@wyxos/vibe 4.5.4 → 4.5.5

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