{"version":3,"sources":["kitty-menu.js"],"names":["window","kitty","menuToggle","menu","backdropElement","dataset","backdrop","classList","contains","document","querySelectorAll","forEach","element","parentElement","removeChild","createElement","className","onclick","parentNode","remove","button","querySelector","contentDocument","body","prepend","toggle","submenuToggle","submenu","isShowing","add","toggleMenuById","id","show","getElementById","prevScrollpos","Math","max","scrollY","onscroll","currentScrollPos","getElementsByClassName","length","style","top","toggleElement","nextSibling"],"mappings":"AAAA,CAAA,WACAA,OAAAC,QACAD,OAAAC,MAAA,IAGAD,OAAAC,MAAAC,WAAA,SAAAC,GACA,IAGAC,EAHA,QAAAD,EAAAE,QAAAC,WAEAH,EAAAI,UAAAC,SAAA,MAAA,EAaAC,SAAAC,iBAAA,wBAAA,EAAAC,QAAA,IACAC,EAAAC,cAAAC,YAAAF,CAAA,CACA,CAAA,IAdAR,EAAAK,SAAAM,cAAA,KAAA,GACAC,UAAA,iBACAZ,EAAAa,QAAA,KACAb,EAAAc,WAAAJ,YAAAV,CAAA,EACAD,EAAAI,UAAAY,OAAA,MAAA,EACA,IAAAC,EAAAjB,EAAAkB,cAAA,SAAA,EACAD,GACAA,EAAAE,gBAAAD,cAAA,OAAA,EAAAd,UAAAY,OAAA,QAAA,CAEA,EACAV,SAAAc,KAAAC,QAAApB,CAAA,IAQAD,EAAAI,UAAAkB,OAAA,MAAA,CACA,EAEAzB,OAAAC,MAAAyB,cAAA,SAAAN,EAAAO,GACA,IAAAC,EAAAD,EAAApB,UAAAC,SAAA,MAAA,EACAmB,EAAAT,WAAAR,iBAAA,UAAA,EAAAC,QAAA,IACAC,EAAAL,UAAAY,OAAA,MAAA,CACA,CAAA,EACAS,GACAD,EAAApB,UAAAY,OAAA,MAAA,EACAC,EAAAb,UAAAY,OAAA,MAAA,IAEAQ,EAAApB,UAAAsB,IAAA,MAAA,EACAT,EAAAb,UAAAsB,IAAA,MAAA,EAEA,EAEA7B,OAAAC,MAAA6B,eAAA,SAAAC,EAAAC,GACApB,EAAAH,SAAAwB,eAAAF,CAAA,EACAnB,IACAoB,EACApB,EAAAM,WAAAX,UAAAY,OAAA,MAAA,EAGAP,EAAAM,WAAAX,UAAAsB,IAAA,MAAA,EACA7B,OAAAC,MAAAC,WAAAU,EAAAM,UAAA,EAGA,EACA,IAAAgB,EAAAC,KAAAC,IAAApC,OAAAqC,QAAA,CAAA,EACArC,OAAAsC,SAAA,WACA,IAAAC,EAAAJ,KAAAC,IAAApC,OAAAqC,QAAA,CAAA,EACA5B,SAAA+B,uBAAA,gCAAA,EAAAC,SAMAhC,SAAAwB,eAAA,gBAAA,EAAAS,MAAAC,IADA,IAAAT,GAAA,IAAAK,GAAAA,EAAAL,EACA,MAEA,QAEAA,EAAAK,EACA,EAEA9B,SAAAC,iBAAA,4CAAA,EAAAC,QAAA,IACAiC,EAAA1B,WAAA2B,aAAAD,EAAA1B,WAAA2B,YAAAtC,UAAAC,SAAA,SAAA,GACAoC,EAAA1B,WAAAJ,YAAA8B,CAAA,CAEA,CAAA,CACA,EAAA","file":"main.min.js","sourcesContent":["(function () {\n if (!window.kitty) {\n window.kitty = {};\n }\n\n window.kitty.menuToggle = function (menu) {\n var useBackdrop = menu.dataset.backdrop == \"true\";\n if (useBackdrop) {\n if (!menu.classList.contains(\"show\")) {\n var backdropElement = document.createElement(\"div\");\n backdropElement.className = \"kitty-backdrop\";\n backdropElement.onclick = () => {\n backdropElement.parentNode.removeChild(backdropElement);\n menu.classList.remove(\"show\");\n var button = menu.querySelector(\".button\");\n if (button) {\n button.contentDocument.querySelector(\":root\").classList.remove(\"active\");\n }\n };\n document.body.prepend(backdropElement);\n } else {\n document.querySelectorAll(\"body > .kitty-backdrop\").forEach((element) => {\n element.parentElement.removeChild(element);\n });\n }\n }\n\n menu.classList.toggle(\"show\");\n };\n\n window.kitty.submenuToggle = function (button, submenu) {\n var isShowing = submenu.classList.contains(\"show\");\n submenu.parentNode.querySelectorAll(\".submenu\").forEach((element) => {\n element.classList.remove(\"show\");\n });\n if (isShowing) {\n submenu.classList.remove(\"show\");\n button.classList.remove(\"show\");\n } else {\n submenu.classList.add(\"show\");\n button.classList.add(\"show\");\n }\n };\n\n window.kitty.toggleMenuById = function (id, show) {\n var element = document.getElementById(id);\n if (element) {\n if (show) {\n element.parentNode.classList.remove(\"show\");\n window.kitty.menuToggle(element.parentNode);\n } else {\n element.parentNode.classList.add(\"show\");\n window.kitty.menuToggle(element.parentNode);\n }\n }\n };\n var prevScrollpos = Math.max(window.scrollY, 0);\n window.onscroll = function() {\n var currentScrollPos = Math.max(window.scrollY, 0);\n var menuActive = document.getElementsByClassName(\"kitty-menu menu-hamburger show\").length;\n\n if (menuActive) {\n return;\n }\n if ((prevScrollpos === 0 && currentScrollPos === 0) || prevScrollpos > currentScrollPos) {\n document.getElementById(\"menu-container\").style.top = \"0px\";\n } else {\n document.getElementById(\"menu-container\").style.top = \"-80px\";\n }\n prevScrollpos = currentScrollPos;\n };\n\n document.querySelectorAll(\".kitty-menu.menu-hamburger .submenu-toggle\").forEach((toggleElement) => {\n if (!toggleElement.parentNode.nextSibling || !toggleElement.parentNode.nextSibling.classList.contains(\"submenu\")) {\n toggleElement.parentNode.removeChild(toggleElement);\n }\n });\n})();\n"]}