{"version":3,"file":"AutoFetchCountry_2.Cp7x-R0h.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/IOhZHSbvXZj2pdQCLWVb/ATpaDIQsbl78jP47KlbY/AutoFetchCountry_2.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";export function autofillCountry(){useEffect(()=>{// Fetch the visitor's country using the provided API\nfetch(\"https://api.fetch.tools/location\").then(response=>response.json()).then(data=>{const country=data.country// For example, \"PK\"\n;// Now, get the country calling code using a service\nfetch(`https://restcountries.com/v3.1/alpha/${country}`).then(res=>res.json()).then(countryData=>{const countryCode=countryData[0].idd.root// For example, \"+\" for PK\n;const callingCode=countryData[0].idd.suffixes[0]// This will be the code, like 92\n;// Combine to form the full country calling code\nconst fullCountryCode=`${countryCode}${callingCode}`;// Select the input field by its name attribute\nconst inputField=document.querySelector('input[name=\"Phone\"]');// If the input field exists, set its value to the detected country code\nif(inputField){inputField.value=fullCountryCode;}}).catch(error=>{console.error(\"Error fetching country code:\",error);});}).catch(error=>{console.error(\"Error fetching country:\",error);});},[]);// Return an empty object as no additional props are being overridden\nreturn{};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withautofillCountry(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...autofillCountry(props)});};}withautofillCountry.displayName=\"autofillCountry\";\nexport const __FramerMetadata__ = {\"exports\":{\"withautofillCountry\":{\"type\":\"reactHoc\",\"name\":\"withautofillCountry\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"autofillCountry\":{\"type\":\"override\",\"name\":\"autofillCountry\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AutoFetchCountry_2.map"],"mappings":"yPAAwE,SAAgB,GAAiB,CASzG,OAT0G,MAAc,CACxH,MAAM,mCAAmC,CAAC,KAAK,GAAU,EAAS,MAAM,CAAC,CAAC,KAAK,GAAM,CAAC,IAAM,EAAQ,EAAK,QAEzG,MAAM,wCAAwC,IAAU,CAAC,KAAK,GAAK,EAAI,MAAM,CAAC,CAAC,KAAK,GAAa,CAAC,IAAM,EAAY,EAAY,GAAG,IAAI,KAChI,EAAY,EAAY,GAAG,IAAI,SAAS,GAEzC,EAAgB,GAAG,IAAc,IACjC,EAAW,SAAS,cAAc,sBAAsB,CAC3D,IAAY,EAAW,MAAM,IAAmB,CAAC,MAAM,GAAO,CAAC,QAAQ,MAAM,+BAA+B,EAAM,EAAG,EAAG,CAAC,MAAM,GAAO,CAAC,QAAQ,MAAM,0BAA0B,EAAM,EAAG,EAAG,EAAE,CAAC,CAC3L,EAAE,CAAqJ,SAAgB,EAAoB,EAAE,CAAC,MAAO,KAAQ,EAA+BA,EAAwC,CAAQC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAgB,EAAM,CAAC,CAAC,mBATnS,IAA6B,IASqF,CAAqL,EAAoB,YAAY"}