@wyxos/vibe 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/lib/components/VibeSurface.vue.d.ts +2 -1
- package/lib/core/feed.d.ts +2 -1
- package/lib/core/itemRemovalController.d.ts +3 -2
- package/lib/core/itemRemovalOptions.d.ts +3 -0
- package/lib/core/masonryOptions.d.ts +3 -0
- package/lib/core/masonryViewportIndex.d.ts +16 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +604 -538
- package/lib/types.d.ts +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -56,7 +56,7 @@ var R = {
|
|
|
56
56
|
}, B = ["disabled"], V = {
|
|
57
57
|
key: 2,
|
|
58
58
|
class: "end-feed"
|
|
59
|
-
}, H = ["disabled"],
|
|
59
|
+
}, H = ["disabled"], ee = /* @__PURE__ */ d({
|
|
60
60
|
__name: "GalleryFooter",
|
|
61
61
|
props: {
|
|
62
62
|
canRetryEnd: { type: Boolean },
|
|
@@ -90,7 +90,7 @@ var R = {
|
|
|
90
90
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
91
91
|
}, " Check for more ", 8, H)]))])) : o("", !0);
|
|
92
92
|
}
|
|
93
|
-
}),
|
|
93
|
+
}), U = /* @__PURE__ */ d({
|
|
94
94
|
__name: "FeedFooter",
|
|
95
95
|
props: {
|
|
96
96
|
actions: {},
|
|
@@ -127,7 +127,7 @@ var R = {
|
|
|
127
127
|
"can-retry-end",
|
|
128
128
|
"show-load-more",
|
|
129
129
|
"state"
|
|
130
|
-
])) : (b(), a(
|
|
130
|
+
])) : (b(), a(ee, {
|
|
131
131
|
key: 1,
|
|
132
132
|
"can-retry-end": e.canRetryEnd,
|
|
133
133
|
"has-error": e.hasError,
|
|
@@ -146,7 +146,7 @@ var R = {
|
|
|
146
146
|
"show-load-more"
|
|
147
147
|
]));
|
|
148
148
|
}
|
|
149
|
-
}),
|
|
149
|
+
}), W = ["role"], G = { class: "gallery-status" }, te = /* @__PURE__ */ d({
|
|
150
150
|
__name: "FeedStatus",
|
|
151
151
|
props: {
|
|
152
152
|
actions: {},
|
|
@@ -160,7 +160,7 @@ var R = {
|
|
|
160
160
|
return (n, u) => (b(), s("main", {
|
|
161
161
|
class: "gallery-shell",
|
|
162
162
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
163
|
-
}, [c("p",
|
|
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(U, {
|
|
164
164
|
key: 0,
|
|
165
165
|
actions: t.actions,
|
|
166
166
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -182,36 +182,32 @@ var R = {
|
|
|
182
182
|
"is-loading",
|
|
183
183
|
"load-more-locked",
|
|
184
184
|
"state"
|
|
185
|
-
])) : o("", !0)], 8,
|
|
185
|
+
])) : o("", !0)], 8, W));
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
|
-
function
|
|
188
|
+
function K(e) {
|
|
189
189
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
190
190
|
}
|
|
191
191
|
//#endregion
|
|
192
192
|
//#region src/core/masonry.ts
|
|
193
|
-
function
|
|
193
|
+
function ne(e) {
|
|
194
194
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
195
195
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function q(e) {
|
|
198
198
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function re(e) {
|
|
201
201
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
|
|
205
|
-
return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
|
|
206
|
-
}
|
|
207
|
-
function re(e, t, n) {
|
|
203
|
+
function ie(e, t, n) {
|
|
208
204
|
if (t <= 0 || e.length === 0) return {
|
|
209
205
|
columns: 0,
|
|
210
206
|
height: 0,
|
|
211
207
|
items: []
|
|
212
208
|
};
|
|
213
209
|
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) => {
|
|
214
|
-
let t =
|
|
210
|
+
let t = q(c), n = s * ne(e) + i, a = {
|
|
215
211
|
x: t * (s + r),
|
|
216
212
|
y: c[t],
|
|
217
213
|
width: s,
|
|
@@ -225,11 +221,54 @@ function re(e, t, n) {
|
|
|
225
221
|
items: l
|
|
226
222
|
};
|
|
227
223
|
}
|
|
228
|
-
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/core/masonryViewportIndex.ts
|
|
226
|
+
function ae(e, t) {
|
|
227
|
+
let n = /* @__PURE__ */ new Map();
|
|
228
|
+
return e.forEach((e, r) => {
|
|
229
|
+
let i = n.get(e.x) ?? [];
|
|
230
|
+
i.push({
|
|
231
|
+
bottom: e.y + e.height,
|
|
232
|
+
index: t?.[r] ?? r,
|
|
233
|
+
top: e.y
|
|
234
|
+
}), n.set(e.x, i);
|
|
235
|
+
}), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
|
|
236
|
+
}
|
|
237
|
+
function oe(e, t) {
|
|
238
|
+
let n = 0, r = 0, i = e.length;
|
|
239
|
+
for (; r < i;) {
|
|
240
|
+
let a = Math.floor((r + i) / 2);
|
|
241
|
+
n += 1, e[a].bottom < t ? r = a + 1 : i = a;
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
index: r,
|
|
245
|
+
inspected: n
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function se(e, t) {
|
|
249
|
+
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
|
|
250
|
+
return e.columns.forEach((e) => {
|
|
251
|
+
let t = oe(e, r);
|
|
252
|
+
o += t.inspected;
|
|
253
|
+
for (let n = t.index; n < e.length; n += 1) {
|
|
254
|
+
let t = e[n];
|
|
255
|
+
if (o += 1, t.top > i) break;
|
|
256
|
+
a.push(t.index);
|
|
257
|
+
}
|
|
258
|
+
}), {
|
|
259
|
+
indices: a.sort((e, t) => e - t),
|
|
260
|
+
inspected: o
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function ce(e) {
|
|
264
|
+
return e?.minColumnWidth ?? 240;
|
|
265
|
+
}
|
|
266
|
+
function le(e, t) {
|
|
229
267
|
let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
|
|
230
268
|
return a === void 0 ? i : Math.min(i, a);
|
|
231
269
|
}
|
|
232
|
-
function
|
|
270
|
+
function J(e) {
|
|
271
|
+
if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
|
|
233
272
|
let t = e?.overscan;
|
|
234
273
|
if (t) {
|
|
235
274
|
for (let [e, n] of [
|
|
@@ -242,10 +281,10 @@ function ae(e) {
|
|
|
242
281
|
}
|
|
243
282
|
//#endregion
|
|
244
283
|
//#region src/core/scrollbar.ts
|
|
245
|
-
function
|
|
284
|
+
function ue(e, t, n) {
|
|
246
285
|
return Math.min(n, Math.max(t, e));
|
|
247
286
|
}
|
|
248
|
-
function
|
|
287
|
+
function Y({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
249
288
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
250
289
|
if (!(c > 0 && o > 0)) return {
|
|
251
290
|
maximumScrollPosition: c,
|
|
@@ -254,23 +293,23 @@ function se({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
254
293
|
thumbSize: o,
|
|
255
294
|
thumbTravel: 0
|
|
256
295
|
};
|
|
257
|
-
let l =
|
|
296
|
+
let l = ue(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
258
297
|
return {
|
|
259
298
|
maximumScrollPosition: c,
|
|
260
299
|
scrollable: !0,
|
|
261
|
-
thumbOffset: u * (
|
|
300
|
+
thumbOffset: u * (ue(n, 0, c) / c),
|
|
262
301
|
thumbSize: l,
|
|
263
302
|
thumbTravel: u
|
|
264
303
|
};
|
|
265
304
|
}
|
|
266
305
|
//#endregion
|
|
267
306
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
268
|
-
var
|
|
307
|
+
var de = ["aria-hidden"], fe = [
|
|
269
308
|
"aria-controls",
|
|
270
309
|
"aria-valuemax",
|
|
271
310
|
"aria-valuenow",
|
|
272
311
|
"tabindex"
|
|
273
|
-
],
|
|
312
|
+
], pe = 32, me = 40, he = 120, X = /* @__PURE__ */ d({
|
|
274
313
|
__name: "GalleryScrollbar",
|
|
275
314
|
props: {
|
|
276
315
|
contentSize: {},
|
|
@@ -292,16 +331,16 @@ var ce = ["aria-hidden"], le = [
|
|
|
292
331
|
function k() {
|
|
293
332
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
294
333
|
g = null, o.value || (l.value = !1);
|
|
295
|
-
},
|
|
334
|
+
}, he);
|
|
296
335
|
}
|
|
297
336
|
function A() {
|
|
298
337
|
l.value = !0, k();
|
|
299
338
|
}
|
|
300
339
|
function j() {
|
|
301
340
|
let e = t.scrollElement, r = i.value;
|
|
302
|
-
return !e || !r ? n :
|
|
341
|
+
return !e || !r ? n : Y({
|
|
303
342
|
contentSize: e.scrollHeight,
|
|
304
|
-
minimumThumbSize:
|
|
343
|
+
minimumThumbSize: pe,
|
|
305
344
|
scrollPosition: e.scrollTop,
|
|
306
345
|
trackSize: r.clientHeight,
|
|
307
346
|
viewportSize: e.clientHeight
|
|
@@ -354,7 +393,7 @@ var ce = ["aria-hidden"], le = [
|
|
|
354
393
|
}
|
|
355
394
|
function z(e) {
|
|
356
395
|
if (!E.value) return;
|
|
357
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r -
|
|
396
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - me : e.key === "ArrowDown" ? r + me : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
358
397
|
i !== null && (e.preventDefault(), A(), P(i));
|
|
359
398
|
}
|
|
360
399
|
function B(e) {
|
|
@@ -400,15 +439,15 @@ var ce = ["aria-hidden"], le = [
|
|
|
400
439
|
onPointerdown: I,
|
|
401
440
|
onPointermove: L,
|
|
402
441
|
onPointerup: R
|
|
403
|
-
}, null, 44,
|
|
442
|
+
}, null, 44, fe)], 42, de));
|
|
404
443
|
}
|
|
405
|
-
}),
|
|
444
|
+
}), ge = (e) => {
|
|
406
445
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
407
446
|
return !1;
|
|
408
|
-
},
|
|
409
|
-
let t =
|
|
447
|
+
}, _e = (e) => e === "", ve = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ye = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), be = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), xe = (e) => {
|
|
448
|
+
let t = be(e);
|
|
410
449
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
411
|
-
},
|
|
450
|
+
}, Se = {
|
|
412
451
|
xmlns: "http://www.w3.org/2000/svg",
|
|
413
452
|
width: 24,
|
|
414
453
|
height: 24,
|
|
@@ -418,27 +457,27 @@ var ce = ["aria-hidden"], le = [
|
|
|
418
457
|
"stroke-width": 2,
|
|
419
458
|
"stroke-linecap": "round",
|
|
420
459
|
"stroke-linejoin": "round"
|
|
421
|
-
},
|
|
422
|
-
...
|
|
460
|
+
}, Ce = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Se.width, color: s = Se.stroke, ...c }, { slots: l }) => p("svg", {
|
|
461
|
+
...Se,
|
|
423
462
|
...c,
|
|
424
463
|
width: o,
|
|
425
464
|
height: o,
|
|
426
465
|
stroke: s,
|
|
427
|
-
"stroke-width":
|
|
428
|
-
class:
|
|
429
|
-
...!l.default && !
|
|
430
|
-
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]),
|
|
466
|
+
"stroke-width": _e(n) || _e(r) || n === !0 || r === !0 ? Number(i || a || Se["stroke-width"]) * 24 / Number(o) : i || a || Se["stroke-width"],
|
|
467
|
+
class: ve("lucide", c.class, ...e ? [`lucide-${ye(xe(e))}-icon`, `lucide-${ye(e)}`] : ["lucide-icon"]),
|
|
468
|
+
...!l.default && !ge(c) && { "aria-hidden": "true" }
|
|
469
|
+
}, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), we = (e, t) => (n, { slots: r, attrs: i }) => p(Ce, {
|
|
431
470
|
...i,
|
|
432
471
|
...n,
|
|
433
472
|
iconNode: t,
|
|
434
473
|
name: e
|
|
435
|
-
}, r),
|
|
474
|
+
}, r), Te = we("chevron-left", [["path", {
|
|
436
475
|
d: "m15 18-6-6 6-6",
|
|
437
476
|
key: "1wnfg3"
|
|
438
|
-
}]]),
|
|
477
|
+
}]]), Ee = we("chevron-right", [["path", {
|
|
439
478
|
d: "m9 18 6-6-6-6",
|
|
440
479
|
key: "mthhwq"
|
|
441
|
-
}]]),
|
|
480
|
+
}]]), De = we("pause", [["rect", {
|
|
442
481
|
x: "14",
|
|
443
482
|
y: "3",
|
|
444
483
|
width: "5",
|
|
@@ -452,10 +491,10 @@ var ce = ["aria-hidden"], le = [
|
|
|
452
491
|
height: "18",
|
|
453
492
|
rx: "1",
|
|
454
493
|
key: "1wsw3u"
|
|
455
|
-
}]]),
|
|
494
|
+
}]]), Oe = we("play", [["path", {
|
|
456
495
|
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",
|
|
457
496
|
key: "10ikf1"
|
|
458
|
-
}]]),
|
|
497
|
+
}]]), ke = we("volume-2", [
|
|
459
498
|
["path", {
|
|
460
499
|
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",
|
|
461
500
|
key: "uqj9uw"
|
|
@@ -468,7 +507,7 @@ var ce = ["aria-hidden"], le = [
|
|
|
468
507
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
469
508
|
key: "ijwkga"
|
|
470
509
|
}]
|
|
471
|
-
]),
|
|
510
|
+
]), Ae = we("volume-x", [
|
|
472
511
|
["path", {
|
|
473
512
|
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",
|
|
474
513
|
key: "uqj9uw"
|
|
@@ -487,22 +526,22 @@ var ce = ["aria-hidden"], le = [
|
|
|
487
526
|
y2: "15",
|
|
488
527
|
key: "5ykzw1"
|
|
489
528
|
}]
|
|
490
|
-
]),
|
|
529
|
+
]), je = {
|
|
491
530
|
401: "Authentication required",
|
|
492
531
|
403: "Access forbidden",
|
|
493
532
|
404: "Preview not found",
|
|
494
533
|
419: "Session expired",
|
|
495
534
|
500: "Server error"
|
|
496
535
|
};
|
|
497
|
-
function
|
|
536
|
+
function Me(e) {
|
|
498
537
|
return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
|
|
499
538
|
}
|
|
500
|
-
function
|
|
501
|
-
return
|
|
539
|
+
function Ne(e) {
|
|
540
|
+
return je[Me(e)] ?? "Preview unavailable";
|
|
502
541
|
}
|
|
503
542
|
//#endregion
|
|
504
543
|
//#region src/components/CardRegion.vue
|
|
505
|
-
var
|
|
544
|
+
var Pe = /* @__PURE__ */ d({
|
|
506
545
|
__name: "CardRegion",
|
|
507
546
|
props: {
|
|
508
547
|
index: {},
|
|
@@ -549,18 +588,18 @@ var je = /* @__PURE__ */ d({
|
|
|
549
588
|
"total"
|
|
550
589
|
]))], 38));
|
|
551
590
|
}
|
|
552
|
-
}),
|
|
591
|
+
}), Fe = [
|
|
553
592
|
"max",
|
|
554
593
|
"value",
|
|
555
594
|
"aria-valuetext",
|
|
556
595
|
"disabled"
|
|
557
|
-
],
|
|
596
|
+
], Ie = {
|
|
558
597
|
key: 0,
|
|
559
598
|
class: "media-controls-row"
|
|
560
|
-
},
|
|
599
|
+
}, Le = ["aria-label", "title"], Re = { class: "media-controls-audio" }, ze = ["aria-label", "title"], Be = ["value", "aria-valuetext"], Ve = {
|
|
561
600
|
class: "media-control-time",
|
|
562
601
|
"aria-live": "off"
|
|
563
|
-
},
|
|
602
|
+
}, He = /* @__PURE__ */ d({
|
|
564
603
|
__name: "MediaControls",
|
|
565
604
|
props: {
|
|
566
605
|
currentTime: {},
|
|
@@ -608,35 +647,35 @@ var je = /* @__PURE__ */ d({
|
|
|
608
647
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
609
648
|
disabled: f.value <= 0,
|
|
610
649
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
611
|
-
}, null, 44,
|
|
650
|
+
}, null, 44, Fe), e.layout === "reel" ? (b(), s("div", Ie, [
|
|
612
651
|
c("button", {
|
|
613
652
|
type: "button",
|
|
614
653
|
class: "media-control-button media-control-playback",
|
|
615
654
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
616
655
|
title: e.playing ? "Pause" : "Play",
|
|
617
656
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
618
|
-
}, [e.playing ? (b(), a(E(
|
|
657
|
+
}, [e.playing ? (b(), a(E(De), {
|
|
619
658
|
key: 0,
|
|
620
659
|
size: 18,
|
|
621
660
|
fill: "currentColor"
|
|
622
|
-
})) : (b(), a(E(
|
|
661
|
+
})) : (b(), a(E(Oe), {
|
|
623
662
|
key: 1,
|
|
624
663
|
size: 18,
|
|
625
664
|
fill: "currentColor"
|
|
626
|
-
}))], 8,
|
|
627
|
-
c("div",
|
|
665
|
+
}))], 8, Le),
|
|
666
|
+
c("div", Re, [c("button", {
|
|
628
667
|
type: "button",
|
|
629
668
|
class: "media-control-button",
|
|
630
669
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
631
670
|
title: e.muted ? "Unmute" : "Mute",
|
|
632
671
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
633
|
-
}, [e.muted || e.volume === 0 ? (b(), a(E(
|
|
672
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(Ae), {
|
|
634
673
|
key: 0,
|
|
635
674
|
size: 18
|
|
636
|
-
})) : (b(), a(E(
|
|
675
|
+
})) : (b(), a(E(ke), {
|
|
637
676
|
key: 1,
|
|
638
677
|
size: 18
|
|
639
|
-
}))], 8,
|
|
678
|
+
}))], 8, ze), c("input", {
|
|
640
679
|
class: "media-control-range media-control-volume",
|
|
641
680
|
type: "range",
|
|
642
681
|
min: "0",
|
|
@@ -647,14 +686,14 @@ var je = /* @__PURE__ */ d({
|
|
|
647
686
|
"aria-label": "Video volume",
|
|
648
687
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
649
688
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
650
|
-
}, null, 44,
|
|
651
|
-
c("output",
|
|
689
|
+
}, null, 44, Be)]),
|
|
690
|
+
c("output", Ve, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
652
691
|
])) : o("", !0)], 34));
|
|
653
692
|
}
|
|
654
693
|
});
|
|
655
694
|
//#endregion
|
|
656
695
|
//#region src/components/useReelVideoActivity.ts
|
|
657
|
-
function
|
|
696
|
+
function Ue(e) {
|
|
658
697
|
let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
|
|
659
698
|
function i() {
|
|
660
699
|
if (!t.value) {
|
|
@@ -688,18 +727,18 @@ function Be(e) {
|
|
|
688
727
|
}
|
|
689
728
|
//#endregion
|
|
690
729
|
//#region src/core/mediaType.ts
|
|
691
|
-
var
|
|
692
|
-
function
|
|
730
|
+
var We = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
|
|
731
|
+
function Ge(e) {
|
|
693
732
|
try {
|
|
694
|
-
return
|
|
733
|
+
return We.test(new URL(e).pathname);
|
|
695
734
|
} catch {
|
|
696
|
-
return
|
|
735
|
+
return We.test(e.split("?")[0] ?? e);
|
|
697
736
|
}
|
|
698
737
|
}
|
|
699
738
|
//#endregion
|
|
700
739
|
//#region src/components/useMediaLoading.ts
|
|
701
|
-
function
|
|
702
|
-
let t = r(() =>
|
|
740
|
+
function Ke(e) {
|
|
741
|
+
let t = r(() => Ge(e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
|
|
703
742
|
return O(i, (t, n) => {
|
|
704
743
|
n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
|
|
705
744
|
}), {
|
|
@@ -710,7 +749,7 @@ function Ue(e) {
|
|
|
710
749
|
}
|
|
711
750
|
//#endregion
|
|
712
751
|
//#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
|
|
713
|
-
var
|
|
752
|
+
var qe = [
|
|
714
753
|
"data-post-id",
|
|
715
754
|
"data-media-index",
|
|
716
755
|
"aria-hidden",
|
|
@@ -718,12 +757,12 @@ var We = [
|
|
|
718
757
|
"inert",
|
|
719
758
|
"role",
|
|
720
759
|
"tabindex"
|
|
721
|
-
],
|
|
760
|
+
], Je = { class: "media-card-content" }, Ye = ["data-media-direction"], Xe = ["data-media-index"], Ze = {
|
|
722
761
|
key: 0,
|
|
723
762
|
"data-test": "media-loading",
|
|
724
763
|
class: "media-loading",
|
|
725
764
|
"aria-hidden": "true"
|
|
726
|
-
},
|
|
765
|
+
}, Qe = ["aria-label"], $e = { class: "media-error-code" }, et = [
|
|
727
766
|
"src",
|
|
728
767
|
"width",
|
|
729
768
|
"height",
|
|
@@ -731,13 +770,13 @@ var We = [
|
|
|
731
770
|
"loop",
|
|
732
771
|
"muted",
|
|
733
772
|
"preload"
|
|
734
|
-
],
|
|
773
|
+
], tt = [
|
|
735
774
|
"src",
|
|
736
775
|
"width",
|
|
737
776
|
"height",
|
|
738
777
|
"fetchpriority",
|
|
739
778
|
"loading"
|
|
740
|
-
],
|
|
779
|
+
], nt = ["aria-label"], rt = ["aria-label"], it = ["aria-label"], at = 40, ot = 160, st = 24, ct = /* @__PURE__ */ d({
|
|
741
780
|
__name: "MediaCard",
|
|
742
781
|
props: {
|
|
743
782
|
active: { type: Boolean },
|
|
@@ -773,57 +812,57 @@ var We = [
|
|
|
773
812
|
function S(e = !1, t = "pointer") {
|
|
774
813
|
e && x("activate", t);
|
|
775
814
|
}
|
|
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),
|
|
815
|
+
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), ee = w(1), U = 1, { effectiveMuted: W, onPlaying: G, playbackAllowed: te } = Ue({
|
|
777
816
|
active: () => l.active,
|
|
778
817
|
layout: () => l.layout,
|
|
779
818
|
videoElement: R,
|
|
780
819
|
videoIsMuted: V,
|
|
781
820
|
videoIsPlaying: H
|
|
782
|
-
}),
|
|
783
|
-
function
|
|
821
|
+
}), K = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
822
|
+
function ne(e) {
|
|
784
823
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
785
824
|
}
|
|
786
|
-
function
|
|
825
|
+
function q(e, t) {
|
|
787
826
|
let n = C.value.length, r = (e + n) % n;
|
|
788
827
|
r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
789
828
|
}
|
|
790
|
-
function
|
|
829
|
+
function re(e, t, n) {
|
|
791
830
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
792
831
|
}
|
|
793
|
-
function
|
|
832
|
+
function ie() {
|
|
794
833
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
795
834
|
}
|
|
796
|
-
function
|
|
797
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
835
|
+
function ae() {
|
|
836
|
+
d !== null && clearTimeout(d), d = setTimeout(ie, ot);
|
|
798
837
|
}
|
|
799
|
-
function
|
|
838
|
+
function oe(e) {
|
|
800
839
|
if (C.value.length <= 1) return;
|
|
801
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
802
|
-
if (n === 0 || (e.preventDefault(),
|
|
840
|
+
let t = e.currentTarget?.clientWidth || 1, n = re(e.deltaX, e.deltaMode, t);
|
|
841
|
+
if (n === 0 || (e.preventDefault(), ae(), p) || (f += n, Math.abs(f) < st)) return;
|
|
803
842
|
let r = Math.sign(f);
|
|
804
|
-
f = 0, p = !0,
|
|
843
|
+
f = 0, p = !0, q(D.value + r);
|
|
805
844
|
}
|
|
806
|
-
function
|
|
845
|
+
function se(e) {
|
|
807
846
|
let t = e.touches[0];
|
|
808
847
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
809
848
|
}
|
|
810
|
-
function
|
|
849
|
+
function ce(e) {
|
|
811
850
|
let t = e.changedTouches[0];
|
|
812
851
|
if (m === null || g === null || !t) return;
|
|
813
852
|
let n = m - t.clientX, r = g - t.clientY;
|
|
814
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) <
|
|
853
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < at || q(D.value + Math.sign(n)));
|
|
815
854
|
}
|
|
816
|
-
let { imageLoading:
|
|
855
|
+
let { imageLoading: le, mediaIsTimed: J, videoPreload: ue } = Ke({
|
|
817
856
|
fetchPriority: () => l.fetchPriority,
|
|
818
857
|
layout: () => l.layout,
|
|
819
858
|
mediaSource: () => F.value,
|
|
820
859
|
videoElement: R
|
|
821
|
-
}),
|
|
860
|
+
}), Y = r(() => l.layout === "reel" && l.stationaryReelControls === !0), de = r(() => J.value && l.previewState === "ready" && (!Y.value || !!(l.active && l.reelControlsTarget))), fe = r(() => `${l.item.postId}:${D.value}:${F.value}`);
|
|
822
861
|
function pe(e) {
|
|
823
862
|
l.layout === "reel" && (e.stopPropagation(), me());
|
|
824
863
|
}
|
|
825
864
|
async function me() {
|
|
826
|
-
if (!(!R.value || !
|
|
865
|
+
if (!(!R.value || !te.value)) {
|
|
827
866
|
if (H.value) {
|
|
828
867
|
R.value.pause();
|
|
829
868
|
return;
|
|
@@ -840,7 +879,7 @@ var We = [
|
|
|
840
879
|
}
|
|
841
880
|
function X(e) {
|
|
842
881
|
let t = e?.currentTarget ?? R.value;
|
|
843
|
-
t && (z.value = he(t.currentTime), B.value = he(t.duration),
|
|
882
|
+
t && (z.value = he(t.currentTime), B.value = he(t.duration), te.value && (V.value = t.muted), ee.value = t.volume, t.volume > 0 && (U = t.volume));
|
|
844
883
|
}
|
|
845
884
|
function ge(e) {
|
|
846
885
|
X(e), x("ready", D.value);
|
|
@@ -856,14 +895,14 @@ var We = [
|
|
|
856
895
|
let t = R.value;
|
|
857
896
|
if (!t || !Number.isFinite(e)) return;
|
|
858
897
|
let n = Math.min(1, Math.max(0, e));
|
|
859
|
-
t.volume = n, t.muted = n === 0, n > 0 && (
|
|
898
|
+
t.volume = n, t.muted = n === 0, n > 0 && (U = n), X();
|
|
860
899
|
}
|
|
861
900
|
function be() {
|
|
862
901
|
let e = R.value;
|
|
863
|
-
e && (e.muted && e.volume === 0 && (e.volume =
|
|
902
|
+
e && (e.muted && e.volume === 0 && (e.volume = U), e.muted = !e.muted, X());
|
|
864
903
|
}
|
|
865
904
|
return v(() => {
|
|
866
|
-
|
|
905
|
+
ie();
|
|
867
906
|
}), (r, i) => (b(), s("article", {
|
|
868
907
|
"data-post-id": e.item.postId,
|
|
869
908
|
"data-media-index": D.value,
|
|
@@ -877,12 +916,12 @@ var We = [
|
|
|
877
916
|
"aria-hidden": e.leaving || void 0,
|
|
878
917
|
"aria-busy": e.previewState === "loading",
|
|
879
918
|
inert: e.leaving || void 0,
|
|
880
|
-
role: e.interactive && !e.leaving && !
|
|
881
|
-
tabindex: e.interactive && !e.leaving && !
|
|
882
|
-
onClick: i[11] ||= (t) => S(e.interactive && !
|
|
883
|
-
onKeydown: [i[12] ||= A((t) => S(e.interactive && !
|
|
884
|
-
}, [c("div",
|
|
885
|
-
e.cardHeader ? (b(), a(
|
|
919
|
+
role: e.interactive && !e.leaving && !K.value ? "button" : void 0,
|
|
920
|
+
tabindex: e.interactive && !e.leaving && !K.value ? 0 : void 0,
|
|
921
|
+
onClick: i[11] ||= (t) => S(e.interactive && !K.value, ne(t)),
|
|
922
|
+
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"])]
|
|
923
|
+
}, [c("div", Je, [
|
|
924
|
+
e.cardHeader ? (b(), a(Pe, {
|
|
886
925
|
key: 0,
|
|
887
926
|
index: e.index,
|
|
888
927
|
item: e.item,
|
|
@@ -908,22 +947,22 @@ var We = [
|
|
|
908
947
|
c("div", {
|
|
909
948
|
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
910
949
|
"data-media-direction": y.value,
|
|
911
|
-
onWheel:
|
|
912
|
-
onTouchstartPassive:
|
|
913
|
-
onTouchendPassive:
|
|
950
|
+
onWheel: oe,
|
|
951
|
+
onTouchstartPassive: se,
|
|
952
|
+
onTouchendPassive: ce
|
|
914
953
|
}, [
|
|
915
954
|
u(n, { name: `media-slide-${y.value}` }, {
|
|
916
955
|
default: k(() => [(b(), s("div", {
|
|
917
956
|
key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
|
|
918
957
|
class: "media-card-frame",
|
|
919
958
|
"data-media-index": D.value
|
|
920
|
-
}, [e.previewState === "loading" ? (b(), s("div",
|
|
959
|
+
}, [e.previewState === "loading" ? (b(), s("div", Ze, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
|
|
921
960
|
key: 1,
|
|
922
961
|
"data-test": "media-error",
|
|
923
962
|
class: "media-error",
|
|
924
963
|
role: "img",
|
|
925
|
-
"aria-label": `${E(
|
|
926
|
-
}, [c("strong",
|
|
964
|
+
"aria-label": `${E(Me)(F.value)} ${E(Ne)(F.value)}`
|
|
965
|
+
}, [c("strong", $e, T(E(Me)(F.value)), 1), c("span", null, T(E(Ne)(F.value)), 1)], 8, Qe)) : o("", !0), E(J) ? (b(), s("video", {
|
|
927
966
|
key: 2,
|
|
928
967
|
ref_key: "videoElement",
|
|
929
968
|
ref: R,
|
|
@@ -934,21 +973,21 @@ var We = [
|
|
|
934
973
|
src: F.value,
|
|
935
974
|
width: I.value ?? void 0,
|
|
936
975
|
height: L.value ?? void 0,
|
|
937
|
-
autoplay: E(
|
|
976
|
+
autoplay: E(te),
|
|
938
977
|
loop: !e.advanceOnMediaEnd,
|
|
939
|
-
muted: E(
|
|
978
|
+
muted: E(W),
|
|
940
979
|
playsinline: "",
|
|
941
|
-
preload: E(
|
|
980
|
+
preload: E(ue),
|
|
942
981
|
onLoadedmetadata: ge,
|
|
943
982
|
onDurationchange: X,
|
|
944
983
|
onTimeupdate: X,
|
|
945
984
|
onVolumechange: X,
|
|
946
|
-
onPlaying: i[0] ||= (...e) => E(
|
|
985
|
+
onPlaying: i[0] ||= (...e) => E(G) && E(G)(...e),
|
|
947
986
|
onPause: i[1] ||= (e) => H.value = !1,
|
|
948
987
|
onEnded: _e,
|
|
949
988
|
onClick: pe,
|
|
950
989
|
onError: i[2] ||= (e) => r.$emit("error", D.value)
|
|
951
|
-
}, null, 42,
|
|
990
|
+
}, null, 42, et)) : (b(), s("img", {
|
|
952
991
|
key: 3,
|
|
953
992
|
class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
|
|
954
993
|
src: F.value,
|
|
@@ -957,28 +996,28 @@ var We = [
|
|
|
957
996
|
fetchpriority: e.fetchPriority,
|
|
958
997
|
alt: "",
|
|
959
998
|
decoding: "async",
|
|
960
|
-
loading: E(
|
|
999
|
+
loading: E(le),
|
|
961
1000
|
onLoad: i[3] ||= (e) => r.$emit("ready", D.value),
|
|
962
1001
|
onError: i[4] ||= (e) => r.$emit("error", D.value)
|
|
963
|
-
}, null, 42,
|
|
1002
|
+
}, null, 42, tt))], 8, Xe))]),
|
|
964
1003
|
_: 1
|
|
965
1004
|
}, 8, ["name"]),
|
|
966
1005
|
(b(), a(t, {
|
|
967
|
-
disabled: !
|
|
1006
|
+
disabled: !Y.value || !e.reelControlsTarget,
|
|
968
1007
|
to: e.reelControlsTarget ?? "body"
|
|
969
1008
|
}, [u(n, {
|
|
970
1009
|
name: "vibe-reel-media-controls",
|
|
971
|
-
css:
|
|
1010
|
+
css: Y.value
|
|
972
1011
|
}, {
|
|
973
|
-
default: k(() => [de.value ? (b(), a(
|
|
1012
|
+
default: k(() => [de.value ? (b(), a(He, {
|
|
974
1013
|
key: fe.value,
|
|
975
1014
|
"current-time": z.value,
|
|
976
|
-
"data-control-post-id":
|
|
1015
|
+
"data-control-post-id": Y.value ? e.item.postId : void 0,
|
|
977
1016
|
duration: B.value,
|
|
978
1017
|
layout: e.layout,
|
|
979
1018
|
muted: V.value,
|
|
980
1019
|
playing: H.value,
|
|
981
|
-
volume:
|
|
1020
|
+
volume: ee.value,
|
|
982
1021
|
onSeek: ve,
|
|
983
1022
|
onToggleMute: be,
|
|
984
1023
|
onTogglePlayback: me,
|
|
@@ -1002,25 +1041,25 @@ var We = [
|
|
|
1002
1041
|
type: "button",
|
|
1003
1042
|
class: "media-carousel-control media-carousel-control--previous",
|
|
1004
1043
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
1005
|
-
onClick: i[5] ||= j((e) =>
|
|
1044
|
+
onClick: i[5] ||= j((e) => q(D.value - 1, e), ["stop"]),
|
|
1006
1045
|
onKeydown: i[6] ||= j(() => {}, ["stop"])
|
|
1007
|
-
}, [u(E(
|
|
1046
|
+
}, [u(E(Te), { size: 20 })], 40, nt), c("button", {
|
|
1008
1047
|
type: "button",
|
|
1009
1048
|
class: "media-carousel-control media-carousel-control--next",
|
|
1010
1049
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
1011
|
-
onClick: i[7] ||= j((e) =>
|
|
1050
|
+
onClick: i[7] ||= j((e) => q(D.value + 1, e), ["stop"]),
|
|
1012
1051
|
onKeydown: i[8] ||= j(() => {}, ["stop"])
|
|
1013
|
-
}, [u(E(
|
|
1014
|
-
|
|
1052
|
+
}, [u(E(Ee), { size: 20 })], 40, rt)], 2)) : o("", !0),
|
|
1053
|
+
K.value ? (b(), s("button", {
|
|
1015
1054
|
key: 1,
|
|
1016
1055
|
class: "media-card-activator",
|
|
1017
1056
|
type: "button",
|
|
1018
1057
|
"aria-label": `Open post ${e.item.postId}`,
|
|
1019
|
-
onClick: i[9] ||= j((e) => r.$emit("activate",
|
|
1058
|
+
onClick: i[9] ||= j((e) => r.$emit("activate", ne(e)), ["stop"]),
|
|
1020
1059
|
onKeydown: i[10] ||= j(() => {}, ["stop"])
|
|
1021
|
-
}, null, 40,
|
|
1022
|
-
], 42,
|
|
1023
|
-
e.cardFooter ? (b(), a(
|
|
1060
|
+
}, null, 40, it)) : o("", !0)
|
|
1061
|
+
], 42, Ye),
|
|
1062
|
+
e.cardFooter ? (b(), a(Pe, {
|
|
1024
1063
|
key: 1,
|
|
1025
1064
|
index: e.index,
|
|
1026
1065
|
item: e.item,
|
|
@@ -1043,12 +1082,12 @@ var We = [
|
|
|
1043
1082
|
"style",
|
|
1044
1083
|
"total"
|
|
1045
1084
|
])) : o("", !0)
|
|
1046
|
-
])], 46,
|
|
1085
|
+
])], 46, qe));
|
|
1047
1086
|
}
|
|
1048
|
-
}),
|
|
1087
|
+
}), lt = { class: "masonry-feed-shell" }, ut = ["aria-hidden", "inert"], dt = {
|
|
1049
1088
|
key: 0,
|
|
1050
1089
|
class: "masonry-feed-status-overlay"
|
|
1051
|
-
},
|
|
1090
|
+
}, ft = 6, pt = 12, mt = /* @__PURE__ */ d({
|
|
1052
1091
|
__name: "MasonryFeed",
|
|
1053
1092
|
props: {
|
|
1054
1093
|
enteringPostIds: {},
|
|
@@ -1084,56 +1123,75 @@ var We = [
|
|
|
1084
1123
|
"visible"
|
|
1085
1124
|
],
|
|
1086
1125
|
setup(t, { expose: n, emit: i }) {
|
|
1087
|
-
let l = t, d = i, f = w(null), p = `vibe-masonry-${D()}`, m = w(null), g = w(0), y = w(
|
|
1126
|
+
let l = t, d = i, f = w(null), p = `vibe-masonry-${D()}`, m = w(null), g = w(0), y = w(ft), 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(() => ie(l.items, g.value, {
|
|
1088
1127
|
additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
|
|
1089
1128
|
gap: y.value,
|
|
1090
|
-
minColumnWidth:
|
|
1091
|
-
})),
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1129
|
+
minColumnWidth: ce(l.masonry)
|
|
1130
|
+
})), R = r(() => {
|
|
1131
|
+
if (l.leavingPostIds.size === 0) return null;
|
|
1132
|
+
let e = l.items.flatMap((e, t) => l.leavingPostIds.has(e.postId) ? [] : [{
|
|
1133
|
+
index: t,
|
|
1134
|
+
item: e
|
|
1135
|
+
}]), t = ie(e.map(({ item: e }) => e), g.value, {
|
|
1095
1136
|
additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
|
|
1096
1137
|
gap: y.value,
|
|
1097
|
-
minColumnWidth:
|
|
1098
|
-
})
|
|
1138
|
+
minColumnWidth: ce(l.masonry)
|
|
1139
|
+
});
|
|
1099
1140
|
return {
|
|
1100
|
-
|
|
1101
|
-
|
|
1141
|
+
indices: e.map(({ index: e }) => e),
|
|
1142
|
+
layout: t,
|
|
1143
|
+
positions: new Map(e.map(({ item: e }, n) => [e.postId, t.items[n]]))
|
|
1102
1144
|
};
|
|
1103
|
-
}),
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1145
|
+
}), z = r(() => {
|
|
1146
|
+
let e = L.value, t = R.value;
|
|
1147
|
+
return t ? {
|
|
1148
|
+
...t.layout,
|
|
1149
|
+
items: l.items.map((n, r) => l.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
|
|
1150
|
+
} : e;
|
|
1151
|
+
}), B = r(() => ae(L.value.items)), V = r(() => {
|
|
1152
|
+
let e = R.value;
|
|
1153
|
+
return e ? ae(e.layout.items, e.indices) : null;
|
|
1154
|
+
}), H = r(() => Math.max(C.value, l.leavingPostIds.size === 0 ? z.value.height : L.value.height)), ee = r(() => ({ height: `${H.value}px` })), W = r(() => !l.infiniteScroll || x.value > 0 && T.value + z.value.height <= x.value + 1), G = r(() => new Set(k.value)), te = r(() => A.value.flatMap((e) => {
|
|
1155
|
+
let t = l.items[e];
|
|
1156
|
+
return t ? [{
|
|
1157
|
+
fetchPriority: G.value.has(e) ? "high" : "low",
|
|
1158
|
+
index: e,
|
|
1159
|
+
item: t
|
|
1160
|
+
}] : [];
|
|
1161
|
+
}));
|
|
1162
|
+
function ne(e, t) {
|
|
1163
|
+
return [...new Set([...e, ...t])].sort((e, t) => e - t);
|
|
1164
|
+
}
|
|
1165
|
+
function q(e, t) {
|
|
1166
|
+
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
1167
|
+
}
|
|
1168
|
+
function oe(e) {
|
|
1169
|
+
let t = {
|
|
1170
|
+
scrollTop: j - T.value,
|
|
1171
|
+
viewportHeight: x.value
|
|
1172
|
+
}, n = V.value, r = se(n ?? B.value, {
|
|
1121
1173
|
...t,
|
|
1122
1174
|
overscan: e
|
|
1123
|
-
})
|
|
1175
|
+
}).indices;
|
|
1176
|
+
return ne(r, l.leavingPostIds.size === 0 ? [] : se(B.value, {
|
|
1124
1177
|
...t,
|
|
1125
1178
|
overscan: e
|
|
1179
|
+
}).indices);
|
|
1180
|
+
}
|
|
1181
|
+
function J() {
|
|
1182
|
+
let e = l.suspended ? [] : oe(0), t = oe(le(l.masonry, x.value));
|
|
1183
|
+
q(k.value, e) || (k.value = e), q(A.value, t) || (A.value = t);
|
|
1184
|
+
}
|
|
1185
|
+
function ue() {
|
|
1186
|
+
if (I !== null) return;
|
|
1187
|
+
I = -1;
|
|
1188
|
+
let e = requestAnimationFrame(() => {
|
|
1189
|
+
I = null, J();
|
|
1126
1190
|
});
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
index: e,
|
|
1132
|
-
item: t
|
|
1133
|
-
}] : [];
|
|
1134
|
-
});
|
|
1135
|
-
}), z = /* @__PURE__ */ new Set();
|
|
1136
|
-
O(() => [...L.value].flatMap((e) => {
|
|
1191
|
+
I !== null && (I = e);
|
|
1192
|
+
}
|
|
1193
|
+
let Y = /* @__PURE__ */ new Set();
|
|
1194
|
+
O(() => [...G.value].flatMap((e) => {
|
|
1137
1195
|
let t = l.items[e];
|
|
1138
1196
|
if (!t) return [];
|
|
1139
1197
|
let n = l.mediaIndices.get(t.postId) ?? 0, r = F(t.postId, n);
|
|
@@ -1145,17 +1203,17 @@ var We = [
|
|
|
1145
1203
|
}), (e) => {
|
|
1146
1204
|
let t = new Set(e.map(({ key: e }) => e));
|
|
1147
1205
|
e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
|
|
1148
|
-
|
|
1149
|
-
}),
|
|
1206
|
+
Y.has(e) || d("visible", n, t);
|
|
1207
|
+
}), Y = t;
|
|
1150
1208
|
}, {
|
|
1151
1209
|
immediate: !0,
|
|
1152
1210
|
flush: "post"
|
|
1153
1211
|
});
|
|
1154
|
-
function
|
|
1155
|
-
let t =
|
|
1212
|
+
function de(e) {
|
|
1213
|
+
let t = z.value.items[e], n = l.items[e]?.postId;
|
|
1156
1214
|
if (!t) return {};
|
|
1157
|
-
let r = n !== void 0 && l.enteringPostIds.has(n), i = n !== void 0 && l.leavingPostIds.has(n), a = r || i ?
|
|
1158
|
-
containerHeight:
|
|
1215
|
+
let r = n !== void 0 && l.enteringPostIds.has(n), i = n !== void 0 && l.leavingPostIds.has(n), a = r || i ? re({
|
|
1216
|
+
containerHeight: Math.max(C.value, L.value.height),
|
|
1159
1217
|
gap: y.value
|
|
1160
1218
|
}) : 0, o = n === void 0 ? 0 : i ? l.removalDelays.get(n) ?? 0 : r ? l.entryDelays.get(n) ?? 0 : 0;
|
|
1161
1219
|
return {
|
|
@@ -1165,43 +1223,50 @@ var We = [
|
|
|
1165
1223
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1166
1224
|
};
|
|
1167
1225
|
}
|
|
1168
|
-
function
|
|
1226
|
+
function fe() {
|
|
1169
1227
|
let e = f.value;
|
|
1170
1228
|
if (!e) return;
|
|
1171
|
-
|
|
1172
|
-
let t =
|
|
1173
|
-
|
|
1229
|
+
j = e.scrollTop, x.value = e.clientHeight;
|
|
1230
|
+
let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
|
|
1231
|
+
C.value = Math.max(0, e.clientHeight - n);
|
|
1232
|
+
let r = m.value;
|
|
1233
|
+
r && (T.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, J());
|
|
1174
1234
|
}
|
|
1175
|
-
function
|
|
1235
|
+
function pe(e) {
|
|
1176
1236
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1177
|
-
g.value = e.clientWidth, y.value = Math.min(
|
|
1237
|
+
g.value = e.clientWidth, y.value = Math.min(pt, Math.max(ft, t * .0075)), fe();
|
|
1178
1238
|
}
|
|
1179
|
-
function
|
|
1239
|
+
function me(e) {
|
|
1180
1240
|
let t = e.currentTarget;
|
|
1181
|
-
t && (
|
|
1241
|
+
t && (j = t.scrollTop, ue(), !l.loadMoreLocked && l.infiniteScroll && K(t) && d("loadMore"));
|
|
1182
1242
|
}
|
|
1183
|
-
function
|
|
1243
|
+
function he() {
|
|
1184
1244
|
let e = f.value;
|
|
1185
|
-
!l.loadMoreLocked && e &&
|
|
1245
|
+
!l.loadMoreLocked && e && K(e) && d("loadMore");
|
|
1186
1246
|
}
|
|
1187
|
-
function
|
|
1247
|
+
function ge() {
|
|
1188
1248
|
return f.value;
|
|
1189
1249
|
}
|
|
1190
1250
|
return O(m, (e) => {
|
|
1191
|
-
|
|
1251
|
+
M?.disconnect(), M = null, P !== null && cancelAnimationFrame(P), e && (pe(e), !(typeof ResizeObserver > "u") && (M = new ResizeObserver(([t]) => {
|
|
1192
1252
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1193
|
-
Math.abs(n - g.value) < .5 || (
|
|
1194
|
-
|
|
1253
|
+
Math.abs(n - g.value) < .5 || (P = requestAnimationFrame(() => {
|
|
1254
|
+
P = null, pe(e);
|
|
1195
1255
|
}));
|
|
1196
|
-
}),
|
|
1256
|
+
}), M.observe(e)));
|
|
1197
1257
|
}), O(f, (e) => {
|
|
1198
|
-
|
|
1199
|
-
}),
|
|
1200
|
-
|
|
1258
|
+
N?.disconnect(), N = null, e && (fe(), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(fe), N.observe(e)));
|
|
1259
|
+
}), O([
|
|
1260
|
+
L,
|
|
1261
|
+
z,
|
|
1262
|
+
() => l.suspended,
|
|
1263
|
+
() => l.masonry
|
|
1264
|
+
], J, { flush: "post" }), v(() => {
|
|
1265
|
+
M?.disconnect(), N?.disconnect(), P !== null && cancelAnimationFrame(P), I !== null && cancelAnimationFrame(I);
|
|
1201
1266
|
}), n({
|
|
1202
|
-
getScrollElement:
|
|
1203
|
-
loadIfNearBottom:
|
|
1204
|
-
}), (n, r) => (b(), s("div",
|
|
1267
|
+
getScrollElement: ge,
|
|
1268
|
+
loadIfNearBottom: he
|
|
1269
|
+
}), (n, r) => (b(), s("div", lt, [
|
|
1205
1270
|
c("main", {
|
|
1206
1271
|
id: p,
|
|
1207
1272
|
ref_key: "galleryElement",
|
|
@@ -1210,14 +1275,14 @@ var We = [
|
|
|
1210
1275
|
"data-layout-mode": "masonry",
|
|
1211
1276
|
"aria-hidden": t.suspended || void 0,
|
|
1212
1277
|
inert: t.suspended || void 0,
|
|
1213
|
-
onScrollPassive:
|
|
1278
|
+
onScrollPassive: me
|
|
1214
1279
|
}, [c("section", {
|
|
1215
1280
|
ref_key: "masonryElement",
|
|
1216
1281
|
ref: m,
|
|
1217
1282
|
class: h(["masonry", { "masonry--ready": g.value > 0 }]),
|
|
1218
|
-
style: _(
|
|
1283
|
+
style: _(ee.value),
|
|
1219
1284
|
"aria-label": "Media gallery"
|
|
1220
|
-
}, [(b(!0), s(e, null, S(
|
|
1285
|
+
}, [(b(!0), s(e, null, S(te.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(ct, {
|
|
1221
1286
|
key: n.postId,
|
|
1222
1287
|
class: "masonry-item",
|
|
1223
1288
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1228,7 +1293,7 @@ var We = [
|
|
|
1228
1293
|
"media-card": t.mediaCard,
|
|
1229
1294
|
index: r,
|
|
1230
1295
|
item: n,
|
|
1231
|
-
"item-style":
|
|
1296
|
+
"item-style": de(r),
|
|
1232
1297
|
interactive: "",
|
|
1233
1298
|
layout: "masonry",
|
|
1234
1299
|
"loaded-count": t.items.length,
|
|
@@ -1257,8 +1322,8 @@ var We = [
|
|
|
1257
1322
|
"onMediaChange",
|
|
1258
1323
|
"onReady",
|
|
1259
1324
|
"onError"
|
|
1260
|
-
]))), 128))], 6)], 42,
|
|
1261
|
-
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext &&
|
|
1325
|
+
]))), 128))], 6)], 42, ut),
|
|
1326
|
+
t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", dt, [u(U, {
|
|
1262
1327
|
actions: t.feedFooterActions,
|
|
1263
1328
|
"can-retry-end": t.canRetryEnd,
|
|
1264
1329
|
"feed-footer": t.feedFooter,
|
|
@@ -1266,7 +1331,7 @@ var We = [
|
|
|
1266
1331
|
"has-next": t.hasNext,
|
|
1267
1332
|
"is-loading": t.isLoadingMore,
|
|
1268
1333
|
"load-more-locked": t.loadMoreLocked,
|
|
1269
|
-
"show-load-more":
|
|
1334
|
+
"show-load-more": W.value,
|
|
1270
1335
|
state: t.state,
|
|
1271
1336
|
onLoadMore: r[0] ||= (e) => d("loadMore"),
|
|
1272
1337
|
onRetryEnd: r[1] ||= (e) => d("retryEnd")
|
|
@@ -1281,8 +1346,8 @@ var We = [
|
|
|
1281
1346
|
"show-load-more",
|
|
1282
1347
|
"state"
|
|
1283
1348
|
])])) : o("", !0),
|
|
1284
|
-
u(
|
|
1285
|
-
"content-size":
|
|
1349
|
+
u(X, {
|
|
1350
|
+
"content-size": z.value.height,
|
|
1286
1351
|
"controls-id": p,
|
|
1287
1352
|
"scroll-element": f.value,
|
|
1288
1353
|
suspended: t.suspended
|
|
@@ -1293,8 +1358,8 @@ var We = [
|
|
|
1293
1358
|
])
|
|
1294
1359
|
]));
|
|
1295
1360
|
}
|
|
1296
|
-
}),
|
|
1297
|
-
function
|
|
1361
|
+
}), ht = 300;
|
|
1362
|
+
function gt(e, t, n) {
|
|
1298
1363
|
let r = e.scrollTop;
|
|
1299
1364
|
if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
|
|
1300
1365
|
e.setAttribute("data-transitioning", "");
|
|
@@ -1302,7 +1367,7 @@ function mt(e, t, n) {
|
|
|
1302
1367
|
return new Promise((n) => {
|
|
1303
1368
|
let o = (s) => {
|
|
1304
1369
|
a += 1;
|
|
1305
|
-
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c /
|
|
1370
|
+
let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / ht), u = 1 - (1 - l) ** 3;
|
|
1306
1371
|
if (e.scrollTop = r + (t - r) * u, l < 1) {
|
|
1307
1372
|
requestAnimationFrame(o);
|
|
1308
1373
|
return;
|
|
@@ -1314,7 +1379,7 @@ function mt(e, t, n) {
|
|
|
1314
1379
|
}
|
|
1315
1380
|
//#endregion
|
|
1316
1381
|
//#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
|
|
1317
|
-
var
|
|
1382
|
+
var _t = ["aria-label"], vt = /* @__PURE__ */ d({
|
|
1318
1383
|
__name: "ReelAutoAdvanceProgress",
|
|
1319
1384
|
props: {
|
|
1320
1385
|
durationMs: {},
|
|
@@ -1332,9 +1397,9 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1332
1397
|
class: "reel-auto-advance-progress",
|
|
1333
1398
|
style: _(a.value),
|
|
1334
1399
|
onAnimationend: n[0] ||= (e) => i("complete")
|
|
1335
|
-
}, null, 36)], 8,
|
|
1400
|
+
}, null, 36)], 8, _t));
|
|
1336
1401
|
}
|
|
1337
|
-
}),
|
|
1402
|
+
}), yt = { class: "reel-viewport" }, bt = ["data-active-post-id", "data-active-media-index"], xt = ["role", "data-status"], St = 2, Ct = 300, wt = /* @__PURE__ */ d({
|
|
1338
1403
|
__name: "ReelFeed",
|
|
1339
1404
|
props: {
|
|
1340
1405
|
initialPostId: {},
|
|
@@ -1372,7 +1437,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1372
1437
|
],
|
|
1373
1438
|
setup(t, { expose: n, emit: i }) {
|
|
1374
1439
|
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(() => {
|
|
1375
|
-
let e = Math.max(0, g.value -
|
|
1440
|
+
let e = Math.max(0, g.value - St), t = Math.min(l.items.length - 1, g.value + St);
|
|
1376
1441
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1377
1442
|
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1378
1443
|
index: e + n,
|
|
@@ -1389,7 +1454,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1389
1454
|
if (!e) return "";
|
|
1390
1455
|
let t = P(e, z.value);
|
|
1391
1456
|
return l.mediaSource === "original" ? t.src : t.preview.src;
|
|
1392
|
-
}), H = r(() => B.value === "ready" &&
|
|
1457
|
+
}), H = r(() => B.value === "ready" && Ge(V.value)), ee = r(() => [
|
|
1393
1458
|
L.value,
|
|
1394
1459
|
z.value,
|
|
1395
1460
|
l.items.length,
|
|
@@ -1397,49 +1462,49 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1397
1462
|
l.reelAutoAdvance.enabled,
|
|
1398
1463
|
l.reelAutoAdvance.includePostItems,
|
|
1399
1464
|
l.reelAutoAdvance.intervalMs
|
|
1400
|
-
].join(":")),
|
|
1465
|
+
].join(":")), W = r(() => {
|
|
1401
1466
|
let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1402
1467
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1403
|
-
}),
|
|
1404
|
-
function
|
|
1468
|
+
}), 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.");
|
|
1469
|
+
function q(e) {
|
|
1405
1470
|
return { gridRow: `${e + 1}` };
|
|
1406
1471
|
}
|
|
1407
|
-
function
|
|
1472
|
+
function re(e) {
|
|
1408
1473
|
let t = D || e.clientHeight;
|
|
1409
1474
|
return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1410
1475
|
}
|
|
1411
|
-
function
|
|
1476
|
+
function ie(e) {
|
|
1412
1477
|
let t = e.currentTarget;
|
|
1413
1478
|
if (!t) return;
|
|
1414
1479
|
let n = D || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
|
|
1415
|
-
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value =
|
|
1480
|
+
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = re(t)), !l.loadMoreLocked && l.infiniteScroll && K(t) && u("loadMore");
|
|
1416
1481
|
}
|
|
1417
|
-
function
|
|
1482
|
+
function ae() {
|
|
1418
1483
|
let e = d.value;
|
|
1419
|
-
e && (x.value = !1,
|
|
1484
|
+
e && (x.value = !1, ce(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
|
|
1420
1485
|
e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
|
|
1421
|
-
}),
|
|
1486
|
+
}), oe());
|
|
1422
1487
|
}
|
|
1423
|
-
function
|
|
1488
|
+
function oe() {
|
|
1424
1489
|
j !== null && clearTimeout(j), j = setTimeout(() => {
|
|
1425
1490
|
j = null;
|
|
1426
1491
|
let e = d.value;
|
|
1427
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1492
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), ce(!1);
|
|
1428
1493
|
}, 120);
|
|
1429
1494
|
}
|
|
1430
|
-
function
|
|
1431
|
-
|
|
1495
|
+
function se() {
|
|
1496
|
+
ce(!0);
|
|
1432
1497
|
let e = d.value;
|
|
1433
|
-
e && (D = e.clientHeight, e.scrollTop = g.value * D),
|
|
1498
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), oe();
|
|
1434
1499
|
}
|
|
1435
|
-
function
|
|
1500
|
+
function ce(e) {
|
|
1436
1501
|
C.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1437
1502
|
}
|
|
1438
|
-
function
|
|
1503
|
+
function le() {
|
|
1439
1504
|
let e = d.value;
|
|
1440
|
-
!l.loadMoreLocked && e &&
|
|
1505
|
+
!l.loadMoreLocked && e && K(e) && u("loadMore");
|
|
1441
1506
|
}
|
|
1442
|
-
function
|
|
1507
|
+
function J(e) {
|
|
1443
1508
|
let t = R.value;
|
|
1444
1509
|
if (!t) return !1;
|
|
1445
1510
|
let n = M(t).length;
|
|
@@ -1447,11 +1512,11 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1447
1512
|
let r = (z.value + e + n) % n;
|
|
1448
1513
|
return u("mediaChange", t.postId, r), !0;
|
|
1449
1514
|
}
|
|
1450
|
-
function
|
|
1515
|
+
function ue(e) {
|
|
1451
1516
|
let t = g.value + e;
|
|
1452
1517
|
return !d.value || t < 0 || t >= l.items.length ? !1 : (pe(t), !0);
|
|
1453
1518
|
}
|
|
1454
|
-
function
|
|
1519
|
+
function Y(e, t) {
|
|
1455
1520
|
let n = l.items.findIndex((t) => t.postId === e), r = l.items[n];
|
|
1456
1521
|
return !d.value || !r || t < 0 || t > r.items.length ? !1 : ((l.mediaIndices.get(e) ?? 0) !== t && u("mediaChange", e, t), n !== g.value && pe(n), !0);
|
|
1457
1522
|
}
|
|
@@ -1462,7 +1527,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1462
1527
|
let t = d.value;
|
|
1463
1528
|
if (!t) return Promise.resolve();
|
|
1464
1529
|
let n = e * (D || t.clientHeight);
|
|
1465
|
-
return g.value = e,
|
|
1530
|
+
return g.value = e, gt(t, n, de());
|
|
1466
1531
|
}
|
|
1467
1532
|
function pe(e) {
|
|
1468
1533
|
fe(e);
|
|
@@ -1472,7 +1537,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1472
1537
|
return t < 0 || t === g.value ? !1 : (await fe(t), !0);
|
|
1473
1538
|
}
|
|
1474
1539
|
async function he(e) {
|
|
1475
|
-
return
|
|
1540
|
+
return J(e) ? (de() || await new Promise((e) => setTimeout(e, Ct)), !0) : !1;
|
|
1476
1541
|
}
|
|
1477
1542
|
function X() {
|
|
1478
1543
|
if (!l.reelAutoAdvance.enabled) return;
|
|
@@ -1493,23 +1558,23 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1493
1558
|
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || X();
|
|
1494
1559
|
}
|
|
1495
1560
|
return O(d, (e) => {
|
|
1496
|
-
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(
|
|
1561
|
+
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(ae), k.observe(e)));
|
|
1497
1562
|
}), O(() => l.items.length, async (e) => {
|
|
1498
1563
|
let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1499
|
-
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(),
|
|
1564
|
+
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), ae();
|
|
1500
1565
|
}), O(L, (e) => {
|
|
1501
1566
|
e !== void 0 && u("activeChange", e);
|
|
1502
1567
|
}, { immediate: !0 }), y(() => {
|
|
1503
|
-
window.addEventListener("resize",
|
|
1568
|
+
window.addEventListener("resize", se), window.addEventListener("orientationchange", se), p >= 0 && m(ae);
|
|
1504
1569
|
}), v(() => {
|
|
1505
|
-
window.removeEventListener("resize",
|
|
1570
|
+
window.removeEventListener("resize", se), window.removeEventListener("orientationchange", se), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
|
|
1506
1571
|
}), n({
|
|
1507
1572
|
activeIndex: g,
|
|
1508
1573
|
activePostId: L,
|
|
1509
|
-
changeActiveMedia:
|
|
1510
|
-
loadIfNearBottom:
|
|
1511
|
-
moveActivePost:
|
|
1512
|
-
navigateToItem:
|
|
1574
|
+
changeActiveMedia: J,
|
|
1575
|
+
loadIfNearBottom: le,
|
|
1576
|
+
moveActivePost: ue,
|
|
1577
|
+
navigateToItem: Y,
|
|
1513
1578
|
transitionActiveMedia: he,
|
|
1514
1579
|
transitionActivePost: me
|
|
1515
1580
|
}), (n, r) => (b(), s("main", {
|
|
@@ -1519,7 +1584,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1519
1584
|
}]),
|
|
1520
1585
|
"data-layout-mode": "reel"
|
|
1521
1586
|
}, [
|
|
1522
|
-
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1587
|
+
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
|
|
1523
1588
|
key: 0,
|
|
1524
1589
|
index: g.value,
|
|
1525
1590
|
item: R.value,
|
|
@@ -1541,19 +1606,19 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1541
1606
|
"style",
|
|
1542
1607
|
"total"
|
|
1543
1608
|
])) : o("", !0),
|
|
1544
|
-
c("div",
|
|
1609
|
+
c("div", yt, [c("div", {
|
|
1545
1610
|
ref_key: "galleryElement",
|
|
1546
1611
|
ref: d,
|
|
1547
1612
|
class: "gallery-shell reel-feed",
|
|
1548
1613
|
"data-active-post-id": L.value,
|
|
1549
1614
|
"data-active-media-index": z.value,
|
|
1550
|
-
onScrollPassive:
|
|
1615
|
+
onScrollPassive: ie
|
|
1551
1616
|
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1552
1617
|
key: 1,
|
|
1553
1618
|
class: "reel-track",
|
|
1554
1619
|
style: _(N.value),
|
|
1555
1620
|
"aria-label": "Media gallery"
|
|
1556
|
-
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(
|
|
1621
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(ct, {
|
|
1557
1622
|
key: n.postId,
|
|
1558
1623
|
active: r === g.value && !x.value,
|
|
1559
1624
|
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
@@ -1562,7 +1627,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1562
1627
|
"fetch-priority": e,
|
|
1563
1628
|
index: r,
|
|
1564
1629
|
item: n,
|
|
1565
|
-
"item-style":
|
|
1630
|
+
"item-style": q(r),
|
|
1566
1631
|
"media-card": t.mediaCard,
|
|
1567
1632
|
layout: "reel",
|
|
1568
1633
|
"loaded-count": t.items.length,
|
|
@@ -1599,12 +1664,12 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1599
1664
|
class: "reel-forward-status",
|
|
1600
1665
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1601
1666
|
"data-status": t.reelForward.status
|
|
1602
|
-
}, [c("p", null, T(
|
|
1667
|
+
}, [c("p", null, T(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1603
1668
|
key: 0,
|
|
1604
1669
|
class: "reel-forward-retry",
|
|
1605
1670
|
type: "button",
|
|
1606
1671
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1607
|
-
}, " Retry ")) : o("", !0)], 8,
|
|
1672
|
+
}, " Retry ")) : o("", !0)], 8, xt)), t.reelForward.status === "idle" ? (b(), a(U, {
|
|
1608
1673
|
key: 2,
|
|
1609
1674
|
actions: t.feedFooterActions,
|
|
1610
1675
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1613,7 +1678,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1613
1678
|
"has-next": t.hasNext,
|
|
1614
1679
|
"is-loading": t.isLoadingMore,
|
|
1615
1680
|
"load-more-locked": t.loadMoreLocked,
|
|
1616
|
-
"show-load-more":
|
|
1681
|
+
"show-load-more": te.value,
|
|
1617
1682
|
state: t.state,
|
|
1618
1683
|
onLoadMore: r[1] ||= (e) => u("loadMore"),
|
|
1619
1684
|
onRetryEnd: r[2] ||= (e) => u("retryEnd")
|
|
@@ -1627,13 +1692,13 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1627
1692
|
"load-more-locked",
|
|
1628
1693
|
"show-load-more",
|
|
1629
1694
|
"state"
|
|
1630
|
-
])) : o("", !0)], 40,
|
|
1695
|
+
])) : o("", !0)], 40, bt), c("div", {
|
|
1631
1696
|
ref_key: "reelControlsElement",
|
|
1632
1697
|
ref: f,
|
|
1633
1698
|
class: "reel-media-controls-host",
|
|
1634
1699
|
"data-test": "reel-media-controls-host"
|
|
1635
1700
|
}, null, 512)]),
|
|
1636
|
-
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(
|
|
1701
|
+
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(Pe, {
|
|
1637
1702
|
key: 1,
|
|
1638
1703
|
index: g.value,
|
|
1639
1704
|
item: R.value,
|
|
@@ -1655,24 +1720,24 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1655
1720
|
"style",
|
|
1656
1721
|
"total"
|
|
1657
1722
|
])) : o("", !0),
|
|
1658
|
-
|
|
1659
|
-
key:
|
|
1723
|
+
G.value ? (b(), a(vt, {
|
|
1724
|
+
key: ee.value,
|
|
1660
1725
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1661
|
-
label:
|
|
1726
|
+
label: W.value,
|
|
1662
1727
|
onComplete: X
|
|
1663
1728
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1664
1729
|
], 2));
|
|
1665
1730
|
}
|
|
1666
|
-
}),
|
|
1731
|
+
}), Tt = ["data-info-sheet-open", "data-info-sheet-mode"], Et = ["aria-hidden", "inert"], Dt = {
|
|
1667
1732
|
key: 0,
|
|
1668
1733
|
class: "reel-info-sheet-layer",
|
|
1669
1734
|
"data-test": "reel-info-sheet"
|
|
1670
|
-
},
|
|
1735
|
+
}, Ot = [
|
|
1671
1736
|
"role",
|
|
1672
1737
|
"aria-modal",
|
|
1673
1738
|
"tabindex",
|
|
1674
1739
|
"data-active-post-id"
|
|
1675
|
-
],
|
|
1740
|
+
], kt = /* @__PURE__ */ d({
|
|
1676
1741
|
__name: "ReelLayout",
|
|
1677
1742
|
props: {
|
|
1678
1743
|
forwardIndex: { default: null },
|
|
@@ -1765,7 +1830,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1765
1830
|
function H(e, t) {
|
|
1766
1831
|
d("mediaChange", e, t);
|
|
1767
1832
|
}
|
|
1768
|
-
function
|
|
1833
|
+
function ee(e, t) {
|
|
1769
1834
|
d("ready", e, t);
|
|
1770
1835
|
}
|
|
1771
1836
|
return O(() => ({
|
|
@@ -1797,7 +1862,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1797
1862
|
class: "reel-layout-main",
|
|
1798
1863
|
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1799
1864
|
inert: e.infoSheetOverlay && A.value || void 0
|
|
1800
|
-
}, [u(
|
|
1865
|
+
}, [u(wt, {
|
|
1801
1866
|
ref_key: "reelFeed",
|
|
1802
1867
|
ref: p,
|
|
1803
1868
|
"can-retry-end": e.canRetryEnd,
|
|
@@ -1824,7 +1889,7 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1824
1889
|
onError: V,
|
|
1825
1890
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1826
1891
|
onMediaChange: H,
|
|
1827
|
-
onReady:
|
|
1892
|
+
onReady: ee,
|
|
1828
1893
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1829
1894
|
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1830
1895
|
}, null, 8, [
|
|
@@ -1848,8 +1913,8 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1848
1913
|
"reel-forward",
|
|
1849
1914
|
"state",
|
|
1850
1915
|
"total"
|
|
1851
|
-
])], 8,
|
|
1852
|
-
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div",
|
|
1916
|
+
])], 8, Et), u(n, { name: "vibe-info-sheet" }, {
|
|
1917
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Dt, [c("aside", {
|
|
1853
1918
|
ref_key: "sheetElement",
|
|
1854
1919
|
ref: _,
|
|
1855
1920
|
class: "reel-info-sheet",
|
|
@@ -1858,14 +1923,14 @@ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
|
|
|
1858
1923
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1859
1924
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1860
1925
|
"data-active-post-id": T.value?.postId
|
|
1861
|
-
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8,
|
|
1926
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Ot)])) : o("", !0)]),
|
|
1862
1927
|
_: 1
|
|
1863
|
-
})], 10,
|
|
1928
|
+
})], 10, Tt));
|
|
1864
1929
|
}
|
|
1865
1930
|
});
|
|
1866
1931
|
//#endregion
|
|
1867
1932
|
//#region src/core/mediaLifecycle.ts
|
|
1868
|
-
function
|
|
1933
|
+
function At(e, t, n, r, i) {
|
|
1869
1934
|
let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
|
|
1870
1935
|
if (!o) return null;
|
|
1871
1936
|
let s = N(o, n), c = P(o, s);
|
|
@@ -1881,7 +1946,7 @@ function Ot(e, t, n, r, i) {
|
|
|
1881
1946
|
postIndex: a
|
|
1882
1947
|
};
|
|
1883
1948
|
}
|
|
1884
|
-
function
|
|
1949
|
+
function jt(e, t) {
|
|
1885
1950
|
O(() => {
|
|
1886
1951
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
|
|
1887
1952
|
return {
|
|
@@ -1891,20 +1956,20 @@ function kt(e, t) {
|
|
|
1891
1956
|
};
|
|
1892
1957
|
}, (n, r) => {
|
|
1893
1958
|
if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
|
|
1894
|
-
let i =
|
|
1959
|
+
let i = At(e, n.postId, n.mediaIndex, "reel", n.origin);
|
|
1895
1960
|
i && t(i);
|
|
1896
1961
|
}, { flush: "sync" });
|
|
1897
1962
|
}
|
|
1898
1963
|
//#endregion
|
|
1899
1964
|
//#region src/components/useMediaLifecycle.ts
|
|
1900
|
-
function
|
|
1965
|
+
function Mt(e, t) {
|
|
1901
1966
|
let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = r(() => e.reelMediaSource === "original" ? i.value : n.value);
|
|
1902
1967
|
function o(e, t, n, r) {
|
|
1903
1968
|
let i = F(t, n);
|
|
1904
1969
|
e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
|
|
1905
1970
|
}
|
|
1906
1971
|
function s(t, n, r, i) {
|
|
1907
|
-
return
|
|
1972
|
+
return At(e, t, n, r, i);
|
|
1908
1973
|
}
|
|
1909
1974
|
function c(e, n, r, i) {
|
|
1910
1975
|
let a = s(e, n, r, i);
|
|
@@ -1926,7 +1991,7 @@ function At(e, t) {
|
|
|
1926
1991
|
let r = s(e, n, "masonry", null);
|
|
1927
1992
|
r && t.visible(r);
|
|
1928
1993
|
}
|
|
1929
|
-
return
|
|
1994
|
+
return jt(e, t.reelChange), O(() => {
|
|
1930
1995
|
let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
|
|
1931
1996
|
return {
|
|
1932
1997
|
mediaIndex: n,
|
|
@@ -1951,16 +2016,16 @@ function At(e, t) {
|
|
|
1951
2016
|
}
|
|
1952
2017
|
//#endregion
|
|
1953
2018
|
//#region src/core/reelEscapeStack.ts
|
|
1954
|
-
var
|
|
1955
|
-
function
|
|
1956
|
-
return
|
|
1957
|
-
let t =
|
|
1958
|
-
t >= 0 &&
|
|
2019
|
+
var Nt = [];
|
|
2020
|
+
function Pt(e) {
|
|
2021
|
+
return Nt.push(e), () => {
|
|
2022
|
+
let t = Nt.indexOf(e);
|
|
2023
|
+
t >= 0 && Nt.splice(t, 1);
|
|
1959
2024
|
};
|
|
1960
2025
|
}
|
|
1961
|
-
function
|
|
2026
|
+
function Ft(e) {
|
|
1962
2027
|
if (!e.isActive()) return !1;
|
|
1963
|
-
let t =
|
|
2028
|
+
let t = Nt.filter((e) => e.isActive()), n = e.element();
|
|
1964
2029
|
return n !== null && t.some((t) => {
|
|
1965
2030
|
if (t === e) return !1;
|
|
1966
2031
|
let r = t.element();
|
|
@@ -1976,14 +2041,14 @@ function Nt(e) {
|
|
|
1976
2041
|
}
|
|
1977
2042
|
//#endregion
|
|
1978
2043
|
//#region src/components/useReelKeyboard.ts
|
|
1979
|
-
function
|
|
2044
|
+
function It(e) {
|
|
1980
2045
|
let t = {
|
|
1981
2046
|
element: e.element,
|
|
1982
2047
|
isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
|
|
1983
2048
|
}, n = null;
|
|
1984
2049
|
function r(n) {
|
|
1985
2050
|
let r = t.isActive();
|
|
1986
|
-
if (n.key === "Escape" && r && !
|
|
2051
|
+
if (n.key === "Escape" && r && !Ft(t)) return;
|
|
1987
2052
|
if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
|
|
1988
2053
|
n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
|
|
1989
2054
|
return;
|
|
@@ -2003,14 +2068,14 @@ function Pt(e) {
|
|
|
2003
2068
|
a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
|
|
2004
2069
|
}
|
|
2005
2070
|
y(() => {
|
|
2006
|
-
n =
|
|
2071
|
+
n = Pt(t), window.addEventListener("keydown", r);
|
|
2007
2072
|
}), v(() => {
|
|
2008
2073
|
window.removeEventListener("keydown", r), n?.(), n = null;
|
|
2009
2074
|
});
|
|
2010
2075
|
}
|
|
2011
2076
|
//#endregion
|
|
2012
2077
|
//#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
|
|
2013
|
-
var
|
|
2078
|
+
var Lt = 35, Rt = 420, zt = /* @__PURE__ */ d({
|
|
2014
2079
|
__name: "VibeSurface",
|
|
2015
2080
|
props: {
|
|
2016
2081
|
canRetryEnd: { type: Boolean },
|
|
@@ -2036,70 +2101,70 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
|
2036
2101
|
"retryForward"
|
|
2037
2102
|
],
|
|
2038
2103
|
setup(t, { expose: i, emit: c }) {
|
|
2039
|
-
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => L(l.state, A.value)), { markMasonryVisible: P, markPreviewError: F, markPreviewReady: I, markReelError: R, markReelReady: z, originalStates: B, previewStates: V, reelStates: H } =
|
|
2104
|
+
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 } = Mt(l.state, {
|
|
2040
2105
|
ready: (e) => d("mediaReady", e),
|
|
2041
2106
|
reelChange: (e) => d("reelMediaChange", e),
|
|
2042
2107
|
visible: (e) => d("mediaVisible", e)
|
|
2043
|
-
}),
|
|
2044
|
-
function
|
|
2108
|
+
}), ee = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
|
|
2109
|
+
function K() {
|
|
2045
2110
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2046
2111
|
}
|
|
2047
|
-
function
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2112
|
+
function ne() {
|
|
2113
|
+
U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
|
|
2114
|
+
U = requestAnimationFrame(() => {
|
|
2115
|
+
U = null, S.value = /* @__PURE__ */ new Set();
|
|
2051
2116
|
});
|
|
2052
2117
|
});
|
|
2053
2118
|
}
|
|
2054
|
-
function
|
|
2119
|
+
function q(e, t) {
|
|
2055
2120
|
let n = l.state.items.find((t) => t.postId === e);
|
|
2056
2121
|
if (!n) return;
|
|
2057
2122
|
let r = N(n, t);
|
|
2058
2123
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
2059
2124
|
}
|
|
2060
|
-
async function
|
|
2125
|
+
async function re() {
|
|
2061
2126
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
2062
2127
|
}
|
|
2063
|
-
function
|
|
2128
|
+
function ie(e) {
|
|
2064
2129
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
2065
2130
|
}
|
|
2066
|
-
function
|
|
2131
|
+
function ae(e) {
|
|
2067
2132
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
2068
2133
|
}
|
|
2069
|
-
function
|
|
2134
|
+
function oe(e) {
|
|
2070
2135
|
if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
|
|
2071
2136
|
let t = l.state.items.find((t) => t.postId === e.postId);
|
|
2072
2137
|
if (!t) return "not-found";
|
|
2073
2138
|
let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
|
|
2074
2139
|
return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
|
|
2075
2140
|
}
|
|
2076
|
-
function
|
|
2141
|
+
function se() {
|
|
2077
2142
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
2078
2143
|
}
|
|
2079
|
-
function
|
|
2080
|
-
|
|
2144
|
+
function ce(e, t) {
|
|
2145
|
+
W = e, G = t === "keyboard", y.value = Y(e), d("openReel", e), m(() => h.value?.focus());
|
|
2081
2146
|
}
|
|
2082
|
-
function
|
|
2147
|
+
function le(e) {
|
|
2083
2148
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
2084
2149
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
2085
2150
|
}
|
|
2086
|
-
function
|
|
2087
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
2088
|
-
let
|
|
2089
|
-
if (
|
|
2090
|
-
let
|
|
2091
|
-
return
|
|
2092
|
-
|
|
2093
|
-
}), S.value = new Set([...S.value].filter((e) => !
|
|
2151
|
+
function J(e, t) {
|
|
2152
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
|
|
2153
|
+
let n = [...new Set(e)], r = n.filter(le);
|
|
2154
|
+
if (r.length === 0) return 0;
|
|
2155
|
+
let i = new Map(D.value), a = t?.staggerMs ?? Lt;
|
|
2156
|
+
return r.forEach((e, t) => {
|
|
2157
|
+
i.set(e, t * a);
|
|
2158
|
+
}), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, Rt + (r.length - 1) * a;
|
|
2094
2159
|
}
|
|
2095
|
-
function
|
|
2096
|
-
let n =
|
|
2160
|
+
function ue(e, t) {
|
|
2161
|
+
let n = le(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
2097
2162
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
2098
2163
|
r.classList.remove("media-card-focus-silent");
|
|
2099
2164
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
2100
2165
|
}
|
|
2101
|
-
function
|
|
2102
|
-
let t = g.value, n =
|
|
2166
|
+
function Y(e) {
|
|
2167
|
+
let t = g.value, n = le(e);
|
|
2103
2168
|
if (t === null || n === null) return {};
|
|
2104
2169
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
2105
2170
|
return {
|
|
@@ -2110,15 +2175,15 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
|
2110
2175
|
};
|
|
2111
2176
|
}
|
|
2112
2177
|
function de() {
|
|
2113
|
-
l.state.reelOrigin === "masonry" && (
|
|
2178
|
+
l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
|
|
2114
2179
|
}
|
|
2115
2180
|
function fe() {
|
|
2116
|
-
let e =
|
|
2117
|
-
x.value = !1,
|
|
2118
|
-
e !== null &&
|
|
2181
|
+
let e = W, t = G;
|
|
2182
|
+
x.value = !1, W = null, G = !1, y.value = {}, m(() => {
|
|
2183
|
+
e !== null && ue(e, t);
|
|
2119
2184
|
});
|
|
2120
2185
|
}
|
|
2121
|
-
return
|
|
2186
|
+
return It({
|
|
2122
2187
|
closeMasonryReel: de,
|
|
2123
2188
|
element: () => g.value,
|
|
2124
2189
|
isReelLeaving: () => x.value,
|
|
@@ -2126,31 +2191,31 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
|
2126
2191
|
setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
|
|
2127
2192
|
state: l.state
|
|
2128
2193
|
}), O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
2129
|
-
let t = e.filter((e) => !
|
|
2130
|
-
if (
|
|
2194
|
+
let t = e.filter((e) => !ee.has(e)), n = new Set(e);
|
|
2195
|
+
if (ee = 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;
|
|
2131
2196
|
let r = /* @__PURE__ */ new Map();
|
|
2132
2197
|
e.forEach((e) => {
|
|
2133
2198
|
let t = C.value.get(e);
|
|
2134
2199
|
t !== void 0 && r.set(e, t);
|
|
2135
2200
|
}), t.forEach((e, t) => {
|
|
2136
|
-
r.set(e, t *
|
|
2137
|
-
}), C.value = r, S.value = new Set([...S.value, ...t]),
|
|
2201
|
+
r.set(e, t * Lt);
|
|
2202
|
+
}), C.value = r, S.value = new Set([...S.value, ...t]), ne();
|
|
2138
2203
|
}, { flush: "sync" }), v(() => {
|
|
2139
|
-
|
|
2204
|
+
U !== null && cancelAnimationFrame(U);
|
|
2140
2205
|
}), i({
|
|
2141
|
-
changeActiveReelMedia:
|
|
2142
|
-
getAutoScrollElement:
|
|
2143
|
-
loadIfNearBottom:
|
|
2144
|
-
moveActiveReelPost:
|
|
2145
|
-
navigateToReelItem:
|
|
2146
|
-
startItemRemoval:
|
|
2206
|
+
changeActiveReelMedia: ie,
|
|
2207
|
+
getAutoScrollElement: se,
|
|
2208
|
+
loadIfNearBottom: re,
|
|
2209
|
+
moveActiveReelPost: ae,
|
|
2210
|
+
navigateToReelItem: oe,
|
|
2211
|
+
startItemRemoval: J,
|
|
2147
2212
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
2148
2213
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
2149
2214
|
}), (r, i) => (b(), s("div", {
|
|
2150
2215
|
ref_key: "surfaceElement",
|
|
2151
2216
|
ref: g,
|
|
2152
2217
|
class: "vibe-surface"
|
|
2153
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(
|
|
2218
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(kt, {
|
|
2154
2219
|
key: 0,
|
|
2155
2220
|
ref_key: "reelRenderer",
|
|
2156
2221
|
ref: p,
|
|
@@ -2184,11 +2249,11 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
|
2184
2249
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2185
2250
|
onError: E(R),
|
|
2186
2251
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
2187
|
-
onMediaChange:
|
|
2252
|
+
onMediaChange: q,
|
|
2188
2253
|
onReady: E(z),
|
|
2189
2254
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
2190
2255
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
2191
|
-
}, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(
|
|
2256
|
+
}, 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, {
|
|
2192
2257
|
key: 1,
|
|
2193
2258
|
actions: t.feedFooterActions,
|
|
2194
2259
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2201,7 +2266,7 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
|
2201
2266
|
"can-retry-end",
|
|
2202
2267
|
"feed-footer",
|
|
2203
2268
|
"state"
|
|
2204
|
-
])) : (b(), s(e, { key: 2 }, [u(
|
|
2269
|
+
])) : (b(), s(e, { key: 2 }, [u(mt, {
|
|
2205
2270
|
ref_key: "masonryRenderer",
|
|
2206
2271
|
ref: f,
|
|
2207
2272
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2226,10 +2291,10 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
|
2226
2291
|
suspended: t.state.reelOrigin === "masonry" || x.value,
|
|
2227
2292
|
state: j.value,
|
|
2228
2293
|
total: t.state.total,
|
|
2229
|
-
onActivate:
|
|
2294
|
+
onActivate: ce,
|
|
2230
2295
|
onError: E(F),
|
|
2231
2296
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2232
|
-
onMediaChange:
|
|
2297
|
+
onMediaChange: q,
|
|
2233
2298
|
onReady: E(I),
|
|
2234
2299
|
onRetryEnd: i[8] ||= (e) => d("retryEnd"),
|
|
2235
2300
|
onVisible: E(P)
|
|
@@ -2273,7 +2338,7 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
|
2273
2338
|
"aria-modal": "true",
|
|
2274
2339
|
tabindex: "-1",
|
|
2275
2340
|
style: _(y.value)
|
|
2276
|
-
}, [u(
|
|
2341
|
+
}, [u(kt, {
|
|
2277
2342
|
ref_key: "reelRenderer",
|
|
2278
2343
|
ref: p,
|
|
2279
2344
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -2306,7 +2371,7 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
|
2306
2371
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2307
2372
|
onError: E(R),
|
|
2308
2373
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2309
|
-
onMediaChange:
|
|
2374
|
+
onMediaChange: q,
|
|
2310
2375
|
onReady: E(z),
|
|
2311
2376
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2312
2377
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
@@ -2317,7 +2382,7 @@ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
|
|
|
2317
2382
|
});
|
|
2318
2383
|
//#endregion
|
|
2319
2384
|
//#region src/core/page.ts
|
|
2320
|
-
function
|
|
2385
|
+
function Bt(e) {
|
|
2321
2386
|
if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
|
|
2322
2387
|
if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
|
|
2323
2388
|
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.");
|
|
@@ -2329,32 +2394,32 @@ function Z(e, t) {
|
|
|
2329
2394
|
}
|
|
2330
2395
|
//#endregion
|
|
2331
2396
|
//#region src/core/requestDelay.ts
|
|
2332
|
-
var
|
|
2397
|
+
var Vt = 2e3, Ht = 1e4, Ut = 250, Wt = {
|
|
2333
2398
|
delayRemainingMs: null,
|
|
2334
2399
|
nextRequestAt: null
|
|
2335
2400
|
};
|
|
2336
|
-
function
|
|
2401
|
+
function Gt(e, t) {
|
|
2337
2402
|
return e === void 0 ? t : Math.floor(e);
|
|
2338
2403
|
}
|
|
2339
|
-
function
|
|
2404
|
+
function Kt(e, t) {
|
|
2340
2405
|
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.`);
|
|
2341
2406
|
}
|
|
2342
|
-
function
|
|
2343
|
-
let n =
|
|
2407
|
+
function qt(e, t = {}) {
|
|
2408
|
+
let n = Gt(t.delayStepMs, Vt), r = Gt(t.delayMaxMs, Ht);
|
|
2344
2409
|
return Math.min(Math.max(0, e) * n, r);
|
|
2345
2410
|
}
|
|
2346
2411
|
function Q(e) {
|
|
2347
|
-
if (e == null || !Number.isFinite(e)) return { ...
|
|
2412
|
+
if (e == null || !Number.isFinite(e)) return { ...Wt };
|
|
2348
2413
|
let t = Math.max(0, Math.floor(e - Date.now()));
|
|
2349
2414
|
return t > 0 ? {
|
|
2350
2415
|
delayRemainingMs: t,
|
|
2351
2416
|
nextRequestAt: e
|
|
2352
|
-
} : { ...
|
|
2417
|
+
} : { ...Wt };
|
|
2353
2418
|
}
|
|
2354
|
-
async function
|
|
2419
|
+
async function Jt({ delayMs: e, onChange: t, signal: n }) {
|
|
2355
2420
|
if (n.aborted) throw new DOMException("Aborted", "AbortError");
|
|
2356
2421
|
if (e <= 0) {
|
|
2357
|
-
t({ ...
|
|
2422
|
+
t({ ...Wt });
|
|
2358
2423
|
return;
|
|
2359
2424
|
}
|
|
2360
2425
|
let r = Date.now() + e;
|
|
@@ -2362,9 +2427,9 @@ async function Kt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2362
2427
|
delayRemainingMs: e,
|
|
2363
2428
|
nextRequestAt: r
|
|
2364
2429
|
}), await new Promise((i, a) => {
|
|
2365
|
-
let o = !1, s = setInterval(f,
|
|
2430
|
+
let o = !1, s = setInterval(f, Ut), c = setTimeout(() => u(), e);
|
|
2366
2431
|
function l() {
|
|
2367
|
-
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...
|
|
2432
|
+
clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Wt });
|
|
2368
2433
|
}
|
|
2369
2434
|
function u(e) {
|
|
2370
2435
|
o || (o = !0, l(), e ? a(e) : i());
|
|
@@ -2379,13 +2444,13 @@ async function Kt({ delayMs: e, onChange: t, signal: n }) {
|
|
|
2379
2444
|
n.addEventListener("abort", d, { once: !0 });
|
|
2380
2445
|
});
|
|
2381
2446
|
}
|
|
2382
|
-
var
|
|
2447
|
+
var Yt = class {
|
|
2383
2448
|
interval = null;
|
|
2384
2449
|
constructor(e) {
|
|
2385
2450
|
this.onChange = e;
|
|
2386
2451
|
}
|
|
2387
2452
|
clear() {
|
|
2388
|
-
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...
|
|
2453
|
+
this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Wt });
|
|
2389
2454
|
}
|
|
2390
2455
|
sync(e) {
|
|
2391
2456
|
this.clear();
|
|
@@ -2393,22 +2458,22 @@ var qt = class {
|
|
|
2393
2458
|
this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
|
|
2394
2459
|
let t = Q(e);
|
|
2395
2460
|
this.onChange(t), t.delayRemainingMs === null && this.clear();
|
|
2396
|
-
},
|
|
2461
|
+
}, Ut));
|
|
2397
2462
|
}
|
|
2398
2463
|
};
|
|
2399
|
-
function
|
|
2464
|
+
function Xt(e, t = !0) {
|
|
2400
2465
|
return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
|
|
2401
2466
|
}
|
|
2402
|
-
function
|
|
2467
|
+
function Zt(e) {
|
|
2403
2468
|
return `${typeof e}:${String(e)}`;
|
|
2404
2469
|
}
|
|
2405
|
-
function
|
|
2470
|
+
function Qt(e, t) {
|
|
2406
2471
|
if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
|
|
2407
2472
|
}
|
|
2408
|
-
function
|
|
2473
|
+
function $t(e) {
|
|
2409
2474
|
if (!e) return;
|
|
2410
|
-
if (
|
|
2411
|
-
|
|
2475
|
+
if (Qt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
|
|
2476
|
+
Kt(e, "frontend autofill");
|
|
2412
2477
|
let t = e.maxAdditionalPages;
|
|
2413
2478
|
if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
|
|
2414
2479
|
return;
|
|
@@ -2420,7 +2485,7 @@ function Zt(e) {
|
|
|
2420
2485
|
if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
|
|
2421
2486
|
}
|
|
2422
2487
|
}
|
|
2423
|
-
function
|
|
2488
|
+
function en(e, t, n = !0) {
|
|
2424
2489
|
if (!e) return {
|
|
2425
2490
|
cycleId: null,
|
|
2426
2491
|
delayRemainingMs: null,
|
|
@@ -2454,7 +2519,7 @@ function Qt(e, t, n = !0) {
|
|
|
2454
2519
|
strategy: e.strategy
|
|
2455
2520
|
};
|
|
2456
2521
|
}
|
|
2457
|
-
function
|
|
2522
|
+
function tn(e) {
|
|
2458
2523
|
return [
|
|
2459
2524
|
"cancelling",
|
|
2460
2525
|
"filling",
|
|
@@ -2462,9 +2527,9 @@ function $t(e) {
|
|
|
2462
2527
|
"waiting"
|
|
2463
2528
|
].includes(e.status);
|
|
2464
2529
|
}
|
|
2465
|
-
async function
|
|
2530
|
+
async function nn(e, t, n) {
|
|
2466
2531
|
let r = t.autofill;
|
|
2467
|
-
if (
|
|
2532
|
+
if (!tn(r) || !r.cycleId) return;
|
|
2468
2533
|
let i = {
|
|
2469
2534
|
cycleId: r.cycleId,
|
|
2470
2535
|
feedKey: r.feedKey ?? "",
|
|
@@ -2477,16 +2542,16 @@ async function en(e, t, n) {
|
|
|
2477
2542
|
throw r.error = e, r.status = "error", e;
|
|
2478
2543
|
}
|
|
2479
2544
|
}
|
|
2480
|
-
function
|
|
2545
|
+
function rn(e, t, n) {
|
|
2481
2546
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2482
2547
|
}
|
|
2483
|
-
async function
|
|
2484
|
-
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ??
|
|
2548
|
+
async function an({ 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 }) {
|
|
2549
|
+
let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Xt(s), g = t, _ = t, v = t, y = 0, b = [], x;
|
|
2485
2550
|
for (; y < h;) {
|
|
2486
|
-
let e =
|
|
2551
|
+
let e = Zt(g);
|
|
2487
2552
|
if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2488
|
-
if (m.add(e), await
|
|
2489
|
-
delayMs:
|
|
2553
|
+
if (m.add(e), await Jt({
|
|
2554
|
+
delayMs: qt(l + y, s),
|
|
2490
2555
|
onChange: a,
|
|
2491
2556
|
signal: d
|
|
2492
2557
|
}), y > 0 && u()) return {
|
|
@@ -2500,7 +2565,7 @@ async function nn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2500
2565
|
status: "paused",
|
|
2501
2566
|
total: x
|
|
2502
2567
|
};
|
|
2503
|
-
let t =
|
|
2568
|
+
let t = Bt(await n({
|
|
2504
2569
|
cursor: g,
|
|
2505
2570
|
signal: d
|
|
2506
2571
|
}));
|
|
@@ -2557,12 +2622,12 @@ async function nn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
|
|
|
2557
2622
|
}
|
|
2558
2623
|
//#endregion
|
|
2559
2624
|
//#region src/core/autofillController.ts
|
|
2560
|
-
var
|
|
2625
|
+
var on = class {
|
|
2561
2626
|
collection = null;
|
|
2562
2627
|
cycle = 0;
|
|
2563
2628
|
delayCountdown;
|
|
2564
2629
|
constructor(e) {
|
|
2565
|
-
this.context = e, this.delayCountdown = new
|
|
2630
|
+
this.context = e, this.delayCountdown = new Yt((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2566
2631
|
}
|
|
2567
2632
|
beginCycle() {
|
|
2568
2633
|
let { options: e, state: t } = this.context;
|
|
@@ -2570,14 +2635,14 @@ var rn = class {
|
|
|
2570
2635
|
this.clear();
|
|
2571
2636
|
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2572
2637
|
return t.autofill = {
|
|
2573
|
-
...
|
|
2638
|
+
...en(e, void 0, !1),
|
|
2574
2639
|
cycleId: n,
|
|
2575
2640
|
status: "filling"
|
|
2576
2641
|
}, n;
|
|
2577
2642
|
}
|
|
2578
2643
|
async cancel() {
|
|
2579
2644
|
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2580
|
-
await
|
|
2645
|
+
await nn(t, n, e), this.commitCollection();
|
|
2581
2646
|
}
|
|
2582
2647
|
captureCollection(e, t) {
|
|
2583
2648
|
t && (this.collection = e);
|
|
@@ -2605,30 +2670,30 @@ var rn = class {
|
|
|
2605
2670
|
requests: r.requests
|
|
2606
2671
|
}));
|
|
2607
2672
|
}
|
|
2608
|
-
},
|
|
2609
|
-
function
|
|
2673
|
+
}, sn = 100;
|
|
2674
|
+
function cn(e, t) {
|
|
2610
2675
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2611
2676
|
}
|
|
2612
|
-
function
|
|
2677
|
+
function ln(e, t, n) {
|
|
2613
2678
|
return Math.min(n, Math.max(t, e));
|
|
2614
2679
|
}
|
|
2615
|
-
function
|
|
2680
|
+
function un(e) {
|
|
2616
2681
|
if (!e) return;
|
|
2617
2682
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2618
|
-
if (
|
|
2619
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2683
|
+
if (cn("autoScroll.minSpeedPxPerSecond", t), cn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2684
|
+
e.speedPxPerSecond !== void 0 && cn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2620
2685
|
}
|
|
2621
|
-
function
|
|
2686
|
+
function dn(e) {
|
|
2622
2687
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2623
2688
|
return {
|
|
2624
2689
|
enabled: e?.enabled ?? !1,
|
|
2625
2690
|
maxSpeedPxPerSecond: n,
|
|
2626
2691
|
minSpeedPxPerSecond: t,
|
|
2627
2692
|
paused: !1,
|
|
2628
|
-
speedPxPerSecond:
|
|
2693
|
+
speedPxPerSecond: ln(e?.speedPxPerSecond ?? 80, t, n)
|
|
2629
2694
|
};
|
|
2630
2695
|
}
|
|
2631
|
-
var
|
|
2696
|
+
var fn = class {
|
|
2632
2697
|
frame = null;
|
|
2633
2698
|
lastTimestamp = null;
|
|
2634
2699
|
mounted = !1;
|
|
@@ -2648,9 +2713,9 @@ var un = class {
|
|
|
2648
2713
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2649
2714
|
}
|
|
2650
2715
|
setSpeed(e) {
|
|
2651
|
-
|
|
2716
|
+
cn("auto-scroll speed", e);
|
|
2652
2717
|
let t = this.options.state;
|
|
2653
|
-
t.speedPxPerSecond =
|
|
2718
|
+
t.speedPxPerSecond = ln(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2654
2719
|
}
|
|
2655
2720
|
tick = (e) => {
|
|
2656
2721
|
this.frame = null;
|
|
@@ -2662,7 +2727,7 @@ var un = class {
|
|
|
2662
2727
|
return;
|
|
2663
2728
|
}
|
|
2664
2729
|
if (this.lastTimestamp !== null) {
|
|
2665
|
-
let r = Math.min(
|
|
2730
|
+
let r = Math.min(sn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2666
2731
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2667
2732
|
}
|
|
2668
2733
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2676,7 +2741,7 @@ var un = class {
|
|
|
2676
2741
|
};
|
|
2677
2742
|
//#endregion
|
|
2678
2743
|
//#region src/core/backendAutofill.ts
|
|
2679
|
-
async function
|
|
2744
|
+
async function pn(e, t, n, r) {
|
|
2680
2745
|
let i = await e.onUnderfilled(n);
|
|
2681
2746
|
if (!r()) return;
|
|
2682
2747
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2690,19 +2755,19 @@ async function dn(e, t, n, r) {
|
|
|
2690
2755
|
status: "waiting"
|
|
2691
2756
|
});
|
|
2692
2757
|
}
|
|
2693
|
-
function
|
|
2758
|
+
function mn(e, t) {
|
|
2694
2759
|
["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);
|
|
2695
2760
|
}
|
|
2696
|
-
function
|
|
2761
|
+
function hn(e, t, n) {
|
|
2697
2762
|
let r = t.autofill;
|
|
2698
|
-
return !
|
|
2763
|
+
return !rn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (mn(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);
|
|
2699
2764
|
}
|
|
2700
|
-
function
|
|
2701
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill =
|
|
2765
|
+
function gn(e, t, n) {
|
|
2766
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = en(e, n), mn(t, n), !0);
|
|
2702
2767
|
}
|
|
2703
2768
|
//#endregion
|
|
2704
2769
|
//#region src/core/initialAutofill.ts
|
|
2705
|
-
async function
|
|
2770
|
+
async function _n({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
|
|
2706
2771
|
let c = a.autofill;
|
|
2707
2772
|
if (!c) return;
|
|
2708
2773
|
let l = s.items.length;
|
|
@@ -2715,7 +2780,7 @@ async function hn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2715
2780
|
return;
|
|
2716
2781
|
}
|
|
2717
2782
|
if (c.strategy === "backend") {
|
|
2718
|
-
await
|
|
2783
|
+
await pn(c, s, {
|
|
2719
2784
|
cycleId: e,
|
|
2720
2785
|
feedKey: c.feedKey,
|
|
2721
2786
|
items: [...s.items],
|
|
@@ -2732,11 +2797,11 @@ async function hn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2732
2797
|
s.autofill.status = "exhausted";
|
|
2733
2798
|
return;
|
|
2734
2799
|
}
|
|
2735
|
-
let u = await
|
|
2800
|
+
let u = await an({
|
|
2736
2801
|
existingItems: s.items,
|
|
2737
2802
|
initialCursor: s.next,
|
|
2738
2803
|
loadPage: a.loadPage,
|
|
2739
|
-
maximumRequests:
|
|
2804
|
+
maximumRequests: Xt(c, !1),
|
|
2740
2805
|
onCollection: n,
|
|
2741
2806
|
onDelayChange: (e) => {
|
|
2742
2807
|
t() && Object.assign(s.autofill, e);
|
|
@@ -2759,13 +2824,13 @@ async function hn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
|
|
|
2759
2824
|
}
|
|
2760
2825
|
//#endregion
|
|
2761
2826
|
//#region src/core/fill.ts
|
|
2762
|
-
function
|
|
2827
|
+
function vn(e) {
|
|
2763
2828
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2764
2829
|
}
|
|
2765
|
-
function
|
|
2830
|
+
function yn(e) {
|
|
2766
2831
|
return `${typeof e}:${String(e)}`;
|
|
2767
2832
|
}
|
|
2768
|
-
function
|
|
2833
|
+
function bn(e) {
|
|
2769
2834
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2770
2835
|
if ("pages" in e) {
|
|
2771
2836
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2774,20 +2839,20 @@ function vn(e) {
|
|
|
2774
2839
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2775
2840
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2776
2841
|
}
|
|
2777
|
-
function
|
|
2842
|
+
function xn(e) {
|
|
2778
2843
|
if (!e) return;
|
|
2779
2844
|
if (e.strategy === "frontend") {
|
|
2780
|
-
|
|
2845
|
+
Kt(e, "frontend fill");
|
|
2781
2846
|
return;
|
|
2782
2847
|
}
|
|
2783
2848
|
if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
|
|
2784
2849
|
let t = e.initialSession;
|
|
2785
2850
|
if (t) {
|
|
2786
2851
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2787
|
-
|
|
2852
|
+
bn(t.target);
|
|
2788
2853
|
}
|
|
2789
2854
|
}
|
|
2790
|
-
function
|
|
2855
|
+
function Sn(e, t, n = !0) {
|
|
2791
2856
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
|
|
2792
2857
|
return {
|
|
2793
2858
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2801,10 +2866,10 @@ function bn(e, t, n = !0) {
|
|
|
2801
2866
|
sessionId: i?.sessionId ?? null,
|
|
2802
2867
|
status: i?.status ?? "idle",
|
|
2803
2868
|
strategy: e?.strategy ?? null,
|
|
2804
|
-
target: i ?
|
|
2869
|
+
target: i ? vn(i.target) : null
|
|
2805
2870
|
};
|
|
2806
2871
|
}
|
|
2807
|
-
function
|
|
2872
|
+
function Cn(e) {
|
|
2808
2873
|
return [
|
|
2809
2874
|
"cancelling",
|
|
2810
2875
|
"filling",
|
|
@@ -2812,13 +2877,13 @@ function xn(e) {
|
|
|
2812
2877
|
"waiting"
|
|
2813
2878
|
].includes(e.status);
|
|
2814
2879
|
}
|
|
2815
|
-
async function
|
|
2880
|
+
async function wn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
|
|
2816
2881
|
let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
|
|
2817
2882
|
for (; _ !== null;) {
|
|
2818
|
-
let e =
|
|
2883
|
+
let e = yn(h);
|
|
2819
2884
|
if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2820
|
-
if (p.add(e), await
|
|
2821
|
-
delayMs:
|
|
2885
|
+
if (p.add(e), await Jt({
|
|
2886
|
+
delayMs: qt(m, o),
|
|
2822
2887
|
onChange: i,
|
|
2823
2888
|
signal: c
|
|
2824
2889
|
}), m > 0 && s()) return {
|
|
@@ -2831,7 +2896,7 @@ async function Sn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
2831
2896
|
status: "paused",
|
|
2832
2897
|
total: y
|
|
2833
2898
|
};
|
|
2834
|
-
let t =
|
|
2899
|
+
let t = Bt(await n({
|
|
2835
2900
|
cursor: h,
|
|
2836
2901
|
signal: c
|
|
2837
2902
|
}));
|
|
@@ -2899,7 +2964,7 @@ async function Sn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
|
|
|
2899
2964
|
}
|
|
2900
2965
|
//#endregion
|
|
2901
2966
|
//#region src/core/backendFill.ts
|
|
2902
|
-
async function
|
|
2967
|
+
async function Tn(e, t, n, r) {
|
|
2903
2968
|
let i = await e.onStart(n);
|
|
2904
2969
|
if (r()) {
|
|
2905
2970
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2913,22 +2978,22 @@ async function Cn(e, t, n, r) {
|
|
|
2913
2978
|
});
|
|
2914
2979
|
}
|
|
2915
2980
|
}
|
|
2916
|
-
function
|
|
2981
|
+
function En(e, t, n) {
|
|
2917
2982
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2918
2983
|
}
|
|
2919
|
-
function
|
|
2984
|
+
function Dn(e) {
|
|
2920
2985
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2921
2986
|
}
|
|
2922
|
-
function
|
|
2987
|
+
function On(e, t) {
|
|
2923
2988
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2924
2989
|
let n = e.fill.target;
|
|
2925
2990
|
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;
|
|
2926
2991
|
}
|
|
2927
|
-
function
|
|
2992
|
+
function kn(e, t, n) {
|
|
2928
2993
|
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));
|
|
2929
2994
|
}
|
|
2930
|
-
function
|
|
2931
|
-
return !
|
|
2995
|
+
function An(e, t, n, r) {
|
|
2996
|
+
return !En(e, t, n) || !Dn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !On(t, n) ? !1 : (kn(t, n, r), Object.assign(t.fill, {
|
|
2932
2997
|
...Q(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2933
2998
|
completedPages: n.completedPages,
|
|
2934
2999
|
error: n.error ?? null,
|
|
@@ -2937,42 +3002,42 @@ function On(e, t, n, r) {
|
|
|
2937
3002
|
status: n.status
|
|
2938
3003
|
}), !0);
|
|
2939
3004
|
}
|
|
2940
|
-
function
|
|
3005
|
+
function jn(e, t, n, r) {
|
|
2941
3006
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2942
3007
|
let i = t.fill;
|
|
2943
|
-
return t.fill =
|
|
3008
|
+
return t.fill = Sn(e, n), !Dn(n) || !On(t, n) ? (t.fill = i, !1) : (kn(t, n, r), !0);
|
|
2944
3009
|
}
|
|
2945
3010
|
//#endregion
|
|
2946
3011
|
//#region src/core/fillController.ts
|
|
2947
|
-
var
|
|
3012
|
+
var Mn = class {
|
|
2948
3013
|
abortController = null;
|
|
2949
3014
|
cycle = 0;
|
|
2950
3015
|
delayCountdown;
|
|
2951
3016
|
requestVersion = 0;
|
|
2952
3017
|
collection = null;
|
|
2953
3018
|
constructor(e) {
|
|
2954
|
-
this.options = e, this.delayCountdown = new
|
|
3019
|
+
this.options = e, this.delayCountdown = new Yt((e) => {
|
|
2955
3020
|
Object.assign(this.options.state.fill, e);
|
|
2956
3021
|
}), this.syncBackendCountdown();
|
|
2957
3022
|
}
|
|
2958
3023
|
isActive() {
|
|
2959
|
-
return
|
|
3024
|
+
return Cn(this.options.state.fill);
|
|
2960
3025
|
}
|
|
2961
3026
|
applyUpdate(e) {
|
|
2962
|
-
let t =
|
|
3027
|
+
let t = An(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2963
3028
|
return t && this.syncBackendCountdown(), t;
|
|
2964
3029
|
}
|
|
2965
3030
|
restoreSession(e) {
|
|
2966
|
-
let t =
|
|
3031
|
+
let t = jn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2967
3032
|
return t && this.syncBackendCountdown(), t;
|
|
2968
3033
|
}
|
|
2969
3034
|
async start(e) {
|
|
2970
3035
|
let t = this.options.fill;
|
|
2971
3036
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2972
3037
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2973
|
-
let n =
|
|
3038
|
+
let n = bn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2974
3039
|
if (this.options.state.fill = {
|
|
2975
|
-
...
|
|
3040
|
+
...Sn(t, void 0, !1),
|
|
2976
3041
|
cycleId: r,
|
|
2977
3042
|
status: "filling",
|
|
2978
3043
|
target: n
|
|
@@ -2983,7 +3048,7 @@ var An = class {
|
|
|
2983
3048
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2984
3049
|
this.abortController = a;
|
|
2985
3050
|
try {
|
|
2986
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
3051
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await Tn(t, this.options.state, {
|
|
2987
3052
|
cycleId: r,
|
|
2988
3053
|
feedKey: t.feedKey,
|
|
2989
3054
|
items: [...this.options.state.items],
|
|
@@ -3001,7 +3066,7 @@ var An = class {
|
|
|
3001
3066
|
}
|
|
3002
3067
|
async cancel() {
|
|
3003
3068
|
let { fill: e, state: t } = this.options;
|
|
3004
|
-
if (!
|
|
3069
|
+
if (!Cn(t.fill) || !t.fill.cycleId) return;
|
|
3005
3070
|
let n = {
|
|
3006
3071
|
cycleId: t.fill.cycleId,
|
|
3007
3072
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -3015,7 +3080,7 @@ var An = class {
|
|
|
3015
3080
|
}
|
|
3016
3081
|
}
|
|
3017
3082
|
reset() {
|
|
3018
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
3083
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Sn(this.options.fill, void 0, !1), this.collection = null;
|
|
3019
3084
|
}
|
|
3020
3085
|
destroy() {
|
|
3021
3086
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -3031,7 +3096,7 @@ var An = class {
|
|
|
3031
3096
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
3032
3097
|
let a = this.options.state;
|
|
3033
3098
|
a.isLoadingMore = !0;
|
|
3034
|
-
let o = await
|
|
3099
|
+
let o = await wn({
|
|
3035
3100
|
existingItems: a.items,
|
|
3036
3101
|
initialCursor: a.next,
|
|
3037
3102
|
loadPage: i,
|
|
@@ -3071,7 +3136,7 @@ var An = class {
|
|
|
3071
3136
|
};
|
|
3072
3137
|
//#endregion
|
|
3073
3138
|
//#region src/core/feedFooter.ts
|
|
3074
|
-
function
|
|
3139
|
+
function Nn(e) {
|
|
3075
3140
|
return {
|
|
3076
3141
|
cancelAutofill: () => e.cancelAutofill(),
|
|
3077
3142
|
loadMore: () => e.loadNext(),
|
|
@@ -3079,45 +3144,45 @@ function jn(e) {
|
|
|
3079
3144
|
retryEnd: () => e.retryEnd()
|
|
3080
3145
|
};
|
|
3081
3146
|
}
|
|
3082
|
-
function
|
|
3147
|
+
function Pn(e) {
|
|
3083
3148
|
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
3084
3149
|
}
|
|
3085
|
-
function
|
|
3086
|
-
e?.intervalMs !== void 0 &&
|
|
3150
|
+
function Fn(e) {
|
|
3151
|
+
e?.intervalMs !== void 0 && Pn(e.intervalMs);
|
|
3087
3152
|
}
|
|
3088
|
-
function
|
|
3153
|
+
function In(e) {
|
|
3089
3154
|
return {
|
|
3090
3155
|
enabled: e?.enabled ?? !1,
|
|
3091
3156
|
includePostItems: e?.includePostItems ?? !1,
|
|
3092
3157
|
intervalMs: e?.intervalMs ?? 5e3
|
|
3093
3158
|
};
|
|
3094
3159
|
}
|
|
3095
|
-
function
|
|
3160
|
+
function Ln(e, t) {
|
|
3096
3161
|
if (typeof t == "boolean") {
|
|
3097
3162
|
e.enabled = t;
|
|
3098
3163
|
return;
|
|
3099
3164
|
}
|
|
3100
|
-
|
|
3165
|
+
Fn(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);
|
|
3101
3166
|
}
|
|
3102
3167
|
//#endregion
|
|
3103
3168
|
//#region src/core/reelInfoSheet.ts
|
|
3104
|
-
function
|
|
3169
|
+
function Rn(e) {
|
|
3105
3170
|
return { enabled: e?.enabled ?? !1 };
|
|
3106
3171
|
}
|
|
3107
|
-
function
|
|
3172
|
+
function zn(e, t, n) {
|
|
3108
3173
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
3109
3174
|
e.enabled = n;
|
|
3110
3175
|
}
|
|
3111
3176
|
//#endregion
|
|
3112
3177
|
//#region src/core/initialRuntimeState.ts
|
|
3113
|
-
function
|
|
3178
|
+
function Bn(e, t) {
|
|
3114
3179
|
let n = e.initialPage;
|
|
3115
3180
|
return {
|
|
3116
3181
|
activeReelPostId: null,
|
|
3117
|
-
autoScroll:
|
|
3118
|
-
autofill:
|
|
3182
|
+
autoScroll: dn(e.autoScroll),
|
|
3183
|
+
autofill: en(e.autofill),
|
|
3119
3184
|
error: null,
|
|
3120
|
-
fill:
|
|
3185
|
+
fill: Sn(e.fill),
|
|
3121
3186
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
3122
3187
|
isLoading: !n,
|
|
3123
3188
|
isLoadingMore: !1,
|
|
@@ -3128,14 +3193,14 @@ function Rn(e, t) {
|
|
|
3128
3193
|
next: n?.next ?? null,
|
|
3129
3194
|
nextPageError: null,
|
|
3130
3195
|
phoneMode: !1,
|
|
3131
|
-
reelAutoAdvance:
|
|
3196
|
+
reelAutoAdvance: In(e.reelAutoAdvance),
|
|
3132
3197
|
reelForward: {
|
|
3133
3198
|
error: null,
|
|
3134
3199
|
status: "idle"
|
|
3135
3200
|
},
|
|
3136
3201
|
reelForwardIndex: null,
|
|
3137
3202
|
reelForwardItem: null,
|
|
3138
|
-
reelInfoSheet:
|
|
3203
|
+
reelInfoSheet: Rn(e.reelInfoSheet),
|
|
3139
3204
|
reelInfoSheetOverlay: !1,
|
|
3140
3205
|
reelMediaSource: "original",
|
|
3141
3206
|
reelOrigin: null,
|
|
@@ -3144,20 +3209,20 @@ function Rn(e, t) {
|
|
|
3144
3209
|
}
|
|
3145
3210
|
//#endregion
|
|
3146
3211
|
//#region src/core/options.ts
|
|
3147
|
-
function
|
|
3212
|
+
function Vn(e, t) {
|
|
3148
3213
|
if (t) {
|
|
3149
3214
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
3150
3215
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
3151
3216
|
}
|
|
3152
3217
|
}
|
|
3153
|
-
function
|
|
3218
|
+
function Hn(e, t) {
|
|
3154
3219
|
if (t) {
|
|
3155
3220
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
3156
3221
|
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.`);
|
|
3157
3222
|
}
|
|
3158
3223
|
}
|
|
3159
|
-
function
|
|
3160
|
-
if (
|
|
3224
|
+
function Un(e) {
|
|
3225
|
+
if (un(e.autoScroll), Vn("cardHeader", e.cardHeader), Vn("cardFooter", e.cardFooter), Hn("header", e.mediaCard?.header), Hn("footer", e.mediaCard?.footer), $t(e.autofill), xn(e.fill), J(e.masonry), Fn(e.reelAutoAdvance), e.removalReconciliation) {
|
|
3161
3226
|
if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
|
|
3162
3227
|
let t = e.removalReconciliation.maxReplayPages ?? 5;
|
|
3163
3228
|
if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
|
|
@@ -3171,7 +3236,7 @@ function Vn(e) {
|
|
|
3171
3236
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
3172
3237
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
3173
3238
|
}
|
|
3174
|
-
function
|
|
3239
|
+
function Wn(e) {
|
|
3175
3240
|
if (typeof e != "string") return e;
|
|
3176
3241
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
3177
3242
|
let t = document.querySelector(e);
|
|
@@ -3180,7 +3245,7 @@ function Hn(e) {
|
|
|
3180
3245
|
}
|
|
3181
3246
|
//#endregion
|
|
3182
3247
|
//#region src/core/pageRequest.ts
|
|
3183
|
-
async function
|
|
3248
|
+
async function Gn({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
|
|
3184
3249
|
let u = s.autofill, d = e && u?.strategy === "frontend" && l.autofill.status === "paused", f = d ? {
|
|
3185
3250
|
received: l.autofill.received,
|
|
3186
3251
|
requests: l.autofill.requests
|
|
@@ -3192,11 +3257,11 @@ async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3192
3257
|
let m = !1;
|
|
3193
3258
|
try {
|
|
3194
3259
|
if (u?.strategy === "frontend") {
|
|
3195
|
-
let s = await
|
|
3260
|
+
let s = await an({
|
|
3196
3261
|
existingItems: e ? l.items : [],
|
|
3197
3262
|
initialCursor: n,
|
|
3198
3263
|
loadPage: i,
|
|
3199
|
-
maximumRequests: f ? Math.max(0,
|
|
3264
|
+
maximumRequests: f ? Math.max(0, Xt(u) - f.requests) : void 0,
|
|
3200
3265
|
onCollection: (e) => t.captureCollection(e, r()),
|
|
3201
3266
|
onDelayChange: (e) => {
|
|
3202
3267
|
r() && Object.assign(l.autofill, e);
|
|
@@ -3219,7 +3284,7 @@ async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3219
3284
|
}), o(s.pages), t.clearCollection();
|
|
3220
3285
|
return;
|
|
3221
3286
|
}
|
|
3222
|
-
let s =
|
|
3287
|
+
let s = Bt(await i({
|
|
3223
3288
|
cursor: n,
|
|
3224
3289
|
signal: c
|
|
3225
3290
|
}));
|
|
@@ -3239,7 +3304,7 @@ async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3239
3304
|
l.autofill.status = "complete";
|
|
3240
3305
|
return;
|
|
3241
3306
|
}
|
|
3242
|
-
await
|
|
3307
|
+
await pn(u, l, {
|
|
3243
3308
|
cycleId: p,
|
|
3244
3309
|
feedKey: u.feedKey,
|
|
3245
3310
|
items: h.slice(d.length),
|
|
@@ -3263,13 +3328,13 @@ async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, l
|
|
|
3263
3328
|
function $(e) {
|
|
3264
3329
|
return `${typeof e}:${String(e)}`;
|
|
3265
3330
|
}
|
|
3266
|
-
function
|
|
3331
|
+
function Kn(e) {
|
|
3267
3332
|
return `${typeof e}:${String(e)}`;
|
|
3268
3333
|
}
|
|
3269
|
-
function
|
|
3334
|
+
function qn(e) {
|
|
3270
3335
|
return e.map(({ postId: e }) => e);
|
|
3271
3336
|
}
|
|
3272
|
-
var
|
|
3337
|
+
var Jn = class {
|
|
3273
3338
|
delay;
|
|
3274
3339
|
enabled;
|
|
3275
3340
|
maxReplayPages;
|
|
@@ -3311,14 +3376,14 @@ var Kn = class {
|
|
|
3311
3376
|
async reconcile({ existingItems: e, loadPage: t, shouldPause: n = () => !1, signal: r }) {
|
|
3312
3377
|
let i = this.pending ?? this.createSession(e);
|
|
3313
3378
|
for (this.pending = i; i.remainingRequests > 0;) {
|
|
3314
|
-
let e =
|
|
3379
|
+
let e = Kn(i.cursor);
|
|
3315
3380
|
if (i.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
|
|
3316
|
-
if (await
|
|
3317
|
-
delayMs:
|
|
3381
|
+
if (await Jt({
|
|
3382
|
+
delayMs: qt(i.pages.length, this.delay),
|
|
3318
3383
|
onChange: () => void 0,
|
|
3319
3384
|
signal: r
|
|
3320
3385
|
}), i.pages.length > 0 && n()) return this.result(i, "paused");
|
|
3321
|
-
let a =
|
|
3386
|
+
let a = Bt(await t({
|
|
3322
3387
|
cursor: i.cursor,
|
|
3323
3388
|
signal: r
|
|
3324
3389
|
}));
|
|
@@ -3331,7 +3396,7 @@ var Kn = class {
|
|
|
3331
3396
|
contributionIds: s,
|
|
3332
3397
|
cursor: i.cursor,
|
|
3333
3398
|
next: a.next,
|
|
3334
|
-
returnedIds:
|
|
3399
|
+
returnedIds: qn(o)
|
|
3335
3400
|
}), 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");
|
|
3336
3401
|
}
|
|
3337
3402
|
return this.result(i, "complete");
|
|
@@ -3370,7 +3435,7 @@ var Kn = class {
|
|
|
3370
3435
|
return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
|
|
3371
3436
|
}
|
|
3372
3437
|
recordPage(e) {
|
|
3373
|
-
let t =
|
|
3438
|
+
let t = Kn(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Kn(e) === t);
|
|
3374
3439
|
n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
|
|
3375
3440
|
...e,
|
|
3376
3441
|
contributionIds: [...e.contributionIds],
|
|
@@ -3380,7 +3445,7 @@ var Kn = class {
|
|
|
3380
3445
|
};
|
|
3381
3446
|
//#endregion
|
|
3382
3447
|
//#region src/core/activeItemRemoval.ts
|
|
3383
|
-
function
|
|
3448
|
+
function Yn(e, t, n, r, i) {
|
|
3384
3449
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
3385
3450
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
3386
3451
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -3393,7 +3458,7 @@ function qn(e, t, n, r, i) {
|
|
|
3393
3458
|
}
|
|
3394
3459
|
//#endregion
|
|
3395
3460
|
//#region src/core/exactMediaRemovalController.ts
|
|
3396
|
-
function
|
|
3461
|
+
function Xn(e, t) {
|
|
3397
3462
|
let [n, ...r] = t;
|
|
3398
3463
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
3399
3464
|
return {
|
|
@@ -3402,10 +3467,10 @@ function Jn(e, t) {
|
|
|
3402
3467
|
items: r
|
|
3403
3468
|
};
|
|
3404
3469
|
}
|
|
3405
|
-
function
|
|
3470
|
+
function Zn(e) {
|
|
3406
3471
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
3407
3472
|
}
|
|
3408
|
-
var
|
|
3473
|
+
var Qn = class {
|
|
3409
3474
|
generation = 0;
|
|
3410
3475
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
3411
3476
|
state;
|
|
@@ -3413,7 +3478,7 @@ var Xn = class {
|
|
|
3413
3478
|
this.options = e, this.state = e.state;
|
|
3414
3479
|
}
|
|
3415
3480
|
remove(e) {
|
|
3416
|
-
|
|
3481
|
+
Zn(e);
|
|
3417
3482
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
3418
3483
|
if (!n) return null;
|
|
3419
3484
|
let r = [...M(n)], i = r[e.mediaIndex];
|
|
@@ -3430,7 +3495,7 @@ var Xn = class {
|
|
|
3430
3495
|
restored: !1
|
|
3431
3496
|
});
|
|
3432
3497
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
3433
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
3498
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Xn(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);
|
|
3434
3499
|
}
|
|
3435
3500
|
reset() {
|
|
3436
3501
|
this.generation += 1;
|
|
@@ -3456,7 +3521,7 @@ var Xn = class {
|
|
|
3456
3521
|
}
|
|
3457
3522
|
restoreIntoPost(e, t) {
|
|
3458
3523
|
let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
|
|
3459
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
3524
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Xn(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
3460
3525
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
3461
3526
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
3462
3527
|
}
|
|
@@ -3469,18 +3534,18 @@ var Xn = class {
|
|
|
3469
3534
|
};
|
|
3470
3535
|
//#endregion
|
|
3471
3536
|
//#region src/core/itemPlacement.ts
|
|
3472
|
-
function
|
|
3537
|
+
function $n(e, t) {
|
|
3473
3538
|
let n = new Set(t);
|
|
3474
3539
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
3475
3540
|
index: t,
|
|
3476
3541
|
item: e
|
|
3477
3542
|
}] : []);
|
|
3478
3543
|
}
|
|
3479
|
-
function
|
|
3544
|
+
function er(e, t) {
|
|
3480
3545
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
3481
3546
|
return e.filter((e) => !n.has(e.postId));
|
|
3482
3547
|
}
|
|
3483
|
-
function
|
|
3548
|
+
function tr(e, t) {
|
|
3484
3549
|
t.forEach(({ index: e }) => {
|
|
3485
3550
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
3486
3551
|
});
|
|
@@ -3491,7 +3556,7 @@ function $n(e, t) {
|
|
|
3491
3556
|
}
|
|
3492
3557
|
//#endregion
|
|
3493
3558
|
//#region src/core/itemRemovalController.ts
|
|
3494
|
-
var
|
|
3559
|
+
var nr = 20, rr = class {
|
|
3495
3560
|
generation = 0;
|
|
3496
3561
|
historyLimit;
|
|
3497
3562
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -3500,20 +3565,21 @@ var er = 20, tr = class {
|
|
|
3500
3565
|
itemOrder;
|
|
3501
3566
|
stopItemsWatcher;
|
|
3502
3567
|
constructor(e) {
|
|
3503
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3568
|
+
this.options = e, this.historyLimit = e.historyLimit ?? nr, 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" });
|
|
3504
3569
|
}
|
|
3505
3570
|
destroy() {
|
|
3506
3571
|
this.reset(), this.stopItemsWatcher();
|
|
3507
3572
|
}
|
|
3508
|
-
async remove(e) {
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3573
|
+
async remove(e, t) {
|
|
3574
|
+
if (t?.staggerMs !== void 0 && (!Number.isFinite(t.staggerMs) || t.staggerMs < 0)) throw TypeError("Vibe item removal staggerMs must be a non-negative number.");
|
|
3575
|
+
let n = this.collectOrderedPlacements(e), r = this.createRemoval(n);
|
|
3576
|
+
if (n.length === 0) return r;
|
|
3577
|
+
let i = n.map(({ item: e }) => e.postId);
|
|
3578
|
+
if (await this.options.prepareRemoval(i), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
3579
|
+
let a = this.options.startRemoval(i, t);
|
|
3580
|
+
if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
|
|
3581
|
+
let o = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), s = new Set(n.map(({ item: e }) => e.postId)), c = o < 0 ? 0 : this.state.items.slice(0, o).filter(({ postId: e }) => s.has(e)).length, l = Math.max(o - c, 0);
|
|
3582
|
+
return this.state.items = er(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
|
|
3517
3583
|
}
|
|
3518
3584
|
reset() {
|
|
3519
3585
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -3524,7 +3590,7 @@ var er = 20, tr = class {
|
|
|
3524
3590
|
this.restoreRemoval(t);
|
|
3525
3591
|
return;
|
|
3526
3592
|
}
|
|
3527
|
-
let n =
|
|
3593
|
+
let n = tr(this.state.items, e);
|
|
3528
3594
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
3529
3595
|
}
|
|
3530
3596
|
restoreRemoval(e) {
|
|
@@ -3550,7 +3616,7 @@ var er = 20, tr = class {
|
|
|
3550
3616
|
}
|
|
3551
3617
|
collectOrderedPlacements(e) {
|
|
3552
3618
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3553
|
-
return
|
|
3619
|
+
return $n(this.state.items, e).map((e) => ({
|
|
3554
3620
|
index: t.get(e.item.postId) ?? e.index,
|
|
3555
3621
|
item: e.item
|
|
3556
3622
|
}));
|
|
@@ -3581,7 +3647,7 @@ var er = 20, tr = class {
|
|
|
3581
3647
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3582
3648
|
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;
|
|
3583
3649
|
}
|
|
3584
|
-
},
|
|
3650
|
+
}, ir = class {
|
|
3585
3651
|
forward = null;
|
|
3586
3652
|
forwardPromise = null;
|
|
3587
3653
|
forwardVersion = 0;
|
|
@@ -3659,7 +3725,7 @@ var er = 20, tr = class {
|
|
|
3659
3725
|
}
|
|
3660
3726
|
}
|
|
3661
3727
|
}
|
|
3662
|
-
},
|
|
3728
|
+
}, ar = class {
|
|
3663
3729
|
generation = 0;
|
|
3664
3730
|
pending = Promise.resolve();
|
|
3665
3731
|
constructor(e) {
|
|
@@ -3709,24 +3775,24 @@ var er = 20, tr = class {
|
|
|
3709
3775
|
};
|
|
3710
3776
|
//#endregion
|
|
3711
3777
|
//#region src/core/removalControllers.ts
|
|
3712
|
-
function
|
|
3713
|
-
let t = new
|
|
3778
|
+
function or(e) {
|
|
3779
|
+
let t = new ir(e), n = new ar({
|
|
3714
3780
|
state: e.state,
|
|
3715
3781
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3716
3782
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3717
3783
|
});
|
|
3718
3784
|
return {
|
|
3719
|
-
exactMediaRemoval: new
|
|
3785
|
+
exactMediaRemoval: new Qn({
|
|
3720
3786
|
onActivate: e.onActivate,
|
|
3721
3787
|
onPostRemoved: (t) => e.onItemsRemoved([t]),
|
|
3722
3788
|
onPostRestored: (t) => e.onItemsRestored([t]),
|
|
3723
3789
|
reelForward: t,
|
|
3724
3790
|
state: e.state
|
|
3725
3791
|
}),
|
|
3726
|
-
itemRemoval: new
|
|
3792
|
+
itemRemoval: new rr({
|
|
3727
3793
|
historyLimit: e.historyLimit,
|
|
3728
3794
|
onItemsRemoved: (n, r, i) => {
|
|
3729
|
-
e.onItemsRemoved(r.map(({ item: e }) => e.postId)),
|
|
3795
|
+
e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Yn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3730
3796
|
},
|
|
3731
3797
|
onRemovalRestored: (n) => {
|
|
3732
3798
|
e.onItemsRestored(n.map(({ item: e }) => e.postId));
|
|
@@ -3734,24 +3800,24 @@ function ir(e) {
|
|
|
3734
3800
|
r && e.onActivate(r.postId);
|
|
3735
3801
|
},
|
|
3736
3802
|
prepareRemoval: (e) => n.prepareItems(e),
|
|
3737
|
-
startRemoval: (t) => e.surface()?.startItemRemoval(t) ?? 0,
|
|
3803
|
+
startRemoval: (t, n) => e.surface()?.startItemRemoval(t, n) ?? 0,
|
|
3738
3804
|
state: e.state
|
|
3739
3805
|
}),
|
|
3740
3806
|
reelForward: t,
|
|
3741
3807
|
reelRemoval: n
|
|
3742
3808
|
};
|
|
3743
3809
|
}
|
|
3744
|
-
var
|
|
3745
|
-
function
|
|
3810
|
+
var sr = 1.5;
|
|
3811
|
+
function cr(e) {
|
|
3746
3812
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3747
3813
|
if (t > 0 && t < 600) return !0;
|
|
3748
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3814
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * sr;
|
|
3749
3815
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3750
3816
|
}
|
|
3751
|
-
function
|
|
3752
|
-
return
|
|
3817
|
+
function lr(e) {
|
|
3818
|
+
return cr(e) ? "reel" : "masonry";
|
|
3753
3819
|
}
|
|
3754
|
-
function
|
|
3820
|
+
function ur(e) {
|
|
3755
3821
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3756
3822
|
return {
|
|
3757
3823
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3761,15 +3827,15 @@ function cr(e) {
|
|
|
3761
3827
|
viewportWidth: n.clientWidth
|
|
3762
3828
|
};
|
|
3763
3829
|
}
|
|
3764
|
-
function
|
|
3765
|
-
return
|
|
3830
|
+
function dr(e) {
|
|
3831
|
+
return cr(ur(e));
|
|
3766
3832
|
}
|
|
3767
|
-
function
|
|
3768
|
-
return
|
|
3833
|
+
function fr(e) {
|
|
3834
|
+
return lr(ur(e));
|
|
3769
3835
|
}
|
|
3770
3836
|
//#endregion
|
|
3771
3837
|
//#region src/core/responsiveLayoutController.ts
|
|
3772
|
-
var
|
|
3838
|
+
var pr = class {
|
|
3773
3839
|
layoutMode;
|
|
3774
3840
|
resizeObserver = null;
|
|
3775
3841
|
target = null;
|
|
@@ -3794,10 +3860,10 @@ var dr = class {
|
|
|
3794
3860
|
}
|
|
3795
3861
|
handleResponsiveLayout = () => {
|
|
3796
3862
|
if (!this.target) return;
|
|
3797
|
-
let e =
|
|
3798
|
-
this.state.phoneMode =
|
|
3863
|
+
let e = fr(this.target);
|
|
3864
|
+
this.state.phoneMode = dr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3799
3865
|
};
|
|
3800
|
-
},
|
|
3866
|
+
}, mr = class {
|
|
3801
3867
|
routedReelPostId = null;
|
|
3802
3868
|
reelRouteIsActive = !1;
|
|
3803
3869
|
constructor(e, t) {
|
|
@@ -3824,7 +3890,7 @@ var dr = class {
|
|
|
3824
3890
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3825
3891
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3826
3892
|
}
|
|
3827
|
-
},
|
|
3893
|
+
}, hr = class {
|
|
3828
3894
|
app = null;
|
|
3829
3895
|
autoScroll;
|
|
3830
3896
|
autofillController;
|
|
@@ -3845,12 +3911,12 @@ var dr = class {
|
|
|
3845
3911
|
notificationItems;
|
|
3846
3912
|
state;
|
|
3847
3913
|
constructor(e) {
|
|
3848
|
-
this.options = e,
|
|
3914
|
+
this.options = e, Un(e);
|
|
3849
3915
|
let t = e.layout ?? "masonry";
|
|
3850
|
-
this.state = x(
|
|
3916
|
+
this.state = x(Bn(e, t)), this.notificationItems = I(this.state), this.autoScroll = new fn({
|
|
3851
3917
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3852
3918
|
state: this.state.autoScroll
|
|
3853
|
-
}), this.autofillController = new
|
|
3919
|
+
}), this.autofillController = new on({
|
|
3854
3920
|
cancelRequest: () => this.cancelRequest(),
|
|
3855
3921
|
onLastCursor: (e) => {
|
|
3856
3922
|
this.lastLoadedCursor = e;
|
|
@@ -3858,7 +3924,7 @@ var dr = class {
|
|
|
3858
3924
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3859
3925
|
options: e.autofill,
|
|
3860
3926
|
state: this.state
|
|
3861
|
-
}), this.removalReconciliation = new
|
|
3927
|
+
}), this.removalReconciliation = new Jn(e), this.fillController = new Mn({
|
|
3862
3928
|
fill: e.fill,
|
|
3863
3929
|
loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
|
|
3864
3930
|
onLastCursor: (e) => {
|
|
@@ -3866,8 +3932,8 @@ var dr = class {
|
|
|
3866
3932
|
},
|
|
3867
3933
|
onPages: (e) => this.removalReconciliation.recordPages(e),
|
|
3868
3934
|
state: this.state
|
|
3869
|
-
}), this.routing = new
|
|
3870
|
-
let n =
|
|
3935
|
+
}), this.routing = new mr(e.routing, this.state);
|
|
3936
|
+
let n = or({
|
|
3871
3937
|
historyLimit: e.removalHistoryLimit,
|
|
3872
3938
|
loadNext: () => this.loadNext(),
|
|
3873
3939
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
@@ -3877,20 +3943,20 @@ var dr = class {
|
|
|
3877
3943
|
state: this.state,
|
|
3878
3944
|
surface: () => this.surface
|
|
3879
3945
|
});
|
|
3880
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
3946
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new pr(t, this.state, () => {
|
|
3881
3947
|
this.routing.syncFeed();
|
|
3882
3948
|
}), this.startStateNotifications();
|
|
3883
3949
|
}
|
|
3884
3950
|
async mount() {
|
|
3885
3951
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3886
3952
|
this.startStateNotifications();
|
|
3887
|
-
let e =
|
|
3888
|
-
this.responsiveLayout.mount(e), this.app = i(
|
|
3953
|
+
let e = Wn(this.options.target);
|
|
3954
|
+
this.responsiveLayout.mount(e), this.app = i(zt, {
|
|
3889
3955
|
canRetryEnd: !!this.options.loadPage,
|
|
3890
3956
|
cardFooter: this.options.cardFooter,
|
|
3891
3957
|
cardHeader: this.options.cardHeader,
|
|
3892
3958
|
feedFooter: this.options.feedFooter,
|
|
3893
|
-
feedFooterActions:
|
|
3959
|
+
feedFooterActions: Nn(this),
|
|
3894
3960
|
mediaCard: this.options.mediaCard,
|
|
3895
3961
|
masonry: this.options.masonry,
|
|
3896
3962
|
onMediaReady: this.options.onMediaReady,
|
|
@@ -3927,8 +3993,8 @@ var dr = class {
|
|
|
3927
3993
|
removeMediaAnimated(e) {
|
|
3928
3994
|
return this.reelRemoval.prepareMedia(e).then(() => this.exactMediaRemoval.remove(e));
|
|
3929
3995
|
}
|
|
3930
|
-
removeItems(e) {
|
|
3931
|
-
return this.itemRemoval.remove(e);
|
|
3996
|
+
removeItems(e, t) {
|
|
3997
|
+
return this.itemRemoval.remove(e, t);
|
|
3932
3998
|
}
|
|
3933
3999
|
restoreItems(e) {
|
|
3934
4000
|
this.itemRemoval.restoreItems(e);
|
|
@@ -3973,7 +4039,7 @@ var dr = class {
|
|
|
3973
4039
|
this.autoScroll.setSpeed(e);
|
|
3974
4040
|
}
|
|
3975
4041
|
applyAutofillUpdate(e) {
|
|
3976
|
-
let t =
|
|
4042
|
+
let t = hn(this.options.autofill, this.state, e);
|
|
3977
4043
|
return t && this.autofillController.syncCountdown(), t;
|
|
3978
4044
|
}
|
|
3979
4045
|
cancelAutofill() {
|
|
@@ -3984,7 +4050,7 @@ var dr = class {
|
|
|
3984
4050
|
await this.cancelFill();
|
|
3985
4051
|
return;
|
|
3986
4052
|
}
|
|
3987
|
-
if (
|
|
4053
|
+
if (tn(this.state.autofill)) {
|
|
3988
4054
|
await this.cancelAutofill();
|
|
3989
4055
|
return;
|
|
3990
4056
|
}
|
|
@@ -3998,12 +4064,12 @@ var dr = class {
|
|
|
3998
4064
|
}
|
|
3999
4065
|
async fill(e) {
|
|
4000
4066
|
if (!this.state.loadMoreLocked) {
|
|
4001
|
-
if (this.pendingRequest ||
|
|
4067
|
+
if (this.pendingRequest || tn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
|
|
4002
4068
|
await this.fillController.start(e);
|
|
4003
4069
|
}
|
|
4004
4070
|
}
|
|
4005
4071
|
restoreAutofillSession(e) {
|
|
4006
|
-
let t =
|
|
4072
|
+
let t = gn(this.options.autofill, this.state, e);
|
|
4007
4073
|
return t && this.autofillController.syncCountdown(), t;
|
|
4008
4074
|
}
|
|
4009
4075
|
restoreFillSession(e) {
|
|
@@ -4011,7 +4077,7 @@ var dr = class {
|
|
|
4011
4077
|
}
|
|
4012
4078
|
async loadNext() {
|
|
4013
4079
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4014
|
-
if (this.state.loadMoreLocked ||
|
|
4080
|
+
if (this.state.loadMoreLocked || tn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
|
|
4015
4081
|
this.state.isLoadingMore = !0, this.state.nextPageError = null;
|
|
4016
4082
|
let e = this.loadNextSequence();
|
|
4017
4083
|
return this.pendingRequest = e, e.finally(() => {
|
|
@@ -4026,12 +4092,12 @@ var dr = class {
|
|
|
4026
4092
|
}
|
|
4027
4093
|
async replaceFeed(e, t) {
|
|
4028
4094
|
if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
|
|
4029
|
-
return
|
|
4095
|
+
return tn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = en(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);
|
|
4030
4096
|
}
|
|
4031
4097
|
async loadFilteredPage(e) {
|
|
4032
4098
|
let t = this.options.loadPage;
|
|
4033
4099
|
if (!t) throw Error("Vibe cannot load a page without loadPage.");
|
|
4034
|
-
let n =
|
|
4100
|
+
let n = Bt(await t(e));
|
|
4035
4101
|
return {
|
|
4036
4102
|
...n,
|
|
4037
4103
|
items: this.removalReconciliation.filterItems(n.items)
|
|
@@ -4061,7 +4127,7 @@ var dr = class {
|
|
|
4061
4127
|
}
|
|
4062
4128
|
async retryEnd() {
|
|
4063
4129
|
if (this.pendingRequest) return this.pendingRequest;
|
|
4064
|
-
if (!this.state.loadMoreLocked && !(
|
|
4130
|
+
if (!this.state.loadMoreLocked && !(tn(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);
|
|
4065
4131
|
}
|
|
4066
4132
|
setInfiniteScroll(e) {
|
|
4067
4133
|
this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
|
|
@@ -4089,10 +4155,10 @@ var dr = class {
|
|
|
4089
4155
|
this.state.total = e;
|
|
4090
4156
|
}
|
|
4091
4157
|
setReelAutoAdvance(e) {
|
|
4092
|
-
|
|
4158
|
+
Ln(this.state.reelAutoAdvance, e);
|
|
4093
4159
|
}
|
|
4094
4160
|
setReelInfoSheet(e) {
|
|
4095
|
-
|
|
4161
|
+
zn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
4096
4162
|
}
|
|
4097
4163
|
setLayout(e) {
|
|
4098
4164
|
this.responsiveLayout.setLayout(e);
|
|
@@ -4112,7 +4178,7 @@ var dr = class {
|
|
|
4112
4178
|
async fetchPage(e, t) {
|
|
4113
4179
|
if (!this.options.loadPage) return;
|
|
4114
4180
|
let n = ++this.requestVersion, r = new AbortController();
|
|
4115
|
-
this.abortController = r, await
|
|
4181
|
+
this.abortController = r, await Gn({
|
|
4116
4182
|
append: t,
|
|
4117
4183
|
autofillController: this.autofillController,
|
|
4118
4184
|
cursor: e,
|
|
@@ -4136,7 +4202,7 @@ var dr = class {
|
|
|
4136
4202
|
startInitialAutofill() {
|
|
4137
4203
|
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
4138
4204
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
4139
|
-
let r =
|
|
4205
|
+
let r = _n({
|
|
4140
4206
|
cycleId: n,
|
|
4141
4207
|
isCurrent: () => e === this.requestVersion,
|
|
4142
4208
|
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
@@ -4162,8 +4228,8 @@ var dr = class {
|
|
|
4162
4228
|
}));
|
|
4163
4229
|
}
|
|
4164
4230
|
};
|
|
4165
|
-
function
|
|
4166
|
-
return new
|
|
4231
|
+
function gr(e) {
|
|
4232
|
+
return new hr(e);
|
|
4167
4233
|
}
|
|
4168
4234
|
//#endregion
|
|
4169
|
-
export {
|
|
4235
|
+
export { gr as createVibe };
|