@wyxos/vibe 1.6.22 → 1.6.24

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.
package/lib/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import { nextTick as U, ref as H, computed as ae, defineComponent as ft, onMounted as dt, onUnmounted as ht, watch as se, createElementBlock as R, openBlock as j, createCommentVNode as ie, createElementVNode as q, normalizeStyle as He, renderSlot as K, normalizeClass as me, withModifiers as nt, toDisplayString as qe, unref as ye, Fragment as lt, renderList as ot, createVNode as Re, withCtx as Ie, mergeProps as Ee, TransitionGroup as Ht } from "vue";
2
- let je = null;
3
- function St() {
4
- if (je != null) return je;
5
- const t = document.createElement("div");
6
- t.style.visibility = "hidden", t.style.overflow = "scroll", t.style.msOverflowStyle = "scrollbar", t.style.width = "100px", t.style.height = "100px", document.body.appendChild(t);
7
- const c = document.createElement("div");
8
- c.style.width = "100%", t.appendChild(c);
9
- const v = t.offsetWidth - c.offsetWidth;
10
- return document.body.removeChild(t), je = v, v;
1
+ import { nextTick as q, ref as D, computed as Q, defineComponent as Ke, onMounted as Qe, onUnmounted as Ze, watch as ee, createElementBlock as R, openBlock as O, createCommentVNode as te, createElementVNode as V, normalizeStyle as ge, renderSlot as _, normalizeClass as re, withModifiers as je, toDisplayString as $e, unref as U, Fragment as Ve, renderList as qe, createVNode as Pe, withCtx as fe, mergeProps as de, TransitionGroup as xt } from "vue";
2
+ let Se = null;
3
+ function bt() {
4
+ if (Se != null) return Se;
5
+ const e = document.createElement("div");
6
+ e.style.visibility = "hidden", e.style.overflow = "scroll", e.style.msOverflowStyle = "scrollbar", e.style.width = "100px", e.style.height = "100px", document.body.appendChild(e);
7
+ const l = document.createElement("div");
8
+ l.style.width = "100%", e.appendChild(l);
9
+ const r = e.offsetWidth - l.offsetWidth;
10
+ return document.body.removeChild(e), Se = r, r;
11
11
  }
12
- function rt(t, c, v, r = {}) {
12
+ function Ye(e, l, r, t = {}) {
13
13
  const {
14
- gutterX: E = 0,
15
- gutterY: w = 0,
16
- header: y = 0,
17
- footer: f = 0,
18
- paddingLeft: x = 0,
19
- paddingRight: M = 0,
20
- sizes: s = {
14
+ gutterX: y = 0,
15
+ gutterY: h = 0,
16
+ header: m = 0,
17
+ footer: i = 0,
18
+ paddingLeft: w = 0,
19
+ paddingRight: b = 0,
20
+ sizes: n = {
21
21
  base: 1,
22
22
  sm: 2,
23
23
  md: 3,
@@ -25,423 +25,873 @@ function rt(t, c, v, r = {}) {
25
25
  xl: 5,
26
26
  "2xl": 6
27
27
  },
28
- placement: T = "masonry"
29
- } = r;
30
- let p = 0, b = 0;
28
+ placement: p = "masonry"
29
+ } = t;
30
+ let x = 0, M = 0;
31
31
  try {
32
- if (c && c.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
33
- const $ = window.getComputedStyle(c);
34
- p = parseFloat($.paddingLeft) || 0, b = parseFloat($.paddingRight) || 0;
32
+ if (l && l.nodeType === 1 && typeof window < "u" && window.getComputedStyle) {
33
+ const L = window.getComputedStyle(l);
34
+ x = parseFloat(L.paddingLeft) || 0, M = parseFloat(L.paddingRight) || 0;
35
35
  }
36
36
  } catch {
37
37
  }
38
- const i = (x || 0) + p, L = (M || 0) + b, l = c.offsetWidth - c.clientWidth, h = l > 0 ? l + 2 : St() + 2, k = c.offsetWidth - h - i - L, P = E * (v - 1), W = Math.floor((k - P) / v), I = t.map(($) => {
39
- const C = $.width, B = $.height;
40
- return Math.round(W * B / C) + f + y;
38
+ const s = (w || 0) + x, g = (b || 0) + M, a = l.offsetWidth - l.clientWidth, d = a > 0 ? a + 2 : bt() + 2, v = l.offsetWidth - d - s - g, T = y * (r - 1), P = Math.floor((v - T) / r), I = e.map((L) => {
39
+ const k = L.width, W = L.height;
40
+ return Math.round(P * W / k) + i + m;
41
41
  });
42
- if (T === "sequential-balanced") {
43
- const $ = I.length;
44
- if ($ === 0) return [];
45
- const C = (N, G, Z) => N + (G > 0 ? w : 0) + Z;
46
- let B = Math.max(...I), a = I.reduce((N, G) => N + G, 0) + w * Math.max(0, $ - 1);
47
- const d = (N) => {
48
- let G = 1, Z = 0, ve = 0;
49
- for (let ee = 0; ee < $; ee++) {
50
- const ge = I[ee], le = C(Z, ve, ge);
51
- if (le <= N)
52
- Z = le, ve++;
53
- else if (G++, Z = ge, ve = 1, ge > N || G > v) return !1;
42
+ if (p === "sequential-balanced") {
43
+ const L = I.length;
44
+ if (L === 0) return [];
45
+ const k = (z, Y, G) => z + (Y > 0 ? h : 0) + G;
46
+ let W = Math.max(...I), o = I.reduce((z, Y) => z + Y, 0) + h * Math.max(0, L - 1);
47
+ const u = (z) => {
48
+ let Y = 1, G = 0, ne = 0;
49
+ for (let J = 0; J < L; J++) {
50
+ const ie = I[J], Z = k(G, ne, ie);
51
+ if (Z <= z)
52
+ G = Z, ne++;
53
+ else if (Y++, G = ie, ne = 1, ie > z || Y > r) return !1;
54
54
  }
55
- return G <= v;
55
+ return Y <= r;
56
56
  };
57
- for (; B < a; ) {
58
- const N = Math.floor((B + a) / 2);
59
- d(N) ? a = N : B = N + 1;
57
+ for (; W < o; ) {
58
+ const z = Math.floor((W + o) / 2);
59
+ u(z) ? o = z : W = z + 1;
60
60
  }
61
- const _ = a, D = new Array(v).fill(0);
62
- let ne = v - 1, X = 0, A = 0;
63
- for (let N = $ - 1; N >= 0; N--) {
64
- const G = I[N], Z = N < ne;
65
- !(C(X, A, G) <= _) || Z ? (D[ne] = N + 1, ne--, X = G, A = 1) : (X = C(X, A, G), A++);
61
+ const E = o, $ = new Array(r).fill(0);
62
+ let C = r - 1, F = 0, N = 0;
63
+ for (let z = L - 1; z >= 0; z--) {
64
+ const Y = I[z], G = z < C;
65
+ !(k(F, N, Y) <= E) || G ? ($[C] = z + 1, C--, F = Y, N = 1) : (F = k(F, N, Y), N++);
66
66
  }
67
- D[0] = 0;
68
- const ue = [], ce = new Array(v).fill(0);
69
- for (let N = 0; N < v; N++) {
70
- const G = D[N], Z = N + 1 < v ? D[N + 1] : $, ve = N * (W + E);
71
- for (let ee = G; ee < Z; ee++) {
72
- const le = {
73
- ...t[ee],
74
- columnWidth: W,
67
+ $[0] = 0;
68
+ const j = [], X = new Array(r).fill(0);
69
+ for (let z = 0; z < r; z++) {
70
+ const Y = $[z], G = z + 1 < r ? $[z + 1] : L, ne = z * (P + y);
71
+ for (let J = Y; J < G; J++) {
72
+ const Z = {
73
+ ...e[J],
74
+ columnWidth: P,
75
75
  imageHeight: 0,
76
76
  columnHeight: 0,
77
77
  left: 0,
78
78
  top: 0
79
79
  };
80
- le.imageHeight = I[ee] - (f + y), le.columnHeight = I[ee], le.left = ve, le.top = ce[N], ce[N] += le.columnHeight + (ee + 1 < Z ? w : 0), ue.push(le);
80
+ Z.imageHeight = I[J] - (i + m), Z.columnHeight = I[J], Z.left = ne, Z.top = X[z], X[z] += Z.columnHeight + (J + 1 < G ? h : 0), j.push(Z);
81
81
  }
82
82
  }
83
- return ue;
83
+ return j;
84
84
  }
85
- const m = new Array(v).fill(0), z = [];
86
- for (let $ = 0; $ < t.length; $++) {
87
- const C = t[$], B = {
88
- ...C,
85
+ const f = new Array(r).fill(0), H = [];
86
+ for (let L = 0; L < e.length; L++) {
87
+ const k = e[L], W = {
88
+ ...k,
89
89
  columnWidth: 0,
90
90
  imageHeight: 0,
91
91
  columnHeight: 0,
92
92
  left: 0,
93
93
  top: 0
94
- }, a = m.indexOf(Math.min(...m)), d = C.width, _ = C.height;
95
- B.columnWidth = W, B.left = a * (W + E), B.imageHeight = Math.round(W * _ / d), B.columnHeight = B.imageHeight + f + y, B.top = m[a], m[a] += B.columnHeight + w, z.push(B);
94
+ }, o = f.indexOf(Math.min(...f)), u = k.width, E = k.height;
95
+ W.columnWidth = P, W.left = o * (P + y), W.imageHeight = Math.round(P * E / u), W.columnHeight = W.imageHeight + i + m, W.top = f[o], f[o] += W.columnHeight + h, H.push(W);
96
96
  }
97
- return z;
97
+ return H;
98
98
  }
99
- var Pt = typeof global == "object" && global && global.Object === Object && global, $t = typeof self == "object" && self && self.Object === Object && self, mt = Pt || $t || Function("return this")(), $e = mt.Symbol, gt = Object.prototype, Nt = gt.hasOwnProperty, Ft = gt.toString, Le = $e ? $e.toStringTag : void 0;
100
- function Wt(t) {
101
- var c = Nt.call(t, Le), v = t[Le];
99
+ var Mt = typeof global == "object" && global && global.Object === Object && global, Tt = typeof self == "object" && self && self.Object === Object && self, et = Mt || Tt || Function("return this")(), xe = et.Symbol, tt = Object.prototype, It = tt.hasOwnProperty, Et = tt.toString, me = xe ? xe.toStringTag : void 0;
100
+ function kt(e) {
101
+ var l = It.call(e, me), r = e[me];
102
102
  try {
103
- t[Le] = void 0;
104
- var r = !0;
103
+ e[me] = void 0;
104
+ var t = !0;
105
105
  } catch {
106
106
  }
107
- var E = Ft.call(t);
108
- return r && (c ? t[Le] = v : delete t[Le]), E;
107
+ var y = Et.call(e);
108
+ return t && (l ? e[me] = r : delete e[me]), y;
109
109
  }
110
- var Bt = Object.prototype, Dt = Bt.toString;
111
- function At(t) {
112
- return Dt.call(t);
110
+ var Lt = Object.prototype, Pt = Lt.toString;
111
+ function St(e) {
112
+ return Pt.call(e);
113
113
  }
114
- var zt = "[object Null]", Ot = "[object Undefined]", it = $e ? $e.toStringTag : void 0;
115
- function Rt(t) {
116
- return t == null ? t === void 0 ? Ot : zt : it && it in Object(t) ? Wt(t) : At(t);
114
+ var Ht = "[object Null]", $t = "[object Undefined]", Ue = xe ? xe.toStringTag : void 0;
115
+ function Nt(e) {
116
+ return e == null ? e === void 0 ? $t : Ht : Ue && Ue in Object(e) ? kt(e) : St(e);
117
117
  }
118
- function jt(t) {
119
- return t != null && typeof t == "object";
118
+ function Dt(e) {
119
+ return e != null && typeof e == "object";
120
120
  }
121
- var Ct = "[object Symbol]";
122
- function qt(t) {
123
- return typeof t == "symbol" || jt(t) && Rt(t) == Ct;
121
+ var zt = "[object Symbol]";
122
+ function Bt(e) {
123
+ return typeof e == "symbol" || Dt(e) && Nt(e) == zt;
124
124
  }
125
- var Vt = /\s/;
126
- function Yt(t) {
127
- for (var c = t.length; c-- && Vt.test(t.charAt(c)); )
125
+ var Ft = /\s/;
126
+ function At(e) {
127
+ for (var l = e.length; l-- && Ft.test(e.charAt(l)); )
128
128
  ;
129
- return c;
129
+ return l;
130
130
  }
131
- var Ut = /^\s+/;
132
- function _t(t) {
133
- return t && t.slice(0, Yt(t) + 1).replace(Ut, "");
131
+ var Wt = /^\s+/;
132
+ function Rt(e) {
133
+ return e && e.slice(0, At(e) + 1).replace(Wt, "");
134
134
  }
135
- function Ve(t) {
136
- var c = typeof t;
137
- return t != null && (c == "object" || c == "function");
135
+ function Ne(e) {
136
+ var l = typeof e;
137
+ return e != null && (l == "object" || l == "function");
138
138
  }
139
- var st = NaN, Xt = /^[-+]0x[0-9a-f]+$/i, Gt = /^0b[01]+$/i, Jt = /^0o[0-7]+$/i, Kt = parseInt;
140
- function ut(t) {
141
- if (typeof t == "number")
142
- return t;
143
- if (qt(t))
144
- return st;
145
- if (Ve(t)) {
146
- var c = typeof t.valueOf == "function" ? t.valueOf() : t;
147
- t = Ve(c) ? c + "" : c;
139
+ var _e = NaN, Ot = /^[-+]0x[0-9a-f]+$/i, Ct = /^0b[01]+$/i, jt = /^0o[0-7]+$/i, Vt = parseInt;
140
+ function Xe(e) {
141
+ if (typeof e == "number")
142
+ return e;
143
+ if (Bt(e))
144
+ return _e;
145
+ if (Ne(e)) {
146
+ var l = typeof e.valueOf == "function" ? e.valueOf() : e;
147
+ e = Ne(l) ? l + "" : l;
148
148
  }
149
- if (typeof t != "string")
150
- return t === 0 ? t : +t;
151
- t = _t(t);
152
- var v = Gt.test(t);
153
- return v || Jt.test(t) ? Kt(t.slice(2), v ? 2 : 8) : Xt.test(t) ? st : +t;
149
+ if (typeof e != "string")
150
+ return e === 0 ? e : +e;
151
+ e = Rt(e);
152
+ var r = Ct.test(e);
153
+ return r || jt.test(e) ? Vt(e.slice(2), r ? 2 : 8) : Ot.test(e) ? _e : +e;
154
154
  }
155
- var Ce = function() {
156
- return mt.Date.now();
157
- }, Qt = "Expected a function", Zt = Math.max, ea = Math.min;
158
- function ct(t, c, v) {
159
- var r, E, w, y, f, x, M = 0, s = !1, T = !1, p = !0;
160
- if (typeof t != "function")
161
- throw new TypeError(Qt);
162
- c = ut(c) || 0, Ve(v) && (s = !!v.leading, T = "maxWait" in v, w = T ? Zt(ut(v.maxWait) || 0, c) : w, p = "trailing" in v ? !!v.trailing : p);
163
- function b(m) {
164
- var z = r, $ = E;
165
- return r = E = void 0, M = m, y = t.apply($, z), y;
155
+ var He = function() {
156
+ return et.Date.now();
157
+ }, qt = "Expected a function", Yt = Math.max, Ut = Math.min;
158
+ function Ge(e, l, r) {
159
+ var t, y, h, m, i, w, b = 0, n = !1, p = !1, x = !0;
160
+ if (typeof e != "function")
161
+ throw new TypeError(qt);
162
+ l = Xe(l) || 0, Ne(r) && (n = !!r.leading, p = "maxWait" in r, h = p ? Yt(Xe(r.maxWait) || 0, l) : h, x = "trailing" in r ? !!r.trailing : x);
163
+ function M(f) {
164
+ var H = t, L = y;
165
+ return t = y = void 0, b = f, m = e.apply(L, H), m;
166
166
  }
167
- function i(m) {
168
- return M = m, f = setTimeout(h, c), s ? b(m) : y;
167
+ function s(f) {
168
+ return b = f, i = setTimeout(d, l), n ? M(f) : m;
169
169
  }
170
- function L(m) {
171
- var z = m - x, $ = m - M, C = c - z;
172
- return T ? ea(C, w - $) : C;
170
+ function g(f) {
171
+ var H = f - w, L = f - b, k = l - H;
172
+ return p ? Ut(k, h - L) : k;
173
173
  }
174
- function l(m) {
175
- var z = m - x, $ = m - M;
176
- return x === void 0 || z >= c || z < 0 || T && $ >= w;
174
+ function a(f) {
175
+ var H = f - w, L = f - b;
176
+ return w === void 0 || H >= l || H < 0 || p && L >= h;
177
177
  }
178
- function h() {
179
- var m = Ce();
180
- if (l(m))
181
- return k(m);
182
- f = setTimeout(h, L(m));
178
+ function d() {
179
+ var f = He();
180
+ if (a(f))
181
+ return v(f);
182
+ i = setTimeout(d, g(f));
183
183
  }
184
- function k(m) {
185
- return f = void 0, p && r ? b(m) : (r = E = void 0, y);
184
+ function v(f) {
185
+ return i = void 0, x && t ? M(f) : (t = y = void 0, m);
186
186
  }
187
- function P() {
188
- f !== void 0 && clearTimeout(f), M = 0, r = x = E = f = void 0;
187
+ function T() {
188
+ i !== void 0 && clearTimeout(i), b = 0, t = w = y = i = void 0;
189
189
  }
190
- function W() {
191
- return f === void 0 ? y : k(Ce());
190
+ function P() {
191
+ return i === void 0 ? m : v(He());
192
192
  }
193
193
  function I() {
194
- var m = Ce(), z = l(m);
195
- if (r = arguments, E = this, x = m, z) {
196
- if (f === void 0)
197
- return i(x);
198
- if (T)
199
- return clearTimeout(f), f = setTimeout(h, c), b(x);
194
+ var f = He(), H = a(f);
195
+ if (t = arguments, y = this, w = f, H) {
196
+ if (i === void 0)
197
+ return s(w);
198
+ if (p)
199
+ return clearTimeout(i), i = setTimeout(d, l), M(w);
200
200
  }
201
- return f === void 0 && (f = setTimeout(h, c)), y;
201
+ return i === void 0 && (i = setTimeout(d, l)), m;
202
202
  }
203
- return I.cancel = P, I.flush = W, I;
203
+ return I.cancel = T, I.flush = P, I;
204
204
  }
205
- function we(t, c) {
206
- const v = c ?? (typeof window < "u" ? window.innerWidth : 1024), r = t.sizes;
207
- return v >= 1536 && r["2xl"] ? r["2xl"] : v >= 1280 && r.xl ? r.xl : v >= 1024 && r.lg ? r.lg : v >= 768 && r.md ? r.md : v >= 640 && r.sm ? r.sm : r.base;
205
+ function ue(e, l) {
206
+ const r = l ?? (typeof window < "u" ? window.innerWidth : 1024), t = e.sizes;
207
+ return r >= 1536 && t["2xl"] ? t["2xl"] : r >= 1280 && t.xl ? t.xl : r >= 1024 && t.lg ? t.lg : r >= 768 && t.md ? t.md : r >= 640 && t.sm ? t.sm : t.base;
208
208
  }
209
- function ta(t) {
210
- const c = t ?? (typeof window < "u" ? window.innerWidth : 1024);
211
- return c >= 1536 ? "2xl" : c >= 1280 ? "xl" : c >= 1024 ? "lg" : c >= 768 ? "md" : c >= 640 ? "sm" : "base";
209
+ function _t(e) {
210
+ const l = e ?? (typeof window < "u" ? window.innerWidth : 1024);
211
+ return l >= 1536 ? "2xl" : l >= 1280 ? "xl" : l >= 1024 ? "lg" : l >= 768 ? "md" : l >= 640 ? "sm" : "base";
212
212
  }
213
- function aa(t) {
214
- return t.reduce((v, r) => Math.max(v, r.top + r.columnHeight), 0) + 500;
213
+ function Xt(e) {
214
+ return e.reduce((r, t) => Math.max(r, t.top + t.columnHeight), 0) + 500;
215
215
  }
216
- function na(t) {
216
+ function Gt(e) {
217
217
  return {
218
- transform: `translate3d(${t.left}px, ${t.top}px, 0)`,
218
+ transform: `translate3d(${e.left}px, ${e.top}px, 0)`,
219
219
  top: "0px",
220
220
  left: "0px",
221
- width: `${t.columnWidth}px`,
222
- height: `${t.columnHeight}px`
221
+ width: `${e.columnWidth}px`,
222
+ height: `${e.columnHeight}px`
223
223
  };
224
224
  }
225
- function la(t, c = 0) {
225
+ function Jt(e, l = 0) {
226
226
  return {
227
- style: na(t),
228
- "data-top": t.top,
229
- "data-left": t.left,
230
- "data-id": `${t.page}-${t.id}`,
231
- "data-index": c
227
+ style: Gt(e),
228
+ "data-top": e.top,
229
+ "data-left": e.left,
230
+ "data-id": `${e.page}-${e.id}`,
231
+ "data-index": l
232
232
  };
233
233
  }
234
- function Ye(t, c) {
235
- if (!t.length || c <= 0)
236
- return new Array(Math.max(1, c)).fill(0);
237
- const r = Array.from(new Set(t.map((y) => y.left))).sort((y, f) => y - f).slice(0, c), E = /* @__PURE__ */ new Map();
238
- for (let y = 0; y < r.length; y++) E.set(r[y], y);
239
- const w = new Array(r.length).fill(0);
240
- for (const y of t) {
241
- const f = E.get(y.left);
242
- f != null && (w[f] = Math.max(w[f], y.top + y.columnHeight));
234
+ function De(e, l) {
235
+ if (!e.length || l <= 0)
236
+ return new Array(Math.max(1, l)).fill(0);
237
+ const t = Array.from(new Set(e.map((m) => m.left))).sort((m, i) => m - i).slice(0, l), y = /* @__PURE__ */ new Map();
238
+ for (let m = 0; m < t.length; m++) y.set(t[m], m);
239
+ const h = new Array(t.length).fill(0);
240
+ for (const m of e) {
241
+ const i = y.get(m.left);
242
+ i != null && (h[i] = Math.max(h[i], m.top + m.columnHeight));
243
243
  }
244
- for (; w.length < c; ) w.push(0);
245
- return w;
244
+ for (; h.length < l; ) h.push(0);
245
+ return h;
246
246
  }
247
- function oa(t, c) {
248
- let v = 0, r = 0;
249
- const E = 1e3;
250
- function w(s, T) {
251
- var i;
252
- const p = (i = t.container) == null ? void 0 : i.value;
253
- if (p) {
254
- const L = p.scrollTop, l = p.clientHeight;
255
- v = L - E, r = L + l + E;
247
+ function Kt(e, l) {
248
+ let r = 0, t = 0;
249
+ const y = 1e3;
250
+ function h(n, p) {
251
+ var s;
252
+ const x = (s = e.container) == null ? void 0 : s.value;
253
+ if (x) {
254
+ const g = x.scrollTop, a = x.clientHeight;
255
+ r = g - y, t = g + a + y;
256
256
  }
257
- return s + T >= v && s <= r;
257
+ return n + p >= r && n <= t;
258
258
  }
259
- function y(s, T) {
260
- const p = parseInt(s.dataset.left || "0", 10), b = parseInt(s.dataset.top || "0", 10), i = parseInt(s.dataset.index || "0", 10), L = s.offsetHeight || parseInt(getComputedStyle(s).height || "200", 10) || 200;
261
- if (!w(b, L)) {
262
- s.style.opacity = "1", s.style.transform = `translate3d(${p}px, ${b}px, 0) scale(1)`, s.style.transition = "none", T();
259
+ function m(n, p) {
260
+ var v;
261
+ const x = parseInt(n.dataset.left || "0", 10), M = parseInt(n.dataset.top || "0", 10), s = parseInt(n.dataset.index || "0", 10), g = n.offsetHeight || parseInt(getComputedStyle(n).height || "200", 10) || 200;
262
+ if ((v = l == null ? void 0 : l.virtualizing) != null && v.value) {
263
+ n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${x}px, ${M}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
264
+ n.style.transition = "", p();
265
+ });
266
+ return;
267
+ }
268
+ if (!h(M, g)) {
269
+ n.style.opacity = "1", n.style.transform = `translate3d(${x}px, ${M}px, 0) scale(1)`, n.style.transition = "none", p();
263
270
  return;
264
271
  }
265
- const l = Math.min(i * 20, 160), h = s.style.getPropertyValue("--masonry-opacity-delay");
266
- s.style.setProperty("--masonry-opacity-delay", `${l}ms`), requestAnimationFrame(() => {
267
- s.style.opacity = "1", s.style.transform = `translate3d(${p}px, ${b}px, 0) scale(1)`;
268
- const k = () => {
269
- h ? s.style.setProperty("--masonry-opacity-delay", h) : s.style.removeProperty("--masonry-opacity-delay"), s.removeEventListener("transitionend", k), T();
272
+ const a = Math.min(s * 20, 160), d = n.style.getPropertyValue("--masonry-opacity-delay");
273
+ n.style.setProperty("--masonry-opacity-delay", `${a}ms`), requestAnimationFrame(() => {
274
+ n.style.opacity = "1", n.style.transform = `translate3d(${x}px, ${M}px, 0) scale(1)`;
275
+ const T = () => {
276
+ d ? n.style.setProperty("--masonry-opacity-delay", d) : n.style.removeProperty("--masonry-opacity-delay"), n.removeEventListener("transitionend", T), p();
270
277
  };
271
- s.addEventListener("transitionend", k);
278
+ n.addEventListener("transitionend", T);
272
279
  });
273
280
  }
274
- function f(s) {
275
- const T = parseInt(s.dataset.left || "0", 10), p = parseInt(s.dataset.top || "0", 10);
276
- s.style.opacity = "0", s.style.transform = `translate3d(${T}px, ${p + 10}px, 0) scale(0.985)`;
277
- }
278
- function x(s) {
279
- const T = parseInt(s.dataset.left || "0", 10), p = parseInt(s.dataset.top || "0", 10), b = s.offsetHeight || parseInt(getComputedStyle(s).height || "200", 10) || 200;
280
- if (!w(p, b)) {
281
- s.style.transition = "none";
281
+ function i(n) {
282
+ var M;
283
+ const p = parseInt(n.dataset.left || "0", 10), x = parseInt(n.dataset.top || "0", 10);
284
+ if ((M = l == null ? void 0 : l.virtualizing) != null && M.value) {
285
+ n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${p}px, ${x}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay");
282
286
  return;
283
287
  }
284
- s.style.transition = "none", s.style.opacity = "1", s.style.transform = `translate3d(${T}px, ${p}px, 0) scale(1)`, s.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
285
- s.style.transition = "";
286
- });
288
+ n.style.opacity = "0", n.style.transform = `translate3d(${p}px, ${x + 10}px, 0) scale(0.985)`;
287
289
  }
288
- function M(s, T) {
289
- const p = parseInt(s.dataset.left || "0", 10), b = parseInt(s.dataset.top || "0", 10), i = s.offsetHeight || parseInt(getComputedStyle(s).height || "200", 10) || 200;
290
- if (!w(b, i)) {
291
- s.style.transition = "none", s.style.opacity = "0", T();
290
+ function w(n) {
291
+ var s;
292
+ const p = parseInt(n.dataset.left || "0", 10), x = parseInt(n.dataset.top || "0", 10), M = n.offsetHeight || parseInt(getComputedStyle(n).height || "200", 10) || 200;
293
+ if (!((s = l == null ? void 0 : l.virtualizing) != null && s.value)) {
294
+ if (!h(x, M)) {
295
+ n.style.transition = "none";
296
+ return;
297
+ }
298
+ n.style.transition = "none", n.style.opacity = "1", n.style.transform = `translate3d(${p}px, ${x}px, 0) scale(1)`, n.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
299
+ n.style.transition = "";
300
+ });
301
+ }
302
+ }
303
+ function b(n, p) {
304
+ var I;
305
+ const x = parseInt(n.dataset.left || "0", 10), M = parseInt(n.dataset.top || "0", 10), s = n.offsetHeight || parseInt(getComputedStyle(n).height || "200", 10) || 200;
306
+ if ((I = l == null ? void 0 : l.virtualizing) != null && I.value) {
307
+ p();
292
308
  return;
293
309
  }
294
- const L = typeof (c == null ? void 0 : c.leaveDurationMs) == "number" ? c.leaveDurationMs : NaN;
295
- let l = Number.isFinite(L) && L > 0 ? L : NaN;
296
- if (!Number.isFinite(l)) {
297
- const m = getComputedStyle(s).getPropertyValue("--masonry-leave-duration") || "", z = parseFloat(m);
298
- l = Number.isFinite(z) && z > 0 ? z : 200;
310
+ if (!h(M, s)) {
311
+ n.style.transition = "none", n.style.opacity = "0", p();
312
+ return;
299
313
  }
300
- const h = s.style.transitionDuration, k = () => {
301
- s.removeEventListener("transitionend", P), clearTimeout(W), s.style.transitionDuration = h || "";
302
- }, P = (I) => {
303
- (!I || I.target === s) && (k(), T());
304
- }, W = setTimeout(() => {
305
- k(), T();
306
- }, l + 100);
314
+ const g = typeof (l == null ? void 0 : l.leaveDurationMs) == "number" ? l.leaveDurationMs : NaN;
315
+ let a = Number.isFinite(g) && g > 0 ? g : NaN;
316
+ if (!Number.isFinite(a)) {
317
+ const H = getComputedStyle(n).getPropertyValue("--masonry-leave-duration") || "", L = parseFloat(H);
318
+ a = Number.isFinite(L) && L > 0 ? L : 200;
319
+ }
320
+ const d = n.style.transitionDuration, v = () => {
321
+ n.removeEventListener("transitionend", T), clearTimeout(P), n.style.transitionDuration = d || "";
322
+ }, T = (f) => {
323
+ (!f || f.target === n) && (v(), p());
324
+ }, P = setTimeout(() => {
325
+ v(), p();
326
+ }, a + 100);
307
327
  requestAnimationFrame(() => {
308
- s.style.transitionDuration = `${l}ms`, s.style.opacity = "0", s.style.transform = `translate3d(${p}px, ${b + 10}px, 0) scale(0.985)`, s.addEventListener("transitionend", P);
328
+ n.style.transitionDuration = `${a}ms`, n.style.opacity = "0", n.style.transform = `translate3d(${x}px, ${M + 10}px, 0) scale(0.985)`, n.addEventListener("transitionend", T);
309
329
  });
310
330
  }
311
331
  return {
312
- onEnter: y,
313
- onBeforeEnter: f,
314
- onBeforeLeave: x,
315
- onLeave: M
332
+ onEnter: m,
333
+ onBeforeEnter: i,
334
+ onBeforeLeave: w,
335
+ onLeave: b
316
336
  };
317
337
  }
318
- function ra({
319
- container: t,
320
- masonry: c,
321
- columns: v,
322
- containerHeight: r,
323
- isLoading: E,
324
- pageSize: w,
325
- refreshLayout: y,
326
- setItemsRaw: f,
327
- loadNext: x,
328
- loadThresholdPx: M
338
+ function Qt({
339
+ container: e,
340
+ masonry: l,
341
+ columns: r,
342
+ containerHeight: t,
343
+ isLoading: y,
344
+ pageSize: h,
345
+ refreshLayout: m,
346
+ setItemsRaw: i,
347
+ loadNext: w,
348
+ loadThresholdPx: b
329
349
  }) {
330
- let s = 0;
331
- async function T(p) {
332
- if (!t.value) return;
333
- const b = p ?? Ye(c.value, v.value), i = b.length ? Math.max(...b) : 0, L = t.value.scrollTop + t.value.clientHeight, l = t.value.scrollTop > s + 1;
334
- s = t.value.scrollTop;
335
- const h = typeof M == "number" ? M : 200, k = h >= 0 ? Math.max(0, i - h) : Math.max(0, i + h);
336
- if (L >= k && l && !E.value) {
337
- await x(), await U();
350
+ let n = 0;
351
+ async function p(x) {
352
+ if (!e.value) return;
353
+ const M = x ?? De(l.value, r.value), s = M.length ? Math.max(...M) : 0, g = e.value.scrollTop + e.value.clientHeight, a = e.value.scrollTop > n + 1;
354
+ n = e.value.scrollTop;
355
+ const d = typeof b == "number" ? b : 200, v = d >= 0 ? Math.max(0, s - d) : Math.max(0, s + d);
356
+ if (g >= v && a && !y.value) {
357
+ await w(), await q();
338
358
  return;
339
359
  }
340
360
  }
341
361
  return {
342
- handleScroll: T
362
+ handleScroll: p
343
363
  };
344
364
  }
345
- function ia(t) {
346
- const { useSwipeMode: c, masonry: v, isLoading: r, loadNext: E, loadPage: w, paginationHistory: y } = t, f = H(0), x = H(0), M = H(!1), s = H(0), T = H(0), p = H(null), b = ae(() => {
347
- if (!c.value || v.value.length === 0) return null;
348
- const a = Math.max(0, Math.min(f.value, v.value.length - 1));
349
- return v.value[a] || null;
350
- }), i = ae(() => {
351
- if (!c.value || !b.value) return null;
352
- const a = f.value + 1;
353
- return a >= v.value.length ? null : v.value[a] || null;
354
- }), L = ae(() => {
355
- if (!c.value || !b.value) return null;
356
- const a = f.value - 1;
357
- return a < 0 ? null : v.value[a] || null;
365
+ function Zt(e) {
366
+ const { useSwipeMode: l, masonry: r, isLoading: t, loadNext: y, loadPage: h, paginationHistory: m } = e, i = D(0), w = D(0), b = D(!1), n = D(0), p = D(0), x = D(null), M = Q(() => {
367
+ if (!l.value || r.value.length === 0) return null;
368
+ const o = Math.max(0, Math.min(i.value, r.value.length - 1));
369
+ return r.value[o] || null;
370
+ }), s = Q(() => {
371
+ if (!l.value || !M.value) return null;
372
+ const o = i.value + 1;
373
+ return o >= r.value.length ? null : r.value[o] || null;
374
+ }), g = Q(() => {
375
+ if (!l.value || !M.value) return null;
376
+ const o = i.value - 1;
377
+ return o < 0 ? null : r.value[o] || null;
358
378
  });
359
- function l() {
360
- if (!p.value) return;
361
- const a = p.value.clientHeight;
362
- x.value = -f.value * a;
379
+ function a() {
380
+ if (!x.value) return;
381
+ const o = x.value.clientHeight;
382
+ w.value = -i.value * o;
363
383
  }
364
- function h() {
365
- if (!i.value) {
366
- E();
384
+ function d() {
385
+ if (!s.value) {
386
+ y();
367
387
  return;
368
388
  }
369
- f.value++, l(), f.value >= v.value.length - 5 && E();
389
+ i.value++, a(), i.value >= r.value.length - 5 && y();
370
390
  }
371
- function k() {
372
- L.value && (f.value--, l());
391
+ function v() {
392
+ g.value && (i.value--, a());
373
393
  }
374
- function P(a) {
375
- c.value && (M.value = !0, s.value = a.touches[0].clientY, T.value = x.value, a.preventDefault());
394
+ function T(o) {
395
+ l.value && (b.value = !0, n.value = o.touches[0].clientY, p.value = w.value, o.preventDefault());
376
396
  }
377
- function W(a) {
378
- if (!c.value || !M.value) return;
379
- const d = a.touches[0].clientY - s.value;
380
- x.value = T.value + d, a.preventDefault();
397
+ function P(o) {
398
+ if (!l.value || !b.value) return;
399
+ const u = o.touches[0].clientY - n.value;
400
+ w.value = p.value + u, o.preventDefault();
381
401
  }
382
- function I(a) {
383
- if (!c.value || !M.value) return;
384
- M.value = !1;
385
- const d = x.value - T.value;
386
- Math.abs(d) > 100 ? d > 0 && L.value ? k() : d < 0 && i.value ? h() : l() : l(), a.preventDefault();
402
+ function I(o) {
403
+ if (!l.value || !b.value) return;
404
+ b.value = !1;
405
+ const u = w.value - p.value;
406
+ Math.abs(u) > 100 ? u > 0 && g.value ? v() : u < 0 && s.value ? d() : a() : a(), o.preventDefault();
387
407
  }
388
- function m(a) {
389
- c.value && (M.value = !0, s.value = a.clientY, T.value = x.value, a.preventDefault());
408
+ function f(o) {
409
+ l.value && (b.value = !0, n.value = o.clientY, p.value = w.value, o.preventDefault());
390
410
  }
391
- function z(a) {
392
- if (!c.value || !M.value) return;
393
- const d = a.clientY - s.value;
394
- x.value = T.value + d, a.preventDefault();
411
+ function H(o) {
412
+ if (!l.value || !b.value) return;
413
+ const u = o.clientY - n.value;
414
+ w.value = p.value + u, o.preventDefault();
395
415
  }
396
- function $(a) {
397
- if (!c.value || !M.value) return;
398
- M.value = !1;
399
- const d = x.value - T.value;
400
- Math.abs(d) > 100 ? d > 0 && L.value ? k() : d < 0 && i.value ? h() : l() : l(), a.preventDefault();
416
+ function L(o) {
417
+ if (!l.value || !b.value) return;
418
+ b.value = !1;
419
+ const u = w.value - p.value;
420
+ Math.abs(u) > 100 ? u > 0 && g.value ? v() : u < 0 && s.value ? d() : a() : a(), o.preventDefault();
401
421
  }
402
- function C() {
403
- !c.value && f.value > 0 && (f.value = 0, x.value = 0), c.value && v.value.length === 0 && !r.value && w(y.value[0]), c.value && l();
422
+ function k() {
423
+ !l.value && i.value > 0 && (i.value = 0, w.value = 0), l.value && r.value.length === 0 && !t.value && h(m.value[0]), l.value && a();
404
424
  }
405
- function B() {
406
- f.value = 0, x.value = 0, M.value = !1;
425
+ function W() {
426
+ i.value = 0, w.value = 0, b.value = !1;
407
427
  }
408
428
  return {
409
429
  // State
410
- currentSwipeIndex: f,
411
- swipeOffset: x,
412
- isDragging: M,
413
- swipeContainer: p,
430
+ currentSwipeIndex: i,
431
+ swipeOffset: w,
432
+ isDragging: b,
433
+ swipeContainer: x,
414
434
  // Computed
415
- currentItem: b,
416
- nextItem: i,
417
- previousItem: L,
435
+ currentItem: M,
436
+ nextItem: s,
437
+ previousItem: g,
418
438
  // Functions
419
- handleTouchStart: P,
420
- handleTouchMove: W,
439
+ handleTouchStart: T,
440
+ handleTouchMove: P,
421
441
  handleTouchEnd: I,
422
- handleMouseDown: m,
423
- handleMouseMove: z,
424
- handleMouseUp: $,
425
- goToNextItem: h,
426
- goToPreviousItem: k,
427
- snapToCurrentItem: l,
428
- handleWindowResize: C,
429
- reset: B
442
+ handleMouseDown: f,
443
+ handleMouseMove: H,
444
+ handleMouseUp: L,
445
+ goToNextItem: d,
446
+ goToPreviousItem: v,
447
+ snapToCurrentItem: a,
448
+ handleWindowResize: k,
449
+ reset: W
450
+ };
451
+ }
452
+ function he(e) {
453
+ return e instanceof Error ? e : new Error(String(e));
454
+ }
455
+ function ea(e) {
456
+ const {
457
+ getNextPage: l,
458
+ masonry: r,
459
+ isLoading: t,
460
+ hasReachedEnd: y,
461
+ loadError: h,
462
+ currentPage: m,
463
+ paginationHistory: i,
464
+ refreshLayout: w,
465
+ retryMaxAttempts: b,
466
+ retryInitialDelayMs: n,
467
+ retryBackoffStepMs: p,
468
+ backfillEnabled: x,
469
+ backfillDelayMs: M,
470
+ backfillMaxCalls: s,
471
+ pageSize: g,
472
+ autoRefreshOnEmpty: a,
473
+ emits: d
474
+ } = e, v = D(!1);
475
+ let T = !1;
476
+ function P(u, E) {
477
+ return new Promise(($) => {
478
+ const C = Math.max(0, u | 0), F = Date.now();
479
+ E(C, C);
480
+ const N = setInterval(() => {
481
+ if (v.value) {
482
+ clearInterval(N), $();
483
+ return;
484
+ }
485
+ const j = Date.now() - F, X = Math.max(0, C - j);
486
+ E(X, C), X <= 0 && (clearInterval(N), $());
487
+ }, 100);
488
+ });
489
+ }
490
+ async function I(u) {
491
+ let E = 0;
492
+ const $ = b;
493
+ let C = n;
494
+ for (; ; )
495
+ try {
496
+ const F = await u();
497
+ return E > 0 && d("retry:stop", { attempt: E, success: !0 }), F;
498
+ } catch (F) {
499
+ if (E++, E > $)
500
+ throw d("retry:stop", { attempt: E - 1, success: !1 }), F;
501
+ d("retry:start", { attempt: E, max: $, totalMs: C }), await P(C, (N, j) => {
502
+ d("retry:tick", { attempt: E, remainingMs: N, totalMs: j });
503
+ }), C += p;
504
+ }
505
+ }
506
+ async function f(u) {
507
+ try {
508
+ const E = await I(() => l(u));
509
+ return w([...r.value, ...E.items]), E;
510
+ } catch (E) {
511
+ throw E;
512
+ }
513
+ }
514
+ async function H(u, E = !1) {
515
+ if (!E && !x || T || v.value || y.value) return;
516
+ const $ = (u || 0) + (g || 0);
517
+ if (!g || g <= 0) return;
518
+ if (i.value[i.value.length - 1] == null) {
519
+ y.value = !0;
520
+ return;
521
+ }
522
+ if (!(r.value.length >= $)) {
523
+ T = !0, t.value = !0;
524
+ try {
525
+ let F = 0;
526
+ for (d("backfill:start", { target: $, fetched: r.value.length, calls: F }); r.value.length < $ && F < s && i.value[i.value.length - 1] != null && !v.value && !y.value && T && (await P(M, (j, X) => {
527
+ d("backfill:tick", {
528
+ fetched: r.value.length,
529
+ target: $,
530
+ calls: F,
531
+ remainingMs: j,
532
+ totalMs: X
533
+ });
534
+ }), !(v.value || !T)); ) {
535
+ const N = i.value[i.value.length - 1];
536
+ if (N == null) {
537
+ y.value = !0;
538
+ break;
539
+ }
540
+ try {
541
+ if (v.value || !T) break;
542
+ const j = await f(N);
543
+ if (v.value || !T) break;
544
+ h.value = null, i.value.push(j.nextPage), j.nextPage == null && (y.value = !0);
545
+ } catch (j) {
546
+ if (v.value || !T) break;
547
+ h.value = he(j);
548
+ }
549
+ F++;
550
+ }
551
+ d("backfill:stop", { fetched: r.value.length, calls: F });
552
+ } finally {
553
+ T = !1, t.value = !1;
554
+ }
555
+ }
556
+ }
557
+ async function L(u) {
558
+ if (!t.value) {
559
+ v.value = !1, t.value = !0, y.value = !1, h.value = null;
560
+ try {
561
+ const E = r.value.length;
562
+ if (v.value) return;
563
+ const $ = await f(u);
564
+ return v.value ? void 0 : (h.value = null, m.value = u, i.value.push($.nextPage), $.nextPage == null && (y.value = !0), await H(E), $);
565
+ } catch (E) {
566
+ throw h.value = he(E), E;
567
+ } finally {
568
+ t.value = !1;
569
+ }
570
+ }
571
+ }
572
+ async function k() {
573
+ if (!t.value && !y.value) {
574
+ v.value = !1, t.value = !0, h.value = null;
575
+ try {
576
+ const u = r.value.length;
577
+ if (v.value) return;
578
+ const E = i.value[i.value.length - 1];
579
+ if (E == null) {
580
+ y.value = !0, t.value = !1;
581
+ return;
582
+ }
583
+ const $ = await f(E);
584
+ return v.value ? void 0 : (h.value = null, m.value = E, i.value.push($.nextPage), $.nextPage == null && (y.value = !0), await H(u), $);
585
+ } catch (u) {
586
+ throw h.value = he(u), u;
587
+ } finally {
588
+ t.value = !1;
589
+ }
590
+ }
591
+ }
592
+ async function W() {
593
+ if (!t.value) {
594
+ v.value = !1, t.value = !0;
595
+ try {
596
+ const u = m.value;
597
+ if (u == null) {
598
+ console.warn("[Masonry] No current page to refresh - currentPage:", m.value, "paginationHistory:", i.value);
599
+ return;
600
+ }
601
+ r.value = [], y.value = !1, h.value = null, i.value = [u];
602
+ const E = await f(u);
603
+ if (v.value) return;
604
+ h.value = null, m.value = u, i.value.push(E.nextPage), E.nextPage == null && (y.value = !0);
605
+ const $ = r.value.length;
606
+ return await H($), E;
607
+ } catch (u) {
608
+ throw h.value = he(u), u;
609
+ } finally {
610
+ t.value = !1;
611
+ }
612
+ }
613
+ }
614
+ function o() {
615
+ const u = T;
616
+ v.value = !0, t.value = !1, T = !1, u && d("backfill:stop", { fetched: r.value.length, calls: 0, cancelled: !0 });
617
+ }
618
+ return {
619
+ loadPage: L,
620
+ loadNext: k,
621
+ refreshCurrentPage: W,
622
+ cancelLoad: o,
623
+ maybeBackfillToTarget: H,
624
+ getContent: f
625
+ };
626
+ }
627
+ function ta(e) {
628
+ const {
629
+ masonry: l,
630
+ useSwipeMode: r,
631
+ refreshLayout: t,
632
+ refreshCurrentPage: y,
633
+ loadNext: h,
634
+ maybeBackfillToTarget: m,
635
+ autoRefreshOnEmpty: i,
636
+ paginationHistory: w
637
+ } = e;
638
+ async function b(s) {
639
+ const g = l.value.filter((a) => a.id !== s.id);
640
+ if (l.value = g, await q(), g.length === 0 && w.value.length > 0) {
641
+ if (i)
642
+ await y();
643
+ else
644
+ try {
645
+ await h(), await m(0, !0);
646
+ } catch {
647
+ }
648
+ return;
649
+ }
650
+ await new Promise((a) => requestAnimationFrame(() => a())), requestAnimationFrame(() => {
651
+ t(g);
652
+ });
653
+ }
654
+ async function n(s) {
655
+ if (!s || s.length === 0) return;
656
+ const g = new Set(s.map((d) => d.id)), a = l.value.filter((d) => !g.has(d.id));
657
+ if (l.value = a, await q(), a.length === 0 && w.value.length > 0) {
658
+ if (i)
659
+ await y();
660
+ else
661
+ try {
662
+ await h(), await m(0, !0);
663
+ } catch {
664
+ }
665
+ return;
666
+ }
667
+ await new Promise((d) => requestAnimationFrame(() => d())), requestAnimationFrame(() => {
668
+ t(a);
669
+ });
670
+ }
671
+ async function p(s, g) {
672
+ if (!s) return;
673
+ const a = l.value;
674
+ if (a.findIndex((P) => P.id === s.id) !== -1) return;
675
+ const v = [...a], T = Math.min(g, v.length);
676
+ v.splice(T, 0, s), l.value = v, await q(), r.value || (await new Promise((P) => requestAnimationFrame(() => P())), requestAnimationFrame(() => {
677
+ t(v);
678
+ }));
679
+ }
680
+ async function x(s, g) {
681
+ var L;
682
+ if (!s || s.length === 0) return;
683
+ if (!g || g.length !== s.length) {
684
+ console.warn("[Masonry] restoreMany: items and indices arrays must have the same length");
685
+ return;
686
+ }
687
+ const a = l.value, d = new Set(a.map((k) => k.id)), v = [];
688
+ for (let k = 0; k < s.length; k++)
689
+ d.has((L = s[k]) == null ? void 0 : L.id) || v.push({ item: s[k], index: g[k] });
690
+ if (v.length === 0) return;
691
+ const T = /* @__PURE__ */ new Map();
692
+ for (const { item: k, index: W } of v)
693
+ T.set(W, k);
694
+ const P = v.length > 0 ? Math.max(...v.map(({ index: k }) => k)) : -1, I = Math.max(a.length - 1, P), f = [];
695
+ let H = 0;
696
+ for (let k = 0; k <= I; k++)
697
+ T.has(k) ? f.push(T.get(k)) : H < a.length && (f.push(a[H]), H++);
698
+ for (; H < a.length; )
699
+ f.push(a[H]), H++;
700
+ l.value = f, await q(), r.value || (await new Promise((k) => requestAnimationFrame(() => k())), requestAnimationFrame(() => {
701
+ t(f);
702
+ }));
703
+ }
704
+ async function M() {
705
+ l.value = [];
706
+ }
707
+ return {
708
+ remove: b,
709
+ removeMany: n,
710
+ restore: p,
711
+ restoreMany: x,
712
+ removeAll: M
713
+ };
714
+ }
715
+ function aa(e) {
716
+ const {
717
+ masonry: l,
718
+ useSwipeMode: r,
719
+ container: t,
720
+ columns: y,
721
+ containerWidth: h,
722
+ masonryContentHeight: m,
723
+ layout: i,
724
+ fixedDimensions: w,
725
+ checkItemDimensions: b
726
+ } = e;
727
+ let n = [];
728
+ function p(g) {
729
+ const a = Xt(g);
730
+ let d = 0;
731
+ if (t.value) {
732
+ const { scrollTop: v, clientHeight: T } = t.value;
733
+ d = v + T + 100;
734
+ }
735
+ m.value = Math.max(a, d);
736
+ }
737
+ function x(g) {
738
+ var T, P;
739
+ if (r.value) {
740
+ l.value = g;
741
+ return;
742
+ }
743
+ if (!t.value) return;
744
+ if (b(g, "refreshLayout"), g.length > 1e3 && n.length > g.length && n.length - g.length < 100) {
745
+ let I = !0;
746
+ for (let f = 0; f < g.length; f++)
747
+ if (((T = g[f]) == null ? void 0 : T.id) !== ((P = n[f]) == null ? void 0 : P.id)) {
748
+ I = !1;
749
+ break;
750
+ }
751
+ if (I) {
752
+ const f = g.map((H, L) => ({
753
+ ...n[L],
754
+ originalIndex: L
755
+ }));
756
+ p(f), l.value = f, n = f;
757
+ return;
758
+ }
759
+ }
760
+ const d = g.map((I, f) => ({
761
+ ...I,
762
+ originalIndex: f
763
+ })), v = t.value;
764
+ if (w.value && w.value.width !== void 0) {
765
+ const I = v.style.width, f = v.style.boxSizing;
766
+ v.style.boxSizing = "border-box", v.style.width = `${w.value.width}px`, v.offsetWidth;
767
+ const H = Ye(d, v, y.value, i.value);
768
+ v.style.width = I, v.style.boxSizing = f, p(H), l.value = H, n = H;
769
+ } else {
770
+ const I = Ye(d, v, y.value, i.value);
771
+ p(I), l.value = I, n = I;
772
+ }
773
+ }
774
+ function M(g, a) {
775
+ w.value = g, g && (g.width !== void 0 && (h.value = g.width), !r.value && t.value && l.value.length > 0 && q(() => {
776
+ y.value = ue(i.value, h.value), x(l.value), a && a();
777
+ }));
778
+ }
779
+ function s() {
780
+ y.value = ue(i.value, h.value), x(l.value);
781
+ }
782
+ return {
783
+ refreshLayout: x,
784
+ setFixedDimensions: M,
785
+ onResize: s,
786
+ calculateHeight: p
787
+ };
788
+ }
789
+ function na(e) {
790
+ const {
791
+ masonry: l,
792
+ container: r,
793
+ columns: t,
794
+ virtualBufferPx: y,
795
+ loadThresholdPx: h
796
+ } = e, m = D(e.handleScroll), i = D(0), w = D(0), b = y, n = D(!1), p = D({
797
+ distanceToTrigger: 0,
798
+ isNearTrigger: !1
799
+ }), x = Q(() => {
800
+ const a = i.value - b, d = i.value + w.value + b, v = l.value;
801
+ return !v || v.length === 0 ? [] : v.filter((P) => {
802
+ if (typeof P.top != "number" || typeof P.columnHeight != "number")
803
+ return !0;
804
+ const I = P.top;
805
+ return P.top + P.columnHeight >= a && I <= d;
806
+ });
807
+ });
808
+ function M(a) {
809
+ if (!r.value) return;
810
+ const { scrollTop: d, clientHeight: v } = r.value, T = d + v, P = a ?? De(l.value, t.value), I = P.length ? Math.max(...P) : 0, f = typeof h == "number" ? h : 200, H = f >= 0 ? Math.max(0, I - f) : Math.max(0, I + f), L = Math.max(0, H - T), k = L <= 100;
811
+ p.value = {
812
+ distanceToTrigger: Math.round(L),
813
+ isNearTrigger: k
814
+ };
815
+ }
816
+ async function s() {
817
+ if (r.value) {
818
+ const d = r.value.scrollTop, v = r.value.clientHeight || window.innerHeight, T = v > 0 ? v : window.innerHeight;
819
+ i.value = d, w.value = T;
820
+ }
821
+ n.value = !0, await q(), await new Promise((d) => requestAnimationFrame(() => d())), n.value = !1;
822
+ const a = De(l.value, t.value);
823
+ m.value(a), M(a);
824
+ }
825
+ function g() {
826
+ i.value = 0, w.value = 0, n.value = !1, p.value = {
827
+ distanceToTrigger: 0,
828
+ isNearTrigger: !1
829
+ };
830
+ }
831
+ return {
832
+ viewportTop: i,
833
+ viewportHeight: w,
834
+ virtualizing: n,
835
+ scrollProgress: p,
836
+ visibleMasonry: x,
837
+ updateScrollProgress: M,
838
+ updateViewport: s,
839
+ reset: g,
840
+ handleScroll: m
430
841
  };
431
842
  }
432
- const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm transition-all duration-300 bg-white relative" }, ca = {
843
+ function la(e) {
844
+ const { masonry: l } = e, r = D(/* @__PURE__ */ new Set());
845
+ function t(m) {
846
+ return typeof m == "number" && m > 0 && Number.isFinite(m);
847
+ }
848
+ function y(m, i) {
849
+ try {
850
+ if (!Array.isArray(m) || m.length === 0) return;
851
+ const w = m.filter((n) => !t(n == null ? void 0 : n.width) || !t(n == null ? void 0 : n.height));
852
+ if (w.length === 0) return;
853
+ const b = [];
854
+ for (const n of w) {
855
+ const p = (n == null ? void 0 : n.id) ?? `idx:${l.value.indexOf(n)}`;
856
+ r.value.has(p) || (r.value.add(p), b.push(p));
857
+ }
858
+ if (b.length > 0) {
859
+ const n = b.slice(0, 10);
860
+ console.warn(
861
+ "[Masonry] Items missing width/height detected:",
862
+ {
863
+ context: i,
864
+ count: b.length,
865
+ sampleIds: n,
866
+ hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
867
+ }
868
+ );
869
+ }
870
+ } catch {
871
+ }
872
+ }
873
+ function h() {
874
+ r.value.clear();
875
+ }
876
+ return {
877
+ checkItemDimensions: y,
878
+ invalidDimensionIds: r,
879
+ reset: h
880
+ };
881
+ }
882
+ const oa = { class: "flex-1 relative min-h-0" }, ra = { class: "w-full h-full rounded-xl overflow-hidden shadow-sm transition-all duration-300 bg-white relative" }, ia = {
433
883
  key: 0,
434
884
  class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-100 text-slate-400 text-sm p-4 text-center"
435
- }, va = {
885
+ }, sa = {
436
886
  key: 1,
437
887
  class: "relative w-full h-full"
438
- }, fa = ["src"], da = ["src", "autoplay", "controls"], ha = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, ma = {
888
+ }, ua = ["src"], ca = ["src", "autoplay", "controls"], va = { class: "w-12 h-12 rounded-full bg-white/80 backdrop-blur-sm flex items-center justify-center shadow-sm" }, fa = {
439
889
  key: 3,
440
890
  class: "absolute bottom-2 left-1/2 transform -translate-x-1/2 flex items-center justify-center z-10"
441
- }, ga = {
891
+ }, da = {
442
892
  key: 4,
443
893
  class: "absolute inset-0 flex flex-col items-center justify-center bg-slate-50 text-slate-400 text-sm p-4 text-center"
444
- }, Ne = /* @__PURE__ */ ft({
894
+ }, be = /* @__PURE__ */ Ke({
445
895
  __name: "MasonryItem",
446
896
  props: {
447
897
  item: {},
@@ -454,282 +904,278 @@ const sa = { class: "flex-1 relative min-h-0" }, ua = { class: "w-full h-full ro
454
904
  inSwipeMode: { type: Boolean, default: !1 }
455
905
  },
456
906
  emits: ["preload:success", "preload:error", "mouse-enter", "mouse-leave"],
457
- setup(t, { emit: c }) {
458
- const v = t, r = c, E = H(!1), w = H(!1), y = H(null), f = H(!1), x = H(!1), M = H(null), s = H(!1), T = H(!1), p = H(!1), b = H(null), i = H(null);
459
- let L = null;
460
- const l = ae(() => {
461
- var a;
462
- return v.type ?? ((a = v.item) == null ? void 0 : a.type) ?? "image";
463
- }), h = ae(() => {
464
- var a;
465
- return v.notFound ?? ((a = v.item) == null ? void 0 : a.notFound) ?? !1;
466
- }), k = ae(() => !!v.inSwipeMode);
467
- function P(a) {
468
- r("mouse-enter", { item: v.item, type: a });
907
+ setup(e, { emit: l }) {
908
+ const r = e, t = l, y = D(!1), h = D(!1), m = D(null), i = D(!1), w = D(!1), b = D(null), n = D(!1), p = D(!1), x = D(!1), M = D(null), s = D(null);
909
+ let g = null;
910
+ const a = Q(() => {
911
+ var o;
912
+ return r.type ?? ((o = r.item) == null ? void 0 : o.type) ?? "image";
913
+ }), d = Q(() => {
914
+ var o;
915
+ return r.notFound ?? ((o = r.item) == null ? void 0 : o.notFound) ?? !1;
916
+ }), v = Q(() => !!r.inSwipeMode);
917
+ function T(o) {
918
+ t("mouse-enter", { item: r.item, type: o });
469
919
  }
470
- function W(a) {
471
- r("mouse-leave", { item: v.item, type: a });
920
+ function P(o) {
921
+ t("mouse-leave", { item: r.item, type: o });
472
922
  }
473
- function I(a) {
474
- if (k.value) return;
475
- const d = a.target;
476
- d && (d.paused ? d.play() : d.pause());
923
+ function I(o) {
924
+ if (v.value) return;
925
+ const u = o.target;
926
+ u && (u.paused ? u.play() : u.pause());
477
927
  }
478
- function m(a) {
479
- const d = a.target;
480
- d && (k.value || d.play(), P("video"));
928
+ function f(o) {
929
+ const u = o.target;
930
+ u && (v.value || u.play(), T("video"));
481
931
  }
482
- function z(a) {
483
- const d = a.target;
484
- d && (k.value || d.pause(), W("video"));
932
+ function H(o) {
933
+ const u = o.target;
934
+ u && (v.value || u.pause(), P("video"));
485
935
  }
486
- function $(a) {
487
- return new Promise((d, _) => {
488
- if (!a) {
489
- const A = new Error("No image source provided");
490
- r("preload:error", { item: v.item, type: "image", src: a, error: A }), _(A);
936
+ function L(o) {
937
+ return new Promise((u, E) => {
938
+ if (!o) {
939
+ const N = new Error("No image source provided");
940
+ t("preload:error", { item: r.item, type: "image", src: o, error: N }), E(N);
491
941
  return;
492
942
  }
493
- const D = new Image(), ne = Date.now(), X = 300;
494
- D.onload = () => {
495
- const A = Date.now() - ne, ue = Math.max(0, X - A);
943
+ const $ = new Image(), C = Date.now(), F = 300;
944
+ $.onload = () => {
945
+ const N = Date.now() - C, j = Math.max(0, F - N);
496
946
  setTimeout(async () => {
497
- E.value = !0, w.value = !1, T.value = !1, await U(), await new Promise((ce) => setTimeout(ce, 100)), p.value = !0, r("preload:success", { item: v.item, type: "image", src: a }), d();
498
- }, ue);
499
- }, D.onerror = () => {
500
- w.value = !0, E.value = !1, T.value = !1;
501
- const A = new Error("Failed to load image");
502
- r("preload:error", { item: v.item, type: "image", src: a, error: A }), _(A);
503
- }, D.src = a;
947
+ y.value = !0, h.value = !1, p.value = !1, await q(), await new Promise((X) => setTimeout(X, 100)), x.value = !0, t("preload:success", { item: r.item, type: "image", src: o }), u();
948
+ }, j);
949
+ }, $.onerror = () => {
950
+ h.value = !0, y.value = !1, p.value = !1;
951
+ const N = new Error("Failed to load image");
952
+ t("preload:error", { item: r.item, type: "image", src: o, error: N }), E(N);
953
+ }, $.src = o;
504
954
  });
505
955
  }
506
- function C(a) {
507
- return new Promise((d, _) => {
508
- if (!a) {
509
- const A = new Error("No video source provided");
510
- r("preload:error", { item: v.item, type: "video", src: a, error: A }), _(A);
956
+ function k(o) {
957
+ return new Promise((u, E) => {
958
+ if (!o) {
959
+ const N = new Error("No video source provided");
960
+ t("preload:error", { item: r.item, type: "video", src: o, error: N }), E(N);
511
961
  return;
512
962
  }
513
- const D = document.createElement("video"), ne = Date.now(), X = 300;
514
- D.preload = "metadata", D.muted = !0, D.onloadedmetadata = () => {
515
- const A = Date.now() - ne, ue = Math.max(0, X - A);
963
+ const $ = document.createElement("video"), C = Date.now(), F = 300;
964
+ $.preload = "metadata", $.muted = !0, $.onloadedmetadata = () => {
965
+ const N = Date.now() - C, j = Math.max(0, F - N);
516
966
  setTimeout(async () => {
517
- f.value = !0, x.value = !1, T.value = !1, await U(), await new Promise((ce) => setTimeout(ce, 100)), p.value = !0, r("preload:success", { item: v.item, type: "video", src: a }), d();
518
- }, ue);
519
- }, D.onerror = () => {
520
- x.value = !0, f.value = !1, T.value = !1;
521
- const A = new Error("Failed to load video");
522
- r("preload:error", { item: v.item, type: "video", src: a, error: A }), _(A);
523
- }, D.src = a;
967
+ i.value = !0, w.value = !1, p.value = !1, await q(), await new Promise((X) => setTimeout(X, 100)), x.value = !0, t("preload:success", { item: r.item, type: "video", src: o }), u();
968
+ }, j);
969
+ }, $.onerror = () => {
970
+ w.value = !0, i.value = !1, p.value = !1;
971
+ const N = new Error("Failed to load video");
972
+ t("preload:error", { item: r.item, type: "video", src: o, error: N }), E(N);
973
+ }, $.src = o;
524
974
  });
525
975
  }
526
- async function B() {
527
- var d;
528
- if (!s.value || T.value || h.value || l.value === "video" && f.value || l.value === "image" && E.value)
976
+ async function W() {
977
+ var u;
978
+ if (!n.value || p.value || d.value || a.value === "video" && i.value || a.value === "image" && y.value)
529
979
  return;
530
- const a = (d = v.item) == null ? void 0 : d.src;
531
- if (a)
532
- if (T.value = !0, p.value = !1, l.value === "video") {
533
- M.value = a, f.value = !1, x.value = !1;
980
+ const o = (u = r.item) == null ? void 0 : u.src;
981
+ if (o)
982
+ if (p.value = !0, x.value = !1, a.value === "video") {
983
+ b.value = o, i.value = !1, w.value = !1;
534
984
  try {
535
- await C(a);
985
+ await k(o);
536
986
  } catch {
537
987
  }
538
988
  } else {
539
- y.value = a, E.value = !1, w.value = !1;
989
+ m.value = o, y.value = !1, h.value = !1;
540
990
  try {
541
- await $(a);
991
+ await L(o);
542
992
  } catch {
543
993
  }
544
994
  }
545
995
  }
546
- return dt(() => {
547
- b.value && (L = new IntersectionObserver(
548
- (a) => {
549
- a.forEach((d) => {
550
- d.isIntersecting && d.intersectionRatio >= 1 ? s.value || (s.value = !0, B()) : d.isIntersecting;
996
+ return Qe(() => {
997
+ M.value && (g = new IntersectionObserver(
998
+ (o) => {
999
+ o.forEach((u) => {
1000
+ u.isIntersecting && u.intersectionRatio >= 1 ? n.value || (n.value = !0, W()) : u.isIntersecting;
551
1001
  });
552
1002
  },
553
1003
  {
554
1004
  // Only trigger when item is 100% visible (full height in view)
555
1005
  threshold: [1]
556
1006
  }
557
- ), L.observe(b.value));
558
- }), ht(() => {
559
- L && (L.disconnect(), L = null);
560
- }), se(
1007
+ ), g.observe(M.value));
1008
+ }), Ze(() => {
1009
+ g && (g.disconnect(), g = null);
1010
+ }), ee(
561
1011
  () => {
562
- var a;
563
- return (a = v.item) == null ? void 0 : a.src;
1012
+ var o;
1013
+ return (o = r.item) == null ? void 0 : o.src;
564
1014
  },
565
- async (a) => {
566
- if (!(!a || h.value)) {
567
- if (l.value === "video") {
568
- if (a !== M.value && (f.value = !1, x.value = !1, M.value = a, s.value)) {
569
- T.value = !0;
1015
+ async (o) => {
1016
+ if (!(!o || d.value)) {
1017
+ if (a.value === "video") {
1018
+ if (o !== b.value && (i.value = !1, w.value = !1, b.value = o, n.value)) {
1019
+ p.value = !0;
570
1020
  try {
571
- await C(a);
1021
+ await k(o);
572
1022
  } catch {
573
1023
  }
574
1024
  }
575
- } else if (a !== y.value && (E.value = !1, w.value = !1, y.value = a, s.value)) {
576
- T.value = !0;
1025
+ } else if (o !== m.value && (y.value = !1, h.value = !1, m.value = o, n.value)) {
1026
+ p.value = !0;
577
1027
  try {
578
- await $(a);
1028
+ await L(o);
579
1029
  } catch {
580
1030
  }
581
1031
  }
582
1032
  }
583
1033
  }
584
- ), se(
585
- () => v.isActive,
586
- (a) => {
587
- !k.value || !i.value || (a ? i.value.play() : i.value.pause());
1034
+ ), ee(
1035
+ () => r.isActive,
1036
+ (o) => {
1037
+ !v.value || !s.value || (o ? s.value.play() : s.value.pause());
588
1038
  }
589
- ), (a, d) => (j(), R("div", {
1039
+ ), (o, u) => (O(), R("div", {
590
1040
  ref_key: "containerRef",
591
- ref: b,
1041
+ ref: M,
592
1042
  class: "relative w-full h-full flex flex-col"
593
1043
  }, [
594
- a.headerHeight > 0 ? (j(), R("div", {
1044
+ o.headerHeight > 0 ? (O(), R("div", {
595
1045
  key: 0,
596
1046
  class: "relative z-10",
597
- style: He({ height: `${a.headerHeight}px` })
1047
+ style: ge({ height: `${o.headerHeight}px` })
598
1048
  }, [
599
- K(a.$slots, "header", {
600
- item: a.item,
601
- remove: a.remove,
602
- imageLoaded: E.value,
603
- imageError: w.value,
604
- videoLoaded: f.value,
605
- videoError: x.value,
606
- showNotFound: h.value,
607
- isLoading: T.value,
608
- mediaType: l.value
1049
+ _(o.$slots, "header", {
1050
+ item: o.item,
1051
+ remove: o.remove,
1052
+ imageLoaded: y.value,
1053
+ imageError: h.value,
1054
+ videoLoaded: i.value,
1055
+ videoError: w.value,
1056
+ showNotFound: d.value,
1057
+ isLoading: p.value,
1058
+ mediaType: a.value
609
1059
  })
610
- ], 4)) : ie("", !0),
611
- q("div", sa, [
612
- K(a.$slots, "default", {
613
- item: a.item,
614
- remove: a.remove,
615
- imageLoaded: E.value,
616
- imageError: w.value,
617
- videoLoaded: f.value,
618
- videoError: x.value,
619
- showNotFound: h.value,
620
- isLoading: T.value,
621
- mediaType: l.value,
622
- imageSrc: y.value,
623
- videoSrc: M.value,
624
- showMedia: p.value
1060
+ ], 4)) : te("", !0),
1061
+ V("div", oa, [
1062
+ _(o.$slots, "default", {
1063
+ item: o.item,
1064
+ remove: o.remove,
1065
+ imageLoaded: y.value,
1066
+ imageError: h.value,
1067
+ videoLoaded: i.value,
1068
+ videoError: w.value,
1069
+ showNotFound: d.value,
1070
+ isLoading: p.value,
1071
+ mediaType: a.value,
1072
+ imageSrc: m.value,
1073
+ videoSrc: b.value,
1074
+ showMedia: x.value
625
1075
  }, () => [
626
- q("div", ua, [
627
- h.value ? (j(), R("div", ca, d[3] || (d[3] = [
628
- q("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
629
- q("span", { class: "font-medium" }, "Not Found", -1),
630
- q("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
631
- ]))) : (j(), R("div", va, [
632
- l.value === "image" && y.value ? (j(), R("img", {
1076
+ V("div", ra, [
1077
+ d.value ? (O(), R("div", ia, u[3] || (u[3] = [
1078
+ V("i", { class: "fas fa-search text-3xl mb-3 opacity-50" }, null, -1),
1079
+ V("span", { class: "font-medium" }, "Not Found", -1),
1080
+ V("span", { class: "text-xs mt-1 opacity-75" }, "This item could not be located", -1)
1081
+ ]))) : (O(), R("div", sa, [
1082
+ a.value === "image" && m.value ? (O(), R("img", {
633
1083
  key: 0,
634
- src: y.value,
635
- class: me([
1084
+ src: m.value,
1085
+ class: re([
636
1086
  "w-full h-full object-cover transition-opacity duration-700 ease-in-out",
637
- E.value && p.value ? "opacity-100" : "opacity-0"
1087
+ y.value && x.value ? "opacity-100" : "opacity-0"
638
1088
  ]),
639
1089
  style: { position: "absolute", top: "0", left: "0" },
640
1090
  loading: "lazy",
641
1091
  decoding: "async",
642
1092
  alt: "",
643
- onMouseenter: d[0] || (d[0] = (_) => P("image")),
644
- onMouseleave: d[1] || (d[1] = (_) => W("image"))
645
- }, null, 42, fa)) : ie("", !0),
646
- l.value === "video" && M.value ? (j(), R("video", {
1093
+ onMouseenter: u[0] || (u[0] = (E) => T("image")),
1094
+ onMouseleave: u[1] || (u[1] = (E) => P("image"))
1095
+ }, null, 42, ua)) : te("", !0),
1096
+ a.value === "video" && b.value ? (O(), R("video", {
647
1097
  key: 1,
648
1098
  ref_key: "videoEl",
649
- ref: i,
650
- src: M.value,
651
- class: me([
1099
+ ref: s,
1100
+ src: b.value,
1101
+ class: re([
652
1102
  "w-full h-full object-cover transition-opacity duration-700 ease-in-out",
653
- f.value && p.value ? "opacity-100" : "opacity-0"
1103
+ i.value && x.value ? "opacity-100" : "opacity-0"
654
1104
  ]),
655
1105
  style: { position: "absolute", top: "0", left: "0" },
656
1106
  muted: "",
657
1107
  loop: "",
658
1108
  playsinline: "",
659
- autoplay: k.value && v.isActive,
660
- controls: k.value,
661
- onClick: nt(I, ["stop"]),
662
- onTouchend: nt(I, ["stop", "prevent"]),
663
- onMouseenter: m,
664
- onMouseleave: z,
665
- onError: d[2] || (d[2] = (_) => x.value = !0)
666
- }, null, 42, da)) : ie("", !0),
667
- !E.value && !f.value && !w.value && !x.value ? (j(), R("div", {
1109
+ autoplay: v.value && r.isActive,
1110
+ controls: v.value,
1111
+ onClick: je(I, ["stop"]),
1112
+ onTouchend: je(I, ["stop", "prevent"]),
1113
+ onMouseenter: f,
1114
+ onMouseleave: H,
1115
+ onError: u[2] || (u[2] = (E) => w.value = !0)
1116
+ }, null, 42, ca)) : te("", !0),
1117
+ !y.value && !i.value && !h.value && !w.value ? (O(), R("div", {
668
1118
  key: 2,
669
- class: me([
1119
+ class: re([
670
1120
  "absolute inset-0 bg-slate-100 flex items-center justify-center transition-opacity duration-500",
671
- p.value ? "opacity-0 pointer-events-none" : "opacity-100"
1121
+ x.value ? "opacity-0 pointer-events-none" : "opacity-100"
672
1122
  ])
673
1123
  }, [
674
- q("div", ha, [
675
- K(a.$slots, "placeholder-icon", { mediaType: l.value }, () => [
676
- q("i", {
677
- class: me(l.value === "video" ? "fas fa-video text-xl text-slate-400" : "fas fa-image text-xl text-slate-400")
1124
+ V("div", va, [
1125
+ _(o.$slots, "placeholder-icon", { mediaType: a.value }, () => [
1126
+ V("i", {
1127
+ class: re(a.value === "video" ? "fas fa-video text-xl text-slate-400" : "fas fa-image text-xl text-slate-400")
678
1128
  }, null, 2)
679
1129
  ])
680
1130
  ])
681
- ], 2)) : ie("", !0),
682
- T.value ? (j(), R("div", ma, d[4] || (d[4] = [
683
- q("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
684
- q("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
1131
+ ], 2)) : te("", !0),
1132
+ p.value ? (O(), R("div", fa, u[4] || (u[4] = [
1133
+ V("div", { class: "bg-white/90 backdrop-blur-sm rounded-full px-3 py-1.5 shadow-sm" }, [
1134
+ V("div", { class: "animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500" })
685
1135
  ], -1)
686
- ]))) : ie("", !0),
687
- l.value === "image" && w.value || l.value === "video" && x.value ? (j(), R("div", ga, [
688
- q("i", {
689
- class: me(l.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
1136
+ ]))) : te("", !0),
1137
+ a.value === "image" && h.value || a.value === "video" && w.value ? (O(), R("div", da, [
1138
+ V("i", {
1139
+ class: re(a.value === "video" ? "fas fa-video text-2xl mb-2 opacity-50" : "fas fa-image text-2xl mb-2 opacity-50")
690
1140
  }, null, 2),
691
- q("span", null, "Failed to load " + qe(l.value), 1)
692
- ])) : ie("", !0)
1141
+ V("span", null, "Failed to load " + $e(a.value), 1)
1142
+ ])) : te("", !0)
693
1143
  ]))
694
1144
  ])
695
1145
  ])
696
1146
  ]),
697
- a.footerHeight > 0 ? (j(), R("div", {
1147
+ o.footerHeight > 0 ? (O(), R("div", {
698
1148
  key: 1,
699
1149
  class: "relative z-10",
700
- style: He({ height: `${a.footerHeight}px` })
1150
+ style: ge({ height: `${o.footerHeight}px` })
701
1151
  }, [
702
- K(a.$slots, "footer", {
703
- item: a.item,
704
- remove: a.remove,
705
- imageLoaded: E.value,
706
- imageError: w.value,
707
- videoLoaded: f.value,
708
- videoError: x.value,
709
- showNotFound: h.value,
710
- isLoading: T.value,
711
- mediaType: l.value
1152
+ _(o.$slots, "footer", {
1153
+ item: o.item,
1154
+ remove: o.remove,
1155
+ imageLoaded: y.value,
1156
+ imageError: h.value,
1157
+ videoLoaded: i.value,
1158
+ videoError: w.value,
1159
+ showNotFound: d.value,
1160
+ isLoading: p.value,
1161
+ mediaType: a.value
712
1162
  })
713
- ], 4)) : ie("", !0)
1163
+ ], 4)) : te("", !0)
714
1164
  ], 512));
715
1165
  }
716
- });
717
- function ke(t) {
718
- return t instanceof Error ? t : new Error(String(t));
719
- }
720
- const pa = { class: "w-full h-full flex items-center justify-center p-4" }, ya = { class: "w-full h-full max-w-full max-h-full relative" }, wa = {
1166
+ }), ma = { class: "w-full h-full flex items-center justify-center p-4" }, ha = { class: "w-full h-full max-w-full max-h-full relative" }, ga = {
721
1167
  key: 0,
722
1168
  class: "w-full py-8 text-center"
723
- }, xa = {
1169
+ }, pa = {
724
1170
  key: 1,
725
1171
  class: "w-full py-8 text-center"
726
- }, ba = { class: "text-red-500 dark:text-red-400" }, Ma = {
1172
+ }, ya = { class: "text-red-500 dark:text-red-400" }, wa = {
727
1173
  key: 0,
728
1174
  class: "w-full py-8 text-center"
729
- }, Ta = {
1175
+ }, xa = {
730
1176
  key: 1,
731
1177
  class: "w-full py-8 text-center"
732
- }, Ia = { class: "text-red-500 dark:text-red-400" }, Ea = /* @__PURE__ */ ft({
1178
+ }, ba = { class: "text-red-500 dark:text-red-400" }, Ma = /* @__PURE__ */ Ke({
733
1179
  __name: "Masonry",
734
1180
  props: {
735
1181
  getNextPage: {
@@ -752,12 +1198,21 @@ const pa = { class: "w-full h-full flex items-center justify-center p-4" }, ya =
752
1198
  type: String,
753
1199
  default: "page",
754
1200
  // or 'cursor'
755
- validator: (t) => ["page", "cursor"].includes(t)
1201
+ validator: (e) => ["page", "cursor"].includes(e)
756
1202
  },
757
1203
  skipInitialLoad: {
758
1204
  type: Boolean,
759
1205
  default: !1
760
1206
  },
1207
+ // Initial pagination state when skipInitialLoad is true and items are provided
1208
+ initialPage: {
1209
+ type: [Number, String],
1210
+ default: null
1211
+ },
1212
+ initialNextPage: {
1213
+ type: [Number, String],
1214
+ default: null
1215
+ },
761
1216
  pageSize: {
762
1217
  type: Number,
763
1218
  default: 40
@@ -822,7 +1277,7 @@ const pa = { class: "w-full h-full flex items-center justify-center p-4" }, ya =
822
1277
  layoutMode: {
823
1278
  type: String,
824
1279
  default: "auto",
825
- validator: (t) => ["auto", "masonry", "swipe"].includes(t)
1280
+ validator: (e) => ["auto", "masonry", "swipe"].includes(e)
826
1281
  },
827
1282
  // Breakpoint for switching to swipe mode (in pixels or Tailwind breakpoint name)
828
1283
  mobileBreakpoint: {
@@ -847,8 +1302,8 @@ const pa = { class: "w-full h-full flex items-center justify-center p-4" }, ya =
847
1302
  "item:mouse-enter",
848
1303
  "item:mouse-leave"
849
1304
  ],
850
- setup(t, { expose: c, emit: v }) {
851
- const r = t, E = {
1305
+ setup(e, { expose: l, emit: r }) {
1306
+ const t = e, y = {
852
1307
  sizes: { base: 1, sm: 2, md: 3, lg: 4, xl: 5, "2xl": 6 },
853
1308
  gutterX: 10,
854
1309
  gutterY: 10,
@@ -857,690 +1312,406 @@ const pa = { class: "w-full h-full flex items-center justify-center p-4" }, ya =
857
1312
  paddingLeft: 0,
858
1313
  paddingRight: 0,
859
1314
  placement: "masonry"
860
- }, w = ae(() => {
861
- var e;
1315
+ }, h = Q(() => {
1316
+ var c;
862
1317
  return {
863
- ...E,
864
- ...r.layout,
1318
+ ...y,
1319
+ ...t.layout,
865
1320
  sizes: {
866
- ...E.sizes,
867
- ...((e = r.layout) == null ? void 0 : e.sizes) || {}
1321
+ ...y.sizes,
1322
+ ...((c = t.layout) == null ? void 0 : c.sizes) || {}
868
1323
  }
869
1324
  };
870
- }), y = H(null), f = H(typeof window < "u" ? window.innerWidth : 1024), x = H(typeof window < "u" ? window.innerHeight : 768), M = H(null);
871
- let s = null;
872
- function T(e) {
1325
+ }), m = D(null), i = D(typeof window < "u" ? window.innerWidth : 1024), w = D(typeof window < "u" ? window.innerHeight : 768), b = D(null);
1326
+ let n = null;
1327
+ function p(c) {
873
1328
  return {
874
1329
  sm: 640,
875
1330
  md: 768,
876
1331
  lg: 1024,
877
1332
  xl: 1280,
878
1333
  "2xl": 1536
879
- }[e] || 768;
880
- }
881
- const p = ae(() => {
882
- if (r.layoutMode === "masonry") return !1;
883
- if (r.layoutMode === "swipe") return !0;
884
- const e = typeof r.mobileBreakpoint == "string" ? T(r.mobileBreakpoint) : r.mobileBreakpoint;
885
- return f.value < e;
886
- }), b = v, i = ae({
887
- get: () => r.items,
888
- set: (e) => b("update:items", e)
889
- }), L = H(7), l = H(null), h = H([]), k = H(null), P = H(!1), W = H(0), I = H(!1), m = H(null), z = ae(() => ta(f.value)), $ = H(/* @__PURE__ */ new Set());
890
- function C(e) {
891
- return typeof e == "number" && Number.isFinite(e) && e > 0;
1334
+ }[c] || 768;
892
1335
  }
893
- function B(e, n) {
894
- try {
895
- if (!Array.isArray(e) || e.length === 0) return;
896
- const o = e.filter((u) => !C(u == null ? void 0 : u.width) || !C(u == null ? void 0 : u.height));
897
- if (o.length === 0) return;
898
- const g = [];
899
- for (const u of o) {
900
- const F = (u == null ? void 0 : u.id) ?? `idx:${e.indexOf(u)}`;
901
- $.value.has(F) || ($.value.add(F), g.push(F));
902
- }
903
- if (g.length > 0) {
904
- const u = g.slice(0, 10);
905
- console.warn(
906
- "[Masonry] Items missing width/height detected:",
907
- {
908
- context: n,
909
- count: g.length,
910
- sampleIds: u,
911
- hint: "Ensure each item has positive width and height. Consider providing fallbacks (e.g., 512x512) at the data layer."
912
- }
913
- );
914
- }
915
- } catch {
1336
+ const x = Q(() => {
1337
+ if (t.layoutMode === "masonry") return !1;
1338
+ if (t.layoutMode === "swipe") return !0;
1339
+ const c = typeof t.mobileBreakpoint == "string" ? p(t.mobileBreakpoint) : t.mobileBreakpoint;
1340
+ return i.value < c;
1341
+ }), M = r, s = Q({
1342
+ get: () => t.items,
1343
+ set: (c) => M("update:items", c)
1344
+ }), g = D(7), a = D(null), d = D([]), v = D(null), T = D(!1), P = D(0), I = D(!1), f = D(null), H = Q(() => _t(i.value)), L = la({
1345
+ masonry: s
1346
+ }), { checkItemDimensions: k, reset: W } = L, o = aa({
1347
+ masonry: s,
1348
+ useSwipeMode: x,
1349
+ container: a,
1350
+ columns: g,
1351
+ containerWidth: i,
1352
+ masonryContentHeight: P,
1353
+ layout: h,
1354
+ fixedDimensions: b,
1355
+ checkItemDimensions: k
1356
+ }), { refreshLayout: u, setFixedDimensions: E, onResize: $ } = o, C = na({
1357
+ masonry: s,
1358
+ container: a,
1359
+ columns: g,
1360
+ virtualBufferPx: t.virtualBufferPx,
1361
+ loadThresholdPx: t.loadThresholdPx,
1362
+ handleScroll: () => {
916
1363
  }
917
- }
918
- const a = H(0), d = H(0), _ = r.virtualBufferPx, D = H(!1), ne = H({
919
- distanceToTrigger: 0,
920
- isNearTrigger: !1
921
- }), X = (e) => {
922
- if (!l.value) return;
923
- const { scrollTop: n, clientHeight: o } = l.value, g = n + o, u = e ?? Ye(i.value, L.value), F = u.length ? Math.max(...u) : 0, S = typeof r.loadThresholdPx == "number" ? r.loadThresholdPx : 200, O = S >= 0 ? Math.max(0, F - S) : Math.max(0, F + S), Q = Math.max(0, O - g), re = Q <= 100;
924
- ne.value = {
925
- distanceToTrigger: Math.round(Q),
926
- isNearTrigger: re
927
- };
928
- }, { onEnter: A, onBeforeEnter: ue, onBeforeLeave: ce, onLeave: N } = oa(
929
- { container: l },
930
- { leaveDurationMs: r.leaveDurationMs }
931
- );
932
- function G(e, n) {
933
- if (D.value) {
934
- const o = parseInt(e.dataset.left || "0", 10), g = parseInt(e.dataset.top || "0", 10);
935
- e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${o}px, ${g}px, 0) scale(1)`, e.style.removeProperty("--masonry-opacity-delay"), requestAnimationFrame(() => {
936
- e.style.transition = "", n();
937
- });
938
- } else
939
- A(e, n);
940
- }
941
- function Z(e) {
942
- if (D.value) {
943
- const n = parseInt(e.dataset.left || "0", 10), o = parseInt(e.dataset.top || "0", 10);
944
- e.style.transition = "none", e.style.opacity = "1", e.style.transform = `translate3d(${n}px, ${o}px, 0) scale(1)`, e.style.removeProperty("--masonry-opacity-delay");
945
- } else
946
- ue(e);
947
- }
948
- function ve(e) {
949
- D.value || ce(e);
950
- }
951
- function ee(e, n) {
952
- D.value ? n() : N(e, n);
953
- }
954
- const ge = ae(() => {
955
- const e = a.value - _, n = a.value + d.value + _, o = i.value;
956
- return !o || o.length === 0 ? [] : o.filter((u) => {
957
- if (typeof u.top != "number" || typeof u.columnHeight != "number")
958
- return !0;
959
- const F = u.top;
960
- return u.top + u.columnHeight >= e && F <= n;
961
- });
962
- }), { handleScroll: le } = ra({
963
- container: l,
964
- masonry: i,
965
- columns: L,
966
- containerHeight: W,
967
- isLoading: P,
968
- pageSize: r.pageSize,
969
- refreshLayout: J,
970
- setItemsRaw: (e) => {
971
- i.value = e;
1364
+ // Will be set after pagination is initialized
1365
+ }), { viewportTop: F, viewportHeight: N, virtualizing: j, visibleMasonry: X, updateScrollProgress: z, updateViewport: Y, reset: G } = C, { onEnter: ne, onBeforeEnter: J, onBeforeLeave: ie, onLeave: Z } = Kt(
1366
+ { container: a },
1367
+ { leaveDurationMs: t.leaveDurationMs, virtualizing: j }
1368
+ ), at = ne, nt = J, lt = ie, ot = Z, rt = ea({
1369
+ getNextPage: t.getNextPage,
1370
+ masonry: s,
1371
+ isLoading: T,
1372
+ hasReachedEnd: I,
1373
+ loadError: f,
1374
+ currentPage: v,
1375
+ paginationHistory: d,
1376
+ refreshLayout: u,
1377
+ retryMaxAttempts: t.retryMaxAttempts,
1378
+ retryInitialDelayMs: t.retryInitialDelayMs,
1379
+ retryBackoffStepMs: t.retryBackoffStepMs,
1380
+ backfillEnabled: t.backfillEnabled,
1381
+ backfillDelayMs: t.backfillDelayMs,
1382
+ backfillMaxCalls: t.backfillMaxCalls,
1383
+ pageSize: t.pageSize,
1384
+ autoRefreshOnEmpty: t.autoRefreshOnEmpty,
1385
+ emits: M
1386
+ }), { loadPage: Me, loadNext: pe, refreshCurrentPage: ze, cancelLoad: Te, maybeBackfillToTarget: it } = rt, K = Zt({
1387
+ useSwipeMode: x,
1388
+ masonry: s,
1389
+ isLoading: T,
1390
+ loadNext: pe,
1391
+ loadPage: Me,
1392
+ paginationHistory: d
1393
+ }), { handleScroll: st } = Qt({
1394
+ container: a,
1395
+ masonry: s,
1396
+ columns: g,
1397
+ containerHeight: P,
1398
+ isLoading: T,
1399
+ pageSize: t.pageSize,
1400
+ refreshLayout: u,
1401
+ setItemsRaw: (c) => {
1402
+ s.value = c;
972
1403
  },
973
- loadNext: xe,
974
- loadThresholdPx: r.loadThresholdPx
1404
+ loadNext: pe,
1405
+ loadThresholdPx: t.loadThresholdPx
975
1406
  });
976
- function pt(e) {
977
- M.value = e, e ? (e.width !== void 0 && (f.value = e.width), e.height !== void 0 && (x.value = e.height), !p.value && l.value && i.value.length > 0 && U(() => {
978
- L.value = we(w.value, f.value), J(i.value), X();
979
- })) : y.value && (f.value = y.value.clientWidth, x.value = y.value.clientHeight);
1407
+ C.handleScroll.value = st;
1408
+ const ut = ta({
1409
+ masonry: s,
1410
+ useSwipeMode: x,
1411
+ refreshLayout: u,
1412
+ refreshCurrentPage: ze,
1413
+ loadNext: pe,
1414
+ maybeBackfillToTarget: it,
1415
+ autoRefreshOnEmpty: t.autoRefreshOnEmpty,
1416
+ paginationHistory: d
1417
+ }), { remove: ce, removeMany: ct, restore: vt, restoreMany: ft, removeAll: dt } = ut;
1418
+ function mt(c) {
1419
+ E(c, z), !c && m.value && (i.value = m.value.clientWidth, w.value = m.value.clientHeight);
980
1420
  }
981
- c({
982
- isLoading: P,
983
- refreshLayout: J,
1421
+ l({
1422
+ isLoading: T,
1423
+ refreshLayout: u,
984
1424
  // Container dimensions (wrapper element)
985
- containerWidth: f,
986
- containerHeight: x,
1425
+ containerWidth: i,
1426
+ containerHeight: w,
987
1427
  // Masonry content height (for backward compatibility, old containerHeight)
988
- contentHeight: W,
1428
+ contentHeight: P,
989
1429
  // Current page
990
- currentPage: k,
1430
+ currentPage: v,
991
1431
  // End of list tracking
992
1432
  hasReachedEnd: I,
993
1433
  // Load error tracking
994
- loadError: m,
1434
+ loadError: f,
995
1435
  // Set fixed dimensions (overrides ResizeObserver)
996
- setFixedDimensions: pt,
997
- remove: Me,
998
- removeMany: wt,
999
- removeAll: Tt,
1000
- restore: xt,
1001
- restoreMany: bt,
1002
- loadNext: xe,
1003
- loadPage: We,
1436
+ setFixedDimensions: mt,
1437
+ remove: ce,
1438
+ removeMany: ct,
1439
+ removeAll: dt,
1440
+ restore: vt,
1441
+ restoreMany: ft,
1442
+ loadNext: pe,
1443
+ loadPage: Me,
1004
1444
  refreshCurrentPage: ze,
1005
- reset: Et,
1006
- destroy: Lt,
1007
- init: et,
1008
- restoreItems: tt,
1009
- paginationHistory: h,
1010
- cancelLoad: Oe,
1011
- scrollToTop: Ke,
1012
- scrollTo: Mt,
1013
- totalItems: ae(() => i.value.length),
1014
- currentBreakpoint: z
1445
+ reset: yt,
1446
+ destroy: wt,
1447
+ init: Ce,
1448
+ restoreItems: Le,
1449
+ paginationHistory: d,
1450
+ cancelLoad: Te,
1451
+ scrollToTop: ht,
1452
+ scrollTo: gt,
1453
+ totalItems: Q(() => s.value.length),
1454
+ currentBreakpoint: H
1015
1455
  });
1016
- function Fe(e) {
1017
- const n = aa(e);
1018
- let o = 0;
1019
- if (l.value) {
1020
- const { scrollTop: g, clientHeight: u } = l.value;
1021
- o = g + u + 100;
1022
- }
1023
- W.value = Math.max(n, o);
1024
- }
1025
- let fe = [];
1026
- function J(e) {
1027
- var u, F;
1028
- if (p.value) {
1029
- i.value = e;
1030
- return;
1031
- }
1032
- if (!l.value) return;
1033
- if (B(e, "refreshLayout"), e.length > 1e3 && fe.length > e.length && fe.length - e.length < 100) {
1034
- let S = !0;
1035
- for (let O = 0; O < e.length; O++)
1036
- if (((u = e[O]) == null ? void 0 : u.id) !== ((F = fe[O]) == null ? void 0 : F.id)) {
1037
- S = !1;
1038
- break;
1039
- }
1040
- if (S) {
1041
- const O = e.map((Q, re) => ({
1042
- ...fe[re],
1043
- originalIndex: re
1044
- }));
1045
- Fe(O), i.value = O, fe = O;
1046
- return;
1047
- }
1048
- }
1049
- const o = e.map((S, O) => ({
1050
- ...S,
1051
- originalIndex: O
1052
- })), g = l.value;
1053
- if (M.value && M.value.width !== void 0) {
1054
- const S = g.style.width, O = g.style.boxSizing;
1055
- g.style.boxSizing = "border-box", g.style.width = `${M.value.width}px`, g.offsetWidth;
1056
- const Q = rt(o, g, L.value, w.value);
1057
- g.style.width = S, g.style.boxSizing = O, Fe(Q), i.value = Q, fe = Q;
1058
- } else {
1059
- const S = rt(o, g, L.value, w.value);
1060
- Fe(S), i.value = S, fe = S;
1061
- }
1062
- }
1063
- function Ue(e, n) {
1064
- return new Promise((o) => {
1065
- const g = Math.max(0, e | 0), u = Date.now();
1066
- n(g, g);
1067
- const F = setInterval(() => {
1068
- if (V.value) {
1069
- clearInterval(F), o();
1070
- return;
1071
- }
1072
- const S = Date.now() - u, O = Math.max(0, g - S);
1073
- n(O, g), O <= 0 && (clearInterval(F), o());
1074
- }, 100);
1075
- });
1076
- }
1077
- async function Se(e) {
1078
- try {
1079
- const n = await yt(() => r.getNextPage(e));
1080
- return J([...i.value, ...n.items]), n;
1081
- } catch (n) {
1082
- throw n;
1083
- }
1084
- }
1085
- async function yt(e) {
1086
- let n = 0;
1087
- const o = r.retryMaxAttempts;
1088
- let g = r.retryInitialDelayMs;
1089
- for (; ; )
1090
- try {
1091
- const u = await e();
1092
- return n > 0 && b("retry:stop", { attempt: n, success: !0 }), u;
1093
- } catch (u) {
1094
- if (n++, n > o)
1095
- throw b("retry:stop", { attempt: n - 1, success: !1 }), u;
1096
- b("retry:start", { attempt: n, max: o, totalMs: g }), await Ue(g, (F, S) => {
1097
- b("retry:tick", { attempt: n, remainingMs: F, totalMs: S });
1098
- }), g += r.retryBackoffStepMs;
1099
- }
1100
- }
1101
- async function We(e) {
1102
- if (!P.value) {
1103
- V.value = !1, P.value = !0, I.value = !1, m.value = null;
1104
- try {
1105
- const n = i.value.length;
1106
- if (V.value) return;
1107
- const o = await Se(e);
1108
- return V.value ? void 0 : (m.value = null, k.value = e, h.value.push(o.nextPage), o.nextPage == null && (I.value = !0), await Te(n), o);
1109
- } catch (n) {
1110
- throw m.value = ke(n), n;
1111
- } finally {
1112
- P.value = !1;
1113
- }
1114
- }
1115
- }
1116
- async function xe() {
1117
- if (!P.value && !I.value) {
1118
- V.value = !1, P.value = !0, m.value = null;
1119
- try {
1120
- const e = i.value.length;
1121
- if (V.value) return;
1122
- const n = h.value[h.value.length - 1];
1123
- if (n == null) {
1124
- I.value = !0, P.value = !1;
1125
- return;
1126
- }
1127
- const o = await Se(n);
1128
- return V.value ? void 0 : (m.value = null, k.value = n, h.value.push(o.nextPage), o.nextPage == null && (I.value = !0), await Te(e), o);
1129
- } catch (e) {
1130
- throw m.value = ke(e), e;
1131
- } finally {
1132
- P.value = !1;
1133
- }
1134
- }
1135
- }
1136
- const te = ia({
1137
- useSwipeMode: p,
1138
- masonry: i,
1139
- isLoading: P,
1140
- loadNext: xe,
1141
- loadPage: We,
1142
- paginationHistory: h
1143
- }), pe = te.currentSwipeIndex, be = te.swipeOffset, Pe = te.isDragging, de = te.swipeContainer, _e = te.handleTouchStart, Xe = te.handleTouchMove, Ge = te.handleTouchEnd, Je = te.handleMouseDown, Be = te.handleMouseMove, De = te.handleMouseUp, Ae = te.snapToCurrentItem;
1144
- async function ze() {
1145
- if (!P.value) {
1146
- V.value = !1, P.value = !0;
1147
- try {
1148
- const e = k.value;
1149
- if (e == null) {
1150
- console.warn("[Masonry] No current page to refresh - currentPage:", k.value, "paginationHistory:", h.value);
1151
- return;
1152
- }
1153
- i.value = [], W.value = 0, I.value = !1, m.value = null, h.value = [e], await U();
1154
- const n = await Se(e);
1155
- if (V.value) return;
1156
- m.value = null, k.value = e, h.value.push(n.nextPage), n.nextPage == null && (I.value = !0);
1157
- const o = i.value.length;
1158
- return await Te(o), n;
1159
- } catch (e) {
1160
- throw m.value = ke(e), e;
1161
- } finally {
1162
- P.value = !1;
1163
- }
1164
- }
1165
- }
1166
- async function Me(e) {
1167
- const n = i.value.filter((o) => o.id !== e.id);
1168
- if (i.value = n, await U(), n.length === 0 && h.value.length > 0) {
1169
- if (r.autoRefreshOnEmpty)
1170
- await ze();
1171
- else
1172
- try {
1173
- await xe(), await Te(0, !0);
1174
- } catch {
1175
- }
1176
- return;
1177
- }
1178
- await new Promise((o) => requestAnimationFrame(() => o())), requestAnimationFrame(() => {
1179
- J(n);
1180
- });
1181
- }
1182
- async function wt(e) {
1183
- if (!e || e.length === 0) return;
1184
- const n = new Set(e.map((g) => g.id)), o = i.value.filter((g) => !n.has(g.id));
1185
- if (i.value = o, await U(), o.length === 0 && h.value.length > 0) {
1186
- if (r.autoRefreshOnEmpty)
1187
- await ze();
1188
- else
1189
- try {
1190
- await xe(), await Te(0, !0);
1191
- } catch {
1192
- }
1193
- return;
1194
- }
1195
- await new Promise((g) => requestAnimationFrame(() => g())), requestAnimationFrame(() => {
1196
- J(o);
1197
- });
1198
- }
1199
- async function xt(e, n) {
1200
- if (!e) return;
1201
- const o = i.value;
1202
- if (o.findIndex((S) => S.id === e.id) !== -1) return;
1203
- const u = [...o], F = Math.min(n, u.length);
1204
- u.splice(F, 0, e), i.value = u, await U(), p.value || (await new Promise((S) => requestAnimationFrame(() => S())), requestAnimationFrame(() => {
1205
- J(u);
1206
- }));
1207
- }
1208
- async function bt(e, n) {
1209
- var at;
1210
- if (!e || e.length === 0) return;
1211
- if (!n || n.length !== e.length) {
1212
- console.warn("[Masonry] restoreMany: items and indices arrays must have the same length");
1213
- return;
1214
- }
1215
- const o = i.value, g = new Set(o.map((Y) => Y.id)), u = [];
1216
- for (let Y = 0; Y < e.length; Y++)
1217
- g.has((at = e[Y]) == null ? void 0 : at.id) || u.push({ item: e[Y], index: n[Y] });
1218
- if (u.length === 0) return;
1219
- const F = /* @__PURE__ */ new Map();
1220
- for (const { item: Y, index: kt } of u)
1221
- F.set(kt, Y);
1222
- const S = u.length > 0 ? Math.max(...u.map(({ index: Y }) => Y)) : -1, O = Math.max(o.length - 1, S), Q = [];
1223
- let re = 0;
1224
- for (let Y = 0; Y <= O; Y++)
1225
- F.has(Y) ? Q.push(F.get(Y)) : re < o.length && (Q.push(o[re]), re++);
1226
- for (; re < o.length; )
1227
- Q.push(o[re]), re++;
1228
- i.value = Q, await U(), p.value || (await new Promise((Y) => requestAnimationFrame(() => Y())), requestAnimationFrame(() => {
1229
- J(Q);
1230
- }));
1231
- }
1232
- function Ke(e) {
1233
- l.value && l.value.scrollTo({
1456
+ const se = K.currentSwipeIndex, ve = K.swipeOffset, ye = K.isDragging, le = K.swipeContainer, Be = K.handleTouchStart, Fe = K.handleTouchMove, Ae = K.handleTouchEnd, We = K.handleMouseDown, Ie = K.handleMouseMove, Ee = K.handleMouseUp, ke = K.snapToCurrentItem;
1457
+ function ht(c) {
1458
+ a.value && a.value.scrollTo({
1234
1459
  top: 0,
1235
- behavior: (e == null ? void 0 : e.behavior) ?? "smooth",
1236
- ...e
1460
+ behavior: (c == null ? void 0 : c.behavior) ?? "smooth",
1461
+ ...c
1237
1462
  });
1238
1463
  }
1239
- function Mt(e) {
1240
- l.value && (l.value.scrollTo({
1241
- top: e.top ?? l.value.scrollTop,
1242
- left: e.left ?? l.value.scrollLeft,
1243
- behavior: e.behavior ?? "auto"
1244
- }), l.value && (a.value = l.value.scrollTop, d.value = l.value.clientHeight || window.innerHeight));
1245
- }
1246
- async function Tt() {
1247
- Ke({ behavior: "smooth" }), i.value = [], x.value = 0, await U(), b("remove-all:complete");
1248
- }
1249
- function It() {
1250
- L.value = we(w.value, f.value), J(i.value), l.value && (a.value = l.value.scrollTop, d.value = l.value.clientHeight);
1251
- }
1252
- let oe = !1;
1253
- const V = H(!1);
1254
- async function Te(e, n = !1) {
1255
- if (!n && !r.backfillEnabled || oe || V.value || I.value) return;
1256
- const o = (e || 0) + (r.pageSize || 0);
1257
- if (!r.pageSize || r.pageSize <= 0) return;
1258
- if (h.value[h.value.length - 1] == null) {
1259
- I.value = !0;
1260
- return;
1261
- }
1262
- if (!(i.value.length >= o)) {
1263
- oe = !0, P.value = !0;
1264
- try {
1265
- let u = 0;
1266
- for (b("backfill:start", { target: o, fetched: i.value.length, calls: u }); i.value.length < o && u < r.backfillMaxCalls && h.value[h.value.length - 1] != null && !V.value && !I.value && oe && (await Ue(r.backfillDelayMs, (S, O) => {
1267
- b("backfill:tick", {
1268
- fetched: i.value.length,
1269
- target: o,
1270
- calls: u,
1271
- remainingMs: S,
1272
- totalMs: O
1273
- });
1274
- }), !(V.value || !oe)); ) {
1275
- const F = h.value[h.value.length - 1];
1276
- if (F == null) {
1277
- I.value = !0;
1278
- break;
1279
- }
1280
- try {
1281
- if (V.value || !oe) break;
1282
- const S = await Se(F);
1283
- if (V.value || !oe) break;
1284
- m.value = null, h.value.push(S.nextPage), S.nextPage == null && (I.value = !0);
1285
- } catch (S) {
1286
- if (V.value || !oe) break;
1287
- m.value = ke(S);
1288
- }
1289
- u++;
1290
- }
1291
- b("backfill:stop", { fetched: i.value.length, calls: u });
1292
- } finally {
1293
- oe = !1, P.value = !1;
1294
- }
1295
- }
1464
+ function gt(c) {
1465
+ a.value && (a.value.scrollTo({
1466
+ top: c.top ?? a.value.scrollTop,
1467
+ left: c.left ?? a.value.scrollLeft,
1468
+ behavior: c.behavior ?? "auto"
1469
+ }), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight));
1296
1470
  }
1297
- function Oe() {
1298
- const e = oe;
1299
- V.value = !0, P.value = !1, oe = !1, e && b("backfill:stop", { fetched: i.value.length, calls: 0, cancelled: !0 });
1471
+ function pt() {
1472
+ $(), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight);
1300
1473
  }
1301
- function Et() {
1302
- Oe(), V.value = !1, l.value && l.value.scrollTo({
1474
+ function yt() {
1475
+ Te(), a.value && a.value.scrollTo({
1303
1476
  top: 0,
1304
1477
  behavior: "smooth"
1305
- }), i.value = [], x.value = 0, k.value = r.loadAtPage, h.value = [r.loadAtPage], I.value = !1, m.value = null, ne.value = {
1306
- distanceToTrigger: 0,
1307
- isNearTrigger: !1
1308
- };
1478
+ }), s.value = [], w.value = 0, v.value = t.loadAtPage, d.value = [t.loadAtPage], I.value = !1, f.value = null, G(), we = !1;
1309
1479
  }
1310
- function Lt() {
1311
- Oe(), i.value = [], W.value = 0, k.value = null, h.value = [], I.value = !1, m.value = null, P.value = !1, oe = !1, V.value = !1, pe.value = 0, be.value = 0, Pe.value = !1, a.value = 0, d.value = 0, D.value = !1, ne.value = {
1312
- distanceToTrigger: 0,
1313
- isNearTrigger: !1
1314
- }, $.value.clear(), l.value && l.value.scrollTo({
1480
+ function wt() {
1481
+ Te(), s.value = [], P.value = 0, v.value = null, d.value = [], I.value = !1, f.value = null, T.value = !1, se.value = 0, ve.value = 0, ye.value = !1, G(), W(), a.value && a.value.scrollTo({
1315
1482
  top: 0,
1316
1483
  behavior: "auto"
1317
1484
  // Instant scroll for destroy
1318
1485
  });
1319
1486
  }
1320
- const he = ct(async () => {
1321
- if (p.value) return;
1322
- if (l.value) {
1323
- const n = l.value.scrollTop, o = l.value.clientHeight || window.innerHeight, g = o > 0 ? o : window.innerHeight;
1324
- a.value = n, d.value = g;
1325
- }
1326
- D.value = !0, await U(), await new Promise((n) => requestAnimationFrame(() => n())), D.value = !1;
1327
- const e = Ye(i.value, L.value);
1328
- le(e), X(e);
1329
- }, 200), Qe = ct(It, 200);
1330
- function Ze() {
1331
- te.handleWindowResize();
1487
+ const oe = Ge(async () => {
1488
+ x.value || await Y();
1489
+ }, 200), Re = Ge(pt, 200);
1490
+ function Oe() {
1491
+ K.handleWindowResize();
1332
1492
  }
1333
- function et(e, n, o) {
1334
- k.value = n, h.value = [n], h.value.push(o), I.value = o == null, B(e, "init"), p.value ? (i.value = [...i.value, ...e], pe.value === 0 && i.value.length > 0 && (be.value = 0)) : (J([...i.value, ...e]), l.value && (a.value = l.value.scrollTop, d.value = l.value.clientHeight || window.innerHeight), U(() => {
1335
- l.value && (a.value = l.value.scrollTop, d.value = l.value.clientHeight || window.innerHeight, X());
1493
+ function Ce(c, S, B) {
1494
+ v.value = S, d.value = [S], d.value.push(B), I.value = B == null, k(c, "init"), x.value ? (s.value = [...s.value, ...c], se.value === 0 && s.value.length > 0 && (ve.value = 0)) : (u([...s.value, ...c]), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight), q(() => {
1495
+ a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight, z());
1336
1496
  }));
1337
1497
  }
1338
- async function tt(e, n, o) {
1339
- if (!r.skipInitialLoad) {
1340
- et(e, n, o);
1498
+ async function Le(c, S, B) {
1499
+ if (!t.skipInitialLoad) {
1500
+ Ce(c, S, B);
1341
1501
  return;
1342
1502
  }
1343
- k.value = n, h.value = [n], o != null && h.value.push(o), I.value = o == null, m.value = null, B(e, "restoreItems"), p.value ? (i.value = e, pe.value === 0 && i.value.length > 0 && (be.value = 0)) : (J(e), l.value && (a.value = l.value.scrollTop, d.value = l.value.clientHeight || window.innerHeight), await U(), l.value && (a.value = l.value.scrollTop, d.value = l.value.clientHeight || window.innerHeight, X()));
1503
+ v.value = S, d.value = [S], B != null && d.value.push(B), I.value = B === null, f.value = null, k(c, "restoreItems"), x.value ? (s.value = c, se.value === 0 && s.value.length > 0 && (ve.value = 0)) : (u(c), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight), await q(), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight || window.innerHeight, z()));
1344
1504
  }
1345
- return se(
1346
- w,
1505
+ ee(
1506
+ h,
1347
1507
  () => {
1348
- p.value || l.value && (L.value = we(w.value, f.value), J(i.value));
1508
+ x.value || a.value && (g.value = ue(h.value, i.value), u(s.value));
1349
1509
  },
1350
1510
  { deep: !0 }
1351
- ), se(() => r.layoutMode, () => {
1352
- M.value && M.value.width !== void 0 ? f.value = M.value.width : y.value && (f.value = y.value.clientWidth);
1353
- }), se(l, (e) => {
1354
- e && !p.value ? (e.removeEventListener("scroll", he), e.addEventListener("scroll", he, { passive: !0 })) : e && e.removeEventListener("scroll", he);
1355
- }, { immediate: !0 }), se(p, (e, n) => {
1356
- n === void 0 && e === !1 || U(() => {
1357
- e ? (document.addEventListener("mousemove", Be), document.addEventListener("mouseup", De), l.value && l.value.removeEventListener("scroll", he), pe.value = 0, be.value = 0, i.value.length > 0 && Ae()) : (document.removeEventListener("mousemove", Be), document.removeEventListener("mouseup", De), l.value && y.value && (M.value && M.value.width !== void 0 ? f.value = M.value.width : f.value = y.value.clientWidth, l.value.removeEventListener("scroll", he), l.value.addEventListener("scroll", he, { passive: !0 }), i.value.length > 0 && (L.value = we(w.value, f.value), J(i.value), a.value = l.value.scrollTop, d.value = l.value.clientHeight, X())));
1511
+ ), ee(() => t.layoutMode, () => {
1512
+ b.value && b.value.width !== void 0 ? i.value = b.value.width : m.value && (i.value = m.value.clientWidth);
1513
+ }), ee(a, (c) => {
1514
+ c && !x.value ? (c.removeEventListener("scroll", oe), c.addEventListener("scroll", oe, { passive: !0 })) : c && c.removeEventListener("scroll", oe);
1515
+ }, { immediate: !0 });
1516
+ let we = !1;
1517
+ return ee(
1518
+ () => [t.items, t.skipInitialLoad, t.initialPage, t.initialNextPage],
1519
+ ([c, S, B, ae]) => {
1520
+ if (S && c && c.length > 0 && !we) {
1521
+ we = !0;
1522
+ const A = B ?? t.loadAtPage;
1523
+ Le(c, A, ae !== void 0 ? ae : void 0);
1524
+ }
1525
+ },
1526
+ { immediate: !1 }
1527
+ ), ee(x, (c, S) => {
1528
+ S === void 0 && c === !1 || q(() => {
1529
+ c ? (document.addEventListener("mousemove", Ie), document.addEventListener("mouseup", Ee), a.value && a.value.removeEventListener("scroll", oe), se.value = 0, ve.value = 0, s.value.length > 0 && ke()) : (document.removeEventListener("mousemove", Ie), document.removeEventListener("mouseup", Ee), a.value && m.value && (b.value && b.value.width !== void 0 ? i.value = b.value.width : i.value = m.value.clientWidth, a.value.removeEventListener("scroll", oe), a.value.addEventListener("scroll", oe, { passive: !0 }), s.value.length > 0 && (g.value = ue(h.value, i.value), u(s.value), F.value = a.value.scrollTop, N.value = a.value.clientHeight, z())));
1358
1530
  });
1359
- }, { immediate: !0 }), se(de, (e) => {
1360
- e && (e.addEventListener("touchstart", _e, { passive: !1 }), e.addEventListener("touchmove", Xe, { passive: !1 }), e.addEventListener("touchend", Ge), e.addEventListener("mousedown", Je));
1361
- }), se(() => i.value.length, (e, n) => {
1362
- p.value && e > 0 && n === 0 && (pe.value = 0, U(() => Ae()));
1363
- }), se(y, (e) => {
1364
- s && (s.disconnect(), s = null), e && typeof ResizeObserver < "u" ? (s = new ResizeObserver((n) => {
1365
- if (!M.value)
1366
- for (const o of n) {
1367
- const g = o.contentRect.width, u = o.contentRect.height;
1368
- f.value !== g && (f.value = g), x.value !== u && (x.value = u);
1531
+ }, { immediate: !0 }), ee(le, (c) => {
1532
+ c && (c.addEventListener("touchstart", Be, { passive: !1 }), c.addEventListener("touchmove", Fe, { passive: !1 }), c.addEventListener("touchend", Ae), c.addEventListener("mousedown", We));
1533
+ }), ee(() => s.value.length, (c, S) => {
1534
+ x.value && c > 0 && S === 0 && (se.value = 0, q(() => ke()));
1535
+ }), ee(m, (c) => {
1536
+ n && (n.disconnect(), n = null), c && typeof ResizeObserver < "u" ? (n = new ResizeObserver((S) => {
1537
+ if (!b.value)
1538
+ for (const B of S) {
1539
+ const ae = B.contentRect.width, A = B.contentRect.height;
1540
+ i.value !== ae && (i.value = ae), w.value !== A && (w.value = A);
1369
1541
  }
1370
- }), s.observe(e), M.value || (f.value = e.clientWidth, x.value = e.clientHeight)) : e && (M.value || (f.value = e.clientWidth, x.value = e.clientHeight));
1371
- }, { immediate: !0 }), se(f, (e, n) => {
1372
- e !== n && e > 0 && !p.value && l.value && i.value.length > 0 && U(() => {
1373
- L.value = we(w.value, e), J(i.value), X();
1542
+ }), n.observe(c), b.value || (i.value = c.clientWidth, w.value = c.clientHeight)) : c && (b.value || (i.value = c.clientWidth, w.value = c.clientHeight));
1543
+ }, { immediate: !0 }), ee(i, (c, S) => {
1544
+ c !== S && c > 0 && !x.value && a.value && s.value.length > 0 && q(() => {
1545
+ g.value = ue(h.value, c), u(s.value), z();
1374
1546
  });
1375
- }), dt(async () => {
1547
+ }), Qe(async () => {
1376
1548
  try {
1377
- await U(), y.value && !s && (f.value = y.value.clientWidth, x.value = y.value.clientHeight), p.value || (L.value = we(w.value, f.value), l.value && (a.value = l.value.scrollTop, d.value = l.value.clientHeight));
1378
- const e = r.loadAtPage;
1379
- if (h.value = [e], !r.skipInitialLoad)
1380
- await We(h.value[0]);
1381
- else if (r.items && r.items.length > 0) {
1382
- const n = r.items[0], o = r.items[r.items.length - 1], g = (n == null ? void 0 : n.page) ?? e ?? 1, u = (o == null ? void 0 : o.next) ?? null;
1383
- await tt(r.items, g, u);
1384
- } else
1385
- k.value = e, h.value = [e];
1386
- p.value ? U(() => Ae()) : X();
1387
- } catch (e) {
1388
- m.value || (console.error("Error during component initialization:", e), m.value = ke(e)), P.value = !1;
1549
+ await q(), m.value && !n && (i.value = m.value.clientWidth, w.value = m.value.clientHeight), x.value || (g.value = ue(h.value, i.value), a.value && (F.value = a.value.scrollTop, N.value = a.value.clientHeight));
1550
+ const c = t.loadAtPage;
1551
+ if (d.value = [c], !t.skipInitialLoad)
1552
+ await Me(d.value[0]);
1553
+ else if (t.items && t.items.length > 0) {
1554
+ const S = t.initialPage !== null && t.initialPage !== void 0 ? t.initialPage : t.loadAtPage, B = t.initialNextPage !== void 0 ? t.initialNextPage : void 0;
1555
+ await Le(t.items, S, B), we = !0;
1556
+ }
1557
+ x.value ? q(() => ke()) : z();
1558
+ } catch (c) {
1559
+ f.value || (console.error("Error during component initialization:", c), f.value = he(c)), T.value = !1;
1389
1560
  }
1390
- window.addEventListener("resize", Qe), window.addEventListener("resize", Ze);
1391
- }), ht(() => {
1392
- var e;
1393
- s && (s.disconnect(), s = null), (e = l.value) == null || e.removeEventListener("scroll", he), window.removeEventListener("resize", Qe), window.removeEventListener("resize", Ze), de.value && (de.value.removeEventListener("touchstart", _e), de.value.removeEventListener("touchmove", Xe), de.value.removeEventListener("touchend", Ge), de.value.removeEventListener("mousedown", Je)), document.removeEventListener("mousemove", Be), document.removeEventListener("mouseup", De);
1394
- }), (e, n) => (j(), R("div", {
1561
+ window.addEventListener("resize", Re), window.addEventListener("resize", Oe);
1562
+ }), Ze(() => {
1563
+ var c;
1564
+ n && (n.disconnect(), n = null), (c = a.value) == null || c.removeEventListener("scroll", oe), window.removeEventListener("resize", Re), window.removeEventListener("resize", Oe), le.value && (le.value.removeEventListener("touchstart", Be), le.value.removeEventListener("touchmove", Fe), le.value.removeEventListener("touchend", Ae), le.value.removeEventListener("mousedown", We)), document.removeEventListener("mousemove", Ie), document.removeEventListener("mouseup", Ee);
1565
+ }), (c, S) => (O(), R("div", {
1395
1566
  ref_key: "wrapper",
1396
- ref: y,
1567
+ ref: m,
1397
1568
  class: "w-full h-full flex flex-col relative"
1398
1569
  }, [
1399
- p.value ? (j(), R("div", {
1570
+ x.value ? (O(), R("div", {
1400
1571
  key: 0,
1401
- class: me(["overflow-hidden w-full flex-1 swipe-container touch-none select-none", { "force-motion": r.forceMotion, "cursor-grab": !ye(Pe), "cursor-grabbing": ye(Pe) }]),
1572
+ class: re(["overflow-hidden w-full flex-1 swipe-container touch-none select-none", { "force-motion": t.forceMotion, "cursor-grab": !U(ye), "cursor-grabbing": U(ye) }]),
1402
1573
  ref_key: "swipeContainer",
1403
- ref: de,
1574
+ ref: le,
1404
1575
  style: { height: "100%", "max-height": "100%", position: "relative" }
1405
1576
  }, [
1406
- q("div", {
1577
+ V("div", {
1407
1578
  class: "relative w-full",
1408
- style: He({
1409
- transform: `translateY(${ye(be)}px)`,
1410
- transition: ye(Pe) ? "none" : `transform ${t.transitionDurationMs}ms ${t.transitionEasing}`,
1411
- height: `${i.value.length * 100}%`
1579
+ style: ge({
1580
+ transform: `translateY(${U(ve)}px)`,
1581
+ transition: U(ye) ? "none" : `transform ${e.transitionDurationMs}ms ${e.transitionEasing}`,
1582
+ height: `${s.value.length * 100}%`
1412
1583
  })
1413
1584
  }, [
1414
- (j(!0), R(lt, null, ot(i.value, (o, g) => (j(), R("div", {
1415
- key: `${o.page}-${o.id}`,
1585
+ (O(!0), R(Ve, null, qe(s.value, (B, ae) => (O(), R("div", {
1586
+ key: `${B.page}-${B.id}`,
1416
1587
  class: "absolute top-0 left-0 w-full",
1417
- style: He({
1418
- top: `${g * (100 / i.value.length)}%`,
1419
- height: `${100 / i.value.length}%`
1588
+ style: ge({
1589
+ top: `${ae * (100 / s.value.length)}%`,
1590
+ height: `${100 / s.value.length}%`
1420
1591
  })
1421
1592
  }, [
1422
- q("div", pa, [
1423
- q("div", ya, [
1424
- K(e.$slots, "default", {
1425
- item: o,
1426
- remove: Me,
1427
- index: o.originalIndex ?? r.items.indexOf(o)
1593
+ V("div", ma, [
1594
+ V("div", ha, [
1595
+ _(c.$slots, "default", {
1596
+ item: B,
1597
+ remove: U(ce),
1598
+ index: B.originalIndex ?? s.value.indexOf(B)
1428
1599
  }, () => [
1429
- Re(Ne, {
1430
- item: o,
1431
- remove: Me,
1432
- "header-height": w.value.header,
1433
- "footer-height": w.value.footer,
1600
+ Pe(be, {
1601
+ item: B,
1602
+ remove: U(ce),
1603
+ "header-height": h.value.header,
1604
+ "footer-height": h.value.footer,
1434
1605
  "in-swipe-mode": !0,
1435
- "is-active": g === ye(pe),
1436
- "onPreload:success": n[0] || (n[0] = (u) => b("item:preload:success", u)),
1437
- "onPreload:error": n[1] || (n[1] = (u) => b("item:preload:error", u)),
1438
- onMouseEnter: n[2] || (n[2] = (u) => b("item:mouse-enter", u)),
1439
- onMouseLeave: n[3] || (n[3] = (u) => b("item:mouse-leave", u))
1606
+ "is-active": ae === U(se),
1607
+ "onPreload:success": S[0] || (S[0] = (A) => M("item:preload:success", A)),
1608
+ "onPreload:error": S[1] || (S[1] = (A) => M("item:preload:error", A)),
1609
+ onMouseEnter: S[2] || (S[2] = (A) => M("item:mouse-enter", A)),
1610
+ onMouseLeave: S[3] || (S[3] = (A) => M("item:mouse-leave", A))
1440
1611
  }, {
1441
- header: Ie((u) => [
1442
- K(e.$slots, "item-header", Ee({ ref_for: !0 }, u), void 0, !0)
1612
+ header: fe((A) => [
1613
+ _(c.$slots, "item-header", de({ ref_for: !0 }, A), void 0, !0)
1443
1614
  ]),
1444
- footer: Ie((u) => [
1445
- K(e.$slots, "item-footer", Ee({ ref_for: !0 }, u), void 0, !0)
1615
+ footer: fe((A) => [
1616
+ _(c.$slots, "item-footer", de({ ref_for: !0 }, A), void 0, !0)
1446
1617
  ]),
1447
1618
  _: 2
1448
- }, 1032, ["item", "header-height", "footer-height", "is-active"])
1619
+ }, 1032, ["item", "remove", "header-height", "footer-height", "is-active"])
1449
1620
  ], !0)
1450
1621
  ])
1451
1622
  ])
1452
1623
  ], 4))), 128))
1453
1624
  ], 4),
1454
- I.value && i.value.length > 0 ? (j(), R("div", wa, [
1455
- K(e.$slots, "end-message", {}, () => [
1456
- n[8] || (n[8] = q("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
1625
+ I.value && s.value.length > 0 ? (O(), R("div", ga, [
1626
+ _(c.$slots, "end-message", {}, () => [
1627
+ S[8] || (S[8] = V("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
1457
1628
  ], !0)
1458
- ])) : ie("", !0),
1459
- m.value && i.value.length > 0 ? (j(), R("div", xa, [
1460
- K(e.$slots, "error-message", { error: m.value }, () => [
1461
- q("p", ba, "Failed to load content: " + qe(m.value.message), 1)
1629
+ ])) : te("", !0),
1630
+ f.value && s.value.length > 0 ? (O(), R("div", pa, [
1631
+ _(c.$slots, "error-message", { error: f.value }, () => [
1632
+ V("p", ya, "Failed to load content: " + $e(f.value.message), 1)
1462
1633
  ], !0)
1463
- ])) : ie("", !0)
1464
- ], 2)) : (j(), R("div", {
1634
+ ])) : te("", !0)
1635
+ ], 2)) : (O(), R("div", {
1465
1636
  key: 1,
1466
- class: me(["overflow-auto w-full flex-1 masonry-container", { "force-motion": r.forceMotion }]),
1637
+ class: re(["overflow-auto w-full flex-1 masonry-container", { "force-motion": t.forceMotion }]),
1467
1638
  ref_key: "container",
1468
- ref: l
1639
+ ref: a
1469
1640
  }, [
1470
- q("div", {
1641
+ V("div", {
1471
1642
  class: "relative",
1472
- style: He({ height: `${W.value}px`, "--masonry-duration": `${t.transitionDurationMs}ms`, "--masonry-leave-duration": `${t.leaveDurationMs}ms`, "--masonry-ease": t.transitionEasing })
1643
+ style: ge({ height: `${P.value}px`, "--masonry-duration": `${e.transitionDurationMs}ms`, "--masonry-leave-duration": `${e.leaveDurationMs}ms`, "--masonry-ease": e.transitionEasing })
1473
1644
  }, [
1474
- Re(Ht, {
1645
+ Pe(xt, {
1475
1646
  name: "masonry",
1476
1647
  css: !1,
1477
- onEnter: G,
1478
- onBeforeEnter: Z,
1479
- onLeave: ee,
1480
- onBeforeLeave: ve
1648
+ onEnter: U(at),
1649
+ onBeforeEnter: U(nt),
1650
+ onLeave: U(ot),
1651
+ onBeforeLeave: U(lt)
1481
1652
  }, {
1482
- default: Ie(() => [
1483
- (j(!0), R(lt, null, ot(ge.value, (o, g) => (j(), R("div", Ee({
1484
- key: `${o.page}-${o.id}`,
1653
+ default: fe(() => [
1654
+ (O(!0), R(Ve, null, qe(U(X), (B, ae) => (O(), R("div", de({
1655
+ key: `${B.page}-${B.id}`,
1485
1656
  class: "absolute masonry-item",
1486
1657
  ref_for: !0
1487
- }, ye(la)(o, g)), [
1488
- K(e.$slots, "default", {
1489
- item: o,
1490
- remove: Me,
1491
- index: o.originalIndex ?? t.items.indexOf(o)
1658
+ }, U(Jt)(B, ae)), [
1659
+ _(c.$slots, "default", {
1660
+ item: B,
1661
+ remove: U(ce),
1662
+ index: B.originalIndex ?? s.value.indexOf(B)
1492
1663
  }, () => [
1493
- Re(Ne, {
1494
- item: o,
1495
- remove: Me,
1496
- "header-height": w.value.header,
1497
- "footer-height": w.value.footer,
1664
+ Pe(be, {
1665
+ item: B,
1666
+ remove: U(ce),
1667
+ "header-height": h.value.header,
1668
+ "footer-height": h.value.footer,
1498
1669
  "in-swipe-mode": !1,
1499
1670
  "is-active": !1,
1500
- "onPreload:success": n[4] || (n[4] = (u) => b("item:preload:success", u)),
1501
- "onPreload:error": n[5] || (n[5] = (u) => b("item:preload:error", u)),
1502
- onMouseEnter: n[6] || (n[6] = (u) => b("item:mouse-enter", u)),
1503
- onMouseLeave: n[7] || (n[7] = (u) => b("item:mouse-leave", u))
1671
+ "onPreload:success": S[4] || (S[4] = (A) => M("item:preload:success", A)),
1672
+ "onPreload:error": S[5] || (S[5] = (A) => M("item:preload:error", A)),
1673
+ onMouseEnter: S[6] || (S[6] = (A) => M("item:mouse-enter", A)),
1674
+ onMouseLeave: S[7] || (S[7] = (A) => M("item:mouse-leave", A))
1504
1675
  }, {
1505
- header: Ie((u) => [
1506
- K(e.$slots, "item-header", Ee({ ref_for: !0 }, u), void 0, !0)
1676
+ header: fe((A) => [
1677
+ _(c.$slots, "item-header", de({ ref_for: !0 }, A), void 0, !0)
1507
1678
  ]),
1508
- footer: Ie((u) => [
1509
- K(e.$slots, "item-footer", Ee({ ref_for: !0 }, u), void 0, !0)
1679
+ footer: fe((A) => [
1680
+ _(c.$slots, "item-footer", de({ ref_for: !0 }, A), void 0, !0)
1510
1681
  ]),
1511
1682
  _: 2
1512
- }, 1032, ["item", "header-height", "footer-height"])
1683
+ }, 1032, ["item", "remove", "header-height", "footer-height"])
1513
1684
  ], !0)
1514
1685
  ], 16))), 128))
1515
1686
  ]),
1516
1687
  _: 3
1517
- })
1688
+ }, 8, ["onEnter", "onBeforeEnter", "onLeave", "onBeforeLeave"])
1518
1689
  ], 4),
1519
- I.value && i.value.length > 0 ? (j(), R("div", Ma, [
1520
- K(e.$slots, "end-message", {}, () => [
1521
- n[9] || (n[9] = q("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
1690
+ I.value && s.value.length > 0 ? (O(), R("div", wa, [
1691
+ _(c.$slots, "end-message", {}, () => [
1692
+ S[9] || (S[9] = V("p", { class: "text-gray-500 dark:text-gray-400" }, "You've reached the end", -1))
1522
1693
  ], !0)
1523
- ])) : ie("", !0),
1524
- m.value && i.value.length > 0 ? (j(), R("div", Ta, [
1525
- K(e.$slots, "error-message", { error: m.value }, () => [
1526
- q("p", Ia, "Failed to load content: " + qe(m.value.message), 1)
1694
+ ])) : te("", !0),
1695
+ f.value && s.value.length > 0 ? (O(), R("div", xa, [
1696
+ _(c.$slots, "error-message", { error: f.value }, () => [
1697
+ V("p", ba, "Failed to load content: " + $e(f.value.message), 1)
1527
1698
  ], !0)
1528
- ])) : ie("", !0)
1699
+ ])) : te("", !0)
1529
1700
  ], 2))
1530
1701
  ], 512));
1531
1702
  }
1532
- }), La = (t, c) => {
1533
- const v = t.__vccOpts || t;
1534
- for (const [r, E] of c)
1535
- v[r] = E;
1536
- return v;
1537
- }, vt = /* @__PURE__ */ La(Ea, [["__scopeId", "data-v-a07e2350"]]), Ha = {
1538
- install(t) {
1539
- t.component("WyxosMasonry", vt), t.component("WMasonry", vt), t.component("WyxosMasonryItem", Ne), t.component("WMasonryItem", Ne);
1703
+ }), Ta = (e, l) => {
1704
+ const r = e.__vccOpts || e;
1705
+ for (const [t, y] of l)
1706
+ r[t] = y;
1707
+ return r;
1708
+ }, Je = /* @__PURE__ */ Ta(Ma, [["__scopeId", "data-v-c6a3147d"]]), ka = {
1709
+ install(e) {
1710
+ e.component("WyxosMasonry", Je), e.component("WMasonry", Je), e.component("WyxosMasonryItem", be), e.component("WMasonryItem", be);
1540
1711
  }
1541
1712
  };
1542
1713
  export {
1543
- vt as Masonry,
1544
- Ne as MasonryItem,
1545
- Ha as default
1714
+ Je as Masonry,
1715
+ be as MasonryItem,
1716
+ ka as default
1546
1717
  };