@wyxos/vibe 5.8.0 → 5.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +1 -1
- package/lib/index.js +610 -622
- package/lib/style.css +1 -1
- 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 oe(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 le(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 ue({ 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 Q = ["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 Q = ["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 Q = ["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 Q = ["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 Q = ["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 Q = ["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 Q = ["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,34 +751,34 @@ 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
759
|
lastAudibleVolume: 1,
|
|
760
760
|
muted: !1,
|
|
761
761
|
volume: 1
|
|
762
762
|
};
|
|
763
|
-
function
|
|
763
|
+
function Xe(e, t) {
|
|
764
764
|
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
765
765
|
}
|
|
766
|
-
function
|
|
767
|
-
let n =
|
|
766
|
+
function Ze(e, t = Ye) {
|
|
767
|
+
let n = Xe(e?.volume, t.volume), r = Xe(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
|
|
768
768
|
return {
|
|
769
|
-
lastAudibleVolume: r > 0 ? r :
|
|
769
|
+
lastAudibleVolume: r > 0 ? r : Ye.lastAudibleVolume,
|
|
770
770
|
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
771
771
|
volume: n
|
|
772
772
|
};
|
|
773
773
|
}
|
|
774
774
|
//#endregion
|
|
775
775
|
//#region src/components/useMediaCardAudio.ts
|
|
776
|
-
function
|
|
777
|
-
let t =
|
|
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
778
|
function o() {
|
|
779
779
|
let t = e.videoElement.value, n = e.reelAudioState();
|
|
780
780
|
if (!t || e.layout() !== "reel" || !n) return;
|
|
781
|
-
let o =
|
|
781
|
+
let o = Ze(n);
|
|
782
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
783
|
}
|
|
784
784
|
function s(e, t) {
|
|
@@ -786,7 +786,7 @@ function Xe(e) {
|
|
|
786
786
|
}
|
|
787
787
|
function c(t) {
|
|
788
788
|
if (e.layout() !== "reel") return;
|
|
789
|
-
let n =
|
|
789
|
+
let n = Ze({
|
|
790
790
|
lastAudibleVolume: a,
|
|
791
791
|
muted: t.muted,
|
|
792
792
|
volume: t.volume
|
|
@@ -821,7 +821,7 @@ function Xe(e) {
|
|
|
821
821
|
}
|
|
822
822
|
//#endregion
|
|
823
823
|
//#region src/components/useReelVideoActivity.ts
|
|
824
|
-
function
|
|
824
|
+
function $e(e) {
|
|
825
825
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
826
826
|
function i() {
|
|
827
827
|
if (!t.value) {
|
|
@@ -855,21 +855,21 @@ function Ze(e) {
|
|
|
855
855
|
}
|
|
856
856
|
//#endregion
|
|
857
857
|
//#region src/core/mediaType.ts
|
|
858
|
-
var
|
|
859
|
-
function
|
|
858
|
+
var et = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
859
|
+
function tt(e) {
|
|
860
860
|
try {
|
|
861
|
-
return
|
|
861
|
+
return et.test(new URL(e).pathname);
|
|
862
862
|
} catch {
|
|
863
|
-
return
|
|
863
|
+
return et.test(e.split("?")[0] ?? e);
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
function
|
|
867
|
-
return e === void 0 ?
|
|
866
|
+
function nt(e, t) {
|
|
867
|
+
return e === void 0 ? tt(t) : e === "video";
|
|
868
868
|
}
|
|
869
869
|
//#endregion
|
|
870
870
|
//#region src/components/useMediaLoading.ts
|
|
871
|
-
function
|
|
872
|
-
let t = r(() =>
|
|
871
|
+
function rt(e) {
|
|
872
|
+
let t = r(() => nt(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
|
|
873
873
|
return O(i, (t, n) => {
|
|
874
874
|
n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
|
|
875
875
|
}), {
|
|
@@ -880,7 +880,7 @@ function tt(e) {
|
|
|
880
880
|
}
|
|
881
881
|
//#endregion
|
|
882
882
|
//#region src/components/useMediaReadiness.ts
|
|
883
|
-
function
|
|
883
|
+
function it(e) {
|
|
884
884
|
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
885
885
|
function f() {
|
|
886
886
|
l !== null && clearTimeout(l), l = null;
|
|
@@ -938,7 +938,7 @@ function nt(e) {
|
|
|
938
938
|
}
|
|
939
939
|
//#endregion
|
|
940
940
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
941
|
-
var
|
|
941
|
+
var at = [
|
|
942
942
|
"data-post-id",
|
|
943
943
|
"data-media-index",
|
|
944
944
|
"aria-hidden",
|
|
@@ -946,12 +946,12 @@ var rt = [
|
|
|
946
946
|
"inert",
|
|
947
947
|
"role",
|
|
948
948
|
"tabindex"
|
|
949
|
-
],
|
|
949
|
+
], ot = { class: "media-card-content" }, st = ["data-media-direction"], ct = ["data-media-index"], lt = {
|
|
950
950
|
key: 0,
|
|
951
951
|
"data-test": "media-loading",
|
|
952
952
|
class: "media-loading",
|
|
953
953
|
"aria-hidden": "true"
|
|
954
|
-
},
|
|
954
|
+
}, ut = [
|
|
955
955
|
"data-source-generation",
|
|
956
956
|
"src",
|
|
957
957
|
"width",
|
|
@@ -960,14 +960,14 @@ var rt = [
|
|
|
960
960
|
"loop",
|
|
961
961
|
"muted",
|
|
962
962
|
"preload"
|
|
963
|
-
],
|
|
963
|
+
], dt = [
|
|
964
964
|
"data-source-generation",
|
|
965
965
|
"src",
|
|
966
966
|
"width",
|
|
967
967
|
"height",
|
|
968
968
|
"fetchpriority",
|
|
969
969
|
"loading"
|
|
970
|
-
],
|
|
970
|
+
], ft = ["aria-label"], pt = ["aria-label"], mt = ["aria-label"], ht = 40, gt = 160, _t = 24, vt = /* @__PURE__ */ d({
|
|
971
971
|
__name: "MediaCard",
|
|
972
972
|
props: {
|
|
973
973
|
active: { type: Boolean },
|
|
@@ -1005,102 +1005,102 @@ var rt = [
|
|
|
1005
1005
|
function S(e = !1, t = "pointer") {
|
|
1006
1006
|
e && x("activate", t);
|
|
1007
1007
|
}
|
|
1008
|
-
let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement:
|
|
1008
|
+
let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: H, markSourceReady: U, noteSourceActivity: W, retrySource: ee, retrying: te, sourceGeneration: G, videoElement: K } = it({
|
|
1009
1009
|
identity: () => `${l.item.postId}:${T.value}:${l.mediaSource ?? "preview"}:${M.value}:${L.value ?? ""}`,
|
|
1010
1010
|
mediaIndex: () => T.value,
|
|
1011
1011
|
onError: (e) => x("error", e),
|
|
1012
1012
|
onReady: (e) => x("ready", e),
|
|
1013
1013
|
previewState: () => l.previewState
|
|
1014
|
-
}),
|
|
1014
|
+
}), ne = w(0), re = w(0), q = w(!1), { apply: ie, setVolume: ae, sync: oe, toggleMute: se, videoIsMuted: J, videoVolume: ce } = Qe({
|
|
1015
1015
|
active: () => l.active,
|
|
1016
1016
|
layout: () => l.layout,
|
|
1017
1017
|
mediaCard: () => l.mediaCard,
|
|
1018
1018
|
onChange: (e) => x("reelAudioChange", e),
|
|
1019
1019
|
reelAudioState: () => l.reelAudioState,
|
|
1020
|
-
videoElement:
|
|
1021
|
-
}), { effectiveMuted:
|
|
1020
|
+
videoElement: K
|
|
1021
|
+
}), { effectiveMuted: le, onPlaying: ue, playbackAllowed: de } = $e({
|
|
1022
1022
|
active: () => l.active,
|
|
1023
1023
|
layout: () => l.layout,
|
|
1024
|
-
videoElement:
|
|
1025
|
-
videoIsMuted:
|
|
1026
|
-
videoIsPlaying:
|
|
1027
|
-
}),
|
|
1028
|
-
function
|
|
1024
|
+
videoElement: K,
|
|
1025
|
+
videoIsMuted: J,
|
|
1026
|
+
videoIsPlaying: q
|
|
1027
|
+
}), Y = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
1028
|
+
function fe(e) {
|
|
1029
1029
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function X(e, t) {
|
|
1032
1032
|
let n = C.value.length, r = (e + n) % n;
|
|
1033
1033
|
r !== T.value && (y.value = e < T.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1035
|
+
function pe(e, t, n) {
|
|
1036
1036
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
1037
1037
|
}
|
|
1038
|
-
function
|
|
1038
|
+
function me() {
|
|
1039
1039
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1042
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
1041
|
+
function he() {
|
|
1042
|
+
d !== null && clearTimeout(d), d = setTimeout(me, gt);
|
|
1043
1043
|
}
|
|
1044
|
-
function
|
|
1044
|
+
function ge(e) {
|
|
1045
1045
|
if (C.value.length <= 1) return;
|
|
1046
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
1047
|
-
if (n === 0 || (e.preventDefault(),
|
|
1046
|
+
let t = e.currentTarget?.clientWidth || 1, n = pe(e.deltaX, e.deltaMode, t);
|
|
1047
|
+
if (n === 0 || (e.preventDefault(), he(), p) || (f += n, Math.abs(f) < _t)) return;
|
|
1048
1048
|
let r = Math.sign(f);
|
|
1049
|
-
f = 0, p = !0,
|
|
1049
|
+
f = 0, p = !0, X(T.value + r);
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1051
|
+
function _e(e) {
|
|
1052
1052
|
let t = e.touches[0];
|
|
1053
1053
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function ve(e) {
|
|
1056
1056
|
let t = e.changedTouches[0];
|
|
1057
1057
|
if (m === null || g === null || !t) return;
|
|
1058
1058
|
let n = m - t.clientX, r = g - t.clientY;
|
|
1059
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
1059
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < ht || X(T.value + Math.sign(n)));
|
|
1060
1060
|
}
|
|
1061
|
-
let { imageLoading:
|
|
1061
|
+
let { imageLoading: ye, mediaIsTimed: be, videoPreload: xe } = rt({
|
|
1062
1062
|
active: () => l.active,
|
|
1063
1063
|
fetchPriority: () => l.fetchPriority,
|
|
1064
1064
|
layout: () => l.layout,
|
|
1065
1065
|
mediaSource: () => M.value,
|
|
1066
1066
|
mediaType: () => L.value,
|
|
1067
|
-
videoElement:
|
|
1068
|
-
}),
|
|
1069
|
-
function
|
|
1070
|
-
l.layout === "reel" && (e.stopPropagation(),
|
|
1067
|
+
videoElement: K
|
|
1068
|
+
}), 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}`);
|
|
1069
|
+
function Te(e) {
|
|
1070
|
+
l.layout === "reel" && (e.stopPropagation(), Ee());
|
|
1071
1071
|
}
|
|
1072
|
-
async function
|
|
1073
|
-
if (!(!
|
|
1074
|
-
if (
|
|
1075
|
-
|
|
1072
|
+
async function Ee() {
|
|
1073
|
+
if (!(!K.value || !de.value)) {
|
|
1074
|
+
if (q.value) {
|
|
1075
|
+
K.value.pause();
|
|
1076
1076
|
return;
|
|
1077
1077
|
}
|
|
1078
1078
|
try {
|
|
1079
|
-
await
|
|
1079
|
+
await K.value.play();
|
|
1080
1080
|
} catch {
|
|
1081
|
-
|
|
1081
|
+
q.value = !1;
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function ke(e) {
|
|
1086
1086
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1089
|
-
let t = e?.currentTarget ??
|
|
1090
|
-
t && (
|
|
1088
|
+
function Ae(e) {
|
|
1089
|
+
let t = e?.currentTarget ?? K.value;
|
|
1090
|
+
t && (ne.value = ke(t.currentTime), re.value = ke(t.duration), oe(t, de.value));
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1093
|
-
|
|
1092
|
+
function je(e) {
|
|
1093
|
+
ie(), Ae(e), U(e);
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1096
|
-
|
|
1095
|
+
function Me() {
|
|
1096
|
+
q.value = !1, x("ended", T.value);
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1099
|
-
let t =
|
|
1100
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(
|
|
1098
|
+
function Ne(e) {
|
|
1099
|
+
let t = K.value;
|
|
1100
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(ke(t.duration), Math.max(0, e)), ne.value = t.currentTime);
|
|
1101
1101
|
}
|
|
1102
1102
|
return v(() => {
|
|
1103
|
-
|
|
1103
|
+
me();
|
|
1104
1104
|
}), (r, i) => (b(), s("article", {
|
|
1105
1105
|
"data-post-id": e.item.postId,
|
|
1106
1106
|
"data-media-index": T.value,
|
|
@@ -1112,14 +1112,14 @@ var rt = [
|
|
|
1112
1112
|
}]),
|
|
1113
1113
|
style: _(e.itemStyle),
|
|
1114
1114
|
"aria-hidden": e.leaving || void 0,
|
|
1115
|
-
"aria-busy": E(B) === "loading" || E(
|
|
1115
|
+
"aria-busy": E(B) === "loading" || E(te),
|
|
1116
1116
|
inert: e.leaving || void 0,
|
|
1117
|
-
role: e.interactive && !e.leaving && !
|
|
1118
|
-
tabindex: e.interactive && !e.leaving && !
|
|
1119
|
-
onClick: i[14] ||= (t) => S(e.interactive && !
|
|
1120
|
-
onKeydown: [i[15] ||= A((t) => S(e.interactive && !
|
|
1121
|
-
}, [c("div",
|
|
1122
|
-
e.cardHeader ? (b(), a(
|
|
1117
|
+
role: e.interactive && !e.leaving && !Y.value ? "button" : void 0,
|
|
1118
|
+
tabindex: e.interactive && !e.leaving && !Y.value ? 0 : void 0,
|
|
1119
|
+
onClick: i[14] ||= (t) => S(e.interactive && !Y.value, fe(t)),
|
|
1120
|
+
onKeydown: [i[15] ||= A((t) => S(e.interactive && !Y.value, "keyboard"), ["enter"]), i[16] ||= A(j((t) => S(e.interactive && !Y.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1121
|
+
}, [c("div", ot, [
|
|
1122
|
+
e.cardHeader ? (b(), a(Ie, {
|
|
1123
1123
|
key: 0,
|
|
1124
1124
|
index: e.index,
|
|
1125
1125
|
item: e.item,
|
|
@@ -1145,36 +1145,36 @@ var rt = [
|
|
|
1145
1145
|
c("div", {
|
|
1146
1146
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
1147
1147
|
"data-media-direction": y.value,
|
|
1148
|
-
onWheel:
|
|
1149
|
-
onTouchstartPassive:
|
|
1150
|
-
onTouchendPassive:
|
|
1148
|
+
onWheel: ge,
|
|
1149
|
+
onTouchstartPassive: _e,
|
|
1150
|
+
onTouchendPassive: ve
|
|
1151
1151
|
}, [
|
|
1152
1152
|
u(n, {
|
|
1153
|
-
css: !E(
|
|
1153
|
+
css: !E(te),
|
|
1154
1154
|
name: `media-slide-${y.value}`
|
|
1155
1155
|
}, {
|
|
1156
1156
|
default: k(() => [(b(), s("div", {
|
|
1157
|
-
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(
|
|
1157
|
+
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(G)}`,
|
|
1158
1158
|
class: "media-card-frame",
|
|
1159
1159
|
"data-media-index": T.value
|
|
1160
|
-
}, [E(B) === "loading" ? (b(), s("div",
|
|
1160
|
+
}, [E(B) === "loading" ? (b(), s("div", lt, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Be, {
|
|
1161
1161
|
key: 1,
|
|
1162
1162
|
component: e.mediaCard?.error?.component,
|
|
1163
|
-
label: E(
|
|
1164
|
-
retrying: E(
|
|
1165
|
-
status: E(
|
|
1166
|
-
onRetry: E(
|
|
1163
|
+
label: E(Fe)(M.value),
|
|
1164
|
+
retrying: E(te),
|
|
1165
|
+
status: E(Pe)(M.value),
|
|
1166
|
+
onRetry: E(ee)
|
|
1167
1167
|
}, null, 8, [
|
|
1168
1168
|
"component",
|
|
1169
1169
|
"label",
|
|
1170
1170
|
"retrying",
|
|
1171
1171
|
"status",
|
|
1172
1172
|
"onRetry"
|
|
1173
|
-
])) : o("", !0), E(
|
|
1173
|
+
])) : o("", !0), E(be) ? (b(), s("video", {
|
|
1174
1174
|
key: 2,
|
|
1175
1175
|
ref_key: "videoElement",
|
|
1176
|
-
ref:
|
|
1177
|
-
"data-source-generation": E(
|
|
1176
|
+
ref: K,
|
|
1177
|
+
"data-source-generation": E(G),
|
|
1178
1178
|
class: h(["media-preview", {
|
|
1179
1179
|
"media-preview--ready": E(B) === "ready",
|
|
1180
1180
|
"media-preview--reel-video": e.layout === "reel"
|
|
@@ -1182,28 +1182,28 @@ var rt = [
|
|
|
1182
1182
|
src: M.value,
|
|
1183
1183
|
width: R.value ?? void 0,
|
|
1184
1184
|
height: z.value ?? void 0,
|
|
1185
|
-
autoplay: E(
|
|
1185
|
+
autoplay: E(de),
|
|
1186
1186
|
loop: !e.advanceOnMediaEnd,
|
|
1187
|
-
muted: E(
|
|
1187
|
+
muted: E(le),
|
|
1188
1188
|
playsinline: "",
|
|
1189
|
-
preload: E(
|
|
1190
|
-
onLoadedmetadata:
|
|
1191
|
-
onProgress: i[0] ||= (...e) => E(
|
|
1192
|
-
onLoadeddata: i[1] ||= (...e) => E(
|
|
1193
|
-
onCanplay: i[2] ||= (...e) => E(
|
|
1194
|
-
onDurationchange:
|
|
1195
|
-
onTimeupdate:
|
|
1196
|
-
onVolumechange:
|
|
1197
|
-
onPlaying: i[3] ||= (...e) => E(
|
|
1198
|
-
onPause: i[4] ||= (e) =>
|
|
1199
|
-
onEnded:
|
|
1200
|
-
onClick:
|
|
1189
|
+
preload: E(xe),
|
|
1190
|
+
onLoadedmetadata: je,
|
|
1191
|
+
onProgress: i[0] ||= (...e) => E(W) && E(W)(...e),
|
|
1192
|
+
onLoadeddata: i[1] ||= (...e) => E(W) && E(W)(...e),
|
|
1193
|
+
onCanplay: i[2] ||= (...e) => E(W) && E(W)(...e),
|
|
1194
|
+
onDurationchange: Ae,
|
|
1195
|
+
onTimeupdate: Ae,
|
|
1196
|
+
onVolumechange: Ae,
|
|
1197
|
+
onPlaying: i[3] ||= (...e) => E(ue) && E(ue)(...e),
|
|
1198
|
+
onPause: i[4] ||= (e) => q.value = !1,
|
|
1199
|
+
onEnded: Me,
|
|
1200
|
+
onClick: Te,
|
|
1201
1201
|
onError: i[5] ||= (...e) => E(V) && E(V)(...e)
|
|
1202
|
-
}, null, 42,
|
|
1202
|
+
}, null, 42, ut)) : (b(), s("img", {
|
|
1203
1203
|
key: 3,
|
|
1204
1204
|
ref_key: "imageElement",
|
|
1205
|
-
ref:
|
|
1206
|
-
"data-source-generation": E(
|
|
1205
|
+
ref: H,
|
|
1206
|
+
"data-source-generation": E(G),
|
|
1207
1207
|
class: h(["media-preview", { "media-preview--ready": E(B) === "ready" }]),
|
|
1208
1208
|
src: M.value,
|
|
1209
1209
|
width: R.value ?? void 0,
|
|
@@ -1211,32 +1211,32 @@ var rt = [
|
|
|
1211
1211
|
fetchpriority: e.fetchPriority,
|
|
1212
1212
|
alt: "",
|
|
1213
1213
|
decoding: "async",
|
|
1214
|
-
loading: E(
|
|
1215
|
-
onLoad: i[6] ||= (...e) => E(
|
|
1214
|
+
loading: E(ye),
|
|
1215
|
+
onLoad: i[6] ||= (...e) => E(U) && E(U)(...e),
|
|
1216
1216
|
onError: i[7] ||= (...e) => E(V) && E(V)(...e)
|
|
1217
|
-
}, null, 42,
|
|
1217
|
+
}, null, 42, dt))], 8, ct))]),
|
|
1218
1218
|
_: 1
|
|
1219
1219
|
}, 8, ["css", "name"]),
|
|
1220
1220
|
(b(), a(t, {
|
|
1221
|
-
disabled: !
|
|
1221
|
+
disabled: !Se.value || !e.reelControlsTarget,
|
|
1222
1222
|
to: e.reelControlsTarget ?? "body"
|
|
1223
1223
|
}, [u(n, {
|
|
1224
1224
|
name: "vibe-reel-media-controls",
|
|
1225
|
-
css:
|
|
1225
|
+
css: Se.value
|
|
1226
1226
|
}, {
|
|
1227
|
-
default: k(() => [
|
|
1228
|
-
key:
|
|
1229
|
-
"current-time":
|
|
1230
|
-
"data-control-post-id":
|
|
1231
|
-
duration:
|
|
1227
|
+
default: k(() => [Ce.value ? (b(), a(Je, {
|
|
1228
|
+
key: we.value,
|
|
1229
|
+
"current-time": ne.value,
|
|
1230
|
+
"data-control-post-id": Se.value ? e.item.postId : void 0,
|
|
1231
|
+
duration: re.value,
|
|
1232
1232
|
layout: e.layout,
|
|
1233
|
-
muted: E(
|
|
1234
|
-
playing:
|
|
1235
|
-
volume: E(
|
|
1236
|
-
onSeek:
|
|
1237
|
-
onToggleMute: E(
|
|
1238
|
-
onTogglePlayback:
|
|
1239
|
-
onVolumeChange: E(
|
|
1233
|
+
muted: E(J),
|
|
1234
|
+
playing: q.value,
|
|
1235
|
+
volume: E(ce),
|
|
1236
|
+
onSeek: Ne,
|
|
1237
|
+
onToggleMute: E(se),
|
|
1238
|
+
onTogglePlayback: Ee,
|
|
1239
|
+
onVolumeChange: E(ae)
|
|
1240
1240
|
}, null, 8, [
|
|
1241
1241
|
"current-time",
|
|
1242
1242
|
"data-control-post-id",
|
|
@@ -1258,25 +1258,25 @@ var rt = [
|
|
|
1258
1258
|
type: "button",
|
|
1259
1259
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1260
1260
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1261
|
-
onClick: i[8] ||= j((e) =>
|
|
1261
|
+
onClick: i[8] ||= j((e) => X(T.value - 1, e), ["stop"]),
|
|
1262
1262
|
onKeydown: i[9] ||= j(() => {}, ["stop"])
|
|
1263
|
-
}, [u(E(
|
|
1263
|
+
}, [u(E(De), { size: 20 })], 40, ft), c("button", {
|
|
1264
1264
|
type: "button",
|
|
1265
1265
|
class: "media-carousel-control media-carousel-control--next",
|
|
1266
1266
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1267
|
-
onClick: i[10] ||= j((e) =>
|
|
1267
|
+
onClick: i[10] ||= j((e) => X(T.value + 1, e), ["stop"]),
|
|
1268
1268
|
onKeydown: i[11] ||= j(() => {}, ["stop"])
|
|
1269
|
-
}, [u(E(
|
|
1270
|
-
|
|
1269
|
+
}, [u(E(Oe), { size: 20 })], 40, pt)], 2)) : o("", !0),
|
|
1270
|
+
Y.value ? (b(), s("button", {
|
|
1271
1271
|
key: 1,
|
|
1272
1272
|
class: "media-card-activator",
|
|
1273
1273
|
type: "button",
|
|
1274
1274
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1275
|
-
onClick: i[12] ||= j((e) => r.$emit("activate",
|
|
1275
|
+
onClick: i[12] ||= j((e) => r.$emit("activate", fe(e)), ["stop"]),
|
|
1276
1276
|
onKeydown: i[13] ||= j(() => {}, ["stop"])
|
|
1277
|
-
}, null, 40,
|
|
1278
|
-
], 42,
|
|
1279
|
-
e.cardFooter ? (b(), a(
|
|
1277
|
+
}, null, 40, mt)) : o("", !0)
|
|
1278
|
+
], 42, st),
|
|
1279
|
+
e.cardFooter ? (b(), a(Ie, {
|
|
1280
1280
|
key: 1,
|
|
1281
1281
|
index: e.index,
|
|
1282
1282
|
item: e.item,
|
|
@@ -1299,12 +1299,12 @@ var rt = [
|
|
|
1299
1299
|
"style",
|
|
1300
1300
|
"total"
|
|
1301
1301
|
])) : o("", !0)
|
|
1302
|
-
])], 46,
|
|
1302
|
+
])], 46, at));
|
|
1303
1303
|
}
|
|
1304
|
-
}),
|
|
1304
|
+
}), yt = { class: "masonry-feed-shell" }, bt = ["aria-hidden", "inert"], xt = {
|
|
1305
1305
|
key: 0,
|
|
1306
1306
|
class: "masonry-feed-status-overlay"
|
|
1307
|
-
},
|
|
1307
|
+
}, St = 6, Ct = 12, wt = 250, Tt = /* @__PURE__ */ d({
|
|
1308
1308
|
__name: "MasonryFeed",
|
|
1309
1309
|
props: {
|
|
1310
1310
|
enteringPostIds: {},
|
|
@@ -1341,19 +1341,19 @@ var rt = [
|
|
|
1341
1341
|
"visible"
|
|
1342
1342
|
],
|
|
1343
1343
|
setup(t, { expose: n, emit: i }) {
|
|
1344
|
-
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(
|
|
1344
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(St), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, R = r(() => oe(d.items, y.value, {
|
|
1345
1345
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1346
1346
|
gap: x.value,
|
|
1347
|
-
minColumnWidth:
|
|
1347
|
+
minColumnWidth: le(d.masonry)
|
|
1348
1348
|
})), z = r(() => {
|
|
1349
1349
|
if (d.leavingPostIds.size === 0) return null;
|
|
1350
1350
|
let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
|
|
1351
1351
|
index: t,
|
|
1352
1352
|
item: e
|
|
1353
|
-
}]), t =
|
|
1353
|
+
}]), t = oe(e.map(({ item: e }) => e), y.value, {
|
|
1354
1354
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1355
1355
|
gap: x.value,
|
|
1356
|
-
minColumnWidth:
|
|
1356
|
+
minColumnWidth: le(d.masonry)
|
|
1357
1357
|
});
|
|
1358
1358
|
return {
|
|
1359
1359
|
indices: e.map(({ index: e }) => e),
|
|
@@ -1366,50 +1366,50 @@ var rt = [
|
|
|
1366
1366
|
...t.layout,
|
|
1367
1367
|
items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
|
|
1368
1368
|
} : e;
|
|
1369
|
-
}), V = r(() =>
|
|
1369
|
+
}), V = r(() => se(R.value.items)), H = r(() => {
|
|
1370
1370
|
let e = z.value;
|
|
1371
|
-
return e ?
|
|
1372
|
-
}),
|
|
1371
|
+
return e ? se(e.layout.items, e.indices) : null;
|
|
1372
|
+
}), 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) => {
|
|
1373
1373
|
let t = d.items[e];
|
|
1374
1374
|
return t ? [{
|
|
1375
|
-
fetchPriority:
|
|
1375
|
+
fetchPriority: G.value.has(e) ? "high" : "low",
|
|
1376
1376
|
index: e,
|
|
1377
1377
|
item: t
|
|
1378
1378
|
}] : [];
|
|
1379
1379
|
}));
|
|
1380
|
-
function
|
|
1380
|
+
function ne(e, t) {
|
|
1381
1381
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1382
1382
|
}
|
|
1383
|
-
function
|
|
1383
|
+
function q(e, t) {
|
|
1384
1384
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1385
1385
|
}
|
|
1386
|
-
function
|
|
1386
|
+
function ie(e) {
|
|
1387
1387
|
let t = {
|
|
1388
1388
|
scrollTop: M - k.value,
|
|
1389
1389
|
viewportHeight: C.value
|
|
1390
|
-
}, n =
|
|
1390
|
+
}, n = H.value, r = ce(n ?? V.value, {
|
|
1391
1391
|
...t,
|
|
1392
1392
|
overscan: e
|
|
1393
1393
|
}).indices;
|
|
1394
|
-
return
|
|
1394
|
+
return ne(r, d.leavingPostIds.size === 0 ? [] : ce(V.value, {
|
|
1395
1395
|
...t,
|
|
1396
1396
|
overscan: e
|
|
1397
1397
|
}).indices);
|
|
1398
1398
|
}
|
|
1399
|
-
function
|
|
1400
|
-
let e =
|
|
1401
|
-
|
|
1399
|
+
function J() {
|
|
1400
|
+
let e = ie(0), t = ie(ue(d.masonry, C.value));
|
|
1401
|
+
q(A.value, e) || (A.value = e), q(j.value, t) || (j.value = t);
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1403
|
+
function de() {
|
|
1404
1404
|
if (I !== null) return;
|
|
1405
1405
|
I = -1;
|
|
1406
1406
|
let e = requestAnimationFrame(() => {
|
|
1407
|
-
I = null,
|
|
1407
|
+
I = null, J();
|
|
1408
1408
|
});
|
|
1409
1409
|
I !== null && (I = e);
|
|
1410
1410
|
}
|
|
1411
|
-
let
|
|
1412
|
-
O(() => [...
|
|
1411
|
+
let Y = /* @__PURE__ */ new Set();
|
|
1412
|
+
O(() => [...G.value].flatMap((e) => {
|
|
1413
1413
|
let t = d.items[e];
|
|
1414
1414
|
if (!t) return [];
|
|
1415
1415
|
let n = d.mediaIndices.get(t.postId) ?? 0, r = L(t.postId, n);
|
|
@@ -1421,16 +1421,16 @@ var rt = [
|
|
|
1421
1421
|
}), (e) => {
|
|
1422
1422
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1423
1423
|
e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
|
|
1424
|
-
|
|
1425
|
-
}),
|
|
1424
|
+
Y.has(e) || f("visible", n, t);
|
|
1425
|
+
}), Y = t;
|
|
1426
1426
|
}, {
|
|
1427
1427
|
immediate: !0,
|
|
1428
1428
|
flush: "post"
|
|
1429
1429
|
});
|
|
1430
|
-
function
|
|
1430
|
+
function fe(e) {
|
|
1431
1431
|
let t = B.value.items[e], n = d.items[e]?.postId;
|
|
1432
1432
|
if (!t) return {};
|
|
1433
|
-
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ?
|
|
1433
|
+
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? ae({
|
|
1434
1434
|
containerHeight: Math.max(T.value, R.value.height),
|
|
1435
1435
|
gap: x.value
|
|
1436
1436
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -1441,52 +1441,52 @@ var rt = [
|
|
|
1441
1441
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1442
1442
|
};
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function X() {
|
|
1445
1445
|
let e = p.value;
|
|
1446
1446
|
if (!e) return;
|
|
1447
1447
|
M = e.scrollTop, C.value = e.clientHeight;
|
|
1448
1448
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
1449
1449
|
T.value = Math.max(0, e.clientHeight - n);
|
|
1450
1450
|
let r = g.value;
|
|
1451
|
-
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop,
|
|
1451
|
+
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, J());
|
|
1452
1452
|
}
|
|
1453
|
-
function
|
|
1453
|
+
function pe(e) {
|
|
1454
1454
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1455
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
1455
|
+
y.value = e.clientWidth, x.value = Math.min(Ct, Math.max(St, t * .0075)), X();
|
|
1456
1456
|
}
|
|
1457
|
-
function
|
|
1457
|
+
function me(e) {
|
|
1458
1458
|
let t = e.currentTarget;
|
|
1459
|
-
t && (M = t.scrollTop,
|
|
1459
|
+
t && (M = t.scrollTop, de(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && re(t) && f("loadMore"));
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1461
|
+
function he() {
|
|
1462
1462
|
let e = p.value;
|
|
1463
|
-
Date.now() >= l && !d.loadMoreLocked && e &&
|
|
1463
|
+
Date.now() >= l && !d.loadMoreLocked && e && re(e) && f("loadMore");
|
|
1464
1464
|
}
|
|
1465
1465
|
O(() => d.items.length, (e, t) => {
|
|
1466
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1466
|
+
e > 0 && e < t && (l = Date.now() + wt);
|
|
1467
1467
|
});
|
|
1468
|
-
function
|
|
1468
|
+
function ge() {
|
|
1469
1469
|
return p.value;
|
|
1470
1470
|
}
|
|
1471
1471
|
return O(g, (e) => {
|
|
1472
|
-
N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (
|
|
1472
|
+
N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (pe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
|
|
1473
1473
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1474
1474
|
Math.abs(n - y.value) < .5 || (F = requestAnimationFrame(() => {
|
|
1475
|
-
F = null,
|
|
1475
|
+
F = null, pe(e);
|
|
1476
1476
|
}));
|
|
1477
1477
|
}), N.observe(e)));
|
|
1478
1478
|
}), O(p, (e) => {
|
|
1479
|
-
P?.disconnect(), P = null, e && (
|
|
1479
|
+
P?.disconnect(), P = null, e && (X(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(X), P.observe(e)));
|
|
1480
1480
|
}), O([
|
|
1481
1481
|
R,
|
|
1482
1482
|
B,
|
|
1483
1483
|
() => d.masonry
|
|
1484
|
-
],
|
|
1484
|
+
], J, { flush: "post" }), v(() => {
|
|
1485
1485
|
N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
|
|
1486
1486
|
}), n({
|
|
1487
|
-
getScrollElement:
|
|
1488
|
-
loadIfNearBottom:
|
|
1489
|
-
}), (n, r) => (b(), s("div",
|
|
1487
|
+
getScrollElement: ge,
|
|
1488
|
+
loadIfNearBottom: he
|
|
1489
|
+
}), (n, r) => (b(), s("div", yt, [
|
|
1490
1490
|
c("main", {
|
|
1491
1491
|
id: m,
|
|
1492
1492
|
ref_key: "galleryElement",
|
|
@@ -1495,14 +1495,14 @@ var rt = [
|
|
|
1495
1495
|
"data-layout-mode": "masonry",
|
|
1496
1496
|
"aria-hidden": t.suspended || void 0,
|
|
1497
1497
|
inert: t.suspended || void 0,
|
|
1498
|
-
onScrollPassive:
|
|
1498
|
+
onScrollPassive: me
|
|
1499
1499
|
}, [c("section", {
|
|
1500
1500
|
ref_key: "masonryElement",
|
|
1501
1501
|
ref: g,
|
|
1502
1502
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
1503
|
-
style: _(
|
|
1503
|
+
style: _(W.value),
|
|
1504
1504
|
"aria-label": "Media gallery"
|
|
1505
|
-
}, [(b(!0), s(e, null, S(
|
|
1505
|
+
}, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(vt, {
|
|
1506
1506
|
key: n.postId,
|
|
1507
1507
|
class: "masonry-item",
|
|
1508
1508
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1513,7 +1513,7 @@ var rt = [
|
|
|
1513
1513
|
"media-card": t.mediaCard,
|
|
1514
1514
|
index: r,
|
|
1515
1515
|
item: n,
|
|
1516
|
-
"item-style":
|
|
1516
|
+
"item-style": fe(r),
|
|
1517
1517
|
interactive: "",
|
|
1518
1518
|
layout: "masonry",
|
|
1519
1519
|
"loaded-count": t.items.length,
|
|
@@ -1542,8 +1542,8 @@ var rt = [
|
|
|
1542
1542
|
"onMediaChange",
|
|
1543
1543
|
"onReady",
|
|
1544
1544
|
"onError"
|
|
1545
|
-
]))), 128))], 6)], 42,
|
|
1546
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext &&
|
|
1545
|
+
]))), 128))], 6)], 42, bt),
|
|
1546
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && ee.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", xt, [u(te, {
|
|
1547
1547
|
actions: t.feedFooterActions,
|
|
1548
1548
|
"can-retry-end": t.canRetryEnd,
|
|
1549
1549
|
"feed-footer": t.feedFooter,
|
|
@@ -1551,7 +1551,7 @@ var rt = [
|
|
|
1551
1551
|
"has-next": t.hasNext,
|
|
1552
1552
|
"is-loading": t.isLoadingMore,
|
|
1553
1553
|
"load-more-locked": t.loadMoreLocked,
|
|
1554
|
-
"show-load-more":
|
|
1554
|
+
"show-load-more": ee.value,
|
|
1555
1555
|
state: t.state,
|
|
1556
1556
|
onLoadMore: r[0] ||= (e) => f("loadMore"),
|
|
1557
1557
|
onRetryEnd: r[1] ||= (e) => f("retryEnd")
|
|
@@ -1566,7 +1566,7 @@ var rt = [
|
|
|
1566
1566
|
"show-load-more",
|
|
1567
1567
|
"state"
|
|
1568
1568
|
])])) : o("", !0),
|
|
1569
|
-
u(
|
|
1569
|
+
u(_e, {
|
|
1570
1570
|
"content-size": B.value.height,
|
|
1571
1571
|
"controls-id": m,
|
|
1572
1572
|
"scroll-element": p.value,
|
|
@@ -1578,8 +1578,8 @@ var rt = [
|
|
|
1578
1578
|
])
|
|
1579
1579
|
]));
|
|
1580
1580
|
}
|
|
1581
|
-
}),
|
|
1582
|
-
function
|
|
1581
|
+
}), Et = 300;
|
|
1582
|
+
function Dt(e, t, n) {
|
|
1583
1583
|
let r = e.scrollTop;
|
|
1584
1584
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1585
1585
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1587,7 +1587,7 @@ function Tt(e, t, n) {
|
|
|
1587
1587
|
return new Promise((n) => {
|
|
1588
1588
|
let o = (s) => {
|
|
1589
1589
|
a += 1;
|
|
1590
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1590
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / Et), u = 1 - (1 - l) ** 3;
|
|
1591
1591
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1592
1592
|
requestAnimationFrame(o);
|
|
1593
1593
|
return;
|
|
@@ -1599,7 +1599,7 @@ function Tt(e, t, n) {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
//#endregion
|
|
1601
1601
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1602
|
-
var
|
|
1602
|
+
var Ot = ["aria-label"], kt = /* @__PURE__ */ d({
|
|
1603
1603
|
__name: "ReelAutoAdvanceProgress",
|
|
1604
1604
|
props: {
|
|
1605
1605
|
durationMs: {},
|
|
@@ -1617,9 +1617,9 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1617
1617
|
class: "reel-auto-advance-progress",
|
|
1618
1618
|
style: _(a.value),
|
|
1619
1619
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1620
|
-
}, null, 36)], 8,
|
|
1620
|
+
}, null, 36)], 8, Ot));
|
|
1621
1621
|
}
|
|
1622
|
-
}),
|
|
1622
|
+
}), At = { class: "reel-viewport" }, jt = ["data-active-post-id", "data-active-media-index"], Mt = ["role", "data-status"], Nt = 300, Pt = 250, Ft = /* @__PURE__ */ d({
|
|
1623
1623
|
__name: "ReelFeed",
|
|
1624
1624
|
props: {
|
|
1625
1625
|
initialPostId: {},
|
|
@@ -1668,10 +1668,10 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1668
1668
|
}), z = r(() => u.items[x.value]?.postId), B = r(() => u.items[x.value]), V = r(() => {
|
|
1669
1669
|
let e = z.value;
|
|
1670
1670
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
1671
|
-
}),
|
|
1671
|
+
}), H = r(() => {
|
|
1672
1672
|
let e = z.value;
|
|
1673
1673
|
return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
|
|
1674
|
-
}),
|
|
1674
|
+
}), U = r(() => B.value ? I(B.value, V.value) : null), W = r(() => U.value ? N(U.value, u.mediaSource ?? "preview") : null), ee = r(() => H.value === "ready" && !!(W.value && nt(W.value.type, W.value.src))), G = r(() => [
|
|
1675
1675
|
z.value,
|
|
1676
1676
|
V.value,
|
|
1677
1677
|
u.items.length,
|
|
@@ -1679,52 +1679,52 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1679
1679
|
u.reelAutoAdvance.enabled,
|
|
1680
1680
|
u.reelAutoAdvance.includePostItems,
|
|
1681
1681
|
u.reelAutoAdvance.intervalMs
|
|
1682
|
-
].join(":")),
|
|
1682
|
+
].join(":")), K = r(() => {
|
|
1683
1683
|
let e = B.value, t = !!(e && u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
1684
1684
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1685
|
-
}),
|
|
1686
|
-
function
|
|
1685
|
+
}), 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.");
|
|
1686
|
+
function ae(e) {
|
|
1687
1687
|
return { gridRow: `${e + 1}` };
|
|
1688
1688
|
}
|
|
1689
|
-
function
|
|
1689
|
+
function oe(e) {
|
|
1690
1690
|
let t = k || e.clientHeight;
|
|
1691
1691
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1692
1692
|
}
|
|
1693
|
-
function
|
|
1693
|
+
function se(e) {
|
|
1694
1694
|
let t = e.currentTarget;
|
|
1695
1695
|
if (!t) return;
|
|
1696
1696
|
let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
1697
|
-
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value =
|
|
1697
|
+
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");
|
|
1698
1698
|
}
|
|
1699
|
-
function
|
|
1699
|
+
function J() {
|
|
1700
1700
|
let e = f.value;
|
|
1701
|
-
e && (C.value = !1,
|
|
1701
|
+
e && (C.value = !1, ue(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
1702
1702
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
1703
|
-
}),
|
|
1703
|
+
}), ce());
|
|
1704
1704
|
}
|
|
1705
|
-
function
|
|
1705
|
+
function ce() {
|
|
1706
1706
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
1707
1707
|
M = null;
|
|
1708
1708
|
let e = f.value;
|
|
1709
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1709
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), ue(!1);
|
|
1710
1710
|
}, 120);
|
|
1711
1711
|
}
|
|
1712
|
-
function
|
|
1713
|
-
|
|
1712
|
+
function le() {
|
|
1713
|
+
ue(!0);
|
|
1714
1714
|
let e = f.value;
|
|
1715
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1715
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), ce();
|
|
1716
1716
|
}
|
|
1717
|
-
function
|
|
1717
|
+
function ue(e) {
|
|
1718
1718
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
1719
1719
|
}
|
|
1720
|
-
function
|
|
1720
|
+
function de() {
|
|
1721
1721
|
let e = f.value;
|
|
1722
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
1722
|
+
Date.now() >= l && !u.loadMoreLocked && e && re(e) && d("loadMore");
|
|
1723
1723
|
}
|
|
1724
1724
|
O(() => u.items.length, (e, t) => {
|
|
1725
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1725
|
+
e > 0 && e < t && (l = Date.now() + Pt);
|
|
1726
1726
|
});
|
|
1727
|
-
function
|
|
1727
|
+
function Y(e) {
|
|
1728
1728
|
let t = B.value;
|
|
1729
1729
|
if (!t) return !1;
|
|
1730
1730
|
let n = P(t).length;
|
|
@@ -1732,34 +1732,34 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1732
1732
|
let r = (V.value + e + n) % n;
|
|
1733
1733
|
return d("mediaChange", t.postId, r), !0;
|
|
1734
1734
|
}
|
|
1735
|
-
function
|
|
1735
|
+
function fe(e) {
|
|
1736
1736
|
let t = x.value + e;
|
|
1737
|
-
return !f.value || t < 0 || t >= u.items.length ? !1 : (
|
|
1737
|
+
return !f.value || t < 0 || t >= u.items.length ? !1 : (he(t), !0);
|
|
1738
1738
|
}
|
|
1739
|
-
function
|
|
1739
|
+
function X(e, t) {
|
|
1740
1740
|
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
1741
|
-
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value &&
|
|
1741
|
+
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);
|
|
1742
1742
|
}
|
|
1743
|
-
function
|
|
1743
|
+
function pe() {
|
|
1744
1744
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1745
1745
|
}
|
|
1746
|
-
function
|
|
1746
|
+
function me(e) {
|
|
1747
1747
|
let t = f.value;
|
|
1748
1748
|
if (!t) return Promise.resolve();
|
|
1749
1749
|
let n = e * (k || t.clientHeight);
|
|
1750
|
-
return x.value = e,
|
|
1750
|
+
return x.value = e, Dt(t, n, pe());
|
|
1751
1751
|
}
|
|
1752
|
-
function
|
|
1753
|
-
|
|
1752
|
+
function he(e) {
|
|
1753
|
+
me(e);
|
|
1754
1754
|
}
|
|
1755
|
-
async function
|
|
1755
|
+
async function ge(e) {
|
|
1756
1756
|
let t = u.items.findIndex((t) => t.postId === e);
|
|
1757
|
-
return t < 0 || t === x.value ? !1 : (await
|
|
1757
|
+
return t < 0 || t === x.value ? !1 : (await me(t), !0);
|
|
1758
1758
|
}
|
|
1759
|
-
async function
|
|
1760
|
-
return
|
|
1759
|
+
async function _e(e) {
|
|
1760
|
+
return Y(e) ? (pe() || await new Promise((e) => setTimeout(e, Nt)), !0) : !1;
|
|
1761
1761
|
}
|
|
1762
|
-
function
|
|
1762
|
+
function ve() {
|
|
1763
1763
|
if (!u.reelAutoAdvance.enabled) return;
|
|
1764
1764
|
let e = B.value;
|
|
1765
1765
|
if (!e) return;
|
|
@@ -1772,31 +1772,31 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1772
1772
|
u.hasNext && !u.loadMoreLocked && d("loadMore");
|
|
1773
1773
|
return;
|
|
1774
1774
|
}
|
|
1775
|
-
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0),
|
|
1775
|
+
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), he(t);
|
|
1776
1776
|
}
|
|
1777
|
-
function
|
|
1778
|
-
!u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !
|
|
1777
|
+
function ye(e, t) {
|
|
1778
|
+
!u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !ee.value || ve();
|
|
1779
1779
|
}
|
|
1780
1780
|
return O(f, (e) => {
|
|
1781
|
-
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(
|
|
1781
|
+
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(J), A.observe(e)));
|
|
1782
1782
|
}), O(() => u.items.length, async (e) => {
|
|
1783
1783
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
1784
|
-
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(),
|
|
1784
|
+
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), J();
|
|
1785
1785
|
}), O(z, (e) => {
|
|
1786
1786
|
e !== void 0 && d("activeChange", e);
|
|
1787
1787
|
}, { immediate: !0 }), y(() => {
|
|
1788
|
-
window.addEventListener("resize",
|
|
1788
|
+
window.addEventListener("resize", le), window.addEventListener("orientationchange", le), g >= 0 && m(J);
|
|
1789
1789
|
}), v(() => {
|
|
1790
|
-
window.removeEventListener("resize",
|
|
1790
|
+
window.removeEventListener("resize", le), window.removeEventListener("orientationchange", le), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
1791
1791
|
}), n({
|
|
1792
1792
|
activeIndex: x,
|
|
1793
1793
|
activePostId: z,
|
|
1794
|
-
changeActiveMedia:
|
|
1795
|
-
loadIfNearBottom:
|
|
1796
|
-
moveActivePost:
|
|
1797
|
-
navigateToItem:
|
|
1798
|
-
transitionActiveMedia:
|
|
1799
|
-
transitionActivePost:
|
|
1794
|
+
changeActiveMedia: Y,
|
|
1795
|
+
loadIfNearBottom: de,
|
|
1796
|
+
moveActivePost: fe,
|
|
1797
|
+
navigateToItem: X,
|
|
1798
|
+
transitionActiveMedia: _e,
|
|
1799
|
+
transitionActivePost: ge
|
|
1800
1800
|
}), (n, r) => (b(), s("main", {
|
|
1801
1801
|
class: h(["reel-shell", {
|
|
1802
1802
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1804,7 +1804,7 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1804
1804
|
}]),
|
|
1805
1805
|
"data-layout-mode": "reel"
|
|
1806
1806
|
}, [
|
|
1807
|
-
t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1807
|
+
t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(Ie, {
|
|
1808
1808
|
key: 0,
|
|
1809
1809
|
index: x.value,
|
|
1810
1810
|
item: B.value,
|
|
@@ -1826,19 +1826,19 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1826
1826
|
"style",
|
|
1827
1827
|
"total"
|
|
1828
1828
|
])) : o("", !0),
|
|
1829
|
-
c("div",
|
|
1829
|
+
c("div", At, [c("div", {
|
|
1830
1830
|
ref_key: "galleryElement",
|
|
1831
1831
|
ref: f,
|
|
1832
1832
|
class: "gallery-shell reel-feed",
|
|
1833
1833
|
"data-active-post-id": z.value,
|
|
1834
1834
|
"data-active-media-index": V.value,
|
|
1835
|
-
onScrollPassive:
|
|
1835
|
+
onScrollPassive: se
|
|
1836
1836
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1837
1837
|
key: 1,
|
|
1838
1838
|
class: "reel-track",
|
|
1839
1839
|
style: _(F.value),
|
|
1840
1840
|
"aria-label": "Media gallery"
|
|
1841
|
-
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(
|
|
1841
|
+
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(vt, {
|
|
1842
1842
|
key: n.postId,
|
|
1843
1843
|
active: i === x.value && !C.value,
|
|
1844
1844
|
"advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
|
|
@@ -1847,7 +1847,7 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1847
1847
|
"fetch-priority": e,
|
|
1848
1848
|
index: i,
|
|
1849
1849
|
item: n,
|
|
1850
|
-
"item-style":
|
|
1850
|
+
"item-style": ae(i),
|
|
1851
1851
|
"media-card": t.mediaCard,
|
|
1852
1852
|
layout: "reel",
|
|
1853
1853
|
"loaded-count": t.items.length,
|
|
@@ -1859,7 +1859,7 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1859
1859
|
"stationary-reel-controls": "",
|
|
1860
1860
|
total: t.total,
|
|
1861
1861
|
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
1862
|
-
onEnded: (e) =>
|
|
1862
|
+
onEnded: (e) => ye(n.postId, e),
|
|
1863
1863
|
onReady: (e) => d("ready", n.postId, e),
|
|
1864
1864
|
onReelAudioChange: r[1] ||= (e) => d("reelAudioChange", e),
|
|
1865
1865
|
onError: (e) => d("error", n.postId, e)
|
|
@@ -1887,12 +1887,12 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1887
1887
|
class: "reel-forward-status",
|
|
1888
1888
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1889
1889
|
"data-status": t.reelForward.status
|
|
1890
|
-
}, [c("p", null, T(
|
|
1890
|
+
}, [c("p", null, T(ie.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1891
1891
|
key: 0,
|
|
1892
1892
|
class: "reel-forward-retry",
|
|
1893
1893
|
type: "button",
|
|
1894
1894
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
1895
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1895
|
+
}, " Retry ")) : o("", !0)], 8, Mt)), t.reelForward.status === "idle" ? (b(), a(te, {
|
|
1896
1896
|
key: 2,
|
|
1897
1897
|
actions: t.feedFooterActions,
|
|
1898
1898
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1901,7 +1901,7 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1901
1901
|
"has-next": t.hasNext,
|
|
1902
1902
|
"is-loading": t.isLoadingMore,
|
|
1903
1903
|
"load-more-locked": t.loadMoreLocked,
|
|
1904
|
-
"show-load-more":
|
|
1904
|
+
"show-load-more": q.value,
|
|
1905
1905
|
state: t.state,
|
|
1906
1906
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
1907
1907
|
onRetryEnd: r[3] ||= (e) => d("retryEnd")
|
|
@@ -1915,13 +1915,13 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1915
1915
|
"load-more-locked",
|
|
1916
1916
|
"show-load-more",
|
|
1917
1917
|
"state"
|
|
1918
|
-
])) : o("", !0)], 40,
|
|
1918
|
+
])) : o("", !0)], 40, jt), c("div", {
|
|
1919
1919
|
ref_key: "reelControlsElement",
|
|
1920
1920
|
ref: p,
|
|
1921
1921
|
class: "reel-media-controls-host",
|
|
1922
1922
|
"data-test": "reel-media-controls-host"
|
|
1923
1923
|
}, null, 512)]),
|
|
1924
|
-
t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1924
|
+
t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(Ie, {
|
|
1925
1925
|
key: 1,
|
|
1926
1926
|
index: x.value,
|
|
1927
1927
|
item: B.value,
|
|
@@ -1943,24 +1943,24 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
1943
1943
|
"style",
|
|
1944
1944
|
"total"
|
|
1945
1945
|
])) : o("", !0),
|
|
1946
|
-
|
|
1947
|
-
key:
|
|
1946
|
+
ne.value ? (b(), a(kt, {
|
|
1947
|
+
key: G.value,
|
|
1948
1948
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1949
|
-
label:
|
|
1950
|
-
onComplete:
|
|
1949
|
+
label: K.value,
|
|
1950
|
+
onComplete: ve
|
|
1951
1951
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1952
1952
|
], 2));
|
|
1953
1953
|
}
|
|
1954
|
-
}),
|
|
1954
|
+
}), It = ["data-info-sheet-open", "data-info-sheet-mode"], Lt = ["aria-hidden", "inert"], Rt = {
|
|
1955
1955
|
key: 0,
|
|
1956
1956
|
class: "reel-info-sheet-layer",
|
|
1957
1957
|
"data-test": "reel-info-sheet"
|
|
1958
|
-
},
|
|
1958
|
+
}, zt = [
|
|
1959
1959
|
"role",
|
|
1960
1960
|
"aria-modal",
|
|
1961
1961
|
"tabindex",
|
|
1962
1962
|
"data-active-post-id"
|
|
1963
|
-
],
|
|
1963
|
+
], Bt = /* @__PURE__ */ d({
|
|
1964
1964
|
__name: "ReelLayout",
|
|
1965
1965
|
props: {
|
|
1966
1966
|
forwardIndex: { default: null },
|
|
@@ -2052,10 +2052,10 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
2052
2052
|
function V(e, t) {
|
|
2053
2053
|
d("error", e, t);
|
|
2054
2054
|
}
|
|
2055
|
-
function
|
|
2055
|
+
function H(e, t) {
|
|
2056
2056
|
d("mediaChange", e, t);
|
|
2057
2057
|
}
|
|
2058
|
-
function
|
|
2058
|
+
function U(e, t) {
|
|
2059
2059
|
d("ready", e, t);
|
|
2060
2060
|
}
|
|
2061
2061
|
return O(() => ({
|
|
@@ -2087,7 +2087,7 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
2087
2087
|
class: "reel-layout-main",
|
|
2088
2088
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
2089
2089
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
2090
|
-
}, [u(
|
|
2090
|
+
}, [u(Ft, {
|
|
2091
2091
|
ref_key: "reelFeed",
|
|
2092
2092
|
ref: p,
|
|
2093
2093
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2114,8 +2114,8 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
2114
2114
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
2115
2115
|
onError: V,
|
|
2116
2116
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
2117
|
-
onMediaChange:
|
|
2118
|
-
onReady:
|
|
2117
|
+
onMediaChange: H,
|
|
2118
|
+
onReady: U,
|
|
2119
2119
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
2120
2120
|
onRetryForward: r[3] ||= (e) => d("retryForward"),
|
|
2121
2121
|
onReelAudioChange: r[4] ||= (e) => d("reelAudioChange", e)
|
|
@@ -2141,8 +2141,8 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
2141
2141
|
"reel-forward",
|
|
2142
2142
|
"state",
|
|
2143
2143
|
"total"
|
|
2144
|
-
])], 8,
|
|
2145
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2144
|
+
])], 8, Lt), u(n, { name: "vibe-info-sheet" }, {
|
|
2145
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Rt, [c("aside", {
|
|
2146
2146
|
ref_key: "sheetElement",
|
|
2147
2147
|
ref: _,
|
|
2148
2148
|
class: "reel-info-sheet",
|
|
@@ -2151,14 +2151,14 @@ var Et = ["aria-label"], Dt = /* @__PURE__ */ d({
|
|
|
2151
2151
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2152
2152
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2153
2153
|
"data-active-post-id": T.value?.postId
|
|
2154
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2154
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, zt)])) : o("", !0)]),
|
|
2155
2155
|
_: 1
|
|
2156
|
-
})], 10,
|
|
2156
|
+
})], 10, It));
|
|
2157
2157
|
}
|
|
2158
2158
|
});
|
|
2159
2159
|
//#endregion
|
|
2160
2160
|
//#region src/core/mediaLifecycle.ts
|
|
2161
|
-
function
|
|
2161
|
+
function Vt(e, t, n, r, i) {
|
|
2162
2162
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2163
2163
|
if (!o) return null;
|
|
2164
2164
|
let s = F(o, n), c = I(o, s);
|
|
@@ -2174,7 +2174,7 @@ function zt(e, t, n, r, i) {
|
|
|
2174
2174
|
postIndex: a
|
|
2175
2175
|
};
|
|
2176
2176
|
}
|
|
2177
|
-
function
|
|
2177
|
+
function Ht(e, t) {
|
|
2178
2178
|
O(() => {
|
|
2179
2179
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2180
2180
|
return {
|
|
@@ -2184,20 +2184,20 @@ function Bt(e, t) {
|
|
|
2184
2184
|
};
|
|
2185
2185
|
}, (n, r) => {
|
|
2186
2186
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2187
|
-
let i =
|
|
2187
|
+
let i = Vt(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2188
2188
|
i && t(i);
|
|
2189
2189
|
}, { flush: "sync" });
|
|
2190
2190
|
}
|
|
2191
2191
|
//#endregion
|
|
2192
2192
|
//#region src/components/useMediaLifecycle.ts
|
|
2193
|
-
function
|
|
2193
|
+
function Ut(e, t) {
|
|
2194
2194
|
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = () => e.reelMediaSource === "preview" ? n : e.reelMediaSource === "mobile" ? a : i, s = r(() => o().value);
|
|
2195
2195
|
function c(e, t, n, r) {
|
|
2196
2196
|
let i = L(t, n);
|
|
2197
2197
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2198
2198
|
}
|
|
2199
2199
|
function l(t, n, r, i) {
|
|
2200
|
-
return
|
|
2200
|
+
return Vt(e, t, n, r, i);
|
|
2201
2201
|
}
|
|
2202
2202
|
function u(e, n, r, i) {
|
|
2203
2203
|
let a = l(e, n, r, i);
|
|
@@ -2219,7 +2219,7 @@ function Vt(e, t) {
|
|
|
2219
2219
|
let r = l(e, n, "masonry", null);
|
|
2220
2220
|
r && t.visible(r);
|
|
2221
2221
|
}
|
|
2222
|
-
return
|
|
2222
|
+
return Ht(e, t.reelChange), O(() => {
|
|
2223
2223
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2224
2224
|
return {
|
|
2225
2225
|
mediaIndex: n,
|
|
@@ -2244,16 +2244,16 @@ function Vt(e, t) {
|
|
|
2244
2244
|
}
|
|
2245
2245
|
//#endregion
|
|
2246
2246
|
//#region src/core/reelEscapeStack.ts
|
|
2247
|
-
var
|
|
2248
|
-
function
|
|
2249
|
-
return
|
|
2250
|
-
let t =
|
|
2251
|
-
t >= 0 &&
|
|
2247
|
+
var Wt = [];
|
|
2248
|
+
function Gt(e) {
|
|
2249
|
+
return Wt.push(e), () => {
|
|
2250
|
+
let t = Wt.indexOf(e);
|
|
2251
|
+
t >= 0 && Wt.splice(t, 1);
|
|
2252
2252
|
};
|
|
2253
2253
|
}
|
|
2254
|
-
function
|
|
2254
|
+
function Kt(e) {
|
|
2255
2255
|
if (!e.isActive()) return !1;
|
|
2256
|
-
let t =
|
|
2256
|
+
let t = Wt.filter((e) => e.isActive()), n = e.element();
|
|
2257
2257
|
return n !== null && t.some((t) => {
|
|
2258
2258
|
if (t === e) return !1;
|
|
2259
2259
|
let r = t.element();
|
|
@@ -2269,14 +2269,14 @@ function Wt(e) {
|
|
|
2269
2269
|
}
|
|
2270
2270
|
//#endregion
|
|
2271
2271
|
//#region src/components/useReelKeyboard.ts
|
|
2272
|
-
function
|
|
2272
|
+
function qt(e) {
|
|
2273
2273
|
let t = {
|
|
2274
2274
|
element: e.element,
|
|
2275
2275
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2276
2276
|
}, n = null;
|
|
2277
2277
|
function r(n) {
|
|
2278
2278
|
let r = t.isActive();
|
|
2279
|
-
if (n.key === "Escape" && r && !
|
|
2279
|
+
if (n.key === "Escape" && r && !Kt(t)) return;
|
|
2280
2280
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2281
2281
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2282
2282
|
return;
|
|
@@ -2296,14 +2296,14 @@ function Gt(e) {
|
|
|
2296
2296
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2297
2297
|
}
|
|
2298
2298
|
y(() => {
|
|
2299
|
-
n =
|
|
2299
|
+
n = Gt(t), window.addEventListener("keydown", r);
|
|
2300
2300
|
}), v(() => {
|
|
2301
2301
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2302
2302
|
});
|
|
2303
2303
|
}
|
|
2304
2304
|
//#endregion
|
|
2305
2305
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2306
|
-
var
|
|
2306
|
+
var Jt = 35, Yt = 420, Xt = /* @__PURE__ */ d({
|
|
2307
2307
|
__name: "VibeSurface",
|
|
2308
2308
|
props: {
|
|
2309
2309
|
canRetryEnd: { type: Boolean },
|
|
@@ -2331,34 +2331,34 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
|
|
|
2331
2331
|
"retryForward"
|
|
2332
2332
|
],
|
|
2333
2333
|
setup(t, { expose: i, emit: c }) {
|
|
2334
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null),
|
|
2334
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => z(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: I, originalStates: L, previewStates: R, reelStates: B } = Ut(l.state, {
|
|
2335
2335
|
ready: (e) => d("mediaReady", e),
|
|
2336
2336
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2337
2337
|
visible: (e) => d("mediaVisible", e)
|
|
2338
|
-
}),
|
|
2339
|
-
function
|
|
2338
|
+
}), V = new Set(l.state.items.map((e) => e.postId)), H = null, U = null, W = !1;
|
|
2339
|
+
function ee() {
|
|
2340
2340
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2341
2341
|
}
|
|
2342
|
-
function
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2342
|
+
function te() {
|
|
2343
|
+
H !== null && cancelAnimationFrame(H), H = requestAnimationFrame(() => {
|
|
2344
|
+
H = requestAnimationFrame(() => {
|
|
2345
|
+
H = null, y.value = /* @__PURE__ */ new Set();
|
|
2346
2346
|
});
|
|
2347
2347
|
});
|
|
2348
2348
|
}
|
|
2349
|
-
function
|
|
2349
|
+
function G(e, t) {
|
|
2350
2350
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2351
2351
|
if (!n) return;
|
|
2352
2352
|
let r = F(n, t);
|
|
2353
2353
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2354
2354
|
}
|
|
2355
|
-
async function
|
|
2355
|
+
async function K() {
|
|
2356
2356
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2357
2357
|
}
|
|
2358
|
-
function
|
|
2358
|
+
function re(e) {
|
|
2359
2359
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2360
2360
|
}
|
|
2361
|
-
function
|
|
2361
|
+
function q(e) {
|
|
2362
2362
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2363
2363
|
}
|
|
2364
2364
|
function ie(e) {
|
|
@@ -2371,81 +2371,70 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
|
|
|
2371
2371
|
function ae() {
|
|
2372
2372
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2373
2373
|
}
|
|
2374
|
-
function
|
|
2375
|
-
|
|
2374
|
+
function oe(e, t) {
|
|
2375
|
+
U = e, W = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
|
|
2376
2376
|
}
|
|
2377
|
-
function
|
|
2377
|
+
function se(e) {
|
|
2378
2378
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2379
2379
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2380
2380
|
}
|
|
2381
|
-
function
|
|
2382
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
2383
|
-
let n = [...new Set(e)], r = n.filter(
|
|
2381
|
+
function J(e, t) {
|
|
2382
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ee()) return 0;
|
|
2383
|
+
let n = [...new Set(e)], r = n.filter(se);
|
|
2384
2384
|
if (r.length === 0) return 0;
|
|
2385
|
-
let i = new Map(
|
|
2385
|
+
let i = new Map(C.value), a = t?.staggerMs ?? Jt;
|
|
2386
2386
|
return r.forEach((e, t) => {
|
|
2387
2387
|
i.set(e, t * a);
|
|
2388
|
-
}),
|
|
2388
|
+
}), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, Yt + (r.length - 1) * a;
|
|
2389
2389
|
}
|
|
2390
2390
|
function ce(e, t) {
|
|
2391
|
-
let n =
|
|
2391
|
+
let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2392
2392
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2393
2393
|
r.classList.remove("media-card-focus-silent");
|
|
2394
2394
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2395
2395
|
}
|
|
2396
|
-
function le(
|
|
2397
|
-
|
|
2398
|
-
if (t === null || n === null) return {};
|
|
2399
|
-
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2400
|
-
return {
|
|
2401
|
-
"--vibe-reel-origin-top": `${Math.max(0, i.top - r.top)}px`,
|
|
2402
|
-
"--vibe-reel-origin-right": `${Math.max(0, r.right - i.right)}px`,
|
|
2403
|
-
"--vibe-reel-origin-bottom": `${Math.max(0, r.bottom - i.bottom)}px`,
|
|
2404
|
-
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2405
|
-
};
|
|
2406
|
-
}
|
|
2407
|
-
function Z() {
|
|
2408
|
-
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2396
|
+
function le() {
|
|
2397
|
+
l.state.reelOrigin === "masonry" && (U ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
|
|
2409
2398
|
}
|
|
2410
2399
|
function ue() {
|
|
2411
|
-
let e =
|
|
2412
|
-
|
|
2400
|
+
let e = U, t = W;
|
|
2401
|
+
_.value = !1, U = null, W = !1, m(() => {
|
|
2413
2402
|
e !== null && ce(e, t);
|
|
2414
2403
|
});
|
|
2415
2404
|
}
|
|
2416
|
-
return
|
|
2417
|
-
closeMasonryReel:
|
|
2405
|
+
return qt({
|
|
2406
|
+
closeMasonryReel: le,
|
|
2418
2407
|
element: () => g.value,
|
|
2419
|
-
isReelLeaving: () =>
|
|
2408
|
+
isReelLeaving: () => _.value,
|
|
2420
2409
|
reelRenderer: () => p.value,
|
|
2421
2410
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2422
2411
|
state: l.state
|
|
2423
2412
|
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2424
|
-
let t = e.filter((e) => !
|
|
2425
|
-
if (
|
|
2413
|
+
let t = e.filter((e) => !V.has(e)), n = new Set(e);
|
|
2414
|
+
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;
|
|
2426
2415
|
let r = /* @__PURE__ */ new Map();
|
|
2427
2416
|
e.forEach((e) => {
|
|
2428
|
-
let t =
|
|
2417
|
+
let t = x.value.get(e);
|
|
2429
2418
|
t !== void 0 && r.set(e, t);
|
|
2430
2419
|
}), t.forEach((e, t) => {
|
|
2431
|
-
r.set(e, t *
|
|
2432
|
-
}),
|
|
2420
|
+
r.set(e, t * Jt);
|
|
2421
|
+
}), x.value = r, y.value = new Set([...y.value, ...t]), te();
|
|
2433
2422
|
}, { flush: "sync" }), v(() => {
|
|
2434
|
-
|
|
2423
|
+
H !== null && cancelAnimationFrame(H);
|
|
2435
2424
|
}), i({
|
|
2436
|
-
changeActiveReelMedia:
|
|
2425
|
+
changeActiveReelMedia: re,
|
|
2437
2426
|
getAutoScrollElement: ae,
|
|
2438
|
-
loadIfNearBottom:
|
|
2439
|
-
moveActiveReelPost:
|
|
2427
|
+
loadIfNearBottom: K,
|
|
2428
|
+
moveActiveReelPost: q,
|
|
2440
2429
|
navigateToReelItem: ie,
|
|
2441
|
-
startItemRemoval:
|
|
2430
|
+
startItemRemoval: J,
|
|
2442
2431
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2443
2432
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2444
2433
|
}), (r, i) => (b(), s("div", {
|
|
2445
2434
|
ref_key: "surfaceElement",
|
|
2446
2435
|
ref: g,
|
|
2447
2436
|
class: "vibe-surface"
|
|
2448
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2437
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Bt, {
|
|
2449
2438
|
key: 0,
|
|
2450
2439
|
ref_key: "reelRenderer",
|
|
2451
2440
|
ref: p,
|
|
@@ -2470,27 +2459,27 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
|
|
|
2470
2459
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2471
2460
|
"next-page-error": !!t.state.nextPageError,
|
|
2472
2461
|
origin: "reel",
|
|
2473
|
-
"preview-states": E(
|
|
2462
|
+
"preview-states": E(B),
|
|
2474
2463
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2475
2464
|
"reel-audio-state": t.reelAudioState,
|
|
2476
2465
|
"reel-forward": t.state.reelForward,
|
|
2477
|
-
state:
|
|
2466
|
+
state: D.value,
|
|
2478
2467
|
total: t.state.total,
|
|
2479
2468
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
2480
2469
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2481
|
-
onError: E(
|
|
2470
|
+
onError: E(N),
|
|
2482
2471
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2483
|
-
onMediaChange:
|
|
2484
|
-
onReady: E(
|
|
2472
|
+
onMediaChange: G,
|
|
2473
|
+
onReady: E(I),
|
|
2485
2474
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2486
2475
|
onRetryForward: i[4] ||= (e) => d("retryForward"),
|
|
2487
2476
|
onReelAudioChange: i[5] ||= (e) => d("reelAudioChange", e)
|
|
2488
|
-
}, 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(
|
|
2477
|
+
}, 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, {
|
|
2489
2478
|
key: 1,
|
|
2490
2479
|
actions: t.feedFooterActions,
|
|
2491
2480
|
"can-retry-end": t.canRetryEnd,
|
|
2492
2481
|
"feed-footer": t.feedFooter,
|
|
2493
|
-
state:
|
|
2482
|
+
state: D.value,
|
|
2494
2483
|
onLoadMore: i[6] ||= (e) => d("loadMore"),
|
|
2495
2484
|
onRetryEnd: i[7] ||= (e) => d("retryEnd")
|
|
2496
2485
|
}, null, 8, [
|
|
@@ -2498,14 +2487,14 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
|
|
|
2498
2487
|
"can-retry-end",
|
|
2499
2488
|
"feed-footer",
|
|
2500
2489
|
"state"
|
|
2501
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2490
|
+
])) : (b(), s(e, { key: 2 }, [u(Tt, {
|
|
2502
2491
|
ref_key: "masonryRenderer",
|
|
2503
2492
|
ref: f,
|
|
2504
2493
|
"can-retry-end": t.canRetryEnd,
|
|
2505
|
-
"entering-post-ids":
|
|
2506
|
-
"entry-delays":
|
|
2507
|
-
"leaving-post-ids":
|
|
2508
|
-
"removal-delays":
|
|
2494
|
+
"entering-post-ids": y.value,
|
|
2495
|
+
"entry-delays": x.value,
|
|
2496
|
+
"leaving-post-ids": S.value,
|
|
2497
|
+
"removal-delays": C.value,
|
|
2509
2498
|
"card-footer": t.cardFooter,
|
|
2510
2499
|
"card-header": t.cardHeader,
|
|
2511
2500
|
"feed-footer": t.feedFooter,
|
|
@@ -2519,17 +2508,17 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
|
|
|
2519
2508
|
"load-more-locked": t.state.loadMoreLocked,
|
|
2520
2509
|
"media-indices": t.state.mediaIndices,
|
|
2521
2510
|
"next-page-error": !!t.state.nextPageError,
|
|
2522
|
-
"preview-states": E(
|
|
2523
|
-
suspended: t.state.reelOrigin === "masonry" ||
|
|
2524
|
-
state:
|
|
2511
|
+
"preview-states": E(R),
|
|
2512
|
+
suspended: t.state.reelOrigin === "masonry" || _.value,
|
|
2513
|
+
state: D.value,
|
|
2525
2514
|
total: t.state.total,
|
|
2526
|
-
onActivate:
|
|
2527
|
-
onError: E(
|
|
2515
|
+
onActivate: oe,
|
|
2516
|
+
onError: E(j),
|
|
2528
2517
|
onLoadMore: i[8] ||= (e) => d("loadMore"),
|
|
2529
|
-
onMediaChange:
|
|
2530
|
-
onReady: E(
|
|
2518
|
+
onMediaChange: G,
|
|
2519
|
+
onReady: E(M),
|
|
2531
2520
|
onRetryEnd: i[9] ||= (e) => d("retryEnd"),
|
|
2532
|
-
onVisible: E(
|
|
2521
|
+
onVisible: E(A)
|
|
2533
2522
|
}, null, 8, [
|
|
2534
2523
|
"can-retry-end",
|
|
2535
2524
|
"entering-post-ids",
|
|
@@ -2568,9 +2557,8 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
|
|
|
2568
2557
|
role: "dialog",
|
|
2569
2558
|
"aria-label": "Media viewer",
|
|
2570
2559
|
"aria-modal": "true",
|
|
2571
|
-
tabindex: "-1"
|
|
2572
|
-
|
|
2573
|
-
}, [u(Rt, {
|
|
2560
|
+
tabindex: "-1"
|
|
2561
|
+
}, [u(Bt, {
|
|
2574
2562
|
ref_key: "reelRenderer",
|
|
2575
2563
|
ref: p,
|
|
2576
2564
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2594,55 +2582,55 @@ var Kt = 35, qt = 420, Jt = /* @__PURE__ */ d({
|
|
|
2594
2582
|
"media-source": "original",
|
|
2595
2583
|
"next-page-error": !!t.state.nextPageError,
|
|
2596
2584
|
origin: "masonry",
|
|
2597
|
-
"preview-states": E(
|
|
2585
|
+
"preview-states": E(L),
|
|
2598
2586
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2599
2587
|
"reel-audio-state": t.reelAudioState,
|
|
2600
2588
|
"reel-forward": t.state.reelForward,
|
|
2601
|
-
state:
|
|
2589
|
+
state: D.value,
|
|
2602
2590
|
total: t.state.total,
|
|
2603
2591
|
onActiveChange: i[10] ||= (e) => d("activeReelChange", e),
|
|
2604
2592
|
onCloseInfoSheet: i[11] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2605
|
-
onError: E(
|
|
2593
|
+
onError: E(N),
|
|
2606
2594
|
onLoadMore: i[12] ||= (e) => d("loadMore"),
|
|
2607
|
-
onMediaChange:
|
|
2608
|
-
onReady: E(
|
|
2595
|
+
onMediaChange: G,
|
|
2596
|
+
onReady: E(I),
|
|
2609
2597
|
onRetryEnd: i[13] ||= (e) => d("retryEnd"),
|
|
2610
2598
|
onRetryForward: i[14] ||= (e) => d("retryForward"),
|
|
2611
2599
|
onReelAudioChange: i[15] ||= (e) => d("reelAudioChange", e)
|
|
2612
|
-
}, 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("."))],
|
|
2600
|
+
}, 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)]),
|
|
2613
2601
|
_: 1
|
|
2614
2602
|
})], 64))], 512));
|
|
2615
2603
|
}
|
|
2616
2604
|
});
|
|
2617
2605
|
//#endregion
|
|
2618
2606
|
//#region src/core/page.ts
|
|
2619
|
-
function
|
|
2607
|
+
function Zt(e) {
|
|
2620
2608
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2621
2609
|
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.");
|
|
2622
2610
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2623
2611
|
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.");
|
|
2624
2612
|
return e;
|
|
2625
2613
|
}
|
|
2626
|
-
function
|
|
2614
|
+
function Z(e, t) {
|
|
2627
2615
|
let n = new Set(e.map((e) => e.postId));
|
|
2628
2616
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2629
2617
|
}
|
|
2630
|
-
function
|
|
2618
|
+
function Qt(e) {
|
|
2631
2619
|
return `${typeof e}:${String(e)}`;
|
|
2632
2620
|
}
|
|
2633
|
-
function
|
|
2634
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${
|
|
2621
|
+
function $t(e) {
|
|
2622
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${Qt(e.mediaId)}`;
|
|
2635
2623
|
}
|
|
2636
|
-
function
|
|
2637
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
2624
|
+
function en(e, t) {
|
|
2625
|
+
let n = [...e], r = new Map(e.map((e, t) => [Qt(e.postId), t]));
|
|
2638
2626
|
return t.forEach((e) => {
|
|
2639
|
-
let t =
|
|
2627
|
+
let t = Qt(e.postId), i = r.get(t);
|
|
2640
2628
|
if (i === void 0) {
|
|
2641
2629
|
r.set(t, n.length), n.push(e);
|
|
2642
2630
|
return;
|
|
2643
2631
|
}
|
|
2644
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
2645
|
-
let t =
|
|
2632
|
+
let a = n[i], o = new Set([a, ...a.items].map($t)), s = [e, ...e.items].filter((e) => {
|
|
2633
|
+
let t = $t(e);
|
|
2646
2634
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
2647
2635
|
});
|
|
2648
2636
|
s.length > 0 && (n[i] = {
|
|
@@ -2651,14 +2639,14 @@ function Qt(e, t) {
|
|
|
2651
2639
|
});
|
|
2652
2640
|
}), n;
|
|
2653
2641
|
}
|
|
2654
|
-
function
|
|
2642
|
+
function tn(e) {
|
|
2655
2643
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
2656
2644
|
}
|
|
2657
2645
|
//#endregion
|
|
2658
2646
|
//#region src/core/appendPage.ts
|
|
2659
|
-
function
|
|
2660
|
-
let i =
|
|
2661
|
-
t.items =
|
|
2647
|
+
function nn(e, t, n, r) {
|
|
2648
|
+
let i = Zt(e), a = n.filterItems(i.items), o = tn(i);
|
|
2649
|
+
t.items = en(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
2662
2650
|
contributionIds: a.map(({ postId: e }) => e),
|
|
2663
2651
|
cursor: o,
|
|
2664
2652
|
next: i.next,
|
|
@@ -2667,32 +2655,32 @@ function en(e, t, n, r) {
|
|
|
2667
2655
|
}
|
|
2668
2656
|
//#endregion
|
|
2669
2657
|
//#region src/core/requestDelay.ts
|
|
2670
|
-
var
|
|
2658
|
+
var rn = 2e3, an = 1e4, on = 250, sn = {
|
|
2671
2659
|
delayRemainingMs: null,
|
|
2672
2660
|
nextRequestAt: null
|
|
2673
2661
|
};
|
|
2674
|
-
function
|
|
2662
|
+
function cn(e, t) {
|
|
2675
2663
|
return e === void 0 ? t : Math.floor(e);
|
|
2676
2664
|
}
|
|
2677
|
-
function
|
|
2665
|
+
function ln(e, t) {
|
|
2678
2666
|
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.`);
|
|
2679
2667
|
}
|
|
2680
|
-
function
|
|
2681
|
-
let n =
|
|
2668
|
+
function un(e, t = {}) {
|
|
2669
|
+
let n = cn(t.delayStepMs, rn), r = cn(t.delayMaxMs, an);
|
|
2682
2670
|
return Math.min(Math.max(0, e) * n, r);
|
|
2683
2671
|
}
|
|
2684
|
-
function
|
|
2685
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2672
|
+
function Q(e) {
|
|
2673
|
+
if (e == null || !Number.isFinite(e)) return { ...sn };
|
|
2686
2674
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2687
2675
|
return t > 0 ? {
|
|
2688
2676
|
delayRemainingMs: t,
|
|
2689
2677
|
nextRequestAt: e
|
|
2690
|
-
} : { ...
|
|
2678
|
+
} : { ...sn };
|
|
2691
2679
|
}
|
|
2692
|
-
async function
|
|
2680
|
+
async function dn({ delayMs: e, onChange: t, signal: n }) {
|
|
2693
2681
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2694
2682
|
if (e <= 0) {
|
|
2695
|
-
t({ ...
|
|
2683
|
+
t({ ...sn });
|
|
2696
2684
|
return;
|
|
2697
2685
|
}
|
|
2698
2686
|
let r = Date.now() + e;
|
|
@@ -2700,9 +2688,9 @@ async function un({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2700
2688
|
delayRemainingMs: e,
|
|
2701
2689
|
nextRequestAt: r
|
|
2702
2690
|
}), await new Promise((i, a) => {
|
|
2703
|
-
let o = !1, s = setInterval(f,
|
|
2691
|
+
let o = !1, s = setInterval(f, on), c = setTimeout(() => u(), e);
|
|
2704
2692
|
function l() {
|
|
2705
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2693
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...sn });
|
|
2706
2694
|
}
|
|
2707
2695
|
function u(e) {
|
|
2708
2696
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2711,42 +2699,42 @@ async function un({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2711
2699
|
u(new DOMException("Aborted", "AbortError"));
|
|
2712
2700
|
}
|
|
2713
2701
|
function f() {
|
|
2714
|
-
let e =
|
|
2702
|
+
let e = Q(r);
|
|
2715
2703
|
t(e), e.delayRemainingMs === null && u();
|
|
2716
2704
|
}
|
|
2717
2705
|
n.addEventListener("abort", d, { once: !0 });
|
|
2718
2706
|
});
|
|
2719
2707
|
}
|
|
2720
|
-
var
|
|
2708
|
+
var fn = class {
|
|
2721
2709
|
interval = null;
|
|
2722
2710
|
constructor(e) {
|
|
2723
2711
|
this.onChange = e;
|
|
2724
2712
|
}
|
|
2725
2713
|
clear() {
|
|
2726
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2714
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...sn });
|
|
2727
2715
|
}
|
|
2728
2716
|
sync(e) {
|
|
2729
2717
|
this.clear();
|
|
2730
|
-
let t =
|
|
2718
|
+
let t = Q(e);
|
|
2731
2719
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2732
|
-
let t =
|
|
2720
|
+
let t = Q(e);
|
|
2733
2721
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2734
|
-
},
|
|
2722
|
+
}, on));
|
|
2735
2723
|
}
|
|
2736
2724
|
};
|
|
2737
|
-
function
|
|
2725
|
+
function pn(e, t = !0) {
|
|
2738
2726
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2739
2727
|
}
|
|
2740
|
-
function
|
|
2728
|
+
function mn(e) {
|
|
2741
2729
|
return `${typeof e}:${String(e)}`;
|
|
2742
2730
|
}
|
|
2743
|
-
function
|
|
2731
|
+
function hn(e, t) {
|
|
2744
2732
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2745
2733
|
}
|
|
2746
|
-
function
|
|
2734
|
+
function gn(e) {
|
|
2747
2735
|
if (!e) return;
|
|
2748
|
-
if (
|
|
2749
|
-
|
|
2736
|
+
if (hn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2737
|
+
ln(e, "frontend autofill");
|
|
2750
2738
|
let t = e.maxAdditionalPages;
|
|
2751
2739
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2752
2740
|
return;
|
|
@@ -2758,7 +2746,7 @@ function hn(e) {
|
|
|
2758
2746
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2759
2747
|
}
|
|
2760
2748
|
}
|
|
2761
|
-
function
|
|
2749
|
+
function _n(e, t, n = !0) {
|
|
2762
2750
|
if (!e) return {
|
|
2763
2751
|
cycleId: null,
|
|
2764
2752
|
delayRemainingMs: null,
|
|
@@ -2775,7 +2763,7 @@ function gn(e, t, n = !0) {
|
|
|
2775
2763
|
status: "idle",
|
|
2776
2764
|
strategy: null
|
|
2777
2765
|
};
|
|
2778
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
2766
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Q(r?.nextRequestAt);
|
|
2779
2767
|
return {
|
|
2780
2768
|
cycleId: r?.cycleId ?? null,
|
|
2781
2769
|
...a,
|
|
@@ -2792,7 +2780,7 @@ function gn(e, t, n = !0) {
|
|
|
2792
2780
|
strategy: e.strategy
|
|
2793
2781
|
};
|
|
2794
2782
|
}
|
|
2795
|
-
function
|
|
2783
|
+
function vn(e) {
|
|
2796
2784
|
return [
|
|
2797
2785
|
"cancelling",
|
|
2798
2786
|
"filling",
|
|
@@ -2800,9 +2788,9 @@ function _n(e) {
|
|
|
2800
2788
|
"waiting"
|
|
2801
2789
|
].includes(e.status);
|
|
2802
2790
|
}
|
|
2803
|
-
async function
|
|
2791
|
+
async function yn(e, t, n) {
|
|
2804
2792
|
let r = t.autofill;
|
|
2805
|
-
if (!
|
|
2793
|
+
if (!vn(r) || !r.cycleId) return;
|
|
2806
2794
|
let i = {
|
|
2807
2795
|
cycleId: r.cycleId,
|
|
2808
2796
|
feedKey: r.feedKey ?? "",
|
|
@@ -2815,16 +2803,16 @@ async function vn(e, t, n) {
|
|
|
2815
2803
|
throw r.error = e, r.status = "error", e;
|
|
2816
2804
|
}
|
|
2817
2805
|
}
|
|
2818
|
-
function
|
|
2806
|
+
function bn(e, t, n) {
|
|
2819
2807
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2820
2808
|
}
|
|
2821
|
-
async function
|
|
2822
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2809
|
+
async function xn({ 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 }) {
|
|
2810
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? pn(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2823
2811
|
for (; y < h;) {
|
|
2824
|
-
let e =
|
|
2812
|
+
let e = mn(g);
|
|
2825
2813
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2826
|
-
if (m.add(e), await
|
|
2827
|
-
delayMs:
|
|
2814
|
+
if (m.add(e), await dn({
|
|
2815
|
+
delayMs: un(l + y, s),
|
|
2828
2816
|
onChange: a,
|
|
2829
2817
|
signal: d
|
|
2830
2818
|
}), y > 0 && u()) return {
|
|
@@ -2838,12 +2826,12 @@ async function bn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2838
2826
|
status: "paused",
|
|
2839
2827
|
total: x
|
|
2840
2828
|
};
|
|
2841
|
-
let t =
|
|
2829
|
+
let t = Zt(await n({
|
|
2842
2830
|
cursor: g,
|
|
2843
2831
|
signal: d
|
|
2844
2832
|
}));
|
|
2845
2833
|
y += 1, _ = g;
|
|
2846
|
-
let r =
|
|
2834
|
+
let r = Z(p, t.items).slice(p.length);
|
|
2847
2835
|
b.push({
|
|
2848
2836
|
contributionIds: r.map(({ postId: e }) => e),
|
|
2849
2837
|
cursor: g,
|
|
@@ -2895,12 +2883,12 @@ async function bn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2895
2883
|
}
|
|
2896
2884
|
//#endregion
|
|
2897
2885
|
//#region src/core/autofillController.ts
|
|
2898
|
-
var
|
|
2886
|
+
var Sn = class {
|
|
2899
2887
|
collection = null;
|
|
2900
2888
|
cycle = 0;
|
|
2901
2889
|
delayCountdown;
|
|
2902
2890
|
constructor(e) {
|
|
2903
|
-
this.context = e, this.delayCountdown = new
|
|
2891
|
+
this.context = e, this.delayCountdown = new fn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2904
2892
|
}
|
|
2905
2893
|
beginCycle() {
|
|
2906
2894
|
let { options: e, state: t } = this.context;
|
|
@@ -2908,14 +2896,14 @@ var xn = class {
|
|
|
2908
2896
|
this.clear();
|
|
2909
2897
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2910
2898
|
return t.autofill = {
|
|
2911
|
-
...
|
|
2899
|
+
..._n(e, void 0, !1),
|
|
2912
2900
|
cycleId: n,
|
|
2913
2901
|
status: "filling"
|
|
2914
2902
|
}, n;
|
|
2915
2903
|
}
|
|
2916
2904
|
async cancel() {
|
|
2917
2905
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2918
|
-
await
|
|
2906
|
+
await yn(t, n, e), this.commitCollection();
|
|
2919
2907
|
}
|
|
2920
2908
|
captureCollection(e, t) {
|
|
2921
2909
|
t && (this.collection = e);
|
|
@@ -2937,36 +2925,36 @@ var xn = class {
|
|
|
2937
2925
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
2938
2926
|
if (t?.strategy !== "frontend") return !1;
|
|
2939
2927
|
let r = this.collection;
|
|
2940
|
-
return this.collection = null, r ? (n.items =
|
|
2928
|
+
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, {
|
|
2941
2929
|
missing: r.missing,
|
|
2942
2930
|
received: r.received,
|
|
2943
2931
|
requests: r.requests
|
|
2944
2932
|
}), !0) : !1;
|
|
2945
2933
|
}
|
|
2946
|
-
},
|
|
2947
|
-
function
|
|
2934
|
+
}, Cn = 100;
|
|
2935
|
+
function wn(e, t) {
|
|
2948
2936
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2949
2937
|
}
|
|
2950
|
-
function
|
|
2938
|
+
function Tn(e, t, n) {
|
|
2951
2939
|
return Math.min(n, Math.max(t, e));
|
|
2952
2940
|
}
|
|
2953
|
-
function
|
|
2941
|
+
function En(e) {
|
|
2954
2942
|
if (!e) return;
|
|
2955
2943
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2956
|
-
if (
|
|
2957
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2944
|
+
if (wn("autoScroll.minSpeedPxPerSecond", t), wn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2945
|
+
e.speedPxPerSecond !== void 0 && wn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2958
2946
|
}
|
|
2959
|
-
function
|
|
2947
|
+
function Dn(e) {
|
|
2960
2948
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2961
2949
|
return {
|
|
2962
2950
|
enabled: e?.enabled ?? !1,
|
|
2963
2951
|
maxSpeedPxPerSecond: n,
|
|
2964
2952
|
minSpeedPxPerSecond: t,
|
|
2965
2953
|
paused: !1,
|
|
2966
|
-
speedPxPerSecond:
|
|
2954
|
+
speedPxPerSecond: Tn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2967
2955
|
};
|
|
2968
2956
|
}
|
|
2969
|
-
var
|
|
2957
|
+
var On = class {
|
|
2970
2958
|
frame = null;
|
|
2971
2959
|
lastTimestamp = null;
|
|
2972
2960
|
mounted = !1;
|
|
@@ -2986,9 +2974,9 @@ var Dn = class {
|
|
|
2986
2974
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2987
2975
|
}
|
|
2988
2976
|
setSpeed(e) {
|
|
2989
|
-
|
|
2977
|
+
wn("auto-scroll speed", e);
|
|
2990
2978
|
let t = this.options.state;
|
|
2991
|
-
t.speedPxPerSecond =
|
|
2979
|
+
t.speedPxPerSecond = Tn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2992
2980
|
}
|
|
2993
2981
|
tick = (e) => {
|
|
2994
2982
|
this.frame = null;
|
|
@@ -3000,7 +2988,7 @@ var Dn = class {
|
|
|
3000
2988
|
return;
|
|
3001
2989
|
}
|
|
3002
2990
|
if (this.lastTimestamp !== null) {
|
|
3003
|
-
let r = Math.min(
|
|
2991
|
+
let r = Math.min(Cn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3004
2992
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3005
2993
|
}
|
|
3006
2994
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3014,13 +3002,13 @@ var Dn = class {
|
|
|
3014
3002
|
};
|
|
3015
3003
|
//#endregion
|
|
3016
3004
|
//#region src/core/backendAutofill.ts
|
|
3017
|
-
async function
|
|
3005
|
+
async function kn(e, t, n, r) {
|
|
3018
3006
|
let i = await e.onUnderfilled(n);
|
|
3019
3007
|
if (!r()) return;
|
|
3020
3008
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
3021
3009
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
3022
3010
|
Object.assign(t.autofill, {
|
|
3023
|
-
...
|
|
3011
|
+
...Q(i.nextRequestAt),
|
|
3024
3012
|
missing: Math.max(0, e.pageSize - a),
|
|
3025
3013
|
received: a,
|
|
3026
3014
|
sequence: i.sequence ?? 0,
|
|
@@ -3028,19 +3016,19 @@ async function On(e, t, n, r) {
|
|
|
3028
3016
|
status: "waiting"
|
|
3029
3017
|
});
|
|
3030
3018
|
}
|
|
3031
|
-
function
|
|
3032
|
-
["complete", "exhausted"].includes(t.status) && t.items && (e.items =
|
|
3019
|
+
function An(e, t) {
|
|
3020
|
+
["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);
|
|
3033
3021
|
}
|
|
3034
|
-
function
|
|
3022
|
+
function jn(e, t, n) {
|
|
3035
3023
|
let r = t.autofill;
|
|
3036
|
-
return !
|
|
3024
|
+
return !bn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (An(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);
|
|
3037
3025
|
}
|
|
3038
|
-
function
|
|
3039
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3026
|
+
function Mn(e, t, n) {
|
|
3027
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = _n(e, n), An(t, n), !0);
|
|
3040
3028
|
}
|
|
3041
3029
|
//#endregion
|
|
3042
3030
|
//#region src/core/backlogRestore.ts
|
|
3043
|
-
async function
|
|
3031
|
+
async function Nn(e, t, n) {
|
|
3044
3032
|
if (!e) return;
|
|
3045
3033
|
let r = new AbortController();
|
|
3046
3034
|
n(r);
|
|
@@ -3055,7 +3043,7 @@ async function Mn(e, t, n) {
|
|
|
3055
3043
|
}
|
|
3056
3044
|
//#endregion
|
|
3057
3045
|
//#region src/core/initialAutofill.ts
|
|
3058
|
-
async function
|
|
3046
|
+
async function Pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3059
3047
|
let c = a.autofill;
|
|
3060
3048
|
if (!c) return;
|
|
3061
3049
|
let l = s.items.length;
|
|
@@ -3068,7 +3056,7 @@ async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3068
3056
|
return;
|
|
3069
3057
|
}
|
|
3070
3058
|
if (c.strategy === "backend") {
|
|
3071
|
-
await
|
|
3059
|
+
await kn(c, s, {
|
|
3072
3060
|
cycleId: e,
|
|
3073
3061
|
feedKey: c.feedKey,
|
|
3074
3062
|
items: [...s.items],
|
|
@@ -3085,11 +3073,11 @@ async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3085
3073
|
s.autofill.status = "exhausted";
|
|
3086
3074
|
return;
|
|
3087
3075
|
}
|
|
3088
|
-
let u = await
|
|
3076
|
+
let u = await xn({
|
|
3089
3077
|
existingItems: s.items,
|
|
3090
3078
|
initialCursor: s.next,
|
|
3091
3079
|
loadPage: a.loadPage,
|
|
3092
|
-
maximumRequests:
|
|
3080
|
+
maximumRequests: pn(c, !1),
|
|
3093
3081
|
onCollection: n,
|
|
3094
3082
|
onDelayChange: (e) => {
|
|
3095
3083
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3103,7 +3091,7 @@ async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3103
3091
|
shouldPause: () => s.loadMoreLocked,
|
|
3104
3092
|
signal: o
|
|
3105
3093
|
});
|
|
3106
|
-
t() && (s.items =
|
|
3094
|
+
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, {
|
|
3107
3095
|
missing: u.missing,
|
|
3108
3096
|
received: u.received,
|
|
3109
3097
|
requests: u.requests,
|
|
@@ -3112,13 +3100,13 @@ async function Nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3112
3100
|
}
|
|
3113
3101
|
//#endregion
|
|
3114
3102
|
//#region src/core/fill.ts
|
|
3115
|
-
function
|
|
3103
|
+
function Fn(e) {
|
|
3116
3104
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3117
3105
|
}
|
|
3118
|
-
function
|
|
3106
|
+
function In(e) {
|
|
3119
3107
|
return `${typeof e}:${String(e)}`;
|
|
3120
3108
|
}
|
|
3121
|
-
function
|
|
3109
|
+
function Ln(e) {
|
|
3122
3110
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3123
3111
|
if ("pages" in e) {
|
|
3124
3112
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3131,21 +3119,21 @@ function In(e) {
|
|
|
3131
3119
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3132
3120
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3133
3121
|
}
|
|
3134
|
-
function
|
|
3122
|
+
function Rn(e) {
|
|
3135
3123
|
if (!e) return;
|
|
3136
3124
|
if (e.strategy === "frontend") {
|
|
3137
|
-
|
|
3125
|
+
ln(e, "frontend fill");
|
|
3138
3126
|
return;
|
|
3139
3127
|
}
|
|
3140
3128
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3141
3129
|
let t = e.initialSession;
|
|
3142
3130
|
if (t) {
|
|
3143
3131
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3144
|
-
|
|
3132
|
+
Ln(t.target);
|
|
3145
3133
|
}
|
|
3146
3134
|
}
|
|
3147
|
-
function
|
|
3148
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3135
|
+
function zn(e, t, n = !0) {
|
|
3136
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
|
|
3149
3137
|
return {
|
|
3150
3138
|
completedPages: i?.completedPages ?? 0,
|
|
3151
3139
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3158,10 +3146,10 @@ function Rn(e, t, n = !0) {
|
|
|
3158
3146
|
sessionId: i?.sessionId ?? null,
|
|
3159
3147
|
status: i?.status ?? "idle",
|
|
3160
3148
|
strategy: e?.strategy ?? null,
|
|
3161
|
-
target: i ?
|
|
3149
|
+
target: i ? Fn(i.target) : null
|
|
3162
3150
|
};
|
|
3163
3151
|
}
|
|
3164
|
-
function
|
|
3152
|
+
function Bn(e) {
|
|
3165
3153
|
return [
|
|
3166
3154
|
"cancelling",
|
|
3167
3155
|
"filling",
|
|
@@ -3169,7 +3157,7 @@ function zn(e) {
|
|
|
3169
3157
|
"waiting"
|
|
3170
3158
|
].includes(e.status);
|
|
3171
3159
|
}
|
|
3172
|
-
async function
|
|
3160
|
+
async function Vn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3173
3161
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3174
3162
|
if ("items" in l && f.length >= l.items) return {
|
|
3175
3163
|
completedPages: m,
|
|
@@ -3181,10 +3169,10 @@ async function Bn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3181
3169
|
status: "complete"
|
|
3182
3170
|
};
|
|
3183
3171
|
for (; _ !== null;) {
|
|
3184
|
-
let e =
|
|
3172
|
+
let e = In(h);
|
|
3185
3173
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3186
|
-
if (p.add(e), await
|
|
3187
|
-
delayMs:
|
|
3174
|
+
if (p.add(e), await dn({
|
|
3175
|
+
delayMs: un(m, o),
|
|
3188
3176
|
onChange: i,
|
|
3189
3177
|
signal: c
|
|
3190
3178
|
}), m > 0 && s()) return {
|
|
@@ -3197,12 +3185,12 @@ async function Bn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3197
3185
|
status: "paused",
|
|
3198
3186
|
total: y
|
|
3199
3187
|
};
|
|
3200
|
-
let t =
|
|
3188
|
+
let t = Zt(await n({
|
|
3201
3189
|
cursor: h,
|
|
3202
3190
|
signal: c
|
|
3203
3191
|
}));
|
|
3204
3192
|
m += 1, g = h;
|
|
3205
|
-
let b =
|
|
3193
|
+
let b = Z(f, t.items).slice(f.length);
|
|
3206
3194
|
if (d.push({
|
|
3207
3195
|
contributionIds: b.map(({ postId: e }) => e),
|
|
3208
3196
|
cursor: h,
|
|
@@ -3265,12 +3253,12 @@ async function Bn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3265
3253
|
}
|
|
3266
3254
|
//#endregion
|
|
3267
3255
|
//#region src/core/backendFill.ts
|
|
3268
|
-
async function
|
|
3256
|
+
async function Hn(e, t, n, r) {
|
|
3269
3257
|
let i = await e.onStart(n);
|
|
3270
3258
|
if (r()) {
|
|
3271
3259
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3272
3260
|
Object.assign(t.fill, {
|
|
3273
|
-
...
|
|
3261
|
+
...Q(i.nextRequestAt),
|
|
3274
3262
|
completedPages: i.completedPages ?? 0,
|
|
3275
3263
|
received: i.received ?? 0,
|
|
3276
3264
|
sequence: i.sequence ?? 0,
|
|
@@ -3279,23 +3267,23 @@ async function Vn(e, t, n, r) {
|
|
|
3279
3267
|
});
|
|
3280
3268
|
}
|
|
3281
3269
|
}
|
|
3282
|
-
function
|
|
3270
|
+
function Un(e, t, n) {
|
|
3283
3271
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3284
3272
|
}
|
|
3285
|
-
function
|
|
3273
|
+
function Wn(e) {
|
|
3286
3274
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3287
3275
|
}
|
|
3288
|
-
function
|
|
3276
|
+
function Gn(e, t) {
|
|
3289
3277
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3290
3278
|
let n = e.fill.target;
|
|
3291
3279
|
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;
|
|
3292
3280
|
}
|
|
3293
|
-
function
|
|
3294
|
-
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items =
|
|
3281
|
+
function Kn(e, t, n) {
|
|
3282
|
+
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));
|
|
3295
3283
|
}
|
|
3296
|
-
function
|
|
3297
|
-
return !
|
|
3298
|
-
...
|
|
3284
|
+
function qn(e, t, n, r) {
|
|
3285
|
+
return !Un(e, t, n) || !Wn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Gn(t, n) ? !1 : (Kn(t, n, r), Object.assign(t.fill, {
|
|
3286
|
+
...Q(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3299
3287
|
completedPages: n.completedPages,
|
|
3300
3288
|
error: n.error ?? null,
|
|
3301
3289
|
received: n.received,
|
|
@@ -3303,45 +3291,45 @@ function Kn(e, t, n, r) {
|
|
|
3303
3291
|
status: n.status
|
|
3304
3292
|
}), !0);
|
|
3305
3293
|
}
|
|
3306
|
-
function
|
|
3294
|
+
function Jn(e, t, n, r) {
|
|
3307
3295
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3308
3296
|
let i = t.fill;
|
|
3309
|
-
return t.fill =
|
|
3297
|
+
return t.fill = zn(e, n), !Wn(n) || !Gn(t, n) ? (t.fill = i, !1) : (Kn(t, n, r), !0);
|
|
3310
3298
|
}
|
|
3311
3299
|
//#endregion
|
|
3312
3300
|
//#region src/core/fillController.ts
|
|
3313
|
-
var
|
|
3301
|
+
var Yn = class {
|
|
3314
3302
|
abortController = null;
|
|
3315
3303
|
cycle = 0;
|
|
3316
3304
|
delayCountdown;
|
|
3317
3305
|
requestVersion = 0;
|
|
3318
3306
|
collection = null;
|
|
3319
3307
|
constructor(e) {
|
|
3320
|
-
this.options = e, this.delayCountdown = new
|
|
3308
|
+
this.options = e, this.delayCountdown = new fn((e) => {
|
|
3321
3309
|
Object.assign(this.options.state.fill, e);
|
|
3322
3310
|
}), this.syncBackendCountdown();
|
|
3323
3311
|
}
|
|
3324
3312
|
isActive() {
|
|
3325
|
-
return
|
|
3313
|
+
return Bn(this.options.state.fill);
|
|
3326
3314
|
}
|
|
3327
3315
|
applyUpdate(e) {
|
|
3328
|
-
let t =
|
|
3316
|
+
let t = qn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3329
3317
|
return t && this.syncBackendCountdown(), t;
|
|
3330
3318
|
}
|
|
3331
3319
|
restoreSession(e) {
|
|
3332
|
-
let t =
|
|
3320
|
+
let t = Jn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3333
3321
|
return t && this.syncBackendCountdown(), t;
|
|
3334
3322
|
}
|
|
3335
3323
|
async start(e, t = {}) {
|
|
3336
3324
|
let n = this.options.fill;
|
|
3337
3325
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3338
3326
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3339
|
-
let r =
|
|
3327
|
+
let r = Ln(e), i = Ln(t.target ?? r), a = t.progressOffset ?? {
|
|
3340
3328
|
completedPages: 0,
|
|
3341
3329
|
received: 0
|
|
3342
3330
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3343
3331
|
if (this.options.state.fill = {
|
|
3344
|
-
...
|
|
3332
|
+
...zn(n, void 0, !1),
|
|
3345
3333
|
completedPages: a.completedPages,
|
|
3346
3334
|
cycleId: o,
|
|
3347
3335
|
received: a.received,
|
|
@@ -3354,7 +3342,7 @@ var Jn = class {
|
|
|
3354
3342
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3355
3343
|
this.abortController = c;
|
|
3356
3344
|
try {
|
|
3357
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3345
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Hn(n, this.options.state, {
|
|
3358
3346
|
cycleId: o,
|
|
3359
3347
|
feedKey: n.feedKey,
|
|
3360
3348
|
items: [...this.options.state.items],
|
|
@@ -3372,7 +3360,7 @@ var Jn = class {
|
|
|
3372
3360
|
}
|
|
3373
3361
|
async cancel() {
|
|
3374
3362
|
let { fill: e, state: t } = this.options;
|
|
3375
|
-
if (!
|
|
3363
|
+
if (!Bn(t.fill) || !t.fill.cycleId) return;
|
|
3376
3364
|
let n = {
|
|
3377
3365
|
cycleId: t.fill.cycleId,
|
|
3378
3366
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3416,7 +3404,7 @@ var Jn = class {
|
|
|
3416
3404
|
});
|
|
3417
3405
|
}
|
|
3418
3406
|
reset() {
|
|
3419
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3407
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = zn(this.options.fill, void 0, !1), this.collection = null;
|
|
3420
3408
|
}
|
|
3421
3409
|
destroy() {
|
|
3422
3410
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3451,7 +3439,7 @@ var Jn = class {
|
|
|
3451
3439
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
3452
3440
|
return;
|
|
3453
3441
|
}
|
|
3454
|
-
let c = await
|
|
3442
|
+
let c = await Vn({
|
|
3455
3443
|
existingItems: s.items,
|
|
3456
3444
|
initialCursor: s.next,
|
|
3457
3445
|
loadPage: o,
|
|
@@ -3477,7 +3465,7 @@ var Jn = class {
|
|
|
3477
3465
|
signal: n.signal,
|
|
3478
3466
|
target: t
|
|
3479
3467
|
});
|
|
3480
|
-
this.isCurrent(r) && (s.items =
|
|
3468
|
+
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, {
|
|
3481
3469
|
completedPages: a.completedPages + c.completedPages,
|
|
3482
3470
|
received: a.received + c.received,
|
|
3483
3471
|
status: c.status
|
|
@@ -3487,7 +3475,7 @@ var Jn = class {
|
|
|
3487
3475
|
let e = this.collection;
|
|
3488
3476
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
3489
3477
|
let t = this.options.state;
|
|
3490
|
-
t.items =
|
|
3478
|
+
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, {
|
|
3491
3479
|
completedPages: e.completedPages,
|
|
3492
3480
|
received: e.received
|
|
3493
3481
|
});
|
|
@@ -3499,7 +3487,7 @@ var Jn = class {
|
|
|
3499
3487
|
};
|
|
3500
3488
|
//#endregion
|
|
3501
3489
|
//#region src/core/fillReconciliation.ts
|
|
3502
|
-
async function
|
|
3490
|
+
async function Xn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
|
|
3503
3491
|
if (!e.needsReconciliation(o.items)) return "skipped";
|
|
3504
3492
|
let s = await e.reconcile({
|
|
3505
3493
|
existingItems: o.items,
|
|
@@ -3508,11 +3496,11 @@ async function Yn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
3508
3496
|
shouldPause: () => o.loadMoreLocked,
|
|
3509
3497
|
signal: a
|
|
3510
3498
|
});
|
|
3511
|
-
return t() ? (o.items =
|
|
3499
|
+
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;
|
|
3512
3500
|
}
|
|
3513
3501
|
//#endregion
|
|
3514
3502
|
//#region src/core/feedFooter.ts
|
|
3515
|
-
function
|
|
3503
|
+
function Zn(e) {
|
|
3516
3504
|
return {
|
|
3517
3505
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3518
3506
|
loadMore: () => e.loadNext(),
|
|
@@ -3524,64 +3512,64 @@ function Xn(e) {
|
|
|
3524
3512
|
retryFill: () => e.retryFill()
|
|
3525
3513
|
};
|
|
3526
3514
|
}
|
|
3527
|
-
function Zn(e) {
|
|
3528
|
-
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3529
|
-
}
|
|
3530
3515
|
function Qn(e) {
|
|
3531
|
-
e
|
|
3516
|
+
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3532
3517
|
}
|
|
3533
3518
|
function $n(e) {
|
|
3519
|
+
e?.intervalMs !== void 0 && Qn(e.intervalMs);
|
|
3520
|
+
}
|
|
3521
|
+
function er(e) {
|
|
3534
3522
|
return {
|
|
3535
3523
|
enabled: e?.enabled ?? !1,
|
|
3536
3524
|
includePostItems: e?.includePostItems ?? !1,
|
|
3537
3525
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3538
3526
|
};
|
|
3539
3527
|
}
|
|
3540
|
-
function
|
|
3528
|
+
function tr(e, t) {
|
|
3541
3529
|
if (typeof t == "boolean") {
|
|
3542
3530
|
e.enabled = t;
|
|
3543
3531
|
return;
|
|
3544
3532
|
}
|
|
3545
|
-
|
|
3533
|
+
$n(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);
|
|
3546
3534
|
}
|
|
3547
3535
|
//#endregion
|
|
3548
3536
|
//#region src/core/reelInfoSheet.ts
|
|
3549
|
-
function
|
|
3537
|
+
function nr(e) {
|
|
3550
3538
|
return { enabled: e?.enabled ?? !1 };
|
|
3551
3539
|
}
|
|
3552
|
-
function
|
|
3540
|
+
function rr(e, t, n) {
|
|
3553
3541
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3554
3542
|
e.enabled = n;
|
|
3555
3543
|
}
|
|
3556
3544
|
//#endregion
|
|
3557
3545
|
//#region src/core/initialRuntimeState.ts
|
|
3558
|
-
function
|
|
3546
|
+
function ir(e, t) {
|
|
3559
3547
|
let n = e.initialPage;
|
|
3560
3548
|
return {
|
|
3561
3549
|
activeReelPostId: null,
|
|
3562
|
-
autoScroll:
|
|
3563
|
-
autofill:
|
|
3550
|
+
autoScroll: Dn(e.autoScroll),
|
|
3551
|
+
autofill: _n(e.autofill),
|
|
3564
3552
|
current: n?.current ?? null,
|
|
3565
3553
|
error: null,
|
|
3566
|
-
fill:
|
|
3554
|
+
fill: zn(e.fill),
|
|
3567
3555
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3568
3556
|
isLoading: !n,
|
|
3569
3557
|
isLoadingMore: !1,
|
|
3570
|
-
items: n ?
|
|
3558
|
+
items: n ? Z([], n.items) : [],
|
|
3571
3559
|
layout: t === "reel" ? "reel" : "masonry",
|
|
3572
3560
|
loadMoreLocked: !1,
|
|
3573
3561
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
3574
3562
|
next: n?.next ?? null,
|
|
3575
3563
|
nextPageError: null,
|
|
3576
3564
|
phoneMode: !1,
|
|
3577
|
-
reelAutoAdvance:
|
|
3565
|
+
reelAutoAdvance: er(e.reelAutoAdvance),
|
|
3578
3566
|
reelForward: {
|
|
3579
3567
|
error: null,
|
|
3580
3568
|
status: "idle"
|
|
3581
3569
|
},
|
|
3582
3570
|
reelForwardIndex: null,
|
|
3583
3571
|
reelForwardItem: null,
|
|
3584
|
-
reelInfoSheet:
|
|
3572
|
+
reelInfoSheet: nr(e.reelInfoSheet),
|
|
3585
3573
|
reelInfoSheetOverlay: !1,
|
|
3586
3574
|
reelMediaSource: "original",
|
|
3587
3575
|
reelOrigin: null,
|
|
@@ -3590,20 +3578,20 @@ function rr(e, t) {
|
|
|
3590
3578
|
}
|
|
3591
3579
|
//#endregion
|
|
3592
3580
|
//#region src/core/options.ts
|
|
3593
|
-
function
|
|
3581
|
+
function ar(e, t) {
|
|
3594
3582
|
if (t) {
|
|
3595
3583
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3596
3584
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3597
3585
|
}
|
|
3598
3586
|
}
|
|
3599
|
-
function
|
|
3587
|
+
function or(e, t) {
|
|
3600
3588
|
if (t) {
|
|
3601
3589
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3602
3590
|
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.`);
|
|
3603
3591
|
}
|
|
3604
3592
|
}
|
|
3605
|
-
function
|
|
3606
|
-
if (
|
|
3593
|
+
function sr(e) {
|
|
3594
|
+
if (En(e.autoScroll), ar("cardHeader", e.cardHeader), ar("cardFooter", e.cardFooter), or("header", e.mediaCard?.header), or("footer", e.mediaCard?.footer), gn(e.autofill), Rn(e.fill), de(e.masonry), $n(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3607
3595
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3608
3596
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3609
3597
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3618,7 +3606,7 @@ function or(e) {
|
|
|
3618
3606
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3619
3607
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3620
3608
|
}
|
|
3621
|
-
function
|
|
3609
|
+
function cr(e) {
|
|
3622
3610
|
if (typeof e != "string") return e;
|
|
3623
3611
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3624
3612
|
let t = document.querySelector(e);
|
|
@@ -3627,7 +3615,7 @@ function sr(e) {
|
|
|
3627
3615
|
}
|
|
3628
3616
|
//#endregion
|
|
3629
3617
|
//#region src/core/pageRequest.ts
|
|
3630
|
-
async function
|
|
3618
|
+
async function lr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3631
3619
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
3632
3620
|
received: l.autofill.received,
|
|
3633
3621
|
requests: l.autofill.requests
|
|
@@ -3639,11 +3627,11 @@ async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3639
3627
|
let m = !1;
|
|
3640
3628
|
try {
|
|
3641
3629
|
if (u?.strategy === "frontend") {
|
|
3642
|
-
let s = await
|
|
3630
|
+
let s = await xn({
|
|
3643
3631
|
existingItems: e ? l.items : [],
|
|
3644
3632
|
initialCursor: n,
|
|
3645
3633
|
loadPage: i,
|
|
3646
|
-
maximumRequests: f ? Math.max(0,
|
|
3634
|
+
maximumRequests: f ? Math.max(0, pn(u) - f.requests) : void 0,
|
|
3647
3635
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3648
3636
|
onDelayChange: (e) => {
|
|
3649
3637
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3658,7 +3646,7 @@ async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3658
3646
|
signal: c
|
|
3659
3647
|
});
|
|
3660
3648
|
if (!r()) return;
|
|
3661
|
-
l.items = e ?
|
|
3649
|
+
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, {
|
|
3662
3650
|
missing: s.missing,
|
|
3663
3651
|
received: s.received,
|
|
3664
3652
|
requests: s.requests,
|
|
@@ -3666,12 +3654,12 @@ async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3666
3654
|
}), o(s.pages), t.clearCollection();
|
|
3667
3655
|
return;
|
|
3668
3656
|
}
|
|
3669
|
-
let s =
|
|
3657
|
+
let s = Zt(await i({
|
|
3670
3658
|
cursor: n,
|
|
3671
3659
|
signal: c
|
|
3672
3660
|
}));
|
|
3673
3661
|
if (!r()) return;
|
|
3674
|
-
let d = e ? l.items : [], h =
|
|
3662
|
+
let d = e ? l.items : [], h = Z(d, s.items), g = h.length - d.length;
|
|
3675
3663
|
if (l.items = h, a(n), o([{
|
|
3676
3664
|
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
3677
3665
|
cursor: n,
|
|
@@ -3686,7 +3674,7 @@ async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3686
3674
|
l.autofill.status = "complete";
|
|
3687
3675
|
return;
|
|
3688
3676
|
}
|
|
3689
|
-
await
|
|
3677
|
+
await kn(u, l, {
|
|
3690
3678
|
cycleId: p,
|
|
3691
3679
|
feedKey: u.feedKey,
|
|
3692
3680
|
items: h.slice(d.length),
|
|
@@ -3708,7 +3696,7 @@ async function cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3708
3696
|
}
|
|
3709
3697
|
//#endregion
|
|
3710
3698
|
//#region src/core/removalReconciliationController.ts
|
|
3711
|
-
function
|
|
3699
|
+
function $(e) {
|
|
3712
3700
|
return `${typeof e}:${String(e)}`;
|
|
3713
3701
|
}
|
|
3714
3702
|
function ur(e) {
|
|
@@ -3736,7 +3724,7 @@ var fr = class {
|
|
|
3736
3724
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
3737
3725
|
}
|
|
3738
3726
|
filterItems(e) {
|
|
3739
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
3727
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has($(e)));
|
|
3740
3728
|
}
|
|
3741
3729
|
needsReconciliation(e) {
|
|
3742
3730
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -3750,38 +3738,38 @@ var fr = class {
|
|
|
3750
3738
|
recordInitialPage(e) {
|
|
3751
3739
|
e && this.recordPages([{
|
|
3752
3740
|
contributionIds: dr(e.items),
|
|
3753
|
-
cursor:
|
|
3741
|
+
cursor: tn(e),
|
|
3754
3742
|
next: e.next,
|
|
3755
3743
|
returnedIds: dr(e.items)
|
|
3756
3744
|
}]);
|
|
3757
3745
|
}
|
|
3758
3746
|
remove(e) {
|
|
3759
|
-
e.forEach((e) => this.tombstones.add(
|
|
3747
|
+
e.forEach((e) => this.tombstones.add($(e)));
|
|
3760
3748
|
}
|
|
3761
3749
|
reset() {
|
|
3762
3750
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
3763
3751
|
}
|
|
3764
3752
|
restore(e) {
|
|
3765
|
-
e.forEach((e) => this.tombstones.delete(
|
|
3753
|
+
e.forEach((e) => this.tombstones.delete($(e)));
|
|
3766
3754
|
}
|
|
3767
3755
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
3768
3756
|
let a = this.pending ?? this.createSession(e);
|
|
3769
3757
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
3770
3758
|
let e = ur(a.cursor);
|
|
3771
3759
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3772
|
-
if (await
|
|
3773
|
-
delayMs:
|
|
3760
|
+
if (await dn({
|
|
3761
|
+
delayMs: un(a.pages.length, this.delay),
|
|
3774
3762
|
onChange: n,
|
|
3775
3763
|
signal: i
|
|
3776
3764
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
3777
|
-
let o =
|
|
3765
|
+
let o = Zt(await t({
|
|
3778
3766
|
cursor: a.cursor,
|
|
3779
3767
|
signal: i
|
|
3780
3768
|
}));
|
|
3781
3769
|
a.seenCursors.add(e);
|
|
3782
3770
|
let s = this.filterItems(o.items), c = [];
|
|
3783
3771
|
if (s.forEach((e) => {
|
|
3784
|
-
let t =
|
|
3772
|
+
let t = $(e.postId);
|
|
3785
3773
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
3786
3774
|
}), a.pages.push({
|
|
3787
3775
|
contributionIds: c,
|
|
@@ -3795,9 +3783,9 @@ var fr = class {
|
|
|
3795
3783
|
createSession(e) {
|
|
3796
3784
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
3797
3785
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
3798
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
3786
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map($))), a = new Set(e.map(({ postId: e }) => $(e)).filter((e) => !i.has(e)));
|
|
3799
3787
|
return {
|
|
3800
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
3788
|
+
appended: new Set(e.map(({ postId: e }) => $(e))),
|
|
3801
3789
|
attributed: new Set(a),
|
|
3802
3790
|
cursor: r.cursor,
|
|
3803
3791
|
items: [],
|
|
@@ -3822,8 +3810,8 @@ var fr = class {
|
|
|
3822
3810
|
}
|
|
3823
3811
|
findUnderfilledPage(e) {
|
|
3824
3812
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
3825
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
3826
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
3813
|
+
let t = new Set(e.map(({ postId: e }) => $(e)));
|
|
3814
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
|
|
3827
3815
|
}
|
|
3828
3816
|
recordPage(e) {
|
|
3829
3817
|
let t = ur(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ur(e) === t);
|
|
@@ -4266,7 +4254,7 @@ var jr = class {
|
|
|
4266
4254
|
}, Mr = class {
|
|
4267
4255
|
state;
|
|
4268
4256
|
constructor(e) {
|
|
4269
|
-
this.options = e, this.state = x(
|
|
4257
|
+
this.options = e, this.state = x(Ze({
|
|
4270
4258
|
...e.initialReelAudioState,
|
|
4271
4259
|
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
4272
4260
|
}));
|
|
@@ -4275,7 +4263,7 @@ var jr = class {
|
|
|
4275
4263
|
return { ...this.state };
|
|
4276
4264
|
}
|
|
4277
4265
|
set(e, t = !1) {
|
|
4278
|
-
Object.assign(this.state,
|
|
4266
|
+
Object.assign(this.state, Ze(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4279
4267
|
}
|
|
4280
4268
|
}, Nr = class {
|
|
4281
4269
|
routedReelPostId = null;
|
|
@@ -4327,24 +4315,24 @@ var jr = class {
|
|
|
4327
4315
|
reelAudio;
|
|
4328
4316
|
state;
|
|
4329
4317
|
constructor(e) {
|
|
4330
|
-
this.options = e,
|
|
4318
|
+
this.options = e, sr(e);
|
|
4331
4319
|
let t = e.layout ?? "masonry";
|
|
4332
|
-
this.state = x(
|
|
4320
|
+
this.state = x(ir(e, t)), this.reelAudio = new Mr(e), this.lastLoadedCursor = e.initialPage ? tn(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new On({
|
|
4333
4321
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4334
4322
|
state: this.state.autoScroll
|
|
4335
|
-
}), this.autofillController = new
|
|
4323
|
+
}), this.autofillController = new Sn({
|
|
4336
4324
|
cancelRequest: () => this.cancelRequest(),
|
|
4337
4325
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4338
4326
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4339
4327
|
options: e.autofill,
|
|
4340
4328
|
state: this.state
|
|
4341
|
-
}), this.removalReconciliation = new fr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new
|
|
4329
|
+
}), this.removalReconciliation = new fr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Yn({
|
|
4342
4330
|
fill: e.fill,
|
|
4343
4331
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4344
4332
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4345
4333
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4346
4334
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4347
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4335
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Xn({
|
|
4348
4336
|
controller: this.removalReconciliation,
|
|
4349
4337
|
isCurrent: t,
|
|
4350
4338
|
loadPage: e.loadPage,
|
|
@@ -4371,13 +4359,13 @@ var jr = class {
|
|
|
4371
4359
|
async mount() {
|
|
4372
4360
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4373
4361
|
this.startStateNotifications();
|
|
4374
|
-
let e =
|
|
4375
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4362
|
+
let e = cr(this.options.target);
|
|
4363
|
+
this.responsiveLayout.mount(e), this.app = i(Xt, {
|
|
4376
4364
|
canRetryEnd: !!this.options.loadPage,
|
|
4377
4365
|
cardFooter: this.options.cardFooter,
|
|
4378
4366
|
cardHeader: this.options.cardHeader,
|
|
4379
4367
|
feedFooter: this.options.feedFooter,
|
|
4380
|
-
feedFooterActions:
|
|
4368
|
+
feedFooterActions: Zn(this),
|
|
4381
4369
|
mediaCard: this.options.mediaCard,
|
|
4382
4370
|
masonry: this.options.masonry,
|
|
4383
4371
|
onMediaReady: this.options.onMediaReady,
|
|
@@ -4402,7 +4390,7 @@ var jr = class {
|
|
|
4402
4390
|
onRetryForward: () => {
|
|
4403
4391
|
this.retryReelForward();
|
|
4404
4392
|
}
|
|
4405
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
4393
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await Nn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
4406
4394
|
this.restoreController = e;
|
|
4407
4395
|
}), !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();
|
|
4408
4396
|
}
|
|
@@ -4473,7 +4461,7 @@ var jr = class {
|
|
|
4473
4461
|
this.autoScroll.setSpeed(e);
|
|
4474
4462
|
}
|
|
4475
4463
|
applyAutofillUpdate(e) {
|
|
4476
|
-
let t =
|
|
4464
|
+
let t = jn(this.options.autofill, this.state, e);
|
|
4477
4465
|
return t && this.autofillController.syncCountdown(), t;
|
|
4478
4466
|
}
|
|
4479
4467
|
cancelAutofill() {
|
|
@@ -4484,7 +4472,7 @@ var jr = class {
|
|
|
4484
4472
|
await this.cancelFill();
|
|
4485
4473
|
return;
|
|
4486
4474
|
}
|
|
4487
|
-
if (
|
|
4475
|
+
if (vn(this.state.autofill)) {
|
|
4488
4476
|
await this.cancelAutofill();
|
|
4489
4477
|
return;
|
|
4490
4478
|
}
|
|
@@ -4498,12 +4486,12 @@ var jr = class {
|
|
|
4498
4486
|
}
|
|
4499
4487
|
async fill(e) {
|
|
4500
4488
|
if (!this.state.loadMoreLocked) {
|
|
4501
|
-
if (this.pendingRequest ||
|
|
4489
|
+
if (this.pendingRequest || vn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4502
4490
|
await this.fillController.start(e);
|
|
4503
4491
|
}
|
|
4504
4492
|
}
|
|
4505
4493
|
restoreAutofillSession(e) {
|
|
4506
|
-
let t =
|
|
4494
|
+
let t = Mn(this.options.autofill, this.state, e);
|
|
4507
4495
|
return t && this.autofillController.syncCountdown(), t;
|
|
4508
4496
|
}
|
|
4509
4497
|
restoreFillSession(e) {
|
|
@@ -4513,14 +4501,14 @@ var jr = class {
|
|
|
4513
4501
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
4514
4502
|
}
|
|
4515
4503
|
appendPage(e) {
|
|
4516
|
-
|
|
4504
|
+
nn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
4517
4505
|
}
|
|
4518
4506
|
replenishAfterRemoval() {
|
|
4519
4507
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
4520
4508
|
}
|
|
4521
4509
|
async startLoadMore(e) {
|
|
4522
4510
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4523
|
-
if (this.state.loadMoreLocked ||
|
|
4511
|
+
if (this.state.loadMoreLocked || vn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
4524
4512
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4525
4513
|
let t = e();
|
|
4526
4514
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -4535,12 +4523,12 @@ var jr = class {
|
|
|
4535
4523
|
}
|
|
4536
4524
|
async replaceFeed(e, t) {
|
|
4537
4525
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4538
|
-
return
|
|
4526
|
+
return vn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = _n(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);
|
|
4539
4527
|
}
|
|
4540
4528
|
async loadFilteredPage(e) {
|
|
4541
4529
|
let t = this.options.loadPage;
|
|
4542
4530
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4543
|
-
let n =
|
|
4531
|
+
let n = Zt(await t(e));
|
|
4544
4532
|
return {
|
|
4545
4533
|
...n,
|
|
4546
4534
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4559,7 +4547,7 @@ var jr = class {
|
|
|
4559
4547
|
let t = ++this.requestVersion, n = new AbortController();
|
|
4560
4548
|
this.abortController = n;
|
|
4561
4549
|
try {
|
|
4562
|
-
let r = await
|
|
4550
|
+
let r = await Xn({
|
|
4563
4551
|
controller: this.removalReconciliation,
|
|
4564
4552
|
isCurrent: () => t === this.requestVersion,
|
|
4565
4553
|
loadPage: e,
|
|
@@ -4577,7 +4565,7 @@ var jr = class {
|
|
|
4577
4565
|
}
|
|
4578
4566
|
async retryEnd() {
|
|
4579
4567
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4580
|
-
if (!this.state.loadMoreLocked && !(
|
|
4568
|
+
if (!this.state.loadMoreLocked && !(vn(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);
|
|
4581
4569
|
}
|
|
4582
4570
|
setInfiniteScroll(e) {
|
|
4583
4571
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4601,10 +4589,10 @@ var jr = class {
|
|
|
4601
4589
|
this.state.total = e;
|
|
4602
4590
|
}
|
|
4603
4591
|
setReelAutoAdvance(e) {
|
|
4604
|
-
|
|
4592
|
+
tr(this.state.reelAutoAdvance, e);
|
|
4605
4593
|
}
|
|
4606
4594
|
setReelInfoSheet(e) {
|
|
4607
|
-
|
|
4595
|
+
rr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4608
4596
|
}
|
|
4609
4597
|
setLayout(e) {
|
|
4610
4598
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4624,7 +4612,7 @@ var jr = class {
|
|
|
4624
4612
|
async fetchPage(e, t) {
|
|
4625
4613
|
if (!this.options.loadPage) return;
|
|
4626
4614
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4627
|
-
this.abortController = r, await
|
|
4615
|
+
this.abortController = r, await lr({
|
|
4628
4616
|
append: t,
|
|
4629
4617
|
autofillController: this.autofillController,
|
|
4630
4618
|
cursor: e,
|
|
@@ -4646,7 +4634,7 @@ var jr = class {
|
|
|
4646
4634
|
startInitialAutofill() {
|
|
4647
4635
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4648
4636
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4649
|
-
let r =
|
|
4637
|
+
let r = Pn({
|
|
4650
4638
|
cycleId: n,
|
|
4651
4639
|
isCurrent: () => e === this.requestVersion,
|
|
4652
4640
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|