@hpcc-js/observablehq-compiler 3.7.1 → 3.7.3
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/dot-DS0nDHkc.js.map +1 -1
- package/dist/duckdb-ZQnOaRxt.js.map +1 -1
- package/dist/{highlight-D4GZSyte.js → highlight-DMD1f-AU.js} +2 -2
- package/dist/{highlight-D4GZSyte.js.map → highlight-DMD1f-AU.js.map} +1 -1
- package/dist/{index-BhLIDOLl.js → index-BEJybQP2.js} +2 -2
- package/dist/{index-BhLIDOLl.js.map → index-BEJybQP2.js.map} +1 -1
- package/dist/{index-1Npg2JBP.js → index-B_MA3pnO.js} +2 -2
- package/dist/{index-1Npg2JBP.js.map → index-B_MA3pnO.js.map} +1 -1
- package/dist/{index-CtJBv-UX.js → index-Bx3I5Hd1.js} +2 -2
- package/dist/{index-CtJBv-UX.js.map → index-Bx3I5Hd1.js.map} +1 -1
- package/dist/{index-1YyP-Dd5.js → index-DX-wW7fi.js} +2 -2
- package/dist/{index-1YyP-Dd5.js.map → index-DX-wW7fi.js.map} +1 -1
- package/dist/{index-DhnKOdJS.js → index-DXoy8fy6.js} +2 -2
- package/dist/{index-DhnKOdJS.js.map → index-DXoy8fy6.js.map} +1 -1
- package/dist/index-DzAd7RhG.js +2 -0
- package/dist/index-DzAd7RhG.js.map +1 -0
- package/dist/leaflet-JfyiggwS.js.map +1 -1
- package/dist/mapboxgl-DqywFqPd.js.map +1 -1
- package/dist/{md-D8g-CkYO.js → md-DCq6DMWq.js} +2 -2
- package/dist/md-DCq6DMWq.js.map +1 -0
- package/dist/mermaid-0kvRJ9Mp.js +2 -0
- package/dist/mermaid-0kvRJ9Mp.js.map +1 -0
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/tex-BV6RAcNQ.js.map +1 -1
- package/dist/vega-lite-Phlb3i_g.js.map +1 -1
- package/package.json +4 -4
- package/dist/index-DnEF9mFX.js +0 -2
- package/dist/index-DnEF9mFX.js.map +0 -1
- package/dist/md-D8g-CkYO.js.map +0 -1
- package/dist/mermaid-DqafRzAu.js +0 -2
- package/dist/mermaid-DqafRzAu.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,n)=>t(e,"name",{value:n,configurable:!0});import{N as n,a as s,s as r,P as i,b as o,c as a,T as l,t as h}from"./highlight-D4GZSyte.js";const f=class _CompositeBlock{static create(t,e,n,s,r){return new _CompositeBlock(t,e,n,s+(s<<8)+t+(e<<4)|0,r,[],[])}constructor(t,e,n,s,r,i,a){this.type=t,this.value=e,this.from=n,this.hash=s,this.end=r,this.children=i,this.positions=a,this.hashProp=[[o.contextHash,s]]}addChild(t,e){t.prop(o.contextHash)!=this.hash&&(t=new l(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,n=this.end){let r=this.children.length-1;return r>=0&&(n=Math.max(n,this.positions[r]+this.children[r].length+this.from)),new l(t.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:/* @__PURE__ */e((t,e,n)=>new l(s.none,t,e,n,this.hashProp),"makeTree")})}};e(f,"CompositeBlock");let d=f;var p,c;(c=p||(p={}))[c.Document=1]="Document",c[c.CodeBlock=2]="CodeBlock",c[c.FencedCode=3]="FencedCode",c[c.Blockquote=4]="Blockquote",c[c.HorizontalRule=5]="HorizontalRule",c[c.BulletList=6]="BulletList",c[c.OrderedList=7]="OrderedList",c[c.ListItem=8]="ListItem",c[c.ATXHeading1=9]="ATXHeading1",c[c.ATXHeading2=10]="ATXHeading2",c[c.ATXHeading3=11]="ATXHeading3",c[c.ATXHeading4=12]="ATXHeading4",c[c.ATXHeading5=13]="ATXHeading5",c[c.ATXHeading6=14]="ATXHeading6",c[c.SetextHeading1=15]="SetextHeading1",c[c.SetextHeading2=16]="SetextHeading2",c[c.HTMLBlock=17]="HTMLBlock",c[c.LinkReference=18]="LinkReference",c[c.Paragraph=19]="Paragraph",c[c.CommentBlock=20]="CommentBlock",c[c.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",c[c.Escape=22]="Escape",c[c.Entity=23]="Entity",c[c.HardBreak=24]="HardBreak",c[c.Emphasis=25]="Emphasis",c[c.StrongEmphasis=26]="StrongEmphasis",c[c.Link=27]="Link",c[c.Image=28]="Image",c[c.InlineCode=29]="InlineCode",c[c.HTMLTag=30]="HTMLTag",c[c.Comment=31]="Comment",c[c.ProcessingInstruction=32]="ProcessingInstruction",c[c.Autolink=33]="Autolink",c[c.HeaderMark=34]="HeaderMark",c[c.QuoteMark=35]="QuoteMark",c[c.ListMark=36]="ListMark",c[c.LinkMark=37]="LinkMark",c[c.EmphasisMark=38]="EmphasisMark",c[c.CodeMark=39]="CodeMark",c[c.CodeText=40]="CodeText",c[c.CodeInfo=41]="CodeInfo",c[c.LinkTitle=42]="LinkTitle",c[c.LinkLabel=43]="LinkLabel",c[c.URL=44]="URL";const u=class _LeafBlock{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}};e(u,"LeafBlock");let g=u;const k=class _Line{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 t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return C(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,n=0){for(let s=e;s<t;s++)n+=9==this.text.charCodeAt(s)?4-n%4:1;return n}findColumn(t){let e=0;for(let n=0;e<this.text.length&&n<t;e++)n+=9==this.text.charCodeAt(e)?4-n%4:1;return e}scrub(){if(!this.baseIndent)return this.text;let t="";for(let e=0;e<this.basePos;e++)t+=" ";return t+this.text.slice(this.basePos)}};e(k,"Line");let m=k;function x(t,e,n){if(n.pos==n.text.length||t!=e.block&&n.indent>=e.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let s=(t.type==p.OrderedList?E:I)(n,e,!1);return s>0&&(t.type!=p.BulletList||w(n,e,!1)<0)&&n.text.charCodeAt(n.pos+s-1)==t.value}e(x,"skipForList");const L={[p.Blockquote]:(t,e,n)=>62==n.next&&(n.markers.push(ht(p.QuoteMark,e.lineStart+n.pos,e.lineStart+n.pos+1)),n.moveBase(n.pos+(b(n.text.charCodeAt(n.pos+1))?2:1)),t.end=e.lineStart+n.text.length,!0),[p.ListItem]:(t,e,n)=>!(n.indent<n.baseIndent+t.value&&n.next>-1)&&(n.moveBaseColumn(n.baseIndent+t.value),!0),[p.OrderedList]:x,[p.BulletList]:x,[p.Document]:()=>!0};function b(t){return 32==t||9==t||10==t||13==t}function C(t,e=0){for(;e<t.length&&b(t.charCodeAt(e));)e++;return e}function S(t,e,n){for(;e>n&&b(t.charCodeAt(e-1));)e--;return e}function y(t){if(96!=t.next&&126!=t.next)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(96==t.next)for(let n=e;n<t.text.length;n++)if(96==t.text.charCodeAt(n))return-1;return e}function A(t){return 62!=t.next?-1:32==t.text.charCodeAt(t.pos+1)?2:1}function w(t,e,n){if(42!=t.next&&45!=t.next&&95!=t.next)return-1;let s=1;for(let r=t.pos+1;r<t.text.length;r++){let e=t.text.charCodeAt(r);if(e==t.next)s++;else if(!b(e))return-1}return n&&45==t.next&&H(t)>-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(q.SetextHeading)>-1||s<3?-1:1}function B(t,e){for(let n=t.stack.length-1;n>=0;n--)if(t.stack[n].type==e)return!0;return!1}function I(t,e,n){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!b(t.text.charCodeAt(t.pos+1))||!(!n||B(e,p.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?-1:1}function E(t,e,n){let s=t.pos,r=t.next;for(;r>=48&&r<=57;){if(s++,s==t.text.length)return-1;r=t.text.charCodeAt(s)}return s==t.pos||s>t.pos+9||46!=r&&41!=r||s<t.text.length-1&&!b(t.text.charCodeAt(s+1))||n&&!B(e,p.OrderedList)&&(t.skipSpace(s+1)==t.text.length||s>t.pos+1||49!=t.next)?-1:s+1-t.pos}function T(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e<t.text.length&&35==t.text.charCodeAt(e);)e++;if(e<t.text.length&&32!=t.text.charCodeAt(e))return-1;let n=e-t.pos;return n>6?-1:n}function H(t){if(45!=t.next&&61!=t.next||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 n=e;for(;e<t.text.length&&b(t.text.charCodeAt(e));)e++;return e==t.text.length?n:-1}e(b,"space"),e(C,"skipSpace"),e(S,"skipSpaceBack"),e(y,"isFencedCode"),e(A,"isBlockquote"),e(w,"isHorizontalRule"),e(B,"inList"),e(I,"isBulletList"),e(E,"isOrderedList"),e(T,"isAtxHeading"),e(H,"isSetextUnderline");const M=/^[ \t]*$/,P=/-->/,v=/\?>/,N=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,P],[/^\s*<\?/,v],[/^\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,M],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,M]];function O(t,e,n){if(60!=t.next)return-1;let s=t.text.slice(t.pos);for(let r=0,i=N.length-(n?1:0);r<i;r++)if(N[r][0].test(s))return r;return-1}function R(t,e){let n=t.countIndent(e,t.pos,t.indent),s=t.countIndent(t.skipSpace(e),e,n);return s>=n+5?n+1:s}function X(t,e,n){let s=t.length-1;s>=0&&t[s].to==e&&t[s].type==p.CodeText?t[s].to=n:t.push(ht(p.CodeText,e,n))}e(O,"isHTMLBlock"),e(R,"getListIndent"),e(X,"addCodeText");const z={LinkReference:void 0,IndentedCode(t,e){let n=e.baseIndent+4;if(e.indent<n)return!1;let s=e.findColumn(n),r=t.lineStart+s,i=t.lineStart+e.text.length,o=[],a=[];for(X(o,r,i);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){X(a,t.lineStart-1,t.lineStart);for(let t of e.markers)a.push(t)}else{if(e.indent<n)break;{if(a.length){for(let t of a)t.type==p.CodeText?X(o,t.from,t.to):o.push(t);a=[]}X(o,t.lineStart-1,t.lineStart);for(let t of e.markers)o.push(t);i=t.lineStart+e.text.length;let n=t.lineStart+e.findColumn(e.baseIndent+4);n<i&&X(o,n,i)}}return a.length&&(a=a.filter(t=>t.type!=p.CodeText),a.length&&(e.markers=a.concat(e.markers))),t.addNode(t.buffer.writeElements(o,-r).finish(p.CodeBlock,i-r),r),!0},FencedCode(t,e){let n=y(e);if(n<0)return!1;let s=t.lineStart+e.pos,r=e.next,i=n-e.pos,o=e.skipSpace(n),a=S(e.text,e.text.length,o),l=[ht(p.CodeMark,s,s+i)];o<a&&l.push(ht(p.CodeInfo,t.lineStart+o,t.lineStart+a));for(let h=!0,f=!0,d=!1;t.nextLine()&&e.depth>=t.stack.length;h=!1){let n=e.pos;if(e.indent-e.baseIndent<4)for(;n<e.text.length&&e.text.charCodeAt(n)==r;)n++;if(n-e.pos>=i&&e.skipSpace(n)==e.text.length){for(let t of e.markers)l.push(t);f&&d&&X(l,t.lineStart-1,t.lineStart),l.push(ht(p.CodeMark,t.lineStart+e.pos,t.lineStart+n)),t.nextLine();break}{d=!0,h||(X(l,t.lineStart-1,t.lineStart),f=!1);for(let t of e.markers)l.push(t);let n=t.lineStart+e.basePos,s=t.lineStart+e.text.length;n<s&&(X(l,n,s),f=!1)}}return t.addNode(t.buffer.writeElements(l,-s).finish(p.FencedCode,t.prevLineEnd()-s),s),!0},Blockquote(t,e){let n=A(e);return!(n<0)&&(t.startContext(p.Blockquote,e.pos),t.addNode(p.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+n),null)},HorizontalRule(t,e){if(w(e,t,!1)<0)return!1;let n=t.lineStart+e.pos;return t.nextLine(),t.addNode(p.HorizontalRule,n),!0},BulletList(t,e){let n=I(e,t,!1);if(n<0)return!1;t.block.type!=p.BulletList&&t.startContext(p.BulletList,e.basePos,e.next);let s=R(e,e.pos+1);return t.startContext(p.ListItem,e.basePos,s-e.baseIndent),t.addNode(p.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(s),null},OrderedList(t,e){let n=E(e,t,!1);if(n<0)return!1;t.block.type!=p.OrderedList&&t.startContext(p.OrderedList,e.basePos,e.text.charCodeAt(e.pos+n-1));let s=R(e,e.pos+n);return t.startContext(p.ListItem,e.basePos,s-e.baseIndent),t.addNode(p.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(s),null},ATXHeading(t,e){let n=T(e);if(n<0)return!1;let s=e.pos,r=t.lineStart+s,i=S(e.text,e.text.length,s),o=i;for(;o>s&&e.text.charCodeAt(o-1)==e.next;)o--;o!=i&&o!=s&&b(e.text.charCodeAt(o-1))||(o=e.text.length);let a=t.buffer.write(p.HeaderMark,0,n).writeElements(t.parser.parseInline(e.text.slice(s+n+1,o),r+n+1),-r);o<e.text.length&&a.write(p.HeaderMark,o-s,i-s);let l=a.finish(p.ATXHeading1-1+n,e.text.length-s);return t.nextLine(),t.addNode(l,r),!0},HTMLBlock(t,e){let n=O(e,0,!1);if(n<0)return!1;let s=t.lineStart+e.pos,r=N[n][1],i=[],o=r!=M;for(;!r.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){o=!1;break}for(let t of e.markers)i.push(t)}o&&t.nextLine();let a=r==P?p.CommentBlock:r==v?p.ProcessingInstructionBlock:p.HTMLBlock,l=t.prevLineEnd();return t.addNode(t.buffer.writeElements(i,-s).finish(a,l-s),s),!0},SetextHeading:void 0},_=class _LinkReferenceParser{constructor(t){this.stage=0,this.elts=[],this.pos=0,this.start=t.start,this.advance(t.content)}nextLine(t,e,n){if(-1==this.stage)return!1;let s=n.content+"\n"+e.scrub(),r=this.advance(s);return r>-1&&r<s.length&&this.complete(t,n,r)}finish(t,e){return(2==this.stage||3==this.stage)&&C(e.content,this.pos)==e.content.length&&this.complete(t,e,e.content.length)}complete(t,e,n){return t.addLeafElement(e,ht(p.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(t){return t?(this.pos=t.to-this.start,this.elts.push(t),this.stage++,!0):(!1===t&&(this.stage=-1),!1)}advance(t){for(;;){if(-1==this.stage)return-1;if(0==this.stage){if(!this.nextStage(St(t,this.pos,this.start,!0)))return-1;if(58!=t.charCodeAt(this.pos))return this.stage=-1;this.elts.push(ht(p.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else{if(1!=this.stage){if(2==this.stage){let e=C(t,this.pos),n=0;if(e>this.pos){let s=Ct(t,e,this.start);if(s){let e=j(t,s.to-this.start);e>0&&(this.nextStage(s),n=e)}}return n||(n=j(t,this.pos)),n>0&&n<t.length?n:-1}return j(t,this.pos)}if(!this.nextStage(bt(t,C(t,this.pos),this.start)))return-1}}}};e(_,"LinkReferenceParser");let D=_;function j(t,e){for(;e<t.length;e++){let n=t.charCodeAt(e);if(10==n)break;if(!b(n))return-1}return e}e(j,"lineEnd");const F=class _SetextHeadingParser{nextLine(t,e,n){let s=e.depth<t.stack.length?-1:H(e),r=e.next;if(s<0)return!1;let i=ht(p.HeaderMark,t.lineStart+e.pos,t.lineStart+s);return t.nextLine(),t.addLeafElement(n,ht(61==r?p.SetextHeading1:p.SetextHeading2,n.start,t.prevLineEnd(),[...t.parser.parseInline(n.content,n.start),i])),!0}finish(){return!1}};e(F,"SetextHeadingParser");let $=F;const q={LinkReference:(t,e)=>91==e.content.charCodeAt(0)?new D(e):null,SetextHeading:()=>new $},U=[(t,e)=>T(e)>=0,(t,e)=>y(e)>=0,(t,e)=>A(e)>=0,(t,e)=>I(e,t,!0)>=0,(t,e)=>E(e,t,!0)>=0,(t,e)=>w(e,t,!0)>=0,(t,e)=>O(e,0,!0)>=0],Q={text:"",end:0},Z=class _BlockContext{constructor(t,e,n,s){this.parser=t,this.input=e,this.ranges=s,this.line=new m,this.atEnd=!1,this.reusePlaceholders=/* @__PURE__ */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=d.create(p.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Et(n,e):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(null!=this.stoppedAt&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:t}=this;for(;;){for(let e=0;;){let n=t.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;e<t.markers.length&&(!n||t.markers[e].from<n.end);){let n=t.markers[e++];this.addNode(n.type,n.from,n.to)}if(!n)break;this.finishContext()}if(t.pos<t.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(t.basePos))return null;t:for(;;){for(let e of this.parser.blockParsers)if(e){let n=e(this,t);if(0!=n){if(1==n)return null;t.forward();continue t}}break}let e=new g(this.lineStart+t.pos,t.text.slice(t.pos));for(let n of this.parser.leafBlockParsers)if(n){let t=n(this,e);t&&e.parsers.push(t)}t:for(;this.nextLine()&&t.pos!=t.text.length;){if(t.indent<t.baseIndent+4)for(let n of this.parser.endLeafBlock)if(n(this,t,e))break t;for(let n of e.parsers)if(n.nextLine(this,t,e))return null;e.content+="\n"+t.scrub();for(let n of t.markers)e.marks.push(n)}return this.finishLeaf(e),null}stopAt(t){if(null!=this.stoppedAt&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}reuseFragment(t){if(!this.fragments.moveTo(this.absoluteLineStart+t,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let e=this.fragments.takeNodes(this);return!!e&&(this.absoluteLineStart+=e,this.lineStart=Tt(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0)}get depth(){return this.stack.length}parentType(t=this.depth-1){return this.parser.nodeSet.types[this.stack[t].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(t){let e=Q;if(e.end=t,t>=this.to)e.text="";else if(e.text=this.lineChunkAt(t),e.end+=e.text.length,this.ranges.length>1){let t=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<e.end;){n++;let s=this.ranges[n].from,r=this.lineChunkAt(s);e.end=s+r.length,e.text=e.text.slice(0,this.ranges[n-1].to-t)+r,t=e.end-e.text.length}}return e}readLine(){let{line:t}=this,{text:e,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,t.reset(e);t.depth<this.stack.length;t.depth++){let e=this.stack[t.depth],n=this.parser.skipContextMarkup[e.type];if(!n)throw new Error("Unhandled block context "+p[e.type]);let s=this.line.markers.length;if(!n(e,this,t)){this.line.markers.length>s&&(e.end=this.line.markers[this.line.markers.length-1].to),t.forward();break}t.forward()}}lineChunkAt(t){let e,n=this.input.chunk(t);if(this.input.lineChunks)e="\n"==n?"":n;else{let t=n.indexOf("\n");e=t<0?n:n.slice(0,t)}return t+e.length>this.to?e.slice(0,this.to-t):e}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(t,e,n=0){this.block=d.create(t,n,this.lineStart+e,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(t,e,n=0){this.startContext(this.parser.getNodeType(t),e,n)}addNode(t,e,n){"number"==typeof t&&(t=new l(this.parser.nodeSet.types[t],nt,nt,(null!=n?n:this.prevLineEnd())-e)),this.block.addChild(t,e-this.block.from)}addElement(t){this.block.addChild(t.toTree(this.parser.nodeSet),t.from-this.block.from)}addLeafElement(t,e){this.addNode(this.buffer.writeElements(wt(e.children,t.marks),-e.from).finish(e.type,e.to-e.from),e.from)}finishContext(){let t=this.stack.pop(),e=this.stack[this.stack.length-1];e.addChild(t.toTree(this.parser.nodeSet),t.from-e.from),this.block=e}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(t){return this.ranges.length>1?V(this.ranges,0,t.topNode,this.ranges[0].from,this.reusePlaceholders):t}finishLeaf(t){for(let n of t.parsers)if(n.finish(this,t))return;let e=wt(this.parser.parseInline(t.content,t.start),t.marks);this.addNode(this.buffer.writeElements(e,-t.start).finish(p.Paragraph,t.content.length),t.start)}elt(t,e,n,s){return"string"==typeof t?ht(this.parser.getNodeType(t),e,n,s):new lt(t,e)}get buffer(){return new rt(this.parser.nodeSet)}};e(Z,"BlockContext");let G=Z;function V(t,n,s,r,i){let o=t[n].to,a=[],h=[],f=s.from+r;function d(e,s){for(;s?e>=o:e>o;){let s=t[n+1].from-o;r+=s,e+=s,n++,o=t[n].to}}e(d,"movePastNext");for(let e=s.firstChild;e;e=e.nextSibling){d(e.from+r,!0);let s,l=e.from+r,p=i.get(e.tree);p?s=p:e.to+r>o?(s=V(t,n,e,r,i),d(e.to+r,!1)):s=e.toTree(),a.push(s),h.push(l-f)}return d(s.to+r,!1),new l(s.type,a,h,s.to+r-f,s.tree?s.tree.propValues:void 0)}e(V,"injectGaps");const J=class _MarkdownParser extends i{constructor(t,e,n,s,r,i,o,a,l){super(),this.nodeSet=t,this.blockParsers=e,this.leafBlockParsers=n,this.blockNames=s,this.endLeafBlock=r,this.skipContextMarkup=i,this.inlineParsers=o,this.inlineNames=a,this.wrappers=l,this.nodeTypes=/* @__PURE__ */Object.create(null);for(let h of t.types)this.nodeTypes[h.name]=h.id}createParse(t,e,n){let s=new G(this,t,e,n);for(let r of this.wrappers)s=r(s,t,e,n);return s}configure(t){let e=Y(t);if(!e)return this;let{nodeSet:i,skipContextMarkup:l}=this,h=this.blockParsers.slice(),f=this.leafBlockParsers.slice(),d=this.blockNames.slice(),c=this.inlineParsers.slice(),u=this.inlineNames.slice(),g=this.endLeafBlock.slice(),k=this.wrappers;if(W(e.defineNodes)){l=Object.assign({},l);let t,h=i.types.slice();for(let n of e.defineNodes){let{name:e,block:r,composite:i,style:f}="string"==typeof n?{name:n}:n;if(h.some(t=>t.name==e))continue;i&&(l[h.length]=(t,e,n)=>i(e,n,t.value));let d=h.length,c=i?["Block","BlockContext"]:r?d>=p.ATXHeading1&&d<=p.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;h.push(s.define({id:d,name:e,props:c&&[[o.group,c]]})),f&&(t||(t={}),Array.isArray(f)||f instanceof a?t[e]=f:Object.assign(t,f))}i=new n(h),t&&(i=i.extend(r(t)))}if(W(e.props)&&(i=i.extend(...e.props)),W(e.remove))for(let n of e.remove){let t=this.blockNames.indexOf(n),e=this.inlineNames.indexOf(n);t>-1&&(h[t]=f[t]=void 0),e>-1&&(c[e]=void 0)}if(W(e.parseBlock))for(let n of e.parseBlock){let t=d.indexOf(n.name);if(t>-1)h[t]=n.parse,f[t]=n.leaf;else{let t=n.before?tt(d,n.before):n.after?tt(d,n.after)+1:d.length-1;h.splice(t,0,n.parse),f.splice(t,0,n.leaf),d.splice(t,0,n.name)}n.endLeaf&&g.push(n.endLeaf)}if(W(e.parseInline))for(let n of e.parseInline){let t=u.indexOf(n.name);if(t>-1)c[t]=n.parse;else{let t=n.before?tt(u,n.before):n.after?tt(u,n.after)+1:u.length-1;c.splice(t,0,n.parse),u.splice(t,0,n.name)}}return e.wrap&&(k=k.concat(e.wrap)),new _MarkdownParser(i,h,f,d,g,l,c,u,k)}getNodeType(t){let e=this.nodeTypes[t];if(null==e)throw new RangeError(`Unknown node type '${t}'`);return e}parseInline(t,e){let n=new At(this,t,e);t:for(let s=e;s<n.end;){let t=n.char(s);for(let e of this.inlineParsers)if(e){let r=e(n,t,s);if(r>=0){s=r;continue t}}s++}return n.resolveMarkers(0)}};e(J,"MarkdownParser");let K=J;function W(t){return null!=t&&t.length>0}function Y(t){if(!Array.isArray(t))return t;if(0==t.length)return null;let n=Y(t[0]);if(1==t.length)return n;let s=Y(t.slice(1));if(!s||!n)return n||s;let r=/* @__PURE__ */e((t,e)=>(t||nt).concat(e||nt),"conc"),i=n.wrap,o=s.wrap;return{props:r(n.props,s.props),defineNodes:r(n.defineNodes,s.defineNodes),parseBlock:r(n.parseBlock,s.parseBlock),parseInline:r(n.parseInline,s.parseInline),remove:r(n.remove,s.remove),wrap:i?o?(t,e,n,s)=>i(o(t,e,n,s),e,n,s):i:o}}function tt(t,e){let n=t.indexOf(e);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return n}e(W,"nonEmpty"),e(Y,"resolveConfig"),e(tt,"findName");let et=[s.none];for(let vt,Nt=1;vt=p[Nt];Nt++)et[Nt]=s.define({id:Nt,name:vt,props:Nt>=p.Escape?[]:[[o.group,Nt in L?["Block","BlockContext"]:["Block","LeafBlock"]]],top:"Document"==vt});const nt=[],st=class _Buffer{constructor(t){this.nodeSet=t,this.content=[],this.nodes=[]}write(t,e,n,s=0){return this.content.push(t,e,n,4+4*s),this}writeElements(t,e=0){for(let n of t)n.writeTo(this,e);return this}finish(t,e){return l.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:t,length:e})}};e(st,"Buffer");let rt=st;const it=class _Element{constructor(t,e,n,s=nt){this.type=t,this.from=e,this.to=n,this.children=s}writeTo(t,e){let n=t.content.length;t.writeElements(this.children,e),t.content.push(this.type,this.from+e,this.to+e,t.content.length+4-n)}toTree(t){return new rt(t).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};e(it,"Element");let ot=it;const at=class _TreeElement{constructor(t,e){this.tree=t,this.from=e}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return nt}writeTo(t,e){t.nodes.push(this.tree),t.content.push(t.nodes.length-1,this.from+e,this.to+e,-1)}toTree(){return this.tree}};e(at,"TreeElement");let lt=at;function ht(t,e,n,s){return new ot(t,e,n,s)}e(ht,"elt");const ft={resolve:"Emphasis",mark:"EmphasisMark"},dt={resolve:"Emphasis",mark:"EmphasisMark"},pt={},ct={},ut=class _InlineDelimiter{constructor(t,e,n,s){this.type=t,this.from=e,this.to=n,this.side=s}};e(ut,"InlineDelimiter");let gt=ut;const kt="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let mt=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{mt=new RegExp("[\\p{S}|\\p{P}]","u")}catch(Pt){}const xt={Escape(t,e,n){if(92!=e||n==t.end-1)return-1;let s=t.char(n+1);for(let r=0;r<32;r++)if(kt.charCodeAt(r)==s)return t.append(ht(p.Escape,n,n+2));return-1},Entity(t,e,n){if(38!=e)return-1;let s=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(t.slice(n+1,n+31));return s?t.append(ht(p.Entity,n,n+1+s[0].length)):-1},InlineCode(t,e,n){if(96!=e||n&&96==t.char(n-1))return-1;let s=n+1;for(;s<t.end&&96==t.char(s);)s++;let r=s-n,i=0;for(;s<t.end;s++)if(96==t.char(s)){if(i++,i==r&&96!=t.char(s+1))return t.append(ht(p.InlineCode,n,s+1,[ht(p.CodeMark,n,n+r),ht(p.CodeMark,s+1-r,s+1)]))}else i=0;return-1},HTMLTag(t,e,n){if(60!=e||n==t.end-1)return-1;let s=t.slice(n+1,t.end),r=/^(?:[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(s);if(r)return t.append(ht(p.Autolink,n,n+1+r[0].length,[ht(p.LinkMark,n,n+1),ht(p.URL,n+1,n+r[0].length),ht(p.LinkMark,n+r[0].length,n+1+r[0].length)]));let i=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(s);if(i)return t.append(ht(p.Comment,n,n+1+i[0].length));let o=/^\?[^]*?\?>/.exec(s);if(o)return t.append(ht(p.ProcessingInstruction,n,n+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(s);return a?t.append(ht(p.HTMLTag,n,n+1+a[0].length)):-1},Emphasis(t,e,n){if(95!=e&&42!=e)return-1;let s=n+1;for(;t.char(s)==e;)s++;let r=t.slice(n-1,n),i=t.slice(s,s+1),o=mt.test(r),a=mt.test(i),l=/\s|^$/.test(r),h=/\s|^$/.test(i),f=!h&&(!a||l||o),d=!l&&(!o||h||a),p=f&&(42==e||!d||o),c=d&&(42==e||!f||a);return t.append(new gt(95==e?ft:dt,n,s,(p?1:0)|(c?2:0)))},HardBreak(t,e,n){if(92==e&&10==t.char(n+1))return t.append(ht(p.HardBreak,n,n+2));if(32==e){let e=n+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=n+2)return t.append(ht(p.HardBreak,n,e+1))}return-1},Link:(t,e,n)=>91==e?t.append(new gt(pt,n,n+1,1)):-1,Image:(t,e,n)=>33==e&&91==t.char(n+1)?t.append(new gt(ct,n,n+2,1)):-1,LinkEnd(t,e,n){if(93!=e)return-1;for(let s=t.parts.length-1;s>=0;s--){let e=t.parts[s];if(e instanceof gt&&(e.type==pt||e.type==ct)){if(!e.side||t.skipSpace(e.to)==n&&!/[(\[]/.test(t.slice(n+1,n+2)))return t.parts[s]=null,-1;let r=t.takeContent(s),i=t.parts[s]=Lt(t,r,e.type==pt?p.Link:p.Image,e.from,n+1);if(e.type==pt)for(let e=0;e<s;e++){let n=t.parts[e];n instanceof gt&&n.type==pt&&(n.side=0)}return i.to}}return-1}};function Lt(t,e,n,s,r){let{text:i}=t,o=t.char(r),a=r;if(e.unshift(ht(p.LinkMark,s,s+(n==p.Image?2:1))),e.push(ht(p.LinkMark,r-1,r)),40==o){let n,s=t.skipSpace(r+1),o=bt(i,s-t.offset,t.offset);o&&(s=t.skipSpace(o.to),s!=o.to&&(n=Ct(i,s-t.offset,t.offset),n&&(s=t.skipSpace(n.to)))),41==t.char(s)&&(e.push(ht(p.LinkMark,r,r+1)),a=s+1,o&&e.push(o),n&&e.push(n),e.push(ht(p.LinkMark,s,a)))}else if(91==o){let n=St(i,r-t.offset,t.offset,!1);n&&(e.push(n),a=n.to)}return ht(n,s,a,e)}function bt(t,e,n){if(60==t.charCodeAt(e)){for(let s=e+1;s<t.length;s++){let r=t.charCodeAt(s);if(62==r)return ht(p.URL,e+n,s+1+n);if(60==r||10==r)return!1}return null}{let s=0,r=e;for(let e=!1;r<t.length;r++){let n=t.charCodeAt(r);if(b(n))break;if(e)e=!1;else if(40==n)s++;else if(41==n){if(!s)break;s--}else 92==n&&(e=!0)}return r>e?ht(p.URL,e+n,r+n):r==t.length&&null}}function Ct(t,e,n){let s=t.charCodeAt(e);if(39!=s&&34!=s&&40!=s)return!1;let r=40==s?41:s;for(let i=e+1,o=!1;i<t.length;i++){let s=t.charCodeAt(i);if(o)o=!1;else{if(s==r)return ht(p.LinkTitle,e+n,i+1+n);92==s&&(o=!0)}}return null}function St(t,e,n,s){for(let r=!1,i=e+1,o=Math.min(t.length,i+999);i<o;i++){let o=t.charCodeAt(i);if(r)r=!1;else{if(93==o)return!s&&ht(p.LinkLabel,e+n,i+1+n);if(s&&!b(o)&&(s=!1),91==o)return!1;92==o&&(r=!0)}}return null}e(Lt,"finishLink"),e(bt,"parseURL"),e(Ct,"parseLinkTitle"),e(St,"parseLinkLabel");const yt=class _InlineContext{constructor(t,e,n){this.parser=t,this.text=e,this.offset=n,this.parts=[]}char(t){return t>=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,n,s,r){return this.append(new gt(t,e,n,(s?1:0)|(r?2:0)))}get hasOpenLink(){for(let t=this.parts.length-1;t>=0;t--){let e=this.parts[t];if(e instanceof gt&&(e.type==pt||e.type==ct))return!0}return!1}addElement(t){return this.append(t)}resolveMarkers(t){for(let n=t;n<this.parts.length;n++){let e=this.parts[n];if(!(e instanceof gt&&e.type.resolve&&2&e.side))continue;let s,r=e.type==ft||e.type==dt,i=e.to-e.from,o=n-1;for(;o>=t;o--){let t=this.parts[o];if(t instanceof gt&&1&t.side&&t.type==e.type&&!(r&&(1&e.side||2&t.side)&&(t.to-t.from+i)%3==0&&((t.to-t.from)%3||i%3))){s=t;break}}if(!s)continue;let a=e.type.resolve,l=[],h=s.from,f=e.to;if(r){let t=Math.min(2,s.to-s.from,i);h=s.to-t,f=e.from+t,a=1==t?"Emphasis":"StrongEmphasis"}s.type.mark&&l.push(this.elt(s.type.mark,h,s.to));for(let t=o+1;t<n;t++)this.parts[t]instanceof ot&&l.push(this.parts[t]),this.parts[t]=null;e.type.mark&&l.push(this.elt(e.type.mark,e.from,f));let d=this.elt(a,h,f,l);this.parts[o]=r&&s.from!=h?new gt(s.type,s.from,h,s.side):null,(this.parts[n]=r&&e.to!=f?new gt(e.type,f,e.to,e.side):null)?this.parts.splice(n,0,d):this.parts[n]=d}let e=[];for(let n=t;n<this.parts.length;n++){let t=this.parts[n];t instanceof ot&&e.push(t)}return e}findOpeningDelimiter(t){for(let e=this.parts.length-1;e>=0;e--){let n=this.parts[e];if(n instanceof gt&&n.type==t&&1&n.side)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}getDelimiterAt(t){let e=this.parts[t];return e instanceof gt?e:null}skipSpace(t){return C(this.text,t-this.offset)+this.offset}elt(t,e,n,s){return"string"==typeof t?ht(this.parser.getNodeType(t),e,n,s):new lt(t,e)}};e(yt,"InlineContext");let At=yt;function wt(t,e){if(!e.length)return t;if(!t.length)return e;let n=t.slice(),s=0;for(let r of e){for(;s<n.length&&n[s].to<r.to;)s++;if(s<n.length&&n[s].from<r.from){let t=n[s];t instanceof ot&&(n[s]=new ot(t.type,t.from,t.to,wt(t.children,[r])))}else n.splice(s++,0,r)}return n}At.linkStart=pt,At.imageStart=ct,e(wt,"injectMarks");const Bt=[p.CodeBlock,p.ListItem,p.OrderedList,p.BulletList],It=class _FragmentCursor{constructor(t,e){this.fragments=t,this.input=e,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,t.length&&(this.fragment=t[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(t,e){for(;this.fragment&&this.fragment.to<=t;)this.nextFragment();if(!this.fragment||this.fragment.from>(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let s=t+this.fragment.offset;for(;n.to<=s;)if(!n.parent())return!1;for(;;){if(n.from>=s)return this.fragment.from<=e;if(!n.childAfter(s))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(o.contextHash)==t}takeNodes(t){let e=this.cursor,n=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),r=t.absoluteLineStart,i=r,o=t.block.children.length,a=i,h=o;for(;;){if(e.to-n>s){if(e.type.isAnonymous&&e.firstChild())continue;break}let r=Tt(e.from-n,t.ranges);if(e.to-n<=t.ranges[t.rangeI].to)t.addNode(e.tree,r);else{let n=new l(t.parser.nodeSet.types[p.Paragraph],[],[],0,t.block.hashProp);t.reusePlaceholders.set(n,e.tree),t.addNode(n,r)}if(e.type.is("Block")&&(Bt.indexOf(e.type.id)<0?(i=e.to-n,o=t.block.children.length):(i=a,o=h,a=e.to-n,h=t.block.children.length)),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return i-r}};e(It,"FragmentCursor");let Et=It;function Tt(t,e){let n=t;for(let s=1;s<e.length;s++){let r=e[s-1].to,i=e[s].from;r<t&&(n-=i-r)}return n}e(Tt,"toRelative");const Ht=r({"Blockquote/...":h.quote,HorizontalRule:h.contentSeparator,"ATXHeading1/... SetextHeading1/...":h.heading1,"ATXHeading2/... SetextHeading2/...":h.heading2,"ATXHeading3/...":h.heading3,"ATXHeading4/...":h.heading4,"ATXHeading5/...":h.heading5,"ATXHeading6/...":h.heading6,"Comment CommentBlock":h.comment,Escape:h.escape,Entity:h.character,"Emphasis/...":h.emphasis,"StrongEmphasis/...":h.strong,"Link/... Image/...":h.link,"OrderedList/... BulletList/...":h.list,"BlockQuote/...":h.quote,"InlineCode CodeText":h.monospace,"URL Autolink":h.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":h.processingInstruction,"CodeInfo LinkLabel":h.labelName,LinkTitle:h.string,Paragraph:h.content}),Mt=new K(new n(et).extend(Ht),Object.keys(z).map(t=>z[t]),Object.keys(z).map(t=>q[t]),Object.keys(z),U,L,Object.keys(xt).map(t=>xt[t]),Object.keys(xt),[]);h.special(h.content),h.processingInstruction,h.special(h.content),h.processingInstruction;export{G as BlockContext,ot as Element,At as InlineContext,g as LeafBlock,m as Line,K as MarkdownParser,Mt as parser};
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
var t=Object.defineProperty,e=(e,n)=>t(e,"name",{value:n,configurable:!0});import{N as n,a as s,s as r,P as i,b as o,c as a,T as l,t as h}from"./highlight-DMD1f-AU.js";const f=class _CompositeBlock{static create(t,e,n,s,r){return new _CompositeBlock(t,e,n,s+(s<<8)+t+(e<<4)|0,r,[],[])}constructor(t,e,n,s,r,i,a){this.type=t,this.value=e,this.from=n,this.hash=s,this.end=r,this.children=i,this.positions=a,this.hashProp=[[o.contextHash,s]]}addChild(t,e){t.prop(o.contextHash)!=this.hash&&(t=new l(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(e)}toTree(t,n=this.end){let r=this.children.length-1;return r>=0&&(n=Math.max(n,this.positions[r]+this.children[r].length+this.from)),new l(t.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:/* @__PURE__ */e((t,e,n)=>new l(s.none,t,e,n,this.hashProp),"makeTree")})}};e(f,"CompositeBlock");let d=f;var p,c;(c=p||(p={}))[c.Document=1]="Document",c[c.CodeBlock=2]="CodeBlock",c[c.FencedCode=3]="FencedCode",c[c.Blockquote=4]="Blockquote",c[c.HorizontalRule=5]="HorizontalRule",c[c.BulletList=6]="BulletList",c[c.OrderedList=7]="OrderedList",c[c.ListItem=8]="ListItem",c[c.ATXHeading1=9]="ATXHeading1",c[c.ATXHeading2=10]="ATXHeading2",c[c.ATXHeading3=11]="ATXHeading3",c[c.ATXHeading4=12]="ATXHeading4",c[c.ATXHeading5=13]="ATXHeading5",c[c.ATXHeading6=14]="ATXHeading6",c[c.SetextHeading1=15]="SetextHeading1",c[c.SetextHeading2=16]="SetextHeading2",c[c.HTMLBlock=17]="HTMLBlock",c[c.LinkReference=18]="LinkReference",c[c.Paragraph=19]="Paragraph",c[c.CommentBlock=20]="CommentBlock",c[c.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",c[c.Escape=22]="Escape",c[c.Entity=23]="Entity",c[c.HardBreak=24]="HardBreak",c[c.Emphasis=25]="Emphasis",c[c.StrongEmphasis=26]="StrongEmphasis",c[c.Link=27]="Link",c[c.Image=28]="Image",c[c.InlineCode=29]="InlineCode",c[c.HTMLTag=30]="HTMLTag",c[c.Comment=31]="Comment",c[c.ProcessingInstruction=32]="ProcessingInstruction",c[c.Autolink=33]="Autolink",c[c.HeaderMark=34]="HeaderMark",c[c.QuoteMark=35]="QuoteMark",c[c.ListMark=36]="ListMark",c[c.LinkMark=37]="LinkMark",c[c.EmphasisMark=38]="EmphasisMark",c[c.CodeMark=39]="CodeMark",c[c.CodeText=40]="CodeText",c[c.CodeInfo=41]="CodeInfo",c[c.LinkTitle=42]="LinkTitle",c[c.LinkLabel=43]="LinkLabel",c[c.URL=44]="URL";const u=class _LeafBlock{constructor(t,e){this.start=t,this.content=e,this.marks=[],this.parsers=[]}};e(u,"LeafBlock");let g=u;const k=class _Line{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 t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return C(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,e=0,n=0){for(let s=e;s<t;s++)n+=9==this.text.charCodeAt(s)?4-n%4:1;return n}findColumn(t){let e=0;for(let n=0;e<this.text.length&&n<t;e++)n+=9==this.text.charCodeAt(e)?4-n%4:1;return e}scrub(){if(!this.baseIndent)return this.text;let t="";for(let e=0;e<this.basePos;e++)t+=" ";return t+this.text.slice(this.basePos)}};e(k,"Line");let m=k;function x(t,e,n){if(n.pos==n.text.length||t!=e.block&&n.indent>=e.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let s=(t.type==p.OrderedList?E:I)(n,e,!1);return s>0&&(t.type!=p.BulletList||w(n,e,!1)<0)&&n.text.charCodeAt(n.pos+s-1)==t.value}e(x,"skipForList");const L={[p.Blockquote]:(t,e,n)=>62==n.next&&(n.markers.push(ht(p.QuoteMark,e.lineStart+n.pos,e.lineStart+n.pos+1)),n.moveBase(n.pos+(b(n.text.charCodeAt(n.pos+1))?2:1)),t.end=e.lineStart+n.text.length,!0),[p.ListItem]:(t,e,n)=>!(n.indent<n.baseIndent+t.value&&n.next>-1)&&(n.moveBaseColumn(n.baseIndent+t.value),!0),[p.OrderedList]:x,[p.BulletList]:x,[p.Document]:()=>!0};function b(t){return 32==t||9==t||10==t||13==t}function C(t,e=0){for(;e<t.length&&b(t.charCodeAt(e));)e++;return e}function S(t,e,n){for(;e>n&&b(t.charCodeAt(e-1));)e--;return e}function y(t){if(96!=t.next&&126!=t.next)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(96==t.next)for(let n=e;n<t.text.length;n++)if(96==t.text.charCodeAt(n))return-1;return e}function A(t){return 62!=t.next?-1:32==t.text.charCodeAt(t.pos+1)?2:1}function w(t,e,n){if(42!=t.next&&45!=t.next&&95!=t.next)return-1;let s=1;for(let r=t.pos+1;r<t.text.length;r++){let e=t.text.charCodeAt(r);if(e==t.next)s++;else if(!b(e))return-1}return n&&45==t.next&&H(t)>-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(q.SetextHeading)>-1||s<3?-1:1}function B(t,e){for(let n=t.stack.length-1;n>=0;n--)if(t.stack[n].type==e)return!0;return!1}function I(t,e,n){return 45!=t.next&&43!=t.next&&42!=t.next||t.pos!=t.text.length-1&&!b(t.text.charCodeAt(t.pos+1))||!(!n||B(e,p.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?-1:1}function E(t,e,n){let s=t.pos,r=t.next;for(;r>=48&&r<=57;){if(s++,s==t.text.length)return-1;r=t.text.charCodeAt(s)}return s==t.pos||s>t.pos+9||46!=r&&41!=r||s<t.text.length-1&&!b(t.text.charCodeAt(s+1))||n&&!B(e,p.OrderedList)&&(t.skipSpace(s+1)==t.text.length||s>t.pos+1||49!=t.next)?-1:s+1-t.pos}function T(t){if(35!=t.next)return-1;let e=t.pos+1;for(;e<t.text.length&&35==t.text.charCodeAt(e);)e++;if(e<t.text.length&&32!=t.text.charCodeAt(e))return-1;let n=e-t.pos;return n>6?-1:n}function H(t){if(45!=t.next&&61!=t.next||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 n=e;for(;e<t.text.length&&b(t.text.charCodeAt(e));)e++;return e==t.text.length?n:-1}e(b,"space"),e(C,"skipSpace"),e(S,"skipSpaceBack"),e(y,"isFencedCode"),e(A,"isBlockquote"),e(w,"isHorizontalRule"),e(B,"inList"),e(I,"isBulletList"),e(E,"isOrderedList"),e(T,"isAtxHeading"),e(H,"isSetextUnderline");const M=/^[ \t]*$/,P=/-->/,v=/\?>/,N=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,P],[/^\s*<\?/,v],[/^\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,M],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,M]];function O(t,e,n){if(60!=t.next)return-1;let s=t.text.slice(t.pos);for(let r=0,i=N.length-(n?1:0);r<i;r++)if(N[r][0].test(s))return r;return-1}function R(t,e){let n=t.countIndent(e,t.pos,t.indent),s=t.countIndent(t.skipSpace(e),e,n);return s>=n+5?n+1:s}function X(t,e,n){let s=t.length-1;s>=0&&t[s].to==e&&t[s].type==p.CodeText?t[s].to=n:t.push(ht(p.CodeText,e,n))}e(O,"isHTMLBlock"),e(R,"getListIndent"),e(X,"addCodeText");const z={LinkReference:void 0,IndentedCode(t,e){let n=e.baseIndent+4;if(e.indent<n)return!1;let s=e.findColumn(n),r=t.lineStart+s,i=t.lineStart+e.text.length,o=[],a=[];for(X(o,r,i);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){X(a,t.lineStart-1,t.lineStart);for(let t of e.markers)a.push(t)}else{if(e.indent<n)break;{if(a.length){for(let t of a)t.type==p.CodeText?X(o,t.from,t.to):o.push(t);a=[]}X(o,t.lineStart-1,t.lineStart);for(let t of e.markers)o.push(t);i=t.lineStart+e.text.length;let n=t.lineStart+e.findColumn(e.baseIndent+4);n<i&&X(o,n,i)}}return a.length&&(a=a.filter(t=>t.type!=p.CodeText),a.length&&(e.markers=a.concat(e.markers))),t.addNode(t.buffer.writeElements(o,-r).finish(p.CodeBlock,i-r),r),!0},FencedCode(t,e){let n=y(e);if(n<0)return!1;let s=t.lineStart+e.pos,r=e.next,i=n-e.pos,o=e.skipSpace(n),a=S(e.text,e.text.length,o),l=[ht(p.CodeMark,s,s+i)];o<a&&l.push(ht(p.CodeInfo,t.lineStart+o,t.lineStart+a));for(let h=!0,f=!0,d=!1;t.nextLine()&&e.depth>=t.stack.length;h=!1){let n=e.pos;if(e.indent-e.baseIndent<4)for(;n<e.text.length&&e.text.charCodeAt(n)==r;)n++;if(n-e.pos>=i&&e.skipSpace(n)==e.text.length){for(let t of e.markers)l.push(t);f&&d&&X(l,t.lineStart-1,t.lineStart),l.push(ht(p.CodeMark,t.lineStart+e.pos,t.lineStart+n)),t.nextLine();break}{d=!0,h||(X(l,t.lineStart-1,t.lineStart),f=!1);for(let t of e.markers)l.push(t);let n=t.lineStart+e.basePos,s=t.lineStart+e.text.length;n<s&&(X(l,n,s),f=!1)}}return t.addNode(t.buffer.writeElements(l,-s).finish(p.FencedCode,t.prevLineEnd()-s),s),!0},Blockquote(t,e){let n=A(e);return!(n<0)&&(t.startContext(p.Blockquote,e.pos),t.addNode(p.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+n),null)},HorizontalRule(t,e){if(w(e,t,!1)<0)return!1;let n=t.lineStart+e.pos;return t.nextLine(),t.addNode(p.HorizontalRule,n),!0},BulletList(t,e){let n=I(e,t,!1);if(n<0)return!1;t.block.type!=p.BulletList&&t.startContext(p.BulletList,e.basePos,e.next);let s=R(e,e.pos+1);return t.startContext(p.ListItem,e.basePos,s-e.baseIndent),t.addNode(p.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(s),null},OrderedList(t,e){let n=E(e,t,!1);if(n<0)return!1;t.block.type!=p.OrderedList&&t.startContext(p.OrderedList,e.basePos,e.text.charCodeAt(e.pos+n-1));let s=R(e,e.pos+n);return t.startContext(p.ListItem,e.basePos,s-e.baseIndent),t.addNode(p.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(s),null},ATXHeading(t,e){let n=T(e);if(n<0)return!1;let s=e.pos,r=t.lineStart+s,i=S(e.text,e.text.length,s),o=i;for(;o>s&&e.text.charCodeAt(o-1)==e.next;)o--;o!=i&&o!=s&&b(e.text.charCodeAt(o-1))||(o=e.text.length);let a=t.buffer.write(p.HeaderMark,0,n).writeElements(t.parser.parseInline(e.text.slice(s+n+1,o),r+n+1),-r);o<e.text.length&&a.write(p.HeaderMark,o-s,i-s);let l=a.finish(p.ATXHeading1-1+n,e.text.length-s);return t.nextLine(),t.addNode(l,r),!0},HTMLBlock(t,e){let n=O(e,0,!1);if(n<0)return!1;let s=t.lineStart+e.pos,r=N[n][1],i=[],o=r!=M;for(;!r.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){o=!1;break}for(let t of e.markers)i.push(t)}o&&t.nextLine();let a=r==P?p.CommentBlock:r==v?p.ProcessingInstructionBlock:p.HTMLBlock,l=t.prevLineEnd();return t.addNode(t.buffer.writeElements(i,-s).finish(a,l-s),s),!0},SetextHeading:void 0},_=class _LinkReferenceParser{constructor(t){this.stage=0,this.elts=[],this.pos=0,this.start=t.start,this.advance(t.content)}nextLine(t,e,n){if(-1==this.stage)return!1;let s=n.content+"\n"+e.scrub(),r=this.advance(s);return r>-1&&r<s.length&&this.complete(t,n,r)}finish(t,e){return(2==this.stage||3==this.stage)&&C(e.content,this.pos)==e.content.length&&this.complete(t,e,e.content.length)}complete(t,e,n){return t.addLeafElement(e,ht(p.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(t){return t?(this.pos=t.to-this.start,this.elts.push(t),this.stage++,!0):(!1===t&&(this.stage=-1),!1)}advance(t){for(;;){if(-1==this.stage)return-1;if(0==this.stage){if(!this.nextStage(St(t,this.pos,this.start,!0)))return-1;if(58!=t.charCodeAt(this.pos))return this.stage=-1;this.elts.push(ht(p.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else{if(1!=this.stage){if(2==this.stage){let e=C(t,this.pos),n=0;if(e>this.pos){let s=Ct(t,e,this.start);if(s){let e=j(t,s.to-this.start);e>0&&(this.nextStage(s),n=e)}}return n||(n=j(t,this.pos)),n>0&&n<t.length?n:-1}return j(t,this.pos)}if(!this.nextStage(bt(t,C(t,this.pos),this.start)))return-1}}}};e(_,"LinkReferenceParser");let D=_;function j(t,e){for(;e<t.length;e++){let n=t.charCodeAt(e);if(10==n)break;if(!b(n))return-1}return e}e(j,"lineEnd");const F=class _SetextHeadingParser{nextLine(t,e,n){let s=e.depth<t.stack.length?-1:H(e),r=e.next;if(s<0)return!1;let i=ht(p.HeaderMark,t.lineStart+e.pos,t.lineStart+s);return t.nextLine(),t.addLeafElement(n,ht(61==r?p.SetextHeading1:p.SetextHeading2,n.start,t.prevLineEnd(),[...t.parser.parseInline(n.content,n.start),i])),!0}finish(){return!1}};e(F,"SetextHeadingParser");let $=F;const q={LinkReference:(t,e)=>91==e.content.charCodeAt(0)?new D(e):null,SetextHeading:()=>new $},U=[(t,e)=>T(e)>=0,(t,e)=>y(e)>=0,(t,e)=>A(e)>=0,(t,e)=>I(e,t,!0)>=0,(t,e)=>E(e,t,!0)>=0,(t,e)=>w(e,t,!0)>=0,(t,e)=>O(e,0,!0)>=0],Q={text:"",end:0},Z=class _BlockContext{constructor(t,e,n,s){this.parser=t,this.input=e,this.ranges=s,this.line=new m,this.atEnd=!1,this.reusePlaceholders=/* @__PURE__ */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=d.create(p.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Et(n,e):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(null!=this.stoppedAt&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:t}=this;for(;;){for(let e=0;;){let n=t.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;e<t.markers.length&&(!n||t.markers[e].from<n.end);){let n=t.markers[e++];this.addNode(n.type,n.from,n.to)}if(!n)break;this.finishContext()}if(t.pos<t.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(t.basePos))return null;t:for(;;){for(let e of this.parser.blockParsers)if(e){let n=e(this,t);if(0!=n){if(1==n)return null;t.forward();continue t}}break}let e=new g(this.lineStart+t.pos,t.text.slice(t.pos));for(let n of this.parser.leafBlockParsers)if(n){let t=n(this,e);t&&e.parsers.push(t)}t:for(;this.nextLine()&&t.pos!=t.text.length;){if(t.indent<t.baseIndent+4)for(let n of this.parser.endLeafBlock)if(n(this,t,e))break t;for(let n of e.parsers)if(n.nextLine(this,t,e))return null;e.content+="\n"+t.scrub();for(let n of t.markers)e.marks.push(n)}return this.finishLeaf(e),null}stopAt(t){if(null!=this.stoppedAt&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}reuseFragment(t){if(!this.fragments.moveTo(this.absoluteLineStart+t,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let e=this.fragments.takeNodes(this);return!!e&&(this.absoluteLineStart+=e,this.lineStart=Tt(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0)}get depth(){return this.stack.length}parentType(t=this.depth-1){return this.parser.nodeSet.types[this.stack[t].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(t){let e=Q;if(e.end=t,t>=this.to)e.text="";else if(e.text=this.lineChunkAt(t),e.end+=e.text.length,this.ranges.length>1){let t=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<e.end;){n++;let s=this.ranges[n].from,r=this.lineChunkAt(s);e.end=s+r.length,e.text=e.text.slice(0,this.ranges[n-1].to-t)+r,t=e.end-e.text.length}}return e}readLine(){let{line:t}=this,{text:e,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,t.reset(e);t.depth<this.stack.length;t.depth++){let e=this.stack[t.depth],n=this.parser.skipContextMarkup[e.type];if(!n)throw new Error("Unhandled block context "+p[e.type]);let s=this.line.markers.length;if(!n(e,this,t)){this.line.markers.length>s&&(e.end=this.line.markers[this.line.markers.length-1].to),t.forward();break}t.forward()}}lineChunkAt(t){let e,n=this.input.chunk(t);if(this.input.lineChunks)e="\n"==n?"":n;else{let t=n.indexOf("\n");e=t<0?n:n.slice(0,t)}return t+e.length>this.to?e.slice(0,this.to-t):e}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(t,e,n=0){this.block=d.create(t,n,this.lineStart+e,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(t,e,n=0){this.startContext(this.parser.getNodeType(t),e,n)}addNode(t,e,n){"number"==typeof t&&(t=new l(this.parser.nodeSet.types[t],nt,nt,(null!=n?n:this.prevLineEnd())-e)),this.block.addChild(t,e-this.block.from)}addElement(t){this.block.addChild(t.toTree(this.parser.nodeSet),t.from-this.block.from)}addLeafElement(t,e){this.addNode(this.buffer.writeElements(wt(e.children,t.marks),-e.from).finish(e.type,e.to-e.from),e.from)}finishContext(){let t=this.stack.pop(),e=this.stack[this.stack.length-1];e.addChild(t.toTree(this.parser.nodeSet),t.from-e.from),this.block=e}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(t){return this.ranges.length>1?V(this.ranges,0,t.topNode,this.ranges[0].from,this.reusePlaceholders):t}finishLeaf(t){for(let n of t.parsers)if(n.finish(this,t))return;let e=wt(this.parser.parseInline(t.content,t.start),t.marks);this.addNode(this.buffer.writeElements(e,-t.start).finish(p.Paragraph,t.content.length),t.start)}elt(t,e,n,s){return"string"==typeof t?ht(this.parser.getNodeType(t),e,n,s):new lt(t,e)}get buffer(){return new rt(this.parser.nodeSet)}};e(Z,"BlockContext");let G=Z;function V(t,n,s,r,i){let o=t[n].to,a=[],h=[],f=s.from+r;function d(e,s){for(;s?e>=o:e>o;){let s=t[n+1].from-o;r+=s,e+=s,n++,o=t[n].to}}e(d,"movePastNext");for(let e=s.firstChild;e;e=e.nextSibling){d(e.from+r,!0);let s,l=e.from+r,p=i.get(e.tree);p?s=p:e.to+r>o?(s=V(t,n,e,r,i),d(e.to+r,!1)):s=e.toTree(),a.push(s),h.push(l-f)}return d(s.to+r,!1),new l(s.type,a,h,s.to+r-f,s.tree?s.tree.propValues:void 0)}e(V,"injectGaps");const J=class _MarkdownParser extends i{constructor(t,e,n,s,r,i,o,a,l){super(),this.nodeSet=t,this.blockParsers=e,this.leafBlockParsers=n,this.blockNames=s,this.endLeafBlock=r,this.skipContextMarkup=i,this.inlineParsers=o,this.inlineNames=a,this.wrappers=l,this.nodeTypes=/* @__PURE__ */Object.create(null);for(let h of t.types)this.nodeTypes[h.name]=h.id}createParse(t,e,n){let s=new G(this,t,e,n);for(let r of this.wrappers)s=r(s,t,e,n);return s}configure(t){let e=Y(t);if(!e)return this;let{nodeSet:i,skipContextMarkup:l}=this,h=this.blockParsers.slice(),f=this.leafBlockParsers.slice(),d=this.blockNames.slice(),c=this.inlineParsers.slice(),u=this.inlineNames.slice(),g=this.endLeafBlock.slice(),k=this.wrappers;if(W(e.defineNodes)){l=Object.assign({},l);let t,h=i.types.slice();for(let n of e.defineNodes){let{name:e,block:r,composite:i,style:f}="string"==typeof n?{name:n}:n;if(h.some(t=>t.name==e))continue;i&&(l[h.length]=(t,e,n)=>i(e,n,t.value));let d=h.length,c=i?["Block","BlockContext"]:r?d>=p.ATXHeading1&&d<=p.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;h.push(s.define({id:d,name:e,props:c&&[[o.group,c]]})),f&&(t||(t={}),Array.isArray(f)||f instanceof a?t[e]=f:Object.assign(t,f))}i=new n(h),t&&(i=i.extend(r(t)))}if(W(e.props)&&(i=i.extend(...e.props)),W(e.remove))for(let n of e.remove){let t=this.blockNames.indexOf(n),e=this.inlineNames.indexOf(n);t>-1&&(h[t]=f[t]=void 0),e>-1&&(c[e]=void 0)}if(W(e.parseBlock))for(let n of e.parseBlock){let t=d.indexOf(n.name);if(t>-1)h[t]=n.parse,f[t]=n.leaf;else{let t=n.before?tt(d,n.before):n.after?tt(d,n.after)+1:d.length-1;h.splice(t,0,n.parse),f.splice(t,0,n.leaf),d.splice(t,0,n.name)}n.endLeaf&&g.push(n.endLeaf)}if(W(e.parseInline))for(let n of e.parseInline){let t=u.indexOf(n.name);if(t>-1)c[t]=n.parse;else{let t=n.before?tt(u,n.before):n.after?tt(u,n.after)+1:u.length-1;c.splice(t,0,n.parse),u.splice(t,0,n.name)}}return e.wrap&&(k=k.concat(e.wrap)),new _MarkdownParser(i,h,f,d,g,l,c,u,k)}getNodeType(t){let e=this.nodeTypes[t];if(null==e)throw new RangeError(`Unknown node type '${t}'`);return e}parseInline(t,e){let n=new At(this,t,e);t:for(let s=e;s<n.end;){let t=n.char(s);for(let e of this.inlineParsers)if(e){let r=e(n,t,s);if(r>=0){s=r;continue t}}s++}return n.resolveMarkers(0)}};e(J,"MarkdownParser");let K=J;function W(t){return null!=t&&t.length>0}function Y(t){if(!Array.isArray(t))return t;if(0==t.length)return null;let n=Y(t[0]);if(1==t.length)return n;let s=Y(t.slice(1));if(!s||!n)return n||s;let r=/* @__PURE__ */e((t,e)=>(t||nt).concat(e||nt),"conc"),i=n.wrap,o=s.wrap;return{props:r(n.props,s.props),defineNodes:r(n.defineNodes,s.defineNodes),parseBlock:r(n.parseBlock,s.parseBlock),parseInline:r(n.parseInline,s.parseInline),remove:r(n.remove,s.remove),wrap:i?o?(t,e,n,s)=>i(o(t,e,n,s),e,n,s):i:o}}function tt(t,e){let n=t.indexOf(e);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return n}e(W,"nonEmpty"),e(Y,"resolveConfig"),e(tt,"findName");let et=[s.none];for(let vt,Nt=1;vt=p[Nt];Nt++)et[Nt]=s.define({id:Nt,name:vt,props:Nt>=p.Escape?[]:[[o.group,Nt in L?["Block","BlockContext"]:["Block","LeafBlock"]]],top:"Document"==vt});const nt=[],st=class _Buffer{constructor(t){this.nodeSet=t,this.content=[],this.nodes=[]}write(t,e,n,s=0){return this.content.push(t,e,n,4+4*s),this}writeElements(t,e=0){for(let n of t)n.writeTo(this,e);return this}finish(t,e){return l.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:t,length:e})}};e(st,"Buffer");let rt=st;const it=class _Element{constructor(t,e,n,s=nt){this.type=t,this.from=e,this.to=n,this.children=s}writeTo(t,e){let n=t.content.length;t.writeElements(this.children,e),t.content.push(this.type,this.from+e,this.to+e,t.content.length+4-n)}toTree(t){return new rt(t).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};e(it,"Element");let ot=it;const at=class _TreeElement{constructor(t,e){this.tree=t,this.from=e}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return nt}writeTo(t,e){t.nodes.push(this.tree),t.content.push(t.nodes.length-1,this.from+e,this.to+e,-1)}toTree(){return this.tree}};e(at,"TreeElement");let lt=at;function ht(t,e,n,s){return new ot(t,e,n,s)}e(ht,"elt");const ft={resolve:"Emphasis",mark:"EmphasisMark"},dt={resolve:"Emphasis",mark:"EmphasisMark"},pt={},ct={},ut=class _InlineDelimiter{constructor(t,e,n,s){this.type=t,this.from=e,this.to=n,this.side=s}};e(ut,"InlineDelimiter");let gt=ut;const kt="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let mt=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{mt=new RegExp("[\\p{S}|\\p{P}]","u")}catch(Pt){}const xt={Escape(t,e,n){if(92!=e||n==t.end-1)return-1;let s=t.char(n+1);for(let r=0;r<32;r++)if(kt.charCodeAt(r)==s)return t.append(ht(p.Escape,n,n+2));return-1},Entity(t,e,n){if(38!=e)return-1;let s=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(t.slice(n+1,n+31));return s?t.append(ht(p.Entity,n,n+1+s[0].length)):-1},InlineCode(t,e,n){if(96!=e||n&&96==t.char(n-1))return-1;let s=n+1;for(;s<t.end&&96==t.char(s);)s++;let r=s-n,i=0;for(;s<t.end;s++)if(96==t.char(s)){if(i++,i==r&&96!=t.char(s+1))return t.append(ht(p.InlineCode,n,s+1,[ht(p.CodeMark,n,n+r),ht(p.CodeMark,s+1-r,s+1)]))}else i=0;return-1},HTMLTag(t,e,n){if(60!=e||n==t.end-1)return-1;let s=t.slice(n+1,t.end),r=/^(?:[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(s);if(r)return t.append(ht(p.Autolink,n,n+1+r[0].length,[ht(p.LinkMark,n,n+1),ht(p.URL,n+1,n+r[0].length),ht(p.LinkMark,n+r[0].length,n+1+r[0].length)]));let i=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(s);if(i)return t.append(ht(p.Comment,n,n+1+i[0].length));let o=/^\?[^]*?\?>/.exec(s);if(o)return t.append(ht(p.ProcessingInstruction,n,n+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(s);return a?t.append(ht(p.HTMLTag,n,n+1+a[0].length)):-1},Emphasis(t,e,n){if(95!=e&&42!=e)return-1;let s=n+1;for(;t.char(s)==e;)s++;let r=t.slice(n-1,n),i=t.slice(s,s+1),o=mt.test(r),a=mt.test(i),l=/\s|^$/.test(r),h=/\s|^$/.test(i),f=!h&&(!a||l||o),d=!l&&(!o||h||a),p=f&&(42==e||!d||o),c=d&&(42==e||!f||a);return t.append(new gt(95==e?ft:dt,n,s,(p?1:0)|(c?2:0)))},HardBreak(t,e,n){if(92==e&&10==t.char(n+1))return t.append(ht(p.HardBreak,n,n+2));if(32==e){let e=n+1;for(;32==t.char(e);)e++;if(10==t.char(e)&&e>=n+2)return t.append(ht(p.HardBreak,n,e+1))}return-1},Link:(t,e,n)=>91==e?t.append(new gt(pt,n,n+1,1)):-1,Image:(t,e,n)=>33==e&&91==t.char(n+1)?t.append(new gt(ct,n,n+2,1)):-1,LinkEnd(t,e,n){if(93!=e)return-1;for(let s=t.parts.length-1;s>=0;s--){let e=t.parts[s];if(e instanceof gt&&(e.type==pt||e.type==ct)){if(!e.side||t.skipSpace(e.to)==n&&!/[(\[]/.test(t.slice(n+1,n+2)))return t.parts[s]=null,-1;let r=t.takeContent(s),i=t.parts[s]=Lt(t,r,e.type==pt?p.Link:p.Image,e.from,n+1);if(e.type==pt)for(let e=0;e<s;e++){let n=t.parts[e];n instanceof gt&&n.type==pt&&(n.side=0)}return i.to}}return-1}};function Lt(t,e,n,s,r){let{text:i}=t,o=t.char(r),a=r;if(e.unshift(ht(p.LinkMark,s,s+(n==p.Image?2:1))),e.push(ht(p.LinkMark,r-1,r)),40==o){let n,s=t.skipSpace(r+1),o=bt(i,s-t.offset,t.offset);o&&(s=t.skipSpace(o.to),s!=o.to&&(n=Ct(i,s-t.offset,t.offset),n&&(s=t.skipSpace(n.to)))),41==t.char(s)&&(e.push(ht(p.LinkMark,r,r+1)),a=s+1,o&&e.push(o),n&&e.push(n),e.push(ht(p.LinkMark,s,a)))}else if(91==o){let n=St(i,r-t.offset,t.offset,!1);n&&(e.push(n),a=n.to)}return ht(n,s,a,e)}function bt(t,e,n){if(60==t.charCodeAt(e)){for(let s=e+1;s<t.length;s++){let r=t.charCodeAt(s);if(62==r)return ht(p.URL,e+n,s+1+n);if(60==r||10==r)return!1}return null}{let s=0,r=e;for(let e=!1;r<t.length;r++){let n=t.charCodeAt(r);if(b(n))break;if(e)e=!1;else if(40==n)s++;else if(41==n){if(!s)break;s--}else 92==n&&(e=!0)}return r>e?ht(p.URL,e+n,r+n):r==t.length&&null}}function Ct(t,e,n){let s=t.charCodeAt(e);if(39!=s&&34!=s&&40!=s)return!1;let r=40==s?41:s;for(let i=e+1,o=!1;i<t.length;i++){let s=t.charCodeAt(i);if(o)o=!1;else{if(s==r)return ht(p.LinkTitle,e+n,i+1+n);92==s&&(o=!0)}}return null}function St(t,e,n,s){for(let r=!1,i=e+1,o=Math.min(t.length,i+999);i<o;i++){let o=t.charCodeAt(i);if(r)r=!1;else{if(93==o)return!s&&ht(p.LinkLabel,e+n,i+1+n);if(s&&!b(o)&&(s=!1),91==o)return!1;92==o&&(r=!0)}}return null}e(Lt,"finishLink"),e(bt,"parseURL"),e(Ct,"parseLinkTitle"),e(St,"parseLinkLabel");const yt=class _InlineContext{constructor(t,e,n){this.parser=t,this.text=e,this.offset=n,this.parts=[]}char(t){return t>=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,e){return this.text.slice(t-this.offset,e-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,e,n,s,r){return this.append(new gt(t,e,n,(s?1:0)|(r?2:0)))}get hasOpenLink(){for(let t=this.parts.length-1;t>=0;t--){let e=this.parts[t];if(e instanceof gt&&(e.type==pt||e.type==ct))return!0}return!1}addElement(t){return this.append(t)}resolveMarkers(t){for(let n=t;n<this.parts.length;n++){let e=this.parts[n];if(!(e instanceof gt&&e.type.resolve&&2&e.side))continue;let s,r=e.type==ft||e.type==dt,i=e.to-e.from,o=n-1;for(;o>=t;o--){let t=this.parts[o];if(t instanceof gt&&1&t.side&&t.type==e.type&&!(r&&(1&e.side||2&t.side)&&(t.to-t.from+i)%3==0&&((t.to-t.from)%3||i%3))){s=t;break}}if(!s)continue;let a=e.type.resolve,l=[],h=s.from,f=e.to;if(r){let t=Math.min(2,s.to-s.from,i);h=s.to-t,f=e.from+t,a=1==t?"Emphasis":"StrongEmphasis"}s.type.mark&&l.push(this.elt(s.type.mark,h,s.to));for(let t=o+1;t<n;t++)this.parts[t]instanceof ot&&l.push(this.parts[t]),this.parts[t]=null;e.type.mark&&l.push(this.elt(e.type.mark,e.from,f));let d=this.elt(a,h,f,l);this.parts[o]=r&&s.from!=h?new gt(s.type,s.from,h,s.side):null,(this.parts[n]=r&&e.to!=f?new gt(e.type,f,e.to,e.side):null)?this.parts.splice(n,0,d):this.parts[n]=d}let e=[];for(let n=t;n<this.parts.length;n++){let t=this.parts[n];t instanceof ot&&e.push(t)}return e}findOpeningDelimiter(t){for(let e=this.parts.length-1;e>=0;e--){let n=this.parts[e];if(n instanceof gt&&n.type==t&&1&n.side)return e}return null}takeContent(t){let e=this.resolveMarkers(t);return this.parts.length=t,e}getDelimiterAt(t){let e=this.parts[t];return e instanceof gt?e:null}skipSpace(t){return C(this.text,t-this.offset)+this.offset}elt(t,e,n,s){return"string"==typeof t?ht(this.parser.getNodeType(t),e,n,s):new lt(t,e)}};e(yt,"InlineContext");let At=yt;function wt(t,e){if(!e.length)return t;if(!t.length)return e;let n=t.slice(),s=0;for(let r of e){for(;s<n.length&&n[s].to<r.to;)s++;if(s<n.length&&n[s].from<r.from){let t=n[s];t instanceof ot&&(n[s]=new ot(t.type,t.from,t.to,wt(t.children,[r])))}else n.splice(s++,0,r)}return n}At.linkStart=pt,At.imageStart=ct,e(wt,"injectMarks");const Bt=[p.CodeBlock,p.ListItem,p.OrderedList,p.BulletList],It=class _FragmentCursor{constructor(t,e){this.fragments=t,this.input=e,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,t.length&&(this.fragment=t[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(t,e){for(;this.fragment&&this.fragment.to<=t;)this.nextFragment();if(!this.fragment||this.fragment.from>(t?t-1:0))return!1;if(this.fragmentEnd<0){let t=this.fragment.to;for(;t>0&&"\n"!=this.input.read(t-1,t);)t--;this.fragmentEnd=t?t-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let s=t+this.fragment.offset;for(;n.to<=s;)if(!n.parent())return!1;for(;;){if(n.from>=s)return this.fragment.from<=e;if(!n.childAfter(s))return!1}}matches(t){let e=this.cursor.tree;return e&&e.prop(o.contextHash)==t}takeNodes(t){let e=this.cursor,n=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),r=t.absoluteLineStart,i=r,o=t.block.children.length,a=i,h=o;for(;;){if(e.to-n>s){if(e.type.isAnonymous&&e.firstChild())continue;break}let r=Tt(e.from-n,t.ranges);if(e.to-n<=t.ranges[t.rangeI].to)t.addNode(e.tree,r);else{let n=new l(t.parser.nodeSet.types[p.Paragraph],[],[],0,t.block.hashProp);t.reusePlaceholders.set(n,e.tree),t.addNode(n,r)}if(e.type.is("Block")&&(Bt.indexOf(e.type.id)<0?(i=e.to-n,o=t.block.children.length):(i=a,o=h),a=e.to-n,h=t.block.children.length),!e.nextSibling())break}for(;t.block.children.length>o;)t.block.children.pop(),t.block.positions.pop();return i-r}};e(It,"FragmentCursor");let Et=It;function Tt(t,e){let n=t;for(let s=1;s<e.length;s++){let r=e[s-1].to,i=e[s].from;r<t&&(n-=i-r)}return n}e(Tt,"toRelative");const Ht=r({"Blockquote/...":h.quote,HorizontalRule:h.contentSeparator,"ATXHeading1/... SetextHeading1/...":h.heading1,"ATXHeading2/... SetextHeading2/...":h.heading2,"ATXHeading3/...":h.heading3,"ATXHeading4/...":h.heading4,"ATXHeading5/...":h.heading5,"ATXHeading6/...":h.heading6,"Comment CommentBlock":h.comment,Escape:h.escape,Entity:h.character,"Emphasis/...":h.emphasis,"StrongEmphasis/...":h.strong,"Link/... Image/...":h.link,"OrderedList/... BulletList/...":h.list,"BlockQuote/...":h.quote,"InlineCode CodeText":h.monospace,"URL Autolink":h.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":h.processingInstruction,"CodeInfo LinkLabel":h.labelName,LinkTitle:h.string,Paragraph:h.content}),Mt=new K(new n(et).extend(Ht),Object.keys(z).map(t=>z[t]),Object.keys(z).map(t=>q[t]),Object.keys(z),U,L,Object.keys(xt).map(t=>xt[t]),Object.keys(xt),[]);h.special(h.content),h.processingInstruction,h.special(h.content),h.processingInstruction;export{G as BlockContext,ot as Element,At as InlineContext,g as LeafBlock,m as Line,K as MarkdownParser,Mt as parser};
|
|
2
|
+
//# sourceMappingURL=index-Bx3I5Hd1.js.map
|