{"version":3,"file":"index.cjs","sources":["../../utils/dist/index.mjs","../src/listener.ts","../src/clickoutside.ts","../src/display.ts","../src/shared/utils.ts","../src/full-screen.ts","../src/hover.ts","../src/intersection.ts","../src/manual-ref.ts","../src/modifier.ts","../src/mounted.ts","../src/moving.ts","../src/pointer.ts","../../../node_modules/.pnpm/@floating-ui+utils@0.2.9/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","../../../node_modules/.pnpm/@floating-ui+core@1.7.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../../../node_modules/.pnpm/@floating-ui+utils@0.2.9/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs","../../../node_modules/.pnpm/@floating-ui+dom@1.7.0/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/utils/resizeObservers.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/algorithms/hasActiveObservations.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/algorithms/hasSkippedObservations.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/algorithms/deliverResizeLoopError.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/ResizeObserverBoxOptions.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/utils/freeze.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/ResizeObserverSize.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/DOMRectReadOnly.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/utils/element.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/utils/global.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/algorithms/calculateBoxSize.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/ResizeObserverEntry.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/algorithms/calculateDepthForNode.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/algorithms/broadcastActiveObservations.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/algorithms/gatherActiveObservationsAtDepth.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/utils/process.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/utils/queueMicroTask.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/utils/queueResizeObserver.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/utils/scheduler.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/ResizeObservation.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/ResizeObserverDetail.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/ResizeObserverController.js","../../../node_modules/.pnpm/@juggle+resize-observer@3.4.0/node_modules/@juggle/resize-observer/lib/ResizeObserver.js","../src/resize.ts","../src/rtl.ts","../src/popper.ts","../src/theme.ts","../src/timer-record.ts","../src/trigger-handler.ts","../src/virtual.ts"],"sourcesContent":["const y = typeof window < \"u\";\nvar Ot;\nconst yn = y && ((Ot = window == null ? void 0 : window.navigator) == null ? void 0 : Ot.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent), re = Object.prototype.toString, oe = Object.prototype.hasOwnProperty;\nfunction B(t, e) {\n return re.call(t) === `[object ${e}]`;\n}\nfunction Mn(t, e) {\n return oe.call(t, e);\n}\nfunction M(t) {\n return t != null;\n}\nfunction ie(t) {\n return t == null;\n}\nfunction Sn(t) {\n return typeof t == \"number\";\n}\nfunction se(t) {\n return Number.isNaN(t);\n}\nfunction wn(t) {\n return typeof t == \"string\";\n}\nfunction En(t) {\n return typeof t == \"boolean\";\n}\nfunction An(t) {\n return t === !0;\n}\nfunction Nn(t) {\n return t === !1;\n}\nfunction Fn(t) {\n return typeof t == \"symbol\";\n}\nfunction On(t) {\n return typeof t == \"bigint\";\n}\nfunction $n(t) {\n return Array.isArray(t);\n}\nfunction Y(t) {\n return B(t, \"Object\");\n}\nfunction Tn(t) {\n return !!t && typeof t.then == \"function\" && typeof t.catch == \"function\";\n}\nfunction $t(t) {\n return typeof t == \"function\";\n}\nfunction Cn(t) {\n return B(t, \"Set\");\n}\nfunction Rn(t) {\n return B(t, \"Map\");\n}\nfunction _n(t) {\n return B(t, \"Date\");\n}\nfunction kn(t) {\n return B(t, \"RegExp\");\n}\nfunction xn(t) {\n return Array.isArray(t) || typeof t == \"string\" ? t.length === 0 : t instanceof Map || t instanceof Set ? t.size === 0 : Y(t) ? Object.keys(t).length === 0 : typeof t == \"number\" ? se(t) : ie(t);\n}\nfunction Dn(t, e = !1) {\n return !e && !y ? !1 : !!(t && \"nodeType\" in t);\n}\nfunction G(t) {\n return M(t) && typeof t[Symbol.iterator] == \"function\";\n}\nfunction it() {\n}\nfunction ce() {\n return !0;\n}\nfunction In() {\n return !1;\n}\nfunction Ln(t, e = 1, n = 1) {\n const r = [];\n for (let o = 0; o < t; ++o)\n r.push(e + o * n);\n return r;\n}\nfunction ae(t) {\n return Object.prototype.toString.call(t).slice(8, -1);\n}\nfunction Hn(t = 16) {\n const e = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890\", n = e.length;\n let r = \"\";\n for (; t--; )\n r += e.charAt(Math.floor(Math.random() * n));\n return r;\n}\nasync function Pn(t, e = {}) {\n if (t.length) {\n for (const [n, r] of t)\n if (typeof n == \"function\" ? n() : n)\n return typeof e.beforeMatchAny == \"function\" && await e.beforeMatchAny(), await r(), typeof e.afterMatchAny == \"function\" && await e.afterMatchAny(), !0;\n }\n return !1;\n}\nasync function Bn(t) {\n if (!y) return !1;\n try {\n return await navigator.clipboard.writeText(t), !0;\n } catch {\n let e = !1;\n const n = document.createElement(\"textarea\"), r = document.activeElement;\n n.value = t, n.setAttribute(\"readonly\", \"\"), n.style.contain = \"strict\", n.style.position = \"absolute\", n.style.height = \"0\", n.style.fontSize = \"12pt\";\n const o = document.getSelection(), i = o ? o.rangeCount > 0 && o.getRangeAt(0) : null;\n return document.body.appendChild(n), n.select(), n.selectionStart = 0, n.selectionEnd = t.length, e = document.execCommand(\"copy\"), document.body.removeChild(n), i && (o.removeAllRanges(), o.addRange(i)), r && r.focus(), e;\n }\n}\nconst fe = \"[-\\\\+]?\\\\d+%?\", ue = \"[-\\\\+]?\\\\d*\\\\.\\\\d+%?\", F = `(?:${ue})|(?:${fe})`, le = `[\\\\s|\\\\(]+(${F})[,|\\\\s]+(${F})[,|\\\\s]+(${F})\\\\s*\\\\)?`, U = `[\\\\s|\\\\(]+(${F})[,|\\\\s]+(${F})[,|\\\\s]+(${F})[,|\\\\s]+(${F})\\\\s*\\\\)?`, Tt = new RegExp(`rgb${le}`), Ct = new RegExp(`rgba${U}`), Rt = new RegExp(`hsl${U}`), _t = new RegExp(`hsla${U}`), kt = new RegExp(`hsv${U}`), xt = new RegExp(`hsva${U}`), Dt = /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, It = /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, Lt = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, Ht = /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, W = Object.freeze({\n aliceblue: \"f0f8ff\",\n antiquewhite: \"faebd7\",\n aqua: \"0ff\",\n aquamarine: \"7fffd4\",\n azure: \"f0ffff\",\n beige: \"f5f5dc\",\n bisque: \"ffe4c4\",\n black: \"000\",\n blanchedalmond: \"ffebcd\",\n blue: \"00f\",\n blueviolet: \"8a2be2\",\n brown: \"a52a2a\",\n burlywood: \"deb887\",\n burntsienna: \"ea7e5d\",\n cadetblue: \"5f9ea0\",\n chartreuse: \"7fff00\",\n chocolate: \"d2691e\",\n coral: \"ff7f50\",\n cornflowerblue: \"6495ed\",\n cornsilk: \"fff8dc\",\n crimson: \"dc143c\",\n cyan: \"0ff\",\n darkblue: \"00008b\",\n darkcyan: \"008b8b\",\n darkgoldenrod: \"b8860b\",\n darkgray: \"a9a9a9\",\n darkgreen: \"006400\",\n darkgrey: \"a9a9a9\",\n darkkhaki: \"bdb76b\",\n darkmagenta: \"8b008b\",\n darkolivegreen: \"556b2f\",\n darkorange: \"ff8c00\",\n darkorchid: \"9932cc\",\n darkred: \"8b0000\",\n darksalmon: \"e9967a\",\n darkseagreen: \"8fbc8f\",\n darkslateblue: \"483d8b\",\n darkslategray: \"2f4f4f\",\n darkslategrey: \"2f4f4f\",\n darkturquoise: \"00ced1\",\n darkviolet: \"9400d3\",\n deeppink: \"ff1493\",\n deepskyblue: \"00bfff\",\n dimgray: \"696969\",\n dimgrey: \"696969\",\n dodgerblue: \"1e90ff\",\n firebrick: \"b22222\",\n floralwhite: \"fffaf0\",\n forestgreen: \"228b22\",\n fuchsia: \"f0f\",\n gainsboro: \"dcdcdc\",\n ghostwhite: \"f8f8ff\",\n gold: \"ffd700\",\n goldenrod: \"daa520\",\n gray: \"808080\",\n green: \"008000\",\n greenyellow: \"adff2f\",\n grey: \"808080\",\n honeydew: \"f0fff0\",\n hotpink: \"ff69b4\",\n indianred: \"cd5c5c\",\n indigo: \"4b0082\",\n ivory: \"fffff0\",\n khaki: \"f0e68c\",\n lavender: \"e6e6fa\",\n lavenderblush: \"fff0f5\",\n lawngreen: \"7cfc00\",\n lemonchiffon: \"fffacd\",\n lightblue: \"add8e6\",\n lightcoral: \"f08080\",\n lightcyan: \"e0ffff\",\n lightgoldenrodyellow: \"fafad2\",\n lightgray: \"d3d3d3\",\n lightgreen: \"90ee90\",\n lightgrey: \"d3d3d3\",\n lightpink: \"ffb6c1\",\n lightsalmon: \"ffa07a\",\n lightseagreen: \"20b2aa\",\n lightskyblue: \"87cefa\",\n lightslategray: \"789\",\n lightslategrey: \"789\",\n lightsteelblue: \"b0c4de\",\n lightyellow: \"ffffe0\",\n lime: \"0f0\",\n limegreen: \"32cd32\",\n linen: \"faf0e6\",\n magenta: \"f0f\",\n maroon: \"800000\",\n mediumaquamarine: \"66cdaa\",\n mediumblue: \"0000cd\",\n mediumorchid: \"ba55d3\",\n mediumpurple: \"9370db\",\n mediumseagreen: \"3cb371\",\n mediumslateblue: \"7b68ee\",\n mediumspringgreen: \"00fa9a\",\n mediumturquoise: \"48d1cc\",\n mediumvioletred: \"c71585\",\n midnightblue: \"191970\",\n mintcream: \"f5fffa\",\n mistyrose: \"ffe4e1\",\n moccasin: \"ffe4b5\",\n navajowhite: \"ffdead\",\n navy: \"000080\",\n oldlace: \"fdf5e6\",\n olive: \"808000\",\n olivedrab: \"6b8e23\",\n orange: \"ffa500\",\n orangered: \"ff4500\",\n orchid: \"da70d6\",\n palegoldenrod: \"eee8aa\",\n palegreen: \"98fb98\",\n paleturquoise: \"afeeee\",\n palevioletred: \"db7093\",\n papayawhip: \"ffefd5\",\n peachpuff: \"ffdab9\",\n peru: \"cd853f\",\n pink: \"ffc0cb\",\n plum: \"dda0dd\",\n powderblue: \"b0e0e6\",\n purple: \"800080\",\n rebeccapurple: \"663399\",\n red: \"f00\",\n rosybrown: \"bc8f8f\",\n royalblue: \"4169e1\",\n saddlebrown: \"8b4513\",\n salmon: \"fa8072\",\n sandybrown: \"f4a460\",\n seagreen: \"2e8b57\",\n seashell: \"fff5ee\",\n sienna: \"a0522d\",\n silver: \"c0c0c0\",\n skyblue: \"87ceeb\",\n slateblue: \"6a5acd\",\n slategray: \"708090\",\n slategrey: \"708090\",\n snow: \"fffafa\",\n springgreen: \"00ff7f\",\n steelblue: \"4682b4\",\n tan: \"d2b48c\",\n teal: \"008080\",\n thistle: \"d8bfd8\",\n tomato: \"ff6347\",\n turquoise: \"40e0d0\",\n violet: \"ee82ee\",\n wheat: \"f5deb3\",\n white: \"fff\",\n whitesmoke: \"f5f5f5\",\n yellow: \"ff0\",\n yellowgreen: \"9acd32\"\n}), de = Object.freeze(new Set(Object.keys(W)));\nfunction Un(t) {\n return t = String(t).trim().toLowerCase(), t ? t === \"transparent\" || W[t] ? !0 : t === \"transparent\" || de.has(t) || Tt.test(t) || Ct.test(t) || Rt.test(t) || _t.test(t) || kt.test(t) || xt.test(t) || Dt.test(t) || It.test(t) || Lt.test(t) || Ht.test(t) : !1;\n}\nfunction he(t) {\n if (t = t.toString().trim().toLowerCase(), t === \"transparent\")\n return { r: 0, g: 0, b: 0, a: 0, format: \"name\", toString: S };\n let e = !1;\n W[t] && (t = W[t], e = !0);\n let n;\n if (n = Tt.exec(t)) {\n const { r, g: o, b: i } = R(n[1], n[2], n[3]);\n return {\n r: r * 255,\n g: o * 255,\n b: i * 255,\n format: \"rgb\",\n toString: S\n };\n }\n if (n = Ct.exec(t)) {\n const { r, g: o, b: i } = R(n[1], n[2], n[3]);\n return {\n r: r * 255,\n g: o * 255,\n b: i * 255,\n a: C(n[4]),\n format: \"rgba\",\n toString: S\n };\n }\n if (n = Rt.exec(t)) {\n const { h: r, s: o, l: i } = z(n[0], n[1], n[3]);\n return { h: r * 360, s: o, l: i, format: \"hsl\", toString: H };\n }\n if (n = _t.exec(t)) {\n const { h: r, s: o, l: i } = z(n[0], n[1], n[3]);\n return {\n h: r * 360,\n s: o,\n l: i,\n a: C(n[4]),\n format: \"hsla\",\n toString: H\n };\n }\n if (n = kt.exec(t)) {\n const { h: r, s: o, v: i } = j(n[0], n[1], n[3]);\n return { h: r * 360, s: o, v: i, format: \"hsv\", toString: q };\n }\n if (n = xt.exec(t)) {\n const { h: r, s: o, v: i } = j(n[0], n[1], n[3]);\n return {\n h: r * 360,\n s: o,\n v: i,\n a: C(n[4]),\n format: \"hsva\",\n toString: q\n };\n }\n return (n = Dt.exec(t)) ? {\n r: parseInt(`${n[1]}${n[1]}`, 16),\n g: parseInt(`${n[2]}${n[2]}`, 16),\n b: parseInt(`${n[3]}${n[3]}`, 16),\n format: e ? \"name\" : \"hex3\",\n toString: S\n } : (n = It.exec(t)) ? {\n r: parseInt(`${n[1]}${n[1]}`, 16),\n g: parseInt(`${n[2]}${n[2]}`, 16),\n b: parseInt(`${n[3]}${n[3]}`, 16),\n a: mt(`${n[4]}${n[4]}`),\n format: e ? \"name\" : \"hex4\",\n toString: S\n } : (n = Lt.exec(t)) ? {\n r: parseInt(n[1], 16),\n g: parseInt(n[2], 16),\n b: parseInt(n[3], 16),\n format: e ? \"name\" : \"hex6\",\n toString: S\n } : (n = Ht.exec(t)) ? {\n r: parseInt(n[1], 16),\n g: parseInt(n[2], 16),\n b: parseInt(n[3], 16),\n a: mt(n[4]),\n format: e ? \"name\" : \"hex8\",\n toString: S\n } : null;\n}\nfunction Yn(t) {\n const { a: e, ...n } = O(t);\n delete n.format;\n const r = Bt(n.r, n.g, n.b), o = Ut(n.r, n.g, n.b), i = st(n.r, n.g, n.b), s = ct(n.r, n.g, n.b, e);\n return {\n rgb: n,\n hsl: r,\n hsv: o,\n hex: i,\n alpha: e,\n rgba: { ...n, a: e, format: \"rgba\" },\n hsla: { ...r, a: e, format: \"hsla\" },\n hsva: { ...o, a: e, format: \"hsva\" },\n hex8: s,\n gray: Gt(n),\n origin: t\n };\n}\nfunction O(t) {\n let e = { r: 0, g: 0, b: 0 }, n = 1, r;\n return typeof t == \"string\" ? r = he(t) : r = t, r !== null && typeof r == \"object\" && (\"l\" in r ? e = Pt(r.h, r.s, r.l) : \"v\" in r && (e = pe(r.h, r.s, r.v)), \"a\" in r && (n = C(r.a ?? 1), Number.isNaN(n) && (n = 1)), e = r), { ...e, a: n, format: \"rgba\", toString: S };\n}\nfunction z(t, e, n) {\n return {\n h: w(t, 0, 360) / 360,\n s: w(I(e) ? L(e) : e, 0, 1),\n l: w(I(n) ? L(n) : n, 0, 1)\n };\n}\nfunction R(t, e, n) {\n return {\n r: w(t, 0, 255) / 255,\n g: w(e, 0, 255) / 255,\n b: w(n, 0, 255) / 255\n };\n}\nfunction j(t, e, n) {\n return {\n h: w(t, 0, 360) / 360,\n s: w(I(e) ? L(e) : e, 0, 1),\n v: w(I(n) ? L(n) : n, 0, 1)\n };\n}\nfunction C(t) {\n return w(I(t) ? L(t) : t, 0, 1);\n}\nfunction Pt(t, e, n) {\n let r, o, i;\n if ({ h: t, s: e, l: n } = z(t, e, n), e === 0)\n r = o = i = n;\n else {\n const s = n < 0.5 ? 1 * (1 + e) : n + e - n * e, c = 2 * n - s;\n r = tt(c, s, t + 1 / 3), o = tt(c, s, t), i = tt(c, s, t - 1 / 3);\n }\n return r *= 255, o *= 255, i *= 255, { r, g: o, b: i, toString: S };\n}\nfunction Bt(t, e, n) {\n ({ r: t, g: e, b: n } = R(t, e, n));\n const r = Math.max(t, e, n), o = Math.min(t, e, n);\n let i, s;\n const c = (r + o) / 2;\n if (r === o)\n i = s = 0;\n else {\n const a = r - o;\n switch (s = c > 0.5 ? a / (2 - r - o) : a / (r + o), r) {\n case t: {\n i = (e - n) / a + (e < n ? 6 : 0);\n break;\n }\n case e: {\n i = (n - t) / a + 2;\n break;\n }\n case n: {\n i = (t - e) / a + 4;\n break;\n }\n default:\n i = 0;\n }\n i *= 60;\n }\n return { h: i, s, l: c, toString: H };\n}\nfunction ge(t, e, n) {\n ({ h: t, s: e, l: n } = z(t, e, n));\n const r = 0.5 * (2 * n + e * (1 - Math.abs(2 * n - 1)));\n return e = 2 * (r - n) / r, { h: t * 360, s: e, v: r, toString: q };\n}\nfunction Gn(t, e, n) {\n ({ h: t, s: e, v: n } = j(t, e, n));\n const r = 0.5 * n * (2 - e);\n return e = n * e / (1 - Math.abs(2 * r - 1)), { h: t * 360, s: e, l: r, toString: H };\n}\nfunction pe(t, e, n) {\n ({ h: t, s: e, v: n } = j(t, e, n)), t *= 6;\n const r = Math.floor(t), o = t - r, i = n * (1 - e), s = n * (1 - o * e), c = n * (1 - (1 - o) * e), a = r % 6;\n let f = [n, s, i, i, c, n][a], u = [c, n, n, s, i, i][a], d = [i, i, c, n, n, s][a];\n return f *= 255, u *= 255, d *= 255, { r: f, g: u, b: d, toString: S };\n}\nfunction Ut(t, e, n) {\n ({ r: t, g: e, b: n } = R(t, e, n));\n const r = Math.max(t, e, n), o = Math.min(t, e, n);\n let i;\n const s = r, c = r - o, a = r === 0 ? 0 : c / r;\n if (r === o)\n i = 0;\n else {\n switch (r) {\n case t: {\n i = (e - n) / c + (e < n ? 6 : 0);\n break;\n }\n case e: {\n i = (n - t) / c + 2;\n break;\n }\n case n: {\n i = (t - e) / c + 4;\n break;\n }\n default:\n i = 0;\n }\n i *= 60;\n }\n return { h: i, s: a, v: s, toString: q };\n}\nfunction st(t, e, n, r = !1) {\n ({ r: t, g: e, b: n } = R(t, e, n));\n const o = [\n $(Math.round(t * 255).toString(16)),\n $(Math.round(e * 255).toString(16)),\n $(Math.round(n * 255).toString(16))\n ];\n return r && T(o[0]) && T(o[1]) && T(o[2]) ? o[0].charAt(0) + o[1].charAt(0) + o[2].charAt(0) : \"#\" + o.join(\"\");\n}\nfunction ct(t, e, n, r, o = !1) {\n ({ r: t, g: e, b: n } = R(t, e, n));\n const i = [\n $(Math.round(t * 255).toString(16)),\n $(Math.round(e * 255).toString(16)),\n $(Math.round(n * 255).toString(16)),\n $(me(C(r)))\n ];\n return o && T(i[0]) && T(i[1]) && T(i[2]) && T(i[3]) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) + i[3].charAt(0) : \"#\" + i.join(\"\");\n}\nfunction Wn(t, e, n = 0.5) {\n if (!t && !e) return { r: 0, g: 0, b: 0, a: 1 };\n if (!t) return O(e);\n if (!e) return O(t);\n const r = O(t), o = O(e), i = w(n, 0, 1), s = i * 2 - 1, c = r.a - o.a, f = ((s * c === -1 ? s : (s + c) / (1 + s * c)) + 1) / 2, u = 1 - f;\n return {\n r: Math.round(r.r * f + o.r * u),\n g: Math.round(r.g * f + o.g * u),\n b: Math.round(r.b * f + o.b * u),\n a: Math.round(r.a * i + o.a * (1 - i)),\n format: \"rgba\",\n toString: S\n };\n}\nfunction zn(t, e) {\n const n = O(t);\n return n.a = C(e), n;\n}\nfunction jn(t = !1, e = \"hex\") {\n const n = Math.round(Math.random() * 255), r = Math.round(Math.random() * 255), o = Math.round(Math.random() * 255);\n if (e === \"hex\")\n return t ? ct(n, r, o, Math.random()) : st(n, r, o);\n let i;\n return e === \"hsl\" ? i = Bt(n, r, o) : e === \"hsv\" ? i = Ut(n, r, o) : i = /* @__PURE__ */ Object.create({ r: n, g: r, b: o, toString: S }), t && (i.a = Math.random()), i.toString();\n}\nfunction Yt(t, e = !1, n = \"hex\") {\n const r = Math.round(Math.random() * 360), o = Math.round(t === \"hard\" ? 80 + Math.random() * 20 : 20 + Math.random() * 70) / 100, i = Math.round(t === \"hard\" ? 40 + Math.random() * 20 : 80 + Math.random() * 15) / 100;\n if (n === \"hsl\")\n return H.bind({ h: r, s: o, l: i })();\n let s;\n if (n === \"hex\" || n === \"rgb\") {\n if (s = Pt(r, o, i), n === \"hex\") {\n const { r: c, g: a, b: f } = s;\n return e ? ct(c, a, f, Math.random()) : st(c, a, f);\n }\n } else n === \"hsv\" && (s = ge(r, o, i));\n return e && (s.a = Math.random()), s.toString();\n}\nfunction qn(t = !1, e = \"hex\") {\n return Yt(\"hard\", t, e);\n}\nfunction Kn(t = !1, e = \"hex\") {\n return Yt(\"soft\", t, e);\n}\nfunction Qn(t) {\n return Gt(O(t));\n}\nfunction $(t) {\n return t.length === 1 ? `0${t}` : t.toString();\n}\nfunction T(t) {\n return t.charAt(0) === t.charAt(1);\n}\nfunction me(t) {\n return Math.round(parseFloat(t) * 255).toString(16);\n}\nfunction mt(t) {\n return parseInt(t, 16) / 255;\n}\nfunction w(t, e, n) {\n return Math.max(e, Math.min(n, parseFloat(t)));\n}\nfunction tt(t, e, n) {\n return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;\n}\nfunction I(t) {\n return String(t).trim().includes(\"%\");\n}\nfunction L(t) {\n const e = parseFloat(t) / 100;\n return Number.isNaN(e) ? 0 : e;\n}\nfunction S() {\n return M(this.a) && this.a >= 0 && this.a < 1 ? `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})` : `rgb(${this.r}, ${this.g}, ${this.b})`;\n}\nfunction H() {\n const t = `${this.s * 100}%`, e = `${this.l * 100}%`;\n return M(this.a) && this.a >= 0 && this.a < 1 ? `hsla(${this.h}, ${t}, ${e}, ${this.a})` : `hsl(${this.h}, ${t}, ${e})`;\n}\nfunction q() {\n const t = `${this.s * 100}%`, e = `${this.v * 100}%`;\n return M(this.a) && this.a >= 0 && this.a < 1 ? `hsva(${this.h}, ${t}, ${e}, ${this.a})` : `hsv(${this.h}, ${t}, ${e})`;\n}\nfunction Gt(t) {\n return (t.r * 0.2126 + t.g * 0.7152 + t.b * 0.0722) / 255;\n}\nlet Wt = 0;\nfunction Xn() {\n return Wt++;\n}\nfunction Vn(t) {\n Wt = Math.round(t);\n}\nfunction Zn(t = 0) {\n return {\n getCount: () => t++,\n setCount: (e) => {\n t = e;\n }\n };\n}\nfunction bt(t) {\n return t & -t;\n}\nfunction Jn(t, e = 0) {\n const n = new Array(t + 1).fill(0);\n function r(c, a) {\n if (!(!a || c >= t))\n for (c += 1; c <= t; )\n n[c] += a, c += bt(c);\n }\n function o(c = t) {\n if (c <= 0) return 0;\n c > t && (c = t);\n let a = c * e;\n for (; c > 0; )\n a += n[c], c -= bt(c);\n return a;\n }\n function i(c) {\n return o(c + 1) - o(c);\n }\n function s(c) {\n let a = 0, f = t;\n for (; f > a; ) {\n const u = Math.floor((a + f) / 2), d = o(u);\n if (d > c) {\n f = u;\n continue;\n } else if (d < c) {\n if (a === u)\n return o(a + 1) <= c ? a + 1 : a;\n a = u;\n } else\n return u;\n }\n return a;\n }\n return { tree: n, add: r, sum: o, get: i, boundIndex: s };\n}\nconst be = /^\\s*[+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?\\s*$/;\nfunction ye(t, e = !1) {\n return typeof t == \"number\" ? !Number.isNaN(t) : e ? be.test(String(t)) : !Number.isNaN(parseFloat(t)) || !Number.isNaN(Number(t));\n}\nfunction Me(t) {\n let e = parseFloat(t);\n return Number.isNaN(e) && (e = Number(t)), Number.isNaN(e) ? 0 : e;\n}\nfunction Se(t, e) {\n return e <= 0 ? t.toString() : `${t < 0 ? \"-\" : \"\"}${String(Math.abs(Math.round(t))).padStart(e, \"0\")}`;\n}\nfunction A(t) {\n return Se(t, 2);\n}\nfunction E(t) {\n const e = t.toString().split(/[eE]/), n = (e[0].split(\".\")[1] || \"\").length - +(e[1] || 0);\n return n > 0 ? n : 0;\n}\nfunction vn(t) {\n return E(t);\n}\nfunction tr(t, e = 3, n = \",\") {\n if (typeof t != \"number\" && (t = parseFloat(t)), Number.isNaN(t)) return \"0\";\n let [r, o] = String(t).split(\".\");\n const i = new RegExp(`(\\\\d+)(\\\\d{${e}})`);\n for (; i.test(r); )\n r = r.replace(i, `$1${n}$2`);\n return o = o ? `.${o}` : \"\", `${r}${o}`;\n}\nfunction zt(t, e) {\n e = Math.max(Math.round(e), 0);\n let n = t.toFixed(E(t));\n const r = n.indexOf(\".\");\n if (r === -1) return t;\n const o = n.replace(\".\", \"\").split(\"\"), i = r + e;\n return o[i] ? (n.charAt(i + 1) === \"5\" ? n = n.substring(0, i + 1) + \"6\" : n = n.substring(0, i + 2), parseFloat(Number(n).toFixed(e))) : t;\n}\nfunction er(t, e, n) {\n return zt(t * e, n);\n}\nfunction nr(t, e) {\n if (e < 0 || e > 1)\n return Math.round(t);\n const n = Math.ceil(t);\n return t + 1 - e >= n ? n : Math.floor(t);\n}\nfunction rr(t, e, n) {\n return Math.max(e, Math.min(n, parseFloat(t)));\n}\nfunction or(t, e, n = 0) {\n if (t <= 0 || e <= 1) return [t];\n n < 1 && (n = 1 / 0);\n const r = [];\n let o = 0;\n for (; t >= e && o < n; )\n r.push(t % e), t = Math.floor(t / e), ++o;\n return r.push(t), r.reverse();\n}\nconst et = [\"th\", \"st\", \"nd\", \"rd\"];\nfunction ir(t) {\n if (t = Math.round(t), t <= 0) return `${t}th`;\n const e = t % 100 > 10 && t % 100 < 14 ? et[0] : et[t % 10] || et[0];\n return `${t}${e}`;\n}\nconst yt = Object.freeze([\n \"B\",\n \"KB\",\n \"MB\",\n \"GB\",\n \"TB\",\n \"AUTO\"\n]);\nfunction sr(t, e = \"AUTO\", n = !1, r) {\n typeof r > \"u\" && (typeof n == \"number\" ? (r = n, n = !1) : r = 2);\n let o = e.toUpperCase();\n o = yt.includes(o) ? o : \"AUTO\";\n let i;\n switch (o) {\n case \"AUTO\":\n i = 0;\n break;\n case \"KB\":\n i = 1;\n break;\n case \"MB\":\n i = 2;\n break;\n case \"GB\":\n i = 3;\n break;\n case \"TB\":\n i = 4;\n break;\n default:\n return t;\n }\n let s;\n if (i)\n s = t / 1024 ** i;\n else\n for (s = t; s > 1024 && !(i > 4); ++i)\n s = s / 1024;\n return s = zt(s, r), n ? `${s}${o === \"AUTO\" ? yt[Math.min(i, 4)] : o}` : s;\n}\nfunction cr(t, e = 0) {\n return e === t ? e : (e > t && ([e, t] = [t, e]), Math.random() * (t - e) + e);\n}\nfunction jt(t, e = 15) {\n return +parseFloat(Number(t).toPrecision(e));\n}\nfunction K(t) {\n const e = String(t);\n if (!e.includes(\"e\"))\n return Number(e.replace(\".\", \"\"));\n const n = E(t);\n return n > 0 ? jt(Number(t) * 10 ** n) : Number(t);\n}\nfunction Q(t) {\n return (...e) => {\n let n = e[0];\n for (let r = 1, o = e.length; r < o; ++r)\n n = t(n, e[r]);\n return n;\n };\n}\nconst P = Q((t, e) => {\n const n = K(t), r = K(e), o = E(t) + E(e);\n return n * r / 10 ** o;\n}), ar = Q((t, e) => {\n const n = 10 ** Math.max(E(t), E(e));\n return (P(t, n) + P(e, n)) / n;\n}), fr = Q((t, e) => {\n const n = 10 ** Math.max(E(t), E(e));\n return (P(t, n) - P(e, n)) / n;\n}), ur = Q((t, e) => {\n const n = K(t), r = K(e);\n return P(n / r, jt(10 ** (E(e) - E(t))));\n}), we = 1e3, N = 1e3, k = 60, Ee = k * N, lr = k * N, X = 60, qt = X * k, Ae = qt * N, dr = qt * N, Kt = 24, Ne = Kt * X, Qt = Ne * k, Fe = Qt * N, hr = Qt * N, at = 7, Oe = at * Kt, $e = Oe * X, Xt = $e * k, Te = Xt * N, gr = Xt * N, Vt = 3, Ce = 4, Re = Ce * Vt, _e = {\n y(t, e) {\n const n = t.getFullYear();\n return e.length === 4 ? n : n % 1e3 % 100;\n },\n M(t, e) {\n const n = t.getMonth() + 1;\n return e.length === 2 ? A(n) : n;\n },\n d(t, e) {\n const n = t.getDate();\n return e.length === 2 ? A(n) : n;\n },\n H(t, e) {\n const n = t.getHours();\n return e.length === 2 ? A(n) : n;\n },\n m(t, e) {\n const n = t.getMinutes();\n return e.length === 2 ? A(n) : n;\n },\n s(t, e) {\n const n = t.getSeconds();\n return e.length === 2 ? A(n) : n;\n },\n q(t, e) {\n const n = Math.ceil((t.getMonth() + 1) / 3);\n return e.length === 2 ? A(n) : n;\n }\n}, ke = /[yMdHmsq](\\w)*|./g, xe = /'(.+?)'/g;\nfunction h(t, e = !1) {\n const n = new Date(t);\n if (e && Number.isNaN(+n))\n throw new RangeError(\"Invalid date value\");\n return typeof t == \"string\" && !t.includes(\":\") && (n.setHours(0), n.setMinutes(0), n.setSeconds(0)), n;\n}\nfunction pr(t, e = \"yyyy-MM-dd HH:mm:ss\") {\n t = h(t);\n const n = e.match(ke), r = n == null ? void 0 : n.length;\n if (!r)\n return e;\n let o = 0, i = \"\";\n for (; o < r; ) {\n const s = n[o], c = s[0], a = _e[c];\n a ? i += a(t, s) : i += s, ++o;\n }\n return i.replace(xe, \"$1\");\n}\nfunction mr(t) {\n return t = h(t), `${A(t.getHours())}:${A(t.getMinutes())}:${A(\n t.getSeconds()\n )}`;\n}\nfunction ot(t) {\n return t = h(t), Math.floor(t.getMonth() / 3) + 1;\n}\nconst De = [\"日\", \"一\", \"二\", \"三\", \"四\", \"五\", \"六\"];\nfunction br(t) {\n return De[t.getDay()];\n}\nfunction Ie(t, e) {\n return t = h(t), t.setTime(t.getTime() + e), t;\n}\nfunction Le(t, e) {\n return e *= N, Ie(t, e);\n}\nfunction He(t, e) {\n return e *= k, Le(t, e);\n}\nfunction Pe(t, e) {\n return e *= X, He(t, e);\n}\nfunction yr(t, e) {\n return e *= 12, Pe(t, e);\n}\nfunction ft(t, e) {\n return t = h(t), e = ~~e, t.setDate(t.getDate() + e), t;\n}\nfunction Mr(t, e) {\n return e *= at, ft(t, e);\n}\nfunction ut(t, e) {\n return t = h(t), e = ~~e, t.setMonth(t.getMonth() + e), t;\n}\nfunction Sr(t, e) {\n return e *= Vt, ut(t, e);\n}\nfunction wr(t, e) {\n return e *= Re, ut(t, e);\n}\nfunction Er(t, e = 42, n = 1) {\n t = h(t);\n const r = [];\n for (let o = 0; o < e; ++o)\n r.push(ft(t, o * n));\n return r;\n}\nfunction Ar(t, e = 12, n = 1) {\n t = h(t);\n const r = [];\n for (let o = 0; o < e; ++o)\n r.push(ut(t, o * n));\n return r;\n}\nfunction Nr(t) {\n const e = t.getDay() ?? 7;\n return ft(t, -e);\n}\nfunction Mt(t) {\n return t = h(t), t.setMilliseconds(0), t;\n}\nfunction St(t) {\n return t = h(t), t.setSeconds(0, 0), t;\n}\nfunction wt(t) {\n return t = h(t), t.setMinutes(0, 0, 0), t;\n}\nfunction Et(t) {\n return t = h(t), t.setHours(0, 0, 0, 0), t;\n}\nfunction Fr(t) {\n return t = h(t), t.setHours(23, 59, 59, 999), t;\n}\nfunction At(t, e = 0) {\n e = e % 7, e < 0 && (e += 7), t = h(t);\n const n = t.getDay(), r = (n < e ? 7 : 0) + n - e;\n return t.setDate(t.getDate() - r), t.setHours(0, 0, 0, 0), t;\n}\nfunction Be(t) {\n return t % 4 === 0 && t % 100 !== 0 || t % 400 === 0;\n}\nfunction Ue(t, e) {\n let n;\n return e < 7 ? e !== 2 ? n = 30 + e % 2 : Be(t) ? n = 29 : n = 28 : n = 31 - e % 2, n;\n}\nfunction Or(t, e = 1) {\n t = h(t);\n const n = t.getFullYear(), r = t.getMonth() + 1, o = t.getDate(), i = Ue(n, r);\n return e = e % i, e < 0 && (e += i), o < e && t.setMonth(r - 1), t.setDate(e), t.setHours(0, 0, 0, 0), t;\n}\nfunction $r(t) {\n t = h(t);\n const e = ot(t);\n return t.setDate(1), t.setHours(0, 0, 0, 0), t.setMonth((e - 1) * 3), t;\n}\nfunction Tr(t, e = 0) {\n e = e % 11, e < 0 && (e += 11), t = h(t);\n const n = t.getMonth(), r = (n < e ? 11 : 0) + n - e;\n return t.setMonth(t.getMonth() - r), t.setDate(1), t.setHours(0, 0, 0, 0), t;\n}\nfunction lt(t, e) {\n return t = h(t), e = h(e), e.getTime() - t.getTime();\n}\nfunction Ye(t, e) {\n const n = lt(t, e) / we;\n return n > 0 ? Math.floor(n) : Math.ceil(n);\n}\nfunction Ge(t, e) {\n const n = lt(t, e) / Ee;\n return n > 0 ? Math.floor(n) : Math.ceil(n);\n}\nfunction We(t, e) {\n const n = lt(t, e) / Ae;\n return n > 0 ? Math.floor(n) : Math.ceil(n);\n}\nfunction ze(t, e) {\n return t = Et(t), e = Et(e), (e.getTime() - t.getTime()) / Fe;\n}\nfunction Cr(t, e, n = 0) {\n return t = At(t, n), e = At(e, n), (e.getTime() - t.getTime()) / Te;\n}\nfunction je(t, e) {\n t = h(t), e = h(e);\n const n = e.getFullYear() - t.getFullYear(), r = e.getMonth() - t.getMonth();\n return n * 12 + r;\n}\nfunction Rr(t, e) {\n t = h(t), e = h(e);\n const n = e.getFullYear() - t.getFullYear(), r = ot(e) - ot(t);\n return n * 4 + r;\n}\nfunction qe(t, e) {\n return t = h(t), e = h(e), e.getFullYear() - t.getFullYear();\n}\nfunction Ke(t, e) {\n t = h(t), e = h(e);\n const n = t.getTime() - e.getTime();\n return n < 0 ? -1 : n > 0 ? 1 : n;\n}\nfunction _(t, e) {\n return -Ke(t, e);\n}\nfunction _r(t, e) {\n return t = Mt(t), e = Mt(e), Ye(t, e);\n}\nfunction kr(t, e) {\n return t = St(t), e = St(e), Ge(t, e);\n}\nfunction xr(t, e) {\n return t = wt(t), e = wt(e), We(t, e);\n}\nfunction Qe(t, e) {\n const n = _(t, e), r = Math.abs(ze(t, e));\n t = h(t), t.setDate(t.getDate() + n * r);\n const o = _(t, e) === -n;\n return n * (r - (o ? 1 : 0));\n}\nfunction Dr(t, e) {\n const n = Qe(t, e) / at;\n return n > 0 ? Math.floor(n) : Math.ceil(n);\n}\nfunction Xe(t, e) {\n const n = _(t, e), r = Math.abs(je(t, e));\n t = h(t), t.setMonth(t.getMonth() + n * r);\n const o = _(t, e) === -n;\n return n * (r - (o ? 1 : 0));\n}\nfunction Ir(t, e) {\n const n = Xe(t, e) / 3;\n return n > 0 ? Math.floor(n) : Math.ceil(n);\n}\nfunction Lr(t, e) {\n const n = _(t, e), r = Math.abs(qe(t, e));\n t = h(t), t.setFullYear(t.getFullYear() + n * r);\n const o = _(t, e) === -n;\n return n * (r - (o ? 1 : 0));\n}\nfunction Ve(t, e = {}) {\n if (t == null || typeof t != \"object\")\n return t;\n const { cloneObject: n = it } = e, r = /* @__PURE__ */ Object.create(null), o = [\n {\n parent: r,\n prop: \"root\",\n data: t\n }\n ], i = /* @__PURE__ */ new WeakMap(), s = [], c = [];\n for (; o.length; ) {\n const { parent: a, prop: f, data: u } = o.pop();\n if (!a) continue;\n const d = ae(u);\n if (d === \"Date\") {\n a[f] = new Date(u);\n continue;\n }\n if (d !== \"Array\") {\n const l = n(d, u);\n if (l != null) {\n a[f] = l;\n continue;\n }\n }\n const g = a[f] = d === \"Array\" || d === \"Set\" || d === \"Map\" ? [] : /* @__PURE__ */ Object.create(null);\n if (d === \"Set\" || d === \"Map\") {\n let l = 0;\n if (d === \"Set\") {\n for (const p of u)\n i.has(p) ? g[l] = i.get(p) : p !== null && typeof p == \"object\" ? o.push({\n parent: g,\n prop: l,\n data: p\n }) : g[l] = p, ++l;\n s.push({ parent: a, prop: f });\n } else {\n for (const p of u) {\n const b = [];\n l = 0;\n for (const m of p)\n i.has(m) ? b[l] = i.get(m) : m !== null && typeof m == \"object\" ? o.push({\n parent: b,\n prop: l,\n data: m\n }) : b[l] = m, ++l;\n g.push(b);\n }\n c.push({ parent: a, prop: f });\n }\n } else\n for (const l of Object.keys(u)) {\n const p = u[l];\n i.has(p) ? g[l] = i.get(p) : p !== null && typeof p == \"object\" ? o.push({\n parent: g,\n prop: l,\n data: p\n }) : g[l] = p;\n }\n i.set(u, g);\n }\n for (const { parent: a, prop: f } of s)\n a[f] = new Set(a[f]);\n for (const { parent: a, prop: f } of c)\n a[f] = new Map(a[f]);\n return r.root;\n}\nconst Ze = \"This object was destroyed, do not use it anywhere\", Je = () => !0;\nfunction Hr(t, e = Ze) {\n const n = () => {\n throw new Error(e);\n };\n Object.keys(t).forEach((r) => {\n typeof t[r] == \"function\" ? t[r] = n.bind(t) : t[r] = null;\n }), Object.getOwnPropertyNames(t.constructor.prototype).forEach((r) => {\n r !== \"constructor\" && typeof t[r] == \"function\" && (t[r] = n.bind(t));\n }), t.isDestroyed = Je;\n}\nconst ve = y && (\"ontouchstart\" in window || tn() > 0), Pr = ve ? \"pointerdown\" : \"click\";\nfunction tn() {\n return typeof navigator < \"u\" && (navigator.maxTouchPoints || navigator.msMaxTouchPoints) || 0;\n}\nfunction Br(t, e, n = window.Event) {\n const { type: r, bubbles: o = !1, cancelable: i = !1, ...s } = e;\n if (!M(r) || r === \"\") return !1;\n let c;\n return M(n) ? c = new n(r, { bubbles: o, cancelable: i }) : (c = document.createEvent(\"HTMLEvents\"), c.initEvent(r, o, i)), Object.assign(c, s), t.dispatchEvent(c);\n}\nconst en = [\n \"button\",\n \"[href]:not(.disabled)\",\n \"input\",\n \"select\",\n \"textarea\",\n \"[tabindex]\",\n \"[contenteditable]\"\n].map((t) => `${t}:not(:disabled):not([disabled])`).join(\", \");\nfunction V(t) {\n return !!t && t.nodeType === 1;\n}\nfunction nn(t) {\n return V(t) ? t : document.body;\n}\nfunction rn(t, e) {\n return !y || !t ? [] : Array.from(nn(e).querySelectorAll(t));\n}\nfunction Ur(t) {\n if (!y) return !1;\n const e = document.activeElement;\n return !V(t) || !e ? !1 : t === e || Zt(e, t);\n}\nfunction Zt(t, e) {\n if (!t || !e) return !1;\n const n = e.__transferElement;\n return e.contains(t) || !!n && (n === t || n.contains(t));\n}\nfunction on(t) {\n if (!y || !V(t) || !t.parentNode || !Zt(t, document.body) || t.style.display === \"none\")\n return !0;\n const e = t.getBoundingClientRect();\n return !(e && e.width > 0 && e.height > 0);\n}\nfunction sn(t) {\n return !on(t);\n}\nfunction cn(t) {\n return !V(t) || t.hasAttribute(\"disabled\") && t.getAttribute(\"disabled\") !== \"false\" || t.disabled;\n}\nfunction Yr(t, e = !1) {\n const n = e ? () => !1 : cn;\n return rn(en, t).filter(\n (r) => sn(r) && r.tabIndex > -1 && !n(r)\n );\n}\nfunction an(t) {\n if (!y || !t) return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.paddingLeft) + parseFloat(e.paddingRight) || 0;\n}\nfunction Gr(t) {\n if (!y || !t) return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.paddingTop) + parseFloat(e.paddingBottom) || 0;\n}\nfunction Wr(t) {\n if (!y || !t) return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.marginLeft) + parseFloat(e.marginRight) || 0;\n}\nfunction zr(t) {\n if (!y || !t) return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.marginTop) + parseFloat(e.marginBottom) || 0;\n}\nfunction jr(t) {\n if (!y || !t) return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.borderLeftWidth) + parseFloat(e.borderRightWidth) || 0;\n}\nfunction qr(t) {\n if (!y || !t) return 0;\n const e = getComputedStyle(t);\n return parseFloat(e.borderTopWidth) + parseFloat(e.borderBottomWidth) || 0;\n}\nfunction Kr(t) {\n if (!y || !t) return 0;\n const e = document.createRange();\n e.setStart(t, 0), e.setEnd(t, t.childNodes.length);\n const n = e.getBoundingClientRect().width, r = an(t);\n return n + r;\n}\nfunction Qr(t) {\n return ye(t, !0) ? `${Me(t)}px` : String(t).trim();\n}\nfunction Xr(t) {\n return M(t) && t !== !1 ? String(t) : void 0;\n}\nconst fn = /[\"'&<>]/;\nfunction Vr(t) {\n const e = \"\" + t, n = fn.exec(e);\n if (!n)\n return e;\n let r = \"\", o, i, s = 0;\n for (i = n.index; i < e.length; i++) {\n switch (e.charCodeAt(i)) {\n case 34:\n o = \""\";\n break;\n case 38:\n o = \"&\";\n break;\n case 39:\n o = \"'\";\n break;\n case 60:\n o = \"<\";\n break;\n case 62:\n o = \">\";\n break;\n default:\n continue;\n }\n s !== i && (r += e.substring(s, i)), s = i + 1, r += o;\n }\n return s !== i ? r + e.substring(s, i) : r;\n}\nfunction Zr() {\n const t = /* @__PURE__ */ new Map();\n return {\n on(e, n) {\n const r = t.get(e);\n (r == null ? void 0 : r.add(n)) || t.set(e, /* @__PURE__ */ new Set([n]));\n },\n off(e, n) {\n const r = t.get(e);\n r && r.delete(n);\n },\n clear(e) {\n const n = t.get(e);\n n && n.clear();\n },\n clearAll() {\n t.clear();\n },\n emit(e, ...n) {\n const r = t.get(e);\n r && r.forEach((o) => {\n o(...n);\n });\n }\n };\n}\nfunction dt(t, e, n) {\n t && !e.has(t) && (n(t), e.add(t));\n}\nconst un = /* @__PURE__ */ new Set();\nfunction Jr(t, e = console.info) {\n dt(t, un, e);\n}\nconst ln = /* @__PURE__ */ new Set();\nfunction vr(t, e = console.warn) {\n dt(t, ln, e);\n}\nconst dn = /* @__PURE__ */ new Set();\nfunction to(t, e = console.warn) {\n dt(t, dn, e);\n}\nconst ht = y ? requestAnimationFrame : (t) => {\n setTimeout(t, 16);\n};\nfunction eo(t, e = 16) {\n if (typeof t != \"function\")\n return it;\n const n = (...i) => {\n t(...i);\n };\n if (e <= 0)\n return Jt(n);\n let r = 0, o;\n return function(...i) {\n const s = Date.now(), c = s - r;\n clearTimeout(o), c >= e ? (r = s, n(...i)) : o = setTimeout(\n () => {\n r = Date.now(), n(...i);\n },\n Math.max(0, e - c)\n );\n };\n}\nfunction no(t, e = 100) {\n if (typeof t != \"function\")\n return it;\n const n = (...o) => {\n t(...o);\n };\n if (e <= 0)\n return Jt(n);\n let r;\n return function(...o) {\n clearTimeout(r), r = setTimeout(() => {\n n(...o);\n }, e);\n };\n}\nfunction Jt(t) {\n if (typeof t != \"function\")\n return t;\n let e = !1, n, r;\n return function(...o) {\n return n = o, e || (e = !0, r = Promise.resolve().then(() => (e = !1, r = void 0, t(...n)))), r;\n };\n}\nfunction ro(t) {\n if (typeof t != \"function\")\n return t;\n let e = !1, n, r;\n return function(...o) {\n return n = o, e || (e = !0, r = new Promise(\n (i) => ht(() => {\n e = !1, r = void 0, i(t(...n));\n })\n )), r;\n };\n}\nconst x = /* @__PURE__ */ new Set(), vt = /* @__PURE__ */ new WeakMap();\nfunction hn() {\n x.forEach((t) => {\n t(...vt.get(t));\n }), x.clear();\n}\nfunction oo(t, ...e) {\n if (typeof t != \"function\")\n return t;\n vt.set(t, e), !x.has(t) && (x.add(t), x.size === 1 && Promise.resolve().then(hn));\n}\nconst D = /* @__PURE__ */ new Set(), te = /* @__PURE__ */ new WeakMap();\nfunction gn() {\n D.forEach((t) => {\n t(...te.get(t));\n }), D.clear();\n}\nfunction io(t, ...e) {\n if (typeof t != \"function\")\n return t;\n te.set(t, e), !D.has(t) && (D.add(t), D.size === 1 && ht(gn));\n}\nasync function so(t, e, n) {\n const r = [], o = [];\n for (const i of e) {\n const s = Promise.resolve().then(() => n(i, e));\n if (r.push(s), t <= e.length) {\n const c = s.then(() => o.splice(o.indexOf(c), 1));\n o.push(c), o.length >= t && await Promise.race(o);\n }\n }\n return Promise.all(r);\n}\nlet nt = null;\nfunction co() {\n if (!y)\n return !0;\n if (nt === null) {\n const t = document.createElement(\"div\");\n t.style.display = \"flex\", t.style.flexDirection = \"column\", t.style.rowGap = \"1px\", t.appendChild(document.createElement(\"div\")), t.appendChild(document.createElement(\"div\")), document.body.appendChild(t), nt = t.scrollHeight === 1, document.body.removeChild(t);\n }\n return nt;\n}\nlet rt = null;\nfunction ao() {\n return y ? (rt === null && (rt = \"loading\" in document.createElement(\"img\")), rt) : !1;\n}\nfunction fo(t) {\n return Array.isArray(t) ? t : [t];\n}\nfunction uo(t, ...e) {\n return $t(t) ? t(...e) : t;\n}\nfunction lo(t) {\n return t.replace(/[\\\\/]+/g, \"/\");\n}\nfunction ho(t) {\n return t[t.length - 1];\n}\nconst Nt = (t) => t;\nfunction go(t, e, n, r) {\n let o;\n typeof n != \"function\" && r === void 0 ? (r = !!n, o = Nt) : o = typeof n == \"function\" ? n : Nt;\n const i = r ? /* @__PURE__ */ new Map() : {};\n if (!M(e)) return i;\n const s = r ? (a, f) => i.set(a, f) : (a, f) => i[a] = f, c = $t(e) ? e : (a) => a[e];\n return t.forEach((a) => {\n if (!M(a)) return;\n const f = c(a);\n M(f) && s(f, o(a));\n }), i;\n}\nfunction po(t, e, n = !1) {\n let r = -1;\n return n || typeof e != \"function\" ? r = t.findIndex((o) => o === e) : r = t.findIndex(e), ~r ? t.splice(r, 1)[0] : null;\n}\nfunction mo(t, e = []) {\n (typeof e == \"string\" || typeof e == \"function\") && (e = [e]);\n const n = e.length, r = {};\n for (const o of t) {\n let i;\n for (let s = 0; s < n; ++s) {\n const c = s === n - 1, a = e[s], f = typeof a == \"function\" ? a(o) : o[a];\n i ? (i[f] || (i[f] = c ? [] : {}), i = i[f]) : (r[f] || (r[f] = c ? [] : {}), i = r[f]);\n }\n i.push(o);\n }\n return r;\n}\nfunction bo(t, e = {}) {\n const {\n keyField: n = \"id\",\n childField: r = \"children\",\n parentField: o = \"parent\",\n rootId: i = null\n } = e, s = M(i) && i !== \"\", c = [], a = /* @__PURE__ */ new Map();\n for (let f = 0, u = t.length; f < u; ++f) {\n const d = t[f], g = d[n];\n if (!(s ? g === i : !M(g)))\n if (a.has(g) ? d[r] = a.get(g) : (d[r] = [], a.set(g, d[r])), d[o] && (!s || d[o] !== i)) {\n const l = d[o];\n a.has(l) || a.set(l, []), a.get(l).push(d);\n } else\n c.push(d);\n }\n return c;\n}\nfunction yo(t, e = {}) {\n const {\n keyField: n = \"id\",\n childField: r = \"children\",\n parentField: o = \"parent\",\n rootId: i = null,\n depthFirst: s = !1,\n injectId: c = !0,\n buildId: a = (m) => m,\n filter: f = ce,\n cascaded: u = !1,\n forceInject: d = !1\n } = e;\n let g = 1;\n const l = M(i) && i !== \"\", p = [], b = [...t];\n for (; b.length; ) {\n const m = b.shift(), Z = m[r], J = Array.isArray(Z) && Z.length ? Z : [];\n c && (d || !m[n]) && (m[n] = a(g++));\n const ee = m[n];\n c && o && (l ? m[o] === i : !m[o]) && (m[o] = i);\n const gt = f(m);\n if (gt && p.push(m), gt || !u) {\n for (let v = 0, ne = J.length; v < ne; ++v) {\n const pt = J[v];\n c && o && (pt[o] = ee), !s && b.push(pt);\n }\n s && b.unshift(...J);\n }\n }\n return p;\n}\nfunction Mo(t, e, n = {}) {\n const { childField: r = \"children\", depthFirst: o = !1 } = n, i = [...t.map((s) => ({ item: s, depth: 0, parent: null }))];\n for (; i.length; ) {\n const { item: s, depth: c, parent: a } = i.shift(), f = s[r];\n e(s, c, a), G(f) && i[o ? \"unshift\" : \"push\"](\n ...Array.from(f).map((u) => ({ item: u, depth: c + 1, parent: s }))\n );\n }\n}\nfunction So(t, e, n = {}) {\n const { childField: r = \"children\", depthFirst: o = !1, clearChildren: i = !0 } = n, s = [], c = [...t.map((a) => ({ item: a, depth: 0, parent: null, result: s }))];\n for (; c.length; ) {\n const { item: a, depth: f, parent: u, result: d } = c.shift(), g = a[r], l = e(a, f, u) ?? {};\n i && (l[r] = []), d.push(l), G(g) && Array.from(g).length && (l[r] = [], c[o ? \"unshift\" : \"push\"](\n ...Array.from(g).map((b) => ({\n item: b,\n depth: f + 1,\n parent: a,\n result: l[r]\n }))\n ));\n }\n return s;\n}\nfunction wo(t, e, n = {}) {\n const {\n childField: r = \"children\",\n leafOnly: o = !1,\n isLeaf: i = (c) => !G(c[r])\n } = n, s = (c, a, f) => c.map((u) => ({ ...u })).filter((u) => {\n const d = u[r], g = i(u), l = G(d) && Array.from(d);\n if (o && !g) {\n if (l && l.length) {\n const b = s(l, a + 1, u);\n return u[r] = b, !!b.length;\n }\n return !1;\n }\n const p = e(u, a, f);\n if (g) return p;\n if (!o && p) return !0;\n if (l && l.length) {\n const b = s(l, a + 1, u);\n return u[r] = b, !!b.length;\n }\n return p;\n });\n return s(t, 0, null);\n}\nconst Ft = (t, e) => Number.isNaN(Number(t) - Number(e)) ? String(t).localeCompare(e) : t - e;\nfunction Eo(t, e) {\n if (!t.sort || Y(e) && !e.key || !e.length)\n return t;\n const n = Array.from(t);\n Array.isArray(e) || (e = [e]);\n const r = e.map(\n (o) => typeof o == \"string\" ? {\n key: o,\n method: Ft,\n type: \"asc\"\n } : o\n ).map((o) => (typeof o.accessor != \"function\" && (o.accessor = (i) => i[o.key]), typeof o.method != \"function\" && (o.method = Ft), o.params = Array.isArray(o.params) ? o.params : [], o));\n return n.sort((o, i) => {\n let s = 0;\n for (const c of r) {\n const { method: a, type: f, accessor: u, params: d } = c, g = f === \"desc\", l = a(u(o, ...d), u(i, ...d));\n if (s = g ? -l : l, s) break;\n }\n return s;\n }), n;\n}\nfunction Ao(t, e, n = !0) {\n t = n ? Ve(t) : t;\n const r = [\n {\n source: t,\n target: e\n }\n ];\n for (; r.length; ) {\n const { source: o, target: i } = r.pop();\n Object.keys(i).forEach((s) => {\n Y(i[s]) ? (Y(o[s]) || (o[s] = /* @__PURE__ */ Object.create(null)), r.push({\n source: o[s],\n target: i[s]\n })) : Array.isArray(i[s]) ? (Array.isArray(o[s]) || (o[s] = []), r.push({\n source: o[s],\n target: i[s]\n })) : o[s] = i[s];\n });\n }\n return t;\n}\nfunction No(t) {\n t = Array.from(t);\n let e = !1;\n const n = () => {\n var r;\n e || ((r = t.shift()) == null || r(), t.length && ht(n));\n };\n return n(), () => e = !0;\n}\nfunction pn(t) {\n const e = t.match(/[A-Z]+/);\n return e && e[0] === t;\n}\nconst mn = /\\B([A-Z])(?=[^A-Z_-])/g;\nfunction Fo(t) {\n return t.replace(mn, \"-$1\").toLowerCase();\n}\nfunction bn(t) {\n return t = t.trim().replace(/\\s+/g, \"-\"), t = t.replace(/-+(\\w)/g, (e, n) => n ? n.toUpperCase() : \"\"), (t.charAt(0).toLocaleUpperCase() + t.slice(1)).replace(\n /[^\\w]/g,\n \"\"\n );\n}\nfunction Oo(t) {\n const e = bn(t);\n return pn(e) ? e.toLocaleLowerCase() : e.charAt(0).toLowerCase() + e.slice(1);\n}\nexport {\n Pr as CLICK_TYPE,\n de as COLOR_NAMES,\n Kt as DAY_ON_HOURS,\n hr as DAY_ON_MILLISECONDS,\n Fe as DAY_ON_MILLS,\n Ne as DAY_ON_MINUTES,\n Qt as DAY_ON_SECONDS,\n Dt as HEX_REG_3,\n It as HEX_REG_4,\n Lt as HEX_REG_6,\n Ht as HEX_REG_8,\n dr as HOUR_ON_MILLISECONDS,\n Ae as HOUR_ON_MILLS,\n X as HOUR_ON_MINUTES,\n qt as HOUR_ON_SECONDS,\n _t as HSLA_REG,\n Rt as HSL_REG,\n xt as HSVA_REG,\n kt as HSV_REG,\n lr as MINUTE_ON_MILLISECONDS,\n Ee as MINUTE_ON_MILLS,\n k as MINUTE_ON_SECONDS,\n W as NAMED_COLORS,\n Vt as QUARTER_ON_MONTHS,\n Ct as RGBA_REG,\n Tt as RGB_REG,\n N as SECOND_ON_MILLISECONDS,\n we as SECOND_ON_MILLS,\n ve as USE_TOUCH,\n at as WEEK_ON_DAYS,\n Oe as WEEK_ON_HOURS,\n gr as WEEK_ON_MILLISECONDS,\n Te as WEEK_ON_MILLS,\n $e as WEEK_ON_MINUTES,\n Xt as WEEK_ON_SECONDS,\n Re as YEAR_ON_MONTHS,\n Ce as YEAR_ON_QUARTERS,\n ft as addDays,\n yr as addHalfDays,\n Pe as addHours,\n Ie as addMilliseconds,\n He as addMinutes,\n ut as addMonths,\n Sr as addQuarters,\n Le as addSeconds,\n Mr as addWeeks,\n wr as addYears,\n zn as adjustAlpha,\n rr as boundRange,\n bo as buildTree,\n uo as callIfFunc,\n Ke as compareAsc,\n _ as compareDesc,\n Zt as contains,\n Jn as createBITree,\n Zn as createCounter,\n Zr as createEventEmitter,\n no as debounce,\n ro as debounceFrame,\n Jt as debounceMinor,\n Pn as decide,\n E as decimalLength,\n Ve as deepClone,\n Hr as destroyObject,\n ze as differenceDays,\n Qe as differenceFullDays,\n xr as differenceFullHours,\n kr as differenceFullMinutes,\n Xe as differenceFullMonths,\n Ir as differenceFullQuarters,\n _r as differenceFullSeconds,\n Dr as differenceFullWeeks,\n Lr as differenceFullYears,\n We as differenceHours,\n lt as differenceMilliseconds,\n Ge as differenceMinutes,\n je as differenceMonths,\n Rr as differenceQuarters,\n Ye as differenceSeconds,\n Cr as differenceWeeks,\n qe as differenceYears,\n vn as digitLength,\n Br as dispatchEvent,\n ur as divide,\n A as doubleDigits,\n Fr as endOfDay,\n fo as ensureArray,\n to as errorOnce,\n Vr as escapeHtml,\n wo as filterTree,\n yo as flatTree,\n pr as format,\n sr as formatByteSize,\n br as getChineseWeek,\n Xn as getGlobalCount,\n ho as getLast,\n Ue as getLastDayOfMonth,\n Nr as getLastSunday,\n ot as getQuarter,\n Kr as getRangeWidth,\n mr as getTime,\n ae as getType,\n jr as getXBorder,\n Wr as getXMargin,\n an as getXPadding,\n qr as getYBorder,\n zr as getYMargin,\n Gr as getYPadding,\n mo as groupByProps,\n Mn as has,\n ge as hslToHsv,\n Pt as hslToRgb,\n Gn as hsvToHsl,\n pe as hsvToRgb,\n Jr as infoOnce,\n B as is,\n $n as isArray,\n On as isBigInt,\n En as isBoolean,\n y as isClient,\n Un as isColor,\n _n as isDate,\n M as isDefined,\n cn as isDisabled,\n Dn as isElement,\n xn as isEmpty,\n Nn as isFalse,\n Ur as isFocusIn,\n $t as isFunction,\n on as isHidden,\n yn as isIOS,\n G as isIterable,\n Be as isLeapYear,\n Rn as isMap,\n se as isNaN,\n ie as isNull,\n Sn as isNumber,\n Y as isObject,\n Tn as isPromise,\n kn as isRegExp,\n Cn as isSet,\n wn as isString,\n Fn as isSymbol,\n An as isTrue,\n ye as isValidNumber,\n sn as isVisible,\n or as leaveNumber,\n go as listToMap,\n So as mapTree,\n Ao as mergeObjects,\n fr as minus,\n Wn as mixColor,\n er as multipleFixed,\n io as nextFrameOnce,\n oo as nextTickOnce,\n it as noop,\n C as normalizeAlpha,\n z as normalizeHsl,\n j as normalizeHsv,\n lo as normalizePath,\n R as normalizeRgb,\n be as numberRE,\n ir as ordinalNumber,\n Se as padStartZeros,\n Yn as parseColor,\n O as parseColorToRgba,\n he as parseStringColor,\n ar as plus,\n rn as queryAll,\n Yr as queryTabables,\n ht as raf,\n cr as random,\n jn as randomColor,\n qn as randomHardColor,\n Yt as randomPreferColor,\n Kn as randomSoftColor,\n Hn as randomString,\n Ln as range,\n Er as rangeDate,\n Ar as rangeMonth,\n po as removeArrayItem,\n st as rgbToHex,\n Bt as rgbToHsl,\n Ut as rgbToHsv,\n ct as rgbaToHex,\n nr as round,\n so as runParallel,\n No as runQueueFrame,\n tr as segmentNumber,\n Vn as setGlobalCount,\n Eo as sortByProps,\n Et as startOfDay,\n wt as startOfHour,\n St as startOfMinute,\n Or as startOfMonth,\n $r as startOfQuarter,\n Mt as startOfSecond,\n At as startOfWeek,\n Tr as startOfYear,\n co as supportFlexGap,\n ao as supportImgLoading,\n eo as throttle,\n P as times,\n Xr as toAttrValue,\n Oo as toCamelCase,\n bn as toCapitalCase,\n Qr as toCssSize,\n h as toDate,\n In as toFalse,\n zt as toFixed,\n Qn as toGrayScale,\n Fo as toKebabCase,\n Me as toNumber,\n jt as toPrecision,\n ce as toTrue,\n go as transformListToMap,\n bo as transformTree,\n Mo as walkTree,\n vr as warnOnce,\n Bn as writeClipboard\n};\n//# sourceMappingURL=index.mjs.map\n","import { computed, getCurrentScope, onScopeDispose, unref, watch } from 'vue'\n\nimport { noop } from '@vexip-ui/utils'\n\nimport type { MaybeRef } from 'vue'\n\nexport interface UseListenerOptions extends AddEventListenerOptions {\n /**\n * 是否禁用整个 hook 的事件处理\n */\n disabled?: MaybeRef\n}\n\nexport function useListener(\n target: MaybeRef,\n event: string,\n listener: (event: E) => any,\n options?: UseListenerOptions | boolean,\n) {\n if (!target) {\n return noop\n }\n\n const normalizedOptions = computed(() => {\n if (typeof options === 'boolean') {\n return { capture: options }\n }\n\n return options || {}\n })\n\n let remove = noop\n\n const stopWatch = watch(\n () => unref(target),\n el => {\n remove()\n\n if (!el) {\n return\n }\n\n const { disabled, ...opts } = normalizedOptions.value\n const handler = (event: Event) => {\n if (!unref(disabled)) {\n listener(event as E)\n }\n }\n\n el.addEventListener(event, handler, opts)\n\n remove = () => {\n el.removeEventListener(event, handler, opts)\n remove = noop\n }\n },\n { immediate: true, flush: 'post' },\n )\n\n const stop = () => {\n stopWatch()\n remove()\n }\n\n getCurrentScope() && onScopeDispose(stop)\n\n return stop\n}\n","import { getCurrentScope, onScopeDispose, ref, unref, watch } from 'vue'\n\nimport { CLICK_TYPE, dispatchEvent, isClient, noop } from '@vexip-ui/utils'\nimport { useListener } from './listener'\n\nimport type { Ref } from 'vue'\nimport type { TransferNode } from '@vexip-ui/utils'\n\nexport const CLICK_OUTSIDE = 'clickoutside'\n\nconst elements = new Set()\n\nif (isClient) {\n document.addEventListener(\n CLICK_TYPE,\n (event: Event) => {\n const target = event.target as Node | null\n const path = event.composedPath && event.composedPath()\n\n elements.forEach(el => {\n if (\n el !== target &&\n (path ? !path.includes(el) : !el.contains(target)) &&\n (!el.__transferElement ||\n (el.__transferElement !== target && !el.__transferElement.contains(target)))\n ) {\n dispatchEvent(el, { type: CLICK_OUTSIDE })\n }\n })\n },\n true,\n )\n}\n\n/**\n * 创建一个可以添加 clickoutside 事件的元素 Ref\n *\n * @param handler 事件的回调方法\n * @param target 需要处理的元素 ref,可不传\n */\nexport function useClickOutside(\n handler: () => void,\n target: Ref = ref(null),\n) {\n let remove = noop\n\n const stopWatch = watch(\n () => unref(target),\n el => {\n remove()\n\n if (!el) {\n return\n }\n\n elements.add(el)\n\n remove = () => {\n elements.delete(el)\n remove = noop\n }\n },\n { immediate: true, flush: 'post' },\n )\n\n const stop = () => {\n stopWatch()\n remove()\n }\n\n getCurrentScope() && onScopeDispose(stop)\n useListener(target, CLICK_OUTSIDE, handler)\n\n return target\n}\n","import { nextTick, onBeforeUnmount, onMounted, ref } from 'vue'\n\nimport { noop } from '@vexip-ui/utils'\n\nimport type { Ref } from 'vue'\n\n/**\n * 创建一个观察了最近的上级元素 display 变化的元素 Ref\n *\n * @param displayInit 元素初次显示后执行的回调\n * @returns 观察了 display 变化的元素 Ref\n */\nexport function useDisplay(\n displayInit = noop,\n element: Ref = ref(null),\n) {\n let observer: MutationObserver | null\n\n onMounted(() => {\n nextTick(() => {\n const hiddenParentNode = queryOutsideHiddenElement(element.value)\n\n if (hiddenParentNode) {\n observer = new MutationObserver(() => {\n if (hiddenParentNode.style.display !== 'none') {\n if (typeof displayInit === 'function') {\n displayInit()\n }\n\n observer?.disconnect()\n observer = null\n }\n })\n\n observer.observe(hiddenParentNode, {\n attributes: true,\n childList: true,\n characterData: true,\n attributeFilter: ['style'],\n })\n } else {\n typeof displayInit === 'function' && displayInit()\n }\n })\n })\n\n onBeforeUnmount(() => {\n observer?.disconnect()\n observer = null\n })\n\n return element\n}\n\nexport function queryOutsideHiddenElement(el?: Element | null) {\n if (el) {\n let parentElement = el.parentElement\n\n while (parentElement && parentElement !== document.body) {\n if (parentElement.style.display === 'none') {\n return parentElement\n }\n\n parentElement = parentElement.parentElement\n }\n }\n\n return null\n}\n\nexport function isHiddenElement(el?: HTMLElement | null) {\n if (el?.style.display !== 'none') {\n return !!queryOutsideHiddenElement(el)\n }\n\n return true\n}\n","import {\n Comment,\n Fragment,\n createTextVNode,\n isVNode,\n readonly,\n ref,\n renderSlot,\n toRef,\n unref,\n watch,\n} from 'vue'\n\nimport { ensureArray, isClient, noop } from '@vexip-ui/utils'\n\nimport type {\n ComponentPublicInstance,\n MaybeRef,\n Ref,\n Slots,\n VNode,\n VNodeChild,\n VNodeNormalizedChildren,\n} from 'vue'\nimport type { MaybeElement, MaybeInstance } from './types'\n\nexport function createSlotRender(\n slots: Slots,\n names: string[]\n): ((params?: any) => VNodeChild) | null\nexport function createSlotRender(\n slots: Slots,\n names: string[],\n fallback: (params?: any) => VNodeChild\n): (params?: any) => VNodeChild\nexport function createSlotRender(\n slots: Slots,\n names: string[],\n fallback?: (params?: any) => VNodeChild,\n) {\n for (const name of names) {\n if (slots[name]) {\n return (params: any) =>\n renderSlot(slots, name, params, () => {\n const vnodes = fallback?.(params)\n\n return vnodes ? ensureArray(vnodes) : []\n })\n }\n }\n\n return fallback || null\n}\n\nexport function flatVNodes(children: VNodeNormalizedChildren) {\n const result: VNode[] = []\n const loop = Array.isArray(children) ? [...children] : []\n\n while (loop.length) {\n const vnode = loop.shift()!\n\n if (vnode === null) continue\n\n if (Array.isArray(vnode)) {\n loop.unshift(...vnode)\n }\n\n if (\n typeof vnode !== 'string' &&\n typeof vnode !== 'number' &&\n (!isVNode(vnode) || vnode.type === Comment)\n ) {\n continue\n }\n\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n result.push(createTextVNode(String(vnode)))\n } else if (vnode.type === Fragment && Array.isArray(vnode.children)) {\n loop.unshift(vnode.children)\n } else {\n result.push(vnode)\n }\n }\n\n return result\n}\n\nexport function unrefElement(\n ref: MaybeRef,\n): T extends string | ComponentPublicInstance ? MaybeElement : T {\n const plain = unref(ref)\n\n if (typeof plain === 'string') {\n return (isClient ? document.querySelector(plain) : null) as any\n }\n\n return (plain as ComponentPublicInstance)?.$el ?? plain\n}\n\nexport function proxyExposed(vnode: VNode): T {\n return new Proxy({} as any, {\n get(_, key) {\n if (!vnode.component) return undefined\n\n return (\n (vnode.component.proxy as any)?.[key] ??\n (vnode.component.exposeProxy as any)?.[key] ??\n (vnode.component.exposed as any)?.[key]\n )\n },\n }) as T\n}\n\nexport function watchPauseable(...args: Parameters) {\n const active = ref(true)\n const handle = args[1] || noop\n\n function pause() {\n active.value = false\n }\n\n function resume() {\n active.value = true\n }\n\n const stop = watch(\n args[0],\n (...callbackArgs) =>\n new Promise((resolve, reject) => {\n if (active.value) {\n Promise.resolve(handle(...callbackArgs))\n .then(resolve)\n .catch(reject)\n }\n }),\n args[2],\n )\n\n return { active: readonly(active), pause, resume, stop }\n}\n\nexport function pickToRefs, K extends keyof T>(reactive: T, keys: K[]) {\n return keys.map(key => toRef(reactive, key)) as { [P in K]: Ref }\n}\n","import { computed, getCurrentScope, isRef, onScopeDispose, ref, watch } from 'vue'\n\nimport { isClient, noop } from '@vexip-ui/utils'\nimport { unrefElement } from './shared/utils'\n\nimport type { ComputedRef, MaybeRef, Ref } from 'vue'\nimport type { MaybeInstance } from './shared/types'\n\nexport interface UseFullScreenResult {\n target: Ref,\n supported: boolean,\n full: ComputedRef,\n enter: (force?: boolean) => Promise,\n exit: (force?: boolean) => Promise,\n toggle: (force?: boolean) => Promise\n}\n\ntype PropertiesMap = [\n 'requestFullscreen',\n 'exitFullscreen',\n 'fullscreenElement',\n 'fullscreenEnabled',\n 'fullscreenchange',\n 'fullscreenerror',\n]\n\nconst functionsMap = [\n [\n 'requestFullscreen',\n 'exitFullscreen',\n 'fullscreenElement',\n 'fullscreenEnabled',\n 'fullscreenchange',\n 'fullscreenerror',\n ],\n // New WebKit\n [\n 'webkitRequestFullscreen',\n 'webkitExitFullscreen',\n 'webkitFullscreenElement',\n 'webkitFullscreenEnabled',\n 'webkitfullscreenchange',\n 'webkitfullscreenerror',\n ],\n // Old WebKit\n [\n 'webkitRequestFullScreen',\n 'webkitCancelFullScreen',\n 'webkitCurrentFullScreenElement',\n 'webkitCancelFullScreen',\n 'webkitfullscreenchange',\n 'webkitfullscreenerror',\n ],\n [\n 'mozRequestFullScreen',\n 'mozCancelFullScreen',\n 'mozFullScreenElement',\n 'mozFullScreenEnabled',\n 'mozfullscreenchange',\n 'mozfullscreenerror',\n ],\n [\n 'msRequestFullscreen',\n 'msExitFullscreen',\n 'msFullscreenElement',\n 'msFullscreenEnabled',\n 'MSFullscreenChange',\n 'MSFullscreenError',\n ],\n] as PropertiesMap[]\n\nlet map!: PropertiesMap\n\nif (isClient) {\n for (const m of functionsMap) {\n if (m[1] in document) {\n map = m\n break\n }\n }\n}\n\nconst supported = !!map\nconst notSupportedResult = {\n supported,\n full: computed(() => false),\n enter: noop,\n exit: noop,\n toggle: noop,\n}\n\nconst states = new Set>()\nconst subscriptions = new WeakMap>()\n\nif (isClient && map) {\n const ELEMENT = map[2]\n const EVENT = map[4]\n\n document.addEventListener(\n EVENT,\n () => {\n states.forEach(state => {\n state.value = false\n })\n\n if (document[ELEMENT]) {\n const full = subscriptions.get(document[ELEMENT])\n\n if (full) {\n full.value = true\n }\n }\n },\n false,\n )\n}\n\nexport function useFullScreen(target: MaybeRef = ref(null)): UseFullScreenResult {\n const targetRef = computed({\n get: () => unrefElement(target),\n set: el => {\n if (isRef(target)) {\n target.value = el\n }\n },\n })\n\n if (!isClient || !supported) {\n return { ...notSupportedResult, target: targetRef }\n }\n\n const [REQUEST, EXIT, ELEMENT] = map\n const full = ref(false)\n\n watch(\n () => unrefElement(target),\n (el, old) => {\n old && subscriptions.delete(old)\n el && subscriptions.set(el, full)\n },\n { immediate: true, flush: 'post' },\n )\n\n states.add(full)\n\n if (getCurrentScope()) {\n onScopeDispose(exit)\n }\n\n async function enter(force = false) {\n await exit()\n\n const el = unrefElement(target)\n\n if (el) {\n if (force || !document[ELEMENT]) {\n await el[REQUEST]()\n full.value = true\n\n return document[ELEMENT] === el\n }\n }\n\n return false\n }\n\n async function exit(force = false) {\n const el = unrefElement(target)\n\n if (force || (document[ELEMENT] && document[ELEMENT] === el)) {\n await document[EXIT]()\n full.value = false\n\n return document[ELEMENT] !== el\n }\n\n return false\n }\n\n async function toggle(force = false) {\n return full.value ? await exit(force) : await enter(force)\n }\n\n return {\n supported,\n target: targetRef,\n full: computed(() => full.value),\n enter,\n exit,\n toggle,\n }\n}\n","import { ref } from 'vue'\n\nimport { useListener } from './listener'\n\nimport type { Ref } from 'vue'\n\nexport function useHover(wrapper: Ref = ref(null)) {\n const isHover = ref(false)\n\n useListener(wrapper, 'mouseenter', enterWrapper)\n useListener(wrapper, 'mouseleave', leaveWrapper)\n\n function enterWrapper() {\n isHover.value = true\n }\n\n function leaveWrapper() {\n isHover.value = false\n }\n\n return { wrapper, isHover }\n}\n","import { getCurrentScope, onScopeDispose, ref, unref, watch } from 'vue'\n\nimport { ensureArray, isClient, noop, toNumber } from '@vexip-ui/utils'\n\nimport type { Ref } from 'vue'\n\nexport type IntersectionHandler = (entry: IntersectionObserverEntry) => any\nexport type UseIntersectionOptions = IntersectionObserverInit & {\n /**\n * 元素交叉状态变化时的回调方法\n */\n handler: IntersectionHandler,\n /**\n * 作用的目标元素的 Ref\n */\n target?: Ref\n}\n\nconst observerCache = new WeakMap<\n Element | Document,\n Map<\n string,\n Map<\n string,\n { ob: IntersectionObserver, count: number, handlers: WeakMap }\n >\n >\n>()\n\nconst spaceRE = /\\s+/g\nconst unitRE = /(px|%)$/\n\nexport function useIntersection(options: UseIntersectionOptions) {\n const target = options.target || ref(null)\n\n if (!isClient) {\n return { target, disconnect: noop }\n }\n\n const { handler } = options\n\n let root = options.root ?? document\n\n const threshold = ensureArray(options.threshold || 0).join() || '0'\n const margin = normalizeMargin(options.rootMargin)\n\n if (!observerCache.has(root)) {\n observerCache.set(root, new Map())\n }\n\n const thresholdCache = observerCache.get(root)!\n\n if (!thresholdCache.has(threshold)) {\n thresholdCache.set(threshold, new Map())\n }\n\n const marginCache = thresholdCache.get(threshold)!\n\n if (!marginCache.has(margin)) {\n marginCache.set(margin, {\n ob: new IntersectionObserver(handleIntersect, { ...options, rootMargin: margin }),\n count: 0,\n handlers: new WeakMap(),\n })\n }\n\n let state = marginCache.get(margin)\n let { ob: observer, handlers } = state!\n\n let remove = noop\n\n const stopWatch = watch(\n () => unref(target),\n el => {\n remove()\n\n if (!el || !observer) {\n return\n }\n\n handlers.set(el, handler)\n observer.observe(el)\n state && state.count++\n\n remove = () => {\n observer.unobserve(el)\n handlers.delete(el)\n state && state.count--\n remove = noop\n }\n },\n { immediate: true, flush: 'post' },\n )\n\n getCurrentScope() && onScopeDispose(disconnect)\n\n function normalizeMargin(margin?: string) {\n if (!margin || !margin.trim()) return '_'\n\n const parts = margin.trim().split(spaceRE, 4)\n parts.length = 4\n\n for (let i = 0; i < 4; ++i) {\n const part = parts[i]\n\n parts[i] = unitRE.test(part) ? part : `${toNumber(part)}px`\n }\n\n return parts.join(' ')\n }\n\n function handleIntersect(entries: IntersectionObserverEntry[]) {\n for (let i = 0, len = entries.length; i < len; ++i) {\n const entry = entries[i]\n const handler = handlers.get(entry.target)\n\n if (typeof handler === 'function') {\n handler(entry)\n }\n }\n }\n\n function disconnect() {\n stopWatch()\n remove()\n\n if (!state) return\n\n if (state.count <= 0) {\n marginCache.delete(margin)\n\n if (!marginCache.size) {\n thresholdCache.delete(threshold)\n\n if (!thresholdCache.size) {\n observerCache.delete(root)\n }\n }\n }\n\n state = undefined\n observer = undefined!\n handlers = undefined!\n root = undefined!\n }\n\n return { target, disconnect }\n}\n","import { customRef } from 'vue'\n\nexport function useManualRef() {\n const updateSet = new Set<() => void>()\n\n function manualRef(value: T) {\n return customRef((track, trigger) => {\n let origin = value\n\n const update = () => {\n if (value !== origin) {\n origin = value\n trigger()\n }\n }\n\n return {\n get: () => (track(), value),\n set: newValue => {\n if (newValue === value) return\n\n value = newValue\n updateSet.add(update)\n },\n }\n })\n }\n\n function triggerUpdate() {\n for (const trigger of updateSet) {\n trigger()\n }\n\n updateSet.clear()\n }\n\n return { updateSet, manualRef, triggerUpdate }\n}\n","import { computed, isRef, reactive, ref, unref } from 'vue'\n\nimport { noop } from '@vexip-ui/utils'\nimport { useListener } from './listener'\n\nimport type { MaybeRef, Ref } from 'vue'\n\nexport type ModifierState = Readonly<\n Omit, 'activeKeys'> & {\n activeKeys: Set,\n resetAll: () => void\n }\n>\n\nexport interface UseModifierOptions {\n /**\n * 作用的目标元素的 Ref\n */\n target?: Ref,\n /**\n * 是否禁用整个 hook 的事件处理\n */\n disabled?: MaybeRef,\n /**\n * 配置键名的别名,会与默认别名动态合并\n */\n aliasMap?: Record,\n /**\n * 是否在目标元素失去焦点时重置修饰符\n *\n * @default true\n */\n autoReset?: boolean,\n /**\n * 事件的 capture 选项\n *\n * @default false\n */\n capture?: boolean,\n /**\n * 事件的 passive 选项\n *\n * @default true\n */\n passive?: boolean,\n /**\n * 是否严格匹配目标元素\n */\n strictTarget?: boolean,\n /**\n * 键按下的事件回调函数\n */\n onKeyDown?: (event: KeyboardEvent, modifier: ModifierState) => void,\n /**\n * 键抬起的时间回调函数\n */\n onKeyUp?: (event: KeyboardEvent, modifier: ModifierState) => void\n}\n\nconst defaultAliasMap: Record = {\n ctrl: 'control',\n command: 'meta',\n cmd: 'meta',\n option: 'alt',\n up: 'arrowup',\n down: 'arrowdown',\n left: 'arrowleft',\n right: 'arrowright',\n}\n\nconst separatorRE = /[+_-]/\nconst splitRE = /[+_-]/g\n\nconst internalProps = ['activeKeys', 'resetAll']\n\nexport function useModifier(options: UseModifierOptions = {}) {\n const {\n autoReset = true,\n capture = false,\n passive = true,\n strictTarget = false,\n onKeyDown = noop,\n onKeyUp = noop,\n } = options\n\n const target = options.target || ref(null)\n const disabled = isRef(options.disabled) ? options.disabled : ref(options.disabled || false)\n const aliasMap = { ...defaultAliasMap, ...(options.aliasMap || {}) }\n const activeKeys = reactive(new Set())\n const metaDeps = new Set()\n const modifier: Record = reactive({ activeKeys, resetAll })\n\n function setModifier(key: string, value: boolean) {\n if (key in modifier) {\n modifier[key] = value\n }\n }\n\n function updateModifier(event: KeyboardEvent, value: boolean) {\n const key = event.key?.toLocaleLowerCase()\n const code = event.code?.toLocaleLowerCase()\n const keys = [code, key].filter(Boolean)\n\n for (const key of keys) {\n activeKeys[value ? 'add' : 'delete'](key)\n setModifier(key, value)\n }\n\n if (!value && key === 'meta') {\n for (const key of metaDeps) {\n activeKeys.delete(key)\n setModifier(key, false)\n }\n\n metaDeps.clear()\n } else if (\n value &&\n typeof event.getModifierState === 'function' &&\n event.getModifierState('Meta')\n ) {\n for (const key of [...activeKeys, ...keys]) {\n metaDeps.add(key)\n }\n }\n }\n\n function resetAll() {\n Object.keys(modifier).forEach(key => {\n modifier[key] = false\n })\n\n modifier.activeKeys = activeKeys\n modifier.resetAll = resetAll\n }\n\n const modifierProxy = new Proxy(modifier, {\n get(target, prop, receiver) {\n if (typeof prop !== 'string' || internalProps.includes(prop)) {\n return Reflect.get(target, prop, receiver)\n }\n\n prop = prop.toLocaleLowerCase()\n\n if (prop in aliasMap) {\n prop = aliasMap[prop]\n }\n\n if (!(prop in modifier)) {\n if (separatorRE.test(prop)) {\n const keys = prop.split(splitRE).map(key => key.trim())\n\n modifier[prop] = computed(() => keys.every(key => unref(modifierProxy[key])))\n } else {\n modifier[prop] = ref(activeKeys.has(prop))\n }\n }\n\n return unref(Reflect.get(target, prop, receiver))\n },\n })\n\n useListener(\n target,\n 'keydown',\n (event: KeyboardEvent) => {\n if (strictTarget && event.target !== unref(target)) {\n return\n }\n\n updateModifier(event, true)\n onKeyDown(event, modifierProxy)\n },\n { capture, passive, disabled },\n )\n useListener(\n target,\n 'keyup',\n (event: KeyboardEvent) => {\n if (strictTarget && event.target !== unref(target)) {\n return\n }\n\n updateModifier(event, false)\n onKeyUp(event, modifierProxy)\n },\n { capture, passive, disabled },\n )\n\n if (autoReset) {\n useListener(target, 'blur', resetAll, { capture, passive, disabled })\n }\n\n return { target, modifier: modifierProxy as ModifierState }\n}\n","import { nextTick, onBeforeUnmount, onMounted, readonly, ref } from 'vue'\n\nexport function useMounted(wait?: 'tick' | 'frame') {\n const isMounted = ref(false)\n\n const mount = () => (isMounted.value = true)\n\n onMounted(() => {\n if (wait === 'tick') {\n nextTick(mount)\n } else if (wait === 'frame') {\n requestAnimationFrame(mount)\n } else {\n mount()\n }\n })\n\n onBeforeUnmount(() => {\n isMounted.value = false\n })\n\n return { isMounted: readonly(isMounted) }\n}\n","import { computed, isRef, ref } from 'vue'\n\nimport { throttle } from '@vexip-ui/utils'\nimport { useListener } from './listener'\n\nimport type { MaybeRef, Ref } from 'vue'\n\nexport interface MovingState {\n xStart: number,\n yStart: number,\n xEnd: number,\n yEnd: number,\n clientX: number,\n clientY: number,\n deltaX: number,\n deltaY: number,\n lazy: boolean,\n [custom: string]: unknown\n}\n\nexport interface UseMovingOptions {\n /**\n * 作用的目标元素的 Ref\n */\n target?: Ref,\n /**\n * 横向位置的初始值\n */\n x?: MaybeRef,\n /**\n * 纵向位置的初始值\n */\n y?: MaybeRef,\n /**\n * 为否为懒加载,开启后会在 End 事件再更新位置状态\n */\n lazy?: MaybeRef,\n /**\n * 是否禁用整个 hook 的事件处理\n */\n disabled?: MaybeRef,\n /**\n * 事件的 capture 选项\n *\n * @default true\n */\n capture?: boolean,\n /**\n * 是否阻止 MouseDown 事件冒泡和默认行为\n *\n * @default true\n */\n stopMouse?: boolean,\n /**\n * 是否阻止 TouchStart 事件冒泡和默认行为\n *\n * @default true\n */\n stopTouch?: boolean,\n /**\n * 移动开始时的回调函数,返回 false 可以阻止本次移动\n */\n onStart?: (state: MovingState, event: PointerEvent) => any,\n /**\n * 移动中的回调函数\n */\n onMove?: (state: MovingState, event: PointerEvent) => void,\n /**\n * 移动结束时的回调函数\n */\n onEnd?: (state: MovingState, event: PointerEvent) => void\n}\n\nfunction disableEvent(event: E) {\n if (event.cancelable) {\n event.stopPropagation()\n event.preventDefault()\n }\n}\n\nexport function useMoving(options: UseMovingOptions) {\n const target = options.target || ref(null)\n const x = isRef(options.x) ? options.x : ref(0)\n const y = isRef(options.y) ? options.y : ref(0)\n const lazy = isRef(options.lazy) ? options.lazy : ref(options.lazy || false)\n const disabled = isRef(options.disabled) ? options.disabled : ref(options.disabled || false)\n\n const { capture = true, stopMouse = true, stopTouch = true } = options\n\n const moving = ref(false)\n const internalState: MovingState = {\n xStart: 0,\n yStart: 0,\n xEnd: 0,\n yEnd: 0,\n clientX: 0,\n clientY: 0,\n deltaX: 0,\n deltaY: 0,\n lazy: false,\n }\n\n let current = 0\n let record = 0\n\n const throttleMove = throttle((event: PointerEvent) => {\n if (record < current) return\n\n updateState(event)\n\n if (!internalState.lazy) {\n x.value = internalState.xEnd\n y.value = internalState.yEnd\n }\n\n options.onMove?.(internalState, event)\n })\n\n function start(event: PointerEvent) {\n if (disabled.value) return\n\n Object.assign(internalState, {\n xStart: x.value,\n yStart: y.value,\n xEnd: x.value,\n yEnd: y.value,\n clientX: event.clientX,\n clientY: event.clientY,\n lazy: lazy.value,\n })\n\n if (options.onStart?.(internalState, event) === false) {\n return\n }\n\n document.addEventListener('pointermove', move, { capture })\n document.addEventListener('pointerup', end, { capture })\n\n record = current\n moving.value = true\n }\n\n function move(event: PointerEvent) {\n if (disabled.value) return\n\n disableEvent(event)\n throttleMove(event)\n }\n\n function end(event: PointerEvent) {\n document.removeEventListener('pointermove', move, { capture })\n document.removeEventListener('pointerup', end, { capture })\n\n if (disabled.value) return\n\n updateState(event)\n\n if (internalState.lazy) {\n x.value = internalState.xEnd\n y.value = internalState.yEnd\n }\n\n moving.value = false\n ++current\n\n options.onEnd?.(internalState, event)\n }\n\n function updateState(event: PointerEvent) {\n const { clientX, clientY } = event\n const { xStart, yStart, clientX: clientXStart, clientY: clientYStart } = internalState\n const deltaX = clientX - clientXStart\n const deltaY = clientY - clientYStart\n\n internalState.deltaX = deltaX\n internalState.deltaY = deltaY\n internalState.xEnd = xStart + deltaX\n internalState.yEnd = yStart + deltaY\n }\n\n useListener(target, 'pointerdown', start, { capture })\n\n stopMouse && useListener(target, 'mousedown', disableEvent, { capture })\n stopTouch && useListener(target, 'touchstart', disableEvent, { capture })\n\n return {\n target,\n moving: computed(() => moving.value),\n x,\n y,\n lazy,\n disabled,\n }\n}\n","import { onBeforeUnmount, ref } from 'vue'\n\nimport { throttle } from '@vexip-ui/utils'\n\nimport type { Ref } from 'vue'\n\nexport interface UsePointerOption {\n /**\n * 横向位置的初始值\n */\n x?: number,\n /**\n * 纵向位置的初始值\n */\n y?: number,\n /**\n * 是否手动停止,默认情况下会在组件的 BeforeUnmount 生命周期注销\n *\n * @default false\n */\n manualStop?: boolean\n}\n\ninterface PointerState {\n x: Ref,\n y: Ref\n}\n\nconst registered = new Set()\nconst record = new Map<'x' | 'y', number>()\n\nrecord.set('x', 0)\nrecord.set('y', 0)\n\nfunction handler(event: PointerEvent) {\n const { pageX, pageY } = event\n\n record.set('x', pageX)\n record.set('y', pageY)\n\n registered.forEach(state => {\n state.x.value = pageX\n state.y.value = pageY\n })\n}\n\nconst throttleHandler = throttle(handler)\n\nfunction register(state: PointerState) {\n if (!registered.size && window) {\n record.set('x', 0)\n record.set('y', 0)\n window.addEventListener('pointermove', throttleHandler, { passive: true })\n }\n\n registered.add(state)\n}\n\nfunction unregister(state: PointerState) {\n registered.delete(state)\n\n if (!registered.size && window) {\n window.removeEventListener('pointermove', throttleHandler)\n }\n}\n\nexport function usePointer(options: UsePointerOption = {}) {\n const x = ref(options.x ?? record.get('x')!)\n const y = ref(options.y ?? record.get('y')!)\n\n const state = { x, y }\n\n register(state)\n\n if (!options.manualStop) {\n onBeforeUnmount(() => {\n unregister(state)\n })\n }\n\n return { ...state, unregister: () => unregister(state) }\n}\n","/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n x: v,\n y: v\n});\nconst oppositeSideMap = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nconst oppositeAlignmentMap = {\n start: 'end',\n end: 'start'\n};\nfunction clamp(start, value, end) {\n return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\nfunction getSideAxis(placement) {\n return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n if (rtl === void 0) {\n rtl = false;\n }\n const alignment = getAlignment(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const length = getAxisLength(alignmentAxis);\n let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);\n}\nfunction getSideList(side, isStart, rtl) {\n const lr = ['left', 'right'];\n const rl = ['right', 'left'];\n const tb = ['top', 'bottom'];\n const bt = ['bottom', 'top'];\n switch (side) {\n case 'top':\n case 'bottom':\n if (rtl) return isStart ? rl : lr;\n return isStart ? lr : rl;\n case 'left':\n case 'right':\n return isStart ? tb : bt;\n default:\n return [];\n }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n const alignment = getAlignment(placement);\n let list = getSideList(getSide(placement), direction === 'start', rtl);\n if (alignment) {\n list = list.map(side => side + \"-\" + alignment);\n if (flipAlignment) {\n list = list.concat(list.map(getOppositeAlignmentPlacement));\n }\n }\n return list;\n}\nfunction getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);\n}\nfunction expandPaddingObject(padding) {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...padding\n };\n}\nfunction getPaddingObject(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\nfunction rectToClientRect(rect) {\n const {\n x,\n y,\n width,\n height\n } = rect;\n return {\n width,\n height,\n top: y,\n left: x,\n right: x + width,\n bottom: y + height,\n x,\n y\n };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n let {\n reference,\n floating\n } = _ref;\n const sideAxis = getSideAxis(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const alignLength = getAxisLength(alignmentAxis);\n const side = getSide(placement);\n const isVertical = sideAxis === 'y';\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n let coords;\n switch (side) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n switch (getAlignment(placement)) {\n case 'start':\n coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);\n break;\n case 'end':\n coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);\n break;\n }\n return coords;\n}\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n const validMiddleware = middleware.filter(Boolean);\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement(rects, placement, rtl);\n let statefulPlacement = placement;\n let middlewareData = {};\n let resetCount = 0;\n for (let i = 0; i < validMiddleware.length; i++) {\n const {\n name,\n fn\n } = validMiddleware[i];\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData = {\n ...middlewareData,\n [name]: {\n ...middlewareData[name],\n ...data\n }\n };\n if (reset && resetCount <= 50) {\n resetCount++;\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n ({\n x,\n y\n } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n }\n i = -1;\n }\n }\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n var _await$platform$isEle;\n if (options === void 0) {\n options = {};\n }\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = state;\n const {\n boundary = 'clippingAncestors',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = evaluate(options, state);\n const paddingObject = getPaddingObject(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n boundary,\n rootBoundary,\n strategy\n }));\n const rect = elementContext === 'floating' ? {\n x,\n y,\n width: rects.floating.width,\n height: rects.floating.height\n } : rects.reference;\n const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n x: 1,\n y: 1\n } : {\n x: 1,\n y: 1\n };\n const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements,\n rect,\n offsetParent,\n strategy\n }) : rect);\n return {\n top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n };\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const min$1 = minPadding;\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(min$1, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n return true;\n });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'autoPlacement',\n options,\n async fn(state) {\n var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n const {\n rects,\n middlewareData,\n placement,\n platform,\n elements\n } = state;\n const {\n crossAxis = false,\n alignment,\n allowedPlacements = placements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n const currentPlacement = placements$1[currentIndex];\n if (currentPlacement == null) {\n return {};\n }\n const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n\n // Make `computeCoords` start from the right place.\n if (placement !== currentPlacement) {\n return {\n reset: {\n placement: placements$1[0]\n }\n };\n }\n const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements$1[currentIndex + 1];\n\n // There are more placements to check.\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n const placementsSortedByMostSpace = allOverflows.map(d => {\n const alignment = getAlignment(d.placement);\n return [d.placement, alignment && crossAxis ?\n // Check along the mainAxis and main crossAxis side.\n d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n // Check only the mainAxis.\n d.overflows[0], d.overflows];\n }).sort((a, b) => a[1] - b[1]);\n const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n // Aligned placements should not check their opposite crossAxis\n // side.\n getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n if (resetPlacement !== placement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n return {};\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'flip',\n options,\n async fn(state) {\n var _middlewareData$arrow, _middlewareData$flip;\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement,\n platform,\n elements\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n fallbackAxisSideDirection = 'none',\n flipAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n\n // If a reset by the arrow was caused due to an alignment offset being\n // added, we should skip any logic now since `flip()` has already done its\n // work.\n // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n const side = getSide(placement);\n const initialSideAxis = getSideAxis(initialPlacement);\n const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n }\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n if (checkMainAxis) {\n overflows.push(overflow[side]);\n }\n if (checkCrossAxis) {\n const sides = getAlignmentSides(placement, rects, rtl);\n overflows.push(overflow[sides[0]], overflow[sides[1]]);\n }\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }];\n\n // One or more sides is overflowing.\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip2, _overflowsData$filter;\n const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n const nextPlacement = placements[nextIndex];\n if (nextPlacement) {\n var _overflowsData$;\n const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;\n const hasInitialMainAxisOverflow = ((_overflowsData$ = overflowsData[0]) == null ? void 0 : _overflowsData$.overflows[0]) > 0;\n if (!ignoreCrossAxisOverflow || hasInitialMainAxisOverflow) {\n // Try next placement and re-run the lifecycle.\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n }\n\n // First, find the candidates that fit on the mainAxis side of overflow,\n // then find the placement that fits the best on the main crossAxis side.\n let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n // Otherwise fallback.\n if (!resetPlacement) {\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$filter2;\n const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n if (hasFallbackAxisSideDirection) {\n const currentSideAxis = getSideAxis(d.placement);\n return currentSideAxis === initialSideAxis ||\n // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n currentSideAxis === 'y';\n }\n return true;\n }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n if (placement) {\n resetPlacement = placement;\n }\n break;\n }\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n }\n if (placement !== resetPlacement) {\n return {\n reset: {\n placement: resetPlacement\n }\n };\n }\n }\n return {};\n }\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'hide',\n options,\n async fn(state) {\n const {\n rects\n } = state;\n const {\n strategy = 'referenceHidden',\n ...detectOverflowOptions\n } = evaluate(options, state);\n switch (strategy) {\n case 'referenceHidden':\n {\n const overflow = await detectOverflow(state, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const offsets = getSideOffsets(overflow, rects.reference);\n return {\n data: {\n referenceHiddenOffsets: offsets,\n referenceHidden: isAnySideFullyClipped(offsets)\n }\n };\n }\n case 'escaped':\n {\n const overflow = await detectOverflow(state, {\n ...detectOverflowOptions,\n altBoundary: true\n });\n const offsets = getSideOffsets(overflow, rects.floating);\n return {\n data: {\n escapedOffsets: offsets,\n escaped: isAnySideFullyClipped(offsets)\n }\n };\n }\n default:\n {\n return {};\n }\n }\n }\n };\n};\n\nfunction getBoundingRect(rects) {\n const minX = min(...rects.map(rect => rect.left));\n const minY = min(...rects.map(rect => rect.top));\n const maxX = max(...rects.map(rect => rect.right));\n const maxY = max(...rects.map(rect => rect.bottom));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n}\nfunction getRectsByLine(rects) {\n const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n const groups = [];\n let prevRect = null;\n for (let i = 0; i < sortedRects.length; i++) {\n const rect = sortedRects[i];\n if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n groups.push([rect]);\n } else {\n groups[groups.length - 1].push(rect);\n }\n prevRect = rect;\n }\n return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'inline',\n options,\n async fn(state) {\n const {\n placement,\n elements,\n rects,\n platform,\n strategy\n } = state;\n // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n const {\n padding = 2,\n x,\n y\n } = evaluate(options, state);\n const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n const clientRects = getRectsByLine(nativeClientRects);\n const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n const paddingObject = getPaddingObject(padding);\n function getBoundingClientRect() {\n // There are two rects and they are disjoined.\n if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {\n // Find the first rect in which the point is fully inside.\n return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n }\n\n // There are 2 or more connected rects.\n if (clientRects.length >= 2) {\n if (getSideAxis(placement) === 'y') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getSide(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n const isLeftSide = getSide(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n const left = minLeft;\n const right = maxRight;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n return fallback;\n }\n const resetRects = await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n });\n if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n return {\n reset: {\n rects: resetRects\n }\n };\n }\n return {};\n }\n };\n};\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n const {\n placement,\n platform,\n elements\n } = state;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isVertical = getSideAxis(placement) === 'y';\n const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;\n const crossAxisMulti = rtl && isVertical ? -1 : 1;\n const rawValue = evaluate(options, state);\n\n // eslint-disable-next-line prefer-const\n let {\n mainAxis,\n crossAxis,\n alignmentAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: rawValue.mainAxis || 0,\n crossAxis: rawValue.crossAxis || 0,\n alignmentAxis: rawValue.alignmentAxis\n };\n if (alignment && typeof alignmentAxis === 'number') {\n crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n }\n return isVertical ? {\n x: crossAxis * crossAxisMulti,\n y: mainAxis * mainAxisMulti\n } : {\n x: mainAxis * mainAxisMulti,\n y: crossAxis * crossAxisMulti\n };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n if (options === void 0) {\n options = 0;\n }\n return {\n name: 'offset',\n options,\n async fn(state) {\n var _middlewareData$offse, _middlewareData$arrow;\n const {\n x,\n y,\n placement,\n middlewareData\n } = state;\n const diffCoords = await convertValueToCoords(state, options);\n\n // If the placement is the same and the arrow caused an alignment offset\n // then we don't need to change the positioning coordinates.\n if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: {\n ...diffCoords,\n placement\n }\n };\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'shift',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const crossAxis = getSideAxis(getSide(placement));\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n if (checkMainAxis) {\n const minSide = mainAxis === 'y' ? 'top' : 'left';\n const maxSide = mainAxis === 'y' ? 'bottom' : 'right';\n const min = mainAxisCoord + overflow[minSide];\n const max = mainAxisCoord - overflow[maxSide];\n mainAxisCoord = clamp(min, mainAxisCoord, max);\n }\n if (checkCrossAxis) {\n const minSide = crossAxis === 'y' ? 'top' : 'left';\n const maxSide = crossAxis === 'y' ? 'bottom' : 'right';\n const min = crossAxisCoord + overflow[minSide];\n const max = crossAxisCoord - overflow[maxSide];\n crossAxisCoord = clamp(min, crossAxisCoord, max);\n }\n const limitedCoords = limiter.fn({\n ...state,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return {\n ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y,\n enabled: {\n [mainAxis]: checkMainAxis,\n [crossAxis]: checkCrossAxis\n }\n }\n };\n }\n };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n options,\n fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = state;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = evaluate(offset, state);\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: 0,\n crossAxis: 0,\n ...rawOffset\n };\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2;\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = ['top', 'left'].includes(getSide(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'size',\n options,\n async fn(state) {\n var _state$middlewareData, _state$middlewareData2;\n const {\n placement,\n rects,\n platform,\n elements\n } = state;\n const {\n apply = () => {},\n ...detectOverflowOptions\n } = evaluate(options, state);\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isYAxis = getSideAxis(placement) === 'y';\n const {\n width,\n height\n } = rects.floating;\n let heightSide;\n let widthSide;\n if (side === 'top' || side === 'bottom') {\n heightSide = side;\n widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n } else {\n widthSide = side;\n heightSide = alignment === 'end' ? 'top' : 'bottom';\n }\n const maximumClippingHeight = height - overflow.top - overflow.bottom;\n const maximumClippingWidth = width - overflow.left - overflow.right;\n const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n const noShift = !state.middlewareData.shift;\n let availableHeight = overflowAvailableHeight;\n let availableWidth = overflowAvailableWidth;\n if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {\n availableWidth = maximumClippingWidth;\n }\n if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {\n availableHeight = maximumClippingHeight;\n }\n if (noShift && !alignment) {\n const xMin = max(overflow.left, 0);\n const xMax = max(overflow.right, 0);\n const yMin = max(overflow.top, 0);\n const yMax = max(overflow.bottom, 0);\n if (isYAxis) {\n availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));\n } else {\n availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));\n }\n }\n await apply({\n ...state,\n availableWidth,\n availableHeight\n });\n const nextDimensions = await platform.getDimensions(elements.floating);\n if (width !== nextDimensions.width || height !== nextDimensions.height) {\n return {\n reset: {\n rects: true\n }\n };\n }\n return {};\n }\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","function hasWindow() {\n return typeof window !== 'undefined';\n}\nfunction getNodeName(node) {\n if (isNode(node)) {\n return (node.nodeName || '').toLowerCase();\n }\n // Mocked nodes in testing environments may not be instances of Node. By\n // returning `#document` an infinite loop won't occur.\n // https://github.com/floating-ui/floating-ui/issues/2317\n return '#document';\n}\nfunction getWindow(node) {\n var _node$ownerDocument;\n return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n var _ref;\n return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n if (!hasWindow() || typeof ShadowRoot === 'undefined') {\n return false;\n }\n return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nfunction isOverflowElement(element) {\n const {\n overflow,\n overflowX,\n overflowY,\n display\n } = getComputedStyle(element);\n return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);\n}\nfunction isTableElement(element) {\n return ['table', 'td', 'th'].includes(getNodeName(element));\n}\nfunction isTopLayer(element) {\n return [':popover-open', ':modal'].some(selector => {\n try {\n return element.matches(selector);\n } catch (e) {\n return false;\n }\n });\n}\nfunction isContainingBlock(elementOrCss) {\n const webkit = isWebKit();\n const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n // https://drafts.csswg.org/css-transforms-2/#individual-transforms\n return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));\n}\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n } else if (isTopLayer(currentNode)) {\n return null;\n }\n currentNode = getParentNode(currentNode);\n }\n return null;\n}\nfunction isWebKit() {\n if (typeof CSS === 'undefined' || !CSS.supports) return false;\n return CSS.supports('-webkit-backdrop-filter', 'none');\n}\nfunction isLastTraversableNode(node) {\n return ['html', 'body', '#document'].includes(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n if (isElement(element)) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n }\n return {\n scrollLeft: element.scrollX,\n scrollTop: element.scrollY\n };\n}\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n const result =\n // Step into the shadow DOM of the parent of a slotted node.\n node.assignedSlot ||\n // DOM Element detected.\n node.parentNode ||\n // ShadowRoot detected.\n isShadowRoot(node) && node.host ||\n // Fallback.\n getDocumentElement(node);\n return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n const parentNode = getParentNode(node);\n if (isLastTraversableNode(parentNode)) {\n return node.ownerDocument ? node.ownerDocument.body : node.body;\n }\n if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n return parentNode;\n }\n return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n var _node$ownerDocument2;\n if (list === void 0) {\n list = [];\n }\n if (traverseIframes === void 0) {\n traverseIframes = true;\n }\n const scrollableAncestor = getNearestOverflowAncestor(node);\n const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n const win = getWindow(scrollableAncestor);\n if (isBody) {\n const frameElement = getFrameElement(win);\n return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);\n }\n return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n}\nfunction getFrameElement(win) {\n return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };\n","import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n const css = getComputedStyle(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height,\n $: shouldFallback\n };\n}\n\nfunction unwrapElement(element) {\n return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n const domElement = unwrapElement(element);\n if (!isHTMLElement(domElement)) {\n return createCoords(1);\n }\n const rect = domElement.getBoundingClientRect();\n const {\n width,\n height,\n $\n } = getCssDimensions(domElement);\n let x = ($ ? round(rect.width) : rect.width) / width;\n let y = ($ ? round(rect.height) : rect.height) / height;\n\n // 0, NaN, or Infinity should always fallback to 1.\n\n if (!x || !Number.isFinite(x)) {\n x = 1;\n }\n if (!y || !Number.isFinite(y)) {\n y = 1;\n }\n return {\n x,\n y\n };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n const win = getWindow(element);\n if (!isWebKit() || !win.visualViewport) {\n return noOffsets;\n }\n return {\n x: win.visualViewport.offsetLeft,\n y: win.visualViewport.offsetTop\n };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {\n return false;\n }\n return isFixed;\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n const clientRect = element.getBoundingClientRect();\n const domElement = unwrapElement(element);\n let scale = createCoords(1);\n if (includeScale) {\n if (offsetParent) {\n if (isElement(offsetParent)) {\n scale = getScale(offsetParent);\n }\n } else {\n scale = getScale(element);\n }\n }\n const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n let x = (clientRect.left + visualOffsets.x) / scale.x;\n let y = (clientRect.top + visualOffsets.y) / scale.y;\n let width = clientRect.width / scale.x;\n let height = clientRect.height / scale.y;\n if (domElement) {\n const win = getWindow(domElement);\n const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n let currentWin = win;\n let currentIFrame = getFrameElement(currentWin);\n while (currentIFrame && offsetParent && offsetWin !== currentWin) {\n const iframeScale = getScale(currentIFrame);\n const iframeRect = currentIFrame.getBoundingClientRect();\n const css = getComputedStyle(currentIFrame);\n const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n x *= iframeScale.x;\n y *= iframeScale.y;\n width *= iframeScale.x;\n height *= iframeScale.y;\n x += left;\n y += top;\n currentWin = getWindow(currentIFrame);\n currentIFrame = getFrameElement(currentWin);\n }\n }\n return rectToClientRect({\n width,\n height,\n x,\n y\n });\n}\n\n// If has a CSS width greater than the viewport, then this will be\n// incorrect for RTL.\nfunction getWindowScrollBarX(element, rect) {\n const leftScroll = getNodeScroll(element).scrollLeft;\n if (!rect) {\n return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;\n }\n return rect.left + leftScroll;\n}\n\nfunction getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {\n if (ignoreScrollbarX === void 0) {\n ignoreScrollbarX = false;\n }\n const htmlRect = documentElement.getBoundingClientRect();\n const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :\n // RTL scrollbar.\n getWindowScrollBarX(documentElement, htmlRect));\n const y = htmlRect.top + scroll.scrollTop;\n return {\n x,\n y\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n elements,\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isFixed = strategy === 'fixed';\n const documentElement = getDocumentElement(offsetParent);\n const topLayer = elements ? isTopLayer(elements.floating) : false;\n if (offsetParent === documentElement || topLayer && isFixed) {\n return rect;\n }\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n let scale = createCoords(1);\n const offsets = createCoords(0);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isHTMLElement(offsetParent)) {\n const offsetRect = getBoundingClientRect(offsetParent);\n scale = getScale(offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);\n return {\n width: rect.width * scale.x,\n height: rect.height * scale.y,\n x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,\n y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y\n };\n}\n\nfunction getClientRects(element) {\n return Array.from(element.getClientRects());\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable.\nfunction getDocumentRect(element) {\n const html = getDocumentElement(element);\n const scroll = getNodeScroll(element);\n const body = element.ownerDocument.body;\n const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n let x = -scroll.scrollLeft + getWindowScrollBarX(element);\n const y = -scroll.scrollTop;\n if (getComputedStyle(body).direction === 'rtl') {\n x += max(html.clientWidth, body.clientWidth) - width;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\nfunction getViewportRect(element, strategy) {\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n const visualViewportBased = isWebKit();\n if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);\n const width = element.clientWidth * scale.x;\n const height = element.clientHeight * scale.y;\n const x = left * scale.x;\n const y = top * scale.y;\n return {\n width,\n height,\n x,\n y\n };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n let rect;\n if (clippingAncestor === 'viewport') {\n rect = getViewportRect(element, strategy);\n } else if (clippingAncestor === 'document') {\n rect = getDocumentRect(getDocumentElement(element));\n } else if (isElement(clippingAncestor)) {\n rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n } else {\n const visualOffsets = getVisualOffsets(element);\n rect = {\n x: clippingAncestor.x - visualOffsets.x,\n y: clippingAncestor.y - visualOffsets.y,\n width: clippingAncestor.width,\n height: clippingAncestor.height\n };\n }\n return rectToClientRect(rect);\n}\nfunction hasFixedPositionAncestor(element, stopNode) {\n const parentNode = getParentNode(element);\n if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {\n return false;\n }\n return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n const cachedResult = cache.get(element);\n if (cachedResult) {\n return cachedResult;\n }\n let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n let currentContainingBlockComputedStyle = null;\n const elementIsFixed = getComputedStyle(element).position === 'fixed';\n let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n const computedStyle = getComputedStyle(currentNode);\n const currentNodeIsContaining = isContainingBlock(currentNode);\n if (!currentNodeIsContaining && computedStyle.position === 'fixed') {\n currentContainingBlockComputedStyle = null;\n }\n const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);\n if (shouldDropCurrentNode) {\n // Drop non-containing blocks.\n result = result.filter(ancestor => ancestor !== currentNode);\n } else {\n // Record last containing block for next iteration.\n currentContainingBlockComputedStyle = computedStyle;\n }\n currentNode = getParentNode(currentNode);\n }\n cache.set(element, result);\n return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary,\n strategy\n } = _ref;\n const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n const firstClippingAncestor = clippingAncestors[0];\n const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {\n const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));\n return {\n width: clippingRect.right - clippingRect.left,\n height: clippingRect.bottom - clippingRect.top,\n x: clippingRect.left,\n y: clippingRect.top\n };\n}\n\nfunction getDimensions(element) {\n const {\n width,\n height\n } = getCssDimensions(element);\n return {\n width,\n height\n };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const isFixed = strategy === 'fixed';\n const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = createCoords(0);\n\n // If the scrollbar appears on the left (e.g. RTL systems). Use\n // Firefox with layout.scrollbar.side = 3 in about:config to test this.\n function setLeftRTLScrollbarOffset() {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n } else if (documentElement) {\n setLeftRTLScrollbarOffset();\n }\n }\n if (isFixed && !isOffsetParentAnElement && documentElement) {\n setLeftRTLScrollbarOffset();\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;\n const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;\n return {\n x,\n y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction isStaticPositioned(element) {\n return getComputedStyle(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {\n return null;\n }\n if (polyfill) {\n return polyfill(element);\n }\n let rawOffsetParent = element.offsetParent;\n\n // Firefox returns the element as the offsetParent if it's non-static,\n // while Chrome and Safari return the element. The element must\n // be used to perform the correct calculations even if the element is\n // non-static.\n if (getDocumentElement(element) === rawOffsetParent) {\n rawOffsetParent = rawOffsetParent.ownerDocument.body;\n }\n return rawOffsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n const win = getWindow(element);\n if (isTopLayer(element)) {\n return win;\n }\n if (!isHTMLElement(element)) {\n let svgOffsetParent = getParentNode(element);\n while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n return svgOffsetParent;\n }\n svgOffsetParent = getParentNode(svgOffsetParent);\n }\n return win;\n }\n let offsetParent = getTrueOffsetParent(element, polyfill);\n while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n }\n if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n return win;\n }\n return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n const getDimensionsFn = this.getDimensions;\n const floatingDimensions = await getDimensionsFn(data.floating);\n return {\n reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n floating: {\n x: 0,\n y: 0,\n width: floatingDimensions.width,\n height: floatingDimensions.height\n }\n };\n};\n\nfunction isRTL(element) {\n return getComputedStyle(element).direction === 'rtl';\n}\n\nconst platform = {\n convertOffsetParentRelativeRectToViewportRelativeRect,\n getDocumentElement,\n getClippingRect,\n getOffsetParent,\n getElementRects,\n getClientRects,\n getDimensions,\n getScale,\n isElement,\n isRTL\n};\n\nfunction rectsAreEqual(a, b) {\n return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove) {\n let io = null;\n let timeoutId;\n const root = getDocumentElement(element);\n function cleanup() {\n var _io;\n clearTimeout(timeoutId);\n (_io = io) == null || _io.disconnect();\n io = null;\n }\n function refresh(skip, threshold) {\n if (skip === void 0) {\n skip = false;\n }\n if (threshold === void 0) {\n threshold = 1;\n }\n cleanup();\n const elementRectForRootMargin = element.getBoundingClientRect();\n const {\n left,\n top,\n width,\n height\n } = elementRectForRootMargin;\n if (!skip) {\n onMove();\n }\n if (!width || !height) {\n return;\n }\n const insetTop = floor(top);\n const insetRight = floor(root.clientWidth - (left + width));\n const insetBottom = floor(root.clientHeight - (top + height));\n const insetLeft = floor(left);\n const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n const options = {\n rootMargin,\n threshold: max(0, min(1, threshold)) || 1\n };\n let isFirstUpdate = true;\n function handleObserve(entries) {\n const ratio = entries[0].intersectionRatio;\n if (ratio !== threshold) {\n if (!isFirstUpdate) {\n return refresh();\n }\n if (!ratio) {\n // If the reference is clipped, the ratio is 0. Throttle the refresh\n // to prevent an infinite loop of updates.\n timeoutId = setTimeout(() => {\n refresh(false, 1e-7);\n }, 1000);\n } else {\n refresh(false, ratio);\n }\n }\n if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {\n // It's possible that even though the ratio is reported as 1, the\n // element is not actually fully within the IntersectionObserver's root\n // area anymore. This can happen under performance constraints. This may\n // be a bug in the browser's IntersectionObserver implementation. To\n // work around this, we compare the element's bounding rect now with\n // what it was at the time we created the IntersectionObserver. If they\n // are not equal then the element moved, so we refresh.\n refresh();\n }\n isFirstUpdate = false;\n }\n\n // Older browsers don't support a `document` as the root and will throw an\n // error.\n try {\n io = new IntersectionObserver(handleObserve, {\n ...options,\n // Handle