
/* eslint-disable camelcase */
!function (i, r) {
var e, c, t, o, d, s;
function a(e, n, l, i) {
return u(e).map(function (e) {
var t = e.closest(i);
if (t) {
var o = t.querySelector(n);
if (o) {
var a = u(l, o);
if (0 !== a.length) return {container: t, article: o, childs: a, shuttle: e};
console.warn("[Taboola Mid Widget] Group childs length is 0.")
} else console.log("[Taboola Mid Widget] Group article not found.")
} else console.log("[Taboola Mid Widget] Group container not found.")
}).filter(function (e) {
return e.container && e.article && e.childs && 0 < e.childs.length && !function (e) {
if ((o = e.childs.filter(function (e) {
return "p" === e.tagName.toLowerCase()
})).length <= 2) return 1;
var t = e.childs[o.length - 1], o = e.childs[o.length - 2];
return !t || !o || "P" !== t.tagName || "P" !== o.tagName
}(e)
})
}
function n(e, t) {
var o, a = t.article, n = t.childs, l = t.shuttle;
l && a && l ? (o = a, l.classList.contains(c) || o.querySelector("." + d) ? console.log("[Taboola Mid Widget] Taboola mid widget already loaded.") : (t = n[e]) ? (a = function (e, t) {
if (t && e) {
t = e.getAttribute(t);
return t && "true" === t.toLowerCase()
}
}(l, "data-ue-is-mobile"), o = Date.now(), "object" == typeof (o = (n = o, e = a, l = r.createElement("div"), (o = r.createElement("div")).id = "taboola-" + (e ? "mobile-" : "") + "mid-article-mca-oc-" + n, o.classList.add(d), l.classList.add(s), l.style.overflow = "hidden", l.appendChild(o), {
container: l,
target: o
})) && o.container && o.target ? (t.insertAdjacentElement("beforebegin", o.container), o = o.target && o.target.id, a = a, o ? "boolean" == typeof a ? (i._taboola = i._taboola || [], a ? i._taboola.push({
mode: "organic-thumbnails-m-1x2",
container: o,
placement: "Mobile-Mid Article-MCA-OC",
target_type: "mix"
}) : i._taboola.push({
mode: "organic-thumbnails-d-2x1",
container: o,
placement: "Mid Article-MCA-OC",
target_type: "mix"
})) : console.warn("[Taboola Mid Widget] Unexpected value: isMobile type must be boolean.") : console.warn("[Taboola Mid Widget] Unexpected value: containerId must be truly.")) : console.warn("[Taboola Mid Widget] Unexpected value: container and target must be truly.")) : console.warn("[Taboola Mid Widget] Unexpected value: Position match no child.")) : console.warn("[Taboola Mid Widget] Unexpected value: shuttle, article and shuttle must be truly.")
}
function l() {
o.includes(i.ueDataLayer && i.ueDataLayer.marca_edition) || (a(t, e, ".ue-c-article__body > p", '.ue-l-article__body[data-section="articleBody"]') || []).forEach(function (e) {
n(e.childs.length - 2, e), e.shuttle.classList.add(c)
})
}
function u(e, t) {
return Array.prototype.map.call((t || r).querySelectorAll(e), function (e) {
return e
})
}
i.__taboolaMidRunning || (i.__taboolaMidRunning = !0, e = ".ue-c-article__body", t = "hr.taboola-art-mid-script:not(." + (c = "taboola-done") + ")", o = ["mexico"], d = "taboola-mid-article-widget", s = "midwidget-taboola", Element.prototype.matches || (Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector), Element.prototype.closest || (Element.prototype.closest = function (e) {
var t = this;
do {
if (Element.prototype.matches.call(t, e)) return t
} while (null !== (t = t.parentElement || t.parentNode) && 1 === t.nodeType);
return null
}), r.addEventListener("nc-urlChanged", function (e) {
l()
}), "loading" !== r.readyState ? l() : i.addEventListener("DOMContentLoaded", function () {
l()
}))
}(window, document);