{"version":3,"file":"ToC_Code.DKH8XDot.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/ycJ3hvya1E2nZy9LZOBU/O291Xu091Yq1T3OphWWY/ToC_Code.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{motion}from\"framer-motion\";// Function to generate a unique ID for headings\nfunction generateId(text){return text.toLowerCase().replace(/[^a-z0-9]+/g,\"-\");}export function TableOfContents(){const[headings,setHeadings]=useState([]);const[activeId,setActiveId]=useState(\"\");const[isVisible,setIsVisible]=useState(false);useEffect(()=>{const headingElements=Array.from(document.querySelectorAll(\"h2\")).map(el=>{const id=el.id||generateId(el.innerText);el.id=id;return{id,text:el.innerText,tag:el.tagName};});// Filter out the \"Table of Contents\" heading by its text\nconst filteredHeadings=headingElements.filter(heading=>heading.text!==\"Table of Contents\");const uniqueHeadings=Array.from(new Set(filteredHeadings.map(heading=>heading.id))).map(id=>filteredHeadings.find(heading=>heading.id===id));setHeadings(uniqueHeadings);const handleScroll=()=>{let currentId=\"\";filteredHeadings.forEach(heading=>{const section=document.getElementById(heading.id);const bounding=section.getBoundingClientRect();if(bounding.top<window.innerHeight&&bounding.bottom>0){currentId=heading.id;}});setActiveId(currentId);};window.addEventListener(\"scroll\",handleScroll);return()=>window.removeEventListener(\"scroll\",handleScroll);},[]);const handleClick=id=>{const element=document.getElementById(id);if(element){const headerOffset=150// Adjust this value between 100-200px\n;const elementPosition=element.getBoundingClientRect().top+window.scrollY;const offsetPosition=elementPosition-headerOffset;window.scrollTo({top:offsetPosition,behavior:\"smooth\"});}};const toggleToC=()=>{setIsVisible(!isVisible);};return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(motion.button,{onClick:toggleToC,style:{position:\"fixed\",bottom:\"20px\",left:\"20px\",padding:\"10px\",backgroundColor:\"#D4B15B\",color:\"#fff\",borderRadius:\"50%\",border:\"none\",zIndex:99999,boxShadow:\"0px 4px 8px rgba(0, 0, 0, 0.2)\",fontSize:\"20px\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},whileHover:{scale:1.1},children:isVisible?/*#__PURE__*/_jsxs(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",className:\"feather feather-x\",children:[/*#__PURE__*/_jsx(\"line\",{x1:\"18\",y1:\"6\",x2:\"6\",y2:\"18\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"6\",y1:\"6\",x2:\"18\",y2:\"18\"})]}):/*#__PURE__*/_jsxs(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",className:\"feather feather-list\",children:[/*#__PURE__*/_jsx(\"line\",{x1:\"8\",y1:\"6\",x2:\"21\",y2:\"6\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"8\",y1:\"12\",x2:\"21\",y2:\"12\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"8\",y1:\"18\",x2:\"21\",y2:\"18\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"3\",y1:\"6\",x2:\"3\",y2:\"6\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"3\",y1:\"12\",x2:\"3\",y2:\"12\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"3\",y1:\"18\",x2:\"3\",y2:\"18\"})]})}),/*#__PURE__*/_jsxs(motion.div,{initial:{left:\"-400px\"},animate:{left:isVisible?\"20px\":\"-400px\"},transition:{duration:.4},style:{position:\"fixed\",bottom:\"80px\",width:\"320px\",maxHeight:\"60vh\",overflowY:\"auto\",backgroundColor:\"#fff\",boxShadow:\"0 4px 12px rgba(0, 0, 0, 0.1)\",padding:\"10px 20px 20px 20px\",zIndex:99999,borderRadius:\"8px\"},children:[/*#__PURE__*/_jsx(\"h2\",{style:{fontFamily:\"'Poppins', sans-serif\",color:\"#333\",marginBottom:\"20px\",textAlign:\"left\"},children:\"Table of Contents\"}),/*#__PURE__*/_jsx(\"ul\",{style:{listStyleType:\"none\",padding:0},children:headings.map(heading=>/*#__PURE__*/_jsx(\"li\",{style:{marginBottom:\"10px\"},children:/*#__PURE__*/_jsx(\"a\",{href:`#${heading.id}`,onClick:e=>{e.preventDefault();handleClick(heading.id);},style:{color:activeId===heading.id?\"#D4B15B\"// Gold color for active heading\n    :\"#333\",fontWeight:activeId===heading.id?\"bold\":\"normal\",fontSize:\"14px\",fontFamily:\"'Poppins', sans-serif\",textDecoration:activeId===heading.id?\"underline\":\"none\",cursor:\"pointer\"},children:heading.text})},heading.id))})]}),/*#__PURE__*/_jsx(\"style\",{children:`\n                    @media (max-width: 390px) {\n                        .motion-button {\n                            bottom: 10px;\n                            left: 10px;\n                            padding: 8px;\n                            font-size: 18px; /* Slightly smaller button for mobile */\n                        }\n                        .motion-div {\n                            width: 90vw; /* 90% of the viewport width for ToC */\n                            max-height: 50vh; /* Slightly shorter height for mobile */\n                            bottom: 60px; /* More padding at the bottom */\n                            padding: 8px 16px; /* Reduced padding for mobile */\n                        }\n                        .motion-heading {\n                            font-size: 16px; /* Smaller font size for heading */\n                        }\n                        .motion-link {\n                            font-size: 12px; /* Smaller font size for links */\n                        }\n                    }\n                `})]});}\nexport const __FramerMetadata__ = {\"exports\":{\"TableOfContents\":{\"type\":\"reactComponent\",\"name\":\"TableOfContents\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ToC_Code.map"],"mappings":"ySACA,SAAS,EAAW,EAAK,CAAC,OAAO,EAAK,cAAc,QAAQ,cAAc,IAAM,UAAgB,GAAiB,CAAC,GAAK,CAAC,EAAS,EAAY,CAACA,EAAS,EAAE,EA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