@kerebron/legacy-compat 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{__vite-browser-external-DnLAWTBr.js → __vite-browser-external-DJIAPZnD.js} +2042 -2081
- package/dist/__vite-browser-external-DJIAPZnD.js.map +1 -0
- package/dist/{__vite-browser-external-gNxgT0fB.cjs → __vite-browser-external-P9g2kRCo.cjs} +56 -56
- package/dist/__vite-browser-external-P9g2kRCo.cjs.map +1 -0
- package/dist/{index-D5LPVJ_2.cjs → index-BAyWFBNd.cjs} +2 -2
- package/dist/{index-D5LPVJ_2.cjs.map → index-BAyWFBNd.cjs.map} +1 -1
- package/dist/{index-GQmM8ZH1.cjs → index-BE2In6o2.cjs} +2 -2
- package/dist/{index-GQmM8ZH1.cjs.map → index-BE2In6o2.cjs.map} +1 -1
- package/dist/{index-CYsibC_Y.cjs → index-BFSW_peR.cjs} +2 -2
- package/dist/{index-CYsibC_Y.cjs.map → index-BFSW_peR.cjs.map} +1 -1
- package/dist/{index-BIMMcrEn.cjs → index-BMTsQoz2.cjs} +2 -2
- package/dist/{index-BIMMcrEn.cjs.map → index-BMTsQoz2.cjs.map} +1 -1
- package/dist/{index-ByBFXKHI.cjs → index-BTeCX7iP.cjs} +2 -2
- package/dist/{index-ByBFXKHI.cjs.map → index-BTeCX7iP.cjs.map} +1 -1
- package/dist/{index-CmlvjNNw.cjs → index-BWVpAu-p.cjs} +2 -2
- package/dist/{index-CmlvjNNw.cjs.map → index-BWVpAu-p.cjs.map} +1 -1
- package/dist/{index-etH8lRTC.js → index-BeoygBf9.js} +3 -3
- package/dist/{index-etH8lRTC.js.map → index-BeoygBf9.js.map} +1 -1
- package/dist/{index-BehjXZtR.cjs → index-Bp7UUxhT.cjs} +2 -2
- package/dist/{index-BehjXZtR.cjs.map → index-Bp7UUxhT.cjs.map} +1 -1
- package/dist/{index-CMCho9D9.js → index-C9KkiItn.js} +3 -3
- package/dist/{index-CMCho9D9.js.map → index-C9KkiItn.js.map} +1 -1
- package/dist/{index-F9hQkwOl.js → index-CBdUOmEL.js} +3 -3
- package/dist/{index-F9hQkwOl.js.map → index-CBdUOmEL.js.map} +1 -1
- package/dist/{index-C27X2gp1.cjs → index-CF59nqXM.cjs} +2 -2
- package/dist/{index-C27X2gp1.cjs.map → index-CF59nqXM.cjs.map} +1 -1
- package/dist/{index-CQcr5vou.cjs → index-COvZdI1h.cjs} +2 -2
- package/dist/{index-CQcr5vou.cjs.map → index-COvZdI1h.cjs.map} +1 -1
- package/dist/{index-J8JH2i1N.js → index-CS04VKJ3.js} +3 -3
- package/dist/{index-J8JH2i1N.js.map → index-CS04VKJ3.js.map} +1 -1
- package/dist/{index-CuZ8w_0d.js → index-CWdd_hhx.js} +3 -3
- package/dist/{index-CuZ8w_0d.js.map → index-CWdd_hhx.js.map} +1 -1
- package/dist/{index-C5uMZIEU.js → index-CcXh3eNf.js} +3 -3
- package/dist/{index-C5uMZIEU.js.map → index-CcXh3eNf.js.map} +1 -1
- package/dist/{index-C_POYwzn.cjs → index-D176VpEe.cjs} +2 -2
- package/dist/{index-C_POYwzn.cjs.map → index-D176VpEe.cjs.map} +1 -1
- package/dist/{index-CRg7yAe3.js → index-DMogRlf6.js} +3 -3
- package/dist/{index-CRg7yAe3.js.map → index-DMogRlf6.js.map} +1 -1
- package/dist/{index-CkPesa8p.cjs → index-DU6X4Hss.cjs} +2 -2
- package/dist/{index-CkPesa8p.cjs.map → index-DU6X4Hss.cjs.map} +1 -1
- package/dist/{index-CuhC7CFZ.js → index-DVjJiJX9.js} +3 -3
- package/dist/{index-CuhC7CFZ.js.map → index-DVjJiJX9.js.map} +1 -1
- package/dist/{index-CxSMVDXg.js → index-DfadY3Zk.js} +5 -5
- package/dist/{index-CxSMVDXg.js.map → index-DfadY3Zk.js.map} +1 -1
- package/dist/{index-BgwSuHpP.js → index-DpqS7M88.js} +4 -4
- package/dist/{index-BgwSuHpP.js.map → index-DpqS7M88.js.map} +1 -1
- package/dist/{index-DOqjMtkP.js → index-Dqa1Romt.js} +2 -2
- package/dist/{index-DOqjMtkP.js.map → index-Dqa1Romt.js.map} +1 -1
- package/dist/{index-aase-zLE.cjs → index-DwzMEK1v.cjs} +2 -2
- package/dist/{index-aase-zLE.cjs.map → index-DwzMEK1v.cjs.map} +1 -1
- package/dist/{index--yaou7_d.js → index-UXHQc4zf.js} +3 -3
- package/dist/{index--yaou7_d.js.map → index-UXHQc4zf.js.map} +1 -1
- package/dist/{index-Dn6TAOdP.js → index-cplAmCw7.js} +3 -3
- package/dist/{index-Dn6TAOdP.js.map → index-cplAmCw7.js.map} +1 -1
- package/dist/{index-y2xFk-bx.cjs → index-gJXS1DPx.cjs} +2 -2
- package/dist/{index-y2xFk-bx.cjs.map → index-gJXS1DPx.cjs.map} +1 -1
- package/dist/{index-Cw5C_pdl.cjs → index-osDEQbsO.cjs} +2 -2
- package/dist/{index-Cw5C_pdl.cjs.map → index-osDEQbsO.cjs.map} +1 -1
- package/dist/{index-BjXDWkNj.js → index-pBR7sQhV.js} +3 -3
- package/dist/{index-BjXDWkNj.js.map → index-pBR7sQhV.js.map} +1 -1
- package/dist/{index-Dy01D8fg.cjs → index-u2prMxmu.cjs} +2 -2
- package/dist/{index-Dy01D8fg.cjs.map → index-u2prMxmu.cjs.map} +1 -1
- package/dist/{index-D7RHYCRU.js → index-zYOHSw6y.js} +3 -3
- package/dist/{index-D7RHYCRU.js.map → index-zYOHSw6y.js.map} +1 -1
- package/dist/kerebron-light.css +1 -1
- package/dist/kerebron.cjs +1 -1
- package/dist/kerebron.css +1 -1
- package/dist/kerebron.js +1 -1
- package/package.json +1 -1
- package/dist/__vite-browser-external-DnLAWTBr.js.map +0 -1
- package/dist/__vite-browser-external-gNxgT0fB.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./__vite-browser-external-gNxgT0fB.cjs"),Le=require("./index-CYsibC_Y.cjs");class X{static create(e,r,n,s,i){let o=s+(s<<8)+e+(r<<4)|0;return new X(e,r,n,o,i,[],[])}constructor(e,r,n,s,i,o,a){this.type=e,this.value=r,this.from=n,this.hash=s,this.end=i,this.children=o,this.positions=a,this.hashProp=[[f.NodeProp.contextHash,s]]}addChild(e,r){e.prop(f.NodeProp.contextHash)!=this.hash&&(e=new f.Tree(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new f.Tree(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(s,i,o)=>new f.Tree(f.NodeType.none,s,i,o,this.hashProp)})}}var d;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(d||(d={}));class et{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}}class tt{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 N(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,r=0,n=0){for(let s=r;s<e;s++)n+=this.text.charCodeAt(s)==9?4-n%4:1;return n}findColumn(e){let r=0;for(let n=0;r<this.text.length&&n<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return r}scrub(){if(!this.baseIndent)return this.text;let e="";for(let r=0;r<this.basePos;r++)e+=" ";return e+this.text.slice(this.basePos)}}function se(t,e,r){if(r.pos==r.text.length||t!=e.block&&r.indent>=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==d.OrderedList?ee:W)(r,e,!1);return n>0&&(t.type!=d.BulletList||Y(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}const be={[d.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(g(d.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(x(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[d.ListItem](t,e,r){return r.indent<r.baseIndent+t.value&&r.next>-1?!1:(r.moveBaseColumn(r.baseIndent+t.value),!0)},[d.OrderedList]:se,[d.BulletList]:se,[d.Document](){return!0}};function x(t){return t==32||t==9||t==10||t==13}function N(t,e=0){for(;e<t.length&&x(t.charCodeAt(e));)e++;return e}function ie(t,e,r){for(;e>r&&x(t.charCodeAt(e-1));)e--;return e}function we(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;if(e<t.pos+3)return-1;if(t.next==96){for(let r=e;r<t.text.length;r++)if(t.text.charCodeAt(r)==96)return-1}return e}function Se(t){return t.next!=62?-1:t.text.charCodeAt(t.pos+1)==32?2:1}function Y(t,e,r){if(t.next!=42&&t.next!=45&&t.next!=95)return-1;let n=1;for(let s=t.pos+1;s<t.text.length;s++){let i=t.text.charCodeAt(s);if(i==t.next)n++;else if(!x(i))return-1}return r&&t.next==45&&Ae(t)>-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(Me.SetextHeading)>-1||n<3?-1:1}function Ce(t,e){for(let r=t.stack.length-1;r>=0;r--)if(t.stack[r].type==e)return!0;return!1}function W(t,e,r){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||x(t.text.charCodeAt(t.pos+1)))&&(!r||Ce(e,d.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?1:-1}function ee(t,e,r){let n=t.pos,s=t.next;for(;s>=48&&s<=57;){n++;if(n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||s!=46&&s!=41||n<t.text.length-1&&!x(t.text.charCodeAt(n+1))||r&&!Ce(e,d.OrderedList)&&(t.skipSpace(n+1)==t.text.length||n>t.pos+1||t.next!=49)?-1:n+1-t.pos}function xe(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==35;)e++;if(e<t.text.length&&t.text.charCodeAt(e)!=32)return-1;let r=e-t.pos;return r>6?-1:r}function Ae(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;let r=e;for(;e<t.text.length&&x(t.text.charCodeAt(e));)e++;return e==t.text.length?r:-1}const Z=/^[ \t]*$/,Ee=/-->/,Be=/\?>/,V=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Ee],[/^\s*<\?/,Be],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,Z],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,Z]];function Ie(t,e,r){if(t.next!=60)return-1;let n=t.text.slice(t.pos);for(let s=0,i=V.length-(r?1:0);s<i;s++)if(V[s][0].test(n))return s;return-1}function oe(t,e){let r=t.countIndent(e,t.pos,t.indent),n=t.countIndent(t.skipSpace(e),e,r);return n>=r+5?r+1:n}function I(t,e,r){let n=t.length-1;n>=0&&t[n].to==e&&t[n].type==d.CodeText?t[n].to=r:t.push(g(d.CodeText,e,r))}const z={LinkReference:void 0,IndentedCode(t,e){let r=e.baseIndent+4;if(e.indent<r)return!1;let n=e.findColumn(r),s=t.lineStart+n,i=t.lineStart+e.text.length,o=[],a=[];for(I(o,s,i);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){I(a,t.lineStart-1,t.lineStart);for(let l of e.markers)a.push(l)}else{if(e.indent<r)break;{if(a.length){for(let h of a)h.type==d.CodeText?I(o,h.from,h.to):o.push(h);a=[]}I(o,t.lineStart-1,t.lineStart);for(let h of e.markers)o.push(h);i=t.lineStart+e.text.length;let l=t.lineStart+e.findColumn(e.baseIndent+4);l<i&&I(o,l,i)}}return a.length&&(a=a.filter(l=>l.type!=d.CodeText),a.length&&(e.markers=a.concat(e.markers))),t.addNode(t.buffer.writeElements(o,-s).finish(d.CodeBlock,i-s),s),!0},FencedCode(t,e){let r=we(e);if(r<0)return!1;let n=t.lineStart+e.pos,s=e.next,i=r-e.pos,o=e.skipSpace(r),a=ie(e.text,e.text.length,o),l=[g(d.CodeMark,n,n+i)];o<a&&l.push(g(d.CodeInfo,t.lineStart+o,t.lineStart+a));for(let h=!0;t.nextLine()&&e.depth>=t.stack.length;h=!1){let u=e.pos;if(e.indent-e.baseIndent<4)for(;u<e.text.length&&e.text.charCodeAt(u)==s;)u++;if(u-e.pos>=i&&e.skipSpace(u)==e.text.length){for(let c of e.markers)l.push(c);l.push(g(d.CodeMark,t.lineStart+e.pos,t.lineStart+u)),t.nextLine();break}else{h||I(l,t.lineStart-1,t.lineStart);for(let m of e.markers)l.push(m);let c=t.lineStart+e.basePos,p=t.lineStart+e.text.length;c<p&&I(l,c,p)}}return t.addNode(t.buffer.writeElements(l,-n).finish(d.FencedCode,t.prevLineEnd()-n),n),!0},Blockquote(t,e){let r=Se(e);return r<0?!1:(t.startContext(d.Blockquote,e.pos),t.addNode(d.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+r),null)},HorizontalRule(t,e){if(Y(e,t,!1)<0)return!1;let r=t.lineStart+e.pos;return t.nextLine(),t.addNode(d.HorizontalRule,r),!0},BulletList(t,e){let r=W(e,t,!1);if(r<0)return!1;t.block.type!=d.BulletList&&t.startContext(d.BulletList,e.basePos,e.next);let n=oe(e,e.pos+1);return t.startContext(d.ListItem,e.basePos,n-e.baseIndent),t.addNode(d.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+r),e.moveBaseColumn(n),null},OrderedList(t,e){let r=ee(e,t,!1);if(r<0)return!1;t.block.type!=d.OrderedList&&t.startContext(d.OrderedList,e.basePos,e.text.charCodeAt(e.pos+r-1));let n=oe(e,e.pos+r);return t.startContext(d.ListItem,e.basePos,n-e.baseIndent),t.addNode(d.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+r),e.moveBaseColumn(n),null},ATXHeading(t,e){let r=xe(e);if(r<0)return!1;let n=e.pos,s=t.lineStart+n,i=ie(e.text,e.text.length,n),o=i;for(;o>n&&e.text.charCodeAt(o-1)==e.next;)o--;(o==i||o==n||!x(e.text.charCodeAt(o-1)))&&(o=e.text.length);let a=t.buffer.write(d.HeaderMark,0,r).writeElements(t.parser.parseInline(e.text.slice(n+r+1,o),s+r+1),-s);o<e.text.length&&a.write(d.HeaderMark,o-n,i-n);let l=a.finish(d.ATXHeading1-1+r,e.text.length-n);return t.nextLine(),t.addNode(l,s),!0},HTMLBlock(t,e){let r=Ie(e,t,!1);if(r<0)return!1;let n=t.lineStart+e.pos,s=V[r][1],i=[],o=s!=Z;for(;!s.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){o=!1;break}for(let h of e.markers)i.push(h)}o&&t.nextLine();let a=s==Ee?d.CommentBlock:s==Be?d.ProcessingInstructionBlock:d.HTMLBlock,l=t.prevLineEnd();return t.addNode(t.buffer.writeElements(i,-n).finish(a,l-n),n),!0},SetextHeading:void 0};class rt{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,r,n){if(this.stage==-1)return!1;let s=n.content+`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./__vite-browser-external-P9g2kRCo.cjs"),Le=require("./index-BFSW_peR.cjs");class X{static create(e,r,n,s,i){let o=s+(s<<8)+e+(r<<4)|0;return new X(e,r,n,o,i,[],[])}constructor(e,r,n,s,i,o,a){this.type=e,this.value=r,this.from=n,this.hash=s,this.end=i,this.children=o,this.positions=a,this.hashProp=[[f.NodeProp.contextHash,s]]}addChild(e,r){e.prop(f.NodeProp.contextHash)!=this.hash&&(e=new f.Tree(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new f.Tree(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(s,i,o)=>new f.Tree(f.NodeType.none,s,i,o,this.hashProp)})}}var d;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(d||(d={}));class et{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}}class tt{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 N(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,r=0,n=0){for(let s=r;s<e;s++)n+=this.text.charCodeAt(s)==9?4-n%4:1;return n}findColumn(e){let r=0;for(let n=0;r<this.text.length&&n<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return r}scrub(){if(!this.baseIndent)return this.text;let e="";for(let r=0;r<this.basePos;r++)e+=" ";return e+this.text.slice(this.basePos)}}function se(t,e,r){if(r.pos==r.text.length||t!=e.block&&r.indent>=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==d.OrderedList?ee:W)(r,e,!1);return n>0&&(t.type!=d.BulletList||Y(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}const be={[d.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(g(d.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(x(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[d.ListItem](t,e,r){return r.indent<r.baseIndent+t.value&&r.next>-1?!1:(r.moveBaseColumn(r.baseIndent+t.value),!0)},[d.OrderedList]:se,[d.BulletList]:se,[d.Document](){return!0}};function x(t){return t==32||t==9||t==10||t==13}function N(t,e=0){for(;e<t.length&&x(t.charCodeAt(e));)e++;return e}function ie(t,e,r){for(;e>r&&x(t.charCodeAt(e-1));)e--;return e}function we(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;if(e<t.pos+3)return-1;if(t.next==96){for(let r=e;r<t.text.length;r++)if(t.text.charCodeAt(r)==96)return-1}return e}function Se(t){return t.next!=62?-1:t.text.charCodeAt(t.pos+1)==32?2:1}function Y(t,e,r){if(t.next!=42&&t.next!=45&&t.next!=95)return-1;let n=1;for(let s=t.pos+1;s<t.text.length;s++){let i=t.text.charCodeAt(s);if(i==t.next)n++;else if(!x(i))return-1}return r&&t.next==45&&Ae(t)>-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(Me.SetextHeading)>-1||n<3?-1:1}function Ce(t,e){for(let r=t.stack.length-1;r>=0;r--)if(t.stack[r].type==e)return!0;return!1}function W(t,e,r){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||x(t.text.charCodeAt(t.pos+1)))&&(!r||Ce(e,d.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?1:-1}function ee(t,e,r){let n=t.pos,s=t.next;for(;s>=48&&s<=57;){n++;if(n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||s!=46&&s!=41||n<t.text.length-1&&!x(t.text.charCodeAt(n+1))||r&&!Ce(e,d.OrderedList)&&(t.skipSpace(n+1)==t.text.length||n>t.pos+1||t.next!=49)?-1:n+1-t.pos}function xe(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==35;)e++;if(e<t.text.length&&t.text.charCodeAt(e)!=32)return-1;let r=e-t.pos;return r>6?-1:r}function Ae(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;let r=e;for(;e<t.text.length&&x(t.text.charCodeAt(e));)e++;return e==t.text.length?r:-1}const Z=/^[ \t]*$/,Ee=/-->/,Be=/\?>/,V=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Ee],[/^\s*<\?/,Be],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,Z],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,Z]];function Ie(t,e,r){if(t.next!=60)return-1;let n=t.text.slice(t.pos);for(let s=0,i=V.length-(r?1:0);s<i;s++)if(V[s][0].test(n))return s;return-1}function oe(t,e){let r=t.countIndent(e,t.pos,t.indent),n=t.countIndent(t.skipSpace(e),e,r);return n>=r+5?r+1:n}function I(t,e,r){let n=t.length-1;n>=0&&t[n].to==e&&t[n].type==d.CodeText?t[n].to=r:t.push(g(d.CodeText,e,r))}const z={LinkReference:void 0,IndentedCode(t,e){let r=e.baseIndent+4;if(e.indent<r)return!1;let n=e.findColumn(r),s=t.lineStart+n,i=t.lineStart+e.text.length,o=[],a=[];for(I(o,s,i);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){I(a,t.lineStart-1,t.lineStart);for(let l of e.markers)a.push(l)}else{if(e.indent<r)break;{if(a.length){for(let h of a)h.type==d.CodeText?I(o,h.from,h.to):o.push(h);a=[]}I(o,t.lineStart-1,t.lineStart);for(let h of e.markers)o.push(h);i=t.lineStart+e.text.length;let l=t.lineStart+e.findColumn(e.baseIndent+4);l<i&&I(o,l,i)}}return a.length&&(a=a.filter(l=>l.type!=d.CodeText),a.length&&(e.markers=a.concat(e.markers))),t.addNode(t.buffer.writeElements(o,-s).finish(d.CodeBlock,i-s),s),!0},FencedCode(t,e){let r=we(e);if(r<0)return!1;let n=t.lineStart+e.pos,s=e.next,i=r-e.pos,o=e.skipSpace(r),a=ie(e.text,e.text.length,o),l=[g(d.CodeMark,n,n+i)];o<a&&l.push(g(d.CodeInfo,t.lineStart+o,t.lineStart+a));for(let h=!0;t.nextLine()&&e.depth>=t.stack.length;h=!1){let u=e.pos;if(e.indent-e.baseIndent<4)for(;u<e.text.length&&e.text.charCodeAt(u)==s;)u++;if(u-e.pos>=i&&e.skipSpace(u)==e.text.length){for(let c of e.markers)l.push(c);l.push(g(d.CodeMark,t.lineStart+e.pos,t.lineStart+u)),t.nextLine();break}else{h||I(l,t.lineStart-1,t.lineStart);for(let m of e.markers)l.push(m);let c=t.lineStart+e.basePos,p=t.lineStart+e.text.length;c<p&&I(l,c,p)}}return t.addNode(t.buffer.writeElements(l,-n).finish(d.FencedCode,t.prevLineEnd()-n),n),!0},Blockquote(t,e){let r=Se(e);return r<0?!1:(t.startContext(d.Blockquote,e.pos),t.addNode(d.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+r),null)},HorizontalRule(t,e){if(Y(e,t,!1)<0)return!1;let r=t.lineStart+e.pos;return t.nextLine(),t.addNode(d.HorizontalRule,r),!0},BulletList(t,e){let r=W(e,t,!1);if(r<0)return!1;t.block.type!=d.BulletList&&t.startContext(d.BulletList,e.basePos,e.next);let n=oe(e,e.pos+1);return t.startContext(d.ListItem,e.basePos,n-e.baseIndent),t.addNode(d.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+r),e.moveBaseColumn(n),null},OrderedList(t,e){let r=ee(e,t,!1);if(r<0)return!1;t.block.type!=d.OrderedList&&t.startContext(d.OrderedList,e.basePos,e.text.charCodeAt(e.pos+r-1));let n=oe(e,e.pos+r);return t.startContext(d.ListItem,e.basePos,n-e.baseIndent),t.addNode(d.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+r),e.moveBaseColumn(n),null},ATXHeading(t,e){let r=xe(e);if(r<0)return!1;let n=e.pos,s=t.lineStart+n,i=ie(e.text,e.text.length,n),o=i;for(;o>n&&e.text.charCodeAt(o-1)==e.next;)o--;(o==i||o==n||!x(e.text.charCodeAt(o-1)))&&(o=e.text.length);let a=t.buffer.write(d.HeaderMark,0,r).writeElements(t.parser.parseInline(e.text.slice(n+r+1,o),s+r+1),-s);o<e.text.length&&a.write(d.HeaderMark,o-n,i-n);let l=a.finish(d.ATXHeading1-1+r,e.text.length-n);return t.nextLine(),t.addNode(l,s),!0},HTMLBlock(t,e){let r=Ie(e,t,!1);if(r<0)return!1;let n=t.lineStart+e.pos,s=V[r][1],i=[],o=s!=Z;for(;!s.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){o=!1;break}for(let h of e.markers)i.push(h)}o&&t.nextLine();let a=s==Ee?d.CommentBlock:s==Be?d.ProcessingInstructionBlock:d.HTMLBlock,l=t.prevLineEnd();return t.addNode(t.buffer.writeElements(i,-n).finish(a,l-n),n),!0},SetextHeading:void 0};class rt{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,r,n){if(this.stage==-1)return!1;let s=n.content+`
|
|
2
2
|
`+r.scrub(),i=this.advance(s);return i>-1&&i<s.length?this.complete(e,n,i):!1}finish(e,r){return(this.stage==2||this.stage==3)&&N(r.content,this.pos)==r.content.length?this.complete(e,r,r.content.length):!1}complete(e,r,n){return e.addLeafElement(r,g(d.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(ze(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(g(d.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Re(e,N(e,this.pos),this.start)))return-1}else if(this.stage==2){let r=N(e,this.pos),n=0;if(r>this.pos){let s=Oe(e,r,this.start);if(s){let i=U(e,s.to-this.start);i>0&&(this.nextStage(s),n=i)}}return n||(n=U(e,this.pos)),n>0&&n<e.length?n:-1}else return U(e,this.pos)}}}function U(t,e){for(;e<t.length;e++){let r=t.charCodeAt(e);if(r==10)break;if(!x(r))return-1}return e}class nt{nextLine(e,r,n){let s=r.depth<e.stack.length?-1:Ae(r),i=r.next;if(s<0)return!1;let o=g(d.HeaderMark,e.lineStart+r.pos,e.lineStart+s);return e.nextLine(),e.addLeafElement(n,g(i==61?d.SetextHeading1:d.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}}const Me={LinkReference(t,e){return e.content.charCodeAt(0)==91?new rt(e):null},SetextHeading(){return new nt}},st=[(t,e)=>xe(e)>=0,(t,e)=>we(e)>=0,(t,e)=>Se(e)>=0,(t,e)=>W(e,t,!0)>=0,(t,e)=>ee(e,t,!0)>=0,(t,e)=>Y(e,t,!0)>=0,(t,e)=>Ie(e,t,!0)>=0],it={text:"",end:0};class ot{constructor(e,r,n,s){this.parser=e,this.input=r,this.ranges=s,this.line=new tt,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=s[s.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=s[0].from,this.block=X.create(d.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new ht(n,r):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 s=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!s||e.markers[n].from<s.end);){let i=e.markers[n++];this.addNode(i.type,i.from,i.to)}if(!s)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 s=n(this,e);if(s!=!1){if(s==!0)return null;e.forward();continue e}}break}let r=new et(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let s=n(this,r);s&&r.parsers.push(s)}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,r))break e}for(let n of r.parsers)if(n.nextLine(this,e,r))return null;r.content+=`
|
|
3
3
|
`+e.scrub();for(let n of e.markers)r.marks.push(n)}return this.finishLeaf(r),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 r=this.fragments.takeNodes(this);return r?(this.absoluteLineStart+=r,this.lineStart=De(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 r=it;if(r.end=e,e>=this.to)r.text="";else if(r.text=this.lineChunkAt(e),r.end+=r.text.length,this.ranges.length>1){let n=this.absoluteLineStart,s=this.rangeI;for(;this.ranges[s].to<r.end;){s++;let i=this.ranges[s].from,o=this.lineChunkAt(i);r.end=i+o.length,r.text=r.text.slice(0,this.ranges[s-1].to-n)+o,n=r.end-r.text.length}}return r}readLine(){let{line:e}=this,{text:r,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(r);e.depth<this.stack.length;e.depth++){let s=this.stack[e.depth],i=this.parser.skipContextMarkup[s.type];if(!i)throw new Error("Unhandled block context "+d[s.type]);let o=this.line.markers.length;if(!i(s,this,e)){this.line.markers.length>o&&(s.end=this.line.markers[this.line.markers.length-1].to);break}e.forward()}}lineChunkAt(e){let r=this.input.chunk(e),n;if(this.input.lineChunks)n=r==`
|
|
4
4
|
`?"":r;else{let s=r.indexOf(`
|
|
5
5
|
`);n=s<0?r:r.slice(0,s)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,r,n=0){this.block=X.create(e,n,this.lineStart+r,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,r,n=0){this.startContext(this.parser.getNodeType(e),r,n)}addNode(e,r,n){typeof e=="number"&&(e=new f.Tree(this.parser.nodeSet.types[e],P,P,(n??this.prevLineEnd())-r)),this.block.addChild(e,r-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,r){this.addNode(this.buffer.writeElements(K(r.children,e.marks),-r.from).finish(r.type,r.to-r.from),r.from)}finishContext(){let e=this.stack.pop(),r=this.stack[this.stack.length-1];r.addChild(e.toTree(this.parser.nodeSet),e.from-r.from),this.block=r}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?Pe(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 r=K(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(r,-e.start).finish(d.Paragraph,e.content.length),e.start)}elt(e,r,n,s){return typeof e=="string"?g(this.parser.getNodeType(e),r,n,s):new Ne(e,r)}get buffer(){return new ve(this.parser.nodeSet)}}function Pe(t,e,r,n,s){let i=t[e].to,o=[],a=[],l=r.from+n;function h(u,c){for(;c?u>=i:u>i;){let p=t[e+1].from-i;n+=p,u+=p,e++,i=t[e].to}}for(let u=r.firstChild;u;u=u.nextSibling){h(u.from+n,!0);let c=u.from+n,p,m=s.get(u.tree);m?p=m:u.to+n>i?(p=Pe(t,e,u,n,s),h(u.to+n,!1)):p=u.toTree(),o.push(p),a.push(c-l)}return h(r.to+n,!1),new f.Tree(r.type,o,a,r.to+n-l,r.tree?r.tree.propValues:void 0)}class $ extends f.Parser{constructor(e,r,n,s,i,o,a,l,h){super(),this.nodeSet=e,this.blockParsers=r,this.leafBlockParsers=n,this.blockNames=s,this.endLeafBlock=i,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=h,this.nodeTypes=Object.create(null);for(let u of e.types)this.nodeTypes[u.name]=u.id}createParse(e,r,n){let s=new ot(this,e,r,n);for(let i of this.wrappers)s=i(s,e,r,n);return s}configure(e){let r=G(e);if(!r)return this;let{nodeSet:n,skipContextMarkup:s}=this,i=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),h=this.inlineNames.slice(),u=this.endLeafBlock.slice(),c=this.wrappers;if(v(r.defineNodes)){s=Object.assign({},s);let p=n.types.slice(),m;for(let b of r.defineNodes){let{name:k,block:A,composite:w,style:S}=typeof b=="string"?{name:b}:b;if(p.some(B=>B.name==k))continue;w&&(s[p.length]=(B,H,We)=>w(H,We,B.value));let L=p.length,E=w?["Block","BlockContext"]:A?L>=d.ATXHeading1&&L<=d.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;p.push(f.NodeType.define({id:L,name:k,props:E&&[[f.NodeProp.group,E]]})),S&&(m||(m={}),Array.isArray(S)||S instanceof f.Tag?m[k]=S:Object.assign(m,S))}n=new f.NodeSet(p),m&&(n=n.extend(f.styleTags(m)))}if(v(r.props)&&(n=n.extend(...r.props)),v(r.remove))for(let p of r.remove){let m=this.blockNames.indexOf(p),b=this.inlineNames.indexOf(p);m>-1&&(i[m]=o[m]=void 0),b>-1&&(l[b]=void 0)}if(v(r.parseBlock))for(let p of r.parseBlock){let m=a.indexOf(p.name);if(m>-1)i[m]=p.parse,o[m]=p.leaf;else{let b=p.before?D(a,p.before):p.after?D(a,p.after)+1:a.length-1;i.splice(b,0,p.parse),o.splice(b,0,p.leaf),a.splice(b,0,p.name)}p.endLeaf&&u.push(p.endLeaf)}if(v(r.parseInline))for(let p of r.parseInline){let m=h.indexOf(p.name);if(m>-1)l[m]=p.parse;else{let b=p.before?D(h,p.before):p.after?D(h,p.after)+1:h.length-1;l.splice(b,0,p.parse),h.splice(b,0,p.name)}}return r.wrap&&(c=c.concat(r.wrap)),new $(n,i,o,a,u,s,l,h,c)}getNodeType(e){let r=this.nodeTypes[e];if(r==null)throw new RangeError(`Unknown node type '${e}'`);return r}parseInline(e,r){let n=new te(this,e,r);e:for(let s=r;s<n.end;){let i=n.char(s);for(let o of this.inlineParsers)if(o){let a=o(n,i,s);if(a>=0){s=a;continue e}}s++}return n.resolveMarkers(0)}}function v(t){return t!=null&&t.length>0}function G(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let e=G(t[0]);if(t.length==1)return e;let r=G(t.slice(1));if(!r||!e)return e||r;let n=(o,a)=>(o||P).concat(a||P),s=e.wrap,i=r.wrap;return{props:n(e.props,r.props),defineNodes:n(e.defineNodes,r.defineNodes),parseBlock:n(e.parseBlock,r.parseBlock),parseInline:n(e.parseInline,r.parseInline),remove:n(e.remove,r.remove),wrap:s?i?(o,a,l,h)=>s(i(o,a,l,h),a,l,h):s:i}}function D(t,e){let r=t.indexOf(e);if(r<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return r}let He=[f.NodeType.none];for(let t=1,e;e=d[t];t++)He[t]=f.NodeType.define({id:t,name:e,props:t>=d.Escape?[]:[[f.NodeProp.group,t in be?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const P=[];class ve{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,r,n,s=0){return this.content.push(e,r,n,4+s*4),this}writeElements(e,r=0){for(let n of e)n.writeTo(this,r);return this}finish(e,r){return f.Tree.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:r})}}class T{constructor(e,r,n,s=P){this.type=e,this.from=r,this.to=n,this.children=s}writeTo(e,r){let n=e.content.length;e.writeElements(this.children,r),e.content.push(this.type,this.from+r,this.to+r,e.content.length+4-n)}toTree(e){return new ve(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}}class Ne{constructor(e,r){this.tree=e,this.from=r}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return P}writeTo(e,r){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+r,this.to+r,-1)}toTree(){return this.tree}}function g(t,e,r,n){return new T(t,e,r,n)}const ye={resolve:"Emphasis",mark:"EmphasisMark"},Te={resolve:"Emphasis",mark:"EmphasisMark"},M={},F={};class C{constructor(e,r,n,s){this.type=e,this.from=r,this.to=n,this.side=s}}const ae="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let R=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{R=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const j={Escape(t,e,r){if(e!=92||r==t.end-1)return-1;let n=t.char(r+1);for(let s=0;s<ae.length;s++)if(ae.charCodeAt(s)==n)return t.append(g(d.Escape,r,r+2));return-1},Entity(t,e,r){if(e!=38)return-1;let n=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(t.slice(r+1,r+31));return n?t.append(g(d.Entity,r,r+1+n[0].length)):-1},InlineCode(t,e,r){if(e!=96||r&&t.char(r-1)==96)return-1;let n=r+1;for(;n<t.end&&t.char(n)==96;)n++;let s=n-r,i=0;for(;n<t.end;n++)if(t.char(n)==96){if(i++,i==s&&t.char(n+1)!=96)return t.append(g(d.InlineCode,r,n+1,[g(d.CodeMark,r,r+s),g(d.CodeMark,n+1-s,n+1)]))}else i=0;return-1},HTMLTag(t,e,r){if(e!=60||r==t.end-1)return-1;let n=t.slice(r+1,t.end),s=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(n);if(s)return t.append(g(d.Autolink,r,r+1+s[0].length,[g(d.LinkMark,r,r+1),g(d.URL,r+1,r+s[0].length),g(d.LinkMark,r+s[0].length,r+1+s[0].length)]));let i=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(n);if(i)return t.append(g(d.Comment,r,r+1+i[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(g(d.ProcessingInstruction,r,r+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(g(d.HTMLTag,r,r+1+a[0].length)):-1},Emphasis(t,e,r){if(e!=95&&e!=42)return-1;let n=r+1;for(;t.char(n)==e;)n++;let s=t.slice(r-1,r),i=t.slice(n,n+1),o=R.test(s),a=R.test(i),l=/\s|^$/.test(s),h=/\s|^$/.test(i),u=!h&&(!a||l||o),c=!l&&(!o||h||a),p=u&&(e==42||!c||o),m=c&&(e==42||!u||a);return t.append(new C(e==95?ye:Te,r,n,(p?1:0)|(m?2:0)))},HardBreak(t,e,r){if(e==92&&t.char(r+1)==10)return t.append(g(d.HardBreak,r,r+2));if(e==32){let n=r+1;for(;t.char(n)==32;)n++;if(t.char(n)==10&&n>=r+2)return t.append(g(d.HardBreak,r,n+1))}return-1},Link(t,e,r){return e==91?t.append(new C(M,r,r+1,1)):-1},Image(t,e,r){return e==33&&t.char(r+1)==91?t.append(new C(F,r,r+2,1)):-1},LinkEnd(t,e,r){if(e!=93)return-1;for(let n=t.parts.length-1;n>=0;n--){let s=t.parts[n];if(s instanceof C&&(s.type==M||s.type==F)){if(!s.side||t.skipSpace(s.to)==r&&!/[(\[]/.test(t.slice(r+1,r+2)))return t.parts[n]=null,-1;let i=t.takeContent(n),o=t.parts[n]=at(t,i,s.type==M?d.Link:d.Image,s.from,r+1);if(s.type==M)for(let a=0;a<n;a++){let l=t.parts[a];l instanceof C&&l.type==M&&(l.side=0)}return o.to}}return-1}};function at(t,e,r,n,s){let{text:i}=t,o=t.char(s),a=s;if(e.unshift(g(d.LinkMark,n,n+(r==d.Image?2:1))),e.push(g(d.LinkMark,s-1,s)),o==40){let l=t.skipSpace(s+1),h=Re(i,l-t.offset,t.offset),u;h&&(l=t.skipSpace(h.to),l!=h.to&&(u=Oe(i,l-t.offset,t.offset),u&&(l=t.skipSpace(u.to)))),t.char(l)==41&&(e.push(g(d.LinkMark,s,s+1)),a=l+1,h&&e.push(h),u&&e.push(u),e.push(g(d.LinkMark,l,a)))}else if(o==91){let l=ze(i,s-t.offset,t.offset,!1);l&&(e.push(l),a=l.to)}return g(r,n,a,e)}function Re(t,e,r){if(t.charCodeAt(e)==60){for(let s=e+1;s<t.length;s++){let i=t.charCodeAt(s);if(i==62)return g(d.URL,e+r,s+1+r);if(i==60||i==10)return!1}return null}else{let s=0,i=e;for(let o=!1;i<t.length;i++){let a=t.charCodeAt(i);if(x(a))break;if(o)o=!1;else if(a==40)s++;else if(a==41){if(!s)break;s--}else a==92&&(o=!0)}return i>e?g(d.URL,e+r,i+r):i==t.length?null:!1}}function Oe(t,e,r){let n=t.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let s=n==40?41:n;for(let i=e+1,o=!1;i<t.length;i++){let a=t.charCodeAt(i);if(o)o=!1;else{if(a==s)return g(d.LinkTitle,e+r,i+1+r);a==92&&(o=!0)}}return null}function ze(t,e,r,n){for(let s=!1,i=e+1,o=Math.min(t.length,i+999);i<o;i++){let a=t.charCodeAt(i);if(s)s=!1;else{if(a==93)return n?!1:g(d.LinkLabel,e+r,i+1+r);if(n&&!x(a)&&(n=!1),a==91)return!1;a==92&&(s=!0)}}return null}class te{constructor(e,r,n){this.parser=e,this.text=r,this.offset=n,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,r){return this.text.slice(e-this.offset,r-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,r,n,s,i){return this.append(new C(e,r,n,(s?1:0)|(i?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let r=this.parts[e];if(r instanceof C&&(r.type==M||r.type==F))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n<this.parts.length;n++){let s=this.parts[n];if(!(s instanceof C&&s.type.resolve&&s.side&2))continue;let i=s.type==ye||s.type==Te,o=s.to-s.from,a,l=n-1;for(;l>=e;l--){let k=this.parts[l];if(k instanceof C&&k.side&1&&k.type==s.type&&!(i&&(s.side&1||k.side&2)&&(k.to-k.from+o)%3==0&&((k.to-k.from)%3||o%3))){a=k;break}}if(!a)continue;let h=s.type.resolve,u=[],c=a.from,p=s.to;if(i){let k=Math.min(2,a.to-a.from,o);c=a.to-k,p=s.from+k,h=k==1?"Emphasis":"StrongEmphasis"}a.type.mark&&u.push(this.elt(a.type.mark,c,a.to));for(let k=l+1;k<n;k++)this.parts[k]instanceof T&&u.push(this.parts[k]),this.parts[k]=null;s.type.mark&&u.push(this.elt(s.type.mark,s.from,p));let m=this.elt(h,c,p,u);this.parts[l]=i&&a.from!=c?new C(a.type,a.from,c,a.side):null,(this.parts[n]=i&&s.to!=p?new C(s.type,p,s.to,s.side):null)?this.parts.splice(n,0,m):this.parts[n]=m}let r=[];for(let n=e;n<this.parts.length;n++){let s=this.parts[n];s instanceof T&&r.push(s)}return r}findOpeningDelimiter(e){for(let r=this.parts.length-1;r>=0;r--){let n=this.parts[r];if(n instanceof C&&n.type==e&&n.side&1)return r}return null}takeContent(e){let r=this.resolveMarkers(e);return this.parts.length=e,r}getDelimiterAt(e){let r=this.parts[e];return r instanceof C?r:null}skipSpace(e){return N(this.text,e-this.offset)+this.offset}elt(e,r,n,s){return typeof e=="string"?g(this.parser.getNodeType(e),r,n,s):new Ne(e,r)}}te.linkStart=M;te.imageStart=F;function K(t,e){if(!e.length)return t;if(!t.length)return e;let r=t.slice(),n=0;for(let s of e){for(;n<r.length&&r[n].to<s.to;)n++;if(n<r.length&&r[n].from<s.from){let i=r[n];i instanceof T&&(r[n]=new T(i.type,i.from,i.to,K(i.children,[s])))}else r.splice(n++,0,s)}return r}const lt=[d.CodeBlock,d.ListItem,d.OrderedList,d.BulletList];class ht{constructor(e,r){this.fragments=e,this.input=r,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,r){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let i=this.fragment.to;for(;i>0&&this.input.read(i-1,i)!=`
|
|
6
6
|
`;)i--;this.fragmentEnd=i?i-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let s=e+this.fragment.offset;for(;n.to<=s;)if(!n.parent())return!1;for(;;){if(n.from>=s)return this.fragment.from<=r;if(!n.childAfter(s))return!1}}matches(e){let r=this.cursor.tree;return r&&r.prop(f.NodeProp.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,o=i,a=e.block.children.length,l=o,h=a;for(;;){if(r.to-n>s){if(r.type.isAnonymous&&r.firstChild())continue;break}let u=De(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,u);else{let c=new f.Tree(e.parser.nodeSet.types[d.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(c,r.tree),e.addNode(c,u)}if(r.type.is("Block")&&(lt.indexOf(r.type.id)<0?(o=r.to-n,a=e.block.children.length):(o=l,a=h,l=r.to-n,h=e.block.children.length)),!r.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-i}}function De(t,e){let r=t;for(let n=1;n<e.length;n++){let s=e[n-1].to,i=e[n].from;s<t&&(r-=i-s)}return r}const ft=f.styleTags({"Blockquote/...":f.tags.quote,HorizontalRule:f.tags.contentSeparator,"ATXHeading1/... SetextHeading1/...":f.tags.heading1,"ATXHeading2/... SetextHeading2/...":f.tags.heading2,"ATXHeading3/...":f.tags.heading3,"ATXHeading4/...":f.tags.heading4,"ATXHeading5/...":f.tags.heading5,"ATXHeading6/...":f.tags.heading6,"Comment CommentBlock":f.tags.comment,Escape:f.tags.escape,Entity:f.tags.character,"Emphasis/...":f.tags.emphasis,"StrongEmphasis/...":f.tags.strong,"Link/... Image/...":f.tags.link,"OrderedList/... BulletList/...":f.tags.list,"BlockQuote/...":f.tags.quote,"InlineCode CodeText":f.tags.monospace,"URL Autolink":f.tags.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":f.tags.processingInstruction,"CodeInfo LinkLabel":f.tags.labelName,LinkTitle:f.tags.string,Paragraph:f.tags.content}),ut=new $(new f.NodeSet(He).extend(ft),Object.keys(z).map(t=>z[t]),Object.keys(z).map(t=>Me[t]),Object.keys(z),st,be,Object.keys(j).map(t=>j[t]),Object.keys(j),[]);function dt(t,e,r){let n=[];for(let s=t.firstChild,i=e;;s=s.nextSibling){let o=s?s.from:r;if(o>i&&n.push({from:i,to:o}),!s)break;i=s.to}return n}function pt(t){let{codeParser:e,htmlParser:r}=t;return{wrap:f.parseMixed((s,i)=>{let o=s.type.id;if(e&&(o==d.CodeBlock||o==d.FencedCode)){let a="";if(o==d.FencedCode){let h=s.node.getChild(d.CodeInfo);h&&(a=i.read(h.from,h.to))}let l=e(a);if(l)return{parser:l,overlay:h=>h.type.id==d.CodeText}}else if(r&&(o==d.HTMLBlock||o==d.HTMLTag||o==d.CommentBlock))return{parser:r,overlay:dt(s.node,s.from,s.to)};return null})}}const ct={resolve:"Strikethrough",mark:"StrikethroughMark"},mt={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":f.tags.strikethrough}},{name:"StrikethroughMark",style:f.tags.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,r){if(e!=126||t.char(r+1)!=126||t.char(r+2)==126)return-1;let n=t.slice(r-1,r),s=t.slice(r+2,r+3),i=/\s|^$/.test(n),o=/\s|^$/.test(s),a=R.test(n),l=R.test(s);return t.addDelimiter(ct,r,r+2,!o&&(!l||i||a),!i&&(!a||o||l))},after:"Emphasis"}]};function y(t,e,r=0,n,s=0){let i=0,o=!0,a=-1,l=-1,h=!1,u=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let c=r;c<e.length;c++){let p=e.charCodeAt(c);p==124&&!h?((!o||a>-1)&&i++,o=!1,n&&(a>-1&&u(),n.push(t.elt("TableDelimiter",c+s,c+s+1))),a=l=-1):(h||p!=32&&p!=9)&&(a<0&&(a=c),l=c+1),h=!h&&p==92}return a>-1&&(i++,n&&u()),i}function le(t,e){for(let r=e;r<t.length;r++){let n=t.charCodeAt(r);if(n==124)return!0;n==92&&r++}return!1}const Xe=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class he{constructor(){this.rows=null}nextLine(e,r,n){if(this.rows==null){this.rows=!1;let s;if((r.next==45||r.next==58||r.next==124)&&Xe.test(s=r.text.slice(r.pos))){let i=[];y(e,n.content,0,i,n.start)==y(e,s,r.pos)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,i),e.elt("TableDelimiter",e.lineStart+r.pos,e.lineStart+r.text.length)])}}else if(this.rows){let s=[];y(e,r.text,r.pos,s,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+r.pos,e.lineStart+r.text.length,s))}return!1}finish(e,r){return this.rows?(e.addLeafElement(r,e.elt("Table",r.start,r.start+r.content.length,this.rows)),!0):!1}}const gt={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":f.tags.heading}},"TableRow",{name:"TableCell",style:f.tags.content},{name:"TableDelimiter",style:f.tags.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return le(e.content,0)?new he:null},endLeaf(t,e,r){if(r.parsers.some(s=>s instanceof he)||!le(e.text,e.basePos))return!1;let n=t.peekLine();return Xe.test(n)&&y(t,e.text,e.basePos)==y(t,n,e.basePos)},before:"SetextHeading"}]};class kt{nextLine(){return!1}finish(e,r){return e.addLeafElement(r,e.elt("Task",r.start,r.start+r.content.length,[e.elt("TaskMarker",r.start,r.start+3),...e.parser.parseInline(r.content.slice(3),r.start+3)])),!0}}const Lt={defineNodes:[{name:"Task",block:!0,style:f.tags.list},{name:"TaskMarker",style:f.tags.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new kt:null},after:"SetextHeading"}]},fe=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,ue=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,bt=/[\w-]+\.[\w-]+($|\/)/,de=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,pe=/\/[a-zA-Z\d@.]+/gy;function ce(t,e,r,n){let s=0;for(let i=e;i<r;i++)t[i]==n&&s++;return s}function wt(t,e){ue.lastIndex=e;let r=ue.exec(t);if(!r||bt.exec(r[0])[0].indexOf("_")>-1)return-1;let n=e+r[0].length;for(;;){let s=t[n-1],i;if(/[?!.,:*_~]/.test(s)||s==")"&&ce(t,e,n,")")>ce(t,e,n,"("))n--;else if(s==";"&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,n))))n=e+i.index;else break}return n}function me(t,e){de.lastIndex=e;let r=de.exec(t);if(!r)return-1;let n=r[0][r[0].length-1];return n=="_"||n=="-"?-1:e+r[0].length-(n=="."?1:0)}const St={parseInline:[{name:"Autolink",parse(t,e,r){let n=r-t.offset;if(n&&/\w/.test(t.text[n-1]))return-1;fe.lastIndex=n;let s=fe.exec(t.text),i=-1;if(!s)return-1;if(s[1]||s[2]){if(i=wt(t.text,n+s[0].length),i>-1&&t.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(n,i));i=n+o[0].length}}else s[3]?i=me(t.text,n):(i=me(t.text,n+s[0].length),i>-1&&s[0]=="xmpp:"&&(pe.lastIndex=i,s=pe.exec(t.text),s&&(i=s.index+s[0].length)));return i<0?-1:(t.addElement(t.elt("URL",r,i+t.offset)),i+t.offset)}}]},Ct=[gt,Lt,mt,St];function Fe(t,e,r){return(n,s,i)=>{if(s!=t||n.char(i+1)==t)return-1;let o=[n.elt(r,i,i+1)];for(let a=i+1;a<n.end;a++){let l=n.char(a);if(l==t)return n.addElement(n.elt(e,i,a+1,o.concat(n.elt(r,a,a+1))));if(l==92&&o.push(n.elt("Escape",a,a+++2)),x(l))break}return-1}}const xt={defineNodes:[{name:"Superscript",style:f.tags.special(f.tags.content)},{name:"SuperscriptMark",style:f.tags.processingInstruction}],parseInline:[{name:"Superscript",parse:Fe(94,"Superscript","SuperscriptMark")}]},At={defineNodes:[{name:"Subscript",style:f.tags.special(f.tags.content)},{name:"SubscriptMark",style:f.tags.processingInstruction}],parseInline:[{name:"Subscript",parse:Fe(126,"Subscript","SubscriptMark")}]},Et={defineNodes:[{name:"Emoji",style:f.tags.character}],parseInline:[{name:"Emoji",parse(t,e,r){let n;return e!=58||!(n=/^[a-zA-Z_0-9]+:/.exec(t.slice(r+1,t.end)))?-1:t.addElement(t.elt("Emoji",r,r+1+n[0].length))}}]},$e=f.defineLanguageFacet({commentTokens:{block:{open:"<!--",close:"-->"}}}),Ue=new f.NodeProp,je=ut.configure({props:[f.foldNodeProp.add(t=>!t.is("Block")||t.is("Document")||J(t)!=null||Bt(t)?void 0:(e,r)=>({from:r.doc.lineAt(e.from).to,to:e.to})),Ue.add(J),f.indentNodeProp.add({Document:()=>null}),f.languageDataProp.add({Document:$e})]});function J(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function Bt(t){return t.name=="OrderedList"||t.name=="BulletList"}function It(t,e){let r=t;for(;;){let n=r.nextSibling,s;if(!n||(s=J(n.type))!=null&&s<=e)break;r=n}return r.to}const Mt=f.foldService.of((t,e,r)=>{for(let n=f.syntaxTree(t).resolveInner(r,-1);n&&!(n.from<e);n=n.parent){let s=n.type.prop(Ue);if(s==null)continue;let i=It(n,s);if(i>r)return{from:r,to:i}}return null});function re(t){return new f.Language($e,t,[],"markdown")}const _e=re(je),Pt=je.configure([Ct,At,xt,Et,{props:[f.foldNodeProp.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),O=re(Pt);function Ht(t,e){return r=>{if(r&&t){let n=null;if(r=/\S*/.exec(r)[0],typeof t=="function"?n=t(r):n=f.LanguageDescription.matchLanguageName(t,r,!0),n instanceof f.LanguageDescription)return n.support?n.support.language.parser:f.ParseContext.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}class _{constructor(e,r,n,s,i,o,a){this.node=e,this.from=r,this.to=n,this.spaceBefore=s,this.spaceAfter=i,this.type=o,this.item=a}blank(e,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length<e;)n+=" ";return n}else{for(let s=this.to-this.from-n.length-this.spaceAfter.length;s>0;s--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(e,r){let n=this.node.name=="OrderedList"?String(+Qe(this.item,e)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function qe(t,e){let r=[],n=[];for(let s=t;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&r.push(s)}for(let s=r.length-1;s>=0;s--){let i=r[s],o,a=e.lineAt(i.from),l=i.from-a.from;if(i.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))n.push(new _(i,l,l+o[0].length,"",o[1],">",null));else if(i.name=="ListItem"&&i.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let h=o[3],u=o[0].length;h.length>=4&&(h=h.slice(0,h.length-4),u-=4),n.push(new _(i.parent,l,l+u,o[1],h,o[2],i))}else if(i.name=="ListItem"&&i.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let h=o[4],u=o[0].length;h.length>4&&(h=h.slice(0,h.length-4),u-=4);let c=o[2];o[3]&&(c+=o[3].replace(/[xX]/," ")),n.push(new _(i.parent,l,l+u,o[1],h,c,i))}}return n}function Qe(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function q(t,e,r,n=0){for(let s=-1,i=t;;){if(i.name=="ListItem"){let a=Qe(i,e),l=+a[2];if(s>=0){if(l!=s+1)return;r.push({from:i.from+a[1].length,to:i.from+a[0].length,insert:String(s+2+n)})}s=l}let o=i.nextSibling;if(!o)break;i=o}}function ne(t,e){let r=/^[ \t]*/.exec(t)[0].length;if(!r||e.facet(f.indentUnit)!=" ")return t;let n=f.countColumn(t,4,r),s="";for(let i=n;i>0;)i>=4?(s+=" ",i-=4):(s+=" ",i--);return s+t.slice(r)}const Ze=(t={})=>({state:e,dispatch:r})=>{let n=f.syntaxTree(e),{doc:s}=e,i=null,o=e.changeByRange(a=>{if(!a.empty||!O.isActiveAt(e,a.from,-1)&&!O.isActiveAt(e,a.from,1))return i={range:a};let l=a.from,h=s.lineAt(l),u=qe(n.resolveInner(l,-1),s);for(;u.length&&u[u.length-1].from>l-h.from;)u.pop();if(!u.length)return i={range:a};let c=u[u.length-1];if(c.to-c.spaceAfter.length>l-h.from)return i={range:a};let p=l>=c.to-c.spaceAfter.length&&!/\S/.test(h.text.slice(c.to));if(c.item&&p){let w=c.node.firstChild,S=c.node.getChild("ListItem","ListItem");if(w.to>=l||S&&S.to<l||h.from>0&&!/[^\s>]/.test(s.lineAt(h.from-1).text)||t.nonTightLists===!1){let L=u.length>1?u[u.length-2]:null,E,B="";L&&L.item?(E=h.from+L.from,B=L.marker(s,1)):E=h.from+(L?L.to:0);let H=[{from:E,to:l,insert:B}];return c.node.name=="OrderedList"&&q(c.item,s,H,-2),L&&L.node.name=="OrderedList"&&q(L.item,s,H),{range:f.EditorSelection.cursor(E+B.length),changes:H}}else{let L=ke(u,e,h);return{range:f.EditorSelection.cursor(l+L.length+1),changes:{from:h.from,insert:L+e.lineBreak}}}}if(c.node.name=="Blockquote"&&p&&h.from){let w=s.lineAt(h.from-1),S=/>\s*$/.exec(w.text);if(S&&S.index==c.from){let L=e.changes([{from:w.from+S.index,to:w.to},{from:h.from+c.from,to:h.to}]);return{range:a.map(L),changes:L}}}let m=[];c.node.name=="OrderedList"&&q(c.item,s,m);let b=c.item&&c.item.from<h.from,k="";if(!b||/^[\s\d.)\-+*>]*/.exec(h.text)[0].length>=c.to)for(let w=0,S=u.length-1;w<=S;w++)k+=w==S&&!b?u[w].marker(s,1):u[w].blank(w<S?f.countColumn(h.text,4,u[w+1].from)-k.length:null);let A=l;for(;A>h.from&&/\s/.test(h.text.charAt(A-h.from-1));)A--;return k=ne(k,e),vt(c.node,e.doc)&&(k=ke(u,e,h)+e.lineBreak+k),m.push({from:A,to:l,insert:e.lineBreak+k}),{range:f.EditorSelection.cursor(A+k.length+1),changes:m}});return i?!1:(r(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},Ve=Ze();function ge(t){return t.name=="QuoteMark"||t.name=="ListMark"}function vt(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let r=t.firstChild,n=t.getChild("ListItem","ListItem");if(!n)return!1;let s=e.lineAt(r.to),i=e.lineAt(n.from),o=/^[\s>]*$/.test(s.text);return s.number+(o?0:1)<i.number}function ke(t,e,r){let n="";for(let s=0,i=t.length-2;s<=i;s++)n+=t[s].blank(s<i?f.countColumn(r.text,4,t[s+1].from)-n.length:null,s<i);return ne(n,e)}function Nt(t,e){let r=t.resolveInner(e,-1),n=e;ge(r)&&(n=r.from,r=r.parent);for(let s;s=r.childBefore(n);)if(ge(s))n=s.from;else if(s.name=="OrderedList"||s.name=="BulletList")r=s.lastChild,n=r.to;else break;return r}const Ge=({state:t,dispatch:e})=>{let r=f.syntaxTree(t),n=null,s=t.changeByRange(i=>{let o=i.from,{doc:a}=t;if(i.empty&&O.isActiveAt(t,i.from)){let l=a.lineAt(o),h=qe(Nt(r,o),a);if(h.length){let u=h[h.length-1],c=u.to-u.spaceAfter.length+(u.spaceAfter?1:0);if(o-l.from>c&&!/\S/.test(l.text.slice(c,o-l.from)))return{range:f.EditorSelection.cursor(l.from+c),changes:{from:l.from+c,to:o}};if(o-l.from==c&&(!u.item||l.from<=u.item.from||!/\S/.test(l.text.slice(0,u.to)))){let p=l.from+u.from;if(u.item&&u.node.from<u.item.from&&/\S/.test(l.text.slice(u.from,u.to))){let m=u.blank(f.countColumn(l.text,4,u.to)-f.countColumn(l.text,4,u.from));return p==l.from&&(m=ne(m,t)),{range:f.EditorSelection.cursor(p+m.length),changes:{from:p,to:l.from+u.to,insert:m}}}if(p<o)return{range:f.EditorSelection.cursor(p),changes:{from:p,to:o}}}}}return n={range:i}});return n?!1:(e(t.update(s,{scrollIntoView:!0,userEvent:"delete"})),!0)},Ke=[{key:"Enter",run:Ve},{key:"Backspace",run:Ge}],Je=Le.html({matchClosingTags:!1});function yt(t={}){let{codeLanguages:e,defaultCodeLanguage:r,addKeymap:n=!0,base:{parser:s}=_e,completeHTMLTags:i=!0,pasteURLAsLink:o=!0,htmlTagLanguage:a=Je}=t;if(!(s instanceof $))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=t.extensions?[t.extensions]:[],h=[a.support,Mt],u;o&&h.push(Ye),r instanceof f.LanguageSupport?(h.push(r.support),u=r.language):r&&(u=r);let c=e||u?Ht(e,u):void 0;l.push(pt({codeParser:c,htmlParser:a.language.parser})),n&&h.push(f.Prec.high(f.keymap.of(Ke)));let p=re(s.configure(l));return i&&h.push(p.data.of({autocomplete:Tt})),new f.LanguageSupport(p,h)}function Tt(t){let{state:e,pos:r}=t,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(r-25,r));if(!n)return null;let s=f.syntaxTree(e).resolveInner(r,-1);for(;s&&!s.type.isTop;){if(s.name=="CodeBlock"||s.name=="FencedCode"||s.name=="ProcessingInstructionBlock"||s.name=="CommentBlock"||s.name=="Link"||s.name=="Image")return null;s=s.parent}return{from:r-n[0].length,to:r,options:Rt(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let Q=null;function Rt(){if(Q)return Q;let t=Le.htmlCompletionSource(new f.CompletionContext(f.EditorState.create({extensions:Je}),0,!0));return Q=t?t.options:[]}const Ot=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Ye=f.EditorView.domEventHandlers({paste:(t,e)=>{var r;let{main:n}=e.state.selection;if(n.empty)return!1;let s=(r=t.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!O.isActiveAt(e.state,n.from,1)))return!1;let i=f.syntaxTree(e.state),o=!1;return i.iterate({from:n.from,to:n.to,enter:a=>{(a.from>n.from||Ot.test(a.name))&&(o=!0)},leave:a=>{a.to<n.to&&(o=!0)}}),o?!1:(e.dispatch({changes:[{from:n.from,insert:"["},{from:n.to,insert:`](${s})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}});exports.commonmarkLanguage=_e;exports.deleteMarkupBackward=Ge;exports.insertNewlineContinueMarkup=Ve;exports.insertNewlineContinueMarkupCommand=Ze;exports.markdown=yt;exports.markdownKeymap=Ke;exports.markdownLanguage=O;exports.pasteURLAsLink=Ye;
|
|
7
|
-
//# sourceMappingURL=index-
|
|
7
|
+
//# sourceMappingURL=index-Bp7UUxhT.cjs.map
|