{"version":3,"file":"DynamicText.DoGtiVeK.mjs","names":["React.useState","React.useState"],"sources":["https:/framerusercontent.com/modules/OiavCRU3swsrvvWEw1BF/46S6j2d9qA0UF3kCD041/DynamicParagraph.js","https:/framerusercontent.com/modules/qhEduHbnEgKm1SUjXnbt/fwVdzlYcwmqtcSOezfov/DynamicText.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function DynamicParagraph({content,fontSize,color,align,lineHeight}){const[parsed,setParsed]=React.useState(content);React.useEffect(()=>{const urlParams=new URLSearchParams(window.location.search);const FALLBACKS={carbrand:\"car\",model:\"\",firstname:\"\",lastname:\"\"};let replaced=content.replace(/#(\\w+)/g,(_,key)=>{const param=key.toLowerCase();const raw=urlParams.get(param);if(raw)return raw// usa esattamente come arriva\n;if(FALLBACKS[param]!==undefined)return FALLBACKS[param];return\"\";});// Rimuove virgola se nomi vuoti\nreplaced=replaced.replace(/^(\\s*,|,)/,\"\").replace(/^\\s+/,\"\");// Capitalizza \"you\" se è la prima parola\nreplaced=replaced.replace(/^you\\b/,\"You\");const cleaned=replaced.replace(/\\s+/g,\" \").replace(/\\s+([.,;!?:])/g,\"$1\").trim();setParsed(cleaned);},[content]);return /*#__PURE__*/_jsx(\"p\",{style:{fontFamily:\"Montserrat, sans-serif\",fontWeight:400,fontSize:`${fontSize}px`,color:color,textAlign:align,lineHeight:`${lineHeight}%`,margin:0},children:parsed});}addPropertyControls(DynamicParagraph,{content:{type:ControlType.String,title:\"Paragraph Text\",defaultValue:\"#Firstname #Lastname, you are part of the most beautiful race in the world. Now, you can go even further – in the only simulator that was made for it.\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:20},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},align:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\"},lineHeight:{type:ControlType.Number,title:\"Line Height %\",defaultValue:140}});export default DynamicParagraph;\nexport const __FramerMetadata__ = {\"exports\":{\"DynamicParagraph\":{\"type\":\"reactComponent\",\"name\":\"DynamicParagraph\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"DynamicParagraph\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DynamicParagraph.map","import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function DynamicText({content,fontSize,color,fontWeight,align,lineHeight}){const[parsed,setParsed]=React.useState(content);React.useEffect(()=>{const urlParams=new URLSearchParams(window.location.search);const FALLBACKS={carbrand:\"car\",model:\"\",firstname:\"\",lastname:\"\"};const replaced=content.replace(/#(\\w+)/g,(_,key)=>{const param=key.toLowerCase();const raw=urlParams.get(param);if(raw)return raw// casing esattamente come nel parametro\n;if(FALLBACKS[param]!==undefined)return FALLBACKS[param];return\"\";});const cleaned=replaced.replace(/\\s+/g,\" \").replace(/\\s+([.,;!?:])/g,\"$1\").trim();setParsed(cleaned);},[content]);return /*#__PURE__*/_jsx(\"span\",{style:{fontFamily:\"Montserrat, sans-serif\",fontSize:`${fontSize}px`,color,fontWeight,textAlign:align,lineHeight:`${lineHeight}%`,display:\"block\"},children:parsed});}addPropertyControls(DynamicText,{content:{type:ControlType.String,title:\"Text\",defaultValue:\"Your #CarBrand #Model\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:18},fontWeight:{type:ControlType.Enum,title:\"Font Weight\",options:[300,400,500,600,700],optionTitles:[\"Light\",\"Regular\",\"Medium\",\"SemiBold\",\"Bold\"],defaultValue:500},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],defaultValue:\"left\"},lineHeight:{type:ControlType.Number,title:\"Line Height (%)\",defaultValue:150}});export default DynamicText;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DynamicText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"DynamicText\":{\"type\":\"reactComponent\",\"name\":\"DynamicText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DynamicText.map"],"mappings":"+LAA2H,SAAgB,EAAiB,CAAC,UAAQ,WAAS,QAAM,QAAM,cAAY,CAAC,GAAK,CAAC,EAAO,GAAWA,EAAe,EAAQ,CAG3F,OAH4F,MAAoB,CAAC,IAAM,EAAU,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAO,EAAU,CAAC,SAAS,MAAM,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,CAAK,EAAS,EAAQ,QAAQ,WAAW,EAAE,IAAM,CAAC,IAAM,EAAM,EAAI,aAAa,CACha,OAD2a,EAAU,IAAI,EAAM,GACpf,EAAU,KAAS,IAAA,GAAwC,GAAvB,EAAU,KAAkB,CACpE,EAAS,EAAS,QAAQ,YAAY,GAAG,CAAC,QAAQ,OAAO,GAAG,CAC5D,EAAS,EAAS,QAAQ,SAAS,MAAM,CAAkF,EAAnE,EAAS,QAAQ,OAAO,IAAI,CAAC,QAAQ,iBAAiB,KAAK,CAAC,MAAM,CAAmB,EAAG,CAAC,EAAQ,CAAC,CAAqB,EAAK,IAAI,CAAC,MAAM,CAAC,WAAW,yBAAyB,WAAW,IAAI,SAAS,GAAG,EAAS,IAAU,QAAM,UAAU,EAAM,WAAW,GAAG,EAAW,GAAG,OAAO,EAAE,CAAC,SAAS,EAAO,CAAC,wBAHpT,IAA4B,IAAoD,CAGsO,EAAoB,EAAiB,CAAC,QAAQ,CAAC,KAAK,EAAY,OAAO,MAAM,iBAAiB,aAAa,yJAAyJ,CAAC,SAAS,CAAC,KAAK,EAAY,OAAO,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