@wyxos/vibe 5.12.0 → 5.13.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
@@ -60,21 +60,21 @@ function V(e, t) {
60
60
  function H(e) {
61
61
  return [e, ...e.items];
62
62
  }
63
- function ee(e, t) {
64
- return Math.min(e.items.length, Math.max(0, t));
65
- }
66
63
  function U(e, t) {
67
- return H(e)[ee(e, t)] ?? e;
64
+ return Math.min(e.items.length, Math.max(0, t));
68
65
  }
69
66
  function W(e, t) {
67
+ return H(e)[U(e, t)] ?? e;
68
+ }
69
+ function G(e, t) {
70
70
  return `${String(e)}:${t}`;
71
71
  }
72
72
  //#endregion
73
73
  //#region src/core/runtime.ts
74
- function G(e) {
74
+ function K(e) {
75
75
  return r(() => Object.freeze([...e.items]));
76
76
  }
77
- function te(e, t = [...e.items]) {
77
+ function ee(e, t = [...e.items]) {
78
78
  return {
79
79
  activeReelPostId: e.activeReelPostId,
80
80
  autoScroll: { ...e.autoScroll },
@@ -104,17 +104,17 @@ function te(e, t = [...e.items]) {
104
104
  }
105
105
  //#endregion
106
106
  //#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
107
- var K = {
107
+ var q = {
108
108
  key: 0,
109
109
  class: "gallery-footer"
110
- }, q = {
110
+ }, J = {
111
111
  key: 0,
112
112
  class: "load-more-status",
113
113
  role: "status"
114
- }, ne = ["disabled"], re = {
114
+ }, te = ["disabled"], ne = {
115
115
  key: 2,
116
116
  class: "end-feed"
117
- }, J = ["disabled"], ie = /* @__PURE__ */ d({
117
+ }, re = ["disabled"], ie = /* @__PURE__ */ d({
118
118
  __name: "GalleryFooter",
119
119
  props: {
120
120
  canRetryEnd: { type: Boolean },
@@ -130,14 +130,14 @@ var K = {
130
130
  function i() {
131
131
  n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
132
132
  }
133
- return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", K, [e.isLoading ? (b(), s("p", q, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
133
+ return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", q, [e.isLoading ? (b(), s("p", J, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
134
134
  key: 1,
135
135
  "data-test": "load-more",
136
136
  class: "load-more-button",
137
137
  type: "button",
138
138
  disabled: e.loadMoreLocked,
139
139
  onClick: i
140
- }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, ne)) : (b(), s("div", re, [n[1] ||= c("p", {
140
+ }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, te)) : (b(), s("div", ne, [n[1] ||= c("p", {
141
141
  class: "end-feed-message",
142
142
  role: "status"
143
143
  }, " You've reached the end. ", -1), c("button", {
@@ -146,7 +146,7 @@ var K = {
146
146
  type: "button",
147
147
  disabled: e.loadMoreLocked,
148
148
  onClick: n[0] ||= (e) => t.$emit("retryEnd")
149
- }, " Check for more ", 8, J)]))])) : o("", !0);
149
+ }, " Check for more ", 8, re)]))])) : o("", !0);
150
150
  }
151
151
  }), ae = /* @__PURE__ */ d({
152
152
  __name: "FeedFooter",
@@ -270,41 +270,163 @@ function fe(e, t, n) {
270
270
  return o + de >= s;
271
271
  });
272
272
  }
273
- function Q(e, t, n) {
274
- if (t <= 0 || e.length === 0) return {
273
+ function Q(e, t) {
274
+ if (e <= 0) return null;
275
+ let n = Math.max(0, t.gap), r = Number.isFinite(t.additionalHeight) ? Math.max(0, t.additionalHeight ?? 0) : 0, i = Math.max(1, t.minColumnWidth), a = Math.max(1, Math.floor((e + n) / (i + n)));
276
+ return {
277
+ additionalHeight: r,
278
+ columns: a,
279
+ gap: n,
280
+ itemWidth: (e - n * (a - 1)) / a
281
+ };
282
+ }
283
+ function pe(e, t, n) {
284
+ let r = Z(t), i = n.itemWidth * X(e) + n.additionalHeight, a = {
285
+ x: r * (n.itemWidth + n.gap),
286
+ y: t[r],
287
+ width: n.itemWidth,
288
+ height: i
289
+ };
290
+ return t[r] += i + n.gap, a;
291
+ }
292
+ function me(e, t) {
293
+ let n = Array.from({ length: t.columns }, () => 0), r = t.itemWidth + t.gap;
294
+ return e.forEach((e) => {
295
+ let i = r === 0 ? 0 : Math.round(e.x / r);
296
+ i < 0 || i >= t.columns || (n[i] = Math.max(n[i], e.y + e.height + t.gap));
297
+ }), n;
298
+ }
299
+ function he(e, t) {
300
+ return e.length === 0 ? 0 : Math.max(0, Math.max(...e) - t);
301
+ }
302
+ function ge(e, t, n) {
303
+ let r = Q(t, n);
304
+ if (!r || e.length === 0) return {
275
305
  columns: 0,
276
306
  height: 0,
277
307
  items: []
278
308
  };
279
- 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) => {
280
- let t = Z(c), n = s * X(e) + i, a = {
281
- x: t * (s + r),
282
- y: c[t],
283
- width: s,
284
- height: n
309
+ let i = Array.from({ length: r.columns }, () => 0), a = e.map((e) => pe(e, i, r));
310
+ return {
311
+ columns: r.columns,
312
+ height: he(i, r.gap),
313
+ items: a
314
+ };
315
+ }
316
+ function _e(e, t, n, r, i, a) {
317
+ let o = Q(t, n);
318
+ if (!o || e.length === 0) return {
319
+ columns: 0,
320
+ height: 0,
321
+ items: []
322
+ };
323
+ if (r.columns !== o.columns || i > 0 && r.items.length < i) return ge(e, t, n);
324
+ let s = Math.max(0, i), c = a?.untilIndex ?? e.length, l = a?.untilBottom, u = s === 0 ? [] : r.items.slice(0, s), d = s === 0 ? Array.from({ length: o.columns }, () => 0) : me(u, o);
325
+ for (let t = s; t < e.length && t < c && !(l !== void 0 && t > s && d.every((e) => e >= l)); t += 1) u.push(pe(e[t], d, o));
326
+ return {
327
+ columns: o.columns,
328
+ height: he(d, o.gap),
329
+ items: u
330
+ };
331
+ }
332
+ function ve(e, t, n, r, i, a) {
333
+ let o = Q(t, n);
334
+ if (!o || e.length === 0) return {
335
+ columns: 0,
336
+ fromIndex: 0,
337
+ height: 0,
338
+ items: [],
339
+ retainedIndices: []
340
+ };
341
+ if (r.items.length !== e.length || r.columns !== o.columns) {
342
+ let a = e.map((e, t) => t).filter((e) => !i(e)), o = ge(a.map((t) => e[t]), t, n), s = e.map((e, t) => r.items[t] ?? {
343
+ height: 0,
344
+ width: 0,
345
+ x: 0,
346
+ y: 0
347
+ });
348
+ return a.forEach((e, t) => {
349
+ s[e] = o.items[t];
350
+ }), {
351
+ columns: o.columns,
352
+ fromIndex: 0,
353
+ height: o.height,
354
+ items: s,
355
+ retainedIndices: a
285
356
  };
286
- return c[t] += n + r, a;
287
- });
357
+ }
358
+ let s = 0;
359
+ for (; s < e.length && !i(s);) s += 1;
360
+ if (s >= e.length) return {
361
+ ...r,
362
+ fromIndex: s,
363
+ retainedIndices: e.map((e, t) => t)
364
+ };
365
+ let c = r.items.slice(), l = [];
366
+ for (let e = 0; e < s; e += 1) l.push(e);
367
+ let u = me(c.slice(0, s), o);
368
+ for (let t = s; t < e.length; t += 1) if (!i(t)) {
369
+ if (a !== void 0 && l.length > s && u.every((e) => e >= a)) break;
370
+ c[t] = pe(e[t], u, o), l.push(t);
371
+ }
288
372
  return {
289
- columns: o,
290
- height: Math.max(...c) - r,
291
- items: l
373
+ columns: o.columns,
374
+ fromIndex: s,
375
+ height: he(u, o.gap),
376
+ items: c,
377
+ retainedIndices: l
292
378
  };
293
379
  }
294
380
  //#endregion
295
381
  //#region src/core/masonryViewportIndex.ts
296
- function pe(e, t) {
382
+ function ye(e) {
383
+ return { columns: [...e.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
384
+ }
385
+ function be(e, t, n) {
386
+ let r = e.get(t.x) ?? [];
387
+ r.push({
388
+ bottom: t.y + t.height,
389
+ index: n,
390
+ top: t.y
391
+ }), e.set(t.x, r);
392
+ }
393
+ function xe(e, t) {
297
394
  let n = /* @__PURE__ */ new Map();
298
395
  return e.forEach((e, r) => {
299
- let i = n.get(e.x) ?? [];
300
- i.push({
301
- bottom: e.y + e.height,
302
- index: t?.[r] ?? r,
303
- top: e.y
304
- }), n.set(e.x, i);
305
- }), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
396
+ be(n, e, t?.[r] ?? r);
397
+ }), ye(n);
398
+ }
399
+ function Se(e, t, n, r) {
400
+ if (n <= 0) return xe(e, r);
401
+ let i = /* @__PURE__ */ new Map();
402
+ t.columns.forEach((t) => {
403
+ t.forEach((t) => {
404
+ if (t.index >= n) return;
405
+ let r = e[t.index];
406
+ if (!r) return;
407
+ let a = i.get(r.x) ?? [];
408
+ a.push(t), i.set(r.x, a);
409
+ });
410
+ });
411
+ for (let t = n; t < e.length; t += 1) be(i, e[t], r?.[t] ?? t);
412
+ return ye(i);
413
+ }
414
+ function Ce(e, t, n, r) {
415
+ if (r <= 0) return xe(t.map((t) => e[t]), t);
416
+ let i = /* @__PURE__ */ new Map();
417
+ return n.columns.forEach((t) => {
418
+ t.forEach((t) => {
419
+ if (t.index >= r) return;
420
+ let n = e[t.index];
421
+ if (!n) return;
422
+ let a = i.get(n.x) ?? [];
423
+ a.push(t), i.set(n.x, a);
424
+ });
425
+ }), t.forEach((t) => {
426
+ t < r || be(i, e[t], t);
427
+ }), ye(i);
306
428
  }
307
- function me(e, t) {
429
+ function we(e, t) {
308
430
  let n = 0, r = 0, i = e.length;
309
431
  for (; r < i;) {
310
432
  let a = Math.floor((r + i) / 2);
@@ -315,10 +437,10 @@ function me(e, t) {
315
437
  inspected: n
316
438
  };
317
439
  }
318
- function he(e, t) {
440
+ function Te(e, t) {
319
441
  let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
320
442
  return e.columns.forEach((e) => {
321
- let t = me(e, r);
443
+ let t = we(e, r);
322
444
  o += t.inspected;
323
445
  for (let n = t.index; n < e.length; n += 1) {
324
446
  let t = e[n];
@@ -330,14 +452,14 @@ function he(e, t) {
330
452
  inspected: o
331
453
  };
332
454
  }
333
- function ge(e) {
455
+ function Ee(e) {
334
456
  return e?.minColumnWidth ?? 240;
335
457
  }
336
- function _e(e, t) {
458
+ function De(e, t) {
337
459
  let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
338
460
  return a === void 0 ? i : Math.min(i, a);
339
461
  }
340
- function ve(e) {
462
+ function Oe(e) {
341
463
  if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
342
464
  let t = e?.overscan;
343
465
  if (t) {
@@ -351,10 +473,10 @@ function ve(e) {
351
473
  }
352
474
  //#endregion
353
475
  //#region src/core/scrollbar.ts
354
- function ye(e, t, n) {
476
+ function ke(e, t, n) {
355
477
  return Math.min(n, Math.max(t, e));
356
478
  }
357
- function be({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
479
+ function Ae({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
358
480
  let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
359
481
  if (!(c > 0 && o > 0)) return {
360
482
  maximumScrollPosition: c,
@@ -363,23 +485,23 @@ function be({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
363
485
  thumbSize: o,
364
486
  thumbTravel: 0
365
487
  };
366
- let l = ye(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
488
+ let l = ke(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
367
489
  return {
368
490
  maximumScrollPosition: c,
369
491
  scrollable: !0,
370
- thumbOffset: u * (ye(n, 0, c) / c),
492
+ thumbOffset: u * (ke(n, 0, c) / c),
371
493
  thumbSize: l,
372
494
  thumbTravel: u
373
495
  };
374
496
  }
375
497
  //#endregion
376
498
  //#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
377
- var xe = ["aria-hidden"], Se = [
499
+ var je = ["aria-hidden"], Me = [
378
500
  "aria-controls",
379
501
  "aria-valuemax",
380
502
  "aria-valuenow",
381
503
  "tabindex"
382
- ], Ce = 32, we = 40, Te = 120, Ee = /* @__PURE__ */ d({
504
+ ], Ne = 32, Pe = 40, Fe = 120, Ie = /* @__PURE__ */ d({
383
505
  __name: "GalleryScrollbar",
384
506
  props: {
385
507
  contentSize: {},
@@ -401,16 +523,16 @@ var xe = ["aria-hidden"], Se = [
401
523
  function k() {
402
524
  g !== null && clearTimeout(g), g = setTimeout(() => {
403
525
  g = null, o.value || (l.value = !1);
404
- }, Te);
526
+ }, Fe);
405
527
  }
406
528
  function A() {
407
529
  l.value = !0, k();
408
530
  }
409
531
  function j() {
410
532
  let e = t.scrollElement, r = i.value;
411
- return !e || !r ? n : be({
533
+ return !e || !r ? n : Ae({
412
534
  contentSize: e.scrollHeight,
413
- minimumThumbSize: Ce,
535
+ minimumThumbSize: Ne,
414
536
  scrollPosition: e.scrollTop,
415
537
  trackSize: r.clientHeight,
416
538
  viewportSize: e.clientHeight
@@ -463,7 +585,7 @@ var xe = ["aria-hidden"], Se = [
463
585
  }
464
586
  function z(e) {
465
587
  if (!E.value) return;
466
- let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - we : e.key === "ArrowDown" ? r + we : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
588
+ let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - Pe : e.key === "ArrowDown" ? r + Pe : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
467
589
  i !== null && (e.preventDefault(), A(), P(i));
468
590
  }
469
591
  function B(e) {
@@ -509,15 +631,15 @@ var xe = ["aria-hidden"], Se = [
509
631
  onPointerdown: I,
510
632
  onPointermove: L,
511
633
  onPointerup: R
512
- }, null, 44, Se)], 42, xe));
634
+ }, null, 44, Me)], 42, je));
513
635
  }
514
- }), De = (e) => {
636
+ }), Le = (e) => {
515
637
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
516
638
  return !1;
517
- }, Oe = (e) => e === "", ke = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Ae = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), je = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Me = (e) => {
518
- let t = je(e);
639
+ }, Re = (e) => e === "", ze = (...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(), Ve = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), He = (e) => {
640
+ let t = Ve(e);
519
641
  return t.charAt(0).toUpperCase() + t.slice(1);
520
- }, Ne = {
642
+ }, Ue = {
521
643
  xmlns: "http://www.w3.org/2000/svg",
522
644
  width: 24,
523
645
  height: 24,
@@ -527,27 +649,27 @@ var xe = ["aria-hidden"], Se = [
527
649
  "stroke-width": 2,
528
650
  "stroke-linecap": "round",
529
651
  "stroke-linejoin": "round"
530
- }, Pe = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Ne.width, color: s = Ne.stroke, ...c }, { slots: l }) => p("svg", {
531
- ...Ne,
652
+ }, We = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Ue.width, color: s = Ue.stroke, ...c }, { slots: l }) => p("svg", {
653
+ ...Ue,
532
654
  ...c,
533
655
  width: o,
534
656
  height: o,
535
657
  stroke: s,
536
- "stroke-width": Oe(n) || Oe(r) || n === !0 || r === !0 ? Number(i || a || Ne["stroke-width"]) * 24 / Number(o) : i || a || Ne["stroke-width"],
537
- class: ke("lucide", c.class, ...e ? [`lucide-${Ae(Me(e))}-icon`, `lucide-${Ae(e)}`] : ["lucide-icon"]),
538
- ...!l.default && !De(c) && { "aria-hidden": "true" }
539
- }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Fe = (e, t) => (n, { slots: r, attrs: i }) => p(Pe, {
658
+ "stroke-width": Re(n) || Re(r) || n === !0 || r === !0 ? Number(i || a || Ue["stroke-width"]) * 24 / Number(o) : i || a || Ue["stroke-width"],
659
+ class: ze("lucide", c.class, ...e ? [`lucide-${Be(He(e))}-icon`, `lucide-${Be(e)}`] : ["lucide-icon"]),
660
+ ...!l.default && !Le(c) && { "aria-hidden": "true" }
661
+ }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Ge = (e, t) => (n, { slots: r, attrs: i }) => p(We, {
540
662
  ...i,
541
663
  ...n,
542
664
  iconNode: t,
543
665
  name: e
544
- }, r), Ie = Fe("chevron-left", [["path", {
666
+ }, r), Ke = Ge("chevron-left", [["path", {
545
667
  d: "m15 18-6-6 6-6",
546
668
  key: "1wnfg3"
547
- }]]), Le = Fe("chevron-right", [["path", {
669
+ }]]), qe = Ge("chevron-right", [["path", {
548
670
  d: "m9 18 6-6-6-6",
549
671
  key: "mthhwq"
550
- }]]), Re = Fe("disc-3", [
672
+ }]]), Je = Ge("disc-3", [
551
673
  ["circle", {
552
674
  cx: "12",
553
675
  cy: "12",
@@ -568,7 +690,7 @@ var xe = ["aria-hidden"], Se = [
568
690
  d: "M18 12c0 1.7-.7 3.2-1.8 4.2",
569
691
  key: "1eah9h"
570
692
  }]
571
- ]), ze = Fe("pause", [["rect", {
693
+ ]), Ye = Ge("pause", [["rect", {
572
694
  x: "14",
573
695
  y: "3",
574
696
  width: "5",
@@ -582,10 +704,10 @@ var xe = ["aria-hidden"], Se = [
582
704
  height: "18",
583
705
  rx: "1",
584
706
  key: "1wsw3u"
585
- }]]), Be = Fe("play", [["path", {
707
+ }]]), Xe = Ge("play", [["path", {
586
708
  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",
587
709
  key: "10ikf1"
588
- }]]), Ve = Fe("volume-2", [
710
+ }]]), Ze = Ge("volume-2", [
589
711
  ["path", {
590
712
  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",
591
713
  key: "uqj9uw"
@@ -598,7 +720,7 @@ var xe = ["aria-hidden"], Se = [
598
720
  d: "M19.364 18.364a9 9 0 0 0 0-12.728",
599
721
  key: "ijwkga"
600
722
  }]
601
- ]), He = Fe("volume-x", [
723
+ ]), Qe = Ge("volume-x", [
602
724
  ["path", {
603
725
  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",
604
726
  key: "uqj9uw"
@@ -617,22 +739,22 @@ var xe = ["aria-hidden"], Se = [
617
739
  y2: "15",
618
740
  key: "5ykzw1"
619
741
  }]
620
- ]), Ue = {
742
+ ]), $e = {
621
743
  401: "Authentication required",
622
744
  403: "Access forbidden",
623
745
  404: "Preview not found",
624
746
  419: "Session expired",
625
747
  500: "Server error"
626
748
  };
627
- function We(e) {
749
+ function et(e) {
628
750
  return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
629
751
  }
630
- function Ge(e) {
631
- return Ue[We(e)] ?? "Preview unavailable";
752
+ function tt(e) {
753
+ return $e[et(e)] ?? "Preview unavailable";
632
754
  }
633
755
  //#endregion
634
756
  //#region src/components/CardRegion.vue
635
- var Ke = /* @__PURE__ */ d({
757
+ var nt = /* @__PURE__ */ d({
636
758
  __name: "CardRegion",
637
759
  props: {
638
760
  index: {},
@@ -647,7 +769,7 @@ var Ke = /* @__PURE__ */ d({
647
769
  total: {}
648
770
  },
649
771
  setup(e) {
650
- let t = e, n = r(() => ee(t.item, t.mediaIndex)), i = r(() => H(t.item)), o = r(() => U(t.item, n.value)), c = r(() => ({
772
+ let t = e, n = r(() => U(t.item, t.mediaIndex)), i = r(() => H(t.item)), o = r(() => W(t.item, n.value)), c = r(() => ({
651
773
  height: `${t.region.height}px`,
652
774
  paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
653
775
  paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
@@ -679,7 +801,7 @@ var Ke = /* @__PURE__ */ d({
679
801
  "total"
680
802
  ]))], 38));
681
803
  }
682
- }), qe = ["aria-busy", "aria-label"], Je = { class: "media-error-code" }, Ye = ["disabled"], Xe = /* @__PURE__ */ d({
804
+ }), rt = ["aria-busy", "aria-label"], it = { class: "media-error-code" }, at = ["disabled"], ot = /* @__PURE__ */ d({
683
805
  __name: "MediaError",
684
806
  props: {
685
807
  component: {},
@@ -714,7 +836,7 @@ var Ke = /* @__PURE__ */ d({
714
836
  "retrying",
715
837
  "status"
716
838
  ]))], 32)) : (b(), s(e, { key: 1 }, [
717
- c("strong", Je, T(t.status), 1),
839
+ c("strong", it, T(t.status), 1),
718
840
  c("span", null, T(t.label), 1),
719
841
  c("button", {
720
842
  "data-test": "media-retry",
@@ -723,26 +845,26 @@ var Ke = /* @__PURE__ */ d({
723
845
  disabled: t.retrying,
724
846
  onClick: j(o, ["stop"]),
725
847
  onKeydown: r[2] ||= j(() => {}, ["stop"])
726
- }, T(t.retrying ? "Retrying…" : "Retry"), 41, Ye)
727
- ], 64))], 8, qe));
848
+ }, T(t.retrying ? "Retrying…" : "Retry"), 41, at)
849
+ ], 64))], 8, rt));
728
850
  }
729
- }), Ze = ["aria-label"], Qe = [
851
+ }), st = ["aria-label"], ct = [
730
852
  "max",
731
853
  "value",
732
854
  "aria-label",
733
855
  "aria-valuetext",
734
856
  "disabled"
735
- ], $e = {
857
+ ], lt = {
736
858
  key: 0,
737
859
  class: "media-controls-row"
738
- }, et = ["aria-label", "title"], tt = { class: "media-controls-audio" }, nt = ["aria-label", "title"], rt = [
860
+ }, ut = ["aria-label", "title"], dt = { class: "media-controls-audio" }, ft = ["aria-label", "title"], pt = [
739
861
  "value",
740
862
  "aria-label",
741
863
  "aria-valuetext"
742
- ], it = {
864
+ ], mt = {
743
865
  class: "media-control-time",
744
866
  "aria-live": "off"
745
- }, at = /* @__PURE__ */ d({
867
+ }, ht = /* @__PURE__ */ d({
746
868
  __name: "MediaControls",
747
869
  props: {
748
870
  currentTime: {},
@@ -792,35 +914,35 @@ var Ke = /* @__PURE__ */ d({
792
914
  "aria-valuetext": `${u(g.value)} of ${u(f.value)}`,
793
915
  disabled: f.value <= 0,
794
916
  onInput: n[0] ||= (e) => i("seek", d(e))
795
- }, null, 44, Qe), e.layout === "reel" ? (b(), s("div", $e, [
917
+ }, null, 44, ct), e.layout === "reel" ? (b(), s("div", lt, [
796
918
  c("button", {
797
919
  type: "button",
798
920
  class: "media-control-button media-control-playback",
799
921
  "aria-label": e.playing ? `Pause ${p.value}` : `Play ${p.value}`,
800
922
  title: e.playing ? "Pause" : "Play",
801
923
  onClick: n[1] ||= (e) => i("togglePlayback")
802
- }, [e.playing ? (b(), a(E(ze), {
924
+ }, [e.playing ? (b(), a(E(Ye), {
803
925
  key: 0,
804
926
  size: 18,
805
927
  fill: "currentColor"
806
- })) : (b(), a(E(Be), {
928
+ })) : (b(), a(E(Xe), {
807
929
  key: 1,
808
930
  size: 18,
809
931
  fill: "currentColor"
810
- }))], 8, et),
811
- c("div", tt, [c("button", {
932
+ }))], 8, ut),
933
+ c("div", dt, [c("button", {
812
934
  type: "button",
813
935
  class: "media-control-button",
814
936
  "aria-label": e.muted ? `Unmute ${p.value}` : `Mute ${p.value}`,
815
937
  title: e.muted ? "Unmute" : "Mute",
816
938
  onClick: n[2] ||= (e) => i("toggleMute")
817
- }, [e.muted || e.volume === 0 ? (b(), a(E(He), {
939
+ }, [e.muted || e.volume === 0 ? (b(), a(E(Qe), {
818
940
  key: 0,
819
941
  size: 18
820
- })) : (b(), a(E(Ve), {
942
+ })) : (b(), a(E(Ze), {
821
943
  key: 1,
822
944
  size: 18
823
- }))], 8, nt), c("input", {
945
+ }))], 8, ft), c("input", {
824
946
  class: "media-control-range media-control-volume",
825
947
  type: "range",
826
948
  min: "0",
@@ -831,15 +953,15 @@ var Ke = /* @__PURE__ */ d({
831
953
  "aria-label": `${m.value} volume`,
832
954
  "aria-valuetext": `${Math.round(e.volume * 100)} percent`,
833
955
  onInput: n[3] ||= (e) => i("volumeChange", d(e))
834
- }, null, 44, rt)]),
835
- c("output", it, T(u(g.value)) + " / " + T(u(f.value)), 1)
836
- ])) : o("", !0)], 42, Ze));
956
+ }, null, 44, pt)]),
957
+ c("output", mt, T(u(g.value)) + " / " + T(u(f.value)), 1)
958
+ ])) : o("", !0)], 42, st));
837
959
  }
838
- }), ot = {
960
+ }), gt = {
839
961
  key: 0,
840
962
  class: "media-card-overlay-host",
841
963
  "data-test": "media-card-overlay"
842
- }, st = /* @__PURE__ */ d({
964
+ }, _t = /* @__PURE__ */ d({
843
965
  __name: "MediaContextOverlay",
844
966
  props: {
845
967
  item: {},
@@ -849,7 +971,7 @@ var Ke = /* @__PURE__ */ d({
849
971
  mediaSource: {}
850
972
  },
851
973
  setup(e) {
852
- return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div", ot, [(b(), a(C(e.mediaCard.overlay.component), {
974
+ return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div", gt, [(b(), a(C(e.mediaCard.overlay.component), {
853
975
  item: e.item,
854
976
  "media-index": e.mediaIndex,
855
977
  "media-item": e.mediaItem,
@@ -861,8 +983,8 @@ var Ke = /* @__PURE__ */ d({
861
983
  "media-source"
862
984
  ]))])) : o("", !0);
863
985
  }
864
- }), ct = 40, lt = 160, ut = 24;
865
- function dt(e) {
986
+ }), vt = 40, yt = 160, bt = 24;
987
+ function xt(e) {
866
988
  let t = w("next"), n = null, r = 0, i = !1, a = null, o = null;
867
989
  function s(n, r) {
868
990
  let i = H(e.item()).length, a = (n + i) % i;
@@ -872,7 +994,7 @@ function dt(e) {
872
994
  r = 0, i = !1, n !== null && clearTimeout(n), n = null;
873
995
  }
874
996
  function l() {
875
- n !== null && clearTimeout(n), n = setTimeout(c, lt);
997
+ n !== null && clearTimeout(n), n = setTimeout(c, yt);
876
998
  }
877
999
  function u(e, t, n) {
878
1000
  return t === 1 ? e * 16 : t === 2 ? e * n : e;
@@ -880,7 +1002,7 @@ function dt(e) {
880
1002
  function d(t) {
881
1003
  if (H(e.item()).length <= 1) return;
882
1004
  let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
883
- if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < ut)) return;
1005
+ if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < bt)) return;
884
1006
  let o = Math.sign(r);
885
1007
  r = 0, i = !0, s(e.mediaIndex() + o);
886
1008
  }
@@ -892,7 +1014,7 @@ function dt(e) {
892
1014
  let n = t.changedTouches[0];
893
1015
  if (a === null || o === null || !n) return;
894
1016
  let r = a - n.clientX, i = o - n.clientY;
895
- a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < ct || s(e.mediaIndex() + Math.sign(r)));
1017
+ a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < vt || s(e.mediaIndex() + Math.sign(r)));
896
1018
  }
897
1019
  return v(c), {
898
1020
  change: s,
@@ -902,14 +1024,14 @@ function dt(e) {
902
1024
  onWheel: d
903
1025
  };
904
1026
  }
905
- var ft = /* @__PURE__ */ new Map(), pt = [], mt = 0, ht = 0;
906
- function gt(e, t) {
1027
+ var St = /* @__PURE__ */ new Map(), Ct = [], wt = 0, Tt = 0;
1028
+ function Et(e, t) {
907
1029
  return `${t ? "timed" : "image"}:${e}`;
908
1030
  }
909
- function _t(e, t, n) {
1031
+ function Dt(e, t, n) {
910
1032
  let r = H(e);
911
1033
  if (r.length < 2) return [];
912
- let i = ee(e, t), a = [];
1034
+ let i = U(e, t), a = [];
913
1035
  for (let e = 1; e < r.length; e += 1) {
914
1036
  let t = i + e, n = i - e;
915
1037
  t < r.length && a.push(t), n >= 0 && a.push(n);
@@ -920,7 +1042,7 @@ function _t(e, t, n) {
920
1042
  if (!t) return [];
921
1043
  let i = I(t.type, t.src) === "audio" ? B(t) : z(t, n);
922
1044
  if (!i) return [];
923
- let a = L(i.type, i.src), s = gt(i.src, a);
1045
+ let a = L(i.type, i.src), s = Et(i.src, a);
924
1046
  return o.has(s) ? [] : (o.add(s), [{
925
1047
  key: s,
926
1048
  src: i.src,
@@ -928,22 +1050,22 @@ function _t(e, t, n) {
928
1050
  }]);
929
1051
  });
930
1052
  }
931
- function vt(e) {
1053
+ function Ot(e) {
932
1054
  let t = e.element;
933
1055
  e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
934
1056
  }
935
- function yt(e) {
936
- ft.delete(e.key);
937
- let t = pt.indexOf(e);
938
- t >= 0 && pt.splice(t, 1), e.cancel?.(), e.cancel = null, vt(e);
1057
+ function kt(e) {
1058
+ St.delete(e.key);
1059
+ let t = Ct.indexOf(e);
1060
+ t >= 0 && Ct.splice(t, 1), e.cancel?.(), e.cancel = null, Ot(e);
939
1061
  }
940
- function bt(e) {
941
- e.state = "loading", mt += 1, e.timed && (ht += 1);
1062
+ function At(e) {
1063
+ e.state = "loading", wt += 1, e.timed && (Tt += 1);
942
1064
  let t = !1, n = () => void 0, r = (r) => {
943
- t || (t = !0, n(), --mt, e.timed && --ht, e.cancel = null, e.state = r, r === "failed" && vt(e), e.refs === 0 && yt(e), xt());
1065
+ t || (t = !0, n(), --wt, e.timed && --Tt, e.cancel = null, e.state = r, r === "failed" && Ot(e), e.refs === 0 && kt(e), jt());
944
1066
  };
945
1067
  if (e.cancel = () => {
946
- t || (t = !0, n(), --mt, e.timed && --ht, vt(e), xt());
1068
+ t || (t = !0, n(), --wt, e.timed && --Tt, Ot(e), jt());
947
1069
  }, e.timed) {
948
1070
  let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
949
1071
  n = () => {
@@ -962,38 +1084,38 @@ function bt(e) {
962
1084
  i.removeEventListener("load", a), i.removeEventListener("error", o);
963
1085
  }, i.addEventListener("load", a, { once: !0 }), i.addEventListener("error", o, { once: !0 }), i.decoding = "async", i.fetchPriority = "low", i.src = e.src, e.element = i;
964
1086
  }
965
- function xt() {
966
- for (; mt < 6;) {
967
- let e = pt.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || ht < 2));
1087
+ function jt() {
1088
+ for (; wt < 6;) {
1089
+ let e = Ct.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || Tt < 2));
968
1090
  if (e < 0) return;
969
- let [t] = pt.splice(e, 1);
970
- t && bt(t);
1091
+ let [t] = Ct.splice(e, 1);
1092
+ t && At(t);
971
1093
  }
972
1094
  }
973
- function St(e) {
974
- let t = ft.get(e.key);
1095
+ function Mt(e) {
1096
+ let t = St.get(e.key);
975
1097
  t || (t = {
976
1098
  ...e,
977
1099
  cancel: null,
978
1100
  element: null,
979
1101
  refs: 0,
980
1102
  state: "queued"
981
- }, ft.set(t.key, t), pt.push(t)), t.refs += 1, xt();
1103
+ }, St.set(t.key, t), Ct.push(t)), t.refs += 1, jt();
982
1104
  let n = !1;
983
1105
  return () => {
984
- n || (n = !0, --t.refs, t.refs === 0 && yt(t));
1106
+ n || (n = !0, --t.refs, t.refs === 0 && kt(t));
985
1107
  };
986
1108
  }
987
1109
  //#endregion
988
1110
  //#region src/components/useVisiblePostPreload.ts
989
- function Ct(e) {
990
- let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? _t(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
1111
+ function Nt(e) {
1112
+ let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? Dt(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
991
1113
  function a() {
992
1114
  let e = new Map(n.value.map((e) => [e.key, e]));
993
1115
  i.forEach((t, n) => {
994
1116
  e.has(n) || (t(), i.delete(n));
995
1117
  }), n.value.forEach((e) => {
996
- i.has(e.key) || i.set(e.key, St(e));
1118
+ i.has(e.key) || i.set(e.key, Mt(e));
997
1119
  });
998
1120
  }
999
1121
  O(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), v(() => {
@@ -1002,7 +1124,7 @@ function Ct(e) {
1002
1124
  }
1003
1125
  //#endregion
1004
1126
  //#region src/components/useMediaLoading.ts
1005
- function wt(e) {
1127
+ function Pt(e) {
1006
1128
  let t = r(() => L(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");
1007
1129
  return O(i, (t, n) => {
1008
1130
  n !== "none" || t === "none" || m(() => e.mediaElement.value?.load());
@@ -1014,7 +1136,7 @@ function wt(e) {
1014
1136
  }
1015
1137
  //#endregion
1016
1138
  //#region src/components/useMediaReadiness.ts
1017
- function Tt(e) {
1139
+ function Ft(e) {
1018
1140
  let t = w(null), n = w(null), i = w(0), a = w(0), o = w(!0), s = w(!1), c = w(!1), l = null, u = !1, d = r(() => c.value || s.value ? "error" : o.value ? "loading" : e.previewState());
1019
1141
  function f() {
1020
1142
  l !== null && clearTimeout(l), l = null;
@@ -1072,30 +1194,30 @@ function Tt(e) {
1072
1194
  }
1073
1195
  //#endregion
1074
1196
  //#region src/core/reelAudio.ts
1075
- var Et = {
1197
+ var It = {
1076
1198
  lastAudibleVolume: 1,
1077
1199
  muted: !1,
1078
1200
  volume: 1
1079
1201
  };
1080
- function Dt(e, t) {
1202
+ function Lt(e, t) {
1081
1203
  return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
1082
1204
  }
1083
- function Ot(e, t = Et) {
1084
- let n = Dt(e?.volume, t.volume), r = Dt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
1205
+ function Rt(e, t = It) {
1206
+ let n = Lt(e?.volume, t.volume), r = Lt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
1085
1207
  return {
1086
- lastAudibleVolume: r > 0 ? r : Et.lastAudibleVolume,
1208
+ lastAudibleVolume: r > 0 ? r : It.lastAudibleVolume,
1087
1209
  muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
1088
1210
  volume: n
1089
1211
  };
1090
1212
  }
1091
1213
  //#endregion
1092
1214
  //#region src/components/useMediaCardAudio.ts
1093
- function kt(e) {
1094
- let t = Ot(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
1215
+ function zt(e) {
1216
+ let t = Rt(e.reelAudioState()), n = e.layout() === "reel" && e.reelAudioState(), r = w(n ? t.muted : e.mediaCard()?.videoMuted ?? e.layout() === "masonry"), i = w(n ? t.volume : 1), a = n ? t.lastAudibleVolume : 1;
1095
1217
  function o() {
1096
1218
  let t = e.mediaElement.value, n = e.reelAudioState();
1097
1219
  if (!t || e.layout() !== "reel" || !n) return;
1098
- let o = Ot(n);
1220
+ let o = Rt(n);
1099
1221
  a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
1100
1222
  }
1101
1223
  function s(e, t) {
@@ -1103,7 +1225,7 @@ function kt(e) {
1103
1225
  }
1104
1226
  function c(t) {
1105
1227
  if (e.layout() !== "reel") return;
1106
- let n = Ot({
1228
+ let n = Rt({
1107
1229
  lastAudibleVolume: a,
1108
1230
  muted: t.muted,
1109
1231
  volume: t.volume
@@ -1138,7 +1260,7 @@ function kt(e) {
1138
1260
  }
1139
1261
  //#endregion
1140
1262
  //#region src/components/useReelVideoActivity.ts
1141
- function At(e) {
1263
+ function Bt(e) {
1142
1264
  let t = r(() => e.layout() === "reel" ? e.active() === !0 : e.inViewport()), n = r(() => t.value ? e.mediaIsMuted.value : !0);
1143
1265
  function i() {
1144
1266
  if (!t.value) {
@@ -1172,18 +1294,18 @@ function At(e) {
1172
1294
  }
1173
1295
  //#endregion
1174
1296
  //#region src/components/useTimedMediaCard.ts
1175
- function jt(e) {
1297
+ function Vt(e) {
1176
1298
  return Number.isFinite(e) ? Math.max(0, e) : 0;
1177
1299
  }
1178
- function Mt(e) {
1179
- let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = kt({
1300
+ function Ht(e) {
1301
+ let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = zt({
1180
1302
  active: e.active,
1181
1303
  layout: e.layout,
1182
1304
  mediaCard: e.mediaCard,
1183
1305
  mediaElement: e.mediaElement,
1184
1306
  onChange: e.onAudioChange,
1185
1307
  reelAudioState: e.reelAudioState
1186
- }), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = At({
1308
+ }), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = Bt({
1187
1309
  active: e.active,
1188
1310
  inViewport: e.inViewport,
1189
1311
  layout: e.layout,
@@ -1193,7 +1315,7 @@ function Mt(e) {
1193
1315
  });
1194
1316
  function p(r) {
1195
1317
  let i = r?.currentTarget ?? e.mediaElement.value;
1196
- i && (t.value = jt(i.currentTime), n.value = jt(i.duration), o(i, f.value));
1318
+ i && (t.value = Vt(i.currentTime), n.value = Vt(i.duration), o(i, f.value));
1197
1319
  }
1198
1320
  function m(t) {
1199
1321
  i(), p(t), e.onReady(t);
@@ -1203,7 +1325,7 @@ function Mt(e) {
1203
1325
  }
1204
1326
  function g(n) {
1205
1327
  let r = e.mediaElement.value;
1206
- !r || !Number.isFinite(n) || (r.currentTime = Math.min(jt(r.duration), Math.max(0, n)), t.value = r.currentTime);
1328
+ !r || !Number.isFinite(n) || (r.currentTime = Math.min(Vt(r.duration), Math.max(0, n)), t.value = r.currentTime);
1207
1329
  }
1208
1330
  async function _() {
1209
1331
  let t = e.mediaElement.value;
@@ -1241,7 +1363,7 @@ function Mt(e) {
1241
1363
  }
1242
1364
  //#endregion
1243
1365
  //#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
1244
- var Nt = [
1366
+ var Ut = [
1245
1367
  "data-post-id",
1246
1368
  "data-media-index",
1247
1369
  "aria-hidden",
@@ -1249,29 +1371,29 @@ var Nt = [
1249
1371
  "inert",
1250
1372
  "role",
1251
1373
  "tabindex"
1252
- ], Pt = { class: "media-card-content" }, Ft = ["data-media-direction"], It = ["data-media-index"], Lt = {
1374
+ ], Wt = { class: "media-card-content" }, Gt = ["data-media-direction"], Kt = ["data-media-index"], qt = {
1253
1375
  key: 0,
1254
1376
  "data-test": "media-loading",
1255
1377
  class: "media-loading",
1256
1378
  "aria-hidden": "true"
1257
- }, Rt = [
1379
+ }, Jt = [
1258
1380
  "data-source-generation",
1259
1381
  "src",
1260
1382
  "autoplay",
1261
1383
  "loop",
1262
1384
  "muted",
1263
1385
  "preload"
1264
- ], zt = ["aria-label", "disabled"], Bt = [
1386
+ ], Yt = ["aria-label", "disabled"], Xt = [
1265
1387
  "src",
1266
1388
  "width",
1267
1389
  "height",
1268
1390
  "fetchpriority",
1269
1391
  "loading"
1270
- ], Vt = {
1392
+ ], Zt = {
1271
1393
  key: 1,
1272
1394
  class: "media-audio-fallback",
1273
1395
  "aria-hidden": "true"
1274
- }, Ht = [
1396
+ }, Qt = [
1275
1397
  "data-source-generation",
1276
1398
  "src",
1277
1399
  "width",
@@ -1280,14 +1402,14 @@ var Nt = [
1280
1402
  "loop",
1281
1403
  "muted",
1282
1404
  "preload"
1283
- ], Ut = [
1405
+ ], $t = [
1284
1406
  "data-source-generation",
1285
1407
  "src",
1286
1408
  "width",
1287
1409
  "height",
1288
1410
  "fetchpriority",
1289
1411
  "loading"
1290
- ], Wt = ["aria-label"], Gt = ["aria-label"], Kt = ["aria-label"], qt = /* @__PURE__ */ d({
1412
+ ], en = ["aria-label"], tn = ["aria-label"], nn = ["aria-label"], rn = /* @__PURE__ */ d({
1291
1413
  __name: "MediaCard",
1292
1414
  props: {
1293
1415
  active: { type: Boolean },
@@ -1326,23 +1448,23 @@ var Nt = [
1326
1448
  function f(e = !1, t = "pointer") {
1327
1449
  e && d("activate", t);
1328
1450
  }
1329
- let p = r(() => H(l.item)), g = r(() => ee(l.item, l.mediaIndex)), v = r(() => U(l.item, g.value)), y = r(() => z(v.value, l.mediaSource ?? "preview")), x = r(() => I(v.value.type, v.value.src)), S = r(() => x.value === "audio"), C = r(() => V(v.value, l.mediaSource ?? "preview")), T = r(() => S.value ? C.value : y.value), D = r(() => T.value.src), M = r(() => I(T.value.type, T.value.src)), N = r(() => y.value.width), P = r(() => y.value.height), F = r(() => B(v.value)), L = w(!1), R = r(() => L.value ? null : F.value), { effectivePreviewState: W, failSourceAttempt: G, imageElement: te, markSourceReady: K, noteSourceActivity: q, retrySource: ne, retrying: re, sourceGeneration: J, mediaElement: ie } = Tt({
1451
+ let p = r(() => H(l.item)), g = r(() => U(l.item, l.mediaIndex)), v = r(() => W(l.item, g.value)), y = r(() => z(v.value, l.mediaSource ?? "preview")), x = r(() => I(v.value.type, v.value.src)), S = r(() => x.value === "audio"), C = r(() => V(v.value, l.mediaSource ?? "preview")), T = r(() => S.value ? C.value : y.value), D = r(() => T.value.src), M = r(() => I(T.value.type, T.value.src)), N = r(() => y.value.width), P = r(() => y.value.height), F = r(() => B(v.value)), L = w(!1), R = r(() => L.value ? null : F.value), { effectivePreviewState: G, failSourceAttempt: K, imageElement: ee, markSourceReady: q, noteSourceActivity: J, retrySource: te, retrying: ne, sourceGeneration: re, mediaElement: ie } = Ft({
1330
1452
  identity: () => `${l.item.postId}:${g.value}:${l.mediaSource ?? "preview"}:${D.value}:${M.value ?? ""}`,
1331
1453
  mediaIndex: () => g.value,
1332
1454
  onError: (e) => d("error", e),
1333
1455
  onReady: (e) => d("ready", e),
1334
1456
  previewState: () => l.previewState
1335
1457
  });
1336
- Ct({
1458
+ Nt({
1337
1459
  inViewport: () => l.inViewport === !0,
1338
1460
  item: () => l.item,
1339
1461
  layout: () => l.layout,
1340
1462
  mediaCard: () => l.mediaCard,
1341
1463
  mediaIndex: () => g.value,
1342
- mediaReady: () => W.value === "ready",
1464
+ mediaReady: () => G.value === "ready",
1343
1465
  mediaSource: () => l.mediaSource ?? "preview"
1344
1466
  });
1345
- let { currentTime: ae, duration: oe, effectiveMuted: Y, isMuted: se, isPlaying: ce, onEnded: X, onLoadedMetadata: Z, onPlaying: le, playbackAllowed: ue, seek: de, setVolume: fe, sync: Q, toggleMute: pe, togglePlayback: me, volume: he } = Mt({
1467
+ let { currentTime: ae, duration: oe, effectiveMuted: Y, isMuted: se, isPlaying: ce, onEnded: X, onLoadedMetadata: Z, onPlaying: le, playbackAllowed: ue, seek: de, setVolume: fe, sync: Q, toggleMute: pe, togglePlayback: me, volume: he } = Ht({
1346
1468
  active: () => l.active,
1347
1469
  inViewport: () => l.inViewport === !0,
1348
1470
  layout: () => l.layout,
@@ -1350,30 +1472,30 @@ var Nt = [
1350
1472
  mediaElement: ie,
1351
1473
  onAudioChange: (e) => d("reelAudioChange", e),
1352
1474
  onEnded: () => d("ended", g.value),
1353
- onReady: K,
1475
+ onReady: q,
1354
1476
  reelAudioState: () => l.reelAudioState
1355
1477
  }), ge = r(() => l.interactive && !!(l.cardHeader || l.cardFooter));
1356
1478
  function _e(e) {
1357
1479
  return e.detail === 0 ? "keyboard" : "pointer";
1358
1480
  }
1359
- let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } = dt({
1481
+ let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } = xt({
1360
1482
  item: () => l.item,
1361
1483
  layout: () => l.layout,
1362
1484
  mediaIndex: () => g.value,
1363
1485
  onChange: (e) => d("mediaChange", e)
1364
- }), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } = wt({
1486
+ }), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } = Pt({
1365
1487
  active: () => l.active,
1366
1488
  fetchPriority: () => l.fetchPriority,
1367
1489
  layout: () => l.layout,
1368
1490
  mediaSource: () => D.value,
1369
1491
  mediaType: () => M.value,
1370
1492
  mediaElement: ie
1371
- }), Ee = r(() => l.layout === "reel" && l.stationaryReelControls === !0), De = r(() => we.value && (!S.value || l.layout === "reel") && W.value === "ready" && (!Ee.value || !!(l.active && l.reelControlsTarget))), Oe = r(() => `${l.item.postId}:${g.value}:${D.value}`);
1493
+ }), Ee = r(() => l.layout === "reel" && l.stationaryReelControls === !0), De = r(() => we.value && (!S.value || l.layout === "reel") && G.value === "ready" && (!Ee.value || !!(l.active && l.reelControlsTarget))), Oe = r(() => `${l.item.postId}:${g.value}:${D.value}`);
1372
1494
  function ke(e) {
1373
1495
  l.layout === "reel" && (e.stopPropagation(), me());
1374
1496
  }
1375
1497
  function Ae() {
1376
- L.value = !0, l.layout === "masonry" && K();
1498
+ L.value = !0, l.layout === "masonry" && q();
1377
1499
  }
1378
1500
  return O(() => F.value?.src, () => {
1379
1501
  L.value = !1;
@@ -1382,26 +1504,26 @@ var Nt = [
1382
1504
  () => l.layout,
1383
1505
  R
1384
1506
  ], ([e, t, n]) => {
1385
- e && t === "masonry" && !n && m(() => K());
1507
+ e && t === "masonry" && !n && m(() => q());
1386
1508
  }, { immediate: !0 }), (r, i) => (b(), s("article", {
1387
1509
  "data-post-id": e.item.postId,
1388
1510
  "data-media-index": g.value,
1389
1511
  class: h(["media-card", {
1390
1512
  "media-card--entering": e.entering,
1391
1513
  "media-card--leaving": e.leaving,
1392
- "media-card--error": E(W) === "error",
1514
+ "media-card--error": E(G) === "error",
1393
1515
  "media-card--transparent-chrome": e.mediaCard?.header?.background === "transparent" || e.mediaCard?.footer?.background === "transparent" || e.cardHeader?.background === "transparent" || e.cardFooter?.background === "transparent"
1394
1516
  }]),
1395
1517
  style: _(e.itemStyle),
1396
1518
  "aria-hidden": e.leaving || void 0,
1397
- "aria-busy": E(W) === "loading" || E(re),
1519
+ "aria-busy": E(G) === "loading" || E(ne),
1398
1520
  inert: e.leaving || void 0,
1399
1521
  role: e.interactive && !e.leaving && !ge.value ? "button" : void 0,
1400
1522
  tabindex: e.interactive && !e.leaving && !ge.value ? 0 : void 0,
1401
1523
  onClick: i[34] ||= (t) => f(e.interactive && !ge.value, _e(t)),
1402
1524
  onKeydown: [i[35] ||= A((t) => f(e.interactive && !ge.value, "keyboard"), ["enter"]), i[36] ||= A(j((t) => f(e.interactive && !ge.value, "keyboard"), ["prevent"]), ["space"])]
1403
- }, [c("div", Pt, [
1404
- e.cardHeader ? (b(), a(Ke, {
1525
+ }, [c("div", Wt, [
1526
+ e.cardHeader ? (b(), a(nt, {
1405
1527
  key: 0,
1406
1528
  index: e.index,
1407
1529
  item: e.item,
@@ -1432,21 +1554,21 @@ var Nt = [
1432
1554
  onTouchendPassive: i[33] ||= (...e) => E(be) && E(be)(...e)
1433
1555
  }, [
1434
1556
  u(n, {
1435
- css: !E(re),
1557
+ css: !E(ne),
1436
1558
  name: `media-slide-${E(ye)}`
1437
1559
  }, {
1438
1560
  default: k(() => [(b(), s("div", {
1439
- key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(J)}`,
1561
+ key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(re)}`,
1440
1562
  class: "media-card-frame",
1441
1563
  "data-media-index": g.value
1442
1564
  }, [
1443
- E(W) === "loading" ? (b(), s("div", Lt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(W) === "error" ? (b(), a(Xe, {
1565
+ E(G) === "loading" ? (b(), s("div", qt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(G) === "error" ? (b(), a(ot, {
1444
1566
  key: 1,
1445
1567
  component: e.mediaCard?.error?.component,
1446
- label: E(Ge)(D.value),
1447
- retrying: E(re),
1448
- status: E(We)(D.value),
1449
- onRetry: E(ne)
1568
+ label: E(tt)(D.value),
1569
+ retrying: E(ne),
1570
+ status: E(et)(D.value),
1571
+ onRetry: E(te)
1450
1572
  }, null, 8, [
1451
1573
  "component",
1452
1574
  "label",
@@ -1458,7 +1580,7 @@ var Nt = [
1458
1580
  key: 2,
1459
1581
  ref_key: "mediaElement",
1460
1582
  ref: ie,
1461
- "data-source-generation": E(J),
1583
+ "data-source-generation": E(re),
1462
1584
  class: "media-audio-element",
1463
1585
  src: D.value,
1464
1586
  autoplay: E(ue),
@@ -1466,21 +1588,21 @@ var Nt = [
1466
1588
  muted: E(Y),
1467
1589
  preload: E(Te),
1468
1590
  onLoadedmetadata: i[0] ||= (...e) => E(Z) && E(Z)(...e),
1469
- onProgress: i[1] ||= (...e) => E(q) && E(q)(...e),
1470
- onLoadeddata: i[2] ||= (...e) => E(q) && E(q)(...e),
1471
- onCanplay: i[3] ||= (...e) => E(q) && E(q)(...e),
1591
+ onProgress: i[1] ||= (...e) => E(J) && E(J)(...e),
1592
+ onLoadeddata: i[2] ||= (...e) => E(J) && E(J)(...e),
1593
+ onCanplay: i[3] ||= (...e) => E(J) && E(J)(...e),
1472
1594
  onDurationchange: i[4] ||= (...e) => E(Q) && E(Q)(...e),
1473
1595
  onTimeupdate: i[5] ||= (...e) => E(Q) && E(Q)(...e),
1474
1596
  onVolumechange: i[6] ||= (...e) => E(Q) && E(Q)(...e),
1475
1597
  onPlaying: i[7] ||= (...e) => E(le) && E(le)(...e),
1476
1598
  onPause: i[8] ||= (e) => ce.value = !1,
1477
1599
  onEnded: i[9] ||= (...e) => E(X) && E(X)(...e),
1478
- onError: i[10] ||= (...e) => E(G) && E(G)(...e)
1479
- }, null, 40, Rt)) : o("", !0),
1600
+ onError: i[10] ||= (...e) => E(K) && E(K)(...e)
1601
+ }, null, 40, Jt)) : o("", !0),
1480
1602
  S.value ? (b(), s("button", {
1481
1603
  key: 3,
1482
1604
  type: "button",
1483
- class: h(["media-audio-artwork media-preview", { "media-preview--ready": E(W) === "ready" }]),
1605
+ class: h(["media-audio-artwork media-preview", { "media-preview--ready": E(G) === "ready" }]),
1484
1606
  "aria-label": e.layout === "reel" ? E(ce) ? "Pause audio" : "Play audio" : "Audio",
1485
1607
  disabled: e.layout !== "reel",
1486
1608
  onClick: ke
@@ -1494,18 +1616,18 @@ var Nt = [
1494
1616
  alt: "",
1495
1617
  decoding: "async",
1496
1618
  loading: E(Ce),
1497
- onLoad: i[11] ||= (t) => e.layout === "masonry" && E(K)(t),
1619
+ onLoad: i[11] ||= (t) => e.layout === "masonry" && E(q)(t),
1498
1620
  onError: Ae
1499
- }, null, 40, Bt)) : (b(), s("span", Vt, [u(E(Re), {
1621
+ }, null, 40, Xt)) : (b(), s("span", Zt, [u(E(Je), {
1500
1622
  size: 64,
1501
1623
  "stroke-width": 1.5
1502
- })]))], 10, zt)) : E(we) ? (b(), s("video", {
1624
+ })]))], 10, Yt)) : E(we) ? (b(), s("video", {
1503
1625
  key: 4,
1504
1626
  ref_key: "mediaElement",
1505
1627
  ref: ie,
1506
- "data-source-generation": E(J),
1628
+ "data-source-generation": E(re),
1507
1629
  class: h(["media-preview", {
1508
- "media-preview--ready": E(W) === "ready",
1630
+ "media-preview--ready": E(G) === "ready",
1509
1631
  "media-preview--reel-video": e.layout === "reel"
1510
1632
  }]),
1511
1633
  src: D.value,
@@ -1517,9 +1639,9 @@ var Nt = [
1517
1639
  playsinline: "",
1518
1640
  preload: E(Te),
1519
1641
  onLoadedmetadata: i[12] ||= (...e) => E(Z) && E(Z)(...e),
1520
- onProgress: i[13] ||= (...e) => E(q) && E(q)(...e),
1521
- onLoadeddata: i[14] ||= (...e) => E(q) && E(q)(...e),
1522
- onCanplay: i[15] ||= (...e) => E(q) && E(q)(...e),
1642
+ onProgress: i[13] ||= (...e) => E(J) && E(J)(...e),
1643
+ onLoadeddata: i[14] ||= (...e) => E(J) && E(J)(...e),
1644
+ onCanplay: i[15] ||= (...e) => E(J) && E(J)(...e),
1523
1645
  onDurationchange: i[16] ||= (...e) => E(Q) && E(Q)(...e),
1524
1646
  onTimeupdate: i[17] ||= (...e) => E(Q) && E(Q)(...e),
1525
1647
  onVolumechange: i[18] ||= (...e) => E(Q) && E(Q)(...e),
@@ -1527,13 +1649,13 @@ var Nt = [
1527
1649
  onPause: i[20] ||= (e) => ce.value = !1,
1528
1650
  onEnded: i[21] ||= (...e) => E(X) && E(X)(...e),
1529
1651
  onClick: ke,
1530
- onError: i[22] ||= (...e) => E(G) && E(G)(...e)
1531
- }, null, 42, Ht)) : S.value ? o("", !0) : (b(), s("img", {
1652
+ onError: i[22] ||= (...e) => E(K) && E(K)(...e)
1653
+ }, null, 42, Qt)) : S.value ? o("", !0) : (b(), s("img", {
1532
1654
  key: 5,
1533
1655
  ref_key: "imageElement",
1534
- ref: te,
1535
- "data-source-generation": E(J),
1536
- class: h(["media-preview", { "media-preview--ready": E(W) === "ready" }]),
1656
+ ref: ee,
1657
+ "data-source-generation": E(re),
1658
+ class: h(["media-preview", { "media-preview--ready": E(G) === "ready" }]),
1537
1659
  src: D.value,
1538
1660
  width: N.value ?? void 0,
1539
1661
  height: P.value ?? void 0,
@@ -1541,13 +1663,13 @@ var Nt = [
1541
1663
  alt: "",
1542
1664
  decoding: "async",
1543
1665
  loading: E(Ce),
1544
- onLoad: i[23] ||= (...e) => E(K) && E(K)(...e),
1545
- onError: i[24] ||= (...e) => E(G) && E(G)(...e)
1546
- }, null, 42, Ut))
1547
- ], 8, It))]),
1666
+ onLoad: i[23] ||= (...e) => E(q) && E(q)(...e),
1667
+ onError: i[24] ||= (...e) => E(K) && E(K)(...e)
1668
+ }, null, 42, $t))
1669
+ ], 8, Kt))]),
1548
1670
  _: 1
1549
1671
  }, 8, ["css", "name"]),
1550
- u(st, {
1672
+ u(_t, {
1551
1673
  item: e.item,
1552
1674
  "media-card": e.mediaCard,
1553
1675
  "media-index": g.value,
@@ -1567,7 +1689,7 @@ var Nt = [
1567
1689
  name: "vibe-reel-media-controls",
1568
1690
  css: Ee.value
1569
1691
  }, {
1570
- default: k(() => [De.value ? (b(), a(at, {
1692
+ default: k(() => [De.value ? (b(), a(ht, {
1571
1693
  key: Oe.value,
1572
1694
  "current-time": E(ae),
1573
1695
  "data-control-post-id": Ee.value ? e.item.postId : void 0,
@@ -1607,13 +1729,13 @@ var Nt = [
1607
1729
  "aria-label": `Previous media for post ${e.item.postId}`,
1608
1730
  onClick: i[25] ||= j((e) => E(ve)(g.value - 1, e), ["stop"]),
1609
1731
  onKeydown: i[26] ||= j(() => {}, ["stop"])
1610
- }, [u(E(Ie), { size: 20 })], 40, Wt), c("button", {
1732
+ }, [u(E(Ke), { size: 20 })], 40, en), c("button", {
1611
1733
  type: "button",
1612
1734
  class: "media-carousel-control media-carousel-control--next",
1613
1735
  "aria-label": `Next media for post ${e.item.postId}`,
1614
1736
  onClick: i[27] ||= j((e) => E(ve)(g.value + 1, e), ["stop"]),
1615
1737
  onKeydown: i[28] ||= j(() => {}, ["stop"])
1616
- }, [u(E(Le), { size: 20 })], 40, Gt)], 2)) : o("", !0),
1738
+ }, [u(E(qe), { size: 20 })], 40, tn)], 2)) : o("", !0),
1617
1739
  ge.value ? (b(), s("button", {
1618
1740
  key: 1,
1619
1741
  class: "media-card-activator",
@@ -1621,9 +1743,9 @@ var Nt = [
1621
1743
  "aria-label": `Open post ${e.item.postId}`,
1622
1744
  onClick: i[29] ||= j((e) => r.$emit("activate", _e(e)), ["stop"]),
1623
1745
  onKeydown: i[30] ||= j(() => {}, ["stop"])
1624
- }, null, 40, Kt)) : o("", !0)
1625
- ], 42, Ft),
1626
- e.cardFooter ? (b(), a(Ke, {
1746
+ }, null, 40, nn)) : o("", !0)
1747
+ ], 42, Gt),
1748
+ e.cardFooter ? (b(), a(nt, {
1627
1749
  key: 1,
1628
1750
  index: e.index,
1629
1751
  item: e.item,
@@ -1646,17 +1768,17 @@ var Nt = [
1646
1768
  "style",
1647
1769
  "total"
1648
1770
  ])) : o("", !0)
1649
- ])], 46, Nt));
1771
+ ])], 46, Ut));
1650
1772
  }
1651
1773
  });
1652
1774
  //#endregion
1653
1775
  //#region src/components/useMasonryMediaVisibility.ts
1654
- function Jt(e) {
1776
+ function an(e) {
1655
1777
  function t(t) {
1656
1778
  return t.flatMap((t) => {
1657
1779
  let n = e.items()[t];
1658
1780
  if (!n) return [];
1659
- let r = e.mediaIndices().get(n.postId) ?? 0, i = W(n.postId, r);
1781
+ let r = e.mediaIndices().get(n.postId) ?? 0, i = G(n.postId, r);
1660
1782
  return e.previewStates().get(i) === "ready" ? [{
1661
1783
  key: i,
1662
1784
  mediaIndex: r,
@@ -1679,11 +1801,68 @@ function Jt(e) {
1679
1801
  n(e.visibleIndices, e.onVisible), n(e.fullyVisibleIndices, e.onFullyVisible);
1680
1802
  }
1681
1803
  //#endregion
1804
+ //#region src/components/useSettledMasonryFeedLayout.ts
1805
+ var on = 1500;
1806
+ function sn(e) {
1807
+ let t = w(0), n = 0, i = null, a = 0, o = 0, s = null, c = 0, l = null, u = null, d = 0;
1808
+ function f() {
1809
+ s !== null && (cancelAnimationFrame(s), s = null);
1810
+ }
1811
+ function p(e, t, n, r) {
1812
+ return i = e, l = t, u = Se(e.items, u ?? xe(r.items), n), c = e.items.length < t.length ? Math.max(c, r.height, e.height) : 0, e.items.length < t.length && m(), e;
1813
+ }
1814
+ function m() {
1815
+ s === null && (s = requestAnimationFrame(() => {
1816
+ s = null;
1817
+ let n = e.items(), r = i;
1818
+ if (!r || r.items.length >= n.length) return;
1819
+ let a = r.items.length;
1820
+ p(_e(n, e.width.value, {
1821
+ additionalHeight: e.additionalHeight.value,
1822
+ gap: e.gap.value,
1823
+ minColumnWidth: e.minColumnWidth.value
1824
+ }, r, a, { untilIndex: a + on }), n, a, r), t.value += 1;
1825
+ }));
1826
+ }
1827
+ let h = r(() => {
1828
+ t.value;
1829
+ let r = e.items(), s = e.width.value, h = {
1830
+ additionalHeight: e.additionalHeight.value,
1831
+ gap: e.gap.value,
1832
+ minColumnWidth: e.minColumnWidth.value
1833
+ }, g = i;
1834
+ if (g && l && d === s && a === h.gap && n === h.additionalHeight && o === h.minColumnWidth) {
1835
+ let t = 0, n = l, i = Math.min(n.length, r.length);
1836
+ for (; t < i && n[t] === r[t];) t += 1;
1837
+ return t === r.length && t === n.length ? (g.items.length < r.length && m(), g) : (f(), p(_e(r, s, h, g, t, { untilBottom: e.packUntilBottom() }), r, t, g));
1838
+ }
1839
+ f();
1840
+ let _ = ge(r, s, h);
1841
+ return i = _, l = r, d = s, a = h.gap, n = h.additionalHeight, o = h.minColumnWidth, u = xe(_.items), c = 0, _;
1842
+ }), g = r(() => (h.value, u ?? xe(h.value.items)));
1843
+ return v(f), {
1844
+ ensurePackedThrough(n) {
1845
+ let r = e.items(), a = i;
1846
+ if (!a || a.items.length >= r.length || a.height >= n) return;
1847
+ f();
1848
+ let o = a.items.length;
1849
+ p(_e(r, e.width.value, {
1850
+ additionalHeight: e.additionalHeight.value,
1851
+ gap: e.gap.value,
1852
+ minColumnWidth: e.minColumnWidth.value
1853
+ }, a, o, { untilBottom: n }), r, o, a), t.value += 1;
1854
+ },
1855
+ layout: h,
1856
+ reservedHeight: () => c,
1857
+ viewportIndex: g
1858
+ };
1859
+ }
1860
+ //#endregion
1682
1861
  //#region src/components/MasonryFeed.vue?vue&type=script&setup=true&lang.ts
1683
- var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1862
+ var cn = { class: "masonry-feed-shell" }, ln = ["aria-hidden", "inert"], un = {
1684
1863
  key: 0,
1685
1864
  class: "masonry-feed-status-overlay"
1686
- }, Qt = 6, $t = 12, en = 250, tn = /* @__PURE__ */ d({
1865
+ }, dn = 6, fn = 12, pn = 250, mn = /* @__PURE__ */ d({
1687
1866
  __name: "MasonryFeed",
1688
1867
  props: {
1689
1868
  enteringPostIds: {},
@@ -1721,35 +1900,32 @@ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1721
1900
  "visible"
1722
1901
  ],
1723
1902
  setup(t, { expose: n, emit: i }) {
1724
- let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(Qt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = w([]), N = 0, P = null, F = null, I = null, L = null, R = r(() => Q(d.items, y.value, {
1903
+ let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(dn), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = w([]), N = 0, P = null, F = null, I = null, L = null, R = r(() => ({
1725
1904
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1726
1905
  gap: x.value,
1727
- minColumnWidth: ge(d.masonry)
1728
- })), z = r(() => {
1729
- if (d.leavingPostIds.size === 0) return null;
1730
- let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
1731
- index: t,
1732
- item: e
1733
- }]), t = Q(e.map(({ item: e }) => e), y.value, {
1734
- additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1735
- gap: x.value,
1736
- minColumnWidth: ge(d.masonry)
1737
- });
1738
- return {
1739
- indices: e.map(({ index: e }) => e),
1740
- layout: t,
1741
- positions: new Map(e.map(({ item: e }, n) => [e.postId, t.items[n]]))
1742
- };
1743
- }), B = r(() => {
1744
- let e = R.value, t = z.value;
1745
- return t ? {
1746
- ...t.layout,
1747
- items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
1748
- } : e;
1749
- }), V = r(() => pe(R.value.items)), H = r(() => {
1750
- let e = z.value;
1751
- return e ? pe(e.layout.items, e.indices) : null;
1752
- }), ee = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? B.value.height : R.value.height)), U = r(() => ({ height: `${ee.value}px` })), G = r(() => !d.infiniteScroll || C.value > 0 && k.value + B.value.height <= C.value + 1), te = r(() => new Set(j.value)), K = r(() => M.value.flatMap((e) => {
1906
+ minColumnWidth: Ee(d.masonry)
1907
+ }));
1908
+ function z() {
1909
+ return N - k.value + C.value + De(d.masonry, C.value);
1910
+ }
1911
+ let B = sn({
1912
+ additionalHeight: r(() => R.value.additionalHeight),
1913
+ gap: x,
1914
+ items: () => d.items,
1915
+ minColumnWidth: r(() => R.value.minColumnWidth),
1916
+ packUntilBottom: z,
1917
+ width: y
1918
+ }), V = B.layout, H = B.viewportIndex, U = r(() => d.leavingPostIds.size === 0 ? null : ve(d.items, y.value, R.value, V.value, (e) => d.leavingPostIds.has(d.items[e].postId), z())), W = r(() => {
1919
+ let e = U.value;
1920
+ return e ? {
1921
+ columns: e.columns,
1922
+ height: e.height,
1923
+ items: e.items
1924
+ } : V.value;
1925
+ }), K = r(() => {
1926
+ let e = U.value;
1927
+ return e ? Ce(e.items, e.retainedIndices, H.value, e.fromIndex) : null;
1928
+ }), ee = r(() => (V.value, Math.max(T.value, B.reservedHeight(), d.leavingPostIds.size === 0 ? W.value.height : V.value.height))), q = r(() => ({ height: `${ee.value}px` })), J = r(() => !d.infiniteScroll || C.value > 0 && k.value + W.value.height <= C.value + 1), te = r(() => new Set(j.value)), ne = r(() => M.value.flatMap((e) => {
1753
1929
  let t = d.items[e];
1754
1930
  return t ? [{
1755
1931
  fetchPriority: te.value.has(e) ? "high" : "low",
@@ -1757,46 +1933,46 @@ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1757
1933
  item: t
1758
1934
  }] : [];
1759
1935
  }));
1760
- function q(e, t) {
1936
+ function re(e, t) {
1761
1937
  return [...new Set([...e, ...t])].sort((e, t) => e - t);
1762
1938
  }
1763
- function ne(e, t) {
1939
+ function ie(e, t) {
1764
1940
  return e.length === t.length && e.every((e, n) => e === t[n]);
1765
1941
  }
1766
- function re(e) {
1942
+ function oe(e) {
1767
1943
  let t = {
1768
1944
  scrollTop: N - k.value,
1769
1945
  viewportHeight: C.value
1770
- }, n = H.value, r = he(n ?? V.value, {
1946
+ }, n = K.value, r = Te(n ?? H.value, {
1771
1947
  ...t,
1772
1948
  overscan: e
1773
1949
  }).indices;
1774
- return q(r, d.leavingPostIds.size === 0 ? [] : he(V.value, {
1950
+ return re(r, d.leavingPostIds.size === 0 ? [] : Te(H.value, {
1775
1951
  ...t,
1776
1952
  overscan: e
1777
1953
  }).indices);
1778
1954
  }
1779
- function J() {
1780
- let e = re(0), t = re(_e(d.masonry, C.value));
1781
- ne(j.value, e) || (j.value = e);
1782
- let n = fe(B.value.items, e.filter((e) => {
1955
+ function Y() {
1956
+ let e = oe(0), t = oe(De(d.masonry, C.value));
1957
+ ie(j.value, e) || (j.value = e);
1958
+ let n = fe(W.value.items, e.filter((e) => {
1783
1959
  let t = d.items[e];
1784
1960
  return t && !d.leavingPostIds.has(t.postId);
1785
1961
  }), {
1786
1962
  scrollTop: N - k.value,
1787
1963
  viewportHeight: C.value
1788
1964
  });
1789
- ne(A.value, n) || (A.value = n), ne(M.value, t) || (M.value = t);
1965
+ ie(A.value, n) || (A.value = n), ie(M.value, t) || (M.value = t);
1790
1966
  }
1791
- function ie() {
1967
+ function se() {
1792
1968
  if (L !== null) return;
1793
1969
  L = -1;
1794
1970
  let e = requestAnimationFrame(() => {
1795
- L = null, J();
1971
+ L = null, Y();
1796
1972
  });
1797
1973
  L !== null && (L = e);
1798
1974
  }
1799
- Jt({
1975
+ an({
1800
1976
  fullyVisibleIndices: () => A.value,
1801
1977
  items: () => d.items,
1802
1978
  mediaIndices: () => d.mediaIndices,
@@ -1805,11 +1981,11 @@ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1805
1981
  previewStates: () => d.previewStates,
1806
1982
  visibleIndices: () => j.value
1807
1983
  });
1808
- function oe(e) {
1809
- let t = B.value.items[e], n = d.items[e]?.postId;
1984
+ function X(e) {
1985
+ let t = W.value.items[e], n = d.items[e]?.postId;
1810
1986
  if (!t) return {};
1811
1987
  let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? le({
1812
- containerHeight: Math.max(T.value, R.value.height),
1988
+ containerHeight: Math.max(T.value, V.value.height),
1813
1989
  gap: x.value
1814
1990
  }) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
1815
1991
  return {
@@ -1819,52 +1995,52 @@ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1819
1995
  transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
1820
1996
  };
1821
1997
  }
1822
- function Y() {
1998
+ function Z() {
1823
1999
  let e = p.value;
1824
2000
  if (!e) return;
1825
2001
  N = e.scrollTop, C.value = e.clientHeight;
1826
2002
  let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
1827
2003
  T.value = Math.max(0, e.clientHeight - n);
1828
2004
  let r = g.value;
1829
- r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, J());
2005
+ r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, Y());
1830
2006
  }
1831
- function se(e) {
2007
+ function ue(e) {
1832
2008
  let t = e.ownerDocument.documentElement.clientWidth;
1833
- y.value = e.clientWidth, x.value = Math.min($t, Math.max(Qt, t * .0075)), Y();
2009
+ y.value = e.clientWidth, x.value = Math.min(fn, Math.max(dn, t * .0075)), Z();
1834
2010
  }
1835
- function X(e) {
2011
+ function de(e) {
1836
2012
  let t = e.currentTarget;
1837
- t && (N = t.scrollTop, ie(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ce(t) && f("loadMore"));
2013
+ t && (N = t.scrollTop, B.ensurePackedThrough(z()), se(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ce(t) && f("loadMore"));
1838
2014
  }
1839
- function Z() {
2015
+ function Q() {
1840
2016
  let e = p.value;
1841
2017
  Date.now() >= l && !d.loadMoreLocked && e && ce(e) && f("loadMore");
1842
2018
  }
1843
2019
  O(() => d.items.length, (e, t) => {
1844
- e > 0 && e < t && (l = Date.now() + en);
2020
+ e > 0 && e < t && (l = Date.now() + pn);
1845
2021
  });
1846
- function ue() {
2022
+ function pe() {
1847
2023
  return p.value;
1848
2024
  }
1849
2025
  return O(g, (e) => {
1850
- P?.disconnect(), P = null, I !== null && cancelAnimationFrame(I), e && (se(e), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(([t]) => {
2026
+ P?.disconnect(), P = null, I !== null && cancelAnimationFrame(I), e && (ue(e), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(([t]) => {
1851
2027
  let n = t?.contentRect.width ?? e.clientWidth;
1852
2028
  Math.abs(n - y.value) < .5 || (I = requestAnimationFrame(() => {
1853
- I = null, se(e);
2029
+ I = null, ue(e);
1854
2030
  }));
1855
2031
  }), P.observe(e)));
1856
2032
  }), O(p, (e) => {
1857
- F?.disconnect(), F = null, e && (Y(), !(typeof ResizeObserver > "u") && (F = new ResizeObserver(Y), F.observe(e)));
2033
+ F?.disconnect(), F = null, e && (Z(), !(typeof ResizeObserver > "u") && (F = new ResizeObserver(Z), F.observe(e)));
1858
2034
  }), O([
1859
- R,
1860
- B,
2035
+ V,
2036
+ W,
1861
2037
  () => d.masonry
1862
- ], J, { flush: "post" }), v(() => {
2038
+ ], Y, { flush: "post" }), v(() => {
1863
2039
  P?.disconnect(), F?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
1864
2040
  }), n({
1865
- getScrollElement: ue,
1866
- loadIfNearBottom: Z
1867
- }), (n, r) => (b(), s("div", Yt, [
2041
+ getScrollElement: pe,
2042
+ loadIfNearBottom: Q
2043
+ }), (n, r) => (b(), s("div", cn, [
1868
2044
  c("main", {
1869
2045
  id: m,
1870
2046
  ref_key: "galleryElement",
@@ -1873,14 +2049,14 @@ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1873
2049
  "data-layout-mode": "masonry",
1874
2050
  "aria-hidden": t.suspended || void 0,
1875
2051
  inert: t.suspended || void 0,
1876
- onScrollPassive: X
2052
+ onScrollPassive: de
1877
2053
  }, [c("section", {
1878
2054
  ref_key: "masonryElement",
1879
2055
  ref: g,
1880
2056
  class: h(["masonry", { "masonry--ready": y.value > 0 }]),
1881
- style: _(U.value),
2057
+ style: _(q.value),
1882
2058
  "aria-label": "Media gallery"
1883
- }, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(qt, {
2059
+ }, [(b(!0), s(e, null, S(ne.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(rn, {
1884
2060
  key: n.postId,
1885
2061
  class: "masonry-item",
1886
2062
  entering: t.enteringPostIds.has(n.postId),
@@ -1892,12 +2068,12 @@ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1892
2068
  "in-viewport": te.value.has(r),
1893
2069
  index: r,
1894
2070
  item: n,
1895
- "item-style": oe(r),
2071
+ "item-style": X(r),
1896
2072
  interactive: "",
1897
2073
  layout: "masonry",
1898
2074
  "loaded-count": t.items.length,
1899
2075
  "media-index": t.mediaIndices.get(n.postId) ?? 0,
1900
- "preview-state": t.previewStates.get(E(W)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
2076
+ "preview-state": t.previewStates.get(E(G)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1901
2077
  total: t.total,
1902
2078
  onActivate: (e) => f("activate", n.postId, e),
1903
2079
  onMediaChange: (e) => f("mediaChange", n.postId, e),
@@ -1922,8 +2098,8 @@ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1922
2098
  "onMediaChange",
1923
2099
  "onReady",
1924
2100
  "onError"
1925
- ]))), 128))], 6)], 42, Xt),
1926
- t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && G.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", Zt, [u(ae, {
2101
+ ]))), 128))], 6)], 42, ln),
2102
+ t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && J.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", un, [u(ae, {
1927
2103
  actions: t.feedFooterActions,
1928
2104
  "can-retry-end": t.canRetryEnd,
1929
2105
  "feed-footer": t.feedFooter,
@@ -1931,7 +2107,7 @@ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1931
2107
  "has-next": t.hasNext,
1932
2108
  "is-loading": t.isLoadingMore,
1933
2109
  "load-more-locked": t.loadMoreLocked,
1934
- "show-load-more": G.value,
2110
+ "show-load-more": J.value,
1935
2111
  state: t.state,
1936
2112
  onLoadMore: r[0] ||= (e) => f("loadMore"),
1937
2113
  onRetryEnd: r[1] ||= (e) => f("retryEnd")
@@ -1946,8 +2122,8 @@ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1946
2122
  "show-load-more",
1947
2123
  "state"
1948
2124
  ])])) : o("", !0),
1949
- u(Ee, {
1950
- "content-size": B.value.height,
2125
+ u(Ie, {
2126
+ "content-size": W.value.height,
1951
2127
  "controls-id": m,
1952
2128
  "scroll-element": p.value,
1953
2129
  suspended: t.suspended
@@ -1958,8 +2134,8 @@ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1958
2134
  ])
1959
2135
  ]));
1960
2136
  }
1961
- }), nn = 300;
1962
- function rn(e, t, n) {
2137
+ }), hn = 300;
2138
+ function gn(e, t, n) {
1963
2139
  let r = e.scrollTop;
1964
2140
  if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
1965
2141
  e.setAttribute("data-transitioning", "");
@@ -1967,7 +2143,7 @@ function rn(e, t, n) {
1967
2143
  return new Promise((n) => {
1968
2144
  let o = (s) => {
1969
2145
  a += 1;
1970
- let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / nn), u = 1 - (1 - l) ** 3;
2146
+ let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / hn), u = 1 - (1 - l) ** 3;
1971
2147
  if (e.scrollTop = r + (t - r) * u, l < 1) {
1972
2148
  requestAnimationFrame(o);
1973
2149
  return;
@@ -1979,7 +2155,7 @@ function rn(e, t, n) {
1979
2155
  }
1980
2156
  //#endregion
1981
2157
  //#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
1982
- var an = ["aria-label"], on = /* @__PURE__ */ d({
2158
+ var _n = ["aria-label"], vn = /* @__PURE__ */ d({
1983
2159
  __name: "ReelAutoAdvanceProgress",
1984
2160
  props: {
1985
2161
  durationMs: {},
@@ -1997,9 +2173,9 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
1997
2173
  class: "reel-auto-advance-progress",
1998
2174
  style: _(a.value),
1999
2175
  onAnimationend: n[0] ||= (e) => i("complete")
2000
- }, null, 36)], 8, an));
2176
+ }, null, 36)], 8, _n));
2001
2177
  }
2002
- }), sn = { class: "reel-viewport" }, cn = ["data-active-post-id", "data-active-media-index"], ln = ["role", "data-status"], un = 300, dn = 250, fn = /* @__PURE__ */ d({
2178
+ }), yn = { class: "reel-viewport" }, bn = ["data-active-post-id", "data-active-media-index"], xn = ["role", "data-status"], Sn = 300, Cn = 250, wn = /* @__PURE__ */ d({
2003
2179
  __name: "ReelFeed",
2004
2180
  props: {
2005
2181
  initialPostId: {},
@@ -2050,8 +2226,8 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2050
2226
  return e === void 0 ? 0 : u.mediaIndices.get(e) ?? 0;
2051
2227
  }), z = r(() => {
2052
2228
  let e = F.value;
2053
- return e === void 0 ? "loading" : u.previewStates.get(W(e, R.value)) ?? "loading";
2054
- }), B = r(() => I.value ? U(I.value, R.value) : null), ee = r(() => B.value ? V(B.value, u.mediaSource ?? "preview") : null), G = r(() => z.value === "ready" && !!(ee.value && L(ee.value.type, ee.value.src))), te = r(() => [
2229
+ return e === void 0 ? "loading" : u.previewStates.get(G(e, R.value)) ?? "loading";
2230
+ }), B = r(() => I.value ? W(I.value, R.value) : null), U = r(() => B.value ? V(B.value, u.mediaSource ?? "preview") : null), K = r(() => z.value === "ready" && !!(U.value && L(U.value.type, U.value.src))), ee = r(() => [
2055
2231
  F.value,
2056
2232
  R.value,
2057
2233
  u.items.length,
@@ -2059,11 +2235,11 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2059
2235
  u.reelAutoAdvance.enabled,
2060
2236
  u.reelAutoAdvance.includePostItems,
2061
2237
  u.reelAutoAdvance.intervalMs
2062
- ].join(":")), K = r(() => {
2238
+ ].join(":")), q = r(() => {
2063
2239
  let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value < H(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
2064
2240
  return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
2065
- }), q = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && z.value !== "loading" && !G.value), ne = r(() => !u.infiniteScroll || u.items.length <= 1), re = 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.");
2066
- function J(e) {
2241
+ }), J = r(() => u.reelAutoAdvance.enabled && u.reelForward.status === "idle" && I.value !== void 0 && z.value !== "loading" && !K.value), te = r(() => !u.infiniteScroll || u.items.length <= 1), ne = 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.");
2242
+ function re(e) {
2067
2243
  return { gridRow: `${e + 1}` };
2068
2244
  }
2069
2245
  function ie(e) {
@@ -2102,7 +2278,7 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2102
2278
  Date.now() >= l && !u.loadMoreLocked && e && ce(e) && d("loadMore");
2103
2279
  }
2104
2280
  O(() => u.items.length, (e, t) => {
2105
- e > 0 && e < t && (l = Date.now() + dn);
2281
+ e > 0 && e < t && (l = Date.now() + Cn);
2106
2282
  });
2107
2283
  function ue(e) {
2108
2284
  let t = I.value;
@@ -2127,7 +2303,7 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2127
2303
  let t = f.value;
2128
2304
  if (!t) return Promise.resolve();
2129
2305
  let n = e * (k || t.clientHeight);
2130
- return x.value = e, rn(t, n, Q());
2306
+ return x.value = e, gn(t, n, Q());
2131
2307
  }
2132
2308
  function me(e) {
2133
2309
  pe(e);
@@ -2137,7 +2313,7 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2137
2313
  return t < 0 || t === x.value ? !1 : (await pe(t), !0);
2138
2314
  }
2139
2315
  async function ge(e) {
2140
- return ue(e) ? (Q() || await new Promise((e) => setTimeout(e, un)), !0) : !1;
2316
+ return ue(e) ? (Q() || await new Promise((e) => setTimeout(e, Sn)), !0) : !1;
2141
2317
  }
2142
2318
  function _e() {
2143
2319
  if (!u.reelAutoAdvance.enabled) return;
@@ -2155,7 +2331,7 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2155
2331
  u.reelAutoAdvance.includePostItems && (u.mediaIndices.get(n.postId) ?? 0) !== 0 && d("mediaChange", n.postId, 0), me(t);
2156
2332
  }
2157
2333
  function ve(e, t) {
2158
- !u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !G.value || _e();
2334
+ !u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !K.value || _e();
2159
2335
  }
2160
2336
  return O(f, (e) => {
2161
2337
  A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(Y), A.observe(e)));
@@ -2184,7 +2360,7 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2184
2360
  }]),
2185
2361
  "data-layout-mode": "reel"
2186
2362
  }, [
2187
- t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(Ke, {
2363
+ t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(nt, {
2188
2364
  key: 0,
2189
2365
  index: x.value,
2190
2366
  item: I.value,
@@ -2206,7 +2382,7 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2206
2382
  "style",
2207
2383
  "total"
2208
2384
  ])) : o("", !0),
2209
- c("div", sn, [c("div", {
2385
+ c("div", yn, [c("div", {
2210
2386
  ref_key: "galleryElement",
2211
2387
  ref: f,
2212
2388
  class: "gallery-shell reel-feed",
@@ -2218,7 +2394,7 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2218
2394
  class: "reel-track",
2219
2395
  style: _(N.value),
2220
2396
  "aria-label": "Media gallery"
2221
- }, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(qt, {
2397
+ }, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(rn, {
2222
2398
  key: n.postId,
2223
2399
  active: i === x.value && !C.value,
2224
2400
  "advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
@@ -2227,13 +2403,13 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2227
2403
  "fetch-priority": e,
2228
2404
  index: i,
2229
2405
  item: n,
2230
- "item-style": J(i),
2406
+ "item-style": re(i),
2231
2407
  "media-card": t.mediaCard,
2232
2408
  layout: "reel",
2233
2409
  "loaded-count": t.items.length,
2234
2410
  "media-index": t.mediaIndices.get(n.postId) ?? 0,
2235
2411
  "media-source": t.mediaSource,
2236
- "preview-state": t.previewStates.get(E(W)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
2412
+ "preview-state": t.previewStates.get(E(G)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
2237
2413
  "reel-controls-target": p.value,
2238
2414
  "reel-audio-state": t.reelAudioState,
2239
2415
  "stationary-reel-controls": "",
@@ -2267,12 +2443,12 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2267
2443
  class: "reel-forward-status",
2268
2444
  role: t.reelForward.status === "error" ? "alert" : "status",
2269
2445
  "data-status": t.reelForward.status
2270
- }, [c("p", null, T(re.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
2446
+ }, [c("p", null, T(ne.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
2271
2447
  key: 0,
2272
2448
  class: "reel-forward-retry",
2273
2449
  type: "button",
2274
2450
  onClick: r[0] ||= (e) => d("retryForward")
2275
- }, " Retry ")) : o("", !0)], 8, ln)), t.reelForward.status === "idle" ? (b(), a(ae, {
2451
+ }, " Retry ")) : o("", !0)], 8, xn)), t.reelForward.status === "idle" ? (b(), a(ae, {
2276
2452
  key: 2,
2277
2453
  actions: t.feedFooterActions,
2278
2454
  "can-retry-end": t.canRetryEnd,
@@ -2281,7 +2457,7 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2281
2457
  "has-next": t.hasNext,
2282
2458
  "is-loading": t.isLoadingMore,
2283
2459
  "load-more-locked": t.loadMoreLocked,
2284
- "show-load-more": ne.value,
2460
+ "show-load-more": te.value,
2285
2461
  state: t.state,
2286
2462
  onLoadMore: r[2] ||= (e) => d("loadMore"),
2287
2463
  onRetryEnd: r[3] ||= (e) => d("retryEnd")
@@ -2295,13 +2471,13 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2295
2471
  "load-more-locked",
2296
2472
  "show-load-more",
2297
2473
  "state"
2298
- ])) : o("", !0)], 40, cn), c("div", {
2474
+ ])) : o("", !0)], 40, bn), c("div", {
2299
2475
  ref_key: "reelControlsElement",
2300
2476
  ref: p,
2301
2477
  class: "reel-media-controls-host",
2302
2478
  "data-test": "reel-media-controls-host"
2303
2479
  }, null, 512)]),
2304
- t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(Ke, {
2480
+ t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(nt, {
2305
2481
  key: 1,
2306
2482
  index: x.value,
2307
2483
  item: I.value,
@@ -2323,24 +2499,24 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2323
2499
  "style",
2324
2500
  "total"
2325
2501
  ])) : o("", !0),
2326
- q.value ? (b(), a(on, {
2327
- key: te.value,
2502
+ J.value ? (b(), a(vn, {
2503
+ key: ee.value,
2328
2504
  "duration-ms": t.reelAutoAdvance.intervalMs,
2329
- label: K.value,
2505
+ label: q.value,
2330
2506
  onComplete: _e
2331
2507
  }, null, 8, ["duration-ms", "label"])) : o("", !0)
2332
2508
  ], 2));
2333
2509
  }
2334
- }), pn = ["data-info-sheet-open", "data-info-sheet-mode"], mn = ["aria-hidden", "inert"], hn = {
2510
+ }), Tn = ["data-info-sheet-open", "data-info-sheet-mode"], En = ["aria-hidden", "inert"], Dn = {
2335
2511
  key: 0,
2336
2512
  class: "reel-info-sheet-layer",
2337
2513
  "data-test": "reel-info-sheet"
2338
- }, gn = [
2514
+ }, On = [
2339
2515
  "role",
2340
2516
  "aria-modal",
2341
2517
  "tabindex",
2342
2518
  "data-active-post-id"
2343
- ], _n = /* @__PURE__ */ d({
2519
+ ], kn = /* @__PURE__ */ d({
2344
2520
  __name: "ReelLayout",
2345
2521
  props: {
2346
2522
  forwardIndex: { default: null },
@@ -2402,7 +2578,7 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2402
2578
  loadedCount: l.items.length,
2403
2579
  mediaCount: H(e).length,
2404
2580
  mediaIndex: D.value,
2405
- mediaItem: U(e, D.value),
2581
+ mediaItem: W(e, D.value),
2406
2582
  mediaSource: l.mediaSource ?? "preview",
2407
2583
  origin: l.origin,
2408
2584
  total: l.total
@@ -2467,7 +2643,7 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2467
2643
  class: "reel-layout-main",
2468
2644
  "aria-hidden": e.infoSheetOverlay && A.value || void 0,
2469
2645
  inert: e.infoSheetOverlay && A.value || void 0
2470
- }, [u(fn, {
2646
+ }, [u(wn, {
2471
2647
  ref_key: "reelFeed",
2472
2648
  ref: p,
2473
2649
  "can-retry-end": e.canRetryEnd,
@@ -2521,8 +2697,8 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2521
2697
  "reel-forward",
2522
2698
  "state",
2523
2699
  "total"
2524
- ])], 8, mn), u(n, { name: "vibe-info-sheet" }, {
2525
- default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", hn, [c("aside", {
2700
+ ])], 8, En), u(n, { name: "vibe-info-sheet" }, {
2701
+ default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Dn, [c("aside", {
2526
2702
  ref_key: "sheetElement",
2527
2703
  ref: _,
2528
2704
  class: "reel-info-sheet",
@@ -2531,17 +2707,17 @@ var an = ["aria-label"], on = /* @__PURE__ */ d({
2531
2707
  "aria-modal": e.infoSheetOverlay ? "true" : void 0,
2532
2708
  tabindex: e.infoSheetOverlay ? -1 : void 0,
2533
2709
  "data-active-post-id": T.value?.postId
2534
- }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, gn)])) : o("", !0)]),
2710
+ }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, On)])) : o("", !0)]),
2535
2711
  _: 1
2536
- })], 10, pn));
2712
+ })], 10, Tn));
2537
2713
  }
2538
2714
  });
2539
2715
  //#endregion
2540
2716
  //#region src/core/mediaLifecycle.ts
2541
- function vn(e, t, n, r, i) {
2717
+ function An(e, t, n, r, i) {
2542
2718
  let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
2543
2719
  if (!o) return null;
2544
- let s = ee(o, n), c = U(o, s);
2720
+ let s = U(o, n), c = W(o, s);
2545
2721
  return {
2546
2722
  item: o,
2547
2723
  layout: r,
@@ -2554,7 +2730,7 @@ function vn(e, t, n, r, i) {
2554
2730
  postIndex: a
2555
2731
  };
2556
2732
  }
2557
- function yn(e, t) {
2733
+ function jn(e, t) {
2558
2734
  O(() => {
2559
2735
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
2560
2736
  return {
@@ -2564,23 +2740,23 @@ function yn(e, t) {
2564
2740
  };
2565
2741
  }, (n, r) => {
2566
2742
  if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
2567
- let i = vn(e, n.postId, n.mediaIndex, "reel", n.origin);
2743
+ let i = An(e, n.postId, n.mediaIndex, "reel", n.origin);
2568
2744
  i && t(i);
2569
2745
  }, { flush: "sync" });
2570
2746
  }
2571
2747
  //#endregion
2572
2748
  //#region src/components/useMediaLifecycle.ts
2573
- function bn(e, t) {
2749
+ function Mn(e, t) {
2574
2750
  let n = /* @__PURE__ */ new Set(), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = w(/* @__PURE__ */ new Map()), s = () => e.reelMediaSource === "preview" ? i : e.reelMediaSource === "mobile" ? o : a, c = r(() => s().value), l = /* @__PURE__ */ new Set();
2575
2751
  function u() {
2576
2752
  n.clear(), l.clear(), i.value = /* @__PURE__ */ new Map(), a.value = /* @__PURE__ */ new Map(), o.value = /* @__PURE__ */ new Map();
2577
2753
  }
2578
2754
  function d(e, t, n, r) {
2579
- let i = W(t, n);
2755
+ let i = G(t, n);
2580
2756
  e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
2581
2757
  }
2582
2758
  function f(t, n, r, i) {
2583
- return vn(e, t, n, r, i);
2759
+ return An(e, t, n, r, i);
2584
2760
  }
2585
2761
  function p(e, n, r, i) {
2586
2762
  let a = f(e, n, r, i);
@@ -2599,13 +2775,13 @@ function bn(e, t) {
2599
2775
  d(s(), t, n, "ready"), p(t, n, "reel", e.reelOrigin ?? "reel");
2600
2776
  }
2601
2777
  function v(e, n) {
2602
- let r = W(e, n);
2778
+ let r = G(e, n);
2603
2779
  if (l.has(r)) return;
2604
2780
  let i = f(e, n, "masonry", null);
2605
2781
  i && (l.add(r), t.visible(i));
2606
2782
  }
2607
2783
  function y(e, r, i, a) {
2608
- let o = [i, W(e, r)].join(":");
2784
+ let o = [i, G(e, r)].join(":");
2609
2785
  if (n.has(o)) return;
2610
2786
  let s = f(e, r, i, a);
2611
2787
  s && (n.add(o), t.fullyVisible(s));
@@ -2613,13 +2789,13 @@ function bn(e, t) {
2613
2789
  function b(e, t) {
2614
2790
  y(e, t, "masonry", null);
2615
2791
  }
2616
- return yn(e, t.reelChange), O(() => {
2792
+ return jn(e, t.reelChange), O(() => {
2617
2793
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
2618
2794
  return {
2619
2795
  mediaIndex: n,
2620
2796
  origin: e.reelOrigin ?? "reel",
2621
2797
  postId: t,
2622
- ready: t !== null && c.value.get(W(t, n)) === "ready"
2798
+ ready: t !== null && c.value.get(G(t, n)) === "ready"
2623
2799
  };
2624
2800
  }, (e, t) => {
2625
2801
  e.postId === null || !e.ready || t?.ready && t.postId === e.postId && t.mediaIndex === e.mediaIndex && t.origin === e.origin || y(e.postId, e.mediaIndex, "reel", e.origin);
@@ -2638,16 +2814,16 @@ function bn(e, t) {
2638
2814
  }
2639
2815
  //#endregion
2640
2816
  //#region src/core/reelEscapeStack.ts
2641
- var xn = [];
2642
- function Sn(e) {
2643
- return xn.push(e), () => {
2644
- let t = xn.indexOf(e);
2645
- t >= 0 && xn.splice(t, 1);
2817
+ var Nn = [];
2818
+ function Pn(e) {
2819
+ return Nn.push(e), () => {
2820
+ let t = Nn.indexOf(e);
2821
+ t >= 0 && Nn.splice(t, 1);
2646
2822
  };
2647
2823
  }
2648
- function Cn(e) {
2824
+ function Fn(e) {
2649
2825
  if (!e.isActive()) return !1;
2650
- let t = xn.filter((e) => e.isActive()), n = e.element();
2826
+ let t = Nn.filter((e) => e.isActive()), n = e.element();
2651
2827
  return n !== null && t.some((t) => {
2652
2828
  if (t === e) return !1;
2653
2829
  let r = t.element();
@@ -2663,14 +2839,14 @@ function Cn(e) {
2663
2839
  }
2664
2840
  //#endregion
2665
2841
  //#region src/components/useReelKeyboard.ts
2666
- function wn(e) {
2842
+ function In(e) {
2667
2843
  let t = {
2668
2844
  element: e.element,
2669
2845
  isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
2670
2846
  }, n = null;
2671
2847
  function r(n) {
2672
2848
  let r = t.isActive();
2673
- if (n.key === "Escape" && r && !Cn(t)) return;
2849
+ if (n.key === "Escape" && r && !Fn(t)) return;
2674
2850
  if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
2675
2851
  n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
2676
2852
  return;
@@ -2690,14 +2866,14 @@ function wn(e) {
2690
2866
  a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
2691
2867
  }
2692
2868
  y(() => {
2693
- n = Sn(t), window.addEventListener("keydown", r);
2869
+ n = Pn(t), window.addEventListener("keydown", r);
2694
2870
  }), v(() => {
2695
2871
  window.removeEventListener("keydown", r), n?.(), n = null;
2696
2872
  });
2697
2873
  }
2698
2874
  //#endregion
2699
2875
  //#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
2700
- var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2876
+ var Ln = 35, Rn = 420, zn = /* @__PURE__ */ d({
2701
2877
  __name: "VibeSurface",
2702
2878
  props: {
2703
2879
  canRetryEnd: { type: Boolean },
@@ -2726,35 +2902,35 @@ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2726
2902
  "retryForward"
2727
2903
  ],
2728
2904
  setup(t, { expose: i, emit: c }) {
2729
- let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => te(l.state, T.value)), { markMasonryFullyVisible: A, markMasonryVisible: j, markPreviewError: M, markPreviewReady: N, markReelError: P, markReelReady: F, originalStates: I, previewStates: L, reelStates: R, resetMediaLifecycle: z } = bn(l.state, {
2905
+ let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), _ = w(!1), y = w(/* @__PURE__ */ new Set()), x = w(/* @__PURE__ */ new Map()), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = r(() => Object.freeze([...l.state.items])), D = r(() => ee(l.state, T.value)), { markMasonryFullyVisible: A, markMasonryVisible: j, markPreviewError: M, markPreviewReady: N, markReelError: P, markReelReady: F, originalStates: I, previewStates: L, reelStates: R, resetMediaLifecycle: z } = Mn(l.state, {
2730
2906
  fullyVisible: (e) => d("mediaFullyVisible", e),
2731
2907
  ready: (e) => d("mediaReady", e),
2732
2908
  reelChange: (e) => d("reelMediaChange", e),
2733
2909
  visible: (e) => d("mediaVisible", e)
2734
- }), B = new Set(l.state.items.map((e) => e.postId)), V = null, U = null, W = !1;
2735
- function G() {
2910
+ }), B = new Set(l.state.items.map((e) => e.postId)), V = null, W = null, G = !1;
2911
+ function K() {
2736
2912
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2737
2913
  }
2738
- function K() {
2914
+ function q() {
2739
2915
  V !== null && cancelAnimationFrame(V), V = requestAnimationFrame(() => {
2740
2916
  V = requestAnimationFrame(() => {
2741
2917
  V = null, y.value = /* @__PURE__ */ new Set();
2742
2918
  });
2743
2919
  });
2744
2920
  }
2745
- function q(e, t) {
2921
+ function J(e, t) {
2746
2922
  let n = l.state.items.find((t) => t.postId === e);
2747
2923
  if (!n) return;
2748
- let r = ee(n, t);
2924
+ let r = U(n, t);
2749
2925
  (l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
2750
2926
  }
2751
- async function ne() {
2927
+ async function te() {
2752
2928
  await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
2753
2929
  }
2754
- function re(e) {
2930
+ function ne(e) {
2755
2931
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
2756
2932
  }
2757
- function J(e) {
2933
+ function re(e) {
2758
2934
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
2759
2935
  }
2760
2936
  function ie(e) {
@@ -2768,20 +2944,20 @@ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2768
2944
  return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
2769
2945
  }
2770
2946
  function oe(e, t) {
2771
- U = e, W = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
2947
+ W = e, G = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
2772
2948
  }
2773
2949
  function Y(e) {
2774
2950
  let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
2775
2951
  return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
2776
2952
  }
2777
2953
  function ce(e, t) {
2778
- if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || G()) return 0;
2954
+ if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
2779
2955
  let n = [...new Set(e)], r = n.filter(Y);
2780
2956
  if (r.length === 0) return 0;
2781
- let i = new Map(C.value), a = t?.staggerMs ?? Tn;
2957
+ let i = new Map(C.value), a = t?.staggerMs ?? Ln;
2782
2958
  return r.forEach((e, t) => {
2783
2959
  i.set(e, t * a);
2784
- }), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, En + (r.length - 1) * a;
2960
+ }), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, Rn + (r.length - 1) * a;
2785
2961
  }
2786
2962
  function X(e, t) {
2787
2963
  let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
@@ -2790,38 +2966,41 @@ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2790
2966
  }, { once: !0 }), r?.focus({ preventScroll: !0 }));
2791
2967
  }
2792
2968
  function Z() {
2793
- l.state.reelOrigin === "masonry" && (U ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
2969
+ l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
2794
2970
  }
2795
2971
  function le() {
2796
- let e = U, t = W;
2797
- _.value = !1, U = null, W = !1, m(() => {
2972
+ let e = W, t = G;
2973
+ _.value = !1, W = null, G = !1, m(() => {
2798
2974
  e !== null && X(e, t);
2799
2975
  });
2800
2976
  }
2801
- return wn({
2977
+ return In({
2802
2978
  closeMasonryReel: Z,
2803
2979
  element: () => g.value,
2804
2980
  isReelLeaving: () => _.value,
2805
2981
  reelRenderer: () => p.value,
2806
2982
  setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
2807
2983
  state: l.state
2808
- }), O(() => l.state.items.map((e) => e.postId), (e) => {
2809
- let t = e.filter((e) => !B.has(e)), n = new Set(e);
2810
- if (B = new Set(e), S.value = new Set([...S.value].filter((e) => n.has(e))), C.value = new Map([...C.value].filter(([e]) => n.has(e))), t.length === 0 || G()) return;
2811
- let r = /* @__PURE__ */ new Map();
2812
- e.forEach((e) => {
2984
+ }), O(() => {
2985
+ let e = l.state.items;
2986
+ return [e, e.length];
2987
+ }, ([e]) => {
2988
+ let t = e.map((e) => e.postId), n = t.filter((e) => !B.has(e)), r = new Set(t);
2989
+ if (B = new Set(t), S.value = new Set([...S.value].filter((e) => r.has(e))), C.value = new Map([...C.value].filter(([e]) => r.has(e))), n.length === 0 || K()) return;
2990
+ let i = /* @__PURE__ */ new Map();
2991
+ t.forEach((e) => {
2813
2992
  let t = x.value.get(e);
2814
- t !== void 0 && r.set(e, t);
2815
- }), t.forEach((e, t) => {
2816
- r.set(e, t * Tn);
2817
- }), x.value = r, y.value = new Set([...y.value, ...t]), K();
2993
+ t !== void 0 && i.set(e, t);
2994
+ }), n.forEach((e, t) => {
2995
+ i.set(e, t * Ln);
2996
+ }), x.value = i, y.value = new Set([...y.value, ...n]), q();
2818
2997
  }, { flush: "sync" }), v(() => {
2819
2998
  V !== null && cancelAnimationFrame(V);
2820
2999
  }), i({
2821
- changeActiveReelMedia: re,
3000
+ changeActiveReelMedia: ne,
2822
3001
  getAutoScrollElement: ae,
2823
- loadIfNearBottom: ne,
2824
- moveActiveReelPost: J,
3002
+ loadIfNearBottom: te,
3003
+ moveActiveReelPost: re,
2825
3004
  navigateToReelItem: ie,
2826
3005
  resetMediaLifecycle: z,
2827
3006
  startItemRemoval: ce,
@@ -2831,7 +3010,7 @@ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2831
3010
  ref_key: "surfaceElement",
2832
3011
  ref: g,
2833
3012
  class: "vibe-surface"
2834
- }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(_n, {
3013
+ }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(kn, {
2835
3014
  key: 0,
2836
3015
  ref_key: "reelRenderer",
2837
3016
  ref: p,
@@ -2866,7 +3045,7 @@ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2866
3045
  onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
2867
3046
  onError: E(P),
2868
3047
  onLoadMore: i[2] ||= (e) => d("loadMore"),
2869
- onMediaChange: q,
3048
+ onMediaChange: J,
2870
3049
  onReady: E(F),
2871
3050
  onRetryEnd: i[3] ||= (e) => d("retryEnd"),
2872
3051
  onRetryForward: i[4] ||= (e) => d("retryForward"),
@@ -2884,7 +3063,7 @@ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2884
3063
  "can-retry-end",
2885
3064
  "feed-footer",
2886
3065
  "state"
2887
- ])) : (b(), s(e, { key: 2 }, [u(tn, {
3066
+ ])) : (b(), s(e, { key: 2 }, [u(mn, {
2888
3067
  ref_key: "masonryRenderer",
2889
3068
  ref: f,
2890
3069
  "can-retry-end": t.canRetryEnd,
@@ -2913,7 +3092,7 @@ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2913
3092
  onError: E(M),
2914
3093
  onFullyVisible: E(A),
2915
3094
  onLoadMore: i[8] ||= (e) => d("loadMore"),
2916
- onMediaChange: q,
3095
+ onMediaChange: J,
2917
3096
  onReady: E(N),
2918
3097
  onRetryEnd: i[9] ||= (e) => d("retryEnd"),
2919
3098
  onVisible: E(j)
@@ -2930,7 +3109,7 @@ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2930
3109
  "aria-label": "Media viewer",
2931
3110
  "aria-modal": "true",
2932
3111
  tabindex: "-1"
2933
- }, [u(_n, {
3112
+ }, [u(kn, {
2934
3113
  ref_key: "reelRenderer",
2935
3114
  ref: p,
2936
3115
  "can-retry-end": t.canRetryEnd,
@@ -2964,7 +3143,7 @@ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2964
3143
  onCloseInfoSheet: i[11] ||= (e) => d("reelInfoSheetChange", !1),
2965
3144
  onError: E(P),
2966
3145
  onLoadMore: i[12] ||= (e) => d("loadMore"),
2967
- onMediaChange: q,
3146
+ onMediaChange: J,
2968
3147
  onReady: E(F),
2969
3148
  onRetryEnd: i[13] ||= (e) => d("retryEnd"),
2970
3149
  onRetryForward: i[14] ||= (e) => d("retryForward"),
@@ -2976,7 +3155,7 @@ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2976
3155
  });
2977
3156
  //#endregion
2978
3157
  //#region src/core/page.ts
2979
- function On(e) {
3158
+ function Bn(e) {
2980
3159
  if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
2981
3160
  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.");
2982
3161
  if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
@@ -2987,22 +3166,22 @@ function $(e, t) {
2987
3166
  let n = new Set(e.map((e) => e.postId));
2988
3167
  return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
2989
3168
  }
2990
- function kn(e) {
3169
+ function Vn(e) {
2991
3170
  return `${typeof e}:${String(e)}`;
2992
3171
  }
2993
- function An(e) {
2994
- return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${kn(e.mediaId)}`;
3172
+ function Hn(e) {
3173
+ return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${Vn(e.mediaId)}`;
2995
3174
  }
2996
- function jn(e, t) {
2997
- let n = [...e], r = new Map(e.map((e, t) => [kn(e.postId), t]));
3175
+ function Un(e, t) {
3176
+ let n = [...e], r = new Map(e.map((e, t) => [Vn(e.postId), t]));
2998
3177
  return t.forEach((e) => {
2999
- let t = kn(e.postId), i = r.get(t);
3178
+ let t = Vn(e.postId), i = r.get(t);
3000
3179
  if (i === void 0) {
3001
3180
  r.set(t, n.length), n.push(e);
3002
3181
  return;
3003
3182
  }
3004
- let a = n[i], o = new Set([a, ...a.items].map(An)), s = [e, ...e.items].filter((e) => {
3005
- let t = An(e);
3183
+ let a = n[i], o = new Set([a, ...a.items].map(Hn)), s = [e, ...e.items].filter((e) => {
3184
+ let t = Hn(e);
3006
3185
  return o.has(t) ? !1 : (o.add(t), !0);
3007
3186
  });
3008
3187
  s.length > 0 && (n[i] = {
@@ -3011,14 +3190,14 @@ function jn(e, t) {
3011
3190
  });
3012
3191
  }), n;
3013
3192
  }
3014
- function Mn(e) {
3193
+ function Wn(e) {
3015
3194
  return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
3016
3195
  }
3017
3196
  //#endregion
3018
3197
  //#region src/core/appendPage.ts
3019
- function Nn(e, t, n, r) {
3020
- let i = On(e), a = n.filterItems(i.items), o = Mn(i);
3021
- t.items = jn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
3198
+ function Gn(e, t, n, r) {
3199
+ let i = Bn(e), a = n.filterItems(i.items), o = Wn(i);
3200
+ t.items = Un(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
3022
3201
  contributionIds: a.map(({ postId: e }) => e),
3023
3202
  cursor: o,
3024
3203
  next: i.next,
@@ -3027,32 +3206,32 @@ function Nn(e, t, n, r) {
3027
3206
  }
3028
3207
  //#endregion
3029
3208
  //#region src/core/requestDelay.ts
3030
- var Pn = 2e3, Fn = 1e4, In = 250, Ln = {
3209
+ var Kn = 2e3, qn = 1e4, Jn = 250, Yn = {
3031
3210
  delayRemainingMs: null,
3032
3211
  nextRequestAt: null
3033
3212
  };
3034
- function Rn(e, t) {
3213
+ function Xn(e, t) {
3035
3214
  return e === void 0 ? t : Math.floor(e);
3036
3215
  }
3037
- function zn(e, t) {
3216
+ function Zn(e, t) {
3038
3217
  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.`);
3039
3218
  }
3040
- function Bn(e, t = {}) {
3041
- let n = Rn(t.delayStepMs, Pn), r = Rn(t.delayMaxMs, Fn);
3219
+ function Qn(e, t = {}) {
3220
+ let n = Xn(t.delayStepMs, Kn), r = Xn(t.delayMaxMs, qn);
3042
3221
  return Math.min(Math.max(0, e) * n, r);
3043
3222
  }
3044
- function Vn(e) {
3045
- if (e == null || !Number.isFinite(e)) return { ...Ln };
3223
+ function $n(e) {
3224
+ if (e == null || !Number.isFinite(e)) return { ...Yn };
3046
3225
  let t = Math.max(0, Math.floor(e - Date.now()));
3047
3226
  return t > 0 ? {
3048
3227
  delayRemainingMs: t,
3049
3228
  nextRequestAt: e
3050
- } : { ...Ln };
3229
+ } : { ...Yn };
3051
3230
  }
3052
- async function Hn({ delayMs: e, onChange: t, signal: n }) {
3231
+ async function er({ delayMs: e, onChange: t, signal: n }) {
3053
3232
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
3054
3233
  if (e <= 0) {
3055
- t({ ...Ln });
3234
+ t({ ...Yn });
3056
3235
  return;
3057
3236
  }
3058
3237
  let r = Date.now() + e;
@@ -3060,9 +3239,9 @@ async function Hn({ delayMs: e, onChange: t, signal: n }) {
3060
3239
  delayRemainingMs: e,
3061
3240
  nextRequestAt: r
3062
3241
  }), await new Promise((i, a) => {
3063
- let o = !1, s = setInterval(f, In), c = setTimeout(() => u(), e);
3242
+ let o = !1, s = setInterval(f, Jn), c = setTimeout(() => u(), e);
3064
3243
  function l() {
3065
- clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Ln });
3244
+ clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Yn });
3066
3245
  }
3067
3246
  function u(e) {
3068
3247
  o || (o = !0, l(), e ? a(e) : i());
@@ -3071,42 +3250,42 @@ async function Hn({ delayMs: e, onChange: t, signal: n }) {
3071
3250
  u(new DOMException("Aborted", "AbortError"));
3072
3251
  }
3073
3252
  function f() {
3074
- let e = Vn(r);
3253
+ let e = $n(r);
3075
3254
  t(e), e.delayRemainingMs === null && u();
3076
3255
  }
3077
3256
  n.addEventListener("abort", d, { once: !0 });
3078
3257
  });
3079
3258
  }
3080
- var Un = class {
3259
+ var tr = class {
3081
3260
  interval = null;
3082
3261
  constructor(e) {
3083
3262
  this.onChange = e;
3084
3263
  }
3085
3264
  clear() {
3086
- this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Ln });
3265
+ this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Yn });
3087
3266
  }
3088
3267
  sync(e) {
3089
3268
  this.clear();
3090
- let t = Vn(e);
3269
+ let t = $n(e);
3091
3270
  this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
3092
- let t = Vn(e);
3271
+ let t = $n(e);
3093
3272
  this.onChange(t), t.delayRemainingMs === null && this.clear();
3094
- }, In));
3273
+ }, Jn));
3095
3274
  }
3096
3275
  };
3097
- function Wn(e, t = !0) {
3276
+ function nr(e, t = !0) {
3098
3277
  return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
3099
3278
  }
3100
- function Gn(e) {
3279
+ function rr(e) {
3101
3280
  return `${typeof e}:${String(e)}`;
3102
3281
  }
3103
- function Kn(e, t) {
3282
+ function ir(e, t) {
3104
3283
  if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
3105
3284
  }
3106
- function qn(e) {
3285
+ function ar(e) {
3107
3286
  if (!e) return;
3108
- if (Kn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
3109
- zn(e, "frontend autofill");
3287
+ if (ir(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
3288
+ Zn(e, "frontend autofill");
3110
3289
  let t = e.maxAdditionalPages;
3111
3290
  if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
3112
3291
  return;
@@ -3118,7 +3297,7 @@ function qn(e) {
3118
3297
  if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
3119
3298
  }
3120
3299
  }
3121
- function Jn(e, t, n = !0) {
3300
+ function or(e, t, n = !0) {
3122
3301
  if (!e) return {
3123
3302
  cycleId: null,
3124
3303
  delayRemainingMs: null,
@@ -3135,7 +3314,7 @@ function Jn(e, t, n = !0) {
3135
3314
  status: "idle",
3136
3315
  strategy: null
3137
3316
  };
3138
- let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Vn(r?.nextRequestAt);
3317
+ let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = $n(r?.nextRequestAt);
3139
3318
  return {
3140
3319
  cycleId: r?.cycleId ?? null,
3141
3320
  ...a,
@@ -3152,7 +3331,7 @@ function Jn(e, t, n = !0) {
3152
3331
  strategy: e.strategy
3153
3332
  };
3154
3333
  }
3155
- function Yn(e) {
3334
+ function sr(e) {
3156
3335
  return [
3157
3336
  "cancelling",
3158
3337
  "filling",
@@ -3160,9 +3339,9 @@ function Yn(e) {
3160
3339
  "waiting"
3161
3340
  ].includes(e.status);
3162
3341
  }
3163
- async function Xn(e, t, n) {
3342
+ async function cr(e, t, n) {
3164
3343
  let r = t.autofill;
3165
- if (!Yn(r) || !r.cycleId) return;
3344
+ if (!sr(r) || !r.cycleId) return;
3166
3345
  let i = {
3167
3346
  cycleId: r.cycleId,
3168
3347
  feedKey: r.feedKey ?? "",
@@ -3175,16 +3354,16 @@ async function Xn(e, t, n) {
3175
3354
  throw r.error = e, r.status = "error", e;
3176
3355
  }
3177
3356
  }
3178
- function Zn(e, t, n) {
3357
+ function lr(e, t, n) {
3179
3358
  return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
3180
3359
  }
3181
- async function Qn({ 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 }) {
3182
- let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Wn(s), g = t, _ = t, v = t, y = 0, b = [], x;
3360
+ async function ur({ 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 }) {
3361
+ let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? nr(s), g = t, _ = t, v = t, y = 0, b = [], x;
3183
3362
  for (; y < h;) {
3184
- let e = Gn(g);
3363
+ let e = rr(g);
3185
3364
  if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
3186
- if (m.add(e), await Hn({
3187
- delayMs: Bn(l + y, s),
3365
+ if (m.add(e), await er({
3366
+ delayMs: Qn(l + y, s),
3188
3367
  onChange: a,
3189
3368
  signal: d
3190
3369
  }), y > 0 && u()) return {
@@ -3198,7 +3377,7 @@ async function Qn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
3198
3377
  status: "paused",
3199
3378
  total: x
3200
3379
  };
3201
- let t = On(await n({
3380
+ let t = Bn(await n({
3202
3381
  cursor: g,
3203
3382
  signal: d
3204
3383
  }));
@@ -3255,12 +3434,12 @@ async function Qn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
3255
3434
  }
3256
3435
  //#endregion
3257
3436
  //#region src/core/autofillController.ts
3258
- var $n = class {
3437
+ var dr = class {
3259
3438
  collection = null;
3260
3439
  cycle = 0;
3261
3440
  delayCountdown;
3262
3441
  constructor(e) {
3263
- this.context = e, this.delayCountdown = new Un((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
3442
+ this.context = e, this.delayCountdown = new tr((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
3264
3443
  }
3265
3444
  beginCycle() {
3266
3445
  let { options: e, state: t } = this.context;
@@ -3268,14 +3447,14 @@ var $n = class {
3268
3447
  this.clear();
3269
3448
  let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
3270
3449
  return t.autofill = {
3271
- ...Jn(e, void 0, !1),
3450
+ ...or(e, void 0, !1),
3272
3451
  cycleId: n,
3273
3452
  status: "filling"
3274
3453
  }, n;
3275
3454
  }
3276
3455
  async cancel() {
3277
3456
  let { cancelRequest: e, options: t, state: n } = this.context;
3278
- await Xn(t, n, e), this.commitCollection();
3457
+ await cr(t, n, e), this.commitCollection();
3279
3458
  }
3280
3459
  captureCollection(e, t) {
3281
3460
  t && (this.collection = e);
@@ -3303,30 +3482,30 @@ var $n = class {
3303
3482
  requests: r.requests
3304
3483
  }), !0) : !1;
3305
3484
  }
3306
- }, er = 100;
3307
- function tr(e, t) {
3485
+ }, fr = 100;
3486
+ function pr(e, t) {
3308
3487
  if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
3309
3488
  }
3310
- function nr(e, t, n) {
3489
+ function mr(e, t, n) {
3311
3490
  return Math.min(n, Math.max(t, e));
3312
3491
  }
3313
- function rr(e) {
3492
+ function hr(e) {
3314
3493
  if (!e) return;
3315
3494
  let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
3316
- if (tr("autoScroll.minSpeedPxPerSecond", t), tr("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
3317
- e.speedPxPerSecond !== void 0 && tr("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
3495
+ if (pr("autoScroll.minSpeedPxPerSecond", t), pr("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
3496
+ e.speedPxPerSecond !== void 0 && pr("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
3318
3497
  }
3319
- function ir(e) {
3498
+ function gr(e) {
3320
3499
  let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
3321
3500
  return {
3322
3501
  enabled: e?.enabled ?? !1,
3323
3502
  maxSpeedPxPerSecond: n,
3324
3503
  minSpeedPxPerSecond: t,
3325
3504
  paused: !1,
3326
- speedPxPerSecond: nr(e?.speedPxPerSecond ?? 80, t, n)
3505
+ speedPxPerSecond: mr(e?.speedPxPerSecond ?? 80, t, n)
3327
3506
  };
3328
3507
  }
3329
- var ar = class {
3508
+ var _r = class {
3330
3509
  frame = null;
3331
3510
  lastTimestamp = null;
3332
3511
  mounted = !1;
@@ -3346,9 +3525,9 @@ var ar = class {
3346
3525
  this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
3347
3526
  }
3348
3527
  setSpeed(e) {
3349
- tr("auto-scroll speed", e);
3528
+ pr("auto-scroll speed", e);
3350
3529
  let t = this.options.state;
3351
- t.speedPxPerSecond = nr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
3530
+ t.speedPxPerSecond = mr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
3352
3531
  }
3353
3532
  tick = (e) => {
3354
3533
  this.frame = null;
@@ -3360,7 +3539,7 @@ var ar = class {
3360
3539
  return;
3361
3540
  }
3362
3541
  if (this.lastTimestamp !== null) {
3363
- let r = Math.min(er, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
3542
+ let r = Math.min(fr, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
3364
3543
  n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
3365
3544
  }
3366
3545
  this.lastTimestamp = e, this.schedule();
@@ -3374,13 +3553,13 @@ var ar = class {
3374
3553
  };
3375
3554
  //#endregion
3376
3555
  //#region src/core/backendAutofill.ts
3377
- async function or(e, t, n, r) {
3556
+ async function vr(e, t, n, r) {
3378
3557
  let i = await e.onUnderfilled(n);
3379
3558
  if (!r()) return;
3380
3559
  if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
3381
3560
  let a = Math.max(n.received, i.received ?? n.received);
3382
3561
  Object.assign(t.autofill, {
3383
- ...Vn(i.nextRequestAt),
3562
+ ...$n(i.nextRequestAt),
3384
3563
  missing: Math.max(0, e.pageSize - a),
3385
3564
  received: a,
3386
3565
  sequence: i.sequence ?? 0,
@@ -3388,19 +3567,19 @@ async function or(e, t, n, r) {
3388
3567
  status: "waiting"
3389
3568
  });
3390
3569
  }
3391
- function sr(e, t) {
3570
+ function yr(e, t) {
3392
3571
  ["complete", "exhausted"].includes(t.status) && t.items && (e.items = $(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
3393
3572
  }
3394
- function cr(e, t, n) {
3573
+ function br(e, t, n) {
3395
3574
  let r = t.autofill;
3396
- return !Zn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (sr(t, n), Object.assign(r, Vn(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);
3575
+ return !lr(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (yr(t, n), Object.assign(r, $n(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);
3397
3576
  }
3398
- function lr(e, t, n) {
3399
- return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Jn(e, n), sr(t, n), !0);
3577
+ function xr(e, t, n) {
3578
+ return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = or(e, n), yr(t, n), !0);
3400
3579
  }
3401
3580
  //#endregion
3402
3581
  //#region src/core/backlogRestore.ts
3403
- async function ur(e, t, n) {
3582
+ async function Sr(e, t, n) {
3404
3583
  if (!e) return;
3405
3584
  let r = new AbortController();
3406
3585
  n(r);
@@ -3415,7 +3594,7 @@ async function ur(e, t, n) {
3415
3594
  }
3416
3595
  //#endregion
3417
3596
  //#region src/core/initialAutofill.ts
3418
- async function dr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
3597
+ async function Cr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
3419
3598
  let c = a.autofill;
3420
3599
  if (!c) return;
3421
3600
  let l = s.items.length;
@@ -3428,7 +3607,7 @@ async function dr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3428
3607
  return;
3429
3608
  }
3430
3609
  if (c.strategy === "backend") {
3431
- await or(c, s, {
3610
+ await vr(c, s, {
3432
3611
  cycleId: e,
3433
3612
  feedKey: c.feedKey,
3434
3613
  items: [...s.items],
@@ -3445,11 +3624,11 @@ async function dr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3445
3624
  s.autofill.status = "exhausted";
3446
3625
  return;
3447
3626
  }
3448
- let u = await Qn({
3627
+ let u = await ur({
3449
3628
  existingItems: s.items,
3450
3629
  initialCursor: s.next,
3451
3630
  loadPage: a.loadPage,
3452
- maximumRequests: Wn(c, !1),
3631
+ maximumRequests: nr(c, !1),
3453
3632
  onCollection: n,
3454
3633
  onDelayChange: (e) => {
3455
3634
  t() && Object.assign(s.autofill, e);
@@ -3472,13 +3651,13 @@ async function dr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3472
3651
  }
3473
3652
  //#endregion
3474
3653
  //#region src/core/fill.ts
3475
- function fr(e) {
3654
+ function wr(e) {
3476
3655
  return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
3477
3656
  }
3478
- function pr(e) {
3657
+ function Tr(e) {
3479
3658
  return `${typeof e}:${String(e)}`;
3480
3659
  }
3481
- function mr(e) {
3660
+ function Er(e) {
3482
3661
  if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
3483
3662
  if ("pages" in e) {
3484
3663
  if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
@@ -3491,21 +3670,21 @@ function mr(e) {
3491
3670
  if ("until" in e && e.until === "end") return { until: "end" };
3492
3671
  throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
3493
3672
  }
3494
- function hr(e) {
3673
+ function Dr(e) {
3495
3674
  if (!e) return;
3496
3675
  if (e.strategy === "frontend") {
3497
- zn(e, "frontend fill");
3676
+ Zn(e, "frontend fill");
3498
3677
  return;
3499
3678
  }
3500
3679
  if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
3501
3680
  let t = e.initialSession;
3502
3681
  if (t) {
3503
3682
  if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
3504
- mr(t.target);
3683
+ Er(t.target);
3505
3684
  }
3506
3685
  }
3507
- function gr(e, t, n = !0) {
3508
- let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Vn(i?.nextRequestAt);
3686
+ function Or(e, t, n = !0) {
3687
+ let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = $n(i?.nextRequestAt);
3509
3688
  return {
3510
3689
  completedPages: i?.completedPages ?? 0,
3511
3690
  cycleId: i?.cycleId ?? null,
@@ -3518,10 +3697,10 @@ function gr(e, t, n = !0) {
3518
3697
  sessionId: i?.sessionId ?? null,
3519
3698
  status: i?.status ?? "idle",
3520
3699
  strategy: e?.strategy ?? null,
3521
- target: i ? fr(i.target) : null
3700
+ target: i ? wr(i.target) : null
3522
3701
  };
3523
3702
  }
3524
- function _r(e) {
3703
+ function kr(e) {
3525
3704
  return [
3526
3705
  "cancelling",
3527
3706
  "filling",
@@ -3529,7 +3708,7 @@ function _r(e) {
3529
3708
  "waiting"
3530
3709
  ].includes(e.status);
3531
3710
  }
3532
- async function vr({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3711
+ async function Ar({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
3533
3712
  let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
3534
3713
  if ("items" in l && f.length >= l.items) return {
3535
3714
  completedPages: m,
@@ -3541,10 +3720,10 @@ async function vr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3541
3720
  status: "complete"
3542
3721
  };
3543
3722
  for (; _ !== null;) {
3544
- let e = pr(h);
3723
+ let e = Tr(h);
3545
3724
  if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
3546
- if (p.add(e), await Hn({
3547
- delayMs: Bn(m, o),
3725
+ if (p.add(e), await er({
3726
+ delayMs: Qn(m, o),
3548
3727
  onChange: i,
3549
3728
  signal: c
3550
3729
  }), m > 0 && s()) return {
@@ -3557,7 +3736,7 @@ async function vr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3557
3736
  status: "paused",
3558
3737
  total: y
3559
3738
  };
3560
- let t = On(await n({
3739
+ let t = Bn(await n({
3561
3740
  cursor: h,
3562
3741
  signal: c
3563
3742
  }));
@@ -3625,12 +3804,12 @@ async function vr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3625
3804
  }
3626
3805
  //#endregion
3627
3806
  //#region src/core/backendFill.ts
3628
- async function yr(e, t, n, r) {
3807
+ async function jr(e, t, n, r) {
3629
3808
  let i = await e.onStart(n);
3630
3809
  if (r()) {
3631
3810
  if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
3632
3811
  Object.assign(t.fill, {
3633
- ...Vn(i.nextRequestAt),
3812
+ ...$n(i.nextRequestAt),
3634
3813
  completedPages: i.completedPages ?? 0,
3635
3814
  received: i.received ?? 0,
3636
3815
  sequence: i.sequence ?? 0,
@@ -3639,23 +3818,23 @@ async function yr(e, t, n, r) {
3639
3818
  });
3640
3819
  }
3641
3820
  }
3642
- function br(e, t, n) {
3821
+ function Mr(e, t, n) {
3643
3822
  return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
3644
3823
  }
3645
- function xr(e) {
3824
+ function Nr(e) {
3646
3825
  return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
3647
3826
  }
3648
- function Sr(e, t) {
3827
+ function Pr(e, t) {
3649
3828
  if (!["complete", "exhausted"].includes(t.status)) return !0;
3650
3829
  let n = e.fill.target;
3651
3830
  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;
3652
3831
  }
3653
- function Cr(e, t, n) {
3832
+ function Fr(e, t, n) {
3654
3833
  t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = $(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
3655
3834
  }
3656
- function wr(e, t, n, r) {
3657
- return !br(e, t, n) || !xr(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Sr(t, n) ? !1 : (Cr(t, n, r), Object.assign(t.fill, {
3658
- ...Vn(n.status === "waiting" ? n.nextRequestAt : null),
3835
+ function Ir(e, t, n, r) {
3836
+ return !Mr(e, t, n) || !Nr(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Pr(t, n) ? !1 : (Fr(t, n, r), Object.assign(t.fill, {
3837
+ ...$n(n.status === "waiting" ? n.nextRequestAt : null),
3659
3838
  completedPages: n.completedPages,
3660
3839
  error: n.error ?? null,
3661
3840
  received: n.received,
@@ -3663,45 +3842,45 @@ function wr(e, t, n, r) {
3663
3842
  status: n.status
3664
3843
  }), !0);
3665
3844
  }
3666
- function Tr(e, t, n, r) {
3845
+ function Lr(e, t, n, r) {
3667
3846
  if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
3668
3847
  let i = t.fill;
3669
- return t.fill = gr(e, n), !xr(n) || !Sr(t, n) ? (t.fill = i, !1) : (Cr(t, n, r), !0);
3848
+ return t.fill = Or(e, n), !Nr(n) || !Pr(t, n) ? (t.fill = i, !1) : (Fr(t, n, r), !0);
3670
3849
  }
3671
3850
  //#endregion
3672
3851
  //#region src/core/fillController.ts
3673
- var Er = class {
3852
+ var Rr = class {
3674
3853
  abortController = null;
3675
3854
  cycle = 0;
3676
3855
  delayCountdown;
3677
3856
  requestVersion = 0;
3678
3857
  collection = null;
3679
3858
  constructor(e) {
3680
- this.options = e, this.delayCountdown = new Un((e) => {
3859
+ this.options = e, this.delayCountdown = new tr((e) => {
3681
3860
  Object.assign(this.options.state.fill, e);
3682
3861
  }), this.syncBackendCountdown();
3683
3862
  }
3684
3863
  isActive() {
3685
- return _r(this.options.state.fill);
3864
+ return kr(this.options.state.fill);
3686
3865
  }
3687
3866
  applyUpdate(e) {
3688
- let t = wr(this.options.fill, this.options.state, e, this.options.onLastCursor);
3867
+ let t = Ir(this.options.fill, this.options.state, e, this.options.onLastCursor);
3689
3868
  return t && this.syncBackendCountdown(), t;
3690
3869
  }
3691
3870
  restoreSession(e) {
3692
- let t = Tr(this.options.fill, this.options.state, e, this.options.onLastCursor);
3871
+ let t = Lr(this.options.fill, this.options.state, e, this.options.onLastCursor);
3693
3872
  return t && this.syncBackendCountdown(), t;
3694
3873
  }
3695
3874
  async start(e, t = {}) {
3696
3875
  let n = this.options.fill;
3697
3876
  if (!n) throw Error("Vibe fill is not configured.");
3698
3877
  if (this.isActive()) throw Error("Vibe fill is already active.");
3699
- let r = mr(e), i = mr(t.target ?? r), a = t.progressOffset ?? {
3878
+ let r = Er(e), i = Er(t.target ?? r), a = t.progressOffset ?? {
3700
3879
  completedPages: 0,
3701
3880
  received: 0
3702
3881
  }, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
3703
3882
  if (this.options.state.fill = {
3704
- ...gr(n, void 0, !1),
3883
+ ...Or(n, void 0, !1),
3705
3884
  completedPages: a.completedPages,
3706
3885
  cycleId: o,
3707
3886
  received: a.received,
@@ -3714,7 +3893,7 @@ var Er = class {
3714
3893
  let s = ++this.requestVersion, c = new AbortController();
3715
3894
  this.abortController = c;
3716
3895
  try {
3717
- n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await yr(n, this.options.state, {
3896
+ n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await jr(n, this.options.state, {
3718
3897
  cycleId: o,
3719
3898
  feedKey: n.feedKey,
3720
3899
  items: [...this.options.state.items],
@@ -3732,7 +3911,7 @@ var Er = class {
3732
3911
  }
3733
3912
  async cancel() {
3734
3913
  let { fill: e, state: t } = this.options;
3735
- if (!_r(t.fill) || !t.fill.cycleId) return;
3914
+ if (!kr(t.fill) || !t.fill.cycleId) return;
3736
3915
  let n = {
3737
3916
  cycleId: t.fill.cycleId,
3738
3917
  feedKey: t.fill.feedKey ?? "",
@@ -3776,7 +3955,7 @@ var Er = class {
3776
3955
  });
3777
3956
  }
3778
3957
  reset() {
3779
- this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = gr(this.options.fill, void 0, !1), this.collection = null;
3958
+ this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = Or(this.options.fill, void 0, !1), this.collection = null;
3780
3959
  }
3781
3960
  destroy() {
3782
3961
  this.abortLocalRequest(), this.delayCountdown.clear();
@@ -3811,7 +3990,7 @@ var Er = class {
3811
3990
  s.fill.status = "until" in t ? "complete" : "exhausted";
3812
3991
  return;
3813
3992
  }
3814
- let c = await vr({
3993
+ let c = await Ar({
3815
3994
  existingItems: s.items,
3816
3995
  initialCursor: s.next,
3817
3996
  loadPage: o,
@@ -3859,7 +4038,7 @@ var Er = class {
3859
4038
  };
3860
4039
  //#endregion
3861
4040
  //#region src/core/fillReconciliation.ts
3862
- async function Dr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
4041
+ async function zr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3863
4042
  if (!e.needsReconciliation(o.items)) return "skipped";
3864
4043
  let s = await e.reconcile({
3865
4044
  existingItems: o.items,
@@ -3872,7 +4051,7 @@ async function Dr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
3872
4051
  }
3873
4052
  //#endregion
3874
4053
  //#region src/core/feedFooter.ts
3875
- function Or(e) {
4054
+ function Br(e) {
3876
4055
  return {
3877
4056
  cancelAutofill: () => e.cancelAutofill(),
3878
4057
  loadMore: () => e.loadNext(),
@@ -3884,46 +4063,46 @@ function Or(e) {
3884
4063
  retryFill: () => e.retryFill()
3885
4064
  };
3886
4065
  }
3887
- function kr(e) {
4066
+ function Vr(e) {
3888
4067
  if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
3889
4068
  }
3890
- function Ar(e) {
3891
- e?.intervalMs !== void 0 && kr(e.intervalMs);
4069
+ function Hr(e) {
4070
+ e?.intervalMs !== void 0 && Vr(e.intervalMs);
3892
4071
  }
3893
- function jr(e) {
4072
+ function Ur(e) {
3894
4073
  return {
3895
4074
  enabled: e?.enabled ?? !1,
3896
4075
  includePostItems: e?.includePostItems ?? !1,
3897
4076
  intervalMs: e?.intervalMs ?? 5e3
3898
4077
  };
3899
4078
  }
3900
- function Mr(e, t) {
4079
+ function Wr(e, t) {
3901
4080
  if (typeof t == "boolean") {
3902
4081
  e.enabled = t;
3903
4082
  return;
3904
4083
  }
3905
- Ar(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);
4084
+ Hr(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);
3906
4085
  }
3907
4086
  //#endregion
3908
4087
  //#region src/core/reelInfoSheet.ts
3909
- function Nr(e) {
4088
+ function Gr(e) {
3910
4089
  return { enabled: e?.enabled ?? !1 };
3911
4090
  }
3912
- function Pr(e, t, n) {
4091
+ function Kr(e, t, n) {
3913
4092
  if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
3914
4093
  e.enabled = n;
3915
4094
  }
3916
4095
  //#endregion
3917
4096
  //#region src/core/initialRuntimeState.ts
3918
- function Fr(e, t) {
4097
+ function qr(e, t) {
3919
4098
  let n = e.initialPage;
3920
4099
  return {
3921
4100
  activeReelPostId: null,
3922
- autoScroll: ir(e.autoScroll),
3923
- autofill: Jn(e.autofill),
4101
+ autoScroll: gr(e.autoScroll),
4102
+ autofill: or(e.autofill),
3924
4103
  current: n?.current ?? null,
3925
4104
  error: null,
3926
- fill: gr(e.fill),
4105
+ fill: Or(e.fill),
3927
4106
  infiniteScroll: e.infiniteScroll ?? !0,
3928
4107
  isLoading: !n,
3929
4108
  isLoadingMore: !1,
@@ -3934,14 +4113,14 @@ function Fr(e, t) {
3934
4113
  next: n?.next ?? null,
3935
4114
  nextPageError: null,
3936
4115
  phoneMode: !1,
3937
- reelAutoAdvance: jr(e.reelAutoAdvance),
4116
+ reelAutoAdvance: Ur(e.reelAutoAdvance),
3938
4117
  reelForward: {
3939
4118
  error: null,
3940
4119
  status: "idle"
3941
4120
  },
3942
4121
  reelForwardIndex: null,
3943
4122
  reelForwardItem: null,
3944
- reelInfoSheet: Nr(e.reelInfoSheet),
4123
+ reelInfoSheet: Gr(e.reelInfoSheet),
3945
4124
  reelInfoSheetOverlay: !1,
3946
4125
  reelMediaSource: "original",
3947
4126
  reelOrigin: null,
@@ -3950,21 +4129,21 @@ function Fr(e, t) {
3950
4129
  }
3951
4130
  //#endregion
3952
4131
  //#region src/core/options.ts
3953
- function Ir(e, t) {
4132
+ function Jr(e, t) {
3954
4133
  if (t) {
3955
4134
  if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
3956
4135
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
3957
4136
  }
3958
4137
  }
3959
- function Lr(e, t) {
4138
+ function Yr(e, t) {
3960
4139
  if (t) {
3961
4140
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
3962
4141
  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.`);
3963
4142
  }
3964
4143
  }
3965
- function Rr(e) {
3966
- if (rr(e.autoScroll), Ir("cardHeader", e.cardHeader), Ir("cardFooter", e.cardFooter), Lr("header", e.mediaCard?.header), Lr("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "visible-post") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"visible-post\".");
3967
- if (qn(e.autofill), hr(e.fill), ve(e.masonry), Ar(e.reelAutoAdvance), e.removalReconciliation) {
4144
+ function Xr(e) {
4145
+ if (hr(e.autoScroll), Jr("cardHeader", e.cardHeader), Jr("cardFooter", e.cardFooter), Yr("header", e.mediaCard?.header), Yr("footer", e.mediaCard?.footer), e.mediaCard?.feedPreload !== void 0 && e.mediaCard.feedPreload !== "none" && e.mediaCard.feedPreload !== "visible-post") throw TypeError("Vibe mediaCard feedPreload must be \"none\" or \"visible-post\".");
4146
+ if (ar(e.autofill), Dr(e.fill), Oe(e.masonry), Hr(e.reelAutoAdvance), e.removalReconciliation) {
3968
4147
  if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
3969
4148
  let t = e.removalReconciliation.maxReplayPages ?? 5;
3970
4149
  if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
@@ -3979,7 +4158,7 @@ function Rr(e) {
3979
4158
  if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
3980
4159
  if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
3981
4160
  }
3982
- function zr(e) {
4161
+ function Zr(e) {
3983
4162
  if (typeof e != "string") return e;
3984
4163
  if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
3985
4164
  let t = document.querySelector(e);
@@ -3988,7 +4167,7 @@ function zr(e) {
3988
4167
  }
3989
4168
  //#endregion
3990
4169
  //#region src/core/pageRequest.ts
3991
- async function Br({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
4170
+ async function Qr({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3992
4171
  let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
3993
4172
  received: l.autofill.received,
3994
4173
  requests: l.autofill.requests
@@ -4000,11 +4179,11 @@ async function Br({ append: e, autofillController: t, cursor: n, isCurrent: r, l
4000
4179
  let m = !1;
4001
4180
  try {
4002
4181
  if (u?.strategy === "frontend") {
4003
- let s = await Qn({
4182
+ let s = await ur({
4004
4183
  existingItems: e ? l.items : [],
4005
4184
  initialCursor: n,
4006
4185
  loadPage: i,
4007
- maximumRequests: f ? Math.max(0, Wn(u) - f.requests) : void 0,
4186
+ maximumRequests: f ? Math.max(0, nr(u) - f.requests) : void 0,
4008
4187
  onCollection: (e) => t.captureCollection(e, r()),
4009
4188
  onDelayChange: (e) => {
4010
4189
  r() && Object.assign(l.autofill, e);
@@ -4027,7 +4206,7 @@ async function Br({ append: e, autofillController: t, cursor: n, isCurrent: r, l
4027
4206
  }), o(s.pages), t.clearCollection();
4028
4207
  return;
4029
4208
  }
4030
- let s = On(await i({
4209
+ let s = Bn(await i({
4031
4210
  cursor: n,
4032
4211
  signal: c
4033
4212
  }));
@@ -4047,7 +4226,7 @@ async function Br({ append: e, autofillController: t, cursor: n, isCurrent: r, l
4047
4226
  l.autofill.status = "complete";
4048
4227
  return;
4049
4228
  }
4050
- await or(u, l, {
4229
+ await vr(u, l, {
4051
4230
  cycleId: p,
4052
4231
  feedKey: u.feedKey,
4053
4232
  items: h.slice(d.length),
@@ -4069,16 +4248,16 @@ async function Br({ append: e, autofillController: t, cursor: n, isCurrent: r, l
4069
4248
  }
4070
4249
  //#endregion
4071
4250
  //#region src/core/removalReconciliationController.ts
4072
- function Vr(e) {
4251
+ function $r(e) {
4073
4252
  return `${typeof e}:${String(e)}`;
4074
4253
  }
4075
- function Hr(e) {
4254
+ function ei(e) {
4076
4255
  return `${typeof e}:${String(e)}`;
4077
4256
  }
4078
- function Ur(e) {
4257
+ function ti(e) {
4079
4258
  return e.map(({ postId: e }) => e);
4080
4259
  }
4081
- var Wr = class {
4260
+ var ni = class {
4082
4261
  delay;
4083
4262
  enabled;
4084
4263
  maxReplayPages;
@@ -4097,7 +4276,7 @@ var Wr = class {
4097
4276
  e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
4098
4277
  }
4099
4278
  filterItems(e) {
4100
- return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(Vr(e)));
4279
+ return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has($r(e)));
4101
4280
  }
4102
4281
  needsReconciliation(e) {
4103
4282
  return this.pending !== null || this.findUnderfilledPage(e) >= 0;
@@ -4110,45 +4289,45 @@ var Wr = class {
4110
4289
  }
4111
4290
  recordInitialPage(e) {
4112
4291
  e && this.recordPages([{
4113
- contributionIds: Ur(e.items),
4114
- cursor: Mn(e),
4292
+ contributionIds: ti(e.items),
4293
+ cursor: Wn(e),
4115
4294
  next: e.next,
4116
- returnedIds: Ur(e.items)
4295
+ returnedIds: ti(e.items)
4117
4296
  }]);
4118
4297
  }
4119
4298
  remove(e) {
4120
- e.forEach((e) => this.tombstones.add(Vr(e)));
4299
+ e.forEach((e) => this.tombstones.add($r(e)));
4121
4300
  }
4122
4301
  reset() {
4123
4302
  this.pages = [], this.pending = null, this.tombstones.clear();
4124
4303
  }
4125
4304
  restore(e) {
4126
- e.forEach((e) => this.tombstones.delete(Vr(e)));
4305
+ e.forEach((e) => this.tombstones.delete($r(e)));
4127
4306
  }
4128
4307
  async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
4129
4308
  let a = this.pending ?? this.createSession(e);
4130
4309
  for (this.pending = a; a.remainingRequests > 0;) {
4131
- let e = Hr(a.cursor);
4310
+ let e = ei(a.cursor);
4132
4311
  if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
4133
- if (await Hn({
4134
- delayMs: Bn(a.pages.length, this.delay),
4312
+ if (await er({
4313
+ delayMs: Qn(a.pages.length, this.delay),
4135
4314
  onChange: n,
4136
4315
  signal: i
4137
4316
  }), a.pages.length > 0 && r()) return this.result(a, "paused");
4138
- let o = On(await t({
4317
+ let o = Bn(await t({
4139
4318
  cursor: a.cursor,
4140
4319
  signal: i
4141
4320
  }));
4142
4321
  a.seenCursors.add(e);
4143
4322
  let s = this.filterItems(o.items), c = [];
4144
4323
  if (s.forEach((e) => {
4145
- let t = Vr(e.postId);
4324
+ let t = $r(e.postId);
4146
4325
  a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
4147
4326
  }), a.pages.push({
4148
4327
  contributionIds: c,
4149
4328
  cursor: a.cursor,
4150
4329
  next: o.next,
4151
- returnedIds: Ur(s)
4330
+ returnedIds: ti(s)
4152
4331
  }), 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");
4153
4332
  }
4154
4333
  return this.result(a, "complete");
@@ -4156,9 +4335,9 @@ var Wr = class {
4156
4335
  createSession(e) {
4157
4336
  let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
4158
4337
  if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
4159
- let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(Vr))), a = new Set(e.map(({ postId: e }) => Vr(e)).filter((e) => !i.has(e)));
4338
+ let i = new Set(n.flatMap(({ contributionIds: e }) => e.map($r))), a = new Set(e.map(({ postId: e }) => $r(e)).filter((e) => !i.has(e)));
4160
4339
  return {
4161
- appended: new Set(e.map(({ postId: e }) => Vr(e))),
4340
+ appended: new Set(e.map(({ postId: e }) => $r(e))),
4162
4341
  attributed: new Set(a),
4163
4342
  cursor: r.cursor,
4164
4343
  items: [],
@@ -4183,11 +4362,11 @@ var Wr = class {
4183
4362
  }
4184
4363
  findUnderfilledPage(e) {
4185
4364
  if (!this.enabled || this.pages.length === 0) return -1;
4186
- let t = new Set(e.map(({ postId: e }) => Vr(e)));
4187
- return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(Vr(e))).length < this.pageSize);
4365
+ let t = new Set(e.map(({ postId: e }) => $r(e)));
4366
+ return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($r(e))).length < this.pageSize);
4188
4367
  }
4189
4368
  recordPage(e) {
4190
- let t = Hr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Hr(e) === t);
4369
+ let t = ei(e.cursor), n = this.pages.findIndex(({ cursor: e }) => ei(e) === t);
4191
4370
  n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
4192
4371
  ...e,
4193
4372
  contributionIds: [...e.contributionIds],
@@ -4197,7 +4376,7 @@ var Wr = class {
4197
4376
  };
4198
4377
  //#endregion
4199
4378
  //#region src/core/activeItemRemoval.ts
4200
- function Gr(e, t, n, r, i) {
4379
+ function ri(e, t, n, r, i) {
4201
4380
  let a = new Set(t.map(({ item: e }) => e.postId));
4202
4381
  if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
4203
4382
  let o = e.items[Math.max(n, 0)];
@@ -4210,7 +4389,7 @@ function Gr(e, t, n, r, i) {
4210
4389
  }
4211
4390
  //#endregion
4212
4391
  //#region src/core/exactMediaRemovalController.ts
4213
- function Kr(e, t) {
4392
+ function ii(e, t) {
4214
4393
  let [n, ...r] = t;
4215
4394
  if (!n) throw Error("Vibe items must contain at least one media asset.");
4216
4395
  return {
@@ -4219,10 +4398,10 @@ function Kr(e, t) {
4219
4398
  items: r
4220
4399
  };
4221
4400
  }
4222
- function qr(e) {
4401
+ function ai(e) {
4223
4402
  if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
4224
4403
  }
4225
- var Jr = class {
4404
+ var oi = class {
4226
4405
  generation = 0;
4227
4406
  metadata = /* @__PURE__ */ new WeakMap();
4228
4407
  state;
@@ -4230,7 +4409,7 @@ var Jr = class {
4230
4409
  this.options = e, this.state = e.state;
4231
4410
  }
4232
4411
  remove(e) {
4233
- qr(e);
4412
+ ai(e);
4234
4413
  let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
4235
4414
  if (!n) return null;
4236
4415
  let r = [...H(n)], i = r[e.mediaIndex];
@@ -4247,7 +4426,7 @@ var Jr = class {
4247
4426
  restored: !1
4248
4427
  });
4249
4428
  let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
4250
- return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Kr(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);
4429
+ return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = ii(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);
4251
4430
  }
4252
4431
  reset() {
4253
4432
  this.generation += 1;
@@ -4273,7 +4452,7 @@ var Jr = class {
4273
4452
  }
4274
4453
  restoreIntoPost(e, t) {
4275
4454
  let n = this.state.items[e], r = [...H(n)], i = Math.min(t.mediaIndex, r.length);
4276
- if (r.splice(i, 0, t.media), this.state.items[e] = Kr(n, r), this.state.activeReelPostId !== t.postId) return;
4455
+ if (r.splice(i, 0, t.media), this.state.items[e] = ii(n, r), this.state.activeReelPostId !== t.postId) return;
4277
4456
  let a = this.state.mediaIndices.get(t.postId) ?? 0;
4278
4457
  a >= i && this.state.mediaIndices.set(t.postId, a + 1);
4279
4458
  }
@@ -4286,18 +4465,18 @@ var Jr = class {
4286
4465
  };
4287
4466
  //#endregion
4288
4467
  //#region src/core/itemPlacement.ts
4289
- function Yr(e, t) {
4468
+ function si(e, t) {
4290
4469
  let n = new Set(t);
4291
4470
  return e.flatMap((e, t) => n.has(e.postId) ? [{
4292
4471
  index: t,
4293
4472
  item: e
4294
4473
  }] : []);
4295
4474
  }
4296
- function Xr(e, t) {
4475
+ function ci(e, t) {
4297
4476
  let n = new Set(t.map(({ item: e }) => e.postId));
4298
4477
  return e.filter((e) => !n.has(e.postId));
4299
4478
  }
4300
- function Zr(e, t) {
4479
+ function li(e, t) {
4301
4480
  t.forEach(({ index: e }) => {
4302
4481
  if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
4303
4482
  });
@@ -4308,7 +4487,7 @@ function Zr(e, t) {
4308
4487
  }
4309
4488
  //#endregion
4310
4489
  //#region src/core/itemRemovalController.ts
4311
- var Qr = 20, $r = class {
4490
+ var ui = 20, di = class {
4312
4491
  generation = 0;
4313
4492
  historyLimit;
4314
4493
  metadata = /* @__PURE__ */ new WeakMap();
@@ -4317,7 +4496,7 @@ var Qr = 20, $r = class {
4317
4496
  itemOrder;
4318
4497
  stopItemsWatcher;
4319
4498
  constructor(e) {
4320
- this.options = e, this.historyLimit = e.historyLimit ?? Qr, 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" });
4499
+ this.options = e, this.historyLimit = e.historyLimit ?? ui, 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" });
4321
4500
  }
4322
4501
  destroy() {
4323
4502
  this.reset(), this.stopItemsWatcher();
@@ -4331,7 +4510,7 @@ var Qr = 20, $r = class {
4331
4510
  let a = this.options.startRemoval(i, t);
4332
4511
  if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
4333
4512
  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);
4334
- return this.state.items = Xr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
4513
+ return this.state.items = ci(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
4335
4514
  }
4336
4515
  reset() {
4337
4516
  this.generation += 1, this.history = [], this.itemOrder = [];
@@ -4342,7 +4521,7 @@ var Qr = 20, $r = class {
4342
4521
  this.restoreRemoval(t);
4343
4522
  return;
4344
4523
  }
4345
- 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 = Zr(this.state.items, r);
4524
+ 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 = li(this.state.items, r);
4346
4525
  this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
4347
4526
  }
4348
4527
  restoreRemoval(e) {
@@ -4368,7 +4547,7 @@ var Qr = 20, $r = class {
4368
4547
  }
4369
4548
  collectOrderedPlacements(e) {
4370
4549
  let t = new Map(this.itemOrder.map((e, t) => [e, t]));
4371
- return Yr(this.state.items, e).map((e) => ({
4550
+ return si(this.state.items, e).map((e) => ({
4372
4551
  index: t.get(e.item.postId) ?? e.index,
4373
4552
  item: e.item
4374
4553
  }));
@@ -4399,7 +4578,7 @@ var Qr = 20, $r = class {
4399
4578
  let r = new Map(this.itemOrder.map((e, t) => [e, t]));
4400
4579
  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;
4401
4580
  }
4402
- }, ei = class {
4581
+ }, fi = class {
4403
4582
  forward = null;
4404
4583
  forwardPromise = null;
4405
4584
  forwardVersion = 0;
@@ -4438,6 +4617,12 @@ var Qr = 20, $r = class {
4438
4617
  status: "idle"
4439
4618
  }, this.state.reelForwardIndex = null, this.state.reelForwardItem = null;
4440
4619
  }
4620
+ stopAtLock() {
4621
+ return this.state.loadMoreLocked ? (this.state.reelOrigin === "masonry" ? (this.reset(), this.options.onCloseReel()) : this.state.reelForward = {
4622
+ error: null,
4623
+ status: "end"
4624
+ }, !0) : !1;
4625
+ }
4441
4626
  startForwardRequest() {
4442
4627
  if (this.forwardPromise) return this.forwardPromise;
4443
4628
  let e = this.loadForward();
@@ -4453,6 +4638,7 @@ var Qr = 20, $r = class {
4453
4638
  this.forward = null, this.clearState(), this.options.onActivate(t.postId);
4454
4639
  return;
4455
4640
  }
4641
+ if (this.stopAtLock()) return;
4456
4642
  if (this.state.nextPageError) {
4457
4643
  this.state.reelForward = {
4458
4644
  error: this.state.nextPageError,
@@ -4461,14 +4647,16 @@ var Qr = 20, $r = class {
4461
4647
  return;
4462
4648
  }
4463
4649
  let n = this.state.next, r = this.state.items.length;
4464
- if (await this.options.replenishAfterRemoval(), this.state.nextPageError) {
4465
- this.state.reelForward = {
4466
- error: this.state.nextPageError,
4467
- status: "error"
4468
- };
4469
- return;
4470
- }
4650
+ if (await this.options.replenishAfterRemoval(), this.forward !== e || e.version !== this.forwardVersion) return;
4471
4651
  if (!this.state.items[e.postIndex]) {
4652
+ if (this.stopAtLock()) return;
4653
+ if (this.state.nextPageError) {
4654
+ this.state.reelForward = {
4655
+ error: this.state.nextPageError,
4656
+ status: "error"
4657
+ };
4658
+ return;
4659
+ }
4472
4660
  if (this.state.next === null) {
4473
4661
  this.state.reelForward = {
4474
4662
  error: null,
@@ -4486,7 +4674,7 @@ var Qr = 20, $r = class {
4486
4674
  }
4487
4675
  }
4488
4676
  }
4489
- }, ti = class {
4677
+ }, pi = class {
4490
4678
  generation = 0;
4491
4679
  pending = Promise.resolve();
4492
4680
  constructor(e) {
@@ -4536,24 +4724,24 @@ var Qr = 20, $r = class {
4536
4724
  };
4537
4725
  //#endregion
4538
4726
  //#region src/core/removalControllers.ts
4539
- function ni(e) {
4540
- let t = new ei(e), n = new ti({
4727
+ function mi(e) {
4728
+ let t = new fi(e), n = new pi({
4541
4729
  state: e.state,
4542
4730
  transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
4543
4731
  transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
4544
4732
  });
4545
4733
  return {
4546
- exactMediaRemoval: new Jr({
4734
+ exactMediaRemoval: new oi({
4547
4735
  onActivate: e.onActivate,
4548
4736
  onPostRemoved: (t) => e.onItemsRemoved([t]),
4549
4737
  onPostRestored: (t) => e.onItemsRestored([t]),
4550
4738
  reelForward: t,
4551
4739
  state: e.state
4552
4740
  }),
4553
- itemRemoval: new $r({
4741
+ itemRemoval: new di({
4554
4742
  historyLimit: e.historyLimit,
4555
4743
  onItemsRemoved: (n, r, i) => {
4556
- e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Gr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4744
+ e.onItemsRemoved(r.map(({ item: e }) => e.postId)), ri(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4557
4745
  },
4558
4746
  onRemovalRestored: (n) => {
4559
4747
  e.onItemsRestored(n.map(({ item: e }) => e.postId));
@@ -4568,17 +4756,17 @@ function ni(e) {
4568
4756
  reelRemoval: n
4569
4757
  };
4570
4758
  }
4571
- var ri = 1.5;
4572
- function ii(e) {
4759
+ var hi = 1.5;
4760
+ function gi(e) {
4573
4761
  let t = Math.min(e.screenWidth, e.screenHeight);
4574
4762
  if (t > 0 && t < 600) return !0;
4575
- let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * ri;
4763
+ let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * hi;
4576
4764
  return !e.hasHover && n > 0 && n < 600 && r;
4577
4765
  }
4578
- function ai(e) {
4579
- return ii(e) ? "reel" : "masonry";
4766
+ function _i(e) {
4767
+ return gi(e) ? "reel" : "masonry";
4580
4768
  }
4581
- function oi(e) {
4769
+ function vi(e) {
4582
4770
  let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
4583
4771
  return {
4584
4772
  hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
@@ -4588,15 +4776,15 @@ function oi(e) {
4588
4776
  viewportWidth: n.clientWidth
4589
4777
  };
4590
4778
  }
4591
- function si(e) {
4592
- return ii(oi(e));
4779
+ function yi(e) {
4780
+ return gi(vi(e));
4593
4781
  }
4594
- function ci(e) {
4595
- return ai(oi(e));
4782
+ function bi(e) {
4783
+ return _i(vi(e));
4596
4784
  }
4597
4785
  //#endregion
4598
4786
  //#region src/core/responsiveLayoutController.ts
4599
- var li = class {
4787
+ var xi = class {
4600
4788
  layoutMode;
4601
4789
  resizeObserver = null;
4602
4790
  target = null;
@@ -4621,13 +4809,13 @@ var li = class {
4621
4809
  }
4622
4810
  handleResponsiveLayout = () => {
4623
4811
  if (!this.target) return;
4624
- let e = ci(this.target);
4625
- this.state.phoneMode = si(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4812
+ let e = bi(this.target);
4813
+ this.state.phoneMode = yi(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
4626
4814
  };
4627
- }, ui = class {
4815
+ }, Si = class {
4628
4816
  state;
4629
4817
  constructor(e) {
4630
- this.options = e, this.state = x(Ot({
4818
+ this.options = e, this.state = x(Rt({
4631
4819
  ...e.initialReelAudioState,
4632
4820
  muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
4633
4821
  }));
@@ -4636,9 +4824,9 @@ var li = class {
4636
4824
  return { ...this.state };
4637
4825
  }
4638
4826
  set(e, t = !1) {
4639
- Object.assign(this.state, Ot(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
4827
+ Object.assign(this.state, Rt(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
4640
4828
  }
4641
- }, di = class {
4829
+ }, Ci = class {
4642
4830
  routedReelPostId = null;
4643
4831
  reelRouteIsActive = !1;
4644
4832
  constructor(e, t) {
@@ -4668,30 +4856,30 @@ var li = class {
4668
4856
  };
4669
4857
  //#endregion
4670
4858
  //#region src/core/updateItems.ts
4671
- function fi(e) {
4859
+ function wi(e) {
4672
4860
  return String(e);
4673
4861
  }
4674
- function pi(e, t) {
4862
+ function Ti(e, t) {
4675
4863
  let n = H(t).length;
4676
4864
  (e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
4677
4865
  }
4678
- function mi(e, t) {
4866
+ function Ei(e, t) {
4679
4867
  let n = /* @__PURE__ */ new Map();
4680
- if (t.forEach((e) => n.set(fi(e.postId), e)), n.size === 0) return [];
4868
+ if (t.forEach((e) => n.set(wi(e.postId), e)), n.size === 0) return [];
4681
4869
  let r = [], i = e.items.map((t) => {
4682
- let i = n.get(fi(t.postId));
4870
+ let i = n.get(wi(t.postId));
4683
4871
  if (!i) return t;
4684
4872
  let a = {
4685
4873
  ...i,
4686
4874
  postId: t.postId
4687
4875
  };
4688
- return pi(e, a), e.reelForwardItem && fi(e.reelForwardItem.postId) === fi(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
4876
+ return Ti(e, a), e.reelForwardItem && wi(e.reelForwardItem.postId) === wi(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
4689
4877
  });
4690
4878
  return r.length > 0 && (e.items = i), r;
4691
4879
  }
4692
4880
  //#endregion
4693
4881
  //#region src/core/createVibe.ts
4694
- var hi = class {
4882
+ var Di = class {
4695
4883
  app = null;
4696
4884
  autoScroll;
4697
4885
  autofillController;
@@ -4714,24 +4902,24 @@ var hi = class {
4714
4902
  reelAudio;
4715
4903
  state;
4716
4904
  constructor(e) {
4717
- this.options = e, Rr(e);
4905
+ this.options = e, Xr(e);
4718
4906
  let t = e.layout ?? "masonry";
4719
- this.state = x(Fr(e, t)), this.reelAudio = new ui(e), this.lastLoadedCursor = e.initialPage ? Mn(e.initialPage) : null, this.notificationItems = G(this.state), this.autoScroll = new ar({
4907
+ this.state = x(qr(e, t)), this.reelAudio = new Si(e), this.lastLoadedCursor = e.initialPage ? Wn(e.initialPage) : null, this.notificationItems = K(this.state), this.autoScroll = new _r({
4720
4908
  getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
4721
4909
  state: this.state.autoScroll
4722
- }), this.autofillController = new $n({
4910
+ }), this.autofillController = new dr({
4723
4911
  cancelRequest: () => this.cancelRequest(),
4724
4912
  onLastCursor: (e) => this.setCurrentCursor(e),
4725
4913
  onPages: (e) => this.removalReconciliation.recordPages(e),
4726
4914
  options: e.autofill,
4727
4915
  state: this.state
4728
- }), this.removalReconciliation = new Wr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Er({
4916
+ }), this.removalReconciliation = new ni(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Rr({
4729
4917
  fill: e.fill,
4730
4918
  loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
4731
4919
  needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
4732
4920
  onLastCursor: (e) => this.setCurrentCursor(e),
4733
4921
  onPages: (e) => this.removalReconciliation.recordPages(e),
4734
- prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Dr({
4922
+ prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => zr({
4735
4923
  controller: this.removalReconciliation,
4736
4924
  isCurrent: t,
4737
4925
  loadPage: e.loadPage,
@@ -4741,30 +4929,31 @@ var hi = class {
4741
4929
  state: this.state
4742
4930
  }),
4743
4931
  state: this.state
4744
- }), this.routing = new di(e.routing, this.state);
4745
- let n = ni({
4932
+ }), this.routing = new Ci(e.routing, this.state);
4933
+ let n = mi({
4746
4934
  historyLimit: e.removalHistoryLimit,
4747
4935
  onActivate: (e) => this.setActiveReelPost(e),
4936
+ onCloseReel: () => this.closeMasonryReel(),
4748
4937
  onItemsRemoved: (e) => this.removalReconciliation.remove(e),
4749
4938
  onItemsRestored: (e) => this.removalReconciliation.restore(e),
4750
4939
  replenishAfterRemoval: () => this.replenishAfterRemoval(),
4751
4940
  state: this.state,
4752
4941
  surface: () => this.surface
4753
4942
  });
4754
- this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new li(t, this.state, () => {
4943
+ this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new xi(t, this.state, () => {
4755
4944
  this.routing.syncFeed();
4756
4945
  }), this.startStateNotifications();
4757
4946
  }
4758
4947
  async mount() {
4759
4948
  if (this.app) throw Error("Vibe is already mounted.");
4760
4949
  this.startStateNotifications();
4761
- let e = zr(this.options.target);
4762
- this.responsiveLayout.mount(e), this.app = i(Dn, {
4950
+ let e = Zr(this.options.target);
4951
+ this.responsiveLayout.mount(e), this.app = i(zn, {
4763
4952
  canRetryEnd: !!this.options.loadPage,
4764
4953
  cardFooter: this.options.cardFooter,
4765
4954
  cardHeader: this.options.cardHeader,
4766
4955
  feedFooter: this.options.feedFooter,
4767
- feedFooterActions: Or(this),
4956
+ feedFooterActions: Br(this),
4768
4957
  mediaCard: this.options.mediaCard,
4769
4958
  masonry: this.options.masonry,
4770
4959
  onMediaFullyVisible: this.options.onMediaFullyVisible,
@@ -4790,7 +4979,7 @@ var hi = class {
4790
4979
  onRetryForward: () => {
4791
4980
  this.retryReelForward();
4792
4981
  }
4793
- }), this.surface = this.app.mount(e), this.autoScroll.mount(), await ur(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4982
+ }), this.surface = this.app.mount(e), this.autoScroll.mount(), await Sr(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4794
4983
  this.restoreController = e;
4795
4984
  }), !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();
4796
4985
  }
@@ -4798,7 +4987,7 @@ var hi = class {
4798
4987
  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;
4799
4988
  }
4800
4989
  getState() {
4801
- return te(this.state);
4990
+ return ee(this.state);
4802
4991
  }
4803
4992
  getReelAudioState() {
4804
4993
  return this.reelAudio.get();
@@ -4825,7 +5014,7 @@ var hi = class {
4825
5014
  return this.itemRemoval.restoreRemoval(e);
4826
5015
  }
4827
5016
  updateItems(e) {
4828
- return mi(this.state, e);
5017
+ return Ei(this.state, e);
4829
5018
  }
4830
5019
  retryReelForward() {
4831
5020
  return this.reelForward.retry();
@@ -4864,7 +5053,7 @@ var hi = class {
4864
5053
  this.autoScroll.setSpeed(e);
4865
5054
  }
4866
5055
  applyAutofillUpdate(e) {
4867
- let t = cr(this.options.autofill, this.state, e);
5056
+ let t = br(this.options.autofill, this.state, e);
4868
5057
  return t && this.autofillController.syncCountdown(), t;
4869
5058
  }
4870
5059
  cancelAutofill() {
@@ -4875,7 +5064,7 @@ var hi = class {
4875
5064
  await this.cancelFill();
4876
5065
  return;
4877
5066
  }
4878
- if (Yn(this.state.autofill)) {
5067
+ if (sr(this.state.autofill)) {
4879
5068
  await this.cancelAutofill();
4880
5069
  return;
4881
5070
  }
@@ -4889,12 +5078,12 @@ var hi = class {
4889
5078
  }
4890
5079
  async fill(e) {
4891
5080
  if (!this.state.loadMoreLocked) {
4892
- if (this.pendingRequest || Yn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
5081
+ if (this.pendingRequest || sr(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4893
5082
  await this.fillController.start(e);
4894
5083
  }
4895
5084
  }
4896
5085
  restoreAutofillSession(e) {
4897
- let t = lr(this.options.autofill, this.state, e);
5086
+ let t = xr(this.options.autofill, this.state, e);
4898
5087
  return t && this.autofillController.syncCountdown(), t;
4899
5088
  }
4900
5089
  restoreFillSession(e) {
@@ -4904,14 +5093,14 @@ var hi = class {
4904
5093
  return this.startLoadMore(() => this.loadNextSequence());
4905
5094
  }
4906
5095
  appendPage(e) {
4907
- Nn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
5096
+ Gn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4908
5097
  }
4909
5098
  replenishAfterRemoval() {
4910
5099
  return this.startLoadMore(() => this.replenishAfterRemovalSequence());
4911
5100
  }
4912
5101
  async startLoadMore(e) {
4913
5102
  if (this.pendingRequest) return this.pendingRequest;
4914
- if (this.state.loadMoreLocked || Yn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
5103
+ if (this.state.loadMoreLocked || sr(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4915
5104
  this.state.isLoadingMore = !0, this.state.nextPageError = null;
4916
5105
  let t = e();
4917
5106
  return this.pendingRequest = t, t.finally(() => {
@@ -4926,12 +5115,12 @@ var hi = class {
4926
5115
  }
4927
5116
  async replaceFeed(e, t) {
4928
5117
  if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
4929
- return Yn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Jn(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.surface?.resetMediaLifecycle(), 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);
5118
+ return sr(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = or(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.surface?.resetMediaLifecycle(), 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);
4930
5119
  }
4931
5120
  async loadFilteredPage(e) {
4932
5121
  let t = this.options.loadPage;
4933
5122
  if (!t) throw Error("Vibe cannot load a page without loadPage.");
4934
- let n = On(await t(e));
5123
+ let n = Bn(await t(e));
4935
5124
  return {
4936
5125
  ...n,
4937
5126
  items: this.removalReconciliation.filterItems(n.items)
@@ -4950,7 +5139,7 @@ var hi = class {
4950
5139
  let t = ++this.requestVersion, n = new AbortController();
4951
5140
  this.abortController = n;
4952
5141
  try {
4953
- let r = await Dr({
5142
+ let r = await zr({
4954
5143
  controller: this.removalReconciliation,
4955
5144
  isCurrent: () => t === this.requestVersion,
4956
5145
  loadPage: e,
@@ -4968,7 +5157,7 @@ var hi = class {
4968
5157
  }
4969
5158
  async retryEnd() {
4970
5159
  if (this.pendingRequest) return this.pendingRequest;
4971
- if (!this.state.loadMoreLocked && !(Yn(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);
5160
+ if (!this.state.loadMoreLocked && !(sr(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);
4972
5161
  }
4973
5162
  setInfiniteScroll(e) {
4974
5163
  this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
@@ -4992,10 +5181,10 @@ var hi = class {
4992
5181
  this.state.total = e;
4993
5182
  }
4994
5183
  setReelAutoAdvance(e) {
4995
- Mr(this.state.reelAutoAdvance, e);
5184
+ Wr(this.state.reelAutoAdvance, e);
4996
5185
  }
4997
5186
  setReelInfoSheet(e) {
4998
- Pr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
5187
+ Kr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4999
5188
  }
5000
5189
  setLayout(e) {
5001
5190
  this.responsiveLayout.setLayout(e);
@@ -5015,7 +5204,7 @@ var hi = class {
5015
5204
  async fetchPage(e, t) {
5016
5205
  if (!this.options.loadPage) return;
5017
5206
  let n = ++this.requestVersion, r = new AbortController();
5018
- this.abortController = r, await Br({
5207
+ this.abortController = r, await Qr({
5019
5208
  append: t,
5020
5209
  autofillController: this.autofillController,
5021
5210
  cursor: e,
@@ -5037,7 +5226,7 @@ var hi = class {
5037
5226
  startInitialAutofill() {
5038
5227
  let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
5039
5228
  this.abortController = t, this.state.isLoadingMore = !0;
5040
- let r = dr({
5229
+ let r = Cr({
5041
5230
  cycleId: n,
5042
5231
  isCurrent: () => e === this.requestVersion,
5043
5232
  onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
@@ -5055,17 +5244,11 @@ var hi = class {
5055
5244
  }
5056
5245
  startStateNotifications() {
5057
5246
  let e = this.options.onStateChange;
5058
- !e || this.stopStateWatcher || (e(te(this.state, this.notificationItems.value)), this.stopStateWatcher = O(this.state, () => e(te(this.state, this.notificationItems.value)), {
5059
- deep: !0,
5060
- flush: "post"
5061
- }));
5247
+ !e || this.stopStateWatcher || (e(ee(this.state, this.notificationItems.value)), this.stopStateWatcher = O(() => ee(this.state, this.notificationItems.value), (t) => e(t), { flush: "post" }));
5062
5248
  }
5063
5249
  setCurrentCursor(e) {
5064
5250
  this.lastLoadedCursor = e, this.state.current = e;
5065
5251
  }
5066
- };
5067
- function gi(e) {
5068
- return new hi(e);
5069
- }
5252
+ }, Oi = (e) => new Di(e);
5070
5253
  //#endregion
5071
- export { gi as createVibe };
5254
+ export { Oi as createVibe };