@wyxos/vibe 5.7.0 → 5.7.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/components/MasonryFeed.vue.d.ts +2 -2
- package/lib/components/MediaCard.vue.d.ts +2 -2
- package/lib/components/MediaError.vue.d.ts +14 -0
- package/lib/components/ReelFeed.vue.d.ts +2 -2
- package/lib/components/ReelLayout.vue.d.ts +2 -2
- package/lib/components/useMediaReadiness.d.ts +1 -0
- package/lib/core/mediaPreview.d.ts +10 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +737 -688
- package/lib/style.css +1 -1
- package/lib/types.d.ts +2 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -71,7 +71,7 @@ var B = {
|
|
|
71
71
|
key: 0,
|
|
72
72
|
class: "load-more-status",
|
|
73
73
|
role: "status"
|
|
74
|
-
},
|
|
74
|
+
}, ee = ["disabled"], H = {
|
|
75
75
|
key: 2,
|
|
76
76
|
class: "end-feed"
|
|
77
77
|
}, U = ["disabled"], W = /* @__PURE__ */ d({
|
|
@@ -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, ee)) : (b(), s("div", H, [n[1] ||= c("p", {
|
|
101
101
|
class: "end-feed-message",
|
|
102
102
|
role: "status"
|
|
103
103
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -108,7 +108,7 @@ var B = {
|
|
|
108
108
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
109
109
|
}, " Check for more ", 8, U)]))])) : o("", !0);
|
|
110
110
|
}
|
|
111
|
-
}),
|
|
111
|
+
}), G = /* @__PURE__ */ d({
|
|
112
112
|
__name: "FeedFooter",
|
|
113
113
|
props: {
|
|
114
114
|
actions: {},
|
|
@@ -164,7 +164,7 @@ var B = {
|
|
|
164
164
|
"show-load-more"
|
|
165
165
|
]));
|
|
166
166
|
}
|
|
167
|
-
}),
|
|
167
|
+
}), K = ["role"], q = { class: "gallery-status" }, te = /* @__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", q, [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(G, {
|
|
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, K));
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
|
-
function
|
|
206
|
+
function J(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 ne(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 Y(e) {
|
|
216
216
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function re(e) {
|
|
219
219
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function ie(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 = Y(c), n = s * ne(e) + i, a = {
|
|
229
229
|
x: t * (s + r),
|
|
230
230
|
y: c[t],
|
|
231
231
|
width: s,
|
|
@@ -241,7 +241,7 @@ function ae(e, t, n) {
|
|
|
241
241
|
}
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/core/masonryViewportIndex.ts
|
|
244
|
-
function
|
|
244
|
+
function ae(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 oe(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 X(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 Y(e, t) {
|
|
|
263
263
|
inspected: n
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function Z(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 = X(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 X(e, t) {
|
|
|
278
278
|
inspected: o
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function Q(e) {
|
|
282
282
|
return e?.minColumnWidth ?? 240;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function oe(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 se(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 ce(e) {
|
|
|
299
299
|
}
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region src/core/scrollbar.ts
|
|
302
|
-
function
|
|
302
|
+
function ce(e, t, n) {
|
|
303
303
|
return Math.min(n, Math.max(t, e));
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function le({ 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 = ce(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 * (ce(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 ue = ["aria-hidden"], de = [
|
|
326
326
|
"aria-controls",
|
|
327
327
|
"aria-valuemax",
|
|
328
328
|
"aria-valuenow",
|
|
329
329
|
"tabindex"
|
|
330
|
-
],
|
|
330
|
+
], fe = 32, pe = 40, me = 120, he = /* @__PURE__ */ d({
|
|
331
331
|
__name: "GalleryScrollbar",
|
|
332
332
|
props: {
|
|
333
333
|
contentSize: {},
|
|
@@ -349,16 +349,16 @@ var de = ["aria-hidden"], fe = [
|
|
|
349
349
|
function k() {
|
|
350
350
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
351
351
|
g = null, o.value || (l.value = !1);
|
|
352
|
-
},
|
|
352
|
+
}, me);
|
|
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 : le({
|
|
360
360
|
contentSize: e.scrollHeight,
|
|
361
|
-
minimumThumbSize:
|
|
361
|
+
minimumThumbSize: fe,
|
|
362
362
|
scrollPosition: e.scrollTop,
|
|
363
363
|
trackSize: r.clientHeight,
|
|
364
364
|
viewportSize: e.clientHeight
|
|
@@ -411,7 +411,7 @@ var de = ["aria-hidden"], fe = [
|
|
|
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 - pe : e.key === "ArrowDown" ? r + pe : 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 de = ["aria-hidden"], fe = [
|
|
|
457
457
|
onPointerdown: I,
|
|
458
458
|
onPointermove: L,
|
|
459
459
|
onPointerup: R
|
|
460
|
-
}, null, 44,
|
|
460
|
+
}, null, 44, de)], 42, ue));
|
|
461
461
|
}
|
|
462
|
-
}),
|
|
462
|
+
}), ge = (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
|
+
}, _e = (e) => e === "", ve = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ye = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), be = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), xe = (e) => {
|
|
466
|
+
let t = be(e);
|
|
467
467
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
468
|
-
},
|
|
468
|
+
}, Se = {
|
|
469
469
|
xmlns: "http://www.w3.org/2000/svg",
|
|
470
470
|
width: 24,
|
|
471
471
|
height: 24,
|
|
@@ -475,27 +475,27 @@ var de = ["aria-hidden"], fe = [
|
|
|
475
475
|
"stroke-width": 2,
|
|
476
476
|
"stroke-linecap": "round",
|
|
477
477
|
"stroke-linejoin": "round"
|
|
478
|
-
},
|
|
479
|
-
...
|
|
478
|
+
}, Ce = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Se.width, color: s = Se.stroke, ...c }, { slots: l }) => p("svg", {
|
|
479
|
+
...Se,
|
|
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": _e(n) || _e(r) || n === !0 || r === !0 ? Number(i || a || Se["stroke-width"]) * 24 / Number(o) : i || a || Se["stroke-width"],
|
|
485
|
+
class: ve("lucide", c.class, ...e ? [`lucide-${ye(xe(e))}-icon`, `lucide-${ye(e)}`] : ["lucide-icon"]),
|
|
486
|
+
...!l.default && !ge(c) && { "aria-hidden": "true" }
|
|
487
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), we = (e, t) => (n, { slots: r, attrs: i }) => p(Ce, {
|
|
488
488
|
...i,
|
|
489
489
|
...n,
|
|
490
490
|
iconNode: t,
|
|
491
491
|
name: e
|
|
492
|
-
}, r),
|
|
492
|
+
}, r), Te = we("chevron-left", [["path", {
|
|
493
493
|
d: "m15 18-6-6 6-6",
|
|
494
494
|
key: "1wnfg3"
|
|
495
|
-
}]]),
|
|
495
|
+
}]]), Ee = we("chevron-right", [["path", {
|
|
496
496
|
d: "m9 18 6-6-6-6",
|
|
497
497
|
key: "mthhwq"
|
|
498
|
-
}]]),
|
|
498
|
+
}]]), De = we("pause", [["rect", {
|
|
499
499
|
x: "14",
|
|
500
500
|
y: "3",
|
|
501
501
|
width: "5",
|
|
@@ -509,10 +509,10 @@ var de = ["aria-hidden"], fe = [
|
|
|
509
509
|
height: "18",
|
|
510
510
|
rx: "1",
|
|
511
511
|
key: "1wsw3u"
|
|
512
|
-
}]]),
|
|
512
|
+
}]]), Oe = we("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
|
+
}]]), ke = we("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 de = ["aria-hidden"], fe = [
|
|
|
525
525
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
526
526
|
key: "ijwkga"
|
|
527
527
|
}]
|
|
528
|
-
]),
|
|
528
|
+
]), Ae = we("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 de = ["aria-hidden"], fe = [
|
|
|
544
544
|
y2: "15",
|
|
545
545
|
key: "5ykzw1"
|
|
546
546
|
}]
|
|
547
|
-
]),
|
|
547
|
+
]), je = {
|
|
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 Me(e) {
|
|
555
555
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
556
556
|
}
|
|
557
|
-
function
|
|
558
|
-
return Me
|
|
557
|
+
function Ne(e) {
|
|
558
|
+
return je[Me(e)] ?? "Preview unavailable";
|
|
559
559
|
}
|
|
560
560
|
//#endregion
|
|
561
561
|
//#region src/components/CardRegion.vue
|
|
562
|
-
var
|
|
562
|
+
var Pe = /* @__PURE__ */ d({
|
|
563
563
|
__name: "CardRegion",
|
|
564
564
|
props: {
|
|
565
565
|
index: {},
|
|
@@ -606,18 +606,65 @@ var Fe = /* @__PURE__ */ d({
|
|
|
606
606
|
"total"
|
|
607
607
|
]))], 38));
|
|
608
608
|
}
|
|
609
|
-
}), Ie = [
|
|
609
|
+
}), Fe = ["aria-busy", "aria-label"], Ie = { class: "media-error-code" }, Le = ["disabled"], Re = /* @__PURE__ */ d({
|
|
610
|
+
__name: "MediaError",
|
|
611
|
+
props: {
|
|
612
|
+
component: {},
|
|
613
|
+
label: {},
|
|
614
|
+
retrying: { type: Boolean },
|
|
615
|
+
status: {}
|
|
616
|
+
},
|
|
617
|
+
emits: ["retry"],
|
|
618
|
+
setup(t, { emit: n }) {
|
|
619
|
+
let r = t, i = n;
|
|
620
|
+
function o() {
|
|
621
|
+
r.retrying || i("retry");
|
|
622
|
+
}
|
|
623
|
+
return (n, r) => (b(), s("div", {
|
|
624
|
+
"data-test": "media-error",
|
|
625
|
+
class: "media-error",
|
|
626
|
+
role: "group",
|
|
627
|
+
"aria-busy": t.retrying,
|
|
628
|
+
"aria-label": `${t.status} ${t.label}`
|
|
629
|
+
}, [t.component ? (b(), s("div", {
|
|
630
|
+
key: 0,
|
|
631
|
+
class: "media-error-component",
|
|
632
|
+
onClick: r[0] ||= j(() => {}, ["stop"]),
|
|
633
|
+
onKeydown: r[1] ||= j(() => {}, ["stop"])
|
|
634
|
+
}, [(b(), a(C(t.component), {
|
|
635
|
+
label: t.label,
|
|
636
|
+
retry: o,
|
|
637
|
+
retrying: t.retrying,
|
|
638
|
+
status: t.status
|
|
639
|
+
}, null, 8, [
|
|
640
|
+
"label",
|
|
641
|
+
"retrying",
|
|
642
|
+
"status"
|
|
643
|
+
]))], 32)) : (b(), s(e, { key: 1 }, [
|
|
644
|
+
c("strong", Ie, T(t.status), 1),
|
|
645
|
+
c("span", null, T(t.label), 1),
|
|
646
|
+
c("button", {
|
|
647
|
+
"data-test": "media-retry",
|
|
648
|
+
class: "media-error-retry",
|
|
649
|
+
type: "button",
|
|
650
|
+
disabled: t.retrying,
|
|
651
|
+
onClick: j(o, ["stop"]),
|
|
652
|
+
onKeydown: r[2] ||= j(() => {}, ["stop"])
|
|
653
|
+
}, T(t.retrying ? "Retrying…" : "Retry"), 41, Le)
|
|
654
|
+
], 64))], 8, Fe));
|
|
655
|
+
}
|
|
656
|
+
}), ze = [
|
|
610
657
|
"max",
|
|
611
658
|
"value",
|
|
612
659
|
"aria-valuetext",
|
|
613
660
|
"disabled"
|
|
614
|
-
],
|
|
661
|
+
], Be = {
|
|
615
662
|
key: 0,
|
|
616
663
|
class: "media-controls-row"
|
|
617
|
-
},
|
|
664
|
+
}, Ve = ["aria-label", "title"], He = { class: "media-controls-audio" }, Ue = ["aria-label", "title"], We = ["value", "aria-valuetext"], Ge = {
|
|
618
665
|
class: "media-control-time",
|
|
619
666
|
"aria-live": "off"
|
|
620
|
-
},
|
|
667
|
+
}, Ke = /* @__PURE__ */ d({
|
|
621
668
|
__name: "MediaControls",
|
|
622
669
|
props: {
|
|
623
670
|
currentTime: {},
|
|
@@ -665,35 +712,35 @@ var Fe = /* @__PURE__ */ d({
|
|
|
665
712
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
666
713
|
disabled: f.value <= 0,
|
|
667
714
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
668
|
-
}, null, 44,
|
|
715
|
+
}, null, 44, ze), e.layout === "reel" ? (b(), s("div", Be, [
|
|
669
716
|
c("button", {
|
|
670
717
|
type: "button",
|
|
671
718
|
class: "media-control-button media-control-playback",
|
|
672
719
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
673
720
|
title: e.playing ? "Pause" : "Play",
|
|
674
721
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
675
|
-
}, [e.playing ? (b(), a(E(
|
|
722
|
+
}, [e.playing ? (b(), a(E(De), {
|
|
676
723
|
key: 0,
|
|
677
724
|
size: 18,
|
|
678
725
|
fill: "currentColor"
|
|
679
|
-
})) : (b(), a(E(
|
|
726
|
+
})) : (b(), a(E(Oe), {
|
|
680
727
|
key: 1,
|
|
681
728
|
size: 18,
|
|
682
729
|
fill: "currentColor"
|
|
683
|
-
}))], 8,
|
|
684
|
-
c("div",
|
|
730
|
+
}))], 8, Ve),
|
|
731
|
+
c("div", He, [c("button", {
|
|
685
732
|
type: "button",
|
|
686
733
|
class: "media-control-button",
|
|
687
734
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
688
735
|
title: e.muted ? "Unmute" : "Mute",
|
|
689
736
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
690
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
737
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(Ae), {
|
|
691
738
|
key: 0,
|
|
692
739
|
size: 18
|
|
693
|
-
})) : (b(), a(E(
|
|
740
|
+
})) : (b(), a(E(ke), {
|
|
694
741
|
key: 1,
|
|
695
742
|
size: 18
|
|
696
|
-
}))], 8,
|
|
743
|
+
}))], 8, Ue), c("input", {
|
|
697
744
|
class: "media-control-range media-control-volume",
|
|
698
745
|
type: "range",
|
|
699
746
|
min: "0",
|
|
@@ -704,14 +751,14 @@ var Fe = /* @__PURE__ */ d({
|
|
|
704
751
|
"aria-label": "Video volume",
|
|
705
752
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
706
753
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
707
|
-
}, null, 44,
|
|
708
|
-
c("output",
|
|
754
|
+
}, null, 44, We)]),
|
|
755
|
+
c("output", Ge, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
709
756
|
])) : o("", !0)], 34));
|
|
710
757
|
}
|
|
711
758
|
});
|
|
712
759
|
//#endregion
|
|
713
760
|
//#region src/components/useReelVideoActivity.ts
|
|
714
|
-
function
|
|
761
|
+
function qe(e) {
|
|
715
762
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
716
763
|
function i() {
|
|
717
764
|
if (!t.value) {
|
|
@@ -745,21 +792,21 @@ function We(e) {
|
|
|
745
792
|
}
|
|
746
793
|
//#endregion
|
|
747
794
|
//#region src/core/mediaType.ts
|
|
748
|
-
var
|
|
749
|
-
function
|
|
795
|
+
var Je = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
796
|
+
function Ye(e) {
|
|
750
797
|
try {
|
|
751
|
-
return
|
|
798
|
+
return Je.test(new URL(e).pathname);
|
|
752
799
|
} catch {
|
|
753
|
-
return
|
|
800
|
+
return Je.test(e.split("?")[0] ?? e);
|
|
754
801
|
}
|
|
755
802
|
}
|
|
756
|
-
function
|
|
757
|
-
return e === void 0 ?
|
|
803
|
+
function Xe(e, t) {
|
|
804
|
+
return e === void 0 ? Ye(t) : e === "video";
|
|
758
805
|
}
|
|
759
806
|
//#endregion
|
|
760
807
|
//#region src/components/useMediaLoading.ts
|
|
761
|
-
function
|
|
762
|
-
let t = r(() =>
|
|
808
|
+
function Ze(e) {
|
|
809
|
+
let t = r(() => Xe(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");
|
|
763
810
|
return O(i, (t, n) => {
|
|
764
811
|
n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
|
|
765
812
|
}), {
|
|
@@ -770,64 +817,65 @@ function Je(e) {
|
|
|
770
817
|
}
|
|
771
818
|
//#endregion
|
|
772
819
|
//#region src/components/useMediaReadiness.ts
|
|
773
|
-
function
|
|
774
|
-
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c =
|
|
775
|
-
function
|
|
776
|
-
|
|
820
|
+
function Qe(e) {
|
|
821
|
+
let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
|
|
822
|
+
function f() {
|
|
823
|
+
l !== null && clearTimeout(l), l = null;
|
|
777
824
|
}
|
|
778
|
-
function
|
|
825
|
+
function p(e) {
|
|
779
826
|
return Number(e.currentTarget.dataset.sourceGeneration) === i.value;
|
|
780
827
|
}
|
|
781
|
-
function
|
|
782
|
-
|
|
828
|
+
function h() {
|
|
829
|
+
f(), l = setTimeout(() => y(), 15e3);
|
|
783
830
|
}
|
|
784
|
-
function
|
|
785
|
-
t && !
|
|
831
|
+
function g(t) {
|
|
832
|
+
t && !p(t) || (f(), o.value = !1, s.value = !1, c.value = !1, e.onReady(e.mediaIndex()));
|
|
786
833
|
}
|
|
787
|
-
function
|
|
834
|
+
function _() {
|
|
788
835
|
let e = t.value;
|
|
789
836
|
if (e?.complete) {
|
|
790
|
-
e.naturalWidth > 0 ?
|
|
837
|
+
e.naturalWidth > 0 ? g() : y();
|
|
791
838
|
return;
|
|
792
839
|
}
|
|
793
840
|
let r = n.value;
|
|
794
841
|
if (r && r.readyState >= HTMLMediaElement.HAVE_METADATA) {
|
|
795
|
-
|
|
842
|
+
g();
|
|
796
843
|
return;
|
|
797
844
|
}
|
|
798
|
-
|
|
845
|
+
h();
|
|
799
846
|
}
|
|
800
|
-
function
|
|
801
|
-
if (!(t && !
|
|
802
|
-
if (
|
|
803
|
-
a.value = 1, i.value += 1, o.value = !0, m(
|
|
847
|
+
function y(t) {
|
|
848
|
+
if (!(t && !p(t))) {
|
|
849
|
+
if (f(), !t && a.value === 0) {
|
|
850
|
+
a.value = 1, i.value += 1, o.value = !0, m(_);
|
|
804
851
|
return;
|
|
805
852
|
}
|
|
806
|
-
o.value = !1, s.value = !0, e.onError(e.mediaIndex());
|
|
853
|
+
o.value = !1, s.value = !0, c.value = !1, e.onError(e.mediaIndex());
|
|
807
854
|
}
|
|
808
855
|
}
|
|
809
|
-
function
|
|
810
|
-
a.value = 0, s.value = !
|
|
856
|
+
function b() {
|
|
857
|
+
c.value || d.value !== "error" || (a.value = 0, s.value = !0, o.value = !0, c.value = !0, i.value += 1, m(_));
|
|
811
858
|
}
|
|
812
|
-
function
|
|
813
|
-
|
|
859
|
+
function x(e) {
|
|
860
|
+
p(e) && o.value && h();
|
|
814
861
|
}
|
|
815
862
|
return O(e.identity, () => {
|
|
816
|
-
|
|
817
|
-
}, { immediate: !0 }), v(
|
|
818
|
-
effectivePreviewState:
|
|
819
|
-
failSourceAttempt:
|
|
863
|
+
f(), i.value += 1, a.value = 0, o.value = u || e.previewState() === "loading", s.value = !1, c.value = !1, u = !0, m(_);
|
|
864
|
+
}, { immediate: !0 }), v(f), {
|
|
865
|
+
effectivePreviewState: d,
|
|
866
|
+
failSourceAttempt: y,
|
|
820
867
|
imageElement: t,
|
|
821
|
-
markSourceReady:
|
|
822
|
-
noteSourceActivity:
|
|
823
|
-
retrySource:
|
|
868
|
+
markSourceReady: g,
|
|
869
|
+
noteSourceActivity: x,
|
|
870
|
+
retrySource: b,
|
|
871
|
+
retrying: c,
|
|
824
872
|
sourceGeneration: i,
|
|
825
873
|
videoElement: n
|
|
826
874
|
};
|
|
827
875
|
}
|
|
828
876
|
//#endregion
|
|
829
877
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
830
|
-
var
|
|
878
|
+
var $e = [
|
|
831
879
|
"data-post-id",
|
|
832
880
|
"data-media-index",
|
|
833
881
|
"aria-hidden",
|
|
@@ -835,12 +883,12 @@ var Xe = [
|
|
|
835
883
|
"inert",
|
|
836
884
|
"role",
|
|
837
885
|
"tabindex"
|
|
838
|
-
],
|
|
886
|
+
], et = { class: "media-card-content" }, tt = ["data-media-direction"], nt = ["data-media-index"], rt = {
|
|
839
887
|
key: 0,
|
|
840
888
|
"data-test": "media-loading",
|
|
841
889
|
class: "media-loading",
|
|
842
890
|
"aria-hidden": "true"
|
|
843
|
-
},
|
|
891
|
+
}, it = [
|
|
844
892
|
"data-source-generation",
|
|
845
893
|
"src",
|
|
846
894
|
"width",
|
|
@@ -849,14 +897,14 @@ var Xe = [
|
|
|
849
897
|
"loop",
|
|
850
898
|
"muted",
|
|
851
899
|
"preload"
|
|
852
|
-
],
|
|
900
|
+
], at = [
|
|
853
901
|
"data-source-generation",
|
|
854
902
|
"src",
|
|
855
903
|
"width",
|
|
856
904
|
"height",
|
|
857
905
|
"fetchpriority",
|
|
858
906
|
"loading"
|
|
859
|
-
],
|
|
907
|
+
], ot = ["aria-label"], st = ["aria-label"], ct = ["aria-label"], lt = 40, ut = 160, dt = 24, ft = /* @__PURE__ */ d({
|
|
860
908
|
__name: "MediaCard",
|
|
861
909
|
props: {
|
|
862
910
|
active: { type: Boolean },
|
|
@@ -892,130 +940,130 @@ var Xe = [
|
|
|
892
940
|
function S(e = !1, t = "pointer") {
|
|
893
941
|
e && x("activate", t);
|
|
894
942
|
}
|
|
895
|
-
let C = r(() => P(l.item)),
|
|
896
|
-
identity: () => `${l.item.postId}:${
|
|
897
|
-
mediaIndex: () =>
|
|
943
|
+
let C = r(() => P(l.item)), T = r(() => F(l.item, l.mediaIndex)), D = r(() => I(l.item, T.value)), O = r(() => N(D.value, l.mediaSource ?? "preview")), M = r(() => O.value.src), L = r(() => O.value.type), R = r(() => O.value.width), z = r(() => O.value.height), { effectivePreviewState: B, failSourceAttempt: V, imageElement: ee, markSourceReady: H, noteSourceActivity: U, retrySource: W, retrying: G, sourceGeneration: K, videoElement: q } = Qe({
|
|
944
|
+
identity: () => `${l.item.postId}:${T.value}:${l.mediaSource ?? "preview"}:${M.value}:${L.value ?? ""}`,
|
|
945
|
+
mediaIndex: () => T.value,
|
|
898
946
|
onError: (e) => x("error", e),
|
|
899
947
|
onReady: (e) => x("ready", e),
|
|
900
948
|
previewState: () => l.previewState
|
|
901
|
-
}),
|
|
949
|
+
}), te = w(0), J = w(0), ne = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), Y = w(!1), re = w(1), ie = 1, { effectiveMuted: ae, onPlaying: X, playbackAllowed: Z } = qe({
|
|
902
950
|
active: () => l.active,
|
|
903
951
|
layout: () => l.layout,
|
|
904
|
-
videoElement:
|
|
905
|
-
videoIsMuted:
|
|
906
|
-
videoIsPlaying:
|
|
907
|
-
}),
|
|
908
|
-
function
|
|
952
|
+
videoElement: q,
|
|
953
|
+
videoIsMuted: ne,
|
|
954
|
+
videoIsPlaying: Y
|
|
955
|
+
}), Q = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
956
|
+
function oe(e) {
|
|
909
957
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
910
958
|
}
|
|
911
|
-
function
|
|
959
|
+
function se(e, t) {
|
|
912
960
|
let n = C.value.length, r = (e + n) % n;
|
|
913
|
-
r !==
|
|
961
|
+
r !== T.value && (y.value = e < T.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
914
962
|
}
|
|
915
|
-
function
|
|
963
|
+
function ce(e, t, n) {
|
|
916
964
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
917
965
|
}
|
|
918
|
-
function
|
|
966
|
+
function le() {
|
|
919
967
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
920
968
|
}
|
|
921
|
-
function
|
|
922
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
969
|
+
function ue() {
|
|
970
|
+
d !== null && clearTimeout(d), d = setTimeout(le, ut);
|
|
923
971
|
}
|
|
924
|
-
function
|
|
972
|
+
function de(e) {
|
|
925
973
|
if (C.value.length <= 1) return;
|
|
926
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
927
|
-
if (n === 0 || (e.preventDefault(),
|
|
974
|
+
let t = e.currentTarget?.clientWidth || 1, n = ce(e.deltaX, e.deltaMode, t);
|
|
975
|
+
if (n === 0 || (e.preventDefault(), ue(), p) || (f += n, Math.abs(f) < dt)) return;
|
|
928
976
|
let r = Math.sign(f);
|
|
929
|
-
f = 0, p = !0,
|
|
977
|
+
f = 0, p = !0, se(T.value + r);
|
|
930
978
|
}
|
|
931
|
-
function
|
|
979
|
+
function fe(e) {
|
|
932
980
|
let t = e.touches[0];
|
|
933
981
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
934
982
|
}
|
|
935
|
-
function
|
|
983
|
+
function pe(e) {
|
|
936
984
|
let t = e.changedTouches[0];
|
|
937
985
|
if (m === null || g === null || !t) return;
|
|
938
986
|
let n = m - t.clientX, r = g - t.clientY;
|
|
939
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
987
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < lt || se(T.value + Math.sign(n)));
|
|
940
988
|
}
|
|
941
|
-
let { imageLoading:
|
|
989
|
+
let { imageLoading: me, mediaIsTimed: he, videoPreload: ge } = Ze({
|
|
942
990
|
active: () => l.active,
|
|
943
991
|
fetchPriority: () => l.fetchPriority,
|
|
944
992
|
layout: () => l.layout,
|
|
945
|
-
mediaSource: () =>
|
|
946
|
-
mediaType: () =>
|
|
947
|
-
videoElement:
|
|
948
|
-
}),
|
|
949
|
-
function
|
|
950
|
-
l.layout === "reel" && (e.stopPropagation(),
|
|
993
|
+
mediaSource: () => M.value,
|
|
994
|
+
mediaType: () => L.value,
|
|
995
|
+
videoElement: q
|
|
996
|
+
}), _e = r(() => l.layout === "reel" && l.stationaryReelControls === !0), ve = r(() => he.value && B.value === "ready" && (!_e.value || !!(l.active && l.reelControlsTarget))), ye = r(() => `${l.item.postId}:${T.value}:${M.value}`);
|
|
997
|
+
function be(e) {
|
|
998
|
+
l.layout === "reel" && (e.stopPropagation(), xe());
|
|
951
999
|
}
|
|
952
|
-
async function
|
|
953
|
-
if (!(!
|
|
954
|
-
if (
|
|
955
|
-
|
|
1000
|
+
async function xe() {
|
|
1001
|
+
if (!(!q.value || !Z.value)) {
|
|
1002
|
+
if (Y.value) {
|
|
1003
|
+
q.value.pause();
|
|
956
1004
|
return;
|
|
957
1005
|
}
|
|
958
1006
|
try {
|
|
959
|
-
await
|
|
1007
|
+
await q.value.play();
|
|
960
1008
|
} catch {
|
|
961
|
-
|
|
1009
|
+
Y.value = !1;
|
|
962
1010
|
}
|
|
963
1011
|
}
|
|
964
1012
|
}
|
|
965
|
-
function
|
|
1013
|
+
function Se(e) {
|
|
966
1014
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
967
1015
|
}
|
|
1016
|
+
function Ce(e) {
|
|
1017
|
+
let t = e?.currentTarget ?? q.value;
|
|
1018
|
+
t && (te.value = Se(t.currentTime), J.value = Se(t.duration), Z.value && (ne.value = t.muted), re.value = t.volume, t.volume > 0 && (ie = t.volume));
|
|
1019
|
+
}
|
|
968
1020
|
function we(e) {
|
|
969
|
-
|
|
970
|
-
t && (ne.value = Ce(t.currentTime), q.value = Ce(t.duration), X.value && (re.value = t.muted), ie.value = t.volume, t.volume > 0 && (ae = t.volume));
|
|
1021
|
+
Ce(e), H(e);
|
|
971
1022
|
}
|
|
972
|
-
function
|
|
973
|
-
|
|
1023
|
+
function De() {
|
|
1024
|
+
Y.value = !1, x("ended", T.value);
|
|
974
1025
|
}
|
|
975
|
-
function Oe() {
|
|
976
|
-
|
|
1026
|
+
function Oe(e) {
|
|
1027
|
+
let t = q.value;
|
|
1028
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(Se(t.duration), Math.max(0, e)), te.value = t.currentTime);
|
|
977
1029
|
}
|
|
978
1030
|
function ke(e) {
|
|
979
|
-
let t =
|
|
980
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(Ce(t.duration), Math.max(0, e)), ne.value = t.currentTime);
|
|
981
|
-
}
|
|
982
|
-
function Ae(e) {
|
|
983
|
-
let t = K.value;
|
|
1031
|
+
let t = q.value;
|
|
984
1032
|
if (!t || !Number.isFinite(e)) return;
|
|
985
1033
|
let n = Math.min(1, Math.max(0, e));
|
|
986
|
-
t.volume = n, t.muted = n === 0, n > 0 && (
|
|
1034
|
+
t.volume = n, t.muted = n === 0, n > 0 && (ie = n), Ce();
|
|
987
1035
|
}
|
|
988
|
-
function
|
|
989
|
-
let e =
|
|
990
|
-
e && (e.muted && e.volume === 0 && (e.volume =
|
|
1036
|
+
function Ae() {
|
|
1037
|
+
let e = q.value;
|
|
1038
|
+
e && (e.muted && e.volume === 0 && (e.volume = ie), e.muted = !e.muted, Ce());
|
|
991
1039
|
}
|
|
992
1040
|
return v(() => {
|
|
993
|
-
|
|
1041
|
+
le();
|
|
994
1042
|
}), (r, i) => (b(), s("article", {
|
|
995
1043
|
"data-post-id": e.item.postId,
|
|
996
|
-
"data-media-index":
|
|
1044
|
+
"data-media-index": T.value,
|
|
997
1045
|
class: h(["media-card", {
|
|
998
1046
|
"media-card--entering": e.entering,
|
|
999
1047
|
"media-card--leaving": e.leaving,
|
|
1000
|
-
"media-card--error": E(
|
|
1048
|
+
"media-card--error": E(B) === "error",
|
|
1001
1049
|
"media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
|
|
1002
1050
|
}]),
|
|
1003
1051
|
style: _(e.itemStyle),
|
|
1004
1052
|
"aria-hidden": e.leaving || void 0,
|
|
1005
|
-
"aria-busy": E(
|
|
1053
|
+
"aria-busy": E(B) === "loading" || E(G),
|
|
1006
1054
|
inert: e.leaving || void 0,
|
|
1007
|
-
role: e.interactive && !e.leaving && !
|
|
1008
|
-
tabindex: e.interactive && !e.leaving && !
|
|
1009
|
-
onClick: i[
|
|
1010
|
-
onKeydown: [i[
|
|
1011
|
-
}, [c("div",
|
|
1012
|
-
e.cardHeader ? (b(), a(
|
|
1055
|
+
role: e.interactive && !e.leaving && !Q.value ? "button" : void 0,
|
|
1056
|
+
tabindex: e.interactive && !e.leaving && !Q.value ? 0 : void 0,
|
|
1057
|
+
onClick: i[14] ||= (t) => S(e.interactive && !Q.value, oe(t)),
|
|
1058
|
+
onKeydown: [i[15] ||= A((t) => S(e.interactive && !Q.value, "keyboard"), ["enter"]), i[16] ||= A(j((t) => S(e.interactive && !Q.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1059
|
+
}, [c("div", et, [
|
|
1060
|
+
e.cardHeader ? (b(), a(Pe, {
|
|
1013
1061
|
key: 0,
|
|
1014
1062
|
index: e.index,
|
|
1015
1063
|
item: e.item,
|
|
1016
1064
|
layout: e.layout,
|
|
1017
1065
|
"loaded-count": e.loadedCount,
|
|
1018
|
-
"media-index":
|
|
1066
|
+
"media-index": T.value,
|
|
1019
1067
|
"media-source": e.mediaSource,
|
|
1020
1068
|
placement: "header",
|
|
1021
1069
|
region: e.cardHeader,
|
|
@@ -1035,96 +1083,98 @@ var Xe = [
|
|
|
1035
1083
|
c("div", {
|
|
1036
1084
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
1037
1085
|
"data-media-direction": y.value,
|
|
1038
|
-
onWheel:
|
|
1039
|
-
onTouchstartPassive:
|
|
1040
|
-
onTouchendPassive:
|
|
1086
|
+
onWheel: de,
|
|
1087
|
+
onTouchstartPassive: fe,
|
|
1088
|
+
onTouchendPassive: pe
|
|
1041
1089
|
}, [
|
|
1042
|
-
u(n, {
|
|
1090
|
+
u(n, {
|
|
1091
|
+
css: !E(G),
|
|
1092
|
+
name: `media-slide-${y.value}`
|
|
1093
|
+
}, {
|
|
1043
1094
|
default: k(() => [(b(), s("div", {
|
|
1044
|
-
key: `${e.item.postId}:${
|
|
1095
|
+
key: `${e.item.postId}:${D.value.src}:${e.mediaSource ?? "preview"}:${E(K)}`,
|
|
1045
1096
|
class: "media-card-frame",
|
|
1046
|
-
"data-media-index":
|
|
1047
|
-
}, [E(
|
|
1097
|
+
"data-media-index": T.value
|
|
1098
|
+
}, [E(B) === "loading" ? (b(), s("div", rt, [...i[17] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(B) === "error" ? (b(), a(Re, {
|
|
1048
1099
|
key: 1,
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
], 8, tt)) : o("", !0), E(ge) ? (b(), s("video", {
|
|
1100
|
+
component: e.mediaCard?.error?.component,
|
|
1101
|
+
label: E(Ne)(M.value),
|
|
1102
|
+
retrying: E(G),
|
|
1103
|
+
status: E(Me)(M.value),
|
|
1104
|
+
onRetry: E(W)
|
|
1105
|
+
}, null, 8, [
|
|
1106
|
+
"component",
|
|
1107
|
+
"label",
|
|
1108
|
+
"retrying",
|
|
1109
|
+
"status",
|
|
1110
|
+
"onRetry"
|
|
1111
|
+
])) : o("", !0), E(he) ? (b(), s("video", {
|
|
1062
1112
|
key: 2,
|
|
1063
1113
|
ref_key: "videoElement",
|
|
1064
|
-
ref:
|
|
1065
|
-
"data-source-generation": E(
|
|
1114
|
+
ref: q,
|
|
1115
|
+
"data-source-generation": E(K),
|
|
1066
1116
|
class: h(["media-preview", {
|
|
1067
|
-
"media-preview--ready": E(
|
|
1117
|
+
"media-preview--ready": E(B) === "ready",
|
|
1068
1118
|
"media-preview--reel-video": e.layout === "reel"
|
|
1069
1119
|
}]),
|
|
1070
|
-
src:
|
|
1071
|
-
width:
|
|
1072
|
-
height:
|
|
1073
|
-
autoplay: E(
|
|
1120
|
+
src: M.value,
|
|
1121
|
+
width: R.value ?? void 0,
|
|
1122
|
+
height: z.value ?? void 0,
|
|
1123
|
+
autoplay: E(Z),
|
|
1074
1124
|
loop: !e.advanceOnMediaEnd,
|
|
1075
|
-
muted: E(
|
|
1125
|
+
muted: E(ae),
|
|
1076
1126
|
playsinline: "",
|
|
1077
|
-
preload: E(
|
|
1078
|
-
onLoadedmetadata:
|
|
1079
|
-
onProgress: i[
|
|
1080
|
-
onLoadeddata: i[
|
|
1081
|
-
onCanplay: i[
|
|
1082
|
-
onDurationchange:
|
|
1083
|
-
onTimeupdate:
|
|
1084
|
-
onVolumechange:
|
|
1085
|
-
onPlaying: i[
|
|
1086
|
-
onPause: i[
|
|
1087
|
-
onEnded:
|
|
1088
|
-
onClick:
|
|
1089
|
-
onError: i[
|
|
1090
|
-
}, null, 42,
|
|
1127
|
+
preload: E(ge),
|
|
1128
|
+
onLoadedmetadata: we,
|
|
1129
|
+
onProgress: i[0] ||= (...e) => E(U) && E(U)(...e),
|
|
1130
|
+
onLoadeddata: i[1] ||= (...e) => E(U) && E(U)(...e),
|
|
1131
|
+
onCanplay: i[2] ||= (...e) => E(U) && E(U)(...e),
|
|
1132
|
+
onDurationchange: Ce,
|
|
1133
|
+
onTimeupdate: Ce,
|
|
1134
|
+
onVolumechange: Ce,
|
|
1135
|
+
onPlaying: i[3] ||= (...e) => E(X) && E(X)(...e),
|
|
1136
|
+
onPause: i[4] ||= (e) => Y.value = !1,
|
|
1137
|
+
onEnded: De,
|
|
1138
|
+
onClick: be,
|
|
1139
|
+
onError: i[5] ||= (...e) => E(V) && E(V)(...e)
|
|
1140
|
+
}, null, 42, it)) : (b(), s("img", {
|
|
1091
1141
|
key: 3,
|
|
1092
1142
|
ref_key: "imageElement",
|
|
1093
1143
|
ref: ee,
|
|
1094
|
-
"data-source-generation": E(
|
|
1095
|
-
class: h(["media-preview", { "media-preview--ready": E(
|
|
1096
|
-
src:
|
|
1097
|
-
width:
|
|
1098
|
-
height:
|
|
1144
|
+
"data-source-generation": E(K),
|
|
1145
|
+
class: h(["media-preview", { "media-preview--ready": E(B) === "ready" }]),
|
|
1146
|
+
src: M.value,
|
|
1147
|
+
width: R.value ?? void 0,
|
|
1148
|
+
height: z.value ?? void 0,
|
|
1099
1149
|
fetchpriority: e.fetchPriority,
|
|
1100
1150
|
alt: "",
|
|
1101
1151
|
decoding: "async",
|
|
1102
|
-
loading: E(
|
|
1103
|
-
onLoad: i[
|
|
1104
|
-
onError: i[
|
|
1105
|
-
}, null, 42,
|
|
1152
|
+
loading: E(me),
|
|
1153
|
+
onLoad: i[6] ||= (...e) => E(H) && E(H)(...e),
|
|
1154
|
+
onError: i[7] ||= (...e) => E(V) && E(V)(...e)
|
|
1155
|
+
}, null, 42, at))], 8, nt))]),
|
|
1106
1156
|
_: 1
|
|
1107
|
-
}, 8, ["name"]),
|
|
1157
|
+
}, 8, ["css", "name"]),
|
|
1108
1158
|
(b(), a(t, {
|
|
1109
|
-
disabled: !
|
|
1159
|
+
disabled: !_e.value || !e.reelControlsTarget,
|
|
1110
1160
|
to: e.reelControlsTarget ?? "body"
|
|
1111
1161
|
}, [u(n, {
|
|
1112
1162
|
name: "vibe-reel-media-controls",
|
|
1113
|
-
css:
|
|
1163
|
+
css: _e.value
|
|
1114
1164
|
}, {
|
|
1115
|
-
default: k(() => [
|
|
1116
|
-
key:
|
|
1117
|
-
"current-time":
|
|
1118
|
-
"data-control-post-id":
|
|
1119
|
-
duration:
|
|
1165
|
+
default: k(() => [ve.value ? (b(), a(Ke, {
|
|
1166
|
+
key: ye.value,
|
|
1167
|
+
"current-time": te.value,
|
|
1168
|
+
"data-control-post-id": _e.value ? e.item.postId : void 0,
|
|
1169
|
+
duration: J.value,
|
|
1120
1170
|
layout: e.layout,
|
|
1121
|
-
muted:
|
|
1122
|
-
playing:
|
|
1123
|
-
volume:
|
|
1124
|
-
onSeek:
|
|
1125
|
-
onToggleMute:
|
|
1126
|
-
onTogglePlayback:
|
|
1127
|
-
onVolumeChange:
|
|
1171
|
+
muted: ne.value,
|
|
1172
|
+
playing: Y.value,
|
|
1173
|
+
volume: re.value,
|
|
1174
|
+
onSeek: Oe,
|
|
1175
|
+
onToggleMute: Ae,
|
|
1176
|
+
onTogglePlayback: xe,
|
|
1177
|
+
onVolumeChange: ke
|
|
1128
1178
|
}, null, 8, [
|
|
1129
1179
|
"current-time",
|
|
1130
1180
|
"data-control-post-id",
|
|
@@ -1144,31 +1194,31 @@ var Xe = [
|
|
|
1144
1194
|
type: "button",
|
|
1145
1195
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1146
1196
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1147
|
-
onClick: i[
|
|
1148
|
-
onKeydown: i[
|
|
1149
|
-
}, [u(E(
|
|
1197
|
+
onClick: i[8] ||= j((e) => se(T.value - 1, e), ["stop"]),
|
|
1198
|
+
onKeydown: i[9] ||= j(() => {}, ["stop"])
|
|
1199
|
+
}, [u(E(Te), { size: 20 })], 40, ot), c("button", {
|
|
1150
1200
|
type: "button",
|
|
1151
1201
|
class: "media-carousel-control media-carousel-control--next",
|
|
1152
1202
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1153
|
-
onClick: i[
|
|
1154
|
-
onKeydown: i[
|
|
1155
|
-
}, [u(E(
|
|
1156
|
-
|
|
1203
|
+
onClick: i[10] ||= j((e) => se(T.value + 1, e), ["stop"]),
|
|
1204
|
+
onKeydown: i[11] ||= j(() => {}, ["stop"])
|
|
1205
|
+
}, [u(E(Ee), { size: 20 })], 40, st)], 2)) : o("", !0),
|
|
1206
|
+
Q.value ? (b(), s("button", {
|
|
1157
1207
|
key: 1,
|
|
1158
1208
|
class: "media-card-activator",
|
|
1159
1209
|
type: "button",
|
|
1160
1210
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1161
|
-
onClick: i[
|
|
1162
|
-
onKeydown: i[
|
|
1163
|
-
}, null, 40,
|
|
1164
|
-
], 42,
|
|
1165
|
-
e.cardFooter ? (b(), a(
|
|
1211
|
+
onClick: i[12] ||= j((e) => r.$emit("activate", oe(e)), ["stop"]),
|
|
1212
|
+
onKeydown: i[13] ||= j(() => {}, ["stop"])
|
|
1213
|
+
}, null, 40, ct)) : o("", !0)
|
|
1214
|
+
], 42, tt),
|
|
1215
|
+
e.cardFooter ? (b(), a(Pe, {
|
|
1166
1216
|
key: 1,
|
|
1167
1217
|
index: e.index,
|
|
1168
1218
|
item: e.item,
|
|
1169
1219
|
layout: e.layout,
|
|
1170
1220
|
"loaded-count": e.loadedCount,
|
|
1171
|
-
"media-index":
|
|
1221
|
+
"media-index": T.value,
|
|
1172
1222
|
"media-source": e.mediaSource,
|
|
1173
1223
|
placement: "footer",
|
|
1174
1224
|
region: e.cardFooter,
|
|
@@ -1185,12 +1235,12 @@ var Xe = [
|
|
|
1185
1235
|
"style",
|
|
1186
1236
|
"total"
|
|
1187
1237
|
])) : o("", !0)
|
|
1188
|
-
])], 46,
|
|
1238
|
+
])], 46, $e));
|
|
1189
1239
|
}
|
|
1190
|
-
}),
|
|
1240
|
+
}), pt = { class: "masonry-feed-shell" }, mt = ["aria-hidden", "inert"], ht = {
|
|
1191
1241
|
key: 0,
|
|
1192
1242
|
class: "masonry-feed-status-overlay"
|
|
1193
|
-
},
|
|
1243
|
+
}, gt = 6, _t = 12, vt = 250, yt = /* @__PURE__ */ d({
|
|
1194
1244
|
__name: "MasonryFeed",
|
|
1195
1245
|
props: {
|
|
1196
1246
|
enteringPostIds: {},
|
|
@@ -1226,19 +1276,19 @@ var Xe = [
|
|
|
1226
1276
|
"visible"
|
|
1227
1277
|
],
|
|
1228
1278
|
setup(t, { expose: n, emit: i }) {
|
|
1229
|
-
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(
|
|
1279
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(gt), 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(() => ie(d.items, y.value, {
|
|
1230
1280
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1231
1281
|
gap: x.value,
|
|
1232
|
-
minColumnWidth:
|
|
1282
|
+
minColumnWidth: Q(d.masonry)
|
|
1233
1283
|
})), z = r(() => {
|
|
1234
1284
|
if (d.leavingPostIds.size === 0) return null;
|
|
1235
1285
|
let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
|
|
1236
1286
|
index: t,
|
|
1237
1287
|
item: e
|
|
1238
|
-
}]), t =
|
|
1288
|
+
}]), t = ie(e.map(({ item: e }) => e), y.value, {
|
|
1239
1289
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1240
1290
|
gap: x.value,
|
|
1241
|
-
minColumnWidth:
|
|
1291
|
+
minColumnWidth: Q(d.masonry)
|
|
1242
1292
|
});
|
|
1243
1293
|
return {
|
|
1244
1294
|
indices: e.map(({ index: e }) => e),
|
|
@@ -1251,50 +1301,50 @@ var Xe = [
|
|
|
1251
1301
|
...t.layout,
|
|
1252
1302
|
items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
|
|
1253
1303
|
} : e;
|
|
1254
|
-
}), V = r(() =>
|
|
1304
|
+
}), V = r(() => ae(R.value.items)), ee = r(() => {
|
|
1255
1305
|
let e = z.value;
|
|
1256
|
-
return e ?
|
|
1257
|
-
}),
|
|
1306
|
+
return e ? ae(e.layout.items, e.indices) : null;
|
|
1307
|
+
}), H = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), U = r(() => ({ height: `${H.value}px` })), W = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), K = r(() => new Set(A.value)), q = r(() => j.value.flatMap((e) => {
|
|
1258
1308
|
let t = d.items[e];
|
|
1259
1309
|
return t ? [{
|
|
1260
|
-
fetchPriority:
|
|
1310
|
+
fetchPriority: K.value.has(e) ? "high" : "low",
|
|
1261
1311
|
index: e,
|
|
1262
1312
|
item: t
|
|
1263
1313
|
}] : [];
|
|
1264
1314
|
}));
|
|
1265
|
-
function
|
|
1315
|
+
function te(e, t) {
|
|
1266
1316
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1267
1317
|
}
|
|
1268
|
-
function
|
|
1318
|
+
function ne(e, t) {
|
|
1269
1319
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1270
1320
|
}
|
|
1271
|
-
function
|
|
1321
|
+
function Y(e) {
|
|
1272
1322
|
let t = {
|
|
1273
1323
|
scrollTop: M - k.value,
|
|
1274
1324
|
viewportHeight: C.value
|
|
1275
|
-
}, n =
|
|
1325
|
+
}, n = ee.value, r = Z(n ?? V.value, {
|
|
1276
1326
|
...t,
|
|
1277
1327
|
overscan: e
|
|
1278
1328
|
}).indices;
|
|
1279
|
-
return
|
|
1329
|
+
return te(r, d.leavingPostIds.size === 0 ? [] : Z(V.value, {
|
|
1280
1330
|
...t,
|
|
1281
1331
|
overscan: e
|
|
1282
1332
|
}).indices);
|
|
1283
1333
|
}
|
|
1284
|
-
function
|
|
1285
|
-
let e =
|
|
1286
|
-
|
|
1334
|
+
function X() {
|
|
1335
|
+
let e = Y(0), t = Y(oe(d.masonry, C.value));
|
|
1336
|
+
ne(A.value, e) || (A.value = e), ne(j.value, t) || (j.value = t);
|
|
1287
1337
|
}
|
|
1288
|
-
function
|
|
1338
|
+
function se() {
|
|
1289
1339
|
if (I !== null) return;
|
|
1290
1340
|
I = -1;
|
|
1291
1341
|
let e = requestAnimationFrame(() => {
|
|
1292
|
-
I = null,
|
|
1342
|
+
I = null, X();
|
|
1293
1343
|
});
|
|
1294
1344
|
I !== null && (I = e);
|
|
1295
1345
|
}
|
|
1296
|
-
let
|
|
1297
|
-
O(() => [...
|
|
1346
|
+
let ce = /* @__PURE__ */ new Set();
|
|
1347
|
+
O(() => [...K.value].flatMap((e) => {
|
|
1298
1348
|
let t = d.items[e];
|
|
1299
1349
|
if (!t) return [];
|
|
1300
1350
|
let n = d.mediaIndices.get(t.postId) ?? 0, r = L(t.postId, n);
|
|
@@ -1306,16 +1356,16 @@ var Xe = [
|
|
|
1306
1356
|
}), (e) => {
|
|
1307
1357
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1308
1358
|
e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
|
|
1309
|
-
|
|
1310
|
-
}),
|
|
1359
|
+
ce.has(e) || f("visible", n, t);
|
|
1360
|
+
}), ce = t;
|
|
1311
1361
|
}, {
|
|
1312
1362
|
immediate: !0,
|
|
1313
1363
|
flush: "post"
|
|
1314
1364
|
});
|
|
1315
|
-
function
|
|
1365
|
+
function le(e) {
|
|
1316
1366
|
let t = B.value.items[e], n = d.items[e]?.postId;
|
|
1317
1367
|
if (!t) return {};
|
|
1318
|
-
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ?
|
|
1368
|
+
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? re({
|
|
1319
1369
|
containerHeight: Math.max(T.value, R.value.height),
|
|
1320
1370
|
gap: x.value
|
|
1321
1371
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
@@ -1326,53 +1376,52 @@ var Xe = [
|
|
|
1326
1376
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1327
1377
|
};
|
|
1328
1378
|
}
|
|
1329
|
-
function
|
|
1379
|
+
function ue() {
|
|
1330
1380
|
let e = p.value;
|
|
1331
1381
|
if (!e) return;
|
|
1332
1382
|
M = e.scrollTop, C.value = e.clientHeight;
|
|
1333
1383
|
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
1334
1384
|
T.value = Math.max(0, e.clientHeight - n);
|
|
1335
1385
|
let r = g.value;
|
|
1336
|
-
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop,
|
|
1386
|
+
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, X());
|
|
1337
1387
|
}
|
|
1338
|
-
function
|
|
1388
|
+
function de(e) {
|
|
1339
1389
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1340
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
1390
|
+
y.value = e.clientWidth, x.value = Math.min(_t, Math.max(gt, t * .0075)), ue();
|
|
1341
1391
|
}
|
|
1342
|
-
function
|
|
1392
|
+
function fe(e) {
|
|
1343
1393
|
let t = e.currentTarget;
|
|
1344
|
-
t && (M = t.scrollTop,
|
|
1394
|
+
t && (M = t.scrollTop, se(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && J(t) && f("loadMore"));
|
|
1345
1395
|
}
|
|
1346
|
-
function
|
|
1396
|
+
function pe() {
|
|
1347
1397
|
let e = p.value;
|
|
1348
|
-
Date.now() >= l && !d.loadMoreLocked && e &&
|
|
1398
|
+
Date.now() >= l && !d.loadMoreLocked && e && J(e) && f("loadMore");
|
|
1349
1399
|
}
|
|
1350
1400
|
O(() => d.items.length, (e, t) => {
|
|
1351
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1401
|
+
e > 0 && e < t && (l = Date.now() + vt);
|
|
1352
1402
|
});
|
|
1353
|
-
function
|
|
1403
|
+
function me() {
|
|
1354
1404
|
return p.value;
|
|
1355
1405
|
}
|
|
1356
1406
|
return O(g, (e) => {
|
|
1357
|
-
N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (
|
|
1407
|
+
N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (de(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
|
|
1358
1408
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1359
1409
|
Math.abs(n - y.value) < .5 || (F = requestAnimationFrame(() => {
|
|
1360
|
-
F = null,
|
|
1410
|
+
F = null, de(e);
|
|
1361
1411
|
}));
|
|
1362
1412
|
}), N.observe(e)));
|
|
1363
1413
|
}), O(p, (e) => {
|
|
1364
|
-
P?.disconnect(), P = null, e && (
|
|
1414
|
+
P?.disconnect(), P = null, e && (ue(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(ue), P.observe(e)));
|
|
1365
1415
|
}), O([
|
|
1366
1416
|
R,
|
|
1367
1417
|
B,
|
|
1368
|
-
() => d.suspended,
|
|
1369
1418
|
() => d.masonry
|
|
1370
|
-
],
|
|
1419
|
+
], X, { flush: "post" }), v(() => {
|
|
1371
1420
|
N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
|
|
1372
1421
|
}), n({
|
|
1373
|
-
getScrollElement:
|
|
1374
|
-
loadIfNearBottom:
|
|
1375
|
-
}), (n, r) => (b(), s("div",
|
|
1422
|
+
getScrollElement: me,
|
|
1423
|
+
loadIfNearBottom: pe
|
|
1424
|
+
}), (n, r) => (b(), s("div", pt, [
|
|
1376
1425
|
c("main", {
|
|
1377
1426
|
id: m,
|
|
1378
1427
|
ref_key: "galleryElement",
|
|
@@ -1381,14 +1430,14 @@ var Xe = [
|
|
|
1381
1430
|
"data-layout-mode": "masonry",
|
|
1382
1431
|
"aria-hidden": t.suspended || void 0,
|
|
1383
1432
|
inert: t.suspended || void 0,
|
|
1384
|
-
onScrollPassive:
|
|
1433
|
+
onScrollPassive: fe
|
|
1385
1434
|
}, [c("section", {
|
|
1386
1435
|
ref_key: "masonryElement",
|
|
1387
1436
|
ref: g,
|
|
1388
1437
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
1389
1438
|
style: _(U.value),
|
|
1390
1439
|
"aria-label": "Media gallery"
|
|
1391
|
-
}, [(b(!0), s(e, null, S(
|
|
1440
|
+
}, [(b(!0), s(e, null, S(q.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(ft, {
|
|
1392
1441
|
key: n.postId,
|
|
1393
1442
|
class: "masonry-item",
|
|
1394
1443
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1399,7 +1448,7 @@ var Xe = [
|
|
|
1399
1448
|
"media-card": t.mediaCard,
|
|
1400
1449
|
index: r,
|
|
1401
1450
|
item: n,
|
|
1402
|
-
"item-style":
|
|
1451
|
+
"item-style": le(r),
|
|
1403
1452
|
interactive: "",
|
|
1404
1453
|
layout: "masonry",
|
|
1405
1454
|
"loaded-count": t.items.length,
|
|
@@ -1428,8 +1477,8 @@ var Xe = [
|
|
|
1428
1477
|
"onMediaChange",
|
|
1429
1478
|
"onReady",
|
|
1430
1479
|
"onError"
|
|
1431
|
-
]))), 128))], 6)], 42,
|
|
1432
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div",
|
|
1480
|
+
]))), 128))], 6)], 42, mt),
|
|
1481
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", ht, [u(G, {
|
|
1433
1482
|
actions: t.feedFooterActions,
|
|
1434
1483
|
"can-retry-end": t.canRetryEnd,
|
|
1435
1484
|
"feed-footer": t.feedFooter,
|
|
@@ -1452,7 +1501,7 @@ var Xe = [
|
|
|
1452
1501
|
"show-load-more",
|
|
1453
1502
|
"state"
|
|
1454
1503
|
])])) : o("", !0),
|
|
1455
|
-
u(
|
|
1504
|
+
u(he, {
|
|
1456
1505
|
"content-size": B.value.height,
|
|
1457
1506
|
"controls-id": m,
|
|
1458
1507
|
"scroll-element": p.value,
|
|
@@ -1464,8 +1513,8 @@ var Xe = [
|
|
|
1464
1513
|
])
|
|
1465
1514
|
]));
|
|
1466
1515
|
}
|
|
1467
|
-
}),
|
|
1468
|
-
function
|
|
1516
|
+
}), bt = 300;
|
|
1517
|
+
function xt(e, t, n) {
|
|
1469
1518
|
let r = e.scrollTop;
|
|
1470
1519
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1471
1520
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1473,7 +1522,7 @@ function bt(e, t, n) {
|
|
|
1473
1522
|
return new Promise((n) => {
|
|
1474
1523
|
let o = (s) => {
|
|
1475
1524
|
a += 1;
|
|
1476
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1525
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / bt), u = 1 - (1 - l) ** 3;
|
|
1477
1526
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1478
1527
|
requestAnimationFrame(o);
|
|
1479
1528
|
return;
|
|
@@ -1485,7 +1534,7 @@ function bt(e, t, n) {
|
|
|
1485
1534
|
}
|
|
1486
1535
|
//#endregion
|
|
1487
1536
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1488
|
-
var
|
|
1537
|
+
var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
1489
1538
|
__name: "ReelAutoAdvanceProgress",
|
|
1490
1539
|
props: {
|
|
1491
1540
|
durationMs: {},
|
|
@@ -1503,9 +1552,9 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1503
1552
|
class: "reel-auto-advance-progress",
|
|
1504
1553
|
style: _(a.value),
|
|
1505
1554
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1506
|
-
}, null, 36)], 8,
|
|
1555
|
+
}, null, 36)], 8, St));
|
|
1507
1556
|
}
|
|
1508
|
-
}),
|
|
1557
|
+
}), wt = { class: "reel-viewport" }, Tt = ["data-active-post-id", "data-active-media-index"], Et = ["role", "data-status"], Dt = 2, Ot = 300, kt = 250, At = /* @__PURE__ */ d({
|
|
1509
1558
|
__name: "ReelFeed",
|
|
1510
1559
|
props: {
|
|
1511
1560
|
initialPostId: {},
|
|
@@ -1543,7 +1592,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1543
1592
|
],
|
|
1544
1593
|
setup(t, { expose: n, emit: i }) {
|
|
1545
1594
|
let l = 0, u = t, d = i, f = w(null), p = w(null), g = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), x = w(Math.max(0, g)), C = w(!1), D = w(!1), k = 0, A = null, j = null, M = null, F = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), R = r(() => {
|
|
1546
|
-
let e = Math.max(0, x.value -
|
|
1595
|
+
let e = Math.max(0, x.value - Dt), t = Math.min(u.items.length - 1, x.value + Dt);
|
|
1547
1596
|
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
1548
1597
|
fetchPriority: e + n === x.value ? "high" : "low",
|
|
1549
1598
|
index: e + n,
|
|
@@ -1552,10 +1601,10 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1552
1601
|
}), z = r(() => u.items[x.value]?.postId), B = r(() => u.items[x.value]), V = r(() => {
|
|
1553
1602
|
let e = z.value;
|
|
1554
1603
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
1555
|
-
}),
|
|
1604
|
+
}), ee = r(() => {
|
|
1556
1605
|
let e = z.value;
|
|
1557
1606
|
return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
|
|
1558
|
-
}),
|
|
1607
|
+
}), H = r(() => B.value ? I(B.value, V.value) : null), U = r(() => H.value ? N(H.value, u.mediaSource ?? "preview") : null), W = r(() => ee.value === "ready" && !!(U.value && Xe(U.value.type, U.value.src))), K = r(() => [
|
|
1559
1608
|
z.value,
|
|
1560
1609
|
V.value,
|
|
1561
1610
|
u.items.length,
|
|
@@ -1563,52 +1612,52 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1563
1612
|
u.reelAutoAdvance.enabled,
|
|
1564
1613
|
u.reelAutoAdvance.includePostItems,
|
|
1565
1614
|
u.reelAutoAdvance.intervalMs
|
|
1566
|
-
].join(":")),
|
|
1615
|
+
].join(":")), q = r(() => {
|
|
1567
1616
|
let e = B.value, t = !!(e && u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
1568
1617
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1569
|
-
}),
|
|
1570
|
-
function
|
|
1618
|
+
}), te = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && B.value !== void 0 && ee.value !== "loading" && !W.value), ne = r(() => !u.infiniteScroll || u.items.length <= 1), Y = 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.");
|
|
1619
|
+
function re(e) {
|
|
1571
1620
|
return { gridRow: `${e + 1}` };
|
|
1572
1621
|
}
|
|
1573
|
-
function
|
|
1622
|
+
function ie(e) {
|
|
1574
1623
|
let t = k || e.clientHeight;
|
|
1575
1624
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1576
1625
|
}
|
|
1577
|
-
function
|
|
1626
|
+
function ae(e) {
|
|
1578
1627
|
let t = e.currentTarget;
|
|
1579
1628
|
if (!t) return;
|
|
1580
1629
|
let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
1581
|
-
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value =
|
|
1630
|
+
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ie(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && J(t) && d("loadMore");
|
|
1582
1631
|
}
|
|
1583
|
-
function
|
|
1632
|
+
function X() {
|
|
1584
1633
|
let e = f.value;
|
|
1585
|
-
e && (C.value = !1,
|
|
1634
|
+
e && (C.value = !1, oe(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
1586
1635
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
1587
|
-
}),
|
|
1636
|
+
}), Z());
|
|
1588
1637
|
}
|
|
1589
|
-
function
|
|
1638
|
+
function Z() {
|
|
1590
1639
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
1591
1640
|
M = null;
|
|
1592
1641
|
let e = f.value;
|
|
1593
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1642
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), oe(!1);
|
|
1594
1643
|
}, 120);
|
|
1595
1644
|
}
|
|
1596
|
-
function
|
|
1597
|
-
|
|
1645
|
+
function Q() {
|
|
1646
|
+
oe(!0);
|
|
1598
1647
|
let e = f.value;
|
|
1599
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1648
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), Z();
|
|
1600
1649
|
}
|
|
1601
|
-
function
|
|
1650
|
+
function oe(e) {
|
|
1602
1651
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
1603
1652
|
}
|
|
1604
|
-
function
|
|
1653
|
+
function se() {
|
|
1605
1654
|
let e = f.value;
|
|
1606
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
1655
|
+
Date.now() >= l && !u.loadMoreLocked && e && J(e) && d("loadMore");
|
|
1607
1656
|
}
|
|
1608
1657
|
O(() => u.items.length, (e, t) => {
|
|
1609
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1658
|
+
e > 0 && e < t && (l = Date.now() + kt);
|
|
1610
1659
|
});
|
|
1611
|
-
function
|
|
1660
|
+
function ce(e) {
|
|
1612
1661
|
let t = B.value;
|
|
1613
1662
|
if (!t) return !1;
|
|
1614
1663
|
let n = P(t).length;
|
|
@@ -1616,34 +1665,34 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1616
1665
|
let r = (V.value + e + n) % n;
|
|
1617
1666
|
return d("mediaChange", t.postId, r), !0;
|
|
1618
1667
|
}
|
|
1619
|
-
function
|
|
1668
|
+
function le(e) {
|
|
1620
1669
|
let t = x.value + e;
|
|
1621
|
-
return !f.value || t < 0 || t >= u.items.length ? !1 : (
|
|
1670
|
+
return !f.value || t < 0 || t >= u.items.length ? !1 : (pe(t), !0);
|
|
1622
1671
|
}
|
|
1623
|
-
function
|
|
1672
|
+
function ue(e, t) {
|
|
1624
1673
|
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
1625
|
-
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value &&
|
|
1674
|
+
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && pe(n), !0);
|
|
1626
1675
|
}
|
|
1627
|
-
function
|
|
1676
|
+
function de() {
|
|
1628
1677
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1629
1678
|
}
|
|
1630
|
-
function
|
|
1679
|
+
function fe(e) {
|
|
1631
1680
|
let t = f.value;
|
|
1632
1681
|
if (!t) return Promise.resolve();
|
|
1633
1682
|
let n = e * (k || t.clientHeight);
|
|
1634
|
-
return x.value = e,
|
|
1683
|
+
return x.value = e, xt(t, n, de());
|
|
1635
1684
|
}
|
|
1636
|
-
function
|
|
1637
|
-
|
|
1685
|
+
function pe(e) {
|
|
1686
|
+
fe(e);
|
|
1638
1687
|
}
|
|
1639
|
-
async function
|
|
1688
|
+
async function me(e) {
|
|
1640
1689
|
let t = u.items.findIndex((t) => t.postId === e);
|
|
1641
|
-
return t < 0 || t === x.value ? !1 : (await
|
|
1690
|
+
return t < 0 || t === x.value ? !1 : (await fe(t), !0);
|
|
1642
1691
|
}
|
|
1643
|
-
async function
|
|
1644
|
-
return
|
|
1692
|
+
async function he(e) {
|
|
1693
|
+
return ce(e) ? (de() || await new Promise((e) => setTimeout(e, Ot)), !0) : !1;
|
|
1645
1694
|
}
|
|
1646
|
-
function
|
|
1695
|
+
function ge() {
|
|
1647
1696
|
if (!u.reelAutoAdvance.enabled) return;
|
|
1648
1697
|
let e = B.value;
|
|
1649
1698
|
if (!e) return;
|
|
@@ -1656,31 +1705,31 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1656
1705
|
u.hasNext && !u.loadMoreLocked && d("loadMore");
|
|
1657
1706
|
return;
|
|
1658
1707
|
}
|
|
1659
|
-
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0),
|
|
1708
|
+
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), pe(t);
|
|
1660
1709
|
}
|
|
1661
|
-
function
|
|
1662
|
-
!u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !W.value ||
|
|
1710
|
+
function _e(e, t) {
|
|
1711
|
+
!u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !W.value || ge();
|
|
1663
1712
|
}
|
|
1664
1713
|
return O(f, (e) => {
|
|
1665
|
-
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(
|
|
1714
|
+
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(X), A.observe(e)));
|
|
1666
1715
|
}), O(() => u.items.length, async (e) => {
|
|
1667
1716
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
1668
|
-
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(),
|
|
1717
|
+
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), X();
|
|
1669
1718
|
}), O(z, (e) => {
|
|
1670
1719
|
e !== void 0 && d("activeChange", e);
|
|
1671
1720
|
}, { immediate: !0 }), y(() => {
|
|
1672
|
-
window.addEventListener("resize",
|
|
1721
|
+
window.addEventListener("resize", Q), window.addEventListener("orientationchange", Q), g >= 0 && m(X);
|
|
1673
1722
|
}), v(() => {
|
|
1674
|
-
window.removeEventListener("resize",
|
|
1723
|
+
window.removeEventListener("resize", Q), window.removeEventListener("orientationchange", Q), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
1675
1724
|
}), n({
|
|
1676
1725
|
activeIndex: x,
|
|
1677
1726
|
activePostId: z,
|
|
1678
|
-
changeActiveMedia:
|
|
1679
|
-
loadIfNearBottom:
|
|
1680
|
-
moveActivePost:
|
|
1681
|
-
navigateToItem:
|
|
1682
|
-
transitionActiveMedia:
|
|
1683
|
-
transitionActivePost:
|
|
1727
|
+
changeActiveMedia: ce,
|
|
1728
|
+
loadIfNearBottom: se,
|
|
1729
|
+
moveActivePost: le,
|
|
1730
|
+
navigateToItem: ue,
|
|
1731
|
+
transitionActiveMedia: he,
|
|
1732
|
+
transitionActivePost: me
|
|
1684
1733
|
}), (n, r) => (b(), s("main", {
|
|
1685
1734
|
class: h(["reel-shell", {
|
|
1686
1735
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1688,7 +1737,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1688
1737
|
}]),
|
|
1689
1738
|
"data-layout-mode": "reel"
|
|
1690
1739
|
}, [
|
|
1691
|
-
t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1740
|
+
t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
|
|
1692
1741
|
key: 0,
|
|
1693
1742
|
index: x.value,
|
|
1694
1743
|
item: B.value,
|
|
@@ -1710,19 +1759,19 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1710
1759
|
"style",
|
|
1711
1760
|
"total"
|
|
1712
1761
|
])) : o("", !0),
|
|
1713
|
-
c("div",
|
|
1762
|
+
c("div", wt, [c("div", {
|
|
1714
1763
|
ref_key: "galleryElement",
|
|
1715
1764
|
ref: f,
|
|
1716
1765
|
class: "gallery-shell reel-feed",
|
|
1717
1766
|
"data-active-post-id": z.value,
|
|
1718
1767
|
"data-active-media-index": V.value,
|
|
1719
|
-
onScrollPassive:
|
|
1768
|
+
onScrollPassive: ae
|
|
1720
1769
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1721
1770
|
key: 1,
|
|
1722
1771
|
class: "reel-track",
|
|
1723
1772
|
style: _(F.value),
|
|
1724
1773
|
"aria-label": "Media gallery"
|
|
1725
|
-
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1774
|
+
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(ft, {
|
|
1726
1775
|
key: n.postId,
|
|
1727
1776
|
active: r === x.value && !C.value,
|
|
1728
1777
|
"advance-on-media-end": u.reelAutoAdvance.enabled && r === x.value,
|
|
@@ -1731,7 +1780,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1731
1780
|
"fetch-priority": e,
|
|
1732
1781
|
index: r,
|
|
1733
1782
|
item: n,
|
|
1734
|
-
"item-style":
|
|
1783
|
+
"item-style": re(r),
|
|
1735
1784
|
"media-card": t.mediaCard,
|
|
1736
1785
|
layout: "reel",
|
|
1737
1786
|
"loaded-count": t.items.length,
|
|
@@ -1742,7 +1791,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1742
1791
|
"stationary-reel-controls": "",
|
|
1743
1792
|
total: t.total,
|
|
1744
1793
|
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
1745
|
-
onEnded: (e) =>
|
|
1794
|
+
onEnded: (e) => _e(n.postId, e),
|
|
1746
1795
|
onReady: (e) => d("ready", n.postId, e),
|
|
1747
1796
|
onError: (e) => d("error", n.postId, e)
|
|
1748
1797
|
}, null, 8, [
|
|
@@ -1768,12 +1817,12 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1768
1817
|
class: "reel-forward-status",
|
|
1769
1818
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1770
1819
|
"data-status": t.reelForward.status
|
|
1771
|
-
}, [c("p", null, T(
|
|
1820
|
+
}, [c("p", null, T(Y.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1772
1821
|
key: 0,
|
|
1773
1822
|
class: "reel-forward-retry",
|
|
1774
1823
|
type: "button",
|
|
1775
1824
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
1776
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1825
|
+
}, " Retry ")) : o("", !0)], 8, Et)), t.reelForward.status === "idle" ? (b(), a(G, {
|
|
1777
1826
|
key: 2,
|
|
1778
1827
|
actions: t.feedFooterActions,
|
|
1779
1828
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1782,7 +1831,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1782
1831
|
"has-next": t.hasNext,
|
|
1783
1832
|
"is-loading": t.isLoadingMore,
|
|
1784
1833
|
"load-more-locked": t.loadMoreLocked,
|
|
1785
|
-
"show-load-more":
|
|
1834
|
+
"show-load-more": ne.value,
|
|
1786
1835
|
state: t.state,
|
|
1787
1836
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1788
1837
|
onRetryEnd: r[2] ||= (e) => d("retryEnd")
|
|
@@ -1796,13 +1845,13 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1796
1845
|
"load-more-locked",
|
|
1797
1846
|
"show-load-more",
|
|
1798
1847
|
"state"
|
|
1799
|
-
])) : o("", !0)], 40,
|
|
1848
|
+
])) : o("", !0)], 40, Tt), c("div", {
|
|
1800
1849
|
ref_key: "reelControlsElement",
|
|
1801
1850
|
ref: p,
|
|
1802
1851
|
class: "reel-media-controls-host",
|
|
1803
1852
|
"data-test": "reel-media-controls-host"
|
|
1804
1853
|
}, null, 512)]),
|
|
1805
|
-
t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1854
|
+
t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
|
|
1806
1855
|
key: 1,
|
|
1807
1856
|
index: x.value,
|
|
1808
1857
|
item: B.value,
|
|
@@ -1824,24 +1873,24 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1824
1873
|
"style",
|
|
1825
1874
|
"total"
|
|
1826
1875
|
])) : o("", !0),
|
|
1827
|
-
|
|
1828
|
-
key:
|
|
1876
|
+
te.value ? (b(), a(Ct, {
|
|
1877
|
+
key: K.value,
|
|
1829
1878
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1830
|
-
label:
|
|
1831
|
-
onComplete:
|
|
1879
|
+
label: q.value,
|
|
1880
|
+
onComplete: ge
|
|
1832
1881
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1833
1882
|
], 2));
|
|
1834
1883
|
}
|
|
1835
|
-
}),
|
|
1884
|
+
}), jt = ["data-info-sheet-open", "data-info-sheet-mode"], Mt = ["aria-hidden", "inert"], Nt = {
|
|
1836
1885
|
key: 0,
|
|
1837
1886
|
class: "reel-info-sheet-layer",
|
|
1838
1887
|
"data-test": "reel-info-sheet"
|
|
1839
|
-
},
|
|
1888
|
+
}, Pt = [
|
|
1840
1889
|
"role",
|
|
1841
1890
|
"aria-modal",
|
|
1842
1891
|
"tabindex",
|
|
1843
1892
|
"data-active-post-id"
|
|
1844
|
-
],
|
|
1893
|
+
], Ft = /* @__PURE__ */ d({
|
|
1845
1894
|
__name: "ReelLayout",
|
|
1846
1895
|
props: {
|
|
1847
1896
|
forwardIndex: { default: null },
|
|
@@ -1931,10 +1980,10 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1931
1980
|
function V(e, t) {
|
|
1932
1981
|
d("error", e, t);
|
|
1933
1982
|
}
|
|
1934
|
-
function
|
|
1983
|
+
function ee(e, t) {
|
|
1935
1984
|
d("mediaChange", e, t);
|
|
1936
1985
|
}
|
|
1937
|
-
function
|
|
1986
|
+
function H(e, t) {
|
|
1938
1987
|
d("ready", e, t);
|
|
1939
1988
|
}
|
|
1940
1989
|
return O(() => ({
|
|
@@ -1966,7 +2015,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1966
2015
|
class: "reel-layout-main",
|
|
1967
2016
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1968
2017
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1969
|
-
}, [u(
|
|
2018
|
+
}, [u(At, {
|
|
1970
2019
|
ref_key: "reelFeed",
|
|
1971
2020
|
ref: p,
|
|
1972
2021
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1992,8 +2041,8 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1992
2041
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
1993
2042
|
onError: V,
|
|
1994
2043
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1995
|
-
onMediaChange:
|
|
1996
|
-
onReady:
|
|
2044
|
+
onMediaChange: ee,
|
|
2045
|
+
onReady: H,
|
|
1997
2046
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1998
2047
|
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1999
2048
|
}, null, 8, [
|
|
@@ -2017,8 +2066,8 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
2017
2066
|
"reel-forward",
|
|
2018
2067
|
"state",
|
|
2019
2068
|
"total"
|
|
2020
|
-
])], 8,
|
|
2021
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2069
|
+
])], 8, Mt), u(n, { name: "vibe-info-sheet" }, {
|
|
2070
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Nt, [c("aside", {
|
|
2022
2071
|
ref_key: "sheetElement",
|
|
2023
2072
|
ref: _,
|
|
2024
2073
|
class: "reel-info-sheet",
|
|
@@ -2027,14 +2076,14 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
2027
2076
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2028
2077
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2029
2078
|
"data-active-post-id": T.value?.postId
|
|
2030
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2079
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Pt)])) : o("", !0)]),
|
|
2031
2080
|
_: 1
|
|
2032
|
-
})], 10,
|
|
2081
|
+
})], 10, jt));
|
|
2033
2082
|
}
|
|
2034
2083
|
});
|
|
2035
2084
|
//#endregion
|
|
2036
2085
|
//#region src/core/mediaLifecycle.ts
|
|
2037
|
-
function
|
|
2086
|
+
function It(e, t, n, r, i) {
|
|
2038
2087
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2039
2088
|
if (!o) return null;
|
|
2040
2089
|
let s = F(o, n), c = I(o, s);
|
|
@@ -2050,7 +2099,7 @@ function Ft(e, t, n, r, i) {
|
|
|
2050
2099
|
postIndex: a
|
|
2051
2100
|
};
|
|
2052
2101
|
}
|
|
2053
|
-
function
|
|
2102
|
+
function Lt(e, t) {
|
|
2054
2103
|
O(() => {
|
|
2055
2104
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2056
2105
|
return {
|
|
@@ -2060,20 +2109,20 @@ function It(e, t) {
|
|
|
2060
2109
|
};
|
|
2061
2110
|
}, (n, r) => {
|
|
2062
2111
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2063
|
-
let i =
|
|
2112
|
+
let i = It(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2064
2113
|
i && t(i);
|
|
2065
2114
|
}, { flush: "sync" });
|
|
2066
2115
|
}
|
|
2067
2116
|
//#endregion
|
|
2068
2117
|
//#region src/components/useMediaLifecycle.ts
|
|
2069
|
-
function
|
|
2118
|
+
function Rt(e, t) {
|
|
2070
2119
|
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);
|
|
2071
2120
|
function c(e, t, n, r) {
|
|
2072
2121
|
let i = L(t, n);
|
|
2073
2122
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2074
2123
|
}
|
|
2075
2124
|
function l(t, n, r, i) {
|
|
2076
|
-
return
|
|
2125
|
+
return It(e, t, n, r, i);
|
|
2077
2126
|
}
|
|
2078
2127
|
function u(e, n, r, i) {
|
|
2079
2128
|
let a = l(e, n, r, i);
|
|
@@ -2095,7 +2144,7 @@ function Lt(e, t) {
|
|
|
2095
2144
|
let r = l(e, n, "masonry", null);
|
|
2096
2145
|
r && t.visible(r);
|
|
2097
2146
|
}
|
|
2098
|
-
return
|
|
2147
|
+
return Lt(e, t.reelChange), O(() => {
|
|
2099
2148
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2100
2149
|
return {
|
|
2101
2150
|
mediaIndex: n,
|
|
@@ -2120,16 +2169,16 @@ function Lt(e, t) {
|
|
|
2120
2169
|
}
|
|
2121
2170
|
//#endregion
|
|
2122
2171
|
//#region src/core/reelEscapeStack.ts
|
|
2123
|
-
var
|
|
2124
|
-
function
|
|
2125
|
-
return
|
|
2126
|
-
let t =
|
|
2127
|
-
t >= 0 &&
|
|
2172
|
+
var zt = [];
|
|
2173
|
+
function Bt(e) {
|
|
2174
|
+
return zt.push(e), () => {
|
|
2175
|
+
let t = zt.indexOf(e);
|
|
2176
|
+
t >= 0 && zt.splice(t, 1);
|
|
2128
2177
|
};
|
|
2129
2178
|
}
|
|
2130
|
-
function
|
|
2179
|
+
function Vt(e) {
|
|
2131
2180
|
if (!e.isActive()) return !1;
|
|
2132
|
-
let t =
|
|
2181
|
+
let t = zt.filter((e) => e.isActive()), n = e.element();
|
|
2133
2182
|
return n !== null && t.some((t) => {
|
|
2134
2183
|
if (t === e) return !1;
|
|
2135
2184
|
let r = t.element();
|
|
@@ -2145,14 +2194,14 @@ function Bt(e) {
|
|
|
2145
2194
|
}
|
|
2146
2195
|
//#endregion
|
|
2147
2196
|
//#region src/components/useReelKeyboard.ts
|
|
2148
|
-
function
|
|
2197
|
+
function Ht(e) {
|
|
2149
2198
|
let t = {
|
|
2150
2199
|
element: e.element,
|
|
2151
2200
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2152
2201
|
}, n = null;
|
|
2153
2202
|
function r(n) {
|
|
2154
2203
|
let r = t.isActive();
|
|
2155
|
-
if (n.key === "Escape" && r && !
|
|
2204
|
+
if (n.key === "Escape" && r && !Vt(t)) return;
|
|
2156
2205
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2157
2206
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2158
2207
|
return;
|
|
@@ -2172,14 +2221,14 @@ function Vt(e) {
|
|
|
2172
2221
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2173
2222
|
}
|
|
2174
2223
|
y(() => {
|
|
2175
|
-
n =
|
|
2224
|
+
n = Bt(t), window.addEventListener("keydown", r);
|
|
2176
2225
|
}), v(() => {
|
|
2177
2226
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2178
2227
|
});
|
|
2179
2228
|
}
|
|
2180
2229
|
//#endregion
|
|
2181
2230
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2182
|
-
var
|
|
2231
|
+
var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
2183
2232
|
__name: "VibeSurface",
|
|
2184
2233
|
props: {
|
|
2185
2234
|
canRetryEnd: { type: Boolean },
|
|
@@ -2205,70 +2254,70 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2205
2254
|
"retryForward"
|
|
2206
2255
|
],
|
|
2207
2256
|
setup(t, { expose: i, emit: c }) {
|
|
2208
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => z(l.state, A.value)), { markMasonryVisible: M, markPreviewError: N, markPreviewReady: I, markReelError: L, markReelReady: R, originalStates: B, previewStates: V, reelStates:
|
|
2257
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => z(l.state, A.value)), { markMasonryVisible: M, markPreviewError: N, markPreviewReady: I, markReelError: L, markReelReady: R, originalStates: B, previewStates: V, reelStates: ee } = Rt(l.state, {
|
|
2209
2258
|
ready: (e) => d("mediaReady", e),
|
|
2210
2259
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2211
2260
|
visible: (e) => d("mediaVisible", e)
|
|
2212
|
-
}),
|
|
2213
|
-
function
|
|
2261
|
+
}), H = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
|
|
2262
|
+
function K() {
|
|
2214
2263
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2215
2264
|
}
|
|
2216
|
-
function
|
|
2265
|
+
function q() {
|
|
2217
2266
|
U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
|
|
2218
2267
|
U = requestAnimationFrame(() => {
|
|
2219
2268
|
U = null, S.value = /* @__PURE__ */ new Set();
|
|
2220
2269
|
});
|
|
2221
2270
|
});
|
|
2222
2271
|
}
|
|
2223
|
-
function
|
|
2272
|
+
function J(e, t) {
|
|
2224
2273
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2225
2274
|
if (!n) return;
|
|
2226
2275
|
let r = F(n, t);
|
|
2227
2276
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2228
2277
|
}
|
|
2229
|
-
async function
|
|
2278
|
+
async function ne() {
|
|
2230
2279
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2231
2280
|
}
|
|
2232
|
-
function
|
|
2281
|
+
function Y(e) {
|
|
2233
2282
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2234
2283
|
}
|
|
2235
|
-
function
|
|
2284
|
+
function re(e) {
|
|
2236
2285
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2237
2286
|
}
|
|
2238
|
-
function
|
|
2287
|
+
function ie(e) {
|
|
2239
2288
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
2240
2289
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
2241
2290
|
if (!t) return "not-found";
|
|
2242
2291
|
let n = P(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
2243
2292
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
2244
2293
|
}
|
|
2245
|
-
function
|
|
2294
|
+
function ae() {
|
|
2246
2295
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2247
2296
|
}
|
|
2248
|
-
function
|
|
2249
|
-
W = e,
|
|
2297
|
+
function X(e, t) {
|
|
2298
|
+
W = e, G = t === "keyboard", y.value = se(e), d("openReel", e), m(() => h.value?.focus());
|
|
2250
2299
|
}
|
|
2251
|
-
function
|
|
2300
|
+
function Z(e) {
|
|
2252
2301
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2253
2302
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2254
2303
|
}
|
|
2255
|
-
function
|
|
2256
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
2257
|
-
let n = [...new Set(e)], r = n.filter(
|
|
2304
|
+
function Q(e, t) {
|
|
2305
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
|
|
2306
|
+
let n = [...new Set(e)], r = n.filter(Z);
|
|
2258
2307
|
if (r.length === 0) return 0;
|
|
2259
|
-
let i = new Map(D.value), a = t?.staggerMs ??
|
|
2308
|
+
let i = new Map(D.value), a = t?.staggerMs ?? Ut;
|
|
2260
2309
|
return r.forEach((e, t) => {
|
|
2261
2310
|
i.set(e, t * a);
|
|
2262
|
-
}), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i,
|
|
2311
|
+
}), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, Wt + (r.length - 1) * a;
|
|
2263
2312
|
}
|
|
2264
|
-
function
|
|
2265
|
-
let n =
|
|
2313
|
+
function oe(e, t) {
|
|
2314
|
+
let n = Z(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2266
2315
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2267
2316
|
r.classList.remove("media-card-focus-silent");
|
|
2268
2317
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2269
2318
|
}
|
|
2270
|
-
function
|
|
2271
|
-
let t = g.value, n =
|
|
2319
|
+
function se(e) {
|
|
2320
|
+
let t = g.value, n = Z(e);
|
|
2272
2321
|
if (t === null || n === null) return {};
|
|
2273
2322
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2274
2323
|
return {
|
|
@@ -2278,48 +2327,48 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2278
2327
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2279
2328
|
};
|
|
2280
2329
|
}
|
|
2281
|
-
function
|
|
2330
|
+
function ce() {
|
|
2282
2331
|
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2283
2332
|
}
|
|
2284
|
-
function
|
|
2285
|
-
let e = W, t =
|
|
2286
|
-
x.value = !1, W = null,
|
|
2287
|
-
e !== null &&
|
|
2333
|
+
function le() {
|
|
2334
|
+
let e = W, t = G;
|
|
2335
|
+
x.value = !1, W = null, G = !1, y.value = {}, m(() => {
|
|
2336
|
+
e !== null && oe(e, t);
|
|
2288
2337
|
});
|
|
2289
2338
|
}
|
|
2290
|
-
return
|
|
2291
|
-
closeMasonryReel:
|
|
2339
|
+
return Ht({
|
|
2340
|
+
closeMasonryReel: ce,
|
|
2292
2341
|
element: () => g.value,
|
|
2293
2342
|
isReelLeaving: () => x.value,
|
|
2294
2343
|
reelRenderer: () => p.value,
|
|
2295
2344
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2296
2345
|
state: l.state
|
|
2297
2346
|
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2298
|
-
let t = e.filter((e) => !
|
|
2299
|
-
if (
|
|
2347
|
+
let t = e.filter((e) => !H.has(e)), n = new Set(e);
|
|
2348
|
+
if (H = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || K()) return;
|
|
2300
2349
|
let r = /* @__PURE__ */ new Map();
|
|
2301
2350
|
e.forEach((e) => {
|
|
2302
2351
|
let t = C.value.get(e);
|
|
2303
2352
|
t !== void 0 && r.set(e, t);
|
|
2304
2353
|
}), t.forEach((e, t) => {
|
|
2305
|
-
r.set(e, t *
|
|
2306
|
-
}), C.value = r, S.value = new Set([...S.value, ...t]),
|
|
2354
|
+
r.set(e, t * Ut);
|
|
2355
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), q();
|
|
2307
2356
|
}, { flush: "sync" }), v(() => {
|
|
2308
2357
|
U !== null && cancelAnimationFrame(U);
|
|
2309
2358
|
}), i({
|
|
2310
|
-
changeActiveReelMedia:
|
|
2311
|
-
getAutoScrollElement:
|
|
2312
|
-
loadIfNearBottom:
|
|
2313
|
-
moveActiveReelPost:
|
|
2314
|
-
navigateToReelItem:
|
|
2315
|
-
startItemRemoval:
|
|
2359
|
+
changeActiveReelMedia: Y,
|
|
2360
|
+
getAutoScrollElement: ae,
|
|
2361
|
+
loadIfNearBottom: ne,
|
|
2362
|
+
moveActiveReelPost: re,
|
|
2363
|
+
navigateToReelItem: ie,
|
|
2364
|
+
startItemRemoval: Q,
|
|
2316
2365
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2317
2366
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2318
2367
|
}), (r, i) => (b(), s("div", {
|
|
2319
2368
|
ref_key: "surfaceElement",
|
|
2320
2369
|
ref: g,
|
|
2321
2370
|
class: "vibe-surface"
|
|
2322
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2371
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Ft, {
|
|
2323
2372
|
key: 0,
|
|
2324
2373
|
ref_key: "reelRenderer",
|
|
2325
2374
|
ref: p,
|
|
@@ -2344,7 +2393,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2344
2393
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2345
2394
|
"next-page-error": !!t.state.nextPageError,
|
|
2346
2395
|
origin: "reel",
|
|
2347
|
-
"preview-states": E(
|
|
2396
|
+
"preview-states": E(ee),
|
|
2348
2397
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2349
2398
|
"reel-forward": t.state.reelForward,
|
|
2350
2399
|
state: j.value,
|
|
@@ -2353,11 +2402,11 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2353
2402
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2354
2403
|
onError: E(L),
|
|
2355
2404
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2356
|
-
onMediaChange:
|
|
2405
|
+
onMediaChange: J,
|
|
2357
2406
|
onReady: E(R),
|
|
2358
2407
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2359
2408
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
2360
|
-
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(
|
|
2409
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(te, {
|
|
2361
2410
|
key: 1,
|
|
2362
2411
|
actions: t.feedFooterActions,
|
|
2363
2412
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2370,7 +2419,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2370
2419
|
"can-retry-end",
|
|
2371
2420
|
"feed-footer",
|
|
2372
2421
|
"state"
|
|
2373
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2422
|
+
])) : (b(), s(e, { key: 2 }, [u(yt, {
|
|
2374
2423
|
ref_key: "masonryRenderer",
|
|
2375
2424
|
ref: f,
|
|
2376
2425
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2395,10 +2444,10 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2395
2444
|
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2396
2445
|
state: j.value,
|
|
2397
2446
|
total: t.state.total,
|
|
2398
|
-
onActivate:
|
|
2447
|
+
onActivate: X,
|
|
2399
2448
|
onError: E(N),
|
|
2400
2449
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2401
|
-
onMediaChange:
|
|
2450
|
+
onMediaChange: J,
|
|
2402
2451
|
onReady: E(I),
|
|
2403
2452
|
onRetryEnd: i[8] ||= (e) => d("retryEnd"),
|
|
2404
2453
|
onVisible: E(M)
|
|
@@ -2430,7 +2479,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2430
2479
|
"onVisible"
|
|
2431
2480
|
]), u(n, {
|
|
2432
2481
|
name: "vibe-reel-viewer",
|
|
2433
|
-
onAfterLeave:
|
|
2482
|
+
onAfterLeave: le
|
|
2434
2483
|
}, {
|
|
2435
2484
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2436
2485
|
key: 0,
|
|
@@ -2442,7 +2491,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2442
2491
|
"aria-modal": "true",
|
|
2443
2492
|
tabindex: "-1",
|
|
2444
2493
|
style: _(y.value)
|
|
2445
|
-
}, [u(
|
|
2494
|
+
}, [u(Ft, {
|
|
2446
2495
|
ref_key: "reelRenderer",
|
|
2447
2496
|
ref: p,
|
|
2448
2497
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2475,7 +2524,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2475
2524
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2476
2525
|
onError: E(L),
|
|
2477
2526
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2478
|
-
onMediaChange:
|
|
2527
|
+
onMediaChange: J,
|
|
2479
2528
|
onReady: E(R),
|
|
2480
2529
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2481
2530
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
@@ -2486,33 +2535,33 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2486
2535
|
});
|
|
2487
2536
|
//#endregion
|
|
2488
2537
|
//#region src/core/page.ts
|
|
2489
|
-
function
|
|
2538
|
+
function Kt(e) {
|
|
2490
2539
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2491
2540
|
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.");
|
|
2492
2541
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2493
2542
|
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.");
|
|
2494
2543
|
return e;
|
|
2495
2544
|
}
|
|
2496
|
-
function
|
|
2545
|
+
function $(e, t) {
|
|
2497
2546
|
let n = new Set(e.map((e) => e.postId));
|
|
2498
2547
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2499
2548
|
}
|
|
2500
|
-
function
|
|
2549
|
+
function qt(e) {
|
|
2501
2550
|
return `${typeof e}:${String(e)}`;
|
|
2502
2551
|
}
|
|
2503
|
-
function
|
|
2504
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${
|
|
2552
|
+
function Jt(e) {
|
|
2553
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${qt(e.mediaId)}`;
|
|
2505
2554
|
}
|
|
2506
|
-
function
|
|
2507
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
2555
|
+
function Yt(e, t) {
|
|
2556
|
+
let n = [...e], r = new Map(e.map((e, t) => [qt(e.postId), t]));
|
|
2508
2557
|
return t.forEach((e) => {
|
|
2509
|
-
let t =
|
|
2558
|
+
let t = qt(e.postId), i = r.get(t);
|
|
2510
2559
|
if (i === void 0) {
|
|
2511
2560
|
r.set(t, n.length), n.push(e);
|
|
2512
2561
|
return;
|
|
2513
2562
|
}
|
|
2514
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
2515
|
-
let t =
|
|
2563
|
+
let a = n[i], o = new Set([a, ...a.items].map(Jt)), s = [e, ...e.items].filter((e) => {
|
|
2564
|
+
let t = Jt(e);
|
|
2516
2565
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
2517
2566
|
});
|
|
2518
2567
|
s.length > 0 && (n[i] = {
|
|
@@ -2521,14 +2570,14 @@ function Jt(e, t) {
|
|
|
2521
2570
|
});
|
|
2522
2571
|
}), n;
|
|
2523
2572
|
}
|
|
2524
|
-
function
|
|
2573
|
+
function Xt(e) {
|
|
2525
2574
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
2526
2575
|
}
|
|
2527
2576
|
//#endregion
|
|
2528
2577
|
//#region src/core/appendPage.ts
|
|
2529
|
-
function
|
|
2530
|
-
let i =
|
|
2531
|
-
t.items =
|
|
2578
|
+
function Zt(e, t, n, r) {
|
|
2579
|
+
let i = Kt(e), a = n.filterItems(i.items), o = Xt(i);
|
|
2580
|
+
t.items = Yt(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
2532
2581
|
contributionIds: a.map(({ postId: e }) => e),
|
|
2533
2582
|
cursor: o,
|
|
2534
2583
|
next: i.next,
|
|
@@ -2537,32 +2586,32 @@ function Xt(e, t, n, r) {
|
|
|
2537
2586
|
}
|
|
2538
2587
|
//#endregion
|
|
2539
2588
|
//#region src/core/requestDelay.ts
|
|
2540
|
-
var
|
|
2589
|
+
var Qt = 2e3, $t = 1e4, en = 250, tn = {
|
|
2541
2590
|
delayRemainingMs: null,
|
|
2542
2591
|
nextRequestAt: null
|
|
2543
2592
|
};
|
|
2544
|
-
function
|
|
2593
|
+
function nn(e, t) {
|
|
2545
2594
|
return e === void 0 ? t : Math.floor(e);
|
|
2546
2595
|
}
|
|
2547
|
-
function
|
|
2596
|
+
function rn(e, t) {
|
|
2548
2597
|
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.`);
|
|
2549
2598
|
}
|
|
2550
|
-
function
|
|
2551
|
-
let n =
|
|
2599
|
+
function an(e, t = {}) {
|
|
2600
|
+
let n = nn(t.delayStepMs, Qt), r = nn(t.delayMaxMs, $t);
|
|
2552
2601
|
return Math.min(Math.max(0, e) * n, r);
|
|
2553
2602
|
}
|
|
2554
|
-
function
|
|
2555
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2603
|
+
function on(e) {
|
|
2604
|
+
if (e == null || !Number.isFinite(e)) return { ...tn };
|
|
2556
2605
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2557
2606
|
return t > 0 ? {
|
|
2558
2607
|
delayRemainingMs: t,
|
|
2559
2608
|
nextRequestAt: e
|
|
2560
|
-
} : { ...
|
|
2609
|
+
} : { ...tn };
|
|
2561
2610
|
}
|
|
2562
|
-
async function
|
|
2611
|
+
async function sn({ delayMs: e, onChange: t, signal: n }) {
|
|
2563
2612
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2564
2613
|
if (e <= 0) {
|
|
2565
|
-
t({ ...
|
|
2614
|
+
t({ ...tn });
|
|
2566
2615
|
return;
|
|
2567
2616
|
}
|
|
2568
2617
|
let r = Date.now() + e;
|
|
@@ -2570,9 +2619,9 @@ async function an({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2570
2619
|
delayRemainingMs: e,
|
|
2571
2620
|
nextRequestAt: r
|
|
2572
2621
|
}), await new Promise((i, a) => {
|
|
2573
|
-
let o = !1, s = setInterval(f,
|
|
2622
|
+
let o = !1, s = setInterval(f, en), c = setTimeout(() => u(), e);
|
|
2574
2623
|
function l() {
|
|
2575
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2624
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...tn });
|
|
2576
2625
|
}
|
|
2577
2626
|
function u(e) {
|
|
2578
2627
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2581,42 +2630,42 @@ async function an({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2581
2630
|
u(new DOMException("Aborted", "AbortError"));
|
|
2582
2631
|
}
|
|
2583
2632
|
function f() {
|
|
2584
|
-
let e =
|
|
2633
|
+
let e = on(r);
|
|
2585
2634
|
t(e), e.delayRemainingMs === null && u();
|
|
2586
2635
|
}
|
|
2587
2636
|
n.addEventListener("abort", d, { once: !0 });
|
|
2588
2637
|
});
|
|
2589
2638
|
}
|
|
2590
|
-
var
|
|
2639
|
+
var cn = class {
|
|
2591
2640
|
interval = null;
|
|
2592
2641
|
constructor(e) {
|
|
2593
2642
|
this.onChange = e;
|
|
2594
2643
|
}
|
|
2595
2644
|
clear() {
|
|
2596
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2645
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...tn });
|
|
2597
2646
|
}
|
|
2598
2647
|
sync(e) {
|
|
2599
2648
|
this.clear();
|
|
2600
|
-
let t =
|
|
2649
|
+
let t = on(e);
|
|
2601
2650
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2602
|
-
let t =
|
|
2651
|
+
let t = on(e);
|
|
2603
2652
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2604
|
-
},
|
|
2653
|
+
}, en));
|
|
2605
2654
|
}
|
|
2606
2655
|
};
|
|
2607
|
-
function
|
|
2656
|
+
function ln(e, t = !0) {
|
|
2608
2657
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2609
2658
|
}
|
|
2610
|
-
function
|
|
2659
|
+
function un(e) {
|
|
2611
2660
|
return `${typeof e}:${String(e)}`;
|
|
2612
2661
|
}
|
|
2613
|
-
function
|
|
2662
|
+
function dn(e, t) {
|
|
2614
2663
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2615
2664
|
}
|
|
2616
|
-
function
|
|
2665
|
+
function fn(e) {
|
|
2617
2666
|
if (!e) return;
|
|
2618
|
-
if (
|
|
2619
|
-
|
|
2667
|
+
if (dn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2668
|
+
rn(e, "frontend autofill");
|
|
2620
2669
|
let t = e.maxAdditionalPages;
|
|
2621
2670
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2622
2671
|
return;
|
|
@@ -2628,7 +2677,7 @@ function un(e) {
|
|
|
2628
2677
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2629
2678
|
}
|
|
2630
2679
|
}
|
|
2631
|
-
function
|
|
2680
|
+
function pn(e, t, n = !0) {
|
|
2632
2681
|
if (!e) return {
|
|
2633
2682
|
cycleId: null,
|
|
2634
2683
|
delayRemainingMs: null,
|
|
@@ -2645,7 +2694,7 @@ function dn(e, t, n = !0) {
|
|
|
2645
2694
|
status: "idle",
|
|
2646
2695
|
strategy: null
|
|
2647
2696
|
};
|
|
2648
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
2697
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = on(r?.nextRequestAt);
|
|
2649
2698
|
return {
|
|
2650
2699
|
cycleId: r?.cycleId ?? null,
|
|
2651
2700
|
...a,
|
|
@@ -2662,7 +2711,7 @@ function dn(e, t, n = !0) {
|
|
|
2662
2711
|
strategy: e.strategy
|
|
2663
2712
|
};
|
|
2664
2713
|
}
|
|
2665
|
-
function
|
|
2714
|
+
function mn(e) {
|
|
2666
2715
|
return [
|
|
2667
2716
|
"cancelling",
|
|
2668
2717
|
"filling",
|
|
@@ -2670,9 +2719,9 @@ function fn(e) {
|
|
|
2670
2719
|
"waiting"
|
|
2671
2720
|
].includes(e.status);
|
|
2672
2721
|
}
|
|
2673
|
-
async function
|
|
2722
|
+
async function hn(e, t, n) {
|
|
2674
2723
|
let r = t.autofill;
|
|
2675
|
-
if (!
|
|
2724
|
+
if (!mn(r) || !r.cycleId) return;
|
|
2676
2725
|
let i = {
|
|
2677
2726
|
cycleId: r.cycleId,
|
|
2678
2727
|
feedKey: r.feedKey ?? "",
|
|
@@ -2685,16 +2734,16 @@ async function pn(e, t, n) {
|
|
|
2685
2734
|
throw r.error = e, r.status = "error", e;
|
|
2686
2735
|
}
|
|
2687
2736
|
}
|
|
2688
|
-
function
|
|
2737
|
+
function gn(e, t, n) {
|
|
2689
2738
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2690
2739
|
}
|
|
2691
|
-
async function
|
|
2692
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2740
|
+
async function _n({ 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 }) {
|
|
2741
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? ln(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2693
2742
|
for (; y < h;) {
|
|
2694
|
-
let e =
|
|
2743
|
+
let e = un(g);
|
|
2695
2744
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2696
|
-
if (m.add(e), await
|
|
2697
|
-
delayMs:
|
|
2745
|
+
if (m.add(e), await sn({
|
|
2746
|
+
delayMs: an(l + y, s),
|
|
2698
2747
|
onChange: a,
|
|
2699
2748
|
signal: d
|
|
2700
2749
|
}), y > 0 && u()) return {
|
|
@@ -2708,12 +2757,12 @@ async function hn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2708
2757
|
status: "paused",
|
|
2709
2758
|
total: x
|
|
2710
2759
|
};
|
|
2711
|
-
let t =
|
|
2760
|
+
let t = Kt(await n({
|
|
2712
2761
|
cursor: g,
|
|
2713
2762
|
signal: d
|
|
2714
2763
|
}));
|
|
2715
2764
|
y += 1, _ = g;
|
|
2716
|
-
let r =
|
|
2765
|
+
let r = $(p, t.items).slice(p.length);
|
|
2717
2766
|
b.push({
|
|
2718
2767
|
contributionIds: r.map(({ postId: e }) => e),
|
|
2719
2768
|
cursor: g,
|
|
@@ -2765,12 +2814,12 @@ async function hn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2765
2814
|
}
|
|
2766
2815
|
//#endregion
|
|
2767
2816
|
//#region src/core/autofillController.ts
|
|
2768
|
-
var
|
|
2817
|
+
var vn = class {
|
|
2769
2818
|
collection = null;
|
|
2770
2819
|
cycle = 0;
|
|
2771
2820
|
delayCountdown;
|
|
2772
2821
|
constructor(e) {
|
|
2773
|
-
this.context = e, this.delayCountdown = new
|
|
2822
|
+
this.context = e, this.delayCountdown = new cn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2774
2823
|
}
|
|
2775
2824
|
beginCycle() {
|
|
2776
2825
|
let { options: e, state: t } = this.context;
|
|
@@ -2778,14 +2827,14 @@ var gn = class {
|
|
|
2778
2827
|
this.clear();
|
|
2779
2828
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2780
2829
|
return t.autofill = {
|
|
2781
|
-
...
|
|
2830
|
+
...pn(e, void 0, !1),
|
|
2782
2831
|
cycleId: n,
|
|
2783
2832
|
status: "filling"
|
|
2784
2833
|
}, n;
|
|
2785
2834
|
}
|
|
2786
2835
|
async cancel() {
|
|
2787
2836
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2788
|
-
await
|
|
2837
|
+
await hn(t, n, e), this.commitCollection();
|
|
2789
2838
|
}
|
|
2790
2839
|
captureCollection(e, t) {
|
|
2791
2840
|
t && (this.collection = e);
|
|
@@ -2807,36 +2856,36 @@ var gn = class {
|
|
|
2807
2856
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
2808
2857
|
if (t?.strategy !== "frontend") return !1;
|
|
2809
2858
|
let r = this.collection;
|
|
2810
|
-
return this.collection = null, r ? (n.items =
|
|
2859
|
+
return this.collection = null, r ? (n.items = $(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, {
|
|
2811
2860
|
missing: r.missing,
|
|
2812
2861
|
received: r.received,
|
|
2813
2862
|
requests: r.requests
|
|
2814
2863
|
}), !0) : !1;
|
|
2815
2864
|
}
|
|
2816
|
-
},
|
|
2817
|
-
function
|
|
2865
|
+
}, yn = 100;
|
|
2866
|
+
function bn(e, t) {
|
|
2818
2867
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2819
2868
|
}
|
|
2820
|
-
function
|
|
2869
|
+
function xn(e, t, n) {
|
|
2821
2870
|
return Math.min(n, Math.max(t, e));
|
|
2822
2871
|
}
|
|
2823
|
-
function
|
|
2872
|
+
function Sn(e) {
|
|
2824
2873
|
if (!e) return;
|
|
2825
2874
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2826
|
-
if (
|
|
2827
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2875
|
+
if (bn("autoScroll.minSpeedPxPerSecond", t), bn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2876
|
+
e.speedPxPerSecond !== void 0 && bn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2828
2877
|
}
|
|
2829
|
-
function
|
|
2878
|
+
function Cn(e) {
|
|
2830
2879
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2831
2880
|
return {
|
|
2832
2881
|
enabled: e?.enabled ?? !1,
|
|
2833
2882
|
maxSpeedPxPerSecond: n,
|
|
2834
2883
|
minSpeedPxPerSecond: t,
|
|
2835
2884
|
paused: !1,
|
|
2836
|
-
speedPxPerSecond:
|
|
2885
|
+
speedPxPerSecond: xn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2837
2886
|
};
|
|
2838
2887
|
}
|
|
2839
|
-
var
|
|
2888
|
+
var wn = class {
|
|
2840
2889
|
frame = null;
|
|
2841
2890
|
lastTimestamp = null;
|
|
2842
2891
|
mounted = !1;
|
|
@@ -2856,9 +2905,9 @@ var Sn = class {
|
|
|
2856
2905
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2857
2906
|
}
|
|
2858
2907
|
setSpeed(e) {
|
|
2859
|
-
|
|
2908
|
+
bn("auto-scroll speed", e);
|
|
2860
2909
|
let t = this.options.state;
|
|
2861
|
-
t.speedPxPerSecond =
|
|
2910
|
+
t.speedPxPerSecond = xn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2862
2911
|
}
|
|
2863
2912
|
tick = (e) => {
|
|
2864
2913
|
this.frame = null;
|
|
@@ -2870,7 +2919,7 @@ var Sn = class {
|
|
|
2870
2919
|
return;
|
|
2871
2920
|
}
|
|
2872
2921
|
if (this.lastTimestamp !== null) {
|
|
2873
|
-
let r = Math.min(
|
|
2922
|
+
let r = Math.min(yn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2874
2923
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2875
2924
|
}
|
|
2876
2925
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2884,13 +2933,13 @@ var Sn = class {
|
|
|
2884
2933
|
};
|
|
2885
2934
|
//#endregion
|
|
2886
2935
|
//#region src/core/backendAutofill.ts
|
|
2887
|
-
async function
|
|
2936
|
+
async function Tn(e, t, n, r) {
|
|
2888
2937
|
let i = await e.onUnderfilled(n);
|
|
2889
2938
|
if (!r()) return;
|
|
2890
2939
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
2891
2940
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
2892
2941
|
Object.assign(t.autofill, {
|
|
2893
|
-
|
|
2942
|
+
...on(i.nextRequestAt),
|
|
2894
2943
|
missing: Math.max(0, e.pageSize - a),
|
|
2895
2944
|
received: a,
|
|
2896
2945
|
sequence: i.sequence ?? 0,
|
|
@@ -2898,19 +2947,19 @@ async function Cn(e, t, n, r) {
|
|
|
2898
2947
|
status: "waiting"
|
|
2899
2948
|
});
|
|
2900
2949
|
}
|
|
2901
|
-
function
|
|
2902
|
-
["complete", "exhausted"].includes(t.status) && t.items && (e.items =
|
|
2950
|
+
function En(e, t) {
|
|
2951
|
+
["complete", "exhausted"].includes(t.status) && t.items && (e.items = $(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
2903
2952
|
}
|
|
2904
|
-
function
|
|
2953
|
+
function Dn(e, t, n) {
|
|
2905
2954
|
let r = t.autofill;
|
|
2906
|
-
return !
|
|
2955
|
+
return !gn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (En(t, n), Object.assign(r, on(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);
|
|
2907
2956
|
}
|
|
2908
|
-
function
|
|
2909
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2957
|
+
function On(e, t, n) {
|
|
2958
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = pn(e, n), En(t, n), !0);
|
|
2910
2959
|
}
|
|
2911
2960
|
//#endregion
|
|
2912
2961
|
//#region src/core/backlogRestore.ts
|
|
2913
|
-
async function
|
|
2962
|
+
async function kn(e, t, n) {
|
|
2914
2963
|
if (!e) return;
|
|
2915
2964
|
let r = new AbortController();
|
|
2916
2965
|
n(r);
|
|
@@ -2925,7 +2974,7 @@ async function Dn(e, t, n) {
|
|
|
2925
2974
|
}
|
|
2926
2975
|
//#endregion
|
|
2927
2976
|
//#region src/core/initialAutofill.ts
|
|
2928
|
-
async function
|
|
2977
|
+
async function An({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2929
2978
|
let c = a.autofill;
|
|
2930
2979
|
if (!c) return;
|
|
2931
2980
|
let l = s.items.length;
|
|
@@ -2938,7 +2987,7 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2938
2987
|
return;
|
|
2939
2988
|
}
|
|
2940
2989
|
if (c.strategy === "backend") {
|
|
2941
|
-
await
|
|
2990
|
+
await Tn(c, s, {
|
|
2942
2991
|
cycleId: e,
|
|
2943
2992
|
feedKey: c.feedKey,
|
|
2944
2993
|
items: [...s.items],
|
|
@@ -2955,11 +3004,11 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2955
3004
|
s.autofill.status = "exhausted";
|
|
2956
3005
|
return;
|
|
2957
3006
|
}
|
|
2958
|
-
let u = await
|
|
3007
|
+
let u = await _n({
|
|
2959
3008
|
existingItems: s.items,
|
|
2960
3009
|
initialCursor: s.next,
|
|
2961
3010
|
loadPage: a.loadPage,
|
|
2962
|
-
maximumRequests:
|
|
3011
|
+
maximumRequests: ln(c, !1),
|
|
2963
3012
|
onCollection: n,
|
|
2964
3013
|
onDelayChange: (e) => {
|
|
2965
3014
|
t() && Object.assign(s.autofill, e);
|
|
@@ -2973,7 +3022,7 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2973
3022
|
shouldPause: () => s.loadMoreLocked,
|
|
2974
3023
|
signal: o
|
|
2975
3024
|
});
|
|
2976
|
-
t() && (s.items =
|
|
3025
|
+
t() && (s.items = $(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, {
|
|
2977
3026
|
missing: u.missing,
|
|
2978
3027
|
received: u.received,
|
|
2979
3028
|
requests: u.requests,
|
|
@@ -2982,13 +3031,13 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2982
3031
|
}
|
|
2983
3032
|
//#endregion
|
|
2984
3033
|
//#region src/core/fill.ts
|
|
2985
|
-
function
|
|
3034
|
+
function jn(e) {
|
|
2986
3035
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2987
3036
|
}
|
|
2988
|
-
function
|
|
3037
|
+
function Mn(e) {
|
|
2989
3038
|
return `${typeof e}:${String(e)}`;
|
|
2990
3039
|
}
|
|
2991
|
-
function
|
|
3040
|
+
function Nn(e) {
|
|
2992
3041
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2993
3042
|
if ("pages" in e) {
|
|
2994
3043
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3001,21 +3050,21 @@ function jn(e) {
|
|
|
3001
3050
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3002
3051
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3003
3052
|
}
|
|
3004
|
-
function
|
|
3053
|
+
function Pn(e) {
|
|
3005
3054
|
if (!e) return;
|
|
3006
3055
|
if (e.strategy === "frontend") {
|
|
3007
|
-
|
|
3056
|
+
rn(e, "frontend fill");
|
|
3008
3057
|
return;
|
|
3009
3058
|
}
|
|
3010
3059
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3011
3060
|
let t = e.initialSession;
|
|
3012
3061
|
if (t) {
|
|
3013
3062
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3014
|
-
|
|
3063
|
+
Nn(t.target);
|
|
3015
3064
|
}
|
|
3016
3065
|
}
|
|
3017
|
-
function
|
|
3018
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3066
|
+
function Fn(e, t, n = !0) {
|
|
3067
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = on(i?.nextRequestAt);
|
|
3019
3068
|
return {
|
|
3020
3069
|
completedPages: i?.completedPages ?? 0,
|
|
3021
3070
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3028,10 +3077,10 @@ function Nn(e, t, n = !0) {
|
|
|
3028
3077
|
sessionId: i?.sessionId ?? null,
|
|
3029
3078
|
status: i?.status ?? "idle",
|
|
3030
3079
|
strategy: e?.strategy ?? null,
|
|
3031
|
-
target: i ?
|
|
3080
|
+
target: i ? jn(i.target) : null
|
|
3032
3081
|
};
|
|
3033
3082
|
}
|
|
3034
|
-
function
|
|
3083
|
+
function In(e) {
|
|
3035
3084
|
return [
|
|
3036
3085
|
"cancelling",
|
|
3037
3086
|
"filling",
|
|
@@ -3039,7 +3088,7 @@ function Pn(e) {
|
|
|
3039
3088
|
"waiting"
|
|
3040
3089
|
].includes(e.status);
|
|
3041
3090
|
}
|
|
3042
|
-
async function
|
|
3091
|
+
async function Ln({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3043
3092
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3044
3093
|
if ("items" in l && f.length >= l.items) return {
|
|
3045
3094
|
completedPages: m,
|
|
@@ -3051,10 +3100,10 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3051
3100
|
status: "complete"
|
|
3052
3101
|
};
|
|
3053
3102
|
for (; _ !== null;) {
|
|
3054
|
-
let e =
|
|
3103
|
+
let e = Mn(h);
|
|
3055
3104
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3056
|
-
if (p.add(e), await
|
|
3057
|
-
delayMs:
|
|
3105
|
+
if (p.add(e), await sn({
|
|
3106
|
+
delayMs: an(m, o),
|
|
3058
3107
|
onChange: i,
|
|
3059
3108
|
signal: c
|
|
3060
3109
|
}), m > 0 && s()) return {
|
|
@@ -3067,12 +3116,12 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3067
3116
|
status: "paused",
|
|
3068
3117
|
total: y
|
|
3069
3118
|
};
|
|
3070
|
-
let t =
|
|
3119
|
+
let t = Kt(await n({
|
|
3071
3120
|
cursor: h,
|
|
3072
3121
|
signal: c
|
|
3073
3122
|
}));
|
|
3074
3123
|
m += 1, g = h;
|
|
3075
|
-
let b =
|
|
3124
|
+
let b = $(f, t.items).slice(f.length);
|
|
3076
3125
|
if (d.push({
|
|
3077
3126
|
contributionIds: b.map(({ postId: e }) => e),
|
|
3078
3127
|
cursor: h,
|
|
@@ -3135,12 +3184,12 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3135
3184
|
}
|
|
3136
3185
|
//#endregion
|
|
3137
3186
|
//#region src/core/backendFill.ts
|
|
3138
|
-
async function
|
|
3187
|
+
async function Rn(e, t, n, r) {
|
|
3139
3188
|
let i = await e.onStart(n);
|
|
3140
3189
|
if (r()) {
|
|
3141
3190
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3142
3191
|
Object.assign(t.fill, {
|
|
3143
|
-
|
|
3192
|
+
...on(i.nextRequestAt),
|
|
3144
3193
|
completedPages: i.completedPages ?? 0,
|
|
3145
3194
|
received: i.received ?? 0,
|
|
3146
3195
|
sequence: i.sequence ?? 0,
|
|
@@ -3149,23 +3198,23 @@ async function In(e, t, n, r) {
|
|
|
3149
3198
|
});
|
|
3150
3199
|
}
|
|
3151
3200
|
}
|
|
3152
|
-
function
|
|
3201
|
+
function zn(e, t, n) {
|
|
3153
3202
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3154
3203
|
}
|
|
3155
|
-
function
|
|
3204
|
+
function Bn(e) {
|
|
3156
3205
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3157
3206
|
}
|
|
3158
|
-
function
|
|
3207
|
+
function Vn(e, t) {
|
|
3159
3208
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3160
3209
|
let n = e.fill.target;
|
|
3161
3210
|
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;
|
|
3162
3211
|
}
|
|
3163
|
-
function
|
|
3164
|
-
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items =
|
|
3212
|
+
function Hn(e, t, n) {
|
|
3213
|
+
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = $(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
3165
3214
|
}
|
|
3166
|
-
function
|
|
3167
|
-
return !
|
|
3168
|
-
|
|
3215
|
+
function Un(e, t, n, r) {
|
|
3216
|
+
return !zn(e, t, n) || !Bn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Vn(t, n) ? !1 : (Hn(t, n, r), Object.assign(t.fill, {
|
|
3217
|
+
...on(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3169
3218
|
completedPages: n.completedPages,
|
|
3170
3219
|
error: n.error ?? null,
|
|
3171
3220
|
received: n.received,
|
|
@@ -3173,45 +3222,45 @@ function Vn(e, t, n, r) {
|
|
|
3173
3222
|
status: n.status
|
|
3174
3223
|
}), !0);
|
|
3175
3224
|
}
|
|
3176
|
-
function
|
|
3225
|
+
function Wn(e, t, n, r) {
|
|
3177
3226
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3178
3227
|
let i = t.fill;
|
|
3179
|
-
return t.fill =
|
|
3228
|
+
return t.fill = Fn(e, n), !Bn(n) || !Vn(t, n) ? (t.fill = i, !1) : (Hn(t, n, r), !0);
|
|
3180
3229
|
}
|
|
3181
3230
|
//#endregion
|
|
3182
3231
|
//#region src/core/fillController.ts
|
|
3183
|
-
var
|
|
3232
|
+
var Gn = class {
|
|
3184
3233
|
abortController = null;
|
|
3185
3234
|
cycle = 0;
|
|
3186
3235
|
delayCountdown;
|
|
3187
3236
|
requestVersion = 0;
|
|
3188
3237
|
collection = null;
|
|
3189
3238
|
constructor(e) {
|
|
3190
|
-
this.options = e, this.delayCountdown = new
|
|
3239
|
+
this.options = e, this.delayCountdown = new cn((e) => {
|
|
3191
3240
|
Object.assign(this.options.state.fill, e);
|
|
3192
3241
|
}), this.syncBackendCountdown();
|
|
3193
3242
|
}
|
|
3194
3243
|
isActive() {
|
|
3195
|
-
return
|
|
3244
|
+
return In(this.options.state.fill);
|
|
3196
3245
|
}
|
|
3197
3246
|
applyUpdate(e) {
|
|
3198
|
-
let t =
|
|
3247
|
+
let t = Un(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3199
3248
|
return t && this.syncBackendCountdown(), t;
|
|
3200
3249
|
}
|
|
3201
3250
|
restoreSession(e) {
|
|
3202
|
-
let t =
|
|
3251
|
+
let t = Wn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3203
3252
|
return t && this.syncBackendCountdown(), t;
|
|
3204
3253
|
}
|
|
3205
3254
|
async start(e, t = {}) {
|
|
3206
3255
|
let n = this.options.fill;
|
|
3207
3256
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3208
3257
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3209
|
-
let r =
|
|
3258
|
+
let r = Nn(e), i = Nn(t.target ?? r), a = t.progressOffset ?? {
|
|
3210
3259
|
completedPages: 0,
|
|
3211
3260
|
received: 0
|
|
3212
3261
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3213
3262
|
if (this.options.state.fill = {
|
|
3214
|
-
...
|
|
3263
|
+
...Fn(n, void 0, !1),
|
|
3215
3264
|
completedPages: a.completedPages,
|
|
3216
3265
|
cycleId: o,
|
|
3217
3266
|
received: a.received,
|
|
@@ -3224,7 +3273,7 @@ var Un = class {
|
|
|
3224
3273
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3225
3274
|
this.abortController = c;
|
|
3226
3275
|
try {
|
|
3227
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3276
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Rn(n, this.options.state, {
|
|
3228
3277
|
cycleId: o,
|
|
3229
3278
|
feedKey: n.feedKey,
|
|
3230
3279
|
items: [...this.options.state.items],
|
|
@@ -3242,7 +3291,7 @@ var Un = class {
|
|
|
3242
3291
|
}
|
|
3243
3292
|
async cancel() {
|
|
3244
3293
|
let { fill: e, state: t } = this.options;
|
|
3245
|
-
if (!
|
|
3294
|
+
if (!In(t.fill) || !t.fill.cycleId) return;
|
|
3246
3295
|
let n = {
|
|
3247
3296
|
cycleId: t.fill.cycleId,
|
|
3248
3297
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3286,7 +3335,7 @@ var Un = class {
|
|
|
3286
3335
|
});
|
|
3287
3336
|
}
|
|
3288
3337
|
reset() {
|
|
3289
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3338
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Fn(this.options.fill, void 0, !1), this.collection = null;
|
|
3290
3339
|
}
|
|
3291
3340
|
destroy() {
|
|
3292
3341
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3321,7 +3370,7 @@ var Un = class {
|
|
|
3321
3370
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
3322
3371
|
return;
|
|
3323
3372
|
}
|
|
3324
|
-
let c = await
|
|
3373
|
+
let c = await Ln({
|
|
3325
3374
|
existingItems: s.items,
|
|
3326
3375
|
initialCursor: s.next,
|
|
3327
3376
|
loadPage: o,
|
|
@@ -3347,7 +3396,7 @@ var Un = class {
|
|
|
3347
3396
|
signal: n.signal,
|
|
3348
3397
|
target: t
|
|
3349
3398
|
});
|
|
3350
|
-
this.isCurrent(r) && (s.items =
|
|
3399
|
+
this.isCurrent(r) && (s.items = $(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, {
|
|
3351
3400
|
completedPages: a.completedPages + c.completedPages,
|
|
3352
3401
|
received: a.received + c.received,
|
|
3353
3402
|
status: c.status
|
|
@@ -3357,7 +3406,7 @@ var Un = class {
|
|
|
3357
3406
|
let e = this.collection;
|
|
3358
3407
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
3359
3408
|
let t = this.options.state;
|
|
3360
|
-
t.items =
|
|
3409
|
+
t.items = $(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, {
|
|
3361
3410
|
completedPages: e.completedPages,
|
|
3362
3411
|
received: e.received
|
|
3363
3412
|
});
|
|
@@ -3369,7 +3418,7 @@ var Un = class {
|
|
|
3369
3418
|
};
|
|
3370
3419
|
//#endregion
|
|
3371
3420
|
//#region src/core/fillReconciliation.ts
|
|
3372
|
-
async function
|
|
3421
|
+
async function Kn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
|
|
3373
3422
|
if (!e.needsReconciliation(o.items)) return "skipped";
|
|
3374
3423
|
let s = await e.reconcile({
|
|
3375
3424
|
existingItems: o.items,
|
|
@@ -3378,11 +3427,11 @@ async function Wn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
3378
3427
|
shouldPause: () => o.loadMoreLocked,
|
|
3379
3428
|
signal: a
|
|
3380
3429
|
});
|
|
3381
|
-
return t() ? (o.items =
|
|
3430
|
+
return t() ? (o.items = $(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;
|
|
3382
3431
|
}
|
|
3383
3432
|
//#endregion
|
|
3384
3433
|
//#region src/core/feedFooter.ts
|
|
3385
|
-
function
|
|
3434
|
+
function qn(e) {
|
|
3386
3435
|
return {
|
|
3387
3436
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3388
3437
|
loadMore: () => e.loadNext(),
|
|
@@ -3394,64 +3443,64 @@ function Gn(e) {
|
|
|
3394
3443
|
retryFill: () => e.retryFill()
|
|
3395
3444
|
};
|
|
3396
3445
|
}
|
|
3397
|
-
function
|
|
3446
|
+
function Jn(e) {
|
|
3398
3447
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3399
3448
|
}
|
|
3400
|
-
function
|
|
3401
|
-
e?.intervalMs !== void 0 &&
|
|
3449
|
+
function Yn(e) {
|
|
3450
|
+
e?.intervalMs !== void 0 && Jn(e.intervalMs);
|
|
3402
3451
|
}
|
|
3403
|
-
function
|
|
3452
|
+
function Xn(e) {
|
|
3404
3453
|
return {
|
|
3405
3454
|
enabled: e?.enabled ?? !1,
|
|
3406
3455
|
includePostItems: e?.includePostItems ?? !1,
|
|
3407
3456
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3408
3457
|
};
|
|
3409
3458
|
}
|
|
3410
|
-
function
|
|
3459
|
+
function Zn(e, t) {
|
|
3411
3460
|
if (typeof t == "boolean") {
|
|
3412
3461
|
e.enabled = t;
|
|
3413
3462
|
return;
|
|
3414
3463
|
}
|
|
3415
|
-
|
|
3464
|
+
Yn(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);
|
|
3416
3465
|
}
|
|
3417
3466
|
//#endregion
|
|
3418
3467
|
//#region src/core/reelInfoSheet.ts
|
|
3419
|
-
function
|
|
3468
|
+
function Qn(e) {
|
|
3420
3469
|
return { enabled: e?.enabled ?? !1 };
|
|
3421
3470
|
}
|
|
3422
|
-
function
|
|
3471
|
+
function $n(e, t, n) {
|
|
3423
3472
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3424
3473
|
e.enabled = n;
|
|
3425
3474
|
}
|
|
3426
3475
|
//#endregion
|
|
3427
3476
|
//#region src/core/initialRuntimeState.ts
|
|
3428
|
-
function
|
|
3477
|
+
function er(e, t) {
|
|
3429
3478
|
let n = e.initialPage;
|
|
3430
3479
|
return {
|
|
3431
3480
|
activeReelPostId: null,
|
|
3432
|
-
autoScroll:
|
|
3433
|
-
autofill:
|
|
3481
|
+
autoScroll: Cn(e.autoScroll),
|
|
3482
|
+
autofill: pn(e.autofill),
|
|
3434
3483
|
current: n?.current ?? null,
|
|
3435
3484
|
error: null,
|
|
3436
|
-
fill:
|
|
3485
|
+
fill: Fn(e.fill),
|
|
3437
3486
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3438
3487
|
isLoading: !n,
|
|
3439
3488
|
isLoadingMore: !1,
|
|
3440
|
-
items: n ?
|
|
3489
|
+
items: n ? $([], n.items) : [],
|
|
3441
3490
|
layout: t === "reel" ? "reel" : "masonry",
|
|
3442
3491
|
loadMoreLocked: !1,
|
|
3443
3492
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
3444
3493
|
next: n?.next ?? null,
|
|
3445
3494
|
nextPageError: null,
|
|
3446
3495
|
phoneMode: !1,
|
|
3447
|
-
reelAutoAdvance:
|
|
3496
|
+
reelAutoAdvance: Xn(e.reelAutoAdvance),
|
|
3448
3497
|
reelForward: {
|
|
3449
3498
|
error: null,
|
|
3450
3499
|
status: "idle"
|
|
3451
3500
|
},
|
|
3452
3501
|
reelForwardIndex: null,
|
|
3453
3502
|
reelForwardItem: null,
|
|
3454
|
-
reelInfoSheet:
|
|
3503
|
+
reelInfoSheet: Qn(e.reelInfoSheet),
|
|
3455
3504
|
reelInfoSheetOverlay: !1,
|
|
3456
3505
|
reelMediaSource: "original",
|
|
3457
3506
|
reelOrigin: null,
|
|
@@ -3460,20 +3509,20 @@ function Qn(e, t) {
|
|
|
3460
3509
|
}
|
|
3461
3510
|
//#endregion
|
|
3462
3511
|
//#region src/core/options.ts
|
|
3463
|
-
function
|
|
3512
|
+
function tr(e, t) {
|
|
3464
3513
|
if (t) {
|
|
3465
3514
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3466
3515
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3467
3516
|
}
|
|
3468
3517
|
}
|
|
3469
|
-
function
|
|
3518
|
+
function nr(e, t) {
|
|
3470
3519
|
if (t) {
|
|
3471
3520
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3472
3521
|
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.`);
|
|
3473
3522
|
}
|
|
3474
3523
|
}
|
|
3475
|
-
function
|
|
3476
|
-
if (
|
|
3524
|
+
function rr(e) {
|
|
3525
|
+
if (Sn(e.autoScroll), tr("cardHeader", e.cardHeader), tr("cardFooter", e.cardFooter), nr("header", e.mediaCard?.header), nr("footer", e.mediaCard?.footer), fn(e.autofill), Pn(e.fill), se(e.masonry), Yn(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3477
3526
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3478
3527
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3479
3528
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3488,7 +3537,7 @@ function tr(e) {
|
|
|
3488
3537
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3489
3538
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3490
3539
|
}
|
|
3491
|
-
function
|
|
3540
|
+
function ir(e) {
|
|
3492
3541
|
if (typeof e != "string") return e;
|
|
3493
3542
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3494
3543
|
let t = document.querySelector(e);
|
|
@@ -3497,7 +3546,7 @@ function nr(e) {
|
|
|
3497
3546
|
}
|
|
3498
3547
|
//#endregion
|
|
3499
3548
|
//#region src/core/pageRequest.ts
|
|
3500
|
-
async function
|
|
3549
|
+
async function ar({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3501
3550
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
3502
3551
|
received: l.autofill.received,
|
|
3503
3552
|
requests: l.autofill.requests
|
|
@@ -3509,11 +3558,11 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3509
3558
|
let m = !1;
|
|
3510
3559
|
try {
|
|
3511
3560
|
if (u?.strategy === "frontend") {
|
|
3512
|
-
let s = await
|
|
3561
|
+
let s = await _n({
|
|
3513
3562
|
existingItems: e ? l.items : [],
|
|
3514
3563
|
initialCursor: n,
|
|
3515
3564
|
loadPage: i,
|
|
3516
|
-
maximumRequests: f ? Math.max(0,
|
|
3565
|
+
maximumRequests: f ? Math.max(0, ln(u) - f.requests) : void 0,
|
|
3517
3566
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3518
3567
|
onDelayChange: (e) => {
|
|
3519
3568
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3528,7 +3577,7 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3528
3577
|
signal: c
|
|
3529
3578
|
});
|
|
3530
3579
|
if (!r()) return;
|
|
3531
|
-
l.items = e ?
|
|
3580
|
+
l.items = e ? $(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, {
|
|
3532
3581
|
missing: s.missing,
|
|
3533
3582
|
received: s.received,
|
|
3534
3583
|
requests: s.requests,
|
|
@@ -3536,12 +3585,12 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3536
3585
|
}), o(s.pages), t.clearCollection();
|
|
3537
3586
|
return;
|
|
3538
3587
|
}
|
|
3539
|
-
let s =
|
|
3588
|
+
let s = Kt(await i({
|
|
3540
3589
|
cursor: n,
|
|
3541
3590
|
signal: c
|
|
3542
3591
|
}));
|
|
3543
3592
|
if (!r()) return;
|
|
3544
|
-
let d = e ? l.items : [], h =
|
|
3593
|
+
let d = e ? l.items : [], h = $(d, s.items), g = h.length - d.length;
|
|
3545
3594
|
if (l.items = h, a(n), o([{
|
|
3546
3595
|
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
3547
3596
|
cursor: n,
|
|
@@ -3556,7 +3605,7 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3556
3605
|
l.autofill.status = "complete";
|
|
3557
3606
|
return;
|
|
3558
3607
|
}
|
|
3559
|
-
await
|
|
3608
|
+
await Tn(u, l, {
|
|
3560
3609
|
cycleId: p,
|
|
3561
3610
|
feedKey: u.feedKey,
|
|
3562
3611
|
items: h.slice(d.length),
|
|
@@ -3578,16 +3627,16 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3578
3627
|
}
|
|
3579
3628
|
//#endregion
|
|
3580
3629
|
//#region src/core/removalReconciliationController.ts
|
|
3581
|
-
function
|
|
3630
|
+
function or(e) {
|
|
3582
3631
|
return `${typeof e}:${String(e)}`;
|
|
3583
3632
|
}
|
|
3584
|
-
function
|
|
3633
|
+
function sr(e) {
|
|
3585
3634
|
return `${typeof e}:${String(e)}`;
|
|
3586
3635
|
}
|
|
3587
|
-
function
|
|
3636
|
+
function cr(e) {
|
|
3588
3637
|
return e.map(({ postId: e }) => e);
|
|
3589
3638
|
}
|
|
3590
|
-
var
|
|
3639
|
+
var lr = class {
|
|
3591
3640
|
delay;
|
|
3592
3641
|
enabled;
|
|
3593
3642
|
maxReplayPages;
|
|
@@ -3606,7 +3655,7 @@ var sr = class {
|
|
|
3606
3655
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
3607
3656
|
}
|
|
3608
3657
|
filterItems(e) {
|
|
3609
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
3658
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(or(e)));
|
|
3610
3659
|
}
|
|
3611
3660
|
needsReconciliation(e) {
|
|
3612
3661
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -3619,45 +3668,45 @@ var sr = class {
|
|
|
3619
3668
|
}
|
|
3620
3669
|
recordInitialPage(e) {
|
|
3621
3670
|
e && this.recordPages([{
|
|
3622
|
-
contributionIds:
|
|
3623
|
-
cursor:
|
|
3671
|
+
contributionIds: cr(e.items),
|
|
3672
|
+
cursor: Xt(e),
|
|
3624
3673
|
next: e.next,
|
|
3625
|
-
returnedIds:
|
|
3674
|
+
returnedIds: cr(e.items)
|
|
3626
3675
|
}]);
|
|
3627
3676
|
}
|
|
3628
3677
|
remove(e) {
|
|
3629
|
-
e.forEach((e) => this.tombstones.add(
|
|
3678
|
+
e.forEach((e) => this.tombstones.add(or(e)));
|
|
3630
3679
|
}
|
|
3631
3680
|
reset() {
|
|
3632
3681
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
3633
3682
|
}
|
|
3634
3683
|
restore(e) {
|
|
3635
|
-
e.forEach((e) => this.tombstones.delete(
|
|
3684
|
+
e.forEach((e) => this.tombstones.delete(or(e)));
|
|
3636
3685
|
}
|
|
3637
3686
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
3638
3687
|
let a = this.pending ?? this.createSession(e);
|
|
3639
3688
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
3640
|
-
let e =
|
|
3689
|
+
let e = sr(a.cursor);
|
|
3641
3690
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3642
|
-
if (await
|
|
3643
|
-
delayMs:
|
|
3691
|
+
if (await sn({
|
|
3692
|
+
delayMs: an(a.pages.length, this.delay),
|
|
3644
3693
|
onChange: n,
|
|
3645
3694
|
signal: i
|
|
3646
3695
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
3647
|
-
let o =
|
|
3696
|
+
let o = Kt(await t({
|
|
3648
3697
|
cursor: a.cursor,
|
|
3649
3698
|
signal: i
|
|
3650
3699
|
}));
|
|
3651
3700
|
a.seenCursors.add(e);
|
|
3652
3701
|
let s = this.filterItems(o.items), c = [];
|
|
3653
3702
|
if (s.forEach((e) => {
|
|
3654
|
-
let t =
|
|
3703
|
+
let t = or(e.postId);
|
|
3655
3704
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
3656
3705
|
}), a.pages.push({
|
|
3657
3706
|
contributionIds: c,
|
|
3658
3707
|
cursor: a.cursor,
|
|
3659
3708
|
next: o.next,
|
|
3660
|
-
returnedIds:
|
|
3709
|
+
returnedIds: cr(s)
|
|
3661
3710
|
}), a.lastCursor = a.cursor, a.next = o.next, --a.remainingRequests, o.total !== void 0 && (a.total = o.total), a.next === null ? a.remainingRequests = 0 : a.cursor = a.next, a.remainingRequests > 0 && r()) return this.result(a, "paused");
|
|
3662
3711
|
}
|
|
3663
3712
|
return this.result(a, "complete");
|
|
@@ -3665,9 +3714,9 @@ var sr = class {
|
|
|
3665
3714
|
createSession(e) {
|
|
3666
3715
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
3667
3716
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
3668
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
3717
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(or))), a = new Set(e.map(({ postId: e }) => or(e)).filter((e) => !i.has(e)));
|
|
3669
3718
|
return {
|
|
3670
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
3719
|
+
appended: new Set(e.map(({ postId: e }) => or(e))),
|
|
3671
3720
|
attributed: new Set(a),
|
|
3672
3721
|
cursor: r.cursor,
|
|
3673
3722
|
items: [],
|
|
@@ -3692,11 +3741,11 @@ var sr = class {
|
|
|
3692
3741
|
}
|
|
3693
3742
|
findUnderfilledPage(e) {
|
|
3694
3743
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
3695
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
3696
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
3744
|
+
let t = new Set(e.map(({ postId: e }) => or(e)));
|
|
3745
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(or(e))).length < this.pageSize);
|
|
3697
3746
|
}
|
|
3698
3747
|
recordPage(e) {
|
|
3699
|
-
let t =
|
|
3748
|
+
let t = sr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => sr(e) === t);
|
|
3700
3749
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3701
3750
|
...e,
|
|
3702
3751
|
contributionIds: [...e.contributionIds],
|
|
@@ -3706,7 +3755,7 @@ var sr = class {
|
|
|
3706
3755
|
};
|
|
3707
3756
|
//#endregion
|
|
3708
3757
|
//#region src/core/activeItemRemoval.ts
|
|
3709
|
-
function
|
|
3758
|
+
function ur(e, t, n, r, i) {
|
|
3710
3759
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3711
3760
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3712
3761
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3719,7 +3768,7 @@ function cr(e, t, n, r, i) {
|
|
|
3719
3768
|
}
|
|
3720
3769
|
//#endregion
|
|
3721
3770
|
//#region src/core/exactMediaRemovalController.ts
|
|
3722
|
-
function
|
|
3771
|
+
function dr(e, t) {
|
|
3723
3772
|
let [n, ...r] = t;
|
|
3724
3773
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3725
3774
|
return {
|
|
@@ -3728,10 +3777,10 @@ function lr(e, t) {
|
|
|
3728
3777
|
items: r
|
|
3729
3778
|
};
|
|
3730
3779
|
}
|
|
3731
|
-
function
|
|
3780
|
+
function fr(e) {
|
|
3732
3781
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3733
3782
|
}
|
|
3734
|
-
var
|
|
3783
|
+
var pr = class {
|
|
3735
3784
|
generation = 0;
|
|
3736
3785
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3737
3786
|
state;
|
|
@@ -3739,7 +3788,7 @@ var dr = class {
|
|
|
3739
3788
|
this.options = e, this.state = e.state;
|
|
3740
3789
|
}
|
|
3741
3790
|
remove(e) {
|
|
3742
|
-
|
|
3791
|
+
fr(e);
|
|
3743
3792
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3744
3793
|
if (!n) return null;
|
|
3745
3794
|
let r = [...P(n)], i = r[e.mediaIndex];
|
|
@@ -3756,7 +3805,7 @@ var dr = class {
|
|
|
3756
3805
|
restored: !1
|
|
3757
3806
|
});
|
|
3758
3807
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3759
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3808
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = dr(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
|
|
3760
3809
|
}
|
|
3761
3810
|
reset() {
|
|
3762
3811
|
this.generation += 1;
|
|
@@ -3782,7 +3831,7 @@ var dr = class {
|
|
|
3782
3831
|
}
|
|
3783
3832
|
restoreIntoPost(e, t) {
|
|
3784
3833
|
let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3785
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3834
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = dr(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3786
3835
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3787
3836
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3788
3837
|
}
|
|
@@ -3795,18 +3844,18 @@ var dr = class {
|
|
|
3795
3844
|
};
|
|
3796
3845
|
//#endregion
|
|
3797
3846
|
//#region src/core/itemPlacement.ts
|
|
3798
|
-
function
|
|
3847
|
+
function mr(e, t) {
|
|
3799
3848
|
let n = new Set(t);
|
|
3800
3849
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3801
3850
|
index: t,
|
|
3802
3851
|
item: e
|
|
3803
3852
|
}] : []);
|
|
3804
3853
|
}
|
|
3805
|
-
function
|
|
3854
|
+
function hr(e, t) {
|
|
3806
3855
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3807
3856
|
return e.filter((e) => !n.has(e.postId));
|
|
3808
3857
|
}
|
|
3809
|
-
function
|
|
3858
|
+
function gr(e, t) {
|
|
3810
3859
|
t.forEach(({ index: e }) => {
|
|
3811
3860
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3812
3861
|
});
|
|
@@ -3817,7 +3866,7 @@ function mr(e, t) {
|
|
|
3817
3866
|
}
|
|
3818
3867
|
//#endregion
|
|
3819
3868
|
//#region src/core/itemRemovalController.ts
|
|
3820
|
-
var
|
|
3869
|
+
var _r = 20, vr = class {
|
|
3821
3870
|
generation = 0;
|
|
3822
3871
|
historyLimit;
|
|
3823
3872
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3826,7 +3875,7 @@ var hr = 20, gr = class {
|
|
|
3826
3875
|
itemOrder;
|
|
3827
3876
|
stopItemsWatcher;
|
|
3828
3877
|
constructor(e) {
|
|
3829
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3878
|
+
this.options = e, this.historyLimit = e.historyLimit ?? _r, this.state = e.state, this.itemOrder = this.state.items.map(({ postId: e }) => e), this.stopItemsWatcher = O(() => this.state.items, (e) => this.appendUnknownItems(e), { flush: "sync" });
|
|
3830
3879
|
}
|
|
3831
3880
|
destroy() {
|
|
3832
3881
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3840,7 +3889,7 @@ var hr = 20, gr = class {
|
|
|
3840
3889
|
let a = this.options.startRemoval(i, t);
|
|
3841
3890
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
3842
3891
|
let o = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), s = new Set(n.map(({ item: e }) => e.postId)), c = o < 0 ? 0 : this.state.items.slice(0, o).filter(({ postId: e }) => s.has(e)).length, l = Math.max(o - c, 0);
|
|
3843
|
-
return this.state.items =
|
|
3892
|
+
return this.state.items = hr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
3844
3893
|
}
|
|
3845
3894
|
reset() {
|
|
3846
3895
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3851,7 +3900,7 @@ var hr = 20, gr = class {
|
|
|
3851
3900
|
this.restoreRemoval(t);
|
|
3852
3901
|
return;
|
|
3853
3902
|
}
|
|
3854
|
-
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i =
|
|
3903
|
+
let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = gr(this.state.items, r);
|
|
3855
3904
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
3856
3905
|
}
|
|
3857
3906
|
restoreRemoval(e) {
|
|
@@ -3877,7 +3926,7 @@ var hr = 20, gr = class {
|
|
|
3877
3926
|
}
|
|
3878
3927
|
collectOrderedPlacements(e) {
|
|
3879
3928
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3880
|
-
return
|
|
3929
|
+
return mr(this.state.items, e).map((e) => ({
|
|
3881
3930
|
index: t.get(e.item.postId) ?? e.index,
|
|
3882
3931
|
item: e.item
|
|
3883
3932
|
}));
|
|
@@ -3908,7 +3957,7 @@ var hr = 20, gr = class {
|
|
|
3908
3957
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3909
3958
|
return this.state.items = [...this.state.items, ...n].sort((e, t) => (r.get(e.postId) ?? 2 ** 53 - 1) - (r.get(t.postId) ?? 2 ** 53 - 1)), !0;
|
|
3910
3959
|
}
|
|
3911
|
-
},
|
|
3960
|
+
}, yr = class {
|
|
3912
3961
|
forward = null;
|
|
3913
3962
|
forwardPromise = null;
|
|
3914
3963
|
forwardVersion = 0;
|
|
@@ -3995,7 +4044,7 @@ var hr = 20, gr = class {
|
|
|
3995
4044
|
}
|
|
3996
4045
|
}
|
|
3997
4046
|
}
|
|
3998
|
-
},
|
|
4047
|
+
}, br = class {
|
|
3999
4048
|
generation = 0;
|
|
4000
4049
|
pending = Promise.resolve();
|
|
4001
4050
|
constructor(e) {
|
|
@@ -4045,24 +4094,24 @@ var hr = 20, gr = class {
|
|
|
4045
4094
|
};
|
|
4046
4095
|
//#endregion
|
|
4047
4096
|
//#region src/core/removalControllers.ts
|
|
4048
|
-
function
|
|
4049
|
-
let t = new
|
|
4097
|
+
function xr(e) {
|
|
4098
|
+
let t = new yr(e), n = new br({
|
|
4050
4099
|
state: e.state,
|
|
4051
4100
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4052
4101
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4053
4102
|
});
|
|
4054
4103
|
return {
|
|
4055
|
-
exactMediaRemoval: new
|
|
4104
|
+
exactMediaRemoval: new pr({
|
|
4056
4105
|
onActivate: e.onActivate,
|
|
4057
4106
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4058
4107
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4059
4108
|
reelForward: t,
|
|
4060
4109
|
state: e.state
|
|
4061
4110
|
}),
|
|
4062
|
-
itemRemoval: new
|
|
4111
|
+
itemRemoval: new vr({
|
|
4063
4112
|
historyLimit: e.historyLimit,
|
|
4064
4113
|
onItemsRemoved: (n, r, i) => {
|
|
4065
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4114
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), ur(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4066
4115
|
},
|
|
4067
4116
|
onRemovalRestored: (n) => {
|
|
4068
4117
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4077,17 +4126,17 @@ function yr(e) {
|
|
|
4077
4126
|
reelRemoval: n
|
|
4078
4127
|
};
|
|
4079
4128
|
}
|
|
4080
|
-
var
|
|
4081
|
-
function
|
|
4129
|
+
var Sr = 1.5;
|
|
4130
|
+
function Cr(e) {
|
|
4082
4131
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4083
4132
|
if (t > 0 && t < 600) return !0;
|
|
4084
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4133
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Sr;
|
|
4085
4134
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4086
4135
|
}
|
|
4087
|
-
function
|
|
4088
|
-
return
|
|
4136
|
+
function wr(e) {
|
|
4137
|
+
return Cr(e) ? "reel" : "masonry";
|
|
4089
4138
|
}
|
|
4090
|
-
function
|
|
4139
|
+
function Tr(e) {
|
|
4091
4140
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4092
4141
|
return {
|
|
4093
4142
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4097,15 +4146,15 @@ function Cr(e) {
|
|
|
4097
4146
|
viewportWidth: n.clientWidth
|
|
4098
4147
|
};
|
|
4099
4148
|
}
|
|
4100
|
-
function
|
|
4101
|
-
return
|
|
4149
|
+
function Er(e) {
|
|
4150
|
+
return Cr(Tr(e));
|
|
4102
4151
|
}
|
|
4103
|
-
function
|
|
4104
|
-
return
|
|
4152
|
+
function Dr(e) {
|
|
4153
|
+
return wr(Tr(e));
|
|
4105
4154
|
}
|
|
4106
4155
|
//#endregion
|
|
4107
4156
|
//#region src/core/responsiveLayoutController.ts
|
|
4108
|
-
var
|
|
4157
|
+
var Or = class {
|
|
4109
4158
|
layoutMode;
|
|
4110
4159
|
resizeObserver = null;
|
|
4111
4160
|
target = null;
|
|
@@ -4130,10 +4179,10 @@ var Er = class {
|
|
|
4130
4179
|
}
|
|
4131
4180
|
handleResponsiveLayout = () => {
|
|
4132
4181
|
if (!this.target) return;
|
|
4133
|
-
let e =
|
|
4134
|
-
this.state.phoneMode =
|
|
4182
|
+
let e = Dr(this.target);
|
|
4183
|
+
this.state.phoneMode = Er(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4135
4184
|
};
|
|
4136
|
-
},
|
|
4185
|
+
}, kr = class {
|
|
4137
4186
|
routedReelPostId = null;
|
|
4138
4187
|
reelRouteIsActive = !1;
|
|
4139
4188
|
constructor(e, t) {
|
|
@@ -4160,7 +4209,7 @@ var Er = class {
|
|
|
4160
4209
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
4161
4210
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
4162
4211
|
}
|
|
4163
|
-
},
|
|
4212
|
+
}, Ar = class {
|
|
4164
4213
|
app = null;
|
|
4165
4214
|
autoScroll;
|
|
4166
4215
|
autofillController;
|
|
@@ -4182,24 +4231,24 @@ var Er = class {
|
|
|
4182
4231
|
notificationItems;
|
|
4183
4232
|
state;
|
|
4184
4233
|
constructor(e) {
|
|
4185
|
-
this.options = e,
|
|
4234
|
+
this.options = e, rr(e);
|
|
4186
4235
|
let t = e.layout ?? "masonry";
|
|
4187
|
-
this.state = x(
|
|
4236
|
+
this.state = x(er(e, t)), this.lastLoadedCursor = e.initialPage ? Xt(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new wn({
|
|
4188
4237
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4189
4238
|
state: this.state.autoScroll
|
|
4190
|
-
}), this.autofillController = new
|
|
4239
|
+
}), this.autofillController = new vn({
|
|
4191
4240
|
cancelRequest: () => this.cancelRequest(),
|
|
4192
4241
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4193
4242
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4194
4243
|
options: e.autofill,
|
|
4195
4244
|
state: this.state
|
|
4196
|
-
}), this.removalReconciliation = new
|
|
4245
|
+
}), this.removalReconciliation = new lr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Gn({
|
|
4197
4246
|
fill: e.fill,
|
|
4198
4247
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4199
4248
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4200
4249
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4201
4250
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4202
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4251
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Kn({
|
|
4203
4252
|
controller: this.removalReconciliation,
|
|
4204
4253
|
isCurrent: t,
|
|
4205
4254
|
loadPage: e.loadPage,
|
|
@@ -4209,8 +4258,8 @@ var Er = class {
|
|
|
4209
4258
|
state: this.state
|
|
4210
4259
|
}),
|
|
4211
4260
|
state: this.state
|
|
4212
|
-
}), this.routing = new
|
|
4213
|
-
let n =
|
|
4261
|
+
}), this.routing = new kr(e.routing, this.state);
|
|
4262
|
+
let n = xr({
|
|
4214
4263
|
historyLimit: e.removalHistoryLimit,
|
|
4215
4264
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4216
4265
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
@@ -4219,20 +4268,20 @@ var Er = class {
|
|
|
4219
4268
|
state: this.state,
|
|
4220
4269
|
surface: () => this.surface
|
|
4221
4270
|
});
|
|
4222
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
4271
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Or(t, this.state, () => {
|
|
4223
4272
|
this.routing.syncFeed();
|
|
4224
4273
|
}), this.startStateNotifications();
|
|
4225
4274
|
}
|
|
4226
4275
|
async mount() {
|
|
4227
4276
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4228
4277
|
this.startStateNotifications();
|
|
4229
|
-
let e =
|
|
4230
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4278
|
+
let e = ir(this.options.target);
|
|
4279
|
+
this.responsiveLayout.mount(e), this.app = i(Gt, {
|
|
4231
4280
|
canRetryEnd: !!this.options.loadPage,
|
|
4232
4281
|
cardFooter: this.options.cardFooter,
|
|
4233
4282
|
cardHeader: this.options.cardHeader,
|
|
4234
4283
|
feedFooter: this.options.feedFooter,
|
|
4235
|
-
feedFooterActions:
|
|
4284
|
+
feedFooterActions: qn(this),
|
|
4236
4285
|
mediaCard: this.options.mediaCard,
|
|
4237
4286
|
masonry: this.options.masonry,
|
|
4238
4287
|
onMediaReady: this.options.onMediaReady,
|
|
@@ -4255,7 +4304,7 @@ var Er = class {
|
|
|
4255
4304
|
onRetryForward: () => {
|
|
4256
4305
|
this.retryReelForward();
|
|
4257
4306
|
}
|
|
4258
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
4307
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await kn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
4259
4308
|
this.restoreController = e;
|
|
4260
4309
|
}), !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();
|
|
4261
4310
|
}
|
|
@@ -4320,7 +4369,7 @@ var Er = class {
|
|
|
4320
4369
|
this.autoScroll.setSpeed(e);
|
|
4321
4370
|
}
|
|
4322
4371
|
applyAutofillUpdate(e) {
|
|
4323
|
-
let t =
|
|
4372
|
+
let t = Dn(this.options.autofill, this.state, e);
|
|
4324
4373
|
return t && this.autofillController.syncCountdown(), t;
|
|
4325
4374
|
}
|
|
4326
4375
|
cancelAutofill() {
|
|
@@ -4331,7 +4380,7 @@ var Er = class {
|
|
|
4331
4380
|
await this.cancelFill();
|
|
4332
4381
|
return;
|
|
4333
4382
|
}
|
|
4334
|
-
if (
|
|
4383
|
+
if (mn(this.state.autofill)) {
|
|
4335
4384
|
await this.cancelAutofill();
|
|
4336
4385
|
return;
|
|
4337
4386
|
}
|
|
@@ -4345,12 +4394,12 @@ var Er = class {
|
|
|
4345
4394
|
}
|
|
4346
4395
|
async fill(e) {
|
|
4347
4396
|
if (!this.state.loadMoreLocked) {
|
|
4348
|
-
if (this.pendingRequest ||
|
|
4397
|
+
if (this.pendingRequest || mn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4349
4398
|
await this.fillController.start(e);
|
|
4350
4399
|
}
|
|
4351
4400
|
}
|
|
4352
4401
|
restoreAutofillSession(e) {
|
|
4353
|
-
let t =
|
|
4402
|
+
let t = On(this.options.autofill, this.state, e);
|
|
4354
4403
|
return t && this.autofillController.syncCountdown(), t;
|
|
4355
4404
|
}
|
|
4356
4405
|
restoreFillSession(e) {
|
|
@@ -4360,14 +4409,14 @@ var Er = class {
|
|
|
4360
4409
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
4361
4410
|
}
|
|
4362
4411
|
appendPage(e) {
|
|
4363
|
-
|
|
4412
|
+
Zt(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
4364
4413
|
}
|
|
4365
4414
|
replenishAfterRemoval() {
|
|
4366
4415
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
4367
4416
|
}
|
|
4368
4417
|
async startLoadMore(e) {
|
|
4369
4418
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4370
|
-
if (this.state.loadMoreLocked ||
|
|
4419
|
+
if (this.state.loadMoreLocked || mn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
4371
4420
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4372
4421
|
let t = e();
|
|
4373
4422
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -4382,12 +4431,12 @@ var Er = class {
|
|
|
4382
4431
|
}
|
|
4383
4432
|
async replaceFeed(e, t) {
|
|
4384
4433
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4385
|
-
return
|
|
4434
|
+
return mn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = pn(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);
|
|
4386
4435
|
}
|
|
4387
4436
|
async loadFilteredPage(e) {
|
|
4388
4437
|
let t = this.options.loadPage;
|
|
4389
4438
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4390
|
-
let n =
|
|
4439
|
+
let n = Kt(await t(e));
|
|
4391
4440
|
return {
|
|
4392
4441
|
...n,
|
|
4393
4442
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4406,7 +4455,7 @@ var Er = class {
|
|
|
4406
4455
|
let t = ++this.requestVersion, n = new AbortController();
|
|
4407
4456
|
this.abortController = n;
|
|
4408
4457
|
try {
|
|
4409
|
-
let r = await
|
|
4458
|
+
let r = await Kn({
|
|
4410
4459
|
controller: this.removalReconciliation,
|
|
4411
4460
|
isCurrent: () => t === this.requestVersion,
|
|
4412
4461
|
loadPage: e,
|
|
@@ -4424,7 +4473,7 @@ var Er = class {
|
|
|
4424
4473
|
}
|
|
4425
4474
|
async retryEnd() {
|
|
4426
4475
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4427
|
-
if (!this.state.loadMoreLocked && !(
|
|
4476
|
+
if (!this.state.loadMoreLocked && !(mn(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);
|
|
4428
4477
|
}
|
|
4429
4478
|
setInfiniteScroll(e) {
|
|
4430
4479
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4448,10 +4497,10 @@ var Er = class {
|
|
|
4448
4497
|
this.state.total = e;
|
|
4449
4498
|
}
|
|
4450
4499
|
setReelAutoAdvance(e) {
|
|
4451
|
-
|
|
4500
|
+
Zn(this.state.reelAutoAdvance, e);
|
|
4452
4501
|
}
|
|
4453
4502
|
setReelInfoSheet(e) {
|
|
4454
|
-
|
|
4503
|
+
$n(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4455
4504
|
}
|
|
4456
4505
|
setLayout(e) {
|
|
4457
4506
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4471,7 +4520,7 @@ var Er = class {
|
|
|
4471
4520
|
async fetchPage(e, t) {
|
|
4472
4521
|
if (!this.options.loadPage) return;
|
|
4473
4522
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4474
|
-
this.abortController = r, await
|
|
4523
|
+
this.abortController = r, await ar({
|
|
4475
4524
|
append: t,
|
|
4476
4525
|
autofillController: this.autofillController,
|
|
4477
4526
|
cursor: e,
|
|
@@ -4493,7 +4542,7 @@ var Er = class {
|
|
|
4493
4542
|
startInitialAutofill() {
|
|
4494
4543
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4495
4544
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4496
|
-
let r =
|
|
4545
|
+
let r = An({
|
|
4497
4546
|
cycleId: n,
|
|
4498
4547
|
isCurrent: () => e === this.requestVersion,
|
|
4499
4548
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4520,8 +4569,8 @@ var Er = class {
|
|
|
4520
4569
|
this.lastLoadedCursor = e, this.state.current = e;
|
|
4521
4570
|
}
|
|
4522
4571
|
};
|
|
4523
|
-
function
|
|
4524
|
-
return new
|
|
4572
|
+
function jr(e) {
|
|
4573
|
+
return new Ar(e);
|
|
4525
4574
|
}
|
|
4526
4575
|
//#endregion
|
|
4527
|
-
export {
|
|
4576
|
+
export { jr as createVibe };
|