/*! Fiesta 1.1.0 | MPL-2.0 | https://fiesta.rastrillo.org */ (function () { "use strict"; if (window.CSS && CSS.supports && CSS.supports("position-area: block-end") && CSS.supports("position-try-fallbacks: flip-block")) return; document.documentElement.setAttribute("data-rst-flip-menus", ""); var DROPDOWN = "[rst-dropdown],.rst-dropdown"; var PANEL = ":scope > [rst-dropdown-menu], :scope > .rst-dropdown__menu"; var open = []; function overflow(r, w) { return Math.max(0, -r.left) + Math.max(0, r.right - w); } function place(d) { var p = d.querySelector(PANEL), w, before; if (!p || getComputedStyle(p).position !== "absolute") return; d.classList.remove("is-flip-inline"); w = document.documentElement.clientWidth; before = overflow(p.getBoundingClientRect(), w); if (!before) return; d.classList.add("is-flip-inline"); if (overflow(p.getBoundingClientRect(), w) >= before) d.classList.remove("is-flip-inline"); } function replace() { open = open.filter(function (d) { return d.open && d.isConnected; }); open.forEach(place); if (!open.length) removeEventListener("resize", replace); } document.addEventListener("toggle", function (e) { var d = e.target; if (!d.matches || !d.matches(DROPDOWN)) return; if (!d.open) return replace(); place(d); if (open.indexOf(d) < 0) open.push(d); addEventListener("resize", replace, { passive: true }); }, true); })();