@aiquants/virtualscroll 1.8.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,131 +1,133 @@
1
- import { jsx as Q, jsxs as Jt, Fragment as we } from "react/jsx-runtime";
2
- import { memo as ze, forwardRef as ge, useState as Xt, useRef as w, useCallback as y, useImperativeHandle as xe, useMemo as Dt, useEffect as O, useLayoutEffect as ne, useId as Xe } from "react";
3
- import { twMerge as Zt } from "tailwind-merge";
4
- const Te = {
1
+ import { jsx as U, jsxs as te, Fragment as Re } from "react/jsx-runtime";
2
+ import { memo as Xe, forwardRef as Ie, useState as Nt, useRef as M, useCallback as C, useImperativeHandle as be, useMemo as kt, useEffect as Y, useLayoutEffect as oe, useId as He } from "react";
3
+ import { twMerge as Qt } from "tailwind-merge";
4
+ const ve = {
5
5
  active: !1,
6
6
  offsetX: 0,
7
7
  offsetY: 0,
8
8
  distance: 0,
9
9
  direction: 0,
10
10
  pointerId: null
11
- }, pe = 6, He = 8, Ue = ({ dragState: r, normalizedDistance: t }) => {
12
- const e = 1 + t * 0.18, n = 0.16 + t * 0.24, o = 0.38 + t * 0.28, a = r.active ? "80ms ease-out" : "220ms ease";
13
- return /* @__PURE__ */ Jt(we, { children: [
14
- /* @__PURE__ */ Q(
11
+ }, he = 6, Ue = 8, qe = ({ dragState: n, normalizedDistance: t }) => {
12
+ const e = 1 + t * 0.18, r = 0.16 + t * 0.24, s = 0.38 + t * 0.28, a = n.active ? "80ms ease-out" : "220ms ease";
13
+ return /* @__PURE__ */ te(Re, { children: [
14
+ /* @__PURE__ */ U(
15
15
  "div",
16
16
  {
17
17
  className: "absolute inset-0 rounded-full",
18
18
  style: {
19
19
  background: "linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",
20
- boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${n})`,
20
+ boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${r})`,
21
21
  transform: `scale(${e})`,
22
- transition: `${a}, ${r.active ? "80ms" : "260ms"} box-shadow ease`
22
+ transition: `${a}, ${n.active ? "80ms" : "260ms"} box-shadow ease`
23
23
  }
24
24
  }
25
25
  ),
26
- /* @__PURE__ */ Q(
26
+ /* @__PURE__ */ U(
27
27
  "div",
28
28
  {
29
29
  className: "aqvs:tap-scroll-circle-inner absolute rounded-full",
30
30
  style: {
31
31
  background: "linear-gradient(140deg, rgba(255,255,255,0.72), rgba(28,28,28,0.58))",
32
32
  boxShadow: "inset 0 4px 10px rgba(0,0,0,0.24), inset 0 0 2px rgba(255,255,255,0.55)",
33
- opacity: o,
34
- transition: r.active ? "120ms opacity ease-out" : "220ms opacity ease"
33
+ opacity: s,
34
+ transition: n.active ? "120ms opacity ease-out" : "220ms opacity ease"
35
35
  }
36
36
  }
37
37
  )
38
38
  ] });
39
- }, Ce = ze(ge(({ onDragChange: r, className: t, maxVisualDistance: e = 160, size: n = 40, style: o, opacity: a = 1, renderVisual: u }, p) => {
40
- const [l, d] = Xt(Te), c = w(null), f = w({ x: 0, y: 0 }), S = w(null), b = w(0), _ = y(
41
- (I) => {
42
- d(I), r(I);
43
- },
44
- [r]
45
- ), X = y(
46
- (I, m, tt = !1) => {
47
- const { x: A, y: et } = f.current, it = I - A, At = m - et, W = Math.abs(At), U = W < pe ? 0 : At < 0 ? -1 : 1, dt = b.current;
48
- let ft = U;
49
- const E = pe + He;
50
- U === 0 ? dt !== 0 && W < E ? ft = dt : (ft = 0, tt || (b.current = 0)) : U !== dt && dt !== 0 && W < E ? ft = dt : b.current = U, _({
51
- active: tt || W >= pe,
52
- offsetX: it,
53
- offsetY: At,
54
- distance: W,
55
- direction: ft,
56
- pointerId: c.current
57
- });
58
- },
59
- [_]
60
- ), k = y((I) => {
61
- if (I === null)
62
- return;
63
- const m = S.current;
64
- m?.hasPointerCapture(I) && m.releasePointerCapture(I);
65
- }, []), B = y(
66
- (I = !1) => {
67
- I && k(c.current), c.current = null, b.current = 0, _(Te);
68
- },
69
- [_, k]
70
- ), ht = y(
71
- (I) => {
72
- I.preventDefault(), I.stopPropagation();
73
- const m = S.current ?? I.currentTarget, { left: tt, top: A, width: et, height: it } = m.getBoundingClientRect();
74
- f.current = { x: tt + et / 2, y: A + it / 2 }, c.current = I.pointerId, m.setPointerCapture(I.pointerId), X(I.clientX, I.clientY, !0);
75
- },
76
- [X]
77
- ), H = y(
78
- (I) => {
79
- c.current === I.pointerId && (I.preventDefault(), X(I.clientX, I.clientY));
80
- },
81
- [X]
82
- ), F = y(
83
- (I) => {
84
- c.current === I.pointerId && (I.preventDefault(), I.stopPropagation(), B(!0));
85
- },
86
- [B]
87
- );
88
- xe(
89
- p,
90
- () => ({
91
- reset: () => {
92
- B(!0);
39
+ }, Ae = Xe(
40
+ Ie(({ onDragChange: n, className: t, maxVisualDistance: e = 160, size: r = 40, style: s, opacity: a = 1, renderVisual: u }, m) => {
41
+ const [l, d] = Nt(ve), c = M(null), f = M({ x: 0, y: 0 }), P = M(null), v = M(0), N = C(
42
+ (I) => {
43
+ d(I), n(I);
93
44
  },
94
- getElement: () => S.current
95
- }),
96
- [B]
97
- );
98
- const C = Math.min(Math.max(a, 0), 1), L = n / 64, R = Math.min(l.distance, e) / e, N = l.direction * R * 10 * L, st = u ?? Ue, ut = {
99
- dragState: l,
100
- normalizedDistance: R,
101
- sizeScale: L,
102
- size: n,
103
- opacity: C
104
- }, $ = {
105
- ...o,
106
- width: n,
107
- height: n,
108
- transform: `translateY(${N}px)`
109
- };
110
- return $.opacity = C, /* @__PURE__ */ Q(
111
- "div",
112
- {
113
- ref: S,
114
- "data-testid": "virtual-scroll-tap-circle",
115
- className: Zt("relative flex touch-none select-none items-center justify-center", "transition-transform duration-100 ease-out", t),
116
- style: $,
117
- tabIndex: -1,
118
- onPointerDown: ht,
119
- onPointerMove: H,
120
- onPointerUp: F,
121
- onPointerCancel: F,
122
- role: "presentation",
123
- children: st(ut)
124
- }
125
- );
126
- }));
127
- Ce.displayName = "TapScrollCircle";
128
- const mt = (r, t, e) => Math.min(e, Math.max(t, r)), he = "virtualscroll:tap-scroll-cancel", be = 20, qe = 250, Be = 60, $e = 20, We = 20, Ke = 240, Pe = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, me = 2.2, je = 8, Ge = 120, Ze = 1 / 60, zt = {
45
+ [n]
46
+ ), q = C(
47
+ (I, O, g = !1) => {
48
+ const { x: et, y: w } = f.current, ut = I - et, dt = O - w, Tt = Math.abs(dt), rt = Tt < he ? 0 : dt < 0 ? -1 : 1, X = v.current;
49
+ let mt = rt;
50
+ const vt = he + Ue;
51
+ rt === 0 ? X !== 0 && Tt < vt ? mt = X : (mt = 0, g || (v.current = 0)) : rt !== X && X !== 0 && Tt < vt ? mt = X : v.current = rt, N({
52
+ active: g || Tt >= he,
53
+ offsetX: ut,
54
+ offsetY: dt,
55
+ distance: Tt,
56
+ direction: mt,
57
+ pointerId: c.current
58
+ });
59
+ },
60
+ [N]
61
+ ), L = C((I) => {
62
+ if (I === null)
63
+ return;
64
+ const O = P.current;
65
+ O?.hasPointerCapture(I) && O.releasePointerCapture(I);
66
+ }, []), K = C(
67
+ (I = !1) => {
68
+ I && L(c.current), c.current = null, v.current = 0, N(ve);
69
+ },
70
+ [N, L]
71
+ ), It = C(
72
+ (I) => {
73
+ I.preventDefault(), I.stopPropagation();
74
+ const O = P.current ?? I.currentTarget, { left: g, top: et, width: w, height: ut } = O.getBoundingClientRect();
75
+ f.current = { x: g + w / 2, y: et + ut / 2 }, c.current = I.pointerId, O.setPointerCapture(I.pointerId), q(I.clientX, I.clientY, !0);
76
+ },
77
+ [q]
78
+ ), $ = C(
79
+ (I) => {
80
+ c.current === I.pointerId && (I.preventDefault(), q(I.clientX, I.clientY));
81
+ },
82
+ [q]
83
+ ), k = C(
84
+ (I) => {
85
+ c.current === I.pointerId && (I.preventDefault(), I.stopPropagation(), K(!0));
86
+ },
87
+ [K]
88
+ );
89
+ be(
90
+ m,
91
+ () => ({
92
+ reset: () => {
93
+ K(!0);
94
+ },
95
+ getElement: () => P.current
96
+ }),
97
+ [K]
98
+ );
99
+ const z = Math.min(Math.max(a, 0), 1), A = r / 64, V = Math.min(l.distance, e) / e, F = l.direction * V * 10 * A, at = u ?? qe, G = {
100
+ dragState: l,
101
+ normalizedDistance: V,
102
+ sizeScale: A,
103
+ size: r,
104
+ opacity: z
105
+ }, Ct = {
106
+ ...s,
107
+ width: r,
108
+ height: r,
109
+ transform: `translateY(${F}px)`
110
+ };
111
+ return Ct.opacity = z, /* @__PURE__ */ U(
112
+ "div",
113
+ {
114
+ ref: P,
115
+ "data-testid": "virtual-scroll-tap-circle",
116
+ className: Qt("relative flex touch-none select-none items-center justify-center", "transition-transform duration-100 ease-out", t),
117
+ style: Ct,
118
+ tabIndex: -1,
119
+ onPointerDown: It,
120
+ onPointerMove: $,
121
+ onPointerUp: k,
122
+ onPointerCancel: k,
123
+ role: "presentation",
124
+ children: at(G)
125
+ }
126
+ );
127
+ })
128
+ );
129
+ Ae.displayName = "TapScrollCircle";
130
+ const xt = (n, t, e) => Math.min(e, Math.max(t, n)), xe = "virtualscroll:tap-scroll-cancel", Pe = 20, $e = 250, Be = 60, We = 20, je = 20, Ke = 240, Se = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, ge = 2.2, Ge = 8, Ze = 120, Je = 1 / 60, Xt = {
129
131
  enabled: !0,
130
132
  size: 40,
131
133
  offsetX: -80,
@@ -136,7 +138,7 @@ const mt = (r, t, e) => Math.min(e, Math.max(t, r)), he = "virtualscroll:tap-scr
136
138
  opacity: 0.9,
137
139
  renderVisual: void 0,
138
140
  maxSpeedCurve: void 0
139
- }, Je = (r) => r ? {
141
+ }, Qe = (n) => n ? {
140
142
  mainSizeKey: "width",
141
143
  crossSizeKey: "height",
142
144
  positionKey: "left",
@@ -156,332 +158,332 @@ const mt = (r, t, e) => Math.min(e, Math.max(t, r)), he = "virtualscroll:tap-scr
156
158
  arrowIcons: ["▲", "▼"],
157
159
  directionClass: "flex flex-col items-stretch",
158
160
  orientation: "vertical"
159
- }, Qe = (r, t) => {
160
- const e = r?.maxSpeedMultiplier, n = typeof e == "number" ? e : nn(t);
161
+ }, tr = (n, t) => {
162
+ const e = n?.maxSpeedMultiplier, r = typeof e == "number" ? e : nr(t);
161
163
  return {
162
- enabled: r?.enabled ?? zt.enabled,
163
- size: r?.size ?? zt.size,
164
- offsetX: r?.offsetX ?? zt.offsetX,
165
- offsetY: r?.offsetY ?? zt.offsetY,
166
- className: r?.className ?? zt.className,
167
- maxVisualDistance: r?.maxVisualDistance ?? zt.maxVisualDistance,
168
- maxSpeedMultiplier: n,
169
- minSpeedMultiplier: Math.max(r?.minSpeedMultiplier ?? zt.minSpeedMultiplier, 0),
170
- opacity: mt(r?.opacity ?? zt.opacity, 0, 1),
171
- renderVisual: r?.renderVisual ?? zt.renderVisual,
172
- maxSpeedCurve: r?.maxSpeedCurve ?? zt.maxSpeedCurve
164
+ enabled: n?.enabled ?? Xt.enabled,
165
+ size: n?.size ?? Xt.size,
166
+ offsetX: n?.offsetX ?? Xt.offsetX,
167
+ offsetY: n?.offsetY ?? Xt.offsetY,
168
+ className: n?.className ?? Xt.className,
169
+ maxVisualDistance: n?.maxVisualDistance ?? Xt.maxVisualDistance,
170
+ maxSpeedMultiplier: r,
171
+ minSpeedMultiplier: Math.max(n?.minSpeedMultiplier ?? Xt.minSpeedMultiplier, 0),
172
+ opacity: xt(n?.opacity ?? Xt.opacity, 0, 1),
173
+ renderVisual: n?.renderVisual ?? Xt.renderVisual,
174
+ maxSpeedCurve: n?.maxSpeedCurve ?? Xt.maxSpeedCurve
173
175
  };
174
- }, tn = ({ isDragging: r, isThumbHovered: t, enableThumbDrag: e }) => Dt(() => e ? r ? "dragging" : t ? "hover" : "idle" : "disabled", [e, r, t]), en = ({ canUseArrowButtons: r, enableArrowButtons: t, resetTapScroll: e, scrollByStep: n }) => {
175
- const o = w(null), a = w(null), u = y(() => {
176
- o.current !== null && (window.clearInterval(o.current), o.current = null), a.current !== null && (window.clearTimeout(a.current), a.current = null);
177
- }, []), p = y(() => {
176
+ }, er = ({ isDragging: n, isThumbHovered: t, enableThumbDrag: e }) => kt(() => e ? n ? "dragging" : t ? "hover" : "idle" : "disabled", [e, n, t]), rr = ({ canUseArrowButtons: n, enableArrowButtons: t, resetTapScroll: e, scrollByStep: r }) => {
177
+ const s = M(null), a = M(null), u = C(() => {
178
+ s.current !== null && (window.clearInterval(s.current), s.current = null), a.current !== null && (window.clearTimeout(a.current), a.current = null);
179
+ }, []), m = C(() => {
178
180
  u();
179
- }, [u]), l = y(
181
+ }, [u]), l = C(
180
182
  (c) => (f) => {
181
- r && (f.preventDefault(), f.stopPropagation(), e(), u(), n(c), a.current = window.setTimeout(() => {
182
- o.current = window.setInterval(() => {
183
- n(c);
183
+ n && (f.preventDefault(), f.stopPropagation(), e(), u(), r(c), a.current = window.setTimeout(() => {
184
+ s.current = window.setInterval(() => {
185
+ r(c);
184
186
  }, Be);
185
- }, qe));
187
+ }, $e));
186
188
  },
187
- [r, u, e, n]
188
- ), d = y(
189
+ [n, u, e, r]
190
+ ), d = C(
189
191
  (c) => (f) => {
190
- t && (f.key === "Enter" || f.key === " " || f.key === "Spacebar") && (f.preventDefault(), n(c));
192
+ t && (f.key === "Enter" || f.key === " " || f.key === "Spacebar") && (f.preventDefault(), r(c));
191
193
  },
192
- [t, n]
194
+ [t, r]
193
195
  );
194
- return O(() => () => {
196
+ return Y(() => () => {
195
197
  u();
196
- }, [u]), { handleArrowPointerDown: l, handleArrowPointerUp: p, handleArrowKeyDown: d };
197
- }, nn = (r) => {
198
- if (!r || r <= 0)
199
- return me;
200
- const t = Math.max(1, r), e = Math.log10(t), n = me + e * je;
201
- return mt(n, me, Ge);
202
- }, rn = ({
203
- contentSize: r,
198
+ }, [u]), { handleArrowPointerDown: l, handleArrowPointerUp: m, handleArrowKeyDown: d };
199
+ }, nr = (n) => {
200
+ if (!n || n <= 0)
201
+ return ge;
202
+ const t = Math.max(1, n), e = Math.log10(t), r = ge + e * Ge;
203
+ return xt(r, ge, Ze);
204
+ }, or = ({
205
+ contentSize: n,
204
206
  viewportSize: t,
205
207
  scrollPosition: e,
206
- onScroll: n,
207
- enableThumbDrag: o = !0,
208
+ onScroll: r,
209
+ enableThumbDrag: s = !0,
208
210
  enableTrackClick: a = !0,
209
211
  enableArrowButtons: u = !0,
210
- horizontal: p = !1,
212
+ horizontal: m = !1,
211
213
  scrollBarWidth: l = 12,
212
214
  className: d,
213
215
  ariaControls: c,
214
216
  tapScrollCircleOptions: f,
215
- itemCount: S,
216
- renderThumbOverlay: b,
217
- visibleStartIndex: _,
218
- visibleEndIndex: X
217
+ itemCount: P,
218
+ renderThumbOverlay: v,
219
+ visibleStartIndex: N,
220
+ visibleEndIndex: q
219
221
  }) => {
220
- const [k, B] = Xt(!1), [ht, H] = Xt(!1), [F, C] = Xt(!1), L = w(null), R = w({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), N = w({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), st = w(e), ut = w(Pe), $ = w(null), I = w(null), m = w(null), tt = Dt(() => Qe(f, S), [S, f]), A = Dt(() => Je(p), [p]), {
221
- enabled: et,
222
- size: it,
223
- offsetX: At,
224
- offsetY: W,
225
- className: U,
226
- maxVisualDistance: dt,
227
- maxSpeedMultiplier: ft,
228
- minSpeedMultiplier: E,
229
- opacity: P,
230
- renderVisual: v,
231
- maxSpeedCurve: nt
232
- } = tt, K = w({
222
+ const [L, K] = Nt(!1), [It, $] = Nt(!1), [k, z] = Nt(!1), A = M(null), V = M({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), F = M({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }), at = M(e), G = M(Se), Ct = M(null), I = M(null), O = M(null), g = kt(() => tr(f, P), [P, f]), et = kt(() => Qe(m), [m]), {
223
+ enabled: w,
224
+ size: ut,
225
+ offsetX: dt,
226
+ offsetY: Tt,
227
+ className: rt,
228
+ maxVisualDistance: X,
229
+ maxSpeedMultiplier: mt,
230
+ minSpeedMultiplier: vt,
231
+ opacity: D,
232
+ renderVisual: T,
233
+ maxSpeedCurve: S
234
+ } = g, J = M({
233
235
  viewportSize: t,
234
- maxScrollPosition: Math.max(r - t, 0),
235
- scrollBarVisible: r > t,
236
- effectiveTapMaxDistance: Math.max(dt, 1),
237
- tapCircleMaxSpeedMultiplier: ft,
238
- tapCircleMinSpeedMultiplier: E,
239
- tapCircleMaxSpeedCurve: nt,
236
+ maxScrollPosition: Math.max(n - t, 0),
237
+ scrollBarVisible: n > t,
238
+ effectiveTapMaxDistance: Math.max(X, 1),
239
+ tapCircleMaxSpeedMultiplier: mt,
240
+ tapCircleMinSpeedMultiplier: vt,
241
+ tapCircleMaxSpeedCurve: S,
240
242
  tapScrollCircleOptions: f
241
- }), { mainSizeKey: Z, crossSizeKey: pt, positionKey: rt, selectDelta: at, getPointerCoordinate: ot, arrowLabels: It, arrowIcons: gt, directionClass: Tt, orientation: wt } = A, _t = Math.max(dt, 1), Ft = t / r, h = l, g = Math.max(t - h * 2, 0), xt = Ft * g, J = Math.min(Math.max(be, xt || 0), g || be), Y = r - t, Vt = Math.max(g - J, 0), bt = Y <= 0 || Vt <= 0 ? 0 : e / Y * Vt, Et = bt + J / 2, Pt = r > t, Nt = Pt && u;
242
- K.current = {
243
+ }), { mainSizeKey: Q, crossSizeKey: st, positionKey: bt, selectDelta: nt, getPointerCoordinate: ft, arrowLabels: lt, arrowIcons: Ft, directionClass: Pt, orientation: ht } = et, Rt = Math.max(X, 1), Lt = t / n, St = l, p = Math.max(t - St * 2, 0), y = Lt * p, it = Math.min(Math.max(Pe, y || 0), p || Pe), B = n - t, W = Math.max(p - it, 0), At = B <= 0 || W <= 0 ? 0 : e / B * W, Vt = At + it / 2, H = n > t, Ht = H && u;
244
+ J.current = {
243
245
  viewportSize: t,
244
- maxScrollPosition: Y,
245
- scrollBarVisible: Pt,
246
- effectiveTapMaxDistance: _t,
247
- tapCircleMaxSpeedMultiplier: ft,
248
- tapCircleMinSpeedMultiplier: E,
249
- tapCircleMaxSpeedCurve: nt,
246
+ maxScrollPosition: B,
247
+ scrollBarVisible: H,
248
+ effectiveTapMaxDistance: Rt,
249
+ tapCircleMaxSpeedMultiplier: mt,
250
+ tapCircleMinSpeedMultiplier: vt,
251
+ tapCircleMaxSpeedCurve: S,
250
252
  tapScrollCircleOptions: f
251
- }, O(() => {
252
- st.current = e;
253
- }, [e]), O(() => {
254
- o || H(!1);
255
- }, [o]);
256
- const Bt = tn({ isDragging: k, isThumbHovered: ht, enableThumbDrag: o }), St = y(
257
- (s, x) => {
258
- const V = K.current, G = x ?? st.current;
259
- if (n) {
260
- const Yt = n(s, G);
261
- if (typeof Yt == "number" && Number.isFinite(Yt))
262
- return st.current = Yt, Yt;
253
+ }, Y(() => {
254
+ at.current = e;
255
+ }, [e]), Y(() => {
256
+ s || $(!1);
257
+ }, [s]);
258
+ const yt = er({ isDragging: L, isThumbHovered: It, enableThumbDrag: s }), Ut = C(
259
+ (o, h) => {
260
+ const R = J.current, ot = h ?? at.current;
261
+ if (r) {
262
+ const wt = r(o, ot);
263
+ if (typeof wt == "number" && Number.isFinite(wt))
264
+ return at.current = wt, wt;
263
265
  }
264
- const vt = typeof s == "function" ? s(G) : s, Mt = Math.max(V.maxScrollPosition, 0), Lt = V.scrollBarVisible ? mt(vt, 0, Mt) : 0;
265
- return st.current = Lt, Lt;
266
+ const E = typeof o == "function" ? o(ot) : o, tt = Math.max(R.maxScrollPosition, 0), _t = R.scrollBarVisible ? xt(E, 0, tt) : 0;
267
+ return at.current = _t, _t;
266
268
  },
267
- [n]
268
- ), kt = y(
269
- (s) => {
270
- const x = K.current, V = st.current;
271
- if (!x.scrollBarVisible || x.maxScrollPosition <= 0) {
272
- const Yt = St(0, V), de = Yt - V;
273
- return { nextPosition: Yt, actualDelta: de, reachedBoundary: !0 };
269
+ [r]
270
+ ), Zt = C(
271
+ (o) => {
272
+ const h = J.current, R = at.current;
273
+ if (!h.scrollBarVisible || h.maxScrollPosition <= 0) {
274
+ const wt = Ut(0, R), ee = wt - R;
275
+ return { nextPosition: wt, actualDelta: ee, reachedBoundary: !0 };
274
276
  }
275
- if (s === 0)
276
- return { nextPosition: V, actualDelta: 0, reachedBoundary: !1 };
277
- const vt = St((Yt) => mt(Yt + s, 0, x.maxScrollPosition), V), Mt = vt - V, Lt = Mt === 0 || s < 0 && vt <= 0 || s > 0 && vt >= x.maxScrollPosition;
278
- return { nextPosition: vt, actualDelta: Mt, reachedBoundary: Lt };
277
+ if (o === 0)
278
+ return { nextPosition: R, actualDelta: 0, reachedBoundary: !1 };
279
+ const E = Ut((wt) => xt(wt + o, 0, h.maxScrollPosition), R), tt = E - R, _t = tt === 0 || o < 0 && E <= 0 || o > 0 && E >= h.maxScrollPosition;
280
+ return { nextPosition: E, actualDelta: tt, reachedBoundary: _t };
279
281
  },
280
- [St]
281
- ), lt = y(() => {
282
- I.current !== null && (window.cancelAnimationFrame(I.current), I.current = null), m.current = null;
283
- }, []), Ct = y(() => {
284
- ut.current = { ...Pe }, C(!1), $.current?.reset(), lt();
285
- }, [lt]), Kt = y(
286
- (s) => {
287
- const x = ut.current, V = K.current;
288
- if (!x.active || x.direction === 0) {
289
- lt();
282
+ [Ut]
283
+ ), Et = C(() => {
284
+ I.current !== null && (window.cancelAnimationFrame(I.current), I.current = null), O.current = null;
285
+ }, []), gt = C(() => {
286
+ G.current = { ...Se }, z(!1), Ct.current?.reset(), Et();
287
+ }, [Et]), Jt = C(
288
+ (o) => {
289
+ const h = G.current, R = J.current;
290
+ if (!h.active || h.direction === 0) {
291
+ Et();
290
292
  return;
291
293
  }
292
- if (!V.scrollBarVisible || V.maxScrollPosition <= 0) {
293
- lt();
294
+ if (!R.scrollBarVisible || R.maxScrollPosition <= 0) {
295
+ Et();
294
296
  return;
295
297
  }
296
- const G = m.current ?? s, vt = Math.max((s - G) / 1e3, 0), Mt = Math.min(vt, Ze);
297
- if (m.current = s, Mt <= 0) {
298
- I.current = window.requestAnimationFrame(Kt);
298
+ const ot = O.current ?? o, E = Math.max((o - ot) / 1e3, 0), tt = Math.min(E, Je);
299
+ if (O.current = o, tt <= 0) {
300
+ I.current = window.requestAnimationFrame(Jt);
299
301
  return;
300
302
  }
301
- const Lt = Math.min(x.distance, V.effectiveTapMaxDistance) / V.effectiveTapMaxDistance, Yt = Lt ** 1.1, de = typeof V.tapScrollCircleOptions?.maxSpeedMultiplier == "number", Qt = Math.max(V.viewportSize * V.tapCircleMinSpeedMultiplier, 40), Re = de ? Qt : 1200;
302
- let fe = Math.max(V.viewportSize * V.tapCircleMaxSpeedMultiplier, Re);
303
- const se = V.tapCircleMaxSpeedCurve;
304
- if (se) {
305
- const ie = Math.max(se.exponentialSteepness, 0), ke = Math.max(se.exponentialScale ?? V.tapCircleMaxSpeedMultiplier, 0), Oe = ie === 0 ? Lt : Math.expm1(ie * Lt), Ie = ie === 0 ? 1 : Math.expm1(ie) || 1, Le = Ie === 0 ? Lt : Math.min(Math.max(Oe / Ie, 0), 1), Ye = V.viewportSize * ke * Le;
306
- fe = Math.min(fe, Math.max(Ye, Qt));
303
+ const _t = Math.min(h.distance, R.effectiveTapMaxDistance) / R.effectiveTapMaxDistance, wt = _t ** 1.1, ee = typeof R.tapScrollCircleOptions?.maxSpeedMultiplier == "number", Gt = Math.max(R.viewportSize * R.tapCircleMinSpeedMultiplier, 40), pe = ee ? Gt : 1200;
304
+ let me = Math.max(R.viewportSize * R.tapCircleMaxSpeedMultiplier, pe);
305
+ const ie = R.tapCircleMaxSpeedCurve;
306
+ if (ie) {
307
+ const ae = Math.max(ie.exponentialSteepness, 0), Oe = Math.max(ie.exponentialScale ?? R.tapCircleMaxSpeedMultiplier, 0), Le = ae === 0 ? _t : Math.expm1(ae * _t), Te = ae === 0 ? 1 : Math.expm1(ae) || 1, Ye = Te === 0 ? _t : Math.min(Math.max(Le / Te, 0), 1), ze = R.viewportSize * Oe * Ye;
308
+ me = Math.min(me, Math.max(ze, Gt));
307
309
  }
308
- const Ae = Math.max(fe, Qt), Ve = Math.max(se?.easedOffset ?? 0, 0), Ee = Math.min(1, Yt + Ve), De = Qt + (Ae - Qt) * Ee, _e = x.direction * De * Mt, { actualDelta: Fe, reachedBoundary: Ne } = kt(_e);
309
- if (Ne || Fe === 0) {
310
- lt();
310
+ const Ve = Math.max(me, Gt), Ee = Math.max(ie?.easedOffset ?? 0, 0), De = Math.min(1, wt + Ee), _e = Gt + (Ve - Gt) * De, Ne = h.direction * _e * tt, { actualDelta: ke, reachedBoundary: Fe } = Zt(Ne);
311
+ if (Fe || ke === 0) {
312
+ Et();
311
313
  return;
312
314
  }
313
- I.current = window.requestAnimationFrame(Kt);
315
+ I.current = window.requestAnimationFrame(Jt);
314
316
  },
315
- [kt, lt]
316
- ), re = y(() => {
317
- I.current === null && (m.current = null, I.current = window.requestAnimationFrame(Kt));
318
- }, [Kt]);
319
- O(() => () => {
320
- lt();
321
- }, [lt]);
322
- const ce = y(
323
- (s) => {
324
- ut.current = s, C(s.active), s.active && s.direction !== 0 ? re() : lt();
317
+ [Zt, Et]
318
+ ), qt = C(() => {
319
+ I.current === null && (O.current = null, I.current = window.requestAnimationFrame(Jt));
320
+ }, [Jt]);
321
+ Y(() => () => {
322
+ Et();
323
+ }, [Et]);
324
+ const Bt = C(
325
+ (o) => {
326
+ G.current = o, z(o.active), o.active && o.direction !== 0 ? qt() : Et();
325
327
  },
326
- [re, lt]
328
+ [qt, Et]
327
329
  );
328
- O(() => {
329
- et || Ct();
330
- }, [Ct, et]), O(() => {
331
- const s = (x) => {
332
- const G = x.detail?.paneId;
333
- G && c && G !== c || Ct();
330
+ Y(() => {
331
+ w || gt();
332
+ }, [gt, w]), Y(() => {
333
+ const o = (h) => {
334
+ const ot = h.detail?.paneId;
335
+ ot && c && ot !== c || gt();
334
336
  };
335
- return window.addEventListener(he, s), () => {
336
- window.removeEventListener(he, s);
337
+ return window.addEventListener(xe, o), () => {
338
+ window.removeEventListener(xe, o);
337
339
  };
338
- }, [c, Ct]), O(() => {
339
- if (!et)
340
+ }, [c, gt]), Y(() => {
341
+ if (!w)
340
342
  return;
341
- const s = (x) => {
342
- if (!ut.current.active || ut.current.pointerId === x.pointerId)
343
+ const o = (h) => {
344
+ if (!G.current.active || G.current.pointerId === h.pointerId)
343
345
  return;
344
- const V = x.target;
345
- if (!(V instanceof Node)) {
346
- Ct();
346
+ const R = h.target;
347
+ if (!(R instanceof Node)) {
348
+ gt();
347
349
  return;
348
350
  }
349
- $.current?.getElement()?.contains(V) || Ct();
351
+ Ct.current?.getElement()?.contains(R) || gt();
350
352
  };
351
- return document.addEventListener("pointerdown", s, !0), () => {
352
- document.removeEventListener("pointerdown", s, !0);
353
+ return document.addEventListener("pointerdown", o, !0), () => {
354
+ document.removeEventListener("pointerdown", o, !0);
353
355
  };
354
- }, [Ct, et]);
355
- const i = (s) => {
356
- if (!Pt || Vt <= 0 || Y <= 0)
356
+ }, [gt, w]);
357
+ const Ot = (o) => {
358
+ if (!H || W <= 0 || B <= 0)
357
359
  return 0;
358
- const x = mt(s, 0, Vt);
359
- return mt(x / Vt * Y, 0, Y);
360
- }, T = (s) => {
361
- const x = Math.max(Math.round(t / We), $e);
362
- kt(s * x);
363
- }, { handleArrowPointerDown: M, handleArrowPointerUp: D, handleArrowKeyDown: q } = en({
364
- canUseArrowButtons: Nt,
360
+ const h = xt(o, 0, W);
361
+ return xt(h / W * B, 0, B);
362
+ }, $t = (o) => {
363
+ const h = Math.max(Math.round(t / je), We);
364
+ Zt(o * h);
365
+ }, { handleArrowPointerDown: Yt, handleArrowPointerUp: Kt, handleArrowKeyDown: se } = rr({
366
+ canUseArrowButtons: Ht,
365
367
  enableArrowButtons: u,
366
- resetTapScroll: Ct,
367
- scrollByStep: T
368
- }), j = (s) => {
369
- if (!Pt)
368
+ resetTapScroll: gt,
369
+ scrollByStep: $t
370
+ }), ue = (o) => {
371
+ if (!H)
370
372
  return;
371
- if (!o) {
372
- s.preventDefault(), s.stopPropagation();
373
+ if (!s) {
374
+ o.preventDefault(), o.stopPropagation();
373
375
  return;
374
376
  }
375
- if (s.pointerType === "mouse" && s.button !== 0 || s.ctrlKey)
377
+ if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
376
378
  return;
377
- Ct();
378
- const x = s.currentTarget;
379
- x.setPointerCapture && x.setPointerCapture(s.pointerId), R.current = {
380
- pointerId: s.pointerId,
381
- startThumbPosition: bt,
382
- startClientX: s.clientX,
383
- startClientY: s.clientY
384
- }, B(!0), H(!0), s.preventDefault(), s.stopPropagation();
385
- }, Rt = (s) => {
386
- const x = R.current;
387
- if (x.pointerId !== s.pointerId)
379
+ gt();
380
+ const h = o.currentTarget;
381
+ h.setPointerCapture && h.setPointerCapture(o.pointerId), V.current = {
382
+ pointerId: o.pointerId,
383
+ startThumbPosition: At,
384
+ startClientX: o.clientX,
385
+ startClientY: o.clientY
386
+ }, K(!0), $(!0), o.preventDefault(), o.stopPropagation();
387
+ }, de = (o) => {
388
+ const h = V.current;
389
+ if (h.pointerId !== o.pointerId)
388
390
  return;
389
- const V = s.clientX - x.startClientX, G = s.clientY - x.startClientY, vt = at(V, G), Mt = i(x.startThumbPosition + vt);
390
- St(Mt), s.cancelable && s.preventDefault();
391
- }, Ht = (s) => {
392
- if (R.current.pointerId !== s.pointerId)
391
+ const R = o.clientX - h.startClientX, ot = o.clientY - h.startClientY, E = nt(R, ot), tt = Ot(h.startThumbPosition + E);
392
+ Ut(tt), o.cancelable && o.preventDefault();
393
+ }, fe = (o) => {
394
+ if (V.current.pointerId !== o.pointerId)
393
395
  return;
394
- const x = s.currentTarget;
395
- x.hasPointerCapture(s.pointerId) && x.releasePointerCapture(s.pointerId), R.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, B(!1), L.current && !L.current.matches(":hover") && H(!1), s.preventDefault(), s.stopPropagation();
396
- }, Ot = (s) => {
397
- if (R.current.pointerId !== s.pointerId)
396
+ const h = o.currentTarget;
397
+ h.hasPointerCapture(o.pointerId) && h.releasePointerCapture(o.pointerId), V.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, K(!1), A.current && !A.current.matches(":hover") && $(!1), o.preventDefault(), o.stopPropagation();
398
+ }, i = (o) => {
399
+ if (V.current.pointerId !== o.pointerId)
398
400
  return;
399
- const x = s.currentTarget;
400
- x.hasPointerCapture(s.pointerId) && x.releasePointerCapture(s.pointerId), R.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, B(!1), L.current && !L.current.matches(":hover") && H(!1);
401
- }, Ut = (s) => {
402
- if (!Pt)
401
+ const h = o.currentTarget;
402
+ h.hasPointerCapture(o.pointerId) && h.releasePointerCapture(o.pointerId), V.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, K(!1), A.current && !A.current.matches(":hover") && $(!1);
403
+ }, x = (o) => {
404
+ if (!H)
403
405
  return;
404
406
  if (!a) {
405
- s.preventDefault(), s.stopPropagation();
407
+ o.preventDefault(), o.stopPropagation();
406
408
  return;
407
409
  }
408
- if (s.pointerType === "mouse" && s.button !== 0 || s.ctrlKey)
410
+ if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
409
411
  return;
410
- const x = s.currentTarget, V = x.getBoundingClientRect(), vt = ot(s) - (p ? V.left : V.top);
411
- Ct();
412
- const Mt = vt - J / 2, Lt = i(Mt);
413
- St(Lt), x.setPointerCapture && x.setPointerCapture(s.pointerId), N.current = {
414
- pointerId: s.pointerId,
415
- startThumbPosition: Mt,
416
- startClientX: s.clientX,
417
- startClientY: s.clientY
418
- }, s.preventDefault(), s.stopPropagation();
419
- }, jt = (s) => {
420
- const x = N.current;
421
- if (x.pointerId !== s.pointerId)
412
+ const h = o.currentTarget, R = h.getBoundingClientRect(), E = ft(o) - (m ? R.left : R.top);
413
+ gt();
414
+ const tt = E - it / 2, _t = Ot(tt);
415
+ Ut(_t), h.setPointerCapture && h.setPointerCapture(o.pointerId), F.current = {
416
+ pointerId: o.pointerId,
417
+ startThumbPosition: tt,
418
+ startClientX: o.clientX,
419
+ startClientY: o.clientY
420
+ }, o.preventDefault(), o.stopPropagation();
421
+ }, b = (o) => {
422
+ const h = F.current;
423
+ if (h.pointerId !== o.pointerId)
422
424
  return;
423
- const V = s.clientX - x.startClientX, G = s.clientY - x.startClientY, vt = at(V, G), Mt = i(x.startThumbPosition + vt);
424
- St(Mt), s.cancelable && s.preventDefault();
425
- }, qt = (s) => {
426
- if (N.current.pointerId !== s.pointerId)
425
+ const R = o.clientX - h.startClientX, ot = o.clientY - h.startClientY, E = nt(R, ot), tt = Ot(h.startThumbPosition + E);
426
+ Ut(tt), o.cancelable && o.preventDefault();
427
+ }, _ = (o) => {
428
+ if (F.current.pointerId !== o.pointerId)
427
429
  return;
428
- const x = s.currentTarget;
429
- x.hasPointerCapture(s.pointerId) && x.releasePointerCapture(s.pointerId), N.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, s.preventDefault(), s.stopPropagation();
430
- }, Gt = (s) => {
431
- if (N.current.pointerId !== s.pointerId)
430
+ const h = o.currentTarget;
431
+ h.hasPointerCapture(o.pointerId) && h.releasePointerCapture(o.pointerId), F.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 }, o.preventDefault(), o.stopPropagation();
432
+ }, j = (o) => {
433
+ if (F.current.pointerId !== o.pointerId)
432
434
  return;
433
- const x = s.currentTarget;
434
- x.hasPointerCapture(s.pointerId) && x.releasePointerCapture(s.pointerId), N.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
435
- }, z = Dt(() => mt((F ? 1 : 0.8) * P, 0, 1), [F, P]), $t = Dt(() => {
436
- const x = `calc(50% - ${it / 2}px + ${W}px)`;
435
+ const h = o.currentTarget;
436
+ h.hasPointerCapture(o.pointerId) && h.releasePointerCapture(o.pointerId), F.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0 };
437
+ }, Z = kt(() => xt((k ? 1 : 0.8) * D, 0, 1), [k, D]), Mt = kt(() => {
438
+ const h = `calc(50% - ${ut / 2}px + ${Tt}px)`;
437
439
  return {
438
- left: At,
439
- top: x
440
+ left: dt,
441
+ top: h
440
442
  };
441
- }, [At, W, it]), ue = (s, x, V) => /* @__PURE__ */ Q(
443
+ }, [dt, Tt, ut]), zt = (o, h, R) => /* @__PURE__ */ U(
442
444
  "button",
443
445
  {
444
446
  type: "button",
445
447
  tabIndex: -1,
446
448
  className: "aqvs:scrollbar-arrow-button flex items-center justify-center text-xs transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
447
449
  style: {
448
- [Z]: h,
449
- [pt]: l
450
+ [Q]: St,
451
+ [st]: l
450
452
  },
451
- "aria-label": x,
452
- onMouseDown: M(s),
453
- onTouchStart: M(s),
454
- onMouseUp: D,
455
- onMouseLeave: D,
456
- onTouchEnd: D,
457
- onTouchCancel: D,
458
- onKeyDown: q(s),
453
+ "aria-label": h,
454
+ onMouseDown: Yt(o),
455
+ onTouchStart: Yt(o),
456
+ onMouseUp: Kt,
457
+ onMouseLeave: Kt,
458
+ onTouchEnd: Kt,
459
+ onTouchCancel: Kt,
460
+ onKeyDown: se(o),
459
461
  "aria-disabled": !u,
460
- disabled: !Nt,
461
- children: /* @__PURE__ */ Q("span", { "aria-hidden": "true", children: V })
462
+ disabled: !Ht,
463
+ children: /* @__PURE__ */ U("span", { "aria-hidden": "true", children: R })
462
464
  }
463
- ), oe = b && Pt ? {
464
- orientation: wt,
465
+ ), Dt = v && H ? {
466
+ orientation: ht,
465
467
  scrollPosition: e,
466
- maxScrollPosition: Y,
467
- contentSize: r,
468
+ maxScrollPosition: B,
469
+ contentSize: n,
468
470
  viewportSize: t,
469
- thumbSize: J,
470
- thumbPosition: bt,
471
- thumbCenter: Et,
472
- trackSize: g,
473
- isDragging: k,
474
- isTapScrollActive: F,
475
- visibleStartIndex: _,
476
- visibleEndIndex: X
471
+ thumbSize: it,
472
+ thumbPosition: At,
473
+ thumbCenter: Vt,
474
+ trackSize: p,
475
+ isDragging: L,
476
+ isTapScrollActive: k,
477
+ visibleStartIndex: N,
478
+ visibleEndIndex: q
477
479
  } : null;
478
- return /* @__PURE__ */ Jt(
480
+ return /* @__PURE__ */ te(
479
481
  "div",
480
482
  {
481
- className: Zt("group relative cursor-default select-none", Tt, d),
483
+ className: Qt("group relative cursor-default select-none", Pt, d),
482
484
  style: {
483
- [Z]: t,
484
- [pt]: l,
485
+ [Q]: t,
486
+ [st]: l,
485
487
  backgroundColor: "white",
486
488
  userSelect: "none",
487
489
  position: "relative",
@@ -492,24 +494,24 @@ const mt = (r, t, e) => Math.min(e, Math.max(t, r)), he = "virtualscroll:tap-scr
492
494
  "aria-controls": c,
493
495
  "aria-valuenow": e,
494
496
  "aria-valuemin": 0,
495
- "aria-valuemax": Y,
496
- "aria-orientation": p ? "horizontal" : "vertical",
497
+ "aria-valuemax": B,
498
+ "aria-orientation": m ? "horizontal" : "vertical",
497
499
  children: [
498
- !p && Pt && et && /* @__PURE__ */ Q(
499
- Ce,
500
+ !m && H && w && /* @__PURE__ */ U(
501
+ Ae,
500
502
  {
501
- ref: $,
502
- className: Zt("pointer-events-auto absolute transition-opacity duration-150", U),
503
- size: it,
504
- maxVisualDistance: _t,
505
- style: $t,
506
- opacity: z,
507
- renderVisual: v,
508
- onDragChange: ce
503
+ ref: Ct,
504
+ className: Qt("pointer-events-auto absolute transition-opacity duration-150", rt),
505
+ size: ut,
506
+ maxVisualDistance: Rt,
507
+ style: Mt,
508
+ opacity: Z,
509
+ renderVisual: T,
510
+ onDragChange: Bt
509
511
  }
510
512
  ),
511
- ue(-1, It[0], gt[0]),
512
- /* @__PURE__ */ Jt(
513
+ zt(-1, lt[0], Ft[0]),
514
+ /* @__PURE__ */ te(
513
515
  "div",
514
516
  {
515
517
  className: "aqvs:scrollbar-track relative flex-1",
@@ -517,50 +519,50 @@ const mt = (r, t, e) => Math.min(e, Math.max(t, r)), he = "virtualscroll:tap-scr
517
519
  borderRadius: l / 2,
518
520
  touchAction: "none"
519
521
  },
520
- onPointerDown: Ut,
521
- onPointerMove: jt,
522
- onPointerUp: qt,
523
- onPointerCancel: Gt,
522
+ onPointerDown: x,
523
+ onPointerMove: b,
524
+ onPointerUp: _,
525
+ onPointerCancel: j,
524
526
  "aria-disabled": !a,
525
527
  children: [
526
- oe && /* @__PURE__ */ Q("div", { className: "pointer-events-none absolute inset-0", "aria-hidden": !0, children: b?.(oe) }),
527
- Pt && // スクロールバーのつまみの当たり判定を広げるためのラッパー
528
- /* @__PURE__ */ Q(
528
+ Dt && /* @__PURE__ */ U("div", { className: "pointer-events-none absolute inset-0", "aria-hidden": !0, children: v?.(Dt) }),
529
+ H && // スクロールバーのつまみの当たり判定を広げるためのラッパー
530
+ /* @__PURE__ */ U(
529
531
  "div",
530
532
  {
531
533
  className: "group absolute",
532
534
  style: {
533
- [Z]: J,
534
- [rt]: bt,
535
- ...p ? { top: 0, bottom: 0 } : { left: 0, right: 0 },
535
+ [Q]: it,
536
+ [bt]: At,
537
+ ...m ? { top: 0, bottom: 0 } : { left: 0, right: 0 },
536
538
  touchAction: "none"
537
539
  },
538
- onPointerDown: j,
539
- onPointerMove: Rt,
540
- onPointerUp: Ht,
541
- onPointerCancel: Ot,
540
+ onPointerDown: ue,
541
+ onPointerMove: de,
542
+ onPointerUp: fe,
543
+ onPointerCancel: i,
542
544
  role: "slider",
543
- "aria-orientation": p ? "horizontal" : "vertical",
545
+ "aria-orientation": m ? "horizontal" : "vertical",
544
546
  "aria-valuenow": e,
545
547
  "aria-valuemin": 0,
546
- "aria-valuemax": Y,
547
- "aria-disabled": !o,
548
+ "aria-valuemax": B,
549
+ "aria-disabled": !s,
548
550
  tabIndex: -1,
549
- children: /* @__PURE__ */ Q(
551
+ children: /* @__PURE__ */ U(
550
552
  "div",
551
553
  {
552
- ref: L,
553
- className: Zt("aqvs:scrollbar-thumb absolute", p ? "aqvs:scrollbar-thumb-horizontal" : "aqvs:scrollbar-thumb-vertical"),
554
- "data-thumb-state": Bt,
554
+ ref: A,
555
+ className: Qt("aqvs:scrollbar-thumb absolute", m ? "aqvs:scrollbar-thumb-horizontal" : "aqvs:scrollbar-thumb-vertical"),
556
+ "data-thumb-state": yt,
555
557
  style: {
556
558
  borderRadius: l - 1,
557
- cursor: o ? "pointer" : "default"
559
+ cursor: s ? "pointer" : "default"
558
560
  },
559
561
  onMouseEnter: () => {
560
- o && H(!0);
562
+ s && $(!0);
561
563
  },
562
564
  onMouseLeave: () => {
563
- o && H(!1);
565
+ s && $(!1);
564
566
  }
565
567
  }
566
568
  )
@@ -569,178 +571,179 @@ const mt = (r, t, e) => Math.min(e, Math.max(t, r)), he = "virtualscroll:tap-scr
569
571
  ]
570
572
  }
571
573
  ),
572
- ue(1, It[1], gt[1])
574
+ zt(1, lt[1], Ft[1])
573
575
  ]
574
576
  }
575
577
  );
576
- }, yt = {
577
- debug(r, ...t) {
578
- process.env.NODE_ENV === "___" && console.debug(`[VirtualScroll] ${r}`, ...t);
578
+ }, pt = {
579
+ debug(n, ...t) {
580
+ process.env.NODE_ENV === "___" && console.debug(`[VirtualScroll] ${n}`, ...t);
579
581
  },
580
- warn(r, ...t) {
581
- console.warn(`[VirtualScroll] ${r}`, ...t);
582
+ warn(n, ...t) {
583
+ console.warn(`[VirtualScroll] ${n}`, ...t);
582
584
  },
583
- error(r, ...t) {
584
- console.error(`[VirtualScroll] ${r}`, ...t);
585
+ error(n, ...t) {
586
+ console.error(`[VirtualScroll] ${n}`, ...t);
585
587
  }
586
- }, te = {
588
+ }, re = {
587
589
  maxVelocity: 6,
588
590
  minVelocity: 0.02,
589
591
  deceleration: 25e-4,
590
592
  velocitySampleWindow: 90,
591
593
  startVelocityThreshold: 0.04
592
- }, ae = (r, t, e) => {
593
- for (const [n, o, a] of t)
594
- e === "add" ? r.addEventListener(n, o, a) : r.removeEventListener(n, o, a);
595
- }, on = ge(
594
+ }, le = (n, t, e) => {
595
+ for (const [r, s, a] of t)
596
+ e === "add" ? n.addEventListener(r, s, a) : n.removeEventListener(r, s, a);
597
+ }, sr = Ie(
596
598
  ({
597
- children: r,
599
+ children: n,
598
600
  contentSize: t,
599
601
  viewportSize: e,
600
- scrollBarWidth: n = 12,
601
- enableThumbDrag: o = !0,
602
+ scrollBarWidth: r = 12,
603
+ enableThumbDrag: s = !0,
602
604
  enableTrackClick: a = !0,
603
605
  enableArrowButtons: u = !0,
604
- enablePointerDrag: p = !0,
606
+ enablePointerDrag: m = !0,
605
607
  onScroll: l,
606
608
  className: d,
607
609
  style: c,
608
610
  background: f,
609
- tapScrollCircleOptions: S,
610
- inertiaOptions: b,
611
- itemCount: _,
612
- renderThumbOverlay: X,
613
- wheelSpeedMultiplier: k = 1,
614
- contentInsets: B,
615
- visibleStartIndex: ht,
616
- visibleEndIndex: H
617
- }, F) => {
618
- const C = w(0), L = w(null), R = w(null), N = w({
611
+ tapScrollCircleOptions: P,
612
+ inertiaOptions: v,
613
+ itemCount: N,
614
+ renderThumbOverlay: q,
615
+ wheelSpeedMultiplier: L = 1,
616
+ contentInsets: K,
617
+ visibleStartIndex: It,
618
+ visibleEndIndex: $,
619
+ renderOverlay: k
620
+ }, z) => {
621
+ const A = M(0), V = M(null), F = M(null), at = M({
619
622
  frame: null,
620
623
  velocity: 0,
621
624
  lastTimestamp: null
622
- }), st = Dt(
625
+ }), G = kt(
623
626
  () => ({
624
- maxVelocity: b?.maxVelocity ?? te.maxVelocity,
625
- minVelocity: b?.minVelocity ?? te.minVelocity,
626
- deceleration: b?.deceleration ?? te.deceleration,
627
- velocitySampleWindow: b?.velocitySampleWindow ?? te.velocitySampleWindow,
628
- startVelocityThreshold: b?.startVelocityThreshold ?? te.startVelocityThreshold
627
+ maxVelocity: v?.maxVelocity ?? re.maxVelocity,
628
+ minVelocity: v?.minVelocity ?? re.minVelocity,
629
+ deceleration: v?.deceleration ?? re.deceleration,
630
+ velocitySampleWindow: v?.velocitySampleWindow ?? re.velocitySampleWindow,
631
+ startVelocityThreshold: v?.startVelocityThreshold ?? re.startVelocityThreshold
629
632
  }),
630
- [b]
631
- ), ut = Dt(() => ({
632
- top: Math.max(0, B?.top ?? 0),
633
- bottom: Math.max(0, B?.bottom ?? 0)
634
- }), [B]);
635
- yt.debug("[ScrollPane] ScrollPane rendered", {
633
+ [v]
634
+ ), Ct = kt(() => ({
635
+ top: Math.max(0, K?.top ?? 0),
636
+ bottom: Math.max(0, K?.bottom ?? 0)
637
+ }), [K]);
638
+ pt.debug("[ScrollPane] ScrollPane rendered", {
636
639
  contentSize: t,
637
640
  viewportSize: e,
638
- scrollBarWidth: n,
641
+ scrollBarWidth: r,
639
642
  className: d,
640
643
  style: c,
641
- tapScrollCircleOptions: S,
642
- inertiaOptions: b,
643
- enablePointerDrag: p,
644
- contentInsets: ut
644
+ tapScrollCircleOptions: P,
645
+ inertiaOptions: v,
646
+ enablePointerDrag: m,
647
+ contentInsets: Ct
645
648
  });
646
- const $ = w({ contentSize: t, viewportSize: e }), I = Dt(() => t > e, [t, e]), m = y(
647
- (P) => {
648
- const { contentSize: v, viewportSize: nt } = $.current, K = v > nt, Z = C.current;
649
- if (yt.debug("[ScrollPane] scrollTo called", { newPosition: P, contentSize: v, viewportSize: nt, currentIsScrollable: K, prevPosition: Z }), !K)
650
- return C.current !== 0 && (C.current = 0, l?.(0, Z)), C.current;
651
- const pt = typeof P == "function" ? P(C.current) : P, rt = Math.max(v - nt, 0), at = mt(pt, 0, rt);
652
- return C.current !== at && (C.current = at, l?.(at, Z)), C.current;
649
+ const I = M({ contentSize: t, viewportSize: e }), O = kt(() => t > e, [t, e]), g = C(
650
+ (T) => {
651
+ const { contentSize: S, viewportSize: J } = I.current, Q = S > J, st = A.current;
652
+ if (pt.debug("[ScrollPane] scrollTo called", { newPosition: T, contentSize: S, viewportSize: J, currentIsScrollable: Q, prevPosition: st }), !Q)
653
+ return A.current !== 0 && (A.current = 0, l?.(0, st)), A.current;
654
+ const bt = typeof T == "function" ? T(A.current) : T, nt = Math.max(S - J, 0), ft = xt(bt, 0, nt);
655
+ return A.current !== ft && (A.current = ft, l?.(ft, st)), A.current;
653
656
  },
654
657
  [l]
655
- ), tt = y(() => {
656
- const P = N.current;
657
- P.frame !== null && cancelAnimationFrame(P.frame), P.frame = null, P.velocity = 0, P.lastTimestamp = null;
658
- }, []), A = w(tt);
659
- O(() => {
660
- A.current = tt;
661
- }, [tt]);
662
- const et = y(
663
- (P) => {
664
- if (!I)
658
+ ), et = C(() => {
659
+ const T = at.current;
660
+ T.frame !== null && cancelAnimationFrame(T.frame), T.frame = null, T.velocity = 0, T.lastTimestamp = null;
661
+ }, []), w = M(et);
662
+ Y(() => {
663
+ w.current = et;
664
+ }, [et]);
665
+ const ut = C(
666
+ (T) => {
667
+ if (!O)
665
668
  return;
666
- const { maxVelocity: v, minVelocity: nt, deceleration: K, startVelocityThreshold: Z } = st, pt = mt(P, -v, v);
667
- if (Math.abs(pt) < Z)
669
+ const { maxVelocity: S, minVelocity: J, deceleration: Q, startVelocityThreshold: st } = G, bt = xt(T, -S, S);
670
+ if (Math.abs(bt) < st)
668
671
  return;
669
- tt(), N.current.velocity = pt, N.current.lastTimestamp = null;
670
- const rt = (at) => {
671
- const ot = N.current;
672
- if (ot.lastTimestamp === null) {
673
- ot.lastTimestamp = at, ot.frame = requestAnimationFrame(rt);
672
+ et(), at.current.velocity = bt, at.current.lastTimestamp = null;
673
+ const nt = (ft) => {
674
+ const lt = at.current;
675
+ if (lt.lastTimestamp === null) {
676
+ lt.lastTimestamp = ft, lt.frame = requestAnimationFrame(nt);
674
677
  return;
675
678
  }
676
- const It = at - ot.lastTimestamp;
677
- if (ot.lastTimestamp = at, It <= 0) {
678
- ot.frame = requestAnimationFrame(rt);
679
+ const Ft = ft - lt.lastTimestamp;
680
+ if (lt.lastTimestamp = ft, Ft <= 0) {
681
+ lt.frame = requestAnimationFrame(nt);
679
682
  return;
680
683
  }
681
- const gt = ot.velocity;
682
- let Tt = gt;
683
- const wt = K * It;
684
- gt > 0 ? Tt = Math.max(0, gt - wt) : gt < 0 && (Tt = Math.min(0, gt + wt));
685
- const Ft = (gt + Tt) / 2 * It, h = C.current;
686
- Ft !== 0 && m((bt) => bt + Ft);
687
- const g = C.current, { contentSize: xt, viewportSize: J } = $.current, Y = Math.max(xt - J, 0);
688
- ot.velocity = Tt;
689
- const Vt = g === h || g <= 0 && Tt <= 0 || g >= Y && Tt >= 0;
690
- if (Math.abs(Tt) < nt || Vt) {
691
- tt();
684
+ const Pt = lt.velocity;
685
+ let ht = Pt;
686
+ const Rt = Q * Ft;
687
+ Pt > 0 ? ht = Math.max(0, Pt - Rt) : Pt < 0 && (ht = Math.min(0, Pt + Rt));
688
+ const St = (Pt + ht) / 2 * Ft, p = A.current;
689
+ St !== 0 && g((Vt) => Vt + St);
690
+ const y = A.current, { contentSize: it, viewportSize: B } = I.current, W = Math.max(it - B, 0);
691
+ lt.velocity = ht;
692
+ const At = y === p || y <= 0 && ht <= 0 || y >= W && ht >= 0;
693
+ if (Math.abs(ht) < J || At) {
694
+ et();
692
695
  return;
693
696
  }
694
- ot.frame = requestAnimationFrame(rt);
697
+ lt.frame = requestAnimationFrame(nt);
695
698
  };
696
- N.current.frame = requestAnimationFrame(rt);
699
+ at.current.frame = requestAnimationFrame(nt);
697
700
  },
698
- [I, st, m, tt]
699
- ), it = w(et);
700
- O(() => {
701
- it.current = et;
702
- }, [et]), ne(() => {
703
- $.current = { contentSize: t, viewportSize: e };
704
- }, [t, e]), ne(() => {
705
- const P = R.current;
706
- if (!P) return;
707
- const v = () => {
708
- P.scrollTop !== 0 && (yt.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: P.scrollTop }), P.scrollTop = 0), P.scrollLeft !== 0 && (P.scrollLeft = 0);
701
+ [O, G, g, et]
702
+ ), dt = M(ut);
703
+ Y(() => {
704
+ dt.current = ut;
705
+ }, [ut]), oe(() => {
706
+ I.current = { contentSize: t, viewportSize: e };
707
+ }, [t, e]), oe(() => {
708
+ const T = F.current;
709
+ if (!T) return;
710
+ const S = () => {
711
+ T.scrollTop !== 0 && (pt.debug("[ScrollPane] Native scroll detected, resetting to 0", { scrollTop: T.scrollTop }), T.scrollTop = 0), T.scrollLeft !== 0 && (T.scrollLeft = 0);
709
712
  };
710
- return P.addEventListener("scroll", v), () => P.removeEventListener("scroll", v);
711
- }, []), ne(() => {
712
- if (I) {
713
- yt.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: C.current });
714
- const P = mt(t - e, 0, t);
715
- C.current > P && m(P);
713
+ return T.addEventListener("scroll", S), () => T.removeEventListener("scroll", S);
714
+ }, []), oe(() => {
715
+ if (O) {
716
+ pt.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", { contentSize: t, viewportSize: e, scrollPosition: A.current });
717
+ const T = xt(t - e, 0, t);
718
+ A.current > T && g(T);
716
719
  } else
717
- m(0);
718
- }, [I, m, t, e]), O(() => {
719
- const P = (nt) => {
720
- if (!I)
720
+ g(0);
721
+ }, [O, g, t, e]), Y(() => {
722
+ const T = (J) => {
723
+ if (!O)
721
724
  return;
722
- nt.preventDefault(), tt();
723
- let K = nt.deltaY;
724
- nt.deltaMode === 1 ? K *= 16 : nt.deltaMode === 2 && (K *= e), k !== 1 && (K *= k), yt.debug("[ScrollPane] wheel event", { deltaY: K, scrollPosition: C.current, wheelSpeedMultiplier: k, deltaMode: nt.deltaMode, scrollTop: R.current?.scrollTop }), m((Z) => Z + K);
725
- }, v = L.current;
726
- return v && v.addEventListener("wheel", P, { passive: !1 }), () => {
727
- v && v.removeEventListener("wheel", P);
725
+ J.preventDefault(), et();
726
+ let Q = J.deltaY;
727
+ J.deltaMode === 1 ? Q *= 16 : J.deltaMode === 2 && (Q *= e), L !== 1 && (Q *= L), pt.debug("[ScrollPane] wheel event", { deltaY: Q, scrollPosition: A.current, wheelSpeedMultiplier: L, deltaMode: J.deltaMode, scrollTop: F.current?.scrollTop }), g((st) => st + Q);
728
+ }, S = V.current;
729
+ return S && S.addEventListener("wheel", T, { passive: !1 }), () => {
730
+ S && S.removeEventListener("wheel", T);
728
731
  };
729
- }, [I, m, tt, e, k]), xe(
730
- F,
732
+ }, [O, g, et, e, L]), be(
733
+ z,
731
734
  () => ({
732
- scrollTo: m,
733
- getScrollPosition: () => C.current,
735
+ scrollTo: (T) => (et(), g(T)),
736
+ getScrollPosition: () => A.current,
734
737
  getContentSize: () => t,
735
738
  getViewportSize: () => e
736
739
  }),
737
- [m, t, e]
740
+ [g, t, e, et]
738
741
  );
739
- const At = w(m);
740
- O(() => {
741
- At.current = m;
742
- }, [m]);
743
- const W = Xe(), U = w({
742
+ const Tt = M(g);
743
+ Y(() => {
744
+ Tt.current = g;
745
+ }, [g]);
746
+ const rt = He(), X = M({
744
747
  pointerId: null,
745
748
  startClientY: 0,
746
749
  startScroll: 0,
@@ -748,199 +751,200 @@ const mt = (r, t, e) => Math.min(e, Math.max(t, r)), he = "virtualscroll:tap-scr
748
751
  shouldCancelNextClick: !1,
749
752
  clickResetTimer: null,
750
753
  velocitySamples: []
751
- }), dt = w(p);
752
- O(() => {
753
- dt.current = p;
754
- }, [p]);
755
- const ft = w(I);
756
- O(() => {
757
- ft.current = I;
758
- }, [I]);
759
- const E = w(st);
760
- return O(() => {
761
- E.current = st;
762
- }, [st]), O(() => {
763
- if (p)
754
+ }), mt = M(m);
755
+ Y(() => {
756
+ mt.current = m;
757
+ }, [m]);
758
+ const vt = M(O);
759
+ Y(() => {
760
+ vt.current = O;
761
+ }, [O]);
762
+ const D = M(G);
763
+ return Y(() => {
764
+ D.current = G;
765
+ }, [G]), Y(() => {
766
+ if (m)
764
767
  return;
765
- const P = R.current, v = U.current;
766
- v.pointerId !== null && P && P.hasPointerCapture(v.pointerId) && P.releasePointerCapture(v.pointerId), v.clickResetTimer !== null && (window.clearTimeout(v.clickResetTimer), v.clickResetTimer = null), v.pointerId = null, v.startClientY = 0, v.startScroll = 0, v.isDragging = !1, v.shouldCancelNextClick = !1, v.velocitySamples = [];
767
- }, [p]), O(() => {
768
- const P = R.current;
769
- if (!P)
768
+ const T = F.current, S = X.current;
769
+ S.pointerId !== null && T && T.hasPointerCapture(S.pointerId) && T.releasePointerCapture(S.pointerId), S.clickResetTimer !== null && (window.clearTimeout(S.clickResetTimer), S.clickResetTimer = null), S.pointerId = null, S.startClientY = 0, S.startScroll = 0, S.isDragging = !1, S.shouldCancelNextClick = !1, S.velocitySamples = [];
770
+ }, [m]), Y(() => {
771
+ const T = F.current;
772
+ if (!T)
770
773
  return;
771
- const v = 6, nt = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), K = () => {
772
- const h = U.current;
773
- h.pointerId = null, h.startClientY = 0, h.startScroll = 0, h.isDragging = !1, h.velocitySamples = [];
774
- }, Z = () => {
775
- const h = U.current;
776
- h.clickResetTimer !== null && (window.clearTimeout(h.clickResetTimer), h.clickResetTimer = null);
777
- }, pt = (h) => {
778
- const g = U.current, xt = nt();
779
- g.velocitySamples.push({ clientY: h, time: xt });
780
- const J = E.current.velocitySampleWindow;
781
- g.velocitySamples = g.velocitySamples.filter((Y) => xt - Y.time <= J);
782
- }, rt = (h) => h instanceof HTMLElement && h.closest("[data-scrollpane-ignore-drag='true']") !== null, at = (h) => {
783
- const g = U.current;
784
- g.shouldCancelNextClick && (h.preventDefault(), h.stopPropagation(), g.shouldCancelNextClick = !1);
785
- }, ot = (h) => {
786
- const g = U.current;
787
- g.isDragging || (g.isDragging = !0, g.shouldCancelNextClick = !0, P.hasPointerCapture(h.pointerId) || P.setPointerCapture(h.pointerId), pt(h.clientY));
788
- }, It = (h) => {
789
- const g = U.current;
790
- if (g.pointerId !== h.pointerId || !(dt.current && ft.current) || !g.isDragging && (Math.abs(h.clientY - g.startClientY) < v || (ot(h), !g.isDragging)))
774
+ const S = 6, J = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), Q = () => {
775
+ const p = X.current;
776
+ p.pointerId = null, p.startClientY = 0, p.startScroll = 0, p.isDragging = !1, p.velocitySamples = [];
777
+ }, st = () => {
778
+ const p = X.current;
779
+ p.clickResetTimer !== null && (window.clearTimeout(p.clickResetTimer), p.clickResetTimer = null);
780
+ }, bt = (p) => {
781
+ const y = X.current, it = J();
782
+ y.velocitySamples.push({ clientY: p, time: it });
783
+ const B = D.current.velocitySampleWindow;
784
+ y.velocitySamples = y.velocitySamples.filter((W) => it - W.time <= B);
785
+ }, nt = (p) => p instanceof HTMLElement && p.closest("[data-scrollpane-ignore-drag='true']") !== null, ft = (p) => {
786
+ const y = X.current;
787
+ y.shouldCancelNextClick && (p.preventDefault(), p.stopPropagation(), y.shouldCancelNextClick = !1);
788
+ }, lt = (p) => {
789
+ const y = X.current;
790
+ y.isDragging || (y.isDragging = !0, y.shouldCancelNextClick = !0, T.hasPointerCapture(p.pointerId) || T.setPointerCapture(p.pointerId), bt(p.clientY));
791
+ }, Ft = (p) => {
792
+ const y = X.current;
793
+ if (y.pointerId !== p.pointerId || !(mt.current && vt.current) || !y.isDragging && (Math.abs(p.clientY - y.startClientY) < S || (lt(p), !y.isDragging)))
791
794
  return;
792
- pt(h.clientY);
793
- const xt = h.clientY - g.startClientY, J = g.startScroll - xt;
794
- At.current(J), h.cancelable && h.preventDefault();
795
- }, gt = (h) => {
796
- const g = U.current;
797
- if (g.pointerId !== h.pointerId)
795
+ bt(p.clientY);
796
+ const it = p.clientY - y.startClientY, B = y.startScroll - it;
797
+ Tt.current(B), p.cancelable && p.preventDefault();
798
+ }, Pt = (p) => {
799
+ const y = X.current;
800
+ if (y.pointerId !== p.pointerId)
798
801
  return;
799
- g.isDragging && g.shouldCancelNextClick && h.cancelable && (h.preventDefault(), h.stopPropagation()), P.hasPointerCapture(h.pointerId) && P.releasePointerCapture(h.pointerId);
800
- let xt = 0;
801
- if (g.isDragging && g.velocitySamples.length >= 2) {
802
- const Y = g.velocitySamples, Vt = E.current.velocitySampleWindow, bt = Y[Y.length - 1], Et = Y.find((Pt) => bt.time - Pt.time <= Vt) ?? Y[0];
803
- if (bt && Et && bt.time !== Et.time) {
804
- const Pt = bt.clientY - Et.clientY, Nt = bt.time - Et.time;
805
- xt = -(Pt / Nt);
802
+ y.isDragging && y.shouldCancelNextClick && p.cancelable && (p.preventDefault(), p.stopPropagation()), T.hasPointerCapture(p.pointerId) && T.releasePointerCapture(p.pointerId);
803
+ let it = 0;
804
+ if (y.isDragging && y.velocitySamples.length >= 2) {
805
+ const W = y.velocitySamples, At = D.current.velocitySampleWindow, Vt = W[W.length - 1], H = W.find((Ht) => Vt.time - Ht.time <= At) ?? W[0];
806
+ if (Vt && H && Vt.time !== H.time) {
807
+ const Ht = Vt.clientY - H.clientY, yt = Vt.time - H.time;
808
+ it = -(Ht / yt);
806
809
  }
807
810
  }
808
- Z(), g.shouldCancelNextClick && (g.clickResetTimer = window.setTimeout(() => {
809
- const Y = U.current;
810
- Y.shouldCancelNextClick = !1, Y.clickResetTimer = null;
811
+ st(), y.shouldCancelNextClick && (y.clickResetTimer = window.setTimeout(() => {
812
+ const W = X.current;
813
+ W.shouldCancelNextClick = !1, W.clickResetTimer = null;
811
814
  }, 0));
812
- const J = E.current.startVelocityThreshold;
813
- K(), Math.abs(xt) >= J && it.current?.(xt);
814
- }, Tt = (h) => {
815
- if (!(dt.current && ft.current) || h.button !== 0 && h.pointerType === "mouse" || h.ctrlKey || h.metaKey || h.altKey || rt(h.target))
815
+ const B = D.current.startVelocityThreshold;
816
+ Q(), Math.abs(it) >= B && dt.current?.(it);
817
+ }, ht = (p) => {
818
+ if (!(mt.current && vt.current) || p.button !== 0 && p.pointerType === "mouse" || p.ctrlKey || p.metaKey || p.altKey || nt(p.target))
816
819
  return;
817
- window.dispatchEvent(new CustomEvent(he, { detail: { paneId: W } })), A.current?.();
818
- const g = U.current;
819
- Z(), g.pointerId = h.pointerId, g.startClientY = h.clientY, g.startScroll = C.current, g.isDragging = !1, g.shouldCancelNextClick = !1, g.velocitySamples = [];
820
- }, wt = (h) => {
821
- const g = U.current;
822
- g.pointerId === h.pointerId && (g.shouldCancelNextClick = !1, P.hasPointerCapture(h.pointerId) && P.releasePointerCapture(h.pointerId), Z(), K());
823
- }, _t = [
824
- ["click", at, !0],
825
- ["pointerdown", Tt, { passive: !1 }],
826
- ["pointermove", It, { passive: !1 }],
827
- ["pointerup", gt, void 0],
828
- ["pointercancel", wt, void 0]
829
- ], Ft = [
830
- ["pointermove", It, { passive: !1 }],
831
- ["pointerup", gt, void 0],
832
- ["pointercancel", wt, void 0]
820
+ window.dispatchEvent(new CustomEvent(xe, { detail: { paneId: rt } })), w.current?.();
821
+ const y = X.current;
822
+ st(), y.pointerId = p.pointerId, y.startClientY = p.clientY, y.startScroll = A.current, y.isDragging = !1, y.shouldCancelNextClick = !1, y.velocitySamples = [];
823
+ }, Rt = (p) => {
824
+ const y = X.current;
825
+ y.pointerId === p.pointerId && (y.shouldCancelNextClick = !1, T.hasPointerCapture(p.pointerId) && T.releasePointerCapture(p.pointerId), st(), Q());
826
+ }, Lt = [
827
+ ["click", ft, !0],
828
+ ["pointerdown", ht, { passive: !1 }],
829
+ ["pointermove", Ft, { passive: !1 }],
830
+ ["pointerup", Pt, void 0],
831
+ ["pointercancel", Rt, void 0]
832
+ ], St = [
833
+ ["pointermove", Ft, { passive: !1 }],
834
+ ["pointerup", Pt, void 0],
835
+ ["pointercancel", Rt, void 0]
833
836
  ];
834
- return ae(P, _t, "add"), ae(window, Ft, "add"), () => {
835
- ae(P, _t, "remove"), ae(window, Ft, "remove");
836
- const h = U.current;
837
- h.pointerId !== null && P.hasPointerCapture(h.pointerId) && P.releasePointerCapture(h.pointerId), Z(), K();
837
+ return le(T, Lt, "add"), le(window, St, "add"), () => {
838
+ le(T, Lt, "remove"), le(window, St, "remove");
839
+ const p = X.current;
840
+ p.pointerId !== null && T.hasPointerCapture(p.pointerId) && T.releasePointerCapture(p.pointerId), st(), Q();
838
841
  };
839
- }, [W]), /* @__PURE__ */ Jt("div", { ref: L, className: Zt("flex", d), style: c, children: [
840
- /* @__PURE__ */ Jt(
842
+ }, [rt]), /* @__PURE__ */ te("div", { ref: V, className: Qt("relative flex", d), style: c, children: [
843
+ /* @__PURE__ */ te(
841
844
  "div",
842
845
  {
843
- ref: R,
844
- className: Zt("relative h-full flex-1 overflow-hidden"),
846
+ ref: F,
847
+ className: Qt("relative h-full flex-1 overflow-hidden"),
845
848
  style: {
846
849
  height: e,
847
- paddingTop: ut.top,
848
- paddingBottom: ut.bottom,
849
- ...p ? { touchAction: "none" } : {}
850
+ paddingTop: Ct.top,
851
+ paddingBottom: Ct.bottom,
852
+ ...m ? { touchAction: "none" } : {}
850
853
  },
851
- id: W,
854
+ id: rt,
852
855
  children: [
853
856
  f,
854
- r(C.current)
857
+ n(A.current)
855
858
  ]
856
859
  }
857
860
  ),
858
- I && /* @__PURE__ */ Q(
859
- rn,
861
+ O && /* @__PURE__ */ U(
862
+ or,
860
863
  {
861
864
  contentSize: t,
862
865
  viewportSize: e,
863
- scrollPosition: C.current,
864
- onScroll: m,
865
- enableThumbDrag: o,
866
+ scrollPosition: A.current,
867
+ onScroll: g,
868
+ enableThumbDrag: s,
866
869
  enableTrackClick: a,
867
870
  enableArrowButtons: u,
868
- scrollBarWidth: n,
869
- ariaControls: W,
870
- tapScrollCircleOptions: S,
871
- itemCount: _,
872
- renderThumbOverlay: X,
873
- visibleStartIndex: ht,
874
- visibleEndIndex: H
871
+ scrollBarWidth: r,
872
+ ariaControls: rt,
873
+ tapScrollCircleOptions: P,
874
+ itemCount: N,
875
+ renderThumbOverlay: q,
876
+ visibleStartIndex: It,
877
+ visibleEndIndex: $
875
878
  }
876
- )
879
+ ),
880
+ k?.()
877
881
  ] });
878
882
  }
879
- ), Se = (r, t, e) => Math.min(Math.max(r, t), e), Pn = ({ dragState: r, normalizedDistance: t, sizeScale: e, size: n }) => {
880
- const o = Math.max(n / 2, 1), a = 1 + t * 0.65, u = Math.max(0.65, 1 - t * 0.25), p = r.direction * t * 26 * e, l = 0.8 + t * 0.18, d = 3 * e, c = 6 * e, f = 22 * e, S = Math.abs(p) + c, b = p > 0 ? d : -Math.abs(p) - d, _ = Math.max(2.5, 3 * e), X = Se(r.offsetX, -o, o), k = Se(r.offsetY, -o, o), B = o * 0.35, ht = X / o * B, H = k / o * B, F = ht * 0.45, C = H * 0.45, L = Math.max(f * 0.38, 6), R = 0.65 + t * 0.2, N = r.active;
881
- return /* @__PURE__ */ Jt(we, { children: [
882
- /* @__PURE__ */ Q(
883
+ ), ye = (n, t, e) => Math.min(Math.max(n, t), e), Tr = ({ dragState: n, normalizedDistance: t, sizeScale: e, size: r }) => {
884
+ const s = Math.max(r / 2, 1), a = 1 + t * 0.65, u = Math.max(0.65, 1 - t * 0.25), m = n.direction * t * 26 * e, l = 0.8 + t * 0.18, d = 3 * e, c = 6 * e, f = 22 * e, P = Math.abs(m) + c, v = m > 0 ? d : -Math.abs(m) - d, N = Math.max(2.5, 3 * e), q = ye(n.offsetX, -s, s), L = ye(n.offsetY, -s, s), K = s * 0.35, It = q / s * K, $ = L / s * K, k = It * 0.45, z = $ * 0.45, A = Math.max(f * 0.38, 6), V = 0.65 + t * 0.2, F = n.active;
885
+ return /* @__PURE__ */ te(Re, { children: [
886
+ /* @__PURE__ */ U(
883
887
  "div",
884
888
  {
885
889
  className: "aqvs:tap-scroll-circle-gradient absolute inset-0 rounded-full border border-white/40 shadow-md",
886
890
  style: {
887
891
  transform: `scale(${u}, ${a})`,
888
- transition: N ? "40ms transform ease-out" : "200ms ease transform"
892
+ transition: F ? "40ms transform ease-out" : "200ms ease transform"
889
893
  }
890
894
  }
891
895
  ),
892
- /* @__PURE__ */ Q(
896
+ /* @__PURE__ */ U(
893
897
  "div",
894
898
  {
895
899
  className: "absolute top-1/2 left-1/2 rounded-full border border-white/50 bg-white/85",
896
900
  style: {
897
901
  width: f,
898
902
  height: f,
899
- transform: `translate(calc(-50% + ${ht}px), calc(-50% + ${H}px)) scale(${u}, ${l * a})`,
900
- transition: N ? "70ms transform ease-out" : "200ms ease transform"
903
+ transform: `translate(calc(-50% + ${It}px), calc(-50% + ${$}px)) scale(${u}, ${l * a})`,
904
+ transition: F ? "70ms transform ease-out" : "200ms ease transform"
901
905
  }
902
906
  }
903
907
  ),
904
- /* @__PURE__ */ Q(
908
+ /* @__PURE__ */ U(
905
909
  "div",
906
910
  {
907
911
  className: "absolute top-1/2 left-1/2 rounded-full bg-white/80",
908
912
  style: {
909
- width: L,
910
- height: L,
911
- transform: `translate(calc(-50% + ${F}px), calc(-50% + ${C}px)) scale(${u}, ${a})`,
912
- opacity: R,
913
+ width: A,
914
+ height: A,
915
+ transform: `translate(calc(-50% + ${k}px), calc(-50% + ${z}px)) scale(${u}, ${a})`,
916
+ opacity: V,
913
917
  boxShadow: "0 0 8px rgba(255,255,255,0.45)",
914
- transition: N ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
918
+ transition: F ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
915
919
  }
916
920
  }
917
921
  ),
918
- /* @__PURE__ */ Q(
922
+ /* @__PURE__ */ U(
919
923
  "div",
920
924
  {
921
925
  className: "absolute top-1/2 left-1/2 rounded-full bg-white/50",
922
926
  style: {
923
- width: _,
924
- height: S,
925
- transform: `translate(-50%, ${b}px)`,
927
+ width: N,
928
+ height: P,
929
+ transform: `translate(-50%, ${v}px)`,
926
930
  opacity: t,
927
- transition: N ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
931
+ transition: F ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
928
932
  }
929
933
  }
930
934
  )
931
935
  ] });
932
- }, sn = (r) => {
933
- if (!Number.isFinite(r))
936
+ }, ir = (n) => {
937
+ if (!Number.isFinite(n))
934
938
  return 0n;
935
- const t = Math.trunc(r);
939
+ const t = Math.trunc(n);
936
940
  return t <= 0 ? 0n : BigInt(t);
937
- }, le = (r) => {
938
- if (r <= 0 || !Number.isFinite(r))
941
+ }, ce = (n) => {
942
+ if (n <= 0 || !Number.isFinite(n))
939
943
  return 0;
940
- const t = Math.trunc(r), e = BigInt(t) & -BigInt(t);
944
+ const t = Math.trunc(n), e = BigInt(t) & -BigInt(t);
941
945
  return Number(e);
942
946
  };
943
- class an {
947
+ class ar {
944
948
  /**
945
949
  * @private
946
950
  * @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
@@ -980,8 +984,8 @@ class an {
980
984
  * @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
981
985
  * @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
982
986
  */
983
- constructor(t, e, n) {
984
- this.reset(t, e, n);
987
+ constructor(t, e, r) {
988
+ this.reset(t, e, r);
985
989
  }
986
990
  /**
987
991
  * @method reset
@@ -991,16 +995,16 @@ class an {
991
995
  * @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
992
996
  * @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
993
997
  */
994
- reset(t, e, n) {
998
+ reset(t, e, r) {
995
999
  if (this.size = t, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, typeof e == "function") {
996
1000
  if (this.valueFn = e, this.size > 0) {
997
- const a = n?.sampleRange ?? {
1001
+ const a = r?.sampleRange ?? {
998
1002
  from: 0,
999
1003
  to: Math.min(99, this.size - 1)
1000
- }, { mode: u, materializedValues: p } = this._calculateMode(a.from, a.to);
1001
- if (this.baseValue = u, n?.materialize)
1002
- for (let l = 0; l < p.length; l++) {
1003
- const d = p[l], c = a.from + l;
1004
+ }, { mode: u, materializedValues: m } = this._calculateMode(a.from, a.to);
1005
+ if (this.baseValue = u, r?.materialize)
1006
+ for (let l = 0; l < m.length; l++) {
1007
+ const d = m[l], c = a.from + l;
1004
1008
  if (c >= this.size)
1005
1009
  break;
1006
1010
  const f = d - this.baseValue;
@@ -1033,30 +1037,30 @@ class an {
1033
1037
  _calculateMode(t, e) {
1034
1038
  if (!this.valueFn)
1035
1039
  return { mode: 0, materializedValues: [] };
1036
- const n = [];
1040
+ const r = [];
1037
1041
  for (let d = t; d <= e && !(d >= this.size); d++)
1038
- n.push(this.valueFn(d));
1039
- const o = [...n];
1040
- if (n.length === 0)
1042
+ r.push(this.valueFn(d));
1043
+ const s = [...r];
1044
+ if (r.length === 0)
1041
1045
  return { mode: 0, materializedValues: [] };
1042
- n.sort((d, c) => d - c);
1043
- const a = Math.floor(n.length / 2);
1046
+ r.sort((d, c) => d - c);
1047
+ const a = Math.floor(r.length / 2);
1044
1048
  let u;
1045
- n.length % 2 === 0 ? u = Math.floor((n[a - 1] + n[a]) / 2) : u = n[a];
1046
- const p = /* @__PURE__ */ new Map();
1049
+ r.length % 2 === 0 ? u = Math.floor((r[a - 1] + r[a]) / 2) : u = r[a];
1050
+ const m = /* @__PURE__ */ new Map();
1047
1051
  let l = 0;
1048
- for (const d of n) {
1049
- const c = (p.get(d) ?? 0) + 1;
1050
- p.set(d, c), c > l && (l = c);
1052
+ for (const d of r) {
1053
+ const c = (m.get(d) ?? 0) + 1;
1054
+ m.set(d, c), c > l && (l = c);
1051
1055
  }
1052
- if (l > n.length * 0.2) {
1056
+ if (l > r.length * 0.2) {
1053
1057
  const d = [];
1054
- for (const [f, S] of p.entries())
1055
- S === l && d.push(f);
1056
- const c = d.reduce((f, S) => f + S, 0);
1058
+ for (const [f, P] of m.entries())
1059
+ P === l && d.push(f);
1060
+ const c = d.reduce((f, P) => f + P, 0);
1057
1061
  u = Math.floor(c / d.length);
1058
1062
  }
1059
- return { mode: u, materializedValues: o };
1063
+ return { mode: u, materializedValues: s };
1060
1064
  }
1061
1065
  /**
1062
1066
  * @method update
@@ -1095,11 +1099,11 @@ class an {
1095
1099
  * @param {DeltaUpdate[]} updates - An array of updates, each with an index and the change to apply.
1096
1100
  */
1097
1101
  updateDeltas(t) {
1098
- for (const { index: e, change: n } of t) {
1102
+ for (const { index: e, change: r } of t) {
1099
1103
  if (e < 0 || e >= this.size)
1100
1104
  throw new Error(`Index ${e} out of bounds`);
1101
- const o = this.deltas.get(e) ?? 0;
1102
- this.deltas.set(e, o + n), this._updateTree(e, n);
1105
+ const s = this.deltas.get(e) ?? 0;
1106
+ this.deltas.set(e, s + r), this._updateTree(e, r);
1103
1107
  }
1104
1108
  return this.total;
1105
1109
  }
@@ -1114,13 +1118,13 @@ class an {
1114
1118
  _updateTree(t, e) {
1115
1119
  if (e === 0)
1116
1120
  return;
1117
- let n = t + 1;
1118
- for (; n <= this.size; ) {
1119
- this.tree.set(n, (this.tree.get(n) ?? 0) + e);
1120
- const o = le(n);
1121
- if (o === 0)
1121
+ let r = t + 1;
1122
+ for (; r <= this.size; ) {
1123
+ this.tree.set(r, (this.tree.get(r) ?? 0) + e);
1124
+ const s = ce(r);
1125
+ if (s === 0)
1122
1126
  break;
1123
- n += o;
1127
+ r += s;
1124
1128
  }
1125
1129
  this.total !== void 0 && (this.total += e);
1126
1130
  }
@@ -1134,13 +1138,13 @@ class an {
1134
1138
  */
1135
1139
  _buildDeltaUpdates(t) {
1136
1140
  const e = [];
1137
- for (const { index: n, value: o } of t) {
1138
- if (n < 0 || n >= this.size)
1139
- throw new Error(`Index ${n} out of bounds`);
1140
- if (o < 0)
1141
+ for (const { index: r, value: s } of t) {
1142
+ if (r < 0 || r >= this.size)
1143
+ throw new Error(`Index ${r} out of bounds`);
1144
+ if (s < 0)
1141
1145
  throw new Error("Value cannot be negative.");
1142
- const a = this.deltas.has(n) ? (this.deltas.get(n) ?? 0) + this.baseValue : this.baseValue, u = o - a;
1143
- u !== 0 && e.push({ index: n, change: u });
1146
+ const a = this.deltas.has(r) ? (this.deltas.get(r) ?? 0) + this.baseValue : this.baseValue, u = s - a;
1147
+ u !== 0 && e.push({ index: r, change: u });
1144
1148
  }
1145
1149
  return e;
1146
1150
  }
@@ -1157,10 +1161,10 @@ class an {
1157
1161
  let t = 0, e = this.size;
1158
1162
  for (; e > 0; ) {
1159
1163
  t += this.tree.get(e) ?? 0;
1160
- const n = le(e);
1161
- if (n === 0)
1164
+ const r = ce(e);
1165
+ if (r === 0)
1162
1166
  break;
1163
- e -= n;
1167
+ e -= r;
1164
1168
  }
1165
1169
  return t + this.baseValue * this.size;
1166
1170
  }
@@ -1174,9 +1178,9 @@ class an {
1174
1178
  */
1175
1179
  _materialize(t, e = !0) {
1176
1180
  if (this.valueFn) {
1177
- const n = this.deltas.get(t) ?? 0, a = this.valueFn(t) - this.baseValue;
1178
- if (a !== n && (this.deltas.set(t, a), e)) {
1179
- const u = a - n;
1181
+ const r = this.deltas.get(t) ?? 0, a = this.valueFn(t) - this.baseValue;
1182
+ if (a !== r && (this.deltas.set(t, a), e)) {
1183
+ const u = a - r;
1180
1184
  this._updateTree(t, u);
1181
1185
  }
1182
1186
  }
@@ -1190,23 +1194,23 @@ class an {
1190
1194
  * @param {number | undefined} index - Target index for materialization.
1191
1195
  * @param {boolean} [forceIndex=false] - When true, materializes the index even if it is outside the provided ranges.
1192
1196
  */
1193
- _materializeRanges(t, e, n = !1) {
1197
+ _materializeRanges(t, e, r = !1) {
1194
1198
  if (!(t?.materialize && this.valueFn))
1195
1199
  return;
1196
- const o = t.ranges;
1197
- if (o && o.length > 0) {
1198
- for (const p of o) {
1199
- const l = p.from, d = Math.min(p.to, this.size - 1);
1200
+ const s = t.ranges;
1201
+ if (s && s.length > 0) {
1202
+ for (const m of s) {
1203
+ const l = m.from, d = Math.min(m.to, this.size - 1);
1200
1204
  for (let c = l; c <= d; c++)
1201
1205
  this._materialize(c);
1202
1206
  }
1203
1207
  if (e === void 0)
1204
1208
  return;
1205
- if (n) {
1209
+ if (r) {
1206
1210
  this._materialize(e);
1207
1211
  return;
1208
1212
  }
1209
- const a = o[0].from, u = o[o.length - 1].to;
1213
+ const a = s[0].from, u = s[s.length - 1].to;
1210
1214
  e >= a && e <= u && this._materialize(e);
1211
1215
  return;
1212
1216
  }
@@ -1222,17 +1226,17 @@ class an {
1222
1226
  * @param {boolean} chooseLowerBound - When true, finds the smallest index meeting or exceeding the target; otherwise finds the largest index not exceeding it.
1223
1227
  * @returns {{ index: number; total: number | undefined; cumulative: number | undefined; currentValue: number | undefined; safeIndex: number | undefined }} Binary search result.
1224
1228
  */
1225
- _findIndex(t, e = {}, n) {
1229
+ _findIndex(t, e = {}, r) {
1226
1230
  if (this.size >= Number.MAX_SAFE_INTEGER)
1227
- return this._findIndexLarge(t, e, n);
1231
+ return this._findIndexLarge(t, e, r);
1228
1232
  if (this.size === 0)
1229
1233
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1230
- let o = 0, a = this.size - 1, u = -1, p, l, d = this.total;
1231
- for (; o <= a; ) {
1232
- const f = Math.floor((o + a) / 2);
1233
- p = this.prefixSum(f, e), d = p.total, (n ? p.cumulative >= t : p.cumulative <= t) ? (u = f, l = p, n ? a = f - 1 : o = f + 1) : n ? o = f + 1 : a = f - 1;
1234
+ let s = 0, a = this.size - 1, u = -1, m, l, d = this.total;
1235
+ for (; s <= a; ) {
1236
+ const f = Math.floor((s + a) / 2);
1237
+ m = this.prefixSum(f, e), d = m.total, (r ? m.cumulative >= t : m.cumulative <= t) ? (u = f, l = m, r ? a = f - 1 : s = f + 1) : r ? s = f + 1 : a = f - 1;
1234
1238
  }
1235
- const c = l ?? p;
1239
+ const c = l ?? m;
1236
1240
  return { index: u, total: d, cumulative: c?.cumulative, currentValue: c?.currentValue, safeIndex: c?.safeIndex };
1237
1241
  }
1238
1242
  /**
@@ -1240,33 +1244,33 @@ class an {
1240
1244
  *
1241
1245
  * 非常に大きなサイズに対して bigint 演算を用いた二分探索を実施。
1242
1246
  */
1243
- _findIndexLarge(t, e, n) {
1247
+ _findIndexLarge(t, e, r) {
1244
1248
  if (this.size === 0)
1245
1249
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1246
- const o = sn(this.size);
1247
- if (o === 0n)
1250
+ const s = ir(this.size);
1251
+ if (s === 0n)
1248
1252
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1249
- let a = 0n, u = o - 1n, p, l, d, c = this.total;
1253
+ let a = 0n, u = s - 1n, m, l, d, c = this.total;
1250
1254
  for (; a <= u; ) {
1251
- const b = a + u >> 1n, _ = Number(b), X = this.prefixSum(_, e);
1252
- if (d = X, c = X.total, n ? X.cumulative >= t : X.cumulative <= t)
1253
- if (p = b, l = X, n) {
1254
- if (b === 0n)
1255
+ const v = a + u >> 1n, N = Number(v), q = this.prefixSum(N, e);
1256
+ if (d = q, c = q.total, r ? q.cumulative >= t : q.cumulative <= t)
1257
+ if (m = v, l = q, r) {
1258
+ if (v === 0n)
1255
1259
  break;
1256
- u = b - 1n;
1260
+ u = v - 1n;
1257
1261
  } else
1258
- a = b + 1n;
1259
- else if (n)
1260
- a = b + 1n;
1262
+ a = v + 1n;
1263
+ else if (r)
1264
+ a = v + 1n;
1261
1265
  else {
1262
- if (b === 0n)
1266
+ if (v === 0n)
1263
1267
  break;
1264
- u = b - 1n;
1268
+ u = v - 1n;
1265
1269
  }
1266
1270
  }
1267
1271
  const f = l ?? d;
1268
1272
  return {
1269
- index: p !== void 0 ? Number(p) : -1,
1273
+ index: m !== void 0 ? Number(m) : -1,
1270
1274
  total: c,
1271
1275
  cumulative: f?.cumulative,
1272
1276
  currentValue: f?.currentValue,
@@ -1284,19 +1288,19 @@ class an {
1284
1288
  prefixSum(t, e) {
1285
1289
  if (t < 0)
1286
1290
  return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
1287
- const n = mt(t, 0, this.size - 1), o = e?.materializeOption;
1288
- this._materializeRanges(o, n, !0);
1289
- let a = 0, u = n + 1;
1291
+ const r = xt(t, 0, this.size - 1), s = e?.materializeOption;
1292
+ this._materializeRanges(s, r, !0);
1293
+ let a = 0, u = r + 1;
1290
1294
  for (; u > 0; ) {
1291
1295
  const l = this.tree.get(u) ?? 0;
1292
1296
  a += l;
1293
- const d = le(u);
1297
+ const d = ce(u);
1294
1298
  if (d === 0)
1295
1299
  break;
1296
1300
  u -= d;
1297
1301
  }
1298
- const p = o?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
1299
- return { cumulative: a + this.baseValue * (n + 1), total: this.total, currentValue: p, safeIndex: n };
1302
+ const m = s?.materialize ? this.get(r) : (this.deltas.get(r) || 0) + this.baseValue;
1303
+ return { cumulative: a + this.baseValue * (r + 1), total: this.total, currentValue: m, safeIndex: r };
1300
1304
  }
1301
1305
  /**
1302
1306
  * @method get
@@ -1309,8 +1313,8 @@ class an {
1309
1313
  get(t, e) {
1310
1314
  if (t < 0 || t >= this.size)
1311
1315
  throw new Error("Index out of bounds");
1312
- const n = e?.materializeOption;
1313
- return this._materializeRanges(n, t), (this.deltas.get(t) ?? 0) + this.baseValue;
1316
+ const r = e?.materializeOption;
1317
+ return this._materializeRanges(r, t), (this.deltas.get(t) ?? 0) + this.baseValue;
1314
1318
  }
1315
1319
  /**
1316
1320
  * @method getTotal
@@ -1326,8 +1330,8 @@ class an {
1326
1330
  this.total = 0;
1327
1331
  else {
1328
1332
  this.total = this._computeTreeTotal();
1329
- const n = this.prefixSum(this.getSize() - 1);
1330
- console.assert(n.cumulative === n.total, "Inconsistent Fenwick Tree state");
1333
+ const r = this.prefixSum(this.getSize() - 1);
1334
+ console.assert(r.cumulative === r.total, "Inconsistent Fenwick Tree state");
1331
1335
  }
1332
1336
  return this.total;
1333
1337
  }
@@ -1340,18 +1344,18 @@ class an {
1340
1344
  */
1341
1345
  rebuildTree(t) {
1342
1346
  if (t?.materialize && this.valueFn) {
1343
- const n = this.valueFn;
1344
- this.reset(this.size, (o) => n(o), { materialize: !0 });
1347
+ const r = this.valueFn;
1348
+ this.reset(this.size, (s) => r(s), { materialize: !0 });
1345
1349
  return;
1346
1350
  }
1347
1351
  const e = /* @__PURE__ */ new Map();
1348
- for (const [n, o] of this.deltas.entries()) {
1349
- if (o === 0)
1352
+ for (const [r, s] of this.deltas.entries()) {
1353
+ if (s === 0)
1350
1354
  continue;
1351
- let a = n + 1;
1355
+ let a = r + 1;
1352
1356
  for (; a <= this.size; ) {
1353
- e.set(a, (e.get(a) ?? 0) + o);
1354
- const u = le(a);
1357
+ e.set(a, (e.get(a) ?? 0) + s);
1358
+ const u = ce(a);
1355
1359
  if (u === 0)
1356
1360
  break;
1357
1361
  a += u;
@@ -1384,11 +1388,11 @@ class an {
1384
1388
  if (t === e)
1385
1389
  return;
1386
1390
  if (t < e)
1387
- for (const o of this.deltas.keys())
1388
- o >= t && this.deltas.delete(o);
1391
+ for (const s of this.deltas.keys())
1392
+ s >= t && this.deltas.delete(s);
1389
1393
  this.size = t, this.rebuildTree();
1390
- const n = this.prefixSum(this.getSize() - 1);
1391
- console.assert(n.cumulative === n.total, "Inconsistent Fenwick Tree state");
1394
+ const r = this.prefixSum(this.getSize() - 1);
1395
+ console.assert(r.cumulative === r.total, "Inconsistent Fenwick Tree state");
1392
1396
  }
1393
1397
  /**
1394
1398
  * @method getSize
@@ -1428,11 +1432,11 @@ class an {
1428
1432
  return this._findIndex(t, e ?? {}, !1);
1429
1433
  }
1430
1434
  }
1431
- const ln = (r, t, e) => {
1432
- const n = Math.max(0, r), o = w(null), a = Dt(() => new an(n, t, e), [n, t, e]);
1433
- return Object.is(o.current, a) || console.warn("[useFenwickMapTree] instance changed"), o.current = a, a;
1435
+ const lr = (n, t, e) => {
1436
+ const r = Math.max(0, n), s = M(null), a = kt(() => new ar(r, t, e), [r, t, e]);
1437
+ return Object.is(s.current, a) || console.warn("[useFenwickMapTree] instance changed"), s.current = a, a;
1434
1438
  };
1435
- class cn {
1439
+ class cr {
1436
1440
  key;
1437
1441
  value;
1438
1442
  prev = null;
@@ -1441,7 +1445,7 @@ class cn {
1441
1445
  this.key = t, this.value = e;
1442
1446
  }
1443
1447
  }
1444
- class ve {
1448
+ class Me {
1445
1449
  head = null;
1446
1450
  tail = null;
1447
1451
  /**
@@ -1482,137 +1486,137 @@ class ve {
1482
1486
  this.remove(t), this.addToTail(t);
1483
1487
  }
1484
1488
  }
1485
- function un(r) {
1486
- const t = w(/* @__PURE__ */ new Map()), e = w(new ve());
1487
- O(() => {
1488
- for (; t.current.size > r; ) {
1489
+ function ur(n) {
1490
+ const t = M(/* @__PURE__ */ new Map()), e = M(new Me());
1491
+ Y(() => {
1492
+ for (; t.current.size > n; ) {
1489
1493
  const c = e.current.removeHead();
1490
1494
  if (c)
1491
1495
  t.current.delete(c.key);
1492
1496
  else
1493
1497
  break;
1494
1498
  }
1495
- }, [r]);
1496
- const n = y((c) => {
1499
+ }, [n]);
1500
+ const r = C((c) => {
1497
1501
  const f = t.current.get(c);
1498
1502
  if (f)
1499
1503
  return e.current.moveToTail(f), f.value;
1500
- }, []), o = y(
1504
+ }, []), s = C(
1501
1505
  (c, f) => {
1502
- if (r <= 0)
1506
+ if (n <= 0)
1503
1507
  return;
1504
- let S = t.current.get(c);
1505
- if (S)
1506
- S.value = f, e.current.moveToTail(S);
1508
+ let P = t.current.get(c);
1509
+ if (P)
1510
+ P.value = f, e.current.moveToTail(P);
1507
1511
  else {
1508
- if (t.current.size >= r) {
1509
- const b = e.current.removeHead();
1510
- b && t.current.delete(b.key);
1512
+ if (t.current.size >= n) {
1513
+ const v = e.current.removeHead();
1514
+ v && t.current.delete(v.key);
1511
1515
  }
1512
- S = new cn(c, f), t.current.set(c, S), e.current.addToTail(S);
1516
+ P = new cr(c, f), t.current.set(c, P), e.current.addToTail(P);
1513
1517
  }
1514
1518
  },
1515
- [r]
1516
- ), a = y((c) => t.current.has(c), []), u = y((c) => {
1519
+ [n]
1520
+ ), a = C((c) => t.current.has(c), []), u = C((c) => {
1517
1521
  const f = t.current.get(c);
1518
1522
  f && (e.current.remove(f), t.current.delete(c));
1519
- }, []), p = y(() => {
1520
- t.current.clear(), e.current = new ve();
1521
- }, []), [l, d] = Xt(() => ({ get: n, set: o, has: a, remove: u, clear: p }));
1522
- return O(() => d({ get: n, set: o, has: a, remove: u, clear: p }), [n, o, a, u, p]), l;
1523
+ }, []), m = C(() => {
1524
+ t.current.clear(), e.current = new Me();
1525
+ }, []), [l, d] = Nt(() => ({ get: r, set: s, has: a, remove: u, clear: m }));
1526
+ return Y(() => d({ get: r, set: s, has: a, remove: u, clear: m }), [r, s, a, u, m]), l;
1523
1527
  }
1524
- const dn = 1e4, Sn = () => {
1525
- const { get: r, set: t, has: e, clear: n } = un(dn);
1526
- return { get: r, set: t, has: e, clear: n };
1527
- }, ct = (r, t) => t <= 0 ? 0 : mt(r, 0, t - 1), fn = (r) => ({
1528
- top: Math.max(0, r?.top ?? 0),
1529
- bottom: Math.max(0, r?.bottom ?? 0)
1530
- }), Wt = (r, t) => r <= t ? 0 : r - t, ee = (r, t) => r <= 0 ? t : r + t, Me = (r) => {
1531
- if (!Number.isFinite(r))
1528
+ const dr = 1e4, vr = () => {
1529
+ const { get: n, set: t, has: e, clear: r } = ur(dr);
1530
+ return { get: n, set: t, has: e, clear: r };
1531
+ }, ct = (n, t) => t <= 0 ? 0 : xt(n, 0, t - 1), fr = (n) => ({
1532
+ top: Math.max(0, n?.top ?? 0),
1533
+ bottom: Math.max(0, n?.bottom ?? 0)
1534
+ }), jt = (n, t) => n <= t ? 0 : n - t, ne = (n, t) => n <= 0 ? t : n + t, we = (n) => {
1535
+ if (!Number.isFinite(n))
1532
1536
  return 0n;
1533
- const t = Math.trunc(r);
1537
+ const t = Math.trunc(n);
1534
1538
  return t <= 0 ? 0n : BigInt(t);
1535
- }, pn = (r, t, e, n, o, a, u, p) => {
1536
- const l = Me(n);
1539
+ }, pr = (n, t, e, r, s, a, u, m) => {
1540
+ const l = we(r);
1537
1541
  if (l === 0n)
1538
1542
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
1539
- const d = (F) => F < 0n ? 0n : F >= l ? l - 1n : F, c = { materializeOption: { materialize: !1 } }, { index: f } = a.findIndexAtOrAfter(r, c);
1540
- let S;
1541
- f === -1 ? S = l - 1n : (S = Me(f), S >= l && (S = l - 1n)), r <= 0 && (S = 0n), p && r >= u && (S = l - 1n);
1542
- const b = (F) => {
1543
- let C = 0, L = F, R = F, N = 0n;
1544
- for (; L < l && C < t; ) {
1545
- const st = Number(L), ut = o(st);
1546
- if (C += ut, R = L, L += 1n, N += 1n, !Number.isFinite(ut) || ut <= 0)
1543
+ const d = (k) => k < 0n ? 0n : k >= l ? l - 1n : k, c = { materializeOption: { materialize: !1 } }, { index: f } = a.findIndexAtOrAfter(n, c);
1544
+ let P;
1545
+ f === -1 ? P = l - 1n : (P = we(f), P >= l && (P = l - 1n)), n <= 0 && (P = 0n), m && n >= u && (P = l - 1n);
1546
+ const v = (k) => {
1547
+ let z = 0, A = k, V = k, F = 0n;
1548
+ for (; A < l && z < t; ) {
1549
+ const at = Number(A), G = s(at);
1550
+ if (z += G, V = A, A += 1n, F += 1n, !Number.isFinite(G) || G <= 0)
1547
1551
  break;
1548
1552
  }
1549
- return N === 0n && (R = F), { height: C, end: R };
1553
+ return F === 0n && (V = k), { height: z, end: V };
1550
1554
  };
1551
- let { height: _, end: X } = b(S);
1552
- if (_ < t && S > 0n) {
1553
- let F = S, C = _;
1554
- for (; F > 0n && C < t; ) {
1555
- F -= 1n;
1556
- const R = Number(F), N = o(R);
1557
- if (C += N, !Number.isFinite(N) || N <= 0)
1555
+ let { height: N, end: q } = v(P);
1556
+ if (N < t && P > 0n) {
1557
+ let k = P, z = N;
1558
+ for (; k > 0n && z < t; ) {
1559
+ k -= 1n;
1560
+ const V = Number(k), F = s(V);
1561
+ if (z += F, !Number.isFinite(F) || F <= 0)
1558
1562
  break;
1559
1563
  }
1560
- S = d(F);
1561
- const L = b(S);
1562
- _ = L.height, X = L.end;
1564
+ P = d(k);
1565
+ const A = v(P);
1566
+ N = A.height, q = A.end;
1563
1567
  }
1564
- const k = d(S), B = d(X), ht = d(k - BigInt(Math.max(0, e))), H = d(B + BigInt(Math.max(0, e)));
1568
+ const L = d(P), K = d(q), It = d(L - BigInt(Math.max(0, e))), $ = d(K + BigInt(Math.max(0, e)));
1565
1569
  return {
1566
- renderingStartIndex: ct(Number(ht), n),
1567
- renderingEndIndex: ct(Number(H), n),
1568
- visibleStartIndex: ct(Number(k), n),
1569
- visibleEndIndex: ct(Number(B), n)
1570
+ renderingStartIndex: ct(Number(It), r),
1571
+ renderingEndIndex: ct(Number($), r),
1572
+ visibleStartIndex: ct(Number(L), r),
1573
+ visibleEndIndex: ct(Number(K), r)
1570
1574
  };
1571
- }, mn = (r, t, e, n, o, a, u) => {
1572
- if (n === 0)
1575
+ }, mr = (n, t, e, r, s, a, u) => {
1576
+ if (r === 0)
1573
1577
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
1574
- const p = Number.isFinite(u), l = p ? Math.min(Math.max(0, r), u) : Math.max(0, r);
1575
- if (n >= Number.MAX_SAFE_INTEGER)
1576
- return pn(l, t, e, n, o, a, u, p);
1577
- const { index: d, cumulative: c, currentValue: f } = a.findIndexAtOrAfter(l, { materializeOption: { materialize: !1 } }), S = d === -1 ? t <= 0 || (c ?? 0) < l + (f ?? 0) ? n - 1 : 0 : d;
1578
- let b = ct(S, n), _ = 0;
1579
- if (b === d && c !== void 0 && f !== void 0)
1580
- _ = c - f - l;
1578
+ const m = Number.isFinite(u), l = m ? Math.min(Math.max(0, n), u) : Math.max(0, n);
1579
+ if (r >= Number.MAX_SAFE_INTEGER)
1580
+ return pr(l, t, e, r, s, a, u, m);
1581
+ const { index: d, cumulative: c, currentValue: f } = a.findIndexAtOrAfter(l, { materializeOption: { materialize: !1 } }), P = d === -1 ? t <= 0 || (c ?? 0) < l + (f ?? 0) ? r - 1 : 0 : d;
1582
+ let v = ct(P, r), N = 0;
1583
+ if (v === d && c !== void 0 && f !== void 0)
1584
+ N = c - f - l;
1581
1585
  else {
1582
- const { cumulative: F, currentValue: C } = a.prefixSum(b, { materializeOption: { materialize: !1 } });
1583
- _ = (F ?? 0) - (C ?? 0) - l;
1586
+ const { cumulative: k, currentValue: z } = a.prefixSum(v, { materializeOption: { materialize: !1 } });
1587
+ N = (k ?? 0) - (z ?? 0) - l;
1584
1588
  }
1585
- const X = _;
1586
- let k = b;
1587
- for (; k < n && _ < t; )
1588
- _ += o(k), k++;
1589
- if (_ < t && b > 0) {
1590
- let F = _ + Math.abs(Math.min(0, X)), C = b - 1;
1591
- for (; C >= 0 && F < t; )
1592
- F += o(C), C--;
1593
- for (b = ct(C + 1, n), _ = 0, k = b; k < n && _ < t; )
1594
- _ += o(k), k++;
1589
+ const q = N;
1590
+ let L = v;
1591
+ for (; L < r && N < t; )
1592
+ N += s(L), L++;
1593
+ if (N < t && v > 0) {
1594
+ let k = N + Math.abs(Math.min(0, q)), z = v - 1;
1595
+ for (; z >= 0 && k < t; )
1596
+ k += s(z), z--;
1597
+ for (v = ct(z + 1, r), N = 0, L = v; L < r && N < t; )
1598
+ N += s(L), L++;
1595
1599
  }
1596
- const B = ct(b - e, n), ht = ct(Math.max(k - 1, b), n), H = ct(ht + e, n);
1597
- return { renderingStartIndex: B, renderingEndIndex: H, visibleStartIndex: b, visibleEndIndex: ht };
1598
- }, hn = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), ye = (r, t, e) => {
1599
- const n = Math.max(0, t ?? 0), o = w({
1600
+ const K = ct(v - e, r), It = ct(Math.max(L - 1, v), r), $ = ct(It + e, r);
1601
+ return { renderingStartIndex: K, renderingEndIndex: $, visibleStartIndex: v, visibleEndIndex: It };
1602
+ }, hr = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), Ce = (n, t, e) => {
1603
+ const r = Math.max(0, t ?? 0), s = M({
1600
1604
  lastInvokeAt: 0,
1601
1605
  rafId: null,
1602
1606
  pendingPayload: null,
1603
1607
  loopActive: !1,
1604
- normalizedThrottle: n
1605
- }), a = y(() => {
1606
- const l = o.current;
1608
+ normalizedThrottle: r
1609
+ }), a = C(() => {
1610
+ const l = s.current;
1607
1611
  l.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(l.rafId), l.rafId = null, l.loopActive = !1;
1608
- }, []), u = y(
1612
+ }, []), u = C(
1609
1613
  (l) => {
1610
- const d = o.current;
1614
+ const d = s.current;
1611
1615
  d.rafId = null;
1612
- const c = typeof l == "number" ? l : hn(), f = d.normalizedThrottle, S = d.pendingPayload, b = r.current;
1613
- if (S !== null && b) {
1614
- const _ = c - d.lastInvokeAt;
1615
- (f === 0 || d.lastInvokeAt === 0 || _ >= f) && (d.pendingPayload = null, d.lastInvokeAt = c, e(b, S));
1616
+ const c = typeof l == "number" ? l : hr(), f = d.normalizedThrottle, P = d.pendingPayload, v = n.current;
1617
+ if (P !== null && v) {
1618
+ const N = c - d.lastInvokeAt;
1619
+ (f === 0 || d.lastInvokeAt === 0 || N >= f) && (d.pendingPayload = null, d.lastInvokeAt = c, e(v, P));
1616
1620
  }
1617
1621
  if (d.pendingPayload !== null) {
1618
1622
  typeof requestAnimationFrame == "function" ? d.rafId = requestAnimationFrame(u) : d.loopActive = !1;
@@ -1620,9 +1624,9 @@ const dn = 1e4, Sn = () => {
1620
1624
  }
1621
1625
  d.loopActive = !1;
1622
1626
  },
1623
- [r, e]
1624
- ), p = y(() => {
1625
- const l = o.current;
1627
+ [n, e]
1628
+ ), m = C(() => {
1629
+ const l = s.current;
1626
1630
  if (!l.loopActive) {
1627
1631
  if (l.loopActive = !0, typeof requestAnimationFrame == "function") {
1628
1632
  l.rafId = requestAnimationFrame(u);
@@ -1631,346 +1635,379 @@ const dn = 1e4, Sn = () => {
1631
1635
  l.loopActive = !1;
1632
1636
  }
1633
1637
  }, [u]);
1634
- return O(() => () => {
1635
- a(), o.current.pendingPayload = null;
1636
- }, [a]), O(() => {
1638
+ return Y(() => () => {
1639
+ a(), s.current.pendingPayload = null;
1640
+ }, [a]), Y(() => {
1637
1641
  a();
1638
- const l = o.current;
1639
- l.lastInvokeAt = 0, l.pendingPayload = null, l.normalizedThrottle = n;
1640
- }, [n, a]), y(
1642
+ const l = s.current;
1643
+ l.lastInvokeAt = 0, l.pendingPayload = null, l.normalizedThrottle = r;
1644
+ }, [r, a]), C(
1641
1645
  (l) => {
1642
- const d = o.current;
1643
- d.pendingPayload = l, p();
1646
+ const d = s.current;
1647
+ d.pendingPayload = l, m();
1644
1648
  },
1645
- [p]
1649
+ [m]
1646
1650
  );
1647
- }, gn = ({
1648
- itemCount: r,
1651
+ }, gr = ({
1652
+ itemCount: n,
1649
1653
  getItem: t,
1650
1654
  getItemHeight: e,
1651
- viewportSize: n,
1652
- overscanCount: o = 15,
1655
+ viewportSize: r,
1656
+ overscanCount: s = 15,
1653
1657
  className: a,
1654
1658
  onScroll: u,
1655
- onRangeChange: p,
1659
+ onRangeChange: m,
1656
1660
  children: l,
1657
1661
  background: d,
1658
1662
  initialScrollIndex: c,
1659
1663
  initialScrollOffset: f,
1660
- tapScrollCircleOptions: S,
1661
- scrollBarWidth: b,
1662
- enableThumbDrag: _,
1663
- enableTrackClick: X,
1664
- enableArrowButtons: k,
1665
- enablePointerDrag: B,
1666
- inertiaOptions: ht,
1667
- callbackThrottleMs: H = 5,
1668
- renderThumbOverlay: F,
1669
- wheelSpeedMultiplier: C,
1670
- contentInsets: L,
1671
- enableKeyboardNavigation: R = !0,
1672
- onItemFocus: N,
1673
- clipItemHeight: st = !1
1674
- }, ut) => {
1675
- const $ = w(null), I = w(!1), m = Dt(() => fn(L), [L]), tt = w({ size: r, valueOrFn: e, options: { sampleRange: { from: 0, to: 100 } } }), A = ln(tt.current.size, tt.current.valueOrFn, tt.current.options), [et] = Xt(() => {
1676
- let i = m.top, T = 0;
1664
+ tapScrollCircleOptions: P,
1665
+ scrollBarWidth: v,
1666
+ enableThumbDrag: N,
1667
+ enableTrackClick: q,
1668
+ enableArrowButtons: L,
1669
+ enablePointerDrag: K,
1670
+ inertiaOptions: It,
1671
+ callbackThrottleMs: $ = 5,
1672
+ renderThumbOverlay: k,
1673
+ wheelSpeedMultiplier: z,
1674
+ contentInsets: A,
1675
+ enableKeyboardNavigation: V = !0,
1676
+ onItemFocus: F,
1677
+ clipItemHeight: at = !1,
1678
+ enableScrollToTopBottomButtons: G
1679
+ }, Ct) => {
1680
+ const I = M(null), O = M(!1), g = kt(() => fr(A), [A]), et = M({ size: n, valueOrFn: e, options: { sampleRange: { from: 0, to: 100 } } }), w = lr(et.current.size, et.current.valueOrFn, et.current.options), [ut] = Nt(() => {
1681
+ let i = g.top, x = 0;
1677
1682
  if (typeof c == "number") {
1678
- const M = mt(c, 0, r - 1), D = mt(M - o * 2, 0, r - 1), q = mt(M + o * 2, 0, r - 1), j = c > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: D, to: q }] } } : void 0, { cumulative: Rt, total: Ht, currentValue: Ot } = A.prefixSum(c, j), Ut = Math.max(Rt - Ot, 0);
1679
- i = ee(Ut, m.top), T = Ht ?? A.getTotal();
1680
- } else typeof f == "number" && (i = ee(Math.max(f, 0), m.top)), T = A.getTotal();
1681
- return { position: i, total: T };
1682
- }), [it, At] = Xt(et.position), [W, U] = Xt(et.total), [dt, ft] = Xt(et.position), [E, P] = Xt(r), v = w(et.position), nt = w(m.top), K = w(u ?? void 0), Z = w(p ?? void 0), pt = w(/* @__PURE__ */ new Map()), rt = w(null), at = w(null);
1683
- O(() => {
1684
- K.current = u ?? void 0, Z.current = p ?? void 0;
1685
- }, [p, u]);
1686
- const ot = y(
1683
+ const b = xt(c, 0, n - 1), _ = xt(b - s * 2, 0, n - 1), j = xt(b + s * 2, 0, n - 1), Z = c > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: _, to: j }] } } : void 0, { cumulative: Mt, total: zt, currentValue: Dt } = w.prefixSum(c, Z), o = Math.max(Mt - Dt, 0);
1684
+ i = ne(o, g.top), x = zt ?? w.getTotal();
1685
+ } else typeof f == "number" && (i = ne(Math.max(f, 0), g.top)), x = w.getTotal();
1686
+ return { position: i, total: x };
1687
+ }), [dt, Tt] = Nt(ut.position), [rt, X] = Nt(ut.total), [mt, vt] = Nt(ut.position), [D, T] = Nt(n), S = M(ut.position), J = M(g.top), Q = M(u ?? void 0), st = M(m ?? void 0), bt = M(/* @__PURE__ */ new Map()), nt = M(null), ft = M(null), [lt, Ft] = Nt(null), [Pt, ht] = Nt(!1), Rt = M(null), Lt = M(!1);
1688
+ Y(() => {
1689
+ Q.current = u ?? void 0, st.current = m ?? void 0;
1690
+ }, [m, u]);
1691
+ const St = C(
1687
1692
  (i) => {
1688
- if (R && i && typeof i.focus == "function")
1693
+ if (V && i && typeof i.focus == "function")
1689
1694
  try {
1690
1695
  i.focus({ preventScroll: !0 });
1691
1696
  } catch {
1692
1697
  i.focus();
1693
1698
  }
1694
1699
  },
1695
- [R]
1696
- ), It = ye(K, H, (i, { position: T, totalHeight: M }) => {
1697
- i(T, M);
1698
- }), gt = ye(Z, H, (i, { renderingStartIndex: T, renderingEndIndex: M, visibleStartIndex: D, visibleEndIndex: q, scrollPosition: j, totalHeight: Rt }) => {
1699
- i(T, M, D, q, j, Rt);
1700
+ [V]
1701
+ ), p = Ce(Q, $, (i, { position: x, totalHeight: b }) => {
1702
+ i(x, b);
1703
+ }), y = Ce(st, $, (i, { renderingStartIndex: x, renderingEndIndex: b, visibleStartIndex: _, visibleEndIndex: j, scrollPosition: Z, totalHeight: Mt }) => {
1704
+ i(x, b, _, j, Z, Mt);
1700
1705
  });
1701
- O(() => (I.current = !0, () => {
1702
- I.current = !1;
1703
- }), []), O(() => {
1704
- R || (pt.current.clear(), rt.current = null, at.current = null);
1705
- }, [R]);
1706
- const Tt = 0.01, wt = w({
1706
+ Y(() => (O.current = !0, () => {
1707
+ O.current = !1;
1708
+ }), []), Y(() => {
1709
+ V || (bt.current.clear(), nt.current = null, ft.current = null);
1710
+ }, [V]);
1711
+ const it = 0.01, B = M({
1707
1712
  rafId: null,
1708
1713
  loopActive: !1,
1709
1714
  idleFrames: 0,
1710
- lastRenderedPosition: et.position
1711
- }), _t = y(() => {
1712
- const i = wt.current;
1715
+ lastRenderedPosition: ut.position
1716
+ }), W = C(() => {
1717
+ const i = B.current;
1713
1718
  i.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(i.rafId), i.rafId = null, i.loopActive = !1, i.idleFrames = 0;
1714
1719
  }, []);
1715
- O(
1720
+ Y(
1716
1721
  () => () => {
1717
- _t();
1722
+ W();
1718
1723
  },
1719
- [_t]
1724
+ [W]
1720
1725
  );
1721
- const Ft = y(() => {
1722
- const i = wt.current;
1726
+ const At = C(() => {
1727
+ const i = B.current;
1723
1728
  i.rafId = null;
1724
- const T = v.current, M = Wt(T, m.top), D = A.getTotal();
1725
- if (At((j) => Math.abs(j - T) < Tt ? j : T), It({ position: M, totalHeight: D }), Math.abs(i.lastRenderedPosition - T) >= Tt ? (i.lastRenderedPosition = T, i.idleFrames = 0) : i.idleFrames += 1, i.idleFrames >= 2) {
1726
- _t();
1729
+ const x = S.current, b = jt(x, g.top), _ = w.getTotal();
1730
+ if (Tt((Z) => Math.abs(Z - x) < it ? Z : x), p({ position: b, totalHeight: _ }), Math.abs(i.lastRenderedPosition - x) >= it ? (i.lastRenderedPosition = x, i.idleFrames = 0) : i.idleFrames += 1, i.idleFrames >= 2) {
1731
+ W();
1727
1732
  return;
1728
1733
  }
1729
1734
  if (typeof requestAnimationFrame == "function") {
1730
- i.rafId = requestAnimationFrame(Ft);
1735
+ i.rafId = requestAnimationFrame(At);
1731
1736
  return;
1732
1737
  }
1733
1738
  i.loopActive = !1;
1734
- }, [A, m.top, It, _t]), h = y(() => {
1735
- const i = wt.current;
1739
+ }, [w, g.top, p, W]), Vt = C(() => {
1740
+ const i = B.current;
1736
1741
  if (i.idleFrames = 0, !i.loopActive) {
1737
1742
  if (i.loopActive = !0, typeof requestAnimationFrame == "function") {
1738
- i.rafId = requestAnimationFrame(Ft);
1743
+ i.rafId = requestAnimationFrame(At);
1739
1744
  return;
1740
1745
  }
1741
1746
  i.loopActive = !1;
1742
1747
  }
1743
- }, [Ft]), g = y(
1744
- (i, T) => {
1745
- const M = T?.immediate ?? !1, D = Wt(i, m.top);
1746
- if (v.current = i, M) {
1747
- wt.current.lastRenderedPosition = i, wt.current.idleFrames = 0, At(i), It({ position: D, totalHeight: A.getTotal() });
1748
+ }, [At]), H = C(
1749
+ (i, x) => {
1750
+ const b = x?.immediate ?? !1, _ = jt(i, g.top);
1751
+ if (S.current = i, b) {
1752
+ B.current.lastRenderedPosition = i, B.current.idleFrames = 0, Tt(i), p({ position: _, totalHeight: w.getTotal() });
1748
1753
  return;
1749
1754
  }
1750
- h();
1755
+ Vt();
1751
1756
  },
1752
- [h, A, m.top, It]
1753
- ), xt = w(!1);
1754
- O(() => {
1755
- if (!xt.current)
1756
- if (xt.current = !0, typeof f == "number") {
1757
- const i = ee(Math.max(f, 0), m.top), T = Math.abs(i - v.current) > 0.5;
1758
- g(i, { immediate: !0 }), T && ft(i);
1757
+ [Vt, w, g.top, p]
1758
+ ), Ht = M(!1);
1759
+ Y(() => {
1760
+ if (!Ht.current)
1761
+ if (Ht.current = !0, typeof f == "number") {
1762
+ const i = ne(Math.max(f, 0), g.top), x = Math.abs(i - S.current) > 0.5;
1763
+ H(i, { immediate: !0 }), x && vt(i);
1759
1764
  } else
1760
- g(v.current, { immediate: !0 });
1761
- }, [f, m.top, g]), ne(() => {
1762
- A.setValueFn(e), E !== r && (A.changeSize(r), P(r));
1763
- const i = A.getTotal();
1764
- W !== i && U(i);
1765
- }, [A, E, r, W, e]), ne(() => {
1766
- dt !== null && $.current && (yt.debug("[VirtualScroll] Scrolling to position:", dt), $.current.scrollTo(dt), ft(null));
1767
- }, [dt]), O(() => {
1768
- const i = nt.current;
1769
- if (i === m.top)
1765
+ H(S.current, { immediate: !0 });
1766
+ }, [f, g.top, H]), oe(() => {
1767
+ w.setValueFn(e), D !== n && (w.changeSize(n), T(n));
1768
+ const i = w.getTotal();
1769
+ rt !== i && X(i);
1770
+ }, [w, D, n, rt, e]), oe(() => {
1771
+ mt !== null && I.current && (pt.debug("[VirtualScroll] Scrolling to position:", mt), I.current.scrollTo(mt), vt(null));
1772
+ }, [mt]), Y(() => {
1773
+ const i = J.current;
1774
+ if (i === g.top)
1770
1775
  return;
1771
- const T = Wt(v.current, i), M = ee(T, m.top);
1772
- nt.current = m.top, v.current = M, ft(M), g(M, { immediate: !0 });
1773
- }, [m.top, g]);
1774
- const J = y(
1776
+ const x = jt(S.current, i), b = ne(x, g.top);
1777
+ J.current = g.top, S.current = b, vt(b), H(b, { immediate: !0 });
1778
+ }, [g.top, H]);
1779
+ const yt = C(
1775
1780
  (i) => {
1776
- if (!$.current)
1781
+ if (!I.current)
1777
1782
  return;
1778
- const T = ct(i, E), M = ct(T - o * 2, E), D = ct(T + o * 2, E), { cumulative: q, total: j, currentValue: Rt } = A.prefixSum(T, { materializeOption: { materialize: !0, ranges: [{ from: M, to: D }] } });
1779
- if (yt.debug("[VirtualScroll] Scrolling to index:", T, "Offset:", q, "Total height:", j, "Current value:", Rt, "safeIndexFrom:", M, "safeIndexTo:", D), !j)
1783
+ const x = ct(i, D), b = ct(x - s * 2, D), _ = ct(x + s * 2, D), { cumulative: j, total: Z, currentValue: Mt } = w.prefixSum(x, { materializeOption: { materialize: !0, ranges: [{ from: b, to: _ }] } });
1784
+ if (pt.debug("[VirtualScroll] Scrolling to index:", x, "Offset:", j, "Total height:", Z, "Current value:", Mt, "safeIndexFrom:", b, "safeIndexTo:", _), !Z)
1780
1785
  return;
1781
- const Ht = Math.max(q - Rt, 0), Ot = ee(Ht, m.top);
1782
- U(j), ft(Ot), yt.debug("[VirtualScroll] Setting scroll position to:", Ot);
1786
+ const zt = Math.max(j - Mt, 0), Dt = ne(zt, g.top);
1787
+ X(Z), vt(Dt), pt.debug("[VirtualScroll] Setting scroll position to:", Dt);
1783
1788
  },
1784
- [A, o, E, m.top]
1785
- ), Y = y(
1789
+ [w, s, D, g.top]
1790
+ ), Ut = C(
1786
1791
  (i) => {
1787
- if (!$.current)
1792
+ if (!I.current)
1788
1793
  return;
1789
- const T = A.getTotal(), M = mt(Math.floor(i), 0, T), D = A.findIndexAtOrAfter(M, { materializeOption: { materialize: !1 } }).index;
1790
- J(D);
1794
+ const x = w.getTotal(), b = xt(Math.floor(i), 0, x), _ = w.findIndexAtOrAfter(b, { materializeOption: { materialize: !1 } }).index;
1795
+ yt(_);
1791
1796
  },
1792
- [A, J]
1793
- ), Vt = y(
1797
+ [w, yt]
1798
+ ), Zt = C(
1794
1799
  (i) => {
1795
- const T = Wt(v.current, m.top), M = typeof i == "function" ? i(T) : i;
1796
- Y(M);
1797
- const D = $.current?.getScrollPosition(), q = typeof D == "number" ? D : v.current;
1798
- return g(q), q;
1800
+ const x = jt(S.current, g.top), b = typeof i == "function" ? i(x) : i;
1801
+ Ut(b);
1802
+ const _ = I.current?.getScrollPosition(), j = typeof _ == "number" ? _ : S.current;
1803
+ return H(j), j;
1799
1804
  },
1800
- [m.top, Y, g]
1801
- ), bt = y(
1802
- (i, T) => {
1803
- yt.debug("[VirtualScroll] Scroll position changed:", i), g(i);
1805
+ [g.top, Ut, H]
1806
+ ), Et = C(
1807
+ (i, x) => {
1808
+ if (pt.debug("[VirtualScroll] Scroll position changed:", i), H(i), G) {
1809
+ if (Lt.current) {
1810
+ Lt.current = !1;
1811
+ return;
1812
+ }
1813
+ const b = i - x;
1814
+ if (pt.debug("[VirtualScroll] Scroll diff:", b, "New:", i, "Prev:", x), Math.abs(b) > 1) {
1815
+ const _ = b > 0 ? "down" : "up";
1816
+ Ft(_), ht(!0), pt.debug("[VirtualScroll] Showing scroll buttons. Direction:", _), Rt.current && clearTimeout(Rt.current), Rt.current = setTimeout(() => {
1817
+ ht(!1), pt.debug("[VirtualScroll] Hiding scroll buttons");
1818
+ }, 2e3);
1819
+ }
1820
+ }
1804
1821
  },
1805
- [g]
1806
- ), Et = Dt(() => Wt(it, m.top), [m.top, it]), Pt = Dt(() => {
1807
- const i = mn(Et, n, o, E, e, A, W);
1808
- return yt.debug("[VirtualScroll] Calculated rendering range:", {
1822
+ [H, G]
1823
+ ), gt = kt(() => jt(dt, g.top), [g.top, dt]), Jt = kt(() => {
1824
+ const i = mr(gt, r, s, D, e, w, rt);
1825
+ return pt.debug("[VirtualScroll] Calculated rendering range:", {
1809
1826
  ...i,
1810
- scrollPosition: Et,
1811
- renderingContentSize: A.getTotal(),
1812
- overscanCount: o,
1813
- viewportSize: n
1827
+ scrollPosition: gt,
1828
+ renderingContentSize: w.getTotal(),
1829
+ overscanCount: s,
1830
+ viewportSize: r
1814
1831
  }), i;
1815
- }, [Et, n, o, E, e, A, W]), { renderingStartIndex: Nt, renderingEndIndex: Bt, visibleStartIndex: St, visibleEndIndex: kt } = Pt, lt = y(
1816
- (i, T) => {
1817
- if (!R || E === 0)
1832
+ }, [gt, r, s, D, e, w, rt]), { renderingStartIndex: qt, renderingEndIndex: Bt, visibleStartIndex: Ot, visibleEndIndex: $t } = Jt, Yt = C(
1833
+ (i, x) => {
1834
+ if (!V || D === 0)
1818
1835
  return;
1819
- const M = ct(i, E);
1820
- if (!(T?.ensureVisible ?? !0)) {
1821
- const Gt = pt.current.get(M);
1822
- Gt && (rt.current = null, at.current = M, ot(Gt));
1836
+ const b = ct(i, D);
1837
+ if (!(x?.ensureVisible ?? !0)) {
1838
+ const ot = bt.current.get(b);
1839
+ ot && (nt.current = null, ft.current = b, St(ot));
1823
1840
  return;
1824
1841
  }
1825
- const q = A.prefixSum(M, { materializeOption: { materialize: !1 } }), j = q.currentValue, Rt = Math.max(q.cumulative - j, 0), Ht = Rt + j, Ot = Wt(v.current, m.top), Ut = Ot + n;
1826
- if (Rt < Ot || Ht > Ut) {
1827
- rt.current = M, J(M);
1842
+ const j = w.prefixSum(b, { materializeOption: { materialize: !1 } }), Z = j.currentValue, Mt = Math.max(j.cumulative - Z, 0), zt = Mt + Z, Dt = jt(S.current, g.top), o = Dt + r;
1843
+ if (Mt < Dt || zt > o) {
1844
+ nt.current = b, yt(b);
1828
1845
  return;
1829
1846
  }
1830
- const qt = pt.current.get(M);
1831
- if (qt) {
1832
- rt.current = null, at.current = M, ot(qt);
1847
+ const R = bt.current.get(b);
1848
+ if (R) {
1849
+ nt.current = null, ft.current = b, St(R);
1833
1850
  return;
1834
1851
  }
1835
- rt.current = M;
1852
+ nt.current = b;
1836
1853
  },
1837
- [R, E, A, m.top, J, ot, n]
1838
- ), Ct = y(
1839
- (i, T) => {
1840
- if (!R || i.defaultPrevented || i.altKey || i.metaKey || i.ctrlKey)
1854
+ [V, D, w, g.top, yt, St, r]
1855
+ ), Kt = C(
1856
+ (i, x) => {
1857
+ if (!V || i.defaultPrevented || i.altKey || i.metaKey || i.ctrlKey)
1841
1858
  return;
1842
- const M = i.target;
1843
- if (M) {
1844
- const D = M.tagName;
1845
- if (D === "INPUT" || D === "TEXTAREA" || D === "SELECT" || M.isContentEditable)
1859
+ const b = i.target;
1860
+ if (b) {
1861
+ const _ = b.tagName;
1862
+ if (_ === "INPUT" || _ === "TEXTAREA" || _ === "SELECT" || b.isContentEditable)
1846
1863
  return;
1847
1864
  }
1848
1865
  if (i.key === "ArrowDown") {
1849
- T < E - 1 && (i.preventDefault(), lt(T + 1));
1866
+ x < D - 1 && (i.preventDefault(), Yt(x + 1));
1850
1867
  return;
1851
1868
  }
1852
1869
  if (i.key === "ArrowUp") {
1853
- T > 0 && (i.preventDefault(), lt(T - 1));
1870
+ x > 0 && (i.preventDefault(), Yt(x - 1));
1854
1871
  return;
1855
1872
  }
1856
1873
  if (i.key === "PageDown") {
1857
- if (T < E - 1) {
1874
+ if (x < D - 1) {
1858
1875
  i.preventDefault();
1859
- const D = Math.max(kt - St + 1, 1), q = Math.max(D, 1), j = ct(Math.min(T + q, E - 1), E);
1860
- lt(j);
1876
+ const _ = Math.max($t - Ot + 1, 1), j = Math.max(_, 1), Z = ct(Math.min(x + j, D - 1), D);
1877
+ Yt(Z);
1861
1878
  }
1862
1879
  return;
1863
1880
  }
1864
- if (i.key === "PageUp" && T > 0) {
1881
+ if (i.key === "PageUp" && x > 0) {
1865
1882
  i.preventDefault();
1866
- const D = Math.max(kt - St + 1, 1), q = Math.max(D, 1), j = ct(T - q, E);
1867
- lt(j);
1883
+ const _ = Math.max($t - Ot + 1, 1), j = Math.max(_, 1), Z = ct(x - j, D);
1884
+ Yt(Z);
1868
1885
  }
1869
1886
  },
1870
- [R, E, lt, kt, St]
1871
- ), Kt = y(
1887
+ [V, D, Yt, $t, Ot]
1888
+ ), se = C(
1872
1889
  (i) => {
1873
- if (!R)
1890
+ if (!V)
1874
1891
  return;
1875
- const T = ct(i, E);
1876
- rt.current = null, at.current = T, N?.(T);
1892
+ const x = ct(i, D);
1893
+ nt.current = null, ft.current = x, F?.(x);
1877
1894
  },
1878
- [R, E, N]
1895
+ [V, D, F]
1879
1896
  );
1880
- O(() => {
1881
- const i = $.current?.getScrollPosition() ?? 0, T = v.current, M = Wt(T, m.top);
1882
- yt.debug("[VirtualScroll] Range change effect triggered", {
1883
- renderingStartIndex: Nt,
1897
+ Y(() => {
1898
+ const i = I.current?.getScrollPosition() ?? 0, x = S.current, b = jt(x, g.top);
1899
+ pt.debug("[VirtualScroll] Range change effect triggered", {
1900
+ renderingStartIndex: qt,
1884
1901
  renderingEndIndex: Bt,
1885
- visibleStartIndex: St,
1886
- visibleEndIndex: kt,
1887
- scrollPositionState: it,
1888
- paneScrollPosition: T,
1889
- logicalScrollPosition: M,
1890
- contentSize: W,
1902
+ visibleStartIndex: Ot,
1903
+ visibleEndIndex: $t,
1904
+ scrollPositionState: dt,
1905
+ paneScrollPosition: x,
1906
+ logicalScrollPosition: b,
1907
+ contentSize: rt,
1891
1908
  scrollPaneScrollPosition: i
1892
- }), gt({
1893
- renderingStartIndex: Nt,
1909
+ }), y({
1910
+ renderingStartIndex: qt,
1894
1911
  renderingEndIndex: Bt,
1895
- visibleStartIndex: St,
1896
- visibleEndIndex: kt,
1897
- scrollPosition: M,
1898
- totalHeight: W
1912
+ visibleStartIndex: Ot,
1913
+ visibleEndIndex: $t,
1914
+ scrollPosition: b,
1915
+ totalHeight: rt
1899
1916
  });
1900
- }, [W, Bt, Nt, m.top, gt, it, kt, St]);
1901
- const re = y(
1917
+ }, [rt, Bt, qt, g.top, y, dt, $t, Ot]);
1918
+ const ue = C(() => G ? /* @__PURE__ */ U("div", { className: `pointer-events-none absolute inset-0 transition-opacity duration-500 ${Pt && lt !== null ? "opacity-100" : "opacity-0"}`, style: { zIndex: 10 }, children: lt === "up" ? /* @__PURE__ */ U("div", { className: "absolute top-2 right-0 left-0 flex justify-center", children: /* @__PURE__ */ U(
1919
+ "button",
1920
+ {
1921
+ type: "button",
1922
+ className: "pointer-events-auto transform rounded-full bg-gray-800/80 px-12 py-1 font-medium text-[10px] text-white uppercase tracking-wider shadow-md backdrop-blur-sm transition-transform hover:bg-gray-700 active:scale-95",
1923
+ onClick: (b) => {
1924
+ b.stopPropagation(), Lt.current = !0, yt(0), ht(!1);
1925
+ },
1926
+ children: "Top"
1927
+ }
1928
+ ) }) : /* @__PURE__ */ U("div", { className: "absolute right-0 bottom-2 left-0 flex justify-center", children: /* @__PURE__ */ U(
1929
+ "button",
1930
+ {
1931
+ type: "button",
1932
+ className: "pointer-events-auto transform rounded-full bg-gray-800/80 px-12 py-1 font-medium text-[10px] text-white uppercase tracking-wider shadow-md backdrop-blur-sm transition-transform hover:bg-gray-700 active:scale-95",
1933
+ onClick: (b) => {
1934
+ b.stopPropagation(), Lt.current = !0, yt(n - 1), ht(!1);
1935
+ },
1936
+ children: "Bottom"
1937
+ }
1938
+ ) }) }) : null, [G, Pt, lt, yt, n]), de = C(
1902
1939
  (i) => {
1903
- const T = (H ?? 0) > 0, M = Math.abs(i - it), D = T && M > 0.5 ? it : i, q = Wt(D, m.top);
1904
- if (yt.debug("[VirtualScroll] Rendering visible items", {
1940
+ const x = ($ ?? 0) > 0, b = Math.abs(i - dt), _ = x && b > 0.5 ? dt : i, j = jt(_, g.top);
1941
+ if (pt.debug("[VirtualScroll] Rendering visible items", {
1905
1942
  currentScrollPosition: i,
1906
- effectiveScrollPosition: q,
1907
- renderingStartIndex: Nt,
1943
+ effectiveScrollPosition: j,
1944
+ renderingStartIndex: qt,
1908
1945
  renderingEndIndex: Bt,
1909
- fenwickSize: E,
1910
- viewportSize: n,
1911
- callbackThrottleMs: H,
1912
- diff: M,
1913
- rawEffectiveScrollPosition: D
1914
- }), E === 0)
1915
- return /* @__PURE__ */ Q("div", { className: "absolute w-full", style: { top: 0 }, children: /* @__PURE__ */ Q("div", { className: "text-center text-gray-500", children: "No items" }) });
1916
- const j = ct(Nt, E), Rt = ct(Bt, E), { cumulative: Ht, currentValue: Ot } = A.prefixSum(j, { materializeOption: { materialize: !1 } }), Ut = Ht - Ot, jt = [], qt = [];
1917
- for (let z = j; z <= Rt; z++) {
1918
- const $t = e(z);
1919
- A.get(z) !== $t && jt.push({ index: z, value: $t });
1920
- const { cumulative: oe, currentValue: s } = A.prefixSum(z, { materializeOption: { materialize: !1 } }), x = oe - s, V = (G) => {
1921
- if (!G) {
1922
- pt.current.delete(z);
1946
+ fenwickSize: D,
1947
+ viewportSize: r,
1948
+ callbackThrottleMs: $,
1949
+ diff: b,
1950
+ rawEffectiveScrollPosition: _
1951
+ }), D === 0)
1952
+ return /* @__PURE__ */ U("div", { className: "absolute w-full", style: { top: 0 }, children: /* @__PURE__ */ U("div", { className: "text-center text-gray-500", children: "No items" }) });
1953
+ const Z = ct(qt, D), Mt = ct(Bt, D), { cumulative: zt, currentValue: Dt } = w.prefixSum(Z, { materializeOption: { materialize: !1 } }), o = zt - Dt, h = [], R = [];
1954
+ for (let E = Z; E <= Mt; E++) {
1955
+ const tt = e(E);
1956
+ w.get(E) !== tt && h.push({ index: E, value: tt });
1957
+ const { cumulative: wt, currentValue: ee } = w.prefixSum(E, { materializeOption: { materialize: !1 } }), Gt = wt - ee, pe = (Wt) => {
1958
+ if (!Wt) {
1959
+ bt.current.delete(E);
1923
1960
  return;
1924
1961
  }
1925
- R && (pt.current.set(z, G), rt.current === z && (rt.current = null, at.current = z, ot(G)));
1962
+ V && (bt.current.set(E, Wt), nt.current === E && (nt.current = null, ft.current = E, St(Wt)));
1926
1963
  };
1927
- qt.push(
1928
- /* @__PURE__ */ Q(
1964
+ R.push(
1965
+ /* @__PURE__ */ U(
1929
1966
  "div",
1930
1967
  {
1931
- ref: V,
1932
- "data-index": z,
1968
+ ref: pe,
1969
+ "data-index": E,
1933
1970
  "data-virtualscroll-item": "true",
1934
1971
  style: {
1935
1972
  position: "absolute",
1936
- top: x - Ut + m.top,
1973
+ top: Gt - o + g.top,
1937
1974
  width: "100%",
1938
- height: $t,
1939
- overflow: st ? "hidden" : void 0
1975
+ height: tt,
1976
+ overflow: at ? "hidden" : void 0
1940
1977
  },
1941
- tabIndex: R ? -1 : void 0,
1942
- onPointerDown: R ? (G) => {
1943
- G.currentTarget.focus({ preventScroll: !0 });
1978
+ tabIndex: V ? -1 : void 0,
1979
+ onPointerDown: V ? (Wt) => {
1980
+ Wt.currentTarget.focus({ preventScroll: !0 });
1944
1981
  } : void 0,
1945
- onKeyDownCapture: R ? (G) => Ct(G, z) : void 0,
1946
- onFocusCapture: R ? () => Kt(z) : void 0,
1947
- children: l(t(z), z)
1982
+ onKeyDownCapture: V ? (Wt) => Kt(Wt, E) : void 0,
1983
+ onFocusCapture: V ? () => se(E) : void 0,
1984
+ children: l(t(E), E)
1948
1985
  },
1949
- z
1986
+ E
1950
1987
  )
1951
1988
  );
1952
1989
  }
1953
- jt.length > 0 && Promise.resolve().then(() => {
1954
- if (!I.current)
1990
+ h.length > 0 && Promise.resolve().then(() => {
1991
+ if (!O.current)
1955
1992
  return;
1956
- const z = A.updates(jt);
1957
- if (!I.current || typeof z != "number")
1993
+ const E = w.updates(h);
1994
+ if (!O.current || typeof E != "number")
1958
1995
  return;
1959
- U(z), yt.debug("[VirtualScroll] Updated heights for items", jt, "New total height:", z);
1960
- const $t = $.current?.getScrollPosition() ?? v.current;
1961
- $t === v.current || !I.current || g($t);
1996
+ X(E), pt.debug("[VirtualScroll] Updated heights for items", h, "New total height:", E);
1997
+ const tt = I.current?.getScrollPosition() ?? S.current;
1998
+ tt === S.current || !O.current || H(tt);
1962
1999
  });
1963
- const Gt = Ut - q;
1964
- if (m.bottom > 0) {
1965
- const z = A.getTotal() + m.top - Ut;
1966
- qt.push(
1967
- /* @__PURE__ */ Q(
2000
+ const ot = o - j;
2001
+ if (g.bottom > 0) {
2002
+ const E = w.getTotal() + g.top - o;
2003
+ R.push(
2004
+ /* @__PURE__ */ U(
1968
2005
  "div",
1969
2006
  {
1970
2007
  style: {
1971
2008
  position: "absolute",
1972
- top: z,
1973
- height: m.bottom,
2009
+ top: E,
2010
+ height: g.bottom,
1974
2011
  width: "100%"
1975
2012
  }
1976
2013
  },
@@ -1978,84 +2015,85 @@ const dn = 1e4, Sn = () => {
1978
2015
  )
1979
2016
  );
1980
2017
  }
1981
- return yt.debug("[VirtualScroll] Rendering items", {
1982
- nodeCount: qt.length,
1983
- containerTop: Gt,
1984
- logicalScrollPosition: Et,
1985
- resolvedInsets: m,
1986
- effectiveScrollPosition: q
1987
- }), /* @__PURE__ */ Q("div", { className: "absolute w-full", style: { top: Gt }, children: qt });
2018
+ return pt.debug("[VirtualScroll] Rendering items", {
2019
+ nodeCount: R.length,
2020
+ containerTop: ot,
2021
+ logicalScrollPosition: gt,
2022
+ resolvedInsets: g,
2023
+ effectiveScrollPosition: j
2024
+ }), /* @__PURE__ */ U("div", { className: "absolute w-full", style: { top: ot }, children: R });
1988
2025
  },
1989
2026
  [
1990
- H,
2027
+ $,
1991
2028
  l,
1992
- R,
1993
- A,
1994
- E,
2029
+ V,
2030
+ w,
2031
+ D,
1995
2032
  t,
1996
2033
  e,
2034
+ se,
1997
2035
  Kt,
1998
- Ct,
1999
- Et,
2036
+ gt,
2000
2037
  Bt,
2001
- Nt,
2002
- m,
2003
- it,
2004
- ot,
2038
+ qt,
2005
2039
  g,
2006
- n,
2007
- st
2040
+ dt,
2041
+ St,
2042
+ H,
2043
+ r,
2044
+ at
2008
2045
  ]
2009
2046
  );
2010
- xe(
2011
- ut,
2047
+ be(
2048
+ Ct,
2012
2049
  () => ({
2013
- getScrollPosition: () => $.current?.getScrollPosition() ?? -1,
2014
- getContentSize: () => $.current?.getContentSize() ?? -1,
2015
- getViewportSize: () => $.current?.getViewportSize() ?? -1,
2016
- scrollTo: Vt,
2017
- scrollToIndex: J,
2018
- getFenwickTreeTotalHeight: () => A.getTotal(),
2019
- getFenwickSize: () => A.getSize(),
2020
- focusItemAtIndex: lt
2050
+ getScrollPosition: () => I.current?.getScrollPosition() ?? -1,
2051
+ getContentSize: () => I.current?.getContentSize() ?? -1,
2052
+ getViewportSize: () => I.current?.getViewportSize() ?? -1,
2053
+ scrollTo: Zt,
2054
+ scrollToIndex: yt,
2055
+ getFenwickTreeTotalHeight: () => w.getTotal(),
2056
+ getFenwickSize: () => w.getSize(),
2057
+ focusItemAtIndex: Yt
2021
2058
  }),
2022
- [Vt, J, A, lt]
2059
+ [Zt, yt, w, Yt]
2023
2060
  );
2024
- const ce = W + m.top + m.bottom;
2025
- return /* @__PURE__ */ Q(
2026
- on,
2061
+ const fe = rt + g.top + g.bottom;
2062
+ return /* @__PURE__ */ U(
2063
+ sr,
2027
2064
  {
2028
- ref: $,
2029
- contentSize: ce,
2030
- viewportSize: n,
2065
+ ref: I,
2066
+ contentSize: fe,
2067
+ viewportSize: r,
2031
2068
  className: a,
2032
- onScroll: bt,
2069
+ onScroll: Et,
2033
2070
  background: d,
2034
- tapScrollCircleOptions: S,
2035
- inertiaOptions: ht,
2036
- itemCount: r,
2037
- scrollBarWidth: b,
2038
- enableThumbDrag: _,
2039
- enableTrackClick: X,
2040
- enableArrowButtons: k,
2041
- enablePointerDrag: B,
2042
- renderThumbOverlay: F,
2043
- wheelSpeedMultiplier: C,
2044
- contentInsets: m,
2045
- visibleStartIndex: St,
2046
- visibleEndIndex: kt,
2047
- children: re
2071
+ tapScrollCircleOptions: P,
2072
+ inertiaOptions: It,
2073
+ itemCount: n,
2074
+ scrollBarWidth: v,
2075
+ enableThumbDrag: N,
2076
+ enableTrackClick: q,
2077
+ enableArrowButtons: L,
2078
+ enablePointerDrag: K,
2079
+ renderThumbOverlay: k,
2080
+ wheelSpeedMultiplier: z,
2081
+ contentInsets: g,
2082
+ visibleStartIndex: Ot,
2083
+ visibleEndIndex: $t,
2084
+ renderOverlay: ue,
2085
+ children: de
2048
2086
  }
2049
2087
  );
2050
- }, vn = ge(gn);
2088
+ }, Pr = Ie(gr);
2051
2089
  export {
2052
- an as FenwickMapTree,
2053
- rn as ScrollBar,
2054
- on as ScrollPane,
2055
- vn as VirtualScroll,
2056
- mt as minmax,
2057
- Pn as tapScrollCircleSampleVisual,
2058
- ln as useFenwickMapTree,
2059
- Sn as useHeightCache,
2060
- un as useLruCache
2090
+ ar as FenwickMapTree,
2091
+ or as ScrollBar,
2092
+ sr as ScrollPane,
2093
+ Pr as VirtualScroll,
2094
+ xt as minmax,
2095
+ Tr as tapScrollCircleSampleVisual,
2096
+ lr as useFenwickMapTree,
2097
+ vr as useHeightCache,
2098
+ ur as useLruCache
2061
2099
  };