From 860120d9cf8ea962719591c309becaf6249e59ff Mon Sep 17 00:00:00 2001
From: Jakub Zych ${_(c)}`)),e=e.replace(/\[([^\]\n]+)\]\(([^()\s]*(?:\([^()\s]*\)[^()\s]*)*)\)/g,(i,c,r)=>{const p=T(r),a=S(_(c));if(!p)return s(a);const n=/^https?:/i.test(p)?' target="_blank" rel="noopener noreferrer nofollow"':"";return s(`${a}`)}),e=S(_(e)),e.replace(/\u0000(\d+)\u0000/g,(i,c)=>t[Number(c)]??"")}function S(o){return o.replace(/\*\*([^*\n]+)\*\*/g,"$1").replace(/(^|[\s(])\*([^*\n]+)\*(?=$|[\s).,;:!?])/g,"$1$2").replace(/(^|[\s(])_([^_\n]+)_(?=$|[\s).,;:!?])/g,"$1$2")}function q(o){if(!o)return"";const t=o.replace(/\r\n?/g,`
+`).split(`
+`),s=[];let e=0;const i=r=>r.trim()==="",c=r=>/^(#{1,6})\s/.test(r)||/^```/.test(r)||/^>\s?/.test(r)||/^\s*([-*+]|\d+[.)])\s+/.test(r)||/^(-{3,}|\*{3,}|_{3,})\s*$/.test(r);for(;e${_(n.join(`
+`))}`);continue}const p=/^(#{1,6})\s+(.*?)\s*#*\s*$/.exec(r);if(p){const n=Math.min(p[1].length+1,6);s.push(`
"),e++;continue}if(/^>\s?/.test(r)){const n=[];for(;e${q(n.join(`
+`))}
`);continue}const a=/^\s*([-*+]|\d+[.)])\s+(.*)$/.exec(r);if(a){const n=/\d/.test(a[1]),v=[];for(;e${v.join("")}
`:`${v.join("")}
`);continue}const m=[r];for(e++;e
F?Fe(d,b,_,!0,!1,P):$(h,m,y,b,_,x,A,R,P)},Et=(d,h,m,y,b,_,x,A,R)=>{let E=0;const F=h.length;let P=d.length-1,L=F-1;for(;E<=P&&E<=L;){const H=d[E],W=h[E]=R?ft(h[E]):tt(h[E]);if(rn(H,W))w(H,W,m,null,b,_,x,A,R);else break;E++}for(;E<=P&&E<=L;){const H=d[P],W=h[L]=R?ft(h[L]):tt(h[L]);if(rn(H,W))w(H,W,m,null,b,_,x,A,R);else break;P--,L--}if(E>P){if(E<=L){const H=L+1,W=H