"use strict";const addQueryArgs=require("./add-query-args-49dcb630.js");var _a;const STATE_INCLUDED_COUNTRIES=["AU","BR","CA","CH","ES","HK","IE","IN","IT","JP","MY","MX","US"],POSTAL_CODE_EXCLUDED_COUNTRIES=["HK"],CITY_EXCLUDED_COUNTRIES=["SG"],hasPostal=a=>!POSTAL_CODE_EXCLUDED_COUNTRIES.includes(a),hasCity=a=>!CITY_EXCLUDED_COUNTRIES.includes(a),hasState=a=>STATE_INCLUDED_COUNTRIES.includes(a),lang=(null===(_a=window.scData)||void 0===_a?void 0:_a.locale)||navigator.language||(null===navigator||void 0===navigator?void 0:navigator.browserLanguage)||(navigator.languages||["en"])[0],countryChoices=async()=>{var a,o,t,s;const l=addQueryArgs.addQueryArgs("https://api.surecart.com/v1/public/atlas",{locale:lang}),e=await fetch(l),i=await e.json(),n=null===(a=(null==i?void 0:i.data)||[])||void 0===a?void 0:a.map((({code:a,name:o})=>({value:a,label:o})));return(null===(s=null===(t=null===(o=null===window||void 0===window?void 0:window.wp)||void 0===o?void 0:o.hooks)||void 0===t?void 0:t.applyFilters)||void 0===s?void 0:s.call(t,"surecart_address_countries",n))||n},getCountryDetails=async a=>{const o=addQueryArgs.addQueryArgs(`https://api.surecart.com/v1/public/atlas/${a}`,{locale:lang}),t=await fetch(o);return await t.json()},isAddressComplete=a=>(null==a?void 0:a.country)&&(null==a?void 0:a.line_1)&&(!hasPostal(a.country)||(null==a?void 0:a.postal_code))&&(!hasCity(a.country)||(null==a?void 0:a.city))&&(!hasState(a.country)||(null==a?void 0:a.state));exports.countryChoices=countryChoices,exports.getCountryDetails=getCountryDetails,exports.isAddressComplete=isAddressComplete;