{"version":3,"file":"DownloadButton.DI0qayEc.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/enYtFtCpjtULyFiOxqhn/hgqwzItv4WWPVFKSswWB/DownloadButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function Download(props){const[bloblUrl,setBlobUrl]=useState(null);const{fileName,firstName,lastName,email,phoneWork,phoneHome,website,jobTitle,organization,country,state,postalCode,city,streetAddress,title,tint,style,file,radius,topLeftRadius,topRightRadius,bottomRightRadius,bottomLeftRadius,isMixedRadius=false,stylePadding,topLeftPadding,topRightPadding,bottomRightPadding,bottomLeftPadding,isMixedPadding=false,font}=props;const borderRadius=isMixedRadius?`${topLeftRadius}px ${topRightRadius}px ${bottomRightRadius}px ${bottomLeftRadius}px`:`${radius}px`;const padding=isMixedPadding?`${topLeftPadding}px ${topRightPadding}px ${bottomRightPadding}px ${bottomLeftPadding}px`:`${stylePadding}px`;const handleClick=async()=>{const response=await fetch(props.file);const blob=await response.blob();const blobUrl=URL.createObjectURL(blob);setBlobUrl(blobUrl);};useEffect(()=>{handleClick();},[]);const generateVCard=()=>{// Create the vCard data string with the variables\nconst vCardData=`BEGIN:VCARD\nVERSION:3.0\nN:${lastName};${firstName};;;\nFN:${firstName} ${lastName}\nEMAIL:${email}\nTEL;TYPE=work,voice:${phoneWork}\nTEL;TYPE=home,voice:${phoneHome}\nURL:${website}\nTITLE:${jobTitle}\nORG:${organization}\nADR;TYPE=work:;;${streetAddress};${city};${state};${postalCode};${country}\nEND:VCARD`;// Rest of the code remains the same...\nconst vCardBlob=new Blob([vCardData],{type:\"text/vcard\"});const vCardURL=URL.createObjectURL(vCardBlob);const downloadLink=document.createElement(\"a\");downloadLink.href=vCardURL;downloadLink.download=\"contact.vcf\";downloadLink.click();URL.revokeObjectURL(vCardURL);};return /*#__PURE__*/_jsx(motion.div,{style:{...style,...containerStyle},children:/*#__PURE__*/_jsx(motion.div,{onClick:generateVCard,style:{borderRadius,padding,backgroundColor:tint,fontSize:font.size,fontWeight:font.weight,color:font.color,fontFamily:`'${font.fontFace}'`,overflow:\"visible\",width:\"100%\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\"},children:/*#__PURE__*/_jsx(\"a\",{style:{textDecoration:\"none\",color:font.color},children:title})})});}addPropertyControls(Download,{firstName:{type:ControlType.String,defaultValue:\"D\\xe1vid\"},lastName:{type:ControlType.String,defaultValue:\"K\\xe1lm\\xe1n\"},email:{type:ControlType.String,defaultValue:\"info@kalmandavid.hu\"},phoneWork:{type:ControlType.String,defaultValue:\"1234567890\"},website:{type:ControlType.String,defaultValue:\"https://www.pkrealty.pl/agents/1\"},phoneHome:{type:ControlType.String,defaultValue:\"1234567890\"},jobTitle:{type:ControlType.String,defaultValue:\"Junior Software Developer\"},organization:{type:ControlType.String,defaultValue:\"Futured\"},streetAddress:{type:ControlType.String,defaultValue:\"Sesame Street 1.\"},city:{type:ControlType.String,defaultValue:\"Győr\"},country:{type:ControlType.String,defaultValue:\"Hungary\"},state:{type:ControlType.String,defaultValue:\"Hungary\"},postalCode:{type:ControlType.String,defaultValue:\"Hungary\"},tint:{title:\"Background Color\",type:ControlType.Color,defaultValue:\"#242424\"},title:{title:\"Label\",type:ControlType.String,defaultValue:\"Download!\"},font:{type:ControlType.Object,controls:{fontFace:{type:ControlType.String,defaultValue:\"Inter\"},size:{type:ControlType.Number,defaultValue:18},color:{type:ControlType.Color,defaultValue:\"#fff\"},weight:{type:ControlType.Enum,defaultValue:\"bold\",options:[\"normal\",\"bold\",\"bolder\",\"lighter\"]}}},radius:{type:ControlType.FusedNumber,title:\"Radius\",defaultValue:8,toggleKey:\"isMixedRadius\",toggleTitles:[\"All\",\"Individual\"],valueKeys:[\"topLeftRadius\",\"topRightRadius\",\"bottomRightRadius\",\"bottomLeftRadius\"],valueLabels:[\"T\",\"R\",\"B\",\"L\"],min:0},stylePadding:{type:ControlType.FusedNumber,title:\"Padding\",defaultValue:16,toggleKey:\"isMixedPadding\",toggleTitles:[\"All\",\"Individual\"],valueKeys:[\"topLeftPadding\",\"topRightPadding\",\"bottomRightPadding\",\"bottomLeftPadding\"],valueLabels:[\"T\",\"R\",\"B\",\"L\"],min:0}});const containerStyle={display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"visible\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Download\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DownloadButton.map"],"mappings":"kOAGG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,EAAS,GAAYA,EAAS,IAAI,EAAO,CAAC,WAAS,YAAU,WAAS,QAAM,YAAU,YAAU,UAAQ,WAAS,eAAa,UAAQ,QAAM,aAAW,OAAK,gBAAc,QAAM,OAAK,QAAM,OAAK,SAAO,gBAAc,iBAAe,oBAAkB,mBAAiB,gBAAc,GAAM,eAAa,iBAAe,kBAAgB,qBAAmB,oBAAkB,iBAAe,GAAM,QAAM,EAAY,EAAa,EAAc,GAAG,EAAc,KAAK,EAAe,KAAK,EAAkB,KAAK,EAAiB,IAAI,GAAG,EAAO,IAAU,EAAQ,EAAe,GAAG,EAAe,KAAK,EAAgB,KAAK,EAAmB,KAAK,EAAkB,IAAI,GAAG,EAAa,IAAU,EAAY,SAAS,CAAwC,IAAM,EAAK,MAAM,MAAnC,MAAM,EAAM,IAAI,EAAA,CAA4B,KAAK,EAAQ,EAAQ,IAAI,gBAAgB,CAAI,EAAE,EAAW,CAAO,CAAE,EAAE,MAAc,CAAC,EAAY,CAAE,EAAE,CAAC,CAAC,EAAE,IAAM,MAAkB,CAC36B,IAAM,EAAU;;IAEZ,E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