@wyxos/vibe 5.10.1 → 5.12.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
@@ -48,7 +48,7 @@ function B(e) {
48
48
  type: "image"
49
49
  };
50
50
  }
51
- function ee(e, t) {
51
+ function V(e, t) {
52
52
  return I(e.type, e.src) === "audio" ? t === "mobile" && e.mobile && I(e.mobile.type, e.mobile.src) === "audio" ? {
53
53
  ...e.mobile,
54
54
  type: "audio"
@@ -57,14 +57,14 @@ function ee(e, t) {
57
57
  type: "audio"
58
58
  } : z(e, t);
59
59
  }
60
- function V(e) {
60
+ function H(e) {
61
61
  return [e, ...e.items];
62
62
  }
63
- function H(e, t) {
63
+ function ee(e, t) {
64
64
  return Math.min(e.items.length, Math.max(0, t));
65
65
  }
66
66
  function U(e, t) {
67
- return V(e)[H(e, t)] ?? e;
67
+ return H(e)[ee(e, t)] ?? e;
68
68
  }
69
69
  function W(e, t) {
70
70
  return `${String(e)}:${t}`;
@@ -111,10 +111,10 @@ var K = {
111
111
  key: 0,
112
112
  class: "load-more-status",
113
113
  role: "status"
114
- }, ne = ["disabled"], J = {
114
+ }, ne = ["disabled"], re = {
115
115
  key: 2,
116
116
  class: "end-feed"
117
- }, re = ["disabled"], Y = /* @__PURE__ */ d({
117
+ }, J = ["disabled"], ie = /* @__PURE__ */ d({
118
118
  __name: "GalleryFooter",
119
119
  props: {
120
120
  canRetryEnd: { type: Boolean },
@@ -137,7 +137,7 @@ var K = {
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", J, [n[1] ||= c("p", {
140
+ }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, ne)) : (b(), s("div", re, [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,9 +146,9 @@ 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, re)]))])) : o("", !0);
149
+ }, " Check for more ", 8, J)]))])) : o("", !0);
150
150
  }
151
- }), ie = /* @__PURE__ */ d({
151
+ }), ae = /* @__PURE__ */ d({
152
152
  __name: "FeedFooter",
153
153
  props: {
154
154
  actions: {},
@@ -185,7 +185,7 @@ var K = {
185
185
  "can-retry-end",
186
186
  "show-load-more",
187
187
  "state"
188
- ])) : (b(), a(Y, {
188
+ ])) : (b(), a(ie, {
189
189
  key: 1,
190
190
  "can-retry-end": e.canRetryEnd,
191
191
  "has-error": e.hasError,
@@ -204,7 +204,7 @@ var K = {
204
204
  "show-load-more"
205
205
  ]));
206
206
  }
207
- }), ae = ["role"], X = { class: "gallery-status" }, oe = /* @__PURE__ */ d({
207
+ }), oe = ["role"], Y = { class: "gallery-status" }, se = /* @__PURE__ */ d({
208
208
  __name: "FeedStatus",
209
209
  props: {
210
210
  actions: {},
@@ -218,7 +218,7 @@ var K = {
218
218
  return (n, u) => (b(), s("main", {
219
219
  class: "gallery-shell",
220
220
  role: r.state.error ? "alert" : r.state.isLoading || r.state.isLoadingMore ? "status" : void 0
221
- }, [c("p", X, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading || r.state.isLoadingMore ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(ie, {
221
+ }, [c("p", Y, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading || r.state.isLoadingMore ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(ae, {
222
222
  key: 0,
223
223
  actions: t.actions,
224
224
  "can-retry-end": t.canRetryEnd,
@@ -240,32 +240,44 @@ var K = {
240
240
  "is-loading",
241
241
  "load-more-locked",
242
242
  "state"
243
- ])) : o("", !0)], 8, ae));
243
+ ])) : o("", !0)], 8, oe));
244
244
  }
245
245
  });
246
- function se(e) {
246
+ function ce(e) {
247
247
  return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
248
248
  }
249
249
  //#endregion
250
250
  //#region src/core/masonry.ts
251
- function Z(e) {
251
+ function X(e) {
252
252
  let t = e.preview?.width ?? e.width, n = e.preview?.height ?? e.height;
253
253
  return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
254
254
  }
255
- function ce(e) {
255
+ function Z(e) {
256
256
  return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
257
257
  }
258
258
  function le(e) {
259
259
  return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
260
260
  }
261
- function ue(e, t, n) {
261
+ var ue = .8, de = .5;
262
+ function fe(e, t, n) {
263
+ let r = Math.max(0, n.viewportHeight);
264
+ if (r === 0) return [];
265
+ let i = n.scrollTop, a = i + r;
266
+ return t.filter((t) => {
267
+ let n = e[t];
268
+ if (!n || n.height <= 0) return !1;
269
+ let o = Math.max(0, Math.min(n.y + n.height, a) - Math.max(n.y, i)), s = n.height <= r ? n.height : r * ue;
270
+ return o + de >= s;
271
+ });
272
+ }
273
+ function Q(e, t, n) {
262
274
  if (t <= 0 || e.length === 0) return {
263
275
  columns: 0,
264
276
  height: 0,
265
277
  items: []
266
278
  };
267
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) => {
268
- let t = ce(c), n = s * Z(e) + i, a = {
280
+ let t = Z(c), n = s * X(e) + i, a = {
269
281
  x: t * (s + r),
270
282
  y: c[t],
271
283
  width: s,
@@ -281,7 +293,7 @@ function ue(e, t, n) {
281
293
  }
282
294
  //#endregion
283
295
  //#region src/core/masonryViewportIndex.ts
284
- function de(e, t) {
296
+ function pe(e, t) {
285
297
  let n = /* @__PURE__ */ new Map();
286
298
  return e.forEach((e, r) => {
287
299
  let i = n.get(e.x) ?? [];
@@ -292,25 +304,25 @@ function de(e, t) {
292
304
  }), n.set(e.x, i);
293
305
  }), { columns: [...n.entries()].sort(([e], [t]) => e - t).map(([, e]) => e.sort((e, t) => e.top - t.top || e.index - t.index)) };
294
306
  }
295
- function fe(e, t) {
307
+ function me(e, t) {
296
308
  let n = 0, r = 0, i = e.length;
297
309
  for (; r < i;) {
298
310
  let a = Math.floor((r + i) / 2);
299
- n += 1, e[a].bottom < t ? r = a + 1 : i = a;
311
+ n += 1, e[a].bottom <= t ? r = a + 1 : i = a;
300
312
  }
301
313
  return {
302
314
  index: r,
303
315
  inspected: n
304
316
  };
305
317
  }
306
- function Q(e, t) {
318
+ function he(e, t) {
307
319
  let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n, a = [], o = 0;
308
320
  return e.columns.forEach((e) => {
309
- let t = fe(e, r);
321
+ let t = me(e, r);
310
322
  o += t.inspected;
311
323
  for (let n = t.index; n < e.length; n += 1) {
312
324
  let t = e[n];
313
- if (o += 1, t.top > i) break;
325
+ if (o += 1, t.top >= i) break;
314
326
  a.push(t.index);
315
327
  }
316
328
  }), {
@@ -318,14 +330,14 @@ function Q(e, t) {
318
330
  inspected: o
319
331
  };
320
332
  }
321
- function pe(e) {
333
+ function ge(e) {
322
334
  return e?.minColumnWidth ?? 240;
323
335
  }
324
- function me(e, t) {
336
+ function _e(e, t) {
325
337
  let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
326
338
  return a === void 0 ? i : Math.min(i, a);
327
339
  }
328
- function he(e) {
340
+ function ve(e) {
329
341
  if (e?.minColumnWidth !== void 0 && (!Number.isFinite(e.minColumnWidth) || e.minColumnWidth <= 0)) throw TypeError("Vibe masonry minColumnWidth must be a positive number.");
330
342
  let t = e?.overscan;
331
343
  if (t) {
@@ -339,10 +351,10 @@ function he(e) {
339
351
  }
340
352
  //#endregion
341
353
  //#region src/core/scrollbar.ts
342
- function ge(e, t, n) {
354
+ function ye(e, t, n) {
343
355
  return Math.min(n, Math.max(t, e));
344
356
  }
345
- function _e({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
357
+ function be({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
346
358
  let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
347
359
  if (!(c > 0 && o > 0)) return {
348
360
  maximumScrollPosition: c,
@@ -351,23 +363,23 @@ function _e({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
351
363
  thumbSize: o,
352
364
  thumbTravel: 0
353
365
  };
354
- let l = ge(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
366
+ let l = ye(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
355
367
  return {
356
368
  maximumScrollPosition: c,
357
369
  scrollable: !0,
358
- thumbOffset: u * (ge(n, 0, c) / c),
370
+ thumbOffset: u * (ye(n, 0, c) / c),
359
371
  thumbSize: l,
360
372
  thumbTravel: u
361
373
  };
362
374
  }
363
375
  //#endregion
364
376
  //#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
365
- var ve = ["aria-hidden"], ye = [
377
+ var xe = ["aria-hidden"], Se = [
366
378
  "aria-controls",
367
379
  "aria-valuemax",
368
380
  "aria-valuenow",
369
381
  "tabindex"
370
- ], be = 32, xe = 40, Se = 120, Ce = /* @__PURE__ */ d({
382
+ ], Ce = 32, we = 40, Te = 120, Ee = /* @__PURE__ */ d({
371
383
  __name: "GalleryScrollbar",
372
384
  props: {
373
385
  contentSize: {},
@@ -389,16 +401,16 @@ var ve = ["aria-hidden"], ye = [
389
401
  function k() {
390
402
  g !== null && clearTimeout(g), g = setTimeout(() => {
391
403
  g = null, o.value || (l.value = !1);
392
- }, Se);
404
+ }, Te);
393
405
  }
394
406
  function A() {
395
407
  l.value = !0, k();
396
408
  }
397
409
  function j() {
398
410
  let e = t.scrollElement, r = i.value;
399
- return !e || !r ? n : _e({
411
+ return !e || !r ? n : be({
400
412
  contentSize: e.scrollHeight,
401
- minimumThumbSize: be,
413
+ minimumThumbSize: Ce,
402
414
  scrollPosition: e.scrollTop,
403
415
  trackSize: r.clientHeight,
404
416
  viewportSize: e.clientHeight
@@ -451,7 +463,7 @@ var ve = ["aria-hidden"], ye = [
451
463
  }
452
464
  function z(e) {
453
465
  if (!E.value) return;
454
- let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - xe : e.key === "ArrowDown" ? r + xe : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
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;
455
467
  i !== null && (e.preventDefault(), A(), P(i));
456
468
  }
457
469
  function B(e) {
@@ -497,15 +509,15 @@ var ve = ["aria-hidden"], ye = [
497
509
  onPointerdown: I,
498
510
  onPointermove: L,
499
511
  onPointerup: R
500
- }, null, 44, ye)], 42, ve));
512
+ }, null, 44, Se)], 42, xe));
501
513
  }
502
- }), we = (e) => {
514
+ }), De = (e) => {
503
515
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
504
516
  return !1;
505
- }, Te = (e) => e === "", Ee = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), De = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Oe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ke = (e) => {
506
- let t = Oe(e);
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);
507
519
  return t.charAt(0).toUpperCase() + t.slice(1);
508
- }, Ae = {
520
+ }, Ne = {
509
521
  xmlns: "http://www.w3.org/2000/svg",
510
522
  width: 24,
511
523
  height: 24,
@@ -515,27 +527,27 @@ var ve = ["aria-hidden"], ye = [
515
527
  "stroke-width": 2,
516
528
  "stroke-linecap": "round",
517
529
  "stroke-linejoin": "round"
518
- }, je = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = Ae.width, color: s = Ae.stroke, ...c }, { slots: l }) => p("svg", {
519
- ...Ae,
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,
520
532
  ...c,
521
533
  width: o,
522
534
  height: o,
523
535
  stroke: s,
524
- "stroke-width": Te(n) || Te(r) || n === !0 || r === !0 ? Number(i || a || Ae["stroke-width"]) * 24 / Number(o) : i || a || Ae["stroke-width"],
525
- class: Ee("lucide", c.class, ...e ? [`lucide-${De(ke(e))}-icon`, `lucide-${De(e)}`] : ["lucide-icon"]),
526
- ...!l.default && !we(c) && { "aria-hidden": "true" }
527
- }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), Me = (e, t) => (n, { slots: r, attrs: i }) => p(je, {
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, {
528
540
  ...i,
529
541
  ...n,
530
542
  iconNode: t,
531
543
  name: e
532
- }, r), Ne = Me("chevron-left", [["path", {
544
+ }, r), Ie = Fe("chevron-left", [["path", {
533
545
  d: "m15 18-6-6 6-6",
534
546
  key: "1wnfg3"
535
- }]]), Pe = Me("chevron-right", [["path", {
547
+ }]]), Le = Fe("chevron-right", [["path", {
536
548
  d: "m9 18 6-6-6-6",
537
549
  key: "mthhwq"
538
- }]]), Fe = Me("disc-3", [
550
+ }]]), Re = Fe("disc-3", [
539
551
  ["circle", {
540
552
  cx: "12",
541
553
  cy: "12",
@@ -556,7 +568,7 @@ var ve = ["aria-hidden"], ye = [
556
568
  d: "M18 12c0 1.7-.7 3.2-1.8 4.2",
557
569
  key: "1eah9h"
558
570
  }]
559
- ]), Ie = Me("pause", [["rect", {
571
+ ]), ze = Fe("pause", [["rect", {
560
572
  x: "14",
561
573
  y: "3",
562
574
  width: "5",
@@ -570,10 +582,10 @@ var ve = ["aria-hidden"], ye = [
570
582
  height: "18",
571
583
  rx: "1",
572
584
  key: "1wsw3u"
573
- }]]), Le = Me("play", [["path", {
585
+ }]]), Be = Fe("play", [["path", {
574
586
  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",
575
587
  key: "10ikf1"
576
- }]]), Re = Me("volume-2", [
588
+ }]]), Ve = Fe("volume-2", [
577
589
  ["path", {
578
590
  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",
579
591
  key: "uqj9uw"
@@ -586,7 +598,7 @@ var ve = ["aria-hidden"], ye = [
586
598
  d: "M19.364 18.364a9 9 0 0 0 0-12.728",
587
599
  key: "ijwkga"
588
600
  }]
589
- ]), ze = Me("volume-x", [
601
+ ]), He = Fe("volume-x", [
590
602
  ["path", {
591
603
  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",
592
604
  key: "uqj9uw"
@@ -605,22 +617,22 @@ var ve = ["aria-hidden"], ye = [
605
617
  y2: "15",
606
618
  key: "5ykzw1"
607
619
  }]
608
- ]), Be = {
620
+ ]), Ue = {
609
621
  401: "Authentication required",
610
622
  403: "Access forbidden",
611
623
  404: "Preview not found",
612
624
  419: "Session expired",
613
625
  500: "Server error"
614
626
  };
615
- function Ve(e) {
627
+ function We(e) {
616
628
  return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
617
629
  }
618
- function He(e) {
619
- return Be[Ve(e)] ?? "Preview unavailable";
630
+ function Ge(e) {
631
+ return Ue[We(e)] ?? "Preview unavailable";
620
632
  }
621
633
  //#endregion
622
634
  //#region src/components/CardRegion.vue
623
- var Ue = /* @__PURE__ */ d({
635
+ var Ke = /* @__PURE__ */ d({
624
636
  __name: "CardRegion",
625
637
  props: {
626
638
  index: {},
@@ -635,7 +647,7 @@ var Ue = /* @__PURE__ */ d({
635
647
  total: {}
636
648
  },
637
649
  setup(e) {
638
- let t = e, n = r(() => H(t.item, t.mediaIndex)), i = r(() => V(t.item)), o = r(() => U(t.item, n.value)), c = r(() => ({
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(() => ({
639
651
  height: `${t.region.height}px`,
640
652
  paddingBlock: t.style?.paddingY === void 0 ? void 0 : `${t.style.paddingY}px`,
641
653
  paddingInline: t.style?.paddingX === void 0 ? void 0 : `${t.style.paddingX}px`
@@ -667,7 +679,7 @@ var Ue = /* @__PURE__ */ d({
667
679
  "total"
668
680
  ]))], 38));
669
681
  }
670
- }), We = ["aria-busy", "aria-label"], Ge = { class: "media-error-code" }, Ke = ["disabled"], qe = /* @__PURE__ */ d({
682
+ }), qe = ["aria-busy", "aria-label"], Je = { class: "media-error-code" }, Ye = ["disabled"], Xe = /* @__PURE__ */ d({
671
683
  __name: "MediaError",
672
684
  props: {
673
685
  component: {},
@@ -702,7 +714,7 @@ var Ue = /* @__PURE__ */ d({
702
714
  "retrying",
703
715
  "status"
704
716
  ]))], 32)) : (b(), s(e, { key: 1 }, [
705
- c("strong", Ge, T(t.status), 1),
717
+ c("strong", Je, T(t.status), 1),
706
718
  c("span", null, T(t.label), 1),
707
719
  c("button", {
708
720
  "data-test": "media-retry",
@@ -711,26 +723,26 @@ var Ue = /* @__PURE__ */ d({
711
723
  disabled: t.retrying,
712
724
  onClick: j(o, ["stop"]),
713
725
  onKeydown: r[2] ||= j(() => {}, ["stop"])
714
- }, T(t.retrying ? "Retrying…" : "Retry"), 41, Ke)
715
- ], 64))], 8, We));
726
+ }, T(t.retrying ? "Retrying…" : "Retry"), 41, Ye)
727
+ ], 64))], 8, qe));
716
728
  }
717
- }), Je = ["aria-label"], Ye = [
729
+ }), Ze = ["aria-label"], Qe = [
718
730
  "max",
719
731
  "value",
720
732
  "aria-label",
721
733
  "aria-valuetext",
722
734
  "disabled"
723
- ], Xe = {
735
+ ], $e = {
724
736
  key: 0,
725
737
  class: "media-controls-row"
726
- }, Ze = ["aria-label", "title"], Qe = { class: "media-controls-audio" }, $e = ["aria-label", "title"], et = [
738
+ }, et = ["aria-label", "title"], tt = { class: "media-controls-audio" }, nt = ["aria-label", "title"], rt = [
727
739
  "value",
728
740
  "aria-label",
729
741
  "aria-valuetext"
730
- ], tt = {
742
+ ], it = {
731
743
  class: "media-control-time",
732
744
  "aria-live": "off"
733
- }, nt = /* @__PURE__ */ d({
745
+ }, at = /* @__PURE__ */ d({
734
746
  __name: "MediaControls",
735
747
  props: {
736
748
  currentTime: {},
@@ -780,35 +792,35 @@ var Ue = /* @__PURE__ */ d({
780
792
  "aria-valuetext": `${u(g.value)} of ${u(f.value)}`,
781
793
  disabled: f.value <= 0,
782
794
  onInput: n[0] ||= (e) => i("seek", d(e))
783
- }, null, 44, Ye), e.layout === "reel" ? (b(), s("div", Xe, [
795
+ }, null, 44, Qe), e.layout === "reel" ? (b(), s("div", $e, [
784
796
  c("button", {
785
797
  type: "button",
786
798
  class: "media-control-button media-control-playback",
787
799
  "aria-label": e.playing ? `Pause ${p.value}` : `Play ${p.value}`,
788
800
  title: e.playing ? "Pause" : "Play",
789
801
  onClick: n[1] ||= (e) => i("togglePlayback")
790
- }, [e.playing ? (b(), a(E(Ie), {
802
+ }, [e.playing ? (b(), a(E(ze), {
791
803
  key: 0,
792
804
  size: 18,
793
805
  fill: "currentColor"
794
- })) : (b(), a(E(Le), {
806
+ })) : (b(), a(E(Be), {
795
807
  key: 1,
796
808
  size: 18,
797
809
  fill: "currentColor"
798
- }))], 8, Ze),
799
- c("div", Qe, [c("button", {
810
+ }))], 8, et),
811
+ c("div", tt, [c("button", {
800
812
  type: "button",
801
813
  class: "media-control-button",
802
814
  "aria-label": e.muted ? `Unmute ${p.value}` : `Mute ${p.value}`,
803
815
  title: e.muted ? "Unmute" : "Mute",
804
816
  onClick: n[2] ||= (e) => i("toggleMute")
805
- }, [e.muted || e.volume === 0 ? (b(), a(E(ze), {
817
+ }, [e.muted || e.volume === 0 ? (b(), a(E(He), {
806
818
  key: 0,
807
819
  size: 18
808
- })) : (b(), a(E(Re), {
820
+ })) : (b(), a(E(Ve), {
809
821
  key: 1,
810
822
  size: 18
811
- }))], 8, $e), c("input", {
823
+ }))], 8, nt), c("input", {
812
824
  class: "media-control-range media-control-volume",
813
825
  type: "range",
814
826
  min: "0",
@@ -819,15 +831,15 @@ var Ue = /* @__PURE__ */ d({
819
831
  "aria-label": `${m.value} volume`,
820
832
  "aria-valuetext": `${Math.round(e.volume * 100)} percent`,
821
833
  onInput: n[3] ||= (e) => i("volumeChange", d(e))
822
- }, null, 44, et)]),
823
- c("output", tt, T(u(g.value)) + " / " + T(u(f.value)), 1)
824
- ])) : o("", !0)], 42, Je));
834
+ }, null, 44, rt)]),
835
+ c("output", it, T(u(g.value)) + " / " + T(u(f.value)), 1)
836
+ ])) : o("", !0)], 42, Ze));
825
837
  }
826
- }), rt = {
838
+ }), ot = {
827
839
  key: 0,
828
840
  class: "media-card-overlay-host",
829
841
  "data-test": "media-card-overlay"
830
- }, it = /* @__PURE__ */ d({
842
+ }, st = /* @__PURE__ */ d({
831
843
  __name: "MediaContextOverlay",
832
844
  props: {
833
845
  item: {},
@@ -837,7 +849,7 @@ var Ue = /* @__PURE__ */ d({
837
849
  mediaSource: {}
838
850
  },
839
851
  setup(e) {
840
- return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div", rt, [(b(), a(C(e.mediaCard.overlay.component), {
852
+ return (t, n) => e.mediaCard?.overlay?.component ? (b(), s("div", ot, [(b(), a(C(e.mediaCard.overlay.component), {
841
853
  item: e.item,
842
854
  "media-index": e.mediaIndex,
843
855
  "media-item": e.mediaItem,
@@ -849,26 +861,26 @@ var Ue = /* @__PURE__ */ d({
849
861
  "media-source"
850
862
  ]))])) : o("", !0);
851
863
  }
852
- }), at = 40, ot = 160, st = 24;
853
- function ct(e) {
864
+ }), ct = 40, lt = 160, ut = 24;
865
+ function dt(e) {
854
866
  let t = w("next"), n = null, r = 0, i = !1, a = null, o = null;
855
867
  function s(n, r) {
856
- let i = V(e.item()).length, a = (n + i) % i;
868
+ let i = H(e.item()).length, a = (n + i) % i;
857
869
  a !== e.mediaIndex() && (t.value = n < e.mediaIndex() ? "previous" : "next", e.onChange(a), r?.detail && r.detail > 0 && r.currentTarget?.blur());
858
870
  }
859
871
  function c() {
860
872
  r = 0, i = !1, n !== null && clearTimeout(n), n = null;
861
873
  }
862
874
  function l() {
863
- n !== null && clearTimeout(n), n = setTimeout(c, ot);
875
+ n !== null && clearTimeout(n), n = setTimeout(c, lt);
864
876
  }
865
877
  function u(e, t, n) {
866
878
  return t === 1 ? e * 16 : t === 2 ? e * n : e;
867
879
  }
868
880
  function d(t) {
869
- if (V(e.item()).length <= 1) return;
881
+ if (H(e.item()).length <= 1) return;
870
882
  let n = t.currentTarget, a = u(t.deltaX, t.deltaMode, n?.clientWidth || 1);
871
- if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < st)) return;
883
+ if (a === 0 || (t.preventDefault(), l(), i) || (r += a, Math.abs(r) < ut)) return;
872
884
  let o = Math.sign(r);
873
885
  r = 0, i = !0, s(e.mediaIndex() + o);
874
886
  }
@@ -880,7 +892,7 @@ function ct(e) {
880
892
  let n = t.changedTouches[0];
881
893
  if (a === null || o === null || !n) return;
882
894
  let r = a - n.clientX, i = o - n.clientY;
883
- a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < at || s(e.mediaIndex() + Math.sign(r)));
895
+ a = null, o = null, !(Math.abs(r) <= Math.abs(i)) && (Math.abs(r) < ct || s(e.mediaIndex() + Math.sign(r)));
884
896
  }
885
897
  return v(c), {
886
898
  change: s,
@@ -890,14 +902,14 @@ function ct(e) {
890
902
  onWheel: d
891
903
  };
892
904
  }
893
- var lt = /* @__PURE__ */ new Map(), ut = [], dt = 0, ft = 0;
894
- function pt(e, t) {
905
+ var ft = /* @__PURE__ */ new Map(), pt = [], mt = 0, ht = 0;
906
+ function gt(e, t) {
895
907
  return `${t ? "timed" : "image"}:${e}`;
896
908
  }
897
- function mt(e, t, n) {
898
- let r = V(e);
909
+ function _t(e, t, n) {
910
+ let r = H(e);
899
911
  if (r.length < 2) return [];
900
- let i = H(e, t), a = [];
912
+ let i = ee(e, t), a = [];
901
913
  for (let e = 1; e < r.length; e += 1) {
902
914
  let t = i + e, n = i - e;
903
915
  t < r.length && a.push(t), n >= 0 && a.push(n);
@@ -908,7 +920,7 @@ function mt(e, t, n) {
908
920
  if (!t) return [];
909
921
  let i = I(t.type, t.src) === "audio" ? B(t) : z(t, n);
910
922
  if (!i) return [];
911
- let a = L(i.type, i.src), s = pt(i.src, a);
923
+ let a = L(i.type, i.src), s = gt(i.src, a);
912
924
  return o.has(s) ? [] : (o.add(s), [{
913
925
  key: s,
914
926
  src: i.src,
@@ -916,22 +928,22 @@ function mt(e, t, n) {
916
928
  }]);
917
929
  });
918
930
  }
919
- function ht(e) {
931
+ function vt(e) {
920
932
  let t = e.element;
921
933
  e.element = null, t && (t instanceof HTMLVideoElement ? (t.pause(), t.removeAttribute("src"), t.load()) : t.removeAttribute("src"));
922
934
  }
923
- function gt(e) {
924
- lt.delete(e.key);
925
- let t = ut.indexOf(e);
926
- t >= 0 && ut.splice(t, 1), e.cancel?.(), e.cancel = null, ht(e);
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);
927
939
  }
928
- function _t(e) {
929
- e.state = "loading", dt += 1, e.timed && (ft += 1);
940
+ function bt(e) {
941
+ e.state = "loading", mt += 1, e.timed && (ht += 1);
930
942
  let t = !1, n = () => void 0, r = (r) => {
931
- t || (t = !0, n(), --dt, e.timed && --ft, e.cancel = null, e.state = r, r === "failed" && ht(e), e.refs === 0 && gt(e), vt());
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());
932
944
  };
933
945
  if (e.cancel = () => {
934
- t || (t = !0, n(), --dt, e.timed && --ft, ht(e), vt());
946
+ t || (t = !0, n(), --mt, e.timed && --ht, vt(e), xt());
935
947
  }, e.timed) {
936
948
  let t = document.createElement("video"), i = () => r("ready"), a = () => r("failed");
937
949
  n = () => {
@@ -950,38 +962,38 @@ function _t(e) {
950
962
  i.removeEventListener("load", a), i.removeEventListener("error", o);
951
963
  }, 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;
952
964
  }
953
- function vt() {
954
- for (; dt < 6;) {
955
- let e = ut.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || ft < 2));
965
+ function xt() {
966
+ for (; mt < 6;) {
967
+ let e = pt.findIndex((e) => e.refs > 0 && e.state === "queued" && (!e.timed || ht < 2));
956
968
  if (e < 0) return;
957
- let [t] = ut.splice(e, 1);
958
- t && _t(t);
969
+ let [t] = pt.splice(e, 1);
970
+ t && bt(t);
959
971
  }
960
972
  }
961
- function yt(e) {
962
- let t = lt.get(e.key);
973
+ function St(e) {
974
+ let t = ft.get(e.key);
963
975
  t || (t = {
964
976
  ...e,
965
977
  cancel: null,
966
978
  element: null,
967
979
  refs: 0,
968
980
  state: "queued"
969
- }, lt.set(t.key, t), ut.push(t)), t.refs += 1, vt();
981
+ }, ft.set(t.key, t), pt.push(t)), t.refs += 1, xt();
970
982
  let n = !1;
971
983
  return () => {
972
- n || (n = !0, --t.refs, t.refs === 0 && gt(t));
984
+ n || (n = !0, --t.refs, t.refs === 0 && yt(t));
973
985
  };
974
986
  }
975
987
  //#endregion
976
988
  //#region src/components/useVisiblePostPreload.ts
977
- function bt(e) {
978
- let t = r(() => e.layout() === "masonry" && e.inViewport() && e.mediaReady() && e.mediaCard()?.feedPreload === "visible-post"), n = r(() => t.value ? mt(e.item(), e.mediaIndex(), e.mediaSource()) : []), i = /* @__PURE__ */ new Map();
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();
979
991
  function a() {
980
992
  let e = new Map(n.value.map((e) => [e.key, e]));
981
993
  i.forEach((t, n) => {
982
994
  e.has(n) || (t(), i.delete(n));
983
995
  }), n.value.forEach((e) => {
984
- i.has(e.key) || i.set(e.key, yt(e));
996
+ i.has(e.key) || i.set(e.key, St(e));
985
997
  });
986
998
  }
987
999
  O(() => n.value.map(({ key: e }) => e).join("\n"), a, { immediate: !0 }), v(() => {
@@ -990,7 +1002,7 @@ function bt(e) {
990
1002
  }
991
1003
  //#endregion
992
1004
  //#region src/components/useMediaLoading.ts
993
- function xt(e) {
1005
+ function wt(e) {
994
1006
  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");
995
1007
  return O(i, (t, n) => {
996
1008
  n !== "none" || t === "none" || m(() => e.mediaElement.value?.load());
@@ -1002,7 +1014,7 @@ function xt(e) {
1002
1014
  }
1003
1015
  //#endregion
1004
1016
  //#region src/components/useMediaReadiness.ts
1005
- function St(e) {
1017
+ function Tt(e) {
1006
1018
  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());
1007
1019
  function f() {
1008
1020
  l !== null && clearTimeout(l), l = null;
@@ -1060,30 +1072,30 @@ function St(e) {
1060
1072
  }
1061
1073
  //#endregion
1062
1074
  //#region src/core/reelAudio.ts
1063
- var Ct = {
1075
+ var Et = {
1064
1076
  lastAudibleVolume: 1,
1065
1077
  muted: !1,
1066
1078
  volume: 1
1067
1079
  };
1068
- function wt(e, t) {
1080
+ function Dt(e, t) {
1069
1081
  return typeof e == "number" && Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : t;
1070
1082
  }
1071
- function Tt(e, t = Ct) {
1072
- let n = wt(e?.volume, t.volume), r = wt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
1083
+ function Ot(e, t = Et) {
1084
+ let n = Dt(e?.volume, t.volume), r = Dt(e?.lastAudibleVolume, n > 0 ? n : t.lastAudibleVolume);
1073
1085
  return {
1074
- lastAudibleVolume: r > 0 ? r : Ct.lastAudibleVolume,
1086
+ lastAudibleVolume: r > 0 ? r : Et.lastAudibleVolume,
1075
1087
  muted: typeof e?.muted == "boolean" ? e.muted : n === 0 || t.muted,
1076
1088
  volume: n
1077
1089
  };
1078
1090
  }
1079
1091
  //#endregion
1080
1092
  //#region src/components/useMediaCardAudio.ts
1081
- function Et(e) {
1082
- let t = Tt(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;
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;
1083
1095
  function o() {
1084
1096
  let t = e.mediaElement.value, n = e.reelAudioState();
1085
1097
  if (!t || e.layout() !== "reel" || !n) return;
1086
- let o = Tt(n);
1098
+ let o = Ot(n);
1087
1099
  a = o.lastAudibleVolume, i.value = o.volume, r.value = o.muted, t.volume = o.volume, t.muted = e.active() === !1 ? !0 : o.muted;
1088
1100
  }
1089
1101
  function s(e, t) {
@@ -1091,7 +1103,7 @@ function Et(e) {
1091
1103
  }
1092
1104
  function c(t) {
1093
1105
  if (e.layout() !== "reel") return;
1094
- let n = Tt({
1106
+ let n = Ot({
1095
1107
  lastAudibleVolume: a,
1096
1108
  muted: t.muted,
1097
1109
  volume: t.volume
@@ -1126,8 +1138,8 @@ function Et(e) {
1126
1138
  }
1127
1139
  //#endregion
1128
1140
  //#region src/components/useReelVideoActivity.ts
1129
- function Dt(e) {
1130
- let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.mediaIsMuted.value : !0);
1141
+ function At(e) {
1142
+ let t = r(() => e.layout() === "reel" ? e.active() === !0 : e.inViewport()), n = r(() => t.value ? e.mediaIsMuted.value : !0);
1131
1143
  function i() {
1132
1144
  if (!t.value) {
1133
1145
  e.mediaElement.value?.pause(), e.mediaIsPlaying.value = !1;
@@ -1160,19 +1172,20 @@ function Dt(e) {
1160
1172
  }
1161
1173
  //#endregion
1162
1174
  //#region src/components/useTimedMediaCard.ts
1163
- function Ot(e) {
1175
+ function jt(e) {
1164
1176
  return Number.isFinite(e) ? Math.max(0, e) : 0;
1165
1177
  }
1166
- function kt(e) {
1167
- let t = w(0), n = w(0), r = w(!1), { apply: i, setVolume: a, sync: o, toggleMute: s, videoIsMuted: c, videoVolume: l } = Et({
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({
1168
1180
  active: e.active,
1169
1181
  layout: e.layout,
1170
1182
  mediaCard: e.mediaCard,
1171
1183
  mediaElement: e.mediaElement,
1172
1184
  onChange: e.onAudioChange,
1173
1185
  reelAudioState: e.reelAudioState
1174
- }), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = Dt({
1186
+ }), { effectiveMuted: u, onPlaying: d, playbackAllowed: f } = At({
1175
1187
  active: e.active,
1188
+ inViewport: e.inViewport,
1176
1189
  layout: e.layout,
1177
1190
  mediaElement: e.mediaElement,
1178
1191
  mediaIsMuted: c,
@@ -1180,7 +1193,7 @@ function kt(e) {
1180
1193
  });
1181
1194
  function p(r) {
1182
1195
  let i = r?.currentTarget ?? e.mediaElement.value;
1183
- i && (t.value = Ot(i.currentTime), n.value = Ot(i.duration), o(i, f.value));
1196
+ i && (t.value = jt(i.currentTime), n.value = jt(i.duration), o(i, f.value));
1184
1197
  }
1185
1198
  function m(t) {
1186
1199
  i(), p(t), e.onReady(t);
@@ -1190,7 +1203,7 @@ function kt(e) {
1190
1203
  }
1191
1204
  function g(n) {
1192
1205
  let r = e.mediaElement.value;
1193
- !r || !Number.isFinite(n) || (r.currentTime = Math.min(Ot(r.duration), Math.max(0, n)), t.value = r.currentTime);
1206
+ !r || !Number.isFinite(n) || (r.currentTime = Math.min(jt(r.duration), Math.max(0, n)), t.value = r.currentTime);
1194
1207
  }
1195
1208
  async function _() {
1196
1209
  let t = e.mediaElement.value;
@@ -1228,7 +1241,7 @@ function kt(e) {
1228
1241
  }
1229
1242
  //#endregion
1230
1243
  //#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
1231
- var At = [
1244
+ var Nt = [
1232
1245
  "data-post-id",
1233
1246
  "data-media-index",
1234
1247
  "aria-hidden",
@@ -1236,29 +1249,29 @@ var At = [
1236
1249
  "inert",
1237
1250
  "role",
1238
1251
  "tabindex"
1239
- ], jt = { class: "media-card-content" }, Mt = ["data-media-direction"], Nt = ["data-media-index"], Pt = {
1252
+ ], Pt = { class: "media-card-content" }, Ft = ["data-media-direction"], It = ["data-media-index"], Lt = {
1240
1253
  key: 0,
1241
1254
  "data-test": "media-loading",
1242
1255
  class: "media-loading",
1243
1256
  "aria-hidden": "true"
1244
- }, Ft = [
1257
+ }, Rt = [
1245
1258
  "data-source-generation",
1246
1259
  "src",
1247
1260
  "autoplay",
1248
1261
  "loop",
1249
1262
  "muted",
1250
1263
  "preload"
1251
- ], It = ["aria-label", "disabled"], Lt = [
1264
+ ], zt = ["aria-label", "disabled"], Bt = [
1252
1265
  "src",
1253
1266
  "width",
1254
1267
  "height",
1255
1268
  "fetchpriority",
1256
1269
  "loading"
1257
- ], Rt = {
1270
+ ], Vt = {
1258
1271
  key: 1,
1259
1272
  class: "media-audio-fallback",
1260
1273
  "aria-hidden": "true"
1261
- }, zt = [
1274
+ }, Ht = [
1262
1275
  "data-source-generation",
1263
1276
  "src",
1264
1277
  "width",
@@ -1267,14 +1280,14 @@ var At = [
1267
1280
  "loop",
1268
1281
  "muted",
1269
1282
  "preload"
1270
- ], Bt = [
1283
+ ], Ut = [
1271
1284
  "data-source-generation",
1272
1285
  "src",
1273
1286
  "width",
1274
1287
  "height",
1275
1288
  "fetchpriority",
1276
1289
  "loading"
1277
- ], Vt = ["aria-label"], Ht = ["aria-label"], Ut = ["aria-label"], Wt = /* @__PURE__ */ d({
1290
+ ], Wt = ["aria-label"], Gt = ["aria-label"], Kt = ["aria-label"], qt = /* @__PURE__ */ d({
1278
1291
  __name: "MediaCard",
1279
1292
  props: {
1280
1293
  active: { type: Boolean },
@@ -1313,14 +1326,14 @@ var At = [
1313
1326
  function f(e = !1, t = "pointer") {
1314
1327
  e && d("activate", t);
1315
1328
  }
1316
- let p = r(() => V(l.item)), g = r(() => H(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(() => ee(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: J, sourceGeneration: re, mediaElement: Y } = St({
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({
1317
1330
  identity: () => `${l.item.postId}:${g.value}:${l.mediaSource ?? "preview"}:${D.value}:${M.value ?? ""}`,
1318
1331
  mediaIndex: () => g.value,
1319
1332
  onError: (e) => d("error", e),
1320
1333
  onReady: (e) => d("ready", e),
1321
1334
  previewState: () => l.previewState
1322
1335
  });
1323
- bt({
1336
+ Ct({
1324
1337
  inViewport: () => l.inViewport === !0,
1325
1338
  item: () => l.item,
1326
1339
  layout: () => l.layout,
@@ -1329,11 +1342,12 @@ var At = [
1329
1342
  mediaReady: () => W.value === "ready",
1330
1343
  mediaSource: () => l.mediaSource ?? "preview"
1331
1344
  });
1332
- let { currentTime: ie, duration: ae, effectiveMuted: X, isMuted: oe, isPlaying: se, onEnded: Z, onLoadedMetadata: ce, onPlaying: le, playbackAllowed: ue, seek: de, setVolume: fe, sync: Q, toggleMute: pe, togglePlayback: me, volume: he } = kt({
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({
1333
1346
  active: () => l.active,
1347
+ inViewport: () => l.inViewport === !0,
1334
1348
  layout: () => l.layout,
1335
1349
  mediaCard: () => l.mediaCard,
1336
- mediaElement: Y,
1350
+ mediaElement: ie,
1337
1351
  onAudioChange: (e) => d("reelAudioChange", e),
1338
1352
  onEnded: () => d("ended", g.value),
1339
1353
  onReady: K,
@@ -1342,18 +1356,18 @@ var At = [
1342
1356
  function _e(e) {
1343
1357
  return e.detail === 0 ? "keyboard" : "pointer";
1344
1358
  }
1345
- let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } = ct({
1359
+ let { change: ve, direction: ye, onTouchEnd: be, onTouchStart: xe, onWheel: Se } = dt({
1346
1360
  item: () => l.item,
1347
1361
  layout: () => l.layout,
1348
1362
  mediaIndex: () => g.value,
1349
1363
  onChange: (e) => d("mediaChange", e)
1350
- }), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } = xt({
1364
+ }), { imageLoading: Ce, mediaIsTimed: we, timedMediaPreload: Te } = wt({
1351
1365
  active: () => l.active,
1352
1366
  fetchPriority: () => l.fetchPriority,
1353
1367
  layout: () => l.layout,
1354
1368
  mediaSource: () => D.value,
1355
1369
  mediaType: () => M.value,
1356
- mediaElement: Y
1370
+ mediaElement: ie
1357
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}`);
1358
1372
  function ke(e) {
1359
1373
  l.layout === "reel" && (e.stopPropagation(), me());
@@ -1380,14 +1394,14 @@ var At = [
1380
1394
  }]),
1381
1395
  style: _(e.itemStyle),
1382
1396
  "aria-hidden": e.leaving || void 0,
1383
- "aria-busy": E(W) === "loading" || E(J),
1397
+ "aria-busy": E(W) === "loading" || E(re),
1384
1398
  inert: e.leaving || void 0,
1385
1399
  role: e.interactive && !e.leaving && !ge.value ? "button" : void 0,
1386
1400
  tabindex: e.interactive && !e.leaving && !ge.value ? 0 : void 0,
1387
1401
  onClick: i[34] ||= (t) => f(e.interactive && !ge.value, _e(t)),
1388
1402
  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"])]
1389
- }, [c("div", jt, [
1390
- e.cardHeader ? (b(), a(Ue, {
1403
+ }, [c("div", Pt, [
1404
+ e.cardHeader ? (b(), a(Ke, {
1391
1405
  key: 0,
1392
1406
  index: e.index,
1393
1407
  item: e.item,
@@ -1418,20 +1432,20 @@ var At = [
1418
1432
  onTouchendPassive: i[33] ||= (...e) => E(be) && E(be)(...e)
1419
1433
  }, [
1420
1434
  u(n, {
1421
- css: !E(J),
1435
+ css: !E(re),
1422
1436
  name: `media-slide-${E(ye)}`
1423
1437
  }, {
1424
1438
  default: k(() => [(b(), s("div", {
1425
- key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(re)}`,
1439
+ key: `${e.item.postId}:${v.value.src}:${e.mediaSource ?? "preview"}:${E(J)}`,
1426
1440
  class: "media-card-frame",
1427
1441
  "data-media-index": g.value
1428
1442
  }, [
1429
- E(W) === "loading" ? (b(), s("div", Pt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(W) === "error" ? (b(), a(qe, {
1443
+ E(W) === "loading" ? (b(), s("div", Lt, [...i[37] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : E(W) === "error" ? (b(), a(Xe, {
1430
1444
  key: 1,
1431
1445
  component: e.mediaCard?.error?.component,
1432
- label: E(He)(D.value),
1433
- retrying: E(J),
1434
- status: E(Ve)(D.value),
1446
+ label: E(Ge)(D.value),
1447
+ retrying: E(re),
1448
+ status: E(We)(D.value),
1435
1449
  onRetry: E(ne)
1436
1450
  }, null, 8, [
1437
1451
  "component",
@@ -1443,15 +1457,15 @@ var At = [
1443
1457
  S.value && e.layout === "reel" ? (b(), s("audio", {
1444
1458
  key: 2,
1445
1459
  ref_key: "mediaElement",
1446
- ref: Y,
1447
- "data-source-generation": E(re),
1460
+ ref: ie,
1461
+ "data-source-generation": E(J),
1448
1462
  class: "media-audio-element",
1449
1463
  src: D.value,
1450
1464
  autoplay: E(ue),
1451
1465
  loop: !e.advanceOnMediaEnd,
1452
- muted: E(X),
1466
+ muted: E(Y),
1453
1467
  preload: E(Te),
1454
- onLoadedmetadata: i[0] ||= (...e) => E(ce) && E(ce)(...e),
1468
+ onLoadedmetadata: i[0] ||= (...e) => E(Z) && E(Z)(...e),
1455
1469
  onProgress: i[1] ||= (...e) => E(q) && E(q)(...e),
1456
1470
  onLoadeddata: i[2] ||= (...e) => E(q) && E(q)(...e),
1457
1471
  onCanplay: i[3] ||= (...e) => E(q) && E(q)(...e),
@@ -1459,15 +1473,15 @@ var At = [
1459
1473
  onTimeupdate: i[5] ||= (...e) => E(Q) && E(Q)(...e),
1460
1474
  onVolumechange: i[6] ||= (...e) => E(Q) && E(Q)(...e),
1461
1475
  onPlaying: i[7] ||= (...e) => E(le) && E(le)(...e),
1462
- onPause: i[8] ||= (e) => se.value = !1,
1463
- onEnded: i[9] ||= (...e) => E(Z) && E(Z)(...e),
1476
+ onPause: i[8] ||= (e) => ce.value = !1,
1477
+ onEnded: i[9] ||= (...e) => E(X) && E(X)(...e),
1464
1478
  onError: i[10] ||= (...e) => E(G) && E(G)(...e)
1465
- }, null, 40, Ft)) : o("", !0),
1479
+ }, null, 40, Rt)) : o("", !0),
1466
1480
  S.value ? (b(), s("button", {
1467
1481
  key: 3,
1468
1482
  type: "button",
1469
1483
  class: h(["media-audio-artwork media-preview", { "media-preview--ready": E(W) === "ready" }]),
1470
- "aria-label": e.layout === "reel" ? E(se) ? "Pause audio" : "Play audio" : "Audio",
1484
+ "aria-label": e.layout === "reel" ? E(ce) ? "Pause audio" : "Play audio" : "Audio",
1471
1485
  disabled: e.layout !== "reel",
1472
1486
  onClick: ke
1473
1487
  }, [R.value ? (b(), s("img", {
@@ -1482,14 +1496,14 @@ var At = [
1482
1496
  loading: E(Ce),
1483
1497
  onLoad: i[11] ||= (t) => e.layout === "masonry" && E(K)(t),
1484
1498
  onError: Ae
1485
- }, null, 40, Lt)) : (b(), s("span", Rt, [u(E(Fe), {
1499
+ }, null, 40, Bt)) : (b(), s("span", Vt, [u(E(Re), {
1486
1500
  size: 64,
1487
1501
  "stroke-width": 1.5
1488
- })]))], 10, It)) : E(we) ? (b(), s("video", {
1502
+ })]))], 10, zt)) : E(we) ? (b(), s("video", {
1489
1503
  key: 4,
1490
1504
  ref_key: "mediaElement",
1491
- ref: Y,
1492
- "data-source-generation": E(re),
1505
+ ref: ie,
1506
+ "data-source-generation": E(J),
1493
1507
  class: h(["media-preview", {
1494
1508
  "media-preview--ready": E(W) === "ready",
1495
1509
  "media-preview--reel-video": e.layout === "reel"
@@ -1499,10 +1513,10 @@ var At = [
1499
1513
  height: P.value ?? void 0,
1500
1514
  autoplay: E(ue),
1501
1515
  loop: !e.advanceOnMediaEnd,
1502
- muted: E(X),
1516
+ muted: E(Y),
1503
1517
  playsinline: "",
1504
1518
  preload: E(Te),
1505
- onLoadedmetadata: i[12] ||= (...e) => E(ce) && E(ce)(...e),
1519
+ onLoadedmetadata: i[12] ||= (...e) => E(Z) && E(Z)(...e),
1506
1520
  onProgress: i[13] ||= (...e) => E(q) && E(q)(...e),
1507
1521
  onLoadeddata: i[14] ||= (...e) => E(q) && E(q)(...e),
1508
1522
  onCanplay: i[15] ||= (...e) => E(q) && E(q)(...e),
@@ -1510,15 +1524,15 @@ var At = [
1510
1524
  onTimeupdate: i[17] ||= (...e) => E(Q) && E(Q)(...e),
1511
1525
  onVolumechange: i[18] ||= (...e) => E(Q) && E(Q)(...e),
1512
1526
  onPlaying: i[19] ||= (...e) => E(le) && E(le)(...e),
1513
- onPause: i[20] ||= (e) => se.value = !1,
1514
- onEnded: i[21] ||= (...e) => E(Z) && E(Z)(...e),
1527
+ onPause: i[20] ||= (e) => ce.value = !1,
1528
+ onEnded: i[21] ||= (...e) => E(X) && E(X)(...e),
1515
1529
  onClick: ke,
1516
1530
  onError: i[22] ||= (...e) => E(G) && E(G)(...e)
1517
- }, null, 42, zt)) : S.value ? o("", !0) : (b(), s("img", {
1531
+ }, null, 42, Ht)) : S.value ? o("", !0) : (b(), s("img", {
1518
1532
  key: 5,
1519
1533
  ref_key: "imageElement",
1520
1534
  ref: te,
1521
- "data-source-generation": E(re),
1535
+ "data-source-generation": E(J),
1522
1536
  class: h(["media-preview", { "media-preview--ready": E(W) === "ready" }]),
1523
1537
  src: D.value,
1524
1538
  width: N.value ?? void 0,
@@ -1529,11 +1543,11 @@ var At = [
1529
1543
  loading: E(Ce),
1530
1544
  onLoad: i[23] ||= (...e) => E(K) && E(K)(...e),
1531
1545
  onError: i[24] ||= (...e) => E(G) && E(G)(...e)
1532
- }, null, 42, Bt))
1533
- ], 8, Nt))]),
1546
+ }, null, 42, Ut))
1547
+ ], 8, It))]),
1534
1548
  _: 1
1535
1549
  }, 8, ["css", "name"]),
1536
- u(it, {
1550
+ u(st, {
1537
1551
  item: e.item,
1538
1552
  "media-card": e.mediaCard,
1539
1553
  "media-index": g.value,
@@ -1553,15 +1567,15 @@ var At = [
1553
1567
  name: "vibe-reel-media-controls",
1554
1568
  css: Ee.value
1555
1569
  }, {
1556
- default: k(() => [De.value ? (b(), a(nt, {
1570
+ default: k(() => [De.value ? (b(), a(at, {
1557
1571
  key: Oe.value,
1558
- "current-time": E(ie),
1572
+ "current-time": E(ae),
1559
1573
  "data-control-post-id": Ee.value ? e.item.postId : void 0,
1560
- duration: E(ae),
1574
+ duration: E(oe),
1561
1575
  layout: e.layout,
1562
1576
  "media-type": S.value ? "audio" : "video",
1563
- muted: E(oe),
1564
- playing: E(se),
1577
+ muted: E(se),
1578
+ playing: E(ce),
1565
1579
  volume: E(he),
1566
1580
  onSeek: E(de),
1567
1581
  onToggleMute: E(pe),
@@ -1593,13 +1607,13 @@ var At = [
1593
1607
  "aria-label": `Previous media for post ${e.item.postId}`,
1594
1608
  onClick: i[25] ||= j((e) => E(ve)(g.value - 1, e), ["stop"]),
1595
1609
  onKeydown: i[26] ||= j(() => {}, ["stop"])
1596
- }, [u(E(Ne), { size: 20 })], 40, Vt), c("button", {
1610
+ }, [u(E(Ie), { size: 20 })], 40, Wt), c("button", {
1597
1611
  type: "button",
1598
1612
  class: "media-carousel-control media-carousel-control--next",
1599
1613
  "aria-label": `Next media for post ${e.item.postId}`,
1600
1614
  onClick: i[27] ||= j((e) => E(ve)(g.value + 1, e), ["stop"]),
1601
1615
  onKeydown: i[28] ||= j(() => {}, ["stop"])
1602
- }, [u(E(Pe), { size: 20 })], 40, Ht)], 2)) : o("", !0),
1616
+ }, [u(E(Le), { size: 20 })], 40, Gt)], 2)) : o("", !0),
1603
1617
  ge.value ? (b(), s("button", {
1604
1618
  key: 1,
1605
1619
  class: "media-card-activator",
@@ -1607,9 +1621,9 @@ var At = [
1607
1621
  "aria-label": `Open post ${e.item.postId}`,
1608
1622
  onClick: i[29] ||= j((e) => r.$emit("activate", _e(e)), ["stop"]),
1609
1623
  onKeydown: i[30] ||= j(() => {}, ["stop"])
1610
- }, null, 40, Ut)) : o("", !0)
1611
- ], 42, Mt),
1612
- e.cardFooter ? (b(), a(Ue, {
1624
+ }, null, 40, Kt)) : o("", !0)
1625
+ ], 42, Ft),
1626
+ e.cardFooter ? (b(), a(Ke, {
1613
1627
  key: 1,
1614
1628
  index: e.index,
1615
1629
  item: e.item,
@@ -1632,12 +1646,44 @@ var At = [
1632
1646
  "style",
1633
1647
  "total"
1634
1648
  ])) : o("", !0)
1635
- ])], 46, At));
1649
+ ])], 46, Nt));
1650
+ }
1651
+ });
1652
+ //#endregion
1653
+ //#region src/components/useMasonryMediaVisibility.ts
1654
+ function Jt(e) {
1655
+ function t(t) {
1656
+ return t.flatMap((t) => {
1657
+ let n = e.items()[t];
1658
+ if (!n) return [];
1659
+ let r = e.mediaIndices().get(n.postId) ?? 0, i = W(n.postId, r);
1660
+ return e.previewStates().get(i) === "ready" ? [{
1661
+ key: i,
1662
+ mediaIndex: r,
1663
+ postId: n.postId
1664
+ }] : [];
1665
+ });
1636
1666
  }
1637
- }), Gt = { class: "masonry-feed-shell" }, Kt = ["aria-hidden", "inert"], qt = {
1667
+ function n(e, n) {
1668
+ let r = /* @__PURE__ */ new Set();
1669
+ O(() => t(e()), (e) => {
1670
+ let t = new Set(e.map(({ key: e }) => e));
1671
+ e.forEach(({ key: e, mediaIndex: t, postId: i }) => {
1672
+ r.has(e) || n(i, t);
1673
+ }), r = t;
1674
+ }, {
1675
+ immediate: !0,
1676
+ flush: "post"
1677
+ });
1678
+ }
1679
+ n(e.visibleIndices, e.onVisible), n(e.fullyVisibleIndices, e.onFullyVisible);
1680
+ }
1681
+ //#endregion
1682
+ //#region src/components/MasonryFeed.vue?vue&type=script&setup=true&lang.ts
1683
+ var Yt = { class: "masonry-feed-shell" }, Xt = ["aria-hidden", "inert"], Zt = {
1638
1684
  key: 0,
1639
1685
  class: "masonry-feed-status-overlay"
1640
- }, Jt = 6, Yt = 12, Xt = 250, Zt = /* @__PURE__ */ d({
1686
+ }, Qt = 6, $t = 12, en = 250, tn = /* @__PURE__ */ d({
1641
1687
  __name: "MasonryFeed",
1642
1688
  props: {
1643
1689
  enteringPostIds: {},
@@ -1667,6 +1713,7 @@ var At = [
1667
1713
  emits: [
1668
1714
  "activate",
1669
1715
  "error",
1716
+ "fullyVisible",
1670
1717
  "loadMore",
1671
1718
  "mediaChange",
1672
1719
  "ready",
@@ -1674,97 +1721,95 @@ var At = [
1674
1721
  "visible"
1675
1722
  ],
1676
1723
  setup(t, { expose: n, emit: i }) {
1677
- let l = 0, d = t, f = i, p = w(null), m = `vibe-masonry-${D()}`, g = w(null), y = w(0), x = w(Jt), C = w(0), T = w(0), k = w(0), A = w([]), j = w([]), M = 0, N = null, P = null, F = null, I = null, L = r(() => ue(d.items, y.value, {
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, {
1678
1725
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1679
1726
  gap: x.value,
1680
- minColumnWidth: pe(d.masonry)
1681
- })), R = r(() => {
1727
+ minColumnWidth: ge(d.masonry)
1728
+ })), z = r(() => {
1682
1729
  if (d.leavingPostIds.size === 0) return null;
1683
1730
  let e = d.items.flatMap((e, t) => d.leavingPostIds.has(e.postId) ? [] : [{
1684
1731
  index: t,
1685
1732
  item: e
1686
- }]), t = ue(e.map(({ item: e }) => e), y.value, {
1733
+ }]), t = Q(e.map(({ item: e }) => e), y.value, {
1687
1734
  additionalHeight: (d.cardHeader?.height ?? 0) + (d.cardFooter?.height ?? 0),
1688
1735
  gap: x.value,
1689
- minColumnWidth: pe(d.masonry)
1736
+ minColumnWidth: ge(d.masonry)
1690
1737
  });
1691
1738
  return {
1692
1739
  indices: e.map(({ index: e }) => e),
1693
1740
  layout: t,
1694
1741
  positions: new Map(e.map(({ item: e }, n) => [e.postId, t.items[n]]))
1695
1742
  };
1696
- }), z = r(() => {
1697
- let e = L.value, t = R.value;
1743
+ }), B = r(() => {
1744
+ let e = R.value, t = z.value;
1698
1745
  return t ? {
1699
1746
  ...t.layout,
1700
1747
  items: d.items.map((n, r) => d.leavingPostIds.has(n.postId) ? e.items[r] : t.positions.get(n.postId) ?? e.items[r])
1701
1748
  } : e;
1702
- }), B = r(() => de(L.value.items)), ee = r(() => {
1703
- let e = R.value;
1704
- return e ? de(e.layout.items, e.indices) : null;
1705
- }), V = r(() => Math.max(T.value, d.leavingPostIds.size === 0 ? z.value.height : L.value.height)), H = r(() => ({ height: `${V.value}px` })), U = r(() => !d.infiniteScroll || C.value > 0 && k.value + z.value.height <= C.value + 1), G = r(() => new Set(A.value)), te = r(() => j.value.flatMap((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) => {
1706
1753
  let t = d.items[e];
1707
1754
  return t ? [{
1708
- fetchPriority: G.value.has(e) ? "high" : "low",
1755
+ fetchPriority: te.value.has(e) ? "high" : "low",
1709
1756
  index: e,
1710
1757
  item: t
1711
1758
  }] : [];
1712
1759
  }));
1713
- function K(e, t) {
1760
+ function q(e, t) {
1714
1761
  return [...new Set([...e, ...t])].sort((e, t) => e - t);
1715
1762
  }
1716
- function q(e, t) {
1763
+ function ne(e, t) {
1717
1764
  return e.length === t.length && e.every((e, n) => e === t[n]);
1718
1765
  }
1719
- function ne(e) {
1766
+ function re(e) {
1720
1767
  let t = {
1721
- scrollTop: M - k.value,
1768
+ scrollTop: N - k.value,
1722
1769
  viewportHeight: C.value
1723
- }, n = ee.value, r = Q(n ?? B.value, {
1770
+ }, n = H.value, r = he(n ?? V.value, {
1724
1771
  ...t,
1725
1772
  overscan: e
1726
1773
  }).indices;
1727
- return K(r, d.leavingPostIds.size === 0 ? [] : Q(B.value, {
1774
+ return q(r, d.leavingPostIds.size === 0 ? [] : he(V.value, {
1728
1775
  ...t,
1729
1776
  overscan: e
1730
1777
  }).indices);
1731
1778
  }
1732
1779
  function J() {
1733
- let e = ne(0), t = ne(me(d.masonry, C.value));
1734
- q(A.value, e) || (A.value = e), q(j.value, t) || (j.value = t);
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) => {
1783
+ let t = d.items[e];
1784
+ return t && !d.leavingPostIds.has(t.postId);
1785
+ }), {
1786
+ scrollTop: N - k.value,
1787
+ viewportHeight: C.value
1788
+ });
1789
+ ne(A.value, n) || (A.value = n), ne(M.value, t) || (M.value = t);
1735
1790
  }
1736
- function re() {
1737
- if (I !== null) return;
1738
- I = -1;
1791
+ function ie() {
1792
+ if (L !== null) return;
1793
+ L = -1;
1739
1794
  let e = requestAnimationFrame(() => {
1740
- I = null, J();
1795
+ L = null, J();
1741
1796
  });
1742
- I !== null && (I = e);
1797
+ L !== null && (L = e);
1743
1798
  }
1744
- let Y = /* @__PURE__ */ new Set();
1745
- O(() => [...G.value].flatMap((e) => {
1746
- let t = d.items[e];
1747
- if (!t) return [];
1748
- let n = d.mediaIndices.get(t.postId) ?? 0, r = W(t.postId, n);
1749
- return d.previewStates.get(r) === "ready" ? [{
1750
- key: r,
1751
- mediaIndex: n,
1752
- postId: t.postId
1753
- }] : [];
1754
- }), (e) => {
1755
- let t = new Set(e.map(({ key: e }) => e));
1756
- e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
1757
- Y.has(e) || f("visible", n, t);
1758
- }), Y = t;
1759
- }, {
1760
- immediate: !0,
1761
- flush: "post"
1799
+ Jt({
1800
+ fullyVisibleIndices: () => A.value,
1801
+ items: () => d.items,
1802
+ mediaIndices: () => d.mediaIndices,
1803
+ onFullyVisible: (e, t) => f("fullyVisible", e, t),
1804
+ onVisible: (e, t) => f("visible", e, t),
1805
+ previewStates: () => d.previewStates,
1806
+ visibleIndices: () => j.value
1762
1807
  });
1763
- function ae(e) {
1764
- let t = z.value.items[e], n = d.items[e]?.postId;
1808
+ function oe(e) {
1809
+ let t = B.value.items[e], n = d.items[e]?.postId;
1765
1810
  if (!t) return {};
1766
1811
  let r = n !== void 0 && d.enteringPostIds.has(n), i = n !== void 0 && d.leavingPostIds.has(n), a = r || i ? le({
1767
- containerHeight: Math.max(T.value, L.value.height),
1812
+ containerHeight: Math.max(T.value, R.value.height),
1768
1813
  gap: x.value
1769
1814
  }) : 0, o = n === void 0 ? 0 : i ? d.removalDelays.get(n) ?? 0 : r ? d.entryDelays.get(n) ?? 0 : 0;
1770
1815
  return {
@@ -1774,52 +1819,52 @@ var At = [
1774
1819
  transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
1775
1820
  };
1776
1821
  }
1777
- function X() {
1822
+ function Y() {
1778
1823
  let e = p.value;
1779
1824
  if (!e) return;
1780
- M = e.scrollTop, C.value = e.clientHeight;
1825
+ N = e.scrollTop, C.value = e.clientHeight;
1781
1826
  let t = e.ownerDocument.defaultView?.getComputedStyle(e), n = (Number.parseFloat(t?.paddingTop ?? "") || 0) + (Number.parseFloat(t?.paddingBottom ?? "") || 0);
1782
1827
  T.value = Math.max(0, e.clientHeight - n);
1783
1828
  let r = g.value;
1784
1829
  r && (k.value = r.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, J());
1785
1830
  }
1786
- function oe(e) {
1831
+ function se(e) {
1787
1832
  let t = e.ownerDocument.documentElement.clientWidth;
1788
- y.value = e.clientWidth, x.value = Math.min(Yt, Math.max(Jt, t * .0075)), X();
1833
+ y.value = e.clientWidth, x.value = Math.min($t, Math.max(Qt, t * .0075)), Y();
1789
1834
  }
1790
- function Z(e) {
1835
+ function X(e) {
1791
1836
  let t = e.currentTarget;
1792
- t && (M = t.scrollTop, re(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && se(t) && f("loadMore"));
1837
+ t && (N = t.scrollTop, ie(), Date.now() >= l && !d.loadMoreLocked && d.infiniteScroll && ce(t) && f("loadMore"));
1793
1838
  }
1794
- function ce() {
1839
+ function Z() {
1795
1840
  let e = p.value;
1796
- Date.now() >= l && !d.loadMoreLocked && e && se(e) && f("loadMore");
1841
+ Date.now() >= l && !d.loadMoreLocked && e && ce(e) && f("loadMore");
1797
1842
  }
1798
1843
  O(() => d.items.length, (e, t) => {
1799
- e > 0 && e < t && (l = Date.now() + Xt);
1844
+ e > 0 && e < t && (l = Date.now() + en);
1800
1845
  });
1801
- function fe() {
1846
+ function ue() {
1802
1847
  return p.value;
1803
1848
  }
1804
1849
  return O(g, (e) => {
1805
- N?.disconnect(), N = null, F !== null && cancelAnimationFrame(F), e && (oe(e), !(typeof ResizeObserver > "u") && (N = new ResizeObserver(([t]) => {
1850
+ P?.disconnect(), P = null, I !== null && cancelAnimationFrame(I), e && (se(e), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(([t]) => {
1806
1851
  let n = t?.contentRect.width ?? e.clientWidth;
1807
- Math.abs(n - y.value) < .5 || (F = requestAnimationFrame(() => {
1808
- F = null, oe(e);
1852
+ Math.abs(n - y.value) < .5 || (I = requestAnimationFrame(() => {
1853
+ I = null, se(e);
1809
1854
  }));
1810
- }), N.observe(e)));
1855
+ }), P.observe(e)));
1811
1856
  }), O(p, (e) => {
1812
- P?.disconnect(), P = null, e && (X(), !(typeof ResizeObserver > "u") && (P = new ResizeObserver(X), P.observe(e)));
1857
+ F?.disconnect(), F = null, e && (Y(), !(typeof ResizeObserver > "u") && (F = new ResizeObserver(Y), F.observe(e)));
1813
1858
  }), O([
1814
- L,
1815
- z,
1859
+ R,
1860
+ B,
1816
1861
  () => d.masonry
1817
1862
  ], J, { flush: "post" }), v(() => {
1818
- N?.disconnect(), P?.disconnect(), F !== null && cancelAnimationFrame(F), I !== null && cancelAnimationFrame(I);
1863
+ P?.disconnect(), F?.disconnect(), I !== null && cancelAnimationFrame(I), L !== null && cancelAnimationFrame(L);
1819
1864
  }), n({
1820
- getScrollElement: fe,
1821
- loadIfNearBottom: ce
1822
- }), (n, r) => (b(), s("div", Gt, [
1865
+ getScrollElement: ue,
1866
+ loadIfNearBottom: Z
1867
+ }), (n, r) => (b(), s("div", Yt, [
1823
1868
  c("main", {
1824
1869
  id: m,
1825
1870
  ref_key: "galleryElement",
@@ -1828,14 +1873,14 @@ var At = [
1828
1873
  "data-layout-mode": "masonry",
1829
1874
  "aria-hidden": t.suspended || void 0,
1830
1875
  inert: t.suspended || void 0,
1831
- onScrollPassive: Z
1876
+ onScrollPassive: X
1832
1877
  }, [c("section", {
1833
1878
  ref_key: "masonryElement",
1834
1879
  ref: g,
1835
1880
  class: h(["masonry", { "masonry--ready": y.value > 0 }]),
1836
- style: _(H.value),
1881
+ style: _(U.value),
1837
1882
  "aria-label": "Media gallery"
1838
- }, [(b(!0), s(e, null, S(te.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(Wt, {
1883
+ }, [(b(!0), s(e, null, S(K.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(qt, {
1839
1884
  key: n.postId,
1840
1885
  class: "masonry-item",
1841
1886
  entering: t.enteringPostIds.has(n.postId),
@@ -1844,10 +1889,10 @@ var At = [
1844
1889
  "card-footer": t.cardFooter,
1845
1890
  "card-header": t.cardHeader,
1846
1891
  "media-card": t.mediaCard,
1847
- "in-viewport": G.value.has(r),
1892
+ "in-viewport": te.value.has(r),
1848
1893
  index: r,
1849
1894
  item: n,
1850
- "item-style": ae(r),
1895
+ "item-style": oe(r),
1851
1896
  interactive: "",
1852
1897
  layout: "masonry",
1853
1898
  "loaded-count": t.items.length,
@@ -1877,8 +1922,8 @@ var At = [
1877
1922
  "onMediaChange",
1878
1923
  "onReady",
1879
1924
  "onError"
1880
- ]))), 128))], 6)], 42, Kt),
1881
- t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && U.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", qt, [u(ie, {
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, {
1882
1927
  actions: t.feedFooterActions,
1883
1928
  "can-retry-end": t.canRetryEnd,
1884
1929
  "feed-footer": t.feedFooter,
@@ -1886,7 +1931,7 @@ var At = [
1886
1931
  "has-next": t.hasNext,
1887
1932
  "is-loading": t.isLoadingMore,
1888
1933
  "load-more-locked": t.loadMoreLocked,
1889
- "show-load-more": U.value,
1934
+ "show-load-more": G.value,
1890
1935
  state: t.state,
1891
1936
  onLoadMore: r[0] ||= (e) => f("loadMore"),
1892
1937
  onRetryEnd: r[1] ||= (e) => f("retryEnd")
@@ -1901,8 +1946,8 @@ var At = [
1901
1946
  "show-load-more",
1902
1947
  "state"
1903
1948
  ])])) : o("", !0),
1904
- u(Ce, {
1905
- "content-size": z.value.height,
1949
+ u(Ee, {
1950
+ "content-size": B.value.height,
1906
1951
  "controls-id": m,
1907
1952
  "scroll-element": p.value,
1908
1953
  suspended: t.suspended
@@ -1913,8 +1958,8 @@ var At = [
1913
1958
  ])
1914
1959
  ]));
1915
1960
  }
1916
- }), Qt = 300;
1917
- function $t(e, t, n) {
1961
+ }), nn = 300;
1962
+ function rn(e, t, n) {
1918
1963
  let r = e.scrollTop;
1919
1964
  if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
1920
1965
  e.setAttribute("data-transitioning", "");
@@ -1922,7 +1967,7 @@ function $t(e, t, n) {
1922
1967
  return new Promise((n) => {
1923
1968
  let o = (s) => {
1924
1969
  a += 1;
1925
- let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / Qt), u = 1 - (1 - l) ** 3;
1970
+ let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / nn), u = 1 - (1 - l) ** 3;
1926
1971
  if (e.scrollTop = r + (t - r) * u, l < 1) {
1927
1972
  requestAnimationFrame(o);
1928
1973
  return;
@@ -1934,7 +1979,7 @@ function $t(e, t, n) {
1934
1979
  }
1935
1980
  //#endregion
1936
1981
  //#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
1937
- var en = ["aria-label"], tn = /* @__PURE__ */ d({
1982
+ var an = ["aria-label"], on = /* @__PURE__ */ d({
1938
1983
  __name: "ReelAutoAdvanceProgress",
1939
1984
  props: {
1940
1985
  durationMs: {},
@@ -1952,9 +1997,9 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
1952
1997
  class: "reel-auto-advance-progress",
1953
1998
  style: _(a.value),
1954
1999
  onAnimationend: n[0] ||= (e) => i("complete")
1955
- }, null, 36)], 8, en));
2000
+ }, null, 36)], 8, an));
1956
2001
  }
1957
- }), nn = { class: "reel-viewport" }, rn = ["data-active-post-id", "data-active-media-index"], an = ["role", "data-status"], on = 300, sn = 250, cn = /* @__PURE__ */ d({
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({
1958
2003
  __name: "ReelFeed",
1959
2004
  props: {
1960
2005
  initialPostId: {},
@@ -2006,7 +2051,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2006
2051
  }), z = r(() => {
2007
2052
  let e = F.value;
2008
2053
  return e === void 0 ? "loading" : u.previewStates.get(W(e, R.value)) ?? "loading";
2009
- }), B = r(() => I.value ? U(I.value, R.value) : null), H = r(() => B.value ? ee(B.value, u.mediaSource ?? "preview") : null), G = r(() => z.value === "ready" && !!(H.value && L(H.value.type, H.value.src))), te = r(() => [
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(() => [
2010
2055
  F.value,
2011
2056
  R.value,
2012
2057
  u.items.length,
@@ -2015,54 +2060,54 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2015
2060
  u.reelAutoAdvance.includePostItems,
2016
2061
  u.reelAutoAdvance.intervalMs
2017
2062
  ].join(":")), K = r(() => {
2018
- let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value < V(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
2063
+ let e = I.value, t = !!(e && u.reelAutoAdvance.includePostItems && R.value < H(e).length - 1), n = u.reelAutoAdvance.intervalMs / 1e3;
2019
2064
  return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
2020
- }), 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), J = r(() => u.reelForward.status === "loading" ? "Loading the next media…" : u.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
2021
- function re(e) {
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) {
2022
2067
  return { gridRow: `${e + 1}` };
2023
2068
  }
2024
- function Y(e) {
2069
+ function ie(e) {
2025
2070
  let t = k || e.clientHeight;
2026
2071
  return t <= 0 || u.items.length === 0 ? 0 : Math.min(u.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
2027
2072
  }
2028
- function ae(e) {
2073
+ function oe(e) {
2029
2074
  let t = e.currentTarget;
2030
2075
  if (!t) return;
2031
2076
  let n = k || t.clientHeight, r = Math.max(0, u.items.length - 1) * n;
2032
- C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = Y(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && se(t) && d("loadMore");
2077
+ C.value = u.items.length > 0 && t.scrollTop > r + 1, D.value || (x.value = ie(t)), Date.now() >= l && !u.loadMoreLocked && u.infiniteScroll && ce(t) && d("loadMore");
2033
2078
  }
2034
- function X() {
2079
+ function Y() {
2035
2080
  let e = f.value;
2036
- e && (C.value = !1, ce(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
2081
+ e && (C.value = !1, Z(!0), k = e.clientHeight, e.scrollTop = x.value * k, j !== null && cancelAnimationFrame(j), j = requestAnimationFrame(() => {
2037
2082
  e.scrollTop = x.value * e.clientHeight, k = e.clientHeight, j = null;
2038
- }), oe());
2083
+ }), se());
2039
2084
  }
2040
- function oe() {
2085
+ function se() {
2041
2086
  M !== null && clearTimeout(M), M = setTimeout(() => {
2042
2087
  M = null;
2043
2088
  let e = f.value;
2044
- e && (k = e.clientHeight, e.scrollTop = x.value * k), ce(!1);
2089
+ e && (k = e.clientHeight, e.scrollTop = x.value * k), Z(!1);
2045
2090
  }, 120);
2046
2091
  }
2047
- function Z() {
2048
- ce(!0);
2092
+ function X() {
2093
+ Z(!0);
2049
2094
  let e = f.value;
2050
- e && (k = e.clientHeight, e.scrollTop = x.value * k), oe();
2095
+ e && (k = e.clientHeight, e.scrollTop = x.value * k), se();
2051
2096
  }
2052
- function ce(e) {
2097
+ function Z(e) {
2053
2098
  D.value = e, f.value?.toggleAttribute("data-resizing", e);
2054
2099
  }
2055
2100
  function le() {
2056
2101
  let e = f.value;
2057
- Date.now() >= l && !u.loadMoreLocked && e && se(e) && d("loadMore");
2102
+ Date.now() >= l && !u.loadMoreLocked && e && ce(e) && d("loadMore");
2058
2103
  }
2059
2104
  O(() => u.items.length, (e, t) => {
2060
- e > 0 && e < t && (l = Date.now() + sn);
2105
+ e > 0 && e < t && (l = Date.now() + dn);
2061
2106
  });
2062
2107
  function ue(e) {
2063
2108
  let t = I.value;
2064
2109
  if (!t) return !1;
2065
- let n = V(t).length;
2110
+ let n = H(t).length;
2066
2111
  if (n <= 1) return !1;
2067
2112
  let r = (R.value + e + n) % n;
2068
2113
  return d("mediaChange", t.postId, r), !0;
@@ -2082,7 +2127,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2082
2127
  let t = f.value;
2083
2128
  if (!t) return Promise.resolve();
2084
2129
  let n = e * (k || t.clientHeight);
2085
- return x.value = e, $t(t, n, Q());
2130
+ return x.value = e, rn(t, n, Q());
2086
2131
  }
2087
2132
  function me(e) {
2088
2133
  pe(e);
@@ -2092,13 +2137,13 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2092
2137
  return t < 0 || t === x.value ? !1 : (await pe(t), !0);
2093
2138
  }
2094
2139
  async function ge(e) {
2095
- return ue(e) ? (Q() || await new Promise((e) => setTimeout(e, on)), !0) : !1;
2140
+ return ue(e) ? (Q() || await new Promise((e) => setTimeout(e, un)), !0) : !1;
2096
2141
  }
2097
2142
  function _e() {
2098
2143
  if (!u.reelAutoAdvance.enabled) return;
2099
2144
  let e = I.value;
2100
2145
  if (!e) return;
2101
- if (u.reelAutoAdvance.includePostItems && R.value < V(e).length - 1) {
2146
+ if (u.reelAutoAdvance.includePostItems && R.value < H(e).length - 1) {
2102
2147
  d("mediaChange", e.postId, R.value + 1);
2103
2148
  return;
2104
2149
  }
@@ -2113,16 +2158,16 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2113
2158
  !u.reelAutoAdvance.enabled || e !== F.value || t !== R.value || !G.value || _e();
2114
2159
  }
2115
2160
  return O(f, (e) => {
2116
- A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(X), A.observe(e)));
2161
+ A?.disconnect(), A = null, e && (k = e.clientHeight, !(typeof ResizeObserver > "u") && (A = new ResizeObserver(Y), A.observe(e)));
2117
2162
  }), O(() => u.items.length, async (e) => {
2118
2163
  let t = u.initialPostId, n = t == null ? -1 : u.items.findIndex(({ postId: e }) => e === t);
2119
- x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), X();
2164
+ x.value = n >= 0 ? n : Math.min(x.value, Math.max(0, e - 1)), await m(), Y();
2120
2165
  }), O(F, (e) => {
2121
2166
  e !== void 0 && d("activeChange", e);
2122
2167
  }, { immediate: !0 }), y(() => {
2123
- window.addEventListener("resize", Z), window.addEventListener("orientationchange", Z), g >= 0 && m(X);
2168
+ window.addEventListener("resize", X), window.addEventListener("orientationchange", X), g >= 0 && m(Y);
2124
2169
  }), v(() => {
2125
- window.removeEventListener("resize", Z), window.removeEventListener("orientationchange", Z), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
2170
+ window.removeEventListener("resize", X), window.removeEventListener("orientationchange", X), A?.disconnect(), j !== null && cancelAnimationFrame(j), M !== null && clearTimeout(M);
2126
2171
  }), n({
2127
2172
  activeIndex: x,
2128
2173
  activePostId: F,
@@ -2139,7 +2184,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2139
2184
  }]),
2140
2185
  "data-layout-mode": "reel"
2141
2186
  }, [
2142
- t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(Ue, {
2187
+ t.cardHeader && I.value && t.reelForward.status === "idle" ? (b(), a(Ke, {
2143
2188
  key: 0,
2144
2189
  index: x.value,
2145
2190
  item: I.value,
@@ -2161,19 +2206,19 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2161
2206
  "style",
2162
2207
  "total"
2163
2208
  ])) : o("", !0),
2164
- c("div", nn, [c("div", {
2209
+ c("div", sn, [c("div", {
2165
2210
  ref_key: "galleryElement",
2166
2211
  ref: f,
2167
2212
  class: "gallery-shell reel-feed",
2168
2213
  "data-active-post-id": F.value,
2169
2214
  "data-active-media-index": R.value,
2170
- onScrollPassive: ae
2215
+ onScrollPassive: oe
2171
2216
  }, [t.reelForward.status === "idle" ? (b(), s("section", {
2172
2217
  key: 1,
2173
2218
  class: "reel-track",
2174
2219
  style: _(N.value),
2175
2220
  "aria-label": "Media gallery"
2176
- }, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(Wt, {
2221
+ }, [(b(!0), s(e, null, S(P.value, ({ fetchPriority: e, item: n, index: i }) => (b(), a(qt, {
2177
2222
  key: n.postId,
2178
2223
  active: i === x.value && !C.value,
2179
2224
  "advance-on-media-end": u.reelAutoAdvance.enabled && i === x.value,
@@ -2182,7 +2227,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2182
2227
  "fetch-priority": e,
2183
2228
  index: i,
2184
2229
  item: n,
2185
- "item-style": re(i),
2230
+ "item-style": J(i),
2186
2231
  "media-card": t.mediaCard,
2187
2232
  layout: "reel",
2188
2233
  "loaded-count": t.items.length,
@@ -2222,12 +2267,12 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2222
2267
  class: "reel-forward-status",
2223
2268
  role: t.reelForward.status === "error" ? "alert" : "status",
2224
2269
  "data-status": t.reelForward.status
2225
- }, [c("p", null, T(J.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
2270
+ }, [c("p", null, T(re.value), 1), t.reelForward.status === "error" || t.reelForward.status === "end" ? (b(), s("button", {
2226
2271
  key: 0,
2227
2272
  class: "reel-forward-retry",
2228
2273
  type: "button",
2229
2274
  onClick: r[0] ||= (e) => d("retryForward")
2230
- }, " Retry ")) : o("", !0)], 8, an)), t.reelForward.status === "idle" ? (b(), a(ie, {
2275
+ }, " Retry ")) : o("", !0)], 8, ln)), t.reelForward.status === "idle" ? (b(), a(ae, {
2231
2276
  key: 2,
2232
2277
  actions: t.feedFooterActions,
2233
2278
  "can-retry-end": t.canRetryEnd,
@@ -2250,13 +2295,13 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2250
2295
  "load-more-locked",
2251
2296
  "show-load-more",
2252
2297
  "state"
2253
- ])) : o("", !0)], 40, rn), c("div", {
2298
+ ])) : o("", !0)], 40, cn), c("div", {
2254
2299
  ref_key: "reelControlsElement",
2255
2300
  ref: p,
2256
2301
  class: "reel-media-controls-host",
2257
2302
  "data-test": "reel-media-controls-host"
2258
2303
  }, null, 512)]),
2259
- t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(Ue, {
2304
+ t.cardFooter && I.value && t.reelForward.status === "idle" ? (b(), a(Ke, {
2260
2305
  key: 1,
2261
2306
  index: x.value,
2262
2307
  item: I.value,
@@ -2278,7 +2323,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2278
2323
  "style",
2279
2324
  "total"
2280
2325
  ])) : o("", !0),
2281
- q.value ? (b(), a(tn, {
2326
+ q.value ? (b(), a(on, {
2282
2327
  key: te.value,
2283
2328
  "duration-ms": t.reelAutoAdvance.intervalMs,
2284
2329
  label: K.value,
@@ -2286,16 +2331,16 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2286
2331
  }, null, 8, ["duration-ms", "label"])) : o("", !0)
2287
2332
  ], 2));
2288
2333
  }
2289
- }), ln = ["data-info-sheet-open", "data-info-sheet-mode"], un = ["aria-hidden", "inert"], dn = {
2334
+ }), pn = ["data-info-sheet-open", "data-info-sheet-mode"], mn = ["aria-hidden", "inert"], hn = {
2290
2335
  key: 0,
2291
2336
  class: "reel-info-sheet-layer",
2292
2337
  "data-test": "reel-info-sheet"
2293
- }, fn = [
2338
+ }, gn = [
2294
2339
  "role",
2295
2340
  "aria-modal",
2296
2341
  "tabindex",
2297
2342
  "data-active-post-id"
2298
- ], pn = /* @__PURE__ */ d({
2343
+ ], _n = /* @__PURE__ */ d({
2299
2344
  __name: "ReelLayout",
2300
2345
  props: {
2301
2346
  forwardIndex: { default: null },
@@ -2355,7 +2400,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2355
2400
  item: e,
2356
2401
  layout: "reel",
2357
2402
  loadedCount: l.items.length,
2358
- mediaCount: V(e).length,
2403
+ mediaCount: H(e).length,
2359
2404
  mediaIndex: D.value,
2360
2405
  mediaItem: U(e, D.value),
2361
2406
  mediaSource: l.mediaSource ?? "preview",
@@ -2390,7 +2435,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2390
2435
  function B(e, t) {
2391
2436
  d("mediaChange", e, t);
2392
2437
  }
2393
- function ee(e, t) {
2438
+ function V(e, t) {
2394
2439
  d("ready", e, t);
2395
2440
  }
2396
2441
  return O(() => ({
@@ -2422,7 +2467,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2422
2467
  class: "reel-layout-main",
2423
2468
  "aria-hidden": e.infoSheetOverlay && A.value || void 0,
2424
2469
  inert: e.infoSheetOverlay && A.value || void 0
2425
- }, [u(cn, {
2470
+ }, [u(fn, {
2426
2471
  ref_key: "reelFeed",
2427
2472
  ref: p,
2428
2473
  "can-retry-end": e.canRetryEnd,
@@ -2450,7 +2495,7 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2450
2495
  onError: z,
2451
2496
  onLoadMore: r[1] ||= (e) => d("loadMore"),
2452
2497
  onMediaChange: B,
2453
- onReady: ee,
2498
+ onReady: V,
2454
2499
  onRetryEnd: r[2] ||= (e) => d("retryEnd"),
2455
2500
  onRetryForward: r[3] ||= (e) => d("retryForward"),
2456
2501
  onReelAudioChange: r[4] ||= (e) => d("reelAudioChange", e)
@@ -2476,8 +2521,8 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2476
2521
  "reel-forward",
2477
2522
  "state",
2478
2523
  "total"
2479
- ])], 8, un), u(n, { name: "vibe-info-sheet" }, {
2480
- default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", dn, [c("aside", {
2524
+ ])], 8, mn), u(n, { name: "vibe-info-sheet" }, {
2525
+ default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", hn, [c("aside", {
2481
2526
  ref_key: "sheetElement",
2482
2527
  ref: _,
2483
2528
  class: "reel-info-sheet",
@@ -2486,17 +2531,17 @@ var en = ["aria-label"], tn = /* @__PURE__ */ d({
2486
2531
  "aria-modal": e.infoSheetOverlay ? "true" : void 0,
2487
2532
  tabindex: e.infoSheetOverlay ? -1 : void 0,
2488
2533
  "data-active-post-id": T.value?.postId
2489
- }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, fn)])) : o("", !0)]),
2534
+ }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, gn)])) : o("", !0)]),
2490
2535
  _: 1
2491
- })], 10, ln));
2536
+ })], 10, pn));
2492
2537
  }
2493
2538
  });
2494
2539
  //#endregion
2495
2540
  //#region src/core/mediaLifecycle.ts
2496
- function mn(e, t, n, r, i) {
2541
+ function vn(e, t, n, r, i) {
2497
2542
  let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
2498
2543
  if (!o) return null;
2499
- let s = H(o, n), c = U(o, s);
2544
+ let s = ee(o, n), c = U(o, s);
2500
2545
  return {
2501
2546
  item: o,
2502
2547
  layout: r,
@@ -2509,7 +2554,7 @@ function mn(e, t, n, r, i) {
2509
2554
  postIndex: a
2510
2555
  };
2511
2556
  }
2512
- function hn(e, t) {
2557
+ function yn(e, t) {
2513
2558
  O(() => {
2514
2559
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
2515
2560
  return {
@@ -2519,76 +2564,90 @@ function hn(e, t) {
2519
2564
  };
2520
2565
  }, (n, r) => {
2521
2566
  if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
2522
- let i = mn(e, n.postId, n.mediaIndex, "reel", n.origin);
2567
+ let i = vn(e, n.postId, n.mediaIndex, "reel", n.origin);
2523
2568
  i && t(i);
2524
2569
  }, { flush: "sync" });
2525
2570
  }
2526
2571
  //#endregion
2527
2572
  //#region src/components/useMediaLifecycle.ts
2528
- function gn(e, t) {
2529
- let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = w(/* @__PURE__ */ new Map()), o = () => e.reelMediaSource === "preview" ? n : e.reelMediaSource === "mobile" ? a : i, s = r(() => o().value);
2530
- function c(e, t, n, r) {
2573
+ function bn(e, t) {
2574
+ 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
+ function u() {
2576
+ n.clear(), l.clear(), i.value = /* @__PURE__ */ new Map(), a.value = /* @__PURE__ */ new Map(), o.value = /* @__PURE__ */ new Map();
2577
+ }
2578
+ function d(e, t, n, r) {
2531
2579
  let i = W(t, n);
2532
2580
  e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
2533
2581
  }
2534
- function l(t, n, r, i) {
2535
- return mn(e, t, n, r, i);
2582
+ function f(t, n, r, i) {
2583
+ return vn(e, t, n, r, i);
2536
2584
  }
2537
- function u(e, n, r, i) {
2538
- let a = l(e, n, r, i);
2585
+ function p(e, n, r, i) {
2586
+ let a = f(e, n, r, i);
2539
2587
  a && t.ready(a);
2540
2588
  }
2541
- function d(e, t) {
2542
- c(n, e, t, "error");
2589
+ function m(e, t) {
2590
+ d(i, e, t, "error");
2591
+ }
2592
+ function h(e, t) {
2593
+ d(i, e, t, "ready"), p(e, t, "masonry", null);
2594
+ }
2595
+ function g(e, t) {
2596
+ d(s(), e, t, "error");
2543
2597
  }
2544
- function f(e, t) {
2545
- c(n, e, t, "ready"), u(e, t, "masonry", null);
2598
+ function _(t, n) {
2599
+ d(s(), t, n, "ready"), p(t, n, "reel", e.reelOrigin ?? "reel");
2546
2600
  }
2547
- function p(e, t) {
2548
- c(o(), e, t, "error");
2601
+ function v(e, n) {
2602
+ let r = W(e, n);
2603
+ if (l.has(r)) return;
2604
+ let i = f(e, n, "masonry", null);
2605
+ i && (l.add(r), t.visible(i));
2549
2606
  }
2550
- function m(t, n) {
2551
- c(o(), t, n, "ready"), u(t, n, "reel", e.reelOrigin ?? "reel");
2607
+ function y(e, r, i, a) {
2608
+ let o = [i, W(e, r)].join(":");
2609
+ if (n.has(o)) return;
2610
+ let s = f(e, r, i, a);
2611
+ s && (n.add(o), t.fullyVisible(s));
2552
2612
  }
2553
- function h(e, n) {
2554
- let r = l(e, n, "masonry", null);
2555
- r && t.visible(r);
2613
+ function b(e, t) {
2614
+ y(e, t, "masonry", null);
2556
2615
  }
2557
- return hn(e, t.reelChange), O(() => {
2616
+ return yn(e, t.reelChange), O(() => {
2558
2617
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
2559
2618
  return {
2560
2619
  mediaIndex: n,
2561
2620
  origin: e.reelOrigin ?? "reel",
2562
2621
  postId: t,
2563
- ready: t !== null && s.value.get(W(t, n)) === "ready"
2622
+ ready: t !== null && c.value.get(W(t, n)) === "ready"
2564
2623
  };
2565
- }, (e, n) => {
2566
- if (e.postId === null || !e.ready || n?.ready && n.postId === e.postId && n.mediaIndex === e.mediaIndex && n.origin === e.origin) return;
2567
- let r = l(e.postId, e.mediaIndex, "reel", e.origin);
2568
- r && t.visible(r);
2624
+ }, (e, t) => {
2625
+ 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);
2569
2626
  }, { flush: "post" }), {
2570
- markMasonryVisible: h,
2571
- markPreviewError: d,
2572
- markPreviewReady: f,
2573
- markReelError: p,
2574
- markReelReady: m,
2575
- originalStates: i,
2576
- previewStates: n,
2577
- reelStates: s
2627
+ markMasonryFullyVisible: b,
2628
+ markMasonryVisible: v,
2629
+ markPreviewError: m,
2630
+ markPreviewReady: h,
2631
+ markReelError: g,
2632
+ markReelReady: _,
2633
+ originalStates: a,
2634
+ previewStates: i,
2635
+ reelStates: c,
2636
+ resetMediaLifecycle: u
2578
2637
  };
2579
2638
  }
2580
2639
  //#endregion
2581
2640
  //#region src/core/reelEscapeStack.ts
2582
- var _n = [];
2583
- function vn(e) {
2584
- return _n.push(e), () => {
2585
- let t = _n.indexOf(e);
2586
- t >= 0 && _n.splice(t, 1);
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);
2587
2646
  };
2588
2647
  }
2589
- function yn(e) {
2648
+ function Cn(e) {
2590
2649
  if (!e.isActive()) return !1;
2591
- let t = _n.filter((e) => e.isActive()), n = e.element();
2650
+ let t = xn.filter((e) => e.isActive()), n = e.element();
2592
2651
  return n !== null && t.some((t) => {
2593
2652
  if (t === e) return !1;
2594
2653
  let r = t.element();
@@ -2604,14 +2663,14 @@ function yn(e) {
2604
2663
  }
2605
2664
  //#endregion
2606
2665
  //#region src/components/useReelKeyboard.ts
2607
- function bn(e) {
2666
+ function wn(e) {
2608
2667
  let t = {
2609
2668
  element: e.element,
2610
2669
  isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
2611
2670
  }, n = null;
2612
2671
  function r(n) {
2613
2672
  let r = t.isActive();
2614
- if (n.key === "Escape" && r && !yn(t)) return;
2673
+ if (n.key === "Escape" && r && !Cn(t)) return;
2615
2674
  if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
2616
2675
  n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
2617
2676
  return;
@@ -2631,14 +2690,14 @@ function bn(e) {
2631
2690
  a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
2632
2691
  }
2633
2692
  y(() => {
2634
- n = vn(t), window.addEventListener("keydown", r);
2693
+ n = Sn(t), window.addEventListener("keydown", r);
2635
2694
  }), v(() => {
2636
2695
  window.removeEventListener("keydown", r), n?.(), n = null;
2637
2696
  });
2638
2697
  }
2639
2698
  //#endregion
2640
2699
  //#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
2641
- var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2700
+ var Tn = 35, En = 420, Dn = /* @__PURE__ */ d({
2642
2701
  __name: "VibeSurface",
2643
2702
  props: {
2644
2703
  canRetryEnd: { type: Boolean },
@@ -2656,6 +2715,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2656
2715
  "activeReelChange",
2657
2716
  "closeReel",
2658
2717
  "loadMore",
2718
+ "mediaFullyVisible",
2659
2719
  "mediaReady",
2660
2720
  "mediaVisible",
2661
2721
  "openReel",
@@ -2666,110 +2726,112 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2666
2726
  "retryForward"
2667
2727
  ],
2668
2728
  setup(t, { expose: i, emit: c }) {
2669
- 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)), { markMasonryVisible: A, markPreviewError: j, markPreviewReady: M, markReelError: N, markReelReady: P, originalStates: F, previewStates: I, reelStates: L } = gn(l.state, {
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, {
2730
+ fullyVisible: (e) => d("mediaFullyVisible", e),
2670
2731
  ready: (e) => d("mediaReady", e),
2671
2732
  reelChange: (e) => d("reelMediaChange", e),
2672
2733
  visible: (e) => d("mediaVisible", e)
2673
- }), R = new Set(l.state.items.map((e) => e.postId)), z = null, B = null, ee = !1;
2674
- function U() {
2734
+ }), B = new Set(l.state.items.map((e) => e.postId)), V = null, U = null, W = !1;
2735
+ function G() {
2675
2736
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2676
2737
  }
2677
- function W() {
2678
- z !== null && cancelAnimationFrame(z), z = requestAnimationFrame(() => {
2679
- z = requestAnimationFrame(() => {
2680
- z = null, y.value = /* @__PURE__ */ new Set();
2738
+ function K() {
2739
+ V !== null && cancelAnimationFrame(V), V = requestAnimationFrame(() => {
2740
+ V = requestAnimationFrame(() => {
2741
+ V = null, y.value = /* @__PURE__ */ new Set();
2681
2742
  });
2682
2743
  });
2683
2744
  }
2684
- function G(e, t) {
2745
+ function q(e, t) {
2685
2746
  let n = l.state.items.find((t) => t.postId === e);
2686
2747
  if (!n) return;
2687
- let r = H(n, t);
2748
+ let r = ee(n, t);
2688
2749
  (l.state.mediaIndices.get(e) ?? 0) !== r && (l.state.mediaIndices = new Map(l.state.mediaIndices).set(e, r));
2689
2750
  }
2690
- async function K() {
2751
+ async function ne() {
2691
2752
  await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
2692
2753
  }
2693
- function q(e) {
2754
+ function re(e) {
2694
2755
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
2695
2756
  }
2696
- function ne(e) {
2757
+ function J(e) {
2697
2758
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
2698
2759
  }
2699
- function J(e) {
2760
+ function ie(e) {
2700
2761
  if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
2701
2762
  let t = l.state.items.find((t) => t.postId === e.postId);
2702
2763
  if (!t) return "not-found";
2703
- let n = V(t).findIndex((t) => t.mediaId === e.mediaId);
2764
+ let n = H(t).findIndex((t) => t.mediaId === e.mediaId);
2704
2765
  return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
2705
2766
  }
2706
- function re() {
2767
+ function ae() {
2707
2768
  return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
2708
2769
  }
2709
- function Y(e, t) {
2710
- B = e, ee = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
2770
+ function oe(e, t) {
2771
+ U = e, W = t === "keyboard", d("openReel", e), m(() => h.value?.focus());
2711
2772
  }
2712
- function ie(e) {
2773
+ function Y(e) {
2713
2774
  let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
2714
2775
  return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
2715
2776
  }
2716
- function ae(e, t) {
2717
- if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || U()) return 0;
2718
- let n = [...new Set(e)], r = n.filter(ie);
2777
+ function ce(e, t) {
2778
+ if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || G()) return 0;
2779
+ let n = [...new Set(e)], r = n.filter(Y);
2719
2780
  if (r.length === 0) return 0;
2720
- let i = new Map(C.value), a = t?.staggerMs ?? xn;
2781
+ let i = new Map(C.value), a = t?.staggerMs ?? Tn;
2721
2782
  return r.forEach((e, t) => {
2722
2783
  i.set(e, t * a);
2723
- }), y.value = new Set([...y.value].filter((e) => !r.includes(e))), S.value = new Set([...S.value, ...n]), C.value = i, Sn + (r.length - 1) * 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;
2724
2785
  }
2725
2786
  function X(e, t) {
2726
- let n = ie(e), r = n?.querySelector(".media-card-activator") ?? n;
2787
+ let n = Y(e), r = n?.querySelector(".media-card-activator") ?? n;
2727
2788
  r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
2728
2789
  r.classList.remove("media-card-focus-silent");
2729
2790
  }, { once: !0 }), r?.focus({ preventScroll: !0 }));
2730
2791
  }
2731
- function se() {
2732
- l.state.reelOrigin === "masonry" && (B ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
2733
- }
2734
2792
  function Z() {
2735
- let e = B, t = ee;
2736
- _.value = !1, B = null, ee = !1, m(() => {
2793
+ l.state.reelOrigin === "masonry" && (U ??= l.state.activeReelPostId, _.value = !0, d("closeReel"));
2794
+ }
2795
+ function le() {
2796
+ let e = U, t = W;
2797
+ _.value = !1, U = null, W = !1, m(() => {
2737
2798
  e !== null && X(e, t);
2738
2799
  });
2739
2800
  }
2740
- return bn({
2741
- closeMasonryReel: se,
2801
+ return wn({
2802
+ closeMasonryReel: Z,
2742
2803
  element: () => g.value,
2743
2804
  isReelLeaving: () => _.value,
2744
2805
  reelRenderer: () => p.value,
2745
2806
  setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
2746
2807
  state: l.state
2747
2808
  }), O(() => l.state.items.map((e) => e.postId), (e) => {
2748
- let t = e.filter((e) => !R.has(e)), n = new Set(e);
2749
- if (R = 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 || U()) return;
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;
2750
2811
  let r = /* @__PURE__ */ new Map();
2751
2812
  e.forEach((e) => {
2752
2813
  let t = x.value.get(e);
2753
2814
  t !== void 0 && r.set(e, t);
2754
2815
  }), t.forEach((e, t) => {
2755
- r.set(e, t * xn);
2756
- }), x.value = r, y.value = new Set([...y.value, ...t]), W();
2816
+ r.set(e, t * Tn);
2817
+ }), x.value = r, y.value = new Set([...y.value, ...t]), K();
2757
2818
  }, { flush: "sync" }), v(() => {
2758
- z !== null && cancelAnimationFrame(z);
2819
+ V !== null && cancelAnimationFrame(V);
2759
2820
  }), i({
2760
- changeActiveReelMedia: q,
2761
- getAutoScrollElement: re,
2762
- loadIfNearBottom: K,
2763
- moveActiveReelPost: ne,
2764
- navigateToReelItem: J,
2765
- startItemRemoval: ae,
2821
+ changeActiveReelMedia: re,
2822
+ getAutoScrollElement: ae,
2823
+ loadIfNearBottom: ne,
2824
+ moveActiveReelPost: J,
2825
+ navigateToReelItem: ie,
2826
+ resetMediaLifecycle: z,
2827
+ startItemRemoval: ce,
2766
2828
  transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
2767
2829
  transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
2768
2830
  }), (r, i) => (b(), s("div", {
2769
2831
  ref_key: "surfaceElement",
2770
2832
  ref: g,
2771
2833
  class: "vibe-surface"
2772
- }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(pn, {
2834
+ }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(_n, {
2773
2835
  key: 0,
2774
2836
  ref_key: "reelRenderer",
2775
2837
  ref: p,
@@ -2794,7 +2856,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2794
2856
  "info-sheet-overlay": t.state.reelInfoSheetOverlay,
2795
2857
  "next-page-error": !!t.state.nextPageError,
2796
2858
  origin: "reel",
2797
- "preview-states": E(L),
2859
+ "preview-states": E(R),
2798
2860
  "reel-auto-advance": t.state.reelAutoAdvance,
2799
2861
  "reel-audio-state": t.reelAudioState,
2800
2862
  "reel-forward": t.state.reelForward,
@@ -2802,14 +2864,14 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2802
2864
  total: t.state.total,
2803
2865
  onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
2804
2866
  onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
2805
- onError: E(N),
2867
+ onError: E(P),
2806
2868
  onLoadMore: i[2] ||= (e) => d("loadMore"),
2807
- onMediaChange: G,
2808
- onReady: E(P),
2869
+ onMediaChange: q,
2870
+ onReady: E(F),
2809
2871
  onRetryEnd: i[3] ||= (e) => d("retryEnd"),
2810
2872
  onRetryForward: i[4] ||= (e) => d("retryForward"),
2811
2873
  onReelAudioChange: i[5] ||= (e) => d("reelAudioChange", e)
2812
- }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(oe, {
2874
+ }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-audio-state.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(se, {
2813
2875
  key: 1,
2814
2876
  actions: t.feedFooterActions,
2815
2877
  "can-retry-end": t.canRetryEnd,
@@ -2822,7 +2884,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2822
2884
  "can-retry-end",
2823
2885
  "feed-footer",
2824
2886
  "state"
2825
- ])) : (b(), s(e, { key: 2 }, [u(Zt, {
2887
+ ])) : (b(), s(e, { key: 2 }, [u(tn, {
2826
2888
  ref_key: "masonryRenderer",
2827
2889
  ref: f,
2828
2890
  "can-retry-end": t.canRetryEnd,
@@ -2843,46 +2905,21 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2843
2905
  "load-more-locked": t.state.loadMoreLocked,
2844
2906
  "media-indices": t.state.mediaIndices,
2845
2907
  "next-page-error": !!t.state.nextPageError,
2846
- "preview-states": E(I),
2908
+ "preview-states": E(L),
2847
2909
  suspended: t.state.reelOrigin === "masonry" || _.value,
2848
2910
  state: D.value,
2849
2911
  total: t.state.total,
2850
- onActivate: Y,
2851
- onError: E(j),
2912
+ onActivate: oe,
2913
+ onError: E(M),
2914
+ onFullyVisible: E(A),
2852
2915
  onLoadMore: i[8] ||= (e) => d("loadMore"),
2853
- onMediaChange: G,
2854
- onReady: E(M),
2916
+ onMediaChange: q,
2917
+ onReady: E(N),
2855
2918
  onRetryEnd: i[9] ||= (e) => d("retryEnd"),
2856
- onVisible: E(A)
2857
- }, null, 8, [
2858
- "can-retry-end",
2859
- "entering-post-ids",
2860
- "entry-delays",
2861
- "leaving-post-ids",
2862
- "removal-delays",
2863
- "card-footer",
2864
- "card-header",
2865
- "feed-footer",
2866
- "feed-footer-actions",
2867
- "media-card",
2868
- "masonry",
2869
- "has-next",
2870
- "infinite-scroll",
2871
- "is-loading-more",
2872
- "items",
2873
- "load-more-locked",
2874
- "media-indices",
2875
- "next-page-error",
2876
- "preview-states",
2877
- "suspended",
2878
- "state",
2879
- "total",
2880
- "onError",
2881
- "onReady",
2882
- "onVisible"
2883
- ]), u(n, {
2919
+ onVisible: E(j)
2920
+ }, null, 8, /* @__PURE__ */ "can-retry-end.entering-post-ids.entry-delays.leaving-post-ids.removal-delays.card-footer.card-header.feed-footer.feed-footer-actions.media-card.masonry.has-next.infinite-scroll.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.suspended.state.total.onError.onFullyVisible.onReady.onVisible".split(".")), u(n, {
2884
2921
  name: "vibe-reel-viewer",
2885
- onAfterLeave: Z
2922
+ onAfterLeave: le
2886
2923
  }, {
2887
2924
  default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
2888
2925
  key: 0,
@@ -2893,7 +2930,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2893
2930
  "aria-label": "Media viewer",
2894
2931
  "aria-modal": "true",
2895
2932
  tabindex: "-1"
2896
- }, [u(pn, {
2933
+ }, [u(_n, {
2897
2934
  ref_key: "reelRenderer",
2898
2935
  ref: p,
2899
2936
  "can-retry-end": t.canRetryEnd,
@@ -2917,7 +2954,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2917
2954
  "media-source": "original",
2918
2955
  "next-page-error": !!t.state.nextPageError,
2919
2956
  origin: "masonry",
2920
- "preview-states": E(F),
2957
+ "preview-states": E(I),
2921
2958
  "reel-auto-advance": t.state.reelAutoAdvance,
2922
2959
  "reel-audio-state": t.reelAudioState,
2923
2960
  "reel-forward": t.state.reelForward,
@@ -2925,10 +2962,10 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2925
2962
  total: t.state.total,
2926
2963
  onActiveChange: i[10] ||= (e) => d("activeReelChange", e),
2927
2964
  onCloseInfoSheet: i[11] ||= (e) => d("reelInfoSheetChange", !1),
2928
- onError: E(N),
2965
+ onError: E(P),
2929
2966
  onLoadMore: i[12] ||= (e) => d("loadMore"),
2930
- onMediaChange: G,
2931
- onReady: E(P),
2967
+ onMediaChange: q,
2968
+ onReady: E(F),
2932
2969
  onRetryEnd: i[13] ||= (e) => d("retryEnd"),
2933
2970
  onRetryForward: i[14] ||= (e) => d("retryForward"),
2934
2971
  onReelAudioChange: i[15] ||= (e) => d("reelAudioChange", e)
@@ -2939,7 +2976,7 @@ var xn = 35, Sn = 420, Cn = /* @__PURE__ */ d({
2939
2976
  });
2940
2977
  //#endregion
2941
2978
  //#region src/core/page.ts
2942
- function wn(e) {
2979
+ function On(e) {
2943
2980
  if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
2944
2981
  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.");
2945
2982
  if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
@@ -2950,22 +2987,22 @@ function $(e, t) {
2950
2987
  let n = new Set(e.map((e) => e.postId));
2951
2988
  return [...e, ...t.filter((e) => n.has(e.postId) ? !1 : (n.add(e.postId), !0))];
2952
2989
  }
2953
- function Tn(e) {
2990
+ function kn(e) {
2954
2991
  return `${typeof e}:${String(e)}`;
2955
2992
  }
2956
- function En(e) {
2957
- return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${Tn(e.mediaId)}`;
2993
+ function An(e) {
2994
+ return e.mediaId === void 0 ? `source:${e.src}\u0000${e.preview?.src ?? ""}` : `id:${kn(e.mediaId)}`;
2958
2995
  }
2959
- function Dn(e, t) {
2960
- let n = [...e], r = new Map(e.map((e, t) => [Tn(e.postId), t]));
2996
+ function jn(e, t) {
2997
+ let n = [...e], r = new Map(e.map((e, t) => [kn(e.postId), t]));
2961
2998
  return t.forEach((e) => {
2962
- let t = Tn(e.postId), i = r.get(t);
2999
+ let t = kn(e.postId), i = r.get(t);
2963
3000
  if (i === void 0) {
2964
3001
  r.set(t, n.length), n.push(e);
2965
3002
  return;
2966
3003
  }
2967
- let a = n[i], o = new Set([a, ...a.items].map(En)), s = [e, ...e.items].filter((e) => {
2968
- let t = En(e);
3004
+ let a = n[i], o = new Set([a, ...a.items].map(An)), s = [e, ...e.items].filter((e) => {
3005
+ let t = An(e);
2969
3006
  return o.has(t) ? !1 : (o.add(t), !0);
2970
3007
  });
2971
3008
  s.length > 0 && (n[i] = {
@@ -2974,14 +3011,14 @@ function Dn(e, t) {
2974
3011
  });
2975
3012
  }), n;
2976
3013
  }
2977
- function On(e) {
3014
+ function Mn(e) {
2978
3015
  return Object.prototype.hasOwnProperty.call(e, "current") ? e.current ?? null : e.next;
2979
3016
  }
2980
3017
  //#endregion
2981
3018
  //#region src/core/appendPage.ts
2982
- function kn(e, t, n, r) {
2983
- let i = wn(e), a = n.filterItems(i.items), o = On(i);
2984
- t.items = Dn(t.items, a), t.next = i.next, i.total !== void 0 && (t.total = i.total), r(o), n.recordPages([{
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([{
2985
3022
  contributionIds: a.map(({ postId: e }) => e),
2986
3023
  cursor: o,
2987
3024
  next: i.next,
@@ -2990,32 +3027,32 @@ function kn(e, t, n, r) {
2990
3027
  }
2991
3028
  //#endregion
2992
3029
  //#region src/core/requestDelay.ts
2993
- var An = 2e3, jn = 1e4, Mn = 250, Nn = {
3030
+ var Pn = 2e3, Fn = 1e4, In = 250, Ln = {
2994
3031
  delayRemainingMs: null,
2995
3032
  nextRequestAt: null
2996
3033
  };
2997
- function Pn(e, t) {
3034
+ function Rn(e, t) {
2998
3035
  return e === void 0 ? t : Math.floor(e);
2999
3036
  }
3000
- function Fn(e, t) {
3037
+ function zn(e, t) {
3001
3038
  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.`);
3002
3039
  }
3003
- function In(e, t = {}) {
3004
- let n = Pn(t.delayStepMs, An), r = Pn(t.delayMaxMs, jn);
3040
+ function Bn(e, t = {}) {
3041
+ let n = Rn(t.delayStepMs, Pn), r = Rn(t.delayMaxMs, Fn);
3005
3042
  return Math.min(Math.max(0, e) * n, r);
3006
3043
  }
3007
- function Ln(e) {
3008
- if (e == null || !Number.isFinite(e)) return { ...Nn };
3044
+ function Vn(e) {
3045
+ if (e == null || !Number.isFinite(e)) return { ...Ln };
3009
3046
  let t = Math.max(0, Math.floor(e - Date.now()));
3010
3047
  return t > 0 ? {
3011
3048
  delayRemainingMs: t,
3012
3049
  nextRequestAt: e
3013
- } : { ...Nn };
3050
+ } : { ...Ln };
3014
3051
  }
3015
- async function Rn({ delayMs: e, onChange: t, signal: n }) {
3052
+ async function Hn({ delayMs: e, onChange: t, signal: n }) {
3016
3053
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
3017
3054
  if (e <= 0) {
3018
- t({ ...Nn });
3055
+ t({ ...Ln });
3019
3056
  return;
3020
3057
  }
3021
3058
  let r = Date.now() + e;
@@ -3023,9 +3060,9 @@ async function Rn({ delayMs: e, onChange: t, signal: n }) {
3023
3060
  delayRemainingMs: e,
3024
3061
  nextRequestAt: r
3025
3062
  }), await new Promise((i, a) => {
3026
- let o = !1, s = setInterval(f, Mn), c = setTimeout(() => u(), e);
3063
+ let o = !1, s = setInterval(f, In), c = setTimeout(() => u(), e);
3027
3064
  function l() {
3028
- clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Nn });
3065
+ clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Ln });
3029
3066
  }
3030
3067
  function u(e) {
3031
3068
  o || (o = !0, l(), e ? a(e) : i());
@@ -3034,42 +3071,42 @@ async function Rn({ delayMs: e, onChange: t, signal: n }) {
3034
3071
  u(new DOMException("Aborted", "AbortError"));
3035
3072
  }
3036
3073
  function f() {
3037
- let e = Ln(r);
3074
+ let e = Vn(r);
3038
3075
  t(e), e.delayRemainingMs === null && u();
3039
3076
  }
3040
3077
  n.addEventListener("abort", d, { once: !0 });
3041
3078
  });
3042
3079
  }
3043
- var zn = class {
3080
+ var Un = class {
3044
3081
  interval = null;
3045
3082
  constructor(e) {
3046
3083
  this.onChange = e;
3047
3084
  }
3048
3085
  clear() {
3049
- this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Nn });
3086
+ this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Ln });
3050
3087
  }
3051
3088
  sync(e) {
3052
3089
  this.clear();
3053
- let t = Ln(e);
3090
+ let t = Vn(e);
3054
3091
  this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
3055
- let t = Ln(e);
3092
+ let t = Vn(e);
3056
3093
  this.onChange(t), t.delayRemainingMs === null && this.clear();
3057
- }, Mn));
3094
+ }, In));
3058
3095
  }
3059
3096
  };
3060
- function Bn(e, t = !0) {
3097
+ function Wn(e, t = !0) {
3061
3098
  return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
3062
3099
  }
3063
- function Vn(e) {
3100
+ function Gn(e) {
3064
3101
  return `${typeof e}:${String(e)}`;
3065
3102
  }
3066
- function Hn(e, t) {
3103
+ function Kn(e, t) {
3067
3104
  if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
3068
3105
  }
3069
- function Un(e) {
3106
+ function qn(e) {
3070
3107
  if (!e) return;
3071
- if (Hn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
3072
- Fn(e, "frontend autofill");
3108
+ if (Kn(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
3109
+ zn(e, "frontend autofill");
3073
3110
  let t = e.maxAdditionalPages;
3074
3111
  if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
3075
3112
  return;
@@ -3081,7 +3118,7 @@ function Un(e) {
3081
3118
  if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
3082
3119
  }
3083
3120
  }
3084
- function Wn(e, t, n = !0) {
3121
+ function Jn(e, t, n = !0) {
3085
3122
  if (!e) return {
3086
3123
  cycleId: null,
3087
3124
  delayRemainingMs: null,
@@ -3098,7 +3135,7 @@ function Wn(e, t, n = !0) {
3098
3135
  status: "idle",
3099
3136
  strategy: null
3100
3137
  };
3101
- let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Ln(r?.nextRequestAt);
3138
+ let r = e.strategy === "backend" ? t ?? (n ? e.initialSession : void 0) : void 0, i = r?.received ?? 0, a = Vn(r?.nextRequestAt);
3102
3139
  return {
3103
3140
  cycleId: r?.cycleId ?? null,
3104
3141
  ...a,
@@ -3115,7 +3152,7 @@ function Wn(e, t, n = !0) {
3115
3152
  strategy: e.strategy
3116
3153
  };
3117
3154
  }
3118
- function Gn(e) {
3155
+ function Yn(e) {
3119
3156
  return [
3120
3157
  "cancelling",
3121
3158
  "filling",
@@ -3123,9 +3160,9 @@ function Gn(e) {
3123
3160
  "waiting"
3124
3161
  ].includes(e.status);
3125
3162
  }
3126
- async function Kn(e, t, n) {
3163
+ async function Xn(e, t, n) {
3127
3164
  let r = t.autofill;
3128
- if (!Gn(r) || !r.cycleId) return;
3165
+ if (!Yn(r) || !r.cycleId) return;
3129
3166
  let i = {
3130
3167
  cycleId: r.cycleId,
3131
3168
  feedKey: r.feedKey ?? "",
@@ -3138,16 +3175,16 @@ async function Kn(e, t, n) {
3138
3175
  throw r.error = e, r.status = "error", e;
3139
3176
  }
3140
3177
  }
3141
- function qn(e, t, n) {
3178
+ function Zn(e, t, n) {
3142
3179
  return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
3143
3180
  }
3144
- async function Jn({ 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 }) {
3145
- let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Bn(s), g = t, _ = t, v = t, y = 0, b = [], x;
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;
3146
3183
  for (; y < h;) {
3147
- let e = Vn(g);
3184
+ let e = Gn(g);
3148
3185
  if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
3149
- if (m.add(e), await Rn({
3150
- delayMs: In(l + y, s),
3186
+ if (m.add(e), await Hn({
3187
+ delayMs: Bn(l + y, s),
3151
3188
  onChange: a,
3152
3189
  signal: d
3153
3190
  }), y > 0 && u()) return {
@@ -3161,7 +3198,7 @@ async function Jn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
3161
3198
  status: "paused",
3162
3199
  total: x
3163
3200
  };
3164
- let t = wn(await n({
3201
+ let t = On(await n({
3165
3202
  cursor: g,
3166
3203
  signal: d
3167
3204
  }));
@@ -3218,12 +3255,12 @@ async function Jn({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
3218
3255
  }
3219
3256
  //#endregion
3220
3257
  //#region src/core/autofillController.ts
3221
- var Yn = class {
3258
+ var $n = class {
3222
3259
  collection = null;
3223
3260
  cycle = 0;
3224
3261
  delayCountdown;
3225
3262
  constructor(e) {
3226
- this.context = e, this.delayCountdown = new zn((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
3263
+ this.context = e, this.delayCountdown = new Un((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
3227
3264
  }
3228
3265
  beginCycle() {
3229
3266
  let { options: e, state: t } = this.context;
@@ -3231,14 +3268,14 @@ var Yn = class {
3231
3268
  this.clear();
3232
3269
  let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
3233
3270
  return t.autofill = {
3234
- ...Wn(e, void 0, !1),
3271
+ ...Jn(e, void 0, !1),
3235
3272
  cycleId: n,
3236
3273
  status: "filling"
3237
3274
  }, n;
3238
3275
  }
3239
3276
  async cancel() {
3240
3277
  let { cancelRequest: e, options: t, state: n } = this.context;
3241
- await Kn(t, n, e), this.commitCollection();
3278
+ await Xn(t, n, e), this.commitCollection();
3242
3279
  }
3243
3280
  captureCollection(e, t) {
3244
3281
  t && (this.collection = e);
@@ -3266,30 +3303,30 @@ var Yn = class {
3266
3303
  requests: r.requests
3267
3304
  }), !0) : !1;
3268
3305
  }
3269
- }, Xn = 100;
3270
- function Zn(e, t) {
3306
+ }, er = 100;
3307
+ function tr(e, t) {
3271
3308
  if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
3272
3309
  }
3273
- function Qn(e, t, n) {
3310
+ function nr(e, t, n) {
3274
3311
  return Math.min(n, Math.max(t, e));
3275
3312
  }
3276
- function $n(e) {
3313
+ function rr(e) {
3277
3314
  if (!e) return;
3278
3315
  let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
3279
- if (Zn("autoScroll.minSpeedPxPerSecond", t), Zn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
3280
- e.speedPxPerSecond !== void 0 && Zn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
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);
3281
3318
  }
3282
- function er(e) {
3319
+ function ir(e) {
3283
3320
  let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
3284
3321
  return {
3285
3322
  enabled: e?.enabled ?? !1,
3286
3323
  maxSpeedPxPerSecond: n,
3287
3324
  minSpeedPxPerSecond: t,
3288
3325
  paused: !1,
3289
- speedPxPerSecond: Qn(e?.speedPxPerSecond ?? 80, t, n)
3326
+ speedPxPerSecond: nr(e?.speedPxPerSecond ?? 80, t, n)
3290
3327
  };
3291
3328
  }
3292
- var tr = class {
3329
+ var ar = class {
3293
3330
  frame = null;
3294
3331
  lastTimestamp = null;
3295
3332
  mounted = !1;
@@ -3309,9 +3346,9 @@ var tr = class {
3309
3346
  this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
3310
3347
  }
3311
3348
  setSpeed(e) {
3312
- Zn("auto-scroll speed", e);
3349
+ tr("auto-scroll speed", e);
3313
3350
  let t = this.options.state;
3314
- t.speedPxPerSecond = Qn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
3351
+ t.speedPxPerSecond = nr(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
3315
3352
  }
3316
3353
  tick = (e) => {
3317
3354
  this.frame = null;
@@ -3323,7 +3360,7 @@ var tr = class {
3323
3360
  return;
3324
3361
  }
3325
3362
  if (this.lastTimestamp !== null) {
3326
- let r = Math.min(Xn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
3363
+ let r = Math.min(er, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
3327
3364
  n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
3328
3365
  }
3329
3366
  this.lastTimestamp = e, this.schedule();
@@ -3337,13 +3374,13 @@ var tr = class {
3337
3374
  };
3338
3375
  //#endregion
3339
3376
  //#region src/core/backendAutofill.ts
3340
- async function nr(e, t, n, r) {
3377
+ async function or(e, t, n, r) {
3341
3378
  let i = await e.onUnderfilled(n);
3342
3379
  if (!r()) return;
3343
3380
  if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
3344
3381
  let a = Math.max(n.received, i.received ?? n.received);
3345
3382
  Object.assign(t.autofill, {
3346
- ...Ln(i.nextRequestAt),
3383
+ ...Vn(i.nextRequestAt),
3347
3384
  missing: Math.max(0, e.pageSize - a),
3348
3385
  received: a,
3349
3386
  sequence: i.sequence ?? 0,
@@ -3351,19 +3388,19 @@ async function nr(e, t, n, r) {
3351
3388
  status: "waiting"
3352
3389
  });
3353
3390
  }
3354
- function rr(e, t) {
3391
+ function sr(e, t) {
3355
3392
  ["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);
3356
3393
  }
3357
- function ir(e, t, n) {
3394
+ function cr(e, t, n) {
3358
3395
  let r = t.autofill;
3359
- return !qn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (rr(t, n), Object.assign(r, Ln(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);
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);
3360
3397
  }
3361
- function ar(e, t, n) {
3362
- return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Wn(e, n), rr(t, n), !0);
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);
3363
3400
  }
3364
3401
  //#endregion
3365
3402
  //#region src/core/backlogRestore.ts
3366
- async function or(e, t, n) {
3403
+ async function ur(e, t, n) {
3367
3404
  if (!e) return;
3368
3405
  let r = new AbortController();
3369
3406
  n(r);
@@ -3378,7 +3415,7 @@ async function or(e, t, n) {
3378
3415
  }
3379
3416
  //#endregion
3380
3417
  //#region src/core/initialAutofill.ts
3381
- async function sr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
3418
+ async function dr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
3382
3419
  let c = a.autofill;
3383
3420
  if (!c) return;
3384
3421
  let l = s.items.length;
@@ -3391,7 +3428,7 @@ async function sr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3391
3428
  return;
3392
3429
  }
3393
3430
  if (c.strategy === "backend") {
3394
- await nr(c, s, {
3431
+ await or(c, s, {
3395
3432
  cycleId: e,
3396
3433
  feedKey: c.feedKey,
3397
3434
  items: [...s.items],
@@ -3408,11 +3445,11 @@ async function sr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3408
3445
  s.autofill.status = "exhausted";
3409
3446
  return;
3410
3447
  }
3411
- let u = await Jn({
3448
+ let u = await Qn({
3412
3449
  existingItems: s.items,
3413
3450
  initialCursor: s.next,
3414
3451
  loadPage: a.loadPage,
3415
- maximumRequests: Bn(c, !1),
3452
+ maximumRequests: Wn(c, !1),
3416
3453
  onCollection: n,
3417
3454
  onDelayChange: (e) => {
3418
3455
  t() && Object.assign(s.autofill, e);
@@ -3435,13 +3472,13 @@ async function sr({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
3435
3472
  }
3436
3473
  //#endregion
3437
3474
  //#region src/core/fill.ts
3438
- function cr(e) {
3475
+ function fr(e) {
3439
3476
  return "items" in e ? { items: e.items } : "pages" in e ? { pages: e.pages } : { until: "end" };
3440
3477
  }
3441
- function lr(e) {
3478
+ function pr(e) {
3442
3479
  return `${typeof e}:${String(e)}`;
3443
3480
  }
3444
- function ur(e) {
3481
+ function mr(e) {
3445
3482
  if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
3446
3483
  if ("pages" in e) {
3447
3484
  if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
@@ -3454,21 +3491,21 @@ function ur(e) {
3454
3491
  if ("until" in e && e.until === "end") return { until: "end" };
3455
3492
  throw TypeError("Vibe fill target must be { items }, { pages }, or { until: 'end' }.");
3456
3493
  }
3457
- function dr(e) {
3494
+ function hr(e) {
3458
3495
  if (!e) return;
3459
3496
  if (e.strategy === "frontend") {
3460
- Fn(e, "frontend fill");
3497
+ zn(e, "frontend fill");
3461
3498
  return;
3462
3499
  }
3463
3500
  if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
3464
3501
  let t = e.initialSession;
3465
3502
  if (t) {
3466
3503
  if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
3467
- ur(t.target);
3504
+ mr(t.target);
3468
3505
  }
3469
3506
  }
3470
- function fr(e, t, n = !0) {
3471
- let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Ln(i?.nextRequestAt);
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);
3472
3509
  return {
3473
3510
  completedPages: i?.completedPages ?? 0,
3474
3511
  cycleId: i?.cycleId ?? null,
@@ -3481,10 +3518,10 @@ function fr(e, t, n = !0) {
3481
3518
  sessionId: i?.sessionId ?? null,
3482
3519
  status: i?.status ?? "idle",
3483
3520
  strategy: e?.strategy ?? null,
3484
- target: i ? cr(i.target) : null
3521
+ target: i ? fr(i.target) : null
3485
3522
  };
3486
3523
  }
3487
- function pr(e) {
3524
+ function _r(e) {
3488
3525
  return [
3489
3526
  "cancelling",
3490
3527
  "filling",
@@ -3492,7 +3529,7 @@ function pr(e) {
3492
3529
  "waiting"
3493
3530
  ].includes(e.status);
3494
3531
  }
3495
- async function mr({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
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 }) {
3496
3533
  let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
3497
3534
  if ("items" in l && f.length >= l.items) return {
3498
3535
  completedPages: m,
@@ -3504,10 +3541,10 @@ async function mr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3504
3541
  status: "complete"
3505
3542
  };
3506
3543
  for (; _ !== null;) {
3507
- let e = lr(h);
3544
+ let e = pr(h);
3508
3545
  if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
3509
- if (p.add(e), await Rn({
3510
- delayMs: In(m, o),
3546
+ if (p.add(e), await Hn({
3547
+ delayMs: Bn(m, o),
3511
3548
  onChange: i,
3512
3549
  signal: c
3513
3550
  }), m > 0 && s()) return {
@@ -3520,7 +3557,7 @@ async function mr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3520
3557
  status: "paused",
3521
3558
  total: y
3522
3559
  };
3523
- let t = wn(await n({
3560
+ let t = On(await n({
3524
3561
  cursor: h,
3525
3562
  signal: c
3526
3563
  }));
@@ -3588,12 +3625,12 @@ async function mr({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
3588
3625
  }
3589
3626
  //#endregion
3590
3627
  //#region src/core/backendFill.ts
3591
- async function hr(e, t, n, r) {
3628
+ async function yr(e, t, n, r) {
3592
3629
  let i = await e.onStart(n);
3593
3630
  if (r()) {
3594
3631
  if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
3595
3632
  Object.assign(t.fill, {
3596
- ...Ln(i.nextRequestAt),
3633
+ ...Vn(i.nextRequestAt),
3597
3634
  completedPages: i.completedPages ?? 0,
3598
3635
  received: i.received ?? 0,
3599
3636
  sequence: i.sequence ?? 0,
@@ -3602,23 +3639,23 @@ async function hr(e, t, n, r) {
3602
3639
  });
3603
3640
  }
3604
3641
  }
3605
- function gr(e, t, n) {
3642
+ function br(e, t, n) {
3606
3643
  return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
3607
3644
  }
3608
- function _r(e) {
3645
+ function xr(e) {
3609
3646
  return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
3610
3647
  }
3611
- function vr(e, t) {
3648
+ function Sr(e, t) {
3612
3649
  if (!["complete", "exhausted"].includes(t.status)) return !0;
3613
3650
  let n = e.fill.target;
3614
3651
  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;
3615
3652
  }
3616
- function yr(e, t, n) {
3653
+ function Cr(e, t, n) {
3617
3654
  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));
3618
3655
  }
3619
- function br(e, t, n, r) {
3620
- return !gr(e, t, n) || !_r(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !vr(t, n) ? !1 : (yr(t, n, r), Object.assign(t.fill, {
3621
- ...Ln(n.status === "waiting" ? n.nextRequestAt : null),
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),
3622
3659
  completedPages: n.completedPages,
3623
3660
  error: n.error ?? null,
3624
3661
  received: n.received,
@@ -3626,45 +3663,45 @@ function br(e, t, n, r) {
3626
3663
  status: n.status
3627
3664
  }), !0);
3628
3665
  }
3629
- function xr(e, t, n, r) {
3666
+ function Tr(e, t, n, r) {
3630
3667
  if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
3631
3668
  let i = t.fill;
3632
- return t.fill = fr(e, n), !_r(n) || !vr(t, n) ? (t.fill = i, !1) : (yr(t, n, r), !0);
3669
+ return t.fill = gr(e, n), !xr(n) || !Sr(t, n) ? (t.fill = i, !1) : (Cr(t, n, r), !0);
3633
3670
  }
3634
3671
  //#endregion
3635
3672
  //#region src/core/fillController.ts
3636
- var Sr = class {
3673
+ var Er = class {
3637
3674
  abortController = null;
3638
3675
  cycle = 0;
3639
3676
  delayCountdown;
3640
3677
  requestVersion = 0;
3641
3678
  collection = null;
3642
3679
  constructor(e) {
3643
- this.options = e, this.delayCountdown = new zn((e) => {
3680
+ this.options = e, this.delayCountdown = new Un((e) => {
3644
3681
  Object.assign(this.options.state.fill, e);
3645
3682
  }), this.syncBackendCountdown();
3646
3683
  }
3647
3684
  isActive() {
3648
- return pr(this.options.state.fill);
3685
+ return _r(this.options.state.fill);
3649
3686
  }
3650
3687
  applyUpdate(e) {
3651
- let t = br(this.options.fill, this.options.state, e, this.options.onLastCursor);
3688
+ let t = wr(this.options.fill, this.options.state, e, this.options.onLastCursor);
3652
3689
  return t && this.syncBackendCountdown(), t;
3653
3690
  }
3654
3691
  restoreSession(e) {
3655
- let t = xr(this.options.fill, this.options.state, e, this.options.onLastCursor);
3692
+ let t = Tr(this.options.fill, this.options.state, e, this.options.onLastCursor);
3656
3693
  return t && this.syncBackendCountdown(), t;
3657
3694
  }
3658
3695
  async start(e, t = {}) {
3659
3696
  let n = this.options.fill;
3660
3697
  if (!n) throw Error("Vibe fill is not configured.");
3661
3698
  if (this.isActive()) throw Error("Vibe fill is already active.");
3662
- let r = ur(e), i = ur(t.target ?? r), a = t.progressOffset ?? {
3699
+ let r = mr(e), i = mr(t.target ?? r), a = t.progressOffset ?? {
3663
3700
  completedPages: 0,
3664
3701
  received: 0
3665
3702
  }, o = t.cycleId ?? `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
3666
3703
  if (this.options.state.fill = {
3667
- ...fr(n, void 0, !1),
3704
+ ...gr(n, void 0, !1),
3668
3705
  completedPages: a.completedPages,
3669
3706
  cycleId: o,
3670
3707
  received: a.received,
@@ -3677,7 +3714,7 @@ var Sr = class {
3677
3714
  let s = ++this.requestVersion, c = new AbortController();
3678
3715
  this.abortController = c;
3679
3716
  try {
3680
- n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await hr(n, this.options.state, {
3717
+ n.strategy === "frontend" ? await this.startFrontend(n, r, c, s, t.prepareFrontend !== !1, a) : (await yr(n, this.options.state, {
3681
3718
  cycleId: o,
3682
3719
  feedKey: n.feedKey,
3683
3720
  items: [...this.options.state.items],
@@ -3695,7 +3732,7 @@ var Sr = class {
3695
3732
  }
3696
3733
  async cancel() {
3697
3734
  let { fill: e, state: t } = this.options;
3698
- if (!pr(t.fill) || !t.fill.cycleId) return;
3735
+ if (!_r(t.fill) || !t.fill.cycleId) return;
3699
3736
  let n = {
3700
3737
  cycleId: t.fill.cycleId,
3701
3738
  feedKey: t.fill.feedKey ?? "",
@@ -3739,7 +3776,7 @@ var Sr = class {
3739
3776
  });
3740
3777
  }
3741
3778
  reset() {
3742
- this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = fr(this.options.fill, void 0, !1), this.collection = null;
3779
+ this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = gr(this.options.fill, void 0, !1), this.collection = null;
3743
3780
  }
3744
3781
  destroy() {
3745
3782
  this.abortLocalRequest(), this.delayCountdown.clear();
@@ -3774,7 +3811,7 @@ var Sr = class {
3774
3811
  s.fill.status = "until" in t ? "complete" : "exhausted";
3775
3812
  return;
3776
3813
  }
3777
- let c = await mr({
3814
+ let c = await vr({
3778
3815
  existingItems: s.items,
3779
3816
  initialCursor: s.next,
3780
3817
  loadPage: o,
@@ -3822,7 +3859,7 @@ var Sr = class {
3822
3859
  };
3823
3860
  //#endregion
3824
3861
  //#region src/core/fillReconciliation.ts
3825
- async function Cr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3862
+ async function Dr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r, setLastCursor: i, signal: a, state: o }) {
3826
3863
  if (!e.needsReconciliation(o.items)) return "skipped";
3827
3864
  let s = await e.reconcile({
3828
3865
  existingItems: o.items,
@@ -3835,7 +3872,7 @@ async function Cr({ controller: e, isCurrent: t, loadPage: n, onDelayChange: r,
3835
3872
  }
3836
3873
  //#endregion
3837
3874
  //#region src/core/feedFooter.ts
3838
- function wr(e) {
3875
+ function Or(e) {
3839
3876
  return {
3840
3877
  cancelAutofill: () => e.cancelAutofill(),
3841
3878
  loadMore: () => e.loadNext(),
@@ -3847,46 +3884,46 @@ function wr(e) {
3847
3884
  retryFill: () => e.retryFill()
3848
3885
  };
3849
3886
  }
3850
- function Tr(e) {
3887
+ function kr(e) {
3851
3888
  if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
3852
3889
  }
3853
- function Er(e) {
3854
- e?.intervalMs !== void 0 && Tr(e.intervalMs);
3890
+ function Ar(e) {
3891
+ e?.intervalMs !== void 0 && kr(e.intervalMs);
3855
3892
  }
3856
- function Dr(e) {
3893
+ function jr(e) {
3857
3894
  return {
3858
3895
  enabled: e?.enabled ?? !1,
3859
3896
  includePostItems: e?.includePostItems ?? !1,
3860
3897
  intervalMs: e?.intervalMs ?? 5e3
3861
3898
  };
3862
3899
  }
3863
- function Or(e, t) {
3900
+ function Mr(e, t) {
3864
3901
  if (typeof t == "boolean") {
3865
3902
  e.enabled = t;
3866
3903
  return;
3867
3904
  }
3868
- Er(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);
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);
3869
3906
  }
3870
3907
  //#endregion
3871
3908
  //#region src/core/reelInfoSheet.ts
3872
- function kr(e) {
3909
+ function Nr(e) {
3873
3910
  return { enabled: e?.enabled ?? !1 };
3874
3911
  }
3875
- function Ar(e, t, n) {
3912
+ function Pr(e, t, n) {
3876
3913
  if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
3877
3914
  e.enabled = n;
3878
3915
  }
3879
3916
  //#endregion
3880
3917
  //#region src/core/initialRuntimeState.ts
3881
- function jr(e, t) {
3918
+ function Fr(e, t) {
3882
3919
  let n = e.initialPage;
3883
3920
  return {
3884
3921
  activeReelPostId: null,
3885
- autoScroll: er(e.autoScroll),
3886
- autofill: Wn(e.autofill),
3922
+ autoScroll: ir(e.autoScroll),
3923
+ autofill: Jn(e.autofill),
3887
3924
  current: n?.current ?? null,
3888
3925
  error: null,
3889
- fill: fr(e.fill),
3926
+ fill: gr(e.fill),
3890
3927
  infiniteScroll: e.infiniteScroll ?? !0,
3891
3928
  isLoading: !n,
3892
3929
  isLoadingMore: !1,
@@ -3897,14 +3934,14 @@ function jr(e, t) {
3897
3934
  next: n?.next ?? null,
3898
3935
  nextPageError: null,
3899
3936
  phoneMode: !1,
3900
- reelAutoAdvance: Dr(e.reelAutoAdvance),
3937
+ reelAutoAdvance: jr(e.reelAutoAdvance),
3901
3938
  reelForward: {
3902
3939
  error: null,
3903
3940
  status: "idle"
3904
3941
  },
3905
3942
  reelForwardIndex: null,
3906
3943
  reelForwardItem: null,
3907
- reelInfoSheet: kr(e.reelInfoSheet),
3944
+ reelInfoSheet: Nr(e.reelInfoSheet),
3908
3945
  reelInfoSheetOverlay: !1,
3909
3946
  reelMediaSource: "original",
3910
3947
  reelOrigin: null,
@@ -3913,21 +3950,21 @@ function jr(e, t) {
3913
3950
  }
3914
3951
  //#endregion
3915
3952
  //#region src/core/options.ts
3916
- function Mr(e, t) {
3953
+ function Ir(e, t) {
3917
3954
  if (t) {
3918
3955
  if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
3919
3956
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
3920
3957
  }
3921
3958
  }
3922
- function Nr(e, t) {
3959
+ function Lr(e, t) {
3923
3960
  if (t) {
3924
3961
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
3925
3962
  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.`);
3926
3963
  }
3927
3964
  }
3928
- function Pr(e) {
3929
- if ($n(e.autoScroll), Mr("cardHeader", e.cardHeader), Mr("cardFooter", e.cardFooter), Nr("header", e.mediaCard?.header), Nr("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\".");
3930
- if (Un(e.autofill), dr(e.fill), he(e.masonry), Er(e.reelAutoAdvance), e.removalReconciliation) {
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) {
3931
3968
  if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
3932
3969
  let t = e.removalReconciliation.maxReplayPages ?? 5;
3933
3970
  if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
@@ -3942,7 +3979,7 @@ function Pr(e) {
3942
3979
  if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
3943
3980
  if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
3944
3981
  }
3945
- function Fr(e) {
3982
+ function zr(e) {
3946
3983
  if (typeof e != "string") return e;
3947
3984
  if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
3948
3985
  let t = document.querySelector(e);
@@ -3951,7 +3988,7 @@ function Fr(e) {
3951
3988
  }
3952
3989
  //#endregion
3953
3990
  //#region src/core/pageRequest.ts
3954
- async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3991
+ async function Br({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3955
3992
  let u = s.autofill, d = e && u?.strategy === "frontend" && (l.autofill.status === "paused" || l.autofill.status === "error"), f = d ? {
3956
3993
  received: l.autofill.received,
3957
3994
  requests: l.autofill.requests
@@ -3963,11 +4000,11 @@ async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3963
4000
  let m = !1;
3964
4001
  try {
3965
4002
  if (u?.strategy === "frontend") {
3966
- let s = await Jn({
4003
+ let s = await Qn({
3967
4004
  existingItems: e ? l.items : [],
3968
4005
  initialCursor: n,
3969
4006
  loadPage: i,
3970
- maximumRequests: f ? Math.max(0, Bn(u) - f.requests) : void 0,
4007
+ maximumRequests: f ? Math.max(0, Wn(u) - f.requests) : void 0,
3971
4008
  onCollection: (e) => t.captureCollection(e, r()),
3972
4009
  onDelayChange: (e) => {
3973
4010
  r() && Object.assign(l.autofill, e);
@@ -3990,7 +4027,7 @@ async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3990
4027
  }), o(s.pages), t.clearCollection();
3991
4028
  return;
3992
4029
  }
3993
- let s = wn(await i({
4030
+ let s = On(await i({
3994
4031
  cursor: n,
3995
4032
  signal: c
3996
4033
  }));
@@ -4010,7 +4047,7 @@ async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, l
4010
4047
  l.autofill.status = "complete";
4011
4048
  return;
4012
4049
  }
4013
- await nr(u, l, {
4050
+ await or(u, l, {
4014
4051
  cycleId: p,
4015
4052
  feedKey: u.feedKey,
4016
4053
  items: h.slice(d.length),
@@ -4032,16 +4069,16 @@ async function Ir({ append: e, autofillController: t, cursor: n, isCurrent: r, l
4032
4069
  }
4033
4070
  //#endregion
4034
4071
  //#region src/core/removalReconciliationController.ts
4035
- function Lr(e) {
4072
+ function Vr(e) {
4036
4073
  return `${typeof e}:${String(e)}`;
4037
4074
  }
4038
- function Rr(e) {
4075
+ function Hr(e) {
4039
4076
  return `${typeof e}:${String(e)}`;
4040
4077
  }
4041
- function zr(e) {
4078
+ function Ur(e) {
4042
4079
  return e.map(({ postId: e }) => e);
4043
4080
  }
4044
- var Br = class {
4081
+ var Wr = class {
4045
4082
  delay;
4046
4083
  enabled;
4047
4084
  maxReplayPages;
@@ -4060,7 +4097,7 @@ var Br = class {
4060
4097
  e.status === "complete" && (this.pages = [...this.pages.slice(0, e.replaceFrom), ...e.pages].slice(-this.maxReplayPages), this.pending = null);
4061
4098
  }
4062
4099
  filterItems(e) {
4063
- return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(Lr(e)));
4100
+ return this.tombstones.size === 0 ? [...e] : e.filter(({ postId: e }) => !this.tombstones.has(Vr(e)));
4064
4101
  }
4065
4102
  needsReconciliation(e) {
4066
4103
  return this.pending !== null || this.findUnderfilledPage(e) >= 0;
@@ -4073,45 +4110,45 @@ var Br = class {
4073
4110
  }
4074
4111
  recordInitialPage(e) {
4075
4112
  e && this.recordPages([{
4076
- contributionIds: zr(e.items),
4077
- cursor: On(e),
4113
+ contributionIds: Ur(e.items),
4114
+ cursor: Mn(e),
4078
4115
  next: e.next,
4079
- returnedIds: zr(e.items)
4116
+ returnedIds: Ur(e.items)
4080
4117
  }]);
4081
4118
  }
4082
4119
  remove(e) {
4083
- e.forEach((e) => this.tombstones.add(Lr(e)));
4120
+ e.forEach((e) => this.tombstones.add(Vr(e)));
4084
4121
  }
4085
4122
  reset() {
4086
4123
  this.pages = [], this.pending = null, this.tombstones.clear();
4087
4124
  }
4088
4125
  restore(e) {
4089
- e.forEach((e) => this.tombstones.delete(Lr(e)));
4126
+ e.forEach((e) => this.tombstones.delete(Vr(e)));
4090
4127
  }
4091
4128
  async reconcile({ existingItems: e, loadPage: t, onDelayChange: n = () => void 0, shouldPause: r = () => !1, signal: i }) {
4092
4129
  let a = this.pending ?? this.createSession(e);
4093
4130
  for (this.pending = a; a.remainingRequests > 0;) {
4094
- let e = Rr(a.cursor);
4131
+ let e = Hr(a.cursor);
4095
4132
  if (a.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
4096
- if (await Rn({
4097
- delayMs: In(a.pages.length, this.delay),
4133
+ if (await Hn({
4134
+ delayMs: Bn(a.pages.length, this.delay),
4098
4135
  onChange: n,
4099
4136
  signal: i
4100
4137
  }), a.pages.length > 0 && r()) return this.result(a, "paused");
4101
- let o = wn(await t({
4138
+ let o = On(await t({
4102
4139
  cursor: a.cursor,
4103
4140
  signal: i
4104
4141
  }));
4105
4142
  a.seenCursors.add(e);
4106
4143
  let s = this.filterItems(o.items), c = [];
4107
4144
  if (s.forEach((e) => {
4108
- let t = Lr(e.postId);
4145
+ let t = Vr(e.postId);
4109
4146
  a.attributed.has(t) || (a.attributed.add(t), c.push(e.postId)), a.appended.has(t) || (a.appended.add(t), a.items.push(e));
4110
4147
  }), a.pages.push({
4111
4148
  contributionIds: c,
4112
4149
  cursor: a.cursor,
4113
4150
  next: o.next,
4114
- returnedIds: zr(s)
4151
+ returnedIds: Ur(s)
4115
4152
  }), 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");
4116
4153
  }
4117
4154
  return this.result(a, "complete");
@@ -4119,9 +4156,9 @@ var Br = class {
4119
4156
  createSession(e) {
4120
4157
  let t = this.findUnderfilledPage(e), n = t < 0 ? [] : this.pages.slice(t), r = n[0];
4121
4158
  if (!r) throw Error("Vibe has no underfilled provider page to reconcile.");
4122
- let i = new Set(n.flatMap(({ contributionIds: e }) => e.map(Lr))), a = new Set(e.map(({ postId: e }) => Lr(e)).filter((e) => !i.has(e)));
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)));
4123
4160
  return {
4124
- appended: new Set(e.map(({ postId: e }) => Lr(e))),
4161
+ appended: new Set(e.map(({ postId: e }) => Vr(e))),
4125
4162
  attributed: new Set(a),
4126
4163
  cursor: r.cursor,
4127
4164
  items: [],
@@ -4146,11 +4183,11 @@ var Br = class {
4146
4183
  }
4147
4184
  findUnderfilledPage(e) {
4148
4185
  if (!this.enabled || this.pages.length === 0) return -1;
4149
- let t = new Set(e.map(({ postId: e }) => Lr(e)));
4150
- return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has(Lr(e))).length < this.pageSize);
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);
4151
4188
  }
4152
4189
  recordPage(e) {
4153
- let t = Rr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Rr(e) === t);
4190
+ let t = Hr(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Hr(e) === t);
4154
4191
  n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
4155
4192
  ...e,
4156
4193
  contributionIds: [...e.contributionIds],
@@ -4160,7 +4197,7 @@ var Br = class {
4160
4197
  };
4161
4198
  //#endregion
4162
4199
  //#region src/core/activeItemRemoval.ts
4163
- function Vr(e, t, n, r, i) {
4200
+ function Gr(e, t, n, r, i) {
4164
4201
  let a = new Set(t.map(({ item: e }) => e.postId));
4165
4202
  if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
4166
4203
  let o = e.items[Math.max(n, 0)];
@@ -4173,7 +4210,7 @@ function Vr(e, t, n, r, i) {
4173
4210
  }
4174
4211
  //#endregion
4175
4212
  //#region src/core/exactMediaRemovalController.ts
4176
- function Hr(e, t) {
4213
+ function Kr(e, t) {
4177
4214
  let [n, ...r] = t;
4178
4215
  if (!n) throw Error("Vibe items must contain at least one media asset.");
4179
4216
  return {
@@ -4182,10 +4219,10 @@ function Hr(e, t) {
4182
4219
  items: r
4183
4220
  };
4184
4221
  }
4185
- function Ur(e) {
4222
+ function qr(e) {
4186
4223
  if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
4187
4224
  }
4188
- var Wr = class {
4225
+ var Jr = class {
4189
4226
  generation = 0;
4190
4227
  metadata = /* @__PURE__ */ new WeakMap();
4191
4228
  state;
@@ -4193,10 +4230,10 @@ var Wr = class {
4193
4230
  this.options = e, this.state = e.state;
4194
4231
  }
4195
4232
  remove(e) {
4196
- Ur(e);
4233
+ qr(e);
4197
4234
  let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
4198
4235
  if (!n) return null;
4199
- let r = [...V(n)], i = r[e.mediaIndex];
4236
+ let r = [...H(n)], i = r[e.mediaIndex];
4200
4237
  if (!i) return null;
4201
4238
  let a = Object.freeze({
4202
4239
  media: i,
@@ -4210,7 +4247,7 @@ var Wr = class {
4210
4247
  restored: !1
4211
4248
  });
4212
4249
  let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
4213
- return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Hr(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);
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);
4214
4251
  }
4215
4252
  reset() {
4216
4253
  this.generation += 1;
@@ -4235,32 +4272,32 @@ var Wr = class {
4235
4272
  return this.state.layout === "reel" || this.state.reelOrigin === "masonry";
4236
4273
  }
4237
4274
  restoreIntoPost(e, t) {
4238
- let n = this.state.items[e], r = [...V(n)], i = Math.min(t.mediaIndex, r.length);
4239
- if (r.splice(i, 0, t.media), this.state.items[e] = Hr(n, r), this.state.activeReelPostId !== t.postId) return;
4275
+ 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;
4240
4277
  let a = this.state.mediaIndices.get(t.postId) ?? 0;
4241
4278
  a >= i && this.state.mediaIndices.set(t.postId, a + 1);
4242
4279
  }
4243
4280
  updateMediaIndexAfterRemoval(e, t, n) {
4244
4281
  let r = this.state.items.find((t) => t.postId === e);
4245
4282
  if (!r) return;
4246
- let i = V(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
4283
+ let i = H(r).length, a = this.state.mediaIndices.get(e) ?? 0, o = a;
4247
4284
  n ? o = t < i ? t : 0 : t < a && (o = a - 1), this.state.mediaIndices.set(e, Math.min(o, i - 1));
4248
4285
  }
4249
4286
  };
4250
4287
  //#endregion
4251
4288
  //#region src/core/itemPlacement.ts
4252
- function Gr(e, t) {
4289
+ function Yr(e, t) {
4253
4290
  let n = new Set(t);
4254
4291
  return e.flatMap((e, t) => n.has(e.postId) ? [{
4255
4292
  index: t,
4256
4293
  item: e
4257
4294
  }] : []);
4258
4295
  }
4259
- function Kr(e, t) {
4296
+ function Xr(e, t) {
4260
4297
  let n = new Set(t.map(({ item: e }) => e.postId));
4261
4298
  return e.filter((e) => !n.has(e.postId));
4262
4299
  }
4263
- function qr(e, t) {
4300
+ function Zr(e, t) {
4264
4301
  t.forEach(({ index: e }) => {
4265
4302
  if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
4266
4303
  });
@@ -4271,7 +4308,7 @@ function qr(e, t) {
4271
4308
  }
4272
4309
  //#endregion
4273
4310
  //#region src/core/itemRemovalController.ts
4274
- var Jr = 20, Yr = class {
4311
+ var Qr = 20, $r = class {
4275
4312
  generation = 0;
4276
4313
  historyLimit;
4277
4314
  metadata = /* @__PURE__ */ new WeakMap();
@@ -4280,7 +4317,7 @@ var Jr = 20, Yr = class {
4280
4317
  itemOrder;
4281
4318
  stopItemsWatcher;
4282
4319
  constructor(e) {
4283
- this.options = e, this.historyLimit = e.historyLimit ?? Jr, 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" });
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" });
4284
4321
  }
4285
4322
  destroy() {
4286
4323
  this.reset(), this.stopItemsWatcher();
@@ -4294,7 +4331,7 @@ var Jr = 20, Yr = class {
4294
4331
  let a = this.options.startRemoval(i, t);
4295
4332
  if (a > 0 && await new Promise((e) => setTimeout(e, a)), this.metadata.get(r)?.generation !== this.generation) return r;
4296
4333
  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);
4297
- return this.state.items = Kr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
4334
+ return this.state.items = Xr(this.state.items, n), this.options.onItemsRemoved(r, n, l), this.record(r), r;
4298
4335
  }
4299
4336
  reset() {
4300
4337
  this.generation += 1, this.history = [], this.itemOrder = [];
@@ -4305,7 +4342,7 @@ var Jr = 20, Yr = class {
4305
4342
  this.restoreRemoval(t);
4306
4343
  return;
4307
4344
  }
4308
- 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 = qr(this.state.items, r);
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);
4309
4346
  this.registerExternalPlacements(r), this.state.items = i, r.length > 0 && this.options.onRemovalRestored(r);
4310
4347
  }
4311
4348
  restoreRemoval(e) {
@@ -4331,7 +4368,7 @@ var Jr = 20, Yr = class {
4331
4368
  }
4332
4369
  collectOrderedPlacements(e) {
4333
4370
  let t = new Map(this.itemOrder.map((e, t) => [e, t]));
4334
- return Gr(this.state.items, e).map((e) => ({
4371
+ return Yr(this.state.items, e).map((e) => ({
4335
4372
  index: t.get(e.item.postId) ?? e.index,
4336
4373
  item: e.item
4337
4374
  }));
@@ -4362,7 +4399,7 @@ var Jr = 20, Yr = class {
4362
4399
  let r = new Map(this.itemOrder.map((e, t) => [e, t]));
4363
4400
  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;
4364
4401
  }
4365
- }, Xr = class {
4402
+ }, ei = class {
4366
4403
  forward = null;
4367
4404
  forwardPromise = null;
4368
4405
  forwardVersion = 0;
@@ -4449,7 +4486,7 @@ var Jr = 20, Yr = class {
4449
4486
  }
4450
4487
  }
4451
4488
  }
4452
- }, Zr = class {
4489
+ }, ti = class {
4453
4490
  generation = 0;
4454
4491
  pending = Promise.resolve();
4455
4492
  constructor(e) {
@@ -4466,7 +4503,7 @@ var Jr = 20, Yr = class {
4466
4503
  if (!n) return;
4467
4504
  let r = t.mediaIndices.get(e.postId) ?? 0;
4468
4505
  if (e.mediaIndex === r) {
4469
- if (V(n).length > 1) {
4506
+ if (H(n).length > 1) {
4470
4507
  await this.options.transitionMedia(1);
4471
4508
  return;
4472
4509
  }
@@ -4499,24 +4536,24 @@ var Jr = 20, Yr = class {
4499
4536
  };
4500
4537
  //#endregion
4501
4538
  //#region src/core/removalControllers.ts
4502
- function Qr(e) {
4503
- let t = new Xr(e), n = new Zr({
4539
+ function ni(e) {
4540
+ let t = new ei(e), n = new ti({
4504
4541
  state: e.state,
4505
4542
  transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
4506
4543
  transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
4507
4544
  });
4508
4545
  return {
4509
- exactMediaRemoval: new Wr({
4546
+ exactMediaRemoval: new Jr({
4510
4547
  onActivate: e.onActivate,
4511
4548
  onPostRemoved: (t) => e.onItemsRemoved([t]),
4512
4549
  onPostRestored: (t) => e.onItemsRestored([t]),
4513
4550
  reelForward: t,
4514
4551
  state: e.state
4515
4552
  }),
4516
- itemRemoval: new Yr({
4553
+ itemRemoval: new $r({
4517
4554
  historyLimit: e.historyLimit,
4518
4555
  onItemsRemoved: (n, r, i) => {
4519
- e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Vr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4556
+ e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Gr(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
4520
4557
  },
4521
4558
  onRemovalRestored: (n) => {
4522
4559
  e.onItemsRestored(n.map(({ item: e }) => e.postId));
@@ -4531,17 +4568,17 @@ function Qr(e) {
4531
4568
  reelRemoval: n
4532
4569
  };
4533
4570
  }
4534
- var $r = 1.5;
4535
- function ei(e) {
4571
+ var ri = 1.5;
4572
+ function ii(e) {
4536
4573
  let t = Math.min(e.screenWidth, e.screenHeight);
4537
4574
  if (t > 0 && t < 600) return !0;
4538
- let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * $r;
4575
+ let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * ri;
4539
4576
  return !e.hasHover && n > 0 && n < 600 && r;
4540
4577
  }
4541
- function ti(e) {
4542
- return ei(e) ? "reel" : "masonry";
4578
+ function ai(e) {
4579
+ return ii(e) ? "reel" : "masonry";
4543
4580
  }
4544
- function ni(e) {
4581
+ function oi(e) {
4545
4582
  let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
4546
4583
  return {
4547
4584
  hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
@@ -4551,15 +4588,15 @@ function ni(e) {
4551
4588
  viewportWidth: n.clientWidth
4552
4589
  };
4553
4590
  }
4554
- function ri(e) {
4555
- return ei(ni(e));
4591
+ function si(e) {
4592
+ return ii(oi(e));
4556
4593
  }
4557
- function ii(e) {
4558
- return ti(ni(e));
4594
+ function ci(e) {
4595
+ return ai(oi(e));
4559
4596
  }
4560
4597
  //#endregion
4561
4598
  //#region src/core/responsiveLayoutController.ts
4562
- var ai = class {
4599
+ var li = class {
4563
4600
  layoutMode;
4564
4601
  resizeObserver = null;
4565
4602
  target = null;
@@ -4584,13 +4621,13 @@ var ai = class {
4584
4621
  }
4585
4622
  handleResponsiveLayout = () => {
4586
4623
  if (!this.target) return;
4587
- let e = ii(this.target);
4588
- this.state.phoneMode = ri(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = this.state.phoneMode ? "mobile" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
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);
4589
4626
  };
4590
- }, oi = class {
4627
+ }, ui = class {
4591
4628
  state;
4592
4629
  constructor(e) {
4593
- this.options = e, this.state = x(Tt({
4630
+ this.options = e, this.state = x(Ot({
4594
4631
  ...e.initialReelAudioState,
4595
4632
  muted: e.initialReelAudioState?.muted ?? e.mediaCard?.videoMuted ?? !1
4596
4633
  }));
@@ -4599,9 +4636,9 @@ var ai = class {
4599
4636
  return { ...this.state };
4600
4637
  }
4601
4638
  set(e, t = !1) {
4602
- Object.assign(this.state, Tt(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
4639
+ Object.assign(this.state, Ot(e, this.state)), t && this.options.onReelAudioStateChange?.(this.get());
4603
4640
  }
4604
- }, si = class {
4641
+ }, di = class {
4605
4642
  routedReelPostId = null;
4606
4643
  reelRouteIsActive = !1;
4607
4644
  constructor(e, t) {
@@ -4631,30 +4668,30 @@ var ai = class {
4631
4668
  };
4632
4669
  //#endregion
4633
4670
  //#region src/core/updateItems.ts
4634
- function ci(e) {
4671
+ function fi(e) {
4635
4672
  return String(e);
4636
4673
  }
4637
- function li(e, t) {
4638
- let n = V(t).length;
4674
+ function pi(e, t) {
4675
+ let n = H(t).length;
4639
4676
  (e.mediaIndices.get(t.postId) ?? 0) >= n && e.mediaIndices.set(t.postId, Math.max(0, n - 1));
4640
4677
  }
4641
- function ui(e, t) {
4678
+ function mi(e, t) {
4642
4679
  let n = /* @__PURE__ */ new Map();
4643
- if (t.forEach((e) => n.set(ci(e.postId), e)), n.size === 0) return [];
4680
+ if (t.forEach((e) => n.set(fi(e.postId), e)), n.size === 0) return [];
4644
4681
  let r = [], i = e.items.map((t) => {
4645
- let i = n.get(ci(t.postId));
4682
+ let i = n.get(fi(t.postId));
4646
4683
  if (!i) return t;
4647
4684
  let a = {
4648
4685
  ...i,
4649
4686
  postId: t.postId
4650
4687
  };
4651
- return li(e, a), e.reelForwardItem && ci(e.reelForwardItem.postId) === ci(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
4688
+ return pi(e, a), e.reelForwardItem && fi(e.reelForwardItem.postId) === fi(t.postId) && (e.reelForwardItem = a), r.push(t.postId), a;
4652
4689
  });
4653
4690
  return r.length > 0 && (e.items = i), r;
4654
4691
  }
4655
4692
  //#endregion
4656
4693
  //#region src/core/createVibe.ts
4657
- var di = class {
4694
+ var hi = class {
4658
4695
  app = null;
4659
4696
  autoScroll;
4660
4697
  autofillController;
@@ -4677,24 +4714,24 @@ var di = class {
4677
4714
  reelAudio;
4678
4715
  state;
4679
4716
  constructor(e) {
4680
- this.options = e, Pr(e);
4717
+ this.options = e, Rr(e);
4681
4718
  let t = e.layout ?? "masonry";
4682
- this.state = x(jr(e, t)), this.reelAudio = new oi(e), this.lastLoadedCursor = e.initialPage ? On(e.initialPage) : null, this.notificationItems = G(this.state), this.autoScroll = new tr({
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({
4683
4720
  getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
4684
4721
  state: this.state.autoScroll
4685
- }), this.autofillController = new Yn({
4722
+ }), this.autofillController = new $n({
4686
4723
  cancelRequest: () => this.cancelRequest(),
4687
4724
  onLastCursor: (e) => this.setCurrentCursor(e),
4688
4725
  onPages: (e) => this.removalReconciliation.recordPages(e),
4689
4726
  options: e.autofill,
4690
4727
  state: this.state
4691
- }), this.removalReconciliation = new Br(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Sr({
4728
+ }), this.removalReconciliation = new Wr(e), this.removalReconciliation.recordInitialPage(e.initialPage), this.fillController = new Er({
4692
4729
  fill: e.fill,
4693
4730
  loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
4694
4731
  needsFrontendPreparation: () => this.removalReconciliation.needsReconciliation(this.state.items),
4695
4732
  onLastCursor: (e) => this.setCurrentCursor(e),
4696
4733
  onPages: (e) => this.removalReconciliation.recordPages(e),
4697
- prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Cr({
4734
+ prepareFrontend: ({ isCurrent: t, onDelayChange: n, signal: r }) => Dr({
4698
4735
  controller: this.removalReconciliation,
4699
4736
  isCurrent: t,
4700
4737
  loadPage: e.loadPage,
@@ -4704,8 +4741,8 @@ var di = class {
4704
4741
  state: this.state
4705
4742
  }),
4706
4743
  state: this.state
4707
- }), this.routing = new si(e.routing, this.state);
4708
- let n = Qr({
4744
+ }), this.routing = new di(e.routing, this.state);
4745
+ let n = ni({
4709
4746
  historyLimit: e.removalHistoryLimit,
4710
4747
  onActivate: (e) => this.setActiveReelPost(e),
4711
4748
  onItemsRemoved: (e) => this.removalReconciliation.remove(e),
@@ -4714,22 +4751,23 @@ var di = class {
4714
4751
  state: this.state,
4715
4752
  surface: () => this.surface
4716
4753
  });
4717
- this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new ai(t, this.state, () => {
4754
+ this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new li(t, this.state, () => {
4718
4755
  this.routing.syncFeed();
4719
4756
  }), this.startStateNotifications();
4720
4757
  }
4721
4758
  async mount() {
4722
4759
  if (this.app) throw Error("Vibe is already mounted.");
4723
4760
  this.startStateNotifications();
4724
- let e = Fr(this.options.target);
4725
- this.responsiveLayout.mount(e), this.app = i(Cn, {
4761
+ let e = zr(this.options.target);
4762
+ this.responsiveLayout.mount(e), this.app = i(Dn, {
4726
4763
  canRetryEnd: !!this.options.loadPage,
4727
4764
  cardFooter: this.options.cardFooter,
4728
4765
  cardHeader: this.options.cardHeader,
4729
4766
  feedFooter: this.options.feedFooter,
4730
- feedFooterActions: wr(this),
4767
+ feedFooterActions: Or(this),
4731
4768
  mediaCard: this.options.mediaCard,
4732
4769
  masonry: this.options.masonry,
4770
+ onMediaFullyVisible: this.options.onMediaFullyVisible,
4733
4771
  onMediaReady: this.options.onMediaReady,
4734
4772
  onMediaVisible: this.options.onMediaVisible,
4735
4773
  onReelMediaChange: this.options.onReelMediaChange,
@@ -4752,7 +4790,7 @@ var di = class {
4752
4790
  onRetryForward: () => {
4753
4791
  this.retryReelForward();
4754
4792
  }
4755
- }), this.surface = this.app.mount(e), this.autoScroll.mount(), await or(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4793
+ }), this.surface = this.app.mount(e), this.autoScroll.mount(), await ur(this.options.restoreBacklog, (e) => this.appendPage(e), (e) => {
4756
4794
  this.restoreController = e;
4757
4795
  }), !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();
4758
4796
  }
@@ -4787,7 +4825,7 @@ var di = class {
4787
4825
  return this.itemRemoval.restoreRemoval(e);
4788
4826
  }
4789
4827
  updateItems(e) {
4790
- return ui(this.state, e);
4828
+ return mi(this.state, e);
4791
4829
  }
4792
4830
  retryReelForward() {
4793
4831
  return this.reelForward.retry();
@@ -4826,7 +4864,7 @@ var di = class {
4826
4864
  this.autoScroll.setSpeed(e);
4827
4865
  }
4828
4866
  applyAutofillUpdate(e) {
4829
- let t = ir(this.options.autofill, this.state, e);
4867
+ let t = cr(this.options.autofill, this.state, e);
4830
4868
  return t && this.autofillController.syncCountdown(), t;
4831
4869
  }
4832
4870
  cancelAutofill() {
@@ -4837,7 +4875,7 @@ var di = class {
4837
4875
  await this.cancelFill();
4838
4876
  return;
4839
4877
  }
4840
- if (Gn(this.state.autofill)) {
4878
+ if (Yn(this.state.autofill)) {
4841
4879
  await this.cancelAutofill();
4842
4880
  return;
4843
4881
  }
@@ -4851,12 +4889,12 @@ var di = class {
4851
4889
  }
4852
4890
  async fill(e) {
4853
4891
  if (!this.state.loadMoreLocked) {
4854
- if (this.pendingRequest || Gn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4892
+ if (this.pendingRequest || Yn(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4855
4893
  await this.fillController.start(e);
4856
4894
  }
4857
4895
  }
4858
4896
  restoreAutofillSession(e) {
4859
- let t = ar(this.options.autofill, this.state, e);
4897
+ let t = lr(this.options.autofill, this.state, e);
4860
4898
  return t && this.autofillController.syncCountdown(), t;
4861
4899
  }
4862
4900
  restoreFillSession(e) {
@@ -4866,14 +4904,14 @@ var di = class {
4866
4904
  return this.startLoadMore(() => this.loadNextSequence());
4867
4905
  }
4868
4906
  appendPage(e) {
4869
- kn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4907
+ Nn(e, this.state, this.removalReconciliation, (e) => this.setCurrentCursor(e));
4870
4908
  }
4871
4909
  replenishAfterRemoval() {
4872
4910
  return this.startLoadMore(() => this.replenishAfterRemovalSequence());
4873
4911
  }
4874
4912
  async startLoadMore(e) {
4875
4913
  if (this.pendingRequest) return this.pendingRequest;
4876
- if (this.state.loadMoreLocked || Gn(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
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;
4877
4915
  this.state.isLoadingMore = !0, this.state.nextPageError = null;
4878
4916
  let t = e();
4879
4917
  return this.pendingRequest = t, t.finally(() => {
@@ -4888,12 +4926,12 @@ var di = class {
4888
4926
  }
4889
4927
  async replaceFeed(e, t) {
4890
4928
  if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
4891
- return Gn(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Wn(this.options.autofill, void 0, !1), this.fillController.reset(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.reset(), this.removalReconciliation.reset(), this.state.error = null, this.state.current = null, this.state.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
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);
4892
4930
  }
4893
4931
  async loadFilteredPage(e) {
4894
4932
  let t = this.options.loadPage;
4895
4933
  if (!t) throw Error("Vibe cannot load a page without loadPage.");
4896
- let n = wn(await t(e));
4934
+ let n = On(await t(e));
4897
4935
  return {
4898
4936
  ...n,
4899
4937
  items: this.removalReconciliation.filterItems(n.items)
@@ -4912,7 +4950,7 @@ var di = class {
4912
4950
  let t = ++this.requestVersion, n = new AbortController();
4913
4951
  this.abortController = n;
4914
4952
  try {
4915
- let r = await Cr({
4953
+ let r = await Dr({
4916
4954
  controller: this.removalReconciliation,
4917
4955
  isCurrent: () => t === this.requestVersion,
4918
4956
  loadPage: e,
@@ -4930,7 +4968,7 @@ var di = class {
4930
4968
  }
4931
4969
  async retryEnd() {
4932
4970
  if (this.pendingRequest) return this.pendingRequest;
4933
- if (!this.state.loadMoreLocked && !(Gn(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);
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);
4934
4972
  }
4935
4973
  setInfiniteScroll(e) {
4936
4974
  this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
@@ -4954,10 +4992,10 @@ var di = class {
4954
4992
  this.state.total = e;
4955
4993
  }
4956
4994
  setReelAutoAdvance(e) {
4957
- Or(this.state.reelAutoAdvance, e);
4995
+ Mr(this.state.reelAutoAdvance, e);
4958
4996
  }
4959
4997
  setReelInfoSheet(e) {
4960
- Ar(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4998
+ Pr(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4961
4999
  }
4962
5000
  setLayout(e) {
4963
5001
  this.responsiveLayout.setLayout(e);
@@ -4977,7 +5015,7 @@ var di = class {
4977
5015
  async fetchPage(e, t) {
4978
5016
  if (!this.options.loadPage) return;
4979
5017
  let n = ++this.requestVersion, r = new AbortController();
4980
- this.abortController = r, await Ir({
5018
+ this.abortController = r, await Br({
4981
5019
  append: t,
4982
5020
  autofillController: this.autofillController,
4983
5021
  cursor: e,
@@ -4999,7 +5037,7 @@ var di = class {
4999
5037
  startInitialAutofill() {
5000
5038
  let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
5001
5039
  this.abortController = t, this.state.isLoadingMore = !0;
5002
- let r = sr({
5040
+ let r = dr({
5003
5041
  cycleId: n,
5004
5042
  isCurrent: () => e === this.requestVersion,
5005
5043
  onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
@@ -5026,8 +5064,8 @@ var di = class {
5026
5064
  this.lastLoadedCursor = e, this.state.current = e;
5027
5065
  }
5028
5066
  };
5029
- function fi(e) {
5030
- return new di(e);
5067
+ function gi(e) {
5068
+ return new hi(e);
5031
5069
  }
5032
5070
  //#endregion
5033
- export { fi as createVibe };
5071
+ export { gi as createVibe };