{"version":3,"file":"FileDownloadButton.BFvOfSW_.mjs","names":["useState","startTransition"],"sources":["https:/framerusercontent.com/modules/iqgHiVTA6UA15mqWfzvH/0GmqSRWfNeu5qOhdAgie/FileDownloadButton.js"],"sourcesContent":["// Component that handles file downloads with preserved filenames\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{startTransition,useState}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function FileDownloadButton(props){const{label,fileUrl=\"https://framerusercontent.com/assets/MLWPbW1dUQawJLhhun3dBwpgJak.mp4\",fileName,buttonColor,buttonTextColor,hoverColor,borderRadius,buttonFont,showIcon,disabled}=props;const[isHovered,setIsHovered]=useState(false);const[isDownloading,setIsDownloading]=useState(false);const handleDownload=async()=>{if(disabled||isDownloading)return;startTransition(()=>setIsDownloading(true));try{const response=await fetch(fileUrl);const blob=await response.blob();const url=window.URL.createObjectURL(blob);const link=document.createElement(\"a\");link.href=url;link.download=fileName||\"download\";document.body.appendChild(link);link.click();document.body.removeChild(link);window.URL.revokeObjectURL(url);}catch(error){console.error(\"Download failed:\",error);}finally{startTransition(()=>setIsDownloading(false));}};return /*#__PURE__*/_jsxs(\"button\",{onClick:handleDownload,onMouseEnter:()=>startTransition(()=>setIsHovered(true)),onMouseLeave:()=>startTransition(()=>setIsHovered(false)),disabled:disabled||isDownloading,style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:8,padding:\"12px 24px\",backgroundColor:isHovered&&!disabled?hoverColor:buttonColor,color:buttonTextColor,border:\"none\",borderRadius,cursor:disabled||isDownloading?\"not-allowed\":\"pointer\",opacity:disabled?.5:1,transition:\"background-color 0.2s ease\",...buttonFont,whiteSpace:\"nowrap\"},children:[showIcon&&/*#__PURE__*/_jsxs(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 16 16\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M8 11L4 7H6.5V2H9.5V7H12L8 11Z\",fill:buttonTextColor}),/*#__PURE__*/_jsx(\"path\",{d:\"M2 13H14V14H2V13Z\",fill:buttonTextColor})]}),/*#__PURE__*/_jsx(\"span\",{children:isDownloading?\"Downloading...\":label})]});}addPropertyControls(FileDownloadButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Download File\"},fileUrl:{type:ControlType.File,title:\"File\",allowedFileTypes:[\"pdf\",\"doc\",\"docx\",\"txt\",\"jpg\",\"jpeg\",\"png\",\"gif\",\"webp\",\"svg\",\"mp4\",\"webm\",\"mov\",\"mp3\",\"wav\",\"ogg\",\"zip\"]},fileName:{type:ControlType.String,title:\"File Name\",defaultValue:\"download.mp4\",description:\"Name for the downloaded file (include extension)\"},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#000000\"},buttonTextColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#333333\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},buttonFont:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{variant:\"Semibold\",fontSize:\"14px\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},showIcon:{type:ControlType.Boolean,title:\"Show Icon\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},disabled:{type:ControlType.Boolean,title:\"Disabled\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FileDownloadButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sour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