@aiquants/virtualscroll 2.5.0 → 2.6.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,7 +1,7 @@
1
- import { jsx as le, jsxs as wt, Fragment as ur } from "react/jsx-runtime";
2
- import br, { memo as xr, forwardRef as Gt, useState as nt, useRef as g, useCallback as S, useImperativeHandle as Zt, useMemo as Fe, useLayoutEffect as ot, useEffect as H, useId as Ir } from "react";
1
+ import { jsx as le, jsxs as Tt, Fragment as ur } from "react/jsx-runtime";
2
+ import br, { memo as xr, forwardRef as Gt, useState as nt, useRef as g, useCallback as v, useImperativeHandle as Zt, useMemo as Ye, useLayoutEffect as it, useEffect as X, useId as Ir } from "react";
3
3
  import { twMerge as Rt } from "tailwind-merge";
4
- class w {
4
+ class T {
5
5
  level;
6
6
  prefix;
7
7
  impl;
@@ -14,7 +14,7 @@ class w {
14
14
  constructor(e = 2, t = "[virtualscroll]", n = console) {
15
15
  this.level = e, this.prefix = t, this.impl = n;
16
16
  }
17
- static instance = new w(2, "[virtualscroll]");
17
+ static instance = new T(2, "[virtualscroll]");
18
18
  /**
19
19
  * @method setLevel
20
20
  * @description Updates the current log level for the static instance.
@@ -22,7 +22,7 @@ class w {
22
22
  * @param {LogLevel} level - The new log level.
23
23
  */
24
24
  static setLevel(e) {
25
- w.instance.setLevel(e);
25
+ T.instance.setLevel(e);
26
26
  }
27
27
  /**
28
28
  * @method setLevel
@@ -40,7 +40,7 @@ class w {
40
40
  * @param {ILogger} impl - The new logger implementation.
41
41
  */
42
42
  static setImplementation(e) {
43
- w.instance.setImplementation(e);
43
+ T.instance.setImplementation(e);
44
44
  }
45
45
  /**
46
46
  * @method setImplementation
@@ -58,7 +58,7 @@ class w {
58
58
  * @param {string} prefix - The new prefix.
59
59
  */
60
60
  static setPrefix(e) {
61
- w.instance.setPrefix(e);
61
+ T.instance.setPrefix(e);
62
62
  }
63
63
  /**
64
64
  * @method setPrefix
@@ -77,7 +77,7 @@ class w {
77
77
  * @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
78
78
  */
79
79
  static isEnabled(e) {
80
- return w.instance.isEnabled(e);
80
+ return T.instance.isEnabled(e);
81
81
  }
82
82
  /**
83
83
  * @method isEnabled
@@ -122,28 +122,28 @@ class w {
122
122
  return typeof e == "string" ? [`${this.prefix} ${e}`] : [this.prefix, e];
123
123
  }
124
124
  static debug(e, ...t) {
125
- w.instance.debug(e, ...t);
125
+ T.instance.debug(e, ...t);
126
126
  }
127
127
  debug(e, ...t) {
128
- this.level <= 0 && this.impl.debug(...this.formatMessage(w.resolveLazy(e)), ...t.map(w.resolveLazy));
128
+ this.level <= 0 && this.impl.debug(...this.formatMessage(T.resolveLazy(e)), ...t.map(T.resolveLazy));
129
129
  }
130
130
  static info(e, ...t) {
131
- w.instance.info(e, ...t);
131
+ T.instance.info(e, ...t);
132
132
  }
133
133
  info(e, ...t) {
134
- this.level <= 1 && this.impl.info(...this.formatMessage(w.resolveLazy(e)), ...t.map(w.resolveLazy));
134
+ this.level <= 1 && this.impl.info(...this.formatMessage(T.resolveLazy(e)), ...t.map(T.resolveLazy));
135
135
  }
136
136
  static warn(e, ...t) {
137
- w.instance.warn(e, ...t);
137
+ T.instance.warn(e, ...t);
138
138
  }
139
139
  warn(e, ...t) {
140
- this.level <= 2 && this.impl.warn(...this.formatMessage(w.resolveLazy(e)), ...t.map(w.resolveLazy));
140
+ this.level <= 2 && this.impl.warn(...this.formatMessage(T.resolveLazy(e)), ...t.map(T.resolveLazy));
141
141
  }
142
142
  static error(e, ...t) {
143
- w.instance.error(e, ...t);
143
+ T.instance.error(e, ...t);
144
144
  }
145
145
  error(e, ...t) {
146
- this.level <= 3 && this.impl.error(...this.formatMessage(w.resolveLazy(e)), ...t.map(w.resolveLazy));
146
+ this.level <= 3 && this.impl.error(...this.formatMessage(T.resolveLazy(e)), ...t.map(T.resolveLazy));
147
147
  }
148
148
  }
149
149
  const tr = {
@@ -153,9 +153,9 @@ const tr = {
153
153
  distance: 0,
154
154
  direction: 0,
155
155
  pointerId: null
156
- }, Xt = 6, vr = 8, Sr = ({ dragState: r, normalizedDistance: e }) => {
156
+ }, Xt = 6, Sr = 8, vr = ({ dragState: r, normalizedDistance: e }) => {
157
157
  const t = 1 + e * 0.18, n = 0.16 + e * 0.24, i = 0.38 + e * 0.28, s = r.active ? "80ms ease-out" : "220ms ease";
158
- return /* @__PURE__ */ wt(ur, { children: [
158
+ return /* @__PURE__ */ Tt(ur, { children: [
159
159
  /* @__PURE__ */ le(
160
160
  "div",
161
161
  {
@@ -182,137 +182,137 @@ const tr = {
182
182
  )
183
183
  ] });
184
184
  }, dr = xr(
185
- Gt(({ onDragChange: r, className: e, maxVisualDistance: t = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: a }, u) => {
186
- const [p, b] = nt(tr), I = g(null), T = g(null), C = g({ x: 0, y: 0 }), h = g(null), D = g(0), Z = S(
187
- (v) => {
188
- b(v), r(v);
185
+ Gt(({ onDragChange: r, className: e, maxVisualDistance: t = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: a }, c) => {
186
+ const [p, b] = nt(tr), I = g(null), w = g(null), C = g({ x: 0, y: 0 }), h = g(null), z = g(0), J = v(
187
+ (S) => {
188
+ b(S), r(S);
189
189
  },
190
190
  [r]
191
- ), Y = S(
192
- (v, q, Ee = !1) => {
193
- const { x: Qe, y: N } = C.current, De = v - Qe, Ge = q - N, Pe = Math.abs(Ge), Ne = Pe < Xt ? 0 : Ge < 0 ? -1 : 1, Ze = D.current;
194
- let $e = Ne;
195
- const X = Xt + vr;
196
- Ne === 0 ? Ze !== 0 && Pe < X ? $e = Ze : ($e = 0, Ee || (D.current = 0)) : Ne !== Ze && Ze !== 0 && Pe < X ? $e = Ze : D.current = Ne, Z({
197
- active: Ee || Pe >= Xt,
191
+ ), B = v(
192
+ (S, $, Ve = !1) => {
193
+ const { x: Qe, y: N } = C.current, De = S - Qe, Ge = $ - N, ye = Math.abs(Ge), Ce = ye < Xt ? 0 : Ge < 0 ? -1 : 1, Ze = z.current;
194
+ let $e = Ce;
195
+ const H = Xt + Sr;
196
+ Ce === 0 ? Ze !== 0 && ye < H ? $e = Ze : ($e = 0, Ve || (z.current = 0)) : Ce !== Ze && Ze !== 0 && ye < H ? $e = Ze : z.current = Ce, J({
197
+ active: Ve || ye >= Xt,
198
198
  offsetX: De,
199
199
  offsetY: Ge,
200
- distance: Pe,
200
+ distance: ye,
201
201
  direction: $e,
202
202
  pointerId: I.current
203
203
  });
204
204
  },
205
- [Z]
206
- ), ue = S((v) => {
207
- if (v === null)
205
+ [J]
206
+ ), de = v((S) => {
207
+ if (S === null)
208
208
  return;
209
- const q = h.current;
210
- q?.hasPointerCapture(v) && q.releasePointerCapture(v);
211
- }, []), de = S(
212
- (v = !1) => {
213
- v && ue(I.current), I.current = null, T.current = null, D.current = 0, Z(tr);
209
+ const $ = h.current;
210
+ $?.hasPointerCapture(S) && $.releasePointerCapture(S);
211
+ }, []), fe = v(
212
+ (S = !1) => {
213
+ S && de(I.current), I.current = null, w.current = null, z.current = 0, J(tr);
214
214
  },
215
- [Z, ue]
216
- ), oe = S(
217
- (v) => {
218
- if (I.current !== null && I.current !== v.pointerId) {
219
- T.current = { pointerId: v.pointerId, clientX: v.clientX, clientY: v.clientY }, v.preventDefault(), v.stopPropagation();
215
+ [J, de]
216
+ ), ne = v(
217
+ (S) => {
218
+ if (I.current !== null && I.current !== S.pointerId) {
219
+ w.current = { pointerId: S.pointerId, clientX: S.clientX, clientY: S.clientY }, S.preventDefault(), S.stopPropagation();
220
220
  return;
221
221
  }
222
- v.preventDefault(), v.stopPropagation();
223
- const q = h.current ?? v.currentTarget, { left: Ee, top: Qe, width: N, height: De } = q.getBoundingClientRect();
224
- C.current = { x: Ee + N / 2, y: Qe + De / 2 }, I.current = v.pointerId;
222
+ S.preventDefault(), S.stopPropagation();
223
+ const $ = h.current ?? S.currentTarget, { left: Ve, top: Qe, width: N, height: De } = $.getBoundingClientRect();
224
+ C.current = { x: Ve + N / 2, y: Qe + De / 2 }, I.current = S.pointerId;
225
225
  try {
226
- q.setPointerCapture(v.pointerId);
226
+ $.setPointerCapture(S.pointerId);
227
227
  } catch {
228
228
  }
229
- Y(v.clientX, v.clientY, !0);
229
+ B(S.clientX, S.clientY, !0);
230
230
  },
231
- [Y]
232
- ), ae = S(
233
- (v) => {
234
- if (I.current !== v.pointerId) {
235
- T.current !== null && T.current.pointerId === v.pointerId && (T.current = { pointerId: v.pointerId, clientX: v.clientX, clientY: v.clientY });
231
+ [B]
232
+ ), ae = v(
233
+ (S) => {
234
+ if (I.current !== S.pointerId) {
235
+ w.current !== null && w.current.pointerId === S.pointerId && (w.current = { pointerId: S.pointerId, clientX: S.clientX, clientY: S.clientY });
236
236
  return;
237
237
  }
238
- v.preventDefault(), Y(v.clientX, v.clientY);
238
+ S.preventDefault(), B(S.clientX, S.clientY);
239
239
  },
240
- [Y]
241
- ), fe = S(
242
- (v) => {
243
- if (I.current !== v.pointerId) {
244
- T.current !== null && T.current.pointerId === v.pointerId && (T.current = null);
240
+ [B]
241
+ ), pe = v(
242
+ (S) => {
243
+ if (I.current !== S.pointerId) {
244
+ w.current !== null && w.current.pointerId === S.pointerId && (w.current = null);
245
245
  return;
246
246
  }
247
- v.preventDefault(), v.stopPropagation();
248
- const q = T.current;
249
- if (T.current = null, q !== null) {
250
- ue(v.pointerId);
251
- const Ee = h.current;
247
+ S.preventDefault(), S.stopPropagation();
248
+ const $ = w.current;
249
+ if (w.current = null, $ !== null) {
250
+ de(S.pointerId);
251
+ const Ve = h.current;
252
252
  let Qe = !0;
253
- if (Ee !== null && typeof Ee.setPointerCapture == "function")
253
+ if (Ve !== null && typeof Ve.setPointerCapture == "function")
254
254
  try {
255
- Ee.setPointerCapture(q.pointerId);
255
+ Ve.setPointerCapture($.pointerId);
256
256
  } catch (N) {
257
257
  (typeof N == "object" && N !== null && "name" in N ? N.name : void 0) === "NotFoundError" && (Qe = !1);
258
258
  }
259
259
  if (Qe) {
260
- I.current = q.pointerId, Y(q.clientX, q.clientY, !0);
260
+ I.current = $.pointerId, B($.clientX, $.clientY, !0);
261
261
  return;
262
262
  }
263
263
  }
264
- de(!0);
264
+ fe(!0);
265
265
  },
266
- [de, ue, Y]
267
- ), P = S(
268
- (v) => {
269
- v.target === v.currentTarget && I.current === v.pointerId && de(!1);
266
+ [fe, de, B]
267
+ ), P = v(
268
+ (S) => {
269
+ S.target === S.currentTarget && I.current === S.pointerId && fe(!1);
270
270
  },
271
- [de]
271
+ [fe]
272
272
  );
273
273
  Zt(
274
- u,
274
+ c,
275
275
  () => ({
276
276
  reset: () => {
277
- de(!0);
277
+ fe(!0);
278
278
  },
279
279
  getElement: () => h.current
280
280
  }),
281
- [de]
281
+ [fe]
282
282
  );
283
- const O = Math.min(Math.max(s, 0), 1), M = n / 64, K = Math.min(p.distance, t) / t, te = p.direction * K * 10 * M, j = a ?? Sr, _ = {
283
+ const _ = Math.min(Math.max(s, 0), 1), M = n / 64, j = Math.min(p.distance, t) / t, te = p.direction * j * 10 * M, G = a ?? vr, Y = {
284
284
  dragState: p,
285
- normalizedDistance: K,
285
+ normalizedDistance: j,
286
286
  sizeScale: M,
287
287
  size: n,
288
- opacity: O
289
- }, G = {
288
+ opacity: _
289
+ }, Z = {
290
290
  ...i,
291
291
  width: n,
292
292
  height: n,
293
293
  transform: `translateY(${te}px)`
294
294
  };
295
- return G.opacity = O, /* @__PURE__ */ le(
295
+ return Z.opacity = _, /* @__PURE__ */ le(
296
296
  "div",
297
297
  {
298
298
  ref: h,
299
299
  "data-testid": "virtual-scroll-tap-circle",
300
300
  className: Rt("aqvs-tap-scroll-circle", e),
301
- style: G,
301
+ style: Z,
302
302
  tabIndex: -1,
303
- onPointerDown: oe,
303
+ onPointerDown: ne,
304
304
  onPointerMove: ae,
305
- onPointerUp: fe,
306
- onPointerCancel: fe,
305
+ onPointerUp: pe,
306
+ onPointerCancel: pe,
307
307
  onLostPointerCapture: P,
308
308
  role: "presentation",
309
- children: j(_)
309
+ children: G(Y)
310
310
  }
311
311
  );
312
312
  })
313
313
  );
314
314
  dr.displayName = "TapScrollCircle";
315
- const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scroll-cancel", rr = 20, Tr = 250, wr = 60, Mr = 20, Pr = 20, fr = {
315
+ const oe = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scroll-cancel", rr = 20, wr = 250, Tr = 60, Mr = 20, Pr = 20, fr = {
316
316
  /** 速度が最大に達する引き距離 (px)。`maxVisualDistance` の既定値。 */
317
317
  maxDistance: 240,
318
318
  /** 最小速度倍率 (ビューポート比)。 */
@@ -359,58 +359,58 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
359
359
  maxVisualDistance: r?.maxVisualDistance ?? ut.maxVisualDistance,
360
360
  maxSpeedMultiplier: n,
361
361
  minSpeedMultiplier: Math.max(r?.minSpeedMultiplier ?? ut.minSpeedMultiplier, 0),
362
- opacity: se(r?.opacity ?? ut.opacity, 0, 1),
362
+ opacity: oe(r?.opacity ?? ut.opacity, 0, 1),
363
363
  renderVisual: r?.renderVisual ?? ut.renderVisual,
364
364
  maxSpeedCurve: r?.maxSpeedCurve ?? ut.maxSpeedCurve
365
365
  };
366
- }, Dr = ({ isDragging: r, isThumbHovered: e, enableThumbDrag: t }) => Fe(() => t ? r ? "dragging" : e ? "hover" : "idle" : "disabled", [t, r, e]), zr = ({ canUseArrowButtons: r, enableArrowButtons: e, resetTapScroll: t, scrollByStep: n }) => {
367
- const i = g(null), s = g(null), a = g(null), u = S(() => {
366
+ }, zr = ({ isDragging: r, isThumbHovered: e, enableThumbDrag: t }) => Ye(() => t ? r ? "dragging" : e ? "hover" : "idle" : "disabled", [t, r, e]), Dr = ({ canUseArrowButtons: r, enableArrowButtons: e, resetTapScroll: t, scrollByStep: n }) => {
367
+ const i = g(null), s = g(null), a = g(null), c = v(() => {
368
368
  i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), a.current !== null && (window.removeEventListener("pointerup", a.current), window.removeEventListener("pointercancel", a.current), window.removeEventListener("blur", a.current), a.current = null);
369
- }, []), p = S(() => {
370
- u();
371
- }, [u]), b = S(
372
- (T) => (C) => {
369
+ }, []), p = v(() => {
370
+ c();
371
+ }, [c]), b = v(
372
+ (w) => (C) => {
373
373
  if (!r)
374
374
  return;
375
- C.cancelable && C.preventDefault(), C.stopPropagation(), t(), u(), n(T), s.current = window.setTimeout(() => {
375
+ C.cancelable && C.preventDefault(), C.stopPropagation(), t(), c(), n(w), s.current = window.setTimeout(() => {
376
376
  i.current = window.setInterval(() => {
377
- n(T);
378
- }, wr);
379
- }, Tr);
380
- const h = () => u();
377
+ n(w);
378
+ }, Tr);
379
+ }, wr);
380
+ const h = () => c();
381
381
  a.current = h, window.addEventListener("pointerup", h), window.addEventListener("pointercancel", h), window.addEventListener("blur", h);
382
382
  },
383
- [r, u, t, n]
384
- ), I = S(
385
- (T) => (C) => {
386
- e && (C.key === "Enter" || C.key === " " || C.key === "Spacebar") && (C.preventDefault(), n(T));
383
+ [r, c, t, n]
384
+ ), I = v(
385
+ (w) => (C) => {
386
+ e && (C.key === "Enter" || C.key === " " || C.key === "Spacebar") && (C.preventDefault(), n(w));
387
387
  },
388
388
  [e, n]
389
389
  );
390
- return H(() => {
391
- r || u();
392
- }, [r, u]), H(() => () => {
393
- u();
394
- }, [u]), { handleArrowPointerDown: b, handleArrowPointerUp: p, handleArrowKeyDown: I };
390
+ return X(() => {
391
+ r || c();
392
+ }, [r, c]), X(() => () => {
393
+ c();
394
+ }, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: p, handleArrowKeyDown: I };
395
395
  }, Ar = 700, It = (r, e) => typeof r == "number" && Number.isFinite(r) ? r : e, Lr = ({ distance: r, maxDistance: e, viewportSize: t, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: a }) => {
396
- const u = Math.max(It(r, 0), 0), p = It(e, 0), b = p > 0 ? Math.min(u, p) / p : 1, I = Math.max(It(t, 0), 0), T = Math.max(It(n, 0), 0), C = Math.max(It(i, 0), 0), h = Math.max(I * T, 40), D = s ? h : 1200, Z = Math.max(I * C, D), Y = a ? Math.max(It(a.exponentialScale, C), 0) : 0, ue = a ? Math.min(Z, Math.max(I * Y, h)) : Z, de = Math.max(ue, h);
397
- let oe = b ** 1.1;
396
+ const c = Math.max(It(r, 0), 0), p = It(e, 0), b = p > 0 ? Math.min(c, p) / p : 1, I = Math.max(It(t, 0), 0), w = Math.max(It(n, 0), 0), C = Math.max(It(i, 0), 0), h = Math.max(I * w, 40), z = s ? h : 1200, J = Math.max(I * C, z), B = a ? Math.max(It(a.exponentialScale, C), 0) : 0, de = a ? Math.min(J, Math.max(I * B, h)) : J, fe = Math.max(de, h);
397
+ let ne = b ** 1.1;
398
398
  if (a) {
399
- const fe = Math.min(Math.max(It(a.exponentialSteepness, 0), 0), Ar);
400
- if (fe === 0)
401
- oe = b;
399
+ const pe = Math.min(Math.max(It(a.exponentialSteepness, 0), 0), Ar);
400
+ if (pe === 0)
401
+ ne = b;
402
402
  else {
403
- const P = Math.expm1(fe) || 1;
404
- oe = Math.min(Math.max(Math.expm1(fe * b) / P, 0), 1);
403
+ const P = Math.expm1(pe) || 1;
404
+ ne = Math.min(Math.max(Math.expm1(pe * b) / P, 0), 1);
405
405
  }
406
406
  }
407
407
  const ae = Math.min(Math.max(It(a?.easedOffset, 0), 0), 1);
408
- return h + (de - h) * (ae + (1 - ae) * oe);
408
+ return h + (fe - h) * (ae + (1 - ae) * ne);
409
409
  }, Or = (r) => {
410
410
  if (!r || r <= 0)
411
411
  return $t;
412
412
  const e = Math.max(1, r), t = Math.log10(e), n = $t + t * Rr;
413
- return se(n, $t, Er);
413
+ return oe(n, $t, Er);
414
414
  }, _r = ({
415
415
  contentSize: r,
416
416
  viewportSize: e,
@@ -419,107 +419,107 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
419
419
  enableThumbDrag: i = !0,
420
420
  enableTrackClick: s = !0,
421
421
  enableArrowButtons: a = !0,
422
- horizontal: u = !1,
422
+ horizontal: c = !1,
423
423
  scrollBarWidth: p = 12,
424
424
  className: b,
425
425
  ariaControls: I,
426
- tapScrollCircleOptions: T,
426
+ tapScrollCircleOptions: w,
427
427
  itemCount: C,
428
428
  renderThumbOverlay: h,
429
- visibleStartIndex: D,
430
- visibleEndIndex: Z
429
+ visibleStartIndex: z,
430
+ visibleEndIndex: J
431
431
  }) => {
432
- const [Y, ue] = nt(!1), [de, oe] = nt(!1), [ae, fe] = nt(!1), P = g(null), O = g({
432
+ const [B, de] = nt(!1), [fe, ne] = nt(!1), [ae, pe] = nt(!1), P = g(null), _ = g({
433
433
  pointerId: null,
434
434
  startThumbPosition: 0,
435
435
  startClientX: 0,
436
436
  startClientY: 0,
437
437
  scale: 1,
438
438
  captureTarget: null
439
- }), M = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), K = g(t), te = g(n), j = g(nr), _ = g(null), G = g(null), v = g(null), q = g(0), Ee = g(0), Qe = Fe(() => Cr(T, C), [C, T]), N = Fe(() => Vr(u), [u]), {
439
+ }), M = g({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), j = g(t), te = g(n), G = g(nr), Y = g(null), Z = g(null), S = g(null), $ = g(0), Ve = g(0), Qe = Ye(() => Cr(w, C), [C, w]), N = Ye(() => Vr(c), [c]), {
440
440
  enabled: De,
441
441
  size: Ge,
442
- offsetX: Pe,
443
- offsetY: Ne,
442
+ offsetX: ye,
443
+ offsetY: Ce,
444
444
  className: Ze,
445
445
  maxVisualDistance: $e,
446
- maxSpeedMultiplier: X,
447
- minSpeedMultiplier: ze,
448
- opacity: ne,
446
+ maxSpeedMultiplier: H,
447
+ minSpeedMultiplier: Ae,
448
+ opacity: ie,
449
449
  renderVisual: he,
450
- maxSpeedCurve: Ye
451
- } = Qe, Ae = g({
450
+ maxSpeedCurve: Be
451
+ } = Qe, Le = g({
452
452
  viewportSize: e,
453
453
  maxScrollPosition: Math.max(r - e, 0),
454
454
  scrollBarVisible: r > e,
455
455
  effectiveTapMaxDistance: Math.max($e, 1),
456
- tapCircleMaxSpeedMultiplier: X,
457
- tapCircleMinSpeedMultiplier: ze,
458
- tapCircleMaxSpeedCurve: Ye,
459
- tapScrollCircleOptions: T,
456
+ tapCircleMaxSpeedMultiplier: H,
457
+ tapCircleMinSpeedMultiplier: Ae,
458
+ tapCircleMaxSpeedCurve: Be,
459
+ tapScrollCircleOptions: w,
460
460
  effectiveTrackLength: 0,
461
461
  onScroll: n,
462
462
  scrollPosition: t
463
- }), { mainSizeKey: dt, crossSizeKey: R, positionKey: ft, selectDelta: pt, getPointerCoordinate: V, arrowLabels: J, arrowIcons: We, directionClass: gt, orientation: Be } = N, et = Math.max($e, 1), ce = e / r, d = Math.max(e - p * 2, 0), Q = ce * d, $ = Math.min(Math.max(rr, Q || 0), d || rr), k = r - e, B = Math.max(d - $, 0), ge = k <= 0 || B <= 0 ? 0 : se(t / k * B, 0, B), Le = ge + $ / 2, ee = r > e || Y, He = ee && a;
464
- ot(() => {
465
- Ae.current = {
463
+ }), { mainSizeKey: dt, crossSizeKey: R, positionKey: ft, selectDelta: pt, getPointerCoordinate: V, arrowLabels: Q, arrowIcons: We, directionClass: gt, orientation: He } = N, et = Math.max($e, 1), ce = e / r, d = Math.max(e - p * 2, 0), W = ce * d, U = Math.min(Math.max(rr, W || 0), d || rr), k = r - e, q = Math.max(d - U, 0), Ie = k <= 0 || q <= 0 ? 0 : oe(t / k * q, 0, q), Re = Ie + U / 2, ee = r > e || B, Oe = ee && a;
464
+ it(() => {
465
+ Le.current = {
466
466
  viewportSize: e,
467
467
  maxScrollPosition: k,
468
468
  scrollBarVisible: ee,
469
469
  effectiveTapMaxDistance: et,
470
- tapCircleMaxSpeedMultiplier: X,
471
- tapCircleMinSpeedMultiplier: ze,
472
- tapCircleMaxSpeedCurve: Ye,
473
- tapScrollCircleOptions: T,
474
- effectiveTrackLength: B,
470
+ tapCircleMaxSpeedMultiplier: H,
471
+ tapCircleMinSpeedMultiplier: Ae,
472
+ tapCircleMaxSpeedCurve: Be,
473
+ tapScrollCircleOptions: w,
474
+ effectiveTrackLength: q,
475
475
  onScroll: n,
476
476
  scrollPosition: t
477
477
  };
478
- }), ot(() => {
479
- K.current = t;
480
- }, [t]), ot(() => {
478
+ }), it(() => {
479
+ j.current = t;
480
+ }, [t]), it(() => {
481
481
  te.current = n;
482
- }, [n]), H(() => {
483
- i || oe(!1);
482
+ }, [n]), X(() => {
483
+ i || ne(!1);
484
484
  }, [i]);
485
- const Ve = Dr({ isDragging: Y, isThumbHovered: de, enableThumbDrag: i }), Ce = S((l, x) => {
486
- const y = Ae.current, A = x ?? K.current;
485
+ const ge = zr({ isDragging: B, isThumbHovered: fe, enableThumbDrag: i }), ze = v((l, x) => {
486
+ const y = Le.current, D = x ?? j.current;
487
487
  if (te.current) {
488
- const ve = te.current(l, A);
488
+ const ve = te.current(l, D);
489
489
  if (typeof ve == "number" && Number.isFinite(ve))
490
- return K.current = ve, ve;
490
+ return j.current = ve, ve;
491
491
  }
492
- const U = typeof l == "function" ? l(A) : l, ie = Math.max(y.maxScrollPosition, 0), Re = y.scrollBarVisible ? se(U, 0, ie) : 0;
493
- return K.current = Re, Re;
494
- }, []), Ue = S(
492
+ const K = typeof l == "function" ? l(D) : l, se = Math.max(y.maxScrollPosition, 0), Ne = y.scrollBarVisible ? oe(K, 0, se) : 0;
493
+ return j.current = Ne, Ne;
494
+ }, []), Ue = v(
495
495
  (l) => {
496
- const x = Ae.current, y = K.current;
496
+ const x = Le.current, y = j.current;
497
497
  if (!x.scrollBarVisible || x.maxScrollPosition <= 0) {
498
- const Ke = Ce(0, y), Pt = Ke - y;
498
+ const Ke = ze(0, y), Pt = Ke - y;
499
499
  return { nextPosition: Ke, actualDelta: Pt, reachedBoundary: !0 };
500
500
  }
501
501
  if (l === 0)
502
502
  return { nextPosition: y, actualDelta: 0, reachedBoundary: !1 };
503
- const U = Ce((Ke) => se(Ke + l, 0, x.maxScrollPosition), y), ie = U - y, Re = l < 0 && y + l <= 0, ve = l > 0 && y + l >= x.maxScrollPosition, st = l < 0 && (U <= 0 || Re && ie === 0) || l > 0 && (U >= x.maxScrollPosition || ve && ie === 0);
504
- return { nextPosition: U, actualDelta: ie, reachedBoundary: st };
503
+ const K = ze((Ke) => oe(Ke + l, 0, x.maxScrollPosition), y), se = K - y, Ne = l < 0 && y + l <= 0, ve = l > 0 && y + l >= x.maxScrollPosition, at = l < 0 && (K <= 0 || Ne && se === 0) || l > 0 && (K >= x.maxScrollPosition || ve && se === 0);
504
+ return { nextPosition: K, actualDelta: se, reachedBoundary: at };
505
505
  },
506
- [Ce]
507
- ), Te = S(
506
+ [ze]
507
+ ), Te = v(
508
508
  (l, x) => {
509
509
  l.current += x;
510
- const y = Math.max(Ae.current.maxScrollPosition, 0);
511
- y > 0 && (l.current = se(l.current, -y, y));
512
- const A = Ue(l.current);
513
- return l.current -= A.actualDelta, A.reachedBoundary && (l.current = 0), A;
510
+ const y = Math.max(Le.current.maxScrollPosition, 0);
511
+ y > 0 && (l.current = oe(l.current, -y, y));
512
+ const D = Ue(l.current);
513
+ return l.current -= D.actualDelta, D.reachedBoundary && (l.current = 0), D;
514
514
  },
515
515
  [Ue]
516
- ), be = S(() => {
517
- G.current !== null && (window.cancelAnimationFrame(G.current), G.current = null), v.current = null, q.current = 0, Ee.current = 0;
518
- }, []), we = S(() => {
519
- j.current = { ...nr }, fe(!1), _.current?.reset(), be();
520
- }, [be]), ye = S(
516
+ ), be = v(() => {
517
+ Z.current !== null && (window.cancelAnimationFrame(Z.current), Z.current = null), S.current = null, $.current = 0, Ve.current = 0;
518
+ }, []), Me = v(() => {
519
+ G.current = { ...nr }, pe(!1), Y.current?.reset(), be();
520
+ }, [be]), Ee = v(
521
521
  (l) => {
522
- const x = j.current, y = Ae.current;
522
+ const x = G.current, y = Le.current;
523
523
  if (!x.active || x.direction === 0) {
524
524
  be();
525
525
  return;
@@ -528,12 +528,12 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
528
528
  be();
529
529
  return;
530
530
  }
531
- const A = v.current ?? l, U = Math.max((l - A) / 1e3, 0), ie = Math.min(U, Nr);
532
- if (v.current = l, ie <= 0) {
533
- G.current = window.requestAnimationFrame(ye);
531
+ const D = S.current ?? l, K = Math.max((l - D) / 1e3, 0), se = Math.min(K, Nr);
532
+ if (S.current = l, se <= 0) {
533
+ Z.current = window.requestAnimationFrame(Ee);
534
534
  return;
535
535
  }
536
- const Re = Lr({
536
+ const Ne = Lr({
537
537
  distance: x.distance,
538
538
  maxDistance: y.effectiveTapMaxDistance,
539
539
  viewportSize: y.viewportSize,
@@ -542,122 +542,122 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
542
542
  hasCustomMaxSpeedMultiplier: typeof y.tapScrollCircleOptions?.maxSpeedMultiplier == "number",
543
543
  curve: y.tapCircleMaxSpeedCurve
544
544
  });
545
- Ee.current !== x.direction && (Ee.current = x.direction, q.current = 0);
546
- const { reachedBoundary: ve } = Te(q, x.direction * Re * ie);
545
+ Ve.current !== x.direction && (Ve.current = x.direction, $.current = 0);
546
+ const { reachedBoundary: ve } = Te($, x.direction * Ne * se);
547
547
  if (ve) {
548
548
  be();
549
549
  return;
550
550
  }
551
- G.current = window.requestAnimationFrame(ye);
551
+ Z.current = window.requestAnimationFrame(Ee);
552
552
  },
553
553
  [Te, be]
554
- ), tt = S(() => {
555
- G.current === null && (v.current = null, q.current = 0, G.current = window.requestAnimationFrame(ye));
556
- }, [ye]);
557
- H(() => {
558
- const l = j.current;
554
+ ), tt = v(() => {
555
+ Z.current === null && (S.current = null, $.current = 0, Z.current = window.requestAnimationFrame(Ee));
556
+ }, [Ee]);
557
+ X(() => {
558
+ const l = G.current;
559
559
  !l.active || l.direction === 0 || tt();
560
- }, [r, e, tt]), H(() => () => {
560
+ }, [r, e, tt]), X(() => () => {
561
561
  be();
562
562
  }, [be]);
563
- const rt = S(
563
+ const rt = v(
564
564
  (l) => {
565
- j.current = l, fe(l.active), l.active && l.direction !== 0 ? tt() : be();
565
+ G.current = l, pe(l.active), l.active && l.direction !== 0 ? tt() : be();
566
566
  },
567
567
  [tt, be]
568
568
  );
569
- H(() => {
570
- De || we();
571
- }, [we, De]), H(() => {
569
+ X(() => {
570
+ De || Me();
571
+ }, [Me, De]), X(() => {
572
572
  const l = (x) => {
573
- const A = x.detail?.paneId;
574
- A && I && A !== I || we();
573
+ const D = x.detail?.paneId;
574
+ D && I && D !== I || Me();
575
575
  };
576
576
  return window.addEventListener(jt, l), () => {
577
577
  window.removeEventListener(jt, l);
578
578
  };
579
- }, [I, we]), H(() => {
579
+ }, [I, Me]), X(() => {
580
580
  if (!De)
581
581
  return;
582
582
  const l = (x) => {
583
- if (!j.current.active || j.current.pointerId === x.pointerId)
583
+ if (!G.current.active || G.current.pointerId === x.pointerId)
584
584
  return;
585
585
  const y = x.target;
586
586
  if (!(y instanceof Node)) {
587
- we();
587
+ Me();
588
588
  return;
589
589
  }
590
- _.current?.getElement()?.contains(y) || we();
590
+ Y.current?.getElement()?.contains(y) || Me();
591
591
  };
592
592
  return document.addEventListener("pointerdown", l, !0), () => {
593
593
  document.removeEventListener("pointerdown", l, !0);
594
594
  };
595
- }, [we, De]);
596
- const at = (l) => {
597
- if (!ee || B <= 0 || k <= 0)
595
+ }, [Me, De]);
596
+ const st = (l) => {
597
+ if (!ee || q <= 0 || k <= 0)
598
598
  return 0;
599
- const x = se(l, 0, B);
600
- return se(x / B * k, 0, k);
601
- }, f = S((l) => {
602
- const { scrollBarVisible: x, effectiveTrackLength: y, maxScrollPosition: A } = Ae.current;
603
- if (w.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: l, trackLen: y, maxScroll: A })), y <= 0 || A <= 0)
599
+ const x = oe(l, 0, q);
600
+ return oe(x / q * k, 0, k);
601
+ }, f = v((l) => {
602
+ const { scrollBarVisible: x, effectiveTrackLength: y, maxScrollPosition: D } = Le.current;
603
+ if (T.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: l, trackLen: y, maxScroll: D })), y <= 0 || D <= 0)
604
604
  return null;
605
- const U = se(l, 0, y);
606
- return se(U / y * A, 0, A);
607
- }, []), E = S(
605
+ const K = oe(l, 0, y);
606
+ return oe(K / y * D, 0, D);
607
+ }, []), E = v(
608
608
  (l) => {
609
- const x = l.getBoundingClientRect(), y = u ? x.width : x.height, A = (st) => {
610
- const Ke = Number.parseFloat(st);
609
+ const x = l.getBoundingClientRect(), y = c ? x.width : x.height, D = (at) => {
610
+ const Ke = Number.parseFloat(at);
611
611
  return Number.isFinite(Ke) ? Ke : 0;
612
- }, U = window.getComputedStyle(l), ie = A(u ? U.width : U.height), Re = ie > 0 ? ie + A(u ? U.paddingLeft : U.paddingTop) + A(u ? U.paddingRight : U.paddingBottom) + A(u ? U.borderLeftWidth : U.borderTopWidth) + A(u ? U.borderRightWidth : U.borderBottomWidth) : 0, ve = Re > 0 ? Re : u ? l.offsetWidth : l.offsetHeight;
612
+ }, K = window.getComputedStyle(l), se = D(c ? K.width : K.height), Ne = se > 0 ? se + D(c ? K.paddingLeft : K.paddingTop) + D(c ? K.paddingRight : K.paddingBottom) + D(c ? K.borderLeftWidth : K.borderTopWidth) + D(c ? K.borderRightWidth : K.borderBottomWidth) : 0, ve = Ne > 0 ? Ne : c ? l.offsetWidth : l.offsetHeight;
613
613
  return ve <= 0 || y <= 0 ? 1 : y / ve;
614
614
  },
615
- [u]
616
- ), Ie = S(
615
+ [c]
616
+ ), Se = v(
617
617
  (l) => {
618
- const x = O.current;
618
+ const x = _.current;
619
619
  if (x.pointerId !== l.pointerId)
620
620
  return;
621
- const y = l.clientX - x.startClientX, A = l.clientY - x.startClientY, U = pt(y, A) / (x.scale || 1);
622
- w.debug("[ScrollBar] handleThumbPointerMove", () => ({
623
- delta: U,
621
+ const y = l.clientX - x.startClientX, D = l.clientY - x.startClientY, K = pt(y, D) / (x.scale || 1);
622
+ T.debug("[ScrollBar] handleThumbPointerMove", () => ({
623
+ delta: K,
624
624
  startThumbPosition: x.startThumbPosition,
625
625
  clientY: l.clientY,
626
626
  startClientY: x.startClientY,
627
- metrics: Ae.current
627
+ metrics: Le.current
628
628
  }));
629
- const ie = f(x.startThumbPosition + U);
630
- ie !== null && Ce(ie), l.cancelable && l.preventDefault();
629
+ const se = f(x.startThumbPosition + K);
630
+ se !== null && ze(se), l.cancelable && l.preventDefault();
631
631
  },
632
- [pt, f, Ce]
633
- ), Oe = S(
632
+ [pt, f, ze]
633
+ ), _e = v(
634
634
  (l) => {
635
- const x = O.current;
635
+ const x = _.current;
636
636
  if (x.pointerId !== l.pointerId)
637
637
  return;
638
- document.removeEventListener("pointermove", Ie), document.removeEventListener("pointerup", Oe), document.removeEventListener("pointercancel", Oe);
638
+ document.removeEventListener("pointermove", Se), document.removeEventListener("pointerup", _e), document.removeEventListener("pointercancel", _e);
639
639
  const y = x.captureTarget;
640
- if (y?.hasPointerCapture?.(l.pointerId) && y.releasePointerCapture(l.pointerId), O.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, ue(!1), P.current) {
641
- const A = P.current.getBoundingClientRect();
642
- l.clientX >= A.left && l.clientX <= A.right && l.clientY >= A.top && l.clientY <= A.bottom || oe(!1);
640
+ if (y?.hasPointerCapture?.(l.pointerId) && y.releasePointerCapture(l.pointerId), _.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, de(!1), P.current) {
641
+ const D = P.current.getBoundingClientRect();
642
+ l.clientX >= D.left && l.clientX <= D.right && l.clientY >= D.top && l.clientY <= D.bottom || ne(!1);
643
643
  } else
644
- oe(!1);
644
+ ne(!1);
645
645
  },
646
- [Ie]
646
+ [Se]
647
647
  );
648
- H(() => () => {
649
- document.removeEventListener("pointermove", Ie), document.removeEventListener("pointerup", Oe), document.removeEventListener("pointercancel", Oe);
650
- }, [Ie, Oe]);
651
- const _e = g(0), it = g(0), lt = S(
648
+ X(() => () => {
649
+ document.removeEventListener("pointermove", Se), document.removeEventListener("pointerup", _e), document.removeEventListener("pointercancel", _e);
650
+ }, [Se, _e]);
651
+ const ke = g(0), ot = g(0), lt = v(
652
652
  (l) => {
653
- const x = Math.max(Math.round(Ae.current.viewportSize / Pr), Mr);
654
- it.current !== l && (it.current = l, _e.current = 0), Te(_e, l * x);
653
+ const x = Math.max(Math.round(Le.current.viewportSize / Pr), Mr);
654
+ ot.current !== l && (ot.current = l, ke.current = 0), Te(ke, l * x);
655
655
  },
656
656
  [Te]
657
- ), { handleArrowPointerDown: mt, handleArrowPointerUp: ct, handleArrowKeyDown: ht } = zr({
658
- canUseArrowButtons: He,
657
+ ), { handleArrowPointerDown: mt, handleArrowPointerUp: ct, handleArrowKeyDown: ht } = Dr({
658
+ canUseArrowButtons: Oe,
659
659
  enableArrowButtons: a,
660
- resetTapScroll: we,
660
+ resetTapScroll: Me,
661
661
  scrollByStep: lt
662
662
  }), Mt = (l) => {
663
663
  if (!ee)
@@ -668,24 +668,24 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
668
668
  }
669
669
  if (l.pointerType === "mouse" && l.button !== 0 || l.ctrlKey)
670
670
  return;
671
- we();
671
+ Me();
672
672
  const x = l.currentTarget, y = E(x);
673
- let A = null;
673
+ let D = null;
674
674
  if (x.setPointerCapture)
675
675
  try {
676
- x.setPointerCapture(l.pointerId), A = x;
676
+ x.setPointerCapture(l.pointerId), D = x;
677
677
  } catch {
678
- A = null;
678
+ D = null;
679
679
  }
680
- O.current = {
680
+ _.current = {
681
681
  pointerId: l.pointerId,
682
- startThumbPosition: ge,
682
+ startThumbPosition: Ie,
683
683
  startClientX: l.clientX,
684
684
  startClientY: l.clientY,
685
685
  scale: y,
686
- captureTarget: A
687
- }, document.addEventListener("pointermove", Ie), document.addEventListener("pointerup", Oe), document.addEventListener("pointercancel", Oe), ue(!0), oe(!0), l.preventDefault(), l.stopPropagation();
688
- }, zt = (l) => {
686
+ captureTarget: D
687
+ }, document.addEventListener("pointermove", Se), document.addEventListener("pointerup", _e), document.addEventListener("pointercancel", _e), de(!0), ne(!0), l.preventDefault(), l.stopPropagation();
688
+ }, Dt = (l) => {
689
689
  if (!ee)
690
690
  return;
691
691
  if (!s) {
@@ -694,20 +694,20 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
694
694
  }
695
695
  if (l.pointerType === "mouse" && l.button !== 0 || l.ctrlKey)
696
696
  return;
697
- const x = l.currentTarget, y = x.getBoundingClientRect(), A = V(l), U = E(x), ie = (A - (u ? y.left : y.top)) / U;
698
- we();
699
- const Re = ie - $ / 2, ve = at(Re);
700
- if (Ce(ve), x.setPointerCapture)
697
+ const x = l.currentTarget, y = x.getBoundingClientRect(), D = V(l), K = E(x), se = (D - (c ? y.left : y.top)) / K;
698
+ Me();
699
+ const Ne = se - U / 2, ve = st(Ne);
700
+ if (ze(ve), x.setPointerCapture)
701
701
  try {
702
702
  x.setPointerCapture(l.pointerId);
703
703
  } catch {
704
704
  }
705
705
  M.current = {
706
706
  pointerId: l.pointerId,
707
- startThumbPosition: Re,
707
+ startThumbPosition: Ne,
708
708
  startClientX: l.clientX,
709
709
  startClientY: l.clientY,
710
- scale: U
710
+ scale: K
711
711
  }, l.preventDefault(), l.stopPropagation();
712
712
  }, bt = () => {
713
713
  M.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
@@ -719,8 +719,8 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
719
719
  bt();
720
720
  return;
721
721
  }
722
- const y = l.clientX - x.startClientX, A = l.clientY - x.startClientY, U = pt(y, A) / (x.scale || 1), ie = at(x.startThumbPosition + U);
723
- Ce(ie), l.cancelable && l.preventDefault();
722
+ const y = l.clientX - x.startClientX, D = l.clientY - x.startClientY, K = pt(y, D) / (x.scale || 1), se = st(x.startThumbPosition + K);
723
+ ze(se), l.cancelable && l.preventDefault();
724
724
  }, xe = (l) => {
725
725
  if (M.current.pointerId !== l.pointerId)
726
726
  return;
@@ -733,13 +733,13 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
733
733
  x.hasPointerCapture?.(l.pointerId) && x.releasePointerCapture(l.pointerId), bt();
734
734
  }, Lt = (l) => {
735
735
  l.target === l.currentTarget && M.current.pointerId === l.pointerId && bt();
736
- }, Ot = Fe(() => se((ae ? 1 : 0.8) * ne, 0, 1), [ae, ne]), Je = Fe(() => {
737
- const x = `calc(50% - ${Ge / 2}px + ${Ne}px)`;
736
+ }, Ot = Ye(() => oe((ae ? 1 : 0.8) * ie, 0, 1), [ae, ie]), Je = Ye(() => {
737
+ const x = `calc(50% - ${Ge / 2}px + ${Ce}px)`;
738
738
  return {
739
- left: Pe,
739
+ left: ye,
740
740
  top: x
741
741
  };
742
- }, [Pe, Ne, Ge]), Et = (l, x, y, A) => /* @__PURE__ */ le(
742
+ }, [ye, Ce, Ge]), Et = (l, x, y, D) => /* @__PURE__ */ le(
743
743
  "button",
744
744
  {
745
745
  type: "button",
@@ -756,26 +756,26 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
756
756
  onPointerCancel: ct,
757
757
  onKeyDown: ht(l),
758
758
  "aria-disabled": !a,
759
- disabled: !He,
759
+ disabled: !Oe,
760
760
  children: /* @__PURE__ */ le("span", { "aria-hidden": "true", children: y })
761
761
  },
762
- A
762
+ D
763
763
  ), Nt = h && ee ? {
764
- orientation: Be,
764
+ orientation: He,
765
765
  scrollPosition: t,
766
766
  maxScrollPosition: k,
767
767
  contentSize: r,
768
768
  viewportSize: e,
769
- thumbSize: $,
770
- thumbPosition: ge,
771
- thumbCenter: Le,
769
+ thumbSize: U,
770
+ thumbPosition: Ie,
771
+ thumbCenter: Re,
772
772
  trackSize: d,
773
- isDragging: Y,
773
+ isDragging: B,
774
774
  isTapScrollActive: ae,
775
- visibleStartIndex: D,
776
- visibleEndIndex: Z
775
+ visibleStartIndex: z,
776
+ visibleEndIndex: J
777
777
  } : null;
778
- return /* @__PURE__ */ wt(
778
+ return /* @__PURE__ */ Tt(
779
779
  "div",
780
780
  {
781
781
  className: Rt("aqvs-scrollbar", gt, b),
@@ -790,12 +790,12 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
790
790
  "aria-valuenow": t,
791
791
  "aria-valuemin": 0,
792
792
  "aria-valuemax": k,
793
- "aria-orientation": u ? "horizontal" : "vertical",
793
+ "aria-orientation": c ? "horizontal" : "vertical",
794
794
  children: [
795
- !u && ee && De && /* @__PURE__ */ le(
795
+ !c && ee && De && /* @__PURE__ */ le(
796
796
  dr,
797
797
  {
798
- ref: _,
798
+ ref: Y,
799
799
  className: Rt("aqvs-scrollbar-tap-circle-wrapper", Ze),
800
800
  size: Ge,
801
801
  maxVisualDistance: et,
@@ -806,15 +806,15 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
806
806
  },
807
807
  "tap-circle"
808
808
  ),
809
- Et(-1, J[0], We[0], "arrow-start"),
810
- /* @__PURE__ */ wt(
809
+ Et(-1, Q[0], We[0], "arrow-start"),
810
+ /* @__PURE__ */ Tt(
811
811
  "div",
812
812
  {
813
813
  className: "aqvs-scrollbar-track",
814
814
  style: {
815
815
  borderRadius: p / 2
816
816
  },
817
- onPointerDown: zt,
817
+ onPointerDown: Dt,
818
818
  onPointerMove: At,
819
819
  onPointerUp: xe,
820
820
  onPointerCancel: xt,
@@ -827,14 +827,14 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
827
827
  {
828
828
  className: "aqvs-scrollbar-thumb-wrapper",
829
829
  style: {
830
- [dt]: $,
831
- [ft]: ge,
832
- ...u ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
830
+ [dt]: U,
831
+ [ft]: Ie,
832
+ ...c ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
833
833
  },
834
- "data-visible": ee || Y ? "true" : "false",
834
+ "data-visible": ee || B ? "true" : "false",
835
835
  onPointerDown: Mt,
836
836
  role: "slider",
837
- "aria-orientation": u ? "horizontal" : "vertical",
837
+ "aria-orientation": c ? "horizontal" : "vertical",
838
838
  "aria-valuenow": t,
839
839
  "aria-valuemin": 0,
840
840
  "aria-valuemax": k,
@@ -844,18 +844,18 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
844
844
  "div",
845
845
  {
846
846
  ref: P,
847
- className: Rt("aqvs-scrollbar-thumb", u ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
847
+ className: Rt("aqvs-scrollbar-thumb", c ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
848
848
  "data-testid": "aqvs-scrollbar-thumb",
849
- "data-thumb-state": Ve,
849
+ "data-thumb-state": ge,
850
850
  style: {
851
851
  borderRadius: p - 1,
852
852
  cursor: i ? "pointer" : "default"
853
853
  },
854
854
  onMouseEnter: () => {
855
- i && oe(!0);
855
+ i && ne(!0);
856
856
  },
857
857
  onMouseLeave: () => {
858
- i && oe(!1);
858
+ i && ne(!1);
859
859
  }
860
860
  },
861
861
  "thumb"
@@ -867,7 +867,7 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
867
867
  },
868
868
  "track"
869
869
  ),
870
- Et(1, J[1], We[1], "arrow-end")
870
+ Et(1, Q[1], We[1], "arrow-end")
871
871
  ]
872
872
  }
873
873
  );
@@ -903,232 +903,234 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
903
903
  scrollBarWidth: i = 12,
904
904
  enableThumbDrag: s = !0,
905
905
  enableTrackClick: a = !0,
906
- enableArrowButtons: u = !0,
906
+ enableArrowButtons: c = !0,
907
907
  enablePointerDrag: p = !0,
908
908
  pointerDragInputs: b = Br,
909
909
  onScroll: I,
910
- className: T,
910
+ className: w,
911
911
  testId: C,
912
912
  style: h,
913
- background: D,
914
- tapScrollCircleOptions: Z,
915
- inertiaOptions: Y,
916
- itemCount: ue,
917
- renderThumbOverlay: de,
918
- wheelSpeedMultiplier: oe = 1,
913
+ background: z,
914
+ tapScrollCircleOptions: J,
915
+ inertiaOptions: B,
916
+ itemCount: de,
917
+ renderThumbOverlay: fe,
918
+ wheelSpeedMultiplier: ne = 1,
919
919
  onWheelHorizontal: ae,
920
- contentInsets: fe,
920
+ contentInsets: pe,
921
921
  visibleStartIndex: P,
922
- visibleEndIndex: O,
922
+ visibleEndIndex: _,
923
923
  renderOverlay: M,
924
- initialScrollPosition: K = 0,
924
+ initialScrollPosition: j = 0,
925
925
  contentProps: te
926
- }, j) => {
927
- const _ = g(Number.isFinite(K) ? Math.max(0, K) : 0), G = g(null), v = g(null), q = t === void 0, [Ee, Qe] = nt(0), N = t ?? Ee, De = g(null);
928
- ot(() => {
929
- if (!q)
926
+ }, G) => {
927
+ const Y = g(Number.isFinite(j) ? Math.max(0, j) : 0), Z = g(null), S = g(null), $ = t === void 0, [Ve, Qe] = nt(0), N = t ?? Ve, De = g(null);
928
+ it(() => {
929
+ if (!$)
930
930
  return;
931
- const d = v.current;
931
+ const d = S.current;
932
932
  if (!d)
933
933
  return;
934
- const Q = () => {
934
+ const W = () => {
935
935
  const k = d.offsetHeight;
936
936
  if (k > 0) {
937
- Qe((B) => B === k ? B : k);
937
+ Qe((q) => q === k ? q : k);
938
938
  return;
939
939
  }
940
- d.offsetParent !== null && e > 0 && De.current !== "zero" && (De.current = "zero", w.warn("[ScrollPane] The self-measured viewport is 0px. Give the scroll pane's host element a definite height (e.g. h-full, flex-1 + min-h-0, an explicit px height), or pass viewportSize explicitly."));
940
+ d.offsetParent !== null && e > 0 && De.current !== "zero" && (De.current = "zero", T.warn("[ScrollPane] The self-measured viewport is 0px. Give the scroll pane's host element a definite height (e.g. h-full, flex-1 + min-h-0, an explicit px height), or pass viewportSize explicitly."));
941
941
  };
942
- if (Q(), typeof ResizeObserver != "function")
942
+ if (W(), typeof ResizeObserver != "function")
943
943
  return;
944
- const $ = new ResizeObserver(Q);
945
- return $.observe(d), () => {
946
- $.disconnect();
944
+ const U = new ResizeObserver(W);
945
+ return U.observe(d), () => {
946
+ U.disconnect();
947
947
  };
948
- }, [e, q]), ot(() => {
949
- q && n?.(Ee);
950
- }, [q, Ee, n]), ot(() => {
951
- if (q)
948
+ }, [e, $]), it(() => {
949
+ $ && n?.(Ve);
950
+ }, [$, Ve, n]), it(() => {
951
+ if ($)
952
952
  return;
953
- const d = G.current;
953
+ const d = Z.current;
954
954
  if (!d)
955
955
  return;
956
- const Q = () => {
956
+ const W = () => {
957
957
  const k = d.clientHeight;
958
958
  if (k <= 0 || Math.abs(k - N) <= 1)
959
959
  return;
960
- const B = `${N}/${k}`;
961
- De.current !== B && (De.current = B, w.warn(
960
+ const q = `${N}/${k}`;
961
+ De.current !== q && (De.current = q, T.warn(
962
962
  `[ScrollPane] viewportSize=${N} but the host band is ${k}px. The clip window, max scroll position, thumb mapping, rendered row count and scrollability all derive from viewportSize, so they are now wrong. Omit viewportSize to let the pane measure itself.`
963
963
  ));
964
964
  };
965
- if (Q(), typeof ResizeObserver != "function")
965
+ if (W(), typeof ResizeObserver != "function")
966
966
  return;
967
- const $ = new ResizeObserver(Q);
968
- return $.observe(d), () => {
969
- $.disconnect();
967
+ const U = new ResizeObserver(W);
968
+ return U.observe(d), () => {
969
+ U.disconnect();
970
970
  };
971
- }, [q, N]);
971
+ }, [$, N]);
972
972
  const Ge = g(ae);
973
- H(() => {
973
+ X(() => {
974
974
  Ge.current = ae;
975
975
  }, [ae]);
976
- const Pe = g({
976
+ const ye = g({
977
977
  frame: null,
978
978
  velocity: 0,
979
979
  lastTimestamp: null,
980
980
  generation: 0
981
- }), Ne = Fe(
981
+ }), Ce = Ye(
982
982
  () => ({
983
- maxVelocity: Y?.maxVelocity ?? Ct.maxVelocity,
984
- minVelocity: Y?.minVelocity ?? Ct.minVelocity,
985
- deceleration: Y?.deceleration ?? Ct.deceleration,
986
- velocitySampleWindow: Y?.velocitySampleWindow ?? Ct.velocitySampleWindow,
987
- startVelocityThreshold: Y?.startVelocityThreshold ?? Ct.startVelocityThreshold
983
+ maxVelocity: B?.maxVelocity ?? Ct.maxVelocity,
984
+ minVelocity: B?.minVelocity ?? Ct.minVelocity,
985
+ deceleration: B?.deceleration ?? Ct.deceleration,
986
+ velocitySampleWindow: B?.velocitySampleWindow ?? Ct.velocitySampleWindow,
987
+ startVelocityThreshold: B?.startVelocityThreshold ?? Ct.startVelocityThreshold
988
988
  }),
989
- [Y]
990
- ), Ze = Fe(() => ({
991
- top: Math.max(0, fe?.top ?? 0),
992
- bottom: Math.max(0, fe?.bottom ?? 0)
993
- }), [fe]);
994
- w.debug("[ScrollPane] ScrollPane rendered", () => ({
989
+ [B]
990
+ ), Ze = Ye(() => ({
991
+ top: Math.max(0, pe?.top ?? 0),
992
+ bottom: Math.max(0, pe?.bottom ?? 0)
993
+ }), [pe]);
994
+ T.debug("[ScrollPane] ScrollPane rendered", () => ({
995
995
  contentSize: e,
996
996
  viewportSize: N,
997
997
  scrollBarWidth: i,
998
- className: T,
998
+ className: w,
999
999
  style: h,
1000
- tapScrollCircleOptions: Z,
1001
- inertiaOptions: Y,
1000
+ tapScrollCircleOptions: J,
1001
+ inertiaOptions: B,
1002
1002
  enablePointerDrag: p,
1003
1003
  contentInsets: Ze
1004
1004
  }));
1005
- const $e = g({ contentSize: e, viewportSize: N });
1006
- $e.current = { contentSize: e, viewportSize: N };
1007
- const X = Fe(() => e > N, [e, N]), ze = S(
1008
- (d) => {
1009
- const { contentSize: Q, viewportSize: $ } = $e.current, k = Q > $, B = _.current;
1010
- if (w.debug("[ScrollPane] scrollTo called", () => ({ newPosition: d, contentSize: Q, viewportSize: $, currentIsScrollable: k, prevPosition: B })), !k)
1011
- return _.current !== 0 && (_.current = 0, I?.(0, B)), _.current;
1012
- const ge = typeof d == "function" ? d(_.current) : d;
1013
- if (!Number.isFinite(ge))
1014
- return w.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: ge }), _.current;
1015
- const Le = Math.max(Q - $, 0), ee = se(ge, 0, Le);
1016
- return _.current !== ee && (_.current = ee, I?.(ee, B)), _.current;
1005
+ const $e = g({ contentSize: e, viewportSize: N }), H = Ye(() => e > N, [e, N]), Ae = v(
1006
+ (d, W) => {
1007
+ let U = W ?? $e.current;
1008
+ W && !(Number.isFinite(W.contentSize) && Number.isFinite(W.viewportSize)) && (T.warn("[ScrollPane] scrollTo received non-finite dimsOverride; falling back to the committed dims", { dimsOverride: W }), U = $e.current);
1009
+ const { contentSize: k, viewportSize: q } = U, Ie = k > q, Re = Y.current;
1010
+ if (T.debug("[ScrollPane] scrollTo called", () => ({ newPosition: d, contentSize: k, viewportSize: q, currentIsScrollable: Ie, prevPosition: Re })), !Ie)
1011
+ return Y.current !== 0 && (Y.current = 0, I?.(0, Re)), Y.current;
1012
+ const ee = typeof d == "function" ? d(Y.current) : d;
1013
+ if (!Number.isFinite(ee))
1014
+ return T.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: ee }), Y.current;
1015
+ const Oe = Math.max(k - q, 0), ge = oe(ee, 0, Oe);
1016
+ return Y.current !== ge && (Y.current = ge, I?.(ge, Re)), Y.current;
1017
1017
  },
1018
1018
  [I]
1019
- ), ne = g(ze);
1020
- H(() => {
1021
- ne.current = ze;
1022
- }, [ze]);
1023
- const he = S(() => {
1024
- const d = Pe.current;
1019
+ ), ie = g(Ae);
1020
+ X(() => {
1021
+ ie.current = Ae;
1022
+ }, [Ae]);
1023
+ const he = v(() => {
1024
+ const d = ye.current;
1025
1025
  d.generation += 1, d.frame !== null && cancelAnimationFrame(d.frame), d.frame = null, d.velocity = 0, d.lastTimestamp = null;
1026
- }, []), Ye = g(he);
1027
- H(() => {
1028
- Ye.current = he;
1029
- }, [he]), H(() => () => {
1030
- Ye.current();
1026
+ }, []), Be = g(he);
1027
+ X(() => {
1028
+ Be.current = he;
1029
+ }, [he]), X(() => () => {
1030
+ Be.current();
1031
1031
  }, []);
1032
- const Ae = S(
1032
+ const Le = v(
1033
1033
  (d) => {
1034
- if (!X)
1034
+ if (!H)
1035
1035
  return;
1036
- const { maxVelocity: Q, minVelocity: $, deceleration: k, startVelocityThreshold: B } = Ne, ge = se(d, -Q, Q);
1037
- if (Math.abs(ge) < B)
1036
+ const { maxVelocity: W, minVelocity: U, deceleration: k, startVelocityThreshold: q } = Ce, Ie = oe(d, -W, W);
1037
+ if (Math.abs(Ie) < q)
1038
1038
  return;
1039
- he(), Pe.current.velocity = ge, Pe.current.lastTimestamp = null;
1040
- const Le = Pe.current.generation, ee = (He) => {
1041
- const Ve = Pe.current;
1042
- if (Ve.generation !== Le)
1039
+ he(), ye.current.velocity = Ie, ye.current.lastTimestamp = null;
1040
+ const Re = ye.current.generation, ee = (Oe) => {
1041
+ const ge = ye.current;
1042
+ if (ge.generation !== Re)
1043
1043
  return;
1044
- if (Ve.lastTimestamp === null) {
1045
- Ve.lastTimestamp = He, Ve.frame = requestAnimationFrame(ee);
1044
+ if (ge.lastTimestamp === null) {
1045
+ ge.lastTimestamp = Oe, ge.frame = requestAnimationFrame(ee);
1046
1046
  return;
1047
1047
  }
1048
- const Ce = He - Ve.lastTimestamp;
1049
- if (Ve.lastTimestamp = He, Ce <= 0) {
1050
- Ve.frame = requestAnimationFrame(ee);
1048
+ const ze = Oe - ge.lastTimestamp;
1049
+ if (ge.lastTimestamp = Oe, ze <= 0) {
1050
+ ge.frame = requestAnimationFrame(ee);
1051
1051
  return;
1052
1052
  }
1053
- const Ue = Ve.velocity;
1053
+ const Ue = ge.velocity;
1054
1054
  let Te = Ue;
1055
- const be = k * Ce;
1055
+ const be = k * ze;
1056
1056
  Ue > 0 ? Te = Math.max(0, Ue - be) : Ue < 0 && (Te = Math.min(0, Ue + be));
1057
- const ye = (Ue + Te) / 2 * Ce, tt = _.current;
1058
- if (ye !== 0 && ne.current((Oe) => Oe + ye), Pe.current.generation !== Le)
1057
+ const Ee = (Ue + Te) / 2 * ze, tt = Y.current;
1058
+ if (Ee !== 0 && ie.current((_e) => _e + Ee), ye.current.generation !== Re)
1059
1059
  return;
1060
- const rt = _.current, { contentSize: at, viewportSize: f } = $e.current, E = Math.max(at - f, 0);
1061
- Ve.velocity = Te;
1062
- const Ie = rt === tt || rt <= 0 && Te <= 0 || rt >= E && Te >= 0;
1063
- if (Math.abs(Te) < $ || Ie) {
1060
+ const rt = Y.current, { contentSize: st, viewportSize: f } = $e.current, E = Math.max(st - f, 0);
1061
+ ge.velocity = Te;
1062
+ const Se = rt === tt || rt <= 0 && Te <= 0 || rt >= E && Te >= 0;
1063
+ if (Math.abs(Te) < U || Se) {
1064
1064
  he();
1065
1065
  return;
1066
1066
  }
1067
- Ve.frame = requestAnimationFrame(ee);
1067
+ ge.frame = requestAnimationFrame(ee);
1068
1068
  };
1069
- Pe.current.frame = requestAnimationFrame(ee);
1069
+ ye.current.frame = requestAnimationFrame(ee);
1070
1070
  },
1071
- [X, Ne, he]
1072
- ), dt = g(Ae);
1073
- H(() => {
1074
- dt.current = Ae;
1075
- }, [Ae]), ot(() => {
1071
+ [H, Ce, he]
1072
+ ), dt = g(Le);
1073
+ X(() => {
1074
+ dt.current = Le;
1075
+ }, [Le]), it(() => {
1076
1076
  $e.current = { contentSize: e, viewportSize: N };
1077
- }, [e, N]), ot(() => {
1078
- const d = v.current;
1077
+ }, [e, N]), it(() => {
1078
+ const d = S.current;
1079
1079
  if (!d) return;
1080
- const Q = () => {
1081
- d.scrollTop !== 0 && (w.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: d.scrollTop })), d.scrollTop = 0), d.scrollLeft !== 0 && (d.scrollLeft = 0);
1080
+ const W = () => {
1081
+ d.scrollTop !== 0 && (T.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: d.scrollTop })), d.scrollTop = 0), d.scrollLeft !== 0 && (d.scrollLeft = 0);
1082
1082
  };
1083
- return d.addEventListener("scroll", Q), () => d.removeEventListener("scroll", Q);
1084
- }, []), ot(() => {
1085
- if (X) {
1086
- w.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: e, viewportSize: N, scrollPosition: _.current }));
1087
- const d = se(e - N, 0, e);
1088
- _.current > d && ze(d);
1083
+ return d.addEventListener("scroll", W), () => d.removeEventListener("scroll", W);
1084
+ }, []), it(() => {
1085
+ if (H) {
1086
+ T.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: e, viewportSize: N, scrollPosition: Y.current }));
1087
+ const d = oe(e - N, 0, e);
1088
+ Y.current > d && Ae(d);
1089
1089
  } else
1090
- ze(0);
1091
- }, [X, ze, e, N]);
1092
- const R = g({ isScrollable: X, viewportSize: N, wheelSpeedMultiplier: oe });
1093
- R.current = { isScrollable: X, viewportSize: N, wheelSpeedMultiplier: oe };
1094
- const ft = S(
1090
+ Ae(0);
1091
+ }, [H, Ae, e, N]);
1092
+ const R = g({ isScrollable: H, viewportSize: N, wheelSpeedMultiplier: ne });
1093
+ it(() => {
1094
+ R.current = { isScrollable: H, viewportSize: N, wheelSpeedMultiplier: ne };
1095
+ }, [H, N, ne]);
1096
+ const ft = v(
1095
1097
  (d) => {
1096
1098
  if (Yr(d))
1097
1099
  return !1;
1098
- const { isScrollable: Q, viewportSize: $, wheelSpeedMultiplier: k } = R.current, B = Fr(d, $);
1099
- if (B.isZoomGesture)
1100
+ const { isScrollable: W, viewportSize: U, wheelSpeedMultiplier: k } = R.current, q = Fr(d, U);
1101
+ if (q.isZoomGesture)
1100
1102
  return !1;
1101
- if (B.isHorizontalDominant)
1102
- return Ge.current ? (sr(d), d.preventDefault(), he(), Ge.current(B.horizontalDelta), !0) : !1;
1103
- if (!Q || B.verticalDelta === 0)
1103
+ if (q.isHorizontalDominant)
1104
+ return Ge.current ? (sr(d), d.preventDefault(), he(), Ge.current(q.horizontalDelta), !0) : !1;
1105
+ if (!W || q.verticalDelta === 0)
1104
1106
  return !1;
1105
1107
  sr(d), d.preventDefault(), he();
1106
- let ge = B.verticalDelta;
1107
- return k !== 1 && (ge *= k), w.debug("[ScrollPane] wheel event", () => ({ deltaY: ge, scrollPosition: _.current, wheelSpeedMultiplier: k, deltaMode: d.deltaMode, scrollTop: v.current?.scrollTop })), ze((Le) => Le + ge), !0;
1108
+ let Ie = q.verticalDelta;
1109
+ return k !== 1 && (Ie *= k), T.debug("[ScrollPane] wheel event", () => ({ deltaY: Ie, scrollPosition: Y.current, wheelSpeedMultiplier: k, deltaMode: d.deltaMode, scrollTop: S.current?.scrollTop })), Ae((Re) => Re + Ie), !0;
1108
1110
  },
1109
- [ze, he]
1111
+ [Ae, he]
1110
1112
  );
1111
- H(() => {
1113
+ X(() => {
1112
1114
  const d = (k) => {
1113
1115
  ft(k);
1114
- }, Q = () => {
1116
+ }, W = () => {
1115
1117
  he();
1116
- }, $ = G.current;
1117
- return $ && ($.addEventListener("wheel", d, { passive: !1 }), $.addEventListener("pointerdown", Q, { capture: !0, passive: !0 })), () => {
1118
- $ && ($.removeEventListener("wheel", d), $.removeEventListener("pointerdown", Q, { capture: !0 }));
1118
+ }, U = Z.current;
1119
+ return U && (U.addEventListener("wheel", d, { passive: !1 }), U.addEventListener("pointerdown", W, { capture: !0, passive: !0 })), () => {
1120
+ U && (U.removeEventListener("wheel", d), U.removeEventListener("pointerdown", W, { capture: !0 }));
1119
1121
  };
1120
1122
  }, [ft, he]), Zt(
1121
- j,
1123
+ G,
1122
1124
  () => ({
1123
- scrollTo: (d) => (he(), ze(d)),
1124
- getScrollPosition: () => _.current,
1125
+ scrollTo: (d, W) => (he(), Ae(d, W)),
1126
+ getScrollPosition: () => Y.current,
1125
1127
  getContentSize: () => e,
1126
1128
  getViewportSize: () => N,
1127
1129
  applyWheel: ft
1128
1130
  }),
1129
- [ze, e, N, he, ft]
1131
+ [Ae, e, N, he, ft]
1130
1132
  );
1131
- const pt = Ir(), V = te?.id ?? pt, J = g({
1133
+ const pt = Ir(), V = te?.id ?? pt, Q = g({
1132
1134
  pointerType: "",
1133
1135
  pointerId: null,
1134
1136
  startClientY: 0,
@@ -1138,140 +1140,140 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
1138
1140
  clickResetTimer: null,
1139
1141
  velocitySamples: []
1140
1142
  }), We = g(p), gt = g(b);
1141
- H(() => {
1143
+ X(() => {
1142
1144
  We.current = p;
1143
- }, [p]), H(() => {
1145
+ }, [p]), X(() => {
1144
1146
  gt.current = b;
1145
1147
  }, [b]);
1146
- const Be = g(X);
1147
- H(() => {
1148
- Be.current = X;
1149
- }, [X]);
1150
- const et = g(Ne);
1151
- H(() => {
1152
- et.current = Ne;
1153
- }, [Ne]), H(() => {
1154
- const d = J.current;
1155
- if (p && X && (d.pointerId === null || Wt(d.pointerType, b)) || d.pointerId === null)
1148
+ const He = g(H);
1149
+ X(() => {
1150
+ He.current = H;
1151
+ }, [H]);
1152
+ const et = g(Ce);
1153
+ X(() => {
1154
+ et.current = Ce;
1155
+ }, [Ce]), X(() => {
1156
+ const d = Q.current;
1157
+ if (p && H && (d.pointerId === null || Wt(d.pointerType, b)) || d.pointerId === null)
1156
1158
  return;
1157
- const Q = v.current;
1159
+ const W = S.current;
1158
1160
  d.clickResetTimer !== null && (window.clearTimeout(d.clickResetTimer), d.clickResetTimer = null);
1159
- const $ = d.isDragging && d.shouldCancelNextClick, k = d.pointerId;
1160
- d.pointerId = null, d.pointerType = "", d.startClientY = 0, d.startScroll = 0, d.isDragging = !1, d.shouldCancelNextClick = $, d.velocitySamples = [], Q?.hasPointerCapture(k) && Q.releasePointerCapture(k);
1161
- }, [p, b, X]), H(() => {
1162
- const d = v.current;
1161
+ const U = d.isDragging && d.shouldCancelNextClick, k = d.pointerId;
1162
+ d.pointerId = null, d.pointerType = "", d.startClientY = 0, d.startScroll = 0, d.isDragging = !1, d.shouldCancelNextClick = U, d.velocitySamples = [], W?.hasPointerCapture(k) && W.releasePointerCapture(k);
1163
+ }, [p, b, H]), X(() => {
1164
+ const d = S.current;
1163
1165
  if (!d)
1164
1166
  return;
1165
- const Q = 6, $ = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), k = () => {
1166
- const f = J.current;
1167
+ const W = 6, U = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), k = () => {
1168
+ const f = Q.current;
1167
1169
  f.pointerId = null, f.pointerType = "", f.startClientY = 0, f.startScroll = 0, f.isDragging = !1, f.velocitySamples = [];
1168
- }, B = () => {
1169
- const f = J.current;
1170
+ }, q = () => {
1171
+ const f = Q.current;
1170
1172
  f.clickResetTimer !== null && (window.clearTimeout(f.clickResetTimer), f.clickResetTimer = null);
1171
- }, ge = (f) => {
1172
- const E = J.current, Ie = $();
1173
- E.velocitySamples.push({ clientY: f, time: Ie });
1174
- const Oe = et.current.velocitySampleWindow;
1175
- E.velocitySamples = E.velocitySamples.filter((_e) => Ie - _e.time <= Oe);
1176
- }, Le = (f) => f instanceof HTMLElement && f.closest("[data-scrollpane-ignore-drag='true']") !== null, ee = (f) => {
1177
- const E = J.current;
1173
+ }, Ie = (f) => {
1174
+ const E = Q.current, Se = U();
1175
+ E.velocitySamples.push({ clientY: f, time: Se });
1176
+ const _e = et.current.velocitySampleWindow;
1177
+ E.velocitySamples = E.velocitySamples.filter((ke) => Se - ke.time <= _e);
1178
+ }, Re = (f) => f instanceof HTMLElement && f.closest("[data-scrollpane-ignore-drag='true']") !== null, ee = (f) => {
1179
+ const E = Q.current;
1178
1180
  E.shouldCancelNextClick && (f.preventDefault(), f.stopPropagation(), E.shouldCancelNextClick = !1);
1179
- }, He = (f) => {
1180
- const E = J.current;
1181
+ }, Oe = (f) => {
1182
+ const E = Q.current;
1181
1183
  if (!E.isDragging) {
1182
1184
  if (E.isDragging = !0, E.shouldCancelNextClick = !0, !d.hasPointerCapture(f.pointerId))
1183
1185
  try {
1184
1186
  d.setPointerCapture(f.pointerId);
1185
1187
  } catch {
1186
1188
  }
1187
- ge(f.clientY);
1189
+ Ie(f.clientY);
1188
1190
  }
1189
- }, Ve = (f) => f.isTrusted || f.target === d, Ce = (f) => {
1190
- const E = J.current;
1191
- d.hasPointerCapture(f) && d.releasePointerCapture(f), E.shouldCancelNextClick = !1, B(), k();
1191
+ }, ge = (f) => f.isTrusted || f.target === d, ze = (f) => {
1192
+ const E = Q.current;
1193
+ d.hasPointerCapture(f) && d.releasePointerCapture(f), E.shouldCancelNextClick = !1, q(), k();
1192
1194
  }, Ue = (f) => {
1193
- const E = J.current;
1195
+ const E = Q.current;
1194
1196
  if (E.pointerId !== f.pointerId)
1195
1197
  return;
1196
1198
  if (f.buttons === 0 && Hr(f.pointerType)) {
1197
- Ce(f.pointerId);
1199
+ ze(f.pointerId);
1198
1200
  return;
1199
1201
  }
1200
- if (!(We.current && Be.current) || !Wt(f.pointerType, gt.current) || !E.isDragging && (Math.abs(f.clientY - E.startClientY) < Q || (He(f), !E.isDragging)))
1202
+ if (!(We.current && He.current) || !Wt(f.pointerType, gt.current) || !E.isDragging && (Math.abs(f.clientY - E.startClientY) < W || (Oe(f), !E.isDragging)))
1201
1203
  return;
1202
- ge(f.clientY);
1203
- const Ie = f.clientY - E.startClientY, Oe = E.startScroll - Ie;
1204
- ne.current(Oe), f.cancelable && f.preventDefault();
1204
+ Ie(f.clientY);
1205
+ const Se = f.clientY - E.startClientY, _e = E.startScroll - Se;
1206
+ ie.current(_e), f.cancelable && f.preventDefault();
1205
1207
  }, Te = () => {
1206
- const f = J.current;
1207
- return f.pointerId !== null || !f.shouldCancelNextClick ? !1 : (B(), f.clickResetTimer = window.setTimeout(() => {
1208
- const E = J.current;
1208
+ const f = Q.current;
1209
+ return f.pointerId !== null || !f.shouldCancelNextClick ? !1 : (q(), f.clickResetTimer = window.setTimeout(() => {
1210
+ const E = Q.current;
1209
1211
  E.shouldCancelNextClick = !1, E.clickResetTimer = null;
1210
1212
  }, 0), !0);
1211
1213
  }, be = (f) => {
1212
- const E = J.current;
1214
+ const E = Q.current;
1213
1215
  if (E.pointerId !== f.pointerId) {
1214
1216
  Te();
1215
1217
  return;
1216
1218
  }
1217
- E.isDragging && E.shouldCancelNextClick && f.cancelable && (f.preventDefault(), f.stopPropagation()), E.isDragging && ge(f.clientY);
1218
- let Ie = 0;
1219
+ E.isDragging && E.shouldCancelNextClick && f.cancelable && (f.preventDefault(), f.stopPropagation()), E.isDragging && Ie(f.clientY);
1220
+ let Se = 0;
1219
1221
  if (E.isDragging && E.velocitySamples.length >= 2) {
1220
- const _e = E.velocitySamples, it = et.current.velocitySampleWindow, lt = _e[_e.length - 1], mt = _e.find((ct) => lt.time - ct.time <= it) ?? _e[0];
1222
+ const ke = E.velocitySamples, ot = et.current.velocitySampleWindow, lt = ke[ke.length - 1], mt = ke.find((ct) => lt.time - ct.time <= ot) ?? ke[0];
1221
1223
  if (lt && mt && lt.time !== mt.time) {
1222
1224
  const ct = lt.clientY - mt.clientY, ht = lt.time - mt.time;
1223
- Ie = -(ct / ht);
1225
+ Se = -(ct / ht);
1224
1226
  }
1225
1227
  }
1226
- B(), E.shouldCancelNextClick && (E.clickResetTimer = window.setTimeout(() => {
1227
- const _e = J.current;
1228
- _e.shouldCancelNextClick = !1, _e.clickResetTimer = null;
1228
+ q(), E.shouldCancelNextClick && (E.clickResetTimer = window.setTimeout(() => {
1229
+ const ke = Q.current;
1230
+ ke.shouldCancelNextClick = !1, ke.clickResetTimer = null;
1229
1231
  }, 0));
1230
- const Oe = et.current.startVelocityThreshold;
1231
- k(), d.hasPointerCapture(f.pointerId) && d.releasePointerCapture(f.pointerId), Math.abs(Ie) >= Oe && dt.current?.(Ie);
1232
- }, we = (f) => {
1233
- if (J.current.pointerId !== null) {
1234
- if (!f.isPrimary || f.pointerType !== J.current.pointerType)
1232
+ const _e = et.current.startVelocityThreshold;
1233
+ k(), d.hasPointerCapture(f.pointerId) && d.releasePointerCapture(f.pointerId), Math.abs(Se) >= _e && dt.current?.(Se);
1234
+ }, Me = (f) => {
1235
+ if (Q.current.pointerId !== null) {
1236
+ if (!f.isPrimary || f.pointerType !== Q.current.pointerType)
1235
1237
  return;
1236
- Ce(J.current.pointerId);
1238
+ ze(Q.current.pointerId);
1237
1239
  }
1238
- if (J.current.shouldCancelNextClick && (B(), J.current.shouldCancelNextClick = !1), !(We.current && Be.current) || !Wt(f.pointerType, gt.current) || f.button !== 0 && f.pointerType === "mouse" || f.ctrlKey || f.metaKey || f.altKey || Le(f.target))
1240
+ if (Q.current.shouldCancelNextClick && (q(), Q.current.shouldCancelNextClick = !1), !(We.current && He.current) || !Wt(f.pointerType, gt.current) || f.button !== 0 && f.pointerType === "mouse" || f.ctrlKey || f.metaKey || f.altKey || Re(f.target))
1239
1241
  return;
1240
- window.dispatchEvent(new CustomEvent(jt, { detail: { paneId: pt } })), Ye.current?.();
1241
- const E = J.current;
1242
- B(), E.pointerId = f.pointerId, E.pointerType = f.pointerType, E.startClientY = f.clientY, E.startScroll = _.current, E.isDragging = !1, E.shouldCancelNextClick = !1, E.velocitySamples = [];
1243
- }, ye = (f) => {
1244
- if (J.current.pointerId !== f.pointerId) {
1242
+ window.dispatchEvent(new CustomEvent(jt, { detail: { paneId: pt } })), Be.current?.();
1243
+ const E = Q.current;
1244
+ q(), E.pointerId = f.pointerId, E.pointerType = f.pointerType, E.startClientY = f.clientY, E.startScroll = Y.current, E.isDragging = !1, E.shouldCancelNextClick = !1, E.velocitySamples = [];
1245
+ }, Ee = (f) => {
1246
+ if (Q.current.pointerId !== f.pointerId) {
1245
1247
  Te();
1246
1248
  return;
1247
1249
  }
1248
- Ve(f) && Ce(f.pointerId);
1250
+ ge(f) && ze(f.pointerId);
1249
1251
  }, rt = [
1250
1252
  ["click", ee, !0],
1251
- ["pointerdown", we, { passive: !1 }],
1253
+ ["pointerdown", Me, { passive: !1 }],
1252
1254
  ["lostpointercapture", (f) => {
1253
- f.target !== d || J.current.pointerId !== f.pointerId || Ce(f.pointerId);
1255
+ f.target !== d || Q.current.pointerId !== f.pointerId || ze(f.pointerId);
1254
1256
  }, void 0]
1255
- ], at = [
1257
+ ], st = [
1256
1258
  ["pointermove", Ue, { passive: !1 }],
1257
1259
  ["pointerup", be, void 0],
1258
- ["pointercancel", ye, void 0]
1260
+ ["pointercancel", Ee, void 0]
1259
1261
  ];
1260
- return _t(d, rt, "add"), _t(window, at, "add"), () => {
1261
- _t(d, rt, "remove"), _t(window, at, "remove");
1262
- const f = J.current;
1263
- f.pointerId !== null && d.hasPointerCapture(f.pointerId) && d.releasePointerCapture(f.pointerId), B(), k();
1262
+ return _t(d, rt, "add"), _t(window, st, "add"), () => {
1263
+ _t(d, rt, "remove"), _t(window, st, "remove");
1264
+ const f = Q.current;
1265
+ f.pointerId !== null && d.hasPointerCapture(f.pointerId) && d.releasePointerCapture(f.pointerId), q(), k();
1264
1266
  };
1265
1267
  }, [pt]);
1266
- const ce = S(
1267
- (d) => (he(), ze(d)),
1268
- [ze, he]
1268
+ const ce = v(
1269
+ (d) => (he(), Ae(d)),
1270
+ [Ae, he]
1269
1271
  );
1270
- return /* @__PURE__ */ wt("div", { ref: G, "data-testid": C, "data-self-measured": q ? "true" : void 0, className: Rt("aqvs-scroll-pane", T), style: h, children: [
1271
- /* @__PURE__ */ wt(
1272
+ return /* @__PURE__ */ Tt("div", { ref: Z, "data-testid": C, "data-self-measured": $ ? "true" : void 0, className: Rt("aqvs-scroll-pane", w), style: h, children: [
1273
+ /* @__PURE__ */ Tt(
1272
1274
  "div",
1273
1275
  {
1274
- ref: v,
1276
+ ref: S,
1275
1277
  className: Rt("aqvs-scroll-pane-content"),
1276
1278
  "data-testid": "aqvs-scroll-pane-content",
1277
1279
  style: {
@@ -1279,7 +1281,7 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
1279
1281
  // レイアウトを所有することで、「計測した値を書き戻して自分のサイズを変える」
1280
1282
  // フィードバックループが構造的に起こらず、初回 paint の時点でも帯は実寸で正しい
1281
1283
  // (数値の反映だけが 1 コミット遅れる)。明示モードは従来どおり px を書く。
1282
- height: q ? void 0 : N,
1284
+ height: $ ? void 0 : N,
1283
1285
  paddingTop: Ze.top,
1284
1286
  paddingBottom: Ze.bottom,
1285
1287
  // スクロール不能時 (contentSize <= viewportSize) は touch-action を通常に戻し、
@@ -1295,13 +1297,13 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
1295
1297
  // 同一条件で揃えてあるため状態としても一貫している。
1296
1298
  // 非同期コンテンツを先読みして確保する挙動は意図的に入れていない
1297
1299
  // (空のペインがページのパンを殺すデッドゾーンになり、そちらの実害の方が大きいため)。
1298
- ...p && X && b.some((d) => d === "touch" || d === "pen") ? { touchAction: "none" } : {}
1300
+ ...p && H && b.some((d) => d === "touch" || d === "pen") ? { touchAction: "none" } : {}
1299
1301
  },
1300
1302
  ...te,
1301
1303
  id: V,
1302
1304
  children: [
1303
- D,
1304
- r(_.current)
1305
+ z,
1306
+ r(Y.current)
1305
1307
  ]
1306
1308
  }
1307
1309
  ),
@@ -1310,18 +1312,18 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
1310
1312
  {
1311
1313
  contentSize: e,
1312
1314
  viewportSize: N,
1313
- scrollPosition: _.current,
1315
+ scrollPosition: Y.current,
1314
1316
  onScroll: ce,
1315
1317
  enableThumbDrag: s,
1316
1318
  enableTrackClick: a,
1317
- enableArrowButtons: u,
1319
+ enableArrowButtons: c,
1318
1320
  scrollBarWidth: i,
1319
1321
  ariaControls: V,
1320
- tapScrollCircleOptions: Z,
1321
- itemCount: ue,
1322
- renderThumbOverlay: de,
1322
+ tapScrollCircleOptions: J,
1323
+ itemCount: de,
1324
+ renderThumbOverlay: fe,
1323
1325
  visibleStartIndex: P,
1324
- visibleEndIndex: O
1326
+ visibleEndIndex: _
1325
1327
  },
1326
1328
  "scrollbar"
1327
1329
  ),
@@ -1329,8 +1331,8 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
1329
1331
  ] });
1330
1332
  }
1331
1333
  ), or = (r, e, t) => Math.min(Math.max(r, e), t), an = ({ dragState: r, normalizedDistance: e, sizeScale: t, size: n }) => {
1332
- const i = Math.max(n / 2, 1), s = 1 + e * 0.65, a = Math.max(0.65, 1 - e * 0.25), u = r.direction * e * 26 * t, p = 0.8 + e * 0.18, b = 3 * t, I = 6 * t, T = 22 * t, C = Math.abs(u) + I, h = u > 0 ? b : -Math.abs(u) - b, D = Math.max(2.5, 3 * t), Z = or(r.offsetX, -i, i), Y = or(r.offsetY, -i, i), ue = i * 0.35, de = Z / i * ue, oe = Y / i * ue, ae = de * 0.45, fe = oe * 0.45, P = Math.max(T * 0.38, 6), O = 0.65 + e * 0.2, M = r.active;
1333
- return /* @__PURE__ */ wt(ur, { children: [
1334
+ const i = Math.max(n / 2, 1), s = 1 + e * 0.65, a = Math.max(0.65, 1 - e * 0.25), c = r.direction * e * 26 * t, p = 0.8 + e * 0.18, b = 3 * t, I = 6 * t, w = 22 * t, C = Math.abs(c) + I, h = c > 0 ? b : -Math.abs(c) - b, z = Math.max(2.5, 3 * t), J = or(r.offsetX, -i, i), B = or(r.offsetY, -i, i), de = i * 0.35, fe = J / i * de, ne = B / i * de, ae = fe * 0.45, pe = ne * 0.45, P = Math.max(w * 0.38, 6), _ = 0.65 + e * 0.2, M = r.active;
1335
+ return /* @__PURE__ */ Tt(ur, { children: [
1334
1336
  /* @__PURE__ */ le(
1335
1337
  "div",
1336
1338
  {
@@ -1346,9 +1348,9 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
1346
1348
  {
1347
1349
  className: "aqvs-sample-visual-pupil",
1348
1350
  style: {
1349
- width: T,
1350
- height: T,
1351
- transform: `translate(calc(-50% + ${de}px), calc(-50% + ${oe}px)) scale(${a}, ${p * s})`,
1351
+ width: w,
1352
+ height: w,
1353
+ transform: `translate(calc(-50% + ${fe}px), calc(-50% + ${ne}px)) scale(${a}, ${p * s})`,
1352
1354
  transition: M ? "70ms transform ease-out" : "200ms ease transform"
1353
1355
  }
1354
1356
  }
@@ -1360,8 +1362,8 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
1360
1362
  style: {
1361
1363
  width: P,
1362
1364
  height: P,
1363
- transform: `translate(calc(-50% + ${ae}px), calc(-50% + ${fe}px)) scale(${a}, ${s})`,
1364
- opacity: O,
1365
+ transform: `translate(calc(-50% + ${ae}px), calc(-50% + ${pe}px)) scale(${a}, ${s})`,
1366
+ opacity: _,
1365
1367
  boxShadow: "0 0 8px rgba(255,255,255,0.45)",
1366
1368
  transition: M ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1367
1369
  }
@@ -1372,7 +1374,7 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
1372
1374
  {
1373
1375
  className: "aqvs-sample-visual-rod",
1374
1376
  style: {
1375
- width: D,
1377
+ width: z,
1376
1378
  height: C,
1377
1379
  transform: `translate(-50%, ${h}px)`,
1378
1380
  opacity: e,
@@ -1399,7 +1401,7 @@ const se = (r, e, t) => Math.max(e, Math.min(t, r)), jt = "virtualscroll:tap-scr
1399
1401
  const t = BigInt(e) & -BigInt(e);
1400
1402
  return Number(t);
1401
1403
  };
1402
- class vt {
1404
+ class St {
1403
1405
  /**
1404
1406
  * @private
1405
1407
  * @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
@@ -1465,24 +1467,24 @@ class vt {
1465
1467
  }
1466
1468
  let s = 0, a;
1467
1469
  if (i > 0) {
1468
- const u = n?.sampleRange ?? {
1470
+ const c = n?.sampleRange ?? {
1469
1471
  from: 0,
1470
1472
  to: Math.min(kt - 1, i - 1)
1471
1473
  };
1472
- let p = Math.max(0, Math.trunc(u.from)), b = Math.min(Math.trunc(u.to), i - 1);
1474
+ let p = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), i - 1);
1473
1475
  if (p > b && (p = 0, b = Math.min(kt - 1, i - 1)), i > kt)
1474
- s = vt._sampleBaseValueStrided(t, i, kt), n?.materialize && (a = { from: p, values: vt._collectValidatedValues(t, p, b) });
1476
+ s = St._sampleBaseValueStrided(t, i, kt), n?.materialize && (a = { from: p, values: St._collectValidatedValues(t, p, b) });
1475
1477
  else {
1476
- const I = vt._collectValidatedValues(t, p, b);
1477
- s = vt._modeOrMedian([...I]), n?.materialize && (a = { from: p, values: I });
1478
+ const I = St._collectValidatedValues(t, p, b);
1479
+ s = St._modeOrMedian([...I]), n?.materialize && (a = { from: p, values: I });
1478
1480
  }
1479
1481
  }
1480
1482
  if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = t, this.baseValue = s, a)
1481
- for (let u = 0; u < a.values.length; u++) {
1482
- const p = a.from + u;
1483
+ for (let c = 0; c < a.values.length; c++) {
1484
+ const p = a.from + c;
1483
1485
  if (p >= this.size)
1484
1486
  break;
1485
- const b = a.values[u] - this.baseValue;
1487
+ const b = a.values[c] - this.baseValue;
1486
1488
  b !== 0 && (this.deltas.set(p, b), this._updateTree(p, b));
1487
1489
  }
1488
1490
  this.total = this.getTotal();
@@ -1528,22 +1530,22 @@ class vt {
1528
1530
  static _modeOrMedian(e) {
1529
1531
  if (e.length === 0)
1530
1532
  return 0;
1531
- e.sort((a, u) => a - u);
1533
+ e.sort((a, c) => a - c);
1532
1534
  const t = Math.floor(e.length / 2);
1533
1535
  let n;
1534
1536
  e.length % 2 === 0 ? n = Math.floor((e[t - 1] + e[t]) / 2) : n = e[t];
1535
1537
  const i = /* @__PURE__ */ new Map();
1536
1538
  let s = 0;
1537
1539
  for (const a of e) {
1538
- const u = (i.get(a) ?? 0) + 1;
1539
- i.set(a, u), u > s && (s = u);
1540
+ const c = (i.get(a) ?? 0) + 1;
1541
+ i.set(a, c), c > s && (s = c);
1540
1542
  }
1541
1543
  if (s > e.length * 0.2) {
1542
1544
  const a = [];
1543
1545
  for (const [p, b] of i.entries())
1544
1546
  b === s && a.push(p);
1545
- const u = a.reduce((p, b) => p + b, 0);
1546
- n = Math.floor(u / a.length);
1547
+ const c = a.reduce((p, b) => p + b, 0);
1548
+ n = Math.floor(c / a.length);
1547
1549
  }
1548
1550
  return n;
1549
1551
  }
@@ -1565,7 +1567,7 @@ class vt {
1565
1567
  const s = [];
1566
1568
  for (let a = 0; a < t && s.length < n; a += i)
1567
1569
  s.push(Ut(e(a), a));
1568
- return vt._modeOrMedian(s);
1570
+ return St._modeOrMedian(s);
1569
1571
  }
1570
1572
  /**
1571
1573
  * @method update
@@ -1663,7 +1665,7 @@ class vt {
1663
1665
  throw new Error(`Value must be a finite number: ${s}`);
1664
1666
  if (s < 0)
1665
1667
  throw new Error("Value cannot be negative.");
1666
- const a = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, u = a + this.baseValue, p = s - u;
1668
+ const a = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, c = a + this.baseValue, p = s - c;
1667
1669
  p !== 0 && t.push({ index: i, change: p }), n.set(i, a + p);
1668
1670
  }
1669
1671
  return t;
@@ -1719,8 +1721,8 @@ class vt {
1719
1721
  return;
1720
1722
  const i = e.ranges;
1721
1723
  if (i && i.length > 0) {
1722
- for (const u of i) {
1723
- const p = Math.max(0, Math.trunc(u.from)), b = Math.min(Math.trunc(u.to), this.size - 1);
1724
+ for (const c of i) {
1725
+ const p = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), this.size - 1);
1724
1726
  for (let I = p; I <= b; I++)
1725
1727
  this._materialize(I);
1726
1728
  }
@@ -1759,8 +1761,8 @@ class vt {
1759
1761
  return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1760
1762
  if (!i)
1761
1763
  break;
1762
- const u = this.deltas.get(s) ?? 0;
1763
- if (this._materialize(s), (this.deltas.get(s) ?? 0) === u)
1764
+ const c = this.deltas.get(s) ?? 0;
1765
+ if (this._materialize(s), (this.deltas.get(s) ?? 0) === c)
1764
1766
  break;
1765
1767
  }
1766
1768
  const a = this.prefixSum(s);
@@ -1808,14 +1810,14 @@ class vt {
1808
1810
  this._materializeRanges(t.materializeOption);
1809
1811
  const s = t.materializeOption?.materialize === !0;
1810
1812
  for (; ; ) {
1811
- let a = 0n, u = i - 1n, p, b, I = this.total;
1812
- for (; a <= u; ) {
1813
- const h = a + u >> 1n, D = Number(h), Z = this.prefixSum(D);
1814
- if (I = Z.total, n ? Z.cumulative >= e : Z.cumulative <= e)
1815
- if (p = h, b = Z, n) {
1813
+ let a = 0n, c = i - 1n, p, b, I = this.total;
1814
+ for (; a <= c; ) {
1815
+ const h = a + c >> 1n, z = Number(h), J = this.prefixSum(z);
1816
+ if (I = J.total, n ? J.cumulative >= e : J.cumulative <= e)
1817
+ if (p = h, b = J, n) {
1816
1818
  if (h === 0n)
1817
1819
  break;
1818
- u = h - 1n;
1820
+ c = h - 1n;
1819
1821
  } else
1820
1822
  a = h + 1n;
1821
1823
  else if (n)
@@ -1823,10 +1825,10 @@ class vt {
1823
1825
  else {
1824
1826
  if (h === 0n)
1825
1827
  break;
1826
- u = h - 1n;
1828
+ c = h - 1n;
1827
1829
  }
1828
1830
  }
1829
- const T = b, C = p !== void 0 ? Number(p) : -1;
1831
+ const w = b, C = p !== void 0 ? Number(p) : -1;
1830
1832
  if (s && C >= 0) {
1831
1833
  const h = this.deltas.get(C) ?? 0;
1832
1834
  if (this._materialize(C), (this.deltas.get(C) ?? 0) !== h)
@@ -1835,9 +1837,9 @@ class vt {
1835
1837
  return {
1836
1838
  index: C,
1837
1839
  total: I,
1838
- cumulative: T?.cumulative,
1839
- currentValue: T?.currentValue,
1840
- safeIndex: T?.safeIndex
1840
+ cumulative: w?.cumulative,
1841
+ currentValue: w?.currentValue,
1842
+ safeIndex: w?.safeIndex
1841
1843
  };
1842
1844
  }
1843
1845
  }
@@ -1854,7 +1856,7 @@ class vt {
1854
1856
  return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
1855
1857
  if (this.size === 0)
1856
1858
  return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
1857
- const n = se(Math.trunc(e), 0, this.size - 1), i = t?.materializeOption;
1859
+ const n = oe(Math.trunc(e), 0, this.size - 1), i = t?.materializeOption;
1858
1860
  this._materializeRanges(i, n, !0);
1859
1861
  let s = 0, a = n + 1;
1860
1862
  for (; a > 0; ) {
@@ -1865,8 +1867,8 @@ class vt {
1865
1867
  break;
1866
1868
  a -= b;
1867
1869
  }
1868
- const u = i?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
1869
- return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue: u, safeIndex: n };
1870
+ const c = i?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
1871
+ return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue: c, safeIndex: n };
1870
1872
  }
1871
1873
  /**
1872
1874
  * @method get
@@ -1899,7 +1901,7 @@ class vt {
1899
1901
  else {
1900
1902
  this.total = this._computeTreeTotal();
1901
1903
  const n = this.prefixSum(this.getSize() - 1);
1902
- n.cumulative !== n.total && w.error("Inconsistent Fenwick Tree state");
1904
+ n.cumulative !== n.total && T.error("Inconsistent Fenwick Tree state");
1903
1905
  }
1904
1906
  return this.total;
1905
1907
  }
@@ -2006,7 +2008,7 @@ class vt {
2006
2008
  this.size = t, this.rebuildTree();
2007
2009
  }
2008
2010
  const i = this.prefixSum(this.getSize() - 1);
2009
- i.cumulative !== i.total && w.error("Inconsistent Fenwick Tree state");
2011
+ i.cumulative !== i.total && T.error("Inconsistent Fenwick Tree state");
2010
2012
  }
2011
2013
  /**
2012
2014
  * @private
@@ -2063,7 +2065,7 @@ class vt {
2063
2065
  */
2064
2066
  _growSize(e, t) {
2065
2067
  if (this.size = t, this.deltas.size > 0) {
2066
- const n = vt._minCoveredLowBound(e, t);
2068
+ const n = St._minCoveredLowBound(e, t);
2067
2069
  if (e - n < this.deltas.size)
2068
2070
  for (let s = n; s < e; s++) {
2069
2071
  const a = this.deltas.get(s);
@@ -2146,12 +2148,12 @@ const $r = (r, e) => {
2146
2148
  return t === n ? !1 : t && n ? t.from !== n.from || t.to !== n.to : !0;
2147
2149
  }, Wr = (r, e, t) => {
2148
2150
  const n = Number.isFinite(r) && r > 0 ? Math.trunc(r) : 0, i = g(null), s = g({ size: n, valueOrFn: e, options: t });
2149
- i.current === null && (i.current = new vt(n, e, t));
2150
- const a = i.current, u = s.current, p = u.size !== n, b = u.valueOrFn !== e, I = $r(u.options, t), T = u.size === 0 && n > 0 && (!i.current || i.current.base === 0);
2151
+ i.current === null && (i.current = new St(n, e, t));
2152
+ const a = i.current, c = s.current, p = c.size !== n, b = c.valueOrFn !== e, I = $r(c.options, t), w = c.size === 0 && n > 0 && (!i.current || i.current.base === 0);
2151
2153
  if (b || I) {
2152
2154
  const C = t?.resetOnValueFnChange ?? !0;
2153
- I || b && C || T ? (t?.debug && w.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }), a.reset(n, e, t)) : (p && (t?.debug && w.debug("[useFenwickMapTree] resize (with valueFn change)", { from: u.size, to: n }), a.changeSize(n)), t?.debug && w.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), a.setValueFn(e, { reset: !1 })), s.current = { size: n, valueOrFn: e, options: t };
2154
- } else p && (t?.debug && w.debug("[useFenwickMapTree] resize", { from: u.size, to: n }), T ? a.reset(n, e, t) : a.changeSize(n), s.current = { size: n, valueOrFn: e, options: t });
2155
+ I || b && C || w ? (t?.debug && T.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }), a.reset(n, e, t)) : (p && (t?.debug && T.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: n }), a.changeSize(n)), t?.debug && T.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), a.setValueFn(e, { reset: !1 })), s.current = { size: n, valueOrFn: e, options: t };
2156
+ } else p && (t?.debug && T.debug("[useFenwickMapTree] resize", { from: c.size, to: n }), w ? a.reset(n, e, t) : a.changeSize(n), s.current = { size: n, valueOrFn: e, options: t });
2155
2157
  return a;
2156
2158
  };
2157
2159
  class Ur {
@@ -2206,9 +2208,9 @@ class Kt {
2206
2208
  }
2207
2209
  function Kr(r) {
2208
2210
  const e = g(/* @__PURE__ */ new Map()), t = g(new Kt()), n = Math.floor(r), i = g(n);
2209
- H(() => {
2211
+ X(() => {
2210
2212
  if (i.current = n, Number.isNaN(n) || n < 0) {
2211
- w.warn(`useLruCache: invalid capacity ${r}; the cache will not store any entries.`), e.current.clear(), t.current = new Kt();
2213
+ T.warn(`useLruCache: invalid capacity ${r}; the cache will not store any entries.`), e.current.clear(), t.current = new Kt();
2212
2214
  return;
2213
2215
  }
2214
2216
  if (Number.isFinite(n))
@@ -2220,55 +2222,55 @@ function Kr(r) {
2220
2222
  break;
2221
2223
  }
2222
2224
  }, [r, n]);
2223
- const s = S((I) => {
2224
- const T = e.current.get(I);
2225
- if (T)
2226
- return t.current.moveToTail(T), T.value;
2227
- }, []), a = S((I, T) => {
2225
+ const s = v((I) => {
2226
+ const w = e.current.get(I);
2227
+ if (w)
2228
+ return t.current.moveToTail(w), w.value;
2229
+ }, []), a = v((I, w) => {
2228
2230
  const C = i.current;
2229
2231
  if (Number.isNaN(C) || C <= 0)
2230
2232
  return;
2231
2233
  let h = e.current.get(I);
2232
2234
  if (h)
2233
- h.value = T, t.current.moveToTail(h);
2235
+ h.value = w, t.current.moveToTail(h);
2234
2236
  else {
2235
2237
  if (e.current.size >= C) {
2236
- const D = t.current.removeHead();
2237
- D && e.current.delete(D.key);
2238
+ const z = t.current.removeHead();
2239
+ z && e.current.delete(z.key);
2238
2240
  }
2239
- h = new Ur(I, T), e.current.set(I, h), t.current.addToTail(h);
2241
+ h = new Ur(I, w), e.current.set(I, h), t.current.addToTail(h);
2240
2242
  }
2241
- }, []), u = S((I) => e.current.has(I), []), p = S((I) => {
2242
- const T = e.current.get(I);
2243
- T && (t.current.remove(T), e.current.delete(I));
2244
- }, []), b = S(() => {
2243
+ }, []), c = v((I) => e.current.has(I), []), p = v((I) => {
2244
+ const w = e.current.get(I);
2245
+ w && (t.current.remove(w), e.current.delete(I));
2246
+ }, []), b = v(() => {
2245
2247
  e.current.clear(), t.current = new Kt();
2246
2248
  }, []);
2247
- return Fe(() => ({ get: s, set: a, has: u, remove: p, clear: b }), [s, a, u, p, b]);
2249
+ return Ye(() => ({ get: s, set: a, has: c, remove: p, clear: b }), [s, a, c, p, b]);
2248
2250
  }
2249
2251
  const jr = 1e4, ln = () => {
2250
2252
  const { get: r, set: e, has: t, clear: n } = Kr(jr);
2251
- return Fe(() => ({ get: r, set: e, has: t, clear: n }), [r, e, t, n]);
2253
+ return Ye(() => ({ get: r, set: e, has: t, clear: n }), [r, e, t, n]);
2252
2254
  }, cn = (r, e) => {
2253
2255
  const t = g(e), n = g(r);
2254
- ot(() => {
2256
+ it(() => {
2255
2257
  t.current = e, n.current = r;
2256
2258
  }, [e, r]);
2257
2259
  const i = g(/* @__PURE__ */ new WeakMap());
2258
- return S((s) => {
2260
+ return v((s) => {
2259
2261
  if (!s || i.current.has(s))
2260
2262
  return;
2261
- const a = (u) => {
2262
- t.current?.enableBridge !== !1 && n.current.current?.applyWheel(u);
2263
+ const a = (c) => {
2264
+ t.current?.enableBridge !== !1 && n.current.current?.applyWheel(c);
2263
2265
  };
2264
2266
  return s.addEventListener("wheel", a, { passive: !1 }), i.current.set(s, a), () => {
2265
2267
  i.current.get(s) === a && (s.removeEventListener("wheel", a), i.current.delete(s));
2266
2268
  };
2267
2269
  }, []);
2268
- }, Se = (r, e) => e <= 0 ? 0 : se(r, 0, e - 1), ar = (r) => ({
2270
+ }, we = (r, e) => e <= 0 ? 0 : oe(r, 0, e - 1), ar = (r) => ({
2269
2271
  top: Math.max(0, r?.top ?? 0),
2270
2272
  bottom: Math.max(0, r?.bottom ?? 0)
2271
- }), je = (r, e) => r <= e ? 0 : r - e, Tt = (r, e) => r <= 0 ? 0 : r + e, Ft = 1e3, lr = 2e3, Gr = 1048576, Zr = 40, Jr = (r) => {
2273
+ }), je = (r, e) => r <= e ? 0 : r - e, wt = (r, e) => r <= 0 ? 0 : r + e, Ft = 1e3, lr = 2e3, Gr = 1048576, Zr = 40, Jr = (r) => {
2272
2274
  const e = r.ownerDocument.defaultView?.getSelection();
2273
2275
  if (!e || e.isCollapsed || e.rangeCount === 0)
2274
2276
  return !1;
@@ -2276,70 +2278,70 @@ const jr = 1e4, ln = () => {
2276
2278
  if (e.getRangeAt(t).intersectsNode(r))
2277
2279
  return !0;
2278
2280
  return !1;
2279
- }, Dt = (r) => {
2281
+ }, zt = (r) => {
2280
2282
  if (!Number.isFinite(r)) return 0n;
2281
2283
  const e = Math.trunc(r);
2282
2284
  return e <= 0 ? 0n : BigInt(e);
2283
- }, Qr = (r, e, t, n, i, s, a, u) => {
2284
- const p = Dt(n);
2285
+ }, Qr = (r, e, t, n, i, s, a, c) => {
2286
+ const p = zt(n);
2285
2287
  if (p === 0n)
2286
2288
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2287
- const b = (P) => P < 0n ? 0n : P >= p ? p - 1n : P, I = { materializeOption: { materialize: !1 } }, { index: T, cumulative: C } = s.findIndexAtOrAfter(r, I);
2289
+ const b = (P) => P < 0n ? 0n : P >= p ? p - 1n : P, I = { materializeOption: { materialize: !1 } }, { index: w, cumulative: C } = s.findIndexAtOrAfter(r, I);
2288
2290
  let h;
2289
- T === -1 ? h = p - 1n : (C === r ? h = Dt(T + 1) : h = Dt(T), h >= p && (h = p - 1n)), r <= 0 && (h = 0n), u && r >= a && (h = p - 1n);
2290
- const D = (P) => {
2291
- const O = Number(P);
2292
- if (!Number.isSafeInteger(O))
2291
+ w === -1 ? h = p - 1n : (C === r ? h = zt(w + 1) : h = zt(w), h >= p && (h = p - 1n)), r <= 0 && (h = 0n), c && r >= a && (h = p - 1n);
2292
+ const z = (P) => {
2293
+ const _ = Number(P);
2294
+ if (!Number.isSafeInteger(_))
2293
2295
  return null;
2294
- const { cumulative: M } = s.prefixSum(O, { materializeOption: { materialize: !1 } });
2296
+ const { cumulative: M } = s.prefixSum(_, { materializeOption: { materialize: !1 } });
2295
2297
  if (!Number.isFinite(M))
2296
2298
  return null;
2297
- const { index: K } = s.findIndexAtOrAfter(M + 0.5, { materializeOption: { materialize: !1 } });
2298
- if (K === -1)
2299
+ const { index: j } = s.findIndexAtOrAfter(M + 0.5, { materializeOption: { materialize: !1 } });
2300
+ if (j === -1)
2299
2301
  return null;
2300
- const te = Dt(K);
2302
+ const te = zt(j);
2301
2303
  return te > P ? te : null;
2302
- }, Z = (P) => {
2303
- let O = 0, M = P, K = P, te = 0n, j = 0;
2304
- for (; M < p && O < e; ) {
2305
- const _ = Number(M), G = i(_);
2306
- if (O += G, K = M, M += 1n, te += 1n, !Number.isFinite(G) || G < 0)
2304
+ }, J = (P) => {
2305
+ let _ = 0, M = P, j = P, te = 0n, G = 0;
2306
+ for (; M < p && _ < e; ) {
2307
+ const Y = Number(M), Z = i(Y);
2308
+ if (_ += Z, j = M, M += 1n, te += 1n, !Number.isFinite(Z) || Z < 0)
2307
2309
  break;
2308
- if (G === 0) {
2309
- if (j += 1, j > Ft) {
2310
- const v = D(K);
2311
- if (v !== null && v > M)
2312
- M = v, j = 0;
2313
- else if (v !== null && v === M && i(Number(M)) > 0)
2314
- j = 0;
2310
+ if (Z === 0) {
2311
+ if (G += 1, G > Ft) {
2312
+ const S = z(j);
2313
+ if (S !== null && S > M)
2314
+ M = S, G = 0;
2315
+ else if (S !== null && S === M && i(Number(M)) > 0)
2316
+ G = 0;
2315
2317
  else
2316
2318
  break;
2317
2319
  }
2318
2320
  } else
2319
- j = 0;
2321
+ G = 0;
2320
2322
  }
2321
- return te === 0n && (K = P), { height: O, end: K };
2323
+ return te === 0n && (j = P), { height: _, end: j };
2322
2324
  };
2323
- let { height: Y, end: ue } = Z(h);
2324
- if (Y < e && h > 0n) {
2325
- let P = h, O = Y, M = 0;
2326
- for (; P > 0n && O < e; ) {
2325
+ let { height: B, end: de } = J(h);
2326
+ if (B < e && h > 0n) {
2327
+ let P = h, _ = B, M = 0;
2328
+ for (; P > 0n && _ < e; ) {
2327
2329
  P -= 1n;
2328
- const te = Number(P), j = i(te);
2329
- if (O += j, !Number.isFinite(j) || j < 0)
2330
+ const te = Number(P), G = i(te);
2331
+ if (_ += G, !Number.isFinite(G) || G < 0)
2330
2332
  break;
2331
- if (j === 0) {
2333
+ if (G === 0) {
2332
2334
  if (M += 1, M > Ft) {
2333
- const _ = Number(P);
2334
- if (!Number.isSafeInteger(_))
2335
+ const Y = Number(P);
2336
+ if (!Number.isSafeInteger(Y))
2335
2337
  break;
2336
- const { cumulative: G } = s.prefixSum(_, { materializeOption: { materialize: !1 } });
2337
- if (!Number.isFinite(G))
2338
+ const { cumulative: Z } = s.prefixSum(Y, { materializeOption: { materialize: !1 } });
2339
+ if (!Number.isFinite(Z))
2338
2340
  break;
2339
- const { index: v } = s.findIndexAtOrAfter(G - 0.5, { materializeOption: { materialize: !1 } }), q = v === -1 ? -1n : Dt(v);
2340
- if (q >= 0n && q < P)
2341
- P = q + 1n, M = 0;
2342
- else if (q === P && P >= 1n && i(Number(P - 1n)) > 0)
2341
+ const { index: S } = s.findIndexAtOrAfter(Z - 0.5, { materializeOption: { materialize: !1 } }), $ = S === -1 ? -1n : zt(S);
2342
+ if ($ >= 0n && $ < P)
2343
+ P = $ + 1n, M = 0;
2344
+ else if ($ === P && P >= 1n && i(Number(P - 1n)) > 0)
2343
2345
  M = 0;
2344
2346
  else
2345
2347
  break;
@@ -2348,44 +2350,44 @@ const jr = 1e4, ln = () => {
2348
2350
  M = 0;
2349
2351
  }
2350
2352
  h = b(P);
2351
- const K = Z(h);
2352
- Y = K.height, ue = K.end;
2353
+ const j = J(h);
2354
+ B = j.height, de = j.end;
2353
2355
  }
2354
- const de = b(h), oe = b(ue), ae = b(de - BigInt(Math.max(0, t))), fe = b(oe + BigInt(Math.max(0, t)));
2356
+ const fe = b(h), ne = b(de), ae = b(fe - BigInt(Math.max(0, t))), pe = b(ne + BigInt(Math.max(0, t)));
2355
2357
  return {
2356
- renderingStartIndex: Se(Number(ae), n),
2357
- renderingEndIndex: Se(Number(fe), n),
2358
- visibleStartIndex: Se(Number(de), n),
2359
- visibleEndIndex: Se(Number(oe), n)
2358
+ renderingStartIndex: we(Number(ae), n),
2359
+ renderingEndIndex: we(Number(pe), n),
2360
+ visibleStartIndex: we(Number(fe), n),
2361
+ visibleEndIndex: we(Number(ne), n)
2360
2362
  };
2361
2363
  }, en = (r, e, t, n, i, s, a) => {
2362
2364
  if (n === 0)
2363
2365
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2364
- const u = Number.isFinite(a), p = u ? Math.min(Math.max(0, r), a) : Math.max(0, r);
2366
+ const c = Number.isFinite(a), p = c ? Math.min(Math.max(0, r), a) : Math.max(0, r);
2365
2367
  if (n >= Number.MAX_SAFE_INTEGER)
2366
- return Qr(p, e, t, n, i, s, a, u);
2367
- const { index: b, cumulative: I, currentValue: T } = s.findIndexAtOrAfter(p, { materializeOption: { materialize: !1 } }), C = b === -1 ? e <= 0 || (I ?? 0) < p + (T ?? 0) ? n - 1 : 0 : b;
2368
- let h = Se(C, n), D = 0;
2368
+ return Qr(p, e, t, n, i, s, a, c);
2369
+ const { index: b, cumulative: I, currentValue: w } = s.findIndexAtOrAfter(p, { materializeOption: { materialize: !1 } }), C = b === -1 ? e <= 0 || (I ?? 0) < p + (w ?? 0) ? n - 1 : 0 : b;
2370
+ let h = we(C, n), z = 0;
2369
2371
  if (b !== -1 && I === p)
2370
- h = Se(b + 1, n), D = 0;
2371
- else if (h === b && I !== void 0 && T !== void 0)
2372
- D = I - T - p;
2372
+ h = we(b + 1, n), z = 0;
2373
+ else if (h === b && I !== void 0 && w !== void 0)
2374
+ z = I - w - p;
2373
2375
  else {
2374
- const { cumulative: P, currentValue: O } = s.prefixSum(h, { materializeOption: { materialize: !1 } });
2375
- D = (P ?? 0) - (O ?? 0) - p;
2376
+ const { cumulative: P, currentValue: _ } = s.prefixSum(h, { materializeOption: { materialize: !1 } });
2377
+ z = (P ?? 0) - (_ ?? 0) - p;
2376
2378
  }
2377
- const Z = D, Y = (P, O) => {
2378
- let M = P, K = O, te = 0;
2379
- for (; M < n && K < e; ) {
2380
- const j = i(M);
2381
- if (K += j, M++, !Number.isFinite(j) || j < 0)
2379
+ const J = z, B = (P, _) => {
2380
+ let M = P, j = _, te = 0;
2381
+ for (; M < n && j < e; ) {
2382
+ const G = i(M);
2383
+ if (j += G, M++, !Number.isFinite(G) || G < 0)
2382
2384
  break;
2383
- if (j === 0) {
2385
+ if (G === 0) {
2384
2386
  if (te++, te > Ft) {
2385
- const { cumulative: _ } = s.prefixSum(M - 1, { materializeOption: { materialize: !1 } }), { index: G } = Number.isFinite(_) ? s.findIndexAtOrAfter(_ + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2386
- if (G > M)
2387
- M = G, te = 0;
2388
- else if (G === M && i(M) > 0)
2387
+ const { cumulative: Y } = s.prefixSum(M - 1, { materializeOption: { materialize: !1 } }), { index: Z } = Number.isFinite(Y) ? s.findIndexAtOrAfter(Y + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2388
+ if (Z > M)
2389
+ M = Z, te = 0;
2390
+ else if (Z === M && i(M) > 0)
2389
2391
  te = 0;
2390
2392
  else
2391
2393
  break;
@@ -2393,44 +2395,44 @@ const jr = 1e4, ln = () => {
2393
2395
  } else
2394
2396
  te = 0;
2395
2397
  }
2396
- return { cursor: M, height: K };
2397
- }, ue = Y(h, D);
2398
- let de = ue.cursor;
2399
- if (D = ue.height, D < e && h > 0) {
2400
- let P = D + Math.abs(Math.min(0, Z)), O = h - 1, M = 0;
2401
- for (; O >= 0 && P < e; ) {
2402
- const te = i(O);
2398
+ return { cursor: M, height: j };
2399
+ }, de = B(h, z);
2400
+ let fe = de.cursor;
2401
+ if (z = de.height, z < e && h > 0) {
2402
+ let P = z + Math.abs(Math.min(0, J)), _ = h - 1, M = 0;
2403
+ for (; _ >= 0 && P < e; ) {
2404
+ const te = i(_);
2403
2405
  if (P += te, !Number.isFinite(te) || te < 0) {
2404
- O--;
2406
+ _--;
2405
2407
  break;
2406
2408
  }
2407
2409
  if (te === 0) {
2408
2410
  if (M++, M > Ft) {
2409
- const { cumulative: j } = s.prefixSum(O, { materializeOption: { materialize: !1 } }), { index: _ } = Number.isFinite(j) ? s.findIndexAtOrAfter(j - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2410
- if (_ !== -1 && _ < O) {
2411
- O = _, M = 0;
2411
+ const { cumulative: G } = s.prefixSum(_, { materializeOption: { materialize: !1 } }), { index: Y } = Number.isFinite(G) ? s.findIndexAtOrAfter(G - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2412
+ if (Y !== -1 && Y < _) {
2413
+ _ = Y, M = 0;
2412
2414
  continue;
2413
2415
  }
2414
- if (_ === O && O >= 1 && i(O - 1) > 0)
2416
+ if (Y === _ && _ >= 1 && i(_ - 1) > 0)
2415
2417
  M = 0;
2416
2418
  else {
2417
- O--;
2419
+ _--;
2418
2420
  break;
2419
2421
  }
2420
2422
  }
2421
2423
  } else
2422
2424
  M = 0;
2423
- O--;
2425
+ _--;
2424
2426
  }
2425
- h = Se(O + 1, n);
2426
- const K = Y(h, 0);
2427
- de = K.cursor, D = K.height;
2427
+ h = we(_ + 1, n);
2428
+ const j = B(h, 0);
2429
+ fe = j.cursor, z = j.height;
2428
2430
  }
2429
- const oe = Se(h - t, n), ae = Se(Math.max(de - 1, h), n), fe = Se(ae + t, n);
2430
- return { renderingStartIndex: oe, renderingEndIndex: fe, visibleStartIndex: h, visibleEndIndex: ae };
2431
+ const ne = we(h - t, n), ae = we(Math.max(fe - 1, h), n), pe = we(ae + t, n);
2432
+ return { renderingStartIndex: ne, renderingEndIndex: pe, visibleStartIndex: h, visibleEndIndex: ae };
2431
2433
  }, cr = (r, e, t) => {
2432
2434
  const n = Math.max(0, e ?? 0), i = g({ last: 0, id: null, arg: null }).current;
2433
- return H(
2435
+ return X(
2434
2436
  () => () => {
2435
2437
  if (i.id !== null && (cancelAnimationFrame(i.id), i.id = null), i.arg !== null && r.current) {
2436
2438
  try {
@@ -2442,12 +2444,12 @@ const jr = 1e4, ln = () => {
2442
2444
  }
2443
2445
  },
2444
2446
  [i, r, t]
2445
- ), S(
2447
+ ), v(
2446
2448
  (s) => {
2447
2449
  if (i.arg = s, i.id !== null) return;
2448
- const a = (u) => {
2450
+ const a = (c) => {
2449
2451
  if (i.id = null, i.arg === null) return;
2450
- const p = u - i.last;
2452
+ const p = c - i.last;
2451
2453
  if (n === 0 || i.last === 0 || p >= n) {
2452
2454
  if (r.current)
2453
2455
  try {
@@ -2455,7 +2457,7 @@ const jr = 1e4, ln = () => {
2455
2457
  } catch (b) {
2456
2458
  console.error("[useThrottledInvoker] Error invoking callback", b);
2457
2459
  }
2458
- i.arg = null, i.last = u;
2460
+ i.arg = null, i.last = c;
2459
2461
  }
2460
2462
  i.arg !== null && (i.id = requestAnimationFrame(a));
2461
2463
  };
@@ -2463,9 +2465,9 @@ const jr = 1e4, ln = () => {
2463
2465
  },
2464
2466
  [n, t, r, i]
2465
2467
  );
2466
- }, tn = br.memo(({ index: r, top: e, height: t, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: a, onKeyDown: u, onFocus: p, registerItemRef: b }) => {
2467
- const I = S((D) => b(r, D), [r, b]), T = S((D) => u(D, r), [r, u]), C = S(() => p(r), [r, p]), h = S((D) => {
2468
- D.currentTarget.focus({ preventScroll: !0 });
2468
+ }, tn = br.memo(({ index: r, top: e, height: t, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: a, onKeyDown: c, onFocus: p, registerItemRef: b }) => {
2469
+ const I = v((z) => b(r, z), [r, b]), w = v((z) => c(z, r), [r, c]), C = v(() => p(r), [r, p]), h = v((z) => {
2470
+ z.currentTarget.focus({ preventScroll: !0 });
2469
2471
  }, []);
2470
2472
  return /* @__PURE__ */ le(
2471
2473
  "div",
@@ -2481,7 +2483,7 @@ const jr = 1e4, ln = () => {
2481
2483
  },
2482
2484
  tabIndex: a ? -1 : void 0,
2483
2485
  onPointerDown: a ? h : void 0,
2484
- onKeyDownCapture: a ? T : void 0,
2486
+ onKeyDownCapture: a ? w : void 0,
2485
2487
  onFocusCapture: a ? C : void 0,
2486
2488
  children: i(n, r)
2487
2489
  }
@@ -2494,74 +2496,74 @@ const jr = 1e4, ln = () => {
2494
2496
  viewportSize: i,
2495
2497
  overscanCount: s = 15,
2496
2498
  className: a,
2497
- testId: u,
2499
+ testId: c,
2498
2500
  onScroll: p,
2499
2501
  onRangeChange: b,
2500
2502
  children: I,
2501
- background: T,
2503
+ background: w,
2502
2504
  initialScrollIndex: C,
2503
2505
  initialScrollOffset: h,
2504
- initialScrollAnchor: D,
2505
- callbackThrottleMs: Z = 5,
2506
- contentInsets: Y,
2507
- onItemFocus: ue,
2508
- scrollBarOptions: de,
2509
- behaviorOptions: oe,
2506
+ initialScrollAnchor: z,
2507
+ callbackThrottleMs: J = 5,
2508
+ contentInsets: B,
2509
+ onItemFocus: de,
2510
+ scrollBarOptions: fe,
2511
+ behaviorOptions: ne,
2510
2512
  onWheelHorizontal: ae,
2511
- horizontalKeyInputs: fe,
2513
+ horizontalKeyInputs: pe,
2512
2514
  horizontalKeyStep: P = Zr,
2513
- contentProps: O
2515
+ contentProps: _
2514
2516
  }, M) => {
2515
- const { width: K, enableThumbDrag: te, enableTrackClick: j, enableArrowButtons: _, enableScrollToTopBottomButtons: G, renderThumbOverlay: v, tapScrollCircleOptions: q } = de ?? {}, { enablePointerDrag: Ee, pointerDragInputs: Qe, enableKeyboardNavigation: N = !0, wheelSpeedMultiplier: De, inertiaOptions: Ge, clipItemHeight: Pe = !1, resetOnGetItemHeightChange: Ne = !1 } = oe ?? {}, [Ze, $e] = nt(0), X = i ?? Ze, ze = S((o) => {
2516
- $e((c) => c === o ? c : o);
2517
- }, []), ne = g(null), he = g({
2517
+ const { width: j, enableThumbDrag: te, enableTrackClick: G, enableArrowButtons: Y, enableScrollToTopBottomButtons: Z, renderThumbOverlay: S, tapScrollCircleOptions: $ } = fe ?? {}, { enablePointerDrag: Ve, pointerDragInputs: Qe, enableKeyboardNavigation: N = !0, wheelSpeedMultiplier: De, inertiaOptions: Ge, clipItemHeight: ye = !1, resetOnGetItemHeightChange: Ce = !1 } = ne ?? {}, [Ze, $e] = nt(0), H = i ?? Ze, Ae = v((o) => {
2518
+ $e((u) => u === o ? u : o);
2519
+ }, []), ie = g(null), he = g({
2518
2520
  renderingStartIndex: 0,
2519
2521
  renderingEndIndex: 0,
2520
2522
  visibleStartIndex: 0,
2521
2523
  visibleEndIndex: 0,
2522
2524
  scrollPosition: 0,
2523
2525
  totalHeight: 0
2524
- }), Ye = g(D && r > 0 ? { index: se(Math.trunc(D.index), 0, r - 1), align: "top", offset: -Math.max(0, D.offsetPx ?? 0) } : null), Ae = g(!1), dt = g(!0);
2525
- H(() => {
2526
+ }), Be = g(z && r > 0 ? { index: oe(Math.trunc(z.index), 0, r - 1), align: "top", offset: -Math.max(0, z.offsetPx ?? 0) } : null), Le = g(!1), dt = g(!0);
2527
+ X(() => {
2526
2528
  if (dt.current) {
2527
2529
  dt.current = !1;
2528
2530
  return;
2529
2531
  }
2530
- Ne && (Ye.current = null);
2531
- }, [Ne, n]);
2532
- const R = Fe(() => ar(Y), [Y]), [ft] = nt(() => {
2533
- const c = D?.index ?? C, m = typeof c == "number" && Number.isFinite(c) ? Math.max(0, Math.trunc(c)) : 0;
2532
+ Ce && (Be.current = null);
2533
+ }, [Ce, n]);
2534
+ const R = Ye(() => ar(B), [B]), [ft] = nt(() => {
2535
+ const u = z?.index ?? C, m = typeof u == "number" && Number.isFinite(u) ? Math.max(0, Math.trunc(u)) : 0;
2534
2536
  return { from: Math.max(0, m - 50), to: m + 50 };
2535
- }), pt = Fe(
2537
+ }), pt = Ye(
2536
2538
  // 目的: Fenwick Tree のオプション設定
2537
2539
  // 依存関係: resetOnGetItemHeightChange, initialSampleRange (マウント時固定)
2538
2540
  // itemCount には依存させない (依存させると追記のたびに options 参照が変わり、計測済み高さが全消去される)。
2539
2541
  // この useMemo により sampleRange を毎レンダー新規生成しない = 参照同一性由来の破壊的 reset を防ぐ。
2540
2542
  () => ({
2541
2543
  sampleRange: ft,
2542
- resetOnValueFnChange: Ne,
2544
+ resetOnValueFnChange: Ce,
2543
2545
  materialize: !0
2544
2546
  }),
2545
- [Ne, ft]
2546
- ), V = Wr(r, n, pt), [J] = nt(() => {
2547
- let o = 0, c = 0;
2548
- if (D && r > 0) {
2549
- const m = se(Math.trunc(D.index), 0, r - 1), z = Math.max(0, D.offsetPx ?? 0), L = se(m - s * 2, 0, r - 1), F = se(m + s * 2, 0, r - 1), W = m > 0 || z > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: L, to: F }] } } : void 0, { cumulative: re, total: Me, currentValue: pe } = V.prefixSum(m, W), me = Math.max(re - pe + z, 0);
2550
- o = Tt(me, R.top), c = Me ?? V.getTotal();
2547
+ [Ce, ft]
2548
+ ), V = Wr(r, n, pt), [Q] = nt(() => {
2549
+ let o = 0, u = 0;
2550
+ if (z && r > 0) {
2551
+ const m = oe(Math.trunc(z.index), 0, r - 1), A = Math.max(0, z.offsetPx ?? 0), L = oe(m - s * 2, 0, r - 1), O = oe(m + s * 2, 0, r - 1), F = m > 0 || A > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: L, to: O }] } } : void 0, { cumulative: re, total: Pe, currentValue: me } = V.prefixSum(m, F), ue = Math.max(re - me + A, 0);
2552
+ o = wt(ue, R.top), u = Pe ?? V.getTotal();
2551
2553
  } else if (typeof C == "number") {
2552
- const m = se(C, 0, r - 1), z = se(m - s * 2, 0, r - 1), L = se(m + s * 2, 0, r - 1), F = C > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: z, to: L }] } } : void 0, { cumulative: W, total: re, currentValue: Me } = V.prefixSum(C, F), pe = Math.max(W - Me, 0);
2553
- o = Tt(pe, R.top), c = re ?? V.getTotal();
2554
- } else typeof h == "number" && (o = Tt(Math.max(h, 0), R.top)), c = V.getTotal();
2555
- return { position: o, total: c };
2556
- }), [We, gt] = nt(J.position), [Be, et] = nt(J.total), ce = g(J.position), d = g(R.top), Q = g(p ?? void 0), $ = g(b ?? void 0), k = g(ae), B = (fe?.length ?? 0) > 0, ge = !!ae;
2557
- H(() => {
2558
- B && (N || w.warn("[VirtualScroll] horizontalKeyInputs is set but behaviorOptions.enableKeyboardNavigation is false; horizontal keyboard scrolling is disabled because the row key handler is not mounted."), ge || w.warn("[VirtualScroll] horizontalKeyInputs is set but onWheelHorizontal is missing; horizontal keyboard scrolling is disabled because the package does not own the horizontal axis."), Number.isFinite(P) && P > 0 || w.warn(`[VirtualScroll] horizontalKeyStep must be a finite positive number, received ${P}. Horizontal arrow keys are left untouched.`));
2559
- }, [B, ge, N, P]);
2560
- const Le = g(/* @__PURE__ */ new Map()), ee = g(null), He = g(null), [Ve, Ce] = nt(null), [Ue, Te] = nt(!1), be = g(null), we = g(!1), ye = g(0), tt = g(!1), rt = g(!1), at = g(r);
2561
- at.current !== r && (at.current = r, rt.current = !0), ot(() => {
2562
- Q.current = p ?? void 0, $.current = b ?? void 0, k.current = ae;
2554
+ const m = oe(C, 0, r - 1), A = oe(m - s * 2, 0, r - 1), L = oe(m + s * 2, 0, r - 1), O = C > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: A, to: L }] } } : void 0, { cumulative: F, total: re, currentValue: Pe } = V.prefixSum(C, O), me = Math.max(F - Pe, 0);
2555
+ o = wt(me, R.top), u = re ?? V.getTotal();
2556
+ } else typeof h == "number" && (o = wt(Math.max(h, 0), R.top)), u = V.getTotal();
2557
+ return { position: o, total: u };
2558
+ }), [We, gt] = nt(Q.position), [He, et] = nt(Q.total), ce = g(Q.position), d = g(R.top), W = g(p ?? void 0), U = g(b ?? void 0), k = g(ae), q = (pe?.length ?? 0) > 0, Ie = !!ae;
2559
+ X(() => {
2560
+ q && (N || T.warn("[VirtualScroll] horizontalKeyInputs is set but behaviorOptions.enableKeyboardNavigation is false; horizontal keyboard scrolling is disabled because the row key handler is not mounted."), Ie || T.warn("[VirtualScroll] horizontalKeyInputs is set but onWheelHorizontal is missing; horizontal keyboard scrolling is disabled because the package does not own the horizontal axis."), Number.isFinite(P) && P > 0 || T.warn(`[VirtualScroll] horizontalKeyStep must be a finite positive number, received ${P}. Horizontal arrow keys are left untouched.`));
2561
+ }, [q, Ie, N, P]);
2562
+ const Re = g(/* @__PURE__ */ new Map()), ee = g(null), Oe = g(null), [ge, ze] = nt(null), [Ue, Te] = nt(!1), be = g(null), Me = g(!1), Ee = g(0), tt = g(!1), rt = g(!1), st = g(r);
2563
+ st.current !== r && (st.current = r, rt.current = !0), it(() => {
2564
+ W.current = p ?? void 0, U.current = b ?? void 0, k.current = ae;
2563
2565
  }, [b, p, ae]);
2564
- const f = S(
2566
+ const f = v(
2565
2567
  (o) => {
2566
2568
  if (N && o && typeof o.focus == "function")
2567
2569
  try {
@@ -2571,59 +2573,59 @@ const jr = 1e4, ln = () => {
2571
2573
  }
2572
2574
  },
2573
2575
  [N]
2574
- ), E = S((o, { position: c, totalHeight: m }) => {
2575
- o(c, m);
2576
- }, []), Ie = cr(Q, Z, E), Oe = S((o, c) => {
2577
- o(c);
2578
- }, []), _e = cr($, Z, Oe), it = g(R.top);
2579
- it.current = R.top;
2580
- const lt = g(Ie);
2581
- lt.current = Ie, H(() => (Ae.current = !1, () => {
2582
- Ae.current = !0, be.current && (clearTimeout(be.current), be.current = null);
2583
- }), []), H(() => {
2584
- N || (Le.current.clear(), ee.current = null, He.current = null);
2576
+ ), E = v((o, { position: u, totalHeight: m }) => {
2577
+ o(u, m);
2578
+ }, []), Se = cr(W, J, E), _e = v((o, u) => {
2579
+ o(u);
2580
+ }, []), ke = cr(U, J, _e), ot = g(R.top);
2581
+ ot.current = R.top;
2582
+ const lt = g(Se);
2583
+ lt.current = Se, X(() => (Le.current = !1, () => {
2584
+ Le.current = !0, be.current && (clearTimeout(be.current), be.current = null);
2585
+ }), []), X(() => {
2586
+ N || (Re.current.clear(), ee.current = null, Oe.current = null);
2585
2587
  }, [N]);
2586
- const mt = S(
2587
- (o, c) => {
2588
- if (!c) {
2589
- Le.current.delete(o);
2588
+ const mt = v(
2589
+ (o, u) => {
2590
+ if (!u) {
2591
+ Re.current.delete(o);
2590
2592
  return;
2591
2593
  }
2592
- N && (Le.current.set(o, c), ee.current === o && (ee.current = null, He.current = o, f(c)));
2594
+ N && (Re.current.set(o, u), ee.current === o && (ee.current = null, Oe.current = o, f(u)));
2593
2595
  },
2594
2596
  [N, f]
2595
2597
  ), ct = 0.01, ht = g({
2596
2598
  rafId: null,
2597
2599
  loopActive: !1,
2598
2600
  idleFrames: 0,
2599
- lastRenderedPosition: J.position
2600
- }), Mt = S(() => {
2601
+ lastRenderedPosition: Q.position
2602
+ }), Mt = v(() => {
2601
2603
  const o = ht.current;
2602
2604
  o.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(o.rafId), o.rafId = null, o.loopActive = !1, o.idleFrames = 0;
2603
2605
  }, []);
2604
- H(
2606
+ X(
2605
2607
  () => () => {
2606
2608
  Mt();
2607
2609
  },
2608
2610
  [Mt]
2609
2611
  );
2610
- const zt = g(() => {
2611
- }), bt = S(() => {
2612
+ const Dt = g(() => {
2613
+ }), bt = v(() => {
2612
2614
  const o = ht.current;
2613
2615
  o.rafId = null;
2614
- const c = ce.current, m = je(c, it.current), z = V.getTotal();
2615
- if (gt((F) => Math.abs(F - c) < ct ? F : c), Math.abs(o.lastRenderedPosition - c) >= ct ? (lt.current({ position: m, totalHeight: z }), o.lastRenderedPosition = c, o.idleFrames = 0) : o.idleFrames += 1, o.idleFrames >= 2) {
2616
+ const u = ce.current, m = je(u, ot.current), A = V.getTotal();
2617
+ if (gt((O) => Math.abs(O - u) < ct ? O : u), Math.abs(o.lastRenderedPosition - u) >= ct ? (lt.current({ position: m, totalHeight: A }), o.lastRenderedPosition = u, o.idleFrames = 0) : o.idleFrames += 1, o.idleFrames >= 2) {
2616
2618
  Mt();
2617
2619
  return;
2618
2620
  }
2619
2621
  if (typeof requestAnimationFrame == "function") {
2620
- o.rafId = requestAnimationFrame((F) => zt.current(F));
2622
+ o.rafId = requestAnimationFrame((O) => Dt.current(O));
2621
2623
  return;
2622
2624
  }
2623
2625
  o.loopActive = !1;
2624
2626
  }, [V, Mt]);
2625
- zt.current = bt;
2626
- const At = S(() => {
2627
+ Dt.current = bt;
2628
+ const At = v(() => {
2627
2629
  const o = ht.current;
2628
2630
  if (o.idleFrames = 0, !o.loopActive) {
2629
2631
  if (o.loopActive = !0, typeof requestAnimationFrame == "function") {
@@ -2632,275 +2634,277 @@ const jr = 1e4, ln = () => {
2632
2634
  }
2633
2635
  o.loopActive = !1;
2634
2636
  }
2635
- }, [bt]), xe = S(
2636
- (o, c) => {
2637
- const m = c?.immediate ?? !1, z = je(o, R.top);
2637
+ }, [bt]), xe = v(
2638
+ (o, u) => {
2639
+ const m = u?.immediate ?? !1, A = je(o, R.top);
2638
2640
  if (ce.current = o, m) {
2639
- ht.current.lastRenderedPosition = o, ht.current.idleFrames = 0, gt(o), Ie({ position: z, totalHeight: V.getTotal() });
2641
+ ht.current.lastRenderedPosition = o, ht.current.idleFrames = 0, gt(o), Se({ position: A, totalHeight: V.getTotal() });
2640
2642
  return;
2641
2643
  }
2642
2644
  At();
2643
2645
  },
2644
- [At, V, R.top, Ie]
2645
- ), xt = S((o) => {
2646
- const c = ne.current;
2647
- if (!c)
2646
+ [At, V, R.top, Se]
2647
+ ), xt = v((o, u = 0) => {
2648
+ const m = ie.current;
2649
+ if (!m)
2648
2650
  return o;
2649
- const m = c.getScrollPosition();
2650
- ye.current += 1;
2651
- const z = c.scrollTo(o);
2652
- return z === m && (ye.current = Math.max(0, ye.current - 1)), Math.abs(z - o) > 0.5 && (tt.current = !0), z;
2651
+ const A = m.getScrollPosition();
2652
+ Ee.current += 1;
2653
+ const L = m.getContentSize() + u, O = m.getViewportSize(), F = m.scrollTo(o, { contentSize: L, viewportSize: O });
2654
+ return F === A && (Ee.current = Math.max(0, Ee.current - 1)), Math.abs(F - o) > 0.5 && (tt.current = !0), F;
2653
2655
  }, []), Lt = g(!1);
2654
- H(() => {
2656
+ X(() => {
2655
2657
  if (!Lt.current)
2656
- if (Lt.current = !0, D == null && typeof C != "number" && typeof h == "number") {
2657
- const o = Tt(Math.max(h, 0), R.top), c = Math.abs(o - ce.current) > 0.5;
2658
- xe(o, { immediate: !0 }), c && ne.current?.scrollTo(o);
2658
+ if (Lt.current = !0, z == null && typeof C != "number" && typeof h == "number") {
2659
+ const o = wt(Math.max(h, 0), R.top), u = Math.abs(o - ce.current) > 0.5;
2660
+ xe(o, { immediate: !0 }), u && ie.current?.scrollTo(o);
2659
2661
  } else
2660
2662
  xe(ce.current, { immediate: !0 });
2661
- }, [D, C, h, R.top, xe]), H(() => {
2663
+ }, [z, C, h, R.top, xe]), X(() => {
2662
2664
  const o = V.getTotal();
2663
- if (Be !== o) {
2665
+ if (He !== o) {
2664
2666
  et(o);
2665
2667
  return;
2666
2668
  }
2667
2669
  if (tt.current) {
2668
2670
  tt.current = !1;
2669
- const c = ne.current;
2670
- if (c && Math.abs(c.getScrollPosition() - ce.current) > 0.5) {
2671
+ const u = ie.current;
2672
+ if (u && Math.abs(u.getScrollPosition() - ce.current) > 0.5) {
2671
2673
  const m = xt(ce.current);
2672
2674
  tt.current = !1, xe(m, { immediate: !0 });
2673
2675
  }
2674
2676
  }
2675
- }, [V, Be, r, xt, xe]), H(() => {
2676
- if (Ye.current !== null) {
2677
- const { index: o, align: c, offset: m } = Ye.current, z = Se(o, r), { cumulative: L, currentValue: F } = V.prefixSum(z, { materializeOption: { materialize: !1 } });
2678
- if (L !== void 0 && F !== void 0) {
2679
- const W = Math.max(L - F, 0);
2680
- let re = W;
2681
- c === "bottom" ? re = L - X : c === "center" && (re = W + F / 2 - X / 2), m && (re -= m), re = Math.max(0, re);
2682
- const Me = Math.max(0, Be + R.top + R.bottom - X), pe = Math.min(Tt(re, R.top), Me);
2683
- Math.abs(pe - ce.current) > 1 && (w.debug("[VirtualScroll] Drift correction", {
2677
+ }, [V, He, r, xt, xe]), X(() => {
2678
+ if (Be.current !== null) {
2679
+ const { index: o, align: u, offset: m } = Be.current, A = we(o, r), { cumulative: L, currentValue: O } = V.prefixSum(A, { materializeOption: { materialize: !1 } });
2680
+ if (L !== void 0 && O !== void 0) {
2681
+ const F = Math.max(L - O, 0);
2682
+ let re = F;
2683
+ u === "bottom" ? re = L - H : u === "center" && (re = F + O / 2 - H / 2), m && (re -= m), re = Math.max(0, re);
2684
+ const Pe = Math.max(0, He + R.top + R.bottom - H), me = Math.min(wt(re, R.top), Pe);
2685
+ Math.abs(me - ce.current) > 1 && (T.debug("[VirtualScroll] Drift correction", {
2684
2686
  from: ce.current,
2685
- to: pe,
2686
- targetIndex: z
2687
- }), ye.current === 0 && (ye.current += 1), ne.current?.scrollTo(pe), xe(pe, { immediate: !0 }));
2687
+ to: me,
2688
+ targetIndex: A
2689
+ }), Ee.current === 0 && (Ee.current += 1), ie.current?.scrollTo(me), xe(me, { immediate: !0 }));
2688
2690
  }
2689
2691
  }
2690
2692
  rt.current = !1;
2691
- }, [Be, V, r, R.top, xe, X, R.bottom]), H(() => {
2693
+ }, [He, V, r, R.top, xe, H, R.bottom]), X(() => {
2692
2694
  const o = d.current;
2693
- if (o === R.top || (d.current = R.top, Ye.current))
2695
+ if (o === R.top || (d.current = R.top, Be.current))
2694
2696
  return;
2695
- const c = je(ce.current, o), m = Tt(c, R.top);
2696
- ce.current = m, ne.current?.scrollTo(m), xe(m, { immediate: !0 });
2697
+ const u = je(ce.current, o), m = wt(u, R.top);
2698
+ ce.current = m, ie.current?.scrollTo(m), xe(m, { immediate: !0 });
2697
2699
  }, [R.top, xe]);
2698
- const Ot = S(
2699
- (o, c) => {
2700
+ const Ot = v(
2701
+ (o, u) => {
2700
2702
  if (r === 0)
2701
2703
  return;
2702
- const m = Se(o, r), z = V.get(m), L = c - z, F = V.update(m, c);
2703
- F !== void 0 && et(F), w.debug("[VirtualScroll] Updated item size manually", { index: m, size: c, total: F });
2704
- let W = Ye.current ? Ye.current.index : null;
2705
- if (W === null) {
2706
- const re = ce.current, Me = ar(Y).top, pe = je(re, Me), { index: me, cumulative: qe } = V.findIndexAtOrAfter(pe, { materializeOption: { materialize: !1 } });
2707
- W = qe !== void 0 && qe === pe ? me + 1 : me;
2704
+ const m = we(o, r), A = V.get(m), L = u - A, O = V.update(m, u);
2705
+ O !== void 0 && et(O), T.debug("[VirtualScroll] Updated item size manually", { index: m, size: u, total: O });
2706
+ let F = Be.current ? Be.current.index : null;
2707
+ if (F === null) {
2708
+ const re = ce.current, Pe = ar(B).top, me = je(re, Pe), { index: ue, cumulative: qe } = V.findIndexAtOrAfter(me, { materializeOption: { materialize: !1 } });
2709
+ F = qe !== void 0 && qe === me ? ue + 1 : ue;
2708
2710
  }
2709
- if (W !== -1 && m < W && L !== 0) {
2710
- const re = ce.current, Me = re + L;
2711
- xt(Me), xe(Me, { immediate: !0 }), w.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: re, to: Me, causedByIndex: m, delta: L, activeVisibleStartIndex: W });
2711
+ if (F !== -1 && m < F && L !== 0) {
2712
+ const re = ce.current, Pe = re + L;
2713
+ xt(Pe, L), xe(Pe, { immediate: !0 }), T.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: re, to: Pe, causedByIndex: m, delta: L, activeVisibleStartIndex: F });
2712
2714
  }
2713
2715
  },
2714
- [V, r, xt, xe, Y]
2715
- ), Je = S(
2716
- (o, c) => {
2717
- if (!ne.current || r === 0)
2716
+ [V, r, xt, xe, B]
2717
+ ), Je = v(
2718
+ (o, u) => {
2719
+ if (!ie.current || r === 0)
2718
2720
  return;
2719
- const m = Se(o, r), z = Se(m - s * 2, r), L = Se(m + s * 2, r), { cumulative: F, total: W, currentValue: re } = V.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: z, to: L }] } });
2720
- if (w.debug("[VirtualScroll] Scrolling to index:", m, "ItemBottom:", F, "Total height:", W, "ItemHeight:", re, "safeIndexFrom:", z, "safeIndexTo:", L), !W)
2721
+ const m = we(o, r), A = we(m - s * 2, r), L = we(m + s * 2, r), { cumulative: O, total: F, currentValue: re } = V.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: A, to: L }] } });
2722
+ if (T.debug("[VirtualScroll] Scrolling to index:", m, "ItemBottom:", O, "Total height:", F, "ItemHeight:", re, "safeIndexFrom:", A, "safeIndexTo:", L), !F)
2721
2723
  return;
2722
- const Me = Math.max(F - re, 0);
2723
- let pe = Me;
2724
- c?.align === "bottom" ? pe = F - X : c?.align === "center" && (pe = Me + re / 2 - X / 2), c?.offset && (pe -= c.offset), pe = Math.max(0, pe);
2725
- const me = Tt(pe, R.top), qe = ne.current?.getContentSize() ?? W + R.top + R.bottom, ke = Math.max(0, qe - X), Xe = Math.min(me, ke);
2726
- Ye.current = {
2724
+ const Pe = Math.max(O - re, 0);
2725
+ let me = Pe;
2726
+ u?.align === "bottom" ? me = O - H : u?.align === "center" && (me = Pe + re / 2 - H / 2), u?.offset && (me -= u.offset), me = Math.max(0, me);
2727
+ const ue = wt(me, R.top), qe = ie.current?.getContentSize() ?? F + R.top + R.bottom, Fe = Math.max(0, qe - H), Xe = Math.min(ue, Fe);
2728
+ Be.current = {
2727
2729
  index: m,
2728
- align: c?.align,
2729
- offset: c?.offset
2730
+ align: u?.align,
2731
+ offset: u?.offset
2730
2732
  };
2731
- const Vt = ne.current?.getScrollPosition() ?? -1, qt = Math.abs(Vt - Xe) > 0.5;
2732
- we.current = !1, ye.current = 0, qt && (we.current = !0, ye.current += 1, ne.current?.scrollTo(Xe)), et(W), xe(Xe, { immediate: !0 }), w.debug("[VirtualScroll] Setting scroll position to:", Xe, { original: me, max: ke });
2733
+ const Vt = ie.current?.getScrollPosition() ?? -1, qt = Math.abs(Vt - Xe) > 0.5;
2734
+ Me.current = !1, Ee.current = 0, qt && (Me.current = !0, Ee.current += 1, ie.current?.scrollTo(Xe)), et(F), xe(Xe, { immediate: !0 }), T.debug("[VirtualScroll] Setting scroll position to:", Xe, { original: ue, max: Fe });
2733
2735
  },
2734
- [V, s, r, R.top, R.bottom, X, xe]
2735
- ), Et = g(D && r === 0 ? D : null);
2736
- H(() => {
2736
+ [V, s, r, R.top, R.bottom, H, xe]
2737
+ ), Et = g(z && r === 0 ? z : null);
2738
+ X(() => {
2737
2739
  const o = Et.current;
2738
- !o || r === 0 || (Et.current = null, Je(se(Math.trunc(o.index), 0, r - 1), { align: "top", offset: -Math.max(0, o.offsetPx ?? 0) }));
2740
+ !o || r === 0 || (Et.current = null, Je(oe(Math.trunc(o.index), 0, r - 1), { align: "top", offset: -Math.max(0, o.offsetPx ?? 0) }));
2739
2741
  }, [r, Je]);
2740
- const Nt = S(
2742
+ const Nt = v(
2741
2743
  (o) => {
2742
- if (!ne.current || r === 0)
2744
+ if (!ie.current || r === 0)
2743
2745
  return;
2744
- const c = V.getTotal(), m = se(Math.floor(o), 0, c), { index: z, cumulative: L, currentValue: F } = V.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), re = (L ?? 0) - (F ?? 0) - m;
2745
- Je(z, { offset: re });
2746
+ const u = V.getTotal(), m = oe(Math.floor(o), 0, u), { index: A, cumulative: L, currentValue: O } = V.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), re = (L ?? 0) - (O ?? 0) - m;
2747
+ Je(A, { offset: re });
2746
2748
  },
2747
2749
  [V, r, Je]
2748
- ), l = S(() => {
2750
+ ), l = v(() => {
2749
2751
  if (r === 0)
2750
2752
  return null;
2751
- const o = je(ce.current, R.top), { index: c, cumulative: m, currentValue: z } = V.findIndexAtOrAfter(o, { materializeOption: { materialize: !1 } });
2752
- if (c === -1)
2753
+ const o = je(ce.current, R.top), { index: u, cumulative: m, currentValue: A } = V.findIndexAtOrAfter(o, { materializeOption: { materialize: !1 } });
2754
+ if (u === -1)
2753
2755
  return { index: r - 1, offsetPx: 0 };
2754
2756
  if (m === o)
2755
- return { index: se(c + 1, 0, r - 1), offsetPx: 0 };
2756
- const L = (m ?? 0) - (z ?? 0);
2757
- return { index: c, offsetPx: Math.max(0, o - L) };
2758
- }, [V, r, R.top]), x = S(
2757
+ return { index: oe(u + 1, 0, r - 1), offsetPx: 0 };
2758
+ const L = (m ?? 0) - (A ?? 0);
2759
+ return { index: u, offsetPx: Math.max(0, o - L) };
2760
+ }, [V, r, R.top]), x = v(
2759
2761
  (o) => {
2760
- const c = je(ce.current, R.top), m = typeof o == "function" ? o(c) : o;
2762
+ const u = je(ce.current, R.top), m = typeof o == "function" ? o(u) : o;
2761
2763
  Nt(m);
2762
- const z = ne.current?.getScrollPosition(), L = typeof z == "number" ? z : ce.current;
2763
- return xe(L), je(L, it.current);
2764
+ const A = ie.current?.getScrollPosition(), L = typeof A == "number" ? A : ce.current;
2765
+ return xe(L), je(L, ot.current);
2764
2766
  },
2765
2767
  [R.top, Nt, xe]
2766
- ), y = S((o) => {
2767
- const c = ne.current;
2768
- if (!c)
2769
- return je(ce.current, it.current);
2770
- const m = c.scrollTo((z) => z + o);
2771
- return je(m, it.current);
2772
- }, []), A = S((o) => ne.current?.applyWheel(o) ?? !1, []), U = S(
2773
- (o, c) => {
2774
- w.debug("[VirtualScroll] Scroll position changed:", o);
2775
- const m = we.current;
2776
- m && (we.current = !1);
2777
- const z = ye.current > 0;
2778
- if (z && (ye.current = 0), m || z || rt.current || (Ye.current = null), xe(o), G) {
2779
- if (m || z)
2768
+ ), y = v((o) => {
2769
+ const u = ie.current;
2770
+ if (!u)
2771
+ return je(ce.current, ot.current);
2772
+ const m = u.scrollTo((A) => A + o);
2773
+ return je(m, ot.current);
2774
+ }, []), D = v((o) => ie.current?.applyWheel(o) ?? !1, []), K = v(
2775
+ (o, u) => {
2776
+ T.debug("[VirtualScroll] Scroll position changed:", o);
2777
+ const m = Me.current;
2778
+ m && (Me.current = !1);
2779
+ const A = Ee.current > 0;
2780
+ A && (Ee.current = 0);
2781
+ const L = rt.current && st.current === r;
2782
+ if (m || A || L || (Be.current = null), xe(o), Z) {
2783
+ if (m || A)
2780
2784
  return;
2781
- const L = o - c;
2782
- if (w.debug("[VirtualScroll] Scroll diff:", L, "New:", o, "Prev:", c), Math.abs(L) > 1) {
2783
- const F = L > 0 ? "down" : "up";
2784
- Ce(F), Te(!0), w.debug("[VirtualScroll] Showing scroll buttons. Direction:", F), be.current && clearTimeout(be.current), be.current = setTimeout(() => {
2785
- Te(!1), w.debug("[VirtualScroll] Hiding scroll buttons");
2785
+ const O = o - u;
2786
+ if (T.debug("[VirtualScroll] Scroll diff:", O, "New:", o, "Prev:", u), Math.abs(O) > 1) {
2787
+ const F = O > 0 ? "down" : "up";
2788
+ ze(F), Te(!0), T.debug("[VirtualScroll] Showing scroll buttons. Direction:", F), be.current && clearTimeout(be.current), be.current = setTimeout(() => {
2789
+ Te(!1), T.debug("[VirtualScroll] Hiding scroll buttons");
2786
2790
  }, 2e3);
2787
2791
  }
2788
2792
  }
2789
2793
  },
2790
- [xe, G]
2791
- ), ie = Fe(() => je(We, R.top), [R.top, We]), Re = Fe(() => {
2792
- const o = V.getTotal(), c = en(ie, X, s, r, n, V, o);
2793
- return w.debug("[VirtualScroll] Calculated rendering range:", () => ({
2794
- ...c,
2795
- scrollPosition: ie,
2794
+ [xe, Z, r]
2795
+ ), se = Ye(() => je(We, R.top), [R.top, We]), Ne = Ye(() => {
2796
+ const o = V.getTotal(), u = en(se, H, s, r, n, V, o);
2797
+ return T.debug("[VirtualScroll] Calculated rendering range:", () => ({
2798
+ ...u,
2799
+ scrollPosition: se,
2796
2800
  renderingContentSize: o,
2797
2801
  overscanCount: s,
2798
- viewportSize: X
2799
- })), c;
2800
- }, [ie, X, s, r, n, V]), { renderingStartIndex: ve, renderingEndIndex: st, visibleStartIndex: Ke, visibleEndIndex: Pt } = Re, St = S(
2801
- (o, c) => {
2802
+ viewportSize: H
2803
+ })), u;
2804
+ }, [se, H, s, r, n, V]), { renderingStartIndex: ve, renderingEndIndex: at, visibleStartIndex: Ke, visibleEndIndex: Pt } = Ne, vt = v(
2805
+ (o, u) => {
2802
2806
  if (!N || r === 0)
2803
2807
  return;
2804
- const m = Se(o, r);
2805
- if (!(c?.ensureVisible ?? !0)) {
2806
- const ke = Le.current.get(m);
2807
- ke && (ee.current = null, He.current = m, f(ke));
2808
+ const m = we(o, r);
2809
+ if (!(u?.ensureVisible ?? !0)) {
2810
+ const Fe = Re.current.get(m);
2811
+ Fe && (ee.current = null, Oe.current = m, f(Fe));
2808
2812
  return;
2809
2813
  }
2810
- const L = V.prefixSum(m, { materializeOption: { materialize: !1 } }), F = L.currentValue, W = Math.max(L.cumulative - F, 0), re = W + F, Me = je(ce.current, R.top), pe = Me + X;
2811
- if (W < Me || re > pe) {
2814
+ const L = V.prefixSum(m, { materializeOption: { materialize: !1 } }), O = L.currentValue, F = Math.max(L.cumulative - O, 0), re = F + O, Pe = je(ce.current, R.top), me = Pe + H;
2815
+ if (F < Pe || re > me) {
2812
2816
  Je(m);
2813
- const ke = Le.current.get(m);
2814
- ke ? (ee.current = null, He.current = m, f(ke)) : ee.current = m;
2817
+ const Fe = Re.current.get(m);
2818
+ Fe ? (ee.current = null, Oe.current = m, f(Fe)) : ee.current = m;
2815
2819
  return;
2816
2820
  }
2817
- const qe = Le.current.get(m);
2821
+ const qe = Re.current.get(m);
2818
2822
  if (qe) {
2819
- ee.current = null, He.current = m, f(qe);
2823
+ ee.current = null, Oe.current = m, f(qe);
2820
2824
  return;
2821
2825
  }
2822
2826
  ee.current = m;
2823
2827
  },
2824
- [N, r, V, R.top, Je, f, X]
2825
- ), Jt = S(
2826
- (o, c) => {
2828
+ [N, r, V, R.top, Je, f, H]
2829
+ ), Jt = v(
2830
+ (o, u) => {
2827
2831
  if (!(!N || o.defaultPrevented) && !(o.altKey || o.metaKey || o.ctrlKey) && o.target === o.currentTarget && !o.currentTarget.isContentEditable) {
2828
2832
  if (o.key === "ArrowLeft" || o.key === "ArrowRight") {
2829
2833
  const m = k.current;
2830
2834
  if (!m)
2831
2835
  return;
2832
- const z = o.shiftKey ? "shift-arrow" : "arrow";
2833
- if (!fe?.includes(z) || o.shiftKey && Jr(o.currentTarget) || !(Number.isFinite(P) && P > 0))
2836
+ const A = o.shiftKey ? "shift-arrow" : "arrow";
2837
+ if (!pe?.includes(A) || o.shiftKey && Jr(o.currentTarget) || !(Number.isFinite(P) && P > 0))
2834
2838
  return;
2835
2839
  o.preventDefault(), m(o.key === "ArrowLeft" ? -P : P);
2836
2840
  return;
2837
2841
  }
2838
2842
  if (o.key === "ArrowDown") {
2839
- c < r - 1 && (o.preventDefault(), St(c + 1));
2843
+ u < r - 1 && (o.preventDefault(), vt(u + 1));
2840
2844
  return;
2841
2845
  }
2842
2846
  if (o.key === "ArrowUp") {
2843
- c > 0 && (o.preventDefault(), St(c - 1));
2847
+ u > 0 && (o.preventDefault(), vt(u - 1));
2844
2848
  return;
2845
2849
  }
2846
2850
  if (o.key === "PageDown") {
2847
- if (c < r - 1) {
2851
+ if (u < r - 1) {
2848
2852
  o.preventDefault();
2849
- const { visibleStartIndex: m, visibleEndIndex: z } = he.current, L = Math.max(z - m + 1, 1), F = Math.max(L, 1), W = Se(Math.min(c + F, r - 1), r);
2850
- St(W);
2853
+ const { visibleStartIndex: m, visibleEndIndex: A } = he.current, L = Math.max(A - m + 1, 1), O = Math.max(L, 1), F = we(Math.min(u + O, r - 1), r);
2854
+ vt(F);
2851
2855
  }
2852
2856
  return;
2853
2857
  }
2854
- if (o.key === "PageUp" && c > 0) {
2858
+ if (o.key === "PageUp" && u > 0) {
2855
2859
  o.preventDefault();
2856
- const { visibleStartIndex: m, visibleEndIndex: z } = he.current, L = Math.max(z - m + 1, 1), F = Math.max(L, 1), W = Se(c - F, r);
2857
- St(W);
2860
+ const { visibleStartIndex: m, visibleEndIndex: A } = he.current, L = Math.max(A - m + 1, 1), O = Math.max(L, 1), F = we(u - O, r);
2861
+ vt(F);
2858
2862
  }
2859
2863
  }
2860
2864
  },
2861
- [N, r, St, fe, P]
2862
- ), Qt = S(
2865
+ [N, r, vt, pe, P]
2866
+ ), Qt = v(
2863
2867
  (o) => {
2864
2868
  if (!N)
2865
2869
  return;
2866
- const c = Se(o, r);
2867
- ee.current = null, He.current = c, ue?.(c);
2870
+ const u = we(o, r);
2871
+ ee.current = null, Oe.current = u, de?.(u);
2868
2872
  },
2869
- [N, r, ue]
2873
+ [N, r, de]
2870
2874
  );
2871
- H(() => {
2872
- const o = ne.current?.getScrollPosition() ?? 0, c = ce.current, m = je(c, R.top);
2873
- w.debug("[VirtualScroll] Range change effect triggered", () => ({
2875
+ X(() => {
2876
+ const o = ie.current?.getScrollPosition() ?? 0, u = ce.current, m = je(u, R.top);
2877
+ T.debug("[VirtualScroll] Range change effect triggered", () => ({
2874
2878
  renderingStartIndex: ve,
2875
- renderingEndIndex: st,
2879
+ renderingEndIndex: at,
2876
2880
  visibleStartIndex: Ke,
2877
2881
  visibleEndIndex: Pt,
2878
2882
  scrollPositionState: We,
2879
- paneScrollPosition: c,
2883
+ paneScrollPosition: u,
2880
2884
  logicalScrollPosition: m,
2881
- contentSize: Be,
2885
+ contentSize: He,
2882
2886
  scrollPaneScrollPosition: o
2883
- })), _e({
2887
+ })), ke({
2884
2888
  renderingStartIndex: ve,
2885
- renderingEndIndex: st,
2889
+ renderingEndIndex: at,
2886
2890
  visibleStartIndex: Ke,
2887
2891
  visibleEndIndex: Pt,
2888
2892
  scrollPosition: m,
2889
- totalHeight: Be
2893
+ totalHeight: He
2890
2894
  });
2891
- }, [Be, st, ve, R.top, _e, We, Pt, Ke]);
2892
- const mr = S(() => {
2893
- if (!G)
2895
+ }, [He, at, ve, R.top, ke, We, Pt, Ke]);
2896
+ const mr = v(() => {
2897
+ if (!Z)
2894
2898
  return null;
2895
- const o = Ue && Ve !== null;
2896
- return /* @__PURE__ */ le("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": o, inert: !o, children: Ve === "up" ? /* @__PURE__ */ le("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ le(
2899
+ const o = Ue && ge !== null;
2900
+ return /* @__PURE__ */ le("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": o, inert: !o, children: ge === "up" ? /* @__PURE__ */ le("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ le(
2897
2901
  "button",
2898
2902
  {
2899
2903
  type: "button",
2900
2904
  className: "aqvs-scroll-to-edge-button",
2901
2905
  tabIndex: o ? 0 : -1,
2902
2906
  onClick: (m) => {
2903
- m.stopPropagation(), we.current = !0, Je(0), Te(!1);
2907
+ m.stopPropagation(), Me.current = !0, Je(0), Te(!1);
2904
2908
  },
2905
2909
  children: "Top"
2906
2910
  }
@@ -2911,38 +2915,38 @@ const jr = 1e4, ln = () => {
2911
2915
  className: "aqvs-scroll-to-edge-button",
2912
2916
  tabIndex: o ? 0 : -1,
2913
2917
  onClick: (m) => {
2914
- m.stopPropagation(), we.current = !0, Je(r - 1), Te(!1);
2918
+ m.stopPropagation(), Me.current = !0, Je(r - 1), Te(!1);
2915
2919
  },
2916
2920
  children: "Bottom"
2917
2921
  }
2918
2922
  ) }) });
2919
- }, [G, Ue, Ve, Je, r]), Yt = g(0), { visibleItems: Bt, renderAnchor: Ht } = Fe(() => {
2923
+ }, [Z, Ue, ge, Je, r]), Yt = g(0), { visibleItems: Bt, renderAnchor: Ht } = Ye(() => {
2920
2924
  if (r === 0)
2921
2925
  return {
2922
2926
  visibleItems: /* @__PURE__ */ le("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ le("div", { className: "aqvs-no-items-text", children: "No items" }) }),
2923
2927
  renderAnchor: 0
2924
2928
  };
2925
- const o = Se(ve, r), c = Se(st, r), { cumulative: m, currentValue: z } = V.prefixSum(o, { materializeOption: { materialize: !1 } }), L = m - z;
2929
+ const o = we(ve, r), u = we(at, r), { cumulative: m, currentValue: A } = V.prefixSum(o, { materializeOption: { materialize: !1 } }), L = m - A;
2926
2930
  Number.isFinite(L) && Math.abs(L - Yt.current) > Gr && (Yt.current = L);
2927
- const F = Yt.current, W = [], re = [];
2928
- let Me = 0, pe = L;
2929
- for (let me = o; me <= c; me++) {
2931
+ const O = Yt.current, F = [], re = [];
2932
+ let Pe = 0, me = L;
2933
+ for (let ue = o; ue <= u; ue++) {
2930
2934
  if (re.length >= lr) {
2931
- w.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: lr, safeRenderingStartIndex: o, safeRenderingEndIndex: c });
2935
+ T.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: lr, safeRenderingStartIndex: o, safeRenderingEndIndex: u });
2932
2936
  break;
2933
2937
  }
2934
- const qe = n(me), ke = V.get(me), Xe = qe - ke;
2935
- Xe !== 0 && W.push({ index: me, value: qe });
2936
- const Vt = pe + Me, qt = t ? t(me) : me;
2938
+ const qe = n(ue), Fe = V.get(ue), Xe = qe - Fe;
2939
+ Xe !== 0 && F.push({ index: ue, value: qe });
2940
+ const Vt = me + Pe, qt = t ? t(ue) : ue;
2937
2941
  re.push(
2938
2942
  /* @__PURE__ */ le(
2939
2943
  tn,
2940
2944
  {
2941
- index: me,
2942
- top: Vt - F,
2945
+ index: ue,
2946
+ top: Vt - O,
2943
2947
  height: qe,
2944
- item: e(me),
2945
- clipItemHeight: Pe,
2948
+ item: e(ue),
2949
+ clipItemHeight: ye,
2946
2950
  enableKeyboardNavigation: N,
2947
2951
  onKeyDown: Jt,
2948
2952
  onFocus: Qt,
@@ -2951,31 +2955,31 @@ const jr = 1e4, ln = () => {
2951
2955
  },
2952
2956
  qt
2953
2957
  )
2954
- ), Me += Xe, pe += ke;
2958
+ ), Pe += Xe, me += Fe;
2955
2959
  }
2956
- return W.length > 0 && Promise.resolve().then(() => {
2957
- if (Ae.current)
2960
+ return F.length > 0 && Promise.resolve().then(() => {
2961
+ if (Le.current)
2958
2962
  return;
2959
- let me = 0;
2960
- for (const Xe of W)
2963
+ let ue = 0;
2964
+ for (const Xe of F)
2961
2965
  if (Xe.index < Ke) {
2962
2966
  const Vt = V.get(Xe.index);
2963
- me += Xe.value - Vt;
2967
+ ue += Xe.value - Vt;
2964
2968
  }
2965
- const qe = V.updates(W);
2966
- if (Ae.current || typeof qe != "number")
2969
+ const qe = V.updates(F);
2970
+ if (Le.current || typeof qe != "number")
2967
2971
  return;
2968
- et(qe), w.debug("[VirtualScroll] Updated heights for items", W, "New total height:", qe);
2969
- const ke = ne.current?.getScrollPosition() ?? ce.current;
2970
- if (me !== 0) {
2971
- const Xe = ke + me;
2972
- xt(Xe), xe(Xe, { immediate: !0 }), w.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: ke, to: Xe, shiftAmount: me });
2973
- } else ke !== ce.current && xe(ke);
2974
- }), { visibleItems: re, renderAnchor: F };
2972
+ et(qe), T.debug("[VirtualScroll] Updated heights for items", F, "New total height:", qe);
2973
+ const Fe = ie.current?.getScrollPosition() ?? ce.current;
2974
+ if (ue !== 0) {
2975
+ const Xe = Fe + ue;
2976
+ xt(Xe, ue), xe(Xe, { immediate: !0 }), T.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: Fe, to: Xe, shiftAmount: ue });
2977
+ } else Fe !== ce.current && xe(Fe);
2978
+ }), { visibleItems: re, renderAnchor: O };
2975
2979
  }, [
2976
2980
  I,
2977
- Pe,
2978
- Be,
2981
+ ye,
2982
+ He,
2979
2983
  N,
2980
2984
  r,
2981
2985
  V,
@@ -2986,26 +2990,26 @@ const jr = 1e4, ln = () => {
2986
2990
  Jt,
2987
2991
  xt,
2988
2992
  mt,
2989
- st,
2993
+ at,
2990
2994
  ve,
2991
2995
  xe,
2992
2996
  Ke
2993
- ]), hr = S(
2997
+ ]), hr = v(
2994
2998
  (o) => {
2995
- const c = (Z ?? 0) > 0, m = Math.abs(o - We), z = c && m > 0.5 ? We : o, L = je(z, R.top);
2996
- if (w.debug("[VirtualScroll] Rendering visible items", () => ({
2999
+ const u = (J ?? 0) > 0, m = Math.abs(o - We), A = u && m > 0.5 ? We : o, L = je(A, R.top);
3000
+ if (T.debug("[VirtualScroll] Rendering visible items", () => ({
2997
3001
  currentScrollPosition: o,
2998
3002
  effectiveScrollPosition: L,
2999
3003
  renderingStartIndex: ve,
3000
- renderingEndIndex: st,
3004
+ renderingEndIndex: at,
3001
3005
  itemCount: r,
3002
- viewportSize: X,
3003
- callbackThrottleMs: Z,
3006
+ viewportSize: H,
3007
+ callbackThrottleMs: J,
3004
3008
  diff: m,
3005
- rawEffectiveScrollPosition: z
3009
+ rawEffectiveScrollPosition: A
3006
3010
  })), r === 0)
3007
3011
  return Bt;
3008
- const F = R.top + Ht - z, W = R.bottom > 0 ? /* @__PURE__ */ le(
3012
+ const O = R.top + Ht - A, F = R.bottom > 0 ? /* @__PURE__ */ le(
3009
3013
  "div",
3010
3014
  {
3011
3015
  className: "aqvs-bottom-inset",
@@ -3017,98 +3021,98 @@ const jr = 1e4, ln = () => {
3017
3021
  },
3018
3022
  "virtualscroll-bottom-inset"
3019
3023
  ) : null;
3020
- return w.debug("[VirtualScroll] Rendering items", () => ({
3021
- containerTop: F,
3022
- logicalScrollPosition: ie,
3024
+ return T.debug("[VirtualScroll] Rendering items", () => ({
3025
+ containerTop: O,
3026
+ logicalScrollPosition: se,
3023
3027
  resolvedInsets: R,
3024
3028
  effectiveScrollPosition: L
3025
- })), /* @__PURE__ */ wt("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
3029
+ })), /* @__PURE__ */ Tt("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${O}px)`, willChange: "transform" }, children: [
3026
3030
  Bt,
3027
- W
3031
+ F
3028
3032
  ] });
3029
3033
  },
3030
- [Z, r, V, ie, Ht, st, ve, R, We, X, Bt]
3031
- ), er = Fe(
3034
+ [J, r, V, se, Ht, at, ve, R, We, H, Bt]
3035
+ ), er = Ye(
3032
3036
  () => ({
3033
- renderingStartIndex: Re.renderingStartIndex,
3034
- renderingEndIndex: Re.renderingEndIndex,
3035
- visibleStartIndex: Re.visibleStartIndex,
3036
- visibleEndIndex: Re.visibleEndIndex,
3037
- scrollPosition: ie,
3037
+ renderingStartIndex: Ne.renderingStartIndex,
3038
+ renderingEndIndex: Ne.renderingEndIndex,
3039
+ visibleStartIndex: Ne.visibleStartIndex,
3040
+ visibleEndIndex: Ne.visibleEndIndex,
3041
+ scrollPosition: se,
3038
3042
  totalHeight: V.getTotal()
3039
3043
  // contentSize (State) ではなく最新値を反映
3040
3044
  }),
3041
3045
  // contentSize を依存に含めることで、updateItemSize/updates 等で木の総高さが変わった際に
3042
3046
  // (fenwickTree は安定参照のため getTotal() の変化だけでは再計算されない) 総高さを再取得する。
3043
- [Re, ie, V, Be]
3047
+ [Ne, se, V, He]
3044
3048
  );
3045
- H(() => {
3049
+ X(() => {
3046
3050
  he.current = er;
3047
3051
  }, [er]), Zt(
3048
3052
  M,
3049
3053
  () => ({
3050
3054
  getScrollPosition: () => {
3051
- const o = ne.current?.getScrollPosition();
3052
- return typeof o == "number" ? je(o, it.current) : -1;
3055
+ const o = ie.current?.getScrollPosition();
3056
+ return typeof o == "number" ? je(o, ot.current) : -1;
3053
3057
  },
3054
- getContentSize: () => ne.current?.getContentSize() ?? -1,
3055
- getViewportSize: () => ne.current?.getViewportSize() ?? -1,
3058
+ getContentSize: () => ie.current?.getContentSize() ?? -1,
3059
+ getViewportSize: () => ie.current?.getViewportSize() ?? -1,
3056
3060
  scrollTo: x,
3057
3061
  scrollBy: y,
3058
- applyWheel: A,
3062
+ applyWheel: D,
3059
3063
  scrollToIndex: Je,
3060
3064
  getFenwickTreeTotalHeight: () => V.getTotal(),
3061
3065
  getFenwickSize: () => V.getSize(),
3062
- focusItemAtIndex: St,
3066
+ focusItemAtIndex: vt,
3063
3067
  getRange: () => he.current,
3064
3068
  getScrollAnchor: l,
3065
3069
  updateItemSize: Ot
3066
3070
  }),
3067
- [x, y, A, Je, V, St, l, Ot]
3071
+ [x, y, D, Je, V, vt, l, Ot]
3068
3072
  );
3069
3073
  const gr = V.getTotal() + R.top + R.bottom;
3070
3074
  return /* @__PURE__ */ le(
3071
3075
  qr,
3072
3076
  {
3073
- ref: ne,
3077
+ ref: ie,
3074
3078
  contentSize: gr,
3075
3079
  viewportSize: i,
3076
- onViewportSizeChange: ze,
3080
+ onViewportSizeChange: Ae,
3077
3081
  className: a,
3078
- testId: u,
3079
- onScroll: U,
3080
- background: T,
3081
- tapScrollCircleOptions: q,
3082
+ testId: c,
3083
+ onScroll: K,
3084
+ background: w,
3085
+ tapScrollCircleOptions: $,
3082
3086
  inertiaOptions: Ge,
3083
3087
  itemCount: r,
3084
- scrollBarWidth: K,
3088
+ scrollBarWidth: j,
3085
3089
  enableThumbDrag: te,
3086
- enableTrackClick: j,
3087
- enableArrowButtons: _,
3088
- enablePointerDrag: Ee,
3090
+ enableTrackClick: G,
3091
+ enableArrowButtons: Y,
3092
+ enablePointerDrag: Ve,
3089
3093
  pointerDragInputs: Qe,
3090
- renderThumbOverlay: v,
3094
+ renderThumbOverlay: S,
3091
3095
  wheelSpeedMultiplier: De,
3092
3096
  onWheelHorizontal: ae,
3093
3097
  contentInsets: R,
3094
- contentProps: O,
3098
+ contentProps: _,
3095
3099
  visibleStartIndex: Ke,
3096
3100
  visibleEndIndex: Pt,
3097
3101
  renderOverlay: mr,
3098
- initialScrollPosition: J.position,
3102
+ initialScrollPosition: Q.position,
3099
3103
  children: hr
3100
3104
  }
3101
3105
  );
3102
3106
  }, un = Gt(rn);
3103
3107
  export {
3104
- vt as FenwickMapTree,
3108
+ St as FenwickMapTree,
3105
3109
  _r as ScrollBar,
3106
3110
  qr as ScrollPane,
3107
3111
  fr as TAP_SCROLL_SPEED_DEFAULTS,
3108
3112
  un as VirtualScroll,
3109
3113
  Or as computeAutoTapScrollMaxSpeedMultiplier,
3110
3114
  Lr as computeTapScrollSpeed,
3111
- se as minmax,
3115
+ oe as minmax,
3112
3116
  an as tapScrollCircleSampleVisual,
3113
3117
  Wr as useFenwickMapTree,
3114
3118
  ln as useHeightCache,