4 lines
9.9 KiB
JavaScript
4 lines
9.9 KiB
JavaScript
|
|
import{c as fn}from"./vendor-micromark-util-combine-extensions-d8XJZrgA.js";import{f as K}from"./vendor-micromark-factory-space-BM4zcA-B.js";import{m as V}from"./vendor-micromark-util-character-Cn8n62xE.js";import{s as G,p as dn}from"./vendor-micromark-util-chunked-DrRIdSP-.js";import{b as hn,c as pn,a as xn,l as b,d as mn,e as H,f as Z,t as Q,s as nn,h as gn,g as kn,i as rn,j as on,k as wn,m as J,n as bn,o as Cn,p as _n,q as vn,r as In,u as yn,v as U}from"./vendor-micromark-core-commonmark-BEN53qso.js";import{r as Sn}from"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import{s as Tn}from"./vendor-micromark-util-subtokenize-BF1Jf29a.js";const An={tokenize:zn};function zn(n){const t=n.attempt(this.parser.constructs.contentInitial,e,o);let r;return t;function e(l){if(l===null){n.consume(l);return}return n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),K(n,t,"linePrefix")}function o(l){return n.enter("paragraph"),i(l)}function i(l){const d=n.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=d),r=d,u(l)}function u(l){if(l===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(l);return}return V(l)?(n.consume(l),n.exit("chunkText"),i):(n.consume(l),u)}}const Fn={tokenize:En},en={tokenize:Bn};function En(n){const t=this,r=[];let e=0,o,i,u;return l;function l(a){if(e<r.length){const k=r[e];return t.containerState=k[1],n.attempt(k[0].continuation,d,s)(a)}return s(a)}function d(a){if(e++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&F();const k=t.events.length;let w=k,m;for(;w--;)if(t.events[w][0]==="exit"&&t.events[w][1].type==="chunkFlow"){m=t.events[w][1].end;break}S(e);let C=k;for(;C<t.events.length;)t.events[C][1].end={...m},C++;return G(t.events,w+1,0,t.events.slice(k)),t.events.length=C,s(a)}return l(a)}function s(a){if(e===r.length){if(!o)return x(a);if(o.currentConstruct&&o.currentConstruct.concrete)return y(a);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},n.check(en,h,p)(a)}function h(a){return o&&F(),S(e),x(a)}function p(a){return t.parser.lazy[t.now().line]=e!==r.length,u=t.now().offset,y(a)}function x(a){return t.containerState={},n.attempt(en,_,y)(a)}function _(a){return e++,r.push([t.currentConstruct,t.containerState]),x(a)}function y(a){if(a===null){o&&F(),S(0),n.consume(a);return}return o=o||t.parser.flow(t.now()),n.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),B(a)}function B(a){if(a===null){O(n.exit("chunkFlow"),!0),S(0),n.consume(a);return}return V(a)?(n.consume(a),O(n.exit("chunkFlow")),e=0,t.interrupt=void 0,l):(n.consume(a),B)}function O(a,k){const w=t.sliceStream(a);if(k&&w.push(null),a.previous=i,i&&(i.next=a),i=a,o.defineSkip(a.start),o.write(w),t.parser.lazy[a.start.line]){let m=o.events.length;for(;m--;)if(o.events[m][1].start.offset<u&&(!o.events[m][1].end||o.events[m][1].end.offset>u))return;const C=t.events.length;let T=C,P,A;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(P){A=t.events[T][1].end;break}P=!0}for(S(e),m=C;m<t.events.length;)t.events[m][1].end={...A},m++;G(t.events,T+1,0,t.events.slice(C)),t.events.length=m}}function S(a){let k=r.length;for(;k-- >a;){const w=r[k];t.containerState=w[1],w[0].exit.call(t,n)}r.length=a}function F(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function Bn(n,t,r){return K(n,n.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}const On={tokenize:Pn};function Pn(n){const t=this,r=n.attempt(hn,e,n.attempt(this.parser.constructs.flowInitial,o,K(n,n.attempt(this.parser.constructs.flow,o,n.attempt(pn,o)),"linePrefix")));return r;function e(i){if(i===null){n.consume(i);return}return n.enter("lineEndingBlank"),n.consume(i),n.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function o(i){if(i===null){n.consume(i);return}return n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),t.currentConstruct=void 0,r}}const jn={resolveAll:un()},Ln=sn("string"),$n=sn("text");function sn(n){return{resolveAll:un(n==="text"?Mn:v
|
||
|
|
`;break}case-3:{u=`\r
|
||
|
|
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&o)continue;u=" ";break}default:u=String.fromCharCode(i)}o=i===-2,e.push(u)}return e.join("")}function oe(n){const e={constructs:fn([Kn,...(n||{}).extensions||[]]),content:o(An),defined:[],document:o(Fn),flow:o(On),lazy:{},string:o(Ln),text:o($n)};return e;function o(i){return u;function u(l){return Vn(e,i,l)}}}function se(n){for(;!Tn(n););return n}const tn=/[\0\t\n\r]/g;function ue(){let n=1,t="",r=!0,e;return o;function o(i,u,l){const d=[];let s,h,p,x,_;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(u||void 0).decode(i)),p=0,t="",r&&(i.charCodeAt(0)===65279&&p++,r=void 0);p<i.length;){if(tn.lastIndex=p,s=tn.exec(i),x=s&&s.index!==void 0?s.index:i.length,_=i.charCodeAt(x),!s){t=i.slice(p);break}if(_===10&&p===x&&e)d.push(-3),e=void 0;else switch(e&&(d.push(-5),e=void 0),p<x&&(d.push(i.slice(p,x)),n+=x-p),_){case 0:{d.push(65533),n++;break}case 9:{for(h=Math.ceil(n/4)*4,d.push(-2);n++<h;)d.push(-1);break}case 10:{d.push(-4),n=1;break}default:e=!0,n=1}p=x+1}return l&&(e&&d.push(-5),t&&d.push(t),d.push(null)),d}}export{oe as a,ue as b,se as p};
|