@vunk/plus 1.15.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/components/bubble-list/index.cjs +1 -1
  2. package/components/bubble-list/index.mjs +265 -133
  3. package/components/bubble-list/src/core/index.vue.d.ts +45 -14
  4. package/components/bubble-list/src/ctx.d.ts +4 -0
  5. package/components/bubble-list/src/index.vue.d.ts +23 -10
  6. package/components/components.css +1 -1
  7. package/components/drawer/src/ctx.d.ts +1 -1
  8. package/components/drawer/src/index.vue.d.ts +7 -7
  9. package/components/pixi-frame/src/apng.vue.d.ts +2 -2
  10. package/components/pixi-frame/src/bitmap-generator.vue.d.ts +18 -18
  11. package/components/pixi-frame/src/bitmap.vue.d.ts +18 -18
  12. package/components/pixi-frame/src/buffer-image.vue.d.ts +18 -18
  13. package/components/pixi-frame/src/core.vue.d.ts +2 -2
  14. package/components/pixi-frame/src/index.vue.d.ts +44 -44
  15. package/components/pixi-frame/src/video.vue.d.ts +2 -2
  16. package/components/recorder-button/src/index.vue.d.ts +2 -2
  17. package/components/scrollbar/src/index.vue.d.ts +2 -2
  18. package/components/speech-button/src/index.vue.d.ts +1 -1
  19. package/components/table-columns/src/ctx.d.ts +2 -2
  20. package/components/table-columns/src/el-ctx.d.ts +3 -3
  21. package/components/table-columns/src/index.vue.d.ts +4 -4
  22. package/components/tables-v1/src/ctx.d.ts +11 -11
  23. package/components/tables-v1/src/el-ctx.d.ts +7 -7
  24. package/components/tables-v1/src/index.vue.d.ts +12 -12
  25. package/components/tables-v1-checkbox/src/ctx.d.ts +9 -9
  26. package/components/tables-v1-checkbox/src/index.vue.d.ts +44 -44
  27. package/components/text/src/ctx.d.ts +1 -1
  28. package/components/text/src/index.vue.d.ts +6 -6
  29. package/components/thinking/src/index.vue.d.ts +2 -2
  30. package/components/vditor/src/ctx.d.ts +1 -1
  31. package/components/vditor/src/index.vue.d.ts +1 -1
  32. package/index.css +3 -1
  33. package/package.json +6 -1
  34. package/vue-virtual-scroller/index.cjs +1 -0
  35. package/vue-virtual-scroller/index.d.ts +4 -0
  36. package/vue-virtual-scroller/index.mjs +2708 -0
  37. package/vue-virtual-scroller/src/components/DynamicScroller.vue.d.ts +52 -0
  38. package/vue-virtual-scroller/src/components/DynamicScrollerItem.vue.d.ts +36 -0
  39. package/vue-virtual-scroller/src/components/ItemView.vue.d.ts +24 -0
  40. package/vue-virtual-scroller/src/components/RecycleScroller.vue.d.ts +65 -0
  41. package/vue-virtual-scroller/src/components/ResizeObserver.vue.d.ts +7 -0
  42. package/vue-virtual-scroller/src/components/WindowScroller.vue.d.ts +54 -0
  43. package/vue-virtual-scroller/src/composables/dynamicScrollerMeasureQueue.d.ts +19 -0
  44. package/vue-virtual-scroller/src/composables/dynamicScrollerMeasurement.d.ts +41 -0
  45. package/vue-virtual-scroller/src/composables/scrollerOptions.d.ts +66 -0
  46. package/vue-virtual-scroller/src/composables/useDynamicScroller.d.ts +109 -0
  47. package/vue-virtual-scroller/src/composables/useDynamicScrollerItem.d.ts +21 -0
  48. package/vue-virtual-scroller/src/composables/useIdState.d.ts +7 -0
  49. package/vue-virtual-scroller/src/composables/useRecycleScroller.d.ts +65 -0
  50. package/vue-virtual-scroller/src/composables/useTableColumnWidths.d.ts +28 -0
  51. package/vue-virtual-scroller/src/composables/useWindowScroller.d.ts +17 -0
  52. package/vue-virtual-scroller/src/config.d.ts +7 -0
  53. package/vue-virtual-scroller/src/directives/observeVisibility.d.ts +8 -0
  54. package/vue-virtual-scroller/src/engine/cache.d.ts +8 -0
  55. package/vue-virtual-scroller/src/engine/keyField.d.ts +13 -0
  56. package/vue-virtual-scroller/src/engine/scroll.d.ts +14 -0
  57. package/vue-virtual-scroller/src/index.d.ts +25 -0
  58. package/vue-virtual-scroller/src/scrollparent.d.ts +27 -0
  59. package/vue-virtual-scroller/src/typecheck/generic-components.typecheck.vue.d.ts +3 -0
  60. package/vue-virtual-scroller/src/typecheck/generic-composables.typecheck.d.ts +1 -0
  61. package/vue-virtual-scroller/src/types.d.ts +139 -0
  62. package/vue-virtual-scroller/src/utils/eventEmitter.d.ts +21 -0
  63. package/vue-virtual-scroller/src/utils/itemSize.d.ts +13 -0
  64. package/vue-virtual-scroller/src/utils/viewStyle.d.ts +29 -0
  65. package/vue-virtual-scroller/src/utils.d.ts +1 -0
  66. package/vue-virtual-scroller/vue-virtual-scroller.css +1 -0
@@ -0,0 +1,2708 @@
1
+ import { computed as E, toValue as R, watch as N, nextTick as tt, ref as Se, onMounted as Xt, onActivated as Fn, onBeforeUnmount as Lt, markRaw as ci, shallowReactive as At, reactive as Yt, provide as Mt, shallowRef as vt, watchEffect as pn, triggerRef as hn, onDeactivated as di, onUnmounted as fi, effectScope as mi, defineComponent as St, openBlock as se, createBlock as Be, resolveDynamicComponent as nt, withCtx as Ue, renderSlot as Re, createElementBlock as Qe, toRef as Zt, withDirectives as Cn, normalizeClass as xt, unref as ee, createCommentVNode as Ne, normalizeStyle as ut, Fragment as Vn, renderList as Pn, mergeProps as $t, toHandlers as vi, createVNode as On, createSlots as pi, normalizeProps as hi, guardReactiveProps as yi, inject as yn, getCurrentInstance as gi, onBeforeUpdate as Si } from "vue";
2
+ function bi(e) {
3
+ return e == null ? "null" : typeof e == "function" ? "a function" : `'${e}'`;
4
+ }
5
+ function ht(e, t, i) {
6
+ if (!i)
7
+ return t;
8
+ const n = typeof i == "function" ? i(e, t) : e?.[i];
9
+ if (n == null)
10
+ throw new Error(`Key is ${n} on item (keyField is ${bi(i)})`);
11
+ return n;
12
+ }
13
+ function Jt(e, t, i) {
14
+ if (typeof i == "function" && t == null)
15
+ throw new Error("index is required when using a function keyField");
16
+ return ht(e, t ?? 0, i);
17
+ }
18
+ function en(e, t, i) {
19
+ return ht(e, t, i);
20
+ }
21
+ function et(e, t) {
22
+ return e.map((i, n) => en(i, n, t));
23
+ }
24
+ function zi(e, t, i) {
25
+ const n = [], l = [];
26
+ for (let c = 0; c < e.length; c++) {
27
+ const p = e[c], v = en(p, c, t), m = i(p, c, v);
28
+ n.push(v), l.push(typeof m == "number" && m > 0 ? m : null);
29
+ }
30
+ return {
31
+ keys: n,
32
+ sizes: l
33
+ };
34
+ }
35
+ function wi(e, t, i) {
36
+ if (!e || e.keys.length !== t.length || e.sizes.length !== t.length)
37
+ return !1;
38
+ for (let n = 0; n < t.length; n++)
39
+ if (e.keys[n] !== en(t[n], n, i))
40
+ return !1;
41
+ return !0;
42
+ }
43
+ function Gt(e, t, i) {
44
+ if (!wi(e, t, i))
45
+ return {};
46
+ const n = {};
47
+ for (let l = 0; l < e.keys.length; l++) {
48
+ const c = e.sizes[l];
49
+ typeof c == "number" && c > 0 && (n[e.keys[l]] = c);
50
+ }
51
+ return n;
52
+ }
53
+ function Dn(e, t) {
54
+ if (!e.length || t.length <= e.length)
55
+ return 0;
56
+ const i = e[0], n = t.indexOf(i);
57
+ if (n <= 0 || n + e.length < t.length && e.length > t.length - n)
58
+ return 0;
59
+ for (let l = 0; l < e.length; l++)
60
+ if (t[n + l] !== e[l])
61
+ return 0;
62
+ return n;
63
+ }
64
+ function gn(e, t, i, n, l, c = 0) {
65
+ const p = l ?? "start";
66
+ if (p === "nearest") {
67
+ const v = i + n, m = e + t;
68
+ return e >= i && m <= v ? null : e < i ? e + c : m - n + c;
69
+ }
70
+ return p === "end" ? e + t - n + c : p === "center" ? e + (t - n) / 2 + c : e + c;
71
+ }
72
+ const Ii = /auto|scroll/;
73
+ function Bn(e, t) {
74
+ return e.parentNode === null ? t : Bn(e.parentNode, [...t, e]);
75
+ }
76
+ function qt(e, t) {
77
+ return getComputedStyle(e, null).getPropertyValue(t);
78
+ }
79
+ function _i(e) {
80
+ return qt(e, "overflow") + qt(e, "overflow-y") + qt(e, "overflow-x");
81
+ }
82
+ function Mi(e) {
83
+ return Ii.test(_i(e));
84
+ }
85
+ function xi(e) {
86
+ if (!(e instanceof HTMLElement || e instanceof SVGElement))
87
+ return;
88
+ if (e.parentNode === null)
89
+ return document.scrollingElement || document.documentElement;
90
+ const t = Bn(e.parentNode, []);
91
+ for (let i = 0; i < t.length; i += 1)
92
+ if (t[i] instanceof Element && Mi(t[i]))
93
+ return t[i];
94
+ return document.scrollingElement || document.documentElement;
95
+ }
96
+ function An(e, t) {
97
+ if (t)
98
+ return t;
99
+ if (!e)
100
+ return;
101
+ const i = xi(e);
102
+ if (i)
103
+ return typeof window < "u" && window.document && (i === window.document.documentElement || i === window.document.body) ? window : i;
104
+ }
105
+ function Ti() {
106
+ const e = /* @__PURE__ */ new Map();
107
+ return {
108
+ on(t, i) {
109
+ let n = e.get(t);
110
+ n || (n = /* @__PURE__ */ new Set(), e.set(t, n)), n.add(i);
111
+ },
112
+ off(t, i) {
113
+ const n = e.get(t);
114
+ n && (n.delete(i), n.size || e.delete(t));
115
+ },
116
+ emit(t, i) {
117
+ const n = e.get(t);
118
+ if (n?.size)
119
+ for (const l of [...n])
120
+ l(i);
121
+ },
122
+ clear() {
123
+ e.clear();
124
+ }
125
+ };
126
+ }
127
+ function yt(e) {
128
+ return e.flowMode && e.direction === "vertical" && !e.gridItems ? "flow" : e.disableTransform ? "position" : "transform";
129
+ }
130
+ function tn(e, t) {
131
+ const i = t.direction === "vertical", n = t.mode ?? "transform", l = {
132
+ visibility: e.nr.used ? "visible" : "hidden",
133
+ pointerEvents: e.nr.used ? void 0 : "none"
134
+ };
135
+ if (n === "flow" ? l.display = e.nr.used ? void 0 : "none" : (l.position = "absolute", l.top = "0px", l.left = "0px", l.display = void 0), n === "position" ? (l[i ? "top" : "left"] = `${e.position}px`, l[i ? "left" : "top"] = `${e.offset}px`, l.transform = "none", l.willChange = "unset") : n === "transform" && (l.transform = i ? `translateY(${e.position}px) translateX(${e.offset}px)` : `translateX(${e.position}px) translateY(${e.offset}px)`, l.willChange = "transform"), t.gridItems && t.itemSize != null) {
136
+ const c = t.itemSecondarySize || t.itemSize;
137
+ l.width = `${i ? c : t.itemSize}px`, l.height = `${i ? t.itemSize : c}px`;
138
+ }
139
+ return l;
140
+ }
141
+ const ki = "[vue-virtual-scroller] `sizeDependencies` is deprecated and will be removed in the next major release. Dynamic item sizing uses ResizeObserver in modern browsers.";
142
+ let Sn = !1;
143
+ function bn(e) {
144
+ e == null || Sn || (Sn = !0, console.warn(ki));
145
+ }
146
+ function $n(e, t, i, n) {
147
+ let l = null, c = null, p = null, v = !1, m = null;
148
+ const g = [], T = i.resizeObserver ? () => {
149
+ } : i.onVscrollUpdate(B), z = E(() => {
150
+ const f = R(e);
151
+ if (i.vscrollData.simpleArray) {
152
+ if (f.index == null)
153
+ throw new Error("index is required when using simple-array mode with dynamic item measurement");
154
+ return f.index;
155
+ }
156
+ return Jt(f.item, f.index, i.vscrollData.keyField);
157
+ }), w = E(() => i.vscrollData.sizes[z.value] || 0), k = E(() => R(e).active && i.vscrollData.active);
158
+ function I() {
159
+ k.value ? c !== z.value && (c = z.value, l = null, p = null, ve(z.value)) : l = z.value;
160
+ }
161
+ function C() {
162
+ R(e).watchData && !i.resizeObserver ? m = N(() => R(e).item, () => {
163
+ P();
164
+ }, {
165
+ deep: !0
166
+ }) : m && (m(), m = null);
167
+ }
168
+ function B({ force: f }) {
169
+ !k.value && f && (p = z.value), (l === z.value || f || !w.value) && I();
170
+ }
171
+ function P() {
172
+ I();
173
+ }
174
+ function q(f) {
175
+ i.undefinedMap[f] && i.undefinedSizeCount.value--, i.undefinedMap[f] = void 0;
176
+ }
177
+ function te(f, O) {
178
+ if (i.vscrollData.sizes[f]) {
179
+ q(f);
180
+ return;
181
+ }
182
+ if (O) {
183
+ i.undefinedMap[f] || i.undefinedSizeCount.value++, i.undefinedMap[f] = !0;
184
+ return;
185
+ }
186
+ i.undefinedMap[f] && (i.undefinedSizeCount.value--, i.undefinedMap[f] = !1);
187
+ }
188
+ function ve(f) {
189
+ i.measureQueue.schedule(f, {
190
+ read() {
191
+ if (z.value !== f)
192
+ return null;
193
+ const O = R(t);
194
+ return O ? {
195
+ width: O.offsetWidth,
196
+ height: O.offsetHeight
197
+ } : null;
198
+ },
199
+ write(O) {
200
+ const { width: J, height: ne } = O;
201
+ S(J, ne);
202
+ },
203
+ done() {
204
+ c = null;
205
+ }
206
+ });
207
+ }
208
+ function S(f, O) {
209
+ const J = ~~(i.direction.value === "vertical" ? O : f);
210
+ J && w.value !== J && K(J);
211
+ }
212
+ function K(f) {
213
+ q(z.value), i.vscrollData.sizes[z.value] = f, R(e).emitResize && R(n)?.onResize?.(z.value);
214
+ }
215
+ function le() {
216
+ if (!i.resizeObserver || v)
217
+ return;
218
+ const f = R(t);
219
+ f && (i.resizeObserver.observe(f), f.$_vs_id = z.value, f.$_vs_onResize = Ce, v = !0);
220
+ }
221
+ function _e() {
222
+ if (!i.resizeObserver || !v)
223
+ return;
224
+ const f = R(t);
225
+ f && (i.resizeObserver.unobserve(f), f.$_vs_onResize = void 0, v = !1);
226
+ }
227
+ function Ce(f, O, J) {
228
+ z.value === f && S(O, J);
229
+ }
230
+ bn(R(e).sizeDependencies), g.push(N(() => R(e).watchData, () => {
231
+ C();
232
+ })), g.push(N(() => R(e).sizeDependencies, (f) => {
233
+ bn(f), i.resizeObserver || P();
234
+ }, {
235
+ deep: !0
236
+ })), g.push(N(z, (f, O) => {
237
+ const J = R(t);
238
+ J && (J.$_vs_id = f), q(O), te(f, k.value);
239
+ const ne = i.vscrollData.sizes[f];
240
+ if (!ne) {
241
+ l = f, P();
242
+ return;
243
+ }
244
+ q(f), v && (i.vscrollData.sizes[f] = ne);
245
+ })), g.push(N(k, (f) => {
246
+ te(z.value, f), i.resizeObserver ? f ? le() : _e() : f && p === z.value && I();
247
+ })), C();
248
+ function A() {
249
+ k.value && (I(), le());
250
+ }
251
+ function Y() {
252
+ i.measureQueue.cancel(z.value), T(), _e(), q(z.value);
253
+ const f = R(t);
254
+ f && (f.$_vs_id = void 0, f.$_vs_onResize = void 0), m && (m(), m = null);
255
+ for (const O of g)
256
+ O();
257
+ g.length = 0;
258
+ }
259
+ return {
260
+ id: z,
261
+ size: w,
262
+ finalActive: k,
263
+ updateSize: I,
264
+ mount: A,
265
+ unmount: Y
266
+ };
267
+ }
268
+ function Ri(e = {}) {
269
+ const t = e.queueFlush ?? ((T) => tt(T)), i = e.overflowQueueFlush ?? t, n = Math.max(1, e.maxTasksPerFlush ?? Number.POSITIVE_INFINITY);
270
+ let l = !1;
271
+ const c = /* @__PURE__ */ new Map();
272
+ function p() {
273
+ l || !c.size || (l = !0, t(v));
274
+ }
275
+ function v() {
276
+ if (l = !1, !c.size)
277
+ return;
278
+ const T = [];
279
+ for (const [w, k] of c)
280
+ if (T.push(k), c.delete(w), T.length >= n)
281
+ break;
282
+ const z = T.map((w) => ({
283
+ task: w,
284
+ value: w.read()
285
+ }));
286
+ for (const w of z)
287
+ w.value != null && w.task.write(w.value), w.task.done();
288
+ c.size && (i(v), l = !0);
289
+ }
290
+ function m(T, z) {
291
+ c.set(T, z), p();
292
+ }
293
+ function g(T) {
294
+ c.delete(T);
295
+ }
296
+ return {
297
+ schedule: m,
298
+ cancel: g
299
+ };
300
+ }
301
+ function nn(e) {
302
+ return E(() => R(e));
303
+ }
304
+ function Ei(e, t, i, n, l) {
305
+ const c = nn(e);
306
+ return {
307
+ el: E(() => {
308
+ const p = c.value.el;
309
+ return R(t ?? p);
310
+ }),
311
+ before: E(() => {
312
+ const p = c.value.before;
313
+ return R(i ?? p);
314
+ }),
315
+ after: E(() => {
316
+ const p = c.value.after;
317
+ return R(n ?? p);
318
+ }),
319
+ scrollParent: E(() => {
320
+ const p = c.value.scrollParent;
321
+ return R(p);
322
+ }),
323
+ callbacks: {
324
+ onResize: () => (l?.onResize ?? c.value.onResize)?.(),
325
+ onVisible: () => (l?.onVisible ?? c.value.onVisible)?.(),
326
+ onHidden: () => (l?.onHidden ?? c.value.onHidden)?.(),
327
+ onUpdate: (p, v, m, g) => (l?.onUpdate ?? c.value.onUpdate)?.(p, v, m, g)
328
+ }
329
+ };
330
+ }
331
+ const Fi = {
332
+ itemsLimit: 1e3
333
+ };
334
+ function Ln(e) {
335
+ return typeof window < "u" && e === window;
336
+ }
337
+ const Ci = (() => {
338
+ if (typeof document > "u")
339
+ return "negative";
340
+ const e = document.createElement("div"), t = document.createElement("div");
341
+ e.style.width = "4px", e.style.height = "1px", e.style.overflow = "auto", e.style.direction = "rtl", t.style.width = "8px", t.style.height = "1px", e.appendChild(t), document.body.appendChild(e), e.scrollLeft = -1;
342
+ const i = e.scrollLeft < 0;
343
+ return document.body.removeChild(e), i ? "negative" : "default";
344
+ })();
345
+ function pt(e, t, i) {
346
+ return t !== "horizontal" || !i || Ln(i) || getComputedStyle(i).direction !== "rtl" ? e : Ci === "negative" ? -e : e;
347
+ }
348
+ function Vi(e, t, i) {
349
+ return pt(e, t, i);
350
+ }
351
+ function Kt(e, t, i, n) {
352
+ const l = Vi(i, t, e), c = !!n?.smooth;
353
+ if (Ln(e)) {
354
+ t === "vertical" ? e.scrollTo({
355
+ top: l,
356
+ behavior: c ? "smooth" : "auto"
357
+ }) : e.scrollTo({
358
+ left: l,
359
+ behavior: c ? "smooth" : "auto"
360
+ });
361
+ return;
362
+ }
363
+ if (typeof e.scrollTo == "function") {
364
+ e.scrollTo(t === "vertical" ? { top: l, behavior: c ? "smooth" : "auto" } : { left: l, behavior: c ? "smooth" : "auto" });
365
+ return;
366
+ }
367
+ t === "vertical" ? e.scrollTop = l : e.scrollLeft = l;
368
+ }
369
+ function Pi(e, t, i, n) {
370
+ if (i) {
371
+ if (n && n !== window) {
372
+ const l = n;
373
+ return t === "vertical" ? l.clientHeight : l.clientWidth;
374
+ }
375
+ return t === "vertical" ? window.innerHeight : window.innerWidth;
376
+ }
377
+ return t === "vertical" ? e.clientHeight : e.clientWidth;
378
+ }
379
+ let Qt = !1;
380
+ function Oi() {
381
+ return Qt;
382
+ }
383
+ if (typeof window < "u") {
384
+ Qt = !1;
385
+ try {
386
+ const e = Object.defineProperty({}, "passive", {
387
+ get() {
388
+ Qt = !0;
389
+ }
390
+ });
391
+ window.addEventListener("test", null, e);
392
+ } catch {
393
+ }
394
+ }
395
+ function He(e) {
396
+ return typeof e == "number" ? e : null;
397
+ }
398
+ function Di(e, t, i, n, l) {
399
+ return typeof i == "number" ? i : typeof i == "function" ? i(e, t) || n || void 0 : n || e?.[l ?? "size"] || void 0;
400
+ }
401
+ function Bi(e, t, i, n, l, c) {
402
+ return typeof i == "function" ? i(e, t) || n || Number(l) || 0 : n || e?.[c ?? "size"] || Number(l) || 0;
403
+ }
404
+ let Ai = 0;
405
+ const $i = [];
406
+ function Li(e) {
407
+ for (let t = 0; t < e.length; t++)
408
+ e[t];
409
+ }
410
+ function Wi(e, t) {
411
+ return e && typeof e == "object" ? e[t] : void 0;
412
+ }
413
+ function Bt(e, t) {
414
+ return e.map((i) => Wi(i, t));
415
+ }
416
+ function Hi(e, t, i, n) {
417
+ if (e.length !== i.length || t.length !== n.length)
418
+ return !1;
419
+ for (let l = 0; l < e.length; l++)
420
+ if (e[l] !== i[l] || t[l] !== n[l])
421
+ return !1;
422
+ return !0;
423
+ }
424
+ function Ni(e) {
425
+ const t = e;
426
+ t._vs_styleStamp++;
427
+ }
428
+ function zn(e) {
429
+ const t = e;
430
+ t._vs_visibilityStamp++, t._vs_styleStamp++;
431
+ }
432
+ function Ui(e, t, i, n) {
433
+ if (i) {
434
+ for (const l of i)
435
+ n(l);
436
+ return;
437
+ }
438
+ for (let l = e; l < t; l++)
439
+ n(l);
440
+ }
441
+ const wn = 8, In = 1;
442
+ function rn(e, t, i, n, l, c) {
443
+ const p = nn(e), v = Ei(p, t, i, n, l), m = E(() => {
444
+ const r = R(F().items);
445
+ return Li(r), r;
446
+ }), g = Se([]), T = Se(0), z = Se(0), w = Se(0), k = Se(!1);
447
+ let I = 0, C = 0, B = 0, P = 0, q = !1, te = null;
448
+ const ve = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
449
+ let K = !1, le = 0, _e = 0, Ce = !1, A = null, Y = null, f = null, O = 0, J = null, ne = null, je = [], pe = [], Me = null, ie = null, xe = null, Ie = !1, G = !1, Pe = !1;
450
+ const ae = /* @__PURE__ */ new Set(), Oe = Se({}), ct = [], Tt = {
451
+ accumulator: 0
452
+ };
453
+ function F() {
454
+ return p.value;
455
+ }
456
+ function Ae() {
457
+ return c?.pageMode ?? F().pageMode;
458
+ }
459
+ const $ = E(() => R(F().enabled ?? !0)), it = E(() => An(
460
+ v.el.value,
461
+ v.scrollParent.value
462
+ )), $e = E(() => {
463
+ const r = m.value;
464
+ return r.length > 0 && typeof r[0] != "object";
465
+ }), rt = E(() => {
466
+ const r = F();
467
+ if (He(r.itemSize) === null) {
468
+ const a = m.value, d = Array.from({ length: a.length });
469
+ Tt.accumulator = 0, d[-1] = Tt;
470
+ const h = r.minItemSize, x = Oe.value, L = $e.value;
471
+ let D = 1e4, U = 0, oe;
472
+ for (let _ = 0, Q = a.length; _ < Q; _++) {
473
+ const ce = L ? _ : ht(a[_], _, r.keyField);
474
+ oe = Bi(
475
+ a[_],
476
+ _,
477
+ r.itemSize,
478
+ x[ce],
479
+ h,
480
+ r.sizeField
481
+ ), oe < D && (D = oe), U += oe;
482
+ const re = ct[_] ?? (ct[_] = {
483
+ accumulator: 0,
484
+ size: void 0
485
+ });
486
+ re.accumulator = U, re.size = oe, d[_] = re;
487
+ }
488
+ return ct.length = a.length, O = D, d;
489
+ }
490
+ return $i;
491
+ }), kt = E(
492
+ () => g.value.filter((r) => (r._vs_visibilityStamp, r.nr.used)).sort((r, o) => r.nr.index - o.nr.index)
493
+ ), bt = E(() => {
494
+ const r = F(), o = $e.value ? null : r.keyField;
495
+ return zi(m.value, o, (a, d, h) => Di(
496
+ a,
497
+ d,
498
+ r.itemSize,
499
+ Oe.value[h],
500
+ r.sizeField
501
+ ));
502
+ });
503
+ function De(r = F()) {
504
+ return r.direction ?? "vertical";
505
+ }
506
+ function Xe(r = F()) {
507
+ const o = De(r);
508
+ let a = r.flowMode ?? !1;
509
+ return a && o !== "vertical" && (G || (console.warn("[vue-recycle-scroller] flowMode only supports vertical lists. Falling back to standard positioning."), G = !0), a = !1), a && r.gridItems && (Pe || (console.warn("[vue-recycle-scroller] flowMode does not support gridItems. Falling back to standard positioning."), Pe = !0), a = !1), yt({
510
+ direction: o,
511
+ disableTransform: r.disableTransform ?? !1,
512
+ flowMode: a,
513
+ gridItems: r.gridItems
514
+ });
515
+ }
516
+ function qe() {
517
+ g.value.sort((r, o) => r.nr.used !== o.nr.used ? r.nr.used ? -1 : 1 : r.nr.used && o.nr.used ? r.nr.index - o.nr.index : r.nr.id - o.nr.id);
518
+ }
519
+ function zt(r) {
520
+ const o = F();
521
+ return Oe.value = Gt(r, m.value, $e.value ? null : o.keyField), Object.keys(Oe.value).length > 0;
522
+ }
523
+ function wt(r) {
524
+ let o = S.get(r);
525
+ return o || (o = [], S.set(r, o)), o;
526
+ }
527
+ function Wt(r, o, a, d, h) {
528
+ const x = ci({
529
+ id: Ai++,
530
+ index: o,
531
+ used: !0,
532
+ key: d,
533
+ type: h
534
+ }), L = At({
535
+ item: a,
536
+ position: 0,
537
+ offset: 0,
538
+ nr: x,
539
+ _vs_styleStamp: 0,
540
+ _vs_visibilityStamp: 0
541
+ });
542
+ return r.push(L), L;
543
+ }
544
+ function Ht(r) {
545
+ const o = wt(r);
546
+ if (o && o.length) {
547
+ const a = o.pop();
548
+ return a.nr.used = !0, zn(a), a;
549
+ }
550
+ }
551
+ function Ze(r, o) {
552
+ const a = g.value, d = a.indexOf(r);
553
+ if (d === -1)
554
+ return;
555
+ const h = Math.max(0, Math.min(o, a.length - 1));
556
+ d !== h && (a.splice(d, 1), a.splice(h, 0, r));
557
+ }
558
+ function s(r) {
559
+ Ze(r, g.value.length - 1);
560
+ }
561
+ function u() {
562
+ const r = g.value;
563
+ let o = 0;
564
+ for (; o < r.length && !r[o].nr.used; )
565
+ o++;
566
+ let a = 0;
567
+ for (let d = o; d < r.length && r[d].nr.used; d++)
568
+ a++;
569
+ return {
570
+ activeStart: o,
571
+ activeCount: a,
572
+ headInsertCount: 0
573
+ };
574
+ }
575
+ function y(r, o, a) {
576
+ let d = null;
577
+ o < I ? (d = a.activeStart + a.headInsertCount, a.headInsertCount++, a.activeCount++) : o >= C && (d = a.activeStart + a.activeCount, a.activeCount++), d != null && Ze(r, d);
578
+ }
579
+ function b(r, o = !1) {
580
+ const a = r.nr.type;
581
+ wt(a).push(r), r.nr.used = !1, r.position = F().hiddenPosition ?? -999999, zn(r), ve.delete(r.nr.key), o && s(r);
582
+ }
583
+ function M() {
584
+ ve.clear(), S.clear();
585
+ for (let r = 0, o = g.value.length; r < o; r++) {
586
+ const a = g.value[r];
587
+ a && b(a);
588
+ }
589
+ }
590
+ function V(r) {
591
+ let o = -1;
592
+ return o = requestAnimationFrame(() => {
593
+ ae.delete(o), r();
594
+ }), ae.add(o), o;
595
+ }
596
+ function H() {
597
+ for (const r of ae)
598
+ cancelAnimationFrame(r);
599
+ ae.clear();
600
+ }
601
+ function ye() {
602
+ A && (clearTimeout(A), A = null), Y && (clearTimeout(Y), Y = null), f && (clearTimeout(f), f = null), ie && (clearTimeout(ie), ie = null), xe && (clearTimeout(xe), xe = null);
603
+ }
604
+ function ue() {
605
+ $.value && (v.callbacks.onResize?.(), k.value && he(!1));
606
+ }
607
+ function Te() {
608
+ if (!$.value)
609
+ return;
610
+ Me && !Ie && lt();
611
+ const r = F();
612
+ if (!K) {
613
+ if (K = !0, A)
614
+ return;
615
+ const o = () => V(() => {
616
+ K = !1;
617
+ const { continuous: a } = he(!1, !0);
618
+ a || (Y && clearTimeout(Y), Y = setTimeout(Te, r.updateInterval + 100));
619
+ });
620
+ o(), r.updateInterval && (A = setTimeout(() => {
621
+ A = null, K && o();
622
+ }, r.updateInterval));
623
+ }
624
+ }
625
+ function Ve(r, o) {
626
+ $.value && k.value && (r || o.boundingClientRect.width !== 0 || o.boundingClientRect.height !== 0 ? (v.callbacks.onVisible?.(), V(() => {
627
+ he(!1);
628
+ })) : v.callbacks.onHidden?.());
629
+ }
630
+ function Le() {
631
+ return it.value ?? window;
632
+ }
633
+ function Ee() {
634
+ const r = v.before.value;
635
+ if (!r)
636
+ return 0;
637
+ const o = F();
638
+ return De(o) === "vertical" ? r.scrollHeight : r.scrollWidth;
639
+ }
640
+ function be() {
641
+ const r = v.el.value;
642
+ if (!r)
643
+ return { start: 0, end: 0 };
644
+ const o = F(), a = De(o), d = a === "vertical";
645
+ let h;
646
+ if (Ae()) {
647
+ const x = r.getBoundingClientRect(), L = d ? x.height : x.width, D = it.value, U = !D || D === window, oe = U ? 0 : D.getBoundingClientRect().top, _ = U ? 0 : D.getBoundingClientRect().left, Q = U ? window.innerHeight : D.clientHeight, ce = U ? window.innerWidth : D.clientWidth;
648
+ let re = d ? -(x.top - oe) : -(x.left - _), ze = d ? Q : ce;
649
+ re < 0 && (ze += re, re = 0), re + ze > L && (ze = L - re), h = {
650
+ start: re,
651
+ end: re + ze
652
+ };
653
+ } else d ? h = {
654
+ start: r.scrollTop,
655
+ end: r.scrollTop + r.clientHeight
656
+ } : h = {
657
+ start: pt(r.scrollLeft, a, r),
658
+ end: pt(r.scrollLeft, a, r) + r.clientWidth
659
+ };
660
+ return h;
661
+ }
662
+ function Qn() {
663
+ const r = v.el.value;
664
+ if (!r)
665
+ return { start: 0, end: 0 };
666
+ const o = F();
667
+ if (De(o) === "vertical") {
668
+ const a = pt(r.scrollLeft, "horizontal", r);
669
+ return {
670
+ start: a,
671
+ end: a + r.clientWidth
672
+ };
673
+ }
674
+ return {
675
+ start: r.scrollTop,
676
+ end: r.scrollTop + r.clientHeight
677
+ };
678
+ }
679
+ function Xn(r, o, a, d) {
680
+ const h = Ee(), x = r.start - d - h, L = r.end + d - h;
681
+ if (I > 0) {
682
+ const D = a[I - 1]?.accumulator ?? 0;
683
+ if (x <= D)
684
+ return !0;
685
+ }
686
+ if (I < o - 1) {
687
+ const D = a[I]?.accumulator ?? Number.POSITIVE_INFINITY;
688
+ if (x > D)
689
+ return !0;
690
+ }
691
+ if (C > 1) {
692
+ const D = a[C - 2]?.accumulator ?? 0;
693
+ if (L <= D)
694
+ return !0;
695
+ }
696
+ if (C < o) {
697
+ const D = a[C - 1]?.accumulator ?? Number.POSITIVE_INFINITY;
698
+ if (L > D)
699
+ return !0;
700
+ }
701
+ return !1;
702
+ }
703
+ function Rt(r) {
704
+ const o = F(), a = He(o.itemSize);
705
+ return a !== null ? a : rt.value[r]?.size || Number(o.minItemSize) || 0;
706
+ }
707
+ function Zn(r) {
708
+ const o = F();
709
+ return tn(r, {
710
+ direction: De(o),
711
+ mode: Xe(o),
712
+ itemSize: He(o.itemSize),
713
+ gridItems: o.gridItems,
714
+ itemSecondarySize: o.itemSecondarySize
715
+ });
716
+ }
717
+ function Ke(r) {
718
+ const o = F(), a = o.gridItems || 1, d = He(o.itemSize);
719
+ return r <= 0 ? 0 : d !== null ? Math.floor(r / a) * d : rt.value[r - 1]?.accumulator || 0;
720
+ }
721
+ function on(r) {
722
+ const o = F(), a = m.value.length, d = o.gridItems || 1, h = He(o.itemSize);
723
+ if (!a)
724
+ return 0;
725
+ if (h !== null) {
726
+ const U = Math.floor(r / h) * d;
727
+ return Math.min(Math.max(U, 0), a - 1);
728
+ }
729
+ let x = 0, L = a - 1, D = 0;
730
+ for (; x <= L; ) {
731
+ const U = Math.floor((x + L) / 2);
732
+ Ke(U) <= r ? (D = U, x = U + 1) : L = U - 1;
733
+ }
734
+ return D;
735
+ }
736
+ function lt() {
737
+ ie && (clearTimeout(ie), ie = null), Me = null;
738
+ }
739
+ function Jn() {
740
+ ie && clearTimeout(ie), ie = setTimeout(() => {
741
+ Me = null, ie = null;
742
+ }, 150);
743
+ }
744
+ function ei(r, o) {
745
+ if (!r.length) {
746
+ lt();
747
+ return;
748
+ }
749
+ const a = Math.max(be().start - Ee(), 0), d = Math.min(on(a), r.length - 1), h = r[d], x = o ? ht(h, d, o) : d, L = Ee() + Ke(d);
750
+ Me = {
751
+ key: x,
752
+ offset: be().start - L
753
+ };
754
+ }
755
+ function sn(r) {
756
+ if (!Me)
757
+ return !1;
758
+ const o = F(), a = r ?? m.value, d = $e.value ? null : o.keyField, x = et(a, d).indexOf(Me.key);
759
+ if (x === -1)
760
+ return lt(), !1;
761
+ const L = Ee() + Ke(x) + Me.offset, D = be().start;
762
+ return Math.abs(L - D) < 0.5 ? !1 : (Ie = !0, Et(L), V(() => {
763
+ Ie = !1;
764
+ }), !0);
765
+ }
766
+ function It() {
767
+ if (dt(), !$.value)
768
+ return;
769
+ const r = Ae() ? Le() : v.el.value;
770
+ r && (J = r, J.addEventListener("scroll", Te, Oi() ? { passive: !0 } : !1), Ae() && r === window && (ne = r, ne.addEventListener("resize", ue)));
771
+ }
772
+ function dt() {
773
+ J && (J.removeEventListener("scroll", Te), J = null), ne && (ne.removeEventListener("resize", ue), ne = null);
774
+ }
775
+ function ti(r, o, a, d, h, x) {
776
+ const L = Math.ceil(r / o) * a, D = Math.max(0, Math.floor(h.start / a)), U = Math.min(Math.ceil(h.end / a), Math.ceil(r / o)), oe = Math.max(0, Math.floor(x.start / d)), _ = Math.min(Math.ceil(x.end / d), o), Q = [];
777
+ for (let ze = D; ze < U; ze++) {
778
+ const ft = ze * o;
779
+ for (let X = oe; X < _; X++) {
780
+ const W = ft + X;
781
+ if (W >= r)
782
+ break;
783
+ Q.push(W);
784
+ }
785
+ }
786
+ const ce = Q[0] ?? 0, re = Q.at(-1) ?? -1;
787
+ return {
788
+ renderedIndices: Q,
789
+ startIndex: ce,
790
+ endIndex: re + 1,
791
+ visibleStartIndex: ce,
792
+ visibleEndIndex: re,
793
+ totalSize: L
794
+ };
795
+ }
796
+ function ni() {
797
+ const r = F(), o = He(r.itemSize);
798
+ if (!r.gridItems || o == null)
799
+ return !1;
800
+ const a = v.el.value;
801
+ if (!a)
802
+ return !1;
803
+ const d = r.itemSecondarySize || o, h = De(r) === "vertical" ? a.clientWidth : a.clientHeight;
804
+ return d * r.gridItems > h;
805
+ }
806
+ function an(r, o, a, d) {
807
+ if (Math.abs(r - o) !== 1 || o < 0 || o >= a)
808
+ return r;
809
+ const h = r > o ? Ke(o) + Rt(o) : Ke(o);
810
+ return Math.abs(h - d) <= wn ? o : r;
811
+ }
812
+ function un(r, o, a, d, h) {
813
+ if (Math.abs(r - o) !== 1)
814
+ return r;
815
+ const x = h ? o - 1 : o;
816
+ if (x < 0 || x >= a)
817
+ return r;
818
+ const L = r > o ? Ke(x) + Rt(x) : Ke(x);
819
+ return Math.abs(L - d) <= wn ? o : r;
820
+ }
821
+ function ii(r, o, a) {
822
+ const d = {
823
+ ...r,
824
+ visibleStartIndex: an(r.visibleStartIndex, B, o, a.rawViewportStart),
825
+ visibleEndIndex: un(r.visibleEndIndex, P, o, a.rawViewportEnd, !1),
826
+ startIndex: an(r.startIndex, I, o, a.renderStart),
827
+ endIndex: un(r.endIndex, C, o, a.renderEnd, !0)
828
+ };
829
+ d.startIndex > d.visibleStartIndex && (d.startIndex = d.visibleStartIndex);
830
+ const h = Math.min(o, d.visibleEndIndex + 1);
831
+ return d.endIndex < h && (d.endIndex = h), d.endIndex < d.startIndex && (d.endIndex = d.startIndex), d;
832
+ }
833
+ function he(r, o = !1) {
834
+ if (!$.value)
835
+ return { continuous: !0 };
836
+ const a = F(), d = He(a.itemSize), h = a.gridItems || 1, x = a.itemSecondarySize || d || 0, L = O, D = a.typeField, U = $e.value ? null : a.keyField, oe = m.value, _ = oe.length, Q = rt.value, ce = ve, re = g.value;
837
+ let ze = null, ft = null, X, W, Fe, de, fe;
838
+ const si = d !== null || _ === 0 || Q[_ - 1] != null;
839
+ if (!_ || !si)
840
+ !_ || !te ? X = W = de = fe = Fe = 0 : (X = Math.min(te.startIndex, _), W = Math.min(te.endIndex, _), de = Math.min(te.visibleStartIndex, _), fe = Math.min(te.visibleEndIndex, _), Fe = Q[_ - 1]?.accumulator ?? te.totalSizeValue);
841
+ else if (Ce)
842
+ X = de = 0, W = fe = Math.min(a.prerender, oe.length), Fe = 0;
843
+ else {
844
+ const Z = be(), we = Qn(), Ye = le, Ge = _e, ge = { ...Z }, _t = { ...we };
845
+ if (o) {
846
+ let me = Z.start - Ye;
847
+ me < 0 && (me = -me);
848
+ let at = we.start - Ge;
849
+ at < 0 && (at = -at);
850
+ const Pt = d === null && Xn(Z, _, Q, a.buffer), ke = d === null && (me >= L || Pt) || d !== null && me >= d, Ot = h > 1 && d != null && at >= x;
851
+ if (!ke && !Ot)
852
+ return {
853
+ continuous: !0
854
+ };
855
+ }
856
+ le = Z.start, _e = we.start;
857
+ const mt = a.buffer;
858
+ ge.start -= mt, ge.end += mt, _t.start -= mt, _t.end += mt;
859
+ let We = 0;
860
+ const mn = v.before.value;
861
+ mn && (We = mn.scrollHeight, ge.start -= We);
862
+ const vn = v.after.value;
863
+ if (vn) {
864
+ const me = vn.scrollHeight;
865
+ ge.end += me;
866
+ }
867
+ const ui = Xe(a) === "flow" && d === null && !o && q && Math.abs(Z.start - Ye) <= In && Math.abs(we.start - Ge) <= In;
868
+ if (d === null) {
869
+ let me, at = 0, Pt = _ - 1, ke = ~~(_ / 2), Ot;
870
+ do
871
+ Ot = ke, me = Q[ke]?.accumulator ?? 0, me < ge.start ? at = ke : ke < _ - 1 && (Q[ke + 1]?.accumulator ?? Number.POSITIVE_INFINITY) > ge.start && (Pt = ke), ke = ~~((at + Pt) / 2);
872
+ while (ke !== Ot);
873
+ for (ke < 0 && (ke = 0), X = ke, Fe = Q[_ - 1]?.accumulator ?? 0, W = ke; W < _ && (Q[W]?.accumulator ?? 0) < ge.end; W++) ;
874
+ for (W === -1 ? W = oe.length - 1 : (W++, W > _ && (W = _)), de = X; de < _ && We + (Q[de]?.accumulator ?? Number.POSITIVE_INFINITY) < ge.start; de++) ;
875
+ for (fe = de; fe < _ && We + (Q[fe]?.accumulator ?? 0) < ge.end; fe++) ;
876
+ if (ui) {
877
+ const Dt = ii({
878
+ startIndex: X,
879
+ endIndex: W,
880
+ visibleStartIndex: de,
881
+ visibleEndIndex: fe
882
+ }, _, {
883
+ rawViewportStart: Z.start - We,
884
+ rawViewportEnd: Z.end - We,
885
+ renderStart: Z.start - mt - We,
886
+ renderEnd: Z.end + mt - We
887
+ });
888
+ X = Dt.startIndex, W = Dt.endIndex, de = Dt.visibleStartIndex, fe = Dt.visibleEndIndex;
889
+ }
890
+ te = {
891
+ startIndex: X,
892
+ endIndex: W,
893
+ visibleStartIndex: de,
894
+ visibleEndIndex: fe,
895
+ totalSizeValue: Fe
896
+ };
897
+ } else if (h > 1) {
898
+ const me = ti(
899
+ _,
900
+ h,
901
+ d,
902
+ x,
903
+ ge,
904
+ _t
905
+ );
906
+ ze = me.renderedIndices, ft = new Set(ze), X = me.startIndex, W = me.endIndex, de = me.visibleStartIndex, fe = me.visibleEndIndex, Fe = me.totalSize;
907
+ } else {
908
+ X = ~~(ge.start / d * h);
909
+ const me = X % h;
910
+ X -= me, W = Math.ceil(ge.end / d * h), de = Math.max(0, Math.floor((ge.start - We) / d * h)), fe = Math.floor((ge.end - We) / d * h), X < 0 && (X = 0), W > _ && (W = _), de < 0 && (de = 0), fe > _ && (fe = _), Fe = Math.ceil(_ / h) * d;
911
+ }
912
+ }
913
+ const ai = typeof a.itemsLimit == "number" && a.itemsLimit > 0 ? a.itemsLimit : Fi.itemsLimit;
914
+ (ze?.length ?? W - X) > ai && ri(), T.value = Fe, z.value = 0, w.value = Xe(a) === "flow" ? Fe : 0;
915
+ let j;
916
+ const Nt = X <= C && W >= I, dn = Xe(a) === "flow", Ut = dn && Nt && !r;
917
+ let jt = null;
918
+ if (!Nt || r)
919
+ M();
920
+ else {
921
+ const Z = (we) => {
922
+ const Ye = re[we];
923
+ Ye && (j = Ye, j.nr.used && ((ft ? ft.has(j.nr.index) : j.nr.index >= X && j.nr.index < W) || b(j, Ut)));
924
+ };
925
+ if (Ut) {
926
+ for (let we = re.length - 1; we >= 0; we--)
927
+ Z(we);
928
+ jt = u();
929
+ } else
930
+ for (let we = 0, Ye = re.length; we < Ye; we++)
931
+ Z(we);
932
+ }
933
+ let st, Ct, Vt = null, fn = 0;
934
+ return Ui(X, W, ze, (Z) => {
935
+ const we = Q[Z] && Q[Z].size, Ye = d || we || O || 1;
936
+ st = oe[Z];
937
+ const Ge = U ? ht(st, Z, U) : Z;
938
+ j = ce.get(Ge);
939
+ let ge = !1;
940
+ if (j)
941
+ j.item !== st && (j.item = st), j.nr.used || console.warn(`Expected existing view's used flag to be true, got ${j.nr.used}`);
942
+ else {
943
+ if (Ct = st[D], j = Ht(Ct), j) {
944
+ const _t = j.nr.index !== Z || j.nr.key !== Ge;
945
+ j.item = st, j.nr.index = Z, j.nr.key = Ge, j.nr.type !== Ct && console.warn("Reused view's type does not match pool's type"), _t && Ni(j);
946
+ } else
947
+ j = Wt(re, Z, st, Ge, Ct);
948
+ ce.set(Ge, j), ge = !0;
949
+ }
950
+ d === null ? (j.position = Q[Z - 1]?.accumulator || 0, j.offset = 0) : (j.position = Math.floor(Z / h) * d, j.offset = Z % h * x), jt && ge && y(j, Z, jt), Vt ??= j.position, fn += Ye;
951
+ }), dn ? (Vt == null ? (z.value = 0, w.value = Fe) : (z.value = Vt, w.value = Math.max(0, Fe - Vt - fn)), Ut || qe()) : (z.value = 0, w.value = 0), I = X, C = W, B = de, P = fe, q = !0, a.emitUpdate && v.callbacks.onUpdate?.(X, W, de, fe), Xe(a) !== "flow" && (f && clearTimeout(f), f = setTimeout(cn, a.updateInterval + 300)), {
952
+ continuous: Nt
953
+ };
954
+ }
955
+ function ri() {
956
+ throw xe = setTimeout(() => {
957
+ xe = null, console.warn("It seems the scroller element isn't scrolling, so it tries to render all the items at once.", "Scroller:", v.el.value), console.warn("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.");
958
+ }), new Error("Rendered items limit reached");
959
+ }
960
+ function li() {
961
+ if (ni())
962
+ return !1;
963
+ const r = g.value.filter(({ nr: o }) => o.used);
964
+ for (let o = 1; o < r.length; o++)
965
+ if (r[o].nr.index !== r[o - 1].nr.index + 1)
966
+ return !0;
967
+ return !1;
968
+ }
969
+ function cn() {
970
+ if ($.value) {
971
+ if (Xe() === "flow") {
972
+ qe();
973
+ return;
974
+ }
975
+ g.value.sort((r, o) => r.nr.index - o.nr.index), li() && (he(!1), f && clearTimeout(f));
976
+ }
977
+ }
978
+ function oi(r, o) {
979
+ if (!$.value)
980
+ return;
981
+ const a = F(), d = De(a), h = v.el.value;
982
+ if (!h)
983
+ return;
984
+ const x = Math.max(0, Math.min(r, m.value.length - 1)), L = be().start, D = Pi(h, d, a.pageMode, it.value), U = Ke(x), oe = Rt(x), _ = gn(
985
+ U,
986
+ oe,
987
+ L,
988
+ D,
989
+ o?.align,
990
+ o?.offset ?? 0
991
+ );
992
+ if (_ == null)
993
+ return;
994
+ Et(_, o);
995
+ const Q = He(a.itemSize);
996
+ if (a.gridItems && Q != null) {
997
+ const ce = v.el.value;
998
+ if (!ce)
999
+ return;
1000
+ const re = a.gridItems, ze = a.itemSecondarySize || Q, X = x % re * ze, W = d === "vertical" ? "horizontal" : "vertical", Fe = W === "horizontal" ? pt(ce.scrollLeft, "horizontal", ce) : ce.scrollTop, de = W === "horizontal" ? ce.clientWidth : ce.clientHeight, fe = gn(
1001
+ X,
1002
+ ze,
1003
+ Fe,
1004
+ de,
1005
+ o?.align,
1006
+ o?.offset ?? 0
1007
+ );
1008
+ fe != null && Kt(ce, W, fe, o);
1009
+ }
1010
+ }
1011
+ function Et(r, o) {
1012
+ if (!$.value)
1013
+ return;
1014
+ const a = F(), d = De(a), h = v.el.value;
1015
+ if (h)
1016
+ if (Ae()) {
1017
+ const x = it.value ?? window, L = d === "vertical" ? "top" : "left", D = x === window, U = D ? document.scrollingElement || document.documentElement : x, oe = U.getBoundingClientRect(), _ = h.getBoundingClientRect(), Q = D ? d === "vertical" ? window.scrollY : window.scrollX : pt(
1018
+ d === "vertical" ? U.scrollTop : U.scrollLeft,
1019
+ d,
1020
+ U
1021
+ ), ce = _[L] - oe[L];
1022
+ Kt(D ? window : U, d, r + Q + ce, o);
1023
+ } else
1024
+ Kt(h, d, r, o);
1025
+ }
1026
+ const ot = F(), Ft = m.value;
1027
+ return je = et(Ft, Ft.length > 0 && typeof Ft[0] != "object" ? null : ot.keyField), pe = Bt(Ft, ot.typeField), ot.cache && zt(ot.cache), $.value && ot.prerender && (Ce = !0, he(!1)), ot.gridItems && He(ot.itemSize) == null && console.error("[vue-recycle-scroller] You must provide an itemSize when using gridItems"), Xt(() => {
1028
+ $.value && (It(), tt(() => {
1029
+ Ce = !1, he(!0), k.value = !0;
1030
+ }));
1031
+ }), Fn(() => {
1032
+ if (!$.value)
1033
+ return;
1034
+ const r = le;
1035
+ typeof r == "number" && tt(() => {
1036
+ Et(r);
1037
+ });
1038
+ }), Lt(() => {
1039
+ ye(), H(), dt();
1040
+ }), N($, (r) => {
1041
+ r ? (It(), tt(() => {
1042
+ he(!0), k.value = !0;
1043
+ })) : (dt(), ye(), H(), k.value = !1);
1044
+ }), N(() => F().cache, (r) => {
1045
+ $.value && (zt(r), he(!0));
1046
+ }), N(() => R(F().items).slice(), (r, o) => {
1047
+ if (!$.value)
1048
+ return;
1049
+ const a = F(), d = $e.value ? null : a.keyField, h = et(r, d), x = Bt(r, a.typeField), L = je, U = !Hi(
1050
+ h,
1051
+ x,
1052
+ L,
1053
+ pe
1054
+ );
1055
+ a.shift && Dn(L, h) > 0 ? ei(o ?? [], d) : lt(), je = h, pe = x, sn(r), he(U);
1056
+ }), N(() => F().keyField, () => {
1057
+ if (!$.value)
1058
+ return;
1059
+ const r = F(), o = $e.value ? null : r.keyField;
1060
+ je = et(m.value, o), pe = Bt(m.value, r.typeField), lt(), he(!0);
1061
+ }), N(() => F().typeField, () => {
1062
+ if (!$.value)
1063
+ return;
1064
+ const r = F();
1065
+ pe = Bt(m.value, r.typeField), lt(), he(!0);
1066
+ }), N(Ae, () => {
1067
+ $.value && (dt(), It(), he(!1));
1068
+ }), N(v.el, () => {
1069
+ $.value && (dt(), It(), he(!1));
1070
+ }), N(it, () => {
1071
+ !$.value || !Ae() || (dt(), It(), he(!1));
1072
+ }), N(rt, () => {
1073
+ $.value && (sn() && Jn(), he(!1));
1074
+ }), N(() => F().gridItems, () => {
1075
+ $.value && he(!0);
1076
+ }), N(() => F().itemSecondarySize, () => {
1077
+ $.value && he(!0);
1078
+ }), {
1079
+ pool: g,
1080
+ visiblePool: kt,
1081
+ totalSize: T,
1082
+ startSpacerSize: z,
1083
+ endSpacerSize: w,
1084
+ ready: k,
1085
+ sizes: rt,
1086
+ simpleArray: $e,
1087
+ scrollToItem: oi,
1088
+ scrollToPosition: Et,
1089
+ getScroll: be,
1090
+ findItemIndex: on,
1091
+ getItemOffset: Ke,
1092
+ getItemSize: Rt,
1093
+ getViewStyle: Zn,
1094
+ cacheSnapshot: bt,
1095
+ restoreCache: zt,
1096
+ updateVisibleItems: he,
1097
+ handleResize: ue,
1098
+ handleVisibilityChange: Ve,
1099
+ sortViews: cn
1100
+ };
1101
+ }
1102
+ function ji(e) {
1103
+ for (let t = 0; t < e.length; t++)
1104
+ e[t];
1105
+ }
1106
+ function Wn(e) {
1107
+ return e.item;
1108
+ }
1109
+ function gt(e, t) {
1110
+ const i = t.get(e);
1111
+ return i || e;
1112
+ }
1113
+ function qi(e) {
1114
+ const t = {};
1115
+ return Object.defineProperties(t, {
1116
+ item: {
1117
+ enumerable: !0,
1118
+ get: () => e.item.item
1119
+ },
1120
+ itemWithSize: {
1121
+ enumerable: !0,
1122
+ get: () => e.item
1123
+ },
1124
+ size: {
1125
+ enumerable: !0,
1126
+ get: () => e.item.size
1127
+ },
1128
+ position: {
1129
+ enumerable: !0,
1130
+ get: () => e.position
1131
+ },
1132
+ offset: {
1133
+ enumerable: !0,
1134
+ get: () => e.offset
1135
+ },
1136
+ id: {
1137
+ enumerable: !0,
1138
+ get: () => e.nr.id
1139
+ },
1140
+ index: {
1141
+ enumerable: !0,
1142
+ get: () => e.nr.index
1143
+ },
1144
+ used: {
1145
+ enumerable: !0,
1146
+ get: () => e.nr.used
1147
+ },
1148
+ key: {
1149
+ enumerable: !0,
1150
+ get: () => e.nr.key
1151
+ },
1152
+ type: {
1153
+ enumerable: !0,
1154
+ get: () => e.nr.type
1155
+ }
1156
+ }), t;
1157
+ }
1158
+ function Ki(e) {
1159
+ return e._vs_styleStamp ?? 0;
1160
+ }
1161
+ function Yi(e) {
1162
+ return e._vs_visibilityStamp ?? 0;
1163
+ }
1164
+ const Hn = [
1165
+ "position",
1166
+ "top",
1167
+ "left",
1168
+ "transform",
1169
+ "willChange",
1170
+ "visibility",
1171
+ "pointerEvents",
1172
+ "display"
1173
+ ];
1174
+ function _n(e) {
1175
+ const t = {};
1176
+ for (const i of Hn)
1177
+ t[i] = e.style[i];
1178
+ return t;
1179
+ }
1180
+ function Nn(e, t) {
1181
+ for (const i of Hn)
1182
+ e.style[i] = t[i] ?? "";
1183
+ }
1184
+ function Je(e, t, i) {
1185
+ e.style[t] !== i && (e.style[t] = i);
1186
+ }
1187
+ function Mn(e, t, i, n, l, c, p) {
1188
+ if (!("view" in t)) {
1189
+ Nn(e, c);
1190
+ return;
1191
+ }
1192
+ const v = e.tagName === "TR", m = yt(l ? {
1193
+ direction: i,
1194
+ flowMode: !0
1195
+ } : {
1196
+ direction: i,
1197
+ disableTransform: n || v
1198
+ }), g = tn(gt(t.view, p), {
1199
+ direction: i,
1200
+ mode: m
1201
+ });
1202
+ Je(e, "position", String(g.position ?? "")), Je(e, "top", String(g.top ?? "")), Je(e, "left", String(g.left ?? "")), Je(e, "transform", m === "flow" || v ? "" : String(g.transform ?? "")), Je(e, "willChange", String(g.willChange ?? "")), Je(e, "visibility", String(g.visibility ?? "")), Je(e, "pointerEvents", String(g.pointerEvents ?? "")), Je(e, "display", String(g.display ?? ""));
1203
+ }
1204
+ function xn(e, t) {
1205
+ return "view" in e && !t;
1206
+ }
1207
+ function Tn(e, t, i, n, l, c) {
1208
+ if ("view" in e) {
1209
+ const p = gt(e.view, c);
1210
+ return {
1211
+ active: p.nr.used && l,
1212
+ id: Wn(p).id
1213
+ };
1214
+ }
1215
+ return {
1216
+ active: t.active && l,
1217
+ id: Zi(
1218
+ t.item,
1219
+ i,
1220
+ n,
1221
+ t.index
1222
+ )
1223
+ };
1224
+ }
1225
+ function Gi(e, t, i, n) {
1226
+ if (!("view" in e))
1227
+ return {
1228
+ direction: t,
1229
+ flowMode: i,
1230
+ legacy: !0
1231
+ };
1232
+ if (i) {
1233
+ const c = gt(e.view, n);
1234
+ return {
1235
+ direction: t,
1236
+ flowMode: i,
1237
+ legacy: !1,
1238
+ visibilityStamp: Yi(c)
1239
+ };
1240
+ }
1241
+ const l = gt(e.view, n);
1242
+ return {
1243
+ active: l.nr.used,
1244
+ direction: t,
1245
+ flowMode: i,
1246
+ legacy: !1,
1247
+ styleStamp: Ki(l),
1248
+ position: xn(e, i) ? l.position : null,
1249
+ offset: xn(e, i) ? l.offset : null
1250
+ };
1251
+ }
1252
+ function kn(e, t) {
1253
+ if ("view" in e) {
1254
+ const i = gt(e.view, t);
1255
+ return {
1256
+ item: Wn(i).item,
1257
+ active: i.nr.used,
1258
+ index: i.nr.index,
1259
+ watchData: e.watchData ?? !1,
1260
+ emitResize: e.emitResize ?? !1,
1261
+ sizeDependencies: e.sizeDependencies ?? null,
1262
+ onResize: e.onResize
1263
+ };
1264
+ }
1265
+ return {
1266
+ watchData: !1,
1267
+ emitResize: !1,
1268
+ sizeDependencies: null,
1269
+ ...e
1270
+ };
1271
+ }
1272
+ function Qi(e, t) {
1273
+ e.item !== t.item && (e.item = t.item), e.active !== t.active && (e.active = t.active), e.index !== t.index && (e.index = t.index), e.watchData !== t.watchData && (e.watchData = t.watchData), e.sizeDependencies !== t.sizeDependencies && (e.sizeDependencies = t.sizeDependencies), e.emitResize !== t.emitResize && (e.emitResize = t.emitResize), e.onResize !== t.onResize && (e.onResize = t.onResize);
1274
+ }
1275
+ function Xi(e, t) {
1276
+ e.onResize !== t.onResize && (e.onResize = t.onResize);
1277
+ }
1278
+ function Zi(e, t, i, n) {
1279
+ return i ? n ?? null : Jt(e, n, t);
1280
+ }
1281
+ function Ji(e) {
1282
+ const t = nn(e);
1283
+ let i = 0, n = {};
1284
+ const l = Ti();
1285
+ let c = !1, p, v = !1, m = [], g = null, T = null, z = null;
1286
+ const w = /* @__PURE__ */ new Set(), k = [], I = Yt({
1287
+ active: !0,
1288
+ sizes: {},
1289
+ keyField: S().keyField,
1290
+ simpleArray: !1
1291
+ }), C = E(() => {
1292
+ const s = R(S().items);
1293
+ return ji(s), s;
1294
+ }), B = E(() => S().direction ?? "vertical"), P = E(() => R(S().el)), q = E(() => R(S().before)), te = E(() => R(S().after)), ve = /* @__PURE__ */ new Map();
1295
+ function S() {
1296
+ return t.value;
1297
+ }
1298
+ const K = E(() => R(S().enabled ?? !0));
1299
+ function le(s) {
1300
+ let u = -1;
1301
+ return u = requestAnimationFrame(() => {
1302
+ w.delete(u), s();
1303
+ }), w.add(u), u;
1304
+ }
1305
+ function _e() {
1306
+ for (const s of w)
1307
+ cancelAnimationFrame(s);
1308
+ w.clear();
1309
+ }
1310
+ const Ce = Ri({
1311
+ // Spread row measurement across frames so one huge flush cannot monopolize layout time.
1312
+ maxTasksPerFlush: 6,
1313
+ overflowQueueFlush(s) {
1314
+ le(s);
1315
+ }
1316
+ });
1317
+ typeof ResizeObserver < "u" && (p = new ResizeObserver((s) => {
1318
+ le(() => {
1319
+ if (Array.isArray(s)) {
1320
+ for (const u of s)
1321
+ if (u.target && u.target.$_vs_onResize) {
1322
+ let y, b;
1323
+ if (u.borderBoxSize) {
1324
+ const M = u.borderBoxSize[0];
1325
+ y = M.inlineSize, b = M.blockSize;
1326
+ } else
1327
+ y = u.contentRect.width, b = u.contentRect.height;
1328
+ u.target.$_vs_onResize(u.target.$_vs_id, y, b);
1329
+ }
1330
+ }
1331
+ });
1332
+ }));
1333
+ const A = {
1334
+ vscrollData: I,
1335
+ resizeObserver: p,
1336
+ measureQueue: Ce,
1337
+ direction: B,
1338
+ undefinedMap: n,
1339
+ undefinedSizeCount: {
1340
+ get value() {
1341
+ return i;
1342
+ },
1343
+ set value(s) {
1344
+ i = s;
1345
+ }
1346
+ },
1347
+ onVscrollUpdate(s) {
1348
+ const u = (y) => {
1349
+ s(y);
1350
+ };
1351
+ return l.on("vscroll:update", u), () => l.off("vscroll:update", u);
1352
+ }
1353
+ };
1354
+ Mt("vscrollData", I), Mt("vscrollParent", {
1355
+ get $_undefinedSizes() {
1356
+ return i;
1357
+ },
1358
+ set $_undefinedSizes(s) {
1359
+ i = s;
1360
+ },
1361
+ get $_undefinedMap() {
1362
+ return n;
1363
+ },
1364
+ set $_undefinedMap(s) {
1365
+ n = s;
1366
+ },
1367
+ $_events: l,
1368
+ direction: B
1369
+ }), Mt("vscrollResizeObserver", p), Mt("vscrollMeasurementContext", A), Mt("vscrollAnchorRegistry", {
1370
+ delete(s) {
1371
+ ve.delete(s);
1372
+ },
1373
+ set(s, u) {
1374
+ ve.set(s, u);
1375
+ }
1376
+ });
1377
+ const Y = E(() => {
1378
+ const s = C.value;
1379
+ return s.length > 0 && typeof s[0] != "object";
1380
+ }), f = vt(0), O = vt(k);
1381
+ pn(() => {
1382
+ if (!K.value)
1383
+ return;
1384
+ const s = T || !P.value ? null : J(P.value.scrollTop, k), y = S().keyField, b = Y.value, M = I.sizes, V = C.value, H = V.length;
1385
+ let ye = k.length !== H, ue = k.length !== H;
1386
+ for (let Te = 0; Te < H; Te++) {
1387
+ const Ve = V[Te], Le = b ? Te : ht(Ve, Te, y);
1388
+ let Ee = M[Le];
1389
+ typeof Ee > "u" && !n[Le] && (Ee = 0);
1390
+ let be = k[Te];
1391
+ if (!be) {
1392
+ be = At({
1393
+ item: Ve,
1394
+ id: Le,
1395
+ size: Ee
1396
+ }), k[Te] = be, ye = !0, ue = !0;
1397
+ continue;
1398
+ }
1399
+ be.item !== Ve && (be.item = Ve, ye = !0, ue = !0), be.id !== Le && (be.id = Le, ye = !0, ue = !0), be.size !== Ee && (be.size = Ee, ye = !0);
1400
+ }
1401
+ k.length !== H && (k.length = H, ye = !0, ue = !0), ye && (g = s, f.value++, ue ? O.value = k.slice() : hn(O));
1402
+ });
1403
+ function J(s, u) {
1404
+ if (!u.length)
1405
+ return null;
1406
+ const y = S().minItemSize;
1407
+ let b = 0, M = 0, V = u[0].id;
1408
+ for (const H of u) {
1409
+ const ye = H.size || y, ue = b + ye;
1410
+ if (M = b, V = H.id, s < ue)
1411
+ return {
1412
+ key: H.id,
1413
+ offset: s - b
1414
+ };
1415
+ b = ue;
1416
+ }
1417
+ return {
1418
+ key: V,
1419
+ offset: Math.max(0, s - M)
1420
+ };
1421
+ }
1422
+ const ne = S();
1423
+ m = et(C.value, Y.value ? null : ne.keyField), ne.cache && (I.sizes = Gt(ne.cache, C.value, Y.value ? null : ne.keyField));
1424
+ function je() {
1425
+ S().onHidden?.();
1426
+ }
1427
+ function pe(s, u, y, b) {
1428
+ S().onUpdate?.(s, u, y, b);
1429
+ }
1430
+ const Me = Yt({
1431
+ get enabled() {
1432
+ return K.value;
1433
+ },
1434
+ get items() {
1435
+ return O.value;
1436
+ },
1437
+ get keyField() {
1438
+ return "id";
1439
+ },
1440
+ get direction() {
1441
+ return B.value;
1442
+ },
1443
+ get itemSize() {
1444
+ return null;
1445
+ },
1446
+ get gridItems() {
1447
+ },
1448
+ get itemSecondarySize() {
1449
+ },
1450
+ get minItemSize() {
1451
+ return S().minItemSize;
1452
+ },
1453
+ get sizeField() {
1454
+ return "size";
1455
+ },
1456
+ get typeField() {
1457
+ return "type";
1458
+ },
1459
+ get buffer() {
1460
+ return S().buffer ?? 200;
1461
+ },
1462
+ get pageMode() {
1463
+ return S().pageMode ?? !1;
1464
+ },
1465
+ get shift() {
1466
+ return !1;
1467
+ },
1468
+ get cache() {
1469
+ return S().cache;
1470
+ },
1471
+ get prerender() {
1472
+ return S().prerender ?? 0;
1473
+ },
1474
+ get emitUpdate() {
1475
+ return S().emitUpdate ?? !1;
1476
+ },
1477
+ get disableTransform() {
1478
+ return S().disableTransform ?? !1;
1479
+ },
1480
+ get flowMode() {
1481
+ return S().flowMode ?? !1;
1482
+ },
1483
+ get hiddenPosition() {
1484
+ return S().hiddenPosition;
1485
+ },
1486
+ get updateInterval() {
1487
+ return S().updateInterval ?? 0;
1488
+ },
1489
+ get el() {
1490
+ return P.value;
1491
+ },
1492
+ get before() {
1493
+ return q.value;
1494
+ },
1495
+ get after() {
1496
+ return te.value;
1497
+ },
1498
+ get scrollParent() {
1499
+ return S().scrollParent;
1500
+ },
1501
+ get onResize() {
1502
+ return ie;
1503
+ },
1504
+ get onVisible() {
1505
+ return xe;
1506
+ },
1507
+ get onHidden() {
1508
+ return je;
1509
+ },
1510
+ get onUpdate() {
1511
+ return pe;
1512
+ }
1513
+ });
1514
+ function ie() {
1515
+ qe(), S().onResize?.();
1516
+ }
1517
+ function xe() {
1518
+ l.emit("vscroll:update", { force: !1 }), S().onVisible?.();
1519
+ }
1520
+ const Ie = rn(
1521
+ Me
1522
+ ), G = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakMap(), ae = vt([]);
1523
+ function Oe(s) {
1524
+ const u = S();
1525
+ return tn(gt(s, G), {
1526
+ direction: B.value,
1527
+ mode: yt({
1528
+ direction: B.value,
1529
+ disableTransform: u.disableTransform ?? !1,
1530
+ flowMode: u.flowMode ?? !1
1531
+ })
1532
+ });
1533
+ }
1534
+ function ct(s) {
1535
+ let u = Pe.get(s);
1536
+ return u || (u = qi(s), Pe.set(s, u), G.set(u, s)), u;
1537
+ }
1538
+ pn(() => {
1539
+ const s = Ie.pool.value, u = s.length, y = ae.value;
1540
+ let b = y.length !== u;
1541
+ for (let M = 0; M < u; M++) {
1542
+ const V = ct(s[M]);
1543
+ y[M] !== V && (y[M] = V, b = !0);
1544
+ }
1545
+ y.length !== u && (y.length = u, b = !0), b && hn(ae);
1546
+ });
1547
+ const Tt = E(
1548
+ () => Ie.visiblePool.value.map(ct)
1549
+ ), F = /* @__PURE__ */ new WeakMap();
1550
+ function Ae() {
1551
+ z != null && (cancelAnimationFrame(z), w.delete(z), z = null);
1552
+ }
1553
+ function $() {
1554
+ Ae(), T = null;
1555
+ }
1556
+ function it() {
1557
+ T == null || z != null || (z = le(() => {
1558
+ z = null, bt();
1559
+ }));
1560
+ }
1561
+ function $e() {
1562
+ const s = P.value;
1563
+ if (!s)
1564
+ return null;
1565
+ const u = s.getBoundingClientRect();
1566
+ let y = null;
1567
+ for (const [b, M] of ve.entries()) {
1568
+ if (!M.active || getComputedStyle(b).visibility === "hidden")
1569
+ continue;
1570
+ const V = b.getBoundingClientRect();
1571
+ if (V.bottom <= u.top || V.top >= u.bottom)
1572
+ continue;
1573
+ const H = Math.max(V.top, u.top) - u.top;
1574
+ (!y || H < y.score) && (y = {
1575
+ key: M.id,
1576
+ offset: V.top - u.top,
1577
+ score: H
1578
+ });
1579
+ }
1580
+ return y;
1581
+ }
1582
+ function rt(s) {
1583
+ const u = P.value;
1584
+ if (!u) {
1585
+ $();
1586
+ return;
1587
+ }
1588
+ const y = u.scrollTop, b = Math.min(Ie.findItemIndex(y), s.length - 1), M = s[b];
1589
+ if (M == null) {
1590
+ $();
1591
+ return;
1592
+ }
1593
+ const V = $e();
1594
+ T = {
1595
+ logicalKey: M,
1596
+ logicalOffset: y - Ie.getItemOffset(b),
1597
+ pendingKeys: /* @__PURE__ */ new Set(),
1598
+ stableFrames: 0,
1599
+ visualKey: V?.key ?? null,
1600
+ visualOffset: V?.offset ?? 0
1601
+ };
1602
+ }
1603
+ function kt(s) {
1604
+ const u = P.value;
1605
+ return !u || Math.abs(u.scrollTop - s) < 0.5 ? !1 : (v = !0, u.scrollTop = s, Ie.updateVisibleItems(!0), u.dispatchEvent(new Event("scroll")), le(() => {
1606
+ v = !1;
1607
+ }), !0);
1608
+ }
1609
+ function bt() {
1610
+ const s = T, u = P.value;
1611
+ if (!s || !u)
1612
+ return;
1613
+ const y = O.value.findIndex((H) => H.id === s.logicalKey);
1614
+ if (y === -1) {
1615
+ $();
1616
+ return;
1617
+ }
1618
+ let b = !1;
1619
+ const M = Ie.getItemOffset(y) + s.logicalOffset;
1620
+ if (b = kt(M) || b, !b && s.visualKey != null)
1621
+ for (const [H, ye] of ve.entries()) {
1622
+ if (!ye.active || ye.id !== s.visualKey || getComputedStyle(H).visibility === "hidden")
1623
+ continue;
1624
+ const ue = H.getBoundingClientRect().top - u.getBoundingClientRect().top - s.visualOffset;
1625
+ b = kt(u.scrollTop + ue) || b;
1626
+ break;
1627
+ }
1628
+ let V = !0;
1629
+ for (const H of s.pendingKeys)
1630
+ if (!(typeof I.sizes[H] == "number" && I.sizes[H] > 0)) {
1631
+ V = !1;
1632
+ break;
1633
+ }
1634
+ if (!b && V) {
1635
+ if (s.stableFrames++, s.stableFrames >= 2) {
1636
+ $();
1637
+ return;
1638
+ }
1639
+ } else
1640
+ s.stableFrames = 0;
1641
+ it();
1642
+ }
1643
+ function De(s, u, y, b) {
1644
+ const M = mi(), V = vt(u), H = At({
1645
+ ...y
1646
+ }), ye = At({
1647
+ onResize: y.onResize
1648
+ }), ue = vt(s), Te = M.run(() => (N(() => Tn(
1649
+ V.value,
1650
+ H,
1651
+ S().keyField,
1652
+ I.simpleArray,
1653
+ I.active,
1654
+ G
1655
+ ), () => {
1656
+ const Ve = ue.value;
1657
+ if (Ve) {
1658
+ const Le = Tn(
1659
+ V.value,
1660
+ H,
1661
+ S().keyField,
1662
+ I.simpleArray,
1663
+ I.active,
1664
+ G
1665
+ ), Ee = Le.id;
1666
+ Ee != null && ve.set(Ve, {
1667
+ active: Le.active,
1668
+ id: Ee
1669
+ });
1670
+ }
1671
+ }, {
1672
+ immediate: !0
1673
+ }), N(() => Gi(
1674
+ V.value,
1675
+ B.value,
1676
+ S().flowMode ?? !1,
1677
+ G
1678
+ ), () => {
1679
+ const Ve = ue.value;
1680
+ Ve && Mn(
1681
+ Ve,
1682
+ V.value,
1683
+ B.value,
1684
+ S().disableTransform ?? !1,
1685
+ S().flowMode ?? !1,
1686
+ b,
1687
+ G
1688
+ );
1689
+ }, {
1690
+ immediate: !0
1691
+ }), $n(
1692
+ H,
1693
+ ue,
1694
+ A,
1695
+ ye
1696
+ )));
1697
+ Te.mount(), F.set(s, {
1698
+ binding: V,
1699
+ scope: M,
1700
+ options: H,
1701
+ callbacks: ye,
1702
+ el: ue,
1703
+ controller: Te,
1704
+ restoreStyles: b
1705
+ });
1706
+ }
1707
+ const Xe = {
1708
+ mounted(s, u) {
1709
+ if (!K.value)
1710
+ return;
1711
+ const y = _n(s);
1712
+ De(s, u.value, kn(u.value, G), y);
1713
+ },
1714
+ updated(s, u) {
1715
+ if (!K.value)
1716
+ return;
1717
+ const y = F.get(s), b = kn(u.value, G);
1718
+ if (!y) {
1719
+ const V = _n(s);
1720
+ De(s, u.value, b, V);
1721
+ return;
1722
+ }
1723
+ const M = y.binding.value !== u.value;
1724
+ M && (y.binding.value = u.value), Qi(y.options, b), Xi(y.callbacks, b), y.el.value !== s && (y.el.value = s), M && Mn(
1725
+ s,
1726
+ u.value,
1727
+ B.value,
1728
+ S().disableTransform ?? !1,
1729
+ S().flowMode ?? !1,
1730
+ y.restoreStyles,
1731
+ G
1732
+ );
1733
+ },
1734
+ unmounted(s) {
1735
+ const u = F.get(s);
1736
+ u && (u.controller.unmount(), u.scope.stop(), Nn(s, u.restoreStyles), ve.delete(s), F.delete(s));
1737
+ }
1738
+ };
1739
+ function qe(s = !1) {
1740
+ K.value && ((s || Y.value) && (I.sizes = {}), l.emit("vscroll:update", { force: !0 }));
1741
+ }
1742
+ function zt(s, u) {
1743
+ Ie.scrollToItem(s, u);
1744
+ }
1745
+ function wt(s) {
1746
+ const u = S();
1747
+ return I.sizes = Gt(s, C.value, Y.value ? null : u.keyField), Ie.restoreCache(s);
1748
+ }
1749
+ function Wt(s, u) {
1750
+ const y = S(), b = u ?? C.value.indexOf(s), M = Y.value ? b : Jt(s, b >= 0 ? b : u, y.keyField);
1751
+ return I.sizes[M] || 0;
1752
+ }
1753
+ function Ht() {
1754
+ if (!K.value)
1755
+ return;
1756
+ const s = S(), u = s.pageMode ? An(P.value, R(s.scrollParent)) ?? window : P.value;
1757
+ if (!u || c)
1758
+ return;
1759
+ c = !0;
1760
+ const y = () => {
1761
+ if (u === window) {
1762
+ const M = document.documentElement;
1763
+ return Math.max(M.scrollHeight, document.body?.scrollHeight ?? 0);
1764
+ }
1765
+ return u.scrollHeight;
1766
+ }, b = (M) => {
1767
+ u === window ? window.scrollTo({ top: M }) : u.scrollTop = M;
1768
+ };
1769
+ tt(() => {
1770
+ b(y() + 5e3);
1771
+ const M = () => {
1772
+ b(y() + 5e3), le(() => {
1773
+ b(y() + 5e3), i === 0 ? c = !1 : le(M);
1774
+ });
1775
+ };
1776
+ le(M);
1777
+ });
1778
+ }
1779
+ function Ze() {
1780
+ T && !v && $();
1781
+ }
1782
+ return N(() => C.value.slice(), (s, u) => {
1783
+ if (!K.value)
1784
+ return;
1785
+ const y = S(), b = Y.value ? null : y.keyField, M = et(s, b);
1786
+ if (y.shift) {
1787
+ const V = u ? et(u, b) : m, H = Dn(V, M);
1788
+ H > 0 ? (rt(V), T && (T.pendingKeys = new Set(M.slice(0, H)), T.stableFrames = 0, tt(() => {
1789
+ T && bt();
1790
+ }))) : $();
1791
+ } else
1792
+ $();
1793
+ m = M, qe();
1794
+ }, { flush: "sync" }), N(() => S().cache, (s) => {
1795
+ K.value && s && wt(s);
1796
+ }), N(() => S().keyField, (s) => {
1797
+ K.value && (I.keyField = s, m = et(C.value, Y.value ? null : s), $(), qe(!0));
1798
+ }, { flush: "sync" }), N(Y, (s) => {
1799
+ I.simpleArray = s;
1800
+ }, { immediate: !0 }), N(() => S().direction, () => {
1801
+ K.value && ($(), qe(!0));
1802
+ }), N(P, (s, u) => {
1803
+ u?.removeEventListener("scroll", Ze), K.value && s?.addEventListener("scroll", Ze);
1804
+ }, {
1805
+ immediate: !0
1806
+ }), N(K, (s) => {
1807
+ const u = P.value;
1808
+ s ? (u?.addEventListener("scroll", Ze), qe()) : (u?.removeEventListener("scroll", Ze), Ae(), _e(), $());
1809
+ }), N(f, () => {
1810
+ if (!K.value)
1811
+ return;
1812
+ const s = P.value;
1813
+ if (!s)
1814
+ return;
1815
+ if (T) {
1816
+ bt();
1817
+ return;
1818
+ }
1819
+ const u = g;
1820
+ if (g = null, !u)
1821
+ return;
1822
+ const y = O.value.findIndex((V) => V.id === u.key);
1823
+ if (y === -1)
1824
+ return;
1825
+ const b = Ie.getItemOffset(y) + u.offset;
1826
+ b - s.scrollTop !== 0 && (s.scrollTop = b);
1827
+ }, { flush: "post" }), Fn(() => {
1828
+ I.active = !0;
1829
+ }), di(() => {
1830
+ I.active = !1;
1831
+ }), fi(() => {
1832
+ Ae(), _e(), P.value?.removeEventListener("scroll", Ze), l.clear();
1833
+ }), {
1834
+ vscrollData: I,
1835
+ itemsWithSize: O,
1836
+ resizeObserver: p,
1837
+ measurementContext: A,
1838
+ vDynamicScrollerItem: Xe,
1839
+ ...Ie,
1840
+ pool: ae,
1841
+ visiblePool: Tt,
1842
+ simpleArray: Y,
1843
+ forceUpdate: qe,
1844
+ scrollToItem: zt,
1845
+ restoreCache: wt,
1846
+ getItemSize: Wt,
1847
+ getViewStyle: Oe,
1848
+ scrollToBottom: Ht,
1849
+ onScrollerResize: ie,
1850
+ onScrollerVisible: xe
1851
+ };
1852
+ }
1853
+ const ln = /* @__PURE__ */ new WeakMap();
1854
+ function er(e) {
1855
+ return typeof e == "function" ? {
1856
+ callback: e,
1857
+ observer: null,
1858
+ intersection: void 0,
1859
+ visible: null
1860
+ } : {
1861
+ callback: e.callback,
1862
+ observer: null,
1863
+ intersection: e.intersection,
1864
+ visible: null
1865
+ };
1866
+ }
1867
+ function Rn(e, t) {
1868
+ Un(e);
1869
+ const i = er(t.value);
1870
+ if (ln.set(e, i), typeof IntersectionObserver > "u") {
1871
+ const n = e.getBoundingClientRect();
1872
+ i.visible = !0, i.callback(!0, {
1873
+ boundingClientRect: n
1874
+ });
1875
+ return;
1876
+ }
1877
+ i.observer = new IntersectionObserver((n) => {
1878
+ const l = n[0], c = !!l?.isIntersecting;
1879
+ i.visible !== null && i.visible === c || (i.visible = c, i.callback(c, l));
1880
+ }, i.intersection), i.observer.observe(e);
1881
+ }
1882
+ function Un(e) {
1883
+ const t = ln.get(e);
1884
+ t?.observer && (t.observer.disconnect(), t.observer = null);
1885
+ }
1886
+ const jn = {
1887
+ mounted(e, t) {
1888
+ Rn(e, t);
1889
+ },
1890
+ updated(e, t) {
1891
+ t.value !== t.oldValue && Rn(e, t);
1892
+ },
1893
+ unmounted(e) {
1894
+ Un(e), ln.delete(e);
1895
+ }
1896
+ }, qn = /* @__PURE__ */ St({
1897
+ __name: "ItemView",
1898
+ props: {
1899
+ view: {},
1900
+ itemTag: {}
1901
+ },
1902
+ setup(e) {
1903
+ const t = e;
1904
+ return (i, n) => (se(), Be(nt(t.itemTag), { class: "vue-recycle-scroller__item-view" }, {
1905
+ default: Ue(() => [
1906
+ Re(i.$slots, "default", {
1907
+ item: t.view.item,
1908
+ index: t.view.nr.index,
1909
+ active: t.view.nr.used
1910
+ })
1911
+ ]),
1912
+ _: 3
1913
+ }));
1914
+ }
1915
+ }), tr = /* @__PURE__ */ St({
1916
+ __name: "ResizeObserver",
1917
+ emits: ["notify"],
1918
+ setup(e, { emit: t }) {
1919
+ const i = t, n = Se();
1920
+ let l = null, c = null;
1921
+ function p() {
1922
+ i("notify");
1923
+ }
1924
+ return Xt(() => {
1925
+ const v = n.value?.parentElement;
1926
+ if (v) {
1927
+ if (typeof ResizeObserver < "u") {
1928
+ l = new ResizeObserver(() => {
1929
+ p();
1930
+ }), l.observe(v);
1931
+ return;
1932
+ }
1933
+ c = () => p(), window.addEventListener("resize", c);
1934
+ }
1935
+ }), Lt(() => {
1936
+ l && (l.disconnect(), l = null), c && (window.removeEventListener("resize", c), c = null);
1937
+ }), (v, m) => (se(), Qe("div", {
1938
+ ref_key: "el",
1939
+ ref: n,
1940
+ class: "vue-recycle-scroller__resize-observer",
1941
+ "aria-hidden": "true"
1942
+ }, null, 512));
1943
+ }
1944
+ }), nr = (e, t) => {
1945
+ const i = e.__vccOpts || e;
1946
+ for (const [n, l] of t)
1947
+ i[n] = l;
1948
+ return i;
1949
+ }, Kn = /* @__PURE__ */ nr(tr, [["__scopeId", "data-v-08cc04ab"]]), ir = /* @__PURE__ */ St({
1950
+ __name: "RecycleScroller",
1951
+ props: {
1952
+ items: {},
1953
+ keyField: { default: "id" },
1954
+ direction: { default: "vertical" },
1955
+ listTag: { default: "div" },
1956
+ itemTag: { default: "div" },
1957
+ itemSize: { default: null },
1958
+ gridItems: { default: void 0 },
1959
+ itemSecondarySize: { default: void 0 },
1960
+ minItemSize: { default: null },
1961
+ sizeField: { default: "size" },
1962
+ typeField: { default: "type" },
1963
+ buffer: { default: 200 },
1964
+ pageMode: { type: Boolean, default: !1 },
1965
+ scrollParent: { default: void 0 },
1966
+ shift: { type: Boolean, default: !1 },
1967
+ cache: { default: void 0 },
1968
+ prerender: { default: 0 },
1969
+ emitUpdate: { type: Boolean, default: !1 },
1970
+ disableTransform: { type: Boolean, default: !1 },
1971
+ flowMode: { type: Boolean, default: !1 },
1972
+ hiddenPosition: { default: void 0 },
1973
+ updateInterval: { default: 0 },
1974
+ itemsLimit: { default: void 0 },
1975
+ skipHover: { type: Boolean, default: !1 },
1976
+ enabled: { type: Boolean, default: !0 },
1977
+ listClass: { default: "" },
1978
+ itemClass: { default: "" }
1979
+ },
1980
+ emits: ["resize", "visible", "hidden", "update", "scrollStart", "scrollEnd"],
1981
+ setup(e, { expose: t, emit: i }) {
1982
+ const n = e, l = i, c = jn, p = Se(), v = Se(), m = Se(), g = Se(null), T = Zt(n, "items"), z = E(() => ({
1983
+ items: T,
1984
+ el: p,
1985
+ before: v,
1986
+ after: m,
1987
+ keyField: n.keyField,
1988
+ direction: n.direction,
1989
+ itemSize: n.itemSize,
1990
+ gridItems: n.gridItems,
1991
+ itemSecondarySize: n.itemSecondarySize,
1992
+ minItemSize: n.minItemSize,
1993
+ sizeField: n.sizeField,
1994
+ typeField: n.typeField,
1995
+ buffer: n.buffer,
1996
+ pageMode: n.pageMode,
1997
+ scrollParent: n.scrollParent,
1998
+ shift: n.shift,
1999
+ cache: n.cache,
2000
+ prerender: n.prerender,
2001
+ emitUpdate: n.emitUpdate,
2002
+ disableTransform: n.disableTransform,
2003
+ flowMode: n.flowMode,
2004
+ hiddenPosition: n.hiddenPosition,
2005
+ updateInterval: n.updateInterval,
2006
+ itemsLimit: n.itemsLimit,
2007
+ enabled: n.enabled,
2008
+ onResize: () => l("resize"),
2009
+ onVisible: () => l("visible"),
2010
+ onHidden: () => l("hidden"),
2011
+ onUpdate: (G, Pe, ae, Oe) => {
2012
+ l("update", G, Pe, ae, Oe), ae <= 0 && l("scrollStart"), Oe >= n.items.length - 1 && l("scrollEnd");
2013
+ }
2014
+ })), w = rn(
2015
+ z
2016
+ ), {
2017
+ pool: k,
2018
+ visiblePool: I,
2019
+ totalSize: C,
2020
+ startSpacerSize: B,
2021
+ endSpacerSize: P,
2022
+ ready: q,
2023
+ scrollToItem: te,
2024
+ scrollToPosition: ve,
2025
+ getScroll: S,
2026
+ findItemIndex: K,
2027
+ getItemOffset: le,
2028
+ getItemSize: _e,
2029
+ getViewStyle: Ce,
2030
+ cacheSnapshot: A,
2031
+ restoreCache: Y,
2032
+ updateVisibleItems: f,
2033
+ handleResize: O,
2034
+ handleVisibilityChange: J
2035
+ } = w, ne = E(
2036
+ () => yt({
2037
+ direction: n.direction,
2038
+ disableTransform: n.disableTransform,
2039
+ flowMode: n.flowMode,
2040
+ gridItems: n.gridItems
2041
+ }) === "flow"
2042
+ ), je = E(() => ({
2043
+ height: `${B.value}px`
2044
+ })), pe = E(() => ({
2045
+ height: `${P.value}px`
2046
+ }));
2047
+ function Me(G) {
2048
+ g.value = G;
2049
+ }
2050
+ function ie() {
2051
+ g.value = null;
2052
+ }
2053
+ const xe = E(() => {
2054
+ const G = {
2055
+ [n.direction === "vertical" ? "minHeight" : "minWidth"]: `${C.value}px`
2056
+ }, Pe = He(n.itemSize);
2057
+ if (n.gridItems && Pe != null) {
2058
+ const ae = (n.itemSecondarySize || Pe) * n.gridItems;
2059
+ G[n.direction === "vertical" ? "minWidth" : "minHeight"] = `${ae}px`;
2060
+ }
2061
+ return G;
2062
+ });
2063
+ return t({
2064
+ el: p,
2065
+ visiblePool: I,
2066
+ startSpacerSize: B,
2067
+ endSpacerSize: P,
2068
+ scrollToItem: te,
2069
+ scrollToPosition: ve,
2070
+ getScroll: S,
2071
+ findItemIndex: K,
2072
+ getItemOffset: le,
2073
+ getItemSize: _e,
2074
+ cacheSnapshot: A,
2075
+ restoreCache: Y,
2076
+ updateVisibleItems: f
2077
+ }), (G, Pe) => Cn((se(), Qe("div", {
2078
+ ref_key: "el",
2079
+ ref: p,
2080
+ class: xt(["vue-recycle-scroller", {
2081
+ "grid-mode": n.gridItems,
2082
+ "flow-mode": ne.value,
2083
+ ready: ee(q),
2084
+ "page-mode": n.pageMode,
2085
+ [`direction-${n.direction}`]: !0
2086
+ }])
2087
+ }, [
2088
+ G.$slots.before ? (se(), Qe("div", {
2089
+ key: 0,
2090
+ ref_key: "before",
2091
+ ref: v,
2092
+ class: "vue-recycle-scroller__slot"
2093
+ }, [
2094
+ Re(G.$slots, "before")
2095
+ ], 512)) : Ne("", !0),
2096
+ (se(), Be(nt(n.listTag), {
2097
+ style: ut(xe.value),
2098
+ class: xt(["vue-recycle-scroller__item-wrapper", n.listClass])
2099
+ }, {
2100
+ default: Ue(() => [
2101
+ ne.value && ee(B) > 0 ? (se(), Be(nt(n.itemTag), {
2102
+ key: 0,
2103
+ "aria-hidden": "true",
2104
+ class: "vue-recycle-scroller__item-spacer",
2105
+ style: ut(je.value)
2106
+ }, null, 8, ["style"])) : Ne("", !0),
2107
+ (se(!0), Qe(Vn, null, Pn(ee(k), (ae) => (se(), Be(qn, $t({
2108
+ key: ae.nr.id,
2109
+ view: ae,
2110
+ "item-tag": n.itemTag,
2111
+ style: ee(q) ? ee(Ce)(ae) : null,
2112
+ class: ["vue-recycle-scroller__item-view", [
2113
+ n.itemClass,
2114
+ {
2115
+ hover: !n.skipHover && g.value === ae.nr.key
2116
+ }
2117
+ ]]
2118
+ }, vi(n.skipHover ? {} : {
2119
+ mouseenter: () => {
2120
+ Me(ae.nr.key);
2121
+ },
2122
+ mouseleave: () => {
2123
+ ie();
2124
+ }
2125
+ })), {
2126
+ default: Ue((Oe) => [
2127
+ Re(G.$slots, "default", $t({ ref_for: !0 }, Oe))
2128
+ ]),
2129
+ _: 3
2130
+ }, 16, ["view", "item-tag", "style", "class"]))), 128)),
2131
+ ne.value && ee(P) > 0 ? (se(), Be(nt(n.itemTag), {
2132
+ key: 1,
2133
+ "aria-hidden": "true",
2134
+ class: "vue-recycle-scroller__item-spacer",
2135
+ style: ut(pe.value)
2136
+ }, null, 8, ["style"])) : Ne("", !0),
2137
+ n.items.length === 0 ? Re(G.$slots, "empty", {}, void 0, void 0, 2) : Ne("", !0)
2138
+ ]),
2139
+ _: 3
2140
+ }, 8, ["style", "class"])),
2141
+ G.$slots.after ? (se(), Qe("div", {
2142
+ key: 1,
2143
+ ref_key: "after",
2144
+ ref: m,
2145
+ class: "vue-recycle-scroller__slot"
2146
+ }, [
2147
+ Re(G.$slots, "after")
2148
+ ], 512)) : Ne("", !0),
2149
+ On(Kn, { onNotify: ee(O) }, null, 8, ["onNotify"])
2150
+ ], 2)), [
2151
+ [ee(c), ee(J)]
2152
+ ]);
2153
+ }
2154
+ }), vr = /* @__PURE__ */ St({
2155
+ inheritAttrs: !1,
2156
+ __name: "DynamicScroller",
2157
+ props: {
2158
+ items: {},
2159
+ keyField: { default: "id" },
2160
+ direction: { default: "vertical" },
2161
+ listTag: { default: "div" },
2162
+ itemTag: { default: "div" },
2163
+ minItemSize: {},
2164
+ shift: { type: Boolean, default: !1 },
2165
+ cache: { default: void 0 },
2166
+ disableTransform: { type: Boolean, default: !1 },
2167
+ flowMode: { type: Boolean, default: !1 },
2168
+ hiddenPosition: { default: void 0 },
2169
+ enabled: { type: Boolean, default: !0 },
2170
+ pageMode: { type: Boolean, default: !1 },
2171
+ scrollParent: { default: void 0 }
2172
+ },
2173
+ emits: ["resize", "visible"],
2174
+ setup(e, { expose: t, emit: i }) {
2175
+ const n = e, l = i, c = Se(), p = Zt(n, "items"), v = E(() => {
2176
+ const A = c.value?.el;
2177
+ return A && typeof A == "object" && "value" in A ? A.value : A;
2178
+ }), m = E(() => ({
2179
+ items: p,
2180
+ keyField: n.keyField,
2181
+ direction: n.direction,
2182
+ minItemSize: n.minItemSize,
2183
+ shift: n.shift,
2184
+ cache: n.cache,
2185
+ flowMode: n.flowMode,
2186
+ hiddenPosition: n.hiddenPosition,
2187
+ enabled: n.enabled,
2188
+ pageMode: n.pageMode,
2189
+ scrollParent: n.scrollParent,
2190
+ el: v.value,
2191
+ onResize: () => l("resize"),
2192
+ onVisible: () => l("visible")
2193
+ })), g = Ji(
2194
+ m
2195
+ ), {
2196
+ itemsWithSize: T,
2197
+ forceUpdate: z,
2198
+ startSpacerSize: w,
2199
+ endSpacerSize: k,
2200
+ scrollToItem: I,
2201
+ scrollToPosition: C,
2202
+ findItemIndex: B,
2203
+ getItemOffset: P,
2204
+ getItemSize: q,
2205
+ cacheSnapshot: te,
2206
+ restoreCache: ve,
2207
+ scrollToBottom: S,
2208
+ onScrollerResize: K,
2209
+ onScrollerVisible: le
2210
+ } = g;
2211
+ function _e(A, Y, f) {
2212
+ return {
2213
+ item: A.item,
2214
+ index: Y,
2215
+ active: f,
2216
+ itemWithSize: A
2217
+ };
2218
+ }
2219
+ return t({
2220
+ startSpacerSize: w,
2221
+ endSpacerSize: k,
2222
+ scrollToItem: I,
2223
+ scrollToPosition: C,
2224
+ findItemIndex: B,
2225
+ getItemOffset: P,
2226
+ scrollToBottom: S,
2227
+ getItemSize: q,
2228
+ cacheSnapshot: te,
2229
+ restoreCache: ve,
2230
+ forceUpdate: z
2231
+ }), (A, Y) => (se(), Be(ir, $t({
2232
+ ref_key: "scroller",
2233
+ ref: c,
2234
+ items: ee(T),
2235
+ "min-item-size": n.minItemSize,
2236
+ direction: n.direction,
2237
+ cache: n.cache,
2238
+ "disable-transform": n.disableTransform,
2239
+ "flow-mode": n.flowMode,
2240
+ "hidden-position": n.hiddenPosition,
2241
+ enabled: n.enabled,
2242
+ "page-mode": n.pageMode,
2243
+ "scroll-parent": n.scrollParent,
2244
+ "key-field": "id",
2245
+ "list-tag": n.listTag,
2246
+ "item-tag": n.itemTag
2247
+ }, A.$attrs, {
2248
+ onResize: ee(K),
2249
+ onVisible: ee(le)
2250
+ }), pi({
2251
+ default: Ue(({ item: f, index: O, active: J }) => [
2252
+ Re(A.$slots, "default", hi(yi(_e(f, O, J))))
2253
+ ]),
2254
+ empty: Ue(() => [
2255
+ Re(A.$slots, "empty")
2256
+ ]),
2257
+ _: 2
2258
+ }, [
2259
+ A.$slots.before ? {
2260
+ name: "before",
2261
+ fn: Ue(() => [
2262
+ Re(A.$slots, "before")
2263
+ ]),
2264
+ key: "0"
2265
+ } : void 0,
2266
+ A.$slots.after ? {
2267
+ name: "after",
2268
+ fn: Ue(() => [
2269
+ Re(A.$slots, "after")
2270
+ ]),
2271
+ key: "1"
2272
+ } : void 0
2273
+ ]), 1040, ["items", "min-item-size", "direction", "cache", "disable-transform", "flow-mode", "hidden-position", "enabled", "page-mode", "scroll-parent", "list-tag", "item-tag", "onResize", "onVisible"]));
2274
+ }
2275
+ });
2276
+ function rr(e, t, i) {
2277
+ const n = yn("vscrollMeasurementContext"), l = yn("vscrollAnchorRegistry", null), c = E(() => {
2278
+ const w = R(e).el;
2279
+ return R(t ?? w);
2280
+ }), p = {
2281
+ onResize: (w) => (i?.onResize ?? R(e).onResize)?.(w)
2282
+ }, v = E(() => R(
2283
+ R(e).enabled ?? !0
2284
+ )), m = $n(e, c, n, p);
2285
+ let g = !1;
2286
+ function T() {
2287
+ g || (m.mount(), g = !0);
2288
+ }
2289
+ function z() {
2290
+ g && (m.unmount(), g = !1);
2291
+ }
2292
+ return Xt(() => {
2293
+ v.value && T();
2294
+ }), N(v, (w) => {
2295
+ if (w)
2296
+ T();
2297
+ else {
2298
+ const k = c.value;
2299
+ l && k && l.delete(k), z();
2300
+ }
2301
+ }), l && N(
2302
+ [m.id, m.finalActive, c, v],
2303
+ ([w, k, I, C], [B, P, q]) => {
2304
+ q && q !== I && l.delete(q), C && I && l.set(I, {
2305
+ active: k,
2306
+ id: w
2307
+ });
2308
+ },
2309
+ {
2310
+ immediate: !0
2311
+ }
2312
+ ), Lt(() => {
2313
+ const w = c.value;
2314
+ l && w && l.delete(w), z();
2315
+ }), {
2316
+ id: m.id,
2317
+ size: m.size,
2318
+ finalActive: m.finalActive,
2319
+ updateSize: m.updateSize
2320
+ };
2321
+ }
2322
+ const pr = /* @__PURE__ */ St({
2323
+ __name: "DynamicScrollerItem",
2324
+ props: {
2325
+ item: {},
2326
+ watchData: { type: Boolean, default: !1 },
2327
+ active: { type: Boolean },
2328
+ index: { default: void 0 },
2329
+ sizeDependencies: { default: null },
2330
+ emitResize: { type: Boolean, default: !1 },
2331
+ enabled: { type: Boolean, default: !0 },
2332
+ tag: { default: "div" }
2333
+ },
2334
+ emits: ["resize"],
2335
+ setup(e, { emit: t }) {
2336
+ const i = e, n = t, l = Se();
2337
+ return rr(
2338
+ i,
2339
+ l,
2340
+ {
2341
+ onResize: (c) => n("resize", c)
2342
+ }
2343
+ ), (c, p) => (se(), Be(nt(i.tag), {
2344
+ ref_key: "el",
2345
+ ref: l
2346
+ }, {
2347
+ default: Ue(() => [
2348
+ Re(c.$slots, "default")
2349
+ ]),
2350
+ _: 3
2351
+ }, 512));
2352
+ }
2353
+ });
2354
+ function lr(e, t, i, n, l) {
2355
+ return rn(
2356
+ e,
2357
+ t,
2358
+ i,
2359
+ n,
2360
+ l,
2361
+ {
2362
+ pageMode: !0
2363
+ }
2364
+ );
2365
+ }
2366
+ const hr = /* @__PURE__ */ St({
2367
+ __name: "WindowScroller",
2368
+ props: {
2369
+ items: {},
2370
+ keyField: { default: "id" },
2371
+ direction: { default: "vertical" },
2372
+ listTag: { default: "div" },
2373
+ itemTag: { default: "div" },
2374
+ itemSize: { default: null },
2375
+ gridItems: { default: void 0 },
2376
+ itemSecondarySize: { default: void 0 },
2377
+ minItemSize: { default: null },
2378
+ sizeField: { default: "size" },
2379
+ typeField: { default: "type" },
2380
+ buffer: { default: 200 },
2381
+ shift: { type: Boolean, default: !1 },
2382
+ cache: { default: void 0 },
2383
+ prerender: { default: 0 },
2384
+ emitUpdate: { type: Boolean, default: !1 },
2385
+ disableTransform: { type: Boolean, default: !1 },
2386
+ flowMode: { type: Boolean, default: !1 },
2387
+ hiddenPosition: { default: void 0 },
2388
+ updateInterval: { default: 0 },
2389
+ itemsLimit: { default: void 0 },
2390
+ enabled: { type: Boolean, default: !0 },
2391
+ listClass: { default: "" },
2392
+ itemClass: { default: "" }
2393
+ },
2394
+ emits: ["resize", "visible", "hidden", "update"],
2395
+ setup(e, { expose: t, emit: i }) {
2396
+ const n = e, l = i, c = jn, p = Se(), v = Se(), m = Se(), g = Zt(n, "items"), T = E(() => ({
2397
+ items: g,
2398
+ el: p,
2399
+ before: v,
2400
+ after: m,
2401
+ keyField: n.keyField,
2402
+ direction: n.direction,
2403
+ itemSize: n.itemSize,
2404
+ gridItems: n.gridItems,
2405
+ itemSecondarySize: n.itemSecondarySize,
2406
+ minItemSize: n.minItemSize,
2407
+ sizeField: n.sizeField,
2408
+ typeField: n.typeField,
2409
+ buffer: n.buffer,
2410
+ shift: n.shift,
2411
+ cache: n.cache,
2412
+ prerender: n.prerender,
2413
+ emitUpdate: n.emitUpdate,
2414
+ disableTransform: n.disableTransform,
2415
+ flowMode: n.flowMode,
2416
+ hiddenPosition: n.hiddenPosition,
2417
+ updateInterval: n.updateInterval,
2418
+ itemsLimit: n.itemsLimit,
2419
+ enabled: n.enabled,
2420
+ onResize: () => l("resize"),
2421
+ onVisible: () => l("visible"),
2422
+ onHidden: () => l("hidden"),
2423
+ onUpdate: (pe, Me, ie, xe) => l("update", pe, Me, ie, xe)
2424
+ })), z = lr(
2425
+ T
2426
+ ), {
2427
+ pool: w,
2428
+ totalSize: k,
2429
+ startSpacerSize: I,
2430
+ endSpacerSize: C,
2431
+ ready: B,
2432
+ scrollToItem: P,
2433
+ scrollToPosition: q,
2434
+ getScroll: te,
2435
+ findItemIndex: ve,
2436
+ getItemOffset: S,
2437
+ getItemSize: K,
2438
+ getViewStyle: le,
2439
+ cacheSnapshot: _e,
2440
+ restoreCache: Ce,
2441
+ updateVisibleItems: A,
2442
+ handleResize: Y,
2443
+ handleVisibilityChange: f
2444
+ } = z, O = E(
2445
+ () => yt({
2446
+ direction: n.direction,
2447
+ disableTransform: n.disableTransform,
2448
+ flowMode: n.flowMode,
2449
+ gridItems: n.gridItems
2450
+ }) === "flow"
2451
+ ), J = E(() => ({
2452
+ height: `${I.value}px`
2453
+ })), ne = E(() => ({
2454
+ height: `${C.value}px`
2455
+ }));
2456
+ return t({
2457
+ el: p,
2458
+ startSpacerSize: I,
2459
+ endSpacerSize: C,
2460
+ scrollToItem: P,
2461
+ scrollToPosition: q,
2462
+ getScroll: te,
2463
+ findItemIndex: ve,
2464
+ getItemOffset: S,
2465
+ getItemSize: K,
2466
+ cacheSnapshot: _e,
2467
+ restoreCache: Ce,
2468
+ updateVisibleItems: A
2469
+ }), (pe, Me) => Cn((se(), Qe("div", {
2470
+ ref_key: "el",
2471
+ ref: p,
2472
+ class: xt(["vue-recycle-scroller vue-window-scroller", {
2473
+ "flow-mode": O.value,
2474
+ ready: ee(B),
2475
+ [`direction-${n.direction}`]: !0
2476
+ }])
2477
+ }, [
2478
+ pe.$slots.before ? (se(), Qe("div", {
2479
+ key: 0,
2480
+ ref_key: "before",
2481
+ ref: v,
2482
+ class: "vue-recycle-scroller__slot"
2483
+ }, [
2484
+ Re(pe.$slots, "before")
2485
+ ], 512)) : Ne("", !0),
2486
+ (se(), Be(nt(n.listTag), {
2487
+ style: ut({ [n.direction === "vertical" ? "minHeight" : "minWidth"]: `${ee(k)}px` }),
2488
+ class: xt(["vue-recycle-scroller__item-wrapper", n.listClass])
2489
+ }, {
2490
+ default: Ue(() => [
2491
+ O.value && ee(I) > 0 ? (se(), Be(nt(n.itemTag), {
2492
+ key: 0,
2493
+ "aria-hidden": "true",
2494
+ class: "vue-recycle-scroller__item-spacer",
2495
+ style: ut(J.value)
2496
+ }, null, 8, ["style"])) : Ne("", !0),
2497
+ (se(!0), Qe(Vn, null, Pn(ee(w), (ie) => (se(), Be(qn, {
2498
+ key: ie.nr.id,
2499
+ view: ie,
2500
+ "item-tag": n.itemTag,
2501
+ style: ut(ee(B) ? ee(le)(ie) : null),
2502
+ class: xt(["vue-recycle-scroller__item-view", n.itemClass])
2503
+ }, {
2504
+ default: Ue((xe) => [
2505
+ Re(pe.$slots, "default", $t({ ref_for: !0 }, xe))
2506
+ ]),
2507
+ _: 3
2508
+ }, 8, ["view", "item-tag", "style", "class"]))), 128)),
2509
+ O.value && ee(C) > 0 ? (se(), Be(nt(n.itemTag), {
2510
+ key: 1,
2511
+ "aria-hidden": "true",
2512
+ class: "vue-recycle-scroller__item-spacer",
2513
+ style: ut(ne.value)
2514
+ }, null, 8, ["style"])) : Ne("", !0),
2515
+ n.items.length === 0 ? Re(pe.$slots, "empty", {}, void 0, void 0, 2) : Ne("", !0)
2516
+ ]),
2517
+ _: 3
2518
+ }, 8, ["style", "class"])),
2519
+ pe.$slots.after ? (se(), Qe("div", {
2520
+ key: 1,
2521
+ ref_key: "after",
2522
+ ref: m,
2523
+ class: "vue-recycle-scroller__slot"
2524
+ }, [
2525
+ Re(pe.$slots, "after")
2526
+ ], 512)) : Ne("", !0),
2527
+ On(Kn, { onNotify: ee(Y) }, null, 8, ["onNotify"])
2528
+ ], 2)), [
2529
+ [ee(c), ee(f)]
2530
+ ]);
2531
+ }
2532
+ });
2533
+ function yr({
2534
+ idProp: e = (t) => t.item.id
2535
+ } = {}) {
2536
+ const t = Yt({}), i = Se(null);
2537
+ let n = null;
2538
+ const l = gi();
2539
+ if (!l)
2540
+ throw new Error("[useIdState] Must be called inside setup()");
2541
+ const c = typeof e == "function" ? () => e(l.proxy) : () => l.proxy[e];
2542
+ function p(m) {
2543
+ const g = l.proxy.$options.idState;
2544
+ if (typeof g == "function") {
2545
+ const T = g.call(l.proxy, l.proxy);
2546
+ return t[m] = T, n = m, T;
2547
+ } else
2548
+ throw new TypeError("[useIdState] Missing `idState` function on component definition.");
2549
+ }
2550
+ function v() {
2551
+ const m = c();
2552
+ m == null && console.warn(`No id found for IdState with idProp: '${e}'.`), m !== n && (t[m] || p(m), i.value = t[m]);
2553
+ }
2554
+ return N(c, (m) => {
2555
+ tt(() => {
2556
+ n = m;
2557
+ });
2558
+ }, { immediate: !0 }), v(), Si(() => {
2559
+ v();
2560
+ }), {
2561
+ idState: i
2562
+ };
2563
+ }
2564
+ function or() {
2565
+ return new Promise((e) => {
2566
+ requestAnimationFrame(() => e());
2567
+ });
2568
+ }
2569
+ function sr(e) {
2570
+ if (e.borderBoxSize) {
2571
+ const t = Array.isArray(e.borderBoxSize) ? e.borderBoxSize[0] : e.borderBoxSize;
2572
+ if (t)
2573
+ return t.inlineSize;
2574
+ }
2575
+ return e.contentRect.width;
2576
+ }
2577
+ function Yn(e) {
2578
+ return (e.tHead ? [...e.tHead.rows] : []).at(-1) ?? null;
2579
+ }
2580
+ function Gn(e, t) {
2581
+ if (e.getAttribute("aria-hidden") === "true" || e.cells.length !== t)
2582
+ return !1;
2583
+ const i = getComputedStyle(e);
2584
+ return i.display === "none" || i.visibility === "hidden" ? !1 : e.getBoundingClientRect().width > 0;
2585
+ }
2586
+ function ar(e) {
2587
+ if (e.getAttribute("aria-hidden") === "true" || e.cells.length === 0)
2588
+ return !1;
2589
+ const t = getComputedStyle(e);
2590
+ return t.display === "none" || t.visibility === "hidden" ? !1 : e.getBoundingClientRect().width > 0;
2591
+ }
2592
+ function ur(e, t) {
2593
+ for (const i of [...e.tBodies])
2594
+ for (const n of [...i.rows])
2595
+ if (Gn(n, t))
2596
+ return n;
2597
+ return null;
2598
+ }
2599
+ function cr(e) {
2600
+ const t = Yn(e);
2601
+ if (t?.cells.length)
2602
+ return t.cells.length;
2603
+ for (const i of [...e.tBodies])
2604
+ for (const n of [...i.rows])
2605
+ if (ar(n))
2606
+ return n.cells.length;
2607
+ return 0;
2608
+ }
2609
+ function En(e, t) {
2610
+ for (const [i, n] of [...e.cells].entries())
2611
+ t[i] = Math.max(t[i] ?? 0, Math.ceil(n.getBoundingClientRect().width));
2612
+ }
2613
+ function dr(e) {
2614
+ const t = cr(e);
2615
+ if (!t)
2616
+ return [];
2617
+ const i = Array.from({ length: t }, (c, p) => p).fill(0), n = Yn(e);
2618
+ if (n && n.cells.length === t && n.getBoundingClientRect().width > 0 && En(n, i), !ur(e, t) && !n)
2619
+ return [];
2620
+ for (const c of [...e.tBodies])
2621
+ for (const p of [...c.rows])
2622
+ Gn(p, t) && En(p, i);
2623
+ return i.some((c) => c > 0) ? i : [];
2624
+ }
2625
+ function gr(e) {
2626
+ const t = vt([]), i = E(() => t.value), n = E(() => t.value.length > 0), l = E(() => t.value.length > 0 ? { tableLayout: "fixed" } : void 0);
2627
+ function c() {
2628
+ return R(e.disabled) || R(e.enabled ?? !0) === !1;
2629
+ }
2630
+ let p = !0, v = null, m = null, g = !1, T = !1, z = !1;
2631
+ const w = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver((B) => {
2632
+ for (const P of B) {
2633
+ if (P.target !== v)
2634
+ continue;
2635
+ const q = sr(P);
2636
+ q !== m && (m = q, C());
2637
+ }
2638
+ });
2639
+ function k() {
2640
+ t.value = [];
2641
+ }
2642
+ async function I() {
2643
+ if (T) {
2644
+ z = !0;
2645
+ return;
2646
+ }
2647
+ T = !0, k(), await tt(), await or(), g = !1;
2648
+ const B = R(e.table);
2649
+ p && B && !c() && (t.value = dr(B)), T = !1, z && (z = !1, C());
2650
+ }
2651
+ function C() {
2652
+ if (p) {
2653
+ if (c() || !R(e.table)) {
2654
+ k();
2655
+ return;
2656
+ }
2657
+ if (g) {
2658
+ z = !0;
2659
+ return;
2660
+ }
2661
+ g = !0, I();
2662
+ }
2663
+ }
2664
+ return N(
2665
+ () => [R(e.table), c()],
2666
+ ([B, P], q) => {
2667
+ const te = q?.[0];
2668
+ if (te && w && w.unobserve(te), v = B ?? null, m = B?.getBoundingClientRect().width ?? null, !B || P) {
2669
+ k();
2670
+ return;
2671
+ }
2672
+ w?.observe(B), C();
2673
+ },
2674
+ {
2675
+ immediate: !0,
2676
+ flush: "post"
2677
+ }
2678
+ ), N(
2679
+ () => R(e.dependencies) ?? null,
2680
+ () => {
2681
+ !c() && R(e.table) && C();
2682
+ },
2683
+ {
2684
+ deep: !0,
2685
+ flush: "post"
2686
+ }
2687
+ ), Lt(() => {
2688
+ p = !1, w?.disconnect();
2689
+ }), {
2690
+ columnWidths: i,
2691
+ hasLockedWidths: n,
2692
+ tableStyle: l,
2693
+ scheduleMeasure: C,
2694
+ clear: k
2695
+ };
2696
+ }
2697
+ export {
2698
+ vr as DynamicScroller,
2699
+ pr as DynamicScrollerItem,
2700
+ ir as RecycleScroller,
2701
+ hr as WindowScroller,
2702
+ Ji as useDynamicScroller,
2703
+ rr as useDynamicScrollerItem,
2704
+ yr as useIdState,
2705
+ rn as useRecycleScroller,
2706
+ gr as useTableColumnWidths,
2707
+ lr as useWindowScroller
2708
+ };