@wyxos/vibe 5.3.0 → 5.4.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
@@ -15,6 +15,9 @@ function F(e, t) {
15
15
  //#endregion
16
16
  //#region src/core/runtime.ts
17
17
  function I(e) {
18
+ return r(() => Object.freeze([...e.items]));
19
+ }
20
+ function L(e, t = [...e.items]) {
18
21
  return {
19
22
  activeReelPostId: e.activeReelPostId,
20
23
  autoScroll: { ...e.autoScroll },
@@ -27,7 +30,7 @@ function I(e) {
27
30
  infiniteScroll: e.infiniteScroll,
28
31
  isLoading: e.isLoading,
29
32
  isLoadingMore: e.isLoadingMore,
30
- items: [...e.items],
33
+ items: t,
31
34
  layout: e.layout,
32
35
  lifecycle: e.isLoading || e.isLoadingMore ? "loading" : e.error || e.nextPageError ? "error" : "loaded",
33
36
  loadMoreLocked: e.loadMoreLocked,
@@ -43,17 +46,17 @@ function I(e) {
43
46
  }
44
47
  //#endregion
45
48
  //#region src/components/GalleryFooter.vue?vue&type=script&setup=true&lang.ts
46
- var L = {
49
+ var R = {
47
50
  key: 0,
48
51
  class: "gallery-footer"
49
- }, R = {
52
+ }, z = {
50
53
  key: 0,
51
54
  class: "load-more-status",
52
55
  role: "status"
53
- }, z = ["disabled"], B = {
56
+ }, B = ["disabled"], V = {
54
57
  key: 2,
55
58
  class: "end-feed"
56
- }, V = ["disabled"], H = /* @__PURE__ */ d({
59
+ }, H = ["disabled"], U = /* @__PURE__ */ d({
57
60
  __name: "GalleryFooter",
58
61
  props: {
59
62
  canRetryEnd: { type: Boolean },
@@ -69,14 +72,14 @@ var L = {
69
72
  function i() {
70
73
  n.loadMoreLocked || (n.hasNext ? r("loadMore") : r("retryEnd"));
71
74
  }
72
- return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", L, [e.isLoading ? (b(), s("p", R, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
75
+ return (t, n) => e.isLoading || e.hasError || e.hasNext && e.showLoadMore || !e.hasNext && e.canRetryEnd ? (b(), s("footer", R, [e.isLoading ? (b(), s("p", z, " Loading more… ")) : e.hasError || e.hasNext && e.showLoadMore ? (b(), s("button", {
73
76
  key: 1,
74
77
  "data-test": "load-more",
75
78
  class: "load-more-button",
76
79
  type: "button",
77
80
  disabled: e.loadMoreLocked,
78
81
  onClick: i
79
- }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, z)) : (b(), s("div", B, [n[1] ||= c("p", {
82
+ }, T(e.hasError ? "Try again" : e.loadMoreLocked ? "Loading paused" : "Load more"), 9, B)) : (b(), s("div", V, [n[1] ||= c("p", {
80
83
  class: "end-feed-message",
81
84
  role: "status"
82
85
  }, " You've reached the end. ", -1), c("button", {
@@ -85,9 +88,9 @@ var L = {
85
88
  type: "button",
86
89
  disabled: e.loadMoreLocked,
87
90
  onClick: n[0] ||= (e) => t.$emit("retryEnd")
88
- }, " Check for more ", 8, V)]))])) : o("", !0);
91
+ }, " Check for more ", 8, H)]))])) : o("", !0);
89
92
  }
90
- }), U = /* @__PURE__ */ d({
93
+ }), W = /* @__PURE__ */ d({
91
94
  __name: "FeedFooter",
92
95
  props: {
93
96
  actions: {},
@@ -124,7 +127,7 @@ var L = {
124
127
  "can-retry-end",
125
128
  "show-load-more",
126
129
  "state"
127
- ])) : (b(), a(H, {
130
+ ])) : (b(), a(U, {
128
131
  key: 1,
129
132
  "can-retry-end": e.canRetryEnd,
130
133
  "has-error": e.hasError,
@@ -143,7 +146,7 @@ var L = {
143
146
  "show-load-more"
144
147
  ]));
145
148
  }
146
- }), W = ["role"], G = { class: "gallery-status" }, ee = /* @__PURE__ */ d({
149
+ }), G = ["role"], K = { class: "gallery-status" }, ee = /* @__PURE__ */ d({
147
150
  __name: "FeedStatus",
148
151
  props: {
149
152
  actions: {},
@@ -157,7 +160,7 @@ var L = {
157
160
  return (n, u) => (b(), s("main", {
158
161
  class: "gallery-shell",
159
162
  role: r.state.error ? "alert" : r.state.isLoading ? "status" : void 0
160
- }, [c("p", G, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(U, {
163
+ }, [c("p", K, [r.state.error ? (b(), s(e, { key: 0 }, [l(" Unable to load media. ")], 64)) : r.state.isLoading ? (b(), s(e, { key: 1 }, [l(" Loading media… ")], 64)) : (b(), s(e, { key: 2 }, [l(" No media found. ")], 64))]), t.feedFooter ? (b(), a(W, {
161
164
  key: 0,
162
165
  actions: t.actions,
163
166
  "can-retry-end": t.canRetryEnd,
@@ -179,36 +182,36 @@ var L = {
179
182
  "is-loading",
180
183
  "load-more-locked",
181
184
  "state"
182
- ])) : o("", !0)], 8, W));
185
+ ])) : o("", !0)], 8, G));
183
186
  }
184
187
  });
185
- function K(e) {
188
+ function q(e) {
186
189
  return e.scrollHeight - e.scrollTop - e.clientHeight <= 240;
187
190
  }
188
191
  //#endregion
189
192
  //#region src/core/masonry.ts
190
- function q(e) {
193
+ function te(e) {
191
194
  let t = e.preview.width ?? e.width, n = e.preview.height ?? e.height;
192
195
  return !t || !n || t <= 0 || n <= 0 ? 1 : n / t;
193
196
  }
194
- function te(e) {
197
+ function J(e) {
195
198
  return e.reduce((t, n, r) => n < e[t] ? r : t, 0);
196
199
  }
197
200
  function ne(e) {
198
201
  return Math.max(0, e.containerHeight) + Math.max(0, e.gap);
199
202
  }
200
- function re(e, t) {
203
+ function Y(e, t) {
201
204
  let n = Math.max(0, t.overscan), r = t.scrollTop - n, i = t.scrollTop + Math.max(0, t.viewportHeight) + n;
202
205
  return e.reduce((e, t, n) => (t.y + t.height >= r && t.y <= i && e.push(n), e), []);
203
206
  }
204
- function ie(e, t, n) {
207
+ function re(e, t, n) {
205
208
  if (t <= 0 || e.length === 0) return {
206
209
  columns: 0,
207
210
  height: 0,
208
211
  items: []
209
212
  };
210
213
  let r = Math.max(0, n.gap), i = Number.isFinite(n.additionalHeight) ? Math.max(0, n.additionalHeight ?? 0) : 0, a = Math.max(1, n.minColumnWidth), o = Math.max(1, Math.floor((t + r) / (a + r))), s = (t - r * (o - 1)) / o, c = Array.from({ length: o }, () => 0), l = e.map((e) => {
211
- let t = te(c), n = s * q(e) + i, a = {
214
+ let t = J(c), n = s * te(e) + i, a = {
212
215
  x: t * (s + r),
213
216
  y: c[t],
214
217
  width: s,
@@ -222,12 +225,27 @@ function ie(e, t, n) {
222
225
  items: l
223
226
  };
224
227
  }
228
+ function ie(e, t) {
229
+ let n = e?.overscan?.minimumPx ?? 800, r = e?.overscan?.viewportMultiplier ?? 1.5, i = Math.max(n, t * r), a = e?.overscan?.maximumPx;
230
+ return a === void 0 ? i : Math.min(i, a);
231
+ }
232
+ function ae(e) {
233
+ let t = e?.overscan;
234
+ if (t) {
235
+ for (let [e, n] of [
236
+ ["maximumPx", t.maximumPx],
237
+ ["minimumPx", t.minimumPx],
238
+ ["viewportMultiplier", t.viewportMultiplier]
239
+ ]) if (n !== void 0 && (!Number.isFinite(n) || n < 0)) throw TypeError(`Vibe masonry overscan ${e} must be a non-negative number.`);
240
+ if (t.maximumPx !== void 0 && t.minimumPx !== void 0 && t.maximumPx < t.minimumPx) throw TypeError("Vibe masonry overscan maximumPx must be greater than or equal to minimumPx.");
241
+ }
242
+ }
225
243
  //#endregion
226
244
  //#region src/core/scrollbar.ts
227
- function ae(e, t, n) {
245
+ function oe(e, t, n) {
228
246
  return Math.min(n, Math.max(t, e));
229
247
  }
230
- function oe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
248
+ function se({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize: r, viewportSize: i }) {
231
249
  let a = Math.max(0, e), o = Math.max(0, r), s = Math.max(0, i), c = Math.max(0, a - s);
232
250
  if (!(c > 0 && o > 0)) return {
233
251
  maximumScrollPosition: c,
@@ -236,23 +254,23 @@ function oe({ contentSize: e, minimumThumbSize: t, scrollPosition: n, trackSize:
236
254
  thumbSize: o,
237
255
  thumbTravel: 0
238
256
  };
239
- let l = ae(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
257
+ let l = oe(s / a * o, Math.min(Math.max(0, t), o), o), u = Math.max(0, o - l);
240
258
  return {
241
259
  maximumScrollPosition: c,
242
260
  scrollable: !0,
243
- thumbOffset: u * (ae(n, 0, c) / c),
261
+ thumbOffset: u * (oe(n, 0, c) / c),
244
262
  thumbSize: l,
245
263
  thumbTravel: u
246
264
  };
247
265
  }
248
266
  //#endregion
249
267
  //#region src/components/GalleryScrollbar.vue?vue&type=script&setup=true&lang.ts
250
- var se = ["aria-hidden"], J = [
268
+ var ce = ["aria-hidden"], le = [
251
269
  "aria-controls",
252
270
  "aria-valuemax",
253
271
  "aria-valuenow",
254
272
  "tabindex"
255
- ], ce = 32, Y = 40, le = 120, ue = /* @__PURE__ */ d({
273
+ ], ue = 32, de = 40, fe = 120, pe = /* @__PURE__ */ d({
256
274
  __name: "GalleryScrollbar",
257
275
  props: {
258
276
  contentSize: {},
@@ -274,16 +292,16 @@ var se = ["aria-hidden"], J = [
274
292
  function k() {
275
293
  g !== null && clearTimeout(g), g = setTimeout(() => {
276
294
  g = null, o.value || (l.value = !1);
277
- }, le);
295
+ }, fe);
278
296
  }
279
297
  function A() {
280
298
  l.value = !0, k();
281
299
  }
282
300
  function j() {
283
301
  let e = t.scrollElement, r = i.value;
284
- return !e || !r ? n : oe({
302
+ return !e || !r ? n : se({
285
303
  contentSize: e.scrollHeight,
286
- minimumThumbSize: ce,
304
+ minimumThumbSize: ue,
287
305
  scrollPosition: e.scrollTop,
288
306
  trackSize: r.clientHeight,
289
307
  viewportSize: e.clientHeight
@@ -336,7 +354,7 @@ var se = ["aria-hidden"], J = [
336
354
  }
337
355
  function z(e) {
338
356
  if (!E.value) return;
339
- let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - Y : e.key === "ArrowDown" ? r + Y : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
357
+ let n = t.scrollElement?.clientHeight ?? 0, r = t.scrollElement?.scrollTop ?? 0, i = e.key === "ArrowUp" ? r - de : e.key === "ArrowDown" ? r + de : e.key === "PageUp" ? r - n : e.key === "PageDown" ? r + n : e.key === "Home" ? 0 : e.key === "End" ? a.value.maximumScrollPosition : null;
340
358
  i !== null && (e.preventDefault(), A(), P(i));
341
359
  }
342
360
  function B(e) {
@@ -382,15 +400,15 @@ var se = ["aria-hidden"], J = [
382
400
  onPointerdown: I,
383
401
  onPointermove: L,
384
402
  onPointerup: R
385
- }, null, 44, J)], 42, se));
403
+ }, null, 44, le)], 42, ce));
386
404
  }
387
- }), de = (e) => {
405
+ }), me = (e) => {
388
406
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
389
407
  return !1;
390
- }, fe = (e) => e === "", pe = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), X = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), me = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), he = (e) => {
391
- let t = me(e);
408
+ }, he = (e) => e === "", X = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ge = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), _e = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ve = (e) => {
409
+ let t = _e(e);
392
410
  return t.charAt(0).toUpperCase() + t.slice(1);
393
- }, ge = {
411
+ }, ye = {
394
412
  xmlns: "http://www.w3.org/2000/svg",
395
413
  width: 24,
396
414
  height: 24,
@@ -400,27 +418,27 @@ var se = ["aria-hidden"], J = [
400
418
  "stroke-width": 2,
401
419
  "stroke-linecap": "round",
402
420
  "stroke-linejoin": "round"
403
- }, _e = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = ge.width, color: s = ge.stroke, ...c }, { slots: l }) => p("svg", {
404
- ...ge,
421
+ }, be = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = ye.width, color: s = ye.stroke, ...c }, { slots: l }) => p("svg", {
422
+ ...ye,
405
423
  ...c,
406
424
  width: o,
407
425
  height: o,
408
426
  stroke: s,
409
- "stroke-width": fe(n) || fe(r) || n === !0 || r === !0 ? Number(i || a || ge["stroke-width"]) * 24 / Number(o) : i || a || ge["stroke-width"],
410
- class: pe("lucide", c.class, ...e ? [`lucide-${X(he(e))}-icon`, `lucide-${X(e)}`] : ["lucide-icon"]),
411
- ...!l.default && !de(c) && { "aria-hidden": "true" }
412
- }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), ve = (e, t) => (n, { slots: r, attrs: i }) => p(_e, {
427
+ "stroke-width": he(n) || he(r) || n === !0 || r === !0 ? Number(i || a || ye["stroke-width"]) * 24 / Number(o) : i || a || ye["stroke-width"],
428
+ class: X("lucide", c.class, ...e ? [`lucide-${ge(ve(e))}-icon`, `lucide-${ge(e)}`] : ["lucide-icon"]),
429
+ ...!l.default && !me(c) && { "aria-hidden": "true" }
430
+ }, [...t.map((e) => p(...e)), ...l.default ? [l.default()] : []]), xe = (e, t) => (n, { slots: r, attrs: i }) => p(be, {
413
431
  ...i,
414
432
  ...n,
415
433
  iconNode: t,
416
434
  name: e
417
- }, r), ye = ve("chevron-left", [["path", {
435
+ }, r), Se = xe("chevron-left", [["path", {
418
436
  d: "m15 18-6-6 6-6",
419
437
  key: "1wnfg3"
420
- }]]), be = ve("chevron-right", [["path", {
438
+ }]]), Ce = xe("chevron-right", [["path", {
421
439
  d: "m9 18 6-6-6-6",
422
440
  key: "mthhwq"
423
- }]]), xe = ve("pause", [["rect", {
441
+ }]]), we = xe("pause", [["rect", {
424
442
  x: "14",
425
443
  y: "3",
426
444
  width: "5",
@@ -434,10 +452,10 @@ var se = ["aria-hidden"], J = [
434
452
  height: "18",
435
453
  rx: "1",
436
454
  key: "1wsw3u"
437
- }]]), Se = ve("play", [["path", {
455
+ }]]), Te = xe("play", [["path", {
438
456
  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",
439
457
  key: "10ikf1"
440
- }]]), Ce = ve("volume-2", [
458
+ }]]), Ee = xe("volume-2", [
441
459
  ["path", {
442
460
  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",
443
461
  key: "uqj9uw"
@@ -450,7 +468,7 @@ var se = ["aria-hidden"], J = [
450
468
  d: "M19.364 18.364a9 9 0 0 0 0-12.728",
451
469
  key: "ijwkga"
452
470
  }]
453
- ]), we = ve("volume-x", [
471
+ ]), De = xe("volume-x", [
454
472
  ["path", {
455
473
  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",
456
474
  key: "uqj9uw"
@@ -469,32 +487,22 @@ var se = ["aria-hidden"], J = [
469
487
  y2: "15",
470
488
  key: "5ykzw1"
471
489
  }]
472
- ]), Te = {
490
+ ]), Oe = {
473
491
  401: "Authentication required",
474
492
  403: "Access forbidden",
475
493
  404: "Preview not found",
476
494
  419: "Session expired",
477
495
  500: "Server error"
478
496
  };
479
- function Ee(e) {
497
+ function ke(e) {
480
498
  return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1] ?? "Error";
481
499
  }
482
- function De(e) {
483
- return Te[Ee(e)] ?? "Preview unavailable";
484
- }
485
- //#endregion
486
- //#region src/core/mediaType.ts
487
- var Oe = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
488
- function ke(e) {
489
- try {
490
- return Oe.test(new URL(e).pathname);
491
- } catch {
492
- return Oe.test(e.split("?")[0] ?? e);
493
- }
500
+ function Ae(e) {
501
+ return Oe[ke(e)] ?? "Preview unavailable";
494
502
  }
495
503
  //#endregion
496
504
  //#region src/components/CardRegion.vue
497
- var Ae = /* @__PURE__ */ d({
505
+ var je = /* @__PURE__ */ d({
498
506
  __name: "CardRegion",
499
507
  props: {
500
508
  index: {},
@@ -541,18 +549,18 @@ var Ae = /* @__PURE__ */ d({
541
549
  "total"
542
550
  ]))], 38));
543
551
  }
544
- }), je = [
552
+ }), Me = [
545
553
  "max",
546
554
  "value",
547
555
  "aria-valuetext",
548
556
  "disabled"
549
- ], Me = {
557
+ ], Ne = {
550
558
  key: 0,
551
559
  class: "media-controls-row"
552
- }, Ne = ["aria-label", "title"], Pe = { class: "media-controls-audio" }, Fe = ["aria-label", "title"], Ie = ["value", "aria-valuetext"], Le = {
560
+ }, Pe = ["aria-label", "title"], Fe = { class: "media-controls-audio" }, Ie = ["aria-label", "title"], Le = ["value", "aria-valuetext"], Re = {
553
561
  class: "media-control-time",
554
562
  "aria-live": "off"
555
- }, Re = /* @__PURE__ */ d({
563
+ }, ze = /* @__PURE__ */ d({
556
564
  __name: "MediaControls",
557
565
  props: {
558
566
  currentTime: {},
@@ -600,35 +608,35 @@ var Ae = /* @__PURE__ */ d({
600
608
  "aria-valuetext": `${u(p.value)} of ${u(f.value)}`,
601
609
  disabled: f.value <= 0,
602
610
  onInput: n[0] ||= (e) => i("seek", d(e))
603
- }, null, 44, je), e.layout === "reel" ? (b(), s("div", Me, [
611
+ }, null, 44, Me), e.layout === "reel" ? (b(), s("div", Ne, [
604
612
  c("button", {
605
613
  type: "button",
606
614
  class: "media-control-button media-control-playback",
607
615
  "aria-label": e.playing ? "Pause video" : "Play video",
608
616
  title: e.playing ? "Pause" : "Play",
609
617
  onClick: n[1] ||= (e) => i("togglePlayback")
610
- }, [e.playing ? (b(), a(E(xe), {
618
+ }, [e.playing ? (b(), a(E(we), {
611
619
  key: 0,
612
620
  size: 18,
613
621
  fill: "currentColor"
614
- })) : (b(), a(E(Se), {
622
+ })) : (b(), a(E(Te), {
615
623
  key: 1,
616
624
  size: 18,
617
625
  fill: "currentColor"
618
- }))], 8, Ne),
619
- c("div", Pe, [c("button", {
626
+ }))], 8, Pe),
627
+ c("div", Fe, [c("button", {
620
628
  type: "button",
621
629
  class: "media-control-button",
622
630
  "aria-label": e.muted ? "Unmute video" : "Mute video",
623
631
  title: e.muted ? "Unmute" : "Mute",
624
632
  onClick: n[2] ||= (e) => i("toggleMute")
625
- }, [e.muted || e.volume === 0 ? (b(), a(E(we), {
633
+ }, [e.muted || e.volume === 0 ? (b(), a(E(De), {
626
634
  key: 0,
627
635
  size: 18
628
- })) : (b(), a(E(Ce), {
636
+ })) : (b(), a(E(Ee), {
629
637
  key: 1,
630
638
  size: 18
631
- }))], 8, Fe), c("input", {
639
+ }))], 8, Ie), c("input", {
632
640
  class: "media-control-range media-control-volume",
633
641
  type: "range",
634
642
  min: "0",
@@ -639,14 +647,14 @@ var Ae = /* @__PURE__ */ d({
639
647
  "aria-label": "Video volume",
640
648
  "aria-valuetext": `${Math.round(e.volume * 100)} percent`,
641
649
  onInput: n[3] ||= (e) => i("volumeChange", d(e))
642
- }, null, 44, Ie)]),
643
- c("output", Le, T(u(p.value)) + " / " + T(u(f.value)), 1)
650
+ }, null, 44, Le)]),
651
+ c("output", Re, T(u(p.value)) + " / " + T(u(f.value)), 1)
644
652
  ])) : o("", !0)], 34));
645
653
  }
646
654
  });
647
655
  //#endregion
648
656
  //#region src/components/useReelVideoActivity.ts
649
- function ze(e) {
657
+ function Be(e) {
650
658
  let t = r(() => e.layout() !== "reel" || e.active() === !0), n = r(() => t.value ? e.videoIsMuted.value : !0);
651
659
  function i() {
652
660
  if (!t.value) {
@@ -679,8 +687,30 @@ function ze(e) {
679
687
  };
680
688
  }
681
689
  //#endregion
690
+ //#region src/core/mediaType.ts
691
+ var Ve = /\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;
692
+ function He(e) {
693
+ try {
694
+ return Ve.test(new URL(e).pathname);
695
+ } catch {
696
+ return Ve.test(e.split("?")[0] ?? e);
697
+ }
698
+ }
699
+ //#endregion
700
+ //#region src/components/useMediaLoading.ts
701
+ function Ue(e) {
702
+ let t = r(() => He(e.mediaSource())), n = r(() => e.layout() === "masonry" && e.fetchPriority() === "low" ? "lazy" : "eager"), i = r(() => e.fetchPriority() === "high" ? "auto" : e.layout() === "masonry" ? "none" : "metadata");
703
+ return O(i, (t, n) => {
704
+ n !== "none" || t === "none" || m(() => e.videoElement.value?.load());
705
+ }), {
706
+ imageLoading: n,
707
+ mediaIsTimed: t,
708
+ videoPreload: i
709
+ };
710
+ }
711
+ //#endregion
682
712
  //#region src/components/MediaCard.vue?vue&type=script&setup=true&lang.ts
683
- var Be = [
713
+ var We = [
684
714
  "data-post-id",
685
715
  "data-media-index",
686
716
  "aria-hidden",
@@ -688,12 +718,12 @@ var Be = [
688
718
  "inert",
689
719
  "role",
690
720
  "tabindex"
691
- ], Ve = { class: "media-card-content" }, He = ["data-media-direction"], Ue = ["data-media-index"], We = {
721
+ ], Ge = { class: "media-card-content" }, Ke = ["data-media-direction"], qe = ["data-media-index"], Je = {
692
722
  key: 0,
693
723
  "data-test": "media-loading",
694
724
  class: "media-loading",
695
725
  "aria-hidden": "true"
696
- }, Ge = ["aria-label"], Ke = { class: "media-error-code" }, qe = [
726
+ }, Ye = ["aria-label"], Xe = { class: "media-error-code" }, Ze = [
697
727
  "src",
698
728
  "width",
699
729
  "height",
@@ -701,12 +731,13 @@ var Be = [
701
731
  "loop",
702
732
  "muted",
703
733
  "preload"
704
- ], Je = [
734
+ ], Qe = [
705
735
  "src",
706
736
  "width",
707
737
  "height",
708
- "fetchpriority"
709
- ], Ye = ["aria-label"], Xe = ["aria-label"], Ze = ["aria-label"], Qe = 40, $e = 160, et = 24, tt = /* @__PURE__ */ d({
738
+ "fetchpriority",
739
+ "loading"
740
+ ], $e = ["aria-label"], et = ["aria-label"], tt = ["aria-label"], nt = 40, rt = 160, it = 24, at = /* @__PURE__ */ d({
710
741
  __name: "MediaCard",
711
742
  props: {
712
743
  active: { type: Boolean },
@@ -742,7 +773,7 @@ var Be = [
742
773
  function S(e = !1, t = "pointer") {
743
774
  e && x("activate", t);
744
775
  }
745
- let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1), U = w(1), W = 1, { effectiveMuted: G, onPlaying: ee, playbackAllowed: K } = ze({
776
+ let C = r(() => M(l.item)), D = r(() => N(l.item, l.mediaIndex)), O = r(() => P(l.item, D.value)), F = r(() => l.mediaSource === "original" ? O.value.src : O.value.preview.src), I = r(() => l.mediaSource === "original" ? O.value.width : O.value.preview.width), L = r(() => l.mediaSource === "original" ? O.value.height : O.value.preview.height), R = w(null), z = w(0), B = w(0), V = w(l.mediaCard?.videoMuted ?? l.layout === "masonry"), H = w(!1), U = w(1), W = 1, { effectiveMuted: G, onPlaying: K, playbackAllowed: ee } = Be({
746
777
  active: () => l.active,
747
778
  layout: () => l.layout,
748
779
  videoElement: R,
@@ -752,42 +783,47 @@ var Be = [
752
783
  function te(e) {
753
784
  return e.detail === 0 ? "keyboard" : "pointer";
754
785
  }
755
- function ne(e, t) {
786
+ function J(e, t) {
756
787
  let n = C.value.length, r = (e + n) % n;
757
788
  r !== D.value && (y.value = e < D.value ? "previous" : "next", x("mediaChange", r), t && t.detail > 0 && t.currentTarget?.blur());
758
789
  }
759
- function re(e, t, n) {
790
+ function ne(e, t, n) {
760
791
  return t === 1 ? e * 16 : t === 2 ? e * n : e;
761
792
  }
762
- function ie() {
793
+ function Y() {
763
794
  f = 0, p = !1, d !== null && clearTimeout(d), d = null;
764
795
  }
765
- function ae() {
766
- d !== null && clearTimeout(d), d = setTimeout(ie, $e);
796
+ function re() {
797
+ d !== null && clearTimeout(d), d = setTimeout(Y, rt);
767
798
  }
768
- function oe(e) {
799
+ function ie(e) {
769
800
  if (C.value.length <= 1) return;
770
- let t = e.currentTarget?.clientWidth || 1, n = re(e.deltaX, e.deltaMode, t);
771
- if (n === 0 || (e.preventDefault(), ae(), p) || (f += n, Math.abs(f) < et)) return;
801
+ let t = e.currentTarget?.clientWidth || 1, n = ne(e.deltaX, e.deltaMode, t);
802
+ if (n === 0 || (e.preventDefault(), re(), p) || (f += n, Math.abs(f) < it)) return;
772
803
  let r = Math.sign(f);
773
- f = 0, p = !0, ne(D.value + r);
804
+ f = 0, p = !0, J(D.value + r);
774
805
  }
775
- function se(e) {
806
+ function ae(e) {
776
807
  let t = e.touches[0];
777
808
  l.layout !== "reel" || !t || (m = t.clientX, g = t.clientY);
778
809
  }
779
- function J(e) {
810
+ function oe(e) {
780
811
  let t = e.changedTouches[0];
781
812
  if (m === null || g === null || !t) return;
782
813
  let n = m - t.clientX, r = g - t.clientY;
783
- m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < Qe || ne(D.value + Math.sign(n)));
814
+ m = null, g = null, !(Math.abs(n) <= Math.abs(r)) && (Math.abs(n) < nt || J(D.value + Math.sign(n)));
784
815
  }
785
- let ce = r(() => ke(F.value)), Y = r(() => l.layout === "reel" && l.stationaryReelControls === !0), le = r(() => ce.value && l.previewState === "ready" && (!Y.value || !!(l.active && l.reelControlsTarget))), ue = r(() => `${l.item.postId}:${D.value}:${F.value}`);
786
- function de(e) {
787
- l.layout === "reel" && (e.stopPropagation(), fe());
816
+ let { imageLoading: se, mediaIsTimed: ce, videoPreload: le } = Ue({
817
+ fetchPriority: () => l.fetchPriority,
818
+ layout: () => l.layout,
819
+ mediaSource: () => F.value,
820
+ videoElement: R
821
+ }), ue = r(() => l.layout === "reel" && l.stationaryReelControls === !0), de = r(() => ce.value && l.previewState === "ready" && (!ue.value || !!(l.active && l.reelControlsTarget))), fe = r(() => `${l.item.postId}:${D.value}:${F.value}`);
822
+ function pe(e) {
823
+ l.layout === "reel" && (e.stopPropagation(), me());
788
824
  }
789
- async function fe() {
790
- if (!(!R.value || !K.value)) {
825
+ async function me() {
826
+ if (!(!R.value || !ee.value)) {
791
827
  if (H.value) {
792
828
  R.value.pause();
793
829
  return;
@@ -799,35 +835,35 @@ var Be = [
799
835
  }
800
836
  }
801
837
  }
802
- function pe(e) {
838
+ function he(e) {
803
839
  return Number.isFinite(e) ? Math.max(0, e) : 0;
804
840
  }
805
841
  function X(e) {
806
842
  let t = e?.currentTarget ?? R.value;
807
- t && (z.value = pe(t.currentTime), B.value = pe(t.duration), K.value && (V.value = t.muted), U.value = t.volume, t.volume > 0 && (W = t.volume));
843
+ t && (z.value = he(t.currentTime), B.value = he(t.duration), ee.value && (V.value = t.muted), U.value = t.volume, t.volume > 0 && (W = t.volume));
808
844
  }
809
- function me(e) {
845
+ function ge(e) {
810
846
  X(e), x("ready", D.value);
811
847
  }
812
- function he() {
848
+ function _e() {
813
849
  H.value = !1, x("ended", D.value);
814
850
  }
815
- function ge(e) {
851
+ function ve(e) {
816
852
  let t = R.value;
817
- !t || !Number.isFinite(e) || (t.currentTime = Math.min(pe(t.duration), Math.max(0, e)), z.value = t.currentTime);
853
+ !t || !Number.isFinite(e) || (t.currentTime = Math.min(he(t.duration), Math.max(0, e)), z.value = t.currentTime);
818
854
  }
819
- function _e(e) {
855
+ function ye(e) {
820
856
  let t = R.value;
821
857
  if (!t || !Number.isFinite(e)) return;
822
858
  let n = Math.min(1, Math.max(0, e));
823
859
  t.volume = n, t.muted = n === 0, n > 0 && (W = n), X();
824
860
  }
825
- function ve() {
861
+ function be() {
826
862
  let e = R.value;
827
863
  e && (e.muted && e.volume === 0 && (e.volume = W), e.muted = !e.muted, X());
828
864
  }
829
865
  return v(() => {
830
- ie();
866
+ Y();
831
867
  }), (r, i) => (b(), s("article", {
832
868
  "data-post-id": e.item.postId,
833
869
  "data-media-index": D.value,
@@ -845,8 +881,8 @@ var Be = [
845
881
  tabindex: e.interactive && !e.leaving && !q.value ? 0 : void 0,
846
882
  onClick: i[11] ||= (t) => S(e.interactive && !q.value, te(t)),
847
883
  onKeydown: [i[12] ||= A((t) => S(e.interactive && !q.value, "keyboard"), ["enter"]), i[13] ||= A(j((t) => S(e.interactive && !q.value, "keyboard"), ["prevent"]), ["space"])]
848
- }, [c("div", Ve, [
849
- e.cardHeader ? (b(), a(Ae, {
884
+ }, [c("div", Ge, [
885
+ e.cardHeader ? (b(), a(je, {
850
886
  key: 0,
851
887
  index: e.index,
852
888
  item: e.item,
@@ -872,22 +908,22 @@ var Be = [
872
908
  c("div", {
873
909
  class: h(["media-card-media", { "media-card-media--carousel": e.layout === "reel" && C.value.length > 1 }]),
874
910
  "data-media-direction": y.value,
875
- onWheel: oe,
876
- onTouchstartPassive: se,
877
- onTouchendPassive: J
911
+ onWheel: ie,
912
+ onTouchstartPassive: ae,
913
+ onTouchendPassive: oe
878
914
  }, [
879
915
  u(n, { name: `media-slide-${y.value}` }, {
880
916
  default: k(() => [(b(), s("div", {
881
917
  key: `${e.item.postId}:${O.value.src}:${e.mediaSource ?? "preview"}`,
882
918
  class: "media-card-frame",
883
919
  "data-media-index": D.value
884
- }, [e.previewState === "loading" ? (b(), s("div", We, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
920
+ }, [e.previewState === "loading" ? (b(), s("div", Je, [...i[14] ||= [c("span", { class: "media-loading-shimmer" }, null, -1)]])) : e.previewState === "error" ? (b(), s("div", {
885
921
  key: 1,
886
922
  "data-test": "media-error",
887
923
  class: "media-error",
888
924
  role: "img",
889
- "aria-label": `${E(Ee)(F.value)} ${E(De)(F.value)}`
890
- }, [c("strong", Ke, T(E(Ee)(F.value)), 1), c("span", null, T(E(De)(F.value)), 1)], 8, Ge)) : o("", !0), ce.value ? (b(), s("video", {
925
+ "aria-label": `${E(ke)(F.value)} ${E(Ae)(F.value)}`
926
+ }, [c("strong", Xe, T(E(ke)(F.value)), 1), c("span", null, T(E(Ae)(F.value)), 1)], 8, Ye)) : o("", !0), E(ce) ? (b(), s("video", {
891
927
  key: 2,
892
928
  ref_key: "videoElement",
893
929
  ref: R,
@@ -898,21 +934,21 @@ var Be = [
898
934
  src: F.value,
899
935
  width: I.value ?? void 0,
900
936
  height: L.value ?? void 0,
901
- autoplay: E(K),
937
+ autoplay: E(ee),
902
938
  loop: !e.advanceOnMediaEnd,
903
939
  muted: E(G),
904
940
  playsinline: "",
905
- preload: e.fetchPriority === "high" ? "auto" : "metadata",
906
- onLoadedmetadata: me,
941
+ preload: E(le),
942
+ onLoadedmetadata: ge,
907
943
  onDurationchange: X,
908
944
  onTimeupdate: X,
909
945
  onVolumechange: X,
910
- onPlaying: i[0] ||= (...e) => E(ee) && E(ee)(...e),
946
+ onPlaying: i[0] ||= (...e) => E(K) && E(K)(...e),
911
947
  onPause: i[1] ||= (e) => H.value = !1,
912
- onEnded: he,
913
- onClick: de,
948
+ onEnded: _e,
949
+ onClick: pe,
914
950
  onError: i[2] ||= (e) => r.$emit("error", D.value)
915
- }, null, 42, qe)) : (b(), s("img", {
951
+ }, null, 42, Ze)) : (b(), s("img", {
916
952
  key: 3,
917
953
  class: h(["media-preview", { "media-preview--ready": e.previewState === "ready" }]),
918
954
  src: F.value,
@@ -921,32 +957,32 @@ var Be = [
921
957
  fetchpriority: e.fetchPriority,
922
958
  alt: "",
923
959
  decoding: "async",
924
- loading: "eager",
960
+ loading: E(se),
925
961
  onLoad: i[3] ||= (e) => r.$emit("ready", D.value),
926
962
  onError: i[4] ||= (e) => r.$emit("error", D.value)
927
- }, null, 42, Je))], 8, Ue))]),
963
+ }, null, 42, Qe))], 8, qe))]),
928
964
  _: 1
929
965
  }, 8, ["name"]),
930
966
  (b(), a(t, {
931
- disabled: !Y.value || !e.reelControlsTarget,
967
+ disabled: !ue.value || !e.reelControlsTarget,
932
968
  to: e.reelControlsTarget ?? "body"
933
969
  }, [u(n, {
934
970
  name: "vibe-reel-media-controls",
935
- css: Y.value
971
+ css: ue.value
936
972
  }, {
937
- default: k(() => [le.value ? (b(), a(Re, {
938
- key: ue.value,
973
+ default: k(() => [de.value ? (b(), a(ze, {
974
+ key: fe.value,
939
975
  "current-time": z.value,
940
- "data-control-post-id": Y.value ? e.item.postId : void 0,
976
+ "data-control-post-id": ue.value ? e.item.postId : void 0,
941
977
  duration: B.value,
942
978
  layout: e.layout,
943
979
  muted: V.value,
944
980
  playing: H.value,
945
981
  volume: U.value,
946
- onSeek: ge,
947
- onToggleMute: ve,
948
- onTogglePlayback: fe,
949
- onVolumeChange: _e
982
+ onSeek: ve,
983
+ onToggleMute: be,
984
+ onTogglePlayback: me,
985
+ onVolumeChange: ye
950
986
  }, null, 8, [
951
987
  "current-time",
952
988
  "data-control-post-id",
@@ -966,15 +1002,15 @@ var Be = [
966
1002
  type: "button",
967
1003
  class: "media-carousel-control media-carousel-control--previous",
968
1004
  "aria-label": `Previous media for post ${e.item.postId}`,
969
- onClick: i[5] ||= j((e) => ne(D.value - 1, e), ["stop"]),
1005
+ onClick: i[5] ||= j((e) => J(D.value - 1, e), ["stop"]),
970
1006
  onKeydown: i[6] ||= j(() => {}, ["stop"])
971
- }, [u(E(ye), { size: 20 })], 40, Ye), c("button", {
1007
+ }, [u(E(Se), { size: 20 })], 40, $e), c("button", {
972
1008
  type: "button",
973
1009
  class: "media-carousel-control media-carousel-control--next",
974
1010
  "aria-label": `Next media for post ${e.item.postId}`,
975
- onClick: i[7] ||= j((e) => ne(D.value + 1, e), ["stop"]),
1011
+ onClick: i[7] ||= j((e) => J(D.value + 1, e), ["stop"]),
976
1012
  onKeydown: i[8] ||= j(() => {}, ["stop"])
977
- }, [u(E(be), { size: 20 })], 40, Xe)], 2)) : o("", !0),
1013
+ }, [u(E(Ce), { size: 20 })], 40, et)], 2)) : o("", !0),
978
1014
  q.value ? (b(), s("button", {
979
1015
  key: 1,
980
1016
  class: "media-card-activator",
@@ -982,9 +1018,9 @@ var Be = [
982
1018
  "aria-label": `Open post ${e.item.postId}`,
983
1019
  onClick: i[9] ||= j((e) => r.$emit("activate", te(e)), ["stop"]),
984
1020
  onKeydown: i[10] ||= j(() => {}, ["stop"])
985
- }, null, 40, Ze)) : o("", !0)
986
- ], 42, He),
987
- e.cardFooter ? (b(), a(Ae, {
1021
+ }, null, 40, tt)) : o("", !0)
1022
+ ], 42, Ke),
1023
+ e.cardFooter ? (b(), a(je, {
988
1024
  key: 1,
989
1025
  index: e.index,
990
1026
  item: e.item,
@@ -1007,15 +1043,19 @@ var Be = [
1007
1043
  "style",
1008
1044
  "total"
1009
1045
  ])) : o("", !0)
1010
- ])], 46, Be));
1046
+ ])], 46, We));
1011
1047
  }
1012
- }), nt = { class: "masonry-feed-shell" }, rt = ["aria-hidden", "inert"], it = 240, at = 6, ot = 12, st = 800, ct = 1.5, lt = /* @__PURE__ */ d({
1048
+ }), ot = { class: "masonry-feed-shell" }, st = ["aria-hidden", "inert"], ct = {
1049
+ key: 0,
1050
+ class: "masonry-feed-status-overlay"
1051
+ }, lt = 240, ut = 6, dt = 12, ft = /* @__PURE__ */ d({
1013
1052
  __name: "MasonryFeed",
1014
1053
  props: {
1015
1054
  enteringPostIds: {},
1016
1055
  entryDelays: {},
1017
1056
  leavingPostIds: { default: () => /* @__PURE__ */ new Set() },
1018
1057
  removalDelays: { default: () => /* @__PURE__ */ new Map() },
1058
+ masonry: {},
1019
1059
  suspended: { type: Boolean },
1020
1060
  canRetryEnd: { type: Boolean },
1021
1061
  cardFooter: {},
@@ -1044,60 +1084,60 @@ var Be = [
1044
1084
  "visible"
1045
1085
  ],
1046
1086
  setup(t, { expose: n, emit: i }) {
1047
- let o = t, l = i, d = w(null), f = `vibe-masonry-${D()}`, p = w(null), m = w(0), g = w(at), y = w(0), x = w(0), C = w(0), T = null, k = null, A = null, j = r(() => ie(o.items, m.value, {
1048
- additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
1049
- gap: g.value,
1050
- minColumnWidth: it
1051
- })), M = r(() => {
1052
- let e = j.value;
1053
- if (o.leavingPostIds.size === 0) return e;
1054
- let t = o.items.filter((e) => !o.leavingPostIds.has(e.postId)), n = ie(t, m.value, {
1055
- additionalHeight: (o.cardHeader?.height ?? 0) + (o.cardFooter?.height ?? 0),
1056
- gap: g.value,
1057
- minColumnWidth: it
1087
+ let l = t, d = i, f = w(null), p = `vibe-masonry-${D()}`, m = w(null), g = w(0), y = w(ut), x = w(0), C = w(0), T = w(0), k = null, A = null, j = null, M = r(() => re(l.items, g.value, {
1088
+ additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
1089
+ gap: y.value,
1090
+ minColumnWidth: lt
1091
+ })), N = r(() => {
1092
+ let e = M.value;
1093
+ if (l.leavingPostIds.size === 0) return e;
1094
+ let t = l.items.filter((e) => !l.leavingPostIds.has(e.postId)), n = re(t, g.value, {
1095
+ additionalHeight: (l.cardHeader?.height ?? 0) + (l.cardFooter?.height ?? 0),
1096
+ gap: y.value,
1097
+ minColumnWidth: lt
1058
1098
  }), r = new Map(t.map((e, t) => [e.postId, n.items[t]]));
1059
1099
  return {
1060
1100
  ...n,
1061
- items: o.items.map((t, n) => o.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
1101
+ items: l.items.map((t, n) => l.leavingPostIds.has(t.postId) ? e.items[n] : r.get(t.postId) ?? e.items[n])
1062
1102
  };
1063
- }), N = r(() => ({ height: `${o.leavingPostIds.size === 0 ? M.value.height : j.value.height}px` })), P = r(() => !o.infiniteScroll || x.value > 0 && C.value + M.value.height <= x.value + 1), I = r(() => {
1064
- if (o.suspended) return /* @__PURE__ */ new Set();
1103
+ }), P = r(() => ({ height: `${l.leavingPostIds.size === 0 ? N.value.height : M.value.height}px` })), I = r(() => !l.infiniteScroll || C.value > 0 && T.value + N.value.height <= C.value + 1), L = r(() => {
1104
+ if (l.suspended) return /* @__PURE__ */ new Set();
1065
1105
  let e = {
1066
- scrollTop: y.value - C.value,
1067
- viewportHeight: x.value
1068
- }, t = re(M.value.items, {
1106
+ scrollTop: x.value - T.value,
1107
+ viewportHeight: C.value
1108
+ }, t = Y(N.value.items, {
1069
1109
  ...e,
1070
1110
  overscan: 0
1071
- }), n = o.leavingPostIds.size === 0 ? [] : re(j.value.items, {
1111
+ }), n = l.leavingPostIds.size === 0 ? [] : Y(M.value.items, {
1072
1112
  ...e,
1073
1113
  overscan: 0
1074
1114
  });
1075
1115
  return new Set([...t, ...n]);
1076
- }), L = r(() => {
1077
- let e = Math.max(st, x.value * ct), t = {
1078
- scrollTop: y.value - C.value,
1079
- viewportHeight: x.value
1080
- }, n = re(M.value.items, {
1116
+ }), R = r(() => {
1117
+ let e = ie(l.masonry, C.value), t = {
1118
+ scrollTop: x.value - T.value,
1119
+ viewportHeight: C.value
1120
+ }, n = Y(N.value.items, {
1081
1121
  ...t,
1082
1122
  overscan: e
1083
- }), r = o.leavingPostIds.size === 0 ? [] : re(j.value.items, {
1123
+ }), r = l.leavingPostIds.size === 0 ? [] : Y(M.value.items, {
1084
1124
  ...t,
1085
1125
  overscan: e
1086
1126
  });
1087
1127
  return [...new Set([...n, ...r])].sort((e, t) => e - t).flatMap((e) => {
1088
- let t = o.items[e];
1128
+ let t = l.items[e];
1089
1129
  return t ? [{
1090
- fetchPriority: I.value.has(e) ? "high" : "low",
1130
+ fetchPriority: L.value.has(e) ? "high" : "low",
1091
1131
  index: e,
1092
1132
  item: t
1093
1133
  }] : [];
1094
1134
  });
1095
- }), R = /* @__PURE__ */ new Set();
1096
- O(() => [...I.value].flatMap((e) => {
1097
- let t = o.items[e];
1135
+ }), z = /* @__PURE__ */ new Set();
1136
+ O(() => [...L.value].flatMap((e) => {
1137
+ let t = l.items[e];
1098
1138
  if (!t) return [];
1099
- let n = o.mediaIndices.get(t.postId) ?? 0, r = F(t.postId, n);
1100
- return o.previewStates.get(r) === "ready" ? [{
1139
+ let n = l.mediaIndices.get(t.postId) ?? 0, r = F(t.postId, n);
1140
+ return l.previewStates.get(r) === "ready" ? [{
1101
1141
  key: r,
1102
1142
  mediaIndex: n,
1103
1143
  postId: t.postId
@@ -1105,152 +1145,156 @@ var Be = [
1105
1145
  }), (e) => {
1106
1146
  let t = new Set(e.map(({ key: e }) => e));
1107
1147
  e.forEach(({ key: e, mediaIndex: t, postId: n }) => {
1108
- R.has(e) || l("visible", n, t);
1109
- }), R = t;
1148
+ z.has(e) || d("visible", n, t);
1149
+ }), z = t;
1110
1150
  }, {
1111
1151
  immediate: !0,
1112
1152
  flush: "post"
1113
1153
  });
1114
- function z(e) {
1115
- let t = M.value.items[e], n = o.items[e]?.postId;
1154
+ function B(e) {
1155
+ let t = N.value.items[e], n = l.items[e]?.postId;
1116
1156
  if (!t) return {};
1117
- let r = n !== void 0 && o.enteringPostIds.has(n), i = n !== void 0 && o.leavingPostIds.has(n), a = r || i ? ne({
1118
- containerHeight: j.value.height,
1119
- gap: g.value
1120
- }) : 0, s = n === void 0 ? 0 : i ? o.removalDelays.get(n) ?? 0 : r ? o.entryDelays.get(n) ?? 0 : 0;
1157
+ let r = n !== void 0 && l.enteringPostIds.has(n), i = n !== void 0 && l.leavingPostIds.has(n), a = r || i ? ne({
1158
+ containerHeight: M.value.height,
1159
+ gap: y.value
1160
+ }) : 0, o = n === void 0 ? 0 : i ? l.removalDelays.get(n) ?? 0 : r ? l.entryDelays.get(n) ?? 0 : 0;
1121
1161
  return {
1122
- "--masonry-entry-delay": `${s}ms`,
1162
+ "--masonry-entry-delay": `${o}ms`,
1123
1163
  width: `${t.width}px`,
1124
1164
  height: `${t.height}px`,
1125
1165
  transform: `translate3d(${t.x}px, ${t.y + a}px, 0)`
1126
1166
  };
1127
1167
  }
1128
- function B() {
1129
- let e = d.value;
1168
+ function V() {
1169
+ let e = f.value;
1130
1170
  if (!e) return;
1131
- y.value = e.scrollTop, x.value = e.clientHeight;
1132
- let t = p.value;
1133
- t && (C.value = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop);
1171
+ x.value = e.scrollTop, C.value = e.clientHeight;
1172
+ let t = m.value;
1173
+ t && (T.value = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop);
1134
1174
  }
1135
- function V(e) {
1175
+ function H(e) {
1136
1176
  let t = e.ownerDocument.documentElement.clientWidth;
1137
- m.value = e.clientWidth, g.value = Math.min(ot, Math.max(at, t * .0075)), B();
1177
+ g.value = e.clientWidth, y.value = Math.min(dt, Math.max(ut, t * .0075)), V();
1138
1178
  }
1139
- function H(e) {
1179
+ function U(e) {
1140
1180
  let t = e.currentTarget;
1141
- t && (y.value = t.scrollTop, !o.loadMoreLocked && o.infiniteScroll && K(t) && l("loadMore"));
1142
- }
1143
- function W() {
1144
- let e = d.value;
1145
- !o.loadMoreLocked && e && K(e) && l("loadMore");
1181
+ t && (x.value = t.scrollTop, !l.loadMoreLocked && l.infiniteScroll && q(t) && d("loadMore"));
1146
1182
  }
1147
1183
  function G() {
1148
- return d.value;
1184
+ let e = f.value;
1185
+ !l.loadMoreLocked && e && q(e) && d("loadMore");
1186
+ }
1187
+ function K() {
1188
+ return f.value;
1149
1189
  }
1150
- return O(p, (e) => {
1151
- T?.disconnect(), T = null, A !== null && cancelAnimationFrame(A), e && (V(e), !(typeof ResizeObserver > "u") && (T = new ResizeObserver(([t]) => {
1190
+ return O(m, (e) => {
1191
+ k?.disconnect(), k = null, j !== null && cancelAnimationFrame(j), e && (H(e), !(typeof ResizeObserver > "u") && (k = new ResizeObserver(([t]) => {
1152
1192
  let n = t?.contentRect.width ?? e.clientWidth;
1153
- Math.abs(n - m.value) < .5 || (A = requestAnimationFrame(() => {
1154
- A = null, V(e);
1193
+ Math.abs(n - g.value) < .5 || (j = requestAnimationFrame(() => {
1194
+ j = null, H(e);
1155
1195
  }));
1156
- }), T.observe(e)));
1157
- }), O(d, (e) => {
1158
- k?.disconnect(), k = null, e && (B(), !(typeof ResizeObserver > "u") && (k = new ResizeObserver(B), k.observe(e)));
1196
+ }), k.observe(e)));
1197
+ }), O(f, (e) => {
1198
+ A?.disconnect(), A = null, e && (V(), !(typeof ResizeObserver > "u") && (A = new ResizeObserver(V), A.observe(e)));
1159
1199
  }), v(() => {
1160
- T?.disconnect(), k?.disconnect(), A !== null && cancelAnimationFrame(A);
1200
+ k?.disconnect(), A?.disconnect(), j !== null && cancelAnimationFrame(j);
1161
1201
  }), n({
1162
- getScrollElement: G,
1163
- loadIfNearBottom: W
1164
- }), (n, r) => (b(), s("div", nt, [c("main", {
1165
- id: f,
1166
- ref_key: "galleryElement",
1167
- ref: d,
1168
- class: h(["gallery-shell masonry-feed", { "masonry-feed--suspended": t.suspended }]),
1169
- "data-layout-mode": "masonry",
1170
- "aria-hidden": t.suspended || void 0,
1171
- inert: t.suspended || void 0,
1172
- onScrollPassive: H
1173
- }, [c("section", {
1174
- ref_key: "masonryElement",
1175
- ref: p,
1176
- class: h(["masonry", { "masonry--ready": m.value > 0 }]),
1177
- style: _(N.value),
1178
- "aria-label": "Media gallery"
1179
- }, [(b(!0), s(e, null, S(L.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(tt, {
1180
- key: n.postId,
1181
- class: "masonry-item",
1182
- entering: t.enteringPostIds.has(n.postId),
1183
- leaving: t.leavingPostIds.has(n.postId),
1184
- "fetch-priority": e,
1185
- "card-footer": t.cardFooter,
1186
- "card-header": t.cardHeader,
1187
- "media-card": t.mediaCard,
1188
- index: r,
1189
- item: n,
1190
- "item-style": z(r),
1191
- interactive: "",
1192
- layout: "masonry",
1193
- "loaded-count": t.items.length,
1194
- "media-index": t.mediaIndices.get(n.postId) ?? 0,
1195
- "preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1196
- total: t.total,
1197
- onActivate: (e) => l("activate", n.postId, e),
1198
- onMediaChange: (e) => l("mediaChange", n.postId, e),
1199
- onReady: (e) => l("ready", n.postId, e),
1200
- onError: (e) => l("error", n.postId, e)
1201
- }, null, 8, [
1202
- "entering",
1203
- "leaving",
1204
- "fetch-priority",
1205
- "card-footer",
1206
- "card-header",
1207
- "media-card",
1208
- "index",
1209
- "item",
1210
- "item-style",
1211
- "loaded-count",
1212
- "media-index",
1213
- "preview-state",
1214
- "total",
1215
- "onActivate",
1216
- "onMediaChange",
1217
- "onReady",
1218
- "onError"
1219
- ]))), 128))], 6), u(U, {
1220
- actions: t.feedFooterActions,
1221
- "can-retry-end": t.canRetryEnd,
1222
- "feed-footer": t.feedFooter,
1223
- "has-error": t.nextPageError,
1224
- "has-next": t.hasNext,
1225
- "is-loading": t.isLoadingMore,
1226
- "load-more-locked": t.loadMoreLocked,
1227
- "show-load-more": P.value,
1228
- state: t.state,
1229
- onLoadMore: r[0] ||= (e) => l("loadMore"),
1230
- onRetryEnd: r[1] ||= (e) => l("retryEnd")
1231
- }, null, 8, [
1232
- "actions",
1233
- "can-retry-end",
1234
- "feed-footer",
1235
- "has-error",
1236
- "has-next",
1237
- "is-loading",
1238
- "load-more-locked",
1239
- "show-load-more",
1240
- "state"
1241
- ])], 42, rt), u(ue, {
1242
- "content-size": M.value.height,
1243
- "controls-id": f,
1244
- "scroll-element": d.value,
1245
- suspended: t.suspended
1246
- }, null, 8, [
1247
- "content-size",
1248
- "scroll-element",
1249
- "suspended"
1250
- ])]));
1202
+ getScrollElement: K,
1203
+ loadIfNearBottom: G
1204
+ }), (n, r) => (b(), s("div", ot, [
1205
+ c("main", {
1206
+ id: p,
1207
+ ref_key: "galleryElement",
1208
+ ref: f,
1209
+ class: h(["gallery-shell masonry-feed", { "masonry-feed--suspended": t.suspended }]),
1210
+ "data-layout-mode": "masonry",
1211
+ "aria-hidden": t.suspended || void 0,
1212
+ inert: t.suspended || void 0,
1213
+ onScrollPassive: U
1214
+ }, [c("section", {
1215
+ ref_key: "masonryElement",
1216
+ ref: m,
1217
+ class: h(["masonry", { "masonry--ready": g.value > 0 }]),
1218
+ style: _(P.value),
1219
+ "aria-label": "Media gallery"
1220
+ }, [(b(!0), s(e, null, S(R.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(at, {
1221
+ key: n.postId,
1222
+ class: "masonry-item",
1223
+ entering: t.enteringPostIds.has(n.postId),
1224
+ leaving: t.leavingPostIds.has(n.postId),
1225
+ "fetch-priority": e,
1226
+ "card-footer": t.cardFooter,
1227
+ "card-header": t.cardHeader,
1228
+ "media-card": t.mediaCard,
1229
+ index: r,
1230
+ item: n,
1231
+ "item-style": B(r),
1232
+ interactive: "",
1233
+ layout: "masonry",
1234
+ "loaded-count": t.items.length,
1235
+ "media-index": t.mediaIndices.get(n.postId) ?? 0,
1236
+ "preview-state": t.previewStates.get(E(F)(n.postId, t.mediaIndices.get(n.postId) ?? 0)) ?? "loading",
1237
+ total: t.total,
1238
+ onActivate: (e) => d("activate", n.postId, e),
1239
+ onMediaChange: (e) => d("mediaChange", n.postId, e),
1240
+ onReady: (e) => d("ready", n.postId, e),
1241
+ onError: (e) => d("error", n.postId, e)
1242
+ }, null, 8, [
1243
+ "entering",
1244
+ "leaving",
1245
+ "fetch-priority",
1246
+ "card-footer",
1247
+ "card-header",
1248
+ "media-card",
1249
+ "index",
1250
+ "item",
1251
+ "item-style",
1252
+ "loaded-count",
1253
+ "media-index",
1254
+ "preview-state",
1255
+ "total",
1256
+ "onActivate",
1257
+ "onMediaChange",
1258
+ "onReady",
1259
+ "onError"
1260
+ ]))), 128))], 6)], 42, st),
1261
+ t.feedFooter || t.isLoadingMore || t.nextPageError || t.hasNext && I.value || !t.hasNext && t.canRetryEnd ? (b(), s("div", ct, [u(W, {
1262
+ actions: t.feedFooterActions,
1263
+ "can-retry-end": t.canRetryEnd,
1264
+ "feed-footer": t.feedFooter,
1265
+ "has-error": t.nextPageError,
1266
+ "has-next": t.hasNext,
1267
+ "is-loading": t.isLoadingMore,
1268
+ "load-more-locked": t.loadMoreLocked,
1269
+ "show-load-more": I.value,
1270
+ state: t.state,
1271
+ onLoadMore: r[0] ||= (e) => d("loadMore"),
1272
+ onRetryEnd: r[1] ||= (e) => d("retryEnd")
1273
+ }, null, 8, [
1274
+ "actions",
1275
+ "can-retry-end",
1276
+ "feed-footer",
1277
+ "has-error",
1278
+ "has-next",
1279
+ "is-loading",
1280
+ "load-more-locked",
1281
+ "show-load-more",
1282
+ "state"
1283
+ ])])) : o("", !0),
1284
+ u(pe, {
1285
+ "content-size": N.value.height,
1286
+ "controls-id": p,
1287
+ "scroll-element": f.value,
1288
+ suspended: t.suspended
1289
+ }, null, 8, [
1290
+ "content-size",
1291
+ "scroll-element",
1292
+ "suspended"
1293
+ ])
1294
+ ]));
1251
1295
  }
1252
- }), ut = 300;
1253
- function dt(e, t, n) {
1296
+ }), pt = 300;
1297
+ function mt(e, t, n) {
1254
1298
  let r = e.scrollTop;
1255
1299
  if (n || Math.abs(r - t) <= 1) return e.scrollTop = t, Promise.resolve();
1256
1300
  e.setAttribute("data-transitioning", "");
@@ -1258,7 +1302,7 @@ function dt(e, t, n) {
1258
1302
  return new Promise((n) => {
1259
1303
  let o = (s) => {
1260
1304
  a += 1;
1261
- let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / ut), u = 1 - (1 - l) ** 3;
1305
+ let c = Math.max(s - i, 1e3 / 60 * a), l = Math.min(1, c / pt), u = 1 - (1 - l) ** 3;
1262
1306
  if (e.scrollTop = r + (t - r) * u, l < 1) {
1263
1307
  requestAnimationFrame(o);
1264
1308
  return;
@@ -1270,7 +1314,7 @@ function dt(e, t, n) {
1270
1314
  }
1271
1315
  //#endregion
1272
1316
  //#region src/components/ReelAutoAdvanceProgress.vue?vue&type=script&setup=true&lang.ts
1273
- var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1317
+ var ht = ["aria-label"], gt = /* @__PURE__ */ d({
1274
1318
  __name: "ReelAutoAdvanceProgress",
1275
1319
  props: {
1276
1320
  durationMs: {},
@@ -1288,9 +1332,9 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1288
1332
  class: "reel-auto-advance-progress",
1289
1333
  style: _(a.value),
1290
1334
  onAnimationend: n[0] ||= (e) => i("complete")
1291
- }, null, 36)], 8, ft));
1335
+ }, null, 36)], 8, ht));
1292
1336
  }
1293
- }), mt = { class: "reel-viewport" }, ht = ["data-active-post-id", "data-active-media-index"], gt = ["role", "data-status"], _t = 2, vt = 300, yt = /* @__PURE__ */ d({
1337
+ }), _t = { class: "reel-viewport" }, vt = ["data-active-post-id", "data-active-media-index"], yt = ["role", "data-status"], bt = 2, xt = 300, St = /* @__PURE__ */ d({
1294
1338
  __name: "ReelFeed",
1295
1339
  props: {
1296
1340
  initialPostId: {},
@@ -1328,7 +1372,7 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1328
1372
  ],
1329
1373
  setup(t, { expose: n, emit: i }) {
1330
1374
  let l = t, u = i, d = w(null), f = w(null), p = l.initialPostId === null || l.initialPostId === void 0 ? -1 : l.items.findIndex((e) => e.postId === l.initialPostId), g = w(Math.max(0, p)), x = w(!1), C = w(!1), D = 0, k = null, A = null, j = null, N = r(() => ({ gridTemplateRows: `repeat(${l.items.length}, 100cqh)` })), I = r(() => {
1331
- let e = Math.max(0, g.value - _t), t = Math.min(l.items.length - 1, g.value + _t);
1375
+ let e = Math.max(0, g.value - bt), t = Math.min(l.items.length - 1, g.value + bt);
1332
1376
  return l.items.slice(e, t + 1).map((t, n) => ({
1333
1377
  fetchPriority: e + n === g.value ? "high" : "low",
1334
1378
  index: e + n,
@@ -1345,7 +1389,7 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1345
1389
  if (!e) return "";
1346
1390
  let t = P(e, z.value);
1347
1391
  return l.mediaSource === "original" ? t.src : t.preview.src;
1348
- }), H = r(() => B.value === "ready" && ke(V.value)), W = r(() => [
1392
+ }), H = r(() => B.value === "ready" && He(V.value)), U = r(() => [
1349
1393
  L.value,
1350
1394
  z.value,
1351
1395
  l.items.length,
@@ -1356,46 +1400,46 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1356
1400
  ].join(":")), G = r(() => {
1357
1401
  let e = R.value, t = !!(e && l.reelAutoAdvance.includePostItems && z.value < M(e).length - 1), n = l.reelAutoAdvance.intervalMs / 1e3;
1358
1402
  return `Auto advance to the next ${t ? "post item" : "post"} in ${n}s`;
1359
- }), ee = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value), q = r(() => !l.infiniteScroll || l.items.length <= 1), te = r(() => l.reelForward.status === "loading" ? "Loading the next media…" : l.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
1360
- function ne(e) {
1403
+ }), K = r(() => l.reelAutoAdvance.enabled && l.reelForward.status === "idle" && R.value !== void 0 && B.value !== "loading" && !H.value), ee = r(() => !l.infiniteScroll || l.items.length <= 1), te = r(() => l.reelForward.status === "loading" ? "Loading the next media…" : l.reelForward.status === "error" ? "Unable to load the next media." : "You reached the end of this feed.");
1404
+ function J(e) {
1361
1405
  return { gridRow: `${e + 1}` };
1362
1406
  }
1363
- function re(e) {
1407
+ function ne(e) {
1364
1408
  let t = D || e.clientHeight;
1365
1409
  return t <= 0 || l.items.length === 0 ? 0 : Math.min(l.items.length - 1, Math.max(0, Math.round(e.scrollTop / t)));
1366
1410
  }
1367
- function ie(e) {
1411
+ function Y(e) {
1368
1412
  let t = e.currentTarget;
1369
1413
  if (!t) return;
1370
1414
  let n = D || t.clientHeight, r = Math.max(0, l.items.length - 1) * n;
1371
- x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = re(t)), !l.loadMoreLocked && l.infiniteScroll && K(t) && u("loadMore");
1415
+ x.value = l.items.length > 0 && t.scrollTop > r + 1, C.value || (g.value = ne(t)), !l.loadMoreLocked && l.infiniteScroll && q(t) && u("loadMore");
1372
1416
  }
1373
- function ae() {
1417
+ function re() {
1374
1418
  let e = d.value;
1375
- e && (x.value = !1, J(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
1419
+ e && (x.value = !1, oe(!0), D = e.clientHeight, e.scrollTop = g.value * D, A !== null && cancelAnimationFrame(A), A = requestAnimationFrame(() => {
1376
1420
  e.scrollTop = g.value * e.clientHeight, D = e.clientHeight, A = null;
1377
- }), oe());
1421
+ }), ie());
1378
1422
  }
1379
- function oe() {
1423
+ function ie() {
1380
1424
  j !== null && clearTimeout(j), j = setTimeout(() => {
1381
1425
  j = null;
1382
1426
  let e = d.value;
1383
- e && (D = e.clientHeight, e.scrollTop = g.value * D), J(!1);
1427
+ e && (D = e.clientHeight, e.scrollTop = g.value * D), oe(!1);
1384
1428
  }, 120);
1385
1429
  }
1386
- function se() {
1387
- J(!0);
1430
+ function ae() {
1431
+ oe(!0);
1388
1432
  let e = d.value;
1389
- e && (D = e.clientHeight, e.scrollTop = g.value * D), oe();
1433
+ e && (D = e.clientHeight, e.scrollTop = g.value * D), ie();
1390
1434
  }
1391
- function J(e) {
1435
+ function oe(e) {
1392
1436
  C.value = e, d.value?.toggleAttribute("data-resizing", e);
1393
1437
  }
1394
- function ce() {
1438
+ function se() {
1395
1439
  let e = d.value;
1396
- !l.loadMoreLocked && e && K(e) && u("loadMore");
1440
+ !l.loadMoreLocked && e && q(e) && u("loadMore");
1397
1441
  }
1398
- function Y(e) {
1442
+ function ce(e) {
1399
1443
  let t = R.value;
1400
1444
  if (!t) return !1;
1401
1445
  let n = M(t).length;
@@ -1418,19 +1462,19 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1418
1462
  let t = d.value;
1419
1463
  if (!t) return Promise.resolve();
1420
1464
  let n = e * (D || t.clientHeight);
1421
- return g.value = e, dt(t, n, de());
1465
+ return g.value = e, mt(t, n, de());
1422
1466
  }
1423
1467
  function pe(e) {
1424
1468
  fe(e);
1425
1469
  }
1426
- async function X(e) {
1470
+ async function me(e) {
1427
1471
  let t = l.items.findIndex((t) => t.postId === e);
1428
1472
  return t < 0 || t === g.value ? !1 : (await fe(t), !0);
1429
1473
  }
1430
- async function me(e) {
1431
- return Y(e) ? (de() || await new Promise((e) => setTimeout(e, vt)), !0) : !1;
1474
+ async function he(e) {
1475
+ return ce(e) ? (de() || await new Promise((e) => setTimeout(e, xt)), !0) : !1;
1432
1476
  }
1433
- function he() {
1477
+ function X() {
1434
1478
  if (!l.reelAutoAdvance.enabled) return;
1435
1479
  let e = R.value;
1436
1480
  if (!e) return;
@@ -1446,28 +1490,28 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1446
1490
  l.reelAutoAdvance.includePostItems && (l.mediaIndices.get(n.postId) ?? 0) !== 0 && u("mediaChange", n.postId, 0), pe(t);
1447
1491
  }
1448
1492
  function ge(e, t) {
1449
- !l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || he();
1493
+ !l.reelAutoAdvance.enabled || e !== L.value || t !== z.value || !H.value || X();
1450
1494
  }
1451
1495
  return O(d, (e) => {
1452
- k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(ae), k.observe(e)));
1496
+ k?.disconnect(), k = null, e && (D = e.clientHeight, !(typeof ResizeObserver > "u") && (k = new ResizeObserver(re), k.observe(e)));
1453
1497
  }), O(() => l.items.length, async (e) => {
1454
1498
  let t = l.initialPostId, n = t == null ? -1 : l.items.findIndex(({ postId: e }) => e === t);
1455
- g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), ae();
1499
+ g.value = n >= 0 ? n : Math.min(g.value, Math.max(0, e - 1)), await m(), re();
1456
1500
  }), O(L, (e) => {
1457
1501
  e !== void 0 && u("activeChange", e);
1458
1502
  }, { immediate: !0 }), y(() => {
1459
- window.addEventListener("resize", se), window.addEventListener("orientationchange", se), p >= 0 && m(ae);
1503
+ window.addEventListener("resize", ae), window.addEventListener("orientationchange", ae), p >= 0 && m(re);
1460
1504
  }), v(() => {
1461
- window.removeEventListener("resize", se), window.removeEventListener("orientationchange", se), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
1505
+ window.removeEventListener("resize", ae), window.removeEventListener("orientationchange", ae), k?.disconnect(), A !== null && cancelAnimationFrame(A), j !== null && clearTimeout(j);
1462
1506
  }), n({
1463
1507
  activeIndex: g,
1464
1508
  activePostId: L,
1465
- changeActiveMedia: Y,
1466
- loadIfNearBottom: ce,
1509
+ changeActiveMedia: ce,
1510
+ loadIfNearBottom: se,
1467
1511
  moveActivePost: le,
1468
1512
  navigateToItem: ue,
1469
- transitionActiveMedia: me,
1470
- transitionActivePost: X
1513
+ transitionActiveMedia: he,
1514
+ transitionActivePost: me
1471
1515
  }), (n, r) => (b(), s("main", {
1472
1516
  class: h(["reel-shell", {
1473
1517
  "reel-shell--has-footer": !!t.cardFooter,
@@ -1475,7 +1519,7 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1475
1519
  }]),
1476
1520
  "data-layout-mode": "reel"
1477
1521
  }, [
1478
- t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(Ae, {
1522
+ t.cardHeader && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
1479
1523
  key: 0,
1480
1524
  index: g.value,
1481
1525
  item: R.value,
@@ -1497,19 +1541,19 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1497
1541
  "style",
1498
1542
  "total"
1499
1543
  ])) : o("", !0),
1500
- c("div", mt, [c("div", {
1544
+ c("div", _t, [c("div", {
1501
1545
  ref_key: "galleryElement",
1502
1546
  ref: d,
1503
1547
  class: "gallery-shell reel-feed",
1504
1548
  "data-active-post-id": L.value,
1505
1549
  "data-active-media-index": z.value,
1506
- onScrollPassive: ie
1550
+ onScrollPassive: Y
1507
1551
  }, [t.reelForward.status === "idle" ? (b(), s("section", {
1508
1552
  key: 1,
1509
1553
  class: "reel-track",
1510
1554
  style: _(N.value),
1511
1555
  "aria-label": "Media gallery"
1512
- }, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(tt, {
1556
+ }, [(b(!0), s(e, null, S(I.value, ({ fetchPriority: e, item: n, index: r }) => (b(), a(at, {
1513
1557
  key: n.postId,
1514
1558
  active: r === g.value && !x.value,
1515
1559
  "advance-on-media-end": l.reelAutoAdvance.enabled && r === g.value,
@@ -1518,7 +1562,7 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1518
1562
  "fetch-priority": e,
1519
1563
  index: r,
1520
1564
  item: n,
1521
- "item-style": ne(r),
1565
+ "item-style": J(r),
1522
1566
  "media-card": t.mediaCard,
1523
1567
  layout: "reel",
1524
1568
  "loaded-count": t.items.length,
@@ -1560,7 +1604,7 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1560
1604
  class: "reel-forward-retry",
1561
1605
  type: "button",
1562
1606
  onClick: r[0] ||= (e) => u("retryForward")
1563
- }, " Retry ")) : o("", !0)], 8, gt)), t.reelForward.status === "idle" ? (b(), a(U, {
1607
+ }, " Retry ")) : o("", !0)], 8, yt)), t.reelForward.status === "idle" ? (b(), a(W, {
1564
1608
  key: 2,
1565
1609
  actions: t.feedFooterActions,
1566
1610
  "can-retry-end": t.canRetryEnd,
@@ -1569,7 +1613,7 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1569
1613
  "has-next": t.hasNext,
1570
1614
  "is-loading": t.isLoadingMore,
1571
1615
  "load-more-locked": t.loadMoreLocked,
1572
- "show-load-more": q.value,
1616
+ "show-load-more": ee.value,
1573
1617
  state: t.state,
1574
1618
  onLoadMore: r[1] ||= (e) => u("loadMore"),
1575
1619
  onRetryEnd: r[2] ||= (e) => u("retryEnd")
@@ -1583,13 +1627,13 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1583
1627
  "load-more-locked",
1584
1628
  "show-load-more",
1585
1629
  "state"
1586
- ])) : o("", !0)], 40, ht), c("div", {
1630
+ ])) : o("", !0)], 40, vt), c("div", {
1587
1631
  ref_key: "reelControlsElement",
1588
1632
  ref: f,
1589
1633
  class: "reel-media-controls-host",
1590
1634
  "data-test": "reel-media-controls-host"
1591
1635
  }, null, 512)]),
1592
- t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(Ae, {
1636
+ t.cardFooter && R.value && t.reelForward.status === "idle" ? (b(), a(je, {
1593
1637
  key: 1,
1594
1638
  index: g.value,
1595
1639
  item: R.value,
@@ -1611,24 +1655,24 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1611
1655
  "style",
1612
1656
  "total"
1613
1657
  ])) : o("", !0),
1614
- ee.value ? (b(), a(pt, {
1615
- key: W.value,
1658
+ K.value ? (b(), a(gt, {
1659
+ key: U.value,
1616
1660
  "duration-ms": t.reelAutoAdvance.intervalMs,
1617
1661
  label: G.value,
1618
- onComplete: he
1662
+ onComplete: X
1619
1663
  }, null, 8, ["duration-ms", "label"])) : o("", !0)
1620
1664
  ], 2));
1621
1665
  }
1622
- }), bt = ["data-info-sheet-open", "data-info-sheet-mode"], xt = ["aria-hidden", "inert"], St = {
1666
+ }), Ct = ["data-info-sheet-open", "data-info-sheet-mode"], wt = ["aria-hidden", "inert"], Tt = {
1623
1667
  key: 0,
1624
1668
  class: "reel-info-sheet-layer",
1625
1669
  "data-test": "reel-info-sheet"
1626
- }, Ct = [
1670
+ }, Et = [
1627
1671
  "role",
1628
1672
  "aria-modal",
1629
1673
  "tabindex",
1630
1674
  "data-active-post-id"
1631
- ], wt = /* @__PURE__ */ d({
1675
+ ], Dt = /* @__PURE__ */ d({
1632
1676
  __name: "ReelLayout",
1633
1677
  props: {
1634
1678
  forwardIndex: { default: null },
@@ -1753,7 +1797,7 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1753
1797
  class: "reel-layout-main",
1754
1798
  "aria-hidden": e.infoSheetOverlay && A.value || void 0,
1755
1799
  inert: e.infoSheetOverlay && A.value || void 0
1756
- }, [u(yt, {
1800
+ }, [u(St, {
1757
1801
  ref_key: "reelFeed",
1758
1802
  ref: p,
1759
1803
  "can-retry-end": e.canRetryEnd,
@@ -1804,8 +1848,8 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1804
1848
  "reel-forward",
1805
1849
  "state",
1806
1850
  "total"
1807
- ])], 8, xt), u(n, { name: "vibe-info-sheet" }, {
1808
- default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", St, [c("aside", {
1851
+ ])], 8, wt), u(n, { name: "vibe-info-sheet" }, {
1852
+ default: k(() => [A.value && e.infoSheet && j.value ? (b(), s("div", Tt, [c("aside", {
1809
1853
  ref_key: "sheetElement",
1810
1854
  ref: _,
1811
1855
  class: "reel-info-sheet",
@@ -1814,14 +1858,14 @@ var ft = ["aria-label"], pt = /* @__PURE__ */ d({
1814
1858
  "aria-modal": e.infoSheetOverlay ? "true" : void 0,
1815
1859
  tabindex: e.infoSheetOverlay ? -1 : void 0,
1816
1860
  "data-active-post-id": T.value?.postId
1817
- }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Ct)])) : o("", !0)]),
1861
+ }, [(b(), a(C(e.infoSheet.component), g(f(j.value)), null, 16))], 8, Et)])) : o("", !0)]),
1818
1862
  _: 1
1819
- })], 10, bt));
1863
+ })], 10, Ct));
1820
1864
  }
1821
1865
  });
1822
1866
  //#endregion
1823
1867
  //#region src/core/mediaLifecycle.ts
1824
- function Tt(e, t, n, r, i) {
1868
+ function Ot(e, t, n, r, i) {
1825
1869
  let a = e.items.findIndex((e) => e.postId === t), o = e.items[a];
1826
1870
  if (!o) return null;
1827
1871
  let s = N(o, n), c = P(o, s);
@@ -1837,7 +1881,7 @@ function Tt(e, t, n, r, i) {
1837
1881
  postIndex: a
1838
1882
  };
1839
1883
  }
1840
- function Et(e, t) {
1884
+ function kt(e, t) {
1841
1885
  O(() => {
1842
1886
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null;
1843
1887
  return {
@@ -1847,20 +1891,20 @@ function Et(e, t) {
1847
1891
  };
1848
1892
  }, (n, r) => {
1849
1893
  if (n.postId === null || n.postId === r?.postId && n.mediaIndex === r.mediaIndex && n.origin === r.origin) return;
1850
- let i = Tt(e, n.postId, n.mediaIndex, "reel", n.origin);
1894
+ let i = Ot(e, n.postId, n.mediaIndex, "reel", n.origin);
1851
1895
  i && t(i);
1852
1896
  }, { flush: "sync" });
1853
1897
  }
1854
1898
  //#endregion
1855
1899
  //#region src/components/useMediaLifecycle.ts
1856
- function Dt(e, t) {
1900
+ function At(e, t) {
1857
1901
  let n = w(/* @__PURE__ */ new Map()), i = w(/* @__PURE__ */ new Map()), a = r(() => e.reelMediaSource === "original" ? i.value : n.value);
1858
1902
  function o(e, t, n, r) {
1859
1903
  let i = F(t, n);
1860
1904
  e.value.get(i) !== r && (e.value = new Map(e.value).set(i, r));
1861
1905
  }
1862
1906
  function s(t, n, r, i) {
1863
- return Tt(e, t, n, r, i);
1907
+ return Ot(e, t, n, r, i);
1864
1908
  }
1865
1909
  function c(e, n, r, i) {
1866
1910
  let a = s(e, n, r, i);
@@ -1882,7 +1926,7 @@ function Dt(e, t) {
1882
1926
  let r = s(e, n, "masonry", null);
1883
1927
  r && t.visible(r);
1884
1928
  }
1885
- return Et(e, t.reelChange), O(() => {
1929
+ return kt(e, t.reelChange), O(() => {
1886
1930
  let t = e.layout === "reel" || e.reelOrigin === "masonry" ? e.activeReelPostId : null, n = t === null ? 0 : e.mediaIndices.get(t) ?? 0;
1887
1931
  return {
1888
1932
  mediaIndex: n,
@@ -1907,16 +1951,16 @@ function Dt(e, t) {
1907
1951
  }
1908
1952
  //#endregion
1909
1953
  //#region src/core/reelEscapeStack.ts
1910
- var Ot = [];
1911
- function kt(e) {
1912
- return Ot.push(e), () => {
1913
- let t = Ot.indexOf(e);
1914
- t >= 0 && Ot.splice(t, 1);
1954
+ var jt = [];
1955
+ function Mt(e) {
1956
+ return jt.push(e), () => {
1957
+ let t = jt.indexOf(e);
1958
+ t >= 0 && jt.splice(t, 1);
1915
1959
  };
1916
1960
  }
1917
- function At(e) {
1961
+ function Nt(e) {
1918
1962
  if (!e.isActive()) return !1;
1919
- let t = Ot.filter((e) => e.isActive()), n = e.element();
1963
+ let t = jt.filter((e) => e.isActive()), n = e.element();
1920
1964
  return n !== null && t.some((t) => {
1921
1965
  if (t === e) return !1;
1922
1966
  let r = t.element();
@@ -1932,14 +1976,14 @@ function At(e) {
1932
1976
  }
1933
1977
  //#endregion
1934
1978
  //#region src/components/useReelKeyboard.ts
1935
- function jt(e) {
1979
+ function Pt(e) {
1936
1980
  let t = {
1937
1981
  element: e.element,
1938
1982
  isActive: () => e.state.layout === "reel" || e.state.reelOrigin === "masonry"
1939
1983
  }, n = null;
1940
1984
  function r(n) {
1941
1985
  let r = t.isActive();
1942
- if (n.key === "Escape" && r && !At(t)) return;
1986
+ if (n.key === "Escape" && r && !Nt(t)) return;
1943
1987
  if (n.key === "Escape" && e.state.reelOrigin === "masonry") {
1944
1988
  n.preventDefault(), e.state.reelInfoSheetOverlay && e.state.reelInfoSheet.enabled && e.setReelInfoSheet(!1), e.closeMasonryReel();
1945
1989
  return;
@@ -1959,14 +2003,14 @@ function jt(e) {
1959
2003
  a !== 0 && e.reelRenderer()?.changeActiveMedia?.(a) && n.preventDefault();
1960
2004
  }
1961
2005
  y(() => {
1962
- n = kt(t), window.addEventListener("keydown", r);
2006
+ n = Mt(t), window.addEventListener("keydown", r);
1963
2007
  }), v(() => {
1964
2008
  window.removeEventListener("keydown", r), n?.(), n = null;
1965
2009
  });
1966
2010
  }
1967
2011
  //#endregion
1968
2012
  //#region src/components/VibeSurface.vue?vue&type=script&setup=true&lang.ts
1969
- var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2013
+ var Ft = 35, It = 420, Lt = /* @__PURE__ */ d({
1970
2014
  __name: "VibeSurface",
1971
2015
  props: {
1972
2016
  canRetryEnd: { type: Boolean },
@@ -1975,6 +2019,7 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
1975
2019
  feedFooter: {},
1976
2020
  feedFooterActions: {},
1977
2021
  mediaCard: {},
2022
+ masonry: {},
1978
2023
  reelInfoSheet: {},
1979
2024
  state: {}
1980
2025
  },
@@ -1991,22 +2036,22 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
1991
2036
  "retryForward"
1992
2037
  ],
1993
2038
  setup(t, { expose: i, emit: c }) {
1994
- let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => I(l.state)), { markMasonryVisible: j, markPreviewError: P, markPreviewReady: F, markReelError: L, markReelReady: R, originalStates: z, previewStates: B, reelStates: V } = Dt(l.state, {
2039
+ let l = t, d = c, f = w(null), p = w(null), h = w(null), g = w(null), y = w({}), x = w(!1), S = w(/* @__PURE__ */ new Set()), C = w(/* @__PURE__ */ new Map()), T = w(/* @__PURE__ */ new Set()), D = w(/* @__PURE__ */ new Map()), A = r(() => Object.freeze([...l.state.items])), j = r(() => L(l.state, A.value)), { markMasonryVisible: P, markPreviewError: F, markPreviewReady: I, markReelError: R, markReelReady: z, originalStates: B, previewStates: V, reelStates: H } = At(l.state, {
1995
2040
  ready: (e) => d("mediaReady", e),
1996
2041
  reelChange: (e) => d("reelMediaChange", e),
1997
2042
  visible: (e) => d("mediaVisible", e)
1998
- }), H = new Set(l.state.items.map((e) => e.postId)), U = null, W = null, G = !1;
1999
- function K() {
2043
+ }), U = new Set(l.state.items.map((e) => e.postId)), W = null, G = null, K = !1;
2044
+ function q() {
2000
2045
  return typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
2001
2046
  }
2002
- function q() {
2003
- U !== null && cancelAnimationFrame(U), U = requestAnimationFrame(() => {
2004
- U = requestAnimationFrame(() => {
2005
- U = null, S.value = /* @__PURE__ */ new Set();
2047
+ function te() {
2048
+ W !== null && cancelAnimationFrame(W), W = requestAnimationFrame(() => {
2049
+ W = requestAnimationFrame(() => {
2050
+ W = null, S.value = /* @__PURE__ */ new Set();
2006
2051
  });
2007
2052
  });
2008
2053
  }
2009
- function te(e, t) {
2054
+ function J(e, t) {
2010
2055
  let n = l.state.items.find((t) => t.postId === e);
2011
2056
  if (!n) return;
2012
2057
  let r = N(n, t);
@@ -2015,46 +2060,46 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2015
2060
  async function ne() {
2016
2061
  await m(), (l.state.layout === "reel" || l.state.reelOrigin === "masonry" ? p.value : f.value)?.loadIfNearBottom();
2017
2062
  }
2018
- function re(e) {
2063
+ function Y(e) {
2019
2064
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.changeActiveMedia?.(e) ?? !1;
2020
2065
  }
2021
- function ie(e) {
2066
+ function re(e) {
2022
2067
  return l.state.isLoading || l.state.items.length === 0 || l.state.layout !== "reel" && l.state.reelOrigin !== "masonry" ? !1 : p.value?.moveActivePost?.(e) ?? !1;
2023
2068
  }
2024
- function ae(e) {
2069
+ function ie(e) {
2025
2070
  if (!(l.state.layout === "reel" || l.state.reelOrigin === "masonry") || l.state.isLoading) return "reel-inactive";
2026
2071
  let t = l.state.items.find((t) => t.postId === e.postId);
2027
2072
  if (!t) return "not-found";
2028
2073
  let n = M(t).findIndex((t) => t.mediaId === e.mediaId);
2029
2074
  return n < 0 ? "not-found" : p.value?.navigateToItem?.(e.postId, n) ? "navigated" : "reel-inactive";
2030
2075
  }
2031
- function oe() {
2076
+ function ae() {
2032
2077
  return l.state.layout !== "masonry" || l.state.reelOrigin === "masonry" ? null : f.value?.getScrollElement?.() ?? null;
2033
2078
  }
2034
- function se(e, t) {
2035
- W = e, G = t === "keyboard", y.value = le(e), d("openReel", e), m(() => h.value?.focus());
2079
+ function oe(e, t) {
2080
+ G = e, K = t === "keyboard", y.value = ue(e), d("openReel", e), m(() => h.value?.focus());
2036
2081
  }
2037
- function J(e) {
2082
+ function se(e) {
2038
2083
  let t = g.value?.querySelectorAll(".masonry-feed [data-post-id]") ?? [];
2039
2084
  return Array.from(t).find((t) => t.dataset.postId === String(e)) ?? null;
2040
2085
  }
2041
2086
  function ce(e) {
2042
- if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || K()) return 0;
2043
- let t = [...new Set(e)], n = t.filter(J);
2087
+ if (l.state.layout !== "masonry" || l.state.reelOrigin !== null || q()) return 0;
2088
+ let t = [...new Set(e)], n = t.filter(se);
2044
2089
  if (n.length === 0) return 0;
2045
2090
  let r = new Map(D.value);
2046
2091
  return n.forEach((e, t) => {
2047
- r.set(e, t * Mt);
2048
- }), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), D.value = r, Nt + (n.length - 1) * Mt;
2092
+ r.set(e, t * Ft);
2093
+ }), S.value = new Set([...S.value].filter((e) => !n.includes(e))), T.value = new Set([...T.value, ...t]), D.value = r, It + (n.length - 1) * Ft;
2049
2094
  }
2050
- function Y(e, t) {
2051
- let n = J(e), r = n?.querySelector(".media-card-activator") ?? n;
2095
+ function le(e, t) {
2096
+ let n = se(e), r = n?.querySelector(".media-card-activator") ?? n;
2052
2097
  r && (r.classList.toggle("media-card-focus-silent", !t), t || r.addEventListener("blur", () => {
2053
2098
  r.classList.remove("media-card-focus-silent");
2054
2099
  }, { once: !0 }), r?.focus({ preventScroll: !0 }));
2055
2100
  }
2056
- function le(e) {
2057
- let t = g.value, n = J(e);
2101
+ function ue(e) {
2102
+ let t = g.value, n = se(e);
2058
2103
  if (t === null || n === null) return {};
2059
2104
  let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
2060
2105
  return {
@@ -2064,40 +2109,40 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2064
2109
  "--vibe-reel-origin-left": `${Math.max(0, i.left - r.left)}px`
2065
2110
  };
2066
2111
  }
2067
- function ue() {
2068
- l.state.reelOrigin === "masonry" && (W ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
2069
- }
2070
2112
  function de() {
2071
- let e = W, t = G;
2072
- x.value = !1, W = null, G = !1, y.value = {}, m(() => {
2073
- e !== null && Y(e, t);
2113
+ l.state.reelOrigin === "masonry" && (G ??= l.state.activeReelPostId, x.value = !0, d("closeReel"));
2114
+ }
2115
+ function fe() {
2116
+ let e = G, t = K;
2117
+ x.value = !1, G = null, K = !1, y.value = {}, m(() => {
2118
+ e !== null && le(e, t);
2074
2119
  });
2075
2120
  }
2076
- return jt({
2077
- closeMasonryReel: ue,
2121
+ return Pt({
2122
+ closeMasonryReel: de,
2078
2123
  element: () => g.value,
2079
2124
  isReelLeaving: () => x.value,
2080
2125
  reelRenderer: () => p.value,
2081
2126
  setReelInfoSheet: (e) => d("reelInfoSheetChange", e),
2082
2127
  state: l.state
2083
2128
  }), O(() => l.state.items.map((e) => e.postId), (e) => {
2084
- let t = e.filter((e) => !H.has(e)), n = new Set(e);
2085
- if (H = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || K()) return;
2129
+ let t = e.filter((e) => !U.has(e)), n = new Set(e);
2130
+ if (U = new Set(e), T.value = new Set([...T.value].filter((e) => n.has(e))), D.value = new Map([...D.value].filter(([e]) => n.has(e))), t.length === 0 || q()) return;
2086
2131
  let r = /* @__PURE__ */ new Map();
2087
2132
  e.forEach((e) => {
2088
2133
  let t = C.value.get(e);
2089
2134
  t !== void 0 && r.set(e, t);
2090
2135
  }), t.forEach((e, t) => {
2091
- r.set(e, t * Mt);
2092
- }), C.value = r, S.value = new Set([...S.value, ...t]), q();
2136
+ r.set(e, t * Ft);
2137
+ }), C.value = r, S.value = new Set([...S.value, ...t]), te();
2093
2138
  }, { flush: "sync" }), v(() => {
2094
- U !== null && cancelAnimationFrame(U);
2139
+ W !== null && cancelAnimationFrame(W);
2095
2140
  }), i({
2096
- changeActiveReelMedia: re,
2097
- getAutoScrollElement: oe,
2141
+ changeActiveReelMedia: Y,
2142
+ getAutoScrollElement: ae,
2098
2143
  loadIfNearBottom: ne,
2099
- moveActiveReelPost: ie,
2100
- navigateToReelItem: ae,
2144
+ moveActiveReelPost: re,
2145
+ navigateToReelItem: ie,
2101
2146
  startItemRemoval: ce,
2102
2147
  transitionActiveReelMedia: (e) => p.value?.transitionActiveMedia?.(e) ?? Promise.resolve(!1),
2103
2148
  transitionActiveReelPost: (e) => p.value?.transitionActivePost?.(e) ?? Promise.resolve(!1)
@@ -2105,7 +2150,7 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2105
2150
  ref_key: "surfaceElement",
2106
2151
  ref: g,
2107
2152
  class: "vibe-surface"
2108
- }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(wt, {
2153
+ }, [t.state.layout === "reel" && (t.state.items.length > 0 || t.state.reelForward.status !== "idle") ? (b(), a(Dt, {
2109
2154
  key: 0,
2110
2155
  ref_key: "reelRenderer",
2111
2156
  ref: p,
@@ -2130,17 +2175,17 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2130
2175
  "info-sheet-overlay": t.state.reelInfoSheetOverlay,
2131
2176
  "next-page-error": !!t.state.nextPageError,
2132
2177
  origin: "reel",
2133
- "preview-states": E(V),
2178
+ "preview-states": E(H),
2134
2179
  "reel-auto-advance": t.state.reelAutoAdvance,
2135
2180
  "reel-forward": t.state.reelForward,
2136
- state: A.value,
2181
+ state: j.value,
2137
2182
  total: t.state.total,
2138
2183
  onActiveChange: i[0] ||= (e) => d("activeReelChange", e),
2139
2184
  onCloseInfoSheet: i[1] ||= (e) => d("reelInfoSheetChange", !1),
2140
- onError: E(L),
2185
+ onError: E(R),
2141
2186
  onLoadMore: i[2] ||= (e) => d("loadMore"),
2142
- onMediaChange: te,
2143
- onReady: E(R),
2187
+ onMediaChange: J,
2188
+ onReady: E(z),
2144
2189
  onRetryEnd: i[3] ||= (e) => d("retryEnd"),
2145
2190
  onRetryForward: i[4] ||= (e) => d("retryForward")
2146
2191
  }, null, 8, /* @__PURE__ */ "can-retry-end.has-next.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.infinite-scroll.is-loading-more.items.load-more-locked.media-source.media-indices.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))) : t.state.error || t.state.isLoading || t.state.items.length === 0 && t.state.reelForward.status === "idle" ? (b(), a(ee, {
@@ -2148,7 +2193,7 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2148
2193
  actions: t.feedFooterActions,
2149
2194
  "can-retry-end": t.canRetryEnd,
2150
2195
  "feed-footer": t.feedFooter,
2151
- state: A.value,
2196
+ state: j.value,
2152
2197
  onLoadMore: i[5] ||= (e) => d("loadMore"),
2153
2198
  onRetryEnd: i[6] ||= (e) => d("retryEnd")
2154
2199
  }, null, 8, [
@@ -2156,7 +2201,7 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2156
2201
  "can-retry-end",
2157
2202
  "feed-footer",
2158
2203
  "state"
2159
- ])) : (b(), s(e, { key: 2 }, [u(lt, {
2204
+ ])) : (b(), s(e, { key: 2 }, [u(ft, {
2160
2205
  ref_key: "masonryRenderer",
2161
2206
  ref: f,
2162
2207
  "can-retry-end": t.canRetryEnd,
@@ -2169,6 +2214,7 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2169
2214
  "feed-footer": t.feedFooter,
2170
2215
  "feed-footer-actions": t.feedFooterActions,
2171
2216
  "media-card": t.mediaCard,
2217
+ masonry: t.masonry,
2172
2218
  "has-next": t.state.next !== null,
2173
2219
  "infinite-scroll": t.state.infiniteScroll,
2174
2220
  "is-loading-more": t.state.isLoadingMore,
@@ -2176,17 +2222,17 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2176
2222
  "load-more-locked": t.state.loadMoreLocked,
2177
2223
  "media-indices": t.state.mediaIndices,
2178
2224
  "next-page-error": !!t.state.nextPageError,
2179
- "preview-states": E(B),
2225
+ "preview-states": E(V),
2180
2226
  suspended: t.state.reelOrigin === "masonry" || x.value,
2181
- state: A.value,
2227
+ state: j.value,
2182
2228
  total: t.state.total,
2183
- onActivate: se,
2184
- onError: E(P),
2229
+ onActivate: oe,
2230
+ onError: E(F),
2185
2231
  onLoadMore: i[7] ||= (e) => d("loadMore"),
2186
- onMediaChange: te,
2187
- onReady: E(F),
2232
+ onMediaChange: J,
2233
+ onReady: E(I),
2188
2234
  onRetryEnd: i[8] ||= (e) => d("retryEnd"),
2189
- onVisible: E(j)
2235
+ onVisible: E(P)
2190
2236
  }, null, 8, [
2191
2237
  "can-retry-end",
2192
2238
  "entering-post-ids",
@@ -2198,6 +2244,7 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2198
2244
  "feed-footer",
2199
2245
  "feed-footer-actions",
2200
2246
  "media-card",
2247
+ "masonry",
2201
2248
  "has-next",
2202
2249
  "infinite-scroll",
2203
2250
  "is-loading-more",
@@ -2214,7 +2261,7 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2214
2261
  "onVisible"
2215
2262
  ]), u(n, {
2216
2263
  name: "vibe-reel-viewer",
2217
- onAfterLeave: de
2264
+ onAfterLeave: fe
2218
2265
  }, {
2219
2266
  default: k(() => [t.state.reelOrigin === "masonry" ? (b(), s("section", {
2220
2267
  key: 0,
@@ -2226,7 +2273,7 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2226
2273
  "aria-modal": "true",
2227
2274
  tabindex: "-1",
2228
2275
  style: _(y.value)
2229
- }, [u(wt, {
2276
+ }, [u(Dt, {
2230
2277
  ref_key: "reelRenderer",
2231
2278
  ref: p,
2232
2279
  "can-retry-end": t.canRetryEnd,
@@ -2250,17 +2297,17 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2250
2297
  "media-source": "original",
2251
2298
  "next-page-error": !!t.state.nextPageError,
2252
2299
  origin: "masonry",
2253
- "preview-states": E(z),
2300
+ "preview-states": E(B),
2254
2301
  "reel-auto-advance": t.state.reelAutoAdvance,
2255
2302
  "reel-forward": t.state.reelForward,
2256
- state: A.value,
2303
+ state: j.value,
2257
2304
  total: t.state.total,
2258
2305
  onActiveChange: i[9] ||= (e) => d("activeReelChange", e),
2259
2306
  onCloseInfoSheet: i[10] ||= (e) => d("reelInfoSheetChange", !1),
2260
- onError: E(L),
2307
+ onError: E(R),
2261
2308
  onLoadMore: i[11] ||= (e) => d("loadMore"),
2262
- onMediaChange: te,
2263
- onReady: E(R),
2309
+ onMediaChange: J,
2310
+ onReady: E(z),
2264
2311
  onRetryEnd: i[12] ||= (e) => d("retryEnd"),
2265
2312
  onRetryForward: i[13] ||= (e) => d("retryForward")
2266
2313
  }, null, 8, /* @__PURE__ */ "can-retry-end.card-footer.card-header.feed-footer.feed-footer-actions.forward-index.forward-item.media-card.has-next.infinite-scroll.initial-post-id.info-sheet.info-sheet-enabled.info-sheet-overlay.is-loading-more.items.load-more-locked.media-indices.next-page-error.preview-states.reel-auto-advance.reel-forward.state.total.onError.onReady".split("."))], 4)) : o("", !0)]),
@@ -2270,7 +2317,7 @@ var Mt = 35, Nt = 420, Pt = /* @__PURE__ */ d({
2270
2317
  });
2271
2318
  //#endregion
2272
2319
  //#region src/core/page.ts
2273
- function Ft(e) {
2320
+ function Rt(e) {
2274
2321
  if (!e || typeof e != "object" || !Array.isArray(e.items)) throw TypeError("Vibe loadPage must resolve to a page with an items array.");
2275
2322
  if (e.next !== null && typeof e.next != "string" && typeof e.next != "number") throw TypeError("Vibe page next must be a string, number, or null.");
2276
2323
  if (e.total !== void 0 && (!Number.isFinite(e.total) || e.total < 0)) throw TypeError("Vibe page total must be a non-negative number when provided.");
@@ -2282,32 +2329,32 @@ function Z(e, t) {
2282
2329
  }
2283
2330
  //#endregion
2284
2331
  //#region src/core/requestDelay.ts
2285
- var It = 2e3, Lt = 1e4, Rt = 250, zt = {
2332
+ var zt = 2e3, Bt = 1e4, Vt = 250, Ht = {
2286
2333
  delayRemainingMs: null,
2287
2334
  nextRequestAt: null
2288
2335
  };
2289
- function Bt(e, t) {
2336
+ function Ut(e, t) {
2290
2337
  return e === void 0 ? t : Math.floor(e);
2291
2338
  }
2292
- function Vt(e, t) {
2339
+ function Wt(e, t) {
2293
2340
  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.`);
2294
2341
  }
2295
- function Ht(e, t = {}) {
2296
- let n = Bt(t.delayStepMs, It), r = Bt(t.delayMaxMs, Lt);
2342
+ function Gt(e, t = {}) {
2343
+ let n = Ut(t.delayStepMs, zt), r = Ut(t.delayMaxMs, Bt);
2297
2344
  return Math.min(Math.max(0, e) * n, r);
2298
2345
  }
2299
2346
  function Q(e) {
2300
- if (e == null || !Number.isFinite(e)) return { ...zt };
2347
+ if (e == null || !Number.isFinite(e)) return { ...Ht };
2301
2348
  let t = Math.max(0, Math.floor(e - Date.now()));
2302
2349
  return t > 0 ? {
2303
2350
  delayRemainingMs: t,
2304
2351
  nextRequestAt: e
2305
- } : { ...zt };
2352
+ } : { ...Ht };
2306
2353
  }
2307
- async function Ut({ delayMs: e, onChange: t, signal: n }) {
2354
+ async function Kt({ delayMs: e, onChange: t, signal: n }) {
2308
2355
  if (n.aborted) throw new DOMException("Aborted", "AbortError");
2309
2356
  if (e <= 0) {
2310
- t({ ...zt });
2357
+ t({ ...Ht });
2311
2358
  return;
2312
2359
  }
2313
2360
  let r = Date.now() + e;
@@ -2315,9 +2362,9 @@ async function Ut({ delayMs: e, onChange: t, signal: n }) {
2315
2362
  delayRemainingMs: e,
2316
2363
  nextRequestAt: r
2317
2364
  }), await new Promise((i, a) => {
2318
- let o = !1, s = setInterval(f, Rt), c = setTimeout(() => u(), e);
2365
+ let o = !1, s = setInterval(f, Vt), c = setTimeout(() => u(), e);
2319
2366
  function l() {
2320
- clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...zt });
2367
+ clearInterval(s), clearTimeout(c), n.removeEventListener("abort", d), t({ ...Ht });
2321
2368
  }
2322
2369
  function u(e) {
2323
2370
  o || (o = !0, l(), e ? a(e) : i());
@@ -2332,13 +2379,13 @@ async function Ut({ delayMs: e, onChange: t, signal: n }) {
2332
2379
  n.addEventListener("abort", d, { once: !0 });
2333
2380
  });
2334
2381
  }
2335
- var Wt = class {
2382
+ var qt = class {
2336
2383
  interval = null;
2337
2384
  constructor(e) {
2338
2385
  this.onChange = e;
2339
2386
  }
2340
2387
  clear() {
2341
- this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...zt });
2388
+ this.interval !== null && clearInterval(this.interval), this.interval = null, this.onChange({ ...Ht });
2342
2389
  }
2343
2390
  sync(e) {
2344
2391
  this.clear();
@@ -2346,22 +2393,22 @@ var Wt = class {
2346
2393
  this.onChange(t), t.delayRemainingMs !== null && (this.interval = setInterval(() => {
2347
2394
  let t = Q(e);
2348
2395
  this.onChange(t), t.delayRemainingMs === null && this.clear();
2349
- }, Rt));
2396
+ }, Vt));
2350
2397
  }
2351
2398
  };
2352
- function Gt(e, t = !0) {
2399
+ function Jt(e, t = !0) {
2353
2400
  return e.maxAdditionalPages === "unlimited" ? Infinity : (e.maxAdditionalPages ?? 10) + (t ? 1 : 0);
2354
2401
  }
2355
- function Kt(e) {
2402
+ function Yt(e) {
2356
2403
  return `${typeof e}:${String(e)}`;
2357
2404
  }
2358
- function qt(e, t) {
2405
+ function Xt(e, t) {
2359
2406
  if (!Number.isInteger(e) || e <= 0) throw TypeError(`Vibe ${t} must be a positive integer.`);
2360
2407
  }
2361
- function Jt(e) {
2408
+ function Zt(e) {
2362
2409
  if (!e) return;
2363
- if (qt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2364
- Vt(e, "frontend autofill");
2410
+ if (Xt(e.pageSize, "autofill pageSize"), e.strategy === "frontend") {
2411
+ Wt(e, "frontend autofill");
2365
2412
  let t = e.maxAdditionalPages;
2366
2413
  if (t !== void 0 && t !== "unlimited" && (!Number.isInteger(t) || t < 0)) throw TypeError("Vibe autofill maxAdditionalPages must be a non-negative integer or \"unlimited\".");
2367
2414
  return;
@@ -2373,7 +2420,7 @@ function Jt(e) {
2373
2420
  if (t.pageSize !== e.pageSize) throw TypeError("Vibe backend autofill initialSession pageSize must match autofill pageSize.");
2374
2421
  }
2375
2422
  }
2376
- function Yt(e, t, n = !0) {
2423
+ function Qt(e, t, n = !0) {
2377
2424
  if (!e) return {
2378
2425
  cycleId: null,
2379
2426
  delayRemainingMs: null,
@@ -2407,7 +2454,7 @@ function Yt(e, t, n = !0) {
2407
2454
  strategy: e.strategy
2408
2455
  };
2409
2456
  }
2410
- function Xt(e) {
2457
+ function $t(e) {
2411
2458
  return [
2412
2459
  "cancelling",
2413
2460
  "filling",
@@ -2415,9 +2462,9 @@ function Xt(e) {
2415
2462
  "waiting"
2416
2463
  ].includes(e.status);
2417
2464
  }
2418
- async function Zt(e, t, n) {
2465
+ async function en(e, t, n) {
2419
2466
  let r = t.autofill;
2420
- if (!Xt(r) || !r.cycleId) return;
2467
+ if (!$t(r) || !r.cycleId) return;
2421
2468
  let i = {
2422
2469
  cycleId: r.cycleId,
2423
2470
  feedKey: r.feedKey ?? "",
@@ -2430,16 +2477,16 @@ async function Zt(e, t, n) {
2430
2477
  throw r.error = e, r.status = "error", e;
2431
2478
  }
2432
2479
  }
2433
- function Qt(e, t, n) {
2480
+ function tn(e, t, n) {
2434
2481
  return e?.strategy === "backend" && t.feedKey === e.feedKey && t.sessionId === n.sessionId;
2435
2482
  }
2436
- async function $t({ 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 }) {
2437
- let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Gt(s), g = t, _ = t, v = t, y = 0, b = [], x;
2483
+ async function nn({ 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 }) {
2484
+ let f = [], p = [...e], m = /* @__PURE__ */ new Set(), h = r ?? Jt(s), g = t, _ = t, v = t, y = 0, b = [], x;
2438
2485
  for (; y < h;) {
2439
- let e = Kt(g);
2486
+ let e = Yt(g);
2440
2487
  if (m.has(e)) throw Error("Vibe autofill received a repeated cursor.");
2441
- if (m.add(e), await Ut({
2442
- delayMs: Ht(l + y, s),
2488
+ if (m.add(e), await Kt({
2489
+ delayMs: Gt(l + y, s),
2443
2490
  onChange: a,
2444
2491
  signal: d
2445
2492
  }), y > 0 && u()) return {
@@ -2453,7 +2500,7 @@ async function $t({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2453
2500
  status: "paused",
2454
2501
  total: x
2455
2502
  };
2456
- let t = Ft(await n({
2503
+ let t = Rt(await n({
2457
2504
  cursor: g,
2458
2505
  signal: d
2459
2506
  }));
@@ -2510,12 +2557,12 @@ async function $t({ existingItems: e, initialCursor: t, loadPage: n, maximumRequ
2510
2557
  }
2511
2558
  //#endregion
2512
2559
  //#region src/core/autofillController.ts
2513
- var en = class {
2560
+ var rn = class {
2514
2561
  collection = null;
2515
2562
  cycle = 0;
2516
2563
  delayCountdown;
2517
2564
  constructor(e) {
2518
- this.context = e, this.delayCountdown = new Wt((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2565
+ this.context = e, this.delayCountdown = new qt((t) => Object.assign(e.state.autofill, t)), this.syncCountdown();
2519
2566
  }
2520
2567
  beginCycle() {
2521
2568
  let { options: e, state: t } = this.context;
@@ -2523,14 +2570,14 @@ var en = class {
2523
2570
  this.clear();
2524
2571
  let n = `vibe-autofill-${Date.now().toString(36)}-${++this.cycle}`;
2525
2572
  return t.autofill = {
2526
- ...Yt(e, void 0, !1),
2573
+ ...Qt(e, void 0, !1),
2527
2574
  cycleId: n,
2528
2575
  status: "filling"
2529
2576
  }, n;
2530
2577
  }
2531
2578
  async cancel() {
2532
2579
  let { cancelRequest: e, options: t, state: n } = this.context;
2533
- await Zt(t, n, e), this.commitCollection();
2580
+ await en(t, n, e), this.commitCollection();
2534
2581
  }
2535
2582
  captureCollection(e, t) {
2536
2583
  t && (this.collection = e);
@@ -2558,30 +2605,30 @@ var en = class {
2558
2605
  requests: r.requests
2559
2606
  }));
2560
2607
  }
2561
- }, tn = 100;
2562
- function nn(e, t) {
2608
+ }, an = 100;
2609
+ function on(e, t) {
2563
2610
  if (!Number.isFinite(t) || t <= 0) throw TypeError(`Vibe ${e} must be a positive number.`);
2564
2611
  }
2565
- function rn(e, t, n) {
2612
+ function sn(e, t, n) {
2566
2613
  return Math.min(n, Math.max(t, e));
2567
2614
  }
2568
- function an(e) {
2615
+ function cn(e) {
2569
2616
  if (!e) return;
2570
2617
  let t = e.minSpeedPxPerSecond ?? 20, n = e.maxSpeedPxPerSecond ?? 240;
2571
- if (nn("autoScroll.minSpeedPxPerSecond", t), nn("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2572
- e.speedPxPerSecond !== void 0 && nn("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2618
+ if (on("autoScroll.minSpeedPxPerSecond", t), on("autoScroll.maxSpeedPxPerSecond", n), t > n) throw TypeError("Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.");
2619
+ e.speedPxPerSecond !== void 0 && on("autoScroll.speedPxPerSecond", e.speedPxPerSecond);
2573
2620
  }
2574
- function on(e) {
2621
+ function ln(e) {
2575
2622
  let t = e?.minSpeedPxPerSecond ?? 20, n = e?.maxSpeedPxPerSecond ?? 240;
2576
2623
  return {
2577
2624
  enabled: e?.enabled ?? !1,
2578
2625
  maxSpeedPxPerSecond: n,
2579
2626
  minSpeedPxPerSecond: t,
2580
2627
  paused: !1,
2581
- speedPxPerSecond: rn(e?.speedPxPerSecond ?? 80, t, n)
2628
+ speedPxPerSecond: sn(e?.speedPxPerSecond ?? 80, t, n)
2582
2629
  };
2583
2630
  }
2584
- var sn = class {
2631
+ var un = class {
2585
2632
  frame = null;
2586
2633
  lastTimestamp = null;
2587
2634
  mounted = !1;
@@ -2601,9 +2648,9 @@ var sn = class {
2601
2648
  this.options.state.enabled && (this.options.state.paused = e, this.lastTimestamp = null, e ? this.cancelFrame() : this.schedule());
2602
2649
  }
2603
2650
  setSpeed(e) {
2604
- nn("auto-scroll speed", e);
2651
+ on("auto-scroll speed", e);
2605
2652
  let t = this.options.state;
2606
- t.speedPxPerSecond = rn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2653
+ t.speedPxPerSecond = sn(e, t.minSpeedPxPerSecond, t.maxSpeedPxPerSecond);
2607
2654
  }
2608
2655
  tick = (e) => {
2609
2656
  this.frame = null;
@@ -2615,7 +2662,7 @@ var sn = class {
2615
2662
  return;
2616
2663
  }
2617
2664
  if (this.lastTimestamp !== null) {
2618
- let r = Math.min(tn, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
2665
+ let r = Math.min(an, Math.max(0, e - this.lastTimestamp)), i = Math.max(0, n.scrollHeight - n.clientHeight);
2619
2666
  n.scrollTop = Math.min(i, n.scrollTop + t.speedPxPerSecond * r / 1e3);
2620
2667
  }
2621
2668
  this.lastTimestamp = e, this.schedule();
@@ -2629,7 +2676,7 @@ var sn = class {
2629
2676
  };
2630
2677
  //#endregion
2631
2678
  //#region src/core/backendAutofill.ts
2632
- async function cn(e, t, n, r) {
2679
+ async function dn(e, t, n, r) {
2633
2680
  let i = await e.onUnderfilled(n);
2634
2681
  if (!r()) return;
2635
2682
  if (!i.sessionId.trim()) throw TypeError("Vibe backend autofill requires a sessionId.");
@@ -2643,19 +2690,19 @@ async function cn(e, t, n, r) {
2643
2690
  status: "waiting"
2644
2691
  });
2645
2692
  }
2646
- function ln(e, t) {
2693
+ function fn(e, t) {
2647
2694
  ["complete", "exhausted"].includes(t.status) && t.items && (e.items = Z(e.items, t.items)), t.next !== void 0 && (e.next = t.next), t.total !== void 0 && (e.total = t.total);
2648
2695
  }
2649
- function un(e, t, n) {
2696
+ function pn(e, t, n) {
2650
2697
  let r = t.autofill;
2651
- return !Qt(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (ln(t, n), Object.assign(r, Q(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);
2698
+ return !tn(e, n, r) || n.sequence <= r.sequence || ["cancelled", "cancelling"].includes(r.status) || ["complete", "exhausted"].includes(n.status) && n.next === void 0 ? !1 : (fn(t, n), Object.assign(r, Q(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);
2652
2699
  }
2653
- function dn(e, t, n) {
2654
- return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Yt(e, n), ln(t, n), !0);
2700
+ function mn(e, t, n) {
2701
+ return e?.strategy !== "backend" || n.feedKey !== e.feedKey || n.pageSize !== e.pageSize ? !1 : (t.autofill = Qt(e, n), fn(t, n), !0);
2655
2702
  }
2656
2703
  //#endregion
2657
2704
  //#region src/core/initialAutofill.ts
2658
- async function fn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
2705
+ async function hn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r, onPages: i, options: a, signal: o, state: s }) {
2659
2706
  let c = a.autofill;
2660
2707
  if (!c) return;
2661
2708
  let l = s.items.length;
@@ -2668,7 +2715,7 @@ async function fn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2668
2715
  return;
2669
2716
  }
2670
2717
  if (c.strategy === "backend") {
2671
- await cn(c, s, {
2718
+ await dn(c, s, {
2672
2719
  cycleId: e,
2673
2720
  feedKey: c.feedKey,
2674
2721
  items: [...s.items],
@@ -2685,11 +2732,11 @@ async function fn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2685
2732
  s.autofill.status = "exhausted";
2686
2733
  return;
2687
2734
  }
2688
- let u = await $t({
2735
+ let u = await nn({
2689
2736
  existingItems: s.items,
2690
2737
  initialCursor: s.next,
2691
2738
  loadPage: a.loadPage,
2692
- maximumRequests: Gt(c, !1),
2739
+ maximumRequests: Jt(c, !1),
2693
2740
  onCollection: n,
2694
2741
  onDelayChange: (e) => {
2695
2742
  t() && Object.assign(s.autofill, e);
@@ -2712,13 +2759,13 @@ async function fn({ cycleId: e, isCurrent: t, onCollection: n, onLastCursor: r,
2712
2759
  }
2713
2760
  //#endregion
2714
2761
  //#region src/core/fill.ts
2715
- function pn(e) {
2762
+ function gn(e) {
2716
2763
  return "pages" in e ? { pages: e.pages } : { until: "end" };
2717
2764
  }
2718
- function mn(e) {
2765
+ function _n(e) {
2719
2766
  return `${typeof e}:${String(e)}`;
2720
2767
  }
2721
- function hn(e) {
2768
+ function vn(e) {
2722
2769
  if (!e || typeof e != "object") throw TypeError("Vibe fill target must be an object.");
2723
2770
  if ("pages" in e) {
2724
2771
  if (!Number.isInteger(e.pages) || e.pages <= 0) throw TypeError("Vibe fill pages must be a positive integer.");
@@ -2727,20 +2774,20 @@ function hn(e) {
2727
2774
  if ("until" in e && e.until === "end") return { until: "end" };
2728
2775
  throw TypeError("Vibe fill target must be { pages } or { until: 'end' }.");
2729
2776
  }
2730
- function gn(e) {
2777
+ function yn(e) {
2731
2778
  if (!e) return;
2732
2779
  if (e.strategy === "frontend") {
2733
- Vt(e, "frontend fill");
2780
+ Wt(e, "frontend fill");
2734
2781
  return;
2735
2782
  }
2736
2783
  if (!e.feedKey.trim()) throw TypeError("Vibe backend fill requires a feedKey.");
2737
2784
  let t = e.initialSession;
2738
2785
  if (t) {
2739
2786
  if (t.feedKey !== e.feedKey) throw TypeError("Vibe backend fill initialSession feedKey must match fill feedKey.");
2740
- hn(t.target);
2787
+ vn(t.target);
2741
2788
  }
2742
2789
  }
2743
- function _n(e, t, n = !0) {
2790
+ function bn(e, t, n = !0) {
2744
2791
  let r = e?.strategy === "backend" && n ? e.initialSession : void 0, i = t ?? r, a = Q(i?.nextRequestAt);
2745
2792
  return {
2746
2793
  completedPages: i?.completedPages ?? 0,
@@ -2754,10 +2801,10 @@ function _n(e, t, n = !0) {
2754
2801
  sessionId: i?.sessionId ?? null,
2755
2802
  status: i?.status ?? "idle",
2756
2803
  strategy: e?.strategy ?? null,
2757
- target: i ? pn(i.target) : null
2804
+ target: i ? gn(i.target) : null
2758
2805
  };
2759
2806
  }
2760
- function vn(e) {
2807
+ function xn(e) {
2761
2808
  return [
2762
2809
  "cancelling",
2763
2810
  "filling",
@@ -2765,13 +2812,13 @@ function vn(e) {
2765
2812
  "waiting"
2766
2813
  ].includes(e.status);
2767
2814
  }
2768
- async function yn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
2815
+ async function Sn({ existingItems: e, initialCursor: t, loadPage: n, onCollection: r = () => void 0, onDelayChange: i, onProgress: a, options: o, shouldPause: s = () => !1, signal: c, target: l }) {
2769
2816
  let u = [], d = [], f = [...e], p = /* @__PURE__ */ new Set(), m = 0, h = t, g = t, _ = t, v = 0, y;
2770
2817
  for (; _ !== null;) {
2771
- let e = mn(h);
2818
+ let e = _n(h);
2772
2819
  if (p.has(e)) throw Error("Vibe fill received a repeated cursor.");
2773
- if (p.add(e), await Ut({
2774
- delayMs: Ht(m, o),
2820
+ if (p.add(e), await Kt({
2821
+ delayMs: Gt(m, o),
2775
2822
  onChange: i,
2776
2823
  signal: c
2777
2824
  }), m > 0 && s()) return {
@@ -2784,7 +2831,7 @@ async function yn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
2784
2831
  status: "paused",
2785
2832
  total: y
2786
2833
  };
2787
- let t = Ft(await n({
2834
+ let t = Rt(await n({
2788
2835
  cursor: h,
2789
2836
  signal: c
2790
2837
  }));
@@ -2852,7 +2899,7 @@ async function yn({ existingItems: e, initialCursor: t, loadPage: n, onCollectio
2852
2899
  }
2853
2900
  //#endregion
2854
2901
  //#region src/core/backendFill.ts
2855
- async function bn(e, t, n, r) {
2902
+ async function Cn(e, t, n, r) {
2856
2903
  let i = await e.onStart(n);
2857
2904
  if (r()) {
2858
2905
  if (!i.sessionId.trim()) throw TypeError("Vibe backend fill requires a sessionId.");
@@ -2866,22 +2913,22 @@ async function bn(e, t, n, r) {
2866
2913
  });
2867
2914
  }
2868
2915
  }
2869
- function xn(e, t, n) {
2916
+ function wn(e, t, n) {
2870
2917
  return e?.strategy === "backend" && n.feedKey === e.feedKey && n.sessionId === t.fill.sessionId;
2871
2918
  }
2872
- function Sn(e) {
2919
+ function Tn(e) {
2873
2920
  return Number.isInteger(e.completedPages) && e.completedPages >= 0 && Number.isInteger(e.received) && e.received >= 0 && Number.isInteger(e.sequence) && e.sequence >= 0;
2874
2921
  }
2875
- function Cn(e, t) {
2922
+ function En(e, t) {
2876
2923
  if (!["complete", "exhausted"].includes(t.status)) return !0;
2877
2924
  let n = e.fill.target;
2878
2925
  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;
2879
2926
  }
2880
- function wn(e, t, n) {
2927
+ function Dn(e, t, n) {
2881
2928
  t.total !== void 0 && (e.total = t.total), ["complete", "exhausted"].includes(t.status) && (e.items = Z(e.items, t.items ?? []), e.next = t.next ?? null, n(t.lastCursor ?? null));
2882
2929
  }
2883
- function Tn(e, t, n, r) {
2884
- return !xn(e, t, n) || !Sn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !Cn(t, n) ? !1 : (wn(t, n, r), Object.assign(t.fill, {
2930
+ function On(e, t, n, r) {
2931
+ return !wn(e, t, n) || !Tn(n) || n.sequence <= t.fill.sequence || ["cancelled", "cancelling"].includes(t.fill.status) || !En(t, n) ? !1 : (Dn(t, n, r), Object.assign(t.fill, {
2885
2932
  ...Q(n.status === "waiting" ? n.nextRequestAt : null),
2886
2933
  completedPages: n.completedPages,
2887
2934
  error: n.error ?? null,
@@ -2890,42 +2937,42 @@ function Tn(e, t, n, r) {
2890
2937
  status: n.status
2891
2938
  }), !0);
2892
2939
  }
2893
- function En(e, t, n, r) {
2940
+ function kn(e, t, n, r) {
2894
2941
  if (e?.strategy !== "backend" || n.feedKey !== e.feedKey) return !1;
2895
2942
  let i = t.fill;
2896
- return t.fill = _n(e, n), !Sn(n) || !Cn(t, n) ? (t.fill = i, !1) : (wn(t, n, r), !0);
2943
+ return t.fill = bn(e, n), !Tn(n) || !En(t, n) ? (t.fill = i, !1) : (Dn(t, n, r), !0);
2897
2944
  }
2898
2945
  //#endregion
2899
2946
  //#region src/core/fillController.ts
2900
- var Dn = class {
2947
+ var An = class {
2901
2948
  abortController = null;
2902
2949
  cycle = 0;
2903
2950
  delayCountdown;
2904
2951
  requestVersion = 0;
2905
2952
  collection = null;
2906
2953
  constructor(e) {
2907
- this.options = e, this.delayCountdown = new Wt((e) => {
2954
+ this.options = e, this.delayCountdown = new qt((e) => {
2908
2955
  Object.assign(this.options.state.fill, e);
2909
2956
  }), this.syncBackendCountdown();
2910
2957
  }
2911
2958
  isActive() {
2912
- return vn(this.options.state.fill);
2959
+ return xn(this.options.state.fill);
2913
2960
  }
2914
2961
  applyUpdate(e) {
2915
- let t = Tn(this.options.fill, this.options.state, e, this.options.onLastCursor);
2962
+ let t = On(this.options.fill, this.options.state, e, this.options.onLastCursor);
2916
2963
  return t && this.syncBackendCountdown(), t;
2917
2964
  }
2918
2965
  restoreSession(e) {
2919
- let t = En(this.options.fill, this.options.state, e, this.options.onLastCursor);
2966
+ let t = kn(this.options.fill, this.options.state, e, this.options.onLastCursor);
2920
2967
  return t && this.syncBackendCountdown(), t;
2921
2968
  }
2922
2969
  async start(e) {
2923
2970
  let t = this.options.fill;
2924
2971
  if (!t) throw Error("Vibe fill is not configured.");
2925
2972
  if (this.isActive()) throw Error("Vibe fill is already active.");
2926
- let n = hn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
2973
+ let n = vn(e), r = `vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;
2927
2974
  if (this.options.state.fill = {
2928
- ..._n(t, void 0, !1),
2975
+ ...bn(t, void 0, !1),
2929
2976
  cycleId: r,
2930
2977
  status: "filling",
2931
2978
  target: n
@@ -2936,7 +2983,7 @@ var Dn = class {
2936
2983
  let i = ++this.requestVersion, a = new AbortController();
2937
2984
  this.abortController = a;
2938
2985
  try {
2939
- t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await bn(t, this.options.state, {
2986
+ t.strategy === "frontend" ? await this.startFrontend(t, n, a, i) : (await Cn(t, this.options.state, {
2940
2987
  cycleId: r,
2941
2988
  feedKey: t.feedKey,
2942
2989
  items: [...this.options.state.items],
@@ -2954,7 +3001,7 @@ var Dn = class {
2954
3001
  }
2955
3002
  async cancel() {
2956
3003
  let { fill: e, state: t } = this.options;
2957
- if (!vn(t.fill) || !t.fill.cycleId) return;
3004
+ if (!xn(t.fill) || !t.fill.cycleId) return;
2958
3005
  let n = {
2959
3006
  cycleId: t.fill.cycleId,
2960
3007
  feedKey: t.fill.feedKey ?? "",
@@ -2968,7 +3015,7 @@ var Dn = class {
2968
3015
  }
2969
3016
  }
2970
3017
  reset() {
2971
- this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = _n(this.options.fill, void 0, !1), this.collection = null;
3018
+ this.abortLocalRequest(), this.delayCountdown.clear(), this.options.state.fill = bn(this.options.fill, void 0, !1), this.collection = null;
2972
3019
  }
2973
3020
  destroy() {
2974
3021
  this.abortLocalRequest(), this.delayCountdown.clear();
@@ -2984,7 +3031,7 @@ var Dn = class {
2984
3031
  if (!i) throw Error("Vibe frontend fill requires loadPage.");
2985
3032
  let a = this.options.state;
2986
3033
  a.isLoadingMore = !0;
2987
- let o = await yn({
3034
+ let o = await Sn({
2988
3035
  existingItems: a.items,
2989
3036
  initialCursor: a.next,
2990
3037
  loadPage: i,
@@ -3024,7 +3071,7 @@ var Dn = class {
3024
3071
  };
3025
3072
  //#endregion
3026
3073
  //#region src/core/feedFooter.ts
3027
- function On(e) {
3074
+ function jn(e) {
3028
3075
  return {
3029
3076
  cancelAutofill: () => e.cancelAutofill(),
3030
3077
  loadMore: () => e.loadNext(),
@@ -3032,45 +3079,45 @@ function On(e) {
3032
3079
  retryEnd: () => e.retryEnd()
3033
3080
  };
3034
3081
  }
3035
- function kn(e) {
3082
+ function Mn(e) {
3036
3083
  if (!Number.isFinite(e) || e <= 0) throw TypeError("Vibe reelAutoAdvance.intervalMs must be a positive number.");
3037
3084
  }
3038
- function An(e) {
3039
- e?.intervalMs !== void 0 && kn(e.intervalMs);
3085
+ function Nn(e) {
3086
+ e?.intervalMs !== void 0 && Mn(e.intervalMs);
3040
3087
  }
3041
- function jn(e) {
3088
+ function Pn(e) {
3042
3089
  return {
3043
3090
  enabled: e?.enabled ?? !1,
3044
3091
  includePostItems: e?.includePostItems ?? !1,
3045
3092
  intervalMs: e?.intervalMs ?? 5e3
3046
3093
  };
3047
3094
  }
3048
- function Mn(e, t) {
3095
+ function Fn(e, t) {
3049
3096
  if (typeof t == "boolean") {
3050
3097
  e.enabled = t;
3051
3098
  return;
3052
3099
  }
3053
- An(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);
3100
+ Nn(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);
3054
3101
  }
3055
3102
  //#endregion
3056
3103
  //#region src/core/reelInfoSheet.ts
3057
- function Nn(e) {
3104
+ function In(e) {
3058
3105
  return { enabled: e?.enabled ?? !1 };
3059
3106
  }
3060
- function Pn(e, t, n) {
3107
+ function Ln(e, t, n) {
3061
3108
  if (n && !t) throw Error("Vibe cannot enable reelInfoSheet without a configured component.");
3062
3109
  e.enabled = n;
3063
3110
  }
3064
3111
  //#endregion
3065
3112
  //#region src/core/initialRuntimeState.ts
3066
- function Fn(e, t) {
3113
+ function Rn(e, t) {
3067
3114
  let n = e.initialPage;
3068
3115
  return {
3069
3116
  activeReelPostId: null,
3070
- autoScroll: on(e.autoScroll),
3071
- autofill: Yt(e.autofill),
3117
+ autoScroll: ln(e.autoScroll),
3118
+ autofill: Qt(e.autofill),
3072
3119
  error: null,
3073
- fill: _n(e.fill),
3120
+ fill: bn(e.fill),
3074
3121
  infiniteScroll: e.infiniteScroll ?? !0,
3075
3122
  isLoading: !n,
3076
3123
  isLoadingMore: !1,
@@ -3081,14 +3128,14 @@ function Fn(e, t) {
3081
3128
  next: n?.next ?? null,
3082
3129
  nextPageError: null,
3083
3130
  phoneMode: !1,
3084
- reelAutoAdvance: jn(e.reelAutoAdvance),
3131
+ reelAutoAdvance: Pn(e.reelAutoAdvance),
3085
3132
  reelForward: {
3086
3133
  error: null,
3087
3134
  status: "idle"
3088
3135
  },
3089
3136
  reelForwardIndex: null,
3090
3137
  reelForwardItem: null,
3091
- reelInfoSheet: Nn(e.reelInfoSheet),
3138
+ reelInfoSheet: In(e.reelInfoSheet),
3092
3139
  reelInfoSheetOverlay: !1,
3093
3140
  reelMediaSource: "original",
3094
3141
  reelOrigin: null,
@@ -3097,20 +3144,20 @@ function Fn(e, t) {
3097
3144
  }
3098
3145
  //#endregion
3099
3146
  //#region src/core/options.ts
3100
- function In(e, t) {
3147
+ function zn(e, t) {
3101
3148
  if (t) {
3102
3149
  if (!Number.isFinite(t.height) || t.height <= 0) throw TypeError(`Vibe ${e} height must be a positive number.`);
3103
3150
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe ${e} background must be "default" or "transparent".`);
3104
3151
  }
3105
3152
  }
3106
- function Ln(e, t) {
3153
+ function Bn(e, t) {
3107
3154
  if (t) {
3108
3155
  if (t.background !== void 0 && t.background !== "default" && t.background !== "transparent") throw TypeError(`Vibe mediaCard ${e} background must be "default" or "transparent".`);
3109
3156
  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.`);
3110
3157
  }
3111
3158
  }
3112
- function Rn(e) {
3113
- if (an(e.autoScroll), In("cardHeader", e.cardHeader), In("cardFooter", e.cardFooter), Ln("header", e.mediaCard?.header), Ln("footer", e.mediaCard?.footer), Jt(e.autofill), gn(e.fill), An(e.reelAutoAdvance), e.removalReconciliation) {
3159
+ function Vn(e) {
3160
+ if (cn(e.autoScroll), zn("cardHeader", e.cardHeader), zn("cardFooter", e.cardFooter), Bn("header", e.mediaCard?.header), Bn("footer", e.mediaCard?.footer), Zt(e.autofill), yn(e.fill), ae(e.masonry), Nn(e.reelAutoAdvance), e.removalReconciliation) {
3114
3161
  if (!Number.isInteger(e.removalReconciliation.pageSize) || e.removalReconciliation.pageSize <= 0) throw TypeError("Vibe removalReconciliation pageSize must be a positive integer.");
3115
3162
  let t = e.removalReconciliation.maxReplayPages ?? 5;
3116
3163
  if (!Number.isInteger(t) || t <= 0) throw TypeError("Vibe removalReconciliation maxReplayPages must be a positive integer.");
@@ -3124,7 +3171,7 @@ function Rn(e) {
3124
3171
  if (e.fill?.strategy === "frontend" && !e.loadPage) throw TypeError("Vibe frontend fill requires loadPage.");
3125
3172
  if (e.fill?.strategy === "backend" && e.fill.initialSession && !e.initialPage) throw TypeError("Vibe backend fill restoration requires initialPage.");
3126
3173
  }
3127
- function zn(e) {
3174
+ function Hn(e) {
3128
3175
  if (typeof e != "string") return e;
3129
3176
  if (typeof document > "u") throw Error("Vibe cannot resolve a selector without a document.");
3130
3177
  let t = document.querySelector(e);
@@ -3133,7 +3180,7 @@ function zn(e) {
3133
3180
  }
3134
3181
  //#endregion
3135
3182
  //#region src/core/pageRequest.ts
3136
- async function Bn({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3183
+ async function Un({ append: e, autofillController: t, cursor: n, isCurrent: r, loadPage: i, onLastCursor: a, onPages: o, options: s, signal: c, state: l }) {
3137
3184
  let u = s.autofill, d = e && u?.strategy === "frontend" && l.autofill.status === "paused", f = d ? {
3138
3185
  received: l.autofill.received,
3139
3186
  requests: l.autofill.requests
@@ -3145,11 +3192,11 @@ async function Bn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3145
3192
  let m = !1;
3146
3193
  try {
3147
3194
  if (u?.strategy === "frontend") {
3148
- let s = await $t({
3195
+ let s = await nn({
3149
3196
  existingItems: e ? l.items : [],
3150
3197
  initialCursor: n,
3151
3198
  loadPage: i,
3152
- maximumRequests: f ? Math.max(0, Gt(u) - f.requests) : void 0,
3199
+ maximumRequests: f ? Math.max(0, Jt(u) - f.requests) : void 0,
3153
3200
  onCollection: (e) => t.captureCollection(e, r()),
3154
3201
  onDelayChange: (e) => {
3155
3202
  r() && Object.assign(l.autofill, e);
@@ -3172,7 +3219,7 @@ async function Bn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3172
3219
  }), o(s.pages), t.clearCollection();
3173
3220
  return;
3174
3221
  }
3175
- let s = Ft(await i({
3222
+ let s = Rt(await i({
3176
3223
  cursor: n,
3177
3224
  signal: c
3178
3225
  }));
@@ -3192,7 +3239,7 @@ async function Bn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3192
3239
  l.autofill.status = "complete";
3193
3240
  return;
3194
3241
  }
3195
- await cn(u, l, {
3242
+ await dn(u, l, {
3196
3243
  cycleId: p,
3197
3244
  feedKey: u.feedKey,
3198
3245
  items: h.slice(d.length),
@@ -3216,13 +3263,13 @@ async function Bn({ append: e, autofillController: t, cursor: n, isCurrent: r, l
3216
3263
  function $(e) {
3217
3264
  return `${typeof e}:${String(e)}`;
3218
3265
  }
3219
- function Vn(e) {
3266
+ function Wn(e) {
3220
3267
  return `${typeof e}:${String(e)}`;
3221
3268
  }
3222
- function Hn(e) {
3269
+ function Gn(e) {
3223
3270
  return e.map(({ postId: e }) => e);
3224
3271
  }
3225
- var Un = class {
3272
+ var Kn = class {
3226
3273
  delay;
3227
3274
  enabled;
3228
3275
  maxReplayPages;
@@ -3264,14 +3311,14 @@ var Un = class {
3264
3311
  async reconcile({ existingItems: e, loadPage: t, shouldPause: n = () => !1, signal: r }) {
3265
3312
  let i = this.pending ?? this.createSession(e);
3266
3313
  for (this.pending = i; i.remainingRequests > 0;) {
3267
- let e = Vn(i.cursor);
3314
+ let e = Wn(i.cursor);
3268
3315
  if (i.seenCursors.has(e)) throw Error("Vibe removal reconciliation received a repeated cursor.");
3269
- if (await Ut({
3270
- delayMs: Ht(i.pages.length, this.delay),
3316
+ if (await Kt({
3317
+ delayMs: Gt(i.pages.length, this.delay),
3271
3318
  onChange: () => void 0,
3272
3319
  signal: r
3273
3320
  }), i.pages.length > 0 && n()) return this.result(i, "paused");
3274
- let a = Ft(await t({
3321
+ let a = Rt(await t({
3275
3322
  cursor: i.cursor,
3276
3323
  signal: r
3277
3324
  }));
@@ -3284,7 +3331,7 @@ var Un = class {
3284
3331
  contributionIds: s,
3285
3332
  cursor: i.cursor,
3286
3333
  next: a.next,
3287
- returnedIds: Hn(o)
3334
+ returnedIds: Gn(o)
3288
3335
  }), i.lastCursor = i.cursor, i.next = a.next, --i.remainingRequests, a.total !== void 0 && (i.total = a.total), i.next === null ? i.remainingRequests = 0 : i.cursor = i.next, i.remainingRequests > 0 && n()) return this.result(i, "paused");
3289
3336
  }
3290
3337
  return this.result(i, "complete");
@@ -3323,7 +3370,7 @@ var Un = class {
3323
3370
  return this.pages.findIndex(({ contributionIds: e }) => e.filter((e) => t.has($(e))).length < this.pageSize);
3324
3371
  }
3325
3372
  recordPage(e) {
3326
- let t = Vn(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Vn(e) === t);
3373
+ let t = Wn(e.cursor), n = this.pages.findIndex(({ cursor: e }) => Wn(e) === t);
3327
3374
  n >= 0 && (this.pages = this.pages.slice(0, n)), this.pages.push({
3328
3375
  ...e,
3329
3376
  contributionIds: [...e.contributionIds],
@@ -3333,7 +3380,7 @@ var Un = class {
3333
3380
  };
3334
3381
  //#endregion
3335
3382
  //#region src/core/activeItemRemoval.ts
3336
- function Wn(e, t, n, r, i) {
3383
+ function qn(e, t, n, r, i) {
3337
3384
  let a = new Set(t.map(({ item: e }) => e.postId));
3338
3385
  if (e.activeReelPostId === null || !a.has(e.activeReelPostId)) return;
3339
3386
  let o = e.items[Math.max(n, 0)];
@@ -3346,7 +3393,7 @@ function Wn(e, t, n, r, i) {
3346
3393
  }
3347
3394
  //#endregion
3348
3395
  //#region src/core/exactMediaRemovalController.ts
3349
- function Gn(e, t) {
3396
+ function Jn(e, t) {
3350
3397
  let [n, ...r] = t;
3351
3398
  if (!n) throw Error("Vibe items must contain at least one media asset.");
3352
3399
  return {
@@ -3355,10 +3402,10 @@ function Gn(e, t) {
3355
3402
  items: r
3356
3403
  };
3357
3404
  }
3358
- function Kn(e) {
3405
+ function Yn(e) {
3359
3406
  if (!Number.isInteger(e.mediaIndex) || e.mediaIndex < 0) throw TypeError("Vibe mediaIndex must be a non-negative integer.");
3360
3407
  }
3361
- var qn = class {
3408
+ var Xn = class {
3362
3409
  generation = 0;
3363
3410
  metadata = /* @__PURE__ */ new WeakMap();
3364
3411
  state;
@@ -3366,7 +3413,7 @@ var qn = class {
3366
3413
  this.options = e, this.state = e.state;
3367
3414
  }
3368
3415
  remove(e) {
3369
- Kn(e);
3416
+ Yn(e);
3370
3417
  let t = this.state.items.findIndex(({ postId: t }) => t === e.postId), n = this.state.items[t];
3371
3418
  if (!n) return null;
3372
3419
  let r = [...M(n)], i = r[e.mediaIndex];
@@ -3383,7 +3430,7 @@ var qn = class {
3383
3430
  restored: !1
3384
3431
  });
3385
3432
  let o = this.state.mediaIndices.get(n.postId) ?? 0, s = this.isReelOpen() && this.state.activeReelPostId === n.postId, c = s && o === e.mediaIndex;
3386
- return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Gn(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);
3433
+ return r.splice(e.mediaIndex, 1), r.length > 0 ? (this.state.items[t] = Jn(n, r), this.updateMediaIndexAfterRemoval(n.postId, e.mediaIndex, c), a) : (this.state.items.splice(t, 1), this.options.onPostRemoved(n.postId), this.state.mediaIndices.delete(n.postId), s && this.advanceFromRemovedPost(a, n), a);
3387
3434
  }
3388
3435
  reset() {
3389
3436
  this.generation += 1;
@@ -3409,7 +3456,7 @@ var qn = class {
3409
3456
  }
3410
3457
  restoreIntoPost(e, t) {
3411
3458
  let n = this.state.items[e], r = [...M(n)], i = Math.min(t.mediaIndex, r.length);
3412
- if (r.splice(i, 0, t.media), this.state.items[e] = Gn(n, r), this.state.activeReelPostId !== t.postId) return;
3459
+ if (r.splice(i, 0, t.media), this.state.items[e] = Jn(n, r), this.state.activeReelPostId !== t.postId) return;
3413
3460
  let a = this.state.mediaIndices.get(t.postId) ?? 0;
3414
3461
  a >= i && this.state.mediaIndices.set(t.postId, a + 1);
3415
3462
  }
@@ -3422,18 +3469,18 @@ var qn = class {
3422
3469
  };
3423
3470
  //#endregion
3424
3471
  //#region src/core/itemPlacement.ts
3425
- function Jn(e, t) {
3472
+ function Zn(e, t) {
3426
3473
  let n = new Set(t);
3427
3474
  return e.flatMap((e, t) => n.has(e.postId) ? [{
3428
3475
  index: t,
3429
3476
  item: e
3430
3477
  }] : []);
3431
3478
  }
3432
- function Yn(e, t) {
3479
+ function Qn(e, t) {
3433
3480
  let n = new Set(t.map(({ item: e }) => e.postId));
3434
3481
  return e.filter((e) => !n.has(e.postId));
3435
3482
  }
3436
- function Xn(e, t) {
3483
+ function $n(e, t) {
3437
3484
  t.forEach(({ index: e }) => {
3438
3485
  if (!Number.isInteger(e) || e < 0) throw Error("Vibe item restore indexes must be non-negative integers.");
3439
3486
  });
@@ -3444,7 +3491,7 @@ function Xn(e, t) {
3444
3491
  }
3445
3492
  //#endregion
3446
3493
  //#region src/core/itemRemovalController.ts
3447
- var Zn = 20, Qn = class {
3494
+ var er = 20, tr = class {
3448
3495
  generation = 0;
3449
3496
  historyLimit;
3450
3497
  metadata = /* @__PURE__ */ new WeakMap();
@@ -3453,7 +3500,7 @@ var Zn = 20, Qn = class {
3453
3500
  itemOrder;
3454
3501
  stopItemsWatcher;
3455
3502
  constructor(e) {
3456
- this.options = e, this.historyLimit = e.historyLimit ?? Zn, 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" });
3503
+ this.options = e, this.historyLimit = e.historyLimit ?? er, 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" });
3457
3504
  }
3458
3505
  destroy() {
3459
3506
  this.reset(), this.stopItemsWatcher();
@@ -3466,7 +3513,7 @@ var Zn = 20, Qn = class {
3466
3513
  let i = this.options.startRemoval(r);
3467
3514
  if (i > 0 && await new Promise((e) => setTimeout(e, i)), this.metadata.get(n)?.generation !== this.generation) return n;
3468
3515
  let a = this.state.items.findIndex((e) => e.postId === this.state.activeReelPostId), o = new Set(t.map(({ item: e }) => e.postId)), s = a < 0 ? 0 : this.state.items.slice(0, a).filter(({ postId: e }) => o.has(e)).length, c = Math.max(a - s, 0);
3469
- return this.state.items = Yn(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
3516
+ return this.state.items = Qn(this.state.items, t), this.options.onItemsRemoved(n, t, c), this.record(n), n;
3470
3517
  }
3471
3518
  reset() {
3472
3519
  this.generation += 1, this.history = [], this.itemOrder = [];
@@ -3477,7 +3524,7 @@ var Zn = 20, Qn = class {
3477
3524
  this.restoreRemoval(t);
3478
3525
  return;
3479
3526
  }
3480
- let n = Xn(this.state.items, e);
3527
+ let n = $n(this.state.items, e);
3481
3528
  this.registerExternalPlacements(e), this.state.items = n;
3482
3529
  }
3483
3530
  restoreRemoval(e) {
@@ -3503,7 +3550,7 @@ var Zn = 20, Qn = class {
3503
3550
  }
3504
3551
  collectOrderedPlacements(e) {
3505
3552
  let t = new Map(this.itemOrder.map((e, t) => [e, t]));
3506
- return Jn(this.state.items, e).map((e) => ({
3553
+ return Zn(this.state.items, e).map((e) => ({
3507
3554
  index: t.get(e.item.postId) ?? e.index,
3508
3555
  item: e.item
3509
3556
  }));
@@ -3534,7 +3581,7 @@ var Zn = 20, Qn = class {
3534
3581
  let r = new Map(this.itemOrder.map((e, t) => [e, t]));
3535
3582
  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;
3536
3583
  }
3537
- }, $n = class {
3584
+ }, nr = class {
3538
3585
  forward = null;
3539
3586
  forwardPromise = null;
3540
3587
  forwardVersion = 0;
@@ -3612,7 +3659,7 @@ var Zn = 20, Qn = class {
3612
3659
  }
3613
3660
  }
3614
3661
  }
3615
- }, er = class {
3662
+ }, rr = class {
3616
3663
  generation = 0;
3617
3664
  pending = Promise.resolve();
3618
3665
  constructor(e) {
@@ -3662,24 +3709,24 @@ var Zn = 20, Qn = class {
3662
3709
  };
3663
3710
  //#endregion
3664
3711
  //#region src/core/removalControllers.ts
3665
- function tr(e) {
3666
- let t = new $n(e), n = new er({
3712
+ function ir(e) {
3713
+ let t = new nr(e), n = new rr({
3667
3714
  state: e.state,
3668
3715
  transitionMedia: (t) => e.surface()?.transitionActiveReelMedia(t) ?? Promise.resolve(!1),
3669
3716
  transitionPost: (t) => e.surface()?.transitionActiveReelPost(t) ?? Promise.resolve(!1)
3670
3717
  });
3671
3718
  return {
3672
- exactMediaRemoval: new qn({
3719
+ exactMediaRemoval: new Xn({
3673
3720
  onActivate: e.onActivate,
3674
3721
  onPostRemoved: (t) => e.onItemsRemoved([t]),
3675
3722
  onPostRestored: (t) => e.onItemsRestored([t]),
3676
3723
  reelForward: t,
3677
3724
  state: e.state
3678
3725
  }),
3679
- itemRemoval: new Qn({
3726
+ itemRemoval: new tr({
3680
3727
  historyLimit: e.historyLimit,
3681
3728
  onItemsRemoved: (n, r, i) => {
3682
- e.onItemsRemoved(r.map(({ item: e }) => e.postId)), Wn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
3729
+ e.onItemsRemoved(r.map(({ item: e }) => e.postId)), qn(e.state, r, i, e.onActivate, (e, r) => t.start(n, e, r));
3683
3730
  },
3684
3731
  onRemovalRestored: (n) => {
3685
3732
  e.onItemsRestored(n.map(({ item: e }) => e.postId));
@@ -3694,17 +3741,17 @@ function tr(e) {
3694
3741
  reelRemoval: n
3695
3742
  };
3696
3743
  }
3697
- var nr = 1.5;
3698
- function rr(e) {
3744
+ var ar = 1.5;
3745
+ function or(e) {
3699
3746
  let t = Math.min(e.screenWidth, e.screenHeight);
3700
3747
  if (t > 0 && t < 600) return !0;
3701
- let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * nr;
3748
+ let n = Math.min(e.viewportWidth, e.viewportHeight), r = t >= n * ar;
3702
3749
  return !e.hasHover && n > 0 && n < 600 && r;
3703
3750
  }
3704
- function ir(e) {
3705
- return rr(e) ? "reel" : "masonry";
3751
+ function sr(e) {
3752
+ return or(e) ? "reel" : "masonry";
3706
3753
  }
3707
- function ar(e) {
3754
+ function cr(e) {
3708
3755
  let t = e.ownerDocument.defaultView, n = e.ownerDocument.documentElement;
3709
3756
  return {
3710
3757
  hasHover: typeof t?.matchMedia == "function" && t.matchMedia("(hover: hover)").matches,
@@ -3714,15 +3761,15 @@ function ar(e) {
3714
3761
  viewportWidth: n.clientWidth
3715
3762
  };
3716
3763
  }
3717
- function or(e) {
3718
- return rr(ar(e));
3764
+ function lr(e) {
3765
+ return or(cr(e));
3719
3766
  }
3720
- function sr(e) {
3721
- return ir(ar(e));
3767
+ function ur(e) {
3768
+ return sr(cr(e));
3722
3769
  }
3723
3770
  //#endregion
3724
3771
  //#region src/core/responsiveLayoutController.ts
3725
- var cr = class {
3772
+ var dr = class {
3726
3773
  layoutMode;
3727
3774
  resizeObserver = null;
3728
3775
  target = null;
@@ -3747,10 +3794,10 @@ var cr = class {
3747
3794
  }
3748
3795
  handleResponsiveLayout = () => {
3749
3796
  if (!this.target) return;
3750
- let e = sr(this.target);
3751
- this.state.phoneMode = or(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
3797
+ let e = ur(this.target);
3798
+ this.state.phoneMode = lr(this.target), this.state.reelInfoSheetOverlay = this.state.phoneMode, this.state.reelMediaSource = e === "reel" ? "preview" : "original", this.layoutMode === "responsive" && this.applyLayout(e);
3752
3799
  };
3753
- }, lr = class {
3800
+ }, fr = class {
3754
3801
  routedReelPostId = null;
3755
3802
  reelRouteIsActive = !1;
3756
3803
  constructor(e, t) {
@@ -3777,7 +3824,7 @@ var cr = class {
3777
3824
  let i = this.reelRouteIsActive ? "replace" : "push";
3778
3825
  this.reelRouteIsActive = !0, this.routedReelPostId = e, this.options.router[i](r);
3779
3826
  }
3780
- }, ur = class {
3827
+ }, pr = class {
3781
3828
  app = null;
3782
3829
  autoScroll;
3783
3830
  autofillController;
@@ -3795,14 +3842,15 @@ var cr = class {
3795
3842
  surface = null;
3796
3843
  stopStateWatcher = null;
3797
3844
  lastLoadedCursor = null;
3845
+ notificationItems;
3798
3846
  state;
3799
3847
  constructor(e) {
3800
- this.options = e, Rn(e);
3848
+ this.options = e, Vn(e);
3801
3849
  let t = e.layout ?? "masonry";
3802
- this.state = x(Fn(e, t)), this.autoScroll = new sn({
3850
+ this.state = x(Rn(e, t)), this.notificationItems = I(this.state), this.autoScroll = new un({
3803
3851
  getScrollElement: () => this.surface?.getAutoScrollElement() ?? null,
3804
3852
  state: this.state.autoScroll
3805
- }), this.autofillController = new en({
3853
+ }), this.autofillController = new rn({
3806
3854
  cancelRequest: () => this.cancelRequest(),
3807
3855
  onLastCursor: (e) => {
3808
3856
  this.lastLoadedCursor = e;
@@ -3810,7 +3858,7 @@ var cr = class {
3810
3858
  onPages: (e) => this.removalReconciliation.recordPages(e),
3811
3859
  options: e.autofill,
3812
3860
  state: this.state
3813
- }), this.removalReconciliation = new Un(e), this.fillController = new Dn({
3861
+ }), this.removalReconciliation = new Kn(e), this.fillController = new An({
3814
3862
  fill: e.fill,
3815
3863
  loadPage: e.loadPage ? (e) => this.loadFilteredPage(e) : void 0,
3816
3864
  onLastCursor: (e) => {
@@ -3818,8 +3866,8 @@ var cr = class {
3818
3866
  },
3819
3867
  onPages: (e) => this.removalReconciliation.recordPages(e),
3820
3868
  state: this.state
3821
- }), this.routing = new lr(e.routing, this.state);
3822
- let n = tr({
3869
+ }), this.routing = new fr(e.routing, this.state);
3870
+ let n = ir({
3823
3871
  historyLimit: e.removalHistoryLimit,
3824
3872
  loadNext: () => this.loadNext(),
3825
3873
  onActivate: (e) => this.setActiveReelPost(e),
@@ -3829,21 +3877,22 @@ var cr = class {
3829
3877
  state: this.state,
3830
3878
  surface: () => this.surface
3831
3879
  });
3832
- this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new cr(t, this.state, () => {
3880
+ this.exactMediaRemoval = n.exactMediaRemoval, this.itemRemoval = n.itemRemoval, this.reelForward = n.reelForward, this.reelRemoval = n.reelRemoval, this.responsiveLayout = new dr(t, this.state, () => {
3833
3881
  this.routing.syncFeed();
3834
3882
  }), this.startStateNotifications();
3835
3883
  }
3836
3884
  async mount() {
3837
3885
  if (this.app) throw Error("Vibe is already mounted.");
3838
3886
  this.startStateNotifications();
3839
- let e = zn(this.options.target);
3840
- this.responsiveLayout.mount(e), this.app = i(Pt, {
3887
+ let e = Hn(this.options.target);
3888
+ this.responsiveLayout.mount(e), this.app = i(Lt, {
3841
3889
  canRetryEnd: !!this.options.loadPage,
3842
3890
  cardFooter: this.options.cardFooter,
3843
3891
  cardHeader: this.options.cardHeader,
3844
3892
  feedFooter: this.options.feedFooter,
3845
- feedFooterActions: On(this),
3893
+ feedFooterActions: jn(this),
3846
3894
  mediaCard: this.options.mediaCard,
3895
+ masonry: this.options.masonry,
3847
3896
  onMediaReady: this.options.onMediaReady,
3848
3897
  onMediaVisible: this.options.onMediaVisible,
3849
3898
  onReelMediaChange: this.options.onReelMediaChange,
@@ -3870,7 +3919,7 @@ var cr = class {
3870
3919
  this.autoScroll.destroy(), this.fillController.destroy(), this.cancelRequest(), this.reelForward.reset(), this.reelRemoval.reset(), this.exactMediaRemoval.reset(), this.itemRemoval.destroy(), this.removalReconciliation.reset(), this.responsiveLayout.destroy(), this.stopStateWatcher?.(), this.stopStateWatcher = null, this.app?.unmount(), this.app = null, this.surface = null;
3871
3920
  }
3872
3921
  getState() {
3873
- return I(this.state);
3922
+ return L(this.state);
3874
3923
  }
3875
3924
  removeMedia(e) {
3876
3925
  return this.exactMediaRemoval.remove(e);
@@ -3924,7 +3973,7 @@ var cr = class {
3924
3973
  this.autoScroll.setSpeed(e);
3925
3974
  }
3926
3975
  applyAutofillUpdate(e) {
3927
- let t = un(this.options.autofill, this.state, e);
3976
+ let t = pn(this.options.autofill, this.state, e);
3928
3977
  return t && this.autofillController.syncCountdown(), t;
3929
3978
  }
3930
3979
  cancelAutofill() {
@@ -3935,7 +3984,7 @@ var cr = class {
3935
3984
  await this.cancelFill();
3936
3985
  return;
3937
3986
  }
3938
- if (Xt(this.state.autofill)) {
3987
+ if ($t(this.state.autofill)) {
3939
3988
  await this.cancelAutofill();
3940
3989
  return;
3941
3990
  }
@@ -3949,12 +3998,12 @@ var cr = class {
3949
3998
  }
3950
3999
  async fill(e) {
3951
4000
  if (!this.state.loadMoreLocked) {
3952
- if (this.pendingRequest || Xt(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
4001
+ if (this.pendingRequest || $t(this.state.autofill)) throw Error("Vibe cannot fill while another page operation is active.");
3953
4002
  await this.fillController.start(e);
3954
4003
  }
3955
4004
  }
3956
4005
  restoreAutofillSession(e) {
3957
- let t = dn(this.options.autofill, this.state, e);
4006
+ let t = mn(this.options.autofill, this.state, e);
3958
4007
  return t && this.autofillController.syncCountdown(), t;
3959
4008
  }
3960
4009
  restoreFillSession(e) {
@@ -3962,7 +4011,7 @@ var cr = class {
3962
4011
  }
3963
4012
  async loadNext() {
3964
4013
  if (this.pendingRequest) return this.pendingRequest;
3965
- if (this.state.loadMoreLocked || Xt(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
4014
+ if (this.state.loadMoreLocked || $t(this.state.autofill) || this.fillController.isActive() || !this.options.loadPage || this.state.next === null && !this.removalReconciliation.needsReconciliation(this.state.items)) return;
3966
4015
  this.state.isLoadingMore = !0, this.state.nextPageError = null;
3967
4016
  let e = this.loadNextSequence();
3968
4017
  return this.pendingRequest = e, e.finally(() => {
@@ -3977,12 +4026,12 @@ var cr = class {
3977
4026
  }
3978
4027
  async replaceFeed(e, t) {
3979
4028
  if (!this.options.loadPage) throw Error(`Vibe cannot ${t} without loadPage.`);
3980
- return Xt(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Yt(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.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
4029
+ return $t(this.state.autofill) && await this.cancelAutofill(), this.fillController.isActive() && await this.cancelFill(), this.cancelRequest(), this.state.autofill = Qt(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.isLoading = !0, this.state.items = [], this.state.next = null, this.state.nextPageError = null, this.state.total = null, this.startRequest(e, !1);
3981
4030
  }
3982
4031
  async loadFilteredPage(e) {
3983
4032
  let t = this.options.loadPage;
3984
4033
  if (!t) throw Error("Vibe cannot load a page without loadPage.");
3985
- let n = Ft(await t(e));
4034
+ let n = Rt(await t(e));
3986
4035
  return {
3987
4036
  ...n,
3988
4037
  items: this.removalReconciliation.filterItems(n.items)
@@ -4012,7 +4061,7 @@ var cr = class {
4012
4061
  }
4013
4062
  async retryEnd() {
4014
4063
  if (this.pendingRequest) return this.pendingRequest;
4015
- if (!this.state.loadMoreLocked && !(Xt(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);
4064
+ if (!this.state.loadMoreLocked && !($t(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);
4016
4065
  }
4017
4066
  setInfiniteScroll(e) {
4018
4067
  this.state.infiniteScroll = e, e && m(() => this.surface?.loadIfNearBottom());
@@ -4040,10 +4089,10 @@ var cr = class {
4040
4089
  this.state.total = e;
4041
4090
  }
4042
4091
  setReelAutoAdvance(e) {
4043
- Mn(this.state.reelAutoAdvance, e);
4092
+ Fn(this.state.reelAutoAdvance, e);
4044
4093
  }
4045
4094
  setReelInfoSheet(e) {
4046
- Pn(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4095
+ Ln(this.state.reelInfoSheet, this.options.reelInfoSheet, e);
4047
4096
  }
4048
4097
  setLayout(e) {
4049
4098
  this.responsiveLayout.setLayout(e);
@@ -4063,7 +4112,7 @@ var cr = class {
4063
4112
  async fetchPage(e, t) {
4064
4113
  if (!this.options.loadPage) return;
4065
4114
  let n = ++this.requestVersion, r = new AbortController();
4066
- this.abortController = r, await Bn({
4115
+ this.abortController = r, await Un({
4067
4116
  append: t,
4068
4117
  autofillController: this.autofillController,
4069
4118
  cursor: e,
@@ -4087,7 +4136,7 @@ var cr = class {
4087
4136
  startInitialAutofill() {
4088
4137
  let e = ++this.requestVersion, t = new AbortController(), n = this.autofillController.beginCycle();
4089
4138
  this.abortController = t, this.state.isLoadingMore = !0;
4090
- let r = fn({
4139
+ let r = hn({
4091
4140
  cycleId: n,
4092
4141
  isCurrent: () => e === this.requestVersion,
4093
4142
  onCollection: (t) => this.autofillController.captureCollection(t, e === this.requestVersion),
@@ -4107,14 +4156,14 @@ var cr = class {
4107
4156
  }
4108
4157
  startStateNotifications() {
4109
4158
  let e = this.options.onStateChange;
4110
- !e || this.stopStateWatcher || (e(this.getState()), this.stopStateWatcher = O(this.state, () => e(this.getState()), {
4159
+ !e || this.stopStateWatcher || (e(L(this.state, this.notificationItems.value)), this.stopStateWatcher = O(this.state, () => e(L(this.state, this.notificationItems.value)), {
4111
4160
  deep: !0,
4112
4161
  flush: "post"
4113
4162
  }));
4114
4163
  }
4115
4164
  };
4116
- function dr(e) {
4117
- return new ur(e);
4165
+ function mr(e) {
4166
+ return new pr(e);
4118
4167
  }
4119
4168
  //#endregion
4120
- export { dr as createVibe };
4169
+ export { mr as createVibe };