{"version":3,"file":"AnimationForSonora.O-OGHBYh.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/9ps6m9Wwec9XZdaZMi0m/OxHOGeARnnaQPcha9hqC/AnimationForSonora.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";function useWindowSize(){const isBrowser=typeof window!==\"undefined\";const[size,setSize]=useState({width:isBrowser?window.innerWidth:0,height:isBrowser?window.innerHeight:0});useEffect(()=>{if(!isBrowser)return;const onResize=()=>setSize({width:window.innerWidth,height:window.innerHeight});window.addEventListener(\"resize\",onResize);return()=>window.removeEventListener(\"resize\",onResize);},[isBrowser]);return size;}function easeInOutCubic(t){return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;}export function AnimationForSonora({backgroundColor=\"#f1f8e9\",sectionHeight=400,phase1Duration=.25,phase2Duration=.7,spacingIntensity=2.5}){const[scrollProgress,setScrollProgress]=useState(0);const[smoothProgress,setSmoothProgress]=useState(0);const containerRef=useRef(null);const rafRef=useRef();const{height:windowHeight}=useWindowSize();useEffect(()=>{const handleScroll=()=>{if(!containerRef.current)return;const container=containerRef.current;const rect=container.getBoundingClientRect();const containerHeight=container.offsetHeight;const viewportHeight=window.innerHeight;const scrollStart=-rect.top;const scrollEnd=containerHeight-viewportHeight;const scrollRange=Math.max(scrollEnd,1);const progress=Math.max(0,Math.min(1,scrollStart/scrollRange));setScrollProgress(progress);};handleScroll();window.addEventListener(\"scroll\",handleScroll,{passive:true});window.addEventListener(\"resize\",handleScroll,{passive:true});return()=>{window.removeEventListener(\"scroll\",handleScroll);window.removeEventListener(\"resize\",handleScroll);};},[windowHeight]);// Smooth interpolation with requestAnimationFrame\nuseEffect(()=>{const animate=()=>{setSmoothProgress(prev=>{const diff=scrollProgress-prev;const delta=diff*.1// Smoothing factor (0.1 = smooth, 1 = instant)\n;return prev+delta;});rafRef.current=requestAnimationFrame(animate);};rafRef.current=requestAnimationFrame(animate);return()=>{if(rafRef.current){cancelAnimationFrame(rafRef.current);}};},[scrollProgress]);const tiles=[{id:0,title:\"AI\",text:\"Automate, optimize, and personalize your account management process at scale.\",activeImg:\"https://res.cloudinary.com/dlhwfesiz/image/upload/v1763288484/ai_ijem5y.svg\",dullImg:\"https://res.cloudinary.com/dlhwfesiz/image/upload/v1763288484/ai-dull_bj1yql.svg\"},{id:1,title:\"Tools\",text:\"Use built-in tools to better understand risk, identify upsell opportunities, and capture the voice of the customer.\",activeImg:\"https://res.cloudinary.com/dlhwfesiz/image/upload/v1763288484/tools_aktgdk.svg\",dullImg:\"https://res.cloudinary.com/dlhwfesiz/image/upload/v1763288485/tools-dull_rmvmuc.svg\"},{id:2,title:\"Customer Groups\",text:\"Organize and manage your customers easily.\",activeImg:\"https://res.cloudinary.com/dlhwfesiz/image/upload/v1764003676/customer_active_toy1z6.svg\",dullImg:\"https://res.cloudinary.com/dlhwfesiz/image/upload/v1763288482/customer-dull_on8wpa.svg\"},{id:3,title:\"Integrations\",text:\"Connect with your favorite tools seamlessly.\",activeImg:\"https://res.cloudinary.com/dlhwfesiz/image/upload/v1763288482/integeration_cclzmj.svg\",dullImg:\"https://res.cloudinary.com/dlhwfesiz/image/upload/v1763288482/integretion-dull_j9ocwm.svg\"}];const phase1End=phase1Duration;const phase1Progress=easeInOutCubic(Math.min(smoothProgress/phase1End,1));const phase2Start=phase1Duration;const phase2End=phase1Duration+phase2Duration;const phase2RawProgress=Math.max(0,Math.min(1,(smoothProgress-phase2Start)/(phase2End-phase2Start)));const phase2Progress=easeInOutCubic(phase2RawProgress);const progressPerTile=1/tiles.length;let activeTileIndex=-1;if(smoothProgress>=phase2Start&&smoothProgress<=phase2End){const rawIndex=phase2Progress/progressPerTile;activeTileIndex=Math.min(tiles.length-1,Math.floor(rawIndex));}else if(smoothProgress>phase2End){activeTileIndex=tiles.length-1;}const getTileStyle=index=>{const initialStackSpacing=60;const initialVerticalGap=60;const additionalSpacing=100*spacingIntensity;const separation=phase1Progress*additionalSpacing;let yOffset=0;let zOffset=-index*initialStackSpacing;let rotateX=0;let opacity=1;yOffset=index*initialVerticalGap;const separationAmount=separation*index;yOffset=yOffset+separationAmount;zOffset=zOffset+separation*index*.5;rotateX=phase1Progress*index*2;if(scrollProgress>=phase2Start){const totalTiles=tiles.length;const cardWithTextHeight=280;const transitionBuffer=.3;const transitionProgress=Math.min(1,phase2RawProgress/transitionBuffer);const smoothTransition=easeInOutCubic(transitionProgress);const phase1EndY=yOffset;const phase1EndZ=zOffset;const phase1EndRotateX=rotateX;const totalSpreadHeight=cardWithTextHeight*(totalTiles-1);const tileYPosition=index*cardWithTextHeight;const scrollOffset=phase2Progress*totalSpreadHeight;const phase2TargetY=tileYPosition-scrollOffset;yOffset=phase1EndY+(phase2TargetY-phase1EndY)*smoothTransition;zOffset=phase1EndZ*(1-smoothTransition);rotateX=phase1EndRotateX*(1-smoothTransition);opacity=1;}return{position:\"absolute\",left:\"50%\",top:\"50%\",transform:`translateX(-50%) translateY(calc(-50% + ${yOffset}px)) translateZ(${zOffset}px) rotateX(${rotateX}deg)`,transition:\"none\",opacity,width:\"100%\",maxWidth:\"310px\",zIndex:activeTileIndex===index?10:4-index,willChange:\"transform, opacity\"};};const getTileTextOpacity=index=>{if(scrollProgress<phase2Start){return 0;}const fadeInDuration=.4;const fadeInStart=.15;const fadeInProgress=Math.max(0,Math.min(1,(phase2RawProgress-fadeInStart)/fadeInDuration));const smoothFadeIn=easeInOutCubic(fadeInProgress);if(activeTileIndex===index){return smoothFadeIn;}return .4*smoothFadeIn;};const getTileTextTransform=index=>{if(scrollProgress<phase2Start){return\"translateY(30px)\";}const slideStart=.15;const slideDuration=.4;const slideProgress=Math.max(0,Math.min(1,(phase2RawProgress-slideStart)/slideDuration));const slideAmount=30*(1-easeInOutCubic(slideProgress));return`translateY(${slideAmount}px)`;};const getImageSource=index=>{const tile=tiles[index];if(scrollProgress<=phase1Duration){return tile.activeImg;}if(activeTileIndex===index){return tile.activeImg;}return tile.dullImg;};const getImageOpacity=index=>{if(scrollProgress<=phase1Duration){return 1;}if(activeTileIndex===index){return 1;}return .5;};return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:`${sectionHeight}vh`,position:\"relative\"},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"sticky\",top:0,width:\"100%\",height:\"100vh\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"hidden\",background:backgroundColor},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",maxWidth:\"360px\",height:\"700px\",perspective:\"1500px\",perspectiveOrigin:\"center center\",marginTop:\"-250px\"},children:tiles.map((tile,index)=>/*#__PURE__*/_jsx(\"div\",{style:getTileStyle(index),children:/*#__PURE__*/_jsxs(\"div\",{style:{textAlign:\"center\",width:\"310px\",height:\"280px\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:\"240px\",height:\"240px\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",flexShrink:0},children:/*#__PURE__*/_jsx(\"img\",{src:getImageSource(index),alt:tile.title,style:{width:\"240px\",height:\"240px\",objectFit:\"contain\",display:\"block\",transition:\"opacity 1s ease\",opacity:getImageOpacity(index),willChange:\"opacity\"}})}),/*#__PURE__*/_jsxs(\"div\",{style:{opacity:getTileTextOpacity(index),transform:getTileTextTransform(index),transition:\"none\",marginTop:\"-20px\",padding:\"0 10px\",textAlign:\"left\",width:\"100%\",boxSizing:\"border-box\",willChange:\"opacity, transform\"},children:[/*#__PURE__*/_jsx(\"h3\",{style:{fontSize:\"18px\",fontWeight:600,margin:\"0 0 8px 0\",color:\"#000000\"},children:tile.title}),/*#__PURE__*/_jsx(\"p\",{style:{fontSize:\"14px\",margin:0,lineHeight:\"1.5\",color:\"#000000\"},children:tile.text})]})]})},tile.id))})})});}AnimationForSonora.displayName=\"Mobile Animation Section\";addPropertyControls(AnimationForSonora,{backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#f1f8e9\"},sectionHeight:{type:ControlType.Number,title:\"Section Height (vh)\",defaultValue:600,min:300,max:1500,step:50},phase1Duration:{type:ControlType.Number,title:\"Phase 1: Stack Separation\",defaultValue:.2,min:.05,max:.5,step:.05},phase2Duration:{type:ControlType.Number,title:\"Phase 2: Sequential Tiles\",defaultValue:.75,min:.2,max:1.5,step:.05},spacingIntensity:{type:ControlType.Number,title:\"Tile Spacing\",defaultValue:2.5,min:.5,max:5,step:.1}});\nexport const __FramerMetadata__ = {\"exports\":{\"AnimationForSonora\":{\"type\":\"reactComponent\",\"name\":\"AnimationForSonora\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AnimationForSonora.map"],"mappings":"6MAA0J,SAAS,GAAe,CAAC,IAAM,EAAiB,IAAS,OAAiB,CAAC,EAAK,GAASA,EAAS,CAAC,MAAM,EAAU,EAAO,WAAW,EAAE,OAAO,EAAU,EAAO,YAAY,EAAE,CAAC,CAAuO,OAAtO,MAAc,CAAC,GAAG,CAAC,EAAU,OAAO,IAAM,MAAa,EAAQ,CAAC,MAAM,EAAO,WAAW,OAAO,EAAO,YAAY,CAAC,CAA4C,OAA3C,EAAO,iBAAiB,SAAS,EAAS,KAAW,EAAO,oBAAoB,SAAS,EAAS,EAAG,CAAC,EAAU,CAAC,CAAQ,EAAM,SAAS,EAAe,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,GAAW,GAAG,EAAE,IAAE,EAAG,EAAG,SAAgB,EAAmB,CAAC,kBAAgB,UAAU,gBAAc,IAAI,iBAAe,IAAI,iBAAe,GAAG,mBAAiB,KAAK,CAAC,GAAK,CAAC,EAAe,GAAmBA,EAAS,EAAE,CAAM,CAAC,EAAe,GAAmBA,EAAS,EAAE,CAAO,EAAaC,EAAO,KAAK,CAAO,EAAOA,GAAQ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