{"version":3,"file":"TableOfContents.DdwcB6Hb.mjs","names":["useState","useRef","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","te","window","_e","de","init_jsx_runtime","p","ce","addPropertyControls","init_framer_BL70qLPA","ControlType","TableOfContents","props","headings","setHeadings","containerRef","extractHeadings","parentContainer","headingElements","extractedHeadings","heading","level","maxDepth","text","id","index","observer","handleLinkClick","element","offsetPosition","offsetY","smoothScroll","getIndentLevel","h","getHierarchicalNumber","minLevel","counters","i","currentLevel","j","parts","minHeadings","hideWhenInsufficient","textColor","showBorder","borderColor","titleFont","showTitle","title","linkColor","linkFont","hoverColor","init_TableOfContents"],"sources":["https:/framerusercontent.com/modules/HciEVoE9aUTofpntbcQQ/WUiKR1DTes93DCcBUL6S/TableOfContents.js"],"sourcesContent":["// Table of Contents component that extracts headings from its container element\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Table of Contents component that automatically extracts headings from its container element\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function TableOfContents(props){const{title=\"Table of Contents\",showTitle=true,maxDepth=6,minHeadings=4,hideWhenInsufficient=false,backgroundColor=\"#FFFFFF\",textColor=\"#000000\",linkColor=\"#0066FF\",hoverColor=\"#0099FF\",borderColor=\"#EEEEEE\",titleFont,linkFont,borderRadius=8,padding=20,showBorder=true,smoothScroll=true,offsetY=0}=props;const[headings,setHeadings]=useState([]);const containerRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;const extractHeadings=()=>{if(!containerRef.current)return;// Find the parent container of this component\nconst parentContainer=containerRef.current.closest(\"[data-framer-name], .framer-component, .framer-frame\")||containerRef.current.parentElement;if(!parentContainer)return;// Get all heading elements from the parent container, excluding this component\nconst headingElements=parentContainer.querySelectorAll(\"h1, h2, h3, h4, h5, h6\");const extractedHeadings=[];headingElements.forEach((heading,index)=>{// Skip if this heading is inside our table of contents component\nif(containerRef.current?.contains(heading))return;const level=parseInt(heading.tagName.charAt(1));if(level>maxDepth)return;const text=heading.textContent?.trim()||\"\";if(!text)return;// Generate or use existing ID\nlet id=heading.id;if(!id){id=`heading-${index}-${text.toLowerCase().replace(/[^a-z0-9]+/g,\"-\")}`;heading.id=id;}extractedHeadings.push({id,text,level});});startTransition(()=>setHeadings(extractedHeadings));};// Initial extraction\nextractHeadings();// Set up mutation observer to watch for changes\nconst observer=new MutationObserver(()=>{extractHeadings();});// Observe the parent container for changes\nconst parentContainer=containerRef.current?.closest(\"[data-framer-name], .framer-component, .framer-frame\")||containerRef.current?.parentElement;if(parentContainer){observer.observe(parentContainer,{childList:true,subtree:true,characterData:true});}return()=>observer.disconnect();},[maxDepth]);const handleLinkClick=heading=>{if(typeof window===\"undefined\")return;const element=document.getElementById(heading.id);if(element){const elementPosition=element.getBoundingClientRect().top+window.pageYOffset;const offsetPosition=elementPosition-offsetY;if(smoothScroll){window.scrollTo({top:offsetPosition,behavior:\"smooth\"});}else{window.scrollTo(0,offsetPosition);}}};const getIndentLevel=level=>{const minLevel=Math.min(...headings.map(h=>h.level));return(level-minLevel)*16;};const getHierarchicalNumber=(index,level)=>{const minLevel=Math.min(...headings.map(h=>h.level));const counters=[];// Initialize counters for each level\nfor(let i=minLevel;i<=6;i++){counters[i]=0;}// Count through headings up to current index\nfor(let i=0;i<=index;i++){const currentHeading=headings[i];const currentLevel=currentHeading.level;// Increment counter for current level\ncounters[currentLevel]++;// Reset counters for deeper levels\nfor(let j=currentLevel+1;j<=6;j++){counters[j]=0;}}// Build hierarchical number string\nconst parts=[];for(let i=minLevel;i<=level;i++){if(counters[i]>0){parts.push(counters[i]);}}return parts.join(\".\");};if(headings.length===0||headings.length<minHeadings){if(hideWhenInsufficient){return null;}return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...props.style,backgroundColor,color:textColor,borderRadius,padding,border:showBorder?`1px solid ${borderColor}`:\"none\",...titleFont},children:[showTitle&&/*#__PURE__*/_jsx(\"div\",{style:{marginBottom:12,...titleFont},children:title}),/*#__PURE__*/_jsx(\"div\",{style:{opacity:.6,fontStyle:\"italic\"},children:headings.length===0?\"No headings found in container\":`Need at least ${minHeadings} headings (found ${headings.length})`})]});}return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...props.style,backgroundColor,color:textColor,borderRadius,padding,border:showBorder?`1px solid ${borderColor}`:\"none\"},children:[showTitle&&/*#__PURE__*/_jsx(\"div\",{style:{marginBottom:16,...titleFont,color:textColor},children:title}),/*#__PURE__*/_jsx(\"nav\",{children:/*#__PURE__*/_jsx(\"ul\",{style:{margin:0,padding:0,listStyle:\"none\"},children:headings.map((heading,index)=>/*#__PURE__*/_jsx(\"li\",{children:/*#__PURE__*/_jsxs(\"button\",{onClick:()=>handleLinkClick(heading),style:{background:\"none\",border:\"none\",padding:\"4px 0\",marginLeft:getIndentLevel(heading.level),color:linkColor,cursor:\"pointer\",textAlign:\"left\",width:\"100%\",textDecoration:\"none\",display:\"block\",transition:\"color 0.2s ease\",...linkFont},onMouseEnter:e=>{e.currentTarget.style.color=hoverColor;},onMouseLeave:e=>{e.currentTarget.style.color=linkColor;},children:[getHierarchicalNumber(index,heading.level),\". \",heading.text]})},`${heading.id}-${index}`))})})]});}addPropertyControls(TableOfContents,{title:{type:ControlType.String,title:\"Title\",defaultValue:\"Table of Contents\"},showTitle:{type:ControlType.Boolean,title:\"Show Title\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},maxDepth:{type:ControlType.Number,title:\"Max Depth\",defaultValue:6,min:1,max:6,step:1,displayStepper:true},minHeadings:{type:ControlType.Number,title:\"Min Headings\",defaultValue:4,min:1,max:20,step:1,displayStepper:true},hideWhenInsufficient:{type:ControlType.Boolean,title:\"Hide When Insufficient\",defaultValue:false,enabledTitle:\"Hide\",disabledTitle:\"Show Message\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},linkColor:{type:ControlType.Color,title:\"Link Color\",defaultValue:\"#0066FF\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#0099FF\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\"},titleFont:{type:ControlType.Font,title:\"Title Font\",defaultValue:{fontSize:\"18px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},linkFont:{type:ControlType.Font,title:\"Link Font\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.4em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:20,min:0,max:40,step:2,unit:\"px\"},showBorder:{type:ControlType.Boolean,title:\"Show Border\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},smoothScroll:{type:ControlType.Boolean,title:\"Smooth Scroll\",defaultValue:true,enabledTitle:\"Smooth\",disabledTitle:\"Instant\"},offsetY:{type:ControlType.Number,title:\"Offset Y\",defaultValue:0,min:-200,max:200,step:5,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TableOfContents\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableOfContents.map"],"mappings":"A,oNAMG,SAAwBe,EAAgB,EAAM,CAAC,GAAK,CAAC,QAAM,oBAAoB,YAAU,GAAK,WAAS,EAAE,cAAY,EAAE,uBAAqB,GAAM,kBAAgB,UAAU,YAAU,UAAU,YAAU,UAAU,aA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