{"version":3,"file":"header-B4ds8mwZ.js","sources":["../../../app/frontend/entrypoints/header.js"],"sourcesContent":["const closeAllDropdowns = () => {\n document.querySelectorAll('.dropdown-menu').forEach((dropdown) => {\n dropdown.classList.add('_hidden');\n dropdown.classList.remove('!_block');\n });\n};\n\n// Добавляем обработчик клика до DOMContentLoaded\ndocument.addEventListener('click', (e) => {\n // Проверяем, что клик не по кнопке дропдауна и не внутри меню\n if (!e.target.closest('[data-toggle=\"dropdown\"]')\n && !e.target.closest('.dropdown-menu')) {\n closeAllDropdowns();\n }\n}, true);\n\ndocument.addEventListener('DOMContentLoaded', () => {\n closeAllDropdowns();\n\n document.querySelectorAll('[data-toggle=\"dropdown\"]').forEach((toggle) => {\n toggle.addEventListener('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n\n let dropdownMenu;\n\n if (toggle.classList.contains('header__menu-btn')) {\n dropdownMenu = toggle.nextElementSibling;\n } else {\n dropdownMenu = toggle.closest('.dropdown')?.querySelector('.dropdown-menu');\n }\n\n if (dropdownMenu) {\n const wasHidden = dropdownMenu.classList.contains('_hidden');\n\n closeAllDropdowns();\n\n if (wasHidden) {\n dropdownMenu.classList.remove('_hidden');\n dropdownMenu.classList.add('!_block');\n }\n }\n });\n });\n});\n\ndocument.addEventListener('DOMContentLoaded', () => {\n document.querySelector('.header .logout-link')?.addEventListener('click', function (e) {\n e.preventDefault();\n\n fetch(this.href, {\n method: 'POST',\n headers: {\n 'X-CSRF-Token': document.querySelector('meta[name=\"csrf-token\"]').content,\n },\n credentials: 'same-origin',\n }).then((response) => {\n if (response.ok) {\n window.location.reload();\n }\n }).catch((error) => {\n // eslint-disable-next-line no-console\n console.error('Ошибка при выходе:', error);\n });\n });\n});\n"],"names":["closeAllDropdowns","document","querySelectorAll","forEach","dropdown","classList","add","remove","addEventListener","e","target","closest","toggle","_a","dropdownMenu","preventDefault","stopPropagation","contains","nextElementSibling","querySelector","wasHidden","fetch","this","href","method","headers","content","credentials","then","response","ok","window","location","reload","catch","error","console"],"mappings":"AAAA,MAAMA,EAAoB,KACxBC,SAASC,iBAAiB,kBAAkBC,SAASC,IAC1CA,EAAAC,UAAUC,IAAI,WACdF,EAAAC,UAAUE,OAAO,UAAS,GACpC,EAIHN,SAASO,iBAAiB,SAAUC,IAE7BA,EAAEC,OAAOC,QAAQ,6BACdF,EAAEC,OAAOC,QAAQ,sBAExB,IACA,GAEHV,SAASO,iBAAiB,oBAAoB,SAG5CP,SAASC,iBAAiB,4BAA4BC,SAASS,IACtDA,EAAAJ,iBAAiB,SAAUC,IApBtC,IAAAI,EAwBU,IAAAC,EAQJ,GAXAL,EAAEM,iBACFN,EAAEO,kBAKAF,EADEF,EAAOP,UAAUY,SAAS,oBACbL,EAAOM,mBAEP,OAAAL,EAAOD,EAAAD,QAAQ,uBAAcQ,cAAc,kBAGxDL,EAAc,CAChB,MAAMM,EAAYN,EAAaT,UAAUY,SAAS,eAI9CG,IACWN,EAAAT,UAAUE,OAAO,WACjBO,EAAAT,UAAUC,IAAI,WAE9B,IACF,GACF,IAGHL,SAASO,iBAAiB,oBAAoB,KA9C9C,IAAAK,EA+CE,OAAAA,EAAAZ,SAASkB,cAAc,4BAAyBX,iBAAiB,SAAS,SAAUC,GAClFA,EAAEM,iBAEFM,MAAMC,KAAKC,KAAM,CACfC,OAAQ,OACRC,QAAS,CACP,eAAgBxB,SAASkB,cAAc,2BAA2BO,SAEpEC,YAAa,gBACZC,MAAMC,IACHA,EAASC,IACXC,OAAOC,SAASC,QACjB,IACAC,OAAOC,IAEAC,QAAAD,MAAM,qBAAsBA,EAAK,GAE/C,GAAA"}