{"version":3,"file":"CustomDownloadButton.DVaiMolQ.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/HLOy73hfEFp9pcp9LwoV/2h4gyidOBMTW6vEAjFZd/CustomDownloadButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback,useEffect}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";export default function Download(props){const{titleEN,titleTR,tint,style,fileEN,fileTR,downloadFileNameEN,downloadFileNameTR}=props;const[isEnglish,setIsEnglish]=useState(true);const DownloadIcon=()=>/*#__PURE__*/_jsxs(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"24\",height:\"18\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",style:{marginRight:\"5px\"},children:[/*#__PURE__*/_jsx(\"path\",{d:\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"}),/*#__PURE__*/_jsx(\"polyline\",{points:\"7 10 12 15 17 10\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"12\",y1:\"15\",x2:\"12\",y2:\"3\"})]});useEffect(()=>{const path=window.location.pathname;setIsEnglish(!path.includes(\"/tr/\"));},[]);const downloadFile=useCallback(()=>{const file=isEnglish?fileEN:fileTR;const downloadFileName=isEnglish?downloadFileNameEN:downloadFileNameTR;fetch(file).then(response=>response.blob()).then(blob=>{const url=window.URL.createObjectURL(blob);const link=document.createElement(\"a\");link.href=url;link.download=downloadFileName||getFileNameFromUrl(file)||\"download\";document.body.appendChild(link);link.click();document.body.removeChild(link);window.URL.revokeObjectURL(url);}).catch(error=>{console.error(\"Error downloading the file:\",error);});},[isEnglish,fileEN,fileTR,downloadFileNameEN,downloadFileNameTR]);return /*#__PURE__*/_jsx(motion.div,{style:{...style,...containerStyle},children:/*#__PURE__*/_jsxs(motion.div,{onTap:downloadFile,style:{margin:40,padding:10,borderRadius:40,backgroundColor:tint,color:\"white\",fontSize:\"1em\",fontWeight:\"bold\",width:\"100%\",height:\"100%\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",textAlign:\"center\"},whileHover:{scale:1.01,cursor:\"pointer\"},children:[/*#__PURE__*/_jsx(DownloadIcon,{}),isEnglish?titleEN:titleTR]})});}Download.defaultProps={tint:\"#09F\",titleEN:\"Download\",titleTR:\"İndir\",downloadFileNameEN:\"\",downloadFileNameTR:\"\"};addPropertyControls(Download,{tint:{title:\"Tint\",type:ControlType.Color},titleEN:{title:\"Label (English)\",type:ControlType.String},titleTR:{title:\"Label (Turkish)\",type:ControlType.String},fileEN:{title:\"File (English)\",type:ControlType.File,allowedFileTypes:[]},fileTR:{title:\"File (Turkish)\",type:ControlType.File,allowedFileTypes:[]},downloadFileNameEN:{title:\"Download File Name (English)\",type:ControlType.String,defaultValue:\"\"},downloadFileNameTR:{title:\"Download File Name (Turkish)\",type:ControlType.String,defaultValue:\"\"}});const containerStyle={display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"hidden\"};function getFileNameFromUrl(url){const decodedUrl=decodeURIComponent(url);const parts=decodedUrl.split(\"/\");return parts[parts.length-1];}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Download\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CustomDownloadButton.map"],"mappings":"yPAAiM,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,UAAQ,UAAQ,OAAK,QAAM,SAAO,SAAO,qBAAmB,sBAAoB,EAAW,CAAC,EAAU,GAAcA,EAAS,EAAI,EAAQ,MAA8B,EAAM,MAAM,CAAC,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,OAAO,eAAe,YAAY,IAAI,cAAc,QAAQ,eAAe,QAAQ,MAAM,CAAC,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