@wyxos/vibe 5.7.2 → 5.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/lib/components/MediaCard.vue.d.ts +4 -1
- package/lib/components/ReelFeed.vue.d.ts +4 -2
- package/lib/components/ReelLayout.vue.d.ts +3 -1
- package/lib/components/VibeSurface.vue.d.ts +4 -1
- package/lib/components/useFeedReplacementPreload.d.ts +11 -0
- package/lib/components/useMediaCardAudio.d.ts +19 -0
- package/lib/components/useMediaLoading.d.ts +1 -1
- package/lib/core/feed.d.ts +2 -1
- package/lib/core/feedReplacementPreload.d.ts +3 -0
- package/lib/core/mediaCardOptions.d.ts +18 -0
- package/lib/core/reelAudio.d.ts +3 -0
- package/lib/core/reelAudioController.d.ts +8 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +835 -701
- package/lib/style.css +1 -1
- package/lib/types.d.ts +6 -13
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -71,10 +71,10 @@ var B = {
|
|
|
71
71
|
key: 0,
|
|
72
72
|
class: "load-more-status",
|
|
73
73
|
role: "status"
|
|
74
|
-
},
|
|
74
|
+
}, H = ["disabled"], U = {
|
|
75
75
|
key: 2,
|
|
76
76
|
class: "end-feed"
|
|
77
|
-
},
|
|
77
|
+
}, W = ["disabled"], ee = /* @__PURE__ */ d({
|
|
78
78
|
__name: "GalleryFooter",
|
|
79
79
|
props: {
|
|
80
80
|
canRetryEnd: { type: Boolean },
|
|
@@ -97,7 +97,7 @@ var B = {
|
|
|
97
97
|
type: "button",
|
|
98
98
|
disabled: e.loadMoreLocked,
|
|
99
99
|
onClick: i
|
|
100
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
100
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, H)) : (b(), s("div", U, [n[1] ||= c("p", {
|
|
101
101
|
class: "end-feed-message",
|
|
102
102
|
role: "status"
|
|
103
103
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -106,9 +106,9 @@ var B = {
|
|
|
106
106
|
type: "button",
|
|
107
107
|
disabled: e.loadMoreLocked,
|
|
108
108
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
109
|
-
}, " Check for more ", 8,
|
|
109
|
+
}, " Check for more ", 8, W)]))])) : o("", !0);
|
|
110
110
|
}
|
|
111
|
-
}),
|
|
111
|
+
}), te = /* @__PURE__ */ d({
|
|
112
112
|
__name: "FeedFooter",
|
|
113
113
|
props: {
|
|
114
114
|
actions: {},
|
|
@@ -145,7 +145,7 @@ var B = {
|
|
|
145
145
|
"can-retry-end",
|
|
146
146
|
"show-load-more",
|
|
147
147
|
"state"
|
|
148
|
-
])) : (b(), a(
|
|
148
|
+
])) : (b(), a(ee, {
|
|
149
149
|
key: 1,
|
|
150
150
|
"can-retry-end": e.canRetryEnd,
|
|
151
151
|
"has-error": e.hasError,
|
|
@@ -164,7 +164,7 @@ var B = {
|
|
|
164
164
|
"show-load-more"
|
|
165
165
|
]));
|
|
166
166
|
}
|
|
167
|
-
}),
|
|
167
|
+
}), G = ["role"], K = { class: "gallery-status" }, ne = /* @__PURE__ */ d({
|
|
168
168
|
__name: "FeedStatus",
|
|
169
169
|
props: {
|
|
170
170
|
actions: {},
|
|
@@ -178,7 +178,7 @@ var B = {
|
|
|
178
178
|
return (n, u) => (b(), s("main", {
|
|
179
179
|
class: "gallery-shell",
|
|
180
180
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
181
|
-
}, [c("p",
|
|
181
|
+
}, [c("p", K, [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(te, {
|
|
182
182
|
key: 0,
|
|
183
183
|
actions: t.actions,
|
|
184
184
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -200,32 +200,32 @@ var B = {
|
|
|
200
200
|
"is-loading",
|
|
201
201
|
"load-more-locked",
|
|
202
202
|
"state"
|
|
203
|
-
])) : o("", !0)], 8,
|
|
203
|
+
])) : o("", !0)], 8, G));
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
|
-
function
|
|
206
|
+
function re(e) {
|
|
207
207
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
208
208
|
}
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region src/core/masonry.ts
|
|
211
|
-
function
|
|
211
|
+
function q(e) {
|
|
212
212
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
213
213
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function ie(e) {
|
|
216
216
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function ae(e) {
|
|
219
219
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function oe(e, t, n) {
|
|
222
222
|
if (t <= 0 || e.length === 0) return {
|
|
223
223
|
columns: 0,
|
|
224
224
|
height: 0,
|
|
225
225
|
items: []
|
|
226
226
|
};
|
|
227
227
|
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) => {
|
|
228
|
-
let t =
|
|
228
|
+
let t = ie(c), n = s * q(e) + i, a = {
|
|
229
229
|
x: t * (s + r),
|
|
230
230
|
y: c[t],
|
|
231
231
|
width: s,
|
|
@@ -241,7 +241,7 @@ function ie(e, t, n) {
|
|
|
241
241
|
}
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/core/masonryViewportIndex.ts
|
|
244
|
-
function
|
|
244
|
+
function se(e, t) {
|
|
245
245
|
let n = /* @__PURE__ */ new Map();
|
|
246
246
|
return e.forEach((e, r) => {
|
|
247
247
|
let i = n.get(e.x) ?? [];
|
|
@@ -252,7 +252,7 @@ function ae(e, t) {
|
|
|
252
252
|
}), n.set(e.x, i);
|
|
253
253
|
}), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function J(e, t) {
|
|
256
256
|
let n = 0, r = 0, i = e.length;
|
|
257
257
|
for (; r < i;) {
|
|
258
258
|
let a = Math.floor((r + i) / 2);
|
|
@@ -263,10 +263,10 @@ function X(e, t) {
|
|
|
263
263
|
inspected: n
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function ce(e, t) {
|
|
267
267
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
|
|
268
268
|
return e.columns.forEach((e) => {
|
|
269
|
-
let t =
|
|
269
|
+
let t = J(e, r);
|
|
270
270
|
o += t.inspected;
|
|
271
271
|
for (let n = t.index; n < e.length; n += 1) {
|
|
272
272
|
let t = e[n];
|
|
@@ -278,14 +278,14 @@ function Z(e, t) {
|
|
|
278
278
|
inspected: o
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function le(e) {
|
|
282
282
|
return e?.minColumnWidth ?? 240;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function ue(e, t) {
|
|
285
285
|
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
286
286
|
return a === void 0 ? i : Math.min(i, a);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function de(e) {
|
|
289
289
|
if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
|
|
290
290
|
let t = e?.overscan;
|
|
291
291
|
if (t) {
|
|
@@ -299,10 +299,10 @@ function se(e) {
|
|
|
299
299
|
}
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region src/core/scrollbar.ts
|
|
302
|
-
function
|
|
302
|
+
function Y(e, t, n) {
|
|
303
303
|
return Math.min(n, Math.max(t, e));
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function fe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
306
306
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
307
307
|
if (!(c > 0 && o > 0)) return {
|
|
308
308
|
maximumScrollPosition: c,
|
|
@@ -311,23 +311,23 @@ function le({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
311
311
|
thumbSize: o,
|
|
312
312
|
thumbTravel: 0
|
|
313
313
|
};
|
|
314
|
-
let l =
|
|
314
|
+
let l = Y(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
315
315
|
return {
|
|
316
316
|
maximumScrollPosition: c,
|
|
317
317
|
scrollable: !0,
|
|
318
|
-
thumbOffset: u * (
|
|
318
|
+
thumbOffset: u * (Y(n, 0, c) / c),
|
|
319
319
|
thumbSize: l,
|
|
320
320
|
thumbTravel: u
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
325
|
-
var
|
|
325
|
+
var X = ["aria-hidden"], pe = [
|
|
326
326
|
"aria-controls",
|
|
327
327
|
"aria-valuemax",
|
|
328
328
|
"aria-valuenow",
|
|
329
329
|
"tabindex"
|
|
330
|
-
],
|
|
330
|
+
], me = 32, he = 40, ge = 120, _e = /* @__PURE__ */ d({
|
|
331
331
|
__name: "GalleryScrollbar",
|
|
332
332
|
props: {
|
|
333
333
|
contentSize: {},
|
|
@@ -349,16 +349,16 @@ var ue = ["aria-hidden"], de = [
|
|
|
349
349
|
function k() {
|
|
350
350
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
351
351
|
g = null, o.value || (l.value = !1);
|
|
352
|
-
},
|
|
352
|
+
}, ge);
|
|
353
353
|
}
|
|
354
354
|
function A() {
|
|
355
355
|
l.value = !0, k();
|
|
356
356
|
}
|
|
357
357
|
function j() {
|
|
358
358
|
let e = t.scrollElement, r = i.value;
|
|
359
|
-
return !e || !r ? n :
|
|
359
|
+
return !e || !r ? n : fe({
|
|
360
360
|
contentSize: e.scrollHeight,
|
|
361
|
-
minimumThumbSize:
|
|
361
|
+
minimumThumbSize: me,
|
|
362
362
|
scrollPosition: e.scrollTop,
|
|
363
363
|
trackSize: r.clientHeight,
|
|
364
364
|
viewportSize: e.clientHeight
|
|
@@ -411,7 +411,7 @@ var ue = ["aria-hidden"], de = [
|
|
|
411
411
|
}
|
|
412
412
|
function z(e) {
|
|
413
413
|
if (!E.value) return;
|
|
414
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
414
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - he : e.key === "ArrowDown" ? r + he : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
415
415
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
416
416
|
}
|
|
417
417
|
function B(e) {
|
|
@@ -457,15 +457,15 @@ var ue = ["aria-hidden"], de = [
|
|
|
457
457
|
onPointerdown: I,
|
|
458
458
|
onPointermove: L,
|
|
459
459
|
onPointerup: R
|
|
460
|
-
}, null, 44,
|
|
460
|
+
}, null, 44, pe)], 42, X));
|
|
461
461
|
}
|
|
462
|
-
}),
|
|
462
|
+
}), ve = (e) => {
|
|
463
463
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
464
464
|
return !1;
|
|
465
|
-
},
|
|
466
|
-
let t =
|
|
465
|
+
}, ye = (e) => e === "", be = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), xe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Se = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Ce = (e) => {
|
|
466
|
+
let t = Se(e);
|
|
467
467
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
468
|
-
},
|
|
468
|
+
}, we = {
|
|
469
469
|
xmlns: "http://www.w3.org/2000/svg",
|
|
470
470
|
width: 24,
|
|
471
471
|
height: 24,
|
|
@@ -475,27 +475,27 @@ var ue = ["aria-hidden"], de = [
|
|
|
475
475
|
"stroke-width": 2,
|
|
476
476
|
"stroke-linecap": "round",
|
|
477
477
|
"stroke-linejoin": "round"
|
|
478
|
-
},
|
|
479
|
-
...
|
|
478
|
+
}, Te = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = we.width, color: s = we.stroke, ...c }, { slots: l }) => p("svg", {
|
|
479
|
+
...we,
|
|
480
480
|
...c,
|
|
481
481
|
width: o,
|
|
482
482
|
height: o,
|
|
483
483
|
stroke: s,
|
|
484
|
-
"stroke-width":
|
|
485
|
-
class:
|
|
486
|
-
...!l.default && !
|
|
487
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
484
|
+
"stroke-width": ye(n) || ye(r) || n === !0 || r === !0 ? Number(i || a || we["stroke-width"]) * 24 / Number(o) : i || a || we["stroke-width"],
|
|
485
|
+
class: be("lucide", c.class, ...e ? [`lucide-${xe(Ce(e))}-icon`, `lucide-${xe(e)}`] : ["lucide-icon"]),
|
|
486
|
+
...!l.default && !ve(c) && { "aria-hidden": "true" }
|
|
487
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Ee = (e, t) => (n, { slots: r, attrs: i }) => p(Te, {
|
|
488
488
|
...i,
|
|
489
489
|
...n,
|
|
490
490
|
iconNode: t,
|
|
491
491
|
name: e
|
|
492
|
-
}, r),
|
|
492
|
+
}, r), De = Ee("chevron-left", [["path", {
|
|
493
493
|
d: "m15 18-6-6 6-6",
|
|
494
494
|
key: "1wnfg3"
|
|
495
|
-
}]]),
|
|
495
|
+
}]]), Oe = Ee("chevron-right", [["path", {
|
|
496
496
|
d: "m9 18 6-6-6-6",
|
|
497
497
|
key: "mthhwq"
|
|
498
|
-
}]]),
|
|
498
|
+
}]]), ke = Ee("pause", [["rect", {
|
|
499
499
|
x: "14",
|
|
500
500
|
y: "3",
|
|
501
501
|
width: "5",
|
|
@@ -509,10 +509,10 @@ var ue = ["aria-hidden"], de = [
|
|
|
509
509
|
height: "18",
|
|
510
510
|
rx: "1",
|
|
511
511
|
key: "1wsw3u"
|
|
512
|
-
}]]),
|
|
512
|
+
}]]), Ae = Ee("play", [["path", {
|
|
513
513
|
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",
|
|
514
514
|
key: "10ikf1"
|
|
515
|
-
}]]),
|
|
515
|
+
}]]), je = Ee("volume-2", [
|
|
516
516
|
["path", {
|
|
517
517
|
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",
|
|
518
518
|
key: "uqj9uw"
|
|
@@ -525,7 +525,7 @@ var ue = ["aria-hidden"], de = [
|
|
|
525
525
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
526
526
|
key: "ijwkga"
|
|
527
527
|
}]
|
|
528
|
-
]),
|
|
528
|
+
]), Me = Ee("volume-x", [
|
|
529
529
|
["path", {
|
|
530
530
|
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",
|
|
531
531
|
key: "uqj9uw"
|
|
@@ -544,22 +544,22 @@ var ue = ["aria-hidden"], de = [
|
|
|
544
544
|
y2: "15",
|
|
545
545
|
key: "5ykzw1"
|
|
546
546
|
}]
|
|
547
|
-
]),
|
|
547
|
+
]), Ne = {
|
|
548
548
|
401: "Authentication required",
|
|
549
549
|
403: "Access forbidden",
|
|
550
550
|
404: "Preview not found",
|
|
551
551
|
419: "Session expired",
|
|
552
552
|
500: "Server error"
|
|
553
553
|
};
|
|
554
|
-
function
|
|
554
|
+
function Pe(e) {
|
|
555
555
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
556
556
|
}
|
|
557
|
-
function
|
|
558
|
-
return
|
|
557
|
+
function Fe(e) {
|
|
558
|
+
return Ne[Pe(e)] ?? "Preview unavailable";
|
|
559
559
|
}
|
|
560
560
|
//#endregion
|
|
561
561
|
//#region src/components/CardRegion.vue
|
|
562
|
-
var
|
|
562
|
+
var Ie = /* @__PURE__ */ d({
|
|
563
563
|
__name: "CardRegion",
|
|
564
564
|
props: {
|
|
565
565
|
index: {},
|
|
@@ -606,7 +606,7 @@ var Pe = /* @__PURE__ */ d({
|
|
|
606
606
|
"total"
|
|
607
607
|
]))], 38));
|
|
608
608
|
}
|
|
609
|
-
}),
|
|
609
|
+
}), Le = ["aria-busy", "aria-label"], Re = { class: "media-error-code" }, ze = ["disabled"], Be = /* @__PURE__ */ d({
|
|
610
610
|
__name: "MediaError",
|
|
611
611
|
props: {
|
|
612
612
|
component: {},
|
|
@@ -641,7 +641,7 @@ var Pe = /* @__PURE__ */ d({
|
|
|
641
641
|
"retrying",
|
|
642
642
|
"status"
|
|
643
643
|
]))], 32)) : (b(), s(e, { key: 1 }, [
|
|
644
|
-
c("strong",
|
|
644
|
+
c("strong", Re, T(t.status), 1),
|
|
645
645
|
c("span", null, T(t.label), 1),
|
|
646
646
|
c("button", {
|
|
647
647
|
"data-test": "media-retry",
|
|
@@ -650,21 +650,21 @@ var Pe = /* @__PURE__ */ d({
|
|
|
650
650
|
disabled: t.retrying,
|
|
651
651
|
onClick: j(o, ["stop"]),
|
|
652
652
|
onKeydown: r[2] ||= j(() => {}, ["stop"])
|
|
653
|
-
}, T(t.retrying ? "Retrying…" : "Retry"), 41,
|
|
654
|
-
], 64))], 8,
|
|
653
|
+
}, T(t.retrying ? "Retrying…" : "Retry"), 41, ze)
|
|
654
|
+
], 64))], 8, Le));
|
|
655
655
|
}
|
|
656
|
-
}),
|
|
656
|
+
}), Ve = [
|
|
657
657
|
"max",
|
|
658
658
|
"value",
|
|
659
659
|
"aria-valuetext",
|
|
660
660
|
"disabled"
|
|
661
|
-
],
|
|
661
|
+
], He = {
|
|
662
662
|
key: 0,
|
|
663
663
|
class: "media-controls-row"
|
|
664
|
-
},
|
|
664
|
+
}, Ue = ["aria-label", "title"], We = { class: "media-controls-audio" }, Ge = ["aria-label", "title"], Ke = ["value", "aria-valuetext"], qe = {
|
|
665
665
|
class: "media-control-time",
|
|
666
666
|
"aria-live": "off"
|
|
667
|
-
},
|
|
667
|
+
}, Je = /* @__PURE__ */ d({
|
|
668
668
|
__name: "MediaControls",
|
|
669
669
|
props: {
|
|
670
670
|
currentTime: {},
|
|
@@ -712,35 +712,35 @@ var Pe = /* @__PURE__ */ d({
|
|
|
712
712
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
713
713
|
disabled: f.value <= 0,
|
|
714
714
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
715
|
-
}, null, 44,
|
|
715
|
+
}, null, 44, Ve), e.layout === "reel" ? (b(), s("div", He, [
|
|
716
716
|
c("button", {
|
|
717
717
|
type: "button",
|
|
718
718
|
class: "media-control-button media-control-playback",
|
|
719
719
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
720
720
|
title: e.playing ? "Pause" : "Play",
|
|
721
721
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
722
|
-
}, [e.playing ? (b(), a(E(
|
|
722
|
+
}, [e.playing ? (b(), a(E(ke), {
|
|
723
723
|
key: 0,
|
|
724
724
|
size: 18,
|
|
725
725
|
fill: "currentColor"
|
|
726
|
-
})) : (b(), a(E(
|
|
726
|
+
})) : (b(), a(E(Ae), {
|
|
727
727
|
key: 1,
|
|
728
728
|
size: 18,
|
|
729
729
|
fill: "currentColor"
|
|
730
|
-
}))], 8,
|
|
731
|
-
c("div",
|
|
730
|
+
}))], 8, Ue),
|
|
731
|
+
c("div", We, [c("button", {
|
|
732
732
|
type: "button",
|
|
733
733
|
class: "media-control-button",
|
|
734
734
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
735
735
|
title: e.muted ? "Unmute" : "Mute",
|
|
736
736
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
737
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
737
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(Me), {
|
|
738
738
|
key: 0,
|
|
739
739
|
size: 18
|
|
740
|
-
})) : (b(), a(E(
|
|
740
|
+
})) : (b(), a(E(je), {
|
|
741
741
|
key: 1,
|
|
742
742
|
size: 18
|
|
743
|
-
}))], 8,
|
|
743
|
+
}))], 8, Ge), c("input", {
|
|
744
744
|
class: "media-control-range media-control-volume",
|
|
745
745
|
type: "range",
|
|
746
746
|
min: "0",
|
|
@@ -751,14 +751,122 @@ var Pe = /* @__PURE__ */ d({
|
|
|
751
751
|
"aria-label": "Video volume",
|
|
752
752
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
753
753
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
754
|
-
}, null, 44,
|
|
755
|
-
c("output",
|
|
754
|
+
}, null, 44, Ke)]),
|
|
755
|
+
c("output", qe, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
756
756
|
])) : o("", !0)], 34));
|
|
757
757
|
}
|
|
758
|
-
})
|
|
758
|
+
}), Ye = {
|
|
759
|
+
lastAudibleVolume: 1,
|
|
760
|
+
muted: !1,
|
|
761
|
+
volume: 1
|
|
762
|
+
};
|
|
763
|
+
function Xe(e, t) {
|
|
764
|
+
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
765
|
+
}
|
|
766
|
+
function Ze(e, t = Ye) {
|
|
767
|
+
let n = Xe(e?.volume, t.volume), r = Xe(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
|
|
768
|
+
return {
|
|
769
|
+
lastAudibleVolume: r > 0 ? r : Ye.lastAudibleVolume,
|
|
770
|
+
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
771
|
+
volume: n
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
//#endregion
|
|
775
|
+
//#region src/components/useMediaCardAudio.ts
|
|
776
|
+
function Qe(e) {
|
|
777
|
+
let t = Ze(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
|
|
778
|
+
function o() {
|
|
779
|
+
let t = e.videoElement.value, n = e.reelAudioState();
|
|
780
|
+
if (!t || e.layout() !== "reel" || !n) return;
|
|
781
|
+
let o = Ze(n);
|
|
782
|
+
a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
|
|
783
|
+
}
|
|
784
|
+
function s(e, t) {
|
|
785
|
+
t && (r.value = e.muted), i.value = e.volume, e.volume > 0 && (a = e.volume);
|
|
786
|
+
}
|
|
787
|
+
function c(t) {
|
|
788
|
+
if (e.layout() !== "reel") return;
|
|
789
|
+
let n = Ze({
|
|
790
|
+
lastAudibleVolume: a,
|
|
791
|
+
muted: t.muted,
|
|
792
|
+
volume: t.volume
|
|
793
|
+
});
|
|
794
|
+
r.value = n.muted, i.value = n.volume, a = n.lastAudibleVolume, e.onChange(n);
|
|
795
|
+
}
|
|
796
|
+
function l(t) {
|
|
797
|
+
let n = e.videoElement.value;
|
|
798
|
+
if (!n || !Number.isFinite(t)) return;
|
|
799
|
+
let r = Math.min(1, Math.max(0, t));
|
|
800
|
+
n.volume = r, n.muted = r === 0, r > 0 && (a = r), s(n, !0), c(n);
|
|
801
|
+
}
|
|
802
|
+
function u() {
|
|
803
|
+
let t = e.videoElement.value;
|
|
804
|
+
t && (t.muted && t.volume === 0 && (t.volume = a), t.muted = !t.muted, s(t, !0), c(t));
|
|
805
|
+
}
|
|
806
|
+
return O([
|
|
807
|
+
e.active,
|
|
808
|
+
e.layout,
|
|
809
|
+
() => e.reelAudioState()?.lastAudibleVolume,
|
|
810
|
+
() => e.reelAudioState()?.muted,
|
|
811
|
+
() => e.reelAudioState()?.volume,
|
|
812
|
+
e.videoElement
|
|
813
|
+
], o, { immediate: !0 }), {
|
|
814
|
+
apply: o,
|
|
815
|
+
setVolume: l,
|
|
816
|
+
sync: s,
|
|
817
|
+
toggleMute: u,
|
|
818
|
+
videoIsMuted: r,
|
|
819
|
+
videoVolume: i
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
//#endregion
|
|
823
|
+
//#region src/core/mediaType.ts
|
|
824
|
+
var $e = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
825
|
+
function et(e) {
|
|
826
|
+
try {
|
|
827
|
+
return $e.test(new URL(e).pathname);
|
|
828
|
+
} catch {
|
|
829
|
+
return $e.test(e.split("?")[0] ?? e);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
function tt(e, t) {
|
|
833
|
+
return e === void 0 ? et(t) : e === "video";
|
|
834
|
+
}
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/core/feedReplacementPreload.ts
|
|
837
|
+
function nt(e, t, n) {
|
|
838
|
+
let r = P(e);
|
|
839
|
+
if (r.length < 2) return null;
|
|
840
|
+
let i = F(e, t), a = r[i < r.length - 1 ? i + 1 : i - 1];
|
|
841
|
+
return a ? N(a, n) : null;
|
|
842
|
+
}
|
|
843
|
+
function rt(e) {
|
|
844
|
+
if (tt(e.type, e.src)) {
|
|
845
|
+
let t = document.createElement("video");
|
|
846
|
+
return t.muted = !0, t.playsInline = !0, t.preload = "auto", t.src = e.src, t.load(), () => {
|
|
847
|
+
t.pause(), t.removeAttribute("src"), t.load();
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
let t = document.createElement("img");
|
|
851
|
+
return t.decoding = "async", t.fetchPriority = "low", t.src = e.src, t.decode?.().catch(() => void 0), () => {
|
|
852
|
+
t.onload = null, t.onerror = null;
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
//#endregion
|
|
856
|
+
//#region src/components/useFeedReplacementPreload.ts
|
|
857
|
+
function it(e) {
|
|
858
|
+
let t = r(() => e.layout() === "masonry" && e.mediaCard()?.feedPreload === "replacement"), n = r(() => !t.value || !e.mediaReady() ? null : nt(e.item(), e.mediaIndex(), e.mediaSource())), i = null;
|
|
859
|
+
O([
|
|
860
|
+
t,
|
|
861
|
+
() => e.mediaReady(),
|
|
862
|
+
() => n.value && `${n.value.type ?? ""}:${n.value.src}`
|
|
863
|
+
], ([e, t]) => {
|
|
864
|
+
e && !t || (i?.(), i = e && n.value ? rt(n.value) : null);
|
|
865
|
+
}, { immediate: !0 }), v(() => i?.());
|
|
866
|
+
}
|
|
759
867
|
//#endregion
|
|
760
868
|
//#region src/components/useReelVideoActivity.ts
|
|
761
|
-
function
|
|
869
|
+
function at(e) {
|
|
762
870
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
763
871
|
function i() {
|
|
764
872
|
if (!t.value) {
|
|
@@ -791,22 +899,9 @@ function qe(e) {
|
|
|
791
899
|
};
|
|
792
900
|
}
|
|
793
901
|
//#endregion
|
|
794
|
-
//#region src/core/mediaType.ts
|
|
795
|
-
var Je = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
796
|
-
function Ye(e) {
|
|
797
|
-
try {
|
|
798
|
-
return Je.test(new URL(e).pathname);
|
|
799
|
-
} catch {
|
|
800
|
-
return Je.test(e.split("?")[0] ?? e);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
function Xe(e, t) {
|
|
804
|
-
return e === void 0 ? Ye(t) : e === "video";
|
|
805
|
-
}
|
|
806
|
-
//#endregion
|
|
807
902
|
//#region src/components/useMediaLoading.ts
|
|
808
|
-
function
|
|
809
|
-
let t = r(() =>
|
|
903
|
+
function ot(e) {
|
|
904
|
+
let t = r(() => tt(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
|
|
810
905
|
return O(i, (t, n) => {
|
|
811
906
|
n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
|
|
812
907
|
}), {
|
|
@@ -817,7 +912,7 @@ function Ze(e) {
|
|
|
817
912
|
}
|
|
818
913
|
//#endregion
|
|
819
914
|
//#region src/components/useMediaReadiness.ts
|
|
820
|
-
function
|
|
915
|
+
function st(e) {
|
|
821
916
|
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
822
917
|
function f() {
|
|
823
918
|
l !== null && clearTimeout(l), l = null;
|
|
@@ -875,7 +970,7 @@ function Qe(e) {
|
|
|
875
970
|
}
|
|
876
971
|
//#endregion
|
|
877
972
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
878
|
-
var
|
|
973
|
+
var ct = [
|
|
879
974
|
"data-post-id",
|
|
880
975
|
"data-media-index",
|
|
881
976
|
"aria-hidden",
|
|
@@ -883,12 +978,12 @@ var $e = [
|
|
|
883
978
|
"inert",
|
|
884
979
|
"role",
|
|
885
980
|
"tabindex"
|
|
886
|
-
],
|
|
981
|
+
], lt = { class: "media-card-content" }, ut = ["data-media-direction"], dt = ["data-media-index"], ft = {
|
|
887
982
|
key: 0,
|
|
888
983
|
"data-test": "media-loading",
|
|
889
984
|
class: "media-loading",
|
|
890
985
|
"aria-hidden": "true"
|
|
891
|
-
},
|
|
986
|
+
}, pt = [
|
|
892
987
|
"data-source-generation",
|
|
893
988
|
"src",
|
|
894
989
|
"width",
|
|
@@ -897,14 +992,14 @@ var $e = [
|
|
|
897
992
|
"loop",
|
|
898
993
|
"muted",
|
|
899
994
|
"preload"
|
|
900
|
-
],
|
|
995
|
+
], mt = [
|
|
901
996
|
"data-source-generation",
|
|
902
997
|
"src",
|
|
903
998
|
"width",
|
|
904
999
|
"height",
|
|
905
1000
|
"fetchpriority",
|
|
906
1001
|
"loading"
|
|
907
|
-
],
|
|
1002
|
+
], ht = ["aria-label"], gt = ["aria-label"], _t = ["aria-label"], vt = 40, yt = 160, bt = 24, xt = /* @__PURE__ */ d({
|
|
908
1003
|
__name: "MediaCard",
|
|
909
1004
|
props: {
|
|
910
1005
|
active: { type: Boolean },
|
|
@@ -925,6 +1020,7 @@ var $e = [
|
|
|
925
1020
|
mediaSource: {},
|
|
926
1021
|
previewState: {},
|
|
927
1022
|
reelControlsTarget: {},
|
|
1023
|
+
reelAudioState: {},
|
|
928
1024
|
stationaryReelControls: { type: Boolean },
|
|
929
1025
|
total: {}
|
|
930
1026
|
},
|
|
@@ -933,112 +1029,119 @@ var $e = [
|
|
|
933
1029
|
"ended",
|
|
934
1030
|
"error",
|
|
935
1031
|
"mediaChange",
|
|
936
|
-
"ready"
|
|
1032
|
+
"ready",
|
|
1033
|
+
"reelAudioChange"
|
|
937
1034
|
],
|
|
938
1035
|
setup(e, { emit: i }) {
|
|
939
1036
|
let l = e, d = null, f = 0, p = !1, m = null, g = null, y = w("next"), x = i;
|
|
940
1037
|
function S(e = !1, t = "pointer") {
|
|
941
1038
|
e && x("activate", t);
|
|
942
1039
|
}
|
|
943
|
-
let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement:
|
|
1040
|
+
let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: H, markSourceReady: U, noteSourceActivity: W, retrySource: ee, retrying: te, sourceGeneration: G, videoElement: K } = st({
|
|
944
1041
|
identity: () => `${l.item.postId}:${T.value}:${l.mediaSource ?? "preview"}:${M.value}:${L.value ?? ""}`,
|
|
945
1042
|
mediaIndex: () => T.value,
|
|
946
1043
|
onError: (e) => x("error", e),
|
|
947
1044
|
onReady: (e) => x("ready", e),
|
|
948
1045
|
previewState: () => l.previewState
|
|
949
|
-
})
|
|
1046
|
+
});
|
|
1047
|
+
it({
|
|
1048
|
+
item: () => l.item,
|
|
1049
|
+
layout: () => l.layout,
|
|
1050
|
+
mediaCard: () => l.mediaCard,
|
|
1051
|
+
mediaIndex: () => T.value,
|
|
1052
|
+
mediaReady: () => B.value === "ready",
|
|
1053
|
+
mediaSource: () => l.mediaSource ?? "preview"
|
|
1054
|
+
});
|
|
1055
|
+
let ne = w(0), re = w(0), q = w(!1), { apply: ie, setVolume: ae, sync: oe, toggleMute: se, videoIsMuted: J, videoVolume: ce } = Qe({
|
|
950
1056
|
active: () => l.active,
|
|
951
1057
|
layout: () => l.layout,
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1058
|
+
mediaCard: () => l.mediaCard,
|
|
1059
|
+
onChange: (e) => x("reelAudioChange", e),
|
|
1060
|
+
reelAudioState: () => l.reelAudioState,
|
|
1061
|
+
videoElement: K
|
|
1062
|
+
}), { effectiveMuted: le, onPlaying: ue, playbackAllowed: de } = at({
|
|
1063
|
+
active: () => l.active,
|
|
1064
|
+
layout: () => l.layout,
|
|
1065
|
+
videoElement: K,
|
|
1066
|
+
videoIsMuted: J,
|
|
1067
|
+
videoIsPlaying: q
|
|
1068
|
+
}), Y = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
1069
|
+
function fe(e) {
|
|
957
1070
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
958
1071
|
}
|
|
959
|
-
function
|
|
1072
|
+
function X(e, t) {
|
|
960
1073
|
let n = C.value.length, r = (e + n) % n;
|
|
961
1074
|
r !== T.value && (y.value = e < T.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
962
1075
|
}
|
|
963
|
-
function
|
|
1076
|
+
function pe(e, t, n) {
|
|
964
1077
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
965
1078
|
}
|
|
966
|
-
function
|
|
1079
|
+
function me() {
|
|
967
1080
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
968
1081
|
}
|
|
969
|
-
function
|
|
970
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
1082
|
+
function he() {
|
|
1083
|
+
d !== null && clearTimeout(d), d = setTimeout(me, yt);
|
|
971
1084
|
}
|
|
972
|
-
function
|
|
1085
|
+
function ge(e) {
|
|
973
1086
|
if (C.value.length <= 1) return;
|
|
974
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
975
|
-
if (n === 0 || (e.preventDefault(),
|
|
1087
|
+
let t = e.currentTarget?.clientWidth || 1, n = pe(e.deltaX, e.deltaMode, t);
|
|
1088
|
+
if (n === 0 || (e.preventDefault(), he(), p) || (f += n, Math.abs(f) < bt)) return;
|
|
976
1089
|
let r = Math.sign(f);
|
|
977
|
-
f = 0, p = !0,
|
|
1090
|
+
f = 0, p = !0, X(T.value + r);
|
|
978
1091
|
}
|
|
979
|
-
function
|
|
1092
|
+
function _e(e) {
|
|
980
1093
|
let t = e.touches[0];
|
|
981
1094
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
982
1095
|
}
|
|
983
|
-
function
|
|
1096
|
+
function ve(e) {
|
|
984
1097
|
let t = e.changedTouches[0];
|
|
985
1098
|
if (m === null || g === null || !t) return;
|
|
986
1099
|
let n = m - t.clientX, r = g - t.clientY;
|
|
987
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
1100
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < vt || X(T.value + Math.sign(n)));
|
|
988
1101
|
}
|
|
989
|
-
let { imageLoading:
|
|
1102
|
+
let { imageLoading: ye, mediaIsTimed: be, videoPreload: xe } = ot({
|
|
990
1103
|
active: () => l.active,
|
|
991
1104
|
fetchPriority: () => l.fetchPriority,
|
|
992
1105
|
layout: () => l.layout,
|
|
993
1106
|
mediaSource: () => M.value,
|
|
994
1107
|
mediaType: () => L.value,
|
|
995
|
-
videoElement:
|
|
996
|
-
}),
|
|
997
|
-
function
|
|
998
|
-
l.layout === "reel" && (e.stopPropagation(),
|
|
1108
|
+
videoElement: K
|
|
1109
|
+
}), Se = r(() => l.layout === "reel" && l.stationaryReelControls === !0), Ce = r(() => be.value && B.value === "ready" && (!Se.value || !!(l.active && l.reelControlsTarget))), we = r(() => `${l.item.postId}:${T.value}:${M.value}`);
|
|
1110
|
+
function Te(e) {
|
|
1111
|
+
l.layout === "reel" && (e.stopPropagation(), Ee());
|
|
999
1112
|
}
|
|
1000
|
-
async function
|
|
1001
|
-
if (!(!
|
|
1002
|
-
if (
|
|
1003
|
-
|
|
1113
|
+
async function Ee() {
|
|
1114
|
+
if (!(!K.value || !de.value)) {
|
|
1115
|
+
if (q.value) {
|
|
1116
|
+
K.value.pause();
|
|
1004
1117
|
return;
|
|
1005
1118
|
}
|
|
1006
1119
|
try {
|
|
1007
|
-
await
|
|
1120
|
+
await K.value.play();
|
|
1008
1121
|
} catch {
|
|
1009
|
-
|
|
1122
|
+
q.value = !1;
|
|
1010
1123
|
}
|
|
1011
1124
|
}
|
|
1012
1125
|
}
|
|
1013
|
-
function
|
|
1126
|
+
function ke(e) {
|
|
1014
1127
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
1015
1128
|
}
|
|
1016
|
-
function
|
|
1017
|
-
let t = e?.currentTarget ??
|
|
1018
|
-
t && (
|
|
1019
|
-
}
|
|
1020
|
-
function we(e) {
|
|
1021
|
-
Ce(e), H(e);
|
|
1129
|
+
function Ae(e) {
|
|
1130
|
+
let t = e?.currentTarget ?? K.value;
|
|
1131
|
+
t && (ne.value = ke(t.currentTime), re.value = ke(t.duration), oe(t, de.value));
|
|
1022
1132
|
}
|
|
1023
|
-
function
|
|
1024
|
-
|
|
1133
|
+
function je(e) {
|
|
1134
|
+
ie(), Ae(e), U(e);
|
|
1025
1135
|
}
|
|
1026
|
-
function
|
|
1027
|
-
|
|
1028
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(Se(t.duration), Math.max(0, e)), te.value = t.currentTime);
|
|
1136
|
+
function Me() {
|
|
1137
|
+
q.value = !1, x("ended", T.value);
|
|
1029
1138
|
}
|
|
1030
|
-
function
|
|
1031
|
-
let t =
|
|
1032
|
-
|
|
1033
|
-
let n = Math.min(1, Math.max(0, e));
|
|
1034
|
-
t.volume = n, t.muted = n === 0, n > 0 && (ie = n), Ce();
|
|
1035
|
-
}
|
|
1036
|
-
function Ae() {
|
|
1037
|
-
let e = q.value;
|
|
1038
|
-
e && (e.muted && e.volume === 0 && (e.volume = ie), e.muted = !e.muted, Ce());
|
|
1139
|
+
function Ne(e) {
|
|
1140
|
+
let t = K.value;
|
|
1141
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(ke(t.duration), Math.max(0, e)), ne.value = t.currentTime);
|
|
1039
1142
|
}
|
|
1040
1143
|
return v(() => {
|
|
1041
|
-
|
|
1144
|
+
me();
|
|
1042
1145
|
}), (r, i) => (b(), s("article", {
|
|
1043
1146
|
"data-post-id": e.item.postId,
|
|
1044
1147
|
"data-media-index": T.value,
|
|
@@ -1050,14 +1153,14 @@ var $e = [
|
|
|
1050
1153
|
}]),
|
|
1051
1154
|
style: _(e.itemStyle),
|
|
1052
1155
|
"aria-hidden": e.leaving || void 0,
|
|
1053
|
-
"aria-busy": E(B) === "loading" || E(
|
|
1156
|
+
"aria-busy": E(B) === "loading" || E(te),
|
|
1054
1157
|
inert: e.leaving || void 0,
|
|
1055
|
-
role: e.interactive && !e.leaving && !
|
|
1056
|
-
tabindex: e.interactive && !e.leaving && !
|
|
1057
|
-
onClick: i[14] ||= (t) => S(e.interactive && !
|
|
1058
|
-
onKeydown: [i[15] ||= A((t) => S(e.interactive && !
|
|
1059
|
-
}, [c("div",
|
|
1060
|
-
e.cardHeader ? (b(), a(
|
|
1158
|
+
role: e.interactive && !e.leaving && !Y.value ? "button" : void 0,
|
|
1159
|
+
tabindex: e.interactive && !e.leaving && !Y.value ? 0 : void 0,
|
|
1160
|
+
onClick: i[14] ||= (t) => S(e.interactive && !Y.value, fe(t)),
|
|
1161
|
+
onKeydown: [i[15] ||= A((t) => S(e.interactive && !Y.value, "keyboard"), ["enter"]), i[16] ||= A(j((t) => S(e.interactive && !Y.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1162
|
+
}, [c("div", lt, [
|
|
1163
|
+
e.cardHeader ? (b(), a(Ie, {
|
|
1061
1164
|
key: 0,
|
|
1062
1165
|
index: e.index,
|
|
1063
1166
|
item: e.item,
|
|
@@ -1083,36 +1186,36 @@ var $e = [
|
|
|
1083
1186
|
c("div", {
|
|
1084
1187
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
1085
1188
|
"data-media-direction": y.value,
|
|
1086
|
-
onWheel:
|
|
1087
|
-
onTouchstartPassive:
|
|
1088
|
-
onTouchendPassive:
|
|
1189
|
+
onWheel: ge,
|
|
1190
|
+
onTouchstartPassive: _e,
|
|
1191
|
+
onTouchendPassive: ve
|
|
1089
1192
|
}, [
|
|
1090
1193
|
u(n, {
|
|
1091
|
-
css: !E(
|
|
1194
|
+
css: !E(te),
|
|
1092
1195
|
name: `media-slide-${y.value}`
|
|
1093
1196
|
}, {
|
|
1094
1197
|
default: k(() => [(b(), s("div", {
|
|
1095
|
-
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(
|
|
1198
|
+
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(G)}`,
|
|
1096
1199
|
class: "media-card-frame",
|
|
1097
1200
|
"data-media-index": T.value
|
|
1098
|
-
}, [E(B) === "loading" ? (b(), s("div",
|
|
1201
|
+
}, [E(B) === "loading" ? (b(), s("div", ft, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Be, {
|
|
1099
1202
|
key: 1,
|
|
1100
1203
|
component: e.mediaCard?.error?.component,
|
|
1101
|
-
label: E(
|
|
1102
|
-
retrying: E(
|
|
1103
|
-
status: E(
|
|
1104
|
-
onRetry: E(
|
|
1204
|
+
label: E(Fe)(M.value),
|
|
1205
|
+
retrying: E(te),
|
|
1206
|
+
status: E(Pe)(M.value),
|
|
1207
|
+
onRetry: E(ee)
|
|
1105
1208
|
}, null, 8, [
|
|
1106
1209
|
"component",
|
|
1107
1210
|
"label",
|
|
1108
1211
|
"retrying",
|
|
1109
1212
|
"status",
|
|
1110
1213
|
"onRetry"
|
|
1111
|
-
])) : o("", !0), E(
|
|
1214
|
+
])) : o("", !0), E(be) ? (b(), s("video", {
|
|
1112
1215
|
key: 2,
|
|
1113
1216
|
ref_key: "videoElement",
|
|
1114
|
-
ref:
|
|
1115
|
-
"data-source-generation": E(
|
|
1217
|
+
ref: K,
|
|
1218
|
+
"data-source-generation": E(G),
|
|
1116
1219
|
class: h(["media-preview", {
|
|
1117
1220
|
"media-preview--ready": E(B) === "ready",
|
|
1118
1221
|
"media-preview--reel-video": e.layout === "reel"
|
|
@@ -1120,28 +1223,28 @@ var $e = [
|
|
|
1120
1223
|
src: M.value,
|
|
1121
1224
|
width: R.value ?? void 0,
|
|
1122
1225
|
height: z.value ?? void 0,
|
|
1123
|
-
autoplay: E(
|
|
1226
|
+
autoplay: E(de),
|
|
1124
1227
|
loop: !e.advanceOnMediaEnd,
|
|
1125
|
-
muted: E(
|
|
1228
|
+
muted: E(le),
|
|
1126
1229
|
playsinline: "",
|
|
1127
|
-
preload: E(
|
|
1128
|
-
onLoadedmetadata:
|
|
1129
|
-
onProgress: i[0] ||= (...e) => E(
|
|
1130
|
-
onLoadeddata: i[1] ||= (...e) => E(
|
|
1131
|
-
onCanplay: i[2] ||= (...e) => E(
|
|
1132
|
-
onDurationchange:
|
|
1133
|
-
onTimeupdate:
|
|
1134
|
-
onVolumechange:
|
|
1135
|
-
onPlaying: i[3] ||= (...e) => E(
|
|
1136
|
-
onPause: i[4] ||= (e) =>
|
|
1137
|
-
onEnded:
|
|
1138
|
-
onClick:
|
|
1230
|
+
preload: E(xe),
|
|
1231
|
+
onLoadedmetadata: je,
|
|
1232
|
+
onProgress: i[0] ||= (...e) => E(W) && E(W)(...e),
|
|
1233
|
+
onLoadeddata: i[1] ||= (...e) => E(W) && E(W)(...e),
|
|
1234
|
+
onCanplay: i[2] ||= (...e) => E(W) && E(W)(...e),
|
|
1235
|
+
onDurationchange: Ae,
|
|
1236
|
+
onTimeupdate: Ae,
|
|
1237
|
+
onVolumechange: Ae,
|
|
1238
|
+
onPlaying: i[3] ||= (...e) => E(ue) && E(ue)(...e),
|
|
1239
|
+
onPause: i[4] ||= (e) => q.value = !1,
|
|
1240
|
+
onEnded: Me,
|
|
1241
|
+
onClick: Te,
|
|
1139
1242
|
onError: i[5] ||= (...e) => E(V) && E(V)(...e)
|
|
1140
|
-
}, null, 42,
|
|
1243
|
+
}, null, 42, pt)) : (b(), s("img", {
|
|
1141
1244
|
key: 3,
|
|
1142
1245
|
ref_key: "imageElement",
|
|
1143
|
-
ref:
|
|
1144
|
-
"data-source-generation": E(
|
|
1246
|
+
ref: H,
|
|
1247
|
+
"data-source-generation": E(G),
|
|
1145
1248
|
class: h(["media-preview", { "media-preview--ready": E(B) === "ready" }]),
|
|
1146
1249
|
src: M.value,
|
|
1147
1250
|
width: R.value ?? void 0,
|
|
@@ -1149,32 +1252,32 @@ var $e = [
|
|
|
1149
1252
|
fetchpriority: e.fetchPriority,
|
|
1150
1253
|
alt: "",
|
|
1151
1254
|
decoding: "async",
|
|
1152
|
-
loading: E(
|
|
1153
|
-
onLoad: i[6] ||= (...e) => E(
|
|
1255
|
+
loading: E(ye),
|
|
1256
|
+
onLoad: i[6] ||= (...e) => E(U) && E(U)(...e),
|
|
1154
1257
|
onError: i[7] ||= (...e) => E(V) && E(V)(...e)
|
|
1155
|
-
}, null, 42,
|
|
1258
|
+
}, null, 42, mt))], 8, dt))]),
|
|
1156
1259
|
_: 1
|
|
1157
1260
|
}, 8, ["css", "name"]),
|
|
1158
1261
|
(b(), a(t, {
|
|
1159
|
-
disabled: !
|
|
1262
|
+
disabled: !Se.value || !e.reelControlsTarget,
|
|
1160
1263
|
to: e.reelControlsTarget ?? "body"
|
|
1161
1264
|
}, [u(n, {
|
|
1162
1265
|
name: "vibe-reel-media-controls",
|
|
1163
|
-
css:
|
|
1266
|
+
css: Se.value
|
|
1164
1267
|
}, {
|
|
1165
|
-
default: k(() => [
|
|
1166
|
-
key:
|
|
1167
|
-
"current-time":
|
|
1168
|
-
"data-control-post-id":
|
|
1169
|
-
duration:
|
|
1268
|
+
default: k(() => [Ce.value ? (b(), a(Je, {
|
|
1269
|
+
key: we.value,
|
|
1270
|
+
"current-time": ne.value,
|
|
1271
|
+
"data-control-post-id": Se.value ? e.item.postId : void 0,
|
|
1272
|
+
duration: re.value,
|
|
1170
1273
|
layout: e.layout,
|
|
1171
|
-
muted:
|
|
1172
|
-
playing:
|
|
1173
|
-
volume:
|
|
1174
|
-
onSeek:
|
|
1175
|
-
onToggleMute:
|
|
1176
|
-
onTogglePlayback:
|
|
1177
|
-
onVolumeChange:
|
|
1274
|
+
muted: E(J),
|
|
1275
|
+
playing: q.value,
|
|
1276
|
+
volume: E(ce),
|
|
1277
|
+
onSeek: Ne,
|
|
1278
|
+
onToggleMute: E(se),
|
|
1279
|
+
onTogglePlayback: Ee,
|
|
1280
|
+
onVolumeChange: E(ae)
|
|
1178
1281
|
}, null, 8, [
|
|
1179
1282
|
"current-time",
|
|
1180
1283
|
"data-control-post-id",
|
|
@@ -1182,7 +1285,9 @@ var $e = [
|
|
|
1182
1285
|
"layout",
|
|
1183
1286
|
"muted",
|
|
1184
1287
|
"playing",
|
|
1185
|
-
"volume"
|
|
1288
|
+
"volume",
|
|
1289
|
+
"onToggleMute",
|
|
1290
|
+
"onVolumeChange"
|
|
1186
1291
|
])) : o("", !0)]),
|
|
1187
1292
|
_: 1
|
|
1188
1293
|
}, 8, ["css"])], 8, ["disabled", "to"])),
|
|
@@ -1194,25 +1299,25 @@ var $e = [
|
|
|
1194
1299
|
type: "button",
|
|
1195
1300
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1196
1301
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1197
|
-
onClick: i[8] ||= j((e) =>
|
|
1302
|
+
onClick: i[8] ||= j((e) => X(T.value - 1, e), ["stop"]),
|
|
1198
1303
|
onKeydown: i[9] ||= j(() => {}, ["stop"])
|
|
1199
|
-
}, [u(E(
|
|
1304
|
+
}, [u(E(De), { size: 20 })], 40, ht), c("button", {
|
|
1200
1305
|
type: "button",
|
|
1201
1306
|
class: "media-carousel-control media-carousel-control--next",
|
|
1202
1307
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1203
|
-
onClick: i[10] ||= j((e) =>
|
|
1308
|
+
onClick: i[10] ||= j((e) => X(T.value + 1, e), ["stop"]),
|
|
1204
1309
|
onKeydown: i[11] ||= j(() => {}, ["stop"])
|
|
1205
|
-
}, [u(E(
|
|
1206
|
-
|
|
1310
|
+
}, [u(E(Oe), { size: 20 })], 40, gt)], 2)) : o("", !0),
|
|
1311
|
+
Y.value ? (b(), s("button", {
|
|
1207
1312
|
key: 1,
|
|
1208
1313
|
class: "media-card-activator",
|
|
1209
1314
|
type: "button",
|
|
1210
1315
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1211
|
-
onClick: i[12] ||= j((e) => r.$emit("activate",
|
|
1316
|
+
onClick: i[12] ||= j((e) => r.$emit("activate", fe(e)), ["stop"]),
|
|
1212
1317
|
onKeydown: i[13] ||= j(() => {}, ["stop"])
|
|
1213
|
-
}, null, 40,
|
|
1214
|
-
], 42,
|
|
1215
|
-
e.cardFooter ? (b(), a(
|
|
1318
|
+
}, null, 40, _t)) : o("", !0)
|
|
1319
|
+
], 42, ut),
|
|
1320
|
+
e.cardFooter ? (b(), a(Ie, {
|
|
1216
1321
|
key: 1,
|
|
1217
1322
|
index: e.index,
|
|
1218
1323
|
item: e.item,
|
|
@@ -1235,12 +1340,12 @@ var $e = [
|
|
|
1235
1340
|
"style",
|
|
1236
1341
|
"total"
|
|
1237
1342
|
])) : o("", !0)
|
|
1238
|
-
])], 46,
|
|
1343
|
+
])], 46, ct));
|
|
1239
1344
|
}
|
|
1240
|
-
}),
|
|
1345
|
+
}), St = { class: "masonry-feed-shell" }, Ct = ["aria-hidden", "inert"], wt = {
|
|
1241
1346
|
key: 0,
|
|
1242
1347
|
class: "masonry-feed-status-overlay"
|
|
1243
|
-
},
|
|
1348
|
+
}, Tt = 6, Et = 12, Dt = 250, Ot = /* @__PURE__ */ d({
|
|
1244
1349
|
__name: "MasonryFeed",
|
|
1245
1350
|
props: {
|
|
1246
1351
|
enteringPostIds: {},
|
|
@@ -1263,6 +1368,7 @@ var $e = [
|
|
|
1263
1368
|
mediaIndices: {},
|
|
1264
1369
|
nextPageError: { type: Boolean },
|
|
1265
1370
|
previewStates: {},
|
|
1371
|
+
reelAudioState: {},
|
|
1266
1372
|
state: {},
|
|
1267
1373
|
total: {}
|
|
1268
1374
|
},
|
|
@@ -1276,19 +1382,19 @@ var $e = [
|
|
|
1276
1382
|
"visible"
|
|
1277
1383
|
],
|
|
1278
1384
|
setup(t, { expose: n, emit: i }) {
|
|
1279
|
-
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(
|
|
1385
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(Tt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, R = r(() => oe(d.items, y.value, {
|
|
1280
1386
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1281
1387
|
gap: x.value,
|
|
1282
|
-
minColumnWidth:
|
|
1388
|
+
minColumnWidth: le(d.masonry)
|
|
1283
1389
|
})), z = r(() => {
|
|
1284
1390
|
if (d.leavingPostIds.size === 0) return null;
|
|
1285
1391
|
let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
|
|
1286
1392
|
index: t,
|
|
1287
1393
|
item: e
|
|
1288
|
-
}]), t =
|
|
1394
|
+
}]), t = oe(e.map(({ item: e }) => e), y.value, {
|
|
1289
1395
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1290
1396
|
gap: x.value,
|
|
1291
|
-
minColumnWidth:
|
|
1397
|
+
minColumnWidth: le(d.masonry)
|
|
1292
1398
|
});
|
|
1293
1399
|
return {
|
|
1294
1400
|
indices: e.map(({ index: e }) => e),
|
|
@@ -1301,50 +1407,50 @@ var $e = [
|
|
|
1301
1407
|
...t.layout,
|
|
1302
1408
|
items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
|
|
1303
1409
|
} : e;
|
|
1304
|
-
}), V = r(() =>
|
|
1410
|
+
}), V = r(() => se(R.value.items)), H = r(() => {
|
|
1305
1411
|
let e = z.value;
|
|
1306
|
-
return e ?
|
|
1307
|
-
}),
|
|
1412
|
+
return e ? se(e.layout.items, e.indices) : null;
|
|
1413
|
+
}), U = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), W = r(() => ({ height: `${U.value}px` })), ee = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), G = r(() => new Set(A.value)), K = r(() => j.value.flatMap((e) => {
|
|
1308
1414
|
let t = d.items[e];
|
|
1309
1415
|
return t ? [{
|
|
1310
|
-
fetchPriority:
|
|
1416
|
+
fetchPriority: G.value.has(e) ? "high" : "low",
|
|
1311
1417
|
index: e,
|
|
1312
1418
|
item: t
|
|
1313
1419
|
}] : [];
|
|
1314
1420
|
}));
|
|
1315
|
-
function
|
|
1421
|
+
function ne(e, t) {
|
|
1316
1422
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1317
1423
|
}
|
|
1318
|
-
function
|
|
1424
|
+
function q(e, t) {
|
|
1319
1425
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1320
1426
|
}
|
|
1321
|
-
function
|
|
1427
|
+
function ie(e) {
|
|
1322
1428
|
let t = {
|
|
1323
1429
|
scrollTop: M - k.value,
|
|
1324
1430
|
viewportHeight: C.value
|
|
1325
|
-
}, n =
|
|
1431
|
+
}, n = H.value, r = ce(n ?? V.value, {
|
|
1326
1432
|
...t,
|
|
1327
1433
|
overscan: e
|
|
1328
1434
|
}).indices;
|
|
1329
|
-
return
|
|
1435
|
+
return ne(r, d.leavingPostIds.size === 0 ? [] : ce(V.value, {
|
|
1330
1436
|
...t,
|
|
1331
1437
|
overscan: e
|
|
1332
1438
|
}).indices);
|
|
1333
1439
|
}
|
|
1334
|
-
function
|
|
1335
|
-
let e =
|
|
1336
|
-
|
|
1440
|
+
function J() {
|
|
1441
|
+
let e = ie(0), t = ie(ue(d.masonry, C.value));
|
|
1442
|
+
q(A.value, e) || (A.value = e), q(j.value, t) || (j.value = t);
|
|
1337
1443
|
}
|
|
1338
|
-
function
|
|
1444
|
+
function de() {
|
|
1339
1445
|
if (I !== null) return;
|
|
1340
1446
|
I = -1;
|
|
1341
1447
|
let e = requestAnimationFrame(() => {
|
|
1342
|
-
I = null,
|
|
1448
|
+
I = null, J();
|
|
1343
1449
|
});
|
|
1344
1450
|
I !== null && (I = e);
|
|
1345
1451
|
}
|
|
1346
|
-
let
|
|
1347
|
-
O(() => [...
|
|
1452
|
+
let Y = /* @__PURE__ */ new Set();
|
|
1453
|
+
O(() => [...G.value].flatMap((e) => {
|
|
1348
1454
|
let t = d.items[e];
|
|
1349
1455
|
if (!t) return [];
|
|
1350
1456
|
let n = d.mediaIndices.get(t.postId) ?? 0, r = L(t.postId, n);
|
|
@@ -1356,16 +1462,16 @@ var $e = [
|
|
|
1356
1462
|
}), (e) => {
|
|
1357
1463
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1358
1464
|
e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
|
|
1359
|
-
|
|
1360
|
-
}),
|
|
1465
|
+
Y.has(e) || f("visible", n, t);
|
|
1466
|
+
}), Y = t;
|
|
1361
1467
|
}, {
|
|
1362
1468
|
immediate: !0,
|
|
1363
1469
|
flush: "post"
|
|
1364
1470
|
});
|
|
1365
|
-
function
|
|
1471
|
+
function fe(e) {
|
|
1366
1472
|
let t = B.value.items[e], n = d.items[e]?.postId;
|
|
1367
1473
|
if (!t) return {};
|
|
1368
|
-
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ?
|
|
1474
|
+
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? ae({
|
|
1369
1475
|
containerHeight: Math.max(T.value, R.value.height),
|
|
1370
1476
|
gap: x.value
|
|
1371
1477
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -1376,52 +1482,52 @@ var $e = [
|
|
|
1376
1482
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1377
1483
|
};
|
|
1378
1484
|
}
|
|
1379
|
-
function
|
|
1485
|
+
function X() {
|
|
1380
1486
|
let e = p.value;
|
|
1381
1487
|
if (!e) return;
|
|
1382
1488
|
M = e.scrollTop, C.value = e.clientHeight;
|
|
1383
1489
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
1384
1490
|
T.value = Math.max(0, e.clientHeight - n);
|
|
1385
1491
|
let r = g.value;
|
|
1386
|
-
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop,
|
|
1492
|
+
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, J());
|
|
1387
1493
|
}
|
|
1388
|
-
function
|
|
1494
|
+
function pe(e) {
|
|
1389
1495
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1390
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
1496
|
+
y.value = e.clientWidth, x.value = Math.min(Et, Math.max(Tt, t * .0075)), X();
|
|
1391
1497
|
}
|
|
1392
|
-
function
|
|
1498
|
+
function me(e) {
|
|
1393
1499
|
let t = e.currentTarget;
|
|
1394
|
-
t && (M = t.scrollTop,
|
|
1500
|
+
t && (M = t.scrollTop, de(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && re(t) && f("loadMore"));
|
|
1395
1501
|
}
|
|
1396
|
-
function
|
|
1502
|
+
function he() {
|
|
1397
1503
|
let e = p.value;
|
|
1398
|
-
Date.now() >= l && !d.loadMoreLocked && e &&
|
|
1504
|
+
Date.now() >= l && !d.loadMoreLocked && e && re(e) && f("loadMore");
|
|
1399
1505
|
}
|
|
1400
1506
|
O(() => d.items.length, (e, t) => {
|
|
1401
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1507
|
+
e > 0 && e < t && (l = Date.now() + Dt);
|
|
1402
1508
|
});
|
|
1403
|
-
function
|
|
1509
|
+
function ge() {
|
|
1404
1510
|
return p.value;
|
|
1405
1511
|
}
|
|
1406
1512
|
return O(g, (e) => {
|
|
1407
|
-
N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (
|
|
1513
|
+
N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (pe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
|
|
1408
1514
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1409
1515
|
Math.abs(n - y.value) < .5 || (F = requestAnimationFrame(() => {
|
|
1410
|
-
F = null,
|
|
1516
|
+
F = null, pe(e);
|
|
1411
1517
|
}));
|
|
1412
1518
|
}), N.observe(e)));
|
|
1413
1519
|
}), O(p, (e) => {
|
|
1414
|
-
P?.disconnect(), P = null, e && (
|
|
1520
|
+
P?.disconnect(), P = null, e && (X(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(X), P.observe(e)));
|
|
1415
1521
|
}), O([
|
|
1416
1522
|
R,
|
|
1417
1523
|
B,
|
|
1418
1524
|
() => d.masonry
|
|
1419
|
-
],
|
|
1525
|
+
], J, { flush: "post" }), v(() => {
|
|
1420
1526
|
N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
|
|
1421
1527
|
}), n({
|
|
1422
|
-
getScrollElement:
|
|
1423
|
-
loadIfNearBottom:
|
|
1424
|
-
}), (n, r) => (b(), s("div",
|
|
1528
|
+
getScrollElement: ge,
|
|
1529
|
+
loadIfNearBottom: he
|
|
1530
|
+
}), (n, r) => (b(), s("div", St, [
|
|
1425
1531
|
c("main", {
|
|
1426
1532
|
id: m,
|
|
1427
1533
|
ref_key: "galleryElement",
|
|
@@ -1430,14 +1536,14 @@ var $e = [
|
|
|
1430
1536
|
"data-layout-mode": "masonry",
|
|
1431
1537
|
"aria-hidden": t.suspended || void 0,
|
|
1432
1538
|
inert: t.suspended || void 0,
|
|
1433
|
-
onScrollPassive:
|
|
1539
|
+
onScrollPassive: me
|
|
1434
1540
|
}, [c("section", {
|
|
1435
1541
|
ref_key: "masonryElement",
|
|
1436
1542
|
ref: g,
|
|
1437
1543
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
1438
|
-
style: _(
|
|
1544
|
+
style: _(W.value),
|
|
1439
1545
|
"aria-label": "Media gallery"
|
|
1440
|
-
}, [(b(!0), s(e, null, S(
|
|
1546
|
+
}, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(xt, {
|
|
1441
1547
|
key: n.postId,
|
|
1442
1548
|
class: "masonry-item",
|
|
1443
1549
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1448,7 +1554,7 @@ var $e = [
|
|
|
1448
1554
|
"media-card": t.mediaCard,
|
|
1449
1555
|
index: r,
|
|
1450
1556
|
item: n,
|
|
1451
|
-
"item-style":
|
|
1557
|
+
"item-style": fe(r),
|
|
1452
1558
|
interactive: "",
|
|
1453
1559
|
layout: "masonry",
|
|
1454
1560
|
"loaded-count": t.items.length,
|
|
@@ -1477,8 +1583,8 @@ var $e = [
|
|
|
1477
1583
|
"onMediaChange",
|
|
1478
1584
|
"onReady",
|
|
1479
1585
|
"onError"
|
|
1480
|
-
]))), 128))], 6)], 42,
|
|
1481
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext &&
|
|
1586
|
+
]))), 128))], 6)], 42, Ct),
|
|
1587
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ee.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", wt, [u(te, {
|
|
1482
1588
|
actions: t.feedFooterActions,
|
|
1483
1589
|
"can-retry-end": t.canRetryEnd,
|
|
1484
1590
|
"feed-footer": t.feedFooter,
|
|
@@ -1486,7 +1592,7 @@ var $e = [
|
|
|
1486
1592
|
"has-next": t.hasNext,
|
|
1487
1593
|
"is-loading": t.isLoadingMore,
|
|
1488
1594
|
"load-more-locked": t.loadMoreLocked,
|
|
1489
|
-
"show-load-more":
|
|
1595
|
+
"show-load-more": ee.value,
|
|
1490
1596
|
state: t.state,
|
|
1491
1597
|
onLoadMore: r[0] ||= (e) => f("loadMore"),
|
|
1492
1598
|
onRetryEnd: r[1] ||= (e) => f("retryEnd")
|
|
@@ -1501,7 +1607,7 @@ var $e = [
|
|
|
1501
1607
|
"show-load-more",
|
|
1502
1608
|
"state"
|
|
1503
1609
|
])])) : o("", !0),
|
|
1504
|
-
u(
|
|
1610
|
+
u(_e, {
|
|
1505
1611
|
"content-size": B.value.height,
|
|
1506
1612
|
"controls-id": m,
|
|
1507
1613
|
"scroll-element": p.value,
|
|
@@ -1513,8 +1619,8 @@ var $e = [
|
|
|
1513
1619
|
])
|
|
1514
1620
|
]));
|
|
1515
1621
|
}
|
|
1516
|
-
}),
|
|
1517
|
-
function
|
|
1622
|
+
}), kt = 300;
|
|
1623
|
+
function At(e, t, n) {
|
|
1518
1624
|
let r = e.scrollTop;
|
|
1519
1625
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1520
1626
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1522,7 +1628,7 @@ function xt(e, t, n) {
|
|
|
1522
1628
|
return new Promise((n) => {
|
|
1523
1629
|
let o = (s) => {
|
|
1524
1630
|
a += 1;
|
|
1525
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1631
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / kt), u = 1 - (1 - l) ** 3;
|
|
1526
1632
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1527
1633
|
requestAnimationFrame(o);
|
|
1528
1634
|
return;
|
|
@@ -1534,7 +1640,7 @@ function xt(e, t, n) {
|
|
|
1534
1640
|
}
|
|
1535
1641
|
//#endregion
|
|
1536
1642
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1537
|
-
var
|
|
1643
|
+
var jt = ["aria-label"], Mt = /* @__PURE__ */ d({
|
|
1538
1644
|
__name: "ReelAutoAdvanceProgress",
|
|
1539
1645
|
props: {
|
|
1540
1646
|
durationMs: {},
|
|
@@ -1552,9 +1658,9 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1552
1658
|
class: "reel-auto-advance-progress",
|
|
1553
1659
|
style: _(a.value),
|
|
1554
1660
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1555
|
-
}, null, 36)], 8,
|
|
1661
|
+
}, null, 36)], 8, jt));
|
|
1556
1662
|
}
|
|
1557
|
-
}),
|
|
1663
|
+
}), Nt = { class: "reel-viewport" }, Pt = ["data-active-post-id", "data-active-media-index"], Ft = ["role", "data-status"], It = 300, Lt = 250, Rt = /* @__PURE__ */ d({
|
|
1558
1664
|
__name: "ReelFeed",
|
|
1559
1665
|
props: {
|
|
1560
1666
|
initialPostId: {},
|
|
@@ -1578,6 +1684,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1578
1684
|
mediaIndices: {},
|
|
1579
1685
|
nextPageError: { type: Boolean },
|
|
1580
1686
|
previewStates: {},
|
|
1687
|
+
reelAudioState: {},
|
|
1581
1688
|
state: {},
|
|
1582
1689
|
total: {}
|
|
1583
1690
|
},
|
|
@@ -1587,12 +1694,13 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1587
1694
|
"loadMore",
|
|
1588
1695
|
"mediaChange",
|
|
1589
1696
|
"ready",
|
|
1697
|
+
"reelAudioChange",
|
|
1590
1698
|
"retryEnd",
|
|
1591
1699
|
"retryForward"
|
|
1592
1700
|
],
|
|
1593
1701
|
setup(t, { expose: n, emit: i }) {
|
|
1594
1702
|
let l = 0, u = t, d = i, f = w(null), p = w(null), g = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), x = w(Math.max(0, g)), C = w(!1), D = w(!1), k = 0, A = null, j = null, M = null, F = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), R = r(() => {
|
|
1595
|
-
let e = Math.max(0, x.value -
|
|
1703
|
+
let e = Math.max(0, x.value - 2), t = Math.min(u.items.length - 1, x.value + 2);
|
|
1596
1704
|
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
1597
1705
|
fetchPriority: e + n === x.value ? "high" : "low",
|
|
1598
1706
|
index: e + n,
|
|
@@ -1601,10 +1709,10 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1601
1709
|
}), z = r(() => u.items[x.value]?.postId), B = r(() => u.items[x.value]), V = r(() => {
|
|
1602
1710
|
let e = z.value;
|
|
1603
1711
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
1604
|
-
}),
|
|
1712
|
+
}), H = r(() => {
|
|
1605
1713
|
let e = z.value;
|
|
1606
1714
|
return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
|
|
1607
|
-
}),
|
|
1715
|
+
}), U = r(() => B.value ? I(B.value, V.value) : null), W = r(() => U.value ? N(U.value, u.mediaSource ?? "preview") : null), ee = r(() => H.value === "ready" && !!(W.value && tt(W.value.type, W.value.src))), G = r(() => [
|
|
1608
1716
|
z.value,
|
|
1609
1717
|
V.value,
|
|
1610
1718
|
u.items.length,
|
|
@@ -1612,52 +1720,52 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1612
1720
|
u.reelAutoAdvance.enabled,
|
|
1613
1721
|
u.reelAutoAdvance.includePostItems,
|
|
1614
1722
|
u.reelAutoAdvance.intervalMs
|
|
1615
|
-
].join(":")),
|
|
1723
|
+
].join(":")), K = r(() => {
|
|
1616
1724
|
let e = B.value, t = !!(e && u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
1617
1725
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1618
|
-
}),
|
|
1619
|
-
function
|
|
1726
|
+
}), ne = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && B.value !== void 0 && H.value !== "loading" && !ee.value), q = r(() => !u.infiniteScroll || u.items.length <= 1), ie = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
|
|
1727
|
+
function ae(e) {
|
|
1620
1728
|
return { gridRow: `${e + 1}` };
|
|
1621
1729
|
}
|
|
1622
|
-
function
|
|
1730
|
+
function oe(e) {
|
|
1623
1731
|
let t = k || e.clientHeight;
|
|
1624
1732
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1625
1733
|
}
|
|
1626
|
-
function
|
|
1734
|
+
function se(e) {
|
|
1627
1735
|
let t = e.currentTarget;
|
|
1628
1736
|
if (!t) return;
|
|
1629
1737
|
let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
1630
|
-
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value =
|
|
1738
|
+
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = oe(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && re(t) && d("loadMore");
|
|
1631
1739
|
}
|
|
1632
|
-
function
|
|
1740
|
+
function J() {
|
|
1633
1741
|
let e = f.value;
|
|
1634
|
-
e && (C.value = !1,
|
|
1742
|
+
e && (C.value = !1, ue(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
1635
1743
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
1636
|
-
}),
|
|
1744
|
+
}), ce());
|
|
1637
1745
|
}
|
|
1638
|
-
function
|
|
1746
|
+
function ce() {
|
|
1639
1747
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
1640
1748
|
M = null;
|
|
1641
1749
|
let e = f.value;
|
|
1642
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1750
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), ue(!1);
|
|
1643
1751
|
}, 120);
|
|
1644
1752
|
}
|
|
1645
|
-
function
|
|
1646
|
-
|
|
1753
|
+
function le() {
|
|
1754
|
+
ue(!0);
|
|
1647
1755
|
let e = f.value;
|
|
1648
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1756
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), ce();
|
|
1649
1757
|
}
|
|
1650
|
-
function
|
|
1758
|
+
function ue(e) {
|
|
1651
1759
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
1652
1760
|
}
|
|
1653
|
-
function
|
|
1761
|
+
function de() {
|
|
1654
1762
|
let e = f.value;
|
|
1655
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
1763
|
+
Date.now() >= l && !u.loadMoreLocked && e && re(e) && d("loadMore");
|
|
1656
1764
|
}
|
|
1657
1765
|
O(() => u.items.length, (e, t) => {
|
|
1658
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1766
|
+
e > 0 && e < t && (l = Date.now() + Lt);
|
|
1659
1767
|
});
|
|
1660
|
-
function
|
|
1768
|
+
function Y(e) {
|
|
1661
1769
|
let t = B.value;
|
|
1662
1770
|
if (!t) return !1;
|
|
1663
1771
|
let n = P(t).length;
|
|
@@ -1665,34 +1773,34 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1665
1773
|
let r = (V.value + e + n) % n;
|
|
1666
1774
|
return d("mediaChange", t.postId, r), !0;
|
|
1667
1775
|
}
|
|
1668
|
-
function
|
|
1776
|
+
function fe(e) {
|
|
1669
1777
|
let t = x.value + e;
|
|
1670
|
-
return !f.value || t < 0 || t >= u.items.length ? !1 : (
|
|
1778
|
+
return !f.value || t < 0 || t >= u.items.length ? !1 : (he(t), !0);
|
|
1671
1779
|
}
|
|
1672
|
-
function
|
|
1780
|
+
function X(e, t) {
|
|
1673
1781
|
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
1674
|
-
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value &&
|
|
1782
|
+
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && he(n), !0);
|
|
1675
1783
|
}
|
|
1676
|
-
function
|
|
1784
|
+
function pe() {
|
|
1677
1785
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1678
1786
|
}
|
|
1679
|
-
function
|
|
1787
|
+
function me(e) {
|
|
1680
1788
|
let t = f.value;
|
|
1681
1789
|
if (!t) return Promise.resolve();
|
|
1682
1790
|
let n = e * (k || t.clientHeight);
|
|
1683
|
-
return x.value = e,
|
|
1791
|
+
return x.value = e, At(t, n, pe());
|
|
1684
1792
|
}
|
|
1685
|
-
function
|
|
1686
|
-
|
|
1793
|
+
function he(e) {
|
|
1794
|
+
me(e);
|
|
1687
1795
|
}
|
|
1688
|
-
async function
|
|
1796
|
+
async function ge(e) {
|
|
1689
1797
|
let t = u.items.findIndex((t) => t.postId === e);
|
|
1690
|
-
return t < 0 || t === x.value ? !1 : (await
|
|
1798
|
+
return t < 0 || t === x.value ? !1 : (await me(t), !0);
|
|
1691
1799
|
}
|
|
1692
|
-
async function
|
|
1693
|
-
return
|
|
1800
|
+
async function _e(e) {
|
|
1801
|
+
return Y(e) ? (pe() || await new Promise((e) => setTimeout(e, It)), !0) : !1;
|
|
1694
1802
|
}
|
|
1695
|
-
function
|
|
1803
|
+
function ve() {
|
|
1696
1804
|
if (!u.reelAutoAdvance.enabled) return;
|
|
1697
1805
|
let e = B.value;
|
|
1698
1806
|
if (!e) return;
|
|
@@ -1705,31 +1813,31 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1705
1813
|
u.hasNext && !u.loadMoreLocked && d("loadMore");
|
|
1706
1814
|
return;
|
|
1707
1815
|
}
|
|
1708
|
-
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0),
|
|
1816
|
+
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), he(t);
|
|
1709
1817
|
}
|
|
1710
|
-
function
|
|
1711
|
-
!u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !
|
|
1818
|
+
function ye(e, t) {
|
|
1819
|
+
!u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !ee.value || ve();
|
|
1712
1820
|
}
|
|
1713
1821
|
return O(f, (e) => {
|
|
1714
|
-
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(
|
|
1822
|
+
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(J), A.observe(e)));
|
|
1715
1823
|
}), O(() => u.items.length, async (e) => {
|
|
1716
1824
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
1717
|
-
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(),
|
|
1825
|
+
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), J();
|
|
1718
1826
|
}), O(z, (e) => {
|
|
1719
1827
|
e !== void 0 && d("activeChange", e);
|
|
1720
1828
|
}, { immediate: !0 }), y(() => {
|
|
1721
|
-
window.addEventListener("resize",
|
|
1829
|
+
window.addEventListener("resize", le), window.addEventListener("orientationchange", le), g >= 0 && m(J);
|
|
1722
1830
|
}), v(() => {
|
|
1723
|
-
window.removeEventListener("resize",
|
|
1831
|
+
window.removeEventListener("resize", le), window.removeEventListener("orientationchange", le), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
1724
1832
|
}), n({
|
|
1725
1833
|
activeIndex: x,
|
|
1726
1834
|
activePostId: z,
|
|
1727
|
-
changeActiveMedia:
|
|
1728
|
-
loadIfNearBottom:
|
|
1729
|
-
moveActivePost:
|
|
1730
|
-
navigateToItem:
|
|
1731
|
-
transitionActiveMedia:
|
|
1732
|
-
transitionActivePost:
|
|
1835
|
+
changeActiveMedia: Y,
|
|
1836
|
+
loadIfNearBottom: de,
|
|
1837
|
+
moveActivePost: fe,
|
|
1838
|
+
navigateToItem: X,
|
|
1839
|
+
transitionActiveMedia: _e,
|
|
1840
|
+
transitionActivePost: ge
|
|
1733
1841
|
}), (n, r) => (b(), s("main", {
|
|
1734
1842
|
class: h(["reel-shell", {
|
|
1735
1843
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1737,7 +1845,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1737
1845
|
}]),
|
|
1738
1846
|
"data-layout-mode": "reel"
|
|
1739
1847
|
}, [
|
|
1740
|
-
t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1848
|
+
t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(Ie, {
|
|
1741
1849
|
key: 0,
|
|
1742
1850
|
index: x.value,
|
|
1743
1851
|
item: B.value,
|
|
@@ -1759,28 +1867,28 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1759
1867
|
"style",
|
|
1760
1868
|
"total"
|
|
1761
1869
|
])) : o("", !0),
|
|
1762
|
-
c("div",
|
|
1870
|
+
c("div", Nt, [c("div", {
|
|
1763
1871
|
ref_key: "galleryElement",
|
|
1764
1872
|
ref: f,
|
|
1765
1873
|
class: "gallery-shell reel-feed",
|
|
1766
1874
|
"data-active-post-id": z.value,
|
|
1767
1875
|
"data-active-media-index": V.value,
|
|
1768
|
-
onScrollPassive:
|
|
1876
|
+
onScrollPassive: se
|
|
1769
1877
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1770
1878
|
key: 1,
|
|
1771
1879
|
class: "reel-track",
|
|
1772
1880
|
style: _(F.value),
|
|
1773
1881
|
"aria-label": "Media gallery"
|
|
1774
|
-
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index:
|
|
1882
|
+
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(xt, {
|
|
1775
1883
|
key: n.postId,
|
|
1776
|
-
active:
|
|
1777
|
-
"advance-on-media-end": u.reelAutoAdvance.enabled &&
|
|
1884
|
+
active: i === x.value && !C.value,
|
|
1885
|
+
"advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
|
|
1778
1886
|
class: "reel-item",
|
|
1779
1887
|
entering: !1,
|
|
1780
1888
|
"fetch-priority": e,
|
|
1781
|
-
index:
|
|
1889
|
+
index: i,
|
|
1782
1890
|
item: n,
|
|
1783
|
-
"item-style":
|
|
1891
|
+
"item-style": ae(i),
|
|
1784
1892
|
"media-card": t.mediaCard,
|
|
1785
1893
|
layout: "reel",
|
|
1786
1894
|
"loaded-count": t.items.length,
|
|
@@ -1788,11 +1896,13 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1788
1896
|
"media-source": t.mediaSource,
|
|
1789
1897
|
"preview-state": t.previewStates.get(E(L)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1790
1898
|
"reel-controls-target": p.value,
|
|
1899
|
+
"reel-audio-state": t.reelAudioState,
|
|
1791
1900
|
"stationary-reel-controls": "",
|
|
1792
1901
|
total: t.total,
|
|
1793
1902
|
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
1794
|
-
onEnded: (e) =>
|
|
1903
|
+
onEnded: (e) => ye(n.postId, e),
|
|
1795
1904
|
onReady: (e) => d("ready", n.postId, e),
|
|
1905
|
+
onReelAudioChange: r[1] ||= (e) => d("reelAudioChange", e),
|
|
1796
1906
|
onError: (e) => d("error", n.postId, e)
|
|
1797
1907
|
}, null, 8, [
|
|
1798
1908
|
"active",
|
|
@@ -1807,6 +1917,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1807
1917
|
"media-source",
|
|
1808
1918
|
"preview-state",
|
|
1809
1919
|
"reel-controls-target",
|
|
1920
|
+
"reel-audio-state",
|
|
1810
1921
|
"total",
|
|
1811
1922
|
"onMediaChange",
|
|
1812
1923
|
"onEnded",
|
|
@@ -1817,12 +1928,12 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1817
1928
|
class: "reel-forward-status",
|
|
1818
1929
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1819
1930
|
"data-status": t.reelForward.status
|
|
1820
|
-
}, [c("p", null, T(
|
|
1931
|
+
}, [c("p", null, T(ie.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1821
1932
|
key: 0,
|
|
1822
1933
|
class: "reel-forward-retry",
|
|
1823
1934
|
type: "button",
|
|
1824
1935
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
1825
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1936
|
+
}, " Retry ")) : o("", !0)], 8, Ft)), t.reelForward.status === "idle" ? (b(), a(te, {
|
|
1826
1937
|
key: 2,
|
|
1827
1938
|
actions: t.feedFooterActions,
|
|
1828
1939
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1831,10 +1942,10 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1831
1942
|
"has-next": t.hasNext,
|
|
1832
1943
|
"is-loading": t.isLoadingMore,
|
|
1833
1944
|
"load-more-locked": t.loadMoreLocked,
|
|
1834
|
-
"show-load-more":
|
|
1945
|
+
"show-load-more": q.value,
|
|
1835
1946
|
state: t.state,
|
|
1836
|
-
onLoadMore: r[
|
|
1837
|
-
onRetryEnd: r[
|
|
1947
|
+
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
1948
|
+
onRetryEnd: r[3] ||= (e) => d("retryEnd")
|
|
1838
1949
|
}, null, 8, [
|
|
1839
1950
|
"actions",
|
|
1840
1951
|
"can-retry-end",
|
|
@@ -1845,13 +1956,13 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1845
1956
|
"load-more-locked",
|
|
1846
1957
|
"show-load-more",
|
|
1847
1958
|
"state"
|
|
1848
|
-
])) : o("", !0)], 40,
|
|
1959
|
+
])) : o("", !0)], 40, Pt), c("div", {
|
|
1849
1960
|
ref_key: "reelControlsElement",
|
|
1850
1961
|
ref: p,
|
|
1851
1962
|
class: "reel-media-controls-host",
|
|
1852
1963
|
"data-test": "reel-media-controls-host"
|
|
1853
1964
|
}, null, 512)]),
|
|
1854
|
-
t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1965
|
+
t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(Ie, {
|
|
1855
1966
|
key: 1,
|
|
1856
1967
|
index: x.value,
|
|
1857
1968
|
item: B.value,
|
|
@@ -1873,24 +1984,24 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1873
1984
|
"style",
|
|
1874
1985
|
"total"
|
|
1875
1986
|
])) : o("", !0),
|
|
1876
|
-
|
|
1877
|
-
key:
|
|
1987
|
+
ne.value ? (b(), a(Mt, {
|
|
1988
|
+
key: G.value,
|
|
1878
1989
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1879
|
-
label:
|
|
1880
|
-
onComplete:
|
|
1990
|
+
label: K.value,
|
|
1991
|
+
onComplete: ve
|
|
1881
1992
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1882
1993
|
], 2));
|
|
1883
1994
|
}
|
|
1884
|
-
}),
|
|
1995
|
+
}), zt = ["data-info-sheet-open", "data-info-sheet-mode"], Bt = ["aria-hidden", "inert"], Vt = {
|
|
1885
1996
|
key: 0,
|
|
1886
1997
|
class: "reel-info-sheet-layer",
|
|
1887
1998
|
"data-test": "reel-info-sheet"
|
|
1888
|
-
},
|
|
1999
|
+
}, Ht = [
|
|
1889
2000
|
"role",
|
|
1890
2001
|
"aria-modal",
|
|
1891
2002
|
"tabindex",
|
|
1892
2003
|
"data-active-post-id"
|
|
1893
|
-
],
|
|
2004
|
+
], Ut = /* @__PURE__ */ d({
|
|
1894
2005
|
__name: "ReelLayout",
|
|
1895
2006
|
props: {
|
|
1896
2007
|
forwardIndex: { default: null },
|
|
@@ -1920,6 +2031,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1920
2031
|
mediaIndices: {},
|
|
1921
2032
|
nextPageError: { type: Boolean },
|
|
1922
2033
|
previewStates: {},
|
|
2034
|
+
reelAudioState: {},
|
|
1923
2035
|
state: {},
|
|
1924
2036
|
total: {}
|
|
1925
2037
|
},
|
|
@@ -1930,6 +2042,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1930
2042
|
"loadMore",
|
|
1931
2043
|
"mediaChange",
|
|
1932
2044
|
"ready",
|
|
2045
|
+
"reelAudioChange",
|
|
1933
2046
|
"retryEnd",
|
|
1934
2047
|
"retryForward"
|
|
1935
2048
|
],
|
|
@@ -1980,10 +2093,10 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
1980
2093
|
function V(e, t) {
|
|
1981
2094
|
d("error", e, t);
|
|
1982
2095
|
}
|
|
1983
|
-
function
|
|
2096
|
+
function H(e, t) {
|
|
1984
2097
|
d("mediaChange", e, t);
|
|
1985
2098
|
}
|
|
1986
|
-
function
|
|
2099
|
+
function U(e, t) {
|
|
1987
2100
|
d("ready", e, t);
|
|
1988
2101
|
}
|
|
1989
2102
|
return O(() => ({
|
|
@@ -2015,7 +2128,7 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
2015
2128
|
class: "reel-layout-main",
|
|
2016
2129
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
2017
2130
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
2018
|
-
}, [u(
|
|
2131
|
+
}, [u(Rt, {
|
|
2019
2132
|
ref_key: "reelFeed",
|
|
2020
2133
|
ref: p,
|
|
2021
2134
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2035,16 +2148,18 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
2035
2148
|
"next-page-error": e.nextPageError,
|
|
2036
2149
|
"preview-states": e.previewStates,
|
|
2037
2150
|
"reel-auto-advance": e.reelAutoAdvance,
|
|
2151
|
+
"reel-audio-state": e.reelAudioState,
|
|
2038
2152
|
"reel-forward": e.reelForward,
|
|
2039
2153
|
state: e.state,
|
|
2040
2154
|
total: e.total,
|
|
2041
2155
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
2042
2156
|
onError: V,
|
|
2043
2157
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
2044
|
-
onMediaChange:
|
|
2045
|
-
onReady:
|
|
2158
|
+
onMediaChange: H,
|
|
2159
|
+
onReady: U,
|
|
2046
2160
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
2047
|
-
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
2161
|
+
onRetryForward: r[3] ||= (e) => d("retryForward"),
|
|
2162
|
+
onReelAudioChange: r[4] ||= (e) => d("reelAudioChange", e)
|
|
2048
2163
|
}, null, 8, [
|
|
2049
2164
|
"can-retry-end",
|
|
2050
2165
|
"card-footer",
|
|
@@ -2063,11 +2178,12 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
2063
2178
|
"next-page-error",
|
|
2064
2179
|
"preview-states",
|
|
2065
2180
|
"reel-auto-advance",
|
|
2181
|
+
"reel-audio-state",
|
|
2066
2182
|
"reel-forward",
|
|
2067
2183
|
"state",
|
|
2068
2184
|
"total"
|
|
2069
|
-
])], 8,
|
|
2070
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2185
|
+
])], 8, Bt), u(n, { name: "vibe-info-sheet" }, {
|
|
2186
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Vt, [c("aside", {
|
|
2071
2187
|
ref_key: "sheetElement",
|
|
2072
2188
|
ref: _,
|
|
2073
2189
|
class: "reel-info-sheet",
|
|
@@ -2076,14 +2192,14 @@ var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
|
2076
2192
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2077
2193
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2078
2194
|
"data-active-post-id": T.value?.postId
|
|
2079
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2195
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Ht)])) : o("", !0)]),
|
|
2080
2196
|
_: 1
|
|
2081
|
-
})], 10,
|
|
2197
|
+
})], 10, zt));
|
|
2082
2198
|
}
|
|
2083
2199
|
});
|
|
2084
2200
|
//#endregion
|
|
2085
2201
|
//#region src/core/mediaLifecycle.ts
|
|
2086
|
-
function
|
|
2202
|
+
function Wt(e, t, n, r, i) {
|
|
2087
2203
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2088
2204
|
if (!o) return null;
|
|
2089
2205
|
let s = F(o, n), c = I(o, s);
|
|
@@ -2099,7 +2215,7 @@ function It(e, t, n, r, i) {
|
|
|
2099
2215
|
postIndex: a
|
|
2100
2216
|
};
|
|
2101
2217
|
}
|
|
2102
|
-
function
|
|
2218
|
+
function Gt(e, t) {
|
|
2103
2219
|
O(() => {
|
|
2104
2220
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2105
2221
|
return {
|
|
@@ -2109,20 +2225,20 @@ function Lt(e, t) {
|
|
|
2109
2225
|
};
|
|
2110
2226
|
}, (n, r) => {
|
|
2111
2227
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2112
|
-
let i =
|
|
2228
|
+
let i = Wt(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2113
2229
|
i && t(i);
|
|
2114
2230
|
}, { flush: "sync" });
|
|
2115
2231
|
}
|
|
2116
2232
|
//#endregion
|
|
2117
2233
|
//#region src/components/useMediaLifecycle.ts
|
|
2118
|
-
function
|
|
2234
|
+
function Kt(e, t) {
|
|
2119
2235
|
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = () => e.reelMediaSource === "preview" ? n : e.reelMediaSource === "mobile" ? a : i, s = r(() => o().value);
|
|
2120
2236
|
function c(e, t, n, r) {
|
|
2121
2237
|
let i = L(t, n);
|
|
2122
2238
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2123
2239
|
}
|
|
2124
2240
|
function l(t, n, r, i) {
|
|
2125
|
-
return
|
|
2241
|
+
return Wt(e, t, n, r, i);
|
|
2126
2242
|
}
|
|
2127
2243
|
function u(e, n, r, i) {
|
|
2128
2244
|
let a = l(e, n, r, i);
|
|
@@ -2144,7 +2260,7 @@ function Rt(e, t) {
|
|
|
2144
2260
|
let r = l(e, n, "masonry", null);
|
|
2145
2261
|
r && t.visible(r);
|
|
2146
2262
|
}
|
|
2147
|
-
return
|
|
2263
|
+
return Gt(e, t.reelChange), O(() => {
|
|
2148
2264
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2149
2265
|
return {
|
|
2150
2266
|
mediaIndex: n,
|
|
@@ -2169,16 +2285,16 @@ function Rt(e, t) {
|
|
|
2169
2285
|
}
|
|
2170
2286
|
//#endregion
|
|
2171
2287
|
//#region src/core/reelEscapeStack.ts
|
|
2172
|
-
var
|
|
2173
|
-
function
|
|
2174
|
-
return
|
|
2175
|
-
let t =
|
|
2176
|
-
t >= 0 &&
|
|
2288
|
+
var qt = [];
|
|
2289
|
+
function Jt(e) {
|
|
2290
|
+
return qt.push(e), () => {
|
|
2291
|
+
let t = qt.indexOf(e);
|
|
2292
|
+
t >= 0 && qt.splice(t, 1);
|
|
2177
2293
|
};
|
|
2178
2294
|
}
|
|
2179
|
-
function
|
|
2295
|
+
function Yt(e) {
|
|
2180
2296
|
if (!e.isActive()) return !1;
|
|
2181
|
-
let t =
|
|
2297
|
+
let t = qt.filter((e) => e.isActive()), n = e.element();
|
|
2182
2298
|
return n !== null && t.some((t) => {
|
|
2183
2299
|
if (t === e) return !1;
|
|
2184
2300
|
let r = t.element();
|
|
@@ -2194,14 +2310,14 @@ function Vt(e) {
|
|
|
2194
2310
|
}
|
|
2195
2311
|
//#endregion
|
|
2196
2312
|
//#region src/components/useReelKeyboard.ts
|
|
2197
|
-
function
|
|
2313
|
+
function Xt(e) {
|
|
2198
2314
|
let t = {
|
|
2199
2315
|
element: e.element,
|
|
2200
2316
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2201
2317
|
}, n = null;
|
|
2202
2318
|
function r(n) {
|
|
2203
2319
|
let r = t.isActive();
|
|
2204
|
-
if (n.key === "Escape" && r && !
|
|
2320
|
+
if (n.key === "Escape" && r && !Yt(t)) return;
|
|
2205
2321
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2206
2322
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2207
2323
|
return;
|
|
@@ -2221,14 +2337,14 @@ function Ht(e) {
|
|
|
2221
2337
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2222
2338
|
}
|
|
2223
2339
|
y(() => {
|
|
2224
|
-
n =
|
|
2340
|
+
n = Jt(t), window.addEventListener("keydown", r);
|
|
2225
2341
|
}), v(() => {
|
|
2226
2342
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2227
2343
|
});
|
|
2228
2344
|
}
|
|
2229
2345
|
//#endregion
|
|
2230
2346
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2231
|
-
var
|
|
2347
|
+
var Zt = 35, Qt = 420, $t = /* @__PURE__ */ d({
|
|
2232
2348
|
__name: "VibeSurface",
|
|
2233
2349
|
props: {
|
|
2234
2350
|
canRetryEnd: { type: Boolean },
|
|
@@ -2239,6 +2355,7 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2239
2355
|
mediaCard: {},
|
|
2240
2356
|
masonry: {},
|
|
2241
2357
|
reelInfoSheet: {},
|
|
2358
|
+
reelAudioState: {},
|
|
2242
2359
|
state: {}
|
|
2243
2360
|
},
|
|
2244
2361
|
emits: [
|
|
@@ -2250,38 +2367,39 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2250
2367
|
"openReel",
|
|
2251
2368
|
"reelMediaChange",
|
|
2252
2369
|
"reelInfoSheetChange",
|
|
2370
|
+
"reelAudioChange",
|
|
2253
2371
|
"retryEnd",
|
|
2254
2372
|
"retryForward"
|
|
2255
2373
|
],
|
|
2256
2374
|
setup(t, { expose: i, emit: c }) {
|
|
2257
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null),
|
|
2375
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => z(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: I, originalStates: L, previewStates: R, reelStates: B } = Kt(l.state, {
|
|
2258
2376
|
ready: (e) => d("mediaReady", e),
|
|
2259
2377
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2260
2378
|
visible: (e) => d("mediaVisible", e)
|
|
2261
|
-
}),
|
|
2262
|
-
function
|
|
2379
|
+
}), V = new Set(l.state.items.map((e) => e.postId)), H = null, U = null, W = !1;
|
|
2380
|
+
function ee() {
|
|
2263
2381
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2264
2382
|
}
|
|
2265
|
-
function
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2383
|
+
function te() {
|
|
2384
|
+
H !== null && cancelAnimationFrame(H), H = requestAnimationFrame(() => {
|
|
2385
|
+
H = requestAnimationFrame(() => {
|
|
2386
|
+
H = null, y.value = /* @__PURE__ */ new Set();
|
|
2269
2387
|
});
|
|
2270
2388
|
});
|
|
2271
2389
|
}
|
|
2272
|
-
function
|
|
2390
|
+
function G(e, t) {
|
|
2273
2391
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2274
2392
|
if (!n) return;
|
|
2275
2393
|
let r = F(n, t);
|
|
2276
2394
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2277
2395
|
}
|
|
2278
|
-
async function
|
|
2396
|
+
async function K() {
|
|
2279
2397
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2280
2398
|
}
|
|
2281
|
-
function
|
|
2399
|
+
function re(e) {
|
|
2282
2400
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2283
2401
|
}
|
|
2284
|
-
function
|
|
2402
|
+
function q(e) {
|
|
2285
2403
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2286
2404
|
}
|
|
2287
2405
|
function ie(e) {
|
|
@@ -2294,81 +2412,70 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2294
2412
|
function ae() {
|
|
2295
2413
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2296
2414
|
}
|
|
2297
|
-
function
|
|
2298
|
-
|
|
2415
|
+
function oe(e, t) {
|
|
2416
|
+
U = e, W = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
|
|
2299
2417
|
}
|
|
2300
|
-
function
|
|
2418
|
+
function se(e) {
|
|
2301
2419
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2302
2420
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2303
2421
|
}
|
|
2304
|
-
function
|
|
2305
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
2306
|
-
let n = [...new Set(e)], r = n.filter(
|
|
2422
|
+
function J(e, t) {
|
|
2423
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ee()) return 0;
|
|
2424
|
+
let n = [...new Set(e)], r = n.filter(se);
|
|
2307
2425
|
if (r.length === 0) return 0;
|
|
2308
|
-
let i = new Map(
|
|
2426
|
+
let i = new Map(C.value), a = t?.staggerMs ?? Zt;
|
|
2309
2427
|
return r.forEach((e, t) => {
|
|
2310
2428
|
i.set(e, t * a);
|
|
2311
|
-
}),
|
|
2429
|
+
}), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, Qt + (r.length - 1) * a;
|
|
2312
2430
|
}
|
|
2313
|
-
function
|
|
2314
|
-
let n =
|
|
2431
|
+
function ce(e, t) {
|
|
2432
|
+
let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2315
2433
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2316
2434
|
r.classList.remove("media-card-focus-silent");
|
|
2317
2435
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2318
2436
|
}
|
|
2319
|
-
function se(e) {
|
|
2320
|
-
let t = g.value, n = Z(e);
|
|
2321
|
-
if (t === null || n === null) return {};
|
|
2322
|
-
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2323
|
-
return {
|
|
2324
|
-
"--vibe-reel-origin-top": `${Math.max(0, i.top - r.top)}px`,
|
|
2325
|
-
"--vibe-reel-origin-right": `${Math.max(0, r.right - i.right)}px`,
|
|
2326
|
-
"--vibe-reel-origin-bottom": `${Math.max(0, r.bottom - i.bottom)}px`,
|
|
2327
|
-
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2328
|
-
};
|
|
2329
|
-
}
|
|
2330
|
-
function ce() {
|
|
2331
|
-
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2332
|
-
}
|
|
2333
2437
|
function le() {
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2438
|
+
l.state.reelOrigin === "masonry" && (U ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
|
|
2439
|
+
}
|
|
2440
|
+
function ue() {
|
|
2441
|
+
let e = U, t = W;
|
|
2442
|
+
_.value = !1, U = null, W = !1, m(() => {
|
|
2443
|
+
e !== null && ce(e, t);
|
|
2337
2444
|
});
|
|
2338
2445
|
}
|
|
2339
|
-
return
|
|
2340
|
-
closeMasonryReel:
|
|
2446
|
+
return Xt({
|
|
2447
|
+
closeMasonryReel: le,
|
|
2341
2448
|
element: () => g.value,
|
|
2342
|
-
isReelLeaving: () =>
|
|
2449
|
+
isReelLeaving: () => _.value,
|
|
2343
2450
|
reelRenderer: () => p.value,
|
|
2344
2451
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2345
2452
|
state: l.state
|
|
2346
2453
|
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2347
|
-
let t = e.filter((e) => !
|
|
2348
|
-
if (
|
|
2454
|
+
let t = e.filter((e) => !V.has(e)), n = new Set(e);
|
|
2455
|
+
if (V = new Set(e), S.value = new Set([...S.value].filter((e) => n.has(e))), C.value = new Map([...C.value].filter(([e]) => n.has(e))), t.length === 0 || ee()) return;
|
|
2349
2456
|
let r = /* @__PURE__ */ new Map();
|
|
2350
2457
|
e.forEach((e) => {
|
|
2351
|
-
let t =
|
|
2458
|
+
let t = x.value.get(e);
|
|
2352
2459
|
t !== void 0 && r.set(e, t);
|
|
2353
2460
|
}), t.forEach((e, t) => {
|
|
2354
|
-
r.set(e, t *
|
|
2355
|
-
}),
|
|
2461
|
+
r.set(e, t * Zt);
|
|
2462
|
+
}), x.value = r, y.value = new Set([...y.value, ...t]), te();
|
|
2356
2463
|
}, { flush: "sync" }), v(() => {
|
|
2357
|
-
|
|
2464
|
+
H !== null && cancelAnimationFrame(H);
|
|
2358
2465
|
}), i({
|
|
2359
|
-
changeActiveReelMedia:
|
|
2466
|
+
changeActiveReelMedia: re,
|
|
2360
2467
|
getAutoScrollElement: ae,
|
|
2361
|
-
loadIfNearBottom:
|
|
2362
|
-
moveActiveReelPost:
|
|
2468
|
+
loadIfNearBottom: K,
|
|
2469
|
+
moveActiveReelPost: q,
|
|
2363
2470
|
navigateToReelItem: ie,
|
|
2364
|
-
startItemRemoval:
|
|
2471
|
+
startItemRemoval: J,
|
|
2365
2472
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2366
2473
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2367
2474
|
}), (r, i) => (b(), s("div", {
|
|
2368
2475
|
ref_key: "surfaceElement",
|
|
2369
2476
|
ref: g,
|
|
2370
2477
|
class: "vibe-surface"
|
|
2371
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2478
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Ut, {
|
|
2372
2479
|
key: 0,
|
|
2373
2480
|
ref_key: "reelRenderer",
|
|
2374
2481
|
ref: p,
|
|
@@ -2393,40 +2500,42 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2393
2500
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2394
2501
|
"next-page-error": !!t.state.nextPageError,
|
|
2395
2502
|
origin: "reel",
|
|
2396
|
-
"preview-states": E(
|
|
2503
|
+
"preview-states": E(B),
|
|
2397
2504
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2505
|
+
"reel-audio-state": t.reelAudioState,
|
|
2398
2506
|
"reel-forward": t.state.reelForward,
|
|
2399
|
-
state:
|
|
2507
|
+
state: D.value,
|
|
2400
2508
|
total: t.state.total,
|
|
2401
2509
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
2402
2510
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2403
|
-
onError: E(
|
|
2511
|
+
onError: E(N),
|
|
2404
2512
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2405
|
-
onMediaChange:
|
|
2406
|
-
onReady: E(
|
|
2513
|
+
onMediaChange: G,
|
|
2514
|
+
onReady: E(I),
|
|
2407
2515
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2408
|
-
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
2409
|
-
|
|
2516
|
+
onRetryForward: i[4] ||= (e) => d("retryForward"),
|
|
2517
|
+
onReelAudioChange: i[5] ||= (e) => d("reelAudioChange", e)
|
|
2518
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(ne, {
|
|
2410
2519
|
key: 1,
|
|
2411
2520
|
actions: t.feedFooterActions,
|
|
2412
2521
|
"can-retry-end": t.canRetryEnd,
|
|
2413
2522
|
"feed-footer": t.feedFooter,
|
|
2414
|
-
state:
|
|
2415
|
-
onLoadMore: i[
|
|
2416
|
-
onRetryEnd: i[
|
|
2523
|
+
state: D.value,
|
|
2524
|
+
onLoadMore: i[6] ||= (e) => d("loadMore"),
|
|
2525
|
+
onRetryEnd: i[7] ||= (e) => d("retryEnd")
|
|
2417
2526
|
}, null, 8, [
|
|
2418
2527
|
"actions",
|
|
2419
2528
|
"can-retry-end",
|
|
2420
2529
|
"feed-footer",
|
|
2421
2530
|
"state"
|
|
2422
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2531
|
+
])) : (b(), s(e, { key: 2 }, [u(Ot, {
|
|
2423
2532
|
ref_key: "masonryRenderer",
|
|
2424
2533
|
ref: f,
|
|
2425
2534
|
"can-retry-end": t.canRetryEnd,
|
|
2426
|
-
"entering-post-ids":
|
|
2427
|
-
"entry-delays":
|
|
2428
|
-
"leaving-post-ids":
|
|
2429
|
-
"removal-delays":
|
|
2535
|
+
"entering-post-ids": y.value,
|
|
2536
|
+
"entry-delays": x.value,
|
|
2537
|
+
"leaving-post-ids": S.value,
|
|
2538
|
+
"removal-delays": C.value,
|
|
2430
2539
|
"card-footer": t.cardFooter,
|
|
2431
2540
|
"card-header": t.cardHeader,
|
|
2432
2541
|
"feed-footer": t.feedFooter,
|
|
@@ -2440,17 +2549,17 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2440
2549
|
"load-more-locked": t.state.loadMoreLocked,
|
|
2441
2550
|
"media-indices": t.state.mediaIndices,
|
|
2442
2551
|
"next-page-error": !!t.state.nextPageError,
|
|
2443
|
-
"preview-states": E(
|
|
2444
|
-
suspended: t.state.reelOrigin === "masonry" ||
|
|
2445
|
-
state:
|
|
2552
|
+
"preview-states": E(R),
|
|
2553
|
+
suspended: t.state.reelOrigin === "masonry" || _.value,
|
|
2554
|
+
state: D.value,
|
|
2446
2555
|
total: t.state.total,
|
|
2447
|
-
onActivate:
|
|
2448
|
-
onError: E(
|
|
2449
|
-
onLoadMore: i[
|
|
2450
|
-
onMediaChange:
|
|
2451
|
-
onReady: E(
|
|
2452
|
-
onRetryEnd: i[
|
|
2453
|
-
onVisible: E(
|
|
2556
|
+
onActivate: oe,
|
|
2557
|
+
onError: E(j),
|
|
2558
|
+
onLoadMore: i[8] ||= (e) => d("loadMore"),
|
|
2559
|
+
onMediaChange: G,
|
|
2560
|
+
onReady: E(M),
|
|
2561
|
+
onRetryEnd: i[9] ||= (e) => d("retryEnd"),
|
|
2562
|
+
onVisible: E(A)
|
|
2454
2563
|
}, null, 8, [
|
|
2455
2564
|
"can-retry-end",
|
|
2456
2565
|
"entering-post-ids",
|
|
@@ -2479,7 +2588,7 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2479
2588
|
"onVisible"
|
|
2480
2589
|
]), u(n, {
|
|
2481
2590
|
name: "vibe-reel-viewer",
|
|
2482
|
-
onAfterLeave:
|
|
2591
|
+
onAfterLeave: ue
|
|
2483
2592
|
}, {
|
|
2484
2593
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2485
2594
|
key: 0,
|
|
@@ -2489,9 +2598,8 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2489
2598
|
role: "dialog",
|
|
2490
2599
|
"aria-label": "Media viewer",
|
|
2491
2600
|
"aria-modal": "true",
|
|
2492
|
-
tabindex: "-1"
|
|
2493
|
-
|
|
2494
|
-
}, [u(Ft, {
|
|
2601
|
+
tabindex: "-1"
|
|
2602
|
+
}, [u(Ut, {
|
|
2495
2603
|
ref_key: "reelRenderer",
|
|
2496
2604
|
ref: p,
|
|
2497
2605
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2515,53 +2623,55 @@ var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
|
2515
2623
|
"media-source": "original",
|
|
2516
2624
|
"next-page-error": !!t.state.nextPageError,
|
|
2517
2625
|
origin: "masonry",
|
|
2518
|
-
"preview-states": E(
|
|
2626
|
+
"preview-states": E(L),
|
|
2519
2627
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2628
|
+
"reel-audio-state": t.reelAudioState,
|
|
2520
2629
|
"reel-forward": t.state.reelForward,
|
|
2521
|
-
state:
|
|
2630
|
+
state: D.value,
|
|
2522
2631
|
total: t.state.total,
|
|
2523
|
-
onActiveChange: i[
|
|
2524
|
-
onCloseInfoSheet: i[
|
|
2525
|
-
onError: E(
|
|
2526
|
-
onLoadMore: i[
|
|
2527
|
-
onMediaChange:
|
|
2528
|
-
onReady: E(
|
|
2529
|
-
onRetryEnd: i[
|
|
2530
|
-
onRetryForward: i[
|
|
2531
|
-
|
|
2632
|
+
onActiveChange: i[10] ||= (e) => d("activeReelChange", e),
|
|
2633
|
+
onCloseInfoSheet: i[11] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2634
|
+
onError: E(N),
|
|
2635
|
+
onLoadMore: i[12] ||= (e) => d("loadMore"),
|
|
2636
|
+
onMediaChange: G,
|
|
2637
|
+
onReady: E(I),
|
|
2638
|
+
onRetryEnd: i[13] ||= (e) => d("retryEnd"),
|
|
2639
|
+
onRetryForward: i[14] ||= (e) => d("retryForward"),
|
|
2640
|
+
onReelAudioChange: i[15] ||= (e) => d("reelAudioChange", e)
|
|
2641
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))], 512)) : o("", !0)]),
|
|
2532
2642
|
_: 1
|
|
2533
2643
|
})], 64))], 512));
|
|
2534
2644
|
}
|
|
2535
2645
|
});
|
|
2536
2646
|
//#endregion
|
|
2537
2647
|
//#region src/core/page.ts
|
|
2538
|
-
function
|
|
2648
|
+
function en(e) {
|
|
2539
2649
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2540
2650
|
if (e.current !== void 0 && e.current !== null && typeof e.current != "string" && typeof e.current != "number") throw TypeError("Vibe page current must be a string, number, null, or undefined.");
|
|
2541
2651
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2542
2652
|
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.");
|
|
2543
2653
|
return e;
|
|
2544
2654
|
}
|
|
2545
|
-
function
|
|
2655
|
+
function Z(e, t) {
|
|
2546
2656
|
let n = new Set(e.map((e) => e.postId));
|
|
2547
2657
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2548
2658
|
}
|
|
2549
|
-
function
|
|
2659
|
+
function tn(e) {
|
|
2550
2660
|
return `${typeof e}:${String(e)}`;
|
|
2551
2661
|
}
|
|
2552
|
-
function
|
|
2553
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${
|
|
2662
|
+
function nn(e) {
|
|
2663
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${tn(e.mediaId)}`;
|
|
2554
2664
|
}
|
|
2555
|
-
function
|
|
2556
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
2665
|
+
function rn(e, t) {
|
|
2666
|
+
let n = [...e], r = new Map(e.map((e, t) => [tn(e.postId), t]));
|
|
2557
2667
|
return t.forEach((e) => {
|
|
2558
|
-
let t =
|
|
2668
|
+
let t = tn(e.postId), i = r.get(t);
|
|
2559
2669
|
if (i === void 0) {
|
|
2560
2670
|
r.set(t, n.length), n.push(e);
|
|
2561
2671
|
return;
|
|
2562
2672
|
}
|
|
2563
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
2564
|
-
let t =
|
|
2673
|
+
let a = n[i], o = new Set([a, ...a.items].map(nn)), s = [e, ...e.items].filter((e) => {
|
|
2674
|
+
let t = nn(e);
|
|
2565
2675
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
2566
2676
|
});
|
|
2567
2677
|
s.length > 0 && (n[i] = {
|
|
@@ -2570,14 +2680,14 @@ function Yt(e, t) {
|
|
|
2570
2680
|
});
|
|
2571
2681
|
}), n;
|
|
2572
2682
|
}
|
|
2573
|
-
function
|
|
2683
|
+
function an(e) {
|
|
2574
2684
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
2575
2685
|
}
|
|
2576
2686
|
//#endregion
|
|
2577
2687
|
//#region src/core/appendPage.ts
|
|
2578
|
-
function
|
|
2579
|
-
let i =
|
|
2580
|
-
t.items =
|
|
2688
|
+
function on(e, t, n, r) {
|
|
2689
|
+
let i = en(e), a = n.filterItems(i.items), o = an(i);
|
|
2690
|
+
t.items = rn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
2581
2691
|
contributionIds: a.map(({ postId: e }) => e),
|
|
2582
2692
|
cursor: o,
|
|
2583
2693
|
next: i.next,
|
|
@@ -2586,32 +2696,32 @@ function Zt(e, t, n, r) {
|
|
|
2586
2696
|
}
|
|
2587
2697
|
//#endregion
|
|
2588
2698
|
//#region src/core/requestDelay.ts
|
|
2589
|
-
var
|
|
2699
|
+
var sn = 2e3, cn = 1e4, ln = 250, un = {
|
|
2590
2700
|
delayRemainingMs: null,
|
|
2591
2701
|
nextRequestAt: null
|
|
2592
2702
|
};
|
|
2593
|
-
function
|
|
2703
|
+
function dn(e, t) {
|
|
2594
2704
|
return e === void 0 ? t : Math.floor(e);
|
|
2595
2705
|
}
|
|
2596
|
-
function
|
|
2706
|
+
function fn(e, t) {
|
|
2597
2707
|
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.`);
|
|
2598
2708
|
}
|
|
2599
|
-
function
|
|
2600
|
-
let n =
|
|
2709
|
+
function pn(e, t = {}) {
|
|
2710
|
+
let n = dn(t.delayStepMs, sn), r = dn(t.delayMaxMs, cn);
|
|
2601
2711
|
return Math.min(Math.max(0, e) * n, r);
|
|
2602
2712
|
}
|
|
2603
|
-
function
|
|
2604
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2713
|
+
function Q(e) {
|
|
2714
|
+
if (e == null || !Number.isFinite(e)) return { ...un };
|
|
2605
2715
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2606
2716
|
return t > 0 ? {
|
|
2607
2717
|
delayRemainingMs: t,
|
|
2608
2718
|
nextRequestAt: e
|
|
2609
|
-
} : { ...
|
|
2719
|
+
} : { ...un };
|
|
2610
2720
|
}
|
|
2611
|
-
async function
|
|
2721
|
+
async function mn({ delayMs: e, onChange: t, signal: n }) {
|
|
2612
2722
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2613
2723
|
if (e <= 0) {
|
|
2614
|
-
t({ ...
|
|
2724
|
+
t({ ...un });
|
|
2615
2725
|
return;
|
|
2616
2726
|
}
|
|
2617
2727
|
let r = Date.now() + e;
|
|
@@ -2619,9 +2729,9 @@ async function sn({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2619
2729
|
delayRemainingMs: e,
|
|
2620
2730
|
nextRequestAt: r
|
|
2621
2731
|
}), await new Promise((i, a) => {
|
|
2622
|
-
let o = !1, s = setInterval(f,
|
|
2732
|
+
let o = !1, s = setInterval(f, ln), c = setTimeout(() => u(), e);
|
|
2623
2733
|
function l() {
|
|
2624
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2734
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...un });
|
|
2625
2735
|
}
|
|
2626
2736
|
function u(e) {
|
|
2627
2737
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2630,42 +2740,42 @@ async function sn({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2630
2740
|
u(new DOMException("Aborted", "AbortError"));
|
|
2631
2741
|
}
|
|
2632
2742
|
function f() {
|
|
2633
|
-
let e =
|
|
2743
|
+
let e = Q(r);
|
|
2634
2744
|
t(e), e.delayRemainingMs === null && u();
|
|
2635
2745
|
}
|
|
2636
2746
|
n.addEventListener("abort", d, { once: !0 });
|
|
2637
2747
|
});
|
|
2638
2748
|
}
|
|
2639
|
-
var
|
|
2749
|
+
var hn = class {
|
|
2640
2750
|
interval = null;
|
|
2641
2751
|
constructor(e) {
|
|
2642
2752
|
this.onChange = e;
|
|
2643
2753
|
}
|
|
2644
2754
|
clear() {
|
|
2645
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2755
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...un });
|
|
2646
2756
|
}
|
|
2647
2757
|
sync(e) {
|
|
2648
2758
|
this.clear();
|
|
2649
|
-
let t =
|
|
2759
|
+
let t = Q(e);
|
|
2650
2760
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2651
|
-
let t =
|
|
2761
|
+
let t = Q(e);
|
|
2652
2762
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2653
|
-
},
|
|
2763
|
+
}, ln));
|
|
2654
2764
|
}
|
|
2655
2765
|
};
|
|
2656
|
-
function
|
|
2766
|
+
function gn(e, t = !0) {
|
|
2657
2767
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2658
2768
|
}
|
|
2659
|
-
function
|
|
2769
|
+
function _n(e) {
|
|
2660
2770
|
return `${typeof e}:${String(e)}`;
|
|
2661
2771
|
}
|
|
2662
|
-
function
|
|
2772
|
+
function vn(e, t) {
|
|
2663
2773
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2664
2774
|
}
|
|
2665
|
-
function
|
|
2775
|
+
function yn(e) {
|
|
2666
2776
|
if (!e) return;
|
|
2667
|
-
if (
|
|
2668
|
-
|
|
2777
|
+
if (vn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2778
|
+
fn(e, "frontend autofill");
|
|
2669
2779
|
let t = e.maxAdditionalPages;
|
|
2670
2780
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2671
2781
|
return;
|
|
@@ -2677,7 +2787,7 @@ function fn(e) {
|
|
|
2677
2787
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2678
2788
|
}
|
|
2679
2789
|
}
|
|
2680
|
-
function
|
|
2790
|
+
function bn(e, t, n = !0) {
|
|
2681
2791
|
if (!e) return {
|
|
2682
2792
|
cycleId: null,
|
|
2683
2793
|
delayRemainingMs: null,
|
|
@@ -2694,7 +2804,7 @@ function pn(e, t, n = !0) {
|
|
|
2694
2804
|
status: "idle",
|
|
2695
2805
|
strategy: null
|
|
2696
2806
|
};
|
|
2697
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
2807
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Q(r?.nextRequestAt);
|
|
2698
2808
|
return {
|
|
2699
2809
|
cycleId: r?.cycleId ?? null,
|
|
2700
2810
|
...a,
|
|
@@ -2711,7 +2821,7 @@ function pn(e, t, n = !0) {
|
|
|
2711
2821
|
strategy: e.strategy
|
|
2712
2822
|
};
|
|
2713
2823
|
}
|
|
2714
|
-
function
|
|
2824
|
+
function xn(e) {
|
|
2715
2825
|
return [
|
|
2716
2826
|
"cancelling",
|
|
2717
2827
|
"filling",
|
|
@@ -2719,9 +2829,9 @@ function mn(e) {
|
|
|
2719
2829
|
"waiting"
|
|
2720
2830
|
].includes(e.status);
|
|
2721
2831
|
}
|
|
2722
|
-
async function
|
|
2832
|
+
async function Sn(e, t, n) {
|
|
2723
2833
|
let r = t.autofill;
|
|
2724
|
-
if (!
|
|
2834
|
+
if (!xn(r) || !r.cycleId) return;
|
|
2725
2835
|
let i = {
|
|
2726
2836
|
cycleId: r.cycleId,
|
|
2727
2837
|
feedKey: r.feedKey ?? "",
|
|
@@ -2734,16 +2844,16 @@ async function hn(e, t, n) {
|
|
|
2734
2844
|
throw r.error = e, r.status = "error", e;
|
|
2735
2845
|
}
|
|
2736
2846
|
}
|
|
2737
|
-
function
|
|
2847
|
+
function Cn(e, t, n) {
|
|
2738
2848
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2739
2849
|
}
|
|
2740
|
-
async function
|
|
2741
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2850
|
+
async function wn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
|
|
2851
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? gn(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2742
2852
|
for (; y < h;) {
|
|
2743
|
-
let e =
|
|
2853
|
+
let e = _n(g);
|
|
2744
2854
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2745
|
-
if (m.add(e), await
|
|
2746
|
-
delayMs:
|
|
2855
|
+
if (m.add(e), await mn({
|
|
2856
|
+
delayMs: pn(l + y, s),
|
|
2747
2857
|
onChange: a,
|
|
2748
2858
|
signal: d
|
|
2749
2859
|
}), y > 0 && u()) return {
|
|
@@ -2757,12 +2867,12 @@ async function _n({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2757
2867
|
status: "paused",
|
|
2758
2868
|
total: x
|
|
2759
2869
|
};
|
|
2760
|
-
let t =
|
|
2870
|
+
let t = en(await n({
|
|
2761
2871
|
cursor: g,
|
|
2762
2872
|
signal: d
|
|
2763
2873
|
}));
|
|
2764
2874
|
y += 1, _ = g;
|
|
2765
|
-
let r =
|
|
2875
|
+
let r = Z(p, t.items).slice(p.length);
|
|
2766
2876
|
b.push({
|
|
2767
2877
|
contributionIds: r.map(({ postId: e }) => e),
|
|
2768
2878
|
cursor: g,
|
|
@@ -2814,12 +2924,12 @@ async function _n({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2814
2924
|
}
|
|
2815
2925
|
//#endregion
|
|
2816
2926
|
//#region src/core/autofillController.ts
|
|
2817
|
-
var
|
|
2927
|
+
var Tn = class {
|
|
2818
2928
|
collection = null;
|
|
2819
2929
|
cycle = 0;
|
|
2820
2930
|
delayCountdown;
|
|
2821
2931
|
constructor(e) {
|
|
2822
|
-
this.context = e, this.delayCountdown = new
|
|
2932
|
+
this.context = e, this.delayCountdown = new hn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2823
2933
|
}
|
|
2824
2934
|
beginCycle() {
|
|
2825
2935
|
let { options: e, state: t } = this.context;
|
|
@@ -2827,14 +2937,14 @@ var vn = class {
|
|
|
2827
2937
|
this.clear();
|
|
2828
2938
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2829
2939
|
return t.autofill = {
|
|
2830
|
-
...
|
|
2940
|
+
...bn(e, void 0, !1),
|
|
2831
2941
|
cycleId: n,
|
|
2832
2942
|
status: "filling"
|
|
2833
2943
|
}, n;
|
|
2834
2944
|
}
|
|
2835
2945
|
async cancel() {
|
|
2836
2946
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2837
|
-
await
|
|
2947
|
+
await Sn(t, n, e), this.commitCollection();
|
|
2838
2948
|
}
|
|
2839
2949
|
captureCollection(e, t) {
|
|
2840
2950
|
t && (this.collection = e);
|
|
@@ -2856,36 +2966,36 @@ var vn = class {
|
|
|
2856
2966
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
2857
2967
|
if (t?.strategy !== "frontend") return !1;
|
|
2858
2968
|
let r = this.collection;
|
|
2859
|
-
return this.collection = null, r ? (n.items =
|
|
2969
|
+
return this.collection = null, r ? (n.items = Z(n.items, r.items), e(r.lastCursor), this.context.onPages(r.pages), n.next = r.next, r.total !== void 0 && (n.total = r.total), Object.assign(n.autofill, {
|
|
2860
2970
|
missing: r.missing,
|
|
2861
2971
|
received: r.received,
|
|
2862
2972
|
requests: r.requests
|
|
2863
2973
|
}), !0) : !1;
|
|
2864
2974
|
}
|
|
2865
|
-
},
|
|
2866
|
-
function
|
|
2975
|
+
}, En = 100;
|
|
2976
|
+
function Dn(e, t) {
|
|
2867
2977
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2868
2978
|
}
|
|
2869
|
-
function
|
|
2979
|
+
function On(e, t, n) {
|
|
2870
2980
|
return Math.min(n, Math.max(t, e));
|
|
2871
2981
|
}
|
|
2872
|
-
function
|
|
2982
|
+
function kn(e) {
|
|
2873
2983
|
if (!e) return;
|
|
2874
2984
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2875
|
-
if (
|
|
2876
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2985
|
+
if (Dn("autoScroll.minSpeedPxPerSecond", t), Dn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2986
|
+
e.speedPxPerSecond !== void 0 && Dn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2877
2987
|
}
|
|
2878
|
-
function
|
|
2988
|
+
function An(e) {
|
|
2879
2989
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2880
2990
|
return {
|
|
2881
2991
|
enabled: e?.enabled ?? !1,
|
|
2882
2992
|
maxSpeedPxPerSecond: n,
|
|
2883
2993
|
minSpeedPxPerSecond: t,
|
|
2884
2994
|
paused: !1,
|
|
2885
|
-
speedPxPerSecond:
|
|
2995
|
+
speedPxPerSecond: On(e?.speedPxPerSecond ?? 80, t, n)
|
|
2886
2996
|
};
|
|
2887
2997
|
}
|
|
2888
|
-
var
|
|
2998
|
+
var jn = class {
|
|
2889
2999
|
frame = null;
|
|
2890
3000
|
lastTimestamp = null;
|
|
2891
3001
|
mounted = !1;
|
|
@@ -2905,9 +3015,9 @@ var wn = class {
|
|
|
2905
3015
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2906
3016
|
}
|
|
2907
3017
|
setSpeed(e) {
|
|
2908
|
-
|
|
3018
|
+
Dn("auto-scroll speed", e);
|
|
2909
3019
|
let t = this.options.state;
|
|
2910
|
-
t.speedPxPerSecond =
|
|
3020
|
+
t.speedPxPerSecond = On(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2911
3021
|
}
|
|
2912
3022
|
tick = (e) => {
|
|
2913
3023
|
this.frame = null;
|
|
@@ -2919,7 +3029,7 @@ var wn = class {
|
|
|
2919
3029
|
return;
|
|
2920
3030
|
}
|
|
2921
3031
|
if (this.lastTimestamp !== null) {
|
|
2922
|
-
let r = Math.min(
|
|
3032
|
+
let r = Math.min(En, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2923
3033
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2924
3034
|
}
|
|
2925
3035
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2933,13 +3043,13 @@ var wn = class {
|
|
|
2933
3043
|
};
|
|
2934
3044
|
//#endregion
|
|
2935
3045
|
//#region src/core/backendAutofill.ts
|
|
2936
|
-
async function
|
|
3046
|
+
async function Mn(e, t, n, r) {
|
|
2937
3047
|
let i = await e.onUnderfilled(n);
|
|
2938
3048
|
if (!r()) return;
|
|
2939
3049
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
2940
3050
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
2941
3051
|
Object.assign(t.autofill, {
|
|
2942
|
-
...
|
|
3052
|
+
...Q(i.nextRequestAt),
|
|
2943
3053
|
missing: Math.max(0, e.pageSize - a),
|
|
2944
3054
|
received: a,
|
|
2945
3055
|
sequence: i.sequence ?? 0,
|
|
@@ -2947,19 +3057,19 @@ async function Tn(e, t, n, r) {
|
|
|
2947
3057
|
status: "waiting"
|
|
2948
3058
|
});
|
|
2949
3059
|
}
|
|
2950
|
-
function
|
|
2951
|
-
["complete", "exhausted"].includes(t.status) && t.items && (e.items =
|
|
3060
|
+
function Nn(e, t) {
|
|
3061
|
+
["complete", "exhausted"].includes(t.status) && t.items && (e.items = Z(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
2952
3062
|
}
|
|
2953
|
-
function
|
|
3063
|
+
function Pn(e, t, n) {
|
|
2954
3064
|
let r = t.autofill;
|
|
2955
|
-
return !
|
|
3065
|
+
return !Cn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Nn(t, n), Object.assign(r, Q(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
|
|
2956
3066
|
}
|
|
2957
|
-
function
|
|
2958
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3067
|
+
function Fn(e, t, n) {
|
|
3068
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = bn(e, n), Nn(t, n), !0);
|
|
2959
3069
|
}
|
|
2960
3070
|
//#endregion
|
|
2961
3071
|
//#region src/core/backlogRestore.ts
|
|
2962
|
-
async function
|
|
3072
|
+
async function In(e, t, n) {
|
|
2963
3073
|
if (!e) return;
|
|
2964
3074
|
let r = new AbortController();
|
|
2965
3075
|
n(r);
|
|
@@ -2974,7 +3084,7 @@ async function kn(e, t, n) {
|
|
|
2974
3084
|
}
|
|
2975
3085
|
//#endregion
|
|
2976
3086
|
//#region src/core/initialAutofill.ts
|
|
2977
|
-
async function
|
|
3087
|
+
async function Ln({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2978
3088
|
let c = a.autofill;
|
|
2979
3089
|
if (!c) return;
|
|
2980
3090
|
let l = s.items.length;
|
|
@@ -2987,7 +3097,7 @@ async function An({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2987
3097
|
return;
|
|
2988
3098
|
}
|
|
2989
3099
|
if (c.strategy === "backend") {
|
|
2990
|
-
await
|
|
3100
|
+
await Mn(c, s, {
|
|
2991
3101
|
cycleId: e,
|
|
2992
3102
|
feedKey: c.feedKey,
|
|
2993
3103
|
items: [...s.items],
|
|
@@ -3004,11 +3114,11 @@ async function An({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3004
3114
|
s.autofill.status = "exhausted";
|
|
3005
3115
|
return;
|
|
3006
3116
|
}
|
|
3007
|
-
let u = await
|
|
3117
|
+
let u = await wn({
|
|
3008
3118
|
existingItems: s.items,
|
|
3009
3119
|
initialCursor: s.next,
|
|
3010
3120
|
loadPage: a.loadPage,
|
|
3011
|
-
maximumRequests:
|
|
3121
|
+
maximumRequests: gn(c, !1),
|
|
3012
3122
|
onCollection: n,
|
|
3013
3123
|
onDelayChange: (e) => {
|
|
3014
3124
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3022,7 +3132,7 @@ async function An({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3022
3132
|
shouldPause: () => s.loadMoreLocked,
|
|
3023
3133
|
signal: o
|
|
3024
3134
|
});
|
|
3025
|
-
t() && (s.items =
|
|
3135
|
+
t() && (s.items = Z(s.items, u.items), s.next = u.next, u.total !== void 0 && (s.total = u.total), r(u.lastCursor), i(u.pages), Object.assign(s.autofill, {
|
|
3026
3136
|
missing: u.missing,
|
|
3027
3137
|
received: u.received,
|
|
3028
3138
|
requests: u.requests,
|
|
@@ -3031,13 +3141,13 @@ async function An({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3031
3141
|
}
|
|
3032
3142
|
//#endregion
|
|
3033
3143
|
//#region src/core/fill.ts
|
|
3034
|
-
function
|
|
3144
|
+
function Rn(e) {
|
|
3035
3145
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3036
3146
|
}
|
|
3037
|
-
function
|
|
3147
|
+
function zn(e) {
|
|
3038
3148
|
return `${typeof e}:${String(e)}`;
|
|
3039
3149
|
}
|
|
3040
|
-
function
|
|
3150
|
+
function Bn(e) {
|
|
3041
3151
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3042
3152
|
if ("pages" in e) {
|
|
3043
3153
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3050,21 +3160,21 @@ function Nn(e) {
|
|
|
3050
3160
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3051
3161
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3052
3162
|
}
|
|
3053
|
-
function
|
|
3163
|
+
function Vn(e) {
|
|
3054
3164
|
if (!e) return;
|
|
3055
3165
|
if (e.strategy === "frontend") {
|
|
3056
|
-
|
|
3166
|
+
fn(e, "frontend fill");
|
|
3057
3167
|
return;
|
|
3058
3168
|
}
|
|
3059
3169
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3060
3170
|
let t = e.initialSession;
|
|
3061
3171
|
if (t) {
|
|
3062
3172
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3063
|
-
|
|
3173
|
+
Bn(t.target);
|
|
3064
3174
|
}
|
|
3065
3175
|
}
|
|
3066
|
-
function
|
|
3067
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3176
|
+
function Hn(e, t, n = !0) {
|
|
3177
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
|
|
3068
3178
|
return {
|
|
3069
3179
|
completedPages: i?.completedPages ?? 0,
|
|
3070
3180
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3077,10 +3187,10 @@ function Fn(e, t, n = !0) {
|
|
|
3077
3187
|
sessionId: i?.sessionId ?? null,
|
|
3078
3188
|
status: i?.status ?? "idle",
|
|
3079
3189
|
strategy: e?.strategy ?? null,
|
|
3080
|
-
target: i ?
|
|
3190
|
+
target: i ? Rn(i.target) : null
|
|
3081
3191
|
};
|
|
3082
3192
|
}
|
|
3083
|
-
function
|
|
3193
|
+
function Un(e) {
|
|
3084
3194
|
return [
|
|
3085
3195
|
"cancelling",
|
|
3086
3196
|
"filling",
|
|
@@ -3088,7 +3198,7 @@ function In(e) {
|
|
|
3088
3198
|
"waiting"
|
|
3089
3199
|
].includes(e.status);
|
|
3090
3200
|
}
|
|
3091
|
-
async function
|
|
3201
|
+
async function Wn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3092
3202
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3093
3203
|
if ("items" in l && f.length >= l.items) return {
|
|
3094
3204
|
completedPages: m,
|
|
@@ -3100,10 +3210,10 @@ async function Ln({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3100
3210
|
status: "complete"
|
|
3101
3211
|
};
|
|
3102
3212
|
for (; _ !== null;) {
|
|
3103
|
-
let e =
|
|
3213
|
+
let e = zn(h);
|
|
3104
3214
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3105
|
-
if (p.add(e), await
|
|
3106
|
-
delayMs:
|
|
3215
|
+
if (p.add(e), await mn({
|
|
3216
|
+
delayMs: pn(m, o),
|
|
3107
3217
|
onChange: i,
|
|
3108
3218
|
signal: c
|
|
3109
3219
|
}), m > 0 && s()) return {
|
|
@@ -3116,12 +3226,12 @@ async function Ln({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3116
3226
|
status: "paused",
|
|
3117
3227
|
total: y
|
|
3118
3228
|
};
|
|
3119
|
-
let t =
|
|
3229
|
+
let t = en(await n({
|
|
3120
3230
|
cursor: h,
|
|
3121
3231
|
signal: c
|
|
3122
3232
|
}));
|
|
3123
3233
|
m += 1, g = h;
|
|
3124
|
-
let b =
|
|
3234
|
+
let b = Z(f, t.items).slice(f.length);
|
|
3125
3235
|
if (d.push({
|
|
3126
3236
|
contributionIds: b.map(({ postId: e }) => e),
|
|
3127
3237
|
cursor: h,
|
|
@@ -3184,12 +3294,12 @@ async function Ln({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3184
3294
|
}
|
|
3185
3295
|
//#endregion
|
|
3186
3296
|
//#region src/core/backendFill.ts
|
|
3187
|
-
async function
|
|
3297
|
+
async function Gn(e, t, n, r) {
|
|
3188
3298
|
let i = await e.onStart(n);
|
|
3189
3299
|
if (r()) {
|
|
3190
3300
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3191
3301
|
Object.assign(t.fill, {
|
|
3192
|
-
...
|
|
3302
|
+
...Q(i.nextRequestAt),
|
|
3193
3303
|
completedPages: i.completedPages ?? 0,
|
|
3194
3304
|
received: i.received ?? 0,
|
|
3195
3305
|
sequence: i.sequence ?? 0,
|
|
@@ -3198,23 +3308,23 @@ async function Rn(e, t, n, r) {
|
|
|
3198
3308
|
});
|
|
3199
3309
|
}
|
|
3200
3310
|
}
|
|
3201
|
-
function
|
|
3311
|
+
function Kn(e, t, n) {
|
|
3202
3312
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3203
3313
|
}
|
|
3204
|
-
function
|
|
3314
|
+
function qn(e) {
|
|
3205
3315
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3206
3316
|
}
|
|
3207
|
-
function
|
|
3317
|
+
function Jn(e, t) {
|
|
3208
3318
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3209
3319
|
let n = e.fill.target;
|
|
3210
3320
|
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;
|
|
3211
3321
|
}
|
|
3212
|
-
function
|
|
3213
|
-
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items =
|
|
3322
|
+
function Yn(e, t, n) {
|
|
3323
|
+
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Z(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
3214
3324
|
}
|
|
3215
|
-
function
|
|
3216
|
-
return !
|
|
3217
|
-
...
|
|
3325
|
+
function Xn(e, t, n, r) {
|
|
3326
|
+
return !Kn(e, t, n) || !qn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Jn(t, n) ? !1 : (Yn(t, n, r), Object.assign(t.fill, {
|
|
3327
|
+
...Q(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3218
3328
|
completedPages: n.completedPages,
|
|
3219
3329
|
error: n.error ?? null,
|
|
3220
3330
|
received: n.received,
|
|
@@ -3222,45 +3332,45 @@ function Un(e, t, n, r) {
|
|
|
3222
3332
|
status: n.status
|
|
3223
3333
|
}), !0);
|
|
3224
3334
|
}
|
|
3225
|
-
function
|
|
3335
|
+
function Zn(e, t, n, r) {
|
|
3226
3336
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3227
3337
|
let i = t.fill;
|
|
3228
|
-
return t.fill =
|
|
3338
|
+
return t.fill = Hn(e, n), !qn(n) || !Jn(t, n) ? (t.fill = i, !1) : (Yn(t, n, r), !0);
|
|
3229
3339
|
}
|
|
3230
3340
|
//#endregion
|
|
3231
3341
|
//#region src/core/fillController.ts
|
|
3232
|
-
var
|
|
3342
|
+
var Qn = class {
|
|
3233
3343
|
abortController = null;
|
|
3234
3344
|
cycle = 0;
|
|
3235
3345
|
delayCountdown;
|
|
3236
3346
|
requestVersion = 0;
|
|
3237
3347
|
collection = null;
|
|
3238
3348
|
constructor(e) {
|
|
3239
|
-
this.options = e, this.delayCountdown = new
|
|
3349
|
+
this.options = e, this.delayCountdown = new hn((e) => {
|
|
3240
3350
|
Object.assign(this.options.state.fill, e);
|
|
3241
3351
|
}), this.syncBackendCountdown();
|
|
3242
3352
|
}
|
|
3243
3353
|
isActive() {
|
|
3244
|
-
return
|
|
3354
|
+
return Un(this.options.state.fill);
|
|
3245
3355
|
}
|
|
3246
3356
|
applyUpdate(e) {
|
|
3247
|
-
let t =
|
|
3357
|
+
let t = Xn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3248
3358
|
return t && this.syncBackendCountdown(), t;
|
|
3249
3359
|
}
|
|
3250
3360
|
restoreSession(e) {
|
|
3251
|
-
let t =
|
|
3361
|
+
let t = Zn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3252
3362
|
return t && this.syncBackendCountdown(), t;
|
|
3253
3363
|
}
|
|
3254
3364
|
async start(e, t = {}) {
|
|
3255
3365
|
let n = this.options.fill;
|
|
3256
3366
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3257
3367
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3258
|
-
let r =
|
|
3368
|
+
let r = Bn(e), i = Bn(t.target ?? r), a = t.progressOffset ?? {
|
|
3259
3369
|
completedPages: 0,
|
|
3260
3370
|
received: 0
|
|
3261
3371
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3262
3372
|
if (this.options.state.fill = {
|
|
3263
|
-
...
|
|
3373
|
+
...Hn(n, void 0, !1),
|
|
3264
3374
|
completedPages: a.completedPages,
|
|
3265
3375
|
cycleId: o,
|
|
3266
3376
|
received: a.received,
|
|
@@ -3273,7 +3383,7 @@ var Gn = class {
|
|
|
3273
3383
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3274
3384
|
this.abortController = c;
|
|
3275
3385
|
try {
|
|
3276
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3386
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Gn(n, this.options.state, {
|
|
3277
3387
|
cycleId: o,
|
|
3278
3388
|
feedKey: n.feedKey,
|
|
3279
3389
|
items: [...this.options.state.items],
|
|
@@ -3291,7 +3401,7 @@ var Gn = class {
|
|
|
3291
3401
|
}
|
|
3292
3402
|
async cancel() {
|
|
3293
3403
|
let { fill: e, state: t } = this.options;
|
|
3294
|
-
if (!
|
|
3404
|
+
if (!Un(t.fill) || !t.fill.cycleId) return;
|
|
3295
3405
|
let n = {
|
|
3296
3406
|
cycleId: t.fill.cycleId,
|
|
3297
3407
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3335,7 +3445,7 @@ var Gn = class {
|
|
|
3335
3445
|
});
|
|
3336
3446
|
}
|
|
3337
3447
|
reset() {
|
|
3338
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3448
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Hn(this.options.fill, void 0, !1), this.collection = null;
|
|
3339
3449
|
}
|
|
3340
3450
|
destroy() {
|
|
3341
3451
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3370,7 +3480,7 @@ var Gn = class {
|
|
|
3370
3480
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
3371
3481
|
return;
|
|
3372
3482
|
}
|
|
3373
|
-
let c = await
|
|
3483
|
+
let c = await Wn({
|
|
3374
3484
|
existingItems: s.items,
|
|
3375
3485
|
initialCursor: s.next,
|
|
3376
3486
|
loadPage: o,
|
|
@@ -3396,7 +3506,7 @@ var Gn = class {
|
|
|
3396
3506
|
signal: n.signal,
|
|
3397
3507
|
target: t
|
|
3398
3508
|
});
|
|
3399
|
-
this.isCurrent(r) && (s.items =
|
|
3509
|
+
this.isCurrent(r) && (s.items = Z(s.items, c.items), s.next = c.next, c.total !== void 0 && (s.total = c.total), this.options.onLastCursor(c.lastCursor), Object.assign(s.fill, {
|
|
3400
3510
|
completedPages: a.completedPages + c.completedPages,
|
|
3401
3511
|
received: a.received + c.received,
|
|
3402
3512
|
status: c.status
|
|
@@ -3406,7 +3516,7 @@ var Gn = class {
|
|
|
3406
3516
|
let e = this.collection;
|
|
3407
3517
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
3408
3518
|
let t = this.options.state;
|
|
3409
|
-
t.items =
|
|
3519
|
+
t.items = Z(t.items, e.items), t.next = e.next, e.total !== void 0 && (t.total = e.total), this.options.onLastCursor(e.lastCursor), this.options.onPages(e.pages), Object.assign(t.fill, {
|
|
3410
3520
|
completedPages: e.completedPages,
|
|
3411
3521
|
received: e.received
|
|
3412
3522
|
});
|
|
@@ -3418,7 +3528,7 @@ var Gn = class {
|
|
|
3418
3528
|
};
|
|
3419
3529
|
//#endregion
|
|
3420
3530
|
//#region src/core/fillReconciliation.ts
|
|
3421
|
-
async function
|
|
3531
|
+
async function $n({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
|
|
3422
3532
|
if (!e.needsReconciliation(o.items)) return "skipped";
|
|
3423
3533
|
let s = await e.reconcile({
|
|
3424
3534
|
existingItems: o.items,
|
|
@@ -3427,11 +3537,11 @@ async function Kn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
3427
3537
|
shouldPause: () => o.loadMoreLocked,
|
|
3428
3538
|
signal: a
|
|
3429
3539
|
});
|
|
3430
|
-
return t() ? (o.items =
|
|
3540
|
+
return t() ? (o.items = Z(o.items, s.items), o.next = s.next, i(s.lastCursor), s.total !== void 0 && (o.total = s.total), e.completeReconciliation(s), s.status) : s.status;
|
|
3431
3541
|
}
|
|
3432
3542
|
//#endregion
|
|
3433
3543
|
//#region src/core/feedFooter.ts
|
|
3434
|
-
function
|
|
3544
|
+
function er(e) {
|
|
3435
3545
|
return {
|
|
3436
3546
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3437
3547
|
loadMore: () => e.loadNext(),
|
|
@@ -3443,64 +3553,64 @@ function qn(e) {
|
|
|
3443
3553
|
retryFill: () => e.retryFill()
|
|
3444
3554
|
};
|
|
3445
3555
|
}
|
|
3446
|
-
function
|
|
3556
|
+
function tr(e) {
|
|
3447
3557
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3448
3558
|
}
|
|
3449
|
-
function
|
|
3450
|
-
e?.intervalMs !== void 0 &&
|
|
3559
|
+
function nr(e) {
|
|
3560
|
+
e?.intervalMs !== void 0 && tr(e.intervalMs);
|
|
3451
3561
|
}
|
|
3452
|
-
function
|
|
3562
|
+
function rr(e) {
|
|
3453
3563
|
return {
|
|
3454
3564
|
enabled: e?.enabled ?? !1,
|
|
3455
3565
|
includePostItems: e?.includePostItems ?? !1,
|
|
3456
3566
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3457
3567
|
};
|
|
3458
3568
|
}
|
|
3459
|
-
function
|
|
3569
|
+
function ir(e, t) {
|
|
3460
3570
|
if (typeof t == "boolean") {
|
|
3461
3571
|
e.enabled = t;
|
|
3462
3572
|
return;
|
|
3463
3573
|
}
|
|
3464
|
-
|
|
3574
|
+
nr(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);
|
|
3465
3575
|
}
|
|
3466
3576
|
//#endregion
|
|
3467
3577
|
//#region src/core/reelInfoSheet.ts
|
|
3468
|
-
function
|
|
3578
|
+
function ar(e) {
|
|
3469
3579
|
return { enabled: e?.enabled ?? !1 };
|
|
3470
3580
|
}
|
|
3471
|
-
function
|
|
3581
|
+
function or(e, t, n) {
|
|
3472
3582
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3473
3583
|
e.enabled = n;
|
|
3474
3584
|
}
|
|
3475
3585
|
//#endregion
|
|
3476
3586
|
//#region src/core/initialRuntimeState.ts
|
|
3477
|
-
function
|
|
3587
|
+
function sr(e, t) {
|
|
3478
3588
|
let n = e.initialPage;
|
|
3479
3589
|
return {
|
|
3480
3590
|
activeReelPostId: null,
|
|
3481
|
-
autoScroll:
|
|
3482
|
-
autofill:
|
|
3591
|
+
autoScroll: An(e.autoScroll),
|
|
3592
|
+
autofill: bn(e.autofill),
|
|
3483
3593
|
current: n?.current ?? null,
|
|
3484
3594
|
error: null,
|
|
3485
|
-
fill:
|
|
3595
|
+
fill: Hn(e.fill),
|
|
3486
3596
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3487
3597
|
isLoading: !n,
|
|
3488
3598
|
isLoadingMore: !1,
|
|
3489
|
-
items: n ?
|
|
3599
|
+
items: n ? Z([], n.items) : [],
|
|
3490
3600
|
layout: t === "reel" ? "reel" : "masonry",
|
|
3491
3601
|
loadMoreLocked: !1,
|
|
3492
3602
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
3493
3603
|
next: n?.next ?? null,
|
|
3494
3604
|
nextPageError: null,
|
|
3495
3605
|
phoneMode: !1,
|
|
3496
|
-
reelAutoAdvance:
|
|
3606
|
+
reelAutoAdvance: rr(e.reelAutoAdvance),
|
|
3497
3607
|
reelForward: {
|
|
3498
3608
|
error: null,
|
|
3499
3609
|
status: "idle"
|
|
3500
3610
|
},
|
|
3501
3611
|
reelForwardIndex: null,
|
|
3502
3612
|
reelForwardItem: null,
|
|
3503
|
-
reelInfoSheet:
|
|
3613
|
+
reelInfoSheet: ar(e.reelInfoSheet),
|
|
3504
3614
|
reelInfoSheetOverlay: !1,
|
|
3505
3615
|
reelMediaSource: "original",
|
|
3506
3616
|
reelOrigin: null,
|
|
@@ -3509,20 +3619,21 @@ function er(e, t) {
|
|
|
3509
3619
|
}
|
|
3510
3620
|
//#endregion
|
|
3511
3621
|
//#region src/core/options.ts
|
|
3512
|
-
function
|
|
3622
|
+
function cr(e, t) {
|
|
3513
3623
|
if (t) {
|
|
3514
3624
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3515
3625
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3516
3626
|
}
|
|
3517
3627
|
}
|
|
3518
|
-
function
|
|
3628
|
+
function lr(e, t) {
|
|
3519
3629
|
if (t) {
|
|
3520
3630
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3521
3631
|
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.`);
|
|
3522
3632
|
}
|
|
3523
3633
|
}
|
|
3524
|
-
function
|
|
3525
|
-
if (
|
|
3634
|
+
function ur(e) {
|
|
3635
|
+
if (kn(e.autoScroll), cr("cardHeader", e.cardHeader), cr("cardFooter", e.cardFooter), lr("header", e.mediaCard?.header), lr("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "replacement") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"replacement\".");
|
|
3636
|
+
if (yn(e.autofill), Vn(e.fill), de(e.masonry), nr(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3526
3637
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3527
3638
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3528
3639
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3537,7 +3648,7 @@ function rr(e) {
|
|
|
3537
3648
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3538
3649
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3539
3650
|
}
|
|
3540
|
-
function
|
|
3651
|
+
function dr(e) {
|
|
3541
3652
|
if (typeof e != "string") return e;
|
|
3542
3653
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3543
3654
|
let t = document.querySelector(e);
|
|
@@ -3546,7 +3657,7 @@ function ir(e) {
|
|
|
3546
3657
|
}
|
|
3547
3658
|
//#endregion
|
|
3548
3659
|
//#region src/core/pageRequest.ts
|
|
3549
|
-
async function
|
|
3660
|
+
async function fr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3550
3661
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
3551
3662
|
received: l.autofill.received,
|
|
3552
3663
|
requests: l.autofill.requests
|
|
@@ -3558,11 +3669,11 @@ async function ar({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3558
3669
|
let m = !1;
|
|
3559
3670
|
try {
|
|
3560
3671
|
if (u?.strategy === "frontend") {
|
|
3561
|
-
let s = await
|
|
3672
|
+
let s = await wn({
|
|
3562
3673
|
existingItems: e ? l.items : [],
|
|
3563
3674
|
initialCursor: n,
|
|
3564
3675
|
loadPage: i,
|
|
3565
|
-
maximumRequests: f ? Math.max(0,
|
|
3676
|
+
maximumRequests: f ? Math.max(0, gn(u) - f.requests) : void 0,
|
|
3566
3677
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3567
3678
|
onDelayChange: (e) => {
|
|
3568
3679
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3577,7 +3688,7 @@ async function ar({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3577
3688
|
signal: c
|
|
3578
3689
|
});
|
|
3579
3690
|
if (!r()) return;
|
|
3580
|
-
l.items = e ?
|
|
3691
|
+
l.items = e ? Z(l.items, s.items) : [...s.items], a(s.lastCursor), l.next = s.next, s.total !== void 0 && (l.total = s.total), Object.assign(l.autofill, {
|
|
3581
3692
|
missing: s.missing,
|
|
3582
3693
|
received: s.received,
|
|
3583
3694
|
requests: s.requests,
|
|
@@ -3585,12 +3696,12 @@ async function ar({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3585
3696
|
}), o(s.pages), t.clearCollection();
|
|
3586
3697
|
return;
|
|
3587
3698
|
}
|
|
3588
|
-
let s =
|
|
3699
|
+
let s = en(await i({
|
|
3589
3700
|
cursor: n,
|
|
3590
3701
|
signal: c
|
|
3591
3702
|
}));
|
|
3592
3703
|
if (!r()) return;
|
|
3593
|
-
let d = e ? l.items : [], h =
|
|
3704
|
+
let d = e ? l.items : [], h = Z(d, s.items), g = h.length - d.length;
|
|
3594
3705
|
if (l.items = h, a(n), o([{
|
|
3595
3706
|
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
3596
3707
|
cursor: n,
|
|
@@ -3605,7 +3716,7 @@ async function ar({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3605
3716
|
l.autofill.status = "complete";
|
|
3606
3717
|
return;
|
|
3607
3718
|
}
|
|
3608
|
-
await
|
|
3719
|
+
await Mn(u, l, {
|
|
3609
3720
|
cycleId: p,
|
|
3610
3721
|
feedKey: u.feedKey,
|
|
3611
3722
|
items: h.slice(d.length),
|
|
@@ -3627,16 +3738,16 @@ async function ar({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3627
3738
|
}
|
|
3628
3739
|
//#endregion
|
|
3629
3740
|
//#region src/core/removalReconciliationController.ts
|
|
3630
|
-
function
|
|
3741
|
+
function $(e) {
|
|
3631
3742
|
return `${typeof e}:${String(e)}`;
|
|
3632
3743
|
}
|
|
3633
|
-
function
|
|
3744
|
+
function pr(e) {
|
|
3634
3745
|
return `${typeof e}:${String(e)}`;
|
|
3635
3746
|
}
|
|
3636
|
-
function
|
|
3747
|
+
function mr(e) {
|
|
3637
3748
|
return e.map(({ postId: e }) => e);
|
|
3638
3749
|
}
|
|
3639
|
-
var
|
|
3750
|
+
var hr = class {
|
|
3640
3751
|
delay;
|
|
3641
3752
|
enabled;
|
|
3642
3753
|
maxReplayPages;
|
|
@@ -3655,7 +3766,7 @@ var lr = class {
|
|
|
3655
3766
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
3656
3767
|
}
|
|
3657
3768
|
filterItems(e) {
|
|
3658
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
3769
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has($(e)));
|
|
3659
3770
|
}
|
|
3660
3771
|
needsReconciliation(e) {
|
|
3661
3772
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -3668,45 +3779,45 @@ var lr = class {
|
|
|
3668
3779
|
}
|
|
3669
3780
|
recordInitialPage(e) {
|
|
3670
3781
|
e && this.recordPages([{
|
|
3671
|
-
contributionIds:
|
|
3672
|
-
cursor:
|
|
3782
|
+
contributionIds: mr(e.items),
|
|
3783
|
+
cursor: an(e),
|
|
3673
3784
|
next: e.next,
|
|
3674
|
-
returnedIds:
|
|
3785
|
+
returnedIds: mr(e.items)
|
|
3675
3786
|
}]);
|
|
3676
3787
|
}
|
|
3677
3788
|
remove(e) {
|
|
3678
|
-
e.forEach((e) => this.tombstones.add(
|
|
3789
|
+
e.forEach((e) => this.tombstones.add($(e)));
|
|
3679
3790
|
}
|
|
3680
3791
|
reset() {
|
|
3681
3792
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
3682
3793
|
}
|
|
3683
3794
|
restore(e) {
|
|
3684
|
-
e.forEach((e) => this.tombstones.delete(
|
|
3795
|
+
e.forEach((e) => this.tombstones.delete($(e)));
|
|
3685
3796
|
}
|
|
3686
3797
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
3687
3798
|
let a = this.pending ?? this.createSession(e);
|
|
3688
3799
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
3689
|
-
let e =
|
|
3800
|
+
let e = pr(a.cursor);
|
|
3690
3801
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3691
|
-
if (await
|
|
3692
|
-
delayMs:
|
|
3802
|
+
if (await mn({
|
|
3803
|
+
delayMs: pn(a.pages.length, this.delay),
|
|
3693
3804
|
onChange: n,
|
|
3694
3805
|
signal: i
|
|
3695
3806
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
3696
|
-
let o =
|
|
3807
|
+
let o = en(await t({
|
|
3697
3808
|
cursor: a.cursor,
|
|
3698
3809
|
signal: i
|
|
3699
3810
|
}));
|
|
3700
3811
|
a.seenCursors.add(e);
|
|
3701
3812
|
let s = this.filterItems(o.items), c = [];
|
|
3702
3813
|
if (s.forEach((e) => {
|
|
3703
|
-
let t =
|
|
3814
|
+
let t = $(e.postId);
|
|
3704
3815
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
3705
3816
|
}), a.pages.push({
|
|
3706
3817
|
contributionIds: c,
|
|
3707
3818
|
cursor: a.cursor,
|
|
3708
3819
|
next: o.next,
|
|
3709
|
-
returnedIds:
|
|
3820
|
+
returnedIds: mr(s)
|
|
3710
3821
|
}), a.lastCursor = a.cursor, a.next = o.next, --a.remainingRequests, o.total !== void 0 && (a.total = o.total), a.next === null ? a.remainingRequests = 0 : a.cursor = a.next, a.remainingRequests > 0 && r()) return this.result(a, "paused");
|
|
3711
3822
|
}
|
|
3712
3823
|
return this.result(a, "complete");
|
|
@@ -3714,9 +3825,9 @@ var lr = class {
|
|
|
3714
3825
|
createSession(e) {
|
|
3715
3826
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
3716
3827
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
3717
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
3828
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map($))), a = new Set(e.map(({ postId: e }) => $(e)).filter((e) => !i.has(e)));
|
|
3718
3829
|
return {
|
|
3719
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
3830
|
+
appended: new Set(e.map(({ postId: e }) => $(e))),
|
|
3720
3831
|
attributed: new Set(a),
|
|
3721
3832
|
cursor: r.cursor,
|
|
3722
3833
|
items: [],
|
|
@@ -3741,11 +3852,11 @@ var lr = class {
|
|
|
3741
3852
|
}
|
|
3742
3853
|
findUnderfilledPage(e) {
|
|
3743
3854
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
3744
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
3745
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
3855
|
+
let t = new Set(e.map(({ postId: e }) => $(e)));
|
|
3856
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
|
|
3746
3857
|
}
|
|
3747
3858
|
recordPage(e) {
|
|
3748
|
-
let t =
|
|
3859
|
+
let t = pr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => pr(e) === t);
|
|
3749
3860
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3750
3861
|
...e,
|
|
3751
3862
|
contributionIds: [...e.contributionIds],
|
|
@@ -3755,7 +3866,7 @@ var lr = class {
|
|
|
3755
3866
|
};
|
|
3756
3867
|
//#endregion
|
|
3757
3868
|
//#region src/core/activeItemRemoval.ts
|
|
3758
|
-
function
|
|
3869
|
+
function gr(e, t, n, r, i) {
|
|
3759
3870
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3760
3871
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3761
3872
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3768,7 +3879,7 @@ function ur(e, t, n, r, i) {
|
|
|
3768
3879
|
}
|
|
3769
3880
|
//#endregion
|
|
3770
3881
|
//#region src/core/exactMediaRemovalController.ts
|
|
3771
|
-
function
|
|
3882
|
+
function _r(e, t) {
|
|
3772
3883
|
let [n, ...r] = t;
|
|
3773
3884
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3774
3885
|
return {
|
|
@@ -3777,10 +3888,10 @@ function dr(e, t) {
|
|
|
3777
3888
|
items: r
|
|
3778
3889
|
};
|
|
3779
3890
|
}
|
|
3780
|
-
function
|
|
3891
|
+
function vr(e) {
|
|
3781
3892
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3782
3893
|
}
|
|
3783
|
-
var
|
|
3894
|
+
var yr = class {
|
|
3784
3895
|
generation = 0;
|
|
3785
3896
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3786
3897
|
state;
|
|
@@ -3788,7 +3899,7 @@ var pr = class {
|
|
|
3788
3899
|
this.options = e, this.state = e.state;
|
|
3789
3900
|
}
|
|
3790
3901
|
remove(e) {
|
|
3791
|
-
|
|
3902
|
+
vr(e);
|
|
3792
3903
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3793
3904
|
if (!n) return null;
|
|
3794
3905
|
let r = [...P(n)], i = r[e.mediaIndex];
|
|
@@ -3805,7 +3916,7 @@ var pr = class {
|
|
|
3805
3916
|
restored: !1
|
|
3806
3917
|
});
|
|
3807
3918
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3808
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3919
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = _r(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
|
|
3809
3920
|
}
|
|
3810
3921
|
reset() {
|
|
3811
3922
|
this.generation += 1;
|
|
@@ -3831,7 +3942,7 @@ var pr = class {
|
|
|
3831
3942
|
}
|
|
3832
3943
|
restoreIntoPost(e, t) {
|
|
3833
3944
|
let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3834
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3945
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = _r(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3835
3946
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3836
3947
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3837
3948
|
}
|
|
@@ -3844,18 +3955,18 @@ var pr = class {
|
|
|
3844
3955
|
};
|
|
3845
3956
|
//#endregion
|
|
3846
3957
|
//#region src/core/itemPlacement.ts
|
|
3847
|
-
function
|
|
3958
|
+
function br(e, t) {
|
|
3848
3959
|
let n = new Set(t);
|
|
3849
3960
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3850
3961
|
index: t,
|
|
3851
3962
|
item: e
|
|
3852
3963
|
}] : []);
|
|
3853
3964
|
}
|
|
3854
|
-
function
|
|
3965
|
+
function xr(e, t) {
|
|
3855
3966
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3856
3967
|
return e.filter((e) => !n.has(e.postId));
|
|
3857
3968
|
}
|
|
3858
|
-
function
|
|
3969
|
+
function Sr(e, t) {
|
|
3859
3970
|
t.forEach(({ index: e }) => {
|
|
3860
3971
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3861
3972
|
});
|
|
@@ -3866,7 +3977,7 @@ function gr(e, t) {
|
|
|
3866
3977
|
}
|
|
3867
3978
|
//#endregion
|
|
3868
3979
|
//#region src/core/itemRemovalController.ts
|
|
3869
|
-
var
|
|
3980
|
+
var Cr = 20, wr = class {
|
|
3870
3981
|
generation = 0;
|
|
3871
3982
|
historyLimit;
|
|
3872
3983
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3875,7 +3986,7 @@ var _r = 20, vr = class {
|
|
|
3875
3986
|
itemOrder;
|
|
3876
3987
|
stopItemsWatcher;
|
|
3877
3988
|
constructor(e) {
|
|
3878
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3989
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Cr, 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" });
|
|
3879
3990
|
}
|
|
3880
3991
|
destroy() {
|
|
3881
3992
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3889,7 +4000,7 @@ var _r = 20, vr = class {
|
|
|
3889
4000
|
let a = this.options.startRemoval(i, t);
|
|
3890
4001
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
3891
4002
|
let o = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), s = new Set(n.map(({ item: e }) => e.postId)), c = o < 0 ? 0 : this.state.items.slice(0, o).filter(({ postId: e }) => s.has(e)).length, l = Math.max(o - c, 0);
|
|
3892
|
-
return this.state.items =
|
|
4003
|
+
return this.state.items = xr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
3893
4004
|
}
|
|
3894
4005
|
reset() {
|
|
3895
4006
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3900,7 +4011,7 @@ var _r = 20, vr = class {
|
|
|
3900
4011
|
this.restoreRemoval(t);
|
|
3901
4012
|
return;
|
|
3902
4013
|
}
|
|
3903
|
-
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i =
|
|
4014
|
+
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = Sr(this.state.items, r);
|
|
3904
4015
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
3905
4016
|
}
|
|
3906
4017
|
restoreRemoval(e) {
|
|
@@ -3926,7 +4037,7 @@ var _r = 20, vr = class {
|
|
|
3926
4037
|
}
|
|
3927
4038
|
collectOrderedPlacements(e) {
|
|
3928
4039
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3929
|
-
return
|
|
4040
|
+
return br(this.state.items, e).map((e) => ({
|
|
3930
4041
|
index: t.get(e.item.postId) ?? e.index,
|
|
3931
4042
|
item: e.item
|
|
3932
4043
|
}));
|
|
@@ -3957,7 +4068,7 @@ var _r = 20, vr = class {
|
|
|
3957
4068
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3958
4069
|
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;
|
|
3959
4070
|
}
|
|
3960
|
-
},
|
|
4071
|
+
}, Tr = class {
|
|
3961
4072
|
forward = null;
|
|
3962
4073
|
forwardPromise = null;
|
|
3963
4074
|
forwardVersion = 0;
|
|
@@ -4044,7 +4155,7 @@ var _r = 20, vr = class {
|
|
|
4044
4155
|
}
|
|
4045
4156
|
}
|
|
4046
4157
|
}
|
|
4047
|
-
},
|
|
4158
|
+
}, Er = class {
|
|
4048
4159
|
generation = 0;
|
|
4049
4160
|
pending = Promise.resolve();
|
|
4050
4161
|
constructor(e) {
|
|
@@ -4094,24 +4205,24 @@ var _r = 20, vr = class {
|
|
|
4094
4205
|
};
|
|
4095
4206
|
//#endregion
|
|
4096
4207
|
//#region src/core/removalControllers.ts
|
|
4097
|
-
function
|
|
4098
|
-
let t = new
|
|
4208
|
+
function Dr(e) {
|
|
4209
|
+
let t = new Tr(e), n = new Er({
|
|
4099
4210
|
state: e.state,
|
|
4100
4211
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4101
4212
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4102
4213
|
});
|
|
4103
4214
|
return {
|
|
4104
|
-
exactMediaRemoval: new
|
|
4215
|
+
exactMediaRemoval: new yr({
|
|
4105
4216
|
onActivate: e.onActivate,
|
|
4106
4217
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4107
4218
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4108
4219
|
reelForward: t,
|
|
4109
4220
|
state: e.state
|
|
4110
4221
|
}),
|
|
4111
|
-
itemRemoval: new
|
|
4222
|
+
itemRemoval: new wr({
|
|
4112
4223
|
historyLimit: e.historyLimit,
|
|
4113
4224
|
onItemsRemoved: (n, r, i) => {
|
|
4114
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4225
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), gr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4115
4226
|
},
|
|
4116
4227
|
onRemovalRestored: (n) => {
|
|
4117
4228
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4126,17 +4237,17 @@ function xr(e) {
|
|
|
4126
4237
|
reelRemoval: n
|
|
4127
4238
|
};
|
|
4128
4239
|
}
|
|
4129
|
-
var
|
|
4130
|
-
function
|
|
4240
|
+
var Or = 1.5;
|
|
4241
|
+
function kr(e) {
|
|
4131
4242
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4132
4243
|
if (t > 0 && t < 600) return !0;
|
|
4133
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4244
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Or;
|
|
4134
4245
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4135
4246
|
}
|
|
4136
|
-
function
|
|
4137
|
-
return
|
|
4247
|
+
function Ar(e) {
|
|
4248
|
+
return kr(e) ? "reel" : "masonry";
|
|
4138
4249
|
}
|
|
4139
|
-
function
|
|
4250
|
+
function jr(e) {
|
|
4140
4251
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4141
4252
|
return {
|
|
4142
4253
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4146,15 +4257,15 @@ function Tr(e) {
|
|
|
4146
4257
|
viewportWidth: n.clientWidth
|
|
4147
4258
|
};
|
|
4148
4259
|
}
|
|
4149
|
-
function
|
|
4150
|
-
return
|
|
4260
|
+
function Mr(e) {
|
|
4261
|
+
return kr(jr(e));
|
|
4151
4262
|
}
|
|
4152
|
-
function
|
|
4153
|
-
return
|
|
4263
|
+
function Nr(e) {
|
|
4264
|
+
return Ar(jr(e));
|
|
4154
4265
|
}
|
|
4155
4266
|
//#endregion
|
|
4156
4267
|
//#region src/core/responsiveLayoutController.ts
|
|
4157
|
-
var
|
|
4268
|
+
var Pr = class {
|
|
4158
4269
|
layoutMode;
|
|
4159
4270
|
resizeObserver = null;
|
|
4160
4271
|
target = null;
|
|
@@ -4179,10 +4290,24 @@ var Or = class {
|
|
|
4179
4290
|
}
|
|
4180
4291
|
handleResponsiveLayout = () => {
|
|
4181
4292
|
if (!this.target) return;
|
|
4182
|
-
let e =
|
|
4183
|
-
this.state.phoneMode =
|
|
4293
|
+
let e = Nr(this.target);
|
|
4294
|
+
this.state.phoneMode = Mr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4184
4295
|
};
|
|
4185
|
-
},
|
|
4296
|
+
}, Fr = class {
|
|
4297
|
+
state;
|
|
4298
|
+
constructor(e) {
|
|
4299
|
+
this.options = e, this.state = x(Ze({
|
|
4300
|
+
...e.initialReelAudioState,
|
|
4301
|
+
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
4302
|
+
}));
|
|
4303
|
+
}
|
|
4304
|
+
get() {
|
|
4305
|
+
return { ...this.state };
|
|
4306
|
+
}
|
|
4307
|
+
set(e, t = !1) {
|
|
4308
|
+
Object.assign(this.state, Ze(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4309
|
+
}
|
|
4310
|
+
}, Ir = class {
|
|
4186
4311
|
routedReelPostId = null;
|
|
4187
4312
|
reelRouteIsActive = !1;
|
|
4188
4313
|
constructor(e, t) {
|
|
@@ -4209,7 +4334,7 @@ var Or = class {
|
|
|
4209
4334
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
4210
4335
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
4211
4336
|
}
|
|
4212
|
-
},
|
|
4337
|
+
}, Lr = class {
|
|
4213
4338
|
app = null;
|
|
4214
4339
|
autoScroll;
|
|
4215
4340
|
autofillController;
|
|
@@ -4229,26 +4354,27 @@ var Or = class {
|
|
|
4229
4354
|
stopStateWatcher = null;
|
|
4230
4355
|
lastLoadedCursor = null;
|
|
4231
4356
|
notificationItems;
|
|
4357
|
+
reelAudio;
|
|
4232
4358
|
state;
|
|
4233
4359
|
constructor(e) {
|
|
4234
|
-
this.options = e,
|
|
4360
|
+
this.options = e, ur(e);
|
|
4235
4361
|
let t = e.layout ?? "masonry";
|
|
4236
|
-
this.state = x(
|
|
4362
|
+
this.state = x(sr(e, t)), this.reelAudio = new Fr(e), this.lastLoadedCursor = e.initialPage ? an(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new jn({
|
|
4237
4363
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4238
4364
|
state: this.state.autoScroll
|
|
4239
|
-
}), this.autofillController = new
|
|
4365
|
+
}), this.autofillController = new Tn({
|
|
4240
4366
|
cancelRequest: () => this.cancelRequest(),
|
|
4241
4367
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4242
4368
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4243
4369
|
options: e.autofill,
|
|
4244
4370
|
state: this.state
|
|
4245
|
-
}), this.removalReconciliation = new
|
|
4371
|
+
}), this.removalReconciliation = new hr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Qn({
|
|
4246
4372
|
fill: e.fill,
|
|
4247
4373
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4248
4374
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4249
4375
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4250
4376
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4251
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4377
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => $n({
|
|
4252
4378
|
controller: this.removalReconciliation,
|
|
4253
4379
|
isCurrent: t,
|
|
4254
4380
|
loadPage: e.loadPage,
|
|
@@ -4258,8 +4384,8 @@ var Or = class {
|
|
|
4258
4384
|
state: this.state
|
|
4259
4385
|
}),
|
|
4260
4386
|
state: this.state
|
|
4261
|
-
}), this.routing = new
|
|
4262
|
-
let n =
|
|
4387
|
+
}), this.routing = new Ir(e.routing, this.state);
|
|
4388
|
+
let n = Dr({
|
|
4263
4389
|
historyLimit: e.removalHistoryLimit,
|
|
4264
4390
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4265
4391
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
@@ -4268,25 +4394,26 @@ var Or = class {
|
|
|
4268
4394
|
state: this.state,
|
|
4269
4395
|
surface: () => this.surface
|
|
4270
4396
|
});
|
|
4271
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
4397
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Pr(t, this.state, () => {
|
|
4272
4398
|
this.routing.syncFeed();
|
|
4273
4399
|
}), this.startStateNotifications();
|
|
4274
4400
|
}
|
|
4275
4401
|
async mount() {
|
|
4276
4402
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4277
4403
|
this.startStateNotifications();
|
|
4278
|
-
let e =
|
|
4279
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4404
|
+
let e = dr(this.options.target);
|
|
4405
|
+
this.responsiveLayout.mount(e), this.app = i($t, {
|
|
4280
4406
|
canRetryEnd: !!this.options.loadPage,
|
|
4281
4407
|
cardFooter: this.options.cardFooter,
|
|
4282
4408
|
cardHeader: this.options.cardHeader,
|
|
4283
4409
|
feedFooter: this.options.feedFooter,
|
|
4284
|
-
feedFooterActions:
|
|
4410
|
+
feedFooterActions: er(this),
|
|
4285
4411
|
mediaCard: this.options.mediaCard,
|
|
4286
4412
|
masonry: this.options.masonry,
|
|
4287
4413
|
onMediaReady: this.options.onMediaReady,
|
|
4288
4414
|
onMediaVisible: this.options.onMediaVisible,
|
|
4289
4415
|
onReelMediaChange: this.options.onReelMediaChange,
|
|
4416
|
+
reelAudioState: this.reelAudio.state,
|
|
4290
4417
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
4291
4418
|
state: this.state,
|
|
4292
4419
|
onActiveReelChange: (e) => {
|
|
@@ -4298,13 +4425,14 @@ var Or = class {
|
|
|
4298
4425
|
},
|
|
4299
4426
|
onOpenReel: (e) => this.openMasonryReel(e),
|
|
4300
4427
|
onReelInfoSheetChange: (e) => this.setReelInfoSheet(e),
|
|
4428
|
+
onReelAudioChange: (e) => this.reelAudio.set(e, !0),
|
|
4301
4429
|
onRetryEnd: () => {
|
|
4302
4430
|
this.retryEnd();
|
|
4303
4431
|
},
|
|
4304
4432
|
onRetryForward: () => {
|
|
4305
4433
|
this.retryReelForward();
|
|
4306
4434
|
}
|
|
4307
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
4435
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await In(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
4308
4436
|
this.restoreController = e;
|
|
4309
4437
|
}), !this.options.initialPage && this.state.items.length === 0 ? await this.reload() : this.options.autofill && this.state.autofill.status === "idle" && !this.fillController.isActive() && !this.state.loadMoreLocked && await this.startInitialAutofill();
|
|
4310
4438
|
}
|
|
@@ -4314,6 +4442,12 @@ var Or = class {
|
|
|
4314
4442
|
getState() {
|
|
4315
4443
|
return z(this.state);
|
|
4316
4444
|
}
|
|
4445
|
+
getReelAudioState() {
|
|
4446
|
+
return this.reelAudio.get();
|
|
4447
|
+
}
|
|
4448
|
+
setReelAudioState(e) {
|
|
4449
|
+
this.reelAudio.set(e);
|
|
4450
|
+
}
|
|
4317
4451
|
removeMedia(e) {
|
|
4318
4452
|
return this.exactMediaRemoval.remove(e);
|
|
4319
4453
|
}
|
|
@@ -4369,7 +4503,7 @@ var Or = class {
|
|
|
4369
4503
|
this.autoScroll.setSpeed(e);
|
|
4370
4504
|
}
|
|
4371
4505
|
applyAutofillUpdate(e) {
|
|
4372
|
-
let t =
|
|
4506
|
+
let t = Pn(this.options.autofill, this.state, e);
|
|
4373
4507
|
return t && this.autofillController.syncCountdown(), t;
|
|
4374
4508
|
}
|
|
4375
4509
|
cancelAutofill() {
|
|
@@ -4380,7 +4514,7 @@ var Or = class {
|
|
|
4380
4514
|
await this.cancelFill();
|
|
4381
4515
|
return;
|
|
4382
4516
|
}
|
|
4383
|
-
if (
|
|
4517
|
+
if (xn(this.state.autofill)) {
|
|
4384
4518
|
await this.cancelAutofill();
|
|
4385
4519
|
return;
|
|
4386
4520
|
}
|
|
@@ -4394,12 +4528,12 @@ var Or = class {
|
|
|
4394
4528
|
}
|
|
4395
4529
|
async fill(e) {
|
|
4396
4530
|
if (!this.state.loadMoreLocked) {
|
|
4397
|
-
if (this.pendingRequest ||
|
|
4531
|
+
if (this.pendingRequest || xn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4398
4532
|
await this.fillController.start(e);
|
|
4399
4533
|
}
|
|
4400
4534
|
}
|
|
4401
4535
|
restoreAutofillSession(e) {
|
|
4402
|
-
let t =
|
|
4536
|
+
let t = Fn(this.options.autofill, this.state, e);
|
|
4403
4537
|
return t && this.autofillController.syncCountdown(), t;
|
|
4404
4538
|
}
|
|
4405
4539
|
restoreFillSession(e) {
|
|
@@ -4409,14 +4543,14 @@ var Or = class {
|
|
|
4409
4543
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
4410
4544
|
}
|
|
4411
4545
|
appendPage(e) {
|
|
4412
|
-
|
|
4546
|
+
on(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
4413
4547
|
}
|
|
4414
4548
|
replenishAfterRemoval() {
|
|
4415
4549
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
4416
4550
|
}
|
|
4417
4551
|
async startLoadMore(e) {
|
|
4418
4552
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4419
|
-
if (this.state.loadMoreLocked ||
|
|
4553
|
+
if (this.state.loadMoreLocked || xn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
4420
4554
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4421
4555
|
let t = e();
|
|
4422
4556
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -4431,12 +4565,12 @@ var Or = class {
|
|
|
4431
4565
|
}
|
|
4432
4566
|
async replaceFeed(e, t) {
|
|
4433
4567
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4434
|
-
return
|
|
4568
|
+
return xn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = bn(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
|
|
4435
4569
|
}
|
|
4436
4570
|
async loadFilteredPage(e) {
|
|
4437
4571
|
let t = this.options.loadPage;
|
|
4438
4572
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4439
|
-
let n =
|
|
4573
|
+
let n = en(await t(e));
|
|
4440
4574
|
return {
|
|
4441
4575
|
...n,
|
|
4442
4576
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4455,7 +4589,7 @@ var Or = class {
|
|
|
4455
4589
|
let t = ++this.requestVersion, n = new AbortController();
|
|
4456
4590
|
this.abortController = n;
|
|
4457
4591
|
try {
|
|
4458
|
-
let r = await
|
|
4592
|
+
let r = await $n({
|
|
4459
4593
|
controller: this.removalReconciliation,
|
|
4460
4594
|
isCurrent: () => t === this.requestVersion,
|
|
4461
4595
|
loadPage: e,
|
|
@@ -4473,7 +4607,7 @@ var Or = class {
|
|
|
4473
4607
|
}
|
|
4474
4608
|
async retryEnd() {
|
|
4475
4609
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4476
|
-
if (!this.state.loadMoreLocked && !(
|
|
4610
|
+
if (!this.state.loadMoreLocked && !(xn(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);
|
|
4477
4611
|
}
|
|
4478
4612
|
setInfiniteScroll(e) {
|
|
4479
4613
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4497,10 +4631,10 @@ var Or = class {
|
|
|
4497
4631
|
this.state.total = e;
|
|
4498
4632
|
}
|
|
4499
4633
|
setReelAutoAdvance(e) {
|
|
4500
|
-
|
|
4634
|
+
ir(this.state.reelAutoAdvance, e);
|
|
4501
4635
|
}
|
|
4502
4636
|
setReelInfoSheet(e) {
|
|
4503
|
-
|
|
4637
|
+
or(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4504
4638
|
}
|
|
4505
4639
|
setLayout(e) {
|
|
4506
4640
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4520,7 +4654,7 @@ var Or = class {
|
|
|
4520
4654
|
async fetchPage(e, t) {
|
|
4521
4655
|
if (!this.options.loadPage) return;
|
|
4522
4656
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4523
|
-
this.abortController = r, await
|
|
4657
|
+
this.abortController = r, await fr({
|
|
4524
4658
|
append: t,
|
|
4525
4659
|
autofillController: this.autofillController,
|
|
4526
4660
|
cursor: e,
|
|
@@ -4542,7 +4676,7 @@ var Or = class {
|
|
|
4542
4676
|
startInitialAutofill() {
|
|
4543
4677
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4544
4678
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4545
|
-
let r =
|
|
4679
|
+
let r = Ln({
|
|
4546
4680
|
cycleId: n,
|
|
4547
4681
|
isCurrent: () => e === this.requestVersion,
|
|
4548
4682
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4569,8 +4703,8 @@ var Or = class {
|
|
|
4569
4703
|
this.lastLoadedCursor = e, this.state.current = e;
|
|
4570
4704
|
}
|
|
4571
4705
|
};
|
|
4572
|
-
function
|
|
4573
|
-
return new
|
|
4706
|
+
function Rr(e) {
|
|
4707
|
+
return new Lr(e);
|
|
4574
4708
|
}
|
|
4575
4709
|
//#endregion
|
|
4576
|
-
export {
|
|
4710
|
+
export { Rr as createVibe };
|