@cagatayfdn/flora-components 0.0.150 → 0.0.152

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,3694 +0,0 @@
1
- import { j as I } from "./jsx-runtime-BcAkpsdy.js";
2
- import j, { createElement as Tt, useRef as Lt, useState as Je, useEffect as ao } from "react";
3
- import { c as wt } from "./index-BHf7G3IG.js";
4
- import "./hooks/useAauth.js";
5
- import Wo from "./hooks/useNiceModal.js";
6
- import "./components/Drawer/Provider.js";
7
- import be from "./components/Icon/index.js";
8
- import { N as Ao } from "./index-H7XbDVmH.js";
9
- import "./assets/images/500_error_2x.gif";
10
- import Qe, { t as pt } from "./locales/i18n.js";
11
- import "./components/Tooltip/Tooltip.js";
12
- import "./react-toastify.esm-BUWNP7Nm.js";
13
- import uo from "./utils/date.js";
14
- import Cn from "./components/Input/Input.js";
15
- import Sn from "./components/ScrollContainer/ScrollContainer.js";
16
- import "./components/Charts/index.js";
17
- import "./components/Checkbox/Checkbox.js";
18
- import "./components/Confirm/Confirm.js";
19
- import "./components/Datepicker/Datepicker.js";
20
- import mo from "./components/Divider/Divider.js";
21
- import "./components/FileUpload/FileUpload.js";
22
- import Oo from "./components/Modal/Modal.js";
23
- import fo from "./components/Grid/Column.js";
24
- import yn from "./components/Grid/Row.js";
25
- import Pt from "./components/InfoDate/InfoDate.js";
26
- import bn from "react-dom";
27
- import { d as jt } from "./helper-1SQ9SI45.js";
28
- import { startFetcher as Hn } from "./utils/fetcher.js";
29
- import "./utils/yup.js";
30
- import { FloraIcons as et } from "./assets/icons/flora-icons.js";
31
- import xt from "./components/IconBox/IconBox.js";
32
- import { S as _n } from "./Select-nhp2PiJK.js";
33
- import kn from "./components/StatusTag/StatusTag.js";
34
- import "./components/Switch/Switch.js";
35
- import "./components/Textarea/Textarea.js";
36
- import { AppearanceButton as ho, NotificationAppearanceType as En } from "./enums/appearance.js";
37
- import go from "./components/Button/Button.js";
38
- import { Notification as Rn } from "./components/Notification/Notification.js";
39
- import './ReactToastify.css';import './ErrorLogModal.css';/* empty css */
40
- import { u as zn } from "./useTranslation-CnCPcxVj.js";
41
- import { T as Bn } from "./Trans-B4ILpbwK.js";
42
- const Ln = "_realTimeLogModalStyle_ew0yg_1", jn = "_modalLeft_ew0yg_30", Mn = "_buttonGroup_ew0yg_37", Nn = "_iosIcon_ew0yg_48", nt = {
43
- realTimeLogModalStyle: Ln,
44
- modalLeft: jn,
45
- buttonGroup: Mn,
46
- iosIcon: Nn
47
- }, kt = 0, Ge = 1, ot = 2, Po = 4;
48
- function po(e) {
49
- return () => e;
50
- }
51
- function Wn(e) {
52
- e();
53
- }
54
- function Do(e, t) {
55
- return (o) => e(t(o));
56
- }
57
- function xo(e, t) {
58
- return () => e(t);
59
- }
60
- function An(e, t) {
61
- return (o) => e(t, o);
62
- }
63
- function Ut(e) {
64
- return e !== void 0;
65
- }
66
- function On(...e) {
67
- return () => {
68
- e.map(Wn);
69
- };
70
- }
71
- function dt() {
72
- }
73
- function Et(e, t) {
74
- return t(e), e;
75
- }
76
- function Pn(e, t) {
77
- return t(e);
78
- }
79
- function ie(...e) {
80
- return e;
81
- }
82
- function Z(e, t) {
83
- return e(Ge, t);
84
- }
85
- function F(e, t) {
86
- e(kt, t);
87
- }
88
- function Kt(e) {
89
- e(ot);
90
- }
91
- function le(e) {
92
- return e(Po);
93
- }
94
- function N(e, t) {
95
- return Z(e, An(t, kt));
96
- }
97
- function ze(e, t) {
98
- const o = e(Ge, (n) => {
99
- o(), t(n);
100
- });
101
- return o;
102
- }
103
- function vo(e) {
104
- let t, o;
105
- return (n) => (r) => {
106
- t = r, o && clearTimeout(o), o = setTimeout(() => {
107
- n(t);
108
- }, e);
109
- };
110
- }
111
- function Vo(e, t) {
112
- return e === t;
113
- }
114
- function re(e = Vo) {
115
- let t;
116
- return (o) => (n) => {
117
- e(t, n) || (t = n, o(n));
118
- };
119
- }
120
- function O(e) {
121
- return (t) => (o) => {
122
- e(o) && t(o);
123
- };
124
- }
125
- function R(e) {
126
- return (t) => Do(t, e);
127
- }
128
- function Ne(e) {
129
- return (t) => () => {
130
- t(e);
131
- };
132
- }
133
- function v(e, ...t) {
134
- const o = Dn(...t);
135
- return (n, r) => {
136
- switch (n) {
137
- case ot:
138
- Kt(e);
139
- return;
140
- case Ge:
141
- return Z(e, o(r));
142
- }
143
- };
144
- }
145
- function We(e, t) {
146
- return (o) => (n) => {
147
- o(t = e(t, n));
148
- };
149
- }
150
- function Ke(e) {
151
- return (t) => (o) => {
152
- e > 0 ? e-- : t(o);
153
- };
154
- }
155
- function Pe(e) {
156
- let t = null, o;
157
- return (n) => (r) => {
158
- t = r, !o && (o = setTimeout(() => {
159
- o = void 0, n(t);
160
- }, e));
161
- };
162
- }
163
- function $(...e) {
164
- const t = new Array(e.length);
165
- let o = 0, n = null;
166
- const r = Math.pow(2, e.length) - 1;
167
- return e.forEach((i, s) => {
168
- const l = Math.pow(2, s);
169
- Z(i, (c) => {
170
- const a = o;
171
- o = o | l, t[s] = c, a !== r && o === r && n && (n(), n = null);
172
- });
173
- }), (i) => (s) => {
174
- const l = () => {
175
- i([s].concat(t));
176
- };
177
- o === r ? l() : n = l;
178
- };
179
- }
180
- function Dn(...e) {
181
- return (t) => e.reduceRight(Pn, t);
182
- }
183
- function Vn(e) {
184
- let t, o;
185
- const n = () => t == null ? void 0 : t();
186
- return function(r, i) {
187
- switch (r) {
188
- case Ge:
189
- return i ? o === i ? void 0 : (n(), o = i, t = Z(e, i), t) : (n(), dt);
190
- case ot:
191
- n(), o = null;
192
- return;
193
- }
194
- };
195
- }
196
- function H(e) {
197
- let t = e;
198
- const o = K();
199
- return (n, r) => {
200
- switch (n) {
201
- case kt:
202
- t = r;
203
- break;
204
- case Ge: {
205
- r(t);
206
- break;
207
- }
208
- case Po:
209
- return t;
210
- }
211
- return o(n, r);
212
- };
213
- }
214
- function pe(e, t) {
215
- return Et(H(t), (o) => N(e, o));
216
- }
217
- function K() {
218
- const e = [];
219
- return (t, o) => {
220
- switch (t) {
221
- case kt:
222
- e.slice().forEach((n) => {
223
- n(o);
224
- });
225
- return;
226
- case ot:
227
- e.splice(0, e.length);
228
- return;
229
- case Ge:
230
- return e.push(o), () => {
231
- const n = e.indexOf(o);
232
- n > -1 && e.splice(n, 1);
233
- };
234
- }
235
- };
236
- }
237
- function _e(e) {
238
- return Et(K(), (t) => N(e, t));
239
- }
240
- function J(e, t = [], { singleton: o } = { singleton: !0 }) {
241
- return {
242
- constructor: e,
243
- dependencies: t,
244
- id: Gn(),
245
- singleton: o
246
- };
247
- }
248
- const Gn = () => Symbol();
249
- function Fn(e) {
250
- const t = /* @__PURE__ */ new Map(), o = ({ constructor: n, dependencies: r, id: i, singleton: s }) => {
251
- if (s && t.has(i))
252
- return t.get(i);
253
- const l = n(r.map((c) => o(c)));
254
- return s && t.set(i, l), l;
255
- };
256
- return o(e);
257
- }
258
- function ae(...e) {
259
- const t = K(), o = new Array(e.length);
260
- let n = 0;
261
- const r = Math.pow(2, e.length) - 1;
262
- return e.forEach((i, s) => {
263
- const l = Math.pow(2, s);
264
- Z(i, (c) => {
265
- o[s] = c, n = n | l, n === r && F(t, o);
266
- });
267
- }), function(i, s) {
268
- switch (i) {
269
- case ot: {
270
- Kt(t);
271
- return;
272
- }
273
- case Ge:
274
- return n === r && s(o), Z(t, s);
275
- }
276
- };
277
- }
278
- function W(e, t = Vo) {
279
- return v(e, re(t));
280
- }
281
- function Dt(...e) {
282
- return function(t, o) {
283
- switch (t) {
284
- case ot:
285
- return;
286
- case Ge:
287
- return On(...e.map((n) => Z(n, o)));
288
- }
289
- };
290
- }
291
- var Te = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e))(Te || {});
292
- const $n = {
293
- 0: "debug",
294
- 3: "error",
295
- 1: "log",
296
- 2: "warn"
297
- }, qn = () => typeof globalThis > "u" ? window : globalThis, Fe = J(
298
- () => {
299
- const e = H(
300
- 3
301
- /* ERROR */
302
- );
303
- return {
304
- log: H((t, o, n = 1) => {
305
- var r;
306
- const i = (r = qn().VIRTUOSO_LOG_LEVEL) != null ? r : le(e);
307
- n >= i && console[$n[n]](
308
- "%creact-virtuoso: %c%s %o",
309
- "color: #0253b3; font-weight: bold",
310
- "color: initial",
311
- t,
312
- o
313
- );
314
- }),
315
- logLevel: e
316
- };
317
- },
318
- [],
319
- { singleton: !0 }
320
- );
321
- function Ye(e, t, o) {
322
- return Yt(e, t, o).callbackRef;
323
- }
324
- function Yt(e, t, o) {
325
- const n = j.useRef(null);
326
- let r = (s) => {
327
- };
328
- const i = j.useMemo(() => typeof ResizeObserver < "u" ? new ResizeObserver((s) => {
329
- const l = () => {
330
- const c = s[0].target;
331
- c.offsetParent !== null && e(c);
332
- };
333
- o ? l() : requestAnimationFrame(l);
334
- }) : null, [e, o]);
335
- return r = (s) => {
336
- s && t ? (i == null || i.observe(s), n.current = s) : (n.current && (i == null || i.unobserve(n.current)), n.current = null);
337
- }, { callbackRef: r, ref: n };
338
- }
339
- function Un(e, t, o, n, r, i, s, l, c) {
340
- const a = j.useCallback(
341
- (h) => {
342
- const w = Kn(h.children, t, l ? "offsetWidth" : "offsetHeight", r);
343
- let g = h.parentElement;
344
- for (; !g.dataset.virtuosoScroller; )
345
- g = g.parentElement;
346
- const p = g.lastElementChild.dataset.viewportType === "window";
347
- let _;
348
- p && (_ = g.ownerDocument.defaultView);
349
- const b = s ? l ? s.scrollLeft : s.scrollTop : p ? l ? _.scrollX || _.document.documentElement.scrollLeft : _.scrollY || _.document.documentElement.scrollTop : l ? g.scrollLeft : g.scrollTop, x = s ? l ? s.scrollWidth : s.scrollHeight : p ? l ? _.document.documentElement.scrollWidth : _.document.documentElement.scrollHeight : l ? g.scrollWidth : g.scrollHeight, f = s ? l ? s.offsetWidth : s.offsetHeight : p ? l ? _.innerWidth : _.innerHeight : l ? g.offsetWidth : g.offsetHeight;
350
- n({
351
- scrollHeight: x,
352
- scrollTop: Math.max(b, 0),
353
- viewportHeight: f
354
- }), i == null || i(
355
- l ? Io("column-gap", getComputedStyle(h).columnGap, r) : Io("row-gap", getComputedStyle(h).rowGap, r)
356
- ), w !== null && e(w);
357
- },
358
- [e, t, r, i, s, n, l]
359
- );
360
- return Yt(a, o, c);
361
- }
362
- function Kn(e, t, o, n) {
363
- const r = e.length;
364
- if (r === 0)
365
- return null;
366
- const i = [];
367
- for (let s = 0; s < r; s++) {
368
- const l = e.item(s);
369
- if (l.dataset.index === void 0)
370
- continue;
371
- const c = parseInt(l.dataset.index), a = parseFloat(l.dataset.knownSize), h = t(l, o);
372
- if (h === 0 && n("Zero-sized element, this should not happen", { child: l }, Te.ERROR), h === a)
373
- continue;
374
- const w = i[i.length - 1];
375
- i.length === 0 || w.size !== h || w.endIndex !== c - 1 ? i.push({ endIndex: c, size: h, startIndex: c }) : i[i.length - 1].endIndex++;
376
- }
377
- return i;
378
- }
379
- function Io(e, t, o) {
380
- return t !== "normal" && !(t != null && t.endsWith("px")) && o(`${e} was not resolved to pixel value correctly`, t, Te.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
381
- }
382
- function Go(e, t, o) {
383
- const n = j.useRef(null), r = j.useCallback(
384
- (c) => {
385
- if (!(c != null && c.offsetParent))
386
- return;
387
- const a = c.getBoundingClientRect(), h = a.width;
388
- let w, g;
389
- if (t) {
390
- const p = t.getBoundingClientRect(), _ = a.top - p.top;
391
- g = p.height - Math.max(0, _), w = _ + t.scrollTop;
392
- } else {
393
- const p = s.current.ownerDocument.defaultView;
394
- g = p.innerHeight - Math.max(0, a.top), w = a.top + p.scrollY;
395
- }
396
- n.current = {
397
- offsetTop: w,
398
- visibleHeight: g,
399
- visibleWidth: h
400
- }, e(n.current);
401
- },
402
- // eslint-disable-next-line react-hooks/exhaustive-deps
403
- [e, t]
404
- ), { callbackRef: i, ref: s } = Yt(r, !0, o), l = j.useCallback(() => {
405
- r(s.current);
406
- }, [r, s]);
407
- return j.useEffect(() => {
408
- var c;
409
- if (t) {
410
- t.addEventListener("scroll", l);
411
- const a = new ResizeObserver(() => {
412
- requestAnimationFrame(l);
413
- });
414
- return a.observe(t), () => {
415
- t.removeEventListener("scroll", l), a.unobserve(t);
416
- };
417
- } else {
418
- const a = (c = s.current) == null ? void 0 : c.ownerDocument.defaultView;
419
- return a == null || a.addEventListener("scroll", l), a == null || a.addEventListener("resize", l), () => {
420
- a == null || a.removeEventListener("scroll", l), a == null || a.removeEventListener("resize", l);
421
- };
422
- }
423
- }, [l, t, s]), i;
424
- }
425
- const xe = J(
426
- () => {
427
- const e = K(), t = K(), o = H(0), n = K(), r = H(0), i = K(), s = K(), l = H(0), c = H(0), a = H(0), h = H(0), w = K(), g = K(), p = H(!1), _ = H(!1), b = H(!1);
428
- return N(
429
- v(
430
- e,
431
- R(({ scrollTop: x }) => x)
432
- ),
433
- t
434
- ), N(
435
- v(
436
- e,
437
- R(({ scrollHeight: x }) => x)
438
- ),
439
- s
440
- ), N(t, r), {
441
- deviation: o,
442
- fixedFooterHeight: a,
443
- fixedHeaderHeight: c,
444
- footerHeight: h,
445
- headerHeight: l,
446
- horizontalDirection: _,
447
- scrollBy: g,
448
- // input
449
- scrollContainerState: e,
450
- scrollHeight: s,
451
- scrollingInProgress: p,
452
- // signals
453
- scrollTo: w,
454
- scrollTop: t,
455
- skipAnimationFrameInResizeObserver: b,
456
- smoothScrollTargetReached: n,
457
- // state
458
- statefulScrollTop: r,
459
- viewportHeight: i
460
- };
461
- },
462
- [],
463
- { singleton: !0 }
464
- ), st = { lvl: 0 };
465
- function Fo(e, t) {
466
- const o = e.length;
467
- if (o === 0)
468
- return [];
469
- let { index: n, value: r } = t(e[0]);
470
- const i = [];
471
- for (let s = 1; s < o; s++) {
472
- const { index: l, value: c } = t(e[s]);
473
- i.push({ end: l - 1, start: n, value: r }), n = l, r = c;
474
- }
475
- return i.push({ end: 1 / 0, start: n, value: r }), i;
476
- }
477
- function ee(e) {
478
- return e === st;
479
- }
480
- function lt(e, t) {
481
- if (!ee(e))
482
- return t === e.k ? e.v : t < e.k ? lt(e.l, t) : lt(e.r, t);
483
- }
484
- function Be(e, t, o = "k") {
485
- if (ee(e))
486
- return [-1 / 0, void 0];
487
- if (Number(e[o]) === t)
488
- return [e.k, e.v];
489
- if (Number(e[o]) < t) {
490
- const n = Be(e.r, t, o);
491
- return n[0] === -1 / 0 ? [e.k, e.v] : n;
492
- }
493
- return Be(e.l, t, o);
494
- }
495
- function He(e, t, o) {
496
- return ee(e) ? Uo(t, o, 1) : t === e.k ? me(e, { k: t, v: o }) : t < e.k ? To(me(e, { l: He(e.l, t, o) })) : To(me(e, { r: He(e.r, t, o) }));
497
- }
498
- function tt() {
499
- return st;
500
- }
501
- function Rt(e, t, o) {
502
- if (ee(e))
503
- return [];
504
- const n = Be(e, t)[0];
505
- return Yn(Gt(e, n, o));
506
- }
507
- function Vt(e, t) {
508
- if (ee(e))
509
- return st;
510
- const { k: o, l: n, r } = e;
511
- if (t === o) {
512
- if (ee(n))
513
- return r;
514
- if (ee(r))
515
- return n;
516
- {
517
- const [i, s] = qo(n);
518
- return Ct(me(e, { k: i, l: $o(n), v: s }));
519
- }
520
- } else
521
- return t < o ? Ct(me(e, { l: Vt(n, t) })) : Ct(me(e, { r: Vt(r, t) }));
522
- }
523
- function Ue(e) {
524
- return ee(e) ? [] : [...Ue(e.l), { k: e.k, v: e.v }, ...Ue(e.r)];
525
- }
526
- function Gt(e, t, o) {
527
- if (ee(e))
528
- return [];
529
- const { k: n, l: r, r: i, v: s } = e;
530
- let l = [];
531
- return n > t && (l = l.concat(Gt(r, t, o))), n >= t && n <= o && l.push({ k: n, v: s }), n <= o && (l = l.concat(Gt(i, t, o))), l;
532
- }
533
- function Ct(e) {
534
- const { l: t, lvl: o, r: n } = e;
535
- if (n.lvl >= o - 1 && t.lvl >= o - 1)
536
- return e;
537
- if (o > n.lvl + 1) {
538
- if (Mt(t))
539
- return Ko(me(e, { lvl: o - 1 }));
540
- if (!ee(t) && !ee(t.r))
541
- return me(t.r, {
542
- l: me(t, { r: t.r.l }),
543
- lvl: o,
544
- r: me(e, {
545
- l: t.r.r,
546
- lvl: o - 1
547
- })
548
- });
549
- throw new Error("Unexpected empty nodes");
550
- } else {
551
- if (Mt(e))
552
- return Ft(me(e, { lvl: o - 1 }));
553
- if (!ee(n) && !ee(n.l)) {
554
- const r = n.l, i = Mt(r) ? n.lvl - 1 : n.lvl;
555
- return me(r, {
556
- l: me(e, {
557
- lvl: o - 1,
558
- r: r.l
559
- }),
560
- lvl: r.lvl + 1,
561
- r: Ft(me(n, { l: r.r, lvl: i }))
562
- });
563
- } else
564
- throw new Error("Unexpected empty nodes");
565
- }
566
- }
567
- function me(e, t) {
568
- return Uo(
569
- t.k !== void 0 ? t.k : e.k,
570
- t.v !== void 0 ? t.v : e.v,
571
- t.lvl !== void 0 ? t.lvl : e.lvl,
572
- t.l !== void 0 ? t.l : e.l,
573
- t.r !== void 0 ? t.r : e.r
574
- );
575
- }
576
- function $o(e) {
577
- return ee(e.r) ? e.l : Ct(me(e, { r: $o(e.r) }));
578
- }
579
- function Mt(e) {
580
- return ee(e) || e.lvl > e.r.lvl;
581
- }
582
- function qo(e) {
583
- return ee(e.r) ? [e.k, e.v] : qo(e.r);
584
- }
585
- function Uo(e, t, o, n = st, r = st) {
586
- return { k: e, l: n, lvl: o, r, v: t };
587
- }
588
- function To(e) {
589
- return Ft(Ko(e));
590
- }
591
- function Ko(e) {
592
- const { l: t } = e;
593
- return !ee(t) && t.lvl === e.lvl ? me(t, { r: me(e, { l: t.r }) }) : e;
594
- }
595
- function Ft(e) {
596
- const { lvl: t, r: o } = e;
597
- return !ee(o) && !ee(o.r) && o.lvl === t && o.r.lvl === t ? me(o, { l: me(e, { r: o.l }), lvl: t + 1 }) : e;
598
- }
599
- function Yn(e) {
600
- return Fo(e, ({ k: t, v: o }) => ({ index: t, value: o }));
601
- }
602
- function Yo(e, t) {
603
- return !!(e && e.startIndex === t.startIndex && e.endIndex === t.endIndex);
604
- }
605
- function ct(e, t) {
606
- return !!(e && e[0] === t[0] && e[1] === t[1]);
607
- }
608
- const Xt = J(
609
- () => ({ recalcInProgress: H(!1) }),
610
- [],
611
- { singleton: !0 }
612
- );
613
- function Xo(e, t, o) {
614
- return e[yt(e, t, o)];
615
- }
616
- function yt(e, t, o, n = 0) {
617
- let r = e.length - 1;
618
- for (; n <= r; ) {
619
- const i = Math.floor((n + r) / 2), s = e[i], l = o(s, t);
620
- if (l === 0)
621
- return i;
622
- if (l === -1) {
623
- if (r - n < 2)
624
- return i - 1;
625
- r = i - 1;
626
- } else {
627
- if (r === n)
628
- return i;
629
- n = i + 1;
630
- }
631
- }
632
- throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`);
633
- }
634
- function Xn(e, t, o, n) {
635
- const r = yt(e, t, n), i = yt(e, o, n, r);
636
- return e.slice(r, i + 1);
637
- }
638
- function Ve(e, t) {
639
- return Math.round(e.getBoundingClientRect()[t]);
640
- }
641
- function zt(e) {
642
- return !ee(e.groupOffsetTree);
643
- }
644
- function Zt({ index: e }, t) {
645
- return t === e ? 0 : t < e ? -1 : 1;
646
- }
647
- function Zn() {
648
- return {
649
- groupIndices: [],
650
- groupOffsetTree: tt(),
651
- lastIndex: 0,
652
- lastOffset: 0,
653
- lastSize: 0,
654
- offsetTree: [],
655
- sizeTree: tt()
656
- };
657
- }
658
- function Jn(e, t) {
659
- let o = ee(e) ? 0 : 1 / 0;
660
- for (const n of t) {
661
- const { endIndex: r, size: i, startIndex: s } = n;
662
- if (o = Math.min(o, s), ee(e)) {
663
- e = He(e, 0, i);
664
- continue;
665
- }
666
- const l = Rt(e, s - 1, r + 1);
667
- if (l.some(ir(n)))
668
- continue;
669
- let c = !1, a = !1;
670
- for (const { end: h, start: w, value: g } of l)
671
- c ? (r >= w || i === g) && (e = Vt(e, w)) : (a = g !== i, c = !0), h > r && r >= w && g !== i && (e = He(e, r + 1, g));
672
- a && (e = He(e, s, i));
673
- }
674
- return [e, o];
675
- }
676
- function Qn(e) {
677
- return typeof e.groupIndex < "u";
678
- }
679
- function er({ offset: e }, t) {
680
- return t === e ? 0 : t < e ? -1 : 1;
681
- }
682
- function at(e, t, o) {
683
- if (t.length === 0)
684
- return 0;
685
- const { index: n, offset: r, size: i } = Xo(t, e, Zt), s = e - n, l = i * s + (s - 1) * o + r;
686
- return l > 0 ? l + o : l;
687
- }
688
- function Zo(e, t) {
689
- if (!zt(t))
690
- return e;
691
- let o = 0;
692
- for (; t.groupIndices[o] <= e + o; )
693
- o++;
694
- return e + o;
695
- }
696
- function Jo(e, t, o) {
697
- if (Qn(e))
698
- return t.groupIndices[e.groupIndex] + 1;
699
- {
700
- const n = e.index === "LAST" ? o : e.index;
701
- let r = Zo(n, t);
702
- return r = Math.max(0, r, Math.min(o, r)), r;
703
- }
704
- }
705
- function tr(e, t, o, n = 0) {
706
- return n > 0 && (t = Math.max(t, Xo(e, n, Zt).offset)), Fo(Xn(e, t, o, er), rr);
707
- }
708
- function or(e, [t, o, n, r]) {
709
- t.length > 0 && n("received item sizes", t, Te.DEBUG);
710
- const i = e.sizeTree;
711
- let s = i, l = 0;
712
- if (o.length > 0 && ee(i) && t.length === 2) {
713
- const g = t[0].size, p = t[1].size;
714
- s = o.reduce((_, b) => He(He(_, b, g), b + 1, p), s);
715
- } else
716
- [s, l] = Jn(s, t);
717
- if (s === i)
718
- return e;
719
- const { lastIndex: c, lastOffset: a, lastSize: h, offsetTree: w } = $t(e.offsetTree, l, s, r);
720
- return {
721
- groupIndices: o,
722
- groupOffsetTree: o.reduce((g, p) => He(g, p, at(p, w, r)), tt()),
723
- lastIndex: c,
724
- lastOffset: a,
725
- lastSize: h,
726
- offsetTree: w,
727
- sizeTree: s
728
- };
729
- }
730
- function nr(e) {
731
- return Ue(e).map(({ k: t, v: o }, n, r) => {
732
- const i = r[n + 1];
733
- return { endIndex: i ? i.k - 1 : 1 / 0, size: o, startIndex: t };
734
- });
735
- }
736
- function wo(e, t) {
737
- let o = 0, n = 0;
738
- for (; o < e; )
739
- o += t[n + 1] - t[n] - 1, n++;
740
- return n - (o === e ? 0 : 1);
741
- }
742
- function $t(e, t, o, n) {
743
- let r = e, i = 0, s = 0, l = 0, c = 0;
744
- if (t !== 0) {
745
- c = yt(r, t - 1, Zt), l = r[c].offset;
746
- const a = Be(o, t - 1);
747
- i = a[0], s = a[1], r.length && r[c].size === Be(o, t)[1] && (c -= 1), r = r.slice(0, c + 1);
748
- } else
749
- r = [];
750
- for (const { start: a, value: h } of Rt(o, t, 1 / 0)) {
751
- const w = a - i, g = w * s + l + w * n;
752
- r.push({
753
- index: a,
754
- offset: g,
755
- size: h
756
- }), i = a, l = g, s = h;
757
- }
758
- return {
759
- lastIndex: i,
760
- lastOffset: l,
761
- lastSize: s,
762
- offsetTree: r
763
- };
764
- }
765
- function rr(e) {
766
- return { index: e.index, value: e };
767
- }
768
- function ir(e) {
769
- const { endIndex: t, size: o, startIndex: n } = e;
770
- return (r) => r.start === n && (r.end === t || r.end === 1 / 0) && r.value === o;
771
- }
772
- const sr = {
773
- offsetHeight: "height",
774
- offsetWidth: "width"
775
- }, Ae = J(
776
- ([{ log: e }, { recalcInProgress: t }]) => {
777
- const o = K(), n = K(), r = pe(n, 0), i = K(), s = K(), l = H(0), c = H([]), a = H(void 0), h = H(void 0), w = H((u, d) => Ve(u, sr[d])), g = H(void 0), p = H(0), _ = Zn(), b = pe(
778
- v(o, $(c, e, p), We(or, _), re()),
779
- _
780
- ), x = pe(
781
- v(
782
- c,
783
- re(),
784
- We((u, d) => ({ current: d, prev: u.current }), {
785
- current: [],
786
- prev: []
787
- }),
788
- R(({ prev: u }) => u)
789
- ),
790
- []
791
- );
792
- N(
793
- v(
794
- c,
795
- O((u) => u.length > 0),
796
- $(b, p),
797
- R(([u, d, C]) => {
798
- const k = u.reduce((B, M, A) => He(B, M, at(M, d.offsetTree, C) || A), tt());
799
- return {
800
- ...d,
801
- groupIndices: u,
802
- groupOffsetTree: k
803
- };
804
- })
805
- ),
806
- b
807
- ), N(
808
- v(
809
- n,
810
- $(b),
811
- O(([u, { lastIndex: d }]) => u < d),
812
- R(([u, { lastIndex: d, lastSize: C }]) => [
813
- {
814
- endIndex: d,
815
- size: C,
816
- startIndex: u
817
- }
818
- ])
819
- ),
820
- o
821
- ), N(a, h);
822
- const f = pe(
823
- v(
824
- a,
825
- R((u) => u === void 0)
826
- ),
827
- !0
828
- );
829
- N(
830
- v(
831
- h,
832
- O((u) => u !== void 0 && ee(le(b).sizeTree)),
833
- R((u) => [{ endIndex: 0, size: u, startIndex: 0 }])
834
- ),
835
- o
836
- );
837
- const m = _e(
838
- v(
839
- o,
840
- $(b),
841
- We(
842
- ({ sizes: u }, [d, C]) => ({
843
- changed: C !== u,
844
- sizes: C
845
- }),
846
- { changed: !1, sizes: _ }
847
- ),
848
- R((u) => u.changed)
849
- )
850
- );
851
- Z(
852
- v(
853
- l,
854
- We(
855
- (u, d) => ({ diff: u.prev - d, prev: d }),
856
- { diff: 0, prev: 0 }
857
- ),
858
- R((u) => u.diff)
859
- ),
860
- (u) => {
861
- const { groupIndices: d } = le(b);
862
- if (u > 0)
863
- F(t, !0), F(i, u + wo(u, d));
864
- else if (u < 0) {
865
- const C = le(x);
866
- C.length > 0 && (u -= wo(-u, C)), F(s, u);
867
- }
868
- }
869
- ), Z(v(l, $(e)), ([u, d]) => {
870
- u < 0 && d(
871
- "`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
872
- { firstItemIndex: l },
873
- Te.ERROR
874
- );
875
- });
876
- const S = _e(i);
877
- N(
878
- v(
879
- i,
880
- $(b),
881
- R(([u, d]) => {
882
- const C = d.groupIndices.length > 0, k = [], B = d.lastSize;
883
- if (C) {
884
- const M = lt(d.sizeTree, 0);
885
- let A = 0, U = 0;
886
- for (; A < u; ) {
887
- const L = d.groupIndices[U], P = d.groupIndices.length === U + 1 ? 1 / 0 : d.groupIndices[U + 1] - L - 1;
888
- k.push({
889
- endIndex: L,
890
- size: M,
891
- startIndex: L
892
- }), k.push({
893
- endIndex: L + 1 + P - 1,
894
- size: B,
895
- startIndex: L + 1
896
- }), U++, A += P + 1;
897
- }
898
- const Q = Ue(d.sizeTree);
899
- return A !== u && Q.shift(), Q.reduce(
900
- (L, { k: P, v: ue }) => {
901
- let ve = L.ranges;
902
- return L.prevSize !== 0 && (ve = [
903
- ...L.ranges,
904
- {
905
- endIndex: P + u - 1,
906
- size: L.prevSize,
907
- startIndex: L.prevIndex
908
- }
909
- ]), {
910
- prevIndex: P + u,
911
- prevSize: ue,
912
- ranges: ve
913
- };
914
- },
915
- {
916
- prevIndex: u,
917
- prevSize: 0,
918
- ranges: k
919
- }
920
- ).ranges;
921
- }
922
- return Ue(d.sizeTree).reduce(
923
- (M, { k: A, v: U }) => ({
924
- prevIndex: A + u,
925
- prevSize: U,
926
- ranges: [...M.ranges, { endIndex: A + u - 1, size: M.prevSize, startIndex: M.prevIndex }]
927
- }),
928
- {
929
- prevIndex: 0,
930
- prevSize: B,
931
- ranges: []
932
- }
933
- ).ranges;
934
- })
935
- ),
936
- o
937
- );
938
- const z = _e(
939
- v(
940
- s,
941
- $(b, p),
942
- R(([u, { offsetTree: d }, C]) => {
943
- const k = -u;
944
- return at(k, d, C);
945
- })
946
- )
947
- );
948
- return N(
949
- v(
950
- s,
951
- $(b, p),
952
- R(([u, d, C]) => {
953
- if (d.groupIndices.length > 0) {
954
- if (ee(d.sizeTree))
955
- return d;
956
- let k = tt();
957
- const B = le(x);
958
- let M = 0, A = 0, U = 0;
959
- for (; M < -u; ) {
960
- U = B[A];
961
- const Q = B[A + 1] - U - 1;
962
- A++, M += Q + 1;
963
- }
964
- if (k = Ue(d.sizeTree).reduce((Q, { k: L, v: P }) => He(Q, Math.max(0, L + u), P), k), M !== -u) {
965
- const Q = lt(d.sizeTree, U);
966
- k = He(k, 0, Q);
967
- const L = Be(d.sizeTree, -u + 1)[1];
968
- k = He(k, 1, L);
969
- }
970
- return {
971
- ...d,
972
- sizeTree: k,
973
- ...$t(d.offsetTree, 0, k, C)
974
- };
975
- } else {
976
- const k = Ue(d.sizeTree).reduce((B, { k: M, v: A }) => He(B, Math.max(0, M + u), A), tt());
977
- return {
978
- ...d,
979
- sizeTree: k,
980
- ...$t(d.offsetTree, 0, k, C)
981
- };
982
- }
983
- })
984
- ),
985
- b
986
- ), {
987
- beforeUnshiftWith: S,
988
- // input
989
- data: g,
990
- defaultItemSize: h,
991
- firstItemIndex: l,
992
- fixedItemSize: a,
993
- gap: p,
994
- groupIndices: c,
995
- itemSize: w,
996
- listRefresh: m,
997
- shiftWith: s,
998
- shiftWithOffset: z,
999
- sizeRanges: o,
1000
- // output
1001
- sizes: b,
1002
- statefulTotalCount: r,
1003
- totalCount: n,
1004
- trackItemSizes: f,
1005
- unshiftWith: i
1006
- };
1007
- },
1008
- ie(Fe, Xt),
1009
- { singleton: !0 }
1010
- );
1011
- function lr(e) {
1012
- return e.reduce(
1013
- (t, o) => (t.groupIndices.push(t.totalCount), t.totalCount += o + 1, t),
1014
- {
1015
- groupIndices: [],
1016
- totalCount: 0
1017
- }
1018
- );
1019
- }
1020
- const Qo = J(
1021
- ([{ groupIndices: e, sizes: t, totalCount: o }, { headerHeight: n, scrollTop: r }]) => {
1022
- const i = K(), s = K(), l = _e(v(i, R(lr)));
1023
- return N(
1024
- v(
1025
- l,
1026
- R((c) => c.totalCount)
1027
- ),
1028
- o
1029
- ), N(
1030
- v(
1031
- l,
1032
- R((c) => c.groupIndices)
1033
- ),
1034
- e
1035
- ), N(
1036
- v(
1037
- ae(r, t, n),
1038
- O(([c, a]) => zt(a)),
1039
- R(([c, a, h]) => Be(a.groupOffsetTree, Math.max(c - h, 0), "v")[0]),
1040
- re(),
1041
- R((c) => [c])
1042
- ),
1043
- s
1044
- ), { groupCounts: i, topItemsIndexes: s };
1045
- },
1046
- ie(Ae, xe)
1047
- ), $e = J(
1048
- ([{ log: e }]) => {
1049
- const t = H(!1), o = _e(
1050
- v(
1051
- t,
1052
- O((n) => n),
1053
- re()
1054
- )
1055
- );
1056
- return Z(t, (n) => {
1057
- n && le(e)("props updated", {}, Te.DEBUG);
1058
- }), { didMount: o, propsReady: t };
1059
- },
1060
- ie(Fe),
1061
- { singleton: !0 }
1062
- ), cr = typeof document < "u" && "scrollBehavior" in document.documentElement.style;
1063
- function en(e) {
1064
- const t = typeof e == "number" ? { index: e } : e;
1065
- return t.align || (t.align = "start"), (!t.behavior || !cr) && (t.behavior = "auto"), t.offset || (t.offset = 0), t;
1066
- }
1067
- const mt = J(
1068
- ([
1069
- { gap: e, listRefresh: t, sizes: o, totalCount: n },
1070
- {
1071
- fixedFooterHeight: r,
1072
- fixedHeaderHeight: i,
1073
- footerHeight: s,
1074
- headerHeight: l,
1075
- scrollingInProgress: c,
1076
- scrollTo: a,
1077
- smoothScrollTargetReached: h,
1078
- viewportHeight: w
1079
- },
1080
- { log: g }
1081
- ]) => {
1082
- const p = K(), _ = K(), b = H(0);
1083
- let x = null, f = null, m = null;
1084
- function S() {
1085
- x && (x(), x = null), m && (m(), m = null), f && (clearTimeout(f), f = null), F(c, !1);
1086
- }
1087
- return N(
1088
- v(
1089
- p,
1090
- $(o, w, n, b, l, s, g),
1091
- $(e, i, r),
1092
- R(
1093
- ([
1094
- [z, u, d, C, k, B, M, A],
1095
- U,
1096
- Q,
1097
- L
1098
- ]) => {
1099
- const P = en(z), { align: ue, behavior: ve, offset: we } = P, Ce = C - 1, he = Jo(P, u, Ce);
1100
- let de = at(he, u.offsetTree, U) + B;
1101
- ue === "end" ? (de += Q + Be(u.sizeTree, he)[1] - d + L, he === Ce && (de += M)) : ue === "center" ? de += (Q + Be(u.sizeTree, he)[1] - d + L) / 2 : de -= k, we && (de += we);
1102
- const Oe = (Ie) => {
1103
- S(), Ie ? (A("retrying to scroll to", { location: z }, Te.DEBUG), F(p, z)) : (F(_, !0), A("list did not change, scroll successful", {}, Te.DEBUG));
1104
- };
1105
- if (S(), ve === "smooth") {
1106
- let Ie = !1;
1107
- m = Z(t, (Le) => {
1108
- Ie = Ie || Le;
1109
- }), x = ze(h, () => {
1110
- Oe(Ie);
1111
- });
1112
- } else
1113
- x = ze(v(t, ar(150)), Oe);
1114
- return f = setTimeout(() => {
1115
- S();
1116
- }, 1200), F(c, !0), A("scrolling from index to", { behavior: ve, index: he, top: de }, Te.DEBUG), { behavior: ve, top: de };
1117
- }
1118
- )
1119
- ),
1120
- a
1121
- ), {
1122
- scrollTargetReached: _,
1123
- scrollToIndex: p,
1124
- topListHeight: b
1125
- };
1126
- },
1127
- ie(Ae, xe, Fe),
1128
- { singleton: !0 }
1129
- );
1130
- function ar(e) {
1131
- return (t) => {
1132
- const o = setTimeout(() => {
1133
- t(!1);
1134
- }, e);
1135
- return (n) => {
1136
- n && (t(!0), clearTimeout(o));
1137
- };
1138
- };
1139
- }
1140
- function Jt(e, t) {
1141
- e == 0 ? t() : requestAnimationFrame(() => {
1142
- Jt(e - 1, t);
1143
- });
1144
- }
1145
- function Qt(e, t) {
1146
- const o = t - 1;
1147
- return typeof e == "number" ? e : e.index === "LAST" ? o : e.index;
1148
- }
1149
- const ft = J(
1150
- ([{ defaultItemSize: e, listRefresh: t, sizes: o }, { scrollTop: n }, { scrollTargetReached: r, scrollToIndex: i }, { didMount: s }]) => {
1151
- const l = H(!0), c = H(0), a = H(!0);
1152
- return N(
1153
- v(
1154
- s,
1155
- $(c),
1156
- O(([h, w]) => !!w),
1157
- Ne(!1)
1158
- ),
1159
- l
1160
- ), N(
1161
- v(
1162
- s,
1163
- $(c),
1164
- O(([h, w]) => !!w),
1165
- Ne(!1)
1166
- ),
1167
- a
1168
- ), Z(
1169
- v(
1170
- ae(t, s),
1171
- $(l, o, e, a),
1172
- O(([[, h], w, { sizeTree: g }, p, _]) => h && (!ee(g) || Ut(p)) && !w && !_),
1173
- $(c)
1174
- ),
1175
- ([, h]) => {
1176
- ze(r, () => {
1177
- F(a, !0);
1178
- }), Jt(4, () => {
1179
- ze(n, () => {
1180
- F(l, !0);
1181
- }), F(i, h);
1182
- });
1183
- }
1184
- ), {
1185
- initialItemFinalLocationReached: a,
1186
- initialTopMostItemIndex: c,
1187
- scrolledToInitialItem: l
1188
- };
1189
- },
1190
- ie(Ae, xe, mt, $e),
1191
- { singleton: !0 }
1192
- );
1193
- function tn(e, t) {
1194
- return Math.abs(e - t) < 1.01;
1195
- }
1196
- const ut = "up", rt = "down", ur = "none", dr = {
1197
- atBottom: !1,
1198
- notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",
1199
- state: {
1200
- offsetBottom: 0,
1201
- scrollHeight: 0,
1202
- scrollTop: 0,
1203
- viewportHeight: 0
1204
- }
1205
- }, mr = 0, ht = J(([{ footerHeight: e, headerHeight: t, scrollBy: o, scrollContainerState: n, scrollTop: r, viewportHeight: i }]) => {
1206
- const s = H(!1), l = H(!0), c = K(), a = K(), h = H(4), w = H(mr), g = pe(
1207
- v(
1208
- Dt(v(W(r), Ke(1), Ne(!0)), v(W(r), Ke(1), Ne(!1), vo(100))),
1209
- re()
1210
- ),
1211
- !1
1212
- ), p = pe(
1213
- v(Dt(v(o, Ne(!0)), v(o, Ne(!1), vo(200))), re()),
1214
- !1
1215
- );
1216
- N(
1217
- v(
1218
- ae(W(r), W(w)),
1219
- R(([m, S]) => m <= S),
1220
- re()
1221
- ),
1222
- l
1223
- ), N(v(l, Pe(50)), a);
1224
- const _ = _e(
1225
- v(
1226
- ae(n, W(i), W(t), W(e), W(h)),
1227
- We((m, [{ scrollHeight: S, scrollTop: z }, u, d, C, k]) => {
1228
- const B = z + u - S > -k, M = {
1229
- scrollHeight: S,
1230
- scrollTop: z,
1231
- viewportHeight: u
1232
- };
1233
- if (B) {
1234
- let U, Q;
1235
- return z > m.state.scrollTop ? (U = "SCROLLED_DOWN", Q = m.state.scrollTop - z) : (U = "SIZE_DECREASED", Q = m.state.scrollTop - z || m.scrollTopDelta), {
1236
- atBottom: !0,
1237
- atBottomBecause: U,
1238
- scrollTopDelta: Q,
1239
- state: M
1240
- };
1241
- }
1242
- let A;
1243
- return M.scrollHeight > m.state.scrollHeight ? A = "SIZE_INCREASED" : u < m.state.viewportHeight ? A = "VIEWPORT_HEIGHT_DECREASING" : z < m.state.scrollTop ? A = "SCROLLING_UPWARDS" : A = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
1244
- atBottom: !1,
1245
- notAtBottomBecause: A,
1246
- state: M
1247
- };
1248
- }, dr),
1249
- re((m, S) => m && m.atBottom === S.atBottom)
1250
- )
1251
- ), b = pe(
1252
- v(
1253
- n,
1254
- We(
1255
- (m, { scrollHeight: S, scrollTop: z, viewportHeight: u }) => {
1256
- if (tn(m.scrollHeight, S))
1257
- return {
1258
- changed: !1,
1259
- jump: 0,
1260
- scrollHeight: S,
1261
- scrollTop: z
1262
- };
1263
- {
1264
- const d = S - (z + u) < 1;
1265
- return m.scrollTop !== z && d ? {
1266
- changed: !0,
1267
- jump: m.scrollTop - z,
1268
- scrollHeight: S,
1269
- scrollTop: z
1270
- } : {
1271
- changed: !0,
1272
- jump: 0,
1273
- scrollHeight: S,
1274
- scrollTop: z
1275
- };
1276
- }
1277
- },
1278
- { changed: !1, jump: 0, scrollHeight: 0, scrollTop: 0 }
1279
- ),
1280
- O((m) => m.changed),
1281
- R((m) => m.jump)
1282
- ),
1283
- 0
1284
- );
1285
- N(
1286
- v(
1287
- _,
1288
- R((m) => m.atBottom)
1289
- ),
1290
- s
1291
- ), N(v(s, Pe(50)), c);
1292
- const x = H(rt);
1293
- N(
1294
- v(
1295
- n,
1296
- R(({ scrollTop: m }) => m),
1297
- re(),
1298
- We(
1299
- (m, S) => le(p) ? { direction: m.direction, prevScrollTop: S } : { direction: S < m.prevScrollTop ? ut : rt, prevScrollTop: S },
1300
- { direction: rt, prevScrollTop: 0 }
1301
- ),
1302
- R((m) => m.direction)
1303
- ),
1304
- x
1305
- ), N(v(n, Pe(50), Ne(ur)), x);
1306
- const f = H(0);
1307
- return N(
1308
- v(
1309
- g,
1310
- O((m) => !m),
1311
- Ne(0)
1312
- ),
1313
- f
1314
- ), N(
1315
- v(
1316
- r,
1317
- Pe(100),
1318
- $(g),
1319
- O(([m, S]) => !!S),
1320
- We(([m, S], [z]) => [S, z], [0, 0]),
1321
- R(([m, S]) => S - m)
1322
- ),
1323
- f
1324
- ), {
1325
- atBottomState: _,
1326
- atBottomStateChange: c,
1327
- atBottomThreshold: h,
1328
- atTopStateChange: a,
1329
- atTopThreshold: w,
1330
- isAtBottom: s,
1331
- isAtTop: l,
1332
- isScrolling: g,
1333
- lastJumpDueToItemResize: b,
1334
- scrollDirection: x,
1335
- scrollVelocity: f
1336
- };
1337
- }, ie(xe)), bt = "top", Ht = "bottom", Co = "none";
1338
- function So(e, t, o) {
1339
- return typeof e == "number" ? o === ut && t === bt || o === rt && t === Ht ? e : 0 : o === ut ? t === bt ? e.main : e.reverse : t === Ht ? e.main : e.reverse;
1340
- }
1341
- function yo(e, t) {
1342
- var o;
1343
- return typeof e == "number" ? e : (o = e[t]) != null ? o : 0;
1344
- }
1345
- const eo = J(
1346
- ([{ deviation: e, fixedHeaderHeight: t, headerHeight: o, scrollTop: n, viewportHeight: r }]) => {
1347
- const i = K(), s = H(0), l = H(0), c = H(0), a = pe(
1348
- v(
1349
- ae(
1350
- W(n),
1351
- W(r),
1352
- W(o),
1353
- W(i, ct),
1354
- W(c),
1355
- W(s),
1356
- W(t),
1357
- W(e),
1358
- W(l)
1359
- ),
1360
- R(
1361
- ([
1362
- h,
1363
- w,
1364
- g,
1365
- [p, _],
1366
- b,
1367
- x,
1368
- f,
1369
- m,
1370
- S
1371
- ]) => {
1372
- const z = h - m, u = x + f, d = Math.max(g - z, 0);
1373
- let C = Co;
1374
- const k = yo(S, bt), B = yo(S, Ht);
1375
- return p -= m, p += g + f, _ += g + f, _ -= m, p > h + u - k && (C = ut), _ < h - d + w + B && (C = rt), C !== Co ? [
1376
- Math.max(z - g - So(b, bt, C) - k, 0),
1377
- z - d - f + w + So(b, Ht, C) + B
1378
- ] : null;
1379
- }
1380
- ),
1381
- O((h) => h != null),
1382
- re(ct)
1383
- ),
1384
- [0, 0]
1385
- );
1386
- return {
1387
- increaseViewportBy: l,
1388
- // input
1389
- listBoundary: i,
1390
- overscan: c,
1391
- topListHeight: s,
1392
- // output
1393
- visibleRange: a
1394
- };
1395
- },
1396
- ie(xe),
1397
- { singleton: !0 }
1398
- );
1399
- function fr(e, t, o) {
1400
- if (zt(t)) {
1401
- const n = Zo(e, t);
1402
- return [
1403
- { index: Be(t.groupOffsetTree, n)[0], offset: 0, size: 0 },
1404
- { data: o == null ? void 0 : o[0], index: n, offset: 0, size: 0 }
1405
- ];
1406
- }
1407
- return [{ data: o == null ? void 0 : o[0], index: e, offset: 0, size: 0 }];
1408
- }
1409
- const Nt = {
1410
- bottom: 0,
1411
- firstItemIndex: 0,
1412
- items: [],
1413
- offsetBottom: 0,
1414
- offsetTop: 0,
1415
- top: 0,
1416
- topItems: [],
1417
- topListHeight: 0,
1418
- totalCount: 0
1419
- };
1420
- function St(e, t, o, n, r, i) {
1421
- const { lastIndex: s, lastOffset: l, lastSize: c } = r;
1422
- let a = 0, h = 0;
1423
- if (e.length > 0) {
1424
- a = e[0].offset;
1425
- const b = e[e.length - 1];
1426
- h = b.offset + b.size;
1427
- }
1428
- const w = o - s, g = l + w * c + (w - 1) * n, p = a, _ = g - h;
1429
- return {
1430
- bottom: h,
1431
- firstItemIndex: i,
1432
- items: bo(e, r, i),
1433
- offsetBottom: _,
1434
- offsetTop: a,
1435
- top: p,
1436
- topItems: bo(t, r, i),
1437
- topListHeight: t.reduce((b, x) => x.size + b, 0),
1438
- totalCount: o
1439
- };
1440
- }
1441
- function on(e, t, o, n, r, i) {
1442
- let s = 0;
1443
- if (o.groupIndices.length > 0)
1444
- for (const h of o.groupIndices) {
1445
- if (h - s >= e)
1446
- break;
1447
- s++;
1448
- }
1449
- const l = e + s, c = Qt(t, l), a = Array.from({ length: l }).map((h, w) => ({
1450
- data: i[w + c],
1451
- index: w + c,
1452
- offset: 0,
1453
- size: 0
1454
- }));
1455
- return St(a, [], l, r, o, n);
1456
- }
1457
- function bo(e, t, o) {
1458
- if (e.length === 0)
1459
- return [];
1460
- if (!zt(t))
1461
- return e.map((a) => ({ ...a, index: a.index + o, originalIndex: a.index }));
1462
- const n = e[0].index, r = e[e.length - 1].index, i = [], s = Rt(t.groupOffsetTree, n, r);
1463
- let l, c = 0;
1464
- for (const a of e) {
1465
- (!l || l.end < a.index) && (l = s.shift(), c = t.groupIndices.indexOf(l.start));
1466
- let h;
1467
- a.index === l.start ? h = {
1468
- index: c,
1469
- type: "group"
1470
- } : h = {
1471
- groupIndex: c,
1472
- index: a.index - (c + 1) + o
1473
- }, i.push({
1474
- ...h,
1475
- data: a.data,
1476
- offset: a.offset,
1477
- originalIndex: a.index,
1478
- size: a.size
1479
- });
1480
- }
1481
- return i;
1482
- }
1483
- const Xe = J(
1484
- ([
1485
- { data: e, firstItemIndex: t, gap: o, sizes: n, totalCount: r },
1486
- i,
1487
- { listBoundary: s, topListHeight: l, visibleRange: c },
1488
- { initialTopMostItemIndex: a, scrolledToInitialItem: h },
1489
- { topListHeight: w },
1490
- g,
1491
- { didMount: p },
1492
- { recalcInProgress: _ }
1493
- ]) => {
1494
- const b = H([]), x = H(0), f = K();
1495
- N(i.topItemsIndexes, b);
1496
- const m = pe(
1497
- v(
1498
- ae(
1499
- p,
1500
- _,
1501
- W(c, ct),
1502
- W(r),
1503
- W(n),
1504
- W(a),
1505
- h,
1506
- W(b),
1507
- W(t),
1508
- W(o),
1509
- e
1510
- ),
1511
- O(([d, C, , k, , , , , , , B]) => {
1512
- const M = B && B.length !== k;
1513
- return d && !C && !M;
1514
- }),
1515
- R(
1516
- ([
1517
- ,
1518
- ,
1519
- [d, C],
1520
- k,
1521
- B,
1522
- M,
1523
- A,
1524
- U,
1525
- Q,
1526
- L,
1527
- P
1528
- ]) => {
1529
- const ue = B, { offsetTree: ve, sizeTree: we } = ue, Ce = le(x);
1530
- if (k === 0)
1531
- return { ...Nt, totalCount: k };
1532
- if (d === 0 && C === 0)
1533
- return Ce === 0 ? { ...Nt, totalCount: k } : on(Ce, M, B, Q, L, P || []);
1534
- if (ee(we))
1535
- return Ce > 0 ? null : St(
1536
- fr(Qt(M, k), ue, P),
1537
- [],
1538
- k,
1539
- L,
1540
- ue,
1541
- Q
1542
- );
1543
- const he = [];
1544
- if (U.length > 0) {
1545
- const De = U[0], Se = U[U.length - 1];
1546
- let ce = 0;
1547
- for (const T of Rt(we, De, Se)) {
1548
- const G = T.value, te = Math.max(T.start, De), y = Math.min(T.end, Se);
1549
- for (let E = te; E <= y; E++)
1550
- he.push({ data: P == null ? void 0 : P[E], index: E, offset: ce, size: G }), ce += G;
1551
- }
1552
- }
1553
- if (!A)
1554
- return St([], he, k, L, ue, Q);
1555
- const de = U.length > 0 ? U[U.length - 1] + 1 : 0, Oe = tr(ve, d, C, de);
1556
- if (Oe.length === 0)
1557
- return null;
1558
- const Ie = k - 1, Le = Et([], (De) => {
1559
- for (const Se of Oe) {
1560
- const ce = Se.value;
1561
- let T = ce.offset, G = Se.start;
1562
- const te = ce.size;
1563
- if (ce.offset < d) {
1564
- G += Math.floor((d - ce.offset + L) / (te + L));
1565
- const E = G - Se.start;
1566
- T += E * te + E * L;
1567
- }
1568
- G < de && (T += (de - G) * te, G = de);
1569
- const y = Math.min(Se.end, Ie);
1570
- for (let E = G; E <= y && !(T >= C); E++)
1571
- De.push({ data: P == null ? void 0 : P[E], index: E, offset: T, size: te }), T += te + L;
1572
- }
1573
- });
1574
- return St(Le, he, k, L, ue, Q);
1575
- }
1576
- ),
1577
- //@ts-expect-error filter needs to be fixed
1578
- O((d) => d !== null),
1579
- re()
1580
- ),
1581
- Nt
1582
- );
1583
- N(
1584
- v(
1585
- e,
1586
- O(Ut),
1587
- R((d) => d == null ? void 0 : d.length)
1588
- ),
1589
- r
1590
- ), N(
1591
- v(
1592
- m,
1593
- R((d) => d.topListHeight)
1594
- ),
1595
- w
1596
- ), N(w, l), N(
1597
- v(
1598
- m,
1599
- R((d) => [d.top, d.bottom])
1600
- ),
1601
- s
1602
- ), N(
1603
- v(
1604
- m,
1605
- R((d) => d.items)
1606
- ),
1607
- f
1608
- );
1609
- const S = _e(
1610
- v(
1611
- m,
1612
- O(({ items: d }) => d.length > 0),
1613
- $(r, e),
1614
- O(([{ items: d }, C]) => d[d.length - 1].originalIndex === C - 1),
1615
- R(([, d, C]) => [d - 1, C]),
1616
- re(ct),
1617
- R(([d]) => d)
1618
- )
1619
- ), z = _e(
1620
- v(
1621
- m,
1622
- Pe(200),
1623
- O(({ items: d, topItems: C }) => d.length > 0 && d[0].originalIndex === C.length),
1624
- R(({ items: d }) => d[0].index),
1625
- re()
1626
- )
1627
- ), u = _e(
1628
- v(
1629
- m,
1630
- O(({ items: d }) => d.length > 0),
1631
- R(({ items: d }) => {
1632
- let C = 0, k = d.length - 1;
1633
- for (; d[C].type === "group" && C < k; )
1634
- C++;
1635
- for (; d[k].type === "group" && k > C; )
1636
- k--;
1637
- return {
1638
- endIndex: d[k].index,
1639
- startIndex: d[C].index
1640
- };
1641
- }),
1642
- re(Yo)
1643
- )
1644
- );
1645
- return { endReached: S, initialItemCount: x, itemsRendered: f, listState: m, rangeChanged: u, startReached: z, topItemsIndexes: b, ...g };
1646
- },
1647
- ie(
1648
- Ae,
1649
- Qo,
1650
- eo,
1651
- ft,
1652
- mt,
1653
- ht,
1654
- $e,
1655
- Xt
1656
- ),
1657
- { singleton: !0 }
1658
- ), nn = J(
1659
- ([{ fixedFooterHeight: e, fixedHeaderHeight: t, footerHeight: o, headerHeight: n }, { listState: r }]) => {
1660
- const i = K(), s = pe(
1661
- v(
1662
- ae(o, e, n, t, r),
1663
- R(([l, c, a, h, w]) => l + c + a + h + w.offsetBottom + w.bottom)
1664
- ),
1665
- 0
1666
- );
1667
- return N(W(s), i), { totalListHeight: s, totalListHeightChanged: i };
1668
- },
1669
- ie(xe, Xe),
1670
- { singleton: !0 }
1671
- ), hr = J(
1672
- ([{ viewportHeight: e }, { totalListHeight: t }]) => {
1673
- const o = H(!1), n = pe(
1674
- v(
1675
- ae(o, e, t),
1676
- O(([r]) => r),
1677
- R(([, r, i]) => Math.max(0, r - i)),
1678
- Pe(0),
1679
- re()
1680
- ),
1681
- 0
1682
- );
1683
- return { alignToBottom: o, paddingTopAddition: n };
1684
- },
1685
- ie(xe, nn),
1686
- { singleton: !0 }
1687
- ), rn = J(() => ({
1688
- context: H(null)
1689
- })), gr = ({
1690
- itemBottom: e,
1691
- itemTop: t,
1692
- locationParams: { align: o, behavior: n, ...r },
1693
- viewportBottom: i,
1694
- viewportTop: s
1695
- }) => t < s ? { ...r, align: o ?? "start", behavior: n } : e > i ? { ...r, align: o ?? "end", behavior: n } : null, sn = J(
1696
- ([
1697
- { gap: e, sizes: t, totalCount: o },
1698
- { fixedFooterHeight: n, fixedHeaderHeight: r, headerHeight: i, scrollingInProgress: s, scrollTop: l, viewportHeight: c },
1699
- { scrollToIndex: a }
1700
- ]) => {
1701
- const h = K();
1702
- return N(
1703
- v(
1704
- h,
1705
- $(t, c, o, i, r, n, l),
1706
- $(e),
1707
- R(([[w, g, p, _, b, x, f, m], S]) => {
1708
- const { align: z, behavior: u, calculateViewLocation: d = gr, done: C, ...k } = w, B = Jo(w, g, _ - 1), M = at(B, g.offsetTree, S) + b + x, A = M + Be(g.sizeTree, B)[1], U = m + x, Q = m + p - f, L = d({
1709
- itemBottom: A,
1710
- itemTop: M,
1711
- locationParams: { align: z, behavior: u, ...k },
1712
- viewportBottom: Q,
1713
- viewportTop: U
1714
- });
1715
- return L ? C && ze(
1716
- v(
1717
- s,
1718
- O((P) => !P),
1719
- // skips the initial publish of false, and the cleanup call.
1720
- // but if scrollingInProgress is true, we skip the initial publish.
1721
- Ke(le(s) ? 1 : 2)
1722
- ),
1723
- C
1724
- ) : C && C(), L;
1725
- }),
1726
- O((w) => w !== null)
1727
- ),
1728
- a
1729
- ), {
1730
- scrollIntoView: h
1731
- };
1732
- },
1733
- ie(Ae, xe, mt, Xe, Fe),
1734
- { singleton: !0 }
1735
- );
1736
- function Ho(e) {
1737
- return e ? e === "smooth" ? "smooth" : "auto" : !1;
1738
- }
1739
- const pr = (e, t) => typeof e == "function" ? Ho(e(t)) : t && Ho(e), xr = J(
1740
- ([
1741
- { listRefresh: e, totalCount: t, fixedItemSize: o, data: n },
1742
- { atBottomState: r, isAtBottom: i },
1743
- { scrollToIndex: s },
1744
- { scrolledToInitialItem: l },
1745
- { didMount: c, propsReady: a },
1746
- { log: h },
1747
- { scrollingInProgress: w },
1748
- { context: g },
1749
- { scrollIntoView: p }
1750
- ]) => {
1751
- const _ = H(!1), b = K();
1752
- let x = null;
1753
- function f(u) {
1754
- F(s, {
1755
- align: "end",
1756
- behavior: u,
1757
- index: "LAST"
1758
- });
1759
- }
1760
- Z(
1761
- v(
1762
- ae(v(W(t), Ke(1)), c),
1763
- $(W(_), i, l, w),
1764
- R(([[u, d], C, k, B, M]) => {
1765
- let A = d && B, U = "auto";
1766
- return A && (U = pr(C, k || M), A = A && !!U), { followOutputBehavior: U, shouldFollow: A, totalCount: u };
1767
- }),
1768
- O(({ shouldFollow: u }) => u)
1769
- ),
1770
- ({ followOutputBehavior: u, totalCount: d }) => {
1771
- x && (x(), x = null), le(o) ? requestAnimationFrame(() => {
1772
- le(h)("following output to ", { totalCount: d }, Te.DEBUG), f(u);
1773
- }) : x = ze(e, () => {
1774
- le(h)("following output to ", { totalCount: d }, Te.DEBUG), f(u), x = null;
1775
- });
1776
- }
1777
- );
1778
- function m(u) {
1779
- const d = ze(r, (C) => {
1780
- u && !C.atBottom && C.notAtBottomBecause === "SIZE_INCREASED" && !x && (le(h)("scrolling to bottom due to increased size", {}, Te.DEBUG), f("auto"));
1781
- });
1782
- setTimeout(d, 100);
1783
- }
1784
- Z(
1785
- v(
1786
- ae(W(_), t, a),
1787
- O(([u, , d]) => u && d),
1788
- We(
1789
- ({ value: u }, [, d]) => ({ refreshed: u === d, value: d }),
1790
- { refreshed: !1, value: 0 }
1791
- ),
1792
- O(({ refreshed: u }) => u),
1793
- $(_, t)
1794
- ),
1795
- ([, u]) => {
1796
- le(l) && m(u !== !1);
1797
- }
1798
- ), Z(b, () => {
1799
- m(le(_) !== !1);
1800
- }), Z(ae(W(_), r), ([u, d]) => {
1801
- u && !d.atBottom && d.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && f("auto");
1802
- });
1803
- const S = H(null), z = K();
1804
- return N(
1805
- Dt(
1806
- v(
1807
- W(n),
1808
- R((u) => {
1809
- var d;
1810
- return (d = u == null ? void 0 : u.length) != null ? d : 0;
1811
- })
1812
- ),
1813
- v(W(t))
1814
- ),
1815
- z
1816
- ), Z(
1817
- v(
1818
- ae(v(z, Ke(1)), c),
1819
- $(W(S), l, w, g),
1820
- R(([[u, d], C, k, B, M]) => d && k && (C == null ? void 0 : C({ context: M, totalCount: u, scrollingInProgress: B }))),
1821
- O((u) => !!u),
1822
- Pe(0)
1823
- ),
1824
- (u) => {
1825
- x && (x(), x = null), le(o) ? requestAnimationFrame(() => {
1826
- le(h)("scrolling into view", {}), F(p, u);
1827
- }) : x = ze(e, () => {
1828
- le(h)("scrolling into view", {}), F(p, u), x = null;
1829
- });
1830
- }
1831
- ), { autoscrollToBottom: b, followOutput: _, scrollIntoViewOnChange: S };
1832
- },
1833
- ie(
1834
- Ae,
1835
- ht,
1836
- mt,
1837
- ft,
1838
- $e,
1839
- Fe,
1840
- xe,
1841
- rn,
1842
- sn
1843
- )
1844
- ), vr = J(
1845
- ([{ data: e, firstItemIndex: t, gap: o, sizes: n }, { initialTopMostItemIndex: r }, { initialItemCount: i, listState: s }, { didMount: l }]) => (N(
1846
- v(
1847
- l,
1848
- $(i),
1849
- O(([, c]) => c !== 0),
1850
- $(r, n, t, o, e),
1851
- R(([[, c], a, h, w, g, p = []]) => on(c, a, h, w, g, p))
1852
- ),
1853
- s
1854
- ), {}),
1855
- ie(Ae, ft, Xe, $e),
1856
- { singleton: !0 }
1857
- ), Ir = J(
1858
- ([{ didMount: e }, { scrollTo: t }, { listState: o }]) => {
1859
- const n = H(0);
1860
- return Z(
1861
- v(
1862
- e,
1863
- $(n),
1864
- O(([, r]) => r !== 0),
1865
- R(([, r]) => ({ top: r }))
1866
- ),
1867
- (r) => {
1868
- ze(
1869
- v(
1870
- o,
1871
- Ke(1),
1872
- O((i) => i.items.length > 1)
1873
- ),
1874
- () => {
1875
- requestAnimationFrame(() => {
1876
- F(t, r);
1877
- });
1878
- }
1879
- );
1880
- }
1881
- ), {
1882
- initialScrollTop: n
1883
- };
1884
- },
1885
- ie($e, xe, Xe),
1886
- { singleton: !0 }
1887
- ), ln = J(
1888
- ([{ scrollVelocity: e }]) => {
1889
- const t = H(!1), o = K(), n = H(!1);
1890
- return N(
1891
- v(
1892
- e,
1893
- $(n, t, o),
1894
- O(([r, i]) => !!i),
1895
- R(([r, i, s, l]) => {
1896
- const { enter: c, exit: a } = i;
1897
- if (s) {
1898
- if (a(r, l))
1899
- return !1;
1900
- } else if (c(r, l))
1901
- return !0;
1902
- return s;
1903
- }),
1904
- re()
1905
- ),
1906
- t
1907
- ), Z(
1908
- v(ae(t, e, o), $(n)),
1909
- ([[r, i, s], l]) => {
1910
- r && l && l.change && l.change(i, s);
1911
- }
1912
- ), { isSeeking: t, scrollSeekConfiguration: n, scrollSeekRangeChanged: o, scrollVelocity: e };
1913
- },
1914
- ie(ht),
1915
- { singleton: !0 }
1916
- ), to = J(([{ scrollContainerState: e, scrollTo: t }]) => {
1917
- const o = K(), n = K(), r = K(), i = H(!1), s = H(void 0);
1918
- return N(
1919
- v(
1920
- ae(o, n),
1921
- R(([{ scrollHeight: l, scrollTop: c, viewportHeight: a }, { offsetTop: h }]) => ({
1922
- scrollHeight: l,
1923
- scrollTop: Math.max(0, c - h),
1924
- viewportHeight: a
1925
- }))
1926
- ),
1927
- e
1928
- ), N(
1929
- v(
1930
- t,
1931
- $(n),
1932
- R(([l, { offsetTop: c }]) => ({
1933
- ...l,
1934
- top: l.top + c
1935
- }))
1936
- ),
1937
- r
1938
- ), {
1939
- customScrollParent: s,
1940
- // config
1941
- useWindowScroll: i,
1942
- // input
1943
- windowScrollContainerState: o,
1944
- // signals
1945
- windowScrollTo: r,
1946
- windowViewportRect: n
1947
- };
1948
- }, ie(xe)), Tr = J(
1949
- ([
1950
- { sizeRanges: e, sizes: t },
1951
- { headerHeight: o, scrollTop: n },
1952
- { initialTopMostItemIndex: r },
1953
- { didMount: i },
1954
- { useWindowScroll: s, windowScrollContainerState: l, windowViewportRect: c }
1955
- ]) => {
1956
- const a = K(), h = H(void 0), w = H(null), g = H(null);
1957
- return N(l, w), N(c, g), Z(
1958
- v(
1959
- a,
1960
- $(t, n, s, w, g, o)
1961
- ),
1962
- ([p, _, b, x, f, m, S]) => {
1963
- const z = nr(_.sizeTree);
1964
- x && f !== null && m !== null && (b = f.scrollTop - m.offsetTop), b -= S, p({ ranges: z, scrollTop: b });
1965
- }
1966
- ), N(v(h, O(Ut), R(wr)), r), N(
1967
- v(
1968
- i,
1969
- $(h),
1970
- O(([, p]) => p !== void 0),
1971
- re(),
1972
- R(([, p]) => p.ranges)
1973
- ),
1974
- e
1975
- ), {
1976
- getState: a,
1977
- restoreStateFrom: h
1978
- };
1979
- },
1980
- ie(Ae, xe, ft, $e, to)
1981
- );
1982
- function wr(e) {
1983
- return { align: "start", index: 0, offset: e.scrollTop };
1984
- }
1985
- const Cr = J(([{ topItemsIndexes: e }]) => {
1986
- const t = H(0);
1987
- return N(
1988
- v(
1989
- t,
1990
- O((o) => o >= 0),
1991
- R((o) => Array.from({ length: o }).map((n, r) => r))
1992
- ),
1993
- e
1994
- ), { topItemCount: t };
1995
- }, ie(Xe));
1996
- function cn(e) {
1997
- let t = !1, o;
1998
- return () => (t || (t = !0, o = e()), o);
1999
- }
2000
- const Sr = cn(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent)), yr = J(
2001
- ([
2002
- { deviation: e, scrollBy: t, scrollingInProgress: o, scrollTop: n },
2003
- { isAtBottom: r, isScrolling: i, lastJumpDueToItemResize: s, scrollDirection: l },
2004
- { listState: c },
2005
- { beforeUnshiftWith: a, gap: h, shiftWithOffset: w, sizes: g },
2006
- { log: p },
2007
- { recalcInProgress: _ }
2008
- ]) => {
2009
- const b = _e(
2010
- v(
2011
- c,
2012
- $(s),
2013
- We(
2014
- ([, f, m, S], [{ bottom: z, items: u, offsetBottom: d, totalCount: C }, k]) => {
2015
- const B = z + d;
2016
- let M = 0;
2017
- return m === C && f.length > 0 && u.length > 0 && (u[0].originalIndex === 0 && f[0].originalIndex === 0 || (M = B - S, M !== 0 && (M += k))), [M, u, C, B];
2018
- },
2019
- [0, [], 0, 0]
2020
- ),
2021
- O(([f]) => f !== 0),
2022
- $(n, l, o, r, p, _),
2023
- O(([, f, m, S, , , z]) => !z && !S && f !== 0 && m === ut),
2024
- R(([[f], , , , , m]) => (m("Upward scrolling compensation", { amount: f }, Te.DEBUG), f))
2025
- )
2026
- );
2027
- function x(f) {
2028
- f > 0 ? (F(t, { behavior: "auto", top: -f }), F(e, 0)) : (F(e, 0), F(t, { behavior: "auto", top: -f }));
2029
- }
2030
- return Z(v(b, $(e, i)), ([f, m, S]) => {
2031
- S && Sr() ? F(e, m - f) : x(-f);
2032
- }), Z(
2033
- v(
2034
- ae(pe(i, !1), e, _),
2035
- O(([f, m, S]) => !f && !S && m !== 0),
2036
- R(([f, m]) => m),
2037
- Pe(1)
2038
- ),
2039
- x
2040
- ), N(
2041
- v(
2042
- w,
2043
- R((f) => ({ top: -f }))
2044
- ),
2045
- t
2046
- ), Z(
2047
- v(
2048
- a,
2049
- $(g, h),
2050
- R(([f, { groupIndices: m, lastSize: S, sizeTree: z }, u]) => {
2051
- function d(C) {
2052
- return C * (S + u);
2053
- }
2054
- if (m.length === 0)
2055
- return d(f);
2056
- {
2057
- let C = 0;
2058
- const k = lt(z, 0);
2059
- let B = 0, M = 0;
2060
- for (; B < f; ) {
2061
- B++, C += k;
2062
- let A = m.length === M + 1 ? 1 / 0 : m[M + 1] - m[M] - 1;
2063
- B + A > f && (C -= k, A = f - B + 1), B += A, C += d(A), M++;
2064
- }
2065
- return C;
2066
- }
2067
- })
2068
- ),
2069
- (f) => {
2070
- F(e, f), requestAnimationFrame(() => {
2071
- F(t, { top: f }), requestAnimationFrame(() => {
2072
- F(e, 0), F(_, !1);
2073
- });
2074
- });
2075
- }
2076
- ), { deviation: e };
2077
- },
2078
- ie(xe, ht, Xe, Ae, Fe, Xt)
2079
- ), br = J(
2080
- ([
2081
- e,
2082
- t,
2083
- o,
2084
- n,
2085
- r,
2086
- i,
2087
- s,
2088
- l,
2089
- c,
2090
- a,
2091
- h
2092
- ]) => ({
2093
- ...e,
2094
- ...t,
2095
- ...o,
2096
- ...n,
2097
- ...r,
2098
- ...i,
2099
- ...s,
2100
- ...l,
2101
- ...c,
2102
- ...a,
2103
- ...h
2104
- }),
2105
- ie(
2106
- eo,
2107
- vr,
2108
- $e,
2109
- ln,
2110
- nn,
2111
- Ir,
2112
- hr,
2113
- to,
2114
- sn,
2115
- Fe,
2116
- rn
2117
- )
2118
- ), Hr = J(
2119
- ([
2120
- {
2121
- data: e,
2122
- defaultItemSize: t,
2123
- firstItemIndex: o,
2124
- fixedItemSize: n,
2125
- gap: r,
2126
- groupIndices: i,
2127
- itemSize: s,
2128
- sizeRanges: l,
2129
- sizes: c,
2130
- statefulTotalCount: a,
2131
- totalCount: h,
2132
- trackItemSizes: w
2133
- },
2134
- { initialItemFinalLocationReached: g, initialTopMostItemIndex: p, scrolledToInitialItem: _ },
2135
- b,
2136
- x,
2137
- f,
2138
- { listState: m, topItemsIndexes: S, ...z },
2139
- { scrollToIndex: u },
2140
- d,
2141
- { topItemCount: C },
2142
- { groupCounts: k },
2143
- B
2144
- ]) => (N(z.rangeChanged, B.scrollSeekRangeChanged), N(
2145
- v(
2146
- B.windowViewportRect,
2147
- R((M) => M.visibleHeight)
2148
- ),
2149
- b.viewportHeight
2150
- ), {
2151
- data: e,
2152
- defaultItemHeight: t,
2153
- firstItemIndex: o,
2154
- fixedItemHeight: n,
2155
- gap: r,
2156
- groupCounts: k,
2157
- initialItemFinalLocationReached: g,
2158
- initialTopMostItemIndex: p,
2159
- scrolledToInitialItem: _,
2160
- sizeRanges: l,
2161
- topItemCount: C,
2162
- topItemsIndexes: S,
2163
- // input
2164
- totalCount: h,
2165
- ...f,
2166
- groupIndices: i,
2167
- itemSize: s,
2168
- listState: m,
2169
- scrollToIndex: u,
2170
- // output
2171
- statefulTotalCount: a,
2172
- trackItemSizes: w,
2173
- // exported from stateFlagsSystem
2174
- ...z,
2175
- // the bag of IO from featureGroup1System
2176
- ...B,
2177
- ...b,
2178
- sizes: c,
2179
- ...x
2180
- }),
2181
- ie(
2182
- Ae,
2183
- ft,
2184
- xe,
2185
- Tr,
2186
- xr,
2187
- Xe,
2188
- mt,
2189
- yr,
2190
- Cr,
2191
- Qo,
2192
- br
2193
- )
2194
- );
2195
- function _r(e, t) {
2196
- const o = {}, n = {};
2197
- let r = 0;
2198
- const i = e.length;
2199
- for (; r < i; )
2200
- n[e[r]] = 1, r += 1;
2201
- for (const s in t)
2202
- Object.hasOwn(n, s) || (o[s] = t[s]);
2203
- return o;
2204
- }
2205
- const vt = typeof document < "u" ? j.useLayoutEffect : j.useEffect;
2206
- function an(e, t, o) {
2207
- const n = Object.keys(t.required || {}), r = Object.keys(t.optional || {}), i = Object.keys(t.methods || {}), s = Object.keys(t.events || {}), l = j.createContext({});
2208
- function c(x, f) {
2209
- x.propsReady && F(x.propsReady, !1);
2210
- for (const m of n) {
2211
- const S = x[t.required[m]];
2212
- F(S, f[m]);
2213
- }
2214
- for (const m of r)
2215
- if (m in f) {
2216
- const S = x[t.optional[m]];
2217
- F(S, f[m]);
2218
- }
2219
- x.propsReady && F(x.propsReady, !0);
2220
- }
2221
- function a(x) {
2222
- return i.reduce((f, m) => (f[m] = (S) => {
2223
- const z = x[t.methods[m]];
2224
- F(z, S);
2225
- }, f), {});
2226
- }
2227
- function h(x) {
2228
- return s.reduce((f, m) => (f[m] = Vn(x[t.events[m]]), f), {});
2229
- }
2230
- const w = j.forwardRef((x, f) => {
2231
- const { children: m, ...S } = x, [z] = j.useState(() => Et(Fn(e), (C) => {
2232
- c(C, S);
2233
- })), [u] = j.useState(xo(h, z));
2234
- vt(() => {
2235
- for (const C of s)
2236
- C in S && Z(u[C], S[C]);
2237
- return () => {
2238
- Object.values(u).map(Kt);
2239
- };
2240
- }, [S, u, z]), vt(() => {
2241
- c(z, S);
2242
- }), j.useImperativeHandle(f, po(a(z)));
2243
- const d = o;
2244
- return /* @__PURE__ */ I.jsx(l.Provider, { value: z, children: o ? /* @__PURE__ */ I.jsx(d, { ..._r([...n, ...r, ...s], S), children: m }) : m });
2245
- }), g = (x) => {
2246
- const f = j.useContext(l);
2247
- return j.useCallback(
2248
- (m) => {
2249
- F(f[x], m);
2250
- },
2251
- [f, x]
2252
- );
2253
- }, p = (x) => {
2254
- const f = j.useContext(l)[x], m = j.useCallback(
2255
- (S) => Z(f, S),
2256
- [f]
2257
- );
2258
- return j.useSyncExternalStore(
2259
- m,
2260
- () => le(f),
2261
- () => le(f)
2262
- );
2263
- }, _ = (x) => {
2264
- const f = j.useContext(l)[x], [m, S] = j.useState(xo(le, f));
2265
- return vt(
2266
- () => Z(f, (z) => {
2267
- z !== m && S(po(z));
2268
- }),
2269
- [f, m]
2270
- ), m;
2271
- }, b = j.version.startsWith("18") ? p : _;
2272
- return {
2273
- Component: w,
2274
- useEmitter: (x, f) => {
2275
- const m = j.useContext(l)[x];
2276
- vt(() => Z(m, f), [f, m]);
2277
- },
2278
- useEmitterValue: b,
2279
- usePublisher: g
2280
- };
2281
- }
2282
- const un = j.createContext(void 0), dn = j.createContext(void 0), mn = typeof document < "u" ? j.useLayoutEffect : j.useEffect;
2283
- function Wt(e) {
2284
- return "self" in e;
2285
- }
2286
- function kr(e) {
2287
- return "body" in e;
2288
- }
2289
- function fn(e, t, o, n = dt, r, i) {
2290
- const s = j.useRef(null), l = j.useRef(null), c = j.useRef(null), a = j.useCallback(
2291
- (g) => {
2292
- let p, _, b;
2293
- const x = g.target;
2294
- if (kr(x) || Wt(x)) {
2295
- const m = Wt(x) ? x : x.defaultView;
2296
- b = i ? m.scrollX : m.scrollY, p = i ? m.document.documentElement.scrollWidth : m.document.documentElement.scrollHeight, _ = i ? m.innerWidth : m.innerHeight;
2297
- } else
2298
- b = i ? x.scrollLeft : x.scrollTop, p = i ? x.scrollWidth : x.scrollHeight, _ = i ? x.offsetWidth : x.offsetHeight;
2299
- const f = () => {
2300
- e({
2301
- scrollHeight: p,
2302
- scrollTop: Math.max(b, 0),
2303
- viewportHeight: _
2304
- });
2305
- };
2306
- g.suppressFlushSync ? f() : bn.flushSync(f), l.current !== null && (b === l.current || b <= 0 || b === p - _) && (l.current = null, t(!0), c.current && (clearTimeout(c.current), c.current = null));
2307
- },
2308
- [e, t, i]
2309
- );
2310
- j.useEffect(() => {
2311
- const g = r || s.current;
2312
- return n(r || s.current), a({ suppressFlushSync: !0, target: g }), g.addEventListener("scroll", a, { passive: !0 }), () => {
2313
- n(null), g.removeEventListener("scroll", a);
2314
- };
2315
- }, [s, a, o, n, r]);
2316
- function h(g) {
2317
- const p = s.current;
2318
- if (!p || (i ? "offsetWidth" in p && p.offsetWidth === 0 : "offsetHeight" in p && p.offsetHeight === 0))
2319
- return;
2320
- const _ = g.behavior === "smooth";
2321
- let b, x, f;
2322
- Wt(p) ? (x = Math.max(
2323
- Ve(p.document.documentElement, i ? "width" : "height"),
2324
- i ? p.document.documentElement.scrollWidth : p.document.documentElement.scrollHeight
2325
- ), b = i ? p.innerWidth : p.innerHeight, f = i ? window.scrollX : window.scrollY) : (x = p[i ? "scrollWidth" : "scrollHeight"], b = Ve(p, i ? "width" : "height"), f = p[i ? "scrollLeft" : "scrollTop"]);
2326
- const m = x - b;
2327
- if (g.top = Math.ceil(Math.max(Math.min(m, g.top), 0)), tn(b, x) || g.top === f) {
2328
- e({ scrollHeight: x, scrollTop: f, viewportHeight: b }), _ && t(!0);
2329
- return;
2330
- }
2331
- _ ? (l.current = g.top, c.current && clearTimeout(c.current), c.current = setTimeout(() => {
2332
- c.current = null, l.current = null, t(!0);
2333
- }, 1e3)) : l.current = null, i && (g = { behavior: g.behavior, left: g.top }), p.scrollTo(g);
2334
- }
2335
- function w(g) {
2336
- i && (g = { behavior: g.behavior, left: g.top }), s.current.scrollBy(g);
2337
- }
2338
- return { scrollByCallback: w, scrollerRef: s, scrollToCallback: h };
2339
- }
2340
- const At = "-webkit-sticky", _o = "sticky", oo = cn(() => {
2341
- if (typeof document > "u")
2342
- return _o;
2343
- const e = document.createElement("div");
2344
- return e.style.position = At, e.style.position === At ? At : _o;
2345
- });
2346
- function hn(e) {
2347
- return e;
2348
- }
2349
- const Er = /* @__PURE__ */ J(() => {
2350
- const e = H((l) => `Item ${l}`), t = H((l) => `Group ${l}`), o = H({}), n = H(hn), r = H("div"), i = H(dt), s = (l, c = null) => pe(
2351
- v(
2352
- o,
2353
- R((a) => a[l]),
2354
- re()
2355
- ),
2356
- c
2357
- );
2358
- return {
2359
- components: o,
2360
- computeItemKey: n,
2361
- EmptyPlaceholder: s("EmptyPlaceholder"),
2362
- FooterComponent: s("Footer"),
2363
- GroupComponent: s("Group", "div"),
2364
- groupContent: t,
2365
- HeaderComponent: s("Header"),
2366
- HeaderFooterTag: r,
2367
- ItemComponent: s("Item", "div"),
2368
- itemContent: e,
2369
- ListComponent: s("List", "div"),
2370
- ScrollerComponent: s("Scroller", "div"),
2371
- scrollerRef: i,
2372
- ScrollSeekPlaceholder: s("ScrollSeekPlaceholder"),
2373
- TopItemListComponent: s("TopItemList")
2374
- };
2375
- }), Rr = /* @__PURE__ */ J(
2376
- ([e, t]) => ({ ...e, ...t }),
2377
- ie(Hr, Er)
2378
- ), zr = ({ height: e }) => /* @__PURE__ */ I.jsx("div", { style: { height: e } }), Br = { overflowAnchor: "none", position: oo(), zIndex: 1 }, gn = { overflowAnchor: "none" }, Lr = { ...gn, display: "inline-block", height: "100%" }, ko = /* @__PURE__ */ j.memo(function({ showTopList: e = !1 }) {
2379
- const t = V("listState"), o = ke("sizeRanges"), n = V("useWindowScroll"), r = V("customScrollParent"), i = ke("windowScrollContainerState"), s = ke("scrollContainerState"), l = r || n ? i : s, c = V("itemContent"), a = V("context"), h = V("groupContent"), w = V("trackItemSizes"), g = V("itemSize"), p = V("log"), _ = ke("gap"), b = V("horizontalDirection"), { callbackRef: x } = Un(
2380
- o,
2381
- g,
2382
- w,
2383
- e ? dt : l,
2384
- p,
2385
- _,
2386
- r,
2387
- b,
2388
- V("skipAnimationFrameInResizeObserver")
2389
- ), [f, m] = j.useState(0);
2390
- no("deviation", (L) => {
2391
- f !== L && m(L);
2392
- });
2393
- const S = V("EmptyPlaceholder"), z = V("ScrollSeekPlaceholder") || zr, u = V("ListComponent"), d = V("ItemComponent"), C = V("GroupComponent"), k = V("computeItemKey"), B = V("isSeeking"), M = V("groupIndices").length > 0, A = V("alignToBottom"), U = V("initialItemFinalLocationReached"), Q = e ? {} : {
2394
- boxSizing: "border-box",
2395
- ...b ? {
2396
- display: "inline-block",
2397
- height: "100%",
2398
- marginLeft: f !== 0 ? f : A ? "auto" : 0,
2399
- paddingLeft: t.offsetTop,
2400
- paddingRight: t.offsetBottom,
2401
- whiteSpace: "nowrap"
2402
- } : {
2403
- marginTop: f !== 0 ? f : A ? "auto" : 0,
2404
- paddingBottom: t.offsetBottom,
2405
- paddingTop: t.offsetTop
2406
- },
2407
- ...U ? {} : { visibility: "hidden" }
2408
- };
2409
- return !e && t.totalCount === 0 && S ? /* @__PURE__ */ I.jsx(S, { ...ge(S, a) }) : /* @__PURE__ */ I.jsx(
2410
- u,
2411
- {
2412
- ...ge(u, a),
2413
- "data-testid": e ? "virtuoso-top-item-list" : "virtuoso-item-list",
2414
- ref: x,
2415
- style: Q,
2416
- children: (e ? t.topItems : t.items).map((L) => {
2417
- const P = L.originalIndex, ue = k(P + t.firstItemIndex, L.data, a);
2418
- return B ? /* @__PURE__ */ Tt(
2419
- z,
2420
- {
2421
- ...ge(z, a),
2422
- height: L.size,
2423
- index: L.index,
2424
- key: ue,
2425
- type: L.type || "item",
2426
- ...L.type === "group" ? {} : { groupIndex: L.groupIndex }
2427
- }
2428
- ) : L.type === "group" ? /* @__PURE__ */ Tt(
2429
- C,
2430
- {
2431
- ...ge(C, a),
2432
- "data-index": P,
2433
- "data-item-index": L.index,
2434
- "data-known-size": L.size,
2435
- key: ue,
2436
- style: Br
2437
- },
2438
- h(L.index, a)
2439
- ) : /* @__PURE__ */ Tt(
2440
- d,
2441
- {
2442
- ...ge(d, a),
2443
- ...Wr(d, L.data),
2444
- "data-index": P,
2445
- "data-item-group-index": L.groupIndex,
2446
- "data-item-index": L.index,
2447
- "data-known-size": L.size,
2448
- key: ue,
2449
- style: b ? Lr : gn
2450
- },
2451
- M ? c(L.index, L.groupIndex, L.data, a) : c(L.index, L.data, a)
2452
- );
2453
- })
2454
- }
2455
- );
2456
- }), jr = {
2457
- height: "100%",
2458
- outline: "none",
2459
- overflowY: "auto",
2460
- position: "relative",
2461
- WebkitOverflowScrolling: "touch"
2462
- }, Mr = {
2463
- outline: "none",
2464
- overflowX: "auto",
2465
- position: "relative"
2466
- }, Bt = (e) => ({
2467
- height: "100%",
2468
- position: "absolute",
2469
- top: 0,
2470
- width: "100%",
2471
- ...e ? { display: "flex", flexDirection: "column" } : {}
2472
- }), Nr = {
2473
- position: oo(),
2474
- top: 0,
2475
- width: "100%",
2476
- zIndex: 1
2477
- };
2478
- function ge(e, t) {
2479
- if (typeof e != "string")
2480
- return { context: t };
2481
- }
2482
- function Wr(e, t) {
2483
- return { item: typeof e == "string" ? void 0 : t };
2484
- }
2485
- const Ar = /* @__PURE__ */ j.memo(function() {
2486
- const e = V("HeaderComponent"), t = ke("headerHeight"), o = V("HeaderFooterTag"), n = Ye(
2487
- j.useMemo(
2488
- () => (i) => {
2489
- t(Ve(i, "height"));
2490
- },
2491
- [t]
2492
- ),
2493
- !0,
2494
- V("skipAnimationFrameInResizeObserver")
2495
- ), r = V("context");
2496
- return e ? /* @__PURE__ */ I.jsx(o, { ref: n, children: /* @__PURE__ */ I.jsx(e, { ...ge(e, r) }) }) : null;
2497
- }), Or = /* @__PURE__ */ j.memo(function() {
2498
- const e = V("FooterComponent"), t = ke("footerHeight"), o = V("HeaderFooterTag"), n = Ye(
2499
- j.useMemo(
2500
- () => (i) => {
2501
- t(Ve(i, "height"));
2502
- },
2503
- [t]
2504
- ),
2505
- !0,
2506
- V("skipAnimationFrameInResizeObserver")
2507
- ), r = V("context");
2508
- return e ? /* @__PURE__ */ I.jsx(o, { ref: n, children: /* @__PURE__ */ I.jsx(e, { ...ge(e, r) }) }) : null;
2509
- });
2510
- function pn({ useEmitter: e, useEmitterValue: t, usePublisher: o }) {
2511
- return j.memo(function({ children: n, style: r, context: i, ...s }) {
2512
- const l = o("scrollContainerState"), c = t("ScrollerComponent"), a = o("smoothScrollTargetReached"), h = t("scrollerRef"), w = t("horizontalDirection") || !1, { scrollByCallback: g, scrollerRef: p, scrollToCallback: _ } = fn(
2513
- l,
2514
- a,
2515
- c,
2516
- h,
2517
- void 0,
2518
- w
2519
- );
2520
- return e("scrollTo", _), e("scrollBy", g), /* @__PURE__ */ I.jsx(
2521
- c,
2522
- {
2523
- "data-testid": "virtuoso-scroller",
2524
- "data-virtuoso-scroller": !0,
2525
- ref: p,
2526
- style: { ...w ? Mr : jr, ...r },
2527
- tabIndex: 0,
2528
- ...s,
2529
- ...ge(c, i),
2530
- children: n
2531
- }
2532
- );
2533
- });
2534
- }
2535
- function xn({ useEmitter: e, useEmitterValue: t, usePublisher: o }) {
2536
- return j.memo(function({ children: n, style: r, context: i, ...s }) {
2537
- const l = o("windowScrollContainerState"), c = t("ScrollerComponent"), a = o("smoothScrollTargetReached"), h = t("totalListHeight"), w = t("deviation"), g = t("customScrollParent"), p = j.useRef(null), _ = t("scrollerRef"), { scrollByCallback: b, scrollerRef: x, scrollToCallback: f } = fn(
2538
- l,
2539
- a,
2540
- c,
2541
- _,
2542
- g
2543
- );
2544
- return mn(() => {
2545
- var m;
2546
- return x.current = g || ((m = p.current) == null ? void 0 : m.ownerDocument.defaultView), () => {
2547
- x.current = null;
2548
- };
2549
- }, [x, g]), e("windowScrollTo", f), e("scrollBy", b), /* @__PURE__ */ I.jsx(
2550
- c,
2551
- {
2552
- ref: p,
2553
- "data-virtuoso-scroller": !0,
2554
- style: { position: "relative", ...r, ...h !== 0 ? { height: h + w } : {} },
2555
- ...s,
2556
- ...ge(c, i),
2557
- children: n
2558
- }
2559
- );
2560
- });
2561
- }
2562
- const Pr = ({ children: e }) => {
2563
- const t = j.useContext(un), o = ke("viewportHeight"), n = ke("fixedItemHeight"), r = V("alignToBottom"), i = V("horizontalDirection"), s = j.useMemo(
2564
- () => Do(o, (c) => Ve(c, i ? "width" : "height")),
2565
- [o, i]
2566
- ), l = Ye(s, !0, V("skipAnimationFrameInResizeObserver"));
2567
- return j.useEffect(() => {
2568
- t && (o(t.viewportHeight), n(t.itemHeight));
2569
- }, [t, o, n]), /* @__PURE__ */ I.jsx("div", { "data-viewport-type": "element", ref: l, style: Bt(r), children: e });
2570
- }, Dr = ({ children: e }) => {
2571
- const t = j.useContext(un), o = ke("windowViewportRect"), n = ke("fixedItemHeight"), r = V("customScrollParent"), i = Go(
2572
- o,
2573
- r,
2574
- V("skipAnimationFrameInResizeObserver")
2575
- ), s = V("alignToBottom");
2576
- return j.useEffect(() => {
2577
- t && (n(t.itemHeight), o({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
2578
- }, [t, o, n]), /* @__PURE__ */ I.jsx("div", { "data-viewport-type": "window", ref: i, style: Bt(s), children: e });
2579
- }, Vr = ({ children: e }) => {
2580
- const t = V("TopItemListComponent") || "div", o = V("headerHeight"), n = { ...Nr, marginTop: `${o}px` }, r = V("context");
2581
- return /* @__PURE__ */ I.jsx(t, { style: n, ...ge(t, r), children: e });
2582
- }, Gr = /* @__PURE__ */ j.memo(function(e) {
2583
- const t = V("useWindowScroll"), o = V("topItemsIndexes").length > 0, n = V("customScrollParent"), r = V("context");
2584
- return /* @__PURE__ */ I.jsxs(n || t ? qr : $r, { ...e, context: r, children: [
2585
- o && /* @__PURE__ */ I.jsx(Vr, { children: /* @__PURE__ */ I.jsx(ko, { showTopList: !0 }) }),
2586
- /* @__PURE__ */ I.jsxs(n || t ? Dr : Pr, { children: [
2587
- /* @__PURE__ */ I.jsx(Ar, {}),
2588
- /* @__PURE__ */ I.jsx(ko, {}),
2589
- /* @__PURE__ */ I.jsx(Or, {})
2590
- ] })
2591
- ] });
2592
- }), {
2593
- Component: Fr,
2594
- useEmitter: no,
2595
- useEmitterValue: V,
2596
- usePublisher: ke
2597
- } = /* @__PURE__ */ an(
2598
- Rr,
2599
- {
2600
- required: {},
2601
- optional: {
2602
- restoreStateFrom: "restoreStateFrom",
2603
- context: "context",
2604
- followOutput: "followOutput",
2605
- scrollIntoViewOnChange: "scrollIntoViewOnChange",
2606
- itemContent: "itemContent",
2607
- groupContent: "groupContent",
2608
- overscan: "overscan",
2609
- increaseViewportBy: "increaseViewportBy",
2610
- totalCount: "totalCount",
2611
- groupCounts: "groupCounts",
2612
- topItemCount: "topItemCount",
2613
- firstItemIndex: "firstItemIndex",
2614
- initialTopMostItemIndex: "initialTopMostItemIndex",
2615
- components: "components",
2616
- atBottomThreshold: "atBottomThreshold",
2617
- atTopThreshold: "atTopThreshold",
2618
- computeItemKey: "computeItemKey",
2619
- defaultItemHeight: "defaultItemHeight",
2620
- fixedItemHeight: "fixedItemHeight",
2621
- itemSize: "itemSize",
2622
- scrollSeekConfiguration: "scrollSeekConfiguration",
2623
- headerFooterTag: "HeaderFooterTag",
2624
- data: "data",
2625
- initialItemCount: "initialItemCount",
2626
- initialScrollTop: "initialScrollTop",
2627
- alignToBottom: "alignToBottom",
2628
- useWindowScroll: "useWindowScroll",
2629
- customScrollParent: "customScrollParent",
2630
- scrollerRef: "scrollerRef",
2631
- logLevel: "logLevel",
2632
- horizontalDirection: "horizontalDirection",
2633
- skipAnimationFrameInResizeObserver: "skipAnimationFrameInResizeObserver"
2634
- },
2635
- methods: {
2636
- scrollToIndex: "scrollToIndex",
2637
- scrollIntoView: "scrollIntoView",
2638
- scrollTo: "scrollTo",
2639
- scrollBy: "scrollBy",
2640
- autoscrollToBottom: "autoscrollToBottom",
2641
- getState: "getState"
2642
- },
2643
- events: {
2644
- isScrolling: "isScrolling",
2645
- endReached: "endReached",
2646
- startReached: "startReached",
2647
- rangeChanged: "rangeChanged",
2648
- atBottomStateChange: "atBottomStateChange",
2649
- atTopStateChange: "atTopStateChange",
2650
- totalListHeightChanged: "totalListHeightChanged",
2651
- itemsRendered: "itemsRendered",
2652
- groupIndices: "groupIndices"
2653
- }
2654
- },
2655
- Gr
2656
- ), $r = /* @__PURE__ */ pn({ useEmitter: no, useEmitterValue: V, usePublisher: ke }), qr = /* @__PURE__ */ xn({ useEmitter: no, useEmitterValue: V, usePublisher: ke }), Ur = Fr;
2657
- oo();
2658
- const Eo = {
2659
- bottom: 0,
2660
- itemHeight: 0,
2661
- items: [],
2662
- itemWidth: 0,
2663
- offsetBottom: 0,
2664
- offsetTop: 0,
2665
- top: 0
2666
- }, Kr = {
2667
- bottom: 0,
2668
- itemHeight: 0,
2669
- items: [{ index: 0 }],
2670
- itemWidth: 0,
2671
- offsetBottom: 0,
2672
- offsetTop: 0,
2673
- top: 0
2674
- }, { ceil: Ro, floor: _t, max: it, min: Ot, round: zo } = Math;
2675
- function Bo(e, t, o) {
2676
- return Array.from({ length: t - e + 1 }).map((n, r) => ({ data: o === null ? null : o[r + e], index: r + e }));
2677
- }
2678
- function Yr(e) {
2679
- return {
2680
- ...Kr,
2681
- items: e
2682
- };
2683
- }
2684
- function It(e, t) {
2685
- return e && e.width === t.width && e.height === t.height;
2686
- }
2687
- function Xr(e, t) {
2688
- return e && e.column === t.column && e.row === t.row;
2689
- }
2690
- const Zr = /* @__PURE__ */ J(
2691
- ([
2692
- { increaseViewportBy: e, listBoundary: t, overscan: o, visibleRange: n },
2693
- { footerHeight: r, headerHeight: i, scrollBy: s, scrollContainerState: l, scrollTo: c, scrollTop: a, smoothScrollTargetReached: h, viewportHeight: w },
2694
- g,
2695
- p,
2696
- { didMount: _, propsReady: b },
2697
- { customScrollParent: x, useWindowScroll: f, windowScrollContainerState: m, windowScrollTo: S, windowViewportRect: z },
2698
- u
2699
- ]) => {
2700
- const d = H(0), C = H(0), k = H(Eo), B = H({ height: 0, width: 0 }), M = H({ height: 0, width: 0 }), A = K(), U = K(), Q = H(0), L = H(null), P = H({ column: 0, row: 0 }), ue = K(), ve = K(), we = H(!1), Ce = H(0), he = H(!0), de = H(!1), Oe = H(!1);
2701
- Z(
2702
- v(
2703
- _,
2704
- $(Ce),
2705
- O(([T, G]) => !!G)
2706
- ),
2707
- () => {
2708
- F(he, !1);
2709
- }
2710
- ), Z(
2711
- v(
2712
- ae(_, he, M, B, Ce, de),
2713
- O(([T, G, te, y, , E]) => T && !G && te.height !== 0 && y.height !== 0 && !E)
2714
- ),
2715
- ([, , , , T]) => {
2716
- F(de, !0), Jt(1, () => {
2717
- F(A, T);
2718
- }), ze(v(a), () => {
2719
- F(t, [0, 0]), F(he, !0);
2720
- });
2721
- }
2722
- ), N(
2723
- v(
2724
- ve,
2725
- O((T) => T != null && T.scrollTop > 0),
2726
- Ne(0)
2727
- ),
2728
- C
2729
- ), Z(
2730
- v(
2731
- _,
2732
- $(ve),
2733
- O(([, T]) => T != null)
2734
- ),
2735
- ([, T]) => {
2736
- T && (F(B, T.viewport), F(M, T.item), F(P, T.gap), T.scrollTop > 0 && (F(we, !0), ze(v(a, Ke(1)), (G) => {
2737
- F(we, !1);
2738
- }), F(c, { top: T.scrollTop })));
2739
- }
2740
- ), N(
2741
- v(
2742
- B,
2743
- R(({ height: T }) => T)
2744
- ),
2745
- w
2746
- ), N(
2747
- v(
2748
- ae(
2749
- W(B, It),
2750
- W(M, It),
2751
- W(P, (T, G) => T && T.column === G.column && T.row === G.row),
2752
- W(a)
2753
- ),
2754
- R(([T, G, te, y]) => ({
2755
- gap: te,
2756
- item: G,
2757
- scrollTop: y,
2758
- viewport: T
2759
- }))
2760
- ),
2761
- ue
2762
- ), N(
2763
- v(
2764
- ae(
2765
- W(d),
2766
- n,
2767
- W(P, Xr),
2768
- W(M, It),
2769
- W(B, It),
2770
- W(L),
2771
- W(C),
2772
- W(we),
2773
- W(he),
2774
- W(Ce)
2775
- ),
2776
- O(([, , , , , , , T]) => !T),
2777
- R(
2778
- ([
2779
- T,
2780
- [G, te],
2781
- y,
2782
- E,
2783
- Y,
2784
- D,
2785
- q,
2786
- ,
2787
- oe,
2788
- X
2789
- ]) => {
2790
- const { column: fe, row: Re } = y, { height: je, width: ye } = E, { width: Me } = Y;
2791
- if (q === 0 && (T === 0 || Me === 0))
2792
- return Eo;
2793
- if (ye === 0) {
2794
- const co = Qt(X, T), wn = co + Math.max(q - 1, 0);
2795
- return Yr(Bo(co, wn, D));
2796
- }
2797
- const gt = vn(Me, ye, fe);
2798
- let Ze, qe;
2799
- oe ? G === 0 && te === 0 && q > 0 ? (Ze = 0, qe = q - 1) : (Ze = gt * _t((G + Re) / (je + Re)), qe = gt * Ro((te + Re) / (je + Re)) - 1, qe = Ot(T - 1, it(qe, gt - 1)), Ze = Ot(qe, it(0, Ze))) : (Ze = 0, qe = -1);
2800
- const ro = Bo(Ze, qe, D), { bottom: io, top: so } = Lo(Y, y, E, ro), lo = Ro(T / gt), Tn = lo * je + (lo - 1) * Re - io;
2801
- return { bottom: io, itemHeight: je, items: ro, itemWidth: ye, offsetBottom: Tn, offsetTop: so, top: so };
2802
- }
2803
- )
2804
- ),
2805
- k
2806
- ), N(
2807
- v(
2808
- L,
2809
- O((T) => T !== null),
2810
- R((T) => T.length)
2811
- ),
2812
- d
2813
- ), N(
2814
- v(
2815
- ae(B, M, k, P),
2816
- O(([T, G, { items: te }]) => te.length > 0 && G.height !== 0 && T.height !== 0),
2817
- R(([T, G, { items: te }, y]) => {
2818
- const { bottom: E, top: Y } = Lo(T, y, G, te);
2819
- return [Y, E];
2820
- }),
2821
- re(ct)
2822
- ),
2823
- t
2824
- );
2825
- const Ie = H(!1);
2826
- N(
2827
- v(
2828
- a,
2829
- $(Ie),
2830
- R(([T, G]) => G || T !== 0)
2831
- ),
2832
- Ie
2833
- );
2834
- const Le = _e(
2835
- v(
2836
- ae(k, d),
2837
- O(([{ items: T }]) => T.length > 0),
2838
- $(Ie),
2839
- O(([[T, G], te]) => {
2840
- const y = T.items[T.items.length - 1].index === G - 1;
2841
- return (te || T.bottom > 0 && T.itemHeight > 0 && T.offsetBottom === 0 && T.items.length === G) && y;
2842
- }),
2843
- R(([[, T]]) => T - 1),
2844
- re()
2845
- )
2846
- ), De = _e(
2847
- v(
2848
- W(k),
2849
- O(({ items: T }) => T.length > 0 && T[0].index === 0),
2850
- Ne(0),
2851
- re()
2852
- )
2853
- ), Se = _e(
2854
- v(
2855
- W(k),
2856
- $(we),
2857
- O(([{ items: T }, G]) => T.length > 0 && !G),
2858
- R(([{ items: T }]) => ({
2859
- endIndex: T[T.length - 1].index,
2860
- startIndex: T[0].index
2861
- })),
2862
- re(Yo),
2863
- Pe(0)
2864
- )
2865
- );
2866
- N(Se, p.scrollSeekRangeChanged), N(
2867
- v(
2868
- A,
2869
- $(B, M, d, P),
2870
- R(([T, G, te, y, E]) => {
2871
- const Y = en(T), { align: D, behavior: q, offset: oe } = Y;
2872
- let X = Y.index;
2873
- X === "LAST" && (X = y - 1), X = it(0, X, Ot(y - 1, X));
2874
- let fe = qt(G, E, te, X);
2875
- return D === "end" ? fe = zo(fe - G.height + te.height) : D === "center" && (fe = zo(fe - G.height / 2 + te.height / 2)), oe && (fe += oe), { behavior: q, top: fe };
2876
- })
2877
- ),
2878
- c
2879
- );
2880
- const ce = pe(
2881
- v(
2882
- k,
2883
- R((T) => T.offsetBottom + T.bottom)
2884
- ),
2885
- 0
2886
- );
2887
- return N(
2888
- v(
2889
- z,
2890
- R((T) => ({ height: T.visibleHeight, width: T.visibleWidth }))
2891
- ),
2892
- B
2893
- ), {
2894
- customScrollParent: x,
2895
- // input
2896
- data: L,
2897
- deviation: Q,
2898
- footerHeight: r,
2899
- gap: P,
2900
- headerHeight: i,
2901
- increaseViewportBy: e,
2902
- initialItemCount: C,
2903
- itemDimensions: M,
2904
- overscan: o,
2905
- restoreStateFrom: ve,
2906
- scrollBy: s,
2907
- scrollContainerState: l,
2908
- scrollHeight: U,
2909
- scrollTo: c,
2910
- scrollToIndex: A,
2911
- scrollTop: a,
2912
- smoothScrollTargetReached: h,
2913
- totalCount: d,
2914
- useWindowScroll: f,
2915
- viewportDimensions: B,
2916
- windowScrollContainerState: m,
2917
- windowScrollTo: S,
2918
- windowViewportRect: z,
2919
- ...p,
2920
- // output
2921
- gridState: k,
2922
- horizontalDirection: Oe,
2923
- initialTopMostItemIndex: Ce,
2924
- totalListHeight: ce,
2925
- ...g,
2926
- endReached: Le,
2927
- propsReady: b,
2928
- rangeChanged: Se,
2929
- startReached: De,
2930
- stateChanged: ue,
2931
- stateRestoreInProgress: we,
2932
- ...u
2933
- };
2934
- },
2935
- ie(eo, xe, ht, ln, $e, to, Fe)
2936
- );
2937
- function vn(e, t, o) {
2938
- return it(1, _t((e + o) / (_t(t) + o)));
2939
- }
2940
- function Lo(e, t, o, n) {
2941
- const { height: r } = o;
2942
- if (r === void 0 || n.length === 0)
2943
- return { bottom: 0, top: 0 };
2944
- const i = qt(e, t, o, n[0].index);
2945
- return { bottom: qt(e, t, o, n[n.length - 1].index) + r, top: i };
2946
- }
2947
- function qt(e, t, o, n) {
2948
- const r = vn(e.width, o.width, t.column), i = _t(n / r), s = i * o.height + it(0, i - 1) * t.row;
2949
- return s > 0 ? s + t.row : s;
2950
- }
2951
- const Jr = /* @__PURE__ */ J(() => {
2952
- const e = H((w) => `Item ${w}`), t = H({}), o = H(null), n = H("virtuoso-grid-item"), r = H("virtuoso-grid-list"), i = H(hn), s = H("div"), l = H(dt), c = (w, g = null) => pe(
2953
- v(
2954
- t,
2955
- R((p) => p[w]),
2956
- re()
2957
- ),
2958
- g
2959
- ), a = H(!1), h = H(!1);
2960
- return N(W(h), a), {
2961
- components: t,
2962
- computeItemKey: i,
2963
- context: o,
2964
- FooterComponent: c("Footer"),
2965
- HeaderComponent: c("Header"),
2966
- headerFooterTag: s,
2967
- itemClassName: n,
2968
- ItemComponent: c("Item", "div"),
2969
- itemContent: e,
2970
- listClassName: r,
2971
- ListComponent: c("List", "div"),
2972
- readyStateChanged: a,
2973
- reportReadyState: h,
2974
- ScrollerComponent: c("Scroller", "div"),
2975
- scrollerRef: l,
2976
- ScrollSeekPlaceholder: c("ScrollSeekPlaceholder", "div")
2977
- };
2978
- }), Qr = /* @__PURE__ */ J(
2979
- ([e, t]) => ({ ...e, ...t }),
2980
- ie(Zr, Jr)
2981
- ), ei = /* @__PURE__ */ j.memo(function() {
2982
- const e = ne("gridState"), t = ne("listClassName"), o = ne("itemClassName"), n = ne("itemContent"), r = ne("computeItemKey"), i = ne("isSeeking"), s = Ee("scrollHeight"), l = ne("ItemComponent"), c = ne("ListComponent"), a = ne("ScrollSeekPlaceholder"), h = ne("context"), w = Ee("itemDimensions"), g = Ee("gap"), p = ne("log"), _ = ne("stateRestoreInProgress"), b = Ee("reportReadyState"), x = Ye(
2983
- j.useMemo(
2984
- () => (f) => {
2985
- const m = f.parentElement.parentElement.scrollHeight;
2986
- s(m);
2987
- const S = f.firstChild;
2988
- if (S) {
2989
- const { height: z, width: u } = S.getBoundingClientRect();
2990
- w({ height: z, width: u });
2991
- }
2992
- g({
2993
- column: jo("column-gap", getComputedStyle(f).columnGap, p),
2994
- row: jo("row-gap", getComputedStyle(f).rowGap, p)
2995
- });
2996
- },
2997
- [s, w, g, p]
2998
- ),
2999
- !0,
3000
- !1
3001
- );
3002
- return mn(() => {
3003
- e.itemHeight > 0 && e.itemWidth > 0 && b(!0);
3004
- }, [e]), _ ? null : /* @__PURE__ */ I.jsx(
3005
- c,
3006
- {
3007
- className: t,
3008
- ref: x,
3009
- ...ge(c, h),
3010
- "data-testid": "virtuoso-item-list",
3011
- style: { paddingBottom: e.offsetBottom, paddingTop: e.offsetTop },
3012
- children: e.items.map((f) => {
3013
- const m = r(f.index, f.data, h);
3014
- return i ? /* @__PURE__ */ I.jsx(
3015
- a,
3016
- {
3017
- ...ge(a, h),
3018
- height: e.itemHeight,
3019
- index: f.index,
3020
- width: e.itemWidth
3021
- },
3022
- m
3023
- ) : /* @__PURE__ */ Tt(
3024
- l,
3025
- {
3026
- ...ge(l, h),
3027
- className: o,
3028
- "data-index": f.index,
3029
- key: m
3030
- },
3031
- n(f.index, f.data, h)
3032
- );
3033
- })
3034
- }
3035
- );
3036
- }), ti = j.memo(function() {
3037
- const e = ne("HeaderComponent"), t = Ee("headerHeight"), o = ne("headerFooterTag"), n = Ye(
3038
- j.useMemo(
3039
- () => (i) => {
3040
- t(Ve(i, "height"));
3041
- },
3042
- [t]
3043
- ),
3044
- !0,
3045
- !1
3046
- ), r = ne("context");
3047
- return e ? /* @__PURE__ */ I.jsx(o, { ref: n, children: /* @__PURE__ */ I.jsx(e, { ...ge(e, r) }) }) : null;
3048
- }), oi = j.memo(function() {
3049
- const e = ne("FooterComponent"), t = Ee("footerHeight"), o = ne("headerFooterTag"), n = Ye(
3050
- j.useMemo(
3051
- () => (i) => {
3052
- t(Ve(i, "height"));
3053
- },
3054
- [t]
3055
- ),
3056
- !0,
3057
- !1
3058
- ), r = ne("context");
3059
- return e ? /* @__PURE__ */ I.jsx(o, { ref: n, children: /* @__PURE__ */ I.jsx(e, { ...ge(e, r) }) }) : null;
3060
- }), ni = ({ children: e }) => {
3061
- const t = j.useContext(dn), o = Ee("itemDimensions"), n = Ee("viewportDimensions"), r = Ye(
3062
- j.useMemo(
3063
- () => (i) => {
3064
- n(i.getBoundingClientRect());
3065
- },
3066
- [n]
3067
- ),
3068
- !0,
3069
- !1
3070
- );
3071
- return j.useEffect(() => {
3072
- t && (n({ height: t.viewportHeight, width: t.viewportWidth }), o({ height: t.itemHeight, width: t.itemWidth }));
3073
- }, [t, n, o]), /* @__PURE__ */ I.jsx("div", { ref: r, style: Bt(!1), children: e });
3074
- }, ri = ({ children: e }) => {
3075
- const t = j.useContext(dn), o = Ee("windowViewportRect"), n = Ee("itemDimensions"), r = ne("customScrollParent"), i = Go(o, r, !1);
3076
- return j.useEffect(() => {
3077
- t && (n({ height: t.itemHeight, width: t.itemWidth }), o({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: t.viewportWidth }));
3078
- }, [t, o, n]), /* @__PURE__ */ I.jsx("div", { ref: i, style: Bt(!1), children: e });
3079
- }, ii = /* @__PURE__ */ j.memo(function({ ...e }) {
3080
- const t = ne("useWindowScroll"), o = ne("customScrollParent"), n = o || t ? li : si, r = o || t ? ri : ni, i = ne("context");
3081
- return /* @__PURE__ */ I.jsx(n, { ...e, ...ge(n, i), children: /* @__PURE__ */ I.jsxs(r, { children: [
3082
- /* @__PURE__ */ I.jsx(ti, {}),
3083
- /* @__PURE__ */ I.jsx(ei, {}),
3084
- /* @__PURE__ */ I.jsx(oi, {})
3085
- ] }) });
3086
- }), {
3087
- Component: Ss,
3088
- useEmitter: In,
3089
- useEmitterValue: ne,
3090
- usePublisher: Ee
3091
- } = /* @__PURE__ */ an(
3092
- Qr,
3093
- {
3094
- optional: {
3095
- context: "context",
3096
- totalCount: "totalCount",
3097
- overscan: "overscan",
3098
- itemContent: "itemContent",
3099
- components: "components",
3100
- computeItemKey: "computeItemKey",
3101
- data: "data",
3102
- initialItemCount: "initialItemCount",
3103
- scrollSeekConfiguration: "scrollSeekConfiguration",
3104
- headerFooterTag: "headerFooterTag",
3105
- listClassName: "listClassName",
3106
- itemClassName: "itemClassName",
3107
- useWindowScroll: "useWindowScroll",
3108
- customScrollParent: "customScrollParent",
3109
- scrollerRef: "scrollerRef",
3110
- logLevel: "logLevel",
3111
- restoreStateFrom: "restoreStateFrom",
3112
- initialTopMostItemIndex: "initialTopMostItemIndex",
3113
- increaseViewportBy: "increaseViewportBy"
3114
- },
3115
- methods: {
3116
- scrollTo: "scrollTo",
3117
- scrollBy: "scrollBy",
3118
- scrollToIndex: "scrollToIndex"
3119
- },
3120
- events: {
3121
- isScrolling: "isScrolling",
3122
- endReached: "endReached",
3123
- startReached: "startReached",
3124
- rangeChanged: "rangeChanged",
3125
- atBottomStateChange: "atBottomStateChange",
3126
- atTopStateChange: "atTopStateChange",
3127
- stateChanged: "stateChanged",
3128
- readyStateChanged: "readyStateChanged"
3129
- }
3130
- },
3131
- ii
3132
- ), si = /* @__PURE__ */ pn({ useEmitter: In, useEmitterValue: ne, usePublisher: Ee }), li = /* @__PURE__ */ xn({ useEmitter: In, useEmitterValue: ne, usePublisher: Ee });
3133
- function jo(e, t, o) {
3134
- return t !== "normal" && !(t != null && t.endsWith("px")) && o(`${e} was not resolved to pixel value correctly`, t, Te.WARN), t === "normal" ? 0 : parseInt(t ?? "0", 10);
3135
- }
3136
- const ci = "_realTimeLogModalStyle_1f0fd_2", ai = "_customHeader_1f0fd_10", ui = "_modalHeader_1f0fd_18", di = "_modalLeft_1f0fd_38", mi = "_buttonGroup_1f0fd_45", fi = "_iosIcon_1f0fd_56", hi = "_modalLoader_1f0fd_86", gi = "_dash_1f0fd_90", pi = "_searchWrapper_1f0fd_95", xi = "_chevronIcons_1f0fd_101", vi = "_logInput_1f0fd_123", Ii = "_searchResult_1f0fd_130", Ti = "_loadingWrap_1f0fd_140", wi = "_modalRight_1f0fd_151", Ci = "_inputsWrapper_1f0fd_155", Si = "_search_1f0fd_95", yi = "_cliCommand_1f0fd_172", bi = "_buttonsWrapper_1f0fd_198", Hi = "_downloadIconBtn_1f0fd_204", _i = "_downloadIconBtn__disabled_1f0fd_228", ki = "_copyIconBtn_1f0fd_238", Ei = "_copyIconBtn__disabled_1f0fd_262", Ri = "_iconGroup_1f0fd_272", zi = "_activeIcon_1f0fd_284", se = {
3137
- realTimeLogModalStyle: ci,
3138
- customHeader: ai,
3139
- modalHeader: ui,
3140
- modalLeft: di,
3141
- buttonGroup: mi,
3142
- iosIcon: fi,
3143
- modalLoader: hi,
3144
- dash: gi,
3145
- searchWrapper: pi,
3146
- chevronIcons: xi,
3147
- logInput: vi,
3148
- searchResult: Ii,
3149
- loadingWrap: Ti,
3150
- modalRight: wi,
3151
- inputsWrapper: Ci,
3152
- search: Si,
3153
- cliCommand: yi,
3154
- buttonsWrapper: bi,
3155
- downloadIconBtn: Hi,
3156
- downloadIconBtn__disabled: _i,
3157
- copyIconBtn: ki,
3158
- copyIconBtn__disabled: Ei,
3159
- iconGroup: Ri,
3160
- activeIcon: zi
3161
- }, ys = {
3162
- status: (e) => ({
3163
- title: Qe.t("label.status"),
3164
- dataIndex: "status",
3165
- className: "capitalize",
3166
- render: (t) => /* @__PURE__ */ I.jsx(kn, { status: e[t], text: t })
3167
- }),
3168
- dateCreated: {
3169
- title: Qe.t("label.date_created"),
3170
- dataIndex: "created_date",
3171
- render: (e) => /* @__PURE__ */ I.jsx(Pt, { date: e })
3172
- }
3173
- }, bs = {
3174
- edit: (e, t) => ({
3175
- title: Qe.t("label.edit"),
3176
- dataIndex: e,
3177
- render: (o, n) => /* @__PURE__ */ I.jsx(xt, { icon: et.Edit, onClick: () => t(o, n) })
3178
- }),
3179
- delete: (e, t) => ({
3180
- title: Qe.t("label.delete"),
3181
- dataIndex: e,
3182
- render: (o, n) => /* @__PURE__ */ I.jsx(xt, { icon: et.Trash, onClick: () => t(o, n) })
3183
- }),
3184
- download: (e, t) => ({
3185
- title: Qe.t("label.export"),
3186
- dataIndex: e,
3187
- render: (o, n) => /* @__PURE__ */ I.jsx(xt, { icon: et.Download, onClick: () => t(o, n) })
3188
- }),
3189
- detail: (e, t) => ({
3190
- title: Qe.t("label.detail"),
3191
- dataIndex: e,
3192
- render: (o, n) => /* @__PURE__ */ I.jsx(xt, { icon: et.Link, onClick: () => t(o, n) })
3193
- })
3194
- };
3195
- var Bi = { BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
3196
- const Mo = Number(
3197
- Bi.VITE_APP_LOKI_REALTIME_LOG_RESPONSE_MIN_LINE_LIMIT
3198
- ), No = 200, Li = 100, ji = (e) => {
3199
- const {
3200
- onClose: t,
3201
- projectPk: o,
3202
- interval: n,
3203
- appPk: r,
3204
- logTypes: i,
3205
- logs: s,
3206
- responseCount: l,
3207
- lastLogIndex: c = 0,
3208
- download: a,
3209
- onFetchLogs: h,
3210
- onClearLogs: w,
3211
- withoutPermission: g
3212
- } = e, p = Lt(null), [, _] = Wo(e.id), [b, x] = Je(!1), [f, m] = Je(), [S, z] = Je(""), [u, d] = Je(), [C, k] = Je(0), B = s || [], M = l === void 0, A = (y, E, Y, D) => {
3213
- const q = {
3214
- applications: [E || i[0].value],
3215
- scroll_mode: y || void 0
3216
- };
3217
- h({ projectPk: o, appPk: r, applications: q.applications, scroll_mode: q.scroll_mode, withoutPermission: g }).then(
3218
- (oe) => {
3219
- if (Object.prototype.hasOwnProperty.call(oe, "error")) {
3220
- D && D();
3221
- return;
3222
- }
3223
- Y && Y();
3224
- }
3225
- );
3226
- };
3227
- function U(y) {
3228
- let E = 0;
3229
- const Y = {};
3230
- return y.forEach((D, q) => {
3231
- const oe = D.message.match(/<mark\b[^>]*>/g);
3232
- E += oe ? oe.length : 0, oe && (Y[q] = oe);
3233
- }), { total: E, filteredLogs: Y };
3234
- }
3235
- const Q = Hn(A, n * 1e3), L = Lt(), P = Lt(Q), ue = (y, E, Y, D) => {
3236
- if (!E || E.length < 1)
3237
- return y;
3238
- let q = y;
3239
- if (D.group)
3240
- if (D.regex) {
3241
- let X;
3242
- try {
3243
- X = new RegExp(
3244
- E,
3245
- D.caseSensitive ? "g" : "gi"
3246
- );
3247
- } catch {
3248
- return y;
3249
- }
3250
- q = y.filter((fe) => X.test(fe.message));
3251
- } else
3252
- D.caseSensitive ? q = y.filter(
3253
- (X) => X.message.includes(E)
3254
- ) : q = y.filter(
3255
- (X) => X.message.toLocaleLowerCase().includes(E.toLocaleLowerCase())
3256
- );
3257
- return q.map((X, fe) => ({
3258
- ...X,
3259
- message: ve(X.message, E, D, fe) + `
3260
- `
3261
- }));
3262
- }, ve = (y, E, Y, D) => {
3263
- if (!E)
3264
- return y;
3265
- try {
3266
- if (Y.regex) {
3267
- let q;
3268
- const oe = E.match(/^\/(.+)\/([gimsuy]*)$/);
3269
- return oe ? q = new RegExp(oe[1], oe[2]) : q = new RegExp(
3270
- E,
3271
- Y.caseSensitive ? "g" : "gi"
3272
- ), y.replace(
3273
- q,
3274
- (X) => `<mark data-mark-index="${D}">${X}</mark>`
3275
- );
3276
- } else {
3277
- if (Y.caseSensitive)
3278
- return y.split(E).join(`<mark data-mark-index="${D}">${E}</mark>`);
3279
- {
3280
- const q = new RegExp(E, "gi");
3281
- return y.replace(
3282
- q,
3283
- (oe) => `<mark data-mark-index="${D}">${oe}</mark>`
3284
- );
3285
- }
3286
- }
3287
- } catch {
3288
- return y;
3289
- }
3290
- }, we = () => {
3291
- z("");
3292
- }, Ce = () => {
3293
- x(!b);
3294
- }, he = () => {
3295
- let y = "";
3296
- B.forEach((E) => {
3297
- y += E.message;
3298
- }), Rn({
3299
- type: En.SUCCESS,
3300
- message: pt("text.copied"),
3301
- closeTime: 3e3
3302
- }), navigator.clipboard.writeText(y);
3303
- }, de = (y, E) => {
3304
- y.currentTarget.classList.toggle(se.activeIcon), d({
3305
- ...u,
3306
- [E]: !(u != null && u[E])
3307
- });
3308
- }, Oe = (y) => {
3309
- var E, Y;
3310
- m(y), clearTimeout(L.current), (E = P.current) == null || E.stopInterval(), (Y = P.current) == null || Y.fetch(void 0, y), jt(() => {
3311
- var D;
3312
- (D = p.current) == null || D.scrollToIndex({ index: "LAST" });
3313
- }, 300)();
3314
- }, Ie = (y) => {
3315
- y.classList.add(se.selectedMark);
3316
- }, Le = (y) => {
3317
- Array.from(y).forEach(
3318
- (E) => E.classList.remove(se.selectedMark)
3319
- );
3320
- }, De = (y, E, Y) => {
3321
- var oe;
3322
- let D = y - 1;
3323
- D < 1 && (D = E), k(D);
3324
- let q = 0;
3325
- for (const X in Y) {
3326
- const fe = Y[X];
3327
- if (q + fe.length >= D) {
3328
- const Re = D - q - 1;
3329
- (oe = p.current) == null || oe.scrollToIndex({ index: Number(X) });
3330
- const je = document.querySelector(
3331
- `[data-index="${Number(X) + 1}"]`
3332
- );
3333
- if (je) {
3334
- const ye = je.getElementsByTagName("mark");
3335
- Le(ye);
3336
- }
3337
- jt(() => {
3338
- const ye = document.querySelector(
3339
- `[data-index="${X}"]`
3340
- );
3341
- if (ye) {
3342
- const Me = ye.getElementsByTagName("mark");
3343
- Me[Re] && (Le(Me), Ie(Me[Re]));
3344
- }
3345
- }, 300)();
3346
- break;
3347
- } else
3348
- q += fe.length;
3349
- }
3350
- }, Se = (y, E, Y) => {
3351
- var oe;
3352
- let D = y + 1;
3353
- D > E && (D = 1), k(D);
3354
- let q = 0;
3355
- for (const X in Y) {
3356
- const fe = Y[X];
3357
- if (q + fe.length >= D) {
3358
- const Re = D - q - 1;
3359
- (oe = p.current) == null || oe.scrollToIndex({ index: Number(X) });
3360
- const je = document.querySelector(
3361
- `[data-index="${Number(X) - 1}"]`
3362
- );
3363
- if (je) {
3364
- const ye = je.getElementsByTagName("mark");
3365
- Le(ye);
3366
- }
3367
- jt(() => {
3368
- const ye = document.querySelector(
3369
- `[data-index="${X}"]`
3370
- );
3371
- if (ye) {
3372
- const Me = ye.getElementsByTagName("mark");
3373
- Me[Re] && (Le(Me), Ie(Me[Re]));
3374
- }
3375
- }, 300)();
3376
- break;
3377
- } else
3378
- q += fe.length;
3379
- }
3380
- }, ce = ue(B, S, P, {
3381
- regex: u == null ? void 0 : u.regex,
3382
- caseSensitive: u == null ? void 0 : u.caseSensitive,
3383
- group: u == null ? void 0 : u.group
3384
- }), T = U(ce), G = (y) => {
3385
- y.key === "Enter" && Se(
3386
- C,
3387
- T.total,
3388
- T.filteredLogs
3389
- );
3390
- }, te = (y, E) => /* @__PURE__ */ I.jsx(
3391
- "div",
3392
- {
3393
- "data-index": y,
3394
- dangerouslySetInnerHTML: { __html: E.message }
3395
- }
3396
- );
3397
- return ao(() => {
3398
- var y, E;
3399
- return (y = P.current) == null || y.fetch(void 0, f), (E = P.current) == null || E.startInterval("newer", f), () => {
3400
- clearTimeout(L.current), P.current.stopInterval(), w();
3401
- };
3402
- }, []), ao(() => (window.removeEventListener("keydown", G), window.addEventListener("keydown", G), () => {
3403
- window.removeEventListener("keydown", G);
3404
- }), [C, T.total, T.filteredLogs]), /* @__PURE__ */ I.jsx(
3405
- Oo,
3406
- {
3407
- visible: !0,
3408
- showClose: !1,
3409
- onClose: () => {
3410
- },
3411
- className: wt(se.realTimeLogModalStyle, {
3412
- "w-[90%]!": !b,
3413
- "w-full! h-full!": b
3414
- }),
3415
- headerClass: se.customHeader,
3416
- header: /* @__PURE__ */ I.jsxs("div", { className: se.modalHeader, children: [
3417
- /* @__PURE__ */ I.jsxs("div", { className: se.modalLeft, children: [
3418
- /* @__PURE__ */ I.jsxs("div", { className: se.buttonGroup, children: [
3419
- /* @__PURE__ */ I.jsx(
3420
- "div",
3421
- {
3422
- className: se.iosIcon,
3423
- onClick: () => {
3424
- t && t(), _();
3425
- },
3426
- children: /* @__PURE__ */ I.jsx(be, { name: "close-window" })
3427
- }
3428
- ),
3429
- /* @__PURE__ */ I.jsx("div", { className: se.iosIcon, onClick: Ce, children: /* @__PURE__ */ I.jsx(be, { name: "expand-window" }) })
3430
- ] }),
3431
- /* @__PURE__ */ I.jsx("div", { children: /* @__PURE__ */ I.jsx(
3432
- _n,
3433
- {
3434
- name: "logTypeSelect",
3435
- style: { height: 39 },
3436
- wrapperClassName: se.logSelect,
3437
- value: f,
3438
- items: i,
3439
- searchable: !1,
3440
- placeholder: `${pt("placeholder.selected_log_type")}: ${i[0].label}`,
3441
- itemPrefix: `${pt("placeholder.selected_log_type")}: `,
3442
- onChange: (y) => {
3443
- Oe(y);
3444
- }
3445
- }
3446
- ) }),
3447
- /* @__PURE__ */ I.jsxs("div", { className: se.searchWrapper, children: [
3448
- /* @__PURE__ */ I.jsx(
3449
- Cn,
3450
- {
3451
- name: "logSearch",
3452
- type: "text",
3453
- placeholder: pt("placeholder.search"),
3454
- isFormGroup: !1,
3455
- value: S,
3456
- className: se.logInput,
3457
- prefixClickable: !0,
3458
- suffixClickable: !0,
3459
- onChange: (y) => {
3460
- var E;
3461
- z(y.target.value), y.target.value.length > 1 && ((E = P.current) == null || E.stopInterval()), k(0);
3462
- },
3463
- prefix: /* @__PURE__ */ I.jsxs("div", { className: se.iconGroup, children: [
3464
- /* @__PURE__ */ I.jsx(
3465
- be,
3466
- {
3467
- name: "group",
3468
- onClick: (y) => {
3469
- de(y, "group");
3470
- }
3471
- }
3472
- ),
3473
- /* @__PURE__ */ I.jsx(
3474
- be,
3475
- {
3476
- name: "case-sensitive",
3477
- onClick: (y) => {
3478
- de(y, "caseSensitive");
3479
- }
3480
- }
3481
- ),
3482
- /* @__PURE__ */ I.jsx(
3483
- be,
3484
- {
3485
- name: "regex",
3486
- onClick: (y) => {
3487
- de(y, "regex");
3488
- }
3489
- }
3490
- )
3491
- ] }),
3492
- suffix: S.length > 0 ? /* @__PURE__ */ I.jsx("div", { children: /* @__PURE__ */ I.jsx(be, { onClick: we, name: "close" }) }) : /* @__PURE__ */ I.jsx("div", { children: /* @__PURE__ */ I.jsx(be, { name: "search" }) })
3493
- }
3494
- ),
3495
- /* @__PURE__ */ I.jsxs("div", { className: se.searchResult, children: [
3496
- S.length > 0 ? C : 0,
3497
- /* @__PURE__ */ I.jsxs("span", { children: [
3498
- "/",
3499
- S.length > 0 ? T.total : 0
3500
- ] })
3501
- ] }),
3502
- /* @__PURE__ */ I.jsxs("div", { className: se.chevronIcons, children: [
3503
- /* @__PURE__ */ I.jsx(
3504
- be,
3505
- {
3506
- name: "chevron-left",
3507
- onClick: () => {
3508
- Se(
3509
- C,
3510
- T.total,
3511
- T.filteredLogs
3512
- );
3513
- }
3514
- }
3515
- ),
3516
- /* @__PURE__ */ I.jsx(
3517
- be,
3518
- {
3519
- name: "chevron-left",
3520
- onClick: () => {
3521
- De(
3522
- C,
3523
- T.total,
3524
- T.filteredLogs
3525
- );
3526
- }
3527
- }
3528
- )
3529
- ] })
3530
- ] })
3531
- ] }),
3532
- /* @__PURE__ */ I.jsx("div", { className: se.modalRight, children: /* @__PURE__ */ I.jsxs("div", { className: se.buttonsWrapper, children: [
3533
- /* @__PURE__ */ I.jsx(
3534
- go,
3535
- {
3536
- appearance: ho.PRIMARY,
3537
- className: wt(se.downloadIconBtn, {
3538
- [se.downloadIconBtn__disabled]: B.length === 0
3539
- }),
3540
- onClick: () => {
3541
- var y;
3542
- return a(
3543
- {
3544
- applications: [
3545
- f || i[0].value
3546
- ],
3547
- start_datetime: uo(
3548
- (y = B == null ? void 0 : B[0]) == null ? void 0 : y.log_timestamp
3549
- ).format(),
3550
- end_datetime: uo().format()
3551
- },
3552
- !0
3553
- );
3554
- },
3555
- children: /* @__PURE__ */ I.jsx(be, { name: et.Download })
3556
- }
3557
- ),
3558
- /* @__PURE__ */ I.jsx(
3559
- go,
3560
- {
3561
- appearance: ho.PRIMARY,
3562
- className: wt(se.copyIconBtn, {
3563
- [se.copyIconBtn__disabled]: B.length === 0
3564
- }),
3565
- onClick: he,
3566
- children: /* @__PURE__ */ I.jsx(be, { name: et.Copy })
3567
- }
3568
- )
3569
- ] }) })
3570
- ] }),
3571
- children: /* @__PURE__ */ I.jsx(
3572
- Ur,
3573
- {
3574
- ref: p,
3575
- style: {
3576
- overflow: "auto",
3577
- height: b ? "100%" : "500px"
3578
- },
3579
- data: ce,
3580
- initialTopMostItemIndex: ce.length - 1 || 0,
3581
- totalCount: ce.length,
3582
- itemContent: te,
3583
- onScroll: (y) => {
3584
- y.currentTarget.scrollHeight - y.currentTarget.scrollTop <= y.currentTarget.clientHeight + No || P.current.stopInterval();
3585
- },
3586
- atTopThreshold: Li,
3587
- atTopStateChange: (y) => {
3588
- var D;
3589
- if (S.length > 0 || M)
3590
- return;
3591
- const E = () => ce.length - c < 30 || c === 0 ? 10 : c, Y = () => {
3592
- var q;
3593
- (q = p.current) == null || q.scrollToIndex({
3594
- index: E()
3595
- });
3596
- };
3597
- y && !M && ((D = P.current) == null || D.fetch(
3598
- "older",
3599
- f,
3600
- Y
3601
- ));
3602
- },
3603
- atBottomThreshold: No,
3604
- atBottomStateChange: (y) => {
3605
- if (ce.length <= 0 || S.length > 0 || M)
3606
- return;
3607
- const E = () => {
3608
- var D, q;
3609
- if (console.log("onNewerSuccess ,first", ce.length), (D = p.current) == null || D.scrollToIndex({
3610
- index: ce.length - 50
3611
- }), l < Mo) {
3612
- P.current.stopInterval(), console.log(
3613
- "onNewerSuccess minLineLimit",
3614
- l,
3615
- Mo
3616
- ), (q = p.current) == null || q.scrollToIndex({
3617
- index: ce.length - 1
3618
- }), P.current.startInterval("newer", f);
3619
- return;
3620
- }
3621
- }, Y = () => {
3622
- var D;
3623
- console.log("Error fetching newer logs"), P.current.stopInterval(), (D = p.current) == null || D.scrollToIndex({
3624
- index: ce.length - 10
3625
- }), P.current.startInterval("newer", f);
3626
- };
3627
- y && P.current.fetch(
3628
- "newer",
3629
- f,
3630
- E,
3631
- Y
3632
- );
3633
- }
3634
- }
3635
- )
3636
- }
3637
- );
3638
- }, Hs = Ao.create(ji), Mi = ({ id: e, onClose: t, errors: o }) => {
3639
- const { t: n } = zn(), [r, i] = Je(!1), [, s] = Wo(e), l = () => {
3640
- s(), t && t();
3641
- }, c = () => {
3642
- i(!r);
3643
- };
3644
- return /* @__PURE__ */ I.jsx(
3645
- Oo,
3646
- {
3647
- onClose: () => {
3648
- },
3649
- showClose: !1,
3650
- headerClass: "bg-gray-57 p-0! border-b border-b-dark-47! h-[90px] w-full",
3651
- className: wt(nt.realTimeLogModalStyle, {
3652
- "w-[90%]!": !r,
3653
- "w-full! h-full!": r
3654
- }),
3655
- header: /* @__PURE__ */ I.jsxs("div", { className: "flex items-center pr-[30px] w-full h-full", children: [
3656
- /* @__PURE__ */ I.jsx("div", { className: nt.modalLeft, children: /* @__PURE__ */ I.jsxs("div", { className: nt.buttonGroup, children: [
3657
- /* @__PURE__ */ I.jsx(
3658
- "div",
3659
- {
3660
- className: nt.iosIcon,
3661
- onClick: () => {
3662
- l && l(), s();
3663
- },
3664
- children: /* @__PURE__ */ I.jsx(be, { name: "close-window" })
3665
- }
3666
- ),
3667
- /* @__PURE__ */ I.jsx("div", { className: nt.iosIcon, onClick: c, children: /* @__PURE__ */ I.jsx(be, { name: "expand-window" }) })
3668
- ] }) }),
3669
- /* @__PURE__ */ I.jsx("div", { children: n("title.error_log") })
3670
- ] }),
3671
- children: /* @__PURE__ */ I.jsx(Sn, { children: o && o.length > 0 ? o.map((a) => /* @__PURE__ */ I.jsxs("div", { className: "container-fluid", children: [
3672
- /* @__PURE__ */ I.jsxs(yn, { children: [
3673
- /* @__PURE__ */ I.jsxs(fo, { children: [
3674
- /* @__PURE__ */ I.jsx("b", { children: `${n("label.created_date")}:` }),
3675
- /* @__PURE__ */ I.jsx(Pt, { date: a == null ? void 0 : a.created_date })
3676
- ] }),
3677
- /* @__PURE__ */ I.jsxs(fo, { children: [
3678
- /* @__PURE__ */ I.jsx("b", { children: `${n("label.date_updated")}:` }),
3679
- /* @__PURE__ */ I.jsx(Pt, { date: a == null ? void 0 : a.update_date })
3680
- ] })
3681
- ] }),
3682
- /* @__PURE__ */ I.jsx(mo, { className: "mt-4 mb-4" }),
3683
- /* @__PURE__ */ I.jsx("p", { className: "whitespace-pre-line", children: a == null ? void 0 : a.log_data }),
3684
- /* @__PURE__ */ I.jsx(mo, { className: "mt-4 mb-4" })
3685
- ] }, a == null ? void 0 : a.id)) : /* @__PURE__ */ I.jsx(Bn, { i18nKey: "text.not_found", values: { dataname: "Log" } }) })
3686
- }
3687
- );
3688
- }, _s = Ao.create(Mi);
3689
- export {
3690
- _s as E,
3691
- Hs as R,
3692
- bs as T,
3693
- ys as a
3694
- };