@wyxos/vibe 5.8.2 → 5.8.3
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/README.md +7 -0
- package/lib/components/MediaCard.vue.d.ts +1 -0
- package/lib/components/useMediaLoading.d.ts +1 -1
- package/lib/components/useVisiblePostPreload.d.ts +12 -0
- package/lib/core/mediaCardOptions.d.ts +1 -0
- package/lib/core/visiblePostPreload.d.ts +22 -0
- package/lib/index.cjs +2 -1
- package/lib/index.js +415 -305
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -820,8 +820,117 @@ function Qe(e) {
|
|
|
820
820
|
};
|
|
821
821
|
}
|
|
822
822
|
//#endregion
|
|
823
|
+
//#region src/core/mediaType.ts
|
|
824
|
+
var $e = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
825
|
+
function et(e) {
|
|
826
|
+
try {
|
|
827
|
+
return $e.test(new URL(e).pathname);
|
|
828
|
+
} catch {
|
|
829
|
+
return $e.test(e.split("?")[0] ?? e);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
function tt(e, t) {
|
|
833
|
+
return e === void 0 ? et(t) : e === "video";
|
|
834
|
+
}
|
|
835
|
+
var nt = /* @__PURE__ */ new Map(), rt = [], it = 0, at = 0;
|
|
836
|
+
function ot(e, t) {
|
|
837
|
+
return `${t ? "timed" : "image"}:${e}`;
|
|
838
|
+
}
|
|
839
|
+
function st(e, t, n) {
|
|
840
|
+
let r = P(e);
|
|
841
|
+
if (r.length < 2) return [];
|
|
842
|
+
let i = F(e, t), a = [];
|
|
843
|
+
for (let e = 1; e < r.length; e += 1) {
|
|
844
|
+
let t = i + e, n = i - e;
|
|
845
|
+
t < r.length && a.push(t), n >= 0 && a.push(n);
|
|
846
|
+
}
|
|
847
|
+
let o = /* @__PURE__ */ new Set();
|
|
848
|
+
return a.flatMap((e) => {
|
|
849
|
+
let t = r[e];
|
|
850
|
+
if (!t) return [];
|
|
851
|
+
let i = N(t, n), a = tt(i.type, i.src), s = ot(i.src, a);
|
|
852
|
+
return o.has(s) ? [] : (o.add(s), [{
|
|
853
|
+
key: s,
|
|
854
|
+
src: i.src,
|
|
855
|
+
timed: a
|
|
856
|
+
}]);
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
function ct(e) {
|
|
860
|
+
let t = e.element;
|
|
861
|
+
e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
|
|
862
|
+
}
|
|
863
|
+
function lt(e) {
|
|
864
|
+
nt.delete(e.key);
|
|
865
|
+
let t = rt.indexOf(e);
|
|
866
|
+
t >= 0 && rt.splice(t, 1), e.cancel?.(), e.cancel = null, ct(e);
|
|
867
|
+
}
|
|
868
|
+
function ut(e) {
|
|
869
|
+
e.state = "loading", it += 1, e.timed && (at += 1);
|
|
870
|
+
let t = !1, n = () => void 0, r = (r) => {
|
|
871
|
+
t || (t = !0, n(), --it, e.timed && --at, e.cancel = null, e.state = r, r === "failed" && ct(e), e.refs === 0 && lt(e), dt());
|
|
872
|
+
};
|
|
873
|
+
if (e.cancel = () => {
|
|
874
|
+
t || (t = !0, n(), --it, e.timed && --at, ct(e), dt());
|
|
875
|
+
}, e.timed) {
|
|
876
|
+
let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
|
|
877
|
+
n = () => {
|
|
878
|
+
t.removeEventListener("loadedmetadata", i), t.removeEventListener("error", a);
|
|
879
|
+
}, t.addEventListener("loadedmetadata", i, { once: !0 }), t.addEventListener("error", a, { once: !0 }), t.muted = !0, t.playsInline = !0, t.preload = "metadata", t.src = e.src, e.element = t, t.load();
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
let i = document.createElement("img"), a = () => {
|
|
883
|
+
if (typeof i.decode != "function") {
|
|
884
|
+
r("ready");
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
i.decode().then(() => r("ready"), () => r("failed"));
|
|
888
|
+
}, o = () => r("failed");
|
|
889
|
+
n = () => {
|
|
890
|
+
i.removeEventListener("load", a), i.removeEventListener("error", o);
|
|
891
|
+
}, i.addEventListener("load", a, { once: !0 }), i.addEventListener("error", o, { once: !0 }), i.decoding = "async", i.fetchPriority = "low", i.src = e.src, e.element = i;
|
|
892
|
+
}
|
|
893
|
+
function dt() {
|
|
894
|
+
for (; it < 6;) {
|
|
895
|
+
let e = rt.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || at < 2));
|
|
896
|
+
if (e < 0) return;
|
|
897
|
+
let [t] = rt.splice(e, 1);
|
|
898
|
+
t && ut(t);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
function ft(e) {
|
|
902
|
+
let t = nt.get(e.key);
|
|
903
|
+
t || (t = {
|
|
904
|
+
...e,
|
|
905
|
+
cancel: null,
|
|
906
|
+
element: null,
|
|
907
|
+
refs: 0,
|
|
908
|
+
state: "queued"
|
|
909
|
+
}, nt.set(t.key, t), rt.push(t)), t.refs += 1, dt();
|
|
910
|
+
let n = !1;
|
|
911
|
+
return () => {
|
|
912
|
+
n || (n = !0, --t.refs, t.refs === 0 && lt(t));
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
//#endregion
|
|
916
|
+
//#region src/components/useVisiblePostPreload.ts
|
|
917
|
+
function pt(e) {
|
|
918
|
+
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? st(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
|
|
919
|
+
function a() {
|
|
920
|
+
let e = new Map(n.value.map((e) => [e.key, e]));
|
|
921
|
+
i.forEach((t, n) => {
|
|
922
|
+
e.has(n) || (t(), i.delete(n));
|
|
923
|
+
}), n.value.forEach((e) => {
|
|
924
|
+
i.has(e.key) || i.set(e.key, ft(e));
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
O(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), v(() => {
|
|
928
|
+
i.forEach((e) => e()), i.clear();
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
//#endregion
|
|
823
932
|
//#region src/components/useReelVideoActivity.ts
|
|
824
|
-
function
|
|
933
|
+
function mt(e) {
|
|
825
934
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
826
935
|
function i() {
|
|
827
936
|
if (!t.value) {
|
|
@@ -854,22 +963,9 @@ function $e(e) {
|
|
|
854
963
|
};
|
|
855
964
|
}
|
|
856
965
|
//#endregion
|
|
857
|
-
//#region src/core/mediaType.ts
|
|
858
|
-
var et = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
859
|
-
function tt(e) {
|
|
860
|
-
try {
|
|
861
|
-
return et.test(new URL(e).pathname);
|
|
862
|
-
} catch {
|
|
863
|
-
return et.test(e.split("?")[0] ?? e);
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
function nt(e, t) {
|
|
867
|
-
return e === void 0 ? tt(t) : e === "video";
|
|
868
|
-
}
|
|
869
|
-
//#endregion
|
|
870
966
|
//#region src/components/useMediaLoading.ts
|
|
871
|
-
function
|
|
872
|
-
let t = r(() =>
|
|
967
|
+
function ht(e) {
|
|
968
|
+
let t = r(() => tt(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
|
|
873
969
|
return O(i, (t, n) => {
|
|
874
970
|
n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
|
|
875
971
|
}), {
|
|
@@ -880,7 +976,7 @@ function rt(e) {
|
|
|
880
976
|
}
|
|
881
977
|
//#endregion
|
|
882
978
|
//#region src/components/useMediaReadiness.ts
|
|
883
|
-
function
|
|
979
|
+
function gt(e) {
|
|
884
980
|
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
885
981
|
function f() {
|
|
886
982
|
l !== null && clearTimeout(l), l = null;
|
|
@@ -938,7 +1034,7 @@ function it(e) {
|
|
|
938
1034
|
}
|
|
939
1035
|
//#endregion
|
|
940
1036
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
941
|
-
var
|
|
1037
|
+
var _t = [
|
|
942
1038
|
"data-post-id",
|
|
943
1039
|
"data-media-index",
|
|
944
1040
|
"aria-hidden",
|
|
@@ -946,12 +1042,12 @@ var at = [
|
|
|
946
1042
|
"inert",
|
|
947
1043
|
"role",
|
|
948
1044
|
"tabindex"
|
|
949
|
-
],
|
|
1045
|
+
], vt = { class: "media-card-content" }, yt = ["data-media-direction"], bt = ["data-media-index"], xt = {
|
|
950
1046
|
key: 0,
|
|
951
1047
|
"data-test": "media-loading",
|
|
952
1048
|
class: "media-loading",
|
|
953
1049
|
"aria-hidden": "true"
|
|
954
|
-
},
|
|
1050
|
+
}, St = [
|
|
955
1051
|
"data-source-generation",
|
|
956
1052
|
"src",
|
|
957
1053
|
"width",
|
|
@@ -960,14 +1056,14 @@ var at = [
|
|
|
960
1056
|
"loop",
|
|
961
1057
|
"muted",
|
|
962
1058
|
"preload"
|
|
963
|
-
],
|
|
1059
|
+
], Ct = [
|
|
964
1060
|
"data-source-generation",
|
|
965
1061
|
"src",
|
|
966
1062
|
"width",
|
|
967
1063
|
"height",
|
|
968
1064
|
"fetchpriority",
|
|
969
1065
|
"loading"
|
|
970
|
-
],
|
|
1066
|
+
], wt = ["aria-label"], Tt = ["aria-label"], Et = ["aria-label"], Dt = 40, Ot = 160, kt = 24, At = /* @__PURE__ */ d({
|
|
971
1067
|
__name: "MediaCard",
|
|
972
1068
|
props: {
|
|
973
1069
|
active: { type: Boolean },
|
|
@@ -976,6 +1072,7 @@ var at = [
|
|
|
976
1072
|
cardHeader: {},
|
|
977
1073
|
entering: { type: Boolean },
|
|
978
1074
|
fetchPriority: {},
|
|
1075
|
+
inViewport: { type: Boolean },
|
|
979
1076
|
index: {},
|
|
980
1077
|
item: {},
|
|
981
1078
|
itemStyle: {},
|
|
@@ -1005,20 +1102,30 @@ var at = [
|
|
|
1005
1102
|
function S(e = !1, t = "pointer") {
|
|
1006
1103
|
e && x("activate", t);
|
|
1007
1104
|
}
|
|
1008
|
-
let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: H, markSourceReady: U, noteSourceActivity: W, retrySource: ee, retrying: te, sourceGeneration: G, videoElement: K } =
|
|
1105
|
+
let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: H, markSourceReady: U, noteSourceActivity: W, retrySource: ee, retrying: te, sourceGeneration: G, videoElement: K } = gt({
|
|
1009
1106
|
identity: () => `${l.item.postId}:${T.value}:${l.mediaSource ?? "preview"}:${M.value}:${L.value ?? ""}`,
|
|
1010
1107
|
mediaIndex: () => T.value,
|
|
1011
1108
|
onError: (e) => x("error", e),
|
|
1012
1109
|
onReady: (e) => x("ready", e),
|
|
1013
1110
|
previewState: () => l.previewState
|
|
1014
|
-
})
|
|
1111
|
+
});
|
|
1112
|
+
pt({
|
|
1113
|
+
inViewport: () => l.inViewport === !0,
|
|
1114
|
+
item: () => l.item,
|
|
1115
|
+
layout: () => l.layout,
|
|
1116
|
+
mediaCard: () => l.mediaCard,
|
|
1117
|
+
mediaIndex: () => T.value,
|
|
1118
|
+
mediaReady: () => B.value === "ready",
|
|
1119
|
+
mediaSource: () => l.mediaSource ?? "preview"
|
|
1120
|
+
});
|
|
1121
|
+
let ne = w(0), re = w(0), q = w(!1), { apply: ie, setVolume: ae, sync: oe, toggleMute: se, videoIsMuted: J, videoVolume: ce } = Qe({
|
|
1015
1122
|
active: () => l.active,
|
|
1016
1123
|
layout: () => l.layout,
|
|
1017
1124
|
mediaCard: () => l.mediaCard,
|
|
1018
1125
|
onChange: (e) => x("reelAudioChange", e),
|
|
1019
1126
|
reelAudioState: () => l.reelAudioState,
|
|
1020
1127
|
videoElement: K
|
|
1021
|
-
}), { effectiveMuted: le, onPlaying: ue, playbackAllowed: de } =
|
|
1128
|
+
}), { effectiveMuted: le, onPlaying: ue, playbackAllowed: de } = mt({
|
|
1022
1129
|
active: () => l.active,
|
|
1023
1130
|
layout: () => l.layout,
|
|
1024
1131
|
videoElement: K,
|
|
@@ -1039,12 +1146,12 @@ var at = [
|
|
|
1039
1146
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
1040
1147
|
}
|
|
1041
1148
|
function he() {
|
|
1042
|
-
d !== null && clearTimeout(d), d = setTimeout(me,
|
|
1149
|
+
d !== null && clearTimeout(d), d = setTimeout(me, Ot);
|
|
1043
1150
|
}
|
|
1044
1151
|
function ge(e) {
|
|
1045
1152
|
if (C.value.length <= 1) return;
|
|
1046
1153
|
let t = e.currentTarget?.clientWidth || 1, n = pe(e.deltaX, e.deltaMode, t);
|
|
1047
|
-
if (n === 0 || (e.preventDefault(), he(), p) || (f += n, Math.abs(f) <
|
|
1154
|
+
if (n === 0 || (e.preventDefault(), he(), p) || (f += n, Math.abs(f) < kt)) return;
|
|
1048
1155
|
let r = Math.sign(f);
|
|
1049
1156
|
f = 0, p = !0, X(T.value + r);
|
|
1050
1157
|
}
|
|
@@ -1056,9 +1163,9 @@ var at = [
|
|
|
1056
1163
|
let t = e.changedTouches[0];
|
|
1057
1164
|
if (m === null || g === null || !t) return;
|
|
1058
1165
|
let n = m - t.clientX, r = g - t.clientY;
|
|
1059
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
1166
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Dt || X(T.value + Math.sign(n)));
|
|
1060
1167
|
}
|
|
1061
|
-
let { imageLoading: ye, mediaIsTimed: be, videoPreload: xe } =
|
|
1168
|
+
let { imageLoading: ye, mediaIsTimed: be, videoPreload: xe } = ht({
|
|
1062
1169
|
active: () => l.active,
|
|
1063
1170
|
fetchPriority: () => l.fetchPriority,
|
|
1064
1171
|
layout: () => l.layout,
|
|
@@ -1118,7 +1225,7 @@ var at = [
|
|
|
1118
1225
|
tabindex: e.interactive && !e.leaving && !Y.value ? 0 : void 0,
|
|
1119
1226
|
onClick: i[14] ||= (t) => S(e.interactive && !Y.value, fe(t)),
|
|
1120
1227
|
onKeydown: [i[15] ||= A((t) => S(e.interactive && !Y.value, "keyboard"), ["enter"]), i[16] ||= A(j((t) => S(e.interactive && !Y.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1121
|
-
}, [c("div",
|
|
1228
|
+
}, [c("div", vt, [
|
|
1122
1229
|
e.cardHeader ? (b(), a(Ie, {
|
|
1123
1230
|
key: 0,
|
|
1124
1231
|
index: e.index,
|
|
@@ -1157,7 +1264,7 @@ var at = [
|
|
|
1157
1264
|
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(G)}`,
|
|
1158
1265
|
class: "media-card-frame",
|
|
1159
1266
|
"data-media-index": T.value
|
|
1160
|
-
}, [E(B) === "loading" ? (b(), s("div",
|
|
1267
|
+
}, [E(B) === "loading" ? (b(), s("div", xt, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Be, {
|
|
1161
1268
|
key: 1,
|
|
1162
1269
|
component: e.mediaCard?.error?.component,
|
|
1163
1270
|
label: E(Fe)(M.value),
|
|
@@ -1199,7 +1306,7 @@ var at = [
|
|
|
1199
1306
|
onEnded: Me,
|
|
1200
1307
|
onClick: Te,
|
|
1201
1308
|
onError: i[5] ||= (...e) => E(V) && E(V)(...e)
|
|
1202
|
-
}, null, 42,
|
|
1309
|
+
}, null, 42, St)) : (b(), s("img", {
|
|
1203
1310
|
key: 3,
|
|
1204
1311
|
ref_key: "imageElement",
|
|
1205
1312
|
ref: H,
|
|
@@ -1214,7 +1321,7 @@ var at = [
|
|
|
1214
1321
|
loading: E(ye),
|
|
1215
1322
|
onLoad: i[6] ||= (...e) => E(U) && E(U)(...e),
|
|
1216
1323
|
onError: i[7] ||= (...e) => E(V) && E(V)(...e)
|
|
1217
|
-
}, null, 42,
|
|
1324
|
+
}, null, 42, Ct))], 8, bt))]),
|
|
1218
1325
|
_: 1
|
|
1219
1326
|
}, 8, ["css", "name"]),
|
|
1220
1327
|
(b(), a(t, {
|
|
@@ -1260,13 +1367,13 @@ var at = [
|
|
|
1260
1367
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1261
1368
|
onClick: i[8] ||= j((e) => X(T.value - 1, e), ["stop"]),
|
|
1262
1369
|
onKeydown: i[9] ||= j(() => {}, ["stop"])
|
|
1263
|
-
}, [u(E(De), { size: 20 })], 40,
|
|
1370
|
+
}, [u(E(De), { size: 20 })], 40, wt), c("button", {
|
|
1264
1371
|
type: "button",
|
|
1265
1372
|
class: "media-carousel-control media-carousel-control--next",
|
|
1266
1373
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1267
1374
|
onClick: i[10] ||= j((e) => X(T.value + 1, e), ["stop"]),
|
|
1268
1375
|
onKeydown: i[11] ||= j(() => {}, ["stop"])
|
|
1269
|
-
}, [u(E(Oe), { size: 20 })], 40,
|
|
1376
|
+
}, [u(E(Oe), { size: 20 })], 40, Tt)], 2)) : o("", !0),
|
|
1270
1377
|
Y.value ? (b(), s("button", {
|
|
1271
1378
|
key: 1,
|
|
1272
1379
|
class: "media-card-activator",
|
|
@@ -1274,8 +1381,8 @@ var at = [
|
|
|
1274
1381
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1275
1382
|
onClick: i[12] ||= j((e) => r.$emit("activate", fe(e)), ["stop"]),
|
|
1276
1383
|
onKeydown: i[13] ||= j(() => {}, ["stop"])
|
|
1277
|
-
}, null, 40,
|
|
1278
|
-
], 42,
|
|
1384
|
+
}, null, 40, Et)) : o("", !0)
|
|
1385
|
+
], 42, yt),
|
|
1279
1386
|
e.cardFooter ? (b(), a(Ie, {
|
|
1280
1387
|
key: 1,
|
|
1281
1388
|
index: e.index,
|
|
@@ -1299,12 +1406,12 @@ var at = [
|
|
|
1299
1406
|
"style",
|
|
1300
1407
|
"total"
|
|
1301
1408
|
])) : o("", !0)
|
|
1302
|
-
])], 46,
|
|
1409
|
+
])], 46, _t));
|
|
1303
1410
|
}
|
|
1304
|
-
}),
|
|
1411
|
+
}), jt = { class: "masonry-feed-shell" }, Mt = ["aria-hidden", "inert"], Nt = {
|
|
1305
1412
|
key: 0,
|
|
1306
1413
|
class: "masonry-feed-status-overlay"
|
|
1307
|
-
},
|
|
1414
|
+
}, Pt = 6, Ft = 12, It = 250, Lt = /* @__PURE__ */ d({
|
|
1308
1415
|
__name: "MasonryFeed",
|
|
1309
1416
|
props: {
|
|
1310
1417
|
enteringPostIds: {},
|
|
@@ -1341,7 +1448,7 @@ var at = [
|
|
|
1341
1448
|
"visible"
|
|
1342
1449
|
],
|
|
1343
1450
|
setup(t, { expose: n, emit: i }) {
|
|
1344
|
-
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(
|
|
1451
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(Pt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, R = r(() => oe(d.items, y.value, {
|
|
1345
1452
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1346
1453
|
gap: x.value,
|
|
1347
1454
|
minColumnWidth: le(d.masonry)
|
|
@@ -1452,7 +1559,7 @@ var at = [
|
|
|
1452
1559
|
}
|
|
1453
1560
|
function pe(e) {
|
|
1454
1561
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1455
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
1562
|
+
y.value = e.clientWidth, x.value = Math.min(Ft, Math.max(Pt, t * .0075)), X();
|
|
1456
1563
|
}
|
|
1457
1564
|
function me(e) {
|
|
1458
1565
|
let t = e.currentTarget;
|
|
@@ -1463,7 +1570,7 @@ var at = [
|
|
|
1463
1570
|
Date.now() >= l && !d.loadMoreLocked && e && re(e) && f("loadMore");
|
|
1464
1571
|
}
|
|
1465
1572
|
O(() => d.items.length, (e, t) => {
|
|
1466
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1573
|
+
e > 0 && e < t && (l = Date.now() + It);
|
|
1467
1574
|
});
|
|
1468
1575
|
function ge() {
|
|
1469
1576
|
return p.value;
|
|
@@ -1486,7 +1593,7 @@ var at = [
|
|
|
1486
1593
|
}), n({
|
|
1487
1594
|
getScrollElement: ge,
|
|
1488
1595
|
loadIfNearBottom: he
|
|
1489
|
-
}), (n, r) => (b(), s("div",
|
|
1596
|
+
}), (n, r) => (b(), s("div", jt, [
|
|
1490
1597
|
c("main", {
|
|
1491
1598
|
id: m,
|
|
1492
1599
|
ref_key: "galleryElement",
|
|
@@ -1502,7 +1609,7 @@ var at = [
|
|
|
1502
1609
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
1503
1610
|
style: _(W.value),
|
|
1504
1611
|
"aria-label": "Media gallery"
|
|
1505
|
-
}, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1612
|
+
}, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(At, {
|
|
1506
1613
|
key: n.postId,
|
|
1507
1614
|
class: "masonry-item",
|
|
1508
1615
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1511,6 +1618,7 @@ var at = [
|
|
|
1511
1618
|
"card-footer": t.cardFooter,
|
|
1512
1619
|
"card-header": t.cardHeader,
|
|
1513
1620
|
"media-card": t.mediaCard,
|
|
1621
|
+
"in-viewport": G.value.has(r),
|
|
1514
1622
|
index: r,
|
|
1515
1623
|
item: n,
|
|
1516
1624
|
"item-style": fe(r),
|
|
@@ -1531,6 +1639,7 @@ var at = [
|
|
|
1531
1639
|
"card-footer",
|
|
1532
1640
|
"card-header",
|
|
1533
1641
|
"media-card",
|
|
1642
|
+
"in-viewport",
|
|
1534
1643
|
"index",
|
|
1535
1644
|
"item",
|
|
1536
1645
|
"item-style",
|
|
@@ -1542,8 +1651,8 @@ var at = [
|
|
|
1542
1651
|
"onMediaChange",
|
|
1543
1652
|
"onReady",
|
|
1544
1653
|
"onError"
|
|
1545
|
-
]))), 128))], 6)], 42,
|
|
1546
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ee.value || !t.hasNext && t.canRetryEnd ? (b(), s("div",
|
|
1654
|
+
]))), 128))], 6)], 42, Mt),
|
|
1655
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ee.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", Nt, [u(te, {
|
|
1547
1656
|
actions: t.feedFooterActions,
|
|
1548
1657
|
"can-retry-end": t.canRetryEnd,
|
|
1549
1658
|
"feed-footer": t.feedFooter,
|
|
@@ -1578,8 +1687,8 @@ var at = [
|
|
|
1578
1687
|
])
|
|
1579
1688
|
]));
|
|
1580
1689
|
}
|
|
1581
|
-
}),
|
|
1582
|
-
function
|
|
1690
|
+
}), Rt = 300;
|
|
1691
|
+
function zt(e, t, n) {
|
|
1583
1692
|
let r = e.scrollTop;
|
|
1584
1693
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1585
1694
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1587,7 +1696,7 @@ function Dt(e, t, n) {
|
|
|
1587
1696
|
return new Promise((n) => {
|
|
1588
1697
|
let o = (s) => {
|
|
1589
1698
|
a += 1;
|
|
1590
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1699
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / Rt), u = 1 - (1 - l) ** 3;
|
|
1591
1700
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1592
1701
|
requestAnimationFrame(o);
|
|
1593
1702
|
return;
|
|
@@ -1599,7 +1708,7 @@ function Dt(e, t, n) {
|
|
|
1599
1708
|
}
|
|
1600
1709
|
//#endregion
|
|
1601
1710
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1602
|
-
var
|
|
1711
|
+
var Bt = ["aria-label"], Vt = /* @__PURE__ */ d({
|
|
1603
1712
|
__name: "ReelAutoAdvanceProgress",
|
|
1604
1713
|
props: {
|
|
1605
1714
|
durationMs: {},
|
|
@@ -1617,9 +1726,9 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1617
1726
|
class: "reel-auto-advance-progress",
|
|
1618
1727
|
style: _(a.value),
|
|
1619
1728
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1620
|
-
}, null, 36)], 8,
|
|
1729
|
+
}, null, 36)], 8, Bt));
|
|
1621
1730
|
}
|
|
1622
|
-
}),
|
|
1731
|
+
}), Ht = { class: "reel-viewport" }, Ut = ["data-active-post-id", "data-active-media-index"], Wt = ["role", "data-status"], Gt = 300, Kt = 250, qt = /* @__PURE__ */ d({
|
|
1623
1732
|
__name: "ReelFeed",
|
|
1624
1733
|
props: {
|
|
1625
1734
|
initialPostId: {},
|
|
@@ -1671,7 +1780,7 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1671
1780
|
}), H = r(() => {
|
|
1672
1781
|
let e = z.value;
|
|
1673
1782
|
return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
|
|
1674
|
-
}), U = r(() => B.value ? I(B.value, V.value) : null), W = r(() => U.value ? N(U.value, u.mediaSource ?? "preview") : null), ee = r(() => H.value === "ready" && !!(W.value &&
|
|
1783
|
+
}), U = r(() => B.value ? I(B.value, V.value) : null), W = r(() => U.value ? N(U.value, u.mediaSource ?? "preview") : null), ee = r(() => H.value === "ready" && !!(W.value && tt(W.value.type, W.value.src))), G = r(() => [
|
|
1675
1784
|
z.value,
|
|
1676
1785
|
V.value,
|
|
1677
1786
|
u.items.length,
|
|
@@ -1722,7 +1831,7 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1722
1831
|
Date.now() >= l && !u.loadMoreLocked && e && re(e) && d("loadMore");
|
|
1723
1832
|
}
|
|
1724
1833
|
O(() => u.items.length, (e, t) => {
|
|
1725
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1834
|
+
e > 0 && e < t && (l = Date.now() + Kt);
|
|
1726
1835
|
});
|
|
1727
1836
|
function Y(e) {
|
|
1728
1837
|
let t = B.value;
|
|
@@ -1747,7 +1856,7 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1747
1856
|
let t = f.value;
|
|
1748
1857
|
if (!t) return Promise.resolve();
|
|
1749
1858
|
let n = e * (k || t.clientHeight);
|
|
1750
|
-
return x.value = e,
|
|
1859
|
+
return x.value = e, zt(t, n, pe());
|
|
1751
1860
|
}
|
|
1752
1861
|
function he(e) {
|
|
1753
1862
|
me(e);
|
|
@@ -1757,7 +1866,7 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1757
1866
|
return t < 0 || t === x.value ? !1 : (await me(t), !0);
|
|
1758
1867
|
}
|
|
1759
1868
|
async function _e(e) {
|
|
1760
|
-
return Y(e) ? (pe() || await new Promise((e) => setTimeout(e,
|
|
1869
|
+
return Y(e) ? (pe() || await new Promise((e) => setTimeout(e, Gt)), !0) : !1;
|
|
1761
1870
|
}
|
|
1762
1871
|
function ve() {
|
|
1763
1872
|
if (!u.reelAutoAdvance.enabled) return;
|
|
@@ -1826,7 +1935,7 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1826
1935
|
"style",
|
|
1827
1936
|
"total"
|
|
1828
1937
|
])) : o("", !0),
|
|
1829
|
-
c("div",
|
|
1938
|
+
c("div", Ht, [c("div", {
|
|
1830
1939
|
ref_key: "galleryElement",
|
|
1831
1940
|
ref: f,
|
|
1832
1941
|
class: "gallery-shell reel-feed",
|
|
@@ -1838,7 +1947,7 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1838
1947
|
class: "reel-track",
|
|
1839
1948
|
style: _(F.value),
|
|
1840
1949
|
"aria-label": "Media gallery"
|
|
1841
|
-
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(
|
|
1950
|
+
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(At, {
|
|
1842
1951
|
key: n.postId,
|
|
1843
1952
|
active: i === x.value && !C.value,
|
|
1844
1953
|
"advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
|
|
@@ -1892,7 +2001,7 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1892
2001
|
class: "reel-forward-retry",
|
|
1893
2002
|
type: "button",
|
|
1894
2003
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
1895
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
2004
|
+
}, " Retry ")) : o("", !0)], 8, Wt)), t.reelForward.status === "idle" ? (b(), a(te, {
|
|
1896
2005
|
key: 2,
|
|
1897
2006
|
actions: t.feedFooterActions,
|
|
1898
2007
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1915,7 +2024,7 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1915
2024
|
"load-more-locked",
|
|
1916
2025
|
"show-load-more",
|
|
1917
2026
|
"state"
|
|
1918
|
-
])) : o("", !0)], 40,
|
|
2027
|
+
])) : o("", !0)], 40, Ut), c("div", {
|
|
1919
2028
|
ref_key: "reelControlsElement",
|
|
1920
2029
|
ref: p,
|
|
1921
2030
|
class: "reel-media-controls-host",
|
|
@@ -1943,7 +2052,7 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1943
2052
|
"style",
|
|
1944
2053
|
"total"
|
|
1945
2054
|
])) : o("", !0),
|
|
1946
|
-
ne.value ? (b(), a(
|
|
2055
|
+
ne.value ? (b(), a(Vt, {
|
|
1947
2056
|
key: G.value,
|
|
1948
2057
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1949
2058
|
label: K.value,
|
|
@@ -1951,16 +2060,16 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
1951
2060
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1952
2061
|
], 2));
|
|
1953
2062
|
}
|
|
1954
|
-
}),
|
|
2063
|
+
}), Jt = ["data-info-sheet-open", "data-info-sheet-mode"], Yt = ["aria-hidden", "inert"], Xt = {
|
|
1955
2064
|
key: 0,
|
|
1956
2065
|
class: "reel-info-sheet-layer",
|
|
1957
2066
|
"data-test": "reel-info-sheet"
|
|
1958
|
-
},
|
|
2067
|
+
}, Zt = [
|
|
1959
2068
|
"role",
|
|
1960
2069
|
"aria-modal",
|
|
1961
2070
|
"tabindex",
|
|
1962
2071
|
"data-active-post-id"
|
|
1963
|
-
],
|
|
2072
|
+
], Qt = /* @__PURE__ */ d({
|
|
1964
2073
|
__name: "ReelLayout",
|
|
1965
2074
|
props: {
|
|
1966
2075
|
forwardIndex: { default: null },
|
|
@@ -2087,7 +2196,7 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
2087
2196
|
class: "reel-layout-main",
|
|
2088
2197
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
2089
2198
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
2090
|
-
}, [u(
|
|
2199
|
+
}, [u(qt, {
|
|
2091
2200
|
ref_key: "reelFeed",
|
|
2092
2201
|
ref: p,
|
|
2093
2202
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2141,8 +2250,8 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
2141
2250
|
"reel-forward",
|
|
2142
2251
|
"state",
|
|
2143
2252
|
"total"
|
|
2144
|
-
])], 8,
|
|
2145
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2253
|
+
])], 8, Yt), u(n, { name: "vibe-info-sheet" }, {
|
|
2254
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Xt, [c("aside", {
|
|
2146
2255
|
ref_key: "sheetElement",
|
|
2147
2256
|
ref: _,
|
|
2148
2257
|
class: "reel-info-sheet",
|
|
@@ -2151,14 +2260,14 @@ var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
|
2151
2260
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2152
2261
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2153
2262
|
"data-active-post-id": T.value?.postId
|
|
2154
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2263
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Zt)])) : o("", !0)]),
|
|
2155
2264
|
_: 1
|
|
2156
|
-
})], 10,
|
|
2265
|
+
})], 10, Jt));
|
|
2157
2266
|
}
|
|
2158
2267
|
});
|
|
2159
2268
|
//#endregion
|
|
2160
2269
|
//#region src/core/mediaLifecycle.ts
|
|
2161
|
-
function
|
|
2270
|
+
function $t(e, t, n, r, i) {
|
|
2162
2271
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2163
2272
|
if (!o) return null;
|
|
2164
2273
|
let s = F(o, n), c = I(o, s);
|
|
@@ -2174,7 +2283,7 @@ function Vt(e, t, n, r, i) {
|
|
|
2174
2283
|
postIndex: a
|
|
2175
2284
|
};
|
|
2176
2285
|
}
|
|
2177
|
-
function
|
|
2286
|
+
function en(e, t) {
|
|
2178
2287
|
O(() => {
|
|
2179
2288
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2180
2289
|
return {
|
|
@@ -2184,20 +2293,20 @@ function Ht(e, t) {
|
|
|
2184
2293
|
};
|
|
2185
2294
|
}, (n, r) => {
|
|
2186
2295
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2187
|
-
let i =
|
|
2296
|
+
let i = $t(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2188
2297
|
i && t(i);
|
|
2189
2298
|
}, { flush: "sync" });
|
|
2190
2299
|
}
|
|
2191
2300
|
//#endregion
|
|
2192
2301
|
//#region src/components/useMediaLifecycle.ts
|
|
2193
|
-
function
|
|
2302
|
+
function tn(e, t) {
|
|
2194
2303
|
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = () => e.reelMediaSource === "preview" ? n : e.reelMediaSource === "mobile" ? a : i, s = r(() => o().value);
|
|
2195
2304
|
function c(e, t, n, r) {
|
|
2196
2305
|
let i = L(t, n);
|
|
2197
2306
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2198
2307
|
}
|
|
2199
2308
|
function l(t, n, r, i) {
|
|
2200
|
-
return
|
|
2309
|
+
return $t(e, t, n, r, i);
|
|
2201
2310
|
}
|
|
2202
2311
|
function u(e, n, r, i) {
|
|
2203
2312
|
let a = l(e, n, r, i);
|
|
@@ -2219,7 +2328,7 @@ function Ut(e, t) {
|
|
|
2219
2328
|
let r = l(e, n, "masonry", null);
|
|
2220
2329
|
r && t.visible(r);
|
|
2221
2330
|
}
|
|
2222
|
-
return
|
|
2331
|
+
return en(e, t.reelChange), O(() => {
|
|
2223
2332
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2224
2333
|
return {
|
|
2225
2334
|
mediaIndex: n,
|
|
@@ -2244,16 +2353,16 @@ function Ut(e, t) {
|
|
|
2244
2353
|
}
|
|
2245
2354
|
//#endregion
|
|
2246
2355
|
//#region src/core/reelEscapeStack.ts
|
|
2247
|
-
var
|
|
2248
|
-
function
|
|
2249
|
-
return
|
|
2250
|
-
let t =
|
|
2251
|
-
t >= 0 &&
|
|
2356
|
+
var nn = [];
|
|
2357
|
+
function rn(e) {
|
|
2358
|
+
return nn.push(e), () => {
|
|
2359
|
+
let t = nn.indexOf(e);
|
|
2360
|
+
t >= 0 && nn.splice(t, 1);
|
|
2252
2361
|
};
|
|
2253
2362
|
}
|
|
2254
|
-
function
|
|
2363
|
+
function an(e) {
|
|
2255
2364
|
if (!e.isActive()) return !1;
|
|
2256
|
-
let t =
|
|
2365
|
+
let t = nn.filter((e) => e.isActive()), n = e.element();
|
|
2257
2366
|
return n !== null && t.some((t) => {
|
|
2258
2367
|
if (t === e) return !1;
|
|
2259
2368
|
let r = t.element();
|
|
@@ -2269,14 +2378,14 @@ function Kt(e) {
|
|
|
2269
2378
|
}
|
|
2270
2379
|
//#endregion
|
|
2271
2380
|
//#region src/components/useReelKeyboard.ts
|
|
2272
|
-
function
|
|
2381
|
+
function on(e) {
|
|
2273
2382
|
let t = {
|
|
2274
2383
|
element: e.element,
|
|
2275
2384
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2276
2385
|
}, n = null;
|
|
2277
2386
|
function r(n) {
|
|
2278
2387
|
let r = t.isActive();
|
|
2279
|
-
if (n.key === "Escape" && r && !
|
|
2388
|
+
if (n.key === "Escape" && r && !an(t)) return;
|
|
2280
2389
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2281
2390
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2282
2391
|
return;
|
|
@@ -2296,14 +2405,14 @@ function qt(e) {
|
|
|
2296
2405
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2297
2406
|
}
|
|
2298
2407
|
y(() => {
|
|
2299
|
-
n =
|
|
2408
|
+
n = rn(t), window.addEventListener("keydown", r);
|
|
2300
2409
|
}), v(() => {
|
|
2301
2410
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2302
2411
|
});
|
|
2303
2412
|
}
|
|
2304
2413
|
//#endregion
|
|
2305
2414
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2306
|
-
var
|
|
2415
|
+
var sn = 35, cn = 420, ln = /* @__PURE__ */ d({
|
|
2307
2416
|
__name: "VibeSurface",
|
|
2308
2417
|
props: {
|
|
2309
2418
|
canRetryEnd: { type: Boolean },
|
|
@@ -2331,7 +2440,7 @@ var Jt = 35, Yt = 420, Xt = /* @__PURE__ */ d({
|
|
|
2331
2440
|
"retryForward"
|
|
2332
2441
|
],
|
|
2333
2442
|
setup(t, { expose: i, emit: c }) {
|
|
2334
|
-
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(() => z(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: I, originalStates: L, previewStates: R, reelStates: B } =
|
|
2443
|
+
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(() => z(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: I, originalStates: L, previewStates: R, reelStates: B } = tn(l.state, {
|
|
2335
2444
|
ready: (e) => d("mediaReady", e),
|
|
2336
2445
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2337
2446
|
visible: (e) => d("mediaVisible", e)
|
|
@@ -2382,10 +2491,10 @@ var Jt = 35, Yt = 420, Xt = /* @__PURE__ */ d({
|
|
|
2382
2491
|
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ee()) return 0;
|
|
2383
2492
|
let n = [...new Set(e)], r = n.filter(se);
|
|
2384
2493
|
if (r.length === 0) return 0;
|
|
2385
|
-
let i = new Map(C.value), a = t?.staggerMs ??
|
|
2494
|
+
let i = new Map(C.value), a = t?.staggerMs ?? sn;
|
|
2386
2495
|
return r.forEach((e, t) => {
|
|
2387
2496
|
i.set(e, t * a);
|
|
2388
|
-
}), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i,
|
|
2497
|
+
}), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, cn + (r.length - 1) * a;
|
|
2389
2498
|
}
|
|
2390
2499
|
function ce(e, t) {
|
|
2391
2500
|
let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
@@ -2402,7 +2511,7 @@ var Jt = 35, Yt = 420, Xt = /* @__PURE__ */ d({
|
|
|
2402
2511
|
e !== null && ce(e, t);
|
|
2403
2512
|
});
|
|
2404
2513
|
}
|
|
2405
|
-
return
|
|
2514
|
+
return on({
|
|
2406
2515
|
closeMasonryReel: le,
|
|
2407
2516
|
element: () => g.value,
|
|
2408
2517
|
isReelLeaving: () => _.value,
|
|
@@ -2417,7 +2526,7 @@ var Jt = 35, Yt = 420, Xt = /* @__PURE__ */ d({
|
|
|
2417
2526
|
let t = x.value.get(e);
|
|
2418
2527
|
t !== void 0 && r.set(e, t);
|
|
2419
2528
|
}), t.forEach((e, t) => {
|
|
2420
|
-
r.set(e, t *
|
|
2529
|
+
r.set(e, t * sn);
|
|
2421
2530
|
}), x.value = r, y.value = new Set([...y.value, ...t]), te();
|
|
2422
2531
|
}, { flush: "sync" }), v(() => {
|
|
2423
2532
|
H !== null && cancelAnimationFrame(H);
|
|
@@ -2434,7 +2543,7 @@ var Jt = 35, Yt = 420, Xt = /* @__PURE__ */ d({
|
|
|
2434
2543
|
ref_key: "surfaceElement",
|
|
2435
2544
|
ref: g,
|
|
2436
2545
|
class: "vibe-surface"
|
|
2437
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2546
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Qt, {
|
|
2438
2547
|
key: 0,
|
|
2439
2548
|
ref_key: "reelRenderer",
|
|
2440
2549
|
ref: p,
|
|
@@ -2487,7 +2596,7 @@ var Jt = 35, Yt = 420, Xt = /* @__PURE__ */ d({
|
|
|
2487
2596
|
"can-retry-end",
|
|
2488
2597
|
"feed-footer",
|
|
2489
2598
|
"state"
|
|
2490
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2599
|
+
])) : (b(), s(e, { key: 2 }, [u(Lt, {
|
|
2491
2600
|
ref_key: "masonryRenderer",
|
|
2492
2601
|
ref: f,
|
|
2493
2602
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2558,7 +2667,7 @@ var Jt = 35, Yt = 420, Xt = /* @__PURE__ */ d({
|
|
|
2558
2667
|
"aria-label": "Media viewer",
|
|
2559
2668
|
"aria-modal": "true",
|
|
2560
2669
|
tabindex: "-1"
|
|
2561
|
-
}, [u(
|
|
2670
|
+
}, [u(Qt, {
|
|
2562
2671
|
ref_key: "reelRenderer",
|
|
2563
2672
|
ref: p,
|
|
2564
2673
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2604,7 +2713,7 @@ var Jt = 35, Yt = 420, Xt = /* @__PURE__ */ d({
|
|
|
2604
2713
|
});
|
|
2605
2714
|
//#endregion
|
|
2606
2715
|
//#region src/core/page.ts
|
|
2607
|
-
function
|
|
2716
|
+
function un(e) {
|
|
2608
2717
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2609
2718
|
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.");
|
|
2610
2719
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
@@ -2615,22 +2724,22 @@ function Z(e, t) {
|
|
|
2615
2724
|
let n = new Set(e.map((e) => e.postId));
|
|
2616
2725
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2617
2726
|
}
|
|
2618
|
-
function
|
|
2727
|
+
function dn(e) {
|
|
2619
2728
|
return `${typeof e}:${String(e)}`;
|
|
2620
2729
|
}
|
|
2621
|
-
function
|
|
2622
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${
|
|
2730
|
+
function fn(e) {
|
|
2731
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${dn(e.mediaId)}`;
|
|
2623
2732
|
}
|
|
2624
|
-
function
|
|
2625
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
2733
|
+
function pn(e, t) {
|
|
2734
|
+
let n = [...e], r = new Map(e.map((e, t) => [dn(e.postId), t]));
|
|
2626
2735
|
return t.forEach((e) => {
|
|
2627
|
-
let t =
|
|
2736
|
+
let t = dn(e.postId), i = r.get(t);
|
|
2628
2737
|
if (i === void 0) {
|
|
2629
2738
|
r.set(t, n.length), n.push(e);
|
|
2630
2739
|
return;
|
|
2631
2740
|
}
|
|
2632
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
2633
|
-
let t =
|
|
2741
|
+
let a = n[i], o = new Set([a, ...a.items].map(fn)), s = [e, ...e.items].filter((e) => {
|
|
2742
|
+
let t = fn(e);
|
|
2634
2743
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
2635
2744
|
});
|
|
2636
2745
|
s.length > 0 && (n[i] = {
|
|
@@ -2639,14 +2748,14 @@ function en(e, t) {
|
|
|
2639
2748
|
});
|
|
2640
2749
|
}), n;
|
|
2641
2750
|
}
|
|
2642
|
-
function
|
|
2751
|
+
function mn(e) {
|
|
2643
2752
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
2644
2753
|
}
|
|
2645
2754
|
//#endregion
|
|
2646
2755
|
//#region src/core/appendPage.ts
|
|
2647
|
-
function
|
|
2648
|
-
let i =
|
|
2649
|
-
t.items =
|
|
2756
|
+
function hn(e, t, n, r) {
|
|
2757
|
+
let i = un(e), a = n.filterItems(i.items), o = mn(i);
|
|
2758
|
+
t.items = pn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
2650
2759
|
contributionIds: a.map(({ postId: e }) => e),
|
|
2651
2760
|
cursor: o,
|
|
2652
2761
|
next: i.next,
|
|
@@ -2655,32 +2764,32 @@ function nn(e, t, n, r) {
|
|
|
2655
2764
|
}
|
|
2656
2765
|
//#endregion
|
|
2657
2766
|
//#region src/core/requestDelay.ts
|
|
2658
|
-
var
|
|
2767
|
+
var gn = 2e3, _n = 1e4, vn = 250, yn = {
|
|
2659
2768
|
delayRemainingMs: null,
|
|
2660
2769
|
nextRequestAt: null
|
|
2661
2770
|
};
|
|
2662
|
-
function
|
|
2771
|
+
function bn(e, t) {
|
|
2663
2772
|
return e === void 0 ? t : Math.floor(e);
|
|
2664
2773
|
}
|
|
2665
|
-
function
|
|
2774
|
+
function xn(e, t) {
|
|
2666
2775
|
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.`);
|
|
2667
2776
|
}
|
|
2668
|
-
function
|
|
2669
|
-
let n =
|
|
2777
|
+
function Sn(e, t = {}) {
|
|
2778
|
+
let n = bn(t.delayStepMs, gn), r = bn(t.delayMaxMs, _n);
|
|
2670
2779
|
return Math.min(Math.max(0, e) * n, r);
|
|
2671
2780
|
}
|
|
2672
2781
|
function Q(e) {
|
|
2673
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2782
|
+
if (e == null || !Number.isFinite(e)) return { ...yn };
|
|
2674
2783
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2675
2784
|
return t > 0 ? {
|
|
2676
2785
|
delayRemainingMs: t,
|
|
2677
2786
|
nextRequestAt: e
|
|
2678
|
-
} : { ...
|
|
2787
|
+
} : { ...yn };
|
|
2679
2788
|
}
|
|
2680
|
-
async function
|
|
2789
|
+
async function Cn({ delayMs: e, onChange: t, signal: n }) {
|
|
2681
2790
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2682
2791
|
if (e <= 0) {
|
|
2683
|
-
t({ ...
|
|
2792
|
+
t({ ...yn });
|
|
2684
2793
|
return;
|
|
2685
2794
|
}
|
|
2686
2795
|
let r = Date.now() + e;
|
|
@@ -2688,9 +2797,9 @@ async function dn({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2688
2797
|
delayRemainingMs: e,
|
|
2689
2798
|
nextRequestAt: r
|
|
2690
2799
|
}), await new Promise((i, a) => {
|
|
2691
|
-
let o = !1, s = setInterval(f,
|
|
2800
|
+
let o = !1, s = setInterval(f, vn), c = setTimeout(() => u(), e);
|
|
2692
2801
|
function l() {
|
|
2693
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2802
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...yn });
|
|
2694
2803
|
}
|
|
2695
2804
|
function u(e) {
|
|
2696
2805
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2705,13 +2814,13 @@ async function dn({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2705
2814
|
n.addEventListener("abort", d, { once: !0 });
|
|
2706
2815
|
});
|
|
2707
2816
|
}
|
|
2708
|
-
var
|
|
2817
|
+
var wn = class {
|
|
2709
2818
|
interval = null;
|
|
2710
2819
|
constructor(e) {
|
|
2711
2820
|
this.onChange = e;
|
|
2712
2821
|
}
|
|
2713
2822
|
clear() {
|
|
2714
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2823
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...yn });
|
|
2715
2824
|
}
|
|
2716
2825
|
sync(e) {
|
|
2717
2826
|
this.clear();
|
|
@@ -2719,22 +2828,22 @@ var fn = class {
|
|
|
2719
2828
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2720
2829
|
let t = Q(e);
|
|
2721
2830
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2722
|
-
},
|
|
2831
|
+
}, vn));
|
|
2723
2832
|
}
|
|
2724
2833
|
};
|
|
2725
|
-
function
|
|
2834
|
+
function Tn(e, t = !0) {
|
|
2726
2835
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2727
2836
|
}
|
|
2728
|
-
function
|
|
2837
|
+
function En(e) {
|
|
2729
2838
|
return `${typeof e}:${String(e)}`;
|
|
2730
2839
|
}
|
|
2731
|
-
function
|
|
2840
|
+
function Dn(e, t) {
|
|
2732
2841
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2733
2842
|
}
|
|
2734
|
-
function
|
|
2843
|
+
function On(e) {
|
|
2735
2844
|
if (!e) return;
|
|
2736
|
-
if (
|
|
2737
|
-
|
|
2845
|
+
if (Dn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2846
|
+
xn(e, "frontend autofill");
|
|
2738
2847
|
let t = e.maxAdditionalPages;
|
|
2739
2848
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2740
2849
|
return;
|
|
@@ -2746,7 +2855,7 @@ function gn(e) {
|
|
|
2746
2855
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2747
2856
|
}
|
|
2748
2857
|
}
|
|
2749
|
-
function
|
|
2858
|
+
function kn(e, t, n = !0) {
|
|
2750
2859
|
if (!e) return {
|
|
2751
2860
|
cycleId: null,
|
|
2752
2861
|
delayRemainingMs: null,
|
|
@@ -2780,7 +2889,7 @@ function _n(e, t, n = !0) {
|
|
|
2780
2889
|
strategy: e.strategy
|
|
2781
2890
|
};
|
|
2782
2891
|
}
|
|
2783
|
-
function
|
|
2892
|
+
function An(e) {
|
|
2784
2893
|
return [
|
|
2785
2894
|
"cancelling",
|
|
2786
2895
|
"filling",
|
|
@@ -2788,9 +2897,9 @@ function vn(e) {
|
|
|
2788
2897
|
"waiting"
|
|
2789
2898
|
].includes(e.status);
|
|
2790
2899
|
}
|
|
2791
|
-
async function
|
|
2900
|
+
async function jn(e, t, n) {
|
|
2792
2901
|
let r = t.autofill;
|
|
2793
|
-
if (!
|
|
2902
|
+
if (!An(r) || !r.cycleId) return;
|
|
2794
2903
|
let i = {
|
|
2795
2904
|
cycleId: r.cycleId,
|
|
2796
2905
|
feedKey: r.feedKey ?? "",
|
|
@@ -2803,16 +2912,16 @@ async function yn(e, t, n) {
|
|
|
2803
2912
|
throw r.error = e, r.status = "error", e;
|
|
2804
2913
|
}
|
|
2805
2914
|
}
|
|
2806
|
-
function
|
|
2915
|
+
function Mn(e, t, n) {
|
|
2807
2916
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2808
2917
|
}
|
|
2809
|
-
async function
|
|
2810
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2918
|
+
async function Nn({ 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 }) {
|
|
2919
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Tn(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2811
2920
|
for (; y < h;) {
|
|
2812
|
-
let e =
|
|
2921
|
+
let e = En(g);
|
|
2813
2922
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2814
|
-
if (m.add(e), await
|
|
2815
|
-
delayMs:
|
|
2923
|
+
if (m.add(e), await Cn({
|
|
2924
|
+
delayMs: Sn(l + y, s),
|
|
2816
2925
|
onChange: a,
|
|
2817
2926
|
signal: d
|
|
2818
2927
|
}), y > 0 && u()) return {
|
|
@@ -2826,7 +2935,7 @@ async function xn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2826
2935
|
status: "paused",
|
|
2827
2936
|
total: x
|
|
2828
2937
|
};
|
|
2829
|
-
let t =
|
|
2938
|
+
let t = un(await n({
|
|
2830
2939
|
cursor: g,
|
|
2831
2940
|
signal: d
|
|
2832
2941
|
}));
|
|
@@ -2883,12 +2992,12 @@ async function xn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2883
2992
|
}
|
|
2884
2993
|
//#endregion
|
|
2885
2994
|
//#region src/core/autofillController.ts
|
|
2886
|
-
var
|
|
2995
|
+
var Pn = class {
|
|
2887
2996
|
collection = null;
|
|
2888
2997
|
cycle = 0;
|
|
2889
2998
|
delayCountdown;
|
|
2890
2999
|
constructor(e) {
|
|
2891
|
-
this.context = e, this.delayCountdown = new
|
|
3000
|
+
this.context = e, this.delayCountdown = new wn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2892
3001
|
}
|
|
2893
3002
|
beginCycle() {
|
|
2894
3003
|
let { options: e, state: t } = this.context;
|
|
@@ -2896,14 +3005,14 @@ var Sn = class {
|
|
|
2896
3005
|
this.clear();
|
|
2897
3006
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2898
3007
|
return t.autofill = {
|
|
2899
|
-
...
|
|
3008
|
+
...kn(e, void 0, !1),
|
|
2900
3009
|
cycleId: n,
|
|
2901
3010
|
status: "filling"
|
|
2902
3011
|
}, n;
|
|
2903
3012
|
}
|
|
2904
3013
|
async cancel() {
|
|
2905
3014
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2906
|
-
await
|
|
3015
|
+
await jn(t, n, e), this.commitCollection();
|
|
2907
3016
|
}
|
|
2908
3017
|
captureCollection(e, t) {
|
|
2909
3018
|
t && (this.collection = e);
|
|
@@ -2931,30 +3040,30 @@ var Sn = class {
|
|
|
2931
3040
|
requests: r.requests
|
|
2932
3041
|
}), !0) : !1;
|
|
2933
3042
|
}
|
|
2934
|
-
},
|
|
2935
|
-
function
|
|
3043
|
+
}, Fn = 100;
|
|
3044
|
+
function In(e, t) {
|
|
2936
3045
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2937
3046
|
}
|
|
2938
|
-
function
|
|
3047
|
+
function Ln(e, t, n) {
|
|
2939
3048
|
return Math.min(n, Math.max(t, e));
|
|
2940
3049
|
}
|
|
2941
|
-
function
|
|
3050
|
+
function Rn(e) {
|
|
2942
3051
|
if (!e) return;
|
|
2943
3052
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2944
|
-
if (
|
|
2945
|
-
e.speedPxPerSecond !== void 0 &&
|
|
3053
|
+
if (In("autoScroll.minSpeedPxPerSecond", t), In("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
3054
|
+
e.speedPxPerSecond !== void 0 && In("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2946
3055
|
}
|
|
2947
|
-
function
|
|
3056
|
+
function zn(e) {
|
|
2948
3057
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2949
3058
|
return {
|
|
2950
3059
|
enabled: e?.enabled ?? !1,
|
|
2951
3060
|
maxSpeedPxPerSecond: n,
|
|
2952
3061
|
minSpeedPxPerSecond: t,
|
|
2953
3062
|
paused: !1,
|
|
2954
|
-
speedPxPerSecond:
|
|
3063
|
+
speedPxPerSecond: Ln(e?.speedPxPerSecond ?? 80, t, n)
|
|
2955
3064
|
};
|
|
2956
3065
|
}
|
|
2957
|
-
var
|
|
3066
|
+
var Bn = class {
|
|
2958
3067
|
frame = null;
|
|
2959
3068
|
lastTimestamp = null;
|
|
2960
3069
|
mounted = !1;
|
|
@@ -2974,9 +3083,9 @@ var On = class {
|
|
|
2974
3083
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2975
3084
|
}
|
|
2976
3085
|
setSpeed(e) {
|
|
2977
|
-
|
|
3086
|
+
In("auto-scroll speed", e);
|
|
2978
3087
|
let t = this.options.state;
|
|
2979
|
-
t.speedPxPerSecond =
|
|
3088
|
+
t.speedPxPerSecond = Ln(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2980
3089
|
}
|
|
2981
3090
|
tick = (e) => {
|
|
2982
3091
|
this.frame = null;
|
|
@@ -2988,7 +3097,7 @@ var On = class {
|
|
|
2988
3097
|
return;
|
|
2989
3098
|
}
|
|
2990
3099
|
if (this.lastTimestamp !== null) {
|
|
2991
|
-
let r = Math.min(
|
|
3100
|
+
let r = Math.min(Fn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2992
3101
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2993
3102
|
}
|
|
2994
3103
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3002,7 +3111,7 @@ var On = class {
|
|
|
3002
3111
|
};
|
|
3003
3112
|
//#endregion
|
|
3004
3113
|
//#region src/core/backendAutofill.ts
|
|
3005
|
-
async function
|
|
3114
|
+
async function Vn(e, t, n, r) {
|
|
3006
3115
|
let i = await e.onUnderfilled(n);
|
|
3007
3116
|
if (!r()) return;
|
|
3008
3117
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -3016,19 +3125,19 @@ async function kn(e, t, n, r) {
|
|
|
3016
3125
|
status: "waiting"
|
|
3017
3126
|
});
|
|
3018
3127
|
}
|
|
3019
|
-
function
|
|
3128
|
+
function Hn(e, t) {
|
|
3020
3129
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = Z(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
3021
3130
|
}
|
|
3022
|
-
function
|
|
3131
|
+
function Un(e, t, n) {
|
|
3023
3132
|
let r = t.autofill;
|
|
3024
|
-
return !
|
|
3133
|
+
return !Mn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Hn(t, n), Object.assign(r, Q(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);
|
|
3025
3134
|
}
|
|
3026
|
-
function
|
|
3027
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3135
|
+
function Wn(e, t, n) {
|
|
3136
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = kn(e, n), Hn(t, n), !0);
|
|
3028
3137
|
}
|
|
3029
3138
|
//#endregion
|
|
3030
3139
|
//#region src/core/backlogRestore.ts
|
|
3031
|
-
async function
|
|
3140
|
+
async function Gn(e, t, n) {
|
|
3032
3141
|
if (!e) return;
|
|
3033
3142
|
let r = new AbortController();
|
|
3034
3143
|
n(r);
|
|
@@ -3043,7 +3152,7 @@ async function Nn(e, t, n) {
|
|
|
3043
3152
|
}
|
|
3044
3153
|
//#endregion
|
|
3045
3154
|
//#region src/core/initialAutofill.ts
|
|
3046
|
-
async function
|
|
3155
|
+
async function Kn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3047
3156
|
let c = a.autofill;
|
|
3048
3157
|
if (!c) return;
|
|
3049
3158
|
let l = s.items.length;
|
|
@@ -3056,7 +3165,7 @@ async function Pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3056
3165
|
return;
|
|
3057
3166
|
}
|
|
3058
3167
|
if (c.strategy === "backend") {
|
|
3059
|
-
await
|
|
3168
|
+
await Vn(c, s, {
|
|
3060
3169
|
cycleId: e,
|
|
3061
3170
|
feedKey: c.feedKey,
|
|
3062
3171
|
items: [...s.items],
|
|
@@ -3073,11 +3182,11 @@ async function Pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3073
3182
|
s.autofill.status = "exhausted";
|
|
3074
3183
|
return;
|
|
3075
3184
|
}
|
|
3076
|
-
let u = await
|
|
3185
|
+
let u = await Nn({
|
|
3077
3186
|
existingItems: s.items,
|
|
3078
3187
|
initialCursor: s.next,
|
|
3079
3188
|
loadPage: a.loadPage,
|
|
3080
|
-
maximumRequests:
|
|
3189
|
+
maximumRequests: Tn(c, !1),
|
|
3081
3190
|
onCollection: n,
|
|
3082
3191
|
onDelayChange: (e) => {
|
|
3083
3192
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3100,13 +3209,13 @@ async function Pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3100
3209
|
}
|
|
3101
3210
|
//#endregion
|
|
3102
3211
|
//#region src/core/fill.ts
|
|
3103
|
-
function
|
|
3212
|
+
function qn(e) {
|
|
3104
3213
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3105
3214
|
}
|
|
3106
|
-
function
|
|
3215
|
+
function Jn(e) {
|
|
3107
3216
|
return `${typeof e}:${String(e)}`;
|
|
3108
3217
|
}
|
|
3109
|
-
function
|
|
3218
|
+
function Yn(e) {
|
|
3110
3219
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3111
3220
|
if ("pages" in e) {
|
|
3112
3221
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3119,20 +3228,20 @@ function Ln(e) {
|
|
|
3119
3228
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3120
3229
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3121
3230
|
}
|
|
3122
|
-
function
|
|
3231
|
+
function Xn(e) {
|
|
3123
3232
|
if (!e) return;
|
|
3124
3233
|
if (e.strategy === "frontend") {
|
|
3125
|
-
|
|
3234
|
+
xn(e, "frontend fill");
|
|
3126
3235
|
return;
|
|
3127
3236
|
}
|
|
3128
3237
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3129
3238
|
let t = e.initialSession;
|
|
3130
3239
|
if (t) {
|
|
3131
3240
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3132
|
-
|
|
3241
|
+
Yn(t.target);
|
|
3133
3242
|
}
|
|
3134
3243
|
}
|
|
3135
|
-
function
|
|
3244
|
+
function Zn(e, t, n = !0) {
|
|
3136
3245
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
|
|
3137
3246
|
return {
|
|
3138
3247
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -3146,10 +3255,10 @@ function zn(e, t, n = !0) {
|
|
|
3146
3255
|
sessionId: i?.sessionId ?? null,
|
|
3147
3256
|
status: i?.status ?? "idle",
|
|
3148
3257
|
strategy: e?.strategy ?? null,
|
|
3149
|
-
target: i ?
|
|
3258
|
+
target: i ? qn(i.target) : null
|
|
3150
3259
|
};
|
|
3151
3260
|
}
|
|
3152
|
-
function
|
|
3261
|
+
function Qn(e) {
|
|
3153
3262
|
return [
|
|
3154
3263
|
"cancelling",
|
|
3155
3264
|
"filling",
|
|
@@ -3157,7 +3266,7 @@ function Bn(e) {
|
|
|
3157
3266
|
"waiting"
|
|
3158
3267
|
].includes(e.status);
|
|
3159
3268
|
}
|
|
3160
|
-
async function
|
|
3269
|
+
async function $n({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3161
3270
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3162
3271
|
if ("items" in l && f.length >= l.items) return {
|
|
3163
3272
|
completedPages: m,
|
|
@@ -3169,10 +3278,10 @@ async function Vn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3169
3278
|
status: "complete"
|
|
3170
3279
|
};
|
|
3171
3280
|
for (; _ !== null;) {
|
|
3172
|
-
let e =
|
|
3281
|
+
let e = Jn(h);
|
|
3173
3282
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3174
|
-
if (p.add(e), await
|
|
3175
|
-
delayMs:
|
|
3283
|
+
if (p.add(e), await Cn({
|
|
3284
|
+
delayMs: Sn(m, o),
|
|
3176
3285
|
onChange: i,
|
|
3177
3286
|
signal: c
|
|
3178
3287
|
}), m > 0 && s()) return {
|
|
@@ -3185,7 +3294,7 @@ async function Vn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3185
3294
|
status: "paused",
|
|
3186
3295
|
total: y
|
|
3187
3296
|
};
|
|
3188
|
-
let t =
|
|
3297
|
+
let t = un(await n({
|
|
3189
3298
|
cursor: h,
|
|
3190
3299
|
signal: c
|
|
3191
3300
|
}));
|
|
@@ -3253,7 +3362,7 @@ async function Vn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3253
3362
|
}
|
|
3254
3363
|
//#endregion
|
|
3255
3364
|
//#region src/core/backendFill.ts
|
|
3256
|
-
async function
|
|
3365
|
+
async function er(e, t, n, r) {
|
|
3257
3366
|
let i = await e.onStart(n);
|
|
3258
3367
|
if (r()) {
|
|
3259
3368
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -3267,22 +3376,22 @@ async function Hn(e, t, n, r) {
|
|
|
3267
3376
|
});
|
|
3268
3377
|
}
|
|
3269
3378
|
}
|
|
3270
|
-
function
|
|
3379
|
+
function tr(e, t, n) {
|
|
3271
3380
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3272
3381
|
}
|
|
3273
|
-
function
|
|
3382
|
+
function nr(e) {
|
|
3274
3383
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3275
3384
|
}
|
|
3276
|
-
function
|
|
3385
|
+
function rr(e, t) {
|
|
3277
3386
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3278
3387
|
let n = e.fill.target;
|
|
3279
3388
|
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;
|
|
3280
3389
|
}
|
|
3281
|
-
function
|
|
3390
|
+
function ir(e, t, n) {
|
|
3282
3391
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Z(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
3283
3392
|
}
|
|
3284
|
-
function
|
|
3285
|
-
return !
|
|
3393
|
+
function ar(e, t, n, r) {
|
|
3394
|
+
return !tr(e, t, n) || !nr(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !rr(t, n) ? !1 : (ir(t, n, r), Object.assign(t.fill, {
|
|
3286
3395
|
...Q(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3287
3396
|
completedPages: n.completedPages,
|
|
3288
3397
|
error: n.error ?? null,
|
|
@@ -3291,45 +3400,45 @@ function qn(e, t, n, r) {
|
|
|
3291
3400
|
status: n.status
|
|
3292
3401
|
}), !0);
|
|
3293
3402
|
}
|
|
3294
|
-
function
|
|
3403
|
+
function or(e, t, n, r) {
|
|
3295
3404
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3296
3405
|
let i = t.fill;
|
|
3297
|
-
return t.fill =
|
|
3406
|
+
return t.fill = Zn(e, n), !nr(n) || !rr(t, n) ? (t.fill = i, !1) : (ir(t, n, r), !0);
|
|
3298
3407
|
}
|
|
3299
3408
|
//#endregion
|
|
3300
3409
|
//#region src/core/fillController.ts
|
|
3301
|
-
var
|
|
3410
|
+
var sr = class {
|
|
3302
3411
|
abortController = null;
|
|
3303
3412
|
cycle = 0;
|
|
3304
3413
|
delayCountdown;
|
|
3305
3414
|
requestVersion = 0;
|
|
3306
3415
|
collection = null;
|
|
3307
3416
|
constructor(e) {
|
|
3308
|
-
this.options = e, this.delayCountdown = new
|
|
3417
|
+
this.options = e, this.delayCountdown = new wn((e) => {
|
|
3309
3418
|
Object.assign(this.options.state.fill, e);
|
|
3310
3419
|
}), this.syncBackendCountdown();
|
|
3311
3420
|
}
|
|
3312
3421
|
isActive() {
|
|
3313
|
-
return
|
|
3422
|
+
return Qn(this.options.state.fill);
|
|
3314
3423
|
}
|
|
3315
3424
|
applyUpdate(e) {
|
|
3316
|
-
let t =
|
|
3425
|
+
let t = ar(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3317
3426
|
return t && this.syncBackendCountdown(), t;
|
|
3318
3427
|
}
|
|
3319
3428
|
restoreSession(e) {
|
|
3320
|
-
let t =
|
|
3429
|
+
let t = or(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3321
3430
|
return t && this.syncBackendCountdown(), t;
|
|
3322
3431
|
}
|
|
3323
3432
|
async start(e, t = {}) {
|
|
3324
3433
|
let n = this.options.fill;
|
|
3325
3434
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3326
3435
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3327
|
-
let r =
|
|
3436
|
+
let r = Yn(e), i = Yn(t.target ?? r), a = t.progressOffset ?? {
|
|
3328
3437
|
completedPages: 0,
|
|
3329
3438
|
received: 0
|
|
3330
3439
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3331
3440
|
if (this.options.state.fill = {
|
|
3332
|
-
...
|
|
3441
|
+
...Zn(n, void 0, !1),
|
|
3333
3442
|
completedPages: a.completedPages,
|
|
3334
3443
|
cycleId: o,
|
|
3335
3444
|
received: a.received,
|
|
@@ -3342,7 +3451,7 @@ var Yn = class {
|
|
|
3342
3451
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3343
3452
|
this.abortController = c;
|
|
3344
3453
|
try {
|
|
3345
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3454
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await er(n, this.options.state, {
|
|
3346
3455
|
cycleId: o,
|
|
3347
3456
|
feedKey: n.feedKey,
|
|
3348
3457
|
items: [...this.options.state.items],
|
|
@@ -3360,7 +3469,7 @@ var Yn = class {
|
|
|
3360
3469
|
}
|
|
3361
3470
|
async cancel() {
|
|
3362
3471
|
let { fill: e, state: t } = this.options;
|
|
3363
|
-
if (!
|
|
3472
|
+
if (!Qn(t.fill) || !t.fill.cycleId) return;
|
|
3364
3473
|
let n = {
|
|
3365
3474
|
cycleId: t.fill.cycleId,
|
|
3366
3475
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3404,7 +3513,7 @@ var Yn = class {
|
|
|
3404
3513
|
});
|
|
3405
3514
|
}
|
|
3406
3515
|
reset() {
|
|
3407
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3516
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Zn(this.options.fill, void 0, !1), this.collection = null;
|
|
3408
3517
|
}
|
|
3409
3518
|
destroy() {
|
|
3410
3519
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3439,7 +3548,7 @@ var Yn = class {
|
|
|
3439
3548
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
3440
3549
|
return;
|
|
3441
3550
|
}
|
|
3442
|
-
let c = await
|
|
3551
|
+
let c = await $n({
|
|
3443
3552
|
existingItems: s.items,
|
|
3444
3553
|
initialCursor: s.next,
|
|
3445
3554
|
loadPage: o,
|
|
@@ -3487,7 +3596,7 @@ var Yn = class {
|
|
|
3487
3596
|
};
|
|
3488
3597
|
//#endregion
|
|
3489
3598
|
//#region src/core/fillReconciliation.ts
|
|
3490
|
-
async function
|
|
3599
|
+
async function cr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
|
|
3491
3600
|
if (!e.needsReconciliation(o.items)) return "skipped";
|
|
3492
3601
|
let s = await e.reconcile({
|
|
3493
3602
|
existingItems: o.items,
|
|
@@ -3500,7 +3609,7 @@ async function Xn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
3500
3609
|
}
|
|
3501
3610
|
//#endregion
|
|
3502
3611
|
//#region src/core/feedFooter.ts
|
|
3503
|
-
function
|
|
3612
|
+
function lr(e) {
|
|
3504
3613
|
return {
|
|
3505
3614
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3506
3615
|
loadMore: () => e.loadNext(),
|
|
@@ -3512,46 +3621,46 @@ function Zn(e) {
|
|
|
3512
3621
|
retryFill: () => e.retryFill()
|
|
3513
3622
|
};
|
|
3514
3623
|
}
|
|
3515
|
-
function
|
|
3624
|
+
function ur(e) {
|
|
3516
3625
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3517
3626
|
}
|
|
3518
|
-
function
|
|
3519
|
-
e?.intervalMs !== void 0 &&
|
|
3627
|
+
function dr(e) {
|
|
3628
|
+
e?.intervalMs !== void 0 && ur(e.intervalMs);
|
|
3520
3629
|
}
|
|
3521
|
-
function
|
|
3630
|
+
function fr(e) {
|
|
3522
3631
|
return {
|
|
3523
3632
|
enabled: e?.enabled ?? !1,
|
|
3524
3633
|
includePostItems: e?.includePostItems ?? !1,
|
|
3525
3634
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3526
3635
|
};
|
|
3527
3636
|
}
|
|
3528
|
-
function
|
|
3637
|
+
function pr(e, t) {
|
|
3529
3638
|
if (typeof t == "boolean") {
|
|
3530
3639
|
e.enabled = t;
|
|
3531
3640
|
return;
|
|
3532
3641
|
}
|
|
3533
|
-
|
|
3642
|
+
dr(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);
|
|
3534
3643
|
}
|
|
3535
3644
|
//#endregion
|
|
3536
3645
|
//#region src/core/reelInfoSheet.ts
|
|
3537
|
-
function
|
|
3646
|
+
function mr(e) {
|
|
3538
3647
|
return { enabled: e?.enabled ?? !1 };
|
|
3539
3648
|
}
|
|
3540
|
-
function
|
|
3649
|
+
function hr(e, t, n) {
|
|
3541
3650
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3542
3651
|
e.enabled = n;
|
|
3543
3652
|
}
|
|
3544
3653
|
//#endregion
|
|
3545
3654
|
//#region src/core/initialRuntimeState.ts
|
|
3546
|
-
function
|
|
3655
|
+
function gr(e, t) {
|
|
3547
3656
|
let n = e.initialPage;
|
|
3548
3657
|
return {
|
|
3549
3658
|
activeReelPostId: null,
|
|
3550
|
-
autoScroll:
|
|
3551
|
-
autofill:
|
|
3659
|
+
autoScroll: zn(e.autoScroll),
|
|
3660
|
+
autofill: kn(e.autofill),
|
|
3552
3661
|
current: n?.current ?? null,
|
|
3553
3662
|
error: null,
|
|
3554
|
-
fill:
|
|
3663
|
+
fill: Zn(e.fill),
|
|
3555
3664
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3556
3665
|
isLoading: !n,
|
|
3557
3666
|
isLoadingMore: !1,
|
|
@@ -3562,14 +3671,14 @@ function ir(e, t) {
|
|
|
3562
3671
|
next: n?.next ?? null,
|
|
3563
3672
|
nextPageError: null,
|
|
3564
3673
|
phoneMode: !1,
|
|
3565
|
-
reelAutoAdvance:
|
|
3674
|
+
reelAutoAdvance: fr(e.reelAutoAdvance),
|
|
3566
3675
|
reelForward: {
|
|
3567
3676
|
error: null,
|
|
3568
3677
|
status: "idle"
|
|
3569
3678
|
},
|
|
3570
3679
|
reelForwardIndex: null,
|
|
3571
3680
|
reelForwardItem: null,
|
|
3572
|
-
reelInfoSheet:
|
|
3681
|
+
reelInfoSheet: mr(e.reelInfoSheet),
|
|
3573
3682
|
reelInfoSheetOverlay: !1,
|
|
3574
3683
|
reelMediaSource: "original",
|
|
3575
3684
|
reelOrigin: null,
|
|
@@ -3578,20 +3687,21 @@ function ir(e, t) {
|
|
|
3578
3687
|
}
|
|
3579
3688
|
//#endregion
|
|
3580
3689
|
//#region src/core/options.ts
|
|
3581
|
-
function
|
|
3690
|
+
function _r(e, t) {
|
|
3582
3691
|
if (t) {
|
|
3583
3692
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3584
3693
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3585
3694
|
}
|
|
3586
3695
|
}
|
|
3587
|
-
function
|
|
3696
|
+
function vr(e, t) {
|
|
3588
3697
|
if (t) {
|
|
3589
3698
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3590
3699
|
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.`);
|
|
3591
3700
|
}
|
|
3592
3701
|
}
|
|
3593
|
-
function
|
|
3594
|
-
if (
|
|
3702
|
+
function yr(e) {
|
|
3703
|
+
if (Rn(e.autoScroll), _r("cardHeader", e.cardHeader), _r("cardFooter", e.cardFooter), vr("header", e.mediaCard?.header), vr("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\".");
|
|
3704
|
+
if (On(e.autofill), Xn(e.fill), de(e.masonry), dr(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3595
3705
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3596
3706
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3597
3707
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3606,7 +3716,7 @@ function sr(e) {
|
|
|
3606
3716
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3607
3717
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3608
3718
|
}
|
|
3609
|
-
function
|
|
3719
|
+
function br(e) {
|
|
3610
3720
|
if (typeof e != "string") return e;
|
|
3611
3721
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3612
3722
|
let t = document.querySelector(e);
|
|
@@ -3615,7 +3725,7 @@ function cr(e) {
|
|
|
3615
3725
|
}
|
|
3616
3726
|
//#endregion
|
|
3617
3727
|
//#region src/core/pageRequest.ts
|
|
3618
|
-
async function
|
|
3728
|
+
async function xr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3619
3729
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
3620
3730
|
received: l.autofill.received,
|
|
3621
3731
|
requests: l.autofill.requests
|
|
@@ -3627,11 +3737,11 @@ async function lr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3627
3737
|
let m = !1;
|
|
3628
3738
|
try {
|
|
3629
3739
|
if (u?.strategy === "frontend") {
|
|
3630
|
-
let s = await
|
|
3740
|
+
let s = await Nn({
|
|
3631
3741
|
existingItems: e ? l.items : [],
|
|
3632
3742
|
initialCursor: n,
|
|
3633
3743
|
loadPage: i,
|
|
3634
|
-
maximumRequests: f ? Math.max(0,
|
|
3744
|
+
maximumRequests: f ? Math.max(0, Tn(u) - f.requests) : void 0,
|
|
3635
3745
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3636
3746
|
onDelayChange: (e) => {
|
|
3637
3747
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3654,7 +3764,7 @@ async function lr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3654
3764
|
}), o(s.pages), t.clearCollection();
|
|
3655
3765
|
return;
|
|
3656
3766
|
}
|
|
3657
|
-
let s =
|
|
3767
|
+
let s = un(await i({
|
|
3658
3768
|
cursor: n,
|
|
3659
3769
|
signal: c
|
|
3660
3770
|
}));
|
|
@@ -3674,7 +3784,7 @@ async function lr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3674
3784
|
l.autofill.status = "complete";
|
|
3675
3785
|
return;
|
|
3676
3786
|
}
|
|
3677
|
-
await
|
|
3787
|
+
await Vn(u, l, {
|
|
3678
3788
|
cycleId: p,
|
|
3679
3789
|
feedKey: u.feedKey,
|
|
3680
3790
|
items: h.slice(d.length),
|
|
@@ -3699,13 +3809,13 @@ async function lr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3699
3809
|
function $(e) {
|
|
3700
3810
|
return `${typeof e}:${String(e)}`;
|
|
3701
3811
|
}
|
|
3702
|
-
function
|
|
3812
|
+
function Sr(e) {
|
|
3703
3813
|
return `${typeof e}:${String(e)}`;
|
|
3704
3814
|
}
|
|
3705
|
-
function
|
|
3815
|
+
function Cr(e) {
|
|
3706
3816
|
return e.map(({ postId: e }) => e);
|
|
3707
3817
|
}
|
|
3708
|
-
var
|
|
3818
|
+
var wr = class {
|
|
3709
3819
|
delay;
|
|
3710
3820
|
enabled;
|
|
3711
3821
|
maxReplayPages;
|
|
@@ -3737,10 +3847,10 @@ var fr = class {
|
|
|
3737
3847
|
}
|
|
3738
3848
|
recordInitialPage(e) {
|
|
3739
3849
|
e && this.recordPages([{
|
|
3740
|
-
contributionIds:
|
|
3741
|
-
cursor:
|
|
3850
|
+
contributionIds: Cr(e.items),
|
|
3851
|
+
cursor: mn(e),
|
|
3742
3852
|
next: e.next,
|
|
3743
|
-
returnedIds:
|
|
3853
|
+
returnedIds: Cr(e.items)
|
|
3744
3854
|
}]);
|
|
3745
3855
|
}
|
|
3746
3856
|
remove(e) {
|
|
@@ -3755,14 +3865,14 @@ var fr = class {
|
|
|
3755
3865
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
3756
3866
|
let a = this.pending ?? this.createSession(e);
|
|
3757
3867
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
3758
|
-
let e =
|
|
3868
|
+
let e = Sr(a.cursor);
|
|
3759
3869
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3760
|
-
if (await
|
|
3761
|
-
delayMs:
|
|
3870
|
+
if (await Cn({
|
|
3871
|
+
delayMs: Sn(a.pages.length, this.delay),
|
|
3762
3872
|
onChange: n,
|
|
3763
3873
|
signal: i
|
|
3764
3874
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
3765
|
-
let o =
|
|
3875
|
+
let o = un(await t({
|
|
3766
3876
|
cursor: a.cursor,
|
|
3767
3877
|
signal: i
|
|
3768
3878
|
}));
|
|
@@ -3775,7 +3885,7 @@ var fr = class {
|
|
|
3775
3885
|
contributionIds: c,
|
|
3776
3886
|
cursor: a.cursor,
|
|
3777
3887
|
next: o.next,
|
|
3778
|
-
returnedIds:
|
|
3888
|
+
returnedIds: Cr(s)
|
|
3779
3889
|
}), 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");
|
|
3780
3890
|
}
|
|
3781
3891
|
return this.result(a, "complete");
|
|
@@ -3814,7 +3924,7 @@ var fr = class {
|
|
|
3814
3924
|
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
|
|
3815
3925
|
}
|
|
3816
3926
|
recordPage(e) {
|
|
3817
|
-
let t =
|
|
3927
|
+
let t = Sr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Sr(e) === t);
|
|
3818
3928
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3819
3929
|
...e,
|
|
3820
3930
|
contributionIds: [...e.contributionIds],
|
|
@@ -3824,7 +3934,7 @@ var fr = class {
|
|
|
3824
3934
|
};
|
|
3825
3935
|
//#endregion
|
|
3826
3936
|
//#region src/core/activeItemRemoval.ts
|
|
3827
|
-
function
|
|
3937
|
+
function Tr(e, t, n, r, i) {
|
|
3828
3938
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3829
3939
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3830
3940
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3837,7 +3947,7 @@ function pr(e, t, n, r, i) {
|
|
|
3837
3947
|
}
|
|
3838
3948
|
//#endregion
|
|
3839
3949
|
//#region src/core/exactMediaRemovalController.ts
|
|
3840
|
-
function
|
|
3950
|
+
function Er(e, t) {
|
|
3841
3951
|
let [n, ...r] = t;
|
|
3842
3952
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3843
3953
|
return {
|
|
@@ -3846,10 +3956,10 @@ function mr(e, t) {
|
|
|
3846
3956
|
items: r
|
|
3847
3957
|
};
|
|
3848
3958
|
}
|
|
3849
|
-
function
|
|
3959
|
+
function Dr(e) {
|
|
3850
3960
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3851
3961
|
}
|
|
3852
|
-
var
|
|
3962
|
+
var Or = class {
|
|
3853
3963
|
generation = 0;
|
|
3854
3964
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3855
3965
|
state;
|
|
@@ -3857,7 +3967,7 @@ var gr = class {
|
|
|
3857
3967
|
this.options = e, this.state = e.state;
|
|
3858
3968
|
}
|
|
3859
3969
|
remove(e) {
|
|
3860
|
-
|
|
3970
|
+
Dr(e);
|
|
3861
3971
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3862
3972
|
if (!n) return null;
|
|
3863
3973
|
let r = [...P(n)], i = r[e.mediaIndex];
|
|
@@ -3874,7 +3984,7 @@ var gr = class {
|
|
|
3874
3984
|
restored: !1
|
|
3875
3985
|
});
|
|
3876
3986
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3877
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3987
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Er(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);
|
|
3878
3988
|
}
|
|
3879
3989
|
reset() {
|
|
3880
3990
|
this.generation += 1;
|
|
@@ -3900,7 +4010,7 @@ var gr = class {
|
|
|
3900
4010
|
}
|
|
3901
4011
|
restoreIntoPost(e, t) {
|
|
3902
4012
|
let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3903
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
4013
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Er(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3904
4014
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3905
4015
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3906
4016
|
}
|
|
@@ -3913,18 +4023,18 @@ var gr = class {
|
|
|
3913
4023
|
};
|
|
3914
4024
|
//#endregion
|
|
3915
4025
|
//#region src/core/itemPlacement.ts
|
|
3916
|
-
function
|
|
4026
|
+
function kr(e, t) {
|
|
3917
4027
|
let n = new Set(t);
|
|
3918
4028
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3919
4029
|
index: t,
|
|
3920
4030
|
item: e
|
|
3921
4031
|
}] : []);
|
|
3922
4032
|
}
|
|
3923
|
-
function
|
|
4033
|
+
function Ar(e, t) {
|
|
3924
4034
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3925
4035
|
return e.filter((e) => !n.has(e.postId));
|
|
3926
4036
|
}
|
|
3927
|
-
function
|
|
4037
|
+
function jr(e, t) {
|
|
3928
4038
|
t.forEach(({ index: e }) => {
|
|
3929
4039
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3930
4040
|
});
|
|
@@ -3935,7 +4045,7 @@ function yr(e, t) {
|
|
|
3935
4045
|
}
|
|
3936
4046
|
//#endregion
|
|
3937
4047
|
//#region src/core/itemRemovalController.ts
|
|
3938
|
-
var
|
|
4048
|
+
var Mr = 20, Nr = class {
|
|
3939
4049
|
generation = 0;
|
|
3940
4050
|
historyLimit;
|
|
3941
4051
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3944,7 +4054,7 @@ var br = 20, xr = class {
|
|
|
3944
4054
|
itemOrder;
|
|
3945
4055
|
stopItemsWatcher;
|
|
3946
4056
|
constructor(e) {
|
|
3947
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
4057
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Mr, 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" });
|
|
3948
4058
|
}
|
|
3949
4059
|
destroy() {
|
|
3950
4060
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3958,7 +4068,7 @@ var br = 20, xr = class {
|
|
|
3958
4068
|
let a = this.options.startRemoval(i, t);
|
|
3959
4069
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
3960
4070
|
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);
|
|
3961
|
-
return this.state.items =
|
|
4071
|
+
return this.state.items = Ar(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
3962
4072
|
}
|
|
3963
4073
|
reset() {
|
|
3964
4074
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3969,7 +4079,7 @@ var br = 20, xr = class {
|
|
|
3969
4079
|
this.restoreRemoval(t);
|
|
3970
4080
|
return;
|
|
3971
4081
|
}
|
|
3972
|
-
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 =
|
|
4082
|
+
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 = jr(this.state.items, r);
|
|
3973
4083
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
3974
4084
|
}
|
|
3975
4085
|
restoreRemoval(e) {
|
|
@@ -3995,7 +4105,7 @@ var br = 20, xr = class {
|
|
|
3995
4105
|
}
|
|
3996
4106
|
collectOrderedPlacements(e) {
|
|
3997
4107
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3998
|
-
return
|
|
4108
|
+
return kr(this.state.items, e).map((e) => ({
|
|
3999
4109
|
index: t.get(e.item.postId) ?? e.index,
|
|
4000
4110
|
item: e.item
|
|
4001
4111
|
}));
|
|
@@ -4026,7 +4136,7 @@ var br = 20, xr = class {
|
|
|
4026
4136
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4027
4137
|
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;
|
|
4028
4138
|
}
|
|
4029
|
-
},
|
|
4139
|
+
}, Pr = class {
|
|
4030
4140
|
forward = null;
|
|
4031
4141
|
forwardPromise = null;
|
|
4032
4142
|
forwardVersion = 0;
|
|
@@ -4113,7 +4223,7 @@ var br = 20, xr = class {
|
|
|
4113
4223
|
}
|
|
4114
4224
|
}
|
|
4115
4225
|
}
|
|
4116
|
-
},
|
|
4226
|
+
}, Fr = class {
|
|
4117
4227
|
generation = 0;
|
|
4118
4228
|
pending = Promise.resolve();
|
|
4119
4229
|
constructor(e) {
|
|
@@ -4163,24 +4273,24 @@ var br = 20, xr = class {
|
|
|
4163
4273
|
};
|
|
4164
4274
|
//#endregion
|
|
4165
4275
|
//#region src/core/removalControllers.ts
|
|
4166
|
-
function
|
|
4167
|
-
let t = new
|
|
4276
|
+
function Ir(e) {
|
|
4277
|
+
let t = new Pr(e), n = new Fr({
|
|
4168
4278
|
state: e.state,
|
|
4169
4279
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4170
4280
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4171
4281
|
});
|
|
4172
4282
|
return {
|
|
4173
|
-
exactMediaRemoval: new
|
|
4283
|
+
exactMediaRemoval: new Or({
|
|
4174
4284
|
onActivate: e.onActivate,
|
|
4175
4285
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4176
4286
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4177
4287
|
reelForward: t,
|
|
4178
4288
|
state: e.state
|
|
4179
4289
|
}),
|
|
4180
|
-
itemRemoval: new
|
|
4290
|
+
itemRemoval: new Nr({
|
|
4181
4291
|
historyLimit: e.historyLimit,
|
|
4182
4292
|
onItemsRemoved: (n, r, i) => {
|
|
4183
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4293
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Tr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4184
4294
|
},
|
|
4185
4295
|
onRemovalRestored: (n) => {
|
|
4186
4296
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4195,17 +4305,17 @@ function wr(e) {
|
|
|
4195
4305
|
reelRemoval: n
|
|
4196
4306
|
};
|
|
4197
4307
|
}
|
|
4198
|
-
var
|
|
4199
|
-
function
|
|
4308
|
+
var Lr = 1.5;
|
|
4309
|
+
function Rr(e) {
|
|
4200
4310
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4201
4311
|
if (t > 0 && t < 600) return !0;
|
|
4202
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4312
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Lr;
|
|
4203
4313
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4204
4314
|
}
|
|
4205
|
-
function
|
|
4206
|
-
return
|
|
4315
|
+
function zr(e) {
|
|
4316
|
+
return Rr(e) ? "reel" : "masonry";
|
|
4207
4317
|
}
|
|
4208
|
-
function
|
|
4318
|
+
function Br(e) {
|
|
4209
4319
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4210
4320
|
return {
|
|
4211
4321
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4215,15 +4325,15 @@ function Or(e) {
|
|
|
4215
4325
|
viewportWidth: n.clientWidth
|
|
4216
4326
|
};
|
|
4217
4327
|
}
|
|
4218
|
-
function
|
|
4219
|
-
return
|
|
4328
|
+
function Vr(e) {
|
|
4329
|
+
return Rr(Br(e));
|
|
4220
4330
|
}
|
|
4221
|
-
function
|
|
4222
|
-
return
|
|
4331
|
+
function Hr(e) {
|
|
4332
|
+
return zr(Br(e));
|
|
4223
4333
|
}
|
|
4224
4334
|
//#endregion
|
|
4225
4335
|
//#region src/core/responsiveLayoutController.ts
|
|
4226
|
-
var
|
|
4336
|
+
var Ur = class {
|
|
4227
4337
|
layoutMode;
|
|
4228
4338
|
resizeObserver = null;
|
|
4229
4339
|
target = null;
|
|
@@ -4248,10 +4358,10 @@ var jr = class {
|
|
|
4248
4358
|
}
|
|
4249
4359
|
handleResponsiveLayout = () => {
|
|
4250
4360
|
if (!this.target) return;
|
|
4251
|
-
let e =
|
|
4252
|
-
this.state.phoneMode =
|
|
4361
|
+
let e = Hr(this.target);
|
|
4362
|
+
this.state.phoneMode = Vr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4253
4363
|
};
|
|
4254
|
-
},
|
|
4364
|
+
}, Wr = class {
|
|
4255
4365
|
state;
|
|
4256
4366
|
constructor(e) {
|
|
4257
4367
|
this.options = e, this.state = x(Ze({
|
|
@@ -4265,7 +4375,7 @@ var jr = class {
|
|
|
4265
4375
|
set(e, t = !1) {
|
|
4266
4376
|
Object.assign(this.state, Ze(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4267
4377
|
}
|
|
4268
|
-
},
|
|
4378
|
+
}, Gr = class {
|
|
4269
4379
|
routedReelPostId = null;
|
|
4270
4380
|
reelRouteIsActive = !1;
|
|
4271
4381
|
constructor(e, t) {
|
|
@@ -4292,7 +4402,7 @@ var jr = class {
|
|
|
4292
4402
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
4293
4403
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
4294
4404
|
}
|
|
4295
|
-
},
|
|
4405
|
+
}, Kr = class {
|
|
4296
4406
|
app = null;
|
|
4297
4407
|
autoScroll;
|
|
4298
4408
|
autofillController;
|
|
@@ -4315,24 +4425,24 @@ var jr = class {
|
|
|
4315
4425
|
reelAudio;
|
|
4316
4426
|
state;
|
|
4317
4427
|
constructor(e) {
|
|
4318
|
-
this.options = e,
|
|
4428
|
+
this.options = e, yr(e);
|
|
4319
4429
|
let t = e.layout ?? "masonry";
|
|
4320
|
-
this.state = x(
|
|
4430
|
+
this.state = x(gr(e, t)), this.reelAudio = new Wr(e), this.lastLoadedCursor = e.initialPage ? mn(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new Bn({
|
|
4321
4431
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4322
4432
|
state: this.state.autoScroll
|
|
4323
|
-
}), this.autofillController = new
|
|
4433
|
+
}), this.autofillController = new Pn({
|
|
4324
4434
|
cancelRequest: () => this.cancelRequest(),
|
|
4325
4435
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4326
4436
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4327
4437
|
options: e.autofill,
|
|
4328
4438
|
state: this.state
|
|
4329
|
-
}), this.removalReconciliation = new
|
|
4439
|
+
}), this.removalReconciliation = new wr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new sr({
|
|
4330
4440
|
fill: e.fill,
|
|
4331
4441
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4332
4442
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4333
4443
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4334
4444
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4335
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4445
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => cr({
|
|
4336
4446
|
controller: this.removalReconciliation,
|
|
4337
4447
|
isCurrent: t,
|
|
4338
4448
|
loadPage: e.loadPage,
|
|
@@ -4342,8 +4452,8 @@ var jr = class {
|
|
|
4342
4452
|
state: this.state
|
|
4343
4453
|
}),
|
|
4344
4454
|
state: this.state
|
|
4345
|
-
}), this.routing = new
|
|
4346
|
-
let n =
|
|
4455
|
+
}), this.routing = new Gr(e.routing, this.state);
|
|
4456
|
+
let n = Ir({
|
|
4347
4457
|
historyLimit: e.removalHistoryLimit,
|
|
4348
4458
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4349
4459
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
@@ -4352,20 +4462,20 @@ var jr = class {
|
|
|
4352
4462
|
state: this.state,
|
|
4353
4463
|
surface: () => this.surface
|
|
4354
4464
|
});
|
|
4355
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
4465
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Ur(t, this.state, () => {
|
|
4356
4466
|
this.routing.syncFeed();
|
|
4357
4467
|
}), this.startStateNotifications();
|
|
4358
4468
|
}
|
|
4359
4469
|
async mount() {
|
|
4360
4470
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4361
4471
|
this.startStateNotifications();
|
|
4362
|
-
let e =
|
|
4363
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4472
|
+
let e = br(this.options.target);
|
|
4473
|
+
this.responsiveLayout.mount(e), this.app = i(ln, {
|
|
4364
4474
|
canRetryEnd: !!this.options.loadPage,
|
|
4365
4475
|
cardFooter: this.options.cardFooter,
|
|
4366
4476
|
cardHeader: this.options.cardHeader,
|
|
4367
4477
|
feedFooter: this.options.feedFooter,
|
|
4368
|
-
feedFooterActions:
|
|
4478
|
+
feedFooterActions: lr(this),
|
|
4369
4479
|
mediaCard: this.options.mediaCard,
|
|
4370
4480
|
masonry: this.options.masonry,
|
|
4371
4481
|
onMediaReady: this.options.onMediaReady,
|
|
@@ -4390,7 +4500,7 @@ var jr = class {
|
|
|
4390
4500
|
onRetryForward: () => {
|
|
4391
4501
|
this.retryReelForward();
|
|
4392
4502
|
}
|
|
4393
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
4503
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await Gn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
4394
4504
|
this.restoreController = e;
|
|
4395
4505
|
}), !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();
|
|
4396
4506
|
}
|
|
@@ -4461,7 +4571,7 @@ var jr = class {
|
|
|
4461
4571
|
this.autoScroll.setSpeed(e);
|
|
4462
4572
|
}
|
|
4463
4573
|
applyAutofillUpdate(e) {
|
|
4464
|
-
let t =
|
|
4574
|
+
let t = Un(this.options.autofill, this.state, e);
|
|
4465
4575
|
return t && this.autofillController.syncCountdown(), t;
|
|
4466
4576
|
}
|
|
4467
4577
|
cancelAutofill() {
|
|
@@ -4472,7 +4582,7 @@ var jr = class {
|
|
|
4472
4582
|
await this.cancelFill();
|
|
4473
4583
|
return;
|
|
4474
4584
|
}
|
|
4475
|
-
if (
|
|
4585
|
+
if (An(this.state.autofill)) {
|
|
4476
4586
|
await this.cancelAutofill();
|
|
4477
4587
|
return;
|
|
4478
4588
|
}
|
|
@@ -4486,12 +4596,12 @@ var jr = class {
|
|
|
4486
4596
|
}
|
|
4487
4597
|
async fill(e) {
|
|
4488
4598
|
if (!this.state.loadMoreLocked) {
|
|
4489
|
-
if (this.pendingRequest ||
|
|
4599
|
+
if (this.pendingRequest || An(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4490
4600
|
await this.fillController.start(e);
|
|
4491
4601
|
}
|
|
4492
4602
|
}
|
|
4493
4603
|
restoreAutofillSession(e) {
|
|
4494
|
-
let t =
|
|
4604
|
+
let t = Wn(this.options.autofill, this.state, e);
|
|
4495
4605
|
return t && this.autofillController.syncCountdown(), t;
|
|
4496
4606
|
}
|
|
4497
4607
|
restoreFillSession(e) {
|
|
@@ -4501,14 +4611,14 @@ var jr = class {
|
|
|
4501
4611
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
4502
4612
|
}
|
|
4503
4613
|
appendPage(e) {
|
|
4504
|
-
|
|
4614
|
+
hn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
4505
4615
|
}
|
|
4506
4616
|
replenishAfterRemoval() {
|
|
4507
4617
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
4508
4618
|
}
|
|
4509
4619
|
async startLoadMore(e) {
|
|
4510
4620
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4511
|
-
if (this.state.loadMoreLocked ||
|
|
4621
|
+
if (this.state.loadMoreLocked || An(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
4512
4622
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4513
4623
|
let t = e();
|
|
4514
4624
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -4523,12 +4633,12 @@ var jr = class {
|
|
|
4523
4633
|
}
|
|
4524
4634
|
async replaceFeed(e, t) {
|
|
4525
4635
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4526
|
-
return
|
|
4636
|
+
return An(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = kn(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.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);
|
|
4527
4637
|
}
|
|
4528
4638
|
async loadFilteredPage(e) {
|
|
4529
4639
|
let t = this.options.loadPage;
|
|
4530
4640
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4531
|
-
let n =
|
|
4641
|
+
let n = un(await t(e));
|
|
4532
4642
|
return {
|
|
4533
4643
|
...n,
|
|
4534
4644
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4547,7 +4657,7 @@ var jr = class {
|
|
|
4547
4657
|
let t = ++this.requestVersion, n = new AbortController();
|
|
4548
4658
|
this.abortController = n;
|
|
4549
4659
|
try {
|
|
4550
|
-
let r = await
|
|
4660
|
+
let r = await cr({
|
|
4551
4661
|
controller: this.removalReconciliation,
|
|
4552
4662
|
isCurrent: () => t === this.requestVersion,
|
|
4553
4663
|
loadPage: e,
|
|
@@ -4565,7 +4675,7 @@ var jr = class {
|
|
|
4565
4675
|
}
|
|
4566
4676
|
async retryEnd() {
|
|
4567
4677
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4568
|
-
if (!this.state.loadMoreLocked && !(
|
|
4678
|
+
if (!this.state.loadMoreLocked && !(An(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);
|
|
4569
4679
|
}
|
|
4570
4680
|
setInfiniteScroll(e) {
|
|
4571
4681
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4589,10 +4699,10 @@ var jr = class {
|
|
|
4589
4699
|
this.state.total = e;
|
|
4590
4700
|
}
|
|
4591
4701
|
setReelAutoAdvance(e) {
|
|
4592
|
-
|
|
4702
|
+
pr(this.state.reelAutoAdvance, e);
|
|
4593
4703
|
}
|
|
4594
4704
|
setReelInfoSheet(e) {
|
|
4595
|
-
|
|
4705
|
+
hr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4596
4706
|
}
|
|
4597
4707
|
setLayout(e) {
|
|
4598
4708
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4612,7 +4722,7 @@ var jr = class {
|
|
|
4612
4722
|
async fetchPage(e, t) {
|
|
4613
4723
|
if (!this.options.loadPage) return;
|
|
4614
4724
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4615
|
-
this.abortController = r, await
|
|
4725
|
+
this.abortController = r, await xr({
|
|
4616
4726
|
append: t,
|
|
4617
4727
|
autofillController: this.autofillController,
|
|
4618
4728
|
cursor: e,
|
|
@@ -4634,7 +4744,7 @@ var jr = class {
|
|
|
4634
4744
|
startInitialAutofill() {
|
|
4635
4745
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4636
4746
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4637
|
-
let r =
|
|
4747
|
+
let r = Kn({
|
|
4638
4748
|
cycleId: n,
|
|
4639
4749
|
isCurrent: () => e === this.requestVersion,
|
|
4640
4750
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4661,8 +4771,8 @@ var jr = class {
|
|
|
4661
4771
|
this.lastLoadedCursor = e, this.state.current = e;
|
|
4662
4772
|
}
|
|
4663
4773
|
};
|
|
4664
|
-
function
|
|
4665
|
-
return new
|
|
4774
|
+
function qr(e) {
|
|
4775
|
+
return new Kr(e);
|
|
4666
4776
|
}
|
|
4667
4777
|
//#endregion
|
|
4668
|
-
export {
|
|
4778
|
+
export { qr as createVibe };
|