@wyxos/vibe 2.2.1 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/index.cjs +1 -1
  2. package/lib/index.js +550 -529
  3. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as xe, ref as v, computed as k, createElementBlock as T, openBlock as _, createElementVNode as C, normalizeStyle as U, watch as oe, onMounted as Qe, onUnmounted as zt, createCommentVNode as Z, createBlock as Ft, unref as le, toDisplayString as Ze, normalizeClass as _t, createVNode as Q, mergeDefaults as fn, useAttrs as dn, shallowRef as Tt, provide as vn, mergeProps as mn, renderSlot as hn, Fragment as Pt, renderList as Et, nextTick as Bt, inject as gn } from "vue";
1
+ import { defineComponent as xe, ref as v, computed as k, createElementBlock as P, openBlock as _, createElementVNode as N, normalizeStyle as U, watch as Z, onMounted as Ze, onUnmounted as Vt, createCommentVNode as ee, createBlock as Ft, unref as ae, toDisplayString as et, normalizeClass as _t, createVNode as Q, mergeDefaults as fn, useAttrs as dn, shallowRef as Pt, provide as vn, mergeProps as mn, renderSlot as hn, Fragment as Tt, renderList as Et, nextTick as Bt, inject as gn } from "vue";
2
2
  const pn = {
3
3
  mode: "default",
4
4
  pageSize: 20,
@@ -12,7 +12,7 @@ const pn = {
12
12
  headerHeight: 0,
13
13
  footerHeight: 0,
14
14
  overscanPx: 600
15
- }, yn = ["aria-label", "aria-valuemax", "aria-valuenow"], Lt = /* @__PURE__ */ xe({
15
+ }, yn = ["aria-label", "aria-valuemax", "aria-valuenow"], zt = /* @__PURE__ */ xe({
16
16
  __name: "MasonryVideoControls",
17
17
  props: {
18
18
  currentTime: {},
@@ -23,99 +23,99 @@ const pn = {
23
23
  },
24
24
  emits: ["seek"],
25
25
  setup(o, { expose: M, emit: i }) {
26
- const a = o, f = i, y = v(null), w = v(null), g = v(null), d = v(!1), p = k(
26
+ const a = o, d = i, b = v(null), y = v(null), h = v(null), u = v(!1), g = k(
27
27
  () => Number.isFinite(a.step) ? Math.max(0, a.step) : 0
28
- ), b = k(
28
+ ), w = k(
29
29
  () => Number.isFinite(a.duration) ? Math.max(0, a.duration) : 0
30
30
  ), S = k(() => {
31
- const u = Number.isFinite(a.currentTime) ? a.currentTime : 0;
32
- return P(u, 0, b.value);
33
- }), N = k(
34
- () => b.value > 0 ? S.value / b.value : 0
31
+ const c = Number.isFinite(a.currentTime) ? a.currentTime : 0;
32
+ return T(c, 0, w.value);
33
+ }), B = k(
34
+ () => w.value > 0 ? S.value / w.value : 0
35
35
  );
36
- function P(u, I, B) {
37
- return Math.min(B, Math.max(I, u));
38
- }
39
- function F(u) {
40
- return p.value <= 0 ? u : Math.round(u / p.value) * p.value;
41
- }
42
- function L(u) {
43
- const I = P(u, 0, b.value);
44
- f("seek", F(I));
45
- }
46
- function R(u) {
47
- const I = w.value;
48
- if (!I) return;
49
- const B = I.getBoundingClientRect();
50
- if (!B.width) return;
51
- const j = P((u - B.left) / B.width, 0, 1);
52
- L(j * b.value);
53
- }
54
- function X(u) {
55
- const I = w.value;
56
- I && (d.value = !0, I.setPointerCapture && I.setPointerCapture(u.pointerId), R(u.clientX));
57
- }
58
- function $(u) {
59
- d.value && R(u.clientX);
60
- }
61
- function H(u) {
62
- if (!d.value) return;
63
- d.value = !1;
64
- const I = w.value;
65
- I?.releasePointerCapture && I.releasePointerCapture(u.pointerId);
66
- }
67
- function q(u) {
68
- if (b.value <= 0) return;
69
- const I = Number.isFinite(a.keyboardStep) ? a.keyboardStep : 1;
70
- let B = S.value;
71
- switch (u.key) {
36
+ function T(c, F, R) {
37
+ return Math.min(R, Math.max(F, c));
38
+ }
39
+ function I(c) {
40
+ return g.value <= 0 ? c : Math.round(c / g.value) * g.value;
41
+ }
42
+ function z(c) {
43
+ const F = T(c, 0, w.value);
44
+ d("seek", I(F));
45
+ }
46
+ function A(c) {
47
+ const F = y.value;
48
+ if (!F) return;
49
+ const R = F.getBoundingClientRect();
50
+ if (!R.width) return;
51
+ const j = T((c - R.left) / R.width, 0, 1);
52
+ z(j * w.value);
53
+ }
54
+ function X(c) {
55
+ const F = y.value;
56
+ F && (u.value = !0, F.setPointerCapture && F.setPointerCapture(c.pointerId), A(c.clientX));
57
+ }
58
+ function $(c) {
59
+ u.value && A(c.clientX);
60
+ }
61
+ function H(c) {
62
+ if (!u.value) return;
63
+ u.value = !1;
64
+ const F = y.value;
65
+ F?.releasePointerCapture && F.releasePointerCapture(c.pointerId);
66
+ }
67
+ function q(c) {
68
+ if (w.value <= 0) return;
69
+ const F = Number.isFinite(a.keyboardStep) ? a.keyboardStep : 1;
70
+ let R = S.value;
71
+ switch (c.key) {
72
72
  case "ArrowLeft":
73
73
  case "ArrowDown":
74
- B -= I;
74
+ R -= F;
75
75
  break;
76
76
  case "ArrowRight":
77
77
  case "ArrowUp":
78
- B += I;
78
+ R += F;
79
79
  break;
80
80
  case "Home":
81
- B = 0;
81
+ R = 0;
82
82
  break;
83
83
  case "End":
84
- B = b.value;
84
+ R = w.value;
85
85
  break;
86
86
  default:
87
87
  return;
88
88
  }
89
- u.preventDefault(), L(B);
89
+ c.preventDefault(), z(R);
90
90
  }
91
- function ae() {
92
- y.value?.focus();
91
+ function te() {
92
+ b.value?.focus();
93
93
  }
94
94
  return M({
95
- focus: ae,
96
- seekTo: L,
97
- percent: N,
95
+ focus: te,
96
+ seekTo: z,
97
+ percent: B,
98
98
  currentValue: S,
99
- maxValue: b,
100
- isDragging: d,
101
- rootEl: y,
102
- trackEl: w,
103
- thumbEl: g
104
- }), (u, I) => (_(), T("div", {
99
+ maxValue: w,
100
+ isDragging: u,
101
+ rootEl: b,
102
+ trackEl: y,
103
+ thumbEl: h
104
+ }), (c, F) => (_(), P("div", {
105
105
  ref_key: "rootEl",
106
- ref: y,
106
+ ref: b,
107
107
  class: "w-full select-none",
108
108
  role: "slider",
109
109
  tabindex: "0",
110
110
  "aria-label": a.ariaLabel,
111
111
  "aria-valuemin": 0,
112
- "aria-valuemax": b.value,
112
+ "aria-valuemax": w.value,
113
113
  "aria-valuenow": S.value,
114
114
  onKeydown: q
115
115
  }, [
116
- C("div", {
116
+ N("div", {
117
117
  ref_key: "trackEl",
118
- ref: w,
118
+ ref: y,
119
119
  class: "relative h-2 w-full cursor-pointer rounded-full bg-slate-200",
120
120
  onPointerdown: X,
121
121
  onPointermove: $,
@@ -123,15 +123,15 @@ const pn = {
123
123
  onPointercancel: H,
124
124
  onPointerleave: H
125
125
  }, [
126
- C("div", {
126
+ N("div", {
127
127
  class: "absolute inset-y-0 left-0 rounded-full bg-slate-500",
128
- style: U({ width: `${N.value * 100}%` })
128
+ style: U({ width: `${B.value * 100}%` })
129
129
  }, null, 4),
130
- C("div", {
130
+ N("div", {
131
131
  ref_key: "thumbEl",
132
- ref: g,
132
+ ref: h,
133
133
  class: "absolute top-1/2 h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full bg-slate-700 shadow",
134
- style: U({ left: `${N.value * 100}%` }),
134
+ style: U({ left: `${B.value * 100}%` }),
135
135
  "aria-hidden": "true"
136
136
  }, null, 4)
137
137
  ], 544)
@@ -167,7 +167,7 @@ const pn = {
167
167
  },
168
168
  emits: ["success", "error"],
169
169
  setup(o, { emit: M }) {
170
- const i = o, a = M, f = xe({
170
+ const i = o, a = M, d = xe({
171
171
  name: "SlotRenderer",
172
172
  props: {
173
173
  slotFn: {
@@ -185,124 +185,145 @@ const pn = {
185
185
  return x ? x(s.slotProps) : null;
186
186
  };
187
187
  }
188
- }), y = v(null), w = v(null), g = v(null), d = v(!1), p = v(!1), b = v(!1), S = v(null), N = k(() => i.item?.type === "video"), P = k(() => {
189
- if (!N.value) return;
188
+ }), b = v(null), y = v(null), h = v(null), u = v(!1), g = v(!1), w = v(!1), S = v(null), B = k(() => i.item?.type === "video"), T = k(() => {
189
+ if (!B.value) return;
190
190
  const s = i.item?.preview, x = i.item?.original;
191
191
  if (!(typeof s != "string" || !s) && !(typeof x == "string" && s === x) && !/\.(mp4|webm)(\?|#|$)/i.test(s) && /\.(png|jpe?g|gif|webp)(\?|#|$)/i.test(s))
192
192
  return s;
193
- }), F = k(() => {
194
- if (!N.value) return;
193
+ }), I = k(() => {
194
+ if (!B.value) return;
195
195
  const s = i.item?.preview;
196
196
  if (typeof s == "string" && s && !/\.(png|jpe?g|gif|webp)(\?|#|$)/i.test(s))
197
197
  return s;
198
198
  const x = i.item?.original;
199
199
  if (typeof x == "string" && x) return x;
200
- }), L = v(!1), R = k(() => !!i.hovered), X = v(0), $ = v(0);
200
+ }), z = v(!1), A = k(() => !!i.hovered), X = v(0), $ = v(0);
201
201
  function H() {
202
202
  i.remove?.();
203
203
  }
204
204
  const q = k(() => {
205
205
  const s = i.item?.width, x = i.item?.height;
206
206
  return { aspectRatio: `${s} / ${x}` };
207
- }), ae = k(() => i.item?.type === "image");
208
- let u = null, I = null;
209
- function B() {
210
- d.value || (d.value = !0, p.value = !1, b.value = !1, S.value = null);
207
+ }), te = k(() => !B.value);
208
+ let c = null, F = null;
209
+ function R() {
210
+ u.value || (u.value = !0, g.value = !1, w.value = !1, S.value = null);
211
211
  }
212
212
  function j(s) {
213
213
  X.value = Number.isFinite(s.duration) ? s.duration : 0, $.value = Number.isFinite(s.currentTime) ? s.currentTime : 0;
214
214
  }
215
215
  async function re() {
216
- if (!N.value || !R.value || !d.value || !p.value || !L.value) return;
217
- const s = g.value;
216
+ if (!B.value || !A.value || !u.value || !g.value || !z.value) return;
217
+ const s = h.value;
218
218
  if (s)
219
219
  try {
220
220
  s.muted = !0, await s.play();
221
221
  } catch {
222
222
  }
223
223
  }
224
- function ee() {
225
- const s = g.value;
224
+ function ne() {
225
+ const s = h.value;
226
226
  s && (s.paused || s.pause());
227
227
  }
228
- function Pe() {
229
- const s = g.value;
228
+ function Ee() {
229
+ const s = h.value;
230
230
  s && (s.paused || s.pause());
231
231
  }
232
- oe(
232
+ Z(
233
233
  () => i.hovered,
234
234
  (s) => {
235
235
  if (s) {
236
- B(), re();
236
+ R(), re();
237
237
  return;
238
238
  }
239
- ee();
239
+ ne();
240
240
  }
241
241
  );
242
- function Ee(s) {
243
- const x = g.value;
242
+ function Be(s) {
243
+ const x = h.value;
244
244
  x && Number.isFinite(s) && (x.currentTime = Math.max(0, Math.min(s, Number.isFinite(x.duration) ? x.duration : s)), j(x));
245
245
  }
246
- Qe(() => {
246
+ Ze(() => {
247
247
  if (typeof IntersectionObserver > "u") {
248
- B();
248
+ R();
249
249
  return;
250
250
  }
251
- if (u = new IntersectionObserver(
251
+ if (c = new IntersectionObserver(
252
252
  (s) => {
253
253
  for (const x of s)
254
254
  if (x.isIntersecting && !((x.intersectionRatio ?? 0) < 0.5)) {
255
- B(), u?.disconnect(), u = null;
255
+ R(), c?.disconnect(), c = null;
256
256
  return;
257
257
  }
258
258
  },
259
259
  { threshold: [0, 0.5, 1] }
260
- ), y.value && u.observe(y.value), N.value && y.value) {
261
- const s = y.value.closest('[data-testid="items-scroll-container"]');
262
- I = new IntersectionObserver(
260
+ ), b.value && c.observe(b.value), B.value && b.value) {
261
+ const s = b.value.closest('[data-testid="items-scroll-container"]');
262
+ F = new IntersectionObserver(
263
263
  (x) => {
264
264
  for (const J of x) {
265
- const Be = J.intersectionRatio ?? 0, Me = !!J.isIntersecting && Be >= 0.5;
266
- L.value = Me, Me ? R.value && re() : Pe();
265
+ const Re = J.intersectionRatio ?? 0, Se = !!J.isIntersecting && Re >= 0.5;
266
+ z.value = Se, Se ? A.value && re() : Ee();
267
267
  }
268
268
  },
269
269
  {
270
270
  root: s ?? void 0,
271
271
  threshold: [0, 0.25, 0.5, 0.75, 1]
272
272
  }
273
- ), I.observe(y.value);
273
+ ), F.observe(b.value);
274
274
  }
275
- }), zt(() => {
276
- u?.disconnect(), u = null, I?.disconnect(), I = null;
275
+ }), Vt(() => {
276
+ c?.disconnect(), c = null, F?.disconnect(), F = null;
277
277
  });
278
- function G() {
279
- p.value || (p.value = !0, b.value = !1, S.value = null, a("success", i.item));
278
+ function W() {
279
+ g.value || (g.value = !0, w.value = !1, S.value = null, a("success", i.item));
280
280
  }
281
281
  function K(s) {
282
- b.value || (p.value = !1, b.value = !0, S.value = s, a("error", { item: i.item, error: s }));
282
+ w.value || (g.value = !1, w.value = !0, S.value = s, a("error", { item: i.item, error: s }));
283
283
  }
284
284
  function ke() {
285
- G();
286
- const s = g.value;
285
+ if (u.value && !g.value && !w.value) {
286
+ if (te.value) {
287
+ const s = y.value;
288
+ if (!s || !s.complete) return;
289
+ s.naturalWidth > 0 && W();
290
+ return;
291
+ }
292
+ if (B.value) {
293
+ const s = h.value;
294
+ s && (s.readyState ?? 0) >= 1 && Me();
295
+ }
296
+ }
297
+ }
298
+ Z(
299
+ [u, () => i.item.preview, () => I.value],
300
+ () => {
301
+ u.value && Promise.resolve().then(ke);
302
+ },
303
+ { flush: "post" }
304
+ );
305
+ function Me() {
306
+ W();
307
+ const s = h.value;
287
308
  s && j(s), re();
288
309
  }
289
- function ge() {
290
- const s = g.value;
310
+ function se() {
311
+ const s = h.value;
291
312
  s && j(s);
292
313
  }
293
- return (s, x) => (_(), T("div", {
314
+ return (s, x) => (_(), P("div", {
294
315
  ref_key: "rootEl",
295
- ref: y,
316
+ ref: b,
296
317
  class: "relative bg-slate-100",
297
318
  style: U(q.value)
298
319
  }, [
299
- d.value && !p.value && !b.value ? (_(), T("div", wn, [
300
- i.loaderSlotFn ? (_(), Ft(le(f), {
320
+ u.value && !g.value && !w.value ? (_(), P("div", wn, [
321
+ i.loaderSlotFn ? (_(), Ft(ae(d), {
301
322
  key: 0,
302
323
  "slot-fn": i.loaderSlotFn,
303
324
  "slot-props": { item: i.item, remove: H }
304
- }, null, 8, ["slot-fn", "slot-props"])) : (_(), T("svg", bn, x[2] || (x[2] = [
305
- C("circle", {
325
+ }, null, 8, ["slot-fn", "slot-props"])) : (_(), P("svg", bn, x[2] || (x[2] = [
326
+ N("circle", {
306
327
  class: "opacity-25",
307
328
  cx: "12",
308
329
  cy: "12",
@@ -311,76 +332,76 @@ const pn = {
311
332
  stroke: "currentColor",
312
333
  "stroke-width": "4"
313
334
  }, null, -1),
314
- C("path", {
335
+ N("path", {
315
336
  class: "opacity-75",
316
337
  fill: "currentColor",
317
338
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
318
339
  }, null, -1)
319
340
  ])))
320
- ])) : d.value && b.value ? (_(), T("div", xn, [
321
- C("div", kn, [
322
- i.errorSlotFn ? (_(), Ft(le(f), {
341
+ ])) : u.value && w.value ? (_(), P("div", xn, [
342
+ N("div", kn, [
343
+ i.errorSlotFn ? (_(), Ft(ae(d), {
323
344
  key: 0,
324
345
  "slot-fn": i.errorSlotFn,
325
346
  "slot-props": { item: i.item, remove: H, error: S.value }
326
- }, null, 8, ["slot-fn", "slot-props"])) : (_(), T("p", Mn, "Error " + Ze(S.value), 1))
347
+ }, null, 8, ["slot-fn", "slot-props"])) : (_(), P("p", Mn, "Error " + et(S.value), 1))
327
348
  ])
328
- ])) : Z("", !0),
329
- d.value && ae.value && !b.value ? (_(), T("img", {
349
+ ])) : ee("", !0),
350
+ u.value && te.value && !w.value ? (_(), P("img", {
330
351
  key: i.item.id + ":img",
331
352
  ref_key: "imgEl",
332
- ref: w,
353
+ ref: y,
333
354
  class: _t([
334
355
  "h-full w-full object-cover transition-opacity duration-300",
335
- p.value ? "opacity-100" : "opacity-0"
356
+ g.value ? "opacity-100" : "opacity-0"
336
357
  ]),
337
358
  src: i.item.preview,
338
359
  width: i.item.width,
339
360
  height: i.item.height,
340
361
  loading: "lazy",
341
362
  alt: i.item.id,
342
- onLoad: G,
363
+ onLoad: W,
343
364
  onError: x[0] || (x[0] = (J) => K(J))
344
- }, null, 42, Sn)) : d.value && !b.value ? (_(), T("video", {
365
+ }, null, 42, Sn)) : u.value && !w.value ? (_(), P("video", {
345
366
  key: i.item.id + ":vid",
346
367
  class: _t([
347
368
  "h-full w-full object-cover transition-opacity duration-300",
348
- p.value ? "opacity-100" : "opacity-0"
369
+ g.value ? "opacity-100" : "opacity-0"
349
370
  ]),
350
- poster: P.value,
371
+ poster: T.value,
351
372
  ref_key: "videoEl",
352
- ref: g,
373
+ ref: h,
353
374
  playsinline: "",
354
375
  loop: "",
355
376
  preload: "metadata",
356
- onLoadedmetadata: ke,
357
- onTimeupdate: ge,
358
- onDurationchange: ge,
359
- onLoadeddata: ge,
377
+ onLoadedmetadata: Me,
378
+ onTimeupdate: se,
379
+ onDurationchange: se,
380
+ onLoadeddata: se,
360
381
  onError: x[1] || (x[1] = (J) => K(J))
361
382
  }, [
362
- C("source", {
363
- src: F.value,
383
+ N("source", {
384
+ src: I.value,
364
385
  type: "video/mp4"
365
386
  }, null, 8, Fn)
366
- ], 42, In)) : Z("", !0),
367
- d.value && N.value && !b.value ? (_(), T("div", _n, [
368
- Q(Lt, {
387
+ ], 42, In)) : ee("", !0),
388
+ u.value && B.value && !w.value ? (_(), P("div", _n, [
389
+ Q(zt, {
369
390
  duration: X.value,
370
391
  "current-time": $.value,
371
- onSeek: Ee
392
+ onSeek: Be
372
393
  }, null, 8, ["duration", "current-time"])
373
- ])) : Z("", !0)
394
+ ])) : ee("", !0)
374
395
  ], 4));
375
396
  }
376
397
  }), $t = Symbol("masonryItemRegistry");
377
- function Tn(o, M) {
398
+ function Pn(o, M) {
378
399
  return !o || o <= 0 || !M || M <= 0 ? 1 : Math.max(1, Math.floor(o / M));
379
400
  }
380
- function Pn(o, M, i, a = 0) {
401
+ function Tn(o, M, i, a = 0) {
381
402
  if (!o || o <= 0 || !M || M <= 0) return i;
382
- const f = typeof a == "number" && a > 0 ? a : 0, y = Math.max(0, M - 1) * f, w = o - y;
383
- return !w || w <= 0 ? i : w / M;
403
+ const d = typeof a == "number" && a > 0 ? a : 0, b = Math.max(0, M - 1) * d, y = o - b;
404
+ return !y || y <= 0 ? i : y / M;
384
405
  }
385
406
  function En(o, M) {
386
407
  const i = o?.width, a = o?.height;
@@ -389,7 +410,7 @@ function En(o, M) {
389
410
  function Dt(o) {
390
411
  return Number.isFinite(o) && o > 0 ? Math.floor(o) : 1;
391
412
  }
392
- function et(o) {
413
+ function tt(o) {
393
414
  return Number.isFinite(o) && o > 0 ? Math.floor(o) : 0;
394
415
  }
395
416
  function Bn() {
@@ -398,172 +419,172 @@ function Bn() {
398
419
  }
399
420
  function Rn(o) {
400
421
  async function M(a) {
401
- const f = et(a);
402
- if (f <= 0) return;
422
+ const d = tt(a);
423
+ if (d <= 0) return;
403
424
  o.stats.value = {
404
425
  ...o.stats.value,
405
- cooldownMsTotal: f,
406
- cooldownMsRemaining: f
426
+ cooldownMsTotal: d,
427
+ cooldownMsRemaining: d
407
428
  };
408
- const y = Date.now(), w = 100;
409
- await new Promise((g) => {
410
- const d = setInterval(() => {
411
- const p = Date.now() - y, b = Math.max(0, f - p);
429
+ const b = Date.now(), y = 100;
430
+ await new Promise((h) => {
431
+ const u = setInterval(() => {
432
+ const g = Date.now() - b, w = Math.max(0, d - g);
412
433
  o.stats.value = {
413
434
  ...o.stats.value,
414
- cooldownMsTotal: f,
415
- cooldownMsRemaining: b
416
- }, b <= 0 && (clearInterval(d), g());
417
- }, w);
435
+ cooldownMsTotal: d,
436
+ cooldownMsRemaining: w
437
+ }, w <= 0 && (clearInterval(u), h());
438
+ }, y);
418
439
  });
419
440
  }
420
441
  async function i(a) {
421
- const f = Dt(o.getPageSize()), y = o.isEnabled(), w = et(o.getRequestDelayMs()), g = o.stats.value.page ?? null, d = o.getCancelToken?.() ?? null, p = () => d !== null && o.getCancelToken && o.getCancelToken() !== d, b = () => {
422
- if (p()) throw Bn();
442
+ const d = Dt(o.getPageSize()), b = o.isEnabled(), y = tt(o.getRequestDelayMs()), h = o.stats.value.page ?? null, u = o.getCancelToken?.() ?? null, g = () => u !== null && o.getCancelToken && o.getCancelToken() !== u, w = () => {
443
+ if (g()) throw Bn();
423
444
  }, S = [];
424
- let N = 0;
425
- o.buffer.value.length && (N = o.buffer.value.length, S.push(...o.buffer.value), o.buffer.value = []), o.stats.value = {
445
+ let B = 0;
446
+ o.buffer.value.length && (B = o.buffer.value.length, S.push(...o.buffer.value), o.buffer.value = []), o.stats.value = {
426
447
  ...o.stats.value,
427
- enabled: y,
448
+ enabled: b,
428
449
  isBackfillActive: !1,
429
450
  isRequestInFlight: !1,
430
- page: g ?? a,
451
+ page: h ?? a,
431
452
  next: a,
432
- cooldownMsTotal: w,
453
+ cooldownMsTotal: y,
433
454
  cooldownMsRemaining: 0,
434
455
  progress: {
435
456
  collected: 0,
436
457
  target: 0
437
458
  },
438
- pageSize: f,
459
+ pageSize: d,
439
460
  bufferSize: 0
440
461
  };
441
- const P = [];
442
- let F = a, L = 0, R = !1;
443
- for (; S.length < f && F != null; ) {
444
- b();
445
- const H = F;
446
- R && (o.stats.value = {
462
+ const T = [];
463
+ let I = a, z = 0, A = !1;
464
+ for (; S.length < d && I != null; ) {
465
+ w();
466
+ const H = I;
467
+ A && (o.stats.value = {
447
468
  ...o.stats.value,
448
- enabled: y,
469
+ enabled: b,
449
470
  isBackfillActive: !0,
450
471
  isRequestInFlight: !0,
451
472
  page: H,
452
473
  next: null,
453
474
  progress: {
454
- collected: Math.min(S.length, f),
455
- target: f
475
+ collected: Math.min(S.length, d),
476
+ target: d
456
477
  },
457
- cooldownMsTotal: w,
478
+ cooldownMsTotal: y,
458
479
  cooldownMsRemaining: 0,
459
- pageSize: f
480
+ pageSize: d
460
481
  });
461
482
  const q = await o.getContent(H);
462
- b(), P.push(H), R && (o.stats.value = {
483
+ w(), T.push(H), A && (o.stats.value = {
463
484
  ...o.stats.value,
464
- enabled: y,
485
+ enabled: b,
465
486
  isBackfillActive: !0,
466
487
  isRequestInFlight: !1,
467
488
  page: H,
468
489
  next: q.nextPage
469
- }), L += q.items.length, o.markEnterFromLeft(q.items), S.push(...q.items), F = q.nextPage, !R && S.length < f && F != null ? (R = !0, o.stats.value = {
490
+ }), z += q.items.length, o.markEnterFromLeft(q.items), S.push(...q.items), I = q.nextPage, !A && S.length < d && I != null ? (A = !0, o.stats.value = {
470
491
  ...o.stats.value,
471
- enabled: y,
492
+ enabled: b,
472
493
  isBackfillActive: !0,
473
494
  isRequestInFlight: !1,
474
495
  page: H,
475
- next: F,
496
+ next: I,
476
497
  progress: {
477
- collected: Math.min(S.length, f),
478
- target: f
498
+ collected: Math.min(S.length, d),
499
+ target: d
479
500
  },
480
- cooldownMsTotal: w,
501
+ cooldownMsTotal: y,
481
502
  cooldownMsRemaining: 0,
482
- pageSize: f
483
- }) : R && (o.stats.value = {
503
+ pageSize: d
504
+ }) : A && (o.stats.value = {
484
505
  ...o.stats.value,
485
- enabled: y,
506
+ enabled: b,
486
507
  isBackfillActive: !0,
487
508
  page: H,
488
- next: F,
509
+ next: I,
489
510
  progress: {
490
- collected: Math.min(S.length, f),
491
- target: f
511
+ collected: Math.min(S.length, d),
512
+ target: d
492
513
  }
493
- }), R && S.length < f && F != null && (await M(w), b());
514
+ }), A && S.length < d && I != null && (await M(y), w());
494
515
  }
495
- const X = S.slice(0, f), $ = S.slice(f);
516
+ const X = S.slice(0, d), $ = S.slice(d);
496
517
  return o.buffer.value = $, o.stats.value = {
497
518
  ...o.stats.value,
498
- enabled: y,
519
+ enabled: b,
499
520
  isBackfillActive: !1,
500
521
  isRequestInFlight: !1,
501
- page: P.length ? P[P.length - 1] : g ?? a,
502
- next: F,
522
+ page: T.length ? T[T.length - 1] : h ?? a,
523
+ next: I,
503
524
  progress: {
504
525
  collected: 0,
505
526
  target: 0
506
527
  },
507
- cooldownMsTotal: w,
528
+ cooldownMsTotal: y,
508
529
  cooldownMsRemaining: 0,
509
- pageSize: f,
530
+ pageSize: d,
510
531
  bufferSize: $.length,
511
532
  lastBatch: {
512
533
  startPage: a,
513
- pages: P,
514
- usedFromBuffer: N,
515
- fetchedFromNetwork: L,
534
+ pages: T,
535
+ usedFromBuffer: B,
536
+ fetchedFromNetwork: z,
516
537
  collectedTotal: S.length,
517
538
  emitted: X.length,
518
539
  carried: $.length
519
540
  },
520
541
  totals: {
521
- pagesFetched: o.stats.value.totals.pagesFetched + P.length,
522
- itemsFetchedFromNetwork: o.stats.value.totals.itemsFetchedFromNetwork + L
542
+ pagesFetched: o.stats.value.totals.pagesFetched + T.length,
543
+ itemsFetchedFromNetwork: o.stats.value.totals.itemsFetchedFromNetwork + z
523
544
  }
524
- }, { batchItems: X, pages: P, nextPage: F };
545
+ }, { batchItems: X, pages: T, nextPage: I };
525
546
  }
526
547
  return { loadBackfillBatch: i };
527
548
  }
528
549
  function An(o) {
529
- const M = o.columnCount, i = o.columnWidth, a = o.gapX, f = o.gapY, y = o.headerHeight, w = o.footerHeight, g = o.bucketPx, d = Array.from({ length: M }, () => 0), p = new Array(o.items.length), b = new Array(o.items.length), S = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
530
- let P = 0;
531
- for (let F = 0; F < o.items.length; F += 1) {
532
- const L = o.items[F];
533
- L?.id && N.set(L.id, F);
534
- let R = 0;
535
- for (let u = 1; u < d.length; u += 1)
536
- d[u] < d[R] && (R = u);
537
- const X = R * (i + a), $ = d[R], H = En(L, i) + y + w;
538
- p[F] = { x: X, y: $ }, b[F] = H, d[R] = $ + H + f, P = Math.max(P, $ + H);
539
- const q = Math.floor($ / g), ae = Math.floor(($ + H) / g);
540
- for (let u = q; u <= ae; u += 1) {
541
- const I = S.get(u);
542
- I ? I.push(F) : S.set(u, [F]);
550
+ const M = o.columnCount, i = o.columnWidth, a = o.gapX, d = o.gapY, b = o.headerHeight, y = o.footerHeight, h = o.bucketPx, u = Array.from({ length: M }, () => 0), g = new Array(o.items.length), w = new Array(o.items.length), S = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
551
+ let T = 0;
552
+ for (let I = 0; I < o.items.length; I += 1) {
553
+ const z = o.items[I];
554
+ z?.id && B.set(z.id, I);
555
+ let A = 0;
556
+ for (let c = 1; c < u.length; c += 1)
557
+ u[c] < u[A] && (A = c);
558
+ const X = A * (i + a), $ = u[A], H = En(z, i) + b + y;
559
+ g[I] = { x: X, y: $ }, w[I] = H, u[A] = $ + H + d, T = Math.max(T, $ + H);
560
+ const q = Math.floor($ / h), te = Math.floor(($ + H) / h);
561
+ for (let c = q; c <= te; c += 1) {
562
+ const F = S.get(c);
563
+ F ? F.push(I) : S.set(c, [I]);
543
564
  }
544
565
  }
545
- return { positions: p, heights: b, buckets: S, contentHeight: P, indexById: N };
566
+ return { positions: g, heights: w, buckets: S, contentHeight: T, indexById: B };
546
567
  }
547
568
  function Cn(o) {
548
569
  const M = o.itemCount;
549
570
  if (!M) return [];
550
- if (o.viewportHeight <= 0) return Array.from({ length: M }, (d, p) => p);
551
- const i = Math.max(0, o.scrollTop - o.overscanPx), a = o.scrollTop + o.viewportHeight + o.overscanPx, f = Math.floor(i / o.bucketPx), y = Math.floor(a / o.bucketPx), w = /* @__PURE__ */ new Set();
552
- for (let d = f; d <= y; d += 1) {
553
- const p = o.buckets.get(d);
554
- if (p)
555
- for (const b of p) w.add(b);
571
+ if (o.viewportHeight <= 0) return Array.from({ length: M }, (u, g) => g);
572
+ const i = Math.max(0, o.scrollTop - o.overscanPx), a = o.scrollTop + o.viewportHeight + o.overscanPx, d = Math.floor(i / o.bucketPx), b = Math.floor(a / o.bucketPx), y = /* @__PURE__ */ new Set();
573
+ for (let u = d; u <= b; u += 1) {
574
+ const g = o.buckets.get(u);
575
+ if (g)
576
+ for (const w of g) y.add(w);
556
577
  }
557
- const g = Array.from(w);
558
- return g.sort((d, p) => d - p), g;
578
+ const h = Array.from(y);
579
+ return h.sort((u, g) => u - g), h;
559
580
  }
560
581
  const Nn = { class: "hidden" }, Hn = {
561
582
  key: 0,
562
583
  class: "flex h-full items-center justify-center"
563
- }, Vn = {
584
+ }, Ln = {
564
585
  key: 1,
565
586
  class: "text-sm font-medium text-red-700"
566
- }, zn = ["onMouseenter", "onMouseleave"], Ln = {
587
+ }, Vn = ["onMouseenter", "onMouseleave"], zn = {
567
588
  key: 0,
568
589
  class: "pointer-events-auto absolute inset-0 z-10"
569
590
  }, $n = { class: "relative" }, Dn = {
@@ -572,7 +593,7 @@ const Nn = { class: "hidden" }, Hn = {
572
593
  }, On = { class: "mt-4 pb-2 text-center text-xs text-slate-600" }, Yn = {
573
594
  key: 0,
574
595
  class: "inline-flex items-center justify-center gap-2"
575
- }, qn = { key: 1 }, Xn = { key: 2 }, At = 100, jn = 200, Ct = 600, Nt = 300, Ht = 600, Vt = 600, Un = 400, Wn = 5, Gn = 1e3, Kn = /* @__PURE__ */ xe({
596
+ }, qn = { key: 1 }, Xn = { key: 2 }, At = 100, jn = 200, Ct = 600, Nt = 300, Ht = 600, Lt = 600, Un = 400, Wn = 5, Gn = 1e3, Kn = /* @__PURE__ */ xe({
576
597
  inheritAttrs: !1,
577
598
  __name: "Masonry",
578
599
  props: /* @__PURE__ */ fn({
@@ -594,7 +615,7 @@ const Nn = { class: "hidden" }, Hn = {
594
615
  }, pn),
595
616
  emits: ["update:items", "preloaded", "failures", "removed"],
596
617
  setup(o, { expose: M, emit: i }) {
597
- const a = o, f = i, y = dn(), w = xe({
618
+ const a = o, d = i, b = dn(), y = xe({
598
619
  name: "SlotRenderer",
599
620
  props: {
600
621
  slotFn: {
@@ -612,90 +633,90 @@ const Nn = { class: "hidden" }, Hn = {
612
633
  return n ? n(e.slotProps) : null;
613
634
  };
614
635
  }
615
- }), g = Tt(null), d = v(null);
616
- function p(e) {
617
- d.value = e;
636
+ }), h = Pt(null), u = v(null);
637
+ function g(e) {
638
+ u.value = e;
618
639
  }
619
- function b(e) {
620
- d.value === e && (d.value = null);
640
+ function w(e) {
641
+ u.value === e && (u.value = null);
621
642
  }
622
643
  vn($t, (e) => {
623
- g.value || (g.value = e);
644
+ h.value || (h.value = e);
624
645
  });
625
- const S = [], N = [];
626
- let P = null, F = null;
627
- function L() {
646
+ const S = [], B = [];
647
+ let T = null, I = null;
648
+ function z() {
628
649
  if (!S.length) return;
629
650
  const e = S.splice(0, S.length);
630
- f("preloaded", e);
651
+ d("preloaded", e);
631
652
  }
632
- function R() {
633
- if (!N.length) return;
634
- const e = N.splice(0, N.length);
635
- f("failures", e);
653
+ function A() {
654
+ if (!B.length) return;
655
+ const e = B.splice(0, B.length);
656
+ d("failures", e);
636
657
  }
637
658
  function X() {
638
- P || (P = setTimeout(() => {
639
- P = null, L();
659
+ T || (T = setTimeout(() => {
660
+ T = null, z();
640
661
  }, At));
641
662
  }
642
663
  function $() {
643
- F || (F = setTimeout(() => {
644
- F = null, R();
664
+ I || (I = setTimeout(() => {
665
+ I = null, A();
645
666
  }, At));
646
667
  }
647
668
  function H(e) {
648
- g.value?.onPreloaded?.(e), S.push(e), X();
669
+ h.value?.onPreloaded?.(e), S.push(e), X();
649
670
  }
650
671
  function q(e) {
651
- g.value?.onFailed?.(e), N.push(e), $();
672
+ h.value?.onFailed?.(e), B.push(e), $();
652
673
  }
653
- Qe(() => {
654
- if (!g.value)
674
+ Ze(() => {
675
+ if (!h.value)
655
676
  throw new Error("[Masonry] Missing <MasonryItem> definition. Add <MasonryItem> as a child of <Masonry>.");
656
677
  });
657
- const ae = k(() => {
658
- const { class: e, ...n } = y;
678
+ const te = k(() => {
679
+ const { class: e, ...n } = b;
659
680
  return n;
660
- }), u = v(null), I = v(0), B = v(0), j = v(0);
681
+ }), c = v(null), F = v(0), R = v(0), j = v(0);
661
682
  let re;
662
- const ee = k(() => a.gapX), Pe = k(() => a.gapY);
663
- function Ee(e) {
683
+ const ne = k(() => a.gapX), Ee = k(() => a.gapY);
684
+ function Be(e) {
664
685
  if (!e) return 0;
665
- const n = Math.max(0, ee.value);
686
+ const n = Math.max(0, ne.value);
666
687
  return Math.max(0, e.clientWidth - n);
667
688
  }
668
- const G = k(() => a.headerHeight), K = k(() => a.footerHeight), ke = k(() => g.value?.header), ge = k(() => g.value?.loader), s = k(() => g.value?.footer), x = k(() => g.value?.overlay), J = k(() => g.value?.error), Be = k(() => !!ke.value), Me = k(() => !!s.value), tt = k(() => !!x.value), nt = k(() => {
669
- if (G.value > 0) return { height: `${G.value}px` };
689
+ const W = k(() => a.headerHeight), K = k(() => a.footerHeight), ke = k(() => h.value?.header), Me = k(() => h.value?.loader), se = k(() => h.value?.footer), s = k(() => h.value?.overlay), x = k(() => h.value?.error), J = k(() => !!ke.value), Re = k(() => !!se.value), Se = k(() => !!s.value), nt = k(() => {
690
+ if (W.value > 0) return { height: `${W.value}px` };
670
691
  }), ot = k(() => {
671
692
  if (K.value > 0) return { height: `${K.value}px` };
672
- }), Se = v([]), Oe = v([]), lt = v(/* @__PURE__ */ new Map()), at = v(0), Re = v(/* @__PURE__ */ new Map());
693
+ }), Ie = v([]), Ye = v([]), lt = v(/* @__PURE__ */ new Map()), at = v(0), Ae = v(/* @__PURE__ */ new Map());
673
694
  function Ot(e) {
674
695
  const n = typeof e == "number" && Number.isFinite(e) ? e : 0;
675
- return j.value + B.value + Math.max(0, n);
696
+ return j.value + R.value + Math.max(0, n);
676
697
  }
677
- const se = v(/* @__PURE__ */ new Set()), ie = v(/* @__PURE__ */ new Set()), Ae = /* @__PURE__ */ new Set(), Ie = v(/* @__PURE__ */ new Map());
698
+ const ie = v(/* @__PURE__ */ new Set()), ue = v(/* @__PURE__ */ new Set()), Ce = /* @__PURE__ */ new Set(), Fe = v(/* @__PURE__ */ new Map());
678
699
  function Yt(e) {
679
700
  return Number.isFinite(e) ? Math.max(0, Math.min(250, e)) : 0;
680
701
  }
681
702
  function qt(e) {
682
- if (!ie.value.has(e)) return;
683
- const n = Ie.value.get(e) ?? 0;
703
+ if (!ue.value.has(e)) return;
704
+ const n = Fe.value.get(e) ?? 0;
684
705
  if (!(n <= 0))
685
706
  return `${n}ms`;
686
707
  }
687
- const Ce = v(/* @__PURE__ */ new Map()), te = v(/* @__PURE__ */ new Set()), ne = v([]);
708
+ const Ne = v(/* @__PURE__ */ new Map()), oe = v(/* @__PURE__ */ new Set()), le = v([]);
688
709
  function Xt(e) {
689
- const n = Ce.value.get(e);
710
+ const n = Ne.value.get(e);
690
711
  return n || { dx: 0, dy: 0 };
691
712
  }
692
713
  function jt(e) {
693
- if (ie.value.has(e)) return `transform ${Ht}ms ease-out`;
694
- if (te.value.has(e)) return `transform ${Nt}ms ease-out`;
714
+ if (ue.value.has(e)) return `transform ${Ht}ms ease-out`;
715
+ if (oe.value.has(e)) return `transform ${Nt}ms ease-out`;
695
716
  }
696
717
  function Ut(e) {
697
- const t = m.value[e]?.id, l = Se.value[e] ?? { x: 0, y: 0 }, r = Oe.value[e] ?? 0, c = r > 0 ? r : Te.value, h = l.x, E = t && se.value.has(t) ? Ot(c) : l.y, O = t ? Xt(t) : { dx: 0, dy: 0 };
698
- return `translate3d(${h + O.dx}px,${E + O.dy}px,0)`;
718
+ const t = m.value[e]?.id, l = Ie.value[e] ?? { x: 0, y: 0 }, r = Ye.value[e] ?? 0, f = r > 0 ? r : Te.value, p = l.x, E = t && ie.value.has(t) ? Ot(f) : l.y, O = t ? Xt(t) : { dx: 0, dy: 0 };
719
+ return `translate3d(${p + O.dx}px,${E + O.dy}px,0)`;
699
720
  }
700
721
  function pe(e) {
701
722
  (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (t) => setTimeout(() => t(0), 0))(() => e());
@@ -707,32 +728,32 @@ const Nn = { class: "hidden" }, Hn = {
707
728
  function st(e) {
708
729
  return typeof e == "number" && Number.isFinite(e) && e > 0;
709
730
  }
710
- function Ne(e) {
731
+ function He(e) {
711
732
  if (!Array.isArray(e) || e.length === 0) return;
712
- const n = new Set(se.value);
733
+ const n = new Set(ie.value);
713
734
  let t = !1;
714
735
  for (const l of e) {
715
736
  const r = l?.id;
716
737
  if (r) {
717
738
  if (!rt.has(r)) {
718
- const c = l?.width, h = l?.height;
719
- (!st(c) || !st(h)) && (rt.add(r), console.warn(
720
- `[Masonry] Item "${r}" has invalid dimensions (width=${String(c)}, height=${String(
721
- h
739
+ const f = l?.width, p = l?.height;
740
+ (!st(f) || !st(p)) && (rt.add(r), console.warn(
741
+ `[Masonry] Item "${r}" has invalid dimensions (width=${String(f)}, height=${String(
742
+ p
722
743
  )}); layout expects { id, width, height }.`
723
744
  ));
724
745
  }
725
746
  n.has(r) || (n.add(r), t = !0);
726
747
  }
727
748
  }
728
- t && (se.value = n);
749
+ t && (ie.value = n);
729
750
  }
730
751
  function it() {
731
752
  const e = /* @__PURE__ */ new Map();
732
- for (const n of We.value) {
753
+ for (const n of Ge.value) {
733
754
  const l = m.value[n]?.id;
734
755
  if (!l) continue;
735
- const r = Se.value[n];
756
+ const r = Ie.value[n];
736
757
  r && e.set(l, { x: r.x, y: r.y });
737
758
  }
738
759
  return e;
@@ -740,31 +761,31 @@ const Nn = { class: "hidden" }, Hn = {
740
761
  function ut(e, n) {
741
762
  if (!e.size) return;
742
763
  const t = /* @__PURE__ */ new Map(), l = [];
743
- for (const [c, h] of e.entries()) {
744
- if (n?.has(c)) continue;
745
- const E = Re.value.get(c);
764
+ for (const [f, p] of e.entries()) {
765
+ if (n?.has(f)) continue;
766
+ const E = Ae.value.get(f);
746
767
  if (E == null) continue;
747
- const O = Se.value[E];
768
+ const O = Ie.value[E];
748
769
  if (!O) continue;
749
- const Y = h.x - O.x, z = h.y - O.y;
750
- (Y || z) && (t.set(c, { dx: Y, dy: z }), l.push(c));
770
+ const Y = p.x - O.x, V = p.y - O.y;
771
+ (Y || V) && (t.set(f, { dx: Y, dy: V }), l.push(f));
751
772
  }
752
773
  if (!t.size) return;
753
- Ce.value = t;
754
- const r = new Set(te.value);
755
- for (const c of l) r.delete(c);
756
- te.value = r, pe(() => {
757
- te.value = /* @__PURE__ */ new Set([...te.value, ...l]), pe(() => {
758
- Ce.value = /* @__PURE__ */ new Map();
774
+ Ne.value = t;
775
+ const r = new Set(oe.value);
776
+ for (const f of l) r.delete(f);
777
+ oe.value = r, pe(() => {
778
+ oe.value = /* @__PURE__ */ new Set([...oe.value, ...l]), pe(() => {
779
+ Ne.value = /* @__PURE__ */ new Map();
759
780
  });
760
781
  }), setTimeout(() => {
761
- const c = new Set(te.value);
762
- for (const h of l) c.delete(h);
763
- te.value = c;
782
+ const f = new Set(oe.value);
783
+ for (const p of l) f.delete(p);
784
+ oe.value = f;
764
785
  }, Nt);
765
786
  }
766
- const ue = v(!0), ce = v(!1), ye = v("");
767
- let D = 0, Ye = 0, He = 0, Ve = 0, Fe = !1;
787
+ const ce = v(!0), fe = v(!1), ye = v("");
788
+ let D = 0, qe = 0, Le = 0, Ve = 0, _e = !1;
768
789
  function ct(e) {
769
790
  return e instanceof Error && e.name === "AbortError";
770
791
  }
@@ -788,101 +809,101 @@ const Nn = { class: "hidden" }, Hn = {
788
809
  }
789
810
  }
790
811
  }
791
- const W = v([]), vt = v([]), qe = v([]), V = v(a.page), ze = v([]);
792
- let fe = null, de = null, Le = 0;
812
+ const G = v([]), vt = v([]), Xe = v([]), L = v(a.page), ze = v([]);
813
+ let de = null, ve = null, $e = 0;
793
814
  function Kt(e) {
794
815
  let n = -1;
795
816
  for (const t of e) {
796
817
  const l = t?.originalIndex;
797
- _e(l) && l > n && (n = l);
818
+ Pe(l) && l > n && (n = l);
798
819
  }
799
- Le = n + 1;
820
+ $e = n + 1;
800
821
  }
801
822
  function we(e) {
802
823
  for (const n of e)
803
- !n || typeof n != "object" || n.id && n.originalIndex == null && (n.originalIndex = Le, Le += 1);
824
+ !n || typeof n != "object" || n.id && n.originalIndex == null && (n.originalIndex = $e, $e += 1);
804
825
  }
805
- const ve = /* @__PURE__ */ new Map(), me = [];
806
- function _e(e) {
826
+ const me = /* @__PURE__ */ new Map(), he = [];
827
+ function Pe(e) {
807
828
  return typeof e == "number" && Number.isFinite(e);
808
829
  }
809
830
  function Jt(e, n) {
810
831
  if (!n.length) return e;
811
832
  const t = /* @__PURE__ */ new Set();
812
- for (const h of e) {
813
- const E = h?.id;
833
+ for (const p of e) {
834
+ const E = p?.id;
814
835
  E && t.add(E);
815
836
  }
816
837
  const l = [];
817
- for (const h of n) {
818
- const E = h?.id;
819
- E && (t.has(E) || (l.push(h), t.add(E)));
838
+ for (const p of n) {
839
+ const E = p?.id;
840
+ E && (t.has(E) || (l.push(p), t.add(E)));
820
841
  }
821
842
  if (!l.length) return e;
822
- const r = l.slice().sort((h, E) => {
823
- const O = _e(h.originalIndex) ? h.originalIndex : Number.POSITIVE_INFINITY, Y = _e(E.originalIndex) ? E.originalIndex : Number.POSITIVE_INFINITY;
843
+ const r = l.slice().sort((p, E) => {
844
+ const O = Pe(p.originalIndex) ? p.originalIndex : Number.POSITIVE_INFINITY, Y = Pe(E.originalIndex) ? E.originalIndex : Number.POSITIVE_INFINITY;
824
845
  return O - Y;
825
- }), c = e.slice();
826
- for (const h of r) {
827
- const E = h.originalIndex;
828
- if (!_e(E)) {
829
- c.push(h);
846
+ }), f = e.slice();
847
+ for (const p of r) {
848
+ const E = p.originalIndex;
849
+ if (!Pe(E)) {
850
+ f.push(p);
830
851
  continue;
831
852
  }
832
- let O = 0, Y = c.length;
853
+ let O = 0, Y = f.length;
833
854
  for (; O < Y; ) {
834
- const z = O + Y >> 1, A = c[z]?.originalIndex;
835
- (_e(A) ? A : Number.POSITIVE_INFINITY) <= E ? O = z + 1 : Y = z;
855
+ const V = O + Y >> 1, C = f[V]?.originalIndex;
856
+ (Pe(C) ? C : Number.POSITIVE_INFINITY) <= E ? O = V + 1 : Y = V;
836
857
  }
837
- c.splice(O, 0, h);
858
+ f.splice(O, 0, p);
838
859
  }
839
- return c;
860
+ return f;
840
861
  }
841
862
  async function mt(e) {
842
863
  if (!e.length) return;
843
- Fe = !0, Ne(e);
864
+ _e = !0, He(e);
844
865
  const n = it();
845
866
  m.value = Jt(m.value, e), await Bt(), ut(n);
846
867
  }
847
868
  async function Qt(e) {
848
- const t = (Array.isArray(e) ? e : [e]).map(Ue).filter(Boolean);
869
+ const t = (Array.isArray(e) ? e : [e]).map(We).filter(Boolean);
849
870
  if (!t.length) return;
850
871
  const l = [];
851
872
  for (const r of t) {
852
- const c = ve.get(r);
853
- c && l.push(c);
873
+ const f = me.get(r);
874
+ f && l.push(f);
854
875
  }
855
876
  if (l.length) {
856
877
  await mt(l);
857
878
  for (const r of l)
858
- r?.id && ve.delete(r.id);
879
+ r?.id && me.delete(r.id);
859
880
  }
860
881
  }
861
882
  async function Zt() {
862
- const e = me.pop();
883
+ const e = he.pop();
863
884
  if (!e?.length) return;
864
885
  const n = [];
865
886
  for (const t of e) {
866
- const l = ve.get(t);
887
+ const l = me.get(t);
867
888
  l && n.push(l);
868
889
  }
869
890
  if (n.length) {
870
891
  await mt(n);
871
892
  for (const t of n)
872
- t?.id && ve.delete(t.id);
893
+ t?.id && me.delete(t.id);
873
894
  }
874
895
  }
875
896
  function en(e) {
876
- const t = (Array.isArray(e) ? e : [e]).map(Ue).filter(Boolean);
897
+ const t = (Array.isArray(e) ? e : [e]).map(We).filter(Boolean);
877
898
  if (!t.length) return;
878
899
  const l = new Set(t);
879
- for (const r of l) ve.delete(r);
880
- for (let r = me.length - 1; r >= 0; r -= 1) {
881
- const h = me[r].filter((E) => !l.has(E));
882
- h.length ? me[r] = h : me.splice(r, 1);
900
+ for (const r of l) me.delete(r);
901
+ for (let r = he.length - 1; r >= 0; r -= 1) {
902
+ const p = he[r].filter((E) => !l.has(E));
903
+ p.length ? he[r] = p : he.splice(r, 1);
883
904
  }
884
905
  }
885
- const Xe = Tt({
906
+ const je = Pt({
886
907
  enabled: !1,
887
908
  isBackfillActive: !1,
888
909
  isRequestInFlight: !1,
@@ -903,85 +924,85 @@ const Nn = { class: "hidden" }, Hn = {
903
924
  }
904
925
  }), ht = Rn({
905
926
  getContent: (e) => dt(e, D),
906
- markEnterFromLeft: Ne,
927
+ markEnterFromLeft: He,
907
928
  buffer: ze,
908
- stats: Xe,
929
+ stats: je,
909
930
  isEnabled: () => a.mode === "backfill",
910
931
  getPageSize: () => a.pageSize,
911
932
  getRequestDelayMs: () => a.backfillRequestDelayMs,
912
- getCancelToken: () => Ye
913
- }), $e = k(() => a.items !== void 0);
914
- oe(
933
+ getCancelToken: () => qe
934
+ }), De = k(() => a.items !== void 0);
935
+ Z(
915
936
  () => a.items,
916
937
  (e) => {
917
- $e.value && (qe.value = Array.isArray(e) ? e : []);
938
+ De.value && (Xe.value = Array.isArray(e) ? e : []);
918
939
  },
919
940
  { immediate: !0 }
920
941
  );
921
942
  const m = k({
922
943
  get() {
923
- return $e.value ? qe.value : vt.value;
944
+ return De.value ? Xe.value : vt.value;
924
945
  },
925
946
  set(e) {
926
- $e.value ? (qe.value = e, f("update:items", e)) : vt.value = e;
947
+ De.value ? (Xe.value = e, d("update:items", e)) : vt.value = e;
927
948
  }
928
- }), be = v(!1), je = v(!1);
949
+ }), be = v(!1), Ue = v(!1);
929
950
  async function gt(e) {
930
951
  const n = await dt(e, D);
931
- return we(n.items), Ne(n.items), { items: n.items, nextPage: n.nextPage };
952
+ return we(n.items), He(n.items), { items: n.items, nextPage: n.nextPage };
932
953
  }
933
- function Ue(e) {
954
+ function We(e) {
934
955
  return e ? typeof e == "string" ? e : e?.id : null;
935
956
  }
936
957
  async function pt(e) {
937
- const t = (Array.isArray(e) ? e : [e]).map(Ue).filter(Boolean);
958
+ const t = (Array.isArray(e) ? e : [e]).map(We).filter(Boolean);
938
959
  if (!t.length) return;
939
- const l = new Set(t), r = [], c = [];
940
- for (const z of l) {
941
- const A = Re.value.get(z);
942
- if (A == null) continue;
943
- const he = m.value[A];
944
- he && (ve.set(z, he), c.push(z), r.push(he));
960
+ const l = new Set(t), r = [], f = [];
961
+ for (const V of l) {
962
+ const C = Ae.value.get(V);
963
+ if (C == null) continue;
964
+ const ge = m.value[C];
965
+ ge && (me.set(V, ge), f.push(V), r.push(ge));
945
966
  }
946
- c.length && (me.push(c), Fe = !0);
947
- const h = it(), E = Te.value, O = j.value + B.value, Y = [];
948
- for (const z of l) {
949
- const A = Re.value.get(z);
950
- if (A == null) continue;
951
- const he = m.value[A];
952
- if (!he) continue;
953
- const Je = Se.value[A] ?? { x: 0, y: 0 }, It = Oe.value[A] ?? E, cn = Math.max(Je.y, O);
967
+ f.length && (he.push(f), _e = !0);
968
+ const p = it(), E = Te.value, O = j.value + R.value, Y = [];
969
+ for (const V of l) {
970
+ const C = Ae.value.get(V);
971
+ if (C == null) continue;
972
+ const ge = m.value[C];
973
+ if (!ge) continue;
974
+ const Qe = Ie.value[C] ?? { x: 0, y: 0 }, It = Ye.value[C] ?? E, cn = Math.max(Qe.y, O);
954
975
  Y.push({
955
- id: z,
956
- item: he,
957
- fromX: Je.x,
958
- fromY: Je.y,
976
+ id: V,
977
+ item: ge,
978
+ fromX: Qe.x,
979
+ fromY: Qe.y,
959
980
  toY: cn + Math.max(0, It),
960
981
  width: E,
961
982
  height: It,
962
983
  leaving: !0
963
984
  });
964
985
  }
965
- if (Y.length && (ne.value = [...ne.value, ...Y]), m.value = m.value.filter((z) => {
966
- const A = z?.id;
967
- return !A || !l.has(A);
968
- }), await Bt(), ut(h, l), Y.length) {
969
- const z = new Set(Y.map((A) => A.id));
986
+ if (Y.length && (le.value = [...le.value, ...Y]), m.value = m.value.filter((V) => {
987
+ const C = V?.id;
988
+ return !C || !l.has(C);
989
+ }), await Bt(), ut(p, l), Y.length) {
990
+ const V = new Set(Y.map((C) => C.id));
970
991
  pe(() => {
971
- ne.value = ne.value.map(
972
- (A) => z.has(A.id) ? { ...A, leaving: !1 } : A
992
+ le.value = le.value.map(
993
+ (C) => V.has(C.id) ? { ...C, leaving: !1 } : C
973
994
  ), setTimeout(() => {
974
- ne.value = ne.value.filter((A) => !z.has(A.id));
975
- }, Vt);
995
+ le.value = le.value.filter((C) => !V.has(C.id));
996
+ }, Lt);
976
997
  });
977
998
  }
978
- r.length && f("removed", { items: r, ids: c });
999
+ r.length && d("removed", { items: r, ids: f });
979
1000
  }
980
- async function De(e) {
1001
+ async function Oe(e) {
981
1002
  return pt(e);
982
1003
  }
983
1004
  function tn() {
984
- D += 1, Ye += 1, fe = null, de = null, ue.value = !1, ce.value = !1;
1005
+ D += 1, qe += 1, de = null, ve = null, ce.value = !1, fe.value = !1;
985
1006
  }
986
1007
  M({
987
1008
  remove: pt,
@@ -991,137 +1012,137 @@ const Nn = { class: "hidden" }, Hn = {
991
1012
  loadNextPage: wt,
992
1013
  cancel: tn,
993
1014
  get pagesLoaded() {
994
- return W.value;
1015
+ return G.value;
995
1016
  },
996
1017
  set pagesLoaded(e) {
997
- W.value = e;
1018
+ G.value = e;
998
1019
  },
999
1020
  get nextPage() {
1000
- return V.value;
1021
+ return L.value;
1001
1022
  },
1002
1023
  set nextPage(e) {
1003
- V.value = e;
1024
+ L.value = e;
1004
1025
  },
1005
1026
  get isLoading() {
1006
- return ue.value || ce.value;
1027
+ return ce.value || fe.value;
1007
1028
  },
1008
1029
  get hasReachedEnd() {
1009
- return a.mode !== "backfill" ? V.value == null : V.value == null && ze.value.length === 0;
1030
+ return a.mode !== "backfill" ? L.value == null : L.value == null && ze.value.length === 0;
1010
1031
  },
1011
1032
  get backfillStats() {
1012
- return Xe.value;
1033
+ return je.value;
1013
1034
  }
1014
1035
  });
1015
1036
  function yt() {
1016
1037
  const e = An({
1017
1038
  items: m.value,
1018
- columnCount: Ke.value,
1039
+ columnCount: Je.value,
1019
1040
  columnWidth: Te.value,
1020
- gapX: ee.value,
1021
- gapY: Pe.value,
1022
- headerHeight: G.value,
1041
+ gapX: ne.value,
1042
+ gapY: Ee.value,
1043
+ headerHeight: W.value,
1023
1044
  footerHeight: K.value,
1024
1045
  bucketPx: Ct
1025
1046
  });
1026
- Se.value = e.positions, Oe.value = e.heights, lt.value = e.buckets, at.value = e.contentHeight, Re.value = e.indexById;
1047
+ Ie.value = e.positions, Ye.value = e.heights, lt.value = e.buckets, at.value = e.contentHeight, Ae.value = e.indexById;
1027
1048
  }
1028
- const nn = k(() => Math.max(at.value, B.value) + jn), We = k(() => Cn({
1049
+ const nn = k(() => Math.max(at.value, R.value) + jn), Ge = k(() => Cn({
1029
1050
  itemCount: m.value.length,
1030
- viewportHeight: B.value,
1051
+ viewportHeight: R.value,
1031
1052
  scrollTop: j.value,
1032
1053
  overscanPx: a.overscanPx,
1033
1054
  bucketPx: Ct,
1034
1055
  buckets: lt.value
1035
1056
  }));
1036
- oe(
1037
- We,
1057
+ Z(
1058
+ Ge,
1038
1059
  (e) => {
1039
1060
  if (!e?.length) return;
1040
- if (be.value && !je.value) {
1061
+ if (be.value && !Ue.value) {
1041
1062
  const l = [];
1042
1063
  for (const r of e) {
1043
- const c = m.value[r];
1044
- c && l.push(c);
1064
+ const f = m.value[r];
1065
+ f && l.push(f);
1045
1066
  }
1046
- l.length && Ne(l), je.value = !0;
1067
+ l.length && He(l), Ue.value = !0;
1047
1068
  }
1048
1069
  const n = [];
1049
1070
  for (const l of e) {
1050
1071
  const r = m.value[l]?.id;
1051
- r && se.value.has(r) && (Ae.has(r) || (Ae.add(r), n.push(r)));
1072
+ r && ie.value.has(r) && (Ce.has(r) || (Ce.add(r), n.push(r)));
1052
1073
  }
1053
1074
  if (!n.length) return;
1054
1075
  const t = n.length > 1 ? Yt(a.enterStaggerMs) : 0;
1055
1076
  if (t > 0) {
1056
- const l = new Map(Ie.value);
1077
+ const l = new Map(Fe.value);
1057
1078
  for (let r = 0; r < n.length; r += 1) {
1058
- const c = n[r], h = Math.min(r * t, Un);
1059
- l.set(c, h);
1079
+ const f = n[r], p = Math.min(r * t, Un);
1080
+ l.set(f, p);
1060
1081
  }
1061
- Ie.value = l;
1082
+ Fe.value = l;
1062
1083
  }
1063
1084
  pe(() => {
1064
- const l = new Set(ie.value);
1085
+ const l = new Set(ue.value);
1065
1086
  for (const r of n) l.add(r);
1066
- ie.value = l;
1087
+ ue.value = l;
1067
1088
  }), Wt(() => {
1068
- const l = new Set(se.value);
1089
+ const l = new Set(ie.value);
1069
1090
  for (const r of n) l.delete(r);
1070
- se.value = l, setTimeout(() => {
1071
- const r = new Set(ie.value), c = new Map(Ie.value);
1072
- for (const h of n)
1073
- r.delete(h), Ae.delete(h), c.delete(h);
1074
- ie.value = r, Ie.value = c;
1091
+ ie.value = l, setTimeout(() => {
1092
+ const r = new Set(ue.value), f = new Map(Fe.value);
1093
+ for (const p of n)
1094
+ r.delete(p), Ce.delete(p), f.delete(p);
1095
+ ue.value = r, Fe.value = f;
1075
1096
  }, Ht);
1076
1097
  });
1077
1098
  },
1078
1099
  { flush: "post" }
1079
1100
  );
1080
1101
  async function wt() {
1081
- if (fe) return fe;
1082
- if (ue.value || ce.value || a.mode !== "backfill" && V.value == null || a.mode === "backfill" && V.value == null && ze.value.length === 0)
1102
+ if (de) return de;
1103
+ if (ce.value || fe.value || a.mode !== "backfill" && L.value == null || a.mode === "backfill" && L.value == null && ze.value.length === 0)
1083
1104
  return;
1084
1105
  const e = D;
1085
1106
  let n = null;
1086
1107
  return n = (async () => {
1087
1108
  try {
1088
- if (ce.value = !0, ye.value = "", a.mode === "backfill") {
1089
- const r = await ht.loadBackfillBatch(V.value);
1109
+ if (fe.value = !0, ye.value = "", a.mode === "backfill") {
1110
+ const r = await ht.loadBackfillBatch(L.value);
1090
1111
  if (e !== D) return;
1091
- r.pages.length && (W.value = [...W.value, ...r.pages]), we(r.batchItems), m.value = [...m.value, ...r.batchItems], V.value = r.nextPage;
1112
+ r.pages.length && (G.value = [...G.value, ...r.pages]), we(r.batchItems), m.value = [...m.value, ...r.batchItems], L.value = r.nextPage;
1092
1113
  return;
1093
1114
  }
1094
- const t = V.value;
1115
+ const t = L.value;
1095
1116
  if (t == null) return;
1096
1117
  const l = await gt(t);
1097
1118
  if (e !== D) return;
1098
- W.value = [...W.value, t], we(l.items), m.value = [...m.value, ...l.items], V.value = l.nextPage;
1119
+ G.value = [...G.value, t], we(l.items), m.value = [...m.value, ...l.items], L.value = l.nextPage;
1099
1120
  } catch (t) {
1100
1121
  if (e !== D || ct(t)) return;
1101
1122
  ye.value = t instanceof Error ? t.message : String(t);
1102
1123
  } finally {
1103
- e === D && (ce.value = !1), fe === n && (fe = null);
1124
+ e === D && (fe.value = !1), de === n && (de = null);
1104
1125
  }
1105
- })(), fe = n, n;
1126
+ })(), de = n, n;
1106
1127
  }
1107
1128
  function on() {
1108
- const e = u.value;
1129
+ const e = c.value;
1109
1130
  if (!e) return;
1110
1131
  const n = e.scrollTop, t = e.clientHeight, l = e.scrollHeight;
1111
- j.value = n, B.value = t;
1112
- const r = He, c = Ve, h = n > r, E = c > 0 && l < c;
1113
- if (He = n, Ve = l, Fe) {
1114
- if (!h) return;
1115
- Fe = !1;
1132
+ j.value = n, R.value = t;
1133
+ const r = Le, f = Ve, p = n > r, E = f > 0 && l < f;
1134
+ if (Le = n, Ve = l, _e) {
1135
+ if (!p) return;
1136
+ _e = !1;
1116
1137
  }
1117
- if (E && !h) return;
1138
+ if (E && !p) return;
1118
1139
  l - (n + t) <= a.prefetchThresholdPx && wt();
1119
1140
  }
1120
1141
  function bt() {
1121
- return u.value;
1142
+ return c.value;
1122
1143
  }
1123
1144
  function xt(e) {
1124
- I.value = Ee(e), B.value = e.clientHeight;
1145
+ F.value = Be(e), R.value = e.clientHeight;
1125
1146
  }
1126
1147
  function ln() {
1127
1148
  typeof ResizeObserver > "u" || (re = new ResizeObserver(() => {
@@ -1141,7 +1162,7 @@ const Nn = { class: "hidden" }, Hn = {
1141
1162
  target: 0
1142
1163
  },
1143
1164
  cooldownMsRemaining: 0,
1144
- cooldownMsTotal: et(a.backfillRequestDelayMs),
1165
+ cooldownMsTotal: tt(a.backfillRequestDelayMs),
1145
1166
  pageSize: Dt(a.pageSize),
1146
1167
  bufferSize: 0,
1147
1168
  lastBatch: null,
@@ -1152,25 +1173,25 @@ const Nn = { class: "hidden" }, Hn = {
1152
1173
  };
1153
1174
  }
1154
1175
  function kt() {
1155
- D += 1, Ye += 1, fe = null, de = null, He = 0, Ve = 0, Fe = !1, Le = 0, ve.clear(), me.length = 0, se.value = /* @__PURE__ */ new Set(), ie.value = /* @__PURE__ */ new Set(), Ae.clear(), Ce.value = /* @__PURE__ */ new Map(), te.value = /* @__PURE__ */ new Set(), ne.value = [], W.value = [], V.value = null, ze.value = [], Xe.value = an(), ue.value = !0, ce.value = !1, ye.value = "", je.value = !1;
1176
+ D += 1, qe += 1, de = null, ve = null, Le = 0, Ve = 0, _e = !1, $e = 0, me.clear(), he.length = 0, ie.value = /* @__PURE__ */ new Set(), ue.value = /* @__PURE__ */ new Set(), Ce.clear(), Ne.value = /* @__PURE__ */ new Map(), oe.value = /* @__PURE__ */ new Set(), le.value = [], G.value = [], L.value = null, ze.value = [], je.value = an(), ce.value = !0, fe.value = !1, ye.value = "", Ue.value = !1;
1156
1177
  }
1157
1178
  function Mt(e) {
1158
- kt(), m.value = [], V.value = e;
1179
+ kt(), m.value = [], L.value = e;
1159
1180
  }
1160
1181
  function rn(e) {
1161
1182
  const n = Array.isArray(e) ? e : [e], t = [], l = /* @__PURE__ */ new Set();
1162
1183
  for (const r of n) {
1163
1184
  if (r == null) continue;
1164
- const c = typeof r == "string" ? `s:${r}` : `n:${String(r)}`;
1165
- l.has(c) || (l.add(c), t.push(r));
1185
+ const f = typeof r == "string" ? `s:${r}` : `n:${String(r)}`;
1186
+ l.has(f) || (l.add(f), t.push(r));
1166
1187
  }
1167
1188
  return t;
1168
1189
  }
1169
- function Ge(e) {
1170
- kt(), W.value = e ? rn(e) : [], V.value = a.page, ue.value = !1, Kt(m.value), we(m.value);
1190
+ function Ke(e) {
1191
+ kt(), G.value = e ? rn(e) : [], L.value = a.page, ce.value = !1, Kt(m.value), we(m.value);
1171
1192
  }
1172
1193
  async function St(e) {
1173
- if (de) return de;
1194
+ if (ve) return ve;
1174
1195
  const n = D;
1175
1196
  let t = null;
1176
1197
  return t = (async () => {
@@ -1178,68 +1199,68 @@ const Nn = { class: "hidden" }, Hn = {
1178
1199
  if (a.mode === "backfill") {
1179
1200
  const l = await ht.loadBackfillBatch(e);
1180
1201
  if (n !== D) return;
1181
- W.value = l.pages.length ? l.pages : [e], we(l.batchItems), m.value = l.batchItems, V.value = l.nextPage;
1202
+ G.value = l.pages.length ? l.pages : [e], we(l.batchItems), m.value = l.batchItems, L.value = l.nextPage;
1182
1203
  } else {
1183
1204
  const l = await gt(e);
1184
1205
  if (n !== D) return;
1185
- W.value = [e], we(l.items), m.value = l.items, V.value = l.nextPage;
1206
+ G.value = [e], we(l.items), m.value = l.items, L.value = l.nextPage;
1186
1207
  }
1187
1208
  } catch (l) {
1188
1209
  if (n !== D || ct(l)) return;
1189
1210
  ye.value = l instanceof Error ? l.message : String(l);
1190
1211
  } finally {
1191
- n === D && (ue.value = !1), de === t && (de = null);
1212
+ n === D && (ce.value = !1), ve === t && (ve = null);
1192
1213
  }
1193
- })(), de = t, t;
1214
+ })(), ve = t, t;
1194
1215
  }
1195
1216
  function sn() {
1196
1217
  const e = bt();
1197
- e && (xt(e), j.value = e.scrollTop, He = e.scrollTop, Ve = e.scrollHeight, re?.observe(e));
1218
+ e && (xt(e), j.value = e.scrollTop, Le = e.scrollTop, Ve = e.scrollHeight, re?.observe(e));
1198
1219
  }
1199
- Qe(async () => {
1220
+ Ze(async () => {
1200
1221
  if (ln(), sn(), a.restoredPages != null) {
1201
- be.value = !0, Ge(a.restoredPages);
1222
+ be.value = !0, Ke(a.restoredPages);
1202
1223
  return;
1203
1224
  }
1204
- if ($e.value && m.value.length > 0) {
1205
- be.value = !0, Ge();
1225
+ if (De.value && m.value.length > 0) {
1226
+ be.value = !0, Ke();
1206
1227
  return;
1207
1228
  }
1208
1229
  be.value = !1, Mt(a.page), await St(a.page);
1209
- }), zt(() => {
1210
- re?.disconnect(), P && (clearTimeout(P), P = null), F && (clearTimeout(F), F = null), L(), R();
1211
- }), oe(
1230
+ }), Vt(() => {
1231
+ re?.disconnect(), T && (clearTimeout(T), T = null), I && (clearTimeout(I), I = null), z(), A();
1232
+ }), Z(
1212
1233
  () => a.page,
1213
1234
  async (e) => {
1214
1235
  if (be.value) {
1215
- V.value = e;
1236
+ L.value = e;
1216
1237
  return;
1217
1238
  }
1218
1239
  Mt(e), await St(e);
1219
1240
  }
1220
- ), oe(
1241
+ ), Z(
1221
1242
  () => a.restoredPages,
1222
1243
  (e) => {
1223
- e && (be.value = !0, Ge(e));
1244
+ e && (be.value = !0, Ke(e));
1224
1245
  }
1225
- ), oe(
1226
- ee,
1246
+ ), Z(
1247
+ ne,
1227
1248
  () => {
1228
- const e = u.value;
1229
- e && (I.value = Ee(e));
1249
+ const e = c.value;
1250
+ e && (F.value = Be(e));
1230
1251
  },
1231
1252
  { immediate: !1 }
1232
1253
  );
1233
- const Ke = k(() => Tn(I.value, a.itemWidth)), Te = k(
1234
- () => Pn(I.value, Ke.value, a.itemWidth, ee.value)
1254
+ const Je = k(() => Pn(F.value, a.itemWidth)), Te = k(
1255
+ () => Tn(F.value, Je.value, a.itemWidth, ne.value)
1235
1256
  );
1236
- oe(
1237
- [Ke, Te, ee, Pe, G, K],
1257
+ Z(
1258
+ [Je, Te, ne, Ee, W, K],
1238
1259
  () => {
1239
1260
  yt();
1240
1261
  },
1241
1262
  { immediate: !0 }
1242
- ), oe(
1263
+ ), Z(
1243
1264
  // Performance note: this component targets very large arrays (e.g. 10k items).
1244
1265
  // Avoid deep watchers over items; rebuild layout only when the list structure
1245
1266
  // changes (new array reference or length change). This keeps metadata-only
@@ -1250,28 +1271,28 @@ const Nn = { class: "hidden" }, Hn = {
1250
1271
  );
1251
1272
  const un = k(() => [
1252
1273
  "mt-8 flex min-h-0 flex-1 flex-col rounded-2xl border border-slate-200/70 bg-white/70 p-5 shadow-sm backdrop-blur",
1253
- y.class
1274
+ b.class
1254
1275
  ]);
1255
- return (e, n) => (_(), T("section", mn(ae.value, { class: un.value }), [
1256
- C("div", Nn, [
1276
+ return (e, n) => (_(), P("section", mn(te.value, { class: un.value }), [
1277
+ N("div", Nn, [
1257
1278
  hn(e.$slots, "default")
1258
1279
  ]),
1259
- C("div", {
1280
+ N("div", {
1260
1281
  ref_key: "scrollViewportRef",
1261
- ref: u,
1282
+ ref: c,
1262
1283
  "data-testid": "items-scroll-container",
1263
1284
  class: "mt-4 min-h-0 flex-1 overflow-auto",
1264
- style: U({ paddingRight: ee.value + "px" }),
1285
+ style: U({ paddingRight: ne.value + "px" }),
1265
1286
  onScroll: on
1266
1287
  }, [
1267
- ue.value ? (_(), T("div", Hn, n[0] || (n[0] = [
1268
- C("div", { class: "inline-flex items-center gap-3 text-sm text-slate-600" }, [
1269
- C("svg", {
1288
+ ce.value ? (_(), P("div", Hn, n[0] || (n[0] = [
1289
+ N("div", { class: "inline-flex items-center gap-3 text-sm text-slate-600" }, [
1290
+ N("svg", {
1270
1291
  class: "h-5 w-5 animate-spin text-slate-500",
1271
1292
  viewBox: "0 0 24 24",
1272
1293
  "aria-hidden": "true"
1273
1294
  }, [
1274
- C("circle", {
1295
+ N("circle", {
1275
1296
  class: "opacity-25",
1276
1297
  cx: "12",
1277
1298
  cy: "12",
@@ -1280,20 +1301,20 @@ const Nn = { class: "hidden" }, Hn = {
1280
1301
  stroke: "currentColor",
1281
1302
  "stroke-width": "4"
1282
1303
  }),
1283
- C("path", {
1304
+ N("path", {
1284
1305
  class: "opacity-75",
1285
1306
  fill: "currentColor",
1286
1307
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
1287
1308
  })
1288
1309
  ]),
1289
- C("span", null, "Loading…")
1310
+ N("span", null, "Loading…")
1290
1311
  ], -1)
1291
- ]))) : ye.value ? (_(), T("p", Vn, "Error: " + Ze(ye.value), 1)) : (_(), T("div", {
1312
+ ]))) : ye.value ? (_(), P("p", Ln, "Error: " + et(ye.value), 1)) : (_(), P("div", {
1292
1313
  key: 2,
1293
1314
  class: "relative",
1294
1315
  style: U({ height: nn.value + "px" })
1295
1316
  }, [
1296
- (_(!0), T(Pt, null, Et(We.value, (t) => (_(), T("article", {
1317
+ (_(!0), P(Tt, null, Et(Ge.value, (t) => (_(), P("article", {
1297
1318
  key: m.value[t].id,
1298
1319
  "data-testid": "item-card",
1299
1320
  class: "absolute overflow-hidden rounded-xl border border-slate-200/60 bg-white shadow-sm",
@@ -1304,111 +1325,111 @@ const Nn = { class: "hidden" }, Hn = {
1304
1325
  transform: Ut(t)
1305
1326
  })
1306
1327
  }, [
1307
- Be.value || G.value > 0 ? (_(), T("div", {
1328
+ J.value || W.value > 0 ? (_(), P("div", {
1308
1329
  key: 0,
1309
1330
  "data-testid": "item-header-container",
1310
1331
  class: "w-full",
1311
1332
  style: U(nt.value)
1312
1333
  }, [
1313
- Q(le(w), {
1334
+ Q(ae(y), {
1314
1335
  "slot-fn": ke.value,
1315
- "slot-props": { item: m.value[t], remove: () => De(m.value[t]) }
1336
+ "slot-props": { item: m.value[t], remove: () => Oe(m.value[t]) }
1316
1337
  }, null, 8, ["slot-fn", "slot-props"])
1317
- ], 4)) : Z("", !0),
1318
- C("div", {
1338
+ ], 4)) : ee("", !0),
1339
+ N("div", {
1319
1340
  class: "group relative",
1320
- onMouseenter: (l) => p(m.value[t].id),
1321
- onMouseleave: (l) => b(m.value[t].id)
1341
+ onMouseenter: (l) => g(m.value[t].id),
1342
+ onMouseleave: (l) => w(m.value[t].id)
1322
1343
  }, [
1323
1344
  Q(Rt, {
1324
1345
  item: m.value[t],
1325
- remove: () => De(m.value[t]),
1326
- "loader-slot-fn": ge.value,
1327
- "error-slot-fn": J.value,
1328
- hovered: d.value === m.value[t].id,
1346
+ remove: () => Oe(m.value[t]),
1347
+ "loader-slot-fn": Me.value,
1348
+ "error-slot-fn": x.value,
1349
+ hovered: u.value === m.value[t].id,
1329
1350
  onSuccess: H,
1330
1351
  onError: q
1331
1352
  }, null, 8, ["item", "remove", "loader-slot-fn", "error-slot-fn", "hovered"]),
1332
- tt.value ? (_(), T("div", Ln, [
1333
- Q(le(w), {
1334
- "slot-fn": x.value,
1335
- "slot-props": { item: m.value[t], remove: () => De(m.value[t]) }
1353
+ Se.value ? (_(), P("div", zn, [
1354
+ Q(ae(y), {
1355
+ "slot-fn": s.value,
1356
+ "slot-props": { item: m.value[t], remove: () => Oe(m.value[t]) }
1336
1357
  }, null, 8, ["slot-fn", "slot-props"])
1337
- ])) : Z("", !0)
1338
- ], 40, zn),
1339
- Me.value || K.value > 0 ? (_(), T("div", {
1358
+ ])) : ee("", !0)
1359
+ ], 40, Vn),
1360
+ Re.value || K.value > 0 ? (_(), P("div", {
1340
1361
  key: 1,
1341
1362
  "data-testid": "item-footer-container",
1342
1363
  class: "w-full",
1343
1364
  style: U(ot.value)
1344
1365
  }, [
1345
- Q(le(w), {
1346
- "slot-fn": s.value,
1347
- "slot-props": { item: m.value[t], remove: () => De(m.value[t]) }
1366
+ Q(ae(y), {
1367
+ "slot-fn": se.value,
1368
+ "slot-props": { item: m.value[t], remove: () => Oe(m.value[t]) }
1348
1369
  }, null, 8, ["slot-fn", "slot-props"])
1349
- ], 4)) : Z("", !0)
1370
+ ], 4)) : ee("", !0)
1350
1371
  ], 4))), 128)),
1351
- (_(!0), T(Pt, null, Et(ne.value, (t) => (_(), T("article", {
1372
+ (_(!0), P(Tt, null, Et(le.value, (t) => (_(), P("article", {
1352
1373
  key: t.id + ":leaving",
1353
1374
  "data-testid": "item-card-leaving",
1354
1375
  class: "pointer-events-none absolute overflow-hidden rounded-xl border border-slate-200/60 bg-white shadow-sm",
1355
1376
  style: U({
1356
1377
  width: t.width + "px",
1357
- transition: "transform " + Vt + "ms ease-out",
1378
+ transition: "transform " + Lt + "ms ease-out",
1358
1379
  transform: t.leaving ? "translate3d(" + t.fromX + "px," + t.fromY + "px,0)" : "translate3d(" + t.fromX + "px," + t.toY + "px,0)"
1359
1380
  })
1360
1381
  }, [
1361
- Be.value || G.value > 0 ? (_(), T("div", {
1382
+ J.value || W.value > 0 ? (_(), P("div", {
1362
1383
  key: 0,
1363
1384
  "data-testid": "item-header-container",
1364
1385
  class: "w-full",
1365
1386
  style: U(nt.value)
1366
1387
  }, [
1367
- Q(le(w), {
1388
+ Q(ae(y), {
1368
1389
  "slot-fn": ke.value,
1369
1390
  "slot-props": { item: t.item, remove: () => {
1370
1391
  } }
1371
1392
  }, null, 8, ["slot-fn", "slot-props"])
1372
- ], 4)) : Z("", !0),
1373
- C("div", $n, [
1393
+ ], 4)) : ee("", !0),
1394
+ N("div", $n, [
1374
1395
  Q(Rt, {
1375
1396
  item: t.item,
1376
1397
  remove: () => {
1377
1398
  },
1378
- "loader-slot-fn": ge.value,
1379
- "error-slot-fn": J.value,
1399
+ "loader-slot-fn": Me.value,
1400
+ "error-slot-fn": x.value,
1380
1401
  hovered: !1
1381
1402
  }, null, 8, ["item", "loader-slot-fn", "error-slot-fn"]),
1382
- tt.value ? (_(), T("div", Dn, [
1383
- Q(le(w), {
1384
- "slot-fn": x.value,
1403
+ Se.value ? (_(), P("div", Dn, [
1404
+ Q(ae(y), {
1405
+ "slot-fn": s.value,
1385
1406
  "slot-props": { item: t.item, remove: () => {
1386
1407
  } }
1387
1408
  }, null, 8, ["slot-fn", "slot-props"])
1388
- ])) : Z("", !0)
1409
+ ])) : ee("", !0)
1389
1410
  ]),
1390
- Me.value || K.value > 0 ? (_(), T("div", {
1411
+ Re.value || K.value > 0 ? (_(), P("div", {
1391
1412
  key: 1,
1392
1413
  "data-testid": "item-footer-container",
1393
1414
  class: "w-full",
1394
1415
  style: U(ot.value)
1395
1416
  }, [
1396
- Q(le(w), {
1397
- "slot-fn": s.value,
1417
+ Q(ae(y), {
1418
+ "slot-fn": se.value,
1398
1419
  "slot-props": { item: t.item, remove: () => {
1399
1420
  } }
1400
1421
  }, null, 8, ["slot-fn", "slot-props"])
1401
- ], 4)) : Z("", !0)
1422
+ ], 4)) : ee("", !0)
1402
1423
  ], 4))), 128))
1403
1424
  ], 4)),
1404
- C("div", On, [
1405
- ce.value ? (_(), T("span", Yn, n[1] || (n[1] = [
1406
- C("svg", {
1425
+ N("div", On, [
1426
+ fe.value ? (_(), P("span", Yn, n[1] || (n[1] = [
1427
+ N("svg", {
1407
1428
  class: "h-4 w-4 animate-spin text-slate-500",
1408
1429
  viewBox: "0 0 24 24",
1409
1430
  "aria-hidden": "true"
1410
1431
  }, [
1411
- C("circle", {
1432
+ N("circle", {
1412
1433
  class: "opacity-25",
1413
1434
  cx: "12",
1414
1435
  cy: "12",
@@ -1417,14 +1438,14 @@ const Nn = { class: "hidden" }, Hn = {
1417
1438
  stroke: "currentColor",
1418
1439
  "stroke-width": "4"
1419
1440
  }),
1420
- C("path", {
1441
+ N("path", {
1421
1442
  class: "opacity-75",
1422
1443
  fill: "currentColor",
1423
1444
  d: "M4 12a8 8 0 0 1 8-8v4a4 4 0 0 0-4 4H4z"
1424
1445
  })
1425
1446
  ], -1),
1426
- C("span", null, "Loading more…", -1)
1427
- ]))) : V.value == null ? (_(), T("span", qn, "End of list")) : (_(), T("span", Xn, "Scroll to load page " + Ze(V.value), 1))
1447
+ N("span", null, "Loading more…", -1)
1448
+ ]))) : L.value == null ? (_(), P("span", qn, "End of list")) : (_(), P("span", Xn, "Scroll to load page " + et(L.value), 1))
1428
1449
  ])
1429
1450
  ], 36)
1430
1451
  ], 16));
@@ -1435,32 +1456,32 @@ const Nn = { class: "hidden" }, Hn = {
1435
1456
  const a = gn($t, null);
1436
1457
  if (!a)
1437
1458
  return () => null;
1438
- const f = i.onPreloaded, y = i.onFailed, w = M.overlay, g = M.default;
1459
+ const d = i.onPreloaded, b = i.onFailed, y = M.overlay, h = M.default;
1439
1460
  return a({
1440
1461
  header: M.header,
1441
1462
  loader: M.loader,
1442
- overlay: w ?? g,
1463
+ overlay: y ?? h,
1443
1464
  error: M.error,
1444
1465
  footer: M.footer,
1445
- onPreloaded: typeof f == "function" ? f : Array.isArray(f) ? (d) => {
1446
- for (const p of f)
1447
- typeof p == "function" && p(d);
1466
+ onPreloaded: typeof d == "function" ? d : Array.isArray(d) ? (u) => {
1467
+ for (const g of d)
1468
+ typeof g == "function" && g(u);
1448
1469
  } : void 0,
1449
- onFailed: typeof y == "function" ? y : Array.isArray(y) ? (d) => {
1450
- for (const p of y)
1451
- typeof p == "function" && p(d);
1470
+ onFailed: typeof b == "function" ? b : Array.isArray(b) ? (u) => {
1471
+ for (const g of b)
1472
+ typeof g == "function" && g(u);
1452
1473
  } : void 0
1453
1474
  }), () => null;
1454
1475
  }
1455
1476
  }), Zn = {
1456
1477
  install(o) {
1457
- o.component("Masonry", Kn), o.component("MasonryItem", Jn), o.component("MasonryVideoControls", Lt);
1478
+ o.component("Masonry", Kn), o.component("MasonryItem", Jn), o.component("MasonryVideoControls", zt);
1458
1479
  }
1459
1480
  };
1460
1481
  export {
1461
1482
  Kn as Masonry,
1462
1483
  Jn as MasonryItem,
1463
- Lt as MasonryVideoControls,
1484
+ zt as MasonryVideoControls,
1464
1485
  Zn as VibePlugin,
1465
1486
  pn as masonryDefaults
1466
1487
  };