vue-virtual-flow 0.0.7 → 0.0.8

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,51 +1,96 @@
1
- import { watch as le, defineComponent as $e, ref as P, computed as i, nextTick as O, onMounted as ke, onUpdated as Ae, onBeforeUnmount as Le, openBlock as x, createElementBlock as T, normalizeStyle as C, createElementVNode as De, renderSlot as ie, createTextVNode as Ie, createCommentVNode as xe, Fragment as ze, renderList as Ee, unref as c, normalizeClass as Be, toDisplayString as Oe } from "vue";
2
- function Ye(a) {
3
- return typeof a == "string" || typeof a == "number" || typeof a == "symbol";
1
+ import { watch as ie, defineComponent as Oe, ref as U, computed as n, nextTick as K, onMounted as Ce, onUpdated as Je, onBeforeUnmount as Pe, openBlock as I, createElementBlock as $, normalizeStyle as N, createElementVNode as je, renderSlot as ce, createTextVNode as Ve, createCommentVNode as ze, Fragment as He, renderList as Ae, unref as u, normalizeClass as We, toDisplayString as Ge } from "vue";
2
+ function tt(l) {
3
+ return typeof l == "string" || typeof l == "number" || typeof l == "symbol";
4
4
  }
5
- function Pe(a, _) {
6
- const E = a[_];
7
- return Ye(E) ? E : void 0;
5
+ function Ze(l, C) {
6
+ const x = l[C];
7
+ return tt(x) ? x : void 0;
8
8
  }
9
- function _e(a) {
10
- return Pe(a, "id") ?? Pe(a, "key");
9
+ function lt(l) {
10
+ return Ze(l, "id") ?? Ze(l, "key");
11
11
  }
12
- function He(a) {
13
- function _(e, y) {
14
- const f = a.itemKey();
15
- if (typeof f == "function")
16
- return f(e, y);
12
+ function De(l) {
13
+ function C(e, m) {
14
+ const c = l.itemKey();
15
+ if (typeof c == "function")
16
+ return c(e, m);
17
17
  if (e !== null && typeof e == "object") {
18
- if (f !== void 0) {
19
- const r = Pe(e, f);
20
- if (r !== void 0) return r;
18
+ if (c !== void 0) {
19
+ const o = Ze(e, c);
20
+ if (o !== void 0) return o;
21
21
  }
22
- const S = _e(e);
23
- if (S !== void 0) return S;
22
+ const r = lt(e);
23
+ if (r !== void 0) return r;
24
24
  }
25
- return y;
25
+ return m;
26
26
  }
27
- function E() {
27
+ function x() {
28
28
  }
29
- return le(
30
- () => [a.itemKey(), a.items()],
31
- E,
29
+ return ie(
30
+ () => [l.itemKey(), l.items()],
31
+ x,
32
32
  { immediate: !0 }
33
- ), { getItemKey: _ };
33
+ ), { getItemKey: C };
34
34
  }
35
- function Ve(a) {
36
- return a === "fill" ? "100%" : typeof a == "number" ? `${a}px` : a;
35
+ function Ye(l) {
36
+ return l === "fill" ? "100%" : typeof l == "number" ? `${l}px` : l;
37
37
  }
38
- function Ce(a) {
39
- return (_, E) => {
40
- typeof E == "string" && (E === "fill" || E.trim().endsWith("%"));
38
+ function Ue(l) {
39
+ return (C, x) => {
40
+ typeof x == "string" && (x === "fill" || x.trim().endsWith("%"));
41
41
  };
42
42
  }
43
- const Ge = ["aria-label"], je = {
43
+ function at(l) {
44
+ const C = Float64Array.from(l), x = C.length, e = new Float64Array(x + 1);
45
+ let m = 0;
46
+ for (let r = 1; r <= x; r += 1) {
47
+ const o = C[r - 1];
48
+ m += o, e[r] += o;
49
+ const f = r + (r & -r);
50
+ f <= x && (e[f] += e[r]);
51
+ }
52
+ let c = 1;
53
+ for (; c * 2 <= x; ) c *= 2;
54
+ return {
55
+ length: x,
56
+ get total() {
57
+ return m;
58
+ },
59
+ getSize(r) {
60
+ return C[r];
61
+ },
62
+ getOffset(r) {
63
+ let o = 0;
64
+ for (let f = r; f > 0; f -= f & -f)
65
+ o += e[f];
66
+ return o;
67
+ },
68
+ setSize(r, o) {
69
+ const f = o - C[r];
70
+ if (f !== 0) {
71
+ C[r] = o, m += f;
72
+ for (let O = r + 1; O <= x; O += O & -O)
73
+ e[O] += f;
74
+ }
75
+ },
76
+ findIndex(r) {
77
+ if (x === 0 || r <= 0) return 0;
78
+ if (r >= m) return x - 1;
79
+ let o = 0, f = 0;
80
+ for (let O = c; O > 0; O = Math.floor(O / 2)) {
81
+ const P = o + O;
82
+ P <= x && f + e[P] <= r && (o = P, f += e[P]);
83
+ }
84
+ return Math.min(o, x - 1);
85
+ }
86
+ };
87
+ }
88
+ const ot = ["aria-label"], nt = {
44
89
  key: 0,
45
90
  class: "vue-chat-virtual-scroll__loading-older",
46
91
  role: "status",
47
92
  "aria-live": "polite"
48
- }, Ue = ["aria-posinset", "aria-setsize"], Ze = /* @__PURE__ */ $e({
93
+ }, it = ["aria-posinset", "aria-setsize"], st = /* @__PURE__ */ Oe({
49
94
  name: "ChatVirtualScroll",
50
95
  __name: "ChatVirtualScroll",
51
96
  props: {
@@ -64,343 +109,376 @@ const Ge = ["aria-label"], je = {
64
109
  loadOlderThreshold: { default: 120 }
65
110
  },
66
111
  emits: ["scroll", "loadOlder", "bottomChange"],
67
- setup(a, { expose: _, emit: E }) {
68
- const e = a, y = E, f = P(), S = P(0), r = P(0), H = P(0), U = P(0), F = P(!0), W = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
69
- let L, p, I = -1, w = !1, A = !1, V = !1, N, K = 0, ee = !1, $ = 0;
70
- const X = Ce(), { getItemKey: B } = He({
112
+ setup(l, { expose: C, emit: x }) {
113
+ const e = l, m = x, c = U(), r = U(0), o = U(0), f = U(0), O = U(0), P = U(!0), Q = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Set();
114
+ let L, p, z = -1, Y = !1, j = !1, A = !1, ne, W = 0, k = !1, te = 0, R, ae, G, se = 0;
115
+ const ue = Ue(), { getItemKey: y } = De({
71
116
  componentName: "ChatVirtualScroll",
72
117
  items: () => e.items,
73
118
  itemKey: () => e.itemKey
74
- }), q = i(
75
- () => Math.max(1, e.estimatedItemSize)
76
- ), ae = i(() => Math.max(0, Math.floor(e.overscan))), he = i(
119
+ }), w = n(
120
+ () => Number.isFinite(e.estimatedItemSize) ? Math.max(1, e.estimatedItemSize) : 48
121
+ ), q = n(() => Math.max(0, Math.floor(e.overscan))), he = n(
77
122
  () => e.size !== void 0 && Number.isFinite(e.size) && e.size > 0 ? Math.max(1, Math.floor(e.size)) : void 0
78
- ), oe = i(() => H.value > 0 ? H.value : typeof e.height == "number" ? Math.max(0, e.height) : q.value), v = i(() => {
79
- U.value;
80
- const t = new Array(e.items.length + 1), n = new Array(e.items.length);
81
- t[0] = 0;
82
- for (let u = 0; u < e.items.length; u += 1) {
83
- const g = B(e.items[u], u), R = W.get(g) ?? q.value;
84
- n[u] = R, t[u + 1] = t[u] + R;
85
- }
123
+ ), ee = n(() => f.value > 0 ? f.value : typeof e.height == "number" ? Math.max(0, e.height) : w.value), de = n(() => {
124
+ const i = e.items.map((v, M) => y(v, M));
86
125
  return {
87
- offsets: t,
88
- sizes: n,
89
- total: t[e.items.length] ?? 0
126
+ keys: i,
127
+ indexes: new Map(i.map((v, M) => [v, M])),
128
+ sizes: at(i.map((v) => Q.get(v) ?? w.value))
90
129
  };
91
- }), M = i(() => {
92
- const t = /* @__PURE__ */ new Map();
93
- return e.items.forEach((n, u) => {
94
- t.set(B(n, u), u);
95
- }), t;
96
- });
97
- function D(t) {
98
- if (e.items.length === 0) return 0;
99
- const n = v.value.offsets;
100
- let u = 0, g = e.items.length;
101
- for (; u < g; ) {
102
- const R = Math.floor((u + g) / 2);
103
- n[R + 1] <= t ? u = R + 1 : g = R;
104
- }
105
- return Math.min(u, e.items.length - 1);
130
+ }), D = n(() => (O.value, { sizes: de.value.sizes, total: de.value.sizes.total }));
131
+ function F(i = D.value.total) {
132
+ return Math.max(0, i - ee.value);
133
+ }
134
+ function ve(i) {
135
+ return D.value.sizes.findIndex(i);
106
136
  }
107
- const ve = i(() => {
137
+ r.value = e.initialScroll === "bottom" ? F() : 0;
138
+ const ge = n(() => {
108
139
  if (e.items.length === 0) return { start: 0, end: 0 };
109
- const t = D(S.value), n = D(S.value + oe.value) + 1, u = Math.max(0, t - ae.value), g = Math.min(
140
+ const i = ve(r.value), v = ve(r.value + ee.value) + 1, M = Math.max(0, i - q.value), H = Math.min(
110
141
  e.items.length,
111
- n + ae.value
112
- ), R = he.value;
113
- if (R === void 0 || g - u <= R) return { start: u, end: g };
114
- const Q = Math.max(0, R - (n - t)), re = t - u, ce = g - n;
115
- let de = Math.min(re, Math.ceil(Q / 2));
116
- const Se = Math.min(ce, Q - de);
117
- return de = Math.min(re, Q - Se), { start: t - de, end: n + Se };
118
- }), te = i(() => ve.value.start), ye = i(() => ve.value.end), ne = i(
119
- () => e.items.slice(te.value, ye.value).map((t, n) => {
120
- const u = te.value + n;
142
+ v + q.value
143
+ ), ye = he.value;
144
+ if (ye === void 0 || H - M <= ye) return { start: M, end: H };
145
+ const we = Math.max(0, ye - (v - i)), Te = i - M, Se = H - v;
146
+ let Le = Math.min(Te, Math.ceil(we / 2));
147
+ const $e = Math.min(Se, we - Le);
148
+ return Le = Math.min(Te, we - $e), { start: i - Le, end: v + $e };
149
+ }), g = n(() => ge.value.start), E = n(() => ge.value.end), B = n(
150
+ () => e.items.slice(g.value, E.value).map((i, v) => {
151
+ const M = g.value + v;
121
152
  return {
122
- item: t,
123
- index: u,
124
- key: B(t, u),
125
- top: v.value.offsets[u] - r.value
153
+ item: i,
154
+ index: M,
155
+ key: y(i, M),
156
+ bottom: Math.max(D.value.total, ee.value) - D.value.sizes.getOffset(M + 1) + o.value
126
157
  };
127
158
  })
128
- ), fe = i(() => ({
129
- height: Ve(e.height)
159
+ ), le = n(() => ({
160
+ height: Ye(e.height)
130
161
  }));
131
- function J() {
132
- var t;
133
- return (((t = f.value) == null ? void 0 : t.scrollTop) ?? 0) + K;
162
+ function oe(i = D.value.total) {
163
+ var H;
164
+ const v = F(i), M = Math.min(0, ((H = c.value) == null ? void 0 : H.scrollTop) ?? 0);
165
+ return Math.max(0, Math.min(v, v + M + W));
166
+ }
167
+ function re(i = !1) {
168
+ if (k || (A || G) && !i || W === 0) return;
169
+ k = !0;
170
+ const v = se, M = ++te;
171
+ o.value = 0, K(() => {
172
+ if (M !== te) return;
173
+ k = !1;
174
+ const H = c.value;
175
+ !H || v !== se || W === 0 || (W = 0, H.scrollTop = Math.min(0, r.value - F()), ae = H.scrollTop, r.value = oe(), b(), me());
176
+ });
134
177
  }
135
- function me() {
136
- ee || (ee = !0, O(() => {
137
- ee = !1;
138
- const t = f.value;
139
- !t || V || K === 0 || (K = 0, t.scrollTop = S.value, S.value = t.scrollTop, ue(), s());
140
- }));
178
+ function Me(i) {
179
+ const v = c.value;
180
+ if (v) {
181
+ if (W += i, r.value = oe(), W === 0 || F() === 0) {
182
+ W = 0, o.value = 0;
183
+ return;
184
+ }
185
+ (A || G) && !k ? (o.value = W, v.scrollTop >= -1 && re(!0)) : re();
186
+ }
141
187
  }
142
- function m(t) {
143
- !f.value || t === 0 || (K += t, S.value = J(), V ? r.value = K : me());
188
+ function _() {
189
+ clearTimeout(ne), ne = void 0;
144
190
  }
145
- function b() {
146
- clearTimeout(N), N = void 0;
191
+ function J() {
192
+ if (j) return;
193
+ _(), A = !1;
194
+ const i = G;
195
+ if (G = void 0, i) {
196
+ i();
197
+ return;
198
+ }
199
+ r.value = oe(), re();
147
200
  }
148
- function z() {
149
- A || (b(), V = !1, S.value = J(), r.value = 0, me());
201
+ function s() {
202
+ _(), (A || G) && !j && (ne = setTimeout(J, 150));
150
203
  }
151
- function G() {
152
- b(), V && !A && (N = setTimeout(z, 150));
204
+ function t() {
205
+ R = void 0, G = void 0;
153
206
  }
154
- function Me() {
155
- b(), A = !0, V = !0, r.value = K;
207
+ function a() {
208
+ t(), _(), j = !0, A = !0, o.value = W;
156
209
  }
157
- function se(t) {
158
- A = t.touches.length > 0, G();
210
+ function h(i) {
211
+ j = i.touches.length > 0, s();
159
212
  }
160
- function ue() {
161
- const t = f.value;
162
- if (!t) return;
163
- const u = Math.max(
213
+ function b() {
214
+ const i = c.value;
215
+ if (!i) return;
216
+ const M = Math.max(
164
217
  0,
165
- v.value.total - J() - t.clientHeight
218
+ D.value.total - oe() - i.clientHeight
166
219
  ) <= Math.max(0, e.bottomThreshold);
167
- u !== F.value && (F.value = u, w && y("bottomChange", u));
220
+ M !== P.value && (P.value = M, Y && m("bottomChange", M));
168
221
  }
169
- function Y() {
170
- var t;
171
- H.value = ((t = f.value) == null ? void 0 : t.clientHeight) ?? 0, X(f.value, e.height), O(() => {
172
- ue(), s();
222
+ function xe() {
223
+ var i;
224
+ f.value = ((i = c.value) == null ? void 0 : i.clientHeight) ?? 0, Y && (r.value = oe()), ue(c.value, e.height), K(() => {
225
+ b(), me();
173
226
  });
174
227
  }
175
- function j() {
176
- var t;
177
- K < 0 && J() < 0 && (K = -Math.max(0, ((t = f.value) == null ? void 0 : t.scrollTop) ?? 0), V && (r.value = K)), S.value = J(), G(), ue(), y("scroll", {
178
- scrollTop: S.value,
179
- startIndex: te.value,
180
- endIndex: ye.value
181
- }), s();
228
+ function pe() {
229
+ var i, v;
230
+ R && ae !== void 0 && Math.abs((((i = c.value) == null ? void 0 : i.scrollTop) ?? 0) - ae) > 1 && t(), r.value = oe(), W !== 0 && (((v = c.value) == null ? void 0 : v.scrollTop) ?? 0) >= -1 && re(!0), s(), b(), m("scroll", {
231
+ scrollTop: r.value,
232
+ startIndex: g.value,
233
+ endIndex: E.value
234
+ }), me();
182
235
  }
183
- function s() {
184
- const t = f.value;
185
- !w || !t || !e.hasOlder || e.loadingOlder || I === e.items.length || J() <= Math.max(0, e.loadOlderThreshold) && (I = e.items.length, y("loadOlder"));
186
- }
187
- function l(t) {
188
- const n = t.borderBoxSize;
189
- if (n) {
190
- const u = Array.isArray(n) ? n[0] : n;
191
- if (u != null && u.blockSize) return u.blockSize;
236
+ function me() {
237
+ const i = c.value;
238
+ !Y || !i || !e.hasOlder || e.loadingOlder || z === e.items.length || oe() <= Math.max(0, e.loadOlderThreshold) && (z = e.items.length, m("loadOlder"));
239
+ }
240
+ function Ee(i) {
241
+ const v = i.borderBoxSize;
242
+ if (v) {
243
+ const M = Array.isArray(v) ? v[0] : v;
244
+ if (M != null && M.blockSize) return M.blockSize;
192
245
  }
193
- return t.contentRect.height;
194
- }
195
- function o(t) {
196
- const n = v.value, u = J(), g = !V && F.value && e.stickToBottom;
197
- let R = 0, Q = !1;
198
- for (const ce of t) {
199
- const de = ce.target, Se = Z.get(de), Re = l(ce);
200
- if (Se === void 0 || Re <= 0) continue;
201
- const Fe = W.get(Se) ?? q.value;
202
- if (Math.abs(Fe - Re) < 0.5) continue;
203
- const We = M.value.get(Se);
204
- We !== void 0 && n.offsets[We + 1] <= u && (R += Re - Fe), W.set(Se, Re), Q = !0;
246
+ return i.contentRect.height;
247
+ }
248
+ function ke(i) {
249
+ const v = D.value.total, M = oe(), H = !A && !G && P.value && e.stickToBottom && (Y || e.initialScroll === "bottom"), ye = ve(M + ee.value - 1), we = !H && M <= 0;
250
+ let Te = 0, Se = !1;
251
+ for (const { key: Qe, height: Fe } of i) {
252
+ if (!Number.isFinite(Fe) || Fe <= 0) continue;
253
+ const _e = de.value.indexes.get(Qe);
254
+ if (_e === void 0) continue;
255
+ const Xe = D.value.sizes.getSize(_e);
256
+ Q.set(Qe, Fe), !(Math.abs(Xe - Fe) < 0.5) && (_e <= ye && (Te += Fe - Xe), D.value.sizes.setSize(_e, Fe), Se = !0);
205
257
  }
206
- if (!Q) return;
207
- U.value += 1;
208
- const re = f.value;
209
- re && (m(g ? Math.max(0, v.value.total - re.clientHeight) - u : R), O(ue));
210
- }
211
- function h(t, n) {
212
- t instanceof HTMLElement && Z.get(t) !== n && (Z.set(t, n), p == null || p.observe(t));
258
+ if (!Se) return;
259
+ O.value += 1;
260
+ const Le = F() - F(v), $e = R && de.value.indexes.get(R.key), Ne = $e !== void 0 && R ? Ie($e, R.align) : H ? F() : we ? 0 : M + Te;
261
+ Me(Ne - M - Le), K(b);
262
+ }
263
+ function d(i) {
264
+ const v = [];
265
+ for (const M of i) {
266
+ const H = X.get(M.target);
267
+ H !== void 0 && v.push({ key: H, height: Ee(M) });
268
+ }
269
+ ke(v);
213
270
  }
214
- function k() {
215
- for (const [t] of Z)
216
- t.isConnected || (p == null || p.unobserve(t), Z.delete(t));
217
- }
218
- function ge(t, n, u = !1) {
219
- const g = f.value;
220
- if (!g) return;
221
- const R = J(), Q = r.value !== 0, re = ++$, ce = n.behavior ?? "auto";
222
- K = 0, r.value = 0, V = !1, b(), ce === "auto" && (S.value = t);
223
- const de = () => {
224
- f.value !== g || re !== $ || (Q && ce !== "auto" && (g.scrollTop = R), u && ce === "auto" ? g.scrollTop = t : g.scrollTo({ ...n, top: t, behavior: ce }), O(ue));
271
+ function S() {
272
+ const i = [];
273
+ for (const v of V) {
274
+ const M = X.get(v);
275
+ M !== void 0 && v.isConnected && i.push({ key: M, height: v.getBoundingClientRect().height });
276
+ }
277
+ V.clear(), ke(i);
278
+ }
279
+ function T(i, v) {
280
+ i instanceof HTMLElement && X.get(i) !== v && (X.set(i, v), Q.has(v) || V.add(i), p == null || p.observe(i));
281
+ }
282
+ function fe() {
283
+ for (const [i] of X)
284
+ i.isConnected || (p == null || p.unobserve(i), X.delete(i), V.delete(i));
285
+ }
286
+ function Z(i, v, M = !1) {
287
+ const H = c.value;
288
+ if (!H) return;
289
+ const ye = oe(), we = o.value !== 0, Te = ++se;
290
+ te += 1, k = !1, R = void 0;
291
+ const Se = v.behavior ?? "auto";
292
+ G = Se === "smooth" ? () => be(i) : void 0, W = 0, o.value = 0, A = !1, _(), Se === "auto" && (r.value = i);
293
+ const Le = () => {
294
+ c.value !== H || Te !== se || (we && Se !== "auto" && (H.scrollTop = ye - F()), M && Se === "auto" ? H.scrollTop = i - F() : H.scrollTo({ ...v, top: i - F(), behavior: Se }), ae = H.scrollTop, Se === "auto" ? r.value = oe() : s(), K(b));
225
295
  };
226
- Q ? O(de) : de();
227
- }
228
- function pe(t, n = {}) {
229
- const u = f.value;
230
- if (!u) return;
231
- const g = Math.max(0, v.value.total - u.clientHeight), R = Math.min(
232
- Math.max(0, Number.isFinite(t) ? t : 0),
233
- g
234
- );
235
- ge(R, n);
236
- }
237
- function we(t, n = {}) {
238
- const u = f.value;
239
- if (!u || e.items.length === 0) return;
240
- const g = Math.min(
241
- e.items.length - 1,
242
- Math.max(0, Math.floor(t))
243
- ), { align: R = "start", ...Q } = n, re = v.value.sizes[g];
244
- let ce = v.value.offsets[g];
245
- R === "center" ? ce -= (u.clientHeight - re) / 2 : R === "end" && (ce -= u.clientHeight - re);
246
- const de = Math.max(
247
- 0,
248
- Math.min(ce, v.value.total - u.clientHeight)
296
+ we ? K(Le) : Le();
297
+ }
298
+ function be(i, v = {}) {
299
+ const M = c.value;
300
+ if (!M) return;
301
+ const H = Math.max(0, D.value.total - M.clientHeight), ye = Math.min(
302
+ Math.max(0, Number.isFinite(i) ? i : 0),
303
+ H
249
304
  );
250
- ge(de, Q);
251
- }
252
- function be(t = "auto") {
253
- ge(0, { behavior: t });
305
+ Z(ye, v);
254
306
  }
255
- function Te(t = "auto") {
256
- const n = f.value;
257
- if (!n) return;
258
- const u = Math.max(0, v.value.total - n.clientHeight);
259
- ge(u, { behavior: t }, !0);
307
+ function Ie(i, v) {
308
+ const M = D.value.sizes.getSize(i);
309
+ let H = D.value.sizes.getOffset(i);
310
+ return v === "center" ? H -= (ee.value - M) / 2 : v === "end" && (H -= ee.value - M), Math.max(0, Math.min(H, F()));
260
311
  }
261
- let d = e.items.map((t, n) => B(t, n));
262
- return le(
263
- () => e.items.map((t, n) => B(t, n)),
264
- async (t) => {
265
- const n = d;
266
- d = t;
267
- const u = f.value, g = !V && F.value && e.stickToBottom, R = n[0], Q = R === void 0 ? 0 : t.indexOf(R), re = Q > 0 ? t.slice(0, Q).reduce(
268
- (de, Se) => de + (W.get(Se) ?? q.value),
269
- 0
270
- ) : 0, ce = new Set(t);
271
- for (const de of W.keys())
272
- ce.has(de) || W.delete(de);
273
- U.value += 1, re > 0 ? m(re) : u && t.length > n.length && g ? m(
274
- Math.max(0, v.value.total - u.clientHeight) - J()
275
- ) : (t.length === 0 || Q < 0) && (K = 0, r.value = 0), await O(), f.value && (S.value = J(), ue(), s());
312
+ function Be(i, v = {}) {
313
+ if (!c.value || e.items.length === 0) return;
314
+ const M = Math.min(
315
+ e.items.length - 1,
316
+ Math.max(0, Math.floor(Number.isFinite(i) ? i : 0))
317
+ ), { align: H = "start", ...ye } = v;
318
+ Z(Ie(M, H), ye);
319
+ const we = de.value.keys[M];
320
+ v.behavior === "smooth" ? G = () => {
321
+ const Te = de.value.indexes.get(we);
322
+ Te !== void 0 && Be(Te, { align: H });
323
+ } : R = { key: we, align: H };
324
+ }
325
+ function Ke(i = "auto") {
326
+ Z(0, { behavior: i });
327
+ }
328
+ function Re(i = "auto") {
329
+ const v = c.value;
330
+ if (!v) return;
331
+ const M = Math.max(0, D.value.total - v.clientHeight);
332
+ Z(M, { behavior: i }, !0), i === "smooth" && (G = () => Re());
333
+ }
334
+ return ie(
335
+ de,
336
+ async (i, v) => {
337
+ const M = v.sizes.total, H = oe(M), ye = !A && !G && P.value && e.stickToBottom, we = v.sizes.findIndex(H + ee.value - 1), Te = v.keys[we], Se = Te === void 0 ? void 0 : i.indexes.get(Te), Le = F() - F(M);
338
+ for (const $e of Q.keys())
339
+ i.indexes.has($e) || Q.delete($e);
340
+ if (i.keys.length === 0 || Se === void 0) {
341
+ W = 0, o.value = 0, r.value = ye ? F() : Math.min(H, F());
342
+ const $e = r.value, Ne = se;
343
+ await K(), Ne === se && de.value === i && Z($e, {}, !0);
344
+ } else {
345
+ const $e = i.sizes.getOffset(Se + 1) - v.sizes.getOffset(we + 1), Ne = ye ? F() : H + $e;
346
+ Me(Ne - H - Le), await K();
347
+ }
348
+ c.value && (r.value = oe(), b(), me());
276
349
  }
277
- ), le(
350
+ ), ie(
278
351
  () => [e.hasOlder, e.loadingOlder],
279
- async ([t]) => {
280
- t || (I = -1), await O(), s();
352
+ async ([i]) => {
353
+ i || (z = -1), await K(), me();
281
354
  }
282
- ), ke(() => {
283
- if (Y(), typeof ResizeObserver < "u") {
284
- L = new ResizeObserver(Y), p = new ResizeObserver(o), f.value && L.observe(f.value);
285
- for (const [t] of Z)
286
- p.observe(t);
355
+ ), Ce(() => {
356
+ if (xe(), c.value && (c.value.scrollTop = e.initialScroll === "bottom" ? 0 : -F(), r.value = oe()), S(), typeof ResizeObserver < "u") {
357
+ L = new ResizeObserver(xe), p = new ResizeObserver(d), c.value && L.observe(c.value);
358
+ for (const [i] of X)
359
+ p.observe(i);
287
360
  }
288
- O(() => {
289
- e.initialScroll === "bottom" && Te("auto"), w = !0, ue(), s();
361
+ K(() => {
362
+ Y = !0, b(), me();
290
363
  });
291
- }), Ae(k), Le(() => {
292
- w = !1, b(), K = 0, $ += 1, L && (L.disconnect(), L = void 0), p && (p.disconnect(), p = void 0), Z.clear();
293
- }), _({
294
- isAtBottom: F,
295
- scrollTo: pe,
296
- scrollToIndex: we,
297
- scrollToTop: be,
298
- scrollToBottom: Te
299
- }), (t, n) => (x(), T("div", {
364
+ }), Je(() => {
365
+ fe(), S();
366
+ }), Pe(() => {
367
+ Y = !1, _(), t(), W = 0, se += 1, te += 1, L && (L.disconnect(), L = void 0), p && (p.disconnect(), p = void 0), X.clear(), V.clear();
368
+ }), C({
369
+ isAtBottom: P,
370
+ scrollTo: be,
371
+ scrollToIndex: Be,
372
+ scrollToTop: Ke,
373
+ scrollToBottom: Re
374
+ }), (i, v) => (I(), $("div", {
300
375
  ref_key: "viewport",
301
- ref: f,
376
+ ref: c,
302
377
  class: "vue-chat-virtual-scroll",
303
- style: C(fe.value),
378
+ style: N(le.value),
304
379
  role: "log",
305
- "aria-label": a.ariaLabel,
380
+ "aria-label": l.ariaLabel,
306
381
  "aria-live": "polite",
307
382
  tabindex: "0",
308
- onScrollPassive: j,
309
- onScrollendPassive: z,
310
- onTouchstartPassive: Me,
311
- onTouchendPassive: se,
312
- onTouchcancelPassive: se
383
+ onScrollPassive: pe,
384
+ onScrollendPassive: J,
385
+ onPointerdownPassive: t,
386
+ onWheelPassive: t,
387
+ onKeydown: t,
388
+ onTouchstartPassive: a,
389
+ onTouchendPassive: h,
390
+ onTouchcancelPassive: h
313
391
  }, [
314
- a.loadingOlder ? (x(), T("div", je, [
315
- De("div", null, [
316
- ie(t.$slots, "loadingOlder", {}, () => [
317
- n[0] || (n[0] = Ie("Loading older messages…", -1))
318
- ])
319
- ])
320
- ])) : xe("", !0),
321
- a.items.length ? (x(), T("div", {
322
- key: 1,
392
+ je("div", {
323
393
  class: "vue-chat-virtual-scroll__spacer",
324
- style: C({ height: `${Math.max(0, v.value.total - r.value)}px` })
394
+ style: N({ height: `${Math.max(ee.value, D.value.total + o.value)}px` })
325
395
  }, [
326
- (x(!0), T(ze, null, Ee(ne.value, ({ item: u, index: g, key: R, top: Q }) => (x(), T("div", {
327
- key: R,
396
+ l.loadingOlder ? (I(), $("div", nt, [
397
+ je("div", null, [
398
+ ce(i.$slots, "loadingOlder", {}, () => [
399
+ v[0] || (v[0] = Ve("Loading older messages…", -1))
400
+ ])
401
+ ])
402
+ ])) : ze("", !0),
403
+ (I(!0), $(He, null, Ae(B.value, ({ item: M, index: H, key: ye, bottom: we }) => (I(), $("div", {
404
+ key: ye,
328
405
  ref_for: !0,
329
- ref: (re) => h(re, R),
406
+ ref: (Te) => T(Te, ye),
330
407
  class: "vue-chat-virtual-scroll__item",
331
- style: C({ transform: `translateY(${Q}px)` }),
408
+ style: N({ transform: `translateY(${-we}px)` }),
332
409
  role: "article",
333
- "aria-posinset": g + 1,
334
- "aria-setsize": a.items.length
410
+ "aria-posinset": H + 1,
411
+ "aria-setsize": l.items.length
335
412
  }, [
336
- ie(t.$slots, "default", {
337
- item: u,
338
- index: g
413
+ ce(i.$slots, "default", {
414
+ item: M,
415
+ index: H
339
416
  })
340
- ], 12, Ue))), 128))
341
- ], 4)) : ie(t.$slots, "empty", {}, void 0, void 0, 2)
342
- ], 44, Ge));
417
+ ], 12, it))), 128)),
418
+ l.items.length ? ze("", !0) : ce(i.$slots, "empty", {}, void 0, void 0, 1)
419
+ ], 4)
420
+ ], 44, ot));
343
421
  }
344
422
  });
345
- function Ke(a) {
346
- const _ = P(), E = P(0), e = P(!1), y = P(!1), f = i(() => Math.max(1, a.threshold())), S = i(
347
- () => a.refreshing() || y.value ? f.value : E.value
348
- ), r = i(
349
- () => Math.min(1, E.value / f.value)
350
- ), H = i(() => a.refreshing() || y.value ? "Refreshing…" : r.value >= 1 ? "Release to refresh" : "Pull to refresh");
351
- function U() {
352
- _.value = void 0, e.value = !1, E.value = 0;
423
+ function qe(l) {
424
+ const C = U(), x = U(0), e = U(!1), m = U(!1), c = n(() => Math.max(1, l.threshold())), r = n(
425
+ () => l.refreshing() || m.value ? c.value : x.value
426
+ ), o = n(
427
+ () => Math.min(1, x.value / c.value)
428
+ ), f = n(() => l.refreshing() || m.value ? "Refreshing…" : o.value >= 1 ? "Release to refresh" : "Pull to refresh");
429
+ function O() {
430
+ C.value = void 0, e.value = !1, x.value = 0;
353
431
  }
354
- function F(L) {
355
- var w;
356
- const p = L.currentTarget, I = ((w = a.scrollTop) == null ? void 0 : w.call(a)) ?? p.scrollTop;
357
- !a.enabled() || a.refreshing() || I > 0 || L.touches.length !== 1 || (_.value = L.touches[0].clientY, e.value = !0);
432
+ function P(V) {
433
+ var z;
434
+ const L = V.currentTarget, p = ((z = l.scrollTop) == null ? void 0 : z.call(l)) ?? L.scrollTop;
435
+ !l.enabled() || l.refreshing() || p > 0 || V.touches.length !== 1 || (C.value = V.touches[0].clientY, e.value = !0);
358
436
  }
359
- function W(L) {
360
- var A;
361
- if (_.value === void 0 || !e.value) return;
362
- const p = L.currentTarget;
363
- if ((((A = a.scrollTop) == null ? void 0 : A.call(a)) ?? p.scrollTop) > 0 || L.touches.length !== 1) {
364
- U();
437
+ function Q(V) {
438
+ var Y;
439
+ if (C.value === void 0 || !e.value) return;
440
+ const L = V.currentTarget;
441
+ if ((((Y = l.scrollTop) == null ? void 0 : Y.call(l)) ?? L.scrollTop) > 0 || V.touches.length !== 1) {
442
+ O();
365
443
  return;
366
444
  }
367
- const w = L.touches[0].clientY - _.value;
368
- if (w <= 0) {
369
- E.value = 0;
445
+ const z = V.touches[0].clientY - C.value;
446
+ if (z <= 0) {
447
+ x.value = 0;
370
448
  return;
371
449
  }
372
- L.preventDefault(), E.value = Math.min(w * 0.5, f.value * 2);
450
+ V.preventDefault(), x.value = Math.min(z * 0.5, c.value * 2);
373
451
  }
374
- function Z() {
375
- if (_.value === void 0) return;
376
- const L = E.value >= f.value && a.enabled() && !a.refreshing();
377
- if (_.value = void 0, e.value = !1, !L) {
378
- E.value = 0;
452
+ function X() {
453
+ if (C.value === void 0) return;
454
+ const V = x.value >= c.value && l.enabled() && !l.refreshing();
455
+ if (C.value = void 0, e.value = !1, !V) {
456
+ x.value = 0;
379
457
  return;
380
458
  }
381
- E.value = f.value, y.value = !0, a.onRefresh(), O(() => {
382
- a.refreshing() || (y.value = !1, E.value = 0);
459
+ x.value = c.value, m.value = !0, l.onRefresh(), K(() => {
460
+ l.refreshing() || (m.value = !1, x.value = 0);
383
461
  });
384
462
  }
385
- return le(
386
- () => a.refreshing(),
387
- (L, p) => {
388
- L ? (y.value = !1, E.value = f.value) : p && (y.value = !1, E.value = 0);
463
+ return ie(
464
+ () => l.refreshing(),
465
+ (V, L) => {
466
+ V ? (m.value = !1, x.value = c.value) : L && (m.value = !1, x.value = 0);
389
467
  }
390
468
  ), {
391
469
  pulling: e,
392
- pullDistance: E,
393
- pullOffset: S,
394
- pullProgress: r,
395
- refreshMessage: H,
396
- refreshThreshold: f,
397
- handleTouchStart: F,
398
- handleTouchMove: W,
399
- handleTouchEnd: Z,
400
- handleTouchCancel: U
470
+ pullDistance: x,
471
+ pullOffset: r,
472
+ pullProgress: o,
473
+ refreshMessage: f,
474
+ refreshThreshold: c,
475
+ handleTouchStart: P,
476
+ handleTouchMove: Q,
477
+ handleTouchEnd: X,
478
+ handleTouchCancel: O
401
479
  };
402
480
  }
403
- const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PURE__ */ $e({
481
+ const rt = ["aria-label"], ut = ["aria-posinset", "aria-setsize"], et = /* @__PURE__ */ Oe({
404
482
  name: "DynamicVirtualScroll",
405
483
  __name: "DynamicVirtualScroll",
406
484
  props: {
@@ -419,294 +497,294 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
419
497
  pullRefreshThreshold: { default: 64 }
420
498
  },
421
499
  emits: ["scroll", "loadMore", "refresh"],
422
- setup(a, { expose: _, emit: E }) {
423
- const e = a, y = E, {
424
- pulling: f,
425
- pullDistance: S,
426
- pullOffset: r,
427
- pullProgress: H,
428
- refreshMessage: U,
429
- refreshThreshold: F,
430
- handleTouchStart: W,
431
- handleTouchMove: Z,
432
- handleTouchEnd: L,
433
- handleTouchCancel: p
434
- } = Ke({
500
+ setup(l, { expose: C, emit: x }) {
501
+ const e = l, m = x, {
502
+ pulling: c,
503
+ pullDistance: r,
504
+ pullOffset: o,
505
+ pullProgress: f,
506
+ refreshMessage: O,
507
+ refreshThreshold: P,
508
+ handleTouchStart: Q,
509
+ handleTouchMove: X,
510
+ handleTouchEnd: V,
511
+ handleTouchCancel: L
512
+ } = qe({
435
513
  enabled: () => e.pullToRefresh,
436
514
  refreshing: () => e.refreshing,
437
515
  threshold: () => e.pullRefreshThreshold,
438
- onRefresh: () => y("refresh")
439
- }), I = P(), w = P(0), A = P(0), V = P(0), N = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map();
440
- let ee, $, X = -1;
441
- const B = Ce(), { getItemKey: q } = He({
516
+ onRefresh: () => m("refresh")
517
+ }), p = U(), z = U(0), Y = U(0), j = U(0), A = /* @__PURE__ */ new Map(), ne = /* @__PURE__ */ new Map();
518
+ let W, k, te = -1;
519
+ const R = Ue(), { getItemKey: ae } = De({
442
520
  componentName: "DynamicVirtualScroll",
443
521
  items: () => e.items,
444
522
  itemKey: () => e.itemKey
445
- }), ae = i(
523
+ }), G = n(
446
524
  () => Math.max(1, e.estimatedItemSize)
447
- ), he = i(
448
- () => Math.max(1, e.loadingItemSize ?? ae.value)
449
- ), oe = i(() => Math.max(0, Math.floor(e.overscan))), v = i(() => A.value > 0 ? A.value : typeof e.height == "number" ? Math.max(0, e.height) : ae.value), M = i(() => {
450
- V.value;
451
- const s = new Array(e.items.length + 1), l = new Array(e.items.length);
525
+ ), se = n(
526
+ () => Math.max(1, e.loadingItemSize ?? G.value)
527
+ ), ue = n(() => Math.max(0, Math.floor(e.overscan))), y = n(() => Y.value > 0 ? Y.value : typeof e.height == "number" ? Math.max(0, e.height) : G.value), w = n(() => {
528
+ j.value;
529
+ const s = new Array(e.items.length + 1), t = new Array(e.items.length);
452
530
  s[0] = 0;
453
- for (let o = 0; o < e.items.length; o += 1) {
454
- const h = q(e.items[o], o), k = N.get(h) ?? ae.value;
455
- l[o] = k, s[o + 1] = s[o] + k;
531
+ for (let a = 0; a < e.items.length; a += 1) {
532
+ const h = ae(e.items[a], a), b = A.get(h) ?? G.value;
533
+ t[a] = b, s[a + 1] = s[a] + b;
456
534
  }
457
535
  return {
458
536
  offsets: s,
459
- sizes: l,
537
+ sizes: t,
460
538
  total: s[e.items.length] ?? 0
461
539
  };
462
- }), D = i(
463
- () => M.value.total + (e.loading ? he.value : 0)
464
- ), ve = i(() => {
540
+ }), q = n(
541
+ () => w.value.total + (e.loading ? se.value : 0)
542
+ ), he = n(() => {
465
543
  const s = /* @__PURE__ */ new Map();
466
- return e.items.forEach((l, o) => {
467
- s.set(q(l, o), o);
544
+ return e.items.forEach((t, a) => {
545
+ s.set(ae(t, a), a);
468
546
  }), s;
469
547
  });
470
- function te(s) {
548
+ function ee(s) {
471
549
  if (e.items.length === 0) return 0;
472
- const l = M.value.offsets;
473
- let o = 0, h = e.items.length;
474
- for (; o < h; ) {
475
- const k = Math.floor((o + h) / 2);
476
- l[k + 1] <= s ? o = k + 1 : h = k;
550
+ const t = w.value.offsets;
551
+ let a = 0, h = e.items.length;
552
+ for (; a < h; ) {
553
+ const b = Math.floor((a + h) / 2);
554
+ t[b + 1] <= s ? a = b + 1 : h = b;
477
555
  }
478
- return Math.min(o, e.items.length - 1);
556
+ return Math.min(a, e.items.length - 1);
479
557
  }
480
- const ye = i(
558
+ const de = n(
481
559
  () => Math.max(
482
560
  0,
483
- te(w.value) - oe.value
561
+ ee(z.value) - ue.value
484
562
  )
485
- ), ne = i(() => {
563
+ ), D = n(() => {
486
564
  if (e.items.length === 0) return 0;
487
- const s = te(w.value + v.value) + 1;
565
+ const s = ee(z.value + y.value) + 1;
488
566
  return Math.min(
489
567
  e.items.length,
490
- s + oe.value
568
+ s + ue.value
491
569
  );
492
- }), fe = i(
493
- () => e.items.slice(ye.value, ne.value).map((s, l) => {
494
- const o = ye.value + l;
570
+ }), F = n(
571
+ () => e.items.slice(de.value, D.value).map((s, t) => {
572
+ const a = de.value + t;
495
573
  return {
496
574
  item: s,
497
- index: o,
498
- key: q(s, o),
499
- top: M.value.offsets[o]
575
+ index: a,
576
+ key: ae(s, a),
577
+ top: w.value.offsets[a]
500
578
  };
501
579
  })
502
- ), J = i(() => ({
503
- height: Ve(e.height)
580
+ ), ve = n(() => ({
581
+ height: Ye(e.height)
504
582
  }));
505
- function me() {
583
+ function ge() {
506
584
  var s;
507
- A.value = ((s = I.value) == null ? void 0 : s.clientHeight) ?? 0, B(I.value, e.height), O(b);
508
- }
509
- function m(s) {
510
- w.value = s.currentTarget.scrollTop, y("scroll", {
511
- scrollTop: w.value,
512
- startIndex: ye.value,
513
- endIndex: ne.value
514
- }), b();
515
- }
516
- function b() {
517
- const s = I.value;
518
- if (!s || !e.hasMore || e.loading || X === e.items.length)
585
+ Y.value = ((s = p.value) == null ? void 0 : s.clientHeight) ?? 0, R(p.value, e.height), K(E);
586
+ }
587
+ function g(s) {
588
+ z.value = s.currentTarget.scrollTop, m("scroll", {
589
+ scrollTop: z.value,
590
+ startIndex: de.value,
591
+ endIndex: D.value
592
+ }), E();
593
+ }
594
+ function E() {
595
+ const s = p.value;
596
+ if (!s || !e.hasMore || e.loading || te === e.items.length)
519
597
  return;
520
- const l = Math.max(0, e.loadMoreThreshold);
521
- D.value - s.scrollTop - s.clientHeight <= l && (X = e.items.length, y("loadMore"));
522
- }
523
- function z(s) {
524
- const l = s.borderBoxSize;
525
- if (l) {
526
- const o = Array.isArray(l) ? l[0] : l;
527
- if (o != null && o.blockSize) return o.blockSize;
598
+ const t = Math.max(0, e.loadMoreThreshold);
599
+ q.value - s.scrollTop - s.clientHeight <= t && (te = e.items.length, m("loadMore"));
600
+ }
601
+ function B(s) {
602
+ const t = s.borderBoxSize;
603
+ if (t) {
604
+ const a = Array.isArray(t) ? t[0] : t;
605
+ if (a != null && a.blockSize) return a.blockSize;
528
606
  }
529
607
  return s.contentRect.height;
530
608
  }
531
- function G(s) {
532
- const l = M.value;
533
- let o = 0, h = !1;
534
- for (const k of s) {
535
- const ge = k.target, pe = K.get(ge), we = z(k);
536
- if (pe === void 0 || we <= 0) continue;
537
- const be = N.get(pe) ?? ae.value;
538
- if (Math.abs(be - we) < 0.5) continue;
539
- const Te = ve.value.get(pe);
540
- Te !== void 0 && l.offsets[Te + 1] <= w.value && (o += we - be), N.set(pe, we), h = !0;
609
+ function le(s) {
610
+ const t = w.value;
611
+ let a = 0, h = !1;
612
+ for (const b of s) {
613
+ const xe = b.target, pe = ne.get(xe), me = B(b);
614
+ if (pe === void 0 || me <= 0) continue;
615
+ const Ee = A.get(pe) ?? G.value;
616
+ if (Math.abs(Ee - me) < 0.5) continue;
617
+ const ke = he.value.get(pe);
618
+ ke !== void 0 && t.offsets[ke + 1] <= z.value && (a += me - Ee), A.set(pe, me), h = !0;
541
619
  }
542
- h && (V.value += 1, O(b), o !== 0 && O(() => {
543
- const k = I.value;
544
- k && (k.scrollTop += o, w.value = k.scrollTop);
620
+ h && (j.value += 1, K(E), a !== 0 && K(() => {
621
+ const b = p.value;
622
+ b && (b.scrollTop += a, z.value = b.scrollTop);
545
623
  }));
546
624
  }
547
- function Me(s, l) {
548
- s instanceof HTMLElement && (K.set(s, l), $ == null || $.observe(s));
625
+ function oe(s, t) {
626
+ s instanceof HTMLElement && (ne.set(s, t), k == null || k.observe(s));
549
627
  }
550
- function se() {
551
- for (const [s] of K)
552
- s.isConnected || ($ == null || $.unobserve(s), K.delete(s));
628
+ function re() {
629
+ for (const [s] of ne)
630
+ s.isConnected || (k == null || k.unobserve(s), ne.delete(s));
553
631
  }
554
- function ue(s, l = {}) {
555
- const o = I.value;
556
- if (!o) return;
557
- const h = Math.max(0, D.value - o.clientHeight), k = Math.min(
632
+ function Me(s, t = {}) {
633
+ const a = p.value;
634
+ if (!a) return;
635
+ const h = Math.max(0, q.value - a.clientHeight), b = Math.min(
558
636
  Math.max(0, Number.isFinite(s) ? s : 0),
559
637
  h
560
- ), ge = l.behavior ?? "auto";
561
- ge === "auto" && (w.value = k), o.scrollTo({ ...l, top: k, behavior: ge });
638
+ ), xe = t.behavior ?? "auto";
639
+ xe === "auto" && (z.value = b), a.scrollTo({ ...t, top: b, behavior: xe });
562
640
  }
563
- function Y(s, l = {}) {
564
- const o = I.value;
565
- if (!o || e.items.length === 0) return;
641
+ function _(s, t = {}) {
642
+ const a = p.value;
643
+ if (!a || e.items.length === 0) return;
566
644
  const h = Math.min(
567
645
  e.items.length - 1,
568
646
  Math.max(0, Math.floor(s))
569
- ), { align: k = "start", ...ge } = l;
570
- let pe = M.value.offsets[h];
571
- const we = M.value.sizes[h];
572
- k === "center" ? pe -= (o.clientHeight - we) / 2 : k === "end" && (pe -= o.clientHeight - we);
573
- const be = Math.max(
647
+ ), { align: b = "start", ...xe } = t;
648
+ let pe = w.value.offsets[h];
649
+ const me = w.value.sizes[h];
650
+ b === "center" ? pe -= (a.clientHeight - me) / 2 : b === "end" && (pe -= a.clientHeight - me);
651
+ const Ee = Math.max(
574
652
  0,
575
- Math.min(pe, D.value - o.clientHeight)
576
- ), Te = ge.behavior ?? "auto";
577
- Te === "auto" && (w.value = be), o.scrollTo({
578
- ...ge,
579
- top: be,
580
- behavior: Te
653
+ Math.min(pe, q.value - a.clientHeight)
654
+ ), ke = xe.behavior ?? "auto";
655
+ ke === "auto" && (z.value = Ee), a.scrollTo({
656
+ ...xe,
657
+ top: Ee,
658
+ behavior: ke
581
659
  });
582
660
  }
583
- function j(s = "auto") {
584
- var l;
585
- (l = I.value) == null || l.scrollTo({ top: 0, behavior: s });
661
+ function J(s = "auto") {
662
+ var t;
663
+ (t = p.value) == null || t.scrollTo({ top: 0, behavior: s });
586
664
  }
587
- return le(
665
+ return ie(
588
666
  () => e.itemKey,
589
667
  () => {
590
- N.clear(), V.value += 1;
668
+ A.clear(), j.value += 1;
591
669
  }
592
- ), le(
670
+ ), ie(
593
671
  () => e.items.length,
594
672
  async () => {
595
673
  const s = new Set(
596
- e.items.map((h, k) => q(h, k))
674
+ e.items.map((h, b) => ae(h, b))
597
675
  );
598
- for (const h of N.keys())
599
- s.has(h) || N.delete(h);
600
- V.value += 1, await O();
601
- const l = I.value;
602
- if (!l) return;
603
- const o = Math.max(0, D.value - l.clientHeight);
604
- l.scrollTop > o && (l.scrollTop = o, w.value = o), b();
676
+ for (const h of A.keys())
677
+ s.has(h) || A.delete(h);
678
+ j.value += 1, await K();
679
+ const t = p.value;
680
+ if (!t) return;
681
+ const a = Math.max(0, q.value - t.clientHeight);
682
+ t.scrollTop > a && (t.scrollTop = a, z.value = a), E();
605
683
  }
606
- ), le(
684
+ ), ie(
607
685
  () => [e.hasMore, e.loading],
608
686
  async ([s]) => {
609
- s || (X = -1), await O(), b();
687
+ s || (te = -1), await K(), E();
610
688
  }
611
- ), ke(() => {
612
- if (me(), typeof ResizeObserver < "u") {
613
- ee = new ResizeObserver(me), $ = new ResizeObserver(G), I.value && ee.observe(I.value);
614
- for (const [s] of K)
615
- $.observe(s);
689
+ ), Ce(() => {
690
+ if (ge(), typeof ResizeObserver < "u") {
691
+ W = new ResizeObserver(ge), k = new ResizeObserver(le), p.value && W.observe(p.value);
692
+ for (const [s] of ne)
693
+ k.observe(s);
616
694
  }
617
- O(b);
618
- }), Ae(se), Le(() => {
619
- ee && (ee.disconnect(), ee = void 0), $ && ($.disconnect(), $ = void 0), K.clear();
620
- }), _({
621
- scrollTo: ue,
622
- scrollToIndex: Y,
623
- scrollToTop: j
624
- }), (s, l) => (x(), T("div", {
695
+ K(E);
696
+ }), Je(re), Pe(() => {
697
+ W && (W.disconnect(), W = void 0), k && (k.disconnect(), k = void 0), ne.clear();
698
+ }), C({
699
+ scrollTo: Me,
700
+ scrollToIndex: _,
701
+ scrollToTop: J
702
+ }), (s, t) => (I(), $("div", {
625
703
  ref_key: "viewport",
626
- ref: I,
627
- class: Be(["vue-dynamic-virtual-scroll", { "vue-dynamic-virtual-scroll--pulling": c(f) }]),
628
- style: C(J.value),
704
+ ref: p,
705
+ class: We(["vue-dynamic-virtual-scroll", { "vue-dynamic-virtual-scroll--pulling": u(c) }]),
706
+ style: N(ve.value),
629
707
  role: "list",
630
- "aria-label": a.ariaLabel,
708
+ "aria-label": l.ariaLabel,
631
709
  tabindex: "0",
632
- onScrollPassive: m,
633
- onTouchstartPassive: l[0] || (l[0] = //@ts-ignore
634
- (...o) => c(W) && c(W)(...o)),
635
- onTouchmove: l[1] || (l[1] = //@ts-ignore
636
- (...o) => c(Z) && c(Z)(...o)),
637
- onTouchend: l[2] || (l[2] = //@ts-ignore
638
- (...o) => c(L) && c(L)(...o)),
639
- onTouchcancel: l[3] || (l[3] = //@ts-ignore
640
- (...o) => c(p) && c(p)(...o))
710
+ onScrollPassive: g,
711
+ onTouchstartPassive: t[0] || (t[0] = //@ts-ignore
712
+ (...a) => u(Q) && u(Q)(...a)),
713
+ onTouchmove: t[1] || (t[1] = //@ts-ignore
714
+ (...a) => u(X) && u(X)(...a)),
715
+ onTouchend: t[2] || (t[2] = //@ts-ignore
716
+ (...a) => u(V) && u(V)(...a)),
717
+ onTouchcancel: t[3] || (t[3] = //@ts-ignore
718
+ (...a) => u(L) && u(L)(...a))
641
719
  }, [
642
- a.pullToRefresh || a.refreshing ? (x(), T("div", {
720
+ l.pullToRefresh || l.refreshing ? (I(), $("div", {
643
721
  key: 0,
644
722
  class: "vue-dynamic-virtual-scroll__refresh",
645
- style: C({
646
- height: `${c(F)}px`,
647
- transform: `translateY(${c(r) - c(F)}px)`
723
+ style: N({
724
+ height: `${u(P)}px`,
725
+ transform: `translateY(${u(o) - u(P)}px)`
648
726
  }),
649
727
  role: "status",
650
728
  "aria-live": "polite"
651
729
  }, [
652
- ie(s.$slots, "refresh", {
653
- pullDistance: c(S),
654
- progress: c(H),
655
- refreshing: a.refreshing
730
+ ce(s.$slots, "refresh", {
731
+ pullDistance: u(r),
732
+ progress: u(f),
733
+ refreshing: l.refreshing
656
734
  }, () => [
657
- Ie(Oe(c(U)), 1)
735
+ Ve(Ge(u(O)), 1)
658
736
  ])
659
- ], 4)) : xe("", !0),
660
- a.items.length || a.loading ? (x(), T("div", {
737
+ ], 4)) : ze("", !0),
738
+ l.items.length || l.loading ? (I(), $("div", {
661
739
  key: 1,
662
740
  class: "vue-dynamic-virtual-scroll__spacer",
663
- style: C({
664
- height: `${D.value}px`,
665
- transform: `translateY(${c(r)}px)`
741
+ style: N({
742
+ height: `${q.value}px`,
743
+ transform: `translateY(${u(o)}px)`
666
744
  })
667
745
  }, [
668
- (x(!0), T(ze, null, Ee(fe.value, ({ item: o, index: h, key: k, top: ge }) => (x(), T("div", {
669
- key: k,
746
+ (I(!0), $(He, null, Ae(F.value, ({ item: a, index: h, key: b, top: xe }) => (I(), $("div", {
747
+ key: b,
670
748
  ref_for: !0,
671
- ref: (pe) => Me(pe, k),
749
+ ref: (pe) => oe(pe, b),
672
750
  class: "vue-dynamic-virtual-scroll__item",
673
- style: C({ transform: `translateY(${ge}px)` }),
751
+ style: N({ transform: `translateY(${xe}px)` }),
674
752
  role: "listitem",
675
753
  "aria-posinset": h + 1,
676
- "aria-setsize": a.items.length
754
+ "aria-setsize": l.items.length
677
755
  }, [
678
- ie(s.$slots, "default", {
679
- item: o,
756
+ ce(s.$slots, "default", {
757
+ item: a,
680
758
  index: h
681
759
  })
682
- ], 12, Je))), 128)),
683
- a.loading ? (x(), T("div", {
760
+ ], 12, ut))), 128)),
761
+ l.loading ? (I(), $("div", {
684
762
  key: 0,
685
763
  class: "vue-dynamic-virtual-scroll__loading",
686
- style: C({
687
- height: `${he.value}px`,
688
- transform: `translateY(${M.value.total}px)`
764
+ style: N({
765
+ height: `${se.value}px`,
766
+ transform: `translateY(${w.value.total}px)`
689
767
  }),
690
768
  role: "status",
691
769
  "aria-live": "polite"
692
770
  }, [
693
- ie(s.$slots, "loading", {}, () => [
694
- l[4] || (l[4] = Ie("Loading more…", -1))
771
+ ce(s.$slots, "loading", {}, () => [
772
+ t[4] || (t[4] = Ve("Loading more…", -1))
695
773
  ])
696
- ], 4)) : xe("", !0)
697
- ], 4)) : (x(), T("div", {
774
+ ], 4)) : ze("", !0)
775
+ ], 4)) : (I(), $("div", {
698
776
  key: 2,
699
777
  class: "vue-dynamic-virtual-scroll__empty",
700
- style: C({ transform: `translateY(${c(r)}px)` })
778
+ style: N({ transform: `translateY(${u(o)}px)` })
701
779
  }, [
702
- ie(s.$slots, "empty")
780
+ ce(s.$slots, "empty")
703
781
  ], 4))
704
- ], 46, qe));
782
+ ], 46, rt));
705
783
  }
706
- }), Qe = ["aria-label"], Xe = ["aria-current", "aria-posinset", "aria-setsize"], et = {
784
+ }), ct = ["aria-label"], dt = ["aria-current", "aria-posinset", "aria-setsize"], vt = {
707
785
  key: 1,
708
786
  class: "vue-short-media-feed__empty"
709
- }, tt = /* @__PURE__ */ $e({
787
+ }, ft = /* @__PURE__ */ Oe({
710
788
  name: "ShortMediaFeed",
711
789
  __name: "ShortMediaFeed",
712
790
  props: {
@@ -721,155 +799,155 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
721
799
  loadMoreThreshold: { default: 2 }
722
800
  },
723
801
  emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
724
- setup(a, { expose: _, emit: E }) {
725
- const e = a, y = E, f = P(), S = P(0), r = P(ee(e.activeIndex));
726
- let H, U = -1;
727
- const F = Ce(), { getItemKey: W } = He({
802
+ setup(l, { expose: C, emit: x }) {
803
+ const e = l, m = x, c = U(), r = U(0), o = U(W(e.activeIndex));
804
+ let f, O = -1;
805
+ const P = Ue(), { getItemKey: Q } = De({
728
806
  componentName: "ShortMediaFeed",
729
807
  items: () => e.items,
730
808
  itemKey: () => e.itemKey
731
- }), Z = i(
809
+ }), X = n(
732
810
  () => Math.max(0, Math.floor(e.buffer))
733
- ), L = i(
811
+ ), V = n(
734
812
  () => Math.max(
735
813
  0,
736
814
  Math.floor(
737
815
  Number.isFinite(e.loadMoreThreshold) ? e.loadMoreThreshold : 0
738
816
  )
739
817
  )
740
- ), p = i(() => S.value > 0 ? S.value : typeof e.height == "number" ? Math.max(1, e.height) : 0), I = i(
741
- () => Math.max(0, r.value - Z.value)
742
- ), w = i(
818
+ ), L = n(() => r.value > 0 ? r.value : typeof e.height == "number" ? Math.max(1, e.height) : 0), p = n(
819
+ () => Math.max(0, o.value - X.value)
820
+ ), z = n(
743
821
  () => Math.min(
744
822
  e.items.length,
745
- r.value + Z.value + 1
823
+ o.value + X.value + 1
746
824
  )
747
- ), A = i(
748
- () => e.items.slice(I.value, w.value).map((v, M) => ({
749
- item: v,
750
- index: I.value + M
825
+ ), Y = n(
826
+ () => e.items.slice(p.value, z.value).map((y, w) => ({
827
+ item: y,
828
+ index: p.value + w
751
829
  }))
752
- ), V = i(() => I.value * p.value), N = i(
753
- () => (e.items.length - w.value) * p.value
754
- ), K = i(() => ({
755
- height: Ve(e.height)
830
+ ), j = n(() => p.value * L.value), A = n(
831
+ () => (e.items.length - z.value) * L.value
832
+ ), ne = n(() => ({
833
+ height: Ye(e.height)
756
834
  }));
757
- function ee(v) {
835
+ function W(y) {
758
836
  return e.items.length === 0 ? 0 : Math.min(
759
837
  e.items.length - 1,
760
- Math.max(0, Math.floor(Number.isFinite(v) ? v : 0))
838
+ Math.max(0, Math.floor(Number.isFinite(y) ? y : 0))
761
839
  );
762
840
  }
763
- function $() {
764
- if (!e.hasMore || e.loading || U === e.items.length)
841
+ function k() {
842
+ if (!e.hasMore || e.loading || O === e.items.length)
765
843
  return;
766
- (e.items.length === 0 ? 0 : e.items.length - 1 - r.value) <= L.value && (U = e.items.length, y("loadMore"));
844
+ (e.items.length === 0 ? 0 : e.items.length - 1 - o.value) <= V.value && (O = e.items.length, m("loadMore"));
767
845
  }
768
- function X(v) {
769
- const M = ee(v);
770
- M === r.value || e.items.length === 0 || (r.value = M, y("update:activeIndex", M), y("change", {
771
- index: M,
772
- item: e.items[M]
773
- }), M === 0 && y("reachStart"), M === e.items.length - 1 && y("reachEnd"), $());
846
+ function te(y) {
847
+ const w = W(y);
848
+ w === o.value || e.items.length === 0 || (o.value = w, m("update:activeIndex", w), m("change", {
849
+ index: w,
850
+ item: e.items[w]
851
+ }), w === 0 && m("reachStart"), w === e.items.length - 1 && m("reachEnd"), k());
774
852
  }
775
- function B(v, M = {}) {
776
- const D = f.value;
777
- D && (typeof D.scrollTo == "function" ? D.scrollTo({ ...M, top: v }) : D.scrollTop = v);
853
+ function R(y, w = {}) {
854
+ const q = c.value;
855
+ q && (typeof q.scrollTo == "function" ? q.scrollTo({ ...w, top: y }) : q.scrollTop = y);
778
856
  }
779
- function q(v, M = {}) {
857
+ function ae(y, w = {}) {
780
858
  if (e.items.length === 0) return;
781
- const D = ee(v);
782
- X(D), B(D * p.value, M);
859
+ const q = W(y);
860
+ te(q), R(q * L.value, w);
783
861
  }
784
- function ae(v) {
785
- if (p.value <= 0) return;
786
- const M = v.currentTarget.scrollTop;
787
- X(Math.round(M / p.value));
862
+ function G(y) {
863
+ if (L.value <= 0) return;
864
+ const w = y.currentTarget.scrollTop;
865
+ te(Math.round(w / L.value));
788
866
  }
789
- function he(v) {
790
- let M;
791
- v.key === "ArrowDown" || v.key === "PageDown" ? M = r.value + 1 : v.key === "ArrowUp" || v.key === "PageUp" ? M = r.value - 1 : v.key === "Home" ? M = 0 : v.key === "End" && (M = e.items.length - 1), M !== void 0 && (v.preventDefault(), q(M, { behavior: "smooth" }));
867
+ function se(y) {
868
+ let w;
869
+ y.key === "ArrowDown" || y.key === "PageDown" ? w = o.value + 1 : y.key === "ArrowUp" || y.key === "PageUp" ? w = o.value - 1 : y.key === "Home" ? w = 0 : y.key === "End" && (w = e.items.length - 1), w !== void 0 && (y.preventDefault(), ae(w, { behavior: "smooth" }));
792
870
  }
793
- function oe() {
794
- var M;
795
- const v = ((M = f.value) == null ? void 0 : M.clientHeight) ?? 0;
796
- F(f.value, e.height), !(v <= 0 || v === S.value) && (S.value = v, O(() => {
797
- B(r.value * v);
871
+ function ue() {
872
+ var w;
873
+ const y = ((w = c.value) == null ? void 0 : w.clientHeight) ?? 0;
874
+ P(c.value, e.height), !(y <= 0 || y === r.value) && (r.value = y, K(() => {
875
+ R(o.value * y);
798
876
  }));
799
877
  }
800
- return le(
878
+ return ie(
801
879
  () => e.activeIndex,
802
- async (v) => {
803
- const M = ee(v);
804
- M !== r.value && (r.value = M, await O(), B(M * p.value), $());
880
+ async (y) => {
881
+ const w = W(y);
882
+ w !== o.value && (o.value = w, await K(), R(w * L.value), k());
805
883
  }
806
- ), le(
884
+ ), ie(
807
885
  () => [
808
886
  e.hasMore,
809
887
  e.loading,
810
888
  e.loadMoreThreshold
811
889
  ],
812
- async ([v]) => {
813
- v || (U = -1), await O(), $();
890
+ async ([y]) => {
891
+ y || (O = -1), await K(), k();
814
892
  }
815
- ), le(
893
+ ), ie(
816
894
  () => e.items.length,
817
895
  async () => {
818
- const v = ee(r.value);
819
- e.items.length === 0 ? r.value !== 0 && (r.value = 0, y("update:activeIndex", 0)) : X(v), await O(), B(v * p.value), $();
896
+ const y = W(o.value);
897
+ e.items.length === 0 ? o.value !== 0 && (o.value = 0, m("update:activeIndex", 0)) : te(y), await K(), R(y * L.value), k();
820
898
  }
821
- ), ke(async () => {
822
- oe(), typeof ResizeObserver < "u" && f.value && (H = new ResizeObserver(oe), H.observe(f.value)), await O(), B(r.value * p.value), $();
823
- }), Le(() => {
824
- H && (H.disconnect(), H = void 0);
825
- }), _({
826
- scrollToIndex: q
827
- }), (v, M) => (x(), T("div", {
899
+ ), Ce(async () => {
900
+ ue(), typeof ResizeObserver < "u" && c.value && (f = new ResizeObserver(ue), f.observe(c.value)), await K(), R(o.value * L.value), k();
901
+ }), Pe(() => {
902
+ f && (f.disconnect(), f = void 0);
903
+ }), C({
904
+ scrollToIndex: ae
905
+ }), (y, w) => (I(), $("div", {
828
906
  ref_key: "viewport",
829
- ref: f,
907
+ ref: c,
830
908
  class: "vue-short-media-feed",
831
- style: C(K.value),
909
+ style: N(ne.value),
832
910
  role: "list",
833
911
  "aria-orientation": "vertical",
834
- "aria-label": a.ariaLabel,
912
+ "aria-label": l.ariaLabel,
835
913
  tabindex: "0",
836
- onScrollPassive: ae,
837
- onKeydown: he
914
+ onScrollPassive: G,
915
+ onKeydown: se
838
916
  }, [
839
- a.items.length ? (x(), T(ze, { key: 0 }, [
840
- V.value > 0 ? (x(), T("div", {
917
+ l.items.length ? (I(), $(He, { key: 0 }, [
918
+ j.value > 0 ? (I(), $("div", {
841
919
  key: 0,
842
920
  class: "vue-short-media-feed__spacer",
843
- style: C({ height: `${V.value}px` }),
921
+ style: N({ height: `${j.value}px` }),
844
922
  "aria-hidden": "true"
845
- }, null, 4)) : xe("", !0),
846
- (x(!0), T(ze, null, Ee(A.value, ({ item: D, index: ve }) => (x(), T("div", {
847
- key: c(W)(D, ve),
923
+ }, null, 4)) : ze("", !0),
924
+ (I(!0), $(He, null, Ae(Y.value, ({ item: q, index: he }) => (I(), $("div", {
925
+ key: u(Q)(q, he),
848
926
  class: "vue-short-media-feed__item",
849
- style: C({ height: `${p.value}px` }),
927
+ style: N({ height: `${L.value}px` }),
850
928
  role: "listitem",
851
- "aria-current": ve === r.value ? "true" : void 0,
852
- "aria-posinset": ve + 1,
853
- "aria-setsize": a.items.length
929
+ "aria-current": he === o.value ? "true" : void 0,
930
+ "aria-posinset": he + 1,
931
+ "aria-setsize": l.items.length
854
932
  }, [
855
- ie(v.$slots, "default", {
856
- item: D,
857
- index: ve,
858
- active: ve === r.value
933
+ ce(y.$slots, "default", {
934
+ item: q,
935
+ index: he,
936
+ active: he === o.value
859
937
  })
860
- ], 12, Xe))), 128)),
861
- N.value > 0 ? (x(), T("div", {
938
+ ], 12, dt))), 128)),
939
+ A.value > 0 ? (I(), $("div", {
862
940
  key: 1,
863
941
  class: "vue-short-media-feed__spacer",
864
- style: C({ height: `${N.value}px` }),
942
+ style: N({ height: `${A.value}px` }),
865
943
  "aria-hidden": "true"
866
- }, null, 4)) : xe("", !0)
867
- ], 64)) : (x(), T("div", et, [
868
- ie(v.$slots, "empty")
944
+ }, null, 4)) : ze("", !0)
945
+ ], 64)) : (I(), $("div", vt, [
946
+ ce(y.$slots, "empty")
869
947
  ]))
870
- ], 44, Qe));
948
+ ], 44, ct));
871
949
  }
872
- }), lt = ["aria-label"], at = /* @__PURE__ */ $e({
950
+ }), ht = ["aria-label"], mt = /* @__PURE__ */ Oe({
873
951
  __name: "SkeletonLoader",
874
952
  props: {
875
953
  width: { default: "100%" },
@@ -878,38 +956,38 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
878
956
  animated: { type: Boolean, default: !0 },
879
957
  ariaLabel: { default: "Loading…" }
880
958
  },
881
- setup(a) {
882
- const _ = a;
883
- function E(y) {
884
- return typeof y == "number" ? `${Math.max(0, y)}px` : y;
885
- }
886
- const e = i(() => ({
887
- width: E(_.width),
888
- height: E(_.height)
959
+ setup(l) {
960
+ const C = l;
961
+ function x(m) {
962
+ return typeof m == "number" ? `${Math.max(0, m)}px` : m;
963
+ }
964
+ const e = n(() => ({
965
+ width: x(C.width),
966
+ height: x(C.height)
889
967
  }));
890
- return (y, f) => (x(), T("div", {
891
- class: Be(["vue-skeleton-loader", [
892
- `vue-skeleton-loader--${a.variant}`,
893
- { "vue-skeleton-loader--animated": a.animated }
968
+ return (m, c) => (I(), $("div", {
969
+ class: We(["vue-skeleton-loader", [
970
+ `vue-skeleton-loader--${l.variant}`,
971
+ { "vue-skeleton-loader--animated": l.animated }
894
972
  ]]),
895
- style: C(e.value),
973
+ style: N(e.value),
896
974
  role: "status",
897
- "aria-label": a.ariaLabel
898
- }, null, 14, lt));
975
+ "aria-label": l.ariaLabel
976
+ }, null, 14, ht));
899
977
  }
900
- }), ot = (a, _) => {
901
- const E = a.__vccOpts || a;
902
- for (const [e, y] of _)
903
- E[e] = y;
904
- return E;
905
- }, nt = /* @__PURE__ */ ot(at, [["__scopeId", "data-v-fc92f61f"]]), it = ["aria-label"], st = {
978
+ }), gt = (l, C) => {
979
+ const x = l.__vccOpts || l;
980
+ for (const [e, m] of C)
981
+ x[e] = m;
982
+ return x;
983
+ }, pt = /* @__PURE__ */ gt(mt, [["__scopeId", "data-v-fc92f61f"]]), yt = ["aria-label"], Mt = {
906
984
  key: 0,
907
985
  class: "vue-virtual-carousel__track",
908
986
  role: "list"
909
- }, rt = ["aria-label", "aria-current"], ut = {
987
+ }, xt = ["aria-label", "aria-current"], wt = {
910
988
  key: 1,
911
989
  class: "vue-virtual-carousel__empty"
912
- }, ct = /* @__PURE__ */ $e({
990
+ }, Tt = /* @__PURE__ */ Oe({
913
991
  name: "VirtualCarousel",
914
992
  __name: "VirtualCarousel",
915
993
  props: {
@@ -932,25 +1010,25 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
932
1010
  responsive: { default: void 0 }
933
1011
  },
934
1012
  emits: ["update:activeIndex", "change", "reachStart", "reachEnd", "loadMore"],
935
- setup(a, { expose: _, emit: E }) {
936
- const e = a, y = E, f = P(), S = P(0), r = P(0);
937
- let H, U = -1, F, W, Z = !1;
938
- const L = P(!1), { getItemKey: p } = He({
1013
+ setup(l, { expose: C, emit: x }) {
1014
+ const e = l, m = x, c = U(), r = U(0), o = U(0);
1015
+ let f, O = -1, P, Q, X = !1;
1016
+ const V = U(!1), { getItemKey: L } = De({
939
1017
  componentName: "VirtualCarousel",
940
1018
  items: () => e.items,
941
1019
  itemKey: () => e.itemKey
942
- }), I = i(() => Math.max(0, S.value)), w = i(() => {
1020
+ }), p = n(() => Math.max(0, r.value)), z = n(() => {
943
1021
  if (!e.responsive || e.responsive.length === 0)
944
1022
  return {
945
1023
  slidesPerView: e.slidesPerView,
946
1024
  slidesToScroll: e.slidesToScroll,
947
1025
  gap: e.gap
948
1026
  };
949
- const l = I.value, o = [...e.responsive].sort(
950
- (h, k) => k.breakpoint - h.breakpoint
1027
+ const t = p.value, a = [...e.responsive].sort(
1028
+ (h, b) => b.breakpoint - h.breakpoint
951
1029
  );
952
- for (const h of o)
953
- if (l >= h.breakpoint)
1030
+ for (const h of a)
1031
+ if (t >= h.breakpoint)
954
1032
  return {
955
1033
  slidesPerView: h.slidesPerView ?? e.slidesPerView,
956
1034
  slidesToScroll: h.slidesToScroll ?? e.slidesToScroll,
@@ -961,278 +1039,278 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
961
1039
  slidesToScroll: e.slidesToScroll,
962
1040
  gap: e.gap
963
1041
  };
964
- }), A = i(
1042
+ }), Y = n(
965
1043
  () => Math.max(
966
1044
  1,
967
1045
  Math.floor(
968
- Number.isFinite(w.value.slidesPerView) ? w.value.slidesPerView : 1
1046
+ Number.isFinite(z.value.slidesPerView) ? z.value.slidesPerView : 1
969
1047
  )
970
1048
  )
971
- ), V = i(
1049
+ ), j = n(
972
1050
  () => Math.max(
973
1051
  1,
974
1052
  Math.floor(
975
- Number.isFinite(w.value.slidesToScroll) ? w.value.slidesToScroll : 1
1053
+ Number.isFinite(z.value.slidesToScroll) ? z.value.slidesToScroll : 1
976
1054
  )
977
1055
  )
978
- ), N = i(
979
- () => Math.max(0, Number.isFinite(w.value.gap) ? w.value.gap : 0)
980
- ), K = i(
1056
+ ), A = n(
1057
+ () => Math.max(0, Number.isFinite(z.value.gap) ? z.value.gap : 0)
1058
+ ), ne = n(
981
1059
  () => Math.max(
982
1060
  0,
983
1061
  Math.floor(Number.isFinite(e.buffer) ? e.buffer : 0)
984
1062
  )
985
- ), ee = i(
1063
+ ), W = n(
986
1064
  () => Math.max(
987
1065
  0,
988
1066
  Math.floor(
989
1067
  Number.isFinite(e.loadMoreThreshold) ? e.loadMoreThreshold : 0
990
1068
  )
991
1069
  )
992
- ), $ = i(() => Number.isFinite(e.autoplayDelay) ? Math.max(1, e.autoplayDelay) : 3e3), X = i(() => {
993
- if (I.value <= 0) return 0;
994
- const l = (A.value - 1) * N.value;
1070
+ ), k = n(() => Number.isFinite(e.autoplayDelay) ? Math.max(1, e.autoplayDelay) : 3e3), te = n(() => {
1071
+ if (p.value <= 0) return 0;
1072
+ const t = (Y.value - 1) * A.value;
995
1073
  return Math.max(
996
1074
  1,
997
- (I.value - l) / A.value
1075
+ (p.value - t) / Y.value
998
1076
  );
999
- }), B = i(() => X.value + N.value), q = i(
1077
+ }), R = n(() => te.value + A.value), ae = n(
1000
1078
  () => Math.max(
1001
1079
  0,
1002
- e.items.length - A.value
1080
+ e.items.length - Y.value
1003
1081
  )
1004
- ), ae = i(
1005
- () => Math.max(0, r.value - K.value)
1006
- ), he = i(
1082
+ ), G = n(
1083
+ () => Math.max(0, o.value - ne.value)
1084
+ ), se = n(
1007
1085
  () => Math.min(
1008
1086
  e.items.length,
1009
- r.value + A.value + K.value
1087
+ o.value + Y.value + ne.value
1010
1088
  )
1011
- ), oe = i(
1012
- () => e.items.slice(ae.value, he.value).map((l, o) => ({
1013
- item: l,
1014
- index: ae.value + o
1089
+ ), ue = n(
1090
+ () => e.items.slice(G.value, se.value).map((t, a) => ({
1091
+ item: t,
1092
+ index: G.value + a
1015
1093
  }))
1016
- ), v = i(() => e.items.length === 0 ? 0 : e.items.length * X.value + (e.items.length - 1) * N.value), M = i(
1017
- () => ae.value * B.value
1018
- ), D = i(
1094
+ ), y = n(() => e.items.length === 0 ? 0 : e.items.length * te.value + (e.items.length - 1) * A.value), w = n(
1095
+ () => G.value * R.value
1096
+ ), q = n(
1019
1097
  () => Math.max(
1020
1098
  0,
1021
- v.value - he.value * B.value
1099
+ y.value - se.value * R.value
1022
1100
  )
1023
- ), ve = i(() => ({
1024
- height: Ve(e.height)
1101
+ ), he = n(() => ({
1102
+ height: Ye(e.height)
1025
1103
  }));
1026
- function te(l) {
1104
+ function ee(t) {
1027
1105
  return Math.min(
1028
- q.value,
1029
- Math.max(0, Math.floor(Number.isFinite(l) ? l : 0))
1106
+ ae.value,
1107
+ Math.max(0, Math.floor(Number.isFinite(t) ? t : 0))
1030
1108
  );
1031
1109
  }
1032
- r.value = te(e.activeIndex);
1033
- function ye(l) {
1034
- return l >= r.value && l < Math.min(
1110
+ o.value = ee(e.activeIndex);
1111
+ function de(t) {
1112
+ return t >= o.value && t < Math.min(
1035
1113
  e.items.length,
1036
- r.value + A.value
1114
+ o.value + Y.value
1037
1115
  );
1038
1116
  }
1039
- function ne() {
1040
- if (!e.hasMore || e.loading || U === e.items.length)
1117
+ function D() {
1118
+ if (!e.hasMore || e.loading || O === e.items.length)
1041
1119
  return;
1042
- const l = e.items.length === 0 ? -1 : Math.min(
1120
+ const t = e.items.length === 0 ? -1 : Math.min(
1043
1121
  e.items.length - 1,
1044
- r.value + A.value - 1
1122
+ o.value + Y.value - 1
1045
1123
  );
1046
- e.items.length - 1 - l <= ee.value && (U = e.items.length, y("loadMore"));
1047
- }
1048
- function fe(l) {
1049
- const o = te(l);
1050
- o === r.value || e.items.length === 0 || (r.value = o, y("update:activeIndex", o), y("change", {
1051
- index: o,
1052
- item: e.items[o]
1053
- }), o === 0 && y("reachStart"), o === q.value && y("reachEnd"), ne(), e.autoplay && !L.value && z());
1054
- }
1055
- function J(l, o = {}) {
1056
- const h = f.value;
1057
- h && (typeof h.scrollTo == "function" ? h.scrollTo({ ...o, left: l }) : h.scrollLeft = l);
1058
- }
1059
- function me(l, o = {}) {
1060
- if (e.items.length === 0 || B.value <= 0) return;
1061
- const h = te(l);
1062
- W = o.behavior === "smooth" ? h : void 0, fe(h), J(h * B.value, {
1063
- ...o,
1064
- behavior: o.behavior
1124
+ e.items.length - 1 - t <= W.value && (O = e.items.length, m("loadMore"));
1125
+ }
1126
+ function F(t) {
1127
+ const a = ee(t);
1128
+ a === o.value || e.items.length === 0 || (o.value = a, m("update:activeIndex", a), m("change", {
1129
+ index: a,
1130
+ item: e.items[a]
1131
+ }), a === 0 && m("reachStart"), a === ae.value && m("reachEnd"), D(), e.autoplay && !V.value && B());
1132
+ }
1133
+ function ve(t, a = {}) {
1134
+ const h = c.value;
1135
+ h && (typeof h.scrollTo == "function" ? h.scrollTo({ ...a, left: t }) : h.scrollLeft = t);
1136
+ }
1137
+ function ge(t, a = {}) {
1138
+ if (e.items.length === 0 || R.value <= 0) return;
1139
+ const h = ee(t);
1140
+ Q = a.behavior === "smooth" ? h : void 0, F(h), ve(h * R.value, {
1141
+ ...a,
1142
+ behavior: a.behavior
1065
1143
  });
1066
1144
  }
1067
- function m(l = "smooth") {
1068
- me(
1069
- r.value + V.value,
1070
- { behavior: l }
1145
+ function g(t = "smooth") {
1146
+ ge(
1147
+ o.value + j.value,
1148
+ { behavior: t }
1071
1149
  );
1072
1150
  }
1073
- function b(l = "smooth") {
1074
- me(
1075
- r.value - V.value,
1076
- { behavior: l }
1151
+ function E(t = "smooth") {
1152
+ ge(
1153
+ o.value - j.value,
1154
+ { behavior: t }
1077
1155
  );
1078
1156
  }
1079
- function z() {
1080
- G(), !(!e.autoplay || e.items.length === 0) && (F = setTimeout(() => {
1081
- r.value >= q.value ? e.autoplayLoop ? me(0, { behavior: "smooth" }) : G() : m("smooth");
1082
- }, $.value));
1157
+ function B() {
1158
+ le(), !(!e.autoplay || e.items.length === 0) && (P = setTimeout(() => {
1159
+ o.value >= ae.value ? e.autoplayLoop ? ge(0, { behavior: "smooth" }) : le() : g("smooth");
1160
+ }, k.value));
1083
1161
  }
1084
- function G() {
1085
- F !== void 0 && (clearTimeout(F), F = void 0);
1162
+ function le() {
1163
+ P !== void 0 && (clearTimeout(P), P = void 0);
1086
1164
  }
1087
- function Me() {
1088
- L.value = !0, e.pauseOnHover && G();
1165
+ function oe() {
1166
+ V.value = !0, e.pauseOnHover && le();
1089
1167
  }
1090
- function se() {
1091
- L.value = !1, e.autoplay && z();
1168
+ function re() {
1169
+ V.value = !1, e.autoplay && B();
1092
1170
  }
1093
- function ue() {
1094
- W = void 0;
1095
- }
1096
- function Y(l) {
1097
- if (B.value <= 0 || Z) return;
1098
- const o = l.currentTarget.scrollLeft;
1099
- if (W !== void 0) {
1100
- const h = W * B.value;
1101
- if (Math.abs(o - h) > 1) return;
1102
- W = void 0;
1171
+ function Me() {
1172
+ Q = void 0;
1173
+ }
1174
+ function _(t) {
1175
+ if (R.value <= 0 || X) return;
1176
+ const a = t.currentTarget.scrollLeft;
1177
+ if (Q !== void 0) {
1178
+ const h = Q * R.value;
1179
+ if (Math.abs(a - h) > 1) return;
1180
+ Q = void 0;
1103
1181
  }
1104
- fe(Math.round(o / B.value));
1182
+ F(Math.round(a / R.value));
1105
1183
  }
1106
- function j(l) {
1107
- l.key === "ArrowRight" || l.key === "PageDown" ? (l.preventDefault(), m()) : l.key === "ArrowLeft" || l.key === "PageUp" ? (l.preventDefault(), b()) : l.key === "Home" ? (l.preventDefault(), me(0, { behavior: "smooth" })) : l.key === "End" && (l.preventDefault(), me(q.value, { behavior: "auto" }));
1184
+ function J(t) {
1185
+ t.key === "ArrowRight" || t.key === "PageDown" ? (t.preventDefault(), g()) : t.key === "ArrowLeft" || t.key === "PageUp" ? (t.preventDefault(), E()) : t.key === "Home" ? (t.preventDefault(), ge(0, { behavior: "smooth" })) : t.key === "End" && (t.preventDefault(), ge(ae.value, { behavior: "auto" }));
1108
1186
  }
1109
1187
  function s() {
1110
- var o;
1111
- const l = ((o = f.value) == null ? void 0 : o.clientWidth) ?? 0;
1112
- l <= 0 || l === S.value || (Z = !0, S.value = l, O(() => {
1113
- const h = te(r.value);
1114
- J(h * B.value), Z = !1;
1188
+ var a;
1189
+ const t = ((a = c.value) == null ? void 0 : a.clientWidth) ?? 0;
1190
+ t <= 0 || t === r.value || (X = !0, r.value = t, K(() => {
1191
+ const h = ee(o.value);
1192
+ ve(h * R.value), X = !1;
1115
1193
  }));
1116
1194
  }
1117
- return le(
1195
+ return ie(
1118
1196
  () => e.activeIndex,
1119
- async (l) => {
1120
- const o = te(l);
1121
- o !== r.value && (ue(), r.value = o, await O(), J(o * B.value), ne());
1197
+ async (t) => {
1198
+ const a = ee(t);
1199
+ a !== o.value && (Me(), o.value = a, await K(), ve(a * R.value), D());
1122
1200
  }
1123
- ), le(
1201
+ ), ie(
1124
1202
  () => [
1125
1203
  e.items.length,
1126
- w.value.slidesPerView,
1127
- w.value.gap,
1128
- w.value.slidesToScroll
1204
+ z.value.slidesPerView,
1205
+ z.value.gap,
1206
+ z.value.slidesToScroll
1129
1207
  ],
1130
1208
  async () => {
1131
- const l = te(r.value);
1132
- e.items.length === 0 ? r.value !== 0 && (r.value = 0, y("update:activeIndex", 0)) : fe(l), await O(), J(l * B.value), ne(), e.autoplay && e.items.length > 0 && !L.value && z();
1209
+ const t = ee(o.value);
1210
+ e.items.length === 0 ? o.value !== 0 && (o.value = 0, m("update:activeIndex", 0)) : F(t), await K(), ve(t * R.value), D(), e.autoplay && e.items.length > 0 && !V.value && B();
1133
1211
  }
1134
- ), le(
1212
+ ), ie(
1135
1213
  () => e.responsive,
1136
1214
  () => {
1137
- O(() => {
1138
- const l = te(r.value);
1139
- J(l * B.value);
1215
+ K(() => {
1216
+ const t = ee(o.value);
1217
+ ve(t * R.value);
1140
1218
  });
1141
1219
  },
1142
1220
  { deep: !0 }
1143
- ), le(
1221
+ ), ie(
1144
1222
  () => [
1145
1223
  e.hasMore,
1146
1224
  e.loading,
1147
1225
  e.loadMoreThreshold
1148
1226
  ],
1149
- async ([l]) => {
1150
- l || (U = -1), await O(), ne();
1227
+ async ([t]) => {
1228
+ t || (O = -1), await K(), D();
1151
1229
  }
1152
- ), le(
1230
+ ), ie(
1153
1231
  () => e.autoplay,
1154
- (l) => {
1155
- l && !L.value ? z() : G();
1232
+ (t) => {
1233
+ t && !V.value ? B() : le();
1156
1234
  }
1157
- ), le(
1235
+ ), ie(
1158
1236
  () => e.autoplayDelay,
1159
1237
  () => {
1160
- e.autoplay && !L.value && z();
1238
+ e.autoplay && !V.value && B();
1161
1239
  }
1162
- ), le(
1240
+ ), ie(
1163
1241
  () => e.autoplayLoop,
1164
- (l) => {
1165
- !e.autoplay || L.value || (!l && r.value >= q.value ? G() : z());
1242
+ (t) => {
1243
+ !e.autoplay || V.value || (!t && o.value >= ae.value ? le() : B());
1166
1244
  }
1167
- ), le(
1245
+ ), ie(
1168
1246
  () => e.pauseOnHover,
1169
- (l) => {
1170
- l && L.value ? G() : !l && e.autoplay && z();
1247
+ (t) => {
1248
+ t && V.value ? le() : !t && e.autoplay && B();
1171
1249
  }
1172
- ), ke(async () => {
1173
- s(), typeof ResizeObserver < "u" && f.value && (H = new ResizeObserver(s), H.observe(f.value)), await O(), J(r.value * B.value), ne(), e.autoplay && z();
1174
- }), Le(() => {
1175
- H && (H.disconnect(), H = void 0), G();
1176
- }), _({
1177
- next: m,
1178
- previous: b,
1179
- scrollToIndex: me,
1180
- startAutoplay: z,
1181
- stopAutoplay: G
1182
- }), (l, o) => (x(), T("div", {
1250
+ ), Ce(async () => {
1251
+ s(), typeof ResizeObserver < "u" && c.value && (f = new ResizeObserver(s), f.observe(c.value)), await K(), ve(o.value * R.value), D(), e.autoplay && B();
1252
+ }), Pe(() => {
1253
+ f && (f.disconnect(), f = void 0), le();
1254
+ }), C({
1255
+ next: g,
1256
+ previous: E,
1257
+ scrollToIndex: ge,
1258
+ startAutoplay: B,
1259
+ stopAutoplay: le
1260
+ }), (t, a) => (I(), $("div", {
1183
1261
  ref_key: "viewport",
1184
- ref: f,
1262
+ ref: c,
1185
1263
  class: "vue-virtual-carousel",
1186
- style: C(ve.value),
1264
+ style: N(he.value),
1187
1265
  role: "region",
1188
1266
  "aria-roledescription": "carousel",
1189
- "aria-label": a.ariaLabel,
1267
+ "aria-label": l.ariaLabel,
1190
1268
  tabindex: "0",
1191
- onScrollPassive: Y,
1192
- onPointerdown: ue,
1193
- onWheelPassive: ue,
1194
- onKeydown: j,
1195
- onMouseenter: Me,
1196
- onMouseleave: se
1269
+ onScrollPassive: _,
1270
+ onPointerdown: Me,
1271
+ onWheelPassive: Me,
1272
+ onKeydown: J,
1273
+ onMouseenter: oe,
1274
+ onMouseleave: re
1197
1275
  }, [
1198
- a.items.length ? (x(), T("div", st, [
1199
- M.value > 0 ? (x(), T("div", {
1276
+ l.items.length ? (I(), $("div", Mt, [
1277
+ w.value > 0 ? (I(), $("div", {
1200
1278
  key: 0,
1201
1279
  class: "vue-virtual-carousel__spacer",
1202
- style: C({ flexBasis: `${M.value}px` }),
1280
+ style: N({ flexBasis: `${w.value}px` }),
1203
1281
  "aria-hidden": "true"
1204
- }, null, 4)) : xe("", !0),
1205
- (x(!0), T(ze, null, Ee(oe.value, ({ item: h, index: k }) => (x(), T("div", {
1206
- key: c(p)(h, k),
1282
+ }, null, 4)) : ze("", !0),
1283
+ (I(!0), $(He, null, Ae(ue.value, ({ item: h, index: b }) => (I(), $("div", {
1284
+ key: u(L)(h, b),
1207
1285
  class: "vue-virtual-carousel__item",
1208
- style: C({
1209
- flexBasis: `${X.value}px`,
1210
- marginRight: k < a.items.length - 1 ? `${N.value}px` : "0px"
1286
+ style: N({
1287
+ flexBasis: `${te.value}px`,
1288
+ marginRight: b < l.items.length - 1 ? `${A.value}px` : "0px"
1211
1289
  }),
1212
1290
  role: "listitem",
1213
1291
  "aria-roledescription": "slide",
1214
- "aria-label": `${k + 1} of ${a.items.length}`,
1215
- "aria-current": k === r.value ? "true" : void 0
1292
+ "aria-label": `${b + 1} of ${l.items.length}`,
1293
+ "aria-current": b === o.value ? "true" : void 0
1216
1294
  }, [
1217
- ie(l.$slots, "default", {
1295
+ ce(t.$slots, "default", {
1218
1296
  item: h,
1219
- index: k,
1220
- active: k === r.value,
1221
- visible: ye(k)
1297
+ index: b,
1298
+ active: b === o.value,
1299
+ visible: de(b)
1222
1300
  })
1223
- ], 12, rt))), 128)),
1224
- D.value > 0 ? (x(), T("div", {
1301
+ ], 12, xt))), 128)),
1302
+ q.value > 0 ? (I(), $("div", {
1225
1303
  key: 1,
1226
1304
  class: "vue-virtual-carousel__spacer",
1227
- style: C({ flexBasis: `${D.value}px` }),
1305
+ style: N({ flexBasis: `${q.value}px` }),
1228
1306
  "aria-hidden": "true"
1229
- }, null, 4)) : xe("", !0)
1230
- ])) : (x(), T("div", ut, [
1231
- ie(l.$slots, "empty")
1307
+ }, null, 4)) : ze("", !0)
1308
+ ])) : (I(), $("div", wt, [
1309
+ ce(t.$slots, "empty")
1232
1310
  ]))
1233
- ], 44, it));
1311
+ ], 44, yt));
1234
1312
  }
1235
- }), dt = ["aria-label"], vt = ["aria-posinset", "aria-setsize"], ft = /* @__PURE__ */ $e({
1313
+ }), bt = ["aria-label"], St = ["aria-posinset", "aria-setsize"], zt = /* @__PURE__ */ Oe({
1236
1314
  name: "VirtualScroll",
1237
1315
  __name: "VirtualScroll",
1238
1316
  props: {
@@ -1251,210 +1329,210 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
1251
1329
  pullRefreshThreshold: { default: 64 }
1252
1330
  },
1253
1331
  emits: ["scroll", "loadMore", "refresh"],
1254
- setup(a, { expose: _, emit: E }) {
1255
- const e = a, y = E, {
1256
- pulling: f,
1257
- pullDistance: S,
1258
- pullOffset: r,
1259
- pullProgress: H,
1260
- refreshMessage: U,
1261
- refreshThreshold: F,
1262
- handleTouchStart: W,
1263
- handleTouchMove: Z,
1264
- handleTouchEnd: L,
1265
- handleTouchCancel: p
1266
- } = Ke({
1332
+ setup(l, { expose: C, emit: x }) {
1333
+ const e = l, m = x, {
1334
+ pulling: c,
1335
+ pullDistance: r,
1336
+ pullOffset: o,
1337
+ pullProgress: f,
1338
+ refreshMessage: O,
1339
+ refreshThreshold: P,
1340
+ handleTouchStart: Q,
1341
+ handleTouchMove: X,
1342
+ handleTouchEnd: V,
1343
+ handleTouchCancel: L
1344
+ } = qe({
1267
1345
  enabled: () => e.pullToRefresh,
1268
1346
  refreshing: () => e.refreshing,
1269
1347
  threshold: () => e.pullRefreshThreshold,
1270
- onRefresh: () => y("refresh")
1271
- }), I = P(), w = P(0), A = P(0);
1272
- let V, N = -1;
1273
- const K = Ce(), { getItemKey: ee } = He({
1348
+ onRefresh: () => m("refresh")
1349
+ }), p = U(), z = U(0), Y = U(0);
1350
+ let j, A = -1;
1351
+ const ne = Ue(), { getItemKey: W } = De({
1274
1352
  componentName: "VirtualScroll",
1275
1353
  items: () => e.items,
1276
1354
  itemKey: () => e.itemKey
1277
- }), $ = i(() => Math.max(1, e.itemSize)), X = i(() => Math.max(0, Math.floor(e.overscan))), B = i(
1278
- () => e.items.length * $.value
1279
- ), q = i(
1280
- () => Math.max(1, e.loadingItemSize ?? $.value)
1281
- ), ae = i(
1282
- () => B.value + (e.loading ? q.value : 0)
1283
- ), he = i(() => A.value > 0 ? A.value : typeof e.height == "number" ? e.height : 0), oe = i(
1355
+ }), k = n(() => Math.max(1, e.itemSize)), te = n(() => Math.max(0, Math.floor(e.overscan))), R = n(
1356
+ () => e.items.length * k.value
1357
+ ), ae = n(
1358
+ () => Math.max(1, e.loadingItemSize ?? k.value)
1359
+ ), G = n(
1360
+ () => R.value + (e.loading ? ae.value : 0)
1361
+ ), se = n(() => Y.value > 0 ? Y.value : typeof e.height == "number" ? e.height : 0), ue = n(
1284
1362
  () => Math.max(
1285
1363
  0,
1286
- Math.floor(w.value / $.value) - X.value
1364
+ Math.floor(z.value / k.value) - te.value
1287
1365
  )
1288
- ), v = i(() => {
1289
- const m = Math.ceil(
1290
- (w.value + he.value) / $.value
1366
+ ), y = n(() => {
1367
+ const g = Math.ceil(
1368
+ (z.value + se.value) / k.value
1291
1369
  );
1292
1370
  return Math.min(
1293
1371
  e.items.length,
1294
- m + X.value
1372
+ g + te.value
1295
1373
  );
1296
- }), M = i(
1297
- () => e.items.slice(oe.value, v.value).map((m, b) => ({
1298
- item: m,
1299
- index: oe.value + b
1374
+ }), w = n(
1375
+ () => e.items.slice(ue.value, y.value).map((g, E) => ({
1376
+ item: g,
1377
+ index: ue.value + E
1300
1378
  }))
1301
- ), D = i(() => ({
1302
- height: Ve(e.height)
1303
- })), ve = i(() => ({
1304
- transform: `translateY(${oe.value * $.value}px)`
1379
+ ), q = n(() => ({
1380
+ height: Ye(e.height)
1381
+ })), he = n(() => ({
1382
+ transform: `translateY(${ue.value * k.value}px)`
1305
1383
  }));
1306
- function te() {
1307
- var m;
1308
- A.value = ((m = I.value) == null ? void 0 : m.clientHeight) ?? 0, K(I.value, e.height), O(ne);
1309
- }
1310
- function ye(m) {
1311
- w.value = m.currentTarget.scrollTop, y("scroll", {
1312
- scrollTop: w.value,
1313
- startIndex: oe.value,
1314
- endIndex: v.value
1315
- }), ne();
1316
- }
1317
- function ne() {
1318
- const m = I.value;
1319
- if (!m || !e.hasMore || e.loading || N === e.items.length)
1384
+ function ee() {
1385
+ var g;
1386
+ Y.value = ((g = p.value) == null ? void 0 : g.clientHeight) ?? 0, ne(p.value, e.height), K(D);
1387
+ }
1388
+ function de(g) {
1389
+ z.value = g.currentTarget.scrollTop, m("scroll", {
1390
+ scrollTop: z.value,
1391
+ startIndex: ue.value,
1392
+ endIndex: y.value
1393
+ }), D();
1394
+ }
1395
+ function D() {
1396
+ const g = p.value;
1397
+ if (!g || !e.hasMore || e.loading || A === e.items.length)
1320
1398
  return;
1321
- const b = Math.max(0, e.loadMoreThreshold);
1322
- ae.value - m.scrollTop - m.clientHeight <= b && (N = e.items.length, y("loadMore"));
1323
- }
1324
- function fe(m, b = {}) {
1325
- const z = I.value;
1326
- if (!z) return;
1327
- const G = Math.max(0, ae.value - z.clientHeight), Me = Math.min(
1328
- Math.max(0, Number.isFinite(m) ? m : 0),
1329
- G
1330
- ), se = b.behavior ?? "auto";
1331
- se === "auto" && (w.value = Me), z.scrollTo({ ...b, top: Me, behavior: se });
1332
- }
1333
- function J(m, b = {}) {
1334
- const z = I.value;
1335
- if (!z || e.items.length === 0) return;
1336
- const G = Math.min(
1399
+ const E = Math.max(0, e.loadMoreThreshold);
1400
+ G.value - g.scrollTop - g.clientHeight <= E && (A = e.items.length, m("loadMore"));
1401
+ }
1402
+ function F(g, E = {}) {
1403
+ const B = p.value;
1404
+ if (!B) return;
1405
+ const le = Math.max(0, G.value - B.clientHeight), oe = Math.min(
1406
+ Math.max(0, Number.isFinite(g) ? g : 0),
1407
+ le
1408
+ ), re = E.behavior ?? "auto";
1409
+ re === "auto" && (z.value = oe), B.scrollTo({ ...E, top: oe, behavior: re });
1410
+ }
1411
+ function ve(g, E = {}) {
1412
+ const B = p.value;
1413
+ if (!B || e.items.length === 0) return;
1414
+ const le = Math.min(
1337
1415
  e.items.length - 1,
1338
- Math.max(0, Math.floor(m))
1339
- ), { align: Me = "start", ...se } = b;
1340
- let ue = G * $.value;
1341
- Me === "center" ? ue -= (z.clientHeight - $.value) / 2 : Me === "end" && (ue -= z.clientHeight - $.value), z.scrollTo({
1342
- ...se,
1343
- top: Math.max(0, Math.min(ue, ae.value - z.clientHeight))
1416
+ Math.max(0, Math.floor(g))
1417
+ ), { align: oe = "start", ...re } = E;
1418
+ let Me = le * k.value;
1419
+ oe === "center" ? Me -= (B.clientHeight - k.value) / 2 : oe === "end" && (Me -= B.clientHeight - k.value), B.scrollTo({
1420
+ ...re,
1421
+ top: Math.max(0, Math.min(Me, G.value - B.clientHeight))
1344
1422
  });
1345
1423
  }
1346
- function me(m = "auto") {
1347
- var b;
1348
- (b = I.value) == null || b.scrollTo({ top: 0, behavior: m });
1424
+ function ge(g = "auto") {
1425
+ var E;
1426
+ (E = p.value) == null || E.scrollTo({ top: 0, behavior: g });
1349
1427
  }
1350
- return le(
1428
+ return ie(
1351
1429
  () => [e.items.length, e.itemSize],
1352
1430
  async () => {
1353
- await O();
1354
- const m = I.value;
1355
- if (!m) return;
1356
- const b = Math.max(0, ae.value - m.clientHeight);
1357
- m.scrollTop > b && (m.scrollTop = b, w.value = b), ne();
1431
+ await K();
1432
+ const g = p.value;
1433
+ if (!g) return;
1434
+ const E = Math.max(0, G.value - g.clientHeight);
1435
+ g.scrollTop > E && (g.scrollTop = E, z.value = E), D();
1358
1436
  }
1359
- ), le(
1437
+ ), ie(
1360
1438
  () => [e.hasMore, e.loading],
1361
- async ([m]) => {
1362
- m || (N = -1), await O(), ne();
1439
+ async ([g]) => {
1440
+ g || (A = -1), await K(), D();
1363
1441
  }
1364
- ), ke(() => {
1365
- te(), typeof ResizeObserver < "u" && I.value && (V = new ResizeObserver(te), V.observe(I.value)), O(ne);
1366
- }), Le(() => {
1367
- V && (V.disconnect(), V = void 0);
1368
- }), _({
1369
- scrollTo: fe,
1370
- scrollToIndex: J,
1371
- scrollToTop: me
1372
- }), (m, b) => (x(), T("div", {
1442
+ ), Ce(() => {
1443
+ ee(), typeof ResizeObserver < "u" && p.value && (j = new ResizeObserver(ee), j.observe(p.value)), K(D);
1444
+ }), Pe(() => {
1445
+ j && (j.disconnect(), j = void 0);
1446
+ }), C({
1447
+ scrollTo: F,
1448
+ scrollToIndex: ve,
1449
+ scrollToTop: ge
1450
+ }), (g, E) => (I(), $("div", {
1373
1451
  ref_key: "viewport",
1374
- ref: I,
1375
- class: Be(["vue-virtual-scroll", { "vue-virtual-scroll--pulling": c(f) }]),
1376
- style: C(D.value),
1452
+ ref: p,
1453
+ class: We(["vue-virtual-scroll", { "vue-virtual-scroll--pulling": u(c) }]),
1454
+ style: N(q.value),
1377
1455
  role: "list",
1378
- "aria-label": a.ariaLabel,
1456
+ "aria-label": l.ariaLabel,
1379
1457
  tabindex: "0",
1380
- onScrollPassive: ye,
1381
- onTouchstartPassive: b[0] || (b[0] = //@ts-ignore
1382
- (...z) => c(W) && c(W)(...z)),
1383
- onTouchmove: b[1] || (b[1] = //@ts-ignore
1384
- (...z) => c(Z) && c(Z)(...z)),
1385
- onTouchend: b[2] || (b[2] = //@ts-ignore
1386
- (...z) => c(L) && c(L)(...z)),
1387
- onTouchcancel: b[3] || (b[3] = //@ts-ignore
1388
- (...z) => c(p) && c(p)(...z))
1458
+ onScrollPassive: de,
1459
+ onTouchstartPassive: E[0] || (E[0] = //@ts-ignore
1460
+ (...B) => u(Q) && u(Q)(...B)),
1461
+ onTouchmove: E[1] || (E[1] = //@ts-ignore
1462
+ (...B) => u(X) && u(X)(...B)),
1463
+ onTouchend: E[2] || (E[2] = //@ts-ignore
1464
+ (...B) => u(V) && u(V)(...B)),
1465
+ onTouchcancel: E[3] || (E[3] = //@ts-ignore
1466
+ (...B) => u(L) && u(L)(...B))
1389
1467
  }, [
1390
- a.pullToRefresh || a.refreshing ? (x(), T("div", {
1468
+ l.pullToRefresh || l.refreshing ? (I(), $("div", {
1391
1469
  key: 0,
1392
1470
  class: "vue-virtual-scroll__refresh",
1393
- style: C({
1394
- height: `${c(F)}px`,
1395
- transform: `translateY(${c(r) - c(F)}px)`
1471
+ style: N({
1472
+ height: `${u(P)}px`,
1473
+ transform: `translateY(${u(o) - u(P)}px)`
1396
1474
  }),
1397
1475
  role: "status",
1398
1476
  "aria-live": "polite"
1399
1477
  }, [
1400
- ie(m.$slots, "refresh", {
1401
- pullDistance: c(S),
1402
- progress: c(H),
1403
- refreshing: a.refreshing
1478
+ ce(g.$slots, "refresh", {
1479
+ pullDistance: u(r),
1480
+ progress: u(f),
1481
+ refreshing: l.refreshing
1404
1482
  }, () => [
1405
- Ie(Oe(c(U)), 1)
1483
+ Ve(Ge(u(O)), 1)
1406
1484
  ])
1407
- ], 4)) : xe("", !0),
1408
- a.items.length || a.loading ? (x(), T("div", {
1485
+ ], 4)) : ze("", !0),
1486
+ l.items.length || l.loading ? (I(), $("div", {
1409
1487
  key: 1,
1410
1488
  class: "vue-virtual-scroll__spacer",
1411
- style: C({
1412
- height: `${ae.value}px`,
1413
- transform: `translateY(${c(r)}px)`
1489
+ style: N({
1490
+ height: `${G.value}px`,
1491
+ transform: `translateY(${u(o)}px)`
1414
1492
  })
1415
1493
  }, [
1416
- De("div", {
1494
+ je("div", {
1417
1495
  class: "vue-virtual-scroll__content",
1418
- style: C(ve.value)
1496
+ style: N(he.value)
1419
1497
  }, [
1420
- (x(!0), T(ze, null, Ee(M.value, ({ item: z, index: G }) => (x(), T("div", {
1421
- key: c(ee)(z, G),
1498
+ (I(!0), $(He, null, Ae(w.value, ({ item: B, index: le }) => (I(), $("div", {
1499
+ key: u(W)(B, le),
1422
1500
  class: "vue-virtual-scroll__item",
1423
- style: C({ height: `${$.value}px` }),
1501
+ style: N({ height: `${k.value}px` }),
1424
1502
  role: "listitem",
1425
- "aria-posinset": G + 1,
1426
- "aria-setsize": a.items.length
1503
+ "aria-posinset": le + 1,
1504
+ "aria-setsize": l.items.length
1427
1505
  }, [
1428
- ie(m.$slots, "default", {
1429
- item: z,
1430
- index: G
1506
+ ce(g.$slots, "default", {
1507
+ item: B,
1508
+ index: le
1431
1509
  })
1432
- ], 12, vt))), 128))
1510
+ ], 12, St))), 128))
1433
1511
  ], 4),
1434
- a.loading ? (x(), T("div", {
1512
+ l.loading ? (I(), $("div", {
1435
1513
  key: 0,
1436
1514
  class: "vue-virtual-scroll__loading",
1437
- style: C({
1438
- height: `${q.value}px`,
1439
- transform: `translateY(${B.value}px)`
1515
+ style: N({
1516
+ height: `${ae.value}px`,
1517
+ transform: `translateY(${R.value}px)`
1440
1518
  }),
1441
1519
  role: "status",
1442
1520
  "aria-live": "polite"
1443
1521
  }, [
1444
- ie(m.$slots, "loading", {}, () => [
1445
- b[4] || (b[4] = Ie("Loading more…", -1))
1522
+ ce(g.$slots, "loading", {}, () => [
1523
+ E[4] || (E[4] = Ve("Loading more…", -1))
1446
1524
  ])
1447
- ], 4)) : xe("", !0)
1448
- ], 4)) : (x(), T("div", {
1525
+ ], 4)) : ze("", !0)
1526
+ ], 4)) : (I(), $("div", {
1449
1527
  key: 2,
1450
1528
  class: "vue-virtual-scroll__empty",
1451
- style: C({ transform: `translateY(${c(r)}px)` })
1529
+ style: N({ transform: `translateY(${u(o)}px)` })
1452
1530
  }, [
1453
- ie(m.$slots, "empty")
1531
+ ce(g.$slots, "empty")
1454
1532
  ], 4))
1455
- ], 46, dt));
1533
+ ], 46, bt));
1456
1534
  }
1457
- }), ht = ["aria-label"], mt = ["aria-posinset", "aria-setsize"], gt = /* @__PURE__ */ $e({
1535
+ }), It = ["aria-label"], $t = ["aria-posinset", "aria-setsize"], kt = /* @__PURE__ */ Oe({
1458
1536
  name: "WindowDynamicVirtualScroll",
1459
1537
  __name: "WindowDynamicVirtualScroll",
1460
1538
  props: {
@@ -1472,15 +1550,15 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
1472
1550
  pullRefreshThreshold: { default: 64 }
1473
1551
  },
1474
1552
  emits: ["scroll", "loadMore", "refresh"],
1475
- setup(a, { expose: _, emit: E }) {
1476
- const e = a, y = E, f = P(), S = P(0), r = P(0), H = P(0), U = P(0), F = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
1477
- let L, p, I, w, A = !1, V = !1, N = -1;
1478
- const { getItemKey: K } = He({
1553
+ setup(l, { expose: C, emit: x }) {
1554
+ const e = l, m = x, c = U(), r = U(0), o = U(0), f = U(0), O = U(0), P = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map();
1555
+ let V, L, p, z, Y = !1, j = !1, A = -1;
1556
+ const { getItemKey: ne } = De({
1479
1557
  componentName: "WindowDynamicVirtualScroll",
1480
1558
  items: () => e.items,
1481
1559
  itemKey: () => e.itemKey
1482
1560
  });
1483
- function ee(d) {
1561
+ function W(d) {
1484
1562
  return typeof window.requestAnimationFrame == "function" ? {
1485
1563
  id: window.requestAnimationFrame(d),
1486
1564
  type: "animation"
@@ -1489,312 +1567,312 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
1489
1567
  type: "timeout"
1490
1568
  };
1491
1569
  }
1492
- function $(d) {
1570
+ function k(d) {
1493
1571
  d && (d.type === "animation" ? window.cancelAnimationFrame(d.id) : window.clearTimeout(d.id));
1494
1572
  }
1495
1573
  const {
1496
- pulling: X,
1497
- pullDistance: B,
1498
- pullOffset: q,
1499
- pullProgress: ae,
1500
- refreshMessage: he,
1501
- refreshThreshold: oe,
1502
- handleTouchStart: v,
1503
- handleTouchMove: M,
1504
- handleTouchEnd: D,
1505
- handleTouchCancel: ve
1506
- } = Ke({
1574
+ pulling: te,
1575
+ pullDistance: R,
1576
+ pullOffset: ae,
1577
+ pullProgress: G,
1578
+ refreshMessage: se,
1579
+ refreshThreshold: ue,
1580
+ handleTouchStart: y,
1581
+ handleTouchMove: w,
1582
+ handleTouchEnd: q,
1583
+ handleTouchCancel: he
1584
+ } = qe({
1507
1585
  enabled: () => e.pullToRefresh,
1508
1586
  refreshing: () => e.refreshing,
1509
1587
  threshold: () => e.pullRefreshThreshold,
1510
- onRefresh: () => y("refresh"),
1588
+ onRefresh: () => m("refresh"),
1511
1589
  scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
1512
- }), te = i(
1590
+ }), ee = n(
1513
1591
  () => Math.max(1, e.estimatedItemSize)
1514
- ), ye = i(
1515
- () => Math.max(1, e.loadingItemSize ?? te.value)
1516
- ), ne = i(() => Math.max(0, Math.floor(e.overscan))), fe = i(() => {
1517
- U.value;
1518
- const d = new Array(e.items.length + 1), t = new Array(e.items.length);
1592
+ ), de = n(
1593
+ () => Math.max(1, e.loadingItemSize ?? ee.value)
1594
+ ), D = n(() => Math.max(0, Math.floor(e.overscan))), F = n(() => {
1595
+ O.value;
1596
+ const d = new Array(e.items.length + 1), S = new Array(e.items.length);
1519
1597
  d[0] = 0;
1520
- for (let n = 0; n < e.items.length; n += 1) {
1521
- const u = K(e.items[n], n), g = F.get(u) ?? te.value;
1522
- t[n] = g, d[n + 1] = d[n] + g;
1598
+ for (let T = 0; T < e.items.length; T += 1) {
1599
+ const fe = ne(e.items[T], T), Z = P.get(fe) ?? ee.value;
1600
+ S[T] = Z, d[T + 1] = d[T] + Z;
1523
1601
  }
1524
1602
  return {
1525
1603
  offsets: d,
1526
- sizes: t,
1604
+ sizes: S,
1527
1605
  total: d[e.items.length] ?? 0
1528
1606
  };
1529
- }), J = i(
1530
- () => fe.value.total + (e.loading ? ye.value : 0)
1531
- ), me = i(() => {
1607
+ }), ve = n(
1608
+ () => F.value.total + (e.loading ? de.value : 0)
1609
+ ), ge = n(() => {
1532
1610
  const d = /* @__PURE__ */ new Map();
1533
- return e.items.forEach((t, n) => {
1534
- d.set(K(t, n), n);
1611
+ return e.items.forEach((S, T) => {
1612
+ d.set(ne(S, T), T);
1535
1613
  }), d;
1536
- }), m = i(
1537
- () => Math.max(0, S.value - H.value)
1614
+ }), g = n(
1615
+ () => Math.max(0, r.value - f.value)
1538
1616
  );
1539
- function b(d) {
1617
+ function E(d) {
1540
1618
  if (e.items.length === 0) return 0;
1541
- const t = fe.value.offsets;
1542
- let n = 0, u = e.items.length;
1543
- for (; n < u; ) {
1544
- const g = Math.floor((n + u) / 2);
1545
- t[g + 1] <= d ? n = g + 1 : u = g;
1619
+ const S = F.value.offsets;
1620
+ let T = 0, fe = e.items.length;
1621
+ for (; T < fe; ) {
1622
+ const Z = Math.floor((T + fe) / 2);
1623
+ S[Z + 1] <= d ? T = Z + 1 : fe = Z;
1546
1624
  }
1547
- return Math.min(n, e.items.length - 1);
1625
+ return Math.min(T, e.items.length - 1);
1548
1626
  }
1549
- const z = i(
1627
+ const B = n(
1550
1628
  () => Math.max(
1551
1629
  0,
1552
- b(m.value) - ne.value
1630
+ E(g.value) - D.value
1553
1631
  )
1554
- ), G = i(() => {
1632
+ ), le = n(() => {
1555
1633
  if (e.items.length === 0) return 0;
1556
- const d = S.value + r.value - H.value, t = Math.max(
1557
- te.value,
1634
+ const d = r.value + o.value - f.value, S = Math.max(
1635
+ ee.value,
1558
1636
  d
1559
- ), n = b(t) + 1;
1637
+ ), T = E(S) + 1;
1560
1638
  return Math.min(
1561
1639
  e.items.length,
1562
- n + ne.value
1640
+ T + D.value
1563
1641
  );
1564
- }), Me = i(
1565
- () => e.items.slice(z.value, G.value).map((d, t) => {
1566
- const n = z.value + t;
1642
+ }), oe = n(
1643
+ () => e.items.slice(B.value, le.value).map((d, S) => {
1644
+ const T = B.value + S;
1567
1645
  return {
1568
1646
  item: d,
1569
- index: n,
1570
- key: K(d, n),
1571
- top: fe.value.offsets[n]
1647
+ index: T,
1648
+ key: ne(d, T),
1649
+ top: F.value.offsets[T]
1572
1650
  };
1573
1651
  })
1574
1652
  );
1575
- function se() {
1576
- typeof window > "u" || (S.value = Math.max(0, window.scrollY), r.value = window.innerHeight, f.value && (H.value = f.value.getBoundingClientRect().top + S.value));
1653
+ function re() {
1654
+ typeof window > "u" || (r.value = Math.max(0, window.scrollY), o.value = window.innerHeight, c.value && (f.value = c.value.getBoundingClientRect().top + r.value));
1577
1655
  }
1578
- function ue() {
1579
- y("scroll", {
1580
- scrollTop: m.value,
1581
- startIndex: z.value,
1582
- endIndex: G.value
1656
+ function Me() {
1657
+ m("scroll", {
1658
+ scrollTop: g.value,
1659
+ startIndex: B.value,
1660
+ endIndex: le.value
1583
1661
  });
1584
1662
  }
1585
- function Y(d = !1) {
1586
- V && (A || (A = d), !I && (I = ee(() => {
1587
- I = void 0, se(), A && (A = !1, ue()), l();
1663
+ function _(d = !1) {
1664
+ j && (Y || (Y = d), !p && (p = W(() => {
1665
+ p = void 0, re(), Y && (Y = !1, Me()), t();
1588
1666
  })));
1589
1667
  }
1590
- function j() {
1591
- Y(!0);
1668
+ function J() {
1669
+ _(!0);
1592
1670
  }
1593
1671
  function s() {
1594
- Y();
1672
+ _();
1595
1673
  }
1596
- function l() {
1597
- if (typeof window > "u" || !e.hasMore || e.loading || N === e.items.length)
1674
+ function t() {
1675
+ if (typeof window > "u" || !e.hasMore || e.loading || A === e.items.length)
1598
1676
  return;
1599
- const d = Math.max(0, e.loadMoreThreshold), t = H.value + J.value, n = S.value + r.value;
1600
- t - n <= d && (N = e.items.length, y("loadMore"));
1601
- }
1602
- function o(d) {
1603
- const t = d.borderBoxSize;
1604
- if (t) {
1605
- const n = Array.isArray(t) ? t[0] : t;
1606
- if (n != null && n.blockSize) return n.blockSize;
1677
+ const d = Math.max(0, e.loadMoreThreshold), S = f.value + ve.value, T = r.value + o.value;
1678
+ S - T <= d && (A = e.items.length, m("loadMore"));
1679
+ }
1680
+ function a(d) {
1681
+ const S = d.borderBoxSize;
1682
+ if (S) {
1683
+ const T = Array.isArray(S) ? S[0] : S;
1684
+ if (T != null && T.blockSize) return T.blockSize;
1607
1685
  }
1608
1686
  return d.contentRect.height;
1609
1687
  }
1610
1688
  function h(d) {
1611
- const t = fe.value;
1612
- let n = 0, u = !1;
1613
- for (const g of d) {
1614
- const R = g.target, Q = W.get(R), re = o(g);
1615
- if (Q === void 0 || re <= 0) continue;
1616
- const ce = F.get(Q) ?? te.value;
1617
- if (Math.abs(ce - re) < 0.5) continue;
1618
- const de = me.value.get(Q);
1619
- de !== void 0 && t.offsets[de + 1] <= m.value && (n += re - ce), F.set(Q, re), u = !0;
1689
+ const S = F.value;
1690
+ let T = 0, fe = !1;
1691
+ for (const Z of d) {
1692
+ const be = Z.target, Ie = Q.get(be), Be = a(Z);
1693
+ if (Ie === void 0 || Be <= 0) continue;
1694
+ const Ke = P.get(Ie) ?? ee.value;
1695
+ if (Math.abs(Ke - Be) < 0.5) continue;
1696
+ const Re = ge.value.get(Ie);
1697
+ Re !== void 0 && S.offsets[Re + 1] <= g.value && (T += Be - Ke), P.set(Ie, Be), fe = !0;
1620
1698
  }
1621
- u && (U.value += 1, O(() => {
1622
- if (V) {
1623
- if (n !== 0 && typeof window < "u") {
1624
- const g = Math.max(
1699
+ fe && (O.value += 1, K(() => {
1700
+ if (j) {
1701
+ if (T !== 0 && typeof window < "u") {
1702
+ const Z = Math.max(
1625
1703
  0,
1626
- S.value + n
1704
+ r.value + T
1627
1705
  );
1628
- S.value = g, window.scrollTo({ top: g, behavior: "auto" });
1706
+ r.value = Z, window.scrollTo({ top: Z, behavior: "auto" });
1629
1707
  }
1630
- se(), l();
1708
+ re(), t();
1631
1709
  }
1632
1710
  }));
1633
1711
  }
1634
- function k(d) {
1635
- if (V) {
1636
- for (const t of d)
1637
- Z.set(t.target, t);
1638
- w || (w = ee(() => {
1639
- w = void 0;
1640
- const t = Array.from(Z.values());
1641
- Z.clear(), h(t);
1712
+ function b(d) {
1713
+ if (j) {
1714
+ for (const S of d)
1715
+ X.set(S.target, S);
1716
+ z || (z = W(() => {
1717
+ z = void 0;
1718
+ const S = Array.from(X.values());
1719
+ X.clear(), h(S);
1642
1720
  }));
1643
1721
  }
1644
1722
  }
1645
- function ge(d, t) {
1646
- d instanceof HTMLElement && (W.set(d, t), p == null || p.observe(d));
1723
+ function xe(d, S) {
1724
+ d instanceof HTMLElement && (Q.set(d, S), L == null || L.observe(d));
1647
1725
  }
1648
1726
  function pe() {
1649
- for (const [d] of W)
1650
- d.isConnected || (p == null || p.unobserve(d), W.delete(d));
1727
+ for (const [d] of Q)
1728
+ d.isConnected || (L == null || L.unobserve(d), Q.delete(d));
1651
1729
  }
1652
- function we(d, t = {}) {
1730
+ function me(d, S = {}) {
1653
1731
  if (typeof window > "u") return;
1654
- se();
1655
- const n = Math.max(0, J.value - r.value), u = Math.min(
1732
+ re();
1733
+ const T = Math.max(0, ve.value - o.value), fe = Math.min(
1656
1734
  Math.max(0, Number.isFinite(d) ? d : 0),
1657
- n
1658
- ), g = Math.max(0, H.value + u), R = t.behavior ?? "auto";
1659
- R === "auto" && (S.value = g), window.scrollTo({ ...t, top: g, behavior: R });
1735
+ T
1736
+ ), Z = Math.max(0, f.value + fe), be = S.behavior ?? "auto";
1737
+ be === "auto" && (r.value = Z), window.scrollTo({ ...S, top: Z, behavior: be });
1660
1738
  }
1661
- function be(d, t = {}) {
1739
+ function Ee(d, S = {}) {
1662
1740
  if (typeof window > "u" || e.items.length === 0) return;
1663
- se();
1664
- const n = Math.min(
1741
+ re();
1742
+ const T = Math.min(
1665
1743
  e.items.length - 1,
1666
1744
  Math.max(0, Math.floor(d))
1667
- ), { align: u = "start", ...g } = t, R = fe.value.sizes[n];
1668
- let Q = H.value + fe.value.offsets[n];
1669
- u === "center" ? Q -= (r.value - R) / 2 : u === "end" && (Q -= r.value - R);
1670
- const re = Math.max(
1671
- H.value,
1672
- H.value + J.value - r.value
1673
- ), ce = Math.max(0, Math.min(Q, re)), de = g.behavior ?? "auto";
1674
- de === "auto" && (S.value = ce), window.scrollTo({
1675
- ...g,
1676
- top: ce,
1677
- behavior: de
1745
+ ), { align: fe = "start", ...Z } = S, be = F.value.sizes[T];
1746
+ let Ie = f.value + F.value.offsets[T];
1747
+ fe === "center" ? Ie -= (o.value - be) / 2 : fe === "end" && (Ie -= o.value - be);
1748
+ const Be = Math.max(
1749
+ f.value,
1750
+ f.value + ve.value - o.value
1751
+ ), Ke = Math.max(0, Math.min(Ie, Be)), Re = Z.behavior ?? "auto";
1752
+ Re === "auto" && (r.value = Ke), window.scrollTo({
1753
+ ...Z,
1754
+ top: Ke,
1755
+ behavior: Re
1678
1756
  });
1679
1757
  }
1680
- function Te(d = "auto") {
1681
- typeof window > "u" || (se(), window.scrollTo({ top: Math.max(0, H.value), behavior: d }));
1758
+ function ke(d = "auto") {
1759
+ typeof window > "u" || (re(), window.scrollTo({ top: Math.max(0, f.value), behavior: d }));
1682
1760
  }
1683
- return le(
1761
+ return ie(
1684
1762
  () => e.itemKey,
1685
1763
  () => {
1686
- F.clear(), U.value += 1, N = -1;
1764
+ P.clear(), O.value += 1, A = -1;
1687
1765
  }
1688
- ), le(
1689
- () => e.items.map((d, t) => K(d, t)),
1690
- async (d, t) => {
1691
- const n = d.length !== t.length || d.some((g, R) => g !== t[R]), u = new Set(d);
1692
- for (const g of F.keys())
1693
- u.has(g) || F.delete(g);
1694
- n && (N = -1), U.value += 1, await O(), V && (se(), l());
1766
+ ), ie(
1767
+ () => e.items.map((d, S) => ne(d, S)),
1768
+ async (d, S) => {
1769
+ const T = d.length !== S.length || d.some((Z, be) => Z !== S[be]), fe = new Set(d);
1770
+ for (const Z of P.keys())
1771
+ fe.has(Z) || P.delete(Z);
1772
+ T && (A = -1), O.value += 1, await K(), j && (re(), t());
1695
1773
  }
1696
- ), le(
1774
+ ), ie(
1697
1775
  () => [e.hasMore, e.loading],
1698
1776
  async ([d]) => {
1699
- d || (N = -1), await O(), V && (se(), l());
1777
+ d || (A = -1), await K(), j && (re(), t());
1700
1778
  }
1701
- ), ke(() => {
1702
- if (V = !0, se(), window.addEventListener("scroll", j, { passive: !0 }), window.addEventListener("resize", s, { passive: !0 }), typeof ResizeObserver < "u") {
1703
- L = new ResizeObserver(() => {
1704
- Y();
1705
- }), p = new ResizeObserver(k), f.value && L.observe(f.value);
1706
- for (const [d] of W)
1707
- p.observe(d);
1779
+ ), Ce(() => {
1780
+ if (j = !0, re(), window.addEventListener("scroll", J, { passive: !0 }), window.addEventListener("resize", s, { passive: !0 }), typeof ResizeObserver < "u") {
1781
+ V = new ResizeObserver(() => {
1782
+ _();
1783
+ }), L = new ResizeObserver(b), c.value && V.observe(c.value);
1784
+ for (const [d] of Q)
1785
+ L.observe(d);
1708
1786
  }
1709
- O(() => {
1710
- V && l();
1787
+ K(() => {
1788
+ j && t();
1711
1789
  });
1712
- }), Ae(pe), Le(() => {
1713
- V = !1, window.removeEventListener("scroll", j), window.removeEventListener("resize", s), $(I), $(w), I = void 0, w = void 0, A = !1, Z.clear(), L && (L.disconnect(), L = void 0), p && (p.disconnect(), p = void 0), W.clear();
1714
- }), _({
1715
- scrollTo: we,
1716
- scrollToIndex: be,
1717
- scrollToTop: Te
1718
- }), (d, t) => (x(), T("div", {
1790
+ }), Je(pe), Pe(() => {
1791
+ j = !1, window.removeEventListener("scroll", J), window.removeEventListener("resize", s), k(p), k(z), p = void 0, z = void 0, Y = !1, X.clear(), V && (V.disconnect(), V = void 0), L && (L.disconnect(), L = void 0), Q.clear();
1792
+ }), C({
1793
+ scrollTo: me,
1794
+ scrollToIndex: Ee,
1795
+ scrollToTop: ke
1796
+ }), (d, S) => (I(), $("div", {
1719
1797
  ref_key: "root",
1720
- ref: f,
1721
- class: Be(["vue-window-dynamic-virtual-scroll", { "vue-window-dynamic-virtual-scroll--pulling": c(X) }]),
1798
+ ref: c,
1799
+ class: We(["vue-window-dynamic-virtual-scroll", { "vue-window-dynamic-virtual-scroll--pulling": u(te) }]),
1722
1800
  role: "list",
1723
- "aria-label": a.ariaLabel,
1724
- onTouchstartPassive: t[0] || (t[0] = //@ts-ignore
1725
- (...n) => c(v) && c(v)(...n)),
1726
- onTouchmove: t[1] || (t[1] = //@ts-ignore
1727
- (...n) => c(M) && c(M)(...n)),
1728
- onTouchend: t[2] || (t[2] = //@ts-ignore
1729
- (...n) => c(D) && c(D)(...n)),
1730
- onTouchcancel: t[3] || (t[3] = //@ts-ignore
1731
- (...n) => c(ve) && c(ve)(...n))
1801
+ "aria-label": l.ariaLabel,
1802
+ onTouchstartPassive: S[0] || (S[0] = //@ts-ignore
1803
+ (...T) => u(y) && u(y)(...T)),
1804
+ onTouchmove: S[1] || (S[1] = //@ts-ignore
1805
+ (...T) => u(w) && u(w)(...T)),
1806
+ onTouchend: S[2] || (S[2] = //@ts-ignore
1807
+ (...T) => u(q) && u(q)(...T)),
1808
+ onTouchcancel: S[3] || (S[3] = //@ts-ignore
1809
+ (...T) => u(he) && u(he)(...T))
1732
1810
  }, [
1733
- a.pullToRefresh || a.refreshing ? (x(), T("div", {
1811
+ l.pullToRefresh || l.refreshing ? (I(), $("div", {
1734
1812
  key: 0,
1735
1813
  class: "vue-window-dynamic-virtual-scroll__refresh",
1736
- style: C({
1737
- height: `${c(oe)}px`,
1738
- transform: `translateY(${c(q) - c(oe)}px)`
1814
+ style: N({
1815
+ height: `${u(ue)}px`,
1816
+ transform: `translateY(${u(ae) - u(ue)}px)`
1739
1817
  }),
1740
1818
  role: "status",
1741
1819
  "aria-live": "polite"
1742
1820
  }, [
1743
- ie(d.$slots, "refresh", {
1744
- pullDistance: c(B),
1745
- progress: c(ae),
1746
- refreshing: a.refreshing
1821
+ ce(d.$slots, "refresh", {
1822
+ pullDistance: u(R),
1823
+ progress: u(G),
1824
+ refreshing: l.refreshing
1747
1825
  }, () => [
1748
- Ie(Oe(c(he)), 1)
1826
+ Ve(Ge(u(se)), 1)
1749
1827
  ])
1750
- ], 4)) : xe("", !0),
1751
- a.items.length || a.loading ? (x(), T("div", {
1828
+ ], 4)) : ze("", !0),
1829
+ l.items.length || l.loading ? (I(), $("div", {
1752
1830
  key: 1,
1753
1831
  class: "vue-window-dynamic-virtual-scroll__spacer",
1754
- style: C({
1755
- height: `${J.value}px`,
1756
- transform: `translateY(${c(q)}px)`
1832
+ style: N({
1833
+ height: `${ve.value}px`,
1834
+ transform: `translateY(${u(ae)}px)`
1757
1835
  })
1758
1836
  }, [
1759
- (x(!0), T(ze, null, Ee(Me.value, ({ item: n, index: u, key: g, top: R }) => (x(), T("div", {
1760
- key: g,
1837
+ (I(!0), $(He, null, Ae(oe.value, ({ item: T, index: fe, key: Z, top: be }) => (I(), $("div", {
1838
+ key: Z,
1761
1839
  ref_for: !0,
1762
- ref: (Q) => ge(Q, g),
1840
+ ref: (Ie) => xe(Ie, Z),
1763
1841
  class: "vue-window-dynamic-virtual-scroll__item",
1764
- style: C({ transform: `translateY(${R}px)` }),
1842
+ style: N({ transform: `translateY(${be}px)` }),
1765
1843
  role: "listitem",
1766
- "aria-posinset": u + 1,
1767
- "aria-setsize": a.items.length
1844
+ "aria-posinset": fe + 1,
1845
+ "aria-setsize": l.items.length
1768
1846
  }, [
1769
- ie(d.$slots, "default", {
1770
- item: n,
1771
- index: u
1847
+ ce(d.$slots, "default", {
1848
+ item: T,
1849
+ index: fe
1772
1850
  })
1773
- ], 12, mt))), 128)),
1774
- a.loading ? (x(), T("div", {
1851
+ ], 12, $t))), 128)),
1852
+ l.loading ? (I(), $("div", {
1775
1853
  key: 0,
1776
1854
  class: "vue-window-dynamic-virtual-scroll__loading",
1777
- style: C({
1778
- height: `${ye.value}px`,
1779
- transform: `translateY(${fe.value.total}px)`
1855
+ style: N({
1856
+ height: `${de.value}px`,
1857
+ transform: `translateY(${F.value.total}px)`
1780
1858
  }),
1781
1859
  role: "status",
1782
1860
  "aria-live": "polite"
1783
1861
  }, [
1784
- ie(d.$slots, "loading", {}, () => [
1785
- t[4] || (t[4] = Ie("Loading more…", -1))
1862
+ ce(d.$slots, "loading", {}, () => [
1863
+ S[4] || (S[4] = Ve("Loading more…", -1))
1786
1864
  ])
1787
- ], 4)) : xe("", !0)
1788
- ], 4)) : (x(), T("div", {
1865
+ ], 4)) : ze("", !0)
1866
+ ], 4)) : (I(), $("div", {
1789
1867
  key: 2,
1790
1868
  class: "vue-window-dynamic-virtual-scroll__empty",
1791
- style: C({ transform: `translateY(${c(q)}px)` })
1869
+ style: N({ transform: `translateY(${u(ae)}px)` })
1792
1870
  }, [
1793
- ie(d.$slots, "empty")
1871
+ ce(d.$slots, "empty")
1794
1872
  ], 4))
1795
- ], 42, ht));
1873
+ ], 42, It));
1796
1874
  }
1797
- }), pt = ["aria-label"], yt = ["aria-posinset", "aria-setsize"], Mt = /* @__PURE__ */ $e({
1875
+ }), Lt = ["aria-label"], Et = ["aria-posinset", "aria-setsize"], Bt = /* @__PURE__ */ Oe({
1798
1876
  name: "WindowGirdVirtualScroll",
1799
1877
  __name: "WindowGirdVirtualScroll",
1800
1878
  props: {
@@ -1814,133 +1892,133 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
1814
1892
  pullRefreshThreshold: { default: 64 }
1815
1893
  },
1816
1894
  emits: ["scroll", "loadMore", "refresh"],
1817
- setup(a, { expose: _, emit: E }) {
1818
- const e = a, y = E, f = P(), S = P(0), r = P(0), H = P(0);
1819
- let U, F = -1;
1820
- const { getItemKey: W } = He({
1895
+ setup(l, { expose: C, emit: x }) {
1896
+ const e = l, m = x, c = U(), r = U(0), o = U(0), f = U(0);
1897
+ let O, P = -1;
1898
+ const { getItemKey: Q } = De({
1821
1899
  componentName: "WindowGirdVirtualScroll",
1822
1900
  items: () => e.items,
1823
1901
  itemKey: () => e.itemKey
1824
1902
  }), {
1825
- pulling: Z,
1826
- pullDistance: L,
1827
- pullOffset: p,
1828
- pullProgress: I,
1829
- refreshMessage: w,
1830
- refreshThreshold: A,
1831
- handleTouchStart: V,
1832
- handleTouchMove: N,
1833
- handleTouchEnd: K,
1834
- handleTouchCancel: ee
1835
- } = Ke({
1903
+ pulling: X,
1904
+ pullDistance: V,
1905
+ pullOffset: L,
1906
+ pullProgress: p,
1907
+ refreshMessage: z,
1908
+ refreshThreshold: Y,
1909
+ handleTouchStart: j,
1910
+ handleTouchMove: A,
1911
+ handleTouchEnd: ne,
1912
+ handleTouchCancel: W
1913
+ } = qe({
1836
1914
  enabled: () => e.pullToRefresh,
1837
1915
  refreshing: () => e.refreshing,
1838
1916
  threshold: () => e.pullRefreshThreshold,
1839
- onRefresh: () => y("refresh"),
1917
+ onRefresh: () => m("refresh"),
1840
1918
  scrollTop: () => typeof window > "u" ? 0 : Math.max(0, window.scrollY)
1841
- }), $ = i(() => Math.max(1, e.itemSize)), X = i(
1919
+ }), k = n(() => Math.max(1, e.itemSize)), te = n(
1842
1920
  () => Math.max(1, Math.floor(e.columns))
1843
- ), B = i(() => Math.max(0, e.gap)), q = i(() => Math.max(0, Math.floor(e.overscan))), ae = i(
1844
- () => Math.max(1, e.loadingItemSize ?? $.value)
1845
- ), he = i(
1846
- () => $.value + B.value
1847
- ), oe = i(
1848
- () => Math.ceil(e.items.length / X.value)
1849
- ), v = i(() => oe.value === 0 ? 0 : oe.value * $.value + (oe.value - 1) * B.value), M = i(
1850
- () => v.value + (e.items.length ? B.value : 0)
1851
- ), D = i(
1852
- () => v.value + (e.loading ? ae.value + (e.items.length ? B.value : 0) : 0)
1853
- ), ve = i(
1854
- () => Math.max(0, S.value - H.value)
1855
- ), te = i(
1921
+ ), R = n(() => Math.max(0, e.gap)), ae = n(() => Math.max(0, Math.floor(e.overscan))), G = n(
1922
+ () => Math.max(1, e.loadingItemSize ?? k.value)
1923
+ ), se = n(
1924
+ () => k.value + R.value
1925
+ ), ue = n(
1926
+ () => Math.ceil(e.items.length / te.value)
1927
+ ), y = n(() => ue.value === 0 ? 0 : ue.value * k.value + (ue.value - 1) * R.value), w = n(
1928
+ () => y.value + (e.items.length ? R.value : 0)
1929
+ ), q = n(
1930
+ () => y.value + (e.loading ? G.value + (e.items.length ? R.value : 0) : 0)
1931
+ ), he = n(
1932
+ () => Math.max(0, r.value - f.value)
1933
+ ), ee = n(
1856
1934
  () => Math.max(
1857
1935
  0,
1858
- Math.floor(ve.value / he.value) - q.value
1936
+ Math.floor(he.value / se.value) - ae.value
1859
1937
  )
1860
- ), ye = i(() => {
1861
- if (oe.value === 0) return 0;
1862
- const Y = Math.max(
1863
- $.value,
1864
- S.value + r.value - H.value
1865
- ), j = Math.ceil(
1866
- (Y + B.value) / he.value
1938
+ ), de = n(() => {
1939
+ if (ue.value === 0) return 0;
1940
+ const _ = Math.max(
1941
+ k.value,
1942
+ r.value + o.value - f.value
1943
+ ), J = Math.ceil(
1944
+ (_ + R.value) / se.value
1867
1945
  );
1868
1946
  return Math.min(
1869
- oe.value,
1870
- j + q.value
1947
+ ue.value,
1948
+ J + ae.value
1871
1949
  );
1872
- }), ne = i(
1873
- () => Math.min(e.items.length, te.value * X.value)
1874
- ), fe = i(
1875
- () => Math.min(e.items.length, ye.value * X.value)
1876
- ), J = i(
1877
- () => e.items.slice(ne.value, fe.value).map((Y, j) => {
1878
- const s = ne.value + j;
1950
+ }), D = n(
1951
+ () => Math.min(e.items.length, ee.value * te.value)
1952
+ ), F = n(
1953
+ () => Math.min(e.items.length, de.value * te.value)
1954
+ ), ve = n(
1955
+ () => e.items.slice(D.value, F.value).map((_, J) => {
1956
+ const s = D.value + J;
1879
1957
  return {
1880
- item: Y,
1958
+ item: _,
1881
1959
  index: s,
1882
- key: W(Y, s),
1883
- rowIndex: Math.floor(s / X.value),
1884
- columnIndex: s % X.value
1960
+ key: Q(_, s),
1961
+ rowIndex: Math.floor(s / te.value),
1962
+ columnIndex: s % te.value
1885
1963
  };
1886
1964
  })
1887
- ), me = i(() => ({
1888
- gridTemplateColumns: `repeat(${X.value}, minmax(0, 1fr))`,
1889
- columnGap: `${B.value}px`,
1890
- rowGap: `${B.value}px`,
1891
- transform: `translateY(${te.value * he.value}px)`
1965
+ ), ge = n(() => ({
1966
+ gridTemplateColumns: `repeat(${te.value}, minmax(0, 1fr))`,
1967
+ columnGap: `${R.value}px`,
1968
+ rowGap: `${R.value}px`,
1969
+ transform: `translateY(${ee.value * se.value}px)`
1892
1970
  }));
1893
- function m() {
1894
- typeof window > "u" || (S.value = Math.max(0, window.scrollY), r.value = window.innerHeight, f.value && (H.value = f.value.getBoundingClientRect().top + S.value));
1895
- }
1896
- function b() {
1897
- y("scroll", {
1898
- scrollTop: ve.value,
1899
- startIndex: ne.value,
1900
- endIndex: fe.value
1971
+ function g() {
1972
+ typeof window > "u" || (r.value = Math.max(0, window.scrollY), o.value = window.innerHeight, c.value && (f.value = c.value.getBoundingClientRect().top + r.value));
1973
+ }
1974
+ function E() {
1975
+ m("scroll", {
1976
+ scrollTop: he.value,
1977
+ startIndex: D.value,
1978
+ endIndex: F.value
1901
1979
  });
1902
1980
  }
1903
- function z() {
1904
- m(), b(), G();
1981
+ function B() {
1982
+ g(), E(), le();
1905
1983
  }
1906
- function G() {
1907
- if (typeof window > "u" || !e.hasMore || e.loading || F === e.items.length)
1984
+ function le() {
1985
+ if (typeof window > "u" || !e.hasMore || e.loading || P === e.items.length)
1908
1986
  return;
1909
- const Y = Math.max(0, e.loadMoreThreshold), j = H.value + D.value, s = S.value + r.value;
1910
- j - s <= Y && (F = e.items.length, y("loadMore"));
1987
+ const _ = Math.max(0, e.loadMoreThreshold), J = f.value + q.value, s = r.value + o.value;
1988
+ J - s <= _ && (P = e.items.length, m("loadMore"));
1911
1989
  }
1912
- function Me(Y, j = {}) {
1990
+ function oe(_, J = {}) {
1913
1991
  if (typeof window > "u") return;
1914
- m();
1915
- const s = Math.max(0, D.value - r.value), l = Math.min(
1916
- Math.max(0, Number.isFinite(Y) ? Y : 0),
1992
+ g();
1993
+ const s = Math.max(0, q.value - o.value), t = Math.min(
1994
+ Math.max(0, Number.isFinite(_) ? _ : 0),
1917
1995
  s
1918
- ), o = Math.max(0, H.value + l), h = j.behavior ?? "auto";
1919
- h === "auto" && (S.value = o), window.scrollTo({ ...j, top: o, behavior: h });
1996
+ ), a = Math.max(0, f.value + t), h = J.behavior ?? "auto";
1997
+ h === "auto" && (r.value = a), window.scrollTo({ ...J, top: a, behavior: h });
1920
1998
  }
1921
- function se(Y, j = {}) {
1999
+ function re(_, J = {}) {
1922
2000
  if (typeof window > "u" || e.items.length === 0) return;
1923
- m();
2001
+ g();
1924
2002
  const s = Math.min(
1925
2003
  e.items.length - 1,
1926
- Math.max(0, Math.floor(Y))
1927
- ), l = Math.floor(s / X.value), { align: o = "start", ...h } = j;
1928
- let k = H.value + l * he.value;
1929
- o === "center" ? k -= (r.value - $.value) / 2 : o === "end" && (k -= r.value - $.value);
1930
- const ge = Math.max(
1931
- H.value,
1932
- H.value + D.value - r.value
1933
- ), pe = Math.max(0, Math.min(k, ge)), we = h.behavior ?? "auto";
1934
- we === "auto" && (S.value = pe), window.scrollTo({
2004
+ Math.max(0, Math.floor(_))
2005
+ ), t = Math.floor(s / te.value), { align: a = "start", ...h } = J;
2006
+ let b = f.value + t * se.value;
2007
+ a === "center" ? b -= (o.value - k.value) / 2 : a === "end" && (b -= o.value - k.value);
2008
+ const xe = Math.max(
2009
+ f.value,
2010
+ f.value + q.value - o.value
2011
+ ), pe = Math.max(0, Math.min(b, xe)), me = h.behavior ?? "auto";
2012
+ me === "auto" && (r.value = pe), window.scrollTo({
1935
2013
  ...h,
1936
2014
  top: pe,
1937
- behavior: we
2015
+ behavior: me
1938
2016
  });
1939
2017
  }
1940
- function ue(Y = "auto") {
1941
- typeof window > "u" || (m(), window.scrollTo({ top: Math.max(0, H.value), behavior: Y }));
2018
+ function Me(_ = "auto") {
2019
+ typeof window > "u" || (g(), window.scrollTo({ top: Math.max(0, f.value), behavior: _ }));
1942
2020
  }
1943
- return le(
2021
+ return ie(
1944
2022
  () => [
1945
2023
  e.items.length,
1946
2024
  e.itemSize,
@@ -1948,128 +2026,128 @@ const qe = ["aria-label"], Je = ["aria-posinset", "aria-setsize"], Ne = /* @__PU
1948
2026
  e.gap
1949
2027
  ],
1950
2028
  async () => {
1951
- await O(), m(), G();
2029
+ await K(), g(), le();
1952
2030
  }
1953
- ), le(
2031
+ ), ie(
1954
2032
  () => [e.hasMore, e.loading],
1955
- async ([Y]) => {
1956
- Y || (F = -1), await O(), m(), G();
2033
+ async ([_]) => {
2034
+ _ || (P = -1), await K(), g(), le();
1957
2035
  }
1958
- ), ke(() => {
1959
- m(), window.addEventListener("scroll", z, { passive: !0 }), window.addEventListener("resize", z, { passive: !0 }), typeof ResizeObserver < "u" && (U = new ResizeObserver(() => {
1960
- m(), G();
1961
- }), f.value && U.observe(f.value)), O(G);
1962
- }), Le(() => {
1963
- window.removeEventListener("scroll", z), window.removeEventListener("resize", z), U && (U.disconnect(), U = void 0);
1964
- }), _({
1965
- scrollTo: Me,
1966
- scrollToIndex: se,
1967
- scrollToTop: ue
1968
- }), (Y, j) => (x(), T("div", {
2036
+ ), Ce(() => {
2037
+ g(), window.addEventListener("scroll", B, { passive: !0 }), window.addEventListener("resize", B, { passive: !0 }), typeof ResizeObserver < "u" && (O = new ResizeObserver(() => {
2038
+ g(), le();
2039
+ }), c.value && O.observe(c.value)), K(le);
2040
+ }), Pe(() => {
2041
+ window.removeEventListener("scroll", B), window.removeEventListener("resize", B), O && (O.disconnect(), O = void 0);
2042
+ }), C({
2043
+ scrollTo: oe,
2044
+ scrollToIndex: re,
2045
+ scrollToTop: Me
2046
+ }), (_, J) => (I(), $("div", {
1969
2047
  ref_key: "root",
1970
- ref: f,
1971
- class: Be(["vue-window-gird-virtual-scroll", { "vue-window-gird-virtual-scroll--pulling": c(Z) }]),
2048
+ ref: c,
2049
+ class: We(["vue-window-gird-virtual-scroll", { "vue-window-gird-virtual-scroll--pulling": u(X) }]),
1972
2050
  role: "list",
1973
- "aria-label": a.ariaLabel,
1974
- onTouchstartPassive: j[0] || (j[0] = //@ts-ignore
1975
- (...s) => c(V) && c(V)(...s)),
1976
- onTouchmove: j[1] || (j[1] = //@ts-ignore
1977
- (...s) => c(N) && c(N)(...s)),
1978
- onTouchend: j[2] || (j[2] = //@ts-ignore
1979
- (...s) => c(K) && c(K)(...s)),
1980
- onTouchcancel: j[3] || (j[3] = //@ts-ignore
1981
- (...s) => c(ee) && c(ee)(...s))
2051
+ "aria-label": l.ariaLabel,
2052
+ onTouchstartPassive: J[0] || (J[0] = //@ts-ignore
2053
+ (...s) => u(j) && u(j)(...s)),
2054
+ onTouchmove: J[1] || (J[1] = //@ts-ignore
2055
+ (...s) => u(A) && u(A)(...s)),
2056
+ onTouchend: J[2] || (J[2] = //@ts-ignore
2057
+ (...s) => u(ne) && u(ne)(...s)),
2058
+ onTouchcancel: J[3] || (J[3] = //@ts-ignore
2059
+ (...s) => u(W) && u(W)(...s))
1982
2060
  }, [
1983
- a.pullToRefresh || a.refreshing ? (x(), T("div", {
2061
+ l.pullToRefresh || l.refreshing ? (I(), $("div", {
1984
2062
  key: 0,
1985
2063
  class: "vue-window-gird-virtual-scroll__refresh",
1986
- style: C({
1987
- height: `${c(A)}px`,
1988
- transform: `translateY(${c(p) - c(A)}px)`
2064
+ style: N({
2065
+ height: `${u(Y)}px`,
2066
+ transform: `translateY(${u(L) - u(Y)}px)`
1989
2067
  }),
1990
2068
  role: "status",
1991
2069
  "aria-live": "polite"
1992
2070
  }, [
1993
- ie(Y.$slots, "refresh", {
1994
- pullDistance: c(L),
1995
- progress: c(I),
1996
- refreshing: a.refreshing
2071
+ ce(_.$slots, "refresh", {
2072
+ pullDistance: u(V),
2073
+ progress: u(p),
2074
+ refreshing: l.refreshing
1997
2075
  }, () => [
1998
- Ie(Oe(c(w)), 1)
2076
+ Ve(Ge(u(z)), 1)
1999
2077
  ])
2000
- ], 4)) : xe("", !0),
2001
- a.items.length || a.loading ? (x(), T("div", {
2078
+ ], 4)) : ze("", !0),
2079
+ l.items.length || l.loading ? (I(), $("div", {
2002
2080
  key: 1,
2003
2081
  class: "vue-window-gird-virtual-scroll__spacer",
2004
- style: C({
2005
- height: `${D.value}px`,
2006
- transform: `translateY(${c(p)}px)`
2082
+ style: N({
2083
+ height: `${q.value}px`,
2084
+ transform: `translateY(${u(L)}px)`
2007
2085
  })
2008
2086
  }, [
2009
- De("div", {
2087
+ je("div", {
2010
2088
  class: "vue-window-gird-virtual-scroll__content",
2011
- style: C(me.value)
2089
+ style: N(ge.value)
2012
2090
  }, [
2013
- (x(!0), T(ze, null, Ee(J.value, ({ item: s, index: l, key: o, rowIndex: h, columnIndex: k }) => (x(), T("div", {
2014
- key: o,
2091
+ (I(!0), $(He, null, Ae(ve.value, ({ item: s, index: t, key: a, rowIndex: h, columnIndex: b }) => (I(), $("div", {
2092
+ key: a,
2015
2093
  class: "vue-window-gird-virtual-scroll__item",
2016
- style: C({ height: `${$.value}px` }),
2094
+ style: N({ height: `${k.value}px` }),
2017
2095
  role: "listitem",
2018
- "aria-posinset": l + 1,
2019
- "aria-setsize": a.items.length
2096
+ "aria-posinset": t + 1,
2097
+ "aria-setsize": l.items.length
2020
2098
  }, [
2021
- ie(Y.$slots, "default", {
2099
+ ce(_.$slots, "default", {
2022
2100
  item: s,
2023
- index: l,
2101
+ index: t,
2024
2102
  rowIndex: h,
2025
- columnIndex: k
2103
+ columnIndex: b
2026
2104
  })
2027
- ], 12, yt))), 128))
2105
+ ], 12, Et))), 128))
2028
2106
  ], 4),
2029
- a.loading ? (x(), T("div", {
2107
+ l.loading ? (I(), $("div", {
2030
2108
  key: 0,
2031
2109
  class: "vue-window-gird-virtual-scroll__loading",
2032
- style: C({
2033
- height: `${ae.value}px`,
2034
- transform: `translateY(${M.value}px)`
2110
+ style: N({
2111
+ height: `${G.value}px`,
2112
+ transform: `translateY(${w.value}px)`
2035
2113
  }),
2036
2114
  role: "status",
2037
2115
  "aria-live": "polite"
2038
2116
  }, [
2039
- ie(Y.$slots, "loading", {}, () => [
2040
- j[4] || (j[4] = Ie("Loading more…", -1))
2117
+ ce(_.$slots, "loading", {}, () => [
2118
+ J[4] || (J[4] = Ve("Loading more…", -1))
2041
2119
  ])
2042
- ], 4)) : xe("", !0)
2043
- ], 4)) : (x(), T("div", {
2120
+ ], 4)) : ze("", !0)
2121
+ ], 4)) : (I(), $("div", {
2044
2122
  key: 2,
2045
2123
  class: "vue-window-gird-virtual-scroll__empty",
2046
- style: C({ transform: `translateY(${c(p)}px)` })
2124
+ style: N({ transform: `translateY(${u(L)}px)` })
2047
2125
  }, [
2048
- ie(Y.$slots, "empty")
2126
+ ce(_.$slots, "empty")
2049
2127
  ], 4))
2050
- ], 42, pt));
2128
+ ], 42, Lt));
2051
2129
  }
2052
- }), wt = Ne, Tt = {
2053
- install(a) {
2054
- a.component("ChatVirtualScroll", Ze), a.component("DynamicVirtualScroll", Ne), a.component("ShortMediaFeed", tt), a.component("SkeletonLoader", nt), a.component("VirtualCarousel", ct), a.component("VirtualList", wt), a.component("VirtualScroll", ft), a.component(
2130
+ }), Vt = et, Ht = {
2131
+ install(l) {
2132
+ l.component("ChatVirtualScroll", st), l.component("DynamicVirtualScroll", et), l.component("ShortMediaFeed", ft), l.component("SkeletonLoader", pt), l.component("VirtualCarousel", Tt), l.component("VirtualList", Vt), l.component("VirtualScroll", zt), l.component(
2055
2133
  "WindowDynamicVirtualScroll",
2056
- gt
2057
- ), a.component(
2134
+ kt
2135
+ ), l.component(
2058
2136
  "WindowGirdVirtualScroll",
2059
- Mt
2137
+ Bt
2060
2138
  );
2061
2139
  }
2062
2140
  };
2063
2141
  export {
2064
- Ze as ChatVirtualScroll,
2065
- Ne as DynamicVirtualScroll,
2066
- tt as ShortMediaFeed,
2067
- nt as SkeletonLoader,
2068
- ct as VirtualCarousel,
2069
- wt as VirtualList,
2070
- ft as VirtualScroll,
2071
- Tt as VueVirtualScroll,
2072
- gt as WindowDynamicVirtualScroll,
2073
- Mt as WindowGirdVirtualScroll,
2074
- Tt as default
2142
+ st as ChatVirtualScroll,
2143
+ et as DynamicVirtualScroll,
2144
+ ft as ShortMediaFeed,
2145
+ pt as SkeletonLoader,
2146
+ Tt as VirtualCarousel,
2147
+ Vt as VirtualList,
2148
+ zt as VirtualScroll,
2149
+ Ht as VueVirtualScroll,
2150
+ kt as WindowDynamicVirtualScroll,
2151
+ Bt as WindowGirdVirtualScroll,
2152
+ Ht as default
2075
2153
  };