@wyxos/vibe 5.1.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/MasonryFeed.vue.d.ts +4 -2
- package/lib/components/MediaCard.vue.d.ts +2 -2
- package/lib/components/ReelFeed.vue.d.ts +2 -2
- package/lib/components/ReelLayout.vue.d.ts +2 -2
- package/lib/components/VibeSurface.vue.d.ts +2 -0
- package/lib/components/useMediaLifecycle.d.ts +19 -0
- package/lib/core/autofill.d.ts +6 -2
- package/lib/core/autofillController.d.ts +2 -0
- package/lib/core/exactMediaRemovalController.d.ts +2 -0
- package/lib/core/fill.d.ts +9 -3
- package/lib/core/fillController.d.ts +4 -0
- package/lib/core/initialAutofill.d.ts +3 -1
- package/lib/core/page.d.ts +7 -1
- package/lib/core/pageRequest.d.ts +18 -0
- package/lib/core/removalControllers.d.ts +2 -0
- package/lib/core/removalReconciliationController.d.ts +41 -0
- package/lib/core/runtime.d.ts +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1142 -815
- package/lib/types.d.ts +12 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -13,39 +13,8 @@ function F(e, t) {
|
|
|
13
13
|
return `${String(e)}:${t}`;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
|
-
//#region src/core/mediaLifecycle.ts
|
|
17
|
-
function I(e, t, n, r, i) {
|
|
18
|
-
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
19
|
-
if (!o) return null;
|
|
20
|
-
let s = N(o, n), c = P(o, s);
|
|
21
|
-
return {
|
|
22
|
-
item: o,
|
|
23
|
-
layout: r,
|
|
24
|
-
media: c,
|
|
25
|
-
mediaId: c.mediaId ?? null,
|
|
26
|
-
mediaIndex: s,
|
|
27
|
-
origin: i,
|
|
28
|
-
postId: o.postId,
|
|
29
|
-
postIndex: a
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function L(e, t) {
|
|
33
|
-
O(() => {
|
|
34
|
-
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
35
|
-
return {
|
|
36
|
-
mediaIndex: t === null ? 0 : e.mediaIndices.get(t) ?? 0,
|
|
37
|
-
origin: e.reelOrigin ?? "reel",
|
|
38
|
-
postId: t
|
|
39
|
-
};
|
|
40
|
-
}, (n, r) => {
|
|
41
|
-
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
42
|
-
let i = I(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
43
|
-
i && t(i);
|
|
44
|
-
}, { flush: "sync" });
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
16
|
//#region src/core/runtime.ts
|
|
48
|
-
function
|
|
17
|
+
function I(e) {
|
|
49
18
|
return {
|
|
50
19
|
activeReelPostId: e.activeReelPostId,
|
|
51
20
|
autoScroll: { ...e.autoScroll },
|
|
@@ -64,6 +33,7 @@ function R(e) {
|
|
|
64
33
|
loadMoreLocked: e.loadMoreLocked,
|
|
65
34
|
next: e.next,
|
|
66
35
|
nextPageError: e.nextPageError,
|
|
36
|
+
phoneMode: e.phoneMode,
|
|
67
37
|
reelAutoAdvance: { ...e.reelAutoAdvance },
|
|
68
38
|
reelForward: { ...e.reelForward },
|
|
69
39
|
reelInfoSheet: { ...e.reelInfoSheet },
|
|
@@ -73,17 +43,17 @@ function R(e) {
|
|
|
73
43
|
}
|
|
74
44
|
//#endregion
|
|
75
45
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
76
|
-
var
|
|
46
|
+
var L = {
|
|
77
47
|
key: 0,
|
|
78
48
|
class: "gallery-footer"
|
|
79
|
-
},
|
|
49
|
+
}, R = {
|
|
80
50
|
key: 0,
|
|
81
51
|
class: "load-more-status",
|
|
82
52
|
role: "status"
|
|
83
|
-
},
|
|
53
|
+
}, z = ["disabled"], B = {
|
|
84
54
|
key: 2,
|
|
85
55
|
class: "end-feed"
|
|
86
|
-
},
|
|
56
|
+
}, V = ["disabled"], H = /* @__PURE__ */ d({
|
|
87
57
|
__name: "GalleryFooter",
|
|
88
58
|
props: {
|
|
89
59
|
canRetryEnd: { type: Boolean },
|
|
@@ -99,14 +69,14 @@ var z = {
|
|
|
99
69
|
function i() {
|
|
100
70
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
101
71
|
}
|
|
102
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer",
|
|
72
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", L, [e.isLoading ? (b(), s("p", R, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
|
|
103
73
|
key: 1,
|
|
104
74
|
"data-test": "load-more",
|
|
105
75
|
class: "load-more-button",
|
|
106
76
|
type: "button",
|
|
107
77
|
disabled: e.loadMoreLocked,
|
|
108
78
|
onClick: i
|
|
109
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
79
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, z)) : (b(), s("div", B, [n[1] ||= c("p", {
|
|
110
80
|
class: "end-feed-message",
|
|
111
81
|
role: "status"
|
|
112
82
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -115,9 +85,9 @@ var z = {
|
|
|
115
85
|
type: "button",
|
|
116
86
|
disabled: e.loadMoreLocked,
|
|
117
87
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
118
|
-
}, " Check for more ", 8,
|
|
88
|
+
}, " Check for more ", 8, V)]))])) : o("", !0);
|
|
119
89
|
}
|
|
120
|
-
}),
|
|
90
|
+
}), U = /* @__PURE__ */ d({
|
|
121
91
|
__name: "FeedFooter",
|
|
122
92
|
props: {
|
|
123
93
|
actions: {},
|
|
@@ -154,7 +124,7 @@ var z = {
|
|
|
154
124
|
"can-retry-end",
|
|
155
125
|
"show-load-more",
|
|
156
126
|
"state"
|
|
157
|
-
])) : (b(), a(
|
|
127
|
+
])) : (b(), a(H, {
|
|
158
128
|
key: 1,
|
|
159
129
|
"can-retry-end": e.canRetryEnd,
|
|
160
130
|
"has-error": e.hasError,
|
|
@@ -173,7 +143,7 @@ var z = {
|
|
|
173
143
|
"show-load-more"
|
|
174
144
|
]));
|
|
175
145
|
}
|
|
176
|
-
}),
|
|
146
|
+
}), W = ["role"], G = { class: "gallery-status" }, ee = /* @__PURE__ */ d({
|
|
177
147
|
__name: "FeedStatus",
|
|
178
148
|
props: {
|
|
179
149
|
actions: {},
|
|
@@ -187,7 +157,7 @@ var z = {
|
|
|
187
157
|
return (n, u) => (b(), s("main", {
|
|
188
158
|
class: "gallery-shell",
|
|
189
159
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
190
|
-
}, [c("p",
|
|
160
|
+
}, [c("p", G, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(U, {
|
|
191
161
|
key: 0,
|
|
192
162
|
actions: t.actions,
|
|
193
163
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -209,36 +179,36 @@ var z = {
|
|
|
209
179
|
"is-loading",
|
|
210
180
|
"load-more-locked",
|
|
211
181
|
"state"
|
|
212
|
-
])) : o("", !0)], 8,
|
|
182
|
+
])) : o("", !0)], 8, W));
|
|
213
183
|
}
|
|
214
184
|
});
|
|
215
|
-
function
|
|
185
|
+
function K(e) {
|
|
216
186
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
217
187
|
}
|
|
218
188
|
//#endregion
|
|
219
189
|
//#region src/core/masonry.ts
|
|
220
|
-
function
|
|
190
|
+
function q(e) {
|
|
221
191
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
222
192
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
223
193
|
}
|
|
224
|
-
function
|
|
194
|
+
function te(e) {
|
|
225
195
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
226
196
|
}
|
|
227
|
-
function
|
|
197
|
+
function ne(e) {
|
|
228
198
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
229
199
|
}
|
|
230
|
-
function
|
|
200
|
+
function re(e, t) {
|
|
231
201
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
|
|
232
202
|
return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
|
|
233
203
|
}
|
|
234
|
-
function
|
|
204
|
+
function ie(e, t, n) {
|
|
235
205
|
if (t <= 0 || e.length === 0) return {
|
|
236
206
|
columns: 0,
|
|
237
207
|
height: 0,
|
|
238
208
|
items: []
|
|
239
209
|
};
|
|
240
210
|
let r = Math.max(0, n.gap), i = Number.isFinite(n.additionalHeight) ? Math.max(0, n.additionalHeight ?? 0) : 0, a = Math.max(1, n.minColumnWidth), o = Math.max(1, Math.floor((t + r) / (a + r))), s = (t - r * (o - 1)) / o, c = Array.from({ length: o }, () => 0), l = e.map((e) => {
|
|
241
|
-
let t =
|
|
211
|
+
let t = te(c), n = s * q(e) + i, a = {
|
|
242
212
|
x: t * (s + r),
|
|
243
213
|
y: c[t],
|
|
244
214
|
width: s,
|
|
@@ -254,10 +224,10 @@ function K(e, t, n) {
|
|
|
254
224
|
}
|
|
255
225
|
//#endregion
|
|
256
226
|
//#region src/core/scrollbar.ts
|
|
257
|
-
function
|
|
227
|
+
function ae(e, t, n) {
|
|
258
228
|
return Math.min(n, Math.max(t, e));
|
|
259
229
|
}
|
|
260
|
-
function
|
|
230
|
+
function oe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
261
231
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
262
232
|
if (!(c > 0 && o > 0)) return {
|
|
263
233
|
maximumScrollPosition: c,
|
|
@@ -266,23 +236,23 @@ function ce({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
266
236
|
thumbSize: o,
|
|
267
237
|
thumbTravel: 0
|
|
268
238
|
};
|
|
269
|
-
let l =
|
|
239
|
+
let l = ae(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
270
240
|
return {
|
|
271
241
|
maximumScrollPosition: c,
|
|
272
242
|
scrollable: !0,
|
|
273
|
-
thumbOffset: u * (
|
|
243
|
+
thumbOffset: u * (ae(n, 0, c) / c),
|
|
274
244
|
thumbSize: l,
|
|
275
245
|
thumbTravel: u
|
|
276
246
|
};
|
|
277
247
|
}
|
|
278
248
|
//#endregion
|
|
279
249
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
280
|
-
var
|
|
250
|
+
var se = ["aria-hidden"], J = [
|
|
281
251
|
"aria-controls",
|
|
282
252
|
"aria-valuemax",
|
|
283
253
|
"aria-valuenow",
|
|
284
254
|
"tabindex"
|
|
285
|
-
],
|
|
255
|
+
], ce = 32, Y = 40, le = 120, ue = /* @__PURE__ */ d({
|
|
286
256
|
__name: "GalleryScrollbar",
|
|
287
257
|
props: {
|
|
288
258
|
contentSize: {},
|
|
@@ -304,16 +274,16 @@ var le = ["aria-hidden"], J = [
|
|
|
304
274
|
function k() {
|
|
305
275
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
306
276
|
g = null, o.value || (l.value = !1);
|
|
307
|
-
},
|
|
277
|
+
}, le);
|
|
308
278
|
}
|
|
309
279
|
function A() {
|
|
310
280
|
l.value = !0, k();
|
|
311
281
|
}
|
|
312
282
|
function j() {
|
|
313
283
|
let e = t.scrollElement, r = i.value;
|
|
314
|
-
return !e || !r ? n :
|
|
284
|
+
return !e || !r ? n : oe({
|
|
315
285
|
contentSize: e.scrollHeight,
|
|
316
|
-
minimumThumbSize:
|
|
286
|
+
minimumThumbSize: ce,
|
|
317
287
|
scrollPosition: e.scrollTop,
|
|
318
288
|
trackSize: r.clientHeight,
|
|
319
289
|
viewportSize: e.clientHeight
|
|
@@ -366,7 +336,7 @@ var le = ["aria-hidden"], J = [
|
|
|
366
336
|
}
|
|
367
337
|
function z(e) {
|
|
368
338
|
if (!E.value) return;
|
|
369
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
339
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - Y : e.key === "ArrowDown" ? r + Y : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
370
340
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
371
341
|
}
|
|
372
342
|
function B(e) {
|
|
@@ -412,15 +382,15 @@ var le = ["aria-hidden"], J = [
|
|
|
412
382
|
onPointerdown: I,
|
|
413
383
|
onPointermove: L,
|
|
414
384
|
onPointerup: R
|
|
415
|
-
}, null, 44, J)], 42,
|
|
385
|
+
}, null, 44, J)], 42, se));
|
|
416
386
|
}
|
|
417
|
-
}),
|
|
387
|
+
}), de = (e) => {
|
|
418
388
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
419
389
|
return !1;
|
|
420
|
-
},
|
|
421
|
-
let t =
|
|
390
|
+
}, fe = (e) => e === "", pe = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), X = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), me = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), he = (e) => {
|
|
391
|
+
let t = me(e);
|
|
422
392
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
423
|
-
},
|
|
393
|
+
}, ge = {
|
|
424
394
|
xmlns: "http://www.w3.org/2000/svg",
|
|
425
395
|
width: 24,
|
|
426
396
|
height: 24,
|
|
@@ -430,27 +400,27 @@ var le = ["aria-hidden"], J = [
|
|
|
430
400
|
"stroke-width": 2,
|
|
431
401
|
"stroke-linecap": "round",
|
|
432
402
|
"stroke-linejoin": "round"
|
|
433
|
-
},
|
|
434
|
-
...
|
|
403
|
+
}, _e = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = ge.width, color: s = ge.stroke, ...c }, { slots: l }) => p("svg", {
|
|
404
|
+
...ge,
|
|
435
405
|
...c,
|
|
436
406
|
width: o,
|
|
437
407
|
height: o,
|
|
438
408
|
stroke: s,
|
|
439
|
-
"stroke-width":
|
|
440
|
-
class: pe("lucide", c.class, ...e ? [`lucide-${
|
|
441
|
-
...!l.default && !
|
|
442
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
409
|
+
"stroke-width": fe(n) || fe(r) || n === !0 || r === !0 ? Number(i || a || ge["stroke-width"]) * 24 / Number(o) : i || a || ge["stroke-width"],
|
|
410
|
+
class: pe("lucide", c.class, ...e ? [`lucide-${X(he(e))}-icon`, `lucide-${X(e)}`] : ["lucide-icon"]),
|
|
411
|
+
...!l.default && !de(c) && { "aria-hidden": "true" }
|
|
412
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), ve = (e, t) => (n, { slots: r, attrs: i }) => p(_e, {
|
|
443
413
|
...i,
|
|
444
414
|
...n,
|
|
445
415
|
iconNode: t,
|
|
446
416
|
name: e
|
|
447
|
-
}, r),
|
|
417
|
+
}, r), ye = ve("chevron-left", [["path", {
|
|
448
418
|
d: "m15 18-6-6 6-6",
|
|
449
419
|
key: "1wnfg3"
|
|
450
|
-
}]]),
|
|
420
|
+
}]]), be = ve("chevron-right", [["path", {
|
|
451
421
|
d: "m9 18 6-6-6-6",
|
|
452
422
|
key: "mthhwq"
|
|
453
|
-
}]]),
|
|
423
|
+
}]]), xe = ve("pause", [["rect", {
|
|
454
424
|
x: "14",
|
|
455
425
|
y: "3",
|
|
456
426
|
width: "5",
|
|
@@ -464,10 +434,10 @@ var le = ["aria-hidden"], J = [
|
|
|
464
434
|
height: "18",
|
|
465
435
|
rx: "1",
|
|
466
436
|
key: "1wsw3u"
|
|
467
|
-
}]]),
|
|
437
|
+
}]]), Se = ve("play", [["path", {
|
|
468
438
|
d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
|
|
469
439
|
key: "10ikf1"
|
|
470
|
-
}]]),
|
|
440
|
+
}]]), Ce = ve("volume-2", [
|
|
471
441
|
["path", {
|
|
472
442
|
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
473
443
|
key: "uqj9uw"
|
|
@@ -480,7 +450,7 @@ var le = ["aria-hidden"], J = [
|
|
|
480
450
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
481
451
|
key: "ijwkga"
|
|
482
452
|
}]
|
|
483
|
-
]),
|
|
453
|
+
]), we = ve("volume-x", [
|
|
484
454
|
["path", {
|
|
485
455
|
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
486
456
|
key: "uqj9uw"
|
|
@@ -499,32 +469,32 @@ var le = ["aria-hidden"], J = [
|
|
|
499
469
|
y2: "15",
|
|
500
470
|
key: "5ykzw1"
|
|
501
471
|
}]
|
|
502
|
-
]),
|
|
472
|
+
]), Te = {
|
|
503
473
|
401: "Authentication required",
|
|
504
474
|
403: "Access forbidden",
|
|
505
475
|
404: "Preview not found",
|
|
506
476
|
419: "Session expired",
|
|
507
477
|
500: "Server error"
|
|
508
478
|
};
|
|
509
|
-
function
|
|
479
|
+
function Ee(e) {
|
|
510
480
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
511
481
|
}
|
|
512
|
-
function
|
|
513
|
-
return Ee
|
|
482
|
+
function De(e) {
|
|
483
|
+
return Te[Ee(e)] ?? "Preview unavailable";
|
|
514
484
|
}
|
|
515
485
|
//#endregion
|
|
516
486
|
//#region src/core/mediaType.ts
|
|
517
|
-
var
|
|
518
|
-
function
|
|
487
|
+
var Oe = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
488
|
+
function ke(e) {
|
|
519
489
|
try {
|
|
520
|
-
return
|
|
490
|
+
return Oe.test(new URL(e).pathname);
|
|
521
491
|
} catch {
|
|
522
|
-
return
|
|
492
|
+
return Oe.test(e.split("?")[0] ?? e);
|
|
523
493
|
}
|
|
524
494
|
}
|
|
525
495
|
//#endregion
|
|
526
496
|
//#region src/components/CardRegion.vue
|
|
527
|
-
var
|
|
497
|
+
var Ae = /* @__PURE__ */ d({
|
|
528
498
|
__name: "CardRegion",
|
|
529
499
|
props: {
|
|
530
500
|
index: {},
|
|
@@ -571,18 +541,18 @@ var je = /* @__PURE__ */ d({
|
|
|
571
541
|
"total"
|
|
572
542
|
]))], 38));
|
|
573
543
|
}
|
|
574
|
-
}),
|
|
544
|
+
}), je = [
|
|
575
545
|
"max",
|
|
576
546
|
"value",
|
|
577
547
|
"aria-valuetext",
|
|
578
548
|
"disabled"
|
|
579
|
-
],
|
|
549
|
+
], Me = {
|
|
580
550
|
key: 0,
|
|
581
551
|
class: "media-controls-row"
|
|
582
|
-
},
|
|
552
|
+
}, Ne = ["aria-label", "title"], Pe = { class: "media-controls-audio" }, Fe = ["aria-label", "title"], Ie = ["value", "aria-valuetext"], Le = {
|
|
583
553
|
class: "media-control-time",
|
|
584
554
|
"aria-live": "off"
|
|
585
|
-
},
|
|
555
|
+
}, Re = /* @__PURE__ */ d({
|
|
586
556
|
__name: "MediaControls",
|
|
587
557
|
props: {
|
|
588
558
|
currentTime: {},
|
|
@@ -630,35 +600,35 @@ var je = /* @__PURE__ */ d({
|
|
|
630
600
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
631
601
|
disabled: f.value <= 0,
|
|
632
602
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
633
|
-
}, null, 44,
|
|
603
|
+
}, null, 44, je), e.layout === "reel" ? (b(), s("div", Me, [
|
|
634
604
|
c("button", {
|
|
635
605
|
type: "button",
|
|
636
606
|
class: "media-control-button media-control-playback",
|
|
637
607
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
638
608
|
title: e.playing ? "Pause" : "Play",
|
|
639
609
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
640
|
-
}, [e.playing ? (b(), a(E(
|
|
610
|
+
}, [e.playing ? (b(), a(E(xe), {
|
|
641
611
|
key: 0,
|
|
642
612
|
size: 18,
|
|
643
613
|
fill: "currentColor"
|
|
644
|
-
})) : (b(), a(E(
|
|
614
|
+
})) : (b(), a(E(Se), {
|
|
645
615
|
key: 1,
|
|
646
616
|
size: 18,
|
|
647
617
|
fill: "currentColor"
|
|
648
|
-
}))], 8,
|
|
649
|
-
c("div",
|
|
618
|
+
}))], 8, Ne),
|
|
619
|
+
c("div", Pe, [c("button", {
|
|
650
620
|
type: "button",
|
|
651
621
|
class: "media-control-button",
|
|
652
622
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
653
623
|
title: e.muted ? "Unmute" : "Mute",
|
|
654
624
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
655
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
625
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(we), {
|
|
656
626
|
key: 0,
|
|
657
627
|
size: 18
|
|
658
|
-
})) : (b(), a(E(
|
|
628
|
+
})) : (b(), a(E(Ce), {
|
|
659
629
|
key: 1,
|
|
660
630
|
size: 18
|
|
661
|
-
}))], 8,
|
|
631
|
+
}))], 8, Fe), c("input", {
|
|
662
632
|
class: "media-control-range media-control-volume",
|
|
663
633
|
type: "range",
|
|
664
634
|
min: "0",
|
|
@@ -669,14 +639,14 @@ var je = /* @__PURE__ */ d({
|
|
|
669
639
|
"aria-label": "Video volume",
|
|
670
640
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
671
641
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
672
|
-
}, null, 44,
|
|
673
|
-
c("output",
|
|
642
|
+
}, null, 44, Ie)]),
|
|
643
|
+
c("output", Le, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
674
644
|
])) : o("", !0)], 34));
|
|
675
645
|
}
|
|
676
646
|
});
|
|
677
647
|
//#endregion
|
|
678
648
|
//#region src/components/useReelVideoActivity.ts
|
|
679
|
-
function
|
|
649
|
+
function ze(e) {
|
|
680
650
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
681
651
|
function i() {
|
|
682
652
|
if (!t.value) {
|
|
@@ -710,7 +680,7 @@ function Be(e) {
|
|
|
710
680
|
}
|
|
711
681
|
//#endregion
|
|
712
682
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
713
|
-
var
|
|
683
|
+
var Be = [
|
|
714
684
|
"data-post-id",
|
|
715
685
|
"data-media-index",
|
|
716
686
|
"aria-hidden",
|
|
@@ -718,12 +688,12 @@ var Ve = [
|
|
|
718
688
|
"inert",
|
|
719
689
|
"role",
|
|
720
690
|
"tabindex"
|
|
721
|
-
],
|
|
691
|
+
], Ve = { class: "media-card-content" }, He = ["data-media-direction"], Ue = ["data-media-index"], We = {
|
|
722
692
|
key: 0,
|
|
723
693
|
"data-test": "media-loading",
|
|
724
694
|
class: "media-loading",
|
|
725
695
|
"aria-hidden": "true"
|
|
726
|
-
},
|
|
696
|
+
}, Ge = ["aria-label"], Ke = { class: "media-error-code" }, qe = [
|
|
727
697
|
"src",
|
|
728
698
|
"width",
|
|
729
699
|
"height",
|
|
@@ -731,12 +701,12 @@ var Ve = [
|
|
|
731
701
|
"loop",
|
|
732
702
|
"muted",
|
|
733
703
|
"preload"
|
|
734
|
-
],
|
|
704
|
+
], Je = [
|
|
735
705
|
"src",
|
|
736
706
|
"width",
|
|
737
707
|
"height",
|
|
738
708
|
"fetchpriority"
|
|
739
|
-
],
|
|
709
|
+
], Ye = ["aria-label"], Xe = ["aria-label"], Ze = ["aria-label"], Qe = 40, $e = 160, et = 24, tt = /* @__PURE__ */ d({
|
|
740
710
|
__name: "MediaCard",
|
|
741
711
|
props: {
|
|
742
712
|
active: { type: Boolean },
|
|
@@ -772,52 +742,52 @@ var Ve = [
|
|
|
772
742
|
function S(e = !1, t = "pointer") {
|
|
773
743
|
e && x("activate", t);
|
|
774
744
|
}
|
|
775
|
-
let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1),
|
|
745
|
+
let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1), U = w(1), W = 1, { effectiveMuted: G, onPlaying: ee, playbackAllowed: K } = ze({
|
|
776
746
|
active: () => l.active,
|
|
777
747
|
layout: () => l.layout,
|
|
778
748
|
videoElement: R,
|
|
779
749
|
videoIsMuted: V,
|
|
780
750
|
videoIsPlaying: H
|
|
781
|
-
}),
|
|
782
|
-
function
|
|
751
|
+
}), q = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
752
|
+
function te(e) {
|
|
783
753
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
784
754
|
}
|
|
785
|
-
function
|
|
755
|
+
function ne(e, t) {
|
|
786
756
|
let n = C.value.length, r = (e + n) % n;
|
|
787
757
|
r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
788
758
|
}
|
|
789
|
-
function
|
|
759
|
+
function re(e, t, n) {
|
|
790
760
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
791
761
|
}
|
|
792
|
-
function
|
|
762
|
+
function ie() {
|
|
793
763
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
794
764
|
}
|
|
795
|
-
function
|
|
796
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
765
|
+
function ae() {
|
|
766
|
+
d !== null && clearTimeout(d), d = setTimeout(ie, $e);
|
|
797
767
|
}
|
|
798
|
-
function
|
|
768
|
+
function oe(e) {
|
|
799
769
|
if (C.value.length <= 1) return;
|
|
800
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
801
|
-
if (n === 0 || (e.preventDefault(),
|
|
770
|
+
let t = e.currentTarget?.clientWidth || 1, n = re(e.deltaX, e.deltaMode, t);
|
|
771
|
+
if (n === 0 || (e.preventDefault(), ae(), p) || (f += n, Math.abs(f) < et)) return;
|
|
802
772
|
let r = Math.sign(f);
|
|
803
|
-
f = 0, p = !0,
|
|
773
|
+
f = 0, p = !0, ne(D.value + r);
|
|
804
774
|
}
|
|
805
|
-
function
|
|
775
|
+
function se(e) {
|
|
806
776
|
let t = e.touches[0];
|
|
807
777
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
808
778
|
}
|
|
809
|
-
function
|
|
779
|
+
function J(e) {
|
|
810
780
|
let t = e.changedTouches[0];
|
|
811
781
|
if (m === null || g === null || !t) return;
|
|
812
782
|
let n = m - t.clientX, r = g - t.clientY;
|
|
813
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
783
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Qe || ne(D.value + Math.sign(n)));
|
|
814
784
|
}
|
|
815
|
-
let
|
|
816
|
-
function
|
|
785
|
+
let ce = r(() => ke(F.value)), Y = r(() => l.layout === "reel" && l.stationaryReelControls === !0), le = r(() => ce.value && l.previewState === "ready" && (!Y.value || !!(l.active && l.reelControlsTarget))), ue = r(() => `${l.item.postId}:${D.value}:${F.value}`);
|
|
786
|
+
function de(e) {
|
|
817
787
|
l.layout === "reel" && (e.stopPropagation(), fe());
|
|
818
788
|
}
|
|
819
789
|
async function fe() {
|
|
820
|
-
if (!(!R.value || !
|
|
790
|
+
if (!(!R.value || !K.value)) {
|
|
821
791
|
if (H.value) {
|
|
822
792
|
R.value.pause();
|
|
823
793
|
return;
|
|
@@ -829,35 +799,35 @@ var Ve = [
|
|
|
829
799
|
}
|
|
830
800
|
}
|
|
831
801
|
}
|
|
832
|
-
function
|
|
802
|
+
function pe(e) {
|
|
833
803
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
834
804
|
}
|
|
835
|
-
function
|
|
805
|
+
function X(e) {
|
|
836
806
|
let t = e?.currentTarget ?? R.value;
|
|
837
|
-
t && (z.value =
|
|
807
|
+
t && (z.value = pe(t.currentTime), B.value = pe(t.duration), K.value && (V.value = t.muted), U.value = t.volume, t.volume > 0 && (W = t.volume));
|
|
838
808
|
}
|
|
839
|
-
function
|
|
840
|
-
|
|
809
|
+
function me(e) {
|
|
810
|
+
X(e), x("ready", D.value);
|
|
841
811
|
}
|
|
842
|
-
function
|
|
812
|
+
function he() {
|
|
843
813
|
H.value = !1, x("ended", D.value);
|
|
844
814
|
}
|
|
845
|
-
function
|
|
815
|
+
function ge(e) {
|
|
846
816
|
let t = R.value;
|
|
847
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(
|
|
817
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(pe(t.duration), Math.max(0, e)), z.value = t.currentTime);
|
|
848
818
|
}
|
|
849
|
-
function
|
|
819
|
+
function _e(e) {
|
|
850
820
|
let t = R.value;
|
|
851
821
|
if (!t || !Number.isFinite(e)) return;
|
|
852
822
|
let n = Math.min(1, Math.max(0, e));
|
|
853
|
-
t.volume = n, t.muted = n === 0, n > 0 && (
|
|
823
|
+
t.volume = n, t.muted = n === 0, n > 0 && (W = n), X();
|
|
854
824
|
}
|
|
855
|
-
function
|
|
825
|
+
function ve() {
|
|
856
826
|
let e = R.value;
|
|
857
|
-
e && (e.muted && e.volume === 0 && (e.volume =
|
|
827
|
+
e && (e.muted && e.volume === 0 && (e.volume = W), e.muted = !e.muted, X());
|
|
858
828
|
}
|
|
859
829
|
return v(() => {
|
|
860
|
-
|
|
830
|
+
ie();
|
|
861
831
|
}), (r, i) => (b(), s("article", {
|
|
862
832
|
"data-post-id": e.item.postId,
|
|
863
833
|
"data-media-index": D.value,
|
|
@@ -871,12 +841,12 @@ var Ve = [
|
|
|
871
841
|
"aria-hidden": e.leaving || void 0,
|
|
872
842
|
"aria-busy": e.previewState === "loading",
|
|
873
843
|
inert: e.leaving || void 0,
|
|
874
|
-
role: e.interactive && !e.leaving && !
|
|
875
|
-
tabindex: e.interactive && !e.leaving && !
|
|
876
|
-
onClick: i[11] ||= (t) => S(e.interactive && !
|
|
877
|
-
onKeydown: [i[12] ||= A((t) => S(e.interactive && !
|
|
878
|
-
}, [c("div",
|
|
879
|
-
e.cardHeader ? (b(), a(
|
|
844
|
+
role: e.interactive && !e.leaving && !q.value ? "button" : void 0,
|
|
845
|
+
tabindex: e.interactive && !e.leaving && !q.value ? 0 : void 0,
|
|
846
|
+
onClick: i[11] ||= (t) => S(e.interactive && !q.value, te(t)),
|
|
847
|
+
onKeydown: [i[12] ||= A((t) => S(e.interactive && !q.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !q.value, "keyboard"), ["prevent"]), ["space"])]
|
|
848
|
+
}, [c("div", Ve, [
|
|
849
|
+
e.cardHeader ? (b(), a(Ae, {
|
|
880
850
|
key: 0,
|
|
881
851
|
index: e.index,
|
|
882
852
|
item: e.item,
|
|
@@ -902,22 +872,22 @@ var Ve = [
|
|
|
902
872
|
c("div", {
|
|
903
873
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
904
874
|
"data-media-direction": y.value,
|
|
905
|
-
onWheel:
|
|
906
|
-
onTouchstartPassive:
|
|
907
|
-
onTouchendPassive:
|
|
875
|
+
onWheel: oe,
|
|
876
|
+
onTouchstartPassive: se,
|
|
877
|
+
onTouchendPassive: J
|
|
908
878
|
}, [
|
|
909
879
|
u(n, { name: `media-slide-${y.value}` }, {
|
|
910
880
|
default: k(() => [(b(), s("div", {
|
|
911
881
|
key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
|
|
912
882
|
class: "media-card-frame",
|
|
913
883
|
"data-media-index": D.value
|
|
914
|
-
}, [e.previewState === "loading" ? (b(), s("div",
|
|
884
|
+
}, [e.previewState === "loading" ? (b(), s("div", We, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
|
|
915
885
|
key: 1,
|
|
916
886
|
"data-test": "media-error",
|
|
917
887
|
class: "media-error",
|
|
918
888
|
role: "img",
|
|
919
|
-
"aria-label": `${E(
|
|
920
|
-
}, [c("strong",
|
|
889
|
+
"aria-label": `${E(Ee)(F.value)} ${E(De)(F.value)}`
|
|
890
|
+
}, [c("strong", Ke, T(E(Ee)(F.value)), 1), c("span", null, T(E(De)(F.value)), 1)], 8, Ge)) : o("", !0), ce.value ? (b(), s("video", {
|
|
921
891
|
key: 2,
|
|
922
892
|
ref_key: "videoElement",
|
|
923
893
|
ref: R,
|
|
@@ -928,21 +898,21 @@ var Ve = [
|
|
|
928
898
|
src: F.value,
|
|
929
899
|
width: I.value ?? void 0,
|
|
930
900
|
height: L.value ?? void 0,
|
|
931
|
-
autoplay: E(
|
|
901
|
+
autoplay: E(K),
|
|
932
902
|
loop: !e.advanceOnMediaEnd,
|
|
933
|
-
muted: E(
|
|
903
|
+
muted: E(G),
|
|
934
904
|
playsinline: "",
|
|
935
905
|
preload: e.fetchPriority === "high" ? "auto" : "metadata",
|
|
936
|
-
onLoadedmetadata:
|
|
937
|
-
onDurationchange:
|
|
938
|
-
onTimeupdate:
|
|
939
|
-
onVolumechange:
|
|
940
|
-
onPlaying: i[0] ||= (...e) => E(
|
|
906
|
+
onLoadedmetadata: me,
|
|
907
|
+
onDurationchange: X,
|
|
908
|
+
onTimeupdate: X,
|
|
909
|
+
onVolumechange: X,
|
|
910
|
+
onPlaying: i[0] ||= (...e) => E(ee) && E(ee)(...e),
|
|
941
911
|
onPause: i[1] ||= (e) => H.value = !1,
|
|
942
|
-
onEnded:
|
|
943
|
-
onClick:
|
|
912
|
+
onEnded: he,
|
|
913
|
+
onClick: de,
|
|
944
914
|
onError: i[2] ||= (e) => r.$emit("error", D.value)
|
|
945
|
-
}, null, 42,
|
|
915
|
+
}, null, 42, qe)) : (b(), s("img", {
|
|
946
916
|
key: 3,
|
|
947
917
|
class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
|
|
948
918
|
src: F.value,
|
|
@@ -954,29 +924,29 @@ var Ve = [
|
|
|
954
924
|
loading: "eager",
|
|
955
925
|
onLoad: i[3] ||= (e) => r.$emit("ready", D.value),
|
|
956
926
|
onError: i[4] ||= (e) => r.$emit("error", D.value)
|
|
957
|
-
}, null, 42,
|
|
927
|
+
}, null, 42, Je))], 8, Ue))]),
|
|
958
928
|
_: 1
|
|
959
929
|
}, 8, ["name"]),
|
|
960
930
|
(b(), a(t, {
|
|
961
|
-
disabled: !
|
|
931
|
+
disabled: !Y.value || !e.reelControlsTarget,
|
|
962
932
|
to: e.reelControlsTarget ?? "body"
|
|
963
933
|
}, [u(n, {
|
|
964
934
|
name: "vibe-reel-media-controls",
|
|
965
|
-
css:
|
|
935
|
+
css: Y.value
|
|
966
936
|
}, {
|
|
967
|
-
default: k(() => [
|
|
968
|
-
key:
|
|
937
|
+
default: k(() => [le.value ? (b(), a(Re, {
|
|
938
|
+
key: ue.value,
|
|
969
939
|
"current-time": z.value,
|
|
970
|
-
"data-control-post-id":
|
|
940
|
+
"data-control-post-id": Y.value ? e.item.postId : void 0,
|
|
971
941
|
duration: B.value,
|
|
972
942
|
layout: e.layout,
|
|
973
943
|
muted: V.value,
|
|
974
944
|
playing: H.value,
|
|
975
|
-
volume:
|
|
976
|
-
onSeek:
|
|
977
|
-
onToggleMute:
|
|
945
|
+
volume: U.value,
|
|
946
|
+
onSeek: ge,
|
|
947
|
+
onToggleMute: ve,
|
|
978
948
|
onTogglePlayback: fe,
|
|
979
|
-
onVolumeChange:
|
|
949
|
+
onVolumeChange: _e
|
|
980
950
|
}, null, 8, [
|
|
981
951
|
"current-time",
|
|
982
952
|
"data-control-post-id",
|
|
@@ -996,25 +966,25 @@ var Ve = [
|
|
|
996
966
|
type: "button",
|
|
997
967
|
class: "media-carousel-control media-carousel-control--previous",
|
|
998
968
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
999
|
-
onClick: i[5] ||= j((e) =>
|
|
969
|
+
onClick: i[5] ||= j((e) => ne(D.value - 1, e), ["stop"]),
|
|
1000
970
|
onKeydown: i[6] ||= j(() => {}, ["stop"])
|
|
1001
|
-
}, [u(E(
|
|
971
|
+
}, [u(E(ye), { size: 20 })], 40, Ye), c("button", {
|
|
1002
972
|
type: "button",
|
|
1003
973
|
class: "media-carousel-control media-carousel-control--next",
|
|
1004
974
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1005
|
-
onClick: i[7] ||= j((e) =>
|
|
975
|
+
onClick: i[7] ||= j((e) => ne(D.value + 1, e), ["stop"]),
|
|
1006
976
|
onKeydown: i[8] ||= j(() => {}, ["stop"])
|
|
1007
|
-
}, [u(E(
|
|
1008
|
-
|
|
977
|
+
}, [u(E(be), { size: 20 })], 40, Xe)], 2)) : o("", !0),
|
|
978
|
+
q.value ? (b(), s("button", {
|
|
1009
979
|
key: 1,
|
|
1010
980
|
class: "media-card-activator",
|
|
1011
981
|
type: "button",
|
|
1012
982
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1013
|
-
onClick: i[9] ||= j((e) => r.$emit("activate",
|
|
983
|
+
onClick: i[9] ||= j((e) => r.$emit("activate", te(e)), ["stop"]),
|
|
1014
984
|
onKeydown: i[10] ||= j(() => {}, ["stop"])
|
|
1015
|
-
}, null, 40,
|
|
1016
|
-
], 42,
|
|
1017
|
-
e.cardFooter ? (b(), a(
|
|
985
|
+
}, null, 40, Ze)) : o("", !0)
|
|
986
|
+
], 42, He),
|
|
987
|
+
e.cardFooter ? (b(), a(Ae, {
|
|
1018
988
|
key: 1,
|
|
1019
989
|
index: e.index,
|
|
1020
990
|
item: e.item,
|
|
@@ -1037,9 +1007,9 @@ var Ve = [
|
|
|
1037
1007
|
"style",
|
|
1038
1008
|
"total"
|
|
1039
1009
|
])) : o("", !0)
|
|
1040
|
-
])], 46,
|
|
1010
|
+
])], 46, Be));
|
|
1041
1011
|
}
|
|
1042
|
-
}),
|
|
1012
|
+
}), nt = { class: "masonry-feed-shell" }, rt = ["aria-hidden", "inert"], it = 240, at = 6, ot = 12, st = 800, ct = 1.5, lt = /* @__PURE__ */ d({
|
|
1043
1013
|
__name: "MasonryFeed",
|
|
1044
1014
|
props: {
|
|
1045
1015
|
enteringPostIds: {},
|
|
@@ -1070,55 +1040,81 @@ var Ve = [
|
|
|
1070
1040
|
"loadMore",
|
|
1071
1041
|
"mediaChange",
|
|
1072
1042
|
"ready",
|
|
1073
|
-
"retryEnd"
|
|
1043
|
+
"retryEnd",
|
|
1044
|
+
"visible"
|
|
1074
1045
|
],
|
|
1075
1046
|
setup(t, { expose: n, emit: i }) {
|
|
1076
|
-
let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(
|
|
1047
|
+
let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(at), y = w(0), x = w(0), C = w(0), T = null, k = null, A = null, j = r(() => ie(o.items, m.value, {
|
|
1077
1048
|
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1078
1049
|
gap: g.value,
|
|
1079
|
-
minColumnWidth:
|
|
1050
|
+
minColumnWidth: it
|
|
1080
1051
|
})), M = r(() => {
|
|
1081
1052
|
let e = j.value;
|
|
1082
1053
|
if (o.leavingPostIds.size === 0) return e;
|
|
1083
|
-
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n =
|
|
1054
|
+
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n = ie(t, m.value, {
|
|
1084
1055
|
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1085
1056
|
gap: g.value,
|
|
1086
|
-
minColumnWidth:
|
|
1057
|
+
minColumnWidth: it
|
|
1087
1058
|
}), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
|
|
1088
1059
|
return {
|
|
1089
1060
|
...n,
|
|
1090
1061
|
items: o.items.map((t, n) => o.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
|
|
1091
1062
|
};
|
|
1092
1063
|
}), N = r(() => ({ height: `${o.leavingPostIds.size === 0 ? M.value.height : j.value.height}px` })), P = r(() => !o.infiniteScroll || x.value > 0 && C.value + M.value.height <= x.value + 1), I = r(() => {
|
|
1093
|
-
|
|
1064
|
+
if (o.suspended) return /* @__PURE__ */ new Set();
|
|
1065
|
+
let e = {
|
|
1066
|
+
scrollTop: y.value - C.value,
|
|
1067
|
+
viewportHeight: x.value
|
|
1068
|
+
}, t = re(M.value.items, {
|
|
1069
|
+
...e,
|
|
1070
|
+
overscan: 0
|
|
1071
|
+
}), n = o.leavingPostIds.size === 0 ? [] : re(j.value.items, {
|
|
1072
|
+
...e,
|
|
1073
|
+
overscan: 0
|
|
1074
|
+
});
|
|
1075
|
+
return new Set([...t, ...n]);
|
|
1076
|
+
}), L = r(() => {
|
|
1077
|
+
let e = Math.max(st, x.value * ct), t = {
|
|
1094
1078
|
scrollTop: y.value - C.value,
|
|
1095
1079
|
viewportHeight: x.value
|
|
1096
|
-
}, n =
|
|
1080
|
+
}, n = re(M.value.items, {
|
|
1097
1081
|
...t,
|
|
1098
1082
|
overscan: e
|
|
1099
|
-
}), r = o.leavingPostIds.size === 0 ? [] :
|
|
1083
|
+
}), r = o.leavingPostIds.size === 0 ? [] : re(j.value.items, {
|
|
1100
1084
|
...t,
|
|
1101
1085
|
overscan: e
|
|
1102
|
-
})
|
|
1103
|
-
|
|
1104
|
-
overscan: 0
|
|
1105
|
-
}), s = o.leavingPostIds.size === 0 ? [] : G(j.value.items, {
|
|
1106
|
-
...t,
|
|
1107
|
-
overscan: 0
|
|
1108
|
-
}), c = new Set([...a, ...s]);
|
|
1109
|
-
return i.flatMap((e) => {
|
|
1086
|
+
});
|
|
1087
|
+
return [...new Set([...n, ...r])].sort((e, t) => e - t).flatMap((e) => {
|
|
1110
1088
|
let t = o.items[e];
|
|
1111
1089
|
return t ? [{
|
|
1112
|
-
fetchPriority:
|
|
1090
|
+
fetchPriority: I.value.has(e) ? "high" : "low",
|
|
1113
1091
|
index: e,
|
|
1114
1092
|
item: t
|
|
1115
1093
|
}] : [];
|
|
1116
1094
|
});
|
|
1095
|
+
}), R = /* @__PURE__ */ new Set();
|
|
1096
|
+
O(() => [...I.value].flatMap((e) => {
|
|
1097
|
+
let t = o.items[e];
|
|
1098
|
+
if (!t) return [];
|
|
1099
|
+
let n = o.mediaIndices.get(t.postId) ?? 0, r = F(t.postId, n);
|
|
1100
|
+
return o.previewStates.get(r) === "ready" ? [{
|
|
1101
|
+
key: r,
|
|
1102
|
+
mediaIndex: n,
|
|
1103
|
+
postId: t.postId
|
|
1104
|
+
}] : [];
|
|
1105
|
+
}), (e) => {
|
|
1106
|
+
let t = new Set(e.map(({ key: e }) => e));
|
|
1107
|
+
e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
|
|
1108
|
+
R.has(e) || l("visible", n, t);
|
|
1109
|
+
}), R = t;
|
|
1110
|
+
}, {
|
|
1111
|
+
immediate: !0,
|
|
1112
|
+
flush: "post"
|
|
1117
1113
|
});
|
|
1118
|
-
function
|
|
1114
|
+
function z(e) {
|
|
1119
1115
|
let t = M.value.items[e], n = o.items[e]?.postId;
|
|
1120
1116
|
if (!t) return {};
|
|
1121
|
-
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ?
|
|
1117
|
+
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ? ne({
|
|
1122
1118
|
containerHeight: j.value.height,
|
|
1123
1119
|
gap: g.value
|
|
1124
1120
|
}) : 0, s = n === void 0 ? 0 : i ? o.removalDelays.get(n) ?? 0 : r ? o.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -1129,43 +1125,43 @@ var Ve = [
|
|
|
1129
1125
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1130
1126
|
};
|
|
1131
1127
|
}
|
|
1132
|
-
function
|
|
1128
|
+
function B() {
|
|
1133
1129
|
let e = d.value;
|
|
1134
1130
|
if (!e) return;
|
|
1135
1131
|
y.value = e.scrollTop, x.value = e.clientHeight;
|
|
1136
1132
|
let t = p.value;
|
|
1137
1133
|
t && (C.value = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop);
|
|
1138
1134
|
}
|
|
1139
|
-
function
|
|
1135
|
+
function V(e) {
|
|
1140
1136
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1141
|
-
m.value = e.clientWidth, g.value = Math.min(
|
|
1137
|
+
m.value = e.clientWidth, g.value = Math.min(ot, Math.max(at, t * .0075)), B();
|
|
1142
1138
|
}
|
|
1143
|
-
function
|
|
1139
|
+
function H(e) {
|
|
1144
1140
|
let t = e.currentTarget;
|
|
1145
|
-
t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll &&
|
|
1141
|
+
t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll && K(t) && l("loadMore"));
|
|
1146
1142
|
}
|
|
1147
|
-
function
|
|
1143
|
+
function W() {
|
|
1148
1144
|
let e = d.value;
|
|
1149
|
-
!o.loadMoreLocked && e &&
|
|
1145
|
+
!o.loadMoreLocked && e && K(e) && l("loadMore");
|
|
1150
1146
|
}
|
|
1151
|
-
function
|
|
1147
|
+
function G() {
|
|
1152
1148
|
return d.value;
|
|
1153
1149
|
}
|
|
1154
1150
|
return O(p, (e) => {
|
|
1155
|
-
T?.disconnect(), T = null, A !== null && cancelAnimationFrame(A), e && (
|
|
1151
|
+
T?.disconnect(), T = null, A !== null && cancelAnimationFrame(A), e && (V(e), !(typeof ResizeObserver > "u") && (T = new ResizeObserver(([t]) => {
|
|
1156
1152
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1157
1153
|
Math.abs(n - m.value) < .5 || (A = requestAnimationFrame(() => {
|
|
1158
|
-
A = null,
|
|
1154
|
+
A = null, V(e);
|
|
1159
1155
|
}));
|
|
1160
1156
|
}), T.observe(e)));
|
|
1161
1157
|
}), O(d, (e) => {
|
|
1162
|
-
k?.disconnect(), k = null, e && (
|
|
1158
|
+
k?.disconnect(), k = null, e && (B(), !(typeof ResizeObserver > "u") && (k = new ResizeObserver(B), k.observe(e)));
|
|
1163
1159
|
}), v(() => {
|
|
1164
1160
|
T?.disconnect(), k?.disconnect(), A !== null && cancelAnimationFrame(A);
|
|
1165
1161
|
}), n({
|
|
1166
|
-
getScrollElement:
|
|
1167
|
-
loadIfNearBottom:
|
|
1168
|
-
}), (n, r) => (b(), s("div",
|
|
1162
|
+
getScrollElement: G,
|
|
1163
|
+
loadIfNearBottom: W
|
|
1164
|
+
}), (n, r) => (b(), s("div", nt, [c("main", {
|
|
1169
1165
|
id: f,
|
|
1170
1166
|
ref_key: "galleryElement",
|
|
1171
1167
|
ref: d,
|
|
@@ -1173,14 +1169,14 @@ var Ve = [
|
|
|
1173
1169
|
"data-layout-mode": "masonry",
|
|
1174
1170
|
"aria-hidden": t.suspended || void 0,
|
|
1175
1171
|
inert: t.suspended || void 0,
|
|
1176
|
-
onScrollPassive:
|
|
1172
|
+
onScrollPassive: H
|
|
1177
1173
|
}, [c("section", {
|
|
1178
1174
|
ref_key: "masonryElement",
|
|
1179
1175
|
ref: p,
|
|
1180
1176
|
class: h(["masonry", { "masonry--ready": m.value > 0 }]),
|
|
1181
1177
|
style: _(N.value),
|
|
1182
1178
|
"aria-label": "Media gallery"
|
|
1183
|
-
}, [(b(!0), s(e, null, S(
|
|
1179
|
+
}, [(b(!0), s(e, null, S(L.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(tt, {
|
|
1184
1180
|
key: n.postId,
|
|
1185
1181
|
class: "masonry-item",
|
|
1186
1182
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1191,7 +1187,7 @@ var Ve = [
|
|
|
1191
1187
|
"media-card": t.mediaCard,
|
|
1192
1188
|
index: r,
|
|
1193
1189
|
item: n,
|
|
1194
|
-
"item-style":
|
|
1190
|
+
"item-style": z(r),
|
|
1195
1191
|
interactive: "",
|
|
1196
1192
|
layout: "masonry",
|
|
1197
1193
|
"loaded-count": t.items.length,
|
|
@@ -1220,7 +1216,7 @@ var Ve = [
|
|
|
1220
1216
|
"onMediaChange",
|
|
1221
1217
|
"onReady",
|
|
1222
1218
|
"onError"
|
|
1223
|
-
]))), 128))], 6), u(
|
|
1219
|
+
]))), 128))], 6), u(U, {
|
|
1224
1220
|
actions: t.feedFooterActions,
|
|
1225
1221
|
"can-retry-end": t.canRetryEnd,
|
|
1226
1222
|
"feed-footer": t.feedFooter,
|
|
@@ -1242,7 +1238,7 @@ var Ve = [
|
|
|
1242
1238
|
"load-more-locked",
|
|
1243
1239
|
"show-load-more",
|
|
1244
1240
|
"state"
|
|
1245
|
-
])], 42,
|
|
1241
|
+
])], 42, rt), u(ue, {
|
|
1246
1242
|
"content-size": M.value.height,
|
|
1247
1243
|
"controls-id": f,
|
|
1248
1244
|
"scroll-element": d.value,
|
|
@@ -1253,8 +1249,8 @@ var Ve = [
|
|
|
1253
1249
|
"suspended"
|
|
1254
1250
|
])]));
|
|
1255
1251
|
}
|
|
1256
|
-
}),
|
|
1257
|
-
function
|
|
1252
|
+
}), ut = 300;
|
|
1253
|
+
function dt(e, t, n) {
|
|
1258
1254
|
let r = e.scrollTop;
|
|
1259
1255
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1260
1256
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1262,7 +1258,7 @@ function ft(e, t, n) {
|
|
|
1262
1258
|
return new Promise((n) => {
|
|
1263
1259
|
let o = (s) => {
|
|
1264
1260
|
a += 1;
|
|
1265
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1261
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / ut), u = 1 - (1 - l) ** 3;
|
|
1266
1262
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1267
1263
|
requestAnimationFrame(o);
|
|
1268
1264
|
return;
|
|
@@ -1274,7 +1270,7 @@ function ft(e, t, n) {
|
|
|
1274
1270
|
}
|
|
1275
1271
|
//#endregion
|
|
1276
1272
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1277
|
-
var
|
|
1273
|
+
var ft = ["aria-label"], pt = /* @__PURE__ */ d({
|
|
1278
1274
|
__name: "ReelAutoAdvanceProgress",
|
|
1279
1275
|
props: {
|
|
1280
1276
|
durationMs: {},
|
|
@@ -1292,9 +1288,9 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1292
1288
|
class: "reel-auto-advance-progress",
|
|
1293
1289
|
style: _(a.value),
|
|
1294
1290
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1295
|
-
}, null, 36)], 8,
|
|
1291
|
+
}, null, 36)], 8, ft));
|
|
1296
1292
|
}
|
|
1297
|
-
}),
|
|
1293
|
+
}), mt = { class: "reel-viewport" }, ht = ["data-active-post-id", "data-active-media-index"], gt = ["role", "data-status"], _t = 2, vt = 300, yt = /* @__PURE__ */ d({
|
|
1298
1294
|
__name: "ReelFeed",
|
|
1299
1295
|
props: {
|
|
1300
1296
|
initialPostId: {},
|
|
@@ -1332,7 +1328,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1332
1328
|
],
|
|
1333
1329
|
setup(t, { expose: n, emit: i }) {
|
|
1334
1330
|
let l = t, u = i, d = w(null), f = w(null), p = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId), g = w(Math.max(0, p)), x = w(!1), C = w(!1), D = 0, k = null, A = null, j = null, N = r(() => ({ gridTemplateRows: `repeat(${l.items.length}, 100cqh)` })), I = r(() => {
|
|
1335
|
-
let e = Math.max(0, g.value -
|
|
1331
|
+
let e = Math.max(0, g.value - _t), t = Math.min(l.items.length - 1, g.value + _t);
|
|
1336
1332
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1337
1333
|
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1338
1334
|
index: e + n,
|
|
@@ -1349,7 +1345,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1349
1345
|
if (!e) return "";
|
|
1350
1346
|
let t = P(e, z.value);
|
|
1351
1347
|
return l.mediaSource === "original" ? t.src : t.preview.src;
|
|
1352
|
-
}), H = r(() => B.value === "ready" &&
|
|
1348
|
+
}), H = r(() => B.value === "ready" && ke(V.value)), W = r(() => [
|
|
1353
1349
|
L.value,
|
|
1354
1350
|
z.value,
|
|
1355
1351
|
l.items.length,
|
|
@@ -1357,49 +1353,49 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1357
1353
|
l.reelAutoAdvance.enabled,
|
|
1358
1354
|
l.reelAutoAdvance.includePostItems,
|
|
1359
1355
|
l.reelAutoAdvance.intervalMs
|
|
1360
|
-
].join(":")),
|
|
1356
|
+
].join(":")), G = r(() => {
|
|
1361
1357
|
let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1362
1358
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1363
|
-
}),
|
|
1364
|
-
function
|
|
1359
|
+
}), ee = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value), q = r(() => !l.infiniteScroll || l.items.length <= 1), te = r(() => l.reelForward.status === "loading" ? "Loading the next media…" : l.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
|
|
1360
|
+
function ne(e) {
|
|
1365
1361
|
return { gridRow: `${e + 1}` };
|
|
1366
1362
|
}
|
|
1367
|
-
function
|
|
1363
|
+
function re(e) {
|
|
1368
1364
|
let t = D || e.clientHeight;
|
|
1369
1365
|
return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1370
1366
|
}
|
|
1371
|
-
function
|
|
1367
|
+
function ie(e) {
|
|
1372
1368
|
let t = e.currentTarget;
|
|
1373
1369
|
if (!t) return;
|
|
1374
1370
|
let n = D || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
|
|
1375
|
-
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value =
|
|
1371
|
+
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = re(t)), !l.loadMoreLocked && l.infiniteScroll && K(t) && u("loadMore");
|
|
1376
1372
|
}
|
|
1377
|
-
function
|
|
1373
|
+
function ae() {
|
|
1378
1374
|
let e = d.value;
|
|
1379
|
-
e && (x.value = !1,
|
|
1375
|
+
e && (x.value = !1, J(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
|
|
1380
1376
|
e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
|
|
1381
|
-
}),
|
|
1377
|
+
}), oe());
|
|
1382
1378
|
}
|
|
1383
|
-
function
|
|
1379
|
+
function oe() {
|
|
1384
1380
|
j !== null && clearTimeout(j), j = setTimeout(() => {
|
|
1385
1381
|
j = null;
|
|
1386
1382
|
let e = d.value;
|
|
1387
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1383
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), J(!1);
|
|
1388
1384
|
}, 120);
|
|
1389
1385
|
}
|
|
1390
|
-
function
|
|
1391
|
-
|
|
1386
|
+
function se() {
|
|
1387
|
+
J(!0);
|
|
1392
1388
|
let e = d.value;
|
|
1393
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1389
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), oe();
|
|
1394
1390
|
}
|
|
1395
|
-
function
|
|
1391
|
+
function J(e) {
|
|
1396
1392
|
C.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1397
1393
|
}
|
|
1398
|
-
function
|
|
1394
|
+
function ce() {
|
|
1399
1395
|
let e = d.value;
|
|
1400
|
-
!l.loadMoreLocked && e &&
|
|
1396
|
+
!l.loadMoreLocked && e && K(e) && u("loadMore");
|
|
1401
1397
|
}
|
|
1402
|
-
function
|
|
1398
|
+
function Y(e) {
|
|
1403
1399
|
let t = R.value;
|
|
1404
1400
|
if (!t) return !1;
|
|
1405
1401
|
let n = M(t).length;
|
|
@@ -1407,34 +1403,34 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1407
1403
|
let r = (z.value + e + n) % n;
|
|
1408
1404
|
return u("mediaChange", t.postId, r), !0;
|
|
1409
1405
|
}
|
|
1410
|
-
function
|
|
1406
|
+
function le(e) {
|
|
1411
1407
|
let t = g.value + e;
|
|
1412
|
-
return !d.value || t < 0 || t >= l.items.length ? !1 : (
|
|
1408
|
+
return !d.value || t < 0 || t >= l.items.length ? !1 : (pe(t), !0);
|
|
1413
1409
|
}
|
|
1414
|
-
function
|
|
1410
|
+
function ue(e, t) {
|
|
1415
1411
|
let n = l.items.findIndex((t) => t.postId === e), r = l.items[n];
|
|
1416
|
-
return !d.value || !r || t < 0 || t > r.items.length ? !1 : ((l.mediaIndices.get(e) ?? 0) !== t && u("mediaChange", e, t), n !== g.value &&
|
|
1412
|
+
return !d.value || !r || t < 0 || t > r.items.length ? !1 : ((l.mediaIndices.get(e) ?? 0) !== t && u("mediaChange", e, t), n !== g.value && pe(n), !0);
|
|
1417
1413
|
}
|
|
1418
|
-
function
|
|
1414
|
+
function de() {
|
|
1419
1415
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1420
1416
|
}
|
|
1421
1417
|
function fe(e) {
|
|
1422
1418
|
let t = d.value;
|
|
1423
1419
|
if (!t) return Promise.resolve();
|
|
1424
1420
|
let n = e * (D || t.clientHeight);
|
|
1425
|
-
return g.value = e,
|
|
1421
|
+
return g.value = e, dt(t, n, de());
|
|
1426
1422
|
}
|
|
1427
|
-
function
|
|
1423
|
+
function pe(e) {
|
|
1428
1424
|
fe(e);
|
|
1429
1425
|
}
|
|
1430
|
-
async function
|
|
1426
|
+
async function X(e) {
|
|
1431
1427
|
let t = l.items.findIndex((t) => t.postId === e);
|
|
1432
1428
|
return t < 0 || t === g.value ? !1 : (await fe(t), !0);
|
|
1433
1429
|
}
|
|
1434
|
-
async function
|
|
1435
|
-
return
|
|
1430
|
+
async function me(e) {
|
|
1431
|
+
return Y(e) ? (de() || await new Promise((e) => setTimeout(e, vt)), !0) : !1;
|
|
1436
1432
|
}
|
|
1437
|
-
function
|
|
1433
|
+
function he() {
|
|
1438
1434
|
if (!l.reelAutoAdvance.enabled) return;
|
|
1439
1435
|
let e = R.value;
|
|
1440
1436
|
if (!e) return;
|
|
@@ -1447,31 +1443,31 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1447
1443
|
l.hasNext && !l.loadMoreLocked && u("loadMore");
|
|
1448
1444
|
return;
|
|
1449
1445
|
}
|
|
1450
|
-
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0),
|
|
1446
|
+
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), pe(t);
|
|
1451
1447
|
}
|
|
1452
|
-
function
|
|
1453
|
-
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value ||
|
|
1448
|
+
function ge(e, t) {
|
|
1449
|
+
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || he();
|
|
1454
1450
|
}
|
|
1455
1451
|
return O(d, (e) => {
|
|
1456
|
-
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(
|
|
1452
|
+
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(ae), k.observe(e)));
|
|
1457
1453
|
}), O(() => l.items.length, async (e) => {
|
|
1458
1454
|
let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1459
|
-
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(),
|
|
1455
|
+
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), ae();
|
|
1460
1456
|
}), O(L, (e) => {
|
|
1461
1457
|
e !== void 0 && u("activeChange", e);
|
|
1462
1458
|
}, { immediate: !0 }), y(() => {
|
|
1463
|
-
window.addEventListener("resize",
|
|
1459
|
+
window.addEventListener("resize", se), window.addEventListener("orientationchange", se), p >= 0 && m(ae);
|
|
1464
1460
|
}), v(() => {
|
|
1465
|
-
window.removeEventListener("resize",
|
|
1461
|
+
window.removeEventListener("resize", se), window.removeEventListener("orientationchange", se), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
|
|
1466
1462
|
}), n({
|
|
1467
1463
|
activeIndex: g,
|
|
1468
1464
|
activePostId: L,
|
|
1469
|
-
changeActiveMedia:
|
|
1470
|
-
loadIfNearBottom:
|
|
1471
|
-
moveActivePost:
|
|
1472
|
-
navigateToItem:
|
|
1473
|
-
transitionActiveMedia:
|
|
1474
|
-
transitionActivePost:
|
|
1465
|
+
changeActiveMedia: Y,
|
|
1466
|
+
loadIfNearBottom: ce,
|
|
1467
|
+
moveActivePost: le,
|
|
1468
|
+
navigateToItem: ue,
|
|
1469
|
+
transitionActiveMedia: me,
|
|
1470
|
+
transitionActivePost: X
|
|
1475
1471
|
}), (n, r) => (b(), s("main", {
|
|
1476
1472
|
class: h(["reel-shell", {
|
|
1477
1473
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1479,7 +1475,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1479
1475
|
}]),
|
|
1480
1476
|
"data-layout-mode": "reel"
|
|
1481
1477
|
}, [
|
|
1482
|
-
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1478
|
+
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(Ae, {
|
|
1483
1479
|
key: 0,
|
|
1484
1480
|
index: g.value,
|
|
1485
1481
|
item: R.value,
|
|
@@ -1501,19 +1497,19 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1501
1497
|
"style",
|
|
1502
1498
|
"total"
|
|
1503
1499
|
])) : o("", !0),
|
|
1504
|
-
c("div",
|
|
1500
|
+
c("div", mt, [c("div", {
|
|
1505
1501
|
ref_key: "galleryElement",
|
|
1506
1502
|
ref: d,
|
|
1507
1503
|
class: "gallery-shell reel-feed",
|
|
1508
1504
|
"data-active-post-id": L.value,
|
|
1509
1505
|
"data-active-media-index": z.value,
|
|
1510
|
-
onScrollPassive:
|
|
1506
|
+
onScrollPassive: ie
|
|
1511
1507
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1512
1508
|
key: 1,
|
|
1513
1509
|
class: "reel-track",
|
|
1514
1510
|
style: _(N.value),
|
|
1515
1511
|
"aria-label": "Media gallery"
|
|
1516
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1512
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(tt, {
|
|
1517
1513
|
key: n.postId,
|
|
1518
1514
|
active: r === g.value && !x.value,
|
|
1519
1515
|
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
@@ -1522,7 +1518,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1522
1518
|
"fetch-priority": e,
|
|
1523
1519
|
index: r,
|
|
1524
1520
|
item: n,
|
|
1525
|
-
"item-style":
|
|
1521
|
+
"item-style": ne(r),
|
|
1526
1522
|
"media-card": t.mediaCard,
|
|
1527
1523
|
layout: "reel",
|
|
1528
1524
|
"loaded-count": t.items.length,
|
|
@@ -1533,7 +1529,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1533
1529
|
"stationary-reel-controls": "",
|
|
1534
1530
|
total: t.total,
|
|
1535
1531
|
onMediaChange: (e) => u("mediaChange", n.postId, e),
|
|
1536
|
-
onEnded: (e) =>
|
|
1532
|
+
onEnded: (e) => ge(n.postId, e),
|
|
1537
1533
|
onReady: (e) => u("ready", n.postId, e),
|
|
1538
1534
|
onError: (e) => u("error", n.postId, e)
|
|
1539
1535
|
}, null, 8, [
|
|
@@ -1559,12 +1555,12 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1559
1555
|
class: "reel-forward-status",
|
|
1560
1556
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1561
1557
|
"data-status": t.reelForward.status
|
|
1562
|
-
}, [c("p", null, T(
|
|
1558
|
+
}, [c("p", null, T(te.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1563
1559
|
key: 0,
|
|
1564
1560
|
class: "reel-forward-retry",
|
|
1565
1561
|
type: "button",
|
|
1566
1562
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1567
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1563
|
+
}, " Retry ")) : o("", !0)], 8, gt)), t.reelForward.status === "idle" ? (b(), a(U, {
|
|
1568
1564
|
key: 2,
|
|
1569
1565
|
actions: t.feedFooterActions,
|
|
1570
1566
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1573,7 +1569,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1573
1569
|
"has-next": t.hasNext,
|
|
1574
1570
|
"is-loading": t.isLoadingMore,
|
|
1575
1571
|
"load-more-locked": t.loadMoreLocked,
|
|
1576
|
-
"show-load-more":
|
|
1572
|
+
"show-load-more": q.value,
|
|
1577
1573
|
state: t.state,
|
|
1578
1574
|
onLoadMore: r[1] ||= (e) => u("loadMore"),
|
|
1579
1575
|
onRetryEnd: r[2] ||= (e) => u("retryEnd")
|
|
@@ -1587,13 +1583,13 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1587
1583
|
"load-more-locked",
|
|
1588
1584
|
"show-load-more",
|
|
1589
1585
|
"state"
|
|
1590
|
-
])) : o("", !0)], 40,
|
|
1586
|
+
])) : o("", !0)], 40, ht), c("div", {
|
|
1591
1587
|
ref_key: "reelControlsElement",
|
|
1592
1588
|
ref: f,
|
|
1593
1589
|
class: "reel-media-controls-host",
|
|
1594
1590
|
"data-test": "reel-media-controls-host"
|
|
1595
1591
|
}, null, 512)]),
|
|
1596
|
-
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1592
|
+
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(Ae, {
|
|
1597
1593
|
key: 1,
|
|
1598
1594
|
index: g.value,
|
|
1599
1595
|
item: R.value,
|
|
@@ -1615,24 +1611,24 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1615
1611
|
"style",
|
|
1616
1612
|
"total"
|
|
1617
1613
|
])) : o("", !0),
|
|
1618
|
-
|
|
1619
|
-
key:
|
|
1614
|
+
ee.value ? (b(), a(pt, {
|
|
1615
|
+
key: W.value,
|
|
1620
1616
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1621
|
-
label:
|
|
1622
|
-
onComplete:
|
|
1617
|
+
label: G.value,
|
|
1618
|
+
onComplete: he
|
|
1623
1619
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1624
1620
|
], 2));
|
|
1625
1621
|
}
|
|
1626
|
-
}),
|
|
1622
|
+
}), bt = ["data-info-sheet-open", "data-info-sheet-mode"], xt = ["aria-hidden", "inert"], St = {
|
|
1627
1623
|
key: 0,
|
|
1628
1624
|
class: "reel-info-sheet-layer",
|
|
1629
1625
|
"data-test": "reel-info-sheet"
|
|
1630
|
-
},
|
|
1626
|
+
}, Ct = [
|
|
1631
1627
|
"role",
|
|
1632
1628
|
"aria-modal",
|
|
1633
1629
|
"tabindex",
|
|
1634
1630
|
"data-active-post-id"
|
|
1635
|
-
],
|
|
1631
|
+
], wt = /* @__PURE__ */ d({
|
|
1636
1632
|
__name: "ReelLayout",
|
|
1637
1633
|
props: {
|
|
1638
1634
|
forwardIndex: { default: null },
|
|
@@ -1725,7 +1721,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1725
1721
|
function H(e, t) {
|
|
1726
1722
|
d("mediaChange", e, t);
|
|
1727
1723
|
}
|
|
1728
|
-
function
|
|
1724
|
+
function U(e, t) {
|
|
1729
1725
|
d("ready", e, t);
|
|
1730
1726
|
}
|
|
1731
1727
|
return O(() => ({
|
|
@@ -1757,7 +1753,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1757
1753
|
class: "reel-layout-main",
|
|
1758
1754
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1759
1755
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1760
|
-
}, [u(
|
|
1756
|
+
}, [u(yt, {
|
|
1761
1757
|
ref_key: "reelFeed",
|
|
1762
1758
|
ref: p,
|
|
1763
1759
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1784,7 +1780,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1784
1780
|
onError: V,
|
|
1785
1781
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1786
1782
|
onMediaChange: H,
|
|
1787
|
-
onReady:
|
|
1783
|
+
onReady: U,
|
|
1788
1784
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1789
1785
|
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1790
1786
|
}, null, 8, [
|
|
@@ -1808,8 +1804,8 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1808
1804
|
"reel-forward",
|
|
1809
1805
|
"state",
|
|
1810
1806
|
"total"
|
|
1811
|
-
])], 8,
|
|
1812
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
1807
|
+
])], 8, xt), u(n, { name: "vibe-info-sheet" }, {
|
|
1808
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", St, [c("aside", {
|
|
1813
1809
|
ref_key: "sheetElement",
|
|
1814
1810
|
ref: _,
|
|
1815
1811
|
class: "reel-info-sheet",
|
|
@@ -1818,20 +1814,109 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1818
1814
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1819
1815
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1820
1816
|
"data-active-post-id": T.value?.postId
|
|
1821
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
1817
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Ct)])) : o("", !0)]),
|
|
1822
1818
|
_: 1
|
|
1823
|
-
})], 10,
|
|
1819
|
+
})], 10, bt));
|
|
1824
1820
|
}
|
|
1825
|
-
})
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1821
|
+
});
|
|
1822
|
+
//#endregion
|
|
1823
|
+
//#region src/core/mediaLifecycle.ts
|
|
1824
|
+
function Tt(e, t, n, r, i) {
|
|
1825
|
+
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
1826
|
+
if (!o) return null;
|
|
1827
|
+
let s = N(o, n), c = P(o, s);
|
|
1828
|
+
return {
|
|
1829
|
+
item: o,
|
|
1830
|
+
layout: r,
|
|
1831
|
+
media: c,
|
|
1832
|
+
mediaId: c.mediaId ?? null,
|
|
1833
|
+
mediaIndex: s,
|
|
1834
|
+
origin: i,
|
|
1835
|
+
phoneMode: e.phoneMode,
|
|
1836
|
+
postId: o.postId,
|
|
1837
|
+
postIndex: a
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
function Et(e, t) {
|
|
1841
|
+
O(() => {
|
|
1842
|
+
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
1843
|
+
return {
|
|
1844
|
+
mediaIndex: t === null ? 0 : e.mediaIndices.get(t) ?? 0,
|
|
1845
|
+
origin: e.reelOrigin ?? "reel",
|
|
1846
|
+
postId: t
|
|
1847
|
+
};
|
|
1848
|
+
}, (n, r) => {
|
|
1849
|
+
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
1850
|
+
let i = Tt(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
1851
|
+
i && t(i);
|
|
1852
|
+
}, { flush: "sync" });
|
|
1853
|
+
}
|
|
1854
|
+
//#endregion
|
|
1855
|
+
//#region src/components/useMediaLifecycle.ts
|
|
1856
|
+
function Dt(e, t) {
|
|
1857
|
+
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = r(() => e.reelMediaSource === "original" ? i.value : n.value);
|
|
1858
|
+
function o(e, t, n, r) {
|
|
1859
|
+
let i = F(t, n);
|
|
1860
|
+
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
1861
|
+
}
|
|
1862
|
+
function s(t, n, r, i) {
|
|
1863
|
+
return Tt(e, t, n, r, i);
|
|
1864
|
+
}
|
|
1865
|
+
function c(e, n, r, i) {
|
|
1866
|
+
let a = s(e, n, r, i);
|
|
1867
|
+
a && t.ready(a);
|
|
1868
|
+
}
|
|
1869
|
+
function l(e, t) {
|
|
1870
|
+
o(n, e, t, "error");
|
|
1871
|
+
}
|
|
1872
|
+
function u(e, t) {
|
|
1873
|
+
o(n, e, t, "ready"), c(e, t, "masonry", null);
|
|
1874
|
+
}
|
|
1875
|
+
function d(t, r) {
|
|
1876
|
+
o(e.reelMediaSource === "original" ? i : n, t, r, "error");
|
|
1877
|
+
}
|
|
1878
|
+
function f(t, r) {
|
|
1879
|
+
o(e.reelMediaSource === "original" ? i : n, t, r, "ready"), c(t, r, "reel", e.reelOrigin ?? "reel");
|
|
1880
|
+
}
|
|
1881
|
+
function p(e, n) {
|
|
1882
|
+
let r = s(e, n, "masonry", null);
|
|
1883
|
+
r && t.visible(r);
|
|
1884
|
+
}
|
|
1885
|
+
return Et(e, t.reelChange), O(() => {
|
|
1886
|
+
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
1887
|
+
return {
|
|
1888
|
+
mediaIndex: n,
|
|
1889
|
+
origin: e.reelOrigin ?? "reel",
|
|
1890
|
+
postId: t,
|
|
1891
|
+
ready: t !== null && a.value.get(F(t, n)) === "ready"
|
|
1892
|
+
};
|
|
1893
|
+
}, (e, n) => {
|
|
1894
|
+
if (e.postId === null || !e.ready || n?.ready && n.postId === e.postId && n.mediaIndex === e.mediaIndex && n.origin === e.origin) return;
|
|
1895
|
+
let r = s(e.postId, e.mediaIndex, "reel", e.origin);
|
|
1896
|
+
r && t.visible(r);
|
|
1897
|
+
}, { flush: "post" }), {
|
|
1898
|
+
markMasonryVisible: p,
|
|
1899
|
+
markPreviewError: l,
|
|
1900
|
+
markPreviewReady: u,
|
|
1901
|
+
markReelError: d,
|
|
1902
|
+
markReelReady: f,
|
|
1903
|
+
originalStates: i,
|
|
1904
|
+
previewStates: n,
|
|
1905
|
+
reelStates: a
|
|
1906
|
+
};
|
|
1907
|
+
}
|
|
1908
|
+
//#endregion
|
|
1909
|
+
//#region src/core/reelEscapeStack.ts
|
|
1910
|
+
var Ot = [];
|
|
1911
|
+
function kt(e) {
|
|
1912
|
+
return Ot.push(e), () => {
|
|
1913
|
+
let t = Ot.indexOf(e);
|
|
1914
|
+
t >= 0 && Ot.splice(t, 1);
|
|
1830
1915
|
};
|
|
1831
1916
|
}
|
|
1832
|
-
function
|
|
1917
|
+
function At(e) {
|
|
1833
1918
|
if (!e.isActive()) return !1;
|
|
1834
|
-
let t =
|
|
1919
|
+
let t = Ot.filter((e) => e.isActive()), n = e.element();
|
|
1835
1920
|
return n !== null && t.some((t) => {
|
|
1836
1921
|
if (t === e) return !1;
|
|
1837
1922
|
let r = t.element();
|
|
@@ -1847,14 +1932,14 @@ function Ot(e) {
|
|
|
1847
1932
|
}
|
|
1848
1933
|
//#endregion
|
|
1849
1934
|
//#region src/components/useReelKeyboard.ts
|
|
1850
|
-
function
|
|
1935
|
+
function jt(e) {
|
|
1851
1936
|
let t = {
|
|
1852
1937
|
element: e.element,
|
|
1853
1938
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
1854
1939
|
}, n = null;
|
|
1855
1940
|
function r(n) {
|
|
1856
1941
|
let r = t.isActive();
|
|
1857
|
-
if (n.key === "Escape" && r && !
|
|
1942
|
+
if (n.key === "Escape" && r && !At(t)) return;
|
|
1858
1943
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
1859
1944
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
1860
1945
|
return;
|
|
@@ -1874,14 +1959,14 @@ function kt(e) {
|
|
|
1874
1959
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
1875
1960
|
}
|
|
1876
1961
|
y(() => {
|
|
1877
|
-
n =
|
|
1962
|
+
n = kt(t), window.addEventListener("keydown", r);
|
|
1878
1963
|
}), v(() => {
|
|
1879
1964
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
1880
1965
|
});
|
|
1881
1966
|
}
|
|
1882
1967
|
//#endregion
|
|
1883
1968
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
1884
|
-
var
|
|
1969
|
+
var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
|
|
1885
1970
|
__name: "VibeSurface",
|
|
1886
1971
|
props: {
|
|
1887
1972
|
canRetryEnd: { type: Boolean },
|
|
@@ -1898,6 +1983,7 @@ var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
|
1898
1983
|
"closeReel",
|
|
1899
1984
|
"loadMore",
|
|
1900
1985
|
"mediaReady",
|
|
1986
|
+
"mediaVisible",
|
|
1901
1987
|
"openReel",
|
|
1902
1988
|
"reelMediaChange",
|
|
1903
1989
|
"reelInfoSheetChange",
|
|
@@ -1905,97 +1991,70 @@ var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
|
1905
1991
|
"retryForward"
|
|
1906
1992
|
],
|
|
1907
1993
|
setup(t, { expose: i, emit: c }) {
|
|
1908
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()),
|
|
1909
|
-
|
|
1994
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => I(l.state)), { markMasonryVisible: j, markPreviewError: P, markPreviewReady: F, markReelError: L, markReelReady: R, originalStates: z, previewStates: B, reelStates: V } = Dt(l.state, {
|
|
1995
|
+
ready: (e) => d("mediaReady", e),
|
|
1996
|
+
reelChange: (e) => d("reelMediaChange", e),
|
|
1997
|
+
visible: (e) => d("mediaVisible", e)
|
|
1998
|
+
}), H = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
|
|
1999
|
+
function K() {
|
|
1910
2000
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1911
2001
|
}
|
|
1912
|
-
function
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
2002
|
+
function q() {
|
|
2003
|
+
U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
|
|
2004
|
+
U = requestAnimationFrame(() => {
|
|
2005
|
+
U = null, S.value = /* @__PURE__ */ new Set();
|
|
1916
2006
|
});
|
|
1917
2007
|
});
|
|
1918
2008
|
}
|
|
1919
|
-
function
|
|
1920
|
-
let r = F(e, t);
|
|
1921
|
-
D.value.get(r) !== n && (D.value = new Map(D.value).set(r, n));
|
|
1922
|
-
}
|
|
1923
|
-
function re(e, t, n) {
|
|
1924
|
-
let r = F(e, t);
|
|
1925
|
-
A.value.get(r) !== n && (A.value = new Map(A.value).set(r, n));
|
|
1926
|
-
}
|
|
1927
|
-
function ie(e, t) {
|
|
1928
|
-
ne(e, t, "error");
|
|
1929
|
-
}
|
|
1930
|
-
function ae(e, t) {
|
|
1931
|
-
ne(e, t, "ready"), G(e, t, "masonry", null);
|
|
1932
|
-
}
|
|
1933
|
-
function W(e, t) {
|
|
1934
|
-
re(e, t, "error");
|
|
1935
|
-
}
|
|
1936
|
-
function oe(e, t) {
|
|
1937
|
-
if (l.state.reelMediaSource === "original") {
|
|
1938
|
-
W(e, t);
|
|
1939
|
-
return;
|
|
1940
|
-
}
|
|
1941
|
-
ie(e, t);
|
|
1942
|
-
}
|
|
1943
|
-
function se(e, t) {
|
|
1944
|
-
l.state.reelMediaSource === "original" ? re(e, t, "ready") : ne(e, t, "ready"), G(e, t, "reel", l.state.reelOrigin ?? "reel");
|
|
1945
|
-
}
|
|
1946
|
-
function G(e, t, n, r) {
|
|
1947
|
-
let i = I(l.state, e, t, n, r);
|
|
1948
|
-
i && d("mediaReady", i);
|
|
1949
|
-
}
|
|
1950
|
-
function K(e, t) {
|
|
2009
|
+
function te(e, t) {
|
|
1951
2010
|
let n = l.state.items.find((t) => t.postId === e);
|
|
1952
2011
|
if (!n) return;
|
|
1953
2012
|
let r = N(n, t);
|
|
1954
2013
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
1955
2014
|
}
|
|
1956
|
-
async function
|
|
2015
|
+
async function ne() {
|
|
1957
2016
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
1958
2017
|
}
|
|
1959
|
-
function
|
|
2018
|
+
function re(e) {
|
|
1960
2019
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
1961
2020
|
}
|
|
1962
|
-
function
|
|
2021
|
+
function ie(e) {
|
|
1963
2022
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
1964
2023
|
}
|
|
1965
|
-
function
|
|
2024
|
+
function ae(e) {
|
|
1966
2025
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
1967
2026
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
1968
2027
|
if (!t) return "not-found";
|
|
1969
2028
|
let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
1970
2029
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
1971
2030
|
}
|
|
1972
|
-
function
|
|
2031
|
+
function oe() {
|
|
1973
2032
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
1974
2033
|
}
|
|
1975
|
-
function
|
|
1976
|
-
|
|
2034
|
+
function se(e, t) {
|
|
2035
|
+
W = e, G = t === "keyboard", y.value = le(e), d("openReel", e), m(() => h.value?.focus());
|
|
1977
2036
|
}
|
|
1978
|
-
function
|
|
2037
|
+
function J(e) {
|
|
1979
2038
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
1980
2039
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
1981
2040
|
}
|
|
1982
|
-
function
|
|
1983
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
1984
|
-
let t = [...new Set(e)], n = t.filter(
|
|
2041
|
+
function ce(e) {
|
|
2042
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
|
|
2043
|
+
let t = [...new Set(e)], n = t.filter(J);
|
|
1985
2044
|
if (n.length === 0) return 0;
|
|
1986
|
-
let r = new Map(
|
|
2045
|
+
let r = new Map(D.value);
|
|
1987
2046
|
return n.forEach((e, t) => {
|
|
1988
|
-
r.set(e, t *
|
|
1989
|
-
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]),
|
|
2047
|
+
r.set(e, t * Mt);
|
|
2048
|
+
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), D.value = r, Nt + (n.length - 1) * Mt;
|
|
1990
2049
|
}
|
|
1991
|
-
function
|
|
1992
|
-
let n =
|
|
2050
|
+
function Y(e, t) {
|
|
2051
|
+
let n = J(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
1993
2052
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
1994
2053
|
r.classList.remove("media-card-focus-silent");
|
|
1995
2054
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
1996
2055
|
}
|
|
1997
|
-
function
|
|
1998
|
-
let t = g.value, n =
|
|
2056
|
+
function le(e) {
|
|
2057
|
+
let t = g.value, n = J(e);
|
|
1999
2058
|
if (t === null || n === null) return {};
|
|
2000
2059
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2001
2060
|
return {
|
|
@@ -2005,48 +2064,48 @@ var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
|
2005
2064
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2006
2065
|
};
|
|
2007
2066
|
}
|
|
2008
|
-
function
|
|
2009
|
-
l.state.reelOrigin === "masonry" && (
|
|
2067
|
+
function ue() {
|
|
2068
|
+
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2010
2069
|
}
|
|
2011
|
-
function
|
|
2012
|
-
let e =
|
|
2013
|
-
x.value = !1,
|
|
2014
|
-
e !== null &&
|
|
2070
|
+
function de() {
|
|
2071
|
+
let e = W, t = G;
|
|
2072
|
+
x.value = !1, W = null, G = !1, y.value = {}, m(() => {
|
|
2073
|
+
e !== null && Y(e, t);
|
|
2015
2074
|
});
|
|
2016
2075
|
}
|
|
2017
|
-
return
|
|
2018
|
-
closeMasonryReel:
|
|
2076
|
+
return jt({
|
|
2077
|
+
closeMasonryReel: ue,
|
|
2019
2078
|
element: () => g.value,
|
|
2020
2079
|
isReelLeaving: () => x.value,
|
|
2021
2080
|
reelRenderer: () => p.value,
|
|
2022
2081
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2023
2082
|
state: l.state
|
|
2024
|
-
}),
|
|
2025
|
-
let t = e.filter((e) => !
|
|
2026
|
-
if (
|
|
2083
|
+
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2084
|
+
let t = e.filter((e) => !H.has(e)), n = new Set(e);
|
|
2085
|
+
if (H = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || K()) return;
|
|
2027
2086
|
let r = /* @__PURE__ */ new Map();
|
|
2028
2087
|
e.forEach((e) => {
|
|
2029
2088
|
let t = C.value.get(e);
|
|
2030
2089
|
t !== void 0 && r.set(e, t);
|
|
2031
2090
|
}), t.forEach((e, t) => {
|
|
2032
|
-
r.set(e, t *
|
|
2033
|
-
}), C.value = r, S.value = new Set([...S.value, ...t]),
|
|
2091
|
+
r.set(e, t * Mt);
|
|
2092
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), q();
|
|
2034
2093
|
}, { flush: "sync" }), v(() => {
|
|
2035
|
-
|
|
2094
|
+
U !== null && cancelAnimationFrame(U);
|
|
2036
2095
|
}), i({
|
|
2037
|
-
changeActiveReelMedia:
|
|
2038
|
-
getAutoScrollElement:
|
|
2039
|
-
loadIfNearBottom:
|
|
2040
|
-
moveActiveReelPost:
|
|
2041
|
-
navigateToReelItem:
|
|
2042
|
-
startItemRemoval:
|
|
2096
|
+
changeActiveReelMedia: re,
|
|
2097
|
+
getAutoScrollElement: oe,
|
|
2098
|
+
loadIfNearBottom: ne,
|
|
2099
|
+
moveActiveReelPost: ie,
|
|
2100
|
+
navigateToReelItem: ae,
|
|
2101
|
+
startItemRemoval: ce,
|
|
2043
2102
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2044
2103
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2045
2104
|
}), (r, i) => (b(), s("div", {
|
|
2046
2105
|
ref_key: "surfaceElement",
|
|
2047
2106
|
ref: g,
|
|
2048
2107
|
class: "vibe-surface"
|
|
2049
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2108
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(wt, {
|
|
2050
2109
|
key: 0,
|
|
2051
2110
|
ref_key: "reelRenderer",
|
|
2052
2111
|
ref: p,
|
|
@@ -2071,51 +2130,25 @@ var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
|
2071
2130
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2072
2131
|
"next-page-error": !!t.state.nextPageError,
|
|
2073
2132
|
origin: "reel",
|
|
2074
|
-
"preview-states":
|
|
2133
|
+
"preview-states": E(V),
|
|
2075
2134
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2076
2135
|
"reel-forward": t.state.reelForward,
|
|
2077
|
-
state:
|
|
2136
|
+
state: A.value,
|
|
2078
2137
|
total: t.state.total,
|
|
2079
2138
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
2080
2139
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2081
|
-
onError:
|
|
2140
|
+
onError: E(L),
|
|
2082
2141
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2083
|
-
onMediaChange:
|
|
2084
|
-
onReady:
|
|
2142
|
+
onMediaChange: te,
|
|
2143
|
+
onReady: E(R),
|
|
2085
2144
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2086
2145
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
2087
|
-
}, null, 8,
|
|
2088
|
-
"can-retry-end",
|
|
2089
|
-
"has-next",
|
|
2090
|
-
"card-footer",
|
|
2091
|
-
"card-header",
|
|
2092
|
-
"feed-footer",
|
|
2093
|
-
"feed-footer-actions",
|
|
2094
|
-
"forward-index",
|
|
2095
|
-
"forward-item",
|
|
2096
|
-
"media-card",
|
|
2097
|
-
"infinite-scroll",
|
|
2098
|
-
"is-loading-more",
|
|
2099
|
-
"items",
|
|
2100
|
-
"load-more-locked",
|
|
2101
|
-
"media-source",
|
|
2102
|
-
"media-indices",
|
|
2103
|
-
"initial-post-id",
|
|
2104
|
-
"info-sheet",
|
|
2105
|
-
"info-sheet-enabled",
|
|
2106
|
-
"info-sheet-overlay",
|
|
2107
|
-
"next-page-error",
|
|
2108
|
-
"preview-states",
|
|
2109
|
-
"reel-auto-advance",
|
|
2110
|
-
"reel-forward",
|
|
2111
|
-
"state",
|
|
2112
|
-
"total"
|
|
2113
|
-
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(U, {
|
|
2146
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(ee, {
|
|
2114
2147
|
key: 1,
|
|
2115
2148
|
actions: t.feedFooterActions,
|
|
2116
2149
|
"can-retry-end": t.canRetryEnd,
|
|
2117
2150
|
"feed-footer": t.feedFooter,
|
|
2118
|
-
state:
|
|
2151
|
+
state: A.value,
|
|
2119
2152
|
onLoadMore: i[5] ||= (e) => d("loadMore"),
|
|
2120
2153
|
onRetryEnd: i[6] ||= (e) => d("retryEnd")
|
|
2121
2154
|
}, null, 8, [
|
|
@@ -2123,14 +2156,14 @@ var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
|
2123
2156
|
"can-retry-end",
|
|
2124
2157
|
"feed-footer",
|
|
2125
2158
|
"state"
|
|
2126
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2159
|
+
])) : (b(), s(e, { key: 2 }, [u(lt, {
|
|
2127
2160
|
ref_key: "masonryRenderer",
|
|
2128
2161
|
ref: f,
|
|
2129
2162
|
"can-retry-end": t.canRetryEnd,
|
|
2130
2163
|
"entering-post-ids": S.value,
|
|
2131
2164
|
"entry-delays": C.value,
|
|
2132
2165
|
"leaving-post-ids": T.value,
|
|
2133
|
-
"removal-delays":
|
|
2166
|
+
"removal-delays": D.value,
|
|
2134
2167
|
"card-footer": t.cardFooter,
|
|
2135
2168
|
"card-header": t.cardHeader,
|
|
2136
2169
|
"feed-footer": t.feedFooter,
|
|
@@ -2143,16 +2176,17 @@ var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
|
2143
2176
|
"load-more-locked": t.state.loadMoreLocked,
|
|
2144
2177
|
"media-indices": t.state.mediaIndices,
|
|
2145
2178
|
"next-page-error": !!t.state.nextPageError,
|
|
2146
|
-
"preview-states":
|
|
2179
|
+
"preview-states": E(B),
|
|
2147
2180
|
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2148
|
-
state:
|
|
2181
|
+
state: A.value,
|
|
2149
2182
|
total: t.state.total,
|
|
2150
|
-
onActivate:
|
|
2151
|
-
onError:
|
|
2183
|
+
onActivate: se,
|
|
2184
|
+
onError: E(P),
|
|
2152
2185
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2153
|
-
onMediaChange:
|
|
2154
|
-
onReady:
|
|
2155
|
-
onRetryEnd: i[8] ||= (e) => d("retryEnd")
|
|
2186
|
+
onMediaChange: te,
|
|
2187
|
+
onReady: E(F),
|
|
2188
|
+
onRetryEnd: i[8] ||= (e) => d("retryEnd"),
|
|
2189
|
+
onVisible: E(j)
|
|
2156
2190
|
}, null, 8, [
|
|
2157
2191
|
"can-retry-end",
|
|
2158
2192
|
"entering-post-ids",
|
|
@@ -2174,10 +2208,13 @@ var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
|
2174
2208
|
"preview-states",
|
|
2175
2209
|
"suspended",
|
|
2176
2210
|
"state",
|
|
2177
|
-
"total"
|
|
2211
|
+
"total",
|
|
2212
|
+
"onError",
|
|
2213
|
+
"onReady",
|
|
2214
|
+
"onVisible"
|
|
2178
2215
|
]), u(n, {
|
|
2179
2216
|
name: "vibe-reel-viewer",
|
|
2180
|
-
onAfterLeave:
|
|
2217
|
+
onAfterLeave: de
|
|
2181
2218
|
}, {
|
|
2182
2219
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2183
2220
|
key: 0,
|
|
@@ -2189,7 +2226,7 @@ var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
|
2189
2226
|
"aria-modal": "true",
|
|
2190
2227
|
tabindex: "-1",
|
|
2191
2228
|
style: _(y.value)
|
|
2192
|
-
}, [u(
|
|
2229
|
+
}, [u(wt, {
|
|
2193
2230
|
ref_key: "reelRenderer",
|
|
2194
2231
|
ref: p,
|
|
2195
2232
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2213,89 +2250,64 @@ var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
|
2213
2250
|
"media-source": "original",
|
|
2214
2251
|
"next-page-error": !!t.state.nextPageError,
|
|
2215
2252
|
origin: "masonry",
|
|
2216
|
-
"preview-states":
|
|
2253
|
+
"preview-states": E(z),
|
|
2217
2254
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2218
2255
|
"reel-forward": t.state.reelForward,
|
|
2219
|
-
state:
|
|
2256
|
+
state: A.value,
|
|
2220
2257
|
total: t.state.total,
|
|
2221
2258
|
onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
|
|
2222
2259
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2223
|
-
onError:
|
|
2260
|
+
onError: E(L),
|
|
2224
2261
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2225
|
-
onMediaChange:
|
|
2226
|
-
onReady:
|
|
2262
|
+
onMediaChange: te,
|
|
2263
|
+
onReady: E(R),
|
|
2227
2264
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2228
2265
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
2229
|
-
}, null, 8,
|
|
2230
|
-
"can-retry-end",
|
|
2231
|
-
"card-footer",
|
|
2232
|
-
"card-header",
|
|
2233
|
-
"feed-footer",
|
|
2234
|
-
"feed-footer-actions",
|
|
2235
|
-
"forward-index",
|
|
2236
|
-
"forward-item",
|
|
2237
|
-
"media-card",
|
|
2238
|
-
"has-next",
|
|
2239
|
-
"infinite-scroll",
|
|
2240
|
-
"initial-post-id",
|
|
2241
|
-
"info-sheet",
|
|
2242
|
-
"info-sheet-enabled",
|
|
2243
|
-
"info-sheet-overlay",
|
|
2244
|
-
"is-loading-more",
|
|
2245
|
-
"items",
|
|
2246
|
-
"load-more-locked",
|
|
2247
|
-
"media-indices",
|
|
2248
|
-
"next-page-error",
|
|
2249
|
-
"preview-states",
|
|
2250
|
-
"reel-auto-advance",
|
|
2251
|
-
"reel-forward",
|
|
2252
|
-
"state",
|
|
2253
|
-
"total"
|
|
2254
|
-
])], 4)) : o("", !0)]),
|
|
2266
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))], 4)) : o("", !0)]),
|
|
2255
2267
|
_: 1
|
|
2256
2268
|
})], 64))], 512));
|
|
2257
2269
|
}
|
|
2258
2270
|
});
|
|
2259
2271
|
//#endregion
|
|
2260
2272
|
//#region src/core/page.ts
|
|
2261
|
-
function
|
|
2273
|
+
function Ft(e) {
|
|
2262
2274
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2263
2275
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2264
2276
|
if (e.total !== void 0 && (!Number.isFinite(e.total) || e.total < 0)) throw TypeError("Vibe page total must be a non-negative number when provided.");
|
|
2265
2277
|
return e;
|
|
2266
2278
|
}
|
|
2267
|
-
function
|
|
2279
|
+
function Z(e, t) {
|
|
2268
2280
|
let n = new Set(e.map((e) => e.postId));
|
|
2269
2281
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2270
2282
|
}
|
|
2271
2283
|
//#endregion
|
|
2272
2284
|
//#region src/core/requestDelay.ts
|
|
2273
|
-
var
|
|
2285
|
+
var It = 2e3, Lt = 1e4, Rt = 250, zt = {
|
|
2274
2286
|
delayRemainingMs: null,
|
|
2275
2287
|
nextRequestAt: null
|
|
2276
2288
|
};
|
|
2277
|
-
function
|
|
2289
|
+
function Bt(e, t) {
|
|
2278
2290
|
return e === void 0 ? t : Math.floor(e);
|
|
2279
2291
|
}
|
|
2280
|
-
function
|
|
2292
|
+
function Vt(e, t) {
|
|
2281
2293
|
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.`);
|
|
2282
2294
|
}
|
|
2283
|
-
function
|
|
2284
|
-
let n =
|
|
2295
|
+
function Ht(e, t = {}) {
|
|
2296
|
+
let n = Bt(t.delayStepMs, It), r = Bt(t.delayMaxMs, Lt);
|
|
2285
2297
|
return Math.min(Math.max(0, e) * n, r);
|
|
2286
2298
|
}
|
|
2287
|
-
function
|
|
2288
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2299
|
+
function Q(e) {
|
|
2300
|
+
if (e == null || !Number.isFinite(e)) return { ...zt };
|
|
2289
2301
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2290
2302
|
return t > 0 ? {
|
|
2291
2303
|
delayRemainingMs: t,
|
|
2292
2304
|
nextRequestAt: e
|
|
2293
|
-
} : { ...
|
|
2305
|
+
} : { ...zt };
|
|
2294
2306
|
}
|
|
2295
|
-
async function
|
|
2307
|
+
async function Ut({ delayMs: e, onChange: t, signal: n }) {
|
|
2296
2308
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2297
2309
|
if (e <= 0) {
|
|
2298
|
-
t({ ...
|
|
2310
|
+
t({ ...zt });
|
|
2299
2311
|
return;
|
|
2300
2312
|
}
|
|
2301
2313
|
let r = Date.now() + e;
|
|
@@ -2303,9 +2315,9 @@ async function Vt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2303
2315
|
delayRemainingMs: e,
|
|
2304
2316
|
nextRequestAt: r
|
|
2305
2317
|
}), await new Promise((i, a) => {
|
|
2306
|
-
let o = !1, s = setInterval(f,
|
|
2318
|
+
let o = !1, s = setInterval(f, Rt), c = setTimeout(() => u(), e);
|
|
2307
2319
|
function l() {
|
|
2308
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2320
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...zt });
|
|
2309
2321
|
}
|
|
2310
2322
|
function u(e) {
|
|
2311
2323
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2314,42 +2326,42 @@ async function Vt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2314
2326
|
u(new DOMException("Aborted", "AbortError"));
|
|
2315
2327
|
}
|
|
2316
2328
|
function f() {
|
|
2317
|
-
let e =
|
|
2329
|
+
let e = Q(r);
|
|
2318
2330
|
t(e), e.delayRemainingMs === null && u();
|
|
2319
2331
|
}
|
|
2320
2332
|
n.addEventListener("abort", d, { once: !0 });
|
|
2321
2333
|
});
|
|
2322
2334
|
}
|
|
2323
|
-
var
|
|
2335
|
+
var Wt = class {
|
|
2324
2336
|
interval = null;
|
|
2325
2337
|
constructor(e) {
|
|
2326
2338
|
this.onChange = e;
|
|
2327
2339
|
}
|
|
2328
2340
|
clear() {
|
|
2329
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2341
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...zt });
|
|
2330
2342
|
}
|
|
2331
2343
|
sync(e) {
|
|
2332
2344
|
this.clear();
|
|
2333
|
-
let t =
|
|
2345
|
+
let t = Q(e);
|
|
2334
2346
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2335
|
-
let t =
|
|
2347
|
+
let t = Q(e);
|
|
2336
2348
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2337
|
-
},
|
|
2349
|
+
}, Rt));
|
|
2338
2350
|
}
|
|
2339
2351
|
};
|
|
2340
|
-
function
|
|
2352
|
+
function Gt(e, t = !0) {
|
|
2341
2353
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2342
2354
|
}
|
|
2343
|
-
function
|
|
2355
|
+
function Kt(e) {
|
|
2344
2356
|
return `${typeof e}:${String(e)}`;
|
|
2345
2357
|
}
|
|
2346
|
-
function
|
|
2358
|
+
function qt(e, t) {
|
|
2347
2359
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2348
2360
|
}
|
|
2349
|
-
function
|
|
2361
|
+
function Jt(e) {
|
|
2350
2362
|
if (!e) return;
|
|
2351
|
-
if (
|
|
2352
|
-
|
|
2363
|
+
if (qt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2364
|
+
Vt(e, "frontend autofill");
|
|
2353
2365
|
let t = e.maxAdditionalPages;
|
|
2354
2366
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2355
2367
|
return;
|
|
@@ -2361,7 +2373,7 @@ function Kt(e) {
|
|
|
2361
2373
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2362
2374
|
}
|
|
2363
2375
|
}
|
|
2364
|
-
function
|
|
2376
|
+
function Yt(e, t, n = !0) {
|
|
2365
2377
|
if (!e) return {
|
|
2366
2378
|
cycleId: null,
|
|
2367
2379
|
delayRemainingMs: null,
|
|
@@ -2378,7 +2390,7 @@ function qt(e, t, n = !0) {
|
|
|
2378
2390
|
status: "idle",
|
|
2379
2391
|
strategy: null
|
|
2380
2392
|
};
|
|
2381
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
2393
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Q(r?.nextRequestAt);
|
|
2382
2394
|
return {
|
|
2383
2395
|
cycleId: r?.cycleId ?? null,
|
|
2384
2396
|
...a,
|
|
@@ -2395,7 +2407,7 @@ function qt(e, t, n = !0) {
|
|
|
2395
2407
|
strategy: e.strategy
|
|
2396
2408
|
};
|
|
2397
2409
|
}
|
|
2398
|
-
function
|
|
2410
|
+
function Xt(e) {
|
|
2399
2411
|
return [
|
|
2400
2412
|
"cancelling",
|
|
2401
2413
|
"filling",
|
|
@@ -2403,9 +2415,9 @@ function Jt(e) {
|
|
|
2403
2415
|
"waiting"
|
|
2404
2416
|
].includes(e.status);
|
|
2405
2417
|
}
|
|
2406
|
-
async function
|
|
2418
|
+
async function Zt(e, t, n) {
|
|
2407
2419
|
let r = t.autofill;
|
|
2408
|
-
if (!
|
|
2420
|
+
if (!Xt(r) || !r.cycleId) return;
|
|
2409
2421
|
let i = {
|
|
2410
2422
|
cycleId: r.cycleId,
|
|
2411
2423
|
feedKey: r.feedKey ?? "",
|
|
@@ -2418,68 +2430,92 @@ async function Yt(e, t, n) {
|
|
|
2418
2430
|
throw r.error = e, r.status = "error", e;
|
|
2419
2431
|
}
|
|
2420
2432
|
}
|
|
2421
|
-
function
|
|
2433
|
+
function Qt(e, t, n) {
|
|
2422
2434
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2423
2435
|
}
|
|
2424
|
-
async function
|
|
2425
|
-
let
|
|
2426
|
-
for (;
|
|
2427
|
-
let e =
|
|
2428
|
-
if (
|
|
2429
|
-
|
|
2430
|
-
delayMs:
|
|
2436
|
+
async function $t({ 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 }) {
|
|
2437
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Gt(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2438
|
+
for (; y < h;) {
|
|
2439
|
+
let e = Kt(g);
|
|
2440
|
+
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2441
|
+
if (m.add(e), await Ut({
|
|
2442
|
+
delayMs: Ht(l + y, s),
|
|
2431
2443
|
onChange: a,
|
|
2432
|
-
signal:
|
|
2433
|
-
})
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2444
|
+
signal: d
|
|
2445
|
+
}), y > 0 && u()) return {
|
|
2446
|
+
items: f,
|
|
2447
|
+
lastCursor: _,
|
|
2448
|
+
missing: Math.max(0, s.pageSize - c - f.length),
|
|
2449
|
+
next: v,
|
|
2450
|
+
pages: b,
|
|
2451
|
+
received: c + f.length,
|
|
2452
|
+
requests: l + y,
|
|
2453
|
+
status: "paused",
|
|
2454
|
+
total: x
|
|
2455
|
+
};
|
|
2456
|
+
let t = Ft(await n({
|
|
2457
|
+
cursor: g,
|
|
2458
|
+
signal: d
|
|
2437
2459
|
}));
|
|
2438
|
-
|
|
2439
|
-
let r =
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
next:
|
|
2444
|
-
|
|
2445
|
-
|
|
2460
|
+
y += 1, _ = g;
|
|
2461
|
+
let r = Z(p, t.items).slice(p.length);
|
|
2462
|
+
b.push({
|
|
2463
|
+
contributionIds: r.map(({ postId: e }) => e),
|
|
2464
|
+
cursor: g,
|
|
2465
|
+
next: t.next,
|
|
2466
|
+
returnedIds: t.items.map(({ postId: e }) => e)
|
|
2467
|
+
}), p.push(...r), f.push(...r), v = t.next, t.total !== void 0 && (x = t.total);
|
|
2468
|
+
let h = {
|
|
2469
|
+
missing: Math.max(0, s.pageSize - c - f.length),
|
|
2470
|
+
next: v,
|
|
2471
|
+
received: c + f.length,
|
|
2472
|
+
requests: l + y
|
|
2446
2473
|
};
|
|
2447
|
-
o(
|
|
2448
|
-
let
|
|
2449
|
-
...
|
|
2450
|
-
items: [...
|
|
2451
|
-
lastCursor:
|
|
2452
|
-
|
|
2474
|
+
o(h);
|
|
2475
|
+
let S = {
|
|
2476
|
+
...h,
|
|
2477
|
+
items: [...f],
|
|
2478
|
+
lastCursor: _,
|
|
2479
|
+
pages: [...b],
|
|
2480
|
+
total: x
|
|
2453
2481
|
};
|
|
2454
|
-
if (i(
|
|
2455
|
-
...
|
|
2482
|
+
if (i(S), h.missing === 0) return {
|
|
2483
|
+
...S,
|
|
2484
|
+
pages: b,
|
|
2456
2485
|
status: "complete"
|
|
2457
2486
|
};
|
|
2458
|
-
if (
|
|
2459
|
-
...
|
|
2487
|
+
if (v === null) return {
|
|
2488
|
+
...S,
|
|
2489
|
+
pages: b,
|
|
2460
2490
|
status: "exhausted"
|
|
2461
2491
|
};
|
|
2462
|
-
|
|
2492
|
+
if (u()) return {
|
|
2493
|
+
...S,
|
|
2494
|
+
pages: b,
|
|
2495
|
+
status: "paused"
|
|
2496
|
+
};
|
|
2497
|
+
g = v;
|
|
2463
2498
|
}
|
|
2464
2499
|
return {
|
|
2465
|
-
items:
|
|
2466
|
-
lastCursor:
|
|
2467
|
-
missing: Math.max(0, s.pageSize - c -
|
|
2468
|
-
next:
|
|
2469
|
-
|
|
2470
|
-
|
|
2500
|
+
items: f,
|
|
2501
|
+
lastCursor: _,
|
|
2502
|
+
missing: Math.max(0, s.pageSize - c - f.length),
|
|
2503
|
+
next: v,
|
|
2504
|
+
pages: b,
|
|
2505
|
+
received: c + f.length,
|
|
2506
|
+
requests: l + y,
|
|
2471
2507
|
status: "exhausted",
|
|
2472
|
-
total:
|
|
2508
|
+
total: x
|
|
2473
2509
|
};
|
|
2474
2510
|
}
|
|
2475
2511
|
//#endregion
|
|
2476
2512
|
//#region src/core/autofillController.ts
|
|
2477
|
-
var
|
|
2513
|
+
var en = class {
|
|
2478
2514
|
collection = null;
|
|
2479
2515
|
cycle = 0;
|
|
2480
2516
|
delayCountdown;
|
|
2481
2517
|
constructor(e) {
|
|
2482
|
-
this.context = e, this.delayCountdown = new
|
|
2518
|
+
this.context = e, this.delayCountdown = new Wt((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2483
2519
|
}
|
|
2484
2520
|
beginCycle() {
|
|
2485
2521
|
let { options: e, state: t } = this.context;
|
|
@@ -2487,14 +2523,14 @@ var Qt = class {
|
|
|
2487
2523
|
this.clear();
|
|
2488
2524
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2489
2525
|
return t.autofill = {
|
|
2490
|
-
...
|
|
2526
|
+
...Yt(e, void 0, !1),
|
|
2491
2527
|
cycleId: n,
|
|
2492
2528
|
status: "filling"
|
|
2493
2529
|
}, n;
|
|
2494
2530
|
}
|
|
2495
2531
|
async cancel() {
|
|
2496
2532
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2497
|
-
await
|
|
2533
|
+
await Zt(t, n, e), this.commitCollection();
|
|
2498
2534
|
}
|
|
2499
2535
|
captureCollection(e, t) {
|
|
2500
2536
|
t && (this.collection = e);
|
|
@@ -2516,36 +2552,36 @@ var Qt = class {
|
|
|
2516
2552
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
2517
2553
|
if (t?.strategy !== "frontend") return;
|
|
2518
2554
|
let r = this.collection;
|
|
2519
|
-
this.collection = null, r && (n.items =
|
|
2555
|
+
this.collection = null, r && (n.items = Z(n.items, r.items), e(r.lastCursor), this.context.onPages(r.pages), n.next = r.next, r.total !== void 0 && (n.total = r.total), Object.assign(n.autofill, {
|
|
2520
2556
|
missing: r.missing,
|
|
2521
2557
|
received: r.received,
|
|
2522
2558
|
requests: r.requests
|
|
2523
2559
|
}));
|
|
2524
2560
|
}
|
|
2525
|
-
},
|
|
2526
|
-
function
|
|
2561
|
+
}, tn = 100;
|
|
2562
|
+
function nn(e, t) {
|
|
2527
2563
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2528
2564
|
}
|
|
2529
|
-
function
|
|
2565
|
+
function rn(e, t, n) {
|
|
2530
2566
|
return Math.min(n, Math.max(t, e));
|
|
2531
2567
|
}
|
|
2532
|
-
function
|
|
2568
|
+
function an(e) {
|
|
2533
2569
|
if (!e) return;
|
|
2534
2570
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2535
|
-
if (
|
|
2536
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2571
|
+
if (nn("autoScroll.minSpeedPxPerSecond", t), nn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2572
|
+
e.speedPxPerSecond !== void 0 && nn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2537
2573
|
}
|
|
2538
|
-
function
|
|
2574
|
+
function on(e) {
|
|
2539
2575
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2540
2576
|
return {
|
|
2541
2577
|
enabled: e?.enabled ?? !1,
|
|
2542
2578
|
maxSpeedPxPerSecond: n,
|
|
2543
2579
|
minSpeedPxPerSecond: t,
|
|
2544
2580
|
paused: !1,
|
|
2545
|
-
speedPxPerSecond:
|
|
2581
|
+
speedPxPerSecond: rn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2546
2582
|
};
|
|
2547
2583
|
}
|
|
2548
|
-
var
|
|
2584
|
+
var sn = class {
|
|
2549
2585
|
frame = null;
|
|
2550
2586
|
lastTimestamp = null;
|
|
2551
2587
|
mounted = !1;
|
|
@@ -2565,9 +2601,9 @@ var an = class {
|
|
|
2565
2601
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2566
2602
|
}
|
|
2567
2603
|
setSpeed(e) {
|
|
2568
|
-
|
|
2604
|
+
nn("auto-scroll speed", e);
|
|
2569
2605
|
let t = this.options.state;
|
|
2570
|
-
t.speedPxPerSecond =
|
|
2606
|
+
t.speedPxPerSecond = rn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2571
2607
|
}
|
|
2572
2608
|
tick = (e) => {
|
|
2573
2609
|
this.frame = null;
|
|
@@ -2579,7 +2615,7 @@ var an = class {
|
|
|
2579
2615
|
return;
|
|
2580
2616
|
}
|
|
2581
2617
|
if (this.lastTimestamp !== null) {
|
|
2582
|
-
let r = Math.min(
|
|
2618
|
+
let r = Math.min(tn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2583
2619
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2584
2620
|
}
|
|
2585
2621
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2593,13 +2629,13 @@ var an = class {
|
|
|
2593
2629
|
};
|
|
2594
2630
|
//#endregion
|
|
2595
2631
|
//#region src/core/backendAutofill.ts
|
|
2596
|
-
async function
|
|
2632
|
+
async function cn(e, t, n, r) {
|
|
2597
2633
|
let i = await e.onUnderfilled(n);
|
|
2598
2634
|
if (!r()) return;
|
|
2599
2635
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
2600
2636
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
2601
2637
|
Object.assign(t.autofill, {
|
|
2602
|
-
|
|
2638
|
+
...Q(i.nextRequestAt),
|
|
2603
2639
|
missing: Math.max(0, e.pageSize - a),
|
|
2604
2640
|
received: a,
|
|
2605
2641
|
sequence: i.sequence ?? 0,
|
|
@@ -2607,81 +2643,82 @@ async function on(e, t, n, r) {
|
|
|
2607
2643
|
status: "waiting"
|
|
2608
2644
|
});
|
|
2609
2645
|
}
|
|
2610
|
-
function
|
|
2611
|
-
["complete", "exhausted"].includes(t.status) && t.items && (e.items =
|
|
2646
|
+
function ln(e, t) {
|
|
2647
|
+
["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);
|
|
2612
2648
|
}
|
|
2613
|
-
function
|
|
2649
|
+
function un(e, t, n) {
|
|
2614
2650
|
let r = t.autofill;
|
|
2615
|
-
return !
|
|
2651
|
+
return !Qt(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (ln(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);
|
|
2616
2652
|
}
|
|
2617
|
-
function
|
|
2618
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2653
|
+
function dn(e, t, n) {
|
|
2654
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Yt(e, n), ln(t, n), !0);
|
|
2619
2655
|
}
|
|
2620
2656
|
//#endregion
|
|
2621
2657
|
//#region src/core/initialAutofill.ts
|
|
2622
|
-
async function
|
|
2623
|
-
let
|
|
2624
|
-
if (!
|
|
2625
|
-
let
|
|
2626
|
-
if (Object.assign(
|
|
2627
|
-
missing: Math.max(0,
|
|
2628
|
-
received:
|
|
2658
|
+
async function fn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2659
|
+
let c = a.autofill;
|
|
2660
|
+
if (!c) return;
|
|
2661
|
+
let l = s.items.length;
|
|
2662
|
+
if (Object.assign(s.autofill, {
|
|
2663
|
+
missing: Math.max(0, c.pageSize - l),
|
|
2664
|
+
received: l,
|
|
2629
2665
|
requests: 1
|
|
2630
|
-
}),
|
|
2631
|
-
|
|
2666
|
+
}), l >= c.pageSize) {
|
|
2667
|
+
s.autofill.status = "complete";
|
|
2632
2668
|
return;
|
|
2633
2669
|
}
|
|
2634
|
-
if (
|
|
2635
|
-
await
|
|
2670
|
+
if (c.strategy === "backend") {
|
|
2671
|
+
await cn(c, s, {
|
|
2636
2672
|
cycleId: e,
|
|
2637
|
-
feedKey:
|
|
2638
|
-
items: [...
|
|
2639
|
-
missing:
|
|
2640
|
-
next:
|
|
2641
|
-
pageSize:
|
|
2642
|
-
received:
|
|
2643
|
-
signal:
|
|
2644
|
-
total:
|
|
2673
|
+
feedKey: c.feedKey,
|
|
2674
|
+
items: [...s.items],
|
|
2675
|
+
missing: c.pageSize - l,
|
|
2676
|
+
next: s.next,
|
|
2677
|
+
pageSize: c.pageSize,
|
|
2678
|
+
received: l,
|
|
2679
|
+
signal: o,
|
|
2680
|
+
total: s.total
|
|
2645
2681
|
}, t);
|
|
2646
2682
|
return;
|
|
2647
2683
|
}
|
|
2648
|
-
if (!
|
|
2649
|
-
|
|
2684
|
+
if (!a.loadPage || s.next === null) {
|
|
2685
|
+
s.autofill.status = "exhausted";
|
|
2650
2686
|
return;
|
|
2651
2687
|
}
|
|
2652
|
-
let
|
|
2653
|
-
existingItems:
|
|
2654
|
-
initialCursor:
|
|
2655
|
-
loadPage:
|
|
2656
|
-
maximumRequests:
|
|
2688
|
+
let u = await $t({
|
|
2689
|
+
existingItems: s.items,
|
|
2690
|
+
initialCursor: s.next,
|
|
2691
|
+
loadPage: a.loadPage,
|
|
2692
|
+
maximumRequests: Gt(c, !1),
|
|
2657
2693
|
onCollection: n,
|
|
2658
2694
|
onDelayChange: (e) => {
|
|
2659
|
-
t() && Object.assign(
|
|
2695
|
+
t() && Object.assign(s.autofill, e);
|
|
2660
2696
|
},
|
|
2661
2697
|
onProgress: (e) => {
|
|
2662
|
-
t() && Object.assign(
|
|
2698
|
+
t() && Object.assign(s.autofill, e, { status: "filling" });
|
|
2663
2699
|
},
|
|
2664
|
-
options:
|
|
2665
|
-
receivedOffset:
|
|
2700
|
+
options: c,
|
|
2701
|
+
receivedOffset: l,
|
|
2666
2702
|
requestOffset: 1,
|
|
2667
|
-
|
|
2703
|
+
shouldPause: () => s.loadMoreLocked,
|
|
2704
|
+
signal: o
|
|
2668
2705
|
});
|
|
2669
|
-
t() && (
|
|
2670
|
-
missing:
|
|
2671
|
-
received:
|
|
2672
|
-
requests:
|
|
2673
|
-
status:
|
|
2706
|
+
t() && (s.items = Z(s.items, u.items), s.next = u.next, u.total !== void 0 && (s.total = u.total), r(u.lastCursor), i(u.pages), Object.assign(s.autofill, {
|
|
2707
|
+
missing: u.missing,
|
|
2708
|
+
received: u.received,
|
|
2709
|
+
requests: u.requests,
|
|
2710
|
+
status: u.status
|
|
2674
2711
|
}));
|
|
2675
2712
|
}
|
|
2676
2713
|
//#endregion
|
|
2677
2714
|
//#region src/core/fill.ts
|
|
2678
|
-
function
|
|
2715
|
+
function pn(e) {
|
|
2679
2716
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2680
2717
|
}
|
|
2681
|
-
function
|
|
2718
|
+
function mn(e) {
|
|
2682
2719
|
return `${typeof e}:${String(e)}`;
|
|
2683
2720
|
}
|
|
2684
|
-
function
|
|
2721
|
+
function hn(e) {
|
|
2685
2722
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2686
2723
|
if ("pages" in e) {
|
|
2687
2724
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2690,21 +2727,21 @@ function pn(e) {
|
|
|
2690
2727
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2691
2728
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2692
2729
|
}
|
|
2693
|
-
function
|
|
2730
|
+
function gn(e) {
|
|
2694
2731
|
if (!e) return;
|
|
2695
2732
|
if (e.strategy === "frontend") {
|
|
2696
|
-
|
|
2733
|
+
Vt(e, "frontend fill");
|
|
2697
2734
|
return;
|
|
2698
2735
|
}
|
|
2699
2736
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2700
2737
|
let t = e.initialSession;
|
|
2701
2738
|
if (t) {
|
|
2702
2739
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2703
|
-
|
|
2740
|
+
hn(t.target);
|
|
2704
2741
|
}
|
|
2705
2742
|
}
|
|
2706
|
-
function
|
|
2707
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
2743
|
+
function _n(e, t, n = !0) {
|
|
2744
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
|
|
2708
2745
|
return {
|
|
2709
2746
|
completedPages: i?.completedPages ?? 0,
|
|
2710
2747
|
cycleId: i?.cycleId ?? null,
|
|
@@ -2717,10 +2754,10 @@ function hn(e, t, n = !0) {
|
|
|
2717
2754
|
sessionId: i?.sessionId ?? null,
|
|
2718
2755
|
status: i?.status ?? "idle",
|
|
2719
2756
|
strategy: e?.strategy ?? null,
|
|
2720
|
-
target: i ?
|
|
2757
|
+
target: i ? pn(i.target) : null
|
|
2721
2758
|
};
|
|
2722
2759
|
}
|
|
2723
|
-
function
|
|
2760
|
+
function vn(e) {
|
|
2724
2761
|
return [
|
|
2725
2762
|
"cancelling",
|
|
2726
2763
|
"filling",
|
|
@@ -2728,64 +2765,99 @@ function gn(e) {
|
|
|
2728
2765
|
"waiting"
|
|
2729
2766
|
].includes(e.status);
|
|
2730
2767
|
}
|
|
2731
|
-
async function
|
|
2732
|
-
let
|
|
2733
|
-
for (;
|
|
2734
|
-
let e =
|
|
2735
|
-
if (
|
|
2736
|
-
|
|
2737
|
-
delayMs:
|
|
2738
|
-
onChange:
|
|
2739
|
-
signal:
|
|
2740
|
-
})
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2768
|
+
async function yn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
2769
|
+
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
2770
|
+
for (; _ !== null;) {
|
|
2771
|
+
let e = mn(h);
|
|
2772
|
+
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2773
|
+
if (p.add(e), await Ut({
|
|
2774
|
+
delayMs: Ht(m, o),
|
|
2775
|
+
onChange: i,
|
|
2776
|
+
signal: c
|
|
2777
|
+
}), m > 0 && s()) return {
|
|
2778
|
+
completedPages: m,
|
|
2779
|
+
items: u,
|
|
2780
|
+
lastCursor: g,
|
|
2781
|
+
next: _,
|
|
2782
|
+
pages: d,
|
|
2783
|
+
received: v,
|
|
2784
|
+
status: "paused",
|
|
2785
|
+
total: y
|
|
2786
|
+
};
|
|
2787
|
+
let t = Ft(await n({
|
|
2788
|
+
cursor: h,
|
|
2789
|
+
signal: c
|
|
2744
2790
|
}));
|
|
2745
|
-
|
|
2746
|
-
let
|
|
2747
|
-
if (
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2791
|
+
m += 1, g = h;
|
|
2792
|
+
let b = Z(f, t.items).slice(f.length);
|
|
2793
|
+
if (d.push({
|
|
2794
|
+
contributionIds: b.map(({ postId: e }) => e),
|
|
2795
|
+
cursor: h,
|
|
2796
|
+
next: t.next,
|
|
2797
|
+
returnedIds: t.items.map(({ postId: e }) => e)
|
|
2798
|
+
}), f.push(...b), u.push(...b), v = u.length, _ = t.next, t.total !== void 0 && (y = t.total), a({
|
|
2799
|
+
completedPages: m,
|
|
2800
|
+
next: _,
|
|
2801
|
+
received: v
|
|
2802
|
+
}), r({
|
|
2803
|
+
completedPages: m,
|
|
2804
|
+
items: [...u],
|
|
2805
|
+
lastCursor: h,
|
|
2806
|
+
next: _,
|
|
2807
|
+
pages: [...d],
|
|
2808
|
+
received: v,
|
|
2809
|
+
total: y
|
|
2810
|
+
}), "pages" in l && m >= l.pages) return {
|
|
2811
|
+
completedPages: m,
|
|
2812
|
+
items: u,
|
|
2813
|
+
lastCursor: h,
|
|
2814
|
+
next: _,
|
|
2815
|
+
pages: d,
|
|
2816
|
+
received: v,
|
|
2757
2817
|
status: "complete",
|
|
2758
|
-
total:
|
|
2818
|
+
total: y
|
|
2819
|
+
};
|
|
2820
|
+
if (_ === null) return {
|
|
2821
|
+
completedPages: m,
|
|
2822
|
+
items: u,
|
|
2823
|
+
lastCursor: h,
|
|
2824
|
+
next: _,
|
|
2825
|
+
pages: d,
|
|
2826
|
+
received: v,
|
|
2827
|
+
status: "pages" in l ? "exhausted" : "complete",
|
|
2828
|
+
total: y
|
|
2759
2829
|
};
|
|
2760
|
-
if (
|
|
2761
|
-
completedPages:
|
|
2762
|
-
items:
|
|
2763
|
-
lastCursor:
|
|
2764
|
-
next:
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2830
|
+
if (s()) return {
|
|
2831
|
+
completedPages: m,
|
|
2832
|
+
items: u,
|
|
2833
|
+
lastCursor: h,
|
|
2834
|
+
next: _,
|
|
2835
|
+
pages: d,
|
|
2836
|
+
received: v,
|
|
2837
|
+
status: "paused",
|
|
2838
|
+
total: y
|
|
2768
2839
|
};
|
|
2769
|
-
|
|
2840
|
+
h = _;
|
|
2770
2841
|
}
|
|
2771
2842
|
return {
|
|
2772
|
-
completedPages:
|
|
2773
|
-
items:
|
|
2774
|
-
lastCursor:
|
|
2843
|
+
completedPages: m,
|
|
2844
|
+
items: u,
|
|
2845
|
+
lastCursor: h,
|
|
2775
2846
|
next: null,
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2847
|
+
pages: d,
|
|
2848
|
+
received: v,
|
|
2849
|
+
status: "pages" in l ? "exhausted" : "complete",
|
|
2850
|
+
total: y
|
|
2779
2851
|
};
|
|
2780
2852
|
}
|
|
2781
2853
|
//#endregion
|
|
2782
2854
|
//#region src/core/backendFill.ts
|
|
2783
|
-
async function
|
|
2855
|
+
async function bn(e, t, n, r) {
|
|
2784
2856
|
let i = await e.onStart(n);
|
|
2785
2857
|
if (r()) {
|
|
2786
2858
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
2787
2859
|
Object.assign(t.fill, {
|
|
2788
|
-
|
|
2860
|
+
...Q(i.nextRequestAt),
|
|
2789
2861
|
completedPages: i.completedPages ?? 0,
|
|
2790
2862
|
received: i.received ?? 0,
|
|
2791
2863
|
sequence: i.sequence ?? 0,
|
|
@@ -2794,23 +2866,23 @@ async function vn(e, t, n, r) {
|
|
|
2794
2866
|
});
|
|
2795
2867
|
}
|
|
2796
2868
|
}
|
|
2797
|
-
function
|
|
2869
|
+
function xn(e, t, n) {
|
|
2798
2870
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2799
2871
|
}
|
|
2800
|
-
function
|
|
2872
|
+
function Sn(e) {
|
|
2801
2873
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2802
2874
|
}
|
|
2803
|
-
function
|
|
2875
|
+
function Cn(e, t) {
|
|
2804
2876
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2805
2877
|
let n = e.fill.target;
|
|
2806
2878
|
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;
|
|
2807
2879
|
}
|
|
2808
|
-
function
|
|
2809
|
-
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items =
|
|
2880
|
+
function wn(e, t, n) {
|
|
2881
|
+
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));
|
|
2810
2882
|
}
|
|
2811
|
-
function
|
|
2812
|
-
return !
|
|
2813
|
-
|
|
2883
|
+
function Tn(e, t, n, r) {
|
|
2884
|
+
return !xn(e, t, n) || !Sn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Cn(t, n) ? !1 : (wn(t, n, r), Object.assign(t.fill, {
|
|
2885
|
+
...Q(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2814
2886
|
completedPages: n.completedPages,
|
|
2815
2887
|
error: n.error ?? null,
|
|
2816
2888
|
received: n.received,
|
|
@@ -2818,41 +2890,42 @@ function Cn(e, t, n, r) {
|
|
|
2818
2890
|
status: n.status
|
|
2819
2891
|
}), !0);
|
|
2820
2892
|
}
|
|
2821
|
-
function
|
|
2893
|
+
function En(e, t, n, r) {
|
|
2822
2894
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2823
2895
|
let i = t.fill;
|
|
2824
|
-
return t.fill =
|
|
2896
|
+
return t.fill = _n(e, n), !Sn(n) || !Cn(t, n) ? (t.fill = i, !1) : (wn(t, n, r), !0);
|
|
2825
2897
|
}
|
|
2826
2898
|
//#endregion
|
|
2827
2899
|
//#region src/core/fillController.ts
|
|
2828
|
-
var
|
|
2900
|
+
var Dn = class {
|
|
2829
2901
|
abortController = null;
|
|
2830
2902
|
cycle = 0;
|
|
2831
2903
|
delayCountdown;
|
|
2832
2904
|
requestVersion = 0;
|
|
2905
|
+
collection = null;
|
|
2833
2906
|
constructor(e) {
|
|
2834
|
-
this.options = e, this.delayCountdown = new
|
|
2907
|
+
this.options = e, this.delayCountdown = new Wt((e) => {
|
|
2835
2908
|
Object.assign(this.options.state.fill, e);
|
|
2836
2909
|
}), this.syncBackendCountdown();
|
|
2837
2910
|
}
|
|
2838
2911
|
isActive() {
|
|
2839
|
-
return
|
|
2912
|
+
return vn(this.options.state.fill);
|
|
2840
2913
|
}
|
|
2841
2914
|
applyUpdate(e) {
|
|
2842
|
-
let t =
|
|
2915
|
+
let t = Tn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2843
2916
|
return t && this.syncBackendCountdown(), t;
|
|
2844
2917
|
}
|
|
2845
2918
|
restoreSession(e) {
|
|
2846
|
-
let t =
|
|
2919
|
+
let t = En(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2847
2920
|
return t && this.syncBackendCountdown(), t;
|
|
2848
2921
|
}
|
|
2849
2922
|
async start(e) {
|
|
2850
2923
|
let t = this.options.fill;
|
|
2851
2924
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2852
2925
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2853
|
-
let n =
|
|
2926
|
+
let n = hn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2854
2927
|
if (this.options.state.fill = {
|
|
2855
|
-
...
|
|
2928
|
+
..._n(t, void 0, !1),
|
|
2856
2929
|
cycleId: r,
|
|
2857
2930
|
status: "filling",
|
|
2858
2931
|
target: n
|
|
@@ -2863,7 +2936,7 @@ var Tn = class {
|
|
|
2863
2936
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2864
2937
|
this.abortController = a;
|
|
2865
2938
|
try {
|
|
2866
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
2939
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await bn(t, this.options.state, {
|
|
2867
2940
|
cycleId: r,
|
|
2868
2941
|
feedKey: t.feedKey,
|
|
2869
2942
|
items: [...this.options.state.items],
|
|
@@ -2881,13 +2954,13 @@ var Tn = class {
|
|
|
2881
2954
|
}
|
|
2882
2955
|
async cancel() {
|
|
2883
2956
|
let { fill: e, state: t } = this.options;
|
|
2884
|
-
if (!
|
|
2957
|
+
if (!vn(t.fill) || !t.fill.cycleId) return;
|
|
2885
2958
|
let n = {
|
|
2886
2959
|
cycleId: t.fill.cycleId,
|
|
2887
2960
|
feedKey: t.fill.feedKey ?? "",
|
|
2888
2961
|
sessionId: t.fill.sessionId
|
|
2889
2962
|
};
|
|
2890
|
-
t.fill.status = "cancelling", this.delayCountdown.clear(), this.abortController?.abort(), this.requestVersion += 1, this.abortController = null, t.isLoadingMore = !1;
|
|
2963
|
+
t.fill.status = "cancelling", this.delayCountdown.clear(), this.abortController?.abort(), this.requestVersion += 1, this.abortController = null, t.isLoadingMore = !1, this.commitCollection();
|
|
2891
2964
|
try {
|
|
2892
2965
|
e?.strategy === "backend" && await e.onCancel(n), t.fill.error = null, t.fill.status = "cancelled";
|
|
2893
2966
|
} catch (e) {
|
|
@@ -2895,7 +2968,7 @@ var Tn = class {
|
|
|
2895
2968
|
}
|
|
2896
2969
|
}
|
|
2897
2970
|
reset() {
|
|
2898
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
2971
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = _n(this.options.fill, void 0, !1), this.collection = null;
|
|
2899
2972
|
}
|
|
2900
2973
|
destroy() {
|
|
2901
2974
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2911,10 +2984,13 @@ var Tn = class {
|
|
|
2911
2984
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2912
2985
|
let a = this.options.state;
|
|
2913
2986
|
a.isLoadingMore = !0;
|
|
2914
|
-
let o = await
|
|
2987
|
+
let o = await yn({
|
|
2915
2988
|
existingItems: a.items,
|
|
2916
2989
|
initialCursor: a.next,
|
|
2917
2990
|
loadPage: i,
|
|
2991
|
+
onCollection: (e) => {
|
|
2992
|
+
this.isCurrent(r) && (this.collection = e);
|
|
2993
|
+
},
|
|
2918
2994
|
onDelayChange: (e) => {
|
|
2919
2995
|
this.isCurrent(r) && Object.assign(a.fill, e);
|
|
2920
2996
|
},
|
|
@@ -2922,14 +2998,24 @@ var Tn = class {
|
|
|
2922
2998
|
this.isCurrent(r) && Object.assign(a.fill, e);
|
|
2923
2999
|
},
|
|
2924
3000
|
options: e,
|
|
3001
|
+
shouldPause: () => a.loadMoreLocked,
|
|
2925
3002
|
signal: n.signal,
|
|
2926
3003
|
target: t
|
|
2927
3004
|
});
|
|
2928
|
-
this.isCurrent(r) && (a.items =
|
|
3005
|
+
this.isCurrent(r) && (a.items = Z(a.items, o.items), a.next = o.next, o.total !== void 0 && (a.total = o.total), this.options.onLastCursor(o.lastCursor), this.options.onPages(o.pages), Object.assign(a.fill, {
|
|
2929
3006
|
completedPages: o.completedPages,
|
|
2930
3007
|
received: o.received,
|
|
2931
3008
|
status: o.status
|
|
2932
|
-
}));
|
|
3009
|
+
}), this.collection = null);
|
|
3010
|
+
}
|
|
3011
|
+
commitCollection() {
|
|
3012
|
+
let e = this.collection;
|
|
3013
|
+
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
3014
|
+
let t = this.options.state;
|
|
3015
|
+
t.items = Z(t.items, e.items), t.next = e.next, e.total !== void 0 && (t.total = e.total), this.options.onLastCursor(e.lastCursor), this.options.onPages(e.pages), Object.assign(t.fill, {
|
|
3016
|
+
completedPages: e.completedPages,
|
|
3017
|
+
received: e.received
|
|
3018
|
+
});
|
|
2933
3019
|
}
|
|
2934
3020
|
syncBackendCountdown() {
|
|
2935
3021
|
let e = this.options.state.fill;
|
|
@@ -2938,7 +3024,7 @@ var Tn = class {
|
|
|
2938
3024
|
};
|
|
2939
3025
|
//#endregion
|
|
2940
3026
|
//#region src/core/feedFooter.ts
|
|
2941
|
-
function
|
|
3027
|
+
function On(e) {
|
|
2942
3028
|
return {
|
|
2943
3029
|
cancelAutofill: () => e.cancelAutofill(),
|
|
2944
3030
|
loadMore: () => e.loadNext(),
|
|
@@ -2946,62 +3032,63 @@ function En(e) {
|
|
|
2946
3032
|
retryEnd: () => e.retryEnd()
|
|
2947
3033
|
};
|
|
2948
3034
|
}
|
|
2949
|
-
function
|
|
3035
|
+
function kn(e) {
|
|
2950
3036
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
2951
3037
|
}
|
|
2952
|
-
function
|
|
2953
|
-
e?.intervalMs !== void 0 &&
|
|
3038
|
+
function An(e) {
|
|
3039
|
+
e?.intervalMs !== void 0 && kn(e.intervalMs);
|
|
2954
3040
|
}
|
|
2955
|
-
function
|
|
3041
|
+
function jn(e) {
|
|
2956
3042
|
return {
|
|
2957
3043
|
enabled: e?.enabled ?? !1,
|
|
2958
3044
|
includePostItems: e?.includePostItems ?? !1,
|
|
2959
3045
|
intervalMs: e?.intervalMs ?? 5e3
|
|
2960
3046
|
};
|
|
2961
3047
|
}
|
|
2962
|
-
function
|
|
3048
|
+
function Mn(e, t) {
|
|
2963
3049
|
if (typeof t == "boolean") {
|
|
2964
3050
|
e.enabled = t;
|
|
2965
3051
|
return;
|
|
2966
3052
|
}
|
|
2967
|
-
|
|
3053
|
+
An(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);
|
|
2968
3054
|
}
|
|
2969
3055
|
//#endregion
|
|
2970
3056
|
//#region src/core/reelInfoSheet.ts
|
|
2971
|
-
function
|
|
3057
|
+
function Nn(e) {
|
|
2972
3058
|
return { enabled: e?.enabled ?? !1 };
|
|
2973
3059
|
}
|
|
2974
|
-
function
|
|
3060
|
+
function Pn(e, t, n) {
|
|
2975
3061
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
2976
3062
|
e.enabled = n;
|
|
2977
3063
|
}
|
|
2978
3064
|
//#endregion
|
|
2979
3065
|
//#region src/core/initialRuntimeState.ts
|
|
2980
|
-
function
|
|
3066
|
+
function Fn(e, t) {
|
|
2981
3067
|
let n = e.initialPage;
|
|
2982
3068
|
return {
|
|
2983
3069
|
activeReelPostId: null,
|
|
2984
|
-
autoScroll:
|
|
2985
|
-
autofill:
|
|
3070
|
+
autoScroll: on(e.autoScroll),
|
|
3071
|
+
autofill: Yt(e.autofill),
|
|
2986
3072
|
error: null,
|
|
2987
|
-
fill:
|
|
3073
|
+
fill: _n(e.fill),
|
|
2988
3074
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
2989
3075
|
isLoading: !n,
|
|
2990
3076
|
isLoadingMore: !1,
|
|
2991
|
-
items: n ?
|
|
3077
|
+
items: n ? Z([], n.items) : [],
|
|
2992
3078
|
layout: t === "reel" ? "reel" : "masonry",
|
|
2993
3079
|
loadMoreLocked: !1,
|
|
2994
3080
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
2995
3081
|
next: n?.next ?? null,
|
|
2996
3082
|
nextPageError: null,
|
|
2997
|
-
|
|
3083
|
+
phoneMode: !1,
|
|
3084
|
+
reelAutoAdvance: jn(e.reelAutoAdvance),
|
|
2998
3085
|
reelForward: {
|
|
2999
3086
|
error: null,
|
|
3000
3087
|
status: "idle"
|
|
3001
3088
|
},
|
|
3002
3089
|
reelForwardIndex: null,
|
|
3003
3090
|
reelForwardItem: null,
|
|
3004
|
-
reelInfoSheet:
|
|
3091
|
+
reelInfoSheet: Nn(e.reelInfoSheet),
|
|
3005
3092
|
reelInfoSheetOverlay: !1,
|
|
3006
3093
|
reelMediaSource: "original",
|
|
3007
3094
|
reelOrigin: null,
|
|
@@ -3010,26 +3097,34 @@ function Nn(e, t) {
|
|
|
3010
3097
|
}
|
|
3011
3098
|
//#endregion
|
|
3012
3099
|
//#region src/core/options.ts
|
|
3013
|
-
function
|
|
3100
|
+
function In(e, t) {
|
|
3014
3101
|
if (t) {
|
|
3015
3102
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3016
3103
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3017
3104
|
}
|
|
3018
3105
|
}
|
|
3019
|
-
function
|
|
3106
|
+
function Ln(e, t) {
|
|
3020
3107
|
if (t) {
|
|
3021
3108
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3022
3109
|
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.`);
|
|
3023
3110
|
}
|
|
3024
3111
|
}
|
|
3025
|
-
function
|
|
3026
|
-
if (
|
|
3112
|
+
function Rn(e) {
|
|
3113
|
+
if (an(e.autoScroll), In("cardHeader", e.cardHeader), In("cardFooter", e.cardFooter), Ln("header", e.mediaCard?.header), Ln("footer", e.mediaCard?.footer), Jt(e.autofill), gn(e.fill), An(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3114
|
+
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3115
|
+
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3116
|
+
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
3117
|
+
if (!e.loadPage) throw TypeError("Vibe removalReconciliation requires loadPage.");
|
|
3118
|
+
if (e.autofill?.strategy === "backend") throw TypeError("Vibe removalReconciliation does not support backend autofill.");
|
|
3119
|
+
if (e.fill?.strategy === "backend") throw TypeError("Vibe removalReconciliation does not support backend fill.");
|
|
3120
|
+
}
|
|
3121
|
+
if (e.removalHistoryLimit !== void 0 && (!Number.isInteger(e.removalHistoryLimit) || e.removalHistoryLimit < 0)) throw TypeError("Vibe removalHistoryLimit must be a non-negative integer.");
|
|
3027
3122
|
if (!e.initialPage && !e.loadPage) throw TypeError("Vibe requires either initialPage or loadPage.");
|
|
3028
3123
|
if (e.initialPage?.next !== null && !e.loadPage) throw TypeError("Vibe requires loadPage when initialPage has a next cursor.");
|
|
3029
3124
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3030
3125
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3031
3126
|
}
|
|
3032
|
-
function
|
|
3127
|
+
function zn(e) {
|
|
3033
3128
|
if (typeof e != "string") return e;
|
|
3034
3129
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3035
3130
|
let t = document.querySelector(e);
|
|
@@ -3037,8 +3132,208 @@ function Ln(e) {
|
|
|
3037
3132
|
return t;
|
|
3038
3133
|
}
|
|
3039
3134
|
//#endregion
|
|
3135
|
+
//#region src/core/pageRequest.ts
|
|
3136
|
+
async function Bn({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3137
|
+
let u = s.autofill, d = e && u?.strategy === "frontend" && l.autofill.status === "paused", f = d ? {
|
|
3138
|
+
received: l.autofill.received,
|
|
3139
|
+
requests: l.autofill.requests
|
|
3140
|
+
} : null, p = u ? d ? l.autofill.cycleId : t.beginCycle() : null;
|
|
3141
|
+
d && Object.assign(l.autofill, {
|
|
3142
|
+
error: null,
|
|
3143
|
+
status: "filling"
|
|
3144
|
+
});
|
|
3145
|
+
let m = !1;
|
|
3146
|
+
try {
|
|
3147
|
+
if (u?.strategy === "frontend") {
|
|
3148
|
+
let s = await $t({
|
|
3149
|
+
existingItems: e ? l.items : [],
|
|
3150
|
+
initialCursor: n,
|
|
3151
|
+
loadPage: i,
|
|
3152
|
+
maximumRequests: f ? Math.max(0, Gt(u) - f.requests) : void 0,
|
|
3153
|
+
onCollection: (e) => t.captureCollection(e, r()),
|
|
3154
|
+
onDelayChange: (e) => {
|
|
3155
|
+
r() && Object.assign(l.autofill, e);
|
|
3156
|
+
},
|
|
3157
|
+
onProgress: (e) => {
|
|
3158
|
+
r() && Object.assign(l.autofill, e, { status: "filling" });
|
|
3159
|
+
},
|
|
3160
|
+
options: u,
|
|
3161
|
+
receivedOffset: f?.received,
|
|
3162
|
+
requestOffset: f?.requests,
|
|
3163
|
+
shouldPause: () => l.loadMoreLocked,
|
|
3164
|
+
signal: c
|
|
3165
|
+
});
|
|
3166
|
+
if (!r()) return;
|
|
3167
|
+
l.items = e ? Z(l.items, s.items) : [...s.items], a(s.lastCursor), l.next = s.next, s.total !== void 0 && (l.total = s.total), Object.assign(l.autofill, {
|
|
3168
|
+
missing: s.missing,
|
|
3169
|
+
received: s.received,
|
|
3170
|
+
requests: s.requests,
|
|
3171
|
+
status: s.status
|
|
3172
|
+
}), o(s.pages), t.clearCollection();
|
|
3173
|
+
return;
|
|
3174
|
+
}
|
|
3175
|
+
let s = Ft(await i({
|
|
3176
|
+
cursor: n,
|
|
3177
|
+
signal: c
|
|
3178
|
+
}));
|
|
3179
|
+
if (!r()) return;
|
|
3180
|
+
let d = e ? l.items : [], h = Z(d, s.items), g = h.length - d.length;
|
|
3181
|
+
if (l.items = h, a(n), o([{
|
|
3182
|
+
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
3183
|
+
cursor: n,
|
|
3184
|
+
next: s.next,
|
|
3185
|
+
returnedIds: s.items.map(({ postId: e }) => e)
|
|
3186
|
+
}]), l.next = s.next, s.total !== void 0 && (l.total = s.total), m = !0, u?.strategy === "backend" && p) {
|
|
3187
|
+
if (Object.assign(l.autofill, {
|
|
3188
|
+
missing: Math.max(0, u.pageSize - g),
|
|
3189
|
+
received: g,
|
|
3190
|
+
requests: 1
|
|
3191
|
+
}), g >= u.pageSize) {
|
|
3192
|
+
l.autofill.status = "complete";
|
|
3193
|
+
return;
|
|
3194
|
+
}
|
|
3195
|
+
await cn(u, l, {
|
|
3196
|
+
cycleId: p,
|
|
3197
|
+
feedKey: u.feedKey,
|
|
3198
|
+
items: h.slice(d.length),
|
|
3199
|
+
missing: u.pageSize - g,
|
|
3200
|
+
next: s.next,
|
|
3201
|
+
pageSize: u.pageSize,
|
|
3202
|
+
received: g,
|
|
3203
|
+
signal: c,
|
|
3204
|
+
total: l.total
|
|
3205
|
+
}, r), t.syncCountdown();
|
|
3206
|
+
}
|
|
3207
|
+
} catch (t) {
|
|
3208
|
+
if (c.aborted || !r()) return;
|
|
3209
|
+
u && (l.autofill.error = t, l.autofill.status = "error"), m || (e ? l.nextPageError = t : l.error = t);
|
|
3210
|
+
} finally {
|
|
3211
|
+
r() && (t.clearCollection(), l.isLoading = !1, l.isLoadingMore = !1);
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
//#endregion
|
|
3215
|
+
//#region src/core/removalReconciliationController.ts
|
|
3216
|
+
function $(e) {
|
|
3217
|
+
return `${typeof e}:${String(e)}`;
|
|
3218
|
+
}
|
|
3219
|
+
function Vn(e) {
|
|
3220
|
+
return `${typeof e}:${String(e)}`;
|
|
3221
|
+
}
|
|
3222
|
+
function Hn(e) {
|
|
3223
|
+
return e.map(({ postId: e }) => e);
|
|
3224
|
+
}
|
|
3225
|
+
var Un = class {
|
|
3226
|
+
delay;
|
|
3227
|
+
enabled;
|
|
3228
|
+
maxReplayPages;
|
|
3229
|
+
pageSize;
|
|
3230
|
+
pages = [];
|
|
3231
|
+
pending = null;
|
|
3232
|
+
tombstones = /* @__PURE__ */ new Set();
|
|
3233
|
+
constructor(e) {
|
|
3234
|
+
let t = e.removalReconciliation;
|
|
3235
|
+
this.enabled = !!t, this.maxReplayPages = t?.maxReplayPages ?? 5, this.pageSize = t?.pageSize ?? 0, this.delay = e.autofill?.strategy === "frontend" ? e.autofill : {
|
|
3236
|
+
delayMaxMs: 0,
|
|
3237
|
+
delayStepMs: 0
|
|
3238
|
+
};
|
|
3239
|
+
}
|
|
3240
|
+
completeReconciliation(e) {
|
|
3241
|
+
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
3242
|
+
}
|
|
3243
|
+
filterItems(e) {
|
|
3244
|
+
return !this.enabled || this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has($(e)));
|
|
3245
|
+
}
|
|
3246
|
+
needsReconciliation(e) {
|
|
3247
|
+
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
3248
|
+
}
|
|
3249
|
+
hasPendingSession() {
|
|
3250
|
+
return this.pending !== null;
|
|
3251
|
+
}
|
|
3252
|
+
recordPages(e) {
|
|
3253
|
+
!this.enabled || e.length === 0 || (e.forEach((e) => this.recordPage(e)), this.pages = this.pages.slice(-this.maxReplayPages));
|
|
3254
|
+
}
|
|
3255
|
+
remove(e) {
|
|
3256
|
+
this.enabled && e.forEach((e) => this.tombstones.add($(e)));
|
|
3257
|
+
}
|
|
3258
|
+
reset() {
|
|
3259
|
+
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
3260
|
+
}
|
|
3261
|
+
restore(e) {
|
|
3262
|
+
this.enabled && e.forEach((e) => this.tombstones.delete($(e)));
|
|
3263
|
+
}
|
|
3264
|
+
async reconcile({ existingItems: e, loadPage: t, shouldPause: n = () => !1, signal: r }) {
|
|
3265
|
+
let i = this.pending ?? this.createSession(e);
|
|
3266
|
+
for (this.pending = i; i.remainingRequests > 0;) {
|
|
3267
|
+
let e = Vn(i.cursor);
|
|
3268
|
+
if (i.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3269
|
+
if (await Ut({
|
|
3270
|
+
delayMs: Ht(i.pages.length, this.delay),
|
|
3271
|
+
onChange: () => void 0,
|
|
3272
|
+
signal: r
|
|
3273
|
+
}), i.pages.length > 0 && n()) return this.result(i, "paused");
|
|
3274
|
+
let a = Ft(await t({
|
|
3275
|
+
cursor: i.cursor,
|
|
3276
|
+
signal: r
|
|
3277
|
+
}));
|
|
3278
|
+
i.seenCursors.add(e);
|
|
3279
|
+
let o = this.filterItems(a.items), s = [];
|
|
3280
|
+
if (o.forEach((e) => {
|
|
3281
|
+
let t = $(e.postId);
|
|
3282
|
+
i.attributed.has(t) || (i.attributed.add(t), s.push(e.postId)), i.appended.has(t) || (i.appended.add(t), i.items.push(e));
|
|
3283
|
+
}), i.pages.push({
|
|
3284
|
+
contributionIds: s,
|
|
3285
|
+
cursor: i.cursor,
|
|
3286
|
+
next: a.next,
|
|
3287
|
+
returnedIds: Hn(o)
|
|
3288
|
+
}), i.lastCursor = i.cursor, i.next = a.next, --i.remainingRequests, a.total !== void 0 && (i.total = a.total), i.next === null ? i.remainingRequests = 0 : i.cursor = i.next, i.remainingRequests > 0 && n()) return this.result(i, "paused");
|
|
3289
|
+
}
|
|
3290
|
+
return this.result(i, "complete");
|
|
3291
|
+
}
|
|
3292
|
+
createSession(e) {
|
|
3293
|
+
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
3294
|
+
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
3295
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map($))), a = new Set(e.map(({ postId: e }) => $(e)).filter((e) => !i.has(e)));
|
|
3296
|
+
return {
|
|
3297
|
+
appended: new Set(e.map(({ postId: e }) => $(e))),
|
|
3298
|
+
attributed: new Set(a),
|
|
3299
|
+
cursor: r.cursor,
|
|
3300
|
+
items: [],
|
|
3301
|
+
lastCursor: r.cursor,
|
|
3302
|
+
next: r.cursor,
|
|
3303
|
+
pages: [],
|
|
3304
|
+
remainingRequests: n.length,
|
|
3305
|
+
replaceFrom: t,
|
|
3306
|
+
seenCursors: /* @__PURE__ */ new Set()
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
result(e, t) {
|
|
3310
|
+
return {
|
|
3311
|
+
items: [...e.items],
|
|
3312
|
+
lastCursor: e.lastCursor,
|
|
3313
|
+
next: e.next,
|
|
3314
|
+
pages: [...e.pages],
|
|
3315
|
+
replaceFrom: e.replaceFrom,
|
|
3316
|
+
status: t,
|
|
3317
|
+
total: e.total
|
|
3318
|
+
};
|
|
3319
|
+
}
|
|
3320
|
+
findUnderfilledPage(e) {
|
|
3321
|
+
if (!this.enabled || this.pages.length === 0) return -1;
|
|
3322
|
+
let t = new Set(e.map(({ postId: e }) => $(e)));
|
|
3323
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
|
|
3324
|
+
}
|
|
3325
|
+
recordPage(e) {
|
|
3326
|
+
let t = Vn(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Vn(e) === t);
|
|
3327
|
+
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3328
|
+
...e,
|
|
3329
|
+
contributionIds: [...e.contributionIds],
|
|
3330
|
+
returnedIds: [...e.returnedIds]
|
|
3331
|
+
});
|
|
3332
|
+
}
|
|
3333
|
+
};
|
|
3334
|
+
//#endregion
|
|
3040
3335
|
//#region src/core/activeItemRemoval.ts
|
|
3041
|
-
function
|
|
3336
|
+
function Wn(e, t, n, r, i) {
|
|
3042
3337
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3043
3338
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3044
3339
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3051,7 +3346,7 @@ function Rn(e, t, n, r, i) {
|
|
|
3051
3346
|
}
|
|
3052
3347
|
//#endregion
|
|
3053
3348
|
//#region src/core/exactMediaRemovalController.ts
|
|
3054
|
-
function
|
|
3349
|
+
function Gn(e, t) {
|
|
3055
3350
|
let [n, ...r] = t;
|
|
3056
3351
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3057
3352
|
return {
|
|
@@ -3060,10 +3355,10 @@ function zn(e, t) {
|
|
|
3060
3355
|
items: r
|
|
3061
3356
|
};
|
|
3062
3357
|
}
|
|
3063
|
-
function
|
|
3358
|
+
function Kn(e) {
|
|
3064
3359
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3065
3360
|
}
|
|
3066
|
-
var
|
|
3361
|
+
var qn = class {
|
|
3067
3362
|
generation = 0;
|
|
3068
3363
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3069
3364
|
state;
|
|
@@ -3071,7 +3366,7 @@ var Vn = class {
|
|
|
3071
3366
|
this.options = e, this.state = e.state;
|
|
3072
3367
|
}
|
|
3073
3368
|
remove(e) {
|
|
3074
|
-
|
|
3369
|
+
Kn(e);
|
|
3075
3370
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3076
3371
|
if (!n) return null;
|
|
3077
3372
|
let r = [...M(n)], i = r[e.mediaIndex];
|
|
@@ -3088,7 +3383,7 @@ var Vn = class {
|
|
|
3088
3383
|
restored: !1
|
|
3089
3384
|
});
|
|
3090
3385
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3091
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3386
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Gn(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);
|
|
3092
3387
|
}
|
|
3093
3388
|
reset() {
|
|
3094
3389
|
this.generation += 1;
|
|
@@ -3097,7 +3392,7 @@ var Vn = class {
|
|
|
3097
3392
|
let t = this.metadata.get(e);
|
|
3098
3393
|
if (!t) throw TypeError("Vibe media removal does not belong to this instance.");
|
|
3099
3394
|
if (t.generation !== this.generation || t.restored) return !1;
|
|
3100
|
-
t.restored = !0;
|
|
3395
|
+
t.restored = !0, this.options.onPostRestored(e.postId);
|
|
3101
3396
|
let n = this.state.items.findIndex(({ postId: t }) => t === e.postId);
|
|
3102
3397
|
return n >= 0 ? this.restoreIntoPost(n, e) : this.state.items.splice(Math.min(e.postIndex, this.state.items.length), 0, t.originalItem), this.options.reelForward.cancel(e) && (this.state.mediaIndices.set(e.postId, e.mediaIndex), this.options.onActivate(e.postId)), !0;
|
|
3103
3398
|
}
|
|
@@ -3114,7 +3409,7 @@ var Vn = class {
|
|
|
3114
3409
|
}
|
|
3115
3410
|
restoreIntoPost(e, t) {
|
|
3116
3411
|
let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3117
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3412
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Gn(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3118
3413
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3119
3414
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3120
3415
|
}
|
|
@@ -3127,18 +3422,18 @@ var Vn = class {
|
|
|
3127
3422
|
};
|
|
3128
3423
|
//#endregion
|
|
3129
3424
|
//#region src/core/itemPlacement.ts
|
|
3130
|
-
function
|
|
3425
|
+
function Jn(e, t) {
|
|
3131
3426
|
let n = new Set(t);
|
|
3132
3427
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3133
3428
|
index: t,
|
|
3134
3429
|
item: e
|
|
3135
3430
|
}] : []);
|
|
3136
3431
|
}
|
|
3137
|
-
function
|
|
3432
|
+
function Yn(e, t) {
|
|
3138
3433
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3139
3434
|
return e.filter((e) => !n.has(e.postId));
|
|
3140
3435
|
}
|
|
3141
|
-
function
|
|
3436
|
+
function Xn(e, t) {
|
|
3142
3437
|
t.forEach(({ index: e }) => {
|
|
3143
3438
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3144
3439
|
});
|
|
@@ -3149,7 +3444,7 @@ function Wn(e, t) {
|
|
|
3149
3444
|
}
|
|
3150
3445
|
//#endregion
|
|
3151
3446
|
//#region src/core/itemRemovalController.ts
|
|
3152
|
-
var
|
|
3447
|
+
var Zn = 20, Qn = class {
|
|
3153
3448
|
generation = 0;
|
|
3154
3449
|
historyLimit;
|
|
3155
3450
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3158,7 +3453,7 @@ var Gn = 20, Kn = class {
|
|
|
3158
3453
|
itemOrder;
|
|
3159
3454
|
stopItemsWatcher;
|
|
3160
3455
|
constructor(e) {
|
|
3161
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3456
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Zn, 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" });
|
|
3162
3457
|
}
|
|
3163
3458
|
destroy() {
|
|
3164
3459
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3171,7 +3466,7 @@ var Gn = 20, Kn = class {
|
|
|
3171
3466
|
let i = this.options.startRemoval(r);
|
|
3172
3467
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
3173
3468
|
let a = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), o = new Set(t.map(({ item: e }) => e.postId)), s = a < 0 ? 0 : this.state.items.slice(0, a).filter(({ postId: e }) => o.has(e)).length, c = Math.max(a - s, 0);
|
|
3174
|
-
return this.state.items =
|
|
3469
|
+
return this.state.items = Yn(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
|
|
3175
3470
|
}
|
|
3176
3471
|
reset() {
|
|
3177
3472
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3182,7 +3477,7 @@ var Gn = 20, Kn = class {
|
|
|
3182
3477
|
this.restoreRemoval(t);
|
|
3183
3478
|
return;
|
|
3184
3479
|
}
|
|
3185
|
-
let n =
|
|
3480
|
+
let n = Xn(this.state.items, e);
|
|
3186
3481
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
3187
3482
|
}
|
|
3188
3483
|
restoreRemoval(e) {
|
|
@@ -3208,7 +3503,7 @@ var Gn = 20, Kn = class {
|
|
|
3208
3503
|
}
|
|
3209
3504
|
collectOrderedPlacements(e) {
|
|
3210
3505
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3211
|
-
return
|
|
3506
|
+
return Jn(this.state.items, e).map((e) => ({
|
|
3212
3507
|
index: t.get(e.item.postId) ?? e.index,
|
|
3213
3508
|
item: e.item
|
|
3214
3509
|
}));
|
|
@@ -3239,7 +3534,7 @@ var Gn = 20, Kn = class {
|
|
|
3239
3534
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3240
3535
|
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;
|
|
3241
3536
|
}
|
|
3242
|
-
},
|
|
3537
|
+
}, $n = class {
|
|
3243
3538
|
forward = null;
|
|
3244
3539
|
forwardPromise = null;
|
|
3245
3540
|
forwardVersion = 0;
|
|
@@ -3317,7 +3612,7 @@ var Gn = 20, Kn = class {
|
|
|
3317
3612
|
}
|
|
3318
3613
|
}
|
|
3319
3614
|
}
|
|
3320
|
-
},
|
|
3615
|
+
}, er = class {
|
|
3321
3616
|
generation = 0;
|
|
3322
3617
|
pending = Promise.resolve();
|
|
3323
3618
|
constructor(e) {
|
|
@@ -3367,24 +3662,27 @@ var Gn = 20, Kn = class {
|
|
|
3367
3662
|
};
|
|
3368
3663
|
//#endregion
|
|
3369
3664
|
//#region src/core/removalControllers.ts
|
|
3370
|
-
function
|
|
3371
|
-
let t = new
|
|
3665
|
+
function tr(e) {
|
|
3666
|
+
let t = new $n(e), n = new er({
|
|
3372
3667
|
state: e.state,
|
|
3373
3668
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3374
3669
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3375
3670
|
});
|
|
3376
3671
|
return {
|
|
3377
|
-
exactMediaRemoval: new
|
|
3672
|
+
exactMediaRemoval: new qn({
|
|
3378
3673
|
onActivate: e.onActivate,
|
|
3674
|
+
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
3675
|
+
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
3379
3676
|
reelForward: t,
|
|
3380
3677
|
state: e.state
|
|
3381
3678
|
}),
|
|
3382
|
-
itemRemoval: new
|
|
3679
|
+
itemRemoval: new Qn({
|
|
3383
3680
|
historyLimit: e.historyLimit,
|
|
3384
3681
|
onItemsRemoved: (n, r, i) => {
|
|
3385
|
-
|
|
3682
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Wn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3386
3683
|
},
|
|
3387
3684
|
onRemovalRestored: (n) => {
|
|
3685
|
+
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
3388
3686
|
let r = t.cancel(n);
|
|
3389
3687
|
r && e.onActivate(r.postId);
|
|
3390
3688
|
},
|
|
@@ -3396,17 +3694,17 @@ function Yn(e) {
|
|
|
3396
3694
|
reelRemoval: n
|
|
3397
3695
|
};
|
|
3398
3696
|
}
|
|
3399
|
-
var
|
|
3400
|
-
function
|
|
3697
|
+
var nr = 1.5;
|
|
3698
|
+
function rr(e) {
|
|
3401
3699
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3402
3700
|
if (t > 0 && t < 600) return !0;
|
|
3403
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3701
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * nr;
|
|
3404
3702
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3405
3703
|
}
|
|
3406
|
-
function
|
|
3407
|
-
return
|
|
3704
|
+
function ir(e) {
|
|
3705
|
+
return rr(e) ? "reel" : "masonry";
|
|
3408
3706
|
}
|
|
3409
|
-
function
|
|
3707
|
+
function ar(e) {
|
|
3410
3708
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3411
3709
|
return {
|
|
3412
3710
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3416,15 +3714,15 @@ function $n(e) {
|
|
|
3416
3714
|
viewportWidth: n.clientWidth
|
|
3417
3715
|
};
|
|
3418
3716
|
}
|
|
3419
|
-
function
|
|
3420
|
-
return
|
|
3717
|
+
function or(e) {
|
|
3718
|
+
return rr(ar(e));
|
|
3421
3719
|
}
|
|
3422
|
-
function
|
|
3423
|
-
return
|
|
3720
|
+
function sr(e) {
|
|
3721
|
+
return ir(ar(e));
|
|
3424
3722
|
}
|
|
3425
3723
|
//#endregion
|
|
3426
3724
|
//#region src/core/responsiveLayoutController.ts
|
|
3427
|
-
var
|
|
3725
|
+
var cr = class {
|
|
3428
3726
|
layoutMode;
|
|
3429
3727
|
resizeObserver = null;
|
|
3430
3728
|
target = null;
|
|
@@ -3449,10 +3747,10 @@ var nr = class {
|
|
|
3449
3747
|
}
|
|
3450
3748
|
handleResponsiveLayout = () => {
|
|
3451
3749
|
if (!this.target) return;
|
|
3452
|
-
let e =
|
|
3453
|
-
this.state.
|
|
3750
|
+
let e = sr(this.target);
|
|
3751
|
+
this.state.phoneMode = or(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3454
3752
|
};
|
|
3455
|
-
},
|
|
3753
|
+
}, lr = class {
|
|
3456
3754
|
routedReelPostId = null;
|
|
3457
3755
|
reelRouteIsActive = !1;
|
|
3458
3756
|
constructor(e, t) {
|
|
@@ -3479,7 +3777,7 @@ var nr = class {
|
|
|
3479
3777
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3480
3778
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3481
3779
|
}
|
|
3482
|
-
},
|
|
3780
|
+
}, ur = class {
|
|
3483
3781
|
app = null;
|
|
3484
3782
|
autoScroll;
|
|
3485
3783
|
autofillController;
|
|
@@ -3491,6 +3789,7 @@ var nr = class {
|
|
|
3491
3789
|
fillController;
|
|
3492
3790
|
exactMediaRemoval;
|
|
3493
3791
|
itemRemoval;
|
|
3792
|
+
removalReconciliation;
|
|
3494
3793
|
reelForward;
|
|
3495
3794
|
reelRemoval;
|
|
3496
3795
|
surface = null;
|
|
@@ -3498,50 +3797,55 @@ var nr = class {
|
|
|
3498
3797
|
lastLoadedCursor = null;
|
|
3499
3798
|
state;
|
|
3500
3799
|
constructor(e) {
|
|
3501
|
-
this.options = e,
|
|
3800
|
+
this.options = e, Rn(e);
|
|
3502
3801
|
let t = e.layout ?? "masonry";
|
|
3503
|
-
this.state = x(
|
|
3802
|
+
this.state = x(Fn(e, t)), this.autoScroll = new sn({
|
|
3504
3803
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3505
3804
|
state: this.state.autoScroll
|
|
3506
|
-
}), this.autofillController = new
|
|
3805
|
+
}), this.autofillController = new en({
|
|
3507
3806
|
cancelRequest: () => this.cancelRequest(),
|
|
3508
3807
|
onLastCursor: (e) => {
|
|
3509
3808
|
this.lastLoadedCursor = e;
|
|
3510
3809
|
},
|
|
3810
|
+
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3511
3811
|
options: e.autofill,
|
|
3512
3812
|
state: this.state
|
|
3513
|
-
}), this.fillController = new
|
|
3813
|
+
}), this.removalReconciliation = new Un(e), this.fillController = new Dn({
|
|
3514
3814
|
fill: e.fill,
|
|
3515
|
-
loadPage: e.loadPage,
|
|
3815
|
+
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
3516
3816
|
onLastCursor: (e) => {
|
|
3517
3817
|
this.lastLoadedCursor = e;
|
|
3518
3818
|
},
|
|
3819
|
+
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3519
3820
|
state: this.state
|
|
3520
|
-
}), this.routing = new
|
|
3521
|
-
let n =
|
|
3821
|
+
}), this.routing = new lr(e.routing, this.state);
|
|
3822
|
+
let n = tr({
|
|
3522
3823
|
historyLimit: e.removalHistoryLimit,
|
|
3523
3824
|
loadNext: () => this.loadNext(),
|
|
3524
3825
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
3826
|
+
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
3827
|
+
onItemsRestored: (e) => this.removalReconciliation.restore(e),
|
|
3525
3828
|
retryEnd: () => this.retryEnd(),
|
|
3526
3829
|
state: this.state,
|
|
3527
3830
|
surface: () => this.surface
|
|
3528
3831
|
});
|
|
3529
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
3832
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new cr(t, this.state, () => {
|
|
3530
3833
|
this.routing.syncFeed();
|
|
3531
3834
|
}), this.startStateNotifications();
|
|
3532
3835
|
}
|
|
3533
3836
|
async mount() {
|
|
3534
3837
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3535
3838
|
this.startStateNotifications();
|
|
3536
|
-
let e =
|
|
3537
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
3839
|
+
let e = zn(this.options.target);
|
|
3840
|
+
this.responsiveLayout.mount(e), this.app = i(Pt, {
|
|
3538
3841
|
canRetryEnd: !!this.options.loadPage,
|
|
3539
3842
|
cardFooter: this.options.cardFooter,
|
|
3540
3843
|
cardHeader: this.options.cardHeader,
|
|
3541
3844
|
feedFooter: this.options.feedFooter,
|
|
3542
|
-
feedFooterActions:
|
|
3845
|
+
feedFooterActions: On(this),
|
|
3543
3846
|
mediaCard: this.options.mediaCard,
|
|
3544
3847
|
onMediaReady: this.options.onMediaReady,
|
|
3848
|
+
onMediaVisible: this.options.onMediaVisible,
|
|
3545
3849
|
onReelMediaChange: this.options.onReelMediaChange,
|
|
3546
3850
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
3547
3851
|
state: this.state,
|
|
@@ -3560,13 +3864,13 @@ var nr = class {
|
|
|
3560
3864
|
onRetryForward: () => {
|
|
3561
3865
|
this.retryReelForward();
|
|
3562
3866
|
}
|
|
3563
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), this.options.initialPage ? this.options.autofill && this.state.autofill.status === "idle" && !this.fillController.isActive() && await this.startInitialAutofill() : await this.reload();
|
|
3867
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), this.options.initialPage ? this.options.autofill && this.state.autofill.status === "idle" && !this.fillController.isActive() && !this.state.loadMoreLocked && await this.startInitialAutofill() : await this.reload();
|
|
3564
3868
|
}
|
|
3565
3869
|
destroy() {
|
|
3566
|
-
this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
3870
|
+
this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.removalReconciliation.reset(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
3567
3871
|
}
|
|
3568
3872
|
getState() {
|
|
3569
|
-
return
|
|
3873
|
+
return I(this.state);
|
|
3570
3874
|
}
|
|
3571
3875
|
removeMedia(e) {
|
|
3572
3876
|
return this.exactMediaRemoval.remove(e);
|
|
@@ -3620,12 +3924,23 @@ var nr = class {
|
|
|
3620
3924
|
this.autoScroll.setSpeed(e);
|
|
3621
3925
|
}
|
|
3622
3926
|
applyAutofillUpdate(e) {
|
|
3623
|
-
let t =
|
|
3927
|
+
let t = un(this.options.autofill, this.state, e);
|
|
3624
3928
|
return t && this.autofillController.syncCountdown(), t;
|
|
3625
3929
|
}
|
|
3626
3930
|
cancelAutofill() {
|
|
3627
3931
|
return this.autofillController.cancel();
|
|
3628
3932
|
}
|
|
3933
|
+
async cancelLoading() {
|
|
3934
|
+
if (this.state.loadMoreLocked = !1, this.fillController.isActive()) {
|
|
3935
|
+
await this.cancelFill();
|
|
3936
|
+
return;
|
|
3937
|
+
}
|
|
3938
|
+
if (Xt(this.state.autofill)) {
|
|
3939
|
+
await this.cancelAutofill();
|
|
3940
|
+
return;
|
|
3941
|
+
}
|
|
3942
|
+
this.cancelRequest();
|
|
3943
|
+
}
|
|
3629
3944
|
applyFillUpdate(e) {
|
|
3630
3945
|
return this.fillController.applyUpdate(e);
|
|
3631
3946
|
}
|
|
@@ -3633,11 +3948,13 @@ var nr = class {
|
|
|
3633
3948
|
return this.fillController.cancel();
|
|
3634
3949
|
}
|
|
3635
3950
|
async fill(e) {
|
|
3636
|
-
if (this.
|
|
3637
|
-
|
|
3951
|
+
if (!this.state.loadMoreLocked) {
|
|
3952
|
+
if (this.pendingRequest || Xt(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
3953
|
+
await this.fillController.start(e);
|
|
3954
|
+
}
|
|
3638
3955
|
}
|
|
3639
3956
|
restoreAutofillSession(e) {
|
|
3640
|
-
let t =
|
|
3957
|
+
let t = dn(this.options.autofill, this.state, e);
|
|
3641
3958
|
return t && this.autofillController.syncCountdown(), t;
|
|
3642
3959
|
}
|
|
3643
3960
|
restoreFillSession(e) {
|
|
@@ -3645,7 +3962,12 @@ var nr = class {
|
|
|
3645
3962
|
}
|
|
3646
3963
|
async loadNext() {
|
|
3647
3964
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3648
|
-
if (
|
|
3965
|
+
if (this.state.loadMoreLocked || Xt(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
3966
|
+
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
3967
|
+
let e = this.loadNextSequence();
|
|
3968
|
+
return this.pendingRequest = e, e.finally(() => {
|
|
3969
|
+
this.pendingRequest === e && (this.pendingRequest = null), this.state.isLoadingMore = !1;
|
|
3970
|
+
});
|
|
3649
3971
|
}
|
|
3650
3972
|
async refresh() {
|
|
3651
3973
|
return this.replaceFeed(this.state.next ?? this.lastLoadedCursor, "refresh");
|
|
@@ -3655,23 +3977,73 @@ var nr = class {
|
|
|
3655
3977
|
}
|
|
3656
3978
|
async replaceFeed(e, t) {
|
|
3657
3979
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
3658
|
-
return
|
|
3980
|
+
return Xt(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Yt(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.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
|
|
3981
|
+
}
|
|
3982
|
+
async loadFilteredPage(e) {
|
|
3983
|
+
let t = this.options.loadPage;
|
|
3984
|
+
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
3985
|
+
let n = Ft(await t(e));
|
|
3986
|
+
return {
|
|
3987
|
+
...n,
|
|
3988
|
+
items: this.removalReconciliation.filterItems(n.items)
|
|
3989
|
+
};
|
|
3990
|
+
}
|
|
3991
|
+
async loadNextSequence() {
|
|
3992
|
+
this.removalReconciliation.needsReconciliation(this.state.items) && !await this.reconcileBeforeNext() || this.state.loadMoreLocked || this.state.next !== null && await this.fetchPage(this.state.next, !0);
|
|
3993
|
+
}
|
|
3994
|
+
async reconcileBeforeNext() {
|
|
3995
|
+
let e = this.options.loadPage;
|
|
3996
|
+
if (!e) return !1;
|
|
3997
|
+
let t = ++this.requestVersion, n = new AbortController();
|
|
3998
|
+
this.abortController = n;
|
|
3999
|
+
try {
|
|
4000
|
+
let r = await this.removalReconciliation.reconcile({
|
|
4001
|
+
existingItems: this.state.items,
|
|
4002
|
+
loadPage: e,
|
|
4003
|
+
shouldPause: () => this.state.loadMoreLocked,
|
|
4004
|
+
signal: n.signal
|
|
4005
|
+
});
|
|
4006
|
+
return t === this.requestVersion ? (this.state.items = Z(this.state.items, r.items), this.state.next = r.next, this.lastLoadedCursor = r.lastCursor, r.total !== void 0 && (this.state.total = r.total), this.removalReconciliation.completeReconciliation(r), r.status === "complete") : !1;
|
|
4007
|
+
} catch (e) {
|
|
4008
|
+
return !n.signal.aborted && t === this.requestVersion && (this.state.nextPageError = e), !1;
|
|
4009
|
+
} finally {
|
|
4010
|
+
this.abortController === n && (this.abortController = null);
|
|
4011
|
+
}
|
|
3659
4012
|
}
|
|
3660
4013
|
async retryEnd() {
|
|
3661
4014
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3662
|
-
if (!this.state.loadMoreLocked && !(
|
|
4015
|
+
if (!this.state.loadMoreLocked && !(Xt(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);
|
|
3663
4016
|
}
|
|
3664
4017
|
setInfiniteScroll(e) {
|
|
3665
4018
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
3666
4019
|
}
|
|
3667
4020
|
setLoadMoreLocked(e) {
|
|
3668
|
-
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e
|
|
4021
|
+
if (this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e)) {
|
|
4022
|
+
let e = this.state.fill.status === "paused" ? this.state.fill.target : null;
|
|
4023
|
+
if (e) {
|
|
4024
|
+
let t = "pages" in e ? e.pages - this.state.fill.completedPages : null;
|
|
4025
|
+
if (t === null || t > 0) {
|
|
4026
|
+
this.fillController.start(t === null ? { until: "end" } : { pages: t });
|
|
4027
|
+
return;
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
if (this.state.autofill.status === "paused" || this.removalReconciliation.hasPendingSession()) {
|
|
4031
|
+
let e = this.pendingRequest;
|
|
4032
|
+
e ? e.finally(() => {
|
|
4033
|
+
this.loadNext();
|
|
4034
|
+
}) : this.loadNext();
|
|
4035
|
+
} else this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom());
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
4038
|
+
setTotal(e) {
|
|
4039
|
+
if (e !== null && (!Number.isInteger(e) || e < 0)) throw TypeError("Vibe total must be a non-negative integer or null.");
|
|
4040
|
+
this.state.total = e;
|
|
3669
4041
|
}
|
|
3670
4042
|
setReelAutoAdvance(e) {
|
|
3671
|
-
|
|
4043
|
+
Mn(this.state.reelAutoAdvance, e);
|
|
3672
4044
|
}
|
|
3673
4045
|
setReelInfoSheet(e) {
|
|
3674
|
-
|
|
4046
|
+
Pn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
3675
4047
|
}
|
|
3676
4048
|
setLayout(e) {
|
|
3677
4049
|
this.responsiveLayout.setLayout(e);
|
|
@@ -3689,68 +4061,22 @@ var nr = class {
|
|
|
3689
4061
|
this.autofillController.clearCountdown(), this.requestVersion += 1, this.abortController?.abort(), this.abortController = null, this.pendingRequest = null, this.state.isLoading = !1, this.state.isLoadingMore = !1;
|
|
3690
4062
|
}
|
|
3691
4063
|
async fetchPage(e, t) {
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
},
|
|
3709
|
-
options: a,
|
|
3710
|
-
signal: i.signal
|
|
3711
|
-
});
|
|
3712
|
-
if (r !== this.requestVersion) return;
|
|
3713
|
-
this.state.items = t ? Q(this.state.items, o.items) : [...o.items], this.lastLoadedCursor = o.lastCursor, this.state.next = o.next, o.total !== void 0 && (this.state.total = o.total), Object.assign(this.state.autofill, {
|
|
3714
|
-
missing: o.missing,
|
|
3715
|
-
received: o.received,
|
|
3716
|
-
requests: o.requests,
|
|
3717
|
-
status: o.status
|
|
3718
|
-
}), this.autofillController.clearCollection();
|
|
3719
|
-
return;
|
|
3720
|
-
}
|
|
3721
|
-
let c = Nt(await n({
|
|
3722
|
-
cursor: e,
|
|
3723
|
-
signal: i.signal
|
|
3724
|
-
}));
|
|
3725
|
-
if (r !== this.requestVersion) return;
|
|
3726
|
-
let l = t ? this.state.items : [], u = Q(l, c.items), d = u.length - l.length;
|
|
3727
|
-
if (this.state.items = u, this.lastLoadedCursor = e, this.state.next = c.next, c.total !== void 0 && (this.state.total = c.total), s = !0, a?.strategy === "backend" && o) {
|
|
3728
|
-
if (Object.assign(this.state.autofill, {
|
|
3729
|
-
missing: Math.max(0, a.pageSize - d),
|
|
3730
|
-
received: d,
|
|
3731
|
-
requests: 1
|
|
3732
|
-
}), d >= a.pageSize) {
|
|
3733
|
-
this.state.autofill.status = "complete";
|
|
3734
|
-
return;
|
|
3735
|
-
}
|
|
3736
|
-
await on(a, this.state, {
|
|
3737
|
-
cycleId: o,
|
|
3738
|
-
feedKey: a.feedKey,
|
|
3739
|
-
items: u.slice(l.length),
|
|
3740
|
-
missing: a.pageSize - d,
|
|
3741
|
-
next: c.next,
|
|
3742
|
-
pageSize: a.pageSize,
|
|
3743
|
-
received: d,
|
|
3744
|
-
signal: i.signal,
|
|
3745
|
-
total: this.state.total
|
|
3746
|
-
}, () => r === this.requestVersion), this.autofillController.syncCountdown();
|
|
3747
|
-
}
|
|
3748
|
-
} catch (e) {
|
|
3749
|
-
if (i.signal.aborted || r !== this.requestVersion) return;
|
|
3750
|
-
a && (this.state.autofill.error = e, this.state.autofill.status = "error"), s || (t ? this.state.nextPageError = e : this.state.error = e);
|
|
3751
|
-
} finally {
|
|
3752
|
-
r === this.requestVersion && (this.autofillController.clearCollection(), this.abortController = null, this.state.isLoading = !1, this.state.isLoadingMore = !1);
|
|
3753
|
-
}
|
|
4064
|
+
if (!this.options.loadPage) return;
|
|
4065
|
+
let n = ++this.requestVersion, r = new AbortController();
|
|
4066
|
+
this.abortController = r, await Bn({
|
|
4067
|
+
append: t,
|
|
4068
|
+
autofillController: this.autofillController,
|
|
4069
|
+
cursor: e,
|
|
4070
|
+
isCurrent: () => n === this.requestVersion,
|
|
4071
|
+
loadPage: (e) => this.loadFilteredPage(e),
|
|
4072
|
+
onLastCursor: (e) => {
|
|
4073
|
+
this.lastLoadedCursor = e;
|
|
4074
|
+
},
|
|
4075
|
+
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4076
|
+
options: this.options,
|
|
4077
|
+
signal: r.signal,
|
|
4078
|
+
state: this.state
|
|
4079
|
+
}), n === this.requestVersion && (this.abortController = null);
|
|
3754
4080
|
}
|
|
3755
4081
|
startRequest(e, t) {
|
|
3756
4082
|
let n = this.fetchPage(e, t);
|
|
@@ -3761,13 +4087,14 @@ var nr = class {
|
|
|
3761
4087
|
startInitialAutofill() {
|
|
3762
4088
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
3763
4089
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
3764
|
-
let r =
|
|
4090
|
+
let r = fn({
|
|
3765
4091
|
cycleId: n,
|
|
3766
4092
|
isCurrent: () => e === this.requestVersion,
|
|
3767
4093
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
3768
4094
|
onLastCursor: (e) => {
|
|
3769
4095
|
this.lastLoadedCursor = e;
|
|
3770
4096
|
},
|
|
4097
|
+
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3771
4098
|
options: this.options,
|
|
3772
4099
|
signal: t.signal,
|
|
3773
4100
|
state: this.state
|
|
@@ -3786,8 +4113,8 @@ var nr = class {
|
|
|
3786
4113
|
}));
|
|
3787
4114
|
}
|
|
3788
4115
|
};
|
|
3789
|
-
function
|
|
3790
|
-
return new
|
|
4116
|
+
function dr(e) {
|
|
4117
|
+
return new ur(e);
|
|
3791
4118
|
}
|
|
3792
4119
|
//#endregion
|
|
3793
|
-
export {
|
|
4120
|
+
export { dr as createVibe };
|