(function (root, factory) { if (typeof module === 'object' && module.exports) { module.exports = factory(root); return; } root.AppPromotionPages = factory(root); if (root.document) { root.document.addEventListener('DOMContentLoaded', function () { root.AppPromotionPages.init(); }); } })(typeof globalThis !== 'undefined' ? globalThis : window, function (root) { 'use strict'; function escapeHtml(value) { return String(value === undefined || value === null ? '' : value) .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } function normalizeId(value) { var normalized; if (typeof value === 'number' && !Number.isSafeInteger(value)) return ''; if (value === undefined || value === null) return ''; normalized = String(value).trim(); return /^[1-9][0-9]*$/.test(normalized) ? normalized : ''; } function text(value) { return value === undefined || value === null ? '' : String(value).trim(); } function normalizeTargetUrl(value) { var normalized = text(value); var parsed; if (!normalized) return ''; try { parsed = new URL(normalized); } catch (error) { return ''; } return parsed.protocol === 'http:' || parsed.protocol === 'https:' ? parsed.href : ''; } function normalizePromotion(item) { var source = item || {}; var promotionId = normalizeId(source.promotionId); var promotionTitle = text(source.promotionTitle); if (!promotionId || !promotionTitle || String(source.status) !== '0') return null; return { promotionId: promotionId, promotionTitle: promotionTitle, promotionDesc: text(source.promotionDesc), targetUrl: normalizeTargetUrl(source.targetUrl) }; } function normalizePromotionList(data) { var items; if (!Array.isArray(data)) return []; items = data.map(normalizePromotion); return items.some(function (item) { return !item; }) ? [] : items; } function renderPromotionCard(item) { var content = '
' + escapeHtml(item.promotionDesc) + '