@aiquants/virtualscroll 2.3.0 → 2.5.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 ot, jsxs as Te, Fragment as tr } from "react/jsx-runtime";
2
- import nr, { memo as ir, forwardRef as $e, useState as re, useRef as x, useCallback as S, useImperativeHandle as Ue, useMemo as Ft, useLayoutEffect as Me, useEffect as Y, useId as sr } from "react";
3
- import { twMerge as ye } from "tailwind-merge";
4
- class N {
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";
3
+ import { twMerge as Rt } from "tailwind-merge";
4
+ class w {
5
5
  level;
6
6
  prefix;
7
7
  impl;
@@ -11,18 +11,18 @@ class N {
11
11
  * @param {string} [prefix="[virtualscroll]"] - The prefix to add to all log messages.
12
12
  * @param {ILogger} [impl=console] - The implementation to use for logging.
13
13
  */
14
- constructor(t = 2, e = "[virtualscroll]", n = console) {
15
- this.level = t, this.prefix = e, this.impl = n;
14
+ constructor(e = 2, t = "[virtualscroll]", n = console) {
15
+ this.level = e, this.prefix = t, this.impl = n;
16
16
  }
17
- static instance = new N(2, "[virtualscroll]");
17
+ static instance = new w(2, "[virtualscroll]");
18
18
  /**
19
19
  * @method setLevel
20
20
  * @description Updates the current log level for the static instance.
21
21
  * @description 静的インスタンスの現在のログレベルを更新します。
22
22
  * @param {LogLevel} level - The new log level.
23
23
  */
24
- static setLevel(t) {
25
- N.instance.setLevel(t);
24
+ static setLevel(e) {
25
+ w.instance.setLevel(e);
26
26
  }
27
27
  /**
28
28
  * @method setLevel
@@ -30,8 +30,8 @@ class N {
30
30
  * @description 現在のログレベルを更新します。
31
31
  * @param {LogLevel} level - The new log level.
32
32
  */
33
- setLevel(t) {
34
- this.level = t;
33
+ setLevel(e) {
34
+ this.level = e;
35
35
  }
36
36
  /**
37
37
  * @method setImplementation
@@ -39,8 +39,8 @@ class N {
39
39
  * @description 静的インスタンスのロガーの実装を更新します。
40
40
  * @param {ILogger} impl - The new logger implementation.
41
41
  */
42
- static setImplementation(t) {
43
- N.instance.setImplementation(t);
42
+ static setImplementation(e) {
43
+ w.instance.setImplementation(e);
44
44
  }
45
45
  /**
46
46
  * @method setImplementation
@@ -48,8 +48,8 @@ class N {
48
48
  * @description ロガーの実装を更新します。
49
49
  * @param {ILogger} impl - The new logger implementation.
50
50
  */
51
- setImplementation(t) {
52
- this.impl = t;
51
+ setImplementation(e) {
52
+ this.impl = e;
53
53
  }
54
54
  /**
55
55
  * @method setPrefix
@@ -57,8 +57,8 @@ class N {
57
57
  * @description 静的インスタンスのログのプレフィックスを更新します。
58
58
  * @param {string} prefix - The new prefix.
59
59
  */
60
- static setPrefix(t) {
61
- N.instance.setPrefix(t);
60
+ static setPrefix(e) {
61
+ w.instance.setPrefix(e);
62
62
  }
63
63
  /**
64
64
  * @method setPrefix
@@ -66,8 +66,8 @@ class N {
66
66
  * @description ログのプレフィックスを更新します。
67
67
  * @param {string} prefix - The new prefix.
68
68
  */
69
- setPrefix(t) {
70
- this.prefix = t;
69
+ setPrefix(e) {
70
+ this.prefix = e;
71
71
  }
72
72
  /**
73
73
  * @method isEnabled
@@ -76,8 +76,8 @@ class N {
76
76
  * @param {LogLevel} level - The level to query. / 問い合わせるレベル。
77
77
  * @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
78
78
  */
79
- static isEnabled(t) {
80
- return N.instance.isEnabled(t);
79
+ static isEnabled(e) {
80
+ return w.instance.isEnabled(e);
81
81
  }
82
82
  /**
83
83
  * @method isEnabled
@@ -90,8 +90,8 @@ class N {
90
90
  * @param {LogLevel} level - The level to query. / 問い合わせるレベル。
91
91
  * @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
92
92
  */
93
- isEnabled(t) {
94
- return this.level <= t;
93
+ isEnabled(e) {
94
+ return this.level <= e;
95
95
  }
96
96
  /**
97
97
  * Resolves a possibly-lazy log argument.
@@ -109,66 +109,66 @@ class N {
109
109
  * ログ呼び出しが呼び出し元をクラッシュさせないよう元の関数値をそのまま返す (握り潰さず出力は残る)。
110
110
  * 関数を値としてログしたい場合は `() => fn` とラップする。非関数値はそのまま素通しするため後方互換。
111
111
  */
112
- static resolveLazy(t) {
113
- if (typeof t != "function")
114
- return t;
112
+ static resolveLazy(e) {
113
+ if (typeof e != "function")
114
+ return e;
115
115
  try {
116
- return t();
116
+ return e();
117
117
  } catch {
118
- return t;
118
+ return e;
119
119
  }
120
120
  }
121
- formatMessage(t) {
122
- return typeof t == "string" ? [`${this.prefix} ${t}`] : [this.prefix, t];
121
+ formatMessage(e) {
122
+ return typeof e == "string" ? [`${this.prefix} ${e}`] : [this.prefix, e];
123
123
  }
124
- static debug(t, ...e) {
125
- N.instance.debug(t, ...e);
124
+ static debug(e, ...t) {
125
+ w.instance.debug(e, ...t);
126
126
  }
127
- debug(t, ...e) {
128
- this.level <= 0 && this.impl.debug(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
127
+ debug(e, ...t) {
128
+ this.level <= 0 && this.impl.debug(...this.formatMessage(w.resolveLazy(e)), ...t.map(w.resolveLazy));
129
129
  }
130
- static info(t, ...e) {
131
- N.instance.info(t, ...e);
130
+ static info(e, ...t) {
131
+ w.instance.info(e, ...t);
132
132
  }
133
- info(t, ...e) {
134
- this.level <= 1 && this.impl.info(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
133
+ info(e, ...t) {
134
+ this.level <= 1 && this.impl.info(...this.formatMessage(w.resolveLazy(e)), ...t.map(w.resolveLazy));
135
135
  }
136
- static warn(t, ...e) {
137
- N.instance.warn(t, ...e);
136
+ static warn(e, ...t) {
137
+ w.instance.warn(e, ...t);
138
138
  }
139
- warn(t, ...e) {
140
- this.level <= 2 && this.impl.warn(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
139
+ warn(e, ...t) {
140
+ this.level <= 2 && this.impl.warn(...this.formatMessage(w.resolveLazy(e)), ...t.map(w.resolveLazy));
141
141
  }
142
- static error(t, ...e) {
143
- N.instance.error(t, ...e);
142
+ static error(e, ...t) {
143
+ w.instance.error(e, ...t);
144
144
  }
145
- error(t, ...e) {
146
- this.level <= 3 && this.impl.error(...this.formatMessage(N.resolveLazy(t)), ...e.map(N.resolveLazy));
145
+ error(e, ...t) {
146
+ this.level <= 3 && this.impl.error(...this.formatMessage(w.resolveLazy(e)), ...t.map(w.resolveLazy));
147
147
  }
148
148
  }
149
- const Ke = {
149
+ const tr = {
150
150
  active: !1,
151
151
  offsetX: 0,
152
152
  offsetY: 0,
153
153
  distance: 0,
154
154
  direction: 0,
155
155
  pointerId: null
156
- }, ze = 6, or = 8, ar = ({ dragState: r, normalizedDistance: t }) => {
157
- const e = 1 + t * 0.18, n = 0.16 + t * 0.24, i = 0.38 + t * 0.28, s = r.active ? "80ms ease-out" : "220ms ease";
158
- return /* @__PURE__ */ Te(tr, { children: [
159
- /* @__PURE__ */ ot(
156
+ }, Xt = 6, vr = 8, Sr = ({ dragState: r, normalizedDistance: e }) => {
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: [
159
+ /* @__PURE__ */ le(
160
160
  "div",
161
161
  {
162
162
  className: "aqvs-tap-scroll-circle-visual-outer",
163
163
  style: {
164
164
  background: "linear-gradient(140deg, rgba(255,255,255,0.62), rgba(72,72,72,0.48))",
165
165
  boxShadow: `0 0 0 1px rgba(255,255,255,0.28), 0 10px 22px rgba(0,0,0,${n})`,
166
- transform: `scale(${e})`,
166
+ transform: `scale(${t})`,
167
167
  transition: `${s}, ${r.active ? "80ms" : "260ms"} box-shadow ease`
168
168
  }
169
169
  }
170
170
  ),
171
- /* @__PURE__ */ ot(
171
+ /* @__PURE__ */ le(
172
172
  "div",
173
173
  {
174
174
  className: "aqvs-tap-scroll-circle-inner",
@@ -181,159 +181,159 @@ const Ke = {
181
181
  }
182
182
  )
183
183
  ] });
184
- }, er = ir(
185
- $e(({ onDragChange: r, className: t, maxVisualDistance: e = 160, size: n = 40, style: i, opacity: s = 1, renderVisual: l }, c) => {
186
- const [d, b] = re(Ke), I = x(null), v = x(null), C = x({ x: 0, y: 0 }), p = x(null), V = x(0), z = S(
187
- (T) => {
188
- b(T), r(T);
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);
189
189
  },
190
190
  [r]
191
- ), W = S(
192
- (T, q, H = !1) => {
193
- const { x: Ht, y: Dt } = C.current, et = T - Ht, nt = q - Dt, G = Math.abs(nt), J = G < ze ? 0 : nt < 0 ? -1 : 1, vt = V.current;
194
- let Lt = J;
195
- const jt = ze + or;
196
- J === 0 ? vt !== 0 && G < jt ? Lt = vt : (Lt = 0, H || (V.current = 0)) : J !== vt && vt !== 0 && G < jt ? Lt = vt : V.current = J, z({
197
- active: H || G >= ze,
198
- offsetX: et,
199
- offsetY: nt,
200
- distance: G,
201
- direction: Lt,
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,
198
+ offsetX: De,
199
+ offsetY: Ge,
200
+ distance: Pe,
201
+ direction: $e,
202
202
  pointerId: I.current
203
203
  });
204
204
  },
205
- [z]
206
- ), at = S((T) => {
207
- if (T === null)
205
+ [Z]
206
+ ), ue = S((v) => {
207
+ if (v === null)
208
208
  return;
209
- const q = p.current;
210
- q?.hasPointerCapture(T) && q.releasePointerCapture(T);
211
- }, []), Q = S(
212
- (T = !1) => {
213
- T && at(I.current), I.current = null, v.current = null, V.current = 0, z(Ke);
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);
214
214
  },
215
- [z, at]
216
- ), tt = S(
217
- (T) => {
218
- if (I.current !== null && I.current !== T.pointerId) {
219
- v.current = { pointerId: T.pointerId, clientX: T.clientX, clientY: T.clientY }, T.preventDefault(), T.stopPropagation();
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();
220
220
  return;
221
221
  }
222
- T.preventDefault(), T.stopPropagation();
223
- const q = p.current ?? T.currentTarget, { left: H, top: Ht, width: Dt, height: et } = q.getBoundingClientRect();
224
- C.current = { x: H + Dt / 2, y: Ht + et / 2 }, I.current = T.pointerId;
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;
225
225
  try {
226
- q.setPointerCapture(T.pointerId);
226
+ q.setPointerCapture(v.pointerId);
227
227
  } catch {
228
228
  }
229
- W(T.clientX, T.clientY, !0);
229
+ Y(v.clientX, v.clientY, !0);
230
230
  },
231
- [W]
232
- ), xt = S(
233
- (T) => {
234
- if (I.current !== T.pointerId) {
235
- v.current !== null && v.current.pointerId === T.pointerId && (v.current = { pointerId: T.pointerId, clientX: T.clientX, clientY: T.clientY });
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 });
236
236
  return;
237
237
  }
238
- T.preventDefault(), W(T.clientX, T.clientY);
238
+ v.preventDefault(), Y(v.clientX, v.clientY);
239
239
  },
240
- [W]
241
- ), Et = S(
242
- (T) => {
243
- if (I.current !== T.pointerId) {
244
- v.current !== null && v.current.pointerId === T.pointerId && (v.current = null);
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);
245
245
  return;
246
246
  }
247
- T.preventDefault(), T.stopPropagation();
248
- const q = v.current;
249
- if (v.current = null, q !== null) {
250
- at(T.pointerId);
251
- const H = p.current;
252
- let Ht = !0;
253
- if (H !== null && typeof H.setPointerCapture == "function")
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;
252
+ let Qe = !0;
253
+ if (Ee !== null && typeof Ee.setPointerCapture == "function")
254
254
  try {
255
- H.setPointerCapture(q.pointerId);
256
- } catch (Dt) {
257
- (typeof Dt == "object" && Dt !== null && "name" in Dt ? Dt.name : void 0) === "NotFoundError" && (Ht = !1);
255
+ Ee.setPointerCapture(q.pointerId);
256
+ } catch (N) {
257
+ (typeof N == "object" && N !== null && "name" in N ? N.name : void 0) === "NotFoundError" && (Qe = !1);
258
258
  }
259
- if (Ht) {
260
- I.current = q.pointerId, W(q.clientX, q.clientY, !0);
259
+ if (Qe) {
260
+ I.current = q.pointerId, Y(q.clientX, q.clientY, !0);
261
261
  return;
262
262
  }
263
263
  }
264
- Q(!0);
264
+ de(!0);
265
265
  },
266
- [Q, at, W]
267
- ), A = S(
268
- (T) => {
269
- T.target === T.currentTarget && I.current === T.pointerId && Q(!1);
266
+ [de, ue, Y]
267
+ ), P = S(
268
+ (v) => {
269
+ v.target === v.currentTarget && I.current === v.pointerId && de(!1);
270
270
  },
271
- [Q]
271
+ [de]
272
272
  );
273
- Ue(
274
- c,
273
+ Zt(
274
+ u,
275
275
  () => ({
276
276
  reset: () => {
277
- Q(!0);
277
+ de(!0);
278
278
  },
279
- getElement: () => p.current
279
+ getElement: () => h.current
280
280
  }),
281
- [Q]
281
+ [de]
282
282
  );
283
- const O = Math.min(Math.max(s, 0), 1), P = n / 64, U = Math.min(d.distance, e) / e, Z = d.direction * U * 10 * P, w = l ?? ar, lt = {
284
- dragState: d,
285
- normalizedDistance: U,
286
- sizeScale: P,
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, _ = {
284
+ dragState: p,
285
+ normalizedDistance: K,
286
+ sizeScale: M,
287
287
  size: n,
288
288
  opacity: O
289
- }, j = {
289
+ }, G = {
290
290
  ...i,
291
291
  width: n,
292
292
  height: n,
293
- transform: `translateY(${Z}px)`
293
+ transform: `translateY(${te}px)`
294
294
  };
295
- return j.opacity = O, /* @__PURE__ */ ot(
295
+ return G.opacity = O, /* @__PURE__ */ le(
296
296
  "div",
297
297
  {
298
- ref: p,
298
+ ref: h,
299
299
  "data-testid": "virtual-scroll-tap-circle",
300
- className: ye("aqvs-tap-scroll-circle", t),
301
- style: j,
300
+ className: Rt("aqvs-tap-scroll-circle", e),
301
+ style: G,
302
302
  tabIndex: -1,
303
- onPointerDown: tt,
304
- onPointerMove: xt,
305
- onPointerUp: Et,
306
- onPointerCancel: Et,
307
- onLostPointerCapture: A,
303
+ onPointerDown: oe,
304
+ onPointerMove: ae,
305
+ onPointerUp: fe,
306
+ onPointerCancel: fe,
307
+ onLostPointerCapture: P,
308
308
  role: "presentation",
309
- children: w(lt)
309
+ children: j(_)
310
310
  }
311
311
  );
312
312
  })
313
313
  );
314
- er.displayName = "TapScrollCircle";
315
- const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scroll-cancel", We = 20, lr = 250, cr = 60, ur = 20, dr = 20, rr = {
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 = {
316
316
  /** 速度が最大に達する引き距離 (px)。`maxVisualDistance` の既定値。 */
317
317
  maxDistance: 240,
318
318
  /** 最小速度倍率 (ビューポート比)。 */
319
319
  minSpeedMultiplier: 0.2
320
- }, fr = rr.maxDistance, je = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, Ye = 2.2, mr = 8, pr = 120, hr = 1 / 10, ee = {
320
+ }, yr = fr.maxDistance, nr = { active: !1, offsetX: 0, offsetY: 0, distance: 0, direction: 0, pointerId: null }, $t = 2.2, Rr = 8, Er = 120, Nr = 1 / 10, ut = {
321
321
  enabled: !0,
322
322
  size: 40,
323
323
  offsetX: -80,
324
324
  offsetY: 0,
325
325
  className: void 0,
326
- maxVisualDistance: fr,
327
- minSpeedMultiplier: rr.minSpeedMultiplier,
326
+ maxVisualDistance: yr,
327
+ minSpeedMultiplier: fr.minSpeedMultiplier,
328
328
  opacity: 0.9,
329
329
  renderVisual: void 0,
330
330
  maxSpeedCurve: void 0
331
- }, gr = (r) => r ? {
331
+ }, Vr = (r) => r ? {
332
332
  mainSizeKey: "width",
333
333
  crossSizeKey: "height",
334
334
  positionKey: "left",
335
- selectDelta: (t, e) => t,
336
- getPointerCoordinate: ({ clientX: t }) => t,
335
+ selectDelta: (e, t) => e,
336
+ getPointerCoordinate: ({ clientX: e }) => e,
337
337
  arrowLabels: ["Scroll left", "Scroll right"],
338
338
  arrowIcons: ["◀", "▶"],
339
339
  directionClass: "aqvs-scrollbar-horizontal",
@@ -342,199 +342,199 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
342
342
  mainSizeKey: "height",
343
343
  crossSizeKey: "width",
344
344
  positionKey: "top",
345
- selectDelta: (t, e) => e,
346
- getPointerCoordinate: ({ clientY: t }) => t,
345
+ selectDelta: (e, t) => t,
346
+ getPointerCoordinate: ({ clientY: e }) => e,
347
347
  arrowLabels: ["Scroll up", "Scroll down"],
348
348
  arrowIcons: ["▲", "▼"],
349
349
  directionClass: "aqvs-scrollbar-vertical",
350
350
  orientation: "vertical"
351
- }, br = (r, t) => {
352
- const e = r?.maxSpeedMultiplier, n = typeof e == "number" ? e : vr(t);
351
+ }, Cr = (r, e) => {
352
+ const t = r?.maxSpeedMultiplier, n = typeof t == "number" ? t : Or(e);
353
353
  return {
354
- enabled: r?.enabled ?? ee.enabled,
355
- size: r?.size ?? ee.size,
356
- offsetX: r?.offsetX ?? ee.offsetX,
357
- offsetY: r?.offsetY ?? ee.offsetY,
358
- className: r?.className ?? ee.className,
359
- maxVisualDistance: r?.maxVisualDistance ?? ee.maxVisualDistance,
354
+ enabled: r?.enabled ?? ut.enabled,
355
+ size: r?.size ?? ut.size,
356
+ offsetX: r?.offsetX ?? ut.offsetX,
357
+ offsetY: r?.offsetY ?? ut.offsetY,
358
+ className: r?.className ?? ut.className,
359
+ maxVisualDistance: r?.maxVisualDistance ?? ut.maxVisualDistance,
360
360
  maxSpeedMultiplier: n,
361
- minSpeedMultiplier: Math.max(r?.minSpeedMultiplier ?? ee.minSpeedMultiplier, 0),
362
- opacity: rt(r?.opacity ?? ee.opacity, 0, 1),
363
- renderVisual: r?.renderVisual ?? ee.renderVisual,
364
- maxSpeedCurve: r?.maxSpeedCurve ?? ee.maxSpeedCurve
361
+ minSpeedMultiplier: Math.max(r?.minSpeedMultiplier ?? ut.minSpeedMultiplier, 0),
362
+ opacity: se(r?.opacity ?? ut.opacity, 0, 1),
363
+ renderVisual: r?.renderVisual ?? ut.renderVisual,
364
+ maxSpeedCurve: r?.maxSpeedCurve ?? ut.maxSpeedCurve
365
365
  };
366
- }, xr = ({ isDragging: r, isThumbHovered: t, enableThumbDrag: e }) => Ft(() => e ? r ? "dragging" : t ? "hover" : "idle" : "disabled", [e, r, t]), Ir = ({ canUseArrowButtons: r, enableArrowButtons: t, resetTapScroll: e, scrollByStep: n }) => {
367
- const i = x(null), s = x(null), l = x(null), c = S(() => {
368
- i.current !== null && (window.clearInterval(i.current), i.current = null), s.current !== null && (window.clearTimeout(s.current), s.current = null), l.current !== null && (window.removeEventListener("pointerup", l.current), window.removeEventListener("pointercancel", l.current), window.removeEventListener("blur", l.current), l.current = null);
369
- }, []), d = S(() => {
370
- c();
371
- }, [c]), b = S(
372
- (v) => (C) => {
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(() => {
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) => {
373
373
  if (!r)
374
374
  return;
375
- C.cancelable && C.preventDefault(), C.stopPropagation(), e(), c(), n(v), s.current = window.setTimeout(() => {
375
+ C.cancelable && C.preventDefault(), C.stopPropagation(), t(), u(), n(T), s.current = window.setTimeout(() => {
376
376
  i.current = window.setInterval(() => {
377
- n(v);
378
- }, cr);
379
- }, lr);
380
- const p = () => c();
381
- l.current = p, window.addEventListener("pointerup", p), window.addEventListener("pointercancel", p), window.addEventListener("blur", p);
377
+ n(T);
378
+ }, wr);
379
+ }, Tr);
380
+ const h = () => u();
381
+ a.current = h, window.addEventListener("pointerup", h), window.addEventListener("pointercancel", h), window.addEventListener("blur", h);
382
382
  },
383
- [r, c, e, n]
383
+ [r, u, t, n]
384
384
  ), I = S(
385
- (v) => (C) => {
386
- t && (C.key === "Enter" || C.key === " " || C.key === "Spacebar") && (C.preventDefault(), n(v));
385
+ (T) => (C) => {
386
+ e && (C.key === "Enter" || C.key === " " || C.key === "Spacebar") && (C.preventDefault(), n(T));
387
387
  },
388
- [t, n]
388
+ [e, n]
389
389
  );
390
- return Y(() => {
391
- r || c();
392
- }, [r, c]), Y(() => () => {
393
- c();
394
- }, [c]), { handleArrowPointerDown: b, handleArrowPointerUp: d, handleArrowKeyDown: I };
395
- }, Tr = 700, he = (r, t) => typeof r == "number" && Number.isFinite(r) ? r : t, Sr = ({ distance: r, maxDistance: t, viewportSize: e, minSpeedMultiplier: n, maxSpeedMultiplier: i, hasCustomMaxSpeedMultiplier: s, curve: l }) => {
396
- const c = Math.max(he(r, 0), 0), d = he(t, 0), b = d > 0 ? Math.min(c, d) / d : 1, I = Math.max(he(e, 0), 0), v = Math.max(he(n, 0), 0), C = Math.max(he(i, 0), 0), p = Math.max(I * v, 40), V = s ? p : 1200, z = Math.max(I * C, V), W = l ? Math.max(he(l.exponentialScale, C), 0) : 0, at = l ? Math.min(z, Math.max(I * W, p)) : z, Q = Math.max(at, p);
397
- let tt = b ** 1.1;
398
- if (l) {
399
- const Et = Math.min(Math.max(he(l.exponentialSteepness, 0), 0), Tr);
400
- if (Et === 0)
401
- tt = b;
390
+ return H(() => {
391
+ r || u();
392
+ }, [r, u]), H(() => () => {
393
+ u();
394
+ }, [u]), { handleArrowPointerDown: b, handleArrowPointerUp: p, handleArrowKeyDown: I };
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;
398
+ if (a) {
399
+ const fe = Math.min(Math.max(It(a.exponentialSteepness, 0), 0), Ar);
400
+ if (fe === 0)
401
+ oe = b;
402
402
  else {
403
- const A = Math.expm1(Et) || 1;
404
- tt = Math.min(Math.max(Math.expm1(Et * b) / A, 0), 1);
403
+ const P = Math.expm1(fe) || 1;
404
+ oe = Math.min(Math.max(Math.expm1(fe * b) / P, 0), 1);
405
405
  }
406
406
  }
407
- const xt = Math.min(Math.max(he(l?.easedOffset, 0), 0), 1);
408
- return p + (Q - p) * (xt + (1 - xt) * tt);
409
- }, vr = (r) => {
407
+ const ae = Math.min(Math.max(It(a?.easedOffset, 0), 0), 1);
408
+ return h + (de - h) * (ae + (1 - ae) * oe);
409
+ }, Or = (r) => {
410
410
  if (!r || r <= 0)
411
- return Ye;
412
- const t = Math.max(1, r), e = Math.log10(t), n = Ye + e * mr;
413
- return rt(n, Ye, pr);
414
- }, Pr = ({
411
+ return $t;
412
+ const e = Math.max(1, r), t = Math.log10(e), n = $t + t * Rr;
413
+ return se(n, $t, Er);
414
+ }, _r = ({
415
415
  contentSize: r,
416
- viewportSize: t,
417
- scrollPosition: e,
416
+ viewportSize: e,
417
+ scrollPosition: t,
418
418
  onScroll: n,
419
419
  enableThumbDrag: i = !0,
420
420
  enableTrackClick: s = !0,
421
- enableArrowButtons: l = !0,
422
- horizontal: c = !1,
423
- scrollBarWidth: d = 12,
421
+ enableArrowButtons: a = !0,
422
+ horizontal: u = !1,
423
+ scrollBarWidth: p = 12,
424
424
  className: b,
425
425
  ariaControls: I,
426
- tapScrollCircleOptions: v,
426
+ tapScrollCircleOptions: T,
427
427
  itemCount: C,
428
- renderThumbOverlay: p,
429
- visibleStartIndex: V,
430
- visibleEndIndex: z
428
+ renderThumbOverlay: h,
429
+ visibleStartIndex: D,
430
+ visibleEndIndex: Z
431
431
  }) => {
432
- const [W, at] = re(!1), [Q, tt] = re(!1), [xt, Et] = re(!1), A = x(null), O = x({
432
+ const [Y, ue] = nt(!1), [de, oe] = nt(!1), [ae, fe] = nt(!1), P = g(null), O = 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
- }), P = x({ pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 }), U = x(e), Z = x(n), w = x(je), lt = x(null), j = x(null), T = x(null), q = x(0), H = x(0), Ht = Ft(() => br(v, C), [C, v]), Dt = Ft(() => gr(c), [c]), {
440
- enabled: et,
441
- size: nt,
442
- offsetX: G,
443
- offsetY: J,
444
- className: vt,
445
- maxVisualDistance: Lt,
446
- maxSpeedMultiplier: jt,
447
- minSpeedMultiplier: R,
448
- opacity: de,
449
- renderVisual: it,
450
- maxSpeedCurve: E
451
- } = Ht, Vt = x({
452
- viewportSize: t,
453
- maxScrollPosition: Math.max(r - t, 0),
454
- scrollBarVisible: r > t,
455
- effectiveTapMaxDistance: Math.max(Lt, 1),
456
- tapCircleMaxSpeedMultiplier: jt,
457
- tapCircleMinSpeedMultiplier: R,
458
- tapCircleMaxSpeedCurve: E,
459
- tapScrollCircleOptions: v,
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]), {
440
+ enabled: De,
441
+ size: Ge,
442
+ offsetX: Pe,
443
+ offsetY: Ne,
444
+ className: Ze,
445
+ maxVisualDistance: $e,
446
+ maxSpeedMultiplier: X,
447
+ minSpeedMultiplier: ze,
448
+ opacity: ne,
449
+ renderVisual: he,
450
+ maxSpeedCurve: Ye
451
+ } = Qe, Ae = g({
452
+ viewportSize: e,
453
+ maxScrollPosition: Math.max(r - e, 0),
454
+ scrollBarVisible: r > e,
455
+ effectiveTapMaxDistance: Math.max($e, 1),
456
+ tapCircleMaxSpeedMultiplier: X,
457
+ tapCircleMinSpeedMultiplier: ze,
458
+ tapCircleMaxSpeedCurve: Ye,
459
+ tapScrollCircleOptions: T,
460
460
  effectiveTrackLength: 0,
461
461
  onScroll: n,
462
- scrollPosition: e
463
- }), { mainSizeKey: zt, crossSizeKey: Jt, positionKey: $t, selectDelta: h, getPointerCoordinate: k, arrowLabels: gt, arrowIcons: X, directionClass: Pt, orientation: ct } = Dt, It = Math.max(Lt, 1), Mt = t / r, yt = Math.max(t - d * 2, 0), ut = Mt * yt, At = Math.min(Math.max(We, ut || 0), yt || We), dt = r - t, st = Math.max(yt - At, 0), _t = dt <= 0 || st <= 0 ? 0 : rt(e / dt * st, 0, st), Xt = _t + At / 2, Nt = r > t || W, ne = Nt && l;
464
- Me(() => {
465
- Vt.current = {
466
- viewportSize: t,
467
- maxScrollPosition: dt,
468
- scrollBarVisible: Nt,
469
- effectiveTapMaxDistance: It,
470
- tapCircleMaxSpeedMultiplier: jt,
471
- tapCircleMinSpeedMultiplier: R,
472
- tapCircleMaxSpeedCurve: E,
473
- tapScrollCircleOptions: v,
474
- effectiveTrackLength: st,
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 = {
466
+ viewportSize: e,
467
+ maxScrollPosition: k,
468
+ scrollBarVisible: ee,
469
+ effectiveTapMaxDistance: et,
470
+ tapCircleMaxSpeedMultiplier: X,
471
+ tapCircleMinSpeedMultiplier: ze,
472
+ tapCircleMaxSpeedCurve: Ye,
473
+ tapScrollCircleOptions: T,
474
+ effectiveTrackLength: B,
475
475
  onScroll: n,
476
- scrollPosition: e
476
+ scrollPosition: t
477
477
  };
478
- }), Me(() => {
479
- U.current = e;
480
- }, [e]), Me(() => {
481
- Z.current = n;
482
- }, [n]), Y(() => {
483
- i || tt(!1);
478
+ }), ot(() => {
479
+ K.current = t;
480
+ }, [t]), ot(() => {
481
+ te.current = n;
482
+ }, [n]), H(() => {
483
+ i || oe(!1);
484
484
  }, [i]);
485
- const Gt = xr({ isDragging: W, isThumbHovered: Q, enableThumbDrag: i }), Ct = S((o, g) => {
486
- const y = Vt.current, L = g ?? U.current;
487
- if (Z.current) {
488
- const Yt = Z.current(o, L);
489
- if (typeof Yt == "number" && Number.isFinite(Yt))
490
- return U.current = Yt, Yt;
485
+ const Ve = Dr({ isDragging: Y, isThumbHovered: de, enableThumbDrag: i }), Ce = S((l, x) => {
486
+ const y = Ae.current, A = x ?? K.current;
487
+ if (te.current) {
488
+ const ve = te.current(l, A);
489
+ if (typeof ve == "number" && Number.isFinite(ve))
490
+ return K.current = ve, ve;
491
491
  }
492
- const B = typeof o == "function" ? o(L) : o, bt = Math.max(y.maxScrollPosition, 0), Ot = y.scrollBarVisible ? rt(B, 0, bt) : 0;
493
- return U.current = Ot, Ot;
494
- }, []), f = S(
495
- (o) => {
496
- const g = Vt.current, y = U.current;
497
- if (!g.scrollBarVisible || g.maxScrollPosition <= 0) {
498
- const ue = Ct(0, y), a = ue - y;
499
- return { nextPosition: ue, actualDelta: a, reachedBoundary: !0 };
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(
495
+ (l) => {
496
+ const x = Ae.current, y = K.current;
497
+ if (!x.scrollBarVisible || x.maxScrollPosition <= 0) {
498
+ const Ke = Ce(0, y), Pt = Ke - y;
499
+ return { nextPosition: Ke, actualDelta: Pt, reachedBoundary: !0 };
500
500
  }
501
- if (o === 0)
501
+ if (l === 0)
502
502
  return { nextPosition: y, actualDelta: 0, reachedBoundary: !1 };
503
- const B = Ct((ue) => rt(ue + o, 0, g.maxScrollPosition), y), bt = B - y, Ot = o < 0 && y + o <= 0, Yt = o > 0 && y + o >= g.maxScrollPosition, ve = o < 0 && (B <= 0 || Ot && bt === 0) || o > 0 && (B >= g.maxScrollPosition || Yt && bt === 0);
504
- return { nextPosition: B, actualDelta: bt, reachedBoundary: ve };
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 };
505
505
  },
506
- [Ct]
507
- ), M = S(
508
- (o, g) => {
509
- o.current += g;
510
- const y = Math.max(Vt.current.maxScrollPosition, 0);
511
- y > 0 && (o.current = rt(o.current, -y, y));
512
- const L = f(o.current);
513
- return o.current -= L.actualDelta, L.reachedBoundary && (o.current = 0), L;
506
+ [Ce]
507
+ ), Te = S(
508
+ (l, x) => {
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;
514
514
  },
515
- [f]
516
- ), ft = S(() => {
517
- j.current !== null && (window.cancelAnimationFrame(j.current), j.current = null), T.current = null, q.current = 0, H.current = 0;
518
- }, []), Tt = S(() => {
519
- w.current = { ...je }, Et(!1), lt.current?.reset(), ft();
520
- }, [ft]), wt = S(
521
- (o) => {
522
- const g = w.current, y = Vt.current;
523
- if (!g.active || g.direction === 0) {
524
- ft();
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(
521
+ (l) => {
522
+ const x = j.current, y = Ae.current;
523
+ if (!x.active || x.direction === 0) {
524
+ be();
525
525
  return;
526
526
  }
527
527
  if (!y.scrollBarVisible || y.maxScrollPosition <= 0) {
528
- ft();
528
+ be();
529
529
  return;
530
530
  }
531
- const L = T.current ?? o, B = Math.max((o - L) / 1e3, 0), bt = Math.min(B, hr);
532
- if (T.current = o, bt <= 0) {
533
- j.current = window.requestAnimationFrame(wt);
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);
534
534
  return;
535
535
  }
536
- const Ot = Sr({
537
- distance: g.distance,
536
+ const Re = Lr({
537
+ distance: x.distance,
538
538
  maxDistance: y.effectiveTapMaxDistance,
539
539
  viewportSize: y.viewportSize,
540
540
  minSpeedMultiplier: y.tapCircleMinSpeedMultiplier,
@@ -542,320 +542,320 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
542
542
  hasCustomMaxSpeedMultiplier: typeof y.tapScrollCircleOptions?.maxSpeedMultiplier == "number",
543
543
  curve: y.tapCircleMaxSpeedCurve
544
544
  });
545
- H.current !== g.direction && (H.current = g.direction, q.current = 0);
546
- const { reachedBoundary: Yt } = M(q, g.direction * Ot * bt);
547
- if (Yt) {
548
- ft();
545
+ Ee.current !== x.direction && (Ee.current = x.direction, q.current = 0);
546
+ const { reachedBoundary: ve } = Te(q, x.direction * Re * ie);
547
+ if (ve) {
548
+ be();
549
549
  return;
550
550
  }
551
- j.current = window.requestAnimationFrame(wt);
551
+ G.current = window.requestAnimationFrame(ye);
552
552
  },
553
- [M, ft]
554
- ), ie = S(() => {
555
- j.current === null && (T.current = null, q.current = 0, j.current = window.requestAnimationFrame(wt));
556
- }, [wt]);
557
- Y(() => {
558
- const o = w.current;
559
- !o.active || o.direction === 0 || ie();
560
- }, [r, t, ie]), Y(() => () => {
561
- ft();
562
- }, [ft]);
563
- const Qt = S(
564
- (o) => {
565
- w.current = o, Et(o.active), o.active && o.direction !== 0 ? ie() : ft();
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;
559
+ !l.active || l.direction === 0 || tt();
560
+ }, [r, e, tt]), H(() => () => {
561
+ be();
562
+ }, [be]);
563
+ const rt = S(
564
+ (l) => {
565
+ j.current = l, fe(l.active), l.active && l.direction !== 0 ? tt() : be();
566
566
  },
567
- [ie, ft]
567
+ [tt, be]
568
568
  );
569
- Y(() => {
570
- et || Tt();
571
- }, [Tt, et]), Y(() => {
572
- const o = (g) => {
573
- const L = g.detail?.paneId;
574
- L && I && L !== I || Tt();
569
+ H(() => {
570
+ De || we();
571
+ }, [we, De]), H(() => {
572
+ const l = (x) => {
573
+ const A = x.detail?.paneId;
574
+ A && I && A !== I || we();
575
575
  };
576
- return window.addEventListener(Xe, o), () => {
577
- window.removeEventListener(Xe, o);
576
+ return window.addEventListener(jt, l), () => {
577
+ window.removeEventListener(jt, l);
578
578
  };
579
- }, [I, Tt]), Y(() => {
580
- if (!et)
579
+ }, [I, we]), H(() => {
580
+ if (!De)
581
581
  return;
582
- const o = (g) => {
583
- if (!w.current.active || w.current.pointerId === g.pointerId)
582
+ const l = (x) => {
583
+ if (!j.current.active || j.current.pointerId === x.pointerId)
584
584
  return;
585
- const y = g.target;
585
+ const y = x.target;
586
586
  if (!(y instanceof Node)) {
587
- Tt();
587
+ we();
588
588
  return;
589
589
  }
590
- lt.current?.getElement()?.contains(y) || Tt();
590
+ _.current?.getElement()?.contains(y) || we();
591
591
  };
592
- return document.addEventListener("pointerdown", o, !0), () => {
593
- document.removeEventListener("pointerdown", o, !0);
592
+ return document.addEventListener("pointerdown", l, !0), () => {
593
+ document.removeEventListener("pointerdown", l, !0);
594
594
  };
595
- }, [Tt, et]);
596
- const te = (o) => {
597
- if (!Nt || st <= 0 || dt <= 0)
595
+ }, [we, De]);
596
+ const at = (l) => {
597
+ if (!ee || B <= 0 || k <= 0)
598
598
  return 0;
599
- const g = rt(o, 0, st);
600
- return rt(g / st * dt, 0, dt);
601
- }, Kt = S((o) => {
602
- const { scrollBarVisible: g, effectiveTrackLength: y, maxScrollPosition: L } = Vt.current;
603
- if (N.debug("[ScrollBar] calculateScrollPositionFromThumb", () => ({ thumbPos: o, trackLen: y, maxScroll: L })), y <= 0 || L <= 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)
604
604
  return null;
605
- const B = rt(o, 0, y);
606
- return rt(B / y * L, 0, L);
607
- }, []), se = S(
608
- (o) => {
609
- const g = o.getBoundingClientRect(), y = c ? g.width : g.height, L = (ve) => {
610
- const ue = Number.parseFloat(ve);
611
- return Number.isFinite(ue) ? ue : 0;
612
- }, B = window.getComputedStyle(o), bt = L(c ? B.width : B.height), Ot = bt > 0 ? bt + L(c ? B.paddingLeft : B.paddingTop) + L(c ? B.paddingRight : B.paddingBottom) + L(c ? B.borderLeftWidth : B.borderTopWidth) + L(c ? B.borderRightWidth : B.borderBottomWidth) : 0, Yt = Ot > 0 ? Ot : c ? o.offsetWidth : o.offsetHeight;
613
- return Yt <= 0 || y <= 0 ? 1 : y / Yt;
605
+ const U = se(l, 0, y);
606
+ return se(U / y * A, 0, A);
607
+ }, []), E = S(
608
+ (l) => {
609
+ const x = l.getBoundingClientRect(), y = u ? x.width : x.height, A = (st) => {
610
+ const Ke = Number.parseFloat(st);
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;
613
+ return ve <= 0 || y <= 0 ? 1 : y / ve;
614
614
  },
615
- [c]
616
- ), fe = S(
617
- (o) => {
618
- const g = O.current;
619
- if (g.pointerId !== o.pointerId)
615
+ [u]
616
+ ), Ie = S(
617
+ (l) => {
618
+ const x = O.current;
619
+ if (x.pointerId !== l.pointerId)
620
620
  return;
621
- const y = o.clientX - g.startClientX, L = o.clientY - g.startClientY, B = h(y, L) / (g.scale || 1);
622
- N.debug("[ScrollBar] handleThumbPointerMove", () => ({
623
- delta: B,
624
- startThumbPosition: g.startThumbPosition,
625
- clientY: o.clientY,
626
- startClientY: g.startClientY,
627
- metrics: Vt.current
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,
624
+ startThumbPosition: x.startThumbPosition,
625
+ clientY: l.clientY,
626
+ startClientY: x.startClientY,
627
+ metrics: Ae.current
628
628
  }));
629
- const bt = Kt(g.startThumbPosition + B);
630
- bt !== null && Ct(bt), o.cancelable && o.preventDefault();
629
+ const ie = f(x.startThumbPosition + U);
630
+ ie !== null && Ce(ie), l.cancelable && l.preventDefault();
631
631
  },
632
- [h, Kt, Ct]
633
- ), Zt = S(
634
- (o) => {
635
- const g = O.current;
636
- if (g.pointerId !== o.pointerId)
632
+ [pt, f, Ce]
633
+ ), Oe = S(
634
+ (l) => {
635
+ const x = O.current;
636
+ if (x.pointerId !== l.pointerId)
637
637
  return;
638
- document.removeEventListener("pointermove", fe), document.removeEventListener("pointerup", Zt), document.removeEventListener("pointercancel", Zt);
639
- const y = g.captureTarget;
640
- if (y?.hasPointerCapture?.(o.pointerId) && y.releasePointerCapture(o.pointerId), O.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1, captureTarget: null }, at(!1), A.current) {
641
- const L = A.current.getBoundingClientRect();
642
- o.clientX >= L.left && o.clientX <= L.right && o.clientY >= L.top && o.clientY <= L.bottom || tt(!1);
638
+ document.removeEventListener("pointermove", Ie), document.removeEventListener("pointerup", Oe), document.removeEventListener("pointercancel", Oe);
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);
643
643
  } else
644
- tt(!1);
644
+ oe(!1);
645
645
  },
646
- [fe]
646
+ [Ie]
647
647
  );
648
- Y(() => () => {
649
- document.removeEventListener("pointermove", fe), document.removeEventListener("pointerup", Zt), document.removeEventListener("pointercancel", Zt);
650
- }, [fe, Zt]);
651
- const we = x(0), mt = x(0), me = S(
652
- (o) => {
653
- const g = Math.max(Math.round(Vt.current.viewportSize / dr), ur);
654
- mt.current !== o && (mt.current = o, we.current = 0), M(we, o * g);
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(
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);
655
655
  },
656
- [M]
657
- ), { handleArrowPointerDown: Ce, handleArrowPointerUp: Se, handleArrowKeyDown: Ut } = Ir({
658
- canUseArrowButtons: ne,
659
- enableArrowButtons: l,
660
- resetTapScroll: Tt,
661
- scrollByStep: me
662
- }), Ve = (o) => {
663
- if (!Nt)
656
+ [Te]
657
+ ), { handleArrowPointerDown: mt, handleArrowPointerUp: ct, handleArrowKeyDown: ht } = zr({
658
+ canUseArrowButtons: He,
659
+ enableArrowButtons: a,
660
+ resetTapScroll: we,
661
+ scrollByStep: lt
662
+ }), Mt = (l) => {
663
+ if (!ee)
664
664
  return;
665
665
  if (!i) {
666
- o.preventDefault(), o.stopPropagation();
666
+ l.preventDefault(), l.stopPropagation();
667
667
  return;
668
668
  }
669
- if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
669
+ if (l.pointerType === "mouse" && l.button !== 0 || l.ctrlKey)
670
670
  return;
671
- Tt();
672
- const g = o.currentTarget, y = se(g);
673
- let L = null;
674
- if (g.setPointerCapture)
671
+ we();
672
+ const x = l.currentTarget, y = E(x);
673
+ let A = null;
674
+ if (x.setPointerCapture)
675
675
  try {
676
- g.setPointerCapture(o.pointerId), L = g;
676
+ x.setPointerCapture(l.pointerId), A = x;
677
677
  } catch {
678
- L = null;
678
+ A = null;
679
679
  }
680
680
  O.current = {
681
- pointerId: o.pointerId,
682
- startThumbPosition: _t,
683
- startClientX: o.clientX,
684
- startClientY: o.clientY,
681
+ pointerId: l.pointerId,
682
+ startThumbPosition: ge,
683
+ startClientX: l.clientX,
684
+ startClientY: l.clientY,
685
685
  scale: y,
686
- captureTarget: L
687
- }, document.addEventListener("pointermove", fe), document.addEventListener("pointerup", Zt), document.addEventListener("pointercancel", Zt), at(!0), tt(!0), o.preventDefault(), o.stopPropagation();
688
- }, De = (o) => {
689
- if (!Nt)
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) => {
689
+ if (!ee)
690
690
  return;
691
691
  if (!s) {
692
- o.preventDefault(), o.stopPropagation();
692
+ l.preventDefault(), l.stopPropagation();
693
693
  return;
694
694
  }
695
- if (o.pointerType === "mouse" && o.button !== 0 || o.ctrlKey)
695
+ if (l.pointerType === "mouse" && l.button !== 0 || l.ctrlKey)
696
696
  return;
697
- const g = o.currentTarget, y = g.getBoundingClientRect(), L = k(o), B = se(g), bt = (L - (c ? y.left : y.top)) / B;
698
- Tt();
699
- const Ot = bt - At / 2, Yt = te(Ot);
700
- if (Ct(Yt), g.setPointerCapture)
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)
701
701
  try {
702
- g.setPointerCapture(o.pointerId);
702
+ x.setPointerCapture(l.pointerId);
703
703
  } catch {
704
704
  }
705
- P.current = {
706
- pointerId: o.pointerId,
707
- startThumbPosition: Ot,
708
- startClientX: o.clientX,
709
- startClientY: o.clientY,
710
- scale: B
711
- }, o.preventDefault(), o.stopPropagation();
712
- }, be = () => {
713
- P.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
714
- }, Ae = (o) => {
715
- const g = P.current;
716
- if (g.pointerId !== o.pointerId)
705
+ M.current = {
706
+ pointerId: l.pointerId,
707
+ startThumbPosition: Re,
708
+ startClientX: l.clientX,
709
+ startClientY: l.clientY,
710
+ scale: U
711
+ }, l.preventDefault(), l.stopPropagation();
712
+ }, bt = () => {
713
+ M.current = { pointerId: null, startThumbPosition: 0, startClientX: 0, startClientY: 0, scale: 1 };
714
+ }, At = (l) => {
715
+ const x = M.current;
716
+ if (x.pointerId !== l.pointerId)
717
717
  return;
718
- if (o.pointerType === "mouse" && o.buttons === 0) {
719
- be();
718
+ if (l.pointerType === "mouse" && l.buttons === 0) {
719
+ bt();
720
720
  return;
721
721
  }
722
- const y = o.clientX - g.startClientX, L = o.clientY - g.startClientY, B = h(y, L) / (g.scale || 1), bt = te(g.startThumbPosition + B);
723
- Ct(bt), o.cancelable && o.preventDefault();
724
- }, ke = (o) => {
725
- if (P.current.pointerId !== o.pointerId)
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();
724
+ }, xe = (l) => {
725
+ if (M.current.pointerId !== l.pointerId)
726
726
  return;
727
- const g = o.currentTarget;
728
- g.hasPointerCapture?.(o.pointerId) && g.releasePointerCapture(o.pointerId), be(), o.preventDefault(), o.stopPropagation();
729
- }, oe = (o) => {
730
- if (P.current.pointerId !== o.pointerId)
727
+ const x = l.currentTarget;
728
+ x.hasPointerCapture?.(l.pointerId) && x.releasePointerCapture(l.pointerId), bt(), l.preventDefault(), l.stopPropagation();
729
+ }, xt = (l) => {
730
+ if (M.current.pointerId !== l.pointerId)
731
731
  return;
732
- const g = o.currentTarget;
733
- g.hasPointerCapture?.(o.pointerId) && g.releasePointerCapture(o.pointerId), be();
734
- }, pe = (o) => {
735
- o.target === o.currentTarget && P.current.pointerId === o.pointerId && be();
736
- }, ae = Ft(() => rt((xt ? 1 : 0.8) * de, 0, 1), [xt, de]), le = Ft(() => {
737
- const g = `calc(50% - ${nt / 2}px + ${J}px)`;
732
+ const x = l.currentTarget;
733
+ x.hasPointerCapture?.(l.pointerId) && x.releasePointerCapture(l.pointerId), bt();
734
+ }, Lt = (l) => {
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)`;
738
738
  return {
739
- left: G,
740
- top: g
739
+ left: Pe,
740
+ top: x
741
741
  };
742
- }, [G, J, nt]), ce = (o, g, y, L) => /* @__PURE__ */ ot(
742
+ }, [Pe, Ne, Ge]), Et = (l, x, y, A) => /* @__PURE__ */ le(
743
743
  "button",
744
744
  {
745
745
  type: "button",
746
746
  tabIndex: 0,
747
747
  className: "aqvs-scrollbar-arrow-button",
748
748
  style: {
749
- [zt]: d,
750
- [Jt]: d
749
+ [dt]: p,
750
+ [R]: p
751
751
  },
752
- "aria-label": g,
753
- onPointerDown: Ce(o),
754
- onPointerUp: Se,
755
- onPointerLeave: Se,
756
- onPointerCancel: Se,
757
- onKeyDown: Ut(o),
758
- "aria-disabled": !l,
759
- disabled: !ne,
760
- children: /* @__PURE__ */ ot("span", { "aria-hidden": "true", children: y })
752
+ "aria-label": x,
753
+ onPointerDown: mt(l),
754
+ onPointerUp: ct,
755
+ onPointerLeave: ct,
756
+ onPointerCancel: ct,
757
+ onKeyDown: ht(l),
758
+ "aria-disabled": !a,
759
+ disabled: !He,
760
+ children: /* @__PURE__ */ le("span", { "aria-hidden": "true", children: y })
761
761
  },
762
- L
763
- ), xe = p && Nt ? {
764
- orientation: ct,
765
- scrollPosition: e,
766
- maxScrollPosition: dt,
762
+ A
763
+ ), Nt = h && ee ? {
764
+ orientation: Be,
765
+ scrollPosition: t,
766
+ maxScrollPosition: k,
767
767
  contentSize: r,
768
- viewportSize: t,
769
- thumbSize: At,
770
- thumbPosition: _t,
771
- thumbCenter: Xt,
772
- trackSize: yt,
773
- isDragging: W,
774
- isTapScrollActive: xt,
775
- visibleStartIndex: V,
776
- visibleEndIndex: z
768
+ viewportSize: e,
769
+ thumbSize: $,
770
+ thumbPosition: ge,
771
+ thumbCenter: Le,
772
+ trackSize: d,
773
+ isDragging: Y,
774
+ isTapScrollActive: ae,
775
+ visibleStartIndex: D,
776
+ visibleEndIndex: Z
777
777
  } : null;
778
- return /* @__PURE__ */ Te(
778
+ return /* @__PURE__ */ wt(
779
779
  "div",
780
780
  {
781
- className: ye("aqvs-scrollbar", Pt, b),
781
+ className: Rt("aqvs-scrollbar", gt, b),
782
782
  style: {
783
- [zt]: t,
784
- [Jt]: d
783
+ [dt]: e,
784
+ [R]: p
785
785
  },
786
- "data-visible": Nt ? "true" : "false",
786
+ "data-visible": ee ? "true" : "false",
787
787
  role: "scrollbar",
788
788
  tabIndex: -1,
789
789
  "aria-controls": I,
790
- "aria-valuenow": e,
790
+ "aria-valuenow": t,
791
791
  "aria-valuemin": 0,
792
- "aria-valuemax": dt,
793
- "aria-orientation": c ? "horizontal" : "vertical",
792
+ "aria-valuemax": k,
793
+ "aria-orientation": u ? "horizontal" : "vertical",
794
794
  children: [
795
- !c && Nt && et && /* @__PURE__ */ ot(
796
- er,
795
+ !u && ee && De && /* @__PURE__ */ le(
796
+ dr,
797
797
  {
798
- ref: lt,
799
- className: ye("aqvs-scrollbar-tap-circle-wrapper", vt),
800
- size: nt,
801
- maxVisualDistance: It,
802
- style: le,
803
- opacity: ae,
804
- renderVisual: it,
805
- onDragChange: Qt
798
+ ref: _,
799
+ className: Rt("aqvs-scrollbar-tap-circle-wrapper", Ze),
800
+ size: Ge,
801
+ maxVisualDistance: et,
802
+ style: Je,
803
+ opacity: Ot,
804
+ renderVisual: he,
805
+ onDragChange: rt
806
806
  },
807
807
  "tap-circle"
808
808
  ),
809
- ce(-1, gt[0], X[0], "arrow-start"),
810
- /* @__PURE__ */ Te(
809
+ Et(-1, J[0], We[0], "arrow-start"),
810
+ /* @__PURE__ */ wt(
811
811
  "div",
812
812
  {
813
813
  className: "aqvs-scrollbar-track",
814
814
  style: {
815
- borderRadius: d / 2
815
+ borderRadius: p / 2
816
816
  },
817
- onPointerDown: De,
818
- onPointerMove: Ae,
819
- onPointerUp: ke,
820
- onPointerCancel: oe,
821
- onLostPointerCapture: pe,
817
+ onPointerDown: zt,
818
+ onPointerMove: At,
819
+ onPointerUp: xe,
820
+ onPointerCancel: xt,
821
+ onLostPointerCapture: Lt,
822
822
  "aria-disabled": !s,
823
823
  children: [
824
- xe && /* @__PURE__ */ ot("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: p?.(xe) }, "overlay"),
825
- /* @__PURE__ */ ot(
824
+ Nt && /* @__PURE__ */ le("div", { className: "aqvs-scrollbar-overlay", "aria-hidden": !0, children: h?.(Nt) }, "overlay"),
825
+ /* @__PURE__ */ le(
826
826
  "div",
827
827
  {
828
828
  className: "aqvs-scrollbar-thumb-wrapper",
829
829
  style: {
830
- [zt]: At,
831
- [$t]: _t,
832
- ...c ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
830
+ [dt]: $,
831
+ [ft]: ge,
832
+ ...u ? { top: 0, bottom: 0 } : { left: 0, right: 0 }
833
833
  },
834
- "data-visible": Nt || W ? "true" : "false",
835
- onPointerDown: Ve,
834
+ "data-visible": ee || Y ? "true" : "false",
835
+ onPointerDown: Mt,
836
836
  role: "slider",
837
- "aria-orientation": c ? "horizontal" : "vertical",
838
- "aria-valuenow": e,
837
+ "aria-orientation": u ? "horizontal" : "vertical",
838
+ "aria-valuenow": t,
839
839
  "aria-valuemin": 0,
840
- "aria-valuemax": dt,
840
+ "aria-valuemax": k,
841
841
  "aria-disabled": !i,
842
842
  tabIndex: -1,
843
- children: /* @__PURE__ */ ot(
843
+ children: /* @__PURE__ */ le(
844
844
  "div",
845
845
  {
846
- ref: A,
847
- className: ye("aqvs-scrollbar-thumb", c ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
846
+ ref: P,
847
+ className: Rt("aqvs-scrollbar-thumb", u ? "aqvs-scrollbar-thumb-horizontal" : "aqvs-scrollbar-thumb-vertical"),
848
848
  "data-testid": "aqvs-scrollbar-thumb",
849
- "data-thumb-state": Gt,
849
+ "data-thumb-state": Ve,
850
850
  style: {
851
- borderRadius: d - 1,
851
+ borderRadius: p - 1,
852
852
  cursor: i ? "pointer" : "default"
853
853
  },
854
854
  onMouseEnter: () => {
855
- i && tt(!0);
855
+ i && oe(!0);
856
856
  },
857
857
  onMouseLeave: () => {
858
- i && tt(!1);
858
+ i && oe(!1);
859
859
  }
860
860
  },
861
861
  "thumb"
@@ -867,202 +867,268 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
867
867
  },
868
868
  "track"
869
869
  ),
870
- ce(1, gt[1], X[1], "arrow-end")
870
+ Et(1, J[1], We[1], "arrow-end")
871
871
  ]
872
872
  }
873
873
  );
874
- }, Mr = ["mouse", "pen", "touch"], Be = (r, t) => !(r === "mouse" || r === "pen" || r === "touch") || t.includes(r), yr = (r) => r === "mouse" || r === "pen", Ee = {
874
+ }, kr = 16, ir = (r, e, t) => e === 1 ? r * kr : e === 2 ? r * t : r, Fr = (r, e) => {
875
+ const t = r.shiftKey && r.deltaX === 0, n = t ? r.deltaY : r.deltaX, i = t ? 0 : r.deltaY, s = n !== 0 && Math.abs(n) >= Math.abs(i);
876
+ return {
877
+ // ❗ ズームでもデルタは潰さない。ここは**事実だけ**を報告し、「横取りしない」という
878
+ // 判断は適用側 (applyWheel) が下す。ここで 0 を詰めると適用側の ctrl 判定が
879
+ // 到達不能な飾りになり、`ctrl+shift+ホイール` を横スクロールとして食う退行を
880
+ // どのテストも検出できなくなる (変異解析で実証済み)。
881
+ isZoomGesture: r.ctrlKey,
882
+ isHorizontalDominant: s,
883
+ horizontalDelta: ir(n, r.deltaMode, e),
884
+ verticalDelta: ir(i, r.deltaMode, e)
885
+ };
886
+ }, pr = /* @__PURE__ */ new WeakSet(), sr = (r) => {
887
+ pr.add(r);
888
+ }, Yr = (r) => pr.has(r), Br = ["mouse", "pen", "touch"], Wt = (r, e) => !(r === "mouse" || r === "pen" || r === "touch") || e.includes(r), Hr = (r) => r === "mouse" || r === "pen", Ct = {
875
889
  maxVelocity: 6,
876
890
  minVelocity: 0.02,
877
891
  deceleration: 25e-4,
878
892
  velocitySampleWindow: 90,
879
893
  startVelocityThreshold: 0.04
880
- }, Le = (r, t, e) => {
881
- for (const [n, i, s] of t)
882
- e === "add" ? r.addEventListener(n, i, s) : r.removeEventListener(n, i, s);
883
- }, wr = $e(
894
+ }, _t = (r, e, t) => {
895
+ for (const [n, i, s] of e)
896
+ t === "add" ? r.addEventListener(n, i, s) : r.removeEventListener(n, i, s);
897
+ }, qr = Gt(
884
898
  ({
885
899
  children: r,
886
- contentSize: t,
887
- viewportSize: e,
888
- scrollBarWidth: n = 12,
889
- enableThumbDrag: i = !0,
890
- enableTrackClick: s = !0,
891
- enableArrowButtons: l = !0,
892
- enablePointerDrag: c = !0,
893
- pointerDragInputs: d = Mr,
894
- onScroll: b,
895
- className: I,
896
- testId: v,
897
- style: C,
898
- background: p,
899
- tapScrollCircleOptions: V,
900
- inertiaOptions: z,
901
- itemCount: W,
902
- renderThumbOverlay: at,
903
- wheelSpeedMultiplier: Q = 1,
904
- onWheelHorizontal: tt,
905
- contentInsets: xt,
906
- visibleStartIndex: Et,
907
- visibleEndIndex: A,
908
- renderOverlay: O,
909
- initialScrollPosition: P = 0,
910
- contentProps: U
911
- }, Z) => {
912
- const w = x(Number.isFinite(P) ? Math.max(0, P) : 0), lt = x(null), j = x(null), T = x(tt);
913
- Y(() => {
914
- T.current = tt;
915
- }, [tt]);
916
- const q = x({
900
+ contentSize: e,
901
+ viewportSize: t,
902
+ onViewportSizeChange: n,
903
+ scrollBarWidth: i = 12,
904
+ enableThumbDrag: s = !0,
905
+ enableTrackClick: a = !0,
906
+ enableArrowButtons: u = !0,
907
+ enablePointerDrag: p = !0,
908
+ pointerDragInputs: b = Br,
909
+ onScroll: I,
910
+ className: T,
911
+ testId: C,
912
+ style: h,
913
+ background: D,
914
+ tapScrollCircleOptions: Z,
915
+ inertiaOptions: Y,
916
+ itemCount: ue,
917
+ renderThumbOverlay: de,
918
+ wheelSpeedMultiplier: oe = 1,
919
+ onWheelHorizontal: ae,
920
+ contentInsets: fe,
921
+ visibleStartIndex: P,
922
+ visibleEndIndex: O,
923
+ renderOverlay: M,
924
+ initialScrollPosition: K = 0,
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)
930
+ return;
931
+ const d = v.current;
932
+ if (!d)
933
+ return;
934
+ const Q = () => {
935
+ const k = d.offsetHeight;
936
+ if (k > 0) {
937
+ Qe((B) => B === k ? B : k);
938
+ return;
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."));
941
+ };
942
+ if (Q(), typeof ResizeObserver != "function")
943
+ return;
944
+ const $ = new ResizeObserver(Q);
945
+ return $.observe(d), () => {
946
+ $.disconnect();
947
+ };
948
+ }, [e, q]), ot(() => {
949
+ q && n?.(Ee);
950
+ }, [q, Ee, n]), ot(() => {
951
+ if (q)
952
+ return;
953
+ const d = G.current;
954
+ if (!d)
955
+ return;
956
+ const Q = () => {
957
+ const k = d.clientHeight;
958
+ if (k <= 0 || Math.abs(k - N) <= 1)
959
+ return;
960
+ const B = `${N}/${k}`;
961
+ De.current !== B && (De.current = B, w.warn(
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
+ ));
964
+ };
965
+ if (Q(), typeof ResizeObserver != "function")
966
+ return;
967
+ const $ = new ResizeObserver(Q);
968
+ return $.observe(d), () => {
969
+ $.disconnect();
970
+ };
971
+ }, [q, N]);
972
+ const Ge = g(ae);
973
+ H(() => {
974
+ Ge.current = ae;
975
+ }, [ae]);
976
+ const Pe = g({
917
977
  frame: null,
918
978
  velocity: 0,
919
979
  lastTimestamp: null,
920
980
  generation: 0
921
- }), H = Ft(
981
+ }), Ne = Fe(
922
982
  () => ({
923
- maxVelocity: z?.maxVelocity ?? Ee.maxVelocity,
924
- minVelocity: z?.minVelocity ?? Ee.minVelocity,
925
- deceleration: z?.deceleration ?? Ee.deceleration,
926
- velocitySampleWindow: z?.velocitySampleWindow ?? Ee.velocitySampleWindow,
927
- startVelocityThreshold: z?.startVelocityThreshold ?? Ee.startVelocityThreshold
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
928
988
  }),
929
- [z]
930
- ), Ht = Ft(() => ({
931
- top: Math.max(0, xt?.top ?? 0),
932
- bottom: Math.max(0, xt?.bottom ?? 0)
933
- }), [xt]);
934
- N.debug("[ScrollPane] ScrollPane rendered", () => ({
935
- contentSize: t,
936
- viewportSize: e,
937
- scrollBarWidth: n,
938
- className: I,
939
- style: C,
940
- tapScrollCircleOptions: V,
941
- inertiaOptions: z,
942
- enablePointerDrag: c,
943
- contentInsets: Ht
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", () => ({
995
+ contentSize: e,
996
+ viewportSize: N,
997
+ scrollBarWidth: i,
998
+ className: T,
999
+ style: h,
1000
+ tapScrollCircleOptions: Z,
1001
+ inertiaOptions: Y,
1002
+ enablePointerDrag: p,
1003
+ contentInsets: Ze
944
1004
  }));
945
- const Dt = x({ contentSize: t, viewportSize: e });
946
- Dt.current = { contentSize: t, viewportSize: e };
947
- const et = Ft(() => t > e, [t, e]), nt = S(
948
- (h) => {
949
- const { contentSize: k, viewportSize: gt } = Dt.current, X = k > gt, Pt = w.current;
950
- if (N.debug("[ScrollPane] scrollTo called", () => ({ newPosition: h, contentSize: k, viewportSize: gt, currentIsScrollable: X, prevPosition: Pt })), !X)
951
- return w.current !== 0 && (w.current = 0, b?.(0, Pt)), w.current;
952
- const ct = typeof h == "function" ? h(w.current) : h;
953
- if (!Number.isFinite(ct))
954
- return N.warn("[ScrollPane] scrollTo received a non-finite position; keeping the current position", { nextPosition: ct }), w.current;
955
- const It = Math.max(k - gt, 0), Mt = rt(ct, 0, It);
956
- return w.current !== Mt && (w.current = Mt, b?.(Mt, Pt)), w.current;
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;
957
1017
  },
958
- [b]
959
- ), G = x(nt);
960
- Y(() => {
961
- G.current = nt;
962
- }, [nt]);
963
- const J = S(() => {
964
- const h = q.current;
965
- h.generation += 1, h.frame !== null && cancelAnimationFrame(h.frame), h.frame = null, h.velocity = 0, h.lastTimestamp = null;
966
- }, []), vt = x(J);
967
- Y(() => {
968
- vt.current = J;
969
- }, [J]), Y(() => () => {
970
- vt.current();
1018
+ [I]
1019
+ ), ne = g(ze);
1020
+ H(() => {
1021
+ ne.current = ze;
1022
+ }, [ze]);
1023
+ const he = S(() => {
1024
+ const d = Pe.current;
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();
971
1031
  }, []);
972
- const Lt = S(
973
- (h) => {
974
- if (!et)
1032
+ const Ae = S(
1033
+ (d) => {
1034
+ if (!X)
975
1035
  return;
976
- const { maxVelocity: k, minVelocity: gt, deceleration: X, startVelocityThreshold: Pt } = H, ct = rt(h, -k, k);
977
- if (Math.abs(ct) < Pt)
1036
+ const { maxVelocity: Q, minVelocity: $, deceleration: k, startVelocityThreshold: B } = Ne, ge = se(d, -Q, Q);
1037
+ if (Math.abs(ge) < B)
978
1038
  return;
979
- J(), q.current.velocity = ct, q.current.lastTimestamp = null;
980
- const It = q.current.generation, Mt = (yt) => {
981
- const ut = q.current;
982
- if (ut.generation !== It)
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)
983
1043
  return;
984
- if (ut.lastTimestamp === null) {
985
- ut.lastTimestamp = yt, ut.frame = requestAnimationFrame(Mt);
1044
+ if (Ve.lastTimestamp === null) {
1045
+ Ve.lastTimestamp = He, Ve.frame = requestAnimationFrame(ee);
986
1046
  return;
987
1047
  }
988
- const At = yt - ut.lastTimestamp;
989
- if (ut.lastTimestamp = yt, At <= 0) {
990
- ut.frame = requestAnimationFrame(Mt);
1048
+ const Ce = He - Ve.lastTimestamp;
1049
+ if (Ve.lastTimestamp = He, Ce <= 0) {
1050
+ Ve.frame = requestAnimationFrame(ee);
991
1051
  return;
992
1052
  }
993
- const dt = ut.velocity;
994
- let st = dt;
995
- const _t = X * At;
996
- dt > 0 ? st = Math.max(0, dt - _t) : dt < 0 && (st = Math.min(0, dt + _t));
997
- const Nt = (dt + st) / 2 * At, ne = w.current;
998
- if (Nt !== 0 && G.current((Tt) => Tt + Nt), q.current.generation !== It)
1053
+ const Ue = Ve.velocity;
1054
+ let Te = Ue;
1055
+ const be = k * Ce;
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)
999
1059
  return;
1000
- const Gt = w.current, { contentSize: Ct, viewportSize: f } = Dt.current, M = Math.max(Ct - f, 0);
1001
- ut.velocity = st;
1002
- const ft = Gt === ne || Gt <= 0 && st <= 0 || Gt >= M && st >= 0;
1003
- if (Math.abs(st) < gt || ft) {
1004
- J();
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) {
1064
+ he();
1005
1065
  return;
1006
1066
  }
1007
- ut.frame = requestAnimationFrame(Mt);
1067
+ Ve.frame = requestAnimationFrame(ee);
1008
1068
  };
1009
- q.current.frame = requestAnimationFrame(Mt);
1069
+ Pe.current.frame = requestAnimationFrame(ee);
1010
1070
  },
1011
- [et, H, J]
1012
- ), jt = x(Lt);
1013
- Y(() => {
1014
- jt.current = Lt;
1015
- }, [Lt]), Me(() => {
1016
- Dt.current = { contentSize: t, viewportSize: e };
1017
- }, [t, e]), Me(() => {
1018
- const h = j.current;
1019
- if (!h) return;
1020
- const k = () => {
1021
- h.scrollTop !== 0 && (N.debug("[ScrollPane] Native scroll detected, resetting to 0", () => ({ scrollTop: h.scrollTop })), h.scrollTop = 0), h.scrollLeft !== 0 && (h.scrollLeft = 0);
1071
+ [X, Ne, he]
1072
+ ), dt = g(Ae);
1073
+ H(() => {
1074
+ dt.current = Ae;
1075
+ }, [Ae]), ot(() => {
1076
+ $e.current = { contentSize: e, viewportSize: N };
1077
+ }, [e, N]), ot(() => {
1078
+ const d = v.current;
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);
1022
1082
  };
1023
- return h.addEventListener("scroll", k), () => h.removeEventListener("scroll", k);
1024
- }, []), Me(() => {
1025
- if (et) {
1026
- N.debug("[ScrollPane] Adjusting scroll position due to content or viewport size change", () => ({ contentSize: t, viewportSize: e, scrollPosition: w.current }));
1027
- const h = rt(t - e, 0, t);
1028
- w.current > h && nt(h);
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);
1029
1089
  } else
1030
- nt(0);
1031
- }, [et, nt, t, e]), Y(() => {
1032
- const h = (X) => {
1033
- if (X.ctrlKey)
1034
- return;
1035
- const Pt = X.shiftKey && X.deltaX === 0, ct = Pt ? X.deltaY : X.deltaX, It = Pt ? 0 : X.deltaY;
1036
- if (ct !== 0 && Math.abs(ct) >= Math.abs(It)) {
1037
- if (T.current) {
1038
- X.preventDefault(), J();
1039
- let ut = ct;
1040
- X.deltaMode === 1 ? ut *= 16 : X.deltaMode === 2 && (ut *= e), T.current(ut);
1041
- }
1042
- return;
1043
- }
1044
- if (!et || X.deltaY === 0)
1045
- return;
1046
- X.preventDefault(), J();
1047
- let yt = X.deltaY;
1048
- X.deltaMode === 1 ? yt *= 16 : X.deltaMode === 2 && (yt *= e), Q !== 1 && (yt *= Q), N.debug("[ScrollPane] wheel event", () => ({ deltaY: yt, scrollPosition: w.current, wheelSpeedMultiplier: Q, deltaMode: X.deltaMode, scrollTop: j.current?.scrollTop })), nt((ut) => ut + yt);
1049
- }, k = () => {
1050
- J();
1051
- }, gt = lt.current;
1052
- return gt && (gt.addEventListener("wheel", h, { passive: !1 }), gt.addEventListener("pointerdown", k, { capture: !0, passive: !0 })), () => {
1053
- gt && (gt.removeEventListener("wheel", h), gt.removeEventListener("pointerdown", k, { capture: !0 }));
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(
1095
+ (d) => {
1096
+ if (Yr(d))
1097
+ return !1;
1098
+ const { isScrollable: Q, viewportSize: $, wheelSpeedMultiplier: k } = R.current, B = Fr(d, $);
1099
+ if (B.isZoomGesture)
1100
+ 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)
1104
+ return !1;
1105
+ 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
+ },
1109
+ [ze, he]
1110
+ );
1111
+ H(() => {
1112
+ const d = (k) => {
1113
+ ft(k);
1114
+ }, Q = () => {
1115
+ 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 }));
1054
1119
  };
1055
- }, [et, nt, J, e, Q]), Ue(
1056
- Z,
1120
+ }, [ft, he]), Zt(
1121
+ j,
1057
1122
  () => ({
1058
- scrollTo: (h) => (J(), nt(h)),
1059
- getScrollPosition: () => w.current,
1060
- getContentSize: () => t,
1061
- getViewportSize: () => e
1123
+ scrollTo: (d) => (he(), ze(d)),
1124
+ getScrollPosition: () => _.current,
1125
+ getContentSize: () => e,
1126
+ getViewportSize: () => N,
1127
+ applyWheel: ft
1062
1128
  }),
1063
- [nt, t, e, J]
1129
+ [ze, e, N, he, ft]
1064
1130
  );
1065
- const R = sr(), de = U?.id ?? R, it = x({
1131
+ const pt = Ir(), V = te?.id ?? pt, J = g({
1066
1132
  pointerType: "",
1067
1133
  pointerId: null,
1068
1134
  startClientY: 0,
@@ -1071,147 +1137,151 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
1071
1137
  shouldCancelNextClick: !1,
1072
1138
  clickResetTimer: null,
1073
1139
  velocitySamples: []
1074
- }), E = x(c), Vt = x(d);
1075
- Y(() => {
1076
- E.current = c;
1077
- }, [c]), Y(() => {
1078
- Vt.current = d;
1079
- }, [d]);
1080
- const zt = x(et);
1081
- Y(() => {
1082
- zt.current = et;
1083
- }, [et]);
1084
- const Jt = x(H);
1085
- Y(() => {
1086
- Jt.current = H;
1087
- }, [H]), Y(() => {
1088
- const h = it.current;
1089
- if (c && et && (h.pointerId === null || Be(h.pointerType, d)) || h.pointerId === null)
1140
+ }), We = g(p), gt = g(b);
1141
+ H(() => {
1142
+ We.current = p;
1143
+ }, [p]), H(() => {
1144
+ gt.current = b;
1145
+ }, [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)
1090
1156
  return;
1091
- const k = j.current;
1092
- h.clickResetTimer !== null && (window.clearTimeout(h.clickResetTimer), h.clickResetTimer = null);
1093
- const gt = h.isDragging && h.shouldCancelNextClick, X = h.pointerId;
1094
- h.pointerId = null, h.pointerType = "", h.startClientY = 0, h.startScroll = 0, h.isDragging = !1, h.shouldCancelNextClick = gt, h.velocitySamples = [], k?.hasPointerCapture(X) && k.releasePointerCapture(X);
1095
- }, [c, d, et]), Y(() => {
1096
- const h = j.current;
1097
- if (!h)
1157
+ const Q = v.current;
1158
+ 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;
1163
+ if (!d)
1098
1164
  return;
1099
- const k = 6, gt = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), X = () => {
1100
- const f = it.current;
1165
+ const Q = 6, $ = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), k = () => {
1166
+ const f = J.current;
1101
1167
  f.pointerId = null, f.pointerType = "", f.startClientY = 0, f.startScroll = 0, f.isDragging = !1, f.velocitySamples = [];
1102
- }, Pt = () => {
1103
- const f = it.current;
1168
+ }, B = () => {
1169
+ const f = J.current;
1104
1170
  f.clickResetTimer !== null && (window.clearTimeout(f.clickResetTimer), f.clickResetTimer = null);
1105
- }, ct = (f) => {
1106
- const M = it.current, ft = gt();
1107
- M.velocitySamples.push({ clientY: f, time: ft });
1108
- const Tt = Jt.current.velocitySampleWindow;
1109
- M.velocitySamples = M.velocitySamples.filter((wt) => ft - wt.time <= Tt);
1110
- }, It = (f) => f instanceof HTMLElement && f.closest("[data-scrollpane-ignore-drag='true']") !== null, Mt = (f) => {
1111
- const M = it.current;
1112
- M.shouldCancelNextClick && (f.preventDefault(), f.stopPropagation(), M.shouldCancelNextClick = !1);
1113
- }, yt = (f) => {
1114
- const M = it.current;
1115
- if (!M.isDragging) {
1116
- if (M.isDragging = !0, M.shouldCancelNextClick = !0, !h.hasPointerCapture(f.pointerId))
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;
1178
+ E.shouldCancelNextClick && (f.preventDefault(), f.stopPropagation(), E.shouldCancelNextClick = !1);
1179
+ }, He = (f) => {
1180
+ const E = J.current;
1181
+ if (!E.isDragging) {
1182
+ if (E.isDragging = !0, E.shouldCancelNextClick = !0, !d.hasPointerCapture(f.pointerId))
1117
1183
  try {
1118
- h.setPointerCapture(f.pointerId);
1184
+ d.setPointerCapture(f.pointerId);
1119
1185
  } catch {
1120
1186
  }
1121
- ct(f.clientY);
1187
+ ge(f.clientY);
1122
1188
  }
1123
- }, ut = (f) => f.isTrusted || f.target === h, At = (f) => {
1124
- const M = it.current;
1125
- h.hasPointerCapture(f) && h.releasePointerCapture(f), M.shouldCancelNextClick = !1, Pt(), X();
1126
- }, dt = (f) => {
1127
- const M = it.current;
1128
- if (M.pointerId !== f.pointerId)
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();
1192
+ }, Ue = (f) => {
1193
+ const E = J.current;
1194
+ if (E.pointerId !== f.pointerId)
1129
1195
  return;
1130
- if (f.buttons === 0 && yr(f.pointerType)) {
1131
- At(f.pointerId);
1196
+ if (f.buttons === 0 && Hr(f.pointerType)) {
1197
+ Ce(f.pointerId);
1132
1198
  return;
1133
1199
  }
1134
- if (!(E.current && zt.current) || !Be(f.pointerType, Vt.current) || !M.isDragging && (Math.abs(f.clientY - M.startClientY) < k || (yt(f), !M.isDragging)))
1200
+ if (!(We.current && Be.current) || !Wt(f.pointerType, gt.current) || !E.isDragging && (Math.abs(f.clientY - E.startClientY) < Q || (He(f), !E.isDragging)))
1135
1201
  return;
1136
- ct(f.clientY);
1137
- const ft = f.clientY - M.startClientY, Tt = M.startScroll - ft;
1138
- G.current(Tt), f.cancelable && f.preventDefault();
1139
- }, st = () => {
1140
- const f = it.current;
1141
- return f.pointerId !== null || !f.shouldCancelNextClick ? !1 : (Pt(), f.clickResetTimer = window.setTimeout(() => {
1142
- const M = it.current;
1143
- M.shouldCancelNextClick = !1, M.clickResetTimer = null;
1202
+ ge(f.clientY);
1203
+ const Ie = f.clientY - E.startClientY, Oe = E.startScroll - Ie;
1204
+ ne.current(Oe), f.cancelable && f.preventDefault();
1205
+ }, Te = () => {
1206
+ const f = J.current;
1207
+ return f.pointerId !== null || !f.shouldCancelNextClick ? !1 : (B(), f.clickResetTimer = window.setTimeout(() => {
1208
+ const E = J.current;
1209
+ E.shouldCancelNextClick = !1, E.clickResetTimer = null;
1144
1210
  }, 0), !0);
1145
- }, _t = (f) => {
1146
- const M = it.current;
1147
- if (M.pointerId !== f.pointerId) {
1148
- st();
1211
+ }, be = (f) => {
1212
+ const E = J.current;
1213
+ if (E.pointerId !== f.pointerId) {
1214
+ Te();
1149
1215
  return;
1150
1216
  }
1151
- M.isDragging && M.shouldCancelNextClick && f.cancelable && (f.preventDefault(), f.stopPropagation()), M.isDragging && ct(f.clientY);
1152
- let ft = 0;
1153
- if (M.isDragging && M.velocitySamples.length >= 2) {
1154
- const wt = M.velocitySamples, ie = Jt.current.velocitySampleWindow, Qt = wt[wt.length - 1], te = wt.find((Kt) => Qt.time - Kt.time <= ie) ?? wt[0];
1155
- if (Qt && te && Qt.time !== te.time) {
1156
- const Kt = Qt.clientY - te.clientY, se = Qt.time - te.time;
1157
- ft = -(Kt / se);
1217
+ E.isDragging && E.shouldCancelNextClick && f.cancelable && (f.preventDefault(), f.stopPropagation()), E.isDragging && ge(f.clientY);
1218
+ let Ie = 0;
1219
+ 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];
1221
+ if (lt && mt && lt.time !== mt.time) {
1222
+ const ct = lt.clientY - mt.clientY, ht = lt.time - mt.time;
1223
+ Ie = -(ct / ht);
1158
1224
  }
1159
1225
  }
1160
- Pt(), M.shouldCancelNextClick && (M.clickResetTimer = window.setTimeout(() => {
1161
- const wt = it.current;
1162
- wt.shouldCancelNextClick = !1, wt.clickResetTimer = null;
1226
+ B(), E.shouldCancelNextClick && (E.clickResetTimer = window.setTimeout(() => {
1227
+ const _e = J.current;
1228
+ _e.shouldCancelNextClick = !1, _e.clickResetTimer = null;
1163
1229
  }, 0));
1164
- const Tt = Jt.current.startVelocityThreshold;
1165
- X(), h.hasPointerCapture(f.pointerId) && h.releasePointerCapture(f.pointerId), Math.abs(ft) >= Tt && jt.current?.(ft);
1166
- }, Xt = (f) => {
1167
- if (it.current.pointerId !== null) {
1168
- if (!f.isPrimary || f.pointerType !== it.current.pointerType)
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)
1169
1235
  return;
1170
- At(it.current.pointerId);
1236
+ Ce(J.current.pointerId);
1171
1237
  }
1172
- if (it.current.shouldCancelNextClick && (Pt(), it.current.shouldCancelNextClick = !1), !(E.current && zt.current) || !Be(f.pointerType, Vt.current) || f.button !== 0 && f.pointerType === "mouse" || f.ctrlKey || f.metaKey || f.altKey || It(f.target))
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))
1173
1239
  return;
1174
- window.dispatchEvent(new CustomEvent(Xe, { detail: { paneId: R } })), vt.current?.();
1175
- const M = it.current;
1176
- Pt(), M.pointerId = f.pointerId, M.pointerType = f.pointerType, M.startClientY = f.clientY, M.startScroll = w.current, M.isDragging = !1, M.shouldCancelNextClick = !1, M.velocitySamples = [];
1177
- }, Nt = (f) => {
1178
- if (it.current.pointerId !== f.pointerId) {
1179
- st();
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) {
1245
+ Te();
1180
1246
  return;
1181
1247
  }
1182
- ut(f) && At(f.pointerId);
1183
- }, Gt = [
1184
- ["click", Mt, !0],
1185
- ["pointerdown", Xt, { passive: !1 }],
1248
+ Ve(f) && Ce(f.pointerId);
1249
+ }, rt = [
1250
+ ["click", ee, !0],
1251
+ ["pointerdown", we, { passive: !1 }],
1186
1252
  ["lostpointercapture", (f) => {
1187
- f.target !== h || it.current.pointerId !== f.pointerId || At(f.pointerId);
1253
+ f.target !== d || J.current.pointerId !== f.pointerId || Ce(f.pointerId);
1188
1254
  }, void 0]
1189
- ], Ct = [
1190
- ["pointermove", dt, { passive: !1 }],
1191
- ["pointerup", _t, void 0],
1192
- ["pointercancel", Nt, void 0]
1255
+ ], at = [
1256
+ ["pointermove", Ue, { passive: !1 }],
1257
+ ["pointerup", be, void 0],
1258
+ ["pointercancel", ye, void 0]
1193
1259
  ];
1194
- return Le(h, Gt, "add"), Le(window, Ct, "add"), () => {
1195
- Le(h, Gt, "remove"), Le(window, Ct, "remove");
1196
- const f = it.current;
1197
- f.pointerId !== null && h.hasPointerCapture(f.pointerId) && h.releasePointerCapture(f.pointerId), Pt(), X();
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();
1198
1264
  };
1199
- }, [R]);
1200
- const $t = S(
1201
- (h) => (J(), nt(h)),
1202
- [nt, J]
1265
+ }, [pt]);
1266
+ const ce = S(
1267
+ (d) => (he(), ze(d)),
1268
+ [ze, he]
1203
1269
  );
1204
- return /* @__PURE__ */ Te("div", { ref: lt, "data-testid": v, className: ye("aqvs-scroll-pane", I), style: C, children: [
1205
- /* @__PURE__ */ Te(
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(
1206
1272
  "div",
1207
1273
  {
1208
- ref: j,
1209
- className: ye("aqvs-scroll-pane-content"),
1274
+ ref: v,
1275
+ className: Rt("aqvs-scroll-pane-content"),
1210
1276
  "data-testid": "aqvs-scroll-pane-content",
1211
1277
  style: {
1212
- height: e,
1213
- paddingTop: Ht.top,
1214
- paddingBottom: Ht.bottom,
1278
+ // ❗ 自己計測モードでは高さを書かない。CSS の `height: 100%` (= ルートの確定高さ) が
1279
+ // レイアウトを所有することで、「計測した値を書き戻して自分のサイズを変える」
1280
+ // フィードバックループが構造的に起こらず、初回 paint の時点でも帯は実寸で正しい
1281
+ // (数値の反映だけが 1 コミット遅れる)。明示モードは従来どおり px を書く。
1282
+ height: q ? void 0 : N,
1283
+ paddingTop: Ze.top,
1284
+ paddingBottom: Ze.bottom,
1215
1285
  // スクロール不能時 (contentSize <= viewportSize) は touch-action を通常に戻し、
1216
1286
  // 短いリスト上のタッチがページ全体のパンを妨げるデッドゾーン化を防ぐ。
1217
1287
  // 直接操作 (指・ペン) のドラッグを許可していない場合も付けない。
@@ -1225,111 +1295,111 @@ const rt = (r, t, e) => Math.max(t, Math.min(e, r)), Xe = "virtualscroll:tap-scr
1225
1295
  // 同一条件で揃えてあるため状態としても一貫している。
1226
1296
  // 非同期コンテンツを先読みして確保する挙動は意図的に入れていない
1227
1297
  // (空のペインがページのパンを殺すデッドゾーンになり、そちらの実害の方が大きいため)。
1228
- ...c && et && d.some((h) => h === "touch" || h === "pen") ? { touchAction: "none" } : {}
1298
+ ...p && X && b.some((d) => d === "touch" || d === "pen") ? { touchAction: "none" } : {}
1229
1299
  },
1230
- ...U,
1231
- id: de,
1300
+ ...te,
1301
+ id: V,
1232
1302
  children: [
1233
- p,
1234
- r(w.current)
1303
+ D,
1304
+ r(_.current)
1235
1305
  ]
1236
1306
  }
1237
1307
  ),
1238
- /* @__PURE__ */ ot(
1239
- Pr,
1308
+ /* @__PURE__ */ le(
1309
+ _r,
1240
1310
  {
1241
- contentSize: t,
1242
- viewportSize: e,
1243
- scrollPosition: w.current,
1244
- onScroll: $t,
1245
- enableThumbDrag: i,
1246
- enableTrackClick: s,
1247
- enableArrowButtons: l,
1248
- scrollBarWidth: n,
1249
- ariaControls: de,
1250
- tapScrollCircleOptions: V,
1251
- itemCount: W,
1252
- renderThumbOverlay: at,
1253
- visibleStartIndex: Et,
1254
- visibleEndIndex: A
1311
+ contentSize: e,
1312
+ viewportSize: N,
1313
+ scrollPosition: _.current,
1314
+ onScroll: ce,
1315
+ enableThumbDrag: s,
1316
+ enableTrackClick: a,
1317
+ enableArrowButtons: u,
1318
+ scrollBarWidth: i,
1319
+ ariaControls: V,
1320
+ tapScrollCircleOptions: Z,
1321
+ itemCount: ue,
1322
+ renderThumbOverlay: de,
1323
+ visibleStartIndex: P,
1324
+ visibleEndIndex: O
1255
1325
  },
1256
1326
  "scrollbar"
1257
1327
  ),
1258
- O?.()
1328
+ M?.()
1259
1329
  ] });
1260
1330
  }
1261
- ), Ge = (r, t, e) => Math.min(Math.max(r, t), e), Br = ({ dragState: r, normalizedDistance: t, sizeScale: e, size: n }) => {
1262
- const i = Math.max(n / 2, 1), s = 1 + t * 0.65, l = Math.max(0.65, 1 - t * 0.25), c = r.direction * t * 26 * e, d = 0.8 + t * 0.18, b = 3 * e, I = 6 * e, v = 22 * e, C = Math.abs(c) + I, p = c > 0 ? b : -Math.abs(c) - b, V = Math.max(2.5, 3 * e), z = Ge(r.offsetX, -i, i), W = Ge(r.offsetY, -i, i), at = i * 0.35, Q = z / i * at, tt = W / i * at, xt = Q * 0.45, Et = tt * 0.45, A = Math.max(v * 0.38, 6), O = 0.65 + t * 0.2, P = r.active;
1263
- return /* @__PURE__ */ Te(tr, { children: [
1264
- /* @__PURE__ */ ot(
1331
+ ), 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
+ /* @__PURE__ */ le(
1265
1335
  "div",
1266
1336
  {
1267
1337
  className: "aqvs-tap-scroll-circle-gradient",
1268
1338
  style: {
1269
- transform: `scale(${l}, ${s})`,
1270
- transition: P ? "40ms transform ease-out" : "200ms ease transform"
1339
+ transform: `scale(${a}, ${s})`,
1340
+ transition: M ? "40ms transform ease-out" : "200ms ease transform"
1271
1341
  }
1272
1342
  }
1273
1343
  ),
1274
- /* @__PURE__ */ ot(
1344
+ /* @__PURE__ */ le(
1275
1345
  "div",
1276
1346
  {
1277
1347
  className: "aqvs-sample-visual-pupil",
1278
1348
  style: {
1279
- width: v,
1280
- height: v,
1281
- transform: `translate(calc(-50% + ${Q}px), calc(-50% + ${tt}px)) scale(${l}, ${d * s})`,
1282
- transition: P ? "70ms transform ease-out" : "200ms ease transform"
1349
+ width: T,
1350
+ height: T,
1351
+ transform: `translate(calc(-50% + ${de}px), calc(-50% + ${oe}px)) scale(${a}, ${p * s})`,
1352
+ transition: M ? "70ms transform ease-out" : "200ms ease transform"
1283
1353
  }
1284
1354
  }
1285
1355
  ),
1286
- /* @__PURE__ */ ot(
1356
+ /* @__PURE__ */ le(
1287
1357
  "div",
1288
1358
  {
1289
1359
  className: "aqvs-sample-visual-highlight",
1290
1360
  style: {
1291
- width: A,
1292
- height: A,
1293
- transform: `translate(calc(-50% + ${xt}px), calc(-50% + ${Et}px)) scale(${l}, ${s})`,
1361
+ width: P,
1362
+ height: P,
1363
+ transform: `translate(calc(-50% + ${ae}px), calc(-50% + ${fe}px)) scale(${a}, ${s})`,
1294
1364
  opacity: O,
1295
1365
  boxShadow: "0 0 8px rgba(255,255,255,0.45)",
1296
- transition: P ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1366
+ transition: M ? "120ms opacity 150ms, 120ms transform ease-out ease-out" : "220ms ease transform, 240ms opacity ease"
1297
1367
  }
1298
1368
  }
1299
1369
  ),
1300
- /* @__PURE__ */ ot(
1370
+ /* @__PURE__ */ le(
1301
1371
  "div",
1302
1372
  {
1303
1373
  className: "aqvs-sample-visual-rod",
1304
1374
  style: {
1305
- width: V,
1375
+ width: D,
1306
1376
  height: C,
1307
- transform: `translate(-50%, ${p}px)`,
1308
- opacity: t,
1309
- transition: P ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
1377
+ transform: `translate(-50%, ${h}px)`,
1378
+ opacity: e,
1379
+ transition: M ? "40ms height, 60ms opacity ease-out ease-out" : "200ms ease height, 120ms ease opacity"
1310
1380
  }
1311
1381
  }
1312
1382
  )
1313
1383
  ] });
1314
- }, _e = 100, Rr = (r) => {
1384
+ }, kt = 100, Xr = (r) => {
1315
1385
  if (!Number.isFinite(r))
1316
1386
  return 0n;
1317
- const t = Math.trunc(r);
1318
- return t <= 0 ? 0n : BigInt(t);
1319
- }, qe = (r, t) => {
1387
+ const e = Math.trunc(r);
1388
+ return e <= 0 ? 0n : BigInt(e);
1389
+ }, Ut = (r, e) => {
1320
1390
  if (!Number.isFinite(r))
1321
- throw new Error(`valueFn returned a non-finite value at index ${t}: ${r}`);
1391
+ throw new Error(`valueFn returned a non-finite value at index ${e}: ${r}`);
1322
1392
  return r;
1323
- }, Pe = (r) => {
1393
+ }, yt = (r) => {
1324
1394
  if (r <= 0 || !Number.isFinite(r))
1325
1395
  return 0;
1326
- const t = Math.trunc(r);
1327
- if (t <= 2147483647)
1328
- return t & -t;
1329
- const e = BigInt(t) & -BigInt(t);
1330
- return Number(e);
1396
+ const e = Math.trunc(r);
1397
+ if (e <= 2147483647)
1398
+ return e & -e;
1399
+ const t = BigInt(e) & -BigInt(e);
1400
+ return Number(t);
1331
1401
  };
1332
- class ge {
1402
+ class vt {
1333
1403
  /**
1334
1404
  * @private
1335
1405
  * @property {Map<number, number>} tree - The Map storing the Fenwick tree structure, specifically the sums of deltas. It is 1-indexed.
@@ -1369,8 +1439,8 @@ class ge {
1369
1439
  * @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
1370
1440
  * @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
1371
1441
  */
1372
- constructor(t, e, n) {
1373
- this.reset(t, e, n);
1442
+ constructor(e, t, n) {
1443
+ this.reset(e, t, n);
1374
1444
  }
1375
1445
  /**
1376
1446
  * @method reset
@@ -1387,33 +1457,33 @@ class ge {
1387
1457
  * @param {number | ((index: number) => number)} valueOrFn - The value for all elements, or a function to generate values.
1388
1458
  * @param {{ sampleRange?: { from: number; to: number }, materialize?: boolean }} [options] - Optional settings for initialization.
1389
1459
  */
1390
- reset(t, e, n) {
1391
- const i = Number.isFinite(t) && t > 0 ? Math.trunc(t) : 0;
1392
- if (typeof e != "function") {
1393
- this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.valueFn = void 0, this.baseValue = e, this.total = this.baseValue * this.size;
1460
+ reset(e, t, n) {
1461
+ const i = Number.isFinite(e) && e > 0 ? Math.trunc(e) : 0;
1462
+ if (typeof t != "function") {
1463
+ this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.valueFn = void 0, this.baseValue = t, this.total = this.baseValue * this.size;
1394
1464
  return;
1395
1465
  }
1396
- let s = 0, l;
1466
+ let s = 0, a;
1397
1467
  if (i > 0) {
1398
- const c = n?.sampleRange ?? {
1468
+ const u = n?.sampleRange ?? {
1399
1469
  from: 0,
1400
- to: Math.min(_e - 1, i - 1)
1470
+ to: Math.min(kt - 1, i - 1)
1401
1471
  };
1402
- let d = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), i - 1);
1403
- if (d > b && (d = 0, b = Math.min(_e - 1, i - 1)), i > _e)
1404
- s = ge._sampleBaseValueStrided(e, i, _e), n?.materialize && (l = { from: d, values: ge._collectValidatedValues(e, d, b) });
1472
+ let p = Math.max(0, Math.trunc(u.from)), b = Math.min(Math.trunc(u.to), i - 1);
1473
+ 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) });
1405
1475
  else {
1406
- const I = ge._collectValidatedValues(e, d, b);
1407
- s = ge._modeOrMedian([...I]), n?.materialize && (l = { from: d, values: I });
1476
+ const I = vt._collectValidatedValues(t, p, b);
1477
+ s = vt._modeOrMedian([...I]), n?.materialize && (a = { from: p, values: I });
1408
1478
  }
1409
1479
  }
1410
- if (this.size = i, this.tree = /* @__PURE__ */ new Map(), this.deltas = /* @__PURE__ */ new Map(), this.total = void 0, this.valueFn = e, this.baseValue = s, l)
1411
- for (let c = 0; c < l.values.length; c++) {
1412
- const d = l.from + c;
1413
- if (d >= this.size)
1480
+ 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
+ if (p >= this.size)
1414
1484
  break;
1415
- const b = l.values[c] - this.baseValue;
1416
- b !== 0 && (this.deltas.set(d, b), this._updateTree(d, b));
1485
+ const b = a.values[u] - this.baseValue;
1486
+ b !== 0 && (this.deltas.set(p, b), this._updateTree(p, b));
1417
1487
  }
1418
1488
  this.total = this.getTotal();
1419
1489
  }
@@ -1424,12 +1494,12 @@ class ge {
1424
1494
  * @param {number | ((index: number) => number)} valueOrFn - The new value for all elements, or a function to generate values.
1425
1495
  * @param {{ reset?: boolean }} [options] - Optional settings. If reset is true, the tree is reset with the new value function.
1426
1496
  */
1427
- setValueFn(t, e) {
1428
- if (e?.reset) {
1429
- this.reset(this.size, t);
1497
+ setValueFn(e, t) {
1498
+ if (t?.reset) {
1499
+ this.reset(this.size, e);
1430
1500
  return;
1431
1501
  }
1432
- typeof t == "function" ? this.valueFn = t : (this.valueFn = void 0, this.baseValue = t, this.total = this._computeTreeTotal());
1502
+ typeof e == "function" ? this.valueFn = e : (this.valueFn = void 0, this.baseValue = e, this.total = this._computeTreeTotal());
1433
1503
  }
1434
1504
  /**
1435
1505
  * @private
@@ -1441,10 +1511,10 @@ class ge {
1441
1511
  * @param {number} to - The ending index of the range (inclusive).
1442
1512
  * @returns {number[]} The validated (finite-only) values in index order.
1443
1513
  */
1444
- static _collectValidatedValues(t, e, n) {
1514
+ static _collectValidatedValues(e, t, n) {
1445
1515
  const i = [];
1446
- for (let s = e; s <= n; s++)
1447
- i.push(qe(t(s), s));
1516
+ for (let s = t; s <= n; s++)
1517
+ i.push(Ut(e(s), s));
1448
1518
  return i;
1449
1519
  }
1450
1520
  /**
@@ -1455,25 +1525,25 @@ class ge {
1455
1525
  * @param {number[]} values - The sampled values (mutated in place by sorting).
1456
1526
  * @returns {number} The representative base value.
1457
1527
  */
1458
- static _modeOrMedian(t) {
1459
- if (t.length === 0)
1528
+ static _modeOrMedian(e) {
1529
+ if (e.length === 0)
1460
1530
  return 0;
1461
- t.sort((l, c) => l - c);
1462
- const e = Math.floor(t.length / 2);
1531
+ e.sort((a, u) => a - u);
1532
+ const t = Math.floor(e.length / 2);
1463
1533
  let n;
1464
- t.length % 2 === 0 ? n = Math.floor((t[e - 1] + t[e]) / 2) : n = t[e];
1534
+ e.length % 2 === 0 ? n = Math.floor((e[t - 1] + e[t]) / 2) : n = e[t];
1465
1535
  const i = /* @__PURE__ */ new Map();
1466
1536
  let s = 0;
1467
- for (const l of t) {
1468
- const c = (i.get(l) ?? 0) + 1;
1469
- i.set(l, c), c > s && (s = c);
1537
+ for (const a of e) {
1538
+ const u = (i.get(a) ?? 0) + 1;
1539
+ i.set(a, u), u > s && (s = u);
1470
1540
  }
1471
- if (s > t.length * 0.2) {
1472
- const l = [];
1473
- for (const [d, b] of i.entries())
1474
- b === s && l.push(d);
1475
- const c = l.reduce((d, b) => d + b, 0);
1476
- n = Math.floor(c / l.length);
1541
+ if (s > e.length * 0.2) {
1542
+ const a = [];
1543
+ for (const [p, b] of i.entries())
1544
+ b === s && a.push(p);
1545
+ const u = a.reduce((p, b) => p + b, 0);
1546
+ n = Math.floor(u / a.length);
1477
1547
  }
1478
1548
  return n;
1479
1549
  }
@@ -1487,15 +1557,15 @@ class ge {
1487
1557
  * @param {number} sampleCount - Maximum number of points to evaluate.
1488
1558
  * @returns {number} The estimated base value.
1489
1559
  */
1490
- static _sampleBaseValueStrided(t, e, n) {
1491
- if (e <= 0)
1560
+ static _sampleBaseValueStrided(e, t, n) {
1561
+ if (t <= 0)
1492
1562
  return 0;
1493
- let i = Math.max(1, Math.ceil(e / n));
1563
+ let i = Math.max(1, Math.ceil(t / n));
1494
1564
  i % 2 === 0 && (i += 1);
1495
1565
  const s = [];
1496
- for (let l = 0; l < e && s.length < n; l += i)
1497
- s.push(qe(t(l), l));
1498
- return ge._modeOrMedian(s);
1566
+ for (let a = 0; a < t && s.length < n; a += i)
1567
+ s.push(Ut(e(a), a));
1568
+ return vt._modeOrMedian(s);
1499
1569
  }
1500
1570
  /**
1501
1571
  * @method update
@@ -1504,8 +1574,8 @@ class ge {
1504
1574
  * @param {number} index - The 0-based index to update.
1505
1575
  * @param {number} value - The new value.
1506
1576
  */
1507
- update(t, e) {
1508
- return this.updates([{ index: t, value: e }]);
1577
+ update(e, t) {
1578
+ return this.updates([{ index: e, value: t }]);
1509
1579
  }
1510
1580
  /**
1511
1581
  * @method updates
@@ -1513,9 +1583,9 @@ class ge {
1513
1583
  * @description 指定されたインデックスの値を更新。
1514
1584
  * @param {ValueUpdate[]} updates - An array of updates, each with an index and the new value.
1515
1585
  */
1516
- updates(t) {
1517
- const e = this._buildDeltaUpdates(t);
1518
- return e.length > 0 ? this.updateDeltas(e) : this.total;
1586
+ updates(e) {
1587
+ const t = this._buildDeltaUpdates(e);
1588
+ return t.length > 0 ? this.updateDeltas(t) : this.total;
1519
1589
  }
1520
1590
  /**
1521
1591
  * @method updateDelta
@@ -1524,8 +1594,8 @@ class ge {
1524
1594
  * @param {number} index - The 0-based index to update.
1525
1595
  * @param {number} change - The value to add to the delta at the given index.
1526
1596
  */
1527
- updateDelta(t, e) {
1528
- return this.updateDeltas([{ index: t, change: e }]);
1597
+ updateDelta(e, t) {
1598
+ return this.updateDeltas([{ index: e, change: t }]);
1529
1599
  }
1530
1600
  /**
1531
1601
  * @method updateDeltas
@@ -1533,23 +1603,23 @@ class ge {
1533
1603
  * @description 指定されたインデックスのデルタを更新し、変更をツリーに伝播させる。全件を先に検証してから適用する (アトミック性): 範囲外/非整数の index、非有限の change、適用後の実効値 (`baseValue` + delta) が負になる変更はいずれも適用前に throw で拒否。負の実効値は `_descend`/`_findIndexLarge` が前提とする累積和の単調性を破壊するため。
1534
1604
  * @param {DeltaUpdate[]} updates - An array of updates, each with an index and the change to apply.
1535
1605
  */
1536
- updateDeltas(t) {
1537
- const e = /* @__PURE__ */ new Map();
1538
- for (const { index: n, change: i } of t) {
1606
+ updateDeltas(e) {
1607
+ const t = /* @__PURE__ */ new Map();
1608
+ for (const { index: n, change: i } of e) {
1539
1609
  if (n < 0 || n >= this.size)
1540
1610
  throw new Error(`Index ${n} out of bounds`);
1541
1611
  if (!Number.isInteger(n))
1542
1612
  throw new Error(`Index must be an integer: ${n}`);
1543
1613
  if (!Number.isFinite(i))
1544
1614
  throw new Error(`Change must be a finite number: ${i}`);
1545
- const l = (e.get(n) ?? this.deltas.get(n) ?? 0) + i;
1546
- if (l + this.baseValue < -1e-9)
1547
- throw new Error(`Change would make the value at index ${n} negative: ${l + this.baseValue}`);
1548
- e.set(n, l);
1615
+ const a = (t.get(n) ?? this.deltas.get(n) ?? 0) + i;
1616
+ if (a + this.baseValue < -1e-9)
1617
+ throw new Error(`Change would make the value at index ${n} negative: ${a + this.baseValue}`);
1618
+ t.set(n, a);
1549
1619
  }
1550
- for (const { index: n, change: i } of t) {
1551
- const l = (this.deltas.get(n) ?? 0) + i;
1552
- l === 0 ? this.deltas.delete(n) : this.deltas.set(n, l), this._updateTree(n, i);
1620
+ for (const { index: n, change: i } of e) {
1621
+ const a = (this.deltas.get(n) ?? 0) + i;
1622
+ a === 0 ? this.deltas.delete(n) : this.deltas.set(n, a), this._updateTree(n, i);
1553
1623
  }
1554
1624
  return this.total;
1555
1625
  }
@@ -1561,18 +1631,18 @@ class ge {
1561
1631
  * @param {number} index - The 0-based index that changed.
1562
1632
  * @param {number} change - The change in value.
1563
1633
  */
1564
- _updateTree(t, e) {
1565
- if (e === 0)
1634
+ _updateTree(e, t) {
1635
+ if (t === 0)
1566
1636
  return;
1567
- let n = t + 1;
1637
+ let n = e + 1;
1568
1638
  for (; n <= this.size; ) {
1569
- this.tree.set(n, (this.tree.get(n) ?? 0) + e);
1570
- const i = Pe(n);
1639
+ this.tree.set(n, (this.tree.get(n) ?? 0) + t);
1640
+ const i = yt(n);
1571
1641
  if (i === 0)
1572
1642
  break;
1573
1643
  n += i;
1574
1644
  }
1575
- this.total !== void 0 && (this.total += e);
1645
+ this.total !== void 0 && (this.total += t);
1576
1646
  }
1577
1647
  /**
1578
1648
  * @private
@@ -1582,9 +1652,9 @@ class ge {
1582
1652
  * @param {ValueUpdate[]} updates - Requested value updates.
1583
1653
  * @returns {DeltaUpdate[]} Sanitized delta updates ready to apply.
1584
1654
  */
1585
- _buildDeltaUpdates(t) {
1586
- const e = [], n = /* @__PURE__ */ new Map();
1587
- for (const { index: i, value: s } of t) {
1655
+ _buildDeltaUpdates(e) {
1656
+ const t = [], n = /* @__PURE__ */ new Map();
1657
+ for (const { index: i, value: s } of e) {
1588
1658
  if (i < 0 || i >= this.size)
1589
1659
  throw new Error(`Index ${i} out of bounds`);
1590
1660
  if (!Number.isInteger(i))
@@ -1593,10 +1663,10 @@ class ge {
1593
1663
  throw new Error(`Value must be a finite number: ${s}`);
1594
1664
  if (s < 0)
1595
1665
  throw new Error("Value cannot be negative.");
1596
- const l = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, c = l + this.baseValue, d = s - c;
1597
- d !== 0 && e.push({ index: i, change: d }), n.set(i, l + d);
1666
+ const a = n.has(i) ? n.get(i) ?? 0 : this.deltas.get(i) ?? 0, u = a + this.baseValue, p = s - u;
1667
+ p !== 0 && t.push({ index: i, change: p }), n.set(i, a + p);
1598
1668
  }
1599
- return e;
1669
+ return t;
1600
1670
  }
1601
1671
  /**
1602
1672
  * @private
@@ -1608,15 +1678,15 @@ class ge {
1608
1678
  _computeTreeTotal() {
1609
1679
  if (this.size <= 0)
1610
1680
  return 0;
1611
- let t = 0, e = this.size;
1612
- for (; e > 0; ) {
1613
- t += this.tree.get(e) ?? 0;
1614
- const n = Pe(e);
1681
+ let e = 0, t = this.size;
1682
+ for (; t > 0; ) {
1683
+ e += this.tree.get(t) ?? 0;
1684
+ const n = yt(t);
1615
1685
  if (n === 0)
1616
1686
  break;
1617
- e -= n;
1687
+ t -= n;
1618
1688
  }
1619
- return t + this.baseValue * this.size;
1689
+ return e + this.baseValue * this.size;
1620
1690
  }
1621
1691
  /**
1622
1692
  * @private
@@ -1626,12 +1696,12 @@ class ge {
1626
1696
  * @param {number} index - The 0-based index to materialize.
1627
1697
  * @param {boolean} [updateTree=true] - Whether to update the Fenwick tree after materialization.
1628
1698
  */
1629
- _materialize(t, e = !0) {
1699
+ _materialize(e, t = !0) {
1630
1700
  if (this.valueFn) {
1631
- const n = this.deltas.get(t) ?? 0, s = qe(this.valueFn(t), t) - this.baseValue;
1632
- if (s !== n && (s === 0 ? this.deltas.delete(t) : this.deltas.set(t, s), e)) {
1633
- const l = s - n;
1634
- this._updateTree(t, l);
1701
+ const n = this.deltas.get(e) ?? 0, s = Ut(this.valueFn(e), e) - this.baseValue;
1702
+ if (s !== n && (s === 0 ? this.deltas.delete(e) : this.deltas.set(e, s), t)) {
1703
+ const a = s - n;
1704
+ this._updateTree(e, a);
1635
1705
  }
1636
1706
  }
1637
1707
  }
@@ -1644,27 +1714,27 @@ class ge {
1644
1714
  * @param {number | undefined} index - Target index for materialization.
1645
1715
  * @param {boolean} [forceIndex=false] - When true, materializes the index even if it is outside the provided ranges.
1646
1716
  */
1647
- _materializeRanges(t, e, n = !1) {
1648
- if (!(t?.materialize && this.valueFn))
1717
+ _materializeRanges(e, t, n = !1) {
1718
+ if (!(e?.materialize && this.valueFn))
1649
1719
  return;
1650
- const i = t.ranges;
1720
+ const i = e.ranges;
1651
1721
  if (i && i.length > 0) {
1652
- for (const c of i) {
1653
- const d = Math.max(0, Math.trunc(c.from)), b = Math.min(Math.trunc(c.to), this.size - 1);
1654
- for (let I = d; I <= b; I++)
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 (let I = p; I <= b; I++)
1655
1725
  this._materialize(I);
1656
1726
  }
1657
- if (e === void 0)
1727
+ if (t === void 0)
1658
1728
  return;
1659
1729
  if (n) {
1660
- this._materialize(e);
1730
+ this._materialize(t);
1661
1731
  return;
1662
1732
  }
1663
- const s = i[0].from, l = i[i.length - 1].to;
1664
- e >= s && e <= l && this._materialize(e);
1733
+ const s = i[0].from, a = i[i.length - 1].to;
1734
+ t >= s && t <= a && this._materialize(t);
1665
1735
  return;
1666
1736
  }
1667
- e !== void 0 && this._materialize(e);
1737
+ t !== void 0 && this._materialize(t);
1668
1738
  }
1669
1739
  /**
1670
1740
  * @private
@@ -1676,30 +1746,30 @@ class ge {
1676
1746
  * @param {boolean} chooseLowerBound - When true, finds the smallest index meeting or exceeding the target; otherwise finds the largest index not exceeding it.
1677
1747
  * @returns {{ index: number; total: number | undefined; cumulative: number | undefined; currentValue: number | undefined; safeIndex: number | undefined }} Binary search result.
1678
1748
  */
1679
- _findIndex(t, e = {}, n) {
1749
+ _findIndex(e, t = {}, n) {
1680
1750
  if (this.size >= 1073741824)
1681
- return this._findIndexLarge(t, e, n);
1751
+ return this._findIndexLarge(e, t, n);
1682
1752
  if (this.size === 0)
1683
1753
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1684
- this._materializeRanges(e.materializeOption);
1685
- const i = e.materializeOption?.materialize === !0;
1754
+ this._materializeRanges(t.materializeOption);
1755
+ const i = t.materializeOption?.materialize === !0;
1686
1756
  let s;
1687
1757
  for (; ; ) {
1688
- if (s = this._descend(t, n), s < 0 || s >= this.size)
1758
+ if (s = this._descend(e, n), s < 0 || s >= this.size)
1689
1759
  return { index: -1, total: this.total ?? this.getTotal(), cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1690
1760
  if (!i)
1691
1761
  break;
1692
- const c = this.deltas.get(s) ?? 0;
1693
- if (this._materialize(s), (this.deltas.get(s) ?? 0) === c)
1762
+ const u = this.deltas.get(s) ?? 0;
1763
+ if (this._materialize(s), (this.deltas.get(s) ?? 0) === u)
1694
1764
  break;
1695
1765
  }
1696
- const l = this.prefixSum(s);
1766
+ const a = this.prefixSum(s);
1697
1767
  return {
1698
1768
  index: s,
1699
- total: this.total ?? l.total,
1700
- cumulative: l.cumulative,
1701
- currentValue: l.currentValue,
1702
- safeIndex: l.safeIndex
1769
+ total: this.total ?? a.total,
1770
+ cumulative: a.cumulative,
1771
+ currentValue: a.currentValue,
1772
+ safeIndex: a.safeIndex
1703
1773
  };
1704
1774
  }
1705
1775
  /**
@@ -1711,63 +1781,63 @@ class ge {
1711
1781
  * @param {boolean} chooseLowerBound - When true, finds the smallest index meeting or exceeding the target; otherwise finds the largest index not exceeding it.
1712
1782
  * @returns {number} The candidate index (may be out of range when no index satisfies the condition).
1713
1783
  */
1714
- _descend(t, e) {
1784
+ _descend(e, t) {
1715
1785
  let n = 0, i = 0, s = 1;
1716
1786
  for (; s << 1 <= this.size; )
1717
1787
  s <<= 1;
1718
1788
  for (; s > 0; s >>= 1) {
1719
- const l = n + s;
1720
- if (l <= this.size) {
1721
- const d = (this.tree.get(l) ?? 0) + this.baseValue * s;
1722
- (e ? i + d < t : i + d <= t) && (n = l, i += d);
1789
+ const a = n + s;
1790
+ if (a <= this.size) {
1791
+ const p = (this.tree.get(a) ?? 0) + this.baseValue * s;
1792
+ (t ? i + p < e : i + p <= e) && (n = a, i += p);
1723
1793
  }
1724
1794
  }
1725
- return e ? n : n - 1;
1795
+ return t ? n : n - 1;
1726
1796
  }
1727
1797
  /**
1728
1798
  * Executes a binary search using bigint arithmetic for extremely large sizes.
1729
1799
  *
1730
1800
  * 非常に大きなサイズに対して bigint 演算を用いた二分探索を実施。
1731
1801
  */
1732
- _findIndexLarge(t, e, n) {
1802
+ _findIndexLarge(e, t, n) {
1733
1803
  if (this.size === 0)
1734
1804
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1735
- const i = Rr(this.size);
1805
+ const i = Xr(this.size);
1736
1806
  if (i === 0n)
1737
1807
  return { index: -1, total: this.total ?? 0, cumulative: void 0, currentValue: void 0, safeIndex: void 0 };
1738
- this._materializeRanges(e.materializeOption);
1739
- const s = e.materializeOption?.materialize === !0;
1808
+ this._materializeRanges(t.materializeOption);
1809
+ const s = t.materializeOption?.materialize === !0;
1740
1810
  for (; ; ) {
1741
- let l = 0n, c = i - 1n, d, b, I = this.total;
1742
- for (; l <= c; ) {
1743
- const p = l + c >> 1n, V = Number(p), z = this.prefixSum(V);
1744
- if (I = z.total, n ? z.cumulative >= t : z.cumulative <= t)
1745
- if (d = p, b = z, n) {
1746
- if (p === 0n)
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) {
1816
+ if (h === 0n)
1747
1817
  break;
1748
- c = p - 1n;
1818
+ u = h - 1n;
1749
1819
  } else
1750
- l = p + 1n;
1820
+ a = h + 1n;
1751
1821
  else if (n)
1752
- l = p + 1n;
1822
+ a = h + 1n;
1753
1823
  else {
1754
- if (p === 0n)
1824
+ if (h === 0n)
1755
1825
  break;
1756
- c = p - 1n;
1826
+ u = h - 1n;
1757
1827
  }
1758
1828
  }
1759
- const v = b, C = d !== void 0 ? Number(d) : -1;
1829
+ const T = b, C = p !== void 0 ? Number(p) : -1;
1760
1830
  if (s && C >= 0) {
1761
- const p = this.deltas.get(C) ?? 0;
1762
- if (this._materialize(C), (this.deltas.get(C) ?? 0) !== p)
1831
+ const h = this.deltas.get(C) ?? 0;
1832
+ if (this._materialize(C), (this.deltas.get(C) ?? 0) !== h)
1763
1833
  continue;
1764
1834
  }
1765
1835
  return {
1766
1836
  index: C,
1767
1837
  total: I,
1768
- cumulative: v?.cumulative,
1769
- currentValue: v?.currentValue,
1770
- safeIndex: v?.safeIndex
1838
+ cumulative: T?.cumulative,
1839
+ currentValue: T?.currentValue,
1840
+ safeIndex: T?.safeIndex
1771
1841
  };
1772
1842
  }
1773
1843
  }
@@ -1779,24 +1849,24 @@ class ge {
1779
1849
  * @param {MaterializeConfig} [options] - Optional settings for materializing values.
1780
1850
  * @returns {{ cumulative: number; total: number | undefined; currentValue: number; safeIndex: number }} The cumulative sum of values from index 0 to the given index, the total sum, and the value at the given index.
1781
1851
  */
1782
- prefixSum(t, e) {
1783
- if (t < 0 || Number.isNaN(t))
1852
+ prefixSum(e, t) {
1853
+ if (e < 0 || Number.isNaN(e))
1784
1854
  return { cumulative: 0, total: this.total, currentValue: 0, safeIndex: 0 };
1785
1855
  if (this.size === 0)
1786
1856
  return { cumulative: 0, total: this.total ?? 0, currentValue: 0, safeIndex: 0 };
1787
- const n = rt(Math.trunc(t), 0, this.size - 1), i = e?.materializeOption;
1857
+ const n = se(Math.trunc(e), 0, this.size - 1), i = t?.materializeOption;
1788
1858
  this._materializeRanges(i, n, !0);
1789
- let s = 0, l = n + 1;
1790
- for (; l > 0; ) {
1791
- const d = this.tree.get(l) ?? 0;
1792
- s += d;
1793
- const b = Pe(l);
1859
+ let s = 0, a = n + 1;
1860
+ for (; a > 0; ) {
1861
+ const p = this.tree.get(a) ?? 0;
1862
+ s += p;
1863
+ const b = yt(a);
1794
1864
  if (b === 0)
1795
1865
  break;
1796
- l -= b;
1866
+ a -= b;
1797
1867
  }
1798
- const c = i?.materialize ? this.get(n) : (this.deltas.get(n) || 0) + this.baseValue;
1799
- return { cumulative: s + this.baseValue * (n + 1), total: this.total, currentValue: c, safeIndex: n };
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 };
1800
1870
  }
1801
1871
  /**
1802
1872
  * @method get
@@ -1806,13 +1876,13 @@ class ge {
1806
1876
  * @param {MaterializeConfig} [options] - Optional settings for materializing values.
1807
1877
  * @returns {number} The value at the given index.
1808
1878
  */
1809
- get(t, e) {
1879
+ get(e, t) {
1810
1880
  if (this.size === 0)
1811
1881
  return 0;
1812
- if (!Number.isInteger(t) || t < 0 || t >= this.size)
1882
+ if (!Number.isInteger(e) || e < 0 || e >= this.size)
1813
1883
  throw new Error("Index out of bounds");
1814
- const n = e?.materializeOption;
1815
- return this._materializeRanges(n, t), (this.deltas.get(t) ?? 0) + this.baseValue;
1884
+ const n = t?.materializeOption;
1885
+ return this._materializeRanges(n, e), (this.deltas.get(e) ?? 0) + this.baseValue;
1816
1886
  }
1817
1887
  /**
1818
1888
  * @method getTotal
@@ -1821,15 +1891,15 @@ class ge {
1821
1891
  * @param {MaterializeConfig} [options] - Optional settings for materializing values.
1822
1892
  * @returns {number} The total sum of all values.
1823
1893
  */
1824
- getTotal(t) {
1825
- const e = t?.materializeOption;
1826
- if (this._materializeRanges(e), this.total === void 0)
1894
+ getTotal(e) {
1895
+ const t = e?.materializeOption;
1896
+ if (this._materializeRanges(t), this.total === void 0)
1827
1897
  if (this.size === 0)
1828
1898
  this.total = 0;
1829
1899
  else {
1830
1900
  this.total = this._computeTreeTotal();
1831
1901
  const n = this.prefixSum(this.getSize() - 1);
1832
- n.cumulative !== n.total && N.error("Inconsistent Fenwick Tree state");
1902
+ n.cumulative !== n.total && w.error("Inconsistent Fenwick Tree state");
1833
1903
  }
1834
1904
  return this.total;
1835
1905
  }
@@ -1840,26 +1910,26 @@ class ge {
1840
1910
  * @param {object} [options] - Optional settings for rebuilding.
1841
1911
  * @param {boolean} [options.materialize=false] - If true and `valueFn` is provided, re-materializes all values, recalculating `deltas` and `baseValue`.
1842
1912
  */
1843
- rebuildTree(t) {
1844
- if (t?.materialize && this.valueFn) {
1913
+ rebuildTree(e) {
1914
+ if (e?.materialize && this.valueFn) {
1845
1915
  const n = this.valueFn;
1846
1916
  this.reset(this.size, (i) => n(i), { materialize: !0 });
1847
1917
  return;
1848
1918
  }
1849
- const e = /* @__PURE__ */ new Map();
1919
+ const t = /* @__PURE__ */ new Map();
1850
1920
  for (const [n, i] of this.deltas.entries()) {
1851
1921
  if (i === 0)
1852
1922
  continue;
1853
1923
  let s = n + 1;
1854
1924
  for (; s <= this.size; ) {
1855
- e.set(s, (e.get(s) ?? 0) + i);
1856
- const l = Pe(s);
1857
- if (l === 0)
1925
+ t.set(s, (t.get(s) ?? 0) + i);
1926
+ const a = yt(s);
1927
+ if (a === 0)
1858
1928
  break;
1859
- s += l;
1929
+ s += a;
1860
1930
  }
1861
1931
  }
1862
- this.tree = e, this.total = this._computeTreeTotal();
1932
+ this.tree = t, this.total = this._computeTreeTotal();
1863
1933
  }
1864
1934
  /**
1865
1935
  * @method calculateAccumulatedError
@@ -1875,10 +1945,10 @@ class ge {
1875
1945
  calculateAccumulatedError() {
1876
1946
  if (this.total === void 0)
1877
1947
  return 0;
1878
- let t = this.baseValue * this.size;
1879
- for (const [e, n] of this.deltas)
1880
- e < this.size && (t += n);
1881
- return this.total - t;
1948
+ let e = this.baseValue * this.size;
1949
+ for (const [t, n] of this.deltas)
1950
+ t < this.size && (e += n);
1951
+ return this.total - e;
1882
1952
  }
1883
1953
  /**
1884
1954
  * @method changeSize
@@ -1916,27 +1986,27 @@ class ge {
1916
1986
  * throw。小数は切り捨て、負値は 0 に縮退 (`reset` の正規化規則と同一)。
1917
1987
  * @param {number} newSize - The new size of the tree.
1918
1988
  */
1919
- changeSize(t) {
1920
- if (!Number.isFinite(t))
1921
- throw new Error(`Size must be a finite number: ${t}`);
1922
- const e = Math.max(0, Math.trunc(t)), n = this.size;
1923
- if (e === n)
1989
+ changeSize(e) {
1990
+ if (!Number.isFinite(e))
1991
+ throw new Error(`Size must be a finite number: ${e}`);
1992
+ const t = Math.max(0, Math.trunc(e)), n = this.size;
1993
+ if (t === n)
1924
1994
  return;
1925
- if (e > n)
1995
+ if (t > n)
1926
1996
  if (n === 0 && this.deltas.size > 0) {
1927
1997
  for (const s of this.deltas.keys())
1928
- s >= e && this.deltas.delete(s);
1929
- this.size = e, this.rebuildTree();
1998
+ s >= t && this.deltas.delete(s);
1999
+ this.size = t, this.rebuildTree();
1930
2000
  } else
1931
- this._growSize(n, e);
2001
+ this._growSize(n, t);
1932
2002
  else {
1933
- if (e > 0)
2003
+ if (t > 0)
1934
2004
  for (const s of this.deltas.keys())
1935
- s >= e && this.deltas.delete(s);
1936
- this.size = e, this.rebuildTree();
2005
+ s >= t && this.deltas.delete(s);
2006
+ this.size = t, this.rebuildTree();
1937
2007
  }
1938
2008
  const i = this.prefixSum(this.getSize() - 1);
1939
- i.cumulative !== i.total && N.error("Inconsistent Fenwick Tree state");
2009
+ i.cumulative !== i.total && w.error("Inconsistent Fenwick Tree state");
1940
2010
  }
1941
2011
  /**
1942
2012
  * @private
@@ -1947,15 +2017,15 @@ class ge {
1947
2017
  * @param {number} newSize - The new size (inclusive upper bound of the new node range).
1948
2018
  * @returns {number} The minimum left boundary `t - lowestSetBit(t)` of the newly-activated nodes.
1949
2019
  */
1950
- static _minCoveredLowBound(t, e) {
2020
+ static _minCoveredLowBound(e, t) {
1951
2021
  let n = 1;
1952
2022
  for (; ; ) {
1953
2023
  const i = n * 2;
1954
- if (Math.floor(e / i) * i <= t)
2024
+ if (Math.floor(t / i) * i <= e)
1955
2025
  break;
1956
2026
  n = i;
1957
2027
  }
1958
- return n * Math.floor(t / n);
2028
+ return n * Math.floor(e / n);
1959
2029
  }
1960
2030
  /**
1961
2031
  * @private
@@ -1967,20 +2037,20 @@ class ge {
1967
2037
  * @param {number} oldSize - The previous size.
1968
2038
  * @param {number} newSize - The new (larger) size.
1969
2039
  */
1970
- _propagateDeltaToGrownNodes(t, e, n, i) {
1971
- let s = t + 1;
2040
+ _propagateDeltaToGrownNodes(e, t, n, i) {
2041
+ let s = e + 1;
1972
2042
  for (; s <= n; ) {
1973
- const l = Pe(s);
1974
- if (l === 0)
2043
+ const a = yt(s);
2044
+ if (a === 0)
1975
2045
  break;
1976
- s += l;
2046
+ s += a;
1977
2047
  }
1978
2048
  for (; s <= i; ) {
1979
- this.tree.set(s, (this.tree.get(s) ?? 0) + e);
1980
- const l = Pe(s);
1981
- if (l === 0)
2049
+ this.tree.set(s, (this.tree.get(s) ?? 0) + t);
2050
+ const a = yt(s);
2051
+ if (a === 0)
1982
2052
  break;
1983
- s += l;
2053
+ s += a;
1984
2054
  }
1985
2055
  }
1986
2056
  /**
@@ -1991,17 +2061,17 @@ class ge {
1991
2061
  * @param {number} oldSize - The previous size.
1992
2062
  * @param {number} newSize - The new (larger) size.
1993
2063
  */
1994
- _growSize(t, e) {
1995
- if (this.size = e, this.deltas.size > 0) {
1996
- const n = ge._minCoveredLowBound(t, e);
1997
- if (t - n < this.deltas.size)
1998
- for (let s = n; s < t; s++) {
1999
- const l = this.deltas.get(s);
2000
- l === void 0 || l === 0 || this._propagateDeltaToGrownNodes(s, l, t, e);
2064
+ _growSize(e, t) {
2065
+ if (this.size = t, this.deltas.size > 0) {
2066
+ const n = vt._minCoveredLowBound(e, t);
2067
+ if (e - n < this.deltas.size)
2068
+ for (let s = n; s < e; s++) {
2069
+ const a = this.deltas.get(s);
2070
+ a === void 0 || a === 0 || this._propagateDeltaToGrownNodes(s, a, e, t);
2001
2071
  }
2002
2072
  else
2003
- for (const [s, l] of this.deltas.entries())
2004
- l === 0 || s < n || this._propagateDeltaToGrownNodes(s, l, t, e);
2073
+ for (const [s, a] of this.deltas.entries())
2074
+ a === 0 || s < n || this._propagateDeltaToGrownNodes(s, a, e, t);
2005
2075
  }
2006
2076
  this.total = this._computeTreeTotal();
2007
2077
  }
@@ -2053,8 +2123,8 @@ class ge {
2053
2123
  * @param {MaterializeRange[]} [options.materializeOption.ranges] - Optional ranges for eager materialization.
2054
2124
  * @returns {{ index: number, total: number | undefined, cumulative: number | undefined, currentValue: number | undefined, safeIndex: number | undefined }} The 0-based index and the total sum, or -1 if not found.
2055
2125
  */
2056
- findIndexAtOrAfter(t, e) {
2057
- return this._findIndex(t, e ?? {}, !0);
2126
+ findIndexAtOrAfter(e, t) {
2127
+ return this._findIndex(e, t ?? {}, !0);
2058
2128
  }
2059
2129
  /**
2060
2130
  * @method findIndexAtOrBefore
@@ -2067,33 +2137,33 @@ class ge {
2067
2137
  * @param {MaterializeRange[]} [options.materializeOption.ranges] - Optional ranges for eager materialization。
2068
2138
  * @returns {{ index: number, total: number | undefined, cumulative: number | undefined, currentValue: number | undefined, safeIndex: number | undefined }} The 0-based index and the total sum, or -1 if not found.
2069
2139
  */
2070
- findIndexAtOrBefore(t, e) {
2071
- return this._findIndex(t, e ?? {}, !1);
2140
+ findIndexAtOrBefore(e, t) {
2141
+ return this._findIndex(e, t ?? {}, !1);
2072
2142
  }
2073
2143
  }
2074
- const Er = (r, t) => {
2075
- const e = r?.sampleRange, n = t?.sampleRange;
2076
- return e === n ? !1 : e && n ? e.from !== n.from || e.to !== n.to : !0;
2077
- }, Nr = (r, t, e) => {
2078
- const n = Number.isFinite(r) && r > 0 ? Math.trunc(r) : 0, i = x(null), s = x({ size: n, valueOrFn: t, options: e });
2079
- i.current === null && (i.current = new ge(n, t, e));
2080
- const l = i.current, c = s.current, d = c.size !== n, b = c.valueOrFn !== t, I = Er(c.options, e), v = c.size === 0 && n > 0 && (!i.current || i.current.base === 0);
2144
+ const $r = (r, e) => {
2145
+ const t = r?.sampleRange, n = e?.sampleRange;
2146
+ return t === n ? !1 : t && n ? t.from !== n.from || t.to !== n.to : !0;
2147
+ }, Wr = (r, e, t) => {
2148
+ 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);
2081
2151
  if (b || I) {
2082
- const C = e?.resetOnValueFnChange ?? !0;
2083
- I || b && C || v ? (e?.debug && N.debug("[useFenwickMapTree] reset", { valueOrFnChanged: b, optionsChanged: I }), l.reset(n, t, e)) : (d && (e?.debug && N.debug("[useFenwickMapTree] resize (with valueFn change)", { from: c.size, to: n }), l.changeSize(n)), e?.debug && N.debug("[useFenwickMapTree] setValueFn (no reset)", { valueOrFnChanged: b }), l.setValueFn(t, { reset: !1 })), s.current = { size: n, valueOrFn: t, options: e };
2084
- } else d && (e?.debug && N.debug("[useFenwickMapTree] resize", { from: c.size, to: n }), v ? l.reset(n, t, e) : l.changeSize(n), s.current = { size: n, valueOrFn: t, options: e });
2085
- return l;
2152
+ 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
+ return a;
2086
2156
  };
2087
- class Cr {
2157
+ class Ur {
2088
2158
  key;
2089
2159
  value;
2090
2160
  prev = null;
2091
2161
  next = null;
2092
- constructor(t, e) {
2093
- this.key = t, this.value = e;
2162
+ constructor(e, t) {
2163
+ this.key = e, this.value = t;
2094
2164
  }
2095
2165
  }
2096
- class He {
2166
+ class Kt {
2097
2167
  head = null;
2098
2168
  tail = null;
2099
2169
  /**
@@ -2102,8 +2172,8 @@ class He {
2102
2172
  * @description ノードをリストの末尾に追加し、最も最近使用されたものとしてマークします。
2103
2173
  * @param {DoublyLinkedListNode<K, V>} node - The node to add.
2104
2174
  */
2105
- addToTail(t) {
2106
- this.tail ? (this.tail.next = t, t.prev = this.tail, this.tail = t) : this.head = this.tail = t;
2175
+ addToTail(e) {
2176
+ this.tail ? (this.tail.next = e, e.prev = this.tail, this.tail = e) : this.head = this.tail = e;
2107
2177
  }
2108
2178
  /**
2109
2179
  * @method remove
@@ -2111,8 +2181,8 @@ class He {
2111
2181
  * @description 指定されたノードをリストから削除します。
2112
2182
  * @param {DoublyLinkedListNode<K, V>} node - The node to remove.
2113
2183
  */
2114
- remove(t) {
2115
- t.prev ? t.prev.next = t.next : this.head = t.next, t.next ? t.next.prev = t.prev : this.tail = t.prev, t.prev = null, t.next = null;
2184
+ remove(e) {
2185
+ e.prev ? e.prev.next = e.next : this.head = e.next, e.next ? e.next.prev = e.prev : this.tail = e.prev, e.prev = null, e.next = null;
2116
2186
  }
2117
2187
  /**
2118
2188
  * @method removeHead
@@ -2121,8 +2191,8 @@ class He {
2121
2191
  * @returns {DoublyLinkedListNode<K, V> | null} The removed head node, or null if the list is empty.
2122
2192
  */
2123
2193
  removeHead() {
2124
- const t = this.head;
2125
- return t && this.remove(t), t;
2194
+ const e = this.head;
2195
+ return e && this.remove(e), e;
2126
2196
  }
2127
2197
  /**
2128
2198
  * @method moveToTail
@@ -2130,250 +2200,274 @@ class He {
2130
2200
  * @description 既存のノードをリストの末尾に移動し、最も最近使用されたものとしてマークします。
2131
2201
  * @param {DoublyLinkedListNode<K, V>} node - The node to move.
2132
2202
  */
2133
- moveToTail(t) {
2134
- this.remove(t), this.addToTail(t);
2203
+ moveToTail(e) {
2204
+ this.remove(e), this.addToTail(e);
2135
2205
  }
2136
2206
  }
2137
- function Vr(r) {
2138
- const t = x(/* @__PURE__ */ new Map()), e = x(new He()), n = Math.floor(r), i = x(n);
2139
- Y(() => {
2207
+ function Kr(r) {
2208
+ const e = g(/* @__PURE__ */ new Map()), t = g(new Kt()), n = Math.floor(r), i = g(n);
2209
+ H(() => {
2140
2210
  if (i.current = n, Number.isNaN(n) || n < 0) {
2141
- N.warn(`useLruCache: invalid capacity ${r}; the cache will not store any entries.`), t.current.clear(), e.current = new He();
2211
+ w.warn(`useLruCache: invalid capacity ${r}; the cache will not store any entries.`), e.current.clear(), t.current = new Kt();
2142
2212
  return;
2143
2213
  }
2144
2214
  if (Number.isFinite(n))
2145
- for (; t.current.size > n; ) {
2146
- const I = e.current.removeHead();
2215
+ for (; e.current.size > n; ) {
2216
+ const I = t.current.removeHead();
2147
2217
  if (I)
2148
- t.current.delete(I.key);
2218
+ e.current.delete(I.key);
2149
2219
  else
2150
2220
  break;
2151
2221
  }
2152
2222
  }, [r, n]);
2153
2223
  const s = S((I) => {
2154
- const v = t.current.get(I);
2155
- if (v)
2156
- return e.current.moveToTail(v), v.value;
2157
- }, []), l = S((I, v) => {
2224
+ const T = e.current.get(I);
2225
+ if (T)
2226
+ return t.current.moveToTail(T), T.value;
2227
+ }, []), a = S((I, T) => {
2158
2228
  const C = i.current;
2159
2229
  if (Number.isNaN(C) || C <= 0)
2160
2230
  return;
2161
- let p = t.current.get(I);
2162
- if (p)
2163
- p.value = v, e.current.moveToTail(p);
2231
+ let h = e.current.get(I);
2232
+ if (h)
2233
+ h.value = T, t.current.moveToTail(h);
2164
2234
  else {
2165
- if (t.current.size >= C) {
2166
- const V = e.current.removeHead();
2167
- V && t.current.delete(V.key);
2235
+ if (e.current.size >= C) {
2236
+ const D = t.current.removeHead();
2237
+ D && e.current.delete(D.key);
2168
2238
  }
2169
- p = new Cr(I, v), t.current.set(I, p), e.current.addToTail(p);
2239
+ h = new Ur(I, T), e.current.set(I, h), t.current.addToTail(h);
2170
2240
  }
2171
- }, []), c = S((I) => t.current.has(I), []), d = S((I) => {
2172
- const v = t.current.get(I);
2173
- v && (e.current.remove(v), t.current.delete(I));
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));
2174
2244
  }, []), b = S(() => {
2175
- t.current.clear(), e.current = new He();
2245
+ e.current.clear(), t.current = new Kt();
2176
2246
  }, []);
2177
- return Ft(() => ({ get: s, set: l, has: c, remove: d, clear: b }), [s, l, c, d, b]);
2247
+ return Fe(() => ({ get: s, set: a, has: u, remove: p, clear: b }), [s, a, u, p, b]);
2178
2248
  }
2179
- const Dr = 1e4, qr = () => {
2180
- const { get: r, set: t, has: e, clear: n } = Vr(Dr);
2181
- return Ft(() => ({ get: r, set: t, has: e, clear: n }), [r, t, e, n]);
2182
- }, St = (r, t) => t <= 0 ? 0 : rt(r, 0, t - 1), Ze = (r) => ({
2249
+ const jr = 1e4, ln = () => {
2250
+ 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]);
2252
+ }, cn = (r, e) => {
2253
+ const t = g(e), n = g(r);
2254
+ ot(() => {
2255
+ t.current = e, n.current = r;
2256
+ }, [e, r]);
2257
+ const i = g(/* @__PURE__ */ new WeakMap());
2258
+ return S((s) => {
2259
+ if (!s || i.current.has(s))
2260
+ return;
2261
+ const a = (u) => {
2262
+ t.current?.enableBridge !== !1 && n.current.current?.applyWheel(u);
2263
+ };
2264
+ return s.addEventListener("wheel", a, { passive: !1 }), i.current.set(s, a), () => {
2265
+ i.current.get(s) === a && (s.removeEventListener("wheel", a), i.current.delete(s));
2266
+ };
2267
+ }, []);
2268
+ }, Se = (r, e) => e <= 0 ? 0 : se(r, 0, e - 1), ar = (r) => ({
2183
2269
  top: Math.max(0, r?.top ?? 0),
2184
2270
  bottom: Math.max(0, r?.bottom ?? 0)
2185
- }), Wt = (r, t) => r <= t ? 0 : r - t, Ie = (r, t) => r <= 0 ? 0 : r + t, Oe = 1e3, Je = 2e3, Ar = 1048576, Ne = (r) => {
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) => {
2272
+ const e = r.ownerDocument.defaultView?.getSelection();
2273
+ if (!e || e.isCollapsed || e.rangeCount === 0)
2274
+ return !1;
2275
+ for (let t = 0; t < e.rangeCount; t += 1)
2276
+ if (e.getRangeAt(t).intersectsNode(r))
2277
+ return !0;
2278
+ return !1;
2279
+ }, Dt = (r) => {
2186
2280
  if (!Number.isFinite(r)) return 0n;
2187
- const t = Math.trunc(r);
2188
- return t <= 0 ? 0n : BigInt(t);
2189
- }, Lr = (r, t, e, n, i, s, l, c) => {
2190
- const d = Ne(n);
2191
- if (d === 0n)
2281
+ const e = Math.trunc(r);
2282
+ return e <= 0 ? 0n : BigInt(e);
2283
+ }, Qr = (r, e, t, n, i, s, a, u) => {
2284
+ const p = Dt(n);
2285
+ if (p === 0n)
2192
2286
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2193
- const b = (A) => A < 0n ? 0n : A >= d ? d - 1n : A, I = { materializeOption: { materialize: !1 } }, { index: v, cumulative: C } = s.findIndexAtOrAfter(r, I);
2194
- let p;
2195
- v === -1 ? p = d - 1n : (C === r ? p = Ne(v + 1) : p = Ne(v), p >= d && (p = d - 1n)), r <= 0 && (p = 0n), c && r >= l && (p = d - 1n);
2196
- const V = (A) => {
2197
- const O = Number(A);
2287
+ const b = (P) => P < 0n ? 0n : P >= p ? p - 1n : P, I = { materializeOption: { materialize: !1 } }, { index: T, cumulative: C } = s.findIndexAtOrAfter(r, I);
2288
+ 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);
2198
2292
  if (!Number.isSafeInteger(O))
2199
2293
  return null;
2200
- const { cumulative: P } = s.prefixSum(O, { materializeOption: { materialize: !1 } });
2201
- if (!Number.isFinite(P))
2294
+ const { cumulative: M } = s.prefixSum(O, { materializeOption: { materialize: !1 } });
2295
+ if (!Number.isFinite(M))
2202
2296
  return null;
2203
- const { index: U } = s.findIndexAtOrAfter(P + 0.5, { materializeOption: { materialize: !1 } });
2204
- if (U === -1)
2297
+ const { index: K } = s.findIndexAtOrAfter(M + 0.5, { materializeOption: { materialize: !1 } });
2298
+ if (K === -1)
2205
2299
  return null;
2206
- const Z = Ne(U);
2207
- return Z > A ? Z : null;
2208
- }, z = (A) => {
2209
- let O = 0, P = A, U = A, Z = 0n, w = 0;
2210
- for (; P < d && O < t; ) {
2211
- const lt = Number(P), j = i(lt);
2212
- if (O += j, U = P, P += 1n, Z += 1n, !Number.isFinite(j) || j < 0)
2300
+ const te = Dt(K);
2301
+ 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)
2213
2307
  break;
2214
- if (j === 0) {
2215
- if (w += 1, w > Oe) {
2216
- const T = V(U);
2217
- if (T !== null && T > P)
2218
- P = T, w = 0;
2219
- else if (T !== null && T === P && i(Number(P)) > 0)
2220
- w = 0;
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;
2221
2315
  else
2222
2316
  break;
2223
2317
  }
2224
2318
  } else
2225
- w = 0;
2319
+ j = 0;
2226
2320
  }
2227
- return Z === 0n && (U = A), { height: O, end: U };
2321
+ return te === 0n && (K = P), { height: O, end: K };
2228
2322
  };
2229
- let { height: W, end: at } = z(p);
2230
- if (W < t && p > 0n) {
2231
- let A = p, O = W, P = 0;
2232
- for (; A > 0n && O < t; ) {
2233
- A -= 1n;
2234
- const Z = Number(A), w = i(Z);
2235
- if (O += w, !Number.isFinite(w) || w < 0)
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; ) {
2327
+ P -= 1n;
2328
+ const te = Number(P), j = i(te);
2329
+ if (O += j, !Number.isFinite(j) || j < 0)
2236
2330
  break;
2237
- if (w === 0) {
2238
- if (P += 1, P > Oe) {
2239
- const lt = Number(A);
2240
- if (!Number.isSafeInteger(lt))
2331
+ if (j === 0) {
2332
+ if (M += 1, M > Ft) {
2333
+ const _ = Number(P);
2334
+ if (!Number.isSafeInteger(_))
2241
2335
  break;
2242
- const { cumulative: j } = s.prefixSum(lt, { materializeOption: { materialize: !1 } });
2243
- if (!Number.isFinite(j))
2336
+ const { cumulative: G } = s.prefixSum(_, { materializeOption: { materialize: !1 } });
2337
+ if (!Number.isFinite(G))
2244
2338
  break;
2245
- const { index: T } = s.findIndexAtOrAfter(j - 0.5, { materializeOption: { materialize: !1 } }), q = T === -1 ? -1n : Ne(T);
2246
- if (q >= 0n && q < A)
2247
- A = q + 1n, P = 0;
2248
- else if (q === A && A >= 1n && i(Number(A - 1n)) > 0)
2249
- P = 0;
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)
2343
+ M = 0;
2250
2344
  else
2251
2345
  break;
2252
2346
  }
2253
2347
  } else
2254
- P = 0;
2348
+ M = 0;
2255
2349
  }
2256
- p = b(A);
2257
- const U = z(p);
2258
- W = U.height, at = U.end;
2350
+ h = b(P);
2351
+ const K = Z(h);
2352
+ Y = K.height, ue = K.end;
2259
2353
  }
2260
- const Q = b(p), tt = b(at), xt = b(Q - BigInt(Math.max(0, e))), Et = b(tt + BigInt(Math.max(0, e)));
2354
+ const de = b(h), oe = b(ue), ae = b(de - BigInt(Math.max(0, t))), fe = b(oe + BigInt(Math.max(0, t)));
2261
2355
  return {
2262
- renderingStartIndex: St(Number(xt), n),
2263
- renderingEndIndex: St(Number(Et), n),
2264
- visibleStartIndex: St(Number(Q), n),
2265
- visibleEndIndex: St(Number(tt), n)
2356
+ renderingStartIndex: Se(Number(ae), n),
2357
+ renderingEndIndex: Se(Number(fe), n),
2358
+ visibleStartIndex: Se(Number(de), n),
2359
+ visibleEndIndex: Se(Number(oe), n)
2266
2360
  };
2267
- }, _r = (r, t, e, n, i, s, l) => {
2361
+ }, en = (r, e, t, n, i, s, a) => {
2268
2362
  if (n === 0)
2269
2363
  return { renderingStartIndex: 0, renderingEndIndex: 0, visibleStartIndex: 0, visibleEndIndex: 0 };
2270
- const c = Number.isFinite(l), d = c ? Math.min(Math.max(0, r), l) : Math.max(0, r);
2364
+ const u = Number.isFinite(a), p = u ? Math.min(Math.max(0, r), a) : Math.max(0, r);
2271
2365
  if (n >= Number.MAX_SAFE_INTEGER)
2272
- return Lr(d, t, e, n, i, s, l, c);
2273
- const { index: b, cumulative: I, currentValue: v } = s.findIndexAtOrAfter(d, { materializeOption: { materialize: !1 } }), C = b === -1 ? t <= 0 || (I ?? 0) < d + (v ?? 0) ? n - 1 : 0 : b;
2274
- let p = St(C, n), V = 0;
2275
- if (b !== -1 && I === d)
2276
- p = St(b + 1, n), V = 0;
2277
- else if (p === b && I !== void 0 && v !== void 0)
2278
- V = I - v - d;
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;
2369
+ 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;
2279
2373
  else {
2280
- const { cumulative: A, currentValue: O } = s.prefixSum(p, { materializeOption: { materialize: !1 } });
2281
- V = (A ?? 0) - (O ?? 0) - d;
2374
+ const { cumulative: P, currentValue: O } = s.prefixSum(h, { materializeOption: { materialize: !1 } });
2375
+ D = (P ?? 0) - (O ?? 0) - p;
2282
2376
  }
2283
- const z = V, W = (A, O) => {
2284
- let P = A, U = O, Z = 0;
2285
- for (; P < n && U < t; ) {
2286
- const w = i(P);
2287
- if (U += w, P++, !Number.isFinite(w) || w < 0)
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)
2288
2382
  break;
2289
- if (w === 0) {
2290
- if (Z++, Z > Oe) {
2291
- const { cumulative: lt } = s.prefixSum(P - 1, { materializeOption: { materialize: !1 } }), { index: j } = Number.isFinite(lt) ? s.findIndexAtOrAfter(lt + 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2292
- if (j > P)
2293
- P = j, Z = 0;
2294
- else if (j === P && i(P) > 0)
2295
- Z = 0;
2383
+ if (j === 0) {
2384
+ 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)
2389
+ te = 0;
2296
2390
  else
2297
2391
  break;
2298
2392
  }
2299
2393
  } else
2300
- Z = 0;
2394
+ te = 0;
2301
2395
  }
2302
- return { cursor: P, height: U };
2303
- }, at = W(p, V);
2304
- let Q = at.cursor;
2305
- if (V = at.height, V < t && p > 0) {
2306
- let A = V + Math.abs(Math.min(0, z)), O = p - 1, P = 0;
2307
- for (; O >= 0 && A < t; ) {
2308
- const Z = i(O);
2309
- if (A += Z, !Number.isFinite(Z) || Z < 0) {
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);
2403
+ if (P += te, !Number.isFinite(te) || te < 0) {
2310
2404
  O--;
2311
2405
  break;
2312
2406
  }
2313
- if (Z === 0) {
2314
- if (P++, P > Oe) {
2315
- const { cumulative: w } = s.prefixSum(O, { materializeOption: { materialize: !1 } }), { index: lt } = Number.isFinite(w) ? s.findIndexAtOrAfter(w - 0.5, { materializeOption: { materialize: !1 } }) : { index: -1 };
2316
- if (lt !== -1 && lt < O) {
2317
- O = lt, P = 0;
2407
+ if (te === 0) {
2408
+ 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;
2318
2412
  continue;
2319
2413
  }
2320
- if (lt === O && O >= 1 && i(O - 1) > 0)
2321
- P = 0;
2414
+ if (_ === O && O >= 1 && i(O - 1) > 0)
2415
+ M = 0;
2322
2416
  else {
2323
2417
  O--;
2324
2418
  break;
2325
2419
  }
2326
2420
  }
2327
2421
  } else
2328
- P = 0;
2422
+ M = 0;
2329
2423
  O--;
2330
2424
  }
2331
- p = St(O + 1, n);
2332
- const U = W(p, 0);
2333
- Q = U.cursor, V = U.height;
2425
+ h = Se(O + 1, n);
2426
+ const K = Y(h, 0);
2427
+ de = K.cursor, D = K.height;
2334
2428
  }
2335
- const tt = St(p - e, n), xt = St(Math.max(Q - 1, p), n), Et = St(xt + e, n);
2336
- return { renderingStartIndex: tt, renderingEndIndex: Et, visibleStartIndex: p, visibleEndIndex: xt };
2337
- }, Qe = (r, t, e) => {
2338
- const n = Math.max(0, t ?? 0), i = x({ last: 0, id: null, arg: null }).current;
2339
- return Y(
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
+ }, cr = (r, e, t) => {
2432
+ const n = Math.max(0, e ?? 0), i = g({ last: 0, id: null, arg: null }).current;
2433
+ return H(
2340
2434
  () => () => {
2341
2435
  if (i.id !== null && (cancelAnimationFrame(i.id), i.id = null), i.arg !== null && r.current) {
2342
2436
  try {
2343
- e(r.current, i.arg);
2437
+ t(r.current, i.arg);
2344
2438
  } catch (s) {
2345
2439
  console.error("[useThrottledInvoker] Error flushing pending callback on unmount", s);
2346
2440
  }
2347
2441
  i.arg = null;
2348
2442
  }
2349
2443
  },
2350
- [i, r, e]
2444
+ [i, r, t]
2351
2445
  ), S(
2352
2446
  (s) => {
2353
2447
  if (i.arg = s, i.id !== null) return;
2354
- const l = (c) => {
2448
+ const a = (u) => {
2355
2449
  if (i.id = null, i.arg === null) return;
2356
- const d = c - i.last;
2357
- if (n === 0 || i.last === 0 || d >= n) {
2450
+ const p = u - i.last;
2451
+ if (n === 0 || i.last === 0 || p >= n) {
2358
2452
  if (r.current)
2359
2453
  try {
2360
- e(r.current, i.arg);
2454
+ t(r.current, i.arg);
2361
2455
  } catch (b) {
2362
2456
  console.error("[useThrottledInvoker] Error invoking callback", b);
2363
2457
  }
2364
- i.arg = null, i.last = c;
2458
+ i.arg = null, i.last = u;
2365
2459
  }
2366
- i.arg !== null && (i.id = requestAnimationFrame(l));
2460
+ i.arg !== null && (i.id = requestAnimationFrame(a));
2367
2461
  };
2368
- i.id = requestAnimationFrame(l);
2462
+ i.id = requestAnimationFrame(a);
2369
2463
  },
2370
- [n, e, r, i]
2464
+ [n, t, r, i]
2371
2465
  );
2372
- }, Or = nr.memo(({ index: r, top: t, height: e, item: n, children: i, clipItemHeight: s, enableKeyboardNavigation: l, onKeyDown: c, onFocus: d, registerItemRef: b }) => {
2373
- const I = S((V) => b(r, V), [r, b]), v = S((V) => c(V, r), [r, c]), C = S(() => d(r), [r, d]), p = S((V) => {
2374
- V.currentTarget.focus({ preventScroll: !0 });
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 });
2375
2469
  }, []);
2376
- return /* @__PURE__ */ ot(
2470
+ return /* @__PURE__ */ le(
2377
2471
  "div",
2378
2472
  {
2379
2473
  ref: I,
@@ -2381,621 +2475,643 @@ const Dr = 1e4, qr = () => {
2381
2475
  "data-virtualscroll-item": "true",
2382
2476
  className: "aqvs-item-container",
2383
2477
  style: {
2384
- top: t,
2385
- height: e,
2478
+ top: e,
2479
+ height: t,
2386
2480
  overflow: s ? "hidden" : void 0
2387
2481
  },
2388
- tabIndex: l ? -1 : void 0,
2389
- onPointerDown: l ? p : void 0,
2390
- onKeyDownCapture: l ? v : void 0,
2391
- onFocusCapture: l ? C : void 0,
2482
+ tabIndex: a ? -1 : void 0,
2483
+ onPointerDown: a ? h : void 0,
2484
+ onKeyDownCapture: a ? T : void 0,
2485
+ onFocusCapture: a ? C : void 0,
2392
2486
  children: i(n, r)
2393
2487
  }
2394
2488
  );
2395
- }), kr = ({
2489
+ }), rn = ({
2396
2490
  itemCount: r,
2397
- getItem: t,
2398
- getItemKey: e,
2491
+ getItem: e,
2492
+ getItemKey: t,
2399
2493
  getItemHeight: n,
2400
2494
  viewportSize: i,
2401
2495
  overscanCount: s = 15,
2402
- className: l,
2403
- testId: c,
2404
- onScroll: d,
2496
+ className: a,
2497
+ testId: u,
2498
+ onScroll: p,
2405
2499
  onRangeChange: b,
2406
2500
  children: I,
2407
- background: v,
2501
+ background: T,
2408
2502
  initialScrollIndex: C,
2409
- initialScrollOffset: p,
2410
- initialScrollAnchor: V,
2411
- callbackThrottleMs: z = 5,
2412
- contentInsets: W,
2413
- onItemFocus: at,
2414
- scrollBarOptions: Q,
2415
- behaviorOptions: tt,
2416
- onWheelHorizontal: xt,
2417
- contentProps: Et
2418
- }, A) => {
2419
- const { width: O, enableThumbDrag: P, enableTrackClick: U, enableArrowButtons: Z, enableScrollToTopBottomButtons: w, renderThumbOverlay: lt, tapScrollCircleOptions: j } = Q ?? {}, { enablePointerDrag: T, pointerDragInputs: q, enableKeyboardNavigation: H = !0, wheelSpeedMultiplier: Ht, inertiaOptions: Dt, clipItemHeight: et = !1, resetOnGetItemHeightChange: nt = !1 } = tt ?? {}, G = x(null), J = x({
2503
+ initialScrollOffset: h,
2504
+ initialScrollAnchor: D,
2505
+ callbackThrottleMs: Z = 5,
2506
+ contentInsets: Y,
2507
+ onItemFocus: ue,
2508
+ scrollBarOptions: de,
2509
+ behaviorOptions: oe,
2510
+ onWheelHorizontal: ae,
2511
+ horizontalKeyInputs: fe,
2512
+ horizontalKeyStep: P = Zr,
2513
+ contentProps: O
2514
+ }, 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({
2420
2518
  renderingStartIndex: 0,
2421
2519
  renderingEndIndex: 0,
2422
2520
  visibleStartIndex: 0,
2423
2521
  visibleEndIndex: 0,
2424
2522
  scrollPosition: 0,
2425
2523
  totalHeight: 0
2426
- }), vt = x(V && r > 0 ? { index: rt(Math.trunc(V.index), 0, r - 1), align: "top", offset: -Math.max(0, V.offsetPx ?? 0) } : null), Lt = x(!1), jt = x(!0);
2427
- Y(() => {
2428
- if (jt.current) {
2429
- jt.current = !1;
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
+ if (dt.current) {
2527
+ dt.current = !1;
2430
2528
  return;
2431
2529
  }
2432
- nt && (vt.current = null);
2433
- }, [nt, n]);
2434
- const R = Ft(() => Ze(W), [W]), [de] = re(() => {
2435
- const u = V?.index ?? C, m = typeof u == "number" && Number.isFinite(u) ? Math.max(0, Math.trunc(u)) : 0;
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;
2436
2534
  return { from: Math.max(0, m - 50), to: m + 50 };
2437
- }), it = Ft(
2535
+ }), pt = Fe(
2438
2536
  // 目的: Fenwick Tree のオプション設定
2439
2537
  // 依存関係: resetOnGetItemHeightChange, initialSampleRange (マウント時固定)
2440
2538
  // itemCount には依存させない (依存させると追記のたびに options 参照が変わり、計測済み高さが全消去される)。
2441
2539
  // この useMemo により sampleRange を毎レンダー新規生成しない = 参照同一性由来の破壊的 reset を防ぐ。
2442
2540
  () => ({
2443
- sampleRange: de,
2444
- resetOnValueFnChange: nt,
2541
+ sampleRange: ft,
2542
+ resetOnValueFnChange: Ne,
2445
2543
  materialize: !0
2446
2544
  }),
2447
- [nt, de]
2448
- ), E = Nr(r, n, it), [Vt] = re(() => {
2449
- let a = 0, u = 0;
2450
- if (V && r > 0) {
2451
- const m = rt(Math.trunc(V.index), 0, r - 1), D = Math.max(0, V.offsetPx ?? 0), _ = rt(m - s * 2, 0, r - 1), F = rt(m + s * 2, 0, r - 1), $ = m > 0 || D > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: _, to: F }] } } : void 0, { cumulative: K, total: Rt, currentValue: pt } = E.prefixSum(m, $), ht = Math.max(K - pt + D, 0);
2452
- a = Ie(ht, R.top), u = Rt ?? E.getTotal();
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();
2453
2551
  } else if (typeof C == "number") {
2454
- const m = rt(C, 0, r - 1), D = rt(m - s * 2, 0, r - 1), _ = rt(m + s * 2, 0, r - 1), F = C > 0 ? { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } } : void 0, { cumulative: $, total: K, currentValue: Rt } = E.prefixSum(C, F), pt = Math.max($ - Rt, 0);
2455
- a = Ie(pt, R.top), u = K ?? E.getTotal();
2456
- } else typeof p == "number" && (a = Ie(Math.max(p, 0), R.top)), u = E.getTotal();
2457
- return { position: a, total: u };
2458
- }), [zt, Jt] = re(Vt.position), [$t, h] = re(Vt.total), k = x(Vt.position), gt = x(R.top), X = x(d ?? void 0), Pt = x(b ?? void 0), ct = x(/* @__PURE__ */ new Map()), It = x(null), Mt = x(null), [yt, ut] = re(null), [At, dt] = re(!1), st = x(null), _t = x(!1), Xt = x(0), Nt = x(!1), ne = x(!1), Gt = x(r);
2459
- Gt.current !== r && (Gt.current = r, ne.current = !0), Y(() => {
2460
- X.current = d ?? void 0, Pt.current = b ?? void 0;
2461
- }, [b, d]);
2462
- const Ct = S(
2463
- (a) => {
2464
- if (H && a && typeof a.focus == "function")
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;
2563
+ }, [b, p, ae]);
2564
+ const f = S(
2565
+ (o) => {
2566
+ if (N && o && typeof o.focus == "function")
2465
2567
  try {
2466
- a.focus({ preventScroll: !0 });
2568
+ o.focus({ preventScroll: !0 });
2467
2569
  } catch {
2468
- a.focus();
2570
+ o.focus();
2469
2571
  }
2470
2572
  },
2471
- [H]
2472
- ), f = S((a, { position: u, totalHeight: m }) => {
2473
- a(u, m);
2474
- }, []), M = Qe(X, z, f), ft = S((a, u) => {
2475
- a(u);
2476
- }, []), Tt = Qe(Pt, z, ft), wt = x(R.top);
2477
- wt.current = R.top;
2478
- const ie = x(M);
2479
- ie.current = M, Y(() => (Lt.current = !1, () => {
2480
- Lt.current = !0, st.current && (clearTimeout(st.current), st.current = null);
2481
- }), []), Y(() => {
2482
- H || (ct.current.clear(), It.current = null, Mt.current = null);
2483
- }, [H]);
2484
- const Qt = S(
2485
- (a, u) => {
2486
- if (!u) {
2487
- ct.current.delete(a);
2573
+ [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);
2585
+ }, [N]);
2586
+ const mt = S(
2587
+ (o, c) => {
2588
+ if (!c) {
2589
+ Le.current.delete(o);
2488
2590
  return;
2489
2591
  }
2490
- H && (ct.current.set(a, u), It.current === a && (It.current = null, Mt.current = a, Ct(u)));
2592
+ N && (Le.current.set(o, c), ee.current === o && (ee.current = null, He.current = o, f(c)));
2491
2593
  },
2492
- [H, Ct]
2493
- ), te = 0.01, Kt = x({
2594
+ [N, f]
2595
+ ), ct = 0.01, ht = g({
2494
2596
  rafId: null,
2495
2597
  loopActive: !1,
2496
2598
  idleFrames: 0,
2497
- lastRenderedPosition: Vt.position
2498
- }), se = S(() => {
2499
- const a = Kt.current;
2500
- a.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(a.rafId), a.rafId = null, a.loopActive = !1, a.idleFrames = 0;
2599
+ lastRenderedPosition: J.position
2600
+ }), Mt = S(() => {
2601
+ const o = ht.current;
2602
+ o.rafId !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(o.rafId), o.rafId = null, o.loopActive = !1, o.idleFrames = 0;
2501
2603
  }, []);
2502
- Y(
2604
+ H(
2503
2605
  () => () => {
2504
- se();
2606
+ Mt();
2505
2607
  },
2506
- [se]
2608
+ [Mt]
2507
2609
  );
2508
- const fe = x(() => {
2509
- }), Zt = S(() => {
2510
- const a = Kt.current;
2511
- a.rafId = null;
2512
- const u = k.current, m = Wt(u, wt.current), D = E.getTotal();
2513
- if (Jt((F) => Math.abs(F - u) < te ? F : u), Math.abs(a.lastRenderedPosition - u) >= te ? (ie.current({ position: m, totalHeight: D }), a.lastRenderedPosition = u, a.idleFrames = 0) : a.idleFrames += 1, a.idleFrames >= 2) {
2514
- se();
2610
+ const zt = g(() => {
2611
+ }), bt = S(() => {
2612
+ const o = ht.current;
2613
+ 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
+ Mt();
2515
2617
  return;
2516
2618
  }
2517
2619
  if (typeof requestAnimationFrame == "function") {
2518
- a.rafId = requestAnimationFrame((F) => fe.current(F));
2620
+ o.rafId = requestAnimationFrame((F) => zt.current(F));
2519
2621
  return;
2520
2622
  }
2521
- a.loopActive = !1;
2522
- }, [E, se]);
2523
- fe.current = Zt;
2524
- const we = S(() => {
2525
- const a = Kt.current;
2526
- if (a.idleFrames = 0, !a.loopActive) {
2527
- if (a.loopActive = !0, typeof requestAnimationFrame == "function") {
2528
- a.rafId = requestAnimationFrame(Zt);
2623
+ o.loopActive = !1;
2624
+ }, [V, Mt]);
2625
+ zt.current = bt;
2626
+ const At = S(() => {
2627
+ const o = ht.current;
2628
+ if (o.idleFrames = 0, !o.loopActive) {
2629
+ if (o.loopActive = !0, typeof requestAnimationFrame == "function") {
2630
+ o.rafId = requestAnimationFrame(bt);
2529
2631
  return;
2530
2632
  }
2531
- a.loopActive = !1;
2633
+ o.loopActive = !1;
2532
2634
  }
2533
- }, [Zt]), mt = S(
2534
- (a, u) => {
2535
- const m = u?.immediate ?? !1, D = Wt(a, R.top);
2536
- if (k.current = a, m) {
2537
- Kt.current.lastRenderedPosition = a, Kt.current.idleFrames = 0, Jt(a), M({ position: D, totalHeight: E.getTotal() });
2635
+ }, [bt]), xe = S(
2636
+ (o, c) => {
2637
+ const m = c?.immediate ?? !1, z = je(o, R.top);
2638
+ if (ce.current = o, m) {
2639
+ ht.current.lastRenderedPosition = o, ht.current.idleFrames = 0, gt(o), Ie({ position: z, totalHeight: V.getTotal() });
2538
2640
  return;
2539
2641
  }
2540
- we();
2642
+ At();
2541
2643
  },
2542
- [we, E, R.top, M]
2543
- ), me = S((a) => {
2544
- const u = G.current;
2545
- if (!u)
2546
- return a;
2547
- const m = u.getScrollPosition();
2548
- Xt.current += 1;
2549
- const D = u.scrollTo(a);
2550
- return D === m && (Xt.current = Math.max(0, Xt.current - 1)), Math.abs(D - a) > 0.5 && (Nt.current = !0), D;
2551
- }, []), Ce = x(!1);
2552
- Y(() => {
2553
- if (!Ce.current)
2554
- if (Ce.current = !0, V == null && typeof C != "number" && typeof p == "number") {
2555
- const a = Ie(Math.max(p, 0), R.top), u = Math.abs(a - k.current) > 0.5;
2556
- mt(a, { immediate: !0 }), u && G.current?.scrollTo(a);
2644
+ [At, V, R.top, Ie]
2645
+ ), xt = S((o) => {
2646
+ const c = ne.current;
2647
+ if (!c)
2648
+ 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;
2653
+ }, []), Lt = g(!1);
2654
+ H(() => {
2655
+ 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);
2557
2659
  } else
2558
- mt(k.current, { immediate: !0 });
2559
- }, [V, C, p, R.top, mt]), Y(() => {
2560
- const a = E.getTotal();
2561
- if ($t !== a) {
2562
- h(a);
2660
+ xe(ce.current, { immediate: !0 });
2661
+ }, [D, C, h, R.top, xe]), H(() => {
2662
+ const o = V.getTotal();
2663
+ if (Be !== o) {
2664
+ et(o);
2563
2665
  return;
2564
2666
  }
2565
- if (Nt.current) {
2566
- Nt.current = !1;
2567
- const u = G.current;
2568
- if (u && Math.abs(u.getScrollPosition() - k.current) > 0.5) {
2569
- const m = me(k.current);
2570
- Nt.current = !1, mt(m, { immediate: !0 });
2667
+ if (tt.current) {
2668
+ tt.current = !1;
2669
+ const c = ne.current;
2670
+ if (c && Math.abs(c.getScrollPosition() - ce.current) > 0.5) {
2671
+ const m = xt(ce.current);
2672
+ tt.current = !1, xe(m, { immediate: !0 });
2571
2673
  }
2572
2674
  }
2573
- }, [E, $t, r, me, mt]), Y(() => {
2574
- if (vt.current !== null) {
2575
- const { index: a, align: u, offset: m } = vt.current, D = St(a, r), { cumulative: _, currentValue: F } = E.prefixSum(D, { materializeOption: { materialize: !1 } });
2576
- if (_ !== void 0 && F !== void 0) {
2577
- const $ = Math.max(_ - F, 0);
2578
- let K = $;
2579
- u === "bottom" ? K = _ - i : u === "center" && (K = $ + F / 2 - i / 2), m && (K -= m), K = Math.max(0, K);
2580
- const Rt = Math.max(0, $t + R.top + R.bottom - i), pt = Math.min(Ie(K, R.top), Rt);
2581
- Math.abs(pt - k.current) > 1 && (N.debug("[VirtualScroll] Drift correction", {
2582
- from: k.current,
2583
- to: pt,
2584
- targetIndex: D
2585
- }), Xt.current === 0 && (Xt.current += 1), G.current?.scrollTo(pt), mt(pt, { immediate: !0 }));
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", {
2684
+ from: ce.current,
2685
+ to: pe,
2686
+ targetIndex: z
2687
+ }), ye.current === 0 && (ye.current += 1), ne.current?.scrollTo(pe), xe(pe, { immediate: !0 }));
2586
2688
  }
2587
2689
  }
2588
- ne.current = !1;
2589
- }, [$t, E, r, R.top, mt, i, R.bottom]), Y(() => {
2590
- const a = gt.current;
2591
- if (a === R.top || (gt.current = R.top, vt.current))
2690
+ rt.current = !1;
2691
+ }, [Be, V, r, R.top, xe, X, R.bottom]), H(() => {
2692
+ const o = d.current;
2693
+ if (o === R.top || (d.current = R.top, Ye.current))
2592
2694
  return;
2593
- const u = Wt(k.current, a), m = Ie(u, R.top);
2594
- k.current = m, G.current?.scrollTo(m), mt(m, { immediate: !0 });
2595
- }, [R.top, mt]);
2596
- const Se = S(
2597
- (a, u) => {
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
+ }, [R.top, xe]);
2698
+ const Ot = S(
2699
+ (o, c) => {
2598
2700
  if (r === 0)
2599
2701
  return;
2600
- const m = St(a, r), D = E.get(m), _ = u - D, F = E.update(m, u);
2601
- F !== void 0 && h(F), N.debug("[VirtualScroll] Updated item size manually", { index: m, size: u, total: F });
2602
- let $ = vt.current ? vt.current.index : null;
2603
- if ($ === null) {
2604
- const K = k.current, Rt = Ze(W).top, pt = Wt(K, Rt), { index: ht, cumulative: Bt } = E.findIndexAtOrAfter(pt, { materializeOption: { materialize: !1 } });
2605
- $ = Bt !== void 0 && Bt === pt ? ht + 1 : ht;
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;
2606
2708
  }
2607
- if ($ !== -1 && m < $ && _ !== 0) {
2608
- const K = k.current, Rt = K + _;
2609
- me(Rt), mt(Rt, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (manual update)", { from: K, to: Rt, causedByIndex: m, delta: _, activeVisibleStartIndex: $ });
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 });
2610
2712
  }
2611
2713
  },
2612
- [E, r, me, mt, W]
2613
- ), Ut = S(
2614
- (a, u) => {
2615
- if (!G.current || r === 0)
2714
+ [V, r, xt, xe, Y]
2715
+ ), Je = S(
2716
+ (o, c) => {
2717
+ if (!ne.current || r === 0)
2616
2718
  return;
2617
- const m = St(a, r), D = St(m - s * 2, r), _ = St(m + s * 2, r), { cumulative: F, total: $, currentValue: K } = E.prefixSum(m, { materializeOption: { materialize: !0, ranges: [{ from: D, to: _ }] } });
2618
- if (N.debug("[VirtualScroll] Scrolling to index:", m, "ItemBottom:", F, "Total height:", $, "ItemHeight:", K, "safeIndexFrom:", D, "safeIndexTo:", _), !$)
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)
2619
2721
  return;
2620
- const Rt = Math.max(F - K, 0);
2621
- let pt = Rt;
2622
- u?.align === "bottom" ? pt = F - i : u?.align === "center" && (pt = Rt + K / 2 - i / 2), u?.offset && (pt -= u.offset), pt = Math.max(0, pt);
2623
- const ht = Ie(pt, R.top), Bt = G.current?.getContentSize() ?? $ + R.top + R.bottom, kt = Math.max(0, Bt - i), qt = Math.min(ht, kt);
2624
- vt.current = {
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 = {
2625
2727
  index: m,
2626
- align: u?.align,
2627
- offset: u?.offset
2728
+ align: c?.align,
2729
+ offset: c?.offset
2628
2730
  };
2629
- const Re = G.current?.getScrollPosition() ?? -1, Fe = Math.abs(Re - qt) > 0.5;
2630
- _t.current = !1, Xt.current = 0, Fe && (_t.current = !0, Xt.current += 1, G.current?.scrollTo(qt)), h($), mt(qt, { immediate: !0 }), N.debug("[VirtualScroll] Setting scroll position to:", qt, { original: ht, max: kt });
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 });
2631
2733
  },
2632
- [E, s, r, R.top, R.bottom, i, mt]
2633
- ), Ve = x(V && r === 0 ? V : null);
2634
- Y(() => {
2635
- const a = Ve.current;
2636
- !a || r === 0 || (Ve.current = null, Ut(rt(Math.trunc(a.index), 0, r - 1), { align: "top", offset: -Math.max(0, a.offsetPx ?? 0) }));
2637
- }, [r, Ut]);
2638
- const De = S(
2639
- (a) => {
2640
- if (!G.current || r === 0)
2734
+ [V, s, r, R.top, R.bottom, X, xe]
2735
+ ), Et = g(D && r === 0 ? D : null);
2736
+ H(() => {
2737
+ 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) }));
2739
+ }, [r, Je]);
2740
+ const Nt = S(
2741
+ (o) => {
2742
+ if (!ne.current || r === 0)
2641
2743
  return;
2642
- const u = E.getTotal(), m = rt(Math.floor(a), 0, u), { index: D, cumulative: _, currentValue: F } = E.findIndexAtOrAfter(m, { materializeOption: { materialize: !1 } }), K = (_ ?? 0) - (F ?? 0) - m;
2643
- Ut(D, { offset: K });
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 });
2644
2746
  },
2645
- [E, r, Ut]
2646
- ), be = S(() => {
2747
+ [V, r, Je]
2748
+ ), l = S(() => {
2647
2749
  if (r === 0)
2648
2750
  return null;
2649
- const a = Wt(k.current, R.top), { index: u, cumulative: m, currentValue: D } = E.findIndexAtOrAfter(a, { materializeOption: { materialize: !1 } });
2650
- if (u === -1)
2751
+ const o = je(ce.current, R.top), { index: c, cumulative: m, currentValue: z } = V.findIndexAtOrAfter(o, { materializeOption: { materialize: !1 } });
2752
+ if (c === -1)
2651
2753
  return { index: r - 1, offsetPx: 0 };
2652
- if (m === a)
2653
- return { index: rt(u + 1, 0, r - 1), offsetPx: 0 };
2654
- const _ = (m ?? 0) - (D ?? 0);
2655
- return { index: u, offsetPx: Math.max(0, a - _) };
2656
- }, [E, r, R.top]), Ae = S(
2657
- (a) => {
2658
- const u = Wt(k.current, R.top), m = typeof a == "function" ? a(u) : a;
2659
- De(m);
2660
- const D = G.current?.getScrollPosition(), _ = typeof D == "number" ? D : k.current;
2661
- return mt(_), Wt(_, wt.current);
2754
+ 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(
2759
+ (o) => {
2760
+ const c = je(ce.current, R.top), m = typeof o == "function" ? o(c) : o;
2761
+ Nt(m);
2762
+ const z = ne.current?.getScrollPosition(), L = typeof z == "number" ? z : ce.current;
2763
+ return xe(L), je(L, it.current);
2662
2764
  },
2663
- [R.top, De, mt]
2664
- ), ke = S(
2665
- (a, u) => {
2666
- N.debug("[VirtualScroll] Scroll position changed:", a);
2667
- const m = _t.current;
2668
- m && (_t.current = !1);
2669
- const D = Xt.current > 0;
2670
- if (D && (Xt.current = 0), m || D || ne.current || (vt.current = null), mt(a), w) {
2671
- if (m || D)
2765
+ [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)
2672
2780
  return;
2673
- const _ = a - u;
2674
- if (N.debug("[VirtualScroll] Scroll diff:", _, "New:", a, "Prev:", u), Math.abs(_) > 1) {
2675
- const F = _ > 0 ? "down" : "up";
2676
- ut(F), dt(!0), N.debug("[VirtualScroll] Showing scroll buttons. Direction:", F), st.current && clearTimeout(st.current), st.current = setTimeout(() => {
2677
- dt(!1), N.debug("[VirtualScroll] Hiding scroll buttons");
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");
2678
2786
  }, 2e3);
2679
2787
  }
2680
2788
  }
2681
2789
  },
2682
- [mt, w]
2683
- ), oe = Ft(() => Wt(zt, R.top), [R.top, zt]), pe = Ft(() => {
2684
- const a = E.getTotal(), u = _r(oe, i, s, r, n, E, a);
2685
- return N.debug("[VirtualScroll] Calculated rendering range:", () => ({
2686
- ...u,
2687
- scrollPosition: oe,
2688
- renderingContentSize: a,
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,
2796
+ renderingContentSize: o,
2689
2797
  overscanCount: s,
2690
- viewportSize: i
2691
- })), u;
2692
- }, [oe, i, s, r, n, E]), { renderingStartIndex: ae, renderingEndIndex: le, visibleStartIndex: ce, visibleEndIndex: xe } = pe, o = S(
2693
- (a, u) => {
2694
- if (!H || r === 0)
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
+ if (!N || r === 0)
2695
2803
  return;
2696
- const m = St(a, r);
2697
- if (!(u?.ensureVisible ?? !0)) {
2698
- const kt = ct.current.get(m);
2699
- kt && (It.current = null, Mt.current = m, Ct(kt));
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));
2700
2808
  return;
2701
2809
  }
2702
- const _ = E.prefixSum(m, { materializeOption: { materialize: !1 } }), F = _.currentValue, $ = Math.max(_.cumulative - F, 0), K = $ + F, Rt = Wt(k.current, R.top), pt = Rt + i;
2703
- if ($ < Rt || K > pt) {
2704
- Ut(m);
2705
- const kt = ct.current.get(m);
2706
- kt ? (It.current = null, Mt.current = m, Ct(kt)) : It.current = m;
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) {
2812
+ Je(m);
2813
+ const ke = Le.current.get(m);
2814
+ ke ? (ee.current = null, He.current = m, f(ke)) : ee.current = m;
2707
2815
  return;
2708
2816
  }
2709
- const Bt = ct.current.get(m);
2710
- if (Bt) {
2711
- It.current = null, Mt.current = m, Ct(Bt);
2817
+ const qe = Le.current.get(m);
2818
+ if (qe) {
2819
+ ee.current = null, He.current = m, f(qe);
2712
2820
  return;
2713
2821
  }
2714
- It.current = m;
2822
+ ee.current = m;
2715
2823
  },
2716
- [H, r, E, R.top, Ut, Ct, i]
2717
- ), g = S(
2718
- (a, u) => {
2719
- if (!H || a.defaultPrevented || a.altKey || a.metaKey || a.ctrlKey)
2720
- return;
2721
- const m = a.target;
2722
- if (m) {
2723
- const D = m.tagName;
2724
- if (D === "INPUT" || D === "TEXTAREA" || D === "SELECT" || m.isContentEditable)
2824
+ [N, r, V, R.top, Je, f, X]
2825
+ ), Jt = S(
2826
+ (o, c) => {
2827
+ if (!(!N || o.defaultPrevented) && !(o.altKey || o.metaKey || o.ctrlKey) && o.target === o.currentTarget && !o.currentTarget.isContentEditable) {
2828
+ if (o.key === "ArrowLeft" || o.key === "ArrowRight") {
2829
+ const m = k.current;
2830
+ if (!m)
2831
+ return;
2832
+ const z = o.shiftKey ? "shift-arrow" : "arrow";
2833
+ if (!fe?.includes(z) || o.shiftKey && Jr(o.currentTarget) || !(Number.isFinite(P) && P > 0))
2834
+ return;
2835
+ o.preventDefault(), m(o.key === "ArrowLeft" ? -P : P);
2725
2836
  return;
2726
- }
2727
- if (a.key === "ArrowDown") {
2728
- u < r - 1 && (a.preventDefault(), o(u + 1));
2729
- return;
2730
- }
2731
- if (a.key === "ArrowUp") {
2732
- u > 0 && (a.preventDefault(), o(u - 1));
2733
- return;
2734
- }
2735
- if (a.key === "PageDown") {
2736
- if (u < r - 1) {
2737
- a.preventDefault();
2738
- const { visibleStartIndex: D, visibleEndIndex: _ } = J.current, F = Math.max(_ - D + 1, 1), $ = Math.max(F, 1), K = St(Math.min(u + $, r - 1), r);
2739
- o(K);
2740
2837
  }
2741
- return;
2742
- }
2743
- if (a.key === "PageUp" && u > 0) {
2744
- a.preventDefault();
2745
- const { visibleStartIndex: D, visibleEndIndex: _ } = J.current, F = Math.max(_ - D + 1, 1), $ = Math.max(F, 1), K = St(u - $, r);
2746
- o(K);
2838
+ if (o.key === "ArrowDown") {
2839
+ c < r - 1 && (o.preventDefault(), St(c + 1));
2840
+ return;
2841
+ }
2842
+ if (o.key === "ArrowUp") {
2843
+ c > 0 && (o.preventDefault(), St(c - 1));
2844
+ return;
2845
+ }
2846
+ if (o.key === "PageDown") {
2847
+ if (c < r - 1) {
2848
+ 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);
2851
+ }
2852
+ return;
2853
+ }
2854
+ if (o.key === "PageUp" && c > 0) {
2855
+ 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);
2858
+ }
2747
2859
  }
2748
2860
  },
2749
- [H, r, o]
2750
- ), y = S(
2751
- (a) => {
2752
- if (!H)
2861
+ [N, r, St, fe, P]
2862
+ ), Qt = S(
2863
+ (o) => {
2864
+ if (!N)
2753
2865
  return;
2754
- const u = St(a, r);
2755
- It.current = null, Mt.current = u, at?.(u);
2866
+ const c = Se(o, r);
2867
+ ee.current = null, He.current = c, ue?.(c);
2756
2868
  },
2757
- [H, r, at]
2869
+ [N, r, ue]
2758
2870
  );
2759
- Y(() => {
2760
- const a = G.current?.getScrollPosition() ?? 0, u = k.current, m = Wt(u, R.top);
2761
- N.debug("[VirtualScroll] Range change effect triggered", () => ({
2762
- renderingStartIndex: ae,
2763
- renderingEndIndex: le,
2764
- visibleStartIndex: ce,
2765
- visibleEndIndex: xe,
2766
- scrollPositionState: zt,
2767
- paneScrollPosition: u,
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", () => ({
2874
+ renderingStartIndex: ve,
2875
+ renderingEndIndex: st,
2876
+ visibleStartIndex: Ke,
2877
+ visibleEndIndex: Pt,
2878
+ scrollPositionState: We,
2879
+ paneScrollPosition: c,
2768
2880
  logicalScrollPosition: m,
2769
- contentSize: $t,
2770
- scrollPaneScrollPosition: a
2771
- })), Tt({
2772
- renderingStartIndex: ae,
2773
- renderingEndIndex: le,
2774
- visibleStartIndex: ce,
2775
- visibleEndIndex: xe,
2881
+ contentSize: Be,
2882
+ scrollPaneScrollPosition: o
2883
+ })), _e({
2884
+ renderingStartIndex: ve,
2885
+ renderingEndIndex: st,
2886
+ visibleStartIndex: Ke,
2887
+ visibleEndIndex: Pt,
2776
2888
  scrollPosition: m,
2777
- totalHeight: $t
2889
+ totalHeight: Be
2778
2890
  });
2779
- }, [$t, le, ae, R.top, Tt, zt, xe, ce]);
2780
- const L = S(() => {
2781
- if (!w)
2891
+ }, [Be, st, ve, R.top, _e, We, Pt, Ke]);
2892
+ const mr = S(() => {
2893
+ if (!G)
2782
2894
  return null;
2783
- const a = At && yt !== null;
2784
- return /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-overlay", "data-visible": a, inert: !a, children: yt === "up" ? /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-top", children: /* @__PURE__ */ ot(
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(
2785
2897
  "button",
2786
2898
  {
2787
2899
  type: "button",
2788
2900
  className: "aqvs-scroll-to-edge-button",
2789
- tabIndex: a ? 0 : -1,
2901
+ tabIndex: o ? 0 : -1,
2790
2902
  onClick: (m) => {
2791
- m.stopPropagation(), _t.current = !0, Ut(0), dt(!1);
2903
+ m.stopPropagation(), we.current = !0, Je(0), Te(!1);
2792
2904
  },
2793
2905
  children: "Top"
2794
2906
  }
2795
- ) }) : /* @__PURE__ */ ot("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ ot(
2907
+ ) }) : /* @__PURE__ */ le("div", { className: "aqvs-scroll-to-edge-button-container aqvs-scroll-to-edge-button-container-bottom", children: /* @__PURE__ */ le(
2796
2908
  "button",
2797
2909
  {
2798
2910
  type: "button",
2799
2911
  className: "aqvs-scroll-to-edge-button",
2800
- tabIndex: a ? 0 : -1,
2912
+ tabIndex: o ? 0 : -1,
2801
2913
  onClick: (m) => {
2802
- m.stopPropagation(), _t.current = !0, Ut(r - 1), dt(!1);
2914
+ m.stopPropagation(), we.current = !0, Je(r - 1), Te(!1);
2803
2915
  },
2804
2916
  children: "Bottom"
2805
2917
  }
2806
2918
  ) }) });
2807
- }, [w, At, yt, Ut, r]), B = x(0), { visibleItems: bt, renderAnchor: Ot } = Ft(() => {
2919
+ }, [G, Ue, Ve, Je, r]), Yt = g(0), { visibleItems: Bt, renderAnchor: Ht } = Fe(() => {
2808
2920
  if (r === 0)
2809
2921
  return {
2810
- visibleItems: /* @__PURE__ */ ot("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ ot("div", { className: "aqvs-no-items-text", children: "No items" }) }),
2922
+ visibleItems: /* @__PURE__ */ le("div", { className: "aqvs-no-items-container", children: /* @__PURE__ */ le("div", { className: "aqvs-no-items-text", children: "No items" }) }),
2811
2923
  renderAnchor: 0
2812
2924
  };
2813
- const a = St(ae, r), u = St(le, r), { cumulative: m, currentValue: D } = E.prefixSum(a, { materializeOption: { materialize: !1 } }), _ = m - D;
2814
- Number.isFinite(_) && Math.abs(_ - B.current) > Ar && (B.current = _);
2815
- const F = B.current, $ = [], K = [];
2816
- let Rt = 0, pt = _;
2817
- for (let ht = a; ht <= u; ht++) {
2818
- if (K.length >= Je) {
2819
- N.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: Je, safeRenderingStartIndex: a, safeRenderingEndIndex: u });
2925
+ const o = Se(ve, r), c = Se(st, r), { cumulative: m, currentValue: z } = V.prefixSum(o, { materializeOption: { materialize: !1 } }), L = m - z;
2926
+ 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++) {
2930
+ if (re.length >= lr) {
2931
+ w.warn("[VirtualScroll] Rendered item count reached the safety cap; truncating render window.", { cap: lr, safeRenderingStartIndex: o, safeRenderingEndIndex: c });
2820
2932
  break;
2821
2933
  }
2822
- const Bt = n(ht), kt = E.get(ht), qt = Bt - kt;
2823
- qt !== 0 && $.push({ index: ht, value: Bt });
2824
- const Re = pt + Rt, Fe = e ? e(ht) : ht;
2825
- K.push(
2826
- /* @__PURE__ */ ot(
2827
- Or,
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;
2937
+ re.push(
2938
+ /* @__PURE__ */ le(
2939
+ tn,
2828
2940
  {
2829
- index: ht,
2830
- top: Re - F,
2831
- height: Bt,
2832
- item: t(ht),
2833
- clipItemHeight: et,
2834
- enableKeyboardNavigation: H,
2835
- onKeyDown: g,
2836
- onFocus: y,
2837
- registerItemRef: Qt,
2941
+ index: me,
2942
+ top: Vt - F,
2943
+ height: qe,
2944
+ item: e(me),
2945
+ clipItemHeight: Pe,
2946
+ enableKeyboardNavigation: N,
2947
+ onKeyDown: Jt,
2948
+ onFocus: Qt,
2949
+ registerItemRef: mt,
2838
2950
  children: I
2839
2951
  },
2840
- Fe
2952
+ qt
2841
2953
  )
2842
- ), Rt += qt, pt += kt;
2954
+ ), Me += Xe, pe += ke;
2843
2955
  }
2844
- return $.length > 0 && Promise.resolve().then(() => {
2845
- if (Lt.current)
2956
+ return W.length > 0 && Promise.resolve().then(() => {
2957
+ if (Ae.current)
2846
2958
  return;
2847
- let ht = 0;
2848
- for (const qt of $)
2849
- if (qt.index < ce) {
2850
- const Re = E.get(qt.index);
2851
- ht += qt.value - Re;
2959
+ let me = 0;
2960
+ for (const Xe of W)
2961
+ if (Xe.index < Ke) {
2962
+ const Vt = V.get(Xe.index);
2963
+ me += Xe.value - Vt;
2852
2964
  }
2853
- const Bt = E.updates($);
2854
- if (Lt.current || typeof Bt != "number")
2965
+ const qe = V.updates(W);
2966
+ if (Ae.current || typeof qe != "number")
2855
2967
  return;
2856
- h(Bt), N.debug("[VirtualScroll] Updated heights for items", $, "New total height:", Bt);
2857
- const kt = G.current?.getScrollPosition() ?? k.current;
2858
- if (ht !== 0) {
2859
- const qt = kt + ht;
2860
- me(qt), mt(qt, { immediate: !0 }), N.debug("[VirtualScroll] Adjusted scroll for layout shift (auto update)", { from: kt, to: qt, shiftAmount: ht });
2861
- } else kt !== k.current && mt(kt);
2862
- }), { visibleItems: K, renderAnchor: F };
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 };
2863
2975
  }, [
2864
2976
  I,
2865
- et,
2866
- $t,
2867
- H,
2977
+ Pe,
2978
+ Be,
2979
+ N,
2868
2980
  r,
2869
- E,
2870
- t,
2981
+ V,
2871
2982
  e,
2983
+ t,
2872
2984
  n,
2873
- y,
2874
- g,
2875
- me,
2876
2985
  Qt,
2877
- le,
2878
- ae,
2986
+ Jt,
2987
+ xt,
2879
2988
  mt,
2880
- ce
2881
- ]), Yt = S(
2882
- (a) => {
2883
- const u = (z ?? 0) > 0, m = Math.abs(a - zt), D = u && m > 0.5 ? zt : a, _ = Wt(D, R.top);
2884
- if (N.debug("[VirtualScroll] Rendering visible items", () => ({
2885
- currentScrollPosition: a,
2886
- effectiveScrollPosition: _,
2887
- renderingStartIndex: ae,
2888
- renderingEndIndex: le,
2989
+ st,
2990
+ ve,
2991
+ xe,
2992
+ Ke
2993
+ ]), hr = S(
2994
+ (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", () => ({
2997
+ currentScrollPosition: o,
2998
+ effectiveScrollPosition: L,
2999
+ renderingStartIndex: ve,
3000
+ renderingEndIndex: st,
2889
3001
  itemCount: r,
2890
- viewportSize: i,
2891
- callbackThrottleMs: z,
3002
+ viewportSize: X,
3003
+ callbackThrottleMs: Z,
2892
3004
  diff: m,
2893
- rawEffectiveScrollPosition: D
3005
+ rawEffectiveScrollPosition: z
2894
3006
  })), r === 0)
2895
- return bt;
2896
- const F = R.top + Ot - D, $ = R.bottom > 0 ? /* @__PURE__ */ ot(
3007
+ return Bt;
3008
+ const F = R.top + Ht - z, W = R.bottom > 0 ? /* @__PURE__ */ le(
2897
3009
  "div",
2898
3010
  {
2899
3011
  className: "aqvs-bottom-inset",
2900
3012
  style: {
2901
3013
  // ラッパー座標での bottom インセット位置 = コンテンツ総高さ (最終行の下端) - アンカー。
2902
- top: E.getTotal() - Ot,
3014
+ top: V.getTotal() - Ht,
2903
3015
  height: R.bottom
2904
3016
  }
2905
3017
  },
2906
3018
  "virtualscroll-bottom-inset"
2907
3019
  ) : null;
2908
- return N.debug("[VirtualScroll] Rendering items", () => ({
3020
+ return w.debug("[VirtualScroll] Rendering items", () => ({
2909
3021
  containerTop: F,
2910
- logicalScrollPosition: oe,
3022
+ logicalScrollPosition: ie,
2911
3023
  resolvedInsets: R,
2912
- effectiveScrollPosition: _
2913
- })), /* @__PURE__ */ Te("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
2914
- bt,
2915
- $
3024
+ effectiveScrollPosition: L
3025
+ })), /* @__PURE__ */ wt("div", { className: "aqvs-items-wrapper", style: { top: 0, transform: `translateY(${F}px)`, willChange: "transform" }, children: [
3026
+ Bt,
3027
+ W
2916
3028
  ] });
2917
3029
  },
2918
- [z, r, E, oe, Ot, le, ae, R, zt, i, bt]
2919
- ), ve = Ft(
3030
+ [Z, r, V, ie, Ht, st, ve, R, We, X, Bt]
3031
+ ), er = Fe(
2920
3032
  () => ({
2921
- renderingStartIndex: pe.renderingStartIndex,
2922
- renderingEndIndex: pe.renderingEndIndex,
2923
- visibleStartIndex: pe.visibleStartIndex,
2924
- visibleEndIndex: pe.visibleEndIndex,
2925
- scrollPosition: oe,
2926
- totalHeight: E.getTotal()
3033
+ renderingStartIndex: Re.renderingStartIndex,
3034
+ renderingEndIndex: Re.renderingEndIndex,
3035
+ visibleStartIndex: Re.visibleStartIndex,
3036
+ visibleEndIndex: Re.visibleEndIndex,
3037
+ scrollPosition: ie,
3038
+ totalHeight: V.getTotal()
2927
3039
  // contentSize (State) ではなく最新値を反映
2928
3040
  }),
2929
3041
  // contentSize を依存に含めることで、updateItemSize/updates 等で木の総高さが変わった際に
2930
3042
  // (fenwickTree は安定参照のため getTotal() の変化だけでは再計算されない) 総高さを再取得する。
2931
- [pe, oe, E, $t]
3043
+ [Re, ie, V, Be]
2932
3044
  );
2933
- Y(() => {
2934
- J.current = ve;
2935
- }, [ve]), Ue(
2936
- A,
3045
+ H(() => {
3046
+ he.current = er;
3047
+ }, [er]), Zt(
3048
+ M,
2937
3049
  () => ({
2938
3050
  getScrollPosition: () => {
2939
- const a = G.current?.getScrollPosition();
2940
- return typeof a == "number" ? Wt(a, wt.current) : -1;
3051
+ const o = ne.current?.getScrollPosition();
3052
+ return typeof o == "number" ? je(o, it.current) : -1;
2941
3053
  },
2942
- getContentSize: () => G.current?.getContentSize() ?? -1,
2943
- getViewportSize: () => G.current?.getViewportSize() ?? -1,
2944
- scrollTo: Ae,
2945
- scrollToIndex: Ut,
2946
- getFenwickTreeTotalHeight: () => E.getTotal(),
2947
- getFenwickSize: () => E.getSize(),
2948
- focusItemAtIndex: o,
2949
- getRange: () => J.current,
2950
- getScrollAnchor: be,
2951
- updateItemSize: Se
3054
+ getContentSize: () => ne.current?.getContentSize() ?? -1,
3055
+ getViewportSize: () => ne.current?.getViewportSize() ?? -1,
3056
+ scrollTo: x,
3057
+ scrollBy: y,
3058
+ applyWheel: A,
3059
+ scrollToIndex: Je,
3060
+ getFenwickTreeTotalHeight: () => V.getTotal(),
3061
+ getFenwickSize: () => V.getSize(),
3062
+ focusItemAtIndex: St,
3063
+ getRange: () => he.current,
3064
+ getScrollAnchor: l,
3065
+ updateItemSize: Ot
2952
3066
  }),
2953
- [Ae, Ut, E, o, be, Se]
3067
+ [x, y, A, Je, V, St, l, Ot]
2954
3068
  );
2955
- const ue = E.getTotal() + R.top + R.bottom;
2956
- return /* @__PURE__ */ ot(
2957
- wr,
3069
+ const gr = V.getTotal() + R.top + R.bottom;
3070
+ return /* @__PURE__ */ le(
3071
+ qr,
2958
3072
  {
2959
- ref: G,
2960
- contentSize: ue,
3073
+ ref: ne,
3074
+ contentSize: gr,
2961
3075
  viewportSize: i,
2962
- className: l,
2963
- testId: c,
2964
- onScroll: ke,
2965
- background: v,
2966
- tapScrollCircleOptions: j,
2967
- inertiaOptions: Dt,
3076
+ onViewportSizeChange: ze,
3077
+ className: a,
3078
+ testId: u,
3079
+ onScroll: U,
3080
+ background: T,
3081
+ tapScrollCircleOptions: q,
3082
+ inertiaOptions: Ge,
2968
3083
  itemCount: r,
2969
- scrollBarWidth: O,
2970
- enableThumbDrag: P,
2971
- enableTrackClick: U,
2972
- enableArrowButtons: Z,
2973
- enablePointerDrag: T,
2974
- pointerDragInputs: q,
2975
- renderThumbOverlay: lt,
2976
- wheelSpeedMultiplier: Ht,
2977
- onWheelHorizontal: xt,
3084
+ scrollBarWidth: K,
3085
+ enableThumbDrag: te,
3086
+ enableTrackClick: j,
3087
+ enableArrowButtons: _,
3088
+ enablePointerDrag: Ee,
3089
+ pointerDragInputs: Qe,
3090
+ renderThumbOverlay: v,
3091
+ wheelSpeedMultiplier: De,
3092
+ onWheelHorizontal: ae,
2978
3093
  contentInsets: R,
2979
- contentProps: Et,
2980
- visibleStartIndex: ce,
2981
- visibleEndIndex: xe,
2982
- renderOverlay: L,
2983
- initialScrollPosition: Vt.position,
2984
- children: Yt
3094
+ contentProps: O,
3095
+ visibleStartIndex: Ke,
3096
+ visibleEndIndex: Pt,
3097
+ renderOverlay: mr,
3098
+ initialScrollPosition: J.position,
3099
+ children: hr
2985
3100
  }
2986
3101
  );
2987
- }, Hr = $e(kr);
3102
+ }, un = Gt(rn);
2988
3103
  export {
2989
- ge as FenwickMapTree,
2990
- Pr as ScrollBar,
2991
- wr as ScrollPane,
2992
- rr as TAP_SCROLL_SPEED_DEFAULTS,
2993
- Hr as VirtualScroll,
2994
- vr as computeAutoTapScrollMaxSpeedMultiplier,
2995
- Sr as computeTapScrollSpeed,
2996
- rt as minmax,
2997
- Br as tapScrollCircleSampleVisual,
2998
- Nr as useFenwickMapTree,
2999
- qr as useHeightCache,
3000
- Vr as useLruCache
3104
+ vt as FenwickMapTree,
3105
+ _r as ScrollBar,
3106
+ qr as ScrollPane,
3107
+ fr as TAP_SCROLL_SPEED_DEFAULTS,
3108
+ un as VirtualScroll,
3109
+ Or as computeAutoTapScrollMaxSpeedMultiplier,
3110
+ Lr as computeTapScrollSpeed,
3111
+ se as minmax,
3112
+ an as tapScrollCircleSampleVisual,
3113
+ Wr as useFenwickMapTree,
3114
+ ln as useHeightCache,
3115
+ Kr as useLruCache,
3116
+ cn as useWheelBridge
3001
3117
  };