{"version":3,"file":"ParallaxImage_prod.C8OYOhf2.mjs","names":["useRef","__esmMin","init_ssg_sandbox_shims","window","de","p","c","init_jsx_runtime","init_npm_react_18_3_1","ce","useReducedMotion","init_framer_motion_DhsWWWsN","addPropertyControls","RenderTarget","init_framer_DJ_0WPVq","ControlType","radiusValue","radius","ImageParallax","DEFAULT_IMAGE","DEFAULT_RADIUS","props","containerRef","imageRef","isCanvas","reducedMotion","container","imageElement","frameId","active","isIntersecting","updateParallax","rect","y","verticalParallaxAmount","x","horizontalParallaxAmount","requestUpdate","intersectionObserver","entry","resizeObserver","handleVisibility","imageSrc","imageAttributes","image","imagePosition","positionX","positionY","borderRadius","style","boxShadow","border","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,SAASgB,EAAY,EAAO,CAAqE,OAAjE,OAAOC,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,EAAc,EAAM,CAAC,GAAK,CAAC,yBAAuB,GAAG,2BAAyB,EAAE,QAAMC,EAAc,QAAM,eAAaC,EAAe,SAAO,aAAWC,EAAYC,EAAatB,EAAO,IAAI,EAAQuB,EAASvB,EAAO,IAAI,EAAQwB,EAASX,EAAa,QAAQ,IAAIA,EAAa,OAAaY,EAAcf,EAAiB,EAAED,MAAc,CAAC,GAAGe,EAAS,OAAO,GAAGC,EAAc,CAAIF,EAAS,UAAS,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,GAAb,EAAQ,KAAQ,CAACF,GAAQ,CAACC,GAAgB,SAAS,OAAO,OAAO,IA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