import{s as g}from"./vendor-micromark-util-chunked-DrRIdSP-.js";import{c as k}from"./vendor-micromark-util-classify-character-Bc1Mydac.js";import{r as d}from"./vendor-micromark-util-resolve-all-PQCKh0dx.js";function j(m){let l=(m||{}).singleTilde;const f={name:"strikethrough",tokenize:S,resolveAll:y};return l==null&&(l=!0),{text:{126:f},insideSpan:{null:[f]},attentionMarkers:{null:[126]}};function y(r,i){let t=-1;for(;++t<r.length;)if(r[t][0]==="enter"&&r[t][1].type==="strikethroughSequenceTemporary"&&r[t][1]._close){let e=t;for(;e--;)if(r[e][0]==="exit"&&r[e][1].type==="strikethroughSequenceTemporary"&&r[e][1]._open&&r[t][1].end.offset-r[t][1].start.offset===r[e][1].end.offset-r[e][1].start.offset){r[t][1].type="strikethroughSequence",r[e][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},r[e][1].start),end:Object.assign({},r[t][1].end)},s={type:"strikethroughText",start:Object.assign({},r[e][1].end),end:Object.assign({},r[t][1].start)},o=[["enter",u,i],["enter",r[e][1],i],["exit",r[e][1],i],["enter",s,i]],h=i.parser.constructs.insideSpan.null;h&&g(o,o.length,0,d(h,r.slice(e+1,t),i)),g(o,o.length,0,[["exit",s,i],["enter",r[t][1],i],["exit",r[t][1],i],["exit",u,i]]),g(r,e-1,t-e+3,o),t=e+o.length-2;break}}for(t=-1;++t<r.length;)r[t][1].type==="strikethroughSequenceTemporary"&&(r[t][1].type="data");return r}function S(r,i,t){const e=this.previous,u=this.events;let s=0;return o;function o(n){return e===126&&u[u.length-1][1].type!=="characterEscape"?t(n):(r.enter("strikethroughSequenceTemporary"),h(n))}function h(n){const a=k(e);if(n===126)return s>1?t(n):(r.consume(n),s++,h);if(s<2&&!l)return t(n);const c=r.exit("strikethroughSequenceTemporary"),p=k(n);return c._open=!p||p===2&&!!a,c._close=!a||a===2&&!!p,i(n)}}}export{j as g};
