@wyxos/vibe 5.13.3 → 5.14.0
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/components/VibeSurface.vue.d.ts +4 -0
- package/lib/core/feed.d.ts +2 -0
- package/lib/core/fillReconciliation.d.ts +2 -1
- package/lib/core/loadingLock.d.ts +10 -0
- package/lib/core/pageReplacement.d.ts +22 -0
- package/lib/core/reelForwardController.d.ts +2 -2
- package/lib/core/removalControllers.d.ts +1 -1
- package/lib/core/runtime.d.ts +2 -1
- package/lib/index.cjs +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +764 -671
- package/lib/types.d.ts +1 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -74,7 +74,10 @@ function G(e, t) {
|
|
|
74
74
|
function K(e) {
|
|
75
75
|
return r(() => Object.freeze([...e.items]));
|
|
76
76
|
}
|
|
77
|
-
function q(e, t
|
|
77
|
+
function q(e, t, n) {
|
|
78
|
+
return n(J(e, t.value)), O(() => J(e, t.value), n, { flush: "post" });
|
|
79
|
+
}
|
|
80
|
+
function J(e, t = [...e.items]) {
|
|
78
81
|
return {
|
|
79
82
|
activeReelPostId: e.activeReelPostId,
|
|
80
83
|
autoScroll: { ...e.autoScroll },
|
|
@@ -104,17 +107,17 @@ function q(e, t = [...e.items]) {
|
|
|
104
107
|
}
|
|
105
108
|
//#endregion
|
|
106
109
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
107
|
-
var
|
|
110
|
+
var Y = {
|
|
108
111
|
key: 0,
|
|
109
112
|
class: "gallery-footer"
|
|
110
|
-
},
|
|
113
|
+
}, ee = {
|
|
111
114
|
key: 0,
|
|
112
115
|
class: "load-more-status",
|
|
113
116
|
role: "status"
|
|
114
|
-
},
|
|
117
|
+
}, te = ["disabled"], ne = {
|
|
115
118
|
key: 2,
|
|
116
119
|
class: "end-feed"
|
|
117
|
-
},
|
|
120
|
+
}, re = ["disabled"], ie = /* @__PURE__ */ d({
|
|
118
121
|
__name: "GalleryFooter",
|
|
119
122
|
props: {
|
|
120
123
|
canRetryEnd: { type: Boolean },
|
|
@@ -130,14 +133,14 @@ var J = {
|
|
|
130
133
|
function i() {
|
|
131
134
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
132
135
|
}
|
|
133
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer",
|
|
136
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", Y, [e.isLoading ? (b(), s("p", ee, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
|
|
134
137
|
key: 1,
|
|
135
138
|
"data-test": "load-more",
|
|
136
139
|
class: "load-more-button",
|
|
137
140
|
type: "button",
|
|
138
141
|
disabled: e.loadMoreLocked,
|
|
139
142
|
onClick: i
|
|
140
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
143
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, te)) : (b(), s("div", ne, [n[1] ||= c("p", {
|
|
141
144
|
class: "end-feed-message",
|
|
142
145
|
role: "status"
|
|
143
146
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -146,9 +149,9 @@ var J = {
|
|
|
146
149
|
type: "button",
|
|
147
150
|
disabled: e.loadMoreLocked,
|
|
148
151
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
149
|
-
}, " Check for more ", 8,
|
|
152
|
+
}, " Check for more ", 8, re)]))])) : o("", !0);
|
|
150
153
|
}
|
|
151
|
-
}),
|
|
154
|
+
}), ae = /* @__PURE__ */ d({
|
|
152
155
|
__name: "FeedFooter",
|
|
153
156
|
props: {
|
|
154
157
|
actions: {},
|
|
@@ -185,7 +188,7 @@ var J = {
|
|
|
185
188
|
"can-retry-end",
|
|
186
189
|
"show-load-more",
|
|
187
190
|
"state"
|
|
188
|
-
])) : (b(), a(
|
|
191
|
+
])) : (b(), a(ie, {
|
|
189
192
|
key: 1,
|
|
190
193
|
"can-retry-end": e.canRetryEnd,
|
|
191
194
|
"has-error": e.hasError,
|
|
@@ -204,7 +207,7 @@ var J = {
|
|
|
204
207
|
"show-load-more"
|
|
205
208
|
]));
|
|
206
209
|
}
|
|
207
|
-
}),
|
|
210
|
+
}), oe = ["role"], se = { class: "gallery-status" }, X = /* @__PURE__ */ d({
|
|
208
211
|
__name: "FeedStatus",
|
|
209
212
|
props: {
|
|
210
213
|
actions: {},
|
|
@@ -218,7 +221,7 @@ var J = {
|
|
|
218
221
|
return (n, u) => (b(), s("main", {
|
|
219
222
|
class: "gallery-shell",
|
|
220
223
|
role: r.state.error ? "alert" : r.state.isLoading || r.state.isLoadingMore ? "status" : void 0
|
|
221
|
-
}, [c("p",
|
|
224
|
+
}, [c("p", se, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading || r.state.isLoadingMore ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(ae, {
|
|
222
225
|
key: 0,
|
|
223
226
|
actions: t.actions,
|
|
224
227
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -240,10 +243,10 @@ var J = {
|
|
|
240
243
|
"is-loading",
|
|
241
244
|
"load-more-locked",
|
|
242
245
|
"state"
|
|
243
|
-
])) : o("", !0)], 8,
|
|
246
|
+
])) : o("", !0)], 8, oe));
|
|
244
247
|
}
|
|
245
248
|
});
|
|
246
|
-
function
|
|
249
|
+
function ce(e) {
|
|
247
250
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
248
251
|
}
|
|
249
252
|
//#endregion
|
|
@@ -252,25 +255,25 @@ function Z(e) {
|
|
|
252
255
|
let t = e.preview?.width ?? e.width, n = e.preview?.height ?? e.height;
|
|
253
256
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
254
257
|
}
|
|
255
|
-
function
|
|
258
|
+
function le(e) {
|
|
256
259
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
257
260
|
}
|
|
258
|
-
function
|
|
261
|
+
function ue(e) {
|
|
259
262
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
260
263
|
}
|
|
261
|
-
var
|
|
262
|
-
function
|
|
264
|
+
var de = .8, fe = .5;
|
|
265
|
+
function Q(e, t, n) {
|
|
263
266
|
let r = Math.max(0, n.viewportHeight);
|
|
264
267
|
if (r === 0) return [];
|
|
265
268
|
let i = n.scrollTop, a = i + r;
|
|
266
269
|
return t.filter((t) => {
|
|
267
270
|
let n = e[t];
|
|
268
271
|
if (!n || n.height <= 0) return !1;
|
|
269
|
-
let o = Math.max(0, Math.min(n.y + n.height, a) - Math.max(n.y, i)), s = n.height <= r ? n.height : r *
|
|
270
|
-
return o +
|
|
272
|
+
let o = Math.max(0, Math.min(n.y + n.height, a) - Math.max(n.y, i)), s = n.height <= r ? n.height : r * de;
|
|
273
|
+
return o + fe >= s;
|
|
271
274
|
});
|
|
272
275
|
}
|
|
273
|
-
function
|
|
276
|
+
function pe(e, t) {
|
|
274
277
|
if (e <= 0) return null;
|
|
275
278
|
let n = Math.max(0, t.gap), r = Number.isFinite(t.additionalHeight) ? Math.max(0, t.additionalHeight ?? 0) : 0, i = Math.max(1, t.minColumnWidth), a = Math.max(1, Math.floor((e + n) / (i + n)));
|
|
276
279
|
return {
|
|
@@ -280,8 +283,8 @@ function Q(e, t) {
|
|
|
280
283
|
itemWidth: (e - n * (a - 1)) / a
|
|
281
284
|
};
|
|
282
285
|
}
|
|
283
|
-
function
|
|
284
|
-
let r =
|
|
286
|
+
function me(e, t, n) {
|
|
287
|
+
let r = le(t), i = n.itemWidth * Z(e) + n.additionalHeight, a = {
|
|
285
288
|
x: r * (n.itemWidth + n.gap),
|
|
286
289
|
y: t[r],
|
|
287
290
|
width: n.itemWidth,
|
|
@@ -289,48 +292,48 @@ function pe(e, t, n) {
|
|
|
289
292
|
};
|
|
290
293
|
return t[r] += i + n.gap, a;
|
|
291
294
|
}
|
|
292
|
-
function
|
|
295
|
+
function he(e, t) {
|
|
293
296
|
let n = Array.from({ length: t.columns }, () => 0), r = t.itemWidth + t.gap;
|
|
294
297
|
return e.forEach((e) => {
|
|
295
298
|
let i = r === 0 ? 0 : Math.round(e.x / r);
|
|
296
299
|
i < 0 || i >= t.columns || (n[i] = Math.max(n[i], e.y + e.height + t.gap));
|
|
297
300
|
}), n;
|
|
298
301
|
}
|
|
299
|
-
function
|
|
302
|
+
function ge(e, t) {
|
|
300
303
|
return e.length === 0 ? 0 : Math.max(0, Math.max(...e) - t);
|
|
301
304
|
}
|
|
302
|
-
function
|
|
303
|
-
let r =
|
|
305
|
+
function _e(e, t, n) {
|
|
306
|
+
let r = pe(t, n);
|
|
304
307
|
if (!r || e.length === 0) return {
|
|
305
308
|
columns: 0,
|
|
306
309
|
height: 0,
|
|
307
310
|
items: []
|
|
308
311
|
};
|
|
309
|
-
let i = Array.from({ length: r.columns }, () => 0), a = e.map((e) =>
|
|
312
|
+
let i = Array.from({ length: r.columns }, () => 0), a = e.map((e) => me(e, i, r));
|
|
310
313
|
return {
|
|
311
314
|
columns: r.columns,
|
|
312
|
-
height:
|
|
315
|
+
height: ge(i, r.gap),
|
|
313
316
|
items: a
|
|
314
317
|
};
|
|
315
318
|
}
|
|
316
|
-
function
|
|
317
|
-
let o =
|
|
319
|
+
function ve(e, t, n, r, i, a) {
|
|
320
|
+
let o = pe(t, n);
|
|
318
321
|
if (!o || e.length === 0) return {
|
|
319
322
|
columns: 0,
|
|
320
323
|
height: 0,
|
|
321
324
|
items: []
|
|
322
325
|
};
|
|
323
|
-
if (r.columns !== o.columns || i > 0 && r.items.length < i) return
|
|
324
|
-
let s = Math.max(0, i), c = a?.untilIndex ?? e.length, l = a?.untilBottom, u = a?.throughIndex ?? s, d = s === 0 ? [] : r.items.slice(0, s), f = s === 0 ? Array.from({ length: o.columns }, () => 0) :
|
|
325
|
-
for (let t = s; t < e.length && t < c && !(l !== void 0 && t > s && t > u && f.every((e) => e >= l)); t += 1) d.push(
|
|
326
|
+
if (r.columns !== o.columns || i > 0 && r.items.length < i) return _e(e, t, n);
|
|
327
|
+
let s = Math.max(0, i), c = a?.untilIndex ?? e.length, l = a?.untilBottom, u = a?.throughIndex ?? s, d = s === 0 ? [] : r.items.slice(0, s), f = s === 0 ? Array.from({ length: o.columns }, () => 0) : he(d, o);
|
|
328
|
+
for (let t = s; t < e.length && t < c && !(l !== void 0 && t > s && t > u && f.every((e) => e >= l)); t += 1) d.push(me(e[t], f, o));
|
|
326
329
|
return {
|
|
327
330
|
columns: o.columns,
|
|
328
|
-
height:
|
|
331
|
+
height: ge(f, o.gap),
|
|
329
332
|
items: d
|
|
330
333
|
};
|
|
331
334
|
}
|
|
332
|
-
function
|
|
333
|
-
let o =
|
|
335
|
+
function ye(e, t, n, r, i, a) {
|
|
336
|
+
let o = pe(t, n);
|
|
334
337
|
if (!o || e.length === 0) return {
|
|
335
338
|
columns: 0,
|
|
336
339
|
fromIndex: 0,
|
|
@@ -339,7 +342,7 @@ function ve(e, t, n, r, i, a) {
|
|
|
339
342
|
retainedIndices: []
|
|
340
343
|
};
|
|
341
344
|
if (r.items.length !== e.length || r.columns !== o.columns) {
|
|
342
|
-
let a = e.map((e, t) => t).filter((e) => !i(e)), o =
|
|
345
|
+
let a = e.map((e, t) => t).filter((e) => !i(e)), o = _e(a.map((t) => e[t]), t, n), s = e.map((e, t) => r.items[t] ?? {
|
|
343
346
|
height: 0,
|
|
344
347
|
width: 0,
|
|
345
348
|
x: 0,
|
|
@@ -364,10 +367,10 @@ function ve(e, t, n, r, i, a) {
|
|
|
364
367
|
};
|
|
365
368
|
let c = r.items.slice(), l = [];
|
|
366
369
|
for (let e = 0; e < s; e += 1) l.push(e);
|
|
367
|
-
let u = a?.untilBottom, d = a?.throughIndex ?? s, f =
|
|
370
|
+
let u = a?.untilBottom, d = a?.throughIndex ?? s, f = he(c.slice(0, s), o);
|
|
368
371
|
for (let t = s; t < e.length; t += 1) if (!i(t)) {
|
|
369
372
|
if (u !== void 0 && l.length > s && t > d && f.every((e) => e >= u)) break;
|
|
370
|
-
c[t] =
|
|
373
|
+
c[t] = me(e[t], f, o), l.push(t);
|
|
371
374
|
}
|
|
372
375
|
let p = new Set(l);
|
|
373
376
|
for (let t = s; t < e.length; t += 1) i(t) || p.has(t) || (c[t] = {
|
|
@@ -379,17 +382,17 @@ function ve(e, t, n, r, i, a) {
|
|
|
379
382
|
return {
|
|
380
383
|
columns: o.columns,
|
|
381
384
|
fromIndex: s,
|
|
382
|
-
height:
|
|
385
|
+
height: ge(f, o.gap),
|
|
383
386
|
items: c,
|
|
384
387
|
retainedIndices: l
|
|
385
388
|
};
|
|
386
389
|
}
|
|
387
390
|
//#endregion
|
|
388
391
|
//#region src/core/masonryViewportIndex.ts
|
|
389
|
-
function
|
|
392
|
+
function be(e) {
|
|
390
393
|
return { columns: [...e.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
|
|
391
394
|
}
|
|
392
|
-
function
|
|
395
|
+
function xe(e, t, n) {
|
|
393
396
|
let r = e.get(t.x) ?? [];
|
|
394
397
|
r.push({
|
|
395
398
|
bottom: t.y + t.height,
|
|
@@ -397,14 +400,14 @@ function be(e, t, n) {
|
|
|
397
400
|
top: t.y
|
|
398
401
|
}), e.set(t.x, r);
|
|
399
402
|
}
|
|
400
|
-
function
|
|
403
|
+
function Se(e, t) {
|
|
401
404
|
let n = /* @__PURE__ */ new Map();
|
|
402
405
|
return e.forEach((e, r) => {
|
|
403
|
-
|
|
404
|
-
}),
|
|
406
|
+
xe(n, e, t?.[r] ?? r);
|
|
407
|
+
}), be(n);
|
|
405
408
|
}
|
|
406
|
-
function
|
|
407
|
-
if (n <= 0) return
|
|
409
|
+
function Ce(e, t, n, r) {
|
|
410
|
+
if (n <= 0) return Se(e, r);
|
|
408
411
|
let i = /* @__PURE__ */ new Map();
|
|
409
412
|
t.columns.forEach((t) => {
|
|
410
413
|
t.forEach((t) => {
|
|
@@ -415,11 +418,11 @@ function Se(e, t, n, r) {
|
|
|
415
418
|
a.push(t), i.set(r.x, a);
|
|
416
419
|
});
|
|
417
420
|
});
|
|
418
|
-
for (let t = n; t < e.length; t += 1)
|
|
419
|
-
return
|
|
421
|
+
for (let t = n; t < e.length; t += 1) xe(i, e[t], r?.[t] ?? t);
|
|
422
|
+
return be(i);
|
|
420
423
|
}
|
|
421
|
-
function
|
|
422
|
-
if (r <= 0) return
|
|
424
|
+
function we(e, t, n, r) {
|
|
425
|
+
if (r <= 0) return Se(t.map((t) => e[t]), t);
|
|
423
426
|
let i = /* @__PURE__ */ new Map();
|
|
424
427
|
return n.columns.forEach((t) => {
|
|
425
428
|
t.forEach((t) => {
|
|
@@ -430,10 +433,10 @@ function Ce(e, t, n, r) {
|
|
|
430
433
|
a.push(t), i.set(n.x, a);
|
|
431
434
|
});
|
|
432
435
|
}), t.forEach((t) => {
|
|
433
|
-
t < r ||
|
|
434
|
-
}),
|
|
436
|
+
t < r || xe(i, e[t], t);
|
|
437
|
+
}), be(i);
|
|
435
438
|
}
|
|
436
|
-
function
|
|
439
|
+
function Te(e, t) {
|
|
437
440
|
let n = 0, r = 0, i = e.length;
|
|
438
441
|
for (; r < i;) {
|
|
439
442
|
let a = Math.floor((r + i) / 2);
|
|
@@ -444,10 +447,10 @@ function we(e, t) {
|
|
|
444
447
|
inspected: n
|
|
445
448
|
};
|
|
446
449
|
}
|
|
447
|
-
function
|
|
450
|
+
function Ee(e, t) {
|
|
448
451
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
|
|
449
452
|
return e.columns.forEach((e) => {
|
|
450
|
-
let t =
|
|
453
|
+
let t = Te(e, r);
|
|
451
454
|
o += t.inspected;
|
|
452
455
|
for (let n = t.index; n < e.length; n += 1) {
|
|
453
456
|
let t = e[n];
|
|
@@ -459,14 +462,14 @@ function Te(e, t) {
|
|
|
459
462
|
inspected: o
|
|
460
463
|
};
|
|
461
464
|
}
|
|
462
|
-
function
|
|
465
|
+
function De(e) {
|
|
463
466
|
return e?.minColumnWidth ?? 240;
|
|
464
467
|
}
|
|
465
|
-
function
|
|
468
|
+
function Oe(e, t) {
|
|
466
469
|
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
467
470
|
return a === void 0 ? i : Math.min(i, a);
|
|
468
471
|
}
|
|
469
|
-
function
|
|
472
|
+
function ke(e) {
|
|
470
473
|
if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
|
|
471
474
|
let t = e?.overscan;
|
|
472
475
|
if (t) {
|
|
@@ -480,10 +483,10 @@ function Oe(e) {
|
|
|
480
483
|
}
|
|
481
484
|
//#endregion
|
|
482
485
|
//#region src/core/scrollbar.ts
|
|
483
|
-
function
|
|
486
|
+
function Ae(e, t, n) {
|
|
484
487
|
return Math.min(n, Math.max(t, e));
|
|
485
488
|
}
|
|
486
|
-
function
|
|
489
|
+
function je({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
487
490
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
488
491
|
if (!(c > 0 && o > 0)) return {
|
|
489
492
|
maximumScrollPosition: c,
|
|
@@ -492,23 +495,23 @@ function Ae({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
492
495
|
thumbSize: o,
|
|
493
496
|
thumbTravel: 0
|
|
494
497
|
};
|
|
495
|
-
let l =
|
|
498
|
+
let l = Ae(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
496
499
|
return {
|
|
497
500
|
maximumScrollPosition: c,
|
|
498
501
|
scrollable: !0,
|
|
499
|
-
thumbOffset: u * (
|
|
502
|
+
thumbOffset: u * (Ae(n, 0, c) / c),
|
|
500
503
|
thumbSize: l,
|
|
501
504
|
thumbTravel: u
|
|
502
505
|
};
|
|
503
506
|
}
|
|
504
507
|
//#endregion
|
|
505
508
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
506
|
-
var
|
|
509
|
+
var Me = ["aria-hidden"], Ne = [
|
|
507
510
|
"aria-controls",
|
|
508
511
|
"aria-valuemax",
|
|
509
512
|
"aria-valuenow",
|
|
510
513
|
"tabindex"
|
|
511
|
-
],
|
|
514
|
+
], Pe = 32, Fe = 40, Ie = 120, Le = /* @__PURE__ */ d({
|
|
512
515
|
__name: "GalleryScrollbar",
|
|
513
516
|
props: {
|
|
514
517
|
contentSize: {},
|
|
@@ -530,16 +533,16 @@ var je = ["aria-hidden"], Me = [
|
|
|
530
533
|
function k() {
|
|
531
534
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
532
535
|
g = null, o.value || (l.value = !1);
|
|
533
|
-
},
|
|
536
|
+
}, Ie);
|
|
534
537
|
}
|
|
535
538
|
function A() {
|
|
536
539
|
l.value = !0, k();
|
|
537
540
|
}
|
|
538
541
|
function j() {
|
|
539
542
|
let e = t.scrollElement, r = i.value;
|
|
540
|
-
return !e || !r ? n :
|
|
543
|
+
return !e || !r ? n : je({
|
|
541
544
|
contentSize: e.scrollHeight,
|
|
542
|
-
minimumThumbSize:
|
|
545
|
+
minimumThumbSize: Pe,
|
|
543
546
|
scrollPosition: e.scrollTop,
|
|
544
547
|
trackSize: r.clientHeight,
|
|
545
548
|
viewportSize: e.clientHeight
|
|
@@ -592,7 +595,7 @@ var je = ["aria-hidden"], Me = [
|
|
|
592
595
|
}
|
|
593
596
|
function z(e) {
|
|
594
597
|
if (!E.value) return;
|
|
595
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
598
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - Fe : e.key === "ArrowDown" ? r + Fe : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
596
599
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
597
600
|
}
|
|
598
601
|
function B(e) {
|
|
@@ -638,15 +641,15 @@ var je = ["aria-hidden"], Me = [
|
|
|
638
641
|
onPointerdown: I,
|
|
639
642
|
onPointermove: L,
|
|
640
643
|
onPointerup: R
|
|
641
|
-
}, null, 44,
|
|
644
|
+
}, null, 44, Ne)], 42, Me));
|
|
642
645
|
}
|
|
643
|
-
}),
|
|
646
|
+
}), Re = (e) => {
|
|
644
647
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
645
648
|
return !1;
|
|
646
|
-
},
|
|
647
|
-
let t =
|
|
649
|
+
}, ze = (e) => e === "", Be = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Ve = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), He = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Ue = (e) => {
|
|
650
|
+
let t = He(e);
|
|
648
651
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
649
|
-
},
|
|
652
|
+
}, We = {
|
|
650
653
|
xmlns: "http://www.w3.org/2000/svg",
|
|
651
654
|
width: 24,
|
|
652
655
|
height: 24,
|
|
@@ -656,27 +659,27 @@ var je = ["aria-hidden"], Me = [
|
|
|
656
659
|
"stroke-width": 2,
|
|
657
660
|
"stroke-linecap": "round",
|
|
658
661
|
"stroke-linejoin": "round"
|
|
659
|
-
},
|
|
660
|
-
...
|
|
662
|
+
}, Ge = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = We.width, color: s = We.stroke, ...c }, { slots: l }) => p("svg", {
|
|
663
|
+
...We,
|
|
661
664
|
...c,
|
|
662
665
|
width: o,
|
|
663
666
|
height: o,
|
|
664
667
|
stroke: s,
|
|
665
|
-
"stroke-width":
|
|
666
|
-
class:
|
|
667
|
-
...!l.default && !
|
|
668
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
668
|
+
"stroke-width": ze(n) || ze(r) || n === !0 || r === !0 ? Number(i || a || We["stroke-width"]) * 24 / Number(o) : i || a || We["stroke-width"],
|
|
669
|
+
class: Be("lucide", c.class, ...e ? [`lucide-${Ve(Ue(e))}-icon`, `lucide-${Ve(e)}`] : ["lucide-icon"]),
|
|
670
|
+
...!l.default && !Re(c) && { "aria-hidden": "true" }
|
|
671
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Ke = (e, t) => (n, { slots: r, attrs: i }) => p(Ge, {
|
|
669
672
|
...i,
|
|
670
673
|
...n,
|
|
671
674
|
iconNode: t,
|
|
672
675
|
name: e
|
|
673
|
-
}, r),
|
|
676
|
+
}, r), qe = Ke("chevron-left", [["path", {
|
|
674
677
|
d: "m15 18-6-6 6-6",
|
|
675
678
|
key: "1wnfg3"
|
|
676
|
-
}]]),
|
|
679
|
+
}]]), Je = Ke("chevron-right", [["path", {
|
|
677
680
|
d: "m9 18 6-6-6-6",
|
|
678
681
|
key: "mthhwq"
|
|
679
|
-
}]]),
|
|
682
|
+
}]]), Ye = Ke("disc-3", [
|
|
680
683
|
["circle", {
|
|
681
684
|
cx: "12",
|
|
682
685
|
cy: "12",
|
|
@@ -697,7 +700,7 @@ var je = ["aria-hidden"], Me = [
|
|
|
697
700
|
d: "M18 12c0 1.7-.7 3.2-1.8 4.2",
|
|
698
701
|
key: "1eah9h"
|
|
699
702
|
}]
|
|
700
|
-
]),
|
|
703
|
+
]), Xe = Ke("pause", [["rect", {
|
|
701
704
|
x: "14",
|
|
702
705
|
y: "3",
|
|
703
706
|
width: "5",
|
|
@@ -711,10 +714,10 @@ var je = ["aria-hidden"], Me = [
|
|
|
711
714
|
height: "18",
|
|
712
715
|
rx: "1",
|
|
713
716
|
key: "1wsw3u"
|
|
714
|
-
}]]),
|
|
717
|
+
}]]), Ze = Ke("play", [["path", {
|
|
715
718
|
d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
|
|
716
719
|
key: "10ikf1"
|
|
717
|
-
}]]),
|
|
720
|
+
}]]), Qe = Ke("volume-2", [
|
|
718
721
|
["path", {
|
|
719
722
|
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
720
723
|
key: "uqj9uw"
|
|
@@ -727,7 +730,7 @@ var je = ["aria-hidden"], Me = [
|
|
|
727
730
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
728
731
|
key: "ijwkga"
|
|
729
732
|
}]
|
|
730
|
-
]),
|
|
733
|
+
]), $e = Ke("volume-x", [
|
|
731
734
|
["path", {
|
|
732
735
|
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
733
736
|
key: "uqj9uw"
|
|
@@ -746,22 +749,22 @@ var je = ["aria-hidden"], Me = [
|
|
|
746
749
|
y2: "15",
|
|
747
750
|
key: "5ykzw1"
|
|
748
751
|
}]
|
|
749
|
-
]),
|
|
752
|
+
]), et = {
|
|
750
753
|
401: "Authentication required",
|
|
751
754
|
403: "Access forbidden",
|
|
752
755
|
404: "Preview not found",
|
|
753
756
|
419: "Session expired",
|
|
754
757
|
500: "Server error"
|
|
755
758
|
};
|
|
756
|
-
function
|
|
759
|
+
function tt(e) {
|
|
757
760
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
758
761
|
}
|
|
759
|
-
function
|
|
760
|
-
return
|
|
762
|
+
function nt(e) {
|
|
763
|
+
return et[tt(e)] ?? "Preview unavailable";
|
|
761
764
|
}
|
|
762
765
|
//#endregion
|
|
763
766
|
//#region src/components/CardRegion.vue
|
|
764
|
-
var
|
|
767
|
+
var rt = /* @__PURE__ */ d({
|
|
765
768
|
__name: "CardRegion",
|
|
766
769
|
props: {
|
|
767
770
|
index: {},
|
|
@@ -808,7 +811,7 @@ var nt = /* @__PURE__ */ d({
|
|
|
808
811
|
"total"
|
|
809
812
|
]))], 38));
|
|
810
813
|
}
|
|
811
|
-
}),
|
|
814
|
+
}), it = ["aria-busy", "aria-label"], at = { class: "media-error-code" }, ot = ["disabled"], st = /* @__PURE__ */ d({
|
|
812
815
|
__name: "MediaError",
|
|
813
816
|
props: {
|
|
814
817
|
component: {},
|
|
@@ -843,7 +846,7 @@ var nt = /* @__PURE__ */ d({
|
|
|
843
846
|
"retrying",
|
|
844
847
|
"status"
|
|
845
848
|
]))], 32)) : (b(), s(e, { key: 1 }, [
|
|
846
|
-
c("strong",
|
|
849
|
+
c("strong", at, T(t.status), 1),
|
|
847
850
|
c("span", null, T(t.label), 1),
|
|
848
851
|
c("button", {
|
|
849
852
|
"data-test": "media-retry",
|
|
@@ -852,26 +855,26 @@ var nt = /* @__PURE__ */ d({
|
|
|
852
855
|
disabled: t.retrying,
|
|
853
856
|
onClick: j(o, ["stop"]),
|
|
854
857
|
onKeydown: r[2] ||= j(() => {}, ["stop"])
|
|
855
|
-
}, T(t.retrying ? "Retrying…" : "Retry"), 41,
|
|
856
|
-
], 64))], 8,
|
|
858
|
+
}, T(t.retrying ? "Retrying…" : "Retry"), 41, ot)
|
|
859
|
+
], 64))], 8, it));
|
|
857
860
|
}
|
|
858
|
-
}),
|
|
861
|
+
}), ct = ["aria-label"], lt = [
|
|
859
862
|
"max",
|
|
860
863
|
"value",
|
|
861
864
|
"aria-label",
|
|
862
865
|
"aria-valuetext",
|
|
863
866
|
"disabled"
|
|
864
|
-
],
|
|
867
|
+
], ut = {
|
|
865
868
|
key: 0,
|
|
866
869
|
class: "media-controls-row"
|
|
867
|
-
},
|
|
870
|
+
}, dt = ["aria-label", "title"], ft = { class: "media-controls-audio" }, pt = ["aria-label", "title"], mt = [
|
|
868
871
|
"value",
|
|
869
872
|
"aria-label",
|
|
870
873
|
"aria-valuetext"
|
|
871
|
-
],
|
|
874
|
+
], ht = {
|
|
872
875
|
class: "media-control-time",
|
|
873
876
|
"aria-live": "off"
|
|
874
|
-
},
|
|
877
|
+
}, gt = /* @__PURE__ */ d({
|
|
875
878
|
__name: "MediaControls",
|
|
876
879
|
props: {
|
|
877
880
|
currentTime: {},
|
|
@@ -921,35 +924,35 @@ var nt = /* @__PURE__ */ d({
|
|
|
921
924
|
"aria-valuetext": `${u(g.value)} of ${u(f.value)}`,
|
|
922
925
|
disabled: f.value <= 0,
|
|
923
926
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
924
|
-
}, null, 44,
|
|
927
|
+
}, null, 44, lt), e.layout === "reel" ? (b(), s("div", ut, [
|
|
925
928
|
c("button", {
|
|
926
929
|
type: "button",
|
|
927
930
|
class: "media-control-button media-control-playback",
|
|
928
931
|
"aria-label": e.playing ? `Pause ${p.value}` : `Play ${p.value}`,
|
|
929
932
|
title: e.playing ? "Pause" : "Play",
|
|
930
933
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
931
|
-
}, [e.playing ? (b(), a(E(
|
|
934
|
+
}, [e.playing ? (b(), a(E(Xe), {
|
|
932
935
|
key: 0,
|
|
933
936
|
size: 18,
|
|
934
937
|
fill: "currentColor"
|
|
935
|
-
})) : (b(), a(E(
|
|
938
|
+
})) : (b(), a(E(Ze), {
|
|
936
939
|
key: 1,
|
|
937
940
|
size: 18,
|
|
938
941
|
fill: "currentColor"
|
|
939
|
-
}))], 8,
|
|
940
|
-
c("div",
|
|
942
|
+
}))], 8, dt),
|
|
943
|
+
c("div", ft, [c("button", {
|
|
941
944
|
type: "button",
|
|
942
945
|
class: "media-control-button",
|
|
943
946
|
"aria-label": e.muted ? `Unmute ${p.value}` : `Mute ${p.value}`,
|
|
944
947
|
title: e.muted ? "Unmute" : "Mute",
|
|
945
948
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
946
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
949
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E($e), {
|
|
947
950
|
key: 0,
|
|
948
951
|
size: 18
|
|
949
|
-
})) : (b(), a(E(
|
|
952
|
+
})) : (b(), a(E(Qe), {
|
|
950
953
|
key: 1,
|
|
951
954
|
size: 18
|
|
952
|
-
}))], 8,
|
|
955
|
+
}))], 8, pt), c("input", {
|
|
953
956
|
class: "media-control-range media-control-volume",
|
|
954
957
|
type: "range",
|
|
955
958
|
min: "0",
|
|
@@ -960,15 +963,15 @@ var nt = /* @__PURE__ */ d({
|
|
|
960
963
|
"aria-label": `${m.value} volume`,
|
|
961
964
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
962
965
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
963
|
-
}, null, 44,
|
|
964
|
-
c("output",
|
|
965
|
-
])) : o("", !0)], 42,
|
|
966
|
+
}, null, 44, mt)]),
|
|
967
|
+
c("output", ht, T(u(g.value)) + " / " + T(u(f.value)), 1)
|
|
968
|
+
])) : o("", !0)], 42, ct));
|
|
966
969
|
}
|
|
967
|
-
}),
|
|
970
|
+
}), _t = {
|
|
968
971
|
key: 0,
|
|
969
972
|
class: "media-card-overlay-host",
|
|
970
973
|
"data-test": "media-card-overlay"
|
|
971
|
-
},
|
|
974
|
+
}, vt = /* @__PURE__ */ d({
|
|
972
975
|
__name: "MediaContextOverlay",
|
|
973
976
|
props: {
|
|
974
977
|
item: {},
|
|
@@ -978,7 +981,7 @@ var nt = /* @__PURE__ */ d({
|
|
|
978
981
|
mediaSource: {}
|
|
979
982
|
},
|
|
980
983
|
setup(e) {
|
|
981
|
-
return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div",
|
|
984
|
+
return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div", _t, [(b(), a(C(e.mediaCard.overlay.component), {
|
|
982
985
|
item: e.item,
|
|
983
986
|
"media-index": e.mediaIndex,
|
|
984
987
|
"media-item": e.mediaItem,
|
|
@@ -990,8 +993,8 @@ var nt = /* @__PURE__ */ d({
|
|
|
990
993
|
"media-source"
|
|
991
994
|
]))])) : o("", !0);
|
|
992
995
|
}
|
|
993
|
-
}),
|
|
994
|
-
function
|
|
996
|
+
}), yt = 40, bt = 160, xt = 24;
|
|
997
|
+
function St(e) {
|
|
995
998
|
let t = w("next"), n = null, r = 0, i = !1, a = null, o = null;
|
|
996
999
|
function s(n, r) {
|
|
997
1000
|
let i = H(e.item()).length, a = (n + i) % i;
|
|
@@ -1001,7 +1004,7 @@ function xt(e) {
|
|
|
1001
1004
|
r = 0, i = !1, n !== null && clearTimeout(n), n = null;
|
|
1002
1005
|
}
|
|
1003
1006
|
function l() {
|
|
1004
|
-
n !== null && clearTimeout(n), n = setTimeout(c,
|
|
1007
|
+
n !== null && clearTimeout(n), n = setTimeout(c, bt);
|
|
1005
1008
|
}
|
|
1006
1009
|
function u(e, t, n) {
|
|
1007
1010
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
@@ -1009,7 +1012,7 @@ function xt(e) {
|
|
|
1009
1012
|
function d(t) {
|
|
1010
1013
|
if (H(e.item()).length <= 1) return;
|
|
1011
1014
|
let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
|
|
1012
|
-
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) <
|
|
1015
|
+
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < xt)) return;
|
|
1013
1016
|
let o = Math.sign(r);
|
|
1014
1017
|
r = 0, i = !0, s(e.mediaIndex() + o);
|
|
1015
1018
|
}
|
|
@@ -1021,7 +1024,7 @@ function xt(e) {
|
|
|
1021
1024
|
let n = t.changedTouches[0];
|
|
1022
1025
|
if (a === null || o === null || !n) return;
|
|
1023
1026
|
let r = a - n.clientX, i = o - n.clientY;
|
|
1024
|
-
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) <
|
|
1027
|
+
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < yt || s(e.mediaIndex() + Math.sign(r)));
|
|
1025
1028
|
}
|
|
1026
1029
|
return v(c), {
|
|
1027
1030
|
change: s,
|
|
@@ -1031,11 +1034,11 @@ function xt(e) {
|
|
|
1031
1034
|
onWheel: d
|
|
1032
1035
|
};
|
|
1033
1036
|
}
|
|
1034
|
-
var
|
|
1035
|
-
function
|
|
1037
|
+
var Ct = /* @__PURE__ */ new Map(), wt = [], Tt = 0, Et = 0;
|
|
1038
|
+
function Dt(e, t) {
|
|
1036
1039
|
return `${t ? "timed" : "image"}:${e}`;
|
|
1037
1040
|
}
|
|
1038
|
-
function
|
|
1041
|
+
function Ot(e, t, n) {
|
|
1039
1042
|
let r = H(e);
|
|
1040
1043
|
if (r.length < 2) return [];
|
|
1041
1044
|
let i = U(e, t), a = [];
|
|
@@ -1049,7 +1052,7 @@ function Dt(e, t, n) {
|
|
|
1049
1052
|
if (!t) return [];
|
|
1050
1053
|
let i = I(t.type, t.src) === "audio" ? B(t) : z(t, n);
|
|
1051
1054
|
if (!i) return [];
|
|
1052
|
-
let a = L(i.type, i.src), s =
|
|
1055
|
+
let a = L(i.type, i.src), s = Dt(i.src, a);
|
|
1053
1056
|
return o.has(s) ? [] : (o.add(s), [{
|
|
1054
1057
|
key: s,
|
|
1055
1058
|
src: i.src,
|
|
@@ -1057,22 +1060,22 @@ function Dt(e, t, n) {
|
|
|
1057
1060
|
}]);
|
|
1058
1061
|
});
|
|
1059
1062
|
}
|
|
1060
|
-
function
|
|
1063
|
+
function kt(e) {
|
|
1061
1064
|
let t = e.element;
|
|
1062
1065
|
e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
|
|
1063
1066
|
}
|
|
1064
|
-
function kt(e) {
|
|
1065
|
-
St.delete(e.key);
|
|
1066
|
-
let t = Ct.indexOf(e);
|
|
1067
|
-
t >= 0 && Ct.splice(t, 1), e.cancel?.(), e.cancel = null, Ot(e);
|
|
1068
|
-
}
|
|
1069
1067
|
function At(e) {
|
|
1070
|
-
|
|
1068
|
+
Ct.delete(e.key);
|
|
1069
|
+
let t = wt.indexOf(e);
|
|
1070
|
+
t >= 0 && wt.splice(t, 1), e.cancel?.(), e.cancel = null, kt(e);
|
|
1071
|
+
}
|
|
1072
|
+
function jt(e) {
|
|
1073
|
+
e.state = "loading", Tt += 1, e.timed && (Et += 1);
|
|
1071
1074
|
let t = !1, n = () => void 0, r = (r) => {
|
|
1072
|
-
t || (t = !0, n(), --
|
|
1075
|
+
t || (t = !0, n(), --Tt, e.timed && --Et, e.cancel = null, e.state = r, r === "failed" && kt(e), e.refs === 0 && At(e), Mt());
|
|
1073
1076
|
};
|
|
1074
1077
|
if (e.cancel = () => {
|
|
1075
|
-
t || (t = !0, n(), --
|
|
1078
|
+
t || (t = !0, n(), --Tt, e.timed && --Et, kt(e), Mt());
|
|
1076
1079
|
}, e.timed) {
|
|
1077
1080
|
let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
|
|
1078
1081
|
n = () => {
|
|
@@ -1091,38 +1094,38 @@ function At(e) {
|
|
|
1091
1094
|
i.removeEventListener("load", a), i.removeEventListener("error", o);
|
|
1092
1095
|
}, i.addEventListener("load", a, { once: !0 }), i.addEventListener("error", o, { once: !0 }), i.decoding = "async", i.fetchPriority = "low", i.src = e.src, e.element = i;
|
|
1093
1096
|
}
|
|
1094
|
-
function
|
|
1095
|
-
for (;
|
|
1096
|
-
let e =
|
|
1097
|
+
function Mt() {
|
|
1098
|
+
for (; Tt < 6;) {
|
|
1099
|
+
let e = wt.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || Et < 2));
|
|
1097
1100
|
if (e < 0) return;
|
|
1098
|
-
let [t] =
|
|
1099
|
-
t &&
|
|
1101
|
+
let [t] = wt.splice(e, 1);
|
|
1102
|
+
t && jt(t);
|
|
1100
1103
|
}
|
|
1101
1104
|
}
|
|
1102
|
-
function
|
|
1103
|
-
let t =
|
|
1105
|
+
function Nt(e) {
|
|
1106
|
+
let t = Ct.get(e.key);
|
|
1104
1107
|
t || (t = {
|
|
1105
1108
|
...e,
|
|
1106
1109
|
cancel: null,
|
|
1107
1110
|
element: null,
|
|
1108
1111
|
refs: 0,
|
|
1109
1112
|
state: "queued"
|
|
1110
|
-
},
|
|
1113
|
+
}, Ct.set(t.key, t), wt.push(t)), t.refs += 1, Mt();
|
|
1111
1114
|
let n = !1;
|
|
1112
1115
|
return () => {
|
|
1113
|
-
n || (n = !0, --t.refs, t.refs === 0 &&
|
|
1116
|
+
n || (n = !0, --t.refs, t.refs === 0 && At(t));
|
|
1114
1117
|
};
|
|
1115
1118
|
}
|
|
1116
1119
|
//#endregion
|
|
1117
1120
|
//#region src/components/useVisiblePostPreload.ts
|
|
1118
|
-
function
|
|
1119
|
-
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ?
|
|
1121
|
+
function Pt(e) {
|
|
1122
|
+
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? Ot(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
|
|
1120
1123
|
function a() {
|
|
1121
1124
|
let e = new Map(n.value.map((e) => [e.key, e]));
|
|
1122
1125
|
i.forEach((t, n) => {
|
|
1123
1126
|
e.has(n) || (t(), i.delete(n));
|
|
1124
1127
|
}), n.value.forEach((e) => {
|
|
1125
|
-
i.has(e.key) || i.set(e.key,
|
|
1128
|
+
i.has(e.key) || i.set(e.key, Nt(e));
|
|
1126
1129
|
});
|
|
1127
1130
|
}
|
|
1128
1131
|
O(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), v(() => {
|
|
@@ -1131,7 +1134,7 @@ function Nt(e) {
|
|
|
1131
1134
|
}
|
|
1132
1135
|
//#endregion
|
|
1133
1136
|
//#region src/components/useMediaLoading.ts
|
|
1134
|
-
function
|
|
1137
|
+
function Ft(e) {
|
|
1135
1138
|
let t = r(() => L(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
|
|
1136
1139
|
return O(i, (t, n) => {
|
|
1137
1140
|
n !== "none" || t === "none" || m(() => e.mediaElement.value?.load());
|
|
@@ -1143,7 +1146,7 @@ function Pt(e) {
|
|
|
1143
1146
|
}
|
|
1144
1147
|
//#endregion
|
|
1145
1148
|
//#region src/components/useMediaReadiness.ts
|
|
1146
|
-
function
|
|
1149
|
+
function It(e) {
|
|
1147
1150
|
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
1148
1151
|
function f() {
|
|
1149
1152
|
l !== null && clearTimeout(l), l = null;
|
|
@@ -1201,30 +1204,30 @@ function Ft(e) {
|
|
|
1201
1204
|
}
|
|
1202
1205
|
//#endregion
|
|
1203
1206
|
//#region src/core/reelAudio.ts
|
|
1204
|
-
var
|
|
1207
|
+
var Lt = {
|
|
1205
1208
|
lastAudibleVolume: 1,
|
|
1206
1209
|
muted: !1,
|
|
1207
1210
|
volume: 1
|
|
1208
1211
|
};
|
|
1209
|
-
function
|
|
1212
|
+
function Rt(e, t) {
|
|
1210
1213
|
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
1211
1214
|
}
|
|
1212
|
-
function
|
|
1213
|
-
let n =
|
|
1215
|
+
function zt(e, t = Lt) {
|
|
1216
|
+
let n = Rt(e?.volume, t.volume), r = Rt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
|
|
1214
1217
|
return {
|
|
1215
|
-
lastAudibleVolume: r > 0 ? r :
|
|
1218
|
+
lastAudibleVolume: r > 0 ? r : Lt.lastAudibleVolume,
|
|
1216
1219
|
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
1217
1220
|
volume: n
|
|
1218
1221
|
};
|
|
1219
1222
|
}
|
|
1220
1223
|
//#endregion
|
|
1221
1224
|
//#region src/components/useMediaCardAudio.ts
|
|
1222
|
-
function
|
|
1223
|
-
let t =
|
|
1225
|
+
function Bt(e) {
|
|
1226
|
+
let t = zt(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
|
|
1224
1227
|
function o() {
|
|
1225
1228
|
let t = e.mediaElement.value, n = e.reelAudioState();
|
|
1226
1229
|
if (!t || e.layout() !== "reel" || !n) return;
|
|
1227
|
-
let o =
|
|
1230
|
+
let o = zt(n);
|
|
1228
1231
|
a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
|
|
1229
1232
|
}
|
|
1230
1233
|
function s(e, t) {
|
|
@@ -1232,7 +1235,7 @@ function zt(e) {
|
|
|
1232
1235
|
}
|
|
1233
1236
|
function c(t) {
|
|
1234
1237
|
if (e.layout() !== "reel") return;
|
|
1235
|
-
let n =
|
|
1238
|
+
let n = zt({
|
|
1236
1239
|
lastAudibleVolume: a,
|
|
1237
1240
|
muted: t.muted,
|
|
1238
1241
|
volume: t.volume
|
|
@@ -1267,7 +1270,7 @@ function zt(e) {
|
|
|
1267
1270
|
}
|
|
1268
1271
|
//#endregion
|
|
1269
1272
|
//#region src/components/useReelVideoActivity.ts
|
|
1270
|
-
function
|
|
1273
|
+
function Vt(e) {
|
|
1271
1274
|
let t = r(() => e.layout() === "reel" ? e.active() === !0 : e.inViewport()), n = r(() => t.value ? e.mediaIsMuted.value : !0);
|
|
1272
1275
|
function i() {
|
|
1273
1276
|
if (!t.value) {
|
|
@@ -1301,18 +1304,18 @@ function Bt(e) {
|
|
|
1301
1304
|
}
|
|
1302
1305
|
//#endregion
|
|
1303
1306
|
//#region src/components/useTimedMediaCard.ts
|
|
1304
|
-
function
|
|
1307
|
+
function Ht(e) {
|
|
1305
1308
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
1306
1309
|
}
|
|
1307
|
-
function
|
|
1308
|
-
let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } =
|
|
1310
|
+
function Ut(e) {
|
|
1311
|
+
let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = Bt({
|
|
1309
1312
|
active: e.active,
|
|
1310
1313
|
layout: e.layout,
|
|
1311
1314
|
mediaCard: e.mediaCard,
|
|
1312
1315
|
mediaElement: e.mediaElement,
|
|
1313
1316
|
onChange: e.onAudioChange,
|
|
1314
1317
|
reelAudioState: e.reelAudioState
|
|
1315
|
-
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } =
|
|
1318
|
+
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = Vt({
|
|
1316
1319
|
active: e.active,
|
|
1317
1320
|
inViewport: e.inViewport,
|
|
1318
1321
|
layout: e.layout,
|
|
@@ -1322,7 +1325,7 @@ function Ht(e) {
|
|
|
1322
1325
|
});
|
|
1323
1326
|
function p(r) {
|
|
1324
1327
|
let i = r?.currentTarget ?? e.mediaElement.value;
|
|
1325
|
-
i && (t.value =
|
|
1328
|
+
i && (t.value = Ht(i.currentTime), n.value = Ht(i.duration), o(i, f.value));
|
|
1326
1329
|
}
|
|
1327
1330
|
function m(t) {
|
|
1328
1331
|
i(), p(t), e.onReady(t);
|
|
@@ -1332,7 +1335,7 @@ function Ht(e) {
|
|
|
1332
1335
|
}
|
|
1333
1336
|
function g(n) {
|
|
1334
1337
|
let r = e.mediaElement.value;
|
|
1335
|
-
!r || !Number.isFinite(n) || (r.currentTime = Math.min(
|
|
1338
|
+
!r || !Number.isFinite(n) || (r.currentTime = Math.min(Ht(r.duration), Math.max(0, n)), t.value = r.currentTime);
|
|
1336
1339
|
}
|
|
1337
1340
|
async function _() {
|
|
1338
1341
|
let t = e.mediaElement.value;
|
|
@@ -1370,7 +1373,7 @@ function Ht(e) {
|
|
|
1370
1373
|
}
|
|
1371
1374
|
//#endregion
|
|
1372
1375
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
1373
|
-
var
|
|
1376
|
+
var Wt = [
|
|
1374
1377
|
"data-post-id",
|
|
1375
1378
|
"data-media-index",
|
|
1376
1379
|
"aria-hidden",
|
|
@@ -1378,29 +1381,29 @@ var Ut = [
|
|
|
1378
1381
|
"inert",
|
|
1379
1382
|
"role",
|
|
1380
1383
|
"tabindex"
|
|
1381
|
-
],
|
|
1384
|
+
], Gt = { class: "media-card-content" }, Kt = ["data-media-direction"], qt = ["data-media-index"], Jt = {
|
|
1382
1385
|
key: 0,
|
|
1383
1386
|
"data-test": "media-loading",
|
|
1384
1387
|
class: "media-loading",
|
|
1385
1388
|
"aria-hidden": "true"
|
|
1386
|
-
},
|
|
1389
|
+
}, Yt = [
|
|
1387
1390
|
"data-source-generation",
|
|
1388
1391
|
"src",
|
|
1389
1392
|
"autoplay",
|
|
1390
1393
|
"loop",
|
|
1391
1394
|
"muted",
|
|
1392
1395
|
"preload"
|
|
1393
|
-
],
|
|
1396
|
+
], Xt = ["aria-label", "disabled"], Zt = [
|
|
1394
1397
|
"src",
|
|
1395
1398
|
"width",
|
|
1396
1399
|
"height",
|
|
1397
1400
|
"fetchpriority",
|
|
1398
1401
|
"loading"
|
|
1399
|
-
],
|
|
1402
|
+
], Qt = {
|
|
1400
1403
|
key: 1,
|
|
1401
1404
|
class: "media-audio-fallback",
|
|
1402
1405
|
"aria-hidden": "true"
|
|
1403
|
-
},
|
|
1406
|
+
}, $t = [
|
|
1404
1407
|
"data-source-generation",
|
|
1405
1408
|
"src",
|
|
1406
1409
|
"width",
|
|
@@ -1409,14 +1412,14 @@ var Ut = [
|
|
|
1409
1412
|
"loop",
|
|
1410
1413
|
"muted",
|
|
1411
1414
|
"preload"
|
|
1412
|
-
],
|
|
1415
|
+
], en = [
|
|
1413
1416
|
"data-source-generation",
|
|
1414
1417
|
"src",
|
|
1415
1418
|
"width",
|
|
1416
1419
|
"height",
|
|
1417
1420
|
"fetchpriority",
|
|
1418
1421
|
"loading"
|
|
1419
|
-
],
|
|
1422
|
+
], tn = ["aria-label"], nn = ["aria-label"], rn = ["aria-label"], an = /* @__PURE__ */ d({
|
|
1420
1423
|
__name: "MediaCard",
|
|
1421
1424
|
props: {
|
|
1422
1425
|
active: { type: Boolean },
|
|
@@ -1455,14 +1458,14 @@ var Ut = [
|
|
|
1455
1458
|
function f(e = !1, t = "pointer") {
|
|
1456
1459
|
e && d("activate", t);
|
|
1457
1460
|
}
|
|
1458
|
-
let p = r(() => H(l.item)), g = r(() => U(l.item, l.mediaIndex)), v = r(() => W(l.item, g.value)), y = r(() => z(v.value, l.mediaSource ?? "preview")), x = r(() => I(v.value.type, v.value.src)), S = r(() => x.value === "audio"), C = r(() => V(v.value, l.mediaSource ?? "preview")), T = r(() => S.value ? C.value : y.value), D = r(() => T.value.src), M = r(() => I(T.value.type, T.value.src)), N = r(() => y.value.width), P = r(() => y.value.height), F = r(() => B(v.value)), L = w(!1), R = r(() => L.value ? null : F.value), { effectivePreviewState: G, failSourceAttempt: K, imageElement: q, markSourceReady: J, noteSourceActivity: Y, retrySource: ee, retrying: te, sourceGeneration: ne, mediaElement: re } =
|
|
1461
|
+
let p = r(() => H(l.item)), g = r(() => U(l.item, l.mediaIndex)), v = r(() => W(l.item, g.value)), y = r(() => z(v.value, l.mediaSource ?? "preview")), x = r(() => I(v.value.type, v.value.src)), S = r(() => x.value === "audio"), C = r(() => V(v.value, l.mediaSource ?? "preview")), T = r(() => S.value ? C.value : y.value), D = r(() => T.value.src), M = r(() => I(T.value.type, T.value.src)), N = r(() => y.value.width), P = r(() => y.value.height), F = r(() => B(v.value)), L = w(!1), R = r(() => L.value ? null : F.value), { effectivePreviewState: G, failSourceAttempt: K, imageElement: q, markSourceReady: J, noteSourceActivity: Y, retrySource: ee, retrying: te, sourceGeneration: ne, mediaElement: re } = It({
|
|
1459
1462
|
identity: () => `${l.item.postId}:${g.value}:${l.mediaSource ?? "preview"}:${D.value}:${M.value ?? ""}`,
|
|
1460
1463
|
mediaIndex: () => g.value,
|
|
1461
1464
|
onError: (e) => d("error", e),
|
|
1462
1465
|
onReady: (e) => d("ready", e),
|
|
1463
1466
|
previewState: () => l.previewState
|
|
1464
1467
|
});
|
|
1465
|
-
|
|
1468
|
+
Pt({
|
|
1466
1469
|
inViewport: () => l.inViewport === !0,
|
|
1467
1470
|
item: () => l.item,
|
|
1468
1471
|
layout: () => l.layout,
|
|
@@ -1471,7 +1474,7 @@ var Ut = [
|
|
|
1471
1474
|
mediaReady: () => G.value === "ready",
|
|
1472
1475
|
mediaSource: () => l.mediaSource ?? "preview"
|
|
1473
1476
|
});
|
|
1474
|
-
let { currentTime: ie, duration: ae, effectiveMuted:
|
|
1477
|
+
let { currentTime: ie, duration: ae, effectiveMuted: oe, isMuted: se, isPlaying: X, onEnded: ce, onLoadedMetadata: Z, onPlaying: le, playbackAllowed: ue, seek: de, setVolume: fe, sync: Q, toggleMute: pe, togglePlayback: me, volume: he } = Ut({
|
|
1475
1478
|
active: () => l.active,
|
|
1476
1479
|
inViewport: () => l.inViewport === !0,
|
|
1477
1480
|
layout: () => l.layout,
|
|
@@ -1485,12 +1488,12 @@ var Ut = [
|
|
|
1485
1488
|
function _e(e) {
|
|
1486
1489
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
1487
1490
|
}
|
|
1488
|
-
let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } =
|
|
1491
|
+
let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } = St({
|
|
1489
1492
|
item: () => l.item,
|
|
1490
1493
|
layout: () => l.layout,
|
|
1491
1494
|
mediaIndex: () => g.value,
|
|
1492
1495
|
onChange: (e) => d("mediaChange", e)
|
|
1493
|
-
}), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } =
|
|
1496
|
+
}), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } = Ft({
|
|
1494
1497
|
active: () => l.active,
|
|
1495
1498
|
fetchPriority: () => l.fetchPriority,
|
|
1496
1499
|
layout: () => l.layout,
|
|
@@ -1529,8 +1532,8 @@ var Ut = [
|
|
|
1529
1532
|
tabindex: e.interactive && !e.leaving && !ge.value ? 0 : void 0,
|
|
1530
1533
|
onClick: i[34] ||= (t) => f(e.interactive && !ge.value, _e(t)),
|
|
1531
1534
|
onKeydown: [i[35] ||= A((t) => f(e.interactive && !ge.value, "keyboard"), ["enter"]), i[36] ||= A(j((t) => f(e.interactive && !ge.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1532
|
-
}, [c("div",
|
|
1533
|
-
e.cardHeader ? (b(), a(
|
|
1535
|
+
}, [c("div", Gt, [
|
|
1536
|
+
e.cardHeader ? (b(), a(rt, {
|
|
1534
1537
|
key: 0,
|
|
1535
1538
|
index: e.index,
|
|
1536
1539
|
item: e.item,
|
|
@@ -1569,12 +1572,12 @@ var Ut = [
|
|
|
1569
1572
|
class: "media-card-frame",
|
|
1570
1573
|
"data-media-index": g.value
|
|
1571
1574
|
}, [
|
|
1572
|
-
E(G) === "loading" ? (b(), s("div",
|
|
1575
|
+
E(G) === "loading" ? (b(), s("div", Jt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(G) === "error" ? (b(), a(st, {
|
|
1573
1576
|
key: 1,
|
|
1574
1577
|
component: e.mediaCard?.error?.component,
|
|
1575
|
-
label: E(
|
|
1578
|
+
label: E(nt)(D.value),
|
|
1576
1579
|
retrying: E(te),
|
|
1577
|
-
status: E(
|
|
1580
|
+
status: E(tt)(D.value),
|
|
1578
1581
|
onRetry: E(ee)
|
|
1579
1582
|
}, null, 8, [
|
|
1580
1583
|
"component",
|
|
@@ -1592,9 +1595,9 @@ var Ut = [
|
|
|
1592
1595
|
src: D.value,
|
|
1593
1596
|
autoplay: E(ue),
|
|
1594
1597
|
loop: !e.advanceOnMediaEnd,
|
|
1595
|
-
muted: E(
|
|
1598
|
+
muted: E(oe),
|
|
1596
1599
|
preload: E(Te),
|
|
1597
|
-
onLoadedmetadata: i[0] ||= (...e) => E(
|
|
1600
|
+
onLoadedmetadata: i[0] ||= (...e) => E(Z) && E(Z)(...e),
|
|
1598
1601
|
onProgress: i[1] ||= (...e) => E(Y) && E(Y)(...e),
|
|
1599
1602
|
onLoadeddata: i[2] ||= (...e) => E(Y) && E(Y)(...e),
|
|
1600
1603
|
onCanplay: i[3] ||= (...e) => E(Y) && E(Y)(...e),
|
|
@@ -1602,15 +1605,15 @@ var Ut = [
|
|
|
1602
1605
|
onTimeupdate: i[5] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1603
1606
|
onVolumechange: i[6] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1604
1607
|
onPlaying: i[7] ||= (...e) => E(le) && E(le)(...e),
|
|
1605
|
-
onPause: i[8] ||= (e) =>
|
|
1606
|
-
onEnded: i[9] ||= (...e) => E(
|
|
1608
|
+
onPause: i[8] ||= (e) => X.value = !1,
|
|
1609
|
+
onEnded: i[9] ||= (...e) => E(ce) && E(ce)(...e),
|
|
1607
1610
|
onError: i[10] ||= (...e) => E(K) && E(K)(...e)
|
|
1608
|
-
}, null, 40,
|
|
1611
|
+
}, null, 40, Yt)) : o("", !0),
|
|
1609
1612
|
S.value ? (b(), s("button", {
|
|
1610
1613
|
key: 3,
|
|
1611
1614
|
type: "button",
|
|
1612
1615
|
class: h(["media-audio-artwork media-preview", { "media-preview--ready": E(G) === "ready" }]),
|
|
1613
|
-
"aria-label": e.layout === "reel" ? E(
|
|
1616
|
+
"aria-label": e.layout === "reel" ? E(X) ? "Pause audio" : "Play audio" : "Audio",
|
|
1614
1617
|
disabled: e.layout !== "reel",
|
|
1615
1618
|
onClick: ke
|
|
1616
1619
|
}, [R.value ? (b(), s("img", {
|
|
@@ -1625,10 +1628,10 @@ var Ut = [
|
|
|
1625
1628
|
loading: E(Ce),
|
|
1626
1629
|
onLoad: i[11] ||= (t) => e.layout === "masonry" && E(J)(t),
|
|
1627
1630
|
onError: Ae
|
|
1628
|
-
}, null, 40,
|
|
1631
|
+
}, null, 40, Zt)) : (b(), s("span", Qt, [u(E(Ye), {
|
|
1629
1632
|
size: 64,
|
|
1630
1633
|
"stroke-width": 1.5
|
|
1631
|
-
})]))], 10,
|
|
1634
|
+
})]))], 10, Xt)) : E(we) ? (b(), s("video", {
|
|
1632
1635
|
key: 4,
|
|
1633
1636
|
ref_key: "mediaElement",
|
|
1634
1637
|
ref: re,
|
|
@@ -1642,10 +1645,10 @@ var Ut = [
|
|
|
1642
1645
|
height: P.value ?? void 0,
|
|
1643
1646
|
autoplay: E(ue),
|
|
1644
1647
|
loop: !e.advanceOnMediaEnd,
|
|
1645
|
-
muted: E(
|
|
1648
|
+
muted: E(oe),
|
|
1646
1649
|
playsinline: "",
|
|
1647
1650
|
preload: E(Te),
|
|
1648
|
-
onLoadedmetadata: i[12] ||= (...e) => E(
|
|
1651
|
+
onLoadedmetadata: i[12] ||= (...e) => E(Z) && E(Z)(...e),
|
|
1649
1652
|
onProgress: i[13] ||= (...e) => E(Y) && E(Y)(...e),
|
|
1650
1653
|
onLoadeddata: i[14] ||= (...e) => E(Y) && E(Y)(...e),
|
|
1651
1654
|
onCanplay: i[15] ||= (...e) => E(Y) && E(Y)(...e),
|
|
@@ -1653,11 +1656,11 @@ var Ut = [
|
|
|
1653
1656
|
onTimeupdate: i[17] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1654
1657
|
onVolumechange: i[18] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1655
1658
|
onPlaying: i[19] ||= (...e) => E(le) && E(le)(...e),
|
|
1656
|
-
onPause: i[20] ||= (e) =>
|
|
1657
|
-
onEnded: i[21] ||= (...e) => E(
|
|
1659
|
+
onPause: i[20] ||= (e) => X.value = !1,
|
|
1660
|
+
onEnded: i[21] ||= (...e) => E(ce) && E(ce)(...e),
|
|
1658
1661
|
onClick: ke,
|
|
1659
1662
|
onError: i[22] ||= (...e) => E(K) && E(K)(...e)
|
|
1660
|
-
}, null, 42,
|
|
1663
|
+
}, null, 42, $t)) : S.value ? o("", !0) : (b(), s("img", {
|
|
1661
1664
|
key: 5,
|
|
1662
1665
|
ref_key: "imageElement",
|
|
1663
1666
|
ref: q,
|
|
@@ -1672,11 +1675,11 @@ var Ut = [
|
|
|
1672
1675
|
loading: E(Ce),
|
|
1673
1676
|
onLoad: i[23] ||= (...e) => E(J) && E(J)(...e),
|
|
1674
1677
|
onError: i[24] ||= (...e) => E(K) && E(K)(...e)
|
|
1675
|
-
}, null, 42,
|
|
1676
|
-
], 8,
|
|
1678
|
+
}, null, 42, en))
|
|
1679
|
+
], 8, qt))]),
|
|
1677
1680
|
_: 1
|
|
1678
1681
|
}, 8, ["css", "name"]),
|
|
1679
|
-
u(
|
|
1682
|
+
u(vt, {
|
|
1680
1683
|
item: e.item,
|
|
1681
1684
|
"media-card": e.mediaCard,
|
|
1682
1685
|
"media-index": g.value,
|
|
@@ -1696,15 +1699,15 @@ var Ut = [
|
|
|
1696
1699
|
name: "vibe-reel-media-controls",
|
|
1697
1700
|
css: Ee.value
|
|
1698
1701
|
}, {
|
|
1699
|
-
default: k(() => [De.value ? (b(), a(
|
|
1702
|
+
default: k(() => [De.value ? (b(), a(gt, {
|
|
1700
1703
|
key: Oe.value,
|
|
1701
1704
|
"current-time": E(ie),
|
|
1702
1705
|
"data-control-post-id": Ee.value ? e.item.postId : void 0,
|
|
1703
1706
|
duration: E(ae),
|
|
1704
1707
|
layout: e.layout,
|
|
1705
1708
|
"media-type": S.value ? "audio" : "video",
|
|
1706
|
-
muted: E(
|
|
1707
|
-
playing: E(
|
|
1709
|
+
muted: E(se),
|
|
1710
|
+
playing: E(X),
|
|
1708
1711
|
volume: E(he),
|
|
1709
1712
|
onSeek: E(de),
|
|
1710
1713
|
onToggleMute: E(pe),
|
|
@@ -1736,13 +1739,13 @@ var Ut = [
|
|
|
1736
1739
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1737
1740
|
onClick: i[25] ||= j((e) => E(ve)(g.value - 1, e), ["stop"]),
|
|
1738
1741
|
onKeydown: i[26] ||= j(() => {}, ["stop"])
|
|
1739
|
-
}, [u(E(
|
|
1742
|
+
}, [u(E(qe), { size: 20 })], 40, tn), c("button", {
|
|
1740
1743
|
type: "button",
|
|
1741
1744
|
class: "media-carousel-control media-carousel-control--next",
|
|
1742
1745
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1743
1746
|
onClick: i[27] ||= j((e) => E(ve)(g.value + 1, e), ["stop"]),
|
|
1744
1747
|
onKeydown: i[28] ||= j(() => {}, ["stop"])
|
|
1745
|
-
}, [u(E(
|
|
1748
|
+
}, [u(E(Je), { size: 20 })], 40, nn)], 2)) : o("", !0),
|
|
1746
1749
|
ge.value ? (b(), s("button", {
|
|
1747
1750
|
key: 1,
|
|
1748
1751
|
class: "media-card-activator",
|
|
@@ -1750,9 +1753,9 @@ var Ut = [
|
|
|
1750
1753
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1751
1754
|
onClick: i[29] ||= j((e) => r.$emit("activate", _e(e)), ["stop"]),
|
|
1752
1755
|
onKeydown: i[30] ||= j(() => {}, ["stop"])
|
|
1753
|
-
}, null, 40,
|
|
1754
|
-
], 42,
|
|
1755
|
-
e.cardFooter ? (b(), a(
|
|
1756
|
+
}, null, 40, rn)) : o("", !0)
|
|
1757
|
+
], 42, Kt),
|
|
1758
|
+
e.cardFooter ? (b(), a(rt, {
|
|
1756
1759
|
key: 1,
|
|
1757
1760
|
index: e.index,
|
|
1758
1761
|
item: e.item,
|
|
@@ -1775,12 +1778,12 @@ var Ut = [
|
|
|
1775
1778
|
"style",
|
|
1776
1779
|
"total"
|
|
1777
1780
|
])) : o("", !0)
|
|
1778
|
-
])], 46,
|
|
1781
|
+
])], 46, Wt));
|
|
1779
1782
|
}
|
|
1780
1783
|
});
|
|
1781
1784
|
//#endregion
|
|
1782
1785
|
//#region src/components/useMasonryMediaVisibility.ts
|
|
1783
|
-
function
|
|
1786
|
+
function on(e) {
|
|
1784
1787
|
function t(t) {
|
|
1785
1788
|
return t.flatMap((t) => {
|
|
1786
1789
|
let n = e.items()[t];
|
|
@@ -1809,14 +1812,14 @@ function an(e) {
|
|
|
1809
1812
|
}
|
|
1810
1813
|
//#endregion
|
|
1811
1814
|
//#region src/components/useSettledMasonryFeedLayout.ts
|
|
1812
|
-
var
|
|
1813
|
-
function
|
|
1815
|
+
var sn = 1500;
|
|
1816
|
+
function cn(e) {
|
|
1814
1817
|
let t = w(0), n = 0, i = null, a = 0, o = 0, s = null, c = 0, l = null, u = null, d = 0;
|
|
1815
1818
|
function f() {
|
|
1816
1819
|
s !== null && (cancelAnimationFrame(s), s = null);
|
|
1817
1820
|
}
|
|
1818
1821
|
function p(e, t, n, r) {
|
|
1819
|
-
return i = e, l = t.slice(), u =
|
|
1822
|
+
return i = e, l = t.slice(), u = Ce(e.items, u ?? Se(r.items), n), c = e.items.length < t.length ? Math.max(c, r.height, e.height) : 0, e.items.length < t.length && e.items.length > n && m(), e;
|
|
1820
1823
|
}
|
|
1821
1824
|
function m() {
|
|
1822
1825
|
s === null && (s = requestAnimationFrame(() => {
|
|
@@ -1824,13 +1827,13 @@ function sn(e) {
|
|
|
1824
1827
|
let n = e.items(), r = i;
|
|
1825
1828
|
if (!r || r.items.length >= n.length) return;
|
|
1826
1829
|
let a = r.items.length;
|
|
1827
|
-
p(
|
|
1830
|
+
p(ve(n, e.width.value, {
|
|
1828
1831
|
additionalHeight: e.additionalHeight.value,
|
|
1829
1832
|
gap: e.gap.value,
|
|
1830
1833
|
minColumnWidth: e.minColumnWidth.value
|
|
1831
1834
|
}, r, a, {
|
|
1832
1835
|
throughIndex: e.packThroughIndex(),
|
|
1833
|
-
untilIndex: a +
|
|
1836
|
+
untilIndex: a + sn
|
|
1834
1837
|
}), n, a, r), t.value += 1;
|
|
1835
1838
|
}));
|
|
1836
1839
|
}
|
|
@@ -1844,22 +1847,22 @@ function sn(e) {
|
|
|
1844
1847
|
if (g && l && d === s && a === h.gap && n === h.additionalHeight && o === h.minColumnWidth) {
|
|
1845
1848
|
let t = 0, n = l, i = Math.min(n.length, r.length);
|
|
1846
1849
|
for (; t < i && n[t] === r[t];) t += 1;
|
|
1847
|
-
return t === r.length && t === n.length ? (g.items.length > 0 && g.items.length < r.length && m(), g) : (f(), p(
|
|
1850
|
+
return t === r.length && t === n.length ? (g.items.length > 0 && g.items.length < r.length && m(), g) : (f(), p(ve(r, s, h, g, t, {
|
|
1848
1851
|
throughIndex: e.packThroughIndex(),
|
|
1849
1852
|
untilBottom: e.packUntilBottom()
|
|
1850
1853
|
}), r, t, g));
|
|
1851
1854
|
}
|
|
1852
1855
|
f();
|
|
1853
|
-
let _ =
|
|
1854
|
-
return i = _, l = r.slice(), d = s, a = h.gap, n = h.additionalHeight, o = h.minColumnWidth, u =
|
|
1855
|
-
}), g = r(() => (h.value, u ??
|
|
1856
|
+
let _ = _e(r, s, h);
|
|
1857
|
+
return i = _, l = r.slice(), d = s, a = h.gap, n = h.additionalHeight, o = h.minColumnWidth, u = Se(_.items), c = 0, _;
|
|
1858
|
+
}), g = r(() => (h.value, u ?? Se(h.value.items)));
|
|
1856
1859
|
return v(f), {
|
|
1857
1860
|
ensurePackedThrough(n) {
|
|
1858
1861
|
let r = e.items(), a = i;
|
|
1859
1862
|
if (!a || a.items.length >= r.length || a.height >= n) return;
|
|
1860
1863
|
f();
|
|
1861
1864
|
let o = a.items.length;
|
|
1862
|
-
p(
|
|
1865
|
+
p(ve(r, e.width.value, {
|
|
1863
1866
|
additionalHeight: e.additionalHeight.value,
|
|
1864
1867
|
gap: e.gap.value,
|
|
1865
1868
|
minColumnWidth: e.minColumnWidth.value
|
|
@@ -1875,10 +1878,10 @@ function sn(e) {
|
|
|
1875
1878
|
}
|
|
1876
1879
|
//#endregion
|
|
1877
1880
|
//#region src/components/MasonryFeed.vue?vue&type=script&setup=true&lang.ts
|
|
1878
|
-
var
|
|
1881
|
+
var ln = { class: "masonry-feed-shell" }, un = ["aria-hidden", "inert"], dn = {
|
|
1879
1882
|
key: 0,
|
|
1880
1883
|
class: "masonry-feed-status-overlay"
|
|
1881
|
-
},
|
|
1884
|
+
}, fn = 6, pn = 12, mn = 250, hn = /* @__PURE__ */ d({
|
|
1882
1885
|
__name: "MasonryFeed",
|
|
1883
1886
|
props: {
|
|
1884
1887
|
enteringPostIds: {},
|
|
@@ -1916,13 +1919,13 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1916
1919
|
"visible"
|
|
1917
1920
|
],
|
|
1918
1921
|
setup(t, { expose: n, emit: i }) {
|
|
1919
|
-
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(
|
|
1922
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(fn), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = w([]), N = 0, P = null, F = null, I = null, L = null, R = r(() => ({
|
|
1920
1923
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1921
1924
|
gap: x.value,
|
|
1922
|
-
minColumnWidth:
|
|
1925
|
+
minColumnWidth: De(d.masonry)
|
|
1923
1926
|
})), z = [];
|
|
1924
1927
|
function B() {
|
|
1925
|
-
let e = N - k.value + C.value +
|
|
1928
|
+
let e = N - k.value + C.value + Oe(d.masonry, C.value), t = M.value.reduce((e, t) => {
|
|
1926
1929
|
let n = z[t];
|
|
1927
1930
|
return n ? Math.max(e, n.y + n.height) : e;
|
|
1928
1931
|
}, 0);
|
|
@@ -1931,7 +1934,7 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1931
1934
|
function V() {
|
|
1932
1935
|
return M.value.reduce((e, t) => Math.max(e, t), -1);
|
|
1933
1936
|
}
|
|
1934
|
-
let H =
|
|
1937
|
+
let H = cn({
|
|
1935
1938
|
additionalHeight: r(() => R.value.additionalHeight),
|
|
1936
1939
|
gap: x,
|
|
1937
1940
|
items: () => d.items,
|
|
@@ -1939,7 +1942,7 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1939
1942
|
packThroughIndex: V,
|
|
1940
1943
|
packUntilBottom: B,
|
|
1941
1944
|
width: y
|
|
1942
|
-
}), U = H.layout, W = H.viewportIndex, K = r(() => d.leavingPostIds.size === 0 ? null :
|
|
1945
|
+
}), U = H.layout, W = H.viewportIndex, K = r(() => d.leavingPostIds.size === 0 ? null : ye(d.items, y.value, R.value, U.value, (e) => d.leavingPostIds.has(d.items[e].postId), {
|
|
1943
1946
|
throughIndex: V(),
|
|
1944
1947
|
untilBottom: B()
|
|
1945
1948
|
})), q = r(() => {
|
|
@@ -1951,7 +1954,7 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1951
1954
|
} : U.value;
|
|
1952
1955
|
}), J = r(() => {
|
|
1953
1956
|
let e = K.value;
|
|
1954
|
-
return e ?
|
|
1957
|
+
return e ? we(e.items, e.retainedIndices, W.value, e.fromIndex) : null;
|
|
1955
1958
|
}), Y = r(() => (U.value, Math.max(T.value, H.reservedHeight(), d.leavingPostIds.size === 0 ? q.value.height : U.value.height))), ee = r(() => ({ height: `${Y.value}px` })), te = r(() => !d.infiniteScroll || C.value > 0 && k.value + q.value.height <= C.value + 1), ne = r(() => new Set(j.value)), re = r(() => M.value.flatMap((e) => {
|
|
1956
1959
|
let t = d.items[e], n = q.value.items[e];
|
|
1957
1960
|
return !t || !n || n.width <= 0 || n.height <= 0 ? [] : [{
|
|
@@ -1960,21 +1963,21 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1960
1963
|
item: t
|
|
1961
1964
|
}];
|
|
1962
1965
|
}));
|
|
1963
|
-
function
|
|
1966
|
+
function ie(e, t) {
|
|
1964
1967
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1965
1968
|
}
|
|
1966
|
-
function
|
|
1969
|
+
function oe(e, t) {
|
|
1967
1970
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1968
1971
|
}
|
|
1969
|
-
function
|
|
1972
|
+
function se(e) {
|
|
1970
1973
|
let t = {
|
|
1971
1974
|
scrollTop: N - k.value,
|
|
1972
1975
|
viewportHeight: C.value
|
|
1973
|
-
}, n = J.value, r =
|
|
1976
|
+
}, n = J.value, r = Ee(n ?? W.value, {
|
|
1974
1977
|
...t,
|
|
1975
1978
|
overscan: e
|
|
1976
1979
|
}).indices;
|
|
1977
|
-
return
|
|
1980
|
+
return ie(r, d.leavingPostIds.size === 0 ? [] : Ee(W.value, {
|
|
1978
1981
|
...t,
|
|
1979
1982
|
overscan: e
|
|
1980
1983
|
}).indices.filter((e) => {
|
|
@@ -1982,27 +1985,27 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1982
1985
|
return t !== void 0 && d.leavingPostIds.has(t.postId);
|
|
1983
1986
|
}));
|
|
1984
1987
|
}
|
|
1985
|
-
function
|
|
1986
|
-
let e =
|
|
1987
|
-
|
|
1988
|
-
let n =
|
|
1988
|
+
function X() {
|
|
1989
|
+
let e = se(0), t = se(Oe(d.masonry, C.value));
|
|
1990
|
+
oe(j.value, e) || (j.value = e);
|
|
1991
|
+
let n = Q(q.value.items, e.filter((e) => {
|
|
1989
1992
|
let t = d.items[e];
|
|
1990
1993
|
return t && !d.leavingPostIds.has(t.postId);
|
|
1991
1994
|
}), {
|
|
1992
1995
|
scrollTop: N - k.value,
|
|
1993
1996
|
viewportHeight: C.value
|
|
1994
1997
|
});
|
|
1995
|
-
|
|
1998
|
+
oe(A.value, n) || (A.value = n), oe(M.value, t) || (M.value = t);
|
|
1996
1999
|
}
|
|
1997
|
-
function
|
|
2000
|
+
function Z() {
|
|
1998
2001
|
if (L !== null) return;
|
|
1999
2002
|
L = -1;
|
|
2000
2003
|
let e = requestAnimationFrame(() => {
|
|
2001
|
-
L = null,
|
|
2004
|
+
L = null, X();
|
|
2002
2005
|
});
|
|
2003
2006
|
L !== null && (L = e);
|
|
2004
2007
|
}
|
|
2005
|
-
|
|
2008
|
+
on({
|
|
2006
2009
|
fullyVisibleIndices: () => A.value,
|
|
2007
2010
|
items: () => d.items,
|
|
2008
2011
|
mediaIndices: () => d.mediaIndices,
|
|
@@ -2011,10 +2014,10 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2011
2014
|
previewStates: () => d.previewStates,
|
|
2012
2015
|
visibleIndices: () => j.value
|
|
2013
2016
|
});
|
|
2014
|
-
function
|
|
2017
|
+
function le(e) {
|
|
2015
2018
|
let t = q.value.items[e], n = d.items[e]?.postId;
|
|
2016
2019
|
if (!t || t.width <= 0 || t.height <= 0) return {};
|
|
2017
|
-
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ?
|
|
2020
|
+
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? ue({
|
|
2018
2021
|
containerHeight: Math.max(T.value, U.value.height),
|
|
2019
2022
|
gap: x.value
|
|
2020
2023
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -2032,31 +2035,31 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2032
2035
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
2033
2036
|
T.value = Math.max(0, e.clientHeight - n);
|
|
2034
2037
|
let r = g.value;
|
|
2035
|
-
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop,
|
|
2038
|
+
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, X());
|
|
2036
2039
|
}
|
|
2037
|
-
function
|
|
2040
|
+
function fe(e) {
|
|
2038
2041
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
2039
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
2042
|
+
y.value = e.clientWidth, x.value = Math.min(pn, Math.max(fn, t * .0075)), de();
|
|
2040
2043
|
}
|
|
2041
2044
|
function pe(e) {
|
|
2042
2045
|
let t = e.currentTarget;
|
|
2043
|
-
t && (N = t.scrollTop, H.ensurePackedThrough(B()),
|
|
2046
|
+
t && (N = t.scrollTop, H.ensurePackedThrough(B()), Z(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ce(t) && f("loadMore"));
|
|
2044
2047
|
}
|
|
2045
2048
|
function me() {
|
|
2046
2049
|
let e = p.value;
|
|
2047
|
-
Date.now() >= l && !d.loadMoreLocked && e &&
|
|
2050
|
+
Date.now() >= l && !d.loadMoreLocked && e && ce(e) && f("loadMore");
|
|
2048
2051
|
}
|
|
2049
2052
|
O(() => d.items.length, (e, t) => {
|
|
2050
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2053
|
+
e > 0 && e < t && (l = Date.now() + mn);
|
|
2051
2054
|
});
|
|
2052
2055
|
function he() {
|
|
2053
2056
|
return p.value;
|
|
2054
2057
|
}
|
|
2055
2058
|
return O(g, (e) => {
|
|
2056
|
-
P?.disconnect(), P = null, I !== null && cancelAnimationFrame(I), e && (
|
|
2059
|
+
P?.disconnect(), P = null, I !== null && cancelAnimationFrame(I), e && (fe(e), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(([t]) => {
|
|
2057
2060
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
2058
2061
|
Math.abs(n - y.value) < .5 || (I = requestAnimationFrame(() => {
|
|
2059
|
-
I = null,
|
|
2062
|
+
I = null, fe(e);
|
|
2060
2063
|
}));
|
|
2061
2064
|
}), P.observe(e)));
|
|
2062
2065
|
}), O(p, (e) => {
|
|
@@ -2067,12 +2070,12 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2067
2070
|
U,
|
|
2068
2071
|
q,
|
|
2069
2072
|
() => d.masonry
|
|
2070
|
-
],
|
|
2073
|
+
], X, { flush: "post" }), v(() => {
|
|
2071
2074
|
P?.disconnect(), F?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
|
|
2072
2075
|
}), n({
|
|
2073
2076
|
getScrollElement: he,
|
|
2074
2077
|
loadIfNearBottom: me
|
|
2075
|
-
}), (n, r) => (b(), s("div",
|
|
2078
|
+
}), (n, r) => (b(), s("div", ln, [
|
|
2076
2079
|
c("main", {
|
|
2077
2080
|
id: m,
|
|
2078
2081
|
ref_key: "galleryElement",
|
|
@@ -2088,7 +2091,7 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2088
2091
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
2089
2092
|
style: _(ee.value),
|
|
2090
2093
|
"aria-label": "Media gallery"
|
|
2091
|
-
}, [(b(!0), s(e, null, S(re.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
2094
|
+
}, [(b(!0), s(e, null, S(re.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(an, {
|
|
2092
2095
|
key: n.postId,
|
|
2093
2096
|
class: "masonry-item",
|
|
2094
2097
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -2100,7 +2103,7 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2100
2103
|
"in-viewport": ne.value.has(r),
|
|
2101
2104
|
index: r,
|
|
2102
2105
|
item: n,
|
|
2103
|
-
"item-style":
|
|
2106
|
+
"item-style": le(r),
|
|
2104
2107
|
interactive: "",
|
|
2105
2108
|
layout: "masonry",
|
|
2106
2109
|
"loaded-count": t.items.length,
|
|
@@ -2130,8 +2133,8 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2130
2133
|
"onMediaChange",
|
|
2131
2134
|
"onReady",
|
|
2132
2135
|
"onError"
|
|
2133
|
-
]))), 128))], 6)], 42,
|
|
2134
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && te.value || !t.hasNext && t.canRetryEnd ? (b(), s("div",
|
|
2136
|
+
]))), 128))], 6)], 42, un),
|
|
2137
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && te.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", dn, [u(ae, {
|
|
2135
2138
|
actions: t.feedFooterActions,
|
|
2136
2139
|
"can-retry-end": t.canRetryEnd,
|
|
2137
2140
|
"feed-footer": t.feedFooter,
|
|
@@ -2154,7 +2157,7 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2154
2157
|
"show-load-more",
|
|
2155
2158
|
"state"
|
|
2156
2159
|
])])) : o("", !0),
|
|
2157
|
-
u(
|
|
2160
|
+
u(Le, {
|
|
2158
2161
|
"content-size": q.value.height,
|
|
2159
2162
|
"controls-id": m,
|
|
2160
2163
|
"scroll-element": p.value,
|
|
@@ -2166,8 +2169,8 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2166
2169
|
])
|
|
2167
2170
|
]));
|
|
2168
2171
|
}
|
|
2169
|
-
}),
|
|
2170
|
-
function
|
|
2172
|
+
}), gn = 300;
|
|
2173
|
+
function _n(e, t, n) {
|
|
2171
2174
|
let r = e.scrollTop;
|
|
2172
2175
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
2173
2176
|
e.setAttribute("data-transitioning", "");
|
|
@@ -2175,7 +2178,7 @@ function gn(e, t, n) {
|
|
|
2175
2178
|
return new Promise((n) => {
|
|
2176
2179
|
let o = (s) => {
|
|
2177
2180
|
a += 1;
|
|
2178
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
2181
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / gn), u = 1 - (1 - l) ** 3;
|
|
2179
2182
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
2180
2183
|
requestAnimationFrame(o);
|
|
2181
2184
|
return;
|
|
@@ -2187,7 +2190,7 @@ function gn(e, t, n) {
|
|
|
2187
2190
|
}
|
|
2188
2191
|
//#endregion
|
|
2189
2192
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
2190
|
-
var
|
|
2193
|
+
var vn = ["aria-label"], yn = /* @__PURE__ */ d({
|
|
2191
2194
|
__name: "ReelAutoAdvanceProgress",
|
|
2192
2195
|
props: {
|
|
2193
2196
|
durationMs: {},
|
|
@@ -2205,9 +2208,9 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2205
2208
|
class: "reel-auto-advance-progress",
|
|
2206
2209
|
style: _(a.value),
|
|
2207
2210
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
2208
|
-
}, null, 36)], 8,
|
|
2211
|
+
}, null, 36)], 8, vn));
|
|
2209
2212
|
}
|
|
2210
|
-
}),
|
|
2213
|
+
}), bn = { class: "reel-viewport" }, xn = ["data-active-post-id", "data-active-media-index"], Sn = ["role", "data-status"], Cn = ["disabled"], wn = 300, Tn = 250, En = /* @__PURE__ */ d({
|
|
2211
2214
|
__name: "ReelFeed",
|
|
2212
2215
|
props: {
|
|
2213
2216
|
initialPostId: {},
|
|
@@ -2270,49 +2273,49 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2270
2273
|
].join(":")), J = r(() => {
|
|
2271
2274
|
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value < H(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
2272
2275
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
2273
|
-
}), Y = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && z.value !== "loading" && !K.value), ee = r(() => !u.infiniteScroll || u.items.length <= 1), te = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
|
|
2274
|
-
function
|
|
2276
|
+
}), Y = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && z.value !== "loading" && !K.value), ee = r(() => !u.infiniteScroll || u.items.length <= 1), te = r(() => u.reelForward.status === "end" && u.hasNext && !u.infiniteScroll && !u.loadMoreLocked), ne = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : te.value ? "Load the next page to continue." : "You reached the end of this feed.");
|
|
2277
|
+
function re(e) {
|
|
2275
2278
|
return { gridRow: `${e + 1}` };
|
|
2276
2279
|
}
|
|
2277
|
-
function
|
|
2280
|
+
function ie(e) {
|
|
2278
2281
|
let t = k || e.clientHeight;
|
|
2279
2282
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
2280
2283
|
}
|
|
2281
|
-
function
|
|
2284
|
+
function oe(e) {
|
|
2282
2285
|
let t = e.currentTarget;
|
|
2283
2286
|
if (!t) return;
|
|
2284
2287
|
let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
2285
|
-
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value =
|
|
2288
|
+
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ie(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && ce(t) && d("loadMore");
|
|
2286
2289
|
}
|
|
2287
|
-
function
|
|
2290
|
+
function se() {
|
|
2288
2291
|
let e = f.value;
|
|
2289
|
-
e && (C.value = !1,
|
|
2292
|
+
e && (C.value = !1, le(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
2290
2293
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
2291
|
-
}),
|
|
2294
|
+
}), X());
|
|
2292
2295
|
}
|
|
2293
|
-
function
|
|
2296
|
+
function X() {
|
|
2294
2297
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
2295
2298
|
M = null;
|
|
2296
2299
|
let e = f.value;
|
|
2297
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
2300
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), le(!1);
|
|
2298
2301
|
}, 120);
|
|
2299
2302
|
}
|
|
2300
2303
|
function Z() {
|
|
2301
|
-
|
|
2304
|
+
le(!0);
|
|
2302
2305
|
let e = f.value;
|
|
2303
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
2306
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), X();
|
|
2304
2307
|
}
|
|
2305
|
-
function
|
|
2308
|
+
function le(e) {
|
|
2306
2309
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
2307
2310
|
}
|
|
2308
|
-
function
|
|
2311
|
+
function ue() {
|
|
2309
2312
|
let e = f.value;
|
|
2310
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
2313
|
+
Date.now() >= l && !u.loadMoreLocked && e && ce(e) && d("loadMore");
|
|
2311
2314
|
}
|
|
2312
2315
|
O(() => u.items.length, (e, t) => {
|
|
2313
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2316
|
+
e > 0 && e < t && (l = Date.now() + Tn);
|
|
2314
2317
|
});
|
|
2315
|
-
function
|
|
2318
|
+
function de(e) {
|
|
2316
2319
|
let t = I.value;
|
|
2317
2320
|
if (!t) return !1;
|
|
2318
2321
|
let n = H(t).length;
|
|
@@ -2320,34 +2323,34 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2320
2323
|
let r = (R.value + e + n) % n;
|
|
2321
2324
|
return d("mediaChange", t.postId, r), !0;
|
|
2322
2325
|
}
|
|
2323
|
-
function
|
|
2326
|
+
function fe(e) {
|
|
2324
2327
|
let t = x.value + e;
|
|
2325
|
-
return !f.value || t < 0 || t >= u.items.length ? !1 : (
|
|
2328
|
+
return !f.value || t < 0 || t >= u.items.length ? !1 : (he(t), !0);
|
|
2326
2329
|
}
|
|
2327
|
-
function
|
|
2330
|
+
function Q(e, t) {
|
|
2328
2331
|
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
2329
|
-
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value &&
|
|
2332
|
+
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && he(n), !0);
|
|
2330
2333
|
}
|
|
2331
|
-
function
|
|
2334
|
+
function pe() {
|
|
2332
2335
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2333
2336
|
}
|
|
2334
|
-
function
|
|
2337
|
+
function me(e) {
|
|
2335
2338
|
let t = f.value;
|
|
2336
2339
|
if (!t) return Promise.resolve();
|
|
2337
2340
|
let n = e * (k || t.clientHeight);
|
|
2338
|
-
return x.value = e,
|
|
2341
|
+
return x.value = e, _n(t, n, pe());
|
|
2339
2342
|
}
|
|
2340
|
-
function
|
|
2341
|
-
|
|
2343
|
+
function he(e) {
|
|
2344
|
+
me(e);
|
|
2342
2345
|
}
|
|
2343
|
-
async function
|
|
2346
|
+
async function ge(e) {
|
|
2344
2347
|
let t = u.items.findIndex((t) => t.postId === e);
|
|
2345
|
-
return t < 0 || t === x.value ? !1 : (await
|
|
2348
|
+
return t < 0 || t === x.value ? !1 : (await me(t), !0);
|
|
2346
2349
|
}
|
|
2347
|
-
async function
|
|
2348
|
-
return
|
|
2350
|
+
async function _e(e) {
|
|
2351
|
+
return de(e) ? (pe() || await new Promise((e) => setTimeout(e, wn)), !0) : !1;
|
|
2349
2352
|
}
|
|
2350
|
-
function
|
|
2353
|
+
function ve() {
|
|
2351
2354
|
if (!u.reelAutoAdvance.enabled) return;
|
|
2352
2355
|
let e = I.value;
|
|
2353
2356
|
if (!e) return;
|
|
@@ -2357,34 +2360,34 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2357
2360
|
}
|
|
2358
2361
|
let t = x.value + 1, n = u.items[t];
|
|
2359
2362
|
if (!n) {
|
|
2360
|
-
u.hasNext && !u.loadMoreLocked && d("loadMore");
|
|
2363
|
+
u.hasNext && u.infiniteScroll && !u.loadMoreLocked && d("loadMore");
|
|
2361
2364
|
return;
|
|
2362
2365
|
}
|
|
2363
|
-
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0),
|
|
2366
|
+
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), he(t);
|
|
2364
2367
|
}
|
|
2365
|
-
function
|
|
2366
|
-
!u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !K.value ||
|
|
2368
|
+
function ye(e, t) {
|
|
2369
|
+
!u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !K.value || ve();
|
|
2367
2370
|
}
|
|
2368
2371
|
return O(f, (e) => {
|
|
2369
|
-
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(
|
|
2372
|
+
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(se), A.observe(e)));
|
|
2370
2373
|
}), O(() => u.items.length, async (e) => {
|
|
2371
2374
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
2372
|
-
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(),
|
|
2375
|
+
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), se();
|
|
2373
2376
|
}), O(F, (e) => {
|
|
2374
2377
|
e !== void 0 && d("activeChange", e);
|
|
2375
2378
|
}, { immediate: !0 }), y(() => {
|
|
2376
|
-
window.addEventListener("resize", Z), window.addEventListener("orientationchange", Z), g >= 0 && m(
|
|
2379
|
+
window.addEventListener("resize", Z), window.addEventListener("orientationchange", Z), g >= 0 && m(se);
|
|
2377
2380
|
}), v(() => {
|
|
2378
2381
|
window.removeEventListener("resize", Z), window.removeEventListener("orientationchange", Z), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
2379
2382
|
}), n({
|
|
2380
2383
|
activeIndex: x,
|
|
2381
2384
|
activePostId: F,
|
|
2382
|
-
changeActiveMedia:
|
|
2383
|
-
loadIfNearBottom:
|
|
2384
|
-
moveActivePost:
|
|
2385
|
-
navigateToItem:
|
|
2386
|
-
transitionActiveMedia:
|
|
2387
|
-
transitionActivePost:
|
|
2385
|
+
changeActiveMedia: de,
|
|
2386
|
+
loadIfNearBottom: ue,
|
|
2387
|
+
moveActivePost: fe,
|
|
2388
|
+
navigateToItem: Q,
|
|
2389
|
+
transitionActiveMedia: _e,
|
|
2390
|
+
transitionActivePost: ge
|
|
2388
2391
|
}), (n, r) => (b(), s("main", {
|
|
2389
2392
|
class: h(["reel-shell", {
|
|
2390
2393
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -2392,7 +2395,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2392
2395
|
}]),
|
|
2393
2396
|
"data-layout-mode": "reel"
|
|
2394
2397
|
}, [
|
|
2395
|
-
t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(
|
|
2398
|
+
t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(rt, {
|
|
2396
2399
|
key: 0,
|
|
2397
2400
|
index: x.value,
|
|
2398
2401
|
item: I.value,
|
|
@@ -2414,19 +2417,19 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2414
2417
|
"style",
|
|
2415
2418
|
"total"
|
|
2416
2419
|
])) : o("", !0),
|
|
2417
|
-
c("div",
|
|
2420
|
+
c("div", bn, [c("div", {
|
|
2418
2421
|
ref_key: "galleryElement",
|
|
2419
2422
|
ref: f,
|
|
2420
2423
|
class: "gallery-shell reel-feed",
|
|
2421
2424
|
"data-active-post-id": F.value,
|
|
2422
2425
|
"data-active-media-index": R.value,
|
|
2423
|
-
onScrollPassive:
|
|
2426
|
+
onScrollPassive: oe
|
|
2424
2427
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
2425
2428
|
key: 1,
|
|
2426
2429
|
class: "reel-track",
|
|
2427
2430
|
style: _(N.value),
|
|
2428
2431
|
"aria-label": "Media gallery"
|
|
2429
|
-
}, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(
|
|
2432
|
+
}, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(an, {
|
|
2430
2433
|
key: n.postId,
|
|
2431
2434
|
active: i === x.value && !C.value,
|
|
2432
2435
|
"advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
|
|
@@ -2435,7 +2438,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2435
2438
|
"fetch-priority": e,
|
|
2436
2439
|
index: i,
|
|
2437
2440
|
item: n,
|
|
2438
|
-
"item-style":
|
|
2441
|
+
"item-style": re(i),
|
|
2439
2442
|
"media-card": t.mediaCard,
|
|
2440
2443
|
layout: "reel",
|
|
2441
2444
|
"loaded-count": t.items.length,
|
|
@@ -2447,7 +2450,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2447
2450
|
"stationary-reel-controls": "",
|
|
2448
2451
|
total: t.total,
|
|
2449
2452
|
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
2450
|
-
onEnded: (e) =>
|
|
2453
|
+
onEnded: (e) => ye(n.postId, e),
|
|
2451
2454
|
onReady: (e) => d("ready", n.postId, e),
|
|
2452
2455
|
onReelAudioChange: r[1] ||= (e) => d("reelAudioChange", e),
|
|
2453
2456
|
onError: (e) => d("error", n.postId, e)
|
|
@@ -2475,12 +2478,13 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2475
2478
|
class: "reel-forward-status",
|
|
2476
2479
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
2477
2480
|
"data-status": t.reelForward.status
|
|
2478
|
-
}, [c("p", null, T(
|
|
2481
|
+
}, [c("p", null, T(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
2479
2482
|
key: 0,
|
|
2480
2483
|
class: "reel-forward-retry",
|
|
2481
2484
|
type: "button",
|
|
2485
|
+
disabled: t.loadMoreLocked,
|
|
2482
2486
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
2483
|
-
}, "
|
|
2487
|
+
}, T(te.value ? "Load more" : "Retry"), 9, Cn)) : o("", !0)], 8, Sn)), t.reelForward.status === "idle" ? (b(), a(ae, {
|
|
2484
2488
|
key: 2,
|
|
2485
2489
|
actions: t.feedFooterActions,
|
|
2486
2490
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2503,13 +2507,13 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2503
2507
|
"load-more-locked",
|
|
2504
2508
|
"show-load-more",
|
|
2505
2509
|
"state"
|
|
2506
|
-
])) : o("", !0)], 40,
|
|
2510
|
+
])) : o("", !0)], 40, xn), c("div", {
|
|
2507
2511
|
ref_key: "reelControlsElement",
|
|
2508
2512
|
ref: p,
|
|
2509
2513
|
class: "reel-media-controls-host",
|
|
2510
2514
|
"data-test": "reel-media-controls-host"
|
|
2511
2515
|
}, null, 512)]),
|
|
2512
|
-
t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(
|
|
2516
|
+
t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(rt, {
|
|
2513
2517
|
key: 1,
|
|
2514
2518
|
index: x.value,
|
|
2515
2519
|
item: I.value,
|
|
@@ -2531,24 +2535,24 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2531
2535
|
"style",
|
|
2532
2536
|
"total"
|
|
2533
2537
|
])) : o("", !0),
|
|
2534
|
-
Y.value ? (b(), a(
|
|
2538
|
+
Y.value ? (b(), a(yn, {
|
|
2535
2539
|
key: q.value,
|
|
2536
2540
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
2537
2541
|
label: J.value,
|
|
2538
|
-
onComplete:
|
|
2542
|
+
onComplete: ve
|
|
2539
2543
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
2540
2544
|
], 2));
|
|
2541
2545
|
}
|
|
2542
|
-
}),
|
|
2546
|
+
}), Dn = ["data-info-sheet-open", "data-info-sheet-mode"], On = ["aria-hidden", "inert"], kn = {
|
|
2543
2547
|
key: 0,
|
|
2544
2548
|
class: "reel-info-sheet-layer",
|
|
2545
2549
|
"data-test": "reel-info-sheet"
|
|
2546
|
-
},
|
|
2550
|
+
}, An = [
|
|
2547
2551
|
"role",
|
|
2548
2552
|
"aria-modal",
|
|
2549
2553
|
"tabindex",
|
|
2550
2554
|
"data-active-post-id"
|
|
2551
|
-
],
|
|
2555
|
+
], jn = /* @__PURE__ */ d({
|
|
2552
2556
|
__name: "ReelLayout",
|
|
2553
2557
|
props: {
|
|
2554
2558
|
forwardIndex: { default: null },
|
|
@@ -2675,7 +2679,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2675
2679
|
class: "reel-layout-main",
|
|
2676
2680
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
2677
2681
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
2678
|
-
}, [u(
|
|
2682
|
+
}, [u(En, {
|
|
2679
2683
|
ref_key: "reelFeed",
|
|
2680
2684
|
ref: p,
|
|
2681
2685
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2729,8 +2733,8 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2729
2733
|
"reel-forward",
|
|
2730
2734
|
"state",
|
|
2731
2735
|
"total"
|
|
2732
|
-
])], 8,
|
|
2733
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2736
|
+
])], 8, On), u(n, { name: "vibe-info-sheet" }, {
|
|
2737
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", kn, [c("aside", {
|
|
2734
2738
|
ref_key: "sheetElement",
|
|
2735
2739
|
ref: _,
|
|
2736
2740
|
class: "reel-info-sheet",
|
|
@@ -2739,14 +2743,14 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2739
2743
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2740
2744
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2741
2745
|
"data-active-post-id": T.value?.postId
|
|
2742
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2746
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, An)])) : o("", !0)]),
|
|
2743
2747
|
_: 1
|
|
2744
|
-
})], 10,
|
|
2748
|
+
})], 10, Dn));
|
|
2745
2749
|
}
|
|
2746
2750
|
});
|
|
2747
2751
|
//#endregion
|
|
2748
2752
|
//#region src/core/mediaLifecycle.ts
|
|
2749
|
-
function
|
|
2753
|
+
function Mn(e, t, n, r, i) {
|
|
2750
2754
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2751
2755
|
if (!o) return null;
|
|
2752
2756
|
let s = U(o, n), c = W(o, s);
|
|
@@ -2762,7 +2766,7 @@ function An(e, t, n, r, i) {
|
|
|
2762
2766
|
postIndex: a
|
|
2763
2767
|
};
|
|
2764
2768
|
}
|
|
2765
|
-
function
|
|
2769
|
+
function Nn(e, t) {
|
|
2766
2770
|
O(() => {
|
|
2767
2771
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2768
2772
|
return {
|
|
@@ -2772,13 +2776,13 @@ function jn(e, t) {
|
|
|
2772
2776
|
};
|
|
2773
2777
|
}, (n, r) => {
|
|
2774
2778
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2775
|
-
let i =
|
|
2779
|
+
let i = Mn(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2776
2780
|
i && t(i);
|
|
2777
2781
|
}, { flush: "sync" });
|
|
2778
2782
|
}
|
|
2779
2783
|
//#endregion
|
|
2780
2784
|
//#region src/components/useMediaLifecycle.ts
|
|
2781
|
-
function
|
|
2785
|
+
function Pn(e, t) {
|
|
2782
2786
|
let n = /* @__PURE__ */ new Set(), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = w(/* @__PURE__ */ new Map()), s = () => e.reelMediaSource === "preview" ? i : e.reelMediaSource === "mobile" ? o : a, c = r(() => s().value), l = /* @__PURE__ */ new Set();
|
|
2783
2787
|
function u() {
|
|
2784
2788
|
n.clear(), l.clear(), i.value = /* @__PURE__ */ new Map(), a.value = /* @__PURE__ */ new Map(), o.value = /* @__PURE__ */ new Map();
|
|
@@ -2788,7 +2792,7 @@ function Mn(e, t) {
|
|
|
2788
2792
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2789
2793
|
}
|
|
2790
2794
|
function f(t, n, r, i) {
|
|
2791
|
-
return
|
|
2795
|
+
return Mn(e, t, n, r, i);
|
|
2792
2796
|
}
|
|
2793
2797
|
function p(e, n, r, i) {
|
|
2794
2798
|
let a = f(e, n, r, i);
|
|
@@ -2821,7 +2825,7 @@ function Mn(e, t) {
|
|
|
2821
2825
|
function b(e, t) {
|
|
2822
2826
|
y(e, t, "masonry", null);
|
|
2823
2827
|
}
|
|
2824
|
-
return
|
|
2828
|
+
return Nn(e, t.reelChange), O(() => {
|
|
2825
2829
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2826
2830
|
return {
|
|
2827
2831
|
mediaIndex: n,
|
|
@@ -2846,16 +2850,16 @@ function Mn(e, t) {
|
|
|
2846
2850
|
}
|
|
2847
2851
|
//#endregion
|
|
2848
2852
|
//#region src/core/reelEscapeStack.ts
|
|
2849
|
-
var
|
|
2850
|
-
function
|
|
2851
|
-
return
|
|
2852
|
-
let t =
|
|
2853
|
-
t >= 0 &&
|
|
2853
|
+
var Fn = [];
|
|
2854
|
+
function In(e) {
|
|
2855
|
+
return Fn.push(e), () => {
|
|
2856
|
+
let t = Fn.indexOf(e);
|
|
2857
|
+
t >= 0 && Fn.splice(t, 1);
|
|
2854
2858
|
};
|
|
2855
2859
|
}
|
|
2856
|
-
function
|
|
2860
|
+
function Ln(e) {
|
|
2857
2861
|
if (!e.isActive()) return !1;
|
|
2858
|
-
let t =
|
|
2862
|
+
let t = Fn.filter((e) => e.isActive()), n = e.element();
|
|
2859
2863
|
return n !== null && t.some((t) => {
|
|
2860
2864
|
if (t === e) return !1;
|
|
2861
2865
|
let r = t.element();
|
|
@@ -2871,14 +2875,14 @@ function Fn(e) {
|
|
|
2871
2875
|
}
|
|
2872
2876
|
//#endregion
|
|
2873
2877
|
//#region src/components/useReelKeyboard.ts
|
|
2874
|
-
function
|
|
2878
|
+
function Rn(e) {
|
|
2875
2879
|
let t = {
|
|
2876
2880
|
element: e.element,
|
|
2877
2881
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2878
2882
|
}, n = null;
|
|
2879
2883
|
function r(n) {
|
|
2880
2884
|
let r = t.isActive();
|
|
2881
|
-
if (n.key === "Escape" && r && !
|
|
2885
|
+
if (n.key === "Escape" && r && !Ln(t)) return;
|
|
2882
2886
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2883
2887
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2884
2888
|
return;
|
|
@@ -2898,14 +2902,14 @@ function In(e) {
|
|
|
2898
2902
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2899
2903
|
}
|
|
2900
2904
|
y(() => {
|
|
2901
|
-
n =
|
|
2905
|
+
n = In(t), window.addEventListener("keydown", r);
|
|
2902
2906
|
}), v(() => {
|
|
2903
2907
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2904
2908
|
});
|
|
2905
2909
|
}
|
|
2906
2910
|
//#endregion
|
|
2907
2911
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2908
|
-
var
|
|
2912
|
+
var zn = 35, Bn = 420, Vn = /* @__PURE__ */ d({
|
|
2909
2913
|
__name: "VibeSurface",
|
|
2910
2914
|
props: {
|
|
2911
2915
|
canRetryEnd: { type: Boolean },
|
|
@@ -2934,7 +2938,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
2934
2938
|
"retryForward"
|
|
2935
2939
|
],
|
|
2936
2940
|
setup(t, { expose: i, emit: c }) {
|
|
2937
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() =>
|
|
2941
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => J(l.state, T.value)), { markMasonryFullyVisible: A, markMasonryVisible: j, markPreviewError: M, markPreviewReady: N, markReelError: P, markReelReady: F, originalStates: I, previewStates: L, reelStates: R, resetMediaLifecycle: z } = Pn(l.state, {
|
|
2938
2942
|
fullyVisible: (e) => d("mediaFullyVisible", e),
|
|
2939
2943
|
ready: (e) => d("mediaReady", e),
|
|
2940
2944
|
reelChange: (e) => d("reelMediaChange", e),
|
|
@@ -2943,7 +2947,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
2943
2947
|
function K() {
|
|
2944
2948
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2945
2949
|
}
|
|
2946
|
-
function
|
|
2950
|
+
function q() {
|
|
2947
2951
|
V !== null && cancelAnimationFrame(V), V = requestAnimationFrame(() => {
|
|
2948
2952
|
V = requestAnimationFrame(() => {
|
|
2949
2953
|
V = null, y.value = /* @__PURE__ */ new Set();
|
|
@@ -2978,36 +2982,49 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
2978
2982
|
function ae(e, t) {
|
|
2979
2983
|
W = e, G = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
|
|
2980
2984
|
}
|
|
2981
|
-
function
|
|
2985
|
+
function oe(e) {
|
|
2982
2986
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2983
2987
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2984
2988
|
}
|
|
2985
2989
|
function se(e, t) {
|
|
2986
2990
|
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
|
|
2987
|
-
let n = [...new Set(e)], r = n.filter(
|
|
2988
|
-
if (
|
|
2989
|
-
let
|
|
2990
|
-
return
|
|
2991
|
-
|
|
2992
|
-
}), y.value = new Set([...y.value].filter((e) => !
|
|
2991
|
+
let n = [...new Set(e)], r = new Set(Array.from(g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [], (e) => e.dataset.postId)), i = n.filter((e) => r.has(String(e)));
|
|
2992
|
+
if (i.length === 0) return 0;
|
|
2993
|
+
let a = new Map(C.value), o = t?.staggerMs ?? zn;
|
|
2994
|
+
return i.forEach((e, t) => {
|
|
2995
|
+
a.set(e, t * o);
|
|
2996
|
+
}), y.value = new Set([...y.value].filter((e) => !i.includes(e))), S.value = new Set([...S.value, ...n]), C.value = a, Bn + (i.length - 1) * o;
|
|
2997
|
+
}
|
|
2998
|
+
function ce() {
|
|
2999
|
+
S.value = /* @__PURE__ */ new Set(), C.value = /* @__PURE__ */ new Map();
|
|
3000
|
+
}
|
|
3001
|
+
async function Z(e, t) {
|
|
3002
|
+
if (t.aborted || se(e, { staggerMs: 0 }) === 0 || (await m(), t.aborted)) return;
|
|
3003
|
+
let n = g.value?.querySelectorAll(".masonry-feed .media-card--leaving") ?? [], r = Array.from(n).flatMap((e) => (getComputedStyle(e).opacity, e.getAnimations?.().filter((e) => e.effect?.getTiming().iterations !== Infinity) ?? []));
|
|
3004
|
+
await new Promise((e) => {
|
|
3005
|
+
let n = () => {
|
|
3006
|
+
t.removeEventListener("abort", n), e();
|
|
3007
|
+
};
|
|
3008
|
+
t.addEventListener("abort", n, { once: !0 }), t.aborted ? n() : Promise.allSettled(r.map((e) => e.finished)).then(n);
|
|
3009
|
+
});
|
|
2993
3010
|
}
|
|
2994
|
-
function
|
|
2995
|
-
let n =
|
|
3011
|
+
function le(e, t) {
|
|
3012
|
+
let n = oe(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2996
3013
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2997
3014
|
r.classList.remove("media-card-focus-silent");
|
|
2998
3015
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2999
3016
|
}
|
|
3000
|
-
function
|
|
3017
|
+
function ue() {
|
|
3001
3018
|
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
|
|
3002
3019
|
}
|
|
3003
|
-
function
|
|
3020
|
+
function de() {
|
|
3004
3021
|
let e = W, t = G;
|
|
3005
3022
|
_.value = !1, W = null, G = !1, m(() => {
|
|
3006
|
-
e !== null &&
|
|
3023
|
+
e !== null && le(e, t);
|
|
3007
3024
|
});
|
|
3008
3025
|
}
|
|
3009
|
-
return
|
|
3010
|
-
closeMasonryReel:
|
|
3026
|
+
return Rn({
|
|
3027
|
+
closeMasonryReel: ue,
|
|
3011
3028
|
element: () => g.value,
|
|
3012
3029
|
isReelLeaving: () => _.value,
|
|
3013
3030
|
reelRenderer: () => p.value,
|
|
@@ -3024,11 +3041,13 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3024
3041
|
let t = x.value.get(e);
|
|
3025
3042
|
t !== void 0 && i.set(e, t);
|
|
3026
3043
|
}), n.forEach((e, t) => {
|
|
3027
|
-
i.set(e, t *
|
|
3028
|
-
}), x.value = i, y.value = new Set([...y.value, ...n]),
|
|
3044
|
+
i.set(e, t * zn);
|
|
3045
|
+
}), x.value = i, y.value = new Set([...y.value, ...n]), q();
|
|
3029
3046
|
}, { flush: "sync" }), v(() => {
|
|
3030
3047
|
V !== null && cancelAnimationFrame(V);
|
|
3031
3048
|
}), i({
|
|
3049
|
+
animateItemRemoval: Z,
|
|
3050
|
+
cancelItemRemoval: ce,
|
|
3032
3051
|
changeActiveReelMedia: te,
|
|
3033
3052
|
getAutoScrollElement: ie,
|
|
3034
3053
|
loadIfNearBottom: ee,
|
|
@@ -3042,7 +3061,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3042
3061
|
ref_key: "surfaceElement",
|
|
3043
3062
|
ref: g,
|
|
3044
3063
|
class: "vibe-surface"
|
|
3045
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
3064
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(jn, {
|
|
3046
3065
|
key: 0,
|
|
3047
3066
|
ref_key: "reelRenderer",
|
|
3048
3067
|
ref: p,
|
|
@@ -3082,7 +3101,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3082
3101
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
3083
3102
|
onRetryForward: i[4] ||= (e) => d("retryForward"),
|
|
3084
3103
|
onReelAudioChange: i[5] ||= (e) => d("reelAudioChange", e)
|
|
3085
|
-
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(
|
|
3104
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(X, {
|
|
3086
3105
|
key: 1,
|
|
3087
3106
|
actions: t.feedFooterActions,
|
|
3088
3107
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3095,7 +3114,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3095
3114
|
"can-retry-end",
|
|
3096
3115
|
"feed-footer",
|
|
3097
3116
|
"state"
|
|
3098
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
3117
|
+
])) : (b(), s(e, { key: 2 }, [u(hn, {
|
|
3099
3118
|
ref_key: "masonryRenderer",
|
|
3100
3119
|
ref: f,
|
|
3101
3120
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3130,7 +3149,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3130
3149
|
onVisible: E(j)
|
|
3131
3150
|
}, null, 8, /* @__PURE__ */ "can-retry-end.entering-post-ids.entry-delays.leaving-post-ids.removal-delays.card-footer.card-header.feed-footer.feed-footer-actions.media-card.masonry.has-next.infinite-scroll.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.suspended.state.total.onError.onFullyVisible.onReady.onVisible".split(".")), u(n, {
|
|
3132
3151
|
name: "vibe-reel-viewer",
|
|
3133
|
-
onAfterLeave:
|
|
3152
|
+
onAfterLeave: de
|
|
3134
3153
|
}, {
|
|
3135
3154
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
3136
3155
|
key: 0,
|
|
@@ -3141,7 +3160,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3141
3160
|
"aria-label": "Media viewer",
|
|
3142
3161
|
"aria-modal": "true",
|
|
3143
3162
|
tabindex: "-1"
|
|
3144
|
-
}, [u(
|
|
3163
|
+
}, [u(jn, {
|
|
3145
3164
|
ref_key: "reelRenderer",
|
|
3146
3165
|
ref: p,
|
|
3147
3166
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3187,7 +3206,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3187
3206
|
});
|
|
3188
3207
|
//#endregion
|
|
3189
3208
|
//#region src/core/page.ts
|
|
3190
|
-
function
|
|
3209
|
+
function Hn(e) {
|
|
3191
3210
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
3192
3211
|
if (e.current !== void 0 && e.current !== null && typeof e.current != "string" && typeof e.current != "number") throw TypeError("Vibe page current must be a string, number, null, or undefined.");
|
|
3193
3212
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
@@ -3198,22 +3217,22 @@ function $(e, t) {
|
|
|
3198
3217
|
let n = new Set(e.map((e) => e.postId));
|
|
3199
3218
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
3200
3219
|
}
|
|
3201
|
-
function
|
|
3220
|
+
function Un(e) {
|
|
3202
3221
|
return `${typeof e}:${String(e)}`;
|
|
3203
3222
|
}
|
|
3204
|
-
function
|
|
3205
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${
|
|
3223
|
+
function Wn(e) {
|
|
3224
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${Un(e.mediaId)}`;
|
|
3206
3225
|
}
|
|
3207
|
-
function
|
|
3208
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
3226
|
+
function Gn(e, t) {
|
|
3227
|
+
let n = [...e], r = new Map(e.map((e, t) => [Un(e.postId), t]));
|
|
3209
3228
|
return t.forEach((e) => {
|
|
3210
|
-
let t =
|
|
3229
|
+
let t = Un(e.postId), i = r.get(t);
|
|
3211
3230
|
if (i === void 0) {
|
|
3212
3231
|
r.set(t, n.length), n.push(e);
|
|
3213
3232
|
return;
|
|
3214
3233
|
}
|
|
3215
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
3216
|
-
let t =
|
|
3234
|
+
let a = n[i], o = new Set([a, ...a.items].map(Wn)), s = [e, ...e.items].filter((e) => {
|
|
3235
|
+
let t = Wn(e);
|
|
3217
3236
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
3218
3237
|
});
|
|
3219
3238
|
s.length > 0 && (n[i] = {
|
|
@@ -3222,14 +3241,14 @@ function Un(e, t) {
|
|
|
3222
3241
|
});
|
|
3223
3242
|
}), n;
|
|
3224
3243
|
}
|
|
3225
|
-
function
|
|
3244
|
+
function Kn(e) {
|
|
3226
3245
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
3227
3246
|
}
|
|
3228
3247
|
//#endregion
|
|
3229
3248
|
//#region src/core/appendPage.ts
|
|
3230
|
-
function
|
|
3231
|
-
let i =
|
|
3232
|
-
t.items =
|
|
3249
|
+
function qn(e, t, n, r) {
|
|
3250
|
+
let i = Hn(e), a = n.filterItems(i.items), o = Kn(i);
|
|
3251
|
+
t.items = Gn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
3233
3252
|
contributionIds: a.map(({ postId: e }) => e),
|
|
3234
3253
|
cursor: o,
|
|
3235
3254
|
next: i.next,
|
|
@@ -3238,32 +3257,32 @@ function Gn(e, t, n, r) {
|
|
|
3238
3257
|
}
|
|
3239
3258
|
//#endregion
|
|
3240
3259
|
//#region src/core/requestDelay.ts
|
|
3241
|
-
var
|
|
3260
|
+
var Jn = 2e3, Yn = 1e4, Xn = 250, Zn = {
|
|
3242
3261
|
delayRemainingMs: null,
|
|
3243
3262
|
nextRequestAt: null
|
|
3244
3263
|
};
|
|
3245
|
-
function
|
|
3264
|
+
function Qn(e, t) {
|
|
3246
3265
|
return e === void 0 ? t : Math.floor(e);
|
|
3247
3266
|
}
|
|
3248
|
-
function
|
|
3267
|
+
function $n(e, t) {
|
|
3249
3268
|
for (let [n, r] of [["delayStepMs", e.delayStepMs], ["delayMaxMs", e.delayMaxMs]]) if (r !== void 0 && (!Number.isFinite(r) || r < 0)) throw TypeError(`Vibe ${t} ${n} must be a non-negative number.`);
|
|
3250
3269
|
}
|
|
3251
|
-
function
|
|
3252
|
-
let n =
|
|
3270
|
+
function er(e, t = {}) {
|
|
3271
|
+
let n = Qn(t.delayStepMs, Jn), r = Qn(t.delayMaxMs, Yn);
|
|
3253
3272
|
return Math.min(Math.max(0, e) * n, r);
|
|
3254
3273
|
}
|
|
3255
|
-
function
|
|
3256
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
3274
|
+
function tr(e) {
|
|
3275
|
+
if (e == null || !Number.isFinite(e)) return { ...Zn };
|
|
3257
3276
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
3258
3277
|
return t > 0 ? {
|
|
3259
3278
|
delayRemainingMs: t,
|
|
3260
3279
|
nextRequestAt: e
|
|
3261
|
-
} : { ...
|
|
3280
|
+
} : { ...Zn };
|
|
3262
3281
|
}
|
|
3263
|
-
async function
|
|
3282
|
+
async function nr({ delayMs: e, onChange: t, signal: n }) {
|
|
3264
3283
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
3265
3284
|
if (e <= 0) {
|
|
3266
|
-
t({ ...
|
|
3285
|
+
t({ ...Zn });
|
|
3267
3286
|
return;
|
|
3268
3287
|
}
|
|
3269
3288
|
let r = Date.now() + e;
|
|
@@ -3271,9 +3290,9 @@ async function er({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3271
3290
|
delayRemainingMs: e,
|
|
3272
3291
|
nextRequestAt: r
|
|
3273
3292
|
}), await new Promise((i, a) => {
|
|
3274
|
-
let o = !1, s = setInterval(f,
|
|
3293
|
+
let o = !1, s = setInterval(f, Xn), c = setTimeout(() => u(), e);
|
|
3275
3294
|
function l() {
|
|
3276
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
3295
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Zn });
|
|
3277
3296
|
}
|
|
3278
3297
|
function u(e) {
|
|
3279
3298
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -3282,42 +3301,42 @@ async function er({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3282
3301
|
u(new DOMException("Aborted", "AbortError"));
|
|
3283
3302
|
}
|
|
3284
3303
|
function f() {
|
|
3285
|
-
let e =
|
|
3304
|
+
let e = tr(r);
|
|
3286
3305
|
t(e), e.delayRemainingMs === null && u();
|
|
3287
3306
|
}
|
|
3288
3307
|
n.addEventListener("abort", d, { once: !0 });
|
|
3289
3308
|
});
|
|
3290
3309
|
}
|
|
3291
|
-
var
|
|
3310
|
+
var rr = class {
|
|
3292
3311
|
interval = null;
|
|
3293
3312
|
constructor(e) {
|
|
3294
3313
|
this.onChange = e;
|
|
3295
3314
|
}
|
|
3296
3315
|
clear() {
|
|
3297
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
3316
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Zn });
|
|
3298
3317
|
}
|
|
3299
3318
|
sync(e) {
|
|
3300
3319
|
this.clear();
|
|
3301
|
-
let t =
|
|
3320
|
+
let t = tr(e);
|
|
3302
3321
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
3303
|
-
let t =
|
|
3322
|
+
let t = tr(e);
|
|
3304
3323
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
3305
|
-
},
|
|
3324
|
+
}, Xn));
|
|
3306
3325
|
}
|
|
3307
3326
|
};
|
|
3308
|
-
function
|
|
3327
|
+
function ir(e, t = !0) {
|
|
3309
3328
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
3310
3329
|
}
|
|
3311
|
-
function
|
|
3330
|
+
function ar(e) {
|
|
3312
3331
|
return `${typeof e}:${String(e)}`;
|
|
3313
3332
|
}
|
|
3314
|
-
function
|
|
3333
|
+
function or(e, t) {
|
|
3315
3334
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
3316
3335
|
}
|
|
3317
|
-
function
|
|
3336
|
+
function sr(e) {
|
|
3318
3337
|
if (!e) return;
|
|
3319
|
-
if (
|
|
3320
|
-
|
|
3338
|
+
if (or(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
3339
|
+
$n(e, "frontend autofill");
|
|
3321
3340
|
let t = e.maxAdditionalPages;
|
|
3322
3341
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
3323
3342
|
return;
|
|
@@ -3329,7 +3348,7 @@ function ar(e) {
|
|
|
3329
3348
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
3330
3349
|
}
|
|
3331
3350
|
}
|
|
3332
|
-
function
|
|
3351
|
+
function cr(e, t, n = !0) {
|
|
3333
3352
|
if (!e) return {
|
|
3334
3353
|
cycleId: null,
|
|
3335
3354
|
delayRemainingMs: null,
|
|
@@ -3346,7 +3365,7 @@ function or(e, t, n = !0) {
|
|
|
3346
3365
|
status: "idle",
|
|
3347
3366
|
strategy: null
|
|
3348
3367
|
};
|
|
3349
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
3368
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = tr(r?.nextRequestAt);
|
|
3350
3369
|
return {
|
|
3351
3370
|
cycleId: r?.cycleId ?? null,
|
|
3352
3371
|
...a,
|
|
@@ -3363,7 +3382,7 @@ function or(e, t, n = !0) {
|
|
|
3363
3382
|
strategy: e.strategy
|
|
3364
3383
|
};
|
|
3365
3384
|
}
|
|
3366
|
-
function
|
|
3385
|
+
function lr(e) {
|
|
3367
3386
|
return [
|
|
3368
3387
|
"cancelling",
|
|
3369
3388
|
"filling",
|
|
@@ -3371,9 +3390,9 @@ function sr(e) {
|
|
|
3371
3390
|
"waiting"
|
|
3372
3391
|
].includes(e.status);
|
|
3373
3392
|
}
|
|
3374
|
-
async function
|
|
3393
|
+
async function ur(e, t, n) {
|
|
3375
3394
|
let r = t.autofill;
|
|
3376
|
-
if (!
|
|
3395
|
+
if (!lr(r) || !r.cycleId) return;
|
|
3377
3396
|
let i = {
|
|
3378
3397
|
cycleId: r.cycleId,
|
|
3379
3398
|
feedKey: r.feedKey ?? "",
|
|
@@ -3386,16 +3405,16 @@ async function cr(e, t, n) {
|
|
|
3386
3405
|
throw r.error = e, r.status = "error", e;
|
|
3387
3406
|
}
|
|
3388
3407
|
}
|
|
3389
|
-
function
|
|
3408
|
+
function dr(e, t, n) {
|
|
3390
3409
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
3391
3410
|
}
|
|
3392
|
-
async function
|
|
3393
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
3411
|
+
async function fr({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
|
|
3412
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? ir(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
3394
3413
|
for (; y < h;) {
|
|
3395
|
-
let e =
|
|
3414
|
+
let e = ar(g);
|
|
3396
3415
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
3397
|
-
if (m.add(e), await
|
|
3398
|
-
delayMs:
|
|
3416
|
+
if (m.add(e), await nr({
|
|
3417
|
+
delayMs: er(l + y, s),
|
|
3399
3418
|
onChange: a,
|
|
3400
3419
|
signal: d
|
|
3401
3420
|
}), y > 0 && u()) return {
|
|
@@ -3409,7 +3428,7 @@ async function ur({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3409
3428
|
status: "paused",
|
|
3410
3429
|
total: x
|
|
3411
3430
|
};
|
|
3412
|
-
let t =
|
|
3431
|
+
let t = Hn(await n({
|
|
3413
3432
|
cursor: g,
|
|
3414
3433
|
signal: d
|
|
3415
3434
|
}));
|
|
@@ -3466,12 +3485,12 @@ async function ur({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3466
3485
|
}
|
|
3467
3486
|
//#endregion
|
|
3468
3487
|
//#region src/core/autofillController.ts
|
|
3469
|
-
var
|
|
3488
|
+
var pr = class {
|
|
3470
3489
|
collection = null;
|
|
3471
3490
|
cycle = 0;
|
|
3472
3491
|
delayCountdown;
|
|
3473
3492
|
constructor(e) {
|
|
3474
|
-
this.context = e, this.delayCountdown = new
|
|
3493
|
+
this.context = e, this.delayCountdown = new rr((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
3475
3494
|
}
|
|
3476
3495
|
beginCycle() {
|
|
3477
3496
|
let { options: e, state: t } = this.context;
|
|
@@ -3479,14 +3498,14 @@ var dr = class {
|
|
|
3479
3498
|
this.clear();
|
|
3480
3499
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3481
3500
|
return t.autofill = {
|
|
3482
|
-
...
|
|
3501
|
+
...cr(e, void 0, !1),
|
|
3483
3502
|
cycleId: n,
|
|
3484
3503
|
status: "filling"
|
|
3485
3504
|
}, n;
|
|
3486
3505
|
}
|
|
3487
3506
|
async cancel() {
|
|
3488
3507
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
3489
|
-
await
|
|
3508
|
+
await ur(t, n, e), this.commitCollection();
|
|
3490
3509
|
}
|
|
3491
3510
|
captureCollection(e, t) {
|
|
3492
3511
|
t && (this.collection = e);
|
|
@@ -3514,30 +3533,30 @@ var dr = class {
|
|
|
3514
3533
|
requests: r.requests
|
|
3515
3534
|
}), !0) : !1;
|
|
3516
3535
|
}
|
|
3517
|
-
},
|
|
3518
|
-
function
|
|
3536
|
+
}, mr = 100;
|
|
3537
|
+
function hr(e, t) {
|
|
3519
3538
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
3520
3539
|
}
|
|
3521
|
-
function
|
|
3540
|
+
function gr(e, t, n) {
|
|
3522
3541
|
return Math.min(n, Math.max(t, e));
|
|
3523
3542
|
}
|
|
3524
|
-
function
|
|
3543
|
+
function _r(e) {
|
|
3525
3544
|
if (!e) return;
|
|
3526
3545
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
3527
|
-
if (
|
|
3528
|
-
e.speedPxPerSecond !== void 0 &&
|
|
3546
|
+
if (hr("autoScroll.minSpeedPxPerSecond", t), hr("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
3547
|
+
e.speedPxPerSecond !== void 0 && hr("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
3529
3548
|
}
|
|
3530
|
-
function
|
|
3549
|
+
function vr(e) {
|
|
3531
3550
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
3532
3551
|
return {
|
|
3533
3552
|
enabled: e?.enabled ?? !1,
|
|
3534
3553
|
maxSpeedPxPerSecond: n,
|
|
3535
3554
|
minSpeedPxPerSecond: t,
|
|
3536
3555
|
paused: !1,
|
|
3537
|
-
speedPxPerSecond:
|
|
3556
|
+
speedPxPerSecond: gr(e?.speedPxPerSecond ?? 80, t, n)
|
|
3538
3557
|
};
|
|
3539
3558
|
}
|
|
3540
|
-
var
|
|
3559
|
+
var yr = class {
|
|
3541
3560
|
frame = null;
|
|
3542
3561
|
lastTimestamp = null;
|
|
3543
3562
|
mounted = !1;
|
|
@@ -3557,9 +3576,9 @@ var _r = class {
|
|
|
3557
3576
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
3558
3577
|
}
|
|
3559
3578
|
setSpeed(e) {
|
|
3560
|
-
|
|
3579
|
+
hr("auto-scroll speed", e);
|
|
3561
3580
|
let t = this.options.state;
|
|
3562
|
-
t.speedPxPerSecond =
|
|
3581
|
+
t.speedPxPerSecond = gr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
3563
3582
|
}
|
|
3564
3583
|
tick = (e) => {
|
|
3565
3584
|
this.frame = null;
|
|
@@ -3571,7 +3590,7 @@ var _r = class {
|
|
|
3571
3590
|
return;
|
|
3572
3591
|
}
|
|
3573
3592
|
if (this.lastTimestamp !== null) {
|
|
3574
|
-
let r = Math.min(
|
|
3593
|
+
let r = Math.min(mr, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3575
3594
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3576
3595
|
}
|
|
3577
3596
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3585,13 +3604,13 @@ var _r = class {
|
|
|
3585
3604
|
};
|
|
3586
3605
|
//#endregion
|
|
3587
3606
|
//#region src/core/backendAutofill.ts
|
|
3588
|
-
async function
|
|
3607
|
+
async function br(e, t, n, r) {
|
|
3589
3608
|
let i = await e.onUnderfilled(n);
|
|
3590
3609
|
if (!r()) return;
|
|
3591
3610
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
3592
3611
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
3593
3612
|
Object.assign(t.autofill, {
|
|
3594
|
-
|
|
3613
|
+
...tr(i.nextRequestAt),
|
|
3595
3614
|
missing: Math.max(0, e.pageSize - a),
|
|
3596
3615
|
received: a,
|
|
3597
3616
|
sequence: i.sequence ?? 0,
|
|
@@ -3599,19 +3618,19 @@ async function vr(e, t, n, r) {
|
|
|
3599
3618
|
status: "waiting"
|
|
3600
3619
|
});
|
|
3601
3620
|
}
|
|
3602
|
-
function
|
|
3621
|
+
function xr(e, t) {
|
|
3603
3622
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = $(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
3604
3623
|
}
|
|
3605
|
-
function
|
|
3624
|
+
function Sr(e, t, n) {
|
|
3606
3625
|
let r = t.autofill;
|
|
3607
|
-
return !
|
|
3626
|
+
return !dr(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (xr(t, n), Object.assign(r, tr(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
|
|
3608
3627
|
}
|
|
3609
|
-
function
|
|
3610
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3628
|
+
function Cr(e, t, n) {
|
|
3629
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = cr(e, n), xr(t, n), !0);
|
|
3611
3630
|
}
|
|
3612
3631
|
//#endregion
|
|
3613
3632
|
//#region src/core/backlogRestore.ts
|
|
3614
|
-
async function
|
|
3633
|
+
async function wr(e, t, n) {
|
|
3615
3634
|
if (!e) return;
|
|
3616
3635
|
let r = new AbortController();
|
|
3617
3636
|
n(r);
|
|
@@ -3626,7 +3645,7 @@ async function Sr(e, t, n) {
|
|
|
3626
3645
|
}
|
|
3627
3646
|
//#endregion
|
|
3628
3647
|
//#region src/core/initialAutofill.ts
|
|
3629
|
-
async function
|
|
3648
|
+
async function Tr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3630
3649
|
let c = a.autofill;
|
|
3631
3650
|
if (!c) return;
|
|
3632
3651
|
let l = s.items.length;
|
|
@@ -3639,7 +3658,7 @@ async function Cr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3639
3658
|
return;
|
|
3640
3659
|
}
|
|
3641
3660
|
if (c.strategy === "backend") {
|
|
3642
|
-
await
|
|
3661
|
+
await br(c, s, {
|
|
3643
3662
|
cycleId: e,
|
|
3644
3663
|
feedKey: c.feedKey,
|
|
3645
3664
|
items: [...s.items],
|
|
@@ -3656,11 +3675,11 @@ async function Cr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3656
3675
|
s.autofill.status = "exhausted";
|
|
3657
3676
|
return;
|
|
3658
3677
|
}
|
|
3659
|
-
let u = await
|
|
3678
|
+
let u = await fr({
|
|
3660
3679
|
existingItems: s.items,
|
|
3661
3680
|
initialCursor: s.next,
|
|
3662
3681
|
loadPage: a.loadPage,
|
|
3663
|
-
maximumRequests:
|
|
3682
|
+
maximumRequests: ir(c, !1),
|
|
3664
3683
|
onCollection: n,
|
|
3665
3684
|
onDelayChange: (e) => {
|
|
3666
3685
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3683,13 +3702,13 @@ async function Cr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3683
3702
|
}
|
|
3684
3703
|
//#endregion
|
|
3685
3704
|
//#region src/core/fill.ts
|
|
3686
|
-
function
|
|
3705
|
+
function Er(e) {
|
|
3687
3706
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3688
3707
|
}
|
|
3689
|
-
function
|
|
3708
|
+
function Dr(e) {
|
|
3690
3709
|
return `${typeof e}:${String(e)}`;
|
|
3691
3710
|
}
|
|
3692
|
-
function
|
|
3711
|
+
function Or(e) {
|
|
3693
3712
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3694
3713
|
if ("pages" in e) {
|
|
3695
3714
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3702,21 +3721,21 @@ function Er(e) {
|
|
|
3702
3721
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3703
3722
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3704
3723
|
}
|
|
3705
|
-
function
|
|
3724
|
+
function kr(e) {
|
|
3706
3725
|
if (!e) return;
|
|
3707
3726
|
if (e.strategy === "frontend") {
|
|
3708
|
-
|
|
3727
|
+
$n(e, "frontend fill");
|
|
3709
3728
|
return;
|
|
3710
3729
|
}
|
|
3711
3730
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3712
3731
|
let t = e.initialSession;
|
|
3713
3732
|
if (t) {
|
|
3714
3733
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3715
|
-
|
|
3734
|
+
Or(t.target);
|
|
3716
3735
|
}
|
|
3717
3736
|
}
|
|
3718
|
-
function
|
|
3719
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3737
|
+
function Ar(e, t, n = !0) {
|
|
3738
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = tr(i?.nextRequestAt);
|
|
3720
3739
|
return {
|
|
3721
3740
|
completedPages: i?.completedPages ?? 0,
|
|
3722
3741
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3729,10 +3748,10 @@ function Or(e, t, n = !0) {
|
|
|
3729
3748
|
sessionId: i?.sessionId ?? null,
|
|
3730
3749
|
status: i?.status ?? "idle",
|
|
3731
3750
|
strategy: e?.strategy ?? null,
|
|
3732
|
-
target: i ?
|
|
3751
|
+
target: i ? Er(i.target) : null
|
|
3733
3752
|
};
|
|
3734
3753
|
}
|
|
3735
|
-
function
|
|
3754
|
+
function jr(e) {
|
|
3736
3755
|
return [
|
|
3737
3756
|
"cancelling",
|
|
3738
3757
|
"filling",
|
|
@@ -3740,7 +3759,7 @@ function kr(e) {
|
|
|
3740
3759
|
"waiting"
|
|
3741
3760
|
].includes(e.status);
|
|
3742
3761
|
}
|
|
3743
|
-
async function
|
|
3762
|
+
async function Mr({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3744
3763
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3745
3764
|
if ("items" in l && f.length >= l.items) return {
|
|
3746
3765
|
completedPages: m,
|
|
@@ -3752,10 +3771,10 @@ async function Ar({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3752
3771
|
status: "complete"
|
|
3753
3772
|
};
|
|
3754
3773
|
for (; _ !== null;) {
|
|
3755
|
-
let e =
|
|
3774
|
+
let e = Dr(h);
|
|
3756
3775
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3757
|
-
if (p.add(e), await
|
|
3758
|
-
delayMs:
|
|
3776
|
+
if (p.add(e), await nr({
|
|
3777
|
+
delayMs: er(m, o),
|
|
3759
3778
|
onChange: i,
|
|
3760
3779
|
signal: c
|
|
3761
3780
|
}), m > 0 && s()) return {
|
|
@@ -3768,7 +3787,7 @@ async function Ar({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3768
3787
|
status: "paused",
|
|
3769
3788
|
total: y
|
|
3770
3789
|
};
|
|
3771
|
-
let t =
|
|
3790
|
+
let t = Hn(await n({
|
|
3772
3791
|
cursor: h,
|
|
3773
3792
|
signal: c
|
|
3774
3793
|
}));
|
|
@@ -3836,12 +3855,12 @@ async function Ar({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3836
3855
|
}
|
|
3837
3856
|
//#endregion
|
|
3838
3857
|
//#region src/core/backendFill.ts
|
|
3839
|
-
async function
|
|
3858
|
+
async function Nr(e, t, n, r) {
|
|
3840
3859
|
let i = await e.onStart(n);
|
|
3841
3860
|
if (r()) {
|
|
3842
3861
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3843
3862
|
Object.assign(t.fill, {
|
|
3844
|
-
|
|
3863
|
+
...tr(i.nextRequestAt),
|
|
3845
3864
|
completedPages: i.completedPages ?? 0,
|
|
3846
3865
|
received: i.received ?? 0,
|
|
3847
3866
|
sequence: i.sequence ?? 0,
|
|
@@ -3850,23 +3869,23 @@ async function jr(e, t, n, r) {
|
|
|
3850
3869
|
});
|
|
3851
3870
|
}
|
|
3852
3871
|
}
|
|
3853
|
-
function
|
|
3872
|
+
function Pr(e, t, n) {
|
|
3854
3873
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3855
3874
|
}
|
|
3856
|
-
function
|
|
3875
|
+
function Fr(e) {
|
|
3857
3876
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3858
3877
|
}
|
|
3859
|
-
function
|
|
3878
|
+
function Ir(e, t) {
|
|
3860
3879
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3861
3880
|
let n = e.fill.target;
|
|
3862
3881
|
return !n || !Array.isArray(t.items) || t.next === void 0 || t.lastCursor === void 0 ? !1 : t.status === "exhausted" ? "pages" in n && t.completedPages < n.pages && t.next === null : "pages" in n ? t.completedPages === n.pages : t.next === null;
|
|
3863
3882
|
}
|
|
3864
|
-
function
|
|
3883
|
+
function Lr(e, t, n) {
|
|
3865
3884
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = $(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
3866
3885
|
}
|
|
3867
|
-
function
|
|
3868
|
-
return !
|
|
3869
|
-
|
|
3886
|
+
function Rr(e, t, n, r) {
|
|
3887
|
+
return !Pr(e, t, n) || !Fr(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Ir(t, n) ? !1 : (Lr(t, n, r), Object.assign(t.fill, {
|
|
3888
|
+
...tr(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3870
3889
|
completedPages: n.completedPages,
|
|
3871
3890
|
error: n.error ?? null,
|
|
3872
3891
|
received: n.received,
|
|
@@ -3874,45 +3893,45 @@ function Ir(e, t, n, r) {
|
|
|
3874
3893
|
status: n.status
|
|
3875
3894
|
}), !0);
|
|
3876
3895
|
}
|
|
3877
|
-
function
|
|
3896
|
+
function zr(e, t, n, r) {
|
|
3878
3897
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3879
3898
|
let i = t.fill;
|
|
3880
|
-
return t.fill =
|
|
3899
|
+
return t.fill = Ar(e, n), !Fr(n) || !Ir(t, n) ? (t.fill = i, !1) : (Lr(t, n, r), !0);
|
|
3881
3900
|
}
|
|
3882
3901
|
//#endregion
|
|
3883
3902
|
//#region src/core/fillController.ts
|
|
3884
|
-
var
|
|
3903
|
+
var Br = class {
|
|
3885
3904
|
abortController = null;
|
|
3886
3905
|
cycle = 0;
|
|
3887
3906
|
delayCountdown;
|
|
3888
3907
|
requestVersion = 0;
|
|
3889
3908
|
collection = null;
|
|
3890
3909
|
constructor(e) {
|
|
3891
|
-
this.options = e, this.delayCountdown = new
|
|
3910
|
+
this.options = e, this.delayCountdown = new rr((e) => {
|
|
3892
3911
|
Object.assign(this.options.state.fill, e);
|
|
3893
3912
|
}), this.syncBackendCountdown();
|
|
3894
3913
|
}
|
|
3895
3914
|
isActive() {
|
|
3896
|
-
return
|
|
3915
|
+
return jr(this.options.state.fill);
|
|
3897
3916
|
}
|
|
3898
3917
|
applyUpdate(e) {
|
|
3899
|
-
let t =
|
|
3918
|
+
let t = Rr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3900
3919
|
return t && this.syncBackendCountdown(), t;
|
|
3901
3920
|
}
|
|
3902
3921
|
restoreSession(e) {
|
|
3903
|
-
let t =
|
|
3922
|
+
let t = zr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3904
3923
|
return t && this.syncBackendCountdown(), t;
|
|
3905
3924
|
}
|
|
3906
3925
|
async start(e, t = {}) {
|
|
3907
3926
|
let n = this.options.fill;
|
|
3908
3927
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3909
3928
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3910
|
-
let r =
|
|
3929
|
+
let r = Or(e), i = Or(t.target ?? r), a = t.progressOffset ?? {
|
|
3911
3930
|
completedPages: 0,
|
|
3912
3931
|
received: 0
|
|
3913
3932
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3914
3933
|
if (this.options.state.fill = {
|
|
3915
|
-
...
|
|
3934
|
+
...Ar(n, void 0, !1),
|
|
3916
3935
|
completedPages: a.completedPages,
|
|
3917
3936
|
cycleId: o,
|
|
3918
3937
|
received: a.received,
|
|
@@ -3925,7 +3944,7 @@ var Rr = class {
|
|
|
3925
3944
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3926
3945
|
this.abortController = c;
|
|
3927
3946
|
try {
|
|
3928
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3947
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Nr(n, this.options.state, {
|
|
3929
3948
|
cycleId: o,
|
|
3930
3949
|
feedKey: n.feedKey,
|
|
3931
3950
|
items: [...this.options.state.items],
|
|
@@ -3943,7 +3962,7 @@ var Rr = class {
|
|
|
3943
3962
|
}
|
|
3944
3963
|
async cancel() {
|
|
3945
3964
|
let { fill: e, state: t } = this.options;
|
|
3946
|
-
if (!
|
|
3965
|
+
if (!jr(t.fill) || !t.fill.cycleId) return;
|
|
3947
3966
|
let n = {
|
|
3948
3967
|
cycleId: t.fill.cycleId,
|
|
3949
3968
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3987,7 +4006,7 @@ var Rr = class {
|
|
|
3987
4006
|
});
|
|
3988
4007
|
}
|
|
3989
4008
|
reset() {
|
|
3990
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
4009
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Ar(this.options.fill, void 0, !1), this.collection = null;
|
|
3991
4010
|
}
|
|
3992
4011
|
destroy() {
|
|
3993
4012
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -4022,7 +4041,7 @@ var Rr = class {
|
|
|
4022
4041
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
4023
4042
|
return;
|
|
4024
4043
|
}
|
|
4025
|
-
let c = await
|
|
4044
|
+
let c = await Mr({
|
|
4026
4045
|
existingItems: s.items,
|
|
4027
4046
|
initialCursor: s.next,
|
|
4028
4047
|
loadPage: o,
|
|
@@ -4070,20 +4089,20 @@ var Rr = class {
|
|
|
4070
4089
|
};
|
|
4071
4090
|
//#endregion
|
|
4072
4091
|
//#region src/core/fillReconciliation.ts
|
|
4073
|
-
async function
|
|
4074
|
-
if (!e.needsReconciliation(
|
|
4075
|
-
let
|
|
4076
|
-
existingItems:
|
|
4092
|
+
async function Vr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, pauseWhenManual: i = !1, setLastCursor: a, signal: o, state: s }) {
|
|
4093
|
+
if (!e.needsReconciliation(s.items)) return "skipped";
|
|
4094
|
+
let c = await e.reconcile({
|
|
4095
|
+
existingItems: s.items,
|
|
4077
4096
|
loadPage: n,
|
|
4078
4097
|
onDelayChange: r,
|
|
4079
|
-
shouldPause: () =>
|
|
4080
|
-
signal:
|
|
4098
|
+
shouldPause: () => s.loadMoreLocked || i && !s.infiniteScroll,
|
|
4099
|
+
signal: o
|
|
4081
4100
|
});
|
|
4082
|
-
return t() ? (
|
|
4101
|
+
return t() ? (s.items = $(s.items, c.items), s.next = c.next, a(c.lastCursor), c.total !== void 0 && (s.total = c.total), e.completeReconciliation(c), c.status) : c.status;
|
|
4083
4102
|
}
|
|
4084
4103
|
//#endregion
|
|
4085
4104
|
//#region src/core/feedFooter.ts
|
|
4086
|
-
function
|
|
4105
|
+
function Hr(e) {
|
|
4087
4106
|
return {
|
|
4088
4107
|
cancelAutofill: () => e.cancelAutofill(),
|
|
4089
4108
|
loadMore: () => e.loadNext(),
|
|
@@ -4095,46 +4114,46 @@ function Br(e) {
|
|
|
4095
4114
|
retryFill: () => e.retryFill()
|
|
4096
4115
|
};
|
|
4097
4116
|
}
|
|
4098
|
-
function
|
|
4117
|
+
function Ur(e) {
|
|
4099
4118
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
4100
4119
|
}
|
|
4101
|
-
function
|
|
4102
|
-
e?.intervalMs !== void 0 &&
|
|
4120
|
+
function Wr(e) {
|
|
4121
|
+
e?.intervalMs !== void 0 && Ur(e.intervalMs);
|
|
4103
4122
|
}
|
|
4104
|
-
function
|
|
4123
|
+
function Gr(e) {
|
|
4105
4124
|
return {
|
|
4106
4125
|
enabled: e?.enabled ?? !1,
|
|
4107
4126
|
includePostItems: e?.includePostItems ?? !1,
|
|
4108
4127
|
intervalMs: e?.intervalMs ?? 5e3
|
|
4109
4128
|
};
|
|
4110
4129
|
}
|
|
4111
|
-
function
|
|
4130
|
+
function Kr(e, t) {
|
|
4112
4131
|
if (typeof t == "boolean") {
|
|
4113
4132
|
e.enabled = t;
|
|
4114
4133
|
return;
|
|
4115
4134
|
}
|
|
4116
|
-
|
|
4135
|
+
Wr(t), t.enabled !== void 0 && (e.enabled = t.enabled), t.includePostItems !== void 0 && (e.includePostItems = t.includePostItems), t.intervalMs !== void 0 && (e.intervalMs = t.intervalMs);
|
|
4117
4136
|
}
|
|
4118
4137
|
//#endregion
|
|
4119
4138
|
//#region src/core/reelInfoSheet.ts
|
|
4120
|
-
function
|
|
4139
|
+
function qr(e) {
|
|
4121
4140
|
return { enabled: e?.enabled ?? !1 };
|
|
4122
4141
|
}
|
|
4123
|
-
function
|
|
4142
|
+
function Jr(e, t, n) {
|
|
4124
4143
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
4125
4144
|
e.enabled = n;
|
|
4126
4145
|
}
|
|
4127
4146
|
//#endregion
|
|
4128
4147
|
//#region src/core/initialRuntimeState.ts
|
|
4129
|
-
function
|
|
4148
|
+
function Yr(e, t) {
|
|
4130
4149
|
let n = e.initialPage;
|
|
4131
4150
|
return {
|
|
4132
4151
|
activeReelPostId: null,
|
|
4133
|
-
autoScroll:
|
|
4134
|
-
autofill:
|
|
4152
|
+
autoScroll: vr(e.autoScroll),
|
|
4153
|
+
autofill: cr(e.autofill),
|
|
4135
4154
|
current: n?.current ?? null,
|
|
4136
4155
|
error: null,
|
|
4137
|
-
fill:
|
|
4156
|
+
fill: Ar(e.fill),
|
|
4138
4157
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
4139
4158
|
isLoading: !n,
|
|
4140
4159
|
isLoadingMore: !1,
|
|
@@ -4145,14 +4164,14 @@ function qr(e, t) {
|
|
|
4145
4164
|
next: n?.next ?? null,
|
|
4146
4165
|
nextPageError: null,
|
|
4147
4166
|
phoneMode: !1,
|
|
4148
|
-
reelAutoAdvance:
|
|
4167
|
+
reelAutoAdvance: Gr(e.reelAutoAdvance),
|
|
4149
4168
|
reelForward: {
|
|
4150
4169
|
error: null,
|
|
4151
4170
|
status: "idle"
|
|
4152
4171
|
},
|
|
4153
4172
|
reelForwardIndex: null,
|
|
4154
4173
|
reelForwardItem: null,
|
|
4155
|
-
reelInfoSheet:
|
|
4174
|
+
reelInfoSheet: qr(e.reelInfoSheet),
|
|
4156
4175
|
reelInfoSheetOverlay: !1,
|
|
4157
4176
|
reelMediaSource: "original",
|
|
4158
4177
|
reelOrigin: null,
|
|
@@ -4161,21 +4180,21 @@ function qr(e, t) {
|
|
|
4161
4180
|
}
|
|
4162
4181
|
//#endregion
|
|
4163
4182
|
//#region src/core/options.ts
|
|
4164
|
-
function
|
|
4183
|
+
function Xr(e, t) {
|
|
4165
4184
|
if (t) {
|
|
4166
4185
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
4167
4186
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
4168
4187
|
}
|
|
4169
4188
|
}
|
|
4170
|
-
function
|
|
4189
|
+
function Zr(e, t) {
|
|
4171
4190
|
if (t) {
|
|
4172
4191
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
4173
4192
|
for (let [n, r] of [["paddingX", t.paddingX], ["paddingY", t.paddingY]]) if (r !== void 0 && (!Number.isFinite(r) || r < 0)) throw TypeError(`Vibe mediaCard ${e} ${n} must be a non-negative number.`);
|
|
4174
4193
|
}
|
|
4175
4194
|
}
|
|
4176
|
-
function
|
|
4177
|
-
if (
|
|
4178
|
-
if (
|
|
4195
|
+
function Qr(e) {
|
|
4196
|
+
if (_r(e.autoScroll), Xr("cardHeader", e.cardHeader), Xr("cardFooter", e.cardFooter), Zr("header", e.mediaCard?.header), Zr("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "visible-post") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"visible-post\".");
|
|
4197
|
+
if (sr(e.autofill), kr(e.fill), ke(e.masonry), Wr(e.reelAutoAdvance), e.removalReconciliation) {
|
|
4179
4198
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
4180
4199
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
4181
4200
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -4190,7 +4209,7 @@ function Xr(e) {
|
|
|
4190
4209
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
4191
4210
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
4192
4211
|
}
|
|
4193
|
-
function
|
|
4212
|
+
function $r(e) {
|
|
4194
4213
|
if (typeof e != "string") return e;
|
|
4195
4214
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
4196
4215
|
let t = document.querySelector(e);
|
|
@@ -4199,7 +4218,7 @@ function Zr(e) {
|
|
|
4199
4218
|
}
|
|
4200
4219
|
//#endregion
|
|
4201
4220
|
//#region src/core/pageRequest.ts
|
|
4202
|
-
async function
|
|
4221
|
+
async function ei({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
4203
4222
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
4204
4223
|
received: l.autofill.received,
|
|
4205
4224
|
requests: l.autofill.requests
|
|
@@ -4211,11 +4230,11 @@ async function Qr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4211
4230
|
let m = !1;
|
|
4212
4231
|
try {
|
|
4213
4232
|
if (u?.strategy === "frontend") {
|
|
4214
|
-
let s = await
|
|
4233
|
+
let s = await fr({
|
|
4215
4234
|
existingItems: e ? l.items : [],
|
|
4216
4235
|
initialCursor: n,
|
|
4217
4236
|
loadPage: i,
|
|
4218
|
-
maximumRequests: f ? Math.max(0,
|
|
4237
|
+
maximumRequests: f ? Math.max(0, ir(u) - f.requests) : void 0,
|
|
4219
4238
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
4220
4239
|
onDelayChange: (e) => {
|
|
4221
4240
|
r() && Object.assign(l.autofill, e);
|
|
@@ -4238,7 +4257,7 @@ async function Qr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4238
4257
|
}), o(s.pages), t.clearCollection();
|
|
4239
4258
|
return;
|
|
4240
4259
|
}
|
|
4241
|
-
let s =
|
|
4260
|
+
let s = Hn(await i({
|
|
4242
4261
|
cursor: n,
|
|
4243
4262
|
signal: c
|
|
4244
4263
|
}));
|
|
@@ -4258,7 +4277,7 @@ async function Qr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4258
4277
|
l.autofill.status = "complete";
|
|
4259
4278
|
return;
|
|
4260
4279
|
}
|
|
4261
|
-
await
|
|
4280
|
+
await br(u, l, {
|
|
4262
4281
|
cycleId: p,
|
|
4263
4282
|
feedKey: u.feedKey,
|
|
4264
4283
|
items: h.slice(d.length),
|
|
@@ -4279,17 +4298,76 @@ async function Qr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4279
4298
|
}
|
|
4280
4299
|
}
|
|
4281
4300
|
//#endregion
|
|
4301
|
+
//#region src/core/pageReplacement.ts
|
|
4302
|
+
var ti = class {
|
|
4303
|
+
controller = null;
|
|
4304
|
+
constructor(e) {
|
|
4305
|
+
this.options = e;
|
|
4306
|
+
}
|
|
4307
|
+
isActive() {
|
|
4308
|
+
return this.controller !== null;
|
|
4309
|
+
}
|
|
4310
|
+
cancel() {
|
|
4311
|
+
this.controller?.abort(), this.controller = null, this.options.surface()?.cancelItemRemoval();
|
|
4312
|
+
}
|
|
4313
|
+
async replace(e, t) {
|
|
4314
|
+
let n = Hn(e);
|
|
4315
|
+
this.cancel();
|
|
4316
|
+
let r = new AbortController();
|
|
4317
|
+
this.controller = r;
|
|
4318
|
+
try {
|
|
4319
|
+
if (await this.options.prepare(), r.signal.aborted) return;
|
|
4320
|
+
let e = this.options.state, i = new Map(e.items.map((e) => [String(e.postId), e])), a = [], o = /* @__PURE__ */ new Set();
|
|
4321
|
+
for (let e of n.items) {
|
|
4322
|
+
let t = String(e.postId);
|
|
4323
|
+
o.has(t) || (o.add(t), a.push({
|
|
4324
|
+
...e,
|
|
4325
|
+
postId: i.get(t)?.postId ?? e.postId
|
|
4326
|
+
}));
|
|
4327
|
+
}
|
|
4328
|
+
let s = e.items.filter((e) => !o.has(String(e.postId))).map((e) => e.postId);
|
|
4329
|
+
if (await this.options.surface()?.animateItemRemoval(s, r.signal), r.signal.aborted) return;
|
|
4330
|
+
if (t?.resetScroll) {
|
|
4331
|
+
let e = this.options.surface()?.getAutoScrollElement();
|
|
4332
|
+
e && (e.scrollTop = 0);
|
|
4333
|
+
}
|
|
4334
|
+
e.mediaIndices = new Map(a.map((t) => [t.postId, U(t, e.mediaIndices.get(t.postId) ?? 0)])), e.activeReelPostId !== null && !o.has(String(e.activeReelPostId)) && (e.activeReelPostId = null, e.reelOrigin = null), e.items = a, e.next = n.next, e.total = n.total ?? null, e.error = null, e.nextPageError = null, this.options.commit({
|
|
4335
|
+
...n,
|
|
4336
|
+
items: a
|
|
4337
|
+
});
|
|
4338
|
+
} finally {
|
|
4339
|
+
this.controller === r && (this.controller = null, this.options.surface()?.cancelItemRemoval());
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
};
|
|
4343
|
+
//#endregion
|
|
4344
|
+
//#region src/core/loadingLock.ts
|
|
4345
|
+
function ni(e, t, n) {
|
|
4346
|
+
if (e.loadMoreLocked !== t && (e.loadMoreLocked = t, !t)) {
|
|
4347
|
+
if (e.fill.status === "paused" && e.fill.target) {
|
|
4348
|
+
n.resumeFill();
|
|
4349
|
+
return;
|
|
4350
|
+
}
|
|
4351
|
+
if (e.autofill.status === "paused" || n.hasPendingSession()) {
|
|
4352
|
+
let e = n.getPending();
|
|
4353
|
+
e ? e.finally(() => {
|
|
4354
|
+
n.loadNext();
|
|
4355
|
+
}) : n.loadNext();
|
|
4356
|
+
} else e.infiniteScroll && m(n.loadIfNearBottom);
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
//#endregion
|
|
4282
4360
|
//#region src/core/removalReconciliationController.ts
|
|
4283
|
-
function
|
|
4361
|
+
function ri(e) {
|
|
4284
4362
|
return `${typeof e}:${String(e)}`;
|
|
4285
4363
|
}
|
|
4286
|
-
function
|
|
4364
|
+
function ii(e) {
|
|
4287
4365
|
return `${typeof e}:${String(e)}`;
|
|
4288
4366
|
}
|
|
4289
|
-
function
|
|
4367
|
+
function ai(e) {
|
|
4290
4368
|
return e.map(({ postId: e }) => e);
|
|
4291
4369
|
}
|
|
4292
|
-
var
|
|
4370
|
+
var oi = class {
|
|
4293
4371
|
delay;
|
|
4294
4372
|
enabled;
|
|
4295
4373
|
maxReplayPages;
|
|
@@ -4308,7 +4386,7 @@ var ni = class {
|
|
|
4308
4386
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
4309
4387
|
}
|
|
4310
4388
|
filterItems(e) {
|
|
4311
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
4389
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(ri(e)));
|
|
4312
4390
|
}
|
|
4313
4391
|
needsReconciliation(e) {
|
|
4314
4392
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -4321,45 +4399,45 @@ var ni = class {
|
|
|
4321
4399
|
}
|
|
4322
4400
|
recordInitialPage(e) {
|
|
4323
4401
|
e && this.recordPages([{
|
|
4324
|
-
contributionIds:
|
|
4325
|
-
cursor:
|
|
4402
|
+
contributionIds: ai(e.items),
|
|
4403
|
+
cursor: Kn(e),
|
|
4326
4404
|
next: e.next,
|
|
4327
|
-
returnedIds:
|
|
4405
|
+
returnedIds: ai(e.items)
|
|
4328
4406
|
}]);
|
|
4329
4407
|
}
|
|
4330
4408
|
remove(e) {
|
|
4331
|
-
e.forEach((e) => this.tombstones.add(
|
|
4409
|
+
e.forEach((e) => this.tombstones.add(ri(e)));
|
|
4332
4410
|
}
|
|
4333
4411
|
reset() {
|
|
4334
4412
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
4335
4413
|
}
|
|
4336
4414
|
restore(e) {
|
|
4337
|
-
e.forEach((e) => this.tombstones.delete(
|
|
4415
|
+
e.forEach((e) => this.tombstones.delete(ri(e)));
|
|
4338
4416
|
}
|
|
4339
4417
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
4340
4418
|
let a = this.pending ?? this.createSession(e);
|
|
4341
4419
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
4342
|
-
let e =
|
|
4420
|
+
let e = ii(a.cursor);
|
|
4343
4421
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
4344
|
-
if (await
|
|
4345
|
-
delayMs:
|
|
4422
|
+
if (await nr({
|
|
4423
|
+
delayMs: er(a.pages.length, this.delay),
|
|
4346
4424
|
onChange: n,
|
|
4347
4425
|
signal: i
|
|
4348
4426
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
4349
|
-
let o =
|
|
4427
|
+
let o = Hn(await t({
|
|
4350
4428
|
cursor: a.cursor,
|
|
4351
4429
|
signal: i
|
|
4352
4430
|
}));
|
|
4353
4431
|
a.seenCursors.add(e);
|
|
4354
4432
|
let s = this.filterItems(o.items), c = [];
|
|
4355
4433
|
if (s.forEach((e) => {
|
|
4356
|
-
let t =
|
|
4434
|
+
let t = ri(e.postId);
|
|
4357
4435
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
4358
4436
|
}), a.pages.push({
|
|
4359
4437
|
contributionIds: c,
|
|
4360
4438
|
cursor: a.cursor,
|
|
4361
4439
|
next: o.next,
|
|
4362
|
-
returnedIds:
|
|
4440
|
+
returnedIds: ai(s)
|
|
4363
4441
|
}), a.lastCursor = a.cursor, a.next = o.next, --a.remainingRequests, o.total !== void 0 && (a.total = o.total), a.next === null ? a.remainingRequests = 0 : a.cursor = a.next, a.remainingRequests > 0 && r()) return this.result(a, "paused");
|
|
4364
4442
|
}
|
|
4365
4443
|
return this.result(a, "complete");
|
|
@@ -4367,9 +4445,9 @@ var ni = class {
|
|
|
4367
4445
|
createSession(e) {
|
|
4368
4446
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
4369
4447
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
4370
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
4448
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(ri))), a = new Set(e.map(({ postId: e }) => ri(e)).filter((e) => !i.has(e)));
|
|
4371
4449
|
return {
|
|
4372
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
4450
|
+
appended: new Set(e.map(({ postId: e }) => ri(e))),
|
|
4373
4451
|
attributed: new Set(a),
|
|
4374
4452
|
cursor: r.cursor,
|
|
4375
4453
|
items: [],
|
|
@@ -4394,11 +4472,11 @@ var ni = class {
|
|
|
4394
4472
|
}
|
|
4395
4473
|
findUnderfilledPage(e) {
|
|
4396
4474
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
4397
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
4398
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
4475
|
+
let t = new Set(e.map(({ postId: e }) => ri(e)));
|
|
4476
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(ri(e))).length < this.pageSize);
|
|
4399
4477
|
}
|
|
4400
4478
|
recordPage(e) {
|
|
4401
|
-
let t =
|
|
4479
|
+
let t = ii(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ii(e) === t);
|
|
4402
4480
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
4403
4481
|
...e,
|
|
4404
4482
|
contributionIds: [...e.contributionIds],
|
|
@@ -4408,7 +4486,7 @@ var ni = class {
|
|
|
4408
4486
|
};
|
|
4409
4487
|
//#endregion
|
|
4410
4488
|
//#region src/core/activeItemRemoval.ts
|
|
4411
|
-
function
|
|
4489
|
+
function si(e, t, n, r, i) {
|
|
4412
4490
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
4413
4491
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
4414
4492
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -4421,7 +4499,7 @@ function ri(e, t, n, r, i) {
|
|
|
4421
4499
|
}
|
|
4422
4500
|
//#endregion
|
|
4423
4501
|
//#region src/core/exactMediaRemovalController.ts
|
|
4424
|
-
function
|
|
4502
|
+
function ci(e, t) {
|
|
4425
4503
|
let [n, ...r] = t;
|
|
4426
4504
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
4427
4505
|
return {
|
|
@@ -4430,10 +4508,10 @@ function ii(e, t) {
|
|
|
4430
4508
|
items: r
|
|
4431
4509
|
};
|
|
4432
4510
|
}
|
|
4433
|
-
function
|
|
4511
|
+
function li(e) {
|
|
4434
4512
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
4435
4513
|
}
|
|
4436
|
-
var
|
|
4514
|
+
var ui = class {
|
|
4437
4515
|
generation = 0;
|
|
4438
4516
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
4439
4517
|
state;
|
|
@@ -4441,7 +4519,7 @@ var oi = class {
|
|
|
4441
4519
|
this.options = e, this.state = e.state;
|
|
4442
4520
|
}
|
|
4443
4521
|
remove(e) {
|
|
4444
|
-
|
|
4522
|
+
li(e);
|
|
4445
4523
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
4446
4524
|
if (!n) return null;
|
|
4447
4525
|
let r = [...H(n)], i = r[e.mediaIndex];
|
|
@@ -4458,7 +4536,7 @@ var oi = class {
|
|
|
4458
4536
|
restored: !1
|
|
4459
4537
|
});
|
|
4460
4538
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
4461
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
4539
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = ci(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
|
|
4462
4540
|
}
|
|
4463
4541
|
reset() {
|
|
4464
4542
|
this.generation += 1;
|
|
@@ -4484,7 +4562,7 @@ var oi = class {
|
|
|
4484
4562
|
}
|
|
4485
4563
|
restoreIntoPost(e, t) {
|
|
4486
4564
|
let n = this.state.items[e], r = [...H(n)], i = Math.min(t.mediaIndex, r.length);
|
|
4487
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
4565
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = ci(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
4488
4566
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
4489
4567
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
4490
4568
|
}
|
|
@@ -4497,18 +4575,18 @@ var oi = class {
|
|
|
4497
4575
|
};
|
|
4498
4576
|
//#endregion
|
|
4499
4577
|
//#region src/core/itemPlacement.ts
|
|
4500
|
-
function
|
|
4578
|
+
function di(e, t) {
|
|
4501
4579
|
let n = new Set(t);
|
|
4502
4580
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
4503
4581
|
index: t,
|
|
4504
4582
|
item: e
|
|
4505
4583
|
}] : []);
|
|
4506
4584
|
}
|
|
4507
|
-
function
|
|
4585
|
+
function fi(e, t) {
|
|
4508
4586
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
4509
4587
|
return e.filter((e) => !n.has(e.postId));
|
|
4510
4588
|
}
|
|
4511
|
-
function
|
|
4589
|
+
function pi(e, t) {
|
|
4512
4590
|
t.forEach(({ index: e }) => {
|
|
4513
4591
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
4514
4592
|
});
|
|
@@ -4519,7 +4597,7 @@ function li(e, t) {
|
|
|
4519
4597
|
}
|
|
4520
4598
|
//#endregion
|
|
4521
4599
|
//#region src/core/itemRemovalController.ts
|
|
4522
|
-
var
|
|
4600
|
+
var mi = 20, hi = class {
|
|
4523
4601
|
generation = 0;
|
|
4524
4602
|
historyLimit;
|
|
4525
4603
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -4528,7 +4606,7 @@ var ui = 20, di = class {
|
|
|
4528
4606
|
itemOrder;
|
|
4529
4607
|
stopItemsWatcher;
|
|
4530
4608
|
constructor(e) {
|
|
4531
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
4609
|
+
this.options = e, this.historyLimit = e.historyLimit ?? mi, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = O(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
4532
4610
|
}
|
|
4533
4611
|
destroy() {
|
|
4534
4612
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -4542,7 +4620,7 @@ var ui = 20, di = class {
|
|
|
4542
4620
|
let a = this.options.startRemoval(i, t);
|
|
4543
4621
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
4544
4622
|
let o = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), s = new Set(n.map(({ item: e }) => e.postId)), c = o < 0 ? 0 : this.state.items.slice(0, o).filter(({ postId: e }) => s.has(e)).length, l = Math.max(o - c, 0);
|
|
4545
|
-
return this.state.items =
|
|
4623
|
+
return this.state.items = fi(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
4546
4624
|
}
|
|
4547
4625
|
reset() {
|
|
4548
4626
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -4553,7 +4631,7 @@ var ui = 20, di = class {
|
|
|
4553
4631
|
this.restoreRemoval(t);
|
|
4554
4632
|
return;
|
|
4555
4633
|
}
|
|
4556
|
-
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i =
|
|
4634
|
+
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = pi(this.state.items, r);
|
|
4557
4635
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
4558
4636
|
}
|
|
4559
4637
|
restoreRemoval(e) {
|
|
@@ -4579,7 +4657,7 @@ var ui = 20, di = class {
|
|
|
4579
4657
|
}
|
|
4580
4658
|
collectOrderedPlacements(e) {
|
|
4581
4659
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4582
|
-
return
|
|
4660
|
+
return di(this.state.items, e).map((e) => ({
|
|
4583
4661
|
index: t.get(e.item.postId) ?? e.index,
|
|
4584
4662
|
item: e.item
|
|
4585
4663
|
}));
|
|
@@ -4610,7 +4688,7 @@ var ui = 20, di = class {
|
|
|
4610
4688
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4611
4689
|
return this.state.items = [...this.state.items, ...n].sort((e, t) => (r.get(e.postId) ?? 2 ** 53 - 1) - (r.get(t.postId) ?? 2 ** 53 - 1)), !0;
|
|
4612
4690
|
}
|
|
4613
|
-
},
|
|
4691
|
+
}, gi = class {
|
|
4614
4692
|
forward = null;
|
|
4615
4693
|
forwardPromise = null;
|
|
4616
4694
|
forwardVersion = 0;
|
|
@@ -4638,10 +4716,10 @@ var ui = 20, di = class {
|
|
|
4638
4716
|
this.forwardVersion += 1, this.forward = null, this.forwardPromise = null, this.clearState();
|
|
4639
4717
|
}
|
|
4640
4718
|
retry() {
|
|
4641
|
-
return !this.forward || this.state.reelForward.status === "idle" ? Promise.resolve() : (this.state.nextPageError = null, this.state.reelForward = {
|
|
4719
|
+
return !this.forward || this.state.reelForward.status === "idle" ? Promise.resolve() : this.forwardPromise ? this.forwardPromise.then(() => this.retry()) : (this.state.nextPageError = null, this.state.reelForward = {
|
|
4642
4720
|
error: null,
|
|
4643
4721
|
status: "loading"
|
|
4644
|
-
}, this.startForwardRequest());
|
|
4722
|
+
}, this.startForwardRequest(!0));
|
|
4645
4723
|
}
|
|
4646
4724
|
clearState() {
|
|
4647
4725
|
this.state.reelForward = {
|
|
@@ -4649,28 +4727,28 @@ var ui = 20, di = class {
|
|
|
4649
4727
|
status: "idle"
|
|
4650
4728
|
}, this.state.reelForwardIndex = null, this.state.reelForwardItem = null;
|
|
4651
4729
|
}
|
|
4652
|
-
|
|
4653
|
-
return this.state.loadMoreLocked ? (this.state.reelOrigin === "masonry" ? (this.reset(), this.options.onCloseReel()) : this.state.reelForward = {
|
|
4730
|
+
stopAtPaginationBoundary(e) {
|
|
4731
|
+
return !this.state.loadMoreLocked && (this.state.infiniteScroll || e) ? !1 : (this.state.reelOrigin === "masonry" ? (this.reset(), this.options.onCloseReel()) : this.state.reelForward = {
|
|
4654
4732
|
error: null,
|
|
4655
4733
|
status: "end"
|
|
4656
|
-
}, !0)
|
|
4734
|
+
}, !0);
|
|
4657
4735
|
}
|
|
4658
|
-
startForwardRequest() {
|
|
4736
|
+
startForwardRequest(e = !1) {
|
|
4659
4737
|
if (this.forwardPromise) return this.forwardPromise;
|
|
4660
|
-
let
|
|
4661
|
-
return this.forwardPromise =
|
|
4662
|
-
this.forwardPromise ===
|
|
4738
|
+
let t = this.loadForward(e);
|
|
4739
|
+
return this.forwardPromise = t, t.finally(() => {
|
|
4740
|
+
this.forwardPromise === t && (this.forwardPromise = null, this.forward && this.state.reelForward.status === "loading" && this.startForwardRequest(e));
|
|
4663
4741
|
});
|
|
4664
4742
|
}
|
|
4665
|
-
async loadForward() {
|
|
4666
|
-
let
|
|
4667
|
-
if (
|
|
4668
|
-
let
|
|
4669
|
-
if (
|
|
4670
|
-
this.forward = null, this.clearState(), this.options.onActivate(
|
|
4743
|
+
async loadForward(e) {
|
|
4744
|
+
let t = this.forward;
|
|
4745
|
+
if (t) for (; this.forward === t && t.version === this.forwardVersion;) {
|
|
4746
|
+
let n = this.state.items[t.postIndex];
|
|
4747
|
+
if (n) {
|
|
4748
|
+
this.forward = null, this.clearState(), this.options.onActivate(n.postId);
|
|
4671
4749
|
return;
|
|
4672
4750
|
}
|
|
4673
|
-
if (this.
|
|
4751
|
+
if (this.stopAtPaginationBoundary(e)) return;
|
|
4674
4752
|
if (this.state.nextPageError) {
|
|
4675
4753
|
this.state.reelForward = {
|
|
4676
4754
|
error: this.state.nextPageError,
|
|
@@ -4678,10 +4756,10 @@ var ui = 20, di = class {
|
|
|
4678
4756
|
};
|
|
4679
4757
|
return;
|
|
4680
4758
|
}
|
|
4681
|
-
let
|
|
4682
|
-
if (await this.options.replenishAfterRemoval(), this.forward !==
|
|
4683
|
-
if (!this.state.items[
|
|
4684
|
-
if (this.
|
|
4759
|
+
let r = this.state.next, i = this.state.items.length;
|
|
4760
|
+
if (await this.options.replenishAfterRemoval(e), this.forward !== t || t.version !== this.forwardVersion) return;
|
|
4761
|
+
if (!this.state.items[t.postIndex]) {
|
|
4762
|
+
if (this.stopAtPaginationBoundary(e)) return;
|
|
4685
4763
|
if (this.state.nextPageError) {
|
|
4686
4764
|
this.state.reelForward = {
|
|
4687
4765
|
error: this.state.nextPageError,
|
|
@@ -4696,7 +4774,7 @@ var ui = 20, di = class {
|
|
|
4696
4774
|
};
|
|
4697
4775
|
return;
|
|
4698
4776
|
}
|
|
4699
|
-
if (this.state.next ===
|
|
4777
|
+
if (this.state.next === r && this.state.items.length === i) {
|
|
4700
4778
|
this.state.reelForward = {
|
|
4701
4779
|
error: /* @__PURE__ */ Error("Vibe could not advance while page loading is unavailable."),
|
|
4702
4780
|
status: "error"
|
|
@@ -4706,7 +4784,7 @@ var ui = 20, di = class {
|
|
|
4706
4784
|
}
|
|
4707
4785
|
}
|
|
4708
4786
|
}
|
|
4709
|
-
},
|
|
4787
|
+
}, _i = class {
|
|
4710
4788
|
generation = 0;
|
|
4711
4789
|
pending = Promise.resolve();
|
|
4712
4790
|
constructor(e) {
|
|
@@ -4756,24 +4834,24 @@ var ui = 20, di = class {
|
|
|
4756
4834
|
};
|
|
4757
4835
|
//#endregion
|
|
4758
4836
|
//#region src/core/removalControllers.ts
|
|
4759
|
-
function
|
|
4760
|
-
let t = new
|
|
4837
|
+
function vi(e) {
|
|
4838
|
+
let t = new gi(e), n = new _i({
|
|
4761
4839
|
state: e.state,
|
|
4762
4840
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4763
4841
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4764
4842
|
});
|
|
4765
4843
|
return {
|
|
4766
|
-
exactMediaRemoval: new
|
|
4844
|
+
exactMediaRemoval: new ui({
|
|
4767
4845
|
onActivate: e.onActivate,
|
|
4768
4846
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4769
4847
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4770
4848
|
reelForward: t,
|
|
4771
4849
|
state: e.state
|
|
4772
4850
|
}),
|
|
4773
|
-
itemRemoval: new
|
|
4851
|
+
itemRemoval: new hi({
|
|
4774
4852
|
historyLimit: e.historyLimit,
|
|
4775
4853
|
onItemsRemoved: (n, r, i) => {
|
|
4776
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4854
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), si(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4777
4855
|
},
|
|
4778
4856
|
onRemovalRestored: (n) => {
|
|
4779
4857
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4788,17 +4866,17 @@ function mi(e) {
|
|
|
4788
4866
|
reelRemoval: n
|
|
4789
4867
|
};
|
|
4790
4868
|
}
|
|
4791
|
-
var
|
|
4792
|
-
function
|
|
4869
|
+
var yi = 1.5;
|
|
4870
|
+
function bi(e) {
|
|
4793
4871
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4794
4872
|
if (t > 0 && t < 600) return !0;
|
|
4795
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4873
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * yi;
|
|
4796
4874
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4797
4875
|
}
|
|
4798
|
-
function
|
|
4799
|
-
return
|
|
4876
|
+
function xi(e) {
|
|
4877
|
+
return bi(e) ? "reel" : "masonry";
|
|
4800
4878
|
}
|
|
4801
|
-
function
|
|
4879
|
+
function Si(e) {
|
|
4802
4880
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4803
4881
|
return {
|
|
4804
4882
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4808,15 +4886,15 @@ function vi(e) {
|
|
|
4808
4886
|
viewportWidth: n.clientWidth
|
|
4809
4887
|
};
|
|
4810
4888
|
}
|
|
4811
|
-
function
|
|
4812
|
-
return
|
|
4889
|
+
function Ci(e) {
|
|
4890
|
+
return bi(Si(e));
|
|
4813
4891
|
}
|
|
4814
|
-
function
|
|
4815
|
-
return
|
|
4892
|
+
function wi(e) {
|
|
4893
|
+
return xi(Si(e));
|
|
4816
4894
|
}
|
|
4817
4895
|
//#endregion
|
|
4818
4896
|
//#region src/core/responsiveLayoutController.ts
|
|
4819
|
-
var
|
|
4897
|
+
var Ti = class {
|
|
4820
4898
|
layoutMode;
|
|
4821
4899
|
resizeObserver = null;
|
|
4822
4900
|
target = null;
|
|
@@ -4841,13 +4919,13 @@ var xi = class {
|
|
|
4841
4919
|
}
|
|
4842
4920
|
handleResponsiveLayout = () => {
|
|
4843
4921
|
if (!this.target) return;
|
|
4844
|
-
let e =
|
|
4845
|
-
this.state.phoneMode =
|
|
4922
|
+
let e = wi(this.target);
|
|
4923
|
+
this.state.phoneMode = Ci(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4846
4924
|
};
|
|
4847
|
-
},
|
|
4925
|
+
}, Ei = class {
|
|
4848
4926
|
state;
|
|
4849
4927
|
constructor(e) {
|
|
4850
|
-
this.options = e, this.state = x(
|
|
4928
|
+
this.options = e, this.state = x(zt({
|
|
4851
4929
|
...e.initialReelAudioState,
|
|
4852
4930
|
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
4853
4931
|
}));
|
|
@@ -4856,9 +4934,9 @@ var xi = class {
|
|
|
4856
4934
|
return { ...this.state };
|
|
4857
4935
|
}
|
|
4858
4936
|
set(e, t = !1) {
|
|
4859
|
-
Object.assign(this.state,
|
|
4937
|
+
Object.assign(this.state, zt(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4860
4938
|
}
|
|
4861
|
-
},
|
|
4939
|
+
}, Di = class {
|
|
4862
4940
|
routedReelPostId = null;
|
|
4863
4941
|
reelRouteIsActive = !1;
|
|
4864
4942
|
constructor(e, t) {
|
|
@@ -4888,30 +4966,30 @@ var xi = class {
|
|
|
4888
4966
|
};
|
|
4889
4967
|
//#endregion
|
|
4890
4968
|
//#region src/core/updateItems.ts
|
|
4891
|
-
function
|
|
4969
|
+
function Oi(e) {
|
|
4892
4970
|
return String(e);
|
|
4893
4971
|
}
|
|
4894
|
-
function
|
|
4972
|
+
function ki(e, t) {
|
|
4895
4973
|
let n = H(t).length;
|
|
4896
4974
|
(e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
|
|
4897
4975
|
}
|
|
4898
|
-
function
|
|
4976
|
+
function Ai(e, t) {
|
|
4899
4977
|
let n = /* @__PURE__ */ new Map();
|
|
4900
|
-
if (t.forEach((e) => n.set(
|
|
4978
|
+
if (t.forEach((e) => n.set(Oi(e.postId), e)), n.size === 0) return [];
|
|
4901
4979
|
let r = [], i = e.items.map((t) => {
|
|
4902
|
-
let i = n.get(
|
|
4980
|
+
let i = n.get(Oi(t.postId));
|
|
4903
4981
|
if (!i) return t;
|
|
4904
4982
|
let a = {
|
|
4905
4983
|
...i,
|
|
4906
4984
|
postId: t.postId
|
|
4907
4985
|
};
|
|
4908
|
-
return
|
|
4986
|
+
return ki(e, a), e.reelForwardItem && Oi(e.reelForwardItem.postId) === Oi(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
|
|
4909
4987
|
});
|
|
4910
4988
|
return r.length > 0 && (e.items = i), r;
|
|
4911
4989
|
}
|
|
4912
4990
|
//#endregion
|
|
4913
4991
|
//#region src/core/createVibe.ts
|
|
4914
|
-
var
|
|
4992
|
+
var ji = class {
|
|
4915
4993
|
app = null;
|
|
4916
4994
|
autoScroll;
|
|
4917
4995
|
autofillController;
|
|
@@ -4933,25 +5011,26 @@ var Di = class {
|
|
|
4933
5011
|
notificationItems;
|
|
4934
5012
|
reelAudio;
|
|
4935
5013
|
state;
|
|
5014
|
+
pageReplacement;
|
|
4936
5015
|
constructor(e) {
|
|
4937
|
-
this.options = e,
|
|
5016
|
+
this.options = e, Qr(e);
|
|
4938
5017
|
let t = e.layout ?? "masonry";
|
|
4939
|
-
this.state = x(
|
|
5018
|
+
this.state = x(Yr(e, t)), this.reelAudio = new Ei(e), this.lastLoadedCursor = e.initialPage ? Kn(e.initialPage) : null, this.notificationItems = K(this.state), this.autoScroll = new yr({
|
|
4940
5019
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4941
5020
|
state: this.state.autoScroll
|
|
4942
|
-
}), this.autofillController = new
|
|
4943
|
-
cancelRequest: () => this.cancelRequest(),
|
|
5021
|
+
}), this.autofillController = new pr({
|
|
5022
|
+
cancelRequest: () => this.cancelRequest(!this.pageReplacement?.isActive()),
|
|
4944
5023
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4945
5024
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4946
5025
|
options: e.autofill,
|
|
4947
5026
|
state: this.state
|
|
4948
|
-
}), this.removalReconciliation = new
|
|
5027
|
+
}), this.removalReconciliation = new oi(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Br({
|
|
4949
5028
|
fill: e.fill,
|
|
4950
5029
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4951
5030
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4952
5031
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4953
5032
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4954
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
5033
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Vr({
|
|
4955
5034
|
controller: this.removalReconciliation,
|
|
4956
5035
|
isCurrent: t,
|
|
4957
5036
|
loadPage: e.loadPage,
|
|
@@ -4961,31 +5040,40 @@ var Di = class {
|
|
|
4961
5040
|
state: this.state
|
|
4962
5041
|
}),
|
|
4963
5042
|
state: this.state
|
|
4964
|
-
}), this.routing = new
|
|
4965
|
-
let n =
|
|
5043
|
+
}), this.routing = new Di(e.routing, this.state);
|
|
5044
|
+
let n = vi({
|
|
4966
5045
|
historyLimit: e.removalHistoryLimit,
|
|
4967
5046
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4968
5047
|
onCloseReel: () => this.closeMasonryReel(),
|
|
4969
5048
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
4970
5049
|
onItemsRestored: (e) => this.removalReconciliation.restore(e),
|
|
4971
|
-
replenishAfterRemoval: () => this.replenishAfterRemoval(),
|
|
5050
|
+
replenishAfterRemoval: (e) => this.replenishAfterRemoval(e),
|
|
4972
5051
|
state: this.state,
|
|
4973
5052
|
surface: () => this.surface
|
|
4974
5053
|
});
|
|
4975
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.
|
|
5054
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.pageReplacement = new ti({
|
|
5055
|
+
state: this.state,
|
|
5056
|
+
surface: () => this.surface,
|
|
5057
|
+
prepare: async () => {
|
|
5058
|
+
this.cancelRequest(!1), lr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill();
|
|
5059
|
+
},
|
|
5060
|
+
commit: (e) => {
|
|
5061
|
+
this.resetFeedVisit(), this.setCurrentCursor(Kn(e)), this.removalReconciliation.recordInitialPage(e), this.state.reelOrigin === null && this.routing.syncFeed();
|
|
5062
|
+
}
|
|
5063
|
+
}), this.responsiveLayout = new Ti(t, this.state, () => {
|
|
4976
5064
|
this.routing.syncFeed();
|
|
4977
5065
|
}), this.startStateNotifications();
|
|
4978
5066
|
}
|
|
4979
5067
|
async mount() {
|
|
4980
5068
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4981
5069
|
this.startStateNotifications();
|
|
4982
|
-
let e =
|
|
4983
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
5070
|
+
let e = $r(this.options.target);
|
|
5071
|
+
this.responsiveLayout.mount(e), this.app = i(Vn, {
|
|
4984
5072
|
canRetryEnd: !!this.options.loadPage,
|
|
4985
5073
|
cardFooter: this.options.cardFooter,
|
|
4986
5074
|
cardHeader: this.options.cardHeader,
|
|
4987
5075
|
feedFooter: this.options.feedFooter,
|
|
4988
|
-
feedFooterActions:
|
|
5076
|
+
feedFooterActions: Hr(this),
|
|
4989
5077
|
mediaCard: this.options.mediaCard,
|
|
4990
5078
|
masonry: this.options.masonry,
|
|
4991
5079
|
onMediaFullyVisible: this.options.onMediaFullyVisible,
|
|
@@ -5011,7 +5099,7 @@ var Di = class {
|
|
|
5011
5099
|
onRetryForward: () => {
|
|
5012
5100
|
this.retryReelForward();
|
|
5013
5101
|
}
|
|
5014
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
5102
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await wr(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
5015
5103
|
this.restoreController = e;
|
|
5016
5104
|
}), !this.options.initialPage && this.state.items.length === 0 ? await this.reload() : this.options.autofill && this.state.autofill.status === "idle" && !this.fillController.isActive() && !this.state.loadMoreLocked && await this.startInitialAutofill();
|
|
5017
5105
|
}
|
|
@@ -5019,7 +5107,7 @@ var Di = class {
|
|
|
5019
5107
|
this.restoreController?.abort(), this.restoreController = null, this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.removalReconciliation.reset(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
5020
5108
|
}
|
|
5021
5109
|
getState() {
|
|
5022
|
-
return
|
|
5110
|
+
return J(this.state);
|
|
5023
5111
|
}
|
|
5024
5112
|
getReelAudioState() {
|
|
5025
5113
|
return this.reelAudio.get();
|
|
@@ -5046,7 +5134,7 @@ var Di = class {
|
|
|
5046
5134
|
return this.itemRemoval.restoreRemoval(e);
|
|
5047
5135
|
}
|
|
5048
5136
|
updateItems(e) {
|
|
5049
|
-
return
|
|
5137
|
+
return Ai(this.state, e);
|
|
5050
5138
|
}
|
|
5051
5139
|
retryReelForward() {
|
|
5052
5140
|
return this.reelForward.retry();
|
|
@@ -5085,22 +5173,21 @@ var Di = class {
|
|
|
5085
5173
|
this.autoScroll.setSpeed(e);
|
|
5086
5174
|
}
|
|
5087
5175
|
applyAutofillUpdate(e) {
|
|
5088
|
-
let t =
|
|
5176
|
+
let t = Sr(this.options.autofill, this.state, e);
|
|
5089
5177
|
return t && this.autofillController.syncCountdown(), t;
|
|
5090
5178
|
}
|
|
5091
5179
|
cancelAutofill() {
|
|
5092
5180
|
return this.autofillController.cancel();
|
|
5093
5181
|
}
|
|
5094
5182
|
async cancelLoading() {
|
|
5095
|
-
if (this.state.loadMoreLocked = !1, this.fillController.isActive()) {
|
|
5183
|
+
if (this.state.loadMoreLocked = !1, this.cancelRequest(), this.fillController.isActive()) {
|
|
5096
5184
|
await this.cancelFill();
|
|
5097
5185
|
return;
|
|
5098
5186
|
}
|
|
5099
|
-
if (
|
|
5187
|
+
if (lr(this.state.autofill)) {
|
|
5100
5188
|
await this.cancelAutofill();
|
|
5101
5189
|
return;
|
|
5102
5190
|
}
|
|
5103
|
-
this.cancelRequest();
|
|
5104
5191
|
}
|
|
5105
5192
|
applyFillUpdate(e) {
|
|
5106
5193
|
return this.fillController.applyUpdate(e);
|
|
@@ -5109,13 +5196,13 @@ var Di = class {
|
|
|
5109
5196
|
return this.fillController.cancel();
|
|
5110
5197
|
}
|
|
5111
5198
|
async fill(e) {
|
|
5112
|
-
if (!this.state.loadMoreLocked) {
|
|
5113
|
-
if (this.pendingRequest ||
|
|
5199
|
+
if (!(this.state.loadMoreLocked || this.pageReplacement.isActive())) {
|
|
5200
|
+
if (this.pendingRequest || lr(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
5114
5201
|
await this.fillController.start(e);
|
|
5115
5202
|
}
|
|
5116
5203
|
}
|
|
5117
5204
|
restoreAutofillSession(e) {
|
|
5118
|
-
let t =
|
|
5205
|
+
let t = Cr(this.options.autofill, this.state, e);
|
|
5119
5206
|
return t && this.autofillController.syncCountdown(), t;
|
|
5120
5207
|
}
|
|
5121
5208
|
restoreFillSession(e) {
|
|
@@ -5125,18 +5212,19 @@ var Di = class {
|
|
|
5125
5212
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
5126
5213
|
}
|
|
5127
5214
|
appendPage(e) {
|
|
5128
|
-
|
|
5215
|
+
qn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
5129
5216
|
}
|
|
5130
|
-
replenishAfterRemoval() {
|
|
5131
|
-
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
5217
|
+
replenishAfterRemoval(e = !0) {
|
|
5218
|
+
return this.startLoadMore(() => this.replenishAfterRemovalSequence(e));
|
|
5132
5219
|
}
|
|
5133
5220
|
async startLoadMore(e) {
|
|
5221
|
+
if (this.pageReplacement.isActive()) return;
|
|
5134
5222
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5135
|
-
if (this.state.loadMoreLocked ||
|
|
5223
|
+
if (this.state.loadMoreLocked || lr(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
5136
5224
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
5137
5225
|
let t = e();
|
|
5138
5226
|
return this.pendingRequest = t, t.finally(() => {
|
|
5139
|
-
this.pendingRequest === t && (this.pendingRequest = null
|
|
5227
|
+
this.pendingRequest === t && (this.pendingRequest = null, this.state.isLoadingMore = !1);
|
|
5140
5228
|
});
|
|
5141
5229
|
}
|
|
5142
5230
|
async refresh() {
|
|
@@ -5145,78 +5233,83 @@ var Di = class {
|
|
|
5145
5233
|
async reload() {
|
|
5146
5234
|
return this.replaceFeed(null, "reload");
|
|
5147
5235
|
}
|
|
5236
|
+
replacePage(e, t) {
|
|
5237
|
+
return this.pageReplacement.replace(e, t);
|
|
5238
|
+
}
|
|
5148
5239
|
async replaceFeed(e, t) {
|
|
5149
5240
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
5150
|
-
return
|
|
5241
|
+
return lr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.resetFeedVisit(), this.surface?.resetMediaLifecycle(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
|
|
5242
|
+
}
|
|
5243
|
+
resetFeedVisit() {
|
|
5244
|
+
this.state.autofill = cr(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset();
|
|
5151
5245
|
}
|
|
5152
5246
|
async loadFilteredPage(e) {
|
|
5153
5247
|
let t = this.options.loadPage;
|
|
5154
5248
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
5155
|
-
let n =
|
|
5249
|
+
let n = Hn(await t(e));
|
|
5156
5250
|
return {
|
|
5157
5251
|
...n,
|
|
5158
5252
|
items: this.removalReconciliation.filterItems(n.items)
|
|
5159
5253
|
};
|
|
5160
5254
|
}
|
|
5161
5255
|
async loadNextSequence() {
|
|
5162
|
-
this.removalReconciliation.needsReconciliation(this.state.items) && !await this.reconcileBeforeNext() || this.state.loadMoreLocked || this.state.next
|
|
5256
|
+
this.removalReconciliation.needsReconciliation(this.state.items) && !await this.reconcileBeforeNext() || this.state.loadMoreLocked || this.state.next === null || await this.fetchPage(this.state.next, !0);
|
|
5163
5257
|
}
|
|
5164
|
-
async replenishAfterRemovalSequence() {
|
|
5165
|
-
|
|
5166
|
-
|
|
5258
|
+
async replenishAfterRemovalSequence(e) {
|
|
5259
|
+
if (!e && !this.state.infiniteScroll) return;
|
|
5260
|
+
let t = this.state.items.length;
|
|
5261
|
+
this.removalReconciliation.needsReconciliation(this.state.items) && (!await this.reconcileBeforeNext(!e) || this.state.items.length > t) || this.state.loadMoreLocked || !e && !this.state.infiniteScroll || this.state.next === null || await this.fetchPage(this.state.next, !0);
|
|
5167
5262
|
}
|
|
5168
|
-
async reconcileBeforeNext() {
|
|
5169
|
-
let
|
|
5170
|
-
if (!
|
|
5171
|
-
let
|
|
5172
|
-
this.abortController =
|
|
5263
|
+
async reconcileBeforeNext(e = !1) {
|
|
5264
|
+
let t = this.options.loadPage;
|
|
5265
|
+
if (!t) return !1;
|
|
5266
|
+
let n = ++this.requestVersion, r = new AbortController();
|
|
5267
|
+
this.abortController = r;
|
|
5173
5268
|
try {
|
|
5174
|
-
let
|
|
5269
|
+
let i = await Vr({
|
|
5175
5270
|
controller: this.removalReconciliation,
|
|
5176
|
-
isCurrent: () =>
|
|
5177
|
-
loadPage:
|
|
5271
|
+
isCurrent: () => n === this.requestVersion,
|
|
5272
|
+
loadPage: t,
|
|
5178
5273
|
onDelayChange: () => void 0,
|
|
5274
|
+
pauseWhenManual: e,
|
|
5179
5275
|
setLastCursor: (e) => this.setCurrentCursor(e),
|
|
5180
|
-
signal:
|
|
5276
|
+
signal: r.signal,
|
|
5181
5277
|
state: this.state
|
|
5182
5278
|
});
|
|
5183
|
-
return
|
|
5279
|
+
return n === this.requestVersion && i === "complete" && (this.state.nextPageError = null), n === this.requestVersion && i === "complete";
|
|
5184
5280
|
} catch (e) {
|
|
5185
|
-
return !
|
|
5281
|
+
return !r.signal.aborted && n === this.requestVersion && (this.state.nextPageError = e), !1;
|
|
5186
5282
|
} finally {
|
|
5187
|
-
this.abortController ===
|
|
5283
|
+
this.abortController === r && (this.abortController = null);
|
|
5188
5284
|
}
|
|
5189
5285
|
}
|
|
5190
5286
|
async retryEnd() {
|
|
5191
|
-
if (this.
|
|
5192
|
-
|
|
5287
|
+
if (!this.pageReplacement.isActive()) {
|
|
5288
|
+
if (this.pendingRequest) return this.pendingRequest;
|
|
5289
|
+
if (!this.state.loadMoreLocked && !(lr(this.state.autofill) || this.fillController.isActive()) && !(this.state.next !== null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.lastLoadedCursor, !0);
|
|
5290
|
+
}
|
|
5193
5291
|
}
|
|
5194
5292
|
setInfiniteScroll(e) {
|
|
5195
5293
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
5196
5294
|
}
|
|
5197
5295
|
setLoadMoreLocked(e) {
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
e ? e.finally(() => {
|
|
5206
|
-
this.loadNext();
|
|
5207
|
-
}) : this.loadNext();
|
|
5208
|
-
} else this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom());
|
|
5209
|
-
}
|
|
5296
|
+
ni(this.state, e, {
|
|
5297
|
+
getPending: () => this.pendingRequest,
|
|
5298
|
+
hasPendingSession: () => this.removalReconciliation.hasPendingSession(),
|
|
5299
|
+
loadNext: () => this.loadNext(),
|
|
5300
|
+
resumeFill: () => this.fillController.resume(this.removalReconciliation.hasPendingSession()),
|
|
5301
|
+
loadIfNearBottom: () => this.surface?.loadIfNearBottom()
|
|
5302
|
+
});
|
|
5210
5303
|
}
|
|
5211
5304
|
setTotal(e) {
|
|
5212
5305
|
if (e !== null && (!Number.isInteger(e) || e < 0)) throw TypeError("Vibe total must be a non-negative integer or null.");
|
|
5213
5306
|
this.state.total = e;
|
|
5214
5307
|
}
|
|
5215
5308
|
setReelAutoAdvance(e) {
|
|
5216
|
-
|
|
5309
|
+
Kr(this.state.reelAutoAdvance, e);
|
|
5217
5310
|
}
|
|
5218
5311
|
setReelInfoSheet(e) {
|
|
5219
|
-
|
|
5312
|
+
Jr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
5220
5313
|
}
|
|
5221
5314
|
setLayout(e) {
|
|
5222
5315
|
this.responsiveLayout.setLayout(e);
|
|
@@ -5230,13 +5323,13 @@ var Di = class {
|
|
|
5230
5323
|
setActiveReelPost(e) {
|
|
5231
5324
|
this.state.layout !== "reel" && this.state.reelOrigin !== "masonry" || (this.state.activeReelPostId = e, this.routing.syncReel(e));
|
|
5232
5325
|
}
|
|
5233
|
-
cancelRequest() {
|
|
5234
|
-
this.autofillController.clearCountdown(), this.requestVersion += 1, this.abortController?.abort(), this.abortController = null, this.pendingRequest = null, this.state.isLoading = !1, this.state.isLoadingMore = !1;
|
|
5326
|
+
cancelRequest(e = !0) {
|
|
5327
|
+
e && this.pageReplacement.cancel(), this.autofillController.clearCountdown(), this.requestVersion += 1, this.abortController?.abort(), this.abortController = null, this.pendingRequest = null, this.state.isLoading = !1, this.state.isLoadingMore = !1;
|
|
5235
5328
|
}
|
|
5236
5329
|
async fetchPage(e, t) {
|
|
5237
5330
|
if (!this.options.loadPage) return;
|
|
5238
5331
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5239
|
-
this.abortController = r, await
|
|
5332
|
+
this.abortController = r, await ei({
|
|
5240
5333
|
append: t,
|
|
5241
5334
|
autofillController: this.autofillController,
|
|
5242
5335
|
cursor: e,
|
|
@@ -5258,7 +5351,7 @@ var Di = class {
|
|
|
5258
5351
|
startInitialAutofill() {
|
|
5259
5352
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
5260
5353
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
5261
|
-
let r =
|
|
5354
|
+
let r = Tr({
|
|
5262
5355
|
cycleId: n,
|
|
5263
5356
|
isCurrent: () => e === this.requestVersion,
|
|
5264
5357
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -5276,11 +5369,11 @@ var Di = class {
|
|
|
5276
5369
|
}
|
|
5277
5370
|
startStateNotifications() {
|
|
5278
5371
|
let e = this.options.onStateChange;
|
|
5279
|
-
!e || this.stopStateWatcher || (
|
|
5372
|
+
!e || this.stopStateWatcher || (this.stopStateWatcher = q(this.state, this.notificationItems, e));
|
|
5280
5373
|
}
|
|
5281
5374
|
setCurrentCursor(e) {
|
|
5282
|
-
this.lastLoadedCursor =
|
|
5375
|
+
this.lastLoadedCursor = this.state.current = e;
|
|
5283
5376
|
}
|
|
5284
|
-
},
|
|
5377
|
+
}, Mi = (e) => new ji(e);
|
|
5285
5378
|
//#endregion
|
|
5286
|
-
export {
|
|
5379
|
+
export { Mi as createVibe };
|