{"version":3,"file":"ParallaxImage_prod.KCK0ISn4.mjs","names":["useRef","useEffect","_jsxs","_jsx","__esmMin","init_ssg_sandbox_shims","window","de","p","c","init_jsx_runtime","init_npm_react_18_3_1","ce","addPropertyControls","RenderTarget","init_framer_BWzg2IRg","ControlType","useReducedMotion","init_framer_motion_1EwlFBEG","radiusValue","radius","ImageParallax","props","verticalParallaxAmount","horizontalParallaxAmount","image","DEFAULT_IMAGE","style","borderRadius","DEFAULT_RADIUS","border","boxShadow","containerRef","imageRef","isCanvas","reducedMotion","container","imageElement","frameId","active","isIntersecting","updateParallax","rect","y","x","requestUpdate","intersectionObserver","entry","resizeObserver","handleVisibility","imageSrc","positionX","positionY","imageAttributes","imagePosition","init_ParallaxImage_prod","\"defaultValue\""],"sources":["https:/framerusercontent.com/modules/zxcGfQb3lPhoJOWc1HTU/YpK8sV4QXcxDjSGwNJam/ParallaxImage_prod.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useRef}from\"react\";import{useReducedMotion}from\"framer-motion\";const DEFAULT_IMAGE={src:\"https://framerusercontent.com/images/oHxPQbqbgpU7CA0wduhfDb4izBY.png\",alt:\"\"};const DEFAULT_RADIUS={top:0,right:0,bottom:0,left:0};function radiusValue(radius){if(typeof radius===\"number\"||typeof radius===\"string\")return radius;return`${radius?.top??0}px ${radius?.right??0}px ${radius?.bottom??0}px ${radius?.left??0}px`;}/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 300\n * @framerDisableUnlink\n */export default function ImageParallax(props){const{verticalParallaxAmount=30,horizontalParallaxAmount=0,image=DEFAULT_IMAGE,style,borderRadius=DEFAULT_RADIUS,border,boxShadow}=props;const containerRef=useRef(null);const imageRef=useRef(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas;const reducedMotion=useReducedMotion();useEffect(()=>{if(isCanvas)return;if(reducedMotion){if(imageRef.current){imageRef.current.style.transform=\"translate3d(0, 0, 0)\";}return;}const container=containerRef.current?.isConnected?containerRef.current:null;const imageElement=imageRef.current;if(!container||!imageElement)return;let frameId=null;let active=true;let isIntersecting=true;const updateParallax=()=>{frameId=null;if(!active||!isIntersecting||document.hidden)return;const rect=container.getBoundingClientRect();if(rect.width<=0||rect.height<=0)return;const verticalProgress=Math.max(0,Math.min(1,(window.innerHeight-rect.top)/(window.innerHeight+rect.height)));const y=(verticalProgress-.5)*(verticalParallaxAmount/100)*rect.height;let x=0;if(horizontalParallaxAmount!==0){const horizontalProgress=(rect.left+rect.width/2-window.innerWidth/2)/window.innerWidth;x=horizontalProgress*(horizontalParallaxAmount/100)*rect.width;}imageElement.style.transform=`translate3d(${x}px, ${y}px, 0)`;// Preserve support for continuously moving/looping parent elements.\nif(horizontalParallaxAmount!==0){frameId=requestAnimationFrame(updateParallax);}};const requestUpdate=()=>{if(frameId===null&&active&&isIntersecting&&!document.hidden){frameId=requestAnimationFrame(updateParallax);}};if(isCanvas)return;const intersectionObserver=new IntersectionObserver(([entry])=>{isIntersecting=entry?entry.isIntersecting:true;if(isIntersecting)requestUpdate();else if(frameId!==null){cancelAnimationFrame(frameId);frameId=null;}},{rootMargin:\"100px\"});const resizeObserver=new ResizeObserver(requestUpdate);const handleVisibility=()=>{if(document.hidden&&frameId!==null){cancelAnimationFrame(frameId);frameId=null;}else{requestUpdate();}};intersectionObserver.observe(container);resizeObserver.observe(container);window.addEventListener(\"scroll\",requestUpdate,{passive:true});window.addEventListener(\"resize\",requestUpdate,{passive:true});document.addEventListener(\"visibilitychange\",handleVisibility);requestUpdate();return()=>{active=false;if(frameId!==null){cancelAnimationFrame(frameId);frameId=null;}intersectionObserver.disconnect();resizeObserver.disconnect();window.removeEventListener(\"scroll\",requestUpdate);window.removeEventListener(\"resize\",requestUpdate);document.removeEventListener(\"visibilitychange\",handleVisibility);};},[verticalParallaxAmount,horizontalParallaxAmount,isCanvas,reducedMotion]);const{src:imageSrc,positionX,positionY,...imageAttributes}=typeof image===\"string\"?{src:image,positionX:undefined,positionY:undefined}:image;const imagePosition=positionX&&positionY?`${positionX} ${positionY}`:\"center\";const radius=radiusValue(borderRadius);return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",height:\"100%\",...style,overflow:\"hidden\",borderRadius:radius,boxShadow:boxShadow||undefined},children:[isCanvas?/*#__PURE__*/_jsx(\"img\",{...imageAttributes,src:imageSrc,alt:imageAttributes.alt??\"\",draggable:false,style:{width:\"100%\",height:\"100%\",display:\"block\",objectFit:\"cover\",objectPosition:imagePosition,borderRadius:radius,userSelect:\"none\",pointerEvents:\"none\"}}):/*#__PURE__*/_jsx(\"img\",{...imageAttributes,ref:imageRef,src:imageSrc,alt:imageAttributes.alt??\"\",draggable:false,style:{position:\"absolute\",top:`-${Math.abs(verticalParallaxAmount)/2}%`,left:`-${Math.abs(horizontalParallaxAmount)/2}%`,width:`calc(100% + ${Math.abs(horizontalParallaxAmount)}%)`,height:`calc(100% + ${Math.abs(verticalParallaxAmount)}%)`,objectFit:\"cover\",objectPosition:imagePosition,borderRadius:radius,willChange:\"transform\",backfaceVisibility:\"hidden\",userSelect:\"none\",pointerEvents:\"none\"}}),/*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",inset:0,zIndex:1,boxSizing:\"border-box\",borderRadius:radius,pointerEvents:\"none\",...border||{}}})]});}addPropertyControls(ImageParallax,{image:{type:ControlType.ResponsiveImage,title:\"Image\",[\"defaultValue\"]:DEFAULT_IMAGE},verticalParallaxAmount:{type:ControlType.Number,title:\"Parallax Y\",defaultValue:30,step:5,max:100,min:-100,unit:\"%\"},horizontalParallaxAmount:{type:ControlType.Number,title:\"Parallax X\",defaultValue:0,step:5,max:100,min:-100,unit:\"%\"},border:{type:ControlType.Border,title:\"Border\",optional:true},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:DEFAULT_RADIUS,min:0,max:100,step:1,unit:\"px\"},boxShadow:{type:ControlType.BoxShadow,title:\"Shadow\",description:\"More components at [Framer University](https://frameruni.link/cc).\"}});ImageParallax.displayName=\"Image Parallax\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageParallax\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerDisableUnlink\":\"\",\"framerIntrinsicHeight\":\"300\",\"framerIntrinsicWidth\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ParallaxImage_prod.map"],"mappings":"A,+PAAuW,SAASmB,EAAYC,EAAO,CAAqE,OAAjE,OAAOA,GAAS,UAAU,OAAOA,GAAS,SAAgBA,EAAa,GAAGA,GAAQ,KAAK,EAAE,KAAKA,GAAQ,OAAO,EAAE,KAAKA,GAAQ,QAAQ,EAAE,KAAKA,GAAQ,MAAM,EAAE,GAAI,CAMniB,SAAwBC,EAAcC,EAAM,CAAC,GAAK,CAACC,yBAAuB,GAAGC,2BAAyB,EAAEC,QAAMC,EAAcC,QAAMC,eAAaC,EAAeC,SAAOC,aAAWT,EAAYU,EAAahC,EAAO,IAAI,EAAQiC,EAASjC,EAAO,IAAI,EAAQkC,EAASpB,EAAa,QAAQ,IAAIA,EAAa,OAAaqB,EAAclB,EAAiB,EAAEhB,MAAc,CAAC,GAAGiC,EAAS,OAAO,GAAGC,EAAc,CAAIF,EAAS,UAASA,EAAS,QAAQ,MAAM,UAAU,wBAAwB,MAAO,CAAC,IAAMG,EAAUJ,EAAa,SAAS,YAAYA,EAAa,QAAQ,KAAWK,EAAaJ,EAAS,QAAQ,GAAG,CAACG,GAAW,CAACC,EAAa,OAAO,IAAIC,EAAQ,KAASC,EAAO,GAASC,EAAe,GAAWC,MAAmB,CAAc,GAAbH,EAAQ,KAAQ,CAACC,GAAQ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