{"version":3,"file":"Download_Button.BoBA8AAF.mjs","names":["_jsx","__esmMin","window","init_jsx_runtime","c","init_ssg_sandbox_shims","RenderTarget","addPropertyControls","init_framer_ChujFWHC","ControlType","CustomFilenameDownload","props","file","filename","buttonInstance","openInNewTab","style","isCanvas","handleDownload","blob","url","link","err","init_Download_Button"],"sources":["https:/framerusercontent.com/modules/owVBof3huDdcJJdmKAa3/bzOYYMV69KrWbt8M6LNe/Download_Button.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 60\n */export default function CustomFilenameDownload(props){const{file,filename,buttonInstance,openInNewTab,style}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const handleDownload=async()=>{if(!file)return;try{const response=await fetch(file);const blob=await response.blob();const url=window.URL.createObjectURL(blob);const link=document.createElement(\"a\");link.href=url;link.download=filename||\"download\";if(openInNewTab)link.target=\"_blank\";document.body.appendChild(link);link.click();document.body.removeChild(link);window.URL.revokeObjectURL(url);}catch(err){console.error(\"Download failed\",err);}};if(isCanvas){return /*#__PURE__*/_jsx(\"div\",{style:{...style,padding:10,background:\"#f3f3f3\",borderRadius:8,fontSize:12,textAlign:\"center\"},children:\"Custom Filename Download\"});}return /*#__PURE__*/_jsx(\"div\",{style:{...style},onClick:handleDownload,children:buttonInstance});}CustomFilenameDownload.defaultProps={filename:\"file.pdf\",openInNewTab:false};addPropertyControls(CustomFilenameDownload,{filename:{type:ControlType.String,title:\"Filename\",placeholder:\"example\"},file:{type:ControlType.File,title:\"File\",allowedFileTypes:[\"pdf\",\"jpg\",\"jpeg\",\"png\",\"webp\",\"svg\",\"zip\",\"doc\",\"docx\"]},buttonInstance:{type:ControlType.ComponentInstance,title:\"Button\"},openInNewTab:{type:ControlType.Boolean,title:\"New Tab\",enabledTitle:\"Yes\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomFilenameDownload\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"200\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth auto\",\"framerIntrinsicHeight\":\"60\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Download_Button.map"],"mappings":"A,kLAMG,SAAwBU,EAAuBC,EAAM,CAAC,GAAK,CAACC,OAAKC,WAASC,iBAAeC,eAAaC,SAAOL,EAAYM,EAASX,EAAa,QAAQ,IAAIA,EAAa,OAAaY,EAAe,SAAS,CAAC,GAAIN,EAAY,GAAG,CAAkC,IAAMO,EAAK,MAAM,MAA7B,MAAMP,CAAI,EAAA,CAA4B,KAAK,EAAQQ,EAAIlB,EAAO,IAAI,gBAAgBiB,CAAI,EAAQE,EAAK,SAAS,cAAc,GAAG,EAAEA,EAAK,KAAKD,EAAIC,EAAK,SAASR,GAAU,WAAcE,IAAaM,EAAK,OAAO,UAAS,SAAS,KAAK,YAAYA,CAAI,EAAEA,EAAK,MAAM,EAAE,SAAS,KAAK,YAAYA,CAAI,EAAEnB,EAAO,IAAI,gBAAgBkB,CAAG,CAAE,OAAOE,EAAI,CAAC,QAAQ,MAAM,kBAAkBA,CAAG,CAAE,CAAC,EAAqL,OAAhLL,EAA8BjB,gBAAK,MAAM,CAAC,MAAM,CAAC,GAAGgB,EAAM,QAAQ,GAAG,WAAW,UAAU,aAAa,EAAE,SAAS,GAAG,UAAU,QAAQ,EAAE,SAAS,0BAA0B,CAAC,EAAuBhB,gBAAK,MAAM,CAAC,MAAM,CAAC,GAAGgB,CAAK,EAAE,QAAQE,EAAe,SAASJ,CAAc,CAAC,CAAE,C,0CAACJ,EAAuB,aAAa,CAAC,SAAS,WAAW,aAAa,EAAK,EAAEH,EAAoBG,EA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