/* Scoped to: ss-amusement-park-navbar */
(function() {
  'use strict';
  var componentRoots = document.querySelectorAll('[data-component-slug="ss-amusement-park-navbar"]');
  componentRoots.forEach(function(componentRoot) {
    // Helper to query within component, with fallback to document for sibling elements
    var $ = function(sel) { 
      return componentRoot.querySelector(sel) || document.querySelector('[data-component-slug="ss-amusement-park-navbar"] ~ ' + sel) || document.querySelector(sel);
    };
    var $$ = function(sel) { 
      var results = componentRoot.querySelectorAll(sel);
      return results.length ? results : document.querySelectorAll(sel);
    };
    // Original component JS runs in this scope
    (function () { setTimeout(function () { var path = window.location.pathname.toLowerCase(); path = path.replace(/^\/|\/$/g, ""); if (path.indexOf("page/") === 0) path = path.substring(5); path = path.split("#")[0]; var currentPath = path.toLowerCase(); if (!currentPath) currentPath = "home"; var textToPath = { home: ["home", "", "#"], explore: ["explore"], tickets: ["tickets"], "about us": ["about"], }; var desktopLinks = document.querySelectorAll( 'nav[data-component-type="Navigation"] a[data-node^="nav_link_"]' ); desktopLinks.forEach(function (link, index) { var linkText = link.textContent.trim().toLowerCase(); var href = link.getAttribute("href") || ""; var linkPath = href .replace(/^\/|\/$/g, "") .replace(/#$/, "") .toLowerCase(); var isActive = false; if (index === 0 && (currentPath === "home" || currentPath === "")) { isActive = true; } else if (linkPath === currentPath) { isActive = true; } else if (textToPath[linkText]) { isActive = textToPath[linkText].some(function (p) { return p === currentPath; }); } if (isActive) { link.classList.remove("text-gray-600", "hover:text-[#2563EB]"); link.classList.add("text-gray-900"); } else { link.classList.remove("text-gray-900"); link.classList.add("text-gray-600", "hover:text-[#2563EB]"); } }); var mobileLinks = document.querySelectorAll(".mobile-drawer nav a"); var mobileIndex = 0; mobileLinks.forEach(function (link) { var linkText = link.textContent.trim().toLowerCase(); var isActive = false; if ( mobileIndex === 0 && (currentPath === "home" || currentPath === "") ) { isActive = true; } else if (textToPath[linkText]) { isActive = textToPath[linkText].some(function (p) { return p === currentPath; }); } if (isActive) { link.classList.add("text-[#2563EB]", "bg-[#2563EB]/10"); link.classList.remove("text-gray-700"); } else { link.classList.remove("text-[#2563EB]", "bg-[#2563EB]/10"); link.classList.add("text-gray-700"); } mobileIndex++; }); var btn = document.querySelector(".mobile-menu-btn"); var overlay = document.querySelector(".mobile-overlay"); var drawer = document.querySelector(".mobile-drawer"); var closeBtn = document.querySelector(".mobile-close"); function openMenu() { overlay.classList.remove("opacity-0", "pointer-events-none"); overlay.classList.add("opacity-100"); drawer.classList.remove("translate-x-full"); document.body.style.overflow = "hidden"; var hamburger = btn.querySelector(".hamburger-icon"); var close = btn.querySelector(".close-icon"); if (hamburger) hamburger.classList.add("hidden"); if (close) close.classList.remove("hidden"); } function closeMenu() { overlay.classList.add("opacity-0", "pointer-events-none"); overlay.classList.remove("opacity-100"); drawer.classList.add("translate-x-full"); document.body.style.overflow = ""; var hamburger = btn.querySelector(".hamburger-icon"); var close = btn.querySelector(".close-icon"); if (hamburger) hamburger.classList.remove("hidden"); if (close) close.classList.add("hidden"); } if (btn) btn.addEventListener("click", openMenu); if (closeBtn) closeBtn.addEventListener("click", closeMenu); if (overlay) overlay.addEventListener("click", closeMenu); }, 0); })();
  });
})();