UNPKG

sqlflow

Version:

This will let you create sql queries with a drag and drop editor.

1,736 lines (1,735 loc) 270 kB
var Ti = Object.defineProperty; var Ri = (e, t, n) => t in e ? Ti(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var Pe = (e, t, n) => Ri(e, typeof t != "symbol" ? t + "" : t, n); import { jsx as d, Fragment as it, jsxs as T } from "react/jsx-runtime"; import * as u from "react"; import Ie, { createContext as Ai, useContext as Pi, useState as z, useEffect as Z, useMemo as Tr, useLayoutEffect as Oi, forwardRef as Rr, createElement as mn, useCallback as gn } from "react"; import Mi, { useNodesState as Ii, useEdgesState as Li, Handle as he, Position as me, addEdge as Di, MiniMap as _i, Controls as Fi, Background as $i } from "reactflow"; import { useDrop as Ht, useDrag as Bi } from "react-dnd"; import * as Wt from "react-dom"; import Vi from "react-dom"; import { QueryBuilder as zi, defaultValidator as Hi, formatQuery as Wi } from "react-querybuilder"; import { ShadcnValueEditor as er, QueryBuilderShadcn as Gi } from "react-querybuilder-shadcn"; import { Prism as Ui } from "react-syntax-highlighter"; class ji { constructor(t, n) { Pe(this, "tables"); Pe(this, "nodes"); Pe(this, "edges"); Pe(this, "listeners"); Pe(this, "query", { select: null, join: /* @__PURE__ */ new Map(), where: null, groupBy: null, having: null, orderBy: null, limit: null, offset: null }); this.tables = /* @__PURE__ */ new Map(), this.nodes = t, this.edges = n, this.listeners = /* @__PURE__ */ new Set(); } getTables(t) { if (!this.isNodeConnected(t)) return []; if (t && this.tables.has(t)) { const n = []; for (let [r, o] of this.tables.entries()) r !== t && n.push(o); return n; } return Array.from(this.tables.values()); } // Add a new table to the graph addTable(t, n) { this.isNodeConnected(t) && (this.tables.set(t, n), this.notifyListeners()); } // Remove a table from the graph removeTable(t) { this.tables.has(t) && (this.tables.delete(t), this.notifyListeners()); } getNodes() { return [...this.nodes]; } setNodes(t) { this.nodes = t; } getEdges() { return [...this.edges]; } setEdges(t) { this.edges = t, this.notifyListeners(); } subscribe(t) { this.listeners.has(t) || this.listeners.add(t); } unsubscribe(t) { this.listeners.has(t) && this.listeners.delete(t); } isNodeConnected(t) { return !!this.edges.find( (r) => r.source === t || r.target === t ); } notifyListeners() { this.listeners.forEach((t) => t()); } processSqlQuery(t, n, r) { var o; switch (t) { case "select": this.query.select = n; break; case "join": r && ((o = this.query.join) == null || o.set(r, n)); break; case "where": this.query.where = n; break; case "groupBy": this.query.groupBy = n; break; case "having": this.query.having = n; break; case "orderBy": this.query.orderBy = n; break; case "limit": this.query.limit = n; break; case "offset": this.query.offset = n; break; default: throw new Error(`Unsupported node type: ${t}`); } } getSqlQuery() { const { select: t, join: n, where: r, groupBy: o, having: i, orderBy: s, limit: a, offset: l } = this.query; let c = ""; return t && (c += `${t} `), n && n.forEach((f) => { c += `${f} `; }), r && (c += `${r} `), o && (c += `${o} `), i && (c += `${i} `), s && (c += `${s} `), a !== null && (c += `LIMIT ${a} `), l !== null && (c += `OFFSET ${l} `), c.trim(); } getFieldData(t) { if (t) for (const n of this.tables.values()) { let r = n.fields.find( (o) => o.name === t ); if (r) return r; } return null; } } const De = class De { constructor() { } static destroyInstance() { De.instance = null; } }; Pe(De, "instance", null), Pe(De, "getQueryGraph", (t, n) => (De.instance || (De.instance = new ji(t, n)), De.instance)); let It = De; const Ar = Ai(void 0), Re = () => { const e = Pi(Ar); if (!e) throw new Error( "useSQLQueryBuilderContext must be used within SQLQueryBuilderProvider" ); return e; }, Jd = ({ children: e, tables: t, nodes: n, edges: r }) => { const [o, i] = z([]), [s, a, l] = Ii([]), [c, f, p] = Li([]), [m] = z( () => It.getQueryGraph(s, c) ), g = (w) => { a((S) => [...S, w]); }, y = (w) => { a((S) => S.filter((C) => C.id !== w)); }, h = (w) => { l(w); }, b = (w) => { w.forEach((S) => m.removeTable(S.id)); }, v = (w) => { p(w); }; Z(() => { m.setEdges(c); }, [c]), Z(() => { m.setNodes(s); }, [s]), Z(() => { t && i(t); }, [t]), Z(() => { n && a(n); }, [n]), Z(() => { r && f(r); }, [r]); const x = Tr( () => ({ tables: o, nodes: s, edges: c, setEdges: f, handleEdgeChanges: v, addNode: g, removeNode: y, onNodesChange: l, handleNodeChange: h, handleNodeDelete: b, queryGraph: m }), [m, s, c] ); return Z(() => () => { i([]), a([]), f([]), It.destroyInstance(); }, []), /* @__PURE__ */ d(Ar.Provider, { value: x, children: e }); }; var D = /* @__PURE__ */ ((e) => (e.SELECT = "select", e.WHERE = "where", e.JOIN = "join", e.GROUP_BY = "group_by", e.ORDER_BY = "order_by", e.HAVING = "having", e.FIELD_ALIAS = "field_alias", e.TABLE_ALIAS = "table_alias", e.AGGREGATION = "aggregation", e.DISTINCT = "distinct", e.LIMIT = "limit", e.OFFSET = "offset", e))(D || {}), Pr = /* @__PURE__ */ ((e) => (e.INNER_JOIN = "INNER JOIN", e.LEFT_JOIN = "LEFT JOIN", e.RIGHT_JOIN = "RIGHT JOIN", e.FULL_JOIN = "FULL JOIN", e))(Pr || {}); function tr(e, [t, n]) { return Math.min(n, Math.max(t, e)); } function U(e, t, { checkForDefaultPrevented: n = !0 } = {}) { return function(o) { if (e == null || e(o), n === !1 || !o.defaultPrevented) return t == null ? void 0 : t(o); }; } function qi(e, t = []) { let n = []; function r(i, s) { const a = u.createContext(s), l = n.length; n = [...n, s]; function c(p) { const { scope: m, children: g, ...y } = p, h = (m == null ? void 0 : m[e][l]) || a, b = u.useMemo(() => y, Object.values(y)); return /* @__PURE__ */ d(h.Provider, { value: b, children: g }); } function f(p, m) { const g = (m == null ? void 0 : m[e][l]) || a, y = u.useContext(g); if (y) return y; if (s !== void 0) return s; throw new Error(`\`${p}\` must be used within \`${i}\``); } return c.displayName = i + "Provider", [c, f]; } const o = () => { const i = n.map((s) => u.createContext(s)); return function(a) { const l = (a == null ? void 0 : a[e]) || i; return u.useMemo( () => ({ [`__scope${e}`]: { ...a, [e]: l } }), [a, l] ); }; }; return o.scopeName = e, [r, Qi(o, ...t)]; } function Qi(...e) { const t = e[0]; if (e.length === 1) return t; const n = () => { const r = e.map((o) => ({ useScope: o(), scopeName: o.scopeName })); return function(i) { const s = r.reduce((a, { useScope: l, scopeName: c }) => { const p = l(i)[`__scope${c}`]; return { ...a, ...p }; }, {}); return u.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]); }; }; return n.scopeName = t.scopeName, n; } function Yi(e, t) { typeof e == "function" ? e(t) : e != null && (e.current = t); } function Or(...e) { return (t) => e.forEach((n) => Yi(n, t)); } function X(...e) { return u.useCallback(Or(...e), e); } var nt = u.forwardRef((e, t) => { const { children: n, ...r } = e, o = u.Children.toArray(n), i = o.find(Ji); if (i) { const s = i.props.children, a = o.map((l) => l === i ? u.Children.count(s) > 1 ? u.Children.only(null) : u.isValidElement(s) ? s.props.children : null : l); return /* @__PURE__ */ d(vn, { ...r, ref: t, children: u.isValidElement(s) ? u.cloneElement(s, void 0, a) : null }); } return /* @__PURE__ */ d(vn, { ...r, ref: t, children: n }); }); nt.displayName = "Slot"; var vn = u.forwardRef((e, t) => { const { children: n, ...r } = e; if (u.isValidElement(n)) { const o = Xi(n); return u.cloneElement(n, { ...Ki(r, n.props), // @ts-ignore ref: t ? Or(t, o) : o }); } return u.Children.count(n) > 1 ? u.Children.only(null) : null; }); vn.displayName = "SlotClone"; var Mr = ({ children: e }) => /* @__PURE__ */ d(it, { children: e }); function Ji(e) { return u.isValidElement(e) && e.type === Mr; } function Ki(e, t) { const n = { ...t }; for (const r in t) { const o = e[r], i = t[r]; /^on[A-Z]/.test(r) ? o && i ? n[r] = (...a) => { i(...a), o(...a); } : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...i } : r === "className" && (n[r] = [o, i].filter(Boolean).join(" ")); } return { ...e, ...n }; } function Xi(e) { var r, o; let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning; return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref); } function Zi(e) { const t = e + "CollectionProvider", [n, r] = qi(t), [o, i] = n( t, { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() } ), s = (g) => { const { scope: y, children: h } = g, b = Ie.useRef(null), v = Ie.useRef(/* @__PURE__ */ new Map()).current; return /* @__PURE__ */ d(o, { scope: y, itemMap: v, collectionRef: b, children: h }); }; s.displayName = t; const a = e + "CollectionSlot", l = Ie.forwardRef( (g, y) => { const { scope: h, children: b } = g, v = i(a, h), x = X(y, v.collectionRef); return /* @__PURE__ */ d(nt, { ref: x, children: b }); } ); l.displayName = a; const c = e + "CollectionItemSlot", f = "data-radix-collection-item", p = Ie.forwardRef( (g, y) => { const { scope: h, children: b, ...v } = g, x = Ie.useRef(null), w = X(y, x), S = i(c, h); return Ie.useEffect(() => (S.itemMap.set(x, { ref: x, ...v }), () => void S.itemMap.delete(x))), /* @__PURE__ */ d(nt, { [f]: "", ref: w, children: b }); } ); p.displayName = c; function m(g) { const y = i(e + "CollectionConsumer", g); return Ie.useCallback(() => { const b = y.collectionRef.current; if (!b) return []; const v = Array.from(b.querySelectorAll(`[${f}]`)); return Array.from(y.itemMap.values()).sort( (S, C) => v.indexOf(S.ref.current) - v.indexOf(C.ref.current) ); }, [y.collectionRef, y.itemMap]); } return [ { Provider: s, Slot: l, ItemSlot: p }, m, r ]; } function In(e, t = []) { let n = []; function r(i, s) { const a = u.createContext(s), l = n.length; n = [...n, s]; const c = (p) => { var v; const { scope: m, children: g, ...y } = p, h = ((v = m == null ? void 0 : m[e]) == null ? void 0 : v[l]) || a, b = u.useMemo(() => y, Object.values(y)); return /* @__PURE__ */ d(h.Provider, { value: b, children: g }); }; c.displayName = i + "Provider"; function f(p, m) { var h; const g = ((h = m == null ? void 0 : m[e]) == null ? void 0 : h[l]) || a, y = u.useContext(g); if (y) return y; if (s !== void 0) return s; throw new Error(`\`${p}\` must be used within \`${i}\``); } return [c, f]; } const o = () => { const i = n.map((s) => u.createContext(s)); return function(a) { const l = (a == null ? void 0 : a[e]) || i; return u.useMemo( () => ({ [`__scope${e}`]: { ...a, [e]: l } }), [a, l] ); }; }; return o.scopeName = e, [r, es(o, ...t)]; } function es(...e) { const t = e[0]; if (e.length === 1) return t; const n = () => { const r = e.map((o) => ({ useScope: o(), scopeName: o.scopeName })); return function(i) { const s = r.reduce((a, { useScope: l, scopeName: c }) => { const p = l(i)[`__scope${c}`]; return { ...a, ...p }; }, {}); return u.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]); }; }; return n.scopeName = t.scopeName, n; } var ts = u.createContext(void 0); function ns(e) { const t = u.useContext(ts); return e || t || "ltr"; } var rs = [ "a", "button", "div", "form", "h2", "h3", "img", "input", "label", "li", "nav", "ol", "p", "span", "svg", "ul" ], J = rs.reduce((e, t) => { const n = u.forwardRef((r, o) => { const { asChild: i, ...s } = r, a = i ? nt : t; return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ d(a, { ...s, ref: o }); }); return n.displayName = `Primitive.${t}`, { ...e, [t]: n }; }, {}); function os(e, t) { e && Wt.flushSync(() => e.dispatchEvent(t)); } function Ee(e) { const t = u.useRef(e); return u.useEffect(() => { t.current = e; }), u.useMemo(() => (...n) => { var r; return (r = t.current) == null ? void 0 : r.call(t, ...n); }, []); } function is(e, t = globalThis == null ? void 0 : globalThis.document) { const n = Ee(e); u.useEffect(() => { const r = (o) => { o.key === "Escape" && n(o); }; return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 }); }, [n, t]); } var ss = "DismissableLayer", bn = "dismissableLayer.update", as = "dismissableLayer.pointerDownOutside", ls = "dismissableLayer.focusOutside", nr, Ir = u.createContext({ layers: /* @__PURE__ */ new Set(), layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(), branches: /* @__PURE__ */ new Set() }), Ln = u.forwardRef( (e, t) => { const { disableOutsidePointerEvents: n = !1, onEscapeKeyDown: r, onPointerDownOutside: o, onFocusOutside: i, onInteractOutside: s, onDismiss: a, ...l } = e, c = u.useContext(Ir), [f, p] = u.useState(null), m = (f == null ? void 0 : f.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, g] = u.useState({}), y = X(t, (R) => p(R)), h = Array.from(c.layers), [b] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), v = h.indexOf(b), x = f ? h.indexOf(f) : -1, w = c.layersWithOutsidePointerEventsDisabled.size > 0, S = x >= v, C = us((R) => { const I = R.target, B = [...c.branches].some(($) => $.contains(I)); !S || B || (o == null || o(R), s == null || s(R), R.defaultPrevented || a == null || a()); }, m), A = fs((R) => { const I = R.target; [...c.branches].some(($) => $.contains(I)) || (i == null || i(R), s == null || s(R), R.defaultPrevented || a == null || a()); }, m); return is((R) => { x === c.layers.size - 1 && (r == null || r(R), !R.defaultPrevented && a && (R.preventDefault(), a())); }, m), u.useEffect(() => { if (f) return n && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (nr = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(f)), c.layers.add(f), rr(), () => { n && c.layersWithOutsidePointerEventsDisabled.size === 1 && (m.body.style.pointerEvents = nr); }; }, [f, m, n, c]), u.useEffect(() => () => { f && (c.layers.delete(f), c.layersWithOutsidePointerEventsDisabled.delete(f), rr()); }, [f, c]), u.useEffect(() => { const R = () => g({}); return document.addEventListener(bn, R), () => document.removeEventListener(bn, R); }, []), /* @__PURE__ */ d( J.div, { ...l, ref: y, style: { pointerEvents: w ? S ? "auto" : "none" : void 0, ...e.style }, onFocusCapture: U(e.onFocusCapture, A.onFocusCapture), onBlurCapture: U(e.onBlurCapture, A.onBlurCapture), onPointerDownCapture: U( e.onPointerDownCapture, C.onPointerDownCapture ) } ); } ); Ln.displayName = ss; var cs = "DismissableLayerBranch", ds = u.forwardRef((e, t) => { const n = u.useContext(Ir), r = u.useRef(null), o = X(t, r); return u.useEffect(() => { const i = r.current; if (i) return n.branches.add(i), () => { n.branches.delete(i); }; }, [n.branches]), /* @__PURE__ */ d(J.div, { ...e, ref: o }); }); ds.displayName = cs; function us(e, t = globalThis == null ? void 0 : globalThis.document) { const n = Ee(e), r = u.useRef(!1), o = u.useRef(() => { }); return u.useEffect(() => { const i = (a) => { if (a.target && !r.current) { let l = function() { Lr( as, n, c, { discrete: !0 } ); }; const c = { originalEvent: a }; a.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = l, t.addEventListener("click", o.current, { once: !0 })) : l(); } else t.removeEventListener("click", o.current); r.current = !1; }, s = window.setTimeout(() => { t.addEventListener("pointerdown", i); }, 0); return () => { window.clearTimeout(s), t.removeEventListener("pointerdown", i), t.removeEventListener("click", o.current); }; }, [t, n]), { // ensures we check React component tree (not just DOM tree) onPointerDownCapture: () => r.current = !0 }; } function fs(e, t = globalThis == null ? void 0 : globalThis.document) { const n = Ee(e), r = u.useRef(!1); return u.useEffect(() => { const o = (i) => { i.target && !r.current && Lr(ls, n, { originalEvent: i }, { discrete: !1 }); }; return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o); }, [t, n]), { onFocusCapture: () => r.current = !0, onBlurCapture: () => r.current = !1 }; } function rr() { const e = new CustomEvent(bn); document.dispatchEvent(e); } function Lr(e, t, n, { discrete: r }) { const o = n.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n }); t && o.addEventListener(e, t, { once: !0 }), r ? os(o, i) : o.dispatchEvent(i); } var on = 0; function ps() { u.useEffect(() => { const e = document.querySelectorAll("[data-radix-focus-guard]"); return document.body.insertAdjacentElement("afterbegin", e[0] ?? or()), document.body.insertAdjacentElement("beforeend", e[1] ?? or()), on++, () => { on === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), on--; }; }, []); } function or() { const e = document.createElement("span"); return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e; } var sn = "focusScope.autoFocusOnMount", an = "focusScope.autoFocusOnUnmount", ir = { bubbles: !1, cancelable: !0 }, hs = "FocusScope", Dr = u.forwardRef((e, t) => { const { loop: n = !1, trapped: r = !1, onMountAutoFocus: o, onUnmountAutoFocus: i, ...s } = e, [a, l] = u.useState(null), c = Ee(o), f = Ee(i), p = u.useRef(null), m = X(t, (h) => l(h)), g = u.useRef({ paused: !1, pause() { this.paused = !0; }, resume() { this.paused = !1; } }).current; u.useEffect(() => { if (r) { let h = function(w) { if (g.paused || !a) return; const S = w.target; a.contains(S) ? p.current = S : Le(p.current, { select: !0 }); }, b = function(w) { if (g.paused || !a) return; const S = w.relatedTarget; S !== null && (a.contains(S) || Le(p.current, { select: !0 })); }, v = function(w) { if (document.activeElement === document.body) for (const C of w) C.removedNodes.length > 0 && Le(a); }; document.addEventListener("focusin", h), document.addEventListener("focusout", b); const x = new MutationObserver(v); return a && x.observe(a, { childList: !0, subtree: !0 }), () => { document.removeEventListener("focusin", h), document.removeEventListener("focusout", b), x.disconnect(); }; } }, [r, a, g.paused]), u.useEffect(() => { if (a) { ar.add(g); const h = document.activeElement; if (!a.contains(h)) { const v = new CustomEvent(sn, ir); a.addEventListener(sn, c), a.dispatchEvent(v), v.defaultPrevented || (ms(ws(_r(a)), { select: !0 }), document.activeElement === h && Le(a)); } return () => { a.removeEventListener(sn, c), setTimeout(() => { const v = new CustomEvent(an, ir); a.addEventListener(an, f), a.dispatchEvent(v), v.defaultPrevented || Le(h ?? document.body, { select: !0 }), a.removeEventListener(an, f), ar.remove(g); }, 0); }; } }, [a, c, f, g]); const y = u.useCallback( (h) => { if (!n && !r || g.paused) return; const b = h.key === "Tab" && !h.altKey && !h.ctrlKey && !h.metaKey, v = document.activeElement; if (b && v) { const x = h.currentTarget, [w, S] = gs(x); w && S ? !h.shiftKey && v === S ? (h.preventDefault(), n && Le(w, { select: !0 })) : h.shiftKey && v === w && (h.preventDefault(), n && Le(S, { select: !0 })) : v === x && h.preventDefault(); } }, [n, r, g.paused] ); return /* @__PURE__ */ d(J.div, { tabIndex: -1, ...s, ref: m, onKeyDown: y }); }); Dr.displayName = hs; function ms(e, { select: t = !1 } = {}) { const n = document.activeElement; for (const r of e) if (Le(r, { select: t }), document.activeElement !== n) return; } function gs(e) { const t = _r(e), n = sr(t, e), r = sr(t.reverse(), e); return [n, r]; } function _r(e) { const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: (r) => { const o = r.tagName === "INPUT" && r.type === "hidden"; return r.disabled || r.hidden || o ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } }); for (; n.nextNode(); ) t.push(n.currentNode); return t; } function sr(e, t) { for (const n of e) if (!vs(n, { upTo: t })) return n; } function vs(e, { upTo: t }) { if (getComputedStyle(e).visibility === "hidden") return !0; for (; e; ) { if (t !== void 0 && e === t) return !1; if (getComputedStyle(e).display === "none") return !0; e = e.parentElement; } return !1; } function bs(e) { return e instanceof HTMLInputElement && "select" in e; } function Le(e, { select: t = !1 } = {}) { if (e && e.focus) { const n = document.activeElement; e.focus({ preventScroll: !0 }), e !== n && bs(e) && t && e.select(); } } var ar = ys(); function ys() { let e = []; return { add(t) { const n = e[0]; t !== n && (n == null || n.pause()), e = lr(e, t), e.unshift(t); }, remove(t) { var n; e = lr(e, t), (n = e[0]) == null || n.resume(); } }; } function lr(e, t) { const n = [...e], r = n.indexOf(t); return r !== -1 && n.splice(r, 1), n; } function ws(e) { return e.filter((t) => t.tagName !== "A"); } var ce = globalThis != null && globalThis.document ? u.useLayoutEffect : () => { }, xs = u.useId || (() => { }), Cs = 0; function Gt(e) { const [t, n] = u.useState(xs()); return ce(() => { n((r) => r ?? String(Cs++)); }, [e]), t ? `radix-${t}` : ""; } const Ss = ["top", "right", "bottom", "left"], Fe = Math.min, ue = Math.max, Lt = Math.round, kt = Math.floor, xe = (e) => ({ x: e, y: e }), ks = { left: "right", right: "left", bottom: "top", top: "bottom" }, Es = { start: "end", end: "start" }; function yn(e, t, n) { return ue(e, Fe(t, n)); } function Ne(e, t) { return typeof e == "function" ? e(t) : e; } function Te(e) { return e.split("-")[0]; } function st(e) { return e.split("-")[1]; } function Dn(e) { return e === "x" ? "y" : "x"; } function _n(e) { return e === "y" ? "height" : "width"; } function $e(e) { return ["top", "bottom"].includes(Te(e)) ? "y" : "x"; } function Fn(e) { return Dn($e(e)); } function Ns(e, t, n) { n === void 0 && (n = !1); const r = st(e), o = Fn(e), i = _n(o); let s = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top"; return t.reference[i] > t.floating[i] && (s = Dt(s)), [s, Dt(s)]; } function Ts(e) { const t = Dt(e); return [wn(e), t, wn(t)]; } function wn(e) { return e.replace(/start|end/g, (t) => Es[t]); } function Rs(e, t, n) { const r = ["left", "right"], o = ["right", "left"], i = ["top", "bottom"], s = ["bottom", "top"]; switch (e) { case "top": case "bottom": return n ? t ? o : r : t ? r : o; case "left": case "right": return t ? i : s; default: return []; } } function As(e, t, n, r) { const o = st(e); let i = Rs(Te(e), n === "start", r); return o && (i = i.map((s) => s + "-" + o), t && (i = i.concat(i.map(wn)))), i; } function Dt(e) { return e.replace(/left|right|bottom|top/g, (t) => ks[t]); } function Ps(e) { return { top: 0, right: 0, bottom: 0, left: 0, ...e }; } function Fr(e) { return typeof e != "number" ? Ps(e) : { top: e, right: e, bottom: e, left: e }; } function _t(e) { const { x: t, y: n, width: r, height: o } = e; return { width: r, height: o, top: n, left: t, right: t + r, bottom: n + o, x: t, y: n }; } function cr(e, t, n) { let { reference: r, floating: o } = e; const i = $e(t), s = Fn(t), a = _n(s), l = Te(t), c = i === "y", f = r.x + r.width / 2 - o.width / 2, p = r.y + r.height / 2 - o.height / 2, m = r[a] / 2 - o[a] / 2; let g; switch (l) { case "top": g = { x: f, y: r.y - o.height }; break; case "bottom": g = { x: f, y: r.y + r.height }; break; case "right": g = { x: r.x + r.width, y: p }; break; case "left": g = { x: r.x - o.width, y: p }; break; default: g = { x: r.x, y: r.y }; } switch (st(t)) { case "start": g[s] -= m * (n && c ? -1 : 1); break; case "end": g[s] += m * (n && c ? -1 : 1); break; } return g; } const Os = async (e, t, n) => { const { placement: r = "bottom", strategy: o = "absolute", middleware: i = [], platform: s } = n, a = i.filter(Boolean), l = await (s.isRTL == null ? void 0 : s.isRTL(t)); let c = await s.getElementRects({ reference: e, floating: t, strategy: o }), { x: f, y: p } = cr(c, r, l), m = r, g = {}, y = 0; for (let h = 0; h < a.length; h++) { const { name: b, fn: v } = a[h], { x, y: w, data: S, reset: C } = await v({ x: f, y: p, initialPlacement: r, placement: m, strategy: o, middlewareData: g, rects: c, platform: s, elements: { reference: e, floating: t } }); f = x ?? f, p = w ?? p, g = { ...g, [b]: { ...g[b], ...S } }, C && y <= 50 && (y++, typeof C == "object" && (C.placement && (m = C.placement), C.rects && (c = C.rects === !0 ? await s.getElementRects({ reference: e, floating: t, strategy: o }) : C.rects), { x: f, y: p } = cr(c, m, l)), h = -1); } return { x: f, y: p, placement: m, strategy: o, middlewareData: g }; }; async function bt(e, t) { var n; t === void 0 && (t = {}); const { x: r, y: o, platform: i, rects: s, elements: a, strategy: l } = e, { boundary: c = "clippingAncestors", rootBoundary: f = "viewport", elementContext: p = "floating", altBoundary: m = !1, padding: g = 0 } = Ne(t, e), y = Fr(g), b = a[m ? p === "floating" ? "reference" : "floating" : p], v = _t(await i.getClippingRect({ element: (n = await (i.isElement == null ? void 0 : i.isElement(b))) == null || n ? b : b.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(a.floating)), boundary: c, rootBoundary: f, strategy: l })), x = p === "floating" ? { x: r, y: o, width: s.floating.width, height: s.floating.height } : s.reference, w = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(a.floating)), S = await (i.isElement == null ? void 0 : i.isElement(w)) ? await (i.getScale == null ? void 0 : i.getScale(w)) || { x: 1, y: 1 } : { x: 1, y: 1 }, C = _t(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({ elements: a, rect: x, offsetParent: w, strategy: l }) : x); return { top: (v.top - C.top + y.top) / S.y, bottom: (C.bottom - v.bottom + y.bottom) / S.y, left: (v.left - C.left + y.left) / S.x, right: (C.right - v.right + y.right) / S.x }; } const Ms = (e) => ({ name: "arrow", options: e, async fn(t) { const { x: n, y: r, placement: o, rects: i, platform: s, elements: a, middlewareData: l } = t, { element: c, padding: f = 0 } = Ne(e, t) || {}; if (c == null) return {}; const p = Fr(f), m = { x: n, y: r }, g = Fn(o), y = _n(g), h = await s.getDimensions(c), b = g === "y", v = b ? "top" : "left", x = b ? "bottom" : "right", w = b ? "clientHeight" : "clientWidth", S = i.reference[y] + i.reference[g] - m[g] - i.floating[y], C = m[g] - i.reference[g], A = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c)); let R = A ? A[w] : 0; (!R || !await (s.isElement == null ? void 0 : s.isElement(A))) && (R = a.floating[w] || i.floating[y]); const I = S / 2 - C / 2, B = R / 2 - h[y] / 2 - 1, $ = Fe(p[v], B), H = Fe(p[x], B), O = $, V = R - h[y] - H, k = R / 2 - h[y] / 2 + I, E = yn(O, k, V), N = !l.arrow && st(o) != null && k !== E && i.reference[y] / 2 - (k < O ? $ : H) - h[y] / 2 < 0, M = N ? k < O ? k - O : k - V : 0; return { [g]: m[g] + M, data: { [g]: E, centerOffset: k - E - M, ...N && { alignmentOffset: M } }, reset: N }; } }), Is = function(e) { return e === void 0 && (e = {}), { name: "flip", options: e, async fn(t) { var n, r; const { placement: o, middlewareData: i, rects: s, initialPlacement: a, platform: l, elements: c } = t, { mainAxis: f = !0, crossAxis: p = !0, fallbackPlacements: m, fallbackStrategy: g = "bestFit", fallbackAxisSideDirection: y = "none", flipAlignment: h = !0, ...b } = Ne(e, t); if ((n = i.arrow) != null && n.alignmentOffset) return {}; const v = Te(o), x = $e(a), w = Te(a) === a, S = await (l.isRTL == null ? void 0 : l.isRTL(c.floating)), C = m || (w || !h ? [Dt(a)] : Ts(a)), A = y !== "none"; !m && A && C.push(...As(a, h, y, S)); const R = [a, ...C], I = await bt(t, b), B = []; let $ = ((r = i.flip) == null ? void 0 : r.overflows) || []; if (f && B.push(I[v]), p) { const k = Ns(o, s, S); B.push(I[k[0]], I[k[1]]); } if ($ = [...$, { placement: o, overflows: B }], !B.every((k) => k <= 0)) { var H, O; const k = (((H = i.flip) == null ? void 0 : H.index) || 0) + 1, E = R[k]; if (E) return { data: { index: k, overflows: $ }, reset: { placement: E } }; let N = (O = $.filter((M) => M.overflows[0] <= 0).sort((M, P) => M.overflows[1] - P.overflows[1])[0]) == null ? void 0 : O.placement; if (!N) switch (g) { case "bestFit": { var V; const M = (V = $.filter((P) => { if (A) { const F = $e(P.placement); return F === x || // Create a bias to the `y` side axis due to horizontal // reading directions favoring greater width. F === "y"; } return !0; }).map((P) => [P.placement, P.overflows.filter((F) => F > 0).reduce((F, ne) => F + ne, 0)]).sort((P, F) => P[1] - F[1])[0]) == null ? void 0 : V[0]; M && (N = M); break; } case "initialPlacement": N = a; break; } if (o !== N) return { reset: { placement: N } }; } return {}; } }; }; function dr(e, t) { return { top: e.top - t.height, right: e.right - t.width, bottom: e.bottom - t.height, left: e.left - t.width }; } function ur(e) { return Ss.some((t) => e[t] >= 0); } const Ls = function(e) { return e === void 0 && (e = {}), { name: "hide", options: e, async fn(t) { const { rects: n } = t, { strategy: r = "referenceHidden", ...o } = Ne(e, t); switch (r) { case "referenceHidden": { const i = await bt(t, { ...o, elementContext: "reference" }), s = dr(i, n.reference); return { data: { referenceHiddenOffsets: s, referenceHidden: ur(s) } }; } case "escaped": { const i = await bt(t, { ...o, altBoundary: !0 }), s = dr(i, n.floating); return { data: { escapedOffsets: s, escaped: ur(s) } }; } default: return {}; } } }; }; async function Ds(e, t) { const { placement: n, platform: r, elements: o } = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = Te(n), a = st(n), l = $e(n) === "y", c = ["left", "top"].includes(s) ? -1 : 1, f = i && l ? -1 : 1, p = Ne(t, e); let { mainAxis: m, crossAxis: g, alignmentAxis: y } = typeof p == "number" ? { mainAxis: p, crossAxis: 0, alignmentAxis: null } : { mainAxis: p.mainAxis || 0, crossAxis: p.crossAxis || 0, alignmentAxis: p.alignmentAxis }; return a && typeof y == "number" && (g = a === "end" ? y * -1 : y), l ? { x: g * f, y: m * c } : { x: m * c, y: g * f }; } const _s = function(e) { return e === void 0 && (e = 0), { name: "offset", options: e, async fn(t) { var n, r; const { x: o, y: i, placement: s, middlewareData: a } = t, l = await Ds(t, e); return s === ((n = a.offset) == null ? void 0 : n.placement) && (r = a.arrow) != null && r.alignmentOffset ? {} : { x: o + l.x, y: i + l.y, data: { ...l, placement: s } }; } }; }, Fs = function(e) { return e === void 0 && (e = {}), { name: "shift", options: e, async fn(t) { const { x: n, y: r, placement: o } = t, { mainAxis: i = !0, crossAxis: s = !1, limiter: a = { fn: (b) => { let { x: v, y: x } = b; return { x: v, y: x }; } }, ...l } = Ne(e, t), c = { x: n, y: r }, f = await bt(t, l), p = $e(Te(o)), m = Dn(p); let g = c[m], y = c[p]; if (i) { const b = m === "y" ? "top" : "left", v = m === "y" ? "bottom" : "right", x = g + f[b], w = g - f[v]; g = yn(x, g, w); } if (s) { const b = p === "y" ? "top" : "left", v = p === "y" ? "bottom" : "right", x = y + f[b], w = y - f[v]; y = yn(x, y, w); } const h = a.fn({ ...t, [m]: g, [p]: y }); return { ...h, data: { x: h.x - n, y: h.y - r, enabled: { [m]: i, [p]: s } } }; } }; }, $s = function(e) { return e === void 0 && (e = {}), { options: e, fn(t) { const { x: n, y: r, placement: o, rects: i, middlewareData: s } = t, { offset: a = 0, mainAxis: l = !0, crossAxis: c = !0 } = Ne(e, t), f = { x: n, y: r }, p = $e(o), m = Dn(p); let g = f[m], y = f[p]; const h = Ne(a, t), b = typeof h == "number" ? { mainAxis: h, crossAxis: 0 } : { mainAxis: 0, crossAxis: 0, ...h }; if (l) { const w = m === "y" ? "height" : "width", S = i.reference[m] - i.floating[w] + b.mainAxis, C = i.reference[m] + i.reference[w] - b.mainAxis; g < S ? g = S : g > C && (g = C); } if (c) { var v, x; const w = m === "y" ? "width" : "height", S = ["top", "left"].includes(Te(o)), C = i.reference[p] - i.floating[w] + (S && ((v = s.offset) == null ? void 0 : v[p]) || 0) + (S ? 0 : b.crossAxis), A = i.reference[p] + i.reference[w] + (S ? 0 : ((x = s.offset) == null ? void 0 : x[p]) || 0) - (S ? b.crossAxis : 0); y < C ? y = C : y > A && (y = A); } return { [m]: g, [p]: y }; } }; }, Bs = function(e) { return e === void 0 && (e = {}), { name: "size", options: e, async fn(t) { var n, r; const { placement: o, rects: i, platform: s, elements: a } = t, { apply: l = () => { }, ...c } = Ne(e, t), f = await bt(t, c), p = Te(o), m = st(o), g = $e(o) === "y", { width: y, height: h } = i.floating; let b, v; p === "top" || p === "bottom" ? (b = p, v = m === (await (s.isRTL == null ? void 0 : s.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (v = p, b = m === "end" ? "top" : "bottom"); const x = h - f.top - f.bottom, w = y - f.left - f.right, S = Fe(h - f[b], x), C = Fe(y - f[v], w), A = !t.middlewareData.shift; let R = S, I = C; if ((n = t.middlewareData.shift) != null && n.enabled.x && (I = w), (r = t.middlewareData.shift) != null && r.enabled.y && (R = x), A && !m) { const $ = ue(f.left, 0), H = ue(f.right, 0), O = ue(f.top, 0), V = ue(f.bottom, 0); g ? I = y - 2 * ($ !== 0 || H !== 0 ? $ + H : ue(f.left, f.right)) : R = h - 2 * (O !== 0 || V !== 0 ? O + V : ue(f.top, f.bottom)); } await l({ ...t, availableWidth: I, availableHeight: R }); const B = await s.getDimensions(a.floating); return y !== B.width || h !== B.height ? { reset: { rects: !0 } } : {}; } }; }; function Ut() { return typeof window < "u"; } function at(e) { return $r(e) ? (e.nodeName || "").toLowerCase() : "#document"; } function fe(e) { var t; return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window; } function Se(e) { var t; return (t = ($r(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement; } function $r(e) { return Ut() ? e instanceof Node || e instanceof fe(e).Node : !1; } function ge(e) { return Ut() ? e instanceof Element || e instanceof fe(e).Element : !1; } function Ce(e) { return Ut() ? e instanceof HTMLElement || e instanceof fe(e).HTMLElement : !1; } function fr(e) { return !Ut() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof fe(e).ShadowRoot; } function wt(e) { const { overflow: t, overflowX: n, overflowY: r, display: o } = ve(e); return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(o); } function Vs(e) { return ["table", "td", "th"].includes(at(e)); } function jt(e) { return [":popover-open", ":modal"].some((t) => { try { return e.matches(t); } catch { return !1; } }); } function $n(e) { const t = Bn(), n = ge(e) ? ve(e) : e; return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((r) => (n.willChange || "").includes(r)) || ["paint", "layout", "strict", "content"].some((r) => (n.contain || "").includes(r)); } function zs(e) { let t = Be(e); for (; Ce(t) && !rt(t); ) { if ($n(t)) return t; if (jt(t)) return null; t = Be(t); } return null; } function Bn() { return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none"); } function rt(e) { return ["html", "body", "#document"].includes(at(e)); } function ve(e) { return fe(e).getComputedStyle(e); } function qt(e) { return ge(e) ? { scrollLeft: e.scrollLeft, scrollTop: e.scrollTop } : { scrollLeft: e.scrollX, scrollTop: e.scrollY }; } function Be(e) { if (at(e) === "html") return e; const t = ( // Step into the shadow DOM of the parent of a slotted node. e.assignedSlot || // DOM Element detected. e.parentNode || // ShadowRoot detected. fr(e) && e.host || // Fallback. Se(e) ); return fr(t) ? t.host : t; } function Br(e) { const t = Be(e); return rt(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : Ce(t) && wt(t) ? t : Br(t); } function yt(e, t, n) { var r; t === void 0 && (t = []), n === void 0 && (n = !0); const o = Br(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = fe(o); if (i) { const a = xn(s); return t.concat(s, s.visualViewport || [], wt(o) ? o : [], a && n ? yt(a) : []); } return t.concat(o, yt(o, [], n)); } function xn(e) { return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null; } function Vr(e) { const t = ve(e); let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0; const o = Ce(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, a = Lt(n) !== i || Lt(r) !== s; return a && (n = i, r = s), { width: n, height: r, $: a }; } function Vn(e) { return ge(e) ? e : e.contextElement; } function Ze(e) { const t = Vn(e); if (!Ce(t)) return xe(1); const n = t.getBoundingClientRect(), { width: r, height: o, $: i } = Vr(t); let s = (i ? Lt(n.width) : n.width) / r, a = (i ? Lt(n.height) : n.height) / o; return (!s || !Number.isFinite(s)) && (s = 1), (!a || !Number.isFinite(a)) && (a = 1), { x: s, y: a }; } const Hs = /* @__PURE__ */ xe(0); function zr(e) { const t = fe(e); return !Bn() || !t.visualViewport ? Hs : { x: t.visualViewport.offsetLeft, y: t.visualViewport.offsetTop }; } function Ws(e, t, n) { return t === void 0 && (t = !1), !n || t && n !== fe(e) ? !1 : t; } function qe(e, t, n, r) { t === void 0 && (t = !1), n === void 0 && (n = !1); const o = e.getBoundingClientRect(), i = Vn(e); let s = xe(1); t && (r ? ge(r) && (s = Ze(r)) : s = Ze(e)); const a = Ws(i, n, r) ? zr(i) : xe(0); let l = (o.left + a.x) / s.x, c = (o.top + a.y) / s.y, f = o.width / s.x, p = o.height / s.y; if (i) { const m = fe(i), g = r && ge(r) ? fe(r) : r; let y = m, h = xn(y); for (; h && r && g !== y; ) { const b = Ze(h), v = h.getBoundingClientRect(), x = ve(h), w = v.left + (h.clientLeft + parseFloat(x.paddingLeft)) * b.x, S = v.top + (h.clientTop + parseFloat(x.paddingTop)) * b.y; l *= b.x, c *= b.y, f *= b.x, p *= b.y, l += w, c += S, y = fe(h), h = xn(y); } } return _t({ width: f, height: p, x: l, y: c }); } function zn(e, t) { const n = qt(e).scrollLeft; return t ? t.left + n : qe(Se(e)).left + n; } function Hr(e, t, n) { n === void 0 && (n = !1); const r = e.getBoundingClientRect(), o = r.left + t.scrollLeft - (n ? 0 : ( // RTL <body> scrollbar. zn(e, r) )), i = r.top + t.scrollTop; return { x: o, y: i }; } function Gs(e) { let { elements: t, rect: n, offsetParent: r, strategy: o } = e; const i = o === "fixed", s = Se(r), a = t ? jt(t.floating) : !1; if (r === s || a && i) return n; let l = { scrollLeft: 0, scrollTop: 0 }, c = xe(1); const f = xe(0), p = Ce(r); if ((p || !p && !i) && ((at(r) !== "body" || wt(s)) && (l = qt(r)), Ce(r))) { const g = qe(r); c = Ze(r), f.x = g.x + r.clientLeft, f.y = g.y + r.clientTop; } const m = s && !p && !i ? Hr(s, l, !0) : xe(0); return { width: n.width * c.x, height: n.height * c.y, x: n.x * c.x - l.scrollLeft * c.x + f.x + m.x, y: n.y * c.y - l.scrollTop * c.y + f.y + m.y }; } function Us(e) { return Array.from(e.getClientRects()); } function js(e) { const t = Se(e), n = qt(e), r = e.ownerDocument.body, o = ue(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = ue(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight); let s = -n.scrollLeft + zn(e); const a = -n.scrollTop; return ve(r).direction === "rtl" && (s += ue(t.clientWidth, r.clientWidth) - o), { width: o, height: i, x: s, y: a }; } function qs(e, t) { const n = fe(e), r = Se(e), o = n.visualViewport; let i = r.clientWidth, s = r.clientHeight, a = 0, l = 0; if (o) { i = o.width, s = o.height; const c = Bn(); (!c || c && t === "fixed") && (a = o.offsetLeft, l = o.offsetTop); } return { width: i, height: s, x: a, y: l }; } function Qs(e, t) { const n = qe(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = Ce(e) ? Ze(e) : xe(1), s = e.clientWidth * i.x, a = e.clientHeight * i.y, l = o * i.x, c = r * i.y; return { width: s, height: a, x: l, y: c }; } function pr(e, t, n) { let r; if (t === "viewport") r = qs(e, n); else if (t === "document") r = js(Se(e)); else if (ge(t)) r = Qs(t, n); else { const o = zr(e); r = { x: t.x - o.x, y: t.y - o.y, width: t.width, height: t.height }; } return _t(r); } function Wr(e, t) { const n = Be(e); return n === t || !ge(n) || rt(n) ? !1 : ve(n).position === "fixed" || Wr(n, t); } function Ys(e, t) { const n = t.get(e); if (n) return n; let r = yt(e, [], !1).filter((a) => ge(a) && at(a) !== "body"), o = null; const i = ve(e).position === "fixed"; let s = i ? Be(e) : e; for (; ge(s) && !rt(s); ) { const a = ve(s), l = $n(s); !l && a.position === "fixed" && (o = null), (i ? !l && !o : !l && a.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || wt(s) && !l && Wr(e, s)) ? r = r.filter((f) => f !== s) : o = a, s = Be(s); } return t.set(e, r), r; } function Js(e) { let { element: t, boundary: n, rootBoundary: r, strategy: o } = e; const s = [...n === "clippingAncestors" ? jt(t) ? [] : Ys(t, this._c) : [].concat(n), r], a = s[0], l = s.reduce((c, f) => { const p = pr(t, f, o); return c.top = ue(p.top, c.top), c.right = Fe(p.right, c.right), c.bottom = Fe(p.bottom, c.bottom), c.left = ue(p.left, c.left), c; }, pr(t, a, o)); return { width: l.right - l.left, height: l.bottom - l.top, x: l.left, y: l.top }; } function Ks(e) { const { width: t, height: n } = Vr(e); return { width: t, height: n }; } function Xs(e, t, n) { const r = Ce(t), o = Se(t), i = n === "fixed", s = qe(e, !0, i, t); let a = { scrollLeft: 0, scrollTop: 0 }; const l = xe(0); if (r || !r && !i) if ((at(t) !== "body" || wt(o)) && (a = qt(t)), r) { const m = qe(t, !0, i, t); l.x = m.x + t.clientLeft, l.y = m.y + t.clientTop; } else o && (l.x = zn(o)); const c = o && !r && !i ? Hr(o, a) : xe(0), f = s.left + a.scrollLeft - l.x - c.x, p = s.top + a.scrollTop - l.y - c.y; return { x: f, y: p, width: s.width, height: s.height }; } function ln(e) { return ve(e).position === "static"; } function hr(e, t) { if (!Ce(e) || ve(e).position === "fixed") return null; if (t) return t(e); let n = e.offsetParent; return Se(e) === n && (n = n.ownerDocument.body), n; } function Gr(e, t) { const n = fe(e); if (jt(e)) return n; if (!Ce(e)) { let o = Be(e); for (; o && !rt(o); ) { if (ge(o) && !ln(o)) return o; o = Be(o); } return n; } let r = hr(e, t); for (; r && Vs(r) && ln(r); ) r = hr(r, t); return r && rt(r) && ln(r) && !$n(r) ? n : r || zs(e) || n; } const Zs = async function(e) { const t = this.getOffsetParent || Gr, n = this.getDimensions, r = await n(e.floating); return { reference: Xs(e.reference, await t(e.floating), e.strategy), floating: { x: 0, y: 0, width: r.width, height: r.height } }; }; function ea(e) { return ve(e).direction === "rtl"; } const ta = { convertOffsetParentRelativeRectToViewportRelativeRect: Gs, getDocumentElement: Se, getClippingRect: Js, getOffsetParent: Gr, getElementRects: Zs, getClientRects: Us, getDimensions: Ks, getScale: Ze, isElement: ge, isRTL: ea }; function na(e, t) { let n = null, r; const o = Se(e); function i() { var a; clearTimeout(r), (a = n) == null || a.disconnect(), n = null; } function s(a, l) { a === void 0 && (a = !1), l === void 0 && (l = 1), i(); const { left: c, top: f, width: p, height: m } = e.getBoundingClientRect();