{"version":3,"file":"lang-_8_19BM2.js","sources":["../../../_frontend/entrypoints/js/lang.js"],"sourcesContent":["(function () {\n const langSelect = document.getElementById(\"lang-switcher\");\n if (!langSelect) {\n return;\n }\n\n let x, i, j, l, ll, selElmnt, a, b, c;\n /* Look for any elements with the class \"custom-select\": */\n x = document.getElementsByClassName(\"custom-lang-select\");\n l = x.length;\n for (i = 0; i < l; i++) {\n selElmnt = x[i].getElementsByTagName(\"select\")[0];\n ll = selElmnt.length;\n /* For each element, create a new DIV that will act as the selected item: */\n a = document.createElement(\"DIV\");\n a.setAttribute(\"class\", \"select-selected\");\n a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;\n x[i].appendChild(a);\n /* For each element, create a new DIV that will contain the option list: */\n b = document.createElement(\"DIV\");\n b.setAttribute(\"class\", \"select-items select-hide\");\n for (j = 0; j < ll; j++) {\n /* For each option in the original select element,\n create a new DIV that will act as an option item: */\n c = document.createElement(\"DIV\");\n c.innerHTML = selElmnt.options[j].innerHTML;\n c.setAttribute(\"data-value\", selElmnt.options[j].value);\n c.addEventListener(\"click\", function (e) {\n /* When an item is clicked, update the original select box,\n and the selected item: */\n var y, i, k, s, h, sl, yl;\n s = this.parentNode.parentNode.getElementsByTagName(\"select\")[0];\n sl = s.length;\n h = this.parentNode.previousSibling;\n for (i = 0; i < sl; i++) {\n if (s.options[i].innerHTML == this.innerHTML) {\n s.selectedIndex = i;\n h.innerHTML = this.innerHTML;\n y = this.parentNode.getElementsByClassName(\"same-as-selected\");\n yl = y.length;\n for (k = 0; k < yl; k++) {\n y[k].removeAttribute(\"class\");\n }\n this.setAttribute(\"class\", \"same-as-selected\");\n break;\n }\n }\n const lang = this.getAttribute(\"data-value\");\n if (lang == \"lv\") {\n window.location = \"/\";\n } else {\n window.location = `/${lang}`;\n }\n h.click();\n });\n b.appendChild(c);\n }\n x[i].appendChild(b);\n a.addEventListener(\"click\", function (e) {\n /* When the select box is clicked, close any other select boxes,\n and open/close the current select box: */\n e.stopPropagation();\n closeAllSelect(this);\n this.nextSibling.classList.toggle(\"select-hide\");\n this.classList.toggle(\"select-arrow-active\");\n });\n }\n\n function closeAllSelect(elmnt) {\n /* A function that will close all select boxes in the document,\n except the current select box: */\n var x, y, i, xl, yl, arrNo = [];\n x = document.getElementsByClassName(\"select-items\");\n y = document.getElementsByClassName(\"select-selected\");\n xl = x.length;\n yl = y.length;\n for (i = 0; i < yl; i++) {\n if (elmnt == y[i]) {\n arrNo.push(i)\n } else {\n y[i].classList.remove(\"select-arrow-active\");\n }\n }\n for (i = 0; i < xl; i++) {\n if (arrNo.indexOf(i)) {\n x[i].classList.add(\"select-hide\");\n }\n }\n }\n\n /* If the user clicks anywhere outside the select box,\n then close all select boxes: */\n document.addEventListener(\"click\", closeAllSelect);\n\n langSelect.addEventListener(\"change\", function () {\n const lang = this.value;\n if (lang == \"lv\") {\n window.location = \"/\";\n } else {\n window.location = `/${lang}`;\n }\n });\n})();\n"],"names":["langSelect","x","j","l","ll","selElmnt","a","b","c","e","y","i","k","s","h","sl","yl","lang","closeAllSelect","elmnt","xl","arrNo"],"mappings":"CAAC,UAAY,CACX,MAAMA,EAAa,SAAS,eAAe,eAAe,EAC1D,GAAI,CAACA,EACH,OAGF,IAAIC,EAAG,EAAGC,EAAGC,EAAGC,EAAIC,EAAUC,EAAGC,EAAGC,EAIpC,IAFAP,EAAI,SAAS,uBAAuB,oBAAoB,EACxDE,EAAIF,EAAE,OACD,EAAI,EAAG,EAAIE,EAAG,IAAK,CAWtB,IAVAE,EAAWJ,EAAE,CAAC,EAAE,qBAAqB,QAAQ,EAAE,CAAC,EAChDG,EAAKC,EAAS,OAEdC,EAAI,SAAS,cAAc,KAAK,EAChCA,EAAE,aAAa,QAAS,iBAAiB,EACzCA,EAAE,UAAYD,EAAS,QAAQA,EAAS,aAAa,EAAE,UACvDJ,EAAE,CAAC,EAAE,YAAYK,CAAC,EAElBC,EAAI,SAAS,cAAc,KAAK,EAChCA,EAAE,aAAa,QAAS,0BAA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