{"version":3,"file":"TableOfContentsWorking.CHrjsbhh.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/k0tmH9wqRuN2Lc7m0qmu/RCflIXhgmXkXsZFnI9hn/TableOfContentsWorking.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";// Full tutorial on https://framermart.com\n// List of headings to display\nconst HEADING_TO_DISPLAY=[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"];export function withTableOfContent(Component){return props=>{const[headings,setHeadings]=useState([]);useEffect(()=>{const newHeadings=[];// Get all headings with an anchor tag\ndocument.querySelectorAll(\"h1 a, h2 a, h3 a, h4 a, h5 a, h6 a\").forEach(anchor=>{const headingElement=anchor;const headingTag=headingElement.parentElement?.tagName.toLowerCase();newHeadings.push({text:headingElement.textContent||\"\",href:headingElement.href,type:headingTag||\"\"});});// Filter out headings that are not in the list of headings to display and do not have an href that includes \"#\"\nsetHeadings(newHeadings.filter(({type,href})=>HEADING_TO_DISPLAY.includes(type)&&href.includes(\"#\")));},[]);return /*#__PURE__*/_jsx(_Fragment,{children:headings.length>0?headings.map(({text,href,type})=>/*#__PURE__*/_jsx(Component,{...props,// @ts-ignore\n    variant:type,title:text,link:href})):/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withTableOfContent\":{\"type\":\"reactHoc\",\"name\":\"withTableOfContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableOfContentsWorking.map"],"mappings":"gIAEyD,SAAgB,EAAmB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,CAAC,CAAC,EAEjD,OAFmD,MAAc,CAAC,IAAM,EAAY,CAAC,EACjM,SAAS,iBAAiB,oCAAoC,CAAC,CAAC,QAAQ,GAAQ,CAAC,IAAM,EAAe,EAAa,EAAW,EAAe,eAAe,QAAQ,YAAY,EAAE,EAAY,KAAK,CAAC,KAAK,EAAe,aAAa,GAAG,KAAK,EAAe,KAAK,KAAK,GAAY,EAAE,CAAC,CAAE,CAAC,EACxR,EAAY,EAAY,QAAQ,CAAC,OAAK,UAAQ,EAAmB,SAAS,CAAI,GAAG,EAAK,SAAS,GAAG,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC,EAAsB,EAAKC,EAAU,CAAC,SAAS,EAAS,OAAO,EAAE,EAAS,KAAK,CAAC,OAAK,OAAK,UAAqB,EAAK,EAAU,CAAC,GAAG,EACxO,QAAQ,EAAK,MAAM,EAAK,KAAK,CAAI,CAAC,CAAC,EAAe,EAAK,EAAU,CAAC,GAAG,CAAK,CAAC,CAAC,CAAC,CAAE,CAAE,mBALrB,IAAsC,EAEhG,EAAmB,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI"}