(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[84711],{684711:function(e,n,t){"use strict";t.d(n,{L:function(){return T}});var r=t(667294),o=t(836808),i=t.n(o),a=t(27898),c=t(450654),u=t(799452),s=t(55024),l=t(968666),d=t(403241),p=t(799907),f=t(789575),g=t(576135),_=t(343509),v=t(30774),h=t(951595),m=t(897631),b=t(635985),w=t(554563),j=t(615390),k=function(e){var n,t=e.viewName,r=e.dropdownData,o=e.languageSwitcherLinks,i=(0,v.t)()[h.E.ENABLE_NEW_LANGUAGE_VERSIONS],a=t&&(t.startsWith("search")||["home","public_tutor_profile","login","signup","teach","vacancies"].includes(t)),c=i&&a,u=(null===r||void 0===r?void 0:r.allLanguages)||[],s=(0,j.y)(u,null!==(n=null===o||void 0===o?void 0:o.i18nUrls)&&void 0!==n?n:[]);return c?s:(0,j.d)(s)},x=t(490116),y=t(794537),O=t(479048),C=t(217674),N=t(365583),I=t(209995),S=t(785893),P={code:"USD",factor:1,symbol:"$",isStandard:!0},E=function(e,n){return n&&e&&e.find((function(e){return e&&e.code===n}))||P},L=function(e){var n=(0,r.useContext)(y.O9),t=E(e.allCurrencies,n),o=r.useState(t.code),i=(0,C.Z)(o,2),a=i[0],c=i[1];return(0,S.jsx)(I._V,{qaId:"currency-switcher",options:e.allCurrencies,value:a,labelReader:function(e){return e.code},valueReader:function(e){return e.code},onChange:function(e){var n=e.option.code;(0,b.pA)({event_name:"currency_changed",json_data:{event_location:"header",new_currency:n,old_currency:t.code}}),c(n),window.location.href=(0,N.u)("/currency/".concat(n,"?next="),window.location.pathname)},onOpen:function(n){var r;e.onOpen(),n.visible&&(r=t.code,(0,b.pA)({event_name:"currency_dropdown_opened",json_data:{current_currency:r}}))}})},D=function(e){var n=e.language,t=e.languages,o=(0,r.useState)(!1),i=o[0],a=o[1];return(0,S.jsx)(I.t6,{qaId:"language-switcher",value:n,options:t,busy:i,labelReader:function(e){return e.name},linkReader:function(e){return e.link},valueReader:function(e){return e.code},onChange:function(e){e.preventDefault(),e.closeSelect(),a(!0),function(e){(0,b.pA)({event_name:"language_changed",json_data:{event_location:"header",new_language:e.new_language,old_language:e.old_language}})}({new_language:e.option.code,old_language:n}),window.location.href=(0,N.u)("/language/".concat(e.option.code,"?next="),"".concat(e.option.link))},onOpen:function(e){e.visible&&(0,b.pA)({event_name:"language_dropdown_opened",json_data:{current_language:n}})}})},H=t(174313),R=function(e){var n=e.viewName,t=void 0===n?"unknown":n,r=e.linkName;(0,b.pA)({event_name:"navigation_anonymous",json_data:{page_name:t,link_name:r}})},W=function(){var e=(0,l.V)(),n=(0,s.p1)();return(0,S.jsx)(c.h.Link,{title:(0,S.jsx)(a._H,{id:"header_ssr.links.home.link",defaultMessage:"Home"}),href:"/".concat(e,"/"),dataQaId:"home-btn",active:"home"===n,onClick:function(){R({viewName:n,linkName:"home"})}})},A=function(){var e=(0,r.useContext)(u.q).headerNavigationUrls,n=(null===e||void 0===e?void 0:e.navigationUrls.findTutors.name)||"",t=i().get("filterState")||"",o=(0,s.p1)();return(0,S.jsx)(c.h.Link,{title:(0,S.jsx)(a._H,{id:"header_ssr.links.find_tutors.link",defaultMessage:"Find tutors"}),href:"".concat(n).concat(t),dataQaId:"find-tutors-btn",active:"search"===o,onClick:function(){"home"===o&&(0,_.EX)("find_tutors"),R({viewName:o,linkName:"find_tutors"})}})},M=function(){var e=(0,l.V)(),n=(0,s.p1)(),t=function(e){var n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(e){case"es":n="/es/cursos-ingles-para-empresas";break;case"pt":n="/pt/cursos-ingles-para-empresas";break;default:n=p.uo[e]||p.uo.en}var r=new URLSearchParams(t).toString();return r?"".concat(n,"?").concat(r):n}(e,"search"===n?{start:"logged_out_search"}:void 0);return(0,S.jsx)(c.h.Link,{title:(0,S.jsx)(a._H,{id:"header_ssr.links.for_business.link",defaultMessage:"For business"}),href:t,dataQaId:"enterprise-btn",onClick:function(){"home"===n&&(0,_.EX)("enterprise"),R({viewName:n,linkName:"enterprise"})}})},U=function(){var e=(0,r.useContext)(u.q).headerNavigationUrls,n=(null===e||void 0===e?void 0:e.navigationUrls.teach.name)||"",t=(0,s.p1)();return(0,S.jsx)(c.h.Link,{title:(0,S.jsx)(a._H,{id:"header_ssr.links.become_tutor.link",defaultMessage:"Become a tutor"}),href:n,dataQaId:"become-tutor-btn",active:"teach"===t,onClick:function(){"home"===t&&(0,_.EX)("become_a_tutor"),R({viewName:t,linkName:"become_a_tutor"})}})},Z=function(){var e=(0,l.V)(),n=(0,s.p1)();return(0,S.jsx)(c.h.Link,{title:(0,S.jsx)(a._H,{id:"header_ssr.links.messages.link",defaultMessage:"Messages"}),href:"/".concat(e,"/messages"),dataQaId:"messages",onClick:function(){R({viewName:n,linkName:"messages"})}})},q=function(){var e=(0,l.V)(),n=(0,s.p1)();return(0,S.jsx)(c.h.Link,{title:(0,S.jsx)(a._H,{id:"header_ssr.links.help.link",defaultMessage:"Help"}),href:"https://help.preply.com/".concat((0,d.E)(e),"/"),dataQaId:"help-button",onClick:function(){R({viewName:n,linkName:"help"})}})},B=function(){var e=(0,l.V)(),n=(0,s.p1)(),t="es"===e?"https://preply.com/es/progreso-en-idiomas-comprobado":"https://preply.com/en/proven-progress-platform";return(0,S.jsx)(c.h.Link,{title:(0,S.jsx)(a._H,{id:"header_ssr.links.brand.link",defaultMessage:"Proven Progress"}),href:t,dataQaId:"brand-button",onClick:function(){R({viewName:n,linkName:"brand"})}})},z=function(e){var n=e.viewName,t=e.dropdownData,r=e.languageSwitcherLinks,o=e.language,i=k({viewName:n,dropdownData:t,languageSwitcherLinks:r});return(0,S.jsx)(D,{language:o,languages:i})},T=function(e){var n=e.language,t=e.background,o=e.viewName,a=e.dropdownData,u=e.languageSwitcherLinks,s=(0,r.useContext)(g.a5),l=!s.mobile&&!s.tablet,d="tokyo-pink"===t?"tokyo-pink":"white",p=(0,v.t)()[h.E.EXP_SHOW_BRAND_LINK_IN_HEADER];(0,r.useEffect)((function(){(0,m.z)(h.E.EXP_SHOW_BRAND_LINK_IN_HEADER)}),[]);var _=function(e){var n=e.viewName,t=e.dropdownData,o=(0,r.useContext)(y.O9),a="home"===n,c=i().get("currency_code")||"",u=a&&""!==c&&c!==o?c:o,s=O.w.of(null===t||void 0===t?void 0:t.allCurrencies).map((function(e){return u&&!e.some((function(e){return(null===e||void 0===e?void 0:e.code)===u}))?[].concat((0,x.Z)(e),[{id:null,code:u,factor:1,isStandard:!1}]):e})).getOrElse([]);return{currentCurrency:E(s,u),allCurrencies:s}}({viewName:o,dropdownData:a}),b=_.currentCurrency,j=_.allCurrencies,C=(0,f.W)(k({viewName:o,dropdownData:a,languageSwitcherLinks:u}),n),N="login"===o||"signup"===o;return(0,S.jsx)(c.h.MainLayout,{desktopLinks:(0,S.jsxs)(c.h.Links,{theme:"Header",children:[(0,S.jsx)(A,{})," ",(0,S.jsx)(M,{})," ",(0,S.jsx)(U,{})," ",p?(0,S.jsx)(B,{}):null]}),mobileLinks:(0,S.jsxs)(c.h.Links,{theme:"Drawer",children:[(0,S.jsx)(W,{}),(0,S.jsx)(A,{}),(0,S.jsx)(M,{}),p?(0,S.jsx)(B,{}):null,(0,S.jsx)(U,{}),(0,S.jsx)(Z,{}),(0,S.jsx)(q,{})]}),background:d,customLanguageSelector:(0,S.jsx)(z,{language:n,viewName:o,dropdownData:a,languageSwitcherLinks:u}),customCurrencySelector:(0,S.jsx)(L,{allCurrencies:(0,w.o)(j),onOpen:function(){}}),helpWidget:N?(0,S.jsx)(H.v,{language:n}):null,currentCurrency:b.code,currentLanguage:{name:C.name,code:C.code},viewName:o,isMobileSsr:!l})}},209995:function(e,n,t){"use strict";t.d(n,{t6:function(){return L},_V:function(){return D}});var r=t(759499),o=t(667294),i=t(294184),a=t.n(i),c=t(641778),u=t(837319),s=t.n(u),l=t(785893),d=function(){throw new Error("Missing context")},p=(0,o.createContext)(d),f=(0,o.createContext)(d);function g(e){var n=(0,o.useContext)(p),t=e.option?n(e.option):"";return(0,l.jsx)(c.t,{tag:"span",variant:"default-regular",children:t})}function _(e){var n=(0,o.useContext)(f)(e.option);return(0,l.jsx)("a",{href:n,className:a()(s().interactive,s().link),onClick:e.onClick,children:(0,l.jsx)(g,{option:e.option})})}function v(e){return(0,l.jsx)("button",{className:a()(s().interactive,s().button),onClick:e.onClick,children:(0,l.jsx)(g,{option:e.option})})}var h=t(217674),m=t(136550),b=t(847902);function w(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function j(e){for(var n=1;nn.top?"bottom":"top"}(n.current);if(null!==o){var i=function(e){var n=document.body.getBoundingClientRect(),t=e.getBoundingClientRect();return{top:n.bottom-t.top,bottom:t.bottom-n.top}}(t.currentTarget),a="top"===o?i.bottom:i.top;f(a-120)}null===(r=e.onOpen)||void 0===r||r.call(e,{visible:!g}),u(o)},dataset:e.qaId?{"qa-id":e.qaId}:void 0,children:(0,l.jsx)(v,{option:_})}),panel:(0,l.jsx)(N,{maxHeight:p,Option:e.Option,options:e.options,valueReader:e.valueReader,onSelect:function(n){var t=!1;e.onChange({option:n.option,closeSelect:function(){u(null)},preventDefault:function(){n.preventDefault()},preventClose:function(){t=!0}}),t||u(null)}})})})]})};function P(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function E(e){for(var n=1;n2&&void 0!==arguments[2])||arguments[2],r="".concat(window.location.search).concat(window.location.hash);return t?"".concat(e).concat(encodeURIComponent(n+r)):"".concat(n+r)}},789575:function(e,n,t){"use strict";t.d(n,{W:function(){return r}});var r=function(e,n){return e&&e.find((function(e){return e&&e.code===n}))||{name:"English",code:"en"}}},403241:function(e,n,t){"use strict";t.d(n,{E:function(){return r}});var r=function(e){return["en","de","es","fr","it","pl","pt","ru"].indexOf(e)>=0?e:"en"}},837319:function(e){e.exports={interactive:"Options_interactive___hokI",link:"Options_link__Ugowf",button:"Options_button__kgcwk"}},118618:function(e){e.exports={root:"Select_root__m2kRM",busy:"Select_busy__s84q0",popover:"Select_popover__YwAJs",top:"Select_top__4rhla",bottom:"Select_bottom__0TnaI",panel:"Select_panel____gFU","fade-in":"Select_fade-in__wvp4f",item:"Select_item__jyPBf"}},475472:function(e){e.exports={HelpWidgetWrap:"styles_HelpWidgetWrap__uA_yF",HelpWidgetMenu:"styles_HelpWidgetMenu__v2F9z",HelpWidgetOpen:"styles_HelpWidgetOpen__KBsGa",HelpWidget:"styles_HelpWidget__uMGSP"}}}]); //# sourceMappingURL=84711-94b01a770ed30a23.js.map