{"version":3,"file":"AutoFetchCountry.CSB461XF.mjs","names":["__legacyOverrideHOC_DataObserverContext"],"sources":["https:/framerusercontent.com/modules/igxg8hlns7HykQs6UCe4/uujww9WkG532KsNlszti/AutoFetchCountry.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=\"Country Code\"]');// 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\":{\"autofillCountry\":{\"type\":\"override\",\"name\":\"autofillCountry\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withautofillCountry\":{\"type\":\"reactHoc\",\"name\":\"withautofillCountry\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AutoFetchCountry.map"],"mappings":"yPAAwE,SAAgB,GAAiB,CASzG,MAT0G,GAAU,IAAI,CACxH,MAAM,mCAAmC,CAAC,KAAK,GAAU,EAAS,MAAM,CAAC,CAAC,KAAK,GAAM,CAAC,IAAM,EAAQ,EAAK,QAEzG,OAAO,uCAAuC,IAAU,CAAC,KAAK,GAAK,EAAI,MAAM,CAAC,CAAC,KAAK,GAAa,CAAC,IAAM,EAAY,EAAY,GAAG,IAAI,KAChI,EAAY,EAAY,GAAG,IAAI,SAAS,GAEzC,KAAmB,IAAc,IACjC,EAAW,SAAS,cAAc,6BAA6B,CACrE,AAAG,IAAY,EAAW,MAAM,EAAkB,EAAC,CAAC,MAAM,GAAO,CAAC,QAAQ,MAAM,+BAA+B,EAAM,AAAE,EAAC,AAAE,EAAC,CAAC,MAAM,GAAO,CAAC,QAAQ,MAAM,0BAA0B,EAAM,AAAE,EAAC,AAAE,EAAC,CAAE,EAAC,CAC3L,CAAE,CAAE,CAAmJ,SAAgB,EAAoB,EAAE,CAAC,MAAO,CAAA,IAAQ,EAA+BA,EAAwC,CAAQ,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAgB,EAAM,AAAC,EAAC,CAAI,cAAA,AATlV,GAA2C,IAA6B,CASE,GAAmF,CAAqL,EAAoB,YAAY"}