@wyxos/vibe 5.2.1 → 5.3.1
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 +4 -2
- package/lib/core/autofillController.d.ts +2 -0
- package/lib/core/fill.d.ts +7 -3
- package/lib/core/fillController.d.ts +2 -0
- package/lib/core/removalReconciliationController.d.ts +7 -1
- package/lib/core/runtime.d.ts +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +1011 -862
- package/lib/style.css +1 -1
- package/lib/types.d.ts +7 -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:
|
|
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
|
|
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 Me = /* @__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 Me = /* @__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 Me = /* @__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 Ve(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 He = [
|
|
|
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 He = [
|
|
|
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 He = [
|
|
|
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
|
|
817
|
-
l.layout === "reel" && (e.stopPropagation(),
|
|
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) {
|
|
787
|
+
l.layout === "reel" && (e.stopPropagation(), fe());
|
|
818
788
|
}
|
|
819
|
-
async function
|
|
820
|
-
if (!(!R.value || !
|
|
789
|
+
async function fe() {
|
|
790
|
+
if (!(!R.value || !K.value)) {
|
|
821
791
|
if (H.value) {
|
|
822
792
|
R.value.pause();
|
|
823
793
|
return;
|
|
@@ -829,12 +799,12 @@ var He = [
|
|
|
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
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
809
|
function me(e) {
|
|
840
810
|
X(e), x("ready", D.value);
|
|
@@ -844,20 +814,20 @@ var He = [
|
|
|
844
814
|
}
|
|
845
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
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
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 He = [
|
|
|
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 He = [
|
|
|
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 He = [
|
|
|
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
906
|
onLoadedmetadata: me,
|
|
937
907
|
onDurationchange: X,
|
|
938
908
|
onTimeupdate: X,
|
|
939
909
|
onVolumechange: X,
|
|
940
|
-
onPlaying: i[0] ||= (...e) => E(
|
|
910
|
+
onPlaying: i[0] ||= (...e) => E(ee) && E(ee)(...e),
|
|
941
911
|
onPause: i[1] ||= (e) => H.value = !1,
|
|
942
912
|
onEnded: he,
|
|
943
|
-
onClick:
|
|
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,28 +924,28 @@ var He = [
|
|
|
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:
|
|
945
|
+
volume: U.value,
|
|
976
946
|
onSeek: ge,
|
|
977
947
|
onToggleMute: ve,
|
|
978
|
-
onTogglePlayback:
|
|
948
|
+
onTogglePlayback: fe,
|
|
979
949
|
onVolumeChange: _e
|
|
980
950
|
}, null, 8, [
|
|
981
951
|
"current-time",
|
|
@@ -996,25 +966,25 @@ var He = [
|
|
|
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,12 @@ var He = [
|
|
|
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 = {
|
|
1013
|
+
key: 0,
|
|
1014
|
+
class: "masonry-feed-status-overlay"
|
|
1015
|
+
}, at = 240, ot = 6, st = 12, ct = 800, lt = 1.5, ut = /* @__PURE__ */ d({
|
|
1043
1016
|
__name: "MasonryFeed",
|
|
1044
1017
|
props: {
|
|
1045
1018
|
enteringPostIds: {},
|
|
@@ -1070,191 +1043,221 @@ var He = [
|
|
|
1070
1043
|
"loadMore",
|
|
1071
1044
|
"mediaChange",
|
|
1072
1045
|
"ready",
|
|
1073
|
-
"retryEnd"
|
|
1046
|
+
"retryEnd",
|
|
1047
|
+
"visible"
|
|
1074
1048
|
],
|
|
1075
1049
|
setup(t, { expose: n, emit: i }) {
|
|
1076
|
-
let
|
|
1077
|
-
additionalHeight: (
|
|
1078
|
-
gap:
|
|
1079
|
-
minColumnWidth:
|
|
1080
|
-
})),
|
|
1081
|
-
let e =
|
|
1082
|
-
if (
|
|
1083
|
-
let t =
|
|
1084
|
-
additionalHeight: (
|
|
1085
|
-
gap:
|
|
1086
|
-
minColumnWidth:
|
|
1050
|
+
let l = t, d = i, f = w(null), p = `vibe-masonry-${D()}`, m = w(null), g = w(0), y = w(ot), x = w(0), C = w(0), T = w(0), k = null, A = null, j = null, M = r(() => ie(l.items, g.value, {
|
|
1051
|
+
additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
|
|
1052
|
+
gap: y.value,
|
|
1053
|
+
minColumnWidth: at
|
|
1054
|
+
})), N = r(() => {
|
|
1055
|
+
let e = M.value;
|
|
1056
|
+
if (l.leavingPostIds.size === 0) return e;
|
|
1057
|
+
let t = l.items.filter((e) => !l.leavingPostIds.has(e.postId)), n = ie(t, g.value, {
|
|
1058
|
+
additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
|
|
1059
|
+
gap: y.value,
|
|
1060
|
+
minColumnWidth: at
|
|
1087
1061
|
}), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
|
|
1088
1062
|
return {
|
|
1089
1063
|
...n,
|
|
1090
|
-
items:
|
|
1064
|
+
items: l.items.map((t, n) => l.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
|
|
1091
1065
|
};
|
|
1092
|
-
}),
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1066
|
+
}), P = r(() => ({ height: `${l.leavingPostIds.size === 0 ? N.value.height : M.value.height}px` })), I = r(() => !l.infiniteScroll || C.value > 0 && T.value + N.value.height <= C.value + 1), L = r(() => {
|
|
1067
|
+
if (l.suspended) return /* @__PURE__ */ new Set();
|
|
1068
|
+
let e = {
|
|
1069
|
+
scrollTop: x.value - T.value,
|
|
1070
|
+
viewportHeight: C.value
|
|
1071
|
+
}, t = re(N.value.items, {
|
|
1072
|
+
...e,
|
|
1073
|
+
overscan: 0
|
|
1074
|
+
}), n = l.leavingPostIds.size === 0 ? [] : re(M.value.items, {
|
|
1075
|
+
...e,
|
|
1076
|
+
overscan: 0
|
|
1077
|
+
});
|
|
1078
|
+
return new Set([...t, ...n]);
|
|
1079
|
+
}), R = r(() => {
|
|
1080
|
+
let e = Math.max(ct, C.value * lt), t = {
|
|
1081
|
+
scrollTop: x.value - T.value,
|
|
1082
|
+
viewportHeight: C.value
|
|
1083
|
+
}, n = re(N.value.items, {
|
|
1097
1084
|
...t,
|
|
1098
1085
|
overscan: e
|
|
1099
|
-
}), r =
|
|
1086
|
+
}), r = l.leavingPostIds.size === 0 ? [] : re(M.value.items, {
|
|
1100
1087
|
...t,
|
|
1101
1088
|
overscan: e
|
|
1102
|
-
})
|
|
1103
|
-
|
|
1104
|
-
|
|
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) => {
|
|
1110
|
-
let t = o.items[e];
|
|
1089
|
+
});
|
|
1090
|
+
return [...new Set([...n, ...r])].sort((e, t) => e - t).flatMap((e) => {
|
|
1091
|
+
let t = l.items[e];
|
|
1111
1092
|
return t ? [{
|
|
1112
|
-
fetchPriority:
|
|
1093
|
+
fetchPriority: L.value.has(e) ? "high" : "low",
|
|
1113
1094
|
index: e,
|
|
1114
1095
|
item: t
|
|
1115
1096
|
}] : [];
|
|
1116
1097
|
});
|
|
1098
|
+
}), z = /* @__PURE__ */ new Set();
|
|
1099
|
+
O(() => [...L.value].flatMap((e) => {
|
|
1100
|
+
let t = l.items[e];
|
|
1101
|
+
if (!t) return [];
|
|
1102
|
+
let n = l.mediaIndices.get(t.postId) ?? 0, r = F(t.postId, n);
|
|
1103
|
+
return l.previewStates.get(r) === "ready" ? [{
|
|
1104
|
+
key: r,
|
|
1105
|
+
mediaIndex: n,
|
|
1106
|
+
postId: t.postId
|
|
1107
|
+
}] : [];
|
|
1108
|
+
}), (e) => {
|
|
1109
|
+
let t = new Set(e.map(({ key: e }) => e));
|
|
1110
|
+
e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
|
|
1111
|
+
z.has(e) || d("visible", n, t);
|
|
1112
|
+
}), z = t;
|
|
1113
|
+
}, {
|
|
1114
|
+
immediate: !0,
|
|
1115
|
+
flush: "post"
|
|
1117
1116
|
});
|
|
1118
|
-
function
|
|
1119
|
-
let t =
|
|
1117
|
+
function B(e) {
|
|
1118
|
+
let t = N.value.items[e], n = l.items[e]?.postId;
|
|
1120
1119
|
if (!t) return {};
|
|
1121
|
-
let r = n !== void 0 &&
|
|
1122
|
-
containerHeight:
|
|
1123
|
-
gap:
|
|
1124
|
-
}) : 0,
|
|
1120
|
+
let r = n !== void 0 && l.enteringPostIds.has(n), i = n !== void 0 && l.leavingPostIds.has(n), a = r || i ? ne({
|
|
1121
|
+
containerHeight: M.value.height,
|
|
1122
|
+
gap: y.value
|
|
1123
|
+
}) : 0, o = n === void 0 ? 0 : i ? l.removalDelays.get(n) ?? 0 : r ? l.entryDelays.get(n) ?? 0 : 0;
|
|
1125
1124
|
return {
|
|
1126
|
-
"--masonry-entry-delay": `${
|
|
1125
|
+
"--masonry-entry-delay": `${o}ms`,
|
|
1127
1126
|
width: `${t.width}px`,
|
|
1128
1127
|
height: `${t.height}px`,
|
|
1129
1128
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1130
1129
|
};
|
|
1131
1130
|
}
|
|
1132
|
-
function
|
|
1133
|
-
let e =
|
|
1131
|
+
function V() {
|
|
1132
|
+
let e = f.value;
|
|
1134
1133
|
if (!e) return;
|
|
1135
|
-
|
|
1136
|
-
let t =
|
|
1137
|
-
t && (
|
|
1134
|
+
x.value = e.scrollTop, C.value = e.clientHeight;
|
|
1135
|
+
let t = m.value;
|
|
1136
|
+
t && (T.value = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop);
|
|
1138
1137
|
}
|
|
1139
|
-
function
|
|
1138
|
+
function H(e) {
|
|
1140
1139
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1141
|
-
|
|
1140
|
+
g.value = e.clientWidth, y.value = Math.min(st, Math.max(ot, t * .0075)), V();
|
|
1142
1141
|
}
|
|
1143
|
-
function
|
|
1142
|
+
function W(e) {
|
|
1144
1143
|
let t = e.currentTarget;
|
|
1145
|
-
t && (
|
|
1144
|
+
t && (x.value = t.scrollTop, !l.loadMoreLocked && l.infiniteScroll && K(t) && d("loadMore"));
|
|
1146
1145
|
}
|
|
1147
|
-
function
|
|
1148
|
-
let e =
|
|
1149
|
-
!
|
|
1146
|
+
function G() {
|
|
1147
|
+
let e = f.value;
|
|
1148
|
+
!l.loadMoreLocked && e && K(e) && d("loadMore");
|
|
1150
1149
|
}
|
|
1151
|
-
function
|
|
1152
|
-
return
|
|
1150
|
+
function ee() {
|
|
1151
|
+
return f.value;
|
|
1153
1152
|
}
|
|
1154
|
-
return O(
|
|
1155
|
-
|
|
1153
|
+
return O(m, (e) => {
|
|
1154
|
+
k?.disconnect(), k = null, j !== null && cancelAnimationFrame(j), e && (H(e), !(typeof ResizeObserver > "u") && (k = new ResizeObserver(([t]) => {
|
|
1156
1155
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1157
|
-
Math.abs(n -
|
|
1158
|
-
|
|
1156
|
+
Math.abs(n - g.value) < .5 || (j = requestAnimationFrame(() => {
|
|
1157
|
+
j = null, H(e);
|
|
1159
1158
|
}));
|
|
1160
|
-
}),
|
|
1161
|
-
}), O(
|
|
1162
|
-
|
|
1159
|
+
}), k.observe(e)));
|
|
1160
|
+
}), O(f, (e) => {
|
|
1161
|
+
A?.disconnect(), A = null, e && (V(), !(typeof ResizeObserver > "u") && (A = new ResizeObserver(V), A.observe(e)));
|
|
1163
1162
|
}), v(() => {
|
|
1164
|
-
|
|
1163
|
+
k?.disconnect(), A?.disconnect(), j !== null && cancelAnimationFrame(j);
|
|
1165
1164
|
}), n({
|
|
1166
|
-
getScrollElement:
|
|
1167
|
-
loadIfNearBottom:
|
|
1168
|
-
}), (n, r) => (b(), s("div",
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
"
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1165
|
+
getScrollElement: ee,
|
|
1166
|
+
loadIfNearBottom: G
|
|
1167
|
+
}), (n, r) => (b(), s("div", nt, [
|
|
1168
|
+
c("main", {
|
|
1169
|
+
id: p,
|
|
1170
|
+
ref_key: "galleryElement",
|
|
1171
|
+
ref: f,
|
|
1172
|
+
class: h(["gallery-shell masonry-feed", { "masonry-feed--suspended": t.suspended }]),
|
|
1173
|
+
"data-layout-mode": "masonry",
|
|
1174
|
+
"aria-hidden": t.suspended || void 0,
|
|
1175
|
+
inert: t.suspended || void 0,
|
|
1176
|
+
onScrollPassive: W
|
|
1177
|
+
}, [c("section", {
|
|
1178
|
+
ref_key: "masonryElement",
|
|
1179
|
+
ref: m,
|
|
1180
|
+
class: h(["masonry", { "masonry--ready": g.value > 0 }]),
|
|
1181
|
+
style: _(P.value),
|
|
1182
|
+
"aria-label": "Media gallery"
|
|
1183
|
+
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(tt, {
|
|
1184
|
+
key: n.postId,
|
|
1185
|
+
class: "masonry-item",
|
|
1186
|
+
entering: t.enteringPostIds.has(n.postId),
|
|
1187
|
+
leaving: t.leavingPostIds.has(n.postId),
|
|
1188
|
+
"fetch-priority": e,
|
|
1189
|
+
"card-footer": t.cardFooter,
|
|
1190
|
+
"card-header": t.cardHeader,
|
|
1191
|
+
"media-card": t.mediaCard,
|
|
1192
|
+
index: r,
|
|
1193
|
+
item: n,
|
|
1194
|
+
"item-style": B(r),
|
|
1195
|
+
interactive: "",
|
|
1196
|
+
layout: "masonry",
|
|
1197
|
+
"loaded-count": t.items.length,
|
|
1198
|
+
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
1199
|
+
"preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1200
|
+
total: t.total,
|
|
1201
|
+
onActivate: (e) => d("activate", n.postId, e),
|
|
1202
|
+
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
1203
|
+
onReady: (e) => d("ready", n.postId, e),
|
|
1204
|
+
onError: (e) => d("error", n.postId, e)
|
|
1205
|
+
}, null, 8, [
|
|
1206
|
+
"entering",
|
|
1207
|
+
"leaving",
|
|
1208
|
+
"fetch-priority",
|
|
1209
|
+
"card-footer",
|
|
1210
|
+
"card-header",
|
|
1211
|
+
"media-card",
|
|
1212
|
+
"index",
|
|
1213
|
+
"item",
|
|
1214
|
+
"item-style",
|
|
1215
|
+
"loaded-count",
|
|
1216
|
+
"media-index",
|
|
1217
|
+
"preview-state",
|
|
1218
|
+
"total",
|
|
1219
|
+
"onActivate",
|
|
1220
|
+
"onMediaChange",
|
|
1221
|
+
"onReady",
|
|
1222
|
+
"onError"
|
|
1223
|
+
]))), 128))], 6)], 42, rt),
|
|
1224
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && I.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", it, [u(U, {
|
|
1225
|
+
actions: t.feedFooterActions,
|
|
1226
|
+
"can-retry-end": t.canRetryEnd,
|
|
1227
|
+
"feed-footer": t.feedFooter,
|
|
1228
|
+
"has-error": t.nextPageError,
|
|
1229
|
+
"has-next": t.hasNext,
|
|
1230
|
+
"is-loading": t.isLoadingMore,
|
|
1231
|
+
"load-more-locked": t.loadMoreLocked,
|
|
1232
|
+
"show-load-more": I.value,
|
|
1233
|
+
state: t.state,
|
|
1234
|
+
onLoadMore: r[0] ||= (e) => d("loadMore"),
|
|
1235
|
+
onRetryEnd: r[1] ||= (e) => d("retryEnd")
|
|
1236
|
+
}, null, 8, [
|
|
1237
|
+
"actions",
|
|
1238
|
+
"can-retry-end",
|
|
1239
|
+
"feed-footer",
|
|
1240
|
+
"has-error",
|
|
1241
|
+
"has-next",
|
|
1242
|
+
"is-loading",
|
|
1243
|
+
"load-more-locked",
|
|
1244
|
+
"show-load-more",
|
|
1245
|
+
"state"
|
|
1246
|
+
])])) : o("", !0),
|
|
1247
|
+
u(ue, {
|
|
1248
|
+
"content-size": N.value.height,
|
|
1249
|
+
"controls-id": p,
|
|
1250
|
+
"scroll-element": f.value,
|
|
1251
|
+
suspended: t.suspended
|
|
1252
|
+
}, null, 8, [
|
|
1253
|
+
"content-size",
|
|
1254
|
+
"scroll-element",
|
|
1255
|
+
"suspended"
|
|
1256
|
+
])
|
|
1257
|
+
]));
|
|
1255
1258
|
}
|
|
1256
|
-
}),
|
|
1257
|
-
function
|
|
1259
|
+
}), dt = 300;
|
|
1260
|
+
function ft(e, t, n) {
|
|
1258
1261
|
let r = e.scrollTop;
|
|
1259
1262
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1260
1263
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1262,7 +1265,7 @@ function pt(e, t, n) {
|
|
|
1262
1265
|
return new Promise((n) => {
|
|
1263
1266
|
let o = (s) => {
|
|
1264
1267
|
a += 1;
|
|
1265
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1268
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / dt), u = 1 - (1 - l) ** 3;
|
|
1266
1269
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1267
1270
|
requestAnimationFrame(o);
|
|
1268
1271
|
return;
|
|
@@ -1274,7 +1277,7 @@ function pt(e, t, n) {
|
|
|
1274
1277
|
}
|
|
1275
1278
|
//#endregion
|
|
1276
1279
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1277
|
-
var
|
|
1280
|
+
var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
1278
1281
|
__name: "ReelAutoAdvanceProgress",
|
|
1279
1282
|
props: {
|
|
1280
1283
|
durationMs: {},
|
|
@@ -1292,9 +1295,9 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1292
1295
|
class: "reel-auto-advance-progress",
|
|
1293
1296
|
style: _(a.value),
|
|
1294
1297
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1295
|
-
}, null, 36)], 8,
|
|
1298
|
+
}, null, 36)], 8, pt));
|
|
1296
1299
|
}
|
|
1297
|
-
}),
|
|
1300
|
+
}), ht = { class: "reel-viewport" }, gt = ["data-active-post-id", "data-active-media-index"], _t = ["role", "data-status"], vt = 2, yt = 300, bt = /* @__PURE__ */ d({
|
|
1298
1301
|
__name: "ReelFeed",
|
|
1299
1302
|
props: {
|
|
1300
1303
|
initialPostId: {},
|
|
@@ -1332,7 +1335,7 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1332
1335
|
],
|
|
1333
1336
|
setup(t, { expose: n, emit: i }) {
|
|
1334
1337
|
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 -
|
|
1338
|
+
let e = Math.max(0, g.value - vt), t = Math.min(l.items.length - 1, g.value + vt);
|
|
1336
1339
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1337
1340
|
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1338
1341
|
index: e + n,
|
|
@@ -1349,7 +1352,7 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1349
1352
|
if (!e) return "";
|
|
1350
1353
|
let t = P(e, z.value);
|
|
1351
1354
|
return l.mediaSource === "original" ? t.src : t.preview.src;
|
|
1352
|
-
}), H = r(() => B.value === "ready" &&
|
|
1355
|
+
}), H = r(() => B.value === "ready" && ke(V.value)), W = r(() => [
|
|
1353
1356
|
L.value,
|
|
1354
1357
|
z.value,
|
|
1355
1358
|
l.items.length,
|
|
@@ -1357,49 +1360,49 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1357
1360
|
l.reelAutoAdvance.enabled,
|
|
1358
1361
|
l.reelAutoAdvance.includePostItems,
|
|
1359
1362
|
l.reelAutoAdvance.intervalMs
|
|
1360
|
-
].join(":")),
|
|
1363
|
+
].join(":")), G = r(() => {
|
|
1361
1364
|
let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1362
1365
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1363
|
-
}),
|
|
1364
|
-
function
|
|
1366
|
+
}), 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.");
|
|
1367
|
+
function ne(e) {
|
|
1365
1368
|
return { gridRow: `${e + 1}` };
|
|
1366
1369
|
}
|
|
1367
|
-
function
|
|
1370
|
+
function re(e) {
|
|
1368
1371
|
let t = D || e.clientHeight;
|
|
1369
1372
|
return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1370
1373
|
}
|
|
1371
|
-
function
|
|
1374
|
+
function ie(e) {
|
|
1372
1375
|
let t = e.currentTarget;
|
|
1373
1376
|
if (!t) return;
|
|
1374
1377
|
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 =
|
|
1378
|
+
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
1379
|
}
|
|
1377
|
-
function
|
|
1380
|
+
function ae() {
|
|
1378
1381
|
let e = d.value;
|
|
1379
|
-
e && (x.value = !1,
|
|
1382
|
+
e && (x.value = !1, J(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
|
|
1380
1383
|
e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
|
|
1381
|
-
}),
|
|
1384
|
+
}), oe());
|
|
1382
1385
|
}
|
|
1383
|
-
function
|
|
1386
|
+
function oe() {
|
|
1384
1387
|
j !== null && clearTimeout(j), j = setTimeout(() => {
|
|
1385
1388
|
j = null;
|
|
1386
1389
|
let e = d.value;
|
|
1387
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1390
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), J(!1);
|
|
1388
1391
|
}, 120);
|
|
1389
1392
|
}
|
|
1390
|
-
function
|
|
1391
|
-
|
|
1393
|
+
function se() {
|
|
1394
|
+
J(!0);
|
|
1392
1395
|
let e = d.value;
|
|
1393
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1396
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), oe();
|
|
1394
1397
|
}
|
|
1395
|
-
function
|
|
1398
|
+
function J(e) {
|
|
1396
1399
|
C.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1397
1400
|
}
|
|
1398
|
-
function
|
|
1401
|
+
function ce() {
|
|
1399
1402
|
let e = d.value;
|
|
1400
|
-
!l.loadMoreLocked && e &&
|
|
1403
|
+
!l.loadMoreLocked && e && K(e) && u("loadMore");
|
|
1401
1404
|
}
|
|
1402
|
-
function
|
|
1405
|
+
function Y(e) {
|
|
1403
1406
|
let t = R.value;
|
|
1404
1407
|
if (!t) return !1;
|
|
1405
1408
|
let n = M(t).length;
|
|
@@ -1407,32 +1410,32 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1407
1410
|
let r = (z.value + e + n) % n;
|
|
1408
1411
|
return u("mediaChange", t.postId, r), !0;
|
|
1409
1412
|
}
|
|
1410
|
-
function
|
|
1413
|
+
function le(e) {
|
|
1411
1414
|
let t = g.value + e;
|
|
1412
|
-
return !d.value || t < 0 || t >= l.items.length ? !1 : (
|
|
1415
|
+
return !d.value || t < 0 || t >= l.items.length ? !1 : (pe(t), !0);
|
|
1413
1416
|
}
|
|
1414
|
-
function
|
|
1417
|
+
function ue(e, t) {
|
|
1415
1418
|
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 &&
|
|
1419
|
+
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
1420
|
}
|
|
1418
|
-
function
|
|
1421
|
+
function de() {
|
|
1419
1422
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1420
1423
|
}
|
|
1421
|
-
function
|
|
1424
|
+
function fe(e) {
|
|
1422
1425
|
let t = d.value;
|
|
1423
1426
|
if (!t) return Promise.resolve();
|
|
1424
1427
|
let n = e * (D || t.clientHeight);
|
|
1425
|
-
return g.value = e,
|
|
1428
|
+
return g.value = e, ft(t, n, de());
|
|
1426
1429
|
}
|
|
1427
|
-
function
|
|
1428
|
-
|
|
1430
|
+
function pe(e) {
|
|
1431
|
+
fe(e);
|
|
1429
1432
|
}
|
|
1430
1433
|
async function X(e) {
|
|
1431
1434
|
let t = l.items.findIndex((t) => t.postId === e);
|
|
1432
|
-
return t < 0 || t === g.value ? !1 : (await
|
|
1435
|
+
return t < 0 || t === g.value ? !1 : (await fe(t), !0);
|
|
1433
1436
|
}
|
|
1434
1437
|
async function me(e) {
|
|
1435
|
-
return
|
|
1438
|
+
return Y(e) ? (de() || await new Promise((e) => setTimeout(e, yt)), !0) : !1;
|
|
1436
1439
|
}
|
|
1437
1440
|
function he() {
|
|
1438
1441
|
if (!l.reelAutoAdvance.enabled) return;
|
|
@@ -1447,29 +1450,29 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1447
1450
|
l.hasNext && !l.loadMoreLocked && u("loadMore");
|
|
1448
1451
|
return;
|
|
1449
1452
|
}
|
|
1450
|
-
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0),
|
|
1453
|
+
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), pe(t);
|
|
1451
1454
|
}
|
|
1452
1455
|
function ge(e, t) {
|
|
1453
1456
|
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || he();
|
|
1454
1457
|
}
|
|
1455
1458
|
return O(d, (e) => {
|
|
1456
|
-
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(
|
|
1459
|
+
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(ae), k.observe(e)));
|
|
1457
1460
|
}), O(() => l.items.length, async (e) => {
|
|
1458
1461
|
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(),
|
|
1462
|
+
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), ae();
|
|
1460
1463
|
}), O(L, (e) => {
|
|
1461
1464
|
e !== void 0 && u("activeChange", e);
|
|
1462
1465
|
}, { immediate: !0 }), y(() => {
|
|
1463
|
-
window.addEventListener("resize",
|
|
1466
|
+
window.addEventListener("resize", se), window.addEventListener("orientationchange", se), p >= 0 && m(ae);
|
|
1464
1467
|
}), v(() => {
|
|
1465
|
-
window.removeEventListener("resize",
|
|
1468
|
+
window.removeEventListener("resize", se), window.removeEventListener("orientationchange", se), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
|
|
1466
1469
|
}), n({
|
|
1467
1470
|
activeIndex: g,
|
|
1468
1471
|
activePostId: L,
|
|
1469
|
-
changeActiveMedia:
|
|
1470
|
-
loadIfNearBottom:
|
|
1471
|
-
moveActivePost:
|
|
1472
|
-
navigateToItem:
|
|
1472
|
+
changeActiveMedia: Y,
|
|
1473
|
+
loadIfNearBottom: ce,
|
|
1474
|
+
moveActivePost: le,
|
|
1475
|
+
navigateToItem: ue,
|
|
1473
1476
|
transitionActiveMedia: me,
|
|
1474
1477
|
transitionActivePost: X
|
|
1475
1478
|
}), (n, r) => (b(), s("main", {
|
|
@@ -1479,7 +1482,7 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1479
1482
|
}]),
|
|
1480
1483
|
"data-layout-mode": "reel"
|
|
1481
1484
|
}, [
|
|
1482
|
-
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1485
|
+
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(Ae, {
|
|
1483
1486
|
key: 0,
|
|
1484
1487
|
index: g.value,
|
|
1485
1488
|
item: R.value,
|
|
@@ -1501,19 +1504,19 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1501
1504
|
"style",
|
|
1502
1505
|
"total"
|
|
1503
1506
|
])) : o("", !0),
|
|
1504
|
-
c("div",
|
|
1507
|
+
c("div", ht, [c("div", {
|
|
1505
1508
|
ref_key: "galleryElement",
|
|
1506
1509
|
ref: d,
|
|
1507
1510
|
class: "gallery-shell reel-feed",
|
|
1508
1511
|
"data-active-post-id": L.value,
|
|
1509
1512
|
"data-active-media-index": z.value,
|
|
1510
|
-
onScrollPassive:
|
|
1513
|
+
onScrollPassive: ie
|
|
1511
1514
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1512
1515
|
key: 1,
|
|
1513
1516
|
class: "reel-track",
|
|
1514
1517
|
style: _(N.value),
|
|
1515
1518
|
"aria-label": "Media gallery"
|
|
1516
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1519
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(tt, {
|
|
1517
1520
|
key: n.postId,
|
|
1518
1521
|
active: r === g.value && !x.value,
|
|
1519
1522
|
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
@@ -1522,7 +1525,7 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1522
1525
|
"fetch-priority": e,
|
|
1523
1526
|
index: r,
|
|
1524
1527
|
item: n,
|
|
1525
|
-
"item-style":
|
|
1528
|
+
"item-style": ne(r),
|
|
1526
1529
|
"media-card": t.mediaCard,
|
|
1527
1530
|
layout: "reel",
|
|
1528
1531
|
"loaded-count": t.items.length,
|
|
@@ -1559,12 +1562,12 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1559
1562
|
class: "reel-forward-status",
|
|
1560
1563
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1561
1564
|
"data-status": t.reelForward.status
|
|
1562
|
-
}, [c("p", null, T(
|
|
1565
|
+
}, [c("p", null, T(te.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1563
1566
|
key: 0,
|
|
1564
1567
|
class: "reel-forward-retry",
|
|
1565
1568
|
type: "button",
|
|
1566
1569
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1567
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1570
|
+
}, " Retry ")) : o("", !0)], 8, _t)), t.reelForward.status === "idle" ? (b(), a(U, {
|
|
1568
1571
|
key: 2,
|
|
1569
1572
|
actions: t.feedFooterActions,
|
|
1570
1573
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1573,7 +1576,7 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1573
1576
|
"has-next": t.hasNext,
|
|
1574
1577
|
"is-loading": t.isLoadingMore,
|
|
1575
1578
|
"load-more-locked": t.loadMoreLocked,
|
|
1576
|
-
"show-load-more":
|
|
1579
|
+
"show-load-more": q.value,
|
|
1577
1580
|
state: t.state,
|
|
1578
1581
|
onLoadMore: r[1] ||= (e) => u("loadMore"),
|
|
1579
1582
|
onRetryEnd: r[2] ||= (e) => u("retryEnd")
|
|
@@ -1587,13 +1590,13 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1587
1590
|
"load-more-locked",
|
|
1588
1591
|
"show-load-more",
|
|
1589
1592
|
"state"
|
|
1590
|
-
])) : o("", !0)], 40,
|
|
1593
|
+
])) : o("", !0)], 40, gt), c("div", {
|
|
1591
1594
|
ref_key: "reelControlsElement",
|
|
1592
1595
|
ref: f,
|
|
1593
1596
|
class: "reel-media-controls-host",
|
|
1594
1597
|
"data-test": "reel-media-controls-host"
|
|
1595
1598
|
}, null, 512)]),
|
|
1596
|
-
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1599
|
+
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(Ae, {
|
|
1597
1600
|
key: 1,
|
|
1598
1601
|
index: g.value,
|
|
1599
1602
|
item: R.value,
|
|
@@ -1615,24 +1618,24 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1615
1618
|
"style",
|
|
1616
1619
|
"total"
|
|
1617
1620
|
])) : o("", !0),
|
|
1618
|
-
|
|
1619
|
-
key:
|
|
1621
|
+
ee.value ? (b(), a(mt, {
|
|
1622
|
+
key: W.value,
|
|
1620
1623
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1621
|
-
label:
|
|
1624
|
+
label: G.value,
|
|
1622
1625
|
onComplete: he
|
|
1623
1626
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1624
1627
|
], 2));
|
|
1625
1628
|
}
|
|
1626
|
-
}),
|
|
1629
|
+
}), xt = ["data-info-sheet-open", "data-info-sheet-mode"], St = ["aria-hidden", "inert"], Ct = {
|
|
1627
1630
|
key: 0,
|
|
1628
1631
|
class: "reel-info-sheet-layer",
|
|
1629
1632
|
"data-test": "reel-info-sheet"
|
|
1630
|
-
},
|
|
1633
|
+
}, wt = [
|
|
1631
1634
|
"role",
|
|
1632
1635
|
"aria-modal",
|
|
1633
1636
|
"tabindex",
|
|
1634
1637
|
"data-active-post-id"
|
|
1635
|
-
],
|
|
1638
|
+
], Tt = /* @__PURE__ */ d({
|
|
1636
1639
|
__name: "ReelLayout",
|
|
1637
1640
|
props: {
|
|
1638
1641
|
forwardIndex: { default: null },
|
|
@@ -1725,7 +1728,7 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1725
1728
|
function H(e, t) {
|
|
1726
1729
|
d("mediaChange", e, t);
|
|
1727
1730
|
}
|
|
1728
|
-
function
|
|
1731
|
+
function U(e, t) {
|
|
1729
1732
|
d("ready", e, t);
|
|
1730
1733
|
}
|
|
1731
1734
|
return O(() => ({
|
|
@@ -1757,7 +1760,7 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1757
1760
|
class: "reel-layout-main",
|
|
1758
1761
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1759
1762
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1760
|
-
}, [u(
|
|
1763
|
+
}, [u(bt, {
|
|
1761
1764
|
ref_key: "reelFeed",
|
|
1762
1765
|
ref: p,
|
|
1763
1766
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1784,7 +1787,7 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1784
1787
|
onError: V,
|
|
1785
1788
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1786
1789
|
onMediaChange: H,
|
|
1787
|
-
onReady:
|
|
1790
|
+
onReady: U,
|
|
1788
1791
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1789
1792
|
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1790
1793
|
}, null, 8, [
|
|
@@ -1808,8 +1811,8 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1808
1811
|
"reel-forward",
|
|
1809
1812
|
"state",
|
|
1810
1813
|
"total"
|
|
1811
|
-
])], 8,
|
|
1812
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
1814
|
+
])], 8, St), u(n, { name: "vibe-info-sheet" }, {
|
|
1815
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Ct, [c("aside", {
|
|
1813
1816
|
ref_key: "sheetElement",
|
|
1814
1817
|
ref: _,
|
|
1815
1818
|
class: "reel-info-sheet",
|
|
@@ -1818,20 +1821,109 @@ var mt = ["aria-label"], ht = /* @__PURE__ */ d({
|
|
|
1818
1821
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1819
1822
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1820
1823
|
"data-active-post-id": T.value?.postId
|
|
1821
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
1824
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, wt)])) : o("", !0)]),
|
|
1822
1825
|
_: 1
|
|
1823
|
-
})], 10,
|
|
1826
|
+
})], 10, xt));
|
|
1824
1827
|
}
|
|
1825
|
-
})
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1828
|
+
});
|
|
1829
|
+
//#endregion
|
|
1830
|
+
//#region src/core/mediaLifecycle.ts
|
|
1831
|
+
function Et(e, t, n, r, i) {
|
|
1832
|
+
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
1833
|
+
if (!o) return null;
|
|
1834
|
+
let s = N(o, n), c = P(o, s);
|
|
1835
|
+
return {
|
|
1836
|
+
item: o,
|
|
1837
|
+
layout: r,
|
|
1838
|
+
media: c,
|
|
1839
|
+
mediaId: c.mediaId ?? null,
|
|
1840
|
+
mediaIndex: s,
|
|
1841
|
+
origin: i,
|
|
1842
|
+
phoneMode: e.phoneMode,
|
|
1843
|
+
postId: o.postId,
|
|
1844
|
+
postIndex: a
|
|
1830
1845
|
};
|
|
1831
1846
|
}
|
|
1832
|
-
function
|
|
1847
|
+
function Dt(e, t) {
|
|
1848
|
+
O(() => {
|
|
1849
|
+
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
1850
|
+
return {
|
|
1851
|
+
mediaIndex: t === null ? 0 : e.mediaIndices.get(t) ?? 0,
|
|
1852
|
+
origin: e.reelOrigin ?? "reel",
|
|
1853
|
+
postId: t
|
|
1854
|
+
};
|
|
1855
|
+
}, (n, r) => {
|
|
1856
|
+
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
1857
|
+
let i = Et(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
1858
|
+
i && t(i);
|
|
1859
|
+
}, { flush: "sync" });
|
|
1860
|
+
}
|
|
1861
|
+
//#endregion
|
|
1862
|
+
//#region src/components/useMediaLifecycle.ts
|
|
1863
|
+
function Ot(e, t) {
|
|
1864
|
+
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = r(() => e.reelMediaSource === "original" ? i.value : n.value);
|
|
1865
|
+
function o(e, t, n, r) {
|
|
1866
|
+
let i = F(t, n);
|
|
1867
|
+
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
1868
|
+
}
|
|
1869
|
+
function s(t, n, r, i) {
|
|
1870
|
+
return Et(e, t, n, r, i);
|
|
1871
|
+
}
|
|
1872
|
+
function c(e, n, r, i) {
|
|
1873
|
+
let a = s(e, n, r, i);
|
|
1874
|
+
a && t.ready(a);
|
|
1875
|
+
}
|
|
1876
|
+
function l(e, t) {
|
|
1877
|
+
o(n, e, t, "error");
|
|
1878
|
+
}
|
|
1879
|
+
function u(e, t) {
|
|
1880
|
+
o(n, e, t, "ready"), c(e, t, "masonry", null);
|
|
1881
|
+
}
|
|
1882
|
+
function d(t, r) {
|
|
1883
|
+
o(e.reelMediaSource === "original" ? i : n, t, r, "error");
|
|
1884
|
+
}
|
|
1885
|
+
function f(t, r) {
|
|
1886
|
+
o(e.reelMediaSource === "original" ? i : n, t, r, "ready"), c(t, r, "reel", e.reelOrigin ?? "reel");
|
|
1887
|
+
}
|
|
1888
|
+
function p(e, n) {
|
|
1889
|
+
let r = s(e, n, "masonry", null);
|
|
1890
|
+
r && t.visible(r);
|
|
1891
|
+
}
|
|
1892
|
+
return Dt(e, t.reelChange), O(() => {
|
|
1893
|
+
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
1894
|
+
return {
|
|
1895
|
+
mediaIndex: n,
|
|
1896
|
+
origin: e.reelOrigin ?? "reel",
|
|
1897
|
+
postId: t,
|
|
1898
|
+
ready: t !== null && a.value.get(F(t, n)) === "ready"
|
|
1899
|
+
};
|
|
1900
|
+
}, (e, n) => {
|
|
1901
|
+
if (e.postId === null || !e.ready || n?.ready && n.postId === e.postId && n.mediaIndex === e.mediaIndex && n.origin === e.origin) return;
|
|
1902
|
+
let r = s(e.postId, e.mediaIndex, "reel", e.origin);
|
|
1903
|
+
r && t.visible(r);
|
|
1904
|
+
}, { flush: "post" }), {
|
|
1905
|
+
markMasonryVisible: p,
|
|
1906
|
+
markPreviewError: l,
|
|
1907
|
+
markPreviewReady: u,
|
|
1908
|
+
markReelError: d,
|
|
1909
|
+
markReelReady: f,
|
|
1910
|
+
originalStates: i,
|
|
1911
|
+
previewStates: n,
|
|
1912
|
+
reelStates: a
|
|
1913
|
+
};
|
|
1914
|
+
}
|
|
1915
|
+
//#endregion
|
|
1916
|
+
//#region src/core/reelEscapeStack.ts
|
|
1917
|
+
var kt = [];
|
|
1918
|
+
function At(e) {
|
|
1919
|
+
return kt.push(e), () => {
|
|
1920
|
+
let t = kt.indexOf(e);
|
|
1921
|
+
t >= 0 && kt.splice(t, 1);
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
function jt(e) {
|
|
1833
1925
|
if (!e.isActive()) return !1;
|
|
1834
|
-
let t =
|
|
1926
|
+
let t = kt.filter((e) => e.isActive()), n = e.element();
|
|
1835
1927
|
return n !== null && t.some((t) => {
|
|
1836
1928
|
if (t === e) return !1;
|
|
1837
1929
|
let r = t.element();
|
|
@@ -1847,14 +1939,14 @@ function kt(e) {
|
|
|
1847
1939
|
}
|
|
1848
1940
|
//#endregion
|
|
1849
1941
|
//#region src/components/useReelKeyboard.ts
|
|
1850
|
-
function
|
|
1942
|
+
function Mt(e) {
|
|
1851
1943
|
let t = {
|
|
1852
1944
|
element: e.element,
|
|
1853
1945
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
1854
1946
|
}, n = null;
|
|
1855
1947
|
function r(n) {
|
|
1856
1948
|
let r = t.isActive();
|
|
1857
|
-
if (n.key === "Escape" && r && !
|
|
1949
|
+
if (n.key === "Escape" && r && !jt(t)) return;
|
|
1858
1950
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
1859
1951
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
1860
1952
|
return;
|
|
@@ -1874,14 +1966,14 @@ function At(e) {
|
|
|
1874
1966
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
1875
1967
|
}
|
|
1876
1968
|
y(() => {
|
|
1877
|
-
n =
|
|
1969
|
+
n = At(t), window.addEventListener("keydown", r);
|
|
1878
1970
|
}), v(() => {
|
|
1879
1971
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
1880
1972
|
});
|
|
1881
1973
|
}
|
|
1882
1974
|
//#endregion
|
|
1883
1975
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
1884
|
-
var
|
|
1976
|
+
var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
1885
1977
|
__name: "VibeSurface",
|
|
1886
1978
|
props: {
|
|
1887
1979
|
canRetryEnd: { type: Boolean },
|
|
@@ -1898,6 +1990,7 @@ var jt = 35, Mt = 420, Nt = /* @__PURE__ */ d({
|
|
|
1898
1990
|
"closeReel",
|
|
1899
1991
|
"loadMore",
|
|
1900
1992
|
"mediaReady",
|
|
1993
|
+
"mediaVisible",
|
|
1901
1994
|
"openReel",
|
|
1902
1995
|
"reelMediaChange",
|
|
1903
1996
|
"reelInfoSheetChange",
|
|
@@ -1905,97 +1998,70 @@ var jt = 35, Mt = 420, Nt = /* @__PURE__ */ d({
|
|
|
1905
1998
|
"retryForward"
|
|
1906
1999
|
],
|
|
1907
2000
|
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
|
-
|
|
2001
|
+
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 } = Ot(l.state, {
|
|
2002
|
+
ready: (e) => d("mediaReady", e),
|
|
2003
|
+
reelChange: (e) => d("reelMediaChange", e),
|
|
2004
|
+
visible: (e) => d("mediaVisible", e)
|
|
2005
|
+
}), H = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
|
|
2006
|
+
function K() {
|
|
1910
2007
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1911
2008
|
}
|
|
1912
|
-
function
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
2009
|
+
function q() {
|
|
2010
|
+
U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
|
|
2011
|
+
U = requestAnimationFrame(() => {
|
|
2012
|
+
U = null, S.value = /* @__PURE__ */ new Set();
|
|
1916
2013
|
});
|
|
1917
2014
|
});
|
|
1918
2015
|
}
|
|
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) {
|
|
2016
|
+
function te(e, t) {
|
|
1951
2017
|
let n = l.state.items.find((t) => t.postId === e);
|
|
1952
2018
|
if (!n) return;
|
|
1953
2019
|
let r = N(n, t);
|
|
1954
2020
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
1955
2021
|
}
|
|
1956
|
-
async function
|
|
2022
|
+
async function ne() {
|
|
1957
2023
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
1958
2024
|
}
|
|
1959
|
-
function
|
|
2025
|
+
function re(e) {
|
|
1960
2026
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
1961
2027
|
}
|
|
1962
|
-
function
|
|
2028
|
+
function ie(e) {
|
|
1963
2029
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
1964
2030
|
}
|
|
1965
|
-
function
|
|
2031
|
+
function ae(e) {
|
|
1966
2032
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
1967
2033
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
1968
2034
|
if (!t) return "not-found";
|
|
1969
2035
|
let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
1970
2036
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
1971
2037
|
}
|
|
1972
|
-
function
|
|
2038
|
+
function oe() {
|
|
1973
2039
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
1974
2040
|
}
|
|
1975
|
-
function
|
|
1976
|
-
|
|
2041
|
+
function se(e, t) {
|
|
2042
|
+
W = e, G = t === "keyboard", y.value = le(e), d("openReel", e), m(() => h.value?.focus());
|
|
1977
2043
|
}
|
|
1978
|
-
function
|
|
2044
|
+
function J(e) {
|
|
1979
2045
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
1980
2046
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
1981
2047
|
}
|
|
1982
|
-
function
|
|
1983
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
1984
|
-
let t = [...new Set(e)], n = t.filter(
|
|
2048
|
+
function ce(e) {
|
|
2049
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
|
|
2050
|
+
let t = [...new Set(e)], n = t.filter(J);
|
|
1985
2051
|
if (n.length === 0) return 0;
|
|
1986
|
-
let r = new Map(
|
|
2052
|
+
let r = new Map(D.value);
|
|
1987
2053
|
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]),
|
|
2054
|
+
r.set(e, t * Nt);
|
|
2055
|
+
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), D.value = r, Pt + (n.length - 1) * Nt;
|
|
1990
2056
|
}
|
|
1991
2057
|
function Y(e, t) {
|
|
1992
|
-
let n =
|
|
2058
|
+
let n = J(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
1993
2059
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
1994
2060
|
r.classList.remove("media-card-focus-silent");
|
|
1995
2061
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
1996
2062
|
}
|
|
1997
|
-
function
|
|
1998
|
-
let t = g.value, n =
|
|
2063
|
+
function le(e) {
|
|
2064
|
+
let t = g.value, n = J(e);
|
|
1999
2065
|
if (t === null || n === null) return {};
|
|
2000
2066
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2001
2067
|
return {
|
|
@@ -2005,48 +2071,48 @@ var jt = 35, Mt = 420, Nt = /* @__PURE__ */ d({
|
|
|
2005
2071
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2006
2072
|
};
|
|
2007
2073
|
}
|
|
2008
|
-
function
|
|
2009
|
-
l.state.reelOrigin === "masonry" && (
|
|
2074
|
+
function ue() {
|
|
2075
|
+
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2010
2076
|
}
|
|
2011
|
-
function
|
|
2012
|
-
let e =
|
|
2013
|
-
x.value = !1,
|
|
2077
|
+
function de() {
|
|
2078
|
+
let e = W, t = G;
|
|
2079
|
+
x.value = !1, W = null, G = !1, y.value = {}, m(() => {
|
|
2014
2080
|
e !== null && Y(e, t);
|
|
2015
2081
|
});
|
|
2016
2082
|
}
|
|
2017
|
-
return
|
|
2018
|
-
closeMasonryReel:
|
|
2083
|
+
return Mt({
|
|
2084
|
+
closeMasonryReel: ue,
|
|
2019
2085
|
element: () => g.value,
|
|
2020
2086
|
isReelLeaving: () => x.value,
|
|
2021
2087
|
reelRenderer: () => p.value,
|
|
2022
2088
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2023
2089
|
state: l.state
|
|
2024
|
-
}),
|
|
2025
|
-
let t = e.filter((e) => !
|
|
2026
|
-
if (
|
|
2090
|
+
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2091
|
+
let t = e.filter((e) => !H.has(e)), n = new Set(e);
|
|
2092
|
+
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
2093
|
let r = /* @__PURE__ */ new Map();
|
|
2028
2094
|
e.forEach((e) => {
|
|
2029
2095
|
let t = C.value.get(e);
|
|
2030
2096
|
t !== void 0 && r.set(e, t);
|
|
2031
2097
|
}), t.forEach((e, t) => {
|
|
2032
|
-
r.set(e, t *
|
|
2033
|
-
}), C.value = r, S.value = new Set([...S.value, ...t]),
|
|
2098
|
+
r.set(e, t * Nt);
|
|
2099
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), q();
|
|
2034
2100
|
}, { flush: "sync" }), v(() => {
|
|
2035
|
-
|
|
2101
|
+
U !== null && cancelAnimationFrame(U);
|
|
2036
2102
|
}), i({
|
|
2037
|
-
changeActiveReelMedia:
|
|
2038
|
-
getAutoScrollElement:
|
|
2039
|
-
loadIfNearBottom:
|
|
2040
|
-
moveActiveReelPost:
|
|
2041
|
-
navigateToReelItem:
|
|
2042
|
-
startItemRemoval:
|
|
2103
|
+
changeActiveReelMedia: re,
|
|
2104
|
+
getAutoScrollElement: oe,
|
|
2105
|
+
loadIfNearBottom: ne,
|
|
2106
|
+
moveActiveReelPost: ie,
|
|
2107
|
+
navigateToReelItem: ae,
|
|
2108
|
+
startItemRemoval: ce,
|
|
2043
2109
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2044
2110
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2045
2111
|
}), (r, i) => (b(), s("div", {
|
|
2046
2112
|
ref_key: "surfaceElement",
|
|
2047
2113
|
ref: g,
|
|
2048
2114
|
class: "vibe-surface"
|
|
2049
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2115
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Tt, {
|
|
2050
2116
|
key: 0,
|
|
2051
2117
|
ref_key: "reelRenderer",
|
|
2052
2118
|
ref: p,
|
|
@@ -2071,51 +2137,25 @@ var jt = 35, Mt = 420, Nt = /* @__PURE__ */ d({
|
|
|
2071
2137
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2072
2138
|
"next-page-error": !!t.state.nextPageError,
|
|
2073
2139
|
origin: "reel",
|
|
2074
|
-
"preview-states":
|
|
2140
|
+
"preview-states": E(V),
|
|
2075
2141
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2076
2142
|
"reel-forward": t.state.reelForward,
|
|
2077
|
-
state:
|
|
2143
|
+
state: A.value,
|
|
2078
2144
|
total: t.state.total,
|
|
2079
2145
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
2080
2146
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2081
|
-
onError:
|
|
2147
|
+
onError: E(L),
|
|
2082
2148
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2083
|
-
onMediaChange:
|
|
2084
|
-
onReady:
|
|
2149
|
+
onMediaChange: te,
|
|
2150
|
+
onReady: E(R),
|
|
2085
2151
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2086
2152
|
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, {
|
|
2153
|
+
}, 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
2154
|
key: 1,
|
|
2115
2155
|
actions: t.feedFooterActions,
|
|
2116
2156
|
"can-retry-end": t.canRetryEnd,
|
|
2117
2157
|
"feed-footer": t.feedFooter,
|
|
2118
|
-
state:
|
|
2158
|
+
state: A.value,
|
|
2119
2159
|
onLoadMore: i[5] ||= (e) => d("loadMore"),
|
|
2120
2160
|
onRetryEnd: i[6] ||= (e) => d("retryEnd")
|
|
2121
2161
|
}, null, 8, [
|
|
@@ -2123,14 +2163,14 @@ var jt = 35, Mt = 420, Nt = /* @__PURE__ */ d({
|
|
|
2123
2163
|
"can-retry-end",
|
|
2124
2164
|
"feed-footer",
|
|
2125
2165
|
"state"
|
|
2126
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2166
|
+
])) : (b(), s(e, { key: 2 }, [u(ut, {
|
|
2127
2167
|
ref_key: "masonryRenderer",
|
|
2128
2168
|
ref: f,
|
|
2129
2169
|
"can-retry-end": t.canRetryEnd,
|
|
2130
2170
|
"entering-post-ids": S.value,
|
|
2131
2171
|
"entry-delays": C.value,
|
|
2132
2172
|
"leaving-post-ids": T.value,
|
|
2133
|
-
"removal-delays":
|
|
2173
|
+
"removal-delays": D.value,
|
|
2134
2174
|
"card-footer": t.cardFooter,
|
|
2135
2175
|
"card-header": t.cardHeader,
|
|
2136
2176
|
"feed-footer": t.feedFooter,
|
|
@@ -2143,16 +2183,17 @@ var jt = 35, Mt = 420, Nt = /* @__PURE__ */ d({
|
|
|
2143
2183
|
"load-more-locked": t.state.loadMoreLocked,
|
|
2144
2184
|
"media-indices": t.state.mediaIndices,
|
|
2145
2185
|
"next-page-error": !!t.state.nextPageError,
|
|
2146
|
-
"preview-states":
|
|
2186
|
+
"preview-states": E(B),
|
|
2147
2187
|
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2148
|
-
state:
|
|
2188
|
+
state: A.value,
|
|
2149
2189
|
total: t.state.total,
|
|
2150
|
-
onActivate:
|
|
2151
|
-
onError:
|
|
2190
|
+
onActivate: se,
|
|
2191
|
+
onError: E(P),
|
|
2152
2192
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2153
|
-
onMediaChange:
|
|
2154
|
-
onReady:
|
|
2155
|
-
onRetryEnd: i[8] ||= (e) => d("retryEnd")
|
|
2193
|
+
onMediaChange: te,
|
|
2194
|
+
onReady: E(F),
|
|
2195
|
+
onRetryEnd: i[8] ||= (e) => d("retryEnd"),
|
|
2196
|
+
onVisible: E(j)
|
|
2156
2197
|
}, null, 8, [
|
|
2157
2198
|
"can-retry-end",
|
|
2158
2199
|
"entering-post-ids",
|
|
@@ -2174,10 +2215,13 @@ var jt = 35, Mt = 420, Nt = /* @__PURE__ */ d({
|
|
|
2174
2215
|
"preview-states",
|
|
2175
2216
|
"suspended",
|
|
2176
2217
|
"state",
|
|
2177
|
-
"total"
|
|
2218
|
+
"total",
|
|
2219
|
+
"onError",
|
|
2220
|
+
"onReady",
|
|
2221
|
+
"onVisible"
|
|
2178
2222
|
]), u(n, {
|
|
2179
2223
|
name: "vibe-reel-viewer",
|
|
2180
|
-
onAfterLeave:
|
|
2224
|
+
onAfterLeave: de
|
|
2181
2225
|
}, {
|
|
2182
2226
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2183
2227
|
key: 0,
|
|
@@ -2189,7 +2233,7 @@ var jt = 35, Mt = 420, Nt = /* @__PURE__ */ d({
|
|
|
2189
2233
|
"aria-modal": "true",
|
|
2190
2234
|
tabindex: "-1",
|
|
2191
2235
|
style: _(y.value)
|
|
2192
|
-
}, [u(
|
|
2236
|
+
}, [u(Tt, {
|
|
2193
2237
|
ref_key: "reelRenderer",
|
|
2194
2238
|
ref: p,
|
|
2195
2239
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2213,52 +2257,27 @@ var jt = 35, Mt = 420, Nt = /* @__PURE__ */ d({
|
|
|
2213
2257
|
"media-source": "original",
|
|
2214
2258
|
"next-page-error": !!t.state.nextPageError,
|
|
2215
2259
|
origin: "masonry",
|
|
2216
|
-
"preview-states":
|
|
2260
|
+
"preview-states": E(z),
|
|
2217
2261
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2218
2262
|
"reel-forward": t.state.reelForward,
|
|
2219
|
-
state:
|
|
2263
|
+
state: A.value,
|
|
2220
2264
|
total: t.state.total,
|
|
2221
2265
|
onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
|
|
2222
2266
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2223
|
-
onError:
|
|
2267
|
+
onError: E(L),
|
|
2224
2268
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2225
|
-
onMediaChange:
|
|
2226
|
-
onReady:
|
|
2269
|
+
onMediaChange: te,
|
|
2270
|
+
onReady: E(R),
|
|
2227
2271
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2228
2272
|
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)]),
|
|
2273
|
+
}, 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
2274
|
_: 1
|
|
2256
2275
|
})], 64))], 512));
|
|
2257
2276
|
}
|
|
2258
2277
|
});
|
|
2259
2278
|
//#endregion
|
|
2260
2279
|
//#region src/core/page.ts
|
|
2261
|
-
function
|
|
2280
|
+
function It(e) {
|
|
2262
2281
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2263
2282
|
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
2283
|
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.");
|
|
@@ -2270,32 +2289,32 @@ function Z(e, t) {
|
|
|
2270
2289
|
}
|
|
2271
2290
|
//#endregion
|
|
2272
2291
|
//#region src/core/requestDelay.ts
|
|
2273
|
-
var
|
|
2292
|
+
var Lt = 2e3, Rt = 1e4, zt = 250, Bt = {
|
|
2274
2293
|
delayRemainingMs: null,
|
|
2275
2294
|
nextRequestAt: null
|
|
2276
2295
|
};
|
|
2277
|
-
function
|
|
2296
|
+
function Vt(e, t) {
|
|
2278
2297
|
return e === void 0 ? t : Math.floor(e);
|
|
2279
2298
|
}
|
|
2280
|
-
function
|
|
2299
|
+
function Ht(e, t) {
|
|
2281
2300
|
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
2301
|
}
|
|
2283
|
-
function
|
|
2284
|
-
let n =
|
|
2302
|
+
function Ut(e, t = {}) {
|
|
2303
|
+
let n = Vt(t.delayStepMs, Lt), r = Vt(t.delayMaxMs, Rt);
|
|
2285
2304
|
return Math.min(Math.max(0, e) * n, r);
|
|
2286
2305
|
}
|
|
2287
2306
|
function Q(e) {
|
|
2288
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2307
|
+
if (e == null || !Number.isFinite(e)) return { ...Bt };
|
|
2289
2308
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2290
2309
|
return t > 0 ? {
|
|
2291
2310
|
delayRemainingMs: t,
|
|
2292
2311
|
nextRequestAt: e
|
|
2293
|
-
} : { ...
|
|
2312
|
+
} : { ...Bt };
|
|
2294
2313
|
}
|
|
2295
|
-
async function
|
|
2314
|
+
async function Wt({ delayMs: e, onChange: t, signal: n }) {
|
|
2296
2315
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2297
2316
|
if (e <= 0) {
|
|
2298
|
-
t({ ...
|
|
2317
|
+
t({ ...Bt });
|
|
2299
2318
|
return;
|
|
2300
2319
|
}
|
|
2301
2320
|
let r = Date.now() + e;
|
|
@@ -2303,9 +2322,9 @@ async function Ht({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2303
2322
|
delayRemainingMs: e,
|
|
2304
2323
|
nextRequestAt: r
|
|
2305
2324
|
}), await new Promise((i, a) => {
|
|
2306
|
-
let o = !1, s = setInterval(f,
|
|
2325
|
+
let o = !1, s = setInterval(f, zt), c = setTimeout(() => u(), e);
|
|
2307
2326
|
function l() {
|
|
2308
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2327
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Bt });
|
|
2309
2328
|
}
|
|
2310
2329
|
function u(e) {
|
|
2311
2330
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2320,13 +2339,13 @@ async function Ht({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2320
2339
|
n.addEventListener("abort", d, { once: !0 });
|
|
2321
2340
|
});
|
|
2322
2341
|
}
|
|
2323
|
-
var
|
|
2342
|
+
var Gt = class {
|
|
2324
2343
|
interval = null;
|
|
2325
2344
|
constructor(e) {
|
|
2326
2345
|
this.onChange = e;
|
|
2327
2346
|
}
|
|
2328
2347
|
clear() {
|
|
2329
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2348
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Bt });
|
|
2330
2349
|
}
|
|
2331
2350
|
sync(e) {
|
|
2332
2351
|
this.clear();
|
|
@@ -2334,22 +2353,22 @@ var Ut = class {
|
|
|
2334
2353
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2335
2354
|
let t = Q(e);
|
|
2336
2355
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2337
|
-
},
|
|
2356
|
+
}, zt));
|
|
2338
2357
|
}
|
|
2339
2358
|
};
|
|
2340
|
-
function
|
|
2359
|
+
function Kt(e, t = !0) {
|
|
2341
2360
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2342
2361
|
}
|
|
2343
|
-
function
|
|
2362
|
+
function qt(e) {
|
|
2344
2363
|
return `${typeof e}:${String(e)}`;
|
|
2345
2364
|
}
|
|
2346
|
-
function
|
|
2365
|
+
function Jt(e, t) {
|
|
2347
2366
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2348
2367
|
}
|
|
2349
|
-
function
|
|
2368
|
+
function Yt(e) {
|
|
2350
2369
|
if (!e) return;
|
|
2351
|
-
if (
|
|
2352
|
-
|
|
2370
|
+
if (Jt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2371
|
+
Ht(e, "frontend autofill");
|
|
2353
2372
|
let t = e.maxAdditionalPages;
|
|
2354
2373
|
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
2374
|
return;
|
|
@@ -2361,7 +2380,7 @@ function qt(e) {
|
|
|
2361
2380
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2362
2381
|
}
|
|
2363
2382
|
}
|
|
2364
|
-
function
|
|
2383
|
+
function Xt(e, t, n = !0) {
|
|
2365
2384
|
if (!e) return {
|
|
2366
2385
|
cycleId: null,
|
|
2367
2386
|
delayRemainingMs: null,
|
|
@@ -2395,7 +2414,7 @@ function Jt(e, t, n = !0) {
|
|
|
2395
2414
|
strategy: e.strategy
|
|
2396
2415
|
};
|
|
2397
2416
|
}
|
|
2398
|
-
function
|
|
2417
|
+
function Zt(e) {
|
|
2399
2418
|
return [
|
|
2400
2419
|
"cancelling",
|
|
2401
2420
|
"filling",
|
|
@@ -2403,9 +2422,9 @@ function Yt(e) {
|
|
|
2403
2422
|
"waiting"
|
|
2404
2423
|
].includes(e.status);
|
|
2405
2424
|
}
|
|
2406
|
-
async function
|
|
2425
|
+
async function Qt(e, t, n) {
|
|
2407
2426
|
let r = t.autofill;
|
|
2408
|
-
if (!
|
|
2427
|
+
if (!Zt(r) || !r.cycleId) return;
|
|
2409
2428
|
let i = {
|
|
2410
2429
|
cycleId: r.cycleId,
|
|
2411
2430
|
feedKey: r.feedKey ?? "",
|
|
@@ -2418,76 +2437,92 @@ async function Xt(e, t, n) {
|
|
|
2418
2437
|
throw r.error = e, r.status = "error", e;
|
|
2419
2438
|
}
|
|
2420
2439
|
}
|
|
2421
|
-
function
|
|
2440
|
+
function $t(e, t, n) {
|
|
2422
2441
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2423
2442
|
}
|
|
2424
|
-
async function
|
|
2425
|
-
let
|
|
2426
|
-
for (;
|
|
2427
|
-
let e =
|
|
2428
|
-
if (
|
|
2429
|
-
|
|
2430
|
-
delayMs:
|
|
2443
|
+
async function en({ 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 }) {
|
|
2444
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Kt(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2445
|
+
for (; y < h;) {
|
|
2446
|
+
let e = qt(g);
|
|
2447
|
+
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2448
|
+
if (m.add(e), await Wt({
|
|
2449
|
+
delayMs: Ut(l + y, s),
|
|
2431
2450
|
onChange: a,
|
|
2432
|
-
signal:
|
|
2433
|
-
})
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2451
|
+
signal: d
|
|
2452
|
+
}), y > 0 && u()) return {
|
|
2453
|
+
items: f,
|
|
2454
|
+
lastCursor: _,
|
|
2455
|
+
missing: Math.max(0, s.pageSize - c - f.length),
|
|
2456
|
+
next: v,
|
|
2457
|
+
pages: b,
|
|
2458
|
+
received: c + f.length,
|
|
2459
|
+
requests: l + y,
|
|
2460
|
+
status: "paused",
|
|
2461
|
+
total: x
|
|
2462
|
+
};
|
|
2463
|
+
let t = It(await n({
|
|
2464
|
+
cursor: g,
|
|
2465
|
+
signal: d
|
|
2437
2466
|
}));
|
|
2438
|
-
|
|
2439
|
-
let r = Z(
|
|
2440
|
-
|
|
2467
|
+
y += 1, _ = g;
|
|
2468
|
+
let r = Z(p, t.items).slice(p.length);
|
|
2469
|
+
b.push({
|
|
2441
2470
|
contributionIds: r.map(({ postId: e }) => e),
|
|
2442
|
-
cursor:
|
|
2471
|
+
cursor: g,
|
|
2443
2472
|
next: t.next,
|
|
2444
2473
|
returnedIds: t.items.map(({ postId: e }) => e)
|
|
2445
|
-
}),
|
|
2446
|
-
let
|
|
2447
|
-
missing: Math.max(0, s.pageSize - c -
|
|
2448
|
-
next:
|
|
2449
|
-
received: c +
|
|
2450
|
-
requests: l +
|
|
2474
|
+
}), p.push(...r), f.push(...r), v = t.next, t.total !== void 0 && (x = t.total);
|
|
2475
|
+
let h = {
|
|
2476
|
+
missing: Math.max(0, s.pageSize - c - f.length),
|
|
2477
|
+
next: v,
|
|
2478
|
+
received: c + f.length,
|
|
2479
|
+
requests: l + y
|
|
2451
2480
|
};
|
|
2452
|
-
o(
|
|
2453
|
-
let
|
|
2454
|
-
...
|
|
2455
|
-
items: [...
|
|
2456
|
-
lastCursor:
|
|
2457
|
-
|
|
2481
|
+
o(h);
|
|
2482
|
+
let S = {
|
|
2483
|
+
...h,
|
|
2484
|
+
items: [...f],
|
|
2485
|
+
lastCursor: _,
|
|
2486
|
+
pages: [...b],
|
|
2487
|
+
total: x
|
|
2458
2488
|
};
|
|
2459
|
-
if (i(
|
|
2460
|
-
...
|
|
2461
|
-
pages:
|
|
2489
|
+
if (i(S), h.missing === 0) return {
|
|
2490
|
+
...S,
|
|
2491
|
+
pages: b,
|
|
2462
2492
|
status: "complete"
|
|
2463
2493
|
};
|
|
2464
|
-
if (
|
|
2465
|
-
...
|
|
2466
|
-
pages:
|
|
2494
|
+
if (v === null) return {
|
|
2495
|
+
...S,
|
|
2496
|
+
pages: b,
|
|
2467
2497
|
status: "exhausted"
|
|
2468
2498
|
};
|
|
2469
|
-
|
|
2499
|
+
if (u()) return {
|
|
2500
|
+
...S,
|
|
2501
|
+
pages: b,
|
|
2502
|
+
status: "paused"
|
|
2503
|
+
};
|
|
2504
|
+
g = v;
|
|
2470
2505
|
}
|
|
2471
2506
|
return {
|
|
2472
|
-
items:
|
|
2473
|
-
lastCursor:
|
|
2474
|
-
missing: Math.max(0, s.pageSize - c -
|
|
2475
|
-
next:
|
|
2476
|
-
pages:
|
|
2477
|
-
received: c +
|
|
2478
|
-
requests: l +
|
|
2507
|
+
items: f,
|
|
2508
|
+
lastCursor: _,
|
|
2509
|
+
missing: Math.max(0, s.pageSize - c - f.length),
|
|
2510
|
+
next: v,
|
|
2511
|
+
pages: b,
|
|
2512
|
+
received: c + f.length,
|
|
2513
|
+
requests: l + y,
|
|
2479
2514
|
status: "exhausted",
|
|
2480
|
-
total:
|
|
2515
|
+
total: x
|
|
2481
2516
|
};
|
|
2482
2517
|
}
|
|
2483
2518
|
//#endregion
|
|
2484
2519
|
//#region src/core/autofillController.ts
|
|
2485
|
-
var
|
|
2520
|
+
var tn = class {
|
|
2486
2521
|
collection = null;
|
|
2487
2522
|
cycle = 0;
|
|
2488
2523
|
delayCountdown;
|
|
2489
2524
|
constructor(e) {
|
|
2490
|
-
this.context = e, this.delayCountdown = new
|
|
2525
|
+
this.context = e, this.delayCountdown = new Gt((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2491
2526
|
}
|
|
2492
2527
|
beginCycle() {
|
|
2493
2528
|
let { options: e, state: t } = this.context;
|
|
@@ -2495,14 +2530,14 @@ var $t = class {
|
|
|
2495
2530
|
this.clear();
|
|
2496
2531
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2497
2532
|
return t.autofill = {
|
|
2498
|
-
...
|
|
2533
|
+
...Xt(e, void 0, !1),
|
|
2499
2534
|
cycleId: n,
|
|
2500
2535
|
status: "filling"
|
|
2501
2536
|
}, n;
|
|
2502
2537
|
}
|
|
2503
2538
|
async cancel() {
|
|
2504
2539
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2505
|
-
await
|
|
2540
|
+
await Qt(t, n, e), this.commitCollection();
|
|
2506
2541
|
}
|
|
2507
2542
|
captureCollection(e, t) {
|
|
2508
2543
|
t && (this.collection = e);
|
|
@@ -2524,36 +2559,36 @@ var $t = class {
|
|
|
2524
2559
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
2525
2560
|
if (t?.strategy !== "frontend") return;
|
|
2526
2561
|
let r = this.collection;
|
|
2527
|
-
this.collection = null, r && (n.items = Z(n.items, r.items), e(r.lastCursor), n.next = r.next, r.total !== void 0 && (n.total = r.total), Object.assign(n.autofill, {
|
|
2562
|
+
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, {
|
|
2528
2563
|
missing: r.missing,
|
|
2529
2564
|
received: r.received,
|
|
2530
2565
|
requests: r.requests
|
|
2531
2566
|
}));
|
|
2532
2567
|
}
|
|
2533
|
-
},
|
|
2534
|
-
function
|
|
2568
|
+
}, nn = 100;
|
|
2569
|
+
function rn(e, t) {
|
|
2535
2570
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2536
2571
|
}
|
|
2537
|
-
function
|
|
2572
|
+
function an(e, t, n) {
|
|
2538
2573
|
return Math.min(n, Math.max(t, e));
|
|
2539
2574
|
}
|
|
2540
|
-
function
|
|
2575
|
+
function on(e) {
|
|
2541
2576
|
if (!e) return;
|
|
2542
2577
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2543
|
-
if (
|
|
2544
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2578
|
+
if (rn("autoScroll.minSpeedPxPerSecond", t), rn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2579
|
+
e.speedPxPerSecond !== void 0 && rn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2545
2580
|
}
|
|
2546
|
-
function
|
|
2581
|
+
function sn(e) {
|
|
2547
2582
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2548
2583
|
return {
|
|
2549
2584
|
enabled: e?.enabled ?? !1,
|
|
2550
2585
|
maxSpeedPxPerSecond: n,
|
|
2551
2586
|
minSpeedPxPerSecond: t,
|
|
2552
2587
|
paused: !1,
|
|
2553
|
-
speedPxPerSecond:
|
|
2588
|
+
speedPxPerSecond: an(e?.speedPxPerSecond ?? 80, t, n)
|
|
2554
2589
|
};
|
|
2555
2590
|
}
|
|
2556
|
-
var
|
|
2591
|
+
var cn = class {
|
|
2557
2592
|
frame = null;
|
|
2558
2593
|
lastTimestamp = null;
|
|
2559
2594
|
mounted = !1;
|
|
@@ -2573,9 +2608,9 @@ var on = class {
|
|
|
2573
2608
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2574
2609
|
}
|
|
2575
2610
|
setSpeed(e) {
|
|
2576
|
-
|
|
2611
|
+
rn("auto-scroll speed", e);
|
|
2577
2612
|
let t = this.options.state;
|
|
2578
|
-
t.speedPxPerSecond =
|
|
2613
|
+
t.speedPxPerSecond = an(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2579
2614
|
}
|
|
2580
2615
|
tick = (e) => {
|
|
2581
2616
|
this.frame = null;
|
|
@@ -2587,7 +2622,7 @@ var on = class {
|
|
|
2587
2622
|
return;
|
|
2588
2623
|
}
|
|
2589
2624
|
if (this.lastTimestamp !== null) {
|
|
2590
|
-
let r = Math.min(
|
|
2625
|
+
let r = Math.min(nn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2591
2626
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2592
2627
|
}
|
|
2593
2628
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2601,7 +2636,7 @@ var on = class {
|
|
|
2601
2636
|
};
|
|
2602
2637
|
//#endregion
|
|
2603
2638
|
//#region src/core/backendAutofill.ts
|
|
2604
|
-
async function
|
|
2639
|
+
async function ln(e, t, n, r) {
|
|
2605
2640
|
let i = await e.onUnderfilled(n);
|
|
2606
2641
|
if (!r()) return;
|
|
2607
2642
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2615,19 +2650,19 @@ async function sn(e, t, n, r) {
|
|
|
2615
2650
|
status: "waiting"
|
|
2616
2651
|
});
|
|
2617
2652
|
}
|
|
2618
|
-
function
|
|
2653
|
+
function un(e, t) {
|
|
2619
2654
|
["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);
|
|
2620
2655
|
}
|
|
2621
|
-
function
|
|
2656
|
+
function dn(e, t, n) {
|
|
2622
2657
|
let r = t.autofill;
|
|
2623
|
-
return
|
|
2658
|
+
return !$t(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (un(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);
|
|
2624
2659
|
}
|
|
2625
|
-
function
|
|
2626
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2660
|
+
function fn(e, t, n) {
|
|
2661
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Xt(e, n), un(t, n), !0);
|
|
2627
2662
|
}
|
|
2628
2663
|
//#endregion
|
|
2629
2664
|
//#region src/core/initialAutofill.ts
|
|
2630
|
-
async function
|
|
2665
|
+
async function pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2631
2666
|
let c = a.autofill;
|
|
2632
2667
|
if (!c) return;
|
|
2633
2668
|
let l = s.items.length;
|
|
@@ -2640,7 +2675,7 @@ async function dn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2640
2675
|
return;
|
|
2641
2676
|
}
|
|
2642
2677
|
if (c.strategy === "backend") {
|
|
2643
|
-
await
|
|
2678
|
+
await ln(c, s, {
|
|
2644
2679
|
cycleId: e,
|
|
2645
2680
|
feedKey: c.feedKey,
|
|
2646
2681
|
items: [...s.items],
|
|
@@ -2657,11 +2692,11 @@ async function dn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2657
2692
|
s.autofill.status = "exhausted";
|
|
2658
2693
|
return;
|
|
2659
2694
|
}
|
|
2660
|
-
let u = await
|
|
2695
|
+
let u = await en({
|
|
2661
2696
|
existingItems: s.items,
|
|
2662
2697
|
initialCursor: s.next,
|
|
2663
2698
|
loadPage: a.loadPage,
|
|
2664
|
-
maximumRequests:
|
|
2699
|
+
maximumRequests: Kt(c, !1),
|
|
2665
2700
|
onCollection: n,
|
|
2666
2701
|
onDelayChange: (e) => {
|
|
2667
2702
|
t() && Object.assign(s.autofill, e);
|
|
@@ -2672,6 +2707,7 @@ async function dn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2672
2707
|
options: c,
|
|
2673
2708
|
receivedOffset: l,
|
|
2674
2709
|
requestOffset: 1,
|
|
2710
|
+
shouldPause: () => s.loadMoreLocked,
|
|
2675
2711
|
signal: o
|
|
2676
2712
|
});
|
|
2677
2713
|
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, {
|
|
@@ -2683,13 +2719,13 @@ async function dn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2683
2719
|
}
|
|
2684
2720
|
//#endregion
|
|
2685
2721
|
//#region src/core/fill.ts
|
|
2686
|
-
function
|
|
2722
|
+
function mn(e) {
|
|
2687
2723
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2688
2724
|
}
|
|
2689
|
-
function
|
|
2725
|
+
function hn(e) {
|
|
2690
2726
|
return `${typeof e}:${String(e)}`;
|
|
2691
2727
|
}
|
|
2692
|
-
function
|
|
2728
|
+
function gn(e) {
|
|
2693
2729
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2694
2730
|
if ("pages" in e) {
|
|
2695
2731
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2698,20 +2734,20 @@ function mn(e) {
|
|
|
2698
2734
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2699
2735
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2700
2736
|
}
|
|
2701
|
-
function
|
|
2737
|
+
function _n(e) {
|
|
2702
2738
|
if (!e) return;
|
|
2703
2739
|
if (e.strategy === "frontend") {
|
|
2704
|
-
|
|
2740
|
+
Ht(e, "frontend fill");
|
|
2705
2741
|
return;
|
|
2706
2742
|
}
|
|
2707
2743
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2708
2744
|
let t = e.initialSession;
|
|
2709
2745
|
if (t) {
|
|
2710
2746
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2711
|
-
|
|
2747
|
+
gn(t.target);
|
|
2712
2748
|
}
|
|
2713
2749
|
}
|
|
2714
|
-
function
|
|
2750
|
+
function vn(e, t, n = !0) {
|
|
2715
2751
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
|
|
2716
2752
|
return {
|
|
2717
2753
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2725,10 +2761,10 @@ function gn(e, t, n = !0) {
|
|
|
2725
2761
|
sessionId: i?.sessionId ?? null,
|
|
2726
2762
|
status: i?.status ?? "idle",
|
|
2727
2763
|
strategy: e?.strategy ?? null,
|
|
2728
|
-
target: i ?
|
|
2764
|
+
target: i ? mn(i.target) : null
|
|
2729
2765
|
};
|
|
2730
2766
|
}
|
|
2731
|
-
function
|
|
2767
|
+
function yn(e) {
|
|
2732
2768
|
return [
|
|
2733
2769
|
"cancelling",
|
|
2734
2770
|
"filling",
|
|
@@ -2736,67 +2772,94 @@ function _n(e) {
|
|
|
2736
2772
|
"waiting"
|
|
2737
2773
|
].includes(e.status);
|
|
2738
2774
|
}
|
|
2739
|
-
async function
|
|
2740
|
-
let
|
|
2741
|
-
for (;
|
|
2742
|
-
let e =
|
|
2743
|
-
if (
|
|
2744
|
-
|
|
2745
|
-
delayMs:
|
|
2746
|
-
onChange:
|
|
2747
|
-
signal:
|
|
2748
|
-
})
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2775
|
+
async function bn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
2776
|
+
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
2777
|
+
for (; _ !== null;) {
|
|
2778
|
+
let e = hn(h);
|
|
2779
|
+
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2780
|
+
if (p.add(e), await Wt({
|
|
2781
|
+
delayMs: Ut(m, o),
|
|
2782
|
+
onChange: i,
|
|
2783
|
+
signal: c
|
|
2784
|
+
}), m > 0 && s()) return {
|
|
2785
|
+
completedPages: m,
|
|
2786
|
+
items: u,
|
|
2787
|
+
lastCursor: g,
|
|
2788
|
+
next: _,
|
|
2789
|
+
pages: d,
|
|
2790
|
+
received: v,
|
|
2791
|
+
status: "paused",
|
|
2792
|
+
total: y
|
|
2793
|
+
};
|
|
2794
|
+
let t = It(await n({
|
|
2795
|
+
cursor: h,
|
|
2796
|
+
signal: c
|
|
2752
2797
|
}));
|
|
2753
|
-
|
|
2754
|
-
let
|
|
2755
|
-
if (
|
|
2756
|
-
contributionIds:
|
|
2757
|
-
cursor:
|
|
2798
|
+
m += 1, g = h;
|
|
2799
|
+
let b = Z(f, t.items).slice(f.length);
|
|
2800
|
+
if (d.push({
|
|
2801
|
+
contributionIds: b.map(({ postId: e }) => e),
|
|
2802
|
+
cursor: h,
|
|
2758
2803
|
next: t.next,
|
|
2759
2804
|
returnedIds: t.items.map(({ postId: e }) => e)
|
|
2760
|
-
}),
|
|
2761
|
-
completedPages:
|
|
2762
|
-
next:
|
|
2763
|
-
received:
|
|
2764
|
-
}),
|
|
2765
|
-
completedPages:
|
|
2766
|
-
items:
|
|
2767
|
-
lastCursor:
|
|
2768
|
-
next:
|
|
2769
|
-
pages:
|
|
2770
|
-
received:
|
|
2805
|
+
}), f.push(...b), u.push(...b), v = u.length, _ = t.next, t.total !== void 0 && (y = t.total), a({
|
|
2806
|
+
completedPages: m,
|
|
2807
|
+
next: _,
|
|
2808
|
+
received: v
|
|
2809
|
+
}), r({
|
|
2810
|
+
completedPages: m,
|
|
2811
|
+
items: [...u],
|
|
2812
|
+
lastCursor: h,
|
|
2813
|
+
next: _,
|
|
2814
|
+
pages: [...d],
|
|
2815
|
+
received: v,
|
|
2816
|
+
total: y
|
|
2817
|
+
}), "pages" in l && m >= l.pages) return {
|
|
2818
|
+
completedPages: m,
|
|
2819
|
+
items: u,
|
|
2820
|
+
lastCursor: h,
|
|
2821
|
+
next: _,
|
|
2822
|
+
pages: d,
|
|
2823
|
+
received: v,
|
|
2771
2824
|
status: "complete",
|
|
2772
|
-
total:
|
|
2825
|
+
total: y
|
|
2826
|
+
};
|
|
2827
|
+
if (_ === null) return {
|
|
2828
|
+
completedPages: m,
|
|
2829
|
+
items: u,
|
|
2830
|
+
lastCursor: h,
|
|
2831
|
+
next: _,
|
|
2832
|
+
pages: d,
|
|
2833
|
+
received: v,
|
|
2834
|
+
status: "pages" in l ? "exhausted" : "complete",
|
|
2835
|
+
total: y
|
|
2773
2836
|
};
|
|
2774
|
-
if (
|
|
2775
|
-
completedPages:
|
|
2776
|
-
items:
|
|
2777
|
-
lastCursor:
|
|
2778
|
-
next:
|
|
2779
|
-
pages:
|
|
2780
|
-
received:
|
|
2781
|
-
status: "
|
|
2782
|
-
total:
|
|
2837
|
+
if (s()) return {
|
|
2838
|
+
completedPages: m,
|
|
2839
|
+
items: u,
|
|
2840
|
+
lastCursor: h,
|
|
2841
|
+
next: _,
|
|
2842
|
+
pages: d,
|
|
2843
|
+
received: v,
|
|
2844
|
+
status: "paused",
|
|
2845
|
+
total: y
|
|
2783
2846
|
};
|
|
2784
|
-
|
|
2847
|
+
h = _;
|
|
2785
2848
|
}
|
|
2786
2849
|
return {
|
|
2787
|
-
completedPages:
|
|
2788
|
-
items:
|
|
2789
|
-
lastCursor:
|
|
2850
|
+
completedPages: m,
|
|
2851
|
+
items: u,
|
|
2852
|
+
lastCursor: h,
|
|
2790
2853
|
next: null,
|
|
2791
|
-
pages:
|
|
2792
|
-
received:
|
|
2793
|
-
status: "pages" in
|
|
2794
|
-
total:
|
|
2854
|
+
pages: d,
|
|
2855
|
+
received: v,
|
|
2856
|
+
status: "pages" in l ? "exhausted" : "complete",
|
|
2857
|
+
total: y
|
|
2795
2858
|
};
|
|
2796
2859
|
}
|
|
2797
2860
|
//#endregion
|
|
2798
2861
|
//#region src/core/backendFill.ts
|
|
2799
|
-
async function
|
|
2862
|
+
async function xn(e, t, n, r) {
|
|
2800
2863
|
let i = await e.onStart(n);
|
|
2801
2864
|
if (r()) {
|
|
2802
2865
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2810,22 +2873,22 @@ async function yn(e, t, n, r) {
|
|
|
2810
2873
|
});
|
|
2811
2874
|
}
|
|
2812
2875
|
}
|
|
2813
|
-
function
|
|
2876
|
+
function Sn(e, t, n) {
|
|
2814
2877
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2815
2878
|
}
|
|
2816
|
-
function
|
|
2879
|
+
function Cn(e) {
|
|
2817
2880
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2818
2881
|
}
|
|
2819
|
-
function
|
|
2882
|
+
function wn(e, t) {
|
|
2820
2883
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2821
2884
|
let n = e.fill.target;
|
|
2822
2885
|
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;
|
|
2823
2886
|
}
|
|
2824
|
-
function
|
|
2887
|
+
function Tn(e, t, n) {
|
|
2825
2888
|
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));
|
|
2826
2889
|
}
|
|
2827
|
-
function
|
|
2828
|
-
return !
|
|
2890
|
+
function En(e, t, n, r) {
|
|
2891
|
+
return !Sn(e, t, n) || !Cn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !wn(t, n) ? !1 : (Tn(t, n, r), Object.assign(t.fill, {
|
|
2829
2892
|
...Q(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2830
2893
|
completedPages: n.completedPages,
|
|
2831
2894
|
error: n.error ?? null,
|
|
@@ -2834,41 +2897,42 @@ function wn(e, t, n, r) {
|
|
|
2834
2897
|
status: n.status
|
|
2835
2898
|
}), !0);
|
|
2836
2899
|
}
|
|
2837
|
-
function
|
|
2900
|
+
function Dn(e, t, n, r) {
|
|
2838
2901
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2839
2902
|
let i = t.fill;
|
|
2840
|
-
return t.fill =
|
|
2903
|
+
return t.fill = vn(e, n), !Cn(n) || !wn(t, n) ? (t.fill = i, !1) : (Tn(t, n, r), !0);
|
|
2841
2904
|
}
|
|
2842
2905
|
//#endregion
|
|
2843
2906
|
//#region src/core/fillController.ts
|
|
2844
|
-
var
|
|
2907
|
+
var On = class {
|
|
2845
2908
|
abortController = null;
|
|
2846
2909
|
cycle = 0;
|
|
2847
2910
|
delayCountdown;
|
|
2848
2911
|
requestVersion = 0;
|
|
2912
|
+
collection = null;
|
|
2849
2913
|
constructor(e) {
|
|
2850
|
-
this.options = e, this.delayCountdown = new
|
|
2914
|
+
this.options = e, this.delayCountdown = new Gt((e) => {
|
|
2851
2915
|
Object.assign(this.options.state.fill, e);
|
|
2852
2916
|
}), this.syncBackendCountdown();
|
|
2853
2917
|
}
|
|
2854
2918
|
isActive() {
|
|
2855
|
-
return
|
|
2919
|
+
return yn(this.options.state.fill);
|
|
2856
2920
|
}
|
|
2857
2921
|
applyUpdate(e) {
|
|
2858
|
-
let t =
|
|
2922
|
+
let t = En(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2859
2923
|
return t && this.syncBackendCountdown(), t;
|
|
2860
2924
|
}
|
|
2861
2925
|
restoreSession(e) {
|
|
2862
|
-
let t =
|
|
2926
|
+
let t = Dn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2863
2927
|
return t && this.syncBackendCountdown(), t;
|
|
2864
2928
|
}
|
|
2865
2929
|
async start(e) {
|
|
2866
2930
|
let t = this.options.fill;
|
|
2867
2931
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2868
2932
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2869
|
-
let n =
|
|
2933
|
+
let n = gn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2870
2934
|
if (this.options.state.fill = {
|
|
2871
|
-
...
|
|
2935
|
+
...vn(t, void 0, !1),
|
|
2872
2936
|
cycleId: r,
|
|
2873
2937
|
status: "filling",
|
|
2874
2938
|
target: n
|
|
@@ -2879,7 +2943,7 @@ var En = class {
|
|
|
2879
2943
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2880
2944
|
this.abortController = a;
|
|
2881
2945
|
try {
|
|
2882
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
2946
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await xn(t, this.options.state, {
|
|
2883
2947
|
cycleId: r,
|
|
2884
2948
|
feedKey: t.feedKey,
|
|
2885
2949
|
items: [...this.options.state.items],
|
|
@@ -2897,13 +2961,13 @@ var En = class {
|
|
|
2897
2961
|
}
|
|
2898
2962
|
async cancel() {
|
|
2899
2963
|
let { fill: e, state: t } = this.options;
|
|
2900
|
-
if (!
|
|
2964
|
+
if (!yn(t.fill) || !t.fill.cycleId) return;
|
|
2901
2965
|
let n = {
|
|
2902
2966
|
cycleId: t.fill.cycleId,
|
|
2903
2967
|
feedKey: t.fill.feedKey ?? "",
|
|
2904
2968
|
sessionId: t.fill.sessionId
|
|
2905
2969
|
};
|
|
2906
|
-
t.fill.status = "cancelling", this.delayCountdown.clear(), this.abortController?.abort(), this.requestVersion += 1, this.abortController = null, t.isLoadingMore = !1;
|
|
2970
|
+
t.fill.status = "cancelling", this.delayCountdown.clear(), this.abortController?.abort(), this.requestVersion += 1, this.abortController = null, t.isLoadingMore = !1, this.commitCollection();
|
|
2907
2971
|
try {
|
|
2908
2972
|
e?.strategy === "backend" && await e.onCancel(n), t.fill.error = null, t.fill.status = "cancelled";
|
|
2909
2973
|
} catch (e) {
|
|
@@ -2911,7 +2975,7 @@ var En = class {
|
|
|
2911
2975
|
}
|
|
2912
2976
|
}
|
|
2913
2977
|
reset() {
|
|
2914
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
2978
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = vn(this.options.fill, void 0, !1), this.collection = null;
|
|
2915
2979
|
}
|
|
2916
2980
|
destroy() {
|
|
2917
2981
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2927,10 +2991,13 @@ var En = class {
|
|
|
2927
2991
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2928
2992
|
let a = this.options.state;
|
|
2929
2993
|
a.isLoadingMore = !0;
|
|
2930
|
-
let o = await
|
|
2994
|
+
let o = await bn({
|
|
2931
2995
|
existingItems: a.items,
|
|
2932
2996
|
initialCursor: a.next,
|
|
2933
2997
|
loadPage: i,
|
|
2998
|
+
onCollection: (e) => {
|
|
2999
|
+
this.isCurrent(r) && (this.collection = e);
|
|
3000
|
+
},
|
|
2934
3001
|
onDelayChange: (e) => {
|
|
2935
3002
|
this.isCurrent(r) && Object.assign(a.fill, e);
|
|
2936
3003
|
},
|
|
@@ -2938,6 +3005,7 @@ var En = class {
|
|
|
2938
3005
|
this.isCurrent(r) && Object.assign(a.fill, e);
|
|
2939
3006
|
},
|
|
2940
3007
|
options: e,
|
|
3008
|
+
shouldPause: () => a.loadMoreLocked,
|
|
2941
3009
|
signal: n.signal,
|
|
2942
3010
|
target: t
|
|
2943
3011
|
});
|
|
@@ -2945,7 +3013,16 @@ var En = class {
|
|
|
2945
3013
|
completedPages: o.completedPages,
|
|
2946
3014
|
received: o.received,
|
|
2947
3015
|
status: o.status
|
|
2948
|
-
}));
|
|
3016
|
+
}), this.collection = null);
|
|
3017
|
+
}
|
|
3018
|
+
commitCollection() {
|
|
3019
|
+
let e = this.collection;
|
|
3020
|
+
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
3021
|
+
let t = this.options.state;
|
|
3022
|
+
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, {
|
|
3023
|
+
completedPages: e.completedPages,
|
|
3024
|
+
received: e.received
|
|
3025
|
+
});
|
|
2949
3026
|
}
|
|
2950
3027
|
syncBackendCountdown() {
|
|
2951
3028
|
let e = this.options.state.fill;
|
|
@@ -2954,7 +3031,7 @@ var En = class {
|
|
|
2954
3031
|
};
|
|
2955
3032
|
//#endregion
|
|
2956
3033
|
//#region src/core/feedFooter.ts
|
|
2957
|
-
function
|
|
3034
|
+
function kn(e) {
|
|
2958
3035
|
return {
|
|
2959
3036
|
cancelAutofill: () => e.cancelAutofill(),
|
|
2960
3037
|
loadMore: () => e.loadNext(),
|
|
@@ -2962,45 +3039,45 @@ function Dn(e) {
|
|
|
2962
3039
|
retryEnd: () => e.retryEnd()
|
|
2963
3040
|
};
|
|
2964
3041
|
}
|
|
2965
|
-
function
|
|
3042
|
+
function An(e) {
|
|
2966
3043
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
2967
3044
|
}
|
|
2968
|
-
function
|
|
2969
|
-
e?.intervalMs !== void 0 &&
|
|
3045
|
+
function jn(e) {
|
|
3046
|
+
e?.intervalMs !== void 0 && An(e.intervalMs);
|
|
2970
3047
|
}
|
|
2971
|
-
function
|
|
3048
|
+
function Mn(e) {
|
|
2972
3049
|
return {
|
|
2973
3050
|
enabled: e?.enabled ?? !1,
|
|
2974
3051
|
includePostItems: e?.includePostItems ?? !1,
|
|
2975
3052
|
intervalMs: e?.intervalMs ?? 5e3
|
|
2976
3053
|
};
|
|
2977
3054
|
}
|
|
2978
|
-
function
|
|
3055
|
+
function Nn(e, t) {
|
|
2979
3056
|
if (typeof t == "boolean") {
|
|
2980
3057
|
e.enabled = t;
|
|
2981
3058
|
return;
|
|
2982
3059
|
}
|
|
2983
|
-
|
|
3060
|
+
jn(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);
|
|
2984
3061
|
}
|
|
2985
3062
|
//#endregion
|
|
2986
3063
|
//#region src/core/reelInfoSheet.ts
|
|
2987
|
-
function
|
|
3064
|
+
function Pn(e) {
|
|
2988
3065
|
return { enabled: e?.enabled ?? !1 };
|
|
2989
3066
|
}
|
|
2990
|
-
function
|
|
3067
|
+
function Fn(e, t, n) {
|
|
2991
3068
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
2992
3069
|
e.enabled = n;
|
|
2993
3070
|
}
|
|
2994
3071
|
//#endregion
|
|
2995
3072
|
//#region src/core/initialRuntimeState.ts
|
|
2996
|
-
function
|
|
3073
|
+
function In(e, t) {
|
|
2997
3074
|
let n = e.initialPage;
|
|
2998
3075
|
return {
|
|
2999
3076
|
activeReelPostId: null,
|
|
3000
|
-
autoScroll:
|
|
3001
|
-
autofill:
|
|
3077
|
+
autoScroll: sn(e.autoScroll),
|
|
3078
|
+
autofill: Xt(e.autofill),
|
|
3002
3079
|
error: null,
|
|
3003
|
-
fill:
|
|
3080
|
+
fill: vn(e.fill),
|
|
3004
3081
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3005
3082
|
isLoading: !n,
|
|
3006
3083
|
isLoadingMore: !1,
|
|
@@ -3010,14 +3087,15 @@ function Pn(e, t) {
|
|
|
3010
3087
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
3011
3088
|
next: n?.next ?? null,
|
|
3012
3089
|
nextPageError: null,
|
|
3013
|
-
|
|
3090
|
+
phoneMode: !1,
|
|
3091
|
+
reelAutoAdvance: Mn(e.reelAutoAdvance),
|
|
3014
3092
|
reelForward: {
|
|
3015
3093
|
error: null,
|
|
3016
3094
|
status: "idle"
|
|
3017
3095
|
},
|
|
3018
3096
|
reelForwardIndex: null,
|
|
3019
3097
|
reelForwardItem: null,
|
|
3020
|
-
reelInfoSheet:
|
|
3098
|
+
reelInfoSheet: Pn(e.reelInfoSheet),
|
|
3021
3099
|
reelInfoSheetOverlay: !1,
|
|
3022
3100
|
reelMediaSource: "original",
|
|
3023
3101
|
reelOrigin: null,
|
|
@@ -3026,20 +3104,20 @@ function Pn(e, t) {
|
|
|
3026
3104
|
}
|
|
3027
3105
|
//#endregion
|
|
3028
3106
|
//#region src/core/options.ts
|
|
3029
|
-
function
|
|
3107
|
+
function Ln(e, t) {
|
|
3030
3108
|
if (t) {
|
|
3031
3109
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3032
3110
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3033
3111
|
}
|
|
3034
3112
|
}
|
|
3035
|
-
function
|
|
3113
|
+
function Rn(e, t) {
|
|
3036
3114
|
if (t) {
|
|
3037
3115
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3038
3116
|
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.`);
|
|
3039
3117
|
}
|
|
3040
3118
|
}
|
|
3041
|
-
function
|
|
3042
|
-
if (
|
|
3119
|
+
function zn(e) {
|
|
3120
|
+
if (on(e.autoScroll), Ln("cardHeader", e.cardHeader), Ln("cardFooter", e.cardFooter), Rn("header", e.mediaCard?.header), Rn("footer", e.mediaCard?.footer), Yt(e.autofill), _n(e.fill), jn(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3043
3121
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3044
3122
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3045
3123
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3053,7 +3131,7 @@ function Ln(e) {
|
|
|
3053
3131
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3054
3132
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3055
3133
|
}
|
|
3056
|
-
function
|
|
3134
|
+
function Bn(e) {
|
|
3057
3135
|
if (typeof e != "string") return e;
|
|
3058
3136
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3059
3137
|
let t = document.querySelector(e);
|
|
@@ -3062,14 +3140,23 @@ function Rn(e) {
|
|
|
3062
3140
|
}
|
|
3063
3141
|
//#endregion
|
|
3064
3142
|
//#region src/core/pageRequest.ts
|
|
3065
|
-
async function
|
|
3066
|
-
let u = s.autofill, d = u
|
|
3143
|
+
async function Vn({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3144
|
+
let u = s.autofill, d = e && u?.strategy === "frontend" && l.autofill.status === "paused", f = d ? {
|
|
3145
|
+
received: l.autofill.received,
|
|
3146
|
+
requests: l.autofill.requests
|
|
3147
|
+
} : null, p = u ? d ? l.autofill.cycleId : t.beginCycle() : null;
|
|
3148
|
+
d && Object.assign(l.autofill, {
|
|
3149
|
+
error: null,
|
|
3150
|
+
status: "filling"
|
|
3151
|
+
});
|
|
3152
|
+
let m = !1;
|
|
3067
3153
|
try {
|
|
3068
3154
|
if (u?.strategy === "frontend") {
|
|
3069
|
-
let s = await
|
|
3155
|
+
let s = await en({
|
|
3070
3156
|
existingItems: e ? l.items : [],
|
|
3071
3157
|
initialCursor: n,
|
|
3072
3158
|
loadPage: i,
|
|
3159
|
+
maximumRequests: f ? Math.max(0, Kt(u) - f.requests) : void 0,
|
|
3073
3160
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3074
3161
|
onDelayChange: (e) => {
|
|
3075
3162
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3078,6 +3165,9 @@ async function zn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3078
3165
|
r() && Object.assign(l.autofill, e, { status: "filling" });
|
|
3079
3166
|
},
|
|
3080
3167
|
options: u,
|
|
3168
|
+
receivedOffset: f?.received,
|
|
3169
|
+
requestOffset: f?.requests,
|
|
3170
|
+
shouldPause: () => l.loadMoreLocked,
|
|
3081
3171
|
signal: c
|
|
3082
3172
|
});
|
|
3083
3173
|
if (!r()) return;
|
|
@@ -3089,41 +3179,41 @@ async function zn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3089
3179
|
}), o(s.pages), t.clearCollection();
|
|
3090
3180
|
return;
|
|
3091
3181
|
}
|
|
3092
|
-
let s =
|
|
3182
|
+
let s = It(await i({
|
|
3093
3183
|
cursor: n,
|
|
3094
3184
|
signal: c
|
|
3095
3185
|
}));
|
|
3096
3186
|
if (!r()) return;
|
|
3097
|
-
let
|
|
3098
|
-
if (l.items =
|
|
3099
|
-
contributionIds:
|
|
3187
|
+
let d = e ? l.items : [], h = Z(d, s.items), g = h.length - d.length;
|
|
3188
|
+
if (l.items = h, a(n), o([{
|
|
3189
|
+
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
3100
3190
|
cursor: n,
|
|
3101
3191
|
next: s.next,
|
|
3102
3192
|
returnedIds: s.items.map(({ postId: e }) => e)
|
|
3103
|
-
}]), l.next = s.next, s.total !== void 0 && (l.total = s.total),
|
|
3193
|
+
}]), l.next = s.next, s.total !== void 0 && (l.total = s.total), m = !0, u?.strategy === "backend" && p) {
|
|
3104
3194
|
if (Object.assign(l.autofill, {
|
|
3105
|
-
missing: Math.max(0, u.pageSize -
|
|
3106
|
-
received:
|
|
3195
|
+
missing: Math.max(0, u.pageSize - g),
|
|
3196
|
+
received: g,
|
|
3107
3197
|
requests: 1
|
|
3108
|
-
}),
|
|
3198
|
+
}), g >= u.pageSize) {
|
|
3109
3199
|
l.autofill.status = "complete";
|
|
3110
3200
|
return;
|
|
3111
3201
|
}
|
|
3112
|
-
await
|
|
3113
|
-
cycleId:
|
|
3202
|
+
await ln(u, l, {
|
|
3203
|
+
cycleId: p,
|
|
3114
3204
|
feedKey: u.feedKey,
|
|
3115
|
-
items:
|
|
3116
|
-
missing: u.pageSize -
|
|
3205
|
+
items: h.slice(d.length),
|
|
3206
|
+
missing: u.pageSize - g,
|
|
3117
3207
|
next: s.next,
|
|
3118
3208
|
pageSize: u.pageSize,
|
|
3119
|
-
received:
|
|
3209
|
+
received: g,
|
|
3120
3210
|
signal: c,
|
|
3121
3211
|
total: l.total
|
|
3122
3212
|
}, r), t.syncCountdown();
|
|
3123
3213
|
}
|
|
3124
3214
|
} catch (t) {
|
|
3125
3215
|
if (c.aborted || !r()) return;
|
|
3126
|
-
u && (l.autofill.error = t, l.autofill.status = "error"),
|
|
3216
|
+
u && (l.autofill.error = t, l.autofill.status = "error"), m || (e ? l.nextPageError = t : l.error = t);
|
|
3127
3217
|
} finally {
|
|
3128
3218
|
r() && (t.clearCollection(), l.isLoading = !1, l.isLoadingMore = !1);
|
|
3129
3219
|
}
|
|
@@ -3133,18 +3223,19 @@ async function zn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3133
3223
|
function $(e) {
|
|
3134
3224
|
return `${typeof e}:${String(e)}`;
|
|
3135
3225
|
}
|
|
3136
|
-
function
|
|
3226
|
+
function Hn(e) {
|
|
3137
3227
|
return `${typeof e}:${String(e)}`;
|
|
3138
3228
|
}
|
|
3139
|
-
function
|
|
3229
|
+
function Un(e) {
|
|
3140
3230
|
return e.map(({ postId: e }) => e);
|
|
3141
3231
|
}
|
|
3142
|
-
var
|
|
3232
|
+
var Wn = class {
|
|
3143
3233
|
delay;
|
|
3144
3234
|
enabled;
|
|
3145
3235
|
maxReplayPages;
|
|
3146
3236
|
pageSize;
|
|
3147
3237
|
pages = [];
|
|
3238
|
+
pending = null;
|
|
3148
3239
|
tombstones = /* @__PURE__ */ new Set();
|
|
3149
3240
|
constructor(e) {
|
|
3150
3241
|
let t = e.removalReconciliation;
|
|
@@ -3154,13 +3245,16 @@ var Hn = class {
|
|
|
3154
3245
|
};
|
|
3155
3246
|
}
|
|
3156
3247
|
completeReconciliation(e) {
|
|
3157
|
-
this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages);
|
|
3248
|
+
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
3158
3249
|
}
|
|
3159
3250
|
filterItems(e) {
|
|
3160
3251
|
return !this.enabled || this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has($(e)));
|
|
3161
3252
|
}
|
|
3162
3253
|
needsReconciliation(e) {
|
|
3163
|
-
return this.findUnderfilledPage(e) >= 0;
|
|
3254
|
+
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
3255
|
+
}
|
|
3256
|
+
hasPendingSession() {
|
|
3257
|
+
return this.pending !== null;
|
|
3164
3258
|
}
|
|
3165
3259
|
recordPages(e) {
|
|
3166
3260
|
!this.enabled || e.length === 0 || (e.forEach((e) => this.recordPage(e)), this.pages = this.pages.slice(-this.maxReplayPages));
|
|
@@ -3169,45 +3263,65 @@ var Hn = class {
|
|
|
3169
3263
|
this.enabled && e.forEach((e) => this.tombstones.add($(e)));
|
|
3170
3264
|
}
|
|
3171
3265
|
reset() {
|
|
3172
|
-
this.pages = [], this.tombstones.clear();
|
|
3266
|
+
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
3173
3267
|
}
|
|
3174
3268
|
restore(e) {
|
|
3175
3269
|
this.enabled && e.forEach((e) => this.tombstones.delete($(e)));
|
|
3176
3270
|
}
|
|
3177
|
-
async reconcile({ existingItems: e, loadPage: t,
|
|
3178
|
-
let
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
p.add(r), await Ht({
|
|
3185
|
-
delayMs: Vt(e, this.delay),
|
|
3271
|
+
async reconcile({ existingItems: e, loadPage: t, shouldPause: n = () => !1, signal: r }) {
|
|
3272
|
+
let i = this.pending ?? this.createSession(e);
|
|
3273
|
+
for (this.pending = i; i.remainingRequests > 0;) {
|
|
3274
|
+
let e = Hn(i.cursor);
|
|
3275
|
+
if (i.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3276
|
+
if (await Wt({
|
|
3277
|
+
delayMs: Ut(i.pages.length, this.delay),
|
|
3186
3278
|
onChange: () => void 0,
|
|
3187
|
-
signal:
|
|
3188
|
-
});
|
|
3189
|
-
let
|
|
3190
|
-
cursor:
|
|
3191
|
-
signal:
|
|
3192
|
-
}))
|
|
3193
|
-
|
|
3279
|
+
signal: r
|
|
3280
|
+
}), i.pages.length > 0 && n()) return this.result(i, "paused");
|
|
3281
|
+
let a = It(await t({
|
|
3282
|
+
cursor: i.cursor,
|
|
3283
|
+
signal: r
|
|
3284
|
+
}));
|
|
3285
|
+
i.seenCursors.add(e);
|
|
3286
|
+
let o = this.filterItems(a.items), s = [];
|
|
3287
|
+
if (o.forEach((e) => {
|
|
3194
3288
|
let t = $(e.postId);
|
|
3195
|
-
|
|
3196
|
-
}),
|
|
3197
|
-
contributionIds:
|
|
3198
|
-
cursor:
|
|
3199
|
-
next:
|
|
3200
|
-
returnedIds:
|
|
3201
|
-
}),
|
|
3202
|
-
m = g;
|
|
3289
|
+
i.attributed.has(t) || (i.attributed.add(t), s.push(e.postId)), i.appended.has(t) || (i.appended.add(t), i.items.push(e));
|
|
3290
|
+
}), i.pages.push({
|
|
3291
|
+
contributionIds: s,
|
|
3292
|
+
cursor: i.cursor,
|
|
3293
|
+
next: a.next,
|
|
3294
|
+
returnedIds: Un(o)
|
|
3295
|
+
}), 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");
|
|
3203
3296
|
}
|
|
3297
|
+
return this.result(i, "complete");
|
|
3298
|
+
}
|
|
3299
|
+
createSession(e) {
|
|
3300
|
+
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
3301
|
+
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
3302
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map($))), a = new Set(e.map(({ postId: e }) => $(e)).filter((e) => !i.has(e)));
|
|
3204
3303
|
return {
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3304
|
+
appended: new Set(e.map(({ postId: e }) => $(e))),
|
|
3305
|
+
attributed: new Set(a),
|
|
3306
|
+
cursor: r.cursor,
|
|
3307
|
+
items: [],
|
|
3308
|
+
lastCursor: r.cursor,
|
|
3309
|
+
next: r.cursor,
|
|
3310
|
+
pages: [],
|
|
3311
|
+
remainingRequests: n.length,
|
|
3312
|
+
replaceFrom: t,
|
|
3313
|
+
seenCursors: /* @__PURE__ */ new Set()
|
|
3314
|
+
};
|
|
3315
|
+
}
|
|
3316
|
+
result(e, t) {
|
|
3317
|
+
return {
|
|
3318
|
+
items: [...e.items],
|
|
3319
|
+
lastCursor: e.lastCursor,
|
|
3320
|
+
next: e.next,
|
|
3321
|
+
pages: [...e.pages],
|
|
3322
|
+
replaceFrom: e.replaceFrom,
|
|
3323
|
+
status: t,
|
|
3324
|
+
total: e.total
|
|
3211
3325
|
};
|
|
3212
3326
|
}
|
|
3213
3327
|
findUnderfilledPage(e) {
|
|
@@ -3216,7 +3330,7 @@ var Hn = class {
|
|
|
3216
3330
|
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
|
|
3217
3331
|
}
|
|
3218
3332
|
recordPage(e) {
|
|
3219
|
-
let t =
|
|
3333
|
+
let t = Hn(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Hn(e) === t);
|
|
3220
3334
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3221
3335
|
...e,
|
|
3222
3336
|
contributionIds: [...e.contributionIds],
|
|
@@ -3226,7 +3340,7 @@ var Hn = class {
|
|
|
3226
3340
|
};
|
|
3227
3341
|
//#endregion
|
|
3228
3342
|
//#region src/core/activeItemRemoval.ts
|
|
3229
|
-
function
|
|
3343
|
+
function Gn(e, t, n, r, i) {
|
|
3230
3344
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3231
3345
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3232
3346
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3239,7 +3353,7 @@ function Un(e, t, n, r, i) {
|
|
|
3239
3353
|
}
|
|
3240
3354
|
//#endregion
|
|
3241
3355
|
//#region src/core/exactMediaRemovalController.ts
|
|
3242
|
-
function
|
|
3356
|
+
function Kn(e, t) {
|
|
3243
3357
|
let [n, ...r] = t;
|
|
3244
3358
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3245
3359
|
return {
|
|
@@ -3248,10 +3362,10 @@ function Wn(e, t) {
|
|
|
3248
3362
|
items: r
|
|
3249
3363
|
};
|
|
3250
3364
|
}
|
|
3251
|
-
function
|
|
3365
|
+
function qn(e) {
|
|
3252
3366
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3253
3367
|
}
|
|
3254
|
-
var
|
|
3368
|
+
var Jn = class {
|
|
3255
3369
|
generation = 0;
|
|
3256
3370
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3257
3371
|
state;
|
|
@@ -3259,7 +3373,7 @@ var Kn = class {
|
|
|
3259
3373
|
this.options = e, this.state = e.state;
|
|
3260
3374
|
}
|
|
3261
3375
|
remove(e) {
|
|
3262
|
-
|
|
3376
|
+
qn(e);
|
|
3263
3377
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3264
3378
|
if (!n) return null;
|
|
3265
3379
|
let r = [...M(n)], i = r[e.mediaIndex];
|
|
@@ -3276,7 +3390,7 @@ var Kn = class {
|
|
|
3276
3390
|
restored: !1
|
|
3277
3391
|
});
|
|
3278
3392
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3279
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3393
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Kn(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);
|
|
3280
3394
|
}
|
|
3281
3395
|
reset() {
|
|
3282
3396
|
this.generation += 1;
|
|
@@ -3302,7 +3416,7 @@ var Kn = class {
|
|
|
3302
3416
|
}
|
|
3303
3417
|
restoreIntoPost(e, t) {
|
|
3304
3418
|
let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3305
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3419
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Kn(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3306
3420
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3307
3421
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3308
3422
|
}
|
|
@@ -3315,18 +3429,18 @@ var Kn = class {
|
|
|
3315
3429
|
};
|
|
3316
3430
|
//#endregion
|
|
3317
3431
|
//#region src/core/itemPlacement.ts
|
|
3318
|
-
function
|
|
3432
|
+
function Yn(e, t) {
|
|
3319
3433
|
let n = new Set(t);
|
|
3320
3434
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3321
3435
|
index: t,
|
|
3322
3436
|
item: e
|
|
3323
3437
|
}] : []);
|
|
3324
3438
|
}
|
|
3325
|
-
function
|
|
3439
|
+
function Xn(e, t) {
|
|
3326
3440
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3327
3441
|
return e.filter((e) => !n.has(e.postId));
|
|
3328
3442
|
}
|
|
3329
|
-
function
|
|
3443
|
+
function Zn(e, t) {
|
|
3330
3444
|
t.forEach(({ index: e }) => {
|
|
3331
3445
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3332
3446
|
});
|
|
@@ -3337,7 +3451,7 @@ function Yn(e, t) {
|
|
|
3337
3451
|
}
|
|
3338
3452
|
//#endregion
|
|
3339
3453
|
//#region src/core/itemRemovalController.ts
|
|
3340
|
-
var
|
|
3454
|
+
var Qn = 20, $n = class {
|
|
3341
3455
|
generation = 0;
|
|
3342
3456
|
historyLimit;
|
|
3343
3457
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3346,7 +3460,7 @@ var Xn = 20, Zn = class {
|
|
|
3346
3460
|
itemOrder;
|
|
3347
3461
|
stopItemsWatcher;
|
|
3348
3462
|
constructor(e) {
|
|
3349
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3463
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Qn, 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" });
|
|
3350
3464
|
}
|
|
3351
3465
|
destroy() {
|
|
3352
3466
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3359,7 +3473,7 @@ var Xn = 20, Zn = class {
|
|
|
3359
3473
|
let i = this.options.startRemoval(r);
|
|
3360
3474
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
3361
3475
|
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);
|
|
3362
|
-
return this.state.items =
|
|
3476
|
+
return this.state.items = Xn(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
|
|
3363
3477
|
}
|
|
3364
3478
|
reset() {
|
|
3365
3479
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3370,7 +3484,7 @@ var Xn = 20, Zn = class {
|
|
|
3370
3484
|
this.restoreRemoval(t);
|
|
3371
3485
|
return;
|
|
3372
3486
|
}
|
|
3373
|
-
let n =
|
|
3487
|
+
let n = Zn(this.state.items, e);
|
|
3374
3488
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
3375
3489
|
}
|
|
3376
3490
|
restoreRemoval(e) {
|
|
@@ -3396,7 +3510,7 @@ var Xn = 20, Zn = class {
|
|
|
3396
3510
|
}
|
|
3397
3511
|
collectOrderedPlacements(e) {
|
|
3398
3512
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3399
|
-
return
|
|
3513
|
+
return Yn(this.state.items, e).map((e) => ({
|
|
3400
3514
|
index: t.get(e.item.postId) ?? e.index,
|
|
3401
3515
|
item: e.item
|
|
3402
3516
|
}));
|
|
@@ -3427,7 +3541,7 @@ var Xn = 20, Zn = class {
|
|
|
3427
3541
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3428
3542
|
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;
|
|
3429
3543
|
}
|
|
3430
|
-
},
|
|
3544
|
+
}, er = class {
|
|
3431
3545
|
forward = null;
|
|
3432
3546
|
forwardPromise = null;
|
|
3433
3547
|
forwardVersion = 0;
|
|
@@ -3505,7 +3619,7 @@ var Xn = 20, Zn = class {
|
|
|
3505
3619
|
}
|
|
3506
3620
|
}
|
|
3507
3621
|
}
|
|
3508
|
-
},
|
|
3622
|
+
}, tr = class {
|
|
3509
3623
|
generation = 0;
|
|
3510
3624
|
pending = Promise.resolve();
|
|
3511
3625
|
constructor(e) {
|
|
@@ -3555,24 +3669,24 @@ var Xn = 20, Zn = class {
|
|
|
3555
3669
|
};
|
|
3556
3670
|
//#endregion
|
|
3557
3671
|
//#region src/core/removalControllers.ts
|
|
3558
|
-
function
|
|
3559
|
-
let t = new
|
|
3672
|
+
function nr(e) {
|
|
3673
|
+
let t = new er(e), n = new tr({
|
|
3560
3674
|
state: e.state,
|
|
3561
3675
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3562
3676
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3563
3677
|
});
|
|
3564
3678
|
return {
|
|
3565
|
-
exactMediaRemoval: new
|
|
3679
|
+
exactMediaRemoval: new Jn({
|
|
3566
3680
|
onActivate: e.onActivate,
|
|
3567
3681
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
3568
3682
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
3569
3683
|
reelForward: t,
|
|
3570
3684
|
state: e.state
|
|
3571
3685
|
}),
|
|
3572
|
-
itemRemoval: new
|
|
3686
|
+
itemRemoval: new $n({
|
|
3573
3687
|
historyLimit: e.historyLimit,
|
|
3574
3688
|
onItemsRemoved: (n, r, i) => {
|
|
3575
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
3689
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Gn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3576
3690
|
},
|
|
3577
3691
|
onRemovalRestored: (n) => {
|
|
3578
3692
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -3587,17 +3701,17 @@ function er(e) {
|
|
|
3587
3701
|
reelRemoval: n
|
|
3588
3702
|
};
|
|
3589
3703
|
}
|
|
3590
|
-
var
|
|
3591
|
-
function
|
|
3704
|
+
var rr = 1.5;
|
|
3705
|
+
function ir(e) {
|
|
3592
3706
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3593
3707
|
if (t > 0 && t < 600) return !0;
|
|
3594
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3708
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * rr;
|
|
3595
3709
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3596
3710
|
}
|
|
3597
|
-
function
|
|
3598
|
-
return
|
|
3711
|
+
function ar(e) {
|
|
3712
|
+
return ir(e) ? "reel" : "masonry";
|
|
3599
3713
|
}
|
|
3600
|
-
function
|
|
3714
|
+
function or(e) {
|
|
3601
3715
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3602
3716
|
return {
|
|
3603
3717
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3607,15 +3721,15 @@ function ir(e) {
|
|
|
3607
3721
|
viewportWidth: n.clientWidth
|
|
3608
3722
|
};
|
|
3609
3723
|
}
|
|
3610
|
-
function
|
|
3611
|
-
return
|
|
3724
|
+
function sr(e) {
|
|
3725
|
+
return ir(or(e));
|
|
3612
3726
|
}
|
|
3613
|
-
function
|
|
3614
|
-
return
|
|
3727
|
+
function cr(e) {
|
|
3728
|
+
return ar(or(e));
|
|
3615
3729
|
}
|
|
3616
3730
|
//#endregion
|
|
3617
3731
|
//#region src/core/responsiveLayoutController.ts
|
|
3618
|
-
var
|
|
3732
|
+
var lr = class {
|
|
3619
3733
|
layoutMode;
|
|
3620
3734
|
resizeObserver = null;
|
|
3621
3735
|
target = null;
|
|
@@ -3640,10 +3754,10 @@ var sr = class {
|
|
|
3640
3754
|
}
|
|
3641
3755
|
handleResponsiveLayout = () => {
|
|
3642
3756
|
if (!this.target) return;
|
|
3643
|
-
let e =
|
|
3644
|
-
this.state.
|
|
3757
|
+
let e = cr(this.target);
|
|
3758
|
+
this.state.phoneMode = sr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3645
3759
|
};
|
|
3646
|
-
},
|
|
3760
|
+
}, ur = class {
|
|
3647
3761
|
routedReelPostId = null;
|
|
3648
3762
|
reelRouteIsActive = !1;
|
|
3649
3763
|
constructor(e, t) {
|
|
@@ -3670,7 +3784,7 @@ var sr = class {
|
|
|
3670
3784
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3671
3785
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3672
3786
|
}
|
|
3673
|
-
},
|
|
3787
|
+
}, dr = class {
|
|
3674
3788
|
app = null;
|
|
3675
3789
|
autoScroll;
|
|
3676
3790
|
autofillController;
|
|
@@ -3690,19 +3804,20 @@ var sr = class {
|
|
|
3690
3804
|
lastLoadedCursor = null;
|
|
3691
3805
|
state;
|
|
3692
3806
|
constructor(e) {
|
|
3693
|
-
this.options = e,
|
|
3807
|
+
this.options = e, zn(e);
|
|
3694
3808
|
let t = e.layout ?? "masonry";
|
|
3695
|
-
this.state = x(
|
|
3809
|
+
this.state = x(In(e, t)), this.autoScroll = new cn({
|
|
3696
3810
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3697
3811
|
state: this.state.autoScroll
|
|
3698
|
-
}), this.autofillController = new
|
|
3812
|
+
}), this.autofillController = new tn({
|
|
3699
3813
|
cancelRequest: () => this.cancelRequest(),
|
|
3700
3814
|
onLastCursor: (e) => {
|
|
3701
3815
|
this.lastLoadedCursor = e;
|
|
3702
3816
|
},
|
|
3817
|
+
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3703
3818
|
options: e.autofill,
|
|
3704
3819
|
state: this.state
|
|
3705
|
-
}), this.removalReconciliation = new
|
|
3820
|
+
}), this.removalReconciliation = new Wn(e), this.fillController = new On({
|
|
3706
3821
|
fill: e.fill,
|
|
3707
3822
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
3708
3823
|
onLastCursor: (e) => {
|
|
@@ -3710,8 +3825,8 @@ var sr = class {
|
|
|
3710
3825
|
},
|
|
3711
3826
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3712
3827
|
state: this.state
|
|
3713
|
-
}), this.routing = new
|
|
3714
|
-
let n =
|
|
3828
|
+
}), this.routing = new ur(e.routing, this.state);
|
|
3829
|
+
let n = nr({
|
|
3715
3830
|
historyLimit: e.removalHistoryLimit,
|
|
3716
3831
|
loadNext: () => this.loadNext(),
|
|
3717
3832
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
@@ -3721,22 +3836,23 @@ var sr = class {
|
|
|
3721
3836
|
state: this.state,
|
|
3722
3837
|
surface: () => this.surface
|
|
3723
3838
|
});
|
|
3724
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
3839
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new lr(t, this.state, () => {
|
|
3725
3840
|
this.routing.syncFeed();
|
|
3726
3841
|
}), this.startStateNotifications();
|
|
3727
3842
|
}
|
|
3728
3843
|
async mount() {
|
|
3729
3844
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3730
3845
|
this.startStateNotifications();
|
|
3731
|
-
let e =
|
|
3732
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
3846
|
+
let e = Bn(this.options.target);
|
|
3847
|
+
this.responsiveLayout.mount(e), this.app = i(Ft, {
|
|
3733
3848
|
canRetryEnd: !!this.options.loadPage,
|
|
3734
3849
|
cardFooter: this.options.cardFooter,
|
|
3735
3850
|
cardHeader: this.options.cardHeader,
|
|
3736
3851
|
feedFooter: this.options.feedFooter,
|
|
3737
|
-
feedFooterActions:
|
|
3852
|
+
feedFooterActions: kn(this),
|
|
3738
3853
|
mediaCard: this.options.mediaCard,
|
|
3739
3854
|
onMediaReady: this.options.onMediaReady,
|
|
3855
|
+
onMediaVisible: this.options.onMediaVisible,
|
|
3740
3856
|
onReelMediaChange: this.options.onReelMediaChange,
|
|
3741
3857
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
3742
3858
|
state: this.state,
|
|
@@ -3755,13 +3871,13 @@ var sr = class {
|
|
|
3755
3871
|
onRetryForward: () => {
|
|
3756
3872
|
this.retryReelForward();
|
|
3757
3873
|
}
|
|
3758
|
-
}), 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();
|
|
3874
|
+
}), 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();
|
|
3759
3875
|
}
|
|
3760
3876
|
destroy() {
|
|
3761
3877
|
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;
|
|
3762
3878
|
}
|
|
3763
3879
|
getState() {
|
|
3764
|
-
return
|
|
3880
|
+
return I(this.state);
|
|
3765
3881
|
}
|
|
3766
3882
|
removeMedia(e) {
|
|
3767
3883
|
return this.exactMediaRemoval.remove(e);
|
|
@@ -3815,12 +3931,23 @@ var sr = class {
|
|
|
3815
3931
|
this.autoScroll.setSpeed(e);
|
|
3816
3932
|
}
|
|
3817
3933
|
applyAutofillUpdate(e) {
|
|
3818
|
-
let t =
|
|
3934
|
+
let t = dn(this.options.autofill, this.state, e);
|
|
3819
3935
|
return t && this.autofillController.syncCountdown(), t;
|
|
3820
3936
|
}
|
|
3821
3937
|
cancelAutofill() {
|
|
3822
3938
|
return this.autofillController.cancel();
|
|
3823
3939
|
}
|
|
3940
|
+
async cancelLoading() {
|
|
3941
|
+
if (this.state.loadMoreLocked = !1, this.fillController.isActive()) {
|
|
3942
|
+
await this.cancelFill();
|
|
3943
|
+
return;
|
|
3944
|
+
}
|
|
3945
|
+
if (Zt(this.state.autofill)) {
|
|
3946
|
+
await this.cancelAutofill();
|
|
3947
|
+
return;
|
|
3948
|
+
}
|
|
3949
|
+
this.cancelRequest();
|
|
3950
|
+
}
|
|
3824
3951
|
applyFillUpdate(e) {
|
|
3825
3952
|
return this.fillController.applyUpdate(e);
|
|
3826
3953
|
}
|
|
@@ -3828,11 +3955,13 @@ var sr = class {
|
|
|
3828
3955
|
return this.fillController.cancel();
|
|
3829
3956
|
}
|
|
3830
3957
|
async fill(e) {
|
|
3831
|
-
if (this.
|
|
3832
|
-
|
|
3958
|
+
if (!this.state.loadMoreLocked) {
|
|
3959
|
+
if (this.pendingRequest || Zt(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
3960
|
+
await this.fillController.start(e);
|
|
3961
|
+
}
|
|
3833
3962
|
}
|
|
3834
3963
|
restoreAutofillSession(e) {
|
|
3835
|
-
let t =
|
|
3964
|
+
let t = fn(this.options.autofill, this.state, e);
|
|
3836
3965
|
return t && this.autofillController.syncCountdown(), t;
|
|
3837
3966
|
}
|
|
3838
3967
|
restoreFillSession(e) {
|
|
@@ -3840,7 +3969,7 @@ var sr = class {
|
|
|
3840
3969
|
}
|
|
3841
3970
|
async loadNext() {
|
|
3842
3971
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3843
|
-
if (this.state.loadMoreLocked ||
|
|
3972
|
+
if (this.state.loadMoreLocked || Zt(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
3844
3973
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
3845
3974
|
let e = this.loadNextSequence();
|
|
3846
3975
|
return this.pendingRequest = e, e.finally(() => {
|
|
@@ -3855,19 +3984,19 @@ var sr = class {
|
|
|
3855
3984
|
}
|
|
3856
3985
|
async replaceFeed(e, t) {
|
|
3857
3986
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
3858
|
-
return
|
|
3987
|
+
return Zt(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Xt(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);
|
|
3859
3988
|
}
|
|
3860
3989
|
async loadFilteredPage(e) {
|
|
3861
3990
|
let t = this.options.loadPage;
|
|
3862
3991
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
3863
|
-
let n =
|
|
3992
|
+
let n = It(await t(e));
|
|
3864
3993
|
return {
|
|
3865
3994
|
...n,
|
|
3866
3995
|
items: this.removalReconciliation.filterItems(n.items)
|
|
3867
3996
|
};
|
|
3868
3997
|
}
|
|
3869
3998
|
async loadNextSequence() {
|
|
3870
|
-
this.removalReconciliation.needsReconciliation(this.state.items) && !await this.reconcileBeforeNext() || this.state.next !== null && await this.fetchPage(this.state.next, !0);
|
|
3999
|
+
this.removalReconciliation.needsReconciliation(this.state.items) && !await this.reconcileBeforeNext() || this.state.loadMoreLocked || this.state.next !== null && await this.fetchPage(this.state.next, !0);
|
|
3871
4000
|
}
|
|
3872
4001
|
async reconcileBeforeNext() {
|
|
3873
4002
|
let e = this.options.loadPage;
|
|
@@ -3878,9 +4007,10 @@ var sr = class {
|
|
|
3878
4007
|
let r = await this.removalReconciliation.reconcile({
|
|
3879
4008
|
existingItems: this.state.items,
|
|
3880
4009
|
loadPage: e,
|
|
4010
|
+
shouldPause: () => this.state.loadMoreLocked,
|
|
3881
4011
|
signal: n.signal
|
|
3882
4012
|
});
|
|
3883
|
-
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),
|
|
4013
|
+
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;
|
|
3884
4014
|
} catch (e) {
|
|
3885
4015
|
return !n.signal.aborted && t === this.requestVersion && (this.state.nextPageError = e), !1;
|
|
3886
4016
|
} finally {
|
|
@@ -3889,19 +4019,38 @@ var sr = class {
|
|
|
3889
4019
|
}
|
|
3890
4020
|
async retryEnd() {
|
|
3891
4021
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3892
|
-
if (!this.state.loadMoreLocked && !(
|
|
4022
|
+
if (!this.state.loadMoreLocked && !(Zt(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);
|
|
3893
4023
|
}
|
|
3894
4024
|
setInfiniteScroll(e) {
|
|
3895
4025
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
3896
4026
|
}
|
|
3897
4027
|
setLoadMoreLocked(e) {
|
|
3898
|
-
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e
|
|
4028
|
+
if (this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e)) {
|
|
4029
|
+
let e = this.state.fill.status === "paused" ? this.state.fill.target : null;
|
|
4030
|
+
if (e) {
|
|
4031
|
+
let t = "pages" in e ? e.pages - this.state.fill.completedPages : null;
|
|
4032
|
+
if (t === null || t > 0) {
|
|
4033
|
+
this.fillController.start(t === null ? { until: "end" } : { pages: t });
|
|
4034
|
+
return;
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
if (this.state.autofill.status === "paused" || this.removalReconciliation.hasPendingSession()) {
|
|
4038
|
+
let e = this.pendingRequest;
|
|
4039
|
+
e ? e.finally(() => {
|
|
4040
|
+
this.loadNext();
|
|
4041
|
+
}) : this.loadNext();
|
|
4042
|
+
} else this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom());
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
setTotal(e) {
|
|
4046
|
+
if (e !== null && (!Number.isInteger(e) || e < 0)) throw TypeError("Vibe total must be a non-negative integer or null.");
|
|
4047
|
+
this.state.total = e;
|
|
3899
4048
|
}
|
|
3900
4049
|
setReelAutoAdvance(e) {
|
|
3901
|
-
|
|
4050
|
+
Nn(this.state.reelAutoAdvance, e);
|
|
3902
4051
|
}
|
|
3903
4052
|
setReelInfoSheet(e) {
|
|
3904
|
-
|
|
4053
|
+
Fn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
3905
4054
|
}
|
|
3906
4055
|
setLayout(e) {
|
|
3907
4056
|
this.responsiveLayout.setLayout(e);
|
|
@@ -3921,7 +4070,7 @@ var sr = class {
|
|
|
3921
4070
|
async fetchPage(e, t) {
|
|
3922
4071
|
if (!this.options.loadPage) return;
|
|
3923
4072
|
let n = ++this.requestVersion, r = new AbortController();
|
|
3924
|
-
this.abortController = r, await
|
|
4073
|
+
this.abortController = r, await Vn({
|
|
3925
4074
|
append: t,
|
|
3926
4075
|
autofillController: this.autofillController,
|
|
3927
4076
|
cursor: e,
|
|
@@ -3945,7 +4094,7 @@ var sr = class {
|
|
|
3945
4094
|
startInitialAutofill() {
|
|
3946
4095
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
3947
4096
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
3948
|
-
let r =
|
|
4097
|
+
let r = pn({
|
|
3949
4098
|
cycleId: n,
|
|
3950
4099
|
isCurrent: () => e === this.requestVersion,
|
|
3951
4100
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -3971,8 +4120,8 @@ var sr = class {
|
|
|
3971
4120
|
}));
|
|
3972
4121
|
}
|
|
3973
4122
|
};
|
|
3974
|
-
function
|
|
3975
|
-
return new
|
|
4123
|
+
function fr(e) {
|
|
4124
|
+
return new dr(e);
|
|
3976
4125
|
}
|
|
3977
4126
|
//#endregion
|
|
3978
|
-
export {
|
|
4127
|
+
export { fr as createVibe };
|