@lanaco/lnc-react-ui
Version:
React component library
960 lines (959 loc) • 24.1 kB
JavaScript
const K = Math.min, N = Math.max, G = Math.round, U = Math.floor, L = (t) => ({
x: t,
y: t
}), Bt = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
};
function wt(t, e, o) {
return N(t, K(e, o));
}
function Z(t, e) {
return typeof t == "function" ? t(e) : t;
}
function B(t) {
return t.split("-")[0];
}
function tt(t) {
return t.split("-")[1];
}
function Ct(t) {
return t === "x" ? "y" : "x";
}
function St(t) {
return t === "y" ? "height" : "width";
}
function P(t) {
const e = t[0];
return e === "t" || e === "b" ? "y" : "x";
}
function Lt(t) {
return Ct(P(t));
}
function Vt(t, e, o) {
o === void 0 && (o = !1);
const n = tt(t), i = Lt(t), r = St(i);
let s = i === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
return e.reference[r] > e.floating[r] && (s = J(s)), [s, J(s)];
}
function _t(t) {
const e = J(t);
return [ft(t), e, ft(e)];
}
function ft(t) {
return t.includes("start") ? t.replace("start", "end") : t.replace("end", "start");
}
const xt = ["left", "right"], yt = ["right", "left"], $t = ["top", "bottom"], Ht = ["bottom", "top"];
function zt(t, e, o) {
switch (t) {
case "top":
case "bottom":
return o ? e ? yt : xt : e ? xt : yt;
case "left":
case "right":
return e ? $t : Ht;
default:
return [];
}
}
function It(t, e, o, n) {
const i = tt(t);
let r = zt(B(t), o === "start", n);
return i && (r = r.map((s) => s + "-" + i), e && (r = r.concat(r.map(ft)))), r;
}
function J(t) {
const e = B(t);
return Bt[e] + t.slice(e.length);
}
function Xt(t) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...t
};
}
function jt(t) {
return typeof t != "number" ? Xt(t) : {
top: t,
right: t,
bottom: t,
left: t
};
}
function Q(t) {
const {
x: e,
y: o,
width: n,
height: i
} = t;
return {
width: n,
height: i,
top: o,
left: e,
right: e + n,
bottom: o + i,
x: e,
y: o
};
}
function vt(t, e, o) {
let {
reference: n,
floating: i
} = t;
const r = P(e), s = Lt(e), c = St(s), l = B(e), f = r === "y", d = n.x + n.width / 2 - i.width / 2, u = n.y + n.height / 2 - i.height / 2, h = n[c] / 2 - i[c] / 2;
let a;
switch (l) {
case "top":
a = {
x: d,
y: n.y - i.height
};
break;
case "bottom":
a = {
x: d,
y: n.y + n.height
};
break;
case "right":
a = {
x: n.x + n.width,
y: u
};
break;
case "left":
a = {
x: n.x - i.width,
y: u
};
break;
default:
a = {
x: n.x,
y: n.y
};
}
switch (tt(e)) {
case "start":
a[s] -= h * (o && f ? -1 : 1);
break;
case "end":
a[s] += h * (o && f ? -1 : 1);
break;
}
return a;
}
async function Yt(t, e) {
var o;
e === void 0 && (e = {});
const {
x: n,
y: i,
platform: r,
rects: s,
elements: c,
strategy: l
} = t, {
boundary: f = "clippingAncestors",
rootBoundary: d = "viewport",
elementContext: u = "floating",
altBoundary: h = !1,
padding: a = 0
} = Z(e, t), m = jt(a), w = c[h ? u === "floating" ? "reference" : "floating" : u], g = Q(await r.getClippingRect({
element: (o = await (r.isElement == null ? void 0 : r.isElement(w))) == null || o ? w : w.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(c.floating)),
boundary: f,
rootBoundary: d,
strategy: l
})), x = u === "floating" ? {
x: n,
y: i,
width: s.floating.width,
height: s.floating.height
} : s.reference, y = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(c.floating)), v = await (r.isElement == null ? void 0 : r.isElement(y)) ? await (r.getScale == null ? void 0 : r.getScale(y)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
}, A = Q(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: c,
rect: x,
offsetParent: y,
strategy: l
}) : x);
return {
top: (g.top - A.top + m.top) / v.y,
bottom: (A.bottom - g.bottom + m.bottom) / v.y,
left: (g.left - A.left + m.left) / v.x,
right: (A.right - g.right + m.right) / v.x
};
}
const qt = 50, Ut = async (t, e, o) => {
const {
placement: n = "bottom",
strategy: i = "absolute",
middleware: r = [],
platform: s
} = o, c = s.detectOverflow ? s : {
...s,
detectOverflow: Yt
}, l = await (s.isRTL == null ? void 0 : s.isRTL(e));
let f = await s.getElementRects({
reference: t,
floating: e,
strategy: i
}), {
x: d,
y: u
} = vt(f, n, l), h = n, a = 0;
const m = {};
for (let p = 0; p < r.length; p++) {
const w = r[p];
if (!w)
continue;
const {
name: g,
fn: x
} = w, {
x: y,
y: v,
data: A,
reset: b
} = await x({
x: d,
y: u,
initialPlacement: n,
placement: h,
strategy: i,
middlewareData: m,
rects: f,
platform: c,
elements: {
reference: t,
floating: e
}
});
d = y ?? d, u = v ?? u, m[g] = {
...m[g],
...A
}, b && a < qt && (a++, typeof b == "object" && (b.placement && (h = b.placement), b.rects && (f = b.rects === !0 ? await s.getElementRects({
reference: t,
floating: e,
strategy: i
}) : b.rects), {
x: d,
y: u
} = vt(f, h, l)), p = -1);
}
return {
x: d,
y: u,
placement: h,
strategy: i,
middlewareData: m
};
}, Kt = function(t) {
return t === void 0 && (t = {}), {
name: "flip",
options: t,
async fn(e) {
var o, n;
const {
placement: i,
middlewareData: r,
rects: s,
initialPlacement: c,
platform: l,
elements: f
} = e, {
mainAxis: d = !0,
crossAxis: u = !0,
fallbackPlacements: h,
fallbackStrategy: a = "bestFit",
fallbackAxisSideDirection: m = "none",
flipAlignment: p = !0,
...w
} = Z(t, e);
if ((o = r.arrow) != null && o.alignmentOffset)
return {};
const g = B(i), x = P(c), y = B(c) === c, v = await (l.isRTL == null ? void 0 : l.isRTL(f.floating)), A = h || (y || !p ? [J(c)] : _t(c)), b = m !== "none";
!h && b && A.push(...It(c, p, m, v));
const _ = [c, ...A], st = await l.detectOverflow(e, w), q = [];
let $ = ((n = r.flip) == null ? void 0 : n.overflows) || [];
if (d && q.push(st[g]), u) {
const M = Vt(i, s, v);
q.push(st[M[0]], st[M[1]]);
}
if ($ = [...$, {
placement: i,
overflows: q
}], !q.every((M) => M <= 0)) {
var mt, gt;
const M = (((mt = r.flip) == null ? void 0 : mt.index) || 0) + 1, rt = _[M];
if (rt && (!(u === "alignment" ? x !== P(rt) : !1) || // We leave the current main axis only if every placement on that axis
// overflows the main axis.
$.every((O) => P(O.placement) === x ? O.overflows[0] > 0 : !0)))
return {
data: {
index: M,
overflows: $
},
reset: {
placement: rt
}
};
let X = (gt = $.filter((k) => k.overflows[0] <= 0).sort((k, O) => k.overflows[1] - O.overflows[1])[0]) == null ? void 0 : gt.placement;
if (!X)
switch (a) {
case "bestFit": {
var pt;
const k = (pt = $.filter((O) => {
if (b) {
const D = P(O.placement);
return D === x || // Create a bias to the `y` side axis due to horizontal
// reading directions favoring greater width.
D === "y";
}
return !0;
}).map((O) => [O.placement, O.overflows.filter((D) => D > 0).reduce((D, Nt) => D + Nt, 0)]).sort((O, D) => O[1] - D[1])[0]) == null ? void 0 : pt[0];
k && (X = k);
break;
}
case "initialPlacement":
X = c;
break;
}
if (i !== X)
return {
reset: {
placement: X
}
};
}
return {};
}
};
}, Gt = /* @__PURE__ */ new Set(["left", "top"]);
async function Jt(t, e) {
const {
placement: o,
platform: n,
elements: i
} = t, r = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), s = B(o), c = tt(o), l = P(o) === "y", f = Gt.has(s) ? -1 : 1, d = r && l ? -1 : 1, u = Z(e, t);
let {
mainAxis: h,
crossAxis: a,
alignmentAxis: m
} = typeof u == "number" ? {
mainAxis: u,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: u.mainAxis || 0,
crossAxis: u.crossAxis || 0,
alignmentAxis: u.alignmentAxis
};
return c && typeof m == "number" && (a = c === "end" ? m * -1 : m), l ? {
x: a * d,
y: h * f
} : {
x: h * f,
y: a * d
};
}
const Qt = function(t) {
return t === void 0 && (t = 0), {
name: "offset",
options: t,
async fn(e) {
var o, n;
const {
x: i,
y: r,
placement: s,
middlewareData: c
} = e, l = await Jt(e, t);
return s === ((o = c.offset) == null ? void 0 : o.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
x: i + l.x,
y: r + l.y,
data: {
...l,
placement: s
}
};
}
};
}, Zt = function(t) {
return t === void 0 && (t = {}), {
name: "shift",
options: t,
async fn(e) {
const {
x: o,
y: n,
placement: i,
platform: r
} = e, {
mainAxis: s = !0,
crossAxis: c = !1,
limiter: l = {
fn: (g) => {
let {
x,
y
} = g;
return {
x,
y
};
}
},
...f
} = Z(t, e), d = {
x: o,
y: n
}, u = await r.detectOverflow(e, f), h = P(B(i)), a = Ct(h);
let m = d[a], p = d[h];
if (s) {
const g = a === "y" ? "top" : "left", x = a === "y" ? "bottom" : "right", y = m + u[g], v = m - u[x];
m = wt(y, m, v);
}
if (c) {
const g = h === "y" ? "top" : "left", x = h === "y" ? "bottom" : "right", y = p + u[g], v = p - u[x];
p = wt(y, p, v);
}
const w = l.fn({
...e,
[a]: m,
[h]: p
});
return {
...w,
data: {
x: w.x - o,
y: w.y - n,
enabled: {
[a]: s,
[h]: c
}
}
};
}
};
};
function et() {
return typeof window < "u";
}
function I(t) {
return Et(t) ? (t.nodeName || "").toLowerCase() : "#document";
}
function R(t) {
var e;
return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
}
function E(t) {
var e;
return (e = (Et(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
}
function Et(t) {
return et() ? t instanceof Node || t instanceof R(t).Node : !1;
}
function C(t) {
return et() ? t instanceof Element || t instanceof R(t).Element : !1;
}
function T(t) {
return et() ? t instanceof HTMLElement || t instanceof R(t).HTMLElement : !1;
}
function bt(t) {
return !et() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof R(t).ShadowRoot;
}
function Y(t) {
const {
overflow: e,
overflowX: o,
overflowY: n,
display: i
} = S(t);
return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && i !== "inline" && i !== "contents";
}
function te(t) {
return /^(table|td|th)$/.test(I(t));
}
function nt(t) {
try {
if (t.matches(":popover-open"))
return !0;
} catch {
}
try {
return t.matches(":modal");
} catch {
return !1;
}
}
const ee = /transform|translate|scale|rotate|perspective|filter/, ne = /paint|layout|strict|content/, W = (t) => !!t && t !== "none";
let ct;
function ut(t) {
const e = C(t) ? S(t) : t;
return W(e.transform) || W(e.translate) || W(e.scale) || W(e.rotate) || W(e.perspective) || !dt() && (W(e.backdropFilter) || W(e.filter)) || ee.test(e.willChange || "") || ne.test(e.contain || "");
}
function oe(t) {
let e = F(t);
for (; T(e) && !z(e); ) {
if (ut(e))
return e;
if (nt(e))
return null;
e = F(e);
}
return null;
}
function dt() {
return ct == null && (ct = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), ct;
}
function z(t) {
return /^(html|body|#document)$/.test(I(t));
}
function S(t) {
return R(t).getComputedStyle(t);
}
function ot(t) {
return C(t) ? {
scrollLeft: t.scrollLeft,
scrollTop: t.scrollTop
} : {
scrollLeft: t.scrollX,
scrollTop: t.scrollY
};
}
function F(t) {
if (I(t) === "html")
return t;
const e = (
// Step into the shadow DOM of the parent of a slotted node.
t.assignedSlot || // DOM Element detected.
t.parentNode || // ShadowRoot detected.
bt(t) && t.host || // Fallback.
E(t)
);
return bt(e) ? e.host : e;
}
function Tt(t) {
const e = F(t);
return z(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : T(e) && Y(e) ? e : Tt(e);
}
function j(t, e, o) {
var n;
e === void 0 && (e = []), o === void 0 && (o = !0);
const i = Tt(t), r = i === ((n = t.ownerDocument) == null ? void 0 : n.body), s = R(i);
if (r) {
const c = at(s);
return e.concat(s, s.visualViewport || [], Y(i) ? i : [], c && o ? j(c) : []);
} else
return e.concat(i, j(i, [], o));
}
function at(t) {
return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
}
function Dt(t) {
const e = S(t);
let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
const i = T(t), r = i ? t.offsetWidth : o, s = i ? t.offsetHeight : n, c = G(o) !== r || G(n) !== s;
return c && (o = r, n = s), {
width: o,
height: n,
$: c
};
}
function ht(t) {
return C(t) ? t : t.contextElement;
}
function H(t) {
const e = ht(t);
if (!T(e))
return L(1);
const o = e.getBoundingClientRect(), {
width: n,
height: i,
$: r
} = Dt(e);
let s = (r ? G(o.width) : o.width) / n, c = (r ? G(o.height) : o.height) / i;
return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
x: s,
y: c
};
}
const ie = /* @__PURE__ */ L(0);
function Pt(t) {
const e = R(t);
return !dt() || !e.visualViewport ? ie : {
x: e.visualViewport.offsetLeft,
y: e.visualViewport.offsetTop
};
}
function se(t, e, o) {
return e === void 0 && (e = !1), !o || e && o !== R(t) ? !1 : e;
}
function V(t, e, o, n) {
e === void 0 && (e = !1), o === void 0 && (o = !1);
const i = t.getBoundingClientRect(), r = ht(t);
let s = L(1);
e && (n ? C(n) && (s = H(n)) : s = H(t));
const c = se(r, o, n) ? Pt(r) : L(0);
let l = (i.left + c.x) / s.x, f = (i.top + c.y) / s.y, d = i.width / s.x, u = i.height / s.y;
if (r) {
const h = R(r), a = n && C(n) ? R(n) : n;
let m = h, p = at(m);
for (; p && n && a !== m; ) {
const w = H(p), g = p.getBoundingClientRect(), x = S(p), y = g.left + (p.clientLeft + parseFloat(x.paddingLeft)) * w.x, v = g.top + (p.clientTop + parseFloat(x.paddingTop)) * w.y;
l *= w.x, f *= w.y, d *= w.x, u *= w.y, l += y, f += v, m = R(p), p = at(m);
}
}
return Q({
width: d,
height: u,
x: l,
y: f
});
}
function it(t, e) {
const o = ot(t).scrollLeft;
return e ? e.left + o : V(E(t)).left + o;
}
function Ft(t, e) {
const o = t.getBoundingClientRect(), n = o.left + e.scrollLeft - it(t, o), i = o.top + e.scrollTop;
return {
x: n,
y: i
};
}
function re(t) {
let {
elements: e,
rect: o,
offsetParent: n,
strategy: i
} = t;
const r = i === "fixed", s = E(n), c = e ? nt(e.floating) : !1;
if (n === s || c && r)
return o;
let l = {
scrollLeft: 0,
scrollTop: 0
}, f = L(1);
const d = L(0), u = T(n);
if ((u || !u && !r) && ((I(n) !== "body" || Y(s)) && (l = ot(n)), u)) {
const a = V(n);
f = H(n), d.x = a.x + n.clientLeft, d.y = a.y + n.clientTop;
}
const h = s && !u && !r ? Ft(s, l) : L(0);
return {
width: o.width * f.x,
height: o.height * f.y,
x: o.x * f.x - l.scrollLeft * f.x + d.x + h.x,
y: o.y * f.y - l.scrollTop * f.y + d.y + h.y
};
}
function ce(t) {
return Array.from(t.getClientRects());
}
function le(t) {
const e = E(t), o = ot(t), n = t.ownerDocument.body, i = N(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), r = N(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
let s = -o.scrollLeft + it(t);
const c = -o.scrollTop;
return S(n).direction === "rtl" && (s += N(e.clientWidth, n.clientWidth) - i), {
width: i,
height: r,
x: s,
y: c
};
}
const Rt = 25;
function fe(t, e) {
const o = R(t), n = E(t), i = o.visualViewport;
let r = n.clientWidth, s = n.clientHeight, c = 0, l = 0;
if (i) {
r = i.width, s = i.height;
const d = dt();
(!d || d && e === "fixed") && (c = i.offsetLeft, l = i.offsetTop);
}
const f = it(n);
if (f <= 0) {
const d = n.ownerDocument, u = d.body, h = getComputedStyle(u), a = d.compatMode === "CSS1Compat" && parseFloat(h.marginLeft) + parseFloat(h.marginRight) || 0, m = Math.abs(n.clientWidth - u.clientWidth - a);
m <= Rt && (r -= m);
} else f <= Rt && (r += f);
return {
width: r,
height: s,
x: c,
y: l
};
}
function ae(t, e) {
const o = V(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, r = T(t) ? H(t) : L(1), s = t.clientWidth * r.x, c = t.clientHeight * r.y, l = i * r.x, f = n * r.y;
return {
width: s,
height: c,
x: l,
y: f
};
}
function At(t, e, o) {
let n;
if (e === "viewport")
n = fe(t, o);
else if (e === "document")
n = le(E(t));
else if (C(e))
n = ae(e, o);
else {
const i = Pt(t);
n = {
x: e.x - i.x,
y: e.y - i.y,
width: e.width,
height: e.height
};
}
return Q(n);
}
function Mt(t, e) {
const o = F(t);
return o === e || !C(o) || z(o) ? !1 : S(o).position === "fixed" || Mt(o, e);
}
function ue(t, e) {
const o = e.get(t);
if (o)
return o;
let n = j(t, [], !1).filter((c) => C(c) && I(c) !== "body"), i = null;
const r = S(t).position === "fixed";
let s = r ? F(t) : t;
for (; C(s) && !z(s); ) {
const c = S(s), l = ut(s);
!l && c.position === "fixed" && (i = null), (r ? !l && !i : !l && c.position === "static" && !!i && (i.position === "absolute" || i.position === "fixed") || Y(s) && !l && Mt(t, s)) ? n = n.filter((d) => d !== s) : i = c, s = F(s);
}
return e.set(t, n), n;
}
function de(t) {
let {
element: e,
boundary: o,
rootBoundary: n,
strategy: i
} = t;
const s = [...o === "clippingAncestors" ? nt(e) ? [] : ue(e, this._c) : [].concat(o), n], c = At(e, s[0], i);
let l = c.top, f = c.right, d = c.bottom, u = c.left;
for (let h = 1; h < s.length; h++) {
const a = At(e, s[h], i);
l = N(a.top, l), f = K(a.right, f), d = K(a.bottom, d), u = N(a.left, u);
}
return {
width: f - u,
height: d - l,
x: u,
y: l
};
}
function he(t) {
const {
width: e,
height: o
} = Dt(t);
return {
width: e,
height: o
};
}
function me(t, e, o) {
const n = T(e), i = E(e), r = o === "fixed", s = V(t, !0, r, e);
let c = {
scrollLeft: 0,
scrollTop: 0
};
const l = L(0);
function f() {
l.x = it(i);
}
if (n || !n && !r)
if ((I(e) !== "body" || Y(i)) && (c = ot(e)), n) {
const a = V(e, !0, r, e);
l.x = a.x + e.clientLeft, l.y = a.y + e.clientTop;
} else i && f();
r && !n && i && f();
const d = i && !n && !r ? Ft(i, c) : L(0), u = s.left + c.scrollLeft - l.x - d.x, h = s.top + c.scrollTop - l.y - d.y;
return {
x: u,
y: h,
width: s.width,
height: s.height
};
}
function lt(t) {
return S(t).position === "static";
}
function Ot(t, e) {
if (!T(t) || S(t).position === "fixed")
return null;
if (e)
return e(t);
let o = t.offsetParent;
return E(t) === o && (o = o.ownerDocument.body), o;
}
function kt(t, e) {
const o = R(t);
if (nt(t))
return o;
if (!T(t)) {
let i = F(t);
for (; i && !z(i); ) {
if (C(i) && !lt(i))
return i;
i = F(i);
}
return o;
}
let n = Ot(t, e);
for (; n && te(n) && lt(n); )
n = Ot(n, e);
return n && z(n) && lt(n) && !ut(n) ? o : n || oe(t) || o;
}
const ge = async function(t) {
const e = this.getOffsetParent || kt, o = this.getDimensions, n = await o(t.floating);
return {
reference: me(t.reference, await e(t.floating), t.strategy),
floating: {
x: 0,
y: 0,
width: n.width,
height: n.height
}
};
};
function pe(t) {
return S(t).direction === "rtl";
}
const we = {
convertOffsetParentRelativeRectToViewportRelativeRect: re,
getDocumentElement: E,
getClippingRect: de,
getOffsetParent: kt,
getElementRects: ge,
getClientRects: ce,
getDimensions: he,
getScale: H,
isElement: C,
isRTL: pe
};
function Wt(t, e) {
return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
}
function xe(t, e) {
let o = null, n;
const i = E(t);
function r() {
var c;
clearTimeout(n), (c = o) == null || c.disconnect(), o = null;
}
function s(c, l) {
c === void 0 && (c = !1), l === void 0 && (l = 1), r();
const f = t.getBoundingClientRect(), {
left: d,
top: u,
width: h,
height: a
} = f;
if (c || e(), !h || !a)
return;
const m = U(u), p = U(i.clientWidth - (d + h)), w = U(i.clientHeight - (u + a)), g = U(d), y = {
rootMargin: -m + "px " + -p + "px " + -w + "px " + -g + "px",
threshold: N(0, K(1, l)) || 1
};
let v = !0;
function A(b) {
const _ = b[0].intersectionRatio;
if (_ !== l) {
if (!v)
return s();
_ ? s(!1, _) : n = setTimeout(() => {
s(!1, 1e-7);
}, 1e3);
}
_ === 1 && !Wt(f, t.getBoundingClientRect()) && s(), v = !1;
}
try {
o = new IntersectionObserver(A, {
...y,
// Handle <iframe>s
root: i.ownerDocument
});
} catch {
o = new IntersectionObserver(A, y);
}
o.observe(t);
}
return s(!0), r;
}
function ye(t, e, o, n) {
n === void 0 && (n = {});
const {
ancestorScroll: i = !0,
ancestorResize: r = !0,
elementResize: s = typeof ResizeObserver == "function",
layoutShift: c = typeof IntersectionObserver == "function",
animationFrame: l = !1
} = n, f = ht(t), d = i || r ? [...f ? j(f) : [], ...e ? j(e) : []] : [];
d.forEach((g) => {
i && g.addEventListener("scroll", o, {
passive: !0
}), r && g.addEventListener("resize", o);
});
const u = f && c ? xe(f, o) : null;
let h = -1, a = null;
s && (a = new ResizeObserver((g) => {
let [x] = g;
x && x.target === f && a && e && (a.unobserve(e), cancelAnimationFrame(h), h = requestAnimationFrame(() => {
var y;
(y = a) == null || y.observe(e);
})), o();
}), f && !l && a.observe(f), e && a.observe(e));
let m, p = l ? V(t) : null;
l && w();
function w() {
const g = V(t);
p && !Wt(p, g) && o(), p = g, m = requestAnimationFrame(w);
}
return o(), () => {
var g;
d.forEach((x) => {
i && x.removeEventListener("scroll", o), r && x.removeEventListener("resize", o);
}), u == null || u(), (g = a) == null || g.disconnect(), a = null, l && cancelAnimationFrame(m);
};
}
const ve = Qt, be = Zt, Re = Kt, Ae = (t, e, o) => {
const n = /* @__PURE__ */ new Map(), i = {
platform: we,
...o
}, r = {
...i.platform,
_c: n
};
return Ut(t, e, {
...i,
platform: r
});
};
export {
ye as a,
Ae as c,
Re as f,
j as g,
ve as o,
be as s
};