@wyxos/vibe 4.5.4 → 4.5.6
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 +6 -2
- package/lib/components/FeedFooter.vue.d.ts +1 -0
- package/lib/components/GalleryFooter.vue.d.ts +1 -0
- package/lib/core/autofill.d.ts +6 -3
- package/lib/core/autofillController.d.ts +25 -0
- package/lib/core/initialAutofill.d.ts +3 -1
- package/lib/index.cjs +1 -1
- package/lib/index.js +756 -700
- package/lib/types.d.ts +1 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, h as p, nextTick as m, normalizeClass as h, normalizeProps as g, normalizeStyle as _, onBeforeUnmount as
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, h as p, nextTick as m, normalizeClass as h, normalizeProps as g, normalizeStyle as _, onBeforeUnmount as v, onMounted as y, openBlock as b, reactive as x, renderList as S, resolveDynamicComponent as C, shallowRef as w, toDisplayString as T, unref as E, useId as D, watch as O, withCtx as k, withKeys as A, withModifiers as j } from "vue";
|
|
2
2
|
//#region src/core/mediaAsset.ts
|
|
3
|
-
function
|
|
3
|
+
function M(e) {
|
|
4
4
|
return [e, ...e.items];
|
|
5
5
|
}
|
|
6
|
-
function M(e, t) {
|
|
7
|
-
return Math.min(e.items.length, Math.max(0, t));
|
|
8
|
-
}
|
|
9
6
|
function N(e, t) {
|
|
10
|
-
return
|
|
7
|
+
return Math.min(e.items.length, Math.max(0, t));
|
|
11
8
|
}
|
|
12
9
|
function P(e, t) {
|
|
10
|
+
return M(e)[N(e, t)] ?? e;
|
|
11
|
+
}
|
|
12
|
+
function F(e, t) {
|
|
13
13
|
return `${String(e)}:${t}`;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/core/runtime.ts
|
|
17
|
-
function
|
|
17
|
+
function I(e) {
|
|
18
18
|
return {
|
|
19
19
|
activeReelPostId: e.activeReelPostId,
|
|
20
20
|
autoScroll: { ...e.autoScroll },
|
|
@@ -42,24 +42,25 @@ function F(e) {
|
|
|
42
42
|
}
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
|
|
45
|
-
var
|
|
45
|
+
var L = {
|
|
46
46
|
key: 0,
|
|
47
47
|
class: "gallery-footer"
|
|
48
|
-
},
|
|
48
|
+
}, R = {
|
|
49
49
|
key: 0,
|
|
50
50
|
class: "load-more-status",
|
|
51
51
|
role: "status"
|
|
52
|
-
},
|
|
52
|
+
}, z = ["disabled"], B = {
|
|
53
53
|
key: 2,
|
|
54
54
|
class: "end-feed"
|
|
55
|
-
},
|
|
55
|
+
}, V = ["disabled"], H = /* @__PURE__ */ d({
|
|
56
56
|
__name: "GalleryFooter",
|
|
57
57
|
props: {
|
|
58
58
|
canRetryEnd: { type: Boolean },
|
|
59
59
|
hasError: { type: Boolean },
|
|
60
60
|
hasNext: { type: Boolean },
|
|
61
61
|
isLoading: { type: Boolean },
|
|
62
|
-
loadMoreLocked: { type: Boolean }
|
|
62
|
+
loadMoreLocked: { type: Boolean },
|
|
63
|
+
showLoadMore: { type: Boolean }
|
|
63
64
|
},
|
|
64
65
|
emits: ["loadMore", "retryEnd"],
|
|
65
66
|
setup(e, { emit: t }) {
|
|
@@ -67,14 +68,14 @@ var I = {
|
|
|
67
68
|
function i() {
|
|
68
69
|
n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
|
|
69
70
|
}
|
|
70
|
-
return (t, n) => e.
|
|
71
|
+
return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", L, [e.isLoading ? (b(), s("p", R, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
|
|
71
72
|
key: 1,
|
|
72
73
|
"data-test": "load-more",
|
|
73
74
|
class: "load-more-button",
|
|
74
75
|
type: "button",
|
|
75
76
|
disabled: e.loadMoreLocked,
|
|
76
77
|
onClick: i
|
|
77
|
-
},
|
|
78
|
+
}, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, z)) : (b(), s("div", B, [n[1] ||= c("p", {
|
|
78
79
|
class: "end-feed-message",
|
|
79
80
|
role: "status"
|
|
80
81
|
}, " You've reached the end. ", -1), c("button", {
|
|
@@ -83,9 +84,9 @@ var I = {
|
|
|
83
84
|
type: "button",
|
|
84
85
|
disabled: e.loadMoreLocked,
|
|
85
86
|
onClick: n[0] ||= (e) => t.$emit("retryEnd")
|
|
86
|
-
}, " Check for more ", 8,
|
|
87
|
+
}, " Check for more ", 8, V)]))])) : o("", !0);
|
|
87
88
|
}
|
|
88
|
-
}),
|
|
89
|
+
}), U = /* @__PURE__ */ d({
|
|
89
90
|
__name: "FeedFooter",
|
|
90
91
|
props: {
|
|
91
92
|
actions: {},
|
|
@@ -95,6 +96,7 @@ var I = {
|
|
|
95
96
|
hasNext: { type: Boolean },
|
|
96
97
|
isLoading: { type: Boolean },
|
|
97
98
|
loadMoreLocked: { type: Boolean },
|
|
99
|
+
showLoadMore: { type: Boolean },
|
|
98
100
|
state: {}
|
|
99
101
|
},
|
|
100
102
|
emits: ["loadMore", "retryEnd"],
|
|
@@ -106,10 +108,11 @@ var I = {
|
|
|
106
108
|
function o() {
|
|
107
109
|
n.actions?.retry();
|
|
108
110
|
}
|
|
109
|
-
return (t, n) => e.feedFooter && e.actions && e.state ? (
|
|
111
|
+
return (t, n) => e.feedFooter && e.actions && e.state ? (b(), a(C(e.feedFooter.component), {
|
|
110
112
|
key: 0,
|
|
111
113
|
actions: e.actions,
|
|
112
114
|
"can-retry-end": e.canRetryEnd,
|
|
115
|
+
"show-load-more": e.showLoadMore,
|
|
113
116
|
state: e.state,
|
|
114
117
|
onAutofillCancel: i,
|
|
115
118
|
onLoadMore: n[0] ||= (e) => r("loadMore"),
|
|
@@ -118,14 +121,16 @@ var I = {
|
|
|
118
121
|
}, null, 40, [
|
|
119
122
|
"actions",
|
|
120
123
|
"can-retry-end",
|
|
124
|
+
"show-load-more",
|
|
121
125
|
"state"
|
|
122
|
-
])) : (
|
|
126
|
+
])) : (b(), a(H, {
|
|
123
127
|
key: 1,
|
|
124
128
|
"can-retry-end": e.canRetryEnd,
|
|
125
129
|
"has-error": e.hasError,
|
|
126
130
|
"has-next": e.hasNext,
|
|
127
131
|
"is-loading": e.isLoading,
|
|
128
132
|
"load-more-locked": e.loadMoreLocked,
|
|
133
|
+
"show-load-more": e.showLoadMore,
|
|
129
134
|
onLoadMore: n[2] ||= (e) => r("loadMore"),
|
|
130
135
|
onRetryEnd: n[3] ||= (e) => r("retryEnd")
|
|
131
136
|
}, null, 8, [
|
|
@@ -133,10 +138,11 @@ var I = {
|
|
|
133
138
|
"has-error",
|
|
134
139
|
"has-next",
|
|
135
140
|
"is-loading",
|
|
136
|
-
"load-more-locked"
|
|
141
|
+
"load-more-locked",
|
|
142
|
+
"show-load-more"
|
|
137
143
|
]));
|
|
138
144
|
}
|
|
139
|
-
}),
|
|
145
|
+
}), W = ["role"], G = { class: "gallery-status" }, ee = /* @__PURE__ */ d({
|
|
140
146
|
__name: "FeedStatus",
|
|
141
147
|
props: {
|
|
142
148
|
actions: {},
|
|
@@ -147,10 +153,10 @@ var I = {
|
|
|
147
153
|
emits: ["loadMore", "retryEnd"],
|
|
148
154
|
setup(t, { emit: n }) {
|
|
149
155
|
let r = t, i = n;
|
|
150
|
-
return (n, u) => (
|
|
156
|
+
return (n, u) => (b(), s("main", {
|
|
151
157
|
class: "gallery-shell",
|
|
152
158
|
role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
|
|
153
|
-
}, [c("p",
|
|
159
|
+
}, [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, {
|
|
154
160
|
key: 0,
|
|
155
161
|
actions: t.actions,
|
|
156
162
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -159,6 +165,7 @@ var I = {
|
|
|
159
165
|
"has-next": t.state.next !== null,
|
|
160
166
|
"is-loading": t.state.isLoadingMore,
|
|
161
167
|
"load-more-locked": t.state.loadMoreLocked,
|
|
168
|
+
"show-load-more": "",
|
|
162
169
|
state: t.state,
|
|
163
170
|
onLoadMore: u[0] ||= (e) => i("loadMore"),
|
|
164
171
|
onRetryEnd: u[1] ||= (e) => i("retryEnd")
|
|
@@ -171,36 +178,36 @@ var I = {
|
|
|
171
178
|
"is-loading",
|
|
172
179
|
"load-more-locked",
|
|
173
180
|
"state"
|
|
174
|
-
])) : o("", !0)], 8,
|
|
181
|
+
])) : o("", !0)], 8, W));
|
|
175
182
|
}
|
|
176
183
|
});
|
|
177
|
-
function
|
|
184
|
+
function K(e) {
|
|
178
185
|
return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
|
|
179
186
|
}
|
|
180
187
|
//#endregion
|
|
181
188
|
//#region src/core/masonry.ts
|
|
182
|
-
function
|
|
189
|
+
function te(e) {
|
|
183
190
|
let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
|
|
184
191
|
return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
|
|
185
192
|
}
|
|
186
|
-
function
|
|
193
|
+
function ne(e) {
|
|
187
194
|
return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
|
|
188
195
|
}
|
|
189
|
-
function
|
|
196
|
+
function re(e) {
|
|
190
197
|
return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
|
|
191
198
|
}
|
|
192
|
-
function
|
|
199
|
+
function ie(e, t) {
|
|
193
200
|
let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
|
|
194
201
|
return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
|
|
195
202
|
}
|
|
196
|
-
function
|
|
203
|
+
function ae(e, t, n) {
|
|
197
204
|
if (t <= 0 || e.length === 0) return {
|
|
198
205
|
columns: 0,
|
|
199
206
|
height: 0,
|
|
200
207
|
items: []
|
|
201
208
|
};
|
|
202
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) => {
|
|
203
|
-
let t =
|
|
210
|
+
let t = ne(c), n = s * te(e) + i, a = {
|
|
204
211
|
x: t * (s + r),
|
|
205
212
|
y: c[t],
|
|
206
213
|
width: s,
|
|
@@ -216,10 +223,10 @@ function q(e, t, n) {
|
|
|
216
223
|
}
|
|
217
224
|
//#endregion
|
|
218
225
|
//#region src/core/scrollbar.ts
|
|
219
|
-
function
|
|
226
|
+
function q(e, t, n) {
|
|
220
227
|
return Math.min(n, Math.max(t, e));
|
|
221
228
|
}
|
|
222
|
-
function
|
|
229
|
+
function oe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
|
|
223
230
|
let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
|
|
224
231
|
if (!(c > 0 && o > 0)) return {
|
|
225
232
|
maximumScrollPosition: c,
|
|
@@ -228,23 +235,23 @@ function J({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
|
|
|
228
235
|
thumbSize: o,
|
|
229
236
|
thumbTravel: 0
|
|
230
237
|
};
|
|
231
|
-
let l =
|
|
238
|
+
let l = q(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
|
|
232
239
|
return {
|
|
233
240
|
maximumScrollPosition: c,
|
|
234
241
|
scrollable: !0,
|
|
235
|
-
thumbOffset: u * (
|
|
242
|
+
thumbOffset: u * (q(n, 0, c) / c),
|
|
236
243
|
thumbSize: l,
|
|
237
244
|
thumbTravel: u
|
|
238
245
|
};
|
|
239
246
|
}
|
|
240
247
|
//#endregion
|
|
241
248
|
//#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
|
|
242
|
-
var
|
|
249
|
+
var J = ["aria-hidden"], se = [
|
|
243
250
|
"aria-controls",
|
|
244
251
|
"aria-valuemax",
|
|
245
252
|
"aria-valuenow",
|
|
246
253
|
"tabindex"
|
|
247
|
-
],
|
|
254
|
+
], ce = 32, Y = 40, le = 120, X = /* @__PURE__ */ d({
|
|
248
255
|
__name: "GalleryScrollbar",
|
|
249
256
|
props: {
|
|
250
257
|
contentSize: {},
|
|
@@ -259,31 +266,31 @@ var Y = ["aria-hidden"], oe = [
|
|
|
259
266
|
thumbOffset: 0,
|
|
260
267
|
thumbSize: 0,
|
|
261
268
|
thumbTravel: 0
|
|
262
|
-
}, i =
|
|
269
|
+
}, i = w(null), a = w(n), o = w(!1), l = w(!1), u = w(!1), d = null, f = 0, p = 0, g = null, y = null, x = null, S = null, C = !1, T = null, E = r(() => a.value.scrollable && !t.suspended), D = r(() => ({
|
|
263
270
|
height: `${a.value.thumbSize}px`,
|
|
264
271
|
transform: `translate3d(0, ${a.value.thumbOffset}px, 0)`
|
|
265
272
|
}));
|
|
266
|
-
function
|
|
273
|
+
function k() {
|
|
267
274
|
g !== null && clearTimeout(g), g = setTimeout(() => {
|
|
268
275
|
g = null, o.value || (l.value = !1);
|
|
269
|
-
},
|
|
270
|
-
}
|
|
271
|
-
function k() {
|
|
272
|
-
l.value = !0, O();
|
|
276
|
+
}, le);
|
|
273
277
|
}
|
|
274
278
|
function A() {
|
|
279
|
+
l.value = !0, k();
|
|
280
|
+
}
|
|
281
|
+
function j() {
|
|
275
282
|
let e = t.scrollElement, r = i.value;
|
|
276
|
-
return !e || !r ? n :
|
|
283
|
+
return !e || !r ? n : oe({
|
|
277
284
|
contentSize: e.scrollHeight,
|
|
278
|
-
minimumThumbSize:
|
|
285
|
+
minimumThumbSize: ce,
|
|
279
286
|
scrollPosition: e.scrollTop,
|
|
280
287
|
trackSize: r.clientHeight,
|
|
281
288
|
viewportSize: e.clientHeight
|
|
282
289
|
});
|
|
283
290
|
}
|
|
284
|
-
function
|
|
291
|
+
function M(e) {
|
|
285
292
|
if (o.value && e !== "scroll") {
|
|
286
|
-
|
|
293
|
+
C = !0;
|
|
287
294
|
return;
|
|
288
295
|
}
|
|
289
296
|
if (o.value) {
|
|
@@ -296,68 +303,68 @@ var Y = ["aria-hidden"], oe = [
|
|
|
296
303
|
};
|
|
297
304
|
return;
|
|
298
305
|
}
|
|
299
|
-
a.value =
|
|
300
|
-
|
|
306
|
+
a.value = j(), !(u.value || y !== null) && (y = requestAnimationFrame(() => {
|
|
307
|
+
y = null, u.value = !0;
|
|
301
308
|
}));
|
|
302
309
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
310
|
+
function N() {
|
|
311
|
+
A(), M("scroll");
|
|
305
312
|
}
|
|
306
|
-
function
|
|
313
|
+
function P(e) {
|
|
307
314
|
let n = t.scrollElement;
|
|
308
|
-
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)),
|
|
315
|
+
n && (n.scrollTop = Math.min(a.value.maximumScrollPosition, Math.max(0, e)), M("scroll"));
|
|
309
316
|
}
|
|
310
|
-
function
|
|
311
|
-
if (!
|
|
317
|
+
function F(e) {
|
|
318
|
+
if (!E.value || e.target !== e.currentTarget) return;
|
|
312
319
|
let t = i.value;
|
|
313
320
|
if (!t || a.value.thumbTravel <= 0) return;
|
|
314
|
-
e.preventDefault(),
|
|
321
|
+
e.preventDefault(), A();
|
|
315
322
|
let n = e.clientY - t.getBoundingClientRect().top - a.value.thumbSize / 2;
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
function F(e) {
|
|
319
|
-
T.value && (e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture?.(e.pointerId), d = e.pointerId, f = e.clientY, p = t.scrollElement?.scrollTop ?? 0, o.value = !0, l.value = !0, g !== null && clearTimeout(g), g = null);
|
|
323
|
+
P(Math.min(1, Math.max(0, n / a.value.thumbTravel)) * a.value.maximumScrollPosition);
|
|
320
324
|
}
|
|
321
325
|
function I(e) {
|
|
322
|
-
|
|
323
|
-
let t = (e.clientY - f) / a.value.thumbTravel * a.value.maximumScrollPosition;
|
|
324
|
-
N(p + t);
|
|
326
|
+
E.value && (e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture?.(e.pointerId), d = e.pointerId, f = e.clientY, p = t.scrollElement?.scrollTop ?? 0, o.value = !0, l.value = !0, g !== null && clearTimeout(g), g = null);
|
|
325
327
|
}
|
|
326
328
|
function L(e) {
|
|
327
|
-
!o.value || e.pointerId !== d || (e.
|
|
329
|
+
if (!o.value || e.pointerId !== d || (e.preventDefault(), a.value.thumbTravel <= 0)) return;
|
|
330
|
+
let t = (e.clientY - f) / a.value.thumbTravel * a.value.maximumScrollPosition;
|
|
331
|
+
P(p + t);
|
|
328
332
|
}
|
|
329
333
|
function R(e) {
|
|
330
|
-
|
|
331
|
-
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - X : e.key === "ArrowDown" ? r + X : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
332
|
-
i !== null && (e.preventDefault(), k(), N(i));
|
|
334
|
+
!o.value || e.pointerId !== d || (e.currentTarget.releasePointerCapture?.(e.pointerId), d = null, o.value = !1, C && (C = !1, M("content")), k());
|
|
333
335
|
}
|
|
334
336
|
function z(e) {
|
|
335
|
-
if (
|
|
336
|
-
|
|
337
|
-
|
|
337
|
+
if (!E.value) return;
|
|
338
|
+
let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - Y : e.key === "ArrowDown" ? r + Y : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
|
|
339
|
+
i !== null && (e.preventDefault(), A(), P(i));
|
|
340
|
+
}
|
|
341
|
+
function B(e) {
|
|
342
|
+
if (S?.disconnect(), !(typeof ResizeObserver > "u")) {
|
|
343
|
+
S = new ResizeObserver(() => M("content"));
|
|
344
|
+
for (let t of e.children) S.observe(t);
|
|
338
345
|
}
|
|
339
346
|
}
|
|
340
|
-
return
|
|
341
|
-
t?.removeEventListener("scroll",
|
|
342
|
-
|
|
343
|
-
}),
|
|
344
|
-
|
|
345
|
-
}),
|
|
346
|
-
}, { immediate: !0 }),
|
|
347
|
-
m(() =>
|
|
348
|
-
}),
|
|
349
|
-
t.scrollElement?.removeEventListener("scroll",
|
|
350
|
-
}), (t, n) => (
|
|
347
|
+
return O(() => t.scrollElement, (e, t) => {
|
|
348
|
+
t?.removeEventListener("scroll", N), x?.disconnect(), x = null, S?.disconnect(), S = null, T?.disconnect(), T = null, e?.addEventListener("scroll", N, { passive: !0 }), e && typeof ResizeObserver < "u" && (T = new ResizeObserver(() => {
|
|
349
|
+
A(), M("resize");
|
|
350
|
+
}), T.observe(e), B(e)), e && typeof MutationObserver < "u" && (x = new MutationObserver(() => {
|
|
351
|
+
B(e), M("content");
|
|
352
|
+
}), x.observe(e, { childList: !0 })), m(() => M("resize"));
|
|
353
|
+
}, { immediate: !0 }), O(() => t.contentSize, () => {
|
|
354
|
+
m(() => M("content"));
|
|
355
|
+
}), v(() => {
|
|
356
|
+
t.scrollElement?.removeEventListener("scroll", N), x?.disconnect(), S?.disconnect(), T?.disconnect(), g !== null && clearTimeout(g), y !== null && cancelAnimationFrame(y);
|
|
357
|
+
}), (t, n) => (b(), s("div", {
|
|
351
358
|
ref_key: "trackElement",
|
|
352
359
|
ref: i,
|
|
353
360
|
class: h(["gallery-scrollbar", {
|
|
354
361
|
"gallery-scrollbar--dragging": o.value,
|
|
355
362
|
"gallery-scrollbar--interacting": l.value,
|
|
356
363
|
"gallery-scrollbar--ready": u.value,
|
|
357
|
-
"gallery-scrollbar--visible":
|
|
364
|
+
"gallery-scrollbar--visible": E.value
|
|
358
365
|
}]),
|
|
359
|
-
"aria-hidden": !
|
|
360
|
-
onPointerdown:
|
|
366
|
+
"aria-hidden": !E.value || void 0,
|
|
367
|
+
onPointerdown: F
|
|
361
368
|
}, [c("div", {
|
|
362
369
|
class: "gallery-scrollbar-thumb",
|
|
363
370
|
"aria-controls": e.controlsId,
|
|
@@ -367,14 +374,14 @@ var Y = ["aria-hidden"], oe = [
|
|
|
367
374
|
"aria-valuemin": "0",
|
|
368
375
|
"aria-valuenow": Math.round(e.scrollElement?.scrollTop ?? 0),
|
|
369
376
|
role: "scrollbar",
|
|
370
|
-
style: _(
|
|
371
|
-
tabindex:
|
|
372
|
-
onKeydown:
|
|
373
|
-
onPointercancel:
|
|
374
|
-
onPointerdown:
|
|
375
|
-
onPointermove:
|
|
376
|
-
onPointerup:
|
|
377
|
-
}, null, 44,
|
|
377
|
+
style: _(D.value),
|
|
378
|
+
tabindex: E.value ? 0 : -1,
|
|
379
|
+
onKeydown: z,
|
|
380
|
+
onPointercancel: R,
|
|
381
|
+
onPointerdown: I,
|
|
382
|
+
onPointermove: L,
|
|
383
|
+
onPointerup: R
|
|
384
|
+
}, null, 44, se)], 42, J));
|
|
378
385
|
}
|
|
379
386
|
}), Z = (e) => {
|
|
380
387
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
@@ -501,17 +508,17 @@ var ke = /* @__PURE__ */ d({
|
|
|
501
508
|
total: {}
|
|
502
509
|
},
|
|
503
510
|
setup(e) {
|
|
504
|
-
let t = e, n = r(() =>
|
|
511
|
+
let t = e, n = r(() => N(t.item, t.mediaIndex)), i = r(() => M(t.item)), o = r(() => P(t.item, n.value)), c = r(() => ({
|
|
505
512
|
height: `${t.region.height}px`,
|
|
506
513
|
paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
|
|
507
514
|
paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
|
|
508
515
|
})), l = r(() => t.style?.background ?? t.region.background);
|
|
509
|
-
return (t, r) => (
|
|
516
|
+
return (t, r) => (b(), s("div", {
|
|
510
517
|
class: h(["media-card-region", [`media-card-${e.placement}`, { "media-card-region--transparent": l.value === "transparent" }]]),
|
|
511
518
|
style: _(c.value),
|
|
512
|
-
onClick: r[0] ||=
|
|
513
|
-
onKeydown: r[1] ||=
|
|
514
|
-
}, [(
|
|
519
|
+
onClick: r[0] ||= j(() => {}, ["stop"]),
|
|
520
|
+
onKeydown: r[1] ||= j(() => {}, ["stop"])
|
|
521
|
+
}, [(b(), a(C(e.region.component), {
|
|
515
522
|
index: e.index,
|
|
516
523
|
item: e.item,
|
|
517
524
|
layout: e.layout,
|
|
@@ -573,13 +580,13 @@ var ke = /* @__PURE__ */ d({
|
|
|
573
580
|
return Number(e.target.value);
|
|
574
581
|
}
|
|
575
582
|
let f = r(() => Math.max(0, n.duration)), p = r(() => l(n.currentTime, f.value)), m = r(() => ({ "--media-range-progress": `${f.value > 0 ? p.value / f.value * 100 : 0}%` })), g = r(() => ({ "--media-range-progress": `${l(n.volume) * 100}%` }));
|
|
576
|
-
return (t, n) => (
|
|
583
|
+
return (t, n) => (b(), s("div", {
|
|
577
584
|
class: h(["media-controls", `media-controls--${e.layout}`]),
|
|
578
585
|
"aria-label": "Video controls",
|
|
579
|
-
onClick: n[4] ||=
|
|
580
|
-
onDblclick: n[5] ||=
|
|
581
|
-
onKeydown: n[6] ||=
|
|
582
|
-
onWheel: n[7] ||=
|
|
586
|
+
onClick: n[4] ||= j(() => {}, ["stop"]),
|
|
587
|
+
onDblclick: n[5] ||= j(() => {}, ["stop"]),
|
|
588
|
+
onKeydown: n[6] ||= j(() => {}, ["stop"]),
|
|
589
|
+
onWheel: n[7] ||= j(() => {}, ["stop"])
|
|
583
590
|
}, [c("input", {
|
|
584
591
|
class: "media-control-range media-control-seek",
|
|
585
592
|
type: "range",
|
|
@@ -592,18 +599,18 @@ var ke = /* @__PURE__ */ d({
|
|
|
592
599
|
"aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
|
|
593
600
|
disabled: f.value <= 0,
|
|
594
601
|
onInput: n[0] ||= (e) => i("seek", d(e))
|
|
595
|
-
}, null, 44, Ae), e.layout === "reel" ? (
|
|
602
|
+
}, null, 44, Ae), e.layout === "reel" ? (b(), s("div", je, [
|
|
596
603
|
c("button", {
|
|
597
604
|
type: "button",
|
|
598
605
|
class: "media-control-button media-control-playback",
|
|
599
606
|
"aria-label": e.playing ? "Pause video" : "Play video",
|
|
600
607
|
title: e.playing ? "Pause" : "Play",
|
|
601
608
|
onClick: n[1] ||= (e) => i("togglePlayback")
|
|
602
|
-
}, [e.playing ? (
|
|
609
|
+
}, [e.playing ? (b(), a(E(be), {
|
|
603
610
|
key: 0,
|
|
604
611
|
size: 18,
|
|
605
612
|
fill: "currentColor"
|
|
606
|
-
})) : (
|
|
613
|
+
})) : (b(), a(E(xe), {
|
|
607
614
|
key: 1,
|
|
608
615
|
size: 18,
|
|
609
616
|
fill: "currentColor"
|
|
@@ -614,10 +621,10 @@ var ke = /* @__PURE__ */ d({
|
|
|
614
621
|
"aria-label": e.muted ? "Unmute video" : "Mute video",
|
|
615
622
|
title: e.muted ? "Unmute" : "Mute",
|
|
616
623
|
onClick: n[2] ||= (e) => i("toggleMute")
|
|
617
|
-
}, [e.muted || e.volume === 0 ? (
|
|
624
|
+
}, [e.muted || e.volume === 0 ? (b(), a(E(Ce), {
|
|
618
625
|
key: 0,
|
|
619
626
|
size: 18
|
|
620
|
-
})) : (
|
|
627
|
+
})) : (b(), a(E(Se), {
|
|
621
628
|
key: 1,
|
|
622
629
|
size: 18
|
|
623
630
|
}))], 8, Pe), c("input", {
|
|
@@ -632,7 +639,7 @@ var ke = /* @__PURE__ */ d({
|
|
|
632
639
|
"aria-valuetext": `${Math.round(e.volume * 100)} percent`,
|
|
633
640
|
onInput: n[3] ||= (e) => i("volumeChange", d(e))
|
|
634
641
|
}, null, 44, Fe)]),
|
|
635
|
-
c("output", Ie,
|
|
642
|
+
c("output", Ie, T(u(p.value)) + " / " + T(u(f.value)), 1)
|
|
636
643
|
])) : o("", !0)], 34));
|
|
637
644
|
}
|
|
638
645
|
}), Re = [
|
|
@@ -692,93 +699,93 @@ var ke = /* @__PURE__ */ d({
|
|
|
692
699
|
"ready"
|
|
693
700
|
],
|
|
694
701
|
setup(e, { emit: i }) {
|
|
695
|
-
let l = e, d = null, f = 0, p = !1, m = null, g = null,
|
|
696
|
-
function
|
|
697
|
-
e &&
|
|
702
|
+
let l = e, d = null, f = 0, p = !1, m = null, g = null, y = w("next"), x = i;
|
|
703
|
+
function S(e = !1, t = "pointer") {
|
|
704
|
+
e && x("activate", t);
|
|
698
705
|
}
|
|
699
|
-
let
|
|
700
|
-
function
|
|
706
|
+
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(!0), H = w(!1), U = w(1), W = 1, G = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
|
|
707
|
+
function ee(e) {
|
|
701
708
|
return e.detail === 0 ? "keyboard" : "pointer";
|
|
702
709
|
}
|
|
703
|
-
function
|
|
704
|
-
let n =
|
|
705
|
-
r !==
|
|
710
|
+
function K(e, t) {
|
|
711
|
+
let n = C.value.length, r = (e + n) % n;
|
|
712
|
+
r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
|
|
706
713
|
}
|
|
707
|
-
function
|
|
714
|
+
function te(e, t, n) {
|
|
708
715
|
return t === 1 ? e * 16 : t === 2 ? e * n : e;
|
|
709
716
|
}
|
|
710
|
-
function
|
|
717
|
+
function ne() {
|
|
711
718
|
f = 0, p = !1, d !== null && clearTimeout(d), d = null;
|
|
712
719
|
}
|
|
713
|
-
function
|
|
714
|
-
d !== null && clearTimeout(d), d = setTimeout(
|
|
720
|
+
function re() {
|
|
721
|
+
d !== null && clearTimeout(d), d = setTimeout(ne, Ze);
|
|
715
722
|
}
|
|
716
|
-
function
|
|
717
|
-
if (
|
|
718
|
-
let t = e.currentTarget?.clientWidth || 1, n =
|
|
719
|
-
if (n === 0 || (e.preventDefault(),
|
|
723
|
+
function ie(e) {
|
|
724
|
+
if (C.value.length <= 1) return;
|
|
725
|
+
let t = e.currentTarget?.clientWidth || 1, n = te(e.deltaX, e.deltaMode, t);
|
|
726
|
+
if (n === 0 || (e.preventDefault(), re(), p) || (f += n, Math.abs(f) < Qe)) return;
|
|
720
727
|
let r = Math.sign(f);
|
|
721
|
-
f = 0, p = !0,
|
|
728
|
+
f = 0, p = !0, K(D.value + r);
|
|
722
729
|
}
|
|
723
|
-
function
|
|
730
|
+
function ae(e) {
|
|
724
731
|
let t = e.touches[0];
|
|
725
732
|
l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
|
|
726
733
|
}
|
|
727
|
-
function
|
|
734
|
+
function q(e) {
|
|
728
735
|
let t = e.changedTouches[0];
|
|
729
736
|
if (m === null || g === null || !t) return;
|
|
730
737
|
let n = m - t.clientX, r = g - t.clientY;
|
|
731
|
-
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Xe ||
|
|
738
|
+
m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Xe || K(D.value + Math.sign(n)));
|
|
732
739
|
}
|
|
733
|
-
let
|
|
734
|
-
function
|
|
735
|
-
l.layout === "reel" && (e.stopPropagation(),
|
|
740
|
+
let oe = r(() => Oe(F.value)), J = r(() => l.layout === "reel" && l.stationaryReelControls === !0), se = r(() => oe.value && l.previewState === "ready" && (!J.value || !!(l.active && l.reelControlsTarget))), ce = r(() => `${l.item.postId}:${D.value}:${F.value}`);
|
|
741
|
+
function Y(e) {
|
|
742
|
+
l.layout === "reel" && (e.stopPropagation(), le());
|
|
736
743
|
}
|
|
737
|
-
async function
|
|
738
|
-
if (
|
|
739
|
-
if (
|
|
740
|
-
|
|
744
|
+
async function le() {
|
|
745
|
+
if (R.value) {
|
|
746
|
+
if (H.value) {
|
|
747
|
+
R.value.pause();
|
|
741
748
|
return;
|
|
742
749
|
}
|
|
743
750
|
try {
|
|
744
|
-
await
|
|
751
|
+
await R.value.play();
|
|
745
752
|
} catch {
|
|
746
|
-
|
|
753
|
+
H.value = !1;
|
|
747
754
|
}
|
|
748
755
|
}
|
|
749
756
|
}
|
|
750
|
-
function
|
|
757
|
+
function X(e) {
|
|
751
758
|
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
752
759
|
}
|
|
753
760
|
function Z(e) {
|
|
754
|
-
let t = e?.currentTarget ??
|
|
755
|
-
t && (
|
|
761
|
+
let t = e?.currentTarget ?? R.value;
|
|
762
|
+
t && (z.value = X(t.currentTime), B.value = X(t.duration), V.value = t.muted, U.value = t.volume, t.volume > 0 && (W = t.volume));
|
|
756
763
|
}
|
|
757
764
|
function ue(e) {
|
|
758
|
-
Z(e),
|
|
765
|
+
Z(e), x("ready", D.value);
|
|
759
766
|
}
|
|
760
767
|
function de() {
|
|
761
|
-
|
|
768
|
+
H.value = !1, x("ended", D.value);
|
|
762
769
|
}
|
|
763
770
|
function fe(e) {
|
|
764
|
-
let t =
|
|
765
|
-
!t || !Number.isFinite(e) || (t.currentTime = Math.min(
|
|
771
|
+
let t = R.value;
|
|
772
|
+
!t || !Number.isFinite(e) || (t.currentTime = Math.min(X(t.duration), Math.max(0, e)), z.value = t.currentTime);
|
|
766
773
|
}
|
|
767
774
|
function pe(e) {
|
|
768
|
-
let t =
|
|
775
|
+
let t = R.value;
|
|
769
776
|
if (!t || !Number.isFinite(e)) return;
|
|
770
777
|
let n = Math.min(1, Math.max(0, e));
|
|
771
|
-
t.volume = n, t.muted = n === 0, n > 0 && (
|
|
778
|
+
t.volume = n, t.muted = n === 0, n > 0 && (W = n), Z();
|
|
772
779
|
}
|
|
773
780
|
function me() {
|
|
774
|
-
let e =
|
|
775
|
-
e && (e.muted && e.volume === 0 && (e.volume =
|
|
781
|
+
let e = R.value;
|
|
782
|
+
e && (e.muted && e.volume === 0 && (e.volume = W), e.muted = !e.muted, Z());
|
|
776
783
|
}
|
|
777
|
-
return
|
|
778
|
-
|
|
779
|
-
}), (r, i) => (
|
|
784
|
+
return v(() => {
|
|
785
|
+
ne();
|
|
786
|
+
}), (r, i) => (b(), s("article", {
|
|
780
787
|
"data-post-id": e.item.postId,
|
|
781
|
-
"data-media-index":
|
|
788
|
+
"data-media-index": D.value,
|
|
782
789
|
class: h(["media-card", {
|
|
783
790
|
"media-card--entering": e.entering,
|
|
784
791
|
"media-card--leaving": e.leaving,
|
|
@@ -789,18 +796,18 @@ var ke = /* @__PURE__ */ d({
|
|
|
789
796
|
"aria-hidden": e.leaving || void 0,
|
|
790
797
|
"aria-busy": e.previewState === "loading",
|
|
791
798
|
inert: e.leaving || void 0,
|
|
792
|
-
role: e.interactive && !e.leaving && !
|
|
793
|
-
tabindex: e.interactive && !e.leaving && !
|
|
794
|
-
onClick: i[11] ||= (t) =>
|
|
795
|
-
onKeydown: [i[12] ||=
|
|
799
|
+
role: e.interactive && !e.leaving && !G.value ? "button" : void 0,
|
|
800
|
+
tabindex: e.interactive && !e.leaving && !G.value ? 0 : void 0,
|
|
801
|
+
onClick: i[11] ||= (t) => S(e.interactive && !G.value, ee(t)),
|
|
802
|
+
onKeydown: [i[12] ||= A((t) => S(e.interactive && !G.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !G.value, "keyboard"), ["prevent"]), ["space"])]
|
|
796
803
|
}, [c("div", ze, [
|
|
797
|
-
e.cardHeader ? (
|
|
804
|
+
e.cardHeader ? (b(), a(ke, {
|
|
798
805
|
key: 0,
|
|
799
806
|
index: e.index,
|
|
800
807
|
item: e.item,
|
|
801
808
|
layout: e.layout,
|
|
802
809
|
"loaded-count": e.loadedCount,
|
|
803
|
-
"media-index":
|
|
810
|
+
"media-index": D.value,
|
|
804
811
|
"media-source": e.mediaSource,
|
|
805
812
|
placement: "header",
|
|
806
813
|
region: e.cardHeader,
|
|
@@ -818,82 +825,82 @@ var ke = /* @__PURE__ */ d({
|
|
|
818
825
|
"total"
|
|
819
826
|
])) : o("", !0),
|
|
820
827
|
c("div", {
|
|
821
|
-
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" &&
|
|
822
|
-
"data-media-direction":
|
|
823
|
-
onWheel:
|
|
824
|
-
onTouchstartPassive:
|
|
825
|
-
onTouchendPassive:
|
|
828
|
+
class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
|
|
829
|
+
"data-media-direction": y.value,
|
|
830
|
+
onWheel: ie,
|
|
831
|
+
onTouchstartPassive: ae,
|
|
832
|
+
onTouchendPassive: q
|
|
826
833
|
}, [
|
|
827
|
-
u(n, { name: `media-slide-${
|
|
828
|
-
default:
|
|
829
|
-
key: `${e.item.postId}:${
|
|
834
|
+
u(n, { name: `media-slide-${y.value}` }, {
|
|
835
|
+
default: k(() => [(b(), s("div", {
|
|
836
|
+
key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
|
|
830
837
|
class: "media-card-frame",
|
|
831
|
-
"data-media-index":
|
|
832
|
-
}, [e.previewState === "loading" ? (
|
|
838
|
+
"data-media-index": D.value
|
|
839
|
+
}, [e.previewState === "loading" ? (b(), s("div", He, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
|
|
833
840
|
key: 1,
|
|
834
841
|
"data-test": "media-error",
|
|
835
842
|
class: "media-error",
|
|
836
843
|
role: "img",
|
|
837
|
-
"aria-label": `${
|
|
838
|
-
}, [c("strong", We,
|
|
844
|
+
"aria-label": `${E(Te)(F.value)} ${E(Ee)(F.value)}`
|
|
845
|
+
}, [c("strong", We, T(E(Te)(F.value)), 1), c("span", null, T(E(Ee)(F.value)), 1)], 8, Ue)) : o("", !0), oe.value ? (b(), s("video", {
|
|
839
846
|
key: 2,
|
|
840
847
|
ref_key: "videoElement",
|
|
841
|
-
ref:
|
|
848
|
+
ref: R,
|
|
842
849
|
class: h(["media-preview", {
|
|
843
850
|
"media-preview--ready": e.previewState === "ready",
|
|
844
851
|
"media-preview--reel-video": e.layout === "reel"
|
|
845
852
|
}]),
|
|
846
|
-
src:
|
|
847
|
-
width:
|
|
848
|
-
height:
|
|
853
|
+
src: F.value,
|
|
854
|
+
width: I.value ?? void 0,
|
|
855
|
+
height: L.value ?? void 0,
|
|
849
856
|
autoplay: "",
|
|
850
857
|
loop: !e.advanceOnMediaEnd,
|
|
851
|
-
muted:
|
|
858
|
+
muted: V.value,
|
|
852
859
|
playsinline: "",
|
|
853
860
|
preload: e.fetchPriority === "high" ? "auto" : "metadata",
|
|
854
861
|
onLoadedmetadata: ue,
|
|
855
862
|
onDurationchange: Z,
|
|
856
863
|
onTimeupdate: Z,
|
|
857
864
|
onVolumechange: Z,
|
|
858
|
-
onPlaying: i[0] ||= (e) =>
|
|
859
|
-
onPause: i[1] ||= (e) =>
|
|
865
|
+
onPlaying: i[0] ||= (e) => H.value = !0,
|
|
866
|
+
onPause: i[1] ||= (e) => H.value = !1,
|
|
860
867
|
onEnded: de,
|
|
861
|
-
onClick:
|
|
862
|
-
onError: i[2] ||= (e) => r.$emit("error",
|
|
863
|
-
}, null, 42, Ge)) : (
|
|
868
|
+
onClick: Y,
|
|
869
|
+
onError: i[2] ||= (e) => r.$emit("error", D.value)
|
|
870
|
+
}, null, 42, Ge)) : (b(), s("img", {
|
|
864
871
|
key: 3,
|
|
865
872
|
class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
|
|
866
|
-
src:
|
|
867
|
-
width:
|
|
868
|
-
height:
|
|
873
|
+
src: F.value,
|
|
874
|
+
width: I.value ?? void 0,
|
|
875
|
+
height: L.value ?? void 0,
|
|
869
876
|
fetchpriority: e.fetchPriority,
|
|
870
877
|
alt: "",
|
|
871
878
|
decoding: "async",
|
|
872
879
|
loading: "eager",
|
|
873
|
-
onLoad: i[3] ||= (e) => r.$emit("ready",
|
|
874
|
-
onError: i[4] ||= (e) => r.$emit("error",
|
|
880
|
+
onLoad: i[3] ||= (e) => r.$emit("ready", D.value),
|
|
881
|
+
onError: i[4] ||= (e) => r.$emit("error", D.value)
|
|
875
882
|
}, null, 42, Ke))], 8, Ve))]),
|
|
876
883
|
_: 1
|
|
877
884
|
}, 8, ["name"]),
|
|
878
|
-
(
|
|
879
|
-
disabled: !
|
|
885
|
+
(b(), a(t, {
|
|
886
|
+
disabled: !J.value || !e.reelControlsTarget,
|
|
880
887
|
to: e.reelControlsTarget ?? "body"
|
|
881
888
|
}, [u(n, {
|
|
882
889
|
name: "vibe-reel-media-controls",
|
|
883
|
-
css:
|
|
890
|
+
css: J.value
|
|
884
891
|
}, {
|
|
885
|
-
default:
|
|
886
|
-
key:
|
|
887
|
-
"current-time":
|
|
888
|
-
"data-control-post-id":
|
|
889
|
-
duration:
|
|
892
|
+
default: k(() => [se.value ? (b(), a(Le, {
|
|
893
|
+
key: ce.value,
|
|
894
|
+
"current-time": z.value,
|
|
895
|
+
"data-control-post-id": J.value ? e.item.postId : void 0,
|
|
896
|
+
duration: B.value,
|
|
890
897
|
layout: e.layout,
|
|
891
|
-
muted:
|
|
892
|
-
playing:
|
|
893
|
-
volume:
|
|
898
|
+
muted: V.value,
|
|
899
|
+
playing: H.value,
|
|
900
|
+
volume: U.value,
|
|
894
901
|
onSeek: fe,
|
|
895
902
|
onToggleMute: me,
|
|
896
|
-
onTogglePlayback:
|
|
903
|
+
onTogglePlayback: le,
|
|
897
904
|
onVolumeChange: pe
|
|
898
905
|
}, null, 8, [
|
|
899
906
|
"current-time",
|
|
@@ -906,7 +913,7 @@ var ke = /* @__PURE__ */ d({
|
|
|
906
913
|
])) : o("", !0)]),
|
|
907
914
|
_: 1
|
|
908
915
|
}, 8, ["css"])], 8, ["disabled", "to"])),
|
|
909
|
-
|
|
916
|
+
C.value.length > 1 ? (b(), s("div", {
|
|
910
917
|
key: 0,
|
|
911
918
|
class: h(["media-carousel-controls", { "media-carousel-controls--persistent": e.layout === "reel" }]),
|
|
912
919
|
"aria-label": "Media navigation"
|
|
@@ -914,31 +921,31 @@ var ke = /* @__PURE__ */ d({
|
|
|
914
921
|
type: "button",
|
|
915
922
|
class: "media-carousel-control media-carousel-control--previous",
|
|
916
923
|
"aria-label": `Previous media for post ${e.item.postId}`,
|
|
917
|
-
onClick: i[5] ||=
|
|
918
|
-
onKeydown: i[6] ||=
|
|
919
|
-
}, [u(
|
|
924
|
+
onClick: i[5] ||= j((e) => K(D.value - 1, e), ["stop"]),
|
|
925
|
+
onKeydown: i[6] ||= j(() => {}, ["stop"])
|
|
926
|
+
}, [u(E(ve), { size: 20 })], 40, qe), c("button", {
|
|
920
927
|
type: "button",
|
|
921
928
|
class: "media-carousel-control media-carousel-control--next",
|
|
922
929
|
"aria-label": `Next media for post ${e.item.postId}`,
|
|
923
|
-
onClick: i[7] ||=
|
|
924
|
-
onKeydown: i[8] ||=
|
|
925
|
-
}, [u(
|
|
926
|
-
|
|
930
|
+
onClick: i[7] ||= j((e) => K(D.value + 1, e), ["stop"]),
|
|
931
|
+
onKeydown: i[8] ||= j(() => {}, ["stop"])
|
|
932
|
+
}, [u(E(ye), { size: 20 })], 40, Je)], 2)) : o("", !0),
|
|
933
|
+
G.value ? (b(), s("button", {
|
|
927
934
|
key: 1,
|
|
928
935
|
class: "media-card-activator",
|
|
929
936
|
type: "button",
|
|
930
937
|
"aria-label": `Open post ${e.item.postId}`,
|
|
931
|
-
onClick: i[9] ||=
|
|
932
|
-
onKeydown: i[10] ||=
|
|
938
|
+
onClick: i[9] ||= j((e) => r.$emit("activate", ee(e)), ["stop"]),
|
|
939
|
+
onKeydown: i[10] ||= j(() => {}, ["stop"])
|
|
933
940
|
}, null, 40, Ye)) : o("", !0)
|
|
934
941
|
], 42, Be),
|
|
935
|
-
e.cardFooter ? (
|
|
942
|
+
e.cardFooter ? (b(), a(ke, {
|
|
936
943
|
key: 1,
|
|
937
944
|
index: e.index,
|
|
938
945
|
item: e.item,
|
|
939
946
|
layout: e.layout,
|
|
940
947
|
"loaded-count": e.loadedCount,
|
|
941
|
-
"media-index":
|
|
948
|
+
"media-index": D.value,
|
|
942
949
|
"media-source": e.mediaSource,
|
|
943
950
|
placement: "footer",
|
|
944
951
|
region: e.cardFooter,
|
|
@@ -991,14 +998,14 @@ var ke = /* @__PURE__ */ d({
|
|
|
991
998
|
"retryEnd"
|
|
992
999
|
],
|
|
993
1000
|
setup(t, { expose: n, emit: i }) {
|
|
994
|
-
let o = t, l = i, d =
|
|
1001
|
+
let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(rt), y = w(0), x = w(0), C = w(0), T = null, k = null, A = null, j = r(() => ae(o.items, m.value, {
|
|
995
1002
|
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
996
1003
|
gap: g.value,
|
|
997
1004
|
minColumnWidth: nt
|
|
998
|
-
})),
|
|
999
|
-
let e =
|
|
1005
|
+
})), M = r(() => {
|
|
1006
|
+
let e = j.value;
|
|
1000
1007
|
if (o.leavingPostIds.size === 0) return e;
|
|
1001
|
-
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n =
|
|
1008
|
+
let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n = ae(t, m.value, {
|
|
1002
1009
|
additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
|
|
1003
1010
|
gap: g.value,
|
|
1004
1011
|
minColumnWidth: nt
|
|
@@ -1007,20 +1014,20 @@ var ke = /* @__PURE__ */ d({
|
|
|
1007
1014
|
...n,
|
|
1008
1015
|
items: o.items.map((t, n) => o.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
|
|
1009
1016
|
};
|
|
1010
|
-
}),
|
|
1011
|
-
let e = Math.max(at,
|
|
1012
|
-
scrollTop:
|
|
1013
|
-
viewportHeight:
|
|
1014
|
-
}, n =
|
|
1017
|
+
}), N = r(() => ({ height: `${o.leavingPostIds.size === 0 ? M.value.height : j.value.height}px` })), P = r(() => !o.infiniteScroll || x.value > 0 && C.value + M.value.height <= x.value + 1), I = r(() => {
|
|
1018
|
+
let e = Math.max(at, x.value * ot), t = {
|
|
1019
|
+
scrollTop: y.value - C.value,
|
|
1020
|
+
viewportHeight: x.value
|
|
1021
|
+
}, n = ie(M.value.items, {
|
|
1015
1022
|
...t,
|
|
1016
1023
|
overscan: e
|
|
1017
|
-
}), r = o.leavingPostIds.size === 0 ? [] :
|
|
1024
|
+
}), r = o.leavingPostIds.size === 0 ? [] : ie(j.value.items, {
|
|
1018
1025
|
...t,
|
|
1019
1026
|
overscan: e
|
|
1020
|
-
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a =
|
|
1027
|
+
}), i = [...new Set([...n, ...r])].sort((e, t) => e - t), a = ie(M.value.items, {
|
|
1021
1028
|
...t,
|
|
1022
1029
|
overscan: 0
|
|
1023
|
-
}), s = o.leavingPostIds.size === 0 ? [] :
|
|
1030
|
+
}), s = o.leavingPostIds.size === 0 ? [] : ie(j.value.items, {
|
|
1024
1031
|
...t,
|
|
1025
1032
|
overscan: 0
|
|
1026
1033
|
}), c = new Set([...a, ...s]);
|
|
@@ -1033,11 +1040,11 @@ var ke = /* @__PURE__ */ d({
|
|
|
1033
1040
|
}] : [];
|
|
1034
1041
|
});
|
|
1035
1042
|
});
|
|
1036
|
-
function
|
|
1037
|
-
let t =
|
|
1043
|
+
function L(e) {
|
|
1044
|
+
let t = M.value.items[e], n = o.items[e]?.postId;
|
|
1038
1045
|
if (!t) return {};
|
|
1039
|
-
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ?
|
|
1040
|
-
containerHeight:
|
|
1046
|
+
let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ? re({
|
|
1047
|
+
containerHeight: j.value.height,
|
|
1041
1048
|
gap: g.value
|
|
1042
1049
|
}) : 0, s = n === void 0 ? 0 : i ? o.removalDelays.get(n) ?? 0 : r ? o.entryDelays.get(n) ?? 0 : 0;
|
|
1043
1050
|
return {
|
|
@@ -1047,43 +1054,43 @@ var ke = /* @__PURE__ */ d({
|
|
|
1047
1054
|
transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
|
|
1048
1055
|
};
|
|
1049
1056
|
}
|
|
1050
|
-
function
|
|
1057
|
+
function R() {
|
|
1051
1058
|
let e = d.value;
|
|
1052
1059
|
if (!e) return;
|
|
1053
|
-
|
|
1060
|
+
y.value = e.scrollTop, x.value = e.clientHeight;
|
|
1054
1061
|
let t = p.value;
|
|
1055
|
-
t && (
|
|
1062
|
+
t && (C.value = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop);
|
|
1056
1063
|
}
|
|
1057
|
-
function
|
|
1064
|
+
function z(e) {
|
|
1058
1065
|
let t = e.ownerDocument.documentElement.clientWidth;
|
|
1059
|
-
m.value = e.clientWidth, g.value = Math.min(it, Math.max(rt, t * .0075)),
|
|
1066
|
+
m.value = e.clientWidth, g.value = Math.min(it, Math.max(rt, t * .0075)), R();
|
|
1060
1067
|
}
|
|
1061
|
-
function
|
|
1068
|
+
function B(e) {
|
|
1062
1069
|
let t = e.currentTarget;
|
|
1063
|
-
t && (
|
|
1070
|
+
t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll && K(t) && l("loadMore"));
|
|
1064
1071
|
}
|
|
1065
|
-
function
|
|
1072
|
+
function V() {
|
|
1066
1073
|
let e = d.value;
|
|
1067
|
-
!o.loadMoreLocked && e &&
|
|
1074
|
+
!o.loadMoreLocked && e && K(e) && l("loadMore");
|
|
1068
1075
|
}
|
|
1069
|
-
function
|
|
1076
|
+
function H() {
|
|
1070
1077
|
return d.value;
|
|
1071
1078
|
}
|
|
1072
|
-
return
|
|
1073
|
-
|
|
1079
|
+
return O(p, (e) => {
|
|
1080
|
+
T?.disconnect(), T = null, A !== null && cancelAnimationFrame(A), e && (z(e), !(typeof ResizeObserver > "u") && (T = new ResizeObserver(([t]) => {
|
|
1074
1081
|
let n = t?.contentRect.width ?? e.clientWidth;
|
|
1075
|
-
Math.abs(n - m.value) < .5 || (
|
|
1076
|
-
|
|
1082
|
+
Math.abs(n - m.value) < .5 || (A = requestAnimationFrame(() => {
|
|
1083
|
+
A = null, z(e);
|
|
1077
1084
|
}));
|
|
1078
|
-
}),
|
|
1079
|
-
}),
|
|
1080
|
-
|
|
1081
|
-
}),
|
|
1082
|
-
|
|
1085
|
+
}), T.observe(e)));
|
|
1086
|
+
}), O(d, (e) => {
|
|
1087
|
+
k?.disconnect(), k = null, e && (R(), !(typeof ResizeObserver > "u") && (k = new ResizeObserver(R), k.observe(e)));
|
|
1088
|
+
}), v(() => {
|
|
1089
|
+
T?.disconnect(), k?.disconnect(), A !== null && cancelAnimationFrame(A);
|
|
1083
1090
|
}), n({
|
|
1084
|
-
getScrollElement:
|
|
1085
|
-
loadIfNearBottom:
|
|
1086
|
-
}), (n, r) => (
|
|
1091
|
+
getScrollElement: H,
|
|
1092
|
+
loadIfNearBottom: V
|
|
1093
|
+
}), (n, r) => (b(), s("div", et, [c("main", {
|
|
1087
1094
|
id: f,
|
|
1088
1095
|
ref_key: "galleryElement",
|
|
1089
1096
|
ref: d,
|
|
@@ -1091,14 +1098,14 @@ var ke = /* @__PURE__ */ d({
|
|
|
1091
1098
|
"data-layout-mode": "masonry",
|
|
1092
1099
|
"aria-hidden": t.suspended || void 0,
|
|
1093
1100
|
inert: t.suspended || void 0,
|
|
1094
|
-
onScrollPassive:
|
|
1101
|
+
onScrollPassive: B
|
|
1095
1102
|
}, [c("section", {
|
|
1096
1103
|
ref_key: "masonryElement",
|
|
1097
1104
|
ref: p,
|
|
1098
1105
|
class: h(["masonry", { "masonry--ready": m.value > 0 }]),
|
|
1099
|
-
style: _(
|
|
1106
|
+
style: _(N.value),
|
|
1100
1107
|
"aria-label": "Media gallery"
|
|
1101
|
-
}, [(
|
|
1108
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a($e, {
|
|
1102
1109
|
key: n.postId,
|
|
1103
1110
|
class: "masonry-item",
|
|
1104
1111
|
entering: t.enteringPostIds.has(n.postId),
|
|
@@ -1109,12 +1116,12 @@ var ke = /* @__PURE__ */ d({
|
|
|
1109
1116
|
"media-card": t.mediaCard,
|
|
1110
1117
|
index: r,
|
|
1111
1118
|
item: n,
|
|
1112
|
-
"item-style":
|
|
1119
|
+
"item-style": L(r),
|
|
1113
1120
|
interactive: "",
|
|
1114
1121
|
layout: "masonry",
|
|
1115
1122
|
"loaded-count": t.items.length,
|
|
1116
1123
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
1117
|
-
"preview-state": t.previewStates.get(
|
|
1124
|
+
"preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1118
1125
|
total: t.total,
|
|
1119
1126
|
onActivate: (e) => l("activate", n.postId, e),
|
|
1120
1127
|
onMediaChange: (e) => l("mediaChange", n.postId, e),
|
|
@@ -1138,7 +1145,7 @@ var ke = /* @__PURE__ */ d({
|
|
|
1138
1145
|
"onMediaChange",
|
|
1139
1146
|
"onReady",
|
|
1140
1147
|
"onError"
|
|
1141
|
-
]))), 128))], 6), u(
|
|
1148
|
+
]))), 128))], 6), u(U, {
|
|
1142
1149
|
actions: t.feedFooterActions,
|
|
1143
1150
|
"can-retry-end": t.canRetryEnd,
|
|
1144
1151
|
"feed-footer": t.feedFooter,
|
|
@@ -1146,6 +1153,7 @@ var ke = /* @__PURE__ */ d({
|
|
|
1146
1153
|
"has-next": t.hasNext,
|
|
1147
1154
|
"is-loading": t.isLoadingMore,
|
|
1148
1155
|
"load-more-locked": t.loadMoreLocked,
|
|
1156
|
+
"show-load-more": P.value,
|
|
1149
1157
|
state: t.state,
|
|
1150
1158
|
onLoadMore: r[0] ||= (e) => l("loadMore"),
|
|
1151
1159
|
onRetryEnd: r[1] ||= (e) => l("retryEnd")
|
|
@@ -1157,9 +1165,10 @@ var ke = /* @__PURE__ */ d({
|
|
|
1157
1165
|
"has-next",
|
|
1158
1166
|
"is-loading",
|
|
1159
1167
|
"load-more-locked",
|
|
1168
|
+
"show-load-more",
|
|
1160
1169
|
"state"
|
|
1161
|
-
])], 42, tt), u(
|
|
1162
|
-
"content-size":
|
|
1170
|
+
])], 42, tt), u(X, {
|
|
1171
|
+
"content-size": M.value.height,
|
|
1163
1172
|
"controls-id": f,
|
|
1164
1173
|
"scroll-element": d.value,
|
|
1165
1174
|
suspended: t.suspended
|
|
@@ -1199,7 +1208,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1199
1208
|
emits: ["complete"],
|
|
1200
1209
|
setup(e, { emit: t }) {
|
|
1201
1210
|
let n = e, i = t, a = r(() => ({ "--vibe-reel-auto-advance-duration": `${n.durationMs}ms` }));
|
|
1202
|
-
return (t, n) => (
|
|
1211
|
+
return (t, n) => (b(), s("div", {
|
|
1203
1212
|
class: "reel-auto-advance",
|
|
1204
1213
|
"data-test": "reel-auto-advance",
|
|
1205
1214
|
role: "timer",
|
|
@@ -1247,111 +1256,111 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1247
1256
|
"retryForward"
|
|
1248
1257
|
],
|
|
1249
1258
|
setup(t, { expose: n, emit: i }) {
|
|
1250
|
-
let l = t, u = i, d =
|
|
1259
|
+
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(() => {
|
|
1251
1260
|
let e = Math.max(0, g.value - ht), t = Math.min(l.items.length - 1, g.value + ht);
|
|
1252
1261
|
return l.items.slice(e, t + 1).map((t, n) => ({
|
|
1253
1262
|
fetchPriority: e + n === g.value ? "high" : "low",
|
|
1254
1263
|
index: e + n,
|
|
1255
1264
|
item: t
|
|
1256
1265
|
}));
|
|
1257
|
-
}),
|
|
1258
|
-
let e =
|
|
1266
|
+
}), L = r(() => l.items[g.value]?.postId), R = r(() => l.items[g.value]), z = r(() => {
|
|
1267
|
+
let e = L.value;
|
|
1259
1268
|
return e === void 0 ? 0 : l.mediaIndices.get(e) ?? 0;
|
|
1260
|
-
}), z = r(() => {
|
|
1261
|
-
let e = I.value;
|
|
1262
|
-
return e === void 0 ? "loading" : l.previewStates.get(P(e, R.value)) ?? "loading";
|
|
1263
1269
|
}), B = r(() => {
|
|
1264
1270
|
let e = L.value;
|
|
1271
|
+
return e === void 0 ? "loading" : l.previewStates.get(F(e, z.value)) ?? "loading";
|
|
1272
|
+
}), V = r(() => {
|
|
1273
|
+
let e = R.value;
|
|
1265
1274
|
if (!e) return "";
|
|
1266
|
-
let t =
|
|
1275
|
+
let t = P(e, z.value);
|
|
1267
1276
|
return l.mediaSource === "original" ? t.src : t.preview.src;
|
|
1268
|
-
}),
|
|
1269
|
-
|
|
1270
|
-
|
|
1277
|
+
}), H = r(() => B.value === "ready" && Oe(V.value)), W = r(() => [
|
|
1278
|
+
L.value,
|
|
1279
|
+
z.value,
|
|
1271
1280
|
l.items.length,
|
|
1272
1281
|
l.loadMoreLocked,
|
|
1273
1282
|
l.reelAutoAdvance.enabled,
|
|
1274
1283
|
l.reelAutoAdvance.includePostItems,
|
|
1275
1284
|
l.reelAutoAdvance.intervalMs
|
|
1276
|
-
].join(":")),
|
|
1277
|
-
let e =
|
|
1285
|
+
].join(":")), G = r(() => {
|
|
1286
|
+
let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
|
|
1278
1287
|
return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
|
|
1279
|
-
}),
|
|
1288
|
+
}), ee = 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.");
|
|
1280
1289
|
function re(e) {
|
|
1281
1290
|
return { gridRow: `${e + 1}` };
|
|
1282
1291
|
}
|
|
1283
1292
|
function ie(e) {
|
|
1284
|
-
let t =
|
|
1293
|
+
let t = D || e.clientHeight;
|
|
1285
1294
|
return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
|
|
1286
1295
|
}
|
|
1287
|
-
function
|
|
1296
|
+
function ae(e) {
|
|
1288
1297
|
let t = e.currentTarget;
|
|
1289
1298
|
if (!t) return;
|
|
1290
|
-
let n =
|
|
1291
|
-
|
|
1299
|
+
let n = D || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
|
|
1300
|
+
x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = ie(t)), !l.loadMoreLocked && l.infiniteScroll && K(t) && u("loadMore");
|
|
1292
1301
|
}
|
|
1293
1302
|
function q() {
|
|
1294
1303
|
let e = d.value;
|
|
1295
|
-
e && (
|
|
1296
|
-
e.scrollTop = g.value * e.clientHeight,
|
|
1297
|
-
}),
|
|
1304
|
+
e && (x.value = !1, se(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
|
|
1305
|
+
e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
|
|
1306
|
+
}), oe());
|
|
1298
1307
|
}
|
|
1299
|
-
function
|
|
1300
|
-
|
|
1301
|
-
|
|
1308
|
+
function oe() {
|
|
1309
|
+
j !== null && clearTimeout(j), j = setTimeout(() => {
|
|
1310
|
+
j = null;
|
|
1302
1311
|
let e = d.value;
|
|
1303
|
-
e && (
|
|
1312
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), se(!1);
|
|
1304
1313
|
}, 120);
|
|
1305
1314
|
}
|
|
1306
1315
|
function J() {
|
|
1307
|
-
|
|
1316
|
+
se(!0);
|
|
1308
1317
|
let e = d.value;
|
|
1309
|
-
e && (
|
|
1318
|
+
e && (D = e.clientHeight, e.scrollTop = g.value * D), oe();
|
|
1310
1319
|
}
|
|
1311
|
-
function
|
|
1312
|
-
|
|
1320
|
+
function se(e) {
|
|
1321
|
+
C.value = e, d.value?.toggleAttribute("data-resizing", e);
|
|
1313
1322
|
}
|
|
1314
|
-
function
|
|
1323
|
+
function ce() {
|
|
1315
1324
|
let e = d.value;
|
|
1316
|
-
!l.loadMoreLocked && e &&
|
|
1325
|
+
!l.loadMoreLocked && e && K(e) && u("loadMore");
|
|
1317
1326
|
}
|
|
1318
|
-
function
|
|
1319
|
-
let t =
|
|
1327
|
+
function Y(e) {
|
|
1328
|
+
let t = R.value;
|
|
1320
1329
|
if (!t) return !1;
|
|
1321
|
-
let n =
|
|
1330
|
+
let n = M(t).length;
|
|
1322
1331
|
if (n <= 1) return !1;
|
|
1323
|
-
let r = (
|
|
1332
|
+
let r = (z.value + e + n) % n;
|
|
1324
1333
|
return u("mediaChange", t.postId, r), !0;
|
|
1325
1334
|
}
|
|
1326
|
-
function
|
|
1335
|
+
function le(e) {
|
|
1327
1336
|
let t = g.value + e;
|
|
1328
|
-
return !d.value || t < 0 || t >= l.items.length ? !1 : (
|
|
1337
|
+
return !d.value || t < 0 || t >= l.items.length ? !1 : (ue(t), !0);
|
|
1329
1338
|
}
|
|
1330
|
-
function
|
|
1339
|
+
function X() {
|
|
1331
1340
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1332
1341
|
}
|
|
1333
|
-
function
|
|
1342
|
+
function Z(e) {
|
|
1334
1343
|
let t = d.value;
|
|
1335
1344
|
if (!t) return Promise.resolve();
|
|
1336
|
-
let n = e * (
|
|
1337
|
-
return g.value = e, lt(t, n,
|
|
1345
|
+
let n = e * (D || t.clientHeight);
|
|
1346
|
+
return g.value = e, lt(t, n, X());
|
|
1338
1347
|
}
|
|
1339
|
-
function
|
|
1340
|
-
|
|
1348
|
+
function ue(e) {
|
|
1349
|
+
Z(e);
|
|
1341
1350
|
}
|
|
1342
|
-
async function
|
|
1351
|
+
async function de(e) {
|
|
1343
1352
|
let t = l.items.findIndex((t) => t.postId === e);
|
|
1344
|
-
return t < 0 || t === g.value ? !1 : (await
|
|
1353
|
+
return t < 0 || t === g.value ? !1 : (await Z(t), !0);
|
|
1345
1354
|
}
|
|
1346
|
-
async function
|
|
1347
|
-
return
|
|
1355
|
+
async function fe(e) {
|
|
1356
|
+
return Y(e) ? (X() || await new Promise((e) => setTimeout(e, gt)), !0) : !1;
|
|
1348
1357
|
}
|
|
1349
|
-
function
|
|
1358
|
+
function pe() {
|
|
1350
1359
|
if (!l.reelAutoAdvance.enabled) return;
|
|
1351
|
-
let e =
|
|
1360
|
+
let e = R.value;
|
|
1352
1361
|
if (!e) return;
|
|
1353
|
-
if (l.reelAutoAdvance.includePostItems &&
|
|
1354
|
-
u("mediaChange", e.postId,
|
|
1362
|
+
if (l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1) {
|
|
1363
|
+
u("mediaChange", e.postId, z.value + 1);
|
|
1355
1364
|
return;
|
|
1356
1365
|
}
|
|
1357
1366
|
let t = g.value + 1, n = l.items[t];
|
|
@@ -1359,44 +1368,44 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1359
1368
|
l.hasNext && !l.loadMoreLocked && u("loadMore");
|
|
1360
1369
|
return;
|
|
1361
1370
|
}
|
|
1362
|
-
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0),
|
|
1371
|
+
l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), ue(t);
|
|
1363
1372
|
}
|
|
1364
|
-
function
|
|
1365
|
-
!l.reelAutoAdvance.enabled || e !==
|
|
1373
|
+
function me(e, t) {
|
|
1374
|
+
!l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || pe();
|
|
1366
1375
|
}
|
|
1367
|
-
return
|
|
1368
|
-
|
|
1369
|
-
}),
|
|
1376
|
+
return O(d, (e) => {
|
|
1377
|
+
k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(q), k.observe(e)));
|
|
1378
|
+
}), O(() => l.items.length, async (e) => {
|
|
1370
1379
|
let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
|
|
1371
1380
|
g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), q();
|
|
1372
|
-
}),
|
|
1381
|
+
}), O(L, (e) => {
|
|
1373
1382
|
e !== void 0 && u("activeChange", e);
|
|
1374
|
-
}, { immediate: !0 }),
|
|
1383
|
+
}, { immediate: !0 }), y(() => {
|
|
1375
1384
|
window.addEventListener("resize", J), window.addEventListener("orientationchange", J), p >= 0 && m(q);
|
|
1376
|
-
}),
|
|
1377
|
-
window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J),
|
|
1385
|
+
}), v(() => {
|
|
1386
|
+
window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
|
|
1378
1387
|
}), n({
|
|
1379
1388
|
activeIndex: g,
|
|
1380
|
-
activePostId:
|
|
1381
|
-
changeActiveMedia:
|
|
1382
|
-
loadIfNearBottom:
|
|
1383
|
-
moveActivePost:
|
|
1384
|
-
transitionActiveMedia:
|
|
1385
|
-
transitionActivePost:
|
|
1386
|
-
}), (n, r) => (
|
|
1389
|
+
activePostId: L,
|
|
1390
|
+
changeActiveMedia: Y,
|
|
1391
|
+
loadIfNearBottom: ce,
|
|
1392
|
+
moveActivePost: le,
|
|
1393
|
+
transitionActiveMedia: fe,
|
|
1394
|
+
transitionActivePost: de
|
|
1395
|
+
}), (n, r) => (b(), s("main", {
|
|
1387
1396
|
class: h(["reel-shell", {
|
|
1388
1397
|
"reel-shell--has-footer": !!t.cardFooter,
|
|
1389
1398
|
"reel-shell--has-header": !!t.cardHeader
|
|
1390
1399
|
}]),
|
|
1391
1400
|
"data-layout-mode": "reel"
|
|
1392
1401
|
}, [
|
|
1393
|
-
t.cardHeader &&
|
|
1402
|
+
t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(ke, {
|
|
1394
1403
|
key: 0,
|
|
1395
1404
|
index: g.value,
|
|
1396
|
-
item:
|
|
1405
|
+
item: R.value,
|
|
1397
1406
|
layout: "reel",
|
|
1398
1407
|
"loaded-count": t.items.length,
|
|
1399
|
-
"media-index":
|
|
1408
|
+
"media-index": z.value,
|
|
1400
1409
|
"media-source": t.mediaSource,
|
|
1401
1410
|
placement: "header",
|
|
1402
1411
|
region: t.cardHeader,
|
|
@@ -1416,17 +1425,17 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1416
1425
|
ref_key: "galleryElement",
|
|
1417
1426
|
ref: d,
|
|
1418
1427
|
class: "gallery-shell reel-feed",
|
|
1419
|
-
"data-active-post-id":
|
|
1420
|
-
"data-active-media-index":
|
|
1421
|
-
onScrollPassive:
|
|
1422
|
-
}, [t.reelForward.status === "idle" ? (
|
|
1428
|
+
"data-active-post-id": L.value,
|
|
1429
|
+
"data-active-media-index": z.value,
|
|
1430
|
+
onScrollPassive: ae
|
|
1431
|
+
}, [t.reelForward.status === "idle" ? (b(), s("section", {
|
|
1423
1432
|
key: 1,
|
|
1424
1433
|
class: "reel-track",
|
|
1425
|
-
style: _(
|
|
1434
|
+
style: _(N.value),
|
|
1426
1435
|
"aria-label": "Media gallery"
|
|
1427
|
-
}, [(
|
|
1436
|
+
}, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a($e, {
|
|
1428
1437
|
key: n.postId,
|
|
1429
|
-
active: r === g.value && !
|
|
1438
|
+
active: r === g.value && !x.value,
|
|
1430
1439
|
"advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
|
|
1431
1440
|
class: "reel-item",
|
|
1432
1441
|
entering: !1,
|
|
@@ -1439,12 +1448,12 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1439
1448
|
"loaded-count": t.items.length,
|
|
1440
1449
|
"media-index": t.mediaIndices.get(n.postId) ?? 0,
|
|
1441
1450
|
"media-source": t.mediaSource,
|
|
1442
|
-
"preview-state": t.previewStates.get(
|
|
1451
|
+
"preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
|
|
1443
1452
|
"reel-controls-target": f.value,
|
|
1444
1453
|
"stationary-reel-controls": "",
|
|
1445
1454
|
total: t.total,
|
|
1446
1455
|
onMediaChange: (e) => u("mediaChange", n.postId, e),
|
|
1447
|
-
onEnded: (e) =>
|
|
1456
|
+
onEnded: (e) => me(n.postId, e),
|
|
1448
1457
|
onReady: (e) => u("ready", n.postId, e),
|
|
1449
1458
|
onError: (e) => u("error", n.postId, e)
|
|
1450
1459
|
}, null, 8, [
|
|
@@ -1465,17 +1474,17 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1465
1474
|
"onEnded",
|
|
1466
1475
|
"onReady",
|
|
1467
1476
|
"onError"
|
|
1468
|
-
]))), 128))], 4)) : (
|
|
1477
|
+
]))), 128))], 4)) : (b(), s("div", {
|
|
1469
1478
|
key: 0,
|
|
1470
1479
|
class: "reel-forward-status",
|
|
1471
1480
|
role: t.reelForward.status === "error" ? "alert" : "status",
|
|
1472
1481
|
"data-status": t.reelForward.status
|
|
1473
|
-
}, [c("p", null,
|
|
1482
|
+
}, [c("p", null, T(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
|
|
1474
1483
|
key: 0,
|
|
1475
1484
|
class: "reel-forward-retry",
|
|
1476
1485
|
type: "button",
|
|
1477
1486
|
onClick: r[0] ||= (e) => u("retryForward")
|
|
1478
|
-
}, " Retry ")) : o("", !0)], 8, mt)), t.reelForward.status === "idle" ? (
|
|
1487
|
+
}, " Retry ")) : o("", !0)], 8, mt)), t.reelForward.status === "idle" ? (b(), a(U, {
|
|
1479
1488
|
key: 2,
|
|
1480
1489
|
actions: t.feedFooterActions,
|
|
1481
1490
|
"can-retry-end": t.canRetryEnd,
|
|
@@ -1484,6 +1493,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1484
1493
|
"has-next": t.hasNext,
|
|
1485
1494
|
"is-loading": t.isLoadingMore,
|
|
1486
1495
|
"load-more-locked": t.loadMoreLocked,
|
|
1496
|
+
"show-load-more": te.value,
|
|
1487
1497
|
state: t.state,
|
|
1488
1498
|
onLoadMore: r[1] ||= (e) => u("loadMore"),
|
|
1489
1499
|
onRetryEnd: r[2] ||= (e) => u("retryEnd")
|
|
@@ -1495,6 +1505,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1495
1505
|
"has-next",
|
|
1496
1506
|
"is-loading",
|
|
1497
1507
|
"load-more-locked",
|
|
1508
|
+
"show-load-more",
|
|
1498
1509
|
"state"
|
|
1499
1510
|
])) : o("", !0)], 40, pt), c("div", {
|
|
1500
1511
|
ref_key: "reelControlsElement",
|
|
@@ -1502,13 +1513,13 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1502
1513
|
class: "reel-media-controls-host",
|
|
1503
1514
|
"data-test": "reel-media-controls-host"
|
|
1504
1515
|
}, null, 512)]),
|
|
1505
|
-
t.cardFooter &&
|
|
1516
|
+
t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(ke, {
|
|
1506
1517
|
key: 1,
|
|
1507
1518
|
index: g.value,
|
|
1508
|
-
item:
|
|
1519
|
+
item: R.value,
|
|
1509
1520
|
layout: "reel",
|
|
1510
1521
|
"loaded-count": t.items.length,
|
|
1511
|
-
"media-index":
|
|
1522
|
+
"media-index": z.value,
|
|
1512
1523
|
"media-source": t.mediaSource,
|
|
1513
1524
|
placement: "footer",
|
|
1514
1525
|
region: t.cardFooter,
|
|
@@ -1524,11 +1535,11 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1524
1535
|
"style",
|
|
1525
1536
|
"total"
|
|
1526
1537
|
])) : o("", !0),
|
|
1527
|
-
|
|
1528
|
-
key:
|
|
1538
|
+
ee.value ? (b(), a(dt, {
|
|
1539
|
+
key: W.value,
|
|
1529
1540
|
"duration-ms": t.reelAutoAdvance.intervalMs,
|
|
1530
|
-
label:
|
|
1531
|
-
onComplete:
|
|
1541
|
+
label: G.value,
|
|
1542
|
+
onComplete: pe
|
|
1532
1543
|
}, null, 8, ["duration-ms", "label"])) : o("", !0)
|
|
1533
1544
|
], 2));
|
|
1534
1545
|
}
|
|
@@ -1585,83 +1596,83 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1585
1596
|
"retryForward"
|
|
1586
1597
|
],
|
|
1587
1598
|
setup(e, { expose: t, emit: i }) {
|
|
1588
|
-
let l = e, d = i, p =
|
|
1599
|
+
let l = e, d = i, p = w(null), _ = w(null), y = null, x = r(() => {
|
|
1589
1600
|
let e = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId);
|
|
1590
1601
|
return Math.max(0, e);
|
|
1591
|
-
}),
|
|
1592
|
-
let e =
|
|
1602
|
+
}), S = r(() => l.items[x.value]), T = r(() => S.value ?? (l.reelForward.status === "idle" ? void 0 : l.forwardItem ?? void 0)), E = r(() => S.value ? x.value : l.forwardIndex ?? 0), D = r(() => {
|
|
1603
|
+
let e = T.value?.postId;
|
|
1593
1604
|
return e === void 0 ? 0 : l.mediaIndices.get(e) ?? 0;
|
|
1594
|
-
}),
|
|
1595
|
-
let e =
|
|
1605
|
+
}), A = r(() => !!(l.infoSheet && l.infoSheetEnabled && T.value)), j = r(() => {
|
|
1606
|
+
let e = T.value;
|
|
1596
1607
|
return e ? {
|
|
1597
|
-
close:
|
|
1598
|
-
index:
|
|
1608
|
+
close: N,
|
|
1609
|
+
index: E.value,
|
|
1599
1610
|
item: e,
|
|
1600
1611
|
layout: "reel",
|
|
1601
1612
|
loadedCount: l.items.length,
|
|
1602
|
-
mediaCount:
|
|
1603
|
-
mediaIndex:
|
|
1604
|
-
mediaItem:
|
|
1613
|
+
mediaCount: M(e).length,
|
|
1614
|
+
mediaIndex: D.value,
|
|
1615
|
+
mediaItem: P(e, D.value),
|
|
1605
1616
|
mediaSource: l.mediaSource ?? "preview",
|
|
1606
1617
|
origin: l.origin,
|
|
1607
1618
|
total: l.total
|
|
1608
1619
|
} : null;
|
|
1609
1620
|
});
|
|
1610
|
-
function
|
|
1621
|
+
function N() {
|
|
1611
1622
|
d("closeInfoSheet");
|
|
1612
1623
|
}
|
|
1613
|
-
function
|
|
1624
|
+
function F(e) {
|
|
1614
1625
|
return p.value?.changeActiveMedia(e) ?? !1;
|
|
1615
1626
|
}
|
|
1616
|
-
function
|
|
1627
|
+
function I() {
|
|
1617
1628
|
p.value?.loadIfNearBottom();
|
|
1618
1629
|
}
|
|
1619
|
-
function
|
|
1630
|
+
function L(e) {
|
|
1620
1631
|
return p.value?.moveActivePost(e) ?? !1;
|
|
1621
1632
|
}
|
|
1622
|
-
function
|
|
1633
|
+
function R(e) {
|
|
1623
1634
|
return p.value?.transitionActiveMedia(e) ?? Promise.resolve(!1);
|
|
1624
1635
|
}
|
|
1625
|
-
function
|
|
1636
|
+
function z(e) {
|
|
1626
1637
|
return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
|
|
1627
1638
|
}
|
|
1628
|
-
function
|
|
1639
|
+
function B(e, t) {
|
|
1629
1640
|
d("error", e, t);
|
|
1630
1641
|
}
|
|
1631
|
-
function
|
|
1642
|
+
function V(e, t) {
|
|
1632
1643
|
d("mediaChange", e, t);
|
|
1633
1644
|
}
|
|
1634
|
-
function
|
|
1645
|
+
function H(e, t) {
|
|
1635
1646
|
d("ready", e, t);
|
|
1636
1647
|
}
|
|
1637
|
-
return
|
|
1648
|
+
return O(() => ({
|
|
1638
1649
|
overlay: l.infoSheetOverlay,
|
|
1639
|
-
visible:
|
|
1650
|
+
visible: A.value
|
|
1640
1651
|
}), async (e, t) => {
|
|
1641
1652
|
if (e.visible && !t?.visible) {
|
|
1642
|
-
|
|
1653
|
+
y = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.overlay && (await m(), _.value?.focus({ preventScroll: !0 }));
|
|
1643
1654
|
return;
|
|
1644
1655
|
}
|
|
1645
|
-
if (!e.visible && t?.visible &&
|
|
1646
|
-
let e =
|
|
1647
|
-
|
|
1656
|
+
if (!e.visible && t?.visible && y?.isConnected) {
|
|
1657
|
+
let e = y;
|
|
1658
|
+
y = null, await m(), e.focus({ preventScroll: !0 });
|
|
1648
1659
|
}
|
|
1649
|
-
}),
|
|
1650
|
-
|
|
1660
|
+
}), v(() => {
|
|
1661
|
+
y = null;
|
|
1651
1662
|
}), t({
|
|
1652
|
-
changeActiveMedia:
|
|
1653
|
-
loadIfNearBottom:
|
|
1654
|
-
moveActivePost:
|
|
1655
|
-
transitionActiveMedia:
|
|
1656
|
-
transitionActivePost:
|
|
1657
|
-
}), (t, r) => (
|
|
1663
|
+
changeActiveMedia: F,
|
|
1664
|
+
loadIfNearBottom: I,
|
|
1665
|
+
moveActivePost: L,
|
|
1666
|
+
transitionActiveMedia: R,
|
|
1667
|
+
transitionActivePost: z
|
|
1668
|
+
}), (t, r) => (b(), s("section", {
|
|
1658
1669
|
class: h(["reel-layout", `reel-layout--${e.infoSheetOverlay ? "overlay" : "layout"}`]),
|
|
1659
|
-
"data-info-sheet-open":
|
|
1670
|
+
"data-info-sheet-open": A.value || void 0,
|
|
1660
1671
|
"data-info-sheet-mode": e.infoSheetOverlay ? "overlay" : "layout"
|
|
1661
1672
|
}, [c("div", {
|
|
1662
1673
|
class: "reel-layout-main",
|
|
1663
|
-
"aria-hidden": e.infoSheetOverlay &&
|
|
1664
|
-
inert: e.infoSheetOverlay &&
|
|
1674
|
+
"aria-hidden": e.infoSheetOverlay && A.value || void 0,
|
|
1675
|
+
inert: e.infoSheetOverlay && A.value || void 0
|
|
1665
1676
|
}, [u(_t, {
|
|
1666
1677
|
ref_key: "reelFeed",
|
|
1667
1678
|
ref: p,
|
|
@@ -1686,10 +1697,10 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1686
1697
|
state: e.state,
|
|
1687
1698
|
total: e.total,
|
|
1688
1699
|
onActiveChange: r[0] ||= (e) => d("activeChange", e),
|
|
1689
|
-
onError:
|
|
1700
|
+
onError: B,
|
|
1690
1701
|
onLoadMore: r[1] ||= (e) => d("loadMore"),
|
|
1691
|
-
onMediaChange:
|
|
1692
|
-
onReady:
|
|
1702
|
+
onMediaChange: V,
|
|
1703
|
+
onReady: H,
|
|
1693
1704
|
onRetryEnd: r[2] ||= (e) => d("retryEnd"),
|
|
1694
1705
|
onRetryForward: r[3] ||= (e) => d("retryForward")
|
|
1695
1706
|
}, null, 8, [
|
|
@@ -1714,7 +1725,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1714
1725
|
"state",
|
|
1715
1726
|
"total"
|
|
1716
1727
|
])], 8, yt), u(n, { name: "vibe-info-sheet" }, {
|
|
1717
|
-
default:
|
|
1728
|
+
default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", bt, [c("aside", {
|
|
1718
1729
|
ref_key: "sheetElement",
|
|
1719
1730
|
ref: _,
|
|
1720
1731
|
class: "reel-info-sheet",
|
|
@@ -1722,8 +1733,8 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1722
1733
|
"aria-label": "Reel information",
|
|
1723
1734
|
"aria-modal": e.infoSheetOverlay ? "true" : void 0,
|
|
1724
1735
|
tabindex: e.infoSheetOverlay ? -1 : void 0,
|
|
1725
|
-
"data-active-post-id":
|
|
1726
|
-
}, [(
|
|
1736
|
+
"data-active-post-id": T.value?.postId
|
|
1737
|
+
}, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, xt)])) : o("", !0)]),
|
|
1727
1738
|
_: 1
|
|
1728
1739
|
})], 10, vt));
|
|
1729
1740
|
}
|
|
@@ -1749,93 +1760,93 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1749
1760
|
"retryForward"
|
|
1750
1761
|
],
|
|
1751
1762
|
setup(t, { expose: i, emit: c }) {
|
|
1752
|
-
let l = t, d = c, f =
|
|
1753
|
-
function
|
|
1763
|
+
let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), x = w({}), S = w(!1), C = w(/* @__PURE__ */ new Set()), T = w(/* @__PURE__ */ new Map()), E = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = w(/* @__PURE__ */ new Map()), j = w(/* @__PURE__ */ new Map()), M = r(() => I(l.state)), P = r(() => l.state.reelMediaSource === "original" ? j.value : A.value), L = new Set(l.state.items.map((e) => e.postId)), R = null, z = null, B = !1;
|
|
1764
|
+
function V() {
|
|
1754
1765
|
return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1755
1766
|
}
|
|
1756
|
-
function
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1767
|
+
function H() {
|
|
1768
|
+
R !== null && cancelAnimationFrame(R), R = requestAnimationFrame(() => {
|
|
1769
|
+
R = requestAnimationFrame(() => {
|
|
1770
|
+
R = null, C.value = /* @__PURE__ */ new Set();
|
|
1760
1771
|
});
|
|
1761
1772
|
});
|
|
1762
1773
|
}
|
|
1763
|
-
function H(e, t, n) {
|
|
1764
|
-
let r = P(e, t);
|
|
1765
|
-
k.value.get(r) !== n && (k.value = new Map(k.value).set(r, n));
|
|
1766
|
-
}
|
|
1767
1774
|
function U(e, t, n) {
|
|
1768
|
-
let r =
|
|
1775
|
+
let r = F(e, t);
|
|
1769
1776
|
A.value.get(r) !== n && (A.value = new Map(A.value).set(r, n));
|
|
1770
1777
|
}
|
|
1771
|
-
function W(e, t) {
|
|
1772
|
-
|
|
1778
|
+
function W(e, t, n) {
|
|
1779
|
+
let r = F(e, t);
|
|
1780
|
+
j.value.get(r) !== n && (j.value = new Map(j.value).set(r, n));
|
|
1773
1781
|
}
|
|
1774
1782
|
function G(e, t) {
|
|
1775
|
-
H(e, t, "ready");
|
|
1776
|
-
}
|
|
1777
|
-
function ne(e, t) {
|
|
1778
1783
|
U(e, t, "error");
|
|
1779
1784
|
}
|
|
1780
|
-
function
|
|
1785
|
+
function K(e, t) {
|
|
1781
1786
|
U(e, t, "ready");
|
|
1782
1787
|
}
|
|
1783
|
-
function
|
|
1788
|
+
function te(e, t) {
|
|
1789
|
+
W(e, t, "error");
|
|
1790
|
+
}
|
|
1791
|
+
function ne(e, t) {
|
|
1792
|
+
W(e, t, "ready");
|
|
1793
|
+
}
|
|
1794
|
+
function re(e, t) {
|
|
1784
1795
|
if (l.state.reelMediaSource === "original") {
|
|
1785
|
-
|
|
1796
|
+
te(e, t);
|
|
1786
1797
|
return;
|
|
1787
1798
|
}
|
|
1788
|
-
|
|
1799
|
+
G(e, t);
|
|
1789
1800
|
}
|
|
1790
|
-
function
|
|
1801
|
+
function ie(e, t) {
|
|
1791
1802
|
if (l.state.reelMediaSource === "original") {
|
|
1792
|
-
|
|
1803
|
+
ne(e, t);
|
|
1793
1804
|
return;
|
|
1794
1805
|
}
|
|
1795
|
-
|
|
1806
|
+
K(e, t);
|
|
1796
1807
|
}
|
|
1797
|
-
function
|
|
1808
|
+
function ae(e, t) {
|
|
1798
1809
|
let n = l.state.items.find((t) => t.postId === e);
|
|
1799
1810
|
if (!n) return;
|
|
1800
|
-
let r =
|
|
1811
|
+
let r = N(n, t);
|
|
1801
1812
|
(l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
|
|
1802
1813
|
}
|
|
1803
|
-
async function
|
|
1814
|
+
async function q() {
|
|
1804
1815
|
await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
|
|
1805
1816
|
}
|
|
1806
|
-
function
|
|
1817
|
+
function oe(e) {
|
|
1807
1818
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
|
|
1808
1819
|
}
|
|
1809
|
-
function
|
|
1820
|
+
function J(e) {
|
|
1810
1821
|
return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
|
|
1811
1822
|
}
|
|
1812
|
-
function
|
|
1823
|
+
function se() {
|
|
1813
1824
|
return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
|
|
1814
1825
|
}
|
|
1815
|
-
function
|
|
1816
|
-
|
|
1826
|
+
function ce(e, t) {
|
|
1827
|
+
z = e, B = t === "keyboard", x.value = Z(e), d("openReel", e), m(() => h.value?.focus());
|
|
1817
1828
|
}
|
|
1818
|
-
function
|
|
1829
|
+
function Y(e) {
|
|
1819
1830
|
let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
|
|
1820
1831
|
return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
|
|
1821
1832
|
}
|
|
1822
|
-
function
|
|
1823
|
-
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null ||
|
|
1824
|
-
let t = [...new Set(e)], n = t.filter(
|
|
1833
|
+
function le(e) {
|
|
1834
|
+
if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || V()) return 0;
|
|
1835
|
+
let t = [...new Set(e)], n = t.filter(Y);
|
|
1825
1836
|
if (n.length === 0) return 0;
|
|
1826
|
-
let r = new Map(
|
|
1837
|
+
let r = new Map(D.value);
|
|
1827
1838
|
return n.forEach((e, t) => {
|
|
1828
1839
|
r.set(e, t * Ct);
|
|
1829
|
-
}),
|
|
1840
|
+
}), C.value = new Set([...C.value].filter((e) => !n.includes(e))), E.value = new Set([...E.value, ...t]), D.value = r, wt + (n.length - 1) * Ct;
|
|
1830
1841
|
}
|
|
1831
|
-
function
|
|
1832
|
-
let n =
|
|
1842
|
+
function X(e, t) {
|
|
1843
|
+
let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
|
|
1833
1844
|
r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
|
|
1834
1845
|
r.classList.remove("media-card-focus-silent");
|
|
1835
1846
|
}, { once: !0 }), r?.focus({ preventScroll: !0 }));
|
|
1836
1847
|
}
|
|
1837
1848
|
function Z(e) {
|
|
1838
|
-
let t = g.value, n =
|
|
1849
|
+
let t = g.value, n = Y(e);
|
|
1839
1850
|
if (t === null || n === null) return {};
|
|
1840
1851
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
1841
1852
|
return {
|
|
@@ -1846,12 +1857,12 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1846
1857
|
};
|
|
1847
1858
|
}
|
|
1848
1859
|
function ue() {
|
|
1849
|
-
l.state.reelOrigin === "masonry" && (
|
|
1860
|
+
l.state.reelOrigin === "masonry" && (z ??= l.state.activeReelPostId, S.value = !0, d("closeReel"));
|
|
1850
1861
|
}
|
|
1851
1862
|
function de() {
|
|
1852
|
-
let e =
|
|
1853
|
-
|
|
1854
|
-
e !== null &&
|
|
1863
|
+
let e = z, t = B;
|
|
1864
|
+
S.value = !1, z = null, B = !1, x.value = {}, m(() => {
|
|
1865
|
+
e !== null && X(e, t);
|
|
1855
1866
|
});
|
|
1856
1867
|
}
|
|
1857
1868
|
function fe(e) {
|
|
@@ -1864,7 +1875,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1864
1875
|
e.preventDefault(), d("reelInfoSheetChange", !1);
|
|
1865
1876
|
return;
|
|
1866
1877
|
}
|
|
1867
|
-
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey ||
|
|
1878
|
+
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || S.value || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry") return;
|
|
1868
1879
|
let n = e.target;
|
|
1869
1880
|
if (n instanceof HTMLElement && (n.isContentEditable || [
|
|
1870
1881
|
"INPUT",
|
|
@@ -1874,31 +1885,31 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1874
1885
|
let r = e.key === "ArrowLeft" ? -1 : e.key === "ArrowRight" ? 1 : 0;
|
|
1875
1886
|
r !== 0 && p.value?.changeActiveMedia?.(r) && e.preventDefault();
|
|
1876
1887
|
}
|
|
1877
|
-
return
|
|
1878
|
-
let t = e.filter((e) => !
|
|
1879
|
-
if (
|
|
1888
|
+
return O(() => l.state.items.map((e) => e.postId), (e) => {
|
|
1889
|
+
let t = e.filter((e) => !L.has(e)), n = new Set(e);
|
|
1890
|
+
if (L = new Set(e), E.value = new Set([...E.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || V()) return;
|
|
1880
1891
|
let r = /* @__PURE__ */ new Map();
|
|
1881
1892
|
e.forEach((e) => {
|
|
1882
|
-
let t =
|
|
1893
|
+
let t = T.value.get(e);
|
|
1883
1894
|
t !== void 0 && r.set(e, t);
|
|
1884
1895
|
}), t.forEach((e, t) => {
|
|
1885
1896
|
r.set(e, t * Ct);
|
|
1886
|
-
}),
|
|
1887
|
-
}, { flush: "sync" }),
|
|
1888
|
-
window.removeEventListener("keydown", fe),
|
|
1897
|
+
}), T.value = r, C.value = new Set([...C.value, ...t]), H();
|
|
1898
|
+
}, { flush: "sync" }), y(() => window.addEventListener("keydown", fe)), v(() => {
|
|
1899
|
+
window.removeEventListener("keydown", fe), R !== null && cancelAnimationFrame(R);
|
|
1889
1900
|
}), i({
|
|
1890
|
-
changeActiveReelMedia:
|
|
1891
|
-
getAutoScrollElement:
|
|
1892
|
-
loadIfNearBottom:
|
|
1893
|
-
moveActiveReelPost:
|
|
1894
|
-
startItemRemoval:
|
|
1901
|
+
changeActiveReelMedia: oe,
|
|
1902
|
+
getAutoScrollElement: se,
|
|
1903
|
+
loadIfNearBottom: q,
|
|
1904
|
+
moveActiveReelPost: J,
|
|
1905
|
+
startItemRemoval: le,
|
|
1895
1906
|
transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
|
|
1896
1907
|
transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
|
|
1897
|
-
}), (r, i) => (
|
|
1908
|
+
}), (r, i) => (b(), s("div", {
|
|
1898
1909
|
ref_key: "surfaceElement",
|
|
1899
1910
|
ref: g,
|
|
1900
1911
|
class: "vibe-surface"
|
|
1901
|
-
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (
|
|
1912
|
+
}, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(St, {
|
|
1902
1913
|
key: 0,
|
|
1903
1914
|
ref_key: "reelRenderer",
|
|
1904
1915
|
ref: p,
|
|
@@ -1923,17 +1934,17 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1923
1934
|
"info-sheet-overlay": t.state.reelInfoSheetOverlay,
|
|
1924
1935
|
"next-page-error": !!t.state.nextPageError,
|
|
1925
1936
|
origin: "reel",
|
|
1926
|
-
"preview-states":
|
|
1937
|
+
"preview-states": P.value,
|
|
1927
1938
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
1928
1939
|
"reel-forward": t.state.reelForward,
|
|
1929
|
-
state:
|
|
1940
|
+
state: M.value,
|
|
1930
1941
|
total: t.state.total,
|
|
1931
1942
|
onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
|
|
1932
1943
|
onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
|
|
1933
|
-
onError:
|
|
1944
|
+
onError: re,
|
|
1934
1945
|
onLoadMore: i[2] ||= (e) => d("loadMore"),
|
|
1935
|
-
onMediaChange:
|
|
1936
|
-
onReady:
|
|
1946
|
+
onMediaChange: ae,
|
|
1947
|
+
onReady: ie,
|
|
1937
1948
|
onRetryEnd: i[3] ||= (e) => d("retryEnd"),
|
|
1938
1949
|
onRetryForward: i[4] ||= (e) => d("retryForward")
|
|
1939
1950
|
}, null, 8, [
|
|
@@ -1962,12 +1973,12 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1962
1973
|
"reel-forward",
|
|
1963
1974
|
"state",
|
|
1964
1975
|
"total"
|
|
1965
|
-
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (
|
|
1976
|
+
])) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(ee, {
|
|
1966
1977
|
key: 1,
|
|
1967
1978
|
actions: t.feedFooterActions,
|
|
1968
1979
|
"can-retry-end": t.canRetryEnd,
|
|
1969
1980
|
"feed-footer": t.feedFooter,
|
|
1970
|
-
state:
|
|
1981
|
+
state: M.value,
|
|
1971
1982
|
onLoadMore: i[5] ||= (e) => d("loadMore"),
|
|
1972
1983
|
onRetryEnd: i[6] ||= (e) => d("retryEnd")
|
|
1973
1984
|
}, null, 8, [
|
|
@@ -1975,14 +1986,14 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1975
1986
|
"can-retry-end",
|
|
1976
1987
|
"feed-footer",
|
|
1977
1988
|
"state"
|
|
1978
|
-
])) : (
|
|
1989
|
+
])) : (b(), s(e, { key: 2 }, [u(st, {
|
|
1979
1990
|
ref_key: "masonryRenderer",
|
|
1980
1991
|
ref: f,
|
|
1981
1992
|
"can-retry-end": t.canRetryEnd,
|
|
1982
|
-
"entering-post-ids":
|
|
1983
|
-
"entry-delays":
|
|
1984
|
-
"leaving-post-ids":
|
|
1985
|
-
"removal-delays":
|
|
1993
|
+
"entering-post-ids": C.value,
|
|
1994
|
+
"entry-delays": T.value,
|
|
1995
|
+
"leaving-post-ids": E.value,
|
|
1996
|
+
"removal-delays": D.value,
|
|
1986
1997
|
"card-footer": t.cardFooter,
|
|
1987
1998
|
"card-header": t.cardHeader,
|
|
1988
1999
|
"feed-footer": t.feedFooter,
|
|
@@ -1995,15 +2006,15 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
1995
2006
|
"load-more-locked": t.state.loadMoreLocked,
|
|
1996
2007
|
"media-indices": t.state.mediaIndices,
|
|
1997
2008
|
"next-page-error": !!t.state.nextPageError,
|
|
1998
|
-
"preview-states":
|
|
1999
|
-
suspended: t.state.reelOrigin === "masonry" ||
|
|
2000
|
-
state:
|
|
2009
|
+
"preview-states": A.value,
|
|
2010
|
+
suspended: t.state.reelOrigin === "masonry" || S.value,
|
|
2011
|
+
state: M.value,
|
|
2001
2012
|
total: t.state.total,
|
|
2002
|
-
onActivate:
|
|
2003
|
-
onError:
|
|
2013
|
+
onActivate: ce,
|
|
2014
|
+
onError: G,
|
|
2004
2015
|
onLoadMore: i[7] ||= (e) => d("loadMore"),
|
|
2005
|
-
onMediaChange:
|
|
2006
|
-
onReady:
|
|
2016
|
+
onMediaChange: ae,
|
|
2017
|
+
onReady: K,
|
|
2007
2018
|
onRetryEnd: i[8] ||= (e) => d("retryEnd")
|
|
2008
2019
|
}, null, 8, [
|
|
2009
2020
|
"can-retry-end",
|
|
@@ -2031,7 +2042,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
2031
2042
|
name: "vibe-reel-viewer",
|
|
2032
2043
|
onAfterLeave: de
|
|
2033
2044
|
}, {
|
|
2034
|
-
default:
|
|
2045
|
+
default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
|
|
2035
2046
|
key: 0,
|
|
2036
2047
|
ref_key: "reelOverlay",
|
|
2037
2048
|
ref: h,
|
|
@@ -2040,7 +2051,7 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
2040
2051
|
"aria-label": "Media viewer",
|
|
2041
2052
|
"aria-modal": "true",
|
|
2042
2053
|
tabindex: "-1",
|
|
2043
|
-
style: _(
|
|
2054
|
+
style: _(x.value)
|
|
2044
2055
|
}, [u(St, {
|
|
2045
2056
|
ref_key: "reelRenderer",
|
|
2046
2057
|
ref: p,
|
|
@@ -2065,17 +2076,17 @@ var ut = ["aria-label"], dt = /* @__PURE__ */ d({
|
|
|
2065
2076
|
"media-source": "original",
|
|
2066
2077
|
"next-page-error": !!t.state.nextPageError,
|
|
2067
2078
|
origin: "masonry",
|
|
2068
|
-
"preview-states":
|
|
2079
|
+
"preview-states": j.value,
|
|
2069
2080
|
"reel-auto-advance": t.state.reelAutoAdvance,
|
|
2070
2081
|
"reel-forward": t.state.reelForward,
|
|
2071
|
-
state:
|
|
2082
|
+
state: M.value,
|
|
2072
2083
|
total: t.state.total,
|
|
2073
2084
|
onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
|
|
2074
2085
|
onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
|
|
2075
|
-
onError:
|
|
2086
|
+
onError: te,
|
|
2076
2087
|
onLoadMore: i[11] ||= (e) => d("loadMore"),
|
|
2077
|
-
onMediaChange:
|
|
2078
|
-
onReady:
|
|
2088
|
+
onMediaChange: ae,
|
|
2089
|
+
onReady: ne,
|
|
2079
2090
|
onRetryEnd: i[12] ||= (e) => d("retryEnd"),
|
|
2080
2091
|
onRetryForward: i[13] ||= (e) => d("retryForward")
|
|
2081
2092
|
}, null, 8, [
|
|
@@ -2273,80 +2284,131 @@ async function Ht(e, t, n) {
|
|
|
2273
2284
|
function Ut(e, t, n) {
|
|
2274
2285
|
return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
|
|
2275
2286
|
}
|
|
2276
|
-
async function Wt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r,
|
|
2277
|
-
let
|
|
2278
|
-
for (;
|
|
2279
|
-
let e = Lt(
|
|
2280
|
-
if (
|
|
2281
|
-
|
|
2282
|
-
delayMs: Nt(
|
|
2283
|
-
onChange:
|
|
2284
|
-
signal:
|
|
2287
|
+
async function Wt({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, signal: u }) {
|
|
2288
|
+
let d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = r ?? It(s), h = t, g = t, _ = 0, v;
|
|
2289
|
+
for (; _ < m;) {
|
|
2290
|
+
let e = Lt(h);
|
|
2291
|
+
if (p.has(e)) throw Error("Vibe autofill received a repeated cursor.");
|
|
2292
|
+
p.add(e), await Pt({
|
|
2293
|
+
delayMs: Nt(l + _, s),
|
|
2294
|
+
onChange: a,
|
|
2295
|
+
signal: u
|
|
2285
2296
|
});
|
|
2286
2297
|
let t = Et(await n({
|
|
2287
|
-
cursor:
|
|
2288
|
-
signal:
|
|
2298
|
+
cursor: h,
|
|
2299
|
+
signal: u
|
|
2289
2300
|
}));
|
|
2290
|
-
|
|
2291
|
-
let r = Q(
|
|
2292
|
-
|
|
2293
|
-
let
|
|
2294
|
-
missing: Math.max(0,
|
|
2295
|
-
next:
|
|
2296
|
-
received:
|
|
2297
|
-
requests:
|
|
2301
|
+
_ += 1;
|
|
2302
|
+
let r = Q(f, t.items).slice(f.length);
|
|
2303
|
+
f.push(...r), d.push(...r), g = t.next, t.total !== void 0 && (v = t.total);
|
|
2304
|
+
let m = {
|
|
2305
|
+
missing: Math.max(0, s.pageSize - c - d.length),
|
|
2306
|
+
next: g,
|
|
2307
|
+
received: c + d.length,
|
|
2308
|
+
requests: l + _
|
|
2298
2309
|
};
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
total:
|
|
2310
|
+
o(m);
|
|
2311
|
+
let y = {
|
|
2312
|
+
...m,
|
|
2313
|
+
items: [...d],
|
|
2314
|
+
lastCursor: h,
|
|
2315
|
+
total: v
|
|
2305
2316
|
};
|
|
2306
|
-
if (
|
|
2307
|
-
...
|
|
2308
|
-
|
|
2309
|
-
lastCursor: m,
|
|
2310
|
-
status: "exhausted",
|
|
2311
|
-
total: _
|
|
2317
|
+
if (i(y), m.missing === 0) return {
|
|
2318
|
+
...y,
|
|
2319
|
+
status: "complete"
|
|
2312
2320
|
};
|
|
2313
|
-
|
|
2321
|
+
if (g === null) return {
|
|
2322
|
+
...y,
|
|
2323
|
+
status: "exhausted"
|
|
2324
|
+
};
|
|
2325
|
+
h = g;
|
|
2314
2326
|
}
|
|
2315
2327
|
return {
|
|
2316
|
-
items:
|
|
2317
|
-
lastCursor:
|
|
2318
|
-
missing: Math.max(0,
|
|
2319
|
-
next:
|
|
2320
|
-
received:
|
|
2321
|
-
requests:
|
|
2328
|
+
items: d,
|
|
2329
|
+
lastCursor: h,
|
|
2330
|
+
missing: Math.max(0, s.pageSize - c - d.length),
|
|
2331
|
+
next: g,
|
|
2332
|
+
received: c + d.length,
|
|
2333
|
+
requests: l + _,
|
|
2322
2334
|
status: "exhausted",
|
|
2323
|
-
total:
|
|
2335
|
+
total: v
|
|
2324
2336
|
};
|
|
2325
2337
|
}
|
|
2326
|
-
|
|
2327
|
-
|
|
2338
|
+
//#endregion
|
|
2339
|
+
//#region src/core/autofillController.ts
|
|
2340
|
+
var Gt = class {
|
|
2341
|
+
collection = null;
|
|
2342
|
+
cycle = 0;
|
|
2343
|
+
delayCountdown;
|
|
2344
|
+
constructor(e) {
|
|
2345
|
+
this.context = e, this.delayCountdown = new Ft((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
|
|
2346
|
+
}
|
|
2347
|
+
beginCycle() {
|
|
2348
|
+
let { options: e, state: t } = this.context;
|
|
2349
|
+
if (!e) return "";
|
|
2350
|
+
this.clear();
|
|
2351
|
+
let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2352
|
+
return t.autofill = {
|
|
2353
|
+
...Bt(e, void 0, !1),
|
|
2354
|
+
cycleId: n,
|
|
2355
|
+
status: "filling"
|
|
2356
|
+
}, n;
|
|
2357
|
+
}
|
|
2358
|
+
async cancel() {
|
|
2359
|
+
let { cancelRequest: e, options: t, state: n } = this.context;
|
|
2360
|
+
await Ht(t, n, e), this.commitCollection();
|
|
2361
|
+
}
|
|
2362
|
+
captureCollection(e, t) {
|
|
2363
|
+
t && (this.collection = e);
|
|
2364
|
+
}
|
|
2365
|
+
clear() {
|
|
2366
|
+
this.delayCountdown.clear(), this.collection = null;
|
|
2367
|
+
}
|
|
2368
|
+
clearCountdown() {
|
|
2369
|
+
this.delayCountdown.clear();
|
|
2370
|
+
}
|
|
2371
|
+
clearCollection() {
|
|
2372
|
+
this.collection = null;
|
|
2373
|
+
}
|
|
2374
|
+
syncCountdown() {
|
|
2375
|
+
let { autofill: e } = this.context.state;
|
|
2376
|
+
this.delayCountdown.sync(e.strategy === "backend" && e.status === "waiting" ? e.nextRequestAt : null);
|
|
2377
|
+
}
|
|
2378
|
+
commitCollection() {
|
|
2379
|
+
let { onLastCursor: e, options: t, state: n } = this.context;
|
|
2380
|
+
if (t?.strategy !== "frontend") return;
|
|
2381
|
+
let r = this.collection;
|
|
2382
|
+
this.collection = null, r && (n.items = Q(n.items, r.items), e(r.lastCursor), n.next = r.next, r.total !== void 0 && (n.total = r.total), Object.assign(n.autofill, {
|
|
2383
|
+
missing: r.missing,
|
|
2384
|
+
received: r.received,
|
|
2385
|
+
requests: r.requests
|
|
2386
|
+
}));
|
|
2387
|
+
}
|
|
2388
|
+
}, Kt = 100;
|
|
2389
|
+
function qt(e, t) {
|
|
2328
2390
|
if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
|
|
2329
2391
|
}
|
|
2330
|
-
function
|
|
2392
|
+
function Jt(e, t, n) {
|
|
2331
2393
|
return Math.min(n, Math.max(t, e));
|
|
2332
2394
|
}
|
|
2333
|
-
function
|
|
2395
|
+
function Yt(e) {
|
|
2334
2396
|
if (!e) return;
|
|
2335
2397
|
let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
|
|
2336
|
-
if (
|
|
2337
|
-
e.speedPxPerSecond !== void 0 &&
|
|
2398
|
+
if (qt("autoScroll.minSpeedPxPerSecond", t), qt("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
|
|
2399
|
+
e.speedPxPerSecond !== void 0 && qt("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
|
|
2338
2400
|
}
|
|
2339
|
-
function
|
|
2401
|
+
function Xt(e) {
|
|
2340
2402
|
let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
|
|
2341
2403
|
return {
|
|
2342
2404
|
enabled: e?.enabled ?? !1,
|
|
2343
2405
|
maxSpeedPxPerSecond: n,
|
|
2344
2406
|
minSpeedPxPerSecond: t,
|
|
2345
2407
|
paused: !1,
|
|
2346
|
-
speedPxPerSecond:
|
|
2408
|
+
speedPxPerSecond: Jt(e?.speedPxPerSecond ?? 80, t, n)
|
|
2347
2409
|
};
|
|
2348
2410
|
}
|
|
2349
|
-
var
|
|
2411
|
+
var Zt = class {
|
|
2350
2412
|
frame = null;
|
|
2351
2413
|
lastTimestamp = null;
|
|
2352
2414
|
mounted = !1;
|
|
@@ -2366,9 +2428,9 @@ var Xt = class {
|
|
|
2366
2428
|
this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
|
|
2367
2429
|
}
|
|
2368
2430
|
setSpeed(e) {
|
|
2369
|
-
|
|
2431
|
+
qt("auto-scroll speed", e);
|
|
2370
2432
|
let t = this.options.state;
|
|
2371
|
-
t.speedPxPerSecond =
|
|
2433
|
+
t.speedPxPerSecond = Jt(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
|
|
2372
2434
|
}
|
|
2373
2435
|
tick = (e) => {
|
|
2374
2436
|
this.frame = null;
|
|
@@ -2380,7 +2442,7 @@ var Xt = class {
|
|
|
2380
2442
|
return;
|
|
2381
2443
|
}
|
|
2382
2444
|
if (this.lastTimestamp !== null) {
|
|
2383
|
-
let r = Math.min(
|
|
2445
|
+
let r = Math.min(Kt, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
|
|
2384
2446
|
n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
|
|
2385
2447
|
}
|
|
2386
2448
|
this.lastTimestamp = e, this.schedule();
|
|
@@ -2394,7 +2456,7 @@ var Xt = class {
|
|
|
2394
2456
|
};
|
|
2395
2457
|
//#endregion
|
|
2396
2458
|
//#region src/core/backendAutofill.ts
|
|
2397
|
-
async function
|
|
2459
|
+
async function Qt(e, t, n, r) {
|
|
2398
2460
|
let i = await e.onUnderfilled(n);
|
|
2399
2461
|
if (!r()) return;
|
|
2400
2462
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
|
|
@@ -2408,80 +2470,81 @@ async function Zt(e, t, n, r) {
|
|
|
2408
2470
|
status: "waiting"
|
|
2409
2471
|
});
|
|
2410
2472
|
}
|
|
2411
|
-
function
|
|
2473
|
+
function $t(e, t) {
|
|
2412
2474
|
["complete", "exhausted"].includes(t.status) && t.items && (e.items = Q(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
|
|
2413
2475
|
}
|
|
2414
|
-
function
|
|
2476
|
+
function en(e, t, n) {
|
|
2415
2477
|
let r = t.autofill;
|
|
2416
|
-
return !Ut(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (
|
|
2478
|
+
return !Ut(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : ($t(t, n), Object.assign(r, $(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);
|
|
2417
2479
|
}
|
|
2418
|
-
function
|
|
2419
|
-
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Bt(e, n),
|
|
2480
|
+
function tn(e, t, n) {
|
|
2481
|
+
return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Bt(e, n), $t(t, n), !0);
|
|
2420
2482
|
}
|
|
2421
2483
|
//#endregion
|
|
2422
2484
|
//#region src/core/initialAutofill.ts
|
|
2423
|
-
async function
|
|
2424
|
-
let
|
|
2425
|
-
if (!
|
|
2426
|
-
let
|
|
2427
|
-
if (Object.assign(
|
|
2428
|
-
missing: Math.max(0,
|
|
2429
|
-
received:
|
|
2485
|
+
async function nn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, options: i, signal: a, state: o }) {
|
|
2486
|
+
let s = i.autofill;
|
|
2487
|
+
if (!s) return;
|
|
2488
|
+
let c = o.items.length;
|
|
2489
|
+
if (Object.assign(o.autofill, {
|
|
2490
|
+
missing: Math.max(0, s.pageSize - c),
|
|
2491
|
+
received: c,
|
|
2430
2492
|
requests: 1
|
|
2431
|
-
}),
|
|
2432
|
-
|
|
2493
|
+
}), c >= s.pageSize) {
|
|
2494
|
+
o.autofill.status = "complete";
|
|
2433
2495
|
return;
|
|
2434
2496
|
}
|
|
2435
|
-
if (
|
|
2436
|
-
await
|
|
2497
|
+
if (s.strategy === "backend") {
|
|
2498
|
+
await Qt(s, o, {
|
|
2437
2499
|
cycleId: e,
|
|
2438
|
-
feedKey:
|
|
2439
|
-
items: [...
|
|
2440
|
-
missing:
|
|
2441
|
-
next:
|
|
2442
|
-
pageSize:
|
|
2443
|
-
received:
|
|
2444
|
-
signal:
|
|
2445
|
-
total:
|
|
2500
|
+
feedKey: s.feedKey,
|
|
2501
|
+
items: [...o.items],
|
|
2502
|
+
missing: s.pageSize - c,
|
|
2503
|
+
next: o.next,
|
|
2504
|
+
pageSize: s.pageSize,
|
|
2505
|
+
received: c,
|
|
2506
|
+
signal: a,
|
|
2507
|
+
total: o.total
|
|
2446
2508
|
}, t);
|
|
2447
2509
|
return;
|
|
2448
2510
|
}
|
|
2449
|
-
if (!
|
|
2450
|
-
|
|
2511
|
+
if (!i.loadPage || o.next === null) {
|
|
2512
|
+
o.autofill.status = "exhausted";
|
|
2451
2513
|
return;
|
|
2452
2514
|
}
|
|
2453
|
-
let
|
|
2454
|
-
existingItems:
|
|
2455
|
-
initialCursor:
|
|
2456
|
-
loadPage:
|
|
2457
|
-
maximumRequests: It(
|
|
2515
|
+
let l = await Wt({
|
|
2516
|
+
existingItems: o.items,
|
|
2517
|
+
initialCursor: o.next,
|
|
2518
|
+
loadPage: i.loadPage,
|
|
2519
|
+
maximumRequests: It(s, !1),
|
|
2520
|
+
onCollection: n,
|
|
2458
2521
|
onDelayChange: (e) => {
|
|
2459
|
-
t() && Object.assign(
|
|
2522
|
+
t() && Object.assign(o.autofill, e);
|
|
2460
2523
|
},
|
|
2461
2524
|
onProgress: (e) => {
|
|
2462
|
-
t() && Object.assign(
|
|
2525
|
+
t() && Object.assign(o.autofill, e, { status: "filling" });
|
|
2463
2526
|
},
|
|
2464
|
-
options:
|
|
2465
|
-
receivedOffset:
|
|
2527
|
+
options: s,
|
|
2528
|
+
receivedOffset: c,
|
|
2466
2529
|
requestOffset: 1,
|
|
2467
|
-
signal:
|
|
2530
|
+
signal: a
|
|
2468
2531
|
});
|
|
2469
|
-
t() && (
|
|
2470
|
-
missing:
|
|
2471
|
-
received:
|
|
2472
|
-
requests:
|
|
2473
|
-
status:
|
|
2532
|
+
t() && (o.items = Q(o.items, l.items), o.next = l.next, l.total !== void 0 && (o.total = l.total), r(l.lastCursor), Object.assign(o.autofill, {
|
|
2533
|
+
missing: l.missing,
|
|
2534
|
+
received: l.received,
|
|
2535
|
+
requests: l.requests,
|
|
2536
|
+
status: l.status
|
|
2474
2537
|
}));
|
|
2475
2538
|
}
|
|
2476
2539
|
//#endregion
|
|
2477
2540
|
//#region src/core/fill.ts
|
|
2478
|
-
function
|
|
2541
|
+
function rn(e) {
|
|
2479
2542
|
return "pages" in e ? { pages: e.pages } : { until: "end" };
|
|
2480
2543
|
}
|
|
2481
|
-
function
|
|
2544
|
+
function an(e) {
|
|
2482
2545
|
return `${typeof e}:${String(e)}`;
|
|
2483
2546
|
}
|
|
2484
|
-
function
|
|
2547
|
+
function on(e) {
|
|
2485
2548
|
if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
|
|
2486
2549
|
if ("pages" in e) {
|
|
2487
2550
|
if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
|
|
@@ -2490,7 +2553,7 @@ function an(e) {
|
|
|
2490
2553
|
if ("until" in e && e.until === "end") return { until: "end" };
|
|
2491
2554
|
throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
|
|
2492
2555
|
}
|
|
2493
|
-
function
|
|
2556
|
+
function sn(e) {
|
|
2494
2557
|
if (!e) return;
|
|
2495
2558
|
if (e.strategy === "frontend") {
|
|
2496
2559
|
Mt(e, "frontend fill");
|
|
@@ -2500,10 +2563,10 @@ function on(e) {
|
|
|
2500
2563
|
let t = e.initialSession;
|
|
2501
2564
|
if (t) {
|
|
2502
2565
|
if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
|
|
2503
|
-
|
|
2566
|
+
on(t.target);
|
|
2504
2567
|
}
|
|
2505
2568
|
}
|
|
2506
|
-
function
|
|
2569
|
+
function cn(e, t, n = !0) {
|
|
2507
2570
|
let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
|
|
2508
2571
|
return {
|
|
2509
2572
|
completedPages: i?.completedPages ?? 0,
|
|
@@ -2517,10 +2580,10 @@ function sn(e, t, n = !0) {
|
|
|
2517
2580
|
sessionId: i?.sessionId ?? null,
|
|
2518
2581
|
status: i?.status ?? "idle",
|
|
2519
2582
|
strategy: e?.strategy ?? null,
|
|
2520
|
-
target: i ?
|
|
2583
|
+
target: i ? rn(i.target) : null
|
|
2521
2584
|
};
|
|
2522
2585
|
}
|
|
2523
|
-
function
|
|
2586
|
+
function ln(e) {
|
|
2524
2587
|
return [
|
|
2525
2588
|
"cancelling",
|
|
2526
2589
|
"filling",
|
|
@@ -2528,10 +2591,10 @@ function cn(e) {
|
|
|
2528
2591
|
"waiting"
|
|
2529
2592
|
].includes(e.status);
|
|
2530
2593
|
}
|
|
2531
|
-
async function
|
|
2594
|
+
async function un({ existingItems: e, initialCursor: t, loadPage: n, onDelayChange: r, onProgress: i, options: a, signal: o, target: s }) {
|
|
2532
2595
|
let c = [], l = [...e], u = /* @__PURE__ */ new Set(), d = 0, f = t, p = t, m = 0, h;
|
|
2533
2596
|
for (; p !== null;) {
|
|
2534
|
-
let e =
|
|
2597
|
+
let e = an(f);
|
|
2535
2598
|
if (u.has(e)) throw Error("Vibe fill received a repeated cursor.");
|
|
2536
2599
|
u.add(e), await Pt({
|
|
2537
2600
|
delayMs: Nt(d, a),
|
|
@@ -2580,7 +2643,7 @@ async function ln({ existingItems: e, initialCursor: t, loadPage: n, onDelayChan
|
|
|
2580
2643
|
}
|
|
2581
2644
|
//#endregion
|
|
2582
2645
|
//#region src/core/backendFill.ts
|
|
2583
|
-
async function
|
|
2646
|
+
async function dn(e, t, n, r) {
|
|
2584
2647
|
let i = await e.onStart(n);
|
|
2585
2648
|
if (r()) {
|
|
2586
2649
|
if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
|
|
@@ -2594,22 +2657,22 @@ async function un(e, t, n, r) {
|
|
|
2594
2657
|
});
|
|
2595
2658
|
}
|
|
2596
2659
|
}
|
|
2597
|
-
function
|
|
2660
|
+
function fn(e, t, n) {
|
|
2598
2661
|
return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
|
|
2599
2662
|
}
|
|
2600
|
-
function
|
|
2663
|
+
function pn(e) {
|
|
2601
2664
|
return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
|
|
2602
2665
|
}
|
|
2603
|
-
function
|
|
2666
|
+
function mn(e, t) {
|
|
2604
2667
|
if (!["complete", "exhausted"].includes(t.status)) return !0;
|
|
2605
2668
|
let n = e.fill.target;
|
|
2606
2669
|
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;
|
|
2607
2670
|
}
|
|
2608
|
-
function
|
|
2671
|
+
function hn(e, t, n) {
|
|
2609
2672
|
t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Q(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
|
|
2610
2673
|
}
|
|
2611
|
-
function
|
|
2612
|
-
return !
|
|
2674
|
+
function gn(e, t, n, r) {
|
|
2675
|
+
return !fn(e, t, n) || !pn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !mn(t, n) ? !1 : (hn(t, n, r), Object.assign(t.fill, {
|
|
2613
2676
|
...$(n.status === "waiting" ? n.nextRequestAt : null),
|
|
2614
2677
|
completedPages: n.completedPages,
|
|
2615
2678
|
error: n.error ?? null,
|
|
@@ -2618,14 +2681,14 @@ function hn(e, t, n, r) {
|
|
|
2618
2681
|
status: n.status
|
|
2619
2682
|
}), !0);
|
|
2620
2683
|
}
|
|
2621
|
-
function
|
|
2684
|
+
function _n(e, t, n, r) {
|
|
2622
2685
|
if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
|
|
2623
2686
|
let i = t.fill;
|
|
2624
|
-
return t.fill =
|
|
2687
|
+
return t.fill = cn(e, n), !pn(n) || !mn(t, n) ? (t.fill = i, !1) : (hn(t, n, r), !0);
|
|
2625
2688
|
}
|
|
2626
2689
|
//#endregion
|
|
2627
2690
|
//#region src/core/fillController.ts
|
|
2628
|
-
var
|
|
2691
|
+
var vn = class {
|
|
2629
2692
|
abortController = null;
|
|
2630
2693
|
cycle = 0;
|
|
2631
2694
|
delayCountdown;
|
|
@@ -2636,23 +2699,23 @@ var _n = class {
|
|
|
2636
2699
|
}), this.syncBackendCountdown();
|
|
2637
2700
|
}
|
|
2638
2701
|
isActive() {
|
|
2639
|
-
return
|
|
2702
|
+
return ln(this.options.state.fill);
|
|
2640
2703
|
}
|
|
2641
2704
|
applyUpdate(e) {
|
|
2642
|
-
let t =
|
|
2705
|
+
let t = gn(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2643
2706
|
return t && this.syncBackendCountdown(), t;
|
|
2644
2707
|
}
|
|
2645
2708
|
restoreSession(e) {
|
|
2646
|
-
let t =
|
|
2709
|
+
let t = _n(this.options.fill, this.options.state, e, this.options.onLastCursor);
|
|
2647
2710
|
return t && this.syncBackendCountdown(), t;
|
|
2648
2711
|
}
|
|
2649
2712
|
async start(e) {
|
|
2650
2713
|
let t = this.options.fill;
|
|
2651
2714
|
if (!t) throw Error("Vibe fill is not configured.");
|
|
2652
2715
|
if (this.isActive()) throw Error("Vibe fill is already active.");
|
|
2653
|
-
let n =
|
|
2716
|
+
let n = on(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
|
|
2654
2717
|
if (this.options.state.fill = {
|
|
2655
|
-
...
|
|
2718
|
+
...cn(t, void 0, !1),
|
|
2656
2719
|
cycleId: r,
|
|
2657
2720
|
status: "filling",
|
|
2658
2721
|
target: n
|
|
@@ -2663,7 +2726,7 @@ var _n = class {
|
|
|
2663
2726
|
let i = ++this.requestVersion, a = new AbortController();
|
|
2664
2727
|
this.abortController = a;
|
|
2665
2728
|
try {
|
|
2666
|
-
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await
|
|
2729
|
+
t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await dn(t, this.options.state, {
|
|
2667
2730
|
cycleId: r,
|
|
2668
2731
|
feedKey: t.feedKey,
|
|
2669
2732
|
items: [...this.options.state.items],
|
|
@@ -2681,7 +2744,7 @@ var _n = class {
|
|
|
2681
2744
|
}
|
|
2682
2745
|
async cancel() {
|
|
2683
2746
|
let { fill: e, state: t } = this.options;
|
|
2684
|
-
if (!
|
|
2747
|
+
if (!ln(t.fill) || !t.fill.cycleId) return;
|
|
2685
2748
|
let n = {
|
|
2686
2749
|
cycleId: t.fill.cycleId,
|
|
2687
2750
|
feedKey: t.fill.feedKey ?? "",
|
|
@@ -2695,7 +2758,7 @@ var _n = class {
|
|
|
2695
2758
|
}
|
|
2696
2759
|
}
|
|
2697
2760
|
reset() {
|
|
2698
|
-
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill =
|
|
2761
|
+
this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = cn(this.options.fill, void 0, !1);
|
|
2699
2762
|
}
|
|
2700
2763
|
destroy() {
|
|
2701
2764
|
this.abortLocalRequest(), this.delayCountdown.clear();
|
|
@@ -2711,7 +2774,7 @@ var _n = class {
|
|
|
2711
2774
|
if (!i) throw Error("Vibe frontend fill requires loadPage.");
|
|
2712
2775
|
let a = this.options.state;
|
|
2713
2776
|
a.isLoadingMore = !0;
|
|
2714
|
-
let o = await
|
|
2777
|
+
let o = await un({
|
|
2715
2778
|
existingItems: a.items,
|
|
2716
2779
|
initialCursor: a.next,
|
|
2717
2780
|
loadPage: i,
|
|
@@ -2738,7 +2801,7 @@ var _n = class {
|
|
|
2738
2801
|
};
|
|
2739
2802
|
//#endregion
|
|
2740
2803
|
//#region src/core/feedFooter.ts
|
|
2741
|
-
function
|
|
2804
|
+
function yn(e) {
|
|
2742
2805
|
return {
|
|
2743
2806
|
cancelAutofill: () => e.cancelAutofill(),
|
|
2744
2807
|
loadMore: () => e.loadNext(),
|
|
@@ -2746,45 +2809,45 @@ function vn(e) {
|
|
|
2746
2809
|
retryEnd: () => e.retryEnd()
|
|
2747
2810
|
};
|
|
2748
2811
|
}
|
|
2749
|
-
function yn(e) {
|
|
2750
|
-
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
2751
|
-
}
|
|
2752
2812
|
function bn(e) {
|
|
2753
|
-
e
|
|
2813
|
+
if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
|
|
2754
2814
|
}
|
|
2755
2815
|
function xn(e) {
|
|
2816
|
+
e?.intervalMs !== void 0 && bn(e.intervalMs);
|
|
2817
|
+
}
|
|
2818
|
+
function Sn(e) {
|
|
2756
2819
|
return {
|
|
2757
2820
|
enabled: e?.enabled ?? !1,
|
|
2758
2821
|
includePostItems: e?.includePostItems ?? !1,
|
|
2759
2822
|
intervalMs: e?.intervalMs ?? 5e3
|
|
2760
2823
|
};
|
|
2761
2824
|
}
|
|
2762
|
-
function
|
|
2825
|
+
function Cn(e, t) {
|
|
2763
2826
|
if (typeof t == "boolean") {
|
|
2764
2827
|
e.enabled = t;
|
|
2765
2828
|
return;
|
|
2766
2829
|
}
|
|
2767
|
-
|
|
2830
|
+
xn(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);
|
|
2768
2831
|
}
|
|
2769
2832
|
//#endregion
|
|
2770
2833
|
//#region src/core/reelInfoSheet.ts
|
|
2771
|
-
function
|
|
2834
|
+
function wn(e) {
|
|
2772
2835
|
return { enabled: e?.enabled ?? !1 };
|
|
2773
2836
|
}
|
|
2774
|
-
function
|
|
2837
|
+
function Tn(e, t, n) {
|
|
2775
2838
|
if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
|
|
2776
2839
|
e.enabled = n;
|
|
2777
2840
|
}
|
|
2778
2841
|
//#endregion
|
|
2779
2842
|
//#region src/core/initialRuntimeState.ts
|
|
2780
|
-
function
|
|
2843
|
+
function En(e, t) {
|
|
2781
2844
|
let n = e.initialPage;
|
|
2782
2845
|
return {
|
|
2783
2846
|
activeReelPostId: null,
|
|
2784
|
-
autoScroll:
|
|
2847
|
+
autoScroll: Xt(e.autoScroll),
|
|
2785
2848
|
autofill: Bt(e.autofill),
|
|
2786
2849
|
error: null,
|
|
2787
|
-
fill:
|
|
2850
|
+
fill: cn(e.fill),
|
|
2788
2851
|
infiniteScroll: e.infiniteScroll ?? !0,
|
|
2789
2852
|
isLoading: !n,
|
|
2790
2853
|
isLoadingMore: !1,
|
|
@@ -2794,14 +2857,14 @@ function Tn(e, t) {
|
|
|
2794
2857
|
mediaIndices: /* @__PURE__ */ new Map(),
|
|
2795
2858
|
next: n?.next ?? null,
|
|
2796
2859
|
nextPageError: null,
|
|
2797
|
-
reelAutoAdvance:
|
|
2860
|
+
reelAutoAdvance: Sn(e.reelAutoAdvance),
|
|
2798
2861
|
reelForward: {
|
|
2799
2862
|
error: null,
|
|
2800
2863
|
status: "idle"
|
|
2801
2864
|
},
|
|
2802
2865
|
reelForwardIndex: null,
|
|
2803
2866
|
reelForwardItem: null,
|
|
2804
|
-
reelInfoSheet:
|
|
2867
|
+
reelInfoSheet: wn(e.reelInfoSheet),
|
|
2805
2868
|
reelInfoSheetOverlay: !1,
|
|
2806
2869
|
reelMediaSource: "original",
|
|
2807
2870
|
reelOrigin: null,
|
|
@@ -2810,26 +2873,26 @@ function Tn(e, t) {
|
|
|
2810
2873
|
}
|
|
2811
2874
|
//#endregion
|
|
2812
2875
|
//#region src/core/options.ts
|
|
2813
|
-
function
|
|
2876
|
+
function Dn(e, t) {
|
|
2814
2877
|
if (t) {
|
|
2815
2878
|
if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
|
|
2816
2879
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
|
|
2817
2880
|
}
|
|
2818
2881
|
}
|
|
2819
|
-
function
|
|
2882
|
+
function On(e, t) {
|
|
2820
2883
|
if (t) {
|
|
2821
2884
|
if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
|
|
2822
2885
|
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.`);
|
|
2823
2886
|
}
|
|
2824
2887
|
}
|
|
2825
|
-
function
|
|
2826
|
-
if (
|
|
2888
|
+
function kn(e) {
|
|
2889
|
+
if (Yt(e.autoScroll), Dn("cardHeader", e.cardHeader), Dn("cardFooter", e.cardFooter), On("header", e.mediaCard?.header), On("footer", e.mediaCard?.footer), zt(e.autofill), sn(e.fill), xn(e.reelAutoAdvance), e.removalHistoryLimit !== void 0 && (!Number.isInteger(e.removalHistoryLimit) || e.removalHistoryLimit < 0)) throw TypeError("Vibe removalHistoryLimit must be a non-negative integer.");
|
|
2827
2890
|
if (!e.initialPage && !e.loadPage) throw TypeError("Vibe requires either initialPage or loadPage.");
|
|
2828
2891
|
if (e.initialPage?.next !== null && !e.loadPage) throw TypeError("Vibe requires loadPage when initialPage has a next cursor.");
|
|
2829
2892
|
if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
|
|
2830
2893
|
if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
|
|
2831
2894
|
}
|
|
2832
|
-
function
|
|
2895
|
+
function An(e) {
|
|
2833
2896
|
if (typeof e != "string") return e;
|
|
2834
2897
|
if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
|
|
2835
2898
|
let t = document.querySelector(e);
|
|
@@ -2838,7 +2901,7 @@ function kn(e) {
|
|
|
2838
2901
|
}
|
|
2839
2902
|
//#endregion
|
|
2840
2903
|
//#region src/core/activeItemRemoval.ts
|
|
2841
|
-
function
|
|
2904
|
+
function jn(e, t, n, r, i) {
|
|
2842
2905
|
let a = new Set(t.map(({ item: e }) => e.postId));
|
|
2843
2906
|
if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
|
|
2844
2907
|
let o = e.items[Math.max(n, 0)];
|
|
@@ -2851,7 +2914,7 @@ function An(e, t, n, r, i) {
|
|
|
2851
2914
|
}
|
|
2852
2915
|
//#endregion
|
|
2853
2916
|
//#region src/core/exactMediaRemovalController.ts
|
|
2854
|
-
function
|
|
2917
|
+
function Mn(e, t) {
|
|
2855
2918
|
let [n, ...r] = t;
|
|
2856
2919
|
if (!n) throw Error("Vibe items must contain at least one media asset.");
|
|
2857
2920
|
return {
|
|
@@ -2860,10 +2923,10 @@ function jn(e, t) {
|
|
|
2860
2923
|
items: r
|
|
2861
2924
|
};
|
|
2862
2925
|
}
|
|
2863
|
-
function
|
|
2926
|
+
function Nn(e) {
|
|
2864
2927
|
if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
|
|
2865
2928
|
}
|
|
2866
|
-
var
|
|
2929
|
+
var Pn = class {
|
|
2867
2930
|
generation = 0;
|
|
2868
2931
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
2869
2932
|
state;
|
|
@@ -2871,10 +2934,10 @@ var Nn = class {
|
|
|
2871
2934
|
this.options = e, this.state = e.state;
|
|
2872
2935
|
}
|
|
2873
2936
|
remove(e) {
|
|
2874
|
-
|
|
2937
|
+
Nn(e);
|
|
2875
2938
|
let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
|
|
2876
2939
|
if (!n) return null;
|
|
2877
|
-
let r = [...
|
|
2940
|
+
let r = [...M(n)], i = r[e.mediaIndex];
|
|
2878
2941
|
if (!i) return null;
|
|
2879
2942
|
let a = Object.freeze({
|
|
2880
2943
|
media: i,
|
|
@@ -2888,7 +2951,7 @@ var Nn = class {
|
|
|
2888
2951
|
restored: !1
|
|
2889
2952
|
});
|
|
2890
2953
|
let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
|
|
2891
|
-
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] =
|
|
2954
|
+
return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Mn(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
|
|
2892
2955
|
}
|
|
2893
2956
|
reset() {
|
|
2894
2957
|
this.generation += 1;
|
|
@@ -2913,32 +2976,32 @@ var Nn = class {
|
|
|
2913
2976
|
return this.state.layout === "reel" || this.state.reelOrigin === "masonry";
|
|
2914
2977
|
}
|
|
2915
2978
|
restoreIntoPost(e, t) {
|
|
2916
|
-
let n = this.state.items[e], r = [...
|
|
2917
|
-
if (r.splice(i, 0, t.media), this.state.items[e] =
|
|
2979
|
+
let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
|
|
2980
|
+
if (r.splice(i, 0, t.media), this.state.items[e] = Mn(n, r), this.state.activeReelPostId !== t.postId) return;
|
|
2918
2981
|
let a = this.state.mediaIndices.get(t.postId) ?? 0;
|
|
2919
2982
|
a >= i && this.state.mediaIndices.set(t.postId, a + 1);
|
|
2920
2983
|
}
|
|
2921
2984
|
updateMediaIndexAfterRemoval(e, t, n) {
|
|
2922
2985
|
let r = this.state.items.find((t) => t.postId === e);
|
|
2923
2986
|
if (!r) return;
|
|
2924
|
-
let i =
|
|
2987
|
+
let i = M(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
|
|
2925
2988
|
n ? o = t < i ? t : 0 : t < a && (o = a - 1), this.state.mediaIndices.set(e, Math.min(o, i - 1));
|
|
2926
2989
|
}
|
|
2927
2990
|
};
|
|
2928
2991
|
//#endregion
|
|
2929
2992
|
//#region src/core/itemPlacement.ts
|
|
2930
|
-
function
|
|
2993
|
+
function Fn(e, t) {
|
|
2931
2994
|
let n = new Set(t);
|
|
2932
2995
|
return e.flatMap((e, t) => n.has(e.postId) ? [{
|
|
2933
2996
|
index: t,
|
|
2934
2997
|
item: e
|
|
2935
2998
|
}] : []);
|
|
2936
2999
|
}
|
|
2937
|
-
function
|
|
3000
|
+
function In(e, t) {
|
|
2938
3001
|
let n = new Set(t.map(({ item: e }) => e.postId));
|
|
2939
3002
|
return e.filter((e) => !n.has(e.postId));
|
|
2940
3003
|
}
|
|
2941
|
-
function
|
|
3004
|
+
function Ln(e, t) {
|
|
2942
3005
|
t.forEach(({ index: e }) => {
|
|
2943
3006
|
if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
|
|
2944
3007
|
});
|
|
@@ -2949,7 +3012,7 @@ function In(e, t) {
|
|
|
2949
3012
|
}
|
|
2950
3013
|
//#endregion
|
|
2951
3014
|
//#region src/core/itemRemovalController.ts
|
|
2952
|
-
var
|
|
3015
|
+
var Rn = 20, zn = class {
|
|
2953
3016
|
generation = 0;
|
|
2954
3017
|
historyLimit;
|
|
2955
3018
|
metadata = /* @__PURE__ */ new WeakMap();
|
|
@@ -2958,7 +3021,7 @@ var Ln = 20, Rn = class {
|
|
|
2958
3021
|
itemOrder;
|
|
2959
3022
|
stopItemsWatcher;
|
|
2960
3023
|
constructor(e) {
|
|
2961
|
-
this.options = e, this.historyLimit = e.historyLimit ??
|
|
3024
|
+
this.options = e, this.historyLimit = e.historyLimit ?? Rn, 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" });
|
|
2962
3025
|
}
|
|
2963
3026
|
destroy() {
|
|
2964
3027
|
this.reset(), this.stopItemsWatcher();
|
|
@@ -2971,7 +3034,7 @@ var Ln = 20, Rn = class {
|
|
|
2971
3034
|
let i = this.options.startRemoval(r);
|
|
2972
3035
|
if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
|
|
2973
3036
|
let a = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), o = new Set(t.map(({ item: e }) => e.postId)), s = a < 0 ? 0 : this.state.items.slice(0, a).filter(({ postId: e }) => o.has(e)).length, c = Math.max(a - s, 0);
|
|
2974
|
-
return this.state.items =
|
|
3037
|
+
return this.state.items = In(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
|
|
2975
3038
|
}
|
|
2976
3039
|
reset() {
|
|
2977
3040
|
this.generation += 1, this.history = [], this.itemOrder = [];
|
|
@@ -2982,7 +3045,7 @@ var Ln = 20, Rn = class {
|
|
|
2982
3045
|
this.restoreRemoval(t);
|
|
2983
3046
|
return;
|
|
2984
3047
|
}
|
|
2985
|
-
let n =
|
|
3048
|
+
let n = Ln(this.state.items, e);
|
|
2986
3049
|
this.registerExternalPlacements(e), this.state.items = n;
|
|
2987
3050
|
}
|
|
2988
3051
|
restoreRemoval(e) {
|
|
@@ -3008,7 +3071,7 @@ var Ln = 20, Rn = class {
|
|
|
3008
3071
|
}
|
|
3009
3072
|
collectOrderedPlacements(e) {
|
|
3010
3073
|
let t = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3011
|
-
return
|
|
3074
|
+
return Fn(this.state.items, e).map((e) => ({
|
|
3012
3075
|
index: t.get(e.item.postId) ?? e.index,
|
|
3013
3076
|
item: e.item
|
|
3014
3077
|
}));
|
|
@@ -3039,7 +3102,7 @@ var Ln = 20, Rn = class {
|
|
|
3039
3102
|
let r = new Map(this.itemOrder.map((e, t) => [e, t]));
|
|
3040
3103
|
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;
|
|
3041
3104
|
}
|
|
3042
|
-
},
|
|
3105
|
+
}, Bn = class {
|
|
3043
3106
|
forward = null;
|
|
3044
3107
|
forwardPromise = null;
|
|
3045
3108
|
forwardVersion = 0;
|
|
@@ -3117,7 +3180,7 @@ var Ln = 20, Rn = class {
|
|
|
3117
3180
|
}
|
|
3118
3181
|
}
|
|
3119
3182
|
}
|
|
3120
|
-
},
|
|
3183
|
+
}, Vn = class {
|
|
3121
3184
|
generation = 0;
|
|
3122
3185
|
pending = Promise.resolve();
|
|
3123
3186
|
constructor(e) {
|
|
@@ -3134,7 +3197,7 @@ var Ln = 20, Rn = class {
|
|
|
3134
3197
|
if (!n) return;
|
|
3135
3198
|
let r = t.mediaIndices.get(e.postId) ?? 0;
|
|
3136
3199
|
if (e.mediaIndex === r) {
|
|
3137
|
-
if (
|
|
3200
|
+
if (M(n).length > 1) {
|
|
3138
3201
|
await this.options.transitionMedia(1);
|
|
3139
3202
|
return;
|
|
3140
3203
|
}
|
|
@@ -3167,22 +3230,22 @@ var Ln = 20, Rn = class {
|
|
|
3167
3230
|
};
|
|
3168
3231
|
//#endregion
|
|
3169
3232
|
//#region src/core/removalControllers.ts
|
|
3170
|
-
function
|
|
3171
|
-
let t = new
|
|
3233
|
+
function Hn(e) {
|
|
3234
|
+
let t = new Bn(e), n = new Vn({
|
|
3172
3235
|
state: e.state,
|
|
3173
3236
|
transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
|
|
3174
3237
|
transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
|
|
3175
3238
|
});
|
|
3176
3239
|
return {
|
|
3177
|
-
exactMediaRemoval: new
|
|
3240
|
+
exactMediaRemoval: new Pn({
|
|
3178
3241
|
onActivate: e.onActivate,
|
|
3179
3242
|
reelForward: t,
|
|
3180
3243
|
state: e.state
|
|
3181
3244
|
}),
|
|
3182
|
-
itemRemoval: new
|
|
3245
|
+
itemRemoval: new zn({
|
|
3183
3246
|
historyLimit: e.historyLimit,
|
|
3184
3247
|
onItemsRemoved: (n, r, i) => {
|
|
3185
|
-
|
|
3248
|
+
jn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
|
|
3186
3249
|
},
|
|
3187
3250
|
onRemovalRestored: (n) => {
|
|
3188
3251
|
let r = t.cancel(n);
|
|
@@ -3196,17 +3259,17 @@ function Vn(e) {
|
|
|
3196
3259
|
reelRemoval: n
|
|
3197
3260
|
};
|
|
3198
3261
|
}
|
|
3199
|
-
var
|
|
3200
|
-
function
|
|
3262
|
+
var Un = 1.5;
|
|
3263
|
+
function Wn(e) {
|
|
3201
3264
|
let t = Math.min(e.screenWidth, e.screenHeight);
|
|
3202
3265
|
if (t > 0 && t < 600) return !0;
|
|
3203
|
-
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n *
|
|
3266
|
+
let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * Un;
|
|
3204
3267
|
return !e.hasHover && n > 0 && n < 600 && r;
|
|
3205
3268
|
}
|
|
3206
|
-
function Wn(e) {
|
|
3207
|
-
return Un(e) ? "reel" : "masonry";
|
|
3208
|
-
}
|
|
3209
3269
|
function Gn(e) {
|
|
3270
|
+
return Wn(e) ? "reel" : "masonry";
|
|
3271
|
+
}
|
|
3272
|
+
function Kn(e) {
|
|
3210
3273
|
let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
|
|
3211
3274
|
return {
|
|
3212
3275
|
hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
|
|
@@ -3216,15 +3279,15 @@ function Gn(e) {
|
|
|
3216
3279
|
viewportWidth: n.clientWidth
|
|
3217
3280
|
};
|
|
3218
3281
|
}
|
|
3219
|
-
function Kn(e) {
|
|
3220
|
-
return Un(Gn(e));
|
|
3221
|
-
}
|
|
3222
3282
|
function qn(e) {
|
|
3223
|
-
return Wn(
|
|
3283
|
+
return Wn(Kn(e));
|
|
3284
|
+
}
|
|
3285
|
+
function Jn(e) {
|
|
3286
|
+
return Gn(Kn(e));
|
|
3224
3287
|
}
|
|
3225
3288
|
//#endregion
|
|
3226
3289
|
//#region src/core/responsiveLayoutController.ts
|
|
3227
|
-
var
|
|
3290
|
+
var Yn = class {
|
|
3228
3291
|
layoutMode;
|
|
3229
3292
|
resizeObserver = null;
|
|
3230
3293
|
target = null;
|
|
@@ -3249,10 +3312,10 @@ var Jn = class {
|
|
|
3249
3312
|
}
|
|
3250
3313
|
handleResponsiveLayout = () => {
|
|
3251
3314
|
if (!this.target) return;
|
|
3252
|
-
let e =
|
|
3253
|
-
this.state.reelInfoSheetOverlay =
|
|
3315
|
+
let e = Jn(this.target);
|
|
3316
|
+
this.state.reelInfoSheetOverlay = qn(this.target), this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
|
|
3254
3317
|
};
|
|
3255
|
-
},
|
|
3318
|
+
}, Xn = class {
|
|
3256
3319
|
routedReelPostId = null;
|
|
3257
3320
|
reelRouteIsActive = !1;
|
|
3258
3321
|
constructor(e, t) {
|
|
@@ -3279,11 +3342,10 @@ var Jn = class {
|
|
|
3279
3342
|
let i = this.reelRouteIsActive ? "replace" : "push";
|
|
3280
3343
|
this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
|
|
3281
3344
|
}
|
|
3282
|
-
},
|
|
3345
|
+
}, Zn = class {
|
|
3283
3346
|
app = null;
|
|
3284
3347
|
autoScroll;
|
|
3285
|
-
|
|
3286
|
-
autofillCycle = 0;
|
|
3348
|
+
autofillController;
|
|
3287
3349
|
abortController = null;
|
|
3288
3350
|
pendingRequest = null;
|
|
3289
3351
|
requestVersion = 0;
|
|
@@ -3299,20 +3361,27 @@ var Jn = class {
|
|
|
3299
3361
|
lastLoadedCursor = null;
|
|
3300
3362
|
state;
|
|
3301
3363
|
constructor(e) {
|
|
3302
|
-
this.options = e,
|
|
3364
|
+
this.options = e, kn(e);
|
|
3303
3365
|
let t = e.layout ?? "masonry";
|
|
3304
|
-
this.state =
|
|
3366
|
+
this.state = x(En(e, t)), this.autoScroll = new Zt({
|
|
3305
3367
|
getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
|
|
3306
3368
|
state: this.state.autoScroll
|
|
3307
|
-
}), this.
|
|
3369
|
+
}), this.autofillController = new Gt({
|
|
3370
|
+
cancelRequest: () => this.cancelRequest(),
|
|
3371
|
+
onLastCursor: (e) => {
|
|
3372
|
+
this.lastLoadedCursor = e;
|
|
3373
|
+
},
|
|
3374
|
+
options: e.autofill,
|
|
3375
|
+
state: this.state
|
|
3376
|
+
}), this.fillController = new vn({
|
|
3308
3377
|
fill: e.fill,
|
|
3309
3378
|
loadPage: e.loadPage,
|
|
3310
3379
|
onLastCursor: (e) => {
|
|
3311
3380
|
this.lastLoadedCursor = e;
|
|
3312
3381
|
},
|
|
3313
3382
|
state: this.state
|
|
3314
|
-
}), this.routing = new
|
|
3315
|
-
let n =
|
|
3383
|
+
}), this.routing = new Xn(e.routing, this.state);
|
|
3384
|
+
let n = Hn({
|
|
3316
3385
|
historyLimit: e.removalHistoryLimit,
|
|
3317
3386
|
loadNext: () => this.loadNext(),
|
|
3318
3387
|
onActivate: (e) => this.setActiveReelPost(e),
|
|
@@ -3320,20 +3389,20 @@ var Jn = class {
|
|
|
3320
3389
|
state: this.state,
|
|
3321
3390
|
surface: () => this.surface
|
|
3322
3391
|
});
|
|
3323
|
-
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new
|
|
3392
|
+
this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Yn(t, this.state, () => {
|
|
3324
3393
|
this.routing.syncFeed();
|
|
3325
3394
|
}), this.startStateNotifications();
|
|
3326
3395
|
}
|
|
3327
3396
|
async mount() {
|
|
3328
3397
|
if (this.app) throw Error("Vibe is already mounted.");
|
|
3329
3398
|
this.startStateNotifications();
|
|
3330
|
-
let e =
|
|
3399
|
+
let e = An(this.options.target);
|
|
3331
3400
|
this.responsiveLayout.mount(e), this.app = i(Tt, {
|
|
3332
3401
|
canRetryEnd: !!this.options.loadPage,
|
|
3333
3402
|
cardFooter: this.options.cardFooter,
|
|
3334
3403
|
cardHeader: this.options.cardHeader,
|
|
3335
3404
|
feedFooter: this.options.feedFooter,
|
|
3336
|
-
feedFooterActions:
|
|
3405
|
+
feedFooterActions: yn(this),
|
|
3337
3406
|
mediaCard: this.options.mediaCard,
|
|
3338
3407
|
reelInfoSheet: this.options.reelInfoSheet,
|
|
3339
3408
|
state: this.state,
|
|
@@ -3358,7 +3427,7 @@ var Jn = class {
|
|
|
3358
3427
|
this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
|
|
3359
3428
|
}
|
|
3360
3429
|
getState() {
|
|
3361
|
-
return
|
|
3430
|
+
return I(this.state);
|
|
3362
3431
|
}
|
|
3363
3432
|
removeMedia(e) {
|
|
3364
3433
|
return this.exactMediaRemoval.remove(e);
|
|
@@ -3409,11 +3478,11 @@ var Jn = class {
|
|
|
3409
3478
|
this.autoScroll.setSpeed(e);
|
|
3410
3479
|
}
|
|
3411
3480
|
applyAutofillUpdate(e) {
|
|
3412
|
-
let t =
|
|
3413
|
-
return t && this.
|
|
3481
|
+
let t = en(this.options.autofill, this.state, e);
|
|
3482
|
+
return t && this.autofillController.syncCountdown(), t;
|
|
3414
3483
|
}
|
|
3415
|
-
|
|
3416
|
-
|
|
3484
|
+
cancelAutofill() {
|
|
3485
|
+
return this.autofillController.cancel();
|
|
3417
3486
|
}
|
|
3418
3487
|
applyFillUpdate(e) {
|
|
3419
3488
|
return this.fillController.applyUpdate(e);
|
|
@@ -3426,8 +3495,8 @@ var Jn = class {
|
|
|
3426
3495
|
await this.fillController.start(e);
|
|
3427
3496
|
}
|
|
3428
3497
|
restoreAutofillSession(e) {
|
|
3429
|
-
let t =
|
|
3430
|
-
return t && this.
|
|
3498
|
+
let t = tn(this.options.autofill, this.state, e);
|
|
3499
|
+
return t && this.autofillController.syncCountdown(), t;
|
|
3431
3500
|
}
|
|
3432
3501
|
restoreFillSession(e) {
|
|
3433
3502
|
return this.fillController.restoreSession(e);
|
|
@@ -3457,10 +3526,10 @@ var Jn = class {
|
|
|
3457
3526
|
this.state.loadMoreLocked !== e && (this.state.loadMoreLocked = e, !e && this.state.infiniteScroll && m(() => this.surface?.loadIfNearBottom()));
|
|
3458
3527
|
}
|
|
3459
3528
|
setReelAutoAdvance(e) {
|
|
3460
|
-
|
|
3529
|
+
Cn(this.state.reelAutoAdvance, e);
|
|
3461
3530
|
}
|
|
3462
3531
|
setReelInfoSheet(e) {
|
|
3463
|
-
|
|
3532
|
+
Tn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
|
|
3464
3533
|
}
|
|
3465
3534
|
setLayout(e) {
|
|
3466
3535
|
this.responsiveLayout.setLayout(e);
|
|
@@ -3475,12 +3544,12 @@ var Jn = class {
|
|
|
3475
3544
|
this.state.layout !== "reel" && this.state.reelOrigin !== "masonry" || (this.state.activeReelPostId = e, this.routing.syncReel(e));
|
|
3476
3545
|
}
|
|
3477
3546
|
cancelRequest() {
|
|
3478
|
-
this.
|
|
3547
|
+
this.autofillController.clearCountdown(), this.requestVersion += 1, this.abortController?.abort(), this.abortController = null, this.pendingRequest = null, this.state.isLoading = !1, this.state.isLoadingMore = !1;
|
|
3479
3548
|
}
|
|
3480
3549
|
async fetchPage(e, t) {
|
|
3481
3550
|
let n = this.options.loadPage;
|
|
3482
3551
|
if (!n) return;
|
|
3483
|
-
let r = ++this.requestVersion, i = new AbortController(), a = this.options.autofill, o = a ? this.
|
|
3552
|
+
let r = ++this.requestVersion, i = new AbortController(), a = this.options.autofill, o = a ? this.autofillController.beginCycle() : null, s = !1;
|
|
3484
3553
|
this.abortController = i;
|
|
3485
3554
|
try {
|
|
3486
3555
|
if (a?.strategy === "frontend") {
|
|
@@ -3488,6 +3557,7 @@ var Jn = class {
|
|
|
3488
3557
|
existingItems: t ? this.state.items : [],
|
|
3489
3558
|
initialCursor: e,
|
|
3490
3559
|
loadPage: n,
|
|
3560
|
+
onCollection: (e) => this.autofillController.captureCollection(e, r === this.requestVersion),
|
|
3491
3561
|
onDelayChange: (e) => {
|
|
3492
3562
|
r === this.requestVersion && Object.assign(this.state.autofill, e);
|
|
3493
3563
|
},
|
|
@@ -3503,7 +3573,7 @@ var Jn = class {
|
|
|
3503
3573
|
received: o.received,
|
|
3504
3574
|
requests: o.requests,
|
|
3505
3575
|
status: o.status
|
|
3506
|
-
});
|
|
3576
|
+
}), this.autofillController.clearCollection();
|
|
3507
3577
|
return;
|
|
3508
3578
|
}
|
|
3509
3579
|
let c = Et(await n({
|
|
@@ -3521,7 +3591,7 @@ var Jn = class {
|
|
|
3521
3591
|
this.state.autofill.status = "complete";
|
|
3522
3592
|
return;
|
|
3523
3593
|
}
|
|
3524
|
-
await
|
|
3594
|
+
await Qt(a, this.state, {
|
|
3525
3595
|
cycleId: o,
|
|
3526
3596
|
feedKey: a.feedKey,
|
|
3527
3597
|
items: u.slice(l.length),
|
|
@@ -3531,30 +3601,15 @@ var Jn = class {
|
|
|
3531
3601
|
received: d,
|
|
3532
3602
|
signal: i.signal,
|
|
3533
3603
|
total: this.state.total
|
|
3534
|
-
}, () => r === this.requestVersion), this.
|
|
3604
|
+
}, () => r === this.requestVersion), this.autofillController.syncCountdown();
|
|
3535
3605
|
}
|
|
3536
3606
|
} catch (e) {
|
|
3537
3607
|
if (i.signal.aborted || r !== this.requestVersion) return;
|
|
3538
3608
|
a && (this.state.autofill.error = e, this.state.autofill.status = "error"), s || (t ? this.state.nextPageError = e : this.state.error = e);
|
|
3539
3609
|
} finally {
|
|
3540
|
-
r === this.requestVersion && (this.abortController = null, this.state.isLoading = !1, this.state.isLoadingMore = !1);
|
|
3610
|
+
r === this.requestVersion && (this.autofillController.clearCollection(), this.abortController = null, this.state.isLoading = !1, this.state.isLoadingMore = !1);
|
|
3541
3611
|
}
|
|
3542
3612
|
}
|
|
3543
|
-
beginAutofillCycle() {
|
|
3544
|
-
let e = this.options.autofill;
|
|
3545
|
-
if (!e) return "";
|
|
3546
|
-
this.autofillDelayCountdown.clear();
|
|
3547
|
-
let t = `vibe-autofill-${Date.now().toString(36)}-${++this.autofillCycle}`;
|
|
3548
|
-
return this.state.autofill = {
|
|
3549
|
-
...Bt(e, void 0, !1),
|
|
3550
|
-
cycleId: t,
|
|
3551
|
-
status: "filling"
|
|
3552
|
-
}, t;
|
|
3553
|
-
}
|
|
3554
|
-
syncAutofillCountdown() {
|
|
3555
|
-
let e = this.state.autofill;
|
|
3556
|
-
this.autofillDelayCountdown.sync(e.strategy === "backend" && e.status === "waiting" ? e.nextRequestAt : null);
|
|
3557
|
-
}
|
|
3558
3613
|
startRequest(e, t) {
|
|
3559
3614
|
let n = this.fetchPage(e, t);
|
|
3560
3615
|
return this.pendingRequest = n, n.finally(() => {
|
|
@@ -3562,11 +3617,12 @@ var Jn = class {
|
|
|
3562
3617
|
});
|
|
3563
3618
|
}
|
|
3564
3619
|
startInitialAutofill() {
|
|
3565
|
-
let e = ++this.requestVersion, t = new AbortController(), n = this.
|
|
3620
|
+
let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
|
|
3566
3621
|
this.abortController = t, this.state.isLoadingMore = !0;
|
|
3567
|
-
let r =
|
|
3622
|
+
let r = nn({
|
|
3568
3623
|
cycleId: n,
|
|
3569
3624
|
isCurrent: () => e === this.requestVersion,
|
|
3625
|
+
onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
|
|
3570
3626
|
onLastCursor: (e) => {
|
|
3571
3627
|
this.lastLoadedCursor = e;
|
|
3572
3628
|
},
|
|
@@ -3576,20 +3632,20 @@ var Jn = class {
|
|
|
3576
3632
|
}).catch((n) => {
|
|
3577
3633
|
t.signal.aborted || e !== this.requestVersion || (this.state.autofill.error = n, this.state.autofill.status = "error", this.state.nextPageError = n);
|
|
3578
3634
|
}).finally(() => {
|
|
3579
|
-
e === this.requestVersion && (this.
|
|
3635
|
+
e === this.requestVersion && (this.autofillController.clearCollection(), this.autofillController.syncCountdown(), this.abortController = null, this.state.isLoadingMore = !1, this.pendingRequest === r && (this.pendingRequest = null));
|
|
3580
3636
|
});
|
|
3581
3637
|
return this.pendingRequest = r, r;
|
|
3582
3638
|
}
|
|
3583
3639
|
startStateNotifications() {
|
|
3584
3640
|
let e = this.options.onStateChange;
|
|
3585
|
-
!e || this.stopStateWatcher || (e(this.getState()), this.stopStateWatcher =
|
|
3641
|
+
!e || this.stopStateWatcher || (e(this.getState()), this.stopStateWatcher = O(this.state, () => e(this.getState()), {
|
|
3586
3642
|
deep: !0,
|
|
3587
3643
|
flush: "post"
|
|
3588
3644
|
}));
|
|
3589
3645
|
}
|
|
3590
3646
|
};
|
|
3591
|
-
function
|
|
3592
|
-
return new
|
|
3647
|
+
function Qn(e) {
|
|
3648
|
+
return new Zn(e);
|
|
3593
3649
|
}
|
|
3594
3650
|
//#endregion
|
|
3595
|
-
export {
|
|
3651
|
+
export { Qn as createVibe };
|