{"version":3,"file":"WithPositionSticky.Bm8tStAI.mjs","names":["useState","_Fragment","_Fragment"],"sources":["https:/framerusercontent.com/modules/c6FWaggQof4ISYDPpSlz/zJmgvbXNpBRhLfbBk47p/LegalLocationInPageNav.js","https:/framerusercontent.com/modules/k2V5d3ECb2crTQERWIjQ/VVyGx0w7oDdq6Bc9C9pR/WithPositionSticky.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{font}from\"https://framerusercontent.com/modules/i4J1EGOrf4GiQfRahlRz/y6ouqX0rU49T8JfBwDzO/_styles.js\";import{useSmoothScroll}from\"https://framerusercontent.com/modules/eSlbzLBXJ10sKJ49G3B9/ikylEbBVmlAiX2rGrRhS/_utils.js\";export function LegalLocationInPageNav(props){const[content,setContent]=useState(null);const[currentAnchor,setCurrentAnchor]=useState(null);useSmoothScroll();useEffect(()=>{setContent(document.querySelector(\".docs-content\"));updateCurrentAnchor();},[content]);const updateCurrentAnchor=()=>{if(!content)return;const anchorElements=content.querySelectorAll(\"h2\");let newCurrentAnchor=null;for(const anchorElement of anchorElements){const{top}=anchorElement.getBoundingClientRect();if(top<=150){newCurrentAnchor=anchorElement.id;}else{break;}}// Set the first link as the current anchor by default\nif(newCurrentAnchor===null&&anchorElements.length>0){newCurrentAnchor=anchorElements[0].id;}if(newCurrentAnchor!==currentAnchor){setCurrentAnchor(newCurrentAnchor);}};useEffect(()=>{const handleScroll=()=>{updateCurrentAnchor();};window.addEventListener(\"scroll\",handleScroll);return()=>{window.removeEventListener(\"scroll\",handleScroll);};},[content]);// This function handles the click event on a navigation anchor link. It prevents the default\n// behavior of the anchor link, scrolls smoothly to the corresponding section of the page,\n// updates the URL hash, and adds a 100-pixel offset to the scroll position for the target element.\nconst handleClick=(event,anchorId)=>{event.preventDefault();const targetElement=document.getElementById(anchorId);if(targetElement){targetElement.scrollIntoView({behavior:\"smooth\",block:\"start\",inline:\"nearest\"});setTimeout(()=>{setCurrentAnchor(anchorId);window.history.pushState({},\"\",`#${anchorId}`);},700);// add a 100 pixel offset to the scroll position\nconst scrollPosition=targetElement.getBoundingClientRect().top+window.pageYOffset;window.scrollTo(0,scrollPosition-100);}};const anchors=content?Array.from(content.querySelectorAll(\"h2\")).map(h2=>{const anchorText=h2.textContent;const anchorId=anchorText.toLowerCase().replace(/[^a-z0-9]+/g,\"-\")// generate an id from the anchor text\n;h2.id=anchorId// set the id of the h2 element to the generated id\n;const currentLink=anchorId===currentAnchor;return /*#__PURE__*/_jsx(\"li\",{style:{borderLeft:currentLink?\"3px solid #1c62eb\":\"\",padding:currentLink?\"7px 0 7px 17px\":\"7px 0 7px 20px\",margin:\"3px 0 3px -1px\",display:\"inline-block\"},children:/*#__PURE__*/_jsx(\"a\",{href:`#${anchorId}`,style:{display:\"inline-block\",fontSize:\"15px\",fontFamily:currentLink?font.euclidMedium:font.euclidRegular,textDecoration:\"none\",color:currentLink?\"#1c62eb\":\"#171a25\",lineHeight:\"1.5\"},onClick:event=>handleClick(event,anchorId),children:anchorText})},anchorId);}):null;return /*#__PURE__*/_jsxs(_Fragment,{children:[anchors&&anchors.length>0&&/*#__PURE__*/_jsxs(\"nav\",{children:[/*#__PURE__*/_jsx(\"div\",{style:{fontFamily:font.euclidBold,textTransform:\"uppercase\",letterSpacing:\"0.08em\",marginBottom:\"10px\"},children:\"In This Document\"}),/*#__PURE__*/_jsx(\"ul\",{style:{display:\"flex\",flexDirection:\"column\",padding:\"0\",borderLeft:\"1px solid #becce9\",// height: \"calc(100vh - 160px)\",\noverflowY:\"auto\"},children:anchors})]}),props.children]});}\nexport const __FramerMetadata__ = {\"exports\":{\"LegalLocationInPageNav\":{\"type\":\"reactComponent\",\"name\":\"LegalLocationInPageNav\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";const styles=`\n  \n    @media (min-width: 1200px) {\n        .position-sticky-desktop {\n            position: sticky;\n            top: 100px;\n            max-height: calc(100vh - 112px);\n            overflow-y: auto;\n        }\n    }\n\n    @media (max-width: 1200px) {\n        .position-sticky-desktop {\n            width: 100%;\n        }\n    }\n`;export function positionSticky(Component){return props=>{return /*#__PURE__*/ _jsxs(_Fragment,{children:[/*#__PURE__*/ _jsx(\"style\",{dangerouslySetInnerHTML:{__html:styles}}),/*#__PURE__*/ _jsx(\"div\",{className:\"position-sticky-desktop\",children:/*#__PURE__*/ _jsx(Component,{...props})})]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"positionSticky\":{\"type\":\"reactHoc\",\"name\":\"positionSticky\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithPositionSticky.map"],"mappings":"wPAAyV,SAAgB,EAAuB,EAAM,CAAC,GAAK,CAAC,EAAQ,GAAYA,EAAS,KAAK,CAAM,CAAC,EAAc,GAAkBA,EAAS,KAAK,CAAC,GAAiB,CAAC,MAAc,CAAC,EAAW,SAAS,cAAc,gBAAgB,CAAC,CAAC,GAAqB,EAAG,CAAC,EAAQ,CAAC,CAAC,IAAM,MAAwB,CAAC,GAAG,CAAC,EAAQ,OAAO,IAAM,EAAe,EAAQ,iBAAiB,KAAK,CAAK,EAAiB,KAAK,IAAI,IAAM,KAAiB,EAAe,CAAC,GAAK,CAAC,OAAK,EAAc,uBAAuB,CAAC,GAAG,GAAK,IAAK,EAAiB,EAAc,QAAS,MAC32B,IAAmB,MAAM,EAAe,OAAO,IAAG,EAAiB,EAAe,GAAG,IAAO,IAAmB,GAAe,EAAiB,EAAiB,EAAI,MAAc,CAAC,IAAM,MAAiB,CAAC,GAAqB,EAAkD,OAA/C,EAAO,iBAAiB,SAAS,EAAa,KAAW,CAAC,EAAO,oBAAoB,SAAS,EAAa,GAAK,CAAC,EAAQ,CAAC,CAGhW,IAAM,GAAa,EAAM,IA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