UNPKG

@fruitsbytes/country-list-ts

Version:

It contains country information including 2 and 3 character ISO codes, country and capital names, currency information, telephone calling codes, and provinces ( first-tier political subdivisions).

431 lines (359 loc) 16.7 kB
import $bMtTm$fastmemoize from "fast-memoize"; var $parcel$global = typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; var $parcel$modules = {}; var $parcel$inits = {}; var parcelRequire = $parcel$global["parcelRequire2e60"]; if (parcelRequire == null) { parcelRequire = function(id) { if (id in $parcel$modules) { return $parcel$modules[id].exports; } if (id in $parcel$inits) { var init = $parcel$inits[id]; delete $parcel$inits[id]; var module = {id: id, exports: {}}; $parcel$modules[id] = module; init.call(module.exports, module, module.exports); return module.exports; } var err = new Error("Cannot find module '" + id + "'"); err.code = 'MODULE_NOT_FOUND'; throw err; }; parcelRequire.register = function register(id, init) { $parcel$inits[id] = init; }; $parcel$global["parcelRequire2e60"] = parcelRequire; } parcelRequire.register("9HzVi", function(module, exports) { module.exports = import("./countries.51a8de00.js").then(()=>parcelRequire("eM1Af")); }); async function $c32e39b78fc8cff2$export$42405f212471e8a2(cca2 = "ht") { return await import(`@fruitsbytes/country-list-ts/dist/flags/${cca2.toLowerCase()}_flag`); } async function $c32e39b78fc8cff2$export$9388fcd1771be726(cca2 = "ht") { return await import(`@fruitsbytes/country-list-ts/dist/data/geo-json/${cca2.toLowerCase()}_geo_json`); } async function $c32e39b78fc8cff2$export$d912daac6d94fba1(cca2 = "ht") { return await import(`@fruitsbytes/country-list-ts/dist/data/topo-json/${cca2.toLowerCase()}_topo_json`); } class $c32e39b78fc8cff2$var$Flag extends HTMLElement { constructor(){ super(); this.attachShadow({ mode: "open" }); const country = this.getAttribute("data-cca2") || "ht"; const width = Number(this.getAttribute("data-display") || "48"); const shape = this.getAttribute("data-shape") || "default"; const wrapper = document.createElement("span"); wrapper.setAttribute("class", "fruits-bytes-country-flag"); wrapper.style.position = "relative"; $c32e39b78fc8cff2$export$42405f212471e8a2(country).then((value)=>{ const img = document.createElement("img"); img.src = value; img.alt = country; wrapper.append(img); }); wrapper.classList.add(shape); let height = width; if (![ "square", "round" ].includes(shape)) height = width * 600 / 900; // Create some CSS to apply to the shadow DOM const style = document.createElement("style"); style.textContent = ` .fruits-bytes-country-flag{ width:${width}px; height:${height}px; } .fruits-bytes-country-flag.square, .fruits-bytes-country-flag.round{ } .fruits-bytes-country-flag.round{ } .fruits-bytes-country-flag img{ display:block; width:100%; object-fit: contain }`; this.shadowRoot.append(style, wrapper); } } customElements.define("cl-flag", $c32e39b78fc8cff2$var$Flag); async function $c32e39b78fc8cff2$export$e0412d591d45e9b(property = "commonName") { switch(property){ case "cca2": const { CCA_2_ARRAY: CCA_2_ARRAY } = await (parcelRequire("9HzVi")); return CCA_2_ARRAY; case "tld": const { TLD_ARRAY: TLD_ARRAY } = await (parcelRequire("9HzVi")); return TLD_ARRAY; case "ccn3": const { CCN_3_ARRAY: CCN_3_ARRAY } = await (parcelRequire("9HzVi")); return CCN_3_ARRAY; case "cca3": const { CCA_3_ARRAY: CCA_3_ARRAY } = await (parcelRequire("9HzVi")); return CCA_3_ARRAY; case "cioc": const { CIOC_ARRAY: CIOC_ARRAY } = await (parcelRequire("9HzVi")); return CIOC_ARRAY; case "countryStatus": const { COUNTRY_STATUS_ARRAY: COUNTRY_STATUS_ARRAY } = await (parcelRequire("9HzVi")); return COUNTRY_STATUS_ARRAY; case "officialName": const { OFFICIAL_NAME_ARRAY: OFFICIAL_NAME_ARRAY } = await (parcelRequire("9HzVi")); return OFFICIAL_NAME_ARRAY; case "currencyCode": const { CURRENCY_CODE_ARRAY: CURRENCY_CODE_ARRAY } = await (parcelRequire("9HzVi")); return CURRENCY_CODE_ARRAY; case "currencyName": const { CURRENCY_NAME_ARRAY: CURRENCY_NAME_ARRAY } = await (parcelRequire("9HzVi")); return CURRENCY_NAME_ARRAY; case "currencySymbol": const { CURRENCY_SYMBOL_ARRAY: CURRENCY_SYMBOL_ARRAY } = await (parcelRequire("9HzVi")); return CURRENCY_SYMBOL_ARRAY; case "region": const { REGION_ARRAY: REGION_ARRAY } = await (parcelRequire("9HzVi")); return REGION_ARRAY; case "subRegion": const { SUB_REGION_ARRAY: SUB_REGION_ARRAY } = await (parcelRequire("9HzVi")); return SUB_REGION_ARRAY; case "capital": const { CAPITAL_ARRAY: CAPITAL_ARRAY } = await (parcelRequire("9HzVi")); return CAPITAL_ARRAY; case "lang": const { LANG_ARRAY: LANG_ARRAY } = await (parcelRequire("9HzVi")); return LANG_ARRAY; case "languageName": const { LANGUAGE_NAME_ARRAY: LANGUAGE_NAME_ARRAY } = await (parcelRequire("9HzVi")); return LANGUAGE_NAME_ARRAY; case "default": case "commonName": default: const { COMMON_NAME_ARRAY: COMMON_NAME_ARRAY } = await (parcelRequire("9HzVi")); return COMMON_NAME_ARRAY; } } function $c32e39b78fc8cff2$export$a98bfde613057188() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("cca2"); } async function $c32e39b78fc8cff2$export$726003d3b6e368b4() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("tld"); } function $c32e39b78fc8cff2$export$87f6b184479a5b42() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("ccn3"); } function $c32e39b78fc8cff2$export$87da4134e79d3639() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("cca3"); } function $c32e39b78fc8cff2$export$d1eca8cb10b6be1d() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("cioc"); } function $c32e39b78fc8cff2$export$85f60a07f26238ec() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("countryStatus"); } function $c32e39b78fc8cff2$export$af8e668157c185ea() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("commonName"); } function $c32e39b78fc8cff2$export$a8ae47c915f65a6c() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("officialName"); } function $c32e39b78fc8cff2$export$a01df35ce0858603() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("currencyCode"); } function $c32e39b78fc8cff2$export$c2f8efb594df36f5() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("currencyName"); } function $c32e39b78fc8cff2$export$dae7f48367f5cf1e() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("currencySymbol"); } function $c32e39b78fc8cff2$export$6b408984b31c1b30() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("region"); } function $c32e39b78fc8cff2$export$f592decc51922e76() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("subRegion"); } function $c32e39b78fc8cff2$export$8c125164d46f23fb() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("capital"); } function $c32e39b78fc8cff2$export$359be4c8544d6fb1() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("lang"); } function $c32e39b78fc8cff2$export$74d99a0fa9518c78() { return $c32e39b78fc8cff2$export$e0412d591d45e9b("languageName"); } async function $c32e39b78fc8cff2$export$c10ef80a1d6ec466(property = "name") { switch(property){ case "tld": const { TLDMap: TLDMap } = await (parcelRequire("9HzVi")); return TLDMap; case "ccn3": const { CCN3Map: CCN3Map } = await (parcelRequire("9HzVi")); return CCN3Map; case "cca3": const { CCA3Map: CCA3Map } = await (parcelRequire("9HzVi")); return CCA3Map; case "cioc": const { CIOCMap: CIOCMap } = await (parcelRequire("9HzVi")); return CIOCMap; case "independent": const { IndependentMap: IndependentMap } = await (parcelRequire("9HzVi")); return IndependentMap; case "idd": const { IDDMap: IDDMap } = await (parcelRequire("9HzVi")); return IDDMap; case "countryStatus": const { CountryStatusMap: CountryStatusMap } = await (parcelRequire("9HzVi")); return CountryStatusMap; case "currencies": const { CurrenciesMap: CurrenciesMap } = await (parcelRequire("9HzVi")); return CurrenciesMap; case "region": const { RegionMap: RegionMap } = await (parcelRequire("9HzVi")); return RegionMap; case "subRegion": const { SubRegionMap: SubRegionMap } = await (parcelRequire("9HzVi")); return SubRegionMap; case "capitals": const { CapitalsMap: CapitalsMap } = await (parcelRequire("9HzVi")); return CapitalsMap; case "languages": const { LanguagesMap: LanguagesMap } = await (parcelRequire("9HzVi")); return LanguagesMap; case "translations": const { TranslationsMap: TranslationsMap } = await (parcelRequire("9HzVi")); return TranslationsMap; case "latLng": const { LatLngMap: LatLngMap } = await (parcelRequire("9HzVi")); return LatLngMap; case "landlocked": const { LandlockedMap: LandlockedMap } = await (parcelRequire("9HzVi")); return LandlockedMap; case "borders": const { BordersMap: BordersMap } = await (parcelRequire("9HzVi")); return BordersMap; case "area": const { AreaMap: AreaMap } = await (parcelRequire("9HzVi")); return AreaMap; case "flag": const { FlagsMap: FlagsMap } = await (parcelRequire("9HzVi")); return FlagsMap; case "demonyms": const { DemonymsMap: DemonymsMap } = await (parcelRequire("9HzVi")); return DemonymsMap; case "callingCodes": const { CallingCodesMap: CallingCodesMap } = await (parcelRequire("9HzVi")); return CallingCodesMap; case "default": case "name": default: const { NamesMap: NamesMap } = await (parcelRequire("9HzVi")); return NamesMap; } } async function $c32e39b78fc8cff2$export$2ce4b52ffb1b2e10(property = "name") { switch(property){ case "tld": const { TLDFatList: TLDFatList } = await (parcelRequire("9HzVi")); return TLDFatList; case "ccn3": const { CCN3FatList: CCN3FatList } = await (parcelRequire("9HzVi")); return CCN3FatList; case "cca3": const { CCA3FatList: CCA3FatList } = await (parcelRequire("9HzVi")); return CCA3FatList; case "cioc": const { CIOCFatList: CIOCFatList } = await (parcelRequire("9HzVi")); return CIOCFatList; case "independent": const { IndependentFatList: IndependentFatList } = await (parcelRequire("9HzVi")); return IndependentFatList; case "idd": const { IDDFatList: IDDFatList } = await (parcelRequire("9HzVi")); return IDDFatList; case "countryStatus": const { CountryStatusFatList: CountryStatusFatList } = await (parcelRequire("9HzVi")); return CountryStatusFatList; case "currencies": const { CurrenciesFatList: CurrenciesFatList } = await (parcelRequire("9HzVi")); return CurrenciesFatList; case "region": const { RegionFatList: RegionFatList } = await (parcelRequire("9HzVi")); return RegionFatList; case "subRegion": const { SubRegionFatList: SubRegionFatList } = await (parcelRequire("9HzVi")); return SubRegionFatList; case "capitals": const { CapitalsFatList: CapitalsFatList } = await (parcelRequire("9HzVi")); return CapitalsFatList; case "languages": const { LanguagesFatList: LanguagesFatList } = await (parcelRequire("9HzVi")); return LanguagesFatList; case "translations": const { TranslationsFatList: TranslationsFatList } = await (parcelRequire("9HzVi")); return TranslationsFatList; case "latLng": const { LatLngFatList: LatLngFatList } = await (parcelRequire("9HzVi")); return LatLngFatList; case "landlocked": const { LandlockedFatList: LandlockedFatList } = await (parcelRequire("9HzVi")); return LandlockedFatList; case "borders": const { BordersFatList: BordersFatList } = await (parcelRequire("9HzVi")); return BordersFatList; case "area": const { AreaFatList: AreaFatList } = await (parcelRequire("9HzVi")); return AreaFatList; case "flag": const { FlagsFatList: FlagsFatList } = await (parcelRequire("9HzVi")); return FlagsFatList; case "demonyms": const { DemonymsFatList: DemonymsFatList } = await (parcelRequire("9HzVi")); return DemonymsFatList; case "callingCodes": const { CallingCodesFatList: CallingCodesFatList } = await (parcelRequire("9HzVi")); return CallingCodesFatList; case "default": case "name": default: const { NamesFatList: NamesFatList } = await (parcelRequire("9HzVi")); return NamesFatList; } } async function $c32e39b78fc8cff2$var$_all() { const { countries: countries } = await (parcelRequire("9HzVi")); return countries; } const $c32e39b78fc8cff2$export$84bf76cd7afc7469 = (0, $bMtTm$fastmemoize)($c32e39b78fc8cff2$var$_all); async function $c32e39b78fc8cff2$var$_find(property, value) { const countries = await $c32e39b78fc8cff2$export$84bf76cd7afc7469(); for (let country of countries)try { if (property.split(".").reduce((o, i)=>o[i], country) === value) return country; } catch (e) { return undefined; } } const $c32e39b78fc8cff2$export$71aa6c912b956294 = (0, $bMtTm$fastmemoize)($c32e39b78fc8cff2$var$_find); async function $c32e39b78fc8cff2$var$_get(property, value) { const countries = await $c32e39b78fc8cff2$export$84bf76cd7afc7469(); let result = []; for (let country of countries)try { if (property.split(".").reduce((o, i)=>o[i], country) === value) result.push(country); } catch (e) { // do Nothing } return result; } const $c32e39b78fc8cff2$export$3988ae62b71be9a3 = (0, $bMtTm$fastmemoize)($c32e39b78fc8cff2$var$_get); export {$c32e39b78fc8cff2$export$42405f212471e8a2 as flag, $c32e39b78fc8cff2$export$9388fcd1771be726 as geo, $c32e39b78fc8cff2$export$d912daac6d94fba1 as topo, $c32e39b78fc8cff2$export$e0412d591d45e9b as ls, $c32e39b78fc8cff2$export$a98bfde613057188 as cca2s, $c32e39b78fc8cff2$export$726003d3b6e368b4 as tlds, $c32e39b78fc8cff2$export$87f6b184479a5b42 as ccn3s, $c32e39b78fc8cff2$export$87da4134e79d3639 as cca3s, $c32e39b78fc8cff2$export$d1eca8cb10b6be1d as ciocs, $c32e39b78fc8cff2$export$85f60a07f26238ec as countryStatuses, $c32e39b78fc8cff2$export$af8e668157c185ea as commonNames, $c32e39b78fc8cff2$export$a8ae47c915f65a6c as officialNames, $c32e39b78fc8cff2$export$a01df35ce0858603 as currencyCodes, $c32e39b78fc8cff2$export$c2f8efb594df36f5 as currencyNames, $c32e39b78fc8cff2$export$dae7f48367f5cf1e as currencySymbols, $c32e39b78fc8cff2$export$6b408984b31c1b30 as regions, $c32e39b78fc8cff2$export$f592decc51922e76 as subRegions, $c32e39b78fc8cff2$export$8c125164d46f23fb as capitals, $c32e39b78fc8cff2$export$359be4c8544d6fb1 as langs, $c32e39b78fc8cff2$export$74d99a0fa9518c78 as languageNames, $c32e39b78fc8cff2$export$c10ef80a1d6ec466 as lsM, $c32e39b78fc8cff2$export$2ce4b52ffb1b2e10 as lsF, $c32e39b78fc8cff2$export$84bf76cd7afc7469 as all, $c32e39b78fc8cff2$export$71aa6c912b956294 as find, $c32e39b78fc8cff2$export$3988ae62b71be9a3 as get}; //# sourceMappingURL=module.js.map