react-window 2.3.1 → 2.3.2

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.
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { jsx as se } from "react/jsx-runtime";
3
- import { useState as L, useLayoutEffect as oe, useEffect as Z, useMemo as R, useRef as P, useCallback as B, memo as ae, useImperativeHandle as fe, createElement as Q } from "react";
2
+ import { jsx as oe } from "react/jsx-runtime";
3
+ import { useState as V, useLayoutEffect as ce, useEffect as te, useMemo as H, useRef as q, useCallback as $, memo as fe, useImperativeHandle as de, createElement as C } from "react";
4
4
  function be(e) {
5
5
  let t = e;
6
6
  for (; t; ) {
@@ -10,14 +10,14 @@ function be(e) {
10
10
  }
11
11
  return !1;
12
12
  }
13
- function Ie(e, t) {
14
- const [s, r] = L(t === "rtl");
15
- return oe(() => {
13
+ function me(e, t) {
14
+ const [s, r] = V(t === "rtl");
15
+ return ce(() => {
16
16
  t ? r(t === "rtl") : e && r(be(e));
17
17
  }, [t, e]), s;
18
18
  }
19
- const J = typeof window < "u" ? oe : Z;
20
- function ce(e) {
19
+ const Y = typeof window < "u" ? ce : te;
20
+ function ae(e) {
21
21
  if (e !== void 0)
22
22
  switch (typeof e) {
23
23
  case "number":
@@ -34,92 +34,92 @@ function we({
34
34
  defaultHeight: t,
35
35
  defaultWidth: s,
36
36
  disabled: r,
37
- element: n,
38
- mode: o,
39
- style: l
37
+ element: o,
38
+ mode: n,
39
+ style: a
40
40
  }) {
41
- const { styleHeight: f, styleWidth: a } = R(
41
+ const { styleHeight: l, styleWidth: c } = H(
42
42
  () => ({
43
- styleHeight: ce(l?.height),
44
- styleWidth: ce(l?.width)
43
+ styleHeight: ae(a?.height),
44
+ styleWidth: ae(a?.width)
45
45
  }),
46
- [l?.height, l?.width]
47
- ), [i, d] = L({
46
+ [a?.height, a?.width]
47
+ ), [f, i] = V({
48
48
  height: t,
49
49
  width: s
50
- }), c = r || o === "only-height" && f !== void 0 || o === "only-width" && a !== void 0 || f !== void 0 && a !== void 0;
51
- return J(() => {
52
- if (n === null || c)
50
+ }), d = r || n === "only-height" && l !== void 0 || n === "only-width" && c !== void 0 || l !== void 0 && c !== void 0;
51
+ return Y(() => {
52
+ if (o === null || d)
53
53
  return;
54
- const g = new ResizeObserver((x) => {
55
- for (const I of x) {
56
- const { contentRect: h, target: z } = I;
57
- n === z && d((u) => u.height === h.height && u.width === h.width ? u : {
58
- height: h.height,
59
- width: h.width
54
+ const u = new ResizeObserver((h) => {
55
+ for (const x of h) {
56
+ const { contentRect: p, target: w } = x;
57
+ o === w && i((g) => g.height === p.height && g.width === p.width ? g : {
58
+ height: p.height,
59
+ width: p.width
60
60
  });
61
61
  }
62
62
  });
63
- return g.observe(n, { box: e }), () => {
64
- g?.unobserve(n);
63
+ return u.observe(o, { box: e }), () => {
64
+ u?.unobserve(o);
65
65
  };
66
- }, [e, c, n, f, a]), R(
66
+ }, [e, d, o, l, c]), H(
67
67
  () => ({
68
- height: f ?? i.height,
69
- width: a ?? i.width
68
+ height: l ?? f.height,
69
+ width: c ?? f.width
70
70
  }),
71
- [i, f, a]
71
+ [f, l, c]
72
72
  );
73
73
  }
74
- function de(e) {
75
- const t = P(() => {
74
+ function ee(e) {
75
+ const t = q(() => {
76
76
  throw new Error("Cannot call an event handler while rendering.");
77
77
  });
78
- return J(() => {
78
+ return Y(() => {
79
79
  t.current = e;
80
- }, [e]), B((...s) => t.current?.(...s), [t]);
80
+ }, [e]), $((...s) => t.current?.(...s), [t]);
81
81
  }
82
- let F = null;
83
- function me(e = !1) {
84
- if (F === null || e) {
82
+ let N = null;
83
+ function Ie(e = !1) {
84
+ if (N === null || e) {
85
85
  const t = document.createElement("div"), s = t.style;
86
86
  s.width = "50px", s.height = "50px", s.overflow = "scroll", s.direction = "rtl";
87
- const r = document.createElement("div"), n = r.style;
88
- return n.width = "100px", n.height = "100px", t.appendChild(r), document.body.appendChild(t), t.scrollLeft > 0 ? F = "positive-descending" : (t.scrollLeft = 1, t.scrollLeft === 0 ? F = "negative" : F = "positive-ascending"), document.body.removeChild(t), F;
87
+ const r = document.createElement("div"), o = r.style;
88
+ return o.width = "100px", o.height = "100px", t.appendChild(r), document.body.appendChild(t), t.scrollLeft > 0 ? N = "positive-descending" : (t.scrollLeft = 1, t.scrollLeft === 0 ? N = "negative" : N = "positive-ascending"), document.body.removeChild(t), N;
89
89
  }
90
- return F;
90
+ return N;
91
91
  }
92
- function C({
92
+ function K({
93
93
  containerElement: e,
94
94
  direction: t,
95
95
  isRtl: s,
96
96
  scrollOffset: r
97
97
  }) {
98
98
  if (t === "horizontal" && s)
99
- switch (me()) {
99
+ switch (Ie()) {
100
100
  case "negative":
101
101
  return -r;
102
102
  case "positive-descending": {
103
103
  if (e) {
104
- const { clientWidth: n, scrollLeft: o, scrollWidth: l } = e;
105
- return l - n - o;
104
+ const { clientWidth: o, scrollWidth: n } = e;
105
+ return n - o - r;
106
106
  }
107
107
  break;
108
108
  }
109
109
  }
110
110
  return r;
111
111
  }
112
- function k(e, t = "Assertion error") {
112
+ function L(e, t = "Assertion error") {
113
113
  if (!e)
114
114
  throw console.error(t), Error(t);
115
115
  }
116
- function X(e, t) {
116
+ function _(e, t) {
117
117
  if (e === t)
118
118
  return !0;
119
- if (!!e != !!t || (k(e !== void 0), k(t !== void 0), Object.keys(e).length !== Object.keys(t).length))
119
+ if (!!e != !!t || (L(e !== void 0), L(t !== void 0), Object.keys(e).length !== Object.keys(t).length))
120
120
  return !1;
121
121
  for (const s in e)
122
- if (!Object.is(t[s], e[s]))
122
+ if (!Object.hasOwn(t, s) || !Object.is(t[s], e[s]))
123
123
  return !1;
124
124
  return !0;
125
125
  }
@@ -136,9 +136,9 @@ function ue({
136
136
  const r = e.get(
137
137
  e.size === 0 ? 0 : e.size - 1
138
138
  );
139
- k(r !== void 0, "Unexpected bounds cache miss");
140
- const n = (r.scrollOffset + r.size) / e.size;
141
- return t * n;
139
+ L(r !== void 0, "Unexpected bounds cache miss");
140
+ const o = (r.scrollOffset + r.size) / e.size;
141
+ return t * o;
142
142
  }
143
143
  }
144
144
  function Oe({
@@ -146,123 +146,149 @@ function Oe({
146
146
  cachedBounds: t,
147
147
  index: s,
148
148
  itemCount: r,
149
- itemSize: n,
150
- containerScrollOffset: o,
151
- containerSize: l
149
+ itemSize: o,
150
+ containerScrollOffset: n,
151
+ containerSize: a
152
152
  }) {
153
153
  if (s < 0 || s >= r)
154
154
  throw RangeError(`Invalid index specified: ${s}`, {
155
155
  cause: `Index ${s} is not within the range of 0 - ${r - 1}`
156
156
  });
157
- const f = ue({
157
+ const l = t.get(s), c = ue({
158
158
  cachedBounds: t,
159
159
  itemCount: r,
160
- itemSize: n
161
- }), a = t.get(s), i = Math.max(
160
+ itemSize: o
161
+ }), f = Math.max(
162
162
  0,
163
- Math.min(f - l, a.scrollOffset)
164
- ), d = Math.max(
163
+ Math.min(c - a, l.scrollOffset)
164
+ ), i = Math.max(
165
165
  0,
166
- a.scrollOffset - l + a.size
167
- );
168
- switch (e === "smart" && (o >= d && o <= i ? e = "auto" : e = "center"), e) {
166
+ l.scrollOffset - a + l.size
167
+ ), d = l.size > a ? n >= l.scrollOffset && n <= i : n >= i && n <= l.scrollOffset;
168
+ switch (e === "smart" && (e = d ? "auto" : "center"), e) {
169
169
  case "start":
170
- return i;
170
+ return f;
171
171
  case "end":
172
- return d;
172
+ return i;
173
173
  case "center":
174
- return a.scrollOffset <= l / 2 ? 0 : a.scrollOffset + a.size / 2 >= f - l / 2 ? f - l : a.scrollOffset + a.size / 2 - l / 2;
174
+ return Math.max(
175
+ 0,
176
+ Math.min(
177
+ c - a,
178
+ l.scrollOffset + l.size / 2 - a / 2
179
+ )
180
+ );
175
181
  case "auto":
176
182
  default:
177
- return o >= d && o <= i ? o : o < d ? d : i;
183
+ return d ? n : n < i ? i : f;
178
184
  }
179
185
  }
180
- function ee({
186
+ function re({
181
187
  cachedBounds: e,
182
188
  containerScrollOffset: t,
183
189
  containerSize: s,
184
190
  itemCount: r,
185
- overscanCount: n
191
+ overscanCount: o
186
192
  }) {
187
- const o = r - 1;
188
- let l = 0, f = -1, a = 0, i = -1, d = 0;
189
- for (; d < o; ) {
190
- const c = e.get(d);
191
- if (c.scrollOffset + c.size > t)
192
- break;
193
- d++;
194
- }
195
- for (l = d, a = Math.max(0, l - n); d < o; ) {
196
- const c = e.get(d);
197
- if (c.scrollOffset + c.size >= t + s)
198
- break;
199
- d++;
193
+ const n = r - 1;
194
+ if (r === 0)
195
+ return {
196
+ startIndexVisible: 0,
197
+ stopIndexVisible: -1,
198
+ startIndexOverscan: 0,
199
+ stopIndexOverscan: -1
200
+ };
201
+ let a, l;
202
+ const { itemSize: c } = e;
203
+ if (c !== void 0 && c > 0)
204
+ a = Math.max(
205
+ 0,
206
+ Math.min(n, Math.floor(t / c))
207
+ ), l = Math.max(
208
+ a,
209
+ Math.min(
210
+ n,
211
+ Math.ceil((t + s) / c) - 1
212
+ )
213
+ );
214
+ else {
215
+ let f = 0, i = Math.min(n, Math.max(0, e.size - 1)), d = 1;
216
+ for (; i < n; ) {
217
+ const u = e.get(i);
218
+ if (u.scrollOffset + u.size > t) break;
219
+ f = i + 1, i = Math.min(n, i + d), d *= 2;
220
+ }
221
+ for (; f < i; ) {
222
+ const u = Math.floor((f + i) / 2), h = e.get(u);
223
+ h.scrollOffset + h.size > t ? i = u : f = u + 1;
224
+ }
225
+ for (a = f, l = f; l < n; ) {
226
+ const u = e.get(l);
227
+ if (u.scrollOffset + u.size >= t + s)
228
+ break;
229
+ l++;
230
+ }
200
231
  }
201
- return f = Math.min(o, d), i = Math.min(r - 1, f + n), l < 0 && (l = 0, f = -1, a = 0, i = -1), {
202
- startIndexVisible: l,
203
- stopIndexVisible: f,
204
- startIndexOverscan: a,
205
- stopIndexOverscan: i
232
+ return {
233
+ startIndexVisible: a,
234
+ stopIndexVisible: l,
235
+ startIndexOverscan: Math.max(0, a - o),
236
+ stopIndexOverscan: Math.min(n, l + o)
206
237
  };
207
238
  }
208
- function ye({
239
+ function ze({
209
240
  itemCount: e,
210
241
  itemProps: t,
211
242
  itemSize: s
212
243
  }) {
213
244
  const r = /* @__PURE__ */ new Map();
214
245
  return {
215
- get(n) {
216
- for (k(n < e, `Invalid index ${n}`); r.size - 1 < n; ) {
217
- const l = r.size;
218
- let f;
219
- switch (typeof s) {
220
- case "function": {
221
- f = s(l, t);
222
- break;
223
- }
224
- case "number": {
225
- f = s;
226
- break;
227
- }
228
- }
229
- if (l === 0)
230
- r.set(l, {
231
- size: f,
246
+ itemSize: typeof s == "number" ? s : void 0,
247
+ get(o) {
248
+ if (L(o < e, `Invalid index ${o}`), typeof s == "number") {
249
+ L(o >= 0, `Invalid index ${o}`);
250
+ let a = r.get(o);
251
+ return a === void 0 && (a = { size: s, scrollOffset: o * s }, r.set(o, a)), a;
252
+ }
253
+ for (; r.size - 1 < o; ) {
254
+ const a = r.size, l = s(a, t);
255
+ if (a === 0)
256
+ r.set(a, {
257
+ size: l,
232
258
  scrollOffset: 0
233
259
  });
234
260
  else {
235
- const a = r.get(l - 1);
236
- k(
237
- a !== void 0,
238
- `Unexpected bounds cache miss for index ${n}`
239
- ), r.set(l, {
240
- scrollOffset: a.scrollOffset + a.size,
241
- size: f
261
+ const c = r.get(a - 1);
262
+ L(
263
+ c !== void 0,
264
+ `Unexpected bounds cache miss for index ${o}`
265
+ ), r.set(a, {
266
+ scrollOffset: c.scrollOffset + c.size,
267
+ size: l
242
268
  });
243
269
  }
244
270
  }
245
- const o = r.get(n);
246
- return k(
247
- o !== void 0,
248
- `Unexpected bounds cache miss for index ${n}`
249
- ), o;
271
+ const n = r.get(o);
272
+ return L(
273
+ n !== void 0,
274
+ `Unexpected bounds cache miss for index ${o}`
275
+ ), n;
250
276
  },
251
- set(n, o) {
252
- r.set(n, o);
277
+ set(o, n) {
278
+ r.set(o, n);
253
279
  },
254
280
  get size() {
255
281
  return r.size;
256
282
  }
257
283
  };
258
284
  }
259
- function ze({
285
+ function ye({
260
286
  itemCount: e,
261
287
  itemProps: t,
262
288
  itemSize: s
263
289
  }) {
264
- return R(
265
- () => ye({
290
+ return H(
291
+ () => ze({
266
292
  itemCount: e,
267
293
  itemProps: t,
268
294
  itemSize: s
@@ -277,13 +303,13 @@ function Se({
277
303
  let s;
278
304
  switch (typeof t) {
279
305
  case "string": {
280
- k(
306
+ L(
281
307
  t.endsWith("%"),
282
308
  `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`
283
- ), k(
309
+ ), L(
284
310
  e !== void 0,
285
311
  "Container size must be defined if a percentage item size is specified"
286
- ), s = e * parseInt(t) / 100;
312
+ ), s = e * parseFloat(t) / 100;
287
313
  break;
288
314
  }
289
315
  default: {
@@ -293,608 +319,710 @@ function Se({
293
319
  }
294
320
  return s;
295
321
  }
296
- function re({
322
+ function ie({
297
323
  containerElement: e,
298
324
  containerStyle: t,
299
325
  defaultContainerSize: s = 0,
300
326
  direction: r,
301
- isRtl: n = !1,
302
- itemCount: o,
303
- itemProps: l,
304
- itemSize: f,
305
- onResize: a,
306
- overscanCount: i
327
+ isRtl: o = !1,
328
+ itemCount: n,
329
+ itemProps: a,
330
+ itemSize: l,
331
+ onResize: c,
332
+ overscanCount: f
307
333
  }) {
308
- const { height: d = s, width: c = s } = we({
334
+ const { height: i = s, width: d = s } = we({
309
335
  defaultHeight: r === "vertical" ? s : void 0,
310
336
  defaultWidth: r === "horizontal" ? s : void 0,
311
337
  element: e,
312
338
  mode: r === "vertical" ? "only-height" : "only-width",
313
339
  style: t
314
- }), g = P({
340
+ }), u = q({
315
341
  height: 0,
316
342
  width: 0
317
- }), x = r === "vertical" ? d : c, I = Se({ containerSize: x, itemSize: f });
318
- oe(() => {
319
- if (typeof a == "function") {
320
- const p = g.current;
321
- (p.height !== d || p.width !== c) && (a({ height: d, width: c }, { ...p }), p.height = d, p.width = c);
343
+ }), h = r === "vertical" ? i : d, x = Se({ containerSize: h, itemSize: l });
344
+ ce(() => {
345
+ if (typeof c == "function") {
346
+ const v = u.current;
347
+ (v.height !== i || v.width !== d) && (c({ height: i, width: d }, { ...v }), v.height = i, v.width = d);
322
348
  }
323
- }, [d, a, c]);
324
- const h = ze({
325
- itemCount: o,
326
- itemProps: l,
327
- itemSize: I
328
- }), z = B(
329
- (p) => h.get(p),
330
- [h]
331
- ), [u, j] = L(
332
- () => ee({
333
- cachedBounds: h,
349
+ }, [i, c, d]);
350
+ const p = ye({
351
+ itemCount: n,
352
+ itemProps: a,
353
+ itemSize: x
354
+ }), w = $(
355
+ (v) => p.get(v),
356
+ [p]
357
+ ), [g, B] = V(
358
+ () => re({
359
+ cachedBounds: p,
334
360
  // TODO Potentially support a defaultScrollOffset prop?
335
361
  containerScrollOffset: 0,
336
- containerSize: x,
337
- itemCount: o,
338
- overscanCount: i
362
+ containerSize: h,
363
+ itemCount: n,
364
+ overscanCount: f
339
365
  })
340
366
  ), {
341
367
  startIndexVisible: T,
342
- startIndexOverscan: E,
343
- stopIndexVisible: D,
344
- stopIndexOverscan: v
368
+ startIndexOverscan: M,
369
+ stopIndexVisible: F,
370
+ stopIndexOverscan: b
345
371
  } = {
346
- startIndexVisible: Math.min(o - 1, u.startIndexVisible),
347
- startIndexOverscan: Math.min(o - 1, u.startIndexOverscan),
348
- stopIndexVisible: Math.min(o - 1, u.stopIndexVisible),
349
- stopIndexOverscan: Math.min(o - 1, u.stopIndexOverscan)
350
- }, U = B(
372
+ startIndexVisible: Math.min(n - 1, g.startIndexVisible),
373
+ startIndexOverscan: Math.min(n - 1, g.startIndexOverscan),
374
+ stopIndexVisible: Math.min(n - 1, g.stopIndexVisible),
375
+ stopIndexOverscan: Math.min(n - 1, g.stopIndexOverscan)
376
+ }, X = $(
351
377
  () => ue({
352
- cachedBounds: h,
353
- itemCount: o,
354
- itemSize: I
378
+ cachedBounds: p,
379
+ itemCount: n,
380
+ itemSize: x
355
381
  }),
356
- [h, o, I]
357
- ), m = B(
358
- (p) => {
359
- const O = C({
382
+ [p, n, x]
383
+ ), m = $(
384
+ (v) => {
385
+ const I = K({
360
386
  containerElement: e,
361
387
  direction: r,
362
- isRtl: n,
363
- scrollOffset: p
388
+ isRtl: o,
389
+ scrollOffset: v
364
390
  });
365
- return ee({
366
- cachedBounds: h,
367
- containerScrollOffset: O,
368
- containerSize: x,
369
- itemCount: o,
370
- overscanCount: i
391
+ return re({
392
+ cachedBounds: p,
393
+ containerScrollOffset: I,
394
+ containerSize: h,
395
+ itemCount: n,
396
+ overscanCount: f
371
397
  });
372
398
  },
373
399
  [
374
- h,
400
+ p,
375
401
  e,
376
- x,
402
+ h,
377
403
  r,
378
- n,
379
404
  o,
380
- i
405
+ n,
406
+ f
381
407
  ]
382
408
  );
383
- J(() => {
384
- const p = (r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
385
- j(m(p));
386
- }, [e, r, m]), J(() => {
409
+ Y(() => {
410
+ const v = (r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
411
+ B(m(v));
412
+ }, [e, r, m]), Y(() => {
387
413
  if (!e)
388
414
  return;
389
- const p = () => {
390
- j((O) => {
391
- const { scrollLeft: M, scrollTop: S } = e, b = C({
415
+ const v = () => {
416
+ B((I) => {
417
+ const { scrollLeft: R, scrollTop: z } = e, y = K({
392
418
  containerElement: e,
393
419
  direction: r,
394
- isRtl: n,
395
- scrollOffset: r === "vertical" ? S : M
396
- }), w = ee({
397
- cachedBounds: h,
398
- containerScrollOffset: b,
399
- containerSize: x,
400
- itemCount: o,
401
- overscanCount: i
420
+ isRtl: o,
421
+ scrollOffset: r === "vertical" ? z : R
422
+ }), G = re({
423
+ cachedBounds: p,
424
+ containerScrollOffset: y,
425
+ containerSize: h,
426
+ itemCount: n,
427
+ overscanCount: f
402
428
  });
403
- return X(w, O) ? O : w;
429
+ return _(G, I) ? I : G;
404
430
  });
405
431
  };
406
- return e.addEventListener("scroll", p), () => {
407
- e.removeEventListener("scroll", p);
432
+ return e.addEventListener("scroll", v), () => {
433
+ e.removeEventListener("scroll", v);
408
434
  };
409
435
  }, [
410
- h,
436
+ p,
411
437
  e,
412
- x,
438
+ h,
413
439
  r,
414
440
  o,
415
- i
441
+ n,
442
+ f
416
443
  ]);
417
- const G = de(
444
+ const U = ee(
418
445
  ({
419
- align: p = "auto",
420
- containerScrollOffset: O,
421
- index: M
446
+ align: v = "auto",
447
+ containerScrollOffset: I,
448
+ index: R
422
449
  }) => {
423
- let S = Oe({
424
- align: p,
425
- cachedBounds: h,
426
- containerScrollOffset: O,
427
- containerSize: x,
428
- index: M,
429
- itemCount: o,
430
- itemSize: I
450
+ let z = Oe({
451
+ align: v,
452
+ cachedBounds: p,
453
+ containerScrollOffset: K({
454
+ containerElement: e,
455
+ direction: r,
456
+ isRtl: o,
457
+ scrollOffset: I
458
+ }),
459
+ containerSize: h,
460
+ index: R,
461
+ itemCount: n,
462
+ itemSize: x
431
463
  });
432
464
  if (e) {
433
- if (S = C({
465
+ if (z = K({
434
466
  containerElement: e,
435
467
  direction: r,
436
- isRtl: n,
437
- scrollOffset: S
468
+ isRtl: o,
469
+ scrollOffset: z
438
470
  }), typeof e.scrollTo != "function") {
439
- const b = m(S);
440
- X(u, b) || j(b);
471
+ const y = m(z);
472
+ _(g, y) || B(y);
441
473
  }
442
- return S;
474
+ return z;
443
475
  }
444
476
  }
445
477
  );
446
478
  return {
447
- getCellBounds: z,
448
- getEstimatedSize: U,
449
- scrollToIndex: G,
450
- startIndexOverscan: E,
479
+ getCellBounds: w,
480
+ getEstimatedSize: X,
481
+ scrollToIndex: U,
482
+ startIndexOverscan: M,
451
483
  startIndexVisible: T,
452
- stopIndexOverscan: v,
453
- stopIndexVisible: D
484
+ stopIndexOverscan: b,
485
+ stopIndexVisible: F
454
486
  };
455
487
  }
456
488
  function he(e) {
457
- return R(() => e, Object.values(e));
489
+ const [t, s] = V(e);
490
+ return _(t, e) ? t : (s(e), e);
458
491
  }
459
492
  function pe(e, t) {
460
493
  const {
461
494
  ariaAttributes: s,
462
495
  style: r,
463
- ...n
496
+ ...o
464
497
  } = e, {
465
- ariaAttributes: o,
466
- style: l,
467
- ...f
498
+ ariaAttributes: n,
499
+ style: a,
500
+ ...l
468
501
  } = t;
469
- return X(s, o) && X(r, l) && X(n, f);
502
+ return _(s, n) && _(r, a) && _(o, l);
470
503
  }
471
- function Ve({
504
+ function Le({
472
505
  cellComponent: e,
473
506
  cellProps: t,
474
507
  children: s,
475
508
  className: r,
476
- columnCount: n,
477
- columnKey: o,
478
- columnWidth: l,
479
- defaultHeight: f = 0,
480
- defaultWidth: a = 0,
481
- dir: i,
482
- gridRef: d,
483
- onCellsRendered: c,
484
- onResize: g,
485
- overscanCount: x = 3,
486
- rowCount: I,
487
- rowHeight: h,
488
- rowKey: z,
489
- style: u,
490
- tagName: j = "div",
509
+ columnCount: o,
510
+ columnKey: n,
511
+ columnWidth: a,
512
+ defaultHeight: l = 0,
513
+ defaultWidth: c = 0,
514
+ dir: f,
515
+ gridRef: i,
516
+ onCellsRendered: d,
517
+ onResize: u,
518
+ overscanCount: h = 3,
519
+ rowCount: x,
520
+ rowHeight: p,
521
+ rowKey: w,
522
+ style: g,
523
+ tagName: B = "div",
491
524
  ...T
492
525
  }) {
493
- const E = he(t), D = R(
494
- () => ae(e, pe),
526
+ const M = he(t), F = H(
527
+ () => fe(e, pe),
495
528
  [e]
496
- ), [v, U] = L(null), m = Ie(v, i), {
497
- getCellBounds: G,
498
- getEstimatedSize: p,
499
- startIndexOverscan: O,
500
- startIndexVisible: M,
501
- scrollToIndex: S,
502
- stopIndexOverscan: b,
503
- stopIndexVisible: w
504
- } = re({
505
- containerElement: v,
506
- containerStyle: u,
507
- defaultContainerSize: a,
529
+ ), [b, X] = V(null), m = me(b, f), {
530
+ getCellBounds: U,
531
+ getEstimatedSize: v,
532
+ startIndexOverscan: I,
533
+ startIndexVisible: R,
534
+ scrollToIndex: z,
535
+ stopIndexOverscan: y,
536
+ stopIndexVisible: G
537
+ } = ie({
538
+ containerElement: b,
539
+ containerStyle: g,
540
+ defaultContainerSize: c,
508
541
  direction: "horizontal",
509
542
  isRtl: m,
510
- itemCount: n,
511
- itemProps: E,
512
- itemSize: l,
513
- onResize: g,
514
- overscanCount: x
543
+ itemCount: o,
544
+ itemProps: M,
545
+ itemSize: a,
546
+ onResize: u,
547
+ overscanCount: h
515
548
  }), {
516
- getCellBounds: V,
517
- getEstimatedSize: _,
518
- startIndexOverscan: N,
519
- startIndexVisible: ie,
520
- scrollToIndex: K,
521
- stopIndexOverscan: Y,
549
+ getCellBounds: E,
550
+ getEstimatedSize: S,
551
+ startIndexOverscan: A,
552
+ startIndexVisible: P,
553
+ scrollToIndex: se,
554
+ stopIndexOverscan: J,
522
555
  stopIndexVisible: le
523
- } = re({
524
- containerElement: v,
525
- containerStyle: u,
526
- defaultContainerSize: f,
556
+ } = ie({
557
+ containerElement: b,
558
+ containerStyle: g,
559
+ defaultContainerSize: l,
527
560
  direction: "vertical",
528
- itemCount: I,
529
- itemProps: E,
530
- itemSize: h,
531
- onResize: g,
532
- overscanCount: x
561
+ itemCount: x,
562
+ itemProps: M,
563
+ itemSize: p,
564
+ onResize: u,
565
+ overscanCount: h
533
566
  });
534
- fe(
535
- d,
567
+ de(
568
+ i,
536
569
  () => ({
537
570
  get element() {
538
- return v;
571
+ return b;
539
572
  },
540
573
  scrollToCell({
541
- behavior: $ = "auto",
542
- columnAlign: y = "auto",
543
- columnIndex: H,
544
- rowAlign: W = "auto",
545
- rowIndex: A
574
+ behavior: W = "auto",
575
+ columnAlign: O = "auto",
576
+ columnIndex: j,
577
+ rowAlign: D = "auto",
578
+ rowIndex: k
546
579
  }) {
547
- const q = S({
548
- align: y,
549
- containerScrollOffset: v?.scrollLeft ?? 0,
550
- index: H
551
- }), ve = K({
552
- align: W,
553
- containerScrollOffset: v?.scrollTop ?? 0,
554
- index: A
580
+ const Q = z({
581
+ align: O,
582
+ containerScrollOffset: b?.scrollLeft ?? 0,
583
+ index: j
584
+ }), xe = se({
585
+ align: D,
586
+ containerScrollOffset: b?.scrollTop ?? 0,
587
+ index: k
555
588
  });
556
- typeof v?.scrollTo == "function" && v.scrollTo({
557
- behavior: $,
558
- left: q,
559
- top: ve
589
+ typeof b?.scrollTo == "function" && b.scrollTo({
590
+ behavior: W,
591
+ left: Q,
592
+ top: xe
560
593
  });
561
594
  },
562
595
  scrollToColumn({
563
- align: $ = "auto",
564
- behavior: y = "auto",
565
- index: H
596
+ align: W = "auto",
597
+ behavior: O = "auto",
598
+ index: j
566
599
  }) {
567
- const W = S({
568
- align: $,
569
- containerScrollOffset: v?.scrollLeft ?? 0,
570
- index: H
600
+ const D = z({
601
+ align: W,
602
+ containerScrollOffset: b?.scrollLeft ?? 0,
603
+ index: j
571
604
  });
572
- typeof v?.scrollTo == "function" && v.scrollTo({
573
- behavior: y,
574
- left: W
605
+ typeof b?.scrollTo == "function" && b.scrollTo({
606
+ behavior: O,
607
+ left: D
575
608
  });
576
609
  },
577
610
  scrollToRow({
578
- align: $ = "auto",
579
- behavior: y = "auto",
580
- index: H
611
+ align: W = "auto",
612
+ behavior: O = "auto",
613
+ index: j
581
614
  }) {
582
- const W = K({
583
- align: $,
584
- containerScrollOffset: v?.scrollTop ?? 0,
585
- index: H
615
+ const D = se({
616
+ align: W,
617
+ containerScrollOffset: b?.scrollTop ?? 0,
618
+ index: j
586
619
  });
587
- typeof v?.scrollTo == "function" && v.scrollTo({
588
- behavior: y,
589
- top: W
620
+ typeof b?.scrollTo == "function" && b.scrollTo({
621
+ behavior: O,
622
+ top: D
590
623
  });
591
624
  }
592
625
  }),
593
- [v, S, K]
594
- ), Z(() => {
595
- O >= 0 && b >= 0 && N >= 0 && Y >= 0 && c && c(
626
+ [b, z, se]
627
+ ), te(() => {
628
+ I >= 0 && y >= 0 && A >= 0 && J >= 0 && d && d(
596
629
  {
597
- columnStartIndex: M,
598
- columnStopIndex: w,
599
- rowStartIndex: ie,
630
+ columnStartIndex: R,
631
+ columnStopIndex: G,
632
+ rowStartIndex: P,
600
633
  rowStopIndex: le
601
634
  },
602
635
  {
603
- columnStartIndex: O,
604
- columnStopIndex: b,
605
- rowStartIndex: N,
606
- rowStopIndex: Y
636
+ columnStartIndex: I,
637
+ columnStopIndex: y,
638
+ rowStartIndex: A,
639
+ rowStopIndex: J
607
640
  }
608
641
  );
609
642
  }, [
610
- c,
611
- O,
612
- M,
613
- b,
614
- w,
615
- N,
616
- ie,
617
- Y,
643
+ d,
644
+ I,
645
+ R,
646
+ y,
647
+ G,
648
+ A,
649
+ P,
650
+ J,
618
651
  le
619
652
  ]);
620
- const ge = R(() => {
621
- const $ = [];
622
- if (n > 0 && I > 0)
623
- for (let y = N; y <= Y; y++) {
624
- const H = V(y), W = [];
625
- for (let A = O; A <= b; A++) {
626
- const q = G(A);
627
- W.push(
628
- /* @__PURE__ */ Q(
629
- D,
653
+ const ge = H(() => {
654
+ const W = [];
655
+ if (o > 0 && x > 0)
656
+ for (let O = A; O <= J; O++) {
657
+ const j = E(O), D = [];
658
+ for (let k = I; k <= y; k++) {
659
+ const Q = U(k);
660
+ D.push(
661
+ /* @__PURE__ */ C(
662
+ F,
630
663
  {
631
- ...E,
664
+ ...M,
632
665
  ariaAttributes: {
633
- "aria-colindex": A + 1,
666
+ "aria-colindex": k + 1,
634
667
  role: "gridcell"
635
668
  },
636
- columnIndex: A,
637
- key: o ? o({
638
- columnIndex: A,
639
- data: E,
640
- rowIndex: y
641
- }) : A,
642
- rowIndex: y,
669
+ columnIndex: k,
670
+ key: n ? n({
671
+ columnIndex: k,
672
+ data: M,
673
+ rowIndex: O
674
+ }) : k,
675
+ rowIndex: O,
643
676
  style: {
644
677
  position: "absolute",
645
678
  left: m ? void 0 : 0,
646
679
  right: m ? 0 : void 0,
647
- transform: `translate(${m ? -q.scrollOffset : q.scrollOffset}px, ${H.scrollOffset}px)`,
648
- height: H.size,
649
- width: q.size
680
+ transform: `translate(${m ? -Q.scrollOffset : Q.scrollOffset}px, ${j.scrollOffset}px)`,
681
+ height: j.size,
682
+ width: Q.size
650
683
  }
651
684
  }
652
685
  )
653
686
  );
654
687
  }
655
- $.push(
656
- /* @__PURE__ */ se(
688
+ W.push(
689
+ /* @__PURE__ */ oe(
657
690
  "div",
658
691
  {
659
692
  role: "row",
660
- "aria-rowindex": y + 1,
661
- children: W
693
+ "aria-rowindex": O + 1,
694
+ children: D
662
695
  },
663
- z ? z({
664
- data: E,
665
- rowIndex: y
666
- }) : y
696
+ w ? w({
697
+ data: M,
698
+ rowIndex: O
699
+ }) : O
667
700
  )
668
701
  );
669
702
  }
670
- return $;
703
+ return W;
671
704
  }, [
672
- D,
673
- E,
674
- n,
705
+ F,
706
+ M,
675
707
  o,
676
- O,
677
- b,
678
- G,
679
- V,
680
- m,
708
+ n,
681
709
  I,
682
- z,
683
- N,
684
- Y
685
- ]), xe = /* @__PURE__ */ se(
710
+ y,
711
+ U,
712
+ E,
713
+ m,
714
+ x,
715
+ w,
716
+ A,
717
+ J
718
+ ]), ve = /* @__PURE__ */ oe(
686
719
  "div",
687
720
  {
688
721
  "aria-hidden": !0,
689
722
  style: {
690
- height: _(),
691
- width: p(),
723
+ height: S(),
724
+ width: v(),
692
725
  zIndex: -1
693
726
  }
694
727
  }
695
728
  );
696
- return Q(
697
- j,
729
+ return C(
730
+ B,
698
731
  {
699
- "aria-colcount": n,
700
- "aria-rowcount": I,
732
+ "aria-colcount": o,
733
+ "aria-rowcount": x,
701
734
  role: "grid",
702
735
  ...T,
703
736
  className: r,
704
- dir: i,
705
- ref: U,
737
+ dir: f,
738
+ ref: X,
706
739
  style: {
707
740
  position: "relative",
708
741
  maxHeight: "100%",
709
742
  maxWidth: "100%",
710
743
  flexGrow: 1,
711
744
  overflow: "auto",
712
- ...u
745
+ ...g
713
746
  }
714
747
  },
715
748
  ge,
716
749
  s,
717
- xe
750
+ ve
718
751
  );
719
752
  }
720
- const Ae = L, ke = P;
753
+ const Ve = V, Re = q;
721
754
  function Te(e) {
722
755
  return e != null && typeof e == "object" && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
723
756
  }
724
- const ne = "data-react-window-index";
725
- function Le({
757
+ function Me({
758
+ element: e,
759
+ getCellBounds: t,
760
+ isDynamicRowHeight: s,
761
+ rowCount: r,
762
+ rowElements: o,
763
+ scrollToIndex: n
764
+ }) {
765
+ const a = q(null), l = q(void 0), c = ee(() => {
766
+ a.current = null, l.current !== void 0 && (cancelAnimationFrame(l.current), l.current = void 0);
767
+ }), f = ee(() => {
768
+ l.current = void 0;
769
+ const i = a.current;
770
+ if (!i) return;
771
+ if (!e || !s || i.index >= r || performance.now() >= i.deadline) {
772
+ c();
773
+ return;
774
+ }
775
+ const d = n({
776
+ align: i.align,
777
+ containerScrollOffset: e.scrollTop,
778
+ index: i.index
779
+ });
780
+ if (d !== void 0) {
781
+ const u = Math.max(
782
+ 0,
783
+ Math.min(d, e.scrollHeight - e.clientHeight)
784
+ );
785
+ if (Math.abs(u - e.scrollTop) > 1)
786
+ i.stableFrames = 0, e.scrollTo({ behavior: "instant", top: u });
787
+ else {
788
+ const h = o.current;
789
+ if (!(h.some(
790
+ (w) => w.getAttribute(Z) === `${i.index}`
791
+ ) && h.every((w) => {
792
+ const g = Number(w.getAttribute(Z));
793
+ return Math.abs(
794
+ t(g).size - w.offsetHeight
795
+ ) <= 1;
796
+ })))
797
+ i.stableFrames = 0;
798
+ else if (++i.stableFrames >= 2) {
799
+ c();
800
+ return;
801
+ }
802
+ }
803
+ }
804
+ l.current = requestAnimationFrame(f);
805
+ });
806
+ return Y(() => {
807
+ if (!e) return;
808
+ const i = (d) => {
809
+ switch (d.key) {
810
+ case "ArrowUp":
811
+ case "ArrowDown":
812
+ case "PageUp":
813
+ case "PageDown":
814
+ case "Home":
815
+ case "End":
816
+ case " ":
817
+ c();
818
+ }
819
+ };
820
+ return e.addEventListener("wheel", c, { passive: !0 }), e.addEventListener("touchstart", c, { passive: !0 }), e.addEventListener("pointerdown", c), e.addEventListener("keydown", i), () => {
821
+ c(), e.removeEventListener("wheel", c), e.removeEventListener("touchstart", c), e.removeEventListener("pointerdown", c), e.removeEventListener("keydown", i);
822
+ };
823
+ }, [c, e]), $(
824
+ ({
825
+ align: i = "auto",
826
+ behavior: d = "auto",
827
+ index: u
828
+ }) => {
829
+ s && i === "smart" && (i = n({
830
+ align: "auto",
831
+ containerScrollOffset: e?.scrollTop ?? 0,
832
+ index: u
833
+ }) === (e?.scrollTop ?? 0) ? "auto" : "center");
834
+ const h = n({
835
+ align: i,
836
+ containerScrollOffset: e?.scrollTop ?? 0,
837
+ index: u
838
+ });
839
+ c(), typeof e?.scrollTo == "function" && (s && (a.current = {
840
+ align: i,
841
+ index: u,
842
+ deadline: performance.now() + 1e3,
843
+ stableFrames: 0
844
+ }, l.current = requestAnimationFrame(f)), e.scrollTo({
845
+ behavior: s ? "instant" : d,
846
+ top: h
847
+ }));
848
+ },
849
+ [c, f, e, s, n]
850
+ );
851
+ }
852
+ const Z = "data-react-window-index";
853
+ function ke({
726
854
  children: e,
727
855
  className: t,
728
856
  defaultHeight: s = 0,
729
857
  listRef: r,
730
- onResize: n,
731
- onRowsRendered: o,
732
- overscanCount: l = 3,
733
- rowComponent: f,
734
- rowCount: a,
735
- rowHeight: i,
736
- rowKey: d,
737
- rowProps: c,
738
- tagName: g = "div",
739
- style: x,
740
- ...I
858
+ onResize: o,
859
+ onRowsRendered: n,
860
+ overscanCount: a = 3,
861
+ rowComponent: l,
862
+ rowCount: c,
863
+ rowHeight: f,
864
+ rowKey: i,
865
+ rowProps: d,
866
+ tagName: u = "div",
867
+ style: h,
868
+ ...x
741
869
  }) {
742
- const h = he(c), z = R(
743
- () => ae(f, pe),
744
- [f]
745
- ), [u, j] = L(null), T = Te(i), E = R(() => T ? (b) => i.getRowHeight(b) ?? i.getAverageRowHeight() : i, [T, i]), {
746
- getCellBounds: D,
747
- getEstimatedSize: v,
748
- scrollToIndex: U,
870
+ const p = he(d), w = H(
871
+ () => fe(l, pe),
872
+ [l]
873
+ ), [g, B] = V(null), T = Te(f), M = H(() => T ? (E) => f.getRowHeight(E) ?? f.getAverageRowHeight() : f, [T, f]), {
874
+ getCellBounds: F,
875
+ getEstimatedSize: b,
876
+ scrollToIndex: X,
749
877
  startIndexOverscan: m,
750
- startIndexVisible: G,
751
- stopIndexOverscan: p,
752
- stopIndexVisible: O
753
- } = re({
754
- containerElement: u,
755
- containerStyle: x,
878
+ startIndexVisible: U,
879
+ stopIndexOverscan: v,
880
+ stopIndexVisible: I
881
+ } = ie({
882
+ containerElement: g,
883
+ containerStyle: h,
756
884
  defaultContainerSize: s,
757
885
  direction: "vertical",
758
- itemCount: a,
759
- itemProps: h,
760
- itemSize: E,
761
- onResize: n,
762
- overscanCount: l
886
+ itemCount: c,
887
+ itemProps: p,
888
+ itemSize: M,
889
+ onResize: o,
890
+ overscanCount: a
891
+ }), R = q([]), z = Me({
892
+ element: g,
893
+ getCellBounds: F,
894
+ isDynamicRowHeight: T,
895
+ rowCount: c,
896
+ rowElements: R,
897
+ scrollToIndex: X
763
898
  });
764
- fe(
899
+ de(
765
900
  r,
766
901
  () => ({
767
902
  get element() {
768
- return u;
903
+ return g;
769
904
  },
770
- scrollToRow({
771
- align: b = "auto",
772
- behavior: w = "auto",
773
- index: V
774
- }) {
775
- const _ = U({
776
- align: b,
777
- containerScrollOffset: u?.scrollTop ?? 0,
778
- index: V
779
- });
780
- typeof u?.scrollTo == "function" && u.scrollTo({
781
- behavior: w,
782
- top: _
783
- });
784
- }
905
+ scrollToRow: z
785
906
  }),
786
- [u, U]
787
- ), J(() => {
788
- if (!u)
907
+ [g, z]
908
+ ), Y(() => {
909
+ if (!g)
789
910
  return;
790
- const b = Array.from(u.children).filter((w, V) => {
791
- if (w.hasAttribute("aria-hidden"))
911
+ const E = Array.from(g.children).slice(
912
+ 0,
913
+ m < 0 ? 0 : v - m + 1
914
+ ).filter((S, A) => {
915
+ if (S.hasAttribute("aria-hidden"))
792
916
  return !1;
793
- const _ = `${m + V}`;
794
- return w.setAttribute(ne, _), !0;
917
+ const P = `${m + A}`;
918
+ return S.setAttribute(Z, P), !0;
795
919
  });
796
- if (T)
797
- return i.observeRowElements(b);
920
+ if (R.current = E, T)
921
+ return f.observeRowElements(E);
798
922
  }, [
799
- u,
923
+ w,
924
+ g,
800
925
  T,
926
+ c,
927
+ f,
801
928
  i,
929
+ p,
802
930
  m,
803
- p
804
- ]), Z(() => {
805
- m >= 0 && p >= 0 && o && o(
931
+ v
932
+ ]), te(() => {
933
+ m >= 0 && v >= 0 && n && n(
806
934
  {
807
- startIndex: G,
808
- stopIndex: O
935
+ startIndex: U,
936
+ stopIndex: I
809
937
  },
810
938
  {
811
939
  startIndex: m,
812
- stopIndex: p
940
+ stopIndex: v
813
941
  }
814
942
  );
815
943
  }, [
816
- o,
944
+ n,
817
945
  m,
818
- G,
819
- p,
820
- O
946
+ U,
947
+ v,
948
+ I
821
949
  ]);
822
- const M = R(() => {
823
- const b = [];
824
- if (a > 0)
825
- for (let w = m; w <= p; w++) {
826
- const V = D(w);
827
- b.push(
828
- /* @__PURE__ */ Q(
829
- z,
950
+ const y = H(() => {
951
+ const E = [];
952
+ if (c > 0)
953
+ for (let S = m; S <= v; S++) {
954
+ const A = F(S);
955
+ E.push(
956
+ /* @__PURE__ */ C(
957
+ w,
830
958
  {
831
- ...h,
959
+ ...p,
832
960
  ariaAttributes: {
833
- "aria-posinset": w + 1,
834
- "aria-setsize": a,
961
+ "aria-posinset": S + 1,
962
+ "aria-setsize": c,
835
963
  role: "listitem"
836
964
  },
837
- key: d ? d(w, h) : w,
838
- index: w,
965
+ key: i ? i(S, p) : S,
966
+ index: S,
839
967
  style: {
840
968
  position: "absolute",
841
969
  left: 0,
842
- transform: `translateY(${V.scrollOffset}px)`,
970
+ transform: `translateY(${A.scrollOffset}px)`,
843
971
  // In case of dynamic row heights, don't specify a height style
844
972
  // otherwise a default/estimated height would mask the actual height
845
- height: T ? void 0 : V.size,
973
+ height: T ? void 0 : A.size,
846
974
  width: "100%"
847
975
  }
848
976
  }
849
977
  )
850
978
  );
851
979
  }
852
- return b;
980
+ return E;
853
981
  }, [
854
- z,
855
- D,
982
+ w,
983
+ F,
856
984
  T,
857
- a,
858
- d,
859
- h,
985
+ c,
986
+ i,
987
+ p,
860
988
  m,
861
- p
862
- ]), S = /* @__PURE__ */ se(
989
+ v
990
+ ]), G = /* @__PURE__ */ oe(
863
991
  "div",
864
992
  {
865
993
  "aria-hidden": !0,
866
994
  style: {
867
- height: v(),
995
+ height: b(),
868
996
  width: "100%",
869
997
  zIndex: -1
870
998
  }
871
999
  }
872
1000
  );
873
- return Q(
874
- g,
1001
+ return C(
1002
+ u,
875
1003
  {
876
1004
  role: "list",
877
- ...I,
1005
+ ...x,
878
1006
  className: t,
879
- ref: j,
1007
+ ref: B,
880
1008
  style: {
881
1009
  position: "relative",
882
1010
  maxHeight: "100%",
883
1011
  flexGrow: 1,
884
1012
  overflowY: "auto",
885
- ...x
1013
+ ...h
886
1014
  }
887
1015
  },
888
- M,
1016
+ y,
889
1017
  e,
890
- S
1018
+ G
891
1019
  );
892
1020
  }
893
- function Me({
1021
+ function $e({
894
1022
  defaultRowHeight: e,
895
1023
  key: t
896
1024
  }) {
897
- const [s, r] = L({
1025
+ const [s, r] = V({
898
1026
  key: t,
899
1027
  map: /* @__PURE__ */ new Map()
900
1028
  });
@@ -902,83 +1030,83 @@ function Me({
902
1030
  key: t,
903
1031
  map: /* @__PURE__ */ new Map()
904
1032
  });
905
- const { map: n } = s, o = B(() => {
906
- let c = 0;
907
- return n.forEach((g) => {
908
- c += g;
909
- }), c === 0 ? e : c / n.size;
910
- }, [e, n]), l = B(
911
- (c) => {
912
- const g = n.get(c);
913
- return g !== void 0 ? g : (n.set(c, e), e);
1033
+ const { map: o } = s, n = $(() => {
1034
+ let d = 0;
1035
+ return o.forEach((u) => {
1036
+ d += u;
1037
+ }), d === 0 ? e : d / o.size;
1038
+ }, [e, o]), a = $(
1039
+ (d) => {
1040
+ const u = o.get(d);
1041
+ return u !== void 0 ? u : e;
914
1042
  },
915
- [e, n]
916
- ), f = B((c, g) => {
917
- r((x) => {
918
- if (x.map.get(c) === g)
919
- return x;
920
- const I = new Map(x.map);
921
- return I.set(c, g), {
922
- ...x,
923
- map: I
1043
+ [e, o]
1044
+ ), l = $((d, u) => {
1045
+ r((h) => {
1046
+ if (h.map.get(d) === u)
1047
+ return h;
1048
+ const x = new Map(h.map);
1049
+ return x.set(d, u), {
1050
+ ...h,
1051
+ map: x
924
1052
  };
925
1053
  });
926
- }, []), a = de(
927
- (c) => {
928
- c.length !== 0 && c.forEach((g) => {
929
- const { borderBoxSize: x, target: I } = g, h = I.getAttribute(ne);
930
- k(
931
- h !== null,
932
- `Invalid ${ne} attribute value`
1054
+ }, []), c = ee(
1055
+ (d) => {
1056
+ d.length !== 0 && d.forEach((u) => {
1057
+ const { borderBoxSize: h, target: x } = u, p = x.getAttribute(Z);
1058
+ L(
1059
+ p !== null,
1060
+ `Invalid ${Z} attribute value`
933
1061
  );
934
- const z = parseInt(h), { blockSize: u } = x[0];
935
- u && f(z, u);
1062
+ const w = parseInt(p), { blockSize: g } = h[0];
1063
+ g && l(w, g);
936
1064
  });
937
1065
  }
938
- ), [i] = L(() => {
1066
+ ), [f] = V(() => {
939
1067
  if (typeof ResizeObserver < "u")
940
- return new ResizeObserver(a);
1068
+ return new ResizeObserver(c);
941
1069
  });
942
- Z(() => {
943
- if (i)
1070
+ te(() => {
1071
+ if (f)
944
1072
  return () => {
945
- i.disconnect();
1073
+ f.disconnect();
946
1074
  };
947
- }, [i]);
948
- const d = B(
949
- (c) => i ? (c.forEach((g) => i.observe(g)), () => {
950
- c.forEach((g) => i.unobserve(g));
1075
+ }, [f]);
1076
+ const i = $(
1077
+ (d) => f ? (d.forEach((u) => f.observe(u)), () => {
1078
+ d.forEach((u) => f.unobserve(u));
951
1079
  }) : () => {
952
1080
  },
953
- [i]
1081
+ [f]
954
1082
  );
955
- return R(
1083
+ return H(
956
1084
  () => ({
957
- getAverageRowHeight: o,
958
- getRowHeight: l,
959
- setRowHeight: f,
960
- observeRowElements: d
1085
+ getAverageRowHeight: n,
1086
+ getRowHeight: a,
1087
+ setRowHeight: l,
1088
+ observeRowElements: i
961
1089
  }),
962
- [o, l, f, d]
1090
+ [n, a, l, i]
963
1091
  );
964
1092
  }
965
- const $e = L, He = P;
966
- let te = -1;
1093
+ const He = V, Fe = q;
1094
+ let ne = -1;
967
1095
  function We(e = !1) {
968
- if (te === -1 || e) {
1096
+ if (ne === -1 || e) {
969
1097
  const t = document.createElement("div"), s = t.style;
970
- s.width = "50px", s.height = "50px", s.overflow = "scroll", document.body.appendChild(t), te = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
1098
+ s.width = "50px", s.height = "50px", s.overflow = "scroll", document.body.appendChild(t), ne = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
971
1099
  }
972
- return te;
1100
+ return ne;
973
1101
  }
974
1102
  export {
975
- Ve as Grid,
976
- Le as List,
1103
+ Le as Grid,
1104
+ ke as List,
977
1105
  We as getScrollbarSize,
978
- Me as useDynamicRowHeight,
979
- Ae as useGridCallbackRef,
980
- ke as useGridRef,
981
- $e as useListCallbackRef,
982
- He as useListRef
1106
+ $e as useDynamicRowHeight,
1107
+ Ve as useGridCallbackRef,
1108
+ Re as useGridRef,
1109
+ He as useListCallbackRef,
1110
+ Fe as useListRef
983
1111
  };
984
1112
  //# sourceMappingURL=react-window.js.map