!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).ContentsOutline=t()}(this,function(){"use strict";const l=(e,t)=>{const n=[];return[].slice.call(e).forEach(e=>{e=new o(e,t);e&&n.push(e)}),n},d=(l,e)=>{if("true"!==l.getAttribute("data-initialized")){const t=l.querySelector(".contents-outline");if(t){const d=e.headings.filter(e=>{let t=e,n=!1,o=!1;for(;;){if(!t.parentNode||["#document","HTML","BODY"].includes(t.parentNode.nodeName))break;if(n="none"===window.getComputedStyle(t.parentNode).getPropertyValue("display"),o="hidden"===window.getComputedStyle(t.parentNode).getPropertyValue("visibility"),n||o)break;t=t.parentNode}return"none"!==window.getComputedStyle(e).getPropertyValue("display")&&"hidden"!==window.getComputedStyle(e).getPropertyValue("visibility")&&!n&&!o});if(d.length<1)l.parentNode.removeChild(l);else{d.sort((e,t)=>{return e.getBoundingClientRect().top-t.getBoundingClientRect().top});const a=(e,t)=>{return document.getElementById(`${e}${t}`)?a(e,t+1):t};let n=0;[].slice.call(d).forEach(e=>{var t;e.getAttribute("id")||(t=n,t=a("co-index-",t),e.setAttribute("id",`co-index-${t}`),n=t+1)});const c=e=>{const t=document.createElement("li"),n=document.createElement("a");return n.textContent=e.textContent.replace(/[\n\r]/g,""),n.setAttribute("href",`#${encodeURI(e.getAttribute("id"))}`),t.appendChild(n),t},s=(e,t)=>{let n="";for(let e=0;e{e=t.parentNode===e;return e&&(n=t),e})?n:t.parentNode?u(t.parentNode,e):t},f=document.createElement("ol");let o=void 0,r=0,i=!1;if(d.forEach(e=>{var t,t=(t=e)?parseInt(t.tagName.replace("H","")):void 0;to&&(1{e.forEach(e=>{if(e.isIntersecting){const t=l.querySelector('[data-is-current="true"]');t&&t.removeAttribute("data-is-current");const n=l.querySelector(`a[href='#${encodeURI(e.target.id)}']`);n&&n.parentElement.setAttribute("data-is-current","true")}})},{root:null,rootMargin:"-50% 0px",threshold:0});[].slice.call(d).forEach(e=>{m.observe(e)})}t.appendChild(f),l.setAttribute("aria-hidden","false"),l.setAttribute("data-initialized","true")}}}};function o(e){var t=1