(() => { // s3Upload/public/syrenis-cookie-management.js function cookieBanner() { "use strict"; const config = { CASSIE_LICENSE_KEY: "6476D512-4F79-450F-BBD3-B0EABC431A02", CASSIE_ENV: "production", CASSIE_PROFILE_ID: "8", LOCATE_API_URL: "https://api.llycw.com/locate", GREEN_ICON_URL: "https://llycw.com/public/green_tick.svg", BLACK_LISTED_STATES: "WA,NV" }; function cookieBannerConfig() { const url = window.location.toString().toLowerCase(); const langAttribute = document.documentElement.lang; let sLang = ""; if (url.endsWith("/es") || url.includes("/es/") || langAttribute === "es") { sLang = "es-US"; } function getRootDomain(url2) { try { const domain = new URL(url2).hostname; const elems = domain.split("."); const iMax = elems.length - 1; const isSecondLevel = elems.length >= 3 && (elems[iMax] + elems[iMax - 1]).length <= 5; return elems.splice(isSecondLevel ? -3 : -2).join("."); } catch (error) { return null; } } function loadScript(src, onSuccess, onError) { const script = document.createElement("script"); script.src = src; script.onload = () => { if (onSuccess) onSuccess(); }; script.onerror = () => { if (onError) onError(); }; document.head.appendChild(script); } function initCassieWidget() { const cassieSettings = { widgetProfileId: config.CASSIE_PROFILE_ID, languageCode: sLang, licenseKey: config.CASSIE_LICENSE_KEY, region: "use", environment: config.CASSIE_ENV, crossDomainConsent: true }; window.CassieWidgetLoader = new CassieWidgetLoaderModule(cassieSettings); } function loadScriptWithFallback() { const rootDomain = getRootDomain(window.location.href); const currentTime = Date.now(); const scriptUrl = rootDomain ? `https://cscript-cdn-use.${rootDomain}/loader.js?${currentTime}` : `https://cscript-cdn-use.lilly.com/loader.js?${currentTime}`; loadScript(scriptUrl, () => { window.cassieResourceRootDomain = rootDomain; initCassieWidget(); }, () => { loadScript(`https://cscript-cdn-use.lilly.com/loader.js?${currentTime}`, () => { initCassieWidget(); }); }); } loadScriptWithFallback(); } function disableContent() { document.addEventListener("CassieTemplateInitialized", () => { document.body.style = null; document.querySelector("HTML").style = null; document.querySelector(".cassie-cookie-module").classList.add("cassie-d-none"); }); document.addEventListener("CassieModalVisibility", () => { const switchText = document.getElementsByClassName("cassie-cookie-group--toggle-switch--status"); const url = window.location.toString().toLowerCase(); const langAttribute = document.documentElement.lang; const switchTextValue = url.endsWith("/es") || url.includes("/es/") || langAttribute === "es" ? "Deshabilitar" : "Off"; for (let i = 0; i < switchText.length; i++) { switchText[i].innerText = switchTextValue; } const toggles = document.getElementsByClassName("cassie-toggle-switch--slider"); for (let i = 0; i < toggles.length; i++) { toggles[i].classList.remove("cassie-toggle-switch--slider--active"); } const cassieAcceptAllToggleSwitch = document.getElementsByClassName("cassie-toggle-switch"); for (let i = 0; i < cassieAcceptAllToggleSwitch.length; i++) { cassieAcceptAllToggleSwitch[i].classList.add("cassie-toggle-switch-state"); } const paragraph = document.getElementById("locationText"); paragraph.style.display = "block"; const savePreference = document.getElementById("cassie_save_preferences"); savePreference.disabled = true; savePreference.style.backgroundColor = "#f5f5f5"; savePreference.style.borderColor = "#bdbdbd"; savePreference.style.boxShadow = "none"; savePreference.style.color = "#bdbdbd"; savePreference.style.cursor = "not-allowed"; }); } function checkRegion() { fetch(config.LOCATE_API_URL).then((response) => response.json()).then((data) => { const bls = config?.BLACK_LISTED_STATES?.split(","); const isBlackListed = bls?.includes(data?.state); if (isBlackListed) { document.addEventListener("CassieTemplateInitialized", () => { CassieWidgetLoader.Widget.rejectAll("prebanner_reject_all"); CassieWidgetLoader.Widget.hideModal(); CassieWidgetLoader.Widget.hideBanner(); }); document.cookie = "consent_adv_and_mark=false; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; document.cookie = "consent_func_cookie=false; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; document.cookie = "consent_performance=false; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; disableContent(); } else { console.log("NRS"); } }).catch((error) => { console.log("Not able to fetch the state data.", error); }).finally(() => { addWidgetListeners(); cookieBannerConfig(); }); } function cookieBannerFooterLink() { document.addEventListener("CassieModalVisibility", () => { const cancelButton = document.createElement("BUTTON"); const savePreference = document.getElementById("cassie_save_preferences"); const url = window.location.toString().toLowerCase(); const langAttribute = document.documentElement.lang; const cancelButtonText = url.endsWith("/es") || url.includes("/es/") || langAttribute === "es" ? "Cancelar" : "Cancel"; cancelButton.innerHTML = cancelButtonText; cancelButton.classList.add("cassie-cookie-modal--cancel-preferences"); cancelButton.setAttribute("id", "cancelId"); savePreference.after(savePreference.appendChild(cancelButton)); document.addEventListener("click", function(event) { if (event.target.id === "cancelId") { event.preventDefault(); if (CassieWidgetLoader.Widget.hasConsent() === false) { CassieWidgetLoader.Widget.showBanner(); } else { CassieWidgetLoader.Widget.hideModal(); } } }); }); document.addEventListener("click", function(event) { if (event.target.tagName === "A" && event.target.getAttribute("href")) { const url = new URL(event.target.href); const isCookieSettings = url.pathname === "/cookie-settings"; if (isCookieSettings) { event.preventDefault(); if (typeof CassieWidgetLoader !== "undefined" && typeof CassieWidgetLoader.Widget !== "undefined" && typeof CassieWidgetLoader.Widget.showModal === "function") { CassieWidgetLoader.Widget.showModal(); } } } }); } function cookieBannerFilesLoaded() { document.addEventListener("CassieTemplateFilesLoaded", () => { const viewMoreButton = document.getElementById("viewMore"); if (viewMoreButton !== null) { viewMoreButton.addEventListener("click", textExpand); } function getCookieValue(name) { let cookies = document.cookie.split("; "); for (let cookie of cookies) { let [key, value] = cookie.split("="); if (key === name) return value; } return null; } let consent_adv_and_mark = getCookieValue("consent_adv_and_mark"); let consent_performance = getCookieValue("consent_performance"); if (consent_adv_and_mark === "false") { let deleteCookie = function(cname) { var d = /* @__PURE__ */ new Date(); d.setTime(d.getTime() - 1e3 * 60 * 60 * 48); var expires = "Expires=" + d.toGMTString(); var host = window.location.host.split(".").splice(-2); var subHost = "." + host[0] + "." + host[1]; window.document.cookie = cname + "=; Path=/; " + expires + "=;Domain=" + subHost; }; ; deleteCookie("_gcl_au"); deleteCookie("everest_g_v2"); } if (consent_performance === "false") { let deleteCookie = function(cname) { var d = /* @__PURE__ */ new Date(); d.setTime(d.getTime() - 1e3 * 60 * 60 * 48); var expires = "Expires=" + d.toGMTString(); var host = window.location.host.split(".").splice(-2); var subHost = "." + host[0] + "." + host[1]; window.document.cookie = cname + "=; Path=/; " + expires + "=;Domain=" + subHost; }, delGat = function() { var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i].trim(); if (cookie.startsWith("_ga") || cookie.startsWith("_gat") || cookie.startsWith("_gat_gtag_UA_")) { var cookieName = cookie.split("=")[0]; var domain = window.location.hostname; var domainParts = domain.split("."); var topLevelDomain = domainParts.slice(-2).join("."); document.cookie = cookieName + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=." + topLevelDomain; } } }; ; deleteCookie("_ga"); deleteCookie("_gid"); delGat(); } const hostname = window.location.hostname; const containsTopDomain = hostname.includes(".lilly.com"); if (containsTopDomain) { let getCookies = function() { const cookies2 = document.cookie.split("; "); const cookieObject = {}; cookies2.forEach((cookie) => { const [name, value] = cookie.split("="); cookieObject[name] = value; }); return cookieObject; }, deleteCookie = function(name) { const domainParts = hostname.split("."); let domainsToTry = []; for (let i = 0; i < domainParts.length - 1; i++) { domainsToTry.push("." + domainParts.slice(i).join(".")); } domainsToTry.push("." + domainParts.slice(-2).join(".")); domainsToTry.forEach((domain) => { if (domain !== ".lilly.com") { document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${domain}`; } }); }; ; const cookies = getCookies(); for (const cookie in cookies) { if (cookies.hasOwnProperty(cookie) && (cookie.startsWith("consent_adv_and_mark") || cookie.startsWith("consent_func_cookie") || cookie.startsWith("consent_performance"))) { deleteCookie(cookie); } } } else { (function deleteConsentCookies() { const currentDomain = window.location.hostname; const cookies = document.cookie.split(";"); const domainParts = currentDomain.split("."); const possibleDomains = domainParts.map((_, index) => { return "." + domainParts.slice(index).join("."); }); cookies.forEach((cookie) => { const [cookieName] = cookie.split("=").map((c) => c.trim()); if (cookieName.startsWith("consent_adv_and_mark") || cookieName.startsWith("consent_func_cookie") || cookieName.startsWith("consent_performance")) { let cookieDeleted = false; possibleDomains.forEach((domain) => { if (!currentDomain.endsWith(domain)) { document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${domain}`; cookieDeleted = true; } }); if (!cookieDeleted) { console.log(`Skipping cookie: ${cookieName} (matches current domain)`); } } }); })(); } function deleteCookies() { const cookiesToDelete = ["consent_adv_and_mark", "consent_func_cookie", "consent_performance"]; const allCookies = document.cookie.split(";"); allCookies.forEach((cookie) => { const [name] = cookie.split("=").map((c) => c.trim()); if (cookiesToDelete.includes(name) && !name.startsWith(".")) { document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;`; } }); } deleteCookies(); }); } function tabEventHandler(event) { if (event.key === "Tab") { event.preventDefault(); const interactiveElements = document.querySelectorAll("#mobContent a, #userToDecline, #cassie_accept_all_pre_banner, #cassie_reject_all_pre_banner, .cassie-view-all"); const currentElement = document.activeElement; const currentIndex = Array.from(interactiveElements).indexOf(currentElement); const nextIndex = event.shiftKey ? (currentIndex - 1 + interactiveElements.length) % interactiveElements.length : (currentIndex + 1) % interactiveElements.length; interactiveElements[nextIndex].focus(); } } function tabEventHandlerModal(event) { if (event.key === "Tab") { event.preventDefault(); const interactiveElements = document.querySelectorAll("#cassie_header_content a, #cassie_cookie_group_toggle_switch_9053, #cassie_cookie_group_toggle_switch_9051, #cassie_cookie_group_toggle_switch_9052, #cassie_save_preferences, #cancelId"); const currentElement = document.activeElement; const currentIndex = Array.from(interactiveElements).indexOf(currentElement); const nextIndex = event.shiftKey ? (currentIndex - 1 + interactiveElements.length) % interactiveElements.length : (currentIndex + 1) % interactiveElements.length; interactiveElements[nextIndex].focus(); } } function alwaysOn() { document.addEventListener("CassieTemplateInitialized", () => { if (CassieWidgetLoader.Widget.hasConsent() === false) { document.addEventListener("keydown", tabEventHandler); document.removeEventListener("keydown", tabEventHandlerModal); } else { document.removeEventListener("keydown", tabEventHandler); } document.addEventListener("CassieModalVisibility", (e) => { const visible = e.detail; if (visible) { document.addEventListener("keydown", tabEventHandlerModal); document.removeEventListener("keydown", tabEventHandler); } else { document.removeEventListener("keydown", tabEventHandlerModal); } }); document.addEventListener("CassieBannerVisibility", (e) => { const visible = e.detail; if (visible) { document.addEventListener("keydown", tabEventHandler); document.removeEventListener("keydown", tabEventHandlerModal); } else { document.removeEventListener("keydown", tabEventHandler); } }); const alwaysOnDiv = document.createElement("div"); alwaysOnDiv.setAttribute("id", "always-active"); const activeText = document.createElement("p"); activeText.setAttribute("id", "always-active-p"); const url = window.location.toString().toLowerCase(); const langAttribute = document.documentElement.lang; const activeTextValue = url.endsWith("/es") || url.includes("/es/") || langAttribute === "es" ? "Siempre Habilitadas" : "Always On"; activeText.textContent = activeTextValue; activeText.setAttribute("style", "font-size: 12px; font-family: Roboto;"); const icon = document.createElement("img"); icon.setAttribute("src", config.GREEN_ICON_URL); icon.setAttribute("height", "20"); icon.setAttribute("width", "20"); icon.setAttribute("id", "always-active-icon"); alwaysOnDiv.appendChild(activeText); alwaysOnDiv.appendChild(icon); const parentDiv = document.getElementById("cassie_expand_strictly_necessary"); parentDiv.insertAdjacentElement("afterend", alwaysOnDiv); alwaysOnDiv.style.display = "flex"; alwaysOnDiv.style.whiteSpace = "nowrap"; icon.style.marginLeft = "5px"; alwaysOnDiv.style.marginRight = "10px"; alwaysOnDiv.style.marginTop = "10px"; }); } function sliderGpcPreInitialized() { document.addEventListener("CassieTemplateInitialized", () => { document.getElementById("cookieSettings").addEventListener("click", (event) => { event.preventDefault(); CassieWidgetLoader.Widget.showModal(); }); document.getElementById("userToDecline").addEventListener("click", (event) => { event.preventDefault(); CassieWidgetLoader.Widget.rejectAll("prebanner_reject_all"); CassieWidgetLoader.Widget.hideModal(); CassieWidgetLoader.Widget.hideBanner(); }); if (CassieWidgetLoader.Widget.hasConsent() === false) { const sliderButton = document.getElementById("cassie_accept_all_toggle_slider"); if (sliderButton) { sliderButton.click(); } } document.getElementById("cassie_accept_all_pre_banner").addEventListener("click", () => { if (CassieWidgetLoader.Widget.gpcEnabled) { CassieWidgetLoader.Widget.acceptAll({ respectGpc: true, source: "prebanner_accept_all" }); CassieWidgetLoader.Widget.hideModal(); CassieWidgetLoader.Widget.hideBanner(); } }); document.getElementById("cassie_save_preferences").addEventListener("click", () => { if (CassieWidgetLoader.Widget.gpcEnabled) { CassieWidgetLoader.Widget.acceptAll({ respectGpc: true, source: "save_pref_button" }); CassieWidgetLoader.Widget.hideModal(); CassieWidgetLoader.Widget.hideBanner(); } }); }); } function textExpand(event) { event.preventDefault(); const dots = document.getElementById("dots"); const moreText = document.getElementById("mobContent"); const linkText = document.getElementById("viewMore"); dots.style.display = dots.style.display === "none" ? "inline" : "none"; linkText.innerHTML = dots.style.display === "none" ? "View Less" : "View More"; moreText.style.display = dots.style.display === "none" ? "inline" : "none"; } function addWidgetListeners() { cookieBannerFilesLoaded(); alwaysOn(); sliderGpcPreInitialized(); cookieBannerFooterLink(); } checkRegion(); } cookieBanner(); })();