virtua 0.52.2 → 0.52.3

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/lib/index.cjs CHANGED
@@ -247,11 +247,7 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
247
247
  t.P(r, s), i !== e.T() && e.A(5, [ i ]);
248
248
  const c = t.j(o, n, e.M() - e.u(0), l);
249
249
  null != c && e.A(9, c);
250
- }, R = /*#__PURE__*/ new WeakMap, T = (e, t, o, n, r, i, c) => {
251
- if (t < n || l(t, r) < s(o, i + 1) || c < o) return !0;
252
- for (const n of e) if (n >= t && n < o) return !0;
253
- return !1;
254
- }, M = (e, t, o) => {
250
+ }, R = /*#__PURE__*/ new WeakMap, T = (e, t, o, n, r, i) => e < o || l(e, n) < s(t, r + 1) || i < t, M = (e, t, o) => {
255
251
  const n = [];
256
252
  for (const r of e) r >= t && r < o && n.push(r);
257
253
  return f(n);
@@ -263,25 +259,22 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
263
259
  e[o] <= t ? n = o + 1 : r = o;
264
260
  }
265
261
  return n - 1;
266
- }, O = (e, t, o, n) => {
267
- const r = C(t, o, n);
268
- r >= 0 && e.push(t[r]);
269
- }, E = (e, t, o, n, r) => {
262
+ }, O = (e, t, o, n, r) => {
270
263
  const s = t.length;
271
264
  for (;o < s && t[o] < n; o++) {
272
265
  const n = t[o];
273
266
  n > r && (e.push(n), r = n);
274
267
  }
275
268
  return o;
276
- }, L = (e, t, o, n, r, s) => {
269
+ }, E = (e, t, o, n, r, s) => {
277
270
  const l = [];
278
271
  for (let e = 0; e < o; e++) l.push(e);
279
- const i = E(l, e, 0, n, o - 1);
272
+ const i = O(l, e, 0, n, o - 1);
280
273
  for (let e = n; e <= r; e++) l.push(e);
281
- E(l, e, i, s, r);
274
+ O(l, e, i, s, r);
282
275
  for (let e = s; e < t; e++) l.push(e);
283
276
  return l;
284
- }, q = (e, t) => s(e.rowIndex + (e.rowSpan || 1), t), A = (e, t) => s(e.colIndex + (e.colSpan || 1), t), W = (e, t, o, n, r, l) => {
277
+ }, L = (e, t) => s(e.rowIndex + (e.rowSpan || 1), t), q = (e, t) => s(e.colIndex + (e.colSpan || 1), t), A = (e, t, o, n, r, l) => {
285
278
  const i = t.length, c = n.length;
286
279
  let a = "[l0]", f = 0, u = 0, d = 0;
287
280
  for (;f < l; ) {
@@ -296,7 +289,7 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
296
289
  a += " " + h + " [l" + g + "]", f = g;
297
290
  }
298
291
  return a;
299
- }, H = (e, t, o, n, r) => {
292
+ }, W = (e, t, o, n, r) => {
300
293
  const s = {
301
294
  display: "grid",
302
295
  gridTemplateRows: "subgrid",
@@ -305,7 +298,7 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
305
298
  gridRow: "l" + e + "/l" + t
306
299
  };
307
300
  return null != o && (s.position = "sticky", s[n] = o + "px", s.zIndex = r), s;
308
- }, P = e => {
301
+ }, H = e => {
309
302
  let t;
310
303
  return {
311
304
  V(o) {
@@ -318,7 +311,7 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
318
311
  t && t.disconnect();
319
312
  }
320
313
  };
321
- }, B = (e, t, o, n, r, s, l) => {
314
+ }, P = (e, t, o, n, r, s, l) => {
322
315
  let i, c, a = 0, f = !1, g = !1, h = !1, p = !1;
323
316
  const m = Date.now, S = n ? "scrollLeft" : "scrollTop", _ = n ? "left" : "top", v = e => r ? -e : e, z = () => v(o[S]), y = (e, t) => {
324
317
  o.scrollTo({
@@ -387,9 +380,9 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
387
380
  o ? (e.A(8, t()), $(a)) : a();
388
381
  }
389
382
  };
390
- }, D = (e, t) => {
383
+ }, B = (e, t) => {
391
384
  let o, n, r = g();
392
- const s = /* @__PURE__ */ new WeakMap, l = P(n => {
385
+ const s = /* @__PURE__ */ new WeakMap, l = H(n => {
393
386
  const r = [];
394
387
  for (const {target: l, contentRect: {width: i, height: c}} of n) if (l === o) (i || c) && e.A(4, t ? i : c); else if (l.offsetParent) {
395
388
  const e = s.get(l);
@@ -399,7 +392,7 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
399
392
  });
400
393
  return {
401
394
  F(s, i = s.parentElement) {
402
- l.V(o = i), n = B(e, i, i, t, t && "rtl" === getComputedStyle(i).direction, () => {
395
+ l.V(o = i), n = P(e, i, i, t, t && "rtl" === getComputedStyle(i).direction, () => {
403
396
  const e = t ? "overflowX" : "overflowY", o = i.style, n = o[e];
404
397
  o[e] = "hidden", u(() => {
405
398
  o[e] = n;
@@ -420,9 +413,9 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
420
413
  },
421
414
  Z: e.O
422
415
  };
423
- }, j = (e, t) => {
416
+ }, D = (e, t) => {
424
417
  let o, n, r, s, l, i = g();
425
- const c = /* @__PURE__ */ new WeakMap, a = P(n => {
418
+ const c = /* @__PURE__ */ new WeakMap, a = H(n => {
426
419
  const r = [];
427
420
  for (const {target: e, contentRect: {width: s, height: i}} of n) if (e === o) l && l(); else if (e.offsetParent) {
428
421
  const o = c.get(e);
@@ -440,7 +433,7 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
440
433
  };
441
434
  u.addEventListener("resize", w), a.V(d), r = () => {
442
435
  u.removeEventListener("resize", w);
443
- }, n = B(e, u, d, t, $, null, h), i[1](!0);
436
+ }, n = P(e, u, d, t, $, null, h), i[1](!0);
444
437
  },
445
438
  v() {
446
439
  r && r(), a.Y(), n && n.Y(), i[1](!1), i = g();
@@ -456,9 +449,9 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
456
449
  },
457
450
  Z: () => s()
458
451
  };
459
- }, V = (e, t) => {
452
+ }, j = (e, t) => {
460
453
  let o, n, r, s = g();
461
- const l = /* @__PURE__ */ new WeakMap, i = /* @__PURE__ */ new WeakMap, c = P(n => {
454
+ const l = /* @__PURE__ */ new WeakMap, i = /* @__PURE__ */ new WeakMap, c = H(n => {
462
455
  const r = [], s = [];
463
456
  for (const {target: c, contentRect: {width: a, height: f}} of n) if (c === o) (a || f) && (e.A(4, f),
464
457
  t.A(4, a)); else if (c.offsetParent) {
@@ -474,7 +467,7 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
474
467
  F(l) {
475
468
  const i = o = l.parentElement;
476
469
  c.V(i);
477
- const a = (e, t) => B(e, i, i, t, t && "rtl" === getComputedStyle(i).direction, () => {
470
+ const a = (e, t) => P(e, i, i, t, t && "rtl" === getComputedStyle(i).direction, () => {
478
471
  const e = t ? "overflowX" : "overflowY", o = i.style, n = o[e];
479
472
  o[e] = "hidden", u(() => {
480
473
  o[e] = n;
@@ -492,9 +485,9 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
492
485
  n && n.J(), r && r.J();
493
486
  }
494
487
  };
495
- }, X = (e, t) => {
488
+ }, V = (e, t) => {
496
489
  e.K(() => t);
497
- }, Y = (e, t, o, {align: n, smooth: r, offset: s = 0} = {}) => {
490
+ }, X = (e, t, o, {align: n, smooth: r, offset: s = 0} = {}) => {
498
491
  if (o = a(o, 0, t.T() - 1), "nearest" === n) {
499
492
  const e = t.u(o), r = t.M();
500
493
  if (e < r) n = "start"; else {
@@ -503,10 +496,10 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
503
496
  }
504
497
  }
505
498
  e.K(() => s + e.Z() + t.u(o) + ("end" === n ? t.$(o) - t.o() : "center" === n ? (t.$(o) - t.o()) / 2 : 0), r);
506
- }, J = (e, t, o, n, r, i, c) => {
499
+ }, Y = (e, t, o, n, r, i, c) => {
507
500
  const f = t.T(), u = o.B(), d = o.D();
508
501
  r = a(r, 0, f - 1);
509
- const $ = M(n, u, d), g = C($, r, d), h = g < 0 ? -1 : $[g], p = () => o.u(u) + (h < 0 || h === r ? 0 : t.u(h + 1) - t.u(h)), m = () => o.u(f) - o.u(d);
502
+ const $ = M(n, u, d), g = C($, r, d), h = g < 0 ? -1 : $[g], p = () => o.u(u) + (h < 0 || h === r ? 0 : o.u(h + 1) - o.u(h)), m = () => o.u(f) - o.u(d);
510
503
  if ("nearest" === i) {
511
504
  if (r < u || r >= d) return;
512
505
  const e = p(), o = t.M() + e, n = t.o() - e - m(), c = t.$(r);
@@ -524,22 +517,22 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
524
517
  const e = p(), o = t.$(r) - (t.o() - e - m());
525
518
  return t.u(r) - e + ("end" === i ? o : "center" === i ? o / 2 : 0);
526
519
  });
527
- }, U = h ? e.useLayoutEffect : e.useEffect, F = "current", G = (e, t) => {
528
- if (Array.isArray(e)) for (const o of e) G(o, t); else null == e || "boolean" == typeof e || t.push(e);
529
- }, K = (e, t) => {
520
+ }, J = h ? e.useLayoutEffect : e.useEffect, U = "current", F = (e, t) => {
521
+ if (Array.isArray(e)) for (const o of e) F(o, t); else null == e || "boolean" == typeof e || t.push(e);
522
+ }, G = (e, t) => {
530
523
  const o = e.key;
531
524
  return null != o ? o : "_" + t;
532
- }, N = t => {
525
+ }, K = t => {
533
526
  const o = (0, e.useRef)(null);
534
527
  return o.current || (o.current = t());
535
- }, Q = t => {
528
+ }, N = t => {
536
529
  const o = (0, e.useRef)(t);
537
- return U(() => {
538
- o[F] = t;
530
+ return J(() => {
531
+ o[U] = t;
539
532
  }, [ t ]), o;
540
- }, Z = /*#__PURE__*/ /*#__PURE__*/ (0, e.memo)(({ee: o, te: n, oe: r, ne: s, re: l, se: i, le: c, ie: a}) => {
533
+ }, Q = /*#__PURE__*/ /*#__PURE__*/ (0, e.memo)(({ee: o, te: n, oe: r, ne: s, re: l, se: i, le: c, ie: a}) => {
541
534
  const f = (0, e.useRef)(null);
542
- U(() => n(f[F], r), [ r ]);
535
+ J(() => n(f[U], r), [ r ]);
543
536
  const u = (0, e.useMemo)(() => {
544
537
  const e = {
545
538
  contain: "layout style",
@@ -561,23 +554,23 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
561
554
  index: r,
562
555
  children: o
563
556
  });
564
- }), ee = (t, o) => (0, e.useMemo)(() => {
557
+ }), Z = (t, o) => (0, e.useMemo)(() => {
565
558
  if ("function" == typeof t) return [ e => t(o[e], e), o.length ];
566
559
  const e = (e => {
567
560
  const t = [];
568
- return G(e, t), t;
561
+ return F(e, t), t;
569
562
  })(t);
570
563
  return [ t => e[t], e.length ];
571
- }, [ t, o ]), te = /*#__PURE__*/ /*#__PURE__*/ (0, e.forwardRef)(({children: n, data: r, bufferSize: s, itemSize: l, shift: i, horizontal: c, keepMounted: a, cache: u, startMargin: d = 0, ssrCount: g, as: h = "div", item: p = "div", scrollRef: m, onScroll: w, onScrollEnd: v}, z) => {
572
- const [x, I] = ee(n, r), b = (0, e.useRef)(null), k = (0, e.useRef)(!!g), R = Q(w), T = Q(v), [M, C, O, E] = N(() => {
564
+ }, [ t, o ]), ee = /*#__PURE__*/ /*#__PURE__*/ (0, e.forwardRef)(({children: n, data: r, bufferSize: s, itemSize: l, shift: i, horizontal: c, keepMounted: a, cache: u, startMargin: d = 0, ssrCount: g, as: h = "div", item: p = "div", scrollRef: m, onScroll: w, onScrollEnd: v}, z) => {
565
+ const [x, I] = Z(n, r), b = (0, e.useRef)(null), k = (0, e.useRef)(!!g), R = N(w), T = N(v), [M, C, O, E] = K(() => {
573
566
  const e = !!c, t = y(I, l, u), o = _(t, g);
574
- return [ o, t, D(o, e), e ];
567
+ return [ o, t, B(o, e), e ];
575
568
  });
576
569
  I !== M.T() && M.A(5, [ I, i ]), d !== M.O() && M.A(6, d);
577
570
  const [L, q] = (0, e.useReducer)(M.I, void 0, M.I), A = M.C(), W = M.t(), H = [], P = e => {
578
571
  const o = x(e);
579
572
  /* @__PURE__ */ /* @__PURE__ */
580
- return (0, t.jsx)(Z, {
573
+ return (0, t.jsx)(Q, {
581
574
  te: O.G,
582
575
  oe: e,
583
576
  ne: M.u(e),
@@ -585,24 +578,24 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
585
578
  se: p,
586
579
  ee: o,
587
580
  le: E,
588
- ie: k[F]
589
- }, K(o, e));
581
+ ie: k[U]
582
+ }, G(o, e));
590
583
  };
591
- if (U(() => {
592
- k[F] = !1, M.q(1, e => {
584
+ if (J(() => {
585
+ k[U] = !1, M.q(1, e => {
593
586
  e ? (0, o.flushSync)(q) : q();
594
587
  }), M.q(4, () => {
595
588
  R.current && R.current(M.M());
596
589
  }), M.q(8, () => {
597
590
  T.current && T.current();
598
591
  });
599
- const e = b[F];
592
+ const e = b[U];
600
593
  return m ? $(() => {
601
- m.current && O.F(e, m[F]);
594
+ m.current && O.F(e, m[U]);
602
595
  }) : O.F(e), () => {
603
596
  M.v(), O.v();
604
597
  };
605
- }, []), U(() => {
598
+ }, []), J(() => {
606
599
  O.N();
607
600
  }, [ L ]), (0, e.useImperativeHandle)(z, () => ({
608
601
  get cache() {
@@ -620,10 +613,10 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
620
613
  findItemIndex: M.k,
621
614
  getItemOffset: M.u,
622
615
  getItemSize: M.$,
623
- scrollToIndex: (e, t) => Y(O, M, e, t),
624
- scrollTo: e => X(O, e),
616
+ scrollToIndex: (e, t) => X(O, M, e, t),
617
+ scrollTo: e => V(O, e),
625
618
  scrollBy: e => ((e, t, o) => {
626
- X(e, o + t.M());
619
+ V(e, o + t.M());
627
620
  })(O, M, e)
628
621
  }), []), a) {
629
622
  const e = new Set(a);
@@ -646,7 +639,7 @@ n), S = e => l(e.t(), e.o()), _ = ({l: e, i: t, u: o, $: n, h: r, p: c, t: a, m:
646
639
  },
647
640
  children: H
648
641
  });
649
- }), oe = /*#__PURE__*/ /*#__PURE__*/ (0, e.forwardRef)(({children: e, data: o, bufferSize: n, itemSize: r, shift: s, horizontal: l, keepMounted: i, cache: c, ssrCount: a, item: f, onScroll: u, onScrollEnd: d, style: $, ...g}, h) => /* @__PURE__ */ /* @__PURE__ */ (0,
642
+ }), te = /*#__PURE__*/ /*#__PURE__*/ (0, e.forwardRef)(({children: e, data: o, bufferSize: n, itemSize: r, shift: s, horizontal: l, keepMounted: i, cache: c, ssrCount: a, item: f, onScroll: u, onScrollEnd: d, style: $, ...g}, h) => /* @__PURE__ */ /* @__PURE__ */ (0,
650
643
  t.jsx)("div", {
651
644
  ...g,
652
645
  style: {
@@ -657,7 +650,7 @@ t.jsx)("div", {
657
650
  height: "100%",
658
651
  ...$
659
652
  },
660
- children: /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(te, {
653
+ children: /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(ee, {
661
654
  ref: h,
662
655
  data: o,
663
656
  bufferSize: n,
@@ -672,22 +665,22 @@ t.jsx)("div", {
672
665
  onScrollEnd: d,
673
666
  children: e
674
667
  })
675
- })), ne = /*#__PURE__*/ /*#__PURE__*/ (0, e.forwardRef)(({children: n, data: r, bufferSize: s, itemSize: l, shift: i, horizontal: c, cache: a, ssrCount: f, as: u = "div", item: d = "div", onScroll: $, onScrollEnd: g}, h) => {
676
- const [p, m] = ee(n, r), w = (0, e.useRef)(null), S = Q($), v = Q(g), z = (0, e.useRef)(!!f), [x, I, b, k] = N(() => {
668
+ })), oe = /*#__PURE__*/ /*#__PURE__*/ (0, e.forwardRef)(({children: n, data: r, bufferSize: s, itemSize: l, shift: i, horizontal: c, cache: a, ssrCount: f, as: u = "div", item: d = "div", onScroll: $, onScrollEnd: g}, h) => {
669
+ const [p, m] = Z(n, r), w = (0, e.useRef)(null), S = N($), v = N(g), z = (0, e.useRef)(!!f), [x, I, b, k] = K(() => {
677
670
  const e = !!c, t = y(m, l, a), o = _(t, f);
678
- return [ o, t, j(o, e), e ];
671
+ return [ o, t, D(o, e), e ];
679
672
  });
680
673
  m !== x.T() && x.A(5, [ m, i ]);
681
674
  const [R, T] = (0, e.useReducer)(x.I, void 0, x.I), M = x.C(), C = x.t(), O = [];
682
- U(() => (z[F] = !1, x.q(1, e => {
675
+ J(() => (z[U] = !1, x.q(1, e => {
683
676
  e ? (0, o.flushSync)(T) : T();
684
677
  }), x.q(4, () => {
685
678
  S.current && S.current();
686
679
  }), x.q(8, () => {
687
680
  v.current && v.current();
688
- }), b.F(w[F]), () => {
681
+ }), b.F(w[U]), () => {
689
682
  x.v(), b.v();
690
- }), []), U(() => {
683
+ }), []), J(() => {
691
684
  b.N();
692
685
  }, [ R ]), (0, e.useImperativeHandle)(h, () => ({
693
686
  get cache() {
@@ -702,11 +695,11 @@ t.jsx)("div", {
702
695
  findItemIndex: x.k,
703
696
  getItemOffset: x.u,
704
697
  getItemSize: x.$,
705
- scrollToIndex: (e, t) => Y(b, x, e, t)
698
+ scrollToIndex: (e, t) => X(b, x, e, t)
706
699
  }), []);
707
700
  for (let [e, o] = x.l(s); e <= o; e++) {
708
701
  const o = p(e);
709
- O.push(/* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(Z, {
702
+ O.push(/* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(Q, {
710
703
  te: b.G,
711
704
  oe: e,
712
705
  ne: x.u(e),
@@ -714,8 +707,8 @@ t.jsx)("div", {
714
707
  se: d,
715
708
  ee: o,
716
709
  le: k,
717
- ie: z[F]
718
- }, K(o, e)));
710
+ ie: z[U]
711
+ }, G(o, e)));
719
712
  }
720
713
  /* @__PURE__ */ /* @__PURE__ */
721
714
  return (0, t.jsx)(u, {
@@ -731,10 +724,10 @@ t.jsx)("div", {
731
724
  },
732
725
  children: O
733
726
  });
734
- }), re = /*#__PURE__*/ /*#__PURE__*/ (0, e.memo)(({ce: {ae: o, fe: n, ue: r, de: s, $e: l, ge: i, he: c, pe: a}, ee: f, me: u, we: d, Se: $, te: g}) => {
727
+ }), ne = /*#__PURE__*/ /*#__PURE__*/ (0, e.memo)(({ce: {ae: o, fe: n, ue: r, de: s, $e: l, ge: i, he: c, pe: a}, ee: f, me: u, we: d, Se: $, te: g}) => {
735
728
  const h = (0, e.useRef)(null);
736
- return U(() => {
737
- if (null != s || null != l) return g(h[F], s, l);
729
+ return J(() => {
730
+ if (null != s || null != l) return g(h[U], s, l);
738
731
  }, [ s, l, g ]), /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)("div", {
739
732
  ref: h,
740
733
  role: i,
@@ -748,12 +741,12 @@ t.jsx)("div", {
748
741
  colIndex: o
749
742
  })
750
743
  });
751
- }), se = /*#__PURE__*/ /*#__PURE__*/ (0, e.memo)(({ce: {_e: e, ve: o, pe: n}, ee: r, me: s, ze: l, te: i}) => /* @__PURE__ */ /* @__PURE__ */ (0,
744
+ }), re = /*#__PURE__*/ /*#__PURE__*/ (0, e.memo)(({ce: {_e: e, ve: o, pe: n}, ee: r, me: s, ze: l, te: i}) => /* @__PURE__ */ /* @__PURE__ */ (0,
752
745
  t.jsx)("div", {
753
746
  role: "row",
754
747
  "aria-rowindex": e + 1,
755
748
  style: n,
756
- children: o.map(o => /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(re, {
749
+ children: o.map(o => /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(ne, {
757
750
  ce: o,
758
751
  ee: r,
759
752
  me: s,
@@ -761,51 +754,47 @@ t.jsx)("div", {
761
754
  Se: e,
762
755
  te: i
763
756
  }, o.ae))
764
- })), le = ({ce: {ye: e, pe: o}, ee: n, xe: r, ze: s, te: l}) => /* @__PURE__ */ /* @__PURE__ */ (0,
757
+ })), se = ({ce: {ye: e, pe: o}, ee: n, xe: r, ze: s, te: l}) => /* @__PURE__ */ /* @__PURE__ */ (0,
765
758
  t.jsx)("div", {
766
759
  role: "rowgroup",
767
760
  style: o,
768
- children: e.map(e => /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(se, {
761
+ children: e.map(e => /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(re, {
769
762
  ce: e,
770
763
  ee: n,
771
764
  me: I(r, e._e),
772
765
  ze: s,
773
766
  te: l
774
767
  }, e._e))
775
- }), ie = /*#__PURE__*/ /*#__PURE__*/ (0, e.forwardRef)(({children: n, rows: i, cols: c, rowHeight: u, colWidth: d, headerRows: $, sectionRows: g, footerRows: h, headerCols: p, footerCols: m, spans: w, keepMounted: v, bufferSize: z, gap: y = 0, ariaSort: x, onVerticalScroll: E, onHorizontalScroll: P, onScrollEnd: B, style: D, ...j}, X) => {
776
- const Y = (0, e.useRef)(null), G = Q(E), K = Q(P), Z = Q(B), [ee, te, oe, ne, re] = N(() => {
768
+ }), le = /*#__PURE__*/ /*#__PURE__*/ (0, e.forwardRef)(({children: n, rows: i, cols: c, rowHeight: u, colWidth: d, headerRows: $, sectionRows: g, footerRows: h, headerCols: p, footerCols: m, spans: w, keepMounted: v, bufferSize: z, gap: y = 0, ariaSort: x, onVerticalScroll: O, onHorizontalScroll: H, onScrollEnd: P, style: B, ...D}, V) => {
769
+ const X = (0, e.useRef)(null), F = N(O), G = N(H), Q = N(P), [Z, ee, te, oe, ne] = K(() => {
777
770
  const e = b(i, u, y), t = b(c, d, y), o = _(e), n = _(t);
778
- return [ o, n, e, t, V(o, n) ];
771
+ return [ o, n, e, t, j(o, n) ];
779
772
  });
780
- k(ee, oe, i, u, $, h), k(te, ne, c, d, p, m);
781
- const ie = () => ee.I() + te.I(), [ce, ae] = (0, e.useReducer)(ie, void 0, ie), fe = ee.C() || te.C(), ue = ee.u(0), de = te.u(0), $e = ee.T(), ge = te.T(), he = ((e, t, o, n, i = r, c = r, u = r, d) => {
773
+ k(Z, te, i, u, $, h), k(ee, oe, c, d, p, m);
774
+ const le = () => Z.I() + ee.I(), [ie, ce] = (0, e.useReducer)(le, void 0, le), ae = Z.C() || ee.C(), fe = Z.u(0), ue = ee.u(0), de = Z.T(), $e = ee.T(), ge = ((e, t, o, n, i = r, c = r, u = r, d) => {
782
775
  const $ = e.m(), g = t.m(), h = e.B(), p = e.D(), m = t.B(), w = t.D(), S = a(o[0], h, p), _ = s(o[1], p - 1), v = a(n[0], m, w), z = s(n[1], w - 1), y = M(i, h, p), x = l(m - 1, 0), I = [], b = [], k = [];
783
776
  for (const e of u) e.rowIndex < $ && e.colIndex < g && k.push(e);
784
- const E = y.length;
785
- E && (O(I, y, S, p), b.push(x));
786
- let P = c, B = 0;
787
- do {
788
- for (;B < k.length; B++) {
789
- const {rowIndex: e, colIndex: t} = k[B];
790
- I.push(e), O(I, y, e, p), b.push(t);
791
- }
792
- const e = [];
793
- for (const t of P) {
794
- const o = t.rowIndex, n = t.colIndex, r = q(t, $), s = A(t, g);
795
- if (o < $ && n < g && (r - o > 1 || s - n > 1)) {
796
- const l = T(I, o, r, h, S, _, p);
797
- if (l && T(b, n, s, m, v, z, w)) k.push(t); else if (l) {
798
- const n = C(y, r - 1, p);
799
- (o < h || n >= 0 && y[n] >= o) && e.push(t);
800
- } else n < m && e.push(t);
777
+ const O = k.length, H = y.length, P = C(y, S, p), B = P < 0 ? -1 : y[P];
778
+ B >= 0 && I.push(B);
779
+ for (const e of c) {
780
+ const t = e.rowIndex, o = e.colIndex, n = L(e, $), r = q(e, g);
781
+ if (t < $ && o < g && (n - t > 1 || r - o > 1)) {
782
+ let s = (T(t, n, h, S, _, p) || B >= t && B < n) && T(o, r, m, v, z, w);
783
+ for (let e = 0; !s && e < O; e++) {
784
+ const {rowIndex: l, colIndex: i} = k[e];
785
+ s = l >= t && l < n && i >= o && i < r;
801
786
  }
787
+ s && k.push(e);
802
788
  }
803
- P = e;
804
- } while (B < k.length);
789
+ }
790
+ for (const {rowIndex: e, colIndex: t} of k) {
791
+ const o = C(y, e, p);
792
+ I.push(e), o >= 0 && I.push(y[o]), b.push(t);
793
+ }
805
794
  f(I), f(b);
806
- const D = L(I, $, h, S, _, p), j = L(b, g, m, v, z, w), V = D.length, X = j.length, Y = /* @__PURE__ */ new Map, J = [], U = [];
795
+ const D = E(I, $, h, S, _, p), j = E(b, g, m, v, z, w), V = D.length, X = j.length, Y = /* @__PURE__ */ new Map, J = [], U = [];
807
796
  for (const e of k) {
808
- const t = q(e, $), o = A(e, g);
797
+ const t = L(e, $), o = q(e, g);
809
798
  J.push(t), U.push(o);
810
799
  const n = j.indexOf(e.colIndex);
811
800
  for (let r = D.indexOf(e.rowIndex); r < V && D[r] < t; r++) {
@@ -819,44 +808,44 @@ t.jsx)("div", {
819
808
  let Q = N;
820
809
  const Z = R.get(e), ee = /* @__PURE__ */ new Map;
821
810
  for (const o of D) {
822
- const n = o < h, r = o >= p, s = r || o >= S && o <= _, i = C(y, o, p), c = n ? 0 : r ? p : i < 0 ? -1 : y[i];
823
- if (o === c) {
824
- const e = n ? h : r ? $ : i + 1 < E ? y[i + 1] : p;
811
+ const n = o < h, r = o >= p, s = C(y, o, p), i = n ? 0 : r ? p : s < 0 ? -1 : y[s];
812
+ if (o === i) {
813
+ const e = n ? h : r ? $ : s + 1 < H ? y[s + 1] : p;
825
814
  J.push(e);
826
815
  const t = [];
827
816
  N.push({
828
- Ie: n ? -1 : r ? -2 : -3 - c,
817
+ Ie: n ? -1 : r ? -2 : -3 - i,
829
818
  ye: t,
830
- pe: H(c, e, n || r ? 0 : null, r ? "bottom" : "top", 4)
819
+ pe: W(i, e, n || r ? 0 : null, r ? "bottom" : "top", 4)
831
820
  }), Q = t;
832
- } else c < 0 && (Q = N);
833
- const a = i >= 0 && o === c, f = a ? K : null, u = o * g, I = Z && Z.get(o), b = I && I.ve, k = [];
821
+ } else i < 0 && (Q = N);
822
+ const c = s >= 0 && o === i, a = n || r || o === B || o >= S && o <= _, f = c ? K : null, u = o * g, I = Z && Z.get(o), b = I && I.ve, k = [];
834
823
  let R = 0, T = !e.H(o) && null, M = o + 1, O = !1;
835
824
  for (let e = 0; e < X; e++) {
836
- const r = j[e], i = r < m, c = r >= w, f = c || r >= v && r <= z, h = Y.get(u + r);
837
- if (h ? h.rowIndex === o && h.colIndex === r : s && f || n || a || i) {
838
- const s = h ? q(h, $) : o + 1, f = h ? A(h, g) : r + 1, u = s - o, p = f - r, m = u > 1, w = p > 1, S = m || w;
825
+ const r = j[e], s = r < m, i = r >= w, f = s || i || r >= v && r <= z, h = Y.get(u + r);
826
+ if (h ? h.rowIndex === o && h.colIndex === r : a && f) {
827
+ const a = h ? L(h, $) : o + 1, f = h ? q(h, g) : r + 1, u = a - o, p = f - r, m = u > 1, w = p > 1, S = m || w;
839
828
  let _, v;
840
- M = l(M, s);
841
- const z = i ? t.u(r) : null, y = c ? t.t() - t.u(f - 1) - t.$(f - 1) : null;
829
+ M = l(M, a);
830
+ const z = s ? t.u(r) : null, y = i ? t.t() - t.u(f - 1) - t.$(f - 1) : null;
842
831
  !1 !== T || m || (_ = o, T = !0), !1 !== F[e] || w || (v = r, F[e] = !0);
843
- const I = n ? "columnheader" : r === x && (i || a) ? "rowheader" : "cell", C = S ? u : void 0, E = S ? p : void 0, L = "cell" !== I && d && d.rowIndex === o && d.colIndex === r ? d.order : void 0;
832
+ const I = n ? "columnheader" : r === x && (s || c) ? "rowheader" : "cell", C = S ? u : void 0, E = S ? p : void 0, A = "cell" !== I && d && d.rowIndex === o && d.colIndex === r ? d.order : void 0;
844
833
  let W;
845
834
  if (b) {
846
835
  const e = b.length;
847
836
  for (;R < e && b[R].ae < r; ) R++;
848
837
  R < e && b[R].ae === r && (W = b[R]);
849
838
  }
850
- if (!W || W.fe !== C || W.ue !== E || W.be !== z || W.ke !== y || W.de !== _ || W.$e !== v || W.ge !== I || W.he !== L) {
839
+ if (!W || W.fe !== C || W.ue !== E || W.be !== z || W.ke !== y || W.de !== _ || W.$e !== v || W.ge !== I || W.he !== A) {
851
840
  let e = "1/l" + r;
852
- S && (e += "/l" + s + "/l" + f);
841
+ S && (e += "/l" + a + "/l" + f);
853
842
  const t = {
854
843
  contain: "layout style",
855
844
  display: "grid",
856
845
  gridArea: e
857
846
  };
858
847
  m && (t.height = "0px", t.minHeight = "100%", t.zIndex = 1), w && (t.width = "0px",
859
- t.minWidth = "100%"), (i || c) && (t[i ? "insetInlineStart" : "insetInlineEnd"] = (i ? z : y) + "px",
848
+ t.minWidth = "100%"), (s || i) && (t[s ? "insetInlineStart" : "insetInlineEnd"] = (s ? z : y) + "px",
860
849
  t.position = "sticky", t.zIndex = 2), W = {
861
850
  ae: r,
862
851
  fe: C,
@@ -864,7 +853,7 @@ t.jsx)("div", {
864
853
  de: _,
865
854
  $e: v,
866
855
  ge: I,
867
- he: L,
856
+ he: A,
868
857
  pe: t,
869
858
  be: z,
870
859
  ke: y
@@ -877,68 +866,68 @@ t.jsx)("div", {
877
866
  const e = I && !O && I.ve.length === k.length && I.Re === f ? I : {
878
867
  _e: o,
879
868
  ve: k,
880
- pe: H(o, M, f, "top", 3),
869
+ pe: W(o, M, f, "top", 3),
881
870
  Re: f
882
871
  };
883
872
  ee.set(o, e), Q.push(e);
884
873
  }
885
874
  }
886
875
  return R.set(e, ee), {
887
- Te: W(e, D, G, f(J), "max-content", $),
888
- Me: W(t, j, F, f(U), "minmax(max-content,auto)", g),
876
+ Te: A(e, D, G, f(J), "max-content", $),
877
+ Me: A(t, j, F, f(U), "minmax(max-content,auto)", g),
889
878
  Ce: N
890
879
  };
891
- })(oe, ne, ee.l(z), te.l(z), g, w, v, x), pe = Q(e => ((e, t, o, n, s, l = r, {rowIndex: i, colIndex: c, rowAlign: a, colAlign: f}) => {
892
- null != i && J(e, t, n, l, i, a, !1), null != c && J(e, o, s, r, c, f, !0);
893
- })(re, ee, te, oe, ne, g, e));
894
- return U(() => {
880
+ })(te, oe, Z.l(z), ee.l(z), g, w, v, x), he = N(e => ((e, t, o, n, s, l = r, {rowIndex: i, colIndex: c, rowAlign: a, colAlign: f}) => {
881
+ null != i && Y(e, t, n, l, i, a, !1), null != c && Y(e, o, s, r, c, f, !0);
882
+ })(ne, Z, ee, te, oe, g, e));
883
+ return J(() => {
895
884
  const e = e => {
896
- e ? (0, o.flushSync)(ae) : ae();
885
+ e ? (0, o.flushSync)(ce) : ce();
897
886
  };
898
- ee.q(1, e), te.q(1, e);
887
+ Z.q(1, e), ee.q(1, e);
899
888
  let t = !1;
900
- ee.q(4, () => {
889
+ Z.q(4, () => {
890
+ t = !0, F.current && F.current(Z.M());
891
+ }), ee.q(4, () => {
901
892
  t = !0, G.current && G.current(ee.M());
902
- }), te.q(4, () => {
903
- t = !0, K.current && K.current(te.M());
904
893
  });
905
894
  const n = () => {
906
- !t || ee.C() || te.C() || (t = !1, Z.current && Z.current());
895
+ !t || Z.C() || ee.C() || (t = !1, Q.current && Q.current());
907
896
  };
908
- return ee.q(8, n), te.q(8, n), re.F(Y[F]), () => {
909
- ee.v(), te.v(), re.v();
897
+ return Z.q(8, n), ee.q(8, n), ne.F(X[U]), () => {
898
+ Z.v(), ee.v(), ne.v();
910
899
  };
911
- }, []), U(() => {
912
- re.N();
913
- }, [ ce ]), (0, e.useImperativeHandle)(X, () => ({
900
+ }, []), J(() => {
901
+ ne.N();
902
+ }, [ ie ]), (0, e.useImperativeHandle)(V, () => ({
914
903
  get verticalScrollOffset() {
915
- return ee.M();
904
+ return Z.M();
916
905
  },
917
906
  get horizontalScrollOffset() {
918
- return te.M();
907
+ return ee.M();
919
908
  },
920
909
  get scrollHeight() {
921
- return S(ee);
910
+ return S(Z);
922
911
  },
923
912
  get scrollWidth() {
924
- return S(te);
913
+ return S(ee);
925
914
  },
926
915
  get viewportHeight() {
927
- return ee.o();
916
+ return Z.o();
928
917
  },
929
918
  get viewportWidth() {
930
- return te.o();
931
- },
932
- findRowIndex: ee.k,
933
- findColIndex: te.k,
934
- getRowOffset: ee.u,
935
- getColOffset: te.u,
936
- getRowSize: ee.$,
937
- getColSize: te.$,
938
- scrollToIndex: e => pe[F](e),
919
+ return ee.o();
920
+ },
921
+ findRowIndex: Z.k,
922
+ findColIndex: ee.k,
923
+ getRowOffset: Z.u,
924
+ getColOffset: ee.u,
925
+ getRowSize: Z.$,
926
+ getColSize: ee.$,
927
+ scrollToIndex: e => he[U](e),
939
928
  scrollTo: ({vertical: e, horizontal: t}) => ((e, t, o) => {
940
929
  null != t && e.K(!1, () => t), null != o && e.K(!0, () => o);
941
- })(re, e, t),
930
+ })(ne, e, t),
942
931
  scrollBy: ({vertical: e, horizontal: t}) => ((e, t, o, n, r) => {
943
932
  if (null != n) {
944
933
  const o = n + t.M();
@@ -948,50 +937,50 @@ t.jsx)("div", {
948
937
  const t = r + o.M();
949
938
  e.K(!0, () => t);
950
939
  }
951
- })(re, ee, te, e, t)
940
+ })(ne, Z, ee, e, t)
952
941
  }), []), /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)("div", {
953
942
  role: "table",
954
- "aria-rowcount": $e,
955
- "aria-colcount": ge,
956
- ...j,
943
+ "aria-rowcount": de,
944
+ "aria-colcount": $e,
945
+ ...D,
957
946
  style: {
958
947
  overflow: "auto",
959
948
  contain: "strict",
960
949
  width: "100%",
961
950
  height: "100%",
962
- ...D
951
+ ...B
963
952
  },
964
953
  children: /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)("div", {
965
- ref: Y,
954
+ ref: X,
966
955
  style: {
967
956
  contain: "size style",
968
957
  overflowAnchor: "none",
969
958
  flex: "none",
970
959
  display: "grid",
971
- gridTemplateRows: he.Te,
972
- gridTemplateColumns: he.Me,
960
+ gridTemplateRows: ge.Te,
961
+ gridTemplateColumns: ge.Me,
973
962
  gap: y,
974
- marginTop: ue,
975
- marginInlineStart: de,
976
- height: S(ee) - ue,
977
- pointerEvents: fe ? "none" : void 0
963
+ marginTop: fe,
964
+ marginInlineStart: ue,
965
+ height: S(Z) - fe,
966
+ pointerEvents: ae ? "none" : void 0
978
967
  },
979
- children: he.Ce.map(e => "ye" in e ? /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(le, {
968
+ children: ge.Ce.map(e => "ye" in e ? /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(se, {
980
969
  ce: e,
981
970
  ee: n,
982
971
  xe: i,
983
972
  ze: c,
984
- te: re.G
985
- }, e.Ie) : /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(se, {
973
+ te: ne.G
974
+ }, e.Ie) : /* @__PURE__ */ /* @__PURE__ */ (0, t.jsx)(re, {
986
975
  ce: e,
987
976
  ee: n,
988
977
  me: I(i, e._e),
989
978
  ze: c,
990
- te: re.G
979
+ te: ne.G
991
980
  }, e._e))
992
981
  })
993
982
  });
994
983
  });
995
984
 
996
- exports.VGrid = ie, exports.VList = oe, exports.Virtualizer = te, exports.WindowVirtualizer = ne;
985
+ exports.VGrid = le, exports.VList = te, exports.Virtualizer = ee, exports.WindowVirtualizer = oe;
997
986
  //# sourceMappingURL=index.cjs.map