12 lines
46 KiB
JavaScript
12 lines
46 KiB
JavaScript
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
var Z=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var Je=Object.prototype.hasOwnProperty;var Ye=(t,e)=>{for(var n in e)Z(t,n,{get:e[n],enumerable:!0})},et=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ve(e))!Je.call(t,s)&&s!==n&&Z(t,s,{get:()=>e[s],enumerable:!(r=Ke(e,s))||r.enumerable});return t};var tt=t=>et(Z({},"__esModule",{value:!0}),t);var Mt={};Ye(Mt,{default:()=>_});module.exports=tt(Mt);var F=require("obsidian"),M=require("@codemirror/view"),Ze=require("@codemirror/language"),B=require("@codemirror/state");var L=require("@lezer/common"),p=require("@lezer/highlight"),z=class t{static create(e,n,r,s,i){let o=s+(s<<8)+e+(n<<4)|0;return new t(e,n,r,o,i,[],[])}constructor(e,n,r,s,i,o,a){this.type=e,this.value=n,this.from=r,this.hash=s,this.end=i,this.children=o,this.positions=a,this.hashProp=[[L.NodeProp.contextHash,s]]}addChild(e,n){e.prop(L.NodeProp.contextHash)!=this.hash&&(e=new L.Tree(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(n)}toTree(e,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.Tree(e.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(s,i,o)=>new L.Tree(L.NodeType.none,s,i,o,this.hashProp)})}},h;(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"})(h||(h={}));var W=class{constructor(e,n){this.start=e,this.content=n,this.marks=[],this.parsers=[]}},K=class{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,n=0,r=0){for(let s=n;s<e;s++)r+=this.text.charCodeAt(s)==9?4-r%4:1;return r}findColumn(e){let n=0;for(let r=0;n<this.text.length&&r<e;n++)r+=this.text.charCodeAt(n)==9?4-r%4:1;return n}scrub(){if(!this.baseIndent)return this.text;let e="";for(let n=0;n<this.basePos;n++)e+=" ";return e+this.text.slice(this.basePos)}};function ke(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 r=(t.type==h.OrderedList?ue:he)(n,e,!1);return r>0&&(t.type!=h.BulletList||le(n,e,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==t.value}var Ee={[h.Blockquote](t,e,n){return n.next!=62?!1:(n.markers.push(k(h.QuoteMark,e.lineStart+n.pos,e.lineStart+n.pos+1)),n.moveBase(n.pos+(E(n.text.charCodeAt(n.pos+1))?2:1)),t.end=e.lineStart+n.text.length,!0)},[h.ListItem](t,e,n){return n.indent<n.baseIndent+t.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+t.value),!0)},[h.OrderedList]:ke,[h.BulletList]:ke,[h.Document](){return!0}};function E(t){return t==32||t==9||t==10||t==13}function N(t,e=0){for(;e<t.length&&E(t.charCodeAt(e));)e++;return e}function be(t,e,n){for(;e>n&&E(t.charCodeAt(e-1));)e--;return e}function Me(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 n=e;n<t.text.length;n++)if(t.text.charCodeAt(n)==96)return-1}return e}function Ie(t){return t.next!=62?-1:t.text.charCodeAt(t.pos+1)==32?2:1}function le(t,e,n){if(t.next!=42&&t.next!=45&&t.next!=95)return-1;let r=1;for(let s=t.pos+1;s<t.text.length;s++){let i=t.text.charCodeAt(s);if(i==t.next)r++;else if(!E(i))return-1}return n&&t.next==45&&He(t)>-1&&t.depth==e.stack.length||r<3?-1:1}function xe(t,e){for(let n=t.stack.length-1;n>=0;n--)if(t.stack[n].type==e)return!0;return!1}function he(t,e,n){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||E(t.text.charCodeAt(t.pos+1)))&&(!n||xe(e,h.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?1:-1}function ue(t,e,n){let r=t.pos,s=t.next;for(;s>=48&&s<=57;){r++;if(r==t.text.length)return-1;s=t.text.charCodeAt(r)}return r==t.pos||r>t.pos+9||s!=46&&s!=41||r<t.text.length-1&&!E(t.text.charCodeAt(r+1))||n&&!xe(e,h.OrderedList)&&(t.skipSpace(r+1)==t.text.length||r>t.pos+1||t.next!=49)?-1:r+1-t.pos}function Ae(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 n=e-t.pos;return n>6?-1:n}function He(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 n=e;for(;e<t.text.length&&E(t.text.charCodeAt(e));)e++;return e==t.text.length?n:-1}var V=/^[ \t]*$/,Be=/-->/,ye=/\?>/,J=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Be],[/^\s*<\?/,ye],[/^\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,V],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,V]];function ve(t,e,n){if(t.next!=60)return-1;let r=t.text.slice(t.pos);for(let s=0,i=J.length-(n?1:0);s<i;s++)if(J[s][0].test(r))return s;return-1}function Le(t,e){let n=t.countIndent(e,t.pos,t.indent),r=t.countIndent(t.skipSpace(e),e,n);return r>=n+5?n+1:r}function x(t,e,n){let r=t.length-1;r>=0&&t[r].to==e&&t[r].type==h.CodeText?t[r].to=n:t.push(k(h.CodeText,e,n))}var D={LinkReference:void 0,IndentedCode(t,e){let n=e.baseIndent+4;if(e.indent<n)return!1;let r=e.findColumn(n),s=t.lineStart+r,i=t.lineStart+e.text.length,o=[],a=[];for(x(o,s,i);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){x(a,t.lineStart-1,t.lineStart);for(let l of e.markers)a.push(l)}else{if(e.indent<n)break;{if(a.length){for(let u of a)u.type==h.CodeText?x(o,u.from,u.to):o.push(u);a=[]}x(o,t.lineStart-1,t.lineStart);for(let u of e.markers)o.push(u);i=t.lineStart+e.text.length;let l=t.lineStart+e.findColumn(e.baseIndent+4);l<i&&x(o,l,i)}}return a.length&&(a=a.filter(l=>l.type!=h.CodeText),a.length&&(e.markers=a.concat(e.markers))),t.addNode(t.buffer.writeElements(o,-s).finish(h.CodeBlock,i-s),s),!0},FencedCode(t,e){let n=Me(e);if(n<0)return!1;let r=t.lineStart+e.pos,s=e.next,i=n-e.pos,o=e.skipSpace(n),a=be(e.text,e.text.length,o),l=[k(h.CodeMark,r,r+i)];o<a&&l.push(k(h.CodeInfo,t.lineStart+o,t.lineStart+a));for(let u=!0;t.nextLine()&&e.depth>=t.stack.length;u=!1){let f=e.pos;if(e.indent-e.baseIndent<4)for(;f<e.text.length&&e.text.charCodeAt(f)==s;)f++;if(f-e.pos>=i&&e.skipSpace(f)==e.text.length){for(let c of e.markers)l.push(c);l.push(k(h.CodeMark,t.lineStart+e.pos,t.lineStart+f)),t.nextLine();break}else{u||x(l,t.lineStart-1,t.lineStart);for(let g of e.markers)l.push(g);let c=t.lineStart+e.basePos,d=t.lineStart+e.text.length;c<d&&x(l,c,d)}}return t.addNode(t.buffer.writeElements(l,-r).finish(h.FencedCode,t.prevLineEnd()-r),r),!0},Blockquote(t,e){let n=Ie(e);return n<0?!1:(t.startContext(h.Blockquote,e.pos),t.addNode(h.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+n),null)},HorizontalRule(t,e){if(le(e,t,!1)<0)return!1;let n=t.lineStart+e.pos;return t.nextLine(),t.addNode(h.HorizontalRule,n),!0},BulletList(t,e){let n=he(e,t,!1);if(n<0)return!1;t.block.type!=h.BulletList&&t.startContext(h.BulletList,e.basePos,e.next);let r=Le(e,e.pos+1);return t.startContext(h.ListItem,e.basePos,r-e.baseIndent),t.addNode(h.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(r),null},OrderedList(t,e){let n=ue(e,t,!1);if(n<0)return!1;t.block.type!=h.OrderedList&&t.startContext(h.OrderedList,e.basePos,e.text.charCodeAt(e.pos+n-1));let r=Le(e,e.pos+n);return t.startContext(h.ListItem,e.basePos,r-e.baseIndent),t.addNode(h.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+n),e.moveBaseColumn(r),null},ATXHeading(t,e){let n=Ae(e);if(n<0)return!1;let r=e.pos,s=t.lineStart+r,i=be(e.text,e.text.length,r),o=i;for(;o>r&&e.text.charCodeAt(o-1)==e.next;)o--;(o==i||o==r||!E(e.text.charCodeAt(o-1)))&&(o=e.text.length);let a=t.buffer.write(h.HeaderMark,0,n).writeElements(t.parser.parseInline(e.text.slice(r+n+1,o),s+n+1),-s);o<e.text.length&&a.write(h.HeaderMark,o-r,i-r);let l=a.finish(h.ATXHeading1-1+n,e.text.length-r);return t.nextLine(),t.addNode(l,s),!0},HTMLBlock(t,e){let n=ve(e,t,!1);if(n<0)return!1;let r=t.lineStart+e.pos,s=J[n][1],i=[],o=s!=V;for(;!s.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){o=!1;break}for(let u of e.markers)i.push(u)}o&&t.nextLine();let a=s==Be?h.CommentBlock:s==ye?h.ProcessingInstructionBlock:h.HTMLBlock,l=t.prevLineEnd();return t.addNode(t.buffer.writeElements(i,-r).finish(a,l-r),r),!0},SetextHeading:void 0},Y=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,n,r){if(this.stage==-1)return!1;let s=r.content+`
|
|
`+n.scrub(),i=this.advance(s);return i>-1&&i<s.length?this.complete(e,r,i):!1}finish(e,n){return(this.stage==2||this.stage==3)&&N(n.content,this.pos)==n.content.length?this.complete(e,n,n.content.length):!1}complete(e,n,r){return e.addLeafElement(n,k(h.LinkReference,this.start,this.start+r,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(Oe(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(k(h.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 n=N(e,this.pos),r=0;if(n>this.pos){let s=ze(e,n,this.start);if(s){let i=G(e,s.to-this.start);i>0&&(this.nextStage(s),r=i)}}return r||(r=G(e,this.pos)),r>0&&r<e.length?r:-1}else return G(e,this.pos)}}};function G(t,e){for(;e<t.length;e++){let n=t.charCodeAt(e);if(n==10)break;if(!E(n))return-1}return e}var ee=class{nextLine(e,n,r){let s=n.depth<e.stack.length?-1:He(n),i=n.next;if(s<0)return!1;let o=k(h.HeaderMark,e.lineStart+n.pos,e.lineStart+s);return e.nextLine(),e.addLeafElement(r,k(i==61?h.SetextHeading1:h.SetextHeading2,r.start,e.prevLineEnd(),[...e.parser.parseInline(r.content,r.start),o])),!0}finish(){return!1}},nt={LinkReference(t,e){return e.content.charCodeAt(0)==91?new Y(e):null},SetextHeading(){return new ee}},rt=[(t,e)=>Ae(e)>=0,(t,e)=>Me(e)>=0,(t,e)=>Ie(e)>=0,(t,e)=>he(e,t,!0)>=0,(t,e)=>ue(e,t,!0)>=0,(t,e)=>le(e,t,!0)>=0,(t,e)=>ve(e,t,!0)>=0],st={text:"",end:0},te=class{constructor(e,n,r,s){this.parser=e,this.input=n,this.ranges=s,this.line=new K,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=z.create(h.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new ae(r,n):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 r=0;;){let s=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<e.markers.length&&(!s||e.markers[r].from<s.end);){let i=e.markers[r++];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 r of this.parser.blockParsers)if(r){let s=r(this,e);if(s!=!1){if(s==!0)return null;e.forward();continue e}}break}let n=new W(this.lineStart+e.pos,e.text.slice(e.pos));for(let r of this.parser.leafBlockParsers)if(r){let s=r(this,n);s&&n.parsers.push(s)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,e,n))break e}for(let r of n.parsers)if(r.nextLine(this,e,n))return null;n.content+=`
|
|
`+e.scrub();for(let r of e.markers)n.marks.push(r)}return this.finishLeaf(n),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 n=this.fragments.takeNodes(this);return n?(this.absoluteLineStart+=n,this.lineStart=$e(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let n=st;if(n.end=e,e>=this.to)n.text="";else if(n.text=this.lineChunkAt(e),n.end+=n.text.length,this.ranges.length>1){let r=this.absoluteLineStart,s=this.rangeI;for(;this.ranges[s].to<n.end;){s++;let i=this.ranges[s].from,o=this.lineChunkAt(i);n.end=i+o.length,n.text=n.text.slice(0,this.ranges[s-1].to-r)+o,r=n.end-n.text.length}}return n}readLine(){let{line:e}=this,{text:n,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,e.reset(n);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 "+h[s.type]);if(!i(s,this,e))break;e.forward()}}lineChunkAt(e){let n=this.input.chunk(e),r;if(this.input.lineChunks)r=n==`
|
|
`?"":n;else{let s=n.indexOf(`
|
|
`);r=s<0?n:n.slice(0,s)}return e+r.length>this.to?r.slice(0,this.to-e):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,n,r=0){this.block=z.create(e,r,this.lineStart+n,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,n,r=0){this.startContext(this.parser.getNodeType(e),n,r)}addNode(e,n,r){typeof e=="number"&&(e=new L.Tree(this.parser.nodeSet.types[e],H,H,(r??this.prevLineEnd())-n)),this.block.addChild(e,n-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,n){this.addNode(this.buffer.writeElements(ie(n.children,e.marks),-n.from).finish(n.type,n.to-n.from),n.from)}finishContext(){let e=this.stack.pop(),n=this.stack[this.stack.length-1];n.addChild(e.toTree(this.parser.nodeSet),e.from-n.from),this.block=n}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?Ne(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let r of e.parsers)if(r.finish(this,e))return;let n=ie(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(n,-e.start).finish(h.Paragraph,e.content.length),e.start)}elt(e,n,r,s){return typeof e=="string"?k(this.parser.getNodeType(e),n,r,s):new $(e,n)}get buffer(){return new O(this.parser.nodeSet)}};function Ne(t,e,n,r,s){let i=t[e].to,o=[],a=[],l=n.from+r;function u(f,c){for(;c?f>=i:f>i;){let d=t[e+1].from-i;r+=d,f+=d,e++,i=t[e].to}}for(let f=n.firstChild;f;f=f.nextSibling){u(f.from+r,!0);let c=f.from+r,d,g=s.get(f.tree);g?d=g:f.to+r>i?(d=Ne(t,e,f,r,s),u(f.to+r,!1)):d=f.toTree(),o.push(d),a.push(c-l)}return u(n.to+r,!1),new L.Tree(n.type,o,a,n.to+r-l,n.tree?n.tree.propValues:void 0)}var ne=class t extends L.Parser{constructor(e,n,r,s,i,o,a,l,u){super(),this.nodeSet=e,this.blockParsers=n,this.leafBlockParsers=r,this.blockNames=s,this.endLeafBlock=i,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=u,this.nodeTypes=Object.create(null);for(let f of e.types)this.nodeTypes[f.name]=f.id}createParse(e,n,r){let s=new te(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}configure(e){let n=re(e);if(!n)return this;let{nodeSet:r,skipContextMarkup:s}=this,i=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),u=this.inlineNames.slice(),f=this.endLeafBlock.slice(),c=this.wrappers;if(y(n.defineNodes)){s=Object.assign({},s);let d=r.types.slice(),g;for(let b of n.defineNodes){let{name:m,block:w,composite:S,style:I}=typeof b=="string"?{name:b}:b;if(d.some(U=>U.name==m))continue;S&&(s[d.length]=(U,Qe,We)=>S(Qe,We,U.value));let j=d.length,me=S?["Block","BlockContext"]:w?j>=h.ATXHeading1&&j<=h.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;d.push(L.NodeType.define({id:j,name:m,props:me&&[[L.NodeProp.group,me]]})),I&&(g||(g={}),Array.isArray(I)||I instanceof p.Tag?g[m]=I:Object.assign(g,I))}r=new L.NodeSet(d),g&&(r=r.extend((0,p.styleTags)(g)))}if(y(n.props)&&(r=r.extend(...n.props)),y(n.remove))for(let d of n.remove){let g=this.blockNames.indexOf(d),b=this.inlineNames.indexOf(d);g>-1&&(i[g]=o[g]=void 0),b>-1&&(l[b]=void 0)}if(y(n.parseBlock))for(let d of n.parseBlock){let g=a.indexOf(d.name);if(g>-1)i[g]=d.parse,o[g]=d.leaf;else{let b=d.before?R(a,d.before):d.after?R(a,d.after)+1:a.length-1;i.splice(b,0,d.parse),o.splice(b,0,d.leaf),a.splice(b,0,d.name)}d.endLeaf&&f.push(d.endLeaf)}if(y(n.parseInline))for(let d of n.parseInline){let g=u.indexOf(d.name);if(g>-1)l[g]=d.parse;else{let b=d.before?R(u,d.before):d.after?R(u,d.after)+1:u.length-1;l.splice(b,0,d.parse),u.splice(b,0,d.name)}}return n.wrap&&(c=c.concat(n.wrap)),new t(r,i,o,a,f,s,l,u,c)}getNodeType(e){let n=this.nodeTypes[e];if(n==null)throw new RangeError(`Unknown node type '${e}'`);return n}parseInline(e,n){let r=new se(this,e,n);e:for(let s=n;s<r.end;){let i=r.char(s);for(let o of this.inlineParsers)if(o){let a=o(r,i,s);if(a>=0){s=a;continue e}}s++}return r.resolveMarkers(0)}};function y(t){return t!=null&&t.length>0}function re(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let e=re(t[0]);if(t.length==1)return e;let n=re(t.slice(1));if(!n||!e)return e||n;let r=(o,a)=>(o||H).concat(a||H),s=e.wrap,i=n.wrap;return{props:r(e.props,n.props),defineNodes:r(e.defineNodes,n.defineNodes),parseBlock:r(e.parseBlock,n.parseBlock),parseInline:r(e.parseInline,n.parseInline),remove:r(e.remove,n.remove),wrap:s?i?(o,a,l,u)=>s(i(o,a,l,u),a,l,u):s:i}}function R(t,e){let n=t.indexOf(e);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return n}var Pe=[L.NodeType.none];for(let t=1,e;e=h[t];t++)Pe[t]=L.NodeType.define({id:t,name:e,props:t>=h.Escape?[]:[[L.NodeProp.group,t in Ee?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var H=[],O=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,n,r,s=0){return this.content.push(e,n,r,4+s*4),this}writeElements(e,n=0){for(let r of e)r.writeTo(this,n);return this}finish(e,n){return L.Tree.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:n})}},A=class{constructor(e,n,r,s=H){this.type=e,this.from=n,this.to=r,this.children=s}writeTo(e,n){let r=e.content.length;e.writeElements(this.children,n),e.content.push(this.type,this.from+n,this.to+n,e.content.length+4-r)}toTree(e){return new O(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}},$=class{constructor(e,n){this.tree=e,this.from=n}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return H}writeTo(e,n){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+n,this.to+n,-1)}toTree(){return this.tree}};function k(t,e,n,r){return new A(t,e,n,r)}var Te={resolve:"Emphasis",mark:"EmphasisMark"},De={resolve:"Emphasis",mark:"EmphasisMark"},v={},we={},C=class{constructor(e,n,r,s){this.type=e,this.from=n,this.to=r,this.side=s}},Se="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{T=new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]","u")}catch{}var Q={Escape(t,e,n){if(e!=92||n==t.end-1)return-1;let r=t.char(n+1);for(let s=0;s<Se.length;s++)if(Se.charCodeAt(s)==r)return t.append(k(h.Escape,n,n+2));return-1},Entity(t,e,n){if(e!=38)return-1;let r=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(t.slice(n+1,n+31));return r?t.append(k(h.Entity,n,n+1+r[0].length)):-1},InlineCode(t,e,n){if(e!=96||n&&t.char(n-1)==96)return-1;let r=n+1;for(;r<t.end&&t.char(r)==96;)r++;let s=r-n,i=0;for(;r<t.end;r++)if(t.char(r)==96){if(i++,i==s&&t.char(r+1)!=96)return t.append(k(h.InlineCode,n,r+1,[k(h.CodeMark,n,n+s),k(h.CodeMark,r+1-s,r+1)]))}else i=0;return-1},HTMLTag(t,e,n){if(e!=60||n==t.end-1)return-1;let r=t.slice(n+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(r);if(s)return t.append(k(h.Autolink,n,n+1+s[0].length,[k(h.LinkMark,n,n+1),k(h.URL,n+1,n+s[0].length),k(h.LinkMark,n+s[0].length,n+1+s[0].length)]));let i=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(r);if(i)return t.append(k(h.Comment,n,n+1+i[0].length));let o=/^\?[^]*?\?>/.exec(r);if(o)return t.append(k(h.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(r);return a?t.append(k(h.HTMLTag,n,n+1+a[0].length)):-1},Emphasis(t,e,n){if(e!=95&&e!=42)return-1;let r=n+1;for(;t.char(r)==e;)r++;let s=t.slice(n-1,n),i=t.slice(r,r+1),o=T.test(s),a=T.test(i),l=/\s|^$/.test(s),u=/\s|^$/.test(i),f=!u&&(!a||l||o),c=!l&&(!o||u||a),d=f&&(e==42||!c||o),g=c&&(e==42||!f||a);return t.append(new C(e==95?Te:De,n,r,(d?1:0)|(g?2:0)))},HardBreak(t,e,n){if(e==92&&t.char(n+1)==10)return t.append(k(h.HardBreak,n,n+2));if(e==32){let r=n+1;for(;t.char(r)==32;)r++;if(t.char(r)==10&&r>=n+2)return t.append(k(h.HardBreak,n,r+1))}return-1},Link(t,e,n){return e==91?t.append(new C(v,n,n+1,1)):-1},Image(t,e,n){return e==33&&t.char(n+1)==91?t.append(new C(we,n,n+2,1)):-1},LinkEnd(t,e,n){if(e!=93)return-1;for(let r=t.parts.length-1;r>=0;r--){let s=t.parts[r];if(s instanceof C&&(s.type==v||s.type==we)){if(!s.side||t.skipSpace(s.to)==n&&!/[(\[]/.test(t.slice(n+1,n+2)))return t.parts[r]=null,-1;let i=t.takeContent(r),o=t.parts[r]=it(t,i,s.type==v?h.Link:h.Image,s.from,n+1);if(s.type==v)for(let a=0;a<r;a++){let l=t.parts[a];l instanceof C&&l.type==v&&(l.side=0)}return o.to}}return-1}};function it(t,e,n,r,s){let{text:i}=t,o=t.char(s),a=s;if(e.unshift(k(h.LinkMark,r,r+(n==h.Image?2:1))),e.push(k(h.LinkMark,s-1,s)),o==40){let l=t.skipSpace(s+1),u=Re(i,l-t.offset,t.offset),f;u&&(l=t.skipSpace(u.to),l!=u.to&&(f=ze(i,l-t.offset,t.offset),f&&(l=t.skipSpace(f.to)))),t.char(l)==41&&(e.push(k(h.LinkMark,s,s+1)),a=l+1,u&&e.push(u),f&&e.push(f),e.push(k(h.LinkMark,l,a)))}else if(o==91){let l=Oe(i,s-t.offset,t.offset,!1);l&&(e.push(l),a=l.to)}return k(n,r,a,e)}function Re(t,e,n){if(t.charCodeAt(e)==60){for(let s=e+1;s<t.length;s++){let i=t.charCodeAt(s);if(i==62)return k(h.URL,e+n,s+1+n);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(E(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?k(h.URL,e+n,i+n):i==t.length?null:!1}}function ze(t,e,n){let r=t.charCodeAt(e);if(r!=39&&r!=34&&r!=40)return!1;let s=r==40?41:r;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 k(h.LinkTitle,e+n,i+1+n);a==92&&(o=!0)}}return null}function Oe(t,e,n,r){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 r?!1:k(h.LinkLabel,e+n,i+1+n);if(r&&!E(a)&&(r=!1),a==91)return!1;a==92&&(s=!0)}}return null}var se=class{constructor(e,n,r){this.parser=e,this.text=n,this.offset=r,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,n){return this.text.slice(e-this.offset,n-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,n,r,s,i){return this.append(new C(e,n,r,(s?1:0)|(i?2:0)))}addElement(e){return this.append(e)}resolveMarkers(e){for(let r=e;r<this.parts.length;r++){let s=this.parts[r];if(!(s instanceof C&&s.type.resolve&&s.side&2))continue;let i=s.type==Te||s.type==De,o=s.to-s.from,a,l=r-1;for(;l>=e;l--){let m=this.parts[l];if(m instanceof C&&m.side&1&&m.type==s.type&&!(i&&(s.side&1||m.side&2)&&(m.to-m.from+o)%3==0&&((m.to-m.from)%3||o%3))){a=m;break}}if(!a)continue;let u=s.type.resolve,f=[],c=a.from,d=s.to;if(i){let m=Math.min(2,a.to-a.from,o);c=a.to-m,d=s.from+m,u=m==1?"Emphasis":"StrongEmphasis"}a.type.mark&&f.push(this.elt(a.type.mark,c,a.to));for(let m=l+1;m<r;m++)this.parts[m]instanceof A&&f.push(this.parts[m]),this.parts[m]=null;s.type.mark&&f.push(this.elt(s.type.mark,s.from,d));let g=this.elt(u,c,d,f);this.parts[l]=i&&a.from!=c?new C(a.type,a.from,c,a.side):null,(this.parts[r]=i&&s.to!=d?new C(s.type,d,s.to,s.side):null)?this.parts.splice(r,0,g):this.parts[r]=g}let n=[];for(let r=e;r<this.parts.length;r++){let s=this.parts[r];s instanceof A&&n.push(s)}return n}findOpeningDelimiter(e){for(let n=this.parts.length-1;n>=0;n--){let r=this.parts[n];if(r instanceof C&&r.type==e)return n}return null}takeContent(e){let n=this.resolveMarkers(e);return this.parts.length=e,n}skipSpace(e){return N(this.text,e-this.offset)+this.offset}elt(e,n,r,s){return typeof e=="string"?k(this.parser.getNodeType(e),n,r,s):new $(e,n)}};function ie(t,e){if(!e.length)return t;if(!t.length)return e;let n=t.slice(),r=0;for(let s of e){for(;r<n.length&&n[r].to<s.to;)r++;if(r<n.length&&n[r].from<s.from){let i=n[r];i instanceof A&&(n[r]=new A(i.type,i.from,i.to,ie(i.children,[s])))}else n.splice(r++,0,s)}return n}var at=[h.CodeBlock,h.ListItem,h.OrderedList,h.BulletList],ae=class{constructor(e,n){this.fragments=e,this.input=n,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,n){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)!=`
|
|
`;)i--;this.fragmentEnd=i?i-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let s=e+this.fragment.offset;for(;r.to<=s;)if(!r.parent())return!1;for(;;){if(r.from>=s)return this.fragment.from<=n;if(!r.childAfter(s))return!1}}matches(e){let n=this.cursor.tree;return n&&n.prop(L.NodeProp.contextHash)==e}takeNodes(e){let n=this.cursor,r=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,o=i,a=e.block.children.length,l=o,u=a;for(;;){if(n.to-r>s){if(n.type.isAnonymous&&n.firstChild())continue;break}let f=$e(n.from-r,e.ranges);if(n.to-r<=e.ranges[e.rangeI].to)e.addNode(n.tree,f);else{let c=new L.Tree(e.parser.nodeSet.types[h.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(c,n.tree),e.addNode(c,f)}if(n.type.is("Block")&&(at.indexOf(n.type.id)<0?(o=n.to-r,a=e.block.children.length):(o=l,a=u,l=n.to-r,u=e.block.children.length)),!n.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-i}};function $e(t,e){let n=t;for(let r=1;r<e.length;r++){let s=e[r-1].to,i=e[r].from;s<t&&(n-=i-s)}return n}var ot=(0,p.styleTags)({"Blockquote/...":p.tags.quote,HorizontalRule:p.tags.contentSeparator,"ATXHeading1/... SetextHeading1/...":p.tags.heading1,"ATXHeading2/... SetextHeading2/...":p.tags.heading2,"ATXHeading3/...":p.tags.heading3,"ATXHeading4/...":p.tags.heading4,"ATXHeading5/...":p.tags.heading5,"ATXHeading6/...":p.tags.heading6,"Comment CommentBlock":p.tags.comment,Escape:p.tags.escape,Entity:p.tags.character,"Emphasis/...":p.tags.emphasis,"StrongEmphasis/...":p.tags.strong,"Link/... Image/...":p.tags.link,"OrderedList/... BulletList/...":p.tags.list,"BlockQuote/...":p.tags.quote,"InlineCode CodeText":p.tags.monospace,"URL Autolink":p.tags.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":p.tags.processingInstruction,"CodeInfo LinkLabel":p.tags.labelName,LinkTitle:p.tags.string,Paragraph:p.tags.content}),Xe=new ne(new L.NodeSet(Pe).extend(ot),Object.keys(D).map(t=>D[t]),Object.keys(D).map(t=>nt[t]),Object.keys(D),rt,Ee,Object.keys(Q).map(t=>Q[t]),Object.keys(Q),[]);var lt={resolve:"Strikethrough",mark:"StrikethroughMark"},xt={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":p.tags.strikethrough}},{name:"StrikethroughMark",style:p.tags.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,n){if(e!=126||t.char(n+1)!=126||t.char(n+2)==126)return-1;let r=t.slice(n-1,n),s=t.slice(n+2,n+3),i=/\s|^$/.test(r),o=/\s|^$/.test(s),a=T.test(r),l=T.test(s);return t.addDelimiter(lt,n,n+2,!o&&(!l||i||a),!i&&(!a||o||l))},after:"Emphasis"}]};function P(t,e,n=0,r,s=0){let i=0,o=!0,a=-1,l=-1,u=!1,f=()=>{r.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let c=n;c<e.length;c++){let d=e.charCodeAt(c);d==124&&!u?((!o||a>-1)&&i++,o=!1,r&&(a>-1&&f(),r.push(t.elt("TableDelimiter",c+s,c+s+1))),a=l=-1):(u||d!=32&&d!=9)&&(a<0&&(a=c),l=c+1),u=!u&&d==92}return a>-1&&(i++,r&&f()),i}function Ce(t,e){for(let n=e;n<t.length;n++){let r=t.charCodeAt(n);if(r==124)return!0;r==92&&n++}return!1}var qe=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,X=class{constructor(){this.rows=null}nextLine(e,n,r){if(this.rows==null){this.rows=!1;let s;if((n.next==45||n.next==58||n.next==124)&&qe.test(s=n.text.slice(n.pos))){let i=[];P(e,r.content,0,i,r.start)==P(e,s,n.pos)&&(this.rows=[e.elt("TableHeader",r.start,r.start+r.content.length,i),e.elt("TableDelimiter",e.lineStart+n.pos,e.lineStart+n.text.length)])}}else if(this.rows){let s=[];P(e,n.text,n.pos,s,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+n.pos,e.lineStart+n.text.length,s))}return!1}finish(e,n){return this.rows?(e.addLeafElement(n,e.elt("Table",n.start,n.start+n.content.length,this.rows)),!0):!1}},At={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":p.tags.heading}},"TableRow",{name:"TableCell",style:p.tags.content},{name:"TableDelimiter",style:p.tags.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return Ce(e.content,0)?new X:null},endLeaf(t,e,n){if(n.parsers.some(s=>s instanceof X)||!Ce(e.text,e.basePos))return!1;let r=t.scanLine(t.absoluteLineEnd+1).text;return qe.test(r)&&P(t,e.text,e.basePos)==P(t,r,e.basePos)},before:"SetextHeading"}]},oe=class{nextLine(){return!1}finish(e,n){return e.addLeafElement(n,e.elt("Task",n.start,n.start+n.content.length,[e.elt("TaskMarker",n.start,n.start+3),...e.parser.parseInline(n.content.slice(3),n.start+3)])),!0}},Ht={defineNodes:[{name:"Task",block:!0,style:p.tags.list},{name:"TaskMarker",style:p.tags.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new oe:null},after:"SetextHeading"}]};function _e(t,e,n){return(r,s,i)=>{if(s!=t||r.char(i+1)==t)return-1;let o=[r.elt(n,i,i+1)];for(let a=i+1;a<r.end;a++){let l=r.char(a);if(l==t)return r.addElement(r.elt(e,i,a+1,o.concat(r.elt(n,a,a+1))));if(l==92&&o.push(r.elt("Escape",a,a+++2)),E(l))break}return-1}}var Bt={defineNodes:[{name:"Superscript",style:p.tags.special(p.tags.content)},{name:"SuperscriptMark",style:p.tags.processingInstruction}],parseInline:[{name:"Superscript",parse:_e(94,"Superscript","SuperscriptMark")}]},yt={defineNodes:[{name:"Subscript",style:p.tags.special(p.tags.content)},{name:"SubscriptMark",style:p.tags.processingInstruction}],parseInline:[{name:"Subscript",parse:_e(126,"Subscript","SubscriptMark")}]},vt={defineNodes:[{name:"Emoji",style:p.tags.character}],parseInline:[{name:"Emoji",parse(t,e,n){let r;return e!=58||!(r=/^[a-zA-Z_0-9]+:/.exec(t.slice(n+1,t.end)))?-1:t.addElement(t.elt("Emoji",n,n+1+r[0].length))}}]};var fe=require("@lezer/highlight");var ht=new Map([["sehr klein","tiny"],["klein","small"],["mittelgro\xDF","medium"],["gro\xDF","large"],["riesig","huge"],["gigantisch","gargantuan"],["rg","lg"],["ng","ng"],["cg","cg"],["rn","ln"],["n","n"],["cn","cn"],["rb","le"],["nb","ne"],["cb","ce"],["dorf","village"],["kleinstadt","town"],["stadt","city"],["gro\xDFstadt","metropolis"],["ungew\xF6hnlich","uncommon"],["selten","rare"],["einzigartig","unique"]]),ut=new Map([["min\xFAsculo","tiny"],["pequeno","small"],["m\xE9dio","medium"],["grande","large"],["enorme","huge"],["imenso","gargantuan"],["ob","lg"],["nb","ng"],["cb","cg"],["on","ln"],["nv","n"],["cn","cn"],["om","le"],["nm","ne"],["cm","ce"],["aldeia","village"],["vila","town"],["cidade","city"],["metr\xF3pole","metropolis"],["incomum","uncommon"],["raro","rare"],["\xFAnico","unique"]]),dt=new Map([["diminuto","tiny"],["peque\xF1o","small"],["medio","medium"],["grande","large"],["gigante","huge"],["gargantuesco","gargantuan"],["lb","lg"],["nb","ng"],["cb","cg"],["ln","ln"],["nv","n"],["cn","cn"],["lm","le"],["nm","ne"],["cm","ce"],["aldea","village"],["pueblo","town"],["ciudad","city"],["metr\xF3poli","metropolis"],["poco com\xFAn","uncommon"],["rara","rare"],["\xFAnica","unique"]]),ft=new Map([["\u043A\u0440\u043E\u0448\u0435\u0447\u043D\u044B\u0439","tiny"],["\u043C\u0430\u043B\u0435\u043D\u044C\u043A\u0438\u0439","small"],["\u0441\u0440\u0435\u0434\u043D\u0438\u0439","medium"],["\u0431\u043E\u043B\u044C\u0448\u043E\u0439","large"],["\u043E\u0433\u0440\u043E\u043C\u043D\u044B\u0439","huge"],["\u0438\u0441\u043F\u043E\u043B\u0438\u043D\u0441\u043A\u0438\u0439","gargantuan"],["\u043F\u0434","lg"],["\u043D\u0434","ng"],["\u0445\u0434","cg"],["\u043F\u043D","ln"],["\u043D","n"],["\u0445\u043D","cn"],["\u043F\u0437","le"],["\u043D\u0437","ne"],["\u0445\u0437","ce"],["\u0434\u0435\u0440\u0435\u0432\u043D\u044F","village"],["\u0433\u043E\u0440\u043E\u0434","town"],["\u043A\u0440\u0443\u043F\u043D\u044B\u0439 \u0433\u043E\u0440\u043E\u0434","city"],["\u043C\u0435\u0433\u0430\u043F\u043E\u043B\u0438\u0441","metropolis"],["\u043D\u0435\u043E\u0431\u044B\u0447\u043D\u044B\u0439","uncommon"],["\u0440\u0435\u0434\u043A\u0438\u0439","rare"],["\u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439","unique"]]),ct=new Map([["\u8D85\u5C0F\u578B","tiny"],["\u5C0F\u578B","small"],["\u4E2D\u578B","medium"],["\u5927\u578B","large"],["\u8D85\u5927\u578B","huge"],["\u5DE8\u5927","gargantuan"],["\u79E9\u5E8F\u306B\u3057\u3066\u5584","lg"],["\u4E2D\u7ACB\u306B\u3057\u3066\u5584","ng"],["\u6DF7\u6C8C\u306B\u3057\u3066\u5584","cg"],["\u79E9\u5E8F\u306B\u3057\u3066\u4E2D\u7ACB","ln"],["\u771F\u306A\u308B\u4E2D\u7ACB","n"],["\u6DF7\u6C8C\u306B\u3057\u3066\u4E2D\u7ACB","cn"],["\u79E9\u5E8F\u306B\u3057\u3066\u60AA","le"],["\u4E2D\u7ACB\u306B\u3057\u3066\u60AA","ne"],["\u6DF7\u6C8C\u306B\u3057\u3066\u60AA","ce"],["\u6751","village"],["\u753A","town"],["\u5E02","city"],["\u5927\u90FD\u5E02","metropolis"],["\u30A2\u30F3\u30B3\u30E2\u30F3","uncommon"],["\u30EC\u30A2","rare"],["\u30E6\u30CB\u30FC\u30AF","unique"]]),pt=new Map([["tr\xE8s petite","tiny"],["petite","small"],["moyenne","medium"],["grande","large"],["tr\xE8s grande","huge"],["gigantesque","gargantuan"],["lb","lg"],["nb","ng"],["cb","cg"],["ln","ln"],["n","n"],["cn","cn"],["lm","le"],["nm","ne"],["cm","ce"],["village","village"],["ville","town"],["cit\xE9","city"],["m\xE9tropole","metropolis"],["peu courant","uncommon"],["rare","rare"],["unique","unique"]]),gt=new Map([["malutki","tiny"],["ma\u0142y","small"],["\u015Bredni","medium"],["du\u017Cy","large"],["wielki","huge"],["ogromny","gargantuan"],["pd","lg"],["nd","ng"],["cd","cg"],["pn","ln"],["n","n"],["cn","cn"],["pz","le"],["nz","ne"],["cz","ce"],["wie\u015B","village"],["miasto","town"],["du\u017Ce miasto","city"],["metropolia","metropolis"],["niespotykany","uncommon"],["rzadki","rare"],["unikalny","unique"]]),mt=new Map([["\uB9E4\uC6B0 \uC791\uC740","tiny"],["\uC791\uC740","small"],["\uC911\uAC04","medium"],["\uD070","large"],["\uAC70\uB300\uD55C","huge"],["\uB9E4\uC6B0 \uAC70\uB300\uD55C","gargantuan"],["\uC9C8\uC11C \uC120","lg"],["\uC911\uB9BD \uC120","ng"],["\uD63C\uB3C8 \uC120","cg"],["\uC9C8\uC11C \uC911\uB9BD","ln"],["\uC911\uB9BD","n"],["\uD63C\uB3C8 \uC911\uB9BD","cn"],["\uC9C8\uC11C \uC545","le"],["\uC911\uB9BD \uC545","ne"],["\uD63C\uB3C8 \uC545","ce"],["\uB9C8\uC744","village"],["\uC74D","town"],["\uB3C4\uC2DC","city"],["\uC911\uC2EC\uC9C0","metropolis"],["\uB4DC\uBB38","uncommon"],["\uD76C\uADC0","rare"],["\uACE0\uC720","unique"]]),kt=new Map([["\u8D85\u5C0F\u578B","tiny"],["\u5C0F\u578B","small"],["\u4E2D\u578B","medium"],["\u5927\u578B","large"],["\u8D85\u5927\u578B","huge"],["\u5DE8\u578B","gargantuan"],["\u5B88\u5E8F \u5584\u826F","lg"],["\u4E2D\u7ACB \u5584\u826F","ng"],["\u5B88\u5E8F \u4E2D\u7ACB","cg"],["\u5B88\u5E8F \u4E2D\u7ACB","ln"],["\u4E2D\u7ACB","n"],["\u6DF7\u4E71 \u4E2D\u7ACB","cn"],["\u5B88\u5E8F \u90AA\u6076","le"],["\u4E2D\u7ACB \u90AA\u6076","ne"],["\u6DF7\u4E71 \u90AA\u6076","ce"],["\u6751\u5E84","village"],["\u9547\u5B50","town"],["\u57CE\u5E02","city"],["\u5927\u90FD\u4F1A","metropolis"],["\u7F55\u89C1","uncommon"],["\u7A00\u6709","rare"],["\u72EC\u7279","unique"]]),bt=new Map([["\u043A\u0440\u0438\u0445\u0456\u0442\u043D\u0438\u0439","tiny"],["\u043C\u0430\u043B\u0435\u043D\u044C\u043A\u0438\u0439","small"],["\u0441\u0435\u0440\u0435\u0434\u043D\u0456\u0439","medium"],["\u0432\u0435\u043B\u0438\u043A\u0438\u0439","large"],["\u0432\u0435\u043B\u0438\u0447\u0435\u0437\u043D\u0438\u0439","huge"],["\u0433\u0430\u0440\u0433\u0430\u043D\u0442\u044E\u0430\u043D","gargantuan"],["\u0437\u0434","lg"],["\u043D\u0434","ng"],["\u0445\u0434","cg"],["\u0437\u043D","ln"],["\u043D","n"],["\u0445\u043D","cn"],["\u0437\u0437","le"],["\u043D\u0437","ne"],["\u0445\u0437","ce"],["\u0441\u0435\u043B\u043E","village"],["\u043C\u0456\u0441\u0442\u043E","town"],["\u0432\u0435\u043B\u0438\u043A\u0435 \u043C\u0456\u0441\u0442\u043E","city"],["\u043C\u0435\u0433\u0430\u043F\u043E\u043B\u0456\u0441","metropolis"],["\u043D\u0435\u0447\u0430\u0441\u0442\u0438\u0439","uncommon"],["\u0440\u0456\u0434\u043A\u0456\u0441\u043D\u0438\u0439","rare"],["\u0443\u043D\u0456\u043A\u0430\u043B\u044C\u043D\u0438\u0439","unique"]]),Fe=new Map([["de",ht],["pt-br",ut],["es",dt],["ru",ft],["ja",ct],["fr",pt],["pl",gt],["ko",mt],["zh",kt],["uk",bt]]);function je(t){let e=window.localStorage.getItem("language");if(e==null||!Fe.has(e))return t;let n=Fe.get(e);return n.has(t)?n.get(t):""}var Ue=new Map([["tiny","pf2e-statblock-trait-size"],["small","pf2e-statblock-trait-size"],["medium","pf2e-statblock-trait-size"],["large","pf2e-statblock-trait-size"],["huge","pf2e-statblock-trait-size"],["gargantuan","pf2e-statblock-trait-size"],["lg","pf2e-statblock-trait-alignment"],["ng","pf2e-statblock-trait-alignment"],["cg","pf2e-statblock-trait-alignment"],["ln","pf2e-statblock-trait-alignment"],["n","pf2e-statblock-trait-alignment"],["cn","pf2e-statblock-trait-alignment"],["le","pf2e-statblock-trait-alignment"],["ne","pf2e-statblock-trait-alignment"],["ce","pf2e-statblock-trait-alignment"],["village","pf2e-statblock-trait-settlement"],["town","pf2e-statblock-trait-settlement"],["city","pf2e-statblock-trait-settlement"],["metropolis","pf2e-statblock-trait-settlement"],["uncommon","pf2e-statblock-trait-uncommon"],["rare","pf2e-statblock-trait-rare"],["unique","pf2e-statblock-trait-unique"]]);function Ge(t){let e=t.trim().toLowerCase(),n=je(e);return Ue.has(n)?Ue.get(n):"pf2e-statblock-trait-normal"}function de(t){if(t==null)return 0;let e=t.className.indexOf("pf2e-statblock-indent-");if(e<0)return 0;let n=t.className.charAt(e+22),r=Number.parseInt(n);return Number.isNaN(r)?0:r}function Lt(t,e){let n=t.getElementsByTagName("p"),r=[];for(let s=0;s<n.length;s++){let o=n[s].childNodes,a=e.createEl("div"),l=null,u=a.createEl("p");for(let f=0;f<o.length;f++){let c=o[f],d=c;if(!(c.nodeName==="#text"&&u.childNodes.length===0&&(d.textContent===null||d.textContent.trim().length===0))){if(u.childNodes.length===0){let g=0;for(let b=f;b<o.length;b++){let m=o[b];if(o[b]instanceof Element&&m.classList.contains("pf2e-statblock-tab"))g++;else break}if(g>0){l!==null?de(l)!==g&&(l=a.createEl("ul",{cls:`pf2e-statblock-indent-${g}`}),l.appendChild(u)):u.classList.add(`pf2e-statblock-indent-${g}`),f+=g-1;continue}if((u.className.includes("pf2e-statblock-indent")||l!==null&&l.className.includes("pf2e-statblock-indent"))&&c.nodeName==="#text"&&d.textContent.startsWith("- ")){u.tagName!=="LI"&&(l===null&&(l=a.createEl("ul",{cls:u.className}),u.replaceWith(l)),u=l.createEl("li"));let b=u.appendChild(c.cloneNode(!1));b.textContent=b.textContent.substring(2);continue}else if(u.tagName==="LI"){let b=a.createEl("p");l.removeChild(u),u=b,l.hasChildNodes()||a.removeChild(l),l=null;let m=0;for(let w=f-1;w>=0;w--){let S=o[w];if(o[w]instanceof Element&&S.classList.contains("pf2e-statblock-tab"))m++;else break}m>0&&u.classList.add(`pf2e-statblock-indent-${m}`)}u.tagName==="P"&&(c instanceof Element&&d.tagName==="STRONG"?u.classList.add("pf2e-statblock-subentry"):u.previousElementSibling!=null&&u.previousElementSibling.tagName==="P"&&!u.previousElementSibling.classList.contains("pf2e-statblock-subentry")&&de(u)===de(u.previousElementSibling)&&u.classList.add("pf2e-statblock-2nd-paragraph"))}else if(c instanceof Element&&d.tagName==="BR"){l===null?u=a.createEl("p"):u=l.createEl("li");continue}u.appendChild(c.cloneNode(!0))}}r.push(a)}for(let s=n.length-1;s>=0;s--)n[s].replaceWith(r[s])}var ce=class{constructor(){this.codeText="";this.locationInDoc=-1}},q=class{constructor(e,n,r){this.decor=r,this.start=e,this.end=n}},pe=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{pe=new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]\\p{Sm}","u")}catch{}var wt={resolve:"Highlight",mark:"HighlightMark"},St={defineNodes:[{name:"Highlight",style:{"Highlight/...":fe.tags.heading3}},{name:"HighlightMark",style:fe.tags.processingInstruction}],parseInline:[{name:"Highlight",parse(t,e,n){if(e!=61||t.char(n+1)!=61||t.char(n+2)==61)return-1;let r=t.slice(n-1,n),s=t.slice(n+2,n+3),i=/\s|^$/.test(r),o=/\s|^$/.test(s),a=pe.test(r),l=pe.test(s);return t.addDelimiter(wt,n,n+2,!o&&(!l||i||a),!i&&(!a||o||l))},before:"Emphasis"}]},Ct=Xe.configure(St),ge=class extends M.WidgetType{constructor(e){super(),this.actionText=e}toDOM(e){let n=document.createElement("span");return this.actionText==="[reaction]"||this.actionText==="[free-action]"||this.actionText=="[one-action]"||this.actionText==="[two-actions]"||this.actionText==="[three-actions]"?(n.innerText=this.actionText,n.className="pf2e-statblock-live-action"):(n.innerText="???",n.className="pf2e-statblock-live-error"),n}},Et=B.StateField.define({create(t){return M.Decoration.none},update(t,e){let n=!1,r=-1,s=new Array;(0,Ze.syntaxTree)(e.state).iterate({enter(a){if(a.type.name==="Document")return!0;let l=e.newDoc.sliceString(a.from,a.to);if(a.type.name.startsWith("HyperMD-codeblock_HyperMD-codeblock-begin_HyperMD-codeblock-begin-bg_HyperMD-codeblock-bg")){if(n)return!1;if(l==="```pf2e-stats"){n=!0,r=-1;let u=new ce;return s.push(u),!1}}if(!n)return!1;if(a.type.name.startsWith("HyperMD-codeblock_HyperMD-codeblock-bg_HyperMD-codeblock-end_HyperMD-codeblock-end-bg"))n=!1;else if(a.type.name.startsWith("hmd-codeblock")){let u="";s[s.length-1].locationInDoc<0?s[s.length-1].locationInDoc=a.from:r!==-1&&(u=`
|
|
`.repeat(a.from-r)),s[s.length-1].codeText+=u+l,r=a.to}return n}});let i=new Array;for(let a of s){let l=a.locationInDoc,u=l+a.codeText.length;Ct.parse(a.codeText).iterate({enter(c){let d=l+c.from,g=l+c.to,b=!0,m=0,w="pf2e-statblock-live";switch(c.type.name){case"Document":return!0;case"ATXHeading1":{w+="-h1";break}case"ATXHeading2":{w+="-h2",b=!1;break}case"ATXHeading3":{w+="-h3",b=!1;break}case"Paragraph":{w+="-p",m=-1;break}case"Emphasis":{w+="-i",m=1;break}case"StrongEmphasis":{w+="-b",m=1;break}case"InlineCode":{if(w+="-actionSource",m=2,b=!1,c.to-c.from<4)return!1;let S=a.codeText.slice(c.from+1,c.to-1);i.push(new q(g,g,M.Decoration.widget({widget:new ge(S)})));break}case"Highlight":{w+="-mark",m=1,b=!1;let S=a.codeText.slice(c.from+2,c.to-2),I=Ge(S);w+=" "+I;break}case"ListItem":{w+="-li",m=-1;break}case"BulletList":{w+="-ul";break}case"OrderedList":{w+="-ol";break}default:return!1}try{let S=M.Decoration.mark({inclusiveStart:!0,class:w});S.startSide=m,i.push(new q(d,g,S))}catch{}return b}})}i.sort((a,l)=>a.start<l.start?-1:a.start>l.start?1:a.decor.startSide<=l.decor.startSide?-1:1);let o=new B.RangeSetBuilder;for(let a of i)o.add(a.start,a.end,a.decor);return o.finish()},provide(t){return M.EditorView.decorations.from(t)}}),_=class extends F.Plugin{async onload(){this.registerMarkdownCodeBlockProcessor("pf2e-stats",(e,n,r)=>{e=e.replaceAll(" ",'<span class="pf2e-statblock-tab">INDENTATION PROCESSING ERROR</span>');let s=n.createEl("div",{cls:"pf2e-statblock"});F.MarkdownRenderer.render(this.app,e,s,r.sourcePath,this);let i=s.getElementsByTagName("mark");for(let o=0;o<i.length;o++){let a=i[o],l=Ge(a.innerText);a.classList.add(l)}Lt(s,n),n.parentElement!=null&&n.parentElement.classList.contains("cm-preview-code-block")&&s.classList.add("pf2e-statblock-edit")}),this.registerEditorExtension(B.Prec.highest(Et))}};
|