{"version":3,"file":"WaveDivider.CpHu_CUw.mjs","names":["useRef","useState","useCallback","p"],"sources":["https:/framerusercontent.com/modules/UrIwkn7i4m4uaLRAQAju/4AGR3Zg0J7mezSRLjYno/WaveDivider.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useRef,useEffect,useState,useCallback}from\"react\";/**\n * Wave Divider\n *\n * A responsive SVG wave divider with 4 variations.\n * Supports repeat tiling and min-width for responsive control.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function WaveDivider(props){const{variant,fillColor,bgColor,waveHeight,flip,animationSpeed,position,repeat,minWidth,style}=props;const containerRef=useRef(null);// Start with enough tiles to cover any viewport on first paint,\n// avoiding a flash while useEffect runs and measure() corrects the count.\nconst[tileCount,setTileCount]=useState(5);const measure=useCallback(()=>{if(!repeat||!containerRef.current){setTileCount(1);return;}const w=containerRef.current.getBoundingClientRect().width;setTileCount(Math.ceil(w/minWidth)+1);},[repeat,minWidth]);useEffect(()=>{measure();window.addEventListener(\"resize\",measure);return()=>window.removeEventListener(\"resize\",measure);},[measure]);// Stretch: single SVG, CSS height + maxHeight, fills full width\nconst stretchStyle={height:waveHeight,maxHeight:waveHeight,width:\"100%\",display:\"block\",transform:flip?\"scaleY(-1)\":undefined,flexShrink:0};// Tile SVGs fill their parent div (which is height-controlled).\n// Using height:100% on the SVG against a px-height div is reliable\n// everywhere — no SVG attribute sizing involved.\nconst tileSvgStyle={width:minWidth,height:\"100%\",display:\"block\",transform:flip?\"scaleY(-1)\":undefined,flexShrink:0};const renderWaveSvg=(key,isTile=false)=>{const svgStyle=isTile?tileSvgStyle:stretchStyle;const par=\"none\";switch(variant){case\"simple\":return /*#__PURE__*/_jsx(\"svg\",{viewBox:\"0 0 1440 120\",preserveAspectRatio:par,style:svgStyle,xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M0,60 C360,120 1080,0 1440,60 L1440,120 L0,120 Z\",fill:fillColor})},key);case\"flipped\":return /*#__PURE__*/_jsx(\"svg\",{viewBox:\"0 0 1440 120\",preserveAspectRatio:par,style:svgStyle,xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M0,60 C120,90 200,100 320,75 C440,50 480,20 600,15 C720,10 780,55 900,70 C1020,85 1100,95 1200,65 C1300,35 1380,40 1440,60 L1440,120 L0,120 Z\",fill:fillColor})},key);case\"layered\":return /*#__PURE__*/_jsxs(\"svg\",{viewBox:\"0 0 1440 180\",preserveAspectRatio:par,style:svgStyle,xmlns:\"http://www.w3.org/2000/svg\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M0,100 C240,40 480,160 720,100 C960,40 1200,160 1440,100 L1440,180 L0,180 Z\",fill:fillColor,opacity:.35}),/*#__PURE__*/_jsx(\"path\",{d:\"M0,100 C320,160 640,60 960,120 C1120,140 1280,60 1440,100 L1440,180 L0,180 Z\",fill:fillColor,opacity:.55}),/*#__PURE__*/_jsx(\"path\",{d:\"M0,125 C360,80 720,160 1080,110 C1260,90 1380,145 1440,125 L1440,180 L0,180 Z\",fill:fillColor})]},key);case\"animated\":return /*#__PURE__*/_jsx(AnimatedWave,{fillColor:fillColor,svgStyle:svgStyle,speed:animationSpeed,par:par},key);default:return null;}};const waveContent=repeat?/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",width:\"100%\",height:waveHeight,overflow:\"hidden\",lineHeight:0},children:Array.from({length:tileCount},(_,i)=>renderWaveSvg(i,true))}):renderWaveSvg();const wrapperBase={width:\"100%\",lineHeight:0,overflow:\"hidden\",backgroundColor:bgColor};if(position===\"inline\"){return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,...wrapperBase},children:waveContent});}const innerStyle={position:\"absolute\",left:0,right:0,height:waveHeight,...wrapperBase,zIndex:1,...position===\"top\"?{top:0}:{bottom:0}};return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,overflow:\"visible\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsx(\"div\",{style:innerStyle,children:waveContent})});}function AnimatedWave({fillColor,svgStyle,speed,par}){const path1Ref=useRef(null);const path2Ref=useRef(null);const path3Ref=useRef(null);const rafRef=useRef(null);useEffect(()=>{const paths=[{ref:path1Ref,from:\"M0,80 C240,140 480,20 720,80 C960,140 1200,20 1440,80 L1440,200 L0,200 Z\",to:\"M0,100 C240,40 480,140 720,80 C960,20 1200,140 1440,60 L1440,200 L0,200 Z\",duration:8e3/speed},{ref:path2Ref,from:\"M0,100 C320,40 640,160 960,100 C1120,60 1280,140 1440,100 L1440,200 L0,200 Z\",to:\"M0,80 C320,160 640,40 960,100 C1120,140 1280,60 1440,120 L1440,200 L0,200 Z\",duration:1e4/speed},{ref:path3Ref,from:\"M0,120 C360,80 720,160 1080,100 C1260,80 1380,130 1440,120 L1440,200 L0,200 Z\",to:\"M0,110 C360,160 720,60 1080,120 C1260,140 1380,90 1440,100 L1440,200 L0,200 Z\",duration:12e3/speed}];const parseNumbers=d=>d.match(/-?\\d+(\\.\\d+)?/g).map(Number);const interpolate=(fromNums,toNums,t)=>{const ease=.5-.5*Math.cos(Math.PI*t);return fromNums.map((f,i)=>f+(toNums[i]-f)*ease);};const rebuildPath=(template,nums)=>{let i=0;return template.replace(/-?\\d+(\\.\\d+)?/g,()=>{const val=nums[i++];return Number.isInteger(val)?val:val.toFixed(1);});};const parsedPaths=paths.map(p=>({...p,fromNums:parseNumbers(p.from),toNums:parseNumbers(p.to)}));let startTime=null;const animate=timestamp=>{if(!startTime)startTime=timestamp;parsedPaths.forEach(p=>{if(!p.ref.current)return;const elapsed=(timestamp-startTime)%p.duration;const t=elapsed/p.duration;const pingPong=t<.5?t*2:2-t*2;const nums=interpolate(p.fromNums,p.toNums,pingPong);p.ref.current.setAttribute(\"d\",rebuildPath(p.from,nums));});rafRef.current=requestAnimationFrame(animate);};rafRef.current=requestAnimationFrame(animate);return()=>{if(rafRef.current)cancelAnimationFrame(rafRef.current);};},[speed]);return /*#__PURE__*/_jsxs(\"svg\",{viewBox:\"0 0 1440 200\",preserveAspectRatio:par,style:svgStyle,xmlns:\"http://www.w3.org/2000/svg\",children:[/*#__PURE__*/_jsx(\"path\",{ref:path1Ref,d:\"M0,80 C240,140 480,20 720,80 C960,140 1200,20 1440,80 L1440,200 L0,200 Z\",fill:fillColor,opacity:.3}),/*#__PURE__*/_jsx(\"path\",{ref:path2Ref,d:\"M0,100 C320,40 640,160 960,100 C1120,60 1280,140 1440,100 L1440,200 L0,200 Z\",fill:fillColor,opacity:.55}),/*#__PURE__*/_jsx(\"path\",{ref:path3Ref,d:\"M0,120 C360,80 720,160 1080,100 C1260,80 1380,130 1440,120 L1440,200 L0,200 Z\",fill:fillColor})]});}addPropertyControls(WaveDivider,{variant:{type:ControlType.Enum,title:\"Variant\",defaultValue:\"layered\",options:[\"simple\",\"flipped\",\"layered\",\"animated\"],optionTitles:[\"Simple Wave\",\"Multi Wave\",\"Layered Waves\",\"Animated Waves\"]},position:{type:ControlType.Enum,title:\"Position\",defaultValue:\"inline\",options:[\"inline\",\"top\",\"bottom\"],optionTitles:[\"Inline\",\"Top of Section\",\"Bottom of Section\"]},fillColor:{type:ControlType.Color,title:\"Wave Color\",defaultValue:\"#0c4a6e\"},bgColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"transparent\"},waveHeight:{type:ControlType.Number,title:\"Height\",defaultValue:120,min:40,max:300,step:1,unit:\"px\"},flip:{type:ControlType.Boolean,title:\"Flip Vertically\",defaultValue:false,enabledTitle:\"Flipped\",disabledTitle:\"Normal\"},repeat:{type:ControlType.Boolean,title:\"Repeat\",defaultValue:false,enabledTitle:\"Tiled\",disabledTitle:\"Stretch\"},minWidth:{type:ControlType.Number,title:\"Min / Tile Width\",defaultValue:1200,min:320,max:1920,step:1,unit:\"px\",description:\"When Stretch: minimum width before clipping. When Tiled: width of each tile.\"},animationSpeed:{type:ControlType.Number,title:\"Anim Speed\",defaultValue:1,min:.25,max:3,step:.25,hidden:props=>props.variant!==\"animated\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WaveDivider\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WaveDivider.map"],"mappings":"gNAQG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,UAAQ,YAAU,UAAQ,aAAW,OAAK,iBAAe,WAAS,SAAO,WAAS,SAAO,EAAY,EAAaA,EAAO,KAAK,CAE7K,CAAC,EAAU,GAAcC,EAAS,EAAE,CAAO,EAAQC,MAAgB,CAAC,GAAG,CAAC,GAAQ,CAAC,EAAa,QAAQ,CAAC,EAAa,EAAE,CAAC,OAAQ,IAAM,EAAE,EAAa,QAAQ,uBAAuB,CAAC,MAAM,EAAa,KAAK,KAAK,EAAE,EAAS,CAAC,EAAE,EAAG,CAAC,EAAO,EAAS,CAAC,CAAC,OAAe,GAAS,CAAC,EAAO,iBAAiB,SAAS,EAAQ,KAAW,EAAO,oBAAoB,SAAS,EAAQ,EAAG,CAAC,EAAQ,CAAC,CAChY,IAAM,EAAa,CAAC,OAAO,EAAW,UAAU,EAAW,MAAM,OAAO,QAAQ,QAAQ,UAAU,EAAK,aAAa,IAAA,GAAU,WAAW,EAAE,CAGrI,EAAa,CAAC,MAAM,EAAS,OAAO,OAAO,QAAQ,QAAQ,UAAU,EAAK,aAAa,IAAA,GAAU,WAAW,EAAE,CAAO,GAAe,EAAI,EAAO,KAAQ,CAAC,IAAM,EAAS,EAAO,EAAa,EAAmB,EAAI,OAAO,OAAO,EAAP,CAAgB,IAAI,SAAS,OAAoB,EAAK,MAAM,CAAC,QAAQ,eAAe,oBAAoB,EAAI,MAAM,EAAS,MAAM,6BAA6B,SAAsB,EAAK,OAAO,CAAC,EAAE,mDAAm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