/* esm.sh - micromark-core-commonmark@2.0.4 */
import{push as j,splice as qn}from"../../micromark-util-chunked@^2.0.0?target=es2022";import{classifyCharacter as sn}from"../../micromark-util-classify-character@^2.0.0?target=es2022";import{resolveAll as Dn}from"../../micromark-util-resolve-all@^2.0.0?target=es2022";var On={name:"attention",resolveAll:Rn,tokenize:_n};function Rn(n,a){let i=-1,t;for(;++i<n.length;)if(n[i][0]==="enter"&&n[i][1].type==="attentionSequence"&&n[i][1]._close){let u=i;for(;u--;)if(n[u][0]==="exit"&&n[u][1].type==="attentionSequence"&&n[u][1]._open&&a.sliceSerialize(n[u][1]).charCodeAt(0)===a.sliceSerialize(n[i][1]).charCodeAt(0)){if((n[u][1]._close||n[i][1]._open)&&(n[i][1].end.offset-n[i][1].start.offset)%3&&!((n[u][1].end.offset-n[u][1].start.offset+n[i][1].end.offset-n[i][1].start.offset)%3))continue;let o=n[u][1].end.offset-n[u][1].start.offset>1&&n[i][1].end.offset-n[i][1].start.offset>1?2:1,l={...n[u][1].end},m={...n[i][1].start};xn(l,-o),xn(m,o);let c={type:o>1?"strongSequence":"emphasisSequence",start:l,end:{...n[u][1].end}},h={type:o>1?"strongSequence":"emphasisSequence",start:{...n[i][1].start},end:m},s={type:o>1?"strongText":"emphasisText",start:{...n[u][1].end},end:{...n[i][1].start}},x={type:o>1?"strong":"emphasis",start:{...c.start},end:{...h.end}};n[u][1].end={...c.start},n[i][1].start={...h.end},t=[],n[u][1].end.offset-n[u][1].start.offset&&(t=j(t,[["enter",n[u][1],a],["exit",n[u][1],a]])),t=j(t,[["enter",x,a],["enter",c,a],["exit",c,a],["enter",s,a]]),t=j(t,Dn(a.parser.constructs.insideSpan.null,n.slice(u+1,i),a)),t=j(t,[["exit",s,a],["enter",h,a],["exit",h,a],["exit",x,a]]);let g=0;n[i][1].end.offset-n[i][1].start.offset&&(g=2,t=j(t,[["enter",n[i][1],a],["exit",n[i][1],a]])),qn(n,u-1,i-u+3,t),i=u+t.length-g-2;break}}for(i=-1;++i<n.length;)n[i][1].type==="attentionSequence"&&(n[i][1].type="data");return n}function _n(n,a){let i=this.parser.constructs.attentionMarkers.null,t=this.previous,u=sn(t),o;return l;function l(c){return o=c,n.enter("attentionSequence"),m(c)}function m(c){if(c===o)return n.consume(c),m;let h=n.exit("attentionSequence"),s=sn(c),x=!s||s===2&&u||i.includes(c)&&c!==42&&c!==95,g=!u||u===2&&s||i.includes(t)&&t!==42&&t!==95;return h._open=!!(o===42?x:x&&(u||!g)),h._close=!!(o===42?g:g&&(s||!x)),a(c)}}function xn(n,a){n.column+=a,n.offset+=a,n._bufferIndex+=a}import{asciiAlphanumeric as d,asciiAlpha as Hn,asciiAtext as Vn,asciiControl as Qn}from"../../micromark-util-character@^2.0.0?target=es2022";var Nn={name:"autolink",tokenize:Wn};function Wn(n,a,i){let t=0;return u;function u(p){return n.enter("autolink"),n.enter("autolinkMarker"),n.consume(p),n.exit("autolinkMarker"),n.enter("autolinkProtocol"),o}function o(p){return Hn(p)?(n.consume(p),l):p===64?i(p):h(p)}function l(p){return p===43||p===45||p===46||d(p)?(t=1,m(p)):h(p)}function m(p){return p===58?(n.consume(p),t=0,c):(p===43||p===45||p===46||d(p))&&t++<32?(n.consume(p),m):(t=0,h(p))}function c(p){return p===62?(n.exit("autolinkProtocol"),n.enter("autolinkMarker"),n.consume(p),n.exit("autolinkMarker"),n.exit("autolink"),a):p===null||p===32||p===60||Qn(p)?i(p):(n.consume(p),c)}function h(p){return p===64?(n.consume(p),s):Vn(p)?(n.consume(p),h):i(p)}function s(p){return d(p)?x(p):i(p)}function x(p){return p===46?(n.consume(p),t=0,s):p===62?(n.exit("autolinkProtocol").type="autolinkEmail",n.enter("autolinkMarker"),n.consume(p),n.exit("autolinkMarker"),n.exit("autolink"),a):g(p)}function g(p){if((p===45||d(p))&&t++<63){let b=p===45?g:x;return n.consume(p),b}return i(p)}}import{factorySpace as Un}from"../../micromark-factory-space@^2.1.0?target=es2022";import{markdownLineEnding as jn,markdownSpace as Gn}from"../../micromark-util-character@^2.0.0?target=es2022";var Q={partial:!0,tokenize:Jn};function Jn(n,a,i){return t;function t(o){return Gn(o)?Un(n,u,"linePrefix")(o):u(o)}function u(o){return o===null||jn(o)?a(o):i(o)}}import{factorySpace as Kn}from"../../micromark-factory-space@^2.1.0?target=es2022";import{markdownSpace as hn}from"../../micromark-util-character@^2.0.0?target=es2022";var kn={continuation:{tokenize:Yn},exit:Zn,name:"blockQuote",tokenize:Xn};function Xn(n,a,i){let t=this;return u;function u(l){if(l===62){let m=t.containerState;return m.open||(n.enter("blockQuote",{_container:!0}),m.open=!0),n.enter("blockQuotePrefix"),n.enter("blockQuoteMarker"),n.consume(l),n.exit("blockQuoteMarker"),o}return i(l)}function o(l){return hn(l)?(n.enter("blockQuotePrefixWhitespace"),n.consume(l),n.exit("blockQuotePrefixWhitespace"),n.exit("blockQuotePrefix"),a):(n.exit("blockQuotePrefix"),a(l))}}function Yn(n,a,i){let t=this;return u;function u(l){return hn(l)?Kn(n,o,"linePrefix",t.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return n.attempt(kn,a,i)(l)}}function Zn(n){n.exit("blockQuote")}import{asciiPunctuation as $n}from"../../micromark-util-character@^2.0.0?target=es2022";var vn={name:"characterEscape",tokenize:dn};function dn(n,a,i){return t;function t(o){return n.enter("characterEscape"),n.enter("escapeMarker"),n.consume(o),n.exit("escapeMarker"),u}function u(o){return $n(o)?(n.enter("characterEscapeValue"),n.consume(o),n.exit("characterEscapeValue"),n.exit("characterEscape"),a):i(o)}}import{decodeNamedCharacterReference as nt}from"../../decode-named-character-reference@^1.0.0?target=es2022";import{asciiAlphanumeric as gn,asciiDigit as tt,asciiHexDigit as rt}from"../../micromark-util-character@^2.0.0?target=es2022";var et={name:"characterReference",tokenize:it};function it(n,a,i){let t=this,u=0,o,l;return m;function m(x){return n.enter("characterReference"),n.enter("characterReferenceMarker"),n.consume(x),n.exit("characterReferenceMarker"),c}function c(x){return x===35?(n.enter("characterReferenceMarkerNumeric"),n.consume(x),n.exit("characterReferenceMarkerNumeric"),h):(n.enter("characterReferenceValue"),o=31,l=gn,s(x))}function h(x){return x===88||x===120?(n.enter("characterReferenceMarkerHexadecimal"),n.consume(x),n.exit("characterReferenceMarkerHexadecimal"),n.enter("characterReferenceValue"),o=6,l=rt,s):(n.enter("characterReferenceValue"),o=7,l=tt,s(x))}function s(x){if(x===59&&u){let g=n.exit("characterReferenceValue");return l===gn&&!nt(t.sliceSerialize(g))?i(x):(n.enter("characterReferenceMarker"),n.consume(x),n.exit("characterReferenceMarker"),n.exit("characterReference"),a)}return l(x)&&u++<o?(n.consume(x),s):i(x)}}import{factorySpace as J}from"../../micromark-factory-space@^2.1.0?target=es2022";import{markdownLineEnding as H,markdownSpace as K}from"../../micromark-util-character@^2.0.0?target=es2022";import"../../micromark-util-character@^2.0.0?target=es2022";var G={partial:!0,tokenize:ut};function ut(n,a,i){let t=this;return u;function u(l){return l===null?i(l):(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),o)}function o(l){return t.parser.lazy[t.now().line]?i(l):a(l)}}var at={concrete:!0,name:"codeFenced",tokenize:lt};function lt(n,a,i){let t=this,u={partial:!0,tokenize:D},o=0,l=0,m;return c;function c(k){return h(k)}function h(k){let z=t.events[t.events.length-1];return o=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,m=k,n.enter("codeFenced"),n.enter("codeFencedFence"),n.enter("codeFencedFenceSequence"),s(k)}function s(k){return k===m?(l++,n.consume(k),s):l<3?i(k):(n.exit("codeFencedFenceSequence"),K(k)?J(n,x,"whitespace")(k):x(k))}function x(k){return k===null||H(k)?(n.exit("codeFencedFence"),t.interrupt?a(k):n.check(G,L,B)(k)):(n.enter("codeFencedFenceInfo"),n.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||H(k)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),x(k)):K(k)?(n.exit("chunkString"),n.exit("codeFencedFenceInfo"),J(n,p,"whitespace")(k)):k===96&&k===m?i(k):(n.consume(k),g)}function p(k){return k===null||H(k)?x(k):(n.enter("codeFencedFenceMeta"),n.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===null||H(k)?(n.exit("chunkString"),n.exit("codeFencedFenceMeta"),x(k)):k===96&&k===m?i(k):(n.consume(k),b)}function L(k){return n.attempt(u,B,q)(k)}function q(k){return n.enter("lineEnding"),n.consume(k),n.exit("lineEnding"),V}function V(k){return o>0&&K(k)?J(n,C,"linePrefix",o+1)(k):C(k)}function C(k){return k===null||H(k)?n.check(G,L,B)(k):(n.enter("codeFlowValue"),y(k))}function y(k){return k===null||H(k)?(n.exit("codeFlowValue"),C(k)):(n.consume(k),y)}function B(k){return n.exit("codeFenced"),a(k)}function D(k,z,I){let E=0;return M;function M(S){return k.enter("lineEnding"),k.consume(S),k.exit("lineEnding"),P}function P(S){return k.enter("codeFencedFence"),K(S)?J(k,f,"linePrefix",t.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(S):f(S)}function f(S){return S===m?(k.enter("codeFencedFenceSequence"),A(S)):I(S)}function A(S){return S===m?(E++,k.consume(S),A):E>=l?(k.exit("codeFencedFenceSequence"),K(S)?J(k,O,"whitespace")(S):O(S)):I(S)}function O(S){return S===null||H(S)?(k.exit("codeFencedFence"),z(S)):I(S)}}}import{factorySpaceMinMax as cn}from"../../micromark-factory-space@^2.1.0?target=es2022";import{markdownLineEnding as nn}from"../../micromark-util-character@^2.0.0?target=es2022";var ot={name:"codeIndented",tokenize:pt},mt={partial:!0,tokenize:st};function pt(n,a,i){return t;function t(m){return n.enter("codeIndented"),cn(n,u,i,"linePrefix",4,4)(m)}function u(m){return m===null?l(m):nn(m)?n.attempt(mt,u,l)(m):(n.enter("codeFlowValue"),o(m))}function o(m){return m===null||nn(m)?(n.exit("codeFlowValue"),u(m)):(n.consume(m),o)}function l(m){return n.exit("codeIndented"),a(m)}}function st(n,a,i){let t=this;return u;function u(l){return t.parser.lazy[t.now().line]?i(l):nn(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),u):cn(n,a,o,"linePrefix",4,4)(l)}function o(l){return nn(l)?u(l):i(l)}}import{markdownLineEnding as Sn}from"../../micromark-util-character@^2.0.0?target=es2022";var xt={name:"codeText",previous:kt,resolve:ht,tokenize:gt};function ht(n){let a=n.length-4,i=3,t,u;if((n[i][1].type==="lineEnding"||n[i][1].type==="space")&&(n[a][1].type==="lineEnding"||n[a][1].type==="space")){for(t=i;++t<a;)if(n[t][1].type==="codeTextData"){n[i][1].type="codeTextPadding",n[a][1].type="codeTextPadding",i+=2,a-=2;break}}for(t=i-1,a++;++t<=a;)u===void 0?t!==a&&n[t][1].type!=="lineEnding"&&(u=t):(t===a||n[t][1].type==="lineEnding")&&(n[u][1].type="codeTextData",t!==u+2&&(n[u][1].end=n[t-1][1].end,n.splice(u+2,t-u-2),a-=t-u-2,t=u+2),u=void 0);return n}function kt(n){return n!==96||this.events[this.events.length-1][1].type==="characterEscape"}function gt(n,a,i){let t=this,u=0,o,l;return m;function m(g){return n.enter("codeText"),n.enter("codeTextSequence"),c(g)}function c(g){return g===96?(n.consume(g),u++,c):(n.exit("codeTextSequence"),h(g))}function h(g){return g===null?i(g):g===32?(n.enter("space"),n.consume(g),n.exit("space"),h):g===96?(l=n.enter("codeTextSequence"),o=0,x(g)):Sn(g)?(n.enter("lineEnding"),n.consume(g),n.exit("lineEnding"),h):(n.enter("codeTextData"),s(g))}function s(g){return g===null||g===32||g===96||Sn(g)?(n.exit("codeTextData"),h(g)):(n.consume(g),s)}function x(g){return g===96?(n.consume(g),o++,x):o===u?(n.exit("codeTextSequence"),n.exit("codeText"),a(g)):(l.type="codeTextData",s(g))}}import{factorySpace as ct}from"../../micromark-factory-space@^2.1.0?target=es2022";import{markdownLineEnding as fn}from"../../micromark-util-character@^2.0.0?target=es2022";import{subtokenize as St}from"../../micromark-util-subtokenize@^2.0.0?target=es2022";var ft={resolve:zt,tokenize:yt},bt={partial:!0,tokenize:Et};function zt(n){return St(n),n}function yt(n,a){let i;return t;function t(m){return n.enter("content"),i=n.enter("chunkContent",{contentType:"content"}),u(m)}function u(m){return m===null?o(m):fn(m)?n.check(bt,l,o)(m):(n.consume(m),u)}function o(m){return n.exit("chunkContent"),n.exit("content"),a(m)}function l(m){return n.consume(m),n.exit("chunkContent"),i.next=n.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,u}}function Et(n,a,i){let t=this;return u;function u(l){return n.exit("chunkContent"),n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),ct(n,o,"linePrefix")}function o(l){if(l===null||fn(l))return i(l);let m=t.events[t.events.length-1];return!t.parser.constructs.disable.null.includes("codeIndented")&&m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?a(l):n.interrupt(t.parser.constructs.flow,i,a)(l)}}import{factoryDestination as wt}from"../../micromark-factory-destination@^2.0.0?target=es2022";import{factoryLabel as Lt}from"../../micromark-factory-label@^2.0.0?target=es2022";import{factorySpace as bn}from"../../micromark-factory-space@^2.1.0?target=es2022";import{factoryTitle as Ct}from"../../micromark-factory-title@^2.0.0?target=es2022";import{factoryWhitespace as zn}from"../../micromark-factory-whitespace@^2.0.0?target=es2022";import{markdownLineEndingOrSpace as yn,markdownLineEnding as En,markdownSpace as wn}from"../../micromark-util-character@^2.0.0?target=es2022";import{normalizeIdentifier as At}from"../../micromark-util-normalize-identifier@^2.0.0?target=es2022";var It={name:"definition",tokenize:Ft},Tt={partial:!0,tokenize:Bt};function Ft(n,a,i){let t=this,u;return o;function o(p){return n.enter("definition"),l(p)}function l(p){return Lt.call(t,n,m,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function m(p){return u=At(t.sliceSerialize(t.events[t.events.length-1][1]).slice(1,-1)),p===58?(n.enter("definitionMarker"),n.consume(p),n.exit("definitionMarker"),c):i(p)}function c(p){return yn(p)?zn(n,h)(p):h(p)}function h(p){return wt(n,s,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function s(p){return n.attempt(Tt,x,x)(p)}function x(p){return wn(p)?bn(n,g,"whitespace")(p):g(p)}function g(p){return p===null||En(p)?(n.exit("definition"),t.parser.defined.push(u),a(p)):i(p)}}function Bt(n,a,i){return t;function t(m){return yn(m)?zn(n,u)(m):i(m)}function u(m){return Ct(n,o,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function o(m){return wn(m)?bn(n,l,"whitespace")(m):l(m)}function l(m){return m===null||En(m)?a(m):i(m)}}import{markdownLineEnding as Mt}from"../../micromark-util-character@^2.0.0?target=es2022";var Pt={name:"hardBreakEscape",tokenize:qt};function qt(n,a,i){return t;function t(o){return n.enter("hardBreakEscape"),n.consume(o),u}function u(o){return Mt(o)?(n.exit("hardBreakEscape"),a(o)):i(o)}}import{factorySpace as Dt}from"../../micromark-factory-space@^2.1.0?target=es2022";import{markdownLineEndingOrSpace as Ln,markdownLineEnding as Ot,markdownSpace as Rt}from"../../micromark-util-character@^2.0.0?target=es2022";import{splice as _t}from"../../micromark-util-chunked@^2.0.0?target=es2022";var Ht={name:"headingAtx",resolve:Vt,tokenize:Qt};function Vt(n,a){let i=n.length-2,t=3;if(n[t][1].type==="whitespace"&&(t+=2),i-2>t&&n[i][1].type==="whitespace"&&(i-=2),n[i][1].type==="atxHeadingSequence"&&(t===i-1||i-4>t&&n[i-2][1].type==="whitespace")&&(i-=t+1===i?2:4),i>t){let u={type:"atxHeadingText",start:n[t][1].start,end:n[i][1].end},o={type:"chunkText",start:n[t][1].start,end:n[i][1].end,contentType:"text"};_t(n,t,i-t+1,[["enter",u,a],["enter",o,a],["exit",o,a],["exit",u,a]])}return n}function Qt(n,a,i){let t=0;return u;function u(s){return n.enter("atxHeading"),o(s)}function o(s){return n.enter("atxHeadingSequence"),l(s)}function l(s){return s===35&&t++<6?(n.consume(s),l):s===null||Ln(s)?(n.exit("atxHeadingSequence"),m(s)):i(s)}function m(s){return s===35?(n.enter("atxHeadingSequence"),c(s)):s===null||Ot(s)?(n.exit("atxHeading"),a(s)):Rt(s)?Dt(n,m,"whitespace")(s):(n.enter("atxHeadingText"),h(s))}function c(s){return s===35?(n.consume(s),c):(n.exit("atxHeadingSequence"),m(s))}function h(s){return s===null||s===35||Ln(s)?(n.exit("atxHeadingText"),m(s)):(n.consume(s),h)}}import{asciiAlphanumeric as Cn,asciiAlpha as X,markdownLineEndingOrSpace as An,markdownLineEnding as N,markdownSpace as W}from"../../micromark-util-character@^2.0.0?target=es2022";import{htmlBlockNames as Nt,htmlRawNames as In}from"../../micromark-util-html-tag-name@^2.0.0?target=es2022";var Wt={concrete:!0,name:"htmlFlow",resolveTo:jt,tokenize:Gt},Ut={partial:!0,tokenize:Jt};function jt(n){let a=n.length;for(;a--&&!(n[a][0]==="enter"&&n[a][1].type==="htmlFlow"););return a>1&&n[a-2][1].type==="linePrefix"&&(n[a][1].start=n[a-2][1].start,n[a+1][1].start=n[a-2][1].start,n.splice(a-2,2)),n}function Gt(n,a,i){let t=this,u,o,l,m,c;return h;function h(e){return s(e)}function s(e){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(e),x}function x(e){return e===33?(n.consume(e),g):e===47?(n.consume(e),o=!0,L):e===63?(n.consume(e),u=3,t.interrupt?a:r):X(e)?(n.consume(e),l=String.fromCharCode(e),q):i(e)}function g(e){return e===45?(n.consume(e),u=2,p):e===91?(n.consume(e),u=5,m=0,b):X(e)?(n.consume(e),u=4,t.interrupt?a:r):i(e)}function p(e){return e===45?(n.consume(e),t.interrupt?a:r):i(e)}function b(e){let _="CDATA[";return e===_.charCodeAt(m++)?(n.consume(e),m===_.length?t.interrupt?a:f:b):i(e)}function L(e){return X(e)?(n.consume(e),l=String.fromCharCode(e),q):i(e)}function q(e){if(e===null||e===47||e===62||An(e)){let _=e===47,Pn=l.toLowerCase();return!_&&!o&&In.includes(Pn)?(u=1,t.interrupt?a(e):f(e)):Nt.includes(l.toLowerCase())?(u=6,_?(n.consume(e),V):t.interrupt?a(e):f(e)):(u=7,t.interrupt&&!t.parser.lazy[t.now().line]?i(e):o?C(e):y(e))}return e===45||Cn(e)?(n.consume(e),l+=String.fromCharCode(e),q):i(e)}function V(e){return e===62?(n.consume(e),t.interrupt?a:f):i(e)}function C(e){return W(e)?(n.consume(e),C):M(e)}function y(e){return e===47?(n.consume(e),M):e===58||e===95||X(e)?(n.consume(e),B):W(e)?(n.consume(e),y):M(e)}function B(e){return e===45||e===46||e===58||e===95||Cn(e)?(n.consume(e),B):D(e)}function D(e){return e===61?(n.consume(e),k):W(e)?(n.consume(e),D):y(e)}function k(e){return e===null||e===60||e===61||e===62||e===96?i(e):e===34||e===39?(n.consume(e),c=e,z):W(e)?(n.consume(e),k):I(e)}function z(e){return e===c?(n.consume(e),c=null,E):e===null||N(e)?i(e):(n.consume(e),z)}function I(e){return e===null||e===34||e===39||e===47||e===60||e===61||e===62||e===96||An(e)?D(e):(n.consume(e),I)}function E(e){return e===47||e===62||W(e)?y(e):i(e)}function M(e){return e===62?(n.consume(e),P):i(e)}function P(e){return e===null||N(e)?f(e):W(e)?(n.consume(e),P):i(e)}function f(e){return e===45&&u===2?(n.consume(e),T):e===60&&u===1?(n.consume(e),w):e===62&&u===4?(n.consume(e),R):e===63&&u===3?(n.consume(e),r):e===93&&u===5?(n.consume(e),v):N(e)&&(u===6||u===7)?(n.exit("htmlFlowData"),n.check(Ut,en,A)(e)):e===null||N(e)?(n.exit("htmlFlowData"),A(e)):(n.consume(e),f)}function A(e){return n.check(G,O,en)(e)}function O(e){return n.enter("lineEnding"),n.consume(e),n.exit("lineEnding"),S}function S(e){return e===null||N(e)?A(e):(n.enter("htmlFlowData"),f(e))}function T(e){return e===45?(n.consume(e),r):f(e)}function w(e){return e===47?(n.consume(e),l="",$):f(e)}function $(e){if(e===62){let _=l.toLowerCase();return In.includes(_)?(n.consume(e),R):f(e)}return X(e)&&l.length<8?(n.consume(e),l+=String.fromCharCode(e),$):f(e)}function v(e){return e===93?(n.consume(e),r):f(e)}function r(e){return e===62?(n.consume(e),R):e===45&&u===2?(n.consume(e),r):f(e)}function R(e){return e===null||N(e)?(n.exit("htmlFlowData"),en(e)):(n.consume(e),R)}function en(e){return n.exit("htmlFlow"),a(e)}}function Jt(n,a,i){return t;function t(u){return n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),n.attempt(Q,a,i)}}import{factorySpace as Kt}from"../../micromark-factory-space@^2.1.0?target=es2022";import{asciiAlphanumeric as un,asciiAlpha as tn,markdownLineEndingOrSpace as an,markdownLineEnding as F,markdownSpace as Y}from"../../micromark-util-character@^2.0.0?target=es2022";var Xt={name:"htmlText",tokenize:Yt};function Yt(n,a,i){let t=this,u,o,l;return m;function m(r){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(r),c}function c(r){return r===33?(n.consume(r),h):r===47?(n.consume(r),D):r===63?(n.consume(r),y):tn(r)?(n.consume(r),I):i(r)}function h(r){return r===45?(n.consume(r),s):r===91?(n.consume(r),o=0,b):tn(r)?(n.consume(r),C):i(r)}function s(r){return r===45?(n.consume(r),p):i(r)}function x(r){return r===null?i(r):r===45?(n.consume(r),g):F(r)?(l=x,w(r)):(n.consume(r),x)}function g(r){return r===45?(n.consume(r),p):x(r)}function p(r){return r===62?T(r):r===45?g(r):x(r)}function b(r){let R="CDATA[";return r===R.charCodeAt(o++)?(n.consume(r),o===R.length?L:b):i(r)}function L(r){return r===null?i(r):r===93?(n.consume(r),q):F(r)?(l=L,w(r)):(n.consume(r),L)}function q(r){return r===93?(n.consume(r),V):L(r)}function V(r){return r===62?T(r):r===93?(n.consume(r),V):L(r)}function C(r){return r===null||r===62?T(r):F(r)?(l=C,w(r)):(n.consume(r),C)}function y(r){return r===null?i(r):r===63?(n.consume(r),B):F(r)?(l=y,w(r)):(n.consume(r),y)}function B(r){return r===62?T(r):y(r)}function D(r){return tn(r)?(n.consume(r),k):i(r)}function k(r){return r===45||un(r)?(n.consume(r),k):z(r)}function z(r){return F(r)?(l=z,w(r)):Y(r)?(n.consume(r),z):T(r)}function I(r){return r===45||un(r)?(n.consume(r),I):r===47||r===62||an(r)?E(r):i(r)}function E(r){return r===47?(n.consume(r),T):r===58||r===95||tn(r)?(n.consume(r),M):F(r)?(l=E,w(r)):Y(r)?(n.consume(r),E):T(r)}function M(r){return r===45||r===46||r===58||r===95||un(r)?(n.consume(r),M):P(r)}function P(r){return r===61?(n.consume(r),f):F(r)?(l=P,w(r)):Y(r)?(n.consume(r),P):E(r)}function f(r){return r===null||r===60||r===61||r===62||r===96?i(r):r===34||r===39?(n.consume(r),u=r,A):F(r)?(l=f,w(r)):Y(r)?(n.consume(r),f):(n.consume(r),O)}function A(r){return r===u?(n.consume(r),u=void 0,S):r===null?i(r):F(r)?(l=A,w(r)):(n.consume(r),A)}function O(r){return r===null||r===34||r===39||r===60||r===61||r===96?i(r):r===47||r===62||an(r)?E(r):(n.consume(r),O)}function S(r){return r===47||r===62||an(r)?E(r):i(r)}function T(r){return r===62?(n.consume(r),n.exit("htmlTextData"),n.exit("htmlText"),a):i(r)}function w(r){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(r),n.exit("lineEnding"),$}function $(r){return Y(r)?Kt(n,v,"linePrefix",t.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(r):v(r)}function v(r){return n.enter("htmlTextData"),l(r)}}import{factoryDestination as Zt}from"../../micromark-factory-destination@^2.0.0?target=es2022";import{factoryLabel as $t}from"../../micromark-factory-label@^2.0.0?target=es2022";import{factoryTitle as vt}from"../../micromark-factory-title@^2.0.0?target=es2022";import{factoryWhitespace as ln}from"../../micromark-factory-whitespace@^2.0.0?target=es2022";import{markdownLineEndingOrSpace as on}from"../../micromark-util-character@^2.0.0?target=es2022";import{push as U,splice as Tn}from"../../micromark-util-chunked@^2.0.0?target=es2022";import{normalizeIdentifier as Fn}from"../../micromark-util-normalize-identifier@^2.0.0?target=es2022";import{resolveAll as dt}from"../../micromark-util-resolve-all@^2.0.0?target=es2022";var Z={name:"labelEnd",resolveAll:er,resolveTo:ir,tokenize:ur},nr={tokenize:ar},tr={tokenize:lr},rr={tokenize:or};function er(n){let a=-1,i=[];for(;++a<n.length;){let t=n[a][1];if(i.push(n[a]),t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd"){let u=t.type==="labelImage"?4:2;t.type="data",a+=u}}return n.length!==i.length&&Tn(n,0,n.length,i),n}function ir(n,a){let i=n.length,t=0,u,o,l;for(;i--;){let s=n[i][1];if(u){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;n[i][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(n[i][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(u=i,s.type!=="labelLink")){t=2;break}}else s.type==="labelEnd"&&(o=i)}let m={type:n[u][1].type==="labelLink"?"link":"image",start:{...n[u][1].start},end:{...n[n.length-1][1].end}},c={type:"label",start:{...n[u][1].start},end:{...n[o][1].end}},h={type:"labelText",start:{...n[u+t+2][1].end},end:{...n[o-2][1].start}};return l=[["enter",m,a],["enter",c,a]],l=U(l,n.slice(u+1,u+t+3)),l=U(l,[["enter",h,a]]),l=U(l,dt(a.parser.constructs.insideSpan.null,n.slice(u+t+4,o-3),a)),l=U(l,[["exit",h,a],n[o-2],n[o-1],["exit",c,a]]),l=U(l,n.slice(o+1)),l=U(l,[["exit",m,a]]),Tn(n,u,n.length,l),n}function ur(n,a,i){let t=this,u=t._labelStarts,o,l;if(u){for(;u.length>0&&u[u.length-1]._balanced;)u.pop();o=u[u.length-1]}return m;function m(g){return o?o._inactive?x(g):(l=t.parser.defined.includes(Fn(t.sliceSerialize({start:o.end,end:t.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(g),n.exit("labelMarker"),n.exit("labelEnd"),c):i(g)}function c(g){return g===40?n.attempt(nr,s,l?s:x)(g):g===91?n.attempt(tr,s,l?h:x)(g):l?s(g):x(g)}function h(g){return n.attempt(rr,s,x)(g)}function s(g){return u.pop(),a(g)}function x(g){return o._balanced=!0,i(g)}}function ar(n,a,i){return t;function t(x){return n.enter("resource"),n.enter("resourceMarker"),n.consume(x),n.exit("resourceMarker"),u}function u(x){return on(x)?ln(n,o)(x):o(x)}function o(x){return x===41?s(x):Zt(n,l,m,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function l(x){return on(x)?ln(n,c)(x):s(x)}function m(x){return i(x)}function c(x){return x===34||x===39||x===40?vt(n,h,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):s(x)}function h(x){return on(x)?ln(n,s)(x):s(x)}function s(x){return x===41?(n.enter("resourceMarker"),n.consume(x),n.exit("resourceMarker"),n.exit("resource"),a):i(x)}}function lr(n,a,i){let t=this;return u;function u(m){return $t.call(t,n,o,l,"reference","referenceMarker","referenceString")(m)}function o(m){return t.parser.defined.includes(Fn(t.sliceSerialize(t.events[t.events.length-1][1]).slice(1,-1)))?a(m):i(m)}function l(m){return i(m)}}function or(n,a,i){return t;function t(o){return n.enter("reference"),n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),u}function u(o){return o===93?(n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),n.exit("reference"),a):i(o)}}var mr={name:"labelStartImage",resolveAll:Z.resolveAll,tokenize:pr};function pr(n,a,i){let t=this,u;return o;function o(c){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(c),n.exit("labelImageMarker"),l}function l(c){return c===91?(n.enter("labelMarker"),n.consume(c),n.exit("labelMarker"),u=n.exit("labelImage"),m):i(c)}function m(c){return c===94&&"_hiddenFootnoteSupport"in t.parser.constructs?i(c):(t._labelStarts=t._labelStarts||[],t._labelStarts.push(u),a(c))}}var sr={name:"labelStartLink",resolveAll:Z.resolveAll,tokenize:xr};function xr(n,a,i){let t=this,u;return o;function o(m){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(m),n.exit("labelMarker"),u=n.exit("labelLink"),l}function l(m){return m===94&&"_hiddenFootnoteSupport"in t.parser.constructs?i(m):(t._labelStarts=t._labelStarts||[],t._labelStarts.push(u),a(m))}}import{factorySpace as hr}from"../../micromark-factory-space@^2.1.0?target=es2022";import"../../micromark-util-character@^2.0.0?target=es2022";var kr={name:"lineEnding",tokenize:gr};function gr(n,a){return i;function i(t){return n.enter("lineEnding"),n.consume(t),n.exit("lineEnding"),hr(n,a,"linePrefix")}}import{factorySpace as rn}from"../../micromark-factory-space@^2.1.0?target=es2022";import{asciiDigit as Bn,markdownSpace as pn}from"../../micromark-util-character@^2.0.0?target=es2022";import{factorySpace as cr}from"../../micromark-factory-space@^2.1.0?target=es2022";import{markdownLineEnding as Sr,markdownSpace as fr}from"../../micromark-util-character@^2.0.0?target=es2022";var mn={name:"thematicBreak",tokenize:br};function br(n,a,i){let t=0,u;return o;function o(h){return n.enter("thematicBreak"),l(h)}function l(h){return u=h,m(h)}function m(h){return h===u?(n.enter("thematicBreakSequence"),c(h)):t>=3&&(h===null||Sr(h))?(n.exit("thematicBreak"),a(h)):i(h)}function c(h){return h===u?(n.consume(h),t++,c):(n.exit("thematicBreakSequence"),fr(h)?cr(n,m,"whitespace")(h):m(h))}}var Mn={continuation:{tokenize:wr},exit:Cr,name:"list",tokenize:Er},zr={partial:!0,tokenize:Ar},yr={partial:!0,tokenize:Lr};function Er(n,a,i){let t=this,u=t.events[t.events.length-1],o=u&&u[1].type==="linePrefix"?u[2].sliceSerialize(u[1],!0).length:0,l=0;return m;function m(p){let b=t.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!t.containerState.marker||p===t.containerState.marker:Bn(p)){if(t.containerState.type||(t.containerState.type=b,n.enter(b,{_container:!0})),b==="listUnordered")return n.enter("listItemPrefix"),p===42||p===45?n.check(mn,i,h)(p):h(p);if(!t.interrupt||p===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),c(p)}return i(p)}function c(p){return Bn(p)&&++l<10?(n.consume(p),c):(!t.interrupt||l<2)&&(t.containerState.marker?p===t.containerState.marker:p===41||p===46)?(n.exit("listItemValue"),h(p)):i(p)}function h(p){return n.enter("listItemMarker"),n.consume(p),n.exit("listItemMarker"),t.containerState.marker=t.containerState.marker||p,n.check(Q,t.interrupt?i:s,n.attempt(zr,g,x))}function s(p){return t.containerState.initialBlankLine=!0,o++,g(p)}function x(p){return pn(p)?(n.enter("listItemPrefixWhitespace"),n.consume(p),n.exit("listItemPrefixWhitespace"),g):i(p)}function g(p){return t.containerState.size=o+t.sliceSerialize(n.exit("listItemPrefix"),!0).length,a(p)}}function wr(n,a,i){let t=this;return t.containerState._closeFlow=void 0,n.check(Q,u,o);function u(m){return t.containerState.furtherBlankLines=t.containerState.furtherBlankLines||t.containerState.initialBlankLine,rn(n,a,"listItemIndent",t.containerState.size+1)(m)}function o(m){return t.containerState.furtherBlankLines||!pn(m)?(t.containerState.furtherBlankLines=void 0,t.containerState.initialBlankLine=void 0,l(m)):(t.containerState.furtherBlankLines=void 0,t.containerState.initialBlankLine=void 0,n.attempt(yr,a,l)(m))}function l(m){return t.containerState._closeFlow=!0,t.interrupt=void 0,rn(n,n.attempt(Mn,a,i),"linePrefix",t.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function Lr(n,a,i){let t=this;return rn(n,u,"listItemIndent",t.containerState.size+1);function u(o){let l=t.events[t.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===t.containerState.size?a(o):i(o)}}function Cr(n){n.exit(this.containerState.type)}function Ar(n,a,i){let t=this;return rn(n,u,"listItemPrefixWhitespace",t.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function u(o){let l=t.events[t.events.length-1];return!pn(o)&&l&&l[1].type==="listItemPrefixWhitespace"?a(o):i(o)}}import{factorySpace as Ir}from"../../micromark-factory-space@^2.1.0?target=es2022";import{markdownLineEnding as Tr,markdownSpace as Fr}from"../../micromark-util-character@^2.0.0?target=es2022";import{EditMap as Br}from"../../micromark-util-edit-map@^1.0.0?target=es2022";var Mr={name:"setextUnderline",resolveTo:Pr,tokenize:qr};function Pr(n,a){let i=new Br,t=n.length,u,o,l;for(;t--;)if(n[t][0]==="enter"){if(n[t][1].type==="content"){u=t;break}n[t][1].type==="paragraph"&&(o=t)}else n[t][1].type==="content"&&i.add(t,1,[]),!l&&n[t][1].type==="definition"&&(l=t);let m={type:"setextHeading",start:{...n[u][1].start},end:{...n[n.length-1][1].end}};return n[o][1].type="setextHeadingText",l?(i.add(o,0,[["enter",m,a]]),i.add(l+1,0,[["exit",n[u][1],a]]),n[u][1].end={...n[l][1].end}):n[u][1]=m,i.add(n.length,0,[["exit",m,a]]),i.consume(n),n}function qr(n,a,i){let t=this,u;return o;function o(h){let s=t.events.length,x;for(;s--;)if(t.events[s][1].type!=="lineEnding"&&t.events[s][1].type!=="linePrefix"&&t.events[s][1].type!=="content"){x=t.events[s][1].type==="paragraph";break}return!t.parser.lazy[t.now().line]&&(t.interrupt||x)?(n.enter("setextHeadingLine"),u=h,l(h)):i(h)}function l(h){return n.enter("setextHeadingLineSequence"),m(h)}function m(h){return h===u?(n.consume(h),m):(n.exit("setextHeadingLineSequence"),Fr(h)?Ir(n,c,"lineSuffix")(h):c(h))}function c(h){return h===null||Tr(h)?(n.exit("setextHeadingLine"),a(h)):i(h)}}export{On as attention,Nn as autolink,Q as blankLine,kn as blockQuote,vn as characterEscape,et as characterReference,at as codeFenced,ot as codeIndented,xt as codeText,ft as content,It as definition,Pt as hardBreakEscape,Ht as headingAtx,Wt as htmlFlow,Xt as htmlText,Z as labelEnd,mr as labelStartImage,sr as labelStartLink,kr as lineEnding,Mn as list,Mr as setextUnderline,mn as thematicBreak};
//# sourceMappingURL=micromark-core-commonmark.mjs.map