@wyxos/vibe 5.9.0 → 5.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/MediaControls.vue.d.ts +2 -1
- package/lib/components/useMediaCardAudio.d.ts +2 -2
- package/lib/components/useMediaCarouselNavigation.d.ts +15 -0
- package/lib/components/useMediaLoading.d.ts +2 -2
- package/lib/components/useMediaReadiness.d.ts +1 -1
- package/lib/components/useReelVideoActivity.d.ts +5 -5
- package/lib/components/useTimedMediaCard.d.ts +30 -0
- package/lib/core/masonry.d.ts +1 -1
- package/lib/core/mediaAsset.d.ts +2 -0
- package/lib/core/mediaType.d.ts +2 -0
- package/lib/index.cjs +2 -2
- package/lib/index.js +1137 -950
- package/lib/style.css +1 -1
- package/lib/types.d.ts +2 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, h as p, nextTick as m, normalizeClass as h, normalizeProps as g, normalizeStyle as _, onBeforeUnmount as v, onMounted as y, openBlock as b, reactive as x, renderList as S, resolveDynamicComponent as C, shallowRef as w, toDisplayString as T, unref as E, useId as D, watch as O, withCtx as k, withKeys as A, withModifiers as j } from "vue";
|
|
2
|
+
//#region src/core/mediaType.ts
|
|
3
|
+
var M = /\.(aac|flac|m4a|mp3|oga|ogg|opus|wav)$/i, N = /\.(m4v|mkv|mov|mp4|ogv|webm)$/i;
|
|
4
|
+
function P(e) {
|
|
5
|
+
try {
|
|
6
|
+
return new URL(e).pathname;
|
|
7
|
+
} catch {
|
|
8
|
+
return e.split(/[?#]/)[0] ?? e;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function F(e) {
|
|
12
|
+
let t = P(e);
|
|
13
|
+
return M.test(t) ? "audio" : N.test(t) ? "video" : "image";
|
|
14
|
+
}
|
|
15
|
+
function I(e, t) {
|
|
16
|
+
return e ?? F(t);
|
|
17
|
+
}
|
|
18
|
+
function L(e, t) {
|
|
19
|
+
return I(e, t) !== "image";
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
2
22
|
//#region src/core/mediaAsset.ts
|
|
3
|
-
function
|
|
23
|
+
function R(e) {
|
|
4
24
|
return {
|
|
5
25
|
height: e.height,
|
|
6
26
|
src: e.src,
|
|
@@ -8,33 +28,53 @@ function M(e) {
|
|
|
8
28
|
width: e.width
|
|
9
29
|
};
|
|
10
30
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
function z(e, t) {
|
|
32
|
+
if (t === "preview" && e.preview) {
|
|
33
|
+
let t = I(e.type, e.src) === "audio" ? I(e.preview.type, e.preview.src) : e.preview.type ?? e.type;
|
|
34
|
+
return {
|
|
35
|
+
...e.preview,
|
|
36
|
+
type: t
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return t === "mobile" && e.mobile ? {
|
|
16
40
|
...e.mobile,
|
|
17
41
|
type: e.mobile.type ?? e.type
|
|
18
|
-
} :
|
|
42
|
+
} : R(e);
|
|
19
43
|
}
|
|
20
|
-
function
|
|
44
|
+
function B(e) {
|
|
45
|
+
let t = e.preview;
|
|
46
|
+
return !t?.src || t.src === e.src || I(t.type, t.src) !== "image" ? null : {
|
|
47
|
+
...t,
|
|
48
|
+
type: "image"
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function ee(e, t) {
|
|
52
|
+
return I(e.type, e.src) === "audio" ? t === "mobile" && e.mobile && I(e.mobile.type, e.mobile.src) === "audio" ? {
|
|
53
|
+
...e.mobile,
|
|
54
|
+
type: "audio"
|
|
55
|
+
} : {
|
|
56
|
+
...R(e),
|
|
57
|
+
type: "audio"
|
|
58
|
+
} : z(e, t);
|
|
59
|
+
}
|
|
60
|
+
function V(e) {
|
|
21
61
|
return [e, ...e.items];
|
|
22
62
|
}
|
|
23
|
-
function
|
|
63
|
+
function H(e, t) {
|
|
24
64
|
return Math.min(e.items.length, Math.max(0, t));
|
|
25
65
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
66
|
+
function U(e, t) {
|
|
67
|
+
return V(e)[H(e, t)] ?? e;
|
|
28
68
|
}
|
|
29
|
-
function
|
|
69
|
+
function W(e, t) {
|
|
30
70
|
return `${String(e)}:${t}`;
|
|
31
71
|
}
|
|
32
72
|
//#endregion
|
|
33
73
|
//#region src/core/runtime.ts
|
|
34
|
-
function
|
|
74
|
+
function G(e) {
|
|
35
75
|
return r(() => Object.freeze([...e.items]));
|
|
36
76
|
}
|
|
37
|
-
function
|
|
77
|
+
function te(e, t = [...e.items]) {
|
|
38
78
|
return {
|
|
39
79
|
activeReelPostId: e.activeReelPostId,
|
|
40
80
|
autoScroll: { ...e.autoScroll },
|
|
@@ -64,17 +104,17 @@ function z(e, t = [...e.items]) {
|
|
|
64
104
|
}
|
|
65
105
|
//#endregion
|
|
66
106
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
67
|
-
var
|
|
107
|
+
var K = {
|
|
68
108
|
key: 0,
|
|
69
109
|
class: "gallery-footer"
|
|
70
|
-
},
|
|
110
|
+
}, q = {
|
|
71
111
|
key: 0,
|
|
72
112
|
class: "load-more-status",
|
|
73
113
|
role: "status"
|
|
74
|
-
},
|
|
114
|
+
}, ne = ["disabled"], J = {
|
|
75
115
|
key: 2,
|
|
76
116
|
class: "end-feed"
|
|
77
|
-
},
|
|
117
|
+
}, re = ["disabled"], Y = /* @__PURE__ */ d({
|
|
78
118
|
__name: "GalleryFooter",
|
|
79
119
|
props: {
|
|
80
120
|
canRetryEnd: { type: Boolean },
|
|
@@ -90,14 +130,14 @@ var B = {
|
|
|
90
130
|
function i() {
|
|
91
131
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
92
132
|
}
|
|
93
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer",
|
|
133
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", K, [e.isLoading ? (b(), s("p", q, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
|
|
94
134
|
key: 1,
|
|
95
135
|
"data-test": "load-more",
|
|
96
136
|
class: "load-more-button",
|
|
97
137
|
type: "button",
|
|
98
138
|
disabled: e.loadMoreLocked,
|
|
99
139
|
onClick: i
|
|
100
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
140
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, ne)) : (b(), s("div", J, [n[1] ||= c("p", {
|
|
101
141
|
class: "end-feed-message",
|
|
102
142
|
role: "status"
|
|
103
143
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -106,9 +146,9 @@ var B = {
|
|
|
106
146
|
type: "button",
|
|
107
147
|
disabled: e.loadMoreLocked,
|
|
108
148
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
109
|
-
}, " Check for more ", 8,
|
|
149
|
+
}, " Check for more ", 8, re)]))])) : o("", !0);
|
|
110
150
|
}
|
|
111
|
-
}),
|
|
151
|
+
}), ie = /* @__PURE__ */ d({
|
|
112
152
|
__name: "FeedFooter",
|
|
113
153
|
props: {
|
|
114
154
|
actions: {},
|
|
@@ -145,7 +185,7 @@ var B = {
|
|
|
145
185
|
"can-retry-end",
|
|
146
186
|
"show-load-more",
|
|
147
187
|
"state"
|
|
148
|
-
])) : (b(), a(
|
|
188
|
+
])) : (b(), a(Y, {
|
|
149
189
|
key: 1,
|
|
150
190
|
"can-retry-end": e.canRetryEnd,
|
|
151
191
|
"has-error": e.hasError,
|
|
@@ -164,7 +204,7 @@ var B = {
|
|
|
164
204
|
"show-load-more"
|
|
165
205
|
]));
|
|
166
206
|
}
|
|
167
|
-
}),
|
|
207
|
+
}), ae = ["role"], X = { class: "gallery-status" }, oe = /* @__PURE__ */ d({
|
|
168
208
|
__name: "FeedStatus",
|
|
169
209
|
props: {
|
|
170
210
|
actions: {},
|
|
@@ -177,8 +217,8 @@ var B = {
|
|
|
177
217
|
let r = t, i = n;
|
|
178
218
|
return (n, u) => (b(), s("main", {
|
|
179
219
|
class: "gallery-shell",
|
|
180
|
-
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
181
|
-
}, [c("p",
|
|
220
|
+
role: r.state.error ? "alert" : r.state.isLoading || r.state.isLoadingMore ? "status" : void 0
|
|
221
|
+
}, [c("p", X, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading || r.state.isLoadingMore ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(ie, {
|
|
182
222
|
key: 0,
|
|
183
223
|
actions: t.actions,
|
|
184
224
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -200,32 +240,32 @@ var B = {
|
|
|
200
240
|
"is-loading",
|
|
201
241
|
"load-more-locked",
|
|
202
242
|
"state"
|
|
203
|
-
])) : o("", !0)], 8,
|
|
243
|
+
])) : o("", !0)], 8, ae));
|
|
204
244
|
}
|
|
205
245
|
});
|
|
206
|
-
function
|
|
246
|
+
function se(e) {
|
|
207
247
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
208
248
|
}
|
|
209
249
|
//#endregion
|
|
210
250
|
//#region src/core/masonry.ts
|
|
211
|
-
function
|
|
212
|
-
let t = e.preview
|
|
251
|
+
function Z(e) {
|
|
252
|
+
let t = e.preview?.width ?? e.width, n = e.preview?.height ?? e.height;
|
|
213
253
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
214
254
|
}
|
|
215
|
-
function
|
|
255
|
+
function ce(e) {
|
|
216
256
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
217
257
|
}
|
|
218
|
-
function
|
|
258
|
+
function le(e) {
|
|
219
259
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
220
260
|
}
|
|
221
|
-
function
|
|
261
|
+
function ue(e, t, n) {
|
|
222
262
|
if (t <= 0 || e.length === 0) return {
|
|
223
263
|
columns: 0,
|
|
224
264
|
height: 0,
|
|
225
265
|
items: []
|
|
226
266
|
};
|
|
227
267
|
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 =
|
|
268
|
+
let t = ce(c), n = s * Z(e) + i, a = {
|
|
229
269
|
x: t * (s + r),
|
|
230
270
|
y: c[t],
|
|
231
271
|
width: s,
|
|
@@ -241,7 +281,7 @@ function oe(e, t, n) {
|
|
|
241
281
|
}
|
|
242
282
|
//#endregion
|
|
243
283
|
//#region src/core/masonryViewportIndex.ts
|
|
244
|
-
function
|
|
284
|
+
function de(e, t) {
|
|
245
285
|
let n = /* @__PURE__ */ new Map();
|
|
246
286
|
return e.forEach((e, r) => {
|
|
247
287
|
let i = n.get(e.x) ?? [];
|
|
@@ -252,7 +292,7 @@ function se(e, t) {
|
|
|
252
292
|
}), n.set(e.x, i);
|
|
253
293
|
}), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
|
|
254
294
|
}
|
|
255
|
-
function
|
|
295
|
+
function fe(e, t) {
|
|
256
296
|
let n = 0, r = 0, i = e.length;
|
|
257
297
|
for (; r < i;) {
|
|
258
298
|
let a = Math.floor((r + i) / 2);
|
|
@@ -263,10 +303,10 @@ function J(e, t) {
|
|
|
263
303
|
inspected: n
|
|
264
304
|
};
|
|
265
305
|
}
|
|
266
|
-
function
|
|
306
|
+
function Q(e, t) {
|
|
267
307
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
|
|
268
308
|
return e.columns.forEach((e) => {
|
|
269
|
-
let t =
|
|
309
|
+
let t = fe(e, r);
|
|
270
310
|
o += t.inspected;
|
|
271
311
|
for (let n = t.index; n < e.length; n += 1) {
|
|
272
312
|
let t = e[n];
|
|
@@ -278,14 +318,14 @@ function ce(e, t) {
|
|
|
278
318
|
inspected: o
|
|
279
319
|
};
|
|
280
320
|
}
|
|
281
|
-
function
|
|
321
|
+
function pe(e) {
|
|
282
322
|
return e?.minColumnWidth ?? 240;
|
|
283
323
|
}
|
|
284
|
-
function
|
|
324
|
+
function me(e, t) {
|
|
285
325
|
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
286
326
|
return a === void 0 ? i : Math.min(i, a);
|
|
287
327
|
}
|
|
288
|
-
function
|
|
328
|
+
function he(e) {
|
|
289
329
|
if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
|
|
290
330
|
let t = e?.overscan;
|
|
291
331
|
if (t) {
|
|
@@ -299,10 +339,10 @@ function de(e) {
|
|
|
299
339
|
}
|
|
300
340
|
//#endregion
|
|
301
341
|
//#region src/core/scrollbar.ts
|
|
302
|
-
function
|
|
342
|
+
function ge(e, t, n) {
|
|
303
343
|
return Math.min(n, Math.max(t, e));
|
|
304
344
|
}
|
|
305
|
-
function
|
|
345
|
+
function _e({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
306
346
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
307
347
|
if (!(c > 0 && o > 0)) return {
|
|
308
348
|
maximumScrollPosition: c,
|
|
@@ -311,23 +351,23 @@ function fe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
311
351
|
thumbSize: o,
|
|
312
352
|
thumbTravel: 0
|
|
313
353
|
};
|
|
314
|
-
let l =
|
|
354
|
+
let l = ge(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
315
355
|
return {
|
|
316
356
|
maximumScrollPosition: c,
|
|
317
357
|
scrollable: !0,
|
|
318
|
-
thumbOffset: u * (
|
|
358
|
+
thumbOffset: u * (ge(n, 0, c) / c),
|
|
319
359
|
thumbSize: l,
|
|
320
360
|
thumbTravel: u
|
|
321
361
|
};
|
|
322
362
|
}
|
|
323
363
|
//#endregion
|
|
324
364
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
325
|
-
var
|
|
365
|
+
var ve = ["aria-hidden"], ye = [
|
|
326
366
|
"aria-controls",
|
|
327
367
|
"aria-valuemax",
|
|
328
368
|
"aria-valuenow",
|
|
329
369
|
"tabindex"
|
|
330
|
-
],
|
|
370
|
+
], be = 32, xe = 40, Se = 120, Ce = /* @__PURE__ */ d({
|
|
331
371
|
__name: "GalleryScrollbar",
|
|
332
372
|
props: {
|
|
333
373
|
contentSize: {},
|
|
@@ -349,16 +389,16 @@ var X = ["aria-hidden"], pe = [
|
|
|
349
389
|
function k() {
|
|
350
390
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
351
391
|
g = null, o.value || (l.value = !1);
|
|
352
|
-
},
|
|
392
|
+
}, Se);
|
|
353
393
|
}
|
|
354
394
|
function A() {
|
|
355
395
|
l.value = !0, k();
|
|
356
396
|
}
|
|
357
397
|
function j() {
|
|
358
398
|
let e = t.scrollElement, r = i.value;
|
|
359
|
-
return !e || !r ? n :
|
|
399
|
+
return !e || !r ? n : _e({
|
|
360
400
|
contentSize: e.scrollHeight,
|
|
361
|
-
minimumThumbSize:
|
|
401
|
+
minimumThumbSize: be,
|
|
362
402
|
scrollPosition: e.scrollTop,
|
|
363
403
|
trackSize: r.clientHeight,
|
|
364
404
|
viewportSize: e.clientHeight
|
|
@@ -411,7 +451,7 @@ var X = ["aria-hidden"], pe = [
|
|
|
411
451
|
}
|
|
412
452
|
function z(e) {
|
|
413
453
|
if (!E.value) return;
|
|
414
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
454
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - xe : e.key === "ArrowDown" ? r + xe : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
415
455
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
416
456
|
}
|
|
417
457
|
function B(e) {
|
|
@@ -457,15 +497,15 @@ var X = ["aria-hidden"], pe = [
|
|
|
457
497
|
onPointerdown: I,
|
|
458
498
|
onPointermove: L,
|
|
459
499
|
onPointerup: R
|
|
460
|
-
}, null, 44,
|
|
500
|
+
}, null, 44, ye)], 42, ve));
|
|
461
501
|
}
|
|
462
|
-
}),
|
|
502
|
+
}), we = (e) => {
|
|
463
503
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
464
504
|
return !1;
|
|
465
|
-
},
|
|
466
|
-
let t =
|
|
505
|
+
}, Te = (e) => e === "", Ee = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), De = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Oe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ke = (e) => {
|
|
506
|
+
let t = Oe(e);
|
|
467
507
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
468
|
-
},
|
|
508
|
+
}, Ae = {
|
|
469
509
|
xmlns: "http://www.w3.org/2000/svg",
|
|
470
510
|
width: 24,
|
|
471
511
|
height: 24,
|
|
@@ -475,27 +515,48 @@ var X = ["aria-hidden"], pe = [
|
|
|
475
515
|
"stroke-width": 2,
|
|
476
516
|
"stroke-linecap": "round",
|
|
477
517
|
"stroke-linejoin": "round"
|
|
478
|
-
},
|
|
479
|
-
...
|
|
518
|
+
}, je = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Ae.width, color: s = Ae.stroke, ...c }, { slots: l }) => p("svg", {
|
|
519
|
+
...Ae,
|
|
480
520
|
...c,
|
|
481
521
|
width: o,
|
|
482
522
|
height: o,
|
|
483
523
|
stroke: s,
|
|
484
|
-
"stroke-width":
|
|
485
|
-
class:
|
|
486
|
-
...!l.default && !
|
|
487
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
524
|
+
"stroke-width": Te(n) || Te(r) || n === !0 || r === !0 ? Number(i || a || Ae["stroke-width"]) * 24 / Number(o) : i || a || Ae["stroke-width"],
|
|
525
|
+
class: Ee("lucide", c.class, ...e ? [`lucide-${De(ke(e))}-icon`, `lucide-${De(e)}`] : ["lucide-icon"]),
|
|
526
|
+
...!l.default && !we(c) && { "aria-hidden": "true" }
|
|
527
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Me = (e, t) => (n, { slots: r, attrs: i }) => p(je, {
|
|
488
528
|
...i,
|
|
489
529
|
...n,
|
|
490
530
|
iconNode: t,
|
|
491
531
|
name: e
|
|
492
|
-
}, r),
|
|
532
|
+
}, r), Ne = Me("chevron-left", [["path", {
|
|
493
533
|
d: "m15 18-6-6 6-6",
|
|
494
534
|
key: "1wnfg3"
|
|
495
|
-
}]]),
|
|
535
|
+
}]]), Pe = Me("chevron-right", [["path", {
|
|
496
536
|
d: "m9 18 6-6-6-6",
|
|
497
537
|
key: "mthhwq"
|
|
498
|
-
}]]),
|
|
538
|
+
}]]), Fe = Me("disc-3", [
|
|
539
|
+
["circle", {
|
|
540
|
+
cx: "12",
|
|
541
|
+
cy: "12",
|
|
542
|
+
r: "10",
|
|
543
|
+
key: "1mglay"
|
|
544
|
+
}],
|
|
545
|
+
["path", {
|
|
546
|
+
d: "M6 12c0-1.7.7-3.2 1.8-4.2",
|
|
547
|
+
key: "oqkarx"
|
|
548
|
+
}],
|
|
549
|
+
["circle", {
|
|
550
|
+
cx: "12",
|
|
551
|
+
cy: "12",
|
|
552
|
+
r: "2",
|
|
553
|
+
key: "1c9p78"
|
|
554
|
+
}],
|
|
555
|
+
["path", {
|
|
556
|
+
d: "M18 12c0 1.7-.7 3.2-1.8 4.2",
|
|
557
|
+
key: "1eah9h"
|
|
558
|
+
}]
|
|
559
|
+
]), Ie = Me("pause", [["rect", {
|
|
499
560
|
x: "14",
|
|
500
561
|
y: "3",
|
|
501
562
|
width: "5",
|
|
@@ -509,10 +570,10 @@ var X = ["aria-hidden"], pe = [
|
|
|
509
570
|
height: "18",
|
|
510
571
|
rx: "1",
|
|
511
572
|
key: "1wsw3u"
|
|
512
|
-
}]]),
|
|
573
|
+
}]]), Le = Me("play", [["path", {
|
|
513
574
|
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
575
|
key: "10ikf1"
|
|
515
|
-
}]]),
|
|
576
|
+
}]]), Re = Me("volume-2", [
|
|
516
577
|
["path", {
|
|
517
578
|
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
579
|
key: "uqj9uw"
|
|
@@ -525,7 +586,7 @@ var X = ["aria-hidden"], pe = [
|
|
|
525
586
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
526
587
|
key: "ijwkga"
|
|
527
588
|
}]
|
|
528
|
-
]),
|
|
589
|
+
]), ze = Me("volume-x", [
|
|
529
590
|
["path", {
|
|
530
591
|
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
592
|
key: "uqj9uw"
|
|
@@ -544,22 +605,22 @@ var X = ["aria-hidden"], pe = [
|
|
|
544
605
|
y2: "15",
|
|
545
606
|
key: "5ykzw1"
|
|
546
607
|
}]
|
|
547
|
-
]),
|
|
608
|
+
]), Be = {
|
|
548
609
|
401: "Authentication required",
|
|
549
610
|
403: "Access forbidden",
|
|
550
611
|
404: "Preview not found",
|
|
551
612
|
419: "Session expired",
|
|
552
613
|
500: "Server error"
|
|
553
614
|
};
|
|
554
|
-
function
|
|
615
|
+
function Ve(e) {
|
|
555
616
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
556
617
|
}
|
|
557
|
-
function
|
|
558
|
-
return
|
|
618
|
+
function He(e) {
|
|
619
|
+
return Be[Ve(e)] ?? "Preview unavailable";
|
|
559
620
|
}
|
|
560
621
|
//#endregion
|
|
561
622
|
//#region src/components/CardRegion.vue
|
|
562
|
-
var
|
|
623
|
+
var Ue = /* @__PURE__ */ d({
|
|
563
624
|
__name: "CardRegion",
|
|
564
625
|
props: {
|
|
565
626
|
index: {},
|
|
@@ -574,7 +635,7 @@ var Ie = /* @__PURE__ */ d({
|
|
|
574
635
|
total: {}
|
|
575
636
|
},
|
|
576
637
|
setup(e) {
|
|
577
|
-
let t = e, n = r(() =>
|
|
638
|
+
let t = e, n = r(() => H(t.item, t.mediaIndex)), i = r(() => V(t.item)), o = r(() => U(t.item, n.value)), c = r(() => ({
|
|
578
639
|
height: `${t.region.height}px`,
|
|
579
640
|
paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
|
|
580
641
|
paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
|
|
@@ -606,7 +667,7 @@ var Ie = /* @__PURE__ */ d({
|
|
|
606
667
|
"total"
|
|
607
668
|
]))], 38));
|
|
608
669
|
}
|
|
609
|
-
}),
|
|
670
|
+
}), We = ["aria-busy", "aria-label"], Ge = { class: "media-error-code" }, Ke = ["disabled"], qe = /* @__PURE__ */ d({
|
|
610
671
|
__name: "MediaError",
|
|
611
672
|
props: {
|
|
612
673
|
component: {},
|
|
@@ -641,7 +702,7 @@ var Ie = /* @__PURE__ */ d({
|
|
|
641
702
|
"retrying",
|
|
642
703
|
"status"
|
|
643
704
|
]))], 32)) : (b(), s(e, { key: 1 }, [
|
|
644
|
-
c("strong",
|
|
705
|
+
c("strong", Ge, T(t.status), 1),
|
|
645
706
|
c("span", null, T(t.label), 1),
|
|
646
707
|
c("button", {
|
|
647
708
|
"data-test": "media-retry",
|
|
@@ -650,26 +711,32 @@ var Ie = /* @__PURE__ */ d({
|
|
|
650
711
|
disabled: t.retrying,
|
|
651
712
|
onClick: j(o, ["stop"]),
|
|
652
713
|
onKeydown: r[2] ||= j(() => {}, ["stop"])
|
|
653
|
-
}, T(t.retrying ? "Retrying…" : "Retry"), 41,
|
|
654
|
-
], 64))], 8,
|
|
714
|
+
}, T(t.retrying ? "Retrying…" : "Retry"), 41, Ke)
|
|
715
|
+
], 64))], 8, We));
|
|
655
716
|
}
|
|
656
|
-
}),
|
|
717
|
+
}), Je = ["aria-label"], Ye = [
|
|
657
718
|
"max",
|
|
658
719
|
"value",
|
|
720
|
+
"aria-label",
|
|
659
721
|
"aria-valuetext",
|
|
660
722
|
"disabled"
|
|
661
|
-
],
|
|
723
|
+
], Xe = {
|
|
662
724
|
key: 0,
|
|
663
725
|
class: "media-controls-row"
|
|
664
|
-
},
|
|
726
|
+
}, Ze = ["aria-label", "title"], Qe = { class: "media-controls-audio" }, $e = ["aria-label", "title"], et = [
|
|
727
|
+
"value",
|
|
728
|
+
"aria-label",
|
|
729
|
+
"aria-valuetext"
|
|
730
|
+
], tt = {
|
|
665
731
|
class: "media-control-time",
|
|
666
732
|
"aria-live": "off"
|
|
667
|
-
},
|
|
733
|
+
}, nt = /* @__PURE__ */ d({
|
|
668
734
|
__name: "MediaControls",
|
|
669
735
|
props: {
|
|
670
736
|
currentTime: {},
|
|
671
737
|
duration: {},
|
|
672
738
|
layout: {},
|
|
739
|
+
mediaType: {},
|
|
673
740
|
muted: { type: Boolean },
|
|
674
741
|
playing: { type: Boolean },
|
|
675
742
|
volume: {}
|
|
@@ -692,10 +759,11 @@ var Ie = /* @__PURE__ */ d({
|
|
|
692
759
|
function d(e) {
|
|
693
760
|
return Number(e.target.value);
|
|
694
761
|
}
|
|
695
|
-
let f = r(() => Math.max(0, n.duration)), p = r(() => l(n.currentTime, f.value)),
|
|
762
|
+
let f = r(() => Math.max(0, n.duration)), p = r(() => n.mediaType === "audio" ? "audio" : "video"), m = r(() => n.mediaType === "audio" ? "Audio" : "Video"), g = r(() => l(n.currentTime, f.value)), v = r(() => ({ "--media-range-progress": `${f.value > 0 ? g.value / f.value * 100 : 0}%` })), y = r(() => ({ "--media-range-progress": `${l(n.volume) * 100}%` }));
|
|
696
763
|
return (t, n) => (b(), s("div", {
|
|
697
764
|
class: h(["media-controls", `media-controls--${e.layout}`]),
|
|
698
|
-
|
|
765
|
+
role: "group",
|
|
766
|
+
"aria-label": `${m.value} controls`,
|
|
699
767
|
onClick: n[4] ||= j(() => {}, ["stop"]),
|
|
700
768
|
onDblclick: n[5] ||= j(() => {}, ["stop"]),
|
|
701
769
|
onKeydown: n[6] ||= j(() => {}, ["stop"]),
|
|
@@ -706,60 +774,60 @@ var Ie = /* @__PURE__ */ d({
|
|
|
706
774
|
min: "0",
|
|
707
775
|
max: f.value || 0,
|
|
708
776
|
step: "0.1",
|
|
709
|
-
value:
|
|
710
|
-
style: _(
|
|
711
|
-
"aria-label":
|
|
712
|
-
"aria-valuetext": `${u(
|
|
777
|
+
value: g.value,
|
|
778
|
+
style: _(v.value),
|
|
779
|
+
"aria-label": `Seek ${p.value}`,
|
|
780
|
+
"aria-valuetext": `${u(g.value)} of ${u(f.value)}`,
|
|
713
781
|
disabled: f.value <= 0,
|
|
714
782
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
715
|
-
}, null, 44,
|
|
783
|
+
}, null, 44, Ye), e.layout === "reel" ? (b(), s("div", Xe, [
|
|
716
784
|
c("button", {
|
|
717
785
|
type: "button",
|
|
718
786
|
class: "media-control-button media-control-playback",
|
|
719
|
-
"aria-label": e.playing ?
|
|
787
|
+
"aria-label": e.playing ? `Pause ${p.value}` : `Play ${p.value}`,
|
|
720
788
|
title: e.playing ? "Pause" : "Play",
|
|
721
789
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
722
|
-
}, [e.playing ? (b(), a(E(
|
|
790
|
+
}, [e.playing ? (b(), a(E(Ie), {
|
|
723
791
|
key: 0,
|
|
724
792
|
size: 18,
|
|
725
793
|
fill: "currentColor"
|
|
726
|
-
})) : (b(), a(E(
|
|
794
|
+
})) : (b(), a(E(Le), {
|
|
727
795
|
key: 1,
|
|
728
796
|
size: 18,
|
|
729
797
|
fill: "currentColor"
|
|
730
|
-
}))], 8,
|
|
731
|
-
c("div",
|
|
798
|
+
}))], 8, Ze),
|
|
799
|
+
c("div", Qe, [c("button", {
|
|
732
800
|
type: "button",
|
|
733
801
|
class: "media-control-button",
|
|
734
|
-
"aria-label": e.muted ?
|
|
802
|
+
"aria-label": e.muted ? `Unmute ${p.value}` : `Mute ${p.value}`,
|
|
735
803
|
title: e.muted ? "Unmute" : "Mute",
|
|
736
804
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
737
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
805
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(ze), {
|
|
738
806
|
key: 0,
|
|
739
807
|
size: 18
|
|
740
|
-
})) : (b(), a(E(
|
|
808
|
+
})) : (b(), a(E(Re), {
|
|
741
809
|
key: 1,
|
|
742
810
|
size: 18
|
|
743
|
-
}))], 8,
|
|
811
|
+
}))], 8, $e), c("input", {
|
|
744
812
|
class: "media-control-range media-control-volume",
|
|
745
813
|
type: "range",
|
|
746
814
|
min: "0",
|
|
747
815
|
max: "1",
|
|
748
816
|
step: "0.05",
|
|
749
817
|
value: e.volume,
|
|
750
|
-
style: _(
|
|
751
|
-
"aria-label":
|
|
818
|
+
style: _(y.value),
|
|
819
|
+
"aria-label": `${m.value} volume`,
|
|
752
820
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
753
821
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
754
|
-
}, null, 44,
|
|
755
|
-
c("output",
|
|
756
|
-
])) : o("", !0)],
|
|
822
|
+
}, null, 44, et)]),
|
|
823
|
+
c("output", tt, T(u(g.value)) + " / " + T(u(f.value)), 1)
|
|
824
|
+
])) : o("", !0)], 42, Je));
|
|
757
825
|
}
|
|
758
|
-
}),
|
|
826
|
+
}), rt = {
|
|
759
827
|
key: 0,
|
|
760
828
|
class: "media-card-overlay-host",
|
|
761
829
|
"data-test": "media-card-overlay"
|
|
762
|
-
},
|
|
830
|
+
}, it = /* @__PURE__ */ d({
|
|
763
831
|
__name: "MediaContextOverlay",
|
|
764
832
|
props: {
|
|
765
833
|
item: {},
|
|
@@ -769,7 +837,7 @@ var Ie = /* @__PURE__ */ d({
|
|
|
769
837
|
mediaSource: {}
|
|
770
838
|
},
|
|
771
839
|
setup(e) {
|
|
772
|
-
return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div",
|
|
840
|
+
return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div", rt, [(b(), a(C(e.mediaCard.overlay.component), {
|
|
773
841
|
item: e.item,
|
|
774
842
|
"media-index": e.mediaIndex,
|
|
775
843
|
"media-item": e.mediaItem,
|
|
@@ -781,91 +849,55 @@ var Ie = /* @__PURE__ */ d({
|
|
|
781
849
|
"media-source"
|
|
782
850
|
]))])) : o("", !0);
|
|
783
851
|
}
|
|
784
|
-
}),
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
let n = e.videoElement.value;
|
|
824
|
-
if (!n || !Number.isFinite(t)) return;
|
|
825
|
-
let r = Math.min(1, Math.max(0, t));
|
|
826
|
-
n.volume = r, n.muted = r === 0, r > 0 && (a = r), s(n, !0), c(n);
|
|
827
|
-
}
|
|
828
|
-
function u() {
|
|
829
|
-
let t = e.videoElement.value;
|
|
830
|
-
t && (t.muted && t.volume === 0 && (t.volume = a), t.muted = !t.muted, s(t, !0), c(t));
|
|
831
|
-
}
|
|
832
|
-
return O([
|
|
833
|
-
e.active,
|
|
834
|
-
e.layout,
|
|
835
|
-
() => e.reelAudioState()?.lastAudibleVolume,
|
|
836
|
-
() => e.reelAudioState()?.muted,
|
|
837
|
-
() => e.reelAudioState()?.volume,
|
|
838
|
-
e.videoElement
|
|
839
|
-
], o, { immediate: !0 }), {
|
|
840
|
-
apply: o,
|
|
841
|
-
setVolume: l,
|
|
842
|
-
sync: s,
|
|
843
|
-
toggleMute: u,
|
|
844
|
-
videoIsMuted: r,
|
|
845
|
-
videoVolume: i
|
|
852
|
+
}), at = 40, ot = 160, st = 24;
|
|
853
|
+
function ct(e) {
|
|
854
|
+
let t = w("next"), n = null, r = 0, i = !1, a = null, o = null;
|
|
855
|
+
function s(n, r) {
|
|
856
|
+
let i = V(e.item()).length, a = (n + i) % i;
|
|
857
|
+
a !== e.mediaIndex() && (t.value = n < e.mediaIndex() ? "previous" : "next", e.onChange(a), r?.detail && r.detail > 0 && r.currentTarget?.blur());
|
|
858
|
+
}
|
|
859
|
+
function c() {
|
|
860
|
+
r = 0, i = !1, n !== null && clearTimeout(n), n = null;
|
|
861
|
+
}
|
|
862
|
+
function l() {
|
|
863
|
+
n !== null && clearTimeout(n), n = setTimeout(c, ot);
|
|
864
|
+
}
|
|
865
|
+
function u(e, t, n) {
|
|
866
|
+
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
867
|
+
}
|
|
868
|
+
function d(t) {
|
|
869
|
+
if (V(e.item()).length <= 1) return;
|
|
870
|
+
let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
|
|
871
|
+
if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < st)) return;
|
|
872
|
+
let o = Math.sign(r);
|
|
873
|
+
r = 0, i = !0, s(e.mediaIndex() + o);
|
|
874
|
+
}
|
|
875
|
+
function f(t) {
|
|
876
|
+
let n = t.touches[0];
|
|
877
|
+
e.layout() !== "reel" || !n || (a = n.clientX, o = n.clientY);
|
|
878
|
+
}
|
|
879
|
+
function p(t) {
|
|
880
|
+
let n = t.changedTouches[0];
|
|
881
|
+
if (a === null || o === null || !n) return;
|
|
882
|
+
let r = a - n.clientX, i = o - n.clientY;
|
|
883
|
+
a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < at || s(e.mediaIndex() + Math.sign(r)));
|
|
884
|
+
}
|
|
885
|
+
return v(c), {
|
|
886
|
+
change: s,
|
|
887
|
+
direction: t,
|
|
888
|
+
onTouchEnd: p,
|
|
889
|
+
onTouchStart: f,
|
|
890
|
+
onWheel: d
|
|
846
891
|
};
|
|
847
892
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
var tt = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
851
|
-
function nt(e) {
|
|
852
|
-
try {
|
|
853
|
-
return tt.test(new URL(e).pathname);
|
|
854
|
-
} catch {
|
|
855
|
-
return tt.test(e.split("?")[0] ?? e);
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
function rt(e, t) {
|
|
859
|
-
return e === void 0 ? nt(t) : e === "video";
|
|
860
|
-
}
|
|
861
|
-
var it = /* @__PURE__ */ new Map(), at = [], ot = 0, st = 0;
|
|
862
|
-
function ct(e, t) {
|
|
893
|
+
var lt = /* @__PURE__ */ new Map(), ut = [], dt = 0, ft = 0;
|
|
894
|
+
function pt(e, t) {
|
|
863
895
|
return `${t ? "timed" : "image"}:${e}`;
|
|
864
896
|
}
|
|
865
|
-
function
|
|
866
|
-
let r =
|
|
897
|
+
function mt(e, t, n) {
|
|
898
|
+
let r = V(e);
|
|
867
899
|
if (r.length < 2) return [];
|
|
868
|
-
let i =
|
|
900
|
+
let i = H(e, t), a = [];
|
|
869
901
|
for (let e = 1; e < r.length; e += 1) {
|
|
870
902
|
let t = i + e, n = i - e;
|
|
871
903
|
t < r.length && a.push(t), n >= 0 && a.push(n);
|
|
@@ -874,7 +906,9 @@ function lt(e, t, n) {
|
|
|
874
906
|
return a.flatMap((e) => {
|
|
875
907
|
let t = r[e];
|
|
876
908
|
if (!t) return [];
|
|
877
|
-
let i =
|
|
909
|
+
let i = I(t.type, t.src) === "audio" ? B(t) : z(t, n);
|
|
910
|
+
if (!i) return [];
|
|
911
|
+
let a = L(i.type, i.src), s = pt(i.src, a);
|
|
878
912
|
return o.has(s) ? [] : (o.add(s), [{
|
|
879
913
|
key: s,
|
|
880
914
|
src: i.src,
|
|
@@ -882,22 +916,22 @@ function lt(e, t, n) {
|
|
|
882
916
|
}]);
|
|
883
917
|
});
|
|
884
918
|
}
|
|
885
|
-
function
|
|
919
|
+
function ht(e) {
|
|
886
920
|
let t = e.element;
|
|
887
921
|
e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
|
|
888
922
|
}
|
|
889
|
-
function
|
|
890
|
-
|
|
891
|
-
let t =
|
|
892
|
-
t >= 0 &&
|
|
923
|
+
function gt(e) {
|
|
924
|
+
lt.delete(e.key);
|
|
925
|
+
let t = ut.indexOf(e);
|
|
926
|
+
t >= 0 && ut.splice(t, 1), e.cancel?.(), e.cancel = null, ht(e);
|
|
893
927
|
}
|
|
894
|
-
function
|
|
895
|
-
e.state = "loading",
|
|
928
|
+
function _t(e) {
|
|
929
|
+
e.state = "loading", dt += 1, e.timed && (ft += 1);
|
|
896
930
|
let t = !1, n = () => void 0, r = (r) => {
|
|
897
|
-
t || (t = !0, n(), --
|
|
931
|
+
t || (t = !0, n(), --dt, e.timed && --ft, e.cancel = null, e.state = r, r === "failed" && ht(e), e.refs === 0 && gt(e), vt());
|
|
898
932
|
};
|
|
899
933
|
if (e.cancel = () => {
|
|
900
|
-
t || (t = !0, n(), --
|
|
934
|
+
t || (t = !0, n(), --dt, e.timed && --ft, ht(e), vt());
|
|
901
935
|
}, e.timed) {
|
|
902
936
|
let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
|
|
903
937
|
n = () => {
|
|
@@ -916,38 +950,38 @@ function ft(e) {
|
|
|
916
950
|
i.removeEventListener("load", a), i.removeEventListener("error", o);
|
|
917
951
|
}, i.addEventListener("load", a, { once: !0 }), i.addEventListener("error", o, { once: !0 }), i.decoding = "async", i.fetchPriority = "low", i.src = e.src, e.element = i;
|
|
918
952
|
}
|
|
919
|
-
function
|
|
920
|
-
for (;
|
|
921
|
-
let e =
|
|
953
|
+
function vt() {
|
|
954
|
+
for (; dt < 6;) {
|
|
955
|
+
let e = ut.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || ft < 2));
|
|
922
956
|
if (e < 0) return;
|
|
923
|
-
let [t] =
|
|
924
|
-
t &&
|
|
957
|
+
let [t] = ut.splice(e, 1);
|
|
958
|
+
t && _t(t);
|
|
925
959
|
}
|
|
926
960
|
}
|
|
927
|
-
function
|
|
928
|
-
let t =
|
|
961
|
+
function yt(e) {
|
|
962
|
+
let t = lt.get(e.key);
|
|
929
963
|
t || (t = {
|
|
930
964
|
...e,
|
|
931
965
|
cancel: null,
|
|
932
966
|
element: null,
|
|
933
967
|
refs: 0,
|
|
934
968
|
state: "queued"
|
|
935
|
-
},
|
|
969
|
+
}, lt.set(t.key, t), ut.push(t)), t.refs += 1, vt();
|
|
936
970
|
let n = !1;
|
|
937
971
|
return () => {
|
|
938
|
-
n || (n = !0, --t.refs, t.refs === 0 &&
|
|
972
|
+
n || (n = !0, --t.refs, t.refs === 0 && gt(t));
|
|
939
973
|
};
|
|
940
974
|
}
|
|
941
975
|
//#endregion
|
|
942
976
|
//#region src/components/useVisiblePostPreload.ts
|
|
943
|
-
function
|
|
944
|
-
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ?
|
|
977
|
+
function bt(e) {
|
|
978
|
+
let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? mt(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
|
|
945
979
|
function a() {
|
|
946
980
|
let e = new Map(n.value.map((e) => [e.key, e]));
|
|
947
981
|
i.forEach((t, n) => {
|
|
948
982
|
e.has(n) || (t(), i.delete(n));
|
|
949
983
|
}), n.value.forEach((e) => {
|
|
950
|
-
i.has(e.key) || i.set(e.key,
|
|
984
|
+
i.has(e.key) || i.set(e.key, yt(e));
|
|
951
985
|
});
|
|
952
986
|
}
|
|
953
987
|
O(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), v(() => {
|
|
@@ -955,54 +989,20 @@ function ht(e) {
|
|
|
955
989
|
});
|
|
956
990
|
}
|
|
957
991
|
//#endregion
|
|
958
|
-
//#region src/components/useReelVideoActivity.ts
|
|
959
|
-
function gt(e) {
|
|
960
|
-
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
961
|
-
function i() {
|
|
962
|
-
if (!t.value) {
|
|
963
|
-
e.videoElement.value?.pause(), e.videoIsPlaying.value = !1;
|
|
964
|
-
return;
|
|
965
|
-
}
|
|
966
|
-
e.videoIsPlaying.value = !0;
|
|
967
|
-
}
|
|
968
|
-
return O(t, (n) => {
|
|
969
|
-
let r = e.videoElement.value;
|
|
970
|
-
if (!n) {
|
|
971
|
-
r?.pause(), r && (r.muted = !0), e.videoIsPlaying.value = !1;
|
|
972
|
-
return;
|
|
973
|
-
}
|
|
974
|
-
m().then(async () => {
|
|
975
|
-
let n = e.videoElement.value;
|
|
976
|
-
if (!(!n || !t.value)) {
|
|
977
|
-
n.muted = e.videoIsMuted.value;
|
|
978
|
-
try {
|
|
979
|
-
await n.play();
|
|
980
|
-
} catch {
|
|
981
|
-
e.videoIsPlaying.value = !1;
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
});
|
|
985
|
-
}), {
|
|
986
|
-
effectiveMuted: n,
|
|
987
|
-
onPlaying: i,
|
|
988
|
-
playbackAllowed: t
|
|
989
|
-
};
|
|
990
|
-
}
|
|
991
|
-
//#endregion
|
|
992
992
|
//#region src/components/useMediaLoading.ts
|
|
993
|
-
function
|
|
994
|
-
let t = r(() =>
|
|
993
|
+
function xt(e) {
|
|
994
|
+
let t = r(() => L(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");
|
|
995
995
|
return O(i, (t, n) => {
|
|
996
|
-
n !== "none" || t === "none" || m(() => e.
|
|
996
|
+
n !== "none" || t === "none" || m(() => e.mediaElement.value?.load());
|
|
997
997
|
}), {
|
|
998
998
|
imageLoading: n,
|
|
999
999
|
mediaIsTimed: t,
|
|
1000
|
-
|
|
1000
|
+
timedMediaPreload: i
|
|
1001
1001
|
};
|
|
1002
1002
|
}
|
|
1003
1003
|
//#endregion
|
|
1004
1004
|
//#region src/components/useMediaReadiness.ts
|
|
1005
|
-
function
|
|
1005
|
+
function St(e) {
|
|
1006
1006
|
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());
|
|
1007
1007
|
function f() {
|
|
1008
1008
|
l !== null && clearTimeout(l), l = null;
|
|
@@ -1055,12 +1055,180 @@ function vt(e) {
|
|
|
1055
1055
|
retrySource: b,
|
|
1056
1056
|
retrying: c,
|
|
1057
1057
|
sourceGeneration: i,
|
|
1058
|
-
|
|
1058
|
+
mediaElement: n
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
//#endregion
|
|
1062
|
+
//#region src/core/reelAudio.ts
|
|
1063
|
+
var Ct = {
|
|
1064
|
+
lastAudibleVolume: 1,
|
|
1065
|
+
muted: !1,
|
|
1066
|
+
volume: 1
|
|
1067
|
+
};
|
|
1068
|
+
function wt(e, t) {
|
|
1069
|
+
return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
|
|
1070
|
+
}
|
|
1071
|
+
function Tt(e, t = Ct) {
|
|
1072
|
+
let n = wt(e?.volume, t.volume), r = wt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
|
|
1073
|
+
return {
|
|
1074
|
+
lastAudibleVolume: r > 0 ? r : Ct.lastAudibleVolume,
|
|
1075
|
+
muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
|
|
1076
|
+
volume: n
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
//#endregion
|
|
1080
|
+
//#region src/components/useMediaCardAudio.ts
|
|
1081
|
+
function Et(e) {
|
|
1082
|
+
let t = Tt(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
|
|
1083
|
+
function o() {
|
|
1084
|
+
let t = e.mediaElement.value, n = e.reelAudioState();
|
|
1085
|
+
if (!t || e.layout() !== "reel" || !n) return;
|
|
1086
|
+
let o = Tt(n);
|
|
1087
|
+
a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
|
|
1088
|
+
}
|
|
1089
|
+
function s(e, t) {
|
|
1090
|
+
t && (r.value = e.muted), i.value = e.volume, e.volume > 0 && (a = e.volume);
|
|
1091
|
+
}
|
|
1092
|
+
function c(t) {
|
|
1093
|
+
if (e.layout() !== "reel") return;
|
|
1094
|
+
let n = Tt({
|
|
1095
|
+
lastAudibleVolume: a,
|
|
1096
|
+
muted: t.muted,
|
|
1097
|
+
volume: t.volume
|
|
1098
|
+
});
|
|
1099
|
+
r.value = n.muted, i.value = n.volume, a = n.lastAudibleVolume, e.onChange(n);
|
|
1100
|
+
}
|
|
1101
|
+
function l(t) {
|
|
1102
|
+
let n = e.mediaElement.value;
|
|
1103
|
+
if (!n || !Number.isFinite(t)) return;
|
|
1104
|
+
let r = Math.min(1, Math.max(0, t));
|
|
1105
|
+
n.volume = r, n.muted = r === 0, r > 0 && (a = r), s(n, !0), c(n);
|
|
1106
|
+
}
|
|
1107
|
+
function u() {
|
|
1108
|
+
let t = e.mediaElement.value;
|
|
1109
|
+
t && (t.muted && t.volume === 0 && (t.volume = a), t.muted = !t.muted, s(t, !0), c(t));
|
|
1110
|
+
}
|
|
1111
|
+
return O([
|
|
1112
|
+
e.active,
|
|
1113
|
+
e.layout,
|
|
1114
|
+
() => e.reelAudioState()?.lastAudibleVolume,
|
|
1115
|
+
() => e.reelAudioState()?.muted,
|
|
1116
|
+
() => e.reelAudioState()?.volume,
|
|
1117
|
+
e.mediaElement
|
|
1118
|
+
], o, { immediate: !0 }), {
|
|
1119
|
+
apply: o,
|
|
1120
|
+
setVolume: l,
|
|
1121
|
+
sync: s,
|
|
1122
|
+
toggleMute: u,
|
|
1123
|
+
videoIsMuted: r,
|
|
1124
|
+
videoVolume: i
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
//#endregion
|
|
1128
|
+
//#region src/components/useReelVideoActivity.ts
|
|
1129
|
+
function Dt(e) {
|
|
1130
|
+
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.mediaIsMuted.value : !0);
|
|
1131
|
+
function i() {
|
|
1132
|
+
if (!t.value) {
|
|
1133
|
+
e.mediaElement.value?.pause(), e.mediaIsPlaying.value = !1;
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
e.mediaIsPlaying.value = !0;
|
|
1137
|
+
}
|
|
1138
|
+
return O(t, (n) => {
|
|
1139
|
+
let r = e.mediaElement.value;
|
|
1140
|
+
if (!n) {
|
|
1141
|
+
r?.pause(), r && (r.muted = !0), e.mediaIsPlaying.value = !1;
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
m().then(async () => {
|
|
1145
|
+
let n = e.mediaElement.value;
|
|
1146
|
+
if (!(!n || !t.value)) {
|
|
1147
|
+
n.muted = e.mediaIsMuted.value;
|
|
1148
|
+
try {
|
|
1149
|
+
await n.play();
|
|
1150
|
+
} catch {
|
|
1151
|
+
e.mediaIsPlaying.value = !1;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
}), {
|
|
1156
|
+
effectiveMuted: n,
|
|
1157
|
+
onPlaying: i,
|
|
1158
|
+
playbackAllowed: t
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
//#endregion
|
|
1162
|
+
//#region src/components/useTimedMediaCard.ts
|
|
1163
|
+
function Ot(e) {
|
|
1164
|
+
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
1165
|
+
}
|
|
1166
|
+
function kt(e) {
|
|
1167
|
+
let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = Et({
|
|
1168
|
+
active: e.active,
|
|
1169
|
+
layout: e.layout,
|
|
1170
|
+
mediaCard: e.mediaCard,
|
|
1171
|
+
mediaElement: e.mediaElement,
|
|
1172
|
+
onChange: e.onAudioChange,
|
|
1173
|
+
reelAudioState: e.reelAudioState
|
|
1174
|
+
}), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = Dt({
|
|
1175
|
+
active: e.active,
|
|
1176
|
+
layout: e.layout,
|
|
1177
|
+
mediaElement: e.mediaElement,
|
|
1178
|
+
mediaIsMuted: c,
|
|
1179
|
+
mediaIsPlaying: r
|
|
1180
|
+
});
|
|
1181
|
+
function p(r) {
|
|
1182
|
+
let i = r?.currentTarget ?? e.mediaElement.value;
|
|
1183
|
+
i && (t.value = Ot(i.currentTime), n.value = Ot(i.duration), o(i, f.value));
|
|
1184
|
+
}
|
|
1185
|
+
function m(t) {
|
|
1186
|
+
i(), p(t), e.onReady(t);
|
|
1187
|
+
}
|
|
1188
|
+
function h() {
|
|
1189
|
+
r.value = !1, e.onEnded();
|
|
1190
|
+
}
|
|
1191
|
+
function g(n) {
|
|
1192
|
+
let r = e.mediaElement.value;
|
|
1193
|
+
!r || !Number.isFinite(n) || (r.currentTime = Math.min(Ot(r.duration), Math.max(0, n)), t.value = r.currentTime);
|
|
1194
|
+
}
|
|
1195
|
+
async function _() {
|
|
1196
|
+
let t = e.mediaElement.value;
|
|
1197
|
+
if (!(!t || !f.value)) {
|
|
1198
|
+
if (r.value) {
|
|
1199
|
+
t.pause();
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
try {
|
|
1203
|
+
await t.play();
|
|
1204
|
+
} catch {
|
|
1205
|
+
r.value = !1;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
return O(e.mediaElement, () => {
|
|
1210
|
+
t.value = 0, n.value = 0, r.value = !1;
|
|
1211
|
+
}, { flush: "sync" }), {
|
|
1212
|
+
currentTime: t,
|
|
1213
|
+
duration: n,
|
|
1214
|
+
effectiveMuted: u,
|
|
1215
|
+
isMuted: c,
|
|
1216
|
+
isPlaying: r,
|
|
1217
|
+
onEnded: h,
|
|
1218
|
+
onLoadedMetadata: m,
|
|
1219
|
+
onPlaying: d,
|
|
1220
|
+
playbackAllowed: f,
|
|
1221
|
+
seek: g,
|
|
1222
|
+
setVolume: a,
|
|
1223
|
+
sync: p,
|
|
1224
|
+
toggleMute: s,
|
|
1225
|
+
togglePlayback: _,
|
|
1226
|
+
volume: l
|
|
1059
1227
|
};
|
|
1060
1228
|
}
|
|
1061
1229
|
//#endregion
|
|
1062
1230
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
1063
|
-
var
|
|
1231
|
+
var At = [
|
|
1064
1232
|
"data-post-id",
|
|
1065
1233
|
"data-media-index",
|
|
1066
1234
|
"aria-hidden",
|
|
@@ -1068,12 +1236,29 @@ var yt = [
|
|
|
1068
1236
|
"inert",
|
|
1069
1237
|
"role",
|
|
1070
1238
|
"tabindex"
|
|
1071
|
-
],
|
|
1239
|
+
], jt = { class: "media-card-content" }, Mt = ["data-media-direction"], Nt = ["data-media-index"], Pt = {
|
|
1072
1240
|
key: 0,
|
|
1073
1241
|
"data-test": "media-loading",
|
|
1074
1242
|
class: "media-loading",
|
|
1075
1243
|
"aria-hidden": "true"
|
|
1076
|
-
},
|
|
1244
|
+
}, Ft = [
|
|
1245
|
+
"data-source-generation",
|
|
1246
|
+
"src",
|
|
1247
|
+
"autoplay",
|
|
1248
|
+
"loop",
|
|
1249
|
+
"muted",
|
|
1250
|
+
"preload"
|
|
1251
|
+
], It = ["aria-label", "disabled"], Lt = [
|
|
1252
|
+
"src",
|
|
1253
|
+
"width",
|
|
1254
|
+
"height",
|
|
1255
|
+
"fetchpriority",
|
|
1256
|
+
"loading"
|
|
1257
|
+
], Rt = {
|
|
1258
|
+
key: 1,
|
|
1259
|
+
class: "media-audio-fallback",
|
|
1260
|
+
"aria-hidden": "true"
|
|
1261
|
+
}, zt = [
|
|
1077
1262
|
"data-source-generation",
|
|
1078
1263
|
"src",
|
|
1079
1264
|
"width",
|
|
@@ -1082,14 +1267,14 @@ var yt = [
|
|
|
1082
1267
|
"loop",
|
|
1083
1268
|
"muted",
|
|
1084
1269
|
"preload"
|
|
1085
|
-
],
|
|
1270
|
+
], Bt = [
|
|
1086
1271
|
"data-source-generation",
|
|
1087
1272
|
"src",
|
|
1088
1273
|
"width",
|
|
1089
1274
|
"height",
|
|
1090
1275
|
"fetchpriority",
|
|
1091
1276
|
"loading"
|
|
1092
|
-
],
|
|
1277
|
+
], Vt = ["aria-label"], Ht = ["aria-label"], Ut = ["aria-label"], Wt = /* @__PURE__ */ d({
|
|
1093
1278
|
__name: "MediaCard",
|
|
1094
1279
|
props: {
|
|
1095
1280
|
active: { type: Boolean },
|
|
@@ -1124,141 +1309,91 @@ var yt = [
|
|
|
1124
1309
|
"reelAudioChange"
|
|
1125
1310
|
],
|
|
1126
1311
|
setup(e, { emit: i }) {
|
|
1127
|
-
let l = e, d =
|
|
1128
|
-
function
|
|
1129
|
-
e &&
|
|
1312
|
+
let l = e, d = i;
|
|
1313
|
+
function f(e = !1, t = "pointer") {
|
|
1314
|
+
e && d("activate", t);
|
|
1130
1315
|
}
|
|
1131
|
-
let
|
|
1132
|
-
identity: () => `${l.item.postId}:${
|
|
1133
|
-
mediaIndex: () =>
|
|
1134
|
-
onError: (e) =>
|
|
1135
|
-
onReady: (e) =>
|
|
1316
|
+
let p = r(() => V(l.item)), g = r(() => H(l.item, l.mediaIndex)), v = r(() => U(l.item, g.value)), y = r(() => z(v.value, l.mediaSource ?? "preview")), x = r(() => I(v.value.type, v.value.src)), S = r(() => x.value === "audio"), C = r(() => ee(v.value, l.mediaSource ?? "preview")), T = r(() => S.value ? C.value : y.value), D = r(() => T.value.src), M = r(() => I(T.value.type, T.value.src)), N = r(() => y.value.width), P = r(() => y.value.height), F = r(() => B(v.value)), L = w(!1), R = r(() => L.value ? null : F.value), { effectivePreviewState: W, failSourceAttempt: G, imageElement: te, markSourceReady: K, noteSourceActivity: q, retrySource: ne, retrying: J, sourceGeneration: re, mediaElement: Y } = St({
|
|
1317
|
+
identity: () => `${l.item.postId}:${g.value}:${l.mediaSource ?? "preview"}:${D.value}:${M.value ?? ""}`,
|
|
1318
|
+
mediaIndex: () => g.value,
|
|
1319
|
+
onError: (e) => d("error", e),
|
|
1320
|
+
onReady: (e) => d("ready", e),
|
|
1136
1321
|
previewState: () => l.previewState
|
|
1137
1322
|
});
|
|
1138
|
-
|
|
1323
|
+
bt({
|
|
1139
1324
|
inViewport: () => l.inViewport === !0,
|
|
1140
1325
|
item: () => l.item,
|
|
1141
1326
|
layout: () => l.layout,
|
|
1142
1327
|
mediaCard: () => l.mediaCard,
|
|
1143
|
-
mediaIndex: () =>
|
|
1144
|
-
mediaReady: () =>
|
|
1328
|
+
mediaIndex: () => g.value,
|
|
1329
|
+
mediaReady: () => W.value === "ready",
|
|
1145
1330
|
mediaSource: () => l.mediaSource ?? "preview"
|
|
1146
1331
|
});
|
|
1147
|
-
let
|
|
1332
|
+
let { currentTime: ie, duration: ae, effectiveMuted: X, isMuted: oe, isPlaying: se, onEnded: Z, onLoadedMetadata: ce, onPlaying: le, playbackAllowed: ue, seek: de, setVolume: fe, sync: Q, toggleMute: pe, togglePlayback: me, volume: he } = kt({
|
|
1148
1333
|
active: () => l.active,
|
|
1149
1334
|
layout: () => l.layout,
|
|
1150
1335
|
mediaCard: () => l.mediaCard,
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
videoElement: K,
|
|
1158
|
-
videoIsMuted: J,
|
|
1159
|
-
videoIsPlaying: q
|
|
1160
|
-
}), Y = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
1161
|
-
function fe(e) {
|
|
1162
|
-
return e.detail === 0 ? "keyboard" : "pointer";
|
|
1163
|
-
}
|
|
1164
|
-
function X(e, t) {
|
|
1165
|
-
let n = C.value.length, r = (e + n) % n;
|
|
1166
|
-
r !== T.value && (y.value = e < T.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
1167
|
-
}
|
|
1168
|
-
function pe(e, t, n) {
|
|
1169
|
-
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
1170
|
-
}
|
|
1171
|
-
function me() {
|
|
1172
|
-
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
1173
|
-
}
|
|
1174
|
-
function he() {
|
|
1175
|
-
d !== null && clearTimeout(d), d = setTimeout(me, At);
|
|
1176
|
-
}
|
|
1177
|
-
function ge(e) {
|
|
1178
|
-
if (C.value.length <= 1) return;
|
|
1179
|
-
let t = e.currentTarget?.clientWidth || 1, n = pe(e.deltaX, e.deltaMode, t);
|
|
1180
|
-
if (n === 0 || (e.preventDefault(), he(), p) || (f += n, Math.abs(f) < jt)) return;
|
|
1181
|
-
let r = Math.sign(f);
|
|
1182
|
-
f = 0, p = !0, X(T.value + r);
|
|
1183
|
-
}
|
|
1336
|
+
mediaElement: Y,
|
|
1337
|
+
onAudioChange: (e) => d("reelAudioChange", e),
|
|
1338
|
+
onEnded: () => d("ended", g.value),
|
|
1339
|
+
onReady: K,
|
|
1340
|
+
reelAudioState: () => l.reelAudioState
|
|
1341
|
+
}), ge = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
1184
1342
|
function _e(e) {
|
|
1185
|
-
|
|
1186
|
-
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
1187
|
-
}
|
|
1188
|
-
function ve(e) {
|
|
1189
|
-
let t = e.changedTouches[0];
|
|
1190
|
-
if (m === null || g === null || !t) return;
|
|
1191
|
-
let n = m - t.clientX, r = g - t.clientY;
|
|
1192
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < kt || X(T.value + Math.sign(n)));
|
|
1343
|
+
return e.detail === 0 ? "keyboard" : "pointer";
|
|
1193
1344
|
}
|
|
1194
|
-
let {
|
|
1345
|
+
let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } = ct({
|
|
1346
|
+
item: () => l.item,
|
|
1347
|
+
layout: () => l.layout,
|
|
1348
|
+
mediaIndex: () => g.value,
|
|
1349
|
+
onChange: (e) => d("mediaChange", e)
|
|
1350
|
+
}), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } = xt({
|
|
1195
1351
|
active: () => l.active,
|
|
1196
1352
|
fetchPriority: () => l.fetchPriority,
|
|
1197
1353
|
layout: () => l.layout,
|
|
1198
|
-
mediaSource: () =>
|
|
1199
|
-
mediaType: () =>
|
|
1200
|
-
|
|
1201
|
-
}),
|
|
1202
|
-
function Te(e) {
|
|
1203
|
-
l.layout === "reel" && (e.stopPropagation(), Ee());
|
|
1204
|
-
}
|
|
1205
|
-
async function Ee() {
|
|
1206
|
-
if (!(!K.value || !de.value)) {
|
|
1207
|
-
if (q.value) {
|
|
1208
|
-
K.value.pause();
|
|
1209
|
-
return;
|
|
1210
|
-
}
|
|
1211
|
-
try {
|
|
1212
|
-
await K.value.play();
|
|
1213
|
-
} catch {
|
|
1214
|
-
q.value = !1;
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1354
|
+
mediaSource: () => D.value,
|
|
1355
|
+
mediaType: () => M.value,
|
|
1356
|
+
mediaElement: Y
|
|
1357
|
+
}), Ee = r(() => l.layout === "reel" && l.stationaryReelControls === !0), De = r(() => we.value && (!S.value || l.layout === "reel") && W.value === "ready" && (!Ee.value || !!(l.active && l.reelControlsTarget))), Oe = r(() => `${l.item.postId}:${g.value}:${D.value}`);
|
|
1218
1358
|
function ke(e) {
|
|
1219
|
-
|
|
1220
|
-
}
|
|
1221
|
-
function Ae(e) {
|
|
1222
|
-
let t = e?.currentTarget ?? K.value;
|
|
1223
|
-
t && (ne.value = ke(t.currentTime), re.value = ke(t.duration), oe(t, de.value));
|
|
1224
|
-
}
|
|
1225
|
-
function je(e) {
|
|
1226
|
-
ie(), Ae(e), U(e);
|
|
1227
|
-
}
|
|
1228
|
-
function Me() {
|
|
1229
|
-
q.value = !1, x("ended", T.value);
|
|
1359
|
+
l.layout === "reel" && (e.stopPropagation(), me());
|
|
1230
1360
|
}
|
|
1231
|
-
function
|
|
1232
|
-
|
|
1233
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(ke(t.duration), Math.max(0, e)), ne.value = t.currentTime);
|
|
1361
|
+
function Ae() {
|
|
1362
|
+
L.value = !0, l.layout === "masonry" && K();
|
|
1234
1363
|
}
|
|
1235
|
-
return
|
|
1236
|
-
|
|
1237
|
-
}), (
|
|
1364
|
+
return O(() => F.value?.src, () => {
|
|
1365
|
+
L.value = !1;
|
|
1366
|
+
}), O([
|
|
1367
|
+
S,
|
|
1368
|
+
() => l.layout,
|
|
1369
|
+
R
|
|
1370
|
+
], ([e, t, n]) => {
|
|
1371
|
+
e && t === "masonry" && !n && m(() => K());
|
|
1372
|
+
}, { immediate: !0 }), (r, i) => (b(), s("article", {
|
|
1238
1373
|
"data-post-id": e.item.postId,
|
|
1239
|
-
"data-media-index":
|
|
1374
|
+
"data-media-index": g.value,
|
|
1240
1375
|
class: h(["media-card", {
|
|
1241
1376
|
"media-card--entering": e.entering,
|
|
1242
1377
|
"media-card--leaving": e.leaving,
|
|
1243
|
-
"media-card--error": E(
|
|
1378
|
+
"media-card--error": E(W) === "error",
|
|
1244
1379
|
"media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
|
|
1245
1380
|
}]),
|
|
1246
1381
|
style: _(e.itemStyle),
|
|
1247
1382
|
"aria-hidden": e.leaving || void 0,
|
|
1248
|
-
"aria-busy": E(
|
|
1383
|
+
"aria-busy": E(W) === "loading" || E(J),
|
|
1249
1384
|
inert: e.leaving || void 0,
|
|
1250
|
-
role: e.interactive && !e.leaving && !
|
|
1251
|
-
tabindex: e.interactive && !e.leaving && !
|
|
1252
|
-
onClick: i[
|
|
1253
|
-
onKeydown: [i[
|
|
1254
|
-
}, [c("div",
|
|
1255
|
-
e.cardHeader ? (b(), a(
|
|
1385
|
+
role: e.interactive && !e.leaving && !ge.value ? "button" : void 0,
|
|
1386
|
+
tabindex: e.interactive && !e.leaving && !ge.value ? 0 : void 0,
|
|
1387
|
+
onClick: i[34] ||= (t) => f(e.interactive && !ge.value, _e(t)),
|
|
1388
|
+
onKeydown: [i[35] ||= A((t) => f(e.interactive && !ge.value, "keyboard"), ["enter"]), i[36] ||= A(j((t) => f(e.interactive && !ge.value, "keyboard"), ["prevent"]), ["space"])]
|
|
1389
|
+
}, [c("div", jt, [
|
|
1390
|
+
e.cardHeader ? (b(), a(Ue, {
|
|
1256
1391
|
key: 0,
|
|
1257
1392
|
index: e.index,
|
|
1258
1393
|
item: e.item,
|
|
1259
1394
|
layout: e.layout,
|
|
1260
1395
|
"loaded-count": e.loadedCount,
|
|
1261
|
-
"media-index":
|
|
1396
|
+
"media-index": g.value,
|
|
1262
1397
|
"media-source": e.mediaSource,
|
|
1263
1398
|
placement: "header",
|
|
1264
1399
|
region: e.cardHeader,
|
|
@@ -1276,85 +1411,133 @@ var yt = [
|
|
|
1276
1411
|
"total"
|
|
1277
1412
|
])) : o("", !0),
|
|
1278
1413
|
c("div", {
|
|
1279
|
-
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" &&
|
|
1280
|
-
"data-media-direction":
|
|
1281
|
-
onWheel:
|
|
1282
|
-
onTouchstartPassive:
|
|
1283
|
-
onTouchendPassive:
|
|
1414
|
+
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && p.value.length > 1 }]),
|
|
1415
|
+
"data-media-direction": E(ye),
|
|
1416
|
+
onWheel: i[31] ||= (...e) => E(Se) && E(Se)(...e),
|
|
1417
|
+
onTouchstartPassive: i[32] ||= (...e) => E(xe) && E(xe)(...e),
|
|
1418
|
+
onTouchendPassive: i[33] ||= (...e) => E(be) && E(be)(...e)
|
|
1284
1419
|
}, [
|
|
1285
1420
|
u(n, {
|
|
1286
|
-
css: !E(
|
|
1287
|
-
name: `media-slide-${
|
|
1421
|
+
css: !E(J),
|
|
1422
|
+
name: `media-slide-${E(ye)}`
|
|
1288
1423
|
}, {
|
|
1289
1424
|
default: k(() => [(b(), s("div", {
|
|
1290
|
-
key: `${e.item.postId}:${
|
|
1425
|
+
key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(re)}`,
|
|
1291
1426
|
class: "media-card-frame",
|
|
1292
|
-
"data-media-index":
|
|
1293
|
-
}, [
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
"
|
|
1313
|
-
"media-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1427
|
+
"data-media-index": g.value
|
|
1428
|
+
}, [
|
|
1429
|
+
E(W) === "loading" ? (b(), s("div", Pt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(W) === "error" ? (b(), a(qe, {
|
|
1430
|
+
key: 1,
|
|
1431
|
+
component: e.mediaCard?.error?.component,
|
|
1432
|
+
label: E(He)(D.value),
|
|
1433
|
+
retrying: E(J),
|
|
1434
|
+
status: E(Ve)(D.value),
|
|
1435
|
+
onRetry: E(ne)
|
|
1436
|
+
}, null, 8, [
|
|
1437
|
+
"component",
|
|
1438
|
+
"label",
|
|
1439
|
+
"retrying",
|
|
1440
|
+
"status",
|
|
1441
|
+
"onRetry"
|
|
1442
|
+
])) : o("", !0),
|
|
1443
|
+
S.value && e.layout === "reel" ? (b(), s("audio", {
|
|
1444
|
+
key: 2,
|
|
1445
|
+
ref_key: "mediaElement",
|
|
1446
|
+
ref: Y,
|
|
1447
|
+
"data-source-generation": E(re),
|
|
1448
|
+
class: "media-audio-element",
|
|
1449
|
+
src: D.value,
|
|
1450
|
+
autoplay: E(ue),
|
|
1451
|
+
loop: !e.advanceOnMediaEnd,
|
|
1452
|
+
muted: E(X),
|
|
1453
|
+
preload: E(Te),
|
|
1454
|
+
onLoadedmetadata: i[0] ||= (...e) => E(ce) && E(ce)(...e),
|
|
1455
|
+
onProgress: i[1] ||= (...e) => E(q) && E(q)(...e),
|
|
1456
|
+
onLoadeddata: i[2] ||= (...e) => E(q) && E(q)(...e),
|
|
1457
|
+
onCanplay: i[3] ||= (...e) => E(q) && E(q)(...e),
|
|
1458
|
+
onDurationchange: i[4] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1459
|
+
onTimeupdate: i[5] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1460
|
+
onVolumechange: i[6] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1461
|
+
onPlaying: i[7] ||= (...e) => E(le) && E(le)(...e),
|
|
1462
|
+
onPause: i[8] ||= (e) => se.value = !1,
|
|
1463
|
+
onEnded: i[9] ||= (...e) => E(Z) && E(Z)(...e),
|
|
1464
|
+
onError: i[10] ||= (...e) => E(G) && E(G)(...e)
|
|
1465
|
+
}, null, 40, Ft)) : o("", !0),
|
|
1466
|
+
S.value ? (b(), s("button", {
|
|
1467
|
+
key: 3,
|
|
1468
|
+
type: "button",
|
|
1469
|
+
class: h(["media-audio-artwork media-preview", { "media-preview--ready": E(W) === "ready" }]),
|
|
1470
|
+
"aria-label": e.layout === "reel" ? E(se) ? "Pause audio" : "Play audio" : "Audio",
|
|
1471
|
+
disabled: e.layout !== "reel",
|
|
1472
|
+
onClick: ke
|
|
1473
|
+
}, [R.value ? (b(), s("img", {
|
|
1474
|
+
key: 0,
|
|
1475
|
+
class: "media-audio-cover",
|
|
1476
|
+
src: R.value.src,
|
|
1477
|
+
width: R.value.width ?? void 0,
|
|
1478
|
+
height: R.value.height ?? void 0,
|
|
1479
|
+
fetchpriority: e.fetchPriority,
|
|
1480
|
+
alt: "",
|
|
1481
|
+
decoding: "async",
|
|
1482
|
+
loading: E(Ce),
|
|
1483
|
+
onLoad: i[11] ||= (t) => e.layout === "masonry" && E(K)(t),
|
|
1484
|
+
onError: Ae
|
|
1485
|
+
}, null, 40, Lt)) : (b(), s("span", Rt, [u(E(Fe), {
|
|
1486
|
+
size: 64,
|
|
1487
|
+
"stroke-width": 1.5
|
|
1488
|
+
})]))], 10, It)) : E(we) ? (b(), s("video", {
|
|
1489
|
+
key: 4,
|
|
1490
|
+
ref_key: "mediaElement",
|
|
1491
|
+
ref: Y,
|
|
1492
|
+
"data-source-generation": E(re),
|
|
1493
|
+
class: h(["media-preview", {
|
|
1494
|
+
"media-preview--ready": E(W) === "ready",
|
|
1495
|
+
"media-preview--reel-video": e.layout === "reel"
|
|
1496
|
+
}]),
|
|
1497
|
+
src: D.value,
|
|
1498
|
+
width: N.value ?? void 0,
|
|
1499
|
+
height: P.value ?? void 0,
|
|
1500
|
+
autoplay: E(ue),
|
|
1501
|
+
loop: !e.advanceOnMediaEnd,
|
|
1502
|
+
muted: E(X),
|
|
1503
|
+
playsinline: "",
|
|
1504
|
+
preload: E(Te),
|
|
1505
|
+
onLoadedmetadata: i[12] ||= (...e) => E(ce) && E(ce)(...e),
|
|
1506
|
+
onProgress: i[13] ||= (...e) => E(q) && E(q)(...e),
|
|
1507
|
+
onLoadeddata: i[14] ||= (...e) => E(q) && E(q)(...e),
|
|
1508
|
+
onCanplay: i[15] ||= (...e) => E(q) && E(q)(...e),
|
|
1509
|
+
onDurationchange: i[16] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1510
|
+
onTimeupdate: i[17] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1511
|
+
onVolumechange: i[18] ||= (...e) => E(Q) && E(Q)(...e),
|
|
1512
|
+
onPlaying: i[19] ||= (...e) => E(le) && E(le)(...e),
|
|
1513
|
+
onPause: i[20] ||= (e) => se.value = !1,
|
|
1514
|
+
onEnded: i[21] ||= (...e) => E(Z) && E(Z)(...e),
|
|
1515
|
+
onClick: ke,
|
|
1516
|
+
onError: i[22] ||= (...e) => E(G) && E(G)(...e)
|
|
1517
|
+
}, null, 42, zt)) : S.value ? o("", !0) : (b(), s("img", {
|
|
1518
|
+
key: 5,
|
|
1519
|
+
ref_key: "imageElement",
|
|
1520
|
+
ref: te,
|
|
1521
|
+
"data-source-generation": E(re),
|
|
1522
|
+
class: h(["media-preview", { "media-preview--ready": E(W) === "ready" }]),
|
|
1523
|
+
src: D.value,
|
|
1524
|
+
width: N.value ?? void 0,
|
|
1525
|
+
height: P.value ?? void 0,
|
|
1526
|
+
fetchpriority: e.fetchPriority,
|
|
1527
|
+
alt: "",
|
|
1528
|
+
decoding: "async",
|
|
1529
|
+
loading: E(Ce),
|
|
1530
|
+
onLoad: i[23] ||= (...e) => E(K) && E(K)(...e),
|
|
1531
|
+
onError: i[24] ||= (...e) => E(G) && E(G)(...e)
|
|
1532
|
+
}, null, 42, Bt))
|
|
1533
|
+
], 8, Nt))]),
|
|
1351
1534
|
_: 1
|
|
1352
1535
|
}, 8, ["css", "name"]),
|
|
1353
|
-
u(
|
|
1536
|
+
u(it, {
|
|
1354
1537
|
item: e.item,
|
|
1355
1538
|
"media-card": e.mediaCard,
|
|
1356
|
-
"media-index":
|
|
1357
|
-
"media-item":
|
|
1539
|
+
"media-index": g.value,
|
|
1540
|
+
"media-item": v.value,
|
|
1358
1541
|
"media-source": e.mediaSource ?? "preview"
|
|
1359
1542
|
}, null, 8, [
|
|
1360
1543
|
"item",
|
|
@@ -1364,39 +1547,43 @@ var yt = [
|
|
|
1364
1547
|
"media-source"
|
|
1365
1548
|
]),
|
|
1366
1549
|
(b(), a(t, {
|
|
1367
|
-
disabled: !
|
|
1550
|
+
disabled: !Ee.value || !e.reelControlsTarget,
|
|
1368
1551
|
to: e.reelControlsTarget ?? "body"
|
|
1369
1552
|
}, [u(n, {
|
|
1370
1553
|
name: "vibe-reel-media-controls",
|
|
1371
|
-
css:
|
|
1554
|
+
css: Ee.value
|
|
1372
1555
|
}, {
|
|
1373
|
-
default: k(() => [
|
|
1374
|
-
key:
|
|
1375
|
-
"current-time":
|
|
1376
|
-
"data-control-post-id":
|
|
1377
|
-
duration:
|
|
1556
|
+
default: k(() => [De.value ? (b(), a(nt, {
|
|
1557
|
+
key: Oe.value,
|
|
1558
|
+
"current-time": E(ie),
|
|
1559
|
+
"data-control-post-id": Ee.value ? e.item.postId : void 0,
|
|
1560
|
+
duration: E(ae),
|
|
1378
1561
|
layout: e.layout,
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1562
|
+
"media-type": S.value ? "audio" : "video",
|
|
1563
|
+
muted: E(oe),
|
|
1564
|
+
playing: E(se),
|
|
1565
|
+
volume: E(he),
|
|
1566
|
+
onSeek: E(de),
|
|
1567
|
+
onToggleMute: E(pe),
|
|
1568
|
+
onTogglePlayback: E(me),
|
|
1569
|
+
onVolumeChange: E(fe)
|
|
1386
1570
|
}, null, 8, [
|
|
1387
1571
|
"current-time",
|
|
1388
1572
|
"data-control-post-id",
|
|
1389
1573
|
"duration",
|
|
1390
1574
|
"layout",
|
|
1575
|
+
"media-type",
|
|
1391
1576
|
"muted",
|
|
1392
1577
|
"playing",
|
|
1393
1578
|
"volume",
|
|
1579
|
+
"onSeek",
|
|
1394
1580
|
"onToggleMute",
|
|
1581
|
+
"onTogglePlayback",
|
|
1395
1582
|
"onVolumeChange"
|
|
1396
1583
|
])) : o("", !0)]),
|
|
1397
1584
|
_: 1
|
|
1398
1585
|
}, 8, ["css"])], 8, ["disabled", "to"])),
|
|
1399
|
-
|
|
1586
|
+
p.value.length > 1 ? (b(), s("div", {
|
|
1400
1587
|
key: 0,
|
|
1401
1588
|
class: h(["media-carousel-controls", { "media-carousel-controls--persistent": e.layout === "reel" }]),
|
|
1402
1589
|
"aria-label": "Media navigation"
|
|
@@ -1404,31 +1591,31 @@ var yt = [
|
|
|
1404
1591
|
type: "button",
|
|
1405
1592
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1406
1593
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1407
|
-
onClick: i[
|
|
1408
|
-
onKeydown: i[
|
|
1409
|
-
}, [u(E(
|
|
1594
|
+
onClick: i[25] ||= j((e) => E(ve)(g.value - 1, e), ["stop"]),
|
|
1595
|
+
onKeydown: i[26] ||= j(() => {}, ["stop"])
|
|
1596
|
+
}, [u(E(Ne), { size: 20 })], 40, Vt), c("button", {
|
|
1410
1597
|
type: "button",
|
|
1411
1598
|
class: "media-carousel-control media-carousel-control--next",
|
|
1412
1599
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1413
|
-
onClick: i[
|
|
1414
|
-
onKeydown: i[
|
|
1415
|
-
}, [u(E(
|
|
1416
|
-
|
|
1600
|
+
onClick: i[27] ||= j((e) => E(ve)(g.value + 1, e), ["stop"]),
|
|
1601
|
+
onKeydown: i[28] ||= j(() => {}, ["stop"])
|
|
1602
|
+
}, [u(E(Pe), { size: 20 })], 40, Ht)], 2)) : o("", !0),
|
|
1603
|
+
ge.value ? (b(), s("button", {
|
|
1417
1604
|
key: 1,
|
|
1418
1605
|
class: "media-card-activator",
|
|
1419
1606
|
type: "button",
|
|
1420
1607
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1421
|
-
onClick: i[
|
|
1422
|
-
onKeydown: i[
|
|
1423
|
-
}, null, 40,
|
|
1424
|
-
], 42,
|
|
1425
|
-
e.cardFooter ? (b(), a(
|
|
1608
|
+
onClick: i[29] ||= j((e) => r.$emit("activate", _e(e)), ["stop"]),
|
|
1609
|
+
onKeydown: i[30] ||= j(() => {}, ["stop"])
|
|
1610
|
+
}, null, 40, Ut)) : o("", !0)
|
|
1611
|
+
], 42, Mt),
|
|
1612
|
+
e.cardFooter ? (b(), a(Ue, {
|
|
1426
1613
|
key: 1,
|
|
1427
1614
|
index: e.index,
|
|
1428
1615
|
item: e.item,
|
|
1429
1616
|
layout: e.layout,
|
|
1430
1617
|
"loaded-count": e.loadedCount,
|
|
1431
|
-
"media-index":
|
|
1618
|
+
"media-index": g.value,
|
|
1432
1619
|
"media-source": e.mediaSource,
|
|
1433
1620
|
placement: "footer",
|
|
1434
1621
|
region: e.cardFooter,
|
|
@@ -1445,12 +1632,12 @@ var yt = [
|
|
|
1445
1632
|
"style",
|
|
1446
1633
|
"total"
|
|
1447
1634
|
])) : o("", !0)
|
|
1448
|
-
])], 46,
|
|
1635
|
+
])], 46, At));
|
|
1449
1636
|
}
|
|
1450
|
-
}),
|
|
1637
|
+
}), Gt = { class: "masonry-feed-shell" }, Kt = ["aria-hidden", "inert"], qt = {
|
|
1451
1638
|
key: 0,
|
|
1452
1639
|
class: "masonry-feed-status-overlay"
|
|
1453
|
-
},
|
|
1640
|
+
}, Jt = 6, Yt = 12, Xt = 250, Zt = /* @__PURE__ */ d({
|
|
1454
1641
|
__name: "MasonryFeed",
|
|
1455
1642
|
props: {
|
|
1456
1643
|
enteringPostIds: {},
|
|
@@ -1487,35 +1674,35 @@ var yt = [
|
|
|
1487
1674
|
"visible"
|
|
1488
1675
|
],
|
|
1489
1676
|
setup(t, { expose: n, emit: i }) {
|
|
1490
|
-
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(
|
|
1677
|
+
let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(Jt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, L = r(() => ue(d.items, y.value, {
|
|
1491
1678
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1492
1679
|
gap: x.value,
|
|
1493
|
-
minColumnWidth:
|
|
1494
|
-
})),
|
|
1680
|
+
minColumnWidth: pe(d.masonry)
|
|
1681
|
+
})), R = r(() => {
|
|
1495
1682
|
if (d.leavingPostIds.size === 0) return null;
|
|
1496
1683
|
let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
|
|
1497
1684
|
index: t,
|
|
1498
1685
|
item: e
|
|
1499
|
-
}]), t =
|
|
1686
|
+
}]), t = ue(e.map(({ item: e }) => e), y.value, {
|
|
1500
1687
|
additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
|
|
1501
1688
|
gap: x.value,
|
|
1502
|
-
minColumnWidth:
|
|
1689
|
+
minColumnWidth: pe(d.masonry)
|
|
1503
1690
|
});
|
|
1504
1691
|
return {
|
|
1505
1692
|
indices: e.map(({ index: e }) => e),
|
|
1506
1693
|
layout: t,
|
|
1507
1694
|
positions: new Map(e.map(({ item: e }, n) => [e.postId, t.items[n]]))
|
|
1508
1695
|
};
|
|
1509
|
-
}),
|
|
1510
|
-
let e =
|
|
1696
|
+
}), z = r(() => {
|
|
1697
|
+
let e = L.value, t = R.value;
|
|
1511
1698
|
return t ? {
|
|
1512
1699
|
...t.layout,
|
|
1513
1700
|
items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
|
|
1514
1701
|
} : e;
|
|
1515
|
-
}),
|
|
1516
|
-
let e =
|
|
1517
|
-
return e ?
|
|
1518
|
-
}),
|
|
1702
|
+
}), B = r(() => de(L.value.items)), ee = r(() => {
|
|
1703
|
+
let e = R.value;
|
|
1704
|
+
return e ? de(e.layout.items, e.indices) : null;
|
|
1705
|
+
}), V = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? z.value.height : L.value.height)), H = r(() => ({ height: `${V.value}px` })), U = r(() => !d.infiniteScroll || C.value > 0 && k.value + z.value.height <= C.value + 1), G = r(() => new Set(A.value)), te = r(() => j.value.flatMap((e) => {
|
|
1519
1706
|
let t = d.items[e];
|
|
1520
1707
|
return t ? [{
|
|
1521
1708
|
fetchPriority: G.value.has(e) ? "high" : "low",
|
|
@@ -1523,30 +1710,30 @@ var yt = [
|
|
|
1523
1710
|
item: t
|
|
1524
1711
|
}] : [];
|
|
1525
1712
|
}));
|
|
1526
|
-
function
|
|
1713
|
+
function K(e, t) {
|
|
1527
1714
|
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1528
1715
|
}
|
|
1529
1716
|
function q(e, t) {
|
|
1530
1717
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1531
1718
|
}
|
|
1532
|
-
function
|
|
1719
|
+
function ne(e) {
|
|
1533
1720
|
let t = {
|
|
1534
1721
|
scrollTop: M - k.value,
|
|
1535
1722
|
viewportHeight: C.value
|
|
1536
|
-
}, n =
|
|
1723
|
+
}, n = ee.value, r = Q(n ?? B.value, {
|
|
1537
1724
|
...t,
|
|
1538
1725
|
overscan: e
|
|
1539
1726
|
}).indices;
|
|
1540
|
-
return
|
|
1727
|
+
return K(r, d.leavingPostIds.size === 0 ? [] : Q(B.value, {
|
|
1541
1728
|
...t,
|
|
1542
1729
|
overscan: e
|
|
1543
1730
|
}).indices);
|
|
1544
1731
|
}
|
|
1545
1732
|
function J() {
|
|
1546
|
-
let e =
|
|
1733
|
+
let e = ne(0), t = ne(me(d.masonry, C.value));
|
|
1547
1734
|
q(A.value, e) || (A.value = e), q(j.value, t) || (j.value = t);
|
|
1548
1735
|
}
|
|
1549
|
-
function
|
|
1736
|
+
function re() {
|
|
1550
1737
|
if (I !== null) return;
|
|
1551
1738
|
I = -1;
|
|
1552
1739
|
let e = requestAnimationFrame(() => {
|
|
@@ -1558,7 +1745,7 @@ var yt = [
|
|
|
1558
1745
|
O(() => [...G.value].flatMap((e) => {
|
|
1559
1746
|
let t = d.items[e];
|
|
1560
1747
|
if (!t) return [];
|
|
1561
|
-
let n = d.mediaIndices.get(t.postId) ?? 0, r =
|
|
1748
|
+
let n = d.mediaIndices.get(t.postId) ?? 0, r = W(t.postId, n);
|
|
1562
1749
|
return d.previewStates.get(r) === "ready" ? [{
|
|
1563
1750
|
key: r,
|
|
1564
1751
|
mediaIndex: n,
|
|
@@ -1573,11 +1760,11 @@ var yt = [
|
|
|
1573
1760
|
immediate: !0,
|
|
1574
1761
|
flush: "post"
|
|
1575
1762
|
});
|
|
1576
|
-
function
|
|
1577
|
-
let t =
|
|
1763
|
+
function ae(e) {
|
|
1764
|
+
let t = z.value.items[e], n = d.items[e]?.postId;
|
|
1578
1765
|
if (!t) return {};
|
|
1579
|
-
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ?
|
|
1580
|
-
containerHeight: Math.max(T.value,
|
|
1766
|
+
let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? le({
|
|
1767
|
+
containerHeight: Math.max(T.value, L.value.height),
|
|
1581
1768
|
gap: x.value
|
|
1582
1769
|
}) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
|
|
1583
1770
|
return {
|
|
@@ -1596,43 +1783,43 @@ var yt = [
|
|
|
1596
1783
|
let r = g.value;
|
|
1597
1784
|
r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, J());
|
|
1598
1785
|
}
|
|
1599
|
-
function
|
|
1786
|
+
function oe(e) {
|
|
1600
1787
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1601
|
-
y.value = e.clientWidth, x.value = Math.min(
|
|
1788
|
+
y.value = e.clientWidth, x.value = Math.min(Yt, Math.max(Jt, t * .0075)), X();
|
|
1602
1789
|
}
|
|
1603
|
-
function
|
|
1790
|
+
function Z(e) {
|
|
1604
1791
|
let t = e.currentTarget;
|
|
1605
|
-
t && (M = t.scrollTop,
|
|
1792
|
+
t && (M = t.scrollTop, re(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && se(t) && f("loadMore"));
|
|
1606
1793
|
}
|
|
1607
|
-
function
|
|
1794
|
+
function ce() {
|
|
1608
1795
|
let e = p.value;
|
|
1609
|
-
Date.now() >= l && !d.loadMoreLocked && e &&
|
|
1796
|
+
Date.now() >= l && !d.loadMoreLocked && e && se(e) && f("loadMore");
|
|
1610
1797
|
}
|
|
1611
1798
|
O(() => d.items.length, (e, t) => {
|
|
1612
|
-
e > 0 && e < t && (l = Date.now() +
|
|
1799
|
+
e > 0 && e < t && (l = Date.now() + Xt);
|
|
1613
1800
|
});
|
|
1614
|
-
function
|
|
1801
|
+
function fe() {
|
|
1615
1802
|
return p.value;
|
|
1616
1803
|
}
|
|
1617
1804
|
return O(g, (e) => {
|
|
1618
|
-
N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (
|
|
1805
|
+
N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (oe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
|
|
1619
1806
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1620
1807
|
Math.abs(n - y.value) < .5 || (F = requestAnimationFrame(() => {
|
|
1621
|
-
F = null,
|
|
1808
|
+
F = null, oe(e);
|
|
1622
1809
|
}));
|
|
1623
1810
|
}), N.observe(e)));
|
|
1624
1811
|
}), O(p, (e) => {
|
|
1625
1812
|
P?.disconnect(), P = null, e && (X(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(X), P.observe(e)));
|
|
1626
1813
|
}), O([
|
|
1627
|
-
|
|
1628
|
-
|
|
1814
|
+
L,
|
|
1815
|
+
z,
|
|
1629
1816
|
() => d.masonry
|
|
1630
1817
|
], J, { flush: "post" }), v(() => {
|
|
1631
1818
|
N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
|
|
1632
1819
|
}), n({
|
|
1633
|
-
getScrollElement:
|
|
1634
|
-
loadIfNearBottom:
|
|
1635
|
-
}), (n, r) => (b(), s("div",
|
|
1820
|
+
getScrollElement: fe,
|
|
1821
|
+
loadIfNearBottom: ce
|
|
1822
|
+
}), (n, r) => (b(), s("div", Gt, [
|
|
1636
1823
|
c("main", {
|
|
1637
1824
|
id: m,
|
|
1638
1825
|
ref_key: "galleryElement",
|
|
@@ -1641,14 +1828,14 @@ var yt = [
|
|
|
1641
1828
|
"data-layout-mode": "masonry",
|
|
1642
1829
|
"aria-hidden": t.suspended || void 0,
|
|
1643
1830
|
inert: t.suspended || void 0,
|
|
1644
|
-
onScrollPassive:
|
|
1831
|
+
onScrollPassive: Z
|
|
1645
1832
|
}, [c("section", {
|
|
1646
1833
|
ref_key: "masonryElement",
|
|
1647
1834
|
ref: g,
|
|
1648
1835
|
class: h(["masonry", { "masonry--ready": y.value > 0 }]),
|
|
1649
|
-
style: _(
|
|
1836
|
+
style: _(H.value),
|
|
1650
1837
|
"aria-label": "Media gallery"
|
|
1651
|
-
}, [(b(!0), s(e, null, S(
|
|
1838
|
+
}, [(b(!0), s(e, null, S(te.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(Wt, {
|
|
1652
1839
|
key: n.postId,
|
|
1653
1840
|
class: "masonry-item",
|
|
1654
1841
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1660,12 +1847,12 @@ var yt = [
|
|
|
1660
1847
|
"in-viewport": G.value.has(r),
|
|
1661
1848
|
index: r,
|
|
1662
1849
|
item: n,
|
|
1663
|
-
"item-style":
|
|
1850
|
+
"item-style": ae(r),
|
|
1664
1851
|
interactive: "",
|
|
1665
1852
|
layout: "masonry",
|
|
1666
1853
|
"loaded-count": t.items.length,
|
|
1667
1854
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
1668
|
-
"preview-state": t.previewStates.get(E(
|
|
1855
|
+
"preview-state": t.previewStates.get(E(W)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1669
1856
|
total: t.total,
|
|
1670
1857
|
onActivate: (e) => f("activate", n.postId, e),
|
|
1671
1858
|
onMediaChange: (e) => f("mediaChange", n.postId, e),
|
|
@@ -1690,8 +1877,8 @@ var yt = [
|
|
|
1690
1877
|
"onMediaChange",
|
|
1691
1878
|
"onReady",
|
|
1692
1879
|
"onError"
|
|
1693
|
-
]))), 128))], 6)], 42,
|
|
1694
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext &&
|
|
1880
|
+
]))), 128))], 6)], 42, Kt),
|
|
1881
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && U.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", qt, [u(ie, {
|
|
1695
1882
|
actions: t.feedFooterActions,
|
|
1696
1883
|
"can-retry-end": t.canRetryEnd,
|
|
1697
1884
|
"feed-footer": t.feedFooter,
|
|
@@ -1699,7 +1886,7 @@ var yt = [
|
|
|
1699
1886
|
"has-next": t.hasNext,
|
|
1700
1887
|
"is-loading": t.isLoadingMore,
|
|
1701
1888
|
"load-more-locked": t.loadMoreLocked,
|
|
1702
|
-
"show-load-more":
|
|
1889
|
+
"show-load-more": U.value,
|
|
1703
1890
|
state: t.state,
|
|
1704
1891
|
onLoadMore: r[0] ||= (e) => f("loadMore"),
|
|
1705
1892
|
onRetryEnd: r[1] ||= (e) => f("retryEnd")
|
|
@@ -1714,8 +1901,8 @@ var yt = [
|
|
|
1714
1901
|
"show-load-more",
|
|
1715
1902
|
"state"
|
|
1716
1903
|
])])) : o("", !0),
|
|
1717
|
-
u(
|
|
1718
|
-
"content-size":
|
|
1904
|
+
u(Ce, {
|
|
1905
|
+
"content-size": z.value.height,
|
|
1719
1906
|
"controls-id": m,
|
|
1720
1907
|
"scroll-element": p.value,
|
|
1721
1908
|
suspended: t.suspended
|
|
@@ -1726,8 +1913,8 @@ var yt = [
|
|
|
1726
1913
|
])
|
|
1727
1914
|
]));
|
|
1728
1915
|
}
|
|
1729
|
-
}),
|
|
1730
|
-
function
|
|
1916
|
+
}), Qt = 300;
|
|
1917
|
+
function $t(e, t, n) {
|
|
1731
1918
|
let r = e.scrollTop;
|
|
1732
1919
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1733
1920
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1735,7 +1922,7 @@ function Vt(e, t, n) {
|
|
|
1735
1922
|
return new Promise((n) => {
|
|
1736
1923
|
let o = (s) => {
|
|
1737
1924
|
a += 1;
|
|
1738
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1925
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / Qt), u = 1 - (1 - l) ** 3;
|
|
1739
1926
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1740
1927
|
requestAnimationFrame(o);
|
|
1741
1928
|
return;
|
|
@@ -1747,7 +1934,7 @@ function Vt(e, t, n) {
|
|
|
1747
1934
|
}
|
|
1748
1935
|
//#endregion
|
|
1749
1936
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1750
|
-
var
|
|
1937
|
+
var en = ["aria-label"], tn = /* @__PURE__ */ d({
|
|
1751
1938
|
__name: "ReelAutoAdvanceProgress",
|
|
1752
1939
|
props: {
|
|
1753
1940
|
durationMs: {},
|
|
@@ -1765,9 +1952,9 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
1765
1952
|
class: "reel-auto-advance-progress",
|
|
1766
1953
|
style: _(a.value),
|
|
1767
1954
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1768
|
-
}, null, 36)], 8,
|
|
1955
|
+
}, null, 36)], 8, en));
|
|
1769
1956
|
}
|
|
1770
|
-
}),
|
|
1957
|
+
}), nn = { class: "reel-viewport" }, rn = ["data-active-post-id", "data-active-media-index"], an = ["role", "data-status"], on = 300, sn = 250, cn = /* @__PURE__ */ d({
|
|
1771
1958
|
__name: "ReelFeed",
|
|
1772
1959
|
props: {
|
|
1773
1960
|
initialPostId: {},
|
|
@@ -1806,113 +1993,113 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
1806
1993
|
"retryForward"
|
|
1807
1994
|
],
|
|
1808
1995
|
setup(t, { expose: n, emit: i }) {
|
|
1809
|
-
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,
|
|
1996
|
+
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, N = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), P = r(() => {
|
|
1810
1997
|
let e = Math.max(0, x.value - 2), t = Math.min(u.items.length - 1, x.value + 2);
|
|
1811
1998
|
return u.items.slice(e, t + 1).map((t, n) => ({
|
|
1812
1999
|
fetchPriority: e + n === x.value ? "high" : "low",
|
|
1813
2000
|
index: e + n,
|
|
1814
2001
|
item: t
|
|
1815
2002
|
}));
|
|
1816
|
-
}),
|
|
1817
|
-
let e =
|
|
2003
|
+
}), F = r(() => u.items[x.value]?.postId), I = r(() => u.items[x.value]), R = r(() => {
|
|
2004
|
+
let e = F.value;
|
|
1818
2005
|
return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
|
|
1819
|
-
}),
|
|
1820
|
-
let e =
|
|
1821
|
-
return e === void 0 ? "loading" : u.previewStates.get(
|
|
1822
|
-
}),
|
|
1823
|
-
|
|
1824
|
-
|
|
2006
|
+
}), z = r(() => {
|
|
2007
|
+
let e = F.value;
|
|
2008
|
+
return e === void 0 ? "loading" : u.previewStates.get(W(e, R.value)) ?? "loading";
|
|
2009
|
+
}), B = r(() => I.value ? U(I.value, R.value) : null), H = r(() => B.value ? ee(B.value, u.mediaSource ?? "preview") : null), G = r(() => z.value === "ready" && !!(H.value && L(H.value.type, H.value.src))), te = r(() => [
|
|
2010
|
+
F.value,
|
|
2011
|
+
R.value,
|
|
1825
2012
|
u.items.length,
|
|
1826
2013
|
u.loadMoreLocked,
|
|
1827
2014
|
u.reelAutoAdvance.enabled,
|
|
1828
2015
|
u.reelAutoAdvance.includePostItems,
|
|
1829
2016
|
u.reelAutoAdvance.intervalMs
|
|
1830
2017
|
].join(":")), K = r(() => {
|
|
1831
|
-
let e =
|
|
2018
|
+
let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value < V(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
|
|
1832
2019
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1833
|
-
}),
|
|
1834
|
-
function
|
|
2020
|
+
}), q = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && z.value !== "loading" && !G.value), ne = r(() => !u.infiniteScroll || u.items.length <= 1), J = 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.");
|
|
2021
|
+
function re(e) {
|
|
1835
2022
|
return { gridRow: `${e + 1}` };
|
|
1836
2023
|
}
|
|
1837
|
-
function
|
|
2024
|
+
function Y(e) {
|
|
1838
2025
|
let t = k || e.clientHeight;
|
|
1839
2026
|
return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1840
2027
|
}
|
|
1841
|
-
function
|
|
2028
|
+
function ae(e) {
|
|
1842
2029
|
let t = e.currentTarget;
|
|
1843
2030
|
if (!t) return;
|
|
1844
2031
|
let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
|
|
1845
|
-
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value =
|
|
2032
|
+
C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = Y(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && se(t) && d("loadMore");
|
|
1846
2033
|
}
|
|
1847
|
-
function
|
|
2034
|
+
function X() {
|
|
1848
2035
|
let e = f.value;
|
|
1849
|
-
e && (C.value = !1,
|
|
2036
|
+
e && (C.value = !1, ce(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
|
|
1850
2037
|
e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
|
|
1851
|
-
}),
|
|
2038
|
+
}), oe());
|
|
1852
2039
|
}
|
|
1853
|
-
function
|
|
2040
|
+
function oe() {
|
|
1854
2041
|
M !== null && clearTimeout(M), M = setTimeout(() => {
|
|
1855
2042
|
M = null;
|
|
1856
2043
|
let e = f.value;
|
|
1857
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
2044
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), ce(!1);
|
|
1858
2045
|
}, 120);
|
|
1859
2046
|
}
|
|
1860
|
-
function
|
|
1861
|
-
|
|
2047
|
+
function Z() {
|
|
2048
|
+
ce(!0);
|
|
1862
2049
|
let e = f.value;
|
|
1863
|
-
e && (k = e.clientHeight, e.scrollTop = x.value * k),
|
|
2050
|
+
e && (k = e.clientHeight, e.scrollTop = x.value * k), oe();
|
|
1864
2051
|
}
|
|
1865
|
-
function
|
|
2052
|
+
function ce(e) {
|
|
1866
2053
|
D.value = e, f.value?.toggleAttribute("data-resizing", e);
|
|
1867
2054
|
}
|
|
1868
|
-
function
|
|
2055
|
+
function le() {
|
|
1869
2056
|
let e = f.value;
|
|
1870
|
-
Date.now() >= l && !u.loadMoreLocked && e &&
|
|
2057
|
+
Date.now() >= l && !u.loadMoreLocked && e && se(e) && d("loadMore");
|
|
1871
2058
|
}
|
|
1872
2059
|
O(() => u.items.length, (e, t) => {
|
|
1873
|
-
e > 0 && e < t && (l = Date.now() +
|
|
2060
|
+
e > 0 && e < t && (l = Date.now() + sn);
|
|
1874
2061
|
});
|
|
1875
|
-
function
|
|
1876
|
-
let t =
|
|
2062
|
+
function ue(e) {
|
|
2063
|
+
let t = I.value;
|
|
1877
2064
|
if (!t) return !1;
|
|
1878
|
-
let n =
|
|
2065
|
+
let n = V(t).length;
|
|
1879
2066
|
if (n <= 1) return !1;
|
|
1880
|
-
let r = (
|
|
2067
|
+
let r = (R.value + e + n) % n;
|
|
1881
2068
|
return d("mediaChange", t.postId, r), !0;
|
|
1882
2069
|
}
|
|
1883
|
-
function
|
|
2070
|
+
function de(e) {
|
|
1884
2071
|
let t = x.value + e;
|
|
1885
|
-
return !f.value || t < 0 || t >= u.items.length ? !1 : (
|
|
2072
|
+
return !f.value || t < 0 || t >= u.items.length ? !1 : (me(t), !0);
|
|
1886
2073
|
}
|
|
1887
|
-
function
|
|
2074
|
+
function fe(e, t) {
|
|
1888
2075
|
let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
|
|
1889
|
-
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value &&
|
|
2076
|
+
return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && me(n), !0);
|
|
1890
2077
|
}
|
|
1891
|
-
function
|
|
2078
|
+
function Q() {
|
|
1892
2079
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1893
2080
|
}
|
|
1894
|
-
function
|
|
2081
|
+
function pe(e) {
|
|
1895
2082
|
let t = f.value;
|
|
1896
2083
|
if (!t) return Promise.resolve();
|
|
1897
2084
|
let n = e * (k || t.clientHeight);
|
|
1898
|
-
return x.value = e,
|
|
2085
|
+
return x.value = e, $t(t, n, Q());
|
|
1899
2086
|
}
|
|
1900
|
-
function
|
|
1901
|
-
|
|
2087
|
+
function me(e) {
|
|
2088
|
+
pe(e);
|
|
1902
2089
|
}
|
|
1903
|
-
async function
|
|
2090
|
+
async function he(e) {
|
|
1904
2091
|
let t = u.items.findIndex((t) => t.postId === e);
|
|
1905
|
-
return t < 0 || t === x.value ? !1 : (await
|
|
2092
|
+
return t < 0 || t === x.value ? !1 : (await pe(t), !0);
|
|
1906
2093
|
}
|
|
1907
|
-
async function
|
|
1908
|
-
return
|
|
2094
|
+
async function ge(e) {
|
|
2095
|
+
return ue(e) ? (Q() || await new Promise((e) => setTimeout(e, on)), !0) : !1;
|
|
1909
2096
|
}
|
|
1910
|
-
function
|
|
2097
|
+
function _e() {
|
|
1911
2098
|
if (!u.reelAutoAdvance.enabled) return;
|
|
1912
|
-
let e =
|
|
2099
|
+
let e = I.value;
|
|
1913
2100
|
if (!e) return;
|
|
1914
|
-
if (u.reelAutoAdvance.includePostItems &&
|
|
1915
|
-
d("mediaChange", e.postId,
|
|
2101
|
+
if (u.reelAutoAdvance.includePostItems && R.value < V(e).length - 1) {
|
|
2102
|
+
d("mediaChange", e.postId, R.value + 1);
|
|
1916
2103
|
return;
|
|
1917
2104
|
}
|
|
1918
2105
|
let t = x.value + 1, n = u.items[t];
|
|
@@ -1920,31 +2107,31 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
1920
2107
|
u.hasNext && !u.loadMoreLocked && d("loadMore");
|
|
1921
2108
|
return;
|
|
1922
2109
|
}
|
|
1923
|
-
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0),
|
|
2110
|
+
u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), me(t);
|
|
1924
2111
|
}
|
|
1925
|
-
function
|
|
1926
|
-
!u.reelAutoAdvance.enabled || e !==
|
|
2112
|
+
function ve(e, t) {
|
|
2113
|
+
!u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !G.value || _e();
|
|
1927
2114
|
}
|
|
1928
2115
|
return O(f, (e) => {
|
|
1929
|
-
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(
|
|
2116
|
+
A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(X), A.observe(e)));
|
|
1930
2117
|
}), O(() => u.items.length, async (e) => {
|
|
1931
2118
|
let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
|
|
1932
|
-
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(),
|
|
1933
|
-
}), O(
|
|
2119
|
+
x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), X();
|
|
2120
|
+
}), O(F, (e) => {
|
|
1934
2121
|
e !== void 0 && d("activeChange", e);
|
|
1935
2122
|
}, { immediate: !0 }), y(() => {
|
|
1936
|
-
window.addEventListener("resize",
|
|
2123
|
+
window.addEventListener("resize", Z), window.addEventListener("orientationchange", Z), g >= 0 && m(X);
|
|
1937
2124
|
}), v(() => {
|
|
1938
|
-
window.removeEventListener("resize",
|
|
2125
|
+
window.removeEventListener("resize", Z), window.removeEventListener("orientationchange", Z), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
|
|
1939
2126
|
}), n({
|
|
1940
2127
|
activeIndex: x,
|
|
1941
|
-
activePostId:
|
|
1942
|
-
changeActiveMedia:
|
|
1943
|
-
loadIfNearBottom:
|
|
1944
|
-
moveActivePost:
|
|
1945
|
-
navigateToItem:
|
|
1946
|
-
transitionActiveMedia:
|
|
1947
|
-
transitionActivePost:
|
|
2128
|
+
activePostId: F,
|
|
2129
|
+
changeActiveMedia: ue,
|
|
2130
|
+
loadIfNearBottom: le,
|
|
2131
|
+
moveActivePost: de,
|
|
2132
|
+
navigateToItem: fe,
|
|
2133
|
+
transitionActiveMedia: ge,
|
|
2134
|
+
transitionActivePost: he
|
|
1948
2135
|
}), (n, r) => (b(), s("main", {
|
|
1949
2136
|
class: h(["reel-shell", {
|
|
1950
2137
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1952,13 +2139,13 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
1952
2139
|
}]),
|
|
1953
2140
|
"data-layout-mode": "reel"
|
|
1954
2141
|
}, [
|
|
1955
|
-
t.cardHeader &&
|
|
2142
|
+
t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(Ue, {
|
|
1956
2143
|
key: 0,
|
|
1957
2144
|
index: x.value,
|
|
1958
|
-
item:
|
|
2145
|
+
item: I.value,
|
|
1959
2146
|
layout: "reel",
|
|
1960
2147
|
"loaded-count": t.items.length,
|
|
1961
|
-
"media-index":
|
|
2148
|
+
"media-index": R.value,
|
|
1962
2149
|
"media-source": t.mediaSource,
|
|
1963
2150
|
placement: "header",
|
|
1964
2151
|
region: t.cardHeader,
|
|
@@ -1974,19 +2161,19 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
1974
2161
|
"style",
|
|
1975
2162
|
"total"
|
|
1976
2163
|
])) : o("", !0),
|
|
1977
|
-
c("div",
|
|
2164
|
+
c("div", nn, [c("div", {
|
|
1978
2165
|
ref_key: "galleryElement",
|
|
1979
2166
|
ref: f,
|
|
1980
2167
|
class: "gallery-shell reel-feed",
|
|
1981
|
-
"data-active-post-id":
|
|
1982
|
-
"data-active-media-index":
|
|
1983
|
-
onScrollPassive:
|
|
2168
|
+
"data-active-post-id": F.value,
|
|
2169
|
+
"data-active-media-index": R.value,
|
|
2170
|
+
onScrollPassive: ae
|
|
1984
2171
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1985
2172
|
key: 1,
|
|
1986
2173
|
class: "reel-track",
|
|
1987
|
-
style: _(
|
|
2174
|
+
style: _(N.value),
|
|
1988
2175
|
"aria-label": "Media gallery"
|
|
1989
|
-
}, [(b(!0), s(e, null, S(
|
|
2176
|
+
}, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(Wt, {
|
|
1990
2177
|
key: n.postId,
|
|
1991
2178
|
active: i === x.value && !C.value,
|
|
1992
2179
|
"advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
|
|
@@ -1995,19 +2182,19 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
1995
2182
|
"fetch-priority": e,
|
|
1996
2183
|
index: i,
|
|
1997
2184
|
item: n,
|
|
1998
|
-
"item-style":
|
|
2185
|
+
"item-style": re(i),
|
|
1999
2186
|
"media-card": t.mediaCard,
|
|
2000
2187
|
layout: "reel",
|
|
2001
2188
|
"loaded-count": t.items.length,
|
|
2002
2189
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
2003
2190
|
"media-source": t.mediaSource,
|
|
2004
|
-
"preview-state": t.previewStates.get(E(
|
|
2191
|
+
"preview-state": t.previewStates.get(E(W)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
2005
2192
|
"reel-controls-target": p.value,
|
|
2006
2193
|
"reel-audio-state": t.reelAudioState,
|
|
2007
2194
|
"stationary-reel-controls": "",
|
|
2008
2195
|
total: t.total,
|
|
2009
2196
|
onMediaChange: (e) => d("mediaChange", n.postId, e),
|
|
2010
|
-
onEnded: (e) =>
|
|
2197
|
+
onEnded: (e) => ve(n.postId, e),
|
|
2011
2198
|
onReady: (e) => d("ready", n.postId, e),
|
|
2012
2199
|
onReelAudioChange: r[1] ||= (e) => d("reelAudioChange", e),
|
|
2013
2200
|
onError: (e) => d("error", n.postId, e)
|
|
@@ -2035,12 +2222,12 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2035
2222
|
class: "reel-forward-status",
|
|
2036
2223
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
2037
2224
|
"data-status": t.reelForward.status
|
|
2038
|
-
}, [c("p", null, T(
|
|
2225
|
+
}, [c("p", null, T(J.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
2039
2226
|
key: 0,
|
|
2040
2227
|
class: "reel-forward-retry",
|
|
2041
2228
|
type: "button",
|
|
2042
2229
|
onClick: r[0] ||= (e) => d("retryForward")
|
|
2043
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
2230
|
+
}, " Retry ")) : o("", !0)], 8, an)), t.reelForward.status === "idle" ? (b(), a(ie, {
|
|
2044
2231
|
key: 2,
|
|
2045
2232
|
actions: t.feedFooterActions,
|
|
2046
2233
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2049,7 +2236,7 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2049
2236
|
"has-next": t.hasNext,
|
|
2050
2237
|
"is-loading": t.isLoadingMore,
|
|
2051
2238
|
"load-more-locked": t.loadMoreLocked,
|
|
2052
|
-
"show-load-more":
|
|
2239
|
+
"show-load-more": ne.value,
|
|
2053
2240
|
state: t.state,
|
|
2054
2241
|
onLoadMore: r[2] ||= (e) => d("loadMore"),
|
|
2055
2242
|
onRetryEnd: r[3] ||= (e) => d("retryEnd")
|
|
@@ -2063,19 +2250,19 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2063
2250
|
"load-more-locked",
|
|
2064
2251
|
"show-load-more",
|
|
2065
2252
|
"state"
|
|
2066
|
-
])) : o("", !0)], 40,
|
|
2253
|
+
])) : o("", !0)], 40, rn), c("div", {
|
|
2067
2254
|
ref_key: "reelControlsElement",
|
|
2068
2255
|
ref: p,
|
|
2069
2256
|
class: "reel-media-controls-host",
|
|
2070
2257
|
"data-test": "reel-media-controls-host"
|
|
2071
2258
|
}, null, 512)]),
|
|
2072
|
-
t.cardFooter &&
|
|
2259
|
+
t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(Ue, {
|
|
2073
2260
|
key: 1,
|
|
2074
2261
|
index: x.value,
|
|
2075
|
-
item:
|
|
2262
|
+
item: I.value,
|
|
2076
2263
|
layout: "reel",
|
|
2077
2264
|
"loaded-count": t.items.length,
|
|
2078
|
-
"media-index":
|
|
2265
|
+
"media-index": R.value,
|
|
2079
2266
|
"media-source": t.mediaSource,
|
|
2080
2267
|
placement: "footer",
|
|
2081
2268
|
region: t.cardFooter,
|
|
@@ -2091,24 +2278,24 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2091
2278
|
"style",
|
|
2092
2279
|
"total"
|
|
2093
2280
|
])) : o("", !0),
|
|
2094
|
-
|
|
2095
|
-
key:
|
|
2281
|
+
q.value ? (b(), a(tn, {
|
|
2282
|
+
key: te.value,
|
|
2096
2283
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
2097
2284
|
label: K.value,
|
|
2098
|
-
onComplete:
|
|
2285
|
+
onComplete: _e
|
|
2099
2286
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
2100
2287
|
], 2));
|
|
2101
2288
|
}
|
|
2102
|
-
}),
|
|
2289
|
+
}), ln = ["data-info-sheet-open", "data-info-sheet-mode"], un = ["aria-hidden", "inert"], dn = {
|
|
2103
2290
|
key: 0,
|
|
2104
2291
|
class: "reel-info-sheet-layer",
|
|
2105
2292
|
"data-test": "reel-info-sheet"
|
|
2106
|
-
},
|
|
2293
|
+
}, fn = [
|
|
2107
2294
|
"role",
|
|
2108
2295
|
"aria-modal",
|
|
2109
2296
|
"tabindex",
|
|
2110
2297
|
"data-active-post-id"
|
|
2111
|
-
],
|
|
2298
|
+
], pn = /* @__PURE__ */ d({
|
|
2112
2299
|
__name: "ReelLayout",
|
|
2113
2300
|
props: {
|
|
2114
2301
|
forwardIndex: { default: null },
|
|
@@ -2168,9 +2355,9 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2168
2355
|
item: e,
|
|
2169
2356
|
layout: "reel",
|
|
2170
2357
|
loadedCount: l.items.length,
|
|
2171
|
-
mediaCount:
|
|
2358
|
+
mediaCount: V(e).length,
|
|
2172
2359
|
mediaIndex: D.value,
|
|
2173
|
-
mediaItem:
|
|
2360
|
+
mediaItem: U(e, D.value),
|
|
2174
2361
|
mediaSource: l.mediaSource ?? "preview",
|
|
2175
2362
|
origin: l.origin,
|
|
2176
2363
|
total: l.total
|
|
@@ -2182,28 +2369,28 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2182
2369
|
function N(e) {
|
|
2183
2370
|
return p.value?.changeActiveMedia(e) ?? !1;
|
|
2184
2371
|
}
|
|
2185
|
-
function
|
|
2372
|
+
function P() {
|
|
2186
2373
|
p.value?.loadIfNearBottom();
|
|
2187
2374
|
}
|
|
2188
|
-
function
|
|
2375
|
+
function F(e) {
|
|
2189
2376
|
return p.value?.moveActivePost(e) ?? !1;
|
|
2190
2377
|
}
|
|
2191
|
-
function
|
|
2378
|
+
function I(e, t) {
|
|
2192
2379
|
return p.value?.navigateToItem(e, t) ?? !1;
|
|
2193
2380
|
}
|
|
2194
|
-
function
|
|
2381
|
+
function L(e) {
|
|
2195
2382
|
return p.value?.transitionActiveMedia(e) ?? Promise.resolve(!1);
|
|
2196
2383
|
}
|
|
2197
|
-
function
|
|
2384
|
+
function R(e) {
|
|
2198
2385
|
return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
|
|
2199
2386
|
}
|
|
2200
|
-
function
|
|
2387
|
+
function z(e, t) {
|
|
2201
2388
|
d("error", e, t);
|
|
2202
2389
|
}
|
|
2203
|
-
function
|
|
2390
|
+
function B(e, t) {
|
|
2204
2391
|
d("mediaChange", e, t);
|
|
2205
2392
|
}
|
|
2206
|
-
function
|
|
2393
|
+
function ee(e, t) {
|
|
2207
2394
|
d("ready", e, t);
|
|
2208
2395
|
}
|
|
2209
2396
|
return O(() => ({
|
|
@@ -2222,11 +2409,11 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2222
2409
|
y = null;
|
|
2223
2410
|
}), t({
|
|
2224
2411
|
changeActiveMedia: N,
|
|
2225
|
-
loadIfNearBottom:
|
|
2226
|
-
moveActivePost:
|
|
2227
|
-
navigateToItem:
|
|
2228
|
-
transitionActiveMedia:
|
|
2229
|
-
transitionActivePost:
|
|
2412
|
+
loadIfNearBottom: P,
|
|
2413
|
+
moveActivePost: F,
|
|
2414
|
+
navigateToItem: I,
|
|
2415
|
+
transitionActiveMedia: L,
|
|
2416
|
+
transitionActivePost: R
|
|
2230
2417
|
}), (t, r) => (b(), s("section", {
|
|
2231
2418
|
class: h(["reel-layout", `reel-layout--${e.infoSheetOverlay ? "overlay" : "layout"}`]),
|
|
2232
2419
|
"data-info-sheet-open": A.value || void 0,
|
|
@@ -2235,7 +2422,7 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2235
2422
|
class: "reel-layout-main",
|
|
2236
2423
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
2237
2424
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
2238
|
-
}, [u(
|
|
2425
|
+
}, [u(cn, {
|
|
2239
2426
|
ref_key: "reelFeed",
|
|
2240
2427
|
ref: p,
|
|
2241
2428
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -2260,10 +2447,10 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2260
2447
|
state: e.state,
|
|
2261
2448
|
total: e.total,
|
|
2262
2449
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
2263
|
-
onError:
|
|
2450
|
+
onError: z,
|
|
2264
2451
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
2265
|
-
onMediaChange:
|
|
2266
|
-
onReady:
|
|
2452
|
+
onMediaChange: B,
|
|
2453
|
+
onReady: ee,
|
|
2267
2454
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
2268
2455
|
onRetryForward: r[3] ||= (e) => d("retryForward"),
|
|
2269
2456
|
onReelAudioChange: r[4] ||= (e) => d("reelAudioChange", e)
|
|
@@ -2289,8 +2476,8 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2289
2476
|
"reel-forward",
|
|
2290
2477
|
"state",
|
|
2291
2478
|
"total"
|
|
2292
|
-
])], 8,
|
|
2293
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
2479
|
+
])], 8, un), u(n, { name: "vibe-info-sheet" }, {
|
|
2480
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", dn, [c("aside", {
|
|
2294
2481
|
ref_key: "sheetElement",
|
|
2295
2482
|
ref: _,
|
|
2296
2483
|
class: "reel-info-sheet",
|
|
@@ -2299,17 +2486,17 @@ var Ht = ["aria-label"], Ut = /* @__PURE__ */ d({
|
|
|
2299
2486
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
2300
2487
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
2301
2488
|
"data-active-post-id": T.value?.postId
|
|
2302
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
2489
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, fn)])) : o("", !0)]),
|
|
2303
2490
|
_: 1
|
|
2304
|
-
})], 10,
|
|
2491
|
+
})], 10, ln));
|
|
2305
2492
|
}
|
|
2306
2493
|
});
|
|
2307
2494
|
//#endregion
|
|
2308
2495
|
//#region src/core/mediaLifecycle.ts
|
|
2309
|
-
function
|
|
2496
|
+
function mn(e, t, n, r, i) {
|
|
2310
2497
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
2311
2498
|
if (!o) return null;
|
|
2312
|
-
let s =
|
|
2499
|
+
let s = H(o, n), c = U(o, s);
|
|
2313
2500
|
return {
|
|
2314
2501
|
item: o,
|
|
2315
2502
|
layout: r,
|
|
@@ -2322,7 +2509,7 @@ function tn(e, t, n, r, i) {
|
|
|
2322
2509
|
postIndex: a
|
|
2323
2510
|
};
|
|
2324
2511
|
}
|
|
2325
|
-
function
|
|
2512
|
+
function hn(e, t) {
|
|
2326
2513
|
O(() => {
|
|
2327
2514
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
2328
2515
|
return {
|
|
@@ -2332,20 +2519,20 @@ function nn(e, t) {
|
|
|
2332
2519
|
};
|
|
2333
2520
|
}, (n, r) => {
|
|
2334
2521
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
2335
|
-
let i =
|
|
2522
|
+
let i = mn(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
2336
2523
|
i && t(i);
|
|
2337
2524
|
}, { flush: "sync" });
|
|
2338
2525
|
}
|
|
2339
2526
|
//#endregion
|
|
2340
2527
|
//#region src/components/useMediaLifecycle.ts
|
|
2341
|
-
function
|
|
2528
|
+
function gn(e, t) {
|
|
2342
2529
|
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);
|
|
2343
2530
|
function c(e, t, n, r) {
|
|
2344
|
-
let i =
|
|
2531
|
+
let i = W(t, n);
|
|
2345
2532
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
2346
2533
|
}
|
|
2347
2534
|
function l(t, n, r, i) {
|
|
2348
|
-
return
|
|
2535
|
+
return mn(e, t, n, r, i);
|
|
2349
2536
|
}
|
|
2350
2537
|
function u(e, n, r, i) {
|
|
2351
2538
|
let a = l(e, n, r, i);
|
|
@@ -2367,13 +2554,13 @@ function rn(e, t) {
|
|
|
2367
2554
|
let r = l(e, n, "masonry", null);
|
|
2368
2555
|
r && t.visible(r);
|
|
2369
2556
|
}
|
|
2370
|
-
return
|
|
2557
|
+
return hn(e, t.reelChange), O(() => {
|
|
2371
2558
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
2372
2559
|
return {
|
|
2373
2560
|
mediaIndex: n,
|
|
2374
2561
|
origin: e.reelOrigin ?? "reel",
|
|
2375
2562
|
postId: t,
|
|
2376
|
-
ready: t !== null && s.value.get(
|
|
2563
|
+
ready: t !== null && s.value.get(W(t, n)) === "ready"
|
|
2377
2564
|
};
|
|
2378
2565
|
}, (e, n) => {
|
|
2379
2566
|
if (e.postId === null || !e.ready || n?.ready && n.postId === e.postId && n.mediaIndex === e.mediaIndex && n.origin === e.origin) return;
|
|
@@ -2392,16 +2579,16 @@ function rn(e, t) {
|
|
|
2392
2579
|
}
|
|
2393
2580
|
//#endregion
|
|
2394
2581
|
//#region src/core/reelEscapeStack.ts
|
|
2395
|
-
var
|
|
2396
|
-
function
|
|
2397
|
-
return
|
|
2398
|
-
let t =
|
|
2399
|
-
t >= 0 &&
|
|
2582
|
+
var _n = [];
|
|
2583
|
+
function vn(e) {
|
|
2584
|
+
return _n.push(e), () => {
|
|
2585
|
+
let t = _n.indexOf(e);
|
|
2586
|
+
t >= 0 && _n.splice(t, 1);
|
|
2400
2587
|
};
|
|
2401
2588
|
}
|
|
2402
|
-
function
|
|
2589
|
+
function yn(e) {
|
|
2403
2590
|
if (!e.isActive()) return !1;
|
|
2404
|
-
let t =
|
|
2591
|
+
let t = _n.filter((e) => e.isActive()), n = e.element();
|
|
2405
2592
|
return n !== null && t.some((t) => {
|
|
2406
2593
|
if (t === e) return !1;
|
|
2407
2594
|
let r = t.element();
|
|
@@ -2417,14 +2604,14 @@ function sn(e) {
|
|
|
2417
2604
|
}
|
|
2418
2605
|
//#endregion
|
|
2419
2606
|
//#region src/components/useReelKeyboard.ts
|
|
2420
|
-
function
|
|
2607
|
+
function bn(e) {
|
|
2421
2608
|
let t = {
|
|
2422
2609
|
element: e.element,
|
|
2423
2610
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
2424
2611
|
}, n = null;
|
|
2425
2612
|
function r(n) {
|
|
2426
2613
|
let r = t.isActive();
|
|
2427
|
-
if (n.key === "Escape" && r && !
|
|
2614
|
+
if (n.key === "Escape" && r && !yn(t)) return;
|
|
2428
2615
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
2429
2616
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
2430
2617
|
return;
|
|
@@ -2444,14 +2631,14 @@ function cn(e) {
|
|
|
2444
2631
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2445
2632
|
}
|
|
2446
2633
|
y(() => {
|
|
2447
|
-
n =
|
|
2634
|
+
n = vn(t), window.addEventListener("keydown", r);
|
|
2448
2635
|
}), v(() => {
|
|
2449
2636
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2450
2637
|
});
|
|
2451
2638
|
}
|
|
2452
2639
|
//#endregion
|
|
2453
2640
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2454
|
-
var
|
|
2641
|
+
var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
|
|
2455
2642
|
__name: "VibeSurface",
|
|
2456
2643
|
props: {
|
|
2457
2644
|
canRetryEnd: { type: Boolean },
|
|
@@ -2479,110 +2666,110 @@ var ln = 35, un = 420, dn = /* @__PURE__ */ d({
|
|
|
2479
2666
|
"retryForward"
|
|
2480
2667
|
],
|
|
2481
2668
|
setup(t, { expose: i, emit: c }) {
|
|
2482
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() =>
|
|
2669
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => te(l.state, T.value)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: P, originalStates: F, previewStates: I, reelStates: L } = gn(l.state, {
|
|
2483
2670
|
ready: (e) => d("mediaReady", e),
|
|
2484
2671
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2485
2672
|
visible: (e) => d("mediaVisible", e)
|
|
2486
|
-
}),
|
|
2487
|
-
function
|
|
2673
|
+
}), R = new Set(l.state.items.map((e) => e.postId)), z = null, B = null, ee = !1;
|
|
2674
|
+
function U() {
|
|
2488
2675
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2489
2676
|
}
|
|
2490
|
-
function
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2677
|
+
function W() {
|
|
2678
|
+
z !== null && cancelAnimationFrame(z), z = requestAnimationFrame(() => {
|
|
2679
|
+
z = requestAnimationFrame(() => {
|
|
2680
|
+
z = null, y.value = /* @__PURE__ */ new Set();
|
|
2494
2681
|
});
|
|
2495
2682
|
});
|
|
2496
2683
|
}
|
|
2497
2684
|
function G(e, t) {
|
|
2498
2685
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2499
2686
|
if (!n) return;
|
|
2500
|
-
let r =
|
|
2687
|
+
let r = H(n, t);
|
|
2501
2688
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2502
2689
|
}
|
|
2503
2690
|
async function K() {
|
|
2504
2691
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2505
2692
|
}
|
|
2506
|
-
function
|
|
2693
|
+
function q(e) {
|
|
2507
2694
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2508
2695
|
}
|
|
2509
|
-
function
|
|
2696
|
+
function ne(e) {
|
|
2510
2697
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2511
2698
|
}
|
|
2512
|
-
function
|
|
2699
|
+
function J(e) {
|
|
2513
2700
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
2514
2701
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
2515
2702
|
if (!t) return "not-found";
|
|
2516
|
-
let n =
|
|
2703
|
+
let n = V(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
2517
2704
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
2518
2705
|
}
|
|
2519
|
-
function
|
|
2706
|
+
function re() {
|
|
2520
2707
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2521
2708
|
}
|
|
2522
|
-
function
|
|
2523
|
-
|
|
2709
|
+
function Y(e, t) {
|
|
2710
|
+
B = e, ee = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
|
|
2524
2711
|
}
|
|
2525
|
-
function
|
|
2712
|
+
function ie(e) {
|
|
2526
2713
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2527
2714
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2528
2715
|
}
|
|
2529
|
-
function
|
|
2530
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
2531
|
-
let n = [...new Set(e)], r = n.filter(
|
|
2716
|
+
function ae(e, t) {
|
|
2717
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || U()) return 0;
|
|
2718
|
+
let n = [...new Set(e)], r = n.filter(ie);
|
|
2532
2719
|
if (r.length === 0) return 0;
|
|
2533
|
-
let i = new Map(C.value), a = t?.staggerMs ??
|
|
2720
|
+
let i = new Map(C.value), a = t?.staggerMs ?? xn;
|
|
2534
2721
|
return r.forEach((e, t) => {
|
|
2535
2722
|
i.set(e, t * a);
|
|
2536
|
-
}), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i,
|
|
2723
|
+
}), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, Sn + (r.length - 1) * a;
|
|
2537
2724
|
}
|
|
2538
|
-
function
|
|
2539
|
-
let n =
|
|
2725
|
+
function X(e, t) {
|
|
2726
|
+
let n = ie(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2540
2727
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2541
2728
|
r.classList.remove("media-card-focus-silent");
|
|
2542
2729
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2543
2730
|
}
|
|
2544
|
-
function
|
|
2545
|
-
l.state.reelOrigin === "masonry" && (
|
|
2731
|
+
function se() {
|
|
2732
|
+
l.state.reelOrigin === "masonry" && (B ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
|
|
2546
2733
|
}
|
|
2547
|
-
function
|
|
2548
|
-
let e =
|
|
2549
|
-
_.value = !1,
|
|
2550
|
-
e !== null &&
|
|
2734
|
+
function Z() {
|
|
2735
|
+
let e = B, t = ee;
|
|
2736
|
+
_.value = !1, B = null, ee = !1, m(() => {
|
|
2737
|
+
e !== null && X(e, t);
|
|
2551
2738
|
});
|
|
2552
2739
|
}
|
|
2553
|
-
return
|
|
2554
|
-
closeMasonryReel:
|
|
2740
|
+
return bn({
|
|
2741
|
+
closeMasonryReel: se,
|
|
2555
2742
|
element: () => g.value,
|
|
2556
2743
|
isReelLeaving: () => _.value,
|
|
2557
2744
|
reelRenderer: () => p.value,
|
|
2558
2745
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2559
2746
|
state: l.state
|
|
2560
2747
|
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2561
|
-
let t = e.filter((e) => !
|
|
2562
|
-
if (
|
|
2748
|
+
let t = e.filter((e) => !R.has(e)), n = new Set(e);
|
|
2749
|
+
if (R = new Set(e), S.value = new Set([...S.value].filter((e) => n.has(e))), C.value = new Map([...C.value].filter(([e]) => n.has(e))), t.length === 0 || U()) return;
|
|
2563
2750
|
let r = /* @__PURE__ */ new Map();
|
|
2564
2751
|
e.forEach((e) => {
|
|
2565
2752
|
let t = x.value.get(e);
|
|
2566
2753
|
t !== void 0 && r.set(e, t);
|
|
2567
2754
|
}), t.forEach((e, t) => {
|
|
2568
|
-
r.set(e, t *
|
|
2569
|
-
}), x.value = r, y.value = new Set([...y.value, ...t]),
|
|
2755
|
+
r.set(e, t * xn);
|
|
2756
|
+
}), x.value = r, y.value = new Set([...y.value, ...t]), W();
|
|
2570
2757
|
}, { flush: "sync" }), v(() => {
|
|
2571
|
-
|
|
2758
|
+
z !== null && cancelAnimationFrame(z);
|
|
2572
2759
|
}), i({
|
|
2573
|
-
changeActiveReelMedia:
|
|
2574
|
-
getAutoScrollElement:
|
|
2760
|
+
changeActiveReelMedia: q,
|
|
2761
|
+
getAutoScrollElement: re,
|
|
2575
2762
|
loadIfNearBottom: K,
|
|
2576
|
-
moveActiveReelPost:
|
|
2577
|
-
navigateToReelItem:
|
|
2578
|
-
startItemRemoval:
|
|
2763
|
+
moveActiveReelPost: ne,
|
|
2764
|
+
navigateToReelItem: J,
|
|
2765
|
+
startItemRemoval: ae,
|
|
2579
2766
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2580
2767
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2581
2768
|
}), (r, i) => (b(), s("div", {
|
|
2582
2769
|
ref_key: "surfaceElement",
|
|
2583
2770
|
ref: g,
|
|
2584
2771
|
class: "vibe-surface"
|
|
2585
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2772
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(pn, {
|
|
2586
2773
|
key: 0,
|
|
2587
2774
|
ref_key: "reelRenderer",
|
|
2588
2775
|
ref: p,
|
|
@@ -2607,7 +2794,7 @@ var ln = 35, un = 420, dn = /* @__PURE__ */ d({
|
|
|
2607
2794
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2608
2795
|
"next-page-error": !!t.state.nextPageError,
|
|
2609
2796
|
origin: "reel",
|
|
2610
|
-
"preview-states": E(
|
|
2797
|
+
"preview-states": E(L),
|
|
2611
2798
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2612
2799
|
"reel-audio-state": t.reelAudioState,
|
|
2613
2800
|
"reel-forward": t.state.reelForward,
|
|
@@ -2618,11 +2805,11 @@ var ln = 35, un = 420, dn = /* @__PURE__ */ d({
|
|
|
2618
2805
|
onError: E(N),
|
|
2619
2806
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2620
2807
|
onMediaChange: G,
|
|
2621
|
-
onReady: E(
|
|
2808
|
+
onReady: E(P),
|
|
2622
2809
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2623
2810
|
onRetryForward: i[4] ||= (e) => d("retryForward"),
|
|
2624
2811
|
onReelAudioChange: i[5] ||= (e) => d("reelAudioChange", e)
|
|
2625
|
-
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(
|
|
2812
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(oe, {
|
|
2626
2813
|
key: 1,
|
|
2627
2814
|
actions: t.feedFooterActions,
|
|
2628
2815
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2635,7 +2822,7 @@ var ln = 35, un = 420, dn = /* @__PURE__ */ d({
|
|
|
2635
2822
|
"can-retry-end",
|
|
2636
2823
|
"feed-footer",
|
|
2637
2824
|
"state"
|
|
2638
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2825
|
+
])) : (b(), s(e, { key: 2 }, [u(Zt, {
|
|
2639
2826
|
ref_key: "masonryRenderer",
|
|
2640
2827
|
ref: f,
|
|
2641
2828
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2656,11 +2843,11 @@ var ln = 35, un = 420, dn = /* @__PURE__ */ d({
|
|
|
2656
2843
|
"load-more-locked": t.state.loadMoreLocked,
|
|
2657
2844
|
"media-indices": t.state.mediaIndices,
|
|
2658
2845
|
"next-page-error": !!t.state.nextPageError,
|
|
2659
|
-
"preview-states": E(
|
|
2846
|
+
"preview-states": E(I),
|
|
2660
2847
|
suspended: t.state.reelOrigin === "masonry" || _.value,
|
|
2661
2848
|
state: D.value,
|
|
2662
2849
|
total: t.state.total,
|
|
2663
|
-
onActivate:
|
|
2850
|
+
onActivate: Y,
|
|
2664
2851
|
onError: E(j),
|
|
2665
2852
|
onLoadMore: i[8] ||= (e) => d("loadMore"),
|
|
2666
2853
|
onMediaChange: G,
|
|
@@ -2695,7 +2882,7 @@ var ln = 35, un = 420, dn = /* @__PURE__ */ d({
|
|
|
2695
2882
|
"onVisible"
|
|
2696
2883
|
]), u(n, {
|
|
2697
2884
|
name: "vibe-reel-viewer",
|
|
2698
|
-
onAfterLeave:
|
|
2885
|
+
onAfterLeave: Z
|
|
2699
2886
|
}, {
|
|
2700
2887
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2701
2888
|
key: 0,
|
|
@@ -2706,7 +2893,7 @@ var ln = 35, un = 420, dn = /* @__PURE__ */ d({
|
|
|
2706
2893
|
"aria-label": "Media viewer",
|
|
2707
2894
|
"aria-modal": "true",
|
|
2708
2895
|
tabindex: "-1"
|
|
2709
|
-
}, [u(
|
|
2896
|
+
}, [u(pn, {
|
|
2710
2897
|
ref_key: "reelRenderer",
|
|
2711
2898
|
ref: p,
|
|
2712
2899
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2730,7 +2917,7 @@ var ln = 35, un = 420, dn = /* @__PURE__ */ d({
|
|
|
2730
2917
|
"media-source": "original",
|
|
2731
2918
|
"next-page-error": !!t.state.nextPageError,
|
|
2732
2919
|
origin: "masonry",
|
|
2733
|
-
"preview-states": E(
|
|
2920
|
+
"preview-states": E(F),
|
|
2734
2921
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2735
2922
|
"reel-audio-state": t.reelAudioState,
|
|
2736
2923
|
"reel-forward": t.state.reelForward,
|
|
@@ -2741,7 +2928,7 @@ var ln = 35, un = 420, dn = /* @__PURE__ */ d({
|
|
|
2741
2928
|
onError: E(N),
|
|
2742
2929
|
onLoadMore: i[12] ||= (e) => d("loadMore"),
|
|
2743
2930
|
onMediaChange: G,
|
|
2744
|
-
onReady: E(
|
|
2931
|
+
onReady: E(P),
|
|
2745
2932
|
onRetryEnd: i[13] ||= (e) => d("retryEnd"),
|
|
2746
2933
|
onRetryForward: i[14] ||= (e) => d("retryForward"),
|
|
2747
2934
|
onReelAudioChange: i[15] ||= (e) => d("reelAudioChange", e)
|
|
@@ -2752,33 +2939,33 @@ var ln = 35, un = 420, dn = /* @__PURE__ */ d({
|
|
|
2752
2939
|
});
|
|
2753
2940
|
//#endregion
|
|
2754
2941
|
//#region src/core/page.ts
|
|
2755
|
-
function
|
|
2942
|
+
function wn(e) {
|
|
2756
2943
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2757
2944
|
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.");
|
|
2758
2945
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2759
2946
|
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.");
|
|
2760
2947
|
return e;
|
|
2761
2948
|
}
|
|
2762
|
-
function
|
|
2949
|
+
function $(e, t) {
|
|
2763
2950
|
let n = new Set(e.map((e) => e.postId));
|
|
2764
2951
|
return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
|
|
2765
2952
|
}
|
|
2766
|
-
function
|
|
2953
|
+
function Tn(e) {
|
|
2767
2954
|
return `${typeof e}:${String(e)}`;
|
|
2768
2955
|
}
|
|
2769
|
-
function
|
|
2770
|
-
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview
|
|
2956
|
+
function En(e) {
|
|
2957
|
+
return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${Tn(e.mediaId)}`;
|
|
2771
2958
|
}
|
|
2772
|
-
function
|
|
2773
|
-
let n = [...e], r = new Map(e.map((e, t) => [
|
|
2959
|
+
function Dn(e, t) {
|
|
2960
|
+
let n = [...e], r = new Map(e.map((e, t) => [Tn(e.postId), t]));
|
|
2774
2961
|
return t.forEach((e) => {
|
|
2775
|
-
let t =
|
|
2962
|
+
let t = Tn(e.postId), i = r.get(t);
|
|
2776
2963
|
if (i === void 0) {
|
|
2777
2964
|
r.set(t, n.length), n.push(e);
|
|
2778
2965
|
return;
|
|
2779
2966
|
}
|
|
2780
|
-
let a = n[i], o = new Set([a, ...a.items].map(
|
|
2781
|
-
let t =
|
|
2967
|
+
let a = n[i], o = new Set([a, ...a.items].map(En)), s = [e, ...e.items].filter((e) => {
|
|
2968
|
+
let t = En(e);
|
|
2782
2969
|
return o.has(t) ? !1 : (o.add(t), !0);
|
|
2783
2970
|
});
|
|
2784
2971
|
s.length > 0 && (n[i] = {
|
|
@@ -2787,14 +2974,14 @@ function hn(e, t) {
|
|
|
2787
2974
|
});
|
|
2788
2975
|
}), n;
|
|
2789
2976
|
}
|
|
2790
|
-
function
|
|
2977
|
+
function On(e) {
|
|
2791
2978
|
return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
|
|
2792
2979
|
}
|
|
2793
2980
|
//#endregion
|
|
2794
2981
|
//#region src/core/appendPage.ts
|
|
2795
|
-
function
|
|
2796
|
-
let i =
|
|
2797
|
-
t.items =
|
|
2982
|
+
function kn(e, t, n, r) {
|
|
2983
|
+
let i = wn(e), a = n.filterItems(i.items), o = On(i);
|
|
2984
|
+
t.items = Dn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
|
|
2798
2985
|
contributionIds: a.map(({ postId: e }) => e),
|
|
2799
2986
|
cursor: o,
|
|
2800
2987
|
next: i.next,
|
|
@@ -2803,32 +2990,32 @@ function _n(e, t, n, r) {
|
|
|
2803
2990
|
}
|
|
2804
2991
|
//#endregion
|
|
2805
2992
|
//#region src/core/requestDelay.ts
|
|
2806
|
-
var
|
|
2993
|
+
var An = 2e3, jn = 1e4, Mn = 250, Nn = {
|
|
2807
2994
|
delayRemainingMs: null,
|
|
2808
2995
|
nextRequestAt: null
|
|
2809
2996
|
};
|
|
2810
|
-
function
|
|
2997
|
+
function Pn(e, t) {
|
|
2811
2998
|
return e === void 0 ? t : Math.floor(e);
|
|
2812
2999
|
}
|
|
2813
|
-
function
|
|
3000
|
+
function Fn(e, t) {
|
|
2814
3001
|
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.`);
|
|
2815
3002
|
}
|
|
2816
|
-
function
|
|
2817
|
-
let n =
|
|
3003
|
+
function In(e, t = {}) {
|
|
3004
|
+
let n = Pn(t.delayStepMs, An), r = Pn(t.delayMaxMs, jn);
|
|
2818
3005
|
return Math.min(Math.max(0, e) * n, r);
|
|
2819
3006
|
}
|
|
2820
|
-
function
|
|
2821
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
3007
|
+
function Ln(e) {
|
|
3008
|
+
if (e == null || !Number.isFinite(e)) return { ...Nn };
|
|
2822
3009
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2823
3010
|
return t > 0 ? {
|
|
2824
3011
|
delayRemainingMs: t,
|
|
2825
3012
|
nextRequestAt: e
|
|
2826
|
-
} : { ...
|
|
3013
|
+
} : { ...Nn };
|
|
2827
3014
|
}
|
|
2828
|
-
async function
|
|
3015
|
+
async function Rn({ delayMs: e, onChange: t, signal: n }) {
|
|
2829
3016
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2830
3017
|
if (e <= 0) {
|
|
2831
|
-
t({ ...
|
|
3018
|
+
t({ ...Nn });
|
|
2832
3019
|
return;
|
|
2833
3020
|
}
|
|
2834
3021
|
let r = Date.now() + e;
|
|
@@ -2836,9 +3023,9 @@ async function Tn({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2836
3023
|
delayRemainingMs: e,
|
|
2837
3024
|
nextRequestAt: r
|
|
2838
3025
|
}), await new Promise((i, a) => {
|
|
2839
|
-
let o = !1, s = setInterval(f,
|
|
3026
|
+
let o = !1, s = setInterval(f, Mn), c = setTimeout(() => u(), e);
|
|
2840
3027
|
function l() {
|
|
2841
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
3028
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Nn });
|
|
2842
3029
|
}
|
|
2843
3030
|
function u(e) {
|
|
2844
3031
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2847,42 +3034,42 @@ async function Tn({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2847
3034
|
u(new DOMException("Aborted", "AbortError"));
|
|
2848
3035
|
}
|
|
2849
3036
|
function f() {
|
|
2850
|
-
let e =
|
|
3037
|
+
let e = Ln(r);
|
|
2851
3038
|
t(e), e.delayRemainingMs === null && u();
|
|
2852
3039
|
}
|
|
2853
3040
|
n.addEventListener("abort", d, { once: !0 });
|
|
2854
3041
|
});
|
|
2855
3042
|
}
|
|
2856
|
-
var
|
|
3043
|
+
var zn = class {
|
|
2857
3044
|
interval = null;
|
|
2858
3045
|
constructor(e) {
|
|
2859
3046
|
this.onChange = e;
|
|
2860
3047
|
}
|
|
2861
3048
|
clear() {
|
|
2862
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
3049
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Nn });
|
|
2863
3050
|
}
|
|
2864
3051
|
sync(e) {
|
|
2865
3052
|
this.clear();
|
|
2866
|
-
let t =
|
|
3053
|
+
let t = Ln(e);
|
|
2867
3054
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2868
|
-
let t =
|
|
3055
|
+
let t = Ln(e);
|
|
2869
3056
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2870
|
-
},
|
|
3057
|
+
}, Mn));
|
|
2871
3058
|
}
|
|
2872
3059
|
};
|
|
2873
|
-
function
|
|
3060
|
+
function Bn(e, t = !0) {
|
|
2874
3061
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2875
3062
|
}
|
|
2876
|
-
function
|
|
3063
|
+
function Vn(e) {
|
|
2877
3064
|
return `${typeof e}:${String(e)}`;
|
|
2878
3065
|
}
|
|
2879
|
-
function
|
|
3066
|
+
function Hn(e, t) {
|
|
2880
3067
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2881
3068
|
}
|
|
2882
|
-
function
|
|
3069
|
+
function Un(e) {
|
|
2883
3070
|
if (!e) return;
|
|
2884
|
-
if (
|
|
2885
|
-
|
|
3071
|
+
if (Hn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
3072
|
+
Fn(e, "frontend autofill");
|
|
2886
3073
|
let t = e.maxAdditionalPages;
|
|
2887
3074
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2888
3075
|
return;
|
|
@@ -2894,7 +3081,7 @@ function An(e) {
|
|
|
2894
3081
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2895
3082
|
}
|
|
2896
3083
|
}
|
|
2897
|
-
function
|
|
3084
|
+
function Wn(e, t, n = !0) {
|
|
2898
3085
|
if (!e) return {
|
|
2899
3086
|
cycleId: null,
|
|
2900
3087
|
delayRemainingMs: null,
|
|
@@ -2911,7 +3098,7 @@ function jn(e, t, n = !0) {
|
|
|
2911
3098
|
status: "idle",
|
|
2912
3099
|
strategy: null
|
|
2913
3100
|
};
|
|
2914
|
-
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a =
|
|
3101
|
+
let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Ln(r?.nextRequestAt);
|
|
2915
3102
|
return {
|
|
2916
3103
|
cycleId: r?.cycleId ?? null,
|
|
2917
3104
|
...a,
|
|
@@ -2928,7 +3115,7 @@ function jn(e, t, n = !0) {
|
|
|
2928
3115
|
strategy: e.strategy
|
|
2929
3116
|
};
|
|
2930
3117
|
}
|
|
2931
|
-
function
|
|
3118
|
+
function Gn(e) {
|
|
2932
3119
|
return [
|
|
2933
3120
|
"cancelling",
|
|
2934
3121
|
"filling",
|
|
@@ -2936,9 +3123,9 @@ function Mn(e) {
|
|
|
2936
3123
|
"waiting"
|
|
2937
3124
|
].includes(e.status);
|
|
2938
3125
|
}
|
|
2939
|
-
async function
|
|
3126
|
+
async function Kn(e, t, n) {
|
|
2940
3127
|
let r = t.autofill;
|
|
2941
|
-
if (!
|
|
3128
|
+
if (!Gn(r) || !r.cycleId) return;
|
|
2942
3129
|
let i = {
|
|
2943
3130
|
cycleId: r.cycleId,
|
|
2944
3131
|
feedKey: r.feedKey ?? "",
|
|
@@ -2951,16 +3138,16 @@ async function Nn(e, t, n) {
|
|
|
2951
3138
|
throw r.error = e, r.status = "error", e;
|
|
2952
3139
|
}
|
|
2953
3140
|
}
|
|
2954
|
-
function
|
|
3141
|
+
function qn(e, t, n) {
|
|
2955
3142
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2956
3143
|
}
|
|
2957
|
-
async function
|
|
2958
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
3144
|
+
async function Jn({ 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 }) {
|
|
3145
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Bn(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2959
3146
|
for (; y < h;) {
|
|
2960
|
-
let e =
|
|
3147
|
+
let e = Vn(g);
|
|
2961
3148
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2962
|
-
if (m.add(e), await
|
|
2963
|
-
delayMs:
|
|
3149
|
+
if (m.add(e), await Rn({
|
|
3150
|
+
delayMs: In(l + y, s),
|
|
2964
3151
|
onChange: a,
|
|
2965
3152
|
signal: d
|
|
2966
3153
|
}), y > 0 && u()) return {
|
|
@@ -2974,12 +3161,12 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2974
3161
|
status: "paused",
|
|
2975
3162
|
total: x
|
|
2976
3163
|
};
|
|
2977
|
-
let t =
|
|
3164
|
+
let t = wn(await n({
|
|
2978
3165
|
cursor: g,
|
|
2979
3166
|
signal: d
|
|
2980
3167
|
}));
|
|
2981
3168
|
y += 1, _ = g;
|
|
2982
|
-
let r =
|
|
3169
|
+
let r = $(p, t.items).slice(p.length);
|
|
2983
3170
|
b.push({
|
|
2984
3171
|
contributionIds: r.map(({ postId: e }) => e),
|
|
2985
3172
|
cursor: g,
|
|
@@ -3031,12 +3218,12 @@ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
3031
3218
|
}
|
|
3032
3219
|
//#endregion
|
|
3033
3220
|
//#region src/core/autofillController.ts
|
|
3034
|
-
var
|
|
3221
|
+
var Yn = class {
|
|
3035
3222
|
collection = null;
|
|
3036
3223
|
cycle = 0;
|
|
3037
3224
|
delayCountdown;
|
|
3038
3225
|
constructor(e) {
|
|
3039
|
-
this.context = e, this.delayCountdown = new
|
|
3226
|
+
this.context = e, this.delayCountdown = new zn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
3040
3227
|
}
|
|
3041
3228
|
beginCycle() {
|
|
3042
3229
|
let { options: e, state: t } = this.context;
|
|
@@ -3044,14 +3231,14 @@ var In = class {
|
|
|
3044
3231
|
this.clear();
|
|
3045
3232
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3046
3233
|
return t.autofill = {
|
|
3047
|
-
...
|
|
3234
|
+
...Wn(e, void 0, !1),
|
|
3048
3235
|
cycleId: n,
|
|
3049
3236
|
status: "filling"
|
|
3050
3237
|
}, n;
|
|
3051
3238
|
}
|
|
3052
3239
|
async cancel() {
|
|
3053
3240
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
3054
|
-
await
|
|
3241
|
+
await Kn(t, n, e), this.commitCollection();
|
|
3055
3242
|
}
|
|
3056
3243
|
captureCollection(e, t) {
|
|
3057
3244
|
t && (this.collection = e);
|
|
@@ -3073,36 +3260,36 @@ var In = class {
|
|
|
3073
3260
|
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
3074
3261
|
if (t?.strategy !== "frontend") return !1;
|
|
3075
3262
|
let r = this.collection;
|
|
3076
|
-
return this.collection = null, r ? (n.items =
|
|
3263
|
+
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, {
|
|
3077
3264
|
missing: r.missing,
|
|
3078
3265
|
received: r.received,
|
|
3079
3266
|
requests: r.requests
|
|
3080
3267
|
}), !0) : !1;
|
|
3081
3268
|
}
|
|
3082
|
-
},
|
|
3083
|
-
function
|
|
3269
|
+
}, Xn = 100;
|
|
3270
|
+
function Zn(e, t) {
|
|
3084
3271
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
3085
3272
|
}
|
|
3086
|
-
function
|
|
3273
|
+
function Qn(e, t, n) {
|
|
3087
3274
|
return Math.min(n, Math.max(t, e));
|
|
3088
3275
|
}
|
|
3089
|
-
function
|
|
3276
|
+
function $n(e) {
|
|
3090
3277
|
if (!e) return;
|
|
3091
3278
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
3092
|
-
if (
|
|
3093
|
-
e.speedPxPerSecond !== void 0 &&
|
|
3279
|
+
if (Zn("autoScroll.minSpeedPxPerSecond", t), Zn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
3280
|
+
e.speedPxPerSecond !== void 0 && Zn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
3094
3281
|
}
|
|
3095
|
-
function
|
|
3282
|
+
function er(e) {
|
|
3096
3283
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
3097
3284
|
return {
|
|
3098
3285
|
enabled: e?.enabled ?? !1,
|
|
3099
3286
|
maxSpeedPxPerSecond: n,
|
|
3100
3287
|
minSpeedPxPerSecond: t,
|
|
3101
3288
|
paused: !1,
|
|
3102
|
-
speedPxPerSecond:
|
|
3289
|
+
speedPxPerSecond: Qn(e?.speedPxPerSecond ?? 80, t, n)
|
|
3103
3290
|
};
|
|
3104
3291
|
}
|
|
3105
|
-
var
|
|
3292
|
+
var tr = class {
|
|
3106
3293
|
frame = null;
|
|
3107
3294
|
lastTimestamp = null;
|
|
3108
3295
|
mounted = !1;
|
|
@@ -3122,9 +3309,9 @@ var Hn = class {
|
|
|
3122
3309
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
3123
3310
|
}
|
|
3124
3311
|
setSpeed(e) {
|
|
3125
|
-
|
|
3312
|
+
Zn("auto-scroll speed", e);
|
|
3126
3313
|
let t = this.options.state;
|
|
3127
|
-
t.speedPxPerSecond =
|
|
3314
|
+
t.speedPxPerSecond = Qn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
3128
3315
|
}
|
|
3129
3316
|
tick = (e) => {
|
|
3130
3317
|
this.frame = null;
|
|
@@ -3136,7 +3323,7 @@ var Hn = class {
|
|
|
3136
3323
|
return;
|
|
3137
3324
|
}
|
|
3138
3325
|
if (this.lastTimestamp !== null) {
|
|
3139
|
-
let r = Math.min(
|
|
3326
|
+
let r = Math.min(Xn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
3140
3327
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
3141
3328
|
}
|
|
3142
3329
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -3150,13 +3337,13 @@ var Hn = class {
|
|
|
3150
3337
|
};
|
|
3151
3338
|
//#endregion
|
|
3152
3339
|
//#region src/core/backendAutofill.ts
|
|
3153
|
-
async function
|
|
3340
|
+
async function nr(e, t, n, r) {
|
|
3154
3341
|
let i = await e.onUnderfilled(n);
|
|
3155
3342
|
if (!r()) return;
|
|
3156
3343
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
3157
3344
|
let a = Math.max(n.received, i.received ?? n.received);
|
|
3158
3345
|
Object.assign(t.autofill, {
|
|
3159
|
-
...
|
|
3346
|
+
...Ln(i.nextRequestAt),
|
|
3160
3347
|
missing: Math.max(0, e.pageSize - a),
|
|
3161
3348
|
received: a,
|
|
3162
3349
|
sequence: i.sequence ?? 0,
|
|
@@ -3164,19 +3351,19 @@ async function Un(e, t, n, r) {
|
|
|
3164
3351
|
status: "waiting"
|
|
3165
3352
|
});
|
|
3166
3353
|
}
|
|
3167
|
-
function
|
|
3168
|
-
["complete", "exhausted"].includes(t.status) && t.items && (e.items =
|
|
3354
|
+
function rr(e, t) {
|
|
3355
|
+
["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);
|
|
3169
3356
|
}
|
|
3170
|
-
function
|
|
3357
|
+
function ir(e, t, n) {
|
|
3171
3358
|
let r = t.autofill;
|
|
3172
|
-
return !
|
|
3359
|
+
return !qn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (rr(t, n), Object.assign(r, Ln(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);
|
|
3173
3360
|
}
|
|
3174
|
-
function
|
|
3175
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
3361
|
+
function ar(e, t, n) {
|
|
3362
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Wn(e, n), rr(t, n), !0);
|
|
3176
3363
|
}
|
|
3177
3364
|
//#endregion
|
|
3178
3365
|
//#region src/core/backlogRestore.ts
|
|
3179
|
-
async function
|
|
3366
|
+
async function or(e, t, n) {
|
|
3180
3367
|
if (!e) return;
|
|
3181
3368
|
let r = new AbortController();
|
|
3182
3369
|
n(r);
|
|
@@ -3191,7 +3378,7 @@ async function qn(e, t, n) {
|
|
|
3191
3378
|
}
|
|
3192
3379
|
//#endregion
|
|
3193
3380
|
//#region src/core/initialAutofill.ts
|
|
3194
|
-
async function
|
|
3381
|
+
async function sr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
3195
3382
|
let c = a.autofill;
|
|
3196
3383
|
if (!c) return;
|
|
3197
3384
|
let l = s.items.length;
|
|
@@ -3204,7 +3391,7 @@ async function Jn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3204
3391
|
return;
|
|
3205
3392
|
}
|
|
3206
3393
|
if (c.strategy === "backend") {
|
|
3207
|
-
await
|
|
3394
|
+
await nr(c, s, {
|
|
3208
3395
|
cycleId: e,
|
|
3209
3396
|
feedKey: c.feedKey,
|
|
3210
3397
|
items: [...s.items],
|
|
@@ -3221,11 +3408,11 @@ async function Jn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3221
3408
|
s.autofill.status = "exhausted";
|
|
3222
3409
|
return;
|
|
3223
3410
|
}
|
|
3224
|
-
let u = await
|
|
3411
|
+
let u = await Jn({
|
|
3225
3412
|
existingItems: s.items,
|
|
3226
3413
|
initialCursor: s.next,
|
|
3227
3414
|
loadPage: a.loadPage,
|
|
3228
|
-
maximumRequests:
|
|
3415
|
+
maximumRequests: Bn(c, !1),
|
|
3229
3416
|
onCollection: n,
|
|
3230
3417
|
onDelayChange: (e) => {
|
|
3231
3418
|
t() && Object.assign(s.autofill, e);
|
|
@@ -3239,7 +3426,7 @@ async function Jn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3239
3426
|
shouldPause: () => s.loadMoreLocked,
|
|
3240
3427
|
signal: o
|
|
3241
3428
|
});
|
|
3242
|
-
t() && (s.items =
|
|
3429
|
+
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, {
|
|
3243
3430
|
missing: u.missing,
|
|
3244
3431
|
received: u.received,
|
|
3245
3432
|
requests: u.requests,
|
|
@@ -3248,13 +3435,13 @@ async function Jn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
3248
3435
|
}
|
|
3249
3436
|
//#endregion
|
|
3250
3437
|
//#region src/core/fill.ts
|
|
3251
|
-
function
|
|
3438
|
+
function cr(e) {
|
|
3252
3439
|
return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
3253
3440
|
}
|
|
3254
|
-
function
|
|
3441
|
+
function lr(e) {
|
|
3255
3442
|
return `${typeof e}:${String(e)}`;
|
|
3256
3443
|
}
|
|
3257
|
-
function
|
|
3444
|
+
function ur(e) {
|
|
3258
3445
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
3259
3446
|
if ("pages" in e) {
|
|
3260
3447
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -3267,21 +3454,21 @@ function Zn(e) {
|
|
|
3267
3454
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
3268
3455
|
throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
|
|
3269
3456
|
}
|
|
3270
|
-
function
|
|
3457
|
+
function dr(e) {
|
|
3271
3458
|
if (!e) return;
|
|
3272
3459
|
if (e.strategy === "frontend") {
|
|
3273
|
-
|
|
3460
|
+
Fn(e, "frontend fill");
|
|
3274
3461
|
return;
|
|
3275
3462
|
}
|
|
3276
3463
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
3277
3464
|
let t = e.initialSession;
|
|
3278
3465
|
if (t) {
|
|
3279
3466
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
3280
|
-
|
|
3467
|
+
ur(t.target);
|
|
3281
3468
|
}
|
|
3282
3469
|
}
|
|
3283
|
-
function
|
|
3284
|
-
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a =
|
|
3470
|
+
function fr(e, t, n = !0) {
|
|
3471
|
+
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Ln(i?.nextRequestAt);
|
|
3285
3472
|
return {
|
|
3286
3473
|
completedPages: i?.completedPages ?? 0,
|
|
3287
3474
|
cycleId: i?.cycleId ?? null,
|
|
@@ -3294,10 +3481,10 @@ function $n(e, t, n = !0) {
|
|
|
3294
3481
|
sessionId: i?.sessionId ?? null,
|
|
3295
3482
|
status: i?.status ?? "idle",
|
|
3296
3483
|
strategy: e?.strategy ?? null,
|
|
3297
|
-
target: i ?
|
|
3484
|
+
target: i ? cr(i.target) : null
|
|
3298
3485
|
};
|
|
3299
3486
|
}
|
|
3300
|
-
function
|
|
3487
|
+
function pr(e) {
|
|
3301
3488
|
return [
|
|
3302
3489
|
"cancelling",
|
|
3303
3490
|
"filling",
|
|
@@ -3305,7 +3492,7 @@ function er(e) {
|
|
|
3305
3492
|
"waiting"
|
|
3306
3493
|
].includes(e.status);
|
|
3307
3494
|
}
|
|
3308
|
-
async function
|
|
3495
|
+
async function mr({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
3309
3496
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
3310
3497
|
if ("items" in l && f.length >= l.items) return {
|
|
3311
3498
|
completedPages: m,
|
|
@@ -3317,10 +3504,10 @@ async function tr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3317
3504
|
status: "complete"
|
|
3318
3505
|
};
|
|
3319
3506
|
for (; _ !== null;) {
|
|
3320
|
-
let e =
|
|
3507
|
+
let e = lr(h);
|
|
3321
3508
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
3322
|
-
if (p.add(e), await
|
|
3323
|
-
delayMs:
|
|
3509
|
+
if (p.add(e), await Rn({
|
|
3510
|
+
delayMs: In(m, o),
|
|
3324
3511
|
onChange: i,
|
|
3325
3512
|
signal: c
|
|
3326
3513
|
}), m > 0 && s()) return {
|
|
@@ -3333,12 +3520,12 @@ async function tr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3333
3520
|
status: "paused",
|
|
3334
3521
|
total: y
|
|
3335
3522
|
};
|
|
3336
|
-
let t =
|
|
3523
|
+
let t = wn(await n({
|
|
3337
3524
|
cursor: h,
|
|
3338
3525
|
signal: c
|
|
3339
3526
|
}));
|
|
3340
3527
|
m += 1, g = h;
|
|
3341
|
-
let b =
|
|
3528
|
+
let b = $(f, t.items).slice(f.length);
|
|
3342
3529
|
if (d.push({
|
|
3343
3530
|
contributionIds: b.map(({ postId: e }) => e),
|
|
3344
3531
|
cursor: h,
|
|
@@ -3401,12 +3588,12 @@ async function tr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
3401
3588
|
}
|
|
3402
3589
|
//#endregion
|
|
3403
3590
|
//#region src/core/backendFill.ts
|
|
3404
|
-
async function
|
|
3591
|
+
async function hr(e, t, n, r) {
|
|
3405
3592
|
let i = await e.onStart(n);
|
|
3406
3593
|
if (r()) {
|
|
3407
3594
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
3408
3595
|
Object.assign(t.fill, {
|
|
3409
|
-
...
|
|
3596
|
+
...Ln(i.nextRequestAt),
|
|
3410
3597
|
completedPages: i.completedPages ?? 0,
|
|
3411
3598
|
received: i.received ?? 0,
|
|
3412
3599
|
sequence: i.sequence ?? 0,
|
|
@@ -3415,23 +3602,23 @@ async function nr(e, t, n, r) {
|
|
|
3415
3602
|
});
|
|
3416
3603
|
}
|
|
3417
3604
|
}
|
|
3418
|
-
function
|
|
3605
|
+
function gr(e, t, n) {
|
|
3419
3606
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
3420
3607
|
}
|
|
3421
|
-
function
|
|
3608
|
+
function _r(e) {
|
|
3422
3609
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
3423
3610
|
}
|
|
3424
|
-
function
|
|
3611
|
+
function vr(e, t) {
|
|
3425
3612
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
3426
3613
|
let n = e.fill.target;
|
|
3427
3614
|
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;
|
|
3428
3615
|
}
|
|
3429
|
-
function
|
|
3430
|
-
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items =
|
|
3616
|
+
function yr(e, t, n) {
|
|
3617
|
+
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));
|
|
3431
3618
|
}
|
|
3432
|
-
function
|
|
3433
|
-
return !
|
|
3434
|
-
...
|
|
3619
|
+
function br(e, t, n, r) {
|
|
3620
|
+
return !gr(e, t, n) || !_r(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !vr(t, n) ? !1 : (yr(t, n, r), Object.assign(t.fill, {
|
|
3621
|
+
...Ln(n.status === "waiting" ? n.nextRequestAt : null),
|
|
3435
3622
|
completedPages: n.completedPages,
|
|
3436
3623
|
error: n.error ?? null,
|
|
3437
3624
|
received: n.received,
|
|
@@ -3439,45 +3626,45 @@ function sr(e, t, n, r) {
|
|
|
3439
3626
|
status: n.status
|
|
3440
3627
|
}), !0);
|
|
3441
3628
|
}
|
|
3442
|
-
function
|
|
3629
|
+
function xr(e, t, n, r) {
|
|
3443
3630
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
3444
3631
|
let i = t.fill;
|
|
3445
|
-
return t.fill =
|
|
3632
|
+
return t.fill = fr(e, n), !_r(n) || !vr(t, n) ? (t.fill = i, !1) : (yr(t, n, r), !0);
|
|
3446
3633
|
}
|
|
3447
3634
|
//#endregion
|
|
3448
3635
|
//#region src/core/fillController.ts
|
|
3449
|
-
var
|
|
3636
|
+
var Sr = class {
|
|
3450
3637
|
abortController = null;
|
|
3451
3638
|
cycle = 0;
|
|
3452
3639
|
delayCountdown;
|
|
3453
3640
|
requestVersion = 0;
|
|
3454
3641
|
collection = null;
|
|
3455
3642
|
constructor(e) {
|
|
3456
|
-
this.options = e, this.delayCountdown = new
|
|
3643
|
+
this.options = e, this.delayCountdown = new zn((e) => {
|
|
3457
3644
|
Object.assign(this.options.state.fill, e);
|
|
3458
3645
|
}), this.syncBackendCountdown();
|
|
3459
3646
|
}
|
|
3460
3647
|
isActive() {
|
|
3461
|
-
return
|
|
3648
|
+
return pr(this.options.state.fill);
|
|
3462
3649
|
}
|
|
3463
3650
|
applyUpdate(e) {
|
|
3464
|
-
let t =
|
|
3651
|
+
let t = br(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3465
3652
|
return t && this.syncBackendCountdown(), t;
|
|
3466
3653
|
}
|
|
3467
3654
|
restoreSession(e) {
|
|
3468
|
-
let t =
|
|
3655
|
+
let t = xr(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
3469
3656
|
return t && this.syncBackendCountdown(), t;
|
|
3470
3657
|
}
|
|
3471
3658
|
async start(e, t = {}) {
|
|
3472
3659
|
let n = this.options.fill;
|
|
3473
3660
|
if (!n) throw Error("Vibe fill is not configured.");
|
|
3474
3661
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
3475
|
-
let r =
|
|
3662
|
+
let r = ur(e), i = ur(t.target ?? r), a = t.progressOffset ?? {
|
|
3476
3663
|
completedPages: 0,
|
|
3477
3664
|
received: 0
|
|
3478
3665
|
}, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
3479
3666
|
if (this.options.state.fill = {
|
|
3480
|
-
|
|
3667
|
+
...fr(n, void 0, !1),
|
|
3481
3668
|
completedPages: a.completedPages,
|
|
3482
3669
|
cycleId: o,
|
|
3483
3670
|
received: a.received,
|
|
@@ -3490,7 +3677,7 @@ var lr = class {
|
|
|
3490
3677
|
let s = ++this.requestVersion, c = new AbortController();
|
|
3491
3678
|
this.abortController = c;
|
|
3492
3679
|
try {
|
|
3493
|
-
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await
|
|
3680
|
+
n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await hr(n, this.options.state, {
|
|
3494
3681
|
cycleId: o,
|
|
3495
3682
|
feedKey: n.feedKey,
|
|
3496
3683
|
items: [...this.options.state.items],
|
|
@@ -3508,7 +3695,7 @@ var lr = class {
|
|
|
3508
3695
|
}
|
|
3509
3696
|
async cancel() {
|
|
3510
3697
|
let { fill: e, state: t } = this.options;
|
|
3511
|
-
if (!
|
|
3698
|
+
if (!pr(t.fill) || !t.fill.cycleId) return;
|
|
3512
3699
|
let n = {
|
|
3513
3700
|
cycleId: t.fill.cycleId,
|
|
3514
3701
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3552,7 +3739,7 @@ var lr = class {
|
|
|
3552
3739
|
});
|
|
3553
3740
|
}
|
|
3554
3741
|
reset() {
|
|
3555
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3742
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = fr(this.options.fill, void 0, !1), this.collection = null;
|
|
3556
3743
|
}
|
|
3557
3744
|
destroy() {
|
|
3558
3745
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3587,7 +3774,7 @@ var lr = class {
|
|
|
3587
3774
|
s.fill.status = "until" in t ? "complete" : "exhausted";
|
|
3588
3775
|
return;
|
|
3589
3776
|
}
|
|
3590
|
-
let c = await
|
|
3777
|
+
let c = await mr({
|
|
3591
3778
|
existingItems: s.items,
|
|
3592
3779
|
initialCursor: s.next,
|
|
3593
3780
|
loadPage: o,
|
|
@@ -3613,7 +3800,7 @@ var lr = class {
|
|
|
3613
3800
|
signal: n.signal,
|
|
3614
3801
|
target: t
|
|
3615
3802
|
});
|
|
3616
|
-
this.isCurrent(r) && (s.items =
|
|
3803
|
+
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, {
|
|
3617
3804
|
completedPages: a.completedPages + c.completedPages,
|
|
3618
3805
|
received: a.received + c.received,
|
|
3619
3806
|
status: c.status
|
|
@@ -3623,7 +3810,7 @@ var lr = class {
|
|
|
3623
3810
|
let e = this.collection;
|
|
3624
3811
|
if (this.collection = null, !e || this.options.fill?.strategy !== "frontend") return;
|
|
3625
3812
|
let t = this.options.state;
|
|
3626
|
-
t.items =
|
|
3813
|
+
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, {
|
|
3627
3814
|
completedPages: e.completedPages,
|
|
3628
3815
|
received: e.received
|
|
3629
3816
|
});
|
|
@@ -3635,7 +3822,7 @@ var lr = class {
|
|
|
3635
3822
|
};
|
|
3636
3823
|
//#endregion
|
|
3637
3824
|
//#region src/core/fillReconciliation.ts
|
|
3638
|
-
async function
|
|
3825
|
+
async function Cr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
|
|
3639
3826
|
if (!e.needsReconciliation(o.items)) return "skipped";
|
|
3640
3827
|
let s = await e.reconcile({
|
|
3641
3828
|
existingItems: o.items,
|
|
@@ -3644,11 +3831,11 @@ async function ur({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
|
|
|
3644
3831
|
shouldPause: () => o.loadMoreLocked,
|
|
3645
3832
|
signal: a
|
|
3646
3833
|
});
|
|
3647
|
-
return t() ? (o.items =
|
|
3834
|
+
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;
|
|
3648
3835
|
}
|
|
3649
3836
|
//#endregion
|
|
3650
3837
|
//#region src/core/feedFooter.ts
|
|
3651
|
-
function
|
|
3838
|
+
function wr(e) {
|
|
3652
3839
|
return {
|
|
3653
3840
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3654
3841
|
loadMore: () => e.loadNext(),
|
|
@@ -3660,64 +3847,64 @@ function dr(e) {
|
|
|
3660
3847
|
retryFill: () => e.retryFill()
|
|
3661
3848
|
};
|
|
3662
3849
|
}
|
|
3663
|
-
function
|
|
3850
|
+
function Tr(e) {
|
|
3664
3851
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3665
3852
|
}
|
|
3666
|
-
function
|
|
3667
|
-
e?.intervalMs !== void 0 &&
|
|
3853
|
+
function Er(e) {
|
|
3854
|
+
e?.intervalMs !== void 0 && Tr(e.intervalMs);
|
|
3668
3855
|
}
|
|
3669
|
-
function
|
|
3856
|
+
function Dr(e) {
|
|
3670
3857
|
return {
|
|
3671
3858
|
enabled: e?.enabled ?? !1,
|
|
3672
3859
|
includePostItems: e?.includePostItems ?? !1,
|
|
3673
3860
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3674
3861
|
};
|
|
3675
3862
|
}
|
|
3676
|
-
function
|
|
3863
|
+
function Or(e, t) {
|
|
3677
3864
|
if (typeof t == "boolean") {
|
|
3678
3865
|
e.enabled = t;
|
|
3679
3866
|
return;
|
|
3680
3867
|
}
|
|
3681
|
-
|
|
3868
|
+
Er(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);
|
|
3682
3869
|
}
|
|
3683
3870
|
//#endregion
|
|
3684
3871
|
//#region src/core/reelInfoSheet.ts
|
|
3685
|
-
function
|
|
3872
|
+
function kr(e) {
|
|
3686
3873
|
return { enabled: e?.enabled ?? !1 };
|
|
3687
3874
|
}
|
|
3688
|
-
function
|
|
3875
|
+
function Ar(e, t, n) {
|
|
3689
3876
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3690
3877
|
e.enabled = n;
|
|
3691
3878
|
}
|
|
3692
3879
|
//#endregion
|
|
3693
3880
|
//#region src/core/initialRuntimeState.ts
|
|
3694
|
-
function
|
|
3881
|
+
function jr(e, t) {
|
|
3695
3882
|
let n = e.initialPage;
|
|
3696
3883
|
return {
|
|
3697
3884
|
activeReelPostId: null,
|
|
3698
|
-
autoScroll:
|
|
3699
|
-
autofill:
|
|
3885
|
+
autoScroll: er(e.autoScroll),
|
|
3886
|
+
autofill: Wn(e.autofill),
|
|
3700
3887
|
current: n?.current ?? null,
|
|
3701
3888
|
error: null,
|
|
3702
|
-
fill:
|
|
3889
|
+
fill: fr(e.fill),
|
|
3703
3890
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3704
3891
|
isLoading: !n,
|
|
3705
3892
|
isLoadingMore: !1,
|
|
3706
|
-
items: n ?
|
|
3893
|
+
items: n ? $([], n.items) : [],
|
|
3707
3894
|
layout: t === "reel" ? "reel" : "masonry",
|
|
3708
3895
|
loadMoreLocked: !1,
|
|
3709
3896
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
3710
3897
|
next: n?.next ?? null,
|
|
3711
3898
|
nextPageError: null,
|
|
3712
3899
|
phoneMode: !1,
|
|
3713
|
-
reelAutoAdvance:
|
|
3900
|
+
reelAutoAdvance: Dr(e.reelAutoAdvance),
|
|
3714
3901
|
reelForward: {
|
|
3715
3902
|
error: null,
|
|
3716
3903
|
status: "idle"
|
|
3717
3904
|
},
|
|
3718
3905
|
reelForwardIndex: null,
|
|
3719
3906
|
reelForwardItem: null,
|
|
3720
|
-
reelInfoSheet:
|
|
3907
|
+
reelInfoSheet: kr(e.reelInfoSheet),
|
|
3721
3908
|
reelInfoSheetOverlay: !1,
|
|
3722
3909
|
reelMediaSource: "original",
|
|
3723
3910
|
reelOrigin: null,
|
|
@@ -3726,21 +3913,21 @@ function vr(e, t) {
|
|
|
3726
3913
|
}
|
|
3727
3914
|
//#endregion
|
|
3728
3915
|
//#region src/core/options.ts
|
|
3729
|
-
function
|
|
3916
|
+
function Mr(e, t) {
|
|
3730
3917
|
if (t) {
|
|
3731
3918
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3732
3919
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3733
3920
|
}
|
|
3734
3921
|
}
|
|
3735
|
-
function
|
|
3922
|
+
function Nr(e, t) {
|
|
3736
3923
|
if (t) {
|
|
3737
3924
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3738
3925
|
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.`);
|
|
3739
3926
|
}
|
|
3740
3927
|
}
|
|
3741
|
-
function
|
|
3742
|
-
if (
|
|
3743
|
-
if (
|
|
3928
|
+
function Pr(e) {
|
|
3929
|
+
if ($n(e.autoScroll), Mr("cardHeader", e.cardHeader), Mr("cardFooter", e.cardFooter), Nr("header", e.mediaCard?.header), Nr("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "visible-post") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"visible-post\".");
|
|
3930
|
+
if (Un(e.autofill), dr(e.fill), he(e.masonry), Er(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3744
3931
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3745
3932
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3746
3933
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3755,7 +3942,7 @@ function xr(e) {
|
|
|
3755
3942
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3756
3943
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3757
3944
|
}
|
|
3758
|
-
function
|
|
3945
|
+
function Fr(e) {
|
|
3759
3946
|
if (typeof e != "string") return e;
|
|
3760
3947
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3761
3948
|
let t = document.querySelector(e);
|
|
@@ -3764,7 +3951,7 @@ function Sr(e) {
|
|
|
3764
3951
|
}
|
|
3765
3952
|
//#endregion
|
|
3766
3953
|
//#region src/core/pageRequest.ts
|
|
3767
|
-
async function
|
|
3954
|
+
async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3768
3955
|
let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
|
|
3769
3956
|
received: l.autofill.received,
|
|
3770
3957
|
requests: l.autofill.requests
|
|
@@ -3776,11 +3963,11 @@ async function Cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3776
3963
|
let m = !1;
|
|
3777
3964
|
try {
|
|
3778
3965
|
if (u?.strategy === "frontend") {
|
|
3779
|
-
let s = await
|
|
3966
|
+
let s = await Jn({
|
|
3780
3967
|
existingItems: e ? l.items : [],
|
|
3781
3968
|
initialCursor: n,
|
|
3782
3969
|
loadPage: i,
|
|
3783
|
-
maximumRequests: f ? Math.max(0,
|
|
3970
|
+
maximumRequests: f ? Math.max(0, Bn(u) - f.requests) : void 0,
|
|
3784
3971
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3785
3972
|
onDelayChange: (e) => {
|
|
3786
3973
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3795,7 +3982,7 @@ async function Cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3795
3982
|
signal: c
|
|
3796
3983
|
});
|
|
3797
3984
|
if (!r()) return;
|
|
3798
|
-
l.items = e ?
|
|
3985
|
+
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, {
|
|
3799
3986
|
missing: s.missing,
|
|
3800
3987
|
received: s.received,
|
|
3801
3988
|
requests: s.requests,
|
|
@@ -3803,12 +3990,12 @@ async function Cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3803
3990
|
}), o(s.pages), t.clearCollection();
|
|
3804
3991
|
return;
|
|
3805
3992
|
}
|
|
3806
|
-
let s =
|
|
3993
|
+
let s = wn(await i({
|
|
3807
3994
|
cursor: n,
|
|
3808
3995
|
signal: c
|
|
3809
3996
|
}));
|
|
3810
3997
|
if (!r()) return;
|
|
3811
|
-
let d = e ? l.items : [], h =
|
|
3998
|
+
let d = e ? l.items : [], h = $(d, s.items), g = h.length - d.length;
|
|
3812
3999
|
if (l.items = h, a(n), o([{
|
|
3813
4000
|
contributionIds: h.slice(d.length).map(({ postId: e }) => e),
|
|
3814
4001
|
cursor: n,
|
|
@@ -3823,7 +4010,7 @@ async function Cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3823
4010
|
l.autofill.status = "complete";
|
|
3824
4011
|
return;
|
|
3825
4012
|
}
|
|
3826
|
-
await
|
|
4013
|
+
await nr(u, l, {
|
|
3827
4014
|
cycleId: p,
|
|
3828
4015
|
feedKey: u.feedKey,
|
|
3829
4016
|
items: h.slice(d.length),
|
|
@@ -3845,16 +4032,16 @@ async function Cr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3845
4032
|
}
|
|
3846
4033
|
//#endregion
|
|
3847
4034
|
//#region src/core/removalReconciliationController.ts
|
|
3848
|
-
function
|
|
4035
|
+
function Lr(e) {
|
|
3849
4036
|
return `${typeof e}:${String(e)}`;
|
|
3850
4037
|
}
|
|
3851
|
-
function
|
|
4038
|
+
function Rr(e) {
|
|
3852
4039
|
return `${typeof e}:${String(e)}`;
|
|
3853
4040
|
}
|
|
3854
|
-
function
|
|
4041
|
+
function zr(e) {
|
|
3855
4042
|
return e.map(({ postId: e }) => e);
|
|
3856
4043
|
}
|
|
3857
|
-
var
|
|
4044
|
+
var Br = class {
|
|
3858
4045
|
delay;
|
|
3859
4046
|
enabled;
|
|
3860
4047
|
maxReplayPages;
|
|
@@ -3873,7 +4060,7 @@ var Er = class {
|
|
|
3873
4060
|
e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
|
|
3874
4061
|
}
|
|
3875
4062
|
filterItems(e) {
|
|
3876
|
-
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(
|
|
4063
|
+
return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(Lr(e)));
|
|
3877
4064
|
}
|
|
3878
4065
|
needsReconciliation(e) {
|
|
3879
4066
|
return this.pending !== null || this.findUnderfilledPage(e) >= 0;
|
|
@@ -3886,45 +4073,45 @@ var Er = class {
|
|
|
3886
4073
|
}
|
|
3887
4074
|
recordInitialPage(e) {
|
|
3888
4075
|
e && this.recordPages([{
|
|
3889
|
-
contributionIds:
|
|
3890
|
-
cursor:
|
|
4076
|
+
contributionIds: zr(e.items),
|
|
4077
|
+
cursor: On(e),
|
|
3891
4078
|
next: e.next,
|
|
3892
|
-
returnedIds:
|
|
4079
|
+
returnedIds: zr(e.items)
|
|
3893
4080
|
}]);
|
|
3894
4081
|
}
|
|
3895
4082
|
remove(e) {
|
|
3896
|
-
e.forEach((e) => this.tombstones.add(
|
|
4083
|
+
e.forEach((e) => this.tombstones.add(Lr(e)));
|
|
3897
4084
|
}
|
|
3898
4085
|
reset() {
|
|
3899
4086
|
this.pages = [], this.pending = null, this.tombstones.clear();
|
|
3900
4087
|
}
|
|
3901
4088
|
restore(e) {
|
|
3902
|
-
e.forEach((e) => this.tombstones.delete(
|
|
4089
|
+
e.forEach((e) => this.tombstones.delete(Lr(e)));
|
|
3903
4090
|
}
|
|
3904
4091
|
async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
|
|
3905
4092
|
let a = this.pending ?? this.createSession(e);
|
|
3906
4093
|
for (this.pending = a; a.remainingRequests > 0;) {
|
|
3907
|
-
let e =
|
|
4094
|
+
let e = Rr(a.cursor);
|
|
3908
4095
|
if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3909
|
-
if (await
|
|
3910
|
-
delayMs:
|
|
4096
|
+
if (await Rn({
|
|
4097
|
+
delayMs: In(a.pages.length, this.delay),
|
|
3911
4098
|
onChange: n,
|
|
3912
4099
|
signal: i
|
|
3913
4100
|
}), a.pages.length > 0 && r()) return this.result(a, "paused");
|
|
3914
|
-
let o =
|
|
4101
|
+
let o = wn(await t({
|
|
3915
4102
|
cursor: a.cursor,
|
|
3916
4103
|
signal: i
|
|
3917
4104
|
}));
|
|
3918
4105
|
a.seenCursors.add(e);
|
|
3919
4106
|
let s = this.filterItems(o.items), c = [];
|
|
3920
4107
|
if (s.forEach((e) => {
|
|
3921
|
-
let t =
|
|
4108
|
+
let t = Lr(e.postId);
|
|
3922
4109
|
a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
|
|
3923
4110
|
}), a.pages.push({
|
|
3924
4111
|
contributionIds: c,
|
|
3925
4112
|
cursor: a.cursor,
|
|
3926
4113
|
next: o.next,
|
|
3927
|
-
returnedIds:
|
|
4114
|
+
returnedIds: zr(s)
|
|
3928
4115
|
}), 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");
|
|
3929
4116
|
}
|
|
3930
4117
|
return this.result(a, "complete");
|
|
@@ -3932,9 +4119,9 @@ var Er = class {
|
|
|
3932
4119
|
createSession(e) {
|
|
3933
4120
|
let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
|
|
3934
4121
|
if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
|
|
3935
|
-
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(
|
|
4122
|
+
let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(Lr))), a = new Set(e.map(({ postId: e }) => Lr(e)).filter((e) => !i.has(e)));
|
|
3936
4123
|
return {
|
|
3937
|
-
appended: new Set(e.map(({ postId: e }) =>
|
|
4124
|
+
appended: new Set(e.map(({ postId: e }) => Lr(e))),
|
|
3938
4125
|
attributed: new Set(a),
|
|
3939
4126
|
cursor: r.cursor,
|
|
3940
4127
|
items: [],
|
|
@@ -3959,11 +4146,11 @@ var Er = class {
|
|
|
3959
4146
|
}
|
|
3960
4147
|
findUnderfilledPage(e) {
|
|
3961
4148
|
if (!this.enabled || this.pages.length === 0) return -1;
|
|
3962
|
-
let t = new Set(e.map(({ postId: e }) =>
|
|
3963
|
-
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(
|
|
4149
|
+
let t = new Set(e.map(({ postId: e }) => Lr(e)));
|
|
4150
|
+
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(Lr(e))).length < this.pageSize);
|
|
3964
4151
|
}
|
|
3965
4152
|
recordPage(e) {
|
|
3966
|
-
let t =
|
|
4153
|
+
let t = Rr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Rr(e) === t);
|
|
3967
4154
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3968
4155
|
...e,
|
|
3969
4156
|
contributionIds: [...e.contributionIds],
|
|
@@ -3973,7 +4160,7 @@ var Er = class {
|
|
|
3973
4160
|
};
|
|
3974
4161
|
//#endregion
|
|
3975
4162
|
//#region src/core/activeItemRemoval.ts
|
|
3976
|
-
function
|
|
4163
|
+
function Vr(e, t, n, r, i) {
|
|
3977
4164
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3978
4165
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3979
4166
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3986,7 +4173,7 @@ function Dr(e, t, n, r, i) {
|
|
|
3986
4173
|
}
|
|
3987
4174
|
//#endregion
|
|
3988
4175
|
//#region src/core/exactMediaRemovalController.ts
|
|
3989
|
-
function
|
|
4176
|
+
function Hr(e, t) {
|
|
3990
4177
|
let [n, ...r] = t;
|
|
3991
4178
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3992
4179
|
return {
|
|
@@ -3995,10 +4182,10 @@ function Or(e, t) {
|
|
|
3995
4182
|
items: r
|
|
3996
4183
|
};
|
|
3997
4184
|
}
|
|
3998
|
-
function
|
|
4185
|
+
function Ur(e) {
|
|
3999
4186
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
4000
4187
|
}
|
|
4001
|
-
var
|
|
4188
|
+
var Wr = class {
|
|
4002
4189
|
generation = 0;
|
|
4003
4190
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
4004
4191
|
state;
|
|
@@ -4006,10 +4193,10 @@ var Ar = class {
|
|
|
4006
4193
|
this.options = e, this.state = e.state;
|
|
4007
4194
|
}
|
|
4008
4195
|
remove(e) {
|
|
4009
|
-
|
|
4196
|
+
Ur(e);
|
|
4010
4197
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
4011
4198
|
if (!n) return null;
|
|
4012
|
-
let r = [...
|
|
4199
|
+
let r = [...V(n)], i = r[e.mediaIndex];
|
|
4013
4200
|
if (!i) return null;
|
|
4014
4201
|
let a = Object.freeze({
|
|
4015
4202
|
media: i,
|
|
@@ -4023,7 +4210,7 @@ var Ar = class {
|
|
|
4023
4210
|
restored: !1
|
|
4024
4211
|
});
|
|
4025
4212
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
4026
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
4213
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Hr(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);
|
|
4027
4214
|
}
|
|
4028
4215
|
reset() {
|
|
4029
4216
|
this.generation += 1;
|
|
@@ -4048,32 +4235,32 @@ var Ar = class {
|
|
|
4048
4235
|
return this.state.layout === "reel" || this.state.reelOrigin === "masonry";
|
|
4049
4236
|
}
|
|
4050
4237
|
restoreIntoPost(e, t) {
|
|
4051
|
-
let n = this.state.items[e], r = [...
|
|
4052
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
4238
|
+
let n = this.state.items[e], r = [...V(n)], i = Math.min(t.mediaIndex, r.length);
|
|
4239
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Hr(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
4053
4240
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
4054
4241
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
4055
4242
|
}
|
|
4056
4243
|
updateMediaIndexAfterRemoval(e, t, n) {
|
|
4057
4244
|
let r = this.state.items.find((t) => t.postId === e);
|
|
4058
4245
|
if (!r) return;
|
|
4059
|
-
let i =
|
|
4246
|
+
let i = V(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
|
|
4060
4247
|
n ? o = t < i ? t : 0 : t < a && (o = a - 1), this.state.mediaIndices.set(e, Math.min(o, i - 1));
|
|
4061
4248
|
}
|
|
4062
4249
|
};
|
|
4063
4250
|
//#endregion
|
|
4064
4251
|
//#region src/core/itemPlacement.ts
|
|
4065
|
-
function
|
|
4252
|
+
function Gr(e, t) {
|
|
4066
4253
|
let n = new Set(t);
|
|
4067
4254
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
4068
4255
|
index: t,
|
|
4069
4256
|
item: e
|
|
4070
4257
|
}] : []);
|
|
4071
4258
|
}
|
|
4072
|
-
function
|
|
4259
|
+
function Kr(e, t) {
|
|
4073
4260
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
4074
4261
|
return e.filter((e) => !n.has(e.postId));
|
|
4075
4262
|
}
|
|
4076
|
-
function
|
|
4263
|
+
function qr(e, t) {
|
|
4077
4264
|
t.forEach(({ index: e }) => {
|
|
4078
4265
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
4079
4266
|
});
|
|
@@ -4084,7 +4271,7 @@ function Nr(e, t) {
|
|
|
4084
4271
|
}
|
|
4085
4272
|
//#endregion
|
|
4086
4273
|
//#region src/core/itemRemovalController.ts
|
|
4087
|
-
var
|
|
4274
|
+
var Jr = 20, Yr = class {
|
|
4088
4275
|
generation = 0;
|
|
4089
4276
|
historyLimit;
|
|
4090
4277
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -4093,7 +4280,7 @@ var Pr = 20, Fr = class {
|
|
|
4093
4280
|
itemOrder;
|
|
4094
4281
|
stopItemsWatcher;
|
|
4095
4282
|
constructor(e) {
|
|
4096
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
4283
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Jr, 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" });
|
|
4097
4284
|
}
|
|
4098
4285
|
destroy() {
|
|
4099
4286
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -4107,7 +4294,7 @@ var Pr = 20, Fr = class {
|
|
|
4107
4294
|
let a = this.options.startRemoval(i, t);
|
|
4108
4295
|
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
4109
4296
|
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);
|
|
4110
|
-
return this.state.items =
|
|
4297
|
+
return this.state.items = Kr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
4111
4298
|
}
|
|
4112
4299
|
reset() {
|
|
4113
4300
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -4118,7 +4305,7 @@ var Pr = 20, Fr = class {
|
|
|
4118
4305
|
this.restoreRemoval(t);
|
|
4119
4306
|
return;
|
|
4120
4307
|
}
|
|
4121
|
-
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 =
|
|
4308
|
+
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 = qr(this.state.items, r);
|
|
4122
4309
|
this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
|
|
4123
4310
|
}
|
|
4124
4311
|
restoreRemoval(e) {
|
|
@@ -4144,7 +4331,7 @@ var Pr = 20, Fr = class {
|
|
|
4144
4331
|
}
|
|
4145
4332
|
collectOrderedPlacements(e) {
|
|
4146
4333
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4147
|
-
return
|
|
4334
|
+
return Gr(this.state.items, e).map((e) => ({
|
|
4148
4335
|
index: t.get(e.item.postId) ?? e.index,
|
|
4149
4336
|
item: e.item
|
|
4150
4337
|
}));
|
|
@@ -4175,7 +4362,7 @@ var Pr = 20, Fr = class {
|
|
|
4175
4362
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
4176
4363
|
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;
|
|
4177
4364
|
}
|
|
4178
|
-
},
|
|
4365
|
+
}, Xr = class {
|
|
4179
4366
|
forward = null;
|
|
4180
4367
|
forwardPromise = null;
|
|
4181
4368
|
forwardVersion = 0;
|
|
@@ -4262,7 +4449,7 @@ var Pr = 20, Fr = class {
|
|
|
4262
4449
|
}
|
|
4263
4450
|
}
|
|
4264
4451
|
}
|
|
4265
|
-
},
|
|
4452
|
+
}, Zr = class {
|
|
4266
4453
|
generation = 0;
|
|
4267
4454
|
pending = Promise.resolve();
|
|
4268
4455
|
constructor(e) {
|
|
@@ -4279,7 +4466,7 @@ var Pr = 20, Fr = class {
|
|
|
4279
4466
|
if (!n) return;
|
|
4280
4467
|
let r = t.mediaIndices.get(e.postId) ?? 0;
|
|
4281
4468
|
if (e.mediaIndex === r) {
|
|
4282
|
-
if (
|
|
4469
|
+
if (V(n).length > 1) {
|
|
4283
4470
|
await this.options.transitionMedia(1);
|
|
4284
4471
|
return;
|
|
4285
4472
|
}
|
|
@@ -4312,24 +4499,24 @@ var Pr = 20, Fr = class {
|
|
|
4312
4499
|
};
|
|
4313
4500
|
//#endregion
|
|
4314
4501
|
//#region src/core/removalControllers.ts
|
|
4315
|
-
function
|
|
4316
|
-
let t = new
|
|
4502
|
+
function Qr(e) {
|
|
4503
|
+
let t = new Xr(e), n = new Zr({
|
|
4317
4504
|
state: e.state,
|
|
4318
4505
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
4319
4506
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
4320
4507
|
});
|
|
4321
4508
|
return {
|
|
4322
|
-
exactMediaRemoval: new
|
|
4509
|
+
exactMediaRemoval: new Wr({
|
|
4323
4510
|
onActivate: e.onActivate,
|
|
4324
4511
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
4325
4512
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
4326
4513
|
reelForward: t,
|
|
4327
4514
|
state: e.state
|
|
4328
4515
|
}),
|
|
4329
|
-
itemRemoval: new
|
|
4516
|
+
itemRemoval: new Yr({
|
|
4330
4517
|
historyLimit: e.historyLimit,
|
|
4331
4518
|
onItemsRemoved: (n, r, i) => {
|
|
4332
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
4519
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Vr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
4333
4520
|
},
|
|
4334
4521
|
onRemovalRestored: (n) => {
|
|
4335
4522
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -4344,17 +4531,17 @@ function Rr(e) {
|
|
|
4344
4531
|
reelRemoval: n
|
|
4345
4532
|
};
|
|
4346
4533
|
}
|
|
4347
|
-
var
|
|
4348
|
-
function
|
|
4534
|
+
var $r = 1.5;
|
|
4535
|
+
function ei(e) {
|
|
4349
4536
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
4350
4537
|
if (t > 0 && t < 600) return !0;
|
|
4351
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
4538
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * $r;
|
|
4352
4539
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
4353
4540
|
}
|
|
4354
|
-
function
|
|
4355
|
-
return
|
|
4541
|
+
function ti(e) {
|
|
4542
|
+
return ei(e) ? "reel" : "masonry";
|
|
4356
4543
|
}
|
|
4357
|
-
function
|
|
4544
|
+
function ni(e) {
|
|
4358
4545
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
4359
4546
|
return {
|
|
4360
4547
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -4364,15 +4551,15 @@ function Hr(e) {
|
|
|
4364
4551
|
viewportWidth: n.clientWidth
|
|
4365
4552
|
};
|
|
4366
4553
|
}
|
|
4367
|
-
function
|
|
4368
|
-
return
|
|
4554
|
+
function ri(e) {
|
|
4555
|
+
return ei(ni(e));
|
|
4369
4556
|
}
|
|
4370
|
-
function
|
|
4371
|
-
return
|
|
4557
|
+
function ii(e) {
|
|
4558
|
+
return ti(ni(e));
|
|
4372
4559
|
}
|
|
4373
4560
|
//#endregion
|
|
4374
4561
|
//#region src/core/responsiveLayoutController.ts
|
|
4375
|
-
var
|
|
4562
|
+
var ai = class {
|
|
4376
4563
|
layoutMode;
|
|
4377
4564
|
resizeObserver = null;
|
|
4378
4565
|
target = null;
|
|
@@ -4397,13 +4584,13 @@ var Gr = class {
|
|
|
4397
4584
|
}
|
|
4398
4585
|
handleResponsiveLayout = () => {
|
|
4399
4586
|
if (!this.target) return;
|
|
4400
|
-
let e =
|
|
4401
|
-
this.state.phoneMode =
|
|
4587
|
+
let e = ii(this.target);
|
|
4588
|
+
this.state.phoneMode = ri(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
4402
4589
|
};
|
|
4403
|
-
},
|
|
4590
|
+
}, oi = class {
|
|
4404
4591
|
state;
|
|
4405
4592
|
constructor(e) {
|
|
4406
|
-
this.options = e, this.state = x(
|
|
4593
|
+
this.options = e, this.state = x(Tt({
|
|
4407
4594
|
...e.initialReelAudioState,
|
|
4408
4595
|
muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
|
|
4409
4596
|
}));
|
|
@@ -4412,9 +4599,9 @@ var Gr = class {
|
|
|
4412
4599
|
return { ...this.state };
|
|
4413
4600
|
}
|
|
4414
4601
|
set(e, t = !1) {
|
|
4415
|
-
Object.assign(this.state,
|
|
4602
|
+
Object.assign(this.state, Tt(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
|
|
4416
4603
|
}
|
|
4417
|
-
},
|
|
4604
|
+
}, si = class {
|
|
4418
4605
|
routedReelPostId = null;
|
|
4419
4606
|
reelRouteIsActive = !1;
|
|
4420
4607
|
constructor(e, t) {
|
|
@@ -4444,30 +4631,30 @@ var Gr = class {
|
|
|
4444
4631
|
};
|
|
4445
4632
|
//#endregion
|
|
4446
4633
|
//#region src/core/updateItems.ts
|
|
4447
|
-
function
|
|
4634
|
+
function ci(e) {
|
|
4448
4635
|
return String(e);
|
|
4449
4636
|
}
|
|
4450
|
-
function
|
|
4451
|
-
let n =
|
|
4637
|
+
function li(e, t) {
|
|
4638
|
+
let n = V(t).length;
|
|
4452
4639
|
(e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
|
|
4453
4640
|
}
|
|
4454
|
-
function
|
|
4641
|
+
function ui(e, t) {
|
|
4455
4642
|
let n = /* @__PURE__ */ new Map();
|
|
4456
|
-
if (t.forEach((e) => n.set(
|
|
4643
|
+
if (t.forEach((e) => n.set(ci(e.postId), e)), n.size === 0) return [];
|
|
4457
4644
|
let r = [], i = e.items.map((t) => {
|
|
4458
|
-
let i = n.get(
|
|
4645
|
+
let i = n.get(ci(t.postId));
|
|
4459
4646
|
if (!i) return t;
|
|
4460
4647
|
let a = {
|
|
4461
4648
|
...i,
|
|
4462
4649
|
postId: t.postId
|
|
4463
4650
|
};
|
|
4464
|
-
return
|
|
4651
|
+
return li(e, a), e.reelForwardItem && ci(e.reelForwardItem.postId) === ci(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
|
|
4465
4652
|
});
|
|
4466
4653
|
return r.length > 0 && (e.items = i), r;
|
|
4467
4654
|
}
|
|
4468
4655
|
//#endregion
|
|
4469
4656
|
//#region src/core/createVibe.ts
|
|
4470
|
-
var
|
|
4657
|
+
var di = class {
|
|
4471
4658
|
app = null;
|
|
4472
4659
|
autoScroll;
|
|
4473
4660
|
autofillController;
|
|
@@ -4490,24 +4677,24 @@ var Zr = class {
|
|
|
4490
4677
|
reelAudio;
|
|
4491
4678
|
state;
|
|
4492
4679
|
constructor(e) {
|
|
4493
|
-
this.options = e,
|
|
4680
|
+
this.options = e, Pr(e);
|
|
4494
4681
|
let t = e.layout ?? "masonry";
|
|
4495
|
-
this.state = x(
|
|
4682
|
+
this.state = x(jr(e, t)), this.reelAudio = new oi(e), this.lastLoadedCursor = e.initialPage ? On(e.initialPage) : null, this.notificationItems = G(this.state), this.autoScroll = new tr({
|
|
4496
4683
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
4497
4684
|
state: this.state.autoScroll
|
|
4498
|
-
}), this.autofillController = new
|
|
4685
|
+
}), this.autofillController = new Yn({
|
|
4499
4686
|
cancelRequest: () => this.cancelRequest(),
|
|
4500
4687
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4501
4688
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4502
4689
|
options: e.autofill,
|
|
4503
4690
|
state: this.state
|
|
4504
|
-
}), this.removalReconciliation = new
|
|
4691
|
+
}), this.removalReconciliation = new Br(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Sr({
|
|
4505
4692
|
fill: e.fill,
|
|
4506
4693
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
4507
4694
|
needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
|
|
4508
4695
|
onLastCursor: (e) => this.setCurrentCursor(e),
|
|
4509
4696
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
4510
|
-
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) =>
|
|
4697
|
+
prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Cr({
|
|
4511
4698
|
controller: this.removalReconciliation,
|
|
4512
4699
|
isCurrent: t,
|
|
4513
4700
|
loadPage: e.loadPage,
|
|
@@ -4517,8 +4704,8 @@ var Zr = class {
|
|
|
4517
4704
|
state: this.state
|
|
4518
4705
|
}),
|
|
4519
4706
|
state: this.state
|
|
4520
|
-
}), this.routing = new
|
|
4521
|
-
let n =
|
|
4707
|
+
}), this.routing = new si(e.routing, this.state);
|
|
4708
|
+
let n = Qr({
|
|
4522
4709
|
historyLimit: e.removalHistoryLimit,
|
|
4523
4710
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
4524
4711
|
onItemsRemoved: (e) => this.removalReconciliation.remove(e),
|
|
@@ -4527,20 +4714,20 @@ var Zr = class {
|
|
|
4527
4714
|
state: this.state,
|
|
4528
4715
|
surface: () => this.surface
|
|
4529
4716
|
});
|
|
4530
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
4717
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new ai(t, this.state, () => {
|
|
4531
4718
|
this.routing.syncFeed();
|
|
4532
4719
|
}), this.startStateNotifications();
|
|
4533
4720
|
}
|
|
4534
4721
|
async mount() {
|
|
4535
4722
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
4536
4723
|
this.startStateNotifications();
|
|
4537
|
-
let e =
|
|
4538
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
4724
|
+
let e = Fr(this.options.target);
|
|
4725
|
+
this.responsiveLayout.mount(e), this.app = i(Cn, {
|
|
4539
4726
|
canRetryEnd: !!this.options.loadPage,
|
|
4540
4727
|
cardFooter: this.options.cardFooter,
|
|
4541
4728
|
cardHeader: this.options.cardHeader,
|
|
4542
4729
|
feedFooter: this.options.feedFooter,
|
|
4543
|
-
feedFooterActions:
|
|
4730
|
+
feedFooterActions: wr(this),
|
|
4544
4731
|
mediaCard: this.options.mediaCard,
|
|
4545
4732
|
masonry: this.options.masonry,
|
|
4546
4733
|
onMediaReady: this.options.onMediaReady,
|
|
@@ -4565,7 +4752,7 @@ var Zr = class {
|
|
|
4565
4752
|
onRetryForward: () => {
|
|
4566
4753
|
this.retryReelForward();
|
|
4567
4754
|
}
|
|
4568
|
-
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await
|
|
4755
|
+
}), this.surface = this.app.mount(e), this.autoScroll.mount(), await or(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
|
|
4569
4756
|
this.restoreController = e;
|
|
4570
4757
|
}), !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();
|
|
4571
4758
|
}
|
|
@@ -4573,7 +4760,7 @@ var Zr = class {
|
|
|
4573
4760
|
this.restoreController?.abort(), this.restoreController = null, this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.removalReconciliation.reset(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
4574
4761
|
}
|
|
4575
4762
|
getState() {
|
|
4576
|
-
return
|
|
4763
|
+
return te(this.state);
|
|
4577
4764
|
}
|
|
4578
4765
|
getReelAudioState() {
|
|
4579
4766
|
return this.reelAudio.get();
|
|
@@ -4600,7 +4787,7 @@ var Zr = class {
|
|
|
4600
4787
|
return this.itemRemoval.restoreRemoval(e);
|
|
4601
4788
|
}
|
|
4602
4789
|
updateItems(e) {
|
|
4603
|
-
return
|
|
4790
|
+
return ui(this.state, e);
|
|
4604
4791
|
}
|
|
4605
4792
|
retryReelForward() {
|
|
4606
4793
|
return this.reelForward.retry();
|
|
@@ -4639,7 +4826,7 @@ var Zr = class {
|
|
|
4639
4826
|
this.autoScroll.setSpeed(e);
|
|
4640
4827
|
}
|
|
4641
4828
|
applyAutofillUpdate(e) {
|
|
4642
|
-
let t =
|
|
4829
|
+
let t = ir(this.options.autofill, this.state, e);
|
|
4643
4830
|
return t && this.autofillController.syncCountdown(), t;
|
|
4644
4831
|
}
|
|
4645
4832
|
cancelAutofill() {
|
|
@@ -4650,7 +4837,7 @@ var Zr = class {
|
|
|
4650
4837
|
await this.cancelFill();
|
|
4651
4838
|
return;
|
|
4652
4839
|
}
|
|
4653
|
-
if (
|
|
4840
|
+
if (Gn(this.state.autofill)) {
|
|
4654
4841
|
await this.cancelAutofill();
|
|
4655
4842
|
return;
|
|
4656
4843
|
}
|
|
@@ -4664,12 +4851,12 @@ var Zr = class {
|
|
|
4664
4851
|
}
|
|
4665
4852
|
async fill(e) {
|
|
4666
4853
|
if (!this.state.loadMoreLocked) {
|
|
4667
|
-
if (this.pendingRequest ||
|
|
4854
|
+
if (this.pendingRequest || Gn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4668
4855
|
await this.fillController.start(e);
|
|
4669
4856
|
}
|
|
4670
4857
|
}
|
|
4671
4858
|
restoreAutofillSession(e) {
|
|
4672
|
-
let t =
|
|
4859
|
+
let t = ar(this.options.autofill, this.state, e);
|
|
4673
4860
|
return t && this.autofillController.syncCountdown(), t;
|
|
4674
4861
|
}
|
|
4675
4862
|
restoreFillSession(e) {
|
|
@@ -4679,14 +4866,14 @@ var Zr = class {
|
|
|
4679
4866
|
return this.startLoadMore(() => this.loadNextSequence());
|
|
4680
4867
|
}
|
|
4681
4868
|
appendPage(e) {
|
|
4682
|
-
|
|
4869
|
+
kn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
|
|
4683
4870
|
}
|
|
4684
4871
|
replenishAfterRemoval() {
|
|
4685
4872
|
return this.startLoadMore(() => this.replenishAfterRemovalSequence());
|
|
4686
4873
|
}
|
|
4687
4874
|
async startLoadMore(e) {
|
|
4688
4875
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4689
|
-
if (this.state.loadMoreLocked ||
|
|
4876
|
+
if (this.state.loadMoreLocked || Gn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
4690
4877
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4691
4878
|
let t = e();
|
|
4692
4879
|
return this.pendingRequest = t, t.finally(() => {
|
|
@@ -4701,12 +4888,12 @@ var Zr = class {
|
|
|
4701
4888
|
}
|
|
4702
4889
|
async replaceFeed(e, t) {
|
|
4703
4890
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4704
|
-
return
|
|
4891
|
+
return Gn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Wn(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);
|
|
4705
4892
|
}
|
|
4706
4893
|
async loadFilteredPage(e) {
|
|
4707
4894
|
let t = this.options.loadPage;
|
|
4708
4895
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4709
|
-
let n =
|
|
4896
|
+
let n = wn(await t(e));
|
|
4710
4897
|
return {
|
|
4711
4898
|
...n,
|
|
4712
4899
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4725,7 +4912,7 @@ var Zr = class {
|
|
|
4725
4912
|
let t = ++this.requestVersion, n = new AbortController();
|
|
4726
4913
|
this.abortController = n;
|
|
4727
4914
|
try {
|
|
4728
|
-
let r = await
|
|
4915
|
+
let r = await Cr({
|
|
4729
4916
|
controller: this.removalReconciliation,
|
|
4730
4917
|
isCurrent: () => t === this.requestVersion,
|
|
4731
4918
|
loadPage: e,
|
|
@@ -4734,7 +4921,7 @@ var Zr = class {
|
|
|
4734
4921
|
signal: n.signal,
|
|
4735
4922
|
state: this.state
|
|
4736
4923
|
});
|
|
4737
|
-
return t === this.requestVersion && r === "complete";
|
|
4924
|
+
return t === this.requestVersion && r === "complete" && (this.state.nextPageError = null), t === this.requestVersion && r === "complete";
|
|
4738
4925
|
} catch (e) {
|
|
4739
4926
|
return !n.signal.aborted && t === this.requestVersion && (this.state.nextPageError = e), !1;
|
|
4740
4927
|
} finally {
|
|
@@ -4743,7 +4930,7 @@ var Zr = class {
|
|
|
4743
4930
|
}
|
|
4744
4931
|
async retryEnd() {
|
|
4745
4932
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4746
|
-
if (!this.state.loadMoreLocked && !(
|
|
4933
|
+
if (!this.state.loadMoreLocked && !(Gn(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);
|
|
4747
4934
|
}
|
|
4748
4935
|
setInfiniteScroll(e) {
|
|
4749
4936
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4767,10 +4954,10 @@ var Zr = class {
|
|
|
4767
4954
|
this.state.total = e;
|
|
4768
4955
|
}
|
|
4769
4956
|
setReelAutoAdvance(e) {
|
|
4770
|
-
|
|
4957
|
+
Or(this.state.reelAutoAdvance, e);
|
|
4771
4958
|
}
|
|
4772
4959
|
setReelInfoSheet(e) {
|
|
4773
|
-
|
|
4960
|
+
Ar(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4774
4961
|
}
|
|
4775
4962
|
setLayout(e) {
|
|
4776
4963
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4790,7 +4977,7 @@ var Zr = class {
|
|
|
4790
4977
|
async fetchPage(e, t) {
|
|
4791
4978
|
if (!this.options.loadPage) return;
|
|
4792
4979
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4793
|
-
this.abortController = r, await
|
|
4980
|
+
this.abortController = r, await Ir({
|
|
4794
4981
|
append: t,
|
|
4795
4982
|
autofillController: this.autofillController,
|
|
4796
4983
|
cursor: e,
|
|
@@ -4812,7 +4999,7 @@ var Zr = class {
|
|
|
4812
4999
|
startInitialAutofill() {
|
|
4813
5000
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4814
5001
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4815
|
-
let r =
|
|
5002
|
+
let r = sr({
|
|
4816
5003
|
cycleId: n,
|
|
4817
5004
|
isCurrent: () => e === this.requestVersion,
|
|
4818
5005
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4830,7 +5017,7 @@ var Zr = class {
|
|
|
4830
5017
|
}
|
|
4831
5018
|
startStateNotifications() {
|
|
4832
5019
|
let e = this.options.onStateChange;
|
|
4833
|
-
!e || this.stopStateWatcher || (e(
|
|
5020
|
+
!e || this.stopStateWatcher || (e(te(this.state, this.notificationItems.value)), this.stopStateWatcher = O(this.state, () => e(te(this.state, this.notificationItems.value)), {
|
|
4834
5021
|
deep: !0,
|
|
4835
5022
|
flush: "post"
|
|
4836
5023
|
}));
|
|
@@ -4839,8 +5026,8 @@ var Zr = class {
|
|
|
4839
5026
|
this.lastLoadedCursor = e, this.state.current = e;
|
|
4840
5027
|
}
|
|
4841
5028
|
};
|
|
4842
|
-
function
|
|
4843
|
-
return new
|
|
5029
|
+
function fi(e) {
|
|
5030
|
+
return new di(e);
|
|
4844
5031
|
}
|
|
4845
5032
|
//#endregion
|
|
4846
|
-
export {
|
|
5033
|
+
export { fi as createVibe };
|