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