/**
* Mobile-optimized image popup on page load (two stacked, centered images).
*/
(function () {
'use strict';
var IMAGE_SRC_1 = 'https://d2j6dbq0eux0bg.cloudfront.net/images/115213540/products/739876155/5984064303.jpg';
var IMAGE_SRC_2 = 'https://d2j6dbq0eux0bg.cloudfront.net/images/115213540/products/739876155/5984107169.jpg';
var IMAGE_ALT = 'Announcement';
var STORAGE_KEY = 'wlc-popup-dismissed';
var SHOW_ONCE_PER_SESSION = true;
if (SHOW_ONCE_PER_SESSION && sessionStorage.getItem(STORAGE_KEY)) {
return;
}
var style = document.createElement('style');
style.textContent = [
'.wlc-popup-overlay{',
'position:fixed;inset:0;z-index:99999;',
'display:flex;align-items:center;justify-content:center;',
'padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));',
'background:rgba(0,0,0,.72);',
'-webkit-tap-highlight-color:transparent;',
'opacity:0;transition:opacity .2s ease;',
'}',
'.wlc-popup-overlay.is-open{opacity:1;}',
'.wlc-popup{',
'position:relative;',
'width:var(--wlc-w,min(92vw,520px));',
'max-width:calc(100vw - 24px);',
'max-height:var(--wlc-h,min(88vh,88dvh));',
'border-radius:12px;background:#111;',
'box-shadow:0 16px 48px rgba(0,0,0,.35);',
'overflow:auto;-webkit-overflow-scrolling:touch;',
'transform:scale(.96);transition:transform .2s ease,width .15s ease;',
'}',
'.wlc-popup-overlay.is-open .wlc-popup{transform:scale(1);}',
'.wlc-popup__imgs{',
'display:flex;flex-direction:column;align-items:center;justify-content:center;',
'width:100%;gap:10px;padding:12px 8px;box-sizing:border-box;',
'}',
'.wlc-popup__img{',
'display:block;width:100%;max-width:100%;height:auto;',
'margin:0 auto;object-fit:contain;',
'}',
'.wlc-popup__close{',
'position:sticky;top:8px;float:right;margin:8px 8px 0 0;z-index:2;',
'width:44px;height:44px;padding:0;border:0;border-radius:999px;',
'background:rgba(0,0,0,.55);color:#fff;font-size:28px;line-height:1;',
'cursor:pointer;display:flex;align-items:center;justify-content:center;',
'-webkit-appearance:none;appearance:none;',
'}',
'.wlc-popup__close:focus-visible{outline:2px solid #fff;outline-offset:2px;}'
].join('');
document.head.appendChild(style);
function viewportSize() {
var vv = window.visualViewport;
return {
w: (vv && vv.width) || window.innerWidth,
h: (vv && vv.height) || window.innerHeight
};
}
function calcWidth(vw) {
if (vw >= 1400) return Math.min(vw * 0.62, 1100);
if (vw >= 1024) return Math.min(vw * 0.68, 960);
if (vw >= 768) return Math.min(vw * 0.78, 760);
return Math.min(vw * 0.92, vw - 24);
}
function sizePopup(popup) {
var v = viewportSize();
var pad = 24;
var w = Math.max(260, Math.min(calcWidth(v.w), v.w - pad));
var h = Math.max(200, v.h - pad);
popup.style.setProperty('--wlc-w', w + 'px');
popup.style.setProperty('--wlc-h', h + 'px');
}
var overlay = document.createElement('div');
overlay.className = 'wlc-popup-overlay';
overlay.setAttribute('role', 'dialog');
overlay.setAttribute('aria-modal', 'true');
overlay.setAttribute('aria-label', IMAGE_ALT);
overlay.innerHTML =
'';
var popup = overlay.querySelector('.wlc-popup');
var imgs = overlay.querySelectorAll('.wlc-popup__img');
var closeBtn = overlay.querySelector('.wlc-popup__close');
var previousOverflow = '';
function lockScroll() {
previousOverflow = document.body.style.overflow;
document.body.style.overflow = 'hidden';
}
function unlockScroll() {
document.body.style.overflow = previousOverflow;
}
var resizeTimer;
function onResize() {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () { sizePopup(popup); }, 50);
}
function close() {
overlay.classList.remove('is-open');
unlockScroll();
if (SHOW_ONCE_PER_SESSION) {
sessionStorage.setItem(STORAGE_KEY, '1');
}
window.removeEventListener('resize', onResize);
window.removeEventListener('orientationchange', onResize);
if (window.visualViewport) {
window.visualViewport.removeEventListener('resize', onResize);
}
setTimeout(function () {
if (overlay.parentNode) overlay.parentNode.removeChild(overlay);
}, 200);
document.removeEventListener('keydown', onKey);
}
function onKey(e) {
if (e.key === 'Escape') close();
}
closeBtn.addEventListener('click', function (e) {
e.stopPropagation();
close();
});
overlay.addEventListener('click', function (e) {
if (e.target === overlay) close();
});
document.addEventListener('keydown', onKey);
function open() {
sizePopup(popup);
for (var i = 0; i < imgs.length; i++) {
imgs[i].onload = function () { sizePopup(popup); };
}
window.addEventListener('resize', onResize);
window.addEventListener('orientationchange', onResize);
if (window.visualViewport) {
window.visualViewport.addEventListener('resize', onResize);
}
document.body.appendChild(overlay);
lockScroll();
requestAnimationFrame(function () {
overlay.classList.add('is-open');
closeBtn.focus();
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', open);
} else {
open();
}
})();