@wyxos/vibe 5.7.1 → 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 -687
- 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,52 +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
1418
|
() => d.masonry
|
|
1369
|
-
],
|
|
1419
|
+
], X, { flush: "post" }), v(() => {
|
|
1370
1420
|
N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
|
|
1371
1421
|
}), n({
|
|
1372
|
-
getScrollElement:
|
|
1373
|
-
loadIfNearBottom:
|
|
1374
|
-
}), (n, r) => (b(), s("div",
|
|
1422
|
+
getScrollElement: me,
|
|
1423
|
+
loadIfNearBottom: pe
|
|
1424
|
+
}), (n, r) => (b(), s("div", pt, [
|
|
1375
1425
|
c("main", {
|
|
1376
1426
|
id: m,
|
|
1377
1427
|
ref_key: "galleryElement",
|
|
@@ -1380,14 +1430,14 @@ var Xe = [
|
|
|
1380
1430
|
"data-layout-mode": "masonry",
|
|
1381
1431
|
"aria-hidden": t.suspended || void 0,
|
|
1382
1432
|
inert: t.suspended || void 0,
|
|
1383
|
-
onScrollPassive:
|
|
1433
|
+
onScrollPassive: fe
|
|
1384
1434
|
}, [c("section", {
|
|
1385
1435
|
ref_key: "masonryElement",
|
|
1386
1436
|
ref: g,
|
|
1387
1437
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
1388
1438
|
style: _(U.value),
|
|
1389
1439
|
"aria-label": "Media gallery"
|
|
1390
|
-
}, [(b(!0), s(e, null, S(
|
|
1440
|
+
}, [(b(!0), s(e, null, S(q.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(ft, {
|
|
1391
1441
|
key: n.postId,
|
|
1392
1442
|
class: "masonry-item",
|
|
1393
1443
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1398,7 +1448,7 @@ var Xe = [
|
|
|
1398
1448
|
"media-card": t.mediaCard,
|
|
1399
1449
|
index: r,
|
|
1400
1450
|
item: n,
|
|
1401
|
-
"item-style":
|
|
1451
|
+
"item-style": le(r),
|
|
1402
1452
|
interactive: "",
|
|
1403
1453
|
layout: "masonry",
|
|
1404
1454
|
"loaded-count": t.items.length,
|
|
@@ -1427,8 +1477,8 @@ var Xe = [
|
|
|
1427
1477
|
"onMediaChange",
|
|
1428
1478
|
"onReady",
|
|
1429
1479
|
"onError"
|
|
1430
|
-
]))), 128))], 6)], 42,
|
|
1431
|
-
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, {
|
|
1432
1482
|
actions: t.feedFooterActions,
|
|
1433
1483
|
"can-retry-end": t.canRetryEnd,
|
|
1434
1484
|
"feed-footer": t.feedFooter,
|
|
@@ -1451,7 +1501,7 @@ var Xe = [
|
|
|
1451
1501
|
"show-load-more",
|
|
1452
1502
|
"state"
|
|
1453
1503
|
])])) : o("", !0),
|
|
1454
|
-
u(
|
|
1504
|
+
u(he, {
|
|
1455
1505
|
"content-size": B.value.height,
|
|
1456
1506
|
"controls-id": m,
|
|
1457
1507
|
"scroll-element": p.value,
|
|
@@ -1463,8 +1513,8 @@ var Xe = [
|
|
|
1463
1513
|
])
|
|
1464
1514
|
]));
|
|
1465
1515
|
}
|
|
1466
|
-
}),
|
|
1467
|
-
function
|
|
1516
|
+
}), bt = 300;
|
|
1517
|
+
function xt(e, t, n) {
|
|
1468
1518
|
let r = e.scrollTop;
|
|
1469
1519
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1470
1520
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1472,7 +1522,7 @@ function bt(e, t, n) {
|
|
|
1472
1522
|
return new Promise((n) => {
|
|
1473
1523
|
let o = (s) => {
|
|
1474
1524
|
a += 1;
|
|
1475
|
-
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;
|
|
1476
1526
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1477
1527
|
requestAnimationFrame(o);
|
|
1478
1528
|
return;
|
|
@@ -1484,7 +1534,7 @@ function bt(e, t, n) {
|
|
|
1484
1534
|
}
|
|
1485
1535
|
//#endregion
|
|
1486
1536
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1487
|
-
var
|
|
1537
|
+
var St = ["aria-label"], Ct = /* @__PURE__ */ d({
|
|
1488
1538
|
__name: "ReelAutoAdvanceProgress",
|
|
1489
1539
|
props: {
|
|
1490
1540
|
durationMs: {},
|
|
@@ -1502,9 +1552,9 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1502
1552
|
class: "reel-auto-advance-progress",
|
|
1503
1553
|
style: _(a.value),
|
|
1504
1554
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1505
|
-
}, null, 36)], 8,
|
|
1555
|
+
}, null, 36)], 8, St));
|
|
1506
1556
|
}
|
|
1507
|
-
}),
|
|
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({
|
|
1508
1558
|
__name: "ReelFeed",
|
|
1509
1559
|
props: {
|
|
1510
1560
|
initialPostId: {},
|
|
@@ -1542,7 +1592,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1542
1592
|
],
|
|
1543
1593
|
setup(t, { expose: n, emit: i }) {
|
|
1544
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(() => {
|
|
1545
|
-
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);
|
|
1546
1596
|
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
1547
1597
|
fetchPriority: e + n === x.value ? "high" : "low",
|
|
1548
1598
|
index: e + n,
|
|
@@ -1551,10 +1601,10 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1551
1601
|
}), z = r(() => u.items[x.value]?.postId), B = r(() => u.items[x.value]), V = r(() => {
|
|
1552
1602
|
let e = z.value;
|
|
1553
1603
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
1554
|
-
}),
|
|
1604
|
+
}), ee = r(() => {
|
|
1555
1605
|
let e = z.value;
|
|
1556
1606
|
return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
|
|
1557
|
-
}),
|
|
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(() => [
|
|
1558
1608
|
z.value,
|
|
1559
1609
|
V.value,
|
|
1560
1610
|
u.items.length,
|
|
@@ -1562,52 +1612,52 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1562
1612
|
u.reelAutoAdvance.enabled,
|
|
1563
1613
|
u.reelAutoAdvance.includePostItems,
|
|
1564
1614
|
u.reelAutoAdvance.intervalMs
|
|
1565
|
-
].join(":")),
|
|
1615
|
+
].join(":")), q = r(() => {
|
|
1566
1616
|
let e = B.value, t = !!(e && u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
1567
1617
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1568
|
-
}),
|
|
1569
|
-
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) {
|
|
1570
1620
|
return { gridRow: `${e + 1}` };
|
|
1571
1621
|
}
|
|
1572
|
-
function
|
|
1622
|
+
function ie(e) {
|
|
1573
1623
|
let t = k || e.clientHeight;
|
|
1574
1624
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1575
1625
|
}
|
|
1576
|
-
function
|
|
1626
|
+
function ae(e) {
|
|
1577
1627
|
let t = e.currentTarget;
|
|
1578
1628
|
if (!t) return;
|
|
1579
1629
|
let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
1580
|
-
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");
|
|
1581
1631
|
}
|
|
1582
|
-
function
|
|
1632
|
+
function X() {
|
|
1583
1633
|
let e = f.value;
|
|
1584
|
-
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(() => {
|
|
1585
1635
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
1586
|
-
}),
|
|
1636
|
+
}), Z());
|
|
1587
1637
|
}
|
|
1588
|
-
function
|
|
1638
|
+
function Z() {
|
|
1589
1639
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
1590
1640
|
M = null;
|
|
1591
1641
|
let e = f.value;
|
|
1592
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1642
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), oe(!1);
|
|
1593
1643
|
}, 120);
|
|
1594
1644
|
}
|
|
1595
|
-
function
|
|
1596
|
-
|
|
1645
|
+
function Q() {
|
|
1646
|
+
oe(!0);
|
|
1597
1647
|
let e = f.value;
|
|
1598
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
1648
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), Z();
|
|
1599
1649
|
}
|
|
1600
|
-
function
|
|
1650
|
+
function oe(e) {
|
|
1601
1651
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
1602
1652
|
}
|
|
1603
|
-
function
|
|
1653
|
+
function se() {
|
|
1604
1654
|
let e = f.value;
|
|
1605
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
1655
|
+
Date.now() >= l && !u.loadMoreLocked && e && J(e) && d("loadMore");
|
|
1606
1656
|
}
|
|
1607
1657
|
O(() => u.items.length, (e, t) => {
|
|
1608
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1658
|
+
e > 0 && e < t && (l = Date.now() + kt);
|
|
1609
1659
|
});
|
|
1610
|
-
function
|
|
1660
|
+
function ce(e) {
|
|
1611
1661
|
let t = B.value;
|
|
1612
1662
|
if (!t) return !1;
|
|
1613
1663
|
let n = P(t).length;
|
|
@@ -1615,34 +1665,34 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1615
1665
|
let r = (V.value + e + n) % n;
|
|
1616
1666
|
return d("mediaChange", t.postId, r), !0;
|
|
1617
1667
|
}
|
|
1618
|
-
function
|
|
1668
|
+
function le(e) {
|
|
1619
1669
|
let t = x.value + e;
|
|
1620
|
-
return !f.value || t < 0 || t >= u.items.length ? !1 : (
|
|
1670
|
+
return !f.value || t < 0 || t >= u.items.length ? !1 : (pe(t), !0);
|
|
1621
1671
|
}
|
|
1622
|
-
function
|
|
1672
|
+
function ue(e, t) {
|
|
1623
1673
|
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
1624
|
-
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);
|
|
1625
1675
|
}
|
|
1626
|
-
function
|
|
1676
|
+
function de() {
|
|
1627
1677
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1628
1678
|
}
|
|
1629
|
-
function
|
|
1679
|
+
function fe(e) {
|
|
1630
1680
|
let t = f.value;
|
|
1631
1681
|
if (!t) return Promise.resolve();
|
|
1632
1682
|
let n = e * (k || t.clientHeight);
|
|
1633
|
-
return x.value = e,
|
|
1683
|
+
return x.value = e, xt(t, n, de());
|
|
1634
1684
|
}
|
|
1635
|
-
function
|
|
1636
|
-
|
|
1685
|
+
function pe(e) {
|
|
1686
|
+
fe(e);
|
|
1637
1687
|
}
|
|
1638
|
-
async function
|
|
1688
|
+
async function me(e) {
|
|
1639
1689
|
let t = u.items.findIndex((t) => t.postId === e);
|
|
1640
|
-
return t < 0 || t === x.value ? !1 : (await
|
|
1690
|
+
return t < 0 || t === x.value ? !1 : (await fe(t), !0);
|
|
1641
1691
|
}
|
|
1642
|
-
async function
|
|
1643
|
-
return
|
|
1692
|
+
async function he(e) {
|
|
1693
|
+
return ce(e) ? (de() || await new Promise((e) => setTimeout(e, Ot)), !0) : !1;
|
|
1644
1694
|
}
|
|
1645
|
-
function
|
|
1695
|
+
function ge() {
|
|
1646
1696
|
if (!u.reelAutoAdvance.enabled) return;
|
|
1647
1697
|
let e = B.value;
|
|
1648
1698
|
if (!e) return;
|
|
@@ -1655,31 +1705,31 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1655
1705
|
u.hasNext && !u.loadMoreLocked && d("loadMore");
|
|
1656
1706
|
return;
|
|
1657
1707
|
}
|
|
1658
|
-
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);
|
|
1659
1709
|
}
|
|
1660
|
-
function
|
|
1661
|
-
!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();
|
|
1662
1712
|
}
|
|
1663
1713
|
return O(f, (e) => {
|
|
1664
|
-
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)));
|
|
1665
1715
|
}), O(() => u.items.length, async (e) => {
|
|
1666
1716
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
1667
|
-
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();
|
|
1668
1718
|
}), O(z, (e) => {
|
|
1669
1719
|
e !== void 0 && d("activeChange", e);
|
|
1670
1720
|
}, { immediate: !0 }), y(() => {
|
|
1671
|
-
window.addEventListener("resize",
|
|
1721
|
+
window.addEventListener("resize", Q), window.addEventListener("orientationchange", Q), g >= 0 && m(X);
|
|
1672
1722
|
}), v(() => {
|
|
1673
|
-
window.removeEventListener("resize",
|
|
1723
|
+
window.removeEventListener("resize", Q), window.removeEventListener("orientationchange", Q), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
1674
1724
|
}), n({
|
|
1675
1725
|
activeIndex: x,
|
|
1676
1726
|
activePostId: z,
|
|
1677
|
-
changeActiveMedia:
|
|
1678
|
-
loadIfNearBottom:
|
|
1679
|
-
moveActivePost:
|
|
1680
|
-
navigateToItem:
|
|
1681
|
-
transitionActiveMedia:
|
|
1682
|
-
transitionActivePost:
|
|
1727
|
+
changeActiveMedia: ce,
|
|
1728
|
+
loadIfNearBottom: se,
|
|
1729
|
+
moveActivePost: le,
|
|
1730
|
+
navigateToItem: ue,
|
|
1731
|
+
transitionActiveMedia: he,
|
|
1732
|
+
transitionActivePost: me
|
|
1683
1733
|
}), (n, r) => (b(), s("main", {
|
|
1684
1734
|
class: h(["reel-shell", {
|
|
1685
1735
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1687,7 +1737,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1687
1737
|
}]),
|
|
1688
1738
|
"data-layout-mode": "reel"
|
|
1689
1739
|
}, [
|
|
1690
|
-
t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1740
|
+
t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
|
|
1691
1741
|
key: 0,
|
|
1692
1742
|
index: x.value,
|
|
1693
1743
|
item: B.value,
|
|
@@ -1709,19 +1759,19 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1709
1759
|
"style",
|
|
1710
1760
|
"total"
|
|
1711
1761
|
])) : o("", !0),
|
|
1712
|
-
c("div",
|
|
1762
|
+
c("div", wt, [c("div", {
|
|
1713
1763
|
ref_key: "galleryElement",
|
|
1714
1764
|
ref: f,
|
|
1715
1765
|
class: "gallery-shell reel-feed",
|
|
1716
1766
|
"data-active-post-id": z.value,
|
|
1717
1767
|
"data-active-media-index": V.value,
|
|
1718
|
-
onScrollPassive:
|
|
1768
|
+
onScrollPassive: ae
|
|
1719
1769
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1720
1770
|
key: 1,
|
|
1721
1771
|
class: "reel-track",
|
|
1722
1772
|
style: _(F.value),
|
|
1723
1773
|
"aria-label": "Media gallery"
|
|
1724
|
-
}, [(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, {
|
|
1725
1775
|
key: n.postId,
|
|
1726
1776
|
active: r === x.value && !C.value,
|
|
1727
1777
|
"advance-on-media-end": u.reelAutoAdvance.enabled && r === x.value,
|
|
@@ -1730,7 +1780,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1730
1780
|
"fetch-priority": e,
|
|
1731
1781
|
index: r,
|
|
1732
1782
|
item: n,
|
|
1733
|
-
"item-style":
|
|
1783
|
+
"item-style": re(r),
|
|
1734
1784
|
"media-card": t.mediaCard,
|
|
1735
1785
|
layout: "reel",
|
|
1736
1786
|
"loaded-count": t.items.length,
|
|
@@ -1741,7 +1791,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1741
1791
|
"stationary-reel-controls": "",
|
|
1742
1792
|
total: t.total,
|
|
1743
1793
|
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
1744
|
-
onEnded: (e) =>
|
|
1794
|
+
onEnded: (e) => _e(n.postId, e),
|
|
1745
1795
|
onReady: (e) => d("ready", n.postId, e),
|
|
1746
1796
|
onError: (e) => d("error", n.postId, e)
|
|
1747
1797
|
}, null, 8, [
|
|
@@ -1767,12 +1817,12 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1767
1817
|
class: "reel-forward-status",
|
|
1768
1818
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1769
1819
|
"data-status": t.reelForward.status
|
|
1770
|
-
}, [c("p", null, T(
|
|
1820
|
+
}, [c("p", null, T(Y.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1771
1821
|
key: 0,
|
|
1772
1822
|
class: "reel-forward-retry",
|
|
1773
1823
|
type: "button",
|
|
1774
1824
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
1775
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1825
|
+
}, " Retry ")) : o("", !0)], 8, Et)), t.reelForward.status === "idle" ? (b(), a(G, {
|
|
1776
1826
|
key: 2,
|
|
1777
1827
|
actions: t.feedFooterActions,
|
|
1778
1828
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1781,7 +1831,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1781
1831
|
"has-next": t.hasNext,
|
|
1782
1832
|
"is-loading": t.isLoadingMore,
|
|
1783
1833
|
"load-more-locked": t.loadMoreLocked,
|
|
1784
|
-
"show-load-more":
|
|
1834
|
+
"show-load-more": ne.value,
|
|
1785
1835
|
state: t.state,
|
|
1786
1836
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1787
1837
|
onRetryEnd: r[2] ||= (e) => d("retryEnd")
|
|
@@ -1795,13 +1845,13 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1795
1845
|
"load-more-locked",
|
|
1796
1846
|
"show-load-more",
|
|
1797
1847
|
"state"
|
|
1798
|
-
])) : o("", !0)], 40,
|
|
1848
|
+
])) : o("", !0)], 40, Tt), c("div", {
|
|
1799
1849
|
ref_key: "reelControlsElement",
|
|
1800
1850
|
ref: p,
|
|
1801
1851
|
class: "reel-media-controls-host",
|
|
1802
1852
|
"data-test": "reel-media-controls-host"
|
|
1803
1853
|
}, null, 512)]),
|
|
1804
|
-
t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1854
|
+
t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
|
|
1805
1855
|
key: 1,
|
|
1806
1856
|
index: x.value,
|
|
1807
1857
|
item: B.value,
|
|
@@ -1823,24 +1873,24 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1823
1873
|
"style",
|
|
1824
1874
|
"total"
|
|
1825
1875
|
])) : o("", !0),
|
|
1826
|
-
|
|
1827
|
-
key:
|
|
1876
|
+
te.value ? (b(), a(Ct, {
|
|
1877
|
+
key: K.value,
|
|
1828
1878
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1829
|
-
label:
|
|
1830
|
-
onComplete:
|
|
1879
|
+
label: q.value,
|
|
1880
|
+
onComplete: ge
|
|
1831
1881
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1832
1882
|
], 2));
|
|
1833
1883
|
}
|
|
1834
|
-
}),
|
|
1884
|
+
}), jt = ["data-info-sheet-open", "data-info-sheet-mode"], Mt = ["aria-hidden", "inert"], Nt = {
|
|
1835
1885
|
key: 0,
|
|
1836
1886
|
class: "reel-info-sheet-layer",
|
|
1837
1887
|
"data-test": "reel-info-sheet"
|
|
1838
|
-
},
|
|
1888
|
+
}, Pt = [
|
|
1839
1889
|
"role",
|
|
1840
1890
|
"aria-modal",
|
|
1841
1891
|
"tabindex",
|
|
1842
1892
|
"data-active-post-id"
|
|
1843
|
-
],
|
|
1893
|
+
], Ft = /* @__PURE__ */ d({
|
|
1844
1894
|
__name: "ReelLayout",
|
|
1845
1895
|
props: {
|
|
1846
1896
|
forwardIndex: { default: null },
|
|
@@ -1930,10 +1980,10 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1930
1980
|
function V(e, t) {
|
|
1931
1981
|
d("error", e, t);
|
|
1932
1982
|
}
|
|
1933
|
-
function
|
|
1983
|
+
function ee(e, t) {
|
|
1934
1984
|
d("mediaChange", e, t);
|
|
1935
1985
|
}
|
|
1936
|
-
function
|
|
1986
|
+
function H(e, t) {
|
|
1937
1987
|
d("ready", e, t);
|
|
1938
1988
|
}
|
|
1939
1989
|
return O(() => ({
|
|
@@ -1965,7 +2015,7 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1965
2015
|
class: "reel-layout-main",
|
|
1966
2016
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1967
2017
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1968
|
-
}, [u(
|
|
2018
|
+
}, [u(At, {
|
|
1969
2019
|
ref_key: "reelFeed",
|
|
1970
2020
|
ref: p,
|
|
1971
2021
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1991,8 +2041,8 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
1991
2041
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
1992
2042
|
onError: V,
|
|
1993
2043
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1994
|
-
onMediaChange:
|
|
1995
|
-
onReady:
|
|
2044
|
+
onMediaChange: ee,
|
|
2045
|
+
onReady: H,
|
|
1996
2046
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1997
2047
|
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1998
2048
|
}, null, 8, [
|
|
@@ -2016,8 +2066,8 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
2016
2066
|
"reel-forward",
|
|
2017
2067
|
"state",
|
|
2018
2068
|
"total"
|
|
2019
|
-
])], 8,
|
|
2020
|
-
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", {
|
|
2021
2071
|
ref_key: "sheetElement",
|
|
2022
2072
|
ref: _,
|
|
2023
2073
|
class: "reel-info-sheet",
|
|
@@ -2026,14 +2076,14 @@ var xt = ["aria-label"], St = /* @__PURE__ */ d({
|
|
|
2026
2076
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2027
2077
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2028
2078
|
"data-active-post-id": T.value?.postId
|
|
2029
|
-
}, [(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)]),
|
|
2030
2080
|
_: 1
|
|
2031
|
-
})], 10,
|
|
2081
|
+
})], 10, jt));
|
|
2032
2082
|
}
|
|
2033
2083
|
});
|
|
2034
2084
|
//#endregion
|
|
2035
2085
|
//#region src/core/mediaLifecycle.ts
|
|
2036
|
-
function
|
|
2086
|
+
function It(e, t, n, r, i) {
|
|
2037
2087
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2038
2088
|
if (!o) return null;
|
|
2039
2089
|
let s = F(o, n), c = I(o, s);
|
|
@@ -2049,7 +2099,7 @@ function Ft(e, t, n, r, i) {
|
|
|
2049
2099
|
postIndex: a
|
|
2050
2100
|
};
|
|
2051
2101
|
}
|
|
2052
|
-
function
|
|
2102
|
+
function Lt(e, t) {
|
|
2053
2103
|
O(() => {
|
|
2054
2104
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2055
2105
|
return {
|
|
@@ -2059,20 +2109,20 @@ function It(e, t) {
|
|
|
2059
2109
|
};
|
|
2060
2110
|
}, (n, r) => {
|
|
2061
2111
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2062
|
-
let i =
|
|
2112
|
+
let i = It(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2063
2113
|
i && t(i);
|
|
2064
2114
|
}, { flush: "sync" });
|
|
2065
2115
|
}
|
|
2066
2116
|
//#endregion
|
|
2067
2117
|
//#region src/components/useMediaLifecycle.ts
|
|
2068
|
-
function
|
|
2118
|
+
function Rt(e, t) {
|
|
2069
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);
|
|
2070
2120
|
function c(e, t, n, r) {
|
|
2071
2121
|
let i = L(t, n);
|
|
2072
2122
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2073
2123
|
}
|
|
2074
2124
|
function l(t, n, r, i) {
|
|
2075
|
-
return
|
|
2125
|
+
return It(e, t, n, r, i);
|
|
2076
2126
|
}
|
|
2077
2127
|
function u(e, n, r, i) {
|
|
2078
2128
|
let a = l(e, n, r, i);
|
|
@@ -2094,7 +2144,7 @@ function Lt(e, t) {
|
|
|
2094
2144
|
let r = l(e, n, "masonry", null);
|
|
2095
2145
|
r && t.visible(r);
|
|
2096
2146
|
}
|
|
2097
|
-
return
|
|
2147
|
+
return Lt(e, t.reelChange), O(() => {
|
|
2098
2148
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2099
2149
|
return {
|
|
2100
2150
|
mediaIndex: n,
|
|
@@ -2119,16 +2169,16 @@ function Lt(e, t) {
|
|
|
2119
2169
|
}
|
|
2120
2170
|
//#endregion
|
|
2121
2171
|
//#region src/core/reelEscapeStack.ts
|
|
2122
|
-
var
|
|
2123
|
-
function
|
|
2124
|
-
return
|
|
2125
|
-
let t =
|
|
2126
|
-
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);
|
|
2127
2177
|
};
|
|
2128
2178
|
}
|
|
2129
|
-
function
|
|
2179
|
+
function Vt(e) {
|
|
2130
2180
|
if (!e.isActive()) return !1;
|
|
2131
|
-
let t =
|
|
2181
|
+
let t = zt.filter((e) => e.isActive()), n = e.element();
|
|
2132
2182
|
return n !== null && t.some((t) => {
|
|
2133
2183
|
if (t === e) return !1;
|
|
2134
2184
|
let r = t.element();
|
|
@@ -2144,14 +2194,14 @@ function Bt(e) {
|
|
|
2144
2194
|
}
|
|
2145
2195
|
//#endregion
|
|
2146
2196
|
//#region src/components/useReelKeyboard.ts
|
|
2147
|
-
function
|
|
2197
|
+
function Ht(e) {
|
|
2148
2198
|
let t = {
|
|
2149
2199
|
element: e.element,
|
|
2150
2200
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2151
2201
|
}, n = null;
|
|
2152
2202
|
function r(n) {
|
|
2153
2203
|
let r = t.isActive();
|
|
2154
|
-
if (n.key === "Escape" && r && !
|
|
2204
|
+
if (n.key === "Escape" && r && !Vt(t)) return;
|
|
2155
2205
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2156
2206
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2157
2207
|
return;
|
|
@@ -2171,14 +2221,14 @@ function Vt(e) {
|
|
|
2171
2221
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2172
2222
|
}
|
|
2173
2223
|
y(() => {
|
|
2174
|
-
n =
|
|
2224
|
+
n = Bt(t), window.addEventListener("keydown", r);
|
|
2175
2225
|
}), v(() => {
|
|
2176
2226
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2177
2227
|
});
|
|
2178
2228
|
}
|
|
2179
2229
|
//#endregion
|
|
2180
2230
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2181
|
-
var
|
|
2231
|
+
var Ut = 35, Wt = 420, Gt = /* @__PURE__ */ d({
|
|
2182
2232
|
__name: "VibeSurface",
|
|
2183
2233
|
props: {
|
|
2184
2234
|
canRetryEnd: { type: Boolean },
|
|
@@ -2204,70 +2254,70 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2204
2254
|
"retryForward"
|
|
2205
2255
|
],
|
|
2206
2256
|
setup(t, { expose: i, emit: c }) {
|
|
2207
|
-
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, {
|
|
2208
2258
|
ready: (e) => d("mediaReady", e),
|
|
2209
2259
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2210
2260
|
visible: (e) => d("mediaVisible", e)
|
|
2211
|
-
}),
|
|
2212
|
-
function
|
|
2261
|
+
}), H = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
|
|
2262
|
+
function K() {
|
|
2213
2263
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2214
2264
|
}
|
|
2215
|
-
function
|
|
2265
|
+
function q() {
|
|
2216
2266
|
U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
|
|
2217
2267
|
U = requestAnimationFrame(() => {
|
|
2218
2268
|
U = null, S.value = /* @__PURE__ */ new Set();
|
|
2219
2269
|
});
|
|
2220
2270
|
});
|
|
2221
2271
|
}
|
|
2222
|
-
function
|
|
2272
|
+
function J(e, t) {
|
|
2223
2273
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2224
2274
|
if (!n) return;
|
|
2225
2275
|
let r = F(n, t);
|
|
2226
2276
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2227
2277
|
}
|
|
2228
|
-
async function
|
|
2278
|
+
async function ne() {
|
|
2229
2279
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2230
2280
|
}
|
|
2231
|
-
function
|
|
2281
|
+
function Y(e) {
|
|
2232
2282
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2233
2283
|
}
|
|
2234
|
-
function
|
|
2284
|
+
function re(e) {
|
|
2235
2285
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2236
2286
|
}
|
|
2237
|
-
function
|
|
2287
|
+
function ie(e) {
|
|
2238
2288
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
2239
2289
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
2240
2290
|
if (!t) return "not-found";
|
|
2241
2291
|
let n = P(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
2242
2292
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
2243
2293
|
}
|
|
2244
|
-
function
|
|
2294
|
+
function ae() {
|
|
2245
2295
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2246
2296
|
}
|
|
2247
|
-
function
|
|
2248
|
-
W = e,
|
|
2297
|
+
function X(e, t) {
|
|
2298
|
+
W = e, G = t === "keyboard", y.value = se(e), d("openReel", e), m(() => h.value?.focus());
|
|
2249
2299
|
}
|
|
2250
|
-
function
|
|
2300
|
+
function Z(e) {
|
|
2251
2301
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2252
2302
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2253
2303
|
}
|
|
2254
|
-
function
|
|
2255
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
2256
|
-
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);
|
|
2257
2307
|
if (r.length === 0) return 0;
|
|
2258
|
-
let i = new Map(D.value), a = t?.staggerMs ??
|
|
2308
|
+
let i = new Map(D.value), a = t?.staggerMs ?? Ut;
|
|
2259
2309
|
return r.forEach((e, t) => {
|
|
2260
2310
|
i.set(e, t * a);
|
|
2261
|
-
}), 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;
|
|
2262
2312
|
}
|
|
2263
|
-
function
|
|
2264
|
-
let n =
|
|
2313
|
+
function oe(e, t) {
|
|
2314
|
+
let n = Z(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2265
2315
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2266
2316
|
r.classList.remove("media-card-focus-silent");
|
|
2267
2317
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2268
2318
|
}
|
|
2269
|
-
function
|
|
2270
|
-
let t = g.value, n =
|
|
2319
|
+
function se(e) {
|
|
2320
|
+
let t = g.value, n = Z(e);
|
|
2271
2321
|
if (t === null || n === null) return {};
|
|
2272
2322
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2273
2323
|
return {
|
|
@@ -2277,48 +2327,48 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2277
2327
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2278
2328
|
};
|
|
2279
2329
|
}
|
|
2280
|
-
function
|
|
2330
|
+
function ce() {
|
|
2281
2331
|
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2282
2332
|
}
|
|
2283
|
-
function
|
|
2284
|
-
let e = W, t =
|
|
2285
|
-
x.value = !1, W = null,
|
|
2286
|
-
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);
|
|
2287
2337
|
});
|
|
2288
2338
|
}
|
|
2289
|
-
return
|
|
2290
|
-
closeMasonryReel:
|
|
2339
|
+
return Ht({
|
|
2340
|
+
closeMasonryReel: ce,
|
|
2291
2341
|
element: () => g.value,
|
|
2292
2342
|
isReelLeaving: () => x.value,
|
|
2293
2343
|
reelRenderer: () => p.value,
|
|
2294
2344
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2295
2345
|
state: l.state
|
|
2296
2346
|
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2297
|
-
let t = e.filter((e) => !
|
|
2298
|
-
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;
|
|
2299
2349
|
let r = /* @__PURE__ */ new Map();
|
|
2300
2350
|
e.forEach((e) => {
|
|
2301
2351
|
let t = C.value.get(e);
|
|
2302
2352
|
t !== void 0 && r.set(e, t);
|
|
2303
2353
|
}), t.forEach((e, t) => {
|
|
2304
|
-
r.set(e, t *
|
|
2305
|
-
}), 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();
|
|
2306
2356
|
}, { flush: "sync" }), v(() => {
|
|
2307
2357
|
U !== null && cancelAnimationFrame(U);
|
|
2308
2358
|
}), i({
|
|
2309
|
-
changeActiveReelMedia:
|
|
2310
|
-
getAutoScrollElement:
|
|
2311
|
-
loadIfNearBottom:
|
|
2312
|
-
moveActiveReelPost:
|
|
2313
|
-
navigateToReelItem:
|
|
2314
|
-
startItemRemoval:
|
|
2359
|
+
changeActiveReelMedia: Y,
|
|
2360
|
+
getAutoScrollElement: ae,
|
|
2361
|
+
loadIfNearBottom: ne,
|
|
2362
|
+
moveActiveReelPost: re,
|
|
2363
|
+
navigateToReelItem: ie,
|
|
2364
|
+
startItemRemoval: Q,
|
|
2315
2365
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2316
2366
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2317
2367
|
}), (r, i) => (b(), s("div", {
|
|
2318
2368
|
ref_key: "surfaceElement",
|
|
2319
2369
|
ref: g,
|
|
2320
2370
|
class: "vibe-surface"
|
|
2321
|
-
}, [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, {
|
|
2322
2372
|
key: 0,
|
|
2323
2373
|
ref_key: "reelRenderer",
|
|
2324
2374
|
ref: p,
|
|
@@ -2343,7 +2393,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2343
2393
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2344
2394
|
"next-page-error": !!t.state.nextPageError,
|
|
2345
2395
|
origin: "reel",
|
|
2346
|
-
"preview-states": E(
|
|
2396
|
+
"preview-states": E(ee),
|
|
2347
2397
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2348
2398
|
"reel-forward": t.state.reelForward,
|
|
2349
2399
|
state: j.value,
|
|
@@ -2352,11 +2402,11 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2352
2402
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2353
2403
|
onError: E(L),
|
|
2354
2404
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2355
|
-
onMediaChange:
|
|
2405
|
+
onMediaChange: J,
|
|
2356
2406
|
onReady: E(R),
|
|
2357
2407
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2358
2408
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
2359
|
-
}, 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, {
|
|
2360
2410
|
key: 1,
|
|
2361
2411
|
actions: t.feedFooterActions,
|
|
2362
2412
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2369,7 +2419,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2369
2419
|
"can-retry-end",
|
|
2370
2420
|
"feed-footer",
|
|
2371
2421
|
"state"
|
|
2372
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2422
|
+
])) : (b(), s(e, { key: 2 }, [u(yt, {
|
|
2373
2423
|
ref_key: "masonryRenderer",
|
|
2374
2424
|
ref: f,
|
|
2375
2425
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2394,10 +2444,10 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2394
2444
|
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2395
2445
|
state: j.value,
|
|
2396
2446
|
total: t.state.total,
|
|
2397
|
-
onActivate:
|
|
2447
|
+
onActivate: X,
|
|
2398
2448
|
onError: E(N),
|
|
2399
2449
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2400
|
-
onMediaChange:
|
|
2450
|
+
onMediaChange: J,
|
|
2401
2451
|
onReady: E(I),
|
|
2402
2452
|
onRetryEnd: i[8] ||= (e) => d("retryEnd"),
|
|
2403
2453
|
onVisible: E(M)
|
|
@@ -2429,7 +2479,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2429
2479
|
"onVisible"
|
|
2430
2480
|
]), u(n, {
|
|
2431
2481
|
name: "vibe-reel-viewer",
|
|
2432
|
-
onAfterLeave:
|
|
2482
|
+
onAfterLeave: le
|
|
2433
2483
|
}, {
|
|
2434
2484
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2435
2485
|
key: 0,
|
|
@@ -2441,7 +2491,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2441
2491
|
"aria-modal": "true",
|
|
2442
2492
|
tabindex: "-1",
|
|
2443
2493
|
style: _(y.value)
|
|
2444
|
-
}, [u(
|
|
2494
|
+
}, [u(Ft, {
|
|
2445
2495
|
ref_key: "reelRenderer",
|
|
2446
2496
|
ref: p,
|
|
2447
2497
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2474,7 +2524,7 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2474
2524
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2475
2525
|
onError: E(L),
|
|
2476
2526
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2477
|
-
onMediaChange:
|
|
2527
|
+
onMediaChange: J,
|
|
2478
2528
|
onReady: E(R),
|
|
2479
2529
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2480
2530
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
@@ -2485,33 +2535,33 @@ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
|
|
|
2485
2535
|
});
|
|
2486
2536
|
//#endregion
|
|
2487
2537
|
//#region src/core/page.ts
|
|
2488
|
-
function
|
|
2538
|
+
function Kt(e) {
|
|
2489
2539
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2490
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.");
|
|
2491
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.");
|
|
2492
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.");
|
|
2493
2543
|
return e;
|
|
2494
2544
|
}
|
|
2495
|
-
function
|
|
2545
|
+
function $(e, t) {
|
|
2496
2546
|
let n = new Set(e.map((e) => e.postId));
|
|
2497
2547
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2498
2548
|
}
|
|
2499
|
-
function
|
|
2549
|
+
function qt(e) {
|
|
2500
2550
|
return `${typeof e}:${String(e)}`;
|
|
2501
2551
|
}
|
|
2502
|
-
function
|
|
2503
|
-
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)}`;
|
|
2504
2554
|
}
|
|
2505
|
-
function
|
|
2506
|
-
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]));
|
|
2507
2557
|
return t.forEach((e) => {
|
|
2508
|
-
let t =
|
|
2558
|
+
let t = qt(e.postId), i = r.get(t);
|
|
2509
2559
|
if (i === void 0) {
|
|
2510
2560
|
r.set(t, n.length), n.push(e);
|
|
2511
2561
|
return;
|
|
2512
2562
|
}
|
|
2513
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
2514
|
-
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);
|
|
2515
2565
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
2516
2566
|
});
|
|
2517
2567
|
s.length > 0 && (n[i] = {
|
|
@@ -2520,14 +2570,14 @@ function Jt(e, t) {
|
|
|
2520
2570
|
});
|
|
2521
2571
|
}), n;
|
|
2522
2572
|
}
|
|
2523
|
-
function
|
|
2573
|
+
function Xt(e) {
|
|
2524
2574
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
2525
2575
|
}
|
|
2526
2576
|
//#endregion
|
|
2527
2577
|
//#region src/core/appendPage.ts
|
|
2528
|
-
function
|
|
2529
|
-
let i =
|
|
2530
|
-
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([{
|
|
2531
2581
|
contributionIds: a.map(({ postId: e }) => e),
|
|
2532
2582
|
cursor: o,
|
|
2533
2583
|
next: i.next,
|
|
@@ -2536,32 +2586,32 @@ function Xt(e, t, n, r) {
|
|
|
2536
2586
|
}
|
|
2537
2587
|
//#endregion
|
|
2538
2588
|
//#region src/core/requestDelay.ts
|
|
2539
|
-
var
|
|
2589
|
+
var Qt = 2e3, $t = 1e4, en = 250, tn = {
|
|
2540
2590
|
delayRemainingMs: null,
|
|
2541
2591
|
nextRequestAt: null
|
|
2542
2592
|
};
|
|
2543
|
-
function
|
|
2593
|
+
function nn(e, t) {
|
|
2544
2594
|
return e === void 0 ? t : Math.floor(e);
|
|
2545
2595
|
}
|
|
2546
|
-
function
|
|
2596
|
+
function rn(e, t) {
|
|
2547
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.`);
|
|
2548
2598
|
}
|
|
2549
|
-
function
|
|
2550
|
-
let n =
|
|
2599
|
+
function an(e, t = {}) {
|
|
2600
|
+
let n = nn(t.delayStepMs, Qt), r = nn(t.delayMaxMs, $t);
|
|
2551
2601
|
return Math.min(Math.max(0, e) * n, r);
|
|
2552
2602
|
}
|
|
2553
|
-
function
|
|
2554
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2603
|
+
function on(e) {
|
|
2604
|
+
if (e == null || !Number.isFinite(e)) return { ...tn };
|
|
2555
2605
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2556
2606
|
return t > 0 ? {
|
|
2557
2607
|
delayRemainingMs: t,
|
|
2558
2608
|
nextRequestAt: e
|
|
2559
|
-
} : { ...
|
|
2609
|
+
} : { ...tn };
|
|
2560
2610
|
}
|
|
2561
|
-
async function
|
|
2611
|
+
async function sn({ delayMs: e, onChange: t, signal: n }) {
|
|
2562
2612
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2563
2613
|
if (e <= 0) {
|
|
2564
|
-
t({ ...
|
|
2614
|
+
t({ ...tn });
|
|
2565
2615
|
return;
|
|
2566
2616
|
}
|
|
2567
2617
|
let r = Date.now() + e;
|
|
@@ -2569,9 +2619,9 @@ async function an({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2569
2619
|
delayRemainingMs: e,
|
|
2570
2620
|
nextRequestAt: r
|
|
2571
2621
|
}), await new Promise((i, a) => {
|
|
2572
|
-
let o = !1, s = setInterval(f,
|
|
2622
|
+
let o = !1, s = setInterval(f, en), c = setTimeout(() => u(), e);
|
|
2573
2623
|
function l() {
|
|
2574
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2624
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...tn });
|
|
2575
2625
|
}
|
|
2576
2626
|
function u(e) {
|
|
2577
2627
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2580,42 +2630,42 @@ async function an({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2580
2630
|
u(new DOMException("Aborted", "AbortError"));
|
|
2581
2631
|
}
|
|
2582
2632
|
function f() {
|
|
2583
|
-
let e =
|
|
2633
|
+
let e = on(r);
|
|
2584
2634
|
t(e), e.delayRemainingMs === null && u();
|
|
2585
2635
|
}
|
|
2586
2636
|
n.addEventListener("abort", d, { once: !0 });
|
|
2587
2637
|
});
|
|
2588
2638
|
}
|
|
2589
|
-
var
|
|
2639
|
+
var cn = class {
|
|
2590
2640
|
interval = null;
|
|
2591
2641
|
constructor(e) {
|
|
2592
2642
|
this.onChange = e;
|
|
2593
2643
|
}
|
|
2594
2644
|
clear() {
|
|
2595
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2645
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...tn });
|
|
2596
2646
|
}
|
|
2597
2647
|
sync(e) {
|
|
2598
2648
|
this.clear();
|
|
2599
|
-
let t =
|
|
2649
|
+
let t = on(e);
|
|
2600
2650
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2601
|
-
let t =
|
|
2651
|
+
let t = on(e);
|
|
2602
2652
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2603
|
-
},
|
|
2653
|
+
}, en));
|
|
2604
2654
|
}
|
|
2605
2655
|
};
|
|
2606
|
-
function
|
|
2656
|
+
function ln(e, t = !0) {
|
|
2607
2657
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2608
2658
|
}
|
|
2609
|
-
function
|
|
2659
|
+
function un(e) {
|
|
2610
2660
|
return `${typeof e}:${String(e)}`;
|
|
2611
2661
|
}
|
|
2612
|
-
function
|
|
2662
|
+
function dn(e, t) {
|
|
2613
2663
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2614
2664
|
}
|
|
2615
|
-
function
|
|
2665
|
+
function fn(e) {
|
|
2616
2666
|
if (!e) return;
|
|
2617
|
-
if (
|
|
2618
|
-
|
|
2667
|
+
if (dn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2668
|
+
rn(e, "frontend autofill");
|
|
2619
2669
|
let t = e.maxAdditionalPages;
|
|
2620
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\".");
|
|
2621
2671
|
return;
|
|
@@ -2627,7 +2677,7 @@ function un(e) {
|
|
|
2627
2677
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2628
2678
|
}
|
|
2629
2679
|
}
|
|
2630
|
-
function
|
|
2680
|
+
function pn(e, t, n = !0) {
|
|
2631
2681
|
if (!e) return {
|
|
2632
2682
|
cycleId: null,
|
|
2633
2683
|
delayRemainingMs: null,
|
|
@@ -2644,7 +2694,7 @@ function dn(e, t, n = !0) {
|
|
|
2644
2694
|
status: "idle",
|
|
2645
2695
|
strategy: null
|
|
2646
2696
|
};
|
|
2647
|
-
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);
|
|
2648
2698
|
return {
|
|
2649
2699
|
cycleId: r?.cycleId ?? null,
|
|
2650
2700
|
...a,
|
|
@@ -2661,7 +2711,7 @@ function dn(e, t, n = !0) {
|
|
|
2661
2711
|
strategy: e.strategy
|
|
2662
2712
|
};
|
|
2663
2713
|
}
|
|
2664
|
-
function
|
|
2714
|
+
function mn(e) {
|
|
2665
2715
|
return [
|
|
2666
2716
|
"cancelling",
|
|
2667
2717
|
"filling",
|
|
@@ -2669,9 +2719,9 @@ function fn(e) {
|
|
|
2669
2719
|
"waiting"
|
|
2670
2720
|
].includes(e.status);
|
|
2671
2721
|
}
|
|
2672
|
-
async function
|
|
2722
|
+
async function hn(e, t, n) {
|
|
2673
2723
|
let r = t.autofill;
|
|
2674
|
-
if (!
|
|
2724
|
+
if (!mn(r) || !r.cycleId) return;
|
|
2675
2725
|
let i = {
|
|
2676
2726
|
cycleId: r.cycleId,
|
|
2677
2727
|
feedKey: r.feedKey ?? "",
|
|
@@ -2684,16 +2734,16 @@ async function pn(e, t, n) {
|
|
|
2684
2734
|
throw r.error = e, r.status = "error", e;
|
|
2685
2735
|
}
|
|
2686
2736
|
}
|
|
2687
|
-
function
|
|
2737
|
+
function gn(e, t, n) {
|
|
2688
2738
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2689
2739
|
}
|
|
2690
|
-
async function
|
|
2691
|
-
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;
|
|
2692
2742
|
for (; y < h;) {
|
|
2693
|
-
let e =
|
|
2743
|
+
let e = un(g);
|
|
2694
2744
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2695
|
-
if (m.add(e), await
|
|
2696
|
-
delayMs:
|
|
2745
|
+
if (m.add(e), await sn({
|
|
2746
|
+
delayMs: an(l + y, s),
|
|
2697
2747
|
onChange: a,
|
|
2698
2748
|
signal: d
|
|
2699
2749
|
}), y > 0 && u()) return {
|
|
@@ -2707,12 +2757,12 @@ async function hn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2707
2757
|
status: "paused",
|
|
2708
2758
|
total: x
|
|
2709
2759
|
};
|
|
2710
|
-
let t =
|
|
2760
|
+
let t = Kt(await n({
|
|
2711
2761
|
cursor: g,
|
|
2712
2762
|
signal: d
|
|
2713
2763
|
}));
|
|
2714
2764
|
y += 1, _ = g;
|
|
2715
|
-
let r =
|
|
2765
|
+
let r = $(p, t.items).slice(p.length);
|
|
2716
2766
|
b.push({
|
|
2717
2767
|
contributionIds: r.map(({ postId: e }) => e),
|
|
2718
2768
|
cursor: g,
|
|
@@ -2764,12 +2814,12 @@ async function hn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2764
2814
|
}
|
|
2765
2815
|
//#endregion
|
|
2766
2816
|
//#region src/core/autofillController.ts
|
|
2767
|
-
var
|
|
2817
|
+
var vn = class {
|
|
2768
2818
|
collection = null;
|
|
2769
2819
|
cycle = 0;
|
|
2770
2820
|
delayCountdown;
|
|
2771
2821
|
constructor(e) {
|
|
2772
|
-
this.context = e, this.delayCountdown = new
|
|
2822
|
+
this.context = e, this.delayCountdown = new cn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2773
2823
|
}
|
|
2774
2824
|
beginCycle() {
|
|
2775
2825
|
let { options: e, state: t } = this.context;
|
|
@@ -2777,14 +2827,14 @@ var gn = class {
|
|
|
2777
2827
|
this.clear();
|
|
2778
2828
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2779
2829
|
return t.autofill = {
|
|
2780
|
-
...
|
|
2830
|
+
...pn(e, void 0, !1),
|
|
2781
2831
|
cycleId: n,
|
|
2782
2832
|
status: "filling"
|
|
2783
2833
|
}, n;
|
|
2784
2834
|
}
|
|
2785
2835
|
async cancel() {
|
|
2786
2836
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2787
|
-
await
|
|
2837
|
+
await hn(t, n, e), this.commitCollection();
|
|
2788
2838
|
}
|
|
2789
2839
|
captureCollection(e, t) {
|
|
2790
2840
|
t && (this.collection = e);
|
|
@@ -2806,36 +2856,36 @@ var gn = class {
|
|
|
2806
2856
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
2807
2857
|
if (t?.strategy !== "frontend") return !1;
|
|
2808
2858
|
let r = this.collection;
|
|
2809
|
-
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, {
|
|
2810
2860
|
missing: r.missing,
|
|
2811
2861
|
received: r.received,
|
|
2812
2862
|
requests: r.requests
|
|
2813
2863
|
}), !0) : !1;
|
|
2814
2864
|
}
|
|
2815
|
-
},
|
|
2816
|
-
function
|
|
2865
|
+
}, yn = 100;
|
|
2866
|
+
function bn(e, t) {
|
|
2817
2867
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2818
2868
|
}
|
|
2819
|
-
function
|
|
2869
|
+
function xn(e, t, n) {
|
|
2820
2870
|
return Math.min(n, Math.max(t, e));
|
|
2821
2871
|
}
|
|
2822
|
-
function
|
|
2872
|
+
function Sn(e) {
|
|
2823
2873
|
if (!e) return;
|
|
2824
2874
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2825
|
-
if (
|
|
2826
|
-
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);
|
|
2827
2877
|
}
|
|
2828
|
-
function
|
|
2878
|
+
function Cn(e) {
|
|
2829
2879
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2830
2880
|
return {
|
|
2831
2881
|
enabled: e?.enabled ?? !1,
|
|
2832
2882
|
maxSpeedPxPerSecond: n,
|
|
2833
2883
|
minSpeedPxPerSecond: t,
|
|
2834
2884
|
paused: !1,
|
|
2835
|
-
speedPxPerSecond:
|
|
2885
|
+
speedPxPerSecond: xn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2836
2886
|
};
|
|
2837
2887
|
}
|
|
2838
|
-
var
|
|
2888
|
+
var wn = class {
|
|
2839
2889
|
frame = null;
|
|
2840
2890
|
lastTimestamp = null;
|
|
2841
2891
|
mounted = !1;
|
|
@@ -2855,9 +2905,9 @@ var Sn = class {
|
|
|
2855
2905
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2856
2906
|
}
|
|
2857
2907
|
setSpeed(e) {
|
|
2858
|
-
|
|
2908
|
+
bn("auto-scroll speed", e);
|
|
2859
2909
|
let t = this.options.state;
|
|
2860
|
-
t.speedPxPerSecond =
|
|
2910
|
+
t.speedPxPerSecond = xn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2861
2911
|
}
|
|
2862
2912
|
tick = (e) => {
|
|
2863
2913
|
this.frame = null;
|
|
@@ -2869,7 +2919,7 @@ var Sn = class {
|
|
|
2869
2919
|
return;
|
|
2870
2920
|
}
|
|
2871
2921
|
if (this.lastTimestamp !== null) {
|
|
2872
|
-
let r = Math.min(
|
|
2922
|
+
let r = Math.min(yn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2873
2923
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2874
2924
|
}
|
|
2875
2925
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2883,13 +2933,13 @@ var Sn = class {
|
|
|
2883
2933
|
};
|
|
2884
2934
|
//#endregion
|
|
2885
2935
|
//#region src/core/backendAutofill.ts
|
|
2886
|
-
async function
|
|
2936
|
+
async function Tn(e, t, n, r) {
|
|
2887
2937
|
let i = await e.onUnderfilled(n);
|
|
2888
2938
|
if (!r()) return;
|
|
2889
2939
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
2890
2940
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
2891
2941
|
Object.assign(t.autofill, {
|
|
2892
|
-
|
|
2942
|
+
...on(i.nextRequestAt),
|
|
2893
2943
|
missing: Math.max(0, e.pageSize - a),
|
|
2894
2944
|
received: a,
|
|
2895
2945
|
sequence: i.sequence ?? 0,
|
|
@@ -2897,19 +2947,19 @@ async function Cn(e, t, n, r) {
|
|
|
2897
2947
|
status: "waiting"
|
|
2898
2948
|
});
|
|
2899
2949
|
}
|
|
2900
|
-
function
|
|
2901
|
-
["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);
|
|
2902
2952
|
}
|
|
2903
|
-
function
|
|
2953
|
+
function Dn(e, t, n) {
|
|
2904
2954
|
let r = t.autofill;
|
|
2905
|
-
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);
|
|
2906
2956
|
}
|
|
2907
|
-
function
|
|
2908
|
-
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);
|
|
2909
2959
|
}
|
|
2910
2960
|
//#endregion
|
|
2911
2961
|
//#region src/core/backlogRestore.ts
|
|
2912
|
-
async function
|
|
2962
|
+
async function kn(e, t, n) {
|
|
2913
2963
|
if (!e) return;
|
|
2914
2964
|
let r = new AbortController();
|
|
2915
2965
|
n(r);
|
|
@@ -2924,7 +2974,7 @@ async function Dn(e, t, n) {
|
|
|
2924
2974
|
}
|
|
2925
2975
|
//#endregion
|
|
2926
2976
|
//#region src/core/initialAutofill.ts
|
|
2927
|
-
async function
|
|
2977
|
+
async function An({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2928
2978
|
let c = a.autofill;
|
|
2929
2979
|
if (!c) return;
|
|
2930
2980
|
let l = s.items.length;
|
|
@@ -2937,7 +2987,7 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2937
2987
|
return;
|
|
2938
2988
|
}
|
|
2939
2989
|
if (c.strategy === "backend") {
|
|
2940
|
-
await
|
|
2990
|
+
await Tn(c, s, {
|
|
2941
2991
|
cycleId: e,
|
|
2942
2992
|
feedKey: c.feedKey,
|
|
2943
2993
|
items: [...s.items],
|
|
@@ -2954,11 +3004,11 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2954
3004
|
s.autofill.status = "exhausted";
|
|
2955
3005
|
return;
|
|
2956
3006
|
}
|
|
2957
|
-
let u = await
|
|
3007
|
+
let u = await _n({
|
|
2958
3008
|
existingItems: s.items,
|
|
2959
3009
|
initialCursor: s.next,
|
|
2960
3010
|
loadPage: a.loadPage,
|
|
2961
|
-
maximumRequests:
|
|
3011
|
+
maximumRequests: ln(c, !1),
|
|
2962
3012
|
onCollection: n,
|
|
2963
3013
|
onDelayChange: (e) => {
|
|
2964
3014
|
t() && Object.assign(s.autofill, e);
|
|
@@ -2972,7 +3022,7 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2972
3022
|
shouldPause: () => s.loadMoreLocked,
|
|
2973
3023
|
signal: o
|
|
2974
3024
|
});
|
|
2975
|
-
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, {
|
|
2976
3026
|
missing: u.missing,
|
|
2977
3027
|
received: u.received,
|
|
2978
3028
|
requests: u.requests,
|
|
@@ -2981,13 +3031,13 @@ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2981
3031
|
}
|
|
2982
3032
|
//#endregion
|
|
2983
3033
|
//#region src/core/fill.ts
|
|
2984
|
-
function
|
|
3034
|
+
function jn(e) {
|
|
2985
3035
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2986
3036
|
}
|
|
2987
|
-
function
|
|
3037
|
+
function Mn(e) {
|
|
2988
3038
|
return `${typeof e}:${String(e)}`;
|
|
2989
3039
|
}
|
|
2990
|
-
function
|
|
3040
|
+
function Nn(e) {
|
|
2991
3041
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2992
3042
|
if ("pages" in e) {
|
|
2993
3043
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3000,21 +3050,21 @@ function jn(e) {
|
|
|
3000
3050
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3001
3051
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3002
3052
|
}
|
|
3003
|
-
function
|
|
3053
|
+
function Pn(e) {
|
|
3004
3054
|
if (!e) return;
|
|
3005
3055
|
if (e.strategy === "frontend") {
|
|
3006
|
-
|
|
3056
|
+
rn(e, "frontend fill");
|
|
3007
3057
|
return;
|
|
3008
3058
|
}
|
|
3009
3059
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3010
3060
|
let t = e.initialSession;
|
|
3011
3061
|
if (t) {
|
|
3012
3062
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3013
|
-
|
|
3063
|
+
Nn(t.target);
|
|
3014
3064
|
}
|
|
3015
3065
|
}
|
|
3016
|
-
function
|
|
3017
|
-
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);
|
|
3018
3068
|
return {
|
|
3019
3069
|
completedPages: i?.completedPages ?? 0,
|
|
3020
3070
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3027,10 +3077,10 @@ function Nn(e, t, n = !0) {
|
|
|
3027
3077
|
sessionId: i?.sessionId ?? null,
|
|
3028
3078
|
status: i?.status ?? "idle",
|
|
3029
3079
|
strategy: e?.strategy ?? null,
|
|
3030
|
-
target: i ?
|
|
3080
|
+
target: i ? jn(i.target) : null
|
|
3031
3081
|
};
|
|
3032
3082
|
}
|
|
3033
|
-
function
|
|
3083
|
+
function In(e) {
|
|
3034
3084
|
return [
|
|
3035
3085
|
"cancelling",
|
|
3036
3086
|
"filling",
|
|
@@ -3038,7 +3088,7 @@ function Pn(e) {
|
|
|
3038
3088
|
"waiting"
|
|
3039
3089
|
].includes(e.status);
|
|
3040
3090
|
}
|
|
3041
|
-
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 }) {
|
|
3042
3092
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3043
3093
|
if ("items" in l && f.length >= l.items) return {
|
|
3044
3094
|
completedPages: m,
|
|
@@ -3050,10 +3100,10 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3050
3100
|
status: "complete"
|
|
3051
3101
|
};
|
|
3052
3102
|
for (; _ !== null;) {
|
|
3053
|
-
let e =
|
|
3103
|
+
let e = Mn(h);
|
|
3054
3104
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3055
|
-
if (p.add(e), await
|
|
3056
|
-
delayMs:
|
|
3105
|
+
if (p.add(e), await sn({
|
|
3106
|
+
delayMs: an(m, o),
|
|
3057
3107
|
onChange: i,
|
|
3058
3108
|
signal: c
|
|
3059
3109
|
}), m > 0 && s()) return {
|
|
@@ -3066,12 +3116,12 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3066
3116
|
status: "paused",
|
|
3067
3117
|
total: y
|
|
3068
3118
|
};
|
|
3069
|
-
let t =
|
|
3119
|
+
let t = Kt(await n({
|
|
3070
3120
|
cursor: h,
|
|
3071
3121
|
signal: c
|
|
3072
3122
|
}));
|
|
3073
3123
|
m += 1, g = h;
|
|
3074
|
-
let b =
|
|
3124
|
+
let b = $(f, t.items).slice(f.length);
|
|
3075
3125
|
if (d.push({
|
|
3076
3126
|
contributionIds: b.map(({ postId: e }) => e),
|
|
3077
3127
|
cursor: h,
|
|
@@ -3134,12 +3184,12 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3134
3184
|
}
|
|
3135
3185
|
//#endregion
|
|
3136
3186
|
//#region src/core/backendFill.ts
|
|
3137
|
-
async function
|
|
3187
|
+
async function Rn(e, t, n, r) {
|
|
3138
3188
|
let i = await e.onStart(n);
|
|
3139
3189
|
if (r()) {
|
|
3140
3190
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3141
3191
|
Object.assign(t.fill, {
|
|
3142
|
-
|
|
3192
|
+
...on(i.nextRequestAt),
|
|
3143
3193
|
completedPages: i.completedPages ?? 0,
|
|
3144
3194
|
received: i.received ?? 0,
|
|
3145
3195
|
sequence: i.sequence ?? 0,
|
|
@@ -3148,23 +3198,23 @@ async function In(e, t, n, r) {
|
|
|
3148
3198
|
});
|
|
3149
3199
|
}
|
|
3150
3200
|
}
|
|
3151
|
-
function
|
|
3201
|
+
function zn(e, t, n) {
|
|
3152
3202
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3153
3203
|
}
|
|
3154
|
-
function
|
|
3204
|
+
function Bn(e) {
|
|
3155
3205
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3156
3206
|
}
|
|
3157
|
-
function
|
|
3207
|
+
function Vn(e, t) {
|
|
3158
3208
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3159
3209
|
let n = e.fill.target;
|
|
3160
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;
|
|
3161
3211
|
}
|
|
3162
|
-
function
|
|
3163
|
-
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));
|
|
3164
3214
|
}
|
|
3165
|
-
function
|
|
3166
|
-
return !
|
|
3167
|
-
|
|
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),
|
|
3168
3218
|
completedPages: n.completedPages,
|
|
3169
3219
|
error: n.error ?? null,
|
|
3170
3220
|
received: n.received,
|
|
@@ -3172,45 +3222,45 @@ function Vn(e, t, n, r) {
|
|
|
3172
3222
|
status: n.status
|
|
3173
3223
|
}), !0);
|
|
3174
3224
|
}
|
|
3175
|
-
function
|
|
3225
|
+
function Wn(e, t, n, r) {
|
|
3176
3226
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3177
3227
|
let i = t.fill;
|
|
3178
|
-
return t.fill =
|
|
3228
|
+
return t.fill = Fn(e, n), !Bn(n) || !Vn(t, n) ? (t.fill = i, !1) : (Hn(t, n, r), !0);
|
|
3179
3229
|
}
|
|
3180
3230
|
//#endregion
|
|
3181
3231
|
//#region src/core/fillController.ts
|
|
3182
|
-
var
|
|
3232
|
+
var Gn = class {
|
|
3183
3233
|
abortController = null;
|
|
3184
3234
|
cycle = 0;
|
|
3185
3235
|
delayCountdown;
|
|
3186
3236
|
requestVersion = 0;
|
|
3187
3237
|
collection = null;
|
|
3188
3238
|
constructor(e) {
|
|
3189
|
-
this.options = e, this.delayCountdown = new
|
|
3239
|
+
this.options = e, this.delayCountdown = new cn((e) => {
|
|
3190
3240
|
Object.assign(this.options.state.fill, e);
|
|
3191
3241
|
}), this.syncBackendCountdown();
|
|
3192
3242
|
}
|
|
3193
3243
|
isActive() {
|
|
3194
|
-
return
|
|
3244
|
+
return In(this.options.state.fill);
|
|
3195
3245
|
}
|
|
3196
3246
|
applyUpdate(e) {
|
|
3197
|
-
let t =
|
|
3247
|
+
let t = Un(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3198
3248
|
return t && this.syncBackendCountdown(), t;
|
|
3199
3249
|
}
|
|
3200
3250
|
restoreSession(e) {
|
|
3201
|
-
let t =
|
|
3251
|
+
let t = Wn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3202
3252
|
return t && this.syncBackendCountdown(), t;
|
|
3203
3253
|
}
|
|
3204
3254
|
async start(e, t = {}) {
|
|
3205
3255
|
let n = this.options.fill;
|
|
3206
3256
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3207
3257
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3208
|
-
let r =
|
|
3258
|
+
let r = Nn(e), i = Nn(t.target ?? r), a = t.progressOffset ?? {
|
|
3209
3259
|
completedPages: 0,
|
|
3210
3260
|
received: 0
|
|
3211
3261
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3212
3262
|
if (this.options.state.fill = {
|
|
3213
|
-
...
|
|
3263
|
+
...Fn(n, void 0, !1),
|
|
3214
3264
|
completedPages: a.completedPages,
|
|
3215
3265
|
cycleId: o,
|
|
3216
3266
|
received: a.received,
|
|
@@ -3223,7 +3273,7 @@ var Un = class {
|
|
|
3223
3273
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3224
3274
|
this.abortController = c;
|
|
3225
3275
|
try {
|
|
3226
|
-
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, {
|
|
3227
3277
|
cycleId: o,
|
|
3228
3278
|
feedKey: n.feedKey,
|
|
3229
3279
|
items: [...this.options.state.items],
|
|
@@ -3241,7 +3291,7 @@ var Un = class {
|
|
|
3241
3291
|
}
|
|
3242
3292
|
async cancel() {
|
|
3243
3293
|
let { fill: e, state: t } = this.options;
|
|
3244
|
-
if (!
|
|
3294
|
+
if (!In(t.fill) || !t.fill.cycleId) return;
|
|
3245
3295
|
let n = {
|
|
3246
3296
|
cycleId: t.fill.cycleId,
|
|
3247
3297
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3285,7 +3335,7 @@ var Un = class {
|
|
|
3285
3335
|
});
|
|
3286
3336
|
}
|
|
3287
3337
|
reset() {
|
|
3288
|
-
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;
|
|
3289
3339
|
}
|
|
3290
3340
|
destroy() {
|
|
3291
3341
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3320,7 +3370,7 @@ var Un = class {
|
|
|
3320
3370
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
3321
3371
|
return;
|
|
3322
3372
|
}
|
|
3323
|
-
let c = await
|
|
3373
|
+
let c = await Ln({
|
|
3324
3374
|
existingItems: s.items,
|
|
3325
3375
|
initialCursor: s.next,
|
|
3326
3376
|
loadPage: o,
|
|
@@ -3346,7 +3396,7 @@ var Un = class {
|
|
|
3346
3396
|
signal: n.signal,
|
|
3347
3397
|
target: t
|
|
3348
3398
|
});
|
|
3349
|
-
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, {
|
|
3350
3400
|
completedPages: a.completedPages + c.completedPages,
|
|
3351
3401
|
received: a.received + c.received,
|
|
3352
3402
|
status: c.status
|
|
@@ -3356,7 +3406,7 @@ var Un = class {
|
|
|
3356
3406
|
let e = this.collection;
|
|
3357
3407
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
3358
3408
|
let t = this.options.state;
|
|
3359
|
-
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, {
|
|
3360
3410
|
completedPages: e.completedPages,
|
|
3361
3411
|
received: e.received
|
|
3362
3412
|
});
|
|
@@ -3368,7 +3418,7 @@ var Un = class {
|
|
|
3368
3418
|
};
|
|
3369
3419
|
//#endregion
|
|
3370
3420
|
//#region src/core/fillReconciliation.ts
|
|
3371
|
-
async function
|
|
3421
|
+
async function Kn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
|
|
3372
3422
|
if (!e.needsReconciliation(o.items)) return "skipped";
|
|
3373
3423
|
let s = await e.reconcile({
|
|
3374
3424
|
existingItems: o.items,
|
|
@@ -3377,11 +3427,11 @@ async function Wn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
3377
3427
|
shouldPause: () => o.loadMoreLocked,
|
|
3378
3428
|
signal: a
|
|
3379
3429
|
});
|
|
3380
|
-
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;
|
|
3381
3431
|
}
|
|
3382
3432
|
//#endregion
|
|
3383
3433
|
//#region src/core/feedFooter.ts
|
|
3384
|
-
function
|
|
3434
|
+
function qn(e) {
|
|
3385
3435
|
return {
|
|
3386
3436
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3387
3437
|
loadMore: () => e.loadNext(),
|
|
@@ -3393,64 +3443,64 @@ function Gn(e) {
|
|
|
3393
3443
|
retryFill: () => e.retryFill()
|
|
3394
3444
|
};
|
|
3395
3445
|
}
|
|
3396
|
-
function
|
|
3446
|
+
function Jn(e) {
|
|
3397
3447
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3398
3448
|
}
|
|
3399
|
-
function
|
|
3400
|
-
e?.intervalMs !== void 0 &&
|
|
3449
|
+
function Yn(e) {
|
|
3450
|
+
e?.intervalMs !== void 0 && Jn(e.intervalMs);
|
|
3401
3451
|
}
|
|
3402
|
-
function
|
|
3452
|
+
function Xn(e) {
|
|
3403
3453
|
return {
|
|
3404
3454
|
enabled: e?.enabled ?? !1,
|
|
3405
3455
|
includePostItems: e?.includePostItems ?? !1,
|
|
3406
3456
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3407
3457
|
};
|
|
3408
3458
|
}
|
|
3409
|
-
function
|
|
3459
|
+
function Zn(e, t) {
|
|
3410
3460
|
if (typeof t == "boolean") {
|
|
3411
3461
|
e.enabled = t;
|
|
3412
3462
|
return;
|
|
3413
3463
|
}
|
|
3414
|
-
|
|
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);
|
|
3415
3465
|
}
|
|
3416
3466
|
//#endregion
|
|
3417
3467
|
//#region src/core/reelInfoSheet.ts
|
|
3418
|
-
function
|
|
3468
|
+
function Qn(e) {
|
|
3419
3469
|
return { enabled: e?.enabled ?? !1 };
|
|
3420
3470
|
}
|
|
3421
|
-
function
|
|
3471
|
+
function $n(e, t, n) {
|
|
3422
3472
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3423
3473
|
e.enabled = n;
|
|
3424
3474
|
}
|
|
3425
3475
|
//#endregion
|
|
3426
3476
|
//#region src/core/initialRuntimeState.ts
|
|
3427
|
-
function
|
|
3477
|
+
function er(e, t) {
|
|
3428
3478
|
let n = e.initialPage;
|
|
3429
3479
|
return {
|
|
3430
3480
|
activeReelPostId: null,
|
|
3431
|
-
autoScroll:
|
|
3432
|
-
autofill:
|
|
3481
|
+
autoScroll: Cn(e.autoScroll),
|
|
3482
|
+
autofill: pn(e.autofill),
|
|
3433
3483
|
current: n?.current ?? null,
|
|
3434
3484
|
error: null,
|
|
3435
|
-
fill:
|
|
3485
|
+
fill: Fn(e.fill),
|
|
3436
3486
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3437
3487
|
isLoading: !n,
|
|
3438
3488
|
isLoadingMore: !1,
|
|
3439
|
-
items: n ?
|
|
3489
|
+
items: n ? $([], n.items) : [],
|
|
3440
3490
|
layout: t === "reel" ? "reel" : "masonry",
|
|
3441
3491
|
loadMoreLocked: !1,
|
|
3442
3492
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
3443
3493
|
next: n?.next ?? null,
|
|
3444
3494
|
nextPageError: null,
|
|
3445
3495
|
phoneMode: !1,
|
|
3446
|
-
reelAutoAdvance:
|
|
3496
|
+
reelAutoAdvance: Xn(e.reelAutoAdvance),
|
|
3447
3497
|
reelForward: {
|
|
3448
3498
|
error: null,
|
|
3449
3499
|
status: "idle"
|
|
3450
3500
|
},
|
|
3451
3501
|
reelForwardIndex: null,
|
|
3452
3502
|
reelForwardItem: null,
|
|
3453
|
-
reelInfoSheet:
|
|
3503
|
+
reelInfoSheet: Qn(e.reelInfoSheet),
|
|
3454
3504
|
reelInfoSheetOverlay: !1,
|
|
3455
3505
|
reelMediaSource: "original",
|
|
3456
3506
|
reelOrigin: null,
|
|
@@ -3459,20 +3509,20 @@ function Qn(e, t) {
|
|
|
3459
3509
|
}
|
|
3460
3510
|
//#endregion
|
|
3461
3511
|
//#region src/core/options.ts
|
|
3462
|
-
function
|
|
3512
|
+
function tr(e, t) {
|
|
3463
3513
|
if (t) {
|
|
3464
3514
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3465
3515
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3466
3516
|
}
|
|
3467
3517
|
}
|
|
3468
|
-
function
|
|
3518
|
+
function nr(e, t) {
|
|
3469
3519
|
if (t) {
|
|
3470
3520
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3471
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.`);
|
|
3472
3522
|
}
|
|
3473
3523
|
}
|
|
3474
|
-
function
|
|
3475
|
-
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) {
|
|
3476
3526
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3477
3527
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3478
3528
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3487,7 +3537,7 @@ function tr(e) {
|
|
|
3487
3537
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3488
3538
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3489
3539
|
}
|
|
3490
|
-
function
|
|
3540
|
+
function ir(e) {
|
|
3491
3541
|
if (typeof e != "string") return e;
|
|
3492
3542
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3493
3543
|
let t = document.querySelector(e);
|
|
@@ -3496,7 +3546,7 @@ function nr(e) {
|
|
|
3496
3546
|
}
|
|
3497
3547
|
//#endregion
|
|
3498
3548
|
//#region src/core/pageRequest.ts
|
|
3499
|
-
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 }) {
|
|
3500
3550
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
3501
3551
|
received: l.autofill.received,
|
|
3502
3552
|
requests: l.autofill.requests
|
|
@@ -3508,11 +3558,11 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3508
3558
|
let m = !1;
|
|
3509
3559
|
try {
|
|
3510
3560
|
if (u?.strategy === "frontend") {
|
|
3511
|
-
let s = await
|
|
3561
|
+
let s = await _n({
|
|
3512
3562
|
existingItems: e ? l.items : [],
|
|
3513
3563
|
initialCursor: n,
|
|
3514
3564
|
loadPage: i,
|
|
3515
|
-
maximumRequests: f ? Math.max(0,
|
|
3565
|
+
maximumRequests: f ? Math.max(0, ln(u) - f.requests) : void 0,
|
|
3516
3566
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3517
3567
|
onDelayChange: (e) => {
|
|
3518
3568
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3527,7 +3577,7 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3527
3577
|
signal: c
|
|
3528
3578
|
});
|
|
3529
3579
|
if (!r()) return;
|
|
3530
|
-
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, {
|
|
3531
3581
|
missing: s.missing,
|
|
3532
3582
|
received: s.received,
|
|
3533
3583
|
requests: s.requests,
|
|
@@ -3535,12 +3585,12 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3535
3585
|
}), o(s.pages), t.clearCollection();
|
|
3536
3586
|
return;
|
|
3537
3587
|
}
|
|
3538
|
-
let s =
|
|
3588
|
+
let s = Kt(await i({
|
|
3539
3589
|
cursor: n,
|
|
3540
3590
|
signal: c
|
|
3541
3591
|
}));
|
|
3542
3592
|
if (!r()) return;
|
|
3543
|
-
let d = e ? l.items : [], h =
|
|
3593
|
+
let d = e ? l.items : [], h = $(d, s.items), g = h.length - d.length;
|
|
3544
3594
|
if (l.items = h, a(n), o([{
|
|
3545
3595
|
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
3546
3596
|
cursor: n,
|
|
@@ -3555,7 +3605,7 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3555
3605
|
l.autofill.status = "complete";
|
|
3556
3606
|
return;
|
|
3557
3607
|
}
|
|
3558
|
-
await
|
|
3608
|
+
await Tn(u, l, {
|
|
3559
3609
|
cycleId: p,
|
|
3560
3610
|
feedKey: u.feedKey,
|
|
3561
3611
|
items: h.slice(d.length),
|
|
@@ -3577,16 +3627,16 @@ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3577
3627
|
}
|
|
3578
3628
|
//#endregion
|
|
3579
3629
|
//#region src/core/removalReconciliationController.ts
|
|
3580
|
-
function
|
|
3630
|
+
function or(e) {
|
|
3581
3631
|
return `${typeof e}:${String(e)}`;
|
|
3582
3632
|
}
|
|
3583
|
-
function
|
|
3633
|
+
function sr(e) {
|
|
3584
3634
|
return `${typeof e}:${String(e)}`;
|
|
3585
3635
|
}
|
|
3586
|
-
function
|
|
3636
|
+
function cr(e) {
|
|
3587
3637
|
return e.map(({ postId: e }) => e);
|
|
3588
3638
|
}
|
|
3589
|
-
var
|
|
3639
|
+
var lr = class {
|
|
3590
3640
|
delay;
|
|
3591
3641
|
enabled;
|
|
3592
3642
|
maxReplayPages;
|
|
@@ -3605,7 +3655,7 @@ var sr = class {
|
|
|
3605
3655
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
3606
3656
|
}
|
|
3607
3657
|
filterItems(e) {
|
|
3608
|
-
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)));
|
|
3609
3659
|
}
|
|
3610
3660
|
needsReconciliation(e) {
|
|
3611
3661
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -3618,45 +3668,45 @@ var sr = class {
|
|
|
3618
3668
|
}
|
|
3619
3669
|
recordInitialPage(e) {
|
|
3620
3670
|
e && this.recordPages([{
|
|
3621
|
-
contributionIds:
|
|
3622
|
-
cursor:
|
|
3671
|
+
contributionIds: cr(e.items),
|
|
3672
|
+
cursor: Xt(e),
|
|
3623
3673
|
next: e.next,
|
|
3624
|
-
returnedIds:
|
|
3674
|
+
returnedIds: cr(e.items)
|
|
3625
3675
|
}]);
|
|
3626
3676
|
}
|
|
3627
3677
|
remove(e) {
|
|
3628
|
-
e.forEach((e) => this.tombstones.add(
|
|
3678
|
+
e.forEach((e) => this.tombstones.add(or(e)));
|
|
3629
3679
|
}
|
|
3630
3680
|
reset() {
|
|
3631
3681
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
3632
3682
|
}
|
|
3633
3683
|
restore(e) {
|
|
3634
|
-
e.forEach((e) => this.tombstones.delete(
|
|
3684
|
+
e.forEach((e) => this.tombstones.delete(or(e)));
|
|
3635
3685
|
}
|
|
3636
3686
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
3637
3687
|
let a = this.pending ?? this.createSession(e);
|
|
3638
3688
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
3639
|
-
let e =
|
|
3689
|
+
let e = sr(a.cursor);
|
|
3640
3690
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3641
|
-
if (await
|
|
3642
|
-
delayMs:
|
|
3691
|
+
if (await sn({
|
|
3692
|
+
delayMs: an(a.pages.length, this.delay),
|
|
3643
3693
|
onChange: n,
|
|
3644
3694
|
signal: i
|
|
3645
3695
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
3646
|
-
let o =
|
|
3696
|
+
let o = Kt(await t({
|
|
3647
3697
|
cursor: a.cursor,
|
|
3648
3698
|
signal: i
|
|
3649
3699
|
}));
|
|
3650
3700
|
a.seenCursors.add(e);
|
|
3651
3701
|
let s = this.filterItems(o.items), c = [];
|
|
3652
3702
|
if (s.forEach((e) => {
|
|
3653
|
-
let t =
|
|
3703
|
+
let t = or(e.postId);
|
|
3654
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));
|
|
3655
3705
|
}), a.pages.push({
|
|
3656
3706
|
contributionIds: c,
|
|
3657
3707
|
cursor: a.cursor,
|
|
3658
3708
|
next: o.next,
|
|
3659
|
-
returnedIds:
|
|
3709
|
+
returnedIds: cr(s)
|
|
3660
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");
|
|
3661
3711
|
}
|
|
3662
3712
|
return this.result(a, "complete");
|
|
@@ -3664,9 +3714,9 @@ var sr = class {
|
|
|
3664
3714
|
createSession(e) {
|
|
3665
3715
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
3666
3716
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
3667
|
-
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)));
|
|
3668
3718
|
return {
|
|
3669
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
3719
|
+
appended: new Set(e.map(({ postId: e }) => or(e))),
|
|
3670
3720
|
attributed: new Set(a),
|
|
3671
3721
|
cursor: r.cursor,
|
|
3672
3722
|
items: [],
|
|
@@ -3691,11 +3741,11 @@ var sr = class {
|
|
|
3691
3741
|
}
|
|
3692
3742
|
findUnderfilledPage(e) {
|
|
3693
3743
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
3694
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
3695
|
-
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);
|
|
3696
3746
|
}
|
|
3697
3747
|
recordPage(e) {
|
|
3698
|
-
let t =
|
|
3748
|
+
let t = sr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => sr(e) === t);
|
|
3699
3749
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3700
3750
|
...e,
|
|
3701
3751
|
contributionIds: [...e.contributionIds],
|
|
@@ -3705,7 +3755,7 @@ var sr = class {
|
|
|
3705
3755
|
};
|
|
3706
3756
|
//#endregion
|
|
3707
3757
|
//#region src/core/activeItemRemoval.ts
|
|
3708
|
-
function
|
|
3758
|
+
function ur(e, t, n, r, i) {
|
|
3709
3759
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3710
3760
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3711
3761
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3718,7 +3768,7 @@ function cr(e, t, n, r, i) {
|
|
|
3718
3768
|
}
|
|
3719
3769
|
//#endregion
|
|
3720
3770
|
//#region src/core/exactMediaRemovalController.ts
|
|
3721
|
-
function
|
|
3771
|
+
function dr(e, t) {
|
|
3722
3772
|
let [n, ...r] = t;
|
|
3723
3773
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3724
3774
|
return {
|
|
@@ -3727,10 +3777,10 @@ function lr(e, t) {
|
|
|
3727
3777
|
items: r
|
|
3728
3778
|
};
|
|
3729
3779
|
}
|
|
3730
|
-
function
|
|
3780
|
+
function fr(e) {
|
|
3731
3781
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3732
3782
|
}
|
|
3733
|
-
var
|
|
3783
|
+
var pr = class {
|
|
3734
3784
|
generation = 0;
|
|
3735
3785
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3736
3786
|
state;
|
|
@@ -3738,7 +3788,7 @@ var dr = class {
|
|
|
3738
3788
|
this.options = e, this.state = e.state;
|
|
3739
3789
|
}
|
|
3740
3790
|
remove(e) {
|
|
3741
|
-
|
|
3791
|
+
fr(e);
|
|
3742
3792
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3743
3793
|
if (!n) return null;
|
|
3744
3794
|
let r = [...P(n)], i = r[e.mediaIndex];
|
|
@@ -3755,7 +3805,7 @@ var dr = class {
|
|
|
3755
3805
|
restored: !1
|
|
3756
3806
|
});
|
|
3757
3807
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3758
|
-
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);
|
|
3759
3809
|
}
|
|
3760
3810
|
reset() {
|
|
3761
3811
|
this.generation += 1;
|
|
@@ -3781,7 +3831,7 @@ var dr = class {
|
|
|
3781
3831
|
}
|
|
3782
3832
|
restoreIntoPost(e, t) {
|
|
3783
3833
|
let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3784
|
-
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;
|
|
3785
3835
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3786
3836
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3787
3837
|
}
|
|
@@ -3794,18 +3844,18 @@ var dr = class {
|
|
|
3794
3844
|
};
|
|
3795
3845
|
//#endregion
|
|
3796
3846
|
//#region src/core/itemPlacement.ts
|
|
3797
|
-
function
|
|
3847
|
+
function mr(e, t) {
|
|
3798
3848
|
let n = new Set(t);
|
|
3799
3849
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3800
3850
|
index: t,
|
|
3801
3851
|
item: e
|
|
3802
3852
|
}] : []);
|
|
3803
3853
|
}
|
|
3804
|
-
function
|
|
3854
|
+
function hr(e, t) {
|
|
3805
3855
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3806
3856
|
return e.filter((e) => !n.has(e.postId));
|
|
3807
3857
|
}
|
|
3808
|
-
function
|
|
3858
|
+
function gr(e, t) {
|
|
3809
3859
|
t.forEach(({ index: e }) => {
|
|
3810
3860
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3811
3861
|
});
|
|
@@ -3816,7 +3866,7 @@ function mr(e, t) {
|
|
|
3816
3866
|
}
|
|
3817
3867
|
//#endregion
|
|
3818
3868
|
//#region src/core/itemRemovalController.ts
|
|
3819
|
-
var
|
|
3869
|
+
var _r = 20, vr = class {
|
|
3820
3870
|
generation = 0;
|
|
3821
3871
|
historyLimit;
|
|
3822
3872
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3825,7 +3875,7 @@ var hr = 20, gr = class {
|
|
|
3825
3875
|
itemOrder;
|
|
3826
3876
|
stopItemsWatcher;
|
|
3827
3877
|
constructor(e) {
|
|
3828
|
-
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" });
|
|
3829
3879
|
}
|
|
3830
3880
|
destroy() {
|
|
3831
3881
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3839,7 +3889,7 @@ var hr = 20, gr = class {
|
|
|
3839
3889
|
let a = this.options.startRemoval(i, t);
|
|
3840
3890
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
3841
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);
|
|
3842
|
-
return this.state.items =
|
|
3892
|
+
return this.state.items = hr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
3843
3893
|
}
|
|
3844
3894
|
reset() {
|
|
3845
3895
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3850,7 +3900,7 @@ var hr = 20, gr = class {
|
|
|
3850
3900
|
this.restoreRemoval(t);
|
|
3851
3901
|
return;
|
|
3852
3902
|
}
|
|
3853
|
-
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);
|
|
3854
3904
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
3855
3905
|
}
|
|
3856
3906
|
restoreRemoval(e) {
|
|
@@ -3876,7 +3926,7 @@ var hr = 20, gr = class {
|
|
|
3876
3926
|
}
|
|
3877
3927
|
collectOrderedPlacements(e) {
|
|
3878
3928
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3879
|
-
return
|
|
3929
|
+
return mr(this.state.items, e).map((e) => ({
|
|
3880
3930
|
index: t.get(e.item.postId) ?? e.index,
|
|
3881
3931
|
item: e.item
|
|
3882
3932
|
}));
|
|
@@ -3907,7 +3957,7 @@ var hr = 20, gr = class {
|
|
|
3907
3957
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3908
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;
|
|
3909
3959
|
}
|
|
3910
|
-
},
|
|
3960
|
+
}, yr = class {
|
|
3911
3961
|
forward = null;
|
|
3912
3962
|
forwardPromise = null;
|
|
3913
3963
|
forwardVersion = 0;
|
|
@@ -3994,7 +4044,7 @@ var hr = 20, gr = class {
|
|
|
3994
4044
|
}
|
|
3995
4045
|
}
|
|
3996
4046
|
}
|
|
3997
|
-
},
|
|
4047
|
+
}, br = class {
|
|
3998
4048
|
generation = 0;
|
|
3999
4049
|
pending = Promise.resolve();
|
|
4000
4050
|
constructor(e) {
|
|
@@ -4044,24 +4094,24 @@ var hr = 20, gr = class {
|
|
|
4044
4094
|
};
|
|
4045
4095
|
//#endregion
|
|
4046
4096
|
//#region src/core/removalControllers.ts
|
|
4047
|
-
function
|
|
4048
|
-
let t = new
|
|
4097
|
+
function xr(e) {
|
|
4098
|
+
let t = new yr(e), n = new br({
|
|
4049
4099
|
state: e.state,
|
|
4050
4100
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4051
4101
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4052
4102
|
});
|
|
4053
4103
|
return {
|
|
4054
|
-
exactMediaRemoval: new
|
|
4104
|
+
exactMediaRemoval: new pr({
|
|
4055
4105
|
onActivate: e.onActivate,
|
|
4056
4106
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4057
4107
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4058
4108
|
reelForward: t,
|
|
4059
4109
|
state: e.state
|
|
4060
4110
|
}),
|
|
4061
|
-
itemRemoval: new
|
|
4111
|
+
itemRemoval: new vr({
|
|
4062
4112
|
historyLimit: e.historyLimit,
|
|
4063
4113
|
onItemsRemoved: (n, r, i) => {
|
|
4064
|
-
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));
|
|
4065
4115
|
},
|
|
4066
4116
|
onRemovalRestored: (n) => {
|
|
4067
4117
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4076,17 +4126,17 @@ function yr(e) {
|
|
|
4076
4126
|
reelRemoval: n
|
|
4077
4127
|
};
|
|
4078
4128
|
}
|
|
4079
|
-
var
|
|
4080
|
-
function
|
|
4129
|
+
var Sr = 1.5;
|
|
4130
|
+
function Cr(e) {
|
|
4081
4131
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4082
4132
|
if (t > 0 && t < 600) return !0;
|
|
4083
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4133
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Sr;
|
|
4084
4134
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4085
4135
|
}
|
|
4086
|
-
function
|
|
4087
|
-
return
|
|
4136
|
+
function wr(e) {
|
|
4137
|
+
return Cr(e) ? "reel" : "masonry";
|
|
4088
4138
|
}
|
|
4089
|
-
function
|
|
4139
|
+
function Tr(e) {
|
|
4090
4140
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4091
4141
|
return {
|
|
4092
4142
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4096,15 +4146,15 @@ function Cr(e) {
|
|
|
4096
4146
|
viewportWidth: n.clientWidth
|
|
4097
4147
|
};
|
|
4098
4148
|
}
|
|
4099
|
-
function
|
|
4100
|
-
return
|
|
4149
|
+
function Er(e) {
|
|
4150
|
+
return Cr(Tr(e));
|
|
4101
4151
|
}
|
|
4102
|
-
function
|
|
4103
|
-
return
|
|
4152
|
+
function Dr(e) {
|
|
4153
|
+
return wr(Tr(e));
|
|
4104
4154
|
}
|
|
4105
4155
|
//#endregion
|
|
4106
4156
|
//#region src/core/responsiveLayoutController.ts
|
|
4107
|
-
var
|
|
4157
|
+
var Or = class {
|
|
4108
4158
|
layoutMode;
|
|
4109
4159
|
resizeObserver = null;
|
|
4110
4160
|
target = null;
|
|
@@ -4129,10 +4179,10 @@ var Er = class {
|
|
|
4129
4179
|
}
|
|
4130
4180
|
handleResponsiveLayout = () => {
|
|
4131
4181
|
if (!this.target) return;
|
|
4132
|
-
let e =
|
|
4133
|
-
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);
|
|
4134
4184
|
};
|
|
4135
|
-
},
|
|
4185
|
+
}, kr = class {
|
|
4136
4186
|
routedReelPostId = null;
|
|
4137
4187
|
reelRouteIsActive = !1;
|
|
4138
4188
|
constructor(e, t) {
|
|
@@ -4159,7 +4209,7 @@ var Er = class {
|
|
|
4159
4209
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
4160
4210
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
4161
4211
|
}
|
|
4162
|
-
},
|
|
4212
|
+
}, Ar = class {
|
|
4163
4213
|
app = null;
|
|
4164
4214
|
autoScroll;
|
|
4165
4215
|
autofillController;
|
|
@@ -4181,24 +4231,24 @@ var Er = class {
|
|
|
4181
4231
|
notificationItems;
|
|
4182
4232
|
state;
|
|
4183
4233
|
constructor(e) {
|
|
4184
|
-
this.options = e,
|
|
4234
|
+
this.options = e, rr(e);
|
|
4185
4235
|
let t = e.layout ?? "masonry";
|
|
4186
|
-
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({
|
|
4187
4237
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4188
4238
|
state: this.state.autoScroll
|
|
4189
|
-
}), this.autofillController = new
|
|
4239
|
+
}), this.autofillController = new vn({
|
|
4190
4240
|
cancelRequest: () => this.cancelRequest(),
|
|
4191
4241
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4192
4242
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4193
4243
|
options: e.autofill,
|
|
4194
4244
|
state: this.state
|
|
4195
|
-
}), this.removalReconciliation = new
|
|
4245
|
+
}), this.removalReconciliation = new lr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Gn({
|
|
4196
4246
|
fill: e.fill,
|
|
4197
4247
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4198
4248
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4199
4249
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4200
4250
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4201
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4251
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Kn({
|
|
4202
4252
|
controller: this.removalReconciliation,
|
|
4203
4253
|
isCurrent: t,
|
|
4204
4254
|
loadPage: e.loadPage,
|
|
@@ -4208,8 +4258,8 @@ var Er = class {
|
|
|
4208
4258
|
state: this.state
|
|
4209
4259
|
}),
|
|
4210
4260
|
state: this.state
|
|
4211
|
-
}), this.routing = new
|
|
4212
|
-
let n =
|
|
4261
|
+
}), this.routing = new kr(e.routing, this.state);
|
|
4262
|
+
let n = xr({
|
|
4213
4263
|
historyLimit: e.removalHistoryLimit,
|
|
4214
4264
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4215
4265
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
@@ -4218,20 +4268,20 @@ var Er = class {
|
|
|
4218
4268
|
state: this.state,
|
|
4219
4269
|
surface: () => this.surface
|
|
4220
4270
|
});
|
|
4221
|
-
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, () => {
|
|
4222
4272
|
this.routing.syncFeed();
|
|
4223
4273
|
}), this.startStateNotifications();
|
|
4224
4274
|
}
|
|
4225
4275
|
async mount() {
|
|
4226
4276
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4227
4277
|
this.startStateNotifications();
|
|
4228
|
-
let e =
|
|
4229
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4278
|
+
let e = ir(this.options.target);
|
|
4279
|
+
this.responsiveLayout.mount(e), this.app = i(Gt, {
|
|
4230
4280
|
canRetryEnd: !!this.options.loadPage,
|
|
4231
4281
|
cardFooter: this.options.cardFooter,
|
|
4232
4282
|
cardHeader: this.options.cardHeader,
|
|
4233
4283
|
feedFooter: this.options.feedFooter,
|
|
4234
|
-
feedFooterActions:
|
|
4284
|
+
feedFooterActions: qn(this),
|
|
4235
4285
|
mediaCard: this.options.mediaCard,
|
|
4236
4286
|
masonry: this.options.masonry,
|
|
4237
4287
|
onMediaReady: this.options.onMediaReady,
|
|
@@ -4254,7 +4304,7 @@ var Er = class {
|
|
|
4254
4304
|
onRetryForward: () => {
|
|
4255
4305
|
this.retryReelForward();
|
|
4256
4306
|
}
|
|
4257
|
-
}), 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) => {
|
|
4258
4308
|
this.restoreController = e;
|
|
4259
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();
|
|
4260
4310
|
}
|
|
@@ -4319,7 +4369,7 @@ var Er = class {
|
|
|
4319
4369
|
this.autoScroll.setSpeed(e);
|
|
4320
4370
|
}
|
|
4321
4371
|
applyAutofillUpdate(e) {
|
|
4322
|
-
let t =
|
|
4372
|
+
let t = Dn(this.options.autofill, this.state, e);
|
|
4323
4373
|
return t && this.autofillController.syncCountdown(), t;
|
|
4324
4374
|
}
|
|
4325
4375
|
cancelAutofill() {
|
|
@@ -4330,7 +4380,7 @@ var Er = class {
|
|
|
4330
4380
|
await this.cancelFill();
|
|
4331
4381
|
return;
|
|
4332
4382
|
}
|
|
4333
|
-
if (
|
|
4383
|
+
if (mn(this.state.autofill)) {
|
|
4334
4384
|
await this.cancelAutofill();
|
|
4335
4385
|
return;
|
|
4336
4386
|
}
|
|
@@ -4344,12 +4394,12 @@ var Er = class {
|
|
|
4344
4394
|
}
|
|
4345
4395
|
async fill(e) {
|
|
4346
4396
|
if (!this.state.loadMoreLocked) {
|
|
4347
|
-
if (this.pendingRequest ||
|
|
4397
|
+
if (this.pendingRequest || mn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4348
4398
|
await this.fillController.start(e);
|
|
4349
4399
|
}
|
|
4350
4400
|
}
|
|
4351
4401
|
restoreAutofillSession(e) {
|
|
4352
|
-
let t =
|
|
4402
|
+
let t = On(this.options.autofill, this.state, e);
|
|
4353
4403
|
return t && this.autofillController.syncCountdown(), t;
|
|
4354
4404
|
}
|
|
4355
4405
|
restoreFillSession(e) {
|
|
@@ -4359,14 +4409,14 @@ var Er = class {
|
|
|
4359
4409
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
4360
4410
|
}
|
|
4361
4411
|
appendPage(e) {
|
|
4362
|
-
|
|
4412
|
+
Zt(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
4363
4413
|
}
|
|
4364
4414
|
replenishAfterRemoval() {
|
|
4365
4415
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
4366
4416
|
}
|
|
4367
4417
|
async startLoadMore(e) {
|
|
4368
4418
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4369
|
-
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;
|
|
4370
4420
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4371
4421
|
let t = e();
|
|
4372
4422
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -4381,12 +4431,12 @@ var Er = class {
|
|
|
4381
4431
|
}
|
|
4382
4432
|
async replaceFeed(e, t) {
|
|
4383
4433
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4384
|
-
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);
|
|
4385
4435
|
}
|
|
4386
4436
|
async loadFilteredPage(e) {
|
|
4387
4437
|
let t = this.options.loadPage;
|
|
4388
4438
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4389
|
-
let n =
|
|
4439
|
+
let n = Kt(await t(e));
|
|
4390
4440
|
return {
|
|
4391
4441
|
...n,
|
|
4392
4442
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4405,7 +4455,7 @@ var Er = class {
|
|
|
4405
4455
|
let t = ++this.requestVersion, n = new AbortController();
|
|
4406
4456
|
this.abortController = n;
|
|
4407
4457
|
try {
|
|
4408
|
-
let r = await
|
|
4458
|
+
let r = await Kn({
|
|
4409
4459
|
controller: this.removalReconciliation,
|
|
4410
4460
|
isCurrent: () => t === this.requestVersion,
|
|
4411
4461
|
loadPage: e,
|
|
@@ -4423,7 +4473,7 @@ var Er = class {
|
|
|
4423
4473
|
}
|
|
4424
4474
|
async retryEnd() {
|
|
4425
4475
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4426
|
-
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);
|
|
4427
4477
|
}
|
|
4428
4478
|
setInfiniteScroll(e) {
|
|
4429
4479
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4447,10 +4497,10 @@ var Er = class {
|
|
|
4447
4497
|
this.state.total = e;
|
|
4448
4498
|
}
|
|
4449
4499
|
setReelAutoAdvance(e) {
|
|
4450
|
-
|
|
4500
|
+
Zn(this.state.reelAutoAdvance, e);
|
|
4451
4501
|
}
|
|
4452
4502
|
setReelInfoSheet(e) {
|
|
4453
|
-
|
|
4503
|
+
$n(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4454
4504
|
}
|
|
4455
4505
|
setLayout(e) {
|
|
4456
4506
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4470,7 +4520,7 @@ var Er = class {
|
|
|
4470
4520
|
async fetchPage(e, t) {
|
|
4471
4521
|
if (!this.options.loadPage) return;
|
|
4472
4522
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4473
|
-
this.abortController = r, await
|
|
4523
|
+
this.abortController = r, await ar({
|
|
4474
4524
|
append: t,
|
|
4475
4525
|
autofillController: this.autofillController,
|
|
4476
4526
|
cursor: e,
|
|
@@ -4492,7 +4542,7 @@ var Er = class {
|
|
|
4492
4542
|
startInitialAutofill() {
|
|
4493
4543
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4494
4544
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4495
|
-
let r =
|
|
4545
|
+
let r = An({
|
|
4496
4546
|
cycleId: n,
|
|
4497
4547
|
isCurrent: () => e === this.requestVersion,
|
|
4498
4548
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4519,8 +4569,8 @@ var Er = class {
|
|
|
4519
4569
|
this.lastLoadedCursor = e, this.state.current = e;
|
|
4520
4570
|
}
|
|
4521
4571
|
};
|
|
4522
|
-
function
|
|
4523
|
-
return new
|
|
4572
|
+
function jr(e) {
|
|
4573
|
+
return new Ar(e);
|
|
4524
4574
|
}
|
|
4525
4575
|
//#endregion
|
|
4526
|
-
export {
|
|
4576
|
+
export { jr as createVibe };
|