function e(e,t=`h1, h2, h3, h4, h5, h6`){let n=document.querySelector(e);if(!n)return;let r=document.getElementById(`heading-anchor-svg`)?.content.querySelector(`svg`)??null;n.querySelectorAll(t).forEach(e=>{if(!e.id){let t=e.textContent?.trim()??``;if(!t||(e.id=t.toLowerCase().replace(/\s+/g,`-`).replace(/[^\p{L}\p{N}-]/gu,``),!e.id))return}if(e.querySelector(`.heading-anchor`))return;let t=document.createElement(`a`);if(t.href=`#${e.id}`,t.className=`heading-anchor`,t.setAttribute(`aria-label`,`Permalink to "${e.textContent?.trim()??``}"`),r){let e=document.createElement(`span`);e.className=`heading-anchor-icon`,e.setAttribute(`aria-hidden`,`true`),e.append(r.cloneNode(!0)),t.append(e)}e.append(t)})}export{e as t};