import{o as t}from"./devlop-Cl3hj7Sz.js";import{h as e}from"./mdast-util-to-markdown-CTgpsuc0.js";function s(){return{exit:{taskListCheckValueChecked:n,taskListCheckValueUnchecked:n,paragraph:i}}}function a(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:o}}}function n(e){const s=this.stack[this.stack.length-2];t("listItem"===s.type),s.checked="taskListCheckValueChecked"===e.type}function i(e){const s=this.stack[this.stack.length-2];if(s&&"listItem"===s.type&&"boolean"==typeof s.checked){const e=this.stack[this.stack.length-1];t("paragraph"===e.type);const a=e.children[0];if(a&&"text"===a.type){const t=s.children;let n,i=-1;for(;++i<t.length;){const e=t[i];if("paragraph"===e.type){n=e;break}}n===e&&(a.value=a.value.slice(1),0===a.value.length?e.children.shift():e.position&&a.position&&"number"==typeof a.position.start.offset&&(a.position.start.column++,a.position.start.offset++,e.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function o(t,s,a,n){const i=t.children[0],o="boolean"==typeof t.checked&&i&&"paragraph"===i.type,c="["+(t.checked?"x":" ")+"] ",r=a.createTracker(n);o&&r.move(c);let h=e.listItem(t,s,a,{...n,...r.current()});return o&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(t){return t+c})),h}export{a,s as g};
