import { CSSProperties, useState } from 'react';
export default (props:{ccode?:string, style:CSSProperties, onclick?:()=>{}, })=>
{
var [countries, setCountries] = useState(null);
if(typeof window != "undefined")
{
if(!window.countries)
{
var getCountries = async ()=>
{
window.countries = await (await fetch(global.cdn("/files/countries.json"))).json();
setCountries(window.countries)
}
getCountries();
}
else {
if(!countries)
{
countries = window.countries
}
}
}
var getCountry = (ccode)=>
{
if(typeof window != "undefined")
{
return window.countries?Object.values(countries).filter(c=> (c as any).code.toLowerCase() == ccode.toLowerCase())[0]:null;
}
return null
}
if(!props.ccode)
{
return null
}
if(props.ccode.length == 2)
{
return {props.onclick?.()}}>
}
else
{
return
{props.onclick?.()}}/>
}
}