1import{L as y}from"./messages.DN8B9N_i.js";import{E as p}from"./errors.viSKvgBn.js";import{l as w}from"./index.CKcF9ROh.js";import{D as b}from"./Dialog-Footer-Header.D3yBKn5P.js";import{D as v}from"./Dropdown.CWRH3Ixf.js";import{Loader as f}from"./canvaspop-scoops-file-saver-hammerjs-html-to-image.DozTvvjn.js";import{_ as D}from"./_plugin-vue_export-helper.DlAUqK2U.js";import{e as g,f as l,t as c,g as s,w as _,r as d,o as h,j as L}from"./redesign-scripts.DbjNN3eJ.js";import{withKeys as S}from"./vue-vue-runtime-dom.qkD_S4hE.js";import"./axios.K7I_4P58.js";import"./ActionButton.Cy_TJhbD.js";import"./feather-icons-vue-feather.Xj-5_6R6.js";import"./vue-devtools-api-vuex.CwBZ66H6.js";import"./_commonjsHelpers.Cpj98o6Y.js";const E={components:{Dialog:b,Dropdown:v,Loader:f},props:{countries:{type:Array,required:!0},currencies:{type:Array,required:!0},languages:{type:Array,required:!0},selectedCountry:{type:String,required:!0},selectedCurrency:{type:String,required:!0},selectedLanguage:{type:String,required:!0}},data(){return{visible:!1,loading:!1,error:null,countryCode:null,currencyCode:null,languageCode:null}},computed:{loadingMessage(){return this.$t(y)}},mounted(){this.countryCode=this.selectedCountry,this.currencyCode=this.selectedCurrency,this.languageCode=this.selectedLanguage},methods:{showDialog(){this.visible=!0},hideDialog(){this.loading||(this.visible=!1)},updateCountryCode(e){this.countryCode=this.countries[e].value,this.currencyCode=this.countries[e].currencyCode},updateCurrencyCode(e){this.currencyCode=this.currencies[e].value},updateLanguageCode(e){this.languageCode=this.languages[e].value},async save(){this.loading=!0,this.error=null;try{const e=await w({countryCode:this.countryCode,currencyCode:this.currencyCode,languageCode:this.languageCode}),{countryCode:t,currencyCode:n,languageCode:u}=e.data.results;this.countryCode=t,this.currencyCode=n,this.languageCode=u,window.location.search?window.location.assign(window.location.pathname+window.location.search):window.location.assign(window.location.pathname)}catch(e){this.error=this.$t("message.constants.errors."+p),this.loading=!1}}}},N={"data-test-id":"region-switcher"},q={class:"mt-4"},A={key:0,"data-error":"",class:"p-2 bg-red-50 text-red-500 border-red-500 rounded mt-4 text-center"};function R(e,t,n,u,r,o){const a=d("Dropdown"),C=d("Loader"),m=d("Dialog");return h(),g("div",N,[l("div",{"data-label":"",class:"btn btn--secondary",tabindex:"0",onClick:t[0]||(t[0]=(...i)=>o.showDialog&&o.showDialog(...i)),onKeydown:t[1]||(t[1]=S((...i)=>o.showDialog&&o.showDialog(...i),["enter"]))},c(e.$t("message.regionSwitcher.selectedLabel",{countryCode:r.countryCode,currencyCode:r.currencyCode})),33),s(m,{visible:r.visible,heading:e.$t("message.regionSwitcher.heading"),"has-cancel-option":"",onCancel:o.hideDialog,onConfirm:o.save},{default:_(()=>[l("p",null,c(e.$t("message.regionSwitcher.instructions")),1),l("div",q,[s(a,{"data-countries":"",class:"mt-4",label:e.$t("message.regionSwitcher.countryLabel"),options:n.countries,selected:r.countryCode,onChangeEvent:o.updateCountryCode},null,8,["label","options","selected","onChangeEvent"]),s(a,{"data-currencies":"",class:"mt-4",label:e.$t("message.regionSwitcher.currencyLabel"),options:n.currencies,selected:r.currencyCode,onChangeEvent:o.updateCurrencyCode},null,8,["label","options","selected","onChangeEvent"]),s(a,{"data-languages":"",class:"mt-4",label:e.$t("message.regionSwitcher.languageLabel"),options:n.languages,selected:r.languageCode,onChangeEvent:o.updateLanguageCode},null,8,["label","options","selected","onChangeEvent"]),r.error?(h(),g("div",A,c(r.error),1)):L("",!0)]),s(C,{overlay:"",visible:r.loading,label:o.loadingMessage,class:"absolute inset-0 text-blue-500"},null,8,["visible","label"])]),_:1},8,["visible","heading","onCancel","onConfirm"])])}const J=D(E,[["render",R]]);export{J as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.