{"version":3,"file":"ImageDownloader.EIDFFD2R.mjs","names":["useState","useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/gxDSECue3WvnkSyE9XVg/x2e7JVbTAL1Rw8QzIlcI/ImageDownloader.js"],"sourcesContent":["// Uploadable image with download button for another file (including PDF)\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useState,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Uploadable image and downloadable file (PDF or any file)\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ImageDownloader(props){const{imageFile=\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",downloadFile=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",downloadLabel=\"Download File\",imageAlt=\"Uploaded Image\",style}=props;const[uploadedImage,setUploadedImage]=useState(null);const inputRef=useRef(null);const handleImageUpload=useCallback(e=>{const file=e.target.files&&e.target.files[0];if(file){const reader=new FileReader;reader.onload=ev=>{startTransition(()=>setUploadedImage(ev.target?.result));};reader.readAsDataURL(file);}},[]);const handleImageClick=useCallback(()=>{if(typeof window===\"undefined\")return;const link=document.createElement(\"a\");link.href=downloadFile;link.download=downloadFile.split(\"/\").pop()||\"file\";document.body.appendChild(link);link.click();document.body.removeChild(link);},[downloadFile]);const handleDownload=useCallback(()=>{if(typeof window===\"undefined\")return;const link=document.createElement(\"a\");link.href=downloadFile;link.download=downloadFile.split(\"/\").pop()||\"file\";document.body.appendChild(link);link.click();document.body.removeChild(link);},[downloadFile]);return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",gap:16,...style},children:[/*#__PURE__*/_jsx(\"input\",{ref:inputRef,type:\"file\",accept:\"image/*\",style:{display:\"none\"},onChange:handleImageUpload}),/*#__PURE__*/_jsx(\"img\",{src:uploadedImage||imageFile,alt:imageAlt,style:{width:\"100%\",height:\"100%\",objectFit:\"contain\",borderRadius:0,boxShadow:\"0 2px 8px rgba(0,0,0,0.08)\",cursor:\"pointer\",marginBottom:0},onClick:handleImageClick,tabIndex:0,role:\"button\",\"aria-label\":\"Upload image\",onKeyDown:e=>{if(e.key===\"Enter\"||e.key===\" \")handleImageClick();}})]});}addPropertyControls(ImageDownloader,{imageFile:{type:ControlType.File,allowedFileTypes:[\"jpg\",\"jpeg\",\"png\",\"gif\",\"webp\",\"svg\"],title:\"Image File\"},downloadFile:{type:ControlType.File,allowedFileTypes:[\"pdf\",\"jpg\",\"jpeg\",\"png\",\"gif\",\"webp\",\"svg\",\"mp4\",\"webm\",\"mov\"],title:\"Download File\"},downloadLabel:{type:ControlType.String,title:\"Download Label\",defaultValue:\"Download File\"},imageAlt:{type:ControlType.String,title:\"Image Alt\",defaultValue:\"Uploaded Image\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageDownloader\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageDownloader.map"],"mappings":"wUAMG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,YAAU,sEAAsE,eAAa,uEAAuE,gBAAc,gBAAgB,WAAS,iBAAiB,SAAO,EAAW,CAAC,EAAc,GAAkBA,EAAS,KAAK,CAAO,EAASC,EAAO,KAAK,CAAO,EAAkBC,EAAY,GAAG,CAAC,IAAM,EAAK,EAAE,OAAO,OAAO,EAAE,OAAO,MAAM,GAAG,GAAG,EAAK,CAAC,IAAM,EAAO,IAAI,WAAW,EAAO,OAAO,GAAI,CAAC,MAAoB,EAAiB,EAAG,QAAQ,OAAO,CAAC,EAAG,EAAO,cAAc,EAAK,GAAI,EAA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