@wyxos/vibe 5.3.1 → 5.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +592 -536
- 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
|
+
}), ee = ["role"], G = { class: "gallery-status" }, te = /* @__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", G, [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(
|
|
163
|
+
}, [c("p", G, [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,7 +182,7 @@ var L = {
|
|
|
179
182
|
"is-loading",
|
|
180
183
|
"load-more-locked",
|
|
181
184
|
"state"
|
|
182
|
-
])) : o("", !0)], 8,
|
|
185
|
+
])) : o("", !0)], 8, ee));
|
|
183
186
|
}
|
|
184
187
|
});
|
|
185
188
|
function K(e) {
|
|
@@ -187,28 +190,28 @@ function K(e) {
|
|
|
187
190
|
}
|
|
188
191
|
//#endregion
|
|
189
192
|
//#region src/core/masonry.ts
|
|
190
|
-
function
|
|
193
|
+
function ne(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 q(e) {
|
|
195
198
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
196
199
|
}
|
|
197
|
-
function
|
|
200
|
+
function re(e) {
|
|
198
201
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
199
202
|
}
|
|
200
|
-
function
|
|
203
|
+
function ie(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 ae(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 = q(c), n = s * ne(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 oe(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 J(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 se(e, t, n) {
|
|
228
246
|
return Math.min(n, Math.max(t, e));
|
|
229
247
|
}
|
|
230
|
-
function
|
|
248
|
+
function Y({ 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 = se(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 * (se(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 : Y({
|
|
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,17 +773,17 @@ 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:
|
|
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: ee, onPlaying: G, playbackAllowed: te } = Be({
|
|
746
777
|
active: () => l.active,
|
|
747
778
|
layout: () => l.layout,
|
|
748
779
|
videoElement: R,
|
|
749
780
|
videoIsMuted: V,
|
|
750
781
|
videoIsPlaying: H
|
|
751
|
-
}),
|
|
752
|
-
function
|
|
782
|
+
}), K = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
783
|
+
function ne(e) {
|
|
753
784
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
754
785
|
}
|
|
755
|
-
function
|
|
786
|
+
function q(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
|
}
|
|
@@ -763,31 +794,36 @@ var Be = [
|
|
|
763
794
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
764
795
|
}
|
|
765
796
|
function ae() {
|
|
766
|
-
d !== null && clearTimeout(d), d = setTimeout(ie,
|
|
797
|
+
d !== null && clearTimeout(d), d = setTimeout(ie, rt);
|
|
767
798
|
}
|
|
768
799
|
function oe(e) {
|
|
769
800
|
if (C.value.length <= 1) return;
|
|
770
801
|
let t = e.currentTarget?.clientWidth || 1, n = re(e.deltaX, e.deltaMode, t);
|
|
771
|
-
if (n === 0 || (e.preventDefault(), ae(), p) || (f += n, Math.abs(f) <
|
|
802
|
+
if (n === 0 || (e.preventDefault(), ae(), 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, q(D.value + r);
|
|
774
805
|
}
|
|
775
|
-
function
|
|
806
|
+
function J(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 se(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 || q(D.value + Math.sign(n)));
|
|
784
815
|
}
|
|
785
|
-
let
|
|
786
|
-
|
|
787
|
-
|
|
816
|
+
let { imageLoading: Y, 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 || !te.value)) {
|
|
791
827
|
if (H.value) {
|
|
792
828
|
R.value.pause();
|
|
793
829
|
return;
|
|
@@ -799,30 +835,30 @@ 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), te.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
|
}
|
|
@@ -841,12 +877,12 @@ var Be = [
|
|
|
841
877
|
"aria-hidden": e.leaving || void 0,
|
|
842
878
|
"aria-busy": e.previewState === "loading",
|
|
843
879
|
inert: e.leaving || void 0,
|
|
844
|
-
role: e.interactive && !e.leaving && !
|
|
845
|
-
tabindex: e.interactive && !e.leaving && !
|
|
846
|
-
onClick: i[11] ||= (t) => S(e.interactive && !
|
|
847
|
-
onKeydown: [i[12] ||= A((t) => S(e.interactive && !
|
|
848
|
-
}, [c("div",
|
|
849
|
-
e.cardHeader ? (b(), a(
|
|
880
|
+
role: e.interactive && !e.leaving && !K.value ? "button" : void 0,
|
|
881
|
+
tabindex: e.interactive && !e.leaving && !K.value ? 0 : void 0,
|
|
882
|
+
onClick: i[11] ||= (t) => S(e.interactive && !K.value, ne(t)),
|
|
883
|
+
onKeydown: [i[12] ||= A((t) => S(e.interactive && !K.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !K.value, "keyboard"), ["prevent"]), ["space"])]
|
|
884
|
+
}, [c("div", Ge, [
|
|
885
|
+
e.cardHeader ? (b(), a(je, {
|
|
850
886
|
key: 0,
|
|
851
887
|
index: e.index,
|
|
852
888
|
item: e.item,
|
|
@@ -873,21 +909,21 @@ var Be = [
|
|
|
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
911
|
onWheel: oe,
|
|
876
|
-
onTouchstartPassive:
|
|
877
|
-
onTouchendPassive:
|
|
912
|
+
onTouchstartPassive: J,
|
|
913
|
+
onTouchendPassive: se
|
|
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(te),
|
|
902
938
|
loop: !e.advanceOnMediaEnd,
|
|
903
|
-
muted: E(
|
|
939
|
+
muted: E(ee),
|
|
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(G) && E(G)(...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(Y),
|
|
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,25 +1002,25 @@ 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) => q(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) => q(D.value + 1, e), ["stop"]),
|
|
976
1012
|
onKeydown: i[8] ||= j(() => {}, ["stop"])
|
|
977
|
-
}, [u(E(
|
|
978
|
-
|
|
1013
|
+
}, [u(E(Ce), { size: 20 })], 40, et)], 2)) : o("", !0),
|
|
1014
|
+
K.value ? (b(), s("button", {
|
|
979
1015
|
key: 1,
|
|
980
1016
|
class: "media-card-activator",
|
|
981
1017
|
type: "button",
|
|
982
1018
|
"aria-label": `Open post ${e.item.postId}`,
|
|
983
|
-
onClick: i[9] ||= j((e) => r.$emit("activate",
|
|
1019
|
+
onClick: i[9] ||= j((e) => r.$emit("activate", ne(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,56 +1084,63 @@ 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 = w([]), A = w([]), j = 0, M = null, N = null, P = null, I = null, L = r(() => ae(l.items, g.value, {
|
|
1051
1088
|
additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
|
|
1052
1089
|
gap: y.value,
|
|
1053
|
-
minColumnWidth:
|
|
1054
|
-
})),
|
|
1055
|
-
let e =
|
|
1090
|
+
minColumnWidth: lt
|
|
1091
|
+
})), R = r(() => {
|
|
1092
|
+
let e = L.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 = ae(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,
|
|
1064
1101
|
items: l.items.map((t, n) => l.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
|
|
1065
1102
|
};
|
|
1066
|
-
}),
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
return
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1103
|
+
}), z = r(() => Math.max(C.value, l.leavingPostIds.size === 0 ? R.value.height : L.value.height)), B = r(() => ({ height: `${z.value}px` })), V = r(() => !l.infiniteScroll || x.value > 0 && T.value + R.value.height <= x.value + 1), H = r(() => new Set(k.value)), U = r(() => A.value.flatMap((e) => {
|
|
1104
|
+
let t = l.items[e];
|
|
1105
|
+
return t ? [{
|
|
1106
|
+
fetchPriority: H.value.has(e) ? "high" : "low",
|
|
1107
|
+
index: e,
|
|
1108
|
+
item: t
|
|
1109
|
+
}] : [];
|
|
1110
|
+
}));
|
|
1111
|
+
function ee(e, t) {
|
|
1112
|
+
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1113
|
+
}
|
|
1114
|
+
function G(e, t) {
|
|
1115
|
+
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1116
|
+
}
|
|
1117
|
+
function te(e) {
|
|
1118
|
+
let t = {
|
|
1119
|
+
scrollTop: j - T.value,
|
|
1120
|
+
viewportHeight: x.value
|
|
1121
|
+
};
|
|
1122
|
+
return ee(ie(R.value.items, {
|
|
1084
1123
|
...t,
|
|
1085
1124
|
overscan: e
|
|
1086
|
-
}),
|
|
1125
|
+
}), l.leavingPostIds.size === 0 ? [] : ie(L.value.items, {
|
|
1087
1126
|
...t,
|
|
1088
1127
|
overscan: e
|
|
1128
|
+
}));
|
|
1129
|
+
}
|
|
1130
|
+
function ne() {
|
|
1131
|
+
let e = l.suspended ? [] : te(0), t = te(oe(l.masonry, x.value));
|
|
1132
|
+
G(k.value, e) || (k.value = e), G(A.value, t) || (A.value = t);
|
|
1133
|
+
}
|
|
1134
|
+
function q() {
|
|
1135
|
+
if (I !== null) return;
|
|
1136
|
+
I = -1;
|
|
1137
|
+
let e = requestAnimationFrame(() => {
|
|
1138
|
+
I = null, ne();
|
|
1089
1139
|
});
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
index: e,
|
|
1095
|
-
item: t
|
|
1096
|
-
}] : [];
|
|
1097
|
-
});
|
|
1098
|
-
}), z = /* @__PURE__ */ new Set();
|
|
1099
|
-
O(() => [...L.value].flatMap((e) => {
|
|
1140
|
+
I !== null && (I = e);
|
|
1141
|
+
}
|
|
1142
|
+
let J = /* @__PURE__ */ new Set();
|
|
1143
|
+
O(() => [...H.value].flatMap((e) => {
|
|
1100
1144
|
let t = l.items[e];
|
|
1101
1145
|
if (!t) return [];
|
|
1102
1146
|
let n = l.mediaIndices.get(t.postId) ?? 0, r = F(t.postId, n);
|
|
@@ -1108,17 +1152,17 @@ var Be = [
|
|
|
1108
1152
|
}), (e) => {
|
|
1109
1153
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1110
1154
|
e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
|
|
1111
|
-
|
|
1112
|
-
}),
|
|
1155
|
+
J.has(e) || d("visible", n, t);
|
|
1156
|
+
}), J = t;
|
|
1113
1157
|
}, {
|
|
1114
1158
|
immediate: !0,
|
|
1115
1159
|
flush: "post"
|
|
1116
1160
|
});
|
|
1117
|
-
function
|
|
1118
|
-
let t =
|
|
1161
|
+
function se(e) {
|
|
1162
|
+
let t = R.value.items[e], n = l.items[e]?.postId;
|
|
1119
1163
|
if (!t) return {};
|
|
1120
|
-
let r = n !== void 0 && l.enteringPostIds.has(n), i = n !== void 0 && l.leavingPostIds.has(n), a = r || i ?
|
|
1121
|
-
containerHeight:
|
|
1164
|
+
let r = n !== void 0 && l.enteringPostIds.has(n), i = n !== void 0 && l.leavingPostIds.has(n), a = r || i ? re({
|
|
1165
|
+
containerHeight: Math.max(C.value, L.value.height),
|
|
1122
1166
|
gap: y.value
|
|
1123
1167
|
}) : 0, o = n === void 0 ? 0 : i ? l.removalDelays.get(n) ?? 0 : r ? l.entryDelays.get(n) ?? 0 : 0;
|
|
1124
1168
|
return {
|
|
@@ -1128,43 +1172,50 @@ var Be = [
|
|
|
1128
1172
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1129
1173
|
};
|
|
1130
1174
|
}
|
|
1131
|
-
function
|
|
1175
|
+
function Y() {
|
|
1132
1176
|
let e = f.value;
|
|
1133
1177
|
if (!e) return;
|
|
1134
|
-
|
|
1135
|
-
let t =
|
|
1136
|
-
|
|
1178
|
+
j = e.scrollTop, x.value = e.clientHeight;
|
|
1179
|
+
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
1180
|
+
C.value = Math.max(0, e.clientHeight - n);
|
|
1181
|
+
let r = m.value;
|
|
1182
|
+
r && (T.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, ne());
|
|
1137
1183
|
}
|
|
1138
|
-
function
|
|
1184
|
+
function ce(e) {
|
|
1139
1185
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1140
|
-
g.value = e.clientWidth, y.value = Math.min(
|
|
1186
|
+
g.value = e.clientWidth, y.value = Math.min(dt, Math.max(ut, t * .0075)), Y();
|
|
1141
1187
|
}
|
|
1142
|
-
function
|
|
1188
|
+
function le(e) {
|
|
1143
1189
|
let t = e.currentTarget;
|
|
1144
|
-
t && (
|
|
1190
|
+
t && (j = t.scrollTop, q(), !l.loadMoreLocked && l.infiniteScroll && K(t) && d("loadMore"));
|
|
1145
1191
|
}
|
|
1146
|
-
function
|
|
1192
|
+
function ue() {
|
|
1147
1193
|
let e = f.value;
|
|
1148
1194
|
!l.loadMoreLocked && e && K(e) && d("loadMore");
|
|
1149
1195
|
}
|
|
1150
|
-
function
|
|
1196
|
+
function de() {
|
|
1151
1197
|
return f.value;
|
|
1152
1198
|
}
|
|
1153
1199
|
return O(m, (e) => {
|
|
1154
|
-
|
|
1200
|
+
M?.disconnect(), M = null, P !== null && cancelAnimationFrame(P), e && (ce(e), !(typeof ResizeObserver > "u") && (M = new ResizeObserver(([t]) => {
|
|
1155
1201
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1156
|
-
Math.abs(n - g.value) < .5 || (
|
|
1157
|
-
|
|
1202
|
+
Math.abs(n - g.value) < .5 || (P = requestAnimationFrame(() => {
|
|
1203
|
+
P = null, ce(e);
|
|
1158
1204
|
}));
|
|
1159
|
-
}),
|
|
1205
|
+
}), M.observe(e)));
|
|
1160
1206
|
}), O(f, (e) => {
|
|
1161
|
-
|
|
1162
|
-
}),
|
|
1163
|
-
|
|
1207
|
+
N?.disconnect(), N = null, e && (Y(), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(Y), N.observe(e)));
|
|
1208
|
+
}), O([
|
|
1209
|
+
L,
|
|
1210
|
+
R,
|
|
1211
|
+
() => l.suspended,
|
|
1212
|
+
() => l.masonry
|
|
1213
|
+
], ne, { flush: "post" }), v(() => {
|
|
1214
|
+
M?.disconnect(), N?.disconnect(), P !== null && cancelAnimationFrame(P), I !== null && cancelAnimationFrame(I);
|
|
1164
1215
|
}), n({
|
|
1165
|
-
getScrollElement:
|
|
1166
|
-
loadIfNearBottom:
|
|
1167
|
-
}), (n, r) => (b(), s("div",
|
|
1216
|
+
getScrollElement: de,
|
|
1217
|
+
loadIfNearBottom: ue
|
|
1218
|
+
}), (n, r) => (b(), s("div", ot, [
|
|
1168
1219
|
c("main", {
|
|
1169
1220
|
id: p,
|
|
1170
1221
|
ref_key: "galleryElement",
|
|
@@ -1173,14 +1224,14 @@ var Be = [
|
|
|
1173
1224
|
"data-layout-mode": "masonry",
|
|
1174
1225
|
"aria-hidden": t.suspended || void 0,
|
|
1175
1226
|
inert: t.suspended || void 0,
|
|
1176
|
-
onScrollPassive:
|
|
1227
|
+
onScrollPassive: le
|
|
1177
1228
|
}, [c("section", {
|
|
1178
1229
|
ref_key: "masonryElement",
|
|
1179
1230
|
ref: m,
|
|
1180
1231
|
class: h(["masonry", { "masonry--ready": g.value > 0 }]),
|
|
1181
|
-
style: _(
|
|
1232
|
+
style: _(B.value),
|
|
1182
1233
|
"aria-label": "Media gallery"
|
|
1183
|
-
}, [(b(!0), s(e, null, S(
|
|
1234
|
+
}, [(b(!0), s(e, null, S(U.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(at, {
|
|
1184
1235
|
key: n.postId,
|
|
1185
1236
|
class: "masonry-item",
|
|
1186
1237
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1191,7 +1242,7 @@ var Be = [
|
|
|
1191
1242
|
"media-card": t.mediaCard,
|
|
1192
1243
|
index: r,
|
|
1193
1244
|
item: n,
|
|
1194
|
-
"item-style":
|
|
1245
|
+
"item-style": se(r),
|
|
1195
1246
|
interactive: "",
|
|
1196
1247
|
layout: "masonry",
|
|
1197
1248
|
"loaded-count": t.items.length,
|
|
@@ -1220,8 +1271,8 @@ var Be = [
|
|
|
1220
1271
|
"onMediaChange",
|
|
1221
1272
|
"onReady",
|
|
1222
1273
|
"onError"
|
|
1223
|
-
]))), 128))], 6)], 42,
|
|
1224
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext &&
|
|
1274
|
+
]))), 128))], 6)], 42, st),
|
|
1275
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && V.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", ct, [u(W, {
|
|
1225
1276
|
actions: t.feedFooterActions,
|
|
1226
1277
|
"can-retry-end": t.canRetryEnd,
|
|
1227
1278
|
"feed-footer": t.feedFooter,
|
|
@@ -1229,7 +1280,7 @@ var Be = [
|
|
|
1229
1280
|
"has-next": t.hasNext,
|
|
1230
1281
|
"is-loading": t.isLoadingMore,
|
|
1231
1282
|
"load-more-locked": t.loadMoreLocked,
|
|
1232
|
-
"show-load-more":
|
|
1283
|
+
"show-load-more": V.value,
|
|
1233
1284
|
state: t.state,
|
|
1234
1285
|
onLoadMore: r[0] ||= (e) => d("loadMore"),
|
|
1235
1286
|
onRetryEnd: r[1] ||= (e) => d("retryEnd")
|
|
@@ -1244,8 +1295,8 @@ var Be = [
|
|
|
1244
1295
|
"show-load-more",
|
|
1245
1296
|
"state"
|
|
1246
1297
|
])])) : o("", !0),
|
|
1247
|
-
u(
|
|
1248
|
-
"content-size":
|
|
1298
|
+
u(pe, {
|
|
1299
|
+
"content-size": R.value.height,
|
|
1249
1300
|
"controls-id": p,
|
|
1250
1301
|
"scroll-element": f.value,
|
|
1251
1302
|
suspended: t.suspended
|
|
@@ -1256,8 +1307,8 @@ var Be = [
|
|
|
1256
1307
|
])
|
|
1257
1308
|
]));
|
|
1258
1309
|
}
|
|
1259
|
-
}),
|
|
1260
|
-
function
|
|
1310
|
+
}), pt = 300;
|
|
1311
|
+
function mt(e, t, n) {
|
|
1261
1312
|
let r = e.scrollTop;
|
|
1262
1313
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1263
1314
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1265,7 +1316,7 @@ function ft(e, t, n) {
|
|
|
1265
1316
|
return new Promise((n) => {
|
|
1266
1317
|
let o = (s) => {
|
|
1267
1318
|
a += 1;
|
|
1268
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1319
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / pt), u = 1 - (1 - l) ** 3;
|
|
1269
1320
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1270
1321
|
requestAnimationFrame(o);
|
|
1271
1322
|
return;
|
|
@@ -1277,7 +1328,7 @@ function ft(e, t, n) {
|
|
|
1277
1328
|
}
|
|
1278
1329
|
//#endregion
|
|
1279
1330
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1280
|
-
var
|
|
1331
|
+
var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
1281
1332
|
__name: "ReelAutoAdvanceProgress",
|
|
1282
1333
|
props: {
|
|
1283
1334
|
durationMs: {},
|
|
@@ -1295,9 +1346,9 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1295
1346
|
class: "reel-auto-advance-progress",
|
|
1296
1347
|
style: _(a.value),
|
|
1297
1348
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1298
|
-
}, null, 36)], 8,
|
|
1349
|
+
}, null, 36)], 8, ht));
|
|
1299
1350
|
}
|
|
1300
|
-
}),
|
|
1351
|
+
}), _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
1352
|
__name: "ReelFeed",
|
|
1302
1353
|
props: {
|
|
1303
1354
|
initialPostId: {},
|
|
@@ -1335,7 +1386,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1335
1386
|
],
|
|
1336
1387
|
setup(t, { expose: n, emit: i }) {
|
|
1337
1388
|
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 -
|
|
1389
|
+
let e = Math.max(0, g.value - bt), t = Math.min(l.items.length - 1, g.value + bt);
|
|
1339
1390
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1340
1391
|
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1341
1392
|
index: e + n,
|
|
@@ -1352,7 +1403,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1352
1403
|
if (!e) return "";
|
|
1353
1404
|
let t = P(e, z.value);
|
|
1354
1405
|
return l.mediaSource === "original" ? t.src : t.preview.src;
|
|
1355
|
-
}), H = r(() => B.value === "ready" &&
|
|
1406
|
+
}), H = r(() => B.value === "ready" && He(V.value)), U = r(() => [
|
|
1356
1407
|
L.value,
|
|
1357
1408
|
z.value,
|
|
1358
1409
|
l.items.length,
|
|
@@ -1360,11 +1411,11 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1360
1411
|
l.reelAutoAdvance.enabled,
|
|
1361
1412
|
l.reelAutoAdvance.includePostItems,
|
|
1362
1413
|
l.reelAutoAdvance.intervalMs
|
|
1363
|
-
].join(":")),
|
|
1414
|
+
].join(":")), ee = r(() => {
|
|
1364
1415
|
let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1365
1416
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1366
|
-
}),
|
|
1367
|
-
function
|
|
1417
|
+
}), G = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value), te = r(() => !l.infiniteScroll || l.items.length <= 1), ne = 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.");
|
|
1418
|
+
function q(e) {
|
|
1368
1419
|
return { gridRow: `${e + 1}` };
|
|
1369
1420
|
}
|
|
1370
1421
|
function re(e) {
|
|
@@ -1379,7 +1430,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1379
1430
|
}
|
|
1380
1431
|
function ae() {
|
|
1381
1432
|
let e = d.value;
|
|
1382
|
-
e && (x.value = !1,
|
|
1433
|
+
e && (x.value = !1, se(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
|
|
1383
1434
|
e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
|
|
1384
1435
|
}), oe());
|
|
1385
1436
|
}
|
|
@@ -1387,22 +1438,22 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1387
1438
|
j !== null && clearTimeout(j), j = setTimeout(() => {
|
|
1388
1439
|
j = null;
|
|
1389
1440
|
let e = d.value;
|
|
1390
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1441
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), se(!1);
|
|
1391
1442
|
}, 120);
|
|
1392
1443
|
}
|
|
1393
|
-
function
|
|
1394
|
-
|
|
1444
|
+
function J() {
|
|
1445
|
+
se(!0);
|
|
1395
1446
|
let e = d.value;
|
|
1396
1447
|
e && (D = e.clientHeight, e.scrollTop = g.value * D), oe();
|
|
1397
1448
|
}
|
|
1398
|
-
function
|
|
1449
|
+
function se(e) {
|
|
1399
1450
|
C.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1400
1451
|
}
|
|
1401
|
-
function
|
|
1452
|
+
function Y() {
|
|
1402
1453
|
let e = d.value;
|
|
1403
1454
|
!l.loadMoreLocked && e && K(e) && u("loadMore");
|
|
1404
1455
|
}
|
|
1405
|
-
function
|
|
1456
|
+
function ce(e) {
|
|
1406
1457
|
let t = R.value;
|
|
1407
1458
|
if (!t) return !1;
|
|
1408
1459
|
let n = M(t).length;
|
|
@@ -1425,19 +1476,19 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1425
1476
|
let t = d.value;
|
|
1426
1477
|
if (!t) return Promise.resolve();
|
|
1427
1478
|
let n = e * (D || t.clientHeight);
|
|
1428
|
-
return g.value = e,
|
|
1479
|
+
return g.value = e, mt(t, n, de());
|
|
1429
1480
|
}
|
|
1430
1481
|
function pe(e) {
|
|
1431
1482
|
fe(e);
|
|
1432
1483
|
}
|
|
1433
|
-
async function
|
|
1484
|
+
async function me(e) {
|
|
1434
1485
|
let t = l.items.findIndex((t) => t.postId === e);
|
|
1435
1486
|
return t < 0 || t === g.value ? !1 : (await fe(t), !0);
|
|
1436
1487
|
}
|
|
1437
|
-
async function
|
|
1438
|
-
return
|
|
1488
|
+
async function he(e) {
|
|
1489
|
+
return ce(e) ? (de() || await new Promise((e) => setTimeout(e, xt)), !0) : !1;
|
|
1439
1490
|
}
|
|
1440
|
-
function
|
|
1491
|
+
function X() {
|
|
1441
1492
|
if (!l.reelAutoAdvance.enabled) return;
|
|
1442
1493
|
let e = R.value;
|
|
1443
1494
|
if (!e) return;
|
|
@@ -1453,7 +1504,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1453
1504
|
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), pe(t);
|
|
1454
1505
|
}
|
|
1455
1506
|
function ge(e, t) {
|
|
1456
|
-
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value ||
|
|
1507
|
+
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || X();
|
|
1457
1508
|
}
|
|
1458
1509
|
return O(d, (e) => {
|
|
1459
1510
|
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(ae), k.observe(e)));
|
|
@@ -1463,18 +1514,18 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1463
1514
|
}), O(L, (e) => {
|
|
1464
1515
|
e !== void 0 && u("activeChange", e);
|
|
1465
1516
|
}, { immediate: !0 }), y(() => {
|
|
1466
|
-
window.addEventListener("resize",
|
|
1517
|
+
window.addEventListener("resize", J), window.addEventListener("orientationchange", J), p >= 0 && m(ae);
|
|
1467
1518
|
}), v(() => {
|
|
1468
|
-
window.removeEventListener("resize",
|
|
1519
|
+
window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
|
|
1469
1520
|
}), n({
|
|
1470
1521
|
activeIndex: g,
|
|
1471
1522
|
activePostId: L,
|
|
1472
|
-
changeActiveMedia:
|
|
1473
|
-
loadIfNearBottom:
|
|
1523
|
+
changeActiveMedia: ce,
|
|
1524
|
+
loadIfNearBottom: Y,
|
|
1474
1525
|
moveActivePost: le,
|
|
1475
1526
|
navigateToItem: ue,
|
|
1476
|
-
transitionActiveMedia:
|
|
1477
|
-
transitionActivePost:
|
|
1527
|
+
transitionActiveMedia: he,
|
|
1528
|
+
transitionActivePost: me
|
|
1478
1529
|
}), (n, r) => (b(), s("main", {
|
|
1479
1530
|
class: h(["reel-shell", {
|
|
1480
1531
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
@@ -1482,7 +1533,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1482
1533
|
}]),
|
|
1483
1534
|
"data-layout-mode": "reel"
|
|
1484
1535
|
}, [
|
|
1485
|
-
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1536
|
+
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
|
|
1486
1537
|
key: 0,
|
|
1487
1538
|
index: g.value,
|
|
1488
1539
|
item: R.value,
|
|
@@ -1504,7 +1555,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1504
1555
|
"style",
|
|
1505
1556
|
"total"
|
|
1506
1557
|
])) : o("", !0),
|
|
1507
|
-
c("div",
|
|
1558
|
+
c("div", _t, [c("div", {
|
|
1508
1559
|
ref_key: "galleryElement",
|
|
1509
1560
|
ref: d,
|
|
1510
1561
|
class: "gallery-shell reel-feed",
|
|
@@ -1516,7 +1567,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1516
1567
|
class: "reel-track",
|
|
1517
1568
|
style: _(N.value),
|
|
1518
1569
|
"aria-label": "Media gallery"
|
|
1519
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1570
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(at, {
|
|
1520
1571
|
key: n.postId,
|
|
1521
1572
|
active: r === g.value && !x.value,
|
|
1522
1573
|
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
@@ -1525,7 +1576,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1525
1576
|
"fetch-priority": e,
|
|
1526
1577
|
index: r,
|
|
1527
1578
|
item: n,
|
|
1528
|
-
"item-style":
|
|
1579
|
+
"item-style": q(r),
|
|
1529
1580
|
"media-card": t.mediaCard,
|
|
1530
1581
|
layout: "reel",
|
|
1531
1582
|
"loaded-count": t.items.length,
|
|
@@ -1562,12 +1613,12 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1562
1613
|
class: "reel-forward-status",
|
|
1563
1614
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1564
1615
|
"data-status": t.reelForward.status
|
|
1565
|
-
}, [c("p", null, T(
|
|
1616
|
+
}, [c("p", null, T(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1566
1617
|
key: 0,
|
|
1567
1618
|
class: "reel-forward-retry",
|
|
1568
1619
|
type: "button",
|
|
1569
1620
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1570
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1621
|
+
}, " Retry ")) : o("", !0)], 8, yt)), t.reelForward.status === "idle" ? (b(), a(W, {
|
|
1571
1622
|
key: 2,
|
|
1572
1623
|
actions: t.feedFooterActions,
|
|
1573
1624
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1576,7 +1627,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1576
1627
|
"has-next": t.hasNext,
|
|
1577
1628
|
"is-loading": t.isLoadingMore,
|
|
1578
1629
|
"load-more-locked": t.loadMoreLocked,
|
|
1579
|
-
"show-load-more":
|
|
1630
|
+
"show-load-more": te.value,
|
|
1580
1631
|
state: t.state,
|
|
1581
1632
|
onLoadMore: r[1] ||= (e) => u("loadMore"),
|
|
1582
1633
|
onRetryEnd: r[2] ||= (e) => u("retryEnd")
|
|
@@ -1590,13 +1641,13 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1590
1641
|
"load-more-locked",
|
|
1591
1642
|
"show-load-more",
|
|
1592
1643
|
"state"
|
|
1593
|
-
])) : o("", !0)], 40,
|
|
1644
|
+
])) : o("", !0)], 40, vt), c("div", {
|
|
1594
1645
|
ref_key: "reelControlsElement",
|
|
1595
1646
|
ref: f,
|
|
1596
1647
|
class: "reel-media-controls-host",
|
|
1597
1648
|
"data-test": "reel-media-controls-host"
|
|
1598
1649
|
}, null, 512)]),
|
|
1599
|
-
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1650
|
+
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
|
|
1600
1651
|
key: 1,
|
|
1601
1652
|
index: g.value,
|
|
1602
1653
|
item: R.value,
|
|
@@ -1618,24 +1669,24 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1618
1669
|
"style",
|
|
1619
1670
|
"total"
|
|
1620
1671
|
])) : o("", !0),
|
|
1621
|
-
|
|
1622
|
-
key:
|
|
1672
|
+
G.value ? (b(), a(gt, {
|
|
1673
|
+
key: U.value,
|
|
1623
1674
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1624
|
-
label:
|
|
1625
|
-
onComplete:
|
|
1675
|
+
label: ee.value,
|
|
1676
|
+
onComplete: X
|
|
1626
1677
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1627
1678
|
], 2));
|
|
1628
1679
|
}
|
|
1629
|
-
}),
|
|
1680
|
+
}), Ct = ["data-info-sheet-open", "data-info-sheet-mode"], wt = ["aria-hidden", "inert"], Tt = {
|
|
1630
1681
|
key: 0,
|
|
1631
1682
|
class: "reel-info-sheet-layer",
|
|
1632
1683
|
"data-test": "reel-info-sheet"
|
|
1633
|
-
},
|
|
1684
|
+
}, Et = [
|
|
1634
1685
|
"role",
|
|
1635
1686
|
"aria-modal",
|
|
1636
1687
|
"tabindex",
|
|
1637
1688
|
"data-active-post-id"
|
|
1638
|
-
],
|
|
1689
|
+
], Dt = /* @__PURE__ */ d({
|
|
1639
1690
|
__name: "ReelLayout",
|
|
1640
1691
|
props: {
|
|
1641
1692
|
forwardIndex: { default: null },
|
|
@@ -1760,7 +1811,7 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1760
1811
|
class: "reel-layout-main",
|
|
1761
1812
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1762
1813
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1763
|
-
}, [u(
|
|
1814
|
+
}, [u(St, {
|
|
1764
1815
|
ref_key: "reelFeed",
|
|
1765
1816
|
ref: p,
|
|
1766
1817
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1811,8 +1862,8 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1811
1862
|
"reel-forward",
|
|
1812
1863
|
"state",
|
|
1813
1864
|
"total"
|
|
1814
|
-
])], 8,
|
|
1815
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
1865
|
+
])], 8, wt), u(n, { name: "vibe-info-sheet" }, {
|
|
1866
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Tt, [c("aside", {
|
|
1816
1867
|
ref_key: "sheetElement",
|
|
1817
1868
|
ref: _,
|
|
1818
1869
|
class: "reel-info-sheet",
|
|
@@ -1821,14 +1872,14 @@ var pt = ["aria-label"], mt = /* @__PURE__ */ d({
|
|
|
1821
1872
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1822
1873
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1823
1874
|
"data-active-post-id": T.value?.postId
|
|
1824
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
1875
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Et)])) : o("", !0)]),
|
|
1825
1876
|
_: 1
|
|
1826
|
-
})], 10,
|
|
1877
|
+
})], 10, Ct));
|
|
1827
1878
|
}
|
|
1828
1879
|
});
|
|
1829
1880
|
//#endregion
|
|
1830
1881
|
//#region src/core/mediaLifecycle.ts
|
|
1831
|
-
function
|
|
1882
|
+
function Ot(e, t, n, r, i) {
|
|
1832
1883
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
1833
1884
|
if (!o) return null;
|
|
1834
1885
|
let s = N(o, n), c = P(o, s);
|
|
@@ -1844,7 +1895,7 @@ function Et(e, t, n, r, i) {
|
|
|
1844
1895
|
postIndex: a
|
|
1845
1896
|
};
|
|
1846
1897
|
}
|
|
1847
|
-
function
|
|
1898
|
+
function kt(e, t) {
|
|
1848
1899
|
O(() => {
|
|
1849
1900
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
1850
1901
|
return {
|
|
@@ -1854,20 +1905,20 @@ function Dt(e, t) {
|
|
|
1854
1905
|
};
|
|
1855
1906
|
}, (n, r) => {
|
|
1856
1907
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
1857
|
-
let i =
|
|
1908
|
+
let i = Ot(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
1858
1909
|
i && t(i);
|
|
1859
1910
|
}, { flush: "sync" });
|
|
1860
1911
|
}
|
|
1861
1912
|
//#endregion
|
|
1862
1913
|
//#region src/components/useMediaLifecycle.ts
|
|
1863
|
-
function
|
|
1914
|
+
function At(e, t) {
|
|
1864
1915
|
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = r(() => e.reelMediaSource === "original" ? i.value : n.value);
|
|
1865
1916
|
function o(e, t, n, r) {
|
|
1866
1917
|
let i = F(t, n);
|
|
1867
1918
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
1868
1919
|
}
|
|
1869
1920
|
function s(t, n, r, i) {
|
|
1870
|
-
return
|
|
1921
|
+
return Ot(e, t, n, r, i);
|
|
1871
1922
|
}
|
|
1872
1923
|
function c(e, n, r, i) {
|
|
1873
1924
|
let a = s(e, n, r, i);
|
|
@@ -1889,7 +1940,7 @@ function Ot(e, t) {
|
|
|
1889
1940
|
let r = s(e, n, "masonry", null);
|
|
1890
1941
|
r && t.visible(r);
|
|
1891
1942
|
}
|
|
1892
|
-
return
|
|
1943
|
+
return kt(e, t.reelChange), O(() => {
|
|
1893
1944
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
1894
1945
|
return {
|
|
1895
1946
|
mediaIndex: n,
|
|
@@ -1914,16 +1965,16 @@ function Ot(e, t) {
|
|
|
1914
1965
|
}
|
|
1915
1966
|
//#endregion
|
|
1916
1967
|
//#region src/core/reelEscapeStack.ts
|
|
1917
|
-
var
|
|
1918
|
-
function
|
|
1919
|
-
return
|
|
1920
|
-
let t =
|
|
1921
|
-
t >= 0 &&
|
|
1968
|
+
var jt = [];
|
|
1969
|
+
function Mt(e) {
|
|
1970
|
+
return jt.push(e), () => {
|
|
1971
|
+
let t = jt.indexOf(e);
|
|
1972
|
+
t >= 0 && jt.splice(t, 1);
|
|
1922
1973
|
};
|
|
1923
1974
|
}
|
|
1924
|
-
function
|
|
1975
|
+
function Nt(e) {
|
|
1925
1976
|
if (!e.isActive()) return !1;
|
|
1926
|
-
let t =
|
|
1977
|
+
let t = jt.filter((e) => e.isActive()), n = e.element();
|
|
1927
1978
|
return n !== null && t.some((t) => {
|
|
1928
1979
|
if (t === e) return !1;
|
|
1929
1980
|
let r = t.element();
|
|
@@ -1939,14 +1990,14 @@ function jt(e) {
|
|
|
1939
1990
|
}
|
|
1940
1991
|
//#endregion
|
|
1941
1992
|
//#region src/components/useReelKeyboard.ts
|
|
1942
|
-
function
|
|
1993
|
+
function Pt(e) {
|
|
1943
1994
|
let t = {
|
|
1944
1995
|
element: e.element,
|
|
1945
1996
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
1946
1997
|
}, n = null;
|
|
1947
1998
|
function r(n) {
|
|
1948
1999
|
let r = t.isActive();
|
|
1949
|
-
if (n.key === "Escape" && r && !
|
|
2000
|
+
if (n.key === "Escape" && r && !Nt(t)) return;
|
|
1950
2001
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
1951
2002
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
1952
2003
|
return;
|
|
@@ -1966,14 +2017,14 @@ function Mt(e) {
|
|
|
1966
2017
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
1967
2018
|
}
|
|
1968
2019
|
y(() => {
|
|
1969
|
-
n =
|
|
2020
|
+
n = Mt(t), window.addEventListener("keydown", r);
|
|
1970
2021
|
}), v(() => {
|
|
1971
2022
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
1972
2023
|
});
|
|
1973
2024
|
}
|
|
1974
2025
|
//#endregion
|
|
1975
2026
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
1976
|
-
var
|
|
2027
|
+
var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
1977
2028
|
__name: "VibeSurface",
|
|
1978
2029
|
props: {
|
|
1979
2030
|
canRetryEnd: { type: Boolean },
|
|
@@ -1982,6 +2033,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
1982
2033
|
feedFooter: {},
|
|
1983
2034
|
feedFooterActions: {},
|
|
1984
2035
|
mediaCard: {},
|
|
2036
|
+
masonry: {},
|
|
1985
2037
|
reelInfoSheet: {},
|
|
1986
2038
|
state: {}
|
|
1987
2039
|
},
|
|
@@ -1998,70 +2050,70 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
1998
2050
|
"retryForward"
|
|
1999
2051
|
],
|
|
2000
2052
|
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(() =>
|
|
2053
|
+
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
2054
|
ready: (e) => d("mediaReady", e),
|
|
2003
2055
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2004
2056
|
visible: (e) => d("mediaVisible", e)
|
|
2005
|
-
}),
|
|
2057
|
+
}), U = new Set(l.state.items.map((e) => e.postId)), W = null, ee = null, G = !1;
|
|
2006
2058
|
function K() {
|
|
2007
2059
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2008
2060
|
}
|
|
2009
|
-
function
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2061
|
+
function ne() {
|
|
2062
|
+
W !== null && cancelAnimationFrame(W), W = requestAnimationFrame(() => {
|
|
2063
|
+
W = requestAnimationFrame(() => {
|
|
2064
|
+
W = null, S.value = /* @__PURE__ */ new Set();
|
|
2013
2065
|
});
|
|
2014
2066
|
});
|
|
2015
2067
|
}
|
|
2016
|
-
function
|
|
2068
|
+
function q(e, t) {
|
|
2017
2069
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2018
2070
|
if (!n) return;
|
|
2019
2071
|
let r = N(n, t);
|
|
2020
2072
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2021
2073
|
}
|
|
2022
|
-
async function
|
|
2074
|
+
async function re() {
|
|
2023
2075
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2024
2076
|
}
|
|
2025
|
-
function
|
|
2077
|
+
function ie(e) {
|
|
2026
2078
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2027
2079
|
}
|
|
2028
|
-
function
|
|
2080
|
+
function ae(e) {
|
|
2029
2081
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2030
2082
|
}
|
|
2031
|
-
function
|
|
2083
|
+
function oe(e) {
|
|
2032
2084
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
2033
2085
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
2034
2086
|
if (!t) return "not-found";
|
|
2035
2087
|
let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
2036
2088
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
2037
2089
|
}
|
|
2038
|
-
function
|
|
2090
|
+
function J() {
|
|
2039
2091
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2040
2092
|
}
|
|
2041
2093
|
function se(e, t) {
|
|
2042
|
-
|
|
2094
|
+
ee = e, G = t === "keyboard", y.value = ue(e), d("openReel", e), m(() => h.value?.focus());
|
|
2043
2095
|
}
|
|
2044
|
-
function
|
|
2096
|
+
function Y(e) {
|
|
2045
2097
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2046
2098
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2047
2099
|
}
|
|
2048
2100
|
function ce(e) {
|
|
2049
2101
|
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
|
|
2050
|
-
let t = [...new Set(e)], n = t.filter(
|
|
2102
|
+
let t = [...new Set(e)], n = t.filter(Y);
|
|
2051
2103
|
if (n.length === 0) return 0;
|
|
2052
2104
|
let r = new Map(D.value);
|
|
2053
2105
|
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,
|
|
2106
|
+
r.set(e, t * Ft);
|
|
2107
|
+
}), 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
2108
|
}
|
|
2057
|
-
function
|
|
2058
|
-
let n =
|
|
2109
|
+
function le(e, t) {
|
|
2110
|
+
let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2059
2111
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2060
2112
|
r.classList.remove("media-card-focus-silent");
|
|
2061
2113
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2062
2114
|
}
|
|
2063
|
-
function
|
|
2064
|
-
let t = g.value, n =
|
|
2115
|
+
function ue(e) {
|
|
2116
|
+
let t = g.value, n = Y(e);
|
|
2065
2117
|
if (t === null || n === null) return {};
|
|
2066
2118
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2067
2119
|
return {
|
|
@@ -2071,40 +2123,40 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2071
2123
|
"--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
|
|
2072
2124
|
};
|
|
2073
2125
|
}
|
|
2074
|
-
function ue() {
|
|
2075
|
-
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2076
|
-
}
|
|
2077
2126
|
function de() {
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2127
|
+
l.state.reelOrigin === "masonry" && (ee ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2128
|
+
}
|
|
2129
|
+
function fe() {
|
|
2130
|
+
let e = ee, t = G;
|
|
2131
|
+
x.value = !1, ee = null, G = !1, y.value = {}, m(() => {
|
|
2132
|
+
e !== null && le(e, t);
|
|
2081
2133
|
});
|
|
2082
2134
|
}
|
|
2083
|
-
return
|
|
2084
|
-
closeMasonryReel:
|
|
2135
|
+
return Pt({
|
|
2136
|
+
closeMasonryReel: de,
|
|
2085
2137
|
element: () => g.value,
|
|
2086
2138
|
isReelLeaving: () => x.value,
|
|
2087
2139
|
reelRenderer: () => p.value,
|
|
2088
2140
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2089
2141
|
state: l.state
|
|
2090
2142
|
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2091
|
-
let t = e.filter((e) => !
|
|
2092
|
-
if (
|
|
2143
|
+
let t = e.filter((e) => !U.has(e)), n = new Set(e);
|
|
2144
|
+
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 || K()) return;
|
|
2093
2145
|
let r = /* @__PURE__ */ new Map();
|
|
2094
2146
|
e.forEach((e) => {
|
|
2095
2147
|
let t = C.value.get(e);
|
|
2096
2148
|
t !== void 0 && r.set(e, t);
|
|
2097
2149
|
}), t.forEach((e, t) => {
|
|
2098
|
-
r.set(e, t *
|
|
2099
|
-
}), C.value = r, S.value = new Set([...S.value, ...t]),
|
|
2150
|
+
r.set(e, t * Ft);
|
|
2151
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), ne();
|
|
2100
2152
|
}, { flush: "sync" }), v(() => {
|
|
2101
|
-
|
|
2153
|
+
W !== null && cancelAnimationFrame(W);
|
|
2102
2154
|
}), i({
|
|
2103
|
-
changeActiveReelMedia:
|
|
2104
|
-
getAutoScrollElement:
|
|
2105
|
-
loadIfNearBottom:
|
|
2106
|
-
moveActiveReelPost:
|
|
2107
|
-
navigateToReelItem:
|
|
2155
|
+
changeActiveReelMedia: ie,
|
|
2156
|
+
getAutoScrollElement: J,
|
|
2157
|
+
loadIfNearBottom: re,
|
|
2158
|
+
moveActiveReelPost: ae,
|
|
2159
|
+
navigateToReelItem: oe,
|
|
2108
2160
|
startItemRemoval: ce,
|
|
2109
2161
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2110
2162
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
@@ -2112,7 +2164,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2112
2164
|
ref_key: "surfaceElement",
|
|
2113
2165
|
ref: g,
|
|
2114
2166
|
class: "vibe-surface"
|
|
2115
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2167
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Dt, {
|
|
2116
2168
|
key: 0,
|
|
2117
2169
|
ref_key: "reelRenderer",
|
|
2118
2170
|
ref: p,
|
|
@@ -2137,25 +2189,25 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2137
2189
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
2138
2190
|
"next-page-error": !!t.state.nextPageError,
|
|
2139
2191
|
origin: "reel",
|
|
2140
|
-
"preview-states": E(
|
|
2192
|
+
"preview-states": E(H),
|
|
2141
2193
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2142
2194
|
"reel-forward": t.state.reelForward,
|
|
2143
|
-
state:
|
|
2195
|
+
state: j.value,
|
|
2144
2196
|
total: t.state.total,
|
|
2145
2197
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
2146
2198
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2147
|
-
onError: E(
|
|
2199
|
+
onError: E(R),
|
|
2148
2200
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2149
|
-
onMediaChange:
|
|
2150
|
-
onReady: E(
|
|
2201
|
+
onMediaChange: q,
|
|
2202
|
+
onReady: E(z),
|
|
2151
2203
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2152
2204
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
2153
|
-
}, 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(
|
|
2205
|
+
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(te, {
|
|
2154
2206
|
key: 1,
|
|
2155
2207
|
actions: t.feedFooterActions,
|
|
2156
2208
|
"can-retry-end": t.canRetryEnd,
|
|
2157
2209
|
"feed-footer": t.feedFooter,
|
|
2158
|
-
state:
|
|
2210
|
+
state: j.value,
|
|
2159
2211
|
onLoadMore: i[5] ||= (e) => d("loadMore"),
|
|
2160
2212
|
onRetryEnd: i[6] ||= (e) => d("retryEnd")
|
|
2161
2213
|
}, null, 8, [
|
|
@@ -2163,7 +2215,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2163
2215
|
"can-retry-end",
|
|
2164
2216
|
"feed-footer",
|
|
2165
2217
|
"state"
|
|
2166
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2218
|
+
])) : (b(), s(e, { key: 2 }, [u(ft, {
|
|
2167
2219
|
ref_key: "masonryRenderer",
|
|
2168
2220
|
ref: f,
|
|
2169
2221
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2176,6 +2228,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2176
2228
|
"feed-footer": t.feedFooter,
|
|
2177
2229
|
"feed-footer-actions": t.feedFooterActions,
|
|
2178
2230
|
"media-card": t.mediaCard,
|
|
2231
|
+
masonry: t.masonry,
|
|
2179
2232
|
"has-next": t.state.next !== null,
|
|
2180
2233
|
"infinite-scroll": t.state.infiniteScroll,
|
|
2181
2234
|
"is-loading-more": t.state.isLoadingMore,
|
|
@@ -2183,17 +2236,17 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2183
2236
|
"load-more-locked": t.state.loadMoreLocked,
|
|
2184
2237
|
"media-indices": t.state.mediaIndices,
|
|
2185
2238
|
"next-page-error": !!t.state.nextPageError,
|
|
2186
|
-
"preview-states": E(
|
|
2239
|
+
"preview-states": E(V),
|
|
2187
2240
|
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2188
|
-
state:
|
|
2241
|
+
state: j.value,
|
|
2189
2242
|
total: t.state.total,
|
|
2190
2243
|
onActivate: se,
|
|
2191
|
-
onError: E(
|
|
2244
|
+
onError: E(F),
|
|
2192
2245
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2193
|
-
onMediaChange:
|
|
2194
|
-
onReady: E(
|
|
2246
|
+
onMediaChange: q,
|
|
2247
|
+
onReady: E(I),
|
|
2195
2248
|
onRetryEnd: i[8] ||= (e) => d("retryEnd"),
|
|
2196
|
-
onVisible: E(
|
|
2249
|
+
onVisible: E(P)
|
|
2197
2250
|
}, null, 8, [
|
|
2198
2251
|
"can-retry-end",
|
|
2199
2252
|
"entering-post-ids",
|
|
@@ -2205,6 +2258,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2205
2258
|
"feed-footer",
|
|
2206
2259
|
"feed-footer-actions",
|
|
2207
2260
|
"media-card",
|
|
2261
|
+
"masonry",
|
|
2208
2262
|
"has-next",
|
|
2209
2263
|
"infinite-scroll",
|
|
2210
2264
|
"is-loading-more",
|
|
@@ -2221,7 +2275,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2221
2275
|
"onVisible"
|
|
2222
2276
|
]), u(n, {
|
|
2223
2277
|
name: "vibe-reel-viewer",
|
|
2224
|
-
onAfterLeave:
|
|
2278
|
+
onAfterLeave: fe
|
|
2225
2279
|
}, {
|
|
2226
2280
|
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2227
2281
|
key: 0,
|
|
@@ -2233,7 +2287,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2233
2287
|
"aria-modal": "true",
|
|
2234
2288
|
tabindex: "-1",
|
|
2235
2289
|
style: _(y.value)
|
|
2236
|
-
}, [u(
|
|
2290
|
+
}, [u(Dt, {
|
|
2237
2291
|
ref_key: "reelRenderer",
|
|
2238
2292
|
ref: p,
|
|
2239
2293
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2257,17 +2311,17 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2257
2311
|
"media-source": "original",
|
|
2258
2312
|
"next-page-error": !!t.state.nextPageError,
|
|
2259
2313
|
origin: "masonry",
|
|
2260
|
-
"preview-states": E(
|
|
2314
|
+
"preview-states": E(B),
|
|
2261
2315
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2262
2316
|
"reel-forward": t.state.reelForward,
|
|
2263
|
-
state:
|
|
2317
|
+
state: j.value,
|
|
2264
2318
|
total: t.state.total,
|
|
2265
2319
|
onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
|
|
2266
2320
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2267
|
-
onError: E(
|
|
2321
|
+
onError: E(R),
|
|
2268
2322
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2269
|
-
onMediaChange:
|
|
2270
|
-
onReady: E(
|
|
2323
|
+
onMediaChange: q,
|
|
2324
|
+
onReady: E(z),
|
|
2271
2325
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2272
2326
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
2273
2327
|
}, 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 +2331,7 @@ var Nt = 35, Pt = 420, Ft = /* @__PURE__ */ d({
|
|
|
2277
2331
|
});
|
|
2278
2332
|
//#endregion
|
|
2279
2333
|
//#region src/core/page.ts
|
|
2280
|
-
function
|
|
2334
|
+
function Rt(e) {
|
|
2281
2335
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2282
2336
|
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
2337
|
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 +2343,32 @@ function Z(e, t) {
|
|
|
2289
2343
|
}
|
|
2290
2344
|
//#endregion
|
|
2291
2345
|
//#region src/core/requestDelay.ts
|
|
2292
|
-
var
|
|
2346
|
+
var zt = 2e3, Bt = 1e4, Vt = 250, Ht = {
|
|
2293
2347
|
delayRemainingMs: null,
|
|
2294
2348
|
nextRequestAt: null
|
|
2295
2349
|
};
|
|
2296
|
-
function
|
|
2350
|
+
function Ut(e, t) {
|
|
2297
2351
|
return e === void 0 ? t : Math.floor(e);
|
|
2298
2352
|
}
|
|
2299
|
-
function
|
|
2353
|
+
function Wt(e, t) {
|
|
2300
2354
|
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
2355
|
}
|
|
2302
|
-
function
|
|
2303
|
-
let n =
|
|
2356
|
+
function Gt(e, t = {}) {
|
|
2357
|
+
let n = Ut(t.delayStepMs, zt), r = Ut(t.delayMaxMs, Bt);
|
|
2304
2358
|
return Math.min(Math.max(0, e) * n, r);
|
|
2305
2359
|
}
|
|
2306
2360
|
function Q(e) {
|
|
2307
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2361
|
+
if (e == null || !Number.isFinite(e)) return { ...Ht };
|
|
2308
2362
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2309
2363
|
return t > 0 ? {
|
|
2310
2364
|
delayRemainingMs: t,
|
|
2311
2365
|
nextRequestAt: e
|
|
2312
|
-
} : { ...
|
|
2366
|
+
} : { ...Ht };
|
|
2313
2367
|
}
|
|
2314
|
-
async function
|
|
2368
|
+
async function Kt({ delayMs: e, onChange: t, signal: n }) {
|
|
2315
2369
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2316
2370
|
if (e <= 0) {
|
|
2317
|
-
t({ ...
|
|
2371
|
+
t({ ...Ht });
|
|
2318
2372
|
return;
|
|
2319
2373
|
}
|
|
2320
2374
|
let r = Date.now() + e;
|
|
@@ -2322,9 +2376,9 @@ async function Wt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2322
2376
|
delayRemainingMs: e,
|
|
2323
2377
|
nextRequestAt: r
|
|
2324
2378
|
}), await new Promise((i, a) => {
|
|
2325
|
-
let o = !1, s = setInterval(f,
|
|
2379
|
+
let o = !1, s = setInterval(f, Vt), c = setTimeout(() => u(), e);
|
|
2326
2380
|
function l() {
|
|
2327
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2381
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Ht });
|
|
2328
2382
|
}
|
|
2329
2383
|
function u(e) {
|
|
2330
2384
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2339,13 +2393,13 @@ async function Wt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2339
2393
|
n.addEventListener("abort", d, { once: !0 });
|
|
2340
2394
|
});
|
|
2341
2395
|
}
|
|
2342
|
-
var
|
|
2396
|
+
var qt = class {
|
|
2343
2397
|
interval = null;
|
|
2344
2398
|
constructor(e) {
|
|
2345
2399
|
this.onChange = e;
|
|
2346
2400
|
}
|
|
2347
2401
|
clear() {
|
|
2348
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2402
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Ht });
|
|
2349
2403
|
}
|
|
2350
2404
|
sync(e) {
|
|
2351
2405
|
this.clear();
|
|
@@ -2353,22 +2407,22 @@ var Gt = class {
|
|
|
2353
2407
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2354
2408
|
let t = Q(e);
|
|
2355
2409
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2356
|
-
},
|
|
2410
|
+
}, Vt));
|
|
2357
2411
|
}
|
|
2358
2412
|
};
|
|
2359
|
-
function
|
|
2413
|
+
function Jt(e, t = !0) {
|
|
2360
2414
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2361
2415
|
}
|
|
2362
|
-
function
|
|
2416
|
+
function Yt(e) {
|
|
2363
2417
|
return `${typeof e}:${String(e)}`;
|
|
2364
2418
|
}
|
|
2365
|
-
function
|
|
2419
|
+
function Xt(e, t) {
|
|
2366
2420
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2367
2421
|
}
|
|
2368
|
-
function
|
|
2422
|
+
function Zt(e) {
|
|
2369
2423
|
if (!e) return;
|
|
2370
|
-
if (
|
|
2371
|
-
|
|
2424
|
+
if (Xt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2425
|
+
Wt(e, "frontend autofill");
|
|
2372
2426
|
let t = e.maxAdditionalPages;
|
|
2373
2427
|
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
2428
|
return;
|
|
@@ -2380,7 +2434,7 @@ function Yt(e) {
|
|
|
2380
2434
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2381
2435
|
}
|
|
2382
2436
|
}
|
|
2383
|
-
function
|
|
2437
|
+
function Qt(e, t, n = !0) {
|
|
2384
2438
|
if (!e) return {
|
|
2385
2439
|
cycleId: null,
|
|
2386
2440
|
delayRemainingMs: null,
|
|
@@ -2414,7 +2468,7 @@ function Xt(e, t, n = !0) {
|
|
|
2414
2468
|
strategy: e.strategy
|
|
2415
2469
|
};
|
|
2416
2470
|
}
|
|
2417
|
-
function
|
|
2471
|
+
function $t(e) {
|
|
2418
2472
|
return [
|
|
2419
2473
|
"cancelling",
|
|
2420
2474
|
"filling",
|
|
@@ -2422,9 +2476,9 @@ function Zt(e) {
|
|
|
2422
2476
|
"waiting"
|
|
2423
2477
|
].includes(e.status);
|
|
2424
2478
|
}
|
|
2425
|
-
async function
|
|
2479
|
+
async function en(e, t, n) {
|
|
2426
2480
|
let r = t.autofill;
|
|
2427
|
-
if (
|
|
2481
|
+
if (!$t(r) || !r.cycleId) return;
|
|
2428
2482
|
let i = {
|
|
2429
2483
|
cycleId: r.cycleId,
|
|
2430
2484
|
feedKey: r.feedKey ?? "",
|
|
@@ -2437,16 +2491,16 @@ async function Qt(e, t, n) {
|
|
|
2437
2491
|
throw r.error = e, r.status = "error", e;
|
|
2438
2492
|
}
|
|
2439
2493
|
}
|
|
2440
|
-
function
|
|
2494
|
+
function tn(e, t, n) {
|
|
2441
2495
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2442
2496
|
}
|
|
2443
|
-
async function
|
|
2444
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2497
|
+
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 }) {
|
|
2498
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Jt(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2445
2499
|
for (; y < h;) {
|
|
2446
|
-
let e =
|
|
2500
|
+
let e = Yt(g);
|
|
2447
2501
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2448
|
-
if (m.add(e), await
|
|
2449
|
-
delayMs:
|
|
2502
|
+
if (m.add(e), await Kt({
|
|
2503
|
+
delayMs: Gt(l + y, s),
|
|
2450
2504
|
onChange: a,
|
|
2451
2505
|
signal: d
|
|
2452
2506
|
}), y > 0 && u()) return {
|
|
@@ -2460,7 +2514,7 @@ async function en({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2460
2514
|
status: "paused",
|
|
2461
2515
|
total: x
|
|
2462
2516
|
};
|
|
2463
|
-
let t =
|
|
2517
|
+
let t = Rt(await n({
|
|
2464
2518
|
cursor: g,
|
|
2465
2519
|
signal: d
|
|
2466
2520
|
}));
|
|
@@ -2517,12 +2571,12 @@ async function en({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2517
2571
|
}
|
|
2518
2572
|
//#endregion
|
|
2519
2573
|
//#region src/core/autofillController.ts
|
|
2520
|
-
var
|
|
2574
|
+
var rn = class {
|
|
2521
2575
|
collection = null;
|
|
2522
2576
|
cycle = 0;
|
|
2523
2577
|
delayCountdown;
|
|
2524
2578
|
constructor(e) {
|
|
2525
|
-
this.context = e, this.delayCountdown = new
|
|
2579
|
+
this.context = e, this.delayCountdown = new qt((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2526
2580
|
}
|
|
2527
2581
|
beginCycle() {
|
|
2528
2582
|
let { options: e, state: t } = this.context;
|
|
@@ -2530,14 +2584,14 @@ var tn = class {
|
|
|
2530
2584
|
this.clear();
|
|
2531
2585
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2532
2586
|
return t.autofill = {
|
|
2533
|
-
...
|
|
2587
|
+
...Qt(e, void 0, !1),
|
|
2534
2588
|
cycleId: n,
|
|
2535
2589
|
status: "filling"
|
|
2536
2590
|
}, n;
|
|
2537
2591
|
}
|
|
2538
2592
|
async cancel() {
|
|
2539
2593
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2540
|
-
await
|
|
2594
|
+
await en(t, n, e), this.commitCollection();
|
|
2541
2595
|
}
|
|
2542
2596
|
captureCollection(e, t) {
|
|
2543
2597
|
t && (this.collection = e);
|
|
@@ -2565,30 +2619,30 @@ var tn = class {
|
|
|
2565
2619
|
requests: r.requests
|
|
2566
2620
|
}));
|
|
2567
2621
|
}
|
|
2568
|
-
},
|
|
2569
|
-
function
|
|
2622
|
+
}, an = 100;
|
|
2623
|
+
function on(e, t) {
|
|
2570
2624
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2571
2625
|
}
|
|
2572
|
-
function
|
|
2626
|
+
function sn(e, t, n) {
|
|
2573
2627
|
return Math.min(n, Math.max(t, e));
|
|
2574
2628
|
}
|
|
2575
|
-
function
|
|
2629
|
+
function cn(e) {
|
|
2576
2630
|
if (!e) return;
|
|
2577
2631
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2578
|
-
if (
|
|
2579
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2632
|
+
if (on("autoScroll.minSpeedPxPerSecond", t), on("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2633
|
+
e.speedPxPerSecond !== void 0 && on("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2580
2634
|
}
|
|
2581
|
-
function
|
|
2635
|
+
function ln(e) {
|
|
2582
2636
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2583
2637
|
return {
|
|
2584
2638
|
enabled: e?.enabled ?? !1,
|
|
2585
2639
|
maxSpeedPxPerSecond: n,
|
|
2586
2640
|
minSpeedPxPerSecond: t,
|
|
2587
2641
|
paused: !1,
|
|
2588
|
-
speedPxPerSecond:
|
|
2642
|
+
speedPxPerSecond: sn(e?.speedPxPerSecond ?? 80, t, n)
|
|
2589
2643
|
};
|
|
2590
2644
|
}
|
|
2591
|
-
var
|
|
2645
|
+
var un = class {
|
|
2592
2646
|
frame = null;
|
|
2593
2647
|
lastTimestamp = null;
|
|
2594
2648
|
mounted = !1;
|
|
@@ -2608,9 +2662,9 @@ var cn = class {
|
|
|
2608
2662
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2609
2663
|
}
|
|
2610
2664
|
setSpeed(e) {
|
|
2611
|
-
|
|
2665
|
+
on("auto-scroll speed", e);
|
|
2612
2666
|
let t = this.options.state;
|
|
2613
|
-
t.speedPxPerSecond =
|
|
2667
|
+
t.speedPxPerSecond = sn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2614
2668
|
}
|
|
2615
2669
|
tick = (e) => {
|
|
2616
2670
|
this.frame = null;
|
|
@@ -2622,7 +2676,7 @@ var cn = class {
|
|
|
2622
2676
|
return;
|
|
2623
2677
|
}
|
|
2624
2678
|
if (this.lastTimestamp !== null) {
|
|
2625
|
-
let r = Math.min(
|
|
2679
|
+
let r = Math.min(an, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2626
2680
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2627
2681
|
}
|
|
2628
2682
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2636,7 +2690,7 @@ var cn = class {
|
|
|
2636
2690
|
};
|
|
2637
2691
|
//#endregion
|
|
2638
2692
|
//#region src/core/backendAutofill.ts
|
|
2639
|
-
async function
|
|
2693
|
+
async function dn(e, t, n, r) {
|
|
2640
2694
|
let i = await e.onUnderfilled(n);
|
|
2641
2695
|
if (!r()) return;
|
|
2642
2696
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2650,19 +2704,19 @@ async function ln(e, t, n, r) {
|
|
|
2650
2704
|
status: "waiting"
|
|
2651
2705
|
});
|
|
2652
2706
|
}
|
|
2653
|
-
function
|
|
2707
|
+
function fn(e, t) {
|
|
2654
2708
|
["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
2709
|
}
|
|
2656
|
-
function
|
|
2710
|
+
function pn(e, t, n) {
|
|
2657
2711
|
let r = t.autofill;
|
|
2658
|
-
return
|
|
2712
|
+
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
2713
|
}
|
|
2660
|
-
function
|
|
2661
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2714
|
+
function mn(e, t, n) {
|
|
2715
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Qt(e, n), fn(t, n), !0);
|
|
2662
2716
|
}
|
|
2663
2717
|
//#endregion
|
|
2664
2718
|
//#region src/core/initialAutofill.ts
|
|
2665
|
-
async function
|
|
2719
|
+
async function hn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2666
2720
|
let c = a.autofill;
|
|
2667
2721
|
if (!c) return;
|
|
2668
2722
|
let l = s.items.length;
|
|
@@ -2675,7 +2729,7 @@ async function pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2675
2729
|
return;
|
|
2676
2730
|
}
|
|
2677
2731
|
if (c.strategy === "backend") {
|
|
2678
|
-
await
|
|
2732
|
+
await dn(c, s, {
|
|
2679
2733
|
cycleId: e,
|
|
2680
2734
|
feedKey: c.feedKey,
|
|
2681
2735
|
items: [...s.items],
|
|
@@ -2692,11 +2746,11 @@ async function pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2692
2746
|
s.autofill.status = "exhausted";
|
|
2693
2747
|
return;
|
|
2694
2748
|
}
|
|
2695
|
-
let u = await
|
|
2749
|
+
let u = await nn({
|
|
2696
2750
|
existingItems: s.items,
|
|
2697
2751
|
initialCursor: s.next,
|
|
2698
2752
|
loadPage: a.loadPage,
|
|
2699
|
-
maximumRequests:
|
|
2753
|
+
maximumRequests: Jt(c, !1),
|
|
2700
2754
|
onCollection: n,
|
|
2701
2755
|
onDelayChange: (e) => {
|
|
2702
2756
|
t() && Object.assign(s.autofill, e);
|
|
@@ -2719,13 +2773,13 @@ async function pn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2719
2773
|
}
|
|
2720
2774
|
//#endregion
|
|
2721
2775
|
//#region src/core/fill.ts
|
|
2722
|
-
function
|
|
2776
|
+
function gn(e) {
|
|
2723
2777
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2724
2778
|
}
|
|
2725
|
-
function
|
|
2779
|
+
function _n(e) {
|
|
2726
2780
|
return `${typeof e}:${String(e)}`;
|
|
2727
2781
|
}
|
|
2728
|
-
function
|
|
2782
|
+
function vn(e) {
|
|
2729
2783
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2730
2784
|
if ("pages" in e) {
|
|
2731
2785
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2734,20 +2788,20 @@ function gn(e) {
|
|
|
2734
2788
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2735
2789
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2736
2790
|
}
|
|
2737
|
-
function
|
|
2791
|
+
function yn(e) {
|
|
2738
2792
|
if (!e) return;
|
|
2739
2793
|
if (e.strategy === "frontend") {
|
|
2740
|
-
|
|
2794
|
+
Wt(e, "frontend fill");
|
|
2741
2795
|
return;
|
|
2742
2796
|
}
|
|
2743
2797
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2744
2798
|
let t = e.initialSession;
|
|
2745
2799
|
if (t) {
|
|
2746
2800
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2747
|
-
|
|
2801
|
+
vn(t.target);
|
|
2748
2802
|
}
|
|
2749
2803
|
}
|
|
2750
|
-
function
|
|
2804
|
+
function bn(e, t, n = !0) {
|
|
2751
2805
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
|
|
2752
2806
|
return {
|
|
2753
2807
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2761,10 +2815,10 @@ function vn(e, t, n = !0) {
|
|
|
2761
2815
|
sessionId: i?.sessionId ?? null,
|
|
2762
2816
|
status: i?.status ?? "idle",
|
|
2763
2817
|
strategy: e?.strategy ?? null,
|
|
2764
|
-
target: i ?
|
|
2818
|
+
target: i ? gn(i.target) : null
|
|
2765
2819
|
};
|
|
2766
2820
|
}
|
|
2767
|
-
function
|
|
2821
|
+
function xn(e) {
|
|
2768
2822
|
return [
|
|
2769
2823
|
"cancelling",
|
|
2770
2824
|
"filling",
|
|
@@ -2772,13 +2826,13 @@ function yn(e) {
|
|
|
2772
2826
|
"waiting"
|
|
2773
2827
|
].includes(e.status);
|
|
2774
2828
|
}
|
|
2775
|
-
async function
|
|
2829
|
+
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
2830
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
2777
2831
|
for (; _ !== null;) {
|
|
2778
|
-
let e =
|
|
2832
|
+
let e = _n(h);
|
|
2779
2833
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2780
|
-
if (p.add(e), await
|
|
2781
|
-
delayMs:
|
|
2834
|
+
if (p.add(e), await Kt({
|
|
2835
|
+
delayMs: Gt(m, o),
|
|
2782
2836
|
onChange: i,
|
|
2783
2837
|
signal: c
|
|
2784
2838
|
}), m > 0 && s()) return {
|
|
@@ -2791,7 +2845,7 @@ async function bn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
2791
2845
|
status: "paused",
|
|
2792
2846
|
total: y
|
|
2793
2847
|
};
|
|
2794
|
-
let t =
|
|
2848
|
+
let t = Rt(await n({
|
|
2795
2849
|
cursor: h,
|
|
2796
2850
|
signal: c
|
|
2797
2851
|
}));
|
|
@@ -2859,7 +2913,7 @@ async function bn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
2859
2913
|
}
|
|
2860
2914
|
//#endregion
|
|
2861
2915
|
//#region src/core/backendFill.ts
|
|
2862
|
-
async function
|
|
2916
|
+
async function Cn(e, t, n, r) {
|
|
2863
2917
|
let i = await e.onStart(n);
|
|
2864
2918
|
if (r()) {
|
|
2865
2919
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2873,22 +2927,22 @@ async function xn(e, t, n, r) {
|
|
|
2873
2927
|
});
|
|
2874
2928
|
}
|
|
2875
2929
|
}
|
|
2876
|
-
function
|
|
2930
|
+
function wn(e, t, n) {
|
|
2877
2931
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2878
2932
|
}
|
|
2879
|
-
function
|
|
2933
|
+
function Tn(e) {
|
|
2880
2934
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2881
2935
|
}
|
|
2882
|
-
function
|
|
2936
|
+
function En(e, t) {
|
|
2883
2937
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2884
2938
|
let n = e.fill.target;
|
|
2885
2939
|
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
2940
|
}
|
|
2887
|
-
function
|
|
2941
|
+
function Dn(e, t, n) {
|
|
2888
2942
|
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
2943
|
}
|
|
2890
|
-
function
|
|
2891
|
-
return !
|
|
2944
|
+
function On(e, t, n, r) {
|
|
2945
|
+
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
2946
|
...Q(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2893
2947
|
completedPages: n.completedPages,
|
|
2894
2948
|
error: n.error ?? null,
|
|
@@ -2897,42 +2951,42 @@ function En(e, t, n, r) {
|
|
|
2897
2951
|
status: n.status
|
|
2898
2952
|
}), !0);
|
|
2899
2953
|
}
|
|
2900
|
-
function
|
|
2954
|
+
function kn(e, t, n, r) {
|
|
2901
2955
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2902
2956
|
let i = t.fill;
|
|
2903
|
-
return t.fill =
|
|
2957
|
+
return t.fill = bn(e, n), !Tn(n) || !En(t, n) ? (t.fill = i, !1) : (Dn(t, n, r), !0);
|
|
2904
2958
|
}
|
|
2905
2959
|
//#endregion
|
|
2906
2960
|
//#region src/core/fillController.ts
|
|
2907
|
-
var
|
|
2961
|
+
var An = class {
|
|
2908
2962
|
abortController = null;
|
|
2909
2963
|
cycle = 0;
|
|
2910
2964
|
delayCountdown;
|
|
2911
2965
|
requestVersion = 0;
|
|
2912
2966
|
collection = null;
|
|
2913
2967
|
constructor(e) {
|
|
2914
|
-
this.options = e, this.delayCountdown = new
|
|
2968
|
+
this.options = e, this.delayCountdown = new qt((e) => {
|
|
2915
2969
|
Object.assign(this.options.state.fill, e);
|
|
2916
2970
|
}), this.syncBackendCountdown();
|
|
2917
2971
|
}
|
|
2918
2972
|
isActive() {
|
|
2919
|
-
return
|
|
2973
|
+
return xn(this.options.state.fill);
|
|
2920
2974
|
}
|
|
2921
2975
|
applyUpdate(e) {
|
|
2922
|
-
let t =
|
|
2976
|
+
let t = On(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2923
2977
|
return t && this.syncBackendCountdown(), t;
|
|
2924
2978
|
}
|
|
2925
2979
|
restoreSession(e) {
|
|
2926
|
-
let t =
|
|
2980
|
+
let t = kn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2927
2981
|
return t && this.syncBackendCountdown(), t;
|
|
2928
2982
|
}
|
|
2929
2983
|
async start(e) {
|
|
2930
2984
|
let t = this.options.fill;
|
|
2931
2985
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2932
2986
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2933
|
-
let n =
|
|
2987
|
+
let n = vn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2934
2988
|
if (this.options.state.fill = {
|
|
2935
|
-
...
|
|
2989
|
+
...bn(t, void 0, !1),
|
|
2936
2990
|
cycleId: r,
|
|
2937
2991
|
status: "filling",
|
|
2938
2992
|
target: n
|
|
@@ -2943,7 +2997,7 @@ var On = class {
|
|
|
2943
2997
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2944
2998
|
this.abortController = a;
|
|
2945
2999
|
try {
|
|
2946
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
3000
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await Cn(t, this.options.state, {
|
|
2947
3001
|
cycleId: r,
|
|
2948
3002
|
feedKey: t.feedKey,
|
|
2949
3003
|
items: [...this.options.state.items],
|
|
@@ -2961,7 +3015,7 @@ var On = class {
|
|
|
2961
3015
|
}
|
|
2962
3016
|
async cancel() {
|
|
2963
3017
|
let { fill: e, state: t } = this.options;
|
|
2964
|
-
if (!
|
|
3018
|
+
if (!xn(t.fill) || !t.fill.cycleId) return;
|
|
2965
3019
|
let n = {
|
|
2966
3020
|
cycleId: t.fill.cycleId,
|
|
2967
3021
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -2975,7 +3029,7 @@ var On = class {
|
|
|
2975
3029
|
}
|
|
2976
3030
|
}
|
|
2977
3031
|
reset() {
|
|
2978
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3032
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = bn(this.options.fill, void 0, !1), this.collection = null;
|
|
2979
3033
|
}
|
|
2980
3034
|
destroy() {
|
|
2981
3035
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2991,7 +3045,7 @@ var On = class {
|
|
|
2991
3045
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2992
3046
|
let a = this.options.state;
|
|
2993
3047
|
a.isLoadingMore = !0;
|
|
2994
|
-
let o = await
|
|
3048
|
+
let o = await Sn({
|
|
2995
3049
|
existingItems: a.items,
|
|
2996
3050
|
initialCursor: a.next,
|
|
2997
3051
|
loadPage: i,
|
|
@@ -3031,7 +3085,7 @@ var On = class {
|
|
|
3031
3085
|
};
|
|
3032
3086
|
//#endregion
|
|
3033
3087
|
//#region src/core/feedFooter.ts
|
|
3034
|
-
function
|
|
3088
|
+
function jn(e) {
|
|
3035
3089
|
return {
|
|
3036
3090
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3037
3091
|
loadMore: () => e.loadNext(),
|
|
@@ -3039,45 +3093,45 @@ function kn(e) {
|
|
|
3039
3093
|
retryEnd: () => e.retryEnd()
|
|
3040
3094
|
};
|
|
3041
3095
|
}
|
|
3042
|
-
function
|
|
3096
|
+
function Mn(e) {
|
|
3043
3097
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3044
3098
|
}
|
|
3045
|
-
function
|
|
3046
|
-
e?.intervalMs !== void 0 &&
|
|
3099
|
+
function Nn(e) {
|
|
3100
|
+
e?.intervalMs !== void 0 && Mn(e.intervalMs);
|
|
3047
3101
|
}
|
|
3048
|
-
function
|
|
3102
|
+
function Pn(e) {
|
|
3049
3103
|
return {
|
|
3050
3104
|
enabled: e?.enabled ?? !1,
|
|
3051
3105
|
includePostItems: e?.includePostItems ?? !1,
|
|
3052
3106
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3053
3107
|
};
|
|
3054
3108
|
}
|
|
3055
|
-
function
|
|
3109
|
+
function Fn(e, t) {
|
|
3056
3110
|
if (typeof t == "boolean") {
|
|
3057
3111
|
e.enabled = t;
|
|
3058
3112
|
return;
|
|
3059
3113
|
}
|
|
3060
|
-
|
|
3114
|
+
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
3115
|
}
|
|
3062
3116
|
//#endregion
|
|
3063
3117
|
//#region src/core/reelInfoSheet.ts
|
|
3064
|
-
function
|
|
3118
|
+
function In(e) {
|
|
3065
3119
|
return { enabled: e?.enabled ?? !1 };
|
|
3066
3120
|
}
|
|
3067
|
-
function
|
|
3121
|
+
function Ln(e, t, n) {
|
|
3068
3122
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3069
3123
|
e.enabled = n;
|
|
3070
3124
|
}
|
|
3071
3125
|
//#endregion
|
|
3072
3126
|
//#region src/core/initialRuntimeState.ts
|
|
3073
|
-
function
|
|
3127
|
+
function Rn(e, t) {
|
|
3074
3128
|
let n = e.initialPage;
|
|
3075
3129
|
return {
|
|
3076
3130
|
activeReelPostId: null,
|
|
3077
|
-
autoScroll:
|
|
3078
|
-
autofill:
|
|
3131
|
+
autoScroll: ln(e.autoScroll),
|
|
3132
|
+
autofill: Qt(e.autofill),
|
|
3079
3133
|
error: null,
|
|
3080
|
-
fill:
|
|
3134
|
+
fill: bn(e.fill),
|
|
3081
3135
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3082
3136
|
isLoading: !n,
|
|
3083
3137
|
isLoadingMore: !1,
|
|
@@ -3088,14 +3142,14 @@ function In(e, t) {
|
|
|
3088
3142
|
next: n?.next ?? null,
|
|
3089
3143
|
nextPageError: null,
|
|
3090
3144
|
phoneMode: !1,
|
|
3091
|
-
reelAutoAdvance:
|
|
3145
|
+
reelAutoAdvance: Pn(e.reelAutoAdvance),
|
|
3092
3146
|
reelForward: {
|
|
3093
3147
|
error: null,
|
|
3094
3148
|
status: "idle"
|
|
3095
3149
|
},
|
|
3096
3150
|
reelForwardIndex: null,
|
|
3097
3151
|
reelForwardItem: null,
|
|
3098
|
-
reelInfoSheet:
|
|
3152
|
+
reelInfoSheet: In(e.reelInfoSheet),
|
|
3099
3153
|
reelInfoSheetOverlay: !1,
|
|
3100
3154
|
reelMediaSource: "original",
|
|
3101
3155
|
reelOrigin: null,
|
|
@@ -3104,20 +3158,20 @@ function In(e, t) {
|
|
|
3104
3158
|
}
|
|
3105
3159
|
//#endregion
|
|
3106
3160
|
//#region src/core/options.ts
|
|
3107
|
-
function
|
|
3161
|
+
function zn(e, t) {
|
|
3108
3162
|
if (t) {
|
|
3109
3163
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3110
3164
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3111
3165
|
}
|
|
3112
3166
|
}
|
|
3113
|
-
function
|
|
3167
|
+
function Bn(e, t) {
|
|
3114
3168
|
if (t) {
|
|
3115
3169
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3116
3170
|
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
3171
|
}
|
|
3118
3172
|
}
|
|
3119
|
-
function
|
|
3120
|
-
if (
|
|
3173
|
+
function Vn(e) {
|
|
3174
|
+
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), J(e.masonry), Nn(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3121
3175
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3122
3176
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3123
3177
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3131,7 +3185,7 @@ function zn(e) {
|
|
|
3131
3185
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3132
3186
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3133
3187
|
}
|
|
3134
|
-
function
|
|
3188
|
+
function Hn(e) {
|
|
3135
3189
|
if (typeof e != "string") return e;
|
|
3136
3190
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3137
3191
|
let t = document.querySelector(e);
|
|
@@ -3140,7 +3194,7 @@ function Bn(e) {
|
|
|
3140
3194
|
}
|
|
3141
3195
|
//#endregion
|
|
3142
3196
|
//#region src/core/pageRequest.ts
|
|
3143
|
-
async function
|
|
3197
|
+
async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3144
3198
|
let u = s.autofill, d = e && u?.strategy === "frontend" && l.autofill.status === "paused", f = d ? {
|
|
3145
3199
|
received: l.autofill.received,
|
|
3146
3200
|
requests: l.autofill.requests
|
|
@@ -3152,11 +3206,11 @@ async function Vn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3152
3206
|
let m = !1;
|
|
3153
3207
|
try {
|
|
3154
3208
|
if (u?.strategy === "frontend") {
|
|
3155
|
-
let s = await
|
|
3209
|
+
let s = await nn({
|
|
3156
3210
|
existingItems: e ? l.items : [],
|
|
3157
3211
|
initialCursor: n,
|
|
3158
3212
|
loadPage: i,
|
|
3159
|
-
maximumRequests: f ? Math.max(0,
|
|
3213
|
+
maximumRequests: f ? Math.max(0, Jt(u) - f.requests) : void 0,
|
|
3160
3214
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3161
3215
|
onDelayChange: (e) => {
|
|
3162
3216
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3179,7 +3233,7 @@ async function Vn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3179
3233
|
}), o(s.pages), t.clearCollection();
|
|
3180
3234
|
return;
|
|
3181
3235
|
}
|
|
3182
|
-
let s =
|
|
3236
|
+
let s = Rt(await i({
|
|
3183
3237
|
cursor: n,
|
|
3184
3238
|
signal: c
|
|
3185
3239
|
}));
|
|
@@ -3199,7 +3253,7 @@ async function Vn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3199
3253
|
l.autofill.status = "complete";
|
|
3200
3254
|
return;
|
|
3201
3255
|
}
|
|
3202
|
-
await
|
|
3256
|
+
await dn(u, l, {
|
|
3203
3257
|
cycleId: p,
|
|
3204
3258
|
feedKey: u.feedKey,
|
|
3205
3259
|
items: h.slice(d.length),
|
|
@@ -3223,13 +3277,13 @@ async function Vn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3223
3277
|
function $(e) {
|
|
3224
3278
|
return `${typeof e}:${String(e)}`;
|
|
3225
3279
|
}
|
|
3226
|
-
function
|
|
3280
|
+
function Wn(e) {
|
|
3227
3281
|
return `${typeof e}:${String(e)}`;
|
|
3228
3282
|
}
|
|
3229
|
-
function
|
|
3283
|
+
function Gn(e) {
|
|
3230
3284
|
return e.map(({ postId: e }) => e);
|
|
3231
3285
|
}
|
|
3232
|
-
var
|
|
3286
|
+
var Kn = class {
|
|
3233
3287
|
delay;
|
|
3234
3288
|
enabled;
|
|
3235
3289
|
maxReplayPages;
|
|
@@ -3271,14 +3325,14 @@ var Wn = class {
|
|
|
3271
3325
|
async reconcile({ existingItems: e, loadPage: t, shouldPause: n = () => !1, signal: r }) {
|
|
3272
3326
|
let i = this.pending ?? this.createSession(e);
|
|
3273
3327
|
for (this.pending = i; i.remainingRequests > 0;) {
|
|
3274
|
-
let e =
|
|
3328
|
+
let e = Wn(i.cursor);
|
|
3275
3329
|
if (i.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3276
|
-
if (await
|
|
3277
|
-
delayMs:
|
|
3330
|
+
if (await Kt({
|
|
3331
|
+
delayMs: Gt(i.pages.length, this.delay),
|
|
3278
3332
|
onChange: () => void 0,
|
|
3279
3333
|
signal: r
|
|
3280
3334
|
}), i.pages.length > 0 && n()) return this.result(i, "paused");
|
|
3281
|
-
let a =
|
|
3335
|
+
let a = Rt(await t({
|
|
3282
3336
|
cursor: i.cursor,
|
|
3283
3337
|
signal: r
|
|
3284
3338
|
}));
|
|
@@ -3291,7 +3345,7 @@ var Wn = class {
|
|
|
3291
3345
|
contributionIds: s,
|
|
3292
3346
|
cursor: i.cursor,
|
|
3293
3347
|
next: a.next,
|
|
3294
|
-
returnedIds:
|
|
3348
|
+
returnedIds: Gn(o)
|
|
3295
3349
|
}), 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
3350
|
}
|
|
3297
3351
|
return this.result(i, "complete");
|
|
@@ -3330,7 +3384,7 @@ var Wn = class {
|
|
|
3330
3384
|
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
|
|
3331
3385
|
}
|
|
3332
3386
|
recordPage(e) {
|
|
3333
|
-
let t =
|
|
3387
|
+
let t = Wn(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Wn(e) === t);
|
|
3334
3388
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3335
3389
|
...e,
|
|
3336
3390
|
contributionIds: [...e.contributionIds],
|
|
@@ -3340,7 +3394,7 @@ var Wn = class {
|
|
|
3340
3394
|
};
|
|
3341
3395
|
//#endregion
|
|
3342
3396
|
//#region src/core/activeItemRemoval.ts
|
|
3343
|
-
function
|
|
3397
|
+
function qn(e, t, n, r, i) {
|
|
3344
3398
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3345
3399
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3346
3400
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3353,7 +3407,7 @@ function Gn(e, t, n, r, i) {
|
|
|
3353
3407
|
}
|
|
3354
3408
|
//#endregion
|
|
3355
3409
|
//#region src/core/exactMediaRemovalController.ts
|
|
3356
|
-
function
|
|
3410
|
+
function Jn(e, t) {
|
|
3357
3411
|
let [n, ...r] = t;
|
|
3358
3412
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3359
3413
|
return {
|
|
@@ -3362,10 +3416,10 @@ function Kn(e, t) {
|
|
|
3362
3416
|
items: r
|
|
3363
3417
|
};
|
|
3364
3418
|
}
|
|
3365
|
-
function
|
|
3419
|
+
function Yn(e) {
|
|
3366
3420
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3367
3421
|
}
|
|
3368
|
-
var
|
|
3422
|
+
var Xn = class {
|
|
3369
3423
|
generation = 0;
|
|
3370
3424
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3371
3425
|
state;
|
|
@@ -3373,7 +3427,7 @@ var Jn = class {
|
|
|
3373
3427
|
this.options = e, this.state = e.state;
|
|
3374
3428
|
}
|
|
3375
3429
|
remove(e) {
|
|
3376
|
-
|
|
3430
|
+
Yn(e);
|
|
3377
3431
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3378
3432
|
if (!n) return null;
|
|
3379
3433
|
let r = [...M(n)], i = r[e.mediaIndex];
|
|
@@ -3390,7 +3444,7 @@ var Jn = class {
|
|
|
3390
3444
|
restored: !1
|
|
3391
3445
|
});
|
|
3392
3446
|
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] =
|
|
3447
|
+
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
3448
|
}
|
|
3395
3449
|
reset() {
|
|
3396
3450
|
this.generation += 1;
|
|
@@ -3416,7 +3470,7 @@ var Jn = class {
|
|
|
3416
3470
|
}
|
|
3417
3471
|
restoreIntoPost(e, t) {
|
|
3418
3472
|
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] =
|
|
3473
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Jn(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3420
3474
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3421
3475
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3422
3476
|
}
|
|
@@ -3429,18 +3483,18 @@ var Jn = class {
|
|
|
3429
3483
|
};
|
|
3430
3484
|
//#endregion
|
|
3431
3485
|
//#region src/core/itemPlacement.ts
|
|
3432
|
-
function
|
|
3486
|
+
function Zn(e, t) {
|
|
3433
3487
|
let n = new Set(t);
|
|
3434
3488
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3435
3489
|
index: t,
|
|
3436
3490
|
item: e
|
|
3437
3491
|
}] : []);
|
|
3438
3492
|
}
|
|
3439
|
-
function
|
|
3493
|
+
function Qn(e, t) {
|
|
3440
3494
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3441
3495
|
return e.filter((e) => !n.has(e.postId));
|
|
3442
3496
|
}
|
|
3443
|
-
function
|
|
3497
|
+
function $n(e, t) {
|
|
3444
3498
|
t.forEach(({ index: e }) => {
|
|
3445
3499
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3446
3500
|
});
|
|
@@ -3451,7 +3505,7 @@ function Zn(e, t) {
|
|
|
3451
3505
|
}
|
|
3452
3506
|
//#endregion
|
|
3453
3507
|
//#region src/core/itemRemovalController.ts
|
|
3454
|
-
var
|
|
3508
|
+
var er = 20, tr = class {
|
|
3455
3509
|
generation = 0;
|
|
3456
3510
|
historyLimit;
|
|
3457
3511
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3460,7 +3514,7 @@ var Qn = 20, $n = class {
|
|
|
3460
3514
|
itemOrder;
|
|
3461
3515
|
stopItemsWatcher;
|
|
3462
3516
|
constructor(e) {
|
|
3463
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3517
|
+
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
3518
|
}
|
|
3465
3519
|
destroy() {
|
|
3466
3520
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -3473,7 +3527,7 @@ var Qn = 20, $n = class {
|
|
|
3473
3527
|
let i = this.options.startRemoval(r);
|
|
3474
3528
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
3475
3529
|
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 =
|
|
3530
|
+
return this.state.items = Qn(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
|
|
3477
3531
|
}
|
|
3478
3532
|
reset() {
|
|
3479
3533
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3484,7 +3538,7 @@ var Qn = 20, $n = class {
|
|
|
3484
3538
|
this.restoreRemoval(t);
|
|
3485
3539
|
return;
|
|
3486
3540
|
}
|
|
3487
|
-
let n =
|
|
3541
|
+
let n = $n(this.state.items, e);
|
|
3488
3542
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
3489
3543
|
}
|
|
3490
3544
|
restoreRemoval(e) {
|
|
@@ -3510,7 +3564,7 @@ var Qn = 20, $n = class {
|
|
|
3510
3564
|
}
|
|
3511
3565
|
collectOrderedPlacements(e) {
|
|
3512
3566
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3513
|
-
return
|
|
3567
|
+
return Zn(this.state.items, e).map((e) => ({
|
|
3514
3568
|
index: t.get(e.item.postId) ?? e.index,
|
|
3515
3569
|
item: e.item
|
|
3516
3570
|
}));
|
|
@@ -3541,7 +3595,7 @@ var Qn = 20, $n = class {
|
|
|
3541
3595
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3542
3596
|
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
3597
|
}
|
|
3544
|
-
},
|
|
3598
|
+
}, nr = class {
|
|
3545
3599
|
forward = null;
|
|
3546
3600
|
forwardPromise = null;
|
|
3547
3601
|
forwardVersion = 0;
|
|
@@ -3619,7 +3673,7 @@ var Qn = 20, $n = class {
|
|
|
3619
3673
|
}
|
|
3620
3674
|
}
|
|
3621
3675
|
}
|
|
3622
|
-
},
|
|
3676
|
+
}, rr = class {
|
|
3623
3677
|
generation = 0;
|
|
3624
3678
|
pending = Promise.resolve();
|
|
3625
3679
|
constructor(e) {
|
|
@@ -3669,24 +3723,24 @@ var Qn = 20, $n = class {
|
|
|
3669
3723
|
};
|
|
3670
3724
|
//#endregion
|
|
3671
3725
|
//#region src/core/removalControllers.ts
|
|
3672
|
-
function
|
|
3673
|
-
let t = new
|
|
3726
|
+
function ir(e) {
|
|
3727
|
+
let t = new nr(e), n = new rr({
|
|
3674
3728
|
state: e.state,
|
|
3675
3729
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3676
3730
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3677
3731
|
});
|
|
3678
3732
|
return {
|
|
3679
|
-
exactMediaRemoval: new
|
|
3733
|
+
exactMediaRemoval: new Xn({
|
|
3680
3734
|
onActivate: e.onActivate,
|
|
3681
3735
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
3682
3736
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
3683
3737
|
reelForward: t,
|
|
3684
3738
|
state: e.state
|
|
3685
3739
|
}),
|
|
3686
|
-
itemRemoval: new
|
|
3740
|
+
itemRemoval: new tr({
|
|
3687
3741
|
historyLimit: e.historyLimit,
|
|
3688
3742
|
onItemsRemoved: (n, r, i) => {
|
|
3689
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
3743
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), qn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3690
3744
|
},
|
|
3691
3745
|
onRemovalRestored: (n) => {
|
|
3692
3746
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -3701,17 +3755,17 @@ function nr(e) {
|
|
|
3701
3755
|
reelRemoval: n
|
|
3702
3756
|
};
|
|
3703
3757
|
}
|
|
3704
|
-
var
|
|
3705
|
-
function
|
|
3758
|
+
var ar = 1.5;
|
|
3759
|
+
function or(e) {
|
|
3706
3760
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3707
3761
|
if (t > 0 && t < 600) return !0;
|
|
3708
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3762
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * ar;
|
|
3709
3763
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3710
3764
|
}
|
|
3711
|
-
function
|
|
3712
|
-
return
|
|
3765
|
+
function sr(e) {
|
|
3766
|
+
return or(e) ? "reel" : "masonry";
|
|
3713
3767
|
}
|
|
3714
|
-
function
|
|
3768
|
+
function cr(e) {
|
|
3715
3769
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3716
3770
|
return {
|
|
3717
3771
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3721,15 +3775,15 @@ function or(e) {
|
|
|
3721
3775
|
viewportWidth: n.clientWidth
|
|
3722
3776
|
};
|
|
3723
3777
|
}
|
|
3724
|
-
function
|
|
3725
|
-
return
|
|
3778
|
+
function lr(e) {
|
|
3779
|
+
return or(cr(e));
|
|
3726
3780
|
}
|
|
3727
|
-
function
|
|
3728
|
-
return
|
|
3781
|
+
function ur(e) {
|
|
3782
|
+
return sr(cr(e));
|
|
3729
3783
|
}
|
|
3730
3784
|
//#endregion
|
|
3731
3785
|
//#region src/core/responsiveLayoutController.ts
|
|
3732
|
-
var
|
|
3786
|
+
var dr = class {
|
|
3733
3787
|
layoutMode;
|
|
3734
3788
|
resizeObserver = null;
|
|
3735
3789
|
target = null;
|
|
@@ -3754,10 +3808,10 @@ var lr = class {
|
|
|
3754
3808
|
}
|
|
3755
3809
|
handleResponsiveLayout = () => {
|
|
3756
3810
|
if (!this.target) return;
|
|
3757
|
-
let e =
|
|
3758
|
-
this.state.phoneMode =
|
|
3811
|
+
let e = ur(this.target);
|
|
3812
|
+
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
3813
|
};
|
|
3760
|
-
},
|
|
3814
|
+
}, fr = class {
|
|
3761
3815
|
routedReelPostId = null;
|
|
3762
3816
|
reelRouteIsActive = !1;
|
|
3763
3817
|
constructor(e, t) {
|
|
@@ -3784,7 +3838,7 @@ var lr = class {
|
|
|
3784
3838
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3785
3839
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3786
3840
|
}
|
|
3787
|
-
},
|
|
3841
|
+
}, pr = class {
|
|
3788
3842
|
app = null;
|
|
3789
3843
|
autoScroll;
|
|
3790
3844
|
autofillController;
|
|
@@ -3802,14 +3856,15 @@ var lr = class {
|
|
|
3802
3856
|
surface = null;
|
|
3803
3857
|
stopStateWatcher = null;
|
|
3804
3858
|
lastLoadedCursor = null;
|
|
3859
|
+
notificationItems;
|
|
3805
3860
|
state;
|
|
3806
3861
|
constructor(e) {
|
|
3807
|
-
this.options = e,
|
|
3862
|
+
this.options = e, Vn(e);
|
|
3808
3863
|
let t = e.layout ?? "masonry";
|
|
3809
|
-
this.state = x(
|
|
3864
|
+
this.state = x(Rn(e, t)), this.notificationItems = I(this.state), this.autoScroll = new un({
|
|
3810
3865
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3811
3866
|
state: this.state.autoScroll
|
|
3812
|
-
}), this.autofillController = new
|
|
3867
|
+
}), this.autofillController = new rn({
|
|
3813
3868
|
cancelRequest: () => this.cancelRequest(),
|
|
3814
3869
|
onLastCursor: (e) => {
|
|
3815
3870
|
this.lastLoadedCursor = e;
|
|
@@ -3817,7 +3872,7 @@ var lr = class {
|
|
|
3817
3872
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3818
3873
|
options: e.autofill,
|
|
3819
3874
|
state: this.state
|
|
3820
|
-
}), this.removalReconciliation = new
|
|
3875
|
+
}), this.removalReconciliation = new Kn(e), this.fillController = new An({
|
|
3821
3876
|
fill: e.fill,
|
|
3822
3877
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
3823
3878
|
onLastCursor: (e) => {
|
|
@@ -3825,8 +3880,8 @@ var lr = class {
|
|
|
3825
3880
|
},
|
|
3826
3881
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3827
3882
|
state: this.state
|
|
3828
|
-
}), this.routing = new
|
|
3829
|
-
let n =
|
|
3883
|
+
}), this.routing = new fr(e.routing, this.state);
|
|
3884
|
+
let n = ir({
|
|
3830
3885
|
historyLimit: e.removalHistoryLimit,
|
|
3831
3886
|
loadNext: () => this.loadNext(),
|
|
3832
3887
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
@@ -3836,21 +3891,22 @@ var lr = class {
|
|
|
3836
3891
|
state: this.state,
|
|
3837
3892
|
surface: () => this.surface
|
|
3838
3893
|
});
|
|
3839
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
3894
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new dr(t, this.state, () => {
|
|
3840
3895
|
this.routing.syncFeed();
|
|
3841
3896
|
}), this.startStateNotifications();
|
|
3842
3897
|
}
|
|
3843
3898
|
async mount() {
|
|
3844
3899
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3845
3900
|
this.startStateNotifications();
|
|
3846
|
-
let e =
|
|
3847
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
3901
|
+
let e = Hn(this.options.target);
|
|
3902
|
+
this.responsiveLayout.mount(e), this.app = i(Lt, {
|
|
3848
3903
|
canRetryEnd: !!this.options.loadPage,
|
|
3849
3904
|
cardFooter: this.options.cardFooter,
|
|
3850
3905
|
cardHeader: this.options.cardHeader,
|
|
3851
3906
|
feedFooter: this.options.feedFooter,
|
|
3852
|
-
feedFooterActions:
|
|
3907
|
+
feedFooterActions: jn(this),
|
|
3853
3908
|
mediaCard: this.options.mediaCard,
|
|
3909
|
+
masonry: this.options.masonry,
|
|
3854
3910
|
onMediaReady: this.options.onMediaReady,
|
|
3855
3911
|
onMediaVisible: this.options.onMediaVisible,
|
|
3856
3912
|
onReelMediaChange: this.options.onReelMediaChange,
|
|
@@ -3877,7 +3933,7 @@ var lr = class {
|
|
|
3877
3933
|
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
3934
|
}
|
|
3879
3935
|
getState() {
|
|
3880
|
-
return
|
|
3936
|
+
return L(this.state);
|
|
3881
3937
|
}
|
|
3882
3938
|
removeMedia(e) {
|
|
3883
3939
|
return this.exactMediaRemoval.remove(e);
|
|
@@ -3931,7 +3987,7 @@ var lr = class {
|
|
|
3931
3987
|
this.autoScroll.setSpeed(e);
|
|
3932
3988
|
}
|
|
3933
3989
|
applyAutofillUpdate(e) {
|
|
3934
|
-
let t =
|
|
3990
|
+
let t = pn(this.options.autofill, this.state, e);
|
|
3935
3991
|
return t && this.autofillController.syncCountdown(), t;
|
|
3936
3992
|
}
|
|
3937
3993
|
cancelAutofill() {
|
|
@@ -3942,7 +3998,7 @@ var lr = class {
|
|
|
3942
3998
|
await this.cancelFill();
|
|
3943
3999
|
return;
|
|
3944
4000
|
}
|
|
3945
|
-
if (
|
|
4001
|
+
if ($t(this.state.autofill)) {
|
|
3946
4002
|
await this.cancelAutofill();
|
|
3947
4003
|
return;
|
|
3948
4004
|
}
|
|
@@ -3956,12 +4012,12 @@ var lr = class {
|
|
|
3956
4012
|
}
|
|
3957
4013
|
async fill(e) {
|
|
3958
4014
|
if (!this.state.loadMoreLocked) {
|
|
3959
|
-
if (this.pendingRequest ||
|
|
4015
|
+
if (this.pendingRequest || $t(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
3960
4016
|
await this.fillController.start(e);
|
|
3961
4017
|
}
|
|
3962
4018
|
}
|
|
3963
4019
|
restoreAutofillSession(e) {
|
|
3964
|
-
let t =
|
|
4020
|
+
let t = mn(this.options.autofill, this.state, e);
|
|
3965
4021
|
return t && this.autofillController.syncCountdown(), t;
|
|
3966
4022
|
}
|
|
3967
4023
|
restoreFillSession(e) {
|
|
@@ -3969,7 +4025,7 @@ var lr = class {
|
|
|
3969
4025
|
}
|
|
3970
4026
|
async loadNext() {
|
|
3971
4027
|
if (this.pendingRequest) return this.pendingRequest;
|
|
3972
|
-
if (this.state.loadMoreLocked ||
|
|
4028
|
+
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
4029
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
3974
4030
|
let e = this.loadNextSequence();
|
|
3975
4031
|
return this.pendingRequest = e, e.finally(() => {
|
|
@@ -3984,12 +4040,12 @@ var lr = class {
|
|
|
3984
4040
|
}
|
|
3985
4041
|
async replaceFeed(e, t) {
|
|
3986
4042
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
3987
|
-
return
|
|
4043
|
+
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
4044
|
}
|
|
3989
4045
|
async loadFilteredPage(e) {
|
|
3990
4046
|
let t = this.options.loadPage;
|
|
3991
4047
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
3992
|
-
let n =
|
|
4048
|
+
let n = Rt(await t(e));
|
|
3993
4049
|
return {
|
|
3994
4050
|
...n,
|
|
3995
4051
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4019,7 +4075,7 @@ var lr = class {
|
|
|
4019
4075
|
}
|
|
4020
4076
|
async retryEnd() {
|
|
4021
4077
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4022
|
-
if (!this.state.loadMoreLocked && !(
|
|
4078
|
+
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
4079
|
}
|
|
4024
4080
|
setInfiniteScroll(e) {
|
|
4025
4081
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4047,10 +4103,10 @@ var lr = class {
|
|
|
4047
4103
|
this.state.total = e;
|
|
4048
4104
|
}
|
|
4049
4105
|
setReelAutoAdvance(e) {
|
|
4050
|
-
|
|
4106
|
+
Fn(this.state.reelAutoAdvance, e);
|
|
4051
4107
|
}
|
|
4052
4108
|
setReelInfoSheet(e) {
|
|
4053
|
-
|
|
4109
|
+
Ln(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4054
4110
|
}
|
|
4055
4111
|
setLayout(e) {
|
|
4056
4112
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4070,7 +4126,7 @@ var lr = class {
|
|
|
4070
4126
|
async fetchPage(e, t) {
|
|
4071
4127
|
if (!this.options.loadPage) return;
|
|
4072
4128
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4073
|
-
this.abortController = r, await
|
|
4129
|
+
this.abortController = r, await Un({
|
|
4074
4130
|
append: t,
|
|
4075
4131
|
autofillController: this.autofillController,
|
|
4076
4132
|
cursor: e,
|
|
@@ -4094,7 +4150,7 @@ var lr = class {
|
|
|
4094
4150
|
startInitialAutofill() {
|
|
4095
4151
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4096
4152
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4097
|
-
let r =
|
|
4153
|
+
let r = hn({
|
|
4098
4154
|
cycleId: n,
|
|
4099
4155
|
isCurrent: () => e === this.requestVersion,
|
|
4100
4156
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4114,14 +4170,14 @@ var lr = class {
|
|
|
4114
4170
|
}
|
|
4115
4171
|
startStateNotifications() {
|
|
4116
4172
|
let e = this.options.onStateChange;
|
|
4117
|
-
!e || this.stopStateWatcher || (e(this.
|
|
4173
|
+
!e || this.stopStateWatcher || (e(L(this.state, this.notificationItems.value)), this.stopStateWatcher = O(this.state, () => e(L(this.state, this.notificationItems.value)), {
|
|
4118
4174
|
deep: !0,
|
|
4119
4175
|
flush: "post"
|
|
4120
4176
|
}));
|
|
4121
4177
|
}
|
|
4122
4178
|
};
|
|
4123
|
-
function
|
|
4124
|
-
return new
|
|
4179
|
+
function mr(e) {
|
|
4180
|
+
return new pr(e);
|
|
4125
4181
|
}
|
|
4126
4182
|
//#endregion
|
|
4127
|
-
export {
|
|
4183
|
+
export { mr as createVibe };
|