{"version":3,"file":"CountryText.DkPRa8DF.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/DQBZi4kAcFzFE91uW9Vr/zEjnbrwnkcq0fewpvcGx/CountryText.js"],"sourcesContent":["// Componente que muestra un texto si la IP de un usuario es de Chile o México, configurable por país\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * CountryText\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CountryText(props){const{textChile,textMexico,textOther,font,color,style}=props;// Inicializar con el valor del sessionStorage si existe\nconst[userCountry,setUserCountry]=useState(()=>{if(typeof window!==\"undefined\"){return sessionStorage.getItem(\"userCountryCode\");}return null;});const[isLoading,setIsLoading]=useState(true);useEffect(()=>{// Si ya tenemos el país guardado, no hacer otra llamada\nif(userCountry){setIsLoading(false);return;}if(typeof window!==\"undefined\"){fetch(\"https://country-dec.gmagnani-56a.workers.dev/\").then(res=>res.json()).then(data=>{sessionStorage.setItem(\"userCountryCode\",data.countryCode);startTransition(()=>{setUserCountry(data.countryCode);setIsLoading(false);});}).catch(()=>{startTransition(()=>{setUserCountry(\"other\");setIsLoading(false);});});}},[userCountry]);let showText=textOther;if(userCountry===\"Chile\"||userCountry===\"CL\"){showText=textChile;}else if(userCountry===\"Mexico\"||userCountry===\"M\\xe9xico\"||userCountry===\"MX\"){showText=textMexico;}return /*#__PURE__*/_jsx(\"span\",{style:{...font,color,...style,display:\"inline-block\"},children:showText});}addPropertyControls(CountryText,{textChile:{type:ControlType.String,title:\"Texto Chile\",defaultValue:\"Hola desde Chile!\"},textMexico:{type:ControlType.String,title:\"Texto M\\xe9xico\",defaultValue:\"\\xa1Hola desde M\\xe9xico!\"},textOther:{type:ControlType.String,title:\"Texto Otros\",defaultValue:\"\\xa1Hola!\"},font:{type:ControlType.Font,title:\"Fuente\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountryText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountryText.map"],"mappings":"kMAMG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,YAAU,aAAW,YAAU,OAAK,QAAM,SAAO,EAChG,CAAC,EAAY,GAAgBA,MAAwB,IAAS,OAAsE,KAAlD,eAAe,QAAQ,kBAAkB,CAAgB,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAK,CAAC,MAAc,CAC5M,GAAG,EAAY,CAAC,EAAa,GAAM,CAAC,OAAkB,IAAS,QAAa,MAAM,gDAAgD,CAAC,KAAK,GAAK,EAAI,MAAM,CAAC,CAAC,KAAK,GAAM,CAAC,eAAe,QAAQ,kBAAkB,EAAK,YAAY,CAAC,MAAoB,CAAC,EAAe,EAAK,YAAY,CAAC,EAAa,GAAM,EAAG,EAAG,CAAC,UAAU,CAAC,MAAoB,CAAC,EAAe,QAAQ,CAAC,EAAa,GAAM,EAAG,EAAG,EAAI,CAAC,EAAY,CAAC,CAAC,IAAI,EAAS,EAAgL,OAAnK,IAAc,SAAS,IAAc,KAAM,EAAS,GAAmB,IAAc,UAAU,IAAc,UAAa,IAAc,QAAM,EAAS,GAAgC,EAAK,OAAO,CAAC,MAAM,CAAC,GAAG,EAAK,QAAM,GAAG,EAAM,QAAQ,eAAe,CAAC,SAAS,EAAS,CAAC,sBAPhpB,IAAsD,IAAoD,CAOwiB,EAAoB,EAAY,CAAC,UAAU,CAAC,KAAK,EAAY,OAAO,MAAM,cAAc,aAAa,oBAAoB,CAAC,WAAW,CAAC,KAAK,EAAY,OA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