{"version":3,"file":"SmoothGradient.Di7Apndh.mjs","names":["useRef","useState","useMemo"],"sources":["https:/framerusercontent.com/modules/cQsnejtuAjcdIX3mkhq6/dejTmfWmoLrOJjm6684n/SmoothGradient.js"],"sourcesContent":["// Smooth gradient overlay component with customizable scrim effect\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo,useEffect,useRef,useState,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function SmoothGradient(props){const{direction,startColor,opacity}=props;const containerRef=useRef(null);const[resolvedStartColor,setResolvedStartColor]=useState(startColor);// Resolve CSS variables on the client\nuseEffect(()=>{if(typeof window===\"undefined\"||!containerRef.current)return;// Check if the color is a CSS variable\nif(startColor.includes(\"var(\")){const computed=getComputedStyle(containerRef.current).getPropertyValue(\"--temp-color-start\");if(computed){startTransition(()=>setResolvedStartColor(computed.trim()));}}else{startTransition(()=>setResolvedStartColor(startColor));}},[startColor]);const gradientStyle=useMemo(()=>{// Scrim coordinates for smooth easing\nconst scrimCoordinates=[{stop:0,alpha:1},{stop:19,alpha:.738},{stop:34,alpha:.541},{stop:47,alpha:.382},{stop:56.5,alpha:.278},{stop:65,alpha:.194},{stop:73,alpha:.126},{stop:80.2,alpha:.075},{stop:86.1,alpha:.042},{stop:91,alpha:.021},{stop:95.2,alpha:.008},{stop:98.2,alpha:.002},{stop:100,alpha:0}];// Parse color to extract RGB values\nconst parseColor=color=>{// Guard for server-side rendering\nif(typeof document===\"undefined\"){// Fallback color parsing for server-side rendering\nif(color.startsWith(\"#\")){const hex=color.slice(1);return{r:parseInt(hex.slice(0,2),16)||0,g:parseInt(hex.slice(2,4),16)||0,b:parseInt(hex.slice(4,6),16)||0};}const rgbMatch=color.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);if(rgbMatch){return{r:parseInt(rgbMatch[1])||0,g:parseInt(rgbMatch[2])||0,b:parseInt(rgbMatch[3])||0};}// Default to black for unknown formats\nreturn{r:0,g:0,b:0};}const canvas=document.createElement(\"canvas\");const ctx=canvas.getContext(\"2d\");if(!ctx)return{r:0,g:0,b:0};ctx.fillStyle=color;const computedColor=ctx.fillStyle;if(computedColor.startsWith(\"#\")){const hex=computedColor.slice(1);return{r:parseInt(hex.slice(0,2),16),g:parseInt(hex.slice(2,4),16),b:parseInt(hex.slice(4,6),16)};}const match=computedColor.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);if(match){return{r:parseInt(match[1]),g:parseInt(match[2]),b:parseInt(match[3])};}return{r:0,g:0,b:0};};const{r,g,b}=parseColor(resolvedStartColor);// Generate gradient stops\nconst stops=scrimCoordinates.map(({stop,alpha})=>{const adjustedAlpha=alpha*opacity;return`rgba(${r}, ${g}, ${b}, ${adjustedAlpha}) ${stop}%`;}).join(\", \");return{background:`linear-gradient(${direction}, ${stops})`};},[direction,resolvedStartColor,opacity]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",position:\"relative\",...gradientStyle,...props.style,// @ts-ignore - CSS custom properties\n\"--temp-color-start\":startColor}});}addPropertyControls(SmoothGradient,{direction:{type:ControlType.Enum,title:\"Direction\",options:[\"to bottom\",\"to top\",\"to left\",\"to right\"],optionTitles:[\"Top to Bottom\",\"Bottom to Top\",\"Left to Right\",\"Right to Left\"],defaultValue:\"to bottom\",displaySegmentedControl:true},startColor:{type:ControlType.Color,title:\"Start Color\",defaultValue:\"#000000\"},opacity:{type:ControlType.Number,title:\"Opacity\",defaultValue:1,min:0,max:1,step:.1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothGradient\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothGradient.map"],"mappings":"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