@wyxos/vibe 1.6.21 → 1.6.22

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