import{g as f}from"./copy-to-clipboard-B1uT6SkR.js";var l=!0,c=!1,s=!1,u=function(e,t){t&&(l=!t.enabled,c=!!t.label,s=!!t.labelAfter),e.core.ruler.after("inline","github-task-lists",function(r){for(var n=r.tokens,a=2;a<n.length;a++)o(n,a)&&(d(n[a],r.Token),i(n[a-2],"class","task-list-item"+(l?"":" enabled")),i(n[h(n,a-2)],"class","contains-task-list"))})};function i(e,t,r){var n=e.attrIndex(t),a=[t,r];n<0?e.attrPush(a):e.attrs[n]=a}function h(e,t){for(var r=e[t].level-1,n=t-1;n>=0;n--)if(e[n].level===r)return n;return-1}function o(e,t){return x(e[t])&&g(e[t-1])&&L(e[t-2])&&_(e[t])}function d(e,t){if(e.children.unshift(b(e,t)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),c)if(s){e.children.pop();var r="task-item-"+Math.ceil(Math.random()*(1e4*1e3)-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+' id="'+r+'">',e.children.push(m(e.content,r,t))}else e.children.unshift(p(t)),e.children.push(v(t))}function b(e,t){var r=new t("html_inline","",0),n=l?' disabled="" ':"";return e.content.indexOf("[ ] ")===0?r.content='<input class="task-list-item-checkbox"'+n+'type="checkbox">':(e.content.indexOf("[x] ")===0||e.content.indexOf("[X] ")===0)&&(r.content='<input class="task-list-item-checkbox" checked=""'+n+'type="checkbox">'),r}function p(e){var t=new e("html_inline","",0);return t.content="<label>",t}function v(e){var t=new e("html_inline","",0);return t.content="</label>",t}function m(e,t,r){var n=new r("html_inline","",0);return n.content='<label class="task-list-item-label" for="'+t+'">'+e+"</label>",n.attrs=[{for:t}],n}function x(e){return e.type==="inline"}function g(e){return e.type==="paragraph_open"}function L(e){return e.type==="list_item_open"}function _(e){return e.content.indexOf("[ ] ")===0||e.content.indexOf("[x] ")===0||e.content.indexOf("[X] ")===0}const y=f(u);export{y as T};
