@wyxos/vibe 5.3.1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/lib/components/VibeSurface.vue.d.ts +2 -0
- package/lib/components/useMediaLoading.d.ts +14 -0
- package/lib/core/feed.d.ts +2 -0
- package/lib/core/masonryOptions.d.ts +12 -0
- package/lib/core/runtime.d.ts +3 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +536 -494
- package/lib/types.d.ts +1 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -15,6 +15,9 @@ function F(e, t) {
|
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/core/runtime.ts
|
|
17
17
|
function I(e) {
|
|
18
|
+
return r(() => Object.freeze([...e.items]));
|
|
19
|
+
}
|
|
20
|
+
function L(e, t = [...e.items]) {
|
|
18
21
|
return {
|
|
19
22
|
activeReelPostId: e.activeReelPostId,
|
|
20
23
|
autoScroll: { ...e.autoScroll },
|
|
@@ -27,7 +30,7 @@ function I(e) {
|
|
|
27
30
|
infiniteScroll: e.infiniteScroll,
|
|
28
31
|
isLoading: e.isLoading,
|
|
29
32
|
isLoadingMore: e.isLoadingMore,
|
|
30
|
-
items:
|
|
33
|
+
items: t,
|
|
31
34
|
layout: e.layout,
|
|
32
35
|
lifecycle: e.isLoading || e.isLoadingMore ? "loading" : e.error || e.nextPageError ? "error" : "loaded",
|
|
33
36
|
loadMoreLocked: e.loadMoreLocked,
|
|
@@ -43,17 +46,17 @@ function I(e) {
|
|
|
43
46
|
}
|
|
44
47
|
//#endregion
|
|
45
48
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
46
|
-
var
|
|
49
|
+
var R = {
|
|
47
50
|
key: 0,
|
|
48
51
|
class: "gallery-footer"
|
|
49
|
-
},
|
|
52
|
+
}, z = {
|
|
50
53
|
key: 0,
|
|
51
54
|
class: "load-more-status",
|
|
52
55
|
role: "status"
|
|
53
|
-
},
|
|
56
|
+
}, B = ["disabled"], V = {
|
|
54
57
|
key: 2,
|
|
55
58
|
class: "end-feed"
|
|
56
|
-
},
|
|
59
|
+
}, H = ["disabled"], U = /* @__PURE__ */ d({
|
|
57
60
|
__name: "GalleryFooter",
|
|
58
61
|
props: {
|
|
59
62
|
canRetryEnd: { type: Boolean },
|
|
@@ -69,14 +72,14 @@ var L = {
|
|
|
69
72
|
function i() {
|
|
70
73
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
71
74
|
}
|
|
72
|
-
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer",
|
|
75
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", R, [e.isLoading ? (b(), s("p", z, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
|
|
73
76
|
key: 1,
|
|
74
77
|
"data-test": "load-more",
|
|
75
78
|
class: "load-more-button",
|
|
76
79
|
type: "button",
|
|
77
80
|
disabled: e.loadMoreLocked,
|
|
78
81
|
onClick: i
|
|
79
|
-
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9,
|
|
82
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, B)) : (b(), s("div", V, [n[1] ||= c("p", {
|
|
80
83
|
class: "end-feed-message",
|
|
81
84
|
role: "status"
|
|
82
85
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -85,9 +88,9 @@ var L = {
|
|
|
85
88
|
type: "button",
|
|
86
89
|
disabled: e.loadMoreLocked,
|
|
87
90
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
88
|
-
}, " Check for more ", 8,
|
|
91
|
+
}, " Check for more ", 8, H)]))])) : o("", !0);
|
|
89
92
|
}
|
|
90
|
-
}),
|
|
93
|
+
}), W = /* @__PURE__ */ d({
|
|
91
94
|
__name: "FeedFooter",
|
|
92
95
|
props: {
|
|
93
96
|
actions: {},
|
|
@@ -124,7 +127,7 @@ var L = {
|
|
|
124
127
|
"can-retry-end",
|
|
125
128
|
"show-load-more",
|
|
126
129
|
"state"
|
|
127
|
-
])) : (b(), a(
|
|
130
|
+
])) : (b(), a(U, {
|
|
128
131
|
key: 1,
|
|
129
132
|
"can-retry-end": e.canRetryEnd,
|
|
130
133
|
"has-error": e.hasError,
|
|
@@ -143,7 +146,7 @@ var L = {
|
|
|
143
146
|
"show-load-more"
|
|
144
147
|
]));
|
|
145
148
|
}
|
|
146
|
-
}),
|
|
149
|
+
}), G = ["role"], K = { class: "gallery-status" }, ee = /* @__PURE__ */ d({
|
|
147
150
|
__name: "FeedStatus",
|
|
148
151
|
props: {
|
|
149
152
|
actions: {},
|
|
@@ -157,7 +160,7 @@ var L = {
|
|
|
157
160
|
return (n, u) => (b(), s("main", {
|
|
158
161
|
class: "gallery-shell",
|
|
159
162
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
160
|
-
}, [c("p",
|
|
163
|
+
}, [c("p", K, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(W, {
|
|
161
164
|
key: 0,
|
|
162
165
|
actions: t.actions,
|
|
163
166
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -179,36 +182,36 @@ var L = {
|
|
|
179
182
|
"is-loading",
|
|
180
183
|
"load-more-locked",
|
|
181
184
|
"state"
|
|
182
|
-
])) : o("", !0)], 8,
|
|
185
|
+
])) : o("", !0)], 8, G));
|
|
183
186
|
}
|
|
184
187
|
});
|
|
185
|
-
function
|
|
188
|
+
function q(e) {
|
|
186
189
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
187
190
|
}
|
|
188
191
|
//#endregion
|
|
189
192
|
//#region src/core/masonry.ts
|
|
190
|
-
function
|
|
193
|
+
function te(e) {
|
|
191
194
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
192
195
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
193
196
|
}
|
|
194
|
-
function
|
|
197
|
+
function J(e) {
|
|
195
198
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
196
199
|
}
|
|
197
200
|
function ne(e) {
|
|
198
201
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
199
202
|
}
|
|
200
|
-
function
|
|
203
|
+
function Y(e, t) {
|
|
201
204
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
|
|
202
205
|
return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
|
|
203
206
|
}
|
|
204
|
-
function
|
|
207
|
+
function re(e, t, n) {
|
|
205
208
|
if (t <= 0 || e.length === 0) return {
|
|
206
209
|
columns: 0,
|
|
207
210
|
height: 0,
|
|
208
211
|
items: []
|
|
209
212
|
};
|
|
210
213
|
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) => {
|
|
211
|
-
let t =
|
|
214
|
+
let t = J(c), n = s * te(e) + i, a = {
|
|
212
215
|
x: t * (s + r),
|
|
213
216
|
y: c[t],
|
|
214
217
|
width: s,
|
|
@@ -222,12 +225,27 @@ function ie(e, t, n) {
|
|
|
222
225
|
items: l
|
|
223
226
|
};
|
|
224
227
|
}
|
|
228
|
+
function ie(e, t) {
|
|
229
|
+
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
230
|
+
return a === void 0 ? i : Math.min(i, a);
|
|
231
|
+
}
|
|
232
|
+
function ae(e) {
|
|
233
|
+
let t = e?.overscan;
|
|
234
|
+
if (t) {
|
|
235
|
+
for (let [e, n] of [
|
|
236
|
+
["maximumPx", t.maximumPx],
|
|
237
|
+
["minimumPx", t.minimumPx],
|
|
238
|
+
["viewportMultiplier", t.viewportMultiplier]
|
|
239
|
+
]) if (n !== void 0 && (!Number.isFinite(n) || n < 0)) throw TypeError(`Vibe masonry overscan ${e} must be a non-negative number.`);
|
|
240
|
+
if (t.maximumPx !== void 0 && t.minimumPx !== void 0 && t.maximumPx < t.minimumPx) throw TypeError("Vibe masonry overscan maximumPx must be greater than or equal to minimumPx.");
|
|
241
|
+
}
|
|
242
|
+
}
|
|
225
243
|
//#endregion
|
|
226
244
|
//#region src/core/scrollbar.ts
|
|
227
|
-
function
|
|
245
|
+
function oe(e, t, n) {
|
|
228
246
|
return Math.min(n, Math.max(t, e));
|
|
229
247
|
}
|
|
230
|
-
function
|
|
248
|
+
function se({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
231
249
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
232
250
|
if (!(c > 0 && o > 0)) return {
|
|
233
251
|
maximumScrollPosition: c,
|
|
@@ -236,23 +254,23 @@ function oe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
236
254
|
thumbSize: o,
|
|
237
255
|
thumbTravel: 0
|
|
238
256
|
};
|
|
239
|
-
let l =
|
|
257
|
+
let l = oe(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
240
258
|
return {
|
|
241
259
|
maximumScrollPosition: c,
|
|
242
260
|
scrollable: !0,
|
|
243
|
-
thumbOffset: u * (
|
|
261
|
+
thumbOffset: u * (oe(n, 0, c) / c),
|
|
244
262
|
thumbSize: l,
|
|
245
263
|
thumbTravel: u
|
|
246
264
|
};
|
|
247
265
|
}
|
|
248
266
|
//#endregion
|
|
249
267
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
250
|
-
var
|
|
268
|
+
var ce = ["aria-hidden"], le = [
|
|
251
269
|
"aria-controls",
|
|
252
270
|
"aria-valuemax",
|
|
253
271
|
"aria-valuenow",
|
|
254
272
|
"tabindex"
|
|
255
|
-
],
|
|
273
|
+
], ue = 32, de = 40, fe = 120, pe = /* @__PURE__ */ d({
|
|
256
274
|
__name: "GalleryScrollbar",
|
|
257
275
|
props: {
|
|
258
276
|
contentSize: {},
|
|
@@ -274,16 +292,16 @@ var se = ["aria-hidden"], J = [
|
|
|
274
292
|
function k() {
|
|
275
293
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
276
294
|
g = null, o.value || (l.value = !1);
|
|
277
|
-
},
|
|
295
|
+
}, fe);
|
|
278
296
|
}
|
|
279
297
|
function A() {
|
|
280
298
|
l.value = !0, k();
|
|
281
299
|
}
|
|
282
300
|
function j() {
|
|
283
301
|
let e = t.scrollElement, r = i.value;
|
|
284
|
-
return !e || !r ? n :
|
|
302
|
+
return !e || !r ? n : se({
|
|
285
303
|
contentSize: e.scrollHeight,
|
|
286
|
-
minimumThumbSize:
|
|
304
|
+
minimumThumbSize: ue,
|
|
287
305
|
scrollPosition: e.scrollTop,
|
|
288
306
|
trackSize: r.clientHeight,
|
|
289
307
|
viewportSize: e.clientHeight
|
|
@@ -336,7 +354,7 @@ var se = ["aria-hidden"], J = [
|
|
|
336
354
|
}
|
|
337
355
|
function z(e) {
|
|
338
356
|
if (!E.value) return;
|
|
339
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
357
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - de : e.key === "ArrowDown" ? r + de : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
340
358
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
341
359
|
}
|
|
342
360
|
function B(e) {
|
|
@@ -382,15 +400,15 @@ var se = ["aria-hidden"], J = [
|
|
|
382
400
|
onPointerdown: I,
|
|
383
401
|
onPointermove: L,
|
|
384
402
|
onPointerup: R
|
|
385
|
-
}, null, 44,
|
|
403
|
+
}, null, 44, le)], 42, ce));
|
|
386
404
|
}
|
|
387
|
-
}),
|
|
405
|
+
}), me = (e) => {
|
|
388
406
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
389
407
|
return !1;
|
|
390
|
-
},
|
|
391
|
-
let t =
|
|
408
|
+
}, he = (e) => e === "", X = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ge = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), _e = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ve = (e) => {
|
|
409
|
+
let t = _e(e);
|
|
392
410
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
393
|
-
},
|
|
411
|
+
}, ye = {
|
|
394
412
|
xmlns: "http://www.w3.org/2000/svg",
|
|
395
413
|
width: 24,
|
|
396
414
|
height: 24,
|
|
@@ -400,27 +418,27 @@ var se = ["aria-hidden"], J = [
|
|
|
400
418
|
"stroke-width": 2,
|
|
401
419
|
"stroke-linecap": "round",
|
|
402
420
|
"stroke-linejoin": "round"
|
|
403
|
-
},
|
|
404
|
-
...
|
|
421
|
+
}, be = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = ye.width, color: s = ye.stroke, ...c }, { slots: l }) => p("svg", {
|
|
422
|
+
...ye,
|
|
405
423
|
...c,
|
|
406
424
|
width: o,
|
|
407
425
|
height: o,
|
|
408
426
|
stroke: s,
|
|
409
|
-
"stroke-width":
|
|
410
|
-
class:
|
|
411
|
-
...!l.default && !
|
|
412
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
427
|
+
"stroke-width": he(n) || he(r) || n === !0 || r === !0 ? Number(i || a || ye["stroke-width"]) * 24 / Number(o) : i || a || ye["stroke-width"],
|
|
428
|
+
class: X("lucide", c.class, ...e ? [`lucide-${ge(ve(e))}-icon`, `lucide-${ge(e)}`] : ["lucide-icon"]),
|
|
429
|
+
...!l.default && !me(c) && { "aria-hidden": "true" }
|
|
430
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), xe = (e, t) => (n, { slots: r, attrs: i }) => p(be, {
|
|
413
431
|
...i,
|
|
414
432
|
...n,
|
|
415
433
|
iconNode: t,
|
|
416
434
|
name: e
|
|
417
|
-
}, r),
|
|
435
|
+
}, r), Se = xe("chevron-left", [["path", {
|
|
418
436
|
d: "m15 18-6-6 6-6",
|
|
419
437
|
key: "1wnfg3"
|
|
420
|
-
}]]),
|
|
438
|
+
}]]), Ce = xe("chevron-right", [["path", {
|
|
421
439
|
d: "m9 18 6-6-6-6",
|
|
422
440
|
key: "mthhwq"
|
|
423
|
-
}]]),
|
|
441
|
+
}]]), we = xe("pause", [["rect", {
|
|
424
442
|
x: "14",
|
|
425
443
|
y: "3",
|
|
426
444
|
width: "5",
|
|
@@ -434,10 +452,10 @@ var se = ["aria-hidden"], J = [
|
|
|
434
452
|
height: "18",
|
|
435
453
|
rx: "1",
|
|
436
454
|
key: "1wsw3u"
|
|
437
|
-
}]]),
|
|
455
|
+
}]]), Te = xe("play", [["path", {
|
|
438
456
|
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",
|
|
439
457
|
key: "10ikf1"
|
|
440
|
-
}]]),
|
|
458
|
+
}]]), Ee = xe("volume-2", [
|
|
441
459
|
["path", {
|
|
442
460
|
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",
|
|
443
461
|
key: "uqj9uw"
|
|
@@ -450,7 +468,7 @@ var se = ["aria-hidden"], J = [
|
|
|
450
468
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
451
469
|
key: "ijwkga"
|
|
452
470
|
}]
|
|
453
|
-
]),
|
|
471
|
+
]), De = xe("volume-x", [
|
|
454
472
|
["path", {
|
|
455
473
|
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",
|
|
456
474
|
key: "uqj9uw"
|
|
@@ -469,32 +487,22 @@ var se = ["aria-hidden"], J = [
|
|
|
469
487
|
y2: "15",
|
|
470
488
|
key: "5ykzw1"
|
|
471
489
|
}]
|
|
472
|
-
]),
|
|
490
|
+
]), Oe = {
|
|
473
491
|
401: "Authentication required",
|
|
474
492
|
403: "Access forbidden",
|
|
475
493
|
404: "Preview not found",
|
|
476
494
|
419: "Session expired",
|
|
477
495
|
500: "Server error"
|
|
478
496
|
};
|
|
479
|
-
function
|
|
497
|
+
function ke(e) {
|
|
480
498
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
481
499
|
}
|
|
482
|
-
function
|
|
483
|
-
return
|
|
484
|
-
}
|
|
485
|
-
//#endregion
|
|
486
|
-
//#region src/core/mediaType.ts
|
|
487
|
-
var Oe = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
488
|
-
function ke(e) {
|
|
489
|
-
try {
|
|
490
|
-
return Oe.test(new URL(e).pathname);
|
|
491
|
-
} catch {
|
|
492
|
-
return Oe.test(e.split("?")[0] ?? e);
|
|
493
|
-
}
|
|
500
|
+
function Ae(e) {
|
|
501
|
+
return Oe[ke(e)] ?? "Preview unavailable";
|
|
494
502
|
}
|
|
495
503
|
//#endregion
|
|
496
504
|
//#region src/components/CardRegion.vue
|
|
497
|
-
var
|
|
505
|
+
var je = /* @__PURE__ */ d({
|
|
498
506
|
__name: "CardRegion",
|
|
499
507
|
props: {
|
|
500
508
|
index: {},
|
|
@@ -541,18 +549,18 @@ var Ae = /* @__PURE__ */ d({
|
|
|
541
549
|
"total"
|
|
542
550
|
]))], 38));
|
|
543
551
|
}
|
|
544
|
-
}),
|
|
552
|
+
}), Me = [
|
|
545
553
|
"max",
|
|
546
554
|
"value",
|
|
547
555
|
"aria-valuetext",
|
|
548
556
|
"disabled"
|
|
549
|
-
],
|
|
557
|
+
], Ne = {
|
|
550
558
|
key: 0,
|
|
551
559
|
class: "media-controls-row"
|
|
552
|
-
},
|
|
560
|
+
}, Pe = ["aria-label", "title"], Fe = { class: "media-controls-audio" }, Ie = ["aria-label", "title"], Le = ["value", "aria-valuetext"], Re = {
|
|
553
561
|
class: "media-control-time",
|
|
554
562
|
"aria-live": "off"
|
|
555
|
-
},
|
|
563
|
+
}, ze = /* @__PURE__ */ d({
|
|
556
564
|
__name: "MediaControls",
|
|
557
565
|
props: {
|
|
558
566
|
currentTime: {},
|
|
@@ -600,35 +608,35 @@ var Ae = /* @__PURE__ */ d({
|
|
|
600
608
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
601
609
|
disabled: f.value <= 0,
|
|
602
610
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
603
|
-
}, null, 44,
|
|
611
|
+
}, null, 44, Me), e.layout === "reel" ? (b(), s("div", Ne, [
|
|
604
612
|
c("button", {
|
|
605
613
|
type: "button",
|
|
606
614
|
class: "media-control-button media-control-playback",
|
|
607
615
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
608
616
|
title: e.playing ? "Pause" : "Play",
|
|
609
617
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
610
|
-
}, [e.playing ? (b(), a(E(
|
|
618
|
+
}, [e.playing ? (b(), a(E(we), {
|
|
611
619
|
key: 0,
|
|
612
620
|
size: 18,
|
|
613
621
|
fill: "currentColor"
|
|
614
|
-
})) : (b(), a(E(
|
|
622
|
+
})) : (b(), a(E(Te), {
|
|
615
623
|
key: 1,
|
|
616
624
|
size: 18,
|
|
617
625
|
fill: "currentColor"
|
|
618
|
-
}))], 8,
|
|
619
|
-
c("div",
|
|
626
|
+
}))], 8, Pe),
|
|
627
|
+
c("div", Fe, [c("button", {
|
|
620
628
|
type: "button",
|
|
621
629
|
class: "media-control-button",
|
|
622
630
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
623
631
|
title: e.muted ? "Unmute" : "Mute",
|
|
624
632
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
625
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
633
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(De), {
|
|
626
634
|
key: 0,
|
|
627
635
|
size: 18
|
|
628
|
-
})) : (b(), a(E(
|
|
636
|
+
})) : (b(), a(E(Ee), {
|
|
629
637
|
key: 1,
|
|
630
638
|
size: 18
|
|
631
|
-
}))], 8,
|
|
639
|
+
}))], 8, Ie), c("input", {
|
|
632
640
|
class: "media-control-range media-control-volume",
|
|
633
641
|
type: "range",
|
|
634
642
|
min: "0",
|
|
@@ -639,14 +647,14 @@ var Ae = /* @__PURE__ */ d({
|
|
|
639
647
|
"aria-label": "Video volume",
|
|
640
648
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
641
649
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
642
|
-
}, null, 44,
|
|
643
|
-
c("output",
|
|
650
|
+
}, null, 44, Le)]),
|
|
651
|
+
c("output", Re, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
644
652
|
])) : o("", !0)], 34));
|
|
645
653
|
}
|
|
646
654
|
});
|
|
647
655
|
//#endregion
|
|
648
656
|
//#region src/components/useReelVideoActivity.ts
|
|
649
|
-
function
|
|
657
|
+
function Be(e) {
|
|
650
658
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
651
659
|
function i() {
|
|
652
660
|
if (!t.value) {
|
|
@@ -679,8 +687,30 @@ function ze(e) {
|
|
|
679
687
|
};
|
|
680
688
|
}
|
|
681
689
|
//#endregion
|
|
690
|
+
//#region src/core/mediaType.ts
|
|
691
|
+
var Ve = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
692
|
+
function He(e) {
|
|
693
|
+
try {
|
|
694
|
+
return Ve.test(new URL(e).pathname);
|
|
695
|
+
} catch {
|
|
696
|
+
return Ve.test(e.split("?")[0] ?? e);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region src/components/useMediaLoading.ts
|
|
701
|
+
function Ue(e) {
|
|
702
|
+
let t = r(() => He(e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
|
|
703
|
+
return O(i, (t, n) => {
|
|
704
|
+
n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
|
|
705
|
+
}), {
|
|
706
|
+
imageLoading: n,
|
|
707
|
+
mediaIsTimed: t,
|
|
708
|
+
videoPreload: i
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
//#endregion
|
|
682
712
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
683
|
-
var
|
|
713
|
+
var We = [
|
|
684
714
|
"data-post-id",
|
|
685
715
|
"data-media-index",
|
|
686
716
|
"aria-hidden",
|
|
@@ -688,12 +718,12 @@ var Be = [
|
|
|
688
718
|
"inert",
|
|
689
719
|
"role",
|
|
690
720
|
"tabindex"
|
|
691
|
-
],
|
|
721
|
+
], Ge = { class: "media-card-content" }, Ke = ["data-media-direction"], qe = ["data-media-index"], Je = {
|
|
692
722
|
key: 0,
|
|
693
723
|
"data-test": "media-loading",
|
|
694
724
|
class: "media-loading",
|
|
695
725
|
"aria-hidden": "true"
|
|
696
|
-
},
|
|
726
|
+
}, Ye = ["aria-label"], Xe = { class: "media-error-code" }, Ze = [
|
|
697
727
|
"src",
|
|
698
728
|
"width",
|
|
699
729
|
"height",
|
|
@@ -701,12 +731,13 @@ var Be = [
|
|
|
701
731
|
"loop",
|
|
702
732
|
"muted",
|
|
703
733
|
"preload"
|
|
704
|
-
],
|
|
734
|
+
], Qe = [
|
|
705
735
|
"src",
|
|
706
736
|
"width",
|
|
707
737
|
"height",
|
|
708
|
-
"fetchpriority"
|
|
709
|
-
|
|
738
|
+
"fetchpriority",
|
|
739
|
+
"loading"
|
|
740
|
+
], $e = ["aria-label"], et = ["aria-label"], tt = ["aria-label"], nt = 40, rt = 160, it = 24, at = /* @__PURE__ */ d({
|
|
710
741
|
__name: "MediaCard",
|
|
711
742
|
props: {
|
|
712
743
|
active: { type: Boolean },
|
|
@@ -742,7 +773,7 @@ var Be = [
|
|
|
742
773
|
function S(e = !1, t = "pointer") {
|
|
743
774
|
e && x("activate", t);
|
|
744
775
|
}
|
|
745
|
-
let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1), U = w(1), W = 1, { effectiveMuted: G, onPlaying:
|
|
776
|
+
let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1), U = w(1), W = 1, { effectiveMuted: G, onPlaying: K, playbackAllowed: ee } = Be({
|
|
746
777
|
active: () => l.active,
|
|
747
778
|
layout: () => l.layout,
|
|
748
779
|
videoElement: R,
|
|
@@ -752,42 +783,47 @@ var Be = [
|
|
|
752
783
|
function te(e) {
|
|
753
784
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
754
785
|
}
|
|
755
|
-
function
|
|
786
|
+
function J(e, t) {
|
|
756
787
|
let n = C.value.length, r = (e + n) % n;
|
|
757
788
|
r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
758
789
|
}
|
|
759
|
-
function
|
|
790
|
+
function ne(e, t, n) {
|
|
760
791
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
761
792
|
}
|
|
762
|
-
function
|
|
793
|
+
function Y() {
|
|
763
794
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
764
795
|
}
|
|
765
|
-
function
|
|
766
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
796
|
+
function re() {
|
|
797
|
+
d !== null && clearTimeout(d), d = setTimeout(Y, rt);
|
|
767
798
|
}
|
|
768
|
-
function
|
|
799
|
+
function ie(e) {
|
|
769
800
|
if (C.value.length <= 1) return;
|
|
770
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
771
|
-
if (n === 0 || (e.preventDefault(),
|
|
801
|
+
let t = e.currentTarget?.clientWidth || 1, n = ne(e.deltaX, e.deltaMode, t);
|
|
802
|
+
if (n === 0 || (e.preventDefault(), re(), p) || (f += n, Math.abs(f) < it)) return;
|
|
772
803
|
let r = Math.sign(f);
|
|
773
|
-
f = 0, p = !0,
|
|
804
|
+
f = 0, p = !0, J(D.value + r);
|
|
774
805
|
}
|
|
775
|
-
function
|
|
806
|
+
function ae(e) {
|
|
776
807
|
let t = e.touches[0];
|
|
777
808
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
778
809
|
}
|
|
779
|
-
function
|
|
810
|
+
function oe(e) {
|
|
780
811
|
let t = e.changedTouches[0];
|
|
781
812
|
if (m === null || g === null || !t) return;
|
|
782
813
|
let n = m - t.clientX, r = g - t.clientY;
|
|
783
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
814
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < nt || J(D.value + Math.sign(n)));
|
|
784
815
|
}
|
|
785
|
-
let
|
|
786
|
-
|
|
787
|
-
|
|
816
|
+
let { imageLoading: se, mediaIsTimed: ce, videoPreload: le } = Ue({
|
|
817
|
+
fetchPriority: () => l.fetchPriority,
|
|
818
|
+
layout: () => l.layout,
|
|
819
|
+
mediaSource: () => F.value,
|
|
820
|
+
videoElement: R
|
|
821
|
+
}), ue = r(() => l.layout === "reel" && l.stationaryReelControls === !0), de = r(() => ce.value && l.previewState === "ready" && (!ue.value || !!(l.active && l.reelControlsTarget))), fe = r(() => `${l.item.postId}:${D.value}:${F.value}`);
|
|
822
|
+
function pe(e) {
|
|
823
|
+
l.layout === "reel" && (e.stopPropagation(), me());
|
|
788
824
|
}
|
|
789
|
-
async function
|
|
790
|
-
if (!(!R.value || !
|
|
825
|
+
async function me() {
|
|
826
|
+
if (!(!R.value || !ee.value)) {
|
|
791
827
|
if (H.value) {
|
|
792
828
|
R.value.pause();
|
|
793
829
|
return;
|
|
@@ -799,35 +835,35 @@ var Be = [
|
|
|
799
835
|
}
|
|
800
836
|
}
|
|
801
837
|
}
|
|
802
|
-
function
|
|
838
|
+
function he(e) {
|
|
803
839
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
804
840
|
}
|
|
805
841
|
function X(e) {
|
|
806
842
|
let t = e?.currentTarget ?? R.value;
|
|
807
|
-
t && (z.value =
|
|
843
|
+
t && (z.value = he(t.currentTime), B.value = he(t.duration), ee.value && (V.value = t.muted), U.value = t.volume, t.volume > 0 && (W = t.volume));
|
|
808
844
|
}
|
|
809
|
-
function
|
|
845
|
+
function ge(e) {
|
|
810
846
|
X(e), x("ready", D.value);
|
|
811
847
|
}
|
|
812
|
-
function
|
|
848
|
+
function _e() {
|
|
813
849
|
H.value = !1, x("ended", D.value);
|
|
814
850
|
}
|
|
815
|
-
function
|
|
851
|
+
function ve(e) {
|
|
816
852
|
let t = R.value;
|
|
817
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(
|
|
853
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(he(t.duration), Math.max(0, e)), z.value = t.currentTime);
|
|
818
854
|
}
|
|
819
|
-
function
|
|
855
|
+
function ye(e) {
|
|
820
856
|
let t = R.value;
|
|
821
857
|
if (!t || !Number.isFinite(e)) return;
|
|
822
858
|
let n = Math.min(1, Math.max(0, e));
|
|
823
859
|
t.volume = n, t.muted = n === 0, n > 0 && (W = n), X();
|
|
824
860
|
}
|
|
825
|
-
function
|
|
861
|
+
function be() {
|
|
826
862
|
let e = R.value;
|
|
827
863
|
e && (e.muted && e.volume === 0 && (e.volume = W), e.muted = !e.muted, X());
|
|
828
864
|
}
|
|
829
865
|
return v(() => {
|
|
830
|
-
|
|
866
|
+
Y();
|
|
831
867
|
}), (r, i) => (b(), s("article", {
|
|
832
868
|
"data-post-id": e.item.postId,
|
|
833
869
|
"data-media-index": D.value,
|
|
@@ -845,8 +881,8 @@ var Be = [
|
|
|
845
881
|
tabindex: e.interactive && !e.leaving && !q.value ? 0 : void 0,
|
|
846
882
|
onClick: i[11] ||= (t) => S(e.interactive && !q.value, te(t)),
|
|
847
883
|
onKeydown: [i[12] ||= A((t) => S(e.interactive && !q.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !q.value, "keyboard"), ["prevent"]), ["space"])]
|
|
848
|
-
}, [c("div",
|
|
849
|
-
e.cardHeader ? (b(), a(
|
|
884
|
+
}, [c("div", Ge, [
|
|
885
|
+
e.cardHeader ? (b(), a(je, {
|
|
850
886
|
key: 0,
|
|
851
887
|
index: e.index,
|
|
852
888
|
item: e.item,
|
|
@@ -872,22 +908,22 @@ var Be = [
|
|
|
872
908
|
c("div", {
|
|
873
909
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
874
910
|
"data-media-direction": y.value,
|
|
875
|
-
onWheel:
|
|
876
|
-
onTouchstartPassive:
|
|
877
|
-
onTouchendPassive:
|
|
911
|
+
onWheel: ie,
|
|
912
|
+
onTouchstartPassive: ae,
|
|
913
|
+
onTouchendPassive: oe
|
|
878
914
|
}, [
|
|
879
915
|
u(n, { name: `media-slide-${y.value}` }, {
|
|
880
916
|
default: k(() => [(b(), s("div", {
|
|
881
917
|
key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
|
|
882
918
|
class: "media-card-frame",
|
|
883
919
|
"data-media-index": D.value
|
|
884
|
-
}, [e.previewState === "loading" ? (b(), s("div",
|
|
920
|
+
}, [e.previewState === "loading" ? (b(), s("div", Je, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
|
|
885
921
|
key: 1,
|
|
886
922
|
"data-test": "media-error",
|
|
887
923
|
class: "media-error",
|
|
888
924
|
role: "img",
|
|
889
|
-
"aria-label": `${E(
|
|
890
|
-
}, [c("strong",
|
|
925
|
+
"aria-label": `${E(ke)(F.value)} ${E(Ae)(F.value)}`
|
|
926
|
+
}, [c("strong", Xe, T(E(ke)(F.value)), 1), c("span", null, T(E(Ae)(F.value)), 1)], 8, Ye)) : o("", !0), E(ce) ? (b(), s("video", {
|
|
891
927
|
key: 2,
|
|
892
928
|
ref_key: "videoElement",
|
|
893
929
|
ref: R,
|
|
@@ -898,21 +934,21 @@ var Be = [
|
|
|
898
934
|
src: F.value,
|
|
899
935
|
width: I.value ?? void 0,
|
|
900
936
|
height: L.value ?? void 0,
|
|
901
|
-
autoplay: E(
|
|
937
|
+
autoplay: E(ee),
|
|
902
938
|
loop: !e.advanceOnMediaEnd,
|
|
903
939
|
muted: E(G),
|
|
904
940
|
playsinline: "",
|
|
905
|
-
preload:
|
|
906
|
-
onLoadedmetadata:
|
|
941
|
+
preload: E(le),
|
|
942
|
+
onLoadedmetadata: ge,
|
|
907
943
|
onDurationchange: X,
|
|
908
944
|
onTimeupdate: X,
|
|
909
945
|
onVolumechange: X,
|
|
910
|
-
onPlaying: i[0] ||= (...e) => E(
|
|
946
|
+
onPlaying: i[0] ||= (...e) => E(K) && E(K)(...e),
|
|
911
947
|
onPause: i[1] ||= (e) => H.value = !1,
|
|
912
|
-
onEnded:
|
|
913
|
-
onClick:
|
|
948
|
+
onEnded: _e,
|
|
949
|
+
onClick: pe,
|
|
914
950
|
onError: i[2] ||= (e) => r.$emit("error", D.value)
|
|
915
|
-
}, null, 42,
|
|
951
|
+
}, null, 42, Ze)) : (b(), s("img", {
|
|
916
952
|
key: 3,
|
|
917
953
|
class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
|
|
918
954
|
src: F.value,
|
|
@@ -921,32 +957,32 @@ var Be = [
|
|
|
921
957
|
fetchpriority: e.fetchPriority,
|
|
922
958
|
alt: "",
|
|
923
959
|
decoding: "async",
|
|
924
|
-
loading:
|
|
960
|
+
loading: E(se),
|
|
925
961
|
onLoad: i[3] ||= (e) => r.$emit("ready", D.value),
|
|
926
962
|
onError: i[4] ||= (e) => r.$emit("error", D.value)
|
|
927
|
-
}, null, 42,
|
|
963
|
+
}, null, 42, Qe))], 8, qe))]),
|
|
928
964
|
_: 1
|
|
929
965
|
}, 8, ["name"]),
|
|
930
966
|
(b(), a(t, {
|
|
931
|
-
disabled: !
|
|
967
|
+
disabled: !ue.value || !e.reelControlsTarget,
|
|
932
968
|
to: e.reelControlsTarget ?? "body"
|
|
933
969
|
}, [u(n, {
|
|
934
970
|
name: "vibe-reel-media-controls",
|
|
935
|
-
css:
|
|
971
|
+
css: ue.value
|
|
936
972
|
}, {
|
|
937
|
-
default: k(() => [
|
|
938
|
-
key:
|
|
973
|
+
default: k(() => [de.value ? (b(), a(ze, {
|
|
974
|
+
key: fe.value,
|
|
939
975
|
"current-time": z.value,
|
|
940
|
-
"data-control-post-id":
|
|
976
|
+
"data-control-post-id": ue.value ? e.item.postId : void 0,
|
|
941
977
|
duration: B.value,
|
|
942
978
|
layout: e.layout,
|
|
943
979
|
muted: V.value,
|
|
944
980
|
playing: H.value,
|
|
945
981
|
volume: U.value,
|
|
946
|
-
onSeek:
|
|
947
|
-
onToggleMute:
|
|
948
|
-
onTogglePlayback:
|
|
949
|
-
onVolumeChange:
|
|
982
|
+
onSeek: ve,
|
|
983
|
+
onToggleMute: be,
|
|
984
|
+
onTogglePlayback: me,
|
|
985
|
+
onVolumeChange: ye
|
|
950
986
|
}, null, 8, [
|
|
951
987
|
"current-time",
|
|
952
988
|
"data-control-post-id",
|
|
@@ -966,15 +1002,15 @@ var Be = [
|
|
|
966
1002
|
type: "button",
|
|
967
1003
|
class: "media-carousel-control media-carousel-control--previous",
|
|
968
1004
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
969
|
-
onClick: i[5] ||= j((e) =>
|
|
1005
|
+
onClick: i[5] ||= j((e) => J(D.value - 1, e), ["stop"]),
|
|
970
1006
|
onKeydown: i[6] ||= j(() => {}, ["stop"])
|
|
971
|
-
}, [u(E(
|
|
1007
|
+
}, [u(E(Se), { size: 20 })], 40, $e), c("button", {
|
|
972
1008
|
type: "button",
|
|
973
1009
|
class: "media-carousel-control media-carousel-control--next",
|
|
974
1010
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
975
|
-
onClick: i[7] ||= j((e) =>
|
|
1011
|
+
onClick: i[7] ||= j((e) => J(D.value + 1, e), ["stop"]),
|
|
976
1012
|
onKeydown: i[8] ||= j(() => {}, ["stop"])
|
|
977
|
-
}, [u(E(
|
|
1013
|
+
}, [u(E(Ce), { size: 20 })], 40, et)], 2)) : o("", !0),
|
|
978
1014
|
q.value ? (b(), s("button", {
|
|
979
1015
|
key: 1,
|
|
980
1016
|
class: "media-card-activator",
|
|
@@ -982,9 +1018,9 @@ var Be = [
|
|
|
982
1018
|
"aria-label": `Open post ${e.item.postId}`,
|
|
983
1019
|
onClick: i[9] ||= j((e) => r.$emit("activate", te(e)), ["stop"]),
|
|
984
1020
|
onKeydown: i[10] ||= j(() => {}, ["stop"])
|
|
985
|
-
}, null, 40,
|
|
986
|
-
], 42,
|
|
987
|
-
e.cardFooter ? (b(), a(
|
|
1021
|
+
}, null, 40, tt)) : o("", !0)
|
|
1022
|
+
], 42, Ke),
|
|
1023
|
+
e.cardFooter ? (b(), a(je, {
|
|
988
1024
|
key: 1,
|
|
989
1025
|
index: e.index,
|
|
990
1026
|
item: e.item,
|
|
@@ -1007,18 +1043,19 @@ var Be = [
|
|
|
1007
1043
|
"style",
|
|
1008
1044
|
"total"
|
|
1009
1045
|
])) : o("", !0)
|
|
1010
|
-
])], 46,
|
|
1046
|
+
])], 46, We));
|
|
1011
1047
|
}
|
|
1012
|
-
}),
|
|
1048
|
+
}), ot = { class: "masonry-feed-shell" }, st = ["aria-hidden", "inert"], ct = {
|
|
1013
1049
|
key: 0,
|
|
1014
1050
|
class: "masonry-feed-status-overlay"
|
|
1015
|
-
},
|
|
1051
|
+
}, lt = 240, ut = 6, dt = 12, ft = /* @__PURE__ */ d({
|
|
1016
1052
|
__name: "MasonryFeed",
|
|
1017
1053
|
props: {
|
|
1018
1054
|
enteringPostIds: {},
|
|
1019
1055
|
entryDelays: {},
|
|
1020
1056
|
leavingPostIds: { default: () => /* @__PURE__ */ new Set() },
|
|
1021
1057
|
removalDelays: { default: () => /* @__PURE__ */ new Map() },
|
|
1058
|
+
masonry: {},
|
|
1022
1059
|
suspended: { type: Boolean },
|
|
1023
1060
|
canRetryEnd: { type: Boolean },
|
|
1024
1061
|
cardFooter: {},
|
|
@@ -1047,17 +1084,17 @@ var Be = [
|
|
|
1047
1084
|
"visible"
|
|
1048
1085
|
],
|
|
1049
1086
|
setup(t, { expose: n, emit: i }) {
|
|
1050
|
-
let l = t, d = i, f = w(null), p = `vibe-masonry-${D()}`, m = w(null), g = w(0), y = w(
|
|
1087
|
+
let l = t, d = i, f = w(null), p = `vibe-masonry-${D()}`, m = w(null), g = w(0), y = w(ut), x = w(0), C = w(0), T = w(0), k = null, A = null, j = null, M = r(() => re(l.items, g.value, {
|
|
1051
1088
|
additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
|
|
1052
1089
|
gap: y.value,
|
|
1053
|
-
minColumnWidth:
|
|
1090
|
+
minColumnWidth: lt
|
|
1054
1091
|
})), N = r(() => {
|
|
1055
1092
|
let e = M.value;
|
|
1056
1093
|
if (l.leavingPostIds.size === 0) return e;
|
|
1057
|
-
let t = l.items.filter((e) => !l.leavingPostIds.has(e.postId)), n =
|
|
1094
|
+
let t = l.items.filter((e) => !l.leavingPostIds.has(e.postId)), n = re(t, g.value, {
|
|
1058
1095
|
additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
|
|
1059
1096
|
gap: y.value,
|
|
1060
|
-
minColumnWidth:
|
|
1097
|
+
minColumnWidth: lt
|
|
1061
1098
|
}), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
|
|
1062
1099
|
return {
|
|
1063
1100
|
...n,
|
|
@@ -1068,22 +1105,22 @@ var Be = [
|
|
|
1068
1105
|
let e = {
|
|
1069
1106
|
scrollTop: x.value - T.value,
|
|
1070
1107
|
viewportHeight: C.value
|
|
1071
|
-
}, t =
|
|
1108
|
+
}, t = Y(N.value.items, {
|
|
1072
1109
|
...e,
|
|
1073
1110
|
overscan: 0
|
|
1074
|
-
}), n = l.leavingPostIds.size === 0 ? [] :
|
|
1111
|
+
}), n = l.leavingPostIds.size === 0 ? [] : Y(M.value.items, {
|
|
1075
1112
|
...e,
|
|
1076
1113
|
overscan: 0
|
|
1077
1114
|
});
|
|
1078
1115
|
return new Set([...t, ...n]);
|
|
1079
1116
|
}), R = r(() => {
|
|
1080
|
-
let e =
|
|
1117
|
+
let e = ie(l.masonry, C.value), t = {
|
|
1081
1118
|
scrollTop: x.value - T.value,
|
|
1082
1119
|
viewportHeight: C.value
|
|
1083
|
-
}, n =
|
|
1120
|
+
}, n = Y(N.value.items, {
|
|
1084
1121
|
...t,
|
|
1085
1122
|
overscan: e
|
|
1086
|
-
}), r = l.leavingPostIds.size === 0 ? [] :
|
|
1123
|
+
}), r = l.leavingPostIds.size === 0 ? [] : Y(M.value.items, {
|
|
1087
1124
|
...t,
|
|
1088
1125
|
overscan: e
|
|
1089
1126
|
});
|
|
@@ -1137,17 +1174,17 @@ var Be = [
|
|
|
1137
1174
|
}
|
|
1138
1175
|
function H(e) {
|
|
1139
1176
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1140
|
-
g.value = e.clientWidth, y.value = Math.min(
|
|
1177
|
+
g.value = e.clientWidth, y.value = Math.min(dt, Math.max(ut, t * .0075)), V();
|
|
1141
1178
|
}
|
|
1142
|
-
function
|
|
1179
|
+
function U(e) {
|
|
1143
1180
|
let t = e.currentTarget;
|
|
1144
|
-
t && (x.value = t.scrollTop, !l.loadMoreLocked && l.infiniteScroll &&
|
|
1181
|
+
t && (x.value = t.scrollTop, !l.loadMoreLocked && l.infiniteScroll && q(t) && d("loadMore"));
|
|
1145
1182
|
}
|
|
1146
1183
|
function G() {
|
|
1147
1184
|
let e = f.value;
|
|
1148
|
-
!l.loadMoreLocked && e &&
|
|
1185
|
+
!l.loadMoreLocked && e && q(e) && d("loadMore");
|
|
1149
1186
|
}
|
|
1150
|
-
function
|
|
1187
|
+
function K() {
|
|
1151
1188
|
return f.value;
|
|
1152
1189
|
}
|
|
1153
1190
|
return O(m, (e) => {
|
|
@@ -1162,9 +1199,9 @@ var Be = [
|
|
|
1162
1199
|
}), v(() => {
|
|
1163
1200
|
k?.disconnect(), A?.disconnect(), j !== null && cancelAnimationFrame(j);
|
|
1164
1201
|
}), n({
|
|
1165
|
-
getScrollElement:
|
|
1202
|
+
getScrollElement: K,
|
|
1166
1203
|
loadIfNearBottom: G
|
|
1167
|
-
}), (n, r) => (b(), s("div",
|
|
1204
|
+
}), (n, r) => (b(), s("div", ot, [
|
|
1168
1205
|
c("main", {
|
|
1169
1206
|
id: p,
|
|
1170
1207
|
ref_key: "galleryElement",
|
|
@@ -1173,14 +1210,14 @@ var Be = [
|
|
|
1173
1210
|
"data-layout-mode": "masonry",
|
|
1174
1211
|
"aria-hidden": t.suspended || void 0,
|
|
1175
1212
|
inert: t.suspended || void 0,
|
|
1176
|
-
onScrollPassive:
|
|
1213
|
+
onScrollPassive: U
|
|
1177
1214
|
}, [c("section", {
|
|
1178
1215
|
ref_key: "masonryElement",
|
|
1179
1216
|
ref: m,
|
|
1180
1217
|
class: h(["masonry", { "masonry--ready": g.value > 0 }]),
|
|
1181
1218
|
style: _(P.value),
|
|
1182
1219
|
"aria-label": "Media gallery"
|
|
1183
|
-
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1220
|
+
}, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(at, {
|
|
1184
1221
|
key: n.postId,
|
|
1185
1222
|
class: "masonry-item",
|
|
1186
1223
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1220,8 +1257,8 @@ var Be = [
|
|
|
1220
1257
|
"onMediaChange",
|
|
1221
1258
|
"onReady",
|
|
1222
1259
|
"onError"
|
|
1223
|
-
]))), 128))], 6)], 42,
|
|
1224
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && I.value || !t.hasNext && t.canRetryEnd ? (b(), s("div",
|
|
1260
|
+
]))), 128))], 6)], 42, st),
|
|
1261
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && I.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", ct, [u(W, {
|
|
1225
1262
|
actions: t.feedFooterActions,
|
|
1226
1263
|
"can-retry-end": t.canRetryEnd,
|
|
1227
1264
|
"feed-footer": t.feedFooter,
|
|
@@ -1244,7 +1281,7 @@ var Be = [
|
|
|
1244
1281
|
"show-load-more",
|
|
1245
1282
|
"state"
|
|
1246
1283
|
])])) : o("", !0),
|
|
1247
|
-
u(
|
|
1284
|
+
u(pe, {
|
|
1248
1285
|
"content-size": N.value.height,
|
|
1249
1286
|
"controls-id": p,
|
|
1250
1287
|
"scroll-element": f.value,
|
|
@@ -1256,8 +1293,8 @@ var Be = [
|
|
|
1256
1293
|
])
|
|
1257
1294
|
]));
|
|
1258
1295
|
}
|
|
1259
|
-
}),
|
|
1260
|
-
function
|
|
1296
|
+
}), pt = 300;
|
|
1297
|
+
function mt(e, t, n) {
|
|
1261
1298
|
let r = e.scrollTop;
|
|
1262
1299
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1263
1300
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1265,7 +1302,7 @@ function ft(e, t, n) {
|
|
|
1265
1302
|
return new Promise((n) => {
|
|
1266
1303
|
let o = (s) => {
|
|
1267
1304
|
a += 1;
|
|
1268
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1305
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / pt), u = 1 - (1 - l) ** 3;
|
|
1269
1306
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1270
1307
|
requestAnimationFrame(o);
|
|
1271
1308
|
return;
|
|
@@ -1277,7 +1314,7 @@ function ft(e, t, n) {
|
|
|
1277
1314
|
}
|
|
1278
1315
|
//#endregion
|
|
1279
1316
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1280
|
-
var
|
|
1317
|
+
var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
1281
1318
|
__name: "ReelAutoAdvanceProgress",
|
|
1282
1319
|
props: {
|
|
1283
1320
|
durationMs: {},
|
|
@@ -1295,9 +1332,9 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1295
1332
|
class: "reel-auto-advance-progress",
|
|
1296
1333
|
style: _(a.value),
|
|
1297
1334
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1298
|
-
}, null, 36)], 8,
|
|
1335
|
+
}, null, 36)], 8, ht));
|
|
1299
1336
|
}
|
|
1300
|
-
}),
|
|
1337
|
+
}), _t = { class: "reel-viewport" }, vt = ["data-active-post-id", "data-active-media-index"], yt = ["role", "data-status"], bt = 2, xt = 300, St = /* @__PURE__ */ d({
|
|
1301
1338
|
__name: "ReelFeed",
|
|
1302
1339
|
props: {
|
|
1303
1340
|
initialPostId: {},
|
|
@@ -1335,7 +1372,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1335
1372
|
],
|
|
1336
1373
|
setup(t, { expose: n, emit: i }) {
|
|
1337
1374
|
let l = t, u = i, d = w(null), f = w(null), p = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId), g = w(Math.max(0, p)), x = w(!1), C = w(!1), D = 0, k = null, A = null, j = null, N = r(() => ({ gridTemplateRows: `repeat(${l.items.length}, 100cqh)` })), I = r(() => {
|
|
1338
|
-
let e = Math.max(0, g.value -
|
|
1375
|
+
let e = Math.max(0, g.value - bt), t = Math.min(l.items.length - 1, g.value + bt);
|
|
1339
1376
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1340
1377
|
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1341
1378
|
index: e + n,
|
|
@@ -1352,7 +1389,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1352
1389
|
if (!e) return "";
|
|
1353
1390
|
let t = P(e, z.value);
|
|
1354
1391
|
return l.mediaSource === "original" ? t.src : t.preview.src;
|
|
1355
|
-
}), H = r(() => B.value === "ready" &&
|
|
1392
|
+
}), H = r(() => B.value === "ready" && He(V.value)), U = r(() => [
|
|
1356
1393
|
L.value,
|
|
1357
1394
|
z.value,
|
|
1358
1395
|
l.items.length,
|
|
@@ -1363,46 +1400,46 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1363
1400
|
].join(":")), G = r(() => {
|
|
1364
1401
|
let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1365
1402
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1366
|
-
}),
|
|
1367
|
-
function
|
|
1403
|
+
}), K = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value), ee = r(() => !l.infiniteScroll || l.items.length <= 1), te = r(() => l.reelForward.status === "loading" ? "Loading the next media…" : l.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
|
|
1404
|
+
function J(e) {
|
|
1368
1405
|
return { gridRow: `${e + 1}` };
|
|
1369
1406
|
}
|
|
1370
|
-
function
|
|
1407
|
+
function ne(e) {
|
|
1371
1408
|
let t = D || e.clientHeight;
|
|
1372
1409
|
return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1373
1410
|
}
|
|
1374
|
-
function
|
|
1411
|
+
function Y(e) {
|
|
1375
1412
|
let t = e.currentTarget;
|
|
1376
1413
|
if (!t) return;
|
|
1377
1414
|
let n = D || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
|
|
1378
|
-
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value =
|
|
1415
|
+
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = ne(t)), !l.loadMoreLocked && l.infiniteScroll && q(t) && u("loadMore");
|
|
1379
1416
|
}
|
|
1380
|
-
function
|
|
1417
|
+
function re() {
|
|
1381
1418
|
let e = d.value;
|
|
1382
|
-
e && (x.value = !1,
|
|
1419
|
+
e && (x.value = !1, oe(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
|
|
1383
1420
|
e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
|
|
1384
|
-
}),
|
|
1421
|
+
}), ie());
|
|
1385
1422
|
}
|
|
1386
|
-
function
|
|
1423
|
+
function ie() {
|
|
1387
1424
|
j !== null && clearTimeout(j), j = setTimeout(() => {
|
|
1388
1425
|
j = null;
|
|
1389
1426
|
let e = d.value;
|
|
1390
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1427
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), oe(!1);
|
|
1391
1428
|
}, 120);
|
|
1392
1429
|
}
|
|
1393
|
-
function
|
|
1394
|
-
|
|
1430
|
+
function ae() {
|
|
1431
|
+
oe(!0);
|
|
1395
1432
|
let e = d.value;
|
|
1396
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1433
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), ie();
|
|
1397
1434
|
}
|
|
1398
|
-
function
|
|
1435
|
+
function oe(e) {
|
|
1399
1436
|
C.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1400
1437
|
}
|
|
1401
|
-
function
|
|
1438
|
+
function se() {
|
|
1402
1439
|
let e = d.value;
|
|
1403
|
-
!l.loadMoreLocked && e &&
|
|
1440
|
+
!l.loadMoreLocked && e && q(e) && u("loadMore");
|
|
1404
1441
|
}
|
|
1405
|
-
function
|
|
1442
|
+
function ce(e) {
|
|
1406
1443
|
let t = R.value;
|
|
1407
1444
|
if (!t) return !1;
|
|
1408
1445
|
let n = M(t).length;
|
|
@@ -1425,19 +1462,19 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1425
1462
|
let t = d.value;
|
|
1426
1463
|
if (!t) return Promise.resolve();
|
|
1427
1464
|
let n = e * (D || t.clientHeight);
|
|
1428
|
-
return g.value = e,
|
|
1465
|
+
return g.value = e, mt(t, n, de());
|
|
1429
1466
|
}
|
|
1430
1467
|
function pe(e) {
|
|
1431
1468
|
fe(e);
|
|
1432
1469
|
}
|
|
1433
|
-
async function
|
|
1470
|
+
async function me(e) {
|
|
1434
1471
|
let t = l.items.findIndex((t) => t.postId === e);
|
|
1435
1472
|
return t < 0 || t === g.value ? !1 : (await fe(t), !0);
|
|
1436
1473
|
}
|
|
1437
|
-
async function
|
|
1438
|
-
return
|
|
1474
|
+
async function he(e) {
|
|
1475
|
+
return ce(e) ? (de() || await new Promise((e) => setTimeout(e, xt)), !0) : !1;
|
|
1439
1476
|
}
|
|
1440
|
-
function
|
|
1477
|
+
function X() {
|
|
1441
1478
|
if (!l.reelAutoAdvance.enabled) return;
|
|
1442
1479
|
let e = R.value;
|
|
1443
1480
|
if (!e) return;
|
|
@@ -1453,28 +1490,28 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1453
1490
|
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), pe(t);
|
|
1454
1491
|
}
|
|
1455
1492
|
function ge(e, t) {
|
|
1456
|
-
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value ||
|
|
1493
|
+
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || X();
|
|
1457
1494
|
}
|
|
1458
1495
|
return O(d, (e) => {
|
|
1459
|
-
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(
|
|
1496
|
+
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(re), k.observe(e)));
|
|
1460
1497
|
}), O(() => l.items.length, async (e) => {
|
|
1461
1498
|
let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1462
|
-
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(),
|
|
1499
|
+
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), re();
|
|
1463
1500
|
}), O(L, (e) => {
|
|
1464
1501
|
e !== void 0 && u("activeChange", e);
|
|
1465
1502
|
}, { immediate: !0 }), y(() => {
|
|
1466
|
-
window.addEventListener("resize",
|
|
1503
|
+
window.addEventListener("resize", ae), window.addEventListener("orientationchange", ae), p >= 0 && m(re);
|
|
1467
1504
|
}), v(() => {
|
|
1468
|
-
window.removeEventListener("resize",
|
|
1505
|
+
window.removeEventListener("resize", ae), window.removeEventListener("orientationchange", ae), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
|
|
1469
1506
|
}), n({
|
|
1470
1507
|
activeIndex: g,
|
|
1471
1508
|
activePostId: L,
|
|
1472
|
-
changeActiveMedia:
|
|
1473
|
-
loadIfNearBottom:
|
|
1509
|
+
changeActiveMedia: ce,
|
|
1510
|
+
loadIfNearBottom: se,
|
|
1474
1511
|
moveActivePost: le,
|
|
1475
1512
|
navigateToItem: ue,
|
|
1476
|
-
transitionActiveMedia:
|
|
1477
|
-
transitionActivePost:
|
|
1513
|
+
transitionActiveMedia: he,
|
|
1514
|
+
transitionActivePost: me
|
|
1478
1515
|
}), (n, r) => (b(), s("main", {
|
|
1479
1516
|
class: h(["reel-shell", {
|
|
1480
1517
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1482,7 +1519,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1482
1519
|
}]),
|
|
1483
1520
|
"data-layout-mode": "reel"
|
|
1484
1521
|
}, [
|
|
1485
|
-
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1522
|
+
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
|
|
1486
1523
|
key: 0,
|
|
1487
1524
|
index: g.value,
|
|
1488
1525
|
item: R.value,
|
|
@@ -1504,19 +1541,19 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1504
1541
|
"style",
|
|
1505
1542
|
"total"
|
|
1506
1543
|
])) : o("", !0),
|
|
1507
|
-
c("div",
|
|
1544
|
+
c("div", _t, [c("div", {
|
|
1508
1545
|
ref_key: "galleryElement",
|
|
1509
1546
|
ref: d,
|
|
1510
1547
|
class: "gallery-shell reel-feed",
|
|
1511
1548
|
"data-active-post-id": L.value,
|
|
1512
1549
|
"data-active-media-index": z.value,
|
|
1513
|
-
onScrollPassive:
|
|
1550
|
+
onScrollPassive: Y
|
|
1514
1551
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1515
1552
|
key: 1,
|
|
1516
1553
|
class: "reel-track",
|
|
1517
1554
|
style: _(N.value),
|
|
1518
1555
|
"aria-label": "Media gallery"
|
|
1519
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1556
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(at, {
|
|
1520
1557
|
key: n.postId,
|
|
1521
1558
|
active: r === g.value && !x.value,
|
|
1522
1559
|
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
@@ -1525,7 +1562,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1525
1562
|
"fetch-priority": e,
|
|
1526
1563
|
index: r,
|
|
1527
1564
|
item: n,
|
|
1528
|
-
"item-style":
|
|
1565
|
+
"item-style": J(r),
|
|
1529
1566
|
"media-card": t.mediaCard,
|
|
1530
1567
|
layout: "reel",
|
|
1531
1568
|
"loaded-count": t.items.length,
|
|
@@ -1567,7 +1604,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1567
1604
|
class: "reel-forward-retry",
|
|
1568
1605
|
type: "button",
|
|
1569
1606
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1570
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1607
|
+
}, " Retry ")) : o("", !0)], 8, yt)), t.reelForward.status === "idle" ? (b(), a(W, {
|
|
1571
1608
|
key: 2,
|
|
1572
1609
|
actions: t.feedFooterActions,
|
|
1573
1610
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1576,7 +1613,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1576
1613
|
"has-next": t.hasNext,
|
|
1577
1614
|
"is-loading": t.isLoadingMore,
|
|
1578
1615
|
"load-more-locked": t.loadMoreLocked,
|
|
1579
|
-
"show-load-more":
|
|
1616
|
+
"show-load-more": ee.value,
|
|
1580
1617
|
state: t.state,
|
|
1581
1618
|
onLoadMore: r[1] ||= (e) => u("loadMore"),
|
|
1582
1619
|
onRetryEnd: r[2] ||= (e) => u("retryEnd")
|
|
@@ -1590,13 +1627,13 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1590
1627
|
"load-more-locked",
|
|
1591
1628
|
"show-load-more",
|
|
1592
1629
|
"state"
|
|
1593
|
-
])) : o("", !0)], 40,
|
|
1630
|
+
])) : o("", !0)], 40, vt), c("div", {
|
|
1594
1631
|
ref_key: "reelControlsElement",
|
|
1595
1632
|
ref: f,
|
|
1596
1633
|
class: "reel-media-controls-host",
|
|
1597
1634
|
"data-test": "reel-media-controls-host"
|
|
1598
1635
|
}, null, 512)]),
|
|
1599
|
-
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1636
|
+
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
|
|
1600
1637
|
key: 1,
|
|
1601
1638
|
index: g.value,
|
|
1602
1639
|
item: R.value,
|
|
@@ -1618,24 +1655,24 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1618
1655
|
"style",
|
|
1619
1656
|
"total"
|
|
1620
1657
|
])) : o("", !0),
|
|
1621
|
-
|
|
1622
|
-
key:
|
|
1658
|
+
K.value ? (b(), a(gt, {
|
|
1659
|
+
key: U.value,
|
|
1623
1660
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1624
1661
|
label: G.value,
|
|
1625
|
-
onComplete:
|
|
1662
|
+
onComplete: X
|
|
1626
1663
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1627
1664
|
], 2));
|
|
1628
1665
|
}
|
|
1629
|
-
}),
|
|
1666
|
+
}), Ct = ["data-info-sheet-open", "data-info-sheet-mode"], wt = ["aria-hidden", "inert"], Tt = {
|
|
1630
1667
|
key: 0,
|
|
1631
1668
|
class: "reel-info-sheet-layer",
|
|
1632
1669
|
"data-test": "reel-info-sheet"
|
|
1633
|
-
},
|
|
1670
|
+
}, Et = [
|
|
1634
1671
|
"role",
|
|
1635
1672
|
"aria-modal",
|
|
1636
1673
|
"tabindex",
|
|
1637
1674
|
"data-active-post-id"
|
|
1638
|
-
],
|
|
1675
|
+
], Dt = /* @__PURE__ */ d({
|
|
1639
1676
|
__name: "ReelLayout",
|
|
1640
1677
|
props: {
|
|
1641
1678
|
forwardIndex: { default: null },
|
|
@@ -1760,7 +1797,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1760
1797
|
class: "reel-layout-main",
|
|
1761
1798
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1762
1799
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1763
|
-
}, [u(
|
|
1800
|
+
}, [u(St, {
|
|
1764
1801
|
ref_key: "reelFeed",
|
|
1765
1802
|
ref: p,
|
|
1766
1803
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1811,8 +1848,8 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1811
1848
|
"reel-forward",
|
|
1812
1849
|
"state",
|
|
1813
1850
|
"total"
|
|
1814
|
-
])], 8,
|
|
1815
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
1851
|
+
])], 8, wt), u(n, { name: "vibe-info-sheet" }, {
|
|
1852
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Tt, [c("aside", {
|
|
1816
1853
|
ref_key: "sheetElement",
|
|
1817
1854
|
ref: _,
|
|
1818
1855
|
class: "reel-info-sheet",
|
|
@@ -1821,14 +1858,14 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1821
1858
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1822
1859
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1823
1860
|
"data-active-post-id": T.value?.postId
|
|
1824
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
1861
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Et)])) : o("", !0)]),
|
|
1825
1862
|
_: 1
|
|
1826
|
-
})], 10,
|
|
1863
|
+
})], 10, Ct));
|
|
1827
1864
|
}
|
|
1828
1865
|
});
|
|
1829
1866
|
//#endregion
|
|
1830
1867
|
//#region src/core/mediaLifecycle.ts
|
|
1831
|
-
function
|
|
1868
|
+
function Ot(e, t, n, r, i) {
|
|
1832
1869
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
1833
1870
|
if (!o) return null;
|
|
1834
1871
|
let s = N(o, n), c = P(o, s);
|
|
@@ -1844,7 +1881,7 @@ function Et(e, t, n, r, i) {
|
|
|
1844
1881
|
postIndex: a
|
|
1845
1882
|
};
|
|
1846
1883
|
}
|
|
1847
|
-
function
|
|
1884
|
+
function kt(e, t) {
|
|
1848
1885
|
O(() => {
|
|
1849
1886
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
1850
1887
|
return {
|
|
@@ -1854,20 +1891,20 @@ function Dt(e, t) {
|
|
|
1854
1891
|
};
|
|
1855
1892
|
}, (n, r) => {
|
|
1856
1893
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
1857
|
-
let i =
|
|
1894
|
+
let i = Ot(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
1858
1895
|
i && t(i);
|
|
1859
1896
|
}, { flush: "sync" });
|
|
1860
1897
|
}
|
|
1861
1898
|
//#endregion
|
|
1862
1899
|
//#region src/components/useMediaLifecycle.ts
|
|
1863
|
-
function
|
|
1900
|
+
function At(e, t) {
|
|
1864
1901
|
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = r(() => e.reelMediaSource === "original" ? i.value : n.value);
|
|
1865
1902
|
function o(e, t, n, r) {
|
|
1866
1903
|
let i = F(t, n);
|
|
1867
1904
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
1868
1905
|
}
|
|
1869
1906
|
function s(t, n, r, i) {
|
|
1870
|
-
return
|
|
1907
|
+
return Ot(e, t, n, r, i);
|
|
1871
1908
|
}
|
|
1872
1909
|
function c(e, n, r, i) {
|
|
1873
1910
|
let a = s(e, n, r, i);
|
|
@@ -1889,7 +1926,7 @@ function Ot(e, t) {
|
|
|
1889
1926
|
let r = s(e, n, "masonry", null);
|
|
1890
1927
|
r && t.visible(r);
|
|
1891
1928
|
}
|
|
1892
|
-
return
|
|
1929
|
+
return kt(e, t.reelChange), O(() => {
|
|
1893
1930
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
1894
1931
|
return {
|
|
1895
1932
|
mediaIndex: n,
|
|
@@ -1914,16 +1951,16 @@ function Ot(e, t) {
|
|
|
1914
1951
|
}
|
|
1915
1952
|
//#endregion
|
|
1916
1953
|
//#region src/core/reelEscapeStack.ts
|
|
1917
|
-
var
|
|
1918
|
-
function
|
|
1919
|
-
return
|
|
1920
|
-
let t =
|
|
1921
|
-
t >= 0 &&
|
|
1954
|
+
var jt = [];
|
|
1955
|
+
function Mt(e) {
|
|
1956
|
+
return jt.push(e), () => {
|
|
1957
|
+
let t = jt.indexOf(e);
|
|
1958
|
+
t >= 0 && jt.splice(t, 1);
|
|
1922
1959
|
};
|
|
1923
1960
|
}
|
|
1924
|
-
function
|
|
1961
|
+
function Nt(e) {
|
|
1925
1962
|
if (!e.isActive()) return !1;
|
|
1926
|
-
let t =
|
|
1963
|
+
let t = jt.filter((e) => e.isActive()), n = e.element();
|
|
1927
1964
|
return n !== null && t.some((t) => {
|
|
1928
1965
|
if (t === e) return !1;
|
|
1929
1966
|
let r = t.element();
|
|
@@ -1939,14 +1976,14 @@ function jt(e) {
|
|
|
1939
1976
|
}
|
|
1940
1977
|
//#endregion
|
|
1941
1978
|
//#region src/components/useReelKeyboard.ts
|
|
1942
|
-
function
|
|
1979
|
+
function Pt(e) {
|
|
1943
1980
|
let t = {
|
|
1944
1981
|
element: e.element,
|
|
1945
1982
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
1946
1983
|
}, n = null;
|
|
1947
1984
|
function r(n) {
|
|
1948
1985
|
let r = t.isActive();
|
|
1949
|
-
if (n.key === "Escape" && r && !
|
|
1986
|
+
if (n.key === "Escape" && r && !Nt(t)) return;
|
|
1950
1987
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
1951
1988
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
1952
1989
|
return;
|
|
@@ -1966,14 +2003,14 @@ function Mt(e) {
|
|
|
1966
2003
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
1967
2004
|
}
|
|
1968
2005
|
y(() => {
|
|
1969
|
-
n =
|
|
2006
|
+
n = Mt(t), window.addEventListener("keydown", r);
|
|
1970
2007
|
}), v(() => {
|
|
1971
2008
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
1972
2009
|
});
|
|
1973
2010
|
}
|
|
1974
2011
|
//#endregion
|
|
1975
2012
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
1976
|
-
var
|
|
2013
|
+
var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
1977
2014
|
__name: "VibeSurface",
|
|
1978
2015
|
props: {
|
|
1979
2016
|
canRetryEnd: { type: Boolean },
|
|
@@ -1982,6 +2019,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
1982
2019
|
feedFooter: {},
|
|
1983
2020
|
feedFooterActions: {},
|
|
1984
2021
|
mediaCard: {},
|
|
2022
|
+
masonry: {},
|
|
1985
2023
|
reelInfoSheet: {},
|
|
1986
2024
|
state: {}
|
|
1987
2025
|
},
|
|
@@ -1998,22 +2036,22 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
1998
2036
|
"retryForward"
|
|
1999
2037
|
],
|
|
2000
2038
|
setup(t, { expose: i, emit: c }) {
|
|
2001
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() =>
|
|
2039
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => L(l.state, A.value)), { markMasonryVisible: P, markPreviewError: F, markPreviewReady: I, markReelError: R, markReelReady: z, originalStates: B, previewStates: V, reelStates: H } = At(l.state, {
|
|
2002
2040
|
ready: (e) => d("mediaReady", e),
|
|
2003
2041
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2004
2042
|
visible: (e) => d("mediaVisible", e)
|
|
2005
|
-
}),
|
|
2006
|
-
function
|
|
2043
|
+
}), U = new Set(l.state.items.map((e) => e.postId)), W = null, G = null, K = !1;
|
|
2044
|
+
function q() {
|
|
2007
2045
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2008
2046
|
}
|
|
2009
|
-
function
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2047
|
+
function te() {
|
|
2048
|
+
W !== null && cancelAnimationFrame(W), W = requestAnimationFrame(() => {
|
|
2049
|
+
W = requestAnimationFrame(() => {
|
|
2050
|
+
W = null, S.value = /* @__PURE__ */ new Set();
|
|
2013
2051
|
});
|
|
2014
2052
|
});
|
|
2015
2053
|
}
|
|
2016
|
-
function
|
|
2054
|
+
function J(e, t) {
|
|
2017
2055
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2018
2056
|
if (!n) return;
|
|
2019
2057
|
let r = N(n, t);
|
|
@@ -2022,46 +2060,46 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2022
2060
|
async function ne() {
|
|
2023
2061
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2024
2062
|
}
|
|
2025
|
-
function
|
|
2063
|
+
function Y(e) {
|
|
2026
2064
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2027
2065
|
}
|
|
2028
|
-
function
|
|
2066
|
+
function re(e) {
|
|
2029
2067
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2030
2068
|
}
|
|
2031
|
-
function
|
|
2069
|
+
function ie(e) {
|
|
2032
2070
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
2033
2071
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
2034
2072
|
if (!t) return "not-found";
|
|
2035
2073
|
let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
2036
2074
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
2037
2075
|
}
|
|
2038
|
-
function
|
|
2076
|
+
function ae() {
|
|
2039
2077
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2040
2078
|
}
|
|
2041
|
-
function
|
|
2042
|
-
|
|
2079
|
+
function oe(e, t) {
|
|
2080
|
+
G = e, K = t === "keyboard", y.value = ue(e), d("openReel", e), m(() => h.value?.focus());
|
|
2043
2081
|
}
|
|
2044
|
-
function
|
|
2082
|
+
function se(e) {
|
|
2045
2083
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2046
2084
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2047
2085
|
}
|
|
2048
2086
|
function ce(e) {
|
|
2049
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
2050
|
-
let t = [...new Set(e)], n = t.filter(
|
|
2087
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || q()) return 0;
|
|
2088
|
+
let t = [...new Set(e)], n = t.filter(se);
|
|
2051
2089
|
if (n.length === 0) return 0;
|
|
2052
2090
|
let r = new Map(D.value);
|
|
2053
2091
|
return n.forEach((e, t) => {
|
|
2054
|
-
r.set(e, t *
|
|
2055
|
-
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), D.value = r,
|
|
2092
|
+
r.set(e, t * Ft);
|
|
2093
|
+
}), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), D.value = r, It + (n.length - 1) * Ft;
|
|
2056
2094
|
}
|
|
2057
|
-
function
|
|
2058
|
-
let n =
|
|
2095
|
+
function le(e, t) {
|
|
2096
|
+
let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2059
2097
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2060
2098
|
r.classList.remove("media-card-focus-silent");
|
|
2061
2099
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2062
2100
|
}
|
|
2063
|
-
function
|
|
2064
|
-
let t = g.value, n =
|
|
2101
|
+
function ue(e) {
|
|
2102
|
+
let t = g.value, n = se(e);
|
|
2065
2103
|
if (t === null || n === null) return {};
|
|
2066
2104
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2067
2105
|
return {
|
|
@@ -2071,40 +2109,40 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2071
2109
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2072
2110
|
};
|
|
2073
2111
|
}
|
|
2074
|
-
function ue() {
|
|
2075
|
-
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2076
|
-
}
|
|
2077
2112
|
function de() {
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2113
|
+
l.state.reelOrigin === "masonry" && (G ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2114
|
+
}
|
|
2115
|
+
function fe() {
|
|
2116
|
+
let e = G, t = K;
|
|
2117
|
+
x.value = !1, G = null, K = !1, y.value = {}, m(() => {
|
|
2118
|
+
e !== null && le(e, t);
|
|
2081
2119
|
});
|
|
2082
2120
|
}
|
|
2083
|
-
return
|
|
2084
|
-
closeMasonryReel:
|
|
2121
|
+
return Pt({
|
|
2122
|
+
closeMasonryReel: de,
|
|
2085
2123
|
element: () => g.value,
|
|
2086
2124
|
isReelLeaving: () => x.value,
|
|
2087
2125
|
reelRenderer: () => p.value,
|
|
2088
2126
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2089
2127
|
state: l.state
|
|
2090
2128
|
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2091
|
-
let t = e.filter((e) => !
|
|
2092
|
-
if (
|
|
2129
|
+
let t = e.filter((e) => !U.has(e)), n = new Set(e);
|
|
2130
|
+
if (U = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || q()) return;
|
|
2093
2131
|
let r = /* @__PURE__ */ new Map();
|
|
2094
2132
|
e.forEach((e) => {
|
|
2095
2133
|
let t = C.value.get(e);
|
|
2096
2134
|
t !== void 0 && r.set(e, t);
|
|
2097
2135
|
}), t.forEach((e, t) => {
|
|
2098
|
-
r.set(e, t *
|
|
2099
|
-
}), C.value = r, S.value = new Set([...S.value, ...t]),
|
|
2136
|
+
r.set(e, t * Ft);
|
|
2137
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), te();
|
|
2100
2138
|
}, { flush: "sync" }), v(() => {
|
|
2101
|
-
|
|
2139
|
+
W !== null && cancelAnimationFrame(W);
|
|
2102
2140
|
}), i({
|
|
2103
|
-
changeActiveReelMedia:
|
|
2104
|
-
getAutoScrollElement:
|
|
2141
|
+
changeActiveReelMedia: Y,
|
|
2142
|
+
getAutoScrollElement: ae,
|
|
2105
2143
|
loadIfNearBottom: ne,
|
|
2106
|
-
moveActiveReelPost:
|
|
2107
|
-
navigateToReelItem:
|
|
2144
|
+
moveActiveReelPost: re,
|
|
2145
|
+
navigateToReelItem: ie,
|
|
2108
2146
|
startItemRemoval: ce,
|
|
2109
2147
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2110
2148
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
@@ -2112,7 +2150,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2112
2150
|
ref_key: "surfaceElement",
|
|
2113
2151
|
ref: g,
|
|
2114
2152
|
class: "vibe-surface"
|
|
2115
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2153
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Dt, {
|
|
2116
2154
|
key: 0,
|
|
2117
2155
|
ref_key: "reelRenderer",
|
|
2118
2156
|
ref: p,
|
|
@@ -2137,17 +2175,17 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2137
2175
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2138
2176
|
"next-page-error": !!t.state.nextPageError,
|
|
2139
2177
|
origin: "reel",
|
|
2140
|
-
"preview-states": E(
|
|
2178
|
+
"preview-states": E(H),
|
|
2141
2179
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2142
2180
|
"reel-forward": t.state.reelForward,
|
|
2143
|
-
state:
|
|
2181
|
+
state: j.value,
|
|
2144
2182
|
total: t.state.total,
|
|
2145
2183
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
2146
2184
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2147
|
-
onError: E(
|
|
2185
|
+
onError: E(R),
|
|
2148
2186
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2149
|
-
onMediaChange:
|
|
2150
|
-
onReady: E(
|
|
2187
|
+
onMediaChange: J,
|
|
2188
|
+
onReady: E(z),
|
|
2151
2189
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2152
2190
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
2153
2191
|
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(ee, {
|
|
@@ -2155,7 +2193,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2155
2193
|
actions: t.feedFooterActions,
|
|
2156
2194
|
"can-retry-end": t.canRetryEnd,
|
|
2157
2195
|
"feed-footer": t.feedFooter,
|
|
2158
|
-
state:
|
|
2196
|
+
state: j.value,
|
|
2159
2197
|
onLoadMore: i[5] ||= (e) => d("loadMore"),
|
|
2160
2198
|
onRetryEnd: i[6] ||= (e) => d("retryEnd")
|
|
2161
2199
|
}, null, 8, [
|
|
@@ -2163,7 +2201,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2163
2201
|
"can-retry-end",
|
|
2164
2202
|
"feed-footer",
|
|
2165
2203
|
"state"
|
|
2166
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2204
|
+
])) : (b(), s(e, { key: 2 }, [u(ft, {
|
|
2167
2205
|
ref_key: "masonryRenderer",
|
|
2168
2206
|
ref: f,
|
|
2169
2207
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2176,6 +2214,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2176
2214
|
"feed-footer": t.feedFooter,
|
|
2177
2215
|
"feed-footer-actions": t.feedFooterActions,
|
|
2178
2216
|
"media-card": t.mediaCard,
|
|
2217
|
+
masonry: t.masonry,
|
|
2179
2218
|
"has-next": t.state.next !== null,
|
|
2180
2219
|
"infinite-scroll": t.state.infiniteScroll,
|
|
2181
2220
|
"is-loading-more": t.state.isLoadingMore,
|
|
@@ -2183,17 +2222,17 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2183
2222
|
"load-more-locked": t.state.loadMoreLocked,
|
|
2184
2223
|
"media-indices": t.state.mediaIndices,
|
|
2185
2224
|
"next-page-error": !!t.state.nextPageError,
|
|
2186
|
-
"preview-states": E(
|
|
2225
|
+
"preview-states": E(V),
|
|
2187
2226
|
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2188
|
-
state:
|
|
2227
|
+
state: j.value,
|
|
2189
2228
|
total: t.state.total,
|
|
2190
|
-
onActivate:
|
|
2191
|
-
onError: E(
|
|
2229
|
+
onActivate: oe,
|
|
2230
|
+
onError: E(F),
|
|
2192
2231
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2193
|
-
onMediaChange:
|
|
2194
|
-
onReady: E(
|
|
2232
|
+
onMediaChange: J,
|
|
2233
|
+
onReady: E(I),
|
|
2195
2234
|
onRetryEnd: i[8] ||= (e) => d("retryEnd"),
|
|
2196
|
-
onVisible: E(
|
|
2235
|
+
onVisible: E(P)
|
|
2197
2236
|
}, null, 8, [
|
|
2198
2237
|
"can-retry-end",
|
|
2199
2238
|
"entering-post-ids",
|
|
@@ -2205,6 +2244,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2205
2244
|
"feed-footer",
|
|
2206
2245
|
"feed-footer-actions",
|
|
2207
2246
|
"media-card",
|
|
2247
|
+
"masonry",
|
|
2208
2248
|
"has-next",
|
|
2209
2249
|
"infinite-scroll",
|
|
2210
2250
|
"is-loading-more",
|
|
@@ -2221,7 +2261,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2221
2261
|
"onVisible"
|
|
2222
2262
|
]), u(n, {
|
|
2223
2263
|
name: "vibe-reel-viewer",
|
|
2224
|
-
onAfterLeave:
|
|
2264
|
+
onAfterLeave: fe
|
|
2225
2265
|
}, {
|
|
2226
2266
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2227
2267
|
key: 0,
|
|
@@ -2233,7 +2273,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2233
2273
|
"aria-modal": "true",
|
|
2234
2274
|
tabindex: "-1",
|
|
2235
2275
|
style: _(y.value)
|
|
2236
|
-
}, [u(
|
|
2276
|
+
}, [u(Dt, {
|
|
2237
2277
|
ref_key: "reelRenderer",
|
|
2238
2278
|
ref: p,
|
|
2239
2279
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2257,17 +2297,17 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2257
2297
|
"media-source": "original",
|
|
2258
2298
|
"next-page-error": !!t.state.nextPageError,
|
|
2259
2299
|
origin: "masonry",
|
|
2260
|
-
"preview-states": E(
|
|
2300
|
+
"preview-states": E(B),
|
|
2261
2301
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2262
2302
|
"reel-forward": t.state.reelForward,
|
|
2263
|
-
state:
|
|
2303
|
+
state: j.value,
|
|
2264
2304
|
total: t.state.total,
|
|
2265
2305
|
onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
|
|
2266
2306
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2267
|
-
onError: E(
|
|
2307
|
+
onError: E(R),
|
|
2268
2308
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2269
|
-
onMediaChange:
|
|
2270
|
-
onReady: E(
|
|
2309
|
+
onMediaChange: J,
|
|
2310
|
+
onReady: E(z),
|
|
2271
2311
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2272
2312
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
2273
2313
|
}, null, 8, /* @__PURE__ */ "can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))], 4)) : o("", !0)]),
|
|
@@ -2277,7 +2317,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2277
2317
|
});
|
|
2278
2318
|
//#endregion
|
|
2279
2319
|
//#region src/core/page.ts
|
|
2280
|
-
function
|
|
2320
|
+
function Rt(e) {
|
|
2281
2321
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2282
2322
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2283
2323
|
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.");
|
|
@@ -2289,32 +2329,32 @@ function Z(e, t) {
|
|
|
2289
2329
|
}
|
|
2290
2330
|
//#endregion
|
|
2291
2331
|
//#region src/core/requestDelay.ts
|
|
2292
|
-
var
|
|
2332
|
+
var zt = 2e3, Bt = 1e4, Vt = 250, Ht = {
|
|
2293
2333
|
delayRemainingMs: null,
|
|
2294
2334
|
nextRequestAt: null
|
|
2295
2335
|
};
|
|
2296
|
-
function
|
|
2336
|
+
function Ut(e, t) {
|
|
2297
2337
|
return e === void 0 ? t : Math.floor(e);
|
|
2298
2338
|
}
|
|
2299
|
-
function
|
|
2339
|
+
function Wt(e, t) {
|
|
2300
2340
|
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.`);
|
|
2301
2341
|
}
|
|
2302
|
-
function
|
|
2303
|
-
let n =
|
|
2342
|
+
function Gt(e, t = {}) {
|
|
2343
|
+
let n = Ut(t.delayStepMs, zt), r = Ut(t.delayMaxMs, Bt);
|
|
2304
2344
|
return Math.min(Math.max(0, e) * n, r);
|
|
2305
2345
|
}
|
|
2306
2346
|
function Q(e) {
|
|
2307
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2347
|
+
if (e == null || !Number.isFinite(e)) return { ...Ht };
|
|
2308
2348
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2309
2349
|
return t > 0 ? {
|
|
2310
2350
|
delayRemainingMs: t,
|
|
2311
2351
|
nextRequestAt: e
|
|
2312
|
-
} : { ...
|
|
2352
|
+
} : { ...Ht };
|
|
2313
2353
|
}
|
|
2314
|
-
async function
|
|
2354
|
+
async function Kt({ delayMs: e, onChange: t, signal: n }) {
|
|
2315
2355
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2316
2356
|
if (e <= 0) {
|
|
2317
|
-
t({ ...
|
|
2357
|
+
t({ ...Ht });
|
|
2318
2358
|
return;
|
|
2319
2359
|
}
|
|
2320
2360
|
let r = Date.now() + e;
|
|
@@ -2322,9 +2362,9 @@ async function Wt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2322
2362
|
delayRemainingMs: e,
|
|
2323
2363
|
nextRequestAt: r
|
|
2324
2364
|
}), await new Promise((i, a) => {
|
|
2325
|
-
let o = !1, s = setInterval(f,
|
|
2365
|
+
let o = !1, s = setInterval(f, Vt), c = setTimeout(() => u(), e);
|
|
2326
2366
|
function l() {
|
|
2327
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2367
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Ht });
|
|
2328
2368
|
}
|
|
2329
2369
|
function u(e) {
|
|
2330
2370
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2339,13 +2379,13 @@ async function Wt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2339
2379
|
n.addEventListener("abort", d, { once: !0 });
|
|
2340
2380
|
});
|
|
2341
2381
|
}
|
|
2342
|
-
var
|
|
2382
|
+
var qt = class {
|
|
2343
2383
|
interval = null;
|
|
2344
2384
|
constructor(e) {
|
|
2345
2385
|
this.onChange = e;
|
|
2346
2386
|
}
|
|
2347
2387
|
clear() {
|
|
2348
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2388
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Ht });
|
|
2349
2389
|
}
|
|
2350
2390
|
sync(e) {
|
|
2351
2391
|
this.clear();
|
|
@@ -2353,22 +2393,22 @@ var Gt = class {
|
|
|
2353
2393
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2354
2394
|
let t = Q(e);
|
|
2355
2395
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2356
|
-
},
|
|
2396
|
+
}, Vt));
|
|
2357
2397
|
}
|
|
2358
2398
|
};
|
|
2359
|
-
function
|
|
2399
|
+
function Jt(e, t = !0) {
|
|
2360
2400
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2361
2401
|
}
|
|
2362
|
-
function
|
|
2402
|
+
function Yt(e) {
|
|
2363
2403
|
return `${typeof e}:${String(e)}`;
|
|
2364
2404
|
}
|
|
2365
|
-
function
|
|
2405
|
+
function Xt(e, t) {
|
|
2366
2406
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2367
2407
|
}
|
|
2368
|
-
function
|
|
2408
|
+
function Zt(e) {
|
|
2369
2409
|
if (!e) return;
|
|
2370
|
-
if (
|
|
2371
|
-
|
|
2410
|
+
if (Xt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2411
|
+
Wt(e, "frontend autofill");
|
|
2372
2412
|
let t = e.maxAdditionalPages;
|
|
2373
2413
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2374
2414
|
return;
|
|
@@ -2380,7 +2420,7 @@ function Yt(e) {
|
|
|
2380
2420
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2381
2421
|
}
|
|
2382
2422
|
}
|
|
2383
|
-
function
|
|
2423
|
+
function Qt(e, t, n = !0) {
|
|
2384
2424
|
if (!e) return {
|
|
2385
2425
|
cycleId: null,
|
|
2386
2426
|
delayRemainingMs: null,
|
|
@@ -2414,7 +2454,7 @@ function Xt(e, t, n = !0) {
|
|
|
2414
2454
|
strategy: e.strategy
|
|
2415
2455
|
};
|
|
2416
2456
|
}
|
|
2417
|
-
function
|
|
2457
|
+
function $t(e) {
|
|
2418
2458
|
return [
|
|
2419
2459
|
"cancelling",
|
|
2420
2460
|
"filling",
|
|
@@ -2422,9 +2462,9 @@ function Zt(e) {
|
|
|
2422
2462
|
"waiting"
|
|
2423
2463
|
].includes(e.status);
|
|
2424
2464
|
}
|
|
2425
|
-
async function
|
|
2465
|
+
async function en(e, t, n) {
|
|
2426
2466
|
let r = t.autofill;
|
|
2427
|
-
if (
|
|
2467
|
+
if (!$t(r) || !r.cycleId) return;
|
|
2428
2468
|
let i = {
|
|
2429
2469
|
cycleId: r.cycleId,
|
|
2430
2470
|
feedKey: r.feedKey ?? "",
|
|
@@ -2437,16 +2477,16 @@ async function Qt(e, t, n) {
|
|
|
2437
2477
|
throw r.error = e, r.status = "error", e;
|
|
2438
2478
|
}
|
|
2439
2479
|
}
|
|
2440
|
-
function
|
|
2480
|
+
function tn(e, t, n) {
|
|
2441
2481
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2442
2482
|
}
|
|
2443
|
-
async function
|
|
2444
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2483
|
+
async function nn({ 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 }) {
|
|
2484
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Jt(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2445
2485
|
for (; y < h;) {
|
|
2446
|
-
let e =
|
|
2486
|
+
let e = Yt(g);
|
|
2447
2487
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2448
|
-
if (m.add(e), await
|
|
2449
|
-
delayMs:
|
|
2488
|
+
if (m.add(e), await Kt({
|
|
2489
|
+
delayMs: Gt(l + y, s),
|
|
2450
2490
|
onChange: a,
|
|
2451
2491
|
signal: d
|
|
2452
2492
|
}), y > 0 && u()) return {
|
|
@@ -2460,7 +2500,7 @@ async function en({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2460
2500
|
status: "paused",
|
|
2461
2501
|
total: x
|
|
2462
2502
|
};
|
|
2463
|
-
let t =
|
|
2503
|
+
let t = Rt(await n({
|
|
2464
2504
|
cursor: g,
|
|
2465
2505
|
signal: d
|
|
2466
2506
|
}));
|
|
@@ -2517,12 +2557,12 @@ async function en({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2517
2557
|
}
|
|
2518
2558
|
//#endregion
|
|
2519
2559
|
//#region src/core/autofillController.ts
|
|
2520
|
-
var
|
|
2560
|
+
var rn = class {
|
|
2521
2561
|
collection = null;
|
|
2522
2562
|
cycle = 0;
|
|
2523
2563
|
delayCountdown;
|
|
2524
2564
|
constructor(e) {
|
|
2525
|
-
this.context = e, this.delayCountdown = new
|
|
2565
|
+
this.context = e, this.delayCountdown = new qt((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2526
2566
|
}
|
|
2527
2567
|
beginCycle() {
|
|
2528
2568
|
let { options: e, state: t } = this.context;
|
|
@@ -2530,14 +2570,14 @@ var tn = class {
|
|
|
2530
2570
|
this.clear();
|
|
2531
2571
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2532
2572
|
return t.autofill = {
|
|
2533
|
-
...
|
|
2573
|
+
...Qt(e, void 0, !1),
|
|
2534
2574
|
cycleId: n,
|
|
2535
2575
|
status: "filling"
|
|
2536
2576
|
}, n;
|
|
2537
2577
|
}
|
|
2538
2578
|
async cancel() {
|
|
2539
2579
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2540
|
-
await
|
|
2580
|
+
await en(t, n, e), this.commitCollection();
|
|
2541
2581
|
}
|
|
2542
2582
|
captureCollection(e, t) {
|
|
2543
2583
|
t && (this.collection = e);
|
|
@@ -2565,30 +2605,30 @@ var tn = class {
|
|
|
2565
2605
|
requests: r.requests
|
|
2566
2606
|
}));
|
|
2567
2607
|
}
|
|
2568
|
-
},
|
|
2569
|
-
function
|
|
2608
|
+
}, an = 100;
|
|
2609
|
+
function on(e, t) {
|
|
2570
2610
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2571
2611
|
}
|
|
2572
|
-
function
|
|
2612
|
+
function sn(e, t, n) {
|
|
2573
2613
|
return Math.min(n, Math.max(t, e));
|
|
2574
2614
|
}
|
|
2575
|
-
function
|
|
2615
|
+
function cn(e) {
|
|
2576
2616
|
if (!e) return;
|
|
2577
2617
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2578
|
-
if (
|
|
2579
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2618
|
+
if (on("autoScroll.minSpeedPxPerSecond", t), on("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2619
|
+
e.speedPxPerSecond !== void 0 && on("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2580
2620
|
}
|
|
2581
|
-
function
|
|
2621
|
+
function ln(e) {
|
|
2582
2622
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2583
2623
|
return {
|
|
2584
2624
|
enabled: e?.enabled ?? !1,
|
|
2585
2625
|
maxSpeedPxPerSecond: n,
|
|
2586
2626
|
minSpeedPxPerSecond: t,
|
|
2587
2627
|
paused: !1,
|
|
2588
|
-
speedPxPerSecond:
|
|
2628
|
+
speedPxPerSecond: sn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2589
2629
|
};
|
|
2590
2630
|
}
|
|
2591
|
-
var
|
|
2631
|
+
var un = class {
|
|
2592
2632
|
frame = null;
|
|
2593
2633
|
lastTimestamp = null;
|
|
2594
2634
|
mounted = !1;
|
|
@@ -2608,9 +2648,9 @@ var cn = class {
|
|
|
2608
2648
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2609
2649
|
}
|
|
2610
2650
|
setSpeed(e) {
|
|
2611
|
-
|
|
2651
|
+
on("auto-scroll speed", e);
|
|
2612
2652
|
let t = this.options.state;
|
|
2613
|
-
t.speedPxPerSecond =
|
|
2653
|
+
t.speedPxPerSecond = sn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2614
2654
|
}
|
|
2615
2655
|
tick = (e) => {
|
|
2616
2656
|
this.frame = null;
|
|
@@ -2622,7 +2662,7 @@ var cn = class {
|
|
|
2622
2662
|
return;
|
|
2623
2663
|
}
|
|
2624
2664
|
if (this.lastTimestamp !== null) {
|
|
2625
|
-
let r = Math.min(
|
|
2665
|
+
let r = Math.min(an, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2626
2666
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2627
2667
|
}
|
|
2628
2668
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2636,7 +2676,7 @@ var cn = class {
|
|
|
2636
2676
|
};
|
|
2637
2677
|
//#endregion
|
|
2638
2678
|
//#region src/core/backendAutofill.ts
|
|
2639
|
-
async function
|
|
2679
|
+
async function dn(e, t, n, r) {
|
|
2640
2680
|
let i = await e.onUnderfilled(n);
|
|
2641
2681
|
if (!r()) return;
|
|
2642
2682
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2650,19 +2690,19 @@ async function ln(e, t, n, r) {
|
|
|
2650
2690
|
status: "waiting"
|
|
2651
2691
|
});
|
|
2652
2692
|
}
|
|
2653
|
-
function
|
|
2693
|
+
function fn(e, t) {
|
|
2654
2694
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = Z(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
2655
2695
|
}
|
|
2656
|
-
function
|
|
2696
|
+
function pn(e, t, n) {
|
|
2657
2697
|
let r = t.autofill;
|
|
2658
|
-
return
|
|
2698
|
+
return !tn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (fn(t, n), Object.assign(r, Q(n.status === "waiting" ? n.nextRequestAt : null)), r.error = n.error ?? null, r.missing = Math.max(0, (r.pageSize ?? 0) - n.received), r.received = n.received, n.requests !== void 0 && (r.requests = n.requests), r.sequence = n.sequence, r.status = n.status, !0);
|
|
2659
2699
|
}
|
|
2660
|
-
function
|
|
2661
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2700
|
+
function mn(e, t, n) {
|
|
2701
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Qt(e, n), fn(t, n), !0);
|
|
2662
2702
|
}
|
|
2663
2703
|
//#endregion
|
|
2664
2704
|
//#region src/core/initialAutofill.ts
|
|
2665
|
-
async function
|
|
2705
|
+
async function hn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2666
2706
|
let c = a.autofill;
|
|
2667
2707
|
if (!c) return;
|
|
2668
2708
|
let l = s.items.length;
|
|
@@ -2675,7 +2715,7 @@ async function pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2675
2715
|
return;
|
|
2676
2716
|
}
|
|
2677
2717
|
if (c.strategy === "backend") {
|
|
2678
|
-
await
|
|
2718
|
+
await dn(c, s, {
|
|
2679
2719
|
cycleId: e,
|
|
2680
2720
|
feedKey: c.feedKey,
|
|
2681
2721
|
items: [...s.items],
|
|
@@ -2692,11 +2732,11 @@ async function pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2692
2732
|
s.autofill.status = "exhausted";
|
|
2693
2733
|
return;
|
|
2694
2734
|
}
|
|
2695
|
-
let u = await
|
|
2735
|
+
let u = await nn({
|
|
2696
2736
|
existingItems: s.items,
|
|
2697
2737
|
initialCursor: s.next,
|
|
2698
2738
|
loadPage: a.loadPage,
|
|
2699
|
-
maximumRequests:
|
|
2739
|
+
maximumRequests: Jt(c, !1),
|
|
2700
2740
|
onCollection: n,
|
|
2701
2741
|
onDelayChange: (e) => {
|
|
2702
2742
|
t() && Object.assign(s.autofill, e);
|
|
@@ -2719,13 +2759,13 @@ async function pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2719
2759
|
}
|
|
2720
2760
|
//#endregion
|
|
2721
2761
|
//#region src/core/fill.ts
|
|
2722
|
-
function
|
|
2762
|
+
function gn(e) {
|
|
2723
2763
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2724
2764
|
}
|
|
2725
|
-
function
|
|
2765
|
+
function _n(e) {
|
|
2726
2766
|
return `${typeof e}:${String(e)}`;
|
|
2727
2767
|
}
|
|
2728
|
-
function
|
|
2768
|
+
function vn(e) {
|
|
2729
2769
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2730
2770
|
if ("pages" in e) {
|
|
2731
2771
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2734,20 +2774,20 @@ function gn(e) {
|
|
|
2734
2774
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2735
2775
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2736
2776
|
}
|
|
2737
|
-
function
|
|
2777
|
+
function yn(e) {
|
|
2738
2778
|
if (!e) return;
|
|
2739
2779
|
if (e.strategy === "frontend") {
|
|
2740
|
-
|
|
2780
|
+
Wt(e, "frontend fill");
|
|
2741
2781
|
return;
|
|
2742
2782
|
}
|
|
2743
2783
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2744
2784
|
let t = e.initialSession;
|
|
2745
2785
|
if (t) {
|
|
2746
2786
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2747
|
-
|
|
2787
|
+
vn(t.target);
|
|
2748
2788
|
}
|
|
2749
2789
|
}
|
|
2750
|
-
function
|
|
2790
|
+
function bn(e, t, n = !0) {
|
|
2751
2791
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
|
|
2752
2792
|
return {
|
|
2753
2793
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2761,10 +2801,10 @@ function vn(e, t, n = !0) {
|
|
|
2761
2801
|
sessionId: i?.sessionId ?? null,
|
|
2762
2802
|
status: i?.status ?? "idle",
|
|
2763
2803
|
strategy: e?.strategy ?? null,
|
|
2764
|
-
target: i ?
|
|
2804
|
+
target: i ? gn(i.target) : null
|
|
2765
2805
|
};
|
|
2766
2806
|
}
|
|
2767
|
-
function
|
|
2807
|
+
function xn(e) {
|
|
2768
2808
|
return [
|
|
2769
2809
|
"cancelling",
|
|
2770
2810
|
"filling",
|
|
@@ -2772,13 +2812,13 @@ function yn(e) {
|
|
|
2772
2812
|
"waiting"
|
|
2773
2813
|
].includes(e.status);
|
|
2774
2814
|
}
|
|
2775
|
-
async function
|
|
2815
|
+
async function Sn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
2776
2816
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
2777
2817
|
for (; _ !== null;) {
|
|
2778
|
-
let e =
|
|
2818
|
+
let e = _n(h);
|
|
2779
2819
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2780
|
-
if (p.add(e), await
|
|
2781
|
-
delayMs:
|
|
2820
|
+
if (p.add(e), await Kt({
|
|
2821
|
+
delayMs: Gt(m, o),
|
|
2782
2822
|
onChange: i,
|
|
2783
2823
|
signal: c
|
|
2784
2824
|
}), m > 0 && s()) return {
|
|
@@ -2791,7 +2831,7 @@ async function bn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
2791
2831
|
status: "paused",
|
|
2792
2832
|
total: y
|
|
2793
2833
|
};
|
|
2794
|
-
let t =
|
|
2834
|
+
let t = Rt(await n({
|
|
2795
2835
|
cursor: h,
|
|
2796
2836
|
signal: c
|
|
2797
2837
|
}));
|
|
@@ -2859,7 +2899,7 @@ async function bn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
2859
2899
|
}
|
|
2860
2900
|
//#endregion
|
|
2861
2901
|
//#region src/core/backendFill.ts
|
|
2862
|
-
async function
|
|
2902
|
+
async function Cn(e, t, n, r) {
|
|
2863
2903
|
let i = await e.onStart(n);
|
|
2864
2904
|
if (r()) {
|
|
2865
2905
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2873,22 +2913,22 @@ async function xn(e, t, n, r) {
|
|
|
2873
2913
|
});
|
|
2874
2914
|
}
|
|
2875
2915
|
}
|
|
2876
|
-
function
|
|
2916
|
+
function wn(e, t, n) {
|
|
2877
2917
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2878
2918
|
}
|
|
2879
|
-
function
|
|
2919
|
+
function Tn(e) {
|
|
2880
2920
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2881
2921
|
}
|
|
2882
|
-
function
|
|
2922
|
+
function En(e, t) {
|
|
2883
2923
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2884
2924
|
let n = e.fill.target;
|
|
2885
2925
|
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;
|
|
2886
2926
|
}
|
|
2887
|
-
function
|
|
2927
|
+
function Dn(e, t, n) {
|
|
2888
2928
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Z(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
2889
2929
|
}
|
|
2890
|
-
function
|
|
2891
|
-
return !
|
|
2930
|
+
function On(e, t, n, r) {
|
|
2931
|
+
return !wn(e, t, n) || !Tn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !En(t, n) ? !1 : (Dn(t, n, r), Object.assign(t.fill, {
|
|
2892
2932
|
...Q(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2893
2933
|
completedPages: n.completedPages,
|
|
2894
2934
|
error: n.error ?? null,
|
|
@@ -2897,42 +2937,42 @@ function En(e, t, n, r) {
|
|
|
2897
2937
|
status: n.status
|
|
2898
2938
|
}), !0);
|
|
2899
2939
|
}
|
|
2900
|
-
function
|
|
2940
|
+
function kn(e, t, n, r) {
|
|
2901
2941
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2902
2942
|
let i = t.fill;
|
|
2903
|
-
return t.fill =
|
|
2943
|
+
return t.fill = bn(e, n), !Tn(n) || !En(t, n) ? (t.fill = i, !1) : (Dn(t, n, r), !0);
|
|
2904
2944
|
}
|
|
2905
2945
|
//#endregion
|
|
2906
2946
|
//#region src/core/fillController.ts
|
|
2907
|
-
var
|
|
2947
|
+
var An = class {
|
|
2908
2948
|
abortController = null;
|
|
2909
2949
|
cycle = 0;
|
|
2910
2950
|
delayCountdown;
|
|
2911
2951
|
requestVersion = 0;
|
|
2912
2952
|
collection = null;
|
|
2913
2953
|
constructor(e) {
|
|
2914
|
-
this.options = e, this.delayCountdown = new
|
|
2954
|
+
this.options = e, this.delayCountdown = new qt((e) => {
|
|
2915
2955
|
Object.assign(this.options.state.fill, e);
|
|
2916
2956
|
}), this.syncBackendCountdown();
|
|
2917
2957
|
}
|
|
2918
2958
|
isActive() {
|
|
2919
|
-
return
|
|
2959
|
+
return xn(this.options.state.fill);
|
|
2920
2960
|
}
|
|
2921
2961
|
applyUpdate(e) {
|
|
2922
|
-
let t =
|
|
2962
|
+
let t = On(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2923
2963
|
return t && this.syncBackendCountdown(), t;
|
|
2924
2964
|
}
|
|
2925
2965
|
restoreSession(e) {
|
|
2926
|
-
let t =
|
|
2966
|
+
let t = kn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2927
2967
|
return t && this.syncBackendCountdown(), t;
|
|
2928
2968
|
}
|
|
2929
2969
|
async start(e) {
|
|
2930
2970
|
let t = this.options.fill;
|
|
2931
2971
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2932
2972
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2933
|
-
let n =
|
|
2973
|
+
let n = vn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2934
2974
|
if (this.options.state.fill = {
|
|
2935
|
-
...
|
|
2975
|
+
...bn(t, void 0, !1),
|
|
2936
2976
|
cycleId: r,
|
|
2937
2977
|
status: "filling",
|
|
2938
2978
|
target: n
|
|
@@ -2943,7 +2983,7 @@ var On = class {
|
|
|
2943
2983
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2944
2984
|
this.abortController = a;
|
|
2945
2985
|
try {
|
|
2946
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
2986
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await Cn(t, this.options.state, {
|
|
2947
2987
|
cycleId: r,
|
|
2948
2988
|
feedKey: t.feedKey,
|
|
2949
2989
|
items: [...this.options.state.items],
|
|
@@ -2961,7 +3001,7 @@ var On = class {
|
|
|
2961
3001
|
}
|
|
2962
3002
|
async cancel() {
|
|
2963
3003
|
let { fill: e, state: t } = this.options;
|
|
2964
|
-
if (!
|
|
3004
|
+
if (!xn(t.fill) || !t.fill.cycleId) return;
|
|
2965
3005
|
let n = {
|
|
2966
3006
|
cycleId: t.fill.cycleId,
|
|
2967
3007
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -2975,7 +3015,7 @@ var On = class {
|
|
|
2975
3015
|
}
|
|
2976
3016
|
}
|
|
2977
3017
|
reset() {
|
|
2978
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3018
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = bn(this.options.fill, void 0, !1), this.collection = null;
|
|
2979
3019
|
}
|
|
2980
3020
|
destroy() {
|
|
2981
3021
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2991,7 +3031,7 @@ var On = class {
|
|
|
2991
3031
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2992
3032
|
let a = this.options.state;
|
|
2993
3033
|
a.isLoadingMore = !0;
|
|
2994
|
-
let o = await
|
|
3034
|
+
let o = await Sn({
|
|
2995
3035
|
existingItems: a.items,
|
|
2996
3036
|
initialCursor: a.next,
|
|
2997
3037
|
loadPage: i,
|
|
@@ -3031,7 +3071,7 @@ var On = class {
|
|
|
3031
3071
|
};
|
|
3032
3072
|
//#endregion
|
|
3033
3073
|
//#region src/core/feedFooter.ts
|
|
3034
|
-
function
|
|
3074
|
+
function jn(e) {
|
|
3035
3075
|
return {
|
|
3036
3076
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3037
3077
|
loadMore: () => e.loadNext(),
|
|
@@ -3039,45 +3079,45 @@ function kn(e) {
|
|
|
3039
3079
|
retryEnd: () => e.retryEnd()
|
|
3040
3080
|
};
|
|
3041
3081
|
}
|
|
3042
|
-
function
|
|
3082
|
+
function Mn(e) {
|
|
3043
3083
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3044
3084
|
}
|
|
3045
|
-
function
|
|
3046
|
-
e?.intervalMs !== void 0 &&
|
|
3085
|
+
function Nn(e) {
|
|
3086
|
+
e?.intervalMs !== void 0 && Mn(e.intervalMs);
|
|
3047
3087
|
}
|
|
3048
|
-
function
|
|
3088
|
+
function Pn(e) {
|
|
3049
3089
|
return {
|
|
3050
3090
|
enabled: e?.enabled ?? !1,
|
|
3051
3091
|
includePostItems: e?.includePostItems ?? !1,
|
|
3052
3092
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3053
3093
|
};
|
|
3054
3094
|
}
|
|
3055
|
-
function
|
|
3095
|
+
function Fn(e, t) {
|
|
3056
3096
|
if (typeof t == "boolean") {
|
|
3057
3097
|
e.enabled = t;
|
|
3058
3098
|
return;
|
|
3059
3099
|
}
|
|
3060
|
-
|
|
3100
|
+
Nn(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);
|
|
3061
3101
|
}
|
|
3062
3102
|
//#endregion
|
|
3063
3103
|
//#region src/core/reelInfoSheet.ts
|
|
3064
|
-
function
|
|
3104
|
+
function In(e) {
|
|
3065
3105
|
return { enabled: e?.enabled ?? !1 };
|
|
3066
3106
|
}
|
|
3067
|
-
function
|
|
3107
|
+
function Ln(e, t, n) {
|
|
3068
3108
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3069
3109
|
e.enabled = n;
|
|
3070
3110
|
}
|
|
3071
3111
|
//#endregion
|
|
3072
3112
|
//#region src/core/initialRuntimeState.ts
|
|
3073
|
-
function
|
|
3113
|
+
function Rn(e, t) {
|
|
3074
3114
|
let n = e.initialPage;
|
|
3075
3115
|
return {
|
|
3076
3116
|
activeReelPostId: null,
|
|
3077
|
-
autoScroll:
|
|
3078
|
-
autofill:
|
|
3117
|
+
autoScroll: ln(e.autoScroll),
|
|
3118
|
+
autofill: Qt(e.autofill),
|
|
3079
3119
|
error: null,
|
|
3080
|
-
fill:
|
|
3120
|
+
fill: bn(e.fill),
|
|
3081
3121
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3082
3122
|
isLoading: !n,
|
|
3083
3123
|
isLoadingMore: !1,
|
|
@@ -3088,14 +3128,14 @@ function In(e, t) {
|
|
|
3088
3128
|
next: n?.next ?? null,
|
|
3089
3129
|
nextPageError: null,
|
|
3090
3130
|
phoneMode: !1,
|
|
3091
|
-
reelAutoAdvance:
|
|
3131
|
+
reelAutoAdvance: Pn(e.reelAutoAdvance),
|
|
3092
3132
|
reelForward: {
|
|
3093
3133
|
error: null,
|
|
3094
3134
|
status: "idle"
|
|
3095
3135
|
},
|
|
3096
3136
|
reelForwardIndex: null,
|
|
3097
3137
|
reelForwardItem: null,
|
|
3098
|
-
reelInfoSheet:
|
|
3138
|
+
reelInfoSheet: In(e.reelInfoSheet),
|
|
3099
3139
|
reelInfoSheetOverlay: !1,
|
|
3100
3140
|
reelMediaSource: "original",
|
|
3101
3141
|
reelOrigin: null,
|
|
@@ -3104,20 +3144,20 @@ function In(e, t) {
|
|
|
3104
3144
|
}
|
|
3105
3145
|
//#endregion
|
|
3106
3146
|
//#region src/core/options.ts
|
|
3107
|
-
function
|
|
3147
|
+
function zn(e, t) {
|
|
3108
3148
|
if (t) {
|
|
3109
3149
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3110
3150
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3111
3151
|
}
|
|
3112
3152
|
}
|
|
3113
|
-
function
|
|
3153
|
+
function Bn(e, t) {
|
|
3114
3154
|
if (t) {
|
|
3115
3155
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3116
3156
|
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.`);
|
|
3117
3157
|
}
|
|
3118
3158
|
}
|
|
3119
|
-
function
|
|
3120
|
-
if (
|
|
3159
|
+
function Vn(e) {
|
|
3160
|
+
if (cn(e.autoScroll), zn("cardHeader", e.cardHeader), zn("cardFooter", e.cardFooter), Bn("header", e.mediaCard?.header), Bn("footer", e.mediaCard?.footer), Zt(e.autofill), yn(e.fill), ae(e.masonry), Nn(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3121
3161
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3122
3162
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3123
3163
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3131,7 +3171,7 @@ function zn(e) {
|
|
|
3131
3171
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3132
3172
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3133
3173
|
}
|
|
3134
|
-
function
|
|
3174
|
+
function Hn(e) {
|
|
3135
3175
|
if (typeof e != "string") return e;
|
|
3136
3176
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3137
3177
|
let t = document.querySelector(e);
|
|
@@ -3140,7 +3180,7 @@ function Bn(e) {
|
|
|
3140
3180
|
}
|
|
3141
3181
|
//#endregion
|
|
3142
3182
|
//#region src/core/pageRequest.ts
|
|
3143
|
-
async function
|
|
3183
|
+
async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3144
3184
|
let u = s.autofill, d = e && u?.strategy === "frontend" && l.autofill.status === "paused", f = d ? {
|
|
3145
3185
|
received: l.autofill.received,
|
|
3146
3186
|
requests: l.autofill.requests
|
|
@@ -3152,11 +3192,11 @@ async function Vn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3152
3192
|
let m = !1;
|
|
3153
3193
|
try {
|
|
3154
3194
|
if (u?.strategy === "frontend") {
|
|
3155
|
-
let s = await
|
|
3195
|
+
let s = await nn({
|
|
3156
3196
|
existingItems: e ? l.items : [],
|
|
3157
3197
|
initialCursor: n,
|
|
3158
3198
|
loadPage: i,
|
|
3159
|
-
maximumRequests: f ? Math.max(0,
|
|
3199
|
+
maximumRequests: f ? Math.max(0, Jt(u) - f.requests) : void 0,
|
|
3160
3200
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3161
3201
|
onDelayChange: (e) => {
|
|
3162
3202
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3179,7 +3219,7 @@ async function Vn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3179
3219
|
}), o(s.pages), t.clearCollection();
|
|
3180
3220
|
return;
|
|
3181
3221
|
}
|
|
3182
|
-
let s =
|
|
3222
|
+
let s = Rt(await i({
|
|
3183
3223
|
cursor: n,
|
|
3184
3224
|
signal: c
|
|
3185
3225
|
}));
|
|
@@ -3199,7 +3239,7 @@ async function Vn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3199
3239
|
l.autofill.status = "complete";
|
|
3200
3240
|
return;
|
|
3201
3241
|
}
|
|
3202
|
-
await
|
|
3242
|
+
await dn(u, l, {
|
|
3203
3243
|
cycleId: p,
|
|
3204
3244
|
feedKey: u.feedKey,
|
|
3205
3245
|
items: h.slice(d.length),
|
|
@@ -3223,13 +3263,13 @@ async function Vn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3223
3263
|
function $(e) {
|
|
3224
3264
|
return `${typeof e}:${String(e)}`;
|
|
3225
3265
|
}
|
|
3226
|
-
function
|
|
3266
|
+
function Wn(e) {
|
|
3227
3267
|
return `${typeof e}:${String(e)}`;
|
|
3228
3268
|
}
|
|
3229
|
-
function
|
|
3269
|
+
function Gn(e) {
|
|
3230
3270
|
return e.map(({ postId: e }) => e);
|
|
3231
3271
|
}
|
|
3232
|
-
var
|
|
3272
|
+
var Kn = class {
|
|
3233
3273
|
delay;
|
|
3234
3274
|
enabled;
|
|
3235
3275
|
maxReplayPages;
|
|
@@ -3271,14 +3311,14 @@ var Wn = class {
|
|
|
3271
3311
|
async reconcile({ existingItems: e, loadPage: t, shouldPause: n = () => !1, signal: r }) {
|
|
3272
3312
|
let i = this.pending ?? this.createSession(e);
|
|
3273
3313
|
for (this.pending = i; i.remainingRequests > 0;) {
|
|
3274
|
-
let e =
|
|
3314
|
+
let e = Wn(i.cursor);
|
|
3275
3315
|
if (i.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3276
|
-
if (await
|
|
3277
|
-
delayMs:
|
|
3316
|
+
if (await Kt({
|
|
3317
|
+
delayMs: Gt(i.pages.length, this.delay),
|
|
3278
3318
|
onChange: () => void 0,
|
|
3279
3319
|
signal: r
|
|
3280
3320
|
}), i.pages.length > 0 && n()) return this.result(i, "paused");
|
|
3281
|
-
let a =
|
|
3321
|
+
let a = Rt(await t({
|
|
3282
3322
|
cursor: i.cursor,
|
|
3283
3323
|
signal: r
|
|
3284
3324
|
}));
|
|
@@ -3291,7 +3331,7 @@ var Wn = class {
|
|
|
3291
3331
|
contributionIds: s,
|
|
3292
3332
|
cursor: i.cursor,
|
|
3293
3333
|
next: a.next,
|
|
3294
|
-
returnedIds:
|
|
3334
|
+
returnedIds: Gn(o)
|
|
3295
3335
|
}), i.lastCursor = i.cursor, i.next = a.next, --i.remainingRequests, a.total !== void 0 && (i.total = a.total), i.next === null ? i.remainingRequests = 0 : i.cursor = i.next, i.remainingRequests > 0 && n()) return this.result(i, "paused");
|
|
3296
3336
|
}
|
|
3297
3337
|
return this.result(i, "complete");
|
|
@@ -3330,7 +3370,7 @@ var Wn = class {
|
|
|
3330
3370
|
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
|
|
3331
3371
|
}
|
|
3332
3372
|
recordPage(e) {
|
|
3333
|
-
let t =
|
|
3373
|
+
let t = Wn(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Wn(e) === t);
|
|
3334
3374
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3335
3375
|
...e,
|
|
3336
3376
|
contributionIds: [...e.contributionIds],
|
|
@@ -3340,7 +3380,7 @@ var Wn = class {
|
|
|
3340
3380
|
};
|
|
3341
3381
|
//#endregion
|
|
3342
3382
|
//#region src/core/activeItemRemoval.ts
|
|
3343
|
-
function
|
|
3383
|
+
function qn(e, t, n, r, i) {
|
|
3344
3384
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3345
3385
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3346
3386
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3353,7 +3393,7 @@ function Gn(e, t, n, r, i) {
|
|
|
3353
3393
|
}
|
|
3354
3394
|
//#endregion
|
|
3355
3395
|
//#region src/core/exactMediaRemovalController.ts
|
|
3356
|
-
function
|
|
3396
|
+
function Jn(e, t) {
|
|
3357
3397
|
let [n, ...r] = t;
|
|
3358
3398
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3359
3399
|
return {
|
|
@@ -3362,10 +3402,10 @@ function Kn(e, t) {
|
|
|
3362
3402
|
items: r
|
|
3363
3403
|
};
|
|
3364
3404
|
}
|
|
3365
|
-
function
|
|
3405
|
+
function Yn(e) {
|
|
3366
3406
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3367
3407
|
}
|
|
3368
|
-
var
|
|
3408
|
+
var Xn = class {
|
|
3369
3409
|
generation = 0;
|
|
3370
3410
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3371
3411
|
state;
|
|
@@ -3373,7 +3413,7 @@ var Jn = class {
|
|
|
3373
3413
|
this.options = e, this.state = e.state;
|
|
3374
3414
|
}
|
|
3375
3415
|
remove(e) {
|
|
3376
|
-
|
|
3416
|
+
Yn(e);
|
|
3377
3417
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3378
3418
|
if (!n) return null;
|
|
3379
3419
|
let r = [...M(n)], i = r[e.mediaIndex];
|
|
@@ -3390,7 +3430,7 @@ var Jn = class {
|
|
|
3390
3430
|
restored: !1
|
|
3391
3431
|
});
|
|
3392
3432
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3393
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3433
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Jn(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);
|
|
3394
3434
|
}
|
|
3395
3435
|
reset() {
|
|
3396
3436
|
this.generation += 1;
|
|
@@ -3416,7 +3456,7 @@ var Jn = class {
|
|
|
3416
3456
|
}
|
|
3417
3457
|
restoreIntoPost(e, t) {
|
|
3418
3458
|
let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3419
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3459
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Jn(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3420
3460
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3421
3461
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3422
3462
|
}
|
|
@@ -3429,18 +3469,18 @@ var Jn = class {
|
|
|
3429
3469
|
};
|
|
3430
3470
|
//#endregion
|
|
3431
3471
|
//#region src/core/itemPlacement.ts
|
|
3432
|
-
function
|
|
3472
|
+
function Zn(e, t) {
|
|
3433
3473
|
let n = new Set(t);
|
|
3434
3474
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3435
3475
|
index: t,
|
|
3436
3476
|
item: e
|
|
3437
3477
|
}] : []);
|
|
3438
3478
|
}
|
|
3439
|
-
function
|
|
3479
|
+
function Qn(e, t) {
|
|
3440
3480
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3441
3481
|
return e.filter((e) => !n.has(e.postId));
|
|
3442
3482
|
}
|
|
3443
|
-
function
|
|
3483
|
+
function $n(e, t) {
|
|
3444
3484
|
t.forEach(({ index: e }) => {
|
|
3445
3485
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3446
3486
|
});
|
|
@@ -3451,7 +3491,7 @@ function Zn(e, t) {
|
|
|
3451
3491
|
}
|
|
3452
3492
|
//#endregion
|
|
3453
3493
|
//#region src/core/itemRemovalController.ts
|
|
3454
|
-
var
|
|
3494
|
+
var er = 20, tr = class {
|
|
3455
3495
|
generation = 0;
|
|
3456
3496
|
historyLimit;
|
|
3457
3497
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3460,7 +3500,7 @@ var Qn = 20, $n = class {
|
|
|
3460
3500
|
itemOrder;
|
|
3461
3501
|
stopItemsWatcher;
|
|
3462
3502
|
constructor(e) {
|
|
3463
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3503
|
+
this.options = e, this.historyLimit = e.historyLimit ?? er, 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" });
|
|
3464
3504
|
}
|
|
3465
3505
|
destroy() {
|
|
3466
3506
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3473,7 +3513,7 @@ var Qn = 20, $n = class {
|
|
|
3473
3513
|
let i = this.options.startRemoval(r);
|
|
3474
3514
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
3475
3515
|
let a = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), o = new Set(t.map(({ item: e }) => e.postId)), s = a < 0 ? 0 : this.state.items.slice(0, a).filter(({ postId: e }) => o.has(e)).length, c = Math.max(a - s, 0);
|
|
3476
|
-
return this.state.items =
|
|
3516
|
+
return this.state.items = Qn(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
|
|
3477
3517
|
}
|
|
3478
3518
|
reset() {
|
|
3479
3519
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3484,7 +3524,7 @@ var Qn = 20, $n = class {
|
|
|
3484
3524
|
this.restoreRemoval(t);
|
|
3485
3525
|
return;
|
|
3486
3526
|
}
|
|
3487
|
-
let n =
|
|
3527
|
+
let n = $n(this.state.items, e);
|
|
3488
3528
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
3489
3529
|
}
|
|
3490
3530
|
restoreRemoval(e) {
|
|
@@ -3510,7 +3550,7 @@ var Qn = 20, $n = class {
|
|
|
3510
3550
|
}
|
|
3511
3551
|
collectOrderedPlacements(e) {
|
|
3512
3552
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3513
|
-
return
|
|
3553
|
+
return Zn(this.state.items, e).map((e) => ({
|
|
3514
3554
|
index: t.get(e.item.postId) ?? e.index,
|
|
3515
3555
|
item: e.item
|
|
3516
3556
|
}));
|
|
@@ -3541,7 +3581,7 @@ var Qn = 20, $n = class {
|
|
|
3541
3581
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3542
3582
|
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;
|
|
3543
3583
|
}
|
|
3544
|
-
},
|
|
3584
|
+
}, nr = class {
|
|
3545
3585
|
forward = null;
|
|
3546
3586
|
forwardPromise = null;
|
|
3547
3587
|
forwardVersion = 0;
|
|
@@ -3619,7 +3659,7 @@ var Qn = 20, $n = class {
|
|
|
3619
3659
|
}
|
|
3620
3660
|
}
|
|
3621
3661
|
}
|
|
3622
|
-
},
|
|
3662
|
+
}, rr = class {
|
|
3623
3663
|
generation = 0;
|
|
3624
3664
|
pending = Promise.resolve();
|
|
3625
3665
|
constructor(e) {
|
|
@@ -3669,24 +3709,24 @@ var Qn = 20, $n = class {
|
|
|
3669
3709
|
};
|
|
3670
3710
|
//#endregion
|
|
3671
3711
|
//#region src/core/removalControllers.ts
|
|
3672
|
-
function
|
|
3673
|
-
let t = new
|
|
3712
|
+
function ir(e) {
|
|
3713
|
+
let t = new nr(e), n = new rr({
|
|
3674
3714
|
state: e.state,
|
|
3675
3715
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3676
3716
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3677
3717
|
});
|
|
3678
3718
|
return {
|
|
3679
|
-
exactMediaRemoval: new
|
|
3719
|
+
exactMediaRemoval: new Xn({
|
|
3680
3720
|
onActivate: e.onActivate,
|
|
3681
3721
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
3682
3722
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
3683
3723
|
reelForward: t,
|
|
3684
3724
|
state: e.state
|
|
3685
3725
|
}),
|
|
3686
|
-
itemRemoval: new
|
|
3726
|
+
itemRemoval: new tr({
|
|
3687
3727
|
historyLimit: e.historyLimit,
|
|
3688
3728
|
onItemsRemoved: (n, r, i) => {
|
|
3689
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
3729
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), qn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3690
3730
|
},
|
|
3691
3731
|
onRemovalRestored: (n) => {
|
|
3692
3732
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -3701,17 +3741,17 @@ function nr(e) {
|
|
|
3701
3741
|
reelRemoval: n
|
|
3702
3742
|
};
|
|
3703
3743
|
}
|
|
3704
|
-
var
|
|
3705
|
-
function
|
|
3744
|
+
var ar = 1.5;
|
|
3745
|
+
function or(e) {
|
|
3706
3746
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3707
3747
|
if (t > 0 && t < 600) return !0;
|
|
3708
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3748
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * ar;
|
|
3709
3749
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3710
3750
|
}
|
|
3711
|
-
function
|
|
3712
|
-
return
|
|
3751
|
+
function sr(e) {
|
|
3752
|
+
return or(e) ? "reel" : "masonry";
|
|
3713
3753
|
}
|
|
3714
|
-
function
|
|
3754
|
+
function cr(e) {
|
|
3715
3755
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3716
3756
|
return {
|
|
3717
3757
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3721,15 +3761,15 @@ function or(e) {
|
|
|
3721
3761
|
viewportWidth: n.clientWidth
|
|
3722
3762
|
};
|
|
3723
3763
|
}
|
|
3724
|
-
function
|
|
3725
|
-
return
|
|
3764
|
+
function lr(e) {
|
|
3765
|
+
return or(cr(e));
|
|
3726
3766
|
}
|
|
3727
|
-
function
|
|
3728
|
-
return
|
|
3767
|
+
function ur(e) {
|
|
3768
|
+
return sr(cr(e));
|
|
3729
3769
|
}
|
|
3730
3770
|
//#endregion
|
|
3731
3771
|
//#region src/core/responsiveLayoutController.ts
|
|
3732
|
-
var
|
|
3772
|
+
var dr = class {
|
|
3733
3773
|
layoutMode;
|
|
3734
3774
|
resizeObserver = null;
|
|
3735
3775
|
target = null;
|
|
@@ -3754,10 +3794,10 @@ var lr = class {
|
|
|
3754
3794
|
}
|
|
3755
3795
|
handleResponsiveLayout = () => {
|
|
3756
3796
|
if (!this.target) return;
|
|
3757
|
-
let e =
|
|
3758
|
-
this.state.phoneMode =
|
|
3797
|
+
let e = ur(this.target);
|
|
3798
|
+
this.state.phoneMode = lr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3759
3799
|
};
|
|
3760
|
-
},
|
|
3800
|
+
}, fr = class {
|
|
3761
3801
|
routedReelPostId = null;
|
|
3762
3802
|
reelRouteIsActive = !1;
|
|
3763
3803
|
constructor(e, t) {
|
|
@@ -3784,7 +3824,7 @@ var lr = class {
|
|
|
3784
3824
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3785
3825
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3786
3826
|
}
|
|
3787
|
-
},
|
|
3827
|
+
}, pr = class {
|
|
3788
3828
|
app = null;
|
|
3789
3829
|
autoScroll;
|
|
3790
3830
|
autofillController;
|
|
@@ -3802,14 +3842,15 @@ var lr = class {
|
|
|
3802
3842
|
surface = null;
|
|
3803
3843
|
stopStateWatcher = null;
|
|
3804
3844
|
lastLoadedCursor = null;
|
|
3845
|
+
notificationItems;
|
|
3805
3846
|
state;
|
|
3806
3847
|
constructor(e) {
|
|
3807
|
-
this.options = e,
|
|
3848
|
+
this.options = e, Vn(e);
|
|
3808
3849
|
let t = e.layout ?? "masonry";
|
|
3809
|
-
this.state = x(
|
|
3850
|
+
this.state = x(Rn(e, t)), this.notificationItems = I(this.state), this.autoScroll = new un({
|
|
3810
3851
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3811
3852
|
state: this.state.autoScroll
|
|
3812
|
-
}), this.autofillController = new
|
|
3853
|
+
}), this.autofillController = new rn({
|
|
3813
3854
|
cancelRequest: () => this.cancelRequest(),
|
|
3814
3855
|
onLastCursor: (e) => {
|
|
3815
3856
|
this.lastLoadedCursor = e;
|
|
@@ -3817,7 +3858,7 @@ var lr = class {
|
|
|
3817
3858
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3818
3859
|
options: e.autofill,
|
|
3819
3860
|
state: this.state
|
|
3820
|
-
}), this.removalReconciliation = new
|
|
3861
|
+
}), this.removalReconciliation = new Kn(e), this.fillController = new An({
|
|
3821
3862
|
fill: e.fill,
|
|
3822
3863
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
3823
3864
|
onLastCursor: (e) => {
|
|
@@ -3825,8 +3866,8 @@ var lr = class {
|
|
|
3825
3866
|
},
|
|
3826
3867
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3827
3868
|
state: this.state
|
|
3828
|
-
}), this.routing = new
|
|
3829
|
-
let n =
|
|
3869
|
+
}), this.routing = new fr(e.routing, this.state);
|
|
3870
|
+
let n = ir({
|
|
3830
3871
|
historyLimit: e.removalHistoryLimit,
|
|
3831
3872
|
loadNext: () => this.loadNext(),
|
|
3832
3873
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
@@ -3836,21 +3877,22 @@ var lr = class {
|
|
|
3836
3877
|
state: this.state,
|
|
3837
3878
|
surface: () => this.surface
|
|
3838
3879
|
});
|
|
3839
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
3880
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new dr(t, this.state, () => {
|
|
3840
3881
|
this.routing.syncFeed();
|
|
3841
3882
|
}), this.startStateNotifications();
|
|
3842
3883
|
}
|
|
3843
3884
|
async mount() {
|
|
3844
3885
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3845
3886
|
this.startStateNotifications();
|
|
3846
|
-
let e =
|
|
3847
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
3887
|
+
let e = Hn(this.options.target);
|
|
3888
|
+
this.responsiveLayout.mount(e), this.app = i(Lt, {
|
|
3848
3889
|
canRetryEnd: !!this.options.loadPage,
|
|
3849
3890
|
cardFooter: this.options.cardFooter,
|
|
3850
3891
|
cardHeader: this.options.cardHeader,
|
|
3851
3892
|
feedFooter: this.options.feedFooter,
|
|
3852
|
-
feedFooterActions:
|
|
3893
|
+
feedFooterActions: jn(this),
|
|
3853
3894
|
mediaCard: this.options.mediaCard,
|
|
3895
|
+
masonry: this.options.masonry,
|
|
3854
3896
|
onMediaReady: this.options.onMediaReady,
|
|
3855
3897
|
onMediaVisible: this.options.onMediaVisible,
|
|
3856
3898
|
onReelMediaChange: this.options.onReelMediaChange,
|
|
@@ -3877,7 +3919,7 @@ var lr = class {
|
|
|
3877
3919
|
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;
|
|
3878
3920
|
}
|
|
3879
3921
|
getState() {
|
|
3880
|
-
return
|
|
3922
|
+
return L(this.state);
|
|
3881
3923
|
}
|
|
3882
3924
|
removeMedia(e) {
|
|
3883
3925
|
return this.exactMediaRemoval.remove(e);
|
|
@@ -3931,7 +3973,7 @@ var lr = class {
|
|
|
3931
3973
|
this.autoScroll.setSpeed(e);
|
|
3932
3974
|
}
|
|
3933
3975
|
applyAutofillUpdate(e) {
|
|
3934
|
-
let t =
|
|
3976
|
+
let t = pn(this.options.autofill, this.state, e);
|
|
3935
3977
|
return t && this.autofillController.syncCountdown(), t;
|
|
3936
3978
|
}
|
|
3937
3979
|
cancelAutofill() {
|
|
@@ -3942,7 +3984,7 @@ var lr = class {
|
|
|
3942
3984
|
await this.cancelFill();
|
|
3943
3985
|
return;
|
|
3944
3986
|
}
|
|
3945
|
-
if (
|
|
3987
|
+
if ($t(this.state.autofill)) {
|
|
3946
3988
|
await this.cancelAutofill();
|
|
3947
3989
|
return;
|
|
3948
3990
|
}
|
|
@@ -3956,12 +3998,12 @@ var lr = class {
|
|
|
3956
3998
|
}
|
|
3957
3999
|
async fill(e) {
|
|
3958
4000
|
if (!this.state.loadMoreLocked) {
|
|
3959
|
-
if (this.pendingRequest ||
|
|
4001
|
+
if (this.pendingRequest || $t(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
3960
4002
|
await this.fillController.start(e);
|
|
3961
4003
|
}
|
|
3962
4004
|
}
|
|
3963
4005
|
restoreAutofillSession(e) {
|
|
3964
|
-
let t =
|
|
4006
|
+
let t = mn(this.options.autofill, this.state, e);
|
|
3965
4007
|
return t && this.autofillController.syncCountdown(), t;
|
|
3966
4008
|
}
|
|
3967
4009
|
restoreFillSession(e) {
|
|
@@ -3969,7 +4011,7 @@ var lr = class {
|
|
|
3969
4011
|
}
|
|
3970
4012
|
async loadNext() {
|
|
3971
4013
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3972
|
-
if (this.state.loadMoreLocked ||
|
|
4014
|
+
if (this.state.loadMoreLocked || $t(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
3973
4015
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
3974
4016
|
let e = this.loadNextSequence();
|
|
3975
4017
|
return this.pendingRequest = e, e.finally(() => {
|
|
@@ -3984,12 +4026,12 @@ var lr = class {
|
|
|
3984
4026
|
}
|
|
3985
4027
|
async replaceFeed(e, t) {
|
|
3986
4028
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
3987
|
-
return
|
|
4029
|
+
return $t(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Qt(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.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
|
|
3988
4030
|
}
|
|
3989
4031
|
async loadFilteredPage(e) {
|
|
3990
4032
|
let t = this.options.loadPage;
|
|
3991
4033
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
3992
|
-
let n =
|
|
4034
|
+
let n = Rt(await t(e));
|
|
3993
4035
|
return {
|
|
3994
4036
|
...n,
|
|
3995
4037
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4019,7 +4061,7 @@ var lr = class {
|
|
|
4019
4061
|
}
|
|
4020
4062
|
async retryEnd() {
|
|
4021
4063
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4022
|
-
if (!this.state.loadMoreLocked && !(
|
|
4064
|
+
if (!this.state.loadMoreLocked && !($t(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);
|
|
4023
4065
|
}
|
|
4024
4066
|
setInfiniteScroll(e) {
|
|
4025
4067
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4047,10 +4089,10 @@ var lr = class {
|
|
|
4047
4089
|
this.state.total = e;
|
|
4048
4090
|
}
|
|
4049
4091
|
setReelAutoAdvance(e) {
|
|
4050
|
-
|
|
4092
|
+
Fn(this.state.reelAutoAdvance, e);
|
|
4051
4093
|
}
|
|
4052
4094
|
setReelInfoSheet(e) {
|
|
4053
|
-
|
|
4095
|
+
Ln(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4054
4096
|
}
|
|
4055
4097
|
setLayout(e) {
|
|
4056
4098
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4070,7 +4112,7 @@ var lr = class {
|
|
|
4070
4112
|
async fetchPage(e, t) {
|
|
4071
4113
|
if (!this.options.loadPage) return;
|
|
4072
4114
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4073
|
-
this.abortController = r, await
|
|
4115
|
+
this.abortController = r, await Un({
|
|
4074
4116
|
append: t,
|
|
4075
4117
|
autofillController: this.autofillController,
|
|
4076
4118
|
cursor: e,
|
|
@@ -4094,7 +4136,7 @@ var lr = class {
|
|
|
4094
4136
|
startInitialAutofill() {
|
|
4095
4137
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4096
4138
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4097
|
-
let r =
|
|
4139
|
+
let r = hn({
|
|
4098
4140
|
cycleId: n,
|
|
4099
4141
|
isCurrent: () => e === this.requestVersion,
|
|
4100
4142
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4114,14 +4156,14 @@ var lr = class {
|
|
|
4114
4156
|
}
|
|
4115
4157
|
startStateNotifications() {
|
|
4116
4158
|
let e = this.options.onStateChange;
|
|
4117
|
-
!e || this.stopStateWatcher || (e(this.
|
|
4159
|
+
!e || this.stopStateWatcher || (e(L(this.state, this.notificationItems.value)), this.stopStateWatcher = O(this.state, () => e(L(this.state, this.notificationItems.value)), {
|
|
4118
4160
|
deep: !0,
|
|
4119
4161
|
flush: "post"
|
|
4120
4162
|
}));
|
|
4121
4163
|
}
|
|
4122
4164
|
};
|
|
4123
|
-
function
|
|
4124
|
-
return new
|
|
4165
|
+
function mr(e) {
|
|
4166
|
+
return new pr(e);
|
|
4125
4167
|
}
|
|
4126
4168
|
//#endregion
|
|
4127
|
-
export {
|
|
4169
|
+
export { mr as createVibe };
|