"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../../../micromark-util-chunked@2.0.1/node_modules/micromark-util-chunked/index.cjs.js"),k=require("../../../../micromark-util-classify-character@2.0.1/node_modules/micromark-util-classify-character/index.cjs.js"),m=require("../../../../micromark-util-resolve-all@2.0.1/node_modules/micromark-util-resolve-all/index.cjs.js");function q(y){let h=(y||{}).singleTilde;const p={name:"strikethrough",tokenize:d,resolveAll:S};return h==null&&(h=!0),{text:{126:p},insideSpan:{null:[p]},attentionMarkers:{null:[126]}};function S(e,i){let r=-1;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="strikethroughSequenceTemporary"&&e[r][1]._close){let t=r;for(;t--;)if(e[t][0]==="exit"&&e[t][1].type==="strikethroughSequenceTemporary"&&e[t][1]._open&&e[r][1].end.offset-e[r][1].start.offset===e[t][1].end.offset-e[t][1].start.offset){e[r][1].type="strikethroughSequence",e[t][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},e[t][1].start),end:Object.assign({},e[r][1].end)},s={type:"strikethroughText",start:Object.assign({},e[t][1].end),end:Object.assign({},e[r][1].start)},o=[["enter",u,i],["enter",e[t][1],i],["exit",e[t][1],i],["enter",s,i]],l=i.parser.constructs.insideSpan.null;l&&g.splice(o,o.length,0,m.resolveAll(l,e.slice(t+1,r),i)),g.splice(o,o.length,0,[["exit",s,i],["enter",e[r][1],i],["exit",e[r][1],i],["exit",u,i]]),g.splice(e,t-1,r-t+3,o),r=t+o.length-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="strikethroughSequenceTemporary"&&(e[r][1].type="data");return e}function d(e,i,r){const t=this.previous,u=this.events;let s=0;return o;function o(n){return t===126&&u[u.length-1][1].type!=="characterEscape"?r(n):(e.enter("strikethroughSequenceTemporary"),l(n))}function l(n){const a=k.classifyCharacter(t);if(n===126)return s>1?r(n):(e.consume(n),s++,l);if(s<2&&!h)return r(n);const f=e.exit("strikethroughSequenceTemporary"),c=k.classifyCharacter(n);return f._open=!c||c===2&&!!a,f._close=!a||a===2&&!!c,i(n)}}}exports.gfmStrikethrough=q;
//# sourceMappingURL=syntax.cjs.js.map
