{"version":3,"file":"Sidescroll.C_afdcXZ.mjs","names":["useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/mmcOcx5LpYDhqvhBIvTs/m8Fb2hvqd44Jwd4eNoIe/Sidescroll.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useRef}from\"react\";// User request: Create a Framer code override named withBoundedHorizontalDragScroll for bounded horizontal drag-scroll with pointer/touch support while preserving taps/clicks when there is no meaningful drag.\nexport function withBoundedHorizontalDragScroll(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const elementRef=useRef(null);const pointerIdRef=useRef(null);const startXRef=useRef(0);const startYRef=useRef(0);const startScrollLeftRef=useRef(0);const dragActiveRef=useRef(false);const dragIntentDecidedRef=useRef(false);const suppressClickRef=useRef(false);const setRefs=useCallback(node=>{elementRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);const onPointerDown=useCallback(event=>{props.onPointerDown?.(event);if(event.defaultPrevented)return;const el=elementRef.current;if(!el)return;pointerIdRef.current=event.pointerId;startXRef.current=event.clientX;startYRef.current=event.clientY;startScrollLeftRef.current=el.scrollLeft;dragActiveRef.current=false;dragIntentDecidedRef.current=false;suppressClickRef.current=false;try{el.setPointerCapture(event.pointerId);}catch{// Ignore if capture is unavailable.\n}},[props]);const onPointerMove=useCallback(event=>{props.onPointerMove?.(event);const el=elementRef.current;if(!el||pointerIdRef.current!==event.pointerId)return;const dx=event.clientX-startXRef.current;const dy=event.clientY-startYRef.current;const absX=Math.abs(dx);const absY=Math.abs(dy);const intentThreshold=6;if(!dragIntentDecidedRef.current){if(absX<intentThreshold&&absY<intentThreshold)return;dragIntentDecidedRef.current=true;if(absX>absY){dragActiveRef.current=true;}else{dragActiveRef.current=false;return;}}if(!dragActiveRef.current)return;event.preventDefault();suppressClickRef.current=suppressClickRef.current||absX>5;const maxScroll=Math.max(0,el.scrollWidth-el.clientWidth);const nextScroll=startScrollLeftRef.current-dx;const boundedScroll=Math.max(0,Math.min(maxScroll,nextScroll));el.scrollLeft=boundedScroll;el.style.cursor=\"grabbing\";},[props]);const onPointerUpOrCancel=useCallback(event=>{if(event.type===\"pointerup\")props.onPointerUp?.(event);if(event.type===\"pointercancel\")props.onPointerCancel?.(event);const el=elementRef.current;if(!el)return;if(pointerIdRef.current===event.pointerId){try{el.releasePointerCapture(event.pointerId);}catch{// Ignore if capture was not set.\n}}pointerIdRef.current=null;dragActiveRef.current=false;dragIntentDecidedRef.current=false;el.style.cursor=\"grab\";},[props]);const onClickCapture=useCallback(event=>{props.onClickCapture?.(event);if(event.defaultPrevented)return;if(suppressClickRef.current){event.preventDefault();event.stopPropagation();}suppressClickRef.current=false;},[props]);return /*#__PURE__*/_jsx(Component,{ref:setRefs,...props,onPointerDown:onPointerDown,onPointerMove:onPointerMove,onPointerUp:onPointerUpOrCancel,onPointerCancel:onPointerUpOrCancel,onClickCapture:onClickCapture,style:{...props.style,overflowX:\"auto\",overflowY:\"hidden\",WebkitOverflowScrolling:\"touch\",scrollbarWidth:\"none\",msOverflowStyle:\"none\",cursor:props.style?.cursor??\"grab\",touchAction:\"pan-y\"}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withBoundedHorizontalDragScroll\":{\"type\":\"reactHoc\",\"name\":\"withBoundedHorizontalDragScroll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Sidescroll.map"],"mappings":"gIACA,SAAgB,EAAgC,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAAWA,EAAO,IAAI,EAAQ,EAAaA,EAAO,IAAI,EAAQ,EAAUA,EAAO,CAAC,EAAQ,EAAUA,EAAO,CAAC,EAAQ,EAAmBA,EAAO,CAAC,EAAQ,EAAcA,EAAO,EAAK,EAAQ,EAAqBA,EAAO,EAAK,EAAQ,EAAiBA,EAAO,EAAK,EAAQ,EAAQC,EAAY,GAAM,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