@wyxos/vibe 5.6.0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,23 +1,40 @@
1
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
3
  function M(e) {
4
- return [e, ...e.items];
4
+ return {
5
+ height: e.height,
6
+ src: e.src,
7
+ type: e.type,
8
+ width: e.width
9
+ };
5
10
  }
6
11
  function N(e, t) {
7
- return Math.min(e.items.length, Math.max(0, t));
12
+ return t === "preview" ? {
13
+ ...e.preview,
14
+ type: e.preview.type ?? e.type
15
+ } : t === "mobile" && e.mobile ? {
16
+ ...e.mobile,
17
+ type: e.mobile.type ?? e.type
18
+ } : M(e);
8
19
  }
9
- function P(e, t) {
10
- return M(e)[N(e, t)] ?? e;
20
+ function P(e) {
21
+ return [e, ...e.items];
11
22
  }
12
23
  function F(e, t) {
24
+ return Math.min(e.items.length, Math.max(0, t));
25
+ }
26
+ function I(e, t) {
27
+ return P(e)[F(e, t)] ?? e;
28
+ }
29
+ function L(e, t) {
13
30
  return `${String(e)}:${t}`;
14
31
  }
15
32
  //#endregion
16
33
  //#region src/core/runtime.ts
17
- function I(e) {
34
+ function R(e) {
18
35
  return r(() => Object.freeze([...e.items]));
19
36
  }
20
- function L(e, t = [...e.items]) {
37
+ function z(e, t = [...e.items]) {
21
38
  return {
22
39
  activeReelPostId: e.activeReelPostId,
23
40
  autoScroll: { ...e.autoScroll },
@@ -47,17 +64,17 @@ function L(e, t = [...e.items]) {
47
64
  }
48
65
  //#endregion
49
66
  //#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
50
- var R = {
67
+ var B = {
51
68
  key: 0,
52
69
  class: "gallery-footer"
53
- }, z = {
70
+ }, V = {
54
71
  key: 0,
55
72
  class: "load-more-status",
56
73
  role: "status"
57
- }, B = ["disabled"], ee = {
74
+ }, H = ["disabled"], ee = {
58
75
  key: 2,
59
76
  class: "end-feed"
60
- }, V = ["disabled"], H = /* @__PURE__ */ d({
77
+ }, U = ["disabled"], W = /* @__PURE__ */ d({
61
78
  __name: "GalleryFooter",
62
79
  props: {
63
80
  canRetryEnd: { type: Boolean },
@@ -73,14 +90,14 @@ var R = {
73
90
  function i() {
74
91
  n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
75
92
  }
76
- return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", R, [e.isLoading ? (b(), s("p", z, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
93
+ return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", B, [e.isLoading ? (b(), s("p", V, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
77
94
  key: 1,
78
95
  "data-test": "load-more",
79
96
  class: "load-more-button",
80
97
  type: "button",
81
98
  disabled: e.loadMoreLocked,
82
99
  onClick: i
83
- }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, B)) : (b(), s("div", ee, [n[1] ||= c("p", {
100
+ }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, H)) : (b(), s("div", ee, [n[1] ||= c("p", {
84
101
  class: "end-feed-message",
85
102
  role: "status"
86
103
  }, " You've reached the end. ", -1), c("button", {
@@ -89,9 +106,9 @@ var R = {
89
106
  type: "button",
90
107
  disabled: e.loadMoreLocked,
91
108
  onClick: n[0] ||= (e) => t.$emit("retryEnd")
92
- }, " Check for more ", 8, V)]))])) : o("", !0);
109
+ }, " Check for more ", 8, U)]))])) : o("", !0);
93
110
  }
94
- }), U = /* @__PURE__ */ d({
111
+ }), te = /* @__PURE__ */ d({
95
112
  __name: "FeedFooter",
96
113
  props: {
97
114
  actions: {},
@@ -128,7 +145,7 @@ var R = {
128
145
  "can-retry-end",
129
146
  "show-load-more",
130
147
  "state"
131
- ])) : (b(), a(H, {
148
+ ])) : (b(), a(W, {
132
149
  key: 1,
133
150
  "can-retry-end": e.canRetryEnd,
134
151
  "has-error": e.hasError,
@@ -147,7 +164,7 @@ var R = {
147
164
  "show-load-more"
148
165
  ]));
149
166
  }
150
- }), W = ["role"], G = { class: "gallery-status" }, te = /* @__PURE__ */ d({
167
+ }), G = ["role"], K = { class: "gallery-status" }, ne = /* @__PURE__ */ d({
151
168
  __name: "FeedStatus",
152
169
  props: {
153
170
  actions: {},
@@ -161,7 +178,7 @@ var R = {
161
178
  return (n, u) => (b(), s("main", {
162
179
  class: "gallery-shell",
163
180
  role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
164
- }, [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, {
181
+ }, [c("p", K, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(te, {
165
182
  key: 0,
166
183
  actions: t.actions,
167
184
  "can-retry-end": t.canRetryEnd,
@@ -183,10 +200,10 @@ var R = {
183
200
  "is-loading",
184
201
  "load-more-locked",
185
202
  "state"
186
- ])) : o("", !0)], 8, W));
203
+ ])) : o("", !0)], 8, G));
187
204
  }
188
205
  });
189
- function ne(e) {
206
+ function q(e) {
190
207
  return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
191
208
  }
192
209
  //#endregion
@@ -195,7 +212,7 @@ function re(e) {
195
212
  let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
196
213
  return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
197
214
  }
198
- function K(e) {
215
+ function J(e) {
199
216
  return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
200
217
  }
201
218
  function ie(e) {
@@ -208,7 +225,7 @@ function ae(e, t, n) {
208
225
  items: []
209
226
  };
210
227
  let r = Math.max(0, n.gap), i = Number.isFinite(n.additionalHeight) ? Math.max(0, n.additionalHeight ?? 0) : 0, a = Math.max(1, n.minColumnWidth), o = Math.max(1, Math.floor((t + r) / (a + r))), s = (t - r * (o - 1)) / o, c = Array.from({ length: o }, () => 0), l = e.map((e) => {
211
- let t = K(c), n = s * re(e) + i, a = {
228
+ let t = J(c), n = s * re(e) + i, a = {
212
229
  x: t * (s + r),
213
230
  y: c[t],
214
231
  width: s,
@@ -235,7 +252,7 @@ function oe(e, t) {
235
252
  }), n.set(e.x, i);
236
253
  }), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
237
254
  }
238
- function q(e, t) {
255
+ function Y(e, t) {
239
256
  let n = 0, r = 0, i = e.length;
240
257
  for (; r < i;) {
241
258
  let a = Math.floor((r + i) / 2);
@@ -246,10 +263,10 @@ function q(e, t) {
246
263
  inspected: n
247
264
  };
248
265
  }
249
- function se(e, t) {
266
+ function X(e, t) {
250
267
  let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
251
268
  return e.columns.forEach((e) => {
252
- let t = q(e, r);
269
+ let t = Y(e, r);
253
270
  o += t.inspected;
254
271
  for (let n = t.index; n < e.length; n += 1) {
255
272
  let t = e[n];
@@ -261,14 +278,14 @@ function se(e, t) {
261
278
  inspected: o
262
279
  };
263
280
  }
264
- function J(e) {
281
+ function Z(e) {
265
282
  return e?.minColumnWidth ?? 240;
266
283
  }
267
- function Y(e, t) {
284
+ function se(e, t) {
268
285
  let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
269
286
  return a === void 0 ? i : Math.min(i, a);
270
287
  }
271
- function X(e) {
288
+ function ce(e) {
272
289
  if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
273
290
  let t = e?.overscan;
274
291
  if (t) {
@@ -282,10 +299,10 @@ function X(e) {
282
299
  }
283
300
  //#endregion
284
301
  //#region src/core/scrollbar.ts
285
- function Z(e, t, n) {
302
+ function le(e, t, n) {
286
303
  return Math.min(n, Math.max(t, e));
287
304
  }
288
- function ce({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
305
+ function ue({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
289
306
  let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
290
307
  if (!(c > 0 && o > 0)) return {
291
308
  maximumScrollPosition: c,
@@ -294,23 +311,23 @@ function ce({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
294
311
  thumbSize: o,
295
312
  thumbTravel: 0
296
313
  };
297
- let l = Z(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
314
+ let l = le(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
298
315
  return {
299
316
  maximumScrollPosition: c,
300
317
  scrollable: !0,
301
- thumbOffset: u * (Z(n, 0, c) / c),
318
+ thumbOffset: u * (le(n, 0, c) / c),
302
319
  thumbSize: l,
303
320
  thumbTravel: u
304
321
  };
305
322
  }
306
323
  //#endregion
307
324
  //#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
308
- var le = ["aria-hidden"], ue = [
325
+ var de = ["aria-hidden"], fe = [
309
326
  "aria-controls",
310
327
  "aria-valuemax",
311
328
  "aria-valuenow",
312
329
  "tabindex"
313
- ], de = 32, fe = 40, pe = 120, me = /* @__PURE__ */ d({
330
+ ], pe = 32, me = 40, he = 120, ge = /* @__PURE__ */ d({
314
331
  __name: "GalleryScrollbar",
315
332
  props: {
316
333
  contentSize: {},
@@ -332,16 +349,16 @@ var le = ["aria-hidden"], ue = [
332
349
  function k() {
333
350
  g !== null && clearTimeout(g), g = setTimeout(() => {
334
351
  g = null, o.value || (l.value = !1);
335
- }, pe);
352
+ }, he);
336
353
  }
337
354
  function A() {
338
355
  l.value = !0, k();
339
356
  }
340
357
  function j() {
341
358
  let e = t.scrollElement, r = i.value;
342
- return !e || !r ? n : ce({
359
+ return !e || !r ? n : ue({
343
360
  contentSize: e.scrollHeight,
344
- minimumThumbSize: de,
361
+ minimumThumbSize: pe,
345
362
  scrollPosition: e.scrollTop,
346
363
  trackSize: r.clientHeight,
347
364
  viewportSize: e.clientHeight
@@ -394,7 +411,7 @@ var le = ["aria-hidden"], ue = [
394
411
  }
395
412
  function z(e) {
396
413
  if (!E.value) return;
397
- let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - fe : e.key === "ArrowDown" ? r + fe : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
414
+ let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - me : e.key === "ArrowDown" ? r + me : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
398
415
  i !== null && (e.preventDefault(), A(), P(i));
399
416
  }
400
417
  function B(e) {
@@ -440,15 +457,15 @@ var le = ["aria-hidden"], ue = [
440
457
  onPointerdown: I,
441
458
  onPointermove: L,
442
459
  onPointerup: R
443
- }, null, 44, ue)], 42, le));
460
+ }, null, 44, fe)], 42, de));
444
461
  }
445
- }), he = (e) => {
462
+ }), _e = (e) => {
446
463
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
447
464
  return !1;
448
- }, ge = (e) => e === "", _e = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ve = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ye = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), be = (e) => {
449
- let t = ye(e);
465
+ }, ve = (e) => e === "", ye = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), be = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), xe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Se = (e) => {
466
+ let t = xe(e);
450
467
  return t.charAt(0).toUpperCase() + t.slice(1);
451
- }, xe = {
468
+ }, Ce = {
452
469
  xmlns: "http://www.w3.org/2000/svg",
453
470
  width: 24,
454
471
  height: 24,
@@ -458,27 +475,27 @@ var le = ["aria-hidden"], ue = [
458
475
  "stroke-width": 2,
459
476
  "stroke-linecap": "round",
460
477
  "stroke-linejoin": "round"
461
- }, Se = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = xe.width, color: s = xe.stroke, ...c }, { slots: l }) => p("svg", {
462
- ...xe,
478
+ }, we = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Ce.width, color: s = Ce.stroke, ...c }, { slots: l }) => p("svg", {
479
+ ...Ce,
463
480
  ...c,
464
481
  width: o,
465
482
  height: o,
466
483
  stroke: s,
467
- "stroke-width": ge(n) || ge(r) || n === !0 || r === !0 ? Number(i || a || xe["stroke-width"]) * 24 / Number(o) : i || a || xe["stroke-width"],
468
- class: _e("lucide", c.class, ...e ? [`lucide-${ve(be(e))}-icon`, `lucide-${ve(e)}`] : ["lucide-icon"]),
469
- ...!l.default && !he(c) && { "aria-hidden": "true" }
470
- }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Ce = (e, t) => (n, { slots: r, attrs: i }) => p(Se, {
484
+ "stroke-width": ve(n) || ve(r) || n === !0 || r === !0 ? Number(i || a || Ce["stroke-width"]) * 24 / Number(o) : i || a || Ce["stroke-width"],
485
+ class: ye("lucide", c.class, ...e ? [`lucide-${be(Se(e))}-icon`, `lucide-${be(e)}`] : ["lucide-icon"]),
486
+ ...!l.default && !_e(c) && { "aria-hidden": "true" }
487
+ }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Te = (e, t) => (n, { slots: r, attrs: i }) => p(we, {
471
488
  ...i,
472
489
  ...n,
473
490
  iconNode: t,
474
491
  name: e
475
- }, r), we = Ce("chevron-left", [["path", {
492
+ }, r), Ee = Te("chevron-left", [["path", {
476
493
  d: "m15 18-6-6 6-6",
477
494
  key: "1wnfg3"
478
- }]]), Te = Ce("chevron-right", [["path", {
495
+ }]]), De = Te("chevron-right", [["path", {
479
496
  d: "m9 18 6-6-6-6",
480
497
  key: "mthhwq"
481
- }]]), Ee = Ce("pause", [["rect", {
498
+ }]]), Oe = Te("pause", [["rect", {
482
499
  x: "14",
483
500
  y: "3",
484
501
  width: "5",
@@ -492,10 +509,10 @@ var le = ["aria-hidden"], ue = [
492
509
  height: "18",
493
510
  rx: "1",
494
511
  key: "1wsw3u"
495
- }]]), De = Ce("play", [["path", {
512
+ }]]), ke = Te("play", [["path", {
496
513
  d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
497
514
  key: "10ikf1"
498
- }]]), Oe = Ce("volume-2", [
515
+ }]]), Ae = Te("volume-2", [
499
516
  ["path", {
500
517
  d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
501
518
  key: "uqj9uw"
@@ -508,7 +525,7 @@ var le = ["aria-hidden"], ue = [
508
525
  d: "M19.364 18.364a9 9 0 0 0 0-12.728",
509
526
  key: "ijwkga"
510
527
  }]
511
- ]), ke = Ce("volume-x", [
528
+ ]), je = Te("volume-x", [
512
529
  ["path", {
513
530
  d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
514
531
  key: "uqj9uw"
@@ -527,22 +544,22 @@ var le = ["aria-hidden"], ue = [
527
544
  y2: "15",
528
545
  key: "5ykzw1"
529
546
  }]
530
- ]), Ae = {
547
+ ]), Me = {
531
548
  401: "Authentication required",
532
549
  403: "Access forbidden",
533
550
  404: "Preview not found",
534
551
  419: "Session expired",
535
552
  500: "Server error"
536
553
  };
537
- function je(e) {
554
+ function Ne(e) {
538
555
  return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
539
556
  }
540
- function Me(e) {
541
- return Ae[je(e)] ?? "Preview unavailable";
557
+ function Pe(e) {
558
+ return Me[Ne(e)] ?? "Preview unavailable";
542
559
  }
543
560
  //#endregion
544
561
  //#region src/components/CardRegion.vue
545
- var Ne = /* @__PURE__ */ d({
562
+ var Fe = /* @__PURE__ */ d({
546
563
  __name: "CardRegion",
547
564
  props: {
548
565
  index: {},
@@ -557,7 +574,7 @@ var Ne = /* @__PURE__ */ d({
557
574
  total: {}
558
575
  },
559
576
  setup(e) {
560
- let t = e, n = r(() => N(t.item, t.mediaIndex)), i = r(() => M(t.item)), o = r(() => P(t.item, n.value)), c = r(() => ({
577
+ let t = e, n = r(() => F(t.item, t.mediaIndex)), i = r(() => P(t.item)), o = r(() => I(t.item, n.value)), c = r(() => ({
561
578
  height: `${t.region.height}px`,
562
579
  paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
563
580
  paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
@@ -589,18 +606,18 @@ var Ne = /* @__PURE__ */ d({
589
606
  "total"
590
607
  ]))], 38));
591
608
  }
592
- }), Pe = [
609
+ }), Ie = [
593
610
  "max",
594
611
  "value",
595
612
  "aria-valuetext",
596
613
  "disabled"
597
- ], Fe = {
614
+ ], Le = {
598
615
  key: 0,
599
616
  class: "media-controls-row"
600
- }, Ie = ["aria-label", "title"], Le = { class: "media-controls-audio" }, Re = ["aria-label", "title"], ze = ["value", "aria-valuetext"], Be = {
617
+ }, Re = ["aria-label", "title"], ze = { class: "media-controls-audio" }, Be = ["aria-label", "title"], Ve = ["value", "aria-valuetext"], He = {
601
618
  class: "media-control-time",
602
619
  "aria-live": "off"
603
- }, Ve = /* @__PURE__ */ d({
620
+ }, Ue = /* @__PURE__ */ d({
604
621
  __name: "MediaControls",
605
622
  props: {
606
623
  currentTime: {},
@@ -648,35 +665,35 @@ var Ne = /* @__PURE__ */ d({
648
665
  "aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
649
666
  disabled: f.value <= 0,
650
667
  onInput: n[0] ||= (e) => i("seek", d(e))
651
- }, null, 44, Pe), e.layout === "reel" ? (b(), s("div", Fe, [
668
+ }, null, 44, Ie), e.layout === "reel" ? (b(), s("div", Le, [
652
669
  c("button", {
653
670
  type: "button",
654
671
  class: "media-control-button media-control-playback",
655
672
  "aria-label": e.playing ? "Pause video" : "Play video",
656
673
  title: e.playing ? "Pause" : "Play",
657
674
  onClick: n[1] ||= (e) => i("togglePlayback")
658
- }, [e.playing ? (b(), a(E(Ee), {
675
+ }, [e.playing ? (b(), a(E(Oe), {
659
676
  key: 0,
660
677
  size: 18,
661
678
  fill: "currentColor"
662
- })) : (b(), a(E(De), {
679
+ })) : (b(), a(E(ke), {
663
680
  key: 1,
664
681
  size: 18,
665
682
  fill: "currentColor"
666
- }))], 8, Ie),
667
- c("div", Le, [c("button", {
683
+ }))], 8, Re),
684
+ c("div", ze, [c("button", {
668
685
  type: "button",
669
686
  class: "media-control-button",
670
687
  "aria-label": e.muted ? "Unmute video" : "Mute video",
671
688
  title: e.muted ? "Unmute" : "Mute",
672
689
  onClick: n[2] ||= (e) => i("toggleMute")
673
- }, [e.muted || e.volume === 0 ? (b(), a(E(ke), {
690
+ }, [e.muted || e.volume === 0 ? (b(), a(E(je), {
674
691
  key: 0,
675
692
  size: 18
676
- })) : (b(), a(E(Oe), {
693
+ })) : (b(), a(E(Ae), {
677
694
  key: 1,
678
695
  size: 18
679
- }))], 8, Re), c("input", {
696
+ }))], 8, Be), c("input", {
680
697
  class: "media-control-range media-control-volume",
681
698
  type: "range",
682
699
  min: "0",
@@ -687,14 +704,14 @@ var Ne = /* @__PURE__ */ d({
687
704
  "aria-label": "Video volume",
688
705
  "aria-valuetext": `${Math.round(e.volume * 100)} percent`,
689
706
  onInput: n[3] ||= (e) => i("volumeChange", d(e))
690
- }, null, 44, ze)]),
691
- c("output", Be, T(u(p.value)) + " / " + T(u(f.value)), 1)
707
+ }, null, 44, Ve)]),
708
+ c("output", He, T(u(p.value)) + " / " + T(u(f.value)), 1)
692
709
  ])) : o("", !0)], 34));
693
710
  }
694
711
  });
695
712
  //#endregion
696
713
  //#region src/components/useReelVideoActivity.ts
697
- function He(e) {
714
+ function We(e) {
698
715
  let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
699
716
  function i() {
700
717
  if (!t.value) {
@@ -728,21 +745,21 @@ function He(e) {
728
745
  }
729
746
  //#endregion
730
747
  //#region src/core/mediaType.ts
731
- var Ue = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
732
- function We(e) {
748
+ var Ge = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
749
+ function Ke(e) {
733
750
  try {
734
- return Ue.test(new URL(e).pathname);
751
+ return Ge.test(new URL(e).pathname);
735
752
  } catch {
736
- return Ue.test(e.split("?")[0] ?? e);
753
+ return Ge.test(e.split("?")[0] ?? e);
737
754
  }
738
755
  }
739
- function Ge(e, t) {
740
- return e === void 0 ? We(t) : e === "video";
756
+ function qe(e, t) {
757
+ return e === void 0 ? Ke(t) : e === "video";
741
758
  }
742
759
  //#endregion
743
760
  //#region src/components/useMediaLoading.ts
744
- function Ke(e) {
745
- let t = r(() => Ge(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
761
+ function Je(e) {
762
+ let t = r(() => qe(e.mediaType(), e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.layout() === "reel" && !e.active() ? "none" : e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
746
763
  return O(i, (t, n) => {
747
764
  n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
748
765
  }), {
@@ -753,7 +770,7 @@ function Ke(e) {
753
770
  }
754
771
  //#endregion
755
772
  //#region src/components/useMediaReadiness.ts
756
- function qe(e) {
773
+ function Ye(e) {
757
774
  let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = null, l = !1, u = r(() => s.value ? "error" : o.value ? "loading" : e.previewState());
758
775
  function d() {
759
776
  c !== null && clearTimeout(c), c = null;
@@ -810,7 +827,7 @@ function qe(e) {
810
827
  }
811
828
  //#endregion
812
829
  //#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
813
- var Je = [
830
+ var Xe = [
814
831
  "data-post-id",
815
832
  "data-media-index",
816
833
  "aria-hidden",
@@ -818,12 +835,12 @@ var Je = [
818
835
  "inert",
819
836
  "role",
820
837
  "tabindex"
821
- ], Ye = { class: "media-card-content" }, Xe = ["data-media-direction"], Ze = ["data-media-index"], Qe = {
838
+ ], Ze = { class: "media-card-content" }, Qe = ["data-media-direction"], $e = ["data-media-index"], et = {
822
839
  key: 0,
823
840
  "data-test": "media-loading",
824
841
  class: "media-loading",
825
842
  "aria-hidden": "true"
826
- }, $e = ["aria-label"], et = { class: "media-error-code" }, tt = [
843
+ }, tt = ["aria-label"], nt = { class: "media-error-code" }, rt = [
827
844
  "data-source-generation",
828
845
  "src",
829
846
  "width",
@@ -832,14 +849,14 @@ var Je = [
832
849
  "loop",
833
850
  "muted",
834
851
  "preload"
835
- ], nt = [
852
+ ], it = [
836
853
  "data-source-generation",
837
854
  "src",
838
855
  "width",
839
856
  "height",
840
857
  "fetchpriority",
841
858
  "loading"
842
- ], rt = ["aria-label"], it = ["aria-label"], at = ["aria-label"], ot = 40, st = 160, ct = 24, lt = /* @__PURE__ */ d({
859
+ ], at = ["aria-label"], ot = ["aria-label"], st = ["aria-label"], ct = 40, lt = 160, ut = 24, dt = /* @__PURE__ */ d({
843
860
  __name: "MediaCard",
844
861
  props: {
845
862
  active: { type: Boolean },
@@ -875,124 +892,124 @@ var Je = [
875
892
  function S(e = !1, t = "pointer") {
876
893
  e && x("activate", t);
877
894
  }
878
- 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.type : O.value.preview.type ?? O.value.type), L = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), R = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), { effectivePreviewState: z, failSourceAttempt: B, imageElement: ee, markSourceReady: V, noteSourceActivity: H, retrySource: U, sourceGeneration: W, videoElement: G } = qe({
879
- identity: () => `${l.item.postId}:${D.value}:${l.mediaSource ?? "preview"}:${F.value}:${I.value ?? ""}`,
895
+ let C = r(() => P(l.item)), D = r(() => F(l.item, l.mediaIndex)), O = r(() => I(l.item, D.value)), M = r(() => N(O.value, l.mediaSource ?? "preview")), L = r(() => M.value.src), R = r(() => M.value.type), z = r(() => M.value.width), B = r(() => M.value.height), { effectivePreviewState: V, failSourceAttempt: H, imageElement: ee, markSourceReady: U, noteSourceActivity: W, retrySource: te, sourceGeneration: G, videoElement: K } = Ye({
896
+ identity: () => `${l.item.postId}:${D.value}:${l.mediaSource ?? "preview"}:${L.value}:${R.value ?? ""}`,
880
897
  mediaIndex: () => D.value,
881
898
  onError: (e) => x("error", e),
882
899
  onReady: (e) => x("ready", e),
883
900
  previewState: () => l.previewState
884
- }), te = w(0), ne = w(0), re = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), K = w(!1), ie = w(1), ae = 1, { effectiveMuted: oe, onPlaying: q, playbackAllowed: se } = He({
901
+ }), ne = w(0), q = w(0), re = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), J = w(!1), ie = w(1), ae = 1, { effectiveMuted: oe, onPlaying: Y, playbackAllowed: X } = We({
885
902
  active: () => l.active,
886
903
  layout: () => l.layout,
887
- videoElement: G,
904
+ videoElement: K,
888
905
  videoIsMuted: re,
889
- videoIsPlaying: K
890
- }), J = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
891
- function Y(e) {
906
+ videoIsPlaying: J
907
+ }), Z = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
908
+ function se(e) {
892
909
  return e.detail === 0 ? "keyboard" : "pointer";
893
910
  }
894
- function X(e, t) {
911
+ function ce(e, t) {
895
912
  let n = C.value.length, r = (e + n) % n;
896
913
  r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
897
914
  }
898
- function Z(e, t, n) {
915
+ function le(e, t, n) {
899
916
  return t === 1 ? e * 16 : t === 2 ? e * n : e;
900
917
  }
901
- function ce() {
918
+ function ue() {
902
919
  f = 0, p = !1, d !== null && clearTimeout(d), d = null;
903
920
  }
904
- function le() {
905
- d !== null && clearTimeout(d), d = setTimeout(ce, st);
921
+ function de() {
922
+ d !== null && clearTimeout(d), d = setTimeout(ue, lt);
906
923
  }
907
- function ue(e) {
924
+ function fe(e) {
908
925
  if (C.value.length <= 1) return;
909
- let t = e.currentTarget?.clientWidth || 1, n = Z(e.deltaX, e.deltaMode, t);
910
- if (n === 0 || (e.preventDefault(), le(), p) || (f += n, Math.abs(f) < ct)) return;
926
+ let t = e.currentTarget?.clientWidth || 1, n = le(e.deltaX, e.deltaMode, t);
927
+ if (n === 0 || (e.preventDefault(), de(), p) || (f += n, Math.abs(f) < ut)) return;
911
928
  let r = Math.sign(f);
912
- f = 0, p = !0, X(D.value + r);
929
+ f = 0, p = !0, ce(D.value + r);
913
930
  }
914
- function de(e) {
931
+ function pe(e) {
915
932
  let t = e.touches[0];
916
933
  l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
917
934
  }
918
- function fe(e) {
935
+ function me(e) {
919
936
  let t = e.changedTouches[0];
920
937
  if (m === null || g === null || !t) return;
921
938
  let n = m - t.clientX, r = g - t.clientY;
922
- m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < ot || X(D.value + Math.sign(n)));
939
+ m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < ct || ce(D.value + Math.sign(n)));
923
940
  }
924
- let { imageLoading: pe, mediaIsTimed: me, videoPreload: he } = Ke({
941
+ let { imageLoading: he, mediaIsTimed: ge, videoPreload: _e } = Je({
925
942
  active: () => l.active,
926
943
  fetchPriority: () => l.fetchPriority,
927
944
  layout: () => l.layout,
928
- mediaSource: () => F.value,
929
- mediaType: () => I.value,
930
- videoElement: G
931
- }), ge = r(() => l.layout === "reel" && l.stationaryReelControls === !0), _e = r(() => me.value && z.value === "ready" && (!ge.value || !!(l.active && l.reelControlsTarget))), ve = r(() => `${l.item.postId}:${D.value}:${F.value}`);
932
- function ye(e) {
933
- l.layout === "reel" && (e.stopPropagation(), be());
945
+ mediaSource: () => L.value,
946
+ mediaType: () => R.value,
947
+ videoElement: K
948
+ }), ve = r(() => l.layout === "reel" && l.stationaryReelControls === !0), ye = r(() => ge.value && V.value === "ready" && (!ve.value || !!(l.active && l.reelControlsTarget))), be = r(() => `${l.item.postId}:${D.value}:${L.value}`);
949
+ function xe(e) {
950
+ l.layout === "reel" && (e.stopPropagation(), Se());
934
951
  }
935
- async function be() {
936
- if (!(!G.value || !se.value)) {
937
- if (K.value) {
938
- G.value.pause();
952
+ async function Se() {
953
+ if (!(!K.value || !X.value)) {
954
+ if (J.value) {
955
+ K.value.pause();
939
956
  return;
940
957
  }
941
958
  try {
942
- await G.value.play();
959
+ await K.value.play();
943
960
  } catch {
944
- K.value = !1;
961
+ J.value = !1;
945
962
  }
946
963
  }
947
964
  }
948
- function xe(e) {
965
+ function Ce(e) {
949
966
  return Number.isFinite(e) ? Math.max(0, e) : 0;
950
967
  }
951
- function Se(e) {
952
- let t = e?.currentTarget ?? G.value;
953
- t && (te.value = xe(t.currentTime), ne.value = xe(t.duration), se.value && (re.value = t.muted), ie.value = t.volume, t.volume > 0 && (ae = t.volume));
968
+ function we(e) {
969
+ let t = e?.currentTarget ?? K.value;
970
+ t && (ne.value = Ce(t.currentTime), q.value = Ce(t.duration), X.value && (re.value = t.muted), ie.value = t.volume, t.volume > 0 && (ae = t.volume));
954
971
  }
955
- function Ce(e) {
956
- Se(e), V(e);
972
+ function Te(e) {
973
+ we(e), U(e);
957
974
  }
958
- function Ee() {
959
- K.value = !1, x("ended", D.value);
975
+ function Oe() {
976
+ J.value = !1, x("ended", D.value);
960
977
  }
961
- function De(e) {
962
- let t = G.value;
963
- !t || !Number.isFinite(e) || (t.currentTime = Math.min(xe(t.duration), Math.max(0, e)), te.value = t.currentTime);
978
+ function ke(e) {
979
+ let t = K.value;
980
+ !t || !Number.isFinite(e) || (t.currentTime = Math.min(Ce(t.duration), Math.max(0, e)), ne.value = t.currentTime);
964
981
  }
965
- function Oe(e) {
966
- let t = G.value;
982
+ function Ae(e) {
983
+ let t = K.value;
967
984
  if (!t || !Number.isFinite(e)) return;
968
985
  let n = Math.min(1, Math.max(0, e));
969
- t.volume = n, t.muted = n === 0, n > 0 && (ae = n), Se();
986
+ t.volume = n, t.muted = n === 0, n > 0 && (ae = n), we();
970
987
  }
971
- function ke() {
972
- let e = G.value;
973
- e && (e.muted && e.volume === 0 && (e.volume = ae), e.muted = !e.muted, Se());
988
+ function je() {
989
+ let e = K.value;
990
+ e && (e.muted && e.volume === 0 && (e.volume = ae), e.muted = !e.muted, we());
974
991
  }
975
992
  return v(() => {
976
- ce();
993
+ ue();
977
994
  }), (r, i) => (b(), s("article", {
978
995
  "data-post-id": e.item.postId,
979
996
  "data-media-index": D.value,
980
997
  class: h(["media-card", {
981
998
  "media-card--entering": e.entering,
982
999
  "media-card--leaving": e.leaving,
983
- "media-card--error": E(z) === "error",
1000
+ "media-card--error": E(V) === "error",
984
1001
  "media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
985
1002
  }]),
986
1003
  style: _(e.itemStyle),
987
1004
  "aria-hidden": e.leaving || void 0,
988
- "aria-busy": E(z) === "loading",
1005
+ "aria-busy": E(V) === "loading",
989
1006
  inert: e.leaving || void 0,
990
- role: e.interactive && !e.leaving && !J.value ? "button" : void 0,
991
- tabindex: e.interactive && !e.leaving && !J.value ? 0 : void 0,
992
- onClick: i[15] ||= (t) => S(e.interactive && !J.value, Y(t)),
993
- onKeydown: [i[16] ||= A((t) => S(e.interactive && !J.value, "keyboard"), ["enter"]), i[17] ||= A(j((t) => S(e.interactive && !J.value, "keyboard"), ["prevent"]), ["space"])]
994
- }, [c("div", Ye, [
995
- e.cardHeader ? (b(), a(Ne, {
1007
+ role: e.interactive && !e.leaving && !Z.value ? "button" : void 0,
1008
+ tabindex: e.interactive && !e.leaving && !Z.value ? 0 : void 0,
1009
+ onClick: i[15] ||= (t) => S(e.interactive && !Z.value, se(t)),
1010
+ onKeydown: [i[16] ||= A((t) => S(e.interactive && !Z.value, "keyboard"), ["enter"]), i[17] ||= A(j((t) => S(e.interactive && !Z.value, "keyboard"), ["prevent"]), ["space"])]
1011
+ }, [c("div", Ze, [
1012
+ e.cardHeader ? (b(), a(Fe, {
996
1013
  key: 0,
997
1014
  index: e.index,
998
1015
  item: e.item,
@@ -1018,96 +1035,96 @@ var Je = [
1018
1035
  c("div", {
1019
1036
  class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
1020
1037
  "data-media-direction": y.value,
1021
- onWheel: ue,
1022
- onTouchstartPassive: de,
1023
- onTouchendPassive: fe
1038
+ onWheel: fe,
1039
+ onTouchstartPassive: pe,
1040
+ onTouchendPassive: me
1024
1041
  }, [
1025
1042
  u(n, { name: `media-slide-${y.value}` }, {
1026
1043
  default: k(() => [(b(), s("div", {
1027
- key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}:${E(W)}`,
1044
+ key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}:${E(G)}`,
1028
1045
  class: "media-card-frame",
1029
1046
  "data-media-index": D.value
1030
- }, [E(z) === "loading" ? (b(), s("div", Qe, [...i[18] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(z) === "error" ? (b(), s("div", {
1047
+ }, [E(V) === "loading" ? (b(), s("div", et, [...i[18] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(V) === "error" ? (b(), s("div", {
1031
1048
  key: 1,
1032
1049
  "data-test": "media-error",
1033
1050
  class: "media-error",
1034
1051
  role: "img",
1035
- "aria-label": `${E(je)(F.value)} ${E(Me)(F.value)}`
1052
+ "aria-label": `${E(Ne)(L.value)} ${E(Pe)(L.value)}`
1036
1053
  }, [
1037
- c("strong", et, T(E(je)(F.value)), 1),
1038
- c("span", null, T(E(Me)(F.value)), 1),
1054
+ c("strong", nt, T(E(Ne)(L.value)), 1),
1055
+ c("span", null, T(E(Pe)(L.value)), 1),
1039
1056
  c("button", {
1040
1057
  type: "button",
1041
1058
  "data-test": "media-retry",
1042
- onClick: i[0] ||= j((...e) => E(U) && E(U)(...e), ["stop"])
1059
+ onClick: i[0] ||= j((...e) => E(te) && E(te)(...e), ["stop"])
1043
1060
  }, "Retry")
1044
- ], 8, $e)) : o("", !0), E(me) ? (b(), s("video", {
1061
+ ], 8, tt)) : o("", !0), E(ge) ? (b(), s("video", {
1045
1062
  key: 2,
1046
1063
  ref_key: "videoElement",
1047
- ref: G,
1048
- "data-source-generation": E(W),
1064
+ ref: K,
1065
+ "data-source-generation": E(G),
1049
1066
  class: h(["media-preview", {
1050
- "media-preview--ready": E(z) === "ready",
1067
+ "media-preview--ready": E(V) === "ready",
1051
1068
  "media-preview--reel-video": e.layout === "reel"
1052
1069
  }]),
1053
- src: F.value,
1054
- width: L.value ?? void 0,
1055
- height: R.value ?? void 0,
1056
- autoplay: E(se),
1070
+ src: L.value,
1071
+ width: z.value ?? void 0,
1072
+ height: B.value ?? void 0,
1073
+ autoplay: E(X),
1057
1074
  loop: !e.advanceOnMediaEnd,
1058
1075
  muted: E(oe),
1059
1076
  playsinline: "",
1060
- preload: E(he),
1061
- onLoadedmetadata: Ce,
1062
- onProgress: i[1] ||= (...e) => E(H) && E(H)(...e),
1063
- onLoadeddata: i[2] ||= (...e) => E(H) && E(H)(...e),
1064
- onCanplay: i[3] ||= (...e) => E(H) && E(H)(...e),
1065
- onDurationchange: Se,
1066
- onTimeupdate: Se,
1067
- onVolumechange: Se,
1068
- onPlaying: i[4] ||= (...e) => E(q) && E(q)(...e),
1069
- onPause: i[5] ||= (e) => K.value = !1,
1070
- onEnded: Ee,
1071
- onClick: ye,
1072
- onError: i[6] ||= (...e) => E(B) && E(B)(...e)
1073
- }, null, 42, tt)) : (b(), s("img", {
1077
+ preload: E(_e),
1078
+ onLoadedmetadata: Te,
1079
+ onProgress: i[1] ||= (...e) => E(W) && E(W)(...e),
1080
+ onLoadeddata: i[2] ||= (...e) => E(W) && E(W)(...e),
1081
+ onCanplay: i[3] ||= (...e) => E(W) && E(W)(...e),
1082
+ onDurationchange: we,
1083
+ onTimeupdate: we,
1084
+ onVolumechange: we,
1085
+ onPlaying: i[4] ||= (...e) => E(Y) && E(Y)(...e),
1086
+ onPause: i[5] ||= (e) => J.value = !1,
1087
+ onEnded: Oe,
1088
+ onClick: xe,
1089
+ onError: i[6] ||= (...e) => E(H) && E(H)(...e)
1090
+ }, null, 42, rt)) : (b(), s("img", {
1074
1091
  key: 3,
1075
1092
  ref_key: "imageElement",
1076
1093
  ref: ee,
1077
- "data-source-generation": E(W),
1078
- class: h(["media-preview", { "media-preview--ready": E(z) === "ready" }]),
1079
- src: F.value,
1080
- width: L.value ?? void 0,
1081
- height: R.value ?? void 0,
1094
+ "data-source-generation": E(G),
1095
+ class: h(["media-preview", { "media-preview--ready": E(V) === "ready" }]),
1096
+ src: L.value,
1097
+ width: z.value ?? void 0,
1098
+ height: B.value ?? void 0,
1082
1099
  fetchpriority: e.fetchPriority,
1083
1100
  alt: "",
1084
1101
  decoding: "async",
1085
- loading: E(pe),
1086
- onLoad: i[7] ||= (...e) => E(V) && E(V)(...e),
1087
- onError: i[8] ||= (...e) => E(B) && E(B)(...e)
1088
- }, null, 42, nt))], 8, Ze))]),
1102
+ loading: E(he),
1103
+ onLoad: i[7] ||= (...e) => E(U) && E(U)(...e),
1104
+ onError: i[8] ||= (...e) => E(H) && E(H)(...e)
1105
+ }, null, 42, it))], 8, $e))]),
1089
1106
  _: 1
1090
1107
  }, 8, ["name"]),
1091
1108
  (b(), a(t, {
1092
- disabled: !ge.value || !e.reelControlsTarget,
1109
+ disabled: !ve.value || !e.reelControlsTarget,
1093
1110
  to: e.reelControlsTarget ?? "body"
1094
1111
  }, [u(n, {
1095
1112
  name: "vibe-reel-media-controls",
1096
- css: ge.value
1113
+ css: ve.value
1097
1114
  }, {
1098
- default: k(() => [_e.value ? (b(), a(Ve, {
1099
- key: ve.value,
1100
- "current-time": te.value,
1101
- "data-control-post-id": ge.value ? e.item.postId : void 0,
1102
- duration: ne.value,
1115
+ default: k(() => [ye.value ? (b(), a(Ue, {
1116
+ key: be.value,
1117
+ "current-time": ne.value,
1118
+ "data-control-post-id": ve.value ? e.item.postId : void 0,
1119
+ duration: q.value,
1103
1120
  layout: e.layout,
1104
1121
  muted: re.value,
1105
- playing: K.value,
1122
+ playing: J.value,
1106
1123
  volume: ie.value,
1107
- onSeek: De,
1108
- onToggleMute: ke,
1109
- onTogglePlayback: be,
1110
- onVolumeChange: Oe
1124
+ onSeek: ke,
1125
+ onToggleMute: je,
1126
+ onTogglePlayback: Se,
1127
+ onVolumeChange: Ae
1111
1128
  }, null, 8, [
1112
1129
  "current-time",
1113
1130
  "data-control-post-id",
@@ -1127,25 +1144,25 @@ var Je = [
1127
1144
  type: "button",
1128
1145
  class: "media-carousel-control media-carousel-control--previous",
1129
1146
  "aria-label": `Previous media for post ${e.item.postId}`,
1130
- onClick: i[9] ||= j((e) => X(D.value - 1, e), ["stop"]),
1147
+ onClick: i[9] ||= j((e) => ce(D.value - 1, e), ["stop"]),
1131
1148
  onKeydown: i[10] ||= j(() => {}, ["stop"])
1132
- }, [u(E(we), { size: 20 })], 40, rt), c("button", {
1149
+ }, [u(E(Ee), { size: 20 })], 40, at), c("button", {
1133
1150
  type: "button",
1134
1151
  class: "media-carousel-control media-carousel-control--next",
1135
1152
  "aria-label": `Next media for post ${e.item.postId}`,
1136
- onClick: i[11] ||= j((e) => X(D.value + 1, e), ["stop"]),
1153
+ onClick: i[11] ||= j((e) => ce(D.value + 1, e), ["stop"]),
1137
1154
  onKeydown: i[12] ||= j(() => {}, ["stop"])
1138
- }, [u(E(Te), { size: 20 })], 40, it)], 2)) : o("", !0),
1139
- J.value ? (b(), s("button", {
1155
+ }, [u(E(De), { size: 20 })], 40, ot)], 2)) : o("", !0),
1156
+ Z.value ? (b(), s("button", {
1140
1157
  key: 1,
1141
1158
  class: "media-card-activator",
1142
1159
  type: "button",
1143
1160
  "aria-label": `Open post ${e.item.postId}`,
1144
- onClick: i[13] ||= j((e) => r.$emit("activate", Y(e)), ["stop"]),
1161
+ onClick: i[13] ||= j((e) => r.$emit("activate", se(e)), ["stop"]),
1145
1162
  onKeydown: i[14] ||= j(() => {}, ["stop"])
1146
- }, null, 40, at)) : o("", !0)
1147
- ], 42, Xe),
1148
- e.cardFooter ? (b(), a(Ne, {
1163
+ }, null, 40, st)) : o("", !0)
1164
+ ], 42, Qe),
1165
+ e.cardFooter ? (b(), a(Fe, {
1149
1166
  key: 1,
1150
1167
  index: e.index,
1151
1168
  item: e.item,
@@ -1168,12 +1185,12 @@ var Je = [
1168
1185
  "style",
1169
1186
  "total"
1170
1187
  ])) : o("", !0)
1171
- ])], 46, Je));
1188
+ ])], 46, Xe));
1172
1189
  }
1173
- }), ut = { class: "masonry-feed-shell" }, dt = ["aria-hidden", "inert"], ft = {
1190
+ }), ft = { class: "masonry-feed-shell" }, pt = ["aria-hidden", "inert"], mt = {
1174
1191
  key: 0,
1175
1192
  class: "masonry-feed-status-overlay"
1176
- }, pt = 6, mt = 12, ht = 250, gt = /* @__PURE__ */ d({
1193
+ }, ht = 6, gt = 12, _t = 250, vt = /* @__PURE__ */ d({
1177
1194
  __name: "MasonryFeed",
1178
1195
  props: {
1179
1196
  enteringPostIds: {},
@@ -1209,10 +1226,10 @@ var Je = [
1209
1226
  "visible"
1210
1227
  ],
1211
1228
  setup(t, { expose: n, emit: i }) {
1212
- let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(pt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, I = null, L = null, R = r(() => ae(d.items, y.value, {
1229
+ let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(ht), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, R = r(() => ae(d.items, y.value, {
1213
1230
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1214
1231
  gap: x.value,
1215
- minColumnWidth: J(d.masonry)
1232
+ minColumnWidth: Z(d.masonry)
1216
1233
  })), z = r(() => {
1217
1234
  if (d.leavingPostIds.size === 0) return null;
1218
1235
  let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
@@ -1221,7 +1238,7 @@ var Je = [
1221
1238
  }]), t = ae(e.map(({ item: e }) => e), y.value, {
1222
1239
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1223
1240
  gap: x.value,
1224
- minColumnWidth: J(d.masonry)
1241
+ minColumnWidth: Z(d.masonry)
1225
1242
  });
1226
1243
  return {
1227
1244
  indices: e.map(({ index: e }) => e),
@@ -1234,53 +1251,53 @@ var Je = [
1234
1251
  ...t.layout,
1235
1252
  items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
1236
1253
  } : e;
1237
- }), ee = r(() => oe(R.value.items)), V = r(() => {
1254
+ }), V = r(() => oe(R.value.items)), H = r(() => {
1238
1255
  let e = z.value;
1239
1256
  return e ? oe(e.layout.items, e.indices) : null;
1240
- }), H = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), W = r(() => ({ height: `${H.value}px` })), G = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), te = r(() => new Set(A.value)), re = r(() => j.value.flatMap((e) => {
1257
+ }), ee = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), U = r(() => ({ height: `${ee.value}px` })), W = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), G = r(() => new Set(A.value)), K = r(() => j.value.flatMap((e) => {
1241
1258
  let t = d.items[e];
1242
1259
  return t ? [{
1243
- fetchPriority: te.value.has(e) ? "high" : "low",
1260
+ fetchPriority: G.value.has(e) ? "high" : "low",
1244
1261
  index: e,
1245
1262
  item: t
1246
1263
  }] : [];
1247
1264
  }));
1248
- function K(e, t) {
1265
+ function ne(e, t) {
1249
1266
  return [...new Set([...e, ...t])].sort((e, t) => e - t);
1250
1267
  }
1251
- function q(e, t) {
1268
+ function re(e, t) {
1252
1269
  return e.length === t.length && e.every((e, n) => e === t[n]);
1253
1270
  }
1254
- function X(e) {
1271
+ function J(e) {
1255
1272
  let t = {
1256
1273
  scrollTop: M - k.value,
1257
1274
  viewportHeight: C.value
1258
- }, n = V.value, r = se(n ?? ee.value, {
1275
+ }, n = H.value, r = X(n ?? V.value, {
1259
1276
  ...t,
1260
1277
  overscan: e
1261
1278
  }).indices;
1262
- return K(r, d.leavingPostIds.size === 0 ? [] : se(ee.value, {
1279
+ return ne(r, d.leavingPostIds.size === 0 ? [] : X(V.value, {
1263
1280
  ...t,
1264
1281
  overscan: e
1265
1282
  }).indices);
1266
1283
  }
1267
- function Z() {
1268
- let e = d.suspended ? [] : X(0), t = X(Y(d.masonry, C.value));
1269
- q(A.value, e) || (A.value = e), q(j.value, t) || (j.value = t);
1284
+ function Y() {
1285
+ let e = d.suspended ? [] : J(0), t = J(se(d.masonry, C.value));
1286
+ re(A.value, e) || (A.value = e), re(j.value, t) || (j.value = t);
1270
1287
  }
1271
1288
  function ce() {
1272
- if (L !== null) return;
1273
- L = -1;
1289
+ if (I !== null) return;
1290
+ I = -1;
1274
1291
  let e = requestAnimationFrame(() => {
1275
- L = null, Z();
1292
+ I = null, Y();
1276
1293
  });
1277
- L !== null && (L = e);
1294
+ I !== null && (I = e);
1278
1295
  }
1279
1296
  let le = /* @__PURE__ */ new Set();
1280
- O(() => [...te.value].flatMap((e) => {
1297
+ O(() => [...G.value].flatMap((e) => {
1281
1298
  let t = d.items[e];
1282
1299
  if (!t) return [];
1283
- let n = d.mediaIndices.get(t.postId) ?? 0, r = F(t.postId, n);
1300
+ let n = d.mediaIndices.get(t.postId) ?? 0, r = L(t.postId, n);
1284
1301
  return d.previewStates.get(r) === "ready" ? [{
1285
1302
  key: r,
1286
1303
  mediaIndex: n,
@@ -1316,31 +1333,31 @@ var Je = [
1316
1333
  let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
1317
1334
  T.value = Math.max(0, e.clientHeight - n);
1318
1335
  let r = g.value;
1319
- r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, Z());
1336
+ r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, Y());
1320
1337
  }
1321
1338
  function fe(e) {
1322
1339
  let t = e.ownerDocument.documentElement.clientWidth;
1323
- y.value = e.clientWidth, x.value = Math.min(mt, Math.max(pt, t * .0075)), de();
1340
+ y.value = e.clientWidth, x.value = Math.min(gt, Math.max(ht, t * .0075)), de();
1324
1341
  }
1325
1342
  function pe(e) {
1326
1343
  let t = e.currentTarget;
1327
- t && (M = t.scrollTop, ce(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ne(t) && f("loadMore"));
1344
+ t && (M = t.scrollTop, ce(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && q(t) && f("loadMore"));
1328
1345
  }
1329
- function he() {
1346
+ function me() {
1330
1347
  let e = p.value;
1331
- Date.now() >= l && !d.loadMoreLocked && e && ne(e) && f("loadMore");
1348
+ Date.now() >= l && !d.loadMoreLocked && e && q(e) && f("loadMore");
1332
1349
  }
1333
1350
  O(() => d.items.length, (e, t) => {
1334
- e > 0 && e < t && (l = Date.now() + ht);
1351
+ e > 0 && e < t && (l = Date.now() + _t);
1335
1352
  });
1336
- function ge() {
1353
+ function he() {
1337
1354
  return p.value;
1338
1355
  }
1339
1356
  return O(g, (e) => {
1340
- N?.disconnect(), N = null, I !== null && cancelAnimationFrame(I), e && (fe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
1357
+ N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (fe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
1341
1358
  let n = t?.contentRect.width ?? e.clientWidth;
1342
- Math.abs(n - y.value) < .5 || (I = requestAnimationFrame(() => {
1343
- I = null, fe(e);
1359
+ Math.abs(n - y.value) < .5 || (F = requestAnimationFrame(() => {
1360
+ F = null, fe(e);
1344
1361
  }));
1345
1362
  }), N.observe(e)));
1346
1363
  }), O(p, (e) => {
@@ -1350,12 +1367,12 @@ var Je = [
1350
1367
  B,
1351
1368
  () => d.suspended,
1352
1369
  () => d.masonry
1353
- ], Z, { flush: "post" }), v(() => {
1354
- N?.disconnect(), P?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
1370
+ ], Y, { flush: "post" }), v(() => {
1371
+ N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
1355
1372
  }), n({
1356
- getScrollElement: ge,
1357
- loadIfNearBottom: he
1358
- }), (n, r) => (b(), s("div", ut, [
1373
+ getScrollElement: he,
1374
+ loadIfNearBottom: me
1375
+ }), (n, r) => (b(), s("div", ft, [
1359
1376
  c("main", {
1360
1377
  id: m,
1361
1378
  ref_key: "galleryElement",
@@ -1369,9 +1386,9 @@ var Je = [
1369
1386
  ref_key: "masonryElement",
1370
1387
  ref: g,
1371
1388
  class: h(["masonry", { "masonry--ready": y.value > 0 }]),
1372
- style: _(W.value),
1389
+ style: _(U.value),
1373
1390
  "aria-label": "Media gallery"
1374
- }, [(b(!0), s(e, null, S(re.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(lt, {
1391
+ }, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(dt, {
1375
1392
  key: n.postId,
1376
1393
  class: "masonry-item",
1377
1394
  entering: t.enteringPostIds.has(n.postId),
@@ -1387,7 +1404,7 @@ var Je = [
1387
1404
  layout: "masonry",
1388
1405
  "loaded-count": t.items.length,
1389
1406
  "media-index": t.mediaIndices.get(n.postId) ?? 0,
1390
- "preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1407
+ "preview-state": t.previewStates.get(E(L)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1391
1408
  total: t.total,
1392
1409
  onActivate: (e) => f("activate", n.postId, e),
1393
1410
  onMediaChange: (e) => f("mediaChange", n.postId, e),
@@ -1411,8 +1428,8 @@ var Je = [
1411
1428
  "onMediaChange",
1412
1429
  "onReady",
1413
1430
  "onError"
1414
- ]))), 128))], 6)], 42, dt),
1415
- t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && G.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", ft, [u(U, {
1431
+ ]))), 128))], 6)], 42, pt),
1432
+ t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && W.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", mt, [u(te, {
1416
1433
  actions: t.feedFooterActions,
1417
1434
  "can-retry-end": t.canRetryEnd,
1418
1435
  "feed-footer": t.feedFooter,
@@ -1420,7 +1437,7 @@ var Je = [
1420
1437
  "has-next": t.hasNext,
1421
1438
  "is-loading": t.isLoadingMore,
1422
1439
  "load-more-locked": t.loadMoreLocked,
1423
- "show-load-more": G.value,
1440
+ "show-load-more": W.value,
1424
1441
  state: t.state,
1425
1442
  onLoadMore: r[0] ||= (e) => f("loadMore"),
1426
1443
  onRetryEnd: r[1] ||= (e) => f("retryEnd")
@@ -1435,7 +1452,7 @@ var Je = [
1435
1452
  "show-load-more",
1436
1453
  "state"
1437
1454
  ])])) : o("", !0),
1438
- u(me, {
1455
+ u(ge, {
1439
1456
  "content-size": B.value.height,
1440
1457
  "controls-id": m,
1441
1458
  "scroll-element": p.value,
@@ -1447,8 +1464,8 @@ var Je = [
1447
1464
  ])
1448
1465
  ]));
1449
1466
  }
1450
- }), _t = 300;
1451
- function vt(e, t, n) {
1467
+ }), yt = 300;
1468
+ function bt(e, t, n) {
1452
1469
  let r = e.scrollTop;
1453
1470
  if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
1454
1471
  e.setAttribute("data-transitioning", "");
@@ -1456,7 +1473,7 @@ function vt(e, t, n) {
1456
1473
  return new Promise((n) => {
1457
1474
  let o = (s) => {
1458
1475
  a += 1;
1459
- let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / _t), u = 1 - (1 - l) ** 3;
1476
+ let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / yt), u = 1 - (1 - l) ** 3;
1460
1477
  if (e.scrollTop = r + (t - r) * u, l < 1) {
1461
1478
  requestAnimationFrame(o);
1462
1479
  return;
@@ -1468,7 +1485,7 @@ function vt(e, t, n) {
1468
1485
  }
1469
1486
  //#endregion
1470
1487
  //#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
1471
- var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1488
+ var xt = ["aria-label"], St = /* @__PURE__ */ d({
1472
1489
  __name: "ReelAutoAdvanceProgress",
1473
1490
  props: {
1474
1491
  durationMs: {},
@@ -1486,9 +1503,9 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1486
1503
  class: "reel-auto-advance-progress",
1487
1504
  style: _(a.value),
1488
1505
  onAnimationend: n[0] ||= (e) => i("complete")
1489
- }, null, 36)], 8, yt));
1506
+ }, null, 36)], 8, xt));
1490
1507
  }
1491
- }), xt = { class: "reel-viewport" }, St = ["data-active-post-id", "data-active-media-index"], Ct = ["role", "data-status"], wt = 2, Tt = 300, Et = 250, Dt = /* @__PURE__ */ d({
1508
+ }), Ct = { class: "reel-viewport" }, wt = ["data-active-post-id", "data-active-media-index"], Tt = ["role", "data-status"], Et = 2, Dt = 300, Ot = 250, kt = /* @__PURE__ */ d({
1492
1509
  __name: "ReelFeed",
1493
1510
  props: {
1494
1511
  initialPostId: {},
@@ -1525,31 +1542,31 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1525
1542
  "retryForward"
1526
1543
  ],
1527
1544
  setup(t, { expose: n, emit: i }) {
1528
- let l = 0, u = t, d = i, f = w(null), p = w(null), g = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), x = w(Math.max(0, g)), C = w(!1), D = w(!1), k = 0, A = null, j = null, N = null, I = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), L = r(() => {
1529
- let e = Math.max(0, x.value - wt), t = Math.min(u.items.length - 1, x.value + wt);
1545
+ let l = 0, u = t, d = i, f = w(null), p = w(null), g = u.initialPostId === null || u.initialPostId === void 0 ? -1 : u.items.findIndex((e) => e.postId === u.initialPostId), x = w(Math.max(0, g)), C = w(!1), D = w(!1), k = 0, A = null, j = null, M = null, F = r(() => ({ gridTemplateRows: `repeat(${u.items.length}, 100cqh)` })), R = r(() => {
1546
+ let e = Math.max(0, x.value - Et), t = Math.min(u.items.length - 1, x.value + Et);
1530
1547
  return u.items.slice(e, t + 1).map((t, n) => ({
1531
1548
  fetchPriority: e + n === x.value ? "high" : "low",
1532
1549
  index: e + n,
1533
1550
  item: t
1534
1551
  }));
1535
- }), R = r(() => u.items[x.value]?.postId), z = r(() => u.items[x.value]), B = r(() => {
1536
- let e = R.value;
1552
+ }), z = r(() => u.items[x.value]?.postId), B = r(() => u.items[x.value]), V = r(() => {
1553
+ let e = z.value;
1537
1554
  return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
1538
- }), ee = r(() => {
1539
- let e = R.value;
1540
- return e === void 0 ? "loading" : u.previewStates.get(F(e, B.value)) ?? "loading";
1541
- }), V = r(() => z.value ? P(z.value, B.value) : null), H = r(() => ee.value === "ready" && !!(V.value && Ge(u.mediaSource === "original" ? V.value.type : V.value.preview.type ?? V.value.type, u.mediaSource === "original" ? V.value.src : V.value.preview.src))), W = r(() => [
1542
- R.value,
1543
- B.value,
1555
+ }), H = r(() => {
1556
+ let e = z.value;
1557
+ return e === void 0 ? "loading" : u.previewStates.get(L(e, V.value)) ?? "loading";
1558
+ }), ee = r(() => B.value ? I(B.value, V.value) : null), U = r(() => ee.value ? N(ee.value, u.mediaSource ?? "preview") : null), W = r(() => H.value === "ready" && !!(U.value && qe(U.value.type, U.value.src))), G = r(() => [
1559
+ z.value,
1560
+ V.value,
1544
1561
  u.items.length,
1545
1562
  u.loadMoreLocked,
1546
1563
  u.reelAutoAdvance.enabled,
1547
1564
  u.reelAutoAdvance.includePostItems,
1548
1565
  u.reelAutoAdvance.intervalMs
1549
- ].join(":")), G = r(() => {
1550
- let e = z.value, t = !!(e && u.reelAutoAdvance.includePostItems && B.value < M(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
1566
+ ].join(":")), K = r(() => {
1567
+ let e = B.value, t = !!(e && u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
1551
1568
  return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
1552
- }), te = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && z.value !== void 0 && ee.value !== "loading" && !H.value), re = r(() => !u.infiniteScroll || u.items.length <= 1), K = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
1569
+ }), ne = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && B.value !== void 0 && H.value !== "loading" && !W.value), re = r(() => !u.infiniteScroll || u.items.length <= 1), J = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
1553
1570
  function ie(e) {
1554
1571
  return { gridRow: `${e + 1}` };
1555
1572
  }
@@ -1561,77 +1578,77 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1561
1578
  let t = e.currentTarget;
1562
1579
  if (!t) return;
1563
1580
  let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
1564
- C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ae(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && ne(t) && d("loadMore");
1581
+ C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ae(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && q(t) && d("loadMore");
1565
1582
  }
1566
- function q() {
1583
+ function Y() {
1567
1584
  let e = f.value;
1568
- e && (C.value = !1, Y(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
1585
+ e && (C.value = !1, se(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
1569
1586
  e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
1570
- }), se());
1587
+ }), X());
1571
1588
  }
1572
- function se() {
1573
- N !== null && clearTimeout(N), N = setTimeout(() => {
1574
- N = null;
1589
+ function X() {
1590
+ M !== null && clearTimeout(M), M = setTimeout(() => {
1591
+ M = null;
1575
1592
  let e = f.value;
1576
- e && (k = e.clientHeight, e.scrollTop = x.value * k), Y(!1);
1593
+ e && (k = e.clientHeight, e.scrollTop = x.value * k), se(!1);
1577
1594
  }, 120);
1578
1595
  }
1579
- function J() {
1580
- Y(!0);
1596
+ function Z() {
1597
+ se(!0);
1581
1598
  let e = f.value;
1582
- e && (k = e.clientHeight, e.scrollTop = x.value * k), se();
1599
+ e && (k = e.clientHeight, e.scrollTop = x.value * k), X();
1583
1600
  }
1584
- function Y(e) {
1601
+ function se(e) {
1585
1602
  D.value = e, f.value?.toggleAttribute("data-resizing", e);
1586
1603
  }
1587
- function X() {
1604
+ function ce() {
1588
1605
  let e = f.value;
1589
- Date.now() >= l && !u.loadMoreLocked && e && ne(e) && d("loadMore");
1606
+ Date.now() >= l && !u.loadMoreLocked && e && q(e) && d("loadMore");
1590
1607
  }
1591
1608
  O(() => u.items.length, (e, t) => {
1592
- e > 0 && e < t && (l = Date.now() + Et);
1609
+ e > 0 && e < t && (l = Date.now() + Ot);
1593
1610
  });
1594
- function Z(e) {
1595
- let t = z.value;
1611
+ function le(e) {
1612
+ let t = B.value;
1596
1613
  if (!t) return !1;
1597
- let n = M(t).length;
1614
+ let n = P(t).length;
1598
1615
  if (n <= 1) return !1;
1599
- let r = (B.value + e + n) % n;
1616
+ let r = (V.value + e + n) % n;
1600
1617
  return d("mediaChange", t.postId, r), !0;
1601
1618
  }
1602
- function ce(e) {
1619
+ function ue(e) {
1603
1620
  let t = x.value + e;
1604
- return !f.value || t < 0 || t >= u.items.length ? !1 : (fe(t), !0);
1621
+ return !f.value || t < 0 || t >= u.items.length ? !1 : (me(t), !0);
1605
1622
  }
1606
- function le(e, t) {
1623
+ function de(e, t) {
1607
1624
  let n = u.items.findIndex((t) => t.postId === e), r = u.items[n];
1608
- return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && fe(n), !0);
1625
+ return !f.value || !r || t < 0 || t > r.items.length ? !1 : ((u.mediaIndices.get(e) ?? 0) !== t && d("mediaChange", e, t), n !== x.value && me(n), !0);
1609
1626
  }
1610
- function ue() {
1627
+ function fe() {
1611
1628
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1612
1629
  }
1613
- function de(e) {
1630
+ function pe(e) {
1614
1631
  let t = f.value;
1615
1632
  if (!t) return Promise.resolve();
1616
1633
  let n = e * (k || t.clientHeight);
1617
- return x.value = e, vt(t, n, ue());
1634
+ return x.value = e, bt(t, n, fe());
1618
1635
  }
1619
- function fe(e) {
1620
- de(e);
1636
+ function me(e) {
1637
+ pe(e);
1621
1638
  }
1622
- async function pe(e) {
1639
+ async function he(e) {
1623
1640
  let t = u.items.findIndex((t) => t.postId === e);
1624
- return t < 0 || t === x.value ? !1 : (await de(t), !0);
1641
+ return t < 0 || t === x.value ? !1 : (await pe(t), !0);
1625
1642
  }
1626
- async function me(e) {
1627
- return Z(e) ? (ue() || await new Promise((e) => setTimeout(e, Tt)), !0) : !1;
1643
+ async function ge(e) {
1644
+ return le(e) ? (fe() || await new Promise((e) => setTimeout(e, Dt)), !0) : !1;
1628
1645
  }
1629
- function he() {
1646
+ function _e() {
1630
1647
  if (!u.reelAutoAdvance.enabled) return;
1631
- let e = z.value;
1648
+ let e = B.value;
1632
1649
  if (!e) return;
1633
- if (u.reelAutoAdvance.includePostItems && B.value < M(e).length - 1) {
1634
- d("mediaChange", e.postId, B.value + 1);
1650
+ if (u.reelAutoAdvance.includePostItems && V.value < P(e).length - 1) {
1651
+ d("mediaChange", e.postId, V.value + 1);
1635
1652
  return;
1636
1653
  }
1637
1654
  let t = x.value + 1, n = u.items[t];
@@ -1639,31 +1656,31 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1639
1656
  u.hasNext && !u.loadMoreLocked && d("loadMore");
1640
1657
  return;
1641
1658
  }
1642
- u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), fe(t);
1659
+ u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), me(t);
1643
1660
  }
1644
- function ge(e, t) {
1645
- !u.reelAutoAdvance.enabled || e !== R.value || t !== B.value || !H.value || he();
1661
+ function ve(e, t) {
1662
+ !u.reelAutoAdvance.enabled || e !== z.value || t !== V.value || !W.value || _e();
1646
1663
  }
1647
1664
  return O(f, (e) => {
1648
- A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(q), A.observe(e)));
1665
+ A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(Y), A.observe(e)));
1649
1666
  }), O(() => u.items.length, async (e) => {
1650
1667
  let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
1651
- x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), q();
1652
- }), O(R, (e) => {
1668
+ x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), Y();
1669
+ }), O(z, (e) => {
1653
1670
  e !== void 0 && d("activeChange", e);
1654
1671
  }, { immediate: !0 }), y(() => {
1655
- window.addEventListener("resize", J), window.addEventListener("orientationchange", J), g >= 0 && m(q);
1672
+ window.addEventListener("resize", Z), window.addEventListener("orientationchange", Z), g >= 0 && m(Y);
1656
1673
  }), v(() => {
1657
- window.removeEventListener("resize", J), window.removeEventListener("orientationchange", J), A?.disconnect(), j !== null && cancelAnimationFrame(j), N !== null && clearTimeout(N);
1674
+ window.removeEventListener("resize", Z), window.removeEventListener("orientationchange", Z), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
1658
1675
  }), n({
1659
1676
  activeIndex: x,
1660
- activePostId: R,
1661
- changeActiveMedia: Z,
1662
- loadIfNearBottom: X,
1663
- moveActivePost: ce,
1664
- navigateToItem: le,
1665
- transitionActiveMedia: me,
1666
- transitionActivePost: pe
1677
+ activePostId: z,
1678
+ changeActiveMedia: le,
1679
+ loadIfNearBottom: ce,
1680
+ moveActivePost: ue,
1681
+ navigateToItem: de,
1682
+ transitionActiveMedia: ge,
1683
+ transitionActivePost: he
1667
1684
  }), (n, r) => (b(), s("main", {
1668
1685
  class: h(["reel-shell", {
1669
1686
  "reel-shell--has-footer": !!t.cardFooter,
@@ -1671,13 +1688,13 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1671
1688
  }]),
1672
1689
  "data-layout-mode": "reel"
1673
1690
  }, [
1674
- t.cardHeader && z.value && t.reelForward.status === "idle" ? (b(), a(Ne, {
1691
+ t.cardHeader && B.value && t.reelForward.status === "idle" ? (b(), a(Fe, {
1675
1692
  key: 0,
1676
1693
  index: x.value,
1677
- item: z.value,
1694
+ item: B.value,
1678
1695
  layout: "reel",
1679
1696
  "loaded-count": t.items.length,
1680
- "media-index": B.value,
1697
+ "media-index": V.value,
1681
1698
  "media-source": t.mediaSource,
1682
1699
  placement: "header",
1683
1700
  region: t.cardHeader,
@@ -1693,19 +1710,19 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1693
1710
  "style",
1694
1711
  "total"
1695
1712
  ])) : o("", !0),
1696
- c("div", xt, [c("div", {
1713
+ c("div", Ct, [c("div", {
1697
1714
  ref_key: "galleryElement",
1698
1715
  ref: f,
1699
1716
  class: "gallery-shell reel-feed",
1700
- "data-active-post-id": R.value,
1701
- "data-active-media-index": B.value,
1717
+ "data-active-post-id": z.value,
1718
+ "data-active-media-index": V.value,
1702
1719
  onScrollPassive: oe
1703
1720
  }, [t.reelForward.status === "idle" ? (b(), s("section", {
1704
1721
  key: 1,
1705
1722
  class: "reel-track",
1706
- style: _(I.value),
1723
+ style: _(F.value),
1707
1724
  "aria-label": "Media gallery"
1708
- }, [(b(!0), s(e, null, S(L.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(lt, {
1725
+ }, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(dt, {
1709
1726
  key: n.postId,
1710
1727
  active: r === x.value && !C.value,
1711
1728
  "advance-on-media-end": u.reelAutoAdvance.enabled && r === x.value,
@@ -1720,12 +1737,12 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1720
1737
  "loaded-count": t.items.length,
1721
1738
  "media-index": t.mediaIndices.get(n.postId) ?? 0,
1722
1739
  "media-source": t.mediaSource,
1723
- "preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1740
+ "preview-state": t.previewStates.get(E(L)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1724
1741
  "reel-controls-target": p.value,
1725
1742
  "stationary-reel-controls": "",
1726
1743
  total: t.total,
1727
1744
  onMediaChange: (e) => d("mediaChange", n.postId, e),
1728
- onEnded: (e) => ge(n.postId, e),
1745
+ onEnded: (e) => ve(n.postId, e),
1729
1746
  onReady: (e) => d("ready", n.postId, e),
1730
1747
  onError: (e) => d("error", n.postId, e)
1731
1748
  }, null, 8, [
@@ -1751,12 +1768,12 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1751
1768
  class: "reel-forward-status",
1752
1769
  role: t.reelForward.status === "error" ? "alert" : "status",
1753
1770
  "data-status": t.reelForward.status
1754
- }, [c("p", null, T(K.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
1771
+ }, [c("p", null, T(J.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
1755
1772
  key: 0,
1756
1773
  class: "reel-forward-retry",
1757
1774
  type: "button",
1758
1775
  onClick: r[0] ||= (e) => d("retryForward")
1759
- }, " Retry ")) : o("", !0)], 8, Ct)), t.reelForward.status === "idle" ? (b(), a(U, {
1776
+ }, " Retry ")) : o("", !0)], 8, Tt)), t.reelForward.status === "idle" ? (b(), a(te, {
1760
1777
  key: 2,
1761
1778
  actions: t.feedFooterActions,
1762
1779
  "can-retry-end": t.canRetryEnd,
@@ -1779,19 +1796,19 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1779
1796
  "load-more-locked",
1780
1797
  "show-load-more",
1781
1798
  "state"
1782
- ])) : o("", !0)], 40, St), c("div", {
1799
+ ])) : o("", !0)], 40, wt), c("div", {
1783
1800
  ref_key: "reelControlsElement",
1784
1801
  ref: p,
1785
1802
  class: "reel-media-controls-host",
1786
1803
  "data-test": "reel-media-controls-host"
1787
1804
  }, null, 512)]),
1788
- t.cardFooter && z.value && t.reelForward.status === "idle" ? (b(), a(Ne, {
1805
+ t.cardFooter && B.value && t.reelForward.status === "idle" ? (b(), a(Fe, {
1789
1806
  key: 1,
1790
1807
  index: x.value,
1791
- item: z.value,
1808
+ item: B.value,
1792
1809
  layout: "reel",
1793
1810
  "loaded-count": t.items.length,
1794
- "media-index": B.value,
1811
+ "media-index": V.value,
1795
1812
  "media-source": t.mediaSource,
1796
1813
  placement: "footer",
1797
1814
  region: t.cardFooter,
@@ -1807,24 +1824,24 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1807
1824
  "style",
1808
1825
  "total"
1809
1826
  ])) : o("", !0),
1810
- te.value ? (b(), a(bt, {
1811
- key: W.value,
1827
+ ne.value ? (b(), a(St, {
1828
+ key: G.value,
1812
1829
  "duration-ms": t.reelAutoAdvance.intervalMs,
1813
- label: G.value,
1814
- onComplete: he
1830
+ label: K.value,
1831
+ onComplete: _e
1815
1832
  }, null, 8, ["duration-ms", "label"])) : o("", !0)
1816
1833
  ], 2));
1817
1834
  }
1818
- }), Ot = ["data-info-sheet-open", "data-info-sheet-mode"], kt = ["aria-hidden", "inert"], At = {
1835
+ }), At = ["data-info-sheet-open", "data-info-sheet-mode"], jt = ["aria-hidden", "inert"], Mt = {
1819
1836
  key: 0,
1820
1837
  class: "reel-info-sheet-layer",
1821
1838
  "data-test": "reel-info-sheet"
1822
- }, jt = [
1839
+ }, Nt = [
1823
1840
  "role",
1824
1841
  "aria-modal",
1825
1842
  "tabindex",
1826
1843
  "data-active-post-id"
1827
- ], Mt = /* @__PURE__ */ d({
1844
+ ], Pt = /* @__PURE__ */ d({
1828
1845
  __name: "ReelLayout",
1829
1846
  props: {
1830
1847
  forwardIndex: { default: null },
@@ -1877,26 +1894,26 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1877
1894
  }), A = r(() => !!(l.infoSheet && l.infoSheetEnabled && T.value)), j = r(() => {
1878
1895
  let e = T.value;
1879
1896
  return e ? {
1880
- close: N,
1897
+ close: M,
1881
1898
  index: E.value,
1882
1899
  item: e,
1883
1900
  layout: "reel",
1884
1901
  loadedCount: l.items.length,
1885
- mediaCount: M(e).length,
1902
+ mediaCount: P(e).length,
1886
1903
  mediaIndex: D.value,
1887
- mediaItem: P(e, D.value),
1904
+ mediaItem: I(e, D.value),
1888
1905
  mediaSource: l.mediaSource ?? "preview",
1889
1906
  origin: l.origin,
1890
1907
  total: l.total
1891
1908
  } : null;
1892
1909
  });
1893
- function N() {
1910
+ function M() {
1894
1911
  d("closeInfoSheet");
1895
1912
  }
1896
- function F(e) {
1913
+ function N(e) {
1897
1914
  return p.value?.changeActiveMedia(e) ?? !1;
1898
1915
  }
1899
- function I() {
1916
+ function F() {
1900
1917
  p.value?.loadIfNearBottom();
1901
1918
  }
1902
1919
  function L(e) {
@@ -1911,13 +1928,13 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1911
1928
  function B(e) {
1912
1929
  return p.value?.transitionActivePost(e) ?? Promise.resolve(!1);
1913
1930
  }
1914
- function ee(e, t) {
1931
+ function V(e, t) {
1915
1932
  d("error", e, t);
1916
1933
  }
1917
- function V(e, t) {
1934
+ function H(e, t) {
1918
1935
  d("mediaChange", e, t);
1919
1936
  }
1920
- function H(e, t) {
1937
+ function ee(e, t) {
1921
1938
  d("ready", e, t);
1922
1939
  }
1923
1940
  return O(() => ({
@@ -1935,8 +1952,8 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1935
1952
  }), v(() => {
1936
1953
  y = null;
1937
1954
  }), t({
1938
- changeActiveMedia: F,
1939
- loadIfNearBottom: I,
1955
+ changeActiveMedia: N,
1956
+ loadIfNearBottom: F,
1940
1957
  moveActivePost: L,
1941
1958
  navigateToItem: R,
1942
1959
  transitionActiveMedia: z,
@@ -1949,7 +1966,7 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1949
1966
  class: "reel-layout-main",
1950
1967
  "aria-hidden": e.infoSheetOverlay && A.value || void 0,
1951
1968
  inert: e.infoSheetOverlay && A.value || void 0
1952
- }, [u(Dt, {
1969
+ }, [u(kt, {
1953
1970
  ref_key: "reelFeed",
1954
1971
  ref: p,
1955
1972
  "can-retry-end": e.canRetryEnd,
@@ -1973,10 +1990,10 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
1973
1990
  state: e.state,
1974
1991
  total: e.total,
1975
1992
  onActiveChange: r[0] ||= (e) => d("activeChange", e),
1976
- onError: ee,
1993
+ onError: V,
1977
1994
  onLoadMore: r[1] ||= (e) => d("loadMore"),
1978
- onMediaChange: V,
1979
- onReady: H,
1995
+ onMediaChange: H,
1996
+ onReady: ee,
1980
1997
  onRetryEnd: r[2] ||= (e) => d("retryEnd"),
1981
1998
  onRetryForward: r[3] ||= (e) => d("retryForward")
1982
1999
  }, null, 8, [
@@ -2000,8 +2017,8 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
2000
2017
  "reel-forward",
2001
2018
  "state",
2002
2019
  "total"
2003
- ])], 8, kt), u(n, { name: "vibe-info-sheet" }, {
2004
- default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", At, [c("aside", {
2020
+ ])], 8, jt), u(n, { name: "vibe-info-sheet" }, {
2021
+ default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Mt, [c("aside", {
2005
2022
  ref_key: "sheetElement",
2006
2023
  ref: _,
2007
2024
  class: "reel-info-sheet",
@@ -2010,17 +2027,17 @@ var yt = ["aria-label"], bt = /* @__PURE__ */ d({
2010
2027
  "aria-modal": e.infoSheetOverlay ? "true" : void 0,
2011
2028
  tabindex: e.infoSheetOverlay ? -1 : void 0,
2012
2029
  "data-active-post-id": T.value?.postId
2013
- }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, jt)])) : o("", !0)]),
2030
+ }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Nt)])) : o("", !0)]),
2014
2031
  _: 1
2015
- })], 10, Ot));
2032
+ })], 10, At));
2016
2033
  }
2017
2034
  });
2018
2035
  //#endregion
2019
2036
  //#region src/core/mediaLifecycle.ts
2020
- function Nt(e, t, n, r, i) {
2037
+ function Ft(e, t, n, r, i) {
2021
2038
  let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
2022
2039
  if (!o) return null;
2023
- let s = N(o, n), c = P(o, s);
2040
+ let s = F(o, n), c = I(o, s);
2024
2041
  return {
2025
2042
  item: o,
2026
2043
  layout: r,
@@ -2033,7 +2050,7 @@ function Nt(e, t, n, r, i) {
2033
2050
  postIndex: a
2034
2051
  };
2035
2052
  }
2036
- function Pt(e, t) {
2053
+ function It(e, t) {
2037
2054
  O(() => {
2038
2055
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
2039
2056
  return {
@@ -2043,76 +2060,76 @@ function Pt(e, t) {
2043
2060
  };
2044
2061
  }, (n, r) => {
2045
2062
  if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
2046
- let i = Nt(e, n.postId, n.mediaIndex, "reel", n.origin);
2063
+ let i = Ft(e, n.postId, n.mediaIndex, "reel", n.origin);
2047
2064
  i && t(i);
2048
2065
  }, { flush: "sync" });
2049
2066
  }
2050
2067
  //#endregion
2051
2068
  //#region src/components/useMediaLifecycle.ts
2052
- function Ft(e, t) {
2053
- let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = r(() => e.reelMediaSource === "original" ? i.value : n.value);
2054
- function o(e, t, n, r) {
2055
- let i = F(t, n);
2069
+ function Lt(e, t) {
2070
+ let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = () => e.reelMediaSource === "preview" ? n : e.reelMediaSource === "mobile" ? a : i, s = r(() => o().value);
2071
+ function c(e, t, n, r) {
2072
+ let i = L(t, n);
2056
2073
  e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
2057
2074
  }
2058
- function s(t, n, r, i) {
2059
- return Nt(e, t, n, r, i);
2075
+ function l(t, n, r, i) {
2076
+ return Ft(e, t, n, r, i);
2060
2077
  }
2061
- function c(e, n, r, i) {
2062
- let a = s(e, n, r, i);
2078
+ function u(e, n, r, i) {
2079
+ let a = l(e, n, r, i);
2063
2080
  a && t.ready(a);
2064
2081
  }
2065
- function l(e, t) {
2066
- o(n, e, t, "error");
2082
+ function d(e, t) {
2083
+ c(n, e, t, "error");
2067
2084
  }
2068
- function u(e, t) {
2069
- o(n, e, t, "ready"), c(e, t, "masonry", null);
2085
+ function f(e, t) {
2086
+ c(n, e, t, "ready"), u(e, t, "masonry", null);
2070
2087
  }
2071
- function d(t, r) {
2072
- o(e.reelMediaSource === "original" ? i : n, t, r, "error");
2088
+ function p(e, t) {
2089
+ c(o(), e, t, "error");
2073
2090
  }
2074
- function f(t, r) {
2075
- o(e.reelMediaSource === "original" ? i : n, t, r, "ready"), c(t, r, "reel", e.reelOrigin ?? "reel");
2091
+ function m(t, n) {
2092
+ c(o(), t, n, "ready"), u(t, n, "reel", e.reelOrigin ?? "reel");
2076
2093
  }
2077
- function p(e, n) {
2078
- let r = s(e, n, "masonry", null);
2094
+ function h(e, n) {
2095
+ let r = l(e, n, "masonry", null);
2079
2096
  r && t.visible(r);
2080
2097
  }
2081
- return Pt(e, t.reelChange), O(() => {
2098
+ return It(e, t.reelChange), O(() => {
2082
2099
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
2083
2100
  return {
2084
2101
  mediaIndex: n,
2085
2102
  origin: e.reelOrigin ?? "reel",
2086
2103
  postId: t,
2087
- ready: t !== null && a.value.get(F(t, n)) === "ready"
2104
+ ready: t !== null && s.value.get(L(t, n)) === "ready"
2088
2105
  };
2089
2106
  }, (e, n) => {
2090
2107
  if (e.postId === null || !e.ready || n?.ready && n.postId === e.postId && n.mediaIndex === e.mediaIndex && n.origin === e.origin) return;
2091
- let r = s(e.postId, e.mediaIndex, "reel", e.origin);
2108
+ let r = l(e.postId, e.mediaIndex, "reel", e.origin);
2092
2109
  r && t.visible(r);
2093
2110
  }, { flush: "post" }), {
2094
- markMasonryVisible: p,
2095
- markPreviewError: l,
2096
- markPreviewReady: u,
2097
- markReelError: d,
2098
- markReelReady: f,
2111
+ markMasonryVisible: h,
2112
+ markPreviewError: d,
2113
+ markPreviewReady: f,
2114
+ markReelError: p,
2115
+ markReelReady: m,
2099
2116
  originalStates: i,
2100
2117
  previewStates: n,
2101
- reelStates: a
2118
+ reelStates: s
2102
2119
  };
2103
2120
  }
2104
2121
  //#endregion
2105
2122
  //#region src/core/reelEscapeStack.ts
2106
- var It = [];
2107
- function Lt(e) {
2108
- return It.push(e), () => {
2109
- let t = It.indexOf(e);
2110
- t >= 0 && It.splice(t, 1);
2123
+ var Rt = [];
2124
+ function zt(e) {
2125
+ return Rt.push(e), () => {
2126
+ let t = Rt.indexOf(e);
2127
+ t >= 0 && Rt.splice(t, 1);
2111
2128
  };
2112
2129
  }
2113
- function Rt(e) {
2130
+ function Bt(e) {
2114
2131
  if (!e.isActive()) return !1;
2115
- let t = It.filter((e) => e.isActive()), n = e.element();
2132
+ let t = Rt.filter((e) => e.isActive()), n = e.element();
2116
2133
  return n !== null && t.some((t) => {
2117
2134
  if (t === e) return !1;
2118
2135
  let r = t.element();
@@ -2128,14 +2145,14 @@ function Rt(e) {
2128
2145
  }
2129
2146
  //#endregion
2130
2147
  //#region src/components/useReelKeyboard.ts
2131
- function zt(e) {
2148
+ function Vt(e) {
2132
2149
  let t = {
2133
2150
  element: e.element,
2134
2151
  isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
2135
2152
  }, n = null;
2136
2153
  function r(n) {
2137
2154
  let r = t.isActive();
2138
- if (n.key === "Escape" && r && !Rt(t)) return;
2155
+ if (n.key === "Escape" && r && !Bt(t)) return;
2139
2156
  if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
2140
2157
  n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
2141
2158
  return;
@@ -2155,14 +2172,14 @@ function zt(e) {
2155
2172
  a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
2156
2173
  }
2157
2174
  y(() => {
2158
- n = Lt(t), window.addEventListener("keydown", r);
2175
+ n = zt(t), window.addEventListener("keydown", r);
2159
2176
  }), v(() => {
2160
2177
  window.removeEventListener("keydown", r), n?.(), n = null;
2161
2178
  });
2162
2179
  }
2163
2180
  //#endregion
2164
2181
  //#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
2165
- var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2182
+ var Ht = 35, Ut = 420, Wt = /* @__PURE__ */ d({
2166
2183
  __name: "VibeSurface",
2167
2184
  props: {
2168
2185
  canRetryEnd: { type: Boolean },
@@ -2188,70 +2205,70 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2188
2205
  "retryForward"
2189
2206
  ],
2190
2207
  setup(t, { expose: i, emit: c }) {
2191
- let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => L(l.state, A.value)), { markMasonryVisible: P, markPreviewError: F, markPreviewReady: I, markReelError: R, markReelReady: z, originalStates: B, previewStates: ee, reelStates: V } = Ft(l.state, {
2208
+ let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => z(l.state, A.value)), { markMasonryVisible: M, markPreviewError: N, markPreviewReady: I, markReelError: L, markReelReady: R, originalStates: B, previewStates: V, reelStates: H } = Lt(l.state, {
2192
2209
  ready: (e) => d("mediaReady", e),
2193
2210
  reelChange: (e) => d("reelMediaChange", e),
2194
2211
  visible: (e) => d("mediaVisible", e)
2195
- }), H = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
2196
- function ne() {
2212
+ }), ee = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, te = !1;
2213
+ function G() {
2197
2214
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2198
2215
  }
2199
- function re() {
2216
+ function K() {
2200
2217
  U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
2201
2218
  U = requestAnimationFrame(() => {
2202
2219
  U = null, S.value = /* @__PURE__ */ new Set();
2203
2220
  });
2204
2221
  });
2205
2222
  }
2206
- function K(e, t) {
2223
+ function q(e, t) {
2207
2224
  let n = l.state.items.find((t) => t.postId === e);
2208
2225
  if (!n) return;
2209
- let r = N(n, t);
2226
+ let r = F(n, t);
2210
2227
  (l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
2211
2228
  }
2212
- async function ie() {
2229
+ async function re() {
2213
2230
  await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
2214
2231
  }
2215
- function ae(e) {
2232
+ function J(e) {
2216
2233
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
2217
2234
  }
2218
- function oe(e) {
2235
+ function ie(e) {
2219
2236
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
2220
2237
  }
2221
- function q(e) {
2238
+ function ae(e) {
2222
2239
  if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
2223
2240
  let t = l.state.items.find((t) => t.postId === e.postId);
2224
2241
  if (!t) return "not-found";
2225
- let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
2242
+ let n = P(t).findIndex((t) => t.mediaId === e.mediaId);
2226
2243
  return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
2227
2244
  }
2228
- function se() {
2245
+ function oe() {
2229
2246
  return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
2230
2247
  }
2231
- function J(e, t) {
2232
- W = e, G = t === "keyboard", y.value = ce(e), d("openReel", e), m(() => h.value?.focus());
2248
+ function Y(e, t) {
2249
+ W = e, te = t === "keyboard", y.value = ce(e), d("openReel", e), m(() => h.value?.focus());
2233
2250
  }
2234
- function Y(e) {
2251
+ function X(e) {
2235
2252
  let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
2236
2253
  return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
2237
2254
  }
2238
- function X(e, t) {
2239
- if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || ne()) return 0;
2240
- let n = [...new Set(e)], r = n.filter(Y);
2255
+ function Z(e, t) {
2256
+ if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || G()) return 0;
2257
+ let n = [...new Set(e)], r = n.filter(X);
2241
2258
  if (r.length === 0) return 0;
2242
- let i = new Map(D.value), a = t?.staggerMs ?? Bt;
2259
+ let i = new Map(D.value), a = t?.staggerMs ?? Ht;
2243
2260
  return r.forEach((e, t) => {
2244
2261
  i.set(e, t * a);
2245
- }), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, Vt + (r.length - 1) * a;
2262
+ }), S.value = new Set([...S.value].filter((e) => !r.includes(e))), T.value = new Set([...T.value, ...n]), D.value = i, Ut + (r.length - 1) * a;
2246
2263
  }
2247
- function Z(e, t) {
2248
- let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
2264
+ function se(e, t) {
2265
+ let n = X(e), r = n?.querySelector(".media-card-activator") ?? n;
2249
2266
  r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
2250
2267
  r.classList.remove("media-card-focus-silent");
2251
2268
  }, { once: !0 }), r?.focus({ preventScroll: !0 }));
2252
2269
  }
2253
2270
  function ce(e) {
2254
- let t = g.value, n = Y(e);
2271
+ let t = g.value, n = X(e);
2255
2272
  if (t === null || n === null) return {};
2256
2273
  let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
2257
2274
  return {
@@ -2265,12 +2282,12 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2265
2282
  l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
2266
2283
  }
2267
2284
  function ue() {
2268
- let e = W, t = G;
2269
- x.value = !1, W = null, G = !1, y.value = {}, m(() => {
2270
- e !== null && Z(e, t);
2285
+ let e = W, t = te;
2286
+ x.value = !1, W = null, te = !1, y.value = {}, m(() => {
2287
+ e !== null && se(e, t);
2271
2288
  });
2272
2289
  }
2273
- return zt({
2290
+ return Vt({
2274
2291
  closeMasonryReel: le,
2275
2292
  element: () => g.value,
2276
2293
  isReelLeaving: () => x.value,
@@ -2278,31 +2295,31 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2278
2295
  setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
2279
2296
  state: l.state
2280
2297
  }), O(() => l.state.items.map((e) => e.postId), (e) => {
2281
- let t = e.filter((e) => !H.has(e)), n = new Set(e);
2282
- if (H = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || ne()) return;
2298
+ let t = e.filter((e) => !ee.has(e)), n = new Set(e);
2299
+ if (ee = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || G()) return;
2283
2300
  let r = /* @__PURE__ */ new Map();
2284
2301
  e.forEach((e) => {
2285
2302
  let t = C.value.get(e);
2286
2303
  t !== void 0 && r.set(e, t);
2287
2304
  }), t.forEach((e, t) => {
2288
- r.set(e, t * Bt);
2289
- }), C.value = r, S.value = new Set([...S.value, ...t]), re();
2305
+ r.set(e, t * Ht);
2306
+ }), C.value = r, S.value = new Set([...S.value, ...t]), K();
2290
2307
  }, { flush: "sync" }), v(() => {
2291
2308
  U !== null && cancelAnimationFrame(U);
2292
2309
  }), i({
2293
- changeActiveReelMedia: ae,
2294
- getAutoScrollElement: se,
2295
- loadIfNearBottom: ie,
2296
- moveActiveReelPost: oe,
2297
- navigateToReelItem: q,
2298
- startItemRemoval: X,
2310
+ changeActiveReelMedia: J,
2311
+ getAutoScrollElement: oe,
2312
+ loadIfNearBottom: re,
2313
+ moveActiveReelPost: ie,
2314
+ navigateToReelItem: ae,
2315
+ startItemRemoval: Z,
2299
2316
  transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
2300
2317
  transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
2301
2318
  }), (r, i) => (b(), s("div", {
2302
2319
  ref_key: "surfaceElement",
2303
2320
  ref: g,
2304
2321
  class: "vibe-surface"
2305
- }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Mt, {
2322
+ }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Pt, {
2306
2323
  key: 0,
2307
2324
  ref_key: "reelRenderer",
2308
2325
  ref: p,
@@ -2327,20 +2344,20 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2327
2344
  "info-sheet-overlay": t.state.reelInfoSheetOverlay,
2328
2345
  "next-page-error": !!t.state.nextPageError,
2329
2346
  origin: "reel",
2330
- "preview-states": E(V),
2347
+ "preview-states": E(H),
2331
2348
  "reel-auto-advance": t.state.reelAutoAdvance,
2332
2349
  "reel-forward": t.state.reelForward,
2333
2350
  state: j.value,
2334
2351
  total: t.state.total,
2335
2352
  onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
2336
2353
  onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
2337
- onError: E(R),
2354
+ onError: E(L),
2338
2355
  onLoadMore: i[2] ||= (e) => d("loadMore"),
2339
- onMediaChange: K,
2340
- onReady: E(z),
2356
+ onMediaChange: q,
2357
+ onReady: E(R),
2341
2358
  onRetryEnd: i[3] ||= (e) => d("retryEnd"),
2342
2359
  onRetryForward: i[4] ||= (e) => d("retryForward")
2343
- }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(te, {
2360
+ }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(ne, {
2344
2361
  key: 1,
2345
2362
  actions: t.feedFooterActions,
2346
2363
  "can-retry-end": t.canRetryEnd,
@@ -2353,7 +2370,7 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2353
2370
  "can-retry-end",
2354
2371
  "feed-footer",
2355
2372
  "state"
2356
- ])) : (b(), s(e, { key: 2 }, [u(gt, {
2373
+ ])) : (b(), s(e, { key: 2 }, [u(vt, {
2357
2374
  ref_key: "masonryRenderer",
2358
2375
  ref: f,
2359
2376
  "can-retry-end": t.canRetryEnd,
@@ -2374,17 +2391,17 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2374
2391
  "load-more-locked": t.state.loadMoreLocked,
2375
2392
  "media-indices": t.state.mediaIndices,
2376
2393
  "next-page-error": !!t.state.nextPageError,
2377
- "preview-states": E(ee),
2394
+ "preview-states": E(V),
2378
2395
  suspended: t.state.reelOrigin === "masonry" || x.value,
2379
2396
  state: j.value,
2380
2397
  total: t.state.total,
2381
- onActivate: J,
2382
- onError: E(F),
2398
+ onActivate: Y,
2399
+ onError: E(N),
2383
2400
  onLoadMore: i[7] ||= (e) => d("loadMore"),
2384
- onMediaChange: K,
2401
+ onMediaChange: q,
2385
2402
  onReady: E(I),
2386
2403
  onRetryEnd: i[8] ||= (e) => d("retryEnd"),
2387
- onVisible: E(P)
2404
+ onVisible: E(M)
2388
2405
  }, null, 8, [
2389
2406
  "can-retry-end",
2390
2407
  "entering-post-ids",
@@ -2425,7 +2442,7 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2425
2442
  "aria-modal": "true",
2426
2443
  tabindex: "-1",
2427
2444
  style: _(y.value)
2428
- }, [u(Mt, {
2445
+ }, [u(Pt, {
2429
2446
  ref_key: "reelRenderer",
2430
2447
  ref: p,
2431
2448
  "can-retry-end": t.canRetryEnd,
@@ -2456,10 +2473,10 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2456
2473
  total: t.state.total,
2457
2474
  onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
2458
2475
  onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
2459
- onError: E(R),
2476
+ onError: E(L),
2460
2477
  onLoadMore: i[11] ||= (e) => d("loadMore"),
2461
- onMediaChange: K,
2462
- onReady: E(z),
2478
+ onMediaChange: q,
2479
+ onReady: E(R),
2463
2480
  onRetryEnd: i[12] ||= (e) => d("retryEnd"),
2464
2481
  onRetryForward: i[13] ||= (e) => d("retryForward")
2465
2482
  }, null, 8, /* @__PURE__ */ "can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))], 4)) : o("", !0)]),
@@ -2469,7 +2486,7 @@ var Bt = 35, Vt = 420, Ht = /* @__PURE__ */ d({
2469
2486
  });
2470
2487
  //#endregion
2471
2488
  //#region src/core/page.ts
2472
- function Ut(e) {
2489
+ function Gt(e) {
2473
2490
  if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
2474
2491
  if (e.current !== void 0 && e.current !== null && typeof e.current != "string" && typeof e.current != "number") throw TypeError("Vibe page current must be a string, number, null, or undefined.");
2475
2492
  if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
@@ -2480,22 +2497,22 @@ function Q(e, t) {
2480
2497
  let n = new Set(e.map((e) => e.postId));
2481
2498
  return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
2482
2499
  }
2483
- function Wt(e) {
2500
+ function Kt(e) {
2484
2501
  return `${typeof e}:${String(e)}`;
2485
2502
  }
2486
- function Gt(e) {
2487
- return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${Wt(e.mediaId)}`;
2503
+ function qt(e) {
2504
+ return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview.src}` : `id:${Kt(e.mediaId)}`;
2488
2505
  }
2489
- function Kt(e, t) {
2490
- let n = [...e], r = new Map(e.map((e, t) => [Wt(e.postId), t]));
2506
+ function Jt(e, t) {
2507
+ let n = [...e], r = new Map(e.map((e, t) => [Kt(e.postId), t]));
2491
2508
  return t.forEach((e) => {
2492
- let t = Wt(e.postId), i = r.get(t);
2509
+ let t = Kt(e.postId), i = r.get(t);
2493
2510
  if (i === void 0) {
2494
2511
  r.set(t, n.length), n.push(e);
2495
2512
  return;
2496
2513
  }
2497
- let a = n[i], o = new Set([a, ...a.items].map(Gt)), s = [e, ...e.items].filter((e) => {
2498
- let t = Gt(e);
2514
+ let a = n[i], o = new Set([a, ...a.items].map(qt)), s = [e, ...e.items].filter((e) => {
2515
+ let t = qt(e);
2499
2516
  return o.has(t) ? !1 : (o.add(t), !0);
2500
2517
  });
2501
2518
  s.length > 0 && (n[i] = {
@@ -2504,14 +2521,14 @@ function Kt(e, t) {
2504
2521
  });
2505
2522
  }), n;
2506
2523
  }
2507
- function qt(e) {
2524
+ function Yt(e) {
2508
2525
  return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
2509
2526
  }
2510
2527
  //#endregion
2511
2528
  //#region src/core/appendPage.ts
2512
- function Jt(e, t, n, r) {
2513
- let i = Ut(e), a = n.filterItems(i.items), o = qt(i);
2514
- t.items = Kt(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
2529
+ function Xt(e, t, n, r) {
2530
+ let i = Gt(e), a = n.filterItems(i.items), o = Yt(i);
2531
+ t.items = Jt(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
2515
2532
  contributionIds: a.map(({ postId: e }) => e),
2516
2533
  cursor: o,
2517
2534
  next: i.next,
@@ -2520,32 +2537,32 @@ function Jt(e, t, n, r) {
2520
2537
  }
2521
2538
  //#endregion
2522
2539
  //#region src/core/requestDelay.ts
2523
- var Yt = 2e3, Xt = 1e4, Zt = 250, Qt = {
2540
+ var Zt = 2e3, Qt = 1e4, $t = 250, en = {
2524
2541
  delayRemainingMs: null,
2525
2542
  nextRequestAt: null
2526
2543
  };
2527
- function $t(e, t) {
2544
+ function tn(e, t) {
2528
2545
  return e === void 0 ? t : Math.floor(e);
2529
2546
  }
2530
- function en(e, t) {
2547
+ function nn(e, t) {
2531
2548
  for (let [n, r] of [["delayStepMs", e.delayStepMs], ["delayMaxMs", e.delayMaxMs]]) if (r !== void 0 && (!Number.isFinite(r) || r < 0)) throw TypeError(`Vibe ${t} ${n} must be a non-negative number.`);
2532
2549
  }
2533
- function tn(e, t = {}) {
2534
- let n = $t(t.delayStepMs, Yt), r = $t(t.delayMaxMs, Xt);
2550
+ function rn(e, t = {}) {
2551
+ let n = tn(t.delayStepMs, Zt), r = tn(t.delayMaxMs, Qt);
2535
2552
  return Math.min(Math.max(0, e) * n, r);
2536
2553
  }
2537
2554
  function $(e) {
2538
- if (e == null || !Number.isFinite(e)) return { ...Qt };
2555
+ if (e == null || !Number.isFinite(e)) return { ...en };
2539
2556
  let t = Math.max(0, Math.floor(e - Date.now()));
2540
2557
  return t > 0 ? {
2541
2558
  delayRemainingMs: t,
2542
2559
  nextRequestAt: e
2543
- } : { ...Qt };
2560
+ } : { ...en };
2544
2561
  }
2545
- async function nn({ delayMs: e, onChange: t, signal: n }) {
2562
+ async function an({ delayMs: e, onChange: t, signal: n }) {
2546
2563
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
2547
2564
  if (e <= 0) {
2548
- t({ ...Qt });
2565
+ t({ ...en });
2549
2566
  return;
2550
2567
  }
2551
2568
  let r = Date.now() + e;
@@ -2553,9 +2570,9 @@ async function nn({ delayMs: e, onChange: t, signal: n }) {
2553
2570
  delayRemainingMs: e,
2554
2571
  nextRequestAt: r
2555
2572
  }), await new Promise((i, a) => {
2556
- let o = !1, s = setInterval(f, Zt), c = setTimeout(() => u(), e);
2573
+ let o = !1, s = setInterval(f, $t), c = setTimeout(() => u(), e);
2557
2574
  function l() {
2558
- clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Qt });
2575
+ clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...en });
2559
2576
  }
2560
2577
  function u(e) {
2561
2578
  o || (o = !0, l(), e ? a(e) : i());
@@ -2570,13 +2587,13 @@ async function nn({ delayMs: e, onChange: t, signal: n }) {
2570
2587
  n.addEventListener("abort", d, { once: !0 });
2571
2588
  });
2572
2589
  }
2573
- var rn = class {
2590
+ var on = class {
2574
2591
  interval = null;
2575
2592
  constructor(e) {
2576
2593
  this.onChange = e;
2577
2594
  }
2578
2595
  clear() {
2579
- this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Qt });
2596
+ this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...en });
2580
2597
  }
2581
2598
  sync(e) {
2582
2599
  this.clear();
@@ -2584,22 +2601,22 @@ var rn = class {
2584
2601
  this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
2585
2602
  let t = $(e);
2586
2603
  this.onChange(t), t.delayRemainingMs === null && this.clear();
2587
- }, Zt));
2604
+ }, $t));
2588
2605
  }
2589
2606
  };
2590
- function an(e, t = !0) {
2607
+ function sn(e, t = !0) {
2591
2608
  return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
2592
2609
  }
2593
- function on(e) {
2610
+ function cn(e) {
2594
2611
  return `${typeof e}:${String(e)}`;
2595
2612
  }
2596
- function sn(e, t) {
2613
+ function ln(e, t) {
2597
2614
  if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
2598
2615
  }
2599
- function cn(e) {
2616
+ function un(e) {
2600
2617
  if (!e) return;
2601
- if (sn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2602
- en(e, "frontend autofill");
2618
+ if (ln(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2619
+ nn(e, "frontend autofill");
2603
2620
  let t = e.maxAdditionalPages;
2604
2621
  if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
2605
2622
  return;
@@ -2611,7 +2628,7 @@ function cn(e) {
2611
2628
  if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
2612
2629
  }
2613
2630
  }
2614
- function ln(e, t, n = !0) {
2631
+ function dn(e, t, n = !0) {
2615
2632
  if (!e) return {
2616
2633
  cycleId: null,
2617
2634
  delayRemainingMs: null,
@@ -2645,7 +2662,7 @@ function ln(e, t, n = !0) {
2645
2662
  strategy: e.strategy
2646
2663
  };
2647
2664
  }
2648
- function un(e) {
2665
+ function fn(e) {
2649
2666
  return [
2650
2667
  "cancelling",
2651
2668
  "filling",
@@ -2653,9 +2670,9 @@ function un(e) {
2653
2670
  "waiting"
2654
2671
  ].includes(e.status);
2655
2672
  }
2656
- async function dn(e, t, n) {
2673
+ async function pn(e, t, n) {
2657
2674
  let r = t.autofill;
2658
- if (!un(r) || !r.cycleId) return;
2675
+ if (!fn(r) || !r.cycleId) return;
2659
2676
  let i = {
2660
2677
  cycleId: r.cycleId,
2661
2678
  feedKey: r.feedKey ?? "",
@@ -2668,16 +2685,16 @@ async function dn(e, t, n) {
2668
2685
  throw r.error = e, r.status = "error", e;
2669
2686
  }
2670
2687
  }
2671
- function fn(e, t, n) {
2688
+ function mn(e, t, n) {
2672
2689
  return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
2673
2690
  }
2674
- async function pn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
2675
- let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? an(s), g = t, _ = t, v = t, y = 0, b = [], x;
2691
+ async function hn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequests: r, onCollection: i, onDelayChange: a, onProgress: o, options: s, receivedOffset: c = 0, requestOffset: l = 0, shouldPause: u = () => !1, signal: d }) {
2692
+ let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? sn(s), g = t, _ = t, v = t, y = 0, b = [], x;
2676
2693
  for (; y < h;) {
2677
- let e = on(g);
2694
+ let e = cn(g);
2678
2695
  if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
2679
- if (m.add(e), await nn({
2680
- delayMs: tn(l + y, s),
2696
+ if (m.add(e), await an({
2697
+ delayMs: rn(l + y, s),
2681
2698
  onChange: a,
2682
2699
  signal: d
2683
2700
  }), y > 0 && u()) return {
@@ -2691,7 +2708,7 @@ async function pn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2691
2708
  status: "paused",
2692
2709
  total: x
2693
2710
  };
2694
- let t = Ut(await n({
2711
+ let t = Gt(await n({
2695
2712
  cursor: g,
2696
2713
  signal: d
2697
2714
  }));
@@ -2748,12 +2765,12 @@ async function pn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2748
2765
  }
2749
2766
  //#endregion
2750
2767
  //#region src/core/autofillController.ts
2751
- var mn = class {
2768
+ var gn = class {
2752
2769
  collection = null;
2753
2770
  cycle = 0;
2754
2771
  delayCountdown;
2755
2772
  constructor(e) {
2756
- this.context = e, this.delayCountdown = new rn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2773
+ this.context = e, this.delayCountdown = new on((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2757
2774
  }
2758
2775
  beginCycle() {
2759
2776
  let { options: e, state: t } = this.context;
@@ -2761,14 +2778,14 @@ var mn = class {
2761
2778
  this.clear();
2762
2779
  let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
2763
2780
  return t.autofill = {
2764
- ...ln(e, void 0, !1),
2781
+ ...dn(e, void 0, !1),
2765
2782
  cycleId: n,
2766
2783
  status: "filling"
2767
2784
  }, n;
2768
2785
  }
2769
2786
  async cancel() {
2770
2787
  let { cancelRequest: e, options: t, state: n } = this.context;
2771
- await dn(t, n, e), this.commitCollection();
2788
+ await pn(t, n, e), this.commitCollection();
2772
2789
  }
2773
2790
  captureCollection(e, t) {
2774
2791
  t && (this.collection = e);
@@ -2796,30 +2813,30 @@ var mn = class {
2796
2813
  requests: r.requests
2797
2814
  }), !0) : !1;
2798
2815
  }
2799
- }, hn = 100;
2800
- function gn(e, t) {
2816
+ }, _n = 100;
2817
+ function vn(e, t) {
2801
2818
  if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
2802
2819
  }
2803
- function _n(e, t, n) {
2820
+ function yn(e, t, n) {
2804
2821
  return Math.min(n, Math.max(t, e));
2805
2822
  }
2806
- function vn(e) {
2823
+ function bn(e) {
2807
2824
  if (!e) return;
2808
2825
  let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
2809
- if (gn("autoScroll.minSpeedPxPerSecond", t), gn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2810
- e.speedPxPerSecond !== void 0 && gn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2826
+ if (vn("autoScroll.minSpeedPxPerSecond", t), vn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2827
+ e.speedPxPerSecond !== void 0 && vn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2811
2828
  }
2812
- function yn(e) {
2829
+ function xn(e) {
2813
2830
  let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
2814
2831
  return {
2815
2832
  enabled: e?.enabled ?? !1,
2816
2833
  maxSpeedPxPerSecond: n,
2817
2834
  minSpeedPxPerSecond: t,
2818
2835
  paused: !1,
2819
- speedPxPerSecond: _n(e?.speedPxPerSecond ?? 80, t, n)
2836
+ speedPxPerSecond: yn(e?.speedPxPerSecond ?? 80, t, n)
2820
2837
  };
2821
2838
  }
2822
- var bn = class {
2839
+ var Sn = class {
2823
2840
  frame = null;
2824
2841
  lastTimestamp = null;
2825
2842
  mounted = !1;
@@ -2839,9 +2856,9 @@ var bn = class {
2839
2856
  this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
2840
2857
  }
2841
2858
  setSpeed(e) {
2842
- gn("auto-scroll speed", e);
2859
+ vn("auto-scroll speed", e);
2843
2860
  let t = this.options.state;
2844
- t.speedPxPerSecond = _n(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2861
+ t.speedPxPerSecond = yn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2845
2862
  }
2846
2863
  tick = (e) => {
2847
2864
  this.frame = null;
@@ -2853,7 +2870,7 @@ var bn = class {
2853
2870
  return;
2854
2871
  }
2855
2872
  if (this.lastTimestamp !== null) {
2856
- let r = Math.min(hn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
2873
+ let r = Math.min(_n, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
2857
2874
  n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
2858
2875
  }
2859
2876
  this.lastTimestamp = e, this.schedule();
@@ -2867,7 +2884,7 @@ var bn = class {
2867
2884
  };
2868
2885
  //#endregion
2869
2886
  //#region src/core/backendAutofill.ts
2870
- async function xn(e, t, n, r) {
2887
+ async function Cn(e, t, n, r) {
2871
2888
  let i = await e.onUnderfilled(n);
2872
2889
  if (!r()) return;
2873
2890
  if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
@@ -2881,19 +2898,19 @@ async function xn(e, t, n, r) {
2881
2898
  status: "waiting"
2882
2899
  });
2883
2900
  }
2884
- function Sn(e, t) {
2901
+ function wn(e, t) {
2885
2902
  ["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);
2886
2903
  }
2887
- function Cn(e, t, n) {
2904
+ function Tn(e, t, n) {
2888
2905
  let r = t.autofill;
2889
- return !fn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (Sn(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);
2906
+ return !mn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (wn(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);
2890
2907
  }
2891
- function wn(e, t, n) {
2892
- return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = ln(e, n), Sn(t, n), !0);
2908
+ function En(e, t, n) {
2909
+ return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = dn(e, n), wn(t, n), !0);
2893
2910
  }
2894
2911
  //#endregion
2895
2912
  //#region src/core/backlogRestore.ts
2896
- async function Tn(e, t, n) {
2913
+ async function Dn(e, t, n) {
2897
2914
  if (!e) return;
2898
2915
  let r = new AbortController();
2899
2916
  n(r);
@@ -2908,7 +2925,7 @@ async function Tn(e, t, n) {
2908
2925
  }
2909
2926
  //#endregion
2910
2927
  //#region src/core/initialAutofill.ts
2911
- async function En({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
2928
+ async function On({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
2912
2929
  let c = a.autofill;
2913
2930
  if (!c) return;
2914
2931
  let l = s.items.length;
@@ -2921,7 +2938,7 @@ async function En({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2921
2938
  return;
2922
2939
  }
2923
2940
  if (c.strategy === "backend") {
2924
- await xn(c, s, {
2941
+ await Cn(c, s, {
2925
2942
  cycleId: e,
2926
2943
  feedKey: c.feedKey,
2927
2944
  items: [...s.items],
@@ -2938,11 +2955,11 @@ async function En({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2938
2955
  s.autofill.status = "exhausted";
2939
2956
  return;
2940
2957
  }
2941
- let u = await pn({
2958
+ let u = await hn({
2942
2959
  existingItems: s.items,
2943
2960
  initialCursor: s.next,
2944
2961
  loadPage: a.loadPage,
2945
- maximumRequests: an(c, !1),
2962
+ maximumRequests: sn(c, !1),
2946
2963
  onCollection: n,
2947
2964
  onDelayChange: (e) => {
2948
2965
  t() && Object.assign(s.autofill, e);
@@ -2965,13 +2982,13 @@ async function En({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2965
2982
  }
2966
2983
  //#endregion
2967
2984
  //#region src/core/fill.ts
2968
- function Dn(e) {
2985
+ function kn(e) {
2969
2986
  return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
2970
2987
  }
2971
- function On(e) {
2988
+ function An(e) {
2972
2989
  return `${typeof e}:${String(e)}`;
2973
2990
  }
2974
- function kn(e) {
2991
+ function jn(e) {
2975
2992
  if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
2976
2993
  if ("pages" in e) {
2977
2994
  if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
@@ -2984,20 +3001,20 @@ function kn(e) {
2984
3001
  if ("until" in e && e.until === "end") return { until: "end" };
2985
3002
  throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
2986
3003
  }
2987
- function An(e) {
3004
+ function Mn(e) {
2988
3005
  if (!e) return;
2989
3006
  if (e.strategy === "frontend") {
2990
- en(e, "frontend fill");
3007
+ nn(e, "frontend fill");
2991
3008
  return;
2992
3009
  }
2993
3010
  if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
2994
3011
  let t = e.initialSession;
2995
3012
  if (t) {
2996
3013
  if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
2997
- kn(t.target);
3014
+ jn(t.target);
2998
3015
  }
2999
3016
  }
3000
- function jn(e, t, n = !0) {
3017
+ function Nn(e, t, n = !0) {
3001
3018
  let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $(i?.nextRequestAt);
3002
3019
  return {
3003
3020
  completedPages: i?.completedPages ?? 0,
@@ -3011,10 +3028,10 @@ function jn(e, t, n = !0) {
3011
3028
  sessionId: i?.sessionId ?? null,
3012
3029
  status: i?.status ?? "idle",
3013
3030
  strategy: e?.strategy ?? null,
3014
- target: i ? Dn(i.target) : null
3031
+ target: i ? kn(i.target) : null
3015
3032
  };
3016
3033
  }
3017
- function Mn(e) {
3034
+ function Pn(e) {
3018
3035
  return [
3019
3036
  "cancelling",
3020
3037
  "filling",
@@ -3022,7 +3039,7 @@ function Mn(e) {
3022
3039
  "waiting"
3023
3040
  ].includes(e.status);
3024
3041
  }
3025
- async function Nn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3042
+ async function Fn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3026
3043
  let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
3027
3044
  if ("items" in l && f.length >= l.items) return {
3028
3045
  completedPages: m,
@@ -3034,10 +3051,10 @@ async function Nn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3034
3051
  status: "complete"
3035
3052
  };
3036
3053
  for (; _ !== null;) {
3037
- let e = On(h);
3054
+ let e = An(h);
3038
3055
  if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
3039
- if (p.add(e), await nn({
3040
- delayMs: tn(m, o),
3056
+ if (p.add(e), await an({
3057
+ delayMs: rn(m, o),
3041
3058
  onChange: i,
3042
3059
  signal: c
3043
3060
  }), m > 0 && s()) return {
@@ -3050,7 +3067,7 @@ async function Nn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3050
3067
  status: "paused",
3051
3068
  total: y
3052
3069
  };
3053
- let t = Ut(await n({
3070
+ let t = Gt(await n({
3054
3071
  cursor: h,
3055
3072
  signal: c
3056
3073
  }));
@@ -3118,7 +3135,7 @@ async function Nn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3118
3135
  }
3119
3136
  //#endregion
3120
3137
  //#region src/core/backendFill.ts
3121
- async function Pn(e, t, n, r) {
3138
+ async function In(e, t, n, r) {
3122
3139
  let i = await e.onStart(n);
3123
3140
  if (r()) {
3124
3141
  if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
@@ -3132,22 +3149,22 @@ async function Pn(e, t, n, r) {
3132
3149
  });
3133
3150
  }
3134
3151
  }
3135
- function Fn(e, t, n) {
3152
+ function Ln(e, t, n) {
3136
3153
  return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
3137
3154
  }
3138
- function In(e) {
3155
+ function Rn(e) {
3139
3156
  return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
3140
3157
  }
3141
- function Ln(e, t) {
3158
+ function zn(e, t) {
3142
3159
  if (!["complete", "exhausted"].includes(t.status)) return !0;
3143
3160
  let n = e.fill.target;
3144
3161
  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;
3145
3162
  }
3146
- function Rn(e, t, n) {
3163
+ function Bn(e, t, n) {
3147
3164
  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));
3148
3165
  }
3149
- function zn(e, t, n, r) {
3150
- return !Fn(e, t, n) || !In(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Ln(t, n) ? !1 : (Rn(t, n, r), Object.assign(t.fill, {
3166
+ function Vn(e, t, n, r) {
3167
+ return !Ln(e, t, n) || !Rn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !zn(t, n) ? !1 : (Bn(t, n, r), Object.assign(t.fill, {
3151
3168
  ...$(n.status === "waiting" ? n.nextRequestAt : null),
3152
3169
  completedPages: n.completedPages,
3153
3170
  error: n.error ?? null,
@@ -3156,45 +3173,45 @@ function zn(e, t, n, r) {
3156
3173
  status: n.status
3157
3174
  }), !0);
3158
3175
  }
3159
- function Bn(e, t, n, r) {
3176
+ function Hn(e, t, n, r) {
3160
3177
  if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
3161
3178
  let i = t.fill;
3162
- return t.fill = jn(e, n), !In(n) || !Ln(t, n) ? (t.fill = i, !1) : (Rn(t, n, r), !0);
3179
+ return t.fill = Nn(e, n), !Rn(n) || !zn(t, n) ? (t.fill = i, !1) : (Bn(t, n, r), !0);
3163
3180
  }
3164
3181
  //#endregion
3165
3182
  //#region src/core/fillController.ts
3166
- var Vn = class {
3183
+ var Un = class {
3167
3184
  abortController = null;
3168
3185
  cycle = 0;
3169
3186
  delayCountdown;
3170
3187
  requestVersion = 0;
3171
3188
  collection = null;
3172
3189
  constructor(e) {
3173
- this.options = e, this.delayCountdown = new rn((e) => {
3190
+ this.options = e, this.delayCountdown = new on((e) => {
3174
3191
  Object.assign(this.options.state.fill, e);
3175
3192
  }), this.syncBackendCountdown();
3176
3193
  }
3177
3194
  isActive() {
3178
- return Mn(this.options.state.fill);
3195
+ return Pn(this.options.state.fill);
3179
3196
  }
3180
3197
  applyUpdate(e) {
3181
- let t = zn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3198
+ let t = Vn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3182
3199
  return t && this.syncBackendCountdown(), t;
3183
3200
  }
3184
3201
  restoreSession(e) {
3185
- let t = Bn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3202
+ let t = Hn(this.options.fill, this.options.state, e, this.options.onLastCursor);
3186
3203
  return t && this.syncBackendCountdown(), t;
3187
3204
  }
3188
3205
  async start(e, t = {}) {
3189
3206
  let n = this.options.fill;
3190
3207
  if (!n) throw Error("Vibe fill is not configured.");
3191
3208
  if (this.isActive()) throw Error("Vibe fill is already active.");
3192
- let r = kn(e), i = kn(t.target ?? r), a = t.progressOffset ?? {
3209
+ let r = jn(e), i = jn(t.target ?? r), a = t.progressOffset ?? {
3193
3210
  completedPages: 0,
3194
3211
  received: 0
3195
3212
  }, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
3196
3213
  if (this.options.state.fill = {
3197
- ...jn(n, void 0, !1),
3214
+ ...Nn(n, void 0, !1),
3198
3215
  completedPages: a.completedPages,
3199
3216
  cycleId: o,
3200
3217
  received: a.received,
@@ -3207,7 +3224,7 @@ var Vn = class {
3207
3224
  let s = ++this.requestVersion, c = new AbortController();
3208
3225
  this.abortController = c;
3209
3226
  try {
3210
- n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await Pn(n, this.options.state, {
3227
+ n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await In(n, this.options.state, {
3211
3228
  cycleId: o,
3212
3229
  feedKey: n.feedKey,
3213
3230
  items: [...this.options.state.items],
@@ -3225,7 +3242,7 @@ var Vn = class {
3225
3242
  }
3226
3243
  async cancel() {
3227
3244
  let { fill: e, state: t } = this.options;
3228
- if (!Mn(t.fill) || !t.fill.cycleId) return;
3245
+ if (!Pn(t.fill) || !t.fill.cycleId) return;
3229
3246
  let n = {
3230
3247
  cycleId: t.fill.cycleId,
3231
3248
  feedKey: t.fill.feedKey ?? "",
@@ -3269,7 +3286,7 @@ var Vn = class {
3269
3286
  });
3270
3287
  }
3271
3288
  reset() {
3272
- this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = jn(this.options.fill, void 0, !1), this.collection = null;
3289
+ this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Nn(this.options.fill, void 0, !1), this.collection = null;
3273
3290
  }
3274
3291
  destroy() {
3275
3292
  this.abortLocalRequest(), this.delayCountdown.clear();
@@ -3304,7 +3321,7 @@ var Vn = class {
3304
3321
  s.fill.status = "until" in t ? "complete" : "exhausted";
3305
3322
  return;
3306
3323
  }
3307
- let c = await Nn({
3324
+ let c = await Fn({
3308
3325
  existingItems: s.items,
3309
3326
  initialCursor: s.next,
3310
3327
  loadPage: o,
@@ -3352,7 +3369,7 @@ var Vn = class {
3352
3369
  };
3353
3370
  //#endregion
3354
3371
  //#region src/core/fillReconciliation.ts
3355
- async function Hn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3372
+ async function Wn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3356
3373
  if (!e.needsReconciliation(o.items)) return "skipped";
3357
3374
  let s = await e.reconcile({
3358
3375
  existingItems: o.items,
@@ -3365,7 +3382,7 @@ async function Hn({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
3365
3382
  }
3366
3383
  //#endregion
3367
3384
  //#region src/core/feedFooter.ts
3368
- function Un(e) {
3385
+ function Gn(e) {
3369
3386
  return {
3370
3387
  cancelAutofill: () => e.cancelAutofill(),
3371
3388
  loadMore: () => e.loadNext(),
@@ -3377,46 +3394,46 @@ function Un(e) {
3377
3394
  retryFill: () => e.retryFill()
3378
3395
  };
3379
3396
  }
3380
- function Wn(e) {
3397
+ function Kn(e) {
3381
3398
  if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
3382
3399
  }
3383
- function Gn(e) {
3384
- e?.intervalMs !== void 0 && Wn(e.intervalMs);
3400
+ function qn(e) {
3401
+ e?.intervalMs !== void 0 && Kn(e.intervalMs);
3385
3402
  }
3386
- function Kn(e) {
3403
+ function Jn(e) {
3387
3404
  return {
3388
3405
  enabled: e?.enabled ?? !1,
3389
3406
  includePostItems: e?.includePostItems ?? !1,
3390
3407
  intervalMs: e?.intervalMs ?? 5e3
3391
3408
  };
3392
3409
  }
3393
- function qn(e, t) {
3410
+ function Yn(e, t) {
3394
3411
  if (typeof t == "boolean") {
3395
3412
  e.enabled = t;
3396
3413
  return;
3397
3414
  }
3398
- Gn(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);
3415
+ qn(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);
3399
3416
  }
3400
3417
  //#endregion
3401
3418
  //#region src/core/reelInfoSheet.ts
3402
- function Jn(e) {
3419
+ function Xn(e) {
3403
3420
  return { enabled: e?.enabled ?? !1 };
3404
3421
  }
3405
- function Yn(e, t, n) {
3422
+ function Zn(e, t, n) {
3406
3423
  if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
3407
3424
  e.enabled = n;
3408
3425
  }
3409
3426
  //#endregion
3410
3427
  //#region src/core/initialRuntimeState.ts
3411
- function Xn(e, t) {
3428
+ function Qn(e, t) {
3412
3429
  let n = e.initialPage;
3413
3430
  return {
3414
3431
  activeReelPostId: null,
3415
- autoScroll: yn(e.autoScroll),
3416
- autofill: ln(e.autofill),
3432
+ autoScroll: xn(e.autoScroll),
3433
+ autofill: dn(e.autofill),
3417
3434
  current: n?.current ?? null,
3418
3435
  error: null,
3419
- fill: jn(e.fill),
3436
+ fill: Nn(e.fill),
3420
3437
  infiniteScroll: e.infiniteScroll ?? !0,
3421
3438
  isLoading: !n,
3422
3439
  isLoadingMore: !1,
@@ -3427,14 +3444,14 @@ function Xn(e, t) {
3427
3444
  next: n?.next ?? null,
3428
3445
  nextPageError: null,
3429
3446
  phoneMode: !1,
3430
- reelAutoAdvance: Kn(e.reelAutoAdvance),
3447
+ reelAutoAdvance: Jn(e.reelAutoAdvance),
3431
3448
  reelForward: {
3432
3449
  error: null,
3433
3450
  status: "idle"
3434
3451
  },
3435
3452
  reelForwardIndex: null,
3436
3453
  reelForwardItem: null,
3437
- reelInfoSheet: Jn(e.reelInfoSheet),
3454
+ reelInfoSheet: Xn(e.reelInfoSheet),
3438
3455
  reelInfoSheetOverlay: !1,
3439
3456
  reelMediaSource: "original",
3440
3457
  reelOrigin: null,
@@ -3443,20 +3460,20 @@ function Xn(e, t) {
3443
3460
  }
3444
3461
  //#endregion
3445
3462
  //#region src/core/options.ts
3446
- function Zn(e, t) {
3463
+ function $n(e, t) {
3447
3464
  if (t) {
3448
3465
  if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
3449
3466
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
3450
3467
  }
3451
3468
  }
3452
- function Qn(e, t) {
3469
+ function er(e, t) {
3453
3470
  if (t) {
3454
3471
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
3455
3472
  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.`);
3456
3473
  }
3457
3474
  }
3458
- function $n(e) {
3459
- if (vn(e.autoScroll), Zn("cardHeader", e.cardHeader), Zn("cardFooter", e.cardFooter), Qn("header", e.mediaCard?.header), Qn("footer", e.mediaCard?.footer), cn(e.autofill), An(e.fill), X(e.masonry), Gn(e.reelAutoAdvance), e.removalReconciliation) {
3475
+ function tr(e) {
3476
+ if (bn(e.autoScroll), $n("cardHeader", e.cardHeader), $n("cardFooter", e.cardFooter), er("header", e.mediaCard?.header), er("footer", e.mediaCard?.footer), un(e.autofill), Mn(e.fill), ce(e.masonry), qn(e.reelAutoAdvance), e.removalReconciliation) {
3460
3477
  if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
3461
3478
  let t = e.removalReconciliation.maxReplayPages ?? 5;
3462
3479
  if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
@@ -3471,7 +3488,7 @@ function $n(e) {
3471
3488
  if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
3472
3489
  if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
3473
3490
  }
3474
- function er(e) {
3491
+ function nr(e) {
3475
3492
  if (typeof e != "string") return e;
3476
3493
  if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
3477
3494
  let t = document.querySelector(e);
@@ -3480,7 +3497,7 @@ function er(e) {
3480
3497
  }
3481
3498
  //#endregion
3482
3499
  //#region src/core/pageRequest.ts
3483
- async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3500
+ async function rr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3484
3501
  let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
3485
3502
  received: l.autofill.received,
3486
3503
  requests: l.autofill.requests
@@ -3492,11 +3509,11 @@ async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3492
3509
  let m = !1;
3493
3510
  try {
3494
3511
  if (u?.strategy === "frontend") {
3495
- let s = await pn({
3512
+ let s = await hn({
3496
3513
  existingItems: e ? l.items : [],
3497
3514
  initialCursor: n,
3498
3515
  loadPage: i,
3499
- maximumRequests: f ? Math.max(0, an(u) - f.requests) : void 0,
3516
+ maximumRequests: f ? Math.max(0, sn(u) - f.requests) : void 0,
3500
3517
  onCollection: (e) => t.captureCollection(e, r()),
3501
3518
  onDelayChange: (e) => {
3502
3519
  r() && Object.assign(l.autofill, e);
@@ -3519,7 +3536,7 @@ async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3519
3536
  }), o(s.pages), t.clearCollection();
3520
3537
  return;
3521
3538
  }
3522
- let s = Ut(await i({
3539
+ let s = Gt(await i({
3523
3540
  cursor: n,
3524
3541
  signal: c
3525
3542
  }));
@@ -3539,7 +3556,7 @@ async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3539
3556
  l.autofill.status = "complete";
3540
3557
  return;
3541
3558
  }
3542
- await xn(u, l, {
3559
+ await Cn(u, l, {
3543
3560
  cycleId: p,
3544
3561
  feedKey: u.feedKey,
3545
3562
  items: h.slice(d.length),
@@ -3561,16 +3578,16 @@ async function tr({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3561
3578
  }
3562
3579
  //#endregion
3563
3580
  //#region src/core/removalReconciliationController.ts
3564
- function nr(e) {
3581
+ function ir(e) {
3565
3582
  return `${typeof e}:${String(e)}`;
3566
3583
  }
3567
- function rr(e) {
3584
+ function ar(e) {
3568
3585
  return `${typeof e}:${String(e)}`;
3569
3586
  }
3570
- function ir(e) {
3587
+ function or(e) {
3571
3588
  return e.map(({ postId: e }) => e);
3572
3589
  }
3573
- var ar = class {
3590
+ var sr = class {
3574
3591
  delay;
3575
3592
  enabled;
3576
3593
  maxReplayPages;
@@ -3589,7 +3606,7 @@ var ar = class {
3589
3606
  e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
3590
3607
  }
3591
3608
  filterItems(e) {
3592
- return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(nr(e)));
3609
+ return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(ir(e)));
3593
3610
  }
3594
3611
  needsReconciliation(e) {
3595
3612
  return this.pending !== null || this.findUnderfilledPage(e) >= 0;
@@ -3602,45 +3619,45 @@ var ar = class {
3602
3619
  }
3603
3620
  recordInitialPage(e) {
3604
3621
  e && this.recordPages([{
3605
- contributionIds: ir(e.items),
3606
- cursor: qt(e),
3622
+ contributionIds: or(e.items),
3623
+ cursor: Yt(e),
3607
3624
  next: e.next,
3608
- returnedIds: ir(e.items)
3625
+ returnedIds: or(e.items)
3609
3626
  }]);
3610
3627
  }
3611
3628
  remove(e) {
3612
- e.forEach((e) => this.tombstones.add(nr(e)));
3629
+ e.forEach((e) => this.tombstones.add(ir(e)));
3613
3630
  }
3614
3631
  reset() {
3615
3632
  this.pages = [], this.pending = null, this.tombstones.clear();
3616
3633
  }
3617
3634
  restore(e) {
3618
- e.forEach((e) => this.tombstones.delete(nr(e)));
3635
+ e.forEach((e) => this.tombstones.delete(ir(e)));
3619
3636
  }
3620
3637
  async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
3621
3638
  let a = this.pending ?? this.createSession(e);
3622
3639
  for (this.pending = a; a.remainingRequests > 0;) {
3623
- let e = rr(a.cursor);
3640
+ let e = ar(a.cursor);
3624
3641
  if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
3625
- if (await nn({
3626
- delayMs: tn(a.pages.length, this.delay),
3642
+ if (await an({
3643
+ delayMs: rn(a.pages.length, this.delay),
3627
3644
  onChange: n,
3628
3645
  signal: i
3629
3646
  }), a.pages.length > 0 && r()) return this.result(a, "paused");
3630
- let o = Ut(await t({
3647
+ let o = Gt(await t({
3631
3648
  cursor: a.cursor,
3632
3649
  signal: i
3633
3650
  }));
3634
3651
  a.seenCursors.add(e);
3635
3652
  let s = this.filterItems(o.items), c = [];
3636
3653
  if (s.forEach((e) => {
3637
- let t = nr(e.postId);
3654
+ let t = ir(e.postId);
3638
3655
  a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
3639
3656
  }), a.pages.push({
3640
3657
  contributionIds: c,
3641
3658
  cursor: a.cursor,
3642
3659
  next: o.next,
3643
- returnedIds: ir(s)
3660
+ returnedIds: or(s)
3644
3661
  }), a.lastCursor = a.cursor, a.next = o.next, --a.remainingRequests, o.total !== void 0 && (a.total = o.total), a.next === null ? a.remainingRequests = 0 : a.cursor = a.next, a.remainingRequests > 0 && r()) return this.result(a, "paused");
3645
3662
  }
3646
3663
  return this.result(a, "complete");
@@ -3648,9 +3665,9 @@ var ar = class {
3648
3665
  createSession(e) {
3649
3666
  let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
3650
3667
  if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
3651
- let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(nr))), a = new Set(e.map(({ postId: e }) => nr(e)).filter((e) => !i.has(e)));
3668
+ let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(ir))), a = new Set(e.map(({ postId: e }) => ir(e)).filter((e) => !i.has(e)));
3652
3669
  return {
3653
- appended: new Set(e.map(({ postId: e }) => nr(e))),
3670
+ appended: new Set(e.map(({ postId: e }) => ir(e))),
3654
3671
  attributed: new Set(a),
3655
3672
  cursor: r.cursor,
3656
3673
  items: [],
@@ -3675,11 +3692,11 @@ var ar = class {
3675
3692
  }
3676
3693
  findUnderfilledPage(e) {
3677
3694
  if (!this.enabled || this.pages.length === 0) return -1;
3678
- let t = new Set(e.map(({ postId: e }) => nr(e)));
3679
- return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(nr(e))).length < this.pageSize);
3695
+ let t = new Set(e.map(({ postId: e }) => ir(e)));
3696
+ return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(ir(e))).length < this.pageSize);
3680
3697
  }
3681
3698
  recordPage(e) {
3682
- let t = rr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => rr(e) === t);
3699
+ let t = ar(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ar(e) === t);
3683
3700
  n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
3684
3701
  ...e,
3685
3702
  contributionIds: [...e.contributionIds],
@@ -3689,7 +3706,7 @@ var ar = class {
3689
3706
  };
3690
3707
  //#endregion
3691
3708
  //#region src/core/activeItemRemoval.ts
3692
- function or(e, t, n, r, i) {
3709
+ function cr(e, t, n, r, i) {
3693
3710
  let a = new Set(t.map(({ item: e }) => e.postId));
3694
3711
  if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
3695
3712
  let o = e.items[Math.max(n, 0)];
@@ -3702,7 +3719,7 @@ function or(e, t, n, r, i) {
3702
3719
  }
3703
3720
  //#endregion
3704
3721
  //#region src/core/exactMediaRemovalController.ts
3705
- function sr(e, t) {
3722
+ function lr(e, t) {
3706
3723
  let [n, ...r] = t;
3707
3724
  if (!n) throw Error("Vibe items must contain at least one media asset.");
3708
3725
  return {
@@ -3711,10 +3728,10 @@ function sr(e, t) {
3711
3728
  items: r
3712
3729
  };
3713
3730
  }
3714
- function cr(e) {
3731
+ function ur(e) {
3715
3732
  if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
3716
3733
  }
3717
- var lr = class {
3734
+ var dr = class {
3718
3735
  generation = 0;
3719
3736
  metadata = /* @__PURE__ */ new WeakMap();
3720
3737
  state;
@@ -3722,10 +3739,10 @@ var lr = class {
3722
3739
  this.options = e, this.state = e.state;
3723
3740
  }
3724
3741
  remove(e) {
3725
- cr(e);
3742
+ ur(e);
3726
3743
  let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
3727
3744
  if (!n) return null;
3728
- let r = [...M(n)], i = r[e.mediaIndex];
3745
+ let r = [...P(n)], i = r[e.mediaIndex];
3729
3746
  if (!i) return null;
3730
3747
  let a = Object.freeze({
3731
3748
  media: i,
@@ -3739,7 +3756,7 @@ var lr = class {
3739
3756
  restored: !1
3740
3757
  });
3741
3758
  let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
3742
- return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = sr(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
3759
+ return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = lr(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
3743
3760
  }
3744
3761
  reset() {
3745
3762
  this.generation += 1;
@@ -3764,32 +3781,32 @@ var lr = class {
3764
3781
  return this.state.layout === "reel" || this.state.reelOrigin === "masonry";
3765
3782
  }
3766
3783
  restoreIntoPost(e, t) {
3767
- let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
3768
- if (r.splice(i, 0, t.media), this.state.items[e] = sr(n, r), this.state.activeReelPostId !== t.postId) return;
3784
+ let n = this.state.items[e], r = [...P(n)], i = Math.min(t.mediaIndex, r.length);
3785
+ if (r.splice(i, 0, t.media), this.state.items[e] = lr(n, r), this.state.activeReelPostId !== t.postId) return;
3769
3786
  let a = this.state.mediaIndices.get(t.postId) ?? 0;
3770
3787
  a >= i && this.state.mediaIndices.set(t.postId, a + 1);
3771
3788
  }
3772
3789
  updateMediaIndexAfterRemoval(e, t, n) {
3773
3790
  let r = this.state.items.find((t) => t.postId === e);
3774
3791
  if (!r) return;
3775
- let i = M(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
3792
+ let i = P(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
3776
3793
  n ? o = t < i ? t : 0 : t < a && (o = a - 1), this.state.mediaIndices.set(e, Math.min(o, i - 1));
3777
3794
  }
3778
3795
  };
3779
3796
  //#endregion
3780
3797
  //#region src/core/itemPlacement.ts
3781
- function ur(e, t) {
3798
+ function fr(e, t) {
3782
3799
  let n = new Set(t);
3783
3800
  return e.flatMap((e, t) => n.has(e.postId) ? [{
3784
3801
  index: t,
3785
3802
  item: e
3786
3803
  }] : []);
3787
3804
  }
3788
- function dr(e, t) {
3805
+ function pr(e, t) {
3789
3806
  let n = new Set(t.map(({ item: e }) => e.postId));
3790
3807
  return e.filter((e) => !n.has(e.postId));
3791
3808
  }
3792
- function fr(e, t) {
3809
+ function mr(e, t) {
3793
3810
  t.forEach(({ index: e }) => {
3794
3811
  if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
3795
3812
  });
@@ -3800,7 +3817,7 @@ function fr(e, t) {
3800
3817
  }
3801
3818
  //#endregion
3802
3819
  //#region src/core/itemRemovalController.ts
3803
- var pr = 20, mr = class {
3820
+ var hr = 20, gr = class {
3804
3821
  generation = 0;
3805
3822
  historyLimit;
3806
3823
  metadata = /* @__PURE__ */ new WeakMap();
@@ -3809,7 +3826,7 @@ var pr = 20, mr = class {
3809
3826
  itemOrder;
3810
3827
  stopItemsWatcher;
3811
3828
  constructor(e) {
3812
- this.options = e, this.historyLimit = e.historyLimit ?? pr, 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" });
3829
+ this.options = e, this.historyLimit = e.historyLimit ?? hr, 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" });
3813
3830
  }
3814
3831
  destroy() {
3815
3832
  this.reset(), this.stopItemsWatcher();
@@ -3823,7 +3840,7 @@ var pr = 20, mr = class {
3823
3840
  let a = this.options.startRemoval(i, t);
3824
3841
  if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
3825
3842
  let o = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), s = new Set(n.map(({ item: e }) => e.postId)), c = o < 0 ? 0 : this.state.items.slice(0, o).filter(({ postId: e }) => s.has(e)).length, l = Math.max(o - c, 0);
3826
- return this.state.items = dr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
3843
+ return this.state.items = pr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
3827
3844
  }
3828
3845
  reset() {
3829
3846
  this.generation += 1, this.history = [], this.itemOrder = [];
@@ -3834,7 +3851,7 @@ var pr = 20, mr = class {
3834
3851
  this.restoreRemoval(t);
3835
3852
  return;
3836
3853
  }
3837
- let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = fr(this.state.items, r);
3854
+ let n = new Set(this.state.items.map(({ postId: e }) => e)), r = e.filter(({ item: e }) => n.has(e.postId) ? !1 : (n.add(e.postId), !0)), i = mr(this.state.items, r);
3838
3855
  this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
3839
3856
  }
3840
3857
  restoreRemoval(e) {
@@ -3860,7 +3877,7 @@ var pr = 20, mr = class {
3860
3877
  }
3861
3878
  collectOrderedPlacements(e) {
3862
3879
  let t = new Map(this.itemOrder.map((e, t) => [e, t]));
3863
- return ur(this.state.items, e).map((e) => ({
3880
+ return fr(this.state.items, e).map((e) => ({
3864
3881
  index: t.get(e.item.postId) ?? e.index,
3865
3882
  item: e.item
3866
3883
  }));
@@ -3891,7 +3908,7 @@ var pr = 20, mr = class {
3891
3908
  let r = new Map(this.itemOrder.map((e, t) => [e, t]));
3892
3909
  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;
3893
3910
  }
3894
- }, hr = class {
3911
+ }, _r = class {
3895
3912
  forward = null;
3896
3913
  forwardPromise = null;
3897
3914
  forwardVersion = 0;
@@ -3978,7 +3995,7 @@ var pr = 20, mr = class {
3978
3995
  }
3979
3996
  }
3980
3997
  }
3981
- }, gr = class {
3998
+ }, vr = class {
3982
3999
  generation = 0;
3983
4000
  pending = Promise.resolve();
3984
4001
  constructor(e) {
@@ -3995,7 +4012,7 @@ var pr = 20, mr = class {
3995
4012
  if (!n) return;
3996
4013
  let r = t.mediaIndices.get(e.postId) ?? 0;
3997
4014
  if (e.mediaIndex === r) {
3998
- if (M(n).length > 1) {
4015
+ if (P(n).length > 1) {
3999
4016
  await this.options.transitionMedia(1);
4000
4017
  return;
4001
4018
  }
@@ -4028,24 +4045,24 @@ var pr = 20, mr = class {
4028
4045
  };
4029
4046
  //#endregion
4030
4047
  //#region src/core/removalControllers.ts
4031
- function _r(e) {
4032
- let t = new hr(e), n = new gr({
4048
+ function yr(e) {
4049
+ let t = new _r(e), n = new vr({
4033
4050
  state: e.state,
4034
4051
  transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
4035
4052
  transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
4036
4053
  });
4037
4054
  return {
4038
- exactMediaRemoval: new lr({
4055
+ exactMediaRemoval: new dr({
4039
4056
  onActivate: e.onActivate,
4040
4057
  onPostRemoved: (t) => e.onItemsRemoved([t]),
4041
4058
  onPostRestored: (t) => e.onItemsRestored([t]),
4042
4059
  reelForward: t,
4043
4060
  state: e.state
4044
4061
  }),
4045
- itemRemoval: new mr({
4062
+ itemRemoval: new gr({
4046
4063
  historyLimit: e.historyLimit,
4047
4064
  onItemsRemoved: (n, r, i) => {
4048
- e.onItemsRemoved(r.map(({ item: e }) => e.postId)), or(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4065
+ e.onItemsRemoved(r.map(({ item: e }) => e.postId)), cr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4049
4066
  },
4050
4067
  onRemovalRestored: (n) => {
4051
4068
  e.onItemsRestored(n.map(({ item: e }) => e.postId));
@@ -4060,17 +4077,17 @@ function _r(e) {
4060
4077
  reelRemoval: n
4061
4078
  };
4062
4079
  }
4063
- var vr = 1.5;
4064
- function yr(e) {
4080
+ var br = 1.5;
4081
+ function xr(e) {
4065
4082
  let t = Math.min(e.screenWidth, e.screenHeight);
4066
4083
  if (t > 0 && t < 600) return !0;
4067
- let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * vr;
4084
+ let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * br;
4068
4085
  return !e.hasHover && n > 0 && n < 600 && r;
4069
4086
  }
4070
- function br(e) {
4071
- return yr(e) ? "reel" : "masonry";
4087
+ function Sr(e) {
4088
+ return xr(e) ? "reel" : "masonry";
4072
4089
  }
4073
- function xr(e) {
4090
+ function Cr(e) {
4074
4091
  let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
4075
4092
  return {
4076
4093
  hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
@@ -4080,15 +4097,15 @@ function xr(e) {
4080
4097
  viewportWidth: n.clientWidth
4081
4098
  };
4082
4099
  }
4083
- function Sr(e) {
4084
- return yr(xr(e));
4100
+ function wr(e) {
4101
+ return xr(Cr(e));
4085
4102
  }
4086
- function Cr(e) {
4087
- return br(xr(e));
4103
+ function Tr(e) {
4104
+ return Sr(Cr(e));
4088
4105
  }
4089
4106
  //#endregion
4090
4107
  //#region src/core/responsiveLayoutController.ts
4091
- var wr = class {
4108
+ var Er = class {
4092
4109
  layoutMode;
4093
4110
  resizeObserver = null;
4094
4111
  target = null;
@@ -4113,10 +4130,10 @@ var wr = class {
4113
4130
  }
4114
4131
  handleResponsiveLayout = () => {
4115
4132
  if (!this.target) return;
4116
- let e = Cr(this.target);
4117
- this.state.phoneMode = Sr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4133
+ let e = Tr(this.target);
4134
+ this.state.phoneMode = wr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4118
4135
  };
4119
- }, Tr = class {
4136
+ }, Dr = class {
4120
4137
  routedReelPostId = null;
4121
4138
  reelRouteIsActive = !1;
4122
4139
  constructor(e, t) {
@@ -4143,7 +4160,7 @@ var wr = class {
4143
4160
  let i = this.reelRouteIsActive ? "replace" : "push";
4144
4161
  this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
4145
4162
  }
4146
- }, Er = class {
4163
+ }, Or = class {
4147
4164
  app = null;
4148
4165
  autoScroll;
4149
4166
  autofillController;
@@ -4165,24 +4182,24 @@ var wr = class {
4165
4182
  notificationItems;
4166
4183
  state;
4167
4184
  constructor(e) {
4168
- this.options = e, $n(e);
4185
+ this.options = e, tr(e);
4169
4186
  let t = e.layout ?? "masonry";
4170
- this.state = x(Xn(e, t)), this.lastLoadedCursor = e.initialPage ? qt(e.initialPage) : null, this.notificationItems = I(this.state), this.autoScroll = new bn({
4187
+ this.state = x(Qn(e, t)), this.lastLoadedCursor = e.initialPage ? Yt(e.initialPage) : null, this.notificationItems = R(this.state), this.autoScroll = new Sn({
4171
4188
  getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
4172
4189
  state: this.state.autoScroll
4173
- }), this.autofillController = new mn({
4190
+ }), this.autofillController = new gn({
4174
4191
  cancelRequest: () => this.cancelRequest(),
4175
4192
  onLastCursor: (e) => this.setCurrentCursor(e),
4176
4193
  onPages: (e) => this.removalReconciliation.recordPages(e),
4177
4194
  options: e.autofill,
4178
4195
  state: this.state
4179
- }), this.removalReconciliation = new ar(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Vn({
4196
+ }), this.removalReconciliation = new sr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Un({
4180
4197
  fill: e.fill,
4181
4198
  loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
4182
4199
  needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
4183
4200
  onLastCursor: (e) => this.setCurrentCursor(e),
4184
4201
  onPages: (e) => this.removalReconciliation.recordPages(e),
4185
- prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Hn({
4202
+ prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Wn({
4186
4203
  controller: this.removalReconciliation,
4187
4204
  isCurrent: t,
4188
4205
  loadPage: e.loadPage,
@@ -4192,8 +4209,8 @@ var wr = class {
4192
4209
  state: this.state
4193
4210
  }),
4194
4211
  state: this.state
4195
- }), this.routing = new Tr(e.routing, this.state);
4196
- let n = _r({
4212
+ }), this.routing = new Dr(e.routing, this.state);
4213
+ let n = yr({
4197
4214
  historyLimit: e.removalHistoryLimit,
4198
4215
  onActivate: (e) => this.setActiveReelPost(e),
4199
4216
  onItemsRemoved: (e) => this.removalReconciliation.remove(e),
@@ -4202,20 +4219,20 @@ var wr = class {
4202
4219
  state: this.state,
4203
4220
  surface: () => this.surface
4204
4221
  });
4205
- this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new wr(t, this.state, () => {
4222
+ this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new Er(t, this.state, () => {
4206
4223
  this.routing.syncFeed();
4207
4224
  }), this.startStateNotifications();
4208
4225
  }
4209
4226
  async mount() {
4210
4227
  if (this.app) throw Error("Vibe is already mounted.");
4211
4228
  this.startStateNotifications();
4212
- let e = er(this.options.target);
4213
- this.responsiveLayout.mount(e), this.app = i(Ht, {
4229
+ let e = nr(this.options.target);
4230
+ this.responsiveLayout.mount(e), this.app = i(Wt, {
4214
4231
  canRetryEnd: !!this.options.loadPage,
4215
4232
  cardFooter: this.options.cardFooter,
4216
4233
  cardHeader: this.options.cardHeader,
4217
4234
  feedFooter: this.options.feedFooter,
4218
- feedFooterActions: Un(this),
4235
+ feedFooterActions: Gn(this),
4219
4236
  mediaCard: this.options.mediaCard,
4220
4237
  masonry: this.options.masonry,
4221
4238
  onMediaReady: this.options.onMediaReady,
@@ -4238,7 +4255,7 @@ var wr = class {
4238
4255
  onRetryForward: () => {
4239
4256
  this.retryReelForward();
4240
4257
  }
4241
- }), this.surface = this.app.mount(e), this.autoScroll.mount(), await Tn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4258
+ }), this.surface = this.app.mount(e), this.autoScroll.mount(), await Dn(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4242
4259
  this.restoreController = e;
4243
4260
  }), !this.options.initialPage && this.state.items.length === 0 ? await this.reload() : this.options.autofill && this.state.autofill.status === "idle" && !this.fillController.isActive() && !this.state.loadMoreLocked && await this.startInitialAutofill();
4244
4261
  }
@@ -4246,7 +4263,7 @@ var wr = class {
4246
4263
  this.restoreController?.abort(), this.restoreController = null, this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.removalReconciliation.reset(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
4247
4264
  }
4248
4265
  getState() {
4249
- return L(this.state);
4266
+ return z(this.state);
4250
4267
  }
4251
4268
  removeMedia(e) {
4252
4269
  return this.exactMediaRemoval.remove(e);
@@ -4303,7 +4320,7 @@ var wr = class {
4303
4320
  this.autoScroll.setSpeed(e);
4304
4321
  }
4305
4322
  applyAutofillUpdate(e) {
4306
- let t = Cn(this.options.autofill, this.state, e);
4323
+ let t = Tn(this.options.autofill, this.state, e);
4307
4324
  return t && this.autofillController.syncCountdown(), t;
4308
4325
  }
4309
4326
  cancelAutofill() {
@@ -4314,7 +4331,7 @@ var wr = class {
4314
4331
  await this.cancelFill();
4315
4332
  return;
4316
4333
  }
4317
- if (un(this.state.autofill)) {
4334
+ if (fn(this.state.autofill)) {
4318
4335
  await this.cancelAutofill();
4319
4336
  return;
4320
4337
  }
@@ -4328,12 +4345,12 @@ var wr = class {
4328
4345
  }
4329
4346
  async fill(e) {
4330
4347
  if (!this.state.loadMoreLocked) {
4331
- if (this.pendingRequest || un(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4348
+ if (this.pendingRequest || fn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4332
4349
  await this.fillController.start(e);
4333
4350
  }
4334
4351
  }
4335
4352
  restoreAutofillSession(e) {
4336
- let t = wn(this.options.autofill, this.state, e);
4353
+ let t = En(this.options.autofill, this.state, e);
4337
4354
  return t && this.autofillController.syncCountdown(), t;
4338
4355
  }
4339
4356
  restoreFillSession(e) {
@@ -4343,14 +4360,14 @@ var wr = class {
4343
4360
  return this.startLoadMore(() => this.loadNextSequence());
4344
4361
  }
4345
4362
  appendPage(e) {
4346
- Jt(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4363
+ Xt(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4347
4364
  }
4348
4365
  replenishAfterRemoval() {
4349
4366
  return this.startLoadMore(() => this.replenishAfterRemovalSequence());
4350
4367
  }
4351
4368
  async startLoadMore(e) {
4352
4369
  if (this.pendingRequest) return this.pendingRequest;
4353
- if (this.state.loadMoreLocked || un(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4370
+ if (this.state.loadMoreLocked || fn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4354
4371
  this.state.isLoadingMore = !0, this.state.nextPageError = null;
4355
4372
  let t = e();
4356
4373
  return this.pendingRequest = t, t.finally(() => {
@@ -4365,12 +4382,12 @@ var wr = class {
4365
4382
  }
4366
4383
  async replaceFeed(e, t) {
4367
4384
  if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
4368
- return un(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = ln(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
4385
+ return fn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = dn(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
4369
4386
  }
4370
4387
  async loadFilteredPage(e) {
4371
4388
  let t = this.options.loadPage;
4372
4389
  if (!t) throw Error("Vibe cannot load a page without loadPage.");
4373
- let n = Ut(await t(e));
4390
+ let n = Gt(await t(e));
4374
4391
  return {
4375
4392
  ...n,
4376
4393
  items: this.removalReconciliation.filterItems(n.items)
@@ -4389,7 +4406,7 @@ var wr = class {
4389
4406
  let t = ++this.requestVersion, n = new AbortController();
4390
4407
  this.abortController = n;
4391
4408
  try {
4392
- let r = await Hn({
4409
+ let r = await Wn({
4393
4410
  controller: this.removalReconciliation,
4394
4411
  isCurrent: () => t === this.requestVersion,
4395
4412
  loadPage: e,
@@ -4407,7 +4424,7 @@ var wr = class {
4407
4424
  }
4408
4425
  async retryEnd() {
4409
4426
  if (this.pendingRequest) return this.pendingRequest;
4410
- if (!this.state.loadMoreLocked && !(un(this.state.autofill) || this.fillController.isActive()) && !(this.state.next !== null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.lastLoadedCursor, !0);
4427
+ if (!this.state.loadMoreLocked && !(fn(this.state.autofill) || this.fillController.isActive()) && !(this.state.next !== null || !this.options.loadPage)) return this.state.isLoadingMore = !0, this.state.nextPageError = null, this.startRequest(this.lastLoadedCursor, !0);
4411
4428
  }
4412
4429
  setInfiniteScroll(e) {
4413
4430
  this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
@@ -4431,10 +4448,10 @@ var wr = class {
4431
4448
  this.state.total = e;
4432
4449
  }
4433
4450
  setReelAutoAdvance(e) {
4434
- qn(this.state.reelAutoAdvance, e);
4451
+ Yn(this.state.reelAutoAdvance, e);
4435
4452
  }
4436
4453
  setReelInfoSheet(e) {
4437
- Yn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4454
+ Zn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4438
4455
  }
4439
4456
  setLayout(e) {
4440
4457
  this.responsiveLayout.setLayout(e);
@@ -4454,7 +4471,7 @@ var wr = class {
4454
4471
  async fetchPage(e, t) {
4455
4472
  if (!this.options.loadPage) return;
4456
4473
  let n = ++this.requestVersion, r = new AbortController();
4457
- this.abortController = r, await tr({
4474
+ this.abortController = r, await rr({
4458
4475
  append: t,
4459
4476
  autofillController: this.autofillController,
4460
4477
  cursor: e,
@@ -4476,7 +4493,7 @@ var wr = class {
4476
4493
  startInitialAutofill() {
4477
4494
  let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
4478
4495
  this.abortController = t, this.state.isLoadingMore = !0;
4479
- let r = En({
4496
+ let r = On({
4480
4497
  cycleId: n,
4481
4498
  isCurrent: () => e === this.requestVersion,
4482
4499
  onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
@@ -4494,7 +4511,7 @@ var wr = class {
4494
4511
  }
4495
4512
  startStateNotifications() {
4496
4513
  let e = this.options.onStateChange;
4497
- !e || this.stopStateWatcher || (e(L(this.state, this.notificationItems.value)), this.stopStateWatcher = O(this.state, () => e(L(this.state, this.notificationItems.value)), {
4514
+ !e || this.stopStateWatcher || (e(z(this.state, this.notificationItems.value)), this.stopStateWatcher = O(this.state, () => e(z(this.state, this.notificationItems.value)), {
4498
4515
  deep: !0,
4499
4516
  flush: "post"
4500
4517
  }));
@@ -4503,8 +4520,8 @@ var wr = class {
4503
4520
  this.lastLoadedCursor = e, this.state.current = e;
4504
4521
  }
4505
4522
  };
4506
- function Dr(e) {
4507
- return new Er(e);
4523
+ function kr(e) {
4524
+ return new Or(e);
4508
4525
  }
4509
4526
  //#endregion
4510
- export { Dr as createVibe };
4527
+ export { kr as createVibe };