@wyxos/vibe 5.0.2 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/lib/components/ReelFeed.vue.d.ts +2 -0
- package/lib/components/ReelLayout.vue.d.ts +2 -0
- package/lib/components/VibeSurface.vue.d.ts +7 -1
- package/lib/components/useReelKeyboard.d.ts +12 -0
- package/lib/core/feed.d.ts +3 -1
- package/lib/core/mediaLifecycle.d.ts +4 -0
- package/lib/core/reelEscapeStack.d.ts +6 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +615 -517
- package/lib/types.d.ts +15 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -13,8 +13,39 @@ 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
|
|
16
47
|
//#region src/core/runtime.ts
|
|
17
|
-
function
|
|
48
|
+
function R(e) {
|
|
18
49
|
return {
|
|
19
50
|
activeReelPostId: e.activeReelPostId,
|
|
20
51
|
autoScroll: { ...e.autoScroll },
|
|
@@ -42,17 +73,17 @@ function I(e) {
|
|
|
42
73
|
}
|
|
43
74
|
//#endregion
|
|
44
75
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
45
|
-
var
|
|
76
|
+
var z = {
|
|
46
77
|
key: 0,
|
|
47
78
|
class: "gallery-footer"
|
|
48
|
-
},
|
|
79
|
+
}, B = {
|
|
49
80
|
key: 0,
|
|
50
81
|
class: "load-more-status",
|
|
51
82
|
role: "status"
|
|
52
|
-
},
|
|
83
|
+
}, V = ["disabled"], H = {
|
|
53
84
|
key: 2,
|
|
54
85
|
class: "end-feed"
|
|
55
|
-
},
|
|
86
|
+
}, ee = ["disabled"], te = /* @__PURE__ */ d({
|
|
56
87
|
__name: "GalleryFooter",
|
|
57
88
|
props: {
|
|
58
89
|
canRetryEnd: { type: Boolean },
|
|
@@ -68,14 +99,14 @@ var L = {
|
|
|
68
99
|
function i() {
|
|
69
100
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
70
101
|
}
|
|
71
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer",
|
|
102
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", z, [e.isLoading ? (b(), s("p", B, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
|
|
72
103
|
key: 1,
|
|
73
104
|
"data-test": "load-more",
|
|
74
105
|
class: "load-more-button",
|
|
75
106
|
type: "button",
|
|
76
107
|
disabled: e.loadMoreLocked,
|
|
77
108
|
onClick: i
|
|
78
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
109
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, V)) : (b(), s("div", H, [n[1] ||= c("p", {
|
|
79
110
|
class: "end-feed-message",
|
|
80
111
|
role: "status"
|
|
81
112
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -84,9 +115,9 @@ var L = {
|
|
|
84
115
|
type: "button",
|
|
85
116
|
disabled: e.loadMoreLocked,
|
|
86
117
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
87
|
-
}, " Check for more ", 8,
|
|
118
|
+
}, " Check for more ", 8, ee)]))])) : o("", !0);
|
|
88
119
|
}
|
|
89
|
-
}),
|
|
120
|
+
}), ne = /* @__PURE__ */ d({
|
|
90
121
|
__name: "FeedFooter",
|
|
91
122
|
props: {
|
|
92
123
|
actions: {},
|
|
@@ -123,7 +154,7 @@ var L = {
|
|
|
123
154
|
"can-retry-end",
|
|
124
155
|
"show-load-more",
|
|
125
156
|
"state"
|
|
126
|
-
])) : (b(), a(
|
|
157
|
+
])) : (b(), a(te, {
|
|
127
158
|
key: 1,
|
|
128
159
|
"can-retry-end": e.canRetryEnd,
|
|
129
160
|
"has-error": e.hasError,
|
|
@@ -142,7 +173,7 @@ var L = {
|
|
|
142
173
|
"show-load-more"
|
|
143
174
|
]));
|
|
144
175
|
}
|
|
145
|
-
}),
|
|
176
|
+
}), re = ["role"], ie = { class: "gallery-status" }, U = /* @__PURE__ */ d({
|
|
146
177
|
__name: "FeedStatus",
|
|
147
178
|
props: {
|
|
148
179
|
actions: {},
|
|
@@ -156,7 +187,7 @@ var L = {
|
|
|
156
187
|
return (n, u) => (b(), s("main", {
|
|
157
188
|
class: "gallery-shell",
|
|
158
189
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
159
|
-
}, [c("p",
|
|
190
|
+
}, [c("p", ie, [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(ne, {
|
|
160
191
|
key: 0,
|
|
161
192
|
actions: t.actions,
|
|
162
193
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -178,10 +209,10 @@ var L = {
|
|
|
178
209
|
"is-loading",
|
|
179
210
|
"load-more-locked",
|
|
180
211
|
"state"
|
|
181
|
-
])) : o("", !0)], 8,
|
|
212
|
+
])) : o("", !0)], 8, re));
|
|
182
213
|
}
|
|
183
214
|
});
|
|
184
|
-
function
|
|
215
|
+
function ae(e) {
|
|
185
216
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
186
217
|
}
|
|
187
218
|
//#endregion
|
|
@@ -190,24 +221,24 @@ function W(e) {
|
|
|
190
221
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
191
222
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
192
223
|
}
|
|
193
|
-
function
|
|
224
|
+
function oe(e) {
|
|
194
225
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
195
226
|
}
|
|
196
|
-
function
|
|
227
|
+
function se(e) {
|
|
197
228
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
198
229
|
}
|
|
199
|
-
function
|
|
230
|
+
function G(e, t) {
|
|
200
231
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
|
|
201
232
|
return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
|
|
202
233
|
}
|
|
203
|
-
function
|
|
234
|
+
function K(e, t, n) {
|
|
204
235
|
if (t <= 0 || e.length === 0) return {
|
|
205
236
|
columns: 0,
|
|
206
237
|
height: 0,
|
|
207
238
|
items: []
|
|
208
239
|
};
|
|
209
240
|
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) => {
|
|
210
|
-
let t =
|
|
241
|
+
let t = oe(c), n = s * W(e) + i, a = {
|
|
211
242
|
x: t * (s + r),
|
|
212
243
|
y: c[t],
|
|
213
244
|
width: s,
|
|
@@ -223,10 +254,10 @@ function q(e, t, n) {
|
|
|
223
254
|
}
|
|
224
255
|
//#endregion
|
|
225
256
|
//#region src/core/scrollbar.ts
|
|
226
|
-
function
|
|
257
|
+
function q(e, t, n) {
|
|
227
258
|
return Math.min(n, Math.max(t, e));
|
|
228
259
|
}
|
|
229
|
-
function
|
|
260
|
+
function ce({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
230
261
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
231
262
|
if (!(c > 0 && o > 0)) return {
|
|
232
263
|
maximumScrollPosition: c,
|
|
@@ -235,23 +266,23 @@ function ae({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
235
266
|
thumbSize: o,
|
|
236
267
|
thumbTravel: 0
|
|
237
268
|
};
|
|
238
|
-
let l =
|
|
269
|
+
let l = q(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
239
270
|
return {
|
|
240
271
|
maximumScrollPosition: c,
|
|
241
272
|
scrollable: !0,
|
|
242
|
-
thumbOffset: u * (
|
|
273
|
+
thumbOffset: u * (q(n, 0, c) / c),
|
|
243
274
|
thumbSize: l,
|
|
244
275
|
thumbTravel: u
|
|
245
276
|
};
|
|
246
277
|
}
|
|
247
278
|
//#endregion
|
|
248
279
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
249
|
-
var
|
|
280
|
+
var le = ["aria-hidden"], J = [
|
|
250
281
|
"aria-controls",
|
|
251
282
|
"aria-valuemax",
|
|
252
283
|
"aria-valuenow",
|
|
253
284
|
"tabindex"
|
|
254
|
-
],
|
|
285
|
+
], ue = 32, de = 40, Y = 120, fe = /* @__PURE__ */ d({
|
|
255
286
|
__name: "GalleryScrollbar",
|
|
256
287
|
props: {
|
|
257
288
|
contentSize: {},
|
|
@@ -273,16 +304,16 @@ var Y = ["aria-hidden"], oe = [
|
|
|
273
304
|
function k() {
|
|
274
305
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
275
306
|
g = null, o.value || (l.value = !1);
|
|
276
|
-
},
|
|
307
|
+
}, Y);
|
|
277
308
|
}
|
|
278
309
|
function A() {
|
|
279
310
|
l.value = !0, k();
|
|
280
311
|
}
|
|
281
312
|
function j() {
|
|
282
313
|
let e = t.scrollElement, r = i.value;
|
|
283
|
-
return !e || !r ? n :
|
|
314
|
+
return !e || !r ? n : ce({
|
|
284
315
|
contentSize: e.scrollHeight,
|
|
285
|
-
minimumThumbSize:
|
|
316
|
+
minimumThumbSize: ue,
|
|
286
317
|
scrollPosition: e.scrollTop,
|
|
287
318
|
trackSize: r.clientHeight,
|
|
288
319
|
viewportSize: e.clientHeight
|
|
@@ -335,7 +366,7 @@ var Y = ["aria-hidden"], oe = [
|
|
|
335
366
|
}
|
|
336
367
|
function z(e) {
|
|
337
368
|
if (!E.value) return;
|
|
338
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
369
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - de : e.key === "ArrowDown" ? r + de : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
339
370
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
340
371
|
}
|
|
341
372
|
function B(e) {
|
|
@@ -381,15 +412,15 @@ var Y = ["aria-hidden"], oe = [
|
|
|
381
412
|
onPointerdown: I,
|
|
382
413
|
onPointermove: L,
|
|
383
414
|
onPointerup: R
|
|
384
|
-
}, null, 44,
|
|
415
|
+
}, null, 44, J)], 42, le));
|
|
385
416
|
}
|
|
386
|
-
}),
|
|
417
|
+
}), X = (e) => {
|
|
387
418
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
388
419
|
return !1;
|
|
389
|
-
},
|
|
390
|
-
let t =
|
|
420
|
+
}, Z = (e) => e === "", pe = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), me = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), he = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ge = (e) => {
|
|
421
|
+
let t = he(e);
|
|
391
422
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
392
|
-
},
|
|
423
|
+
}, _e = {
|
|
393
424
|
xmlns: "http://www.w3.org/2000/svg",
|
|
394
425
|
width: 24,
|
|
395
426
|
height: 24,
|
|
@@ -399,27 +430,27 @@ var Y = ["aria-hidden"], oe = [
|
|
|
399
430
|
"stroke-width": 2,
|
|
400
431
|
"stroke-linecap": "round",
|
|
401
432
|
"stroke-linejoin": "round"
|
|
402
|
-
},
|
|
403
|
-
...
|
|
433
|
+
}, ve = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = _e.width, color: s = _e.stroke, ...c }, { slots: l }) => p("svg", {
|
|
434
|
+
..._e,
|
|
404
435
|
...c,
|
|
405
436
|
width: o,
|
|
406
437
|
height: o,
|
|
407
438
|
stroke: s,
|
|
408
|
-
"stroke-width":
|
|
409
|
-
class:
|
|
410
|
-
...!l.default && !
|
|
411
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
439
|
+
"stroke-width": Z(n) || Z(r) || n === !0 || r === !0 ? Number(i || a || _e["stroke-width"]) * 24 / Number(o) : i || a || _e["stroke-width"],
|
|
440
|
+
class: pe("lucide", c.class, ...e ? [`lucide-${me(ge(e))}-icon`, `lucide-${me(e)}`] : ["lucide-icon"]),
|
|
441
|
+
...!l.default && !X(c) && { "aria-hidden": "true" }
|
|
442
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), ye = (e, t) => (n, { slots: r, attrs: i }) => p(ve, {
|
|
412
443
|
...i,
|
|
413
444
|
...n,
|
|
414
445
|
iconNode: t,
|
|
415
446
|
name: e
|
|
416
|
-
}, r),
|
|
447
|
+
}, r), be = ye("chevron-left", [["path", {
|
|
417
448
|
d: "m15 18-6-6 6-6",
|
|
418
449
|
key: "1wnfg3"
|
|
419
|
-
}]]),
|
|
450
|
+
}]]), xe = ye("chevron-right", [["path", {
|
|
420
451
|
d: "m9 18 6-6-6-6",
|
|
421
452
|
key: "mthhwq"
|
|
422
|
-
}]]),
|
|
453
|
+
}]]), Se = ye("pause", [["rect", {
|
|
423
454
|
x: "14",
|
|
424
455
|
y: "3",
|
|
425
456
|
width: "5",
|
|
@@ -433,10 +464,10 @@ var Y = ["aria-hidden"], oe = [
|
|
|
433
464
|
height: "18",
|
|
434
465
|
rx: "1",
|
|
435
466
|
key: "1wsw3u"
|
|
436
|
-
}]]),
|
|
467
|
+
}]]), Ce = ye("play", [["path", {
|
|
437
468
|
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",
|
|
438
469
|
key: "10ikf1"
|
|
439
|
-
}]]),
|
|
470
|
+
}]]), we = ye("volume-2", [
|
|
440
471
|
["path", {
|
|
441
472
|
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",
|
|
442
473
|
key: "uqj9uw"
|
|
@@ -449,7 +480,7 @@ var Y = ["aria-hidden"], oe = [
|
|
|
449
480
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
450
481
|
key: "ijwkga"
|
|
451
482
|
}]
|
|
452
|
-
]),
|
|
483
|
+
]), Te = ye("volume-x", [
|
|
453
484
|
["path", {
|
|
454
485
|
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",
|
|
455
486
|
key: "uqj9uw"
|
|
@@ -468,32 +499,32 @@ var Y = ["aria-hidden"], oe = [
|
|
|
468
499
|
y2: "15",
|
|
469
500
|
key: "5ykzw1"
|
|
470
501
|
}]
|
|
471
|
-
]),
|
|
502
|
+
]), Ee = {
|
|
472
503
|
401: "Authentication required",
|
|
473
504
|
403: "Access forbidden",
|
|
474
505
|
404: "Preview not found",
|
|
475
506
|
419: "Session expired",
|
|
476
507
|
500: "Server error"
|
|
477
508
|
};
|
|
478
|
-
function
|
|
509
|
+
function De(e) {
|
|
479
510
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
480
511
|
}
|
|
481
|
-
function
|
|
482
|
-
return
|
|
512
|
+
function Oe(e) {
|
|
513
|
+
return Ee[De(e)] ?? "Preview unavailable";
|
|
483
514
|
}
|
|
484
515
|
//#endregion
|
|
485
516
|
//#region src/core/mediaType.ts
|
|
486
|
-
var
|
|
487
|
-
function
|
|
517
|
+
var ke = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
518
|
+
function Ae(e) {
|
|
488
519
|
try {
|
|
489
|
-
return
|
|
520
|
+
return ke.test(new URL(e).pathname);
|
|
490
521
|
} catch {
|
|
491
|
-
return
|
|
522
|
+
return ke.test(e.split("?")[0] ?? e);
|
|
492
523
|
}
|
|
493
524
|
}
|
|
494
525
|
//#endregion
|
|
495
526
|
//#region src/components/CardRegion.vue
|
|
496
|
-
var
|
|
527
|
+
var je = /* @__PURE__ */ d({
|
|
497
528
|
__name: "CardRegion",
|
|
498
529
|
props: {
|
|
499
530
|
index: {},
|
|
@@ -540,18 +571,18 @@ var ke = /* @__PURE__ */ d({
|
|
|
540
571
|
"total"
|
|
541
572
|
]))], 38));
|
|
542
573
|
}
|
|
543
|
-
}),
|
|
574
|
+
}), Me = [
|
|
544
575
|
"max",
|
|
545
576
|
"value",
|
|
546
577
|
"aria-valuetext",
|
|
547
578
|
"disabled"
|
|
548
|
-
],
|
|
579
|
+
], Ne = {
|
|
549
580
|
key: 0,
|
|
550
581
|
class: "media-controls-row"
|
|
551
|
-
},
|
|
582
|
+
}, Pe = ["aria-label", "title"], Fe = { class: "media-controls-audio" }, Ie = ["aria-label", "title"], Le = ["value", "aria-valuetext"], Re = {
|
|
552
583
|
class: "media-control-time",
|
|
553
584
|
"aria-live": "off"
|
|
554
|
-
},
|
|
585
|
+
}, ze = /* @__PURE__ */ d({
|
|
555
586
|
__name: "MediaControls",
|
|
556
587
|
props: {
|
|
557
588
|
currentTime: {},
|
|
@@ -599,35 +630,35 @@ var ke = /* @__PURE__ */ d({
|
|
|
599
630
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
600
631
|
disabled: f.value <= 0,
|
|
601
632
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
602
|
-
}, null, 44,
|
|
633
|
+
}, null, 44, Me), e.layout === "reel" ? (b(), s("div", Ne, [
|
|
603
634
|
c("button", {
|
|
604
635
|
type: "button",
|
|
605
636
|
class: "media-control-button media-control-playback",
|
|
606
637
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
607
638
|
title: e.playing ? "Pause" : "Play",
|
|
608
639
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
609
|
-
}, [e.playing ? (b(), a(E(
|
|
640
|
+
}, [e.playing ? (b(), a(E(Se), {
|
|
610
641
|
key: 0,
|
|
611
642
|
size: 18,
|
|
612
643
|
fill: "currentColor"
|
|
613
|
-
})) : (b(), a(E(
|
|
644
|
+
})) : (b(), a(E(Ce), {
|
|
614
645
|
key: 1,
|
|
615
646
|
size: 18,
|
|
616
647
|
fill: "currentColor"
|
|
617
|
-
}))], 8,
|
|
618
|
-
c("div",
|
|
648
|
+
}))], 8, Pe),
|
|
649
|
+
c("div", Fe, [c("button", {
|
|
619
650
|
type: "button",
|
|
620
651
|
class: "media-control-button",
|
|
621
652
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
622
653
|
title: e.muted ? "Unmute" : "Mute",
|
|
623
654
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
624
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
655
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(Te), {
|
|
625
656
|
key: 0,
|
|
626
657
|
size: 18
|
|
627
|
-
})) : (b(), a(E(
|
|
658
|
+
})) : (b(), a(E(we), {
|
|
628
659
|
key: 1,
|
|
629
660
|
size: 18
|
|
630
|
-
}))], 8,
|
|
661
|
+
}))], 8, Ie), c("input", {
|
|
631
662
|
class: "media-control-range media-control-volume",
|
|
632
663
|
type: "range",
|
|
633
664
|
min: "0",
|
|
@@ -638,14 +669,14 @@ var ke = /* @__PURE__ */ d({
|
|
|
638
669
|
"aria-label": "Video volume",
|
|
639
670
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
640
671
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
641
|
-
}, null, 44,
|
|
642
|
-
c("output",
|
|
672
|
+
}, null, 44, Le)]),
|
|
673
|
+
c("output", Re, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
643
674
|
])) : o("", !0)], 34));
|
|
644
675
|
}
|
|
645
676
|
});
|
|
646
677
|
//#endregion
|
|
647
678
|
//#region src/components/useReelVideoActivity.ts
|
|
648
|
-
function
|
|
679
|
+
function Be(e) {
|
|
649
680
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
650
681
|
function i() {
|
|
651
682
|
if (!t.value) {
|
|
@@ -679,7 +710,7 @@ function Re(e) {
|
|
|
679
710
|
}
|
|
680
711
|
//#endregion
|
|
681
712
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
682
|
-
var
|
|
713
|
+
var Ve = [
|
|
683
714
|
"data-post-id",
|
|
684
715
|
"data-media-index",
|
|
685
716
|
"aria-hidden",
|
|
@@ -687,12 +718,12 @@ var ze = [
|
|
|
687
718
|
"inert",
|
|
688
719
|
"role",
|
|
689
720
|
"tabindex"
|
|
690
|
-
],
|
|
721
|
+
], He = { class: "media-card-content" }, Ue = ["data-media-direction"], We = ["data-media-index"], Ge = {
|
|
691
722
|
key: 0,
|
|
692
723
|
"data-test": "media-loading",
|
|
693
724
|
class: "media-loading",
|
|
694
725
|
"aria-hidden": "true"
|
|
695
|
-
},
|
|
726
|
+
}, Ke = ["aria-label"], qe = { class: "media-error-code" }, Je = [
|
|
696
727
|
"src",
|
|
697
728
|
"width",
|
|
698
729
|
"height",
|
|
@@ -700,12 +731,12 @@ var ze = [
|
|
|
700
731
|
"loop",
|
|
701
732
|
"muted",
|
|
702
733
|
"preload"
|
|
703
|
-
],
|
|
734
|
+
], Ye = [
|
|
704
735
|
"src",
|
|
705
736
|
"width",
|
|
706
737
|
"height",
|
|
707
738
|
"fetchpriority"
|
|
708
|
-
],
|
|
739
|
+
], Xe = ["aria-label"], Ze = ["aria-label"], Qe = ["aria-label"], $e = 40, et = 160, tt = 24, nt = /* @__PURE__ */ d({
|
|
709
740
|
__name: "MediaCard",
|
|
710
741
|
props: {
|
|
711
742
|
active: { type: Boolean },
|
|
@@ -741,52 +772,52 @@ var ze = [
|
|
|
741
772
|
function S(e = !1, t = "pointer") {
|
|
742
773
|
e && x("activate", t);
|
|
743
774
|
}
|
|
744
|
-
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), ee = w(1), te = 1, { effectiveMuted: ne, onPlaying: re, playbackAllowed:
|
|
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), ee = w(1), te = 1, { effectiveMuted: ne, onPlaying: re, playbackAllowed: ie } = Be({
|
|
745
776
|
active: () => l.active,
|
|
746
777
|
layout: () => l.layout,
|
|
747
778
|
videoElement: R,
|
|
748
779
|
videoIsMuted: V,
|
|
749
780
|
videoIsPlaying: H
|
|
750
|
-
}),
|
|
751
|
-
function
|
|
781
|
+
}), U = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
782
|
+
function ae(e) {
|
|
752
783
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
753
784
|
}
|
|
754
|
-
function
|
|
785
|
+
function W(e, t) {
|
|
755
786
|
let n = C.value.length, r = (e + n) % n;
|
|
756
787
|
r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
757
788
|
}
|
|
758
|
-
function
|
|
789
|
+
function oe(e, t, n) {
|
|
759
790
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
760
791
|
}
|
|
761
|
-
function
|
|
792
|
+
function se() {
|
|
762
793
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
763
794
|
}
|
|
764
|
-
function
|
|
765
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
795
|
+
function G() {
|
|
796
|
+
d !== null && clearTimeout(d), d = setTimeout(se, et);
|
|
766
797
|
}
|
|
767
|
-
function
|
|
798
|
+
function K(e) {
|
|
768
799
|
if (C.value.length <= 1) return;
|
|
769
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
770
|
-
if (n === 0 || (e.preventDefault(),
|
|
800
|
+
let t = e.currentTarget?.clientWidth || 1, n = oe(e.deltaX, e.deltaMode, t);
|
|
801
|
+
if (n === 0 || (e.preventDefault(), G(), p) || (f += n, Math.abs(f) < tt)) return;
|
|
771
802
|
let r = Math.sign(f);
|
|
772
|
-
f = 0, p = !0,
|
|
803
|
+
f = 0, p = !0, W(D.value + r);
|
|
773
804
|
}
|
|
774
|
-
function
|
|
805
|
+
function q(e) {
|
|
775
806
|
let t = e.touches[0];
|
|
776
807
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
777
808
|
}
|
|
778
|
-
function
|
|
809
|
+
function ce(e) {
|
|
779
810
|
let t = e.changedTouches[0];
|
|
780
811
|
if (m === null || g === null || !t) return;
|
|
781
812
|
let n = m - t.clientX, r = g - t.clientY;
|
|
782
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
813
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < $e || W(D.value + Math.sign(n)));
|
|
783
814
|
}
|
|
784
|
-
let
|
|
785
|
-
function
|
|
786
|
-
l.layout === "reel" && (e.stopPropagation(),
|
|
815
|
+
let le = r(() => Ae(F.value)), J = r(() => l.layout === "reel" && l.stationaryReelControls === !0), ue = r(() => le.value && l.previewState === "ready" && (!J.value || !!(l.active && l.reelControlsTarget))), de = r(() => `${l.item.postId}:${D.value}:${F.value}`);
|
|
816
|
+
function Y(e) {
|
|
817
|
+
l.layout === "reel" && (e.stopPropagation(), fe());
|
|
787
818
|
}
|
|
788
|
-
async function
|
|
789
|
-
if (!(!R.value || !
|
|
819
|
+
async function fe() {
|
|
820
|
+
if (!(!R.value || !ie.value)) {
|
|
790
821
|
if (H.value) {
|
|
791
822
|
R.value.pause();
|
|
792
823
|
return;
|
|
@@ -798,12 +829,12 @@ var ze = [
|
|
|
798
829
|
}
|
|
799
830
|
}
|
|
800
831
|
}
|
|
801
|
-
function
|
|
832
|
+
function X(e) {
|
|
802
833
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
803
834
|
}
|
|
804
835
|
function Z(e) {
|
|
805
836
|
let t = e?.currentTarget ?? R.value;
|
|
806
|
-
t && (z.value =
|
|
837
|
+
t && (z.value = X(t.currentTime), B.value = X(t.duration), ie.value && (V.value = t.muted), ee.value = t.volume, t.volume > 0 && (te = t.volume));
|
|
807
838
|
}
|
|
808
839
|
function pe(e) {
|
|
809
840
|
Z(e), x("ready", D.value);
|
|
@@ -813,7 +844,7 @@ var ze = [
|
|
|
813
844
|
}
|
|
814
845
|
function he(e) {
|
|
815
846
|
let t = R.value;
|
|
816
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(
|
|
847
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(X(t.duration), Math.max(0, e)), z.value = t.currentTime);
|
|
817
848
|
}
|
|
818
849
|
function ge(e) {
|
|
819
850
|
let t = R.value;
|
|
@@ -826,7 +857,7 @@ var ze = [
|
|
|
826
857
|
e && (e.muted && e.volume === 0 && (e.volume = te), e.muted = !e.muted, Z());
|
|
827
858
|
}
|
|
828
859
|
return v(() => {
|
|
829
|
-
|
|
860
|
+
se();
|
|
830
861
|
}), (r, i) => (b(), s("article", {
|
|
831
862
|
"data-post-id": e.item.postId,
|
|
832
863
|
"data-media-index": D.value,
|
|
@@ -840,12 +871,12 @@ var ze = [
|
|
|
840
871
|
"aria-hidden": e.leaving || void 0,
|
|
841
872
|
"aria-busy": e.previewState === "loading",
|
|
842
873
|
inert: e.leaving || void 0,
|
|
843
|
-
role: e.interactive && !e.leaving && !
|
|
844
|
-
tabindex: e.interactive && !e.leaving && !
|
|
845
|
-
onClick: i[11] ||= (t) => S(e.interactive && !
|
|
846
|
-
onKeydown: [i[12] ||= A((t) => S(e.interactive && !
|
|
847
|
-
}, [c("div",
|
|
848
|
-
e.cardHeader ? (b(), a(
|
|
874
|
+
role: e.interactive && !e.leaving && !U.value ? "button" : void 0,
|
|
875
|
+
tabindex: e.interactive && !e.leaving && !U.value ? 0 : void 0,
|
|
876
|
+
onClick: i[11] ||= (t) => S(e.interactive && !U.value, ae(t)),
|
|
877
|
+
onKeydown: [i[12] ||= A((t) => S(e.interactive && !U.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !U.value, "keyboard"), ["prevent"]), ["space"])]
|
|
878
|
+
}, [c("div", He, [
|
|
879
|
+
e.cardHeader ? (b(), a(je, {
|
|
849
880
|
key: 0,
|
|
850
881
|
index: e.index,
|
|
851
882
|
item: e.item,
|
|
@@ -871,22 +902,22 @@ var ze = [
|
|
|
871
902
|
c("div", {
|
|
872
903
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
873
904
|
"data-media-direction": y.value,
|
|
874
|
-
onWheel:
|
|
875
|
-
onTouchstartPassive:
|
|
876
|
-
onTouchendPassive:
|
|
905
|
+
onWheel: K,
|
|
906
|
+
onTouchstartPassive: q,
|
|
907
|
+
onTouchendPassive: ce
|
|
877
908
|
}, [
|
|
878
909
|
u(n, { name: `media-slide-${y.value}` }, {
|
|
879
910
|
default: k(() => [(b(), s("div", {
|
|
880
911
|
key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
|
|
881
912
|
class: "media-card-frame",
|
|
882
913
|
"data-media-index": D.value
|
|
883
|
-
}, [e.previewState === "loading" ? (b(), s("div",
|
|
914
|
+
}, [e.previewState === "loading" ? (b(), s("div", Ge, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
|
|
884
915
|
key: 1,
|
|
885
916
|
"data-test": "media-error",
|
|
886
917
|
class: "media-error",
|
|
887
918
|
role: "img",
|
|
888
|
-
"aria-label": `${E(
|
|
889
|
-
}, [c("strong",
|
|
919
|
+
"aria-label": `${E(De)(F.value)} ${E(Oe)(F.value)}`
|
|
920
|
+
}, [c("strong", qe, T(E(De)(F.value)), 1), c("span", null, T(E(Oe)(F.value)), 1)], 8, Ke)) : o("", !0), le.value ? (b(), s("video", {
|
|
890
921
|
key: 2,
|
|
891
922
|
ref_key: "videoElement",
|
|
892
923
|
ref: R,
|
|
@@ -897,7 +928,7 @@ var ze = [
|
|
|
897
928
|
src: F.value,
|
|
898
929
|
width: I.value ?? void 0,
|
|
899
930
|
height: L.value ?? void 0,
|
|
900
|
-
autoplay: E(
|
|
931
|
+
autoplay: E(ie),
|
|
901
932
|
loop: !e.advanceOnMediaEnd,
|
|
902
933
|
muted: E(ne),
|
|
903
934
|
playsinline: "",
|
|
@@ -909,9 +940,9 @@ var ze = [
|
|
|
909
940
|
onPlaying: i[0] ||= (...e) => E(re) && E(re)(...e),
|
|
910
941
|
onPause: i[1] ||= (e) => H.value = !1,
|
|
911
942
|
onEnded: me,
|
|
912
|
-
onClick:
|
|
943
|
+
onClick: Y,
|
|
913
944
|
onError: i[2] ||= (e) => r.$emit("error", D.value)
|
|
914
|
-
}, null, 42,
|
|
945
|
+
}, null, 42, Je)) : (b(), s("img", {
|
|
915
946
|
key: 3,
|
|
916
947
|
class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
|
|
917
948
|
src: F.value,
|
|
@@ -923,20 +954,20 @@ var ze = [
|
|
|
923
954
|
loading: "eager",
|
|
924
955
|
onLoad: i[3] ||= (e) => r.$emit("ready", D.value),
|
|
925
956
|
onError: i[4] ||= (e) => r.$emit("error", D.value)
|
|
926
|
-
}, null, 42,
|
|
957
|
+
}, null, 42, Ye))], 8, We))]),
|
|
927
958
|
_: 1
|
|
928
959
|
}, 8, ["name"]),
|
|
929
960
|
(b(), a(t, {
|
|
930
|
-
disabled: !
|
|
961
|
+
disabled: !J.value || !e.reelControlsTarget,
|
|
931
962
|
to: e.reelControlsTarget ?? "body"
|
|
932
963
|
}, [u(n, {
|
|
933
964
|
name: "vibe-reel-media-controls",
|
|
934
|
-
css:
|
|
965
|
+
css: J.value
|
|
935
966
|
}, {
|
|
936
|
-
default: k(() => [
|
|
937
|
-
key:
|
|
967
|
+
default: k(() => [ue.value ? (b(), a(ze, {
|
|
968
|
+
key: de.value,
|
|
938
969
|
"current-time": z.value,
|
|
939
|
-
"data-control-post-id":
|
|
970
|
+
"data-control-post-id": J.value ? e.item.postId : void 0,
|
|
940
971
|
duration: B.value,
|
|
941
972
|
layout: e.layout,
|
|
942
973
|
muted: V.value,
|
|
@@ -944,7 +975,7 @@ var ze = [
|
|
|
944
975
|
volume: ee.value,
|
|
945
976
|
onSeek: he,
|
|
946
977
|
onToggleMute: _e,
|
|
947
|
-
onTogglePlayback:
|
|
978
|
+
onTogglePlayback: fe,
|
|
948
979
|
onVolumeChange: ge
|
|
949
980
|
}, null, 8, [
|
|
950
981
|
"current-time",
|
|
@@ -965,25 +996,25 @@ var ze = [
|
|
|
965
996
|
type: "button",
|
|
966
997
|
class: "media-carousel-control media-carousel-control--previous",
|
|
967
998
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
968
|
-
onClick: i[5] ||= j((e) =>
|
|
999
|
+
onClick: i[5] ||= j((e) => W(D.value - 1, e), ["stop"]),
|
|
969
1000
|
onKeydown: i[6] ||= j(() => {}, ["stop"])
|
|
970
|
-
}, [u(E(
|
|
1001
|
+
}, [u(E(be), { size: 20 })], 40, Xe), c("button", {
|
|
971
1002
|
type: "button",
|
|
972
1003
|
class: "media-carousel-control media-carousel-control--next",
|
|
973
1004
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
974
|
-
onClick: i[7] ||= j((e) =>
|
|
1005
|
+
onClick: i[7] ||= j((e) => W(D.value + 1, e), ["stop"]),
|
|
975
1006
|
onKeydown: i[8] ||= j(() => {}, ["stop"])
|
|
976
|
-
}, [u(E(
|
|
977
|
-
|
|
1007
|
+
}, [u(E(xe), { size: 20 })], 40, Ze)], 2)) : o("", !0),
|
|
1008
|
+
U.value ? (b(), s("button", {
|
|
978
1009
|
key: 1,
|
|
979
1010
|
class: "media-card-activator",
|
|
980
1011
|
type: "button",
|
|
981
1012
|
"aria-label": `Open post ${e.item.postId}`,
|
|
982
|
-
onClick: i[9] ||= j((e) => r.$emit("activate",
|
|
1013
|
+
onClick: i[9] ||= j((e) => r.$emit("activate", ae(e)), ["stop"]),
|
|
983
1014
|
onKeydown: i[10] ||= j(() => {}, ["stop"])
|
|
984
|
-
}, null, 40,
|
|
985
|
-
], 42,
|
|
986
|
-
e.cardFooter ? (b(), a(
|
|
1015
|
+
}, null, 40, Qe)) : o("", !0)
|
|
1016
|
+
], 42, Ue),
|
|
1017
|
+
e.cardFooter ? (b(), a(je, {
|
|
987
1018
|
key: 1,
|
|
988
1019
|
index: e.index,
|
|
989
1020
|
item: e.item,
|
|
@@ -1006,9 +1037,9 @@ var ze = [
|
|
|
1006
1037
|
"style",
|
|
1007
1038
|
"total"
|
|
1008
1039
|
])) : o("", !0)
|
|
1009
|
-
])], 46,
|
|
1040
|
+
])], 46, Ve));
|
|
1010
1041
|
}
|
|
1011
|
-
}),
|
|
1042
|
+
}), rt = { class: "masonry-feed-shell" }, it = ["aria-hidden", "inert"], at = 240, ot = 6, st = 12, ct = 800, lt = 1.5, ut = /* @__PURE__ */ d({
|
|
1012
1043
|
__name: "MasonryFeed",
|
|
1013
1044
|
props: {
|
|
1014
1045
|
enteringPostIds: {},
|
|
@@ -1042,36 +1073,36 @@ var ze = [
|
|
|
1042
1073
|
"retryEnd"
|
|
1043
1074
|
],
|
|
1044
1075
|
setup(t, { expose: n, emit: i }) {
|
|
1045
|
-
let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(
|
|
1076
|
+
let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(ot), y = w(0), x = w(0), C = w(0), T = null, k = null, A = null, j = r(() => K(o.items, m.value, {
|
|
1046
1077
|
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1047
1078
|
gap: g.value,
|
|
1048
|
-
minColumnWidth:
|
|
1079
|
+
minColumnWidth: at
|
|
1049
1080
|
})), M = r(() => {
|
|
1050
1081
|
let e = j.value;
|
|
1051
1082
|
if (o.leavingPostIds.size === 0) return e;
|
|
1052
|
-
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n =
|
|
1083
|
+
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n = K(t, m.value, {
|
|
1053
1084
|
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1054
1085
|
gap: g.value,
|
|
1055
|
-
minColumnWidth:
|
|
1086
|
+
minColumnWidth: at
|
|
1056
1087
|
}), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
|
|
1057
1088
|
return {
|
|
1058
1089
|
...n,
|
|
1059
1090
|
items: o.items.map((t, n) => o.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
|
|
1060
1091
|
};
|
|
1061
1092
|
}), N = r(() => ({ height: `${o.leavingPostIds.size === 0 ? M.value.height : j.value.height}px` })), P = r(() => !o.infiniteScroll || x.value > 0 && C.value + M.value.height <= x.value + 1), I = r(() => {
|
|
1062
|
-
let e = Math.max(
|
|
1093
|
+
let e = Math.max(ct, x.value * lt), t = {
|
|
1063
1094
|
scrollTop: y.value - C.value,
|
|
1064
1095
|
viewportHeight: x.value
|
|
1065
|
-
}, n =
|
|
1096
|
+
}, n = G(M.value.items, {
|
|
1066
1097
|
...t,
|
|
1067
1098
|
overscan: e
|
|
1068
|
-
}), r = o.leavingPostIds.size === 0 ? [] :
|
|
1099
|
+
}), r = o.leavingPostIds.size === 0 ? [] : G(j.value.items, {
|
|
1069
1100
|
...t,
|
|
1070
1101
|
overscan: e
|
|
1071
|
-
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a =
|
|
1102
|
+
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a = G(M.value.items, {
|
|
1072
1103
|
...t,
|
|
1073
1104
|
overscan: 0
|
|
1074
|
-
}), s = o.leavingPostIds.size === 0 ? [] :
|
|
1105
|
+
}), s = o.leavingPostIds.size === 0 ? [] : G(j.value.items, {
|
|
1075
1106
|
...t,
|
|
1076
1107
|
overscan: 0
|
|
1077
1108
|
}), c = new Set([...a, ...s]);
|
|
@@ -1087,7 +1118,7 @@ var ze = [
|
|
|
1087
1118
|
function L(e) {
|
|
1088
1119
|
let t = M.value.items[e], n = o.items[e]?.postId;
|
|
1089
1120
|
if (!t) return {};
|
|
1090
|
-
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ?
|
|
1121
|
+
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ? se({
|
|
1091
1122
|
containerHeight: j.value.height,
|
|
1092
1123
|
gap: g.value
|
|
1093
1124
|
}) : 0, s = n === void 0 ? 0 : i ? o.removalDelays.get(n) ?? 0 : r ? o.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -1107,15 +1138,15 @@ var ze = [
|
|
|
1107
1138
|
}
|
|
1108
1139
|
function z(e) {
|
|
1109
1140
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1110
|
-
m.value = e.clientWidth, g.value = Math.min(
|
|
1141
|
+
m.value = e.clientWidth, g.value = Math.min(st, Math.max(ot, t * .0075)), R();
|
|
1111
1142
|
}
|
|
1112
1143
|
function B(e) {
|
|
1113
1144
|
let t = e.currentTarget;
|
|
1114
|
-
t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll &&
|
|
1145
|
+
t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll && ae(t) && l("loadMore"));
|
|
1115
1146
|
}
|
|
1116
1147
|
function V() {
|
|
1117
1148
|
let e = d.value;
|
|
1118
|
-
!o.loadMoreLocked && e &&
|
|
1149
|
+
!o.loadMoreLocked && e && ae(e) && l("loadMore");
|
|
1119
1150
|
}
|
|
1120
1151
|
function H() {
|
|
1121
1152
|
return d.value;
|
|
@@ -1134,7 +1165,7 @@ var ze = [
|
|
|
1134
1165
|
}), n({
|
|
1135
1166
|
getScrollElement: H,
|
|
1136
1167
|
loadIfNearBottom: V
|
|
1137
|
-
}), (n, r) => (b(), s("div",
|
|
1168
|
+
}), (n, r) => (b(), s("div", rt, [c("main", {
|
|
1138
1169
|
id: f,
|
|
1139
1170
|
ref_key: "galleryElement",
|
|
1140
1171
|
ref: d,
|
|
@@ -1149,7 +1180,7 @@ var ze = [
|
|
|
1149
1180
|
class: h(["masonry", { "masonry--ready": m.value > 0 }]),
|
|
1150
1181
|
style: _(N.value),
|
|
1151
1182
|
"aria-label": "Media gallery"
|
|
1152
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1183
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(nt, {
|
|
1153
1184
|
key: n.postId,
|
|
1154
1185
|
class: "masonry-item",
|
|
1155
1186
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1189,7 +1220,7 @@ var ze = [
|
|
|
1189
1220
|
"onMediaChange",
|
|
1190
1221
|
"onReady",
|
|
1191
1222
|
"onError"
|
|
1192
|
-
]))), 128))], 6), u(
|
|
1223
|
+
]))), 128))], 6), u(ne, {
|
|
1193
1224
|
actions: t.feedFooterActions,
|
|
1194
1225
|
"can-retry-end": t.canRetryEnd,
|
|
1195
1226
|
"feed-footer": t.feedFooter,
|
|
@@ -1211,7 +1242,7 @@ var ze = [
|
|
|
1211
1242
|
"load-more-locked",
|
|
1212
1243
|
"show-load-more",
|
|
1213
1244
|
"state"
|
|
1214
|
-
])], 42,
|
|
1245
|
+
])], 42, it), u(fe, {
|
|
1215
1246
|
"content-size": M.value.height,
|
|
1216
1247
|
"controls-id": f,
|
|
1217
1248
|
"scroll-element": d.value,
|
|
@@ -1222,8 +1253,8 @@ var ze = [
|
|
|
1222
1253
|
"suspended"
|
|
1223
1254
|
])]));
|
|
1224
1255
|
}
|
|
1225
|
-
}),
|
|
1226
|
-
function
|
|
1256
|
+
}), dt = 300;
|
|
1257
|
+
function ft(e, t, n) {
|
|
1227
1258
|
let r = e.scrollTop;
|
|
1228
1259
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1229
1260
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1231,7 +1262,7 @@ function ut(e, t, n) {
|
|
|
1231
1262
|
return new Promise((n) => {
|
|
1232
1263
|
let o = (s) => {
|
|
1233
1264
|
a += 1;
|
|
1234
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1265
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / dt), u = 1 - (1 - l) ** 3;
|
|
1235
1266
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1236
1267
|
requestAnimationFrame(o);
|
|
1237
1268
|
return;
|
|
@@ -1243,7 +1274,7 @@ function ut(e, t, n) {
|
|
|
1243
1274
|
}
|
|
1244
1275
|
//#endregion
|
|
1245
1276
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1246
|
-
var
|
|
1277
|
+
var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
1247
1278
|
__name: "ReelAutoAdvanceProgress",
|
|
1248
1279
|
props: {
|
|
1249
1280
|
durationMs: {},
|
|
@@ -1261,9 +1292,9 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1261
1292
|
class: "reel-auto-advance-progress",
|
|
1262
1293
|
style: _(a.value),
|
|
1263
1294
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1264
|
-
}, null, 36)], 8,
|
|
1295
|
+
}, null, 36)], 8, pt));
|
|
1265
1296
|
}
|
|
1266
|
-
}),
|
|
1297
|
+
}), ht = { class: "reel-viewport" }, gt = ["data-active-post-id", "data-active-media-index"], _t = ["role", "data-status"], vt = 2, yt = 300, bt = /* @__PURE__ */ d({
|
|
1267
1298
|
__name: "ReelFeed",
|
|
1268
1299
|
props: {
|
|
1269
1300
|
initialPostId: {},
|
|
@@ -1301,7 +1332,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1301
1332
|
],
|
|
1302
1333
|
setup(t, { expose: n, emit: i }) {
|
|
1303
1334
|
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(() => {
|
|
1304
|
-
let e = Math.max(0, g.value -
|
|
1335
|
+
let e = Math.max(0, g.value - vt), t = Math.min(l.items.length - 1, g.value + vt);
|
|
1305
1336
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1306
1337
|
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1307
1338
|
index: e + n,
|
|
@@ -1318,7 +1349,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1318
1349
|
if (!e) return "";
|
|
1319
1350
|
let t = P(e, z.value);
|
|
1320
1351
|
return l.mediaSource === "original" ? t.src : t.preview.src;
|
|
1321
|
-
}), H = r(() => B.value === "ready" &&
|
|
1352
|
+
}), H = r(() => B.value === "ready" && Ae(V.value)), ee = r(() => [
|
|
1322
1353
|
L.value,
|
|
1323
1354
|
z.value,
|
|
1324
1355
|
l.items.length,
|
|
@@ -1326,49 +1357,49 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1326
1357
|
l.reelAutoAdvance.enabled,
|
|
1327
1358
|
l.reelAutoAdvance.includePostItems,
|
|
1328
1359
|
l.reelAutoAdvance.intervalMs
|
|
1329
|
-
].join(":")),
|
|
1360
|
+
].join(":")), te = r(() => {
|
|
1330
1361
|
let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1331
1362
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1332
|
-
}), re = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value),
|
|
1333
|
-
function
|
|
1363
|
+
}), re = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value), ie = r(() => !l.infiniteScroll || l.items.length <= 1), U = 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.");
|
|
1364
|
+
function W(e) {
|
|
1334
1365
|
return { gridRow: `${e + 1}` };
|
|
1335
1366
|
}
|
|
1336
|
-
function
|
|
1367
|
+
function oe(e) {
|
|
1337
1368
|
let t = D || e.clientHeight;
|
|
1338
1369
|
return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1339
1370
|
}
|
|
1340
|
-
function
|
|
1371
|
+
function se(e) {
|
|
1341
1372
|
let t = e.currentTarget;
|
|
1342
1373
|
if (!t) return;
|
|
1343
1374
|
let n = D || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
|
|
1344
|
-
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value =
|
|
1375
|
+
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = oe(t)), !l.loadMoreLocked && l.infiniteScroll && ae(t) && u("loadMore");
|
|
1345
1376
|
}
|
|
1346
|
-
function
|
|
1377
|
+
function G() {
|
|
1347
1378
|
let e = d.value;
|
|
1348
|
-
e && (x.value = !1,
|
|
1379
|
+
e && (x.value = !1, ce(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
|
|
1349
1380
|
e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
|
|
1350
|
-
}),
|
|
1381
|
+
}), K());
|
|
1351
1382
|
}
|
|
1352
|
-
function
|
|
1383
|
+
function K() {
|
|
1353
1384
|
j !== null && clearTimeout(j), j = setTimeout(() => {
|
|
1354
1385
|
j = null;
|
|
1355
1386
|
let e = d.value;
|
|
1356
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1387
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), ce(!1);
|
|
1357
1388
|
}, 120);
|
|
1358
1389
|
}
|
|
1359
|
-
function
|
|
1360
|
-
|
|
1390
|
+
function q() {
|
|
1391
|
+
ce(!0);
|
|
1361
1392
|
let e = d.value;
|
|
1362
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1393
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), K();
|
|
1363
1394
|
}
|
|
1364
|
-
function
|
|
1395
|
+
function ce(e) {
|
|
1365
1396
|
C.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1366
1397
|
}
|
|
1367
|
-
function
|
|
1398
|
+
function le() {
|
|
1368
1399
|
let e = d.value;
|
|
1369
|
-
!l.loadMoreLocked && e &&
|
|
1400
|
+
!l.loadMoreLocked && e && ae(e) && u("loadMore");
|
|
1370
1401
|
}
|
|
1371
|
-
function
|
|
1402
|
+
function J(e) {
|
|
1372
1403
|
let t = R.value;
|
|
1373
1404
|
if (!t) return !1;
|
|
1374
1405
|
let n = M(t).length;
|
|
@@ -1376,30 +1407,34 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1376
1407
|
let r = (z.value + e + n) % n;
|
|
1377
1408
|
return u("mediaChange", t.postId, r), !0;
|
|
1378
1409
|
}
|
|
1379
|
-
function
|
|
1410
|
+
function ue(e) {
|
|
1380
1411
|
let t = g.value + e;
|
|
1381
|
-
return !d.value || t < 0 || t >= l.items.length ? !1 : (
|
|
1412
|
+
return !d.value || t < 0 || t >= l.items.length ? !1 : (X(t), !0);
|
|
1382
1413
|
}
|
|
1383
|
-
function
|
|
1414
|
+
function de(e, t) {
|
|
1415
|
+
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 && X(n), !0);
|
|
1417
|
+
}
|
|
1418
|
+
function Y() {
|
|
1384
1419
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1385
1420
|
}
|
|
1386
|
-
function
|
|
1421
|
+
function fe(e) {
|
|
1387
1422
|
let t = d.value;
|
|
1388
1423
|
if (!t) return Promise.resolve();
|
|
1389
1424
|
let n = e * (D || t.clientHeight);
|
|
1390
|
-
return g.value = e,
|
|
1425
|
+
return g.value = e, ft(t, n, Y());
|
|
1391
1426
|
}
|
|
1392
|
-
function
|
|
1393
|
-
|
|
1427
|
+
function X(e) {
|
|
1428
|
+
fe(e);
|
|
1394
1429
|
}
|
|
1395
|
-
async function
|
|
1430
|
+
async function Z(e) {
|
|
1396
1431
|
let t = l.items.findIndex((t) => t.postId === e);
|
|
1397
|
-
return t < 0 || t === g.value ? !1 : (await
|
|
1432
|
+
return t < 0 || t === g.value ? !1 : (await fe(t), !0);
|
|
1398
1433
|
}
|
|
1399
|
-
async function
|
|
1400
|
-
return
|
|
1434
|
+
async function pe(e) {
|
|
1435
|
+
return J(e) ? (Y() || await new Promise((e) => setTimeout(e, yt)), !0) : !1;
|
|
1401
1436
|
}
|
|
1402
|
-
function
|
|
1437
|
+
function me() {
|
|
1403
1438
|
if (!l.reelAutoAdvance.enabled) return;
|
|
1404
1439
|
let e = R.value;
|
|
1405
1440
|
if (!e) return;
|
|
@@ -1412,30 +1447,31 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1412
1447
|
l.hasNext && !l.loadMoreLocked && u("loadMore");
|
|
1413
1448
|
return;
|
|
1414
1449
|
}
|
|
1415
|
-
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0),
|
|
1450
|
+
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), X(t);
|
|
1416
1451
|
}
|
|
1417
|
-
function
|
|
1418
|
-
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value ||
|
|
1452
|
+
function he(e, t) {
|
|
1453
|
+
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || me();
|
|
1419
1454
|
}
|
|
1420
1455
|
return O(d, (e) => {
|
|
1421
|
-
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(
|
|
1456
|
+
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(G), k.observe(e)));
|
|
1422
1457
|
}), O(() => l.items.length, async (e) => {
|
|
1423
1458
|
let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1424
|
-
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(),
|
|
1459
|
+
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), G();
|
|
1425
1460
|
}), O(L, (e) => {
|
|
1426
1461
|
e !== void 0 && u("activeChange", e);
|
|
1427
1462
|
}, { immediate: !0 }), y(() => {
|
|
1428
|
-
window.addEventListener("resize",
|
|
1463
|
+
window.addEventListener("resize", q), window.addEventListener("orientationchange", q), p >= 0 && m(G);
|
|
1429
1464
|
}), v(() => {
|
|
1430
|
-
window.removeEventListener("resize",
|
|
1465
|
+
window.removeEventListener("resize", q), window.removeEventListener("orientationchange", q), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
|
|
1431
1466
|
}), n({
|
|
1432
1467
|
activeIndex: g,
|
|
1433
1468
|
activePostId: L,
|
|
1434
|
-
changeActiveMedia:
|
|
1435
|
-
loadIfNearBottom:
|
|
1436
|
-
moveActivePost:
|
|
1437
|
-
|
|
1438
|
-
|
|
1469
|
+
changeActiveMedia: J,
|
|
1470
|
+
loadIfNearBottom: le,
|
|
1471
|
+
moveActivePost: ue,
|
|
1472
|
+
navigateToItem: de,
|
|
1473
|
+
transitionActiveMedia: pe,
|
|
1474
|
+
transitionActivePost: Z
|
|
1439
1475
|
}), (n, r) => (b(), s("main", {
|
|
1440
1476
|
class: h(["reel-shell", {
|
|
1441
1477
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1443,7 +1479,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1443
1479
|
}]),
|
|
1444
1480
|
"data-layout-mode": "reel"
|
|
1445
1481
|
}, [
|
|
1446
|
-
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1482
|
+
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
|
|
1447
1483
|
key: 0,
|
|
1448
1484
|
index: g.value,
|
|
1449
1485
|
item: R.value,
|
|
@@ -1465,19 +1501,19 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1465
1501
|
"style",
|
|
1466
1502
|
"total"
|
|
1467
1503
|
])) : o("", !0),
|
|
1468
|
-
c("div",
|
|
1504
|
+
c("div", ht, [c("div", {
|
|
1469
1505
|
ref_key: "galleryElement",
|
|
1470
1506
|
ref: d,
|
|
1471
1507
|
class: "gallery-shell reel-feed",
|
|
1472
1508
|
"data-active-post-id": L.value,
|
|
1473
1509
|
"data-active-media-index": z.value,
|
|
1474
|
-
onScrollPassive:
|
|
1510
|
+
onScrollPassive: se
|
|
1475
1511
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1476
1512
|
key: 1,
|
|
1477
1513
|
class: "reel-track",
|
|
1478
1514
|
style: _(N.value),
|
|
1479
1515
|
"aria-label": "Media gallery"
|
|
1480
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1516
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(nt, {
|
|
1481
1517
|
key: n.postId,
|
|
1482
1518
|
active: r === g.value && !x.value,
|
|
1483
1519
|
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
@@ -1486,7 +1522,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1486
1522
|
"fetch-priority": e,
|
|
1487
1523
|
index: r,
|
|
1488
1524
|
item: n,
|
|
1489
|
-
"item-style":
|
|
1525
|
+
"item-style": W(r),
|
|
1490
1526
|
"media-card": t.mediaCard,
|
|
1491
1527
|
layout: "reel",
|
|
1492
1528
|
"loaded-count": t.items.length,
|
|
@@ -1497,7 +1533,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1497
1533
|
"stationary-reel-controls": "",
|
|
1498
1534
|
total: t.total,
|
|
1499
1535
|
onMediaChange: (e) => u("mediaChange", n.postId, e),
|
|
1500
|
-
onEnded: (e) =>
|
|
1536
|
+
onEnded: (e) => he(n.postId, e),
|
|
1501
1537
|
onReady: (e) => u("ready", n.postId, e),
|
|
1502
1538
|
onError: (e) => u("error", n.postId, e)
|
|
1503
1539
|
}, null, 8, [
|
|
@@ -1523,12 +1559,12 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1523
1559
|
class: "reel-forward-status",
|
|
1524
1560
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1525
1561
|
"data-status": t.reelForward.status
|
|
1526
|
-
}, [c("p", null, T(
|
|
1562
|
+
}, [c("p", null, T(U.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1527
1563
|
key: 0,
|
|
1528
1564
|
class: "reel-forward-retry",
|
|
1529
1565
|
type: "button",
|
|
1530
1566
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1531
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1567
|
+
}, " Retry ")) : o("", !0)], 8, _t)), t.reelForward.status === "idle" ? (b(), a(ne, {
|
|
1532
1568
|
key: 2,
|
|
1533
1569
|
actions: t.feedFooterActions,
|
|
1534
1570
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1537,7 +1573,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1537
1573
|
"has-next": t.hasNext,
|
|
1538
1574
|
"is-loading": t.isLoadingMore,
|
|
1539
1575
|
"load-more-locked": t.loadMoreLocked,
|
|
1540
|
-
"show-load-more":
|
|
1576
|
+
"show-load-more": ie.value,
|
|
1541
1577
|
state: t.state,
|
|
1542
1578
|
onLoadMore: r[1] ||= (e) => u("loadMore"),
|
|
1543
1579
|
onRetryEnd: r[2] ||= (e) => u("retryEnd")
|
|
@@ -1551,13 +1587,13 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1551
1587
|
"load-more-locked",
|
|
1552
1588
|
"show-load-more",
|
|
1553
1589
|
"state"
|
|
1554
|
-
])) : o("", !0)], 40,
|
|
1590
|
+
])) : o("", !0)], 40, gt), c("div", {
|
|
1555
1591
|
ref_key: "reelControlsElement",
|
|
1556
1592
|
ref: f,
|
|
1557
1593
|
class: "reel-media-controls-host",
|
|
1558
1594
|
"data-test": "reel-media-controls-host"
|
|
1559
1595
|
}, null, 512)]),
|
|
1560
|
-
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1596
|
+
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
|
|
1561
1597
|
key: 1,
|
|
1562
1598
|
index: g.value,
|
|
1563
1599
|
item: R.value,
|
|
@@ -1579,24 +1615,24 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1579
1615
|
"style",
|
|
1580
1616
|
"total"
|
|
1581
1617
|
])) : o("", !0),
|
|
1582
|
-
re.value ? (b(), a(
|
|
1583
|
-
key:
|
|
1618
|
+
re.value ? (b(), a(mt, {
|
|
1619
|
+
key: ee.value,
|
|
1584
1620
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1585
|
-
label:
|
|
1586
|
-
onComplete:
|
|
1621
|
+
label: te.value,
|
|
1622
|
+
onComplete: me
|
|
1587
1623
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1588
1624
|
], 2));
|
|
1589
1625
|
}
|
|
1590
|
-
}),
|
|
1626
|
+
}), xt = ["data-info-sheet-open", "data-info-sheet-mode"], St = ["aria-hidden", "inert"], Ct = {
|
|
1591
1627
|
key: 0,
|
|
1592
1628
|
class: "reel-info-sheet-layer",
|
|
1593
1629
|
"data-test": "reel-info-sheet"
|
|
1594
|
-
},
|
|
1630
|
+
}, wt = [
|
|
1595
1631
|
"role",
|
|
1596
1632
|
"aria-modal",
|
|
1597
1633
|
"tabindex",
|
|
1598
1634
|
"data-active-post-id"
|
|
1599
|
-
],
|
|
1635
|
+
], Tt = /* @__PURE__ */ d({
|
|
1600
1636
|
__name: "ReelLayout",
|
|
1601
1637
|
props: {
|
|
1602
1638
|
forwardIndex: { default: null },
|
|
@@ -1674,19 +1710,22 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1674
1710
|
function L(e) {
|
|
1675
1711
|
return p.value?.moveActivePost(e) ?? !1;
|
|
1676
1712
|
}
|
|
1677
|
-
function R(e) {
|
|
1678
|
-
return p.value?.
|
|
1713
|
+
function R(e, t) {
|
|
1714
|
+
return p.value?.navigateToItem(e, t) ?? !1;
|
|
1679
1715
|
}
|
|
1680
1716
|
function z(e) {
|
|
1717
|
+
return p.value?.transitionActiveMedia(e) ?? Promise.resolve(!1);
|
|
1718
|
+
}
|
|
1719
|
+
function B(e) {
|
|
1681
1720
|
return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
|
|
1682
1721
|
}
|
|
1683
|
-
function
|
|
1722
|
+
function V(e, t) {
|
|
1684
1723
|
d("error", e, t);
|
|
1685
1724
|
}
|
|
1686
|
-
function
|
|
1725
|
+
function H(e, t) {
|
|
1687
1726
|
d("mediaChange", e, t);
|
|
1688
1727
|
}
|
|
1689
|
-
function
|
|
1728
|
+
function ee(e, t) {
|
|
1690
1729
|
d("ready", e, t);
|
|
1691
1730
|
}
|
|
1692
1731
|
return O(() => ({
|
|
@@ -1707,8 +1746,9 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1707
1746
|
changeActiveMedia: F,
|
|
1708
1747
|
loadIfNearBottom: I,
|
|
1709
1748
|
moveActivePost: L,
|
|
1710
|
-
|
|
1711
|
-
|
|
1749
|
+
navigateToItem: R,
|
|
1750
|
+
transitionActiveMedia: z,
|
|
1751
|
+
transitionActivePost: B
|
|
1712
1752
|
}), (t, r) => (b(), s("section", {
|
|
1713
1753
|
class: h(["reel-layout", `reel-layout--${e.infoSheetOverlay ? "overlay" : "layout"}`]),
|
|
1714
1754
|
"data-info-sheet-open": A.value || void 0,
|
|
@@ -1717,7 +1757,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1717
1757
|
class: "reel-layout-main",
|
|
1718
1758
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1719
1759
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1720
|
-
}, [u(
|
|
1760
|
+
}, [u(bt, {
|
|
1721
1761
|
ref_key: "reelFeed",
|
|
1722
1762
|
ref: p,
|
|
1723
1763
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1741,10 +1781,10 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1741
1781
|
state: e.state,
|
|
1742
1782
|
total: e.total,
|
|
1743
1783
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
1744
|
-
onError:
|
|
1784
|
+
onError: V,
|
|
1745
1785
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1746
|
-
onMediaChange:
|
|
1747
|
-
onReady:
|
|
1786
|
+
onMediaChange: H,
|
|
1787
|
+
onReady: ee,
|
|
1748
1788
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1749
1789
|
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1750
1790
|
}, null, 8, [
|
|
@@ -1768,8 +1808,8 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1768
1808
|
"reel-forward",
|
|
1769
1809
|
"state",
|
|
1770
1810
|
"total"
|
|
1771
|
-
])], 8,
|
|
1772
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
1811
|
+
])], 8, St), u(n, { name: "vibe-info-sheet" }, {
|
|
1812
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Ct, [c("aside", {
|
|
1773
1813
|
ref_key: "sheetElement",
|
|
1774
1814
|
ref: _,
|
|
1775
1815
|
class: "reel-info-sheet",
|
|
@@ -1778,11 +1818,70 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1778
1818
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1779
1819
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1780
1820
|
"data-active-post-id": T.value?.postId
|
|
1781
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
1821
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, wt)])) : o("", !0)]),
|
|
1782
1822
|
_: 1
|
|
1783
|
-
})], 10,
|
|
1823
|
+
})], 10, xt));
|
|
1784
1824
|
}
|
|
1785
|
-
}),
|
|
1825
|
+
}), Et = [];
|
|
1826
|
+
function Dt(e) {
|
|
1827
|
+
return Et.push(e), () => {
|
|
1828
|
+
let t = Et.indexOf(e);
|
|
1829
|
+
t >= 0 && Et.splice(t, 1);
|
|
1830
|
+
};
|
|
1831
|
+
}
|
|
1832
|
+
function Ot(e) {
|
|
1833
|
+
if (!e.isActive()) return !1;
|
|
1834
|
+
let t = Et.filter((e) => e.isActive()), n = e.element();
|
|
1835
|
+
return n !== null && t.some((t) => {
|
|
1836
|
+
if (t === e) return !1;
|
|
1837
|
+
let r = t.element();
|
|
1838
|
+
return r !== null && n.contains(r);
|
|
1839
|
+
}) ? !1 : t.filter((e) => {
|
|
1840
|
+
let n = e.element();
|
|
1841
|
+
return n === null || !t.some((t) => {
|
|
1842
|
+
if (t === e) return !1;
|
|
1843
|
+
let r = t.element();
|
|
1844
|
+
return r !== null && n.contains(r);
|
|
1845
|
+
});
|
|
1846
|
+
}).at(-1) === e;
|
|
1847
|
+
}
|
|
1848
|
+
//#endregion
|
|
1849
|
+
//#region src/components/useReelKeyboard.ts
|
|
1850
|
+
function kt(e) {
|
|
1851
|
+
let t = {
|
|
1852
|
+
element: e.element,
|
|
1853
|
+
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
1854
|
+
}, n = null;
|
|
1855
|
+
function r(n) {
|
|
1856
|
+
let r = t.isActive();
|
|
1857
|
+
if (n.key === "Escape" && r && !Ot(t)) return;
|
|
1858
|
+
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
1859
|
+
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
1860
|
+
return;
|
|
1861
|
+
}
|
|
1862
|
+
if (n.key === "Escape" && r && e.state.reelInfoSheet.enabled) {
|
|
1863
|
+
n.preventDefault(), e.setReelInfoSheet(!1);
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1866
|
+
if (n.defaultPrevented || n.altKey || n.ctrlKey || n.metaKey || n.shiftKey || e.isReelLeaving() || !r) return;
|
|
1867
|
+
let i = n.target;
|
|
1868
|
+
if (i instanceof HTMLElement && (i.isContentEditable || [
|
|
1869
|
+
"INPUT",
|
|
1870
|
+
"SELECT",
|
|
1871
|
+
"TEXTAREA"
|
|
1872
|
+
].includes(i.tagName))) return;
|
|
1873
|
+
let a = n.key === "ArrowLeft" ? -1 : n.key === "ArrowRight" ? 1 : 0;
|
|
1874
|
+
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
1875
|
+
}
|
|
1876
|
+
y(() => {
|
|
1877
|
+
n = Dt(t), window.addEventListener("keydown", r);
|
|
1878
|
+
}), v(() => {
|
|
1879
|
+
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
//#endregion
|
|
1883
|
+
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
1884
|
+
var At = 35, jt = 420, Mt = /* @__PURE__ */ d({
|
|
1786
1885
|
__name: "VibeSurface",
|
|
1787
1886
|
props: {
|
|
1788
1887
|
canRetryEnd: { type: Boolean },
|
|
@@ -1798,99 +1897,105 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1798
1897
|
"activeReelChange",
|
|
1799
1898
|
"closeReel",
|
|
1800
1899
|
"loadMore",
|
|
1900
|
+
"mediaReady",
|
|
1801
1901
|
"openReel",
|
|
1902
|
+
"reelMediaChange",
|
|
1802
1903
|
"reelInfoSheetChange",
|
|
1803
1904
|
"retryEnd",
|
|
1804
1905
|
"retryForward"
|
|
1805
1906
|
],
|
|
1806
1907
|
setup(t, { expose: i, emit: c }) {
|
|
1807
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null),
|
|
1808
|
-
function
|
|
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()), E = w(/* @__PURE__ */ new Map()), D = w(/* @__PURE__ */ new Map()), A = w(/* @__PURE__ */ new Map()), j = r(() => R(l.state)), P = r(() => l.state.reelMediaSource === "original" ? A.value : D.value), z = new Set(l.state.items.map((e) => e.postId)), B = null, V = null, H = !1;
|
|
1909
|
+
function ee() {
|
|
1809
1910
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1810
1911
|
}
|
|
1811
|
-
function
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1912
|
+
function te() {
|
|
1913
|
+
B !== null && cancelAnimationFrame(B), B = requestAnimationFrame(() => {
|
|
1914
|
+
B = requestAnimationFrame(() => {
|
|
1915
|
+
B = null, S.value = /* @__PURE__ */ new Set();
|
|
1815
1916
|
});
|
|
1816
1917
|
});
|
|
1817
1918
|
}
|
|
1818
|
-
function
|
|
1919
|
+
function ne(e, t, n) {
|
|
1819
1920
|
let r = F(e, t);
|
|
1820
|
-
|
|
1921
|
+
D.value.get(r) !== n && (D.value = new Map(D.value).set(r, n));
|
|
1821
1922
|
}
|
|
1822
|
-
function
|
|
1923
|
+
function re(e, t, n) {
|
|
1823
1924
|
let r = F(e, t);
|
|
1824
|
-
|
|
1925
|
+
A.value.get(r) !== n && (A.value = new Map(A.value).set(r, n));
|
|
1825
1926
|
}
|
|
1826
|
-
function
|
|
1827
|
-
|
|
1927
|
+
function ie(e, t) {
|
|
1928
|
+
ne(e, t, "error");
|
|
1828
1929
|
}
|
|
1829
|
-
function
|
|
1830
|
-
|
|
1930
|
+
function ae(e, t) {
|
|
1931
|
+
ne(e, t, "ready"), G(e, t, "masonry", null);
|
|
1831
1932
|
}
|
|
1832
1933
|
function W(e, t) {
|
|
1833
|
-
|
|
1934
|
+
re(e, t, "error");
|
|
1834
1935
|
}
|
|
1835
|
-
function
|
|
1836
|
-
te(e, t, "ready");
|
|
1837
|
-
}
|
|
1838
|
-
function G(e, t) {
|
|
1936
|
+
function oe(e, t) {
|
|
1839
1937
|
if (l.state.reelMediaSource === "original") {
|
|
1840
1938
|
W(e, t);
|
|
1841
1939
|
return;
|
|
1842
1940
|
}
|
|
1843
|
-
|
|
1941
|
+
ie(e, t);
|
|
1844
1942
|
}
|
|
1845
|
-
function
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
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);
|
|
1851
1949
|
}
|
|
1852
|
-
function
|
|
1950
|
+
function K(e, t) {
|
|
1853
1951
|
let n = l.state.items.find((t) => t.postId === e);
|
|
1854
1952
|
if (!n) return;
|
|
1855
1953
|
let r = N(n, t);
|
|
1856
1954
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
1857
1955
|
}
|
|
1858
|
-
async function
|
|
1956
|
+
async function q() {
|
|
1859
1957
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
1860
1958
|
}
|
|
1861
|
-
function
|
|
1959
|
+
function ce(e) {
|
|
1862
1960
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
1863
1961
|
}
|
|
1864
|
-
function
|
|
1962
|
+
function le(e) {
|
|
1865
1963
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
1866
1964
|
}
|
|
1867
|
-
function
|
|
1965
|
+
function J(e) {
|
|
1966
|
+
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
1967
|
+
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
1968
|
+
if (!t) return "not-found";
|
|
1969
|
+
let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
1970
|
+
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
1971
|
+
}
|
|
1972
|
+
function ue() {
|
|
1868
1973
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
1869
1974
|
}
|
|
1870
|
-
function
|
|
1871
|
-
|
|
1975
|
+
function de(e, t) {
|
|
1976
|
+
V = e, H = t === "keyboard", y.value = Z(e), d("openReel", e), m(() => h.value?.focus());
|
|
1872
1977
|
}
|
|
1873
|
-
function
|
|
1978
|
+
function Y(e) {
|
|
1874
1979
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
1875
1980
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
1876
1981
|
}
|
|
1877
|
-
function
|
|
1878
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
1879
|
-
let t = [...new Set(e)], n = t.filter(
|
|
1982
|
+
function fe(e) {
|
|
1983
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ee()) return 0;
|
|
1984
|
+
let t = [...new Set(e)], n = t.filter(Y);
|
|
1880
1985
|
if (n.length === 0) return 0;
|
|
1881
|
-
let r = new Map(
|
|
1986
|
+
let r = new Map(E.value);
|
|
1882
1987
|
return n.forEach((e, t) => {
|
|
1883
|
-
r.set(e, t *
|
|
1884
|
-
}),
|
|
1988
|
+
r.set(e, t * At);
|
|
1989
|
+
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), E.value = r, jt + (n.length - 1) * At;
|
|
1885
1990
|
}
|
|
1886
|
-
function
|
|
1887
|
-
let n =
|
|
1991
|
+
function X(e, t) {
|
|
1992
|
+
let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
1888
1993
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
1889
1994
|
r.classList.remove("media-card-focus-silent");
|
|
1890
1995
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
1891
1996
|
}
|
|
1892
|
-
function
|
|
1893
|
-
let t = g.value, n =
|
|
1997
|
+
function Z(e) {
|
|
1998
|
+
let t = g.value, n = Y(e);
|
|
1894
1999
|
if (t === null || n === null) return {};
|
|
1895
2000
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
1896
2001
|
return {
|
|
@@ -1900,60 +2005,48 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1900
2005
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
1901
2006
|
};
|
|
1902
2007
|
}
|
|
1903
|
-
function
|
|
1904
|
-
l.state.reelOrigin === "masonry" && (
|
|
2008
|
+
function pe() {
|
|
2009
|
+
l.state.reelOrigin === "masonry" && (V ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
1905
2010
|
}
|
|
1906
|
-
function
|
|
1907
|
-
let e =
|
|
1908
|
-
|
|
1909
|
-
e !== null &&
|
|
2011
|
+
function me() {
|
|
2012
|
+
let e = V, t = H;
|
|
2013
|
+
x.value = !1, V = null, H = !1, y.value = {}, m(() => {
|
|
2014
|
+
e !== null && X(e, t);
|
|
1910
2015
|
});
|
|
1911
2016
|
}
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || S.value || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry") return;
|
|
1923
|
-
let n = e.target;
|
|
1924
|
-
if (n instanceof HTMLElement && (n.isContentEditable || [
|
|
1925
|
-
"INPUT",
|
|
1926
|
-
"SELECT",
|
|
1927
|
-
"TEXTAREA"
|
|
1928
|
-
].includes(n.tagName))) return;
|
|
1929
|
-
let r = e.key === "ArrowLeft" ? -1 : e.key === "ArrowRight" ? 1 : 0;
|
|
1930
|
-
r !== 0 && p.value?.changeActiveMedia?.(r) && e.preventDefault();
|
|
1931
|
-
}
|
|
1932
|
-
return O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
1933
|
-
let t = e.filter((e) => !L.has(e)), n = new Set(e);
|
|
1934
|
-
if (L = new Set(e), E.value = new Set([...E.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || V()) return;
|
|
2017
|
+
return kt({
|
|
2018
|
+
closeMasonryReel: pe,
|
|
2019
|
+
element: () => g.value,
|
|
2020
|
+
isReelLeaving: () => x.value,
|
|
2021
|
+
reelRenderer: () => p.value,
|
|
2022
|
+
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2023
|
+
state: l.state
|
|
2024
|
+
}), L(l.state, (e) => d("reelMediaChange", e)), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2025
|
+
let t = e.filter((e) => !z.has(e)), n = new Set(e);
|
|
2026
|
+
if (z = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), E.value = new Map([...E.value].filter(([e]) => n.has(e))), t.length === 0 || ee()) return;
|
|
1935
2027
|
let r = /* @__PURE__ */ new Map();
|
|
1936
2028
|
e.forEach((e) => {
|
|
1937
|
-
let t =
|
|
2029
|
+
let t = C.value.get(e);
|
|
1938
2030
|
t !== void 0 && r.set(e, t);
|
|
1939
2031
|
}), t.forEach((e, t) => {
|
|
1940
|
-
r.set(e, t *
|
|
1941
|
-
}),
|
|
1942
|
-
}, { flush: "sync" }),
|
|
1943
|
-
|
|
2032
|
+
r.set(e, t * At);
|
|
2033
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), te();
|
|
2034
|
+
}, { flush: "sync" }), v(() => {
|
|
2035
|
+
B !== null && cancelAnimationFrame(B);
|
|
1944
2036
|
}), i({
|
|
1945
|
-
changeActiveReelMedia:
|
|
1946
|
-
getAutoScrollElement:
|
|
1947
|
-
loadIfNearBottom:
|
|
1948
|
-
moveActiveReelPost:
|
|
1949
|
-
|
|
2037
|
+
changeActiveReelMedia: ce,
|
|
2038
|
+
getAutoScrollElement: ue,
|
|
2039
|
+
loadIfNearBottom: q,
|
|
2040
|
+
moveActiveReelPost: le,
|
|
2041
|
+
navigateToReelItem: J,
|
|
2042
|
+
startItemRemoval: fe,
|
|
1950
2043
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
1951
2044
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
1952
2045
|
}), (r, i) => (b(), s("div", {
|
|
1953
2046
|
ref_key: "surfaceElement",
|
|
1954
2047
|
ref: g,
|
|
1955
2048
|
class: "vibe-surface"
|
|
1956
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2049
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Tt, {
|
|
1957
2050
|
key: 0,
|
|
1958
2051
|
ref_key: "reelRenderer",
|
|
1959
2052
|
ref: p,
|
|
@@ -1981,14 +2074,14 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
1981
2074
|
"preview-states": P.value,
|
|
1982
2075
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
1983
2076
|
"reel-forward": t.state.reelForward,
|
|
1984
|
-
state:
|
|
2077
|
+
state: j.value,
|
|
1985
2078
|
total: t.state.total,
|
|
1986
2079
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
1987
2080
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
1988
|
-
onError:
|
|
2081
|
+
onError: oe,
|
|
1989
2082
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
1990
|
-
onMediaChange:
|
|
1991
|
-
onReady:
|
|
2083
|
+
onMediaChange: K,
|
|
2084
|
+
onReady: se,
|
|
1992
2085
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
1993
2086
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
1994
2087
|
}, null, 8, [
|
|
@@ -2017,12 +2110,12 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
2017
2110
|
"reel-forward",
|
|
2018
2111
|
"state",
|
|
2019
2112
|
"total"
|
|
2020
|
-
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(
|
|
2113
|
+
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(U, {
|
|
2021
2114
|
key: 1,
|
|
2022
2115
|
actions: t.feedFooterActions,
|
|
2023
2116
|
"can-retry-end": t.canRetryEnd,
|
|
2024
2117
|
"feed-footer": t.feedFooter,
|
|
2025
|
-
state:
|
|
2118
|
+
state: j.value,
|
|
2026
2119
|
onLoadMore: i[5] ||= (e) => d("loadMore"),
|
|
2027
2120
|
onRetryEnd: i[6] ||= (e) => d("retryEnd")
|
|
2028
2121
|
}, null, 8, [
|
|
@@ -2030,14 +2123,14 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
2030
2123
|
"can-retry-end",
|
|
2031
2124
|
"feed-footer",
|
|
2032
2125
|
"state"
|
|
2033
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2126
|
+
])) : (b(), s(e, { key: 2 }, [u(ut, {
|
|
2034
2127
|
ref_key: "masonryRenderer",
|
|
2035
2128
|
ref: f,
|
|
2036
2129
|
"can-retry-end": t.canRetryEnd,
|
|
2037
|
-
"entering-post-ids":
|
|
2038
|
-
"entry-delays":
|
|
2039
|
-
"leaving-post-ids":
|
|
2040
|
-
"removal-delays":
|
|
2130
|
+
"entering-post-ids": S.value,
|
|
2131
|
+
"entry-delays": C.value,
|
|
2132
|
+
"leaving-post-ids": T.value,
|
|
2133
|
+
"removal-delays": E.value,
|
|
2041
2134
|
"card-footer": t.cardFooter,
|
|
2042
2135
|
"card-header": t.cardHeader,
|
|
2043
2136
|
"feed-footer": t.feedFooter,
|
|
@@ -2050,15 +2143,15 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
2050
2143
|
"load-more-locked": t.state.loadMoreLocked,
|
|
2051
2144
|
"media-indices": t.state.mediaIndices,
|
|
2052
2145
|
"next-page-error": !!t.state.nextPageError,
|
|
2053
|
-
"preview-states":
|
|
2054
|
-
suspended: t.state.reelOrigin === "masonry" ||
|
|
2055
|
-
state:
|
|
2146
|
+
"preview-states": D.value,
|
|
2147
|
+
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2148
|
+
state: j.value,
|
|
2056
2149
|
total: t.state.total,
|
|
2057
|
-
onActivate:
|
|
2058
|
-
onError:
|
|
2150
|
+
onActivate: de,
|
|
2151
|
+
onError: ie,
|
|
2059
2152
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2060
|
-
onMediaChange:
|
|
2061
|
-
onReady:
|
|
2153
|
+
onMediaChange: K,
|
|
2154
|
+
onReady: ae,
|
|
2062
2155
|
onRetryEnd: i[8] ||= (e) => d("retryEnd")
|
|
2063
2156
|
}, null, 8, [
|
|
2064
2157
|
"can-retry-end",
|
|
@@ -2084,7 +2177,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
2084
2177
|
"total"
|
|
2085
2178
|
]), u(n, {
|
|
2086
2179
|
name: "vibe-reel-viewer",
|
|
2087
|
-
onAfterLeave:
|
|
2180
|
+
onAfterLeave: me
|
|
2088
2181
|
}, {
|
|
2089
2182
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2090
2183
|
key: 0,
|
|
@@ -2095,8 +2188,8 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
2095
2188
|
"aria-label": "Media viewer",
|
|
2096
2189
|
"aria-modal": "true",
|
|
2097
2190
|
tabindex: "-1",
|
|
2098
|
-
style: _(
|
|
2099
|
-
}, [u(
|
|
2191
|
+
style: _(y.value)
|
|
2192
|
+
}, [u(Tt, {
|
|
2100
2193
|
ref_key: "reelRenderer",
|
|
2101
2194
|
ref: p,
|
|
2102
2195
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2120,17 +2213,17 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
2120
2213
|
"media-source": "original",
|
|
2121
2214
|
"next-page-error": !!t.state.nextPageError,
|
|
2122
2215
|
origin: "masonry",
|
|
2123
|
-
"preview-states":
|
|
2216
|
+
"preview-states": A.value,
|
|
2124
2217
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2125
2218
|
"reel-forward": t.state.reelForward,
|
|
2126
|
-
state:
|
|
2219
|
+
state: j.value,
|
|
2127
2220
|
total: t.state.total,
|
|
2128
2221
|
onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
|
|
2129
2222
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2130
2223
|
onError: W,
|
|
2131
2224
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2132
|
-
onMediaChange:
|
|
2133
|
-
onReady:
|
|
2225
|
+
onMediaChange: K,
|
|
2226
|
+
onReady: se,
|
|
2134
2227
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2135
2228
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
2136
2229
|
}, null, 8, [
|
|
@@ -2165,7 +2258,7 @@ var dt = ["aria-label"], ft = /* @__PURE__ */ d({
|
|
|
2165
2258
|
});
|
|
2166
2259
|
//#endregion
|
|
2167
2260
|
//#region src/core/page.ts
|
|
2168
|
-
function
|
|
2261
|
+
function Nt(e) {
|
|
2169
2262
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2170
2263
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2171
2264
|
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.");
|
|
@@ -2177,32 +2270,32 @@ function Q(e, t) {
|
|
|
2177
2270
|
}
|
|
2178
2271
|
//#endregion
|
|
2179
2272
|
//#region src/core/requestDelay.ts
|
|
2180
|
-
var
|
|
2273
|
+
var Pt = 2e3, Ft = 1e4, It = 250, Lt = {
|
|
2181
2274
|
delayRemainingMs: null,
|
|
2182
2275
|
nextRequestAt: null
|
|
2183
2276
|
};
|
|
2184
|
-
function
|
|
2277
|
+
function Rt(e, t) {
|
|
2185
2278
|
return e === void 0 ? t : Math.floor(e);
|
|
2186
2279
|
}
|
|
2187
|
-
function
|
|
2280
|
+
function zt(e, t) {
|
|
2188
2281
|
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.`);
|
|
2189
2282
|
}
|
|
2190
|
-
function
|
|
2191
|
-
let n =
|
|
2283
|
+
function Bt(e, t = {}) {
|
|
2284
|
+
let n = Rt(t.delayStepMs, Pt), r = Rt(t.delayMaxMs, Ft);
|
|
2192
2285
|
return Math.min(Math.max(0, e) * n, r);
|
|
2193
2286
|
}
|
|
2194
2287
|
function $(e) {
|
|
2195
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2288
|
+
if (e == null || !Number.isFinite(e)) return { ...Lt };
|
|
2196
2289
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2197
2290
|
return t > 0 ? {
|
|
2198
2291
|
delayRemainingMs: t,
|
|
2199
2292
|
nextRequestAt: e
|
|
2200
|
-
} : { ...
|
|
2293
|
+
} : { ...Lt };
|
|
2201
2294
|
}
|
|
2202
|
-
async function
|
|
2295
|
+
async function Vt({ delayMs: e, onChange: t, signal: n }) {
|
|
2203
2296
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2204
2297
|
if (e <= 0) {
|
|
2205
|
-
t({ ...
|
|
2298
|
+
t({ ...Lt });
|
|
2206
2299
|
return;
|
|
2207
2300
|
}
|
|
2208
2301
|
let r = Date.now() + e;
|
|
@@ -2210,9 +2303,9 @@ async function Ft({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2210
2303
|
delayRemainingMs: e,
|
|
2211
2304
|
nextRequestAt: r
|
|
2212
2305
|
}), await new Promise((i, a) => {
|
|
2213
|
-
let o = !1, s = setInterval(f,
|
|
2306
|
+
let o = !1, s = setInterval(f, It), c = setTimeout(() => u(), e);
|
|
2214
2307
|
function l() {
|
|
2215
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2308
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Lt });
|
|
2216
2309
|
}
|
|
2217
2310
|
function u(e) {
|
|
2218
2311
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2227,13 +2320,13 @@ async function Ft({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2227
2320
|
n.addEventListener("abort", d, { once: !0 });
|
|
2228
2321
|
});
|
|
2229
2322
|
}
|
|
2230
|
-
var
|
|
2323
|
+
var Ht = class {
|
|
2231
2324
|
interval = null;
|
|
2232
2325
|
constructor(e) {
|
|
2233
2326
|
this.onChange = e;
|
|
2234
2327
|
}
|
|
2235
2328
|
clear() {
|
|
2236
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2329
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Lt });
|
|
2237
2330
|
}
|
|
2238
2331
|
sync(e) {
|
|
2239
2332
|
this.clear();
|
|
@@ -2241,22 +2334,22 @@ var It = class {
|
|
|
2241
2334
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2242
2335
|
let t = $(e);
|
|
2243
2336
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2244
|
-
},
|
|
2337
|
+
}, It));
|
|
2245
2338
|
}
|
|
2246
2339
|
};
|
|
2247
|
-
function
|
|
2340
|
+
function Ut(e, t = !0) {
|
|
2248
2341
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2249
2342
|
}
|
|
2250
|
-
function
|
|
2343
|
+
function Wt(e) {
|
|
2251
2344
|
return `${typeof e}:${String(e)}`;
|
|
2252
2345
|
}
|
|
2253
|
-
function
|
|
2346
|
+
function Gt(e, t) {
|
|
2254
2347
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2255
2348
|
}
|
|
2256
|
-
function
|
|
2349
|
+
function Kt(e) {
|
|
2257
2350
|
if (!e) return;
|
|
2258
|
-
if (
|
|
2259
|
-
|
|
2351
|
+
if (Gt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2352
|
+
zt(e, "frontend autofill");
|
|
2260
2353
|
let t = e.maxAdditionalPages;
|
|
2261
2354
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2262
2355
|
return;
|
|
@@ -2268,7 +2361,7 @@ function Bt(e) {
|
|
|
2268
2361
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2269
2362
|
}
|
|
2270
2363
|
}
|
|
2271
|
-
function
|
|
2364
|
+
function qt(e, t, n = !0) {
|
|
2272
2365
|
if (!e) return {
|
|
2273
2366
|
cycleId: null,
|
|
2274
2367
|
delayRemainingMs: null,
|
|
@@ -2302,7 +2395,7 @@ function Vt(e, t, n = !0) {
|
|
|
2302
2395
|
strategy: e.strategy
|
|
2303
2396
|
};
|
|
2304
2397
|
}
|
|
2305
|
-
function
|
|
2398
|
+
function Jt(e) {
|
|
2306
2399
|
return [
|
|
2307
2400
|
"cancelling",
|
|
2308
2401
|
"filling",
|
|
@@ -2310,9 +2403,9 @@ function Ht(e) {
|
|
|
2310
2403
|
"waiting"
|
|
2311
2404
|
].includes(e.status);
|
|
2312
2405
|
}
|
|
2313
|
-
async function
|
|
2406
|
+
async function Yt(e, t, n) {
|
|
2314
2407
|
let r = t.autofill;
|
|
2315
|
-
if (!
|
|
2408
|
+
if (!Jt(r) || !r.cycleId) return;
|
|
2316
2409
|
let i = {
|
|
2317
2410
|
cycleId: r.cycleId,
|
|
2318
2411
|
feedKey: r.feedKey ?? "",
|
|
@@ -2325,20 +2418,20 @@ async function Ut(e, t, n) {
|
|
|
2325
2418
|
throw r.error = e, r.status = "error", e;
|
|
2326
2419
|
}
|
|
2327
2420
|
}
|
|
2328
|
-
function
|
|
2421
|
+
function Xt(e, t, n) {
|
|
2329
2422
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2330
2423
|
}
|
|
2331
|
-
async function
|
|
2332
|
-
let d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = r ??
|
|
2424
|
+
async function Zt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, signal: u }) {
|
|
2425
|
+
let d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = r ?? Ut(s), h = t, g = t, _ = 0, v;
|
|
2333
2426
|
for (; _ < m;) {
|
|
2334
|
-
let e =
|
|
2427
|
+
let e = Wt(h);
|
|
2335
2428
|
if (p.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2336
|
-
p.add(e), await
|
|
2337
|
-
delayMs:
|
|
2429
|
+
p.add(e), await Vt({
|
|
2430
|
+
delayMs: Bt(l + _, s),
|
|
2338
2431
|
onChange: a,
|
|
2339
2432
|
signal: u
|
|
2340
2433
|
});
|
|
2341
|
-
let t =
|
|
2434
|
+
let t = Nt(await n({
|
|
2342
2435
|
cursor: h,
|
|
2343
2436
|
signal: u
|
|
2344
2437
|
}));
|
|
@@ -2381,12 +2474,12 @@ async function Gt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2381
2474
|
}
|
|
2382
2475
|
//#endregion
|
|
2383
2476
|
//#region src/core/autofillController.ts
|
|
2384
|
-
var
|
|
2477
|
+
var Qt = class {
|
|
2385
2478
|
collection = null;
|
|
2386
2479
|
cycle = 0;
|
|
2387
2480
|
delayCountdown;
|
|
2388
2481
|
constructor(e) {
|
|
2389
|
-
this.context = e, this.delayCountdown = new
|
|
2482
|
+
this.context = e, this.delayCountdown = new Ht((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2390
2483
|
}
|
|
2391
2484
|
beginCycle() {
|
|
2392
2485
|
let { options: e, state: t } = this.context;
|
|
@@ -2394,14 +2487,14 @@ var Kt = class {
|
|
|
2394
2487
|
this.clear();
|
|
2395
2488
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2396
2489
|
return t.autofill = {
|
|
2397
|
-
...
|
|
2490
|
+
...qt(e, void 0, !1),
|
|
2398
2491
|
cycleId: n,
|
|
2399
2492
|
status: "filling"
|
|
2400
2493
|
}, n;
|
|
2401
2494
|
}
|
|
2402
2495
|
async cancel() {
|
|
2403
2496
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2404
|
-
await
|
|
2497
|
+
await Yt(t, n, e), this.commitCollection();
|
|
2405
2498
|
}
|
|
2406
2499
|
captureCollection(e, t) {
|
|
2407
2500
|
t && (this.collection = e);
|
|
@@ -2429,30 +2522,30 @@ var Kt = class {
|
|
|
2429
2522
|
requests: r.requests
|
|
2430
2523
|
}));
|
|
2431
2524
|
}
|
|
2432
|
-
},
|
|
2433
|
-
function
|
|
2525
|
+
}, $t = 100;
|
|
2526
|
+
function en(e, t) {
|
|
2434
2527
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2435
2528
|
}
|
|
2436
|
-
function
|
|
2529
|
+
function tn(e, t, n) {
|
|
2437
2530
|
return Math.min(n, Math.max(t, e));
|
|
2438
2531
|
}
|
|
2439
|
-
function
|
|
2532
|
+
function nn(e) {
|
|
2440
2533
|
if (!e) return;
|
|
2441
2534
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2442
|
-
if (
|
|
2443
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2535
|
+
if (en("autoScroll.minSpeedPxPerSecond", t), en("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2536
|
+
e.speedPxPerSecond !== void 0 && en("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2444
2537
|
}
|
|
2445
|
-
function
|
|
2538
|
+
function rn(e) {
|
|
2446
2539
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2447
2540
|
return {
|
|
2448
2541
|
enabled: e?.enabled ?? !1,
|
|
2449
2542
|
maxSpeedPxPerSecond: n,
|
|
2450
2543
|
minSpeedPxPerSecond: t,
|
|
2451
2544
|
paused: !1,
|
|
2452
|
-
speedPxPerSecond:
|
|
2545
|
+
speedPxPerSecond: tn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2453
2546
|
};
|
|
2454
2547
|
}
|
|
2455
|
-
var
|
|
2548
|
+
var an = class {
|
|
2456
2549
|
frame = null;
|
|
2457
2550
|
lastTimestamp = null;
|
|
2458
2551
|
mounted = !1;
|
|
@@ -2472,9 +2565,9 @@ var Qt = class {
|
|
|
2472
2565
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2473
2566
|
}
|
|
2474
2567
|
setSpeed(e) {
|
|
2475
|
-
|
|
2568
|
+
en("auto-scroll speed", e);
|
|
2476
2569
|
let t = this.options.state;
|
|
2477
|
-
t.speedPxPerSecond =
|
|
2570
|
+
t.speedPxPerSecond = tn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2478
2571
|
}
|
|
2479
2572
|
tick = (e) => {
|
|
2480
2573
|
this.frame = null;
|
|
@@ -2486,7 +2579,7 @@ var Qt = class {
|
|
|
2486
2579
|
return;
|
|
2487
2580
|
}
|
|
2488
2581
|
if (this.lastTimestamp !== null) {
|
|
2489
|
-
let r = Math.min(
|
|
2582
|
+
let r = Math.min($t, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2490
2583
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2491
2584
|
}
|
|
2492
2585
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2500,7 +2593,7 @@ var Qt = class {
|
|
|
2500
2593
|
};
|
|
2501
2594
|
//#endregion
|
|
2502
2595
|
//#region src/core/backendAutofill.ts
|
|
2503
|
-
async function
|
|
2596
|
+
async function on(e, t, n, r) {
|
|
2504
2597
|
let i = await e.onUnderfilled(n);
|
|
2505
2598
|
if (!r()) return;
|
|
2506
2599
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2514,19 +2607,19 @@ async function $t(e, t, n, r) {
|
|
|
2514
2607
|
status: "waiting"
|
|
2515
2608
|
});
|
|
2516
2609
|
}
|
|
2517
|
-
function
|
|
2610
|
+
function sn(e, t) {
|
|
2518
2611
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = Q(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
2519
2612
|
}
|
|
2520
|
-
function
|
|
2613
|
+
function cn(e, t, n) {
|
|
2521
2614
|
let r = t.autofill;
|
|
2522
|
-
return !
|
|
2615
|
+
return !Xt(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (sn(t, n), Object.assign(r, $(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);
|
|
2523
2616
|
}
|
|
2524
|
-
function
|
|
2525
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2617
|
+
function ln(e, t, n) {
|
|
2618
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = qt(e, n), sn(t, n), !0);
|
|
2526
2619
|
}
|
|
2527
2620
|
//#endregion
|
|
2528
2621
|
//#region src/core/initialAutofill.ts
|
|
2529
|
-
async function
|
|
2622
|
+
async function un({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, options: i, signal: a, state: o }) {
|
|
2530
2623
|
let s = i.autofill;
|
|
2531
2624
|
if (!s) return;
|
|
2532
2625
|
let c = o.items.length;
|
|
@@ -2539,7 +2632,7 @@ async function rn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2539
2632
|
return;
|
|
2540
2633
|
}
|
|
2541
2634
|
if (s.strategy === "backend") {
|
|
2542
|
-
await
|
|
2635
|
+
await on(s, o, {
|
|
2543
2636
|
cycleId: e,
|
|
2544
2637
|
feedKey: s.feedKey,
|
|
2545
2638
|
items: [...o.items],
|
|
@@ -2556,11 +2649,11 @@ async function rn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2556
2649
|
o.autofill.status = "exhausted";
|
|
2557
2650
|
return;
|
|
2558
2651
|
}
|
|
2559
|
-
let l = await
|
|
2652
|
+
let l = await Zt({
|
|
2560
2653
|
existingItems: o.items,
|
|
2561
2654
|
initialCursor: o.next,
|
|
2562
2655
|
loadPage: i.loadPage,
|
|
2563
|
-
maximumRequests:
|
|
2656
|
+
maximumRequests: Ut(s, !1),
|
|
2564
2657
|
onCollection: n,
|
|
2565
2658
|
onDelayChange: (e) => {
|
|
2566
2659
|
t() && Object.assign(o.autofill, e);
|
|
@@ -2582,13 +2675,13 @@ async function rn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2582
2675
|
}
|
|
2583
2676
|
//#endregion
|
|
2584
2677
|
//#region src/core/fill.ts
|
|
2585
|
-
function
|
|
2678
|
+
function dn(e) {
|
|
2586
2679
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2587
2680
|
}
|
|
2588
|
-
function
|
|
2681
|
+
function fn(e) {
|
|
2589
2682
|
return `${typeof e}:${String(e)}`;
|
|
2590
2683
|
}
|
|
2591
|
-
function
|
|
2684
|
+
function pn(e) {
|
|
2592
2685
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2593
2686
|
if ("pages" in e) {
|
|
2594
2687
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2597,20 +2690,20 @@ function sn(e) {
|
|
|
2597
2690
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2598
2691
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2599
2692
|
}
|
|
2600
|
-
function
|
|
2693
|
+
function mn(e) {
|
|
2601
2694
|
if (!e) return;
|
|
2602
2695
|
if (e.strategy === "frontend") {
|
|
2603
|
-
|
|
2696
|
+
zt(e, "frontend fill");
|
|
2604
2697
|
return;
|
|
2605
2698
|
}
|
|
2606
2699
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2607
2700
|
let t = e.initialSession;
|
|
2608
2701
|
if (t) {
|
|
2609
2702
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2610
|
-
|
|
2703
|
+
pn(t.target);
|
|
2611
2704
|
}
|
|
2612
2705
|
}
|
|
2613
|
-
function
|
|
2706
|
+
function hn(e, t, n = !0) {
|
|
2614
2707
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
|
|
2615
2708
|
return {
|
|
2616
2709
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2624,10 +2717,10 @@ function ln(e, t, n = !0) {
|
|
|
2624
2717
|
sessionId: i?.sessionId ?? null,
|
|
2625
2718
|
status: i?.status ?? "idle",
|
|
2626
2719
|
strategy: e?.strategy ?? null,
|
|
2627
|
-
target: i ?
|
|
2720
|
+
target: i ? dn(i.target) : null
|
|
2628
2721
|
};
|
|
2629
2722
|
}
|
|
2630
|
-
function
|
|
2723
|
+
function gn(e) {
|
|
2631
2724
|
return [
|
|
2632
2725
|
"cancelling",
|
|
2633
2726
|
"filling",
|
|
@@ -2635,17 +2728,17 @@ function un(e) {
|
|
|
2635
2728
|
"waiting"
|
|
2636
2729
|
].includes(e.status);
|
|
2637
2730
|
}
|
|
2638
|
-
async function
|
|
2731
|
+
async function _n({ existingItems: e, initialCursor: t, loadPage: n, onDelayChange: r, onProgress: i, options: a, signal: o, target: s }) {
|
|
2639
2732
|
let c = [], l = [...e], u = /* @__PURE__ */ new Set(), d = 0, f = t, p = t, m = 0, h;
|
|
2640
2733
|
for (; p !== null;) {
|
|
2641
|
-
let e =
|
|
2734
|
+
let e = fn(f);
|
|
2642
2735
|
if (u.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2643
|
-
u.add(e), await
|
|
2644
|
-
delayMs:
|
|
2736
|
+
u.add(e), await Vt({
|
|
2737
|
+
delayMs: Bt(d, a),
|
|
2645
2738
|
onChange: r,
|
|
2646
2739
|
signal: o
|
|
2647
2740
|
});
|
|
2648
|
-
let t =
|
|
2741
|
+
let t = Nt(await n({
|
|
2649
2742
|
cursor: f,
|
|
2650
2743
|
signal: o
|
|
2651
2744
|
}));
|
|
@@ -2687,7 +2780,7 @@ async function dn({ existingItems: e, initialCursor: t, loadPage: n, onDelayChan
|
|
|
2687
2780
|
}
|
|
2688
2781
|
//#endregion
|
|
2689
2782
|
//#region src/core/backendFill.ts
|
|
2690
|
-
async function
|
|
2783
|
+
async function vn(e, t, n, r) {
|
|
2691
2784
|
let i = await e.onStart(n);
|
|
2692
2785
|
if (r()) {
|
|
2693
2786
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2701,22 +2794,22 @@ async function fn(e, t, n, r) {
|
|
|
2701
2794
|
});
|
|
2702
2795
|
}
|
|
2703
2796
|
}
|
|
2704
|
-
function
|
|
2797
|
+
function yn(e, t, n) {
|
|
2705
2798
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2706
2799
|
}
|
|
2707
|
-
function
|
|
2800
|
+
function bn(e) {
|
|
2708
2801
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2709
2802
|
}
|
|
2710
|
-
function
|
|
2803
|
+
function xn(e, t) {
|
|
2711
2804
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2712
2805
|
let n = e.fill.target;
|
|
2713
2806
|
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;
|
|
2714
2807
|
}
|
|
2715
|
-
function
|
|
2808
|
+
function Sn(e, t, n) {
|
|
2716
2809
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Q(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
2717
2810
|
}
|
|
2718
|
-
function
|
|
2719
|
-
return !
|
|
2811
|
+
function Cn(e, t, n, r) {
|
|
2812
|
+
return !yn(e, t, n) || !bn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !xn(t, n) ? !1 : (Sn(t, n, r), Object.assign(t.fill, {
|
|
2720
2813
|
...$(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2721
2814
|
completedPages: n.completedPages,
|
|
2722
2815
|
error: n.error ?? null,
|
|
@@ -2725,41 +2818,41 @@ function _n(e, t, n, r) {
|
|
|
2725
2818
|
status: n.status
|
|
2726
2819
|
}), !0);
|
|
2727
2820
|
}
|
|
2728
|
-
function
|
|
2821
|
+
function wn(e, t, n, r) {
|
|
2729
2822
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2730
2823
|
let i = t.fill;
|
|
2731
|
-
return t.fill =
|
|
2824
|
+
return t.fill = hn(e, n), !bn(n) || !xn(t, n) ? (t.fill = i, !1) : (Sn(t, n, r), !0);
|
|
2732
2825
|
}
|
|
2733
2826
|
//#endregion
|
|
2734
2827
|
//#region src/core/fillController.ts
|
|
2735
|
-
var
|
|
2828
|
+
var Tn = class {
|
|
2736
2829
|
abortController = null;
|
|
2737
2830
|
cycle = 0;
|
|
2738
2831
|
delayCountdown;
|
|
2739
2832
|
requestVersion = 0;
|
|
2740
2833
|
constructor(e) {
|
|
2741
|
-
this.options = e, this.delayCountdown = new
|
|
2834
|
+
this.options = e, this.delayCountdown = new Ht((e) => {
|
|
2742
2835
|
Object.assign(this.options.state.fill, e);
|
|
2743
2836
|
}), this.syncBackendCountdown();
|
|
2744
2837
|
}
|
|
2745
2838
|
isActive() {
|
|
2746
|
-
return
|
|
2839
|
+
return gn(this.options.state.fill);
|
|
2747
2840
|
}
|
|
2748
2841
|
applyUpdate(e) {
|
|
2749
|
-
let t =
|
|
2842
|
+
let t = Cn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2750
2843
|
return t && this.syncBackendCountdown(), t;
|
|
2751
2844
|
}
|
|
2752
2845
|
restoreSession(e) {
|
|
2753
|
-
let t =
|
|
2846
|
+
let t = wn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2754
2847
|
return t && this.syncBackendCountdown(), t;
|
|
2755
2848
|
}
|
|
2756
2849
|
async start(e) {
|
|
2757
2850
|
let t = this.options.fill;
|
|
2758
2851
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2759
2852
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2760
|
-
let n =
|
|
2853
|
+
let n = pn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2761
2854
|
if (this.options.state.fill = {
|
|
2762
|
-
...
|
|
2855
|
+
...hn(t, void 0, !1),
|
|
2763
2856
|
cycleId: r,
|
|
2764
2857
|
status: "filling",
|
|
2765
2858
|
target: n
|
|
@@ -2770,7 +2863,7 @@ var yn = class {
|
|
|
2770
2863
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2771
2864
|
this.abortController = a;
|
|
2772
2865
|
try {
|
|
2773
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
2866
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await vn(t, this.options.state, {
|
|
2774
2867
|
cycleId: r,
|
|
2775
2868
|
feedKey: t.feedKey,
|
|
2776
2869
|
items: [...this.options.state.items],
|
|
@@ -2788,7 +2881,7 @@ var yn = class {
|
|
|
2788
2881
|
}
|
|
2789
2882
|
async cancel() {
|
|
2790
2883
|
let { fill: e, state: t } = this.options;
|
|
2791
|
-
if (!
|
|
2884
|
+
if (!gn(t.fill) || !t.fill.cycleId) return;
|
|
2792
2885
|
let n = {
|
|
2793
2886
|
cycleId: t.fill.cycleId,
|
|
2794
2887
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -2802,7 +2895,7 @@ var yn = class {
|
|
|
2802
2895
|
}
|
|
2803
2896
|
}
|
|
2804
2897
|
reset() {
|
|
2805
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
2898
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = hn(this.options.fill, void 0, !1);
|
|
2806
2899
|
}
|
|
2807
2900
|
destroy() {
|
|
2808
2901
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2818,7 +2911,7 @@ var yn = class {
|
|
|
2818
2911
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2819
2912
|
let a = this.options.state;
|
|
2820
2913
|
a.isLoadingMore = !0;
|
|
2821
|
-
let o = await
|
|
2914
|
+
let o = await _n({
|
|
2822
2915
|
existingItems: a.items,
|
|
2823
2916
|
initialCursor: a.next,
|
|
2824
2917
|
loadPage: i,
|
|
@@ -2845,7 +2938,7 @@ var yn = class {
|
|
|
2845
2938
|
};
|
|
2846
2939
|
//#endregion
|
|
2847
2940
|
//#region src/core/feedFooter.ts
|
|
2848
|
-
function
|
|
2941
|
+
function En(e) {
|
|
2849
2942
|
return {
|
|
2850
2943
|
cancelAutofill: () => e.cancelAutofill(),
|
|
2851
2944
|
loadMore: () => e.loadNext(),
|
|
@@ -2853,45 +2946,45 @@ function bn(e) {
|
|
|
2853
2946
|
retryEnd: () => e.retryEnd()
|
|
2854
2947
|
};
|
|
2855
2948
|
}
|
|
2856
|
-
function
|
|
2949
|
+
function Dn(e) {
|
|
2857
2950
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
2858
2951
|
}
|
|
2859
|
-
function
|
|
2860
|
-
e?.intervalMs !== void 0 &&
|
|
2952
|
+
function On(e) {
|
|
2953
|
+
e?.intervalMs !== void 0 && Dn(e.intervalMs);
|
|
2861
2954
|
}
|
|
2862
|
-
function
|
|
2955
|
+
function kn(e) {
|
|
2863
2956
|
return {
|
|
2864
2957
|
enabled: e?.enabled ?? !1,
|
|
2865
2958
|
includePostItems: e?.includePostItems ?? !1,
|
|
2866
2959
|
intervalMs: e?.intervalMs ?? 5e3
|
|
2867
2960
|
};
|
|
2868
2961
|
}
|
|
2869
|
-
function
|
|
2962
|
+
function An(e, t) {
|
|
2870
2963
|
if (typeof t == "boolean") {
|
|
2871
2964
|
e.enabled = t;
|
|
2872
2965
|
return;
|
|
2873
2966
|
}
|
|
2874
|
-
|
|
2967
|
+
On(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);
|
|
2875
2968
|
}
|
|
2876
2969
|
//#endregion
|
|
2877
2970
|
//#region src/core/reelInfoSheet.ts
|
|
2878
|
-
function
|
|
2971
|
+
function jn(e) {
|
|
2879
2972
|
return { enabled: e?.enabled ?? !1 };
|
|
2880
2973
|
}
|
|
2881
|
-
function
|
|
2974
|
+
function Mn(e, t, n) {
|
|
2882
2975
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
2883
2976
|
e.enabled = n;
|
|
2884
2977
|
}
|
|
2885
2978
|
//#endregion
|
|
2886
2979
|
//#region src/core/initialRuntimeState.ts
|
|
2887
|
-
function
|
|
2980
|
+
function Nn(e, t) {
|
|
2888
2981
|
let n = e.initialPage;
|
|
2889
2982
|
return {
|
|
2890
2983
|
activeReelPostId: null,
|
|
2891
|
-
autoScroll:
|
|
2892
|
-
autofill:
|
|
2984
|
+
autoScroll: rn(e.autoScroll),
|
|
2985
|
+
autofill: qt(e.autofill),
|
|
2893
2986
|
error: null,
|
|
2894
|
-
fill:
|
|
2987
|
+
fill: hn(e.fill),
|
|
2895
2988
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
2896
2989
|
isLoading: !n,
|
|
2897
2990
|
isLoadingMore: !1,
|
|
@@ -2901,14 +2994,14 @@ function Dn(e, t) {
|
|
|
2901
2994
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
2902
2995
|
next: n?.next ?? null,
|
|
2903
2996
|
nextPageError: null,
|
|
2904
|
-
reelAutoAdvance:
|
|
2997
|
+
reelAutoAdvance: kn(e.reelAutoAdvance),
|
|
2905
2998
|
reelForward: {
|
|
2906
2999
|
error: null,
|
|
2907
3000
|
status: "idle"
|
|
2908
3001
|
},
|
|
2909
3002
|
reelForwardIndex: null,
|
|
2910
3003
|
reelForwardItem: null,
|
|
2911
|
-
reelInfoSheet:
|
|
3004
|
+
reelInfoSheet: jn(e.reelInfoSheet),
|
|
2912
3005
|
reelInfoSheetOverlay: !1,
|
|
2913
3006
|
reelMediaSource: "original",
|
|
2914
3007
|
reelOrigin: null,
|
|
@@ -2917,26 +3010,26 @@ function Dn(e, t) {
|
|
|
2917
3010
|
}
|
|
2918
3011
|
//#endregion
|
|
2919
3012
|
//#region src/core/options.ts
|
|
2920
|
-
function
|
|
3013
|
+
function Pn(e, t) {
|
|
2921
3014
|
if (t) {
|
|
2922
3015
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
2923
3016
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
2924
3017
|
}
|
|
2925
3018
|
}
|
|
2926
|
-
function
|
|
3019
|
+
function Fn(e, t) {
|
|
2927
3020
|
if (t) {
|
|
2928
3021
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
2929
3022
|
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.`);
|
|
2930
3023
|
}
|
|
2931
3024
|
}
|
|
2932
|
-
function
|
|
2933
|
-
if (
|
|
3025
|
+
function In(e) {
|
|
3026
|
+
if (nn(e.autoScroll), Pn("cardHeader", e.cardHeader), Pn("cardFooter", e.cardFooter), Fn("header", e.mediaCard?.header), Fn("footer", e.mediaCard?.footer), Kt(e.autofill), mn(e.fill), On(e.reelAutoAdvance), e.removalHistoryLimit !== void 0 && (!Number.isInteger(e.removalHistoryLimit) || e.removalHistoryLimit < 0)) throw TypeError("Vibe removalHistoryLimit must be a non-negative integer.");
|
|
2934
3027
|
if (!e.initialPage && !e.loadPage) throw TypeError("Vibe requires either initialPage or loadPage.");
|
|
2935
3028
|
if (e.initialPage?.next !== null && !e.loadPage) throw TypeError("Vibe requires loadPage when initialPage has a next cursor.");
|
|
2936
3029
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
2937
3030
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
2938
3031
|
}
|
|
2939
|
-
function
|
|
3032
|
+
function Ln(e) {
|
|
2940
3033
|
if (typeof e != "string") return e;
|
|
2941
3034
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
2942
3035
|
let t = document.querySelector(e);
|
|
@@ -2945,7 +3038,7 @@ function jn(e) {
|
|
|
2945
3038
|
}
|
|
2946
3039
|
//#endregion
|
|
2947
3040
|
//#region src/core/activeItemRemoval.ts
|
|
2948
|
-
function
|
|
3041
|
+
function Rn(e, t, n, r, i) {
|
|
2949
3042
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
2950
3043
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
2951
3044
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -2958,7 +3051,7 @@ function Mn(e, t, n, r, i) {
|
|
|
2958
3051
|
}
|
|
2959
3052
|
//#endregion
|
|
2960
3053
|
//#region src/core/exactMediaRemovalController.ts
|
|
2961
|
-
function
|
|
3054
|
+
function zn(e, t) {
|
|
2962
3055
|
let [n, ...r] = t;
|
|
2963
3056
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
2964
3057
|
return {
|
|
@@ -2967,10 +3060,10 @@ function Nn(e, t) {
|
|
|
2967
3060
|
items: r
|
|
2968
3061
|
};
|
|
2969
3062
|
}
|
|
2970
|
-
function
|
|
3063
|
+
function Bn(e) {
|
|
2971
3064
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
2972
3065
|
}
|
|
2973
|
-
var
|
|
3066
|
+
var Vn = class {
|
|
2974
3067
|
generation = 0;
|
|
2975
3068
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
2976
3069
|
state;
|
|
@@ -2978,7 +3071,7 @@ var Fn = class {
|
|
|
2978
3071
|
this.options = e, this.state = e.state;
|
|
2979
3072
|
}
|
|
2980
3073
|
remove(e) {
|
|
2981
|
-
|
|
3074
|
+
Bn(e);
|
|
2982
3075
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
2983
3076
|
if (!n) return null;
|
|
2984
3077
|
let r = [...M(n)], i = r[e.mediaIndex];
|
|
@@ -2995,7 +3088,7 @@ var Fn = class {
|
|
|
2995
3088
|
restored: !1
|
|
2996
3089
|
});
|
|
2997
3090
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
2998
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3091
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = zn(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
|
|
2999
3092
|
}
|
|
3000
3093
|
reset() {
|
|
3001
3094
|
this.generation += 1;
|
|
@@ -3021,7 +3114,7 @@ var Fn = class {
|
|
|
3021
3114
|
}
|
|
3022
3115
|
restoreIntoPost(e, t) {
|
|
3023
3116
|
let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3024
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3117
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = zn(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3025
3118
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3026
3119
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3027
3120
|
}
|
|
@@ -3034,18 +3127,18 @@ var Fn = class {
|
|
|
3034
3127
|
};
|
|
3035
3128
|
//#endregion
|
|
3036
3129
|
//#region src/core/itemPlacement.ts
|
|
3037
|
-
function
|
|
3130
|
+
function Hn(e, t) {
|
|
3038
3131
|
let n = new Set(t);
|
|
3039
3132
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3040
3133
|
index: t,
|
|
3041
3134
|
item: e
|
|
3042
3135
|
}] : []);
|
|
3043
3136
|
}
|
|
3044
|
-
function
|
|
3137
|
+
function Un(e, t) {
|
|
3045
3138
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3046
3139
|
return e.filter((e) => !n.has(e.postId));
|
|
3047
3140
|
}
|
|
3048
|
-
function
|
|
3141
|
+
function Wn(e, t) {
|
|
3049
3142
|
t.forEach(({ index: e }) => {
|
|
3050
3143
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3051
3144
|
});
|
|
@@ -3056,7 +3149,7 @@ function Rn(e, t) {
|
|
|
3056
3149
|
}
|
|
3057
3150
|
//#endregion
|
|
3058
3151
|
//#region src/core/itemRemovalController.ts
|
|
3059
|
-
var
|
|
3152
|
+
var Gn = 20, Kn = class {
|
|
3060
3153
|
generation = 0;
|
|
3061
3154
|
historyLimit;
|
|
3062
3155
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3065,7 +3158,7 @@ var zn = 20, Bn = class {
|
|
|
3065
3158
|
itemOrder;
|
|
3066
3159
|
stopItemsWatcher;
|
|
3067
3160
|
constructor(e) {
|
|
3068
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3161
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Gn, 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" });
|
|
3069
3162
|
}
|
|
3070
3163
|
destroy() {
|
|
3071
3164
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3078,7 +3171,7 @@ var zn = 20, Bn = class {
|
|
|
3078
3171
|
let i = this.options.startRemoval(r);
|
|
3079
3172
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
3080
3173
|
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);
|
|
3081
|
-
return this.state.items =
|
|
3174
|
+
return this.state.items = Un(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
|
|
3082
3175
|
}
|
|
3083
3176
|
reset() {
|
|
3084
3177
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3089,7 +3182,7 @@ var zn = 20, Bn = class {
|
|
|
3089
3182
|
this.restoreRemoval(t);
|
|
3090
3183
|
return;
|
|
3091
3184
|
}
|
|
3092
|
-
let n =
|
|
3185
|
+
let n = Wn(this.state.items, e);
|
|
3093
3186
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
3094
3187
|
}
|
|
3095
3188
|
restoreRemoval(e) {
|
|
@@ -3115,7 +3208,7 @@ var zn = 20, Bn = class {
|
|
|
3115
3208
|
}
|
|
3116
3209
|
collectOrderedPlacements(e) {
|
|
3117
3210
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3118
|
-
return
|
|
3211
|
+
return Hn(this.state.items, e).map((e) => ({
|
|
3119
3212
|
index: t.get(e.item.postId) ?? e.index,
|
|
3120
3213
|
item: e.item
|
|
3121
3214
|
}));
|
|
@@ -3146,7 +3239,7 @@ var zn = 20, Bn = class {
|
|
|
3146
3239
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3147
3240
|
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;
|
|
3148
3241
|
}
|
|
3149
|
-
},
|
|
3242
|
+
}, qn = class {
|
|
3150
3243
|
forward = null;
|
|
3151
3244
|
forwardPromise = null;
|
|
3152
3245
|
forwardVersion = 0;
|
|
@@ -3224,7 +3317,7 @@ var zn = 20, Bn = class {
|
|
|
3224
3317
|
}
|
|
3225
3318
|
}
|
|
3226
3319
|
}
|
|
3227
|
-
},
|
|
3320
|
+
}, Jn = class {
|
|
3228
3321
|
generation = 0;
|
|
3229
3322
|
pending = Promise.resolve();
|
|
3230
3323
|
constructor(e) {
|
|
@@ -3274,22 +3367,22 @@ var zn = 20, Bn = class {
|
|
|
3274
3367
|
};
|
|
3275
3368
|
//#endregion
|
|
3276
3369
|
//#region src/core/removalControllers.ts
|
|
3277
|
-
function
|
|
3278
|
-
let t = new
|
|
3370
|
+
function Yn(e) {
|
|
3371
|
+
let t = new qn(e), n = new Jn({
|
|
3279
3372
|
state: e.state,
|
|
3280
3373
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3281
3374
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3282
3375
|
});
|
|
3283
3376
|
return {
|
|
3284
|
-
exactMediaRemoval: new
|
|
3377
|
+
exactMediaRemoval: new Vn({
|
|
3285
3378
|
onActivate: e.onActivate,
|
|
3286
3379
|
reelForward: t,
|
|
3287
3380
|
state: e.state
|
|
3288
3381
|
}),
|
|
3289
|
-
itemRemoval: new
|
|
3382
|
+
itemRemoval: new Kn({
|
|
3290
3383
|
historyLimit: e.historyLimit,
|
|
3291
3384
|
onItemsRemoved: (n, r, i) => {
|
|
3292
|
-
|
|
3385
|
+
Rn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3293
3386
|
},
|
|
3294
3387
|
onRemovalRestored: (n) => {
|
|
3295
3388
|
let r = t.cancel(n);
|
|
@@ -3303,17 +3396,17 @@ function Un(e) {
|
|
|
3303
3396
|
reelRemoval: n
|
|
3304
3397
|
};
|
|
3305
3398
|
}
|
|
3306
|
-
var
|
|
3307
|
-
function
|
|
3399
|
+
var Xn = 1.5;
|
|
3400
|
+
function Zn(e) {
|
|
3308
3401
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3309
3402
|
if (t > 0 && t < 600) return !0;
|
|
3310
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3403
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Xn;
|
|
3311
3404
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3312
3405
|
}
|
|
3313
|
-
function
|
|
3314
|
-
return
|
|
3406
|
+
function Qn(e) {
|
|
3407
|
+
return Zn(e) ? "reel" : "masonry";
|
|
3315
3408
|
}
|
|
3316
|
-
function
|
|
3409
|
+
function $n(e) {
|
|
3317
3410
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3318
3411
|
return {
|
|
3319
3412
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3323,15 +3416,15 @@ function qn(e) {
|
|
|
3323
3416
|
viewportWidth: n.clientWidth
|
|
3324
3417
|
};
|
|
3325
3418
|
}
|
|
3326
|
-
function
|
|
3327
|
-
return
|
|
3419
|
+
function er(e) {
|
|
3420
|
+
return Zn($n(e));
|
|
3328
3421
|
}
|
|
3329
|
-
function
|
|
3330
|
-
return
|
|
3422
|
+
function tr(e) {
|
|
3423
|
+
return Qn($n(e));
|
|
3331
3424
|
}
|
|
3332
3425
|
//#endregion
|
|
3333
3426
|
//#region src/core/responsiveLayoutController.ts
|
|
3334
|
-
var
|
|
3427
|
+
var nr = class {
|
|
3335
3428
|
layoutMode;
|
|
3336
3429
|
resizeObserver = null;
|
|
3337
3430
|
target = null;
|
|
@@ -3356,10 +3449,10 @@ var Xn = class {
|
|
|
3356
3449
|
}
|
|
3357
3450
|
handleResponsiveLayout = () => {
|
|
3358
3451
|
if (!this.target) return;
|
|
3359
|
-
let e =
|
|
3360
|
-
this.state.reelInfoSheetOverlay =
|
|
3452
|
+
let e = tr(this.target);
|
|
3453
|
+
this.state.reelInfoSheetOverlay = er(this.target), this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3361
3454
|
};
|
|
3362
|
-
},
|
|
3455
|
+
}, rr = class {
|
|
3363
3456
|
routedReelPostId = null;
|
|
3364
3457
|
reelRouteIsActive = !1;
|
|
3365
3458
|
constructor(e, t) {
|
|
@@ -3386,7 +3479,7 @@ var Xn = class {
|
|
|
3386
3479
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3387
3480
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3388
3481
|
}
|
|
3389
|
-
},
|
|
3482
|
+
}, ir = class {
|
|
3390
3483
|
app = null;
|
|
3391
3484
|
autoScroll;
|
|
3392
3485
|
autofillController;
|
|
@@ -3405,27 +3498,27 @@ var Xn = class {
|
|
|
3405
3498
|
lastLoadedCursor = null;
|
|
3406
3499
|
state;
|
|
3407
3500
|
constructor(e) {
|
|
3408
|
-
this.options = e,
|
|
3501
|
+
this.options = e, In(e);
|
|
3409
3502
|
let t = e.layout ?? "masonry";
|
|
3410
|
-
this.state = x(
|
|
3503
|
+
this.state = x(Nn(e, t)), this.autoScroll = new an({
|
|
3411
3504
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3412
3505
|
state: this.state.autoScroll
|
|
3413
|
-
}), this.autofillController = new
|
|
3506
|
+
}), this.autofillController = new Qt({
|
|
3414
3507
|
cancelRequest: () => this.cancelRequest(),
|
|
3415
3508
|
onLastCursor: (e) => {
|
|
3416
3509
|
this.lastLoadedCursor = e;
|
|
3417
3510
|
},
|
|
3418
3511
|
options: e.autofill,
|
|
3419
3512
|
state: this.state
|
|
3420
|
-
}), this.fillController = new
|
|
3513
|
+
}), this.fillController = new Tn({
|
|
3421
3514
|
fill: e.fill,
|
|
3422
3515
|
loadPage: e.loadPage,
|
|
3423
3516
|
onLastCursor: (e) => {
|
|
3424
3517
|
this.lastLoadedCursor = e;
|
|
3425
3518
|
},
|
|
3426
3519
|
state: this.state
|
|
3427
|
-
}), this.routing = new
|
|
3428
|
-
let n =
|
|
3520
|
+
}), this.routing = new rr(e.routing, this.state);
|
|
3521
|
+
let n = Yn({
|
|
3429
3522
|
historyLimit: e.removalHistoryLimit,
|
|
3430
3523
|
loadNext: () => this.loadNext(),
|
|
3431
3524
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
@@ -3433,21 +3526,23 @@ var Xn = class {
|
|
|
3433
3526
|
state: this.state,
|
|
3434
3527
|
surface: () => this.surface
|
|
3435
3528
|
});
|
|
3436
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
3529
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new nr(t, this.state, () => {
|
|
3437
3530
|
this.routing.syncFeed();
|
|
3438
3531
|
}), this.startStateNotifications();
|
|
3439
3532
|
}
|
|
3440
3533
|
async mount() {
|
|
3441
3534
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3442
3535
|
this.startStateNotifications();
|
|
3443
|
-
let e =
|
|
3444
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
3536
|
+
let e = Ln(this.options.target);
|
|
3537
|
+
this.responsiveLayout.mount(e), this.app = i(Mt, {
|
|
3445
3538
|
canRetryEnd: !!this.options.loadPage,
|
|
3446
3539
|
cardFooter: this.options.cardFooter,
|
|
3447
3540
|
cardHeader: this.options.cardHeader,
|
|
3448
3541
|
feedFooter: this.options.feedFooter,
|
|
3449
|
-
feedFooterActions:
|
|
3542
|
+
feedFooterActions: En(this),
|
|
3450
3543
|
mediaCard: this.options.mediaCard,
|
|
3544
|
+
onMediaReady: this.options.onMediaReady,
|
|
3545
|
+
onReelMediaChange: this.options.onReelMediaChange,
|
|
3451
3546
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
3452
3547
|
state: this.state,
|
|
3453
3548
|
onActiveReelChange: (e) => {
|
|
@@ -3471,7 +3566,7 @@ var Xn = class {
|
|
|
3471
3566
|
this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
3472
3567
|
}
|
|
3473
3568
|
getState() {
|
|
3474
|
-
return
|
|
3569
|
+
return R(this.state);
|
|
3475
3570
|
}
|
|
3476
3571
|
removeMedia(e) {
|
|
3477
3572
|
return this.exactMediaRemoval.remove(e);
|
|
@@ -3509,6 +3604,9 @@ var Xn = class {
|
|
|
3509
3604
|
previousReelPost() {
|
|
3510
3605
|
return this.surface?.moveActiveReelPost(-1) ?? !1;
|
|
3511
3606
|
}
|
|
3607
|
+
navigateToReelItem(e) {
|
|
3608
|
+
return this.surface?.navigateToReelItem(e) ?? "reel-inactive";
|
|
3609
|
+
}
|
|
3512
3610
|
pauseAutoScroll() {
|
|
3513
3611
|
this.autoScroll.setPaused(!0);
|
|
3514
3612
|
}
|
|
@@ -3522,7 +3620,7 @@ var Xn = class {
|
|
|
3522
3620
|
this.autoScroll.setSpeed(e);
|
|
3523
3621
|
}
|
|
3524
3622
|
applyAutofillUpdate(e) {
|
|
3525
|
-
let t =
|
|
3623
|
+
let t = cn(this.options.autofill, this.state, e);
|
|
3526
3624
|
return t && this.autofillController.syncCountdown(), t;
|
|
3527
3625
|
}
|
|
3528
3626
|
cancelAutofill() {
|
|
@@ -3535,11 +3633,11 @@ var Xn = class {
|
|
|
3535
3633
|
return this.fillController.cancel();
|
|
3536
3634
|
}
|
|
3537
3635
|
async fill(e) {
|
|
3538
|
-
if (this.pendingRequest ||
|
|
3636
|
+
if (this.pendingRequest || Jt(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
3539
3637
|
await this.fillController.start(e);
|
|
3540
3638
|
}
|
|
3541
3639
|
restoreAutofillSession(e) {
|
|
3542
|
-
let t =
|
|
3640
|
+
let t = ln(this.options.autofill, this.state, e);
|
|
3543
3641
|
return t && this.autofillController.syncCountdown(), t;
|
|
3544
3642
|
}
|
|
3545
3643
|
restoreFillSession(e) {
|
|
@@ -3547,7 +3645,7 @@ var Xn = class {
|
|
|
3547
3645
|
}
|
|
3548
3646
|
async loadNext() {
|
|
3549
3647
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3550
|
-
if (!this.state.loadMoreLocked && !(
|
|
3648
|
+
if (!this.state.loadMoreLocked && !(Jt(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.state.next, !0);
|
|
3551
3649
|
}
|
|
3552
3650
|
async refresh() {
|
|
3553
3651
|
return this.replaceFeed(this.state.next ?? this.lastLoadedCursor, "refresh");
|
|
@@ -3557,11 +3655,11 @@ var Xn = class {
|
|
|
3557
3655
|
}
|
|
3558
3656
|
async replaceFeed(e, t) {
|
|
3559
3657
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
3560
|
-
return
|
|
3658
|
+
return Jt(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = qt(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.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);
|
|
3561
3659
|
}
|
|
3562
3660
|
async retryEnd() {
|
|
3563
3661
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3564
|
-
if (!this.state.loadMoreLocked && !(
|
|
3662
|
+
if (!this.state.loadMoreLocked && !(Jt(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);
|
|
3565
3663
|
}
|
|
3566
3664
|
setInfiniteScroll(e) {
|
|
3567
3665
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -3570,10 +3668,10 @@ var Xn = class {
|
|
|
3570
3668
|
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e && this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom()));
|
|
3571
3669
|
}
|
|
3572
3670
|
setReelAutoAdvance(e) {
|
|
3573
|
-
|
|
3671
|
+
An(this.state.reelAutoAdvance, e);
|
|
3574
3672
|
}
|
|
3575
3673
|
setReelInfoSheet(e) {
|
|
3576
|
-
|
|
3674
|
+
Mn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
3577
3675
|
}
|
|
3578
3676
|
setLayout(e) {
|
|
3579
3677
|
this.responsiveLayout.setLayout(e);
|
|
@@ -3597,7 +3695,7 @@ var Xn = class {
|
|
|
3597
3695
|
this.abortController = i;
|
|
3598
3696
|
try {
|
|
3599
3697
|
if (a?.strategy === "frontend") {
|
|
3600
|
-
let o = await
|
|
3698
|
+
let o = await Zt({
|
|
3601
3699
|
existingItems: t ? this.state.items : [],
|
|
3602
3700
|
initialCursor: e,
|
|
3603
3701
|
loadPage: n,
|
|
@@ -3620,7 +3718,7 @@ var Xn = class {
|
|
|
3620
3718
|
}), this.autofillController.clearCollection();
|
|
3621
3719
|
return;
|
|
3622
3720
|
}
|
|
3623
|
-
let c =
|
|
3721
|
+
let c = Nt(await n({
|
|
3624
3722
|
cursor: e,
|
|
3625
3723
|
signal: i.signal
|
|
3626
3724
|
}));
|
|
@@ -3635,7 +3733,7 @@ var Xn = class {
|
|
|
3635
3733
|
this.state.autofill.status = "complete";
|
|
3636
3734
|
return;
|
|
3637
3735
|
}
|
|
3638
|
-
await
|
|
3736
|
+
await on(a, this.state, {
|
|
3639
3737
|
cycleId: o,
|
|
3640
3738
|
feedKey: a.feedKey,
|
|
3641
3739
|
items: u.slice(l.length),
|
|
@@ -3663,7 +3761,7 @@ var Xn = class {
|
|
|
3663
3761
|
startInitialAutofill() {
|
|
3664
3762
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
3665
3763
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
3666
|
-
let r =
|
|
3764
|
+
let r = un({
|
|
3667
3765
|
cycleId: n,
|
|
3668
3766
|
isCurrent: () => e === this.requestVersion,
|
|
3669
3767
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -3688,8 +3786,8 @@ var Xn = class {
|
|
|
3688
3786
|
}));
|
|
3689
3787
|
}
|
|
3690
3788
|
};
|
|
3691
|
-
function
|
|
3692
|
-
return new
|
|
3789
|
+
function ar(e) {
|
|
3790
|
+
return new ir(e);
|
|
3693
3791
|
}
|
|
3694
3792
|
//#endregion
|
|
3695
|
-
export {
|
|
3793
|
+
export { ar as createVibe };
|