{"version":3,"file":"HorizontalScroll.D0guRCeF.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/q4STY3Mjde7LP69x8Py5/3hMwCTCssH41stxn3oBH/HorizontalScroll.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useLayoutEffect,useRef,useState}from\"react\";import{motion,useScroll,useSpring,useTransform}from\"framer-motion\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/docs/guides/auto-sizing\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function HorizontalScroll(props){const containerRef=useRef(null);const scrollRef=useRef(null);const sizerRef=useRef(null);const[scrollRange,setScrollRange]=useState(0);const[contentWidth,setContentWidth]=useState(0);useLayoutEffect(()=>{if(!sizerRef.current)return;setScrollRange(scrollRef.current.scrollWidth);const onResize=entries=>{for(let entry of entries){setContentWidth(entry.contentRect.width);setScrollRange(scrollRef.current.scrollWidth);}};const onStyleChange=entries=>{for(let entry of entries){setScrollRange(scrollRef.current.scrollWidth);}};const resizeObserver=new ResizeObserver(onResize);resizeObserver.observe(sizerRef.current);const mutationObserver=new MutationObserver(onStyleChange);mutationObserver.observe(scrollRef.current,{attributes:true,attributeFilter:[\"style\"]});return()=>{resizeObserver.disconnect();mutationObserver.disconnect();};},[]);const{scrollYProgress}=useScroll({target:containerRef});const transform=useTransform(scrollYProgress,[0,1],[0,-scrollRange+contentWidth]);const physics={damping:60,mass:1,stiffness:500};const spring=useSpring(transform,physics);return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,...props,children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"sticky\",top:0},children:/*#__PURE__*/_jsx(\"div\",{style:{overflow:\"hidden\"},children:/*#__PURE__*/_jsx(motion.div,{ref:scrollRef,style:{x:spring},children:props.children})})}),RenderTarget.current()!==RenderTarget.canvas&&/*#__PURE__*/_jsx(\"div\",{ref:sizerRef,\"aria-hidden\":\"true\",style:{width:\"100%\",height:scrollRange}})]});}addPropertyControls(HorizontalScroll,{children:{type:ControlType.ComponentInstance}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HorizontalScroll\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HorizontalScroll.map"],"mappings":"2aAMG,SAAwB,EAAiB,EAAM,CAAC,IAAM,EAAaA,EAAO,MAAY,EAAUA,EAAO,MAAY,EAASA,EAAO,MAAW,CAAC,EAAY,EAAe,CAACC,EAAS,GAAQ,CAAC,EAAa,EAAgB,CAACA,EAAS,GAAG,MAAoB,CAAC,GAAG,CAAC,EAAS,QAAQ,OAAO,EAAe,EAAU,QAAQ,aAAa,IAAM,EAAS,GAAS,CAAC,IAAI,IAAI,KAAS,EAAS,EAAgB,EAAM,YAAY,OAAO,EAAe,EAAU,QAAQ,YAAe,EAAO,EAAc,GAAS,CAAC,IAAI,IAAI,KAAS,EAAS,EAAe,EAAU,QAAQ,YAAe,EAAO,EAAe,IAAI,eAAe,GAAU,EAAe,QAAQ,EAAS,SAAS,IAAM,EAAiB,IAAI,iBAAiB,GAAuG,OAAxF,EAAiB,QAAQ,EAAU,QAAQ,CAAC,WAAW,GAAK,gBAAgB,CAAC,QAAQ,CAAC,MAAY,CAAC,EAAe,aAAa,EAAiB,YAAc,CAAE,EAAC,EAAE,EAAE,GAAK,CAAC,kBAAgB,CAAC,EAAU,CAAC,OAAO,EAAa,EAAQ,EAAU,EAAa,EAAgB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAY,EAAa,EAAQ,EAAQ,CAAC,QAAQ,GAAG,KAAK,EAAE,UAAU,IAAI,CAAO,EAAO,EAAU,EAAU,GAAS,OAAoB,EAAM,MAAM,CAAC,IAAI,EAAa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