import{r as t,h as e}from"./p-3d23a42a.js";const s=class{constructor(s){t(this,s),this.links=[],this.label="Contents",this.basepath="",this.itemOffsets=[],this.selectedId=null,this.pageWidth=document.body.offsetWidth,this.toItem=({text:t,href:s})=>e("li",null,e("stencil-route-link",{url:`${this.basepath}${s}`,class:"Nav-link "+(this.selectedId===s?"selected":"")},t))}function(){this.pageWidth<1234||requestAnimationFrame((()=>{const t=this.itemOffsets.findIndex((t=>t.topOffset>window.scrollY));this.selectedId=0===t||void 0===this.itemOffsets[this.itemOffsets.length-1]?null:-1===t?this.itemOffsets[this.itemOffsets.length-1].id:this.itemOffsets[t-1].id}))}updateItemOffsets(){requestAnimationFrame((()=>{this.pageWidth=document.body.offsetWidth,this.itemOffsets=this.links.map((t=>{const e=document.getElementById(t.href.substring(1));return{id:t.href,topOffset:e.getBoundingClientRect().top+window.scrollY}}))}))}componentDidLoad(){this.updateItemOffsets()}render(){return this.links.length<1?null:[e("strong",{class:"Nav-header"},this.label),e("nav",null,e("ul",{class:"Nav-subnav"},this.links.map(this.toItem)))]}static get watchers(){return{links:["updateItemOffsets"]}}};s.style="sparkle-table-of-contents{display:block;font-size:13px;margin-bottom:2rem}sparkle-table-of-contents .Nav-header{color:var(--text-color--lighter);font-size:0.75em;font-weight:800;letter-spacing:1px;text-transform:uppercase;padding-left:0}sparkle-table-of-contents ul{padding:0;list-style:none;line-height:1.23em}sparkle-table-of-contents .Nav-link{padding-left:0;margin-left:0}sparkle-table-of-contents a{color:inherit;display:inline-block;transition:.2s color, .3s transform ease-out}sparkle-table-of-contents .Nav-link.selected a{color:var(--accent-color);transform:translateX(2px)}";export{s as sparkle_table_of_contents}