var u=(n,e,t)=>new Promise((a,i)=>{var d=o=>{try{r(t.next(o))}catch(c){i(c)}},v=o=>{try{r(t.throw(o))}catch(c){i(c)}},r=o=>o.done?a(o.value):Promise.resolve(o.value).then(d,v);r((t=t.apply(n,e)).next())});import{C as h,V as _}from"./vendor.6533e564.js";import{o as m,g}from"./container.d194e338.js";import"./axios.a12892f3.js";import{n as s,e as p,q as y}from"./lesson.45fb358c.js";import{L as l}from"./localization-repository.605a1b7d.js";import{l as f}from"./index3.15a19b85.js";const k="localization";const w={name:"LocalizationItem"};var L=function(){var e=this,t=e._self._c;return t("div",{staticClass:"localization-item",on:{click:function(a){return e.$emit("click")}}},[e._t("default")],2)},C=[],$=s(w,L,C,!1,null,"d6252b55",null,null);const z=$.exports;const b={name:"LocalizationClose"};var x=function(){var e=this,t=e._self._c;return t("button",{staticClass:"localization-close",on:{click:function(a){return e.$emit("close")}}},[t("svg",{attrs:{width:"32",height:"32",viewBox:"0 0 32 32",stroke:"#000",fill:"none",xmlns:"http://www.w3.org/2000/svg"}},[t("path",{attrs:{d:"M9.40039 9.40039L22.5997 22.5997","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}}),t("path",{attrs:{d:"M9.40039 22.5996L22.5997 9.40028","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}})])])},M=[],O=s(b,x,M,!1,null,"177c458b",null,null);const q=O.exports;const S={name:"LocalizationMenu",components:{LocalizationClose:q,FlexContainer:p,LocalizationItem:z},props:{flat:{type:Boolean,default:!1,required:!1}},data(){return{tabs:[{title:this.$t("language"),key:"language",active:!0},{title:this.$t("currency"),key:"currency",active:!1}],languages:[],currencies:[]}},created(){return u(this,null,function*(){this.$emit("loading",!0);try{this.currencies=yield l.currencies(!0),this.languages=yield l.languages()}catch(n){console.log(n)}finally{this.$emit("loading",!1)}})},methods:{handle(n){this.active.key==="language"&&l.changeLanguage(n.iso_2),this.active.key==="currency"&&l.changeCurrency(n.id)}},computed:{list(){return this.active.key==="language"?this.languages:this.active.key==="currency"?this.currencies:[]},active:{get(){return this.tabs.find(n=>n.active)},set(n){this.active&&(this.tabs.find(e=>e.active).active=!1),n.active=!0}}}};var F=function(){var e=this,t=e._self._c;return t("div",{staticClass:"localization-menu",class:{"localization-menu_flat":e.flat}},[t("div",{staticClass:"localization-menu__back",on:{click:function(a){return e.$emit("close")}}},[t("svg",{attrs:{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#52565C",xmlns:"http://www.w3.org/2000/svg"}},[t("path",{attrs:{d:"M17.5 12L6.5 12M6.5 12L11.0882 16M6.5 12L11.0882 8","stroke-linecap":"round","stroke-linejoin":"round"}})]),t("span",{domProps:{innerHTML:e._s(e.$t("back_to_menu"))}})]),t("ul",{staticClass:"localization-menu-tabs"},[t("flex-container",e._l(e.tabs,function(a){return t("li",{key:a.key,staticClass:"localization-menu-tab",class:{active:a===e.active},on:{click:function(i){e.active=a}}},[e._v(" "+e._s(a.title)+" ")])}),0),t("LocalizationClose",{on:{close:function(a){return e.$emit("close")}}})],1),t("h3",{staticClass:"localization-title"},[e._v(" "+e._s(e.active.key==="language"?e.$t("select_language"):e.$t("select_currency"))+" ")]),t("div",{staticClass:"localization-container"},e._l(e.list,function(a,i){return t("localization-item",{key:i,class:{active:a.is_active},on:{click:function(d){return e.handle(a)}}},[e._v(" "+e._s(a.original_name||a.code)+" ")])}),1)])},j=[],H=s(S,F,j,!1,null,"7bd1815d",null,null);const B=H.exports;const E={props:{loading:{type:Boolean,default:!1,required:!1},language:{type:Object,default:()=>null},currency:{type:Object,default:()=>null}},name:"LocalizationHandler",components:{FlexContainer:p,SpinLoader:y},methods:{handle(){this.$emit("handle"),document.querySelectorAll(".fp-header__dropdown").forEach(n=>{n.classList.remove("fp-header__dropdown-show")}),document.querySelectorAll(".fp-header__left-menu-link-arrow").forEach(n=>{n.classList.remove("fp-header__left-menu-link-active")}),document.querySelectorAll(".header__menu_item_dropdown").forEach(n=>{n.parentElement.classList.remove("active")}),document.body.classList.remove("open-menu"),document.querySelector(".header__menu").classList.remove("open"),document.querySelector(".header__menu").classList.remove("open-child")}}};var A=function(){var e=this,t=e._self._c;return t("button",{staticClass:"localization-handler",on:{click:function(a){return e.handle()}}},[e.loading?t("SpinLoader",{attrs:{color:"#3965ff",width:24,"stroke-width":4}}):t("flex-container",[t("svg",{attrs:{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"black",xmlns:"http://www.w3.org/2000/svg"}},[t("path",{attrs:{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}}),t("path",{attrs:{d:"M2 12H22","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}}),t("path",{attrs:{d:"M12 2C14.5013 4.73835 15.9228 8.29203 16 12C15.9228 15.708 14.5013 19.2616 12 22C9.49872 19.2616 8.07725 15.708 8 12C8.07725 8.29203 9.49872 4.73835 12 2V2Z","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}})]),e.language&&e.currency?t("span",[e._v(" "+e._s(e.$t("language"))+": "+e._s(e.language.name)+", "+e._s(e.currency.code))]):e._e()])],1)},R=[],I=s(E,A,R,!1,null,"1ee667eb",null,null);const Z=I.exports;const V=(n,e)=>`
        <div class="raw-handler">
            <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="#3965FF" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M2 12H22" stroke="#3965FF" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M12 2C14.5013 4.73835 15.9228 8.29203 16 12C15.9228 15.708 14.5013 19.2616 12 22C9.49872 19.2616 8.07725 15.708 8 12C8.07725 8.29203 9.49872 4.73835 12 2V2Z" stroke="#3965FF" stroke-linecap="round" stroke-linejoin="round"/>
            </svg>
            <p> ${n.original_name}, ${e.code} - ${e.html_code}</p>
        </div>
    `,N={components:{LocalizationMenu:B,LocalizationHandler:Z},directives:{ClickOutside:h},props:{flat:{type:Boolean,default:!1,required:!1}},name:"LocalizationModal",data(){return{isOpen:!!this.flat,loading:!1,currentLanguage:null,currentCurrency:null,subscriptions:[]}},methods:{handleClickOutside({target:n}){n.closest("[data-localization-raw-handler]")||(this.isOpen=!1)},open(){this.isOpen=!0}},mounted(){return u(this,null,function*(){this.currentLanguage=(yield l.languages()).find(e=>e.is_active),this.currentCurrency=yield l.currentCurrency();const n=document.querySelectorAll("[data-localization-raw-handler]");for(const e of n)e.innerHTML=V(this.currentLanguage,this.currentCurrency),e.addEventListener("click",()=>{this.open(),document.querySelector(".hamburger-mobile")&&document.querySelector(".hamburger-mobile").classList.toggle("open"),document.querySelector(".fp-header__mobile-menu")&&document.querySelector(".fp-header__mobile-menu").classList.toggle("show"),document.querySelector(".fp__overlay")&&document.querySelector(".fp__overlay").classList.toggle("fp__overlay-show")}),this.subscriptions.push(e)})},destroyed(){for(const n of this.subscriptions)n.removeEventListener("click",this.open)}};var T=function(){var e=this,t=e._self._c;return t("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.handleClickOutside,expression:"handleClickOutside"}],staticClass:"localization-modal"},[e.flat?e._e():t("LocalizationHandler",{attrs:{language:e.currentLanguage,currency:e.currentCurrency,loading:e.loading&&e.isOpen},on:{handle:function(a){e.isOpen=!e.isOpen}}}),t("LocalizationMenu",{directives:[{name:"show",rawName:"v-show",value:e.isOpen&&!e.loading,expression:"isOpen && !loading"}],attrs:{flat:e.flat},on:{close:function(a){e.isOpen=!1},loading:function(a){e.loading=a}}})],1)},D=[],K=s(N,T,D,!1,null,"ef8d32c3",null,null);const P=K.exports,{app_current_locale:Y}=window;m(()=>{const n=g(k);n&&(_.mixin({methods:{$t(e){let t="en";return(f[Y||t]||f[t])[e]||e}}}),new _({el:n,render:e=>e(P)}))});
//# sourceMappingURL=localizationModal.e34883f5.js.map
