{"version":3,"file":"HorizontalScroll.-AvSylAw.mjs","names":[],"sources":["https:/framerusercontent.com/modules/scu4NP12ocrgBXc3Fw2E/ACyLptWvsYmjhBji7Msg/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,EAAa,EAAO,KAAK,CAAO,EAAU,EAAO,KAAK,CAAO,EAAS,EAAO,KAAK,CAAM,CAAC,EAAY,EAAe,CAAC,EAAS,EAAE,CAAM,CAAC,EAAa,EAAgB,CAAC,EAAS,EAAE,CAAC,EAAgB,IAAI,CAAC,IAAI,EAAS,QAAQ,OAAO,EAAe,EAAU,QAAQ,YAAY,CAAC,IAAM,EAAS,GAAS,CAAC,IAAI,IAAI,KAAS,EAAkD,AAAzC,EAAgB,EAAM,YAAY,MAAM,CAAC,EAAe,EAAU,QAAQ,YAAY,AAAG,EAAO,EAAc,GAAS,CAAC,IAAI,IAAI,KAAS,EAAS,EAAe,EAAU,QAAQ,YAAY,AAAG,EAAO,EAAe,IAAI,eAAe,GAAU,EAAe,QAAQ,EAAS,QAAQ,CAAC,IAAM,EAAiB,IAAI,iBAAiB,GAAuG,MAAxF,GAAiB,QAAQ,EAAU,QAAQ,CAAC,YAAW,EAAK,gBAAgB,CAAC,OAAQ,CAAC,EAAC,CAAO,IAAI,CAA6B,AAA5B,EAAe,YAAY,CAAC,EAAiB,YAAY,AAAE,CAAE,EAAC,CAAE,EAAC,CAAC,GAAK,CAAC,kBAAgB,CAAC,EAAU,CAAC,OAAO,CAAa,EAAC,CAAO,EAAU,EAAa,EAAgB,CAAC,EAAE,CAAE,EAAC,CAAC,GAAG,EAAY,CAAa,EAAC,CAAO,EAAQ,CAAC,Q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