vue-virtual-flow 0.0.5 → 0.0.6

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