1import{l as m}from"./logger-pamvzmAu.js";import"./earn-rewards-XxFFKy6r.js";import"./redeem-rewards-DYzBWxG8.js";import"./exports-NHIMKJG4.js";import"./custom-html-element-Cddc4xm8.js";import"./event-zU-Y6ZHH.js";import"./customer-portal-R96TstYq.js";class v extends HTMLElement{connectedCallback(){this.initElements(),this.initEventListeners(),this.handleInitialNavigation()}initElements(){var t;this.clubContainer=document.querySelector(".club__Container"),this.navItems=this.clubContainer.querySelectorAll(".js-club-nav-item"),this.sections=this.clubContainer.querySelectorAll(".tabs__Content section"),this.promoSection=this.clubContainer.querySelector(".promotion-slider-section"),this.pointsButton=this.clubContainer.querySelector(".js-show-points"),this.pointsSection=this.clubContainer.querySelector("#points-history"),this.backButton=(t=this.pointsSection)==null?void 0:t.querySelector(".js-back"),this.navContainer=this.clubContainer.querySelector(".js-nav-container"),this.clubCardContainer=document.querySelector(".js-club-card-container"),this.currentNavItem=null,this.currentSection=null}initEventListeners(){var t;this.navItems.forEach(e=>{e.addEventListener("click",i=>{this.handleNavItemClick(i,e)})}),this.pointsButton&&this.pointsButton.addEventListener("click",e=>{this.showPointsSection(e)}),(t=this.backButton)==null||t.addEventListener("click",()=>this.handleBackButton()),window.addEventListener("popstate",()=>this.handleInitialNavigation())}handleNavItemClick(t,e){const i=e.getAttribute("role"),a=e.dataset.target;if(i!=="link"&&i==="tab"&&a){const s=new URL(e.href,window.location.origin);window.location.pathname===s.pathname?(t.preventDefault(),history.pushState(null,null,e.href),this.switchTab(a)):window.location.href=e.href}}handleInitialNavigation(){const t=window.location.pathname.split("/"),e=window.location.hash.substring(1),i=this.generateTargetId(t,e);i?this.switchTab(i):this.activateDefaultTab()}switchTab(t){var a;const e=Array.from(this.navItems).find(s=>s.dataset.target===t);if(!e){m.info("No navigation item found for targetId.",{targetId:t});return}this.currentNavItem&&this.currentNavItem.classList.remove("active"),this.currentSection&&this.currentSection.classList.remove("active"),e.classList.add("active"),this.currentNavItem=e;const i=document.querySelector(".js-club-menu");if((a=i==null?void 0:i.close)==null||a.call(i),t==="account-overview")this.showMainTabs();else{const s=Array.from(this.sections).find(n=>n.id===t);if(s){if(s.classList.add("active"),this.currentSection=s,this.sections.forEach(n=>{n!==s&&n.classList.remove("active")}),this.hideMainTabs(),t==="account-earn-rewards"){const n=document.querySelector("earn-rewards");n&&setTimeout(()=>{n._createLayout(n)},0)}else if(t==="account-redeem-rewards"){const n=document.querySelector("redeem-rewards");n&&setTimeout(()=>{n._onLoyaltyLionLoaded(new Promise(o=>{n.querySelector("#loyaltylion")?o("loyaltylion loaded"):new MutationObserver((l,d)=>{n.querySelector("#loyaltylion")&&(o("loyaltylion loaded"),d.disconnect())}).observe(n,{childList:!0,subtree:!0})}))},0)}else if(t==="account-refer-a-friend"&&window.loyaltylion&&window.loyaltylion.ui){window.loyaltylion.ui.refresh(),document.body.classList.add("loyalty--refreshed");const n=document.querySelector("earn-rewards");if(n){const o=new Promise(r=>{const c=document.querySelector(".referral__Element");if(c&&c.hasChildNodes())r("referral element already loaded");else{const l=new MutationObserver((d,h)=>{const u=document.querySelector(".referral__Element");u&&u.hasChildNodes()&&(r("referral element loaded"),h.disconnect())});l.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>{l.disconnect(),r("referral element timeout")},5e3)}});n._onLoyaltyLionLoaded(o,n)}}}}}showPointsSection(t){t.preventDefault(),this.sections.forEach(e=>e.classList.remove("active")),this.hideMainTabs(),this.clubCardContainer&&(this.clubCardContainer.classList.add("hidden"),this.clubCardContainer.parentElement.classList.add("max-md:hidden")),this.navContainer.classList.add("max-sm:hidden"),this.pointsSection.classList.add("active"),this.currentNavItem&&this.currentNavItem.classList.add("hidden-active")}handleBackButton(){if(this.pointsSection.classList.remove("active"),this.navContainer.classList.remove("max-sm:hidden"),this.clubCardContainer&&(this.clubCardContainer.classList.remove("hidden"),this.clubCardContainer.parentElement.classList.remove("max-md:hidden")),this.currentNavItem){const e=this.currentNavItem;e.classList.remove("hidden-active"),e.classList.add("active")}this.currentSection&&this.currentSection.classList.add("active");const t=this.currentNavItem&&"dataset"in this.currentNavItem?this.currentNavItem.dataset.target:null;t==="account-overview"||t==="manage-subscription"?this.showMainTabs():t!==null&&this.hideMainTabs()}activateDefaultTab(){const t=this.navItems[0],e=t?t.dataset.target:null;if(t&&e){t.classList.add("active");const i=Array.from(this.sections).find(a=>a.id===e);i&&(i.classList.add("active"),this.currentSection=i),this.currentNavItem=t}}hideMainTabs(){this.sections.forEach(t=>{t.classList.contains("tabs__HiddenSection")||t.parentElement.classList.add("mainSection--hidden")})}showMainTabs(){this.sections.forEach(t=>{t.classList.contains("tabs__HiddenSection")||t.parentElement.classList.remove("mainSection--hidden")})}generateTargetId(t,e){const i=t[t.length-1]||"",a=t[t.length-2]||"";let s=a&&i?`${a}-${i}`:i||a;return e&&(s=s?`${s}-${e}
1`:e),s.replace(/[^a-zA-Z0-9-]/g,"").toLowerCase()}}customElements.get("club-nav")||customElements.define("club-nav",v);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.