{"version":3,"file":"TableOfContents.DUZj-RES.mjs","names":["useState","_Fragment","startTransition"],"sources":["https:/framerusercontent.com/modules/ehSeuro06W0WvyRCVJ4X/o2GO7GZvKvKUlIvdqAVi/TableOfContents.js"],"sourcesContent":["// Table of Contents component that automatically generates navigation from page headings\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Table of Contents\n * \n * Automatically generates a clickable table of contents from all headings (h1-h6) on the page.\n * Excludes body paragraphs and only includes heading elements.\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{title,variant,backgroundColor,textColor,linkColor,hoverColor,activeColor,borderRadius,padding,titleFont,linkFont,showLevels,indentSize,scrollOffset,border,boxShadow,showDividers,dividerColor,dividerHeight}=props;const[tocItems,setTocItems]=useState([]);const[hoveredIndex,setHoveredIndex]=useState(null);const[activeIndex,setActiveIndex]=useState(0);const[isOpen,setIsOpen]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;const generateTOC=()=>{const headings=document.querySelectorAll(\"h2\");const items=[];const seenIds=new Set;const seenTexts=new Set;headings.forEach((heading,index)=>{const text=heading.textContent||\"\";const normalizedText=text.trim().toLowerCase();// Skip if this heading matches the component title\nif(text===title)return;// Skip if heading contains \"table of contents\" (case-insensitive)\nif(normalizedText.includes(\"table of contents\"))return;// Skip if heading contains \"schedule a demo with playground today\" (case-insensitive)\nif(normalizedText.includes(\"schedule a demo with playground today\"))return;// Skip footer CTA heading\nif(normalizedText===\"stay in the loop on all things ece\"||normalizedText.includes(\"stay in the loop on all things ece\"))return;// Skip if we've already seen this text\nif(seenTexts.has(text))return;let id=heading.id;if(!id){id=`heading-${index}-${text.toLowerCase().replace(/\\s+/g,\"-\").replace(/[^\\w-]/g,\"\")}`;heading.id=id;}// Skip if we've already seen this ID\nif(seenIds.has(id))return;const level=parseInt(heading.tagName.substring(1));items.push({id,text,level});seenIds.add(id);seenTexts.add(text);});startTransition(()=>setTocItems(items));};generateTOC();const observer=new MutationObserver(generateTOC);observer.observe(document.body,{childList:true,subtree:true});return()=>observer.disconnect();},[title]);useEffect(()=>{if(typeof window===\"undefined\")return;const handleScroll=()=>{const scrollPosition=window.scrollY+scrollOffset+50;let currentActiveIndex=0;for(let i=tocItems.length-1;i>=0;i--){const element=document.getElementById(tocItems[i].id);if(element){const elementTop=element.getBoundingClientRect().top+window.pageYOffset;if(scrollPosition>=elementTop){currentActiveIndex=i;break;}}}startTransition(()=>setActiveIndex(currentActiveIndex));};handleScroll();window.addEventListener(\"scroll\",handleScroll);return()=>window.removeEventListener(\"scroll\",handleScroll);},[tocItems,scrollOffset]);const handleClick=id=>{if(typeof window===\"undefined\")return;const element=document.getElementById(id);if(element){const elementPosition=element.getBoundingClientRect().top+window.pageYOffset;const offsetPosition=elementPosition-scrollOffset;window.scrollTo({top:offsetPosition,behavior:\"smooth\"});// Close dropdown after clicking a link\nif(variant===\"dropdown\"){startTransition(()=>setIsOpen(false));}}};const getIndent=level=>{if(!showLevels)return 0;return(level-1)*indentSize;};return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,position:\"relative\",backgroundColor,borderRadius,paddingTop:padding.paddingTop,paddingRight:padding.paddingRight,paddingBottom:padding.paddingBottom,paddingLeft:padding.paddingLeft,overflow:variant===\"dropdown\"?\"visible\":\"auto\",border,boxShadow},children:variant===\"list\"?/*#__PURE__*/_jsxs(_Fragment,{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,index)=>/*#__PURE__*/_jsxs(\"li\",{style:{marginBottom:8,paddingLeft:getIndent(item.level)},children:[/*#__PURE__*/_jsx(\"a\",{href:`#${item.id}`,onClick:e=>{e.preventDefault();handleClick(item.id);},onMouseEnter:()=>startTransition(()=>setHoveredIndex(index)),onMouseLeave:()=>startTransition(()=>setHoveredIndex(null)),style:{color:activeIndex===index?activeColor:hoveredIndex===index?hoverColor:linkColor,textDecoration:\"none\",cursor:\"pointer\",transition:\"color 0.2s ease\",display:\"block\",...linkFont},children:item.text}),showDividers&&index<tocItems.length-1&&/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:dividerHeight,backgroundColor:dividerColor,marginTop:8}})]},item.id))})})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsxs(\"div\",{onClick:()=>startTransition(()=>setIsOpen(!isOpen)),style:{display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\",cursor:\"pointer\",userSelect:\"none\"},children:[/*#__PURE__*/_jsx(\"h3\",{style:{margin:0,color:textColor,...titleFont},children:title}),/*#__PURE__*/_jsx(\"svg\",{width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",style:{transform:isOpen?\"rotate(180deg)\":\"rotate(0deg)\",transition:\"transform 0.2s ease\",flexShrink:0},children:/*#__PURE__*/_jsx(\"path\",{d:\"M6 9L12 15L18 9\",stroke:textColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})]}),isOpen&&/*#__PURE__*/_jsx(\"nav\",{style:{marginTop:16},children:/*#__PURE__*/_jsx(\"ul\",{style:{listStyle:\"none\",margin:0,padding:0},children:tocItems.map((item,index)=>/*#__PURE__*/_jsxs(\"li\",{style:{marginBottom:8,paddingLeft:getIndent(item.level)},children:[/*#__PURE__*/_jsx(\"a\",{href:`#${item.id}`,onClick:e=>{e.preventDefault();handleClick(item.id);},onMouseEnter:()=>startTransition(()=>setHoveredIndex(index)),onMouseLeave:()=>startTransition(()=>setHoveredIndex(null)),style:{color:activeIndex===index?activeColor:hoveredIndex===index?hoverColor:linkColor,textDecoration:\"none\",cursor:\"pointer\",transition:\"color 0.2s ease\",display:\"block\",...linkFont},children:item.text}),showDividers&&index<tocItems.length-1&&/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:dividerHeight,backgroundColor:dividerColor,marginTop:8}})]},item.id))})})]})});}addPropertyControls(TableOfContents,{title:{type:ControlType.String,title:\"Title\",defaultValue:\"Table of Contents\"},variant:{type:ControlType.Enum,title:\"Variant\",options:[\"list\",\"dropdown\"],optionTitles:[\"List\",\"Dropdown\"],defaultValue:\"list\",displaySegmentedControl:true},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F5F5F5\"},textColor:{type:ControlType.Color,title:\"Title Color\",defaultValue:\"#000000\"},linkColor:{type:ControlType.Color,title:\"Link Color\",defaultValue:\"#0099FF\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#0066FF\"},activeColor:{type:ControlType.Color,title:\"Active Color\",defaultValue:\"#000000\"},border:{type:ControlType.Border,title:\"Border\"},boxShadow:{type:ControlType.BoxShadow,title:\"Shadow\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32},padding:{type:ControlType.Object,title:\"Padding\",controls:{paddingTop:{type:ControlType.Number,title:\"Top\",defaultValue:20,min:0,max:60},paddingRight:{type:ControlType.Number,title:\"Right\",defaultValue:20,min:0,max:60},paddingBottom:{type:ControlType.Number,title:\"Bottom\",defaultValue:20,min:0,max:60},paddingLeft:{type:ControlType.Number,title:\"Left\",defaultValue:20,min:0,max:60}}},scrollOffset:{type:ControlType.Number,title:\"Scroll Offset\",defaultValue:100,min:0,max:500,step:10,unit:\"px\"},titleFont:{type:ControlType.Font,title:\"Title Font\",defaultValue:{fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},linkFont:{type:ControlType.Font,title:\"Link Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},showLevels:{type:ControlType.Boolean,title:\"Show Levels\",defaultValue:true,enabledTitle:\"Indent\",disabledTitle:\"Flat\"},indentSize:{type:ControlType.Number,title:\"Indent Size\",defaultValue:16,min:0,max:40,hidden:({showLevels})=>!showLevels},showDividers:{type:ControlType.Boolean,title:\"Show Dividers\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},dividerColor:{type:ControlType.Color,title:\"Divider Color\",defaultValue:\"#EEEEEE\",hidden:({showDividers})=>!showDividers},dividerHeight:{type:ControlType.Number,title:\"Divider Height\",defaultValue:1,min:1,max:10,unit:\"px\",hidden:({showDividers})=>!showDividers}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TableOfContents\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"300\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableOfContents.map"],"mappings":"gNAYG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,QAAM,UAAQ,kBAAgB,YAAU,YAAU,aAAW,cAAY,eAAa,UAAQ,YAAU,WAAS,aAAW,aAAW,eAAa,SAAO,YAAU,eAAa,eAAa,iBAAe,EAAW,CAAC,EAAS,GAAaA,EAAS,EAAE,CAAC,CAAM,CAAC,EAAa,GAAiBA,EAAS,KAAK,CAAM,CAAC,EAAY,GAAgBA,EAAS,EAAE,CAAM,CAAC,EAAO,GAAWA,EAAS,GAAM,CAAC,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,MAAgB,CAAC,IAAM,EAAS,SAAS,iBAAiB,KAAK,CAAO,EAAM,EAAE,CAAO,EAAQ,IAAI,IAAU,EAAU,IAAI,IAAI,EAAS,SA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