@wyxos/vibe 5.13.3 → 5.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js
CHANGED
|
@@ -204,7 +204,7 @@ var J = {
|
|
|
204
204
|
"show-load-more"
|
|
205
205
|
]));
|
|
206
206
|
}
|
|
207
|
-
}), ae = ["role"],
|
|
207
|
+
}), ae = ["role"], oe = { class: "gallery-status" }, se = /* @__PURE__ */ d({
|
|
208
208
|
__name: "FeedStatus",
|
|
209
209
|
props: {
|
|
210
210
|
actions: {},
|
|
@@ -218,7 +218,7 @@ var J = {
|
|
|
218
218
|
return (n, u) => (b(), s("main", {
|
|
219
219
|
class: "gallery-shell",
|
|
220
220
|
role: r.state.error ? "alert" : r.state.isLoading || r.state.isLoadingMore ? "status" : void 0
|
|
221
|
-
}, [c("p",
|
|
221
|
+
}, [c("p", oe, [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(ie, {
|
|
222
222
|
key: 0,
|
|
223
223
|
actions: t.actions,
|
|
224
224
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -243,16 +243,16 @@ var J = {
|
|
|
243
243
|
])) : o("", !0)], 8, ae));
|
|
244
244
|
}
|
|
245
245
|
});
|
|
246
|
-
function
|
|
246
|
+
function ce(e) {
|
|
247
247
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
248
248
|
}
|
|
249
249
|
//#endregion
|
|
250
250
|
//#region src/core/masonry.ts
|
|
251
|
-
function
|
|
251
|
+
function X(e) {
|
|
252
252
|
let t = e.preview?.width ?? e.width, n = e.preview?.height ?? e.height;
|
|
253
253
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function Z(e) {
|
|
256
256
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
257
257
|
}
|
|
258
258
|
function le(e) {
|
|
@@ -281,7 +281,7 @@ function Q(e, t) {
|
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
283
|
function pe(e, t, n) {
|
|
284
|
-
let r =
|
|
284
|
+
let r = Z(t), i = n.itemWidth * X(e) + n.additionalHeight, a = {
|
|
285
285
|
x: r * (n.itemWidth + n.gap),
|
|
286
286
|
y: t[r],
|
|
287
287
|
width: n.itemWidth,
|
|
@@ -1471,7 +1471,7 @@ var Ut = [
|
|
|
1471
1471
|
mediaReady: () => G.value === "ready",
|
|
1472
1472
|
mediaSource: () => l.mediaSource ?? "preview"
|
|
1473
1473
|
});
|
|
1474
|
-
let { currentTime: ie, duration: ae, effectiveMuted:
|
|
1474
|
+
let { currentTime: ie, duration: ae, effectiveMuted: oe, isMuted: se, isPlaying: ce, onEnded: X, onLoadedMetadata: Z, onPlaying: le, playbackAllowed: ue, seek: de, setVolume: fe, sync: Q, toggleMute: pe, togglePlayback: me, volume: he } = Ht({
|
|
1475
1475
|
active: () => l.active,
|
|
1476
1476
|
inViewport: () => l.inViewport === !0,
|
|
1477
1477
|
layout: () => l.layout,
|
|
@@ -1592,9 +1592,9 @@ var Ut = [
|
|
|
1592
1592
|
src: D.value,
|
|
1593
1593
|
autoplay: E(ue),
|
|
1594
1594
|
loop: !e.advanceOnMediaEnd,
|
|
1595
|
-
muted: E(
|
|
1595
|
+
muted: E(oe),
|
|
1596
1596
|
preload: E(Te),
|
|
1597
|
-
onLoadedmetadata: i[0] ||= (...e) => E(
|
|
1597
|
+
onLoadedmetadata: i[0] ||= (...e) => E(Z) && E(Z)(...e),
|
|
1598
1598
|
onProgress: i[1] ||= (...e) => E(Y) && E(Y)(...e),
|
|
1599
1599
|
onLoadeddata: i[2] ||= (...e) => E(Y) && E(Y)(...e),
|
|
1600
1600
|
onCanplay: i[3] ||= (...e) => E(Y) && E(Y)(...e),
|
|
@@ -1602,15 +1602,15 @@ var Ut = [
|
|
|
1602
1602
|
onTimeupdate: i[5] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1603
1603
|
onVolumechange: i[6] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1604
1604
|
onPlaying: i[7] ||= (...e) => E(le) && E(le)(...e),
|
|
1605
|
-
onPause: i[8] ||= (e) =>
|
|
1606
|
-
onEnded: i[9] ||= (...e) => E(
|
|
1605
|
+
onPause: i[8] ||= (e) => ce.value = !1,
|
|
1606
|
+
onEnded: i[9] ||= (...e) => E(X) && E(X)(...e),
|
|
1607
1607
|
onError: i[10] ||= (...e) => E(K) && E(K)(...e)
|
|
1608
1608
|
}, null, 40, Jt)) : o("", !0),
|
|
1609
1609
|
S.value ? (b(), s("button", {
|
|
1610
1610
|
key: 3,
|
|
1611
1611
|
type: "button",
|
|
1612
1612
|
class: h(["media-audio-artwork media-preview", { "media-preview--ready": E(G) === "ready" }]),
|
|
1613
|
-
"aria-label": e.layout === "reel" ? E(
|
|
1613
|
+
"aria-label": e.layout === "reel" ? E(ce) ? "Pause audio" : "Play audio" : "Audio",
|
|
1614
1614
|
disabled: e.layout !== "reel",
|
|
1615
1615
|
onClick: ke
|
|
1616
1616
|
}, [R.value ? (b(), s("img", {
|
|
@@ -1642,10 +1642,10 @@ var Ut = [
|
|
|
1642
1642
|
height: P.value ?? void 0,
|
|
1643
1643
|
autoplay: E(ue),
|
|
1644
1644
|
loop: !e.advanceOnMediaEnd,
|
|
1645
|
-
muted: E(
|
|
1645
|
+
muted: E(oe),
|
|
1646
1646
|
playsinline: "",
|
|
1647
1647
|
preload: E(Te),
|
|
1648
|
-
onLoadedmetadata: i[12] ||= (...e) => E(
|
|
1648
|
+
onLoadedmetadata: i[12] ||= (...e) => E(Z) && E(Z)(...e),
|
|
1649
1649
|
onProgress: i[13] ||= (...e) => E(Y) && E(Y)(...e),
|
|
1650
1650
|
onLoadeddata: i[14] ||= (...e) => E(Y) && E(Y)(...e),
|
|
1651
1651
|
onCanplay: i[15] ||= (...e) => E(Y) && E(Y)(...e),
|
|
@@ -1653,8 +1653,8 @@ var Ut = [
|
|
|
1653
1653
|
onTimeupdate: i[17] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1654
1654
|
onVolumechange: i[18] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1655
1655
|
onPlaying: i[19] ||= (...e) => E(le) && E(le)(...e),
|
|
1656
|
-
onPause: i[20] ||= (e) =>
|
|
1657
|
-
onEnded: i[21] ||= (...e) => E(
|
|
1656
|
+
onPause: i[20] ||= (e) => ce.value = !1,
|
|
1657
|
+
onEnded: i[21] ||= (...e) => E(X) && E(X)(...e),
|
|
1658
1658
|
onClick: ke,
|
|
1659
1659
|
onError: i[22] ||= (...e) => E(K) && E(K)(...e)
|
|
1660
1660
|
}, null, 42, Qt)) : S.value ? o("", !0) : (b(), s("img", {
|
|
@@ -1703,8 +1703,8 @@ var Ut = [
|
|
|
1703
1703
|
duration: E(ae),
|
|
1704
1704
|
layout: e.layout,
|
|
1705
1705
|
"media-type": S.value ? "audio" : "video",
|
|
1706
|
-
muted: E(
|
|
1707
|
-
playing: E(
|
|
1706
|
+
muted: E(se),
|
|
1707
|
+
playing: E(ce),
|
|
1708
1708
|
volume: E(he),
|
|
1709
1709
|
onSeek: E(de),
|
|
1710
1710
|
onToggleMute: E(pe),
|
|
@@ -1963,10 +1963,10 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1963
1963
|
function ae(e, t) {
|
|
1964
1964
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1965
1965
|
}
|
|
1966
|
-
function
|
|
1966
|
+
function oe(e, t) {
|
|
1967
1967
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1968
1968
|
}
|
|
1969
|
-
function
|
|
1969
|
+
function se(e) {
|
|
1970
1970
|
let t = {
|
|
1971
1971
|
scrollTop: N - k.value,
|
|
1972
1972
|
viewportHeight: C.value
|
|
@@ -1982,9 +1982,9 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1982
1982
|
return t !== void 0 && d.leavingPostIds.has(t.postId);
|
|
1983
1983
|
}));
|
|
1984
1984
|
}
|
|
1985
|
-
function
|
|
1986
|
-
let e =
|
|
1987
|
-
|
|
1985
|
+
function X() {
|
|
1986
|
+
let e = se(0), t = se(De(d.masonry, C.value));
|
|
1987
|
+
oe(j.value, e) || (j.value = e);
|
|
1988
1988
|
let n = fe(q.value.items, e.filter((e) => {
|
|
1989
1989
|
let t = d.items[e];
|
|
1990
1990
|
return t && !d.leavingPostIds.has(t.postId);
|
|
@@ -1992,13 +1992,13 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
1992
1992
|
scrollTop: N - k.value,
|
|
1993
1993
|
viewportHeight: C.value
|
|
1994
1994
|
});
|
|
1995
|
-
|
|
1995
|
+
oe(A.value, n) || (A.value = n), oe(M.value, t) || (M.value = t);
|
|
1996
1996
|
}
|
|
1997
|
-
function
|
|
1997
|
+
function Z() {
|
|
1998
1998
|
if (L !== null) return;
|
|
1999
1999
|
L = -1;
|
|
2000
2000
|
let e = requestAnimationFrame(() => {
|
|
2001
|
-
L = null,
|
|
2001
|
+
L = null, X();
|
|
2002
2002
|
});
|
|
2003
2003
|
L !== null && (L = e);
|
|
2004
2004
|
}
|
|
@@ -2032,7 +2032,7 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2032
2032
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
2033
2033
|
T.value = Math.max(0, e.clientHeight - n);
|
|
2034
2034
|
let r = g.value;
|
|
2035
|
-
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop,
|
|
2035
|
+
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, X());
|
|
2036
2036
|
}
|
|
2037
2037
|
function Q(e) {
|
|
2038
2038
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
@@ -2040,11 +2040,11 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2040
2040
|
}
|
|
2041
2041
|
function pe(e) {
|
|
2042
2042
|
let t = e.currentTarget;
|
|
2043
|
-
t && (N = t.scrollTop, H.ensurePackedThrough(B()),
|
|
2043
|
+
t && (N = t.scrollTop, H.ensurePackedThrough(B()), Z(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ce(t) && f("loadMore"));
|
|
2044
2044
|
}
|
|
2045
2045
|
function me() {
|
|
2046
2046
|
let e = p.value;
|
|
2047
|
-
Date.now() >= l && !d.loadMoreLocked && e &&
|
|
2047
|
+
Date.now() >= l && !d.loadMoreLocked && e && ce(e) && f("loadMore");
|
|
2048
2048
|
}
|
|
2049
2049
|
O(() => d.items.length, (e, t) => {
|
|
2050
2050
|
e > 0 && e < t && (l = Date.now() + pn);
|
|
@@ -2067,7 +2067,7 @@ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
|
|
|
2067
2067
|
U,
|
|
2068
2068
|
q,
|
|
2069
2069
|
() => d.masonry
|
|
2070
|
-
],
|
|
2070
|
+
], X, { flush: "post" }), v(() => {
|
|
2071
2071
|
P?.disconnect(), F?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
|
|
2072
2072
|
}), n({
|
|
2073
2073
|
getScrollElement: he,
|
|
@@ -2207,7 +2207,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2207
2207
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
2208
2208
|
}, null, 36)], 8, _n));
|
|
2209
2209
|
}
|
|
2210
|
-
}), yn = { class: "reel-viewport" }, bn = ["data-active-post-id", "data-active-media-index"], xn = ["role", "data-status"], Sn =
|
|
2210
|
+
}), yn = { class: "reel-viewport" }, bn = ["data-active-post-id", "data-active-media-index"], xn = ["role", "data-status"], Sn = ["disabled"], Cn = 300, wn = 250, Tn = /* @__PURE__ */ d({
|
|
2211
2211
|
__name: "ReelFeed",
|
|
2212
2212
|
props: {
|
|
2213
2213
|
initialPostId: {},
|
|
@@ -2270,49 +2270,49 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2270
2270
|
].join(":")), J = r(() => {
|
|
2271
2271
|
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value < H(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
2272
2272
|
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
|
|
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 === "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.");
|
|
2274
|
+
function re(e) {
|
|
2275
2275
|
return { gridRow: `${e + 1}` };
|
|
2276
2276
|
}
|
|
2277
|
-
function
|
|
2277
|
+
function ae(e) {
|
|
2278
2278
|
let t = k || e.clientHeight;
|
|
2279
2279
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
2280
2280
|
}
|
|
2281
|
-
function
|
|
2281
|
+
function oe(e) {
|
|
2282
2282
|
let t = e.currentTarget;
|
|
2283
2283
|
if (!t) return;
|
|
2284
2284
|
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 =
|
|
2285
|
+
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ae(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && ce(t) && d("loadMore");
|
|
2286
2286
|
}
|
|
2287
|
-
function
|
|
2287
|
+
function se() {
|
|
2288
2288
|
let e = f.value;
|
|
2289
|
-
e && (C.value = !1,
|
|
2289
|
+
e && (C.value = !1, le(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
2290
2290
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
2291
|
-
}),
|
|
2291
|
+
}), X());
|
|
2292
2292
|
}
|
|
2293
|
-
function
|
|
2293
|
+
function X() {
|
|
2294
2294
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
2295
2295
|
M = null;
|
|
2296
2296
|
let e = f.value;
|
|
2297
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
2297
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), le(!1);
|
|
2298
2298
|
}, 120);
|
|
2299
2299
|
}
|
|
2300
2300
|
function Z() {
|
|
2301
|
-
|
|
2301
|
+
le(!0);
|
|
2302
2302
|
let e = f.value;
|
|
2303
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
2303
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), X();
|
|
2304
2304
|
}
|
|
2305
|
-
function
|
|
2305
|
+
function le(e) {
|
|
2306
2306
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
2307
2307
|
}
|
|
2308
|
-
function
|
|
2308
|
+
function ue() {
|
|
2309
2309
|
let e = f.value;
|
|
2310
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
2310
|
+
Date.now() >= l && !u.loadMoreLocked && e && ce(e) && d("loadMore");
|
|
2311
2311
|
}
|
|
2312
2312
|
O(() => u.items.length, (e, t) => {
|
|
2313
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2313
|
+
e > 0 && e < t && (l = Date.now() + wn);
|
|
2314
2314
|
});
|
|
2315
|
-
function
|
|
2315
|
+
function de(e) {
|
|
2316
2316
|
let t = I.value;
|
|
2317
2317
|
if (!t) return !1;
|
|
2318
2318
|
let n = H(t).length;
|
|
@@ -2320,34 +2320,34 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2320
2320
|
let r = (R.value + e + n) % n;
|
|
2321
2321
|
return d("mediaChange", t.postId, r), !0;
|
|
2322
2322
|
}
|
|
2323
|
-
function
|
|
2323
|
+
function fe(e) {
|
|
2324
2324
|
let t = x.value + e;
|
|
2325
|
-
return !f.value || t < 0 || t >= u.items.length ? !1 : (
|
|
2325
|
+
return !f.value || t < 0 || t >= u.items.length ? !1 : (he(t), !0);
|
|
2326
2326
|
}
|
|
2327
|
-
function
|
|
2327
|
+
function Q(e, t) {
|
|
2328
2328
|
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 &&
|
|
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 && he(n), !0);
|
|
2330
2330
|
}
|
|
2331
|
-
function
|
|
2331
|
+
function pe() {
|
|
2332
2332
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2333
2333
|
}
|
|
2334
|
-
function
|
|
2334
|
+
function me(e) {
|
|
2335
2335
|
let t = f.value;
|
|
2336
2336
|
if (!t) return Promise.resolve();
|
|
2337
2337
|
let n = e * (k || t.clientHeight);
|
|
2338
|
-
return x.value = e, gn(t, n,
|
|
2338
|
+
return x.value = e, gn(t, n, pe());
|
|
2339
2339
|
}
|
|
2340
|
-
function
|
|
2341
|
-
|
|
2340
|
+
function he(e) {
|
|
2341
|
+
me(e);
|
|
2342
2342
|
}
|
|
2343
|
-
async function
|
|
2343
|
+
async function ge(e) {
|
|
2344
2344
|
let t = u.items.findIndex((t) => t.postId === e);
|
|
2345
|
-
return t < 0 || t === x.value ? !1 : (await
|
|
2345
|
+
return t < 0 || t === x.value ? !1 : (await me(t), !0);
|
|
2346
2346
|
}
|
|
2347
|
-
async function
|
|
2348
|
-
return
|
|
2347
|
+
async function _e(e) {
|
|
2348
|
+
return de(e) ? (pe() || await new Promise((e) => setTimeout(e, Cn)), !0) : !1;
|
|
2349
2349
|
}
|
|
2350
|
-
function
|
|
2350
|
+
function ve() {
|
|
2351
2351
|
if (!u.reelAutoAdvance.enabled) return;
|
|
2352
2352
|
let e = I.value;
|
|
2353
2353
|
if (!e) return;
|
|
@@ -2357,34 +2357,34 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2357
2357
|
}
|
|
2358
2358
|
let t = x.value + 1, n = u.items[t];
|
|
2359
2359
|
if (!n) {
|
|
2360
|
-
u.hasNext && !u.loadMoreLocked && d("loadMore");
|
|
2360
|
+
u.hasNext && u.infiniteScroll && !u.loadMoreLocked && d("loadMore");
|
|
2361
2361
|
return;
|
|
2362
2362
|
}
|
|
2363
|
-
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0),
|
|
2363
|
+
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), he(t);
|
|
2364
2364
|
}
|
|
2365
|
-
function
|
|
2366
|
-
!u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !K.value ||
|
|
2365
|
+
function ye(e, t) {
|
|
2366
|
+
!u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !K.value || ve();
|
|
2367
2367
|
}
|
|
2368
2368
|
return O(f, (e) => {
|
|
2369
|
-
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(
|
|
2369
|
+
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(se), A.observe(e)));
|
|
2370
2370
|
}), O(() => u.items.length, async (e) => {
|
|
2371
2371
|
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(),
|
|
2372
|
+
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), se();
|
|
2373
2373
|
}), O(F, (e) => {
|
|
2374
2374
|
e !== void 0 && d("activeChange", e);
|
|
2375
2375
|
}, { immediate: !0 }), y(() => {
|
|
2376
|
-
window.addEventListener("resize", Z), window.addEventListener("orientationchange", Z), g >= 0 && m(
|
|
2376
|
+
window.addEventListener("resize", Z), window.addEventListener("orientationchange", Z), g >= 0 && m(se);
|
|
2377
2377
|
}), v(() => {
|
|
2378
2378
|
window.removeEventListener("resize", Z), window.removeEventListener("orientationchange", Z), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
2379
2379
|
}), n({
|
|
2380
2380
|
activeIndex: x,
|
|
2381
2381
|
activePostId: F,
|
|
2382
|
-
changeActiveMedia:
|
|
2383
|
-
loadIfNearBottom:
|
|
2384
|
-
moveActivePost:
|
|
2385
|
-
navigateToItem:
|
|
2386
|
-
transitionActiveMedia:
|
|
2387
|
-
transitionActivePost:
|
|
2382
|
+
changeActiveMedia: de,
|
|
2383
|
+
loadIfNearBottom: ue,
|
|
2384
|
+
moveActivePost: fe,
|
|
2385
|
+
navigateToItem: Q,
|
|
2386
|
+
transitionActiveMedia: _e,
|
|
2387
|
+
transitionActivePost: ge
|
|
2388
2388
|
}), (n, r) => (b(), s("main", {
|
|
2389
2389
|
class: h(["reel-shell", {
|
|
2390
2390
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -2420,7 +2420,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2420
2420
|
class: "gallery-shell reel-feed",
|
|
2421
2421
|
"data-active-post-id": F.value,
|
|
2422
2422
|
"data-active-media-index": R.value,
|
|
2423
|
-
onScrollPassive:
|
|
2423
|
+
onScrollPassive: oe
|
|
2424
2424
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
2425
2425
|
key: 1,
|
|
2426
2426
|
class: "reel-track",
|
|
@@ -2435,7 +2435,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2435
2435
|
"fetch-priority": e,
|
|
2436
2436
|
index: i,
|
|
2437
2437
|
item: n,
|
|
2438
|
-
"item-style":
|
|
2438
|
+
"item-style": re(i),
|
|
2439
2439
|
"media-card": t.mediaCard,
|
|
2440
2440
|
layout: "reel",
|
|
2441
2441
|
"loaded-count": t.items.length,
|
|
@@ -2447,7 +2447,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2447
2447
|
"stationary-reel-controls": "",
|
|
2448
2448
|
total: t.total,
|
|
2449
2449
|
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
2450
|
-
onEnded: (e) =>
|
|
2450
|
+
onEnded: (e) => ye(n.postId, e),
|
|
2451
2451
|
onReady: (e) => d("ready", n.postId, e),
|
|
2452
2452
|
onReelAudioChange: r[1] ||= (e) => d("reelAudioChange", e),
|
|
2453
2453
|
onError: (e) => d("error", n.postId, e)
|
|
@@ -2475,12 +2475,13 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2475
2475
|
class: "reel-forward-status",
|
|
2476
2476
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
2477
2477
|
"data-status": t.reelForward.status
|
|
2478
|
-
}, [c("p", null, T(
|
|
2478
|
+
}, [c("p", null, T(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
2479
2479
|
key: 0,
|
|
2480
2480
|
class: "reel-forward-retry",
|
|
2481
2481
|
type: "button",
|
|
2482
|
+
disabled: t.loadMoreLocked,
|
|
2482
2483
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
2483
|
-
}, "
|
|
2484
|
+
}, T(te.value ? "Load more" : "Retry"), 9, Sn)) : o("", !0)], 8, xn)), t.reelForward.status === "idle" ? (b(), a(ie, {
|
|
2484
2485
|
key: 2,
|
|
2485
2486
|
actions: t.feedFooterActions,
|
|
2486
2487
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2535,20 +2536,20 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2535
2536
|
key: q.value,
|
|
2536
2537
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
2537
2538
|
label: J.value,
|
|
2538
|
-
onComplete:
|
|
2539
|
+
onComplete: ve
|
|
2539
2540
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
2540
2541
|
], 2));
|
|
2541
2542
|
}
|
|
2542
|
-
}),
|
|
2543
|
+
}), En = ["data-info-sheet-open", "data-info-sheet-mode"], Dn = ["aria-hidden", "inert"], On = {
|
|
2543
2544
|
key: 0,
|
|
2544
2545
|
class: "reel-info-sheet-layer",
|
|
2545
2546
|
"data-test": "reel-info-sheet"
|
|
2546
|
-
},
|
|
2547
|
+
}, kn = [
|
|
2547
2548
|
"role",
|
|
2548
2549
|
"aria-modal",
|
|
2549
2550
|
"tabindex",
|
|
2550
2551
|
"data-active-post-id"
|
|
2551
|
-
],
|
|
2552
|
+
], An = /* @__PURE__ */ d({
|
|
2552
2553
|
__name: "ReelLayout",
|
|
2553
2554
|
props: {
|
|
2554
2555
|
forwardIndex: { default: null },
|
|
@@ -2675,7 +2676,7 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2675
2676
|
class: "reel-layout-main",
|
|
2676
2677
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
2677
2678
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
2678
|
-
}, [u(
|
|
2679
|
+
}, [u(Tn, {
|
|
2679
2680
|
ref_key: "reelFeed",
|
|
2680
2681
|
ref: p,
|
|
2681
2682
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2729,8 +2730,8 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2729
2730
|
"reel-forward",
|
|
2730
2731
|
"state",
|
|
2731
2732
|
"total"
|
|
2732
|
-
])], 8,
|
|
2733
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2733
|
+
])], 8, Dn), u(n, { name: "vibe-info-sheet" }, {
|
|
2734
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", On, [c("aside", {
|
|
2734
2735
|
ref_key: "sheetElement",
|
|
2735
2736
|
ref: _,
|
|
2736
2737
|
class: "reel-info-sheet",
|
|
@@ -2739,14 +2740,14 @@ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
|
|
|
2739
2740
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2740
2741
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2741
2742
|
"data-active-post-id": T.value?.postId
|
|
2742
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2743
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, kn)])) : o("", !0)]),
|
|
2743
2744
|
_: 1
|
|
2744
|
-
})], 10,
|
|
2745
|
+
})], 10, En));
|
|
2745
2746
|
}
|
|
2746
2747
|
});
|
|
2747
2748
|
//#endregion
|
|
2748
2749
|
//#region src/core/mediaLifecycle.ts
|
|
2749
|
-
function
|
|
2750
|
+
function jn(e, t, n, r, i) {
|
|
2750
2751
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2751
2752
|
if (!o) return null;
|
|
2752
2753
|
let s = U(o, n), c = W(o, s);
|
|
@@ -2762,7 +2763,7 @@ function An(e, t, n, r, i) {
|
|
|
2762
2763
|
postIndex: a
|
|
2763
2764
|
};
|
|
2764
2765
|
}
|
|
2765
|
-
function
|
|
2766
|
+
function Mn(e, t) {
|
|
2766
2767
|
O(() => {
|
|
2767
2768
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2768
2769
|
return {
|
|
@@ -2772,13 +2773,13 @@ function jn(e, t) {
|
|
|
2772
2773
|
};
|
|
2773
2774
|
}, (n, r) => {
|
|
2774
2775
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2775
|
-
let i =
|
|
2776
|
+
let i = jn(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2776
2777
|
i && t(i);
|
|
2777
2778
|
}, { flush: "sync" });
|
|
2778
2779
|
}
|
|
2779
2780
|
//#endregion
|
|
2780
2781
|
//#region src/components/useMediaLifecycle.ts
|
|
2781
|
-
function
|
|
2782
|
+
function Nn(e, t) {
|
|
2782
2783
|
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
2784
|
function u() {
|
|
2784
2785
|
n.clear(), l.clear(), i.value = /* @__PURE__ */ new Map(), a.value = /* @__PURE__ */ new Map(), o.value = /* @__PURE__ */ new Map();
|
|
@@ -2788,7 +2789,7 @@ function Mn(e, t) {
|
|
|
2788
2789
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2789
2790
|
}
|
|
2790
2791
|
function f(t, n, r, i) {
|
|
2791
|
-
return
|
|
2792
|
+
return jn(e, t, n, r, i);
|
|
2792
2793
|
}
|
|
2793
2794
|
function p(e, n, r, i) {
|
|
2794
2795
|
let a = f(e, n, r, i);
|
|
@@ -2821,7 +2822,7 @@ function Mn(e, t) {
|
|
|
2821
2822
|
function b(e, t) {
|
|
2822
2823
|
y(e, t, "masonry", null);
|
|
2823
2824
|
}
|
|
2824
|
-
return
|
|
2825
|
+
return Mn(e, t.reelChange), O(() => {
|
|
2825
2826
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2826
2827
|
return {
|
|
2827
2828
|
mediaIndex: n,
|
|
@@ -2846,16 +2847,16 @@ function Mn(e, t) {
|
|
|
2846
2847
|
}
|
|
2847
2848
|
//#endregion
|
|
2848
2849
|
//#region src/core/reelEscapeStack.ts
|
|
2849
|
-
var
|
|
2850
|
-
function
|
|
2851
|
-
return
|
|
2852
|
-
let t =
|
|
2853
|
-
t >= 0 &&
|
|
2850
|
+
var Pn = [];
|
|
2851
|
+
function Fn(e) {
|
|
2852
|
+
return Pn.push(e), () => {
|
|
2853
|
+
let t = Pn.indexOf(e);
|
|
2854
|
+
t >= 0 && Pn.splice(t, 1);
|
|
2854
2855
|
};
|
|
2855
2856
|
}
|
|
2856
|
-
function
|
|
2857
|
+
function In(e) {
|
|
2857
2858
|
if (!e.isActive()) return !1;
|
|
2858
|
-
let t =
|
|
2859
|
+
let t = Pn.filter((e) => e.isActive()), n = e.element();
|
|
2859
2860
|
return n !== null && t.some((t) => {
|
|
2860
2861
|
if (t === e) return !1;
|
|
2861
2862
|
let r = t.element();
|
|
@@ -2871,14 +2872,14 @@ function Fn(e) {
|
|
|
2871
2872
|
}
|
|
2872
2873
|
//#endregion
|
|
2873
2874
|
//#region src/components/useReelKeyboard.ts
|
|
2874
|
-
function
|
|
2875
|
+
function Ln(e) {
|
|
2875
2876
|
let t = {
|
|
2876
2877
|
element: e.element,
|
|
2877
2878
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2878
2879
|
}, n = null;
|
|
2879
2880
|
function r(n) {
|
|
2880
2881
|
let r = t.isActive();
|
|
2881
|
-
if (n.key === "Escape" && r && !
|
|
2882
|
+
if (n.key === "Escape" && r && !In(t)) return;
|
|
2882
2883
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2883
2884
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2884
2885
|
return;
|
|
@@ -2898,14 +2899,14 @@ function In(e) {
|
|
|
2898
2899
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2899
2900
|
}
|
|
2900
2901
|
y(() => {
|
|
2901
|
-
n =
|
|
2902
|
+
n = Fn(t), window.addEventListener("keydown", r);
|
|
2902
2903
|
}), v(() => {
|
|
2903
2904
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2904
2905
|
});
|
|
2905
2906
|
}
|
|
2906
2907
|
//#endregion
|
|
2907
2908
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2908
|
-
var
|
|
2909
|
+
var Rn = 35, zn = 420, Bn = /* @__PURE__ */ d({
|
|
2909
2910
|
__name: "VibeSurface",
|
|
2910
2911
|
props: {
|
|
2911
2912
|
canRetryEnd: { type: Boolean },
|
|
@@ -2934,7 +2935,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
2934
2935
|
"retryForward"
|
|
2935
2936
|
],
|
|
2936
2937
|
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(() => q(l.state, T.value)), { markMasonryFullyVisible: A, markMasonryVisible: j, markPreviewError: M, markPreviewReady: N, markReelError: P, markReelReady: F, originalStates: I, previewStates: L, reelStates: R, resetMediaLifecycle: z } =
|
|
2938
|
+
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(() => q(l.state, T.value)), { markMasonryFullyVisible: A, markMasonryVisible: j, markPreviewError: M, markPreviewReady: N, markReelError: P, markReelReady: F, originalStates: I, previewStates: L, reelStates: R, resetMediaLifecycle: z } = Nn(l.state, {
|
|
2938
2939
|
fullyVisible: (e) => d("mediaFullyVisible", e),
|
|
2939
2940
|
ready: (e) => d("mediaReady", e),
|
|
2940
2941
|
reelChange: (e) => d("reelMediaChange", e),
|
|
@@ -2978,36 +2979,36 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
2978
2979
|
function ae(e, t) {
|
|
2979
2980
|
W = e, G = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
|
|
2980
2981
|
}
|
|
2981
|
-
function
|
|
2982
|
+
function oe(e) {
|
|
2982
2983
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2983
2984
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2984
2985
|
}
|
|
2985
|
-
function
|
|
2986
|
+
function ce(e, t) {
|
|
2986
2987
|
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
|
|
2987
|
-
let n = [...new Set(e)], r = n.filter(
|
|
2988
|
+
let n = [...new Set(e)], r = n.filter(oe);
|
|
2988
2989
|
if (r.length === 0) return 0;
|
|
2989
|
-
let i = new Map(C.value), a = t?.staggerMs ??
|
|
2990
|
+
let i = new Map(C.value), a = t?.staggerMs ?? Rn;
|
|
2990
2991
|
return r.forEach((e, t) => {
|
|
2991
2992
|
i.set(e, t * a);
|
|
2992
|
-
}), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i,
|
|
2993
|
+
}), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, zn + (r.length - 1) * a;
|
|
2993
2994
|
}
|
|
2994
|
-
function
|
|
2995
|
-
let n =
|
|
2995
|
+
function X(e, t) {
|
|
2996
|
+
let n = oe(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2996
2997
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2997
2998
|
r.classList.remove("media-card-focus-silent");
|
|
2998
2999
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2999
3000
|
}
|
|
3000
|
-
function
|
|
3001
|
+
function Z() {
|
|
3001
3002
|
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
|
|
3002
3003
|
}
|
|
3003
3004
|
function le() {
|
|
3004
3005
|
let e = W, t = G;
|
|
3005
3006
|
_.value = !1, W = null, G = !1, m(() => {
|
|
3006
|
-
e !== null &&
|
|
3007
|
+
e !== null && X(e, t);
|
|
3007
3008
|
});
|
|
3008
3009
|
}
|
|
3009
|
-
return
|
|
3010
|
-
closeMasonryReel:
|
|
3010
|
+
return Ln({
|
|
3011
|
+
closeMasonryReel: Z,
|
|
3011
3012
|
element: () => g.value,
|
|
3012
3013
|
isReelLeaving: () => _.value,
|
|
3013
3014
|
reelRenderer: () => p.value,
|
|
@@ -3024,7 +3025,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3024
3025
|
let t = x.value.get(e);
|
|
3025
3026
|
t !== void 0 && i.set(e, t);
|
|
3026
3027
|
}), n.forEach((e, t) => {
|
|
3027
|
-
i.set(e, t *
|
|
3028
|
+
i.set(e, t * Rn);
|
|
3028
3029
|
}), x.value = i, y.value = new Set([...y.value, ...n]), J();
|
|
3029
3030
|
}, { flush: "sync" }), v(() => {
|
|
3030
3031
|
V !== null && cancelAnimationFrame(V);
|
|
@@ -3035,14 +3036,14 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3035
3036
|
moveActiveReelPost: ne,
|
|
3036
3037
|
navigateToReelItem: re,
|
|
3037
3038
|
resetMediaLifecycle: z,
|
|
3038
|
-
startItemRemoval:
|
|
3039
|
+
startItemRemoval: ce,
|
|
3039
3040
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
3040
3041
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
3041
3042
|
}), (r, i) => (b(), s("div", {
|
|
3042
3043
|
ref_key: "surfaceElement",
|
|
3043
3044
|
ref: g,
|
|
3044
3045
|
class: "vibe-surface"
|
|
3045
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
3046
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(An, {
|
|
3046
3047
|
key: 0,
|
|
3047
3048
|
ref_key: "reelRenderer",
|
|
3048
3049
|
ref: p,
|
|
@@ -3082,7 +3083,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3082
3083
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
3083
3084
|
onRetryForward: i[4] ||= (e) => d("retryForward"),
|
|
3084
3085
|
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(
|
|
3086
|
+
}, 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(se, {
|
|
3086
3087
|
key: 1,
|
|
3087
3088
|
actions: t.feedFooterActions,
|
|
3088
3089
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3141,7 +3142,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3141
3142
|
"aria-label": "Media viewer",
|
|
3142
3143
|
"aria-modal": "true",
|
|
3143
3144
|
tabindex: "-1"
|
|
3144
|
-
}, [u(
|
|
3145
|
+
}, [u(An, {
|
|
3145
3146
|
ref_key: "reelRenderer",
|
|
3146
3147
|
ref: p,
|
|
3147
3148
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -3187,7 +3188,7 @@ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
|
|
|
3187
3188
|
});
|
|
3188
3189
|
//#endregion
|
|
3189
3190
|
//#region src/core/page.ts
|
|
3190
|
-
function
|
|
3191
|
+
function Vn(e) {
|
|
3191
3192
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
3192
3193
|
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
3194
|
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 +3199,22 @@ function $(e, t) {
|
|
|
3198
3199
|
let n = new Set(e.map((e) => e.postId));
|
|
3199
3200
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
3200
3201
|
}
|
|
3201
|
-
function
|
|
3202
|
+
function Hn(e) {
|
|
3202
3203
|
return `${typeof e}:${String(e)}`;
|
|
3203
3204
|
}
|
|
3204
|
-
function
|
|
3205
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${
|
|
3205
|
+
function Un(e) {
|
|
3206
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${Hn(e.mediaId)}`;
|
|
3206
3207
|
}
|
|
3207
|
-
function
|
|
3208
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
3208
|
+
function Wn(e, t) {
|
|
3209
|
+
let n = [...e], r = new Map(e.map((e, t) => [Hn(e.postId), t]));
|
|
3209
3210
|
return t.forEach((e) => {
|
|
3210
|
-
let t =
|
|
3211
|
+
let t = Hn(e.postId), i = r.get(t);
|
|
3211
3212
|
if (i === void 0) {
|
|
3212
3213
|
r.set(t, n.length), n.push(e);
|
|
3213
3214
|
return;
|
|
3214
3215
|
}
|
|
3215
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
3216
|
-
let t =
|
|
3216
|
+
let a = n[i], o = new Set([a, ...a.items].map(Un)), s = [e, ...e.items].filter((e) => {
|
|
3217
|
+
let t = Un(e);
|
|
3217
3218
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
3218
3219
|
});
|
|
3219
3220
|
s.length > 0 && (n[i] = {
|
|
@@ -3222,14 +3223,14 @@ function Un(e, t) {
|
|
|
3222
3223
|
});
|
|
3223
3224
|
}), n;
|
|
3224
3225
|
}
|
|
3225
|
-
function
|
|
3226
|
+
function Gn(e) {
|
|
3226
3227
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
3227
3228
|
}
|
|
3228
3229
|
//#endregion
|
|
3229
3230
|
//#region src/core/appendPage.ts
|
|
3230
|
-
function
|
|
3231
|
-
let i =
|
|
3232
|
-
t.items =
|
|
3231
|
+
function Kn(e, t, n, r) {
|
|
3232
|
+
let i = Vn(e), a = n.filterItems(i.items), o = Gn(i);
|
|
3233
|
+
t.items = Wn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
3233
3234
|
contributionIds: a.map(({ postId: e }) => e),
|
|
3234
3235
|
cursor: o,
|
|
3235
3236
|
next: i.next,
|
|
@@ -3238,32 +3239,32 @@ function Gn(e, t, n, r) {
|
|
|
3238
3239
|
}
|
|
3239
3240
|
//#endregion
|
|
3240
3241
|
//#region src/core/requestDelay.ts
|
|
3241
|
-
var
|
|
3242
|
+
var qn = 2e3, Jn = 1e4, Yn = 250, Xn = {
|
|
3242
3243
|
delayRemainingMs: null,
|
|
3243
3244
|
nextRequestAt: null
|
|
3244
3245
|
};
|
|
3245
|
-
function
|
|
3246
|
+
function Zn(e, t) {
|
|
3246
3247
|
return e === void 0 ? t : Math.floor(e);
|
|
3247
3248
|
}
|
|
3248
|
-
function
|
|
3249
|
+
function Qn(e, t) {
|
|
3249
3250
|
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
3251
|
}
|
|
3251
|
-
function
|
|
3252
|
-
let n =
|
|
3252
|
+
function $n(e, t = {}) {
|
|
3253
|
+
let n = Zn(t.delayStepMs, qn), r = Zn(t.delayMaxMs, Jn);
|
|
3253
3254
|
return Math.min(Math.max(0, e) * n, r);
|
|
3254
3255
|
}
|
|
3255
|
-
function
|
|
3256
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
3256
|
+
function er(e) {
|
|
3257
|
+
if (e == null || !Number.isFinite(e)) return { ...Xn };
|
|
3257
3258
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
3258
3259
|
return t > 0 ? {
|
|
3259
3260
|
delayRemainingMs: t,
|
|
3260
3261
|
nextRequestAt: e
|
|
3261
|
-
} : { ...
|
|
3262
|
+
} : { ...Xn };
|
|
3262
3263
|
}
|
|
3263
|
-
async function
|
|
3264
|
+
async function tr({ delayMs: e, onChange: t, signal: n }) {
|
|
3264
3265
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
3265
3266
|
if (e <= 0) {
|
|
3266
|
-
t({ ...
|
|
3267
|
+
t({ ...Xn });
|
|
3267
3268
|
return;
|
|
3268
3269
|
}
|
|
3269
3270
|
let r = Date.now() + e;
|
|
@@ -3271,9 +3272,9 @@ async function er({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3271
3272
|
delayRemainingMs: e,
|
|
3272
3273
|
nextRequestAt: r
|
|
3273
3274
|
}), await new Promise((i, a) => {
|
|
3274
|
-
let o = !1, s = setInterval(f,
|
|
3275
|
+
let o = !1, s = setInterval(f, Yn), c = setTimeout(() => u(), e);
|
|
3275
3276
|
function l() {
|
|
3276
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
3277
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Xn });
|
|
3277
3278
|
}
|
|
3278
3279
|
function u(e) {
|
|
3279
3280
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -3282,42 +3283,42 @@ async function er({ delayMs: e, onChange: t, signal: n }) {
|
|
|
3282
3283
|
u(new DOMException("Aborted", "AbortError"));
|
|
3283
3284
|
}
|
|
3284
3285
|
function f() {
|
|
3285
|
-
let e =
|
|
3286
|
+
let e = er(r);
|
|
3286
3287
|
t(e), e.delayRemainingMs === null && u();
|
|
3287
3288
|
}
|
|
3288
3289
|
n.addEventListener("abort", d, { once: !0 });
|
|
3289
3290
|
});
|
|
3290
3291
|
}
|
|
3291
|
-
var
|
|
3292
|
+
var nr = class {
|
|
3292
3293
|
interval = null;
|
|
3293
3294
|
constructor(e) {
|
|
3294
3295
|
this.onChange = e;
|
|
3295
3296
|
}
|
|
3296
3297
|
clear() {
|
|
3297
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
3298
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Xn });
|
|
3298
3299
|
}
|
|
3299
3300
|
sync(e) {
|
|
3300
3301
|
this.clear();
|
|
3301
|
-
let t =
|
|
3302
|
+
let t = er(e);
|
|
3302
3303
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
3303
|
-
let t =
|
|
3304
|
+
let t = er(e);
|
|
3304
3305
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
3305
|
-
},
|
|
3306
|
+
}, Yn));
|
|
3306
3307
|
}
|
|
3307
3308
|
};
|
|
3308
|
-
function
|
|
3309
|
+
function rr(e, t = !0) {
|
|
3309
3310
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
3310
3311
|
}
|
|
3311
|
-
function
|
|
3312
|
+
function ir(e) {
|
|
3312
3313
|
return `${typeof e}:${String(e)}`;
|
|
3313
3314
|
}
|
|
3314
|
-
function
|
|
3315
|
+
function ar(e, t) {
|
|
3315
3316
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
3316
3317
|
}
|
|
3317
|
-
function
|
|
3318
|
+
function or(e) {
|
|
3318
3319
|
if (!e) return;
|
|
3319
|
-
if (
|
|
3320
|
-
|
|
3320
|
+
if (ar(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
3321
|
+
Qn(e, "frontend autofill");
|
|
3321
3322
|
let t = e.maxAdditionalPages;
|
|
3322
3323
|
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
3324
|
return;
|
|
@@ -3329,7 +3330,7 @@ function ar(e) {
|
|
|
3329
3330
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
3330
3331
|
}
|
|
3331
3332
|
}
|
|
3332
|
-
function
|
|
3333
|
+
function sr(e, t, n = !0) {
|
|
3333
3334
|
if (!e) return {
|
|
3334
3335
|
cycleId: null,
|
|
3335
3336
|
delayRemainingMs: null,
|
|
@@ -3346,7 +3347,7 @@ function or(e, t, n = !0) {
|
|
|
3346
3347
|
status: "idle",
|
|
3347
3348
|
strategy: null
|
|
3348
3349
|
};
|
|
3349
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
3350
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = er(r?.nextRequestAt);
|
|
3350
3351
|
return {
|
|
3351
3352
|
cycleId: r?.cycleId ?? null,
|
|
3352
3353
|
...a,
|
|
@@ -3363,7 +3364,7 @@ function or(e, t, n = !0) {
|
|
|
3363
3364
|
strategy: e.strategy
|
|
3364
3365
|
};
|
|
3365
3366
|
}
|
|
3366
|
-
function
|
|
3367
|
+
function cr(e) {
|
|
3367
3368
|
return [
|
|
3368
3369
|
"cancelling",
|
|
3369
3370
|
"filling",
|
|
@@ -3371,9 +3372,9 @@ function sr(e) {
|
|
|
3371
3372
|
"waiting"
|
|
3372
3373
|
].includes(e.status);
|
|
3373
3374
|
}
|
|
3374
|
-
async function
|
|
3375
|
+
async function lr(e, t, n) {
|
|
3375
3376
|
let r = t.autofill;
|
|
3376
|
-
if (!
|
|
3377
|
+
if (!cr(r) || !r.cycleId) return;
|
|
3377
3378
|
let i = {
|
|
3378
3379
|
cycleId: r.cycleId,
|
|
3379
3380
|
feedKey: r.feedKey ?? "",
|
|
@@ -3386,16 +3387,16 @@ async function cr(e, t, n) {
|
|
|
3386
3387
|
throw r.error = e, r.status = "error", e;
|
|
3387
3388
|
}
|
|
3388
3389
|
}
|
|
3389
|
-
function
|
|
3390
|
+
function ur(e, t, n) {
|
|
3390
3391
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
3391
3392
|
}
|
|
3392
|
-
async function
|
|
3393
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
3393
|
+
async function dr({ 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 }) {
|
|
3394
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? rr(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
3394
3395
|
for (; y < h;) {
|
|
3395
|
-
let e =
|
|
3396
|
+
let e = ir(g);
|
|
3396
3397
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
3397
|
-
if (m.add(e), await
|
|
3398
|
-
delayMs:
|
|
3398
|
+
if (m.add(e), await tr({
|
|
3399
|
+
delayMs: $n(l + y, s),
|
|
3399
3400
|
onChange: a,
|
|
3400
3401
|
signal: d
|
|
3401
3402
|
}), y > 0 && u()) return {
|
|
@@ -3409,7 +3410,7 @@ async function ur({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3409
3410
|
status: "paused",
|
|
3410
3411
|
total: x
|
|
3411
3412
|
};
|
|
3412
|
-
let t =
|
|
3413
|
+
let t = Vn(await n({
|
|
3413
3414
|
cursor: g,
|
|
3414
3415
|
signal: d
|
|
3415
3416
|
}));
|
|
@@ -3466,12 +3467,12 @@ async function ur({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3466
3467
|
}
|
|
3467
3468
|
//#endregion
|
|
3468
3469
|
//#region src/core/autofillController.ts
|
|
3469
|
-
var
|
|
3470
|
+
var fr = class {
|
|
3470
3471
|
collection = null;
|
|
3471
3472
|
cycle = 0;
|
|
3472
3473
|
delayCountdown;
|
|
3473
3474
|
constructor(e) {
|
|
3474
|
-
this.context = e, this.delayCountdown = new
|
|
3475
|
+
this.context = e, this.delayCountdown = new nr((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
3475
3476
|
}
|
|
3476
3477
|
beginCycle() {
|
|
3477
3478
|
let { options: e, state: t } = this.context;
|
|
@@ -3479,14 +3480,14 @@ var dr = class {
|
|
|
3479
3480
|
this.clear();
|
|
3480
3481
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3481
3482
|
return t.autofill = {
|
|
3482
|
-
...
|
|
3483
|
+
...sr(e, void 0, !1),
|
|
3483
3484
|
cycleId: n,
|
|
3484
3485
|
status: "filling"
|
|
3485
3486
|
}, n;
|
|
3486
3487
|
}
|
|
3487
3488
|
async cancel() {
|
|
3488
3489
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
3489
|
-
await
|
|
3490
|
+
await lr(t, n, e), this.commitCollection();
|
|
3490
3491
|
}
|
|
3491
3492
|
captureCollection(e, t) {
|
|
3492
3493
|
t && (this.collection = e);
|
|
@@ -3514,30 +3515,30 @@ var dr = class {
|
|
|
3514
3515
|
requests: r.requests
|
|
3515
3516
|
}), !0) : !1;
|
|
3516
3517
|
}
|
|
3517
|
-
},
|
|
3518
|
-
function
|
|
3518
|
+
}, pr = 100;
|
|
3519
|
+
function mr(e, t) {
|
|
3519
3520
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
3520
3521
|
}
|
|
3521
|
-
function
|
|
3522
|
+
function hr(e, t, n) {
|
|
3522
3523
|
return Math.min(n, Math.max(t, e));
|
|
3523
3524
|
}
|
|
3524
|
-
function
|
|
3525
|
+
function gr(e) {
|
|
3525
3526
|
if (!e) return;
|
|
3526
3527
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
3527
|
-
if (
|
|
3528
|
-
e.speedPxPerSecond !== void 0 &&
|
|
3528
|
+
if (mr("autoScroll.minSpeedPxPerSecond", t), mr("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
3529
|
+
e.speedPxPerSecond !== void 0 && mr("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
3529
3530
|
}
|
|
3530
|
-
function
|
|
3531
|
+
function _r(e) {
|
|
3531
3532
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
3532
3533
|
return {
|
|
3533
3534
|
enabled: e?.enabled ?? !1,
|
|
3534
3535
|
maxSpeedPxPerSecond: n,
|
|
3535
3536
|
minSpeedPxPerSecond: t,
|
|
3536
3537
|
paused: !1,
|
|
3537
|
-
speedPxPerSecond:
|
|
3538
|
+
speedPxPerSecond: hr(e?.speedPxPerSecond ?? 80, t, n)
|
|
3538
3539
|
};
|
|
3539
3540
|
}
|
|
3540
|
-
var
|
|
3541
|
+
var vr = class {
|
|
3541
3542
|
frame = null;
|
|
3542
3543
|
lastTimestamp = null;
|
|
3543
3544
|
mounted = !1;
|
|
@@ -3557,9 +3558,9 @@ var _r = class {
|
|
|
3557
3558
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
3558
3559
|
}
|
|
3559
3560
|
setSpeed(e) {
|
|
3560
|
-
|
|
3561
|
+
mr("auto-scroll speed", e);
|
|
3561
3562
|
let t = this.options.state;
|
|
3562
|
-
t.speedPxPerSecond =
|
|
3563
|
+
t.speedPxPerSecond = hr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
3563
3564
|
}
|
|
3564
3565
|
tick = (e) => {
|
|
3565
3566
|
this.frame = null;
|
|
@@ -3571,7 +3572,7 @@ var _r = class {
|
|
|
3571
3572
|
return;
|
|
3572
3573
|
}
|
|
3573
3574
|
if (this.lastTimestamp !== null) {
|
|
3574
|
-
let r = Math.min(
|
|
3575
|
+
let r = Math.min(pr, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3575
3576
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3576
3577
|
}
|
|
3577
3578
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3585,13 +3586,13 @@ var _r = class {
|
|
|
3585
3586
|
};
|
|
3586
3587
|
//#endregion
|
|
3587
3588
|
//#region src/core/backendAutofill.ts
|
|
3588
|
-
async function
|
|
3589
|
+
async function yr(e, t, n, r) {
|
|
3589
3590
|
let i = await e.onUnderfilled(n);
|
|
3590
3591
|
if (!r()) return;
|
|
3591
3592
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
3592
3593
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
3593
3594
|
Object.assign(t.autofill, {
|
|
3594
|
-
|
|
3595
|
+
...er(i.nextRequestAt),
|
|
3595
3596
|
missing: Math.max(0, e.pageSize - a),
|
|
3596
3597
|
received: a,
|
|
3597
3598
|
sequence: i.sequence ?? 0,
|
|
@@ -3599,19 +3600,19 @@ async function vr(e, t, n, r) {
|
|
|
3599
3600
|
status: "waiting"
|
|
3600
3601
|
});
|
|
3601
3602
|
}
|
|
3602
|
-
function
|
|
3603
|
+
function br(e, t) {
|
|
3603
3604
|
["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
3605
|
}
|
|
3605
|
-
function
|
|
3606
|
+
function xr(e, t, n) {
|
|
3606
3607
|
let r = t.autofill;
|
|
3607
|
-
return !
|
|
3608
|
+
return !ur(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (br(t, n), Object.assign(r, er(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
3609
|
}
|
|
3609
|
-
function
|
|
3610
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3610
|
+
function Sr(e, t, n) {
|
|
3611
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = sr(e, n), br(t, n), !0);
|
|
3611
3612
|
}
|
|
3612
3613
|
//#endregion
|
|
3613
3614
|
//#region src/core/backlogRestore.ts
|
|
3614
|
-
async function
|
|
3615
|
+
async function Cr(e, t, n) {
|
|
3615
3616
|
if (!e) return;
|
|
3616
3617
|
let r = new AbortController();
|
|
3617
3618
|
n(r);
|
|
@@ -3626,7 +3627,7 @@ async function Sr(e, t, n) {
|
|
|
3626
3627
|
}
|
|
3627
3628
|
//#endregion
|
|
3628
3629
|
//#region src/core/initialAutofill.ts
|
|
3629
|
-
async function
|
|
3630
|
+
async function wr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3630
3631
|
let c = a.autofill;
|
|
3631
3632
|
if (!c) return;
|
|
3632
3633
|
let l = s.items.length;
|
|
@@ -3639,7 +3640,7 @@ async function Cr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3639
3640
|
return;
|
|
3640
3641
|
}
|
|
3641
3642
|
if (c.strategy === "backend") {
|
|
3642
|
-
await
|
|
3643
|
+
await yr(c, s, {
|
|
3643
3644
|
cycleId: e,
|
|
3644
3645
|
feedKey: c.feedKey,
|
|
3645
3646
|
items: [...s.items],
|
|
@@ -3656,11 +3657,11 @@ async function Cr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3656
3657
|
s.autofill.status = "exhausted";
|
|
3657
3658
|
return;
|
|
3658
3659
|
}
|
|
3659
|
-
let u = await
|
|
3660
|
+
let u = await dr({
|
|
3660
3661
|
existingItems: s.items,
|
|
3661
3662
|
initialCursor: s.next,
|
|
3662
3663
|
loadPage: a.loadPage,
|
|
3663
|
-
maximumRequests:
|
|
3664
|
+
maximumRequests: rr(c, !1),
|
|
3664
3665
|
onCollection: n,
|
|
3665
3666
|
onDelayChange: (e) => {
|
|
3666
3667
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3683,13 +3684,13 @@ async function Cr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3683
3684
|
}
|
|
3684
3685
|
//#endregion
|
|
3685
3686
|
//#region src/core/fill.ts
|
|
3686
|
-
function
|
|
3687
|
+
function Tr(e) {
|
|
3687
3688
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3688
3689
|
}
|
|
3689
|
-
function
|
|
3690
|
+
function Er(e) {
|
|
3690
3691
|
return `${typeof e}:${String(e)}`;
|
|
3691
3692
|
}
|
|
3692
|
-
function
|
|
3693
|
+
function Dr(e) {
|
|
3693
3694
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3694
3695
|
if ("pages" in e) {
|
|
3695
3696
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3702,21 +3703,21 @@ function Er(e) {
|
|
|
3702
3703
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3703
3704
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3704
3705
|
}
|
|
3705
|
-
function
|
|
3706
|
+
function Or(e) {
|
|
3706
3707
|
if (!e) return;
|
|
3707
3708
|
if (e.strategy === "frontend") {
|
|
3708
|
-
|
|
3709
|
+
Qn(e, "frontend fill");
|
|
3709
3710
|
return;
|
|
3710
3711
|
}
|
|
3711
3712
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3712
3713
|
let t = e.initialSession;
|
|
3713
3714
|
if (t) {
|
|
3714
3715
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3715
|
-
|
|
3716
|
+
Dr(t.target);
|
|
3716
3717
|
}
|
|
3717
3718
|
}
|
|
3718
|
-
function
|
|
3719
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3719
|
+
function kr(e, t, n = !0) {
|
|
3720
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = er(i?.nextRequestAt);
|
|
3720
3721
|
return {
|
|
3721
3722
|
completedPages: i?.completedPages ?? 0,
|
|
3722
3723
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3729,10 +3730,10 @@ function Or(e, t, n = !0) {
|
|
|
3729
3730
|
sessionId: i?.sessionId ?? null,
|
|
3730
3731
|
status: i?.status ?? "idle",
|
|
3731
3732
|
strategy: e?.strategy ?? null,
|
|
3732
|
-
target: i ?
|
|
3733
|
+
target: i ? Tr(i.target) : null
|
|
3733
3734
|
};
|
|
3734
3735
|
}
|
|
3735
|
-
function
|
|
3736
|
+
function Ar(e) {
|
|
3736
3737
|
return [
|
|
3737
3738
|
"cancelling",
|
|
3738
3739
|
"filling",
|
|
@@ -3740,7 +3741,7 @@ function kr(e) {
|
|
|
3740
3741
|
"waiting"
|
|
3741
3742
|
].includes(e.status);
|
|
3742
3743
|
}
|
|
3743
|
-
async function
|
|
3744
|
+
async function jr({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3744
3745
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3745
3746
|
if ("items" in l && f.length >= l.items) return {
|
|
3746
3747
|
completedPages: m,
|
|
@@ -3752,10 +3753,10 @@ async function Ar({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3752
3753
|
status: "complete"
|
|
3753
3754
|
};
|
|
3754
3755
|
for (; _ !== null;) {
|
|
3755
|
-
let e =
|
|
3756
|
+
let e = Er(h);
|
|
3756
3757
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3757
|
-
if (p.add(e), await
|
|
3758
|
-
delayMs:
|
|
3758
|
+
if (p.add(e), await tr({
|
|
3759
|
+
delayMs: $n(m, o),
|
|
3759
3760
|
onChange: i,
|
|
3760
3761
|
signal: c
|
|
3761
3762
|
}), m > 0 && s()) return {
|
|
@@ -3768,7 +3769,7 @@ async function Ar({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3768
3769
|
status: "paused",
|
|
3769
3770
|
total: y
|
|
3770
3771
|
};
|
|
3771
|
-
let t =
|
|
3772
|
+
let t = Vn(await n({
|
|
3772
3773
|
cursor: h,
|
|
3773
3774
|
signal: c
|
|
3774
3775
|
}));
|
|
@@ -3836,12 +3837,12 @@ async function Ar({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3836
3837
|
}
|
|
3837
3838
|
//#endregion
|
|
3838
3839
|
//#region src/core/backendFill.ts
|
|
3839
|
-
async function
|
|
3840
|
+
async function Mr(e, t, n, r) {
|
|
3840
3841
|
let i = await e.onStart(n);
|
|
3841
3842
|
if (r()) {
|
|
3842
3843
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3843
3844
|
Object.assign(t.fill, {
|
|
3844
|
-
|
|
3845
|
+
...er(i.nextRequestAt),
|
|
3845
3846
|
completedPages: i.completedPages ?? 0,
|
|
3846
3847
|
received: i.received ?? 0,
|
|
3847
3848
|
sequence: i.sequence ?? 0,
|
|
@@ -3850,23 +3851,23 @@ async function jr(e, t, n, r) {
|
|
|
3850
3851
|
});
|
|
3851
3852
|
}
|
|
3852
3853
|
}
|
|
3853
|
-
function
|
|
3854
|
+
function Nr(e, t, n) {
|
|
3854
3855
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3855
3856
|
}
|
|
3856
|
-
function
|
|
3857
|
+
function Pr(e) {
|
|
3857
3858
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3858
3859
|
}
|
|
3859
|
-
function
|
|
3860
|
+
function Fr(e, t) {
|
|
3860
3861
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3861
3862
|
let n = e.fill.target;
|
|
3862
3863
|
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
3864
|
}
|
|
3864
|
-
function
|
|
3865
|
+
function Ir(e, t, n) {
|
|
3865
3866
|
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
3867
|
}
|
|
3867
|
-
function
|
|
3868
|
-
return !
|
|
3869
|
-
|
|
3868
|
+
function Lr(e, t, n, r) {
|
|
3869
|
+
return !Nr(e, t, n) || !Pr(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Fr(t, n) ? !1 : (Ir(t, n, r), Object.assign(t.fill, {
|
|
3870
|
+
...er(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3870
3871
|
completedPages: n.completedPages,
|
|
3871
3872
|
error: n.error ?? null,
|
|
3872
3873
|
received: n.received,
|
|
@@ -3874,45 +3875,45 @@ function Ir(e, t, n, r) {
|
|
|
3874
3875
|
status: n.status
|
|
3875
3876
|
}), !0);
|
|
3876
3877
|
}
|
|
3877
|
-
function
|
|
3878
|
+
function Rr(e, t, n, r) {
|
|
3878
3879
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3879
3880
|
let i = t.fill;
|
|
3880
|
-
return t.fill =
|
|
3881
|
+
return t.fill = kr(e, n), !Pr(n) || !Fr(t, n) ? (t.fill = i, !1) : (Ir(t, n, r), !0);
|
|
3881
3882
|
}
|
|
3882
3883
|
//#endregion
|
|
3883
3884
|
//#region src/core/fillController.ts
|
|
3884
|
-
var
|
|
3885
|
+
var zr = class {
|
|
3885
3886
|
abortController = null;
|
|
3886
3887
|
cycle = 0;
|
|
3887
3888
|
delayCountdown;
|
|
3888
3889
|
requestVersion = 0;
|
|
3889
3890
|
collection = null;
|
|
3890
3891
|
constructor(e) {
|
|
3891
|
-
this.options = e, this.delayCountdown = new
|
|
3892
|
+
this.options = e, this.delayCountdown = new nr((e) => {
|
|
3892
3893
|
Object.assign(this.options.state.fill, e);
|
|
3893
3894
|
}), this.syncBackendCountdown();
|
|
3894
3895
|
}
|
|
3895
3896
|
isActive() {
|
|
3896
|
-
return
|
|
3897
|
+
return Ar(this.options.state.fill);
|
|
3897
3898
|
}
|
|
3898
3899
|
applyUpdate(e) {
|
|
3899
|
-
let t =
|
|
3900
|
+
let t = Lr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3900
3901
|
return t && this.syncBackendCountdown(), t;
|
|
3901
3902
|
}
|
|
3902
3903
|
restoreSession(e) {
|
|
3903
|
-
let t =
|
|
3904
|
+
let t = Rr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3904
3905
|
return t && this.syncBackendCountdown(), t;
|
|
3905
3906
|
}
|
|
3906
3907
|
async start(e, t = {}) {
|
|
3907
3908
|
let n = this.options.fill;
|
|
3908
3909
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3909
3910
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3910
|
-
let r =
|
|
3911
|
+
let r = Dr(e), i = Dr(t.target ?? r), a = t.progressOffset ?? {
|
|
3911
3912
|
completedPages: 0,
|
|
3912
3913
|
received: 0
|
|
3913
3914
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3914
3915
|
if (this.options.state.fill = {
|
|
3915
|
-
...
|
|
3916
|
+
...kr(n, void 0, !1),
|
|
3916
3917
|
completedPages: a.completedPages,
|
|
3917
3918
|
cycleId: o,
|
|
3918
3919
|
received: a.received,
|
|
@@ -3925,7 +3926,7 @@ var Rr = class {
|
|
|
3925
3926
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3926
3927
|
this.abortController = c;
|
|
3927
3928
|
try {
|
|
3928
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3929
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Mr(n, this.options.state, {
|
|
3929
3930
|
cycleId: o,
|
|
3930
3931
|
feedKey: n.feedKey,
|
|
3931
3932
|
items: [...this.options.state.items],
|
|
@@ -3943,7 +3944,7 @@ var Rr = class {
|
|
|
3943
3944
|
}
|
|
3944
3945
|
async cancel() {
|
|
3945
3946
|
let { fill: e, state: t } = this.options;
|
|
3946
|
-
if (!
|
|
3947
|
+
if (!Ar(t.fill) || !t.fill.cycleId) return;
|
|
3947
3948
|
let n = {
|
|
3948
3949
|
cycleId: t.fill.cycleId,
|
|
3949
3950
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3987,7 +3988,7 @@ var Rr = class {
|
|
|
3987
3988
|
});
|
|
3988
3989
|
}
|
|
3989
3990
|
reset() {
|
|
3990
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3991
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = kr(this.options.fill, void 0, !1), this.collection = null;
|
|
3991
3992
|
}
|
|
3992
3993
|
destroy() {
|
|
3993
3994
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -4022,7 +4023,7 @@ var Rr = class {
|
|
|
4022
4023
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
4023
4024
|
return;
|
|
4024
4025
|
}
|
|
4025
|
-
let c = await
|
|
4026
|
+
let c = await jr({
|
|
4026
4027
|
existingItems: s.items,
|
|
4027
4028
|
initialCursor: s.next,
|
|
4028
4029
|
loadPage: o,
|
|
@@ -4070,20 +4071,20 @@ var Rr = class {
|
|
|
4070
4071
|
};
|
|
4071
4072
|
//#endregion
|
|
4072
4073
|
//#region src/core/fillReconciliation.ts
|
|
4073
|
-
async function
|
|
4074
|
-
if (!e.needsReconciliation(
|
|
4075
|
-
let
|
|
4076
|
-
existingItems:
|
|
4074
|
+
async function Br({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, pauseWhenManual: i = !1, setLastCursor: a, signal: o, state: s }) {
|
|
4075
|
+
if (!e.needsReconciliation(s.items)) return "skipped";
|
|
4076
|
+
let c = await e.reconcile({
|
|
4077
|
+
existingItems: s.items,
|
|
4077
4078
|
loadPage: n,
|
|
4078
4079
|
onDelayChange: r,
|
|
4079
|
-
shouldPause: () =>
|
|
4080
|
-
signal:
|
|
4080
|
+
shouldPause: () => s.loadMoreLocked || i && !s.infiniteScroll,
|
|
4081
|
+
signal: o
|
|
4081
4082
|
});
|
|
4082
|
-
return t() ? (
|
|
4083
|
+
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
4084
|
}
|
|
4084
4085
|
//#endregion
|
|
4085
4086
|
//#region src/core/feedFooter.ts
|
|
4086
|
-
function
|
|
4087
|
+
function Vr(e) {
|
|
4087
4088
|
return {
|
|
4088
4089
|
cancelAutofill: () => e.cancelAutofill(),
|
|
4089
4090
|
loadMore: () => e.loadNext(),
|
|
@@ -4095,46 +4096,46 @@ function Br(e) {
|
|
|
4095
4096
|
retryFill: () => e.retryFill()
|
|
4096
4097
|
};
|
|
4097
4098
|
}
|
|
4098
|
-
function Vr(e) {
|
|
4099
|
-
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
4100
|
-
}
|
|
4101
4099
|
function Hr(e) {
|
|
4102
|
-
e
|
|
4100
|
+
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
4103
4101
|
}
|
|
4104
4102
|
function Ur(e) {
|
|
4103
|
+
e?.intervalMs !== void 0 && Hr(e.intervalMs);
|
|
4104
|
+
}
|
|
4105
|
+
function Wr(e) {
|
|
4105
4106
|
return {
|
|
4106
4107
|
enabled: e?.enabled ?? !1,
|
|
4107
4108
|
includePostItems: e?.includePostItems ?? !1,
|
|
4108
4109
|
intervalMs: e?.intervalMs ?? 5e3
|
|
4109
4110
|
};
|
|
4110
4111
|
}
|
|
4111
|
-
function
|
|
4112
|
+
function Gr(e, t) {
|
|
4112
4113
|
if (typeof t == "boolean") {
|
|
4113
4114
|
e.enabled = t;
|
|
4114
4115
|
return;
|
|
4115
4116
|
}
|
|
4116
|
-
|
|
4117
|
+
Ur(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
4118
|
}
|
|
4118
4119
|
//#endregion
|
|
4119
4120
|
//#region src/core/reelInfoSheet.ts
|
|
4120
|
-
function
|
|
4121
|
+
function Kr(e) {
|
|
4121
4122
|
return { enabled: e?.enabled ?? !1 };
|
|
4122
4123
|
}
|
|
4123
|
-
function
|
|
4124
|
+
function qr(e, t, n) {
|
|
4124
4125
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
4125
4126
|
e.enabled = n;
|
|
4126
4127
|
}
|
|
4127
4128
|
//#endregion
|
|
4128
4129
|
//#region src/core/initialRuntimeState.ts
|
|
4129
|
-
function
|
|
4130
|
+
function Jr(e, t) {
|
|
4130
4131
|
let n = e.initialPage;
|
|
4131
4132
|
return {
|
|
4132
4133
|
activeReelPostId: null,
|
|
4133
|
-
autoScroll:
|
|
4134
|
-
autofill:
|
|
4134
|
+
autoScroll: _r(e.autoScroll),
|
|
4135
|
+
autofill: sr(e.autofill),
|
|
4135
4136
|
current: n?.current ?? null,
|
|
4136
4137
|
error: null,
|
|
4137
|
-
fill:
|
|
4138
|
+
fill: kr(e.fill),
|
|
4138
4139
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
4139
4140
|
isLoading: !n,
|
|
4140
4141
|
isLoadingMore: !1,
|
|
@@ -4145,14 +4146,14 @@ function qr(e, t) {
|
|
|
4145
4146
|
next: n?.next ?? null,
|
|
4146
4147
|
nextPageError: null,
|
|
4147
4148
|
phoneMode: !1,
|
|
4148
|
-
reelAutoAdvance:
|
|
4149
|
+
reelAutoAdvance: Wr(e.reelAutoAdvance),
|
|
4149
4150
|
reelForward: {
|
|
4150
4151
|
error: null,
|
|
4151
4152
|
status: "idle"
|
|
4152
4153
|
},
|
|
4153
4154
|
reelForwardIndex: null,
|
|
4154
4155
|
reelForwardItem: null,
|
|
4155
|
-
reelInfoSheet:
|
|
4156
|
+
reelInfoSheet: Kr(e.reelInfoSheet),
|
|
4156
4157
|
reelInfoSheetOverlay: !1,
|
|
4157
4158
|
reelMediaSource: "original",
|
|
4158
4159
|
reelOrigin: null,
|
|
@@ -4161,21 +4162,21 @@ function qr(e, t) {
|
|
|
4161
4162
|
}
|
|
4162
4163
|
//#endregion
|
|
4163
4164
|
//#region src/core/options.ts
|
|
4164
|
-
function
|
|
4165
|
+
function Yr(e, t) {
|
|
4165
4166
|
if (t) {
|
|
4166
4167
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
4167
4168
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
4168
4169
|
}
|
|
4169
4170
|
}
|
|
4170
|
-
function
|
|
4171
|
+
function Xr(e, t) {
|
|
4171
4172
|
if (t) {
|
|
4172
4173
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
4173
4174
|
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
4175
|
}
|
|
4175
4176
|
}
|
|
4176
|
-
function
|
|
4177
|
-
if (
|
|
4178
|
-
if (
|
|
4177
|
+
function Zr(e) {
|
|
4178
|
+
if (gr(e.autoScroll), Yr("cardHeader", e.cardHeader), Yr("cardFooter", e.cardFooter), Xr("header", e.mediaCard?.header), Xr("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\".");
|
|
4179
|
+
if (or(e.autofill), Or(e.fill), Oe(e.masonry), Ur(e.reelAutoAdvance), e.removalReconciliation) {
|
|
4179
4180
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
4180
4181
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
4181
4182
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -4190,7 +4191,7 @@ function Xr(e) {
|
|
|
4190
4191
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
4191
4192
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
4192
4193
|
}
|
|
4193
|
-
function
|
|
4194
|
+
function Qr(e) {
|
|
4194
4195
|
if (typeof e != "string") return e;
|
|
4195
4196
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
4196
4197
|
let t = document.querySelector(e);
|
|
@@ -4199,7 +4200,7 @@ function Zr(e) {
|
|
|
4199
4200
|
}
|
|
4200
4201
|
//#endregion
|
|
4201
4202
|
//#region src/core/pageRequest.ts
|
|
4202
|
-
async function
|
|
4203
|
+
async function $r({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
4203
4204
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
4204
4205
|
received: l.autofill.received,
|
|
4205
4206
|
requests: l.autofill.requests
|
|
@@ -4211,11 +4212,11 @@ async function Qr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4211
4212
|
let m = !1;
|
|
4212
4213
|
try {
|
|
4213
4214
|
if (u?.strategy === "frontend") {
|
|
4214
|
-
let s = await
|
|
4215
|
+
let s = await dr({
|
|
4215
4216
|
existingItems: e ? l.items : [],
|
|
4216
4217
|
initialCursor: n,
|
|
4217
4218
|
loadPage: i,
|
|
4218
|
-
maximumRequests: f ? Math.max(0,
|
|
4219
|
+
maximumRequests: f ? Math.max(0, rr(u) - f.requests) : void 0,
|
|
4219
4220
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
4220
4221
|
onDelayChange: (e) => {
|
|
4221
4222
|
r() && Object.assign(l.autofill, e);
|
|
@@ -4238,7 +4239,7 @@ async function Qr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4238
4239
|
}), o(s.pages), t.clearCollection();
|
|
4239
4240
|
return;
|
|
4240
4241
|
}
|
|
4241
|
-
let s =
|
|
4242
|
+
let s = Vn(await i({
|
|
4242
4243
|
cursor: n,
|
|
4243
4244
|
signal: c
|
|
4244
4245
|
}));
|
|
@@ -4258,7 +4259,7 @@ async function Qr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4258
4259
|
l.autofill.status = "complete";
|
|
4259
4260
|
return;
|
|
4260
4261
|
}
|
|
4261
|
-
await
|
|
4262
|
+
await yr(u, l, {
|
|
4262
4263
|
cycleId: p,
|
|
4263
4264
|
feedKey: u.feedKey,
|
|
4264
4265
|
items: h.slice(d.length),
|
|
@@ -4280,16 +4281,16 @@ async function Qr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
4280
4281
|
}
|
|
4281
4282
|
//#endregion
|
|
4282
4283
|
//#region src/core/removalReconciliationController.ts
|
|
4283
|
-
function $r(e) {
|
|
4284
|
-
return `${typeof e}:${String(e)}`;
|
|
4285
|
-
}
|
|
4286
4284
|
function ei(e) {
|
|
4287
4285
|
return `${typeof e}:${String(e)}`;
|
|
4288
4286
|
}
|
|
4289
4287
|
function ti(e) {
|
|
4288
|
+
return `${typeof e}:${String(e)}`;
|
|
4289
|
+
}
|
|
4290
|
+
function ni(e) {
|
|
4290
4291
|
return e.map(({ postId: e }) => e);
|
|
4291
4292
|
}
|
|
4292
|
-
var
|
|
4293
|
+
var ri = class {
|
|
4293
4294
|
delay;
|
|
4294
4295
|
enabled;
|
|
4295
4296
|
maxReplayPages;
|
|
@@ -4308,7 +4309,7 @@ var ni = class {
|
|
|
4308
4309
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
4309
4310
|
}
|
|
4310
4311
|
filterItems(e) {
|
|
4311
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
4312
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(ei(e)));
|
|
4312
4313
|
}
|
|
4313
4314
|
needsReconciliation(e) {
|
|
4314
4315
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -4321,45 +4322,45 @@ var ni = class {
|
|
|
4321
4322
|
}
|
|
4322
4323
|
recordInitialPage(e) {
|
|
4323
4324
|
e && this.recordPages([{
|
|
4324
|
-
contributionIds:
|
|
4325
|
-
cursor:
|
|
4325
|
+
contributionIds: ni(e.items),
|
|
4326
|
+
cursor: Gn(e),
|
|
4326
4327
|
next: e.next,
|
|
4327
|
-
returnedIds:
|
|
4328
|
+
returnedIds: ni(e.items)
|
|
4328
4329
|
}]);
|
|
4329
4330
|
}
|
|
4330
4331
|
remove(e) {
|
|
4331
|
-
e.forEach((e) => this.tombstones.add(
|
|
4332
|
+
e.forEach((e) => this.tombstones.add(ei(e)));
|
|
4332
4333
|
}
|
|
4333
4334
|
reset() {
|
|
4334
4335
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
4335
4336
|
}
|
|
4336
4337
|
restore(e) {
|
|
4337
|
-
e.forEach((e) => this.tombstones.delete(
|
|
4338
|
+
e.forEach((e) => this.tombstones.delete(ei(e)));
|
|
4338
4339
|
}
|
|
4339
4340
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
4340
4341
|
let a = this.pending ?? this.createSession(e);
|
|
4341
4342
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
4342
|
-
let e =
|
|
4343
|
+
let e = ti(a.cursor);
|
|
4343
4344
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
4344
|
-
if (await
|
|
4345
|
-
delayMs:
|
|
4345
|
+
if (await tr({
|
|
4346
|
+
delayMs: $n(a.pages.length, this.delay),
|
|
4346
4347
|
onChange: n,
|
|
4347
4348
|
signal: i
|
|
4348
4349
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
4349
|
-
let o =
|
|
4350
|
+
let o = Vn(await t({
|
|
4350
4351
|
cursor: a.cursor,
|
|
4351
4352
|
signal: i
|
|
4352
4353
|
}));
|
|
4353
4354
|
a.seenCursors.add(e);
|
|
4354
4355
|
let s = this.filterItems(o.items), c = [];
|
|
4355
4356
|
if (s.forEach((e) => {
|
|
4356
|
-
let t =
|
|
4357
|
+
let t = ei(e.postId);
|
|
4357
4358
|
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
4359
|
}), a.pages.push({
|
|
4359
4360
|
contributionIds: c,
|
|
4360
4361
|
cursor: a.cursor,
|
|
4361
4362
|
next: o.next,
|
|
4362
|
-
returnedIds:
|
|
4363
|
+
returnedIds: ni(s)
|
|
4363
4364
|
}), 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
4365
|
}
|
|
4365
4366
|
return this.result(a, "complete");
|
|
@@ -4367,9 +4368,9 @@ var ni = class {
|
|
|
4367
4368
|
createSession(e) {
|
|
4368
4369
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
4369
4370
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
4370
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
4371
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(ei))), a = new Set(e.map(({ postId: e }) => ei(e)).filter((e) => !i.has(e)));
|
|
4371
4372
|
return {
|
|
4372
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
4373
|
+
appended: new Set(e.map(({ postId: e }) => ei(e))),
|
|
4373
4374
|
attributed: new Set(a),
|
|
4374
4375
|
cursor: r.cursor,
|
|
4375
4376
|
items: [],
|
|
@@ -4394,11 +4395,11 @@ var ni = class {
|
|
|
4394
4395
|
}
|
|
4395
4396
|
findUnderfilledPage(e) {
|
|
4396
4397
|
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(
|
|
4398
|
+
let t = new Set(e.map(({ postId: e }) => ei(e)));
|
|
4399
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(ei(e))).length < this.pageSize);
|
|
4399
4400
|
}
|
|
4400
4401
|
recordPage(e) {
|
|
4401
|
-
let t =
|
|
4402
|
+
let t = ti(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ti(e) === t);
|
|
4402
4403
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
4403
4404
|
...e,
|
|
4404
4405
|
contributionIds: [...e.contributionIds],
|
|
@@ -4408,7 +4409,7 @@ var ni = class {
|
|
|
4408
4409
|
};
|
|
4409
4410
|
//#endregion
|
|
4410
4411
|
//#region src/core/activeItemRemoval.ts
|
|
4411
|
-
function
|
|
4412
|
+
function ii(e, t, n, r, i) {
|
|
4412
4413
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
4413
4414
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
4414
4415
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -4421,7 +4422,7 @@ function ri(e, t, n, r, i) {
|
|
|
4421
4422
|
}
|
|
4422
4423
|
//#endregion
|
|
4423
4424
|
//#region src/core/exactMediaRemovalController.ts
|
|
4424
|
-
function
|
|
4425
|
+
function ai(e, t) {
|
|
4425
4426
|
let [n, ...r] = t;
|
|
4426
4427
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
4427
4428
|
return {
|
|
@@ -4430,10 +4431,10 @@ function ii(e, t) {
|
|
|
4430
4431
|
items: r
|
|
4431
4432
|
};
|
|
4432
4433
|
}
|
|
4433
|
-
function
|
|
4434
|
+
function oi(e) {
|
|
4434
4435
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
4435
4436
|
}
|
|
4436
|
-
var
|
|
4437
|
+
var si = class {
|
|
4437
4438
|
generation = 0;
|
|
4438
4439
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
4439
4440
|
state;
|
|
@@ -4441,7 +4442,7 @@ var oi = class {
|
|
|
4441
4442
|
this.options = e, this.state = e.state;
|
|
4442
4443
|
}
|
|
4443
4444
|
remove(e) {
|
|
4444
|
-
|
|
4445
|
+
oi(e);
|
|
4445
4446
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
4446
4447
|
if (!n) return null;
|
|
4447
4448
|
let r = [...H(n)], i = r[e.mediaIndex];
|
|
@@ -4458,7 +4459,7 @@ var oi = class {
|
|
|
4458
4459
|
restored: !1
|
|
4459
4460
|
});
|
|
4460
4461
|
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] =
|
|
4462
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = ai(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
4463
|
}
|
|
4463
4464
|
reset() {
|
|
4464
4465
|
this.generation += 1;
|
|
@@ -4484,7 +4485,7 @@ var oi = class {
|
|
|
4484
4485
|
}
|
|
4485
4486
|
restoreIntoPost(e, t) {
|
|
4486
4487
|
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] =
|
|
4488
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = ai(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
4488
4489
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
4489
4490
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
4490
4491
|
}
|
|
@@ -4497,18 +4498,18 @@ var oi = class {
|
|
|
4497
4498
|
};
|
|
4498
4499
|
//#endregion
|
|
4499
4500
|
//#region src/core/itemPlacement.ts
|
|
4500
|
-
function
|
|
4501
|
+
function ci(e, t) {
|
|
4501
4502
|
let n = new Set(t);
|
|
4502
4503
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
4503
4504
|
index: t,
|
|
4504
4505
|
item: e
|
|
4505
4506
|
}] : []);
|
|
4506
4507
|
}
|
|
4507
|
-
function
|
|
4508
|
+
function li(e, t) {
|
|
4508
4509
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
4509
4510
|
return e.filter((e) => !n.has(e.postId));
|
|
4510
4511
|
}
|
|
4511
|
-
function
|
|
4512
|
+
function ui(e, t) {
|
|
4512
4513
|
t.forEach(({ index: e }) => {
|
|
4513
4514
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
4514
4515
|
});
|
|
@@ -4519,7 +4520,7 @@ function li(e, t) {
|
|
|
4519
4520
|
}
|
|
4520
4521
|
//#endregion
|
|
4521
4522
|
//#region src/core/itemRemovalController.ts
|
|
4522
|
-
var
|
|
4523
|
+
var di = 20, fi = class {
|
|
4523
4524
|
generation = 0;
|
|
4524
4525
|
historyLimit;
|
|
4525
4526
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -4528,7 +4529,7 @@ var ui = 20, di = class {
|
|
|
4528
4529
|
itemOrder;
|
|
4529
4530
|
stopItemsWatcher;
|
|
4530
4531
|
constructor(e) {
|
|
4531
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
4532
|
+
this.options = e, this.historyLimit = e.historyLimit ?? di, 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
4533
|
}
|
|
4533
4534
|
destroy() {
|
|
4534
4535
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -4542,7 +4543,7 @@ var ui = 20, di = class {
|
|
|
4542
4543
|
let a = this.options.startRemoval(i, t);
|
|
4543
4544
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
4544
4545
|
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 =
|
|
4546
|
+
return this.state.items = li(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
4546
4547
|
}
|
|
4547
4548
|
reset() {
|
|
4548
4549
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -4553,7 +4554,7 @@ var ui = 20, di = class {
|
|
|
4553
4554
|
this.restoreRemoval(t);
|
|
4554
4555
|
return;
|
|
4555
4556
|
}
|
|
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 =
|
|
4557
|
+
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 = ui(this.state.items, r);
|
|
4557
4558
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
4558
4559
|
}
|
|
4559
4560
|
restoreRemoval(e) {
|
|
@@ -4579,7 +4580,7 @@ var ui = 20, di = class {
|
|
|
4579
4580
|
}
|
|
4580
4581
|
collectOrderedPlacements(e) {
|
|
4581
4582
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4582
|
-
return
|
|
4583
|
+
return ci(this.state.items, e).map((e) => ({
|
|
4583
4584
|
index: t.get(e.item.postId) ?? e.index,
|
|
4584
4585
|
item: e.item
|
|
4585
4586
|
}));
|
|
@@ -4610,7 +4611,7 @@ var ui = 20, di = class {
|
|
|
4610
4611
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4611
4612
|
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
4613
|
}
|
|
4613
|
-
},
|
|
4614
|
+
}, pi = class {
|
|
4614
4615
|
forward = null;
|
|
4615
4616
|
forwardPromise = null;
|
|
4616
4617
|
forwardVersion = 0;
|
|
@@ -4638,10 +4639,10 @@ var ui = 20, di = class {
|
|
|
4638
4639
|
this.forwardVersion += 1, this.forward = null, this.forwardPromise = null, this.clearState();
|
|
4639
4640
|
}
|
|
4640
4641
|
retry() {
|
|
4641
|
-
return !this.forward || this.state.reelForward.status === "idle" ? Promise.resolve() : (this.state.nextPageError = null, this.state.reelForward = {
|
|
4642
|
+
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
4643
|
error: null,
|
|
4643
4644
|
status: "loading"
|
|
4644
|
-
}, this.startForwardRequest());
|
|
4645
|
+
}, this.startForwardRequest(!0));
|
|
4645
4646
|
}
|
|
4646
4647
|
clearState() {
|
|
4647
4648
|
this.state.reelForward = {
|
|
@@ -4649,28 +4650,28 @@ var ui = 20, di = class {
|
|
|
4649
4650
|
status: "idle"
|
|
4650
4651
|
}, this.state.reelForwardIndex = null, this.state.reelForwardItem = null;
|
|
4651
4652
|
}
|
|
4652
|
-
|
|
4653
|
-
return this.state.loadMoreLocked ? (this.state.reelOrigin === "masonry" ? (this.reset(), this.options.onCloseReel()) : this.state.reelForward = {
|
|
4653
|
+
stopAtPaginationBoundary(e) {
|
|
4654
|
+
return !this.state.loadMoreLocked && (this.state.infiniteScroll || e) ? !1 : (this.state.reelOrigin === "masonry" ? (this.reset(), this.options.onCloseReel()) : this.state.reelForward = {
|
|
4654
4655
|
error: null,
|
|
4655
4656
|
status: "end"
|
|
4656
|
-
}, !0)
|
|
4657
|
+
}, !0);
|
|
4657
4658
|
}
|
|
4658
|
-
startForwardRequest() {
|
|
4659
|
+
startForwardRequest(e = !1) {
|
|
4659
4660
|
if (this.forwardPromise) return this.forwardPromise;
|
|
4660
|
-
let
|
|
4661
|
-
return this.forwardPromise =
|
|
4662
|
-
this.forwardPromise ===
|
|
4661
|
+
let t = this.loadForward(e);
|
|
4662
|
+
return this.forwardPromise = t, t.finally(() => {
|
|
4663
|
+
this.forwardPromise === t && (this.forwardPromise = null, this.forward && this.state.reelForward.status === "loading" && this.startForwardRequest(e));
|
|
4663
4664
|
});
|
|
4664
4665
|
}
|
|
4665
|
-
async loadForward() {
|
|
4666
|
-
let
|
|
4667
|
-
if (
|
|
4668
|
-
let
|
|
4669
|
-
if (
|
|
4670
|
-
this.forward = null, this.clearState(), this.options.onActivate(
|
|
4666
|
+
async loadForward(e) {
|
|
4667
|
+
let t = this.forward;
|
|
4668
|
+
if (t) for (; this.forward === t && t.version === this.forwardVersion;) {
|
|
4669
|
+
let n = this.state.items[t.postIndex];
|
|
4670
|
+
if (n) {
|
|
4671
|
+
this.forward = null, this.clearState(), this.options.onActivate(n.postId);
|
|
4671
4672
|
return;
|
|
4672
4673
|
}
|
|
4673
|
-
if (this.
|
|
4674
|
+
if (this.stopAtPaginationBoundary(e)) return;
|
|
4674
4675
|
if (this.state.nextPageError) {
|
|
4675
4676
|
this.state.reelForward = {
|
|
4676
4677
|
error: this.state.nextPageError,
|
|
@@ -4678,10 +4679,10 @@ var ui = 20, di = class {
|
|
|
4678
4679
|
};
|
|
4679
4680
|
return;
|
|
4680
4681
|
}
|
|
4681
|
-
let
|
|
4682
|
-
if (await this.options.replenishAfterRemoval(), this.forward !==
|
|
4683
|
-
if (!this.state.items[
|
|
4684
|
-
if (this.
|
|
4682
|
+
let r = this.state.next, i = this.state.items.length;
|
|
4683
|
+
if (await this.options.replenishAfterRemoval(e), this.forward !== t || t.version !== this.forwardVersion) return;
|
|
4684
|
+
if (!this.state.items[t.postIndex]) {
|
|
4685
|
+
if (this.stopAtPaginationBoundary(e)) return;
|
|
4685
4686
|
if (this.state.nextPageError) {
|
|
4686
4687
|
this.state.reelForward = {
|
|
4687
4688
|
error: this.state.nextPageError,
|
|
@@ -4696,7 +4697,7 @@ var ui = 20, di = class {
|
|
|
4696
4697
|
};
|
|
4697
4698
|
return;
|
|
4698
4699
|
}
|
|
4699
|
-
if (this.state.next ===
|
|
4700
|
+
if (this.state.next === r && this.state.items.length === i) {
|
|
4700
4701
|
this.state.reelForward = {
|
|
4701
4702
|
error: /* @__PURE__ */ Error("Vibe could not advance while page loading is unavailable."),
|
|
4702
4703
|
status: "error"
|
|
@@ -4706,7 +4707,7 @@ var ui = 20, di = class {
|
|
|
4706
4707
|
}
|
|
4707
4708
|
}
|
|
4708
4709
|
}
|
|
4709
|
-
},
|
|
4710
|
+
}, mi = class {
|
|
4710
4711
|
generation = 0;
|
|
4711
4712
|
pending = Promise.resolve();
|
|
4712
4713
|
constructor(e) {
|
|
@@ -4756,24 +4757,24 @@ var ui = 20, di = class {
|
|
|
4756
4757
|
};
|
|
4757
4758
|
//#endregion
|
|
4758
4759
|
//#region src/core/removalControllers.ts
|
|
4759
|
-
function
|
|
4760
|
-
let t = new
|
|
4760
|
+
function hi(e) {
|
|
4761
|
+
let t = new pi(e), n = new mi({
|
|
4761
4762
|
state: e.state,
|
|
4762
4763
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4763
4764
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4764
4765
|
});
|
|
4765
4766
|
return {
|
|
4766
|
-
exactMediaRemoval: new
|
|
4767
|
+
exactMediaRemoval: new si({
|
|
4767
4768
|
onActivate: e.onActivate,
|
|
4768
4769
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4769
4770
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4770
4771
|
reelForward: t,
|
|
4771
4772
|
state: e.state
|
|
4772
4773
|
}),
|
|
4773
|
-
itemRemoval: new
|
|
4774
|
+
itemRemoval: new fi({
|
|
4774
4775
|
historyLimit: e.historyLimit,
|
|
4775
4776
|
onItemsRemoved: (n, r, i) => {
|
|
4776
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4777
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), ii(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4777
4778
|
},
|
|
4778
4779
|
onRemovalRestored: (n) => {
|
|
4779
4780
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4788,17 +4789,17 @@ function mi(e) {
|
|
|
4788
4789
|
reelRemoval: n
|
|
4789
4790
|
};
|
|
4790
4791
|
}
|
|
4791
|
-
var
|
|
4792
|
-
function
|
|
4792
|
+
var gi = 1.5;
|
|
4793
|
+
function _i(e) {
|
|
4793
4794
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4794
4795
|
if (t > 0 && t < 600) return !0;
|
|
4795
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4796
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * gi;
|
|
4796
4797
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4797
4798
|
}
|
|
4798
|
-
function _i(e) {
|
|
4799
|
-
return gi(e) ? "reel" : "masonry";
|
|
4800
|
-
}
|
|
4801
4799
|
function vi(e) {
|
|
4800
|
+
return _i(e) ? "reel" : "masonry";
|
|
4801
|
+
}
|
|
4802
|
+
function yi(e) {
|
|
4802
4803
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4803
4804
|
return {
|
|
4804
4805
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4808,15 +4809,15 @@ function vi(e) {
|
|
|
4808
4809
|
viewportWidth: n.clientWidth
|
|
4809
4810
|
};
|
|
4810
4811
|
}
|
|
4811
|
-
function yi(e) {
|
|
4812
|
-
return gi(vi(e));
|
|
4813
|
-
}
|
|
4814
4812
|
function bi(e) {
|
|
4815
|
-
return _i(
|
|
4813
|
+
return _i(yi(e));
|
|
4814
|
+
}
|
|
4815
|
+
function xi(e) {
|
|
4816
|
+
return vi(yi(e));
|
|
4816
4817
|
}
|
|
4817
4818
|
//#endregion
|
|
4818
4819
|
//#region src/core/responsiveLayoutController.ts
|
|
4819
|
-
var
|
|
4820
|
+
var Si = class {
|
|
4820
4821
|
layoutMode;
|
|
4821
4822
|
resizeObserver = null;
|
|
4822
4823
|
target = null;
|
|
@@ -4841,10 +4842,10 @@ var xi = class {
|
|
|
4841
4842
|
}
|
|
4842
4843
|
handleResponsiveLayout = () => {
|
|
4843
4844
|
if (!this.target) return;
|
|
4844
|
-
let e =
|
|
4845
|
-
this.state.phoneMode =
|
|
4845
|
+
let e = xi(this.target);
|
|
4846
|
+
this.state.phoneMode = bi(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4846
4847
|
};
|
|
4847
|
-
},
|
|
4848
|
+
}, Ci = class {
|
|
4848
4849
|
state;
|
|
4849
4850
|
constructor(e) {
|
|
4850
4851
|
this.options = e, this.state = x(Rt({
|
|
@@ -4858,7 +4859,7 @@ var xi = class {
|
|
|
4858
4859
|
set(e, t = !1) {
|
|
4859
4860
|
Object.assign(this.state, Rt(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4860
4861
|
}
|
|
4861
|
-
},
|
|
4862
|
+
}, wi = class {
|
|
4862
4863
|
routedReelPostId = null;
|
|
4863
4864
|
reelRouteIsActive = !1;
|
|
4864
4865
|
constructor(e, t) {
|
|
@@ -4888,30 +4889,30 @@ var xi = class {
|
|
|
4888
4889
|
};
|
|
4889
4890
|
//#endregion
|
|
4890
4891
|
//#region src/core/updateItems.ts
|
|
4891
|
-
function
|
|
4892
|
+
function Ti(e) {
|
|
4892
4893
|
return String(e);
|
|
4893
4894
|
}
|
|
4894
|
-
function
|
|
4895
|
+
function Ei(e, t) {
|
|
4895
4896
|
let n = H(t).length;
|
|
4896
4897
|
(e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
|
|
4897
4898
|
}
|
|
4898
|
-
function
|
|
4899
|
+
function Di(e, t) {
|
|
4899
4900
|
let n = /* @__PURE__ */ new Map();
|
|
4900
|
-
if (t.forEach((e) => n.set(
|
|
4901
|
+
if (t.forEach((e) => n.set(Ti(e.postId), e)), n.size === 0) return [];
|
|
4901
4902
|
let r = [], i = e.items.map((t) => {
|
|
4902
|
-
let i = n.get(
|
|
4903
|
+
let i = n.get(Ti(t.postId));
|
|
4903
4904
|
if (!i) return t;
|
|
4904
4905
|
let a = {
|
|
4905
4906
|
...i,
|
|
4906
4907
|
postId: t.postId
|
|
4907
4908
|
};
|
|
4908
|
-
return
|
|
4909
|
+
return Ei(e, a), e.reelForwardItem && Ti(e.reelForwardItem.postId) === Ti(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
|
|
4909
4910
|
});
|
|
4910
4911
|
return r.length > 0 && (e.items = i), r;
|
|
4911
4912
|
}
|
|
4912
4913
|
//#endregion
|
|
4913
4914
|
//#region src/core/createVibe.ts
|
|
4914
|
-
var
|
|
4915
|
+
var Oi = class {
|
|
4915
4916
|
app = null;
|
|
4916
4917
|
autoScroll;
|
|
4917
4918
|
autofillController;
|
|
@@ -4934,24 +4935,24 @@ var Di = class {
|
|
|
4934
4935
|
reelAudio;
|
|
4935
4936
|
state;
|
|
4936
4937
|
constructor(e) {
|
|
4937
|
-
this.options = e,
|
|
4938
|
+
this.options = e, Zr(e);
|
|
4938
4939
|
let t = e.layout ?? "masonry";
|
|
4939
|
-
this.state = x(
|
|
4940
|
+
this.state = x(Jr(e, t)), this.reelAudio = new Ci(e), this.lastLoadedCursor = e.initialPage ? Gn(e.initialPage) : null, this.notificationItems = K(this.state), this.autoScroll = new vr({
|
|
4940
4941
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4941
4942
|
state: this.state.autoScroll
|
|
4942
|
-
}), this.autofillController = new
|
|
4943
|
+
}), this.autofillController = new fr({
|
|
4943
4944
|
cancelRequest: () => this.cancelRequest(),
|
|
4944
4945
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4945
4946
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4946
4947
|
options: e.autofill,
|
|
4947
4948
|
state: this.state
|
|
4948
|
-
}), this.removalReconciliation = new
|
|
4949
|
+
}), this.removalReconciliation = new ri(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new zr({
|
|
4949
4950
|
fill: e.fill,
|
|
4950
4951
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4951
4952
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4952
4953
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4953
4954
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4954
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4955
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Br({
|
|
4955
4956
|
controller: this.removalReconciliation,
|
|
4956
4957
|
isCurrent: t,
|
|
4957
4958
|
loadPage: e.loadPage,
|
|
@@ -4961,31 +4962,31 @@ var Di = class {
|
|
|
4961
4962
|
state: this.state
|
|
4962
4963
|
}),
|
|
4963
4964
|
state: this.state
|
|
4964
|
-
}), this.routing = new
|
|
4965
|
-
let n =
|
|
4965
|
+
}), this.routing = new wi(e.routing, this.state);
|
|
4966
|
+
let n = hi({
|
|
4966
4967
|
historyLimit: e.removalHistoryLimit,
|
|
4967
4968
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4968
4969
|
onCloseReel: () => this.closeMasonryReel(),
|
|
4969
4970
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
4970
4971
|
onItemsRestored: (e) => this.removalReconciliation.restore(e),
|
|
4971
|
-
replenishAfterRemoval: () => this.replenishAfterRemoval(),
|
|
4972
|
+
replenishAfterRemoval: (e) => this.replenishAfterRemoval(e),
|
|
4972
4973
|
state: this.state,
|
|
4973
4974
|
surface: () => this.surface
|
|
4974
4975
|
});
|
|
4975
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
4976
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Si(t, this.state, () => {
|
|
4976
4977
|
this.routing.syncFeed();
|
|
4977
4978
|
}), this.startStateNotifications();
|
|
4978
4979
|
}
|
|
4979
4980
|
async mount() {
|
|
4980
4981
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4981
4982
|
this.startStateNotifications();
|
|
4982
|
-
let e =
|
|
4983
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4983
|
+
let e = Qr(this.options.target);
|
|
4984
|
+
this.responsiveLayout.mount(e), this.app = i(Bn, {
|
|
4984
4985
|
canRetryEnd: !!this.options.loadPage,
|
|
4985
4986
|
cardFooter: this.options.cardFooter,
|
|
4986
4987
|
cardHeader: this.options.cardHeader,
|
|
4987
4988
|
feedFooter: this.options.feedFooter,
|
|
4988
|
-
feedFooterActions:
|
|
4989
|
+
feedFooterActions: Vr(this),
|
|
4989
4990
|
mediaCard: this.options.mediaCard,
|
|
4990
4991
|
masonry: this.options.masonry,
|
|
4991
4992
|
onMediaFullyVisible: this.options.onMediaFullyVisible,
|
|
@@ -5011,7 +5012,7 @@ var Di = class {
|
|
|
5011
5012
|
onRetryForward: () => {
|
|
5012
5013
|
this.retryReelForward();
|
|
5013
5014
|
}
|
|
5014
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
5015
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await Cr(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
5015
5016
|
this.restoreController = e;
|
|
5016
5017
|
}), !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
5018
|
}
|
|
@@ -5046,7 +5047,7 @@ var Di = class {
|
|
|
5046
5047
|
return this.itemRemoval.restoreRemoval(e);
|
|
5047
5048
|
}
|
|
5048
5049
|
updateItems(e) {
|
|
5049
|
-
return
|
|
5050
|
+
return Di(this.state, e);
|
|
5050
5051
|
}
|
|
5051
5052
|
retryReelForward() {
|
|
5052
5053
|
return this.reelForward.retry();
|
|
@@ -5085,7 +5086,7 @@ var Di = class {
|
|
|
5085
5086
|
this.autoScroll.setSpeed(e);
|
|
5086
5087
|
}
|
|
5087
5088
|
applyAutofillUpdate(e) {
|
|
5088
|
-
let t =
|
|
5089
|
+
let t = xr(this.options.autofill, this.state, e);
|
|
5089
5090
|
return t && this.autofillController.syncCountdown(), t;
|
|
5090
5091
|
}
|
|
5091
5092
|
cancelAutofill() {
|
|
@@ -5096,7 +5097,7 @@ var Di = class {
|
|
|
5096
5097
|
await this.cancelFill();
|
|
5097
5098
|
return;
|
|
5098
5099
|
}
|
|
5099
|
-
if (
|
|
5100
|
+
if (cr(this.state.autofill)) {
|
|
5100
5101
|
await this.cancelAutofill();
|
|
5101
5102
|
return;
|
|
5102
5103
|
}
|
|
@@ -5110,12 +5111,12 @@ var Di = class {
|
|
|
5110
5111
|
}
|
|
5111
5112
|
async fill(e) {
|
|
5112
5113
|
if (!this.state.loadMoreLocked) {
|
|
5113
|
-
if (this.pendingRequest ||
|
|
5114
|
+
if (this.pendingRequest || cr(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
5114
5115
|
await this.fillController.start(e);
|
|
5115
5116
|
}
|
|
5116
5117
|
}
|
|
5117
5118
|
restoreAutofillSession(e) {
|
|
5118
|
-
let t =
|
|
5119
|
+
let t = Sr(this.options.autofill, this.state, e);
|
|
5119
5120
|
return t && this.autofillController.syncCountdown(), t;
|
|
5120
5121
|
}
|
|
5121
5122
|
restoreFillSession(e) {
|
|
@@ -5125,14 +5126,14 @@ var Di = class {
|
|
|
5125
5126
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
5126
5127
|
}
|
|
5127
5128
|
appendPage(e) {
|
|
5128
|
-
|
|
5129
|
+
Kn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
5129
5130
|
}
|
|
5130
|
-
replenishAfterRemoval() {
|
|
5131
|
-
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
5131
|
+
replenishAfterRemoval(e = !0) {
|
|
5132
|
+
return this.startLoadMore(() => this.replenishAfterRemovalSequence(e));
|
|
5132
5133
|
}
|
|
5133
5134
|
async startLoadMore(e) {
|
|
5134
5135
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5135
|
-
if (this.state.loadMoreLocked ||
|
|
5136
|
+
if (this.state.loadMoreLocked || cr(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
5136
5137
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
5137
5138
|
let t = e();
|
|
5138
5139
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -5147,49 +5148,51 @@ var Di = class {
|
|
|
5147
5148
|
}
|
|
5148
5149
|
async replaceFeed(e, t) {
|
|
5149
5150
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
5150
|
-
return
|
|
5151
|
+
return cr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = sr(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), 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);
|
|
5151
5152
|
}
|
|
5152
5153
|
async loadFilteredPage(e) {
|
|
5153
5154
|
let t = this.options.loadPage;
|
|
5154
5155
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
5155
|
-
let n =
|
|
5156
|
+
let n = Vn(await t(e));
|
|
5156
5157
|
return {
|
|
5157
5158
|
...n,
|
|
5158
5159
|
items: this.removalReconciliation.filterItems(n.items)
|
|
5159
5160
|
};
|
|
5160
5161
|
}
|
|
5161
5162
|
async loadNextSequence() {
|
|
5162
|
-
this.removalReconciliation.needsReconciliation(this.state.items) && !await this.reconcileBeforeNext() || this.state.loadMoreLocked || this.state.next
|
|
5163
|
+
this.removalReconciliation.needsReconciliation(this.state.items) && !await this.reconcileBeforeNext() || this.state.loadMoreLocked || this.state.next === null || await this.fetchPage(this.state.next, !0);
|
|
5163
5164
|
}
|
|
5164
|
-
async replenishAfterRemovalSequence() {
|
|
5165
|
-
|
|
5166
|
-
|
|
5165
|
+
async replenishAfterRemovalSequence(e) {
|
|
5166
|
+
if (!e && !this.state.infiniteScroll) return;
|
|
5167
|
+
let t = this.state.items.length;
|
|
5168
|
+
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
5169
|
}
|
|
5168
|
-
async reconcileBeforeNext() {
|
|
5169
|
-
let
|
|
5170
|
-
if (!
|
|
5171
|
-
let
|
|
5172
|
-
this.abortController =
|
|
5170
|
+
async reconcileBeforeNext(e = !1) {
|
|
5171
|
+
let t = this.options.loadPage;
|
|
5172
|
+
if (!t) return !1;
|
|
5173
|
+
let n = ++this.requestVersion, r = new AbortController();
|
|
5174
|
+
this.abortController = r;
|
|
5173
5175
|
try {
|
|
5174
|
-
let
|
|
5176
|
+
let i = await Br({
|
|
5175
5177
|
controller: this.removalReconciliation,
|
|
5176
|
-
isCurrent: () =>
|
|
5177
|
-
loadPage:
|
|
5178
|
+
isCurrent: () => n === this.requestVersion,
|
|
5179
|
+
loadPage: t,
|
|
5178
5180
|
onDelayChange: () => void 0,
|
|
5181
|
+
pauseWhenManual: e,
|
|
5179
5182
|
setLastCursor: (e) => this.setCurrentCursor(e),
|
|
5180
|
-
signal:
|
|
5183
|
+
signal: r.signal,
|
|
5181
5184
|
state: this.state
|
|
5182
5185
|
});
|
|
5183
|
-
return
|
|
5186
|
+
return n === this.requestVersion && i === "complete" && (this.state.nextPageError = null), n === this.requestVersion && i === "complete";
|
|
5184
5187
|
} catch (e) {
|
|
5185
|
-
return !
|
|
5188
|
+
return !r.signal.aborted && n === this.requestVersion && (this.state.nextPageError = e), !1;
|
|
5186
5189
|
} finally {
|
|
5187
|
-
this.abortController ===
|
|
5190
|
+
this.abortController === r && (this.abortController = null);
|
|
5188
5191
|
}
|
|
5189
5192
|
}
|
|
5190
5193
|
async retryEnd() {
|
|
5191
5194
|
if (this.pendingRequest) return this.pendingRequest;
|
|
5192
|
-
if (!this.state.loadMoreLocked && !(
|
|
5195
|
+
if (!this.state.loadMoreLocked && !(cr(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);
|
|
5193
5196
|
}
|
|
5194
5197
|
setInfiniteScroll(e) {
|
|
5195
5198
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -5213,10 +5216,10 @@ var Di = class {
|
|
|
5213
5216
|
this.state.total = e;
|
|
5214
5217
|
}
|
|
5215
5218
|
setReelAutoAdvance(e) {
|
|
5216
|
-
|
|
5219
|
+
Gr(this.state.reelAutoAdvance, e);
|
|
5217
5220
|
}
|
|
5218
5221
|
setReelInfoSheet(e) {
|
|
5219
|
-
|
|
5222
|
+
qr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
5220
5223
|
}
|
|
5221
5224
|
setLayout(e) {
|
|
5222
5225
|
this.responsiveLayout.setLayout(e);
|
|
@@ -5236,7 +5239,7 @@ var Di = class {
|
|
|
5236
5239
|
async fetchPage(e, t) {
|
|
5237
5240
|
if (!this.options.loadPage) return;
|
|
5238
5241
|
let n = ++this.requestVersion, r = new AbortController();
|
|
5239
|
-
this.abortController = r, await
|
|
5242
|
+
this.abortController = r, await $r({
|
|
5240
5243
|
append: t,
|
|
5241
5244
|
autofillController: this.autofillController,
|
|
5242
5245
|
cursor: e,
|
|
@@ -5258,7 +5261,7 @@ var Di = class {
|
|
|
5258
5261
|
startInitialAutofill() {
|
|
5259
5262
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
5260
5263
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
5261
|
-
let r =
|
|
5264
|
+
let r = wr({
|
|
5262
5265
|
cycleId: n,
|
|
5263
5266
|
isCurrent: () => e === this.requestVersion,
|
|
5264
5267
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -5281,6 +5284,6 @@ var Di = class {
|
|
|
5281
5284
|
setCurrentCursor(e) {
|
|
5282
5285
|
this.lastLoadedCursor = e, this.state.current = e;
|
|
5283
5286
|
}
|
|
5284
|
-
},
|
|
5287
|
+
}, ki = (e) => new Oi(e);
|
|
5285
5288
|
//#endregion
|
|
5286
|
-
export {
|
|
5289
|
+
export { ki as createVibe };
|