{"version":3,"file":"WaveLoopdown.CKHTpTCJ.mjs","names":["useState","useRef","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","_e","p","ce","de","useInView","motion","init_framer_motion_DhsWWWsN","init_framer_BisrWwwE","addPropertyControls","ControlType","useSiteReducedMotion","reduced","setReduced","stored","MOTION_STORAGE_KEY","onChange","MOTION_EVENT_NAME","wavePath","waves","top","BASE_Y","peak","half","d","i","x0","x1","yFrom","yTo","xm","WaveLoop","reducedMotion","containerRef","isInView","duration","speed","shouldAnimate","waveCount","peakHeight","color","init_WaveLoopdown","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/uvkgTjb6g3KbL5rFY0zx/2xhGba5FiFGsD8trUCqM/WaveLoopdown.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{motion,useInView}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";// Site-wide reduced-motion preference\nconst MOTION_STORAGE_KEY=\"tidemark-reduced-motion\";const MOTION_EVENT_NAME=\"tidemark-motion-change\";function useSiteReducedMotion(){const[reduced,setReduced]=useState(()=>{if(typeof window===\"undefined\")return false;try{const stored=window.localStorage.getItem(MOTION_STORAGE_KEY);if(stored===\"true\")return true;if(stored===\"false\")return false;}catch{// Fall back to system preference\n}return window.matchMedia?window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches:false;});useEffect(()=>{function onChange(e){setReduced(e.detail);}window.addEventListener(MOTION_EVENT_NAME,onChange);return()=>window.removeEventListener(MOTION_EVENT_NAME,onChange);},[]);return reduced;}// Builds one tile of the wave (1200 wide, 53 tall). It starts and ends on\n// a crest, so two tiles side by side loop with no seam.\nconst BASE_Y=43;function wavePath(waves,peak){const n=Math.max(1,Math.min(10,Math.round(waves)));const top=BASE_Y-Math.max(1,Math.min(BASE_Y,peak));const half=600/n;let d=`M0,${top}`;for(let i=0;i<n*2;i++){const x0=i*half;const x1=x0+half;const yFrom=i%2===0?top:BASE_Y;const yTo=i%2===0?BASE_Y:top;const xm=x0+half/2;d+=` C${xm},${yFrom} ${xm},${yTo} ${x1},${yTo}`;}return d+\" L1200,53 L0,53 Z\";}export default function WaveLoop({color=\"#000008\",speed=40,peakHeight=33,waveCount=2}){const reducedMotion=useSiteReducedMotion();const containerRef=useRef(null);const isInView=useInView(containerRef,{once:false,amount:.01});const duration=Math.max(1,Number(speed)||40);const shouldAnimate=!reducedMotion&&isInView;const d=wavePath(waveCount??2,peakHeight??33);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,\"aria-hidden\":\"true\",style:{width:\"100%\",height:\"53px\",overflow:\"hidden\",position:\"relative\",transform:\"rotate(180deg)\"},children:/*#__PURE__*/_jsxs(motion.div,{style:{// Plain positioning instead of flex: Safari on iPad/iPhone\n// can mis-size SVGs inside a flex row and leave a gap.\nposition:\"relative\",width:\"200%\",height:\"100%\"},initial:{x:\"0%\"},animate:shouldAnimate?{x:\"-50%\"}:{x:\"0%\"},transition:shouldAnimate?{duration,ease:\"linear\",repeat:Infinity}:{duration:0},children:[/*#__PURE__*/_jsx(\"svg\",{viewBox:\"0 0 1200 53\",style:{position:\"absolute\",top:0,left:\"0%\",width:\"calc(50% + 1px)\",height:\"100%\",display:\"block\"},preserveAspectRatio:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:d,fill:color})}),/*#__PURE__*/_jsx(\"svg\",{viewBox:\"0 0 1200 53\",style:{position:\"absolute\",top:0,left:\"50%\",width:\"50%\",height:\"100%\",display:\"block\"},preserveAspectRatio:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:d,fill:color})})]},shouldAnimate?\"move-\"+duration:\"still\")});}addPropertyControls(WaveLoop,{color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000008\"},speed:{type:ControlType.Number,title:\"Speed (sec)\",defaultValue:40,min:2,max:200,step:1,unit:\"s\",description:\"Seconds for one full loop. Higher is slower.\"},peakHeight:{type:ControlType.Number,title:\"Peak Height\",defaultValue:33,min:2,max:43,step:1,unit:\"px\",description:\"How tall each wave is. Lower is flatter.\"},waveCount:{type:ControlType.Number,title:\"Wave Count\",defaultValue:2,min:1,max:10,step:1,displayStepper:true,description:\"Number of waves across the width.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WaveLoop\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WaveLoopdown.map"],"mappings":"A,2PACoG,SAASgB,GAAsB,CAAC,GAAK,CAACC,EAAQC,GAAYlB,MAAa,CAAC,GAAUK,IAAS,OAAY,MAAO,GAAM,GAAG,CAAC,IAAMc,EAAOd,EAAO,aAAa,QAAQe,CAAkB,EAAE,GAAGD,IAAS,OAAO,MAAO,GAAK,GAAGA,IAAS,QAAQ,MAAO,EAAM,MAAM,CAC/V,CAAC,OAAOd,EAAO,WAAWA,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAAQ,EAAM,CAAC,EAAuL,OAArLG,MAAc,CAAC,SAASa,EAAS,EAAE,CAACH,EAAW,EAAE,MAAM,CAAE,CAAqD,OAApDb,EAAO,iBAAiBiB,EAAkBD,CAAQ,MAAYhB,EAAO,oBAAoBiB,EAAkBD,CAAQ,CAAE,EAAE,CAAC,CAAC,EAASJ,CAAQ,CAErR,SAASM,EAAS,EAAM,EAAK,CAAC,IAAM,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,GAAG,KAAK,MAAMC,CAAK,CAAC,CAAC,EAAQC,EAAIC,EAAO,KAAK,IAAI,EAAE,KAAK,IAAIA,EAAOC,CAAI,CAAC,EAAQC,EAAK,IAAI,EAAMC,EAAE,MAAMJ,IAAM,IAAI,IAAIK,EAAE,EAAEA,EAAE,EAAE,EAAE,IAAI,CAAC,IAAMC,EAAGD,EAAEF,EAAWI,EAAGD,EAAGH,EAA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