{"version":3,"file":"ImageColorOverlay.cdCgHIoG.mjs","names":[],"sources":["https:/framerusercontent.com/modules/LPSUTBnaeH9RNMBR3D37/aNR2k4k6S2JjvEwndIwS/ImageColorOverlay.js"],"sourcesContent":["// Image color overlay component with scale slider and color picker\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Image Color Overlay\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 400\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ImageColorOverlay(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Image\"},initialScale=100,overlayColor=\"#0099FF\",clipOverlap=true,alignment=\"center\",verticalAlignment=\"middle\",style}=props;const maskPositionMap={left:\"left\",center:\"center\",right:\"right\"};const maskPositionVerticalMap={top:\"top\",middle:\"center\",bottom:\"bottom\"};const transformOriginMap={left:\"left center\",center:\"center center\",right:\"right center\"};const transformOriginVerticalMap={top:\"top\",middle:\"center\",bottom:\"bottom\"};const horizontalOrigin=alignment===\"left\"?\"left\":alignment===\"right\"?\"right\":\"center\";const verticalOrigin=verticalAlignment===\"top\"?\"top\":verticalAlignment===\"bottom\"?\"bottom\":\"center\";return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",overflow:clipOverlap?\"hidden\":\"visible\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",backgroundColor:overlayColor,WebkitMaskImage:`url(${image.src})`,maskImage:`url(${image.src})`,WebkitMaskSize:\"contain\",maskSize:\"contain\",WebkitMaskRepeat:\"no-repeat\",maskRepeat:\"no-repeat\",WebkitMaskPosition:`${maskPositionMap[alignment]} ${maskPositionVerticalMap[verticalAlignment]}`,maskPosition:`${maskPositionMap[alignment]} ${maskPositionVerticalMap[verticalAlignment]}`,transform:`scale(${initialScale/100})`,transformOrigin:`${horizontalOrigin} ${verticalOrigin}`}})});}function getInvertValue(color){const rgb=hexToRgb(color);if(!rgb)return 0;const brightness=(rgb.r+rgb.g+rgb.b)/3;return brightness>127?1:0;}function getHueRotate(color){const rgb=hexToRgb(color);if(!rgb)return 0;const r=rgb.r/255;const g=rgb.g/255;const b=rgb.b/255;const max=Math.max(r,g,b);const min=Math.min(r,g,b);let h=0;if(max!==min){const d=max-min;if(max===r){h=((g-b)/d+(g<b?6:0))/6;}else if(max===g){h=((b-r)/d+2)/6;}else{h=((r-g)/d+4)/6;}}return h*360;}function getBrightness(color){const rgb=hexToRgb(color);if(!rgb)return 1;const brightness=(rgb.r+rgb.g+rgb.b)/3/255;return Math.max(.5,brightness*1.5);}function hexToRgb(hex){// Handle hex colors\nif(hex.startsWith(\"#\")){const result=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);return result?{r:parseInt(result[1],16),g:parseInt(result[2],16),b:parseInt(result[3],16)}:null;}// Handle rgb/rgba\nif(hex.startsWith(\"rgb\")){const match=hex.match(/\\d+/g);if(match&&match.length>=3){return{r:parseInt(match[0]),g:parseInt(match[1]),b:parseInt(match[2])};}}// Handle hsl/hsla\nif(hex.startsWith(\"hsl\")){const match=hex.match(/\\d+\\.?\\d*/g);if(match&&match.length>=3){const h=parseFloat(match[0])/360;const s=parseFloat(match[1])/100;const l=parseFloat(match[2])/100;const hue2rgb=(p,q,t)=>{if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p;};const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;return{r:Math.round(hue2rgb(p,q,h+1/3)*255),g:Math.round(hue2rgb(p,q,h)*255),b:Math.round(hue2rgb(p,q,h-1/3)*255)};}}return null;}addPropertyControls(ImageColorOverlay,{image:{type:ControlType.ResponsiveImage,title:\"Image\"},initialScale:{type:ControlType.Number,title:\"Scale\",defaultValue:100,min:50,max:200,step:1,unit:\"%\"},overlayColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#0099FF\"},clipOverlap:{type:ControlType.Boolean,title:\"Clip Overlap\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},alignment:{type:ControlType.Enum,title:\"Horizontal\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Middle\",\"Right\"],defaultValue:\"center\",displaySegmentedControl:true},verticalAlignment:{type:ControlType.Enum,title:\"Vertical\",options:[\"top\",\"middle\",\"bottom\"],optionTitles:[\"Top\",\"Middle\",\"Bottom\"],defaultValue:\"middle\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageColorOverlay\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"400\",\"framerIntrinsicHeight\":\"400\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageColorOverlay.map"],"mappings":"4JASG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,sEAAsE,IAAI,OAAO,EAAE,eAAa,IAAI,eAAa,UAAU,cAAY,GAAK,YAAU,SAAS,oBAAkB,SAAS,SAAO,EAAY,EAAgB,CAAC,KAAK,OAAO,OAAO,SAAS,MAAM,OAAO,EAAQ,EAAwB,CAAC,IAAI,MAAM,OAAO,SAAS,OAAO,QAAQ,EAA+K,EAAiB,IAAY,OAAO,OAAO,IAAY,QAAQ,QAAQ,SAAe,EAAe,IAAoB,MAAM,MAAM,IAAoB,SAAS,SAAS,SAAS,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,SAAS,WAAW,MAAM,OAAO,OAAO,OAAO,QAAQ,OAAO,SAAS,EAAY,SAAS,SAAS,EAAE,SAAsB,EAAK,MAAM,CAAC,MAAM,CA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