@wyxos/vibe 1.6.21 → 1.6.23

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