{"version":3,"file":"ScrollNext.DaOG8T5a.mjs","names":["useRef","useState","__esmMin","init_ssg_sandbox_shims","window","_e","de","c","init_jsx_runtime","init_npm_react_18_3_1","ce","findScroller","el","start","depth","all","node","ox","makeArrow","ref","disabled","setDisabled","direction","scroller","update","atStart","atEnd","handleClick","props","event","Component","label","withScrollLeft","withScrollRight","init_ScrollNext"],"sources":["https:/framerusercontent.com/modules/UcahVSvq25fuJx7MeOmk/2zp0SHnSVSZPRIZTfbHb/ScrollNext.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";// Finds the nearest horizontal scroller, searching from this element's parent outwards.\nfunction findScroller(start){let el=start;for(let depth=0;el&&depth<5;depth++){const all=el.querySelectorAll(\"*\");for(const node of Array.from(all)){const ox=getComputedStyle(node).overflowX;if((ox===\"auto\"||ox===\"scroll\")&&node.scrollWidth>node.clientWidth+1){return node;}}el=el.parentElement;}return null;}// Original: scrolls forward, loops back to start at the end.\nexport function withScrollNext(Component){return props=>{const handleClick=event=>{props.onClick?.(event);const scroller=findScroller(event.currentTarget?.parentElement??null);if(!scroller)return;const atEnd=scroller.scrollLeft+scroller.clientWidth>=scroller.scrollWidth-4;if(atEnd){scroller.scrollTo({left:0,behavior:\"smooth\"});}else{scroller.scrollBy({left:Math.round(scroller.clientWidth*.8),behavior:\"smooth\"});}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,role:\"button\",\"aria-label\":\"Scroll to next screens\",style:{...props.style,cursor:\"pointer\"}});};}// Arrow navigator: left / right buttons that dim at either end.\nfunction makeArrow(direction,label){return function(Component){return props=>{const ref=useRef(null);const[disabled,setDisabled]=useState(direction===-1);useEffect(()=>{const scroller=findScroller(ref.current?.parentElement??null);if(!scroller)return;const update=()=>{const atStart=scroller.scrollLeft<=4;const atEnd=scroller.scrollLeft+scroller.clientWidth>=scroller.scrollWidth-4;setDisabled(direction===-1?atStart:atEnd);};update();scroller.addEventListener(\"scroll\",update,{passive:true});window.addEventListener(\"resize\",update);return()=>{scroller.removeEventListener(\"scroll\",update);window.removeEventListener(\"resize\",update);};},[]);const handleClick=event=>{props.onClick?.(event);const scroller=findScroller(ref.current?.parentElement??null);if(!scroller)return;scroller.scrollBy({left:direction*Math.round(scroller.clientWidth*.8),behavior:\"smooth\"});};return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,role:\"button\",\"aria-label\":label,\"aria-disabled\":disabled,style:{...props.style,cursor:disabled?\"default\":\"pointer\",opacity:disabled?.35:1,transition:\"opacity 0.2s ease\"}})});};};}export function withScrollLeft(Component){return makeArrow(-1,\"Scroll to previous screens\")(Component);}export function withScrollRight(Component){return makeArrow(1,\"Scroll to next screens\")(Component);}\nexport const __FramerMetadata__ = {\"exports\":{\"withScrollLeft\":{\"type\":\"reactHoc\",\"name\":\"withScrollLeft\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScrollRight\":{\"type\":\"reactHoc\",\"name\":\"withScrollRight\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScrollNext\":{\"type\":\"reactHoc\",\"name\":\"withScrollNext\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollNext.map"],"mappings":"A,8IACA,SAASW,EAAa,EAAM,CAAC,IAAIC,EAAGC,EAAM,IAAI,IAAIC,EAAM,EAAEF,GAAIE,EAAM,EAAE,IAAQ,CAAC,IAAMC,EAAIH,EAAG,iBAAiB,GAAG,EAAE,IAAI,IAAMI,KAAQ,MAAM,KAAKD,CAAG,EAAE,CAAC,IAAME,EAAG,iBAAiBD,CAAI,CAAC,CAAC,UAAU,IAAIC,IAAK,QAAQA,IAAK,WAAWD,EAAK,YAAYA,EAAK,YAAY,EAAG,OAAOA,CAAM,CAAC,EAAGJ,EAAG,aAAc,CAAC,OAAO,IAAK,CAEpT,SAASM,EAAU,EAAU,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