Files
Borealis-Github-Replica/Data/Engine/web-interface/build/assets/micromark-util-subtokenize-QwsxNXk2.js

2 lines
1.7 KiB
JavaScript

import{s as w}from"./micromark-util-chunked-DrRIdSP-.js";function I(l){const c={};let e=-1,p,r,n,o,f,s,u;for(;++e<l.length;){for(;e in c;)e=c[e];if(p=l[e],e&&p[1].type==="chunkFlow"&&l[e-1][1].type==="listItemPrefix"&&(s=p[1]._tokenizer.events,n=0,n<s.length&&s[n][1].type==="lineEndingBlank"&&(n+=2),n<s.length&&s[n][1].type==="content"))for(;++n<s.length&&s[n][1].type!=="content";)s[n][1].type==="chunkText"&&(s[n][1]._isInFirstContentOfListItem=!0,n++);if(p[0]==="enter")p[1].contentType&&(Object.assign(c,_(l,e)),e=c[e],u=!0);else if(p[1]._container){for(n=e,r=void 0;n--&&(o=l[n],o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(r&&(l[r][1].type="lineEndingBlank"),o[1].type="lineEnding",r=n);r&&(p[1].end=Object.assign({},l[r][1].start),f=l.slice(r,e),f.unshift(p),w(l,r,e-r+1,f))}}return!u}function _(l,c){const e=l[c][1],p=l[c][2];let r=c-1;const n=[],o=e._tokenizer||p.parser[e.contentType](e.start),f=o.events,s=[],u={};let h,m,i=-1,t=e,d=0,k=0;const a=[k];for(;t;){for(;l[++r][1]!==t;);n.push(r),t._tokenizer||(h=p.sliceStream(t),t.next||h.push(null),m&&o.defineSkip(t.start),t._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),t._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=t,t=t.next}for(t=e;++i<f.length;)f[i][0]==="exit"&&f[i-1][0]==="enter"&&f[i][1].type===f[i-1][1].type&&f[i][1].start.line!==f[i][1].end.line&&(k=i+1,a.push(k),t._tokenizer=void 0,t.previous=void 0,t=t.next);for(o.events=[],t?(t._tokenizer=void 0,t.previous=void 0):a.pop(),i=a.length;i--;){const y=f.slice(a[i],a[i+1]),g=n.pop();s.unshift([g,g+y.length-1]),w(l,g,2,y)}for(i=-1;++i<s.length;)u[d+s[i][0]]=d+s[i][1],d+=s[i][1]-s[i][0]-1;return u}export{I as s};