import{p as L,s as X}from"./vendor-micromark-util-chunked-DrRIdSP-.js";import{c as d}from"./vendor-micromark-util-classify-character-Bc1Mydac.js";import{r as en}from"./vendor-micromark-util-resolve-all-PQCKh0dx.js";import{b as q,c as F,d as sn,e as pn,f as b,m as z,g as hn,h as xn,i as Z,j as A}from"./vendor-micromark-util-character-Cn8n62xE.js";import{f as y}from"./vendor-micromark-factory-space-BM4zcA-B.js";import{d as kn}from"./vendor-decode-named-character-reference-C3-224fz.js";import{s as gn}from"./vendor-micromark-util-subtokenize-BF1Jf29a.js";import{f as un}from"./vendor-micromark-factory-destination-QK-4WEtY.js";import{f as an}from"./vendor-micromark-factory-label-Bo_B4AwM.js";import{f as ln}from"./vendor-micromark-factory-title-D-E2MfTG.js";import{f as G}from"./vendor-micromark-factory-whitespace-D8F2YPRT.js";import{n as $}from"./vendor-micromark-util-normalize-identifier-C9ANKk3v.js";import{h as nn,a as Sn}from"./vendor-micromark-util-html-tag-name-DbKNfynz.js";const Ot={name:"attention",resolveAll:zn,tokenize:bn};function zn(n,a){let r=-1,t,l,o,u,m,g,h,x;for(;++r1&&n[r][1].end.offset-n[r][1].start.offset>1?2:1;const p={...n[t][1].end},S={...n[r][1].start};tn(p,-g),tn(S,g),u={type:g>1?"strongSequence":"emphasisSequence",start:p,end:{...n[t][1].end}},m={type:g>1?"strongSequence":"emphasisSequence",start:{...n[r][1].start},end:S},o={type:g>1?"strongText":"emphasisText",start:{...n[t][1].end},end:{...n[r][1].start}},l={type:g>1?"strong":"emphasis",start:{...u.start},end:{...m.end}},n[t][1].end={...u.start},n[r][1].start={...m.end},h=[],n[t][1].end.offset-n[t][1].start.offset&&(h=L(h,[["enter",n[t][1],a],["exit",n[t][1],a]])),h=L(h,[["enter",l,a],["enter",u,a],["exit",u,a],["enter",o,a]]),h=L(h,en(a.parser.constructs.insideSpan.null,n.slice(t+1,r),a)),h=L(h,[["exit",o,a],["enter",m,a],["exit",m,a],["exit",l,a]]),n[r][1].end.offset-n[r][1].start.offset?(x=2,h=L(h,[["enter",n[r][1],a],["exit",n[r][1],a]])):x=0,X(n,t-1,r-t+3,h),r=t+h.length-x-2;break}}for(r=-1;++r0&&b(k)?y(n,M,"linePrefix",o+1)(k):M(k)}function M(k){return k===null||z(k)?n.check(rn,B,R)(k):(n.enter("codeFlowValue"),w(k))}function w(k){return k===null||z(k)?(n.exit("codeFlowValue"),M(k)):(n.consume(k),w)}function R(k){return n.exit("codeFenced"),a(k)}function N(k,C,D){let I=0;return H;function H(c){return k.enter("lineEnding"),k.consume(c),k.exit("lineEnding"),V}function V(c){return k.enter("codeFencedFence"),b(c)?y(k,E,"linePrefix",t.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):E(c)}function E(c){return c===m?(k.enter("codeFencedFenceSequence"),P(c)):D(c)}function P(c){return c===m?(I++,k.consume(c),P):I>=u?(k.exit("codeFencedFenceSequence"),b(c)?y(k,Q,"whitespace")(c):Q(c)):D(c)}function Q(c){return c===null||z(c)?(k.exit("codeFencedFence"),C(c)):D(c)}}}function Ln(n,a,r){const t=this;return l;function l(u){return u===null?r(u):(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),o)}function o(u){return t.parser.lazy[t.now().line]?r(u):a(u)}}const Nt={name:"codeIndented",tokenize:Bn},Fn={partial:!0,tokenize:Mn};function Bn(n,a,r){const t=this;return l;function l(h){return n.enter("codeIndented"),y(n,o,"linePrefix",5)(h)}function o(h){const x=t.events[t.events.length-1];return x&&x[1].type==="linePrefix"&&x[2].sliceSerialize(x[1],!0).length>=4?u(h):r(h)}function u(h){return h===null?g(h):z(h)?n.attempt(Fn,u,g)(h):(n.enter("codeFlowValue"),m(h))}function m(h){return h===null||z(h)?(n.exit("codeFlowValue"),u(h)):(n.consume(h),m)}function g(h){return n.exit("codeIndented"),a(h)}}function Mn(n,a,r){const t=this;return l;function l(u){return t.parser.lazy[t.now().line]?r(u):z(u)?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),l):y(n,o,"linePrefix",5)(u)}function o(u){const m=t.events[t.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?a(u):z(u)?l(u):r(u)}}const Qt={name:"codeText",previous:qn,resolve:Pn,tokenize:Dn};function Pn(n){let a=n.length-4,r=3,t,l;if((n[r][1].type==="lineEnding"||n[r][1].type==="space")&&(n[a][1].type==="lineEnding"||n[a][1].type==="space")){for(t=r;++t=4?a(u):n.interrupt(t.parser.constructs.flow,r,a)(u)}}const Ut={name:"definition",tokenize:Nn},_n={partial:!0,tokenize:Qn};function Nn(n,a,r){const t=this;let l;return o;function o(s){return n.enter("definition"),u(s)}function u(s){return an.call(t,n,m,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(s)}function m(s){return l=$(t.sliceSerialize(t.events[t.events.length-1][1]).slice(1,-1)),s===58?(n.enter("definitionMarker"),n.consume(s),n.exit("definitionMarker"),g):r(s)}function g(s){return A(s)?G(n,h)(s):h(s)}function h(s){return un(n,x,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(s)}function x(s){return n.attempt(_n,p,p)(s)}function p(s){return b(s)?y(n,S,"whitespace")(s):S(s)}function S(s){return s===null||z(s)?(n.exit("definition"),t.parser.defined.push(l),a(s)):r(s)}}function Qn(n,a,r){return t;function t(m){return A(m)?G(n,l)(m):r(m)}function l(m){return ln(n,o,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(m)}function o(m){return b(m)?y(n,u,"whitespace")(m):u(m)}function u(m){return m===null||z(m)?a(m):r(m)}}const jt={name:"hardBreakEscape",tokenize:Wn};function Wn(n,a,r){return t;function t(o){return n.enter("hardBreakEscape"),n.consume(o),l}function l(o){return z(o)?(n.exit("hardBreakEscape"),a(o)):r(o)}}const Gt={name:"headingAtx",resolve:Un,tokenize:jn};function Un(n,a){let r=n.length-2,t=3,l,o;return n[t][1].type==="whitespace"&&(t+=2),r-2>t&&n[r][1].type==="whitespace"&&(r-=2),n[r][1].type==="atxHeadingSequence"&&(t===r-1||r-4>t&&n[r-2][1].type==="whitespace")&&(r-=t+1===r?2:4),r>t&&(l={type:"atxHeadingText",start:n[t][1].start,end:n[r][1].end},o={type:"chunkText",start:n[t][1].start,end:n[r][1].end,contentType:"text"},X(n,t,r-t+1,[["enter",l,a],["enter",o,a],["exit",o,a],["exit",l,a]])),n}function jn(n,a,r){let t=0;return l;function l(x){return n.enter("atxHeading"),o(x)}function o(x){return n.enter("atxHeadingSequence"),u(x)}function u(x){return x===35&&t++<6?(n.consume(x),u):x===null||A(x)?(n.exit("atxHeadingSequence"),m(x)):r(x)}function m(x){return x===35?(n.enter("atxHeadingSequence"),g(x)):x===null||z(x)?(n.exit("atxHeading"),a(x)):b(x)?y(n,m,"whitespace")(x):(n.enter("atxHeadingText"),h(x))}function g(x){return x===35?(n.consume(x),g):(n.exit("atxHeadingSequence"),m(x))}function h(x){return x===null||x===35||A(x)?(n.exit("atxHeadingText"),m(x)):(n.consume(x),h)}}const Jt={concrete:!0,name:"htmlFlow",resolveTo:Kn,tokenize:Xn},Gn={partial:!0,tokenize:Zn},Jn={partial:!0,tokenize:Yn};function Kn(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 Xn(n,a,r){const t=this;let l,o,u,m,g;return h;function h(i){return x(i)}function x(i){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(i),p}function p(i){return i===33?(n.consume(i),S):i===47?(n.consume(i),o=!0,B):i===63?(n.consume(i),l=3,t.interrupt?a:e):q(i)?(n.consume(i),u=String.fromCharCode(i),_):r(i)}function S(i){return i===45?(n.consume(i),l=2,s):i===91?(n.consume(i),l=5,m=0,f):q(i)?(n.consume(i),l=4,t.interrupt?a:e):r(i)}function s(i){return i===45?(n.consume(i),t.interrupt?a:e):r(i)}function f(i){const U="CDATA[";return i===U.charCodeAt(m++)?(n.consume(i),m===U.length?t.interrupt?a:E:f):r(i)}function B(i){return q(i)?(n.consume(i),u=String.fromCharCode(i),_):r(i)}function _(i){if(i===null||i===47||i===62||A(i)){const U=i===47,mn=u.toLowerCase();return!U&&!o&&nn.includes(mn)?(l=1,t.interrupt?a(i):E(i)):Sn.includes(u.toLowerCase())?(l=6,U?(n.consume(i),j):t.interrupt?a(i):E(i)):(l=7,t.interrupt&&!t.parser.lazy[t.now().line]?r(i):o?M(i):w(i))}return i===45||F(i)?(n.consume(i),u+=String.fromCharCode(i),_):r(i)}function j(i){return i===62?(n.consume(i),t.interrupt?a:E):r(i)}function M(i){return b(i)?(n.consume(i),M):H(i)}function w(i){return i===47?(n.consume(i),H):i===58||i===95||q(i)?(n.consume(i),R):b(i)?(n.consume(i),w):H(i)}function R(i){return i===45||i===46||i===58||i===95||F(i)?(n.consume(i),R):N(i)}function N(i){return i===61?(n.consume(i),k):b(i)?(n.consume(i),N):w(i)}function k(i){return i===null||i===60||i===61||i===62||i===96?r(i):i===34||i===39?(n.consume(i),g=i,C):b(i)?(n.consume(i),k):D(i)}function C(i){return i===g?(n.consume(i),g=null,I):i===null||z(i)?r(i):(n.consume(i),C)}function D(i){return i===null||i===34||i===39||i===47||i===60||i===61||i===62||i===96||A(i)?N(i):(n.consume(i),D)}function I(i){return i===47||i===62||b(i)?w(i):r(i)}function H(i){return i===62?(n.consume(i),V):r(i)}function V(i){return i===null||z(i)?E(i):b(i)?(n.consume(i),V):r(i)}function E(i){return i===45&&l===2?(n.consume(i),O):i===60&&l===1?(n.consume(i),T):i===62&&l===4?(n.consume(i),W):i===63&&l===3?(n.consume(i),e):i===93&&l===5?(n.consume(i),K):z(i)&&(l===6||l===7)?(n.exit("htmlFlowData"),n.check(Gn,Y,P)(i)):i===null||z(i)?(n.exit("htmlFlowData"),P(i)):(n.consume(i),E)}function P(i){return n.check(Jn,Q,Y)(i)}function Q(i){return n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),c}function c(i){return i===null||z(i)?P(i):(n.enter("htmlFlowData"),E(i))}function O(i){return i===45?(n.consume(i),e):E(i)}function T(i){return i===47?(n.consume(i),u="",J):E(i)}function J(i){if(i===62){const U=u.toLowerCase();return nn.includes(U)?(n.consume(i),W):E(i)}return q(i)&&u.length<8?(n.consume(i),u+=String.fromCharCode(i),J):E(i)}function K(i){return i===93?(n.consume(i),e):E(i)}function e(i){return i===62?(n.consume(i),W):i===45&&l===2?(n.consume(i),e):E(i)}function W(i){return i===null||z(i)?(n.exit("htmlFlowData"),Y(i)):(n.consume(i),W)}function Y(i){return n.exit("htmlFlow"),a(i)}}function Yn(n,a,r){const t=this;return l;function l(u){return z(u)?(n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),o):r(u)}function o(u){return t.parser.lazy[t.now().line]?r(u):a(u)}}function Zn(n,a,r){return t;function t(l){return n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),n.attempt(v,a,r)}}const Kt={name:"htmlText",tokenize:$n};function $n(n,a,r){const t=this;let l,o,u;return m;function m(e){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(e),g}function g(e){return e===33?(n.consume(e),h):e===47?(n.consume(e),N):e===63?(n.consume(e),w):q(e)?(n.consume(e),D):r(e)}function h(e){return e===45?(n.consume(e),x):e===91?(n.consume(e),o=0,f):q(e)?(n.consume(e),M):r(e)}function x(e){return e===45?(n.consume(e),s):r(e)}function p(e){return e===null?r(e):e===45?(n.consume(e),S):z(e)?(u=p,T(e)):(n.consume(e),p)}function S(e){return e===45?(n.consume(e),s):p(e)}function s(e){return e===62?O(e):e===45?S(e):p(e)}function f(e){const W="CDATA[";return e===W.charCodeAt(o++)?(n.consume(e),o===W.length?B:f):r(e)}function B(e){return e===null?r(e):e===93?(n.consume(e),_):z(e)?(u=B,T(e)):(n.consume(e),B)}function _(e){return e===93?(n.consume(e),j):B(e)}function j(e){return e===62?O(e):e===93?(n.consume(e),j):B(e)}function M(e){return e===null||e===62?O(e):z(e)?(u=M,T(e)):(n.consume(e),M)}function w(e){return e===null?r(e):e===63?(n.consume(e),R):z(e)?(u=w,T(e)):(n.consume(e),w)}function R(e){return e===62?O(e):w(e)}function N(e){return q(e)?(n.consume(e),k):r(e)}function k(e){return e===45||F(e)?(n.consume(e),k):C(e)}function C(e){return z(e)?(u=C,T(e)):b(e)?(n.consume(e),C):O(e)}function D(e){return e===45||F(e)?(n.consume(e),D):e===47||e===62||A(e)?I(e):r(e)}function I(e){return e===47?(n.consume(e),O):e===58||e===95||q(e)?(n.consume(e),H):z(e)?(u=I,T(e)):b(e)?(n.consume(e),I):O(e)}function H(e){return e===45||e===46||e===58||e===95||F(e)?(n.consume(e),H):V(e)}function V(e){return e===61?(n.consume(e),E):z(e)?(u=V,T(e)):b(e)?(n.consume(e),V):I(e)}function E(e){return e===null||e===60||e===61||e===62||e===96?r(e):e===34||e===39?(n.consume(e),l=e,P):z(e)?(u=E,T(e)):b(e)?(n.consume(e),E):(n.consume(e),Q)}function P(e){return e===l?(n.consume(e),l=void 0,c):e===null?r(e):z(e)?(u=P,T(e)):(n.consume(e),P)}function Q(e){return e===null||e===34||e===39||e===60||e===61||e===96?r(e):e===47||e===62||A(e)?I(e):(n.consume(e),Q)}function c(e){return e===47||e===62||A(e)?I(e):r(e)}function O(e){return e===62?(n.consume(e),n.exit("htmlTextData"),n.exit("htmlText"),a):r(e)}function T(e){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(e),n.exit("lineEnding"),J}function J(e){return b(e)?y(n,K,"linePrefix",t.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(e):K(e)}function K(e){return n.enter("htmlTextData"),u(e)}}const on={name:"labelEnd",resolveAll:tt,resolveTo:rt,tokenize:et},vn={tokenize:it},dn={tokenize:ut},nt={tokenize:at};function tt(n){let a=-1;const r=[];for(;++a=3&&(h===null||z(h))?(n.exit("thematicBreak"),a(h)):r(h)}function g(h){return h===l?(n.consume(h),t++,g):(n.exit("thematicBreakSequence"),b(h)?y(n,m,"whitespace")(h):m(h))}}const ht={continuation:{tokenize:St},exit:bt,name:"list",tokenize:gt},xt={partial:!0,tokenize:ct},kt={partial:!0,tokenize:zt};function gt(n,a,r){const t=this,l=t.events[t.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,u=0;return m;function m(s){const f=t.containerState.type||(s===42||s===43||s===45?"listUnordered":"listOrdered");if(f==="listUnordered"?!t.containerState.marker||s===t.containerState.marker:Z(s)){if(t.containerState.type||(t.containerState.type=f,n.enter(f,{_container:!0})),f==="listUnordered")return n.enter("listItemPrefix"),s===42||s===45?n.check(st,r,h)(s):h(s);if(!t.interrupt||s===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),g(s)}return r(s)}function g(s){return Z(s)&&++u<10?(n.consume(s),g):(!t.interrupt||u<2)&&(t.containerState.marker?s===t.containerState.marker:s===41||s===46)?(n.exit("listItemValue"),h(s)):r(s)}function h(s){return n.enter("listItemMarker"),n.consume(s),n.exit("listItemMarker"),t.containerState.marker=t.containerState.marker||s,n.check(v,t.interrupt?r:x,n.attempt(xt,S,p))}function x(s){return t.containerState.initialBlankLine=!0,o++,S(s)}function p(s){return b(s)?(n.enter("listItemPrefixWhitespace"),n.consume(s),n.exit("listItemPrefixWhitespace"),S):r(s)}function S(s){return t.containerState.size=o+t.sliceSerialize(n.exit("listItemPrefix"),!0).length,a(s)}}function St(n,a,r){const t=this;return t.containerState._closeFlow=void 0,n.check(v,l,o);function l(m){return t.containerState.furtherBlankLines=t.containerState.furtherBlankLines||t.containerState.initialBlankLine,y(n,a,"listItemIndent",t.containerState.size+1)(m)}function o(m){return t.containerState.furtherBlankLines||!b(m)?(t.containerState.furtherBlankLines=void 0,t.containerState.initialBlankLine=void 0,u(m)):(t.containerState.furtherBlankLines=void 0,t.containerState.initialBlankLine=void 0,n.attempt(kt,a,u)(m))}function u(m){return t.containerState._closeFlow=!0,t.interrupt=void 0,y(n,n.attempt(ht,a,r),"linePrefix",t.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m)}}function zt(n,a,r){const t=this;return y(n,l,"listItemIndent",t.containerState.size+1);function l(o){const u=t.events[t.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===t.containerState.size?a(o):r(o)}}function bt(n){n.exit(this.containerState.type)}function ct(n,a,r){const t=this;return y(n,l,"listItemPrefixWhitespace",t.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const u=t.events[t.events.length-1];return!b(o)&&u&&u[1].type==="listItemPrefixWhitespace"?a(o):r(o)}}const $t={name:"setextUnderline",resolveTo:yt,tokenize:Et};function yt(n,a){let r=n.length,t,l,o;for(;r--;)if(n[r][0]==="enter"){if(n[r][1].type==="content"){t=r;break}n[r][1].type==="paragraph"&&(l=r)}else n[r][1].type==="content"&&n.splice(r,1),!o&&n[r][1].type==="definition"&&(o=r);const u={type:"setextHeading",start:{...n[t][1].start},end:{...n[n.length-1][1].end}};return n[l][1].type="setextHeadingText",o?(n.splice(l,0,["enter",u,a]),n.splice(o+1,0,["exit",n[t][1],a]),n[t][1].end={...n[o][1].end}):n[t][1]=u,n.push(["exit",u,a]),n}function Et(n,a,r){const t=this;let l;return o;function o(h){let x=t.events.length,p;for(;x--;)if(t.events[x][1].type!=="lineEnding"&&t.events[x][1].type!=="linePrefix"&&t.events[x][1].type!=="content"){p=t.events[x][1].type==="paragraph";break}return!t.parser.lazy[t.now().line]&&(t.interrupt||p)?(n.enter("setextHeadingLine"),l=h,u(h)):r(h)}function u(h){return n.enter("setextHeadingLineSequence"),m(h)}function m(h){return h===l?(n.consume(h),m):(n.exit("setextHeadingLineSequence"),b(h)?y(n,g,"lineSuffix")(h):g(h))}function g(h){return h===null||z(h)?(n.exit("setextHeadingLine"),a(h)):r(h)}}export{En as a,v as b,Wt as c,Ut as d,Nt as e,_t as f,Gt as g,Jt as h,Ht as i,Vt as j,Qt as k,ht as l,Ot as m,on as n,jt as o,Yt as p,Rt as q,Kt as r,$t as s,st as t,Xt as u,Zt as v};