(function() {
function t_throttle(t, e, n) {
var o, r;
return e || (e = 250),
function() {
var c = n || this,
u = +new Date,
l = arguments;
o && u < o + e ? (clearTimeout(r), r = setTimeout(function() {
o = u, t.apply(c, l)
}, e)) : (o = u, t.apply(c, l))
}
}
function t_menusub_updateSectionsOffsets(t) {
Array.prototype.forEach.call(t, function(t) {
t.setAttribute("data-offset-top", t.offsetTop)
});
let e = document.querySelectorAll('[data-record-type="215"]');
Array.prototype.forEach.call(e, function(t) {
t.setAttribute("data-offset-top", t.offsetTop)
})
}
function t_menusub_highlightNavLinks(t, e, n, o) {
var r = window.pageYOffset,
c = o,
u = 0;
return e.length && (u = e[0].getAttribute("data-offset-top")), e.length && null === o && r + 300 < +u ? (Array.prototype.forEach.call(t, function(t) {
t.parentNode.classList.contains("tn-atom") ? t.parentNode.classList.remove("t-active") : t.classList.remove("t-active")
}), null) : (Array.prototype.forEach.call(e, function(u, l, i) {
var a = u.getAttribute("data-offset-top"),
s = null != e[l + 1] ? e[l + 1].getAttribute("data-offset-top") : 0,
m = u.id,
d = n[m];
u = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
return a < s && s <= r ? null : ((a <= r + 300 || e[0].id === m && r >= u - window.innerHeight) && (null !== o || (d.classList.contains("t-active") || d.parentNode.classList.contains("t-active")) ? null !== o && m === o && (c = null) : (Array.prototype.forEach.call(t, function(t) {
t.parentNode.classList.contains("tn-atom") ? t.parentNode.classList.remove("t-active") : t.classList.remove("t-active")
}), d.parentNode.classList.contains("tn-atom") ? d.parentNode.classList.add("t-active") : d.classList.add("t-active"))), !1)
}), c)
}
function t_menusub_catchScroll(t) {
var e, n, o = null,
r = [],
c = [],
u = [],
x = '';
Array.prototype.forEach.call(t, function(t) {
u.push(t)
}), Array.prototype.forEach.call(u, function(t) {
var isShiftDown = false;
if (window.nlm009FixMenuTop && isShiftDown) {
var myZoom = 1;
if (window.nlm009FixMenuBottom) {
var menuBlk = document.querySelector("#" + window.nlm009FixMenuTop);
} else {
var menuBlk = document.querySelector("#rec493197482");
}
if (navigator.userAgent.indexOf("Firefox") != -1 ) {
let scaleWrapper = menuBlk.querySelector(".tn-atom__scale-wrapper");
if (scaleWrapper) {
myZoom = scaleWrapper.style.transform.replace(/[^0-9,.]/g,"");
let int2 = setInterval(function() {
scaleWrapper = menuBlk.querySelector(".tn-atom__scale-wrapper");
let z1 = scaleWrapper.style.transform.replace(/[^0-9,.]/g,"");
if (z1 != myZoom) {
myZoom = scaleWrapper.style.transform.replace(/[^0-9,.]/g,"");
}
}, 100);
}
} else {
if (menuBlk.style.zoom != "") {
myZoom = menuBlk.style.zoom;
let int2 = setInterval(function() {
let z1 = menuBlk.style.zoom;
if (z1 != myZoom) {
myZoom = menuBlk.style.zoom;
}
}, 10);
}
}
}
var e = t_menusub_getSectionByHref(t);
e && e.length && Array.prototype.forEach.call(e, function(e) {
e.id && r.push(e), c[e.id] = t
}), t.parentNode.classList.contains("tn-atom") ? x = t.parentNode : x = t, x.addEventListener("click", function(e) {
e.preventDefault();
let linkHref = t.getAttribute("href");
if (linkHref.includes('#rec')) {
var block = document.querySelector(t.getAttribute("href"));
} else {
var block = document.querySelector(`[data-record-type="215"] a[name="${linkHref.replace('#','')}"]`);
}
if (window.nlm009FixMenuTop && isShiftDown) {
var fromTop = block.offsetTop - menuBlk.offsetHeight*myZoom - menuBlk.offsetTop;
} else {
var fromTop = block.offsetTop;
}
window.scrollTo({
top: [fromTop],
behavior: "auto"
});
var e;
Array.prototype.forEach.call(u, function(t) {
t.parentNode.classList.contains("tn-atom") ? t.parentNode.classList.remove("t-active") : t.classList.remove("t-active")
}), t.classList.contains("tooltipstered") || (t.parentNode.classList.contains("tn-atom") ? t.parentNode.classList.remove("t-active") : t.classList.remove("t-active"), (e = t_menusub_getSectionByHref(t)) && e.length && Array.prototype.forEach.call(e, function(t) {
c[t.id].parentNode.classList.contains("tn-atom") ? c[t.id].parentNode.classList.add("t-active") : c[t.id].classList.add("t-active"), o = t.id
}))
})
}), window.addEventListener("resize", t_throttle(function() {
t_menusub_updateSectionsOffsets(r)
})), setTimeout(function() {
t_menusub_updateSectionsOffsets(r), t_menusub_highlightNavLinks(u, r, c, o)
}, 1e3), window.addEventListener("scroll", t_throttle(function() {
var t = (new Date).getTime();
e && t < e + 100 ? (clearTimeout(n), n = setTimeout(function() {
e = t, o = t_menusub_highlightNavLinks(u, r, c, o)
}, 100 - (t - e))) : (e = t, o = t_menusub_highlightNavLinks(u, r, c, o))
}))
}
function t_menusub_getSectionByHref(t) {
var e = "";
(o = t.getAttribute("href")) && (e = o.replace(/\s+/g, "").substring(1));
var n, o;
t = document.querySelectorAll('.r[id="' + e + '"]');
return (o = document.querySelectorAll('.r[data-record-type="215"]')).length && ((o = document.querySelectorAll('.r[data-record-type="215"] a[name="' + e + '"]')).length > 0 && (n = o[0].parentNode.id, o = n = document.querySelectorAll('.r[id="' + n + '"]'))), 1 === t.length ? t : 1 === o.length && n ? o : void 0
}
function t_menusub_checkAnchorLinks2(t) {
var e = document.querySelectorAll("#rec" + t + ' .menu a:not(.tooltipstered)[href*="#"]');
(e = sortHrefs(e)).length > 0 && t_menusub_catchScroll(e)
}
function sortHrefs(e) {
let t = e,
r = t,
l = document.querySelectorAll(".t-rec");
for (let e = 0; e < t.length; e++) {
let u = t[e].getAttribute("href").replace("#", ""),
c = (document.querySelectorAll('.r[id="' + u + '"]'), document.querySelectorAll('.r[data-record-type="215"] a[name="' + u + '"]'));
c.length > 0 && (u = c[0].parentNode.getAttribute("id")), document.querySelectorAll(".t-rec").forEach(function(r, l) {
r.id == u && t[e].setAttribute("nolim-menu-hook", l)
});
for (let u = 0; u < l.length; u++) "215" == l[u].getAttribute("data-record-type") && l[u].children[0].getAttribute("name") == t[e].getAttribute("href").replace("#", "") && document.querySelectorAll('.r[data-record-type="215"] a[name="' + t[e].getAttribute("href").replace("#", "") + '"]').length > 0 && (r[u] = t[e].getAttribute("href")), "215" != l[u].getAttribute("data-record-type") && l[u].id == t[e].getAttribute("href").replace("#", "") && document.querySelector("#" + t[e].getAttribute("href").replace("#", "")).length > 0 && (r[u] = t[e].getAttribute("href"))
}
for (let e = (r = [].slice.call(r)).length; e + 1 > 1; e--) {
let t = r[e - 1].getAttribute("href").replace("#", ""),
l = document.querySelectorAll('.r[id="' + t + '"]'),
u = document.querySelectorAll('.r[data-record-type="215"] a[name="' + t + '"]');
l.length > 0 || u.length > 0 || r.splice(e - 1, 1)
}
return r = (r = [].slice.call(r).sort(function(e, t) {
return Number(e.getAttribute("nolim-menu-hook").replace("#rec", "")) < Number(t.getAttribute("nolim-menu-hook").replace("#rec", "")) ? -1 : Number(e.getAttribute("nolim-menu-hook").replace("#rec", "")) > Number(t.getAttribute("nolim-menu-hook").replace("#rec", "")) ? 1 : 0
})).filter(e => null !== e)
}
function t_menusub_highlight() {
var t = window.location.href,
e = window.location.pathname;
Array.prototype.forEach.call([t, e], function(t) {
"/" === t[t.length - 1] && (t = t.slice(0, -1))
}), "/" === e.charAt(0) && (e = e.slice(1)), "" === e && (e = "/"), e = '.menu a[href="' + t + '"], .menu a[href="' + t + '/"], .menu a[href="' + e + '"], .menu a[href="/' + e + '"], .menu a[href="' + e + '/"], .menu a[href="/' + e + '/"]', e = document.querySelectorAll(e), Array.prototype.forEach.call(e, function(t) {
t.parentNode.classList.contains("tn-atom") ? t.parentNode.classList.add("t-active") : t.classList.add("t-active")
})
}
function t_ready(t) {
"loading" != document.readyState ? t() : document.addEventListener ? document.addEventListener("DOMContentLoaded", t) : document.attachEvent("onreadystatechange", function() {
"loading" != document.readyState && t()
})
}
t_ready(function() {
window.nlm015block493197482 = true;
let t = setInterval(function() {
document.querySelectorAll(".t-rec").length > 0 && document.querySelectorAll(".menu .tn-atom").length > 0 && (clearInterval(t), t_menusub_highlight(), t_menusub_checkAnchorLinks2("493197482"))
}, 50)
});
}());