{"version":3,"file":"TableOfContents.CG1IhWK5.mjs","names":["useState","useEffect","startTransition","_jsxs","_jsx","__esmMin","init_npm_react_18_3_1","te","window","init_ssg_sandbox_shims","ce","init_jsx_runtime","p","_e","addPropertyControls","init_framer_BWzg2IRg","ControlType","TableOfContents","props","contentLayer","title","backgroundColor","textColor","activeColor","borderRadius","padding","showBorder","borderColor","titleFont","itemFont","indentSize","activeId","setActiveId","tocItems","setTocItems","scanHeadings","contentContainer","headings","items","heading","index","level","text","id","timer","observer","headingElements","item","entries","entry","handleClick","element","minLevel","c","e","init_TableOfContents"],"sources":["https:/framerusercontent.com/modules/izkketfJTCCUNzzn0aT0/C7pK0dmdjyhEFbWNCyRk/TableOfContents.js"],"sourcesContent":["// Table of Contents component for blog posts - automatically generates navigation from headings\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Table of Contents\n *\n * @framerIntrinsicWidth 300\n * @framerIntrinsicHeight 400\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TableOfContents(props){const{contentLayer,title,backgroundColor,textColor,activeColor,borderRadius,padding,showBorder,borderColor,titleFont,itemFont,indentSize}=props;const[activeId,setActiveId]=useState(\"\");const[tocItems,setTocItems]=useState([]);// Scan for headings in the rendered content\nuseEffect(()=>{if(typeof window===\"undefined\")return;const scanHeadings=()=>{// Find the TOC component first\nconst tocComponent=document.querySelector(\"[data-toc-component]\");if(!tocComponent)return;// Find the contentLayer within the TOC component\n// It should be a direct child or nearby sibling that was passed as contentLayer prop\nlet contentContainer=null;// Try to find a container with data-framer-name=\"Blog Content\" or similar\nconst blogContent=document.querySelector('[data-framer-name=\"Blog Content\"]');if(blogContent){contentContainer=blogContent;}else{// Fallback: look for the Content layer\ncontentContainer=document.querySelector('[data-framer-name=\"Content\"]');}if(!contentContainer)return;const headings=contentContainer.querySelectorAll(\"h1, h2, h3, h4, h5, h6\");const items=[];headings.forEach((heading,index)=>{const level=parseInt(heading.tagName.substring(1));const text=heading.textContent||\"\";const id=heading.id||`heading-${index}`;// Assign ID if not present\nif(!heading.id){heading.id=id;}items.push({id,text,level});});startTransition(()=>setTocItems(items));};// Initial scan\nscanHeadings();// Rescan after a short delay to catch dynamically loaded content\nconst timer=setTimeout(scanHeadings,500);// Set up a MutationObserver to detect content changes\nconst observer=new MutationObserver(scanHeadings);observer.observe(document.body,{childList:true,subtree:true});return()=>{clearTimeout(timer);observer.disconnect();};},[contentLayer]);useEffect(()=>{if(typeof window===\"undefined\"||tocItems.length===0)return;const headingElements=tocItems.map(item=>document.getElementById(item.id)).filter(Boolean);const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting){startTransition(()=>setActiveId(entry.target.id));}});},{rootMargin:\"-20% 0px -80% 0px\"});headingElements.forEach(heading=>{if(heading)observer.observe(heading);});return()=>observer.disconnect();},[tocItems]);const handleClick=id=>{if(typeof window===\"undefined\")return;const element=document.getElementById(id);if(element){element.scrollIntoView({behavior:\"smooth\",block:\"start\"});}};const minLevel=tocItems.length>0?Math.min(...tocItems.map(item=>item.level)):1;return /*#__PURE__*/_jsxs(\"div\",{\"data-toc-component\":true,style:{...props.style,position:\"relative\",backgroundColor,borderRadius,padding,border:showBorder?`1px solid ${borderColor}`:\"none\",overflow:\"auto\"},children:[/*#__PURE__*/_jsx(\"h3\",{style:{margin:0,marginBottom:16,color:textColor,...titleFont},children:title}),/*#__PURE__*/_jsx(\"nav\",{children:/*#__PURE__*/_jsx(\"ul\",{style:{listStyle:\"none\",margin:0,padding:0},children:tocItems.map(item=>/*#__PURE__*/_jsx(\"li\",{style:{marginBottom:8,paddingLeft:(item.level-minLevel)*indentSize},children:/*#__PURE__*/_jsx(\"a\",{href:`#${item.id}`,onClick:e=>{e.preventDefault();handleClick(item.id);},style:{color:activeId===item.id?activeColor:textColor,textDecoration:\"none\",cursor:\"pointer\",display:\"block\",transition:\"color 0.2s ease\",opacity:activeId===item.id?1:.7,fontWeight:activeId===item.id?600:400,...itemFont},onMouseEnter:e=>{e.currentTarget.style.color=activeColor;},onMouseLeave:e=>{e.currentTarget.style.color=activeId===item.id?activeColor:textColor;},children:item.text})},item.id))})})]});}addPropertyControls(TableOfContents,{contentLayer:{type:ControlType.ComponentInstance,title:\"Content Layer\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Table of Contents\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F5F5F5\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},activeColor:{type:ControlType.Color,title:\"Active Color\",defaultValue:\"#0099FF\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:20,min:0,max:60,step:4,unit:\"px\"},showBorder:{type:ControlType.Boolean,title:\"Border\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\",hidden:({showBorder})=>!showBorder},titleFont:{type:ControlType.Font,title:\"Title Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},itemFont:{type:ControlType.Font,title:\"Item Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},indentSize:{type:ControlType.Number,title:\"Indent Size\",defaultValue:16,min:0,max:40,step:4,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TableOfContents\",\"slots\":[\"contentLayer\"],\"annotations\":{\"framerIntrinsicHeight\":\"400\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framer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