{"version":3,"file":"KeyEdge.CPQjJeHy.mjs","names":["useRef","__esmMin","init_ssg_sandbox_shims","window","de","c","init_jsx_runtime","init_npm_react_18_3_1","ce","RenderTarget","addPropertyControls","init_framer_Bf4_tcb2","ControlType","KeyEdge","DEFAULTS","props","rootRef","staticRender","root","teeth","reduced","dip","COUNT","progress","pointerX","raf","visibleCount","inView","layout","keyWidth","i","paint","moving","center","near","clamp","start","noise","e","smooth","t","sway","wake","onScroll","rect","vh","onMove","onLeave","resize","seen","entry","fromColor","toColor","init_KeyEdge","b","a","v","x"],"sources":["https:/framerusercontent.com/modules/LxFlxPsDiTd3mUTooY0u/bAk3xfhy27zcqu5MnRlj/KeyEdge.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const DEFAULTS={fromColor:\"#F6F3E8\",toColor:\"#11121C\",keyWidth:34};const COUNT=72;const clamp=(v,a=0,b=1)=>Math.min(b,Math.max(a,v));const smooth=t=>t*t*(3-2*t);const noise=i=>{const x=Math.sin(i*91.17)*24634.6345;return x-Math.floor(x);};/**\n * A section divider made of keys. They rise one after another as the page scrolls\n * and dip when the pointer passes over them.\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 1200\n * @framerIntrinsicHeight 96\n */export default function KeyEdge(props){const{fromColor,toColor,keyWidth}={...DEFAULTS,...props};const rootRef=useRef(null);const staticRender=typeof window===\"undefined\"||RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{const root=rootRef.current;if(!root||staticRender)return;const teeth=Array.from(root.querySelectorAll(\"[data-t]\"));const reduced=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;const dip=new Float32Array(COUNT);let progress=reduced?1:0;let pointerX=-1;let raf=0;let visibleCount=COUNT;let inView=false;const layout=()=>{visibleCount=Math.min(COUNT,Math.max(8,Math.ceil(root.clientWidth/keyWidth)));teeth.forEach((t,i)=>{t.style.display=i<visibleCount?\"block\":\"none\";});};const paint=()=>{raf=0;let moving=false;for(let i=0;i<visibleCount;i++){const center=(i+.5)/visibleCount;const near=pointerX<0?0:clamp(1-Math.abs(center-pointerX)*visibleCount/2.6);dip[i]+=(near*.3-dip[i])*.22;if(Math.abs(near*.3-dip[i])>.002)moving=true;const start=noise(i)*.44+center*.14;const e=smooth(clamp((progress-start)/.42));const t=performance.now()/1e3;const sway=reduced?0:(.5+.5*Math.sin(t*.55+i*.47))*.1+(.5+.5*Math.sin(t*.23-i*.19))*.06;teeth[i].style.transform=\"scaleY(\"+clamp(e-dip[i]*e-sway*e).toFixed(4)+\")\";}if(moving||inView&&!reduced)raf=requestAnimationFrame(paint);};const wake=()=>{if(!raf)raf=requestAnimationFrame(paint);};const onScroll=()=>{if(reduced)return;const rect=root.getBoundingClientRect();const vh=window.innerHeight||800;progress=clamp((vh*.98-rect.top)/(vh*.48));wake();};const onMove=e=>{const rect=root.getBoundingClientRect();pointerX=(e.clientX-rect.left)/rect.width;wake();};const onLeave=()=>{pointerX=-1;wake();};layout();onScroll();paint();const resize=new ResizeObserver(()=>{layout();wake();});resize.observe(root);const seen=new IntersectionObserver(([entry])=>{inView=entry.isIntersecting;wake();});seen.observe(root);window.addEventListener(\"scroll\",onScroll,{passive:true});root.addEventListener(\"pointermove\",onMove);root.addEventListener(\"pointerleave\",onLeave);return()=>{cancelAnimationFrame(raf);resize.disconnect();seen.disconnect();window.removeEventListener(\"scroll\",onScroll);root.removeEventListener(\"pointermove\",onMove);root.removeEventListener(\"pointerleave\",onLeave);};},[keyWidth,staticRender]);return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,\"aria-hidden\":true,style:{...props.style,display:\"flex\",alignItems:\"flex-end\",width:\"100%\",height:\"100%\",overflow:\"hidden\",background:fromColor},children:Array.from({length:COUNT},(_,i)=>/*#__PURE__*/_jsx(\"div\",{\"data-t\":true,style:{flex:\"1 1 0\",minWidth:0,height:\"100%\",marginRight:-.5,background:toColor,transformOrigin:\"50% 100%\"}},i))});}addPropertyControls(KeyEdge,{fromColor:{type:ControlType.Color,title:\"From\",defaultValue:DEFAULTS.fromColor},toColor:{type:ControlType.Color,title:\"To\",defaultValue:DEFAULTS.toColor},keyWidth:{type:ControlType.Number,title:\"Key width\",min:16,max:80,step:1,unit:\"px\",defaultValue:DEFAULTS.keyWidth}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"KeyEdge\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"1200\",\"framerIntrinsicHeight\":\"96\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./KeyEdge.map"],"mappings":"A,uMAQG,SAAwBa,EAAQ,EAAM,CAAC,GAAK,CAAC,YAAU,UAAQ,YAAU,CAAC,GAAGC,EAAS,GAAGC,CAAK,EAAQC,EAAQhB,EAAO,IAAI,EAAQiB,EAAoBd,IAAS,QAAaM,EAAa,QAAQ,IAAIA,EAAa,OAAyhE,OAAlhED,MAAc,CAAC,IAAMU,EAAKF,EAAQ,QAAQ,GAAG,CAACE,GAAMD,EAAa,OAAO,IAAME,EAAM,MAAM,KAAKD,EAAK,iBAAiB,UAAU,CAAC,EAAQE,EAAQjB,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAAckB,EAAI,IAAI,aAAaC,CAAK,EAAMC,EAAS,KAAgBC,EAAS,GAAOC,EAAI,EAAMC,EAAaJ,EAAUK,EAAO,GAAYC,MAAW,CAAC,EAAa,KAAK,IAAIN,EAAM,KAAK,IAAI,EAAE,KAAK,KAAKJ,EAAK,YAAYW,CAAQ,CAAC,CAAC,EAAEV,EAAM,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,QAAQW,EAAEJ,EAAa,QAAQ,MAAO,CAAC,CAAE,EAAQK,MAAU,CAAC,EAAI,EA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