{"version":3,"file":"ScrollToActive_Blog.Bcm4Lubr.mjs","names":[],"sources":["https:/framerusercontent.com/modules/kxatsOFP8vVP6poZl1da/hExbltcetkZVQCldEhqt/ScrollToActive_Blog.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";export function withScrollToActive(Component){return props=>{useEffect(()=>{const currentPath=window.location.pathname.replace(/\\/$/,\"\");const findActivePill=()=>{const allLinks=document.querySelectorAll(\"a\");let activePill=null;allLinks.forEach(link=>{const href=link.href;if(!href)return;try{const linkPath=new URL(href).pathname.replace(/\\/$/,\"\");if(linkPath===currentPath){activePill=link;}}catch(e){}});return activePill;};const scrollToPill=pill=>{// Trouver le parent scrollable\nlet scrollParent=pill.parentElement;while(scrollParent){const style=window.getComputedStyle(scrollParent);const overflowX=style.overflowX;if(overflowX===\"scroll\"||overflowX===\"auto\"){break;}scrollParent=scrollParent.parentElement;}if(!scrollParent){// Fallback : essayer scrollIntoView sur l'élément\npill.scrollIntoView({behavior:\"auto\",inline:\"center\",block:\"nearest\"});return;}// Calcul manuel de la position du scroll\nconst pillRect=pill.getBoundingClientRect();const parentRect=scrollParent.getBoundingClientRect();const pillCenterInParent=pillRect.left-parentRect.left+pillRect.width/2;const targetScroll=scrollParent.scrollLeft+pillCenterInParent-parentRect.width/2;// Force le scroll sans behavior smooth (compat mobile)\nscrollParent.scrollLeft=targetScroll;console.log(\"[ScrollToActive] Scroll appliqu\\xe9 \\xe0:\",targetScroll);};const tryScroll=attempt=>{const pill=findActivePill();if(!pill){if(attempt<10){setTimeout(()=>tryScroll(attempt+1),300);}return;}scrollToPill(pill);};// Délais multiples pour compat mobile (rendu plus lent)\nconst timeouts=[setTimeout(()=>tryScroll(1),300),setTimeout(()=>tryScroll(1),800),setTimeout(()=>tryScroll(1),1500),setTimeout(()=>tryScroll(1),2500)];return()=>timeouts.forEach(t=>clearTimeout(t));},[]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withScrollToActive\":{\"type\":\"reactHoc\",\"name\":\"withScrollToActive\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollToActive_Blog.map"],"mappings":"gIAAwE,SAAgB,EAAmB,EAAU,CAAC,MAAO,KAAQ,MAAc,CAAC,IAAM,EAAY,EAAO,SAAS,SAAS,QAAQ,MAAM,GAAG,CAAO,MAAmB,CAAC,IAAM,EAAS,SAAS,iBAAiB,IAAI,CAAK,EAAW,KAAwL,OAAnL,EAAS,QAAQ,GAAM,CAAC,IAAM,EAAK,EAAK,KAAS,KAAY,GAAG,CAAgB,IAAI,IAAI,EAAK,CAAC,SAAS,QAAQ,MAAM,GAAG,GAAe,IAAa,EAAW,QAAe,IAAI,CAAQ,GAAmB,EAAa,GAAM,CAC7gB,IAAI,EAAa,EAAK,cAAc,KAAM,GAAa,CAAmD,IAAM,EAA5C,EAAO,iBAAiB,EAAa,CAAuB,UAAU,GAAG,IAAY,UAAU,IAAY,OAAQ,MAAO,EAAa,EAAa,cAAe,GAAG,CAAC,EAAa,CACxP,EAAK,eAAe,CAAC,SAAS,OAAO,OAAO,SAAS,MAAM,UAAU,CAAC,CAAC,OACvE,IAAM,EAAS,EAAK,uBAAuB,CAAO,EAAW,EAAa,uBAAuB,CAAO,EAAmB,EAAS,KAAK,EAAW,KAAK,EAAS,MAAM,EAAQ,EAAa,EAAa,WAAW,EAAmB,EAAW,MAAM,EACzP,EAAa,WAAW,EAAa,QAAQ,IAAI,sCAA4C,EAAa,EAAS,EAAU,GAAS,CAAC,IAAM,EAAK,GAAgB,CAAC,GAAG,CAAC,EAAK,CAAI,EAAQ,IAAI,eAAe,EAAU,EAAQ,EAAE,CAAC,IAAI,CAAE,OAAQ,EAAa,EAAK,EAC1P,EAAS,CAAC,eAAe,EAAU,EAAE,CAAC,IAAI,CAAC,eAAe,EAAU,EAAE,CAAC,IAAI,CAAC,eAAe,EAAU,EAAE,CAAC,KAAK,CAAC,eAAe,EAAU,EAAE,CAAC,KAAK,CAAC,CAAC,UAAU,EAAS,QAAQ,GAAG,aAAa,EAAE,CAAC,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,uBAL/M,IAA6B"}