{"version":3,"file":"TableOfContents.uvfftW2o.mjs","names":["useRef","useState","useCallback","useMemo","startTransition","__esmMin","ne","init_ssg_sandbox_shims","init_npm_react_18_3_1","te","window","pe","ce","c","_e","de","addPropertyControls","init_framer_DKWANagr","ControlType","slugify","value","TableOfContents","props","containerRef","tocItems","setTocItems","hoveredId","setHoveredId","scanHeadings","root","headingElements","container","filteredHeadings","el","usedIds","heading","ensureUniqueId","normalizedBase","baseId","index","candidate","nextItems","text","id","timeoutId","onItemClick","event","target","targetTop","style","title","isParentHovered","item","__FramerMetadata__","init_TableOfContents","init_jsx_runtime","\"exports\"","\"default\"","\"type\"","\"name\"","\"slots\"","\"annotations\"","\"framerSupportedLayoutHeight\"","\"framerContractVersion\"","\"framerSupportedLayoutWidth\"","\"__FramerMetadata__\""],"sources":["https:/framerusercontent.com/modules/Ozim3xnRhmcRAFGIqQDP/hWCQFiO7xK2rh2kHYFTA/TableOfContents.js"],"sourcesContent":["// User request: Update TableOfContents so it lists only H2 headings in a flat list while keeping title/background controls, smooth-scroll behavior, anchor id generation, styling, and static-render safety unchanged.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{startTransition,useCallback,useEffect,useMemo,useRef,useState}from\"react\";function slugify(value){return value.toLowerCase().replace(/[^a-z0-9]+/g,\"-\").replace(/-+/g,\"-\").replace(/^-|-$/g,\"\");}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function TableOfContents(props){const{title=\"Content of the article\",backgroundColor=\"rgba(255, 145, 0, 0.08)\",style}=props;const containerRef=useRef(null);const[tocItems,setTocItems]=useState([]);const[hoveredId,setHoveredId]=useState(null);const scanHeadings=useCallback(()=>{if(typeof document===\"undefined\")return;const root=document.querySelector(\"main\")??document;const headingElements=Array.from(root.querySelectorAll(\"h2\"));const container=containerRef.current;const filteredHeadings=headingElements.filter(el=>{if(!container)return true;return!container.contains(el);});const usedIds=new Set;filteredHeadings.forEach(heading=>{if(heading.id)usedIds.add(heading.id);});const ensureUniqueId=baseId=>{const normalizedBase=baseId||\"section\";if(!usedIds.has(normalizedBase)){usedIds.add(normalizedBase);return normalizedBase;}let index=2;let candidate=`${normalizedBase}-${index}`;while(usedIds.has(candidate)){index+=1;candidate=`${normalizedBase}-${index}`;}usedIds.add(candidate);return candidate;};const nextItems=[];filteredHeadings.forEach(heading=>{const text=heading.textContent?.trim()??\"\";if(!text)return;let id=heading.id?.trim()??\"\";if(!id){id=ensureUniqueId(slugify(text));heading.id=id;}else{id=ensureUniqueId(id);heading.id=id;}nextItems.push({id,text});});startTransition(()=>setTocItems(nextItems));},[]);useEffect(()=>{scanHeadings();let timeoutId=0;if(typeof window!==\"undefined\"){timeoutId=window.setTimeout(()=>{scanHeadings();},350);}return()=>{if(typeof window!==\"undefined\"&&timeoutId){window.clearTimeout(timeoutId);}};},[scanHeadings]);const onItemClick=useCallback((event,id)=>{event.preventDefault();if(typeof document===\"undefined\"||typeof window===\"undefined\")return;const target=document.getElementById(id);if(!target)return;const targetTop=target.getBoundingClientRect().top+window.scrollY-90;window.scrollTo({top:Math.max(0,targetTop),behavior:\"smooth\"});window.history.replaceState(null,\"\",`#${id}`);},[]);const hasItems=useMemo(()=>tocItems.length>0,[tocItems]);if(!hasItems)return null;return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"auto\",boxSizing:\"border-box\",backgroundColor,borderRadius:16,padding:24,color:\"#1A1A1A\",...style},children:[/*#__PURE__*/_jsx(\"div\",{style:{fontSize:18,fontWeight:700,lineHeight:1.2,marginBottom:14,letterSpacing:\"-0.01em\"},children:title}),/*#__PURE__*/_jsx(\"nav\",{\"aria-label\":\"Table of contents\",children:/*#__PURE__*/_jsx(\"ul\",{style:{display:\"flex\",flexDirection:\"column\",gap:8,listStyle:\"none\",padding:0,margin:0},children:tocItems.map(item=>{const isParentHovered=hoveredId===item.id;return /*#__PURE__*/_jsx(\"li\",{style:{display:\"flex\",flexDirection:\"column\",gap:6},children:/*#__PURE__*/_jsx(\"a\",{href:`#${item.id}`,onClick:event=>onItemClick(event,item.id),onMouseEnter:()=>startTransition(()=>setHoveredId(item.id)),onMouseLeave:()=>startTransition(()=>setHoveredId(null)),style:{color:isParentHovered?\"#FF7A00\":\"#2A2A2A\",textDecoration:\"none\",fontSize:15,fontWeight:500,lineHeight:1.45,cursor:\"pointer\",transition:\"color 0.2s ease\",width:\"max-content\",maxWidth:\"100%\"},children:item.text})},item.id);})})})]});}addPropertyControls(TableOfContents,{title:{type:ControlType.String,defaultValue:\"Content of the article\"},backgroundColor:{type:ControlType.Color,defaultValue:\"rgba(255, 145, 0, 0.08)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TableOfContents\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableOfContents.map"],"mappings":"A,wNAC8L,SAASmB,EAAQ,EAAM,CAAC,OAAOC,EAAM,YAAY,CAAC,CAAC,QAAQ,cAAc,GAAG,CAAC,CAAC,QAAQ,MAAM,GAAG,CAAC,CAAC,QAAQ,SAAS,EAAE,CAAE,CAGjT,SAAwBC,EAAgB,EAAM,CAAC,GAAK,CAAC,QAAM,yBAAyB,kBAAgB,0BAA0B,SAAOC,EAAYC,EAAavB,EAAO,IAAI,EAAO,CAACwB,EAASC,GAAaxB,EAAS,CAAC,CAAC,EAAO,CAACyB,EAAUC,GAAc1B,EAAS,IAAI,EAAQ2B,EAAa1B,MAAgB,CAAC,GAAG,OAAO,SAAW,IAAY,OAAO,IAAM2B,EAAK,SAAS,cAAc,MAAM,GAAG,SAAeC,EAAgB,MAAM,KAAKD,EAAK,iBAAiB,IAAI,CAAC,EAAQE,EAAUR,EAAa,QAAcS,EAAiBF,EAAgB,OAAO,G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