@govbr-ds/webcomponents
Version:
Biblioteca de Web Components baseado no GovBR-DS
1,676 lines (1,571 loc) • 123 kB
JavaScript
/*!
* Construído por SERPRO
* © https://serpro.gov.br/ - MIT License.
*/
import { r, c as a, g as o, h as t, a as i } from "./p-ClsF4De3.js";
import { H as n } from "./p-BRKK5nMe.js";
/**
* Custom positioning reference element.
* @see https://floating-ui.com/docs/virtual-elements
*/ const e = [ "top", "right", "bottom", "left" ];
const g = Math.min;
const v = Math.max;
const d = Math.round;
const c = Math.floor;
const createCoords = r => ({
x: r,
y: r
});
const b = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
};
const l = {
start: "end",
end: "start"
};
function clamp(r, a, o) {
return v(r, g(a, o));
}
function evaluate(r, a) {
return typeof r === "function" ? r(a) : r;
}
function getSide(r) {
return r.split("-")[0];
}
function getAlignment(r) {
return r.split("-")[1];
}
function getOppositeAxis(r) {
return r === "x" ? "y" : "x";
}
function getAxisLength(r) {
return r === "y" ? "height" : "width";
}
function getSideAxis(r) {
return [ "top", "bottom" ].includes(getSide(r)) ? "y" : "x";
}
function getAlignmentAxis(r) {
return getOppositeAxis(getSideAxis(r));
}
function getAlignmentSides(r, a, o) {
if (o === void 0) {
o = false;
}
const t = getAlignment(r);
const i = getAlignmentAxis(r);
const n = getAxisLength(i);
let e = i === "x" ? t === (o ? "end" : "start") ? "right" : "left" : t === "start" ? "bottom" : "top";
if (a.reference[n] > a.floating[n]) {
e = getOppositePlacement(e);
}
return [ e, getOppositePlacement(e) ];
}
function getExpandedPlacements(r) {
const a = getOppositePlacement(r);
return [ getOppositeAlignmentPlacement(r), a, getOppositeAlignmentPlacement(a) ];
}
function getOppositeAlignmentPlacement(r) {
return r.replace(/start|end/g, (r => l[r]));
}
function getSideList(r, a, o) {
const t = [ "left", "right" ];
const i = [ "right", "left" ];
const n = [ "top", "bottom" ];
const e = [ "bottom", "top" ];
switch (r) {
case "top":
case "bottom":
if (o) return a ? i : t;
return a ? t : i;
case "left":
case "right":
return a ? n : e;
default:
return [];
}
}
function getOppositeAxisPlacements(r, a, o, t) {
const i = getAlignment(r);
let n = getSideList(getSide(r), o === "start", t);
if (i) {
n = n.map((r => r + "-" + i));
if (a) {
n = n.concat(n.map(getOppositeAlignmentPlacement));
}
}
return n;
}
function getOppositePlacement(r) {
return r.replace(/left|right|bottom|top/g, (r => b[r]));
}
function expandPaddingObject(r) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...r
};
}
function getPaddingObject(r) {
return typeof r !== "number" ? expandPaddingObject(r) : {
top: r,
right: r,
bottom: r,
left: r
};
}
function rectToClientRect(r) {
const {x: a, y: o, width: t, height: i} = r;
return {
width: t,
height: i,
top: o,
left: a,
right: a + t,
bottom: o + i,
x: a,
y: o
};
}
function computeCoordsFromPlacement(r, a, o) {
let {reference: t, floating: i} = r;
const n = getSideAxis(a);
const e = getAlignmentAxis(a);
const g = getAxisLength(e);
const v = getSide(a);
const d = n === "y";
const c = t.x + t.width / 2 - i.width / 2;
const b = t.y + t.height / 2 - i.height / 2;
const l = t[g] / 2 - i[g] / 2;
let u;
switch (v) {
case "top":
u = {
x: c,
y: t.y - i.height
};
break;
case "bottom":
u = {
x: c,
y: t.y + t.height
};
break;
case "right":
u = {
x: t.x + t.width,
y: b
};
break;
case "left":
u = {
x: t.x - i.width,
y: b
};
break;
default:
u = {
x: t.x,
y: t.y
};
}
switch (getAlignment(a)) {
case "start":
u[e] -= l * (o && d ? -1 : 1);
break;
case "end":
u[e] += l * (o && d ? -1 : 1);
break;
}
return u;
}
/**
* Computes the `x` and `y` coordinates that will place the floating element
* next to a given reference element.
*
* This export does not have any `platform` interface logic. You will need to
* write one for the platform you are using Floating UI with.
*/ const computePosition$1 = async (r, a, o) => {
const {placement: t = "bottom", strategy: i = "absolute", middleware: n = [], platform: e} = o;
const g = n.filter(Boolean);
const v = await (e.isRTL == null ? void 0 : e.isRTL(a));
let d = await e.getElementRects({
reference: r,
floating: a,
strategy: i
});
let {x: c, y: b} = computeCoordsFromPlacement(d, t, v);
let l = t;
let u = {};
let m = 0;
for (let o = 0; o < g.length; o++) {
const {name: n, fn: s} = g[o];
const {x: k, y: p, data: f, reset: w} = await s({
x: c,
y: b,
initialPlacement: t,
placement: l,
strategy: i,
middlewareData: u,
rects: d,
platform: e,
elements: {
reference: r,
floating: a
}
});
c = k != null ? k : c;
b = p != null ? p : b;
u = {
...u,
[n]: {
...u[n],
...f
}
};
if (w && m <= 50) {
m++;
if (typeof w === "object") {
if (w.placement) {
l = w.placement;
}
if (w.rects) {
d = w.rects === true ? await e.getElementRects({
reference: r,
floating: a,
strategy: i
}) : w.rects;
}
({x: c, y: b} = computeCoordsFromPlacement(d, l, v));
}
o = -1;
}
}
return {
x: c,
y: b,
placement: l,
strategy: i,
middlewareData: u
};
};
/**
* Resolves with an object of overflow side offsets that determine how much the
* element is overflowing a given clipping boundary on each side.
* - positive = overflowing the boundary by that number of pixels
* - negative = how many pixels left before it will overflow
* - 0 = lies flush with the boundary
* @see https://floating-ui.com/docs/detectOverflow
*/ async function detectOverflow(r, a) {
var o;
if (a === void 0) {
a = {};
}
const {x: t, y: i, platform: n, rects: e, elements: g, strategy: v} = r;
const {boundary: d = "clippingAncestors", rootBoundary: c = "viewport", elementContext: b = "floating", altBoundary: l = false, padding: u = 0} = evaluate(a, r);
const m = getPaddingObject(u);
const s = b === "floating" ? "reference" : "floating";
const k = g[l ? s : b];
const p = rectToClientRect(await n.getClippingRect({
element: ((o = await (n.isElement == null ? void 0 : n.isElement(k))) != null ? o : true) ? k : k.contextElement || await (n.getDocumentElement == null ? void 0 : n.getDocumentElement(g.floating)),
boundary: d,
rootBoundary: c,
strategy: v
}));
const f = b === "floating" ? {
x: t,
y: i,
width: e.floating.width,
height: e.floating.height
} : e.reference;
const w = await (n.getOffsetParent == null ? void 0 : n.getOffsetParent(g.floating));
const h = await (n.isElement == null ? void 0 : n.isElement(w)) ? await (n.getScale == null ? void 0 : n.getScale(w)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
};
const y = rectToClientRect(n.convertOffsetParentRelativeRectToViewportRelativeRect ? await n.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: g,
rect: f,
offsetParent: w,
strategy: v
}) : f);
return {
top: (p.top - y.top + m.top) / h.y,
bottom: (y.bottom - p.bottom + m.bottom) / h.y,
left: (p.left - y.left + m.left) / h.x,
right: (y.right - p.right + m.right) / h.x
};
}
/**
* Provides data to position an inner element of the floating element so that it
* appears centered to the reference element.
* @see https://floating-ui.com/docs/arrow
*/ const arrow$1 = r => ({
name: "arrow",
options: r,
async fn(a) {
const {x: o, y: t, placement: i, rects: n, platform: e, elements: v, middlewareData: d} = a;
// Since `element` is required, we don't Partial<> the type.
const {element: c, padding: b = 0} = evaluate(r, a) || {};
if (c == null) {
return {};
}
const l = getPaddingObject(b);
const u = {
x: o,
y: t
};
const m = getAlignmentAxis(i);
const s = getAxisLength(m);
const k = await e.getDimensions(c);
const p = m === "y";
const f = p ? "top" : "left";
const w = p ? "bottom" : "right";
const h = p ? "clientHeight" : "clientWidth";
const y = n.reference[s] + n.reference[m] - u[m] - n.floating[s];
const x = u[m] - n.reference[m];
const A = await (e.getOffsetParent == null ? void 0 : e.getOffsetParent(c));
let O = A ? A[h] : 0;
// DOM platform can return `window` as the `offsetParent`.
if (!O || !await (e.isElement == null ? void 0 : e.isElement(A))) {
O = v.floating[h] || n.floating[s];
}
const C = y / 2 - x / 2;
// If the padding is large enough that it causes the arrow to no longer be
// centered, modify the padding so that it is centered.
const S = O / 2 - k[s] / 2 - 1;
const E = g(l[f], S);
const T = g(l[w], S);
// Make sure the arrow doesn't overflow the floating element if the center
// point is outside the floating element's bounds.
const P = E;
const R = O - k[s] - T;
const z = O / 2 - k[s] / 2 + C;
const L = clamp(P, z, R);
// If the reference is small enough that the arrow's padding causes it to
// to point to nothing for an aligned placement, adjust the offset of the
// floating element itself. To ensure `shift()` continues to take action,
// a single reset is performed when this is true.
const N = !d.arrow && getAlignment(i) != null && z !== L && n.reference[s] / 2 - (z < P ? E : T) - k[s] / 2 < 0;
const D = N ? z < P ? z - P : z - R : 0;
return {
[m]: u[m] + D,
data: {
[m]: L,
centerOffset: z - L - D,
...N && {
alignmentOffset: D
}
},
reset: N
};
}
})
/**
* Optimizes the visibility of the floating element by flipping the `placement`
* in order to keep it in view when the preferred placement(s) will overflow the
* clipping boundary. Alternative to `autoPlacement`.
* @see https://floating-ui.com/docs/flip
*/;
const flip$1 = function(r) {
if (r === void 0) {
r = {};
}
return {
name: "flip",
options: r,
async fn(a) {
var o, t;
const {placement: i, middlewareData: n, rects: e, initialPlacement: g, platform: v, elements: d} = a;
const {mainAxis: c = true, crossAxis: b = true, fallbackPlacements: l, fallbackStrategy: u = "bestFit", fallbackAxisSideDirection: m = "none", flipAlignment: s = true, ...k} = evaluate(r, a);
// If a reset by the arrow was caused due to an alignment offset being
// added, we should skip any logic now since `flip()` has already done its
// work.
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
if ((o = n.arrow) != null && o.alignmentOffset) {
return {};
}
const p = getSide(i);
const f = getSideAxis(g);
const w = getSide(g) === g;
const h = await (v.isRTL == null ? void 0 : v.isRTL(d.floating));
const y = l || (w || !s ? [ getOppositePlacement(g) ] : getExpandedPlacements(g));
const x = m !== "none";
if (!l && x) {
y.push(...getOppositeAxisPlacements(g, s, m, h));
}
const A = [ g, ...y ];
const O = await detectOverflow(a, k);
const C = [];
let S = ((t = n.flip) == null ? void 0 : t.overflows) || [];
if (c) {
C.push(O[p]);
}
if (b) {
const r = getAlignmentSides(i, e, h);
C.push(O[r[0]], O[r[1]]);
}
S = [ ...S, {
placement: i,
overflows: C
} ];
// One or more sides is overflowing.
if (!C.every((r => r <= 0))) {
var E, T;
const r = (((E = n.flip) == null ? void 0 : E.index) || 0) + 1;
const a = A[r];
if (a) {
const o = b === "alignment" ? f !== getSideAxis(a) : false;
if (!o ||
// We leave the current main axis only if every placement on that axis
// overflows the main axis.
S.every((r => r.overflows[0] > 0 && getSideAxis(r.placement) === f))) {
// Try next placement and re-run the lifecycle.
return {
data: {
index: r,
overflows: S
},
reset: {
placement: a
}
};
}
}
// First, find the candidates that fit on the mainAxis side of overflow,
// then find the placement that fits the best on the main crossAxis side.
let o = (T = S.filter((r => r.overflows[0] <= 0)).sort(((r, a) => r.overflows[1] - a.overflows[1]))[0]) == null ? void 0 : T.placement;
// Otherwise fallback.
if (!o) {
switch (u) {
case "bestFit":
{
var P;
const r = (P = S.filter((r => {
if (x) {
const a = getSideAxis(r.placement);
return a === f ||
// Create a bias to the `y` side axis due to horizontal
// reading directions favoring greater width.
a === "y";
}
return true;
})).map((r => [ r.placement, r.overflows.filter((r => r > 0)).reduce(((r, a) => r + a), 0) ])).sort(((r, a) => r[1] - a[1]))[0]) == null ? void 0 : P[0];
if (r) {
o = r;
}
break;
}
case "initialPlacement":
o = g;
break;
}
}
if (i !== o) {
return {
reset: {
placement: o
}
};
}
}
return {};
}
};
};
function getSideOffsets(r, a) {
return {
top: r.top - a.height,
right: r.right - a.width,
bottom: r.bottom - a.height,
left: r.left - a.width
};
}
function isAnySideFullyClipped(r) {
return e.some((a => r[a] >= 0));
}
/**
* Provides data to hide the floating element in applicable situations, such as
* when it is not in the same clipping context as the reference element.
* @see https://floating-ui.com/docs/hide
*/ const hide$1 = function(r) {
if (r === void 0) {
r = {};
}
return {
name: "hide",
options: r,
async fn(a) {
const {rects: o} = a;
const {strategy: t = "referenceHidden", ...i} = evaluate(r, a);
switch (t) {
case "referenceHidden":
{
const r = await detectOverflow(a, {
...i,
elementContext: "reference"
});
const t = getSideOffsets(r, o.reference);
return {
data: {
referenceHiddenOffsets: t,
referenceHidden: isAnySideFullyClipped(t)
}
};
}
case "escaped":
{
const r = await detectOverflow(a, {
...i,
altBoundary: true
});
const t = getSideOffsets(r, o.floating);
return {
data: {
escapedOffsets: t,
escaped: isAnySideFullyClipped(t)
}
};
}
default:
{
return {};
}
}
}
};
};
// For type backwards-compatibility, the `OffsetOptions` type was also
// Derivable.
async function convertValueToCoords(r, a) {
const {placement: o, platform: t, elements: i} = r;
const n = await (t.isRTL == null ? void 0 : t.isRTL(i.floating));
const e = getSide(o);
const g = getAlignment(o);
const v = getSideAxis(o) === "y";
const d = [ "left", "top" ].includes(e) ? -1 : 1;
const c = n && v ? -1 : 1;
const b = evaluate(a, r);
// eslint-disable-next-line prefer-const
let {mainAxis: l, crossAxis: u, alignmentAxis: m} = typeof b === "number" ? {
mainAxis: b,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: b.mainAxis || 0,
crossAxis: b.crossAxis || 0,
alignmentAxis: b.alignmentAxis
};
if (g && typeof m === "number") {
u = g === "end" ? m * -1 : m;
}
return v ? {
x: u * c,
y: l * d
} : {
x: l * d,
y: u * c
};
}
/**
* Modifies the placement by translating the floating element along the
* specified axes.
* A number (shorthand for `mainAxis` or distance), or an axes configuration
* object may be passed.
* @see https://floating-ui.com/docs/offset
*/ const offset$1 = function(r) {
if (r === void 0) {
r = 0;
}
return {
name: "offset",
options: r,
async fn(a) {
var o, t;
const {x: i, y: n, placement: e, middlewareData: g} = a;
const v = await convertValueToCoords(a, r);
// If the placement is the same and the arrow caused an alignment offset
// then we don't need to change the positioning coordinates.
if (e === ((o = g.offset) == null ? void 0 : o.placement) && (t = g.arrow) != null && t.alignmentOffset) {
return {};
}
return {
x: i + v.x,
y: n + v.y,
data: {
...v,
placement: e
}
};
}
};
};
/**
* Optimizes the visibility of the floating element by shifting it in order to
* keep it in view when it will overflow the clipping boundary.
* @see https://floating-ui.com/docs/shift
*/ const shift$1 = function(r) {
if (r === void 0) {
r = {};
}
return {
name: "shift",
options: r,
async fn(a) {
const {x: o, y: t, placement: i} = a;
const {mainAxis: n = true, crossAxis: e = false, limiter: g = {
fn: r => {
let {x: a, y: o} = r;
return {
x: a,
y: o
};
}
}, ...v} = evaluate(r, a);
const d = {
x: o,
y: t
};
const c = await detectOverflow(a, v);
const b = getSideAxis(getSide(i));
const l = getOppositeAxis(b);
let u = d[l];
let m = d[b];
if (n) {
const r = l === "y" ? "top" : "left";
const a = l === "y" ? "bottom" : "right";
const o = u + c[r];
const t = u - c[a];
u = clamp(o, u, t);
}
if (e) {
const r = b === "y" ? "top" : "left";
const a = b === "y" ? "bottom" : "right";
const o = m + c[r];
const t = m - c[a];
m = clamp(o, m, t);
}
const s = g.fn({
...a,
[l]: u,
[b]: m
});
return {
...s,
data: {
x: s.x - o,
y: s.y - t,
enabled: {
[l]: n,
[b]: e
}
}
};
}
};
};
function hasWindow() {
return typeof window !== "undefined";
}
function getNodeName(r) {
if (isNode(r)) {
return (r.nodeName || "").toLowerCase();
}
// Mocked nodes in testing environments may not be instances of Node. By
// returning `#document` an infinite loop won't occur.
// https://github.com/floating-ui/floating-ui/issues/2317
return "#document";
}
function getWindow(r) {
var a;
return (r == null || (a = r.ownerDocument) == null ? void 0 : a.defaultView) || window;
}
function getDocumentElement(r) {
var a;
return (a = (isNode(r) ? r.ownerDocument : r.document) || window.document) == null ? void 0 : a.documentElement;
}
function isNode(r) {
if (!hasWindow()) {
return false;
}
return r instanceof Node || r instanceof getWindow(r).Node;
}
function isElement(r) {
if (!hasWindow()) {
return false;
}
return r instanceof Element || r instanceof getWindow(r).Element;
}
function isHTMLElement(r) {
if (!hasWindow()) {
return false;
}
return r instanceof HTMLElement || r instanceof getWindow(r).HTMLElement;
}
function isShadowRoot(r) {
if (!hasWindow() || typeof ShadowRoot === "undefined") {
return false;
}
return r instanceof ShadowRoot || r instanceof getWindow(r).ShadowRoot;
}
function isOverflowElement(r) {
const {overflow: a, overflowX: o, overflowY: t, display: i} = getComputedStyle(r);
return /auto|scroll|overlay|hidden|clip/.test(a + t + o) && ![ "inline", "contents" ].includes(i);
}
function isTableElement(r) {
return [ "table", "td", "th" ].includes(getNodeName(r));
}
function isTopLayer(r) {
return [ ":popover-open", ":modal" ].some((a => {
try {
return r.matches(a);
} catch (r) {
return false;
}
}));
}
function isContainingBlock(r) {
const a = isWebKit();
const o = isElement(r) ? getComputedStyle(r) : r;
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
return [ "transform", "translate", "scale", "rotate", "perspective" ].some((r => o[r] ? o[r] !== "none" : false)) || (o.containerType ? o.containerType !== "normal" : false) || !a && (o.backdropFilter ? o.backdropFilter !== "none" : false) || !a && (o.filter ? o.filter !== "none" : false) || [ "transform", "translate", "scale", "rotate", "perspective", "filter" ].some((r => (o.willChange || "").includes(r))) || [ "paint", "layout", "strict", "content" ].some((r => (o.contain || "").includes(r)));
}
function getContainingBlock(r) {
let a = getParentNode(r);
while (isHTMLElement(a) && !isLastTraversableNode(a)) {
if (isContainingBlock(a)) {
return a;
} else if (isTopLayer(a)) {
return null;
}
a = getParentNode(a);
}
return null;
}
function isWebKit() {
if (typeof CSS === "undefined" || !CSS.supports) return false;
return CSS.supports("-webkit-backdrop-filter", "none");
}
function isLastTraversableNode(r) {
return [ "html", "body", "#document" ].includes(getNodeName(r));
}
function getComputedStyle(r) {
return getWindow(r).getComputedStyle(r);
}
function getNodeScroll(r) {
if (isElement(r)) {
return {
scrollLeft: r.scrollLeft,
scrollTop: r.scrollTop
};
}
return {
scrollLeft: r.scrollX,
scrollTop: r.scrollY
};
}
function getParentNode(r) {
if (getNodeName(r) === "html") {
return r;
}
const a =
// Step into the shadow DOM of the parent of a slotted node.
r.assignedSlot ||
// DOM Element detected.
r.parentNode ||
// ShadowRoot detected.
isShadowRoot(r) && r.host ||
// Fallback.
getDocumentElement(r);
return isShadowRoot(a) ? a.host : a;
}
function getNearestOverflowAncestor(r) {
const a = getParentNode(r);
if (isLastTraversableNode(a)) {
return r.ownerDocument ? r.ownerDocument.body : r.body;
}
if (isHTMLElement(a) && isOverflowElement(a)) {
return a;
}
return getNearestOverflowAncestor(a);
}
function getOverflowAncestors(r, a, o) {
var t;
if (a === void 0) {
a = [];
}
if (o === void 0) {
o = true;
}
const i = getNearestOverflowAncestor(r);
const n = i === ((t = r.ownerDocument) == null ? void 0 : t.body);
const e = getWindow(i);
if (n) {
const r = getFrameElement(e);
return a.concat(e, e.visualViewport || [], isOverflowElement(i) ? i : [], r && o ? getOverflowAncestors(r) : []);
}
return a.concat(i, getOverflowAncestors(i, [], o));
}
function getFrameElement(r) {
return r.parent && Object.getPrototypeOf(r.parent) ? r.frameElement : null;
}
function getCssDimensions(r) {
const a = getComputedStyle(r);
// In testing environments, the `width` and `height` properties are empty
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
let o = parseFloat(a.width) || 0;
let t = parseFloat(a.height) || 0;
const i = isHTMLElement(r);
const n = i ? r.offsetWidth : o;
const e = i ? r.offsetHeight : t;
const g = d(o) !== n || d(t) !== e;
if (g) {
o = n;
t = e;
}
return {
width: o,
height: t,
$: g
};
}
function unwrapElement(r) {
return !isElement(r) ? r.contextElement : r;
}
function getScale(r) {
const a = unwrapElement(r);
if (!isHTMLElement(a)) {
return createCoords(1);
}
const o = a.getBoundingClientRect();
const {width: t, height: i, $: n} = getCssDimensions(a);
let e = (n ? d(o.width) : o.width) / t;
let g = (n ? d(o.height) : o.height) / i;
// 0, NaN, or Infinity should always fallback to 1.
if (!e || !Number.isFinite(e)) {
e = 1;
}
if (!g || !Number.isFinite(g)) {
g = 1;
}
return {
x: e,
y: g
};
}
const u = createCoords(0);
function getVisualOffsets(r) {
const a = getWindow(r);
if (!isWebKit() || !a.visualViewport) {
return u;
}
return {
x: a.visualViewport.offsetLeft,
y: a.visualViewport.offsetTop
};
}
function shouldAddVisualOffsets(r, a, o) {
if (a === void 0) {
a = false;
}
if (!o || a && o !== getWindow(r)) {
return false;
}
return a;
}
function getBoundingClientRect(r, a, o, t) {
if (a === void 0) {
a = false;
}
if (o === void 0) {
o = false;
}
const i = r.getBoundingClientRect();
const n = unwrapElement(r);
let e = createCoords(1);
if (a) {
if (t) {
if (isElement(t)) {
e = getScale(t);
}
} else {
e = getScale(r);
}
}
const g = shouldAddVisualOffsets(n, o, t) ? getVisualOffsets(n) : createCoords(0);
let v = (i.left + g.x) / e.x;
let d = (i.top + g.y) / e.y;
let c = i.width / e.x;
let b = i.height / e.y;
if (n) {
const r = getWindow(n);
const a = t && isElement(t) ? getWindow(t) : t;
let o = r;
let i = getFrameElement(o);
while (i && t && a !== o) {
const r = getScale(i);
const a = i.getBoundingClientRect();
const t = getComputedStyle(i);
const n = a.left + (i.clientLeft + parseFloat(t.paddingLeft)) * r.x;
const e = a.top + (i.clientTop + parseFloat(t.paddingTop)) * r.y;
v *= r.x;
d *= r.y;
c *= r.x;
b *= r.y;
v += n;
d += e;
o = getWindow(i);
i = getFrameElement(o);
}
}
return rectToClientRect({
width: c,
height: b,
x: v,
y: d
});
}
// If <html> has a CSS width greater than the viewport, then this will be
// incorrect for RTL.
function getWindowScrollBarX(r, a) {
const o = getNodeScroll(r).scrollLeft;
if (!a) {
return getBoundingClientRect(getDocumentElement(r)).left + o;
}
return a.left + o;
}
function getHTMLOffset(r, a, o) {
if (o === void 0) {
o = false;
}
const t = r.getBoundingClientRect();
const i = t.left + a.scrollLeft - (o ? 0 :
// RTL <body> scrollbar.
getWindowScrollBarX(r, t));
const n = t.top + a.scrollTop;
return {
x: i,
y: n
};
}
function convertOffsetParentRelativeRectToViewportRelativeRect(r) {
let {elements: a, rect: o, offsetParent: t, strategy: i} = r;
const n = i === "fixed";
const e = getDocumentElement(t);
const g = a ? isTopLayer(a.floating) : false;
if (t === e || g && n) {
return o;
}
let v = {
scrollLeft: 0,
scrollTop: 0
};
let d = createCoords(1);
const c = createCoords(0);
const b = isHTMLElement(t);
if (b || !b && !n) {
if (getNodeName(t) !== "body" || isOverflowElement(e)) {
v = getNodeScroll(t);
}
if (isHTMLElement(t)) {
const r = getBoundingClientRect(t);
d = getScale(t);
c.x = r.x + t.clientLeft;
c.y = r.y + t.clientTop;
}
}
const l = e && !b && !n ? getHTMLOffset(e, v, true) : createCoords(0);
return {
width: o.width * d.x,
height: o.height * d.y,
x: o.x * d.x - v.scrollLeft * d.x + c.x + l.x,
y: o.y * d.y - v.scrollTop * d.y + c.y + l.y
};
}
function getClientRects(r) {
return Array.from(r.getClientRects());
}
// Gets the entire size of the scrollable document area, even extending outside
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
function getDocumentRect(r) {
const a = getDocumentElement(r);
const o = getNodeScroll(r);
const t = r.ownerDocument.body;
const i = v(a.scrollWidth, a.clientWidth, t.scrollWidth, t.clientWidth);
const n = v(a.scrollHeight, a.clientHeight, t.scrollHeight, t.clientHeight);
let e = -o.scrollLeft + getWindowScrollBarX(r);
const g = -o.scrollTop;
if (getComputedStyle(t).direction === "rtl") {
e += v(a.clientWidth, t.clientWidth) - i;
}
return {
width: i,
height: n,
x: e,
y: g
};
}
function getViewportRect(r, a) {
const o = getWindow(r);
const t = getDocumentElement(r);
const i = o.visualViewport;
let n = t.clientWidth;
let e = t.clientHeight;
let g = 0;
let v = 0;
if (i) {
n = i.width;
e = i.height;
const r = isWebKit();
if (!r || r && a === "fixed") {
g = i.offsetLeft;
v = i.offsetTop;
}
}
return {
width: n,
height: e,
x: g,
y: v
};
}
// Returns the inner client rect, subtracting scrollbars if present.
function getInnerBoundingClientRect(r, a) {
const o = getBoundingClientRect(r, true, a === "fixed");
const t = o.top + r.clientTop;
const i = o.left + r.clientLeft;
const n = isHTMLElement(r) ? getScale(r) : createCoords(1);
const e = r.clientWidth * n.x;
const g = r.clientHeight * n.y;
const v = i * n.x;
const d = t * n.y;
return {
width: e,
height: g,
x: v,
y: d
};
}
function getClientRectFromClippingAncestor(r, a, o) {
let t;
if (a === "viewport") {
t = getViewportRect(r, o);
} else if (a === "document") {
t = getDocumentRect(getDocumentElement(r));
} else if (isElement(a)) {
t = getInnerBoundingClientRect(a, o);
} else {
const o = getVisualOffsets(r);
t = {
x: a.x - o.x,
y: a.y - o.y,
width: a.width,
height: a.height
};
}
return rectToClientRect(t);
}
function hasFixedPositionAncestor(r, a) {
const o = getParentNode(r);
if (o === a || !isElement(o) || isLastTraversableNode(o)) {
return false;
}
return getComputedStyle(o).position === "fixed" || hasFixedPositionAncestor(o, a);
}
// A "clipping ancestor" is an `overflow` element with the characteristic of
// clipping (or hiding) child elements. This returns all clipping ancestors
// of the given element up the tree.
function getClippingElementAncestors(r, a) {
const o = a.get(r);
if (o) {
return o;
}
let t = getOverflowAncestors(r, [], false).filter((r => isElement(r) && getNodeName(r) !== "body"));
let i = null;
const n = getComputedStyle(r).position === "fixed";
let e = n ? getParentNode(r) : r;
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
while (isElement(e) && !isLastTraversableNode(e)) {
const a = getComputedStyle(e);
const o = isContainingBlock(e);
if (!o && a.position === "fixed") {
i = null;
}
const g = n ? !o && !i : !o && a.position === "static" && !!i && [ "absolute", "fixed" ].includes(i.position) || isOverflowElement(e) && !o && hasFixedPositionAncestor(r, e);
if (g) {
// Drop non-containing blocks.
t = t.filter((r => r !== e));
} else {
// Record last containing block for next iteration.
i = a;
}
e = getParentNode(e);
}
a.set(r, t);
return t;
}
// Gets the maximum area that the element is visible in due to any number of
// clipping ancestors.
function getClippingRect(r) {
let {element: a, boundary: o, rootBoundary: t, strategy: i} = r;
const n = o === "clippingAncestors" ? isTopLayer(a) ? [] : getClippingElementAncestors(a, this._c) : [].concat(o);
const e = [ ...n, t ];
const d = e[0];
const c = e.reduce(((r, o) => {
const t = getClientRectFromClippingAncestor(a, o, i);
r.top = v(t.top, r.top);
r.right = g(t.right, r.right);
r.bottom = g(t.bottom, r.bottom);
r.left = v(t.left, r.left);
return r;
}), getClientRectFromClippingAncestor(a, d, i));
return {
width: c.right - c.left,
height: c.bottom - c.top,
x: c.left,
y: c.top
};
}
function getDimensions(r) {
const {width: a, height: o} = getCssDimensions(r);
return {
width: a,
height: o
};
}
function getRectRelativeToOffsetParent(r, a, o) {
const t = isHTMLElement(a);
const i = getDocumentElement(a);
const n = o === "fixed";
const e = getBoundingClientRect(r, true, n, a);
let g = {
scrollLeft: 0,
scrollTop: 0
};
const v = createCoords(0);
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
function setLeftRTLScrollbarOffset() {
v.x = getWindowScrollBarX(i);
}
if (t || !t && !n) {
if (getNodeName(a) !== "body" || isOverflowElement(i)) {
g = getNodeScroll(a);
}
if (t) {
const r = getBoundingClientRect(a, true, n, a);
v.x = r.x + a.clientLeft;
v.y = r.y + a.clientTop;
} else if (i) {
setLeftRTLScrollbarOffset();
}
}
if (n && !t && i) {
setLeftRTLScrollbarOffset();
}
const d = i && !t && !n ? getHTMLOffset(i, g) : createCoords(0);
const c = e.left + g.scrollLeft - v.x - d.x;
const b = e.top + g.scrollTop - v.y - d.y;
return {
x: c,
y: b,
width: e.width,
height: e.height
};
}
function isStaticPositioned(r) {
return getComputedStyle(r).position === "static";
}
function getTrueOffsetParent(r, a) {
if (!isHTMLElement(r) || getComputedStyle(r).position === "fixed") {
return null;
}
if (a) {
return a(r);
}
let o = r.offsetParent;
// Firefox returns the <html> element as the offsetParent if it's non-static,
// while Chrome and Safari return the <body> element. The <body> element must
// be used to perform the correct calculations even if the <html> element is
// non-static.
if (getDocumentElement(r) === o) {
o = o.ownerDocument.body;
}
return o;
}
// Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.
function getOffsetParent(r, a) {
const o = getWindow(r);
if (isTopLayer(r)) {
return o;
}
if (!isHTMLElement(r)) {
let a = getParentNode(r);
while (a && !isLastTraversableNode(a)) {
if (isElement(a) && !isStaticPositioned(a)) {
return a;
}
a = getParentNode(a);
}
return o;
}
let t = getTrueOffsetParent(r, a);
while (t && isTableElement(t) && isStaticPositioned(t)) {
t = getTrueOffsetParent(t, a);
}
if (t && isLastTraversableNode(t) && isStaticPositioned(t) && !isContainingBlock(t)) {
return o;
}
return t || getContainingBlock(r) || o;
}
const getElementRects = async function(r) {
const a = this.getOffsetParent || getOffsetParent;
const o = this.getDimensions;
const t = await o(r.floating);
return {
reference: getRectRelativeToOffsetParent(r.reference, await a(r.floating), r.strategy),
floating: {
x: 0,
y: 0,
width: t.width,
height: t.height
}
};
};
function isRTL(r) {
return getComputedStyle(r).direction === "rtl";
}
const m = {
convertOffsetParentRelativeRectToViewportRelativeRect,
getDocumentElement,
getClippingRect,
getOffsetParent,
getElementRects,
getClientRects,
getDimensions,
getScale,
isElement,
isRTL
};
function rectsAreEqual(r, a) {
return r.x === a.x && r.y === a.y && r.width === a.width && r.height === a.height;
}
// https://samthor.au/2021/observing-dom/
function observeMove(r, a) {
let o = null;
let t;
const i = getDocumentElement(r);
function cleanup() {
var r;
clearTimeout(t);
(r = o) == null || r.disconnect();
o = null;
}
function refresh(n, e) {
if (n === void 0) {
n = false;
}
if (e === void 0) {
e = 1;
}
cleanup();
const d = r.getBoundingClientRect();
const {left: b, top: l, width: u, height: m} = d;
if (!n) {
a();
}
if (!u || !m) {
return;
}
const s = c(l);
const k = c(i.clientWidth - (b + u));
const p = c(i.clientHeight - (l + m));
const f = c(b);
const w = -s + "px " + -k + "px " + -p + "px " + -f + "px";
const h = {
rootMargin: w,
threshold: v(0, g(1, e)) || 1
};
let y = true;
function handleObserve(a) {
const o = a[0].intersectionRatio;
if (o !== e) {
if (!y) {
return refresh();
}
if (!o) {
// If the reference is clipped, the ratio is 0. Throttle the refresh
// to prevent an infinite loop of updates.
t = setTimeout((() => {
refresh(false, 1e-7);
}), 1e3);
} else {
refresh(false, o);
}
}
if (o === 1 && !rectsAreEqual(d, r.getBoundingClientRect())) {
// It's possible that even though the ratio is reported as 1, the
// element is not actually fully within the IntersectionObserver's root
// area anymore. This can happen under performance constraints. This may
// be a bug in the browser's IntersectionObserver implementation. To
// work around this, we compare the element's bounding rect now with
// what it was at the time we created the IntersectionObserver. If they
// are not equal then the element moved, so we refresh.
refresh();
}
y = false;
}
// Older browsers don't support a `document` as the root and will throw an
// error.
try {
o = new IntersectionObserver(handleObserve, {
...h,
// Handle <iframe>s
root: i.ownerDocument
});
} catch (r) {
o = new IntersectionObserver(handleObserve, h);
}
o.observe(r);
}
refresh(true);
return cleanup;
}
/**
* Automatically updates the position of the floating element when necessary.
* Should only be called when the floating element is mounted on the DOM or
* visible on the screen.
* @returns cleanup function that should be invoked when the floating element is
* removed from the DOM or hidden from the screen.
* @see https://floating-ui.com/docs/autoUpdate
*/ function autoUpdate(r, a, o, t) {
if (t === void 0) {
t = {};
}
const {ancestorScroll: i = true, ancestorResize: n = true, elementResize: e = typeof ResizeObserver === "function", layoutShift: g = typeof IntersectionObserver === "function", animationFrame: v = false} = t;
const d = unwrapElement(r);
const c = i || n ? [ ...d ? getOverflowAncestors(d) : [], ...getOverflowAncestors(a) ] : [];
c.forEach((r => {
i && r.addEventListener("scroll", o, {
passive: true
});
n && r.addEventListener("resize", o);
}));
const b = d && g ? observeMove(d, o) : null;
let l = -1;
let u = null;
if (e) {
u = new ResizeObserver((r => {
let [t] = r;
if (t && t.target === d && u) {
// Prevent update loops when using the `size` middleware.
// https://github.com/floating-ui/floating-ui/issues/1740
u.unobserve(a);
cancelAnimationFrame(l);
l = requestAnimationFrame((() => {
var r;
(r = u) == null || r.observe(a);
}));
}
o();
}));
if (d && !v) {
u.observe(d);
}
u.observe(a);
}
let m;
let s = v ? getBoundingClientRect(r) : null;
if (v) {
frameLoop();
}
function frameLoop() {
const a = getBoundingClientRect(r);
if (s && !rectsAreEqual(s, a)) {
o();
}
s = a;
m = requestAnimationFrame(frameLoop);
}
o();
return () => {
var r;
c.forEach((r => {
i && r.removeEventListener("scroll", o);
n && r.removeEventListener("resize", o);
}));
b == null || b();
(r = u) == null || r.disconnect();
u = null;
if (v) {
cancelAnimationFrame(m);
}
};
}
/**
* Modifies the placement by translating the floating element along the
* specified axes.
* A number (shorthand for `mainAxis` or distance), or an axes configuration
* object may be passed.
* @see https://floating-ui.com/docs/offset
*/ const s = offset$1;
/**
* Optimizes the visibility of the floating element by shifting it in order to
* keep it in view when it will overflow the clipping boundary.
* @see https://floating-ui.com/docs/shift
*/ const k = shift$1;
/**
* Optimizes the visibility of the floating element by flipping the `placement`
* in order to keep it in view when the preferred placement(s) will overflow the
* clipping boundary. Alternative to `autoPlacement`.
* @see https://floating-ui.com/docs/flip
*/ const p = flip$1;
/**
* Provides data to hide the floating element in applicable situations, such as
* when it is not in the same clipping context as the reference element.
* @see https://floating-ui.com/docs/hide
*/ const f = hide$1;
/**
* Provides data to position an inner element of the floating element so that it
* appears centered to the reference element.
* @see https://floating-ui.com/docs/arrow
*/ const w = arrow$1;
/**
* Computes the `x` and `y` coordinates that will place the floating element
* next to a given reference element.
*/ const computePosition = (r, a, o) => {
// This caches the expensive `getClippingElementAncestors` function so that
// multiple lifecycle resets re-use the same result. It only lives for a
// single call. If other functions become expensive, we can add them as well.
const t = new Map;
const i = {
platform: m,
...o
};
const n = {
...i.platform,
_c: t
};
return computePosition$1(r, a, {
...i,
platform: n
});
};
/**
* FloatingUIManager é uma classe utilitária que gerencia o posicionamento de elementos flutuantes
* como tooltips ou popovers em relação a um elemento de disparo (trigger).
* Ela utiliza a biblioteca Floating UI para calcular posições e lidar com atualizações.
*/ class h {
triggerElement;
contentElement;
arrowElement;
placement;
onUpdate;
cleanupAutoUpdate;
constructor(r) {
this.triggerElement = r.triggerElement;
this.contentElement = r.contentElement;
this.arrowElement = r.arrowElement;
this.placement = r.placement ?? "top";
this.onUpdate = r.onUpdate;
}
/**
* Inicia o gerenciador Floating UI configurando a atualização automática da posição.
*/ start() {
this.cleanupAutoUpdate = autoUpdate(this.triggerElement, this.contentElement, (() => this.updatePosition()));
}
/**
* Para o gerenciador Floating UI e limpa os recursos utilizados.
*/ stop() {
this.cleanupAutoUpdate?.();
}
/**
* Atualiza a posição do elemento flutuante com base no elemento disparador e no elemento de conteúdo.
* Esta função é chamada automaticamente quando o gerenciador está ativo.
* Ela calcula a nova posição usando a biblioteca Floating UI e aplica as transformações necessárias.
* Também atualiza a posição da seta, se fornecida.
* Além disso, define o atributo de dados `data-placement` no elemento de conteúdo para refletir a posição atual.
* @returns {Promise<void>} Uma promessa que resolve quando a posição é atualizada.
*/ async updatePosition() {
const r = await computePosition(this.triggerElement, this.contentElement, {
placement: this.placement,
middleware: this.buildMiddleware()
});
this.updateTooltipPosition(r);
this.updateArrowPosition(r);
this.setPlacementDataAttribute(r);
this.onUpdate?.(r);
}
/**
* Constrói os middlewares necessários para o Floating UI.
* Esses middlewares são usados para ajustar o posicionamento do elemento flutuante,
* incluindo offset, flip, shift e hide. Se uma seta for fornecida, o middleware de seta também é adicionado.
* @returns {Middleware[]} Retorna um array de middlewares configurados para o Floating UI.
*/ buildMiddleware() {
const r = [ s(8), p(), k({
padding: 5
}), f() ];
if (this.arrowElement != null) {
r.push(w({
element: this.arrowElement
}));
}
return r;
}
/**
* Adiciona o estilo necessário para posicionar o tooltip com base nas coordenadas fornecidas.
* Esta função é chamada após o cálculo da posição do tooltip.
* Ela aplica as propriedades CSS `left` e `top` ao elemento de conteúdo do tooltip.
* @param data Contém as coordenadas x e y para posicionar o tooltip.
*/ updateTooltipPosition(r) {
const {x: a, y: o} = r;
Object.assign(this.contentElement.style, {
left: `${a}px`,
top: `${o}px`
});
}
/**
* Adiciona o estilo necessário para posicionar a seta do tooltip com base nos dados de middleware.
* Esta função é chamada após o cálculo da posição do tooltip.
* Ela aplica as propriedades CSS `left`, `top`, `right`, `bottom` e a posição estática da seta.
* A posição estática é determinada com base na colocação do tooltip (top, right, bottom, left).
* Se a seta não estiver presente ou os dados de middleware não contiverem informações sobre a seta, nada será feito.
* @param data Contém a posição da seta e os dados de middleware.
*/ updateArrowPosition(r) {
if (this.arrowElement == null || r.middlewareData.arrow == null) return;
const {x: a, y: o} = r.middlewareData.arrow;
const t = r.placement.split("-")[0];
const i = {
top: "bottom",
right: "left",
bottom: "top",
left: "right"
}[t];
Object.assign(this.arrowElement.style, {
left: a != null ? `${a}px` : "",
top: o != null ? `${o}px` : "",
right: "",
bottom: "",
[i]: "-4px"
});
}
/**
* Define o atributo de dados `data-placement` no elemento de conteúdo.
* Este atributo é usado para indicar a posição atual do tooltip ou popover.
* Ele é útil para fins de acessibilidade e para permitir que estilos CSS sejam aplicados com base na posição.
* @param data Objeto contendo a propriedade `placement` que define a posição do tooltip ou popover.
* A propriedade `placement` deve ser uma string representando a posição, como 'top', 'bottom', 'left', 'right', etc.
*/ setPlacementDataAttribute(r) {
this.contentElement.setAttribute("data-placement", r.placement);
}
}
const y = "*,:after,:before{-webkit-box-sizing:border-box;box-sizing:border-box}:host{line-height:var(--font-line-height-medium);-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;-ms-text-size-adjust:100%;text-size-adjust:100%}body{margin:0}hr{-webkit-box-sizing:content-box;box-sizing:content-box;height:0;overflow:visible}a{background-color:transparent}strong{font-weight:bolder}small{font-size:80%}img{border-style:none}button,input,select,textarea{font-family:inherit;font-size:100%;line-height:var(--font-line-height-medium);margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;-moz-appearance:button;appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{-webkit-box-sizing:border-box;box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none;appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden]{display:none}.d-flex{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}.align-items-center{-webkit-box-align:center!important;-ms-flex-align:center!important;align-items:center!important}.col,[class*=col-]{padding-left:calc(var(--grid-gutter)*.5);padding-right:calc(var(--grid-gutter)*.5);width:100%}.col{-webkit-box-flex:1;-ms-flex:1 0 0%;flex:1 0 0%;min-width:8.3333333333%}.col-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto}.col-2{-ms-flex-preferred-size:16.6666666667%;flex-basis:16.6666666667%;max-width:16.6666666667%}.container,.container-lg{--grid-margin:var(--grid-portrait-margin);--grid-maxwidth:var(--grid-portrait-maxwidth);margin-left:auto;margin-right:auto;max-width:var(--grid-maxwidth);padding-left:var(--grid-margin);padding-right:var(--grid-margin);width:100%}.row{--grid-gutter:var(--grid-portrait-gutter);display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-left:calc(var(--grid-gutter)*-.5);margin-right:calc(var(--grid-gutter)*-.5)}@media (min-width:576px){.container,.container-lg{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-sm) - var(--grid-tablet-margin))}}@media (min-width:992px){.container,.container-lg{--grid-margin:var(--grid-tablet-margin)}.row{--grid-gutter:var(--grid-tablet-gutter)}.container{--grid-maxwidth:calc(var(--grid-breakpoint-md) - var(--grid-tablet-margin))}}@media (min-width:1280px){.container,.container-lg{--grid-margin:var(--grid-desktop-margin)}.row{--grid-gutter:var(--grid-desktop-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-lg) - var(--grid-desktop-margin))}}@media (min-width:1600px){.container,.container-lg{--grid-margin:var(--grid-tv-margin)}.row{--grid-gutter:var(--grid-tv-gutter)}.container,.container-lg{--grid-maxwidth:calc(var(--grid-breakpoint-xl) - var(--grid-tv-margin))}}.mt-1{margin-top:var(--spacing-scale-half)!important}.mb-1{margin-bottom:var(--spacing-scale-half)!important}.mr-2{margin-right:var(--spacing-scale-base)!important}.mr-n2{margin-right:calc(var(--spacing-scale-base)*-1)!important}.ml-2{margin-left:var(--spacing-scale-base)!important}.mr-auto{margin-right:auto!important}.pt-half{padding-top:v