{"version":3,"file":"Focus.DewDKX5W.mjs","names":["useRef","_Fragment","useState"],"sources":["https:/framerusercontent.com/modules/i06PHS99MB5xeaYEJu4N/VzpMI6NwTKhZSddj3mOU/Focus.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef,useState,startTransition}from\"react\";// Overrides for the Rack Focus hero.\n//\n// withFocusTrack   goes on the tall section the scene is pinned inside. It\n//                  measures how far that section has been scrolled and hands\n//                  the position to Rack Focus and Focus Scale.\n// withVisibleHeight goes on any full-screen layer. It makes the layer as tall\n//                  as the visible window, so nothing sits behind a phone\n//                  browser's toolbar.\n// withVisibleViewport goes on a component instance (the navigation). Layers\n//                  inside it that are set to a viewport height then use the\n//                  visible window too.\n// withHideOnScroll goes on the fixed layer that holds the navigation. It\n//                  slides the layer away while the page scrolls down and\n//                  brings it back as soon as the page scrolls up.\nfunction focusStore(){if(typeof window===\"undefined\")return null;const w=window;if(!w.__barytaFocus)w.__barytaFocus={t:0,p:0,count:0,live:false,subs:new Set,scrollTo:null,kick:null};return w.__barytaFocus;}const clamp=(v,a,b)=>Math.min(b,Math.max(a,v));// Hold each stop for a while, then move to the next one.\nfunction plateau(raw){const i=Math.floor(raw);const f=raw-i;const hold=.2;const u=clamp((f-hold)/(1-2*hold),0,1);return i+u*u*(3-2*u);}export function withFocusTrack(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const local=useRef(null);useEffect(()=>{const el=local.current;const store=focusStore();if(!el||!store)return;const reduced=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;let raf=0;let last=0;let lastScroll=0;let top=0;let range=0;const emit=()=>store.subs.forEach(fn=>fn(store.p));const measure=()=>{const r=el.getBoundingClientRect();range=r.height-window.innerHeight;top=r.top+window.scrollY;store.t=range>1?clamp(-r.top/range,0,1):0;};const tick=now=>{raf=0;const n=Math.max(1,store.count);const idle=now-lastScroll>170;let goal=plateau(store.t*(n-1));if(idle||reduced)goal=Math.round(goal);const dt=Math.min(64,Math.max(1,now-last));last=now;let p=reduced?goal:store.p+(goal-store.p)*(1-Math.exp(-dt/140));if(Math.abs(goal-p)<4e-4)p=goal;if(p!==store.p){store.p=p;emit();}if(p!==goal||!idle)raf=requestAnimationFrame(tick);};const wake=()=>{if(!raf){last=performance.now();raf=requestAnimationFrame(tick);}};const onScroll=()=>{const before=store.t;measure();if(store.t!==before){lastScroll=performance.now();wake();}};const onResize=()=>{measure();wake();};store.live=true;store.kick=wake;store.scrollTo=index=>{measure();const n=Math.max(1,store.count);const to=top+(n>1?index/(n-1):0)*Math.max(0,range);window.scrollTo({top:to,behavior:reduced?\"auto\":\"smooth\"});};measure();const n0=Math.max(1,store.count);store.p=Math.round(store.t*(n0-1));emit();window.addEventListener(\"scroll\",onScroll,{passive:true});window.addEventListener(\"resize\",onResize);return()=>{window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",onResize);if(raf)cancelAnimationFrame(raf);store.live=false;store.kick=null;store.scrollTo=null;store.t=0;store.p=0;};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:node=>{local.current=node;if(typeof ref===\"function\")ref(node);else if(ref)ref.current=node;}});});}const VISIBLE_CSS=\".baryta-visible{height:100vh!important;height:100dvh!important}\";export function withVisibleHeight(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{dangerouslySetInnerHTML:{__html:VISIBLE_CSS}}),/*#__PURE__*/_jsx(Component,{...props,ref:ref,className:[props.className,\"baryta-visible\"].filter(Boolean).join(\" \")})]});});}export function withVisibleViewport(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{...props,ref:ref,style:{...props.style,\"--framer-viewport-height\":\"100dvh\"}});});}export function withHideOnScroll(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const local=useRef(null);const[hidden,setHidden]=useState(false);useEffect(()=>{const el=local.current;if(!el)return;let lastY=window.scrollY;let raf=0;let now=false;const update=()=>{raf=0;const y=window.scrollY;if(Math.abs(y-lastY)<6)return;// Never hide near the top of the page, or while the phone\n// menu is open (the layer is then much taller than a bar).\nconst open=el.offsetHeight>200;const next=!open&&y>160&&y>lastY;lastY=y;if(next!==now){now=next;startTransition(()=>setHidden(next));}};const onScroll=()=>{if(!raf)raf=requestAnimationFrame(update);};window.addEventListener(\"scroll\",onScroll,{passive:true});return()=>{window.removeEventListener(\"scroll\",onScroll);if(raf)cancelAnimationFrame(raf);};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:node=>{local.current=node;if(typeof ref===\"function\")ref(node);else if(ref)ref.current=node;},onFocusCapture:()=>setHidden(false),style:{...props.style,transform:hidden?\"translateY(-110%)\":\"translateY(0%)\",transition:\"transform .4s cubic-bezier(.3,.7,.2,1)\"}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withVisibleHeight\":{\"type\":\"reactHoc\",\"name\":\"withVisibleHeight\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withVisibleViewport\":{\"type\":\"reactHoc\",\"name\":\"withVisibleViewport\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFocusTrack\":{\"type\":\"reactHoc\",\"name\":\"withFocusTrack\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHideOnScroll\":{\"type\":\"reactHoc\",\"name\":\"withHideOnScroll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Focus.map"],"mappings":"0KAcA,SAAS,GAAY,CAAC,GAAU,IAAS,OAAY,OAAO,KAAK,IAAM,EAAE,EAA6G,MAAtG,CAAoB,EAAE,gBAAc,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,GAAM,KAAK,IAAI,IAAI,SAAS,KAAK,KAAK,IAAI,EAAS,EAAE,aAAc,CAC7M,SAAS,EAAQ,EAAI,CAAC,IAAM,EAAE,KAAK,MAA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