@wyxos/vibe 4.0.0 → 4.1.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/README.md +53 -5
- package/lib/components/FeedFooter.vue.d.ts +21 -0
- package/lib/components/FeedStatus.vue.d.ts +16 -0
- package/lib/components/VibeSurface.vue.d.ts +4 -2
- package/lib/core/autofill.d.ts +1 -0
- package/lib/core/feed.d.ts +4 -1
- package/lib/core/feedFooter.d.ts +9 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +869 -717
- package/lib/types.d.ts +16 -1
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Vibe is an initializable Vue 3 media feed with virtualized masonry and reel layouts.
|
|
4
4
|
|
|
5
|
+
Read the [full documentation](./docs/index.md) for guided setup, layout and data-loading concepts, and the API reference.
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -145,11 +147,13 @@ integration is used.
|
|
|
145
147
|
|
|
146
148
|
## Autofill
|
|
147
149
|
|
|
148
|
-
Autofill targets a number of new top-level cards after
|
|
149
|
-
|
|
150
|
+
Autofill targets a number of new top-level cards after the provider or consumer
|
|
151
|
+
adapter has grouped each post into one `VibeItem`. Vibe does not perform
|
|
152
|
+
provider-specific grouping; it only deduplicates `postId` defensively as pages
|
|
153
|
+
are appended. `autofill.pageSize` is the minimum card target for one Vibe load
|
|
150
154
|
cycle, not the server's own response size. For example, a server may return up
|
|
151
|
-
to 30 cards per request while Vibe is configured with `pageSize: 40`;
|
|
152
|
-
follows cursors until the cycle contains at least 40 cards.
|
|
155
|
+
to 30 grouped cards per request while Vibe is configured with `pageSize: 40`;
|
|
156
|
+
Vibe then follows cursors until the cycle contains at least 40 cards.
|
|
153
157
|
|
|
154
158
|
### Frontend autofill
|
|
155
159
|
|
|
@@ -167,7 +171,7 @@ const vibe = createVibe({
|
|
|
167
171
|
autofill: {
|
|
168
172
|
strategy: 'frontend',
|
|
169
173
|
pageSize: 40,
|
|
170
|
-
maxAdditionalPages:
|
|
174
|
+
maxAdditionalPages: 'unlimited',
|
|
171
175
|
delayStepMs: 2_000,
|
|
172
176
|
delayMaxMs: 10_000,
|
|
173
177
|
},
|
|
@@ -186,6 +190,9 @@ await vibe.mount()
|
|
|
186
190
|
There is no frontend session snapshot. With 25 restored cards and
|
|
187
191
|
`pageSize: 40`, Vibe continues from `initialPage.next` until the load cycle has
|
|
188
192
|
at least 40 unique cards. Without `initialPage`, Vibe starts at cursor `null`.
|
|
193
|
+
`maxAdditionalPages` accepts a non-negative integer or the serializable string
|
|
194
|
+
`'unlimited'`. Unlimited cycles still stop at the target, end of pagination,
|
|
195
|
+
a repeated cursor, an error, cancellation/abort, or `destroy()`.
|
|
189
196
|
|
|
190
197
|
The first request is immediate. Each subsequent request waits
|
|
191
198
|
`min(completedRequests * delayStepMs, delayMaxMs)`, so the defaults produce
|
|
@@ -564,6 +571,47 @@ reel still updates this requested state; the sheet becomes visible when a valid
|
|
|
564
571
|
reel context exists. This preserves the existing persistent sheet-state
|
|
565
572
|
behavior across masonry viewer closes.
|
|
566
573
|
|
|
574
|
+
## Custom feed footer
|
|
575
|
+
|
|
576
|
+
Set `feedFooter.component` to replace the built-in `GalleryFooter`. Consumers
|
|
577
|
+
that omit it keep the existing pagination and end-of-feed footer.
|
|
578
|
+
|
|
579
|
+
```ts
|
|
580
|
+
import FeedFooter from './FeedFooter.vue'
|
|
581
|
+
|
|
582
|
+
const vibe = createVibe({
|
|
583
|
+
target: '#gallery',
|
|
584
|
+
loadPage,
|
|
585
|
+
feedFooter: {
|
|
586
|
+
component: FeedFooter,
|
|
587
|
+
},
|
|
588
|
+
})
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
Type the component with `VibeFeedFooterProps`. Its `state` prop is the reactive
|
|
592
|
+
public `VibeState`, including autofill progress, request count, countdown,
|
|
593
|
+
loading, end, error, and load-more-lock state. Its `actions` prop contains
|
|
594
|
+
`loadMore()`, `retryEnd()`, `retry()`, and `cancelAutofill()`:
|
|
595
|
+
|
|
596
|
+
```vue
|
|
597
|
+
<script setup lang="ts">
|
|
598
|
+
import type { VibeFeedFooterProps } from '@wyxos/vibe'
|
|
599
|
+
|
|
600
|
+
const props = defineProps<VibeFeedFooterProps>()
|
|
601
|
+
</script>
|
|
602
|
+
|
|
603
|
+
<template>
|
|
604
|
+
<footer>
|
|
605
|
+
<span>{{ props.state.autofill.received }} / {{ props.state.autofill.pageSize }}</span>
|
|
606
|
+
<button type="button" @click="props.actions.cancelAutofill()">Cancel</button>
|
|
607
|
+
</footer>
|
|
608
|
+
</template>
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
A footer may instead emit `load-more`, `retry-end`, `retry`, or
|
|
612
|
+
`autofill-cancel`; Vibe routes those events to the same actions. Consumer
|
|
613
|
+
components own their markup, styling, state selection, and additional controls.
|
|
614
|
+
|
|
567
615
|
## Load-more lock
|
|
568
616
|
|
|
569
617
|
Pause ordinary forward pagination without disabling the feed or cancelling a request
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { VibeFeedFooter, VibeFeedFooterActions, VibeState } from '../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
actions?: VibeFeedFooterActions;
|
|
4
|
+
canRetryEnd: boolean;
|
|
5
|
+
feedFooter?: VibeFeedFooter;
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
hasNext: boolean;
|
|
8
|
+
infiniteScroll: boolean;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
loadMoreLocked: boolean;
|
|
11
|
+
state?: VibeState;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
loadMore: () => any;
|
|
15
|
+
retryEnd: () => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
onLoadMore?: (() => any) | undefined;
|
|
18
|
+
onRetryEnd?: (() => any) | undefined;
|
|
19
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { VibeFeedFooter, VibeFeedFooterActions, VibeState } from '../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
actions: VibeFeedFooterActions;
|
|
4
|
+
canRetryEnd: boolean;
|
|
5
|
+
feedFooter?: VibeFeedFooter;
|
|
6
|
+
state: VibeState;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
|
+
loadMore: () => any;
|
|
10
|
+
retryEnd: () => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onLoadMore?: (() => any) | undefined;
|
|
13
|
+
onRetryEnd?: (() => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { VibeCardRegion, VibeItemId, VibeReelInfoSheetOptions } from '../types';
|
|
1
|
+
import { type VibeRuntimeState } from '../core/runtime';
|
|
2
|
+
import type { VibeCardRegion, VibeFeedFooter, VibeFeedFooterActions, VibeItemId, VibeReelInfoSheetOptions } from '../types';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
canRetryEnd: boolean;
|
|
5
5
|
cardFooter?: VibeCardRegion;
|
|
6
6
|
cardHeader?: VibeCardRegion;
|
|
7
|
+
feedFooter?: VibeFeedFooter;
|
|
8
|
+
feedFooterActions: VibeFeedFooterActions;
|
|
7
9
|
reelInfoSheet?: VibeReelInfoSheetOptions;
|
|
8
10
|
state: VibeRuntimeState;
|
|
9
11
|
};
|
package/lib/core/autofill.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { VibeAutofillOptions, VibeAutofillSessionSnapshot, VibeAutofillStat
|
|
|
2
2
|
import type { VibeRuntimeState } from './runtime';
|
|
3
3
|
import { type RequestDelaySnapshot } from './requestDelay';
|
|
4
4
|
export declare const DEFAULT_MAX_ADDITIONAL_PAGES = 10;
|
|
5
|
+
export declare function frontendAutofillRequestLimit(options: VibeFrontendAutofillOptions, includeInitialRequest?: boolean): number;
|
|
5
6
|
export interface FrontendAutofillProgress {
|
|
6
7
|
missing: number;
|
|
7
8
|
next: VibeCursor;
|
package/lib/core/feed.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { VibeCardRegion, VibeItem, VibeItemId, VibeMediaSource, VibeReelAutoAdvanceState, VibeReelInfoSheetOptions, VibeReelOrigin } from '../types';
|
|
1
|
+
import type { VibeCardRegion, VibeFeedFooter, VibeFeedFooterActions, VibeItem, VibeItemId, VibeMediaSource, VibeReelAutoAdvanceState, VibeReelInfoSheetOptions, VibeReelOrigin, VibeState } from '../types';
|
|
2
2
|
import type { MediaPreviewState } from './mediaPreview';
|
|
3
3
|
export interface FeedRendererProps {
|
|
4
4
|
canRetryEnd: boolean;
|
|
5
5
|
cardFooter?: VibeCardRegion;
|
|
6
6
|
cardHeader?: VibeCardRegion;
|
|
7
|
+
feedFooter?: VibeFeedFooter;
|
|
8
|
+
feedFooterActions?: VibeFeedFooterActions;
|
|
7
9
|
hasNext: boolean;
|
|
8
10
|
infiniteScroll: boolean;
|
|
9
11
|
isLoadingMore: boolean;
|
|
@@ -12,6 +14,7 @@ export interface FeedRendererProps {
|
|
|
12
14
|
mediaIndices: ReadonlyMap<VibeItemId, number>;
|
|
13
15
|
nextPageError: boolean;
|
|
14
16
|
previewStates: ReadonlyMap<string, MediaPreviewState>;
|
|
17
|
+
state?: VibeState;
|
|
15
18
|
total: number | null;
|
|
16
19
|
}
|
|
17
20
|
export interface MasonryFeedProps extends FeedRendererProps {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { VibeFeedFooterActions } from '../types';
|
|
2
|
+
interface FeedFooterActionTarget {
|
|
3
|
+
cancelAutofill: () => Promise<void>;
|
|
4
|
+
loadNext: () => Promise<void>;
|
|
5
|
+
reload: () => Promise<void>;
|
|
6
|
+
retryEnd: () => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare function createFeedFooterActions(target: FeedFooterActionTarget): VibeFeedFooterActions;
|
|
9
|
+
export {};
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`vue`);function t(e){return[e,...e.items]}function n(e,t){return Math.min(e.items.length,Math.max(0,t))}function r(e,r){return t(e)[n(e,r)]??e}function i(e,t){return`${String(e)}:${t}`}function a(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=240}function o(e){let t=e.preview.width??e.width,n=e.preview.height??e.height;return!t||!n||t<=0||n<=0?1:n/t}function s(e){return e.reduce((t,n,r)=>n<e[t]?r:t,0)}function c(e){return Math.max(0,e.containerHeight)+Math.max(0,e.gap)}function l(e,t){let n=Math.max(0,t.overscan),r=t.scrollTop-n,i=t.scrollTop+Math.max(0,t.viewportHeight)+n;return e.reduce((e,t,n)=>(t.y+t.height>=r&&t.y<=i&&e.push(n),e),[])}function u(e,t,n){if(t<=0||e.length===0)return{columns:0,height:0,items:[]};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),c=Math.max(1,Math.floor((t+r)/(a+r))),l=(t-r*(c-1))/c,u=Array.from({length:c},()=>0),d=e.map(e=>{let t=s(u),n=l*o(e)+i,a={x:t*(l+r),y:u[t],width:l,height:n};return u[t]+=n+r,a});return{columns:c,height:Math.max(...u)-r,items:d}}function d(e,t,n){return Math.min(n,Math.max(t,e))}function f({contentSize:e,minimumThumbSize:t,scrollPosition:n,trackSize:r,viewportSize:i}){let a=Math.max(0,e),o=Math.max(0,r),s=Math.max(0,i),c=Math.max(0,a-s);if(!(c>0&&o>0))return{maximumScrollPosition:c,scrollable:!1,thumbOffset:0,thumbSize:o,thumbTravel:0};let l=d(s/a*o,Math.min(Math.max(0,t),o),o),u=Math.max(0,o-l);return{maximumScrollPosition:c,scrollable:!0,thumbOffset:u*(d(n,0,c)/c),thumbSize:l,thumbTravel:u}}var p=[`aria-hidden`],m=[`aria-controls`,`aria-valuemax`,`aria-valuenow`,`tabindex`],h=32,g=40,_=120,v=(0,e.defineComponent)({__name:`GalleryScrollbar`,props:{contentSize:{},controlsId:{},scrollElement:{},suspended:{type:Boolean}},setup(t){let n=t,r={maximumScrollPosition:0,scrollable:!1,thumbOffset:0,thumbSize:0,thumbTravel:0},i=(0,e.shallowRef)(null),a=(0,e.shallowRef)(r),o=(0,e.shallowRef)(!1),s=(0,e.shallowRef)(!1),c=(0,e.shallowRef)(!1),l=null,u=0,d=0,v=null,y=null,b=null,x=null,S=!1,C=null,w=(0,e.computed)(()=>a.value.scrollable&&!n.suspended),T=(0,e.computed)(()=>({height:`${a.value.thumbSize}px`,transform:`translate3d(0, ${a.value.thumbOffset}px, 0)`}));function E(){v!==null&&clearTimeout(v),v=setTimeout(()=>{v=null,o.value||(s.value=!1)},_)}function D(){s.value=!0,E()}function O(){let e=n.scrollElement,t=i.value;return!e||!t?r:f({contentSize:e.scrollHeight,minimumThumbSize:h,scrollPosition:e.scrollTop,trackSize:t.clientHeight,viewportSize:e.clientHeight})}function k(e){if(o.value&&e!==`scroll`){S=!0;return}if(o.value){let e=n.scrollElement;if(!e||a.value.maximumScrollPosition<=0)return;let t=Math.min(1,Math.max(0,e.scrollTop/a.value.maximumScrollPosition));a.value={...a.value,thumbOffset:a.value.thumbTravel*t};return}a.value=O(),!(c.value||y!==null)&&(y=requestAnimationFrame(()=>{y=null,c.value=!0}))}function A(){D(),k(`scroll`)}function j(e){let t=n.scrollElement;t&&(t.scrollTop=Math.min(a.value.maximumScrollPosition,Math.max(0,e)),k(`scroll`))}function M(e){if(!w.value||e.target!==e.currentTarget)return;let t=i.value;if(!t||a.value.thumbTravel<=0)return;e.preventDefault(),D();let n=e.clientY-t.getBoundingClientRect().top-a.value.thumbSize/2;j(Math.min(1,Math.max(0,n/a.value.thumbTravel))*a.value.maximumScrollPosition)}function N(e){w.value&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),l=e.pointerId,u=e.clientY,d=n.scrollElement?.scrollTop??0,o.value=!0,s.value=!0,v!==null&&clearTimeout(v),v=null)}function P(e){if(!o.value||e.pointerId!==l||(e.preventDefault(),a.value.thumbTravel<=0))return;let t=(e.clientY-u)/a.value.thumbTravel*a.value.maximumScrollPosition;j(d+t)}function F(e){!o.value||e.pointerId!==l||(e.currentTarget.releasePointerCapture?.(e.pointerId),l=null,o.value=!1,S&&(S=!1,k(`content`)),E())}function I(e){if(!w.value)return;let t=n.scrollElement?.clientHeight??0,r=n.scrollElement?.scrollTop??0,i=e.key===`ArrowUp`?r-g:e.key===`ArrowDown`?r+g:e.key===`PageUp`?r-t:e.key===`PageDown`?r+t:e.key===`Home`?0:e.key===`End`?a.value.maximumScrollPosition:null;i!==null&&(e.preventDefault(),D(),j(i))}function L(e){if(x?.disconnect(),!(typeof ResizeObserver>`u`)){x=new ResizeObserver(()=>k(`content`));for(let t of e.children)x.observe(t)}}return(0,e.watch)(()=>n.scrollElement,(t,n)=>{n?.removeEventListener(`scroll`,A),b?.disconnect(),b=null,x?.disconnect(),x=null,C?.disconnect(),C=null,t?.addEventListener(`scroll`,A,{passive:!0}),t&&typeof ResizeObserver<`u`&&(C=new ResizeObserver(()=>{D(),k(`resize`)}),C.observe(t),L(t)),t&&typeof MutationObserver<`u`&&(b=new MutationObserver(()=>{L(t),k(`content`)}),b.observe(t,{childList:!0})),(0,e.nextTick)(()=>k(`resize`))},{immediate:!0}),(0,e.watch)(()=>n.contentSize,()=>{(0,e.nextTick)(()=>k(`content`))}),(0,e.onBeforeUnmount)(()=>{n.scrollElement?.removeEventListener(`scroll`,A),b?.disconnect(),x?.disconnect(),C?.disconnect(),v!==null&&clearTimeout(v),y!==null&&cancelAnimationFrame(y)}),(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{ref_key:`trackElement`,ref:i,class:(0,e.normalizeClass)([`gallery-scrollbar`,{"gallery-scrollbar--dragging":o.value,"gallery-scrollbar--interacting":s.value,"gallery-scrollbar--ready":c.value,"gallery-scrollbar--visible":w.value}]),"aria-hidden":!w.value||void 0,onPointerdown:M},[(0,e.createElementVNode)(`div`,{class:`gallery-scrollbar-thumb`,"aria-controls":t.controlsId,"aria-label":`Media gallery scroll position`,"aria-orientation":`vertical`,"aria-valuemax":Math.round(a.value.maximumScrollPosition),"aria-valuemin":`0`,"aria-valuenow":Math.round(t.scrollElement?.scrollTop??0),role:`scrollbar`,style:(0,e.normalizeStyle)(T.value),tabindex:w.value?0:-1,onKeydown:I,onPointercancel:F,onPointerdown:N,onPointermove:P,onPointerup:F},null,44,m)],42,p))}}),y={key:0,class:`gallery-footer`},b={key:0,class:`load-more-status`,role:`status`},x=[`disabled`],S={key:2,class:`gallery-sentinel`,"aria-hidden":`true`},C={key:3,class:`end-feed`},w=[`disabled`],T=(0,e.defineComponent)({__name:`GalleryFooter`,props:{canRetryEnd:{type:Boolean},hasError:{type:Boolean},hasNext:{type:Boolean},infiniteScroll:{type:Boolean},isLoading:{type:Boolean},loadMoreLocked:{type:Boolean}},emits:[`loadMore`,`retryEnd`],setup(t,{emit:n}){let r=t,i=n;function a(){r.loadMoreLocked||(r.hasNext?i(`loadMore`):i(`retryEnd`))}return(n,r)=>t.hasNext||t.isLoading||t.hasError||t.canRetryEnd?((0,e.openBlock)(),(0,e.createElementBlock)(`footer`,y,[t.isLoading?((0,e.openBlock)(),(0,e.createElementBlock)(`p`,b,` Loading more… `)):t.hasError||t.hasNext&&(!t.infiniteScroll||t.loadMoreLocked)?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:1,"data-test":`load-more`,class:`load-more-button`,type:`button`,disabled:t.loadMoreLocked,onClick:a},(0,e.toDisplayString)(t.hasError?`Try again`:t.loadMoreLocked?`Loading paused`:`Load more`),9,x)):t.hasNext?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,S)):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,C,[r[1]||=(0,e.createElementVNode)(`p`,{class:`end-feed-message`,role:`status`},` You've reached the end. `,-1),(0,e.createElementVNode)(`button`,{"data-test":`retry-end`,class:`load-more-button`,type:`button`,disabled:t.loadMoreLocked,onClick:r[0]||=e=>n.$emit(`retryEnd`)},` Check for more `,8,w)]))])):(0,e.createCommentVNode)(``,!0)}}),E=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},D=e=>e===``,O=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),k=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),A=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),j=e=>{let t=A(e);return t.charAt(0).toUpperCase()+t.slice(1)},M={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},N=({name:t,iconNode:n,absoluteStrokeWidth:r,"absolute-stroke-width":i,strokeWidth:a,"stroke-width":o,size:s=M.width,color:c=M.stroke,...l},{slots:u})=>(0,e.h)(`svg`,{...M,...l,width:s,height:s,stroke:c,"stroke-width":D(r)||D(i)||r===!0||i===!0?Number(a||o||M[`stroke-width`])*24/Number(s):a||o||M[`stroke-width`],class:O(`lucide`,l.class,...t?[`lucide-${k(j(t))}-icon`,`lucide-${k(t)}`]:[`lucide-icon`]),...!u.default&&!E(l)&&{"aria-hidden":`true`}},[...n.map(t=>(0,e.h)(...t)),...u.default?[u.default()]:[]]),P=(t,n)=>(r,{slots:i,attrs:a})=>(0,e.h)(N,{...a,...r,iconNode:n,name:t},i),F=P(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),I=P(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),L=P(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),R=P(`play`,[[`path`,{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`,key:`10ikf1`}]]),z=P(`volume-2`,[[`path`,{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`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),B=P(`volume-x`,[[`path`,{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`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),V={401:`Authentication required`,403:`Access forbidden`,404:`Preview not found`,419:`Session expired`,500:`Server error`};function H(e){return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1]??`Error`}function U(e){return V[H(e)]??`Preview unavailable`}var W=/\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;function G(e){try{return W.test(new URL(e).pathname)}catch{return W.test(e.split(`?`)[0]??e)}}var K=(0,e.defineComponent)({__name:`CardRegion`,props:{index:{},item:{},layout:{},loadedCount:{},mediaIndex:{},mediaSource:{},placement:{},region:{},total:{}},setup(i){let a=i,o=(0,e.computed)(()=>n(a.item,a.mediaIndex)),s=(0,e.computed)(()=>t(a.item)),c=(0,e.computed)(()=>r(a.item,o.value));return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`media-card-region`,`media-card-${i.placement}`]),style:(0,e.normalizeStyle)({height:`${i.region.height}px`}),onClick:n[0]||=(0,e.withModifiers)(()=>{},[`stop`]),onKeydown:n[1]||=(0,e.withModifiers)(()=>{},[`stop`])},[((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(i.region.component),{index:i.index,item:i.item,layout:i.layout,"loaded-count":i.loadedCount,"media-count":s.value.length,"media-index":o.value,"media-item":c.value,"media-source":i.mediaSource??`preview`,total:i.total},null,8,[`index`,`item`,`layout`,`loaded-count`,`media-count`,`media-index`,`media-item`,`media-source`,`total`]))],38))}}),q=[`max`,`value`,`aria-valuetext`,`disabled`],ee={key:0,class:`media-controls-row`},te=[`aria-label`,`title`],ne={class:`media-controls-audio`},re=[`aria-label`,`title`],ie=[`value`,`aria-valuetext`],ae={class:`media-control-time`,"aria-live":`off`},oe=(0,e.defineComponent)({__name:`MediaControls`,props:{currentTime:{},duration:{},layout:{},muted:{type:Boolean},playing:{type:Boolean},volume:{}},emits:[`seek`,`toggleMute`,`togglePlayback`,`volumeChange`],setup(t,{emit:n}){let r=t,i=n;function a(e,t=1){return Number.isFinite(e)?Math.min(t,Math.max(0,e)):0}function o(e){let t=Math.floor(a(e,2**53-1)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${r}:${String(i).padStart(2,`0`)}`}function s(e){return Number(e.target.value)}let c=(0,e.computed)(()=>Math.max(0,r.duration)),l=(0,e.computed)(()=>a(r.currentTime,c.value)),u=(0,e.computed)(()=>({"--media-range-progress":`${c.value>0?l.value/c.value*100:0}%`})),d=(0,e.computed)(()=>({"--media-range-progress":`${a(r.volume)*100}%`}));return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`media-controls`,`media-controls--${t.layout}`]),"aria-label":`Video controls`,onClick:r[4]||=(0,e.withModifiers)(()=>{},[`stop`]),onDblclick:r[5]||=(0,e.withModifiers)(()=>{},[`stop`]),onKeydown:r[6]||=(0,e.withModifiers)(()=>{},[`stop`]),onWheel:r[7]||=(0,e.withModifiers)(()=>{},[`stop`])},[(0,e.createElementVNode)(`input`,{class:`media-control-range media-control-seek`,type:`range`,min:`0`,max:c.value||0,step:`0.1`,value:l.value,style:(0,e.normalizeStyle)(u.value),"aria-label":`Seek video`,"aria-valuetext":`${o(l.value)} of ${o(c.value)}`,disabled:c.value<=0,onInput:r[0]||=e=>i(`seek`,s(e))},null,44,q),t.layout===`reel`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ee,[(0,e.createElementVNode)(`button`,{type:`button`,class:`media-control-button media-control-playback`,"aria-label":t.playing?`Pause video`:`Play video`,title:t.playing?`Pause`:`Play`,onClick:r[1]||=e=>i(`togglePlayback`)},[t.playing?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(L),{key:0,size:18,fill:`currentColor`})):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(R),{key:1,size:18,fill:`currentColor`}))],8,te),(0,e.createElementVNode)(`div`,ne,[(0,e.createElementVNode)(`button`,{type:`button`,class:`media-control-button`,"aria-label":t.muted?`Unmute video`:`Mute video`,title:t.muted?`Unmute`:`Mute`,onClick:r[2]||=e=>i(`toggleMute`)},[t.muted||t.volume===0?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(B),{key:0,size:18})):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(z),{key:1,size:18}))],8,re),(0,e.createElementVNode)(`input`,{class:`media-control-range media-control-volume`,type:`range`,min:`0`,max:`1`,step:`0.05`,value:t.volume,style:(0,e.normalizeStyle)(d.value),"aria-label":`Video volume`,"aria-valuetext":`${Math.round(t.volume*100)} percent`,onInput:r[3]||=e=>i(`volumeChange`,s(e))},null,44,ie)]),(0,e.createElementVNode)(`output`,ae,(0,e.toDisplayString)(o(l.value))+` / `+(0,e.toDisplayString)(o(c.value)),1)])):(0,e.createCommentVNode)(``,!0)],34))}}),se=[`data-post-id`,`data-media-index`,`aria-busy`,`role`,`tabindex`],ce={class:`media-card-content`},le=[`data-media-direction`],ue=[`data-media-index`],de={key:0,"data-test":`media-loading`,class:`media-loading`,"aria-hidden":`true`},fe=[`aria-label`],pe={class:`media-error-code`},me=[`src`,`width`,`height`,`loop`,`muted`,`preload`],he=[`src`,`width`,`height`,`fetchpriority`],ge=[`aria-label`],_e=[`aria-label`],ve=[`aria-label`],ye=40,be=160,xe=24,Se=(0,e.defineComponent)({__name:`MediaCard`,props:{advanceOnMediaEnd:{type:Boolean},cardFooter:{},cardHeader:{},entering:{type:Boolean},fetchPriority:{},index:{},item:{},itemStyle:{},interactive:{type:Boolean},layout:{},loadedCount:{},mediaIndex:{},mediaSource:{},previewState:{},total:{}},emits:[`activate`,`ended`,`error`,`mediaChange`,`ready`],setup(i,{emit:a}){let o=i,s=null,c=0,l=!1,u=null,d=null,f=(0,e.shallowRef)(`next`),p=a;function m(e=!1,t=`pointer`){e&&p(`activate`,t)}let h=(0,e.computed)(()=>t(o.item)),g=(0,e.computed)(()=>n(o.item,o.mediaIndex)),_=(0,e.computed)(()=>r(o.item,g.value)),v=(0,e.computed)(()=>o.mediaSource===`original`?_.value.src:_.value.preview.src),y=(0,e.computed)(()=>o.mediaSource===`original`?_.value.width:_.value.preview.width),b=(0,e.computed)(()=>o.mediaSource===`original`?_.value.height:_.value.preview.height),x=(0,e.shallowRef)(null),S=(0,e.shallowRef)(0),C=(0,e.shallowRef)(0),w=(0,e.shallowRef)(!0),T=(0,e.shallowRef)(!1),E=(0,e.shallowRef)(1),D=1,O=(0,e.computed)(()=>o.interactive&&!!(o.cardHeader||o.cardFooter));function k(e){return e.detail===0?`keyboard`:`pointer`}function A(e,t){let n=h.value.length,r=(e+n)%n;r!==g.value&&(f.value=e<g.value?`previous`:`next`,p(`mediaChange`,r),t&&t.detail>0&&t.currentTarget?.blur())}function j(e,t,n){return t===1?e*16:t===2?e*n:e}function M(){c=0,l=!1,s!==null&&clearTimeout(s),s=null}function N(){s!==null&&clearTimeout(s),s=setTimeout(M,be)}function P(e){if(h.value.length<=1)return;let t=e.currentTarget?.clientWidth||1,n=j(e.deltaX,e.deltaMode,t);if(n===0||(e.preventDefault(),N(),l)||(c+=n,Math.abs(c)<xe))return;let r=Math.sign(c);c=0,l=!0,A(g.value+r)}function L(e){let t=e.touches[0];o.layout!==`reel`||!t||(u=t.clientX,d=t.clientY)}function R(e){let t=e.changedTouches[0];if(u===null||d===null||!t)return;let n=u-t.clientX,r=d-t.clientY;u=null,d=null,!(Math.abs(n)<=Math.abs(r))&&(Math.abs(n)<ye||A(g.value+Math.sign(n)))}let z=(0,e.computed)(()=>G(v.value));function B(e){o.layout===`reel`&&(e.stopPropagation(),V())}async function V(){if(x.value){if(T.value){x.value.pause();return}try{await x.value.play()}catch{T.value=!1}}}function W(e){return Number.isFinite(e)?Math.max(0,e):0}function q(e){let t=e?.currentTarget??x.value;t&&(S.value=W(t.currentTime),C.value=W(t.duration),w.value=t.muted,E.value=t.volume,t.volume>0&&(D=t.volume))}function ee(e){q(e),p(`ready`,g.value)}function te(){T.value=!1,p(`ended`,g.value)}function ne(e){let t=x.value;!t||!Number.isFinite(e)||(t.currentTime=Math.min(W(t.duration),Math.max(0,e)),S.value=t.currentTime)}function re(e){let t=x.value;if(!t||!Number.isFinite(e))return;let n=Math.min(1,Math.max(0,e));t.volume=n,t.muted=n===0,n>0&&(D=n),q()}function ie(){let e=x.value;e&&(e.muted&&e.volume===0&&(e.volume=D),e.muted=!e.muted,q())}return(0,e.onBeforeUnmount)(()=>{M()}),(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`article`,{"data-post-id":i.item.postId,"data-media-index":g.value,class:(0,e.normalizeClass)([`media-card`,{"media-card--entering":i.entering,"media-card--error":i.previewState===`error`}]),style:(0,e.normalizeStyle)(i.itemStyle),"aria-busy":i.previewState===`loading`,role:i.interactive&&!O.value?`button`:void 0,tabindex:i.interactive&&!O.value?0:void 0,onClick:n[11]||=e=>m(i.interactive&&!O.value,k(e)),onKeydown:[n[12]||=(0,e.withKeys)(e=>m(i.interactive&&!O.value,`keyboard`),[`enter`]),n[13]||=(0,e.withKeys)((0,e.withModifiers)(e=>m(i.interactive&&!O.value,`keyboard`),[`prevent`]),[`space`])]},[(0,e.createElementVNode)(`div`,ce,[i.cardHeader?((0,e.openBlock)(),(0,e.createBlock)(K,{key:0,index:i.index,item:i.item,layout:i.layout,"loaded-count":i.loadedCount,"media-index":g.value,"media-source":i.mediaSource,placement:`header`,region:i.cardHeader,total:i.total},null,8,[`index`,`item`,`layout`,`loaded-count`,`media-index`,`media-source`,`region`,`total`])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`media-card-media`,{"media-card-media--carousel":i.layout===`reel`&&h.value.length>1}]),"data-media-direction":f.value,onWheel:P,onTouchstartPassive:L,onTouchendPassive:R},[(0,e.createVNode)(e.Transition,{name:`media-slide-${f.value}`},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:`${i.item.postId}:${g.value}:${i.mediaSource??`preview`}`,class:`media-card-frame`,"data-media-index":g.value},[i.previewState===`loading`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,de,[...n[14]||=[(0,e.createElementVNode)(`span`,{class:`media-loading-shimmer`},null,-1)]])):i.previewState===`error`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,"data-test":`media-error`,class:`media-error`,role:`img`,"aria-label":`${(0,e.unref)(H)(v.value)} ${(0,e.unref)(U)(v.value)}`},[(0,e.createElementVNode)(`strong`,pe,(0,e.toDisplayString)((0,e.unref)(H)(v.value)),1),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)((0,e.unref)(U)(v.value)),1)],8,fe)):(0,e.createCommentVNode)(``,!0),z.value?((0,e.openBlock)(),(0,e.createElementBlock)(`video`,{key:2,ref_key:`videoElement`,ref:x,class:(0,e.normalizeClass)([`media-preview`,{"media-preview--ready":i.previewState===`ready`,"media-preview--reel-video":i.layout===`reel`}]),src:v.value,width:y.value??void 0,height:b.value??void 0,autoplay:``,loop:!i.advanceOnMediaEnd,muted:w.value,playsinline:``,preload:i.fetchPriority===`high`?`auto`:`metadata`,onLoadedmetadata:ee,onDurationchange:q,onTimeupdate:q,onVolumechange:q,onPlaying:n[0]||=e=>T.value=!0,onPause:n[1]||=e=>T.value=!1,onEnded:te,onClick:B,onError:n[2]||=e=>t.$emit(`error`,g.value)},null,42,me)):((0,e.openBlock)(),(0,e.createElementBlock)(`img`,{key:3,class:(0,e.normalizeClass)([`media-preview`,{"media-preview--ready":i.previewState===`ready`}]),src:v.value,width:y.value??void 0,height:b.value??void 0,fetchpriority:i.fetchPriority,alt:``,decoding:`async`,loading:`eager`,onLoad:n[3]||=e=>t.$emit(`ready`,g.value),onError:n[4]||=e=>t.$emit(`error`,g.value)},null,42,he))],8,ue))]),_:1},8,[`name`]),z.value&&i.previewState===`ready`?((0,e.openBlock)(),(0,e.createBlock)(oe,{key:0,"current-time":S.value,duration:C.value,layout:i.layout,muted:w.value,playing:T.value,volume:E.value,onSeek:ne,onToggleMute:ie,onTogglePlayback:V,onVolumeChange:re},null,8,[`current-time`,`duration`,`layout`,`muted`,`playing`,`volume`])):(0,e.createCommentVNode)(``,!0),h.value.length>1?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:(0,e.normalizeClass)([`media-carousel-controls`,{"media-carousel-controls--persistent":i.layout===`reel`}]),"aria-label":`Media navigation`},[(0,e.createElementVNode)(`button`,{type:`button`,class:`media-carousel-control media-carousel-control--previous`,"aria-label":`Previous media for post ${i.item.postId}`,onClick:n[5]||=(0,e.withModifiers)(e=>A(g.value-1,e),[`stop`]),onKeydown:n[6]||=(0,e.withModifiers)(()=>{},[`stop`])},[(0,e.createVNode)((0,e.unref)(F),{size:20})],40,ge),(0,e.createElementVNode)(`button`,{type:`button`,class:`media-carousel-control media-carousel-control--next`,"aria-label":`Next media for post ${i.item.postId}`,onClick:n[7]||=(0,e.withModifiers)(e=>A(g.value+1,e),[`stop`]),onKeydown:n[8]||=(0,e.withModifiers)(()=>{},[`stop`])},[(0,e.createVNode)((0,e.unref)(I),{size:20})],40,_e)],2)):(0,e.createCommentVNode)(``,!0),O.value?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:2,class:`media-card-activator`,type:`button`,"aria-label":`Open post ${i.item.postId}`,onClick:n[9]||=(0,e.withModifiers)(e=>t.$emit(`activate`,k(e)),[`stop`]),onKeydown:n[10]||=(0,e.withModifiers)(()=>{},[`stop`])},null,40,ve)):(0,e.createCommentVNode)(``,!0)],42,le),i.cardFooter?((0,e.openBlock)(),(0,e.createBlock)(K,{key:1,index:i.index,item:i.item,layout:i.layout,"loaded-count":i.loadedCount,"media-index":g.value,"media-source":i.mediaSource,placement:`footer`,region:i.cardFooter,total:i.total},null,8,[`index`,`item`,`layout`,`loaded-count`,`media-index`,`media-source`,`region`,`total`])):(0,e.createCommentVNode)(``,!0)])],46,se))}}),Ce={class:`masonry-feed-shell`},we=[`aria-hidden`,`inert`],Te=240,Ee=6,De=12,Oe=800,ke=1.5,Ae=(0,e.defineComponent)({__name:`MasonryFeed`,props:{enteringPostIds:{},entryDelays:{},suspended:{type:Boolean},canRetryEnd:{type:Boolean},cardFooter:{},cardHeader:{},hasNext:{type:Boolean},infiniteScroll:{type:Boolean},isLoadingMore:{type:Boolean},items:{},loadMoreLocked:{type:Boolean},mediaIndices:{},nextPageError:{type:Boolean},previewStates:{},total:{}},emits:[`activate`,`error`,`loadMore`,`mediaChange`,`ready`,`retryEnd`],setup(t,{expose:n,emit:r}){let o=t,s=r,d=(0,e.shallowRef)(null),f=`vibe-masonry-${(0,e.useId)()}`,p=(0,e.shallowRef)(null),m=(0,e.shallowRef)(0),h=(0,e.shallowRef)(Ee),g=(0,e.shallowRef)(0),_=(0,e.shallowRef)(0),y=(0,e.shallowRef)(0),b=null,x=null,S=null,C=(0,e.computed)(()=>u(o.items,m.value,{additionalHeight:(o.cardHeader?.height??0)+(o.cardFooter?.height??0),gap:h.value,minColumnWidth:Te})),w=(0,e.computed)(()=>({height:`${C.value.height}px`})),E=(0,e.computed)(()=>{let e=Math.max(Oe,_.value*ke),t={scrollTop:g.value-y.value,viewportHeight:_.value},n=l(C.value.items,{...t,overscan:e}),r=new Set(l(C.value.items,{...t,overscan:0}));return n.flatMap(e=>{let t=o.items[e];return t?[{fetchPriority:r.has(e)?`high`:`low`,index:e,item:t}]:[]})});function D(e){let t=C.value.items[e],n=o.items[e]?.postId;if(!t)return{};let r=n!==void 0&&o.enteringPostIds.has(n)?c({containerHeight:C.value.height,gap:h.value}):0;return{"--masonry-entry-delay":`${n===void 0?0:o.entryDelays.get(n)??0}ms`,top:`${t.y}px`,left:`${t.x}px`,width:`${t.width}px`,height:`${t.height}px`,transform:`translate3d(0, ${r}px, 0)`}}function O(){let e=d.value;if(!e)return;g.value=e.scrollTop,_.value=e.clientHeight;let t=p.value;t&&(y.value=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop)}function k(e){let t=e.ownerDocument.documentElement.clientWidth;m.value=e.clientWidth,h.value=Math.min(De,Math.max(Ee,t*.0075)),O()}function A(e){let t=e.currentTarget;t&&(g.value=t.scrollTop,!o.loadMoreLocked&&o.infiniteScroll&&a(t)&&s(`loadMore`))}function j(){let e=d.value;!o.loadMoreLocked&&e&&a(e)&&s(`loadMore`)}function M(){return d.value}return(0,e.watch)(p,e=>{b?.disconnect(),b=null,S!==null&&cancelAnimationFrame(S),e&&(k(e),!(typeof ResizeObserver>`u`)&&(b=new ResizeObserver(([t])=>{let n=t?.contentRect.width??e.clientWidth;Math.abs(n-m.value)<.5||(S=requestAnimationFrame(()=>{S=null,k(e)}))}),b.observe(e)))}),(0,e.watch)(d,e=>{x?.disconnect(),x=null,e&&(O(),!(typeof ResizeObserver>`u`)&&(x=new ResizeObserver(O),x.observe(e)))}),(0,e.onBeforeUnmount)(()=>{b?.disconnect(),x?.disconnect(),S!==null&&cancelAnimationFrame(S)}),n({getScrollElement:M,loadIfNearBottom:j}),(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Ce,[(0,e.createElementVNode)(`main`,{id:f,ref_key:`galleryElement`,ref:d,class:(0,e.normalizeClass)([`gallery-shell masonry-feed`,{"masonry-feed--suspended":t.suspended}]),"data-layout-mode":`masonry`,"aria-hidden":t.suspended||void 0,inert:t.suspended||void 0,onScrollPassive:A},[(0,e.createElementVNode)(`section`,{ref_key:`masonryElement`,ref:p,class:(0,e.normalizeClass)([`masonry`,{"masonry--ready":m.value>0}]),style:(0,e.normalizeStyle)(w.value),"aria-label":`Media gallery`},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(E.value,({fetchPriority:n,item:r,index:a})=>((0,e.openBlock)(),(0,e.createBlock)(Se,{key:r.postId,class:`masonry-item`,entering:t.enteringPostIds.has(r.postId),"fetch-priority":n,"card-footer":t.cardFooter,"card-header":t.cardHeader,index:a,item:r,"item-style":D(a),interactive:``,layout:`masonry`,"loaded-count":t.items.length,"media-index":t.mediaIndices.get(r.postId)??0,"preview-state":t.previewStates.get((0,e.unref)(i)(r.postId,t.mediaIndices.get(r.postId)??0))??`loading`,total:t.total,onActivate:e=>s(`activate`,r.postId,e),onMediaChange:e=>s(`mediaChange`,r.postId,e),onReady:e=>s(`ready`,r.postId,e),onError:e=>s(`error`,r.postId,e)},null,8,[`entering`,`fetch-priority`,`card-footer`,`card-header`,`index`,`item`,`item-style`,`loaded-count`,`media-index`,`preview-state`,`total`,`onActivate`,`onMediaChange`,`onReady`,`onError`]))),128))],6),(0,e.createVNode)(T,{"can-retry-end":t.canRetryEnd,"has-error":t.nextPageError,"has-next":t.hasNext,"infinite-scroll":t.infiniteScroll,"is-loading":t.isLoadingMore,"load-more-locked":t.loadMoreLocked,onLoadMore:r[0]||=e=>s(`loadMore`),onRetryEnd:r[1]||=e=>s(`retryEnd`)},null,8,[`can-retry-end`,`has-error`,`has-next`,`infinite-scroll`,`is-loading`,`load-more-locked`])],42,we),(0,e.createVNode)(v,{"content-size":C.value.height,"controls-id":f,"scroll-element":d.value,suspended:t.suspended},null,8,[`content-size`,`scroll-element`,`suspended`])]))}}),je=[`aria-label`],Me=(0,e.defineComponent)({__name:`ReelAutoAdvanceProgress`,props:{durationMs:{},label:{}},emits:[`complete`],setup(t,{emit:n}){let r=t,i=n,a=(0,e.computed)(()=>({"--vibe-reel-auto-advance-duration":`${r.durationMs}ms`}));return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`reel-auto-advance`,"data-test":`reel-auto-advance`,role:`timer`,"aria-label":t.label},[(0,e.createElementVNode)(`span`,{class:`reel-auto-advance-progress`,style:(0,e.normalizeStyle)(a.value),onAnimationend:r[0]||=e=>i(`complete`)},null,36)],8,je))}}),Ne=[`data-active-post-id`,`data-active-media-index`],Pe=2,Fe=(0,e.defineComponent)({__name:`ReelFeed`,props:{initialPostId:{},mediaSource:{},reelAutoAdvance:{},canRetryEnd:{type:Boolean},cardFooter:{},cardHeader:{},hasNext:{type:Boolean},infiniteScroll:{type:Boolean},isLoadingMore:{type:Boolean},items:{},loadMoreLocked:{type:Boolean},mediaIndices:{},nextPageError:{type:Boolean},previewStates:{},total:{}},emits:[`activeChange`,`error`,`loadMore`,`mediaChange`,`ready`,`retryEnd`],setup(n,{expose:o,emit:s}){let c=n,l=s,u=(0,e.shallowRef)(null),d=c.initialPostId===null||c.initialPostId===void 0?-1:c.items.findIndex(e=>e.postId===c.initialPostId),f=(0,e.shallowRef)(Math.max(0,d)),p=(0,e.shallowRef)(!1),m=0,h=null,g=null,_=null,v=(0,e.computed)(()=>({gridTemplateRows:`repeat(${c.items.length}, 100cqh)`})),y=(0,e.computed)(()=>{let e=Math.max(0,f.value-Pe),t=Math.min(c.items.length-1,f.value+Pe);return c.items.slice(e,t+1).map((t,n)=>({fetchPriority:e+n===f.value?`high`:`low`,index:e+n,item:t}))}),b=(0,e.computed)(()=>c.items[f.value]?.postId),x=(0,e.computed)(()=>c.items[f.value]),S=(0,e.computed)(()=>{let e=b.value;return e===void 0?0:c.mediaIndices.get(e)??0}),C=(0,e.computed)(()=>{let e=b.value;return e===void 0?`loading`:c.previewStates.get(i(e,S.value))??`loading`}),w=(0,e.computed)(()=>{let e=x.value;if(!e)return``;let t=r(e,S.value);return c.mediaSource===`original`?t.src:t.preview.src}),E=(0,e.computed)(()=>C.value===`ready`&&G(w.value)),D=(0,e.computed)(()=>[b.value,S.value,c.items.length,c.loadMoreLocked,c.reelAutoAdvance.enabled,c.reelAutoAdvance.includePostItems,c.reelAutoAdvance.intervalMs].join(`:`)),O=(0,e.computed)(()=>{let e=x.value,n=!!(e&&c.reelAutoAdvance.includePostItems&&S.value<t(e).length-1),r=c.reelAutoAdvance.intervalMs/1e3;return`Auto advance to the next ${n?`post item`:`post`} in ${r}s`}),k=(0,e.computed)(()=>c.reelAutoAdvance.enabled&&x.value!==void 0&&C.value!==`loading`&&!E.value);function A(e){return{gridRow:`${e+1}`}}function j(e){let t=m||e.clientHeight;return t<=0||c.items.length===0?0:Math.min(c.items.length-1,Math.max(0,Math.round(e.scrollTop/t)))}function M(e){let t=e.currentTarget;t&&(p.value||(f.value=j(t)),!c.loadMoreLocked&&c.infiniteScroll&&a(t)&&l(`loadMore`))}function N(){let e=u.value;e&&(I(!0),m=e.clientHeight,e.scrollTop=f.value*m,g!==null&&cancelAnimationFrame(g),g=requestAnimationFrame(()=>{e.scrollTop=f.value*e.clientHeight,m=e.clientHeight,g=null}),P())}function P(){_!==null&&clearTimeout(_),_=setTimeout(()=>{_=null;let e=u.value;e&&(m=e.clientHeight,e.scrollTop=f.value*m),I(!1)},120)}function F(){I(!0);let e=u.value;e&&(m=e.clientHeight,e.scrollTop=f.value*m),P()}function I(e){p.value=e,u.value?.toggleAttribute(`data-resizing`,e)}function L(){let e=u.value;!c.loadMoreLocked&&e&&a(e)&&l(`loadMore`)}function R(e){let n=x.value;if(!n)return!1;let r=t(n).length;if(r<=1)return!1;let i=(S.value+e+r)%r;return l(`mediaChange`,n.postId,i),!0}function z(e){let t=f.value+e;return!u.value||t<0||t>=c.items.length?!1:(V(t),!0)}function B(){return typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function V(e){let t=u.value;if(!t)return;let n=e*(m||t.clientHeight);if(f.value=e,!B()&&typeof t.scrollTo==`function`){t.scrollTo({behavior:`smooth`,top:n});return}t.scrollTop=n}function H(){if(!c.reelAutoAdvance.enabled)return;let e=x.value;if(!e)return;if(c.reelAutoAdvance.includePostItems&&S.value<t(e).length-1){l(`mediaChange`,e.postId,S.value+1);return}let n=f.value+1,r=c.items[n];if(!r){c.hasNext&&!c.loadMoreLocked&&l(`loadMore`);return}c.reelAutoAdvance.includePostItems&&(c.mediaIndices.get(r.postId)??0)!==0&&l(`mediaChange`,r.postId,0),V(n)}function U(e,t){!c.reelAutoAdvance.enabled||e!==b.value||t!==S.value||!E.value||H()}return(0,e.watch)(u,e=>{h?.disconnect(),h=null,e&&(m=e.clientHeight,!(typeof ResizeObserver>`u`)&&(h=new ResizeObserver(N),h.observe(e)))}),(0,e.watch)(()=>c.items.length,async t=>{f.value=Math.min(f.value,Math.max(0,t-1)),await(0,e.nextTick)(),N()}),(0,e.watch)(b,e=>{e!==void 0&&l(`activeChange`,e)},{immediate:!0}),(0,e.onMounted)(()=>{window.addEventListener(`resize`,F),window.addEventListener(`orientationchange`,F),d>=0&&(0,e.nextTick)(N)}),(0,e.onBeforeUnmount)(()=>{window.removeEventListener(`resize`,F),window.removeEventListener(`orientationchange`,F),h?.disconnect(),g!==null&&cancelAnimationFrame(g),_!==null&&clearTimeout(_)}),o({activeIndex:f,activePostId:b,changeActiveMedia:R,loadIfNearBottom:L,moveActivePost:z}),(t,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`main`,{class:(0,e.normalizeClass)([`reel-shell`,{"reel-shell--has-footer":!!n.cardFooter,"reel-shell--has-header":!!n.cardHeader}]),"data-layout-mode":`reel`},[n.cardHeader&&x.value?((0,e.openBlock)(),(0,e.createBlock)(K,{key:0,index:f.value,item:x.value,layout:`reel`,"loaded-count":n.items.length,"media-index":S.value,"media-source":n.mediaSource,placement:`header`,region:n.cardHeader,total:n.total},null,8,[`index`,`item`,`loaded-count`,`media-index`,`media-source`,`region`,`total`])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{ref_key:`galleryElement`,ref:u,class:`gallery-shell reel-feed`,"data-active-post-id":b.value,"data-active-media-index":S.value,onScrollPassive:M},[(0,e.createElementVNode)(`section`,{class:`reel-track`,style:(0,e.normalizeStyle)(v.value),"aria-label":`Media gallery`},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(y.value,({fetchPriority:t,item:r,index:a})=>((0,e.openBlock)(),(0,e.createBlock)(Se,{key:r.postId,"advance-on-media-end":c.reelAutoAdvance.enabled&&a===f.value,class:`reel-item`,entering:!1,"fetch-priority":t,index:a,item:r,"item-style":A(a),layout:`reel`,"loaded-count":n.items.length,"media-index":n.mediaIndices.get(r.postId)??0,"media-source":n.mediaSource,"preview-state":n.previewStates.get((0,e.unref)(i)(r.postId,n.mediaIndices.get(r.postId)??0))??`loading`,total:n.total,onMediaChange:e=>l(`mediaChange`,r.postId,e),onEnded:e=>U(r.postId,e),onReady:e=>l(`ready`,r.postId,e),onError:e=>l(`error`,r.postId,e)},null,8,[`advance-on-media-end`,`fetch-priority`,`index`,`item`,`item-style`,`loaded-count`,`media-index`,`media-source`,`preview-state`,`total`,`onMediaChange`,`onEnded`,`onReady`,`onError`]))),128))],4),(0,e.createVNode)(T,{"can-retry-end":n.canRetryEnd,"has-error":n.nextPageError,"has-next":n.hasNext,"infinite-scroll":n.infiniteScroll,"is-loading":n.isLoadingMore,"load-more-locked":n.loadMoreLocked,onLoadMore:r[0]||=e=>l(`loadMore`),onRetryEnd:r[1]||=e=>l(`retryEnd`)},null,8,[`can-retry-end`,`has-error`,`has-next`,`infinite-scroll`,`is-loading`,`load-more-locked`])],40,Ne),n.cardFooter&&x.value?((0,e.openBlock)(),(0,e.createBlock)(K,{key:1,index:f.value,item:x.value,layout:`reel`,"loaded-count":n.items.length,"media-index":S.value,"media-source":n.mediaSource,placement:`footer`,region:n.cardFooter,total:n.total},null,8,[`index`,`item`,`loaded-count`,`media-index`,`media-source`,`region`,`total`])):(0,e.createCommentVNode)(``,!0),k.value?((0,e.openBlock)(),(0,e.createBlock)(Me,{key:D.value,"duration-ms":n.reelAutoAdvance.intervalMs,label:O.value,onComplete:H},null,8,[`duration-ms`,`label`])):(0,e.createCommentVNode)(``,!0)],2))}}),Ie=[`data-info-sheet-open`,`data-info-sheet-mode`],Le=[`aria-hidden`,`inert`],Re={key:0,class:`reel-info-sheet-layer`,"data-test":`reel-info-sheet`},ze=[`role`,`aria-modal`,`tabindex`,`data-active-post-id`],Be=(0,e.defineComponent)({__name:`ReelLayout`,props:{infoSheet:{},infoSheetEnabled:{type:Boolean},infoSheetOverlay:{type:Boolean},origin:{},initialPostId:{},mediaSource:{},reelAutoAdvance:{},canRetryEnd:{type:Boolean},cardFooter:{},cardHeader:{},hasNext:{type:Boolean},infiniteScroll:{type:Boolean},isLoadingMore:{type:Boolean},items:{},loadMoreLocked:{type:Boolean},mediaIndices:{},nextPageError:{type:Boolean},previewStates:{},total:{}},emits:[`activeChange`,`closeInfoSheet`,`error`,`loadMore`,`mediaChange`,`ready`,`retryEnd`],setup(n,{expose:i,emit:a}){let o=n,s=a,c=(0,e.shallowRef)(null),l=(0,e.shallowRef)(null),u=null,d=(0,e.computed)(()=>{let e=o.initialPostId===null||o.initialPostId===void 0?-1:o.items.findIndex(e=>e.postId===o.initialPostId);return Math.max(0,e)}),f=(0,e.computed)(()=>o.items[d.value]),p=(0,e.computed)(()=>{let e=f.value?.postId;return e===void 0?0:o.mediaIndices.get(e)??0}),m=(0,e.computed)(()=>!!(o.infoSheet&&o.infoSheetEnabled&&f.value)),h=(0,e.computed)(()=>{let e=f.value;return e?{close:g,index:d.value,item:e,layout:`reel`,loadedCount:o.items.length,mediaCount:t(e).length,mediaIndex:p.value,mediaItem:r(e,p.value),mediaSource:o.mediaSource??`preview`,origin:o.origin,total:o.total}:null});function g(){s(`closeInfoSheet`)}function _(e){return c.value?.changeActiveMedia(e)??!1}function v(){c.value?.loadIfNearBottom()}function y(e){return c.value?.moveActivePost(e)??!1}function b(e,t){s(`error`,e,t)}function x(e,t){s(`mediaChange`,e,t)}function S(e,t){s(`ready`,e,t)}return(0,e.watch)(()=>({overlay:o.infoSheetOverlay,visible:m.value}),async(t,n)=>{if(t.visible&&!n?.visible){u=document.activeElement instanceof HTMLElement?document.activeElement:null,t.overlay&&(await(0,e.nextTick)(),l.value?.focus({preventScroll:!0}));return}if(!t.visible&&n?.visible&&u?.isConnected){let t=u;u=null,await(0,e.nextTick)(),t.focus({preventScroll:!0})}}),(0,e.onBeforeUnmount)(()=>{u=null}),i({changeActiveMedia:_,loadIfNearBottom:v,moveActivePost:y}),(t,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`section`,{class:(0,e.normalizeClass)([`reel-layout`,`reel-layout--${n.infoSheetOverlay?`overlay`:`layout`}`]),"data-info-sheet-open":m.value||void 0,"data-info-sheet-mode":n.infoSheetOverlay?`overlay`:`layout`},[(0,e.createElementVNode)(`div`,{class:`reel-layout-main`,"aria-hidden":n.infoSheetOverlay&&m.value||void 0,inert:n.infoSheetOverlay&&m.value||void 0},[(0,e.createVNode)(Fe,{ref_key:`reelFeed`,ref:c,"can-retry-end":n.canRetryEnd,"card-footer":n.cardFooter,"card-header":n.cardHeader,"has-next":n.hasNext,"infinite-scroll":n.infiniteScroll,"initial-post-id":n.initialPostId,"is-loading-more":n.isLoadingMore,items:n.items,"load-more-locked":n.loadMoreLocked,"media-indices":n.mediaIndices,"media-source":n.mediaSource,"next-page-error":n.nextPageError,"preview-states":n.previewStates,"reel-auto-advance":n.reelAutoAdvance,total:n.total,onActiveChange:r[0]||=e=>s(`activeChange`,e),onError:b,onLoadMore:r[1]||=e=>s(`loadMore`),onMediaChange:x,onReady:S,onRetryEnd:r[2]||=e=>s(`retryEnd`)},null,8,[`can-retry-end`,`card-footer`,`card-header`,`has-next`,`infinite-scroll`,`initial-post-id`,`is-loading-more`,`items`,`load-more-locked`,`media-indices`,`media-source`,`next-page-error`,`preview-states`,`reel-auto-advance`,`total`])],8,Le),(0,e.createVNode)(e.Transition,{name:`vibe-info-sheet`},{default:(0,e.withCtx)(()=>[m.value&&n.infoSheet&&h.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,Re,[(0,e.createElementVNode)(`aside`,{ref_key:`sheetElement`,ref:l,class:`reel-info-sheet`,role:n.infoSheetOverlay?`dialog`:`complementary`,"aria-label":`Reel information`,"aria-modal":n.infoSheetOverlay?`true`:void 0,tabindex:n.infoSheetOverlay?-1:void 0,"data-active-post-id":f.value?.postId},[((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(n.infoSheet.component),(0,e.normalizeProps)((0,e.guardReactiveProps)(h.value)),null,16))],8,ze)])):(0,e.createCommentVNode)(``,!0)]),_:1})],10,Ie))}}),Ve={key:0,class:`gallery-shell`,role:`alert`},He={key:1,class:`gallery-shell`,role:`status`},Ue={key:2,class:`gallery-shell`},We=35,Ge=(0,e.defineComponent)({__name:`VibeSurface`,props:{canRetryEnd:{type:Boolean},cardFooter:{},cardHeader:{},reelInfoSheet:{},state:{}},emits:[`activeReelChange`,`closeReel`,`loadMore`,`openReel`,`reelInfoSheetChange`,`retryEnd`],setup(t,{expose:r,emit:a}){let o=t,s=a,c=(0,e.shallowRef)(null),l=(0,e.shallowRef)(null),u=(0,e.shallowRef)(null),d=(0,e.shallowRef)(null),f=(0,e.shallowRef)({}),p=(0,e.shallowRef)(!1),m=(0,e.shallowRef)(new Set),h=(0,e.shallowRef)(new Map),g=(0,e.shallowRef)(new Map),_=(0,e.shallowRef)(new Map),v=(0,e.shallowRef)(new Map),y=(0,e.computed)(()=>o.state.reelMediaSource===`original`?v.value:_.value),b=new Set(o.state.items.map(e=>e.postId)),x=null,S=null,C=!1;function w(){return typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function T(){x!==null&&cancelAnimationFrame(x),x=requestAnimationFrame(()=>{x=requestAnimationFrame(()=>{x=null,m.value=new Set})})}function E(e,t,n){let r=i(e,t);_.value.get(r)!==n&&(_.value=new Map(_.value).set(r,n))}function D(e,t,n){let r=i(e,t);v.value.get(r)!==n&&(v.value=new Map(v.value).set(r,n))}function O(e,t){E(e,t,`error`)}function k(e,t){E(e,t,`ready`)}function A(e,t){D(e,t,`error`)}function j(e,t){D(e,t,`ready`)}function M(e,t){if(o.state.reelMediaSource===`original`){A(e,t);return}O(e,t)}function N(e,t){if(o.state.reelMediaSource===`original`){j(e,t);return}k(e,t)}function P(e,t){let r=o.state.items.find(t=>t.postId===e);if(!r)return;let i=n(r,t);(g.value.get(e)??0)!==i&&(g.value=new Map(g.value).set(e,i))}async function F(){await(0,e.nextTick)(),(o.state.layout===`reel`||o.state.reelOrigin===`masonry`?l.value:c.value)?.loadIfNearBottom()}function I(e){return o.state.isLoading||o.state.items.length===0||o.state.layout!==`reel`&&o.state.reelOrigin!==`masonry`?!1:l.value?.changeActiveMedia?.(e)??!1}function L(e){return o.state.isLoading||o.state.items.length===0||o.state.layout!==`reel`&&o.state.reelOrigin!==`masonry`?!1:l.value?.moveActivePost?.(e)??!1}function R(){return o.state.layout!==`masonry`||o.state.reelOrigin===`masonry`?null:c.value?.getScrollElement?.()??null}function z(t,n){S=t,C=n===`keyboard`,f.value=H(t),s(`openReel`,t),(0,e.nextTick)(()=>u.value?.focus())}function B(e){let t=d.value?.querySelectorAll(`.masonry-feed [data-post-id]`)??[];return Array.from(t).find(t=>t.dataset.postId===String(e))??null}function V(e,t){let n=B(e),r=n?.querySelector(`.media-card-activator`)??n;r&&(r.classList.toggle(`media-card-focus-silent`,!t),t||r.addEventListener(`blur`,()=>{r.classList.remove(`media-card-focus-silent`)},{once:!0}),r?.focus({preventScroll:!0}))}function H(e){let t=d.value,n=B(e);if(t===null||n===null)return{};let r=t.getBoundingClientRect(),i=n.getBoundingClientRect();return{"--vibe-reel-origin-top":`${Math.max(0,i.top-r.top)}px`,"--vibe-reel-origin-right":`${Math.max(0,r.right-i.right)}px`,"--vibe-reel-origin-bottom":`${Math.max(0,r.bottom-i.bottom)}px`,"--vibe-reel-origin-left":`${Math.max(0,i.left-r.left)}px`}}function U(){o.state.reelOrigin===`masonry`&&(S??=o.state.activeReelPostId,p.value=!0,s(`closeReel`))}function W(){let t=S,n=C;p.value=!1,S=null,C=!1,f.value={},(0,e.nextTick)(()=>{t!==null&&V(t,n)})}function G(e){let t=o.state.layout===`reel`||o.state.reelOrigin===`masonry`;if(e.key===`Escape`&&o.state.reelOrigin===`masonry`){e.preventDefault(),U();return}if(e.key===`Escape`&&t&&o.state.reelInfoSheet.enabled){e.preventDefault(),s(`reelInfoSheetChange`,!1);return}if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||p.value||o.state.layout!==`reel`&&o.state.reelOrigin!==`masonry`)return;let n=e.target;if(n instanceof HTMLElement&&(n.isContentEditable||[`INPUT`,`SELECT`,`TEXTAREA`].includes(n.tagName)))return;let r=e.key===`ArrowLeft`?-1:e.key===`ArrowRight`?1:0;r!==0&&l.value?.changeActiveMedia?.(r)&&e.preventDefault()}return(0,e.watch)(()=>o.state.items.map(e=>e.postId),e=>{let t=e.filter(e=>!b.has(e));if(b=new Set(e),t.length===0||w())return;let n=new Map;e.forEach(e=>{let t=h.value.get(e);t!==void 0&&n.set(e,t)}),t.forEach((e,t)=>{n.set(e,t*We)}),h.value=n,m.value=new Set([...m.value,...t]),T()},{flush:`sync`}),(0,e.onMounted)(()=>window.addEventListener(`keydown`,G)),(0,e.onBeforeUnmount)(()=>{window.removeEventListener(`keydown`,G),x!==null&&cancelAnimationFrame(x)}),r({changeActiveReelMedia:I,getAutoScrollElement:R,loadIfNearBottom:F,moveActiveReelPost:L}),(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{ref_key:`surfaceElement`,ref:d,class:`vibe-surface`},[t.state.error?((0,e.openBlock)(),(0,e.createElementBlock)(`main`,Ve,[...r[10]||=[(0,e.createElementVNode)(`p`,{class:`gallery-status`},` Unable to load media. `,-1)]])):t.state.isLoading?((0,e.openBlock)(),(0,e.createElementBlock)(`main`,He,[...r[11]||=[(0,e.createElementVNode)(`p`,{class:`gallery-status`},` Loading media… `,-1)]])):t.state.items.length===0?((0,e.openBlock)(),(0,e.createElementBlock)(`main`,Ue,[...r[12]||=[(0,e.createElementVNode)(`p`,{class:`gallery-status`},` No media found. `,-1)]])):t.state.layout===`reel`?((0,e.openBlock)(),(0,e.createBlock)(Be,{key:3,ref_key:`reelRenderer`,ref:l,"can-retry-end":t.canRetryEnd,"has-next":t.state.next!==null,"card-footer":t.cardFooter,"card-header":t.cardHeader,"infinite-scroll":t.state.infiniteScroll,"is-loading-more":t.state.isLoadingMore,items:t.state.items,"load-more-locked":t.state.loadMoreLocked,"media-source":t.state.reelMediaSource,"media-indices":g.value,"initial-post-id":t.state.activeReelPostId,"info-sheet":t.reelInfoSheet,"info-sheet-enabled":t.state.reelInfoSheet.enabled,"info-sheet-overlay":t.state.reelInfoSheetOverlay,"next-page-error":!!t.state.nextPageError,origin:`reel`,"preview-states":y.value,"reel-auto-advance":t.state.reelAutoAdvance,total:t.state.total,onActiveChange:r[0]||=e=>s(`activeReelChange`,e),onCloseInfoSheet:r[1]||=e=>s(`reelInfoSheetChange`,!1),onError:M,onLoadMore:r[2]||=e=>s(`loadMore`),onMediaChange:P,onReady:N,onRetryEnd:r[3]||=e=>s(`retryEnd`)},null,8,[`can-retry-end`,`has-next`,`card-footer`,`card-header`,`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`,`total`])):((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:4},[(0,e.createVNode)(Ae,{ref_key:`masonryRenderer`,ref:c,"can-retry-end":t.canRetryEnd,"entering-post-ids":m.value,"entry-delays":h.value,"card-footer":t.cardFooter,"card-header":t.cardHeader,"has-next":t.state.next!==null,"infinite-scroll":t.state.infiniteScroll,"is-loading-more":t.state.isLoadingMore,items:t.state.items,"load-more-locked":t.state.loadMoreLocked,"media-indices":g.value,"next-page-error":!!t.state.nextPageError,"preview-states":_.value,suspended:t.state.reelOrigin===`masonry`||p.value,total:t.state.total,onActivate:z,onError:O,onLoadMore:r[4]||=e=>s(`loadMore`),onMediaChange:P,onReady:k,onRetryEnd:r[5]||=e=>s(`retryEnd`)},null,8,[`can-retry-end`,`entering-post-ids`,`entry-delays`,`card-footer`,`card-header`,`has-next`,`infinite-scroll`,`is-loading-more`,`items`,`load-more-locked`,`media-indices`,`next-page-error`,`preview-states`,`suspended`,`total`]),(0,e.createVNode)(e.Transition,{name:`vibe-reel-viewer`,onAfterLeave:W},{default:(0,e.withCtx)(()=>[t.state.reelOrigin===`masonry`?((0,e.openBlock)(),(0,e.createElementBlock)(`section`,{key:0,ref_key:`reelOverlay`,ref:u,class:`vibe-reel-overlay`,role:`dialog`,"aria-label":`Media viewer`,"aria-modal":`true`,tabindex:`-1`,style:(0,e.normalizeStyle)(f.value)},[(0,e.createVNode)(Be,{ref_key:`reelRenderer`,ref:l,"can-retry-end":t.canRetryEnd,"card-footer":t.cardFooter,"card-header":t.cardHeader,"has-next":t.state.next!==null,"infinite-scroll":t.state.infiniteScroll,"initial-post-id":t.state.activeReelPostId,"info-sheet":t.reelInfoSheet,"info-sheet-enabled":t.state.reelInfoSheet.enabled,"info-sheet-overlay":t.state.reelInfoSheetOverlay,"is-loading-more":t.state.isLoadingMore,items:t.state.items,"load-more-locked":t.state.loadMoreLocked,"media-indices":g.value,"media-source":`original`,"next-page-error":!!t.state.nextPageError,origin:`masonry`,"preview-states":v.value,"reel-auto-advance":t.state.reelAutoAdvance,total:t.state.total,onActiveChange:r[6]||=e=>s(`activeReelChange`,e),onCloseInfoSheet:r[7]||=e=>s(`reelInfoSheetChange`,!1),onError:A,onLoadMore:r[8]||=e=>s(`loadMore`),onMediaChange:P,onReady:j,onRetryEnd:r[9]||=e=>s(`retryEnd`)},null,8,[`can-retry-end`,`card-footer`,`card-header`,`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`,`total`])],4)):(0,e.createCommentVNode)(``,!0)]),_:1})],64))],512))}});function Ke(e){if(!e||typeof e!=`object`||!Array.isArray(e.items))throw TypeError(`Vibe loadPage must resolve to a page with an items array.`);if(e.next!==null&&typeof e.next!=`string`&&typeof e.next!=`number`)throw TypeError(`Vibe page next must be a string, number, or null.`);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.`);return e}function J(e,t){let n=new Set(e.map(e=>e.postId));return[...e,...t.filter(e=>n.has(e.postId)?!1:(n.add(e.postId),!0))]}var qe=2e3,Je=1e4,Ye=250,Y={delayRemainingMs:null,nextRequestAt:null};function Xe(e,t){return e===void 0?t:Math.floor(e)}function Ze(e,t){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.`)}function Qe(e,t={}){let n=Xe(t.delayStepMs,qe),r=Xe(t.delayMaxMs,Je);return Math.min(Math.max(0,e)*n,r)}function X(e){if(e==null||!Number.isFinite(e))return{...Y};let t=Math.max(0,Math.floor(e-Date.now()));return t>0?{delayRemainingMs:t,nextRequestAt:e}:{...Y}}async function $e({delayMs:e,onChange:t,signal:n}){if(n.aborted)throw new DOMException(`Aborted`,`AbortError`);if(e<=0){t({...Y});return}let r=Date.now()+e;t({delayRemainingMs:e,nextRequestAt:r}),await new Promise((i,a)=>{let o=!1,s=setInterval(f,Ye),c=setTimeout(()=>u(),e);function l(){clearInterval(s),clearTimeout(c),n.removeEventListener(`abort`,d),t({...Y})}function u(e){o||(o=!0,l(),e?a(e):i())}function d(){u(new DOMException(`Aborted`,`AbortError`))}function f(){let e=X(r);t(e),e.delayRemainingMs===null&&u()}n.addEventListener(`abort`,d,{once:!0})})}var et=class{interval=null;constructor(e){this.onChange=e}clear(){this.interval!==null&&clearInterval(this.interval),this.interval=null,this.onChange({...Y})}sync(e){this.clear();let t=X(e);this.onChange(t),t.delayRemainingMs!==null&&(this.interval=setInterval(()=>{let t=X(e);this.onChange(t),t.delayRemainingMs===null&&this.clear()},Ye))}};function tt(e){return`${typeof e}:${String(e)}`}function nt(e,t){if(!Number.isInteger(e)||e<=0)throw TypeError(`Vibe ${t} must be a positive integer.`)}function rt(e){if(!e)return;if(nt(e.pageSize,`autofill pageSize`),e.strategy===`frontend`){Ze(e,`frontend autofill`);let t=e.maxAdditionalPages;if(t!==void 0&&(!Number.isInteger(t)||t<0))throw TypeError(`Vibe autofill maxAdditionalPages must be a non-negative integer.`);return}if(!e.feedKey.trim())throw TypeError(`Vibe backend autofill requires a feedKey.`);let t=e.initialSession;if(t){if(t.feedKey!==e.feedKey)throw TypeError(`Vibe backend autofill initialSession feedKey must match autofill feedKey.`);if(t.pageSize!==e.pageSize)throw TypeError(`Vibe backend autofill initialSession pageSize must match autofill pageSize.`)}}function Z(e,t,n=!0){if(!e)return{cycleId:null,delayRemainingMs:null,enabled:!1,error:null,feedKey:null,missing:0,nextRequestAt:null,pageSize:null,received:0,requests:0,sequence:0,sessionId:null,status:`idle`,strategy:null};let r=e.strategy===`backend`?t??(n?e.initialSession:void 0):void 0,i=r?.received??0,a=X(r?.nextRequestAt);return{cycleId:r?.cycleId??null,...a,enabled:!0,error:r?.error??null,feedKey:e.strategy===`backend`?e.feedKey:null,missing:Math.max(0,e.pageSize-i),pageSize:e.pageSize,received:i,requests:r?.requests??0,sequence:r?.sequence??0,sessionId:r?.sessionId??null,status:r?r.status:`idle`,strategy:e.strategy}}function Q(e){return[`cancelling`,`filling`,`restoring`,`waiting`].includes(e.status)}async function it(e,t,n){let r=t.autofill;if(!Q(r)||!r.cycleId)return;let i={cycleId:r.cycleId,feedKey:r.feedKey??``,sessionId:r.sessionId};n(),r.status=`cancelling`;try{e?.strategy===`backend`&&await e.onCancel(i),r.error=null,r.status=`cancelled`}catch(e){throw r.error=e,r.status=`error`,e}}function at(e,t,n){return e?.strategy===`backend`&&t.feedKey===e.feedKey&&t.sessionId===n.sessionId}async function ot({existingItems:e,initialCursor:t,loadPage:n,maximumRequests:r,onDelayChange:i,onProgress:a,options:o,receivedOffset:s=0,requestOffset:c=0,signal:l}){let u=[],d=[...e],f=new Set,p=r??1+(o.maxAdditionalPages??10),m=t,h=t,g=0,_;for(;g<p;){let e=tt(m);if(f.has(e))throw Error(`Vibe autofill received a repeated cursor.`);f.add(e),await $e({delayMs:Qe(c+g,o),onChange:i,signal:l});let t=Ke(await n({cursor:m,signal:l}));g+=1;let r=J(d,t.items).slice(d.length);d.push(...r),u.push(...r),h=t.next,t.total!==void 0&&(_=t.total);let p={missing:Math.max(0,o.pageSize-s-u.length),next:h,received:s+u.length,requests:c+g};if(a(p),p.missing===0)return{...p,items:u,lastCursor:m,status:`complete`,total:_};if(h===null)return{...p,items:u,lastCursor:m,status:`exhausted`,total:_};m=h}return{items:u,lastCursor:m,missing:Math.max(0,o.pageSize-s-u.length),next:h,received:s+u.length,requests:c+g,status:`exhausted`,total:_}}var st=100;function $(e,t){if(!Number.isFinite(t)||t<=0)throw TypeError(`Vibe ${e} must be a positive number.`)}function ct(e,t,n){return Math.min(n,Math.max(t,e))}function lt(e){if(!e)return;let t=e.minSpeedPxPerSecond??20,n=e.maxSpeedPxPerSecond??240;if($(`autoScroll.minSpeedPxPerSecond`,t),$(`autoScroll.maxSpeedPxPerSecond`,n),t>n)throw TypeError(`Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.`);e.speedPxPerSecond!==void 0&&$(`autoScroll.speedPxPerSecond`,e.speedPxPerSecond)}function ut(e){let t=e?.minSpeedPxPerSecond??20,n=e?.maxSpeedPxPerSecond??240;return{enabled:e?.enabled??!1,maxSpeedPxPerSecond:n,minSpeedPxPerSecond:t,paused:!1,speedPxPerSecond:ct(e?.speedPxPerSecond??80,t,n)}}var dt=class{frame=null;lastTimestamp=null;mounted=!1;constructor(e){this.options=e}mount(){this.mounted=!0,this.schedule()}destroy(){this.mounted=!1,this.cancelFrame()}setEnabled(e,t){t!==void 0&&this.setSpeed(t),this.options.state.enabled=e,this.options.state.paused=!1,this.lastTimestamp=null,e?this.schedule():this.cancelFrame()}setPaused(e){this.options.state.enabled&&(this.options.state.paused=e,this.lastTimestamp=null,e?this.cancelFrame():this.schedule())}setSpeed(e){$(`auto-scroll speed`,e);let t=this.options.state;t.speedPxPerSecond=ct(e,t.minSpeedPxPerSecond,t.maxSpeedPxPerSecond)}tick=e=>{this.frame=null;let t=this.options.state;if(!this.mounted||!t.enabled)return;let n=t.paused?null:this.options.getScrollElement();if(!n){this.lastTimestamp=null,this.schedule();return}if(this.lastTimestamp!==null){let r=Math.min(st,Math.max(0,e-this.lastTimestamp)),i=Math.max(0,n.scrollHeight-n.clientHeight);n.scrollTop=Math.min(i,n.scrollTop+t.speedPxPerSecond*r/1e3)}this.lastTimestamp=e,this.schedule()};schedule(){!this.mounted||!this.options.state.enabled||this.frame!==null||typeof requestAnimationFrame==`function`&&(this.frame=requestAnimationFrame(this.tick))}cancelFrame(){this.frame!==null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(this.frame),this.frame=null,this.lastTimestamp=null}};async function ft(e,t,n,r){let i=await e.onUnderfilled(n);if(!r())return;if(!i.sessionId.trim())throw TypeError(`Vibe backend autofill requires a sessionId.`);let a=Math.max(n.received,i.received??n.received);Object.assign(t.autofill,{...X(i.nextRequestAt),missing:Math.max(0,e.pageSize-a),received:a,sequence:i.sequence??0,sessionId:i.sessionId,status:`waiting`})}function pt(e,t){[`complete`,`exhausted`].includes(t.status)&&t.items&&(e.items=J(e.items,t.items)),t.next!==void 0&&(e.next=t.next),t.total!==void 0&&(e.total=t.total)}function mt(e,t,n){let r=t.autofill;return!at(e,n,r)||n.sequence<=r.sequence||[`cancelled`,`cancelling`].includes(r.status)||[`complete`,`exhausted`].includes(n.status)&&n.next===void 0?!1:(pt(t,n),Object.assign(r,X(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)}function ht(e,t,n){return e?.strategy!==`backend`||n.feedKey!==e.feedKey||n.pageSize!==e.pageSize?!1:(t.autofill=Z(e,n),pt(t,n),!0)}var gt=1.5;function _t(e){let t=Math.min(e.screenWidth,e.screenHeight);if(t>0&&t<600)return!0;let n=Math.min(e.viewportWidth,e.viewportHeight),r=t>=n*gt;return!e.hasHover&&n>0&&n<600&&r}function vt(e){return _t(e)?`reel`:`masonry`}function yt(e){let t=e.ownerDocument.defaultView,n=e.ownerDocument.documentElement;return{hasHover:typeof t?.matchMedia==`function`&&t.matchMedia(`(hover: hover)`).matches,screenHeight:t?.screen.height??0,screenWidth:t?.screen.width??0,viewportHeight:n.clientHeight,viewportWidth:n.clientWidth}}function bt(e){return _t(yt(e))}function xt(e){return vt(yt(e))}async function St({cycleId:e,isCurrent:t,onLastCursor:n,options:r,signal:i,state:a}){let o=r.autofill;if(!o)return;let s=a.items.length;if(Object.assign(a.autofill,{missing:Math.max(0,o.pageSize-s),received:s,requests:1}),s>=o.pageSize){a.autofill.status=`complete`;return}if(o.strategy===`backend`){await ft(o,a,{cycleId:e,feedKey:o.feedKey,items:[...a.items],missing:o.pageSize-s,next:a.next,pageSize:o.pageSize,received:s,signal:i,total:a.total},t);return}if(!r.loadPage||a.next===null){a.autofill.status=`exhausted`;return}let c=await ot({existingItems:a.items,initialCursor:a.next,loadPage:r.loadPage,maximumRequests:o.maxAdditionalPages??10,onDelayChange:e=>{t()&&Object.assign(a.autofill,e)},onProgress:e=>{t()&&Object.assign(a.autofill,e,{status:`filling`})},options:o,receivedOffset:s,requestOffset:1,signal:i});t()&&(a.items=J(a.items,c.items),a.next=c.next,c.total!==void 0&&(a.total=c.total),n(c.lastCursor),Object.assign(a.autofill,{missing:c.missing,received:c.received,requests:c.requests,status:c.status}))}function Ct(e){return`pages`in e?{pages:e.pages}:{until:`end`}}function wt(e){return`${typeof e}:${String(e)}`}function Tt(e){if(!e||typeof e!=`object`)throw TypeError(`Vibe fill target must be an object.`);if(`pages`in e){if(!Number.isInteger(e.pages)||e.pages<=0)throw TypeError(`Vibe fill pages must be a positive integer.`);return{pages:e.pages}}if(`until`in e&&e.until===`end`)return{until:`end`};throw TypeError(`Vibe fill target must be { pages } or { until: 'end' }.`)}function Et(e){if(!e)return;if(e.strategy===`frontend`){Ze(e,`frontend fill`);return}if(!e.feedKey.trim())throw TypeError(`Vibe backend fill requires a feedKey.`);let t=e.initialSession;if(t){if(t.feedKey!==e.feedKey)throw TypeError(`Vibe backend fill initialSession feedKey must match fill feedKey.`);Tt(t.target)}}function Dt(e,t,n=!0){let r=e?.strategy===`backend`&&n?e.initialSession:void 0,i=t??r,a=X(i?.nextRequestAt);return{completedPages:i?.completedPages??0,cycleId:i?.cycleId??null,...a,enabled:!!e,error:i?.error??null,feedKey:e?.strategy===`backend`?e.feedKey:null,received:i?.received??0,sequence:i?.sequence??0,sessionId:i?.sessionId??null,status:i?.status??`idle`,strategy:e?.strategy??null,target:i?Ct(i.target):null}}function Ot(e){return[`cancelling`,`filling`,`restoring`,`waiting`].includes(e.status)}async function kt({existingItems:e,initialCursor:t,loadPage:n,onDelayChange:r,onProgress:i,options:a,signal:o,target:s}){let c=[],l=[...e],u=new Set,d=0,f=t,p=t,m=0,h;for(;p!==null;){let e=wt(f);if(u.has(e))throw Error(`Vibe fill received a repeated cursor.`);u.add(e),await $e({delayMs:Qe(d,a),onChange:r,signal:o});let t=Ke(await n({cursor:f,signal:o}));d+=1;let g=J(l,t.items).slice(l.length);if(l.push(...g),c.push(...g),m=c.length,p=t.next,t.total!==void 0&&(h=t.total),i({completedPages:d,next:p,received:m}),`pages`in s&&d>=s.pages)return{completedPages:d,items:c,lastCursor:f,next:p,received:m,status:`complete`,total:h};if(p===null)return{completedPages:d,items:c,lastCursor:f,next:p,received:m,status:`pages`in s?`exhausted`:`complete`,total:h};f=p}return{completedPages:d,items:c,lastCursor:f,next:null,received:m,status:`pages`in s?`exhausted`:`complete`,total:h}}async function At(e,t,n,r){let i=await e.onStart(n);if(r()){if(!i.sessionId.trim())throw TypeError(`Vibe backend fill requires a sessionId.`);Object.assign(t.fill,{...X(i.nextRequestAt),completedPages:i.completedPages??0,received:i.received??0,sequence:i.sequence??0,sessionId:i.sessionId,status:`waiting`})}}function jt(e,t,n){return e?.strategy===`backend`&&n.feedKey===e.feedKey&&n.sessionId===t.fill.sessionId}function Mt(e){return Number.isInteger(e.completedPages)&&e.completedPages>=0&&Number.isInteger(e.received)&&e.received>=0&&Number.isInteger(e.sequence)&&e.sequence>=0}function Nt(e,t){if(![`complete`,`exhausted`].includes(t.status))return!0;let n=e.fill.target;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}function Pt(e,t,n){t.total!==void 0&&(e.total=t.total),[`complete`,`exhausted`].includes(t.status)&&(e.items=J(e.items,t.items??[]),e.next=t.next??null,n(t.lastCursor??null))}function Ft(e,t,n,r){return!jt(e,t,n)||!Mt(n)||n.sequence<=t.fill.sequence||[`cancelled`,`cancelling`].includes(t.fill.status)||!Nt(t,n)?!1:(Pt(t,n,r),Object.assign(t.fill,{...X(n.status===`waiting`?n.nextRequestAt:null),completedPages:n.completedPages,error:n.error??null,received:n.received,sequence:n.sequence,status:n.status}),!0)}function It(e,t,n,r){if(e?.strategy!==`backend`||n.feedKey!==e.feedKey)return!1;let i=t.fill;return t.fill=Dt(e,n),!Mt(n)||!Nt(t,n)?(t.fill=i,!1):(Pt(t,n,r),!0)}var Lt=class{abortController=null;cycle=0;delayCountdown;requestVersion=0;constructor(e){this.options=e,this.delayCountdown=new et(e=>{Object.assign(this.options.state.fill,e)}),this.syncBackendCountdown()}isActive(){return Ot(this.options.state.fill)}applyUpdate(e){let t=Ft(this.options.fill,this.options.state,e,this.options.onLastCursor);return t&&this.syncBackendCountdown(),t}restoreSession(e){let t=It(this.options.fill,this.options.state,e,this.options.onLastCursor);return t&&this.syncBackendCountdown(),t}async start(e){let t=this.options.fill;if(!t)throw Error(`Vibe fill is not configured.`);if(this.isActive())throw Error(`Vibe fill is already active.`);let n=Tt(e),r=`vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;if(this.options.state.fill={...Dt(t,void 0,!1),cycleId:r,status:`filling`,target:n},this.options.state.next===null){this.options.state.fill.status=`pages`in n?`exhausted`:`complete`;return}let i=++this.requestVersion,a=new AbortController;this.abortController=a;try{t.strategy===`frontend`?await this.startFrontend(t,n,a,i):(await At(t,this.options.state,{cycleId:r,feedKey:t.feedKey,items:[...this.options.state.items],next:this.options.state.next,signal:a.signal,target:n,total:this.options.state.total},()=>this.isCurrent(i)),this.syncBackendCountdown())}catch(e){if(a.signal.aborted||!this.isCurrent(i))return;throw this.options.state.fill.error=e,this.options.state.fill.status=`error`,e}finally{this.isCurrent(i)&&(this.abortController=null,this.options.state.isLoadingMore=!1)}}async cancel(){let{fill:e,state:t}=this.options;if(!Ot(t.fill)||!t.fill.cycleId)return;let n={cycleId:t.fill.cycleId,feedKey:t.fill.feedKey??``,sessionId:t.fill.sessionId};t.fill.status=`cancelling`,this.delayCountdown.clear(),this.abortController?.abort(),this.requestVersion+=1,this.abortController=null,t.isLoadingMore=!1;try{e?.strategy===`backend`&&await e.onCancel(n),t.fill.error=null,t.fill.status=`cancelled`}catch(e){throw t.fill.error=e,t.fill.status=`error`,e}}reset(){this.abortLocalRequest(),this.delayCountdown.clear(),this.options.state.fill=Dt(this.options.fill,void 0,!1)}destroy(){this.abortLocalRequest(),this.delayCountdown.clear()}abortLocalRequest(){this.requestVersion+=1,this.abortController?.abort(),this.abortController=null,this.options.state.isLoadingMore=!1}isCurrent(e){return e===this.requestVersion&&![`cancelled`,`cancelling`].includes(this.options.state.fill.status)}async startFrontend(e,t,n,r){let i=this.options.loadPage;if(!i)throw Error(`Vibe frontend fill requires loadPage.`);let a=this.options.state;a.isLoadingMore=!0;let o=await kt({existingItems:a.items,initialCursor:a.next,loadPage:i,onDelayChange:e=>{this.isCurrent(r)&&Object.assign(a.fill,e)},onProgress:e=>{this.isCurrent(r)&&Object.assign(a.fill,e)},options:e,signal:n.signal,target:t});this.isCurrent(r)&&(a.items=J(a.items,o.items),a.next=o.next,o.total!==void 0&&(a.total=o.total),this.options.onLastCursor(o.lastCursor),Object.assign(a.fill,{completedPages:o.completedPages,received:o.received,status:o.status}))}syncBackendCountdown(){let e=this.options.state.fill;this.delayCountdown.sync(e.strategy===`backend`&&e.status===`waiting`?e.nextRequestAt:null)}};function Rt(e){if(!Number.isFinite(e)||e<=0)throw TypeError(`Vibe reelAutoAdvance.intervalMs must be a positive number.`)}function zt(e){e?.intervalMs!==void 0&&Rt(e.intervalMs)}function Bt(e){return{enabled:e?.enabled??!1,includePostItems:e?.includePostItems??!1,intervalMs:e?.intervalMs??5e3}}function Vt(e,t){if(typeof t==`boolean`){e.enabled=t;return}zt(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)}function Ht(e){return{enabled:e?.enabled??!1}}function Ut(e,t,n){if(n&&!t)throw Error(`Vibe cannot enable reelInfoSheet without a configured component.`);e.enabled=n}function Wt(e,t){let n=e.initialPage;return{activeReelPostId:null,autoScroll:ut(e.autoScroll),autofill:Z(e.autofill),error:null,fill:Dt(e.fill),infiniteScroll:e.infiniteScroll??!0,isLoading:!n,isLoadingMore:!1,items:n?J([],n.items):[],layout:t===`reel`?`reel`:`masonry`,loadMoreLocked:!1,next:n?.next??null,nextPageError:null,reelAutoAdvance:Bt(e.reelAutoAdvance),reelInfoSheet:Ht(e.reelInfoSheet),reelInfoSheetOverlay:!1,reelMediaSource:`original`,reelOrigin:null,total:n?.total??null}}function Gt(e,t){if(t&&(!Number.isFinite(t.height)||t.height<=0))throw TypeError(`Vibe ${e} height must be a positive number.`)}function Kt(e){if(lt(e.autoScroll),Gt(`cardHeader`,e.cardHeader),Gt(`cardFooter`,e.cardFooter),rt(e.autofill),Et(e.fill),zt(e.reelAutoAdvance),!e.initialPage&&!e.loadPage)throw TypeError(`Vibe requires either initialPage or loadPage.`);if(e.initialPage?.next!==null&&!e.loadPage)throw TypeError(`Vibe requires loadPage when initialPage has a next cursor.`);if(e.fill?.strategy===`frontend`&&!e.loadPage)throw TypeError(`Vibe frontend fill requires loadPage.`);if(e.fill?.strategy===`backend`&&e.fill.initialSession&&!e.initialPage)throw TypeError(`Vibe backend fill restoration requires initialPage.`)}function qt(e){if(typeof e!=`string`)return e;if(typeof document>`u`)throw Error(`Vibe cannot resolve a selector without a document.`);let t=document.querySelector(e);if(!t)throw Error(`Vibe target not found: ${e}`);return t}var Jt=class{routedReelPostId=null;reelRouteIsActive=!1;constructor(e,t){this.options=e,this.state=t}syncFeed(){if(!this.options||!this.reelRouteIsActive)return;this.reelRouteIsActive=!1,this.routedReelPostId=null;let e=typeof this.options.feed==`function`?this.options.feed():this.options.feed;this.options.router.replace(e)}syncReel(e){if(!this.options)return;let t=this.state.items.findIndex(t=>t.postId===e),n=this.state.items[t];if(!n||this.reelRouteIsActive&&this.routedReelPostId===e)return;let r=this.options.reel({index:t,item:n,loadedCount:this.state.items.length,origin:this.state.reelOrigin??`reel`,total:this.state.total});if(r===null)return;let i=this.reelRouteIsActive?`replace`:`push`;this.reelRouteIsActive=!0,this.routedReelPostId=e,this.options.router[i](r)}};function Yt(e){return{activeReelPostId:e.activeReelPostId,autoScroll:{...e.autoScroll},autofill:{...e.autofill},error:e.error,fill:{...e.fill,target:e.fill.target?{...e.fill.target}:null},infiniteScroll:e.infiniteScroll,isLoading:e.isLoading,isLoadingMore:e.isLoadingMore,items:[...e.items],layout:e.layout,lifecycle:e.isLoading||e.isLoadingMore?`loading`:e.error||e.nextPageError?`error`:`loaded`,loadMoreLocked:e.loadMoreLocked,next:e.next,nextPageError:e.nextPageError,reelAutoAdvance:{...e.reelAutoAdvance},reelInfoSheet:{...e.reelInfoSheet},reelOrigin:e.reelOrigin,total:e.total}}var Xt=class{app=null;autoScroll;autofillDelayCountdown;autofillCycle=0;abortController=null;pendingRequest=null;requestVersion=0;resizeObserver=null;routing;fillController;surface=null;stopStateWatcher=null;target=null;layoutMode;lastLoadedCursor=null;state;constructor(t){this.options=t,Kt(t),this.layoutMode=t.layout??`masonry`,this.state=(0,e.reactive)(Wt(t,this.layoutMode)),this.autoScroll=new dt({getScrollElement:()=>this.surface?.getAutoScrollElement()??null,state:this.state.autoScroll}),this.autofillDelayCountdown=new et(e=>Object.assign(this.state.autofill,e)),this.syncAutofillCountdown(),this.fillController=new Lt({fill:t.fill,loadPage:t.loadPage,onLastCursor:e=>{this.lastLoadedCursor=e},state:this.state}),this.routing=new Jt(t.routing,this.state),this.startStateNotifications()}async mount(){if(this.app)throw Error(`Vibe is already mounted.`);this.startStateNotifications();let t=qt(this.options.target);this.target=t,this.startResponsiveLayout(),this.app=(0,e.createApp)(Ge,{canRetryEnd:!!this.options.loadPage,cardFooter:this.options.cardFooter,cardHeader:this.options.cardHeader,reelInfoSheet:this.options.reelInfoSheet,state:this.state,onActiveReelChange:e=>this.setActiveReelPost(e),onCloseReel:()=>this.closeMasonryReel(),onLoadMore:()=>{this.loadNext()},onOpenReel:e=>this.openMasonryReel(e),onReelInfoSheetChange:e=>this.setReelInfoSheet(e),onRetryEnd:()=>{this.retryEnd()}}),this.surface=this.app.mount(t),this.autoScroll.mount(),this.options.initialPage?this.options.autofill&&this.state.autofill.status===`idle`&&!this.fillController.isActive()&&await this.startInitialAutofill():await this.reload()}destroy(){this.autoScroll.destroy(),this.fillController.destroy(),this.cancelRequest(),this.stopResponsiveLayout(),this.stopStateWatcher?.(),this.stopStateWatcher=null,this.app?.unmount(),this.app=null,this.surface=null,this.target=null}getState(){return Yt(this.state)}nextReelMediaItem(){return this.surface?.changeActiveReelMedia(1)??!1}previousReelMediaItem(){return this.surface?.changeActiveReelMedia(-1)??!1}nextReelPost(){return this.surface?.moveActiveReelPost(1)??!1}previousReelPost(){return this.surface?.moveActiveReelPost(-1)??!1}pauseAutoScroll(){this.autoScroll.setPaused(!0)}resumeAutoScroll(){this.autoScroll.setPaused(!1)}setAutoScroll(e,t){this.autoScroll.setEnabled(e,t)}setAutoScrollSpeed(e){this.autoScroll.setSpeed(e)}applyAutofillUpdate(e){let t=mt(this.options.autofill,this.state,e);return t&&this.syncAutofillCountdown(),t}async cancelAutofill(){await it(this.options.autofill,this.state,()=>this.cancelRequest())}applyFillUpdate(e){return this.fillController.applyUpdate(e)}cancelFill(){return this.fillController.cancel()}async fill(e){if(this.pendingRequest||Q(this.state.autofill))throw Error(`Vibe cannot fill while another page operation is active.`);await this.fillController.start(e)}restoreAutofillSession(e){let t=ht(this.options.autofill,this.state,e);return t&&this.syncAutofillCountdown(),t}restoreFillSession(e){return this.fillController.restoreSession(e)}async loadNext(){if(this.pendingRequest)return this.pendingRequest;if(!this.state.loadMoreLocked&&!(Q(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.state.next,!0)}async reload(){if(!this.options.loadPage)throw Error(`Vibe cannot reload without loadPage.`);return Q(this.state.autofill)&&await this.cancelAutofill(),this.fillController.isActive()&&await this.cancelFill(),this.cancelRequest(),this.state.autofill=Z(this.options.autofill,void 0,!1),this.fillController.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(null,!1)}async retryEnd(){if(this.pendingRequest)return this.pendingRequest;if(!this.state.loadMoreLocked&&!(Q(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)}setInfiniteScroll(t){this.state.infiniteScroll=t,t&&(0,e.nextTick)(()=>this.surface?.loadIfNearBottom())}setLoadMoreLocked(t){this.state.loadMoreLocked!==t&&(this.state.loadMoreLocked=t,!t&&this.state.infiniteScroll&&(0,e.nextTick)(()=>this.surface?.loadIfNearBottom()))}setReelAutoAdvance(e){Vt(this.state.reelAutoAdvance,e)}setReelInfoSheet(e){Ut(this.state.reelInfoSheet,this.options.reelInfoSheet,e)}setLayout(e){e!==this.layoutMode&&(this.layoutMode=e,e===`responsive`?this.handleResponsiveLayout():this.applyLayout(e))}applyLayout(e){e!==this.state.layout&&(e===`masonry`&&(this.state.activeReelPostId=null,this.routing.syncFeed()),this.state.reelOrigin=null,this.state.layout=e)}handleResponsiveLayout=()=>{if(!this.target)return;let e=xt(this.target);this.state.reelInfoSheetOverlay=bt(this.target),this.state.reelMediaSource=e===`reel`?`preview`:`original`,this.layoutMode===`responsive`&&this.applyLayout(e)};startResponsiveLayout(){if(!this.target)return;this.handleResponsiveLayout();let e=this.target.ownerDocument.defaultView;e?.addEventListener(`resize`,this.handleResponsiveLayout);let t=e?.ResizeObserver??globalThis.ResizeObserver;t!==void 0&&(this.resizeObserver=new t(this.handleResponsiveLayout),this.resizeObserver.observe(this.target))}stopResponsiveLayout(){this.target?.ownerDocument.defaultView?.removeEventListener(`resize`,this.handleResponsiveLayout),this.resizeObserver?.disconnect(),this.resizeObserver=null}closeMasonryReel(){this.state.reelOrigin===`masonry`&&(this.state.activeReelPostId=null,this.state.reelOrigin=null,this.routing.syncFeed())}openMasonryReel(e){this.state.layout===`masonry`&&this.state.items.some(t=>t.postId===e)&&(this.state.activeReelPostId=e,this.state.reelOrigin=`masonry`,this.routing.syncReel(e))}setActiveReelPost(e){this.state.layout!==`reel`&&this.state.reelOrigin!==`masonry`||(this.state.activeReelPostId=e,this.routing.syncReel(e))}cancelRequest(){this.autofillDelayCountdown.clear(),this.requestVersion+=1,this.abortController?.abort(),this.abortController=null,this.pendingRequest=null,this.state.isLoading=!1,this.state.isLoadingMore=!1}async fetchPage(e,t){let n=this.options.loadPage;if(!n)return;let r=++this.requestVersion,i=new AbortController,a=this.options.autofill,o=a?this.beginAutofillCycle():null,s=!1;this.abortController=i;try{if(a?.strategy===`frontend`){let o=await ot({existingItems:t?this.state.items:[],initialCursor:e,loadPage:n,onDelayChange:e=>{r===this.requestVersion&&Object.assign(this.state.autofill,e)},onProgress:e=>{r===this.requestVersion&&Object.assign(this.state.autofill,e,{status:`filling`})},options:a,signal:i.signal});if(r!==this.requestVersion)return;this.state.items=t?J(this.state.items,o.items):[...o.items],this.lastLoadedCursor=o.lastCursor,this.state.next=o.next,o.total!==void 0&&(this.state.total=o.total),Object.assign(this.state.autofill,{missing:o.missing,received:o.received,requests:o.requests,status:o.status});return}let c=Ke(await n({cursor:e,signal:i.signal}));if(r!==this.requestVersion)return;let l=t?this.state.items:[],u=J(l,c.items),d=u.length-l.length;if(this.state.items=u,this.lastLoadedCursor=e,this.state.next=c.next,c.total!==void 0&&(this.state.total=c.total),s=!0,a?.strategy===`backend`&&o){if(Object.assign(this.state.autofill,{missing:Math.max(0,a.pageSize-d),received:d,requests:1}),d>=a.pageSize){this.state.autofill.status=`complete`;return}await ft(a,this.state,{cycleId:o,feedKey:a.feedKey,items:u.slice(l.length),missing:a.pageSize-d,next:c.next,pageSize:a.pageSize,received:d,signal:i.signal,total:this.state.total},()=>r===this.requestVersion),this.syncAutofillCountdown()}}catch(e){if(i.signal.aborted||r!==this.requestVersion)return;a&&(this.state.autofill.error=e,this.state.autofill.status=`error`),s||(t?this.state.nextPageError=e:this.state.error=e)}finally{r===this.requestVersion&&(this.abortController=null,this.state.isLoading=!1,this.state.isLoadingMore=!1)}}beginAutofillCycle(){let e=this.options.autofill;if(!e)return``;this.autofillDelayCountdown.clear();let t=`vibe-autofill-${Date.now().toString(36)}-${++this.autofillCycle}`;return this.state.autofill={...Z(e,void 0,!1),cycleId:t,status:`filling`},t}syncAutofillCountdown(){let e=this.state.autofill;this.autofillDelayCountdown.sync(e.strategy===`backend`&&e.status===`waiting`?e.nextRequestAt:null)}startRequest(e,t){let n=this.fetchPage(e,t);return this.pendingRequest=n,n.finally(()=>{this.pendingRequest===n&&(this.pendingRequest=null)})}startInitialAutofill(){let e=++this.requestVersion,t=new AbortController,n=this.beginAutofillCycle();this.abortController=t,this.state.isLoadingMore=!0;let r=St({cycleId:n,isCurrent:()=>e===this.requestVersion,onLastCursor:e=>{this.lastLoadedCursor=e},options:this.options,signal:t.signal,state:this.state}).catch(n=>{t.signal.aborted||e!==this.requestVersion||(this.state.autofill.error=n,this.state.autofill.status=`error`,this.state.nextPageError=n)}).finally(()=>{e===this.requestVersion&&(this.syncAutofillCountdown(),this.abortController=null,this.state.isLoadingMore=!1,this.pendingRequest===r&&(this.pendingRequest=null))});return this.pendingRequest=r,r}startStateNotifications(){let t=this.options.onStateChange;!t||this.stopStateWatcher||(t(this.getState()),this.stopStateWatcher=(0,e.watch)(this.state,()=>t(this.getState()),{deep:!0,flush:`post`}))}};function Zt(e){return new Xt(e)}exports.createVibe=Zt;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`vue`);function t(e){return[e,...e.items]}function n(e,t){return Math.min(e.items.length,Math.max(0,t))}function r(e,r){return t(e)[n(e,r)]??e}function i(e,t){return`${String(e)}:${t}`}function a(e){return{activeReelPostId:e.activeReelPostId,autoScroll:{...e.autoScroll},autofill:{...e.autofill},error:e.error,fill:{...e.fill,target:e.fill.target?{...e.fill.target}:null},infiniteScroll:e.infiniteScroll,isLoading:e.isLoading,isLoadingMore:e.isLoadingMore,items:[...e.items],layout:e.layout,lifecycle:e.isLoading||e.isLoadingMore?`loading`:e.error||e.nextPageError?`error`:`loaded`,loadMoreLocked:e.loadMoreLocked,next:e.next,nextPageError:e.nextPageError,reelAutoAdvance:{...e.reelAutoAdvance},reelInfoSheet:{...e.reelInfoSheet},reelOrigin:e.reelOrigin,total:e.total}}var o={key:0,class:`gallery-footer`},s={key:0,class:`load-more-status`,role:`status`},c=[`disabled`],l={key:2,class:`gallery-sentinel`,"aria-hidden":`true`},u={key:3,class:`end-feed`},d=[`disabled`],f=(0,e.defineComponent)({__name:`GalleryFooter`,props:{canRetryEnd:{type:Boolean},hasError:{type:Boolean},hasNext:{type:Boolean},infiniteScroll:{type:Boolean},isLoading:{type:Boolean},loadMoreLocked:{type:Boolean}},emits:[`loadMore`,`retryEnd`],setup(t,{emit:n}){let r=t,i=n;function a(){r.loadMoreLocked||(r.hasNext?i(`loadMore`):i(`retryEnd`))}return(n,r)=>t.hasNext||t.isLoading||t.hasError||t.canRetryEnd?((0,e.openBlock)(),(0,e.createElementBlock)(`footer`,o,[t.isLoading?((0,e.openBlock)(),(0,e.createElementBlock)(`p`,s,` Loading more… `)):t.hasError||t.hasNext&&(!t.infiniteScroll||t.loadMoreLocked)?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:1,"data-test":`load-more`,class:`load-more-button`,type:`button`,disabled:t.loadMoreLocked,onClick:a},(0,e.toDisplayString)(t.hasError?`Try again`:t.loadMoreLocked?`Loading paused`:`Load more`),9,c)):t.hasNext?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,l)):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,u,[r[1]||=(0,e.createElementVNode)(`p`,{class:`end-feed-message`,role:`status`},` You've reached the end. `,-1),(0,e.createElementVNode)(`button`,{"data-test":`retry-end`,class:`load-more-button`,type:`button`,disabled:t.loadMoreLocked,onClick:r[0]||=e=>n.$emit(`retryEnd`)},` Check for more `,8,d)]))])):(0,e.createCommentVNode)(``,!0)}}),p=(0,e.defineComponent)({__name:`FeedFooter`,props:{actions:{},canRetryEnd:{type:Boolean},feedFooter:{},hasError:{type:Boolean},hasNext:{type:Boolean},infiniteScroll:{type:Boolean},isLoading:{type:Boolean},loadMoreLocked:{type:Boolean},state:{}},emits:[`loadMore`,`retryEnd`],setup(t,{emit:n}){let r=t,i=n;function a(){r.actions?.cancelAutofill()}function o(){r.actions?.retry()}return(n,r)=>t.feedFooter&&t.actions&&t.state?((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.feedFooter.component),{key:0,actions:t.actions,state:t.state,onAutofillCancel:a,onLoadMore:r[0]||=e=>i(`loadMore`),onRetry:o,onRetryEnd:r[1]||=e=>i(`retryEnd`)},null,40,[`actions`,`state`])):((0,e.openBlock)(),(0,e.createBlock)(f,{key:1,"can-retry-end":t.canRetryEnd,"has-error":t.hasError,"has-next":t.hasNext,"infinite-scroll":t.infiniteScroll,"is-loading":t.isLoading,"load-more-locked":t.loadMoreLocked,onLoadMore:r[2]||=e=>i(`loadMore`),onRetryEnd:r[3]||=e=>i(`retryEnd`)},null,8,[`can-retry-end`,`has-error`,`has-next`,`infinite-scroll`,`is-loading`,`load-more-locked`]))}}),m=[`role`],h={class:`gallery-status`},g=(0,e.defineComponent)({__name:`FeedStatus`,props:{actions:{},canRetryEnd:{type:Boolean},feedFooter:{},state:{}},emits:[`loadMore`,`retryEnd`],setup(t,{emit:n}){let r=t,i=n;return(n,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`main`,{class:`gallery-shell`,role:r.state.error?`alert`:r.state.isLoading?`status`:void 0},[(0,e.createElementVNode)(`p`,h,[r.state.error?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[(0,e.createTextVNode)(` Unable to load media. `)],64)):r.state.isLoading?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[(0,e.createTextVNode)(` Loading media… `)],64)):((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:2},[(0,e.createTextVNode)(` No media found. `)],64))]),t.feedFooter?((0,e.openBlock)(),(0,e.createBlock)(p,{key:0,actions:t.actions,"can-retry-end":t.canRetryEnd,"feed-footer":t.feedFooter,"has-error":!!t.state.nextPageError,"has-next":t.state.next!==null,"infinite-scroll":t.state.infiniteScroll,"is-loading":t.state.isLoadingMore,"load-more-locked":t.state.loadMoreLocked,state:t.state,onLoadMore:a[0]||=e=>i(`loadMore`),onRetryEnd:a[1]||=e=>i(`retryEnd`)},null,8,[`actions`,`can-retry-end`,`feed-footer`,`has-error`,`has-next`,`infinite-scroll`,`is-loading`,`load-more-locked`,`state`])):(0,e.createCommentVNode)(``,!0)],8,m))}});function _(e){return e.scrollHeight-e.scrollTop-e.clientHeight<=240}function v(e){let t=e.preview.width??e.width,n=e.preview.height??e.height;return!t||!n||t<=0||n<=0?1:n/t}function y(e){return e.reduce((t,n,r)=>n<e[t]?r:t,0)}function b(e){return Math.max(0,e.containerHeight)+Math.max(0,e.gap)}function x(e,t){let n=Math.max(0,t.overscan),r=t.scrollTop-n,i=t.scrollTop+Math.max(0,t.viewportHeight)+n;return e.reduce((e,t,n)=>(t.y+t.height>=r&&t.y<=i&&e.push(n),e),[])}function S(e,t,n){if(t<=0||e.length===0)return{columns:0,height:0,items:[]};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=>{let t=y(c),n=s*v(e)+i,a={x:t*(s+r),y:c[t],width:s,height:n};return c[t]+=n+r,a});return{columns:o,height:Math.max(...c)-r,items:l}}function C(e,t,n){return Math.min(n,Math.max(t,e))}function w({contentSize:e,minimumThumbSize:t,scrollPosition:n,trackSize:r,viewportSize:i}){let a=Math.max(0,e),o=Math.max(0,r),s=Math.max(0,i),c=Math.max(0,a-s);if(!(c>0&&o>0))return{maximumScrollPosition:c,scrollable:!1,thumbOffset:0,thumbSize:o,thumbTravel:0};let l=C(s/a*o,Math.min(Math.max(0,t),o),o),u=Math.max(0,o-l);return{maximumScrollPosition:c,scrollable:!0,thumbOffset:u*(C(n,0,c)/c),thumbSize:l,thumbTravel:u}}var T=[`aria-hidden`],E=[`aria-controls`,`aria-valuemax`,`aria-valuenow`,`tabindex`],D=32,O=40,k=120,A=(0,e.defineComponent)({__name:`GalleryScrollbar`,props:{contentSize:{},controlsId:{},scrollElement:{},suspended:{type:Boolean}},setup(t){let n=t,r={maximumScrollPosition:0,scrollable:!1,thumbOffset:0,thumbSize:0,thumbTravel:0},i=(0,e.shallowRef)(null),a=(0,e.shallowRef)(r),o=(0,e.shallowRef)(!1),s=(0,e.shallowRef)(!1),c=(0,e.shallowRef)(!1),l=null,u=0,d=0,f=null,p=null,m=null,h=null,g=!1,_=null,v=(0,e.computed)(()=>a.value.scrollable&&!n.suspended),y=(0,e.computed)(()=>({height:`${a.value.thumbSize}px`,transform:`translate3d(0, ${a.value.thumbOffset}px, 0)`}));function b(){f!==null&&clearTimeout(f),f=setTimeout(()=>{f=null,o.value||(s.value=!1)},k)}function x(){s.value=!0,b()}function S(){let e=n.scrollElement,t=i.value;return!e||!t?r:w({contentSize:e.scrollHeight,minimumThumbSize:D,scrollPosition:e.scrollTop,trackSize:t.clientHeight,viewportSize:e.clientHeight})}function C(e){if(o.value&&e!==`scroll`){g=!0;return}if(o.value){let e=n.scrollElement;if(!e||a.value.maximumScrollPosition<=0)return;let t=Math.min(1,Math.max(0,e.scrollTop/a.value.maximumScrollPosition));a.value={...a.value,thumbOffset:a.value.thumbTravel*t};return}a.value=S(),!(c.value||p!==null)&&(p=requestAnimationFrame(()=>{p=null,c.value=!0}))}function A(){x(),C(`scroll`)}function j(e){let t=n.scrollElement;t&&(t.scrollTop=Math.min(a.value.maximumScrollPosition,Math.max(0,e)),C(`scroll`))}function M(e){if(!v.value||e.target!==e.currentTarget)return;let t=i.value;if(!t||a.value.thumbTravel<=0)return;e.preventDefault(),x();let n=e.clientY-t.getBoundingClientRect().top-a.value.thumbSize/2;j(Math.min(1,Math.max(0,n/a.value.thumbTravel))*a.value.maximumScrollPosition)}function N(e){v.value&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),l=e.pointerId,u=e.clientY,d=n.scrollElement?.scrollTop??0,o.value=!0,s.value=!0,f!==null&&clearTimeout(f),f=null)}function P(e){if(!o.value||e.pointerId!==l||(e.preventDefault(),a.value.thumbTravel<=0))return;let t=(e.clientY-u)/a.value.thumbTravel*a.value.maximumScrollPosition;j(d+t)}function F(e){!o.value||e.pointerId!==l||(e.currentTarget.releasePointerCapture?.(e.pointerId),l=null,o.value=!1,g&&(g=!1,C(`content`)),b())}function I(e){if(!v.value)return;let t=n.scrollElement?.clientHeight??0,r=n.scrollElement?.scrollTop??0,i=e.key===`ArrowUp`?r-O:e.key===`ArrowDown`?r+O:e.key===`PageUp`?r-t:e.key===`PageDown`?r+t:e.key===`Home`?0:e.key===`End`?a.value.maximumScrollPosition:null;i!==null&&(e.preventDefault(),x(),j(i))}function L(e){if(h?.disconnect(),!(typeof ResizeObserver>`u`)){h=new ResizeObserver(()=>C(`content`));for(let t of e.children)h.observe(t)}}return(0,e.watch)(()=>n.scrollElement,(t,n)=>{n?.removeEventListener(`scroll`,A),m?.disconnect(),m=null,h?.disconnect(),h=null,_?.disconnect(),_=null,t?.addEventListener(`scroll`,A,{passive:!0}),t&&typeof ResizeObserver<`u`&&(_=new ResizeObserver(()=>{x(),C(`resize`)}),_.observe(t),L(t)),t&&typeof MutationObserver<`u`&&(m=new MutationObserver(()=>{L(t),C(`content`)}),m.observe(t,{childList:!0})),(0,e.nextTick)(()=>C(`resize`))},{immediate:!0}),(0,e.watch)(()=>n.contentSize,()=>{(0,e.nextTick)(()=>C(`content`))}),(0,e.onBeforeUnmount)(()=>{n.scrollElement?.removeEventListener(`scroll`,A),m?.disconnect(),h?.disconnect(),_?.disconnect(),f!==null&&clearTimeout(f),p!==null&&cancelAnimationFrame(p)}),(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{ref_key:`trackElement`,ref:i,class:(0,e.normalizeClass)([`gallery-scrollbar`,{"gallery-scrollbar--dragging":o.value,"gallery-scrollbar--interacting":s.value,"gallery-scrollbar--ready":c.value,"gallery-scrollbar--visible":v.value}]),"aria-hidden":!v.value||void 0,onPointerdown:M},[(0,e.createElementVNode)(`div`,{class:`gallery-scrollbar-thumb`,"aria-controls":t.controlsId,"aria-label":`Media gallery scroll position`,"aria-orientation":`vertical`,"aria-valuemax":Math.round(a.value.maximumScrollPosition),"aria-valuemin":`0`,"aria-valuenow":Math.round(t.scrollElement?.scrollTop??0),role:`scrollbar`,style:(0,e.normalizeStyle)(y.value),tabindex:v.value?0:-1,onKeydown:I,onPointercancel:F,onPointerdown:N,onPointermove:P,onPointerup:F},null,44,E)],42,T))}}),j=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},M=e=>e===``,N=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),P=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),F=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),I=e=>{let t=F(e);return t.charAt(0).toUpperCase()+t.slice(1)},L={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},R=({name:t,iconNode:n,absoluteStrokeWidth:r,"absolute-stroke-width":i,strokeWidth:a,"stroke-width":o,size:s=L.width,color:c=L.stroke,...l},{slots:u})=>(0,e.h)(`svg`,{...L,...l,width:s,height:s,stroke:c,"stroke-width":M(r)||M(i)||r===!0||i===!0?Number(a||o||L[`stroke-width`])*24/Number(s):a||o||L[`stroke-width`],class:N(`lucide`,l.class,...t?[`lucide-${P(I(t))}-icon`,`lucide-${P(t)}`]:[`lucide-icon`]),...!u.default&&!j(l)&&{"aria-hidden":`true`}},[...n.map(t=>(0,e.h)(...t)),...u.default?[u.default()]:[]]),z=(t,n)=>(r,{slots:i,attrs:a})=>(0,e.h)(R,{...a,...r,iconNode:n,name:t},i),ee=z(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),B=z(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),V=z(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),H=z(`play`,[[`path`,{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`,key:`10ikf1`}]]),te=z(`volume-2`,[[`path`,{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`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),ne=z(`volume-x`,[[`path`,{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`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),re={401:`Authentication required`,403:`Access forbidden`,404:`Preview not found`,419:`Session expired`,500:`Server error`};function U(e){return e.match(/\/demo-errors\/(401|403|404|419|500)\//)?.[1]??`Error`}function W(e){return re[U(e)]??`Preview unavailable`}var G=/\.(aac|flac|m4a|mp3|mp4|mov|ogg|opus|wav|webm)$/i;function ie(e){try{return G.test(new URL(e).pathname)}catch{return G.test(e.split(`?`)[0]??e)}}var K=(0,e.defineComponent)({__name:`CardRegion`,props:{index:{},item:{},layout:{},loadedCount:{},mediaIndex:{},mediaSource:{},placement:{},region:{},total:{}},setup(i){let a=i,o=(0,e.computed)(()=>n(a.item,a.mediaIndex)),s=(0,e.computed)(()=>t(a.item)),c=(0,e.computed)(()=>r(a.item,o.value));return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`media-card-region`,`media-card-${i.placement}`]),style:(0,e.normalizeStyle)({height:`${i.region.height}px`}),onClick:n[0]||=(0,e.withModifiers)(()=>{},[`stop`]),onKeydown:n[1]||=(0,e.withModifiers)(()=>{},[`stop`])},[((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(i.region.component),{index:i.index,item:i.item,layout:i.layout,"loaded-count":i.loadedCount,"media-count":s.value.length,"media-index":o.value,"media-item":c.value,"media-source":i.mediaSource??`preview`,total:i.total},null,8,[`index`,`item`,`layout`,`loaded-count`,`media-count`,`media-index`,`media-item`,`media-source`,`total`]))],38))}}),ae=[`max`,`value`,`aria-valuetext`,`disabled`],oe={key:0,class:`media-controls-row`},se=[`aria-label`,`title`],ce={class:`media-controls-audio`},le=[`aria-label`,`title`],ue=[`value`,`aria-valuetext`],de={class:`media-control-time`,"aria-live":`off`},fe=(0,e.defineComponent)({__name:`MediaControls`,props:{currentTime:{},duration:{},layout:{},muted:{type:Boolean},playing:{type:Boolean},volume:{}},emits:[`seek`,`toggleMute`,`togglePlayback`,`volumeChange`],setup(t,{emit:n}){let r=t,i=n;function a(e,t=1){return Number.isFinite(e)?Math.min(t,Math.max(0,e)):0}function o(e){let t=Math.floor(a(e,2**53-1)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${r}:${String(i).padStart(2,`0`)}`}function s(e){return Number(e.target.value)}let c=(0,e.computed)(()=>Math.max(0,r.duration)),l=(0,e.computed)(()=>a(r.currentTime,c.value)),u=(0,e.computed)(()=>({"--media-range-progress":`${c.value>0?l.value/c.value*100:0}%`})),d=(0,e.computed)(()=>({"--media-range-progress":`${a(r.volume)*100}%`}));return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`media-controls`,`media-controls--${t.layout}`]),"aria-label":`Video controls`,onClick:r[4]||=(0,e.withModifiers)(()=>{},[`stop`]),onDblclick:r[5]||=(0,e.withModifiers)(()=>{},[`stop`]),onKeydown:r[6]||=(0,e.withModifiers)(()=>{},[`stop`]),onWheel:r[7]||=(0,e.withModifiers)(()=>{},[`stop`])},[(0,e.createElementVNode)(`input`,{class:`media-control-range media-control-seek`,type:`range`,min:`0`,max:c.value||0,step:`0.1`,value:l.value,style:(0,e.normalizeStyle)(u.value),"aria-label":`Seek video`,"aria-valuetext":`${o(l.value)} of ${o(c.value)}`,disabled:c.value<=0,onInput:r[0]||=e=>i(`seek`,s(e))},null,44,ae),t.layout===`reel`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,oe,[(0,e.createElementVNode)(`button`,{type:`button`,class:`media-control-button media-control-playback`,"aria-label":t.playing?`Pause video`:`Play video`,title:t.playing?`Pause`:`Play`,onClick:r[1]||=e=>i(`togglePlayback`)},[t.playing?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(V),{key:0,size:18,fill:`currentColor`})):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(H),{key:1,size:18,fill:`currentColor`}))],8,se),(0,e.createElementVNode)(`div`,ce,[(0,e.createElementVNode)(`button`,{type:`button`,class:`media-control-button`,"aria-label":t.muted?`Unmute video`:`Mute video`,title:t.muted?`Unmute`:`Mute`,onClick:r[2]||=e=>i(`toggleMute`)},[t.muted||t.volume===0?((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(ne),{key:0,size:18})):((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(te),{key:1,size:18}))],8,le),(0,e.createElementVNode)(`input`,{class:`media-control-range media-control-volume`,type:`range`,min:`0`,max:`1`,step:`0.05`,value:t.volume,style:(0,e.normalizeStyle)(d.value),"aria-label":`Video volume`,"aria-valuetext":`${Math.round(t.volume*100)} percent`,onInput:r[3]||=e=>i(`volumeChange`,s(e))},null,44,ue)]),(0,e.createElementVNode)(`output`,de,(0,e.toDisplayString)(o(l.value))+` / `+(0,e.toDisplayString)(o(c.value)),1)])):(0,e.createCommentVNode)(``,!0)],34))}}),pe=[`data-post-id`,`data-media-index`,`aria-busy`,`role`,`tabindex`],me={class:`media-card-content`},he=[`data-media-direction`],ge=[`data-media-index`],_e={key:0,"data-test":`media-loading`,class:`media-loading`,"aria-hidden":`true`},ve=[`aria-label`],ye={class:`media-error-code`},be=[`src`,`width`,`height`,`loop`,`muted`,`preload`],xe=[`src`,`width`,`height`,`fetchpriority`],Se=[`aria-label`],Ce=[`aria-label`],we=[`aria-label`],Te=40,Ee=160,De=24,Oe=(0,e.defineComponent)({__name:`MediaCard`,props:{advanceOnMediaEnd:{type:Boolean},cardFooter:{},cardHeader:{},entering:{type:Boolean},fetchPriority:{},index:{},item:{},itemStyle:{},interactive:{type:Boolean},layout:{},loadedCount:{},mediaIndex:{},mediaSource:{},previewState:{},total:{}},emits:[`activate`,`ended`,`error`,`mediaChange`,`ready`],setup(i,{emit:a}){let o=i,s=null,c=0,l=!1,u=null,d=null,f=(0,e.shallowRef)(`next`),p=a;function m(e=!1,t=`pointer`){e&&p(`activate`,t)}let h=(0,e.computed)(()=>t(o.item)),g=(0,e.computed)(()=>n(o.item,o.mediaIndex)),_=(0,e.computed)(()=>r(o.item,g.value)),v=(0,e.computed)(()=>o.mediaSource===`original`?_.value.src:_.value.preview.src),y=(0,e.computed)(()=>o.mediaSource===`original`?_.value.width:_.value.preview.width),b=(0,e.computed)(()=>o.mediaSource===`original`?_.value.height:_.value.preview.height),x=(0,e.shallowRef)(null),S=(0,e.shallowRef)(0),C=(0,e.shallowRef)(0),w=(0,e.shallowRef)(!0),T=(0,e.shallowRef)(!1),E=(0,e.shallowRef)(1),D=1,O=(0,e.computed)(()=>o.interactive&&!!(o.cardHeader||o.cardFooter));function k(e){return e.detail===0?`keyboard`:`pointer`}function A(e,t){let n=h.value.length,r=(e+n)%n;r!==g.value&&(f.value=e<g.value?`previous`:`next`,p(`mediaChange`,r),t&&t.detail>0&&t.currentTarget?.blur())}function j(e,t,n){return t===1?e*16:t===2?e*n:e}function M(){c=0,l=!1,s!==null&&clearTimeout(s),s=null}function N(){s!==null&&clearTimeout(s),s=setTimeout(M,Ee)}function P(e){if(h.value.length<=1)return;let t=e.currentTarget?.clientWidth||1,n=j(e.deltaX,e.deltaMode,t);if(n===0||(e.preventDefault(),N(),l)||(c+=n,Math.abs(c)<De))return;let r=Math.sign(c);c=0,l=!0,A(g.value+r)}function F(e){let t=e.touches[0];o.layout!==`reel`||!t||(u=t.clientX,d=t.clientY)}function I(e){let t=e.changedTouches[0];if(u===null||d===null||!t)return;let n=u-t.clientX,r=d-t.clientY;u=null,d=null,!(Math.abs(n)<=Math.abs(r))&&(Math.abs(n)<Te||A(g.value+Math.sign(n)))}let L=(0,e.computed)(()=>ie(v.value));function R(e){o.layout===`reel`&&(e.stopPropagation(),z())}async function z(){if(x.value){if(T.value){x.value.pause();return}try{await x.value.play()}catch{T.value=!1}}}function V(e){return Number.isFinite(e)?Math.max(0,e):0}function H(e){let t=e?.currentTarget??x.value;t&&(S.value=V(t.currentTime),C.value=V(t.duration),w.value=t.muted,E.value=t.volume,t.volume>0&&(D=t.volume))}function te(e){H(e),p(`ready`,g.value)}function ne(){T.value=!1,p(`ended`,g.value)}function re(e){let t=x.value;!t||!Number.isFinite(e)||(t.currentTime=Math.min(V(t.duration),Math.max(0,e)),S.value=t.currentTime)}function G(e){let t=x.value;if(!t||!Number.isFinite(e))return;let n=Math.min(1,Math.max(0,e));t.volume=n,t.muted=n===0,n>0&&(D=n),H()}function ae(){let e=x.value;e&&(e.muted&&e.volume===0&&(e.volume=D),e.muted=!e.muted,H())}return(0,e.onBeforeUnmount)(()=>{M()}),(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`article`,{"data-post-id":i.item.postId,"data-media-index":g.value,class:(0,e.normalizeClass)([`media-card`,{"media-card--entering":i.entering,"media-card--error":i.previewState===`error`}]),style:(0,e.normalizeStyle)(i.itemStyle),"aria-busy":i.previewState===`loading`,role:i.interactive&&!O.value?`button`:void 0,tabindex:i.interactive&&!O.value?0:void 0,onClick:n[11]||=e=>m(i.interactive&&!O.value,k(e)),onKeydown:[n[12]||=(0,e.withKeys)(e=>m(i.interactive&&!O.value,`keyboard`),[`enter`]),n[13]||=(0,e.withKeys)((0,e.withModifiers)(e=>m(i.interactive&&!O.value,`keyboard`),[`prevent`]),[`space`])]},[(0,e.createElementVNode)(`div`,me,[i.cardHeader?((0,e.openBlock)(),(0,e.createBlock)(K,{key:0,index:i.index,item:i.item,layout:i.layout,"loaded-count":i.loadedCount,"media-index":g.value,"media-source":i.mediaSource,placement:`header`,region:i.cardHeader,total:i.total},null,8,[`index`,`item`,`layout`,`loaded-count`,`media-index`,`media-source`,`region`,`total`])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`media-card-media`,{"media-card-media--carousel":i.layout===`reel`&&h.value.length>1}]),"data-media-direction":f.value,onWheel:P,onTouchstartPassive:F,onTouchendPassive:I},[(0,e.createVNode)(e.Transition,{name:`media-slide-${f.value}`},{default:(0,e.withCtx)(()=>[((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:`${i.item.postId}:${g.value}:${i.mediaSource??`preview`}`,class:`media-card-frame`,"data-media-index":g.value},[i.previewState===`loading`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,_e,[...n[14]||=[(0,e.createElementVNode)(`span`,{class:`media-loading-shimmer`},null,-1)]])):i.previewState===`error`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,"data-test":`media-error`,class:`media-error`,role:`img`,"aria-label":`${(0,e.unref)(U)(v.value)} ${(0,e.unref)(W)(v.value)}`},[(0,e.createElementVNode)(`strong`,ye,(0,e.toDisplayString)((0,e.unref)(U)(v.value)),1),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)((0,e.unref)(W)(v.value)),1)],8,ve)):(0,e.createCommentVNode)(``,!0),L.value?((0,e.openBlock)(),(0,e.createElementBlock)(`video`,{key:2,ref_key:`videoElement`,ref:x,class:(0,e.normalizeClass)([`media-preview`,{"media-preview--ready":i.previewState===`ready`,"media-preview--reel-video":i.layout===`reel`}]),src:v.value,width:y.value??void 0,height:b.value??void 0,autoplay:``,loop:!i.advanceOnMediaEnd,muted:w.value,playsinline:``,preload:i.fetchPriority===`high`?`auto`:`metadata`,onLoadedmetadata:te,onDurationchange:H,onTimeupdate:H,onVolumechange:H,onPlaying:n[0]||=e=>T.value=!0,onPause:n[1]||=e=>T.value=!1,onEnded:ne,onClick:R,onError:n[2]||=e=>t.$emit(`error`,g.value)},null,42,be)):((0,e.openBlock)(),(0,e.createElementBlock)(`img`,{key:3,class:(0,e.normalizeClass)([`media-preview`,{"media-preview--ready":i.previewState===`ready`}]),src:v.value,width:y.value??void 0,height:b.value??void 0,fetchpriority:i.fetchPriority,alt:``,decoding:`async`,loading:`eager`,onLoad:n[3]||=e=>t.$emit(`ready`,g.value),onError:n[4]||=e=>t.$emit(`error`,g.value)},null,42,xe))],8,ge))]),_:1},8,[`name`]),L.value&&i.previewState===`ready`?((0,e.openBlock)(),(0,e.createBlock)(fe,{key:0,"current-time":S.value,duration:C.value,layout:i.layout,muted:w.value,playing:T.value,volume:E.value,onSeek:re,onToggleMute:ae,onTogglePlayback:z,onVolumeChange:G},null,8,[`current-time`,`duration`,`layout`,`muted`,`playing`,`volume`])):(0,e.createCommentVNode)(``,!0),h.value.length>1?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:(0,e.normalizeClass)([`media-carousel-controls`,{"media-carousel-controls--persistent":i.layout===`reel`}]),"aria-label":`Media navigation`},[(0,e.createElementVNode)(`button`,{type:`button`,class:`media-carousel-control media-carousel-control--previous`,"aria-label":`Previous media for post ${i.item.postId}`,onClick:n[5]||=(0,e.withModifiers)(e=>A(g.value-1,e),[`stop`]),onKeydown:n[6]||=(0,e.withModifiers)(()=>{},[`stop`])},[(0,e.createVNode)((0,e.unref)(ee),{size:20})],40,Se),(0,e.createElementVNode)(`button`,{type:`button`,class:`media-carousel-control media-carousel-control--next`,"aria-label":`Next media for post ${i.item.postId}`,onClick:n[7]||=(0,e.withModifiers)(e=>A(g.value+1,e),[`stop`]),onKeydown:n[8]||=(0,e.withModifiers)(()=>{},[`stop`])},[(0,e.createVNode)((0,e.unref)(B),{size:20})],40,Ce)],2)):(0,e.createCommentVNode)(``,!0),O.value?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:2,class:`media-card-activator`,type:`button`,"aria-label":`Open post ${i.item.postId}`,onClick:n[9]||=(0,e.withModifiers)(e=>t.$emit(`activate`,k(e)),[`stop`]),onKeydown:n[10]||=(0,e.withModifiers)(()=>{},[`stop`])},null,40,we)):(0,e.createCommentVNode)(``,!0)],42,he),i.cardFooter?((0,e.openBlock)(),(0,e.createBlock)(K,{key:1,index:i.index,item:i.item,layout:i.layout,"loaded-count":i.loadedCount,"media-index":g.value,"media-source":i.mediaSource,placement:`footer`,region:i.cardFooter,total:i.total},null,8,[`index`,`item`,`layout`,`loaded-count`,`media-index`,`media-source`,`region`,`total`])):(0,e.createCommentVNode)(``,!0)])],46,pe))}}),ke={class:`masonry-feed-shell`},Ae=[`aria-hidden`,`inert`],je=240,Me=6,Ne=12,Pe=800,Fe=1.5,Ie=(0,e.defineComponent)({__name:`MasonryFeed`,props:{enteringPostIds:{},entryDelays:{},suspended:{type:Boolean},canRetryEnd:{type:Boolean},cardFooter:{},cardHeader:{},feedFooter:{},feedFooterActions:{},hasNext:{type:Boolean},infiniteScroll:{type:Boolean},isLoadingMore:{type:Boolean},items:{},loadMoreLocked:{type:Boolean},mediaIndices:{},nextPageError:{type:Boolean},previewStates:{},state:{},total:{}},emits:[`activate`,`error`,`loadMore`,`mediaChange`,`ready`,`retryEnd`],setup(t,{expose:n,emit:r}){let a=t,o=r,s=(0,e.shallowRef)(null),c=`vibe-masonry-${(0,e.useId)()}`,l=(0,e.shallowRef)(null),u=(0,e.shallowRef)(0),d=(0,e.shallowRef)(Me),f=(0,e.shallowRef)(0),m=(0,e.shallowRef)(0),h=(0,e.shallowRef)(0),g=null,v=null,y=null,C=(0,e.computed)(()=>S(a.items,u.value,{additionalHeight:(a.cardHeader?.height??0)+(a.cardFooter?.height??0),gap:d.value,minColumnWidth:je})),w=(0,e.computed)(()=>({height:`${C.value.height}px`})),T=(0,e.computed)(()=>{let e=Math.max(Pe,m.value*Fe),t={scrollTop:f.value-h.value,viewportHeight:m.value},n=x(C.value.items,{...t,overscan:e}),r=new Set(x(C.value.items,{...t,overscan:0}));return n.flatMap(e=>{let t=a.items[e];return t?[{fetchPriority:r.has(e)?`high`:`low`,index:e,item:t}]:[]})});function E(e){let t=C.value.items[e],n=a.items[e]?.postId;if(!t)return{};let r=n!==void 0&&a.enteringPostIds.has(n)?b({containerHeight:C.value.height,gap:d.value}):0;return{"--masonry-entry-delay":`${n===void 0?0:a.entryDelays.get(n)??0}ms`,top:`${t.y}px`,left:`${t.x}px`,width:`${t.width}px`,height:`${t.height}px`,transform:`translate3d(0, ${r}px, 0)`}}function D(){let e=s.value;if(!e)return;f.value=e.scrollTop,m.value=e.clientHeight;let t=l.value;t&&(h.value=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop)}function O(e){let t=e.ownerDocument.documentElement.clientWidth;u.value=e.clientWidth,d.value=Math.min(Ne,Math.max(Me,t*.0075)),D()}function k(e){let t=e.currentTarget;t&&(f.value=t.scrollTop,!a.loadMoreLocked&&a.infiniteScroll&&_(t)&&o(`loadMore`))}function j(){let e=s.value;!a.loadMoreLocked&&e&&_(e)&&o(`loadMore`)}function M(){return s.value}return(0,e.watch)(l,e=>{g?.disconnect(),g=null,y!==null&&cancelAnimationFrame(y),e&&(O(e),!(typeof ResizeObserver>`u`)&&(g=new ResizeObserver(([t])=>{let n=t?.contentRect.width??e.clientWidth;Math.abs(n-u.value)<.5||(y=requestAnimationFrame(()=>{y=null,O(e)}))}),g.observe(e)))}),(0,e.watch)(s,e=>{v?.disconnect(),v=null,e&&(D(),!(typeof ResizeObserver>`u`)&&(v=new ResizeObserver(D),v.observe(e)))}),(0,e.onBeforeUnmount)(()=>{g?.disconnect(),v?.disconnect(),y!==null&&cancelAnimationFrame(y)}),n({getScrollElement:M,loadIfNearBottom:j}),(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ke,[(0,e.createElementVNode)(`main`,{id:c,ref_key:`galleryElement`,ref:s,class:(0,e.normalizeClass)([`gallery-shell masonry-feed`,{"masonry-feed--suspended":t.suspended}]),"data-layout-mode":`masonry`,"aria-hidden":t.suspended||void 0,inert:t.suspended||void 0,onScrollPassive:k},[(0,e.createElementVNode)(`section`,{ref_key:`masonryElement`,ref:l,class:(0,e.normalizeClass)([`masonry`,{"masonry--ready":u.value>0}]),style:(0,e.normalizeStyle)(w.value),"aria-label":`Media gallery`},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(T.value,({fetchPriority:n,item:r,index:a})=>((0,e.openBlock)(),(0,e.createBlock)(Oe,{key:r.postId,class:`masonry-item`,entering:t.enteringPostIds.has(r.postId),"fetch-priority":n,"card-footer":t.cardFooter,"card-header":t.cardHeader,index:a,item:r,"item-style":E(a),interactive:``,layout:`masonry`,"loaded-count":t.items.length,"media-index":t.mediaIndices.get(r.postId)??0,"preview-state":t.previewStates.get((0,e.unref)(i)(r.postId,t.mediaIndices.get(r.postId)??0))??`loading`,total:t.total,onActivate:e=>o(`activate`,r.postId,e),onMediaChange:e=>o(`mediaChange`,r.postId,e),onReady:e=>o(`ready`,r.postId,e),onError:e=>o(`error`,r.postId,e)},null,8,[`entering`,`fetch-priority`,`card-footer`,`card-header`,`index`,`item`,`item-style`,`loaded-count`,`media-index`,`preview-state`,`total`,`onActivate`,`onMediaChange`,`onReady`,`onError`]))),128))],6),(0,e.createVNode)(p,{actions:t.feedFooterActions,"can-retry-end":t.canRetryEnd,"feed-footer":t.feedFooter,"has-error":t.nextPageError,"has-next":t.hasNext,"infinite-scroll":t.infiniteScroll,"is-loading":t.isLoadingMore,"load-more-locked":t.loadMoreLocked,state:t.state,onLoadMore:r[0]||=e=>o(`loadMore`),onRetryEnd:r[1]||=e=>o(`retryEnd`)},null,8,[`actions`,`can-retry-end`,`feed-footer`,`has-error`,`has-next`,`infinite-scroll`,`is-loading`,`load-more-locked`,`state`])],42,Ae),(0,e.createVNode)(A,{"content-size":C.value.height,"controls-id":c,"scroll-element":s.value,suspended:t.suspended},null,8,[`content-size`,`scroll-element`,`suspended`])]))}}),Le=[`aria-label`],Re=(0,e.defineComponent)({__name:`ReelAutoAdvanceProgress`,props:{durationMs:{},label:{}},emits:[`complete`],setup(t,{emit:n}){let r=t,i=n,a=(0,e.computed)(()=>({"--vibe-reel-auto-advance-duration":`${r.durationMs}ms`}));return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`reel-auto-advance`,"data-test":`reel-auto-advance`,role:`timer`,"aria-label":t.label},[(0,e.createElementVNode)(`span`,{class:`reel-auto-advance-progress`,style:(0,e.normalizeStyle)(a.value),onAnimationend:r[0]||=e=>i(`complete`)},null,36)],8,Le))}}),ze=[`data-active-post-id`,`data-active-media-index`],Be=2,Ve=(0,e.defineComponent)({__name:`ReelFeed`,props:{initialPostId:{},mediaSource:{},reelAutoAdvance:{},canRetryEnd:{type:Boolean},cardFooter:{},cardHeader:{},feedFooter:{},feedFooterActions:{},hasNext:{type:Boolean},infiniteScroll:{type:Boolean},isLoadingMore:{type:Boolean},items:{},loadMoreLocked:{type:Boolean},mediaIndices:{},nextPageError:{type:Boolean},previewStates:{},state:{},total:{}},emits:[`activeChange`,`error`,`loadMore`,`mediaChange`,`ready`,`retryEnd`],setup(n,{expose:a,emit:o}){let s=n,c=o,l=(0,e.shallowRef)(null),u=s.initialPostId===null||s.initialPostId===void 0?-1:s.items.findIndex(e=>e.postId===s.initialPostId),d=(0,e.shallowRef)(Math.max(0,u)),f=(0,e.shallowRef)(!1),m=0,h=null,g=null,v=null,y=(0,e.computed)(()=>({gridTemplateRows:`repeat(${s.items.length}, 100cqh)`})),b=(0,e.computed)(()=>{let e=Math.max(0,d.value-Be),t=Math.min(s.items.length-1,d.value+Be);return s.items.slice(e,t+1).map((t,n)=>({fetchPriority:e+n===d.value?`high`:`low`,index:e+n,item:t}))}),x=(0,e.computed)(()=>s.items[d.value]?.postId),S=(0,e.computed)(()=>s.items[d.value]),C=(0,e.computed)(()=>{let e=x.value;return e===void 0?0:s.mediaIndices.get(e)??0}),w=(0,e.computed)(()=>{let e=x.value;return e===void 0?`loading`:s.previewStates.get(i(e,C.value))??`loading`}),T=(0,e.computed)(()=>{let e=S.value;if(!e)return``;let t=r(e,C.value);return s.mediaSource===`original`?t.src:t.preview.src}),E=(0,e.computed)(()=>w.value===`ready`&&ie(T.value)),D=(0,e.computed)(()=>[x.value,C.value,s.items.length,s.loadMoreLocked,s.reelAutoAdvance.enabled,s.reelAutoAdvance.includePostItems,s.reelAutoAdvance.intervalMs].join(`:`)),O=(0,e.computed)(()=>{let e=S.value,n=!!(e&&s.reelAutoAdvance.includePostItems&&C.value<t(e).length-1),r=s.reelAutoAdvance.intervalMs/1e3;return`Auto advance to the next ${n?`post item`:`post`} in ${r}s`}),k=(0,e.computed)(()=>s.reelAutoAdvance.enabled&&S.value!==void 0&&w.value!==`loading`&&!E.value);function A(e){return{gridRow:`${e+1}`}}function j(e){let t=m||e.clientHeight;return t<=0||s.items.length===0?0:Math.min(s.items.length-1,Math.max(0,Math.round(e.scrollTop/t)))}function M(e){let t=e.currentTarget;t&&(f.value||(d.value=j(t)),!s.loadMoreLocked&&s.infiniteScroll&&_(t)&&c(`loadMore`))}function N(){let e=l.value;e&&(I(!0),m=e.clientHeight,e.scrollTop=d.value*m,g!==null&&cancelAnimationFrame(g),g=requestAnimationFrame(()=>{e.scrollTop=d.value*e.clientHeight,m=e.clientHeight,g=null}),P())}function P(){v!==null&&clearTimeout(v),v=setTimeout(()=>{v=null;let e=l.value;e&&(m=e.clientHeight,e.scrollTop=d.value*m),I(!1)},120)}function F(){I(!0);let e=l.value;e&&(m=e.clientHeight,e.scrollTop=d.value*m),P()}function I(e){f.value=e,l.value?.toggleAttribute(`data-resizing`,e)}function L(){let e=l.value;!s.loadMoreLocked&&e&&_(e)&&c(`loadMore`)}function R(e){let n=S.value;if(!n)return!1;let r=t(n).length;if(r<=1)return!1;let i=(C.value+e+r)%r;return c(`mediaChange`,n.postId,i),!0}function z(e){let t=d.value+e;return!l.value||t<0||t>=s.items.length?!1:(B(t),!0)}function ee(){return typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function B(e){let t=l.value;if(!t)return;let n=e*(m||t.clientHeight);if(d.value=e,!ee()&&typeof t.scrollTo==`function`){t.scrollTo({behavior:`smooth`,top:n});return}t.scrollTop=n}function V(){if(!s.reelAutoAdvance.enabled)return;let e=S.value;if(!e)return;if(s.reelAutoAdvance.includePostItems&&C.value<t(e).length-1){c(`mediaChange`,e.postId,C.value+1);return}let n=d.value+1,r=s.items[n];if(!r){s.hasNext&&!s.loadMoreLocked&&c(`loadMore`);return}s.reelAutoAdvance.includePostItems&&(s.mediaIndices.get(r.postId)??0)!==0&&c(`mediaChange`,r.postId,0),B(n)}function H(e,t){!s.reelAutoAdvance.enabled||e!==x.value||t!==C.value||!E.value||V()}return(0,e.watch)(l,e=>{h?.disconnect(),h=null,e&&(m=e.clientHeight,!(typeof ResizeObserver>`u`)&&(h=new ResizeObserver(N),h.observe(e)))}),(0,e.watch)(()=>s.items.length,async t=>{d.value=Math.min(d.value,Math.max(0,t-1)),await(0,e.nextTick)(),N()}),(0,e.watch)(x,e=>{e!==void 0&&c(`activeChange`,e)},{immediate:!0}),(0,e.onMounted)(()=>{window.addEventListener(`resize`,F),window.addEventListener(`orientationchange`,F),u>=0&&(0,e.nextTick)(N)}),(0,e.onBeforeUnmount)(()=>{window.removeEventListener(`resize`,F),window.removeEventListener(`orientationchange`,F),h?.disconnect(),g!==null&&cancelAnimationFrame(g),v!==null&&clearTimeout(v)}),a({activeIndex:d,activePostId:x,changeActiveMedia:R,loadIfNearBottom:L,moveActivePost:z}),(t,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`main`,{class:(0,e.normalizeClass)([`reel-shell`,{"reel-shell--has-footer":!!n.cardFooter,"reel-shell--has-header":!!n.cardHeader}]),"data-layout-mode":`reel`},[n.cardHeader&&S.value?((0,e.openBlock)(),(0,e.createBlock)(K,{key:0,index:d.value,item:S.value,layout:`reel`,"loaded-count":n.items.length,"media-index":C.value,"media-source":n.mediaSource,placement:`header`,region:n.cardHeader,total:n.total},null,8,[`index`,`item`,`loaded-count`,`media-index`,`media-source`,`region`,`total`])):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{ref_key:`galleryElement`,ref:l,class:`gallery-shell reel-feed`,"data-active-post-id":x.value,"data-active-media-index":C.value,onScrollPassive:M},[(0,e.createElementVNode)(`section`,{class:`reel-track`,style:(0,e.normalizeStyle)(y.value),"aria-label":`Media gallery`},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(b.value,({fetchPriority:t,item:r,index:a})=>((0,e.openBlock)(),(0,e.createBlock)(Oe,{key:r.postId,"advance-on-media-end":s.reelAutoAdvance.enabled&&a===d.value,class:`reel-item`,entering:!1,"fetch-priority":t,index:a,item:r,"item-style":A(a),layout:`reel`,"loaded-count":n.items.length,"media-index":n.mediaIndices.get(r.postId)??0,"media-source":n.mediaSource,"preview-state":n.previewStates.get((0,e.unref)(i)(r.postId,n.mediaIndices.get(r.postId)??0))??`loading`,total:n.total,onMediaChange:e=>c(`mediaChange`,r.postId,e),onEnded:e=>H(r.postId,e),onReady:e=>c(`ready`,r.postId,e),onError:e=>c(`error`,r.postId,e)},null,8,[`advance-on-media-end`,`fetch-priority`,`index`,`item`,`item-style`,`loaded-count`,`media-index`,`media-source`,`preview-state`,`total`,`onMediaChange`,`onEnded`,`onReady`,`onError`]))),128))],4),(0,e.createVNode)(p,{actions:n.feedFooterActions,"can-retry-end":n.canRetryEnd,"feed-footer":n.feedFooter,"has-error":n.nextPageError,"has-next":n.hasNext,"infinite-scroll":n.infiniteScroll,"is-loading":n.isLoadingMore,"load-more-locked":n.loadMoreLocked,state:n.state,onLoadMore:r[0]||=e=>c(`loadMore`),onRetryEnd:r[1]||=e=>c(`retryEnd`)},null,8,[`actions`,`can-retry-end`,`feed-footer`,`has-error`,`has-next`,`infinite-scroll`,`is-loading`,`load-more-locked`,`state`])],40,ze),n.cardFooter&&S.value?((0,e.openBlock)(),(0,e.createBlock)(K,{key:1,index:d.value,item:S.value,layout:`reel`,"loaded-count":n.items.length,"media-index":C.value,"media-source":n.mediaSource,placement:`footer`,region:n.cardFooter,total:n.total},null,8,[`index`,`item`,`loaded-count`,`media-index`,`media-source`,`region`,`total`])):(0,e.createCommentVNode)(``,!0),k.value?((0,e.openBlock)(),(0,e.createBlock)(Re,{key:D.value,"duration-ms":n.reelAutoAdvance.intervalMs,label:O.value,onComplete:V},null,8,[`duration-ms`,`label`])):(0,e.createCommentVNode)(``,!0)],2))}}),He=[`data-info-sheet-open`,`data-info-sheet-mode`],Ue=[`aria-hidden`,`inert`],We={key:0,class:`reel-info-sheet-layer`,"data-test":`reel-info-sheet`},Ge=[`role`,`aria-modal`,`tabindex`,`data-active-post-id`],Ke=(0,e.defineComponent)({__name:`ReelLayout`,props:{infoSheet:{},infoSheetEnabled:{type:Boolean},infoSheetOverlay:{type:Boolean},origin:{},initialPostId:{},mediaSource:{},reelAutoAdvance:{},canRetryEnd:{type:Boolean},cardFooter:{},cardHeader:{},feedFooter:{},feedFooterActions:{},hasNext:{type:Boolean},infiniteScroll:{type:Boolean},isLoadingMore:{type:Boolean},items:{},loadMoreLocked:{type:Boolean},mediaIndices:{},nextPageError:{type:Boolean},previewStates:{},state:{},total:{}},emits:[`activeChange`,`closeInfoSheet`,`error`,`loadMore`,`mediaChange`,`ready`,`retryEnd`],setup(n,{expose:i,emit:a}){let o=n,s=a,c=(0,e.shallowRef)(null),l=(0,e.shallowRef)(null),u=null,d=(0,e.computed)(()=>{let e=o.initialPostId===null||o.initialPostId===void 0?-1:o.items.findIndex(e=>e.postId===o.initialPostId);return Math.max(0,e)}),f=(0,e.computed)(()=>o.items[d.value]),p=(0,e.computed)(()=>{let e=f.value?.postId;return e===void 0?0:o.mediaIndices.get(e)??0}),m=(0,e.computed)(()=>!!(o.infoSheet&&o.infoSheetEnabled&&f.value)),h=(0,e.computed)(()=>{let e=f.value;return e?{close:g,index:d.value,item:e,layout:`reel`,loadedCount:o.items.length,mediaCount:t(e).length,mediaIndex:p.value,mediaItem:r(e,p.value),mediaSource:o.mediaSource??`preview`,origin:o.origin,total:o.total}:null});function g(){s(`closeInfoSheet`)}function _(e){return c.value?.changeActiveMedia(e)??!1}function v(){c.value?.loadIfNearBottom()}function y(e){return c.value?.moveActivePost(e)??!1}function b(e,t){s(`error`,e,t)}function x(e,t){s(`mediaChange`,e,t)}function S(e,t){s(`ready`,e,t)}return(0,e.watch)(()=>({overlay:o.infoSheetOverlay,visible:m.value}),async(t,n)=>{if(t.visible&&!n?.visible){u=document.activeElement instanceof HTMLElement?document.activeElement:null,t.overlay&&(await(0,e.nextTick)(),l.value?.focus({preventScroll:!0}));return}if(!t.visible&&n?.visible&&u?.isConnected){let t=u;u=null,await(0,e.nextTick)(),t.focus({preventScroll:!0})}}),(0,e.onBeforeUnmount)(()=>{u=null}),i({changeActiveMedia:_,loadIfNearBottom:v,moveActivePost:y}),(t,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`section`,{class:(0,e.normalizeClass)([`reel-layout`,`reel-layout--${n.infoSheetOverlay?`overlay`:`layout`}`]),"data-info-sheet-open":m.value||void 0,"data-info-sheet-mode":n.infoSheetOverlay?`overlay`:`layout`},[(0,e.createElementVNode)(`div`,{class:`reel-layout-main`,"aria-hidden":n.infoSheetOverlay&&m.value||void 0,inert:n.infoSheetOverlay&&m.value||void 0},[(0,e.createVNode)(Ve,{ref_key:`reelFeed`,ref:c,"can-retry-end":n.canRetryEnd,"card-footer":n.cardFooter,"card-header":n.cardHeader,"feed-footer":n.feedFooter,"feed-footer-actions":n.feedFooterActions,"has-next":n.hasNext,"infinite-scroll":n.infiniteScroll,"initial-post-id":n.initialPostId,"is-loading-more":n.isLoadingMore,items:n.items,"load-more-locked":n.loadMoreLocked,"media-indices":n.mediaIndices,"media-source":n.mediaSource,"next-page-error":n.nextPageError,"preview-states":n.previewStates,"reel-auto-advance":n.reelAutoAdvance,state:n.state,total:n.total,onActiveChange:r[0]||=e=>s(`activeChange`,e),onError:b,onLoadMore:r[1]||=e=>s(`loadMore`),onMediaChange:x,onReady:S,onRetryEnd:r[2]||=e=>s(`retryEnd`)},null,8,[`can-retry-end`,`card-footer`,`card-header`,`feed-footer`,`feed-footer-actions`,`has-next`,`infinite-scroll`,`initial-post-id`,`is-loading-more`,`items`,`load-more-locked`,`media-indices`,`media-source`,`next-page-error`,`preview-states`,`reel-auto-advance`,`state`,`total`])],8,Ue),(0,e.createVNode)(e.Transition,{name:`vibe-info-sheet`},{default:(0,e.withCtx)(()=>[m.value&&n.infoSheet&&h.value?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,We,[(0,e.createElementVNode)(`aside`,{ref_key:`sheetElement`,ref:l,class:`reel-info-sheet`,role:n.infoSheetOverlay?`dialog`:`complementary`,"aria-label":`Reel information`,"aria-modal":n.infoSheetOverlay?`true`:void 0,tabindex:n.infoSheetOverlay?-1:void 0,"data-active-post-id":f.value?.postId},[((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(n.infoSheet.component),(0,e.normalizeProps)((0,e.guardReactiveProps)(h.value)),null,16))],8,Ge)])):(0,e.createCommentVNode)(``,!0)]),_:1})],10,He))}}),qe=35,Je=(0,e.defineComponent)({__name:`VibeSurface`,props:{canRetryEnd:{type:Boolean},cardFooter:{},cardHeader:{},feedFooter:{},feedFooterActions:{},reelInfoSheet:{},state:{}},emits:[`activeReelChange`,`closeReel`,`loadMore`,`openReel`,`reelInfoSheetChange`,`retryEnd`],setup(t,{expose:r,emit:o}){let s=t,c=o,l=(0,e.shallowRef)(null),u=(0,e.shallowRef)(null),d=(0,e.shallowRef)(null),f=(0,e.shallowRef)(null),p=(0,e.shallowRef)({}),m=(0,e.shallowRef)(!1),h=(0,e.shallowRef)(new Set),_=(0,e.shallowRef)(new Map),v=(0,e.shallowRef)(new Map),y=(0,e.shallowRef)(new Map),b=(0,e.shallowRef)(new Map),x=(0,e.computed)(()=>a(s.state)),S=(0,e.computed)(()=>s.state.reelMediaSource===`original`?b.value:y.value),C=new Set(s.state.items.map(e=>e.postId)),w=null,T=null,E=!1;function D(){return typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function O(){w!==null&&cancelAnimationFrame(w),w=requestAnimationFrame(()=>{w=requestAnimationFrame(()=>{w=null,h.value=new Set})})}function k(e,t,n){let r=i(e,t);y.value.get(r)!==n&&(y.value=new Map(y.value).set(r,n))}function A(e,t,n){let r=i(e,t);b.value.get(r)!==n&&(b.value=new Map(b.value).set(r,n))}function j(e,t){k(e,t,`error`)}function M(e,t){k(e,t,`ready`)}function N(e,t){A(e,t,`error`)}function P(e,t){A(e,t,`ready`)}function F(e,t){if(s.state.reelMediaSource===`original`){N(e,t);return}j(e,t)}function I(e,t){if(s.state.reelMediaSource===`original`){P(e,t);return}M(e,t)}function L(e,t){let r=s.state.items.find(t=>t.postId===e);if(!r)return;let i=n(r,t);(v.value.get(e)??0)!==i&&(v.value=new Map(v.value).set(e,i))}async function R(){await(0,e.nextTick)(),(s.state.layout===`reel`||s.state.reelOrigin===`masonry`?u.value:l.value)?.loadIfNearBottom()}function z(e){return s.state.isLoading||s.state.items.length===0||s.state.layout!==`reel`&&s.state.reelOrigin!==`masonry`?!1:u.value?.changeActiveMedia?.(e)??!1}function ee(e){return s.state.isLoading||s.state.items.length===0||s.state.layout!==`reel`&&s.state.reelOrigin!==`masonry`?!1:u.value?.moveActivePost?.(e)??!1}function B(){return s.state.layout!==`masonry`||s.state.reelOrigin===`masonry`?null:l.value?.getScrollElement?.()??null}function V(t,n){T=t,E=n===`keyboard`,p.value=ne(t),c(`openReel`,t),(0,e.nextTick)(()=>d.value?.focus())}function H(e){let t=f.value?.querySelectorAll(`.masonry-feed [data-post-id]`)??[];return Array.from(t).find(t=>t.dataset.postId===String(e))??null}function te(e,t){let n=H(e),r=n?.querySelector(`.media-card-activator`)??n;r&&(r.classList.toggle(`media-card-focus-silent`,!t),t||r.addEventListener(`blur`,()=>{r.classList.remove(`media-card-focus-silent`)},{once:!0}),r?.focus({preventScroll:!0}))}function ne(e){let t=f.value,n=H(e);if(t===null||n===null)return{};let r=t.getBoundingClientRect(),i=n.getBoundingClientRect();return{"--vibe-reel-origin-top":`${Math.max(0,i.top-r.top)}px`,"--vibe-reel-origin-right":`${Math.max(0,r.right-i.right)}px`,"--vibe-reel-origin-bottom":`${Math.max(0,r.bottom-i.bottom)}px`,"--vibe-reel-origin-left":`${Math.max(0,i.left-r.left)}px`}}function re(){s.state.reelOrigin===`masonry`&&(T??=s.state.activeReelPostId,m.value=!0,c(`closeReel`))}function U(){let t=T,n=E;m.value=!1,T=null,E=!1,p.value={},(0,e.nextTick)(()=>{t!==null&&te(t,n)})}function W(e){let t=s.state.layout===`reel`||s.state.reelOrigin===`masonry`;if(e.key===`Escape`&&s.state.reelOrigin===`masonry`){e.preventDefault(),re();return}if(e.key===`Escape`&&t&&s.state.reelInfoSheet.enabled){e.preventDefault(),c(`reelInfoSheetChange`,!1);return}if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||m.value||s.state.layout!==`reel`&&s.state.reelOrigin!==`masonry`)return;let n=e.target;if(n instanceof HTMLElement&&(n.isContentEditable||[`INPUT`,`SELECT`,`TEXTAREA`].includes(n.tagName)))return;let r=e.key===`ArrowLeft`?-1:e.key===`ArrowRight`?1:0;r!==0&&u.value?.changeActiveMedia?.(r)&&e.preventDefault()}return(0,e.watch)(()=>s.state.items.map(e=>e.postId),e=>{let t=e.filter(e=>!C.has(e));if(C=new Set(e),t.length===0||D())return;let n=new Map;e.forEach(e=>{let t=_.value.get(e);t!==void 0&&n.set(e,t)}),t.forEach((e,t)=>{n.set(e,t*qe)}),_.value=n,h.value=new Set([...h.value,...t]),O()},{flush:`sync`}),(0,e.onMounted)(()=>window.addEventListener(`keydown`,W)),(0,e.onBeforeUnmount)(()=>{window.removeEventListener(`keydown`,W),w!==null&&cancelAnimationFrame(w)}),r({changeActiveReelMedia:z,getAutoScrollElement:B,loadIfNearBottom:R,moveActiveReelPost:ee}),(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{ref_key:`surfaceElement`,ref:f,class:`vibe-surface`},[t.state.error||t.state.isLoading||t.state.items.length===0?((0,e.openBlock)(),(0,e.createBlock)(g,{key:0,actions:t.feedFooterActions,"can-retry-end":t.canRetryEnd,"feed-footer":t.feedFooter,state:x.value,onLoadMore:r[0]||=e=>c(`loadMore`),onRetryEnd:r[1]||=e=>c(`retryEnd`)},null,8,[`actions`,`can-retry-end`,`feed-footer`,`state`])):t.state.layout===`reel`?((0,e.openBlock)(),(0,e.createBlock)(Ke,{key:1,ref_key:`reelRenderer`,ref:u,"can-retry-end":t.canRetryEnd,"has-next":t.state.next!==null,"card-footer":t.cardFooter,"card-header":t.cardHeader,"feed-footer":t.feedFooter,"feed-footer-actions":t.feedFooterActions,"infinite-scroll":t.state.infiniteScroll,"is-loading-more":t.state.isLoadingMore,items:t.state.items,"load-more-locked":t.state.loadMoreLocked,"media-source":t.state.reelMediaSource,"media-indices":v.value,"initial-post-id":t.state.activeReelPostId,"info-sheet":t.reelInfoSheet,"info-sheet-enabled":t.state.reelInfoSheet.enabled,"info-sheet-overlay":t.state.reelInfoSheetOverlay,"next-page-error":!!t.state.nextPageError,origin:`reel`,"preview-states":S.value,"reel-auto-advance":t.state.reelAutoAdvance,state:x.value,total:t.state.total,onActiveChange:r[2]||=e=>c(`activeReelChange`,e),onCloseInfoSheet:r[3]||=e=>c(`reelInfoSheetChange`,!1),onError:F,onLoadMore:r[4]||=e=>c(`loadMore`),onMediaChange:L,onReady:I,onRetryEnd:r[5]||=e=>c(`retryEnd`)},null,8,[`can-retry-end`,`has-next`,`card-footer`,`card-header`,`feed-footer`,`feed-footer-actions`,`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`,`state`,`total`])):((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:2},[(0,e.createVNode)(Ie,{ref_key:`masonryRenderer`,ref:l,"can-retry-end":t.canRetryEnd,"entering-post-ids":h.value,"entry-delays":_.value,"card-footer":t.cardFooter,"card-header":t.cardHeader,"feed-footer":t.feedFooter,"feed-footer-actions":t.feedFooterActions,"has-next":t.state.next!==null,"infinite-scroll":t.state.infiniteScroll,"is-loading-more":t.state.isLoadingMore,items:t.state.items,"load-more-locked":t.state.loadMoreLocked,"media-indices":v.value,"next-page-error":!!t.state.nextPageError,"preview-states":y.value,suspended:t.state.reelOrigin===`masonry`||m.value,state:x.value,total:t.state.total,onActivate:V,onError:j,onLoadMore:r[6]||=e=>c(`loadMore`),onMediaChange:L,onReady:M,onRetryEnd:r[7]||=e=>c(`retryEnd`)},null,8,[`can-retry-end`,`entering-post-ids`,`entry-delays`,`card-footer`,`card-header`,`feed-footer`,`feed-footer-actions`,`has-next`,`infinite-scroll`,`is-loading-more`,`items`,`load-more-locked`,`media-indices`,`next-page-error`,`preview-states`,`suspended`,`state`,`total`]),(0,e.createVNode)(e.Transition,{name:`vibe-reel-viewer`,onAfterLeave:U},{default:(0,e.withCtx)(()=>[t.state.reelOrigin===`masonry`?((0,e.openBlock)(),(0,e.createElementBlock)(`section`,{key:0,ref_key:`reelOverlay`,ref:d,class:`vibe-reel-overlay`,role:`dialog`,"aria-label":`Media viewer`,"aria-modal":`true`,tabindex:`-1`,style:(0,e.normalizeStyle)(p.value)},[(0,e.createVNode)(Ke,{ref_key:`reelRenderer`,ref:u,"can-retry-end":t.canRetryEnd,"card-footer":t.cardFooter,"card-header":t.cardHeader,"feed-footer":t.feedFooter,"feed-footer-actions":t.feedFooterActions,"has-next":t.state.next!==null,"infinite-scroll":t.state.infiniteScroll,"initial-post-id":t.state.activeReelPostId,"info-sheet":t.reelInfoSheet,"info-sheet-enabled":t.state.reelInfoSheet.enabled,"info-sheet-overlay":t.state.reelInfoSheetOverlay,"is-loading-more":t.state.isLoadingMore,items:t.state.items,"load-more-locked":t.state.loadMoreLocked,"media-indices":v.value,"media-source":`original`,"next-page-error":!!t.state.nextPageError,origin:`masonry`,"preview-states":b.value,"reel-auto-advance":t.state.reelAutoAdvance,state:x.value,total:t.state.total,onActiveChange:r[8]||=e=>c(`activeReelChange`,e),onCloseInfoSheet:r[9]||=e=>c(`reelInfoSheetChange`,!1),onError:N,onLoadMore:r[10]||=e=>c(`loadMore`),onMediaChange:L,onReady:P,onRetryEnd:r[11]||=e=>c(`retryEnd`)},null,8,[`can-retry-end`,`card-footer`,`card-header`,`feed-footer`,`feed-footer-actions`,`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`,`state`,`total`])],4)):(0,e.createCommentVNode)(``,!0)]),_:1})],64))],512))}});function Ye(e){if(!e||typeof e!=`object`||!Array.isArray(e.items))throw TypeError(`Vibe loadPage must resolve to a page with an items array.`);if(e.next!==null&&typeof e.next!=`string`&&typeof e.next!=`number`)throw TypeError(`Vibe page next must be a string, number, or null.`);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.`);return e}function q(e,t){let n=new Set(e.map(e=>e.postId));return[...e,...t.filter(e=>n.has(e.postId)?!1:(n.add(e.postId),!0))]}var Xe=2e3,Ze=1e4,Qe=250,J={delayRemainingMs:null,nextRequestAt:null};function $e(e,t){return e===void 0?t:Math.floor(e)}function et(e,t){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.`)}function tt(e,t={}){let n=$e(t.delayStepMs,Xe),r=$e(t.delayMaxMs,Ze);return Math.min(Math.max(0,e)*n,r)}function Y(e){if(e==null||!Number.isFinite(e))return{...J};let t=Math.max(0,Math.floor(e-Date.now()));return t>0?{delayRemainingMs:t,nextRequestAt:e}:{...J}}async function nt({delayMs:e,onChange:t,signal:n}){if(n.aborted)throw new DOMException(`Aborted`,`AbortError`);if(e<=0){t({...J});return}let r=Date.now()+e;t({delayRemainingMs:e,nextRequestAt:r}),await new Promise((i,a)=>{let o=!1,s=setInterval(f,Qe),c=setTimeout(()=>u(),e);function l(){clearInterval(s),clearTimeout(c),n.removeEventListener(`abort`,d),t({...J})}function u(e){o||(o=!0,l(),e?a(e):i())}function d(){u(new DOMException(`Aborted`,`AbortError`))}function f(){let e=Y(r);t(e),e.delayRemainingMs===null&&u()}n.addEventListener(`abort`,d,{once:!0})})}var rt=class{interval=null;constructor(e){this.onChange=e}clear(){this.interval!==null&&clearInterval(this.interval),this.interval=null,this.onChange({...J})}sync(e){this.clear();let t=Y(e);this.onChange(t),t.delayRemainingMs!==null&&(this.interval=setInterval(()=>{let t=Y(e);this.onChange(t),t.delayRemainingMs===null&&this.clear()},Qe))}};function it(e,t=!0){return e.maxAdditionalPages===`unlimited`?1/0:(e.maxAdditionalPages??10)+(t?1:0)}function at(e){return`${typeof e}:${String(e)}`}function ot(e,t){if(!Number.isInteger(e)||e<=0)throw TypeError(`Vibe ${t} must be a positive integer.`)}function st(e){if(!e)return;if(ot(e.pageSize,`autofill pageSize`),e.strategy===`frontend`){et(e,`frontend autofill`);let t=e.maxAdditionalPages;if(t!==void 0&&t!==`unlimited`&&(!Number.isInteger(t)||t<0))throw TypeError(`Vibe autofill maxAdditionalPages must be a non-negative integer or "unlimited".`);return}if(!e.feedKey.trim())throw TypeError(`Vibe backend autofill requires a feedKey.`);let t=e.initialSession;if(t){if(t.feedKey!==e.feedKey)throw TypeError(`Vibe backend autofill initialSession feedKey must match autofill feedKey.`);if(t.pageSize!==e.pageSize)throw TypeError(`Vibe backend autofill initialSession pageSize must match autofill pageSize.`)}}function X(e,t,n=!0){if(!e)return{cycleId:null,delayRemainingMs:null,enabled:!1,error:null,feedKey:null,missing:0,nextRequestAt:null,pageSize:null,received:0,requests:0,sequence:0,sessionId:null,status:`idle`,strategy:null};let r=e.strategy===`backend`?t??(n?e.initialSession:void 0):void 0,i=r?.received??0,a=Y(r?.nextRequestAt);return{cycleId:r?.cycleId??null,...a,enabled:!0,error:r?.error??null,feedKey:e.strategy===`backend`?e.feedKey:null,missing:Math.max(0,e.pageSize-i),pageSize:e.pageSize,received:i,requests:r?.requests??0,sequence:r?.sequence??0,sessionId:r?.sessionId??null,status:r?r.status:`idle`,strategy:e.strategy}}function Z(e){return[`cancelling`,`filling`,`restoring`,`waiting`].includes(e.status)}async function ct(e,t,n){let r=t.autofill;if(!Z(r)||!r.cycleId)return;let i={cycleId:r.cycleId,feedKey:r.feedKey??``,sessionId:r.sessionId};n(),r.status=`cancelling`;try{e?.strategy===`backend`&&await e.onCancel(i),r.error=null,r.status=`cancelled`}catch(e){throw r.error=e,r.status=`error`,e}}function lt(e,t,n){return e?.strategy===`backend`&&t.feedKey===e.feedKey&&t.sessionId===n.sessionId}async function ut({existingItems:e,initialCursor:t,loadPage:n,maximumRequests:r,onDelayChange:i,onProgress:a,options:o,receivedOffset:s=0,requestOffset:c=0,signal:l}){let u=[],d=[...e],f=new Set,p=r??it(o),m=t,h=t,g=0,_;for(;g<p;){let e=at(m);if(f.has(e))throw Error(`Vibe autofill received a repeated cursor.`);f.add(e),await nt({delayMs:tt(c+g,o),onChange:i,signal:l});let t=Ye(await n({cursor:m,signal:l}));g+=1;let r=q(d,t.items).slice(d.length);d.push(...r),u.push(...r),h=t.next,t.total!==void 0&&(_=t.total);let p={missing:Math.max(0,o.pageSize-s-u.length),next:h,received:s+u.length,requests:c+g};if(a(p),p.missing===0)return{...p,items:u,lastCursor:m,status:`complete`,total:_};if(h===null)return{...p,items:u,lastCursor:m,status:`exhausted`,total:_};m=h}return{items:u,lastCursor:m,missing:Math.max(0,o.pageSize-s-u.length),next:h,received:s+u.length,requests:c+g,status:`exhausted`,total:_}}var dt=100;function Q(e,t){if(!Number.isFinite(t)||t<=0)throw TypeError(`Vibe ${e} must be a positive number.`)}function ft(e,t,n){return Math.min(n,Math.max(t,e))}function pt(e){if(!e)return;let t=e.minSpeedPxPerSecond??20,n=e.maxSpeedPxPerSecond??240;if(Q(`autoScroll.minSpeedPxPerSecond`,t),Q(`autoScroll.maxSpeedPxPerSecond`,n),t>n)throw TypeError(`Vibe autoScroll.minSpeedPxPerSecond cannot exceed maxSpeedPxPerSecond.`);e.speedPxPerSecond!==void 0&&Q(`autoScroll.speedPxPerSecond`,e.speedPxPerSecond)}function mt(e){let t=e?.minSpeedPxPerSecond??20,n=e?.maxSpeedPxPerSecond??240;return{enabled:e?.enabled??!1,maxSpeedPxPerSecond:n,minSpeedPxPerSecond:t,paused:!1,speedPxPerSecond:ft(e?.speedPxPerSecond??80,t,n)}}var ht=class{frame=null;lastTimestamp=null;mounted=!1;constructor(e){this.options=e}mount(){this.mounted=!0,this.schedule()}destroy(){this.mounted=!1,this.cancelFrame()}setEnabled(e,t){t!==void 0&&this.setSpeed(t),this.options.state.enabled=e,this.options.state.paused=!1,this.lastTimestamp=null,e?this.schedule():this.cancelFrame()}setPaused(e){this.options.state.enabled&&(this.options.state.paused=e,this.lastTimestamp=null,e?this.cancelFrame():this.schedule())}setSpeed(e){Q(`auto-scroll speed`,e);let t=this.options.state;t.speedPxPerSecond=ft(e,t.minSpeedPxPerSecond,t.maxSpeedPxPerSecond)}tick=e=>{this.frame=null;let t=this.options.state;if(!this.mounted||!t.enabled)return;let n=t.paused?null:this.options.getScrollElement();if(!n){this.lastTimestamp=null,this.schedule();return}if(this.lastTimestamp!==null){let r=Math.min(dt,Math.max(0,e-this.lastTimestamp)),i=Math.max(0,n.scrollHeight-n.clientHeight);n.scrollTop=Math.min(i,n.scrollTop+t.speedPxPerSecond*r/1e3)}this.lastTimestamp=e,this.schedule()};schedule(){!this.mounted||!this.options.state.enabled||this.frame!==null||typeof requestAnimationFrame==`function`&&(this.frame=requestAnimationFrame(this.tick))}cancelFrame(){this.frame!==null&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(this.frame),this.frame=null,this.lastTimestamp=null}};async function gt(e,t,n,r){let i=await e.onUnderfilled(n);if(!r())return;if(!i.sessionId.trim())throw TypeError(`Vibe backend autofill requires a sessionId.`);let a=Math.max(n.received,i.received??n.received);Object.assign(t.autofill,{...Y(i.nextRequestAt),missing:Math.max(0,e.pageSize-a),received:a,sequence:i.sequence??0,sessionId:i.sessionId,status:`waiting`})}function _t(e,t){[`complete`,`exhausted`].includes(t.status)&&t.items&&(e.items=q(e.items,t.items)),t.next!==void 0&&(e.next=t.next),t.total!==void 0&&(e.total=t.total)}function vt(e,t,n){let r=t.autofill;return!lt(e,n,r)||n.sequence<=r.sequence||[`cancelled`,`cancelling`].includes(r.status)||[`complete`,`exhausted`].includes(n.status)&&n.next===void 0?!1:(_t(t,n),Object.assign(r,Y(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)}function yt(e,t,n){return e?.strategy!==`backend`||n.feedKey!==e.feedKey||n.pageSize!==e.pageSize?!1:(t.autofill=X(e,n),_t(t,n),!0)}var bt=1.5;function xt(e){let t=Math.min(e.screenWidth,e.screenHeight);if(t>0&&t<600)return!0;let n=Math.min(e.viewportWidth,e.viewportHeight),r=t>=n*bt;return!e.hasHover&&n>0&&n<600&&r}function St(e){return xt(e)?`reel`:`masonry`}function Ct(e){let t=e.ownerDocument.defaultView,n=e.ownerDocument.documentElement;return{hasHover:typeof t?.matchMedia==`function`&&t.matchMedia(`(hover: hover)`).matches,screenHeight:t?.screen.height??0,screenWidth:t?.screen.width??0,viewportHeight:n.clientHeight,viewportWidth:n.clientWidth}}function wt(e){return xt(Ct(e))}function Tt(e){return St(Ct(e))}async function Et({cycleId:e,isCurrent:t,onLastCursor:n,options:r,signal:i,state:a}){let o=r.autofill;if(!o)return;let s=a.items.length;if(Object.assign(a.autofill,{missing:Math.max(0,o.pageSize-s),received:s,requests:1}),s>=o.pageSize){a.autofill.status=`complete`;return}if(o.strategy===`backend`){await gt(o,a,{cycleId:e,feedKey:o.feedKey,items:[...a.items],missing:o.pageSize-s,next:a.next,pageSize:o.pageSize,received:s,signal:i,total:a.total},t);return}if(!r.loadPage||a.next===null){a.autofill.status=`exhausted`;return}let c=await ut({existingItems:a.items,initialCursor:a.next,loadPage:r.loadPage,maximumRequests:it(o,!1),onDelayChange:e=>{t()&&Object.assign(a.autofill,e)},onProgress:e=>{t()&&Object.assign(a.autofill,e,{status:`filling`})},options:o,receivedOffset:s,requestOffset:1,signal:i});t()&&(a.items=q(a.items,c.items),a.next=c.next,c.total!==void 0&&(a.total=c.total),n(c.lastCursor),Object.assign(a.autofill,{missing:c.missing,received:c.received,requests:c.requests,status:c.status}))}function Dt(e){return`pages`in e?{pages:e.pages}:{until:`end`}}function Ot(e){return`${typeof e}:${String(e)}`}function kt(e){if(!e||typeof e!=`object`)throw TypeError(`Vibe fill target must be an object.`);if(`pages`in e){if(!Number.isInteger(e.pages)||e.pages<=0)throw TypeError(`Vibe fill pages must be a positive integer.`);return{pages:e.pages}}if(`until`in e&&e.until===`end`)return{until:`end`};throw TypeError(`Vibe fill target must be { pages } or { until: 'end' }.`)}function At(e){if(!e)return;if(e.strategy===`frontend`){et(e,`frontend fill`);return}if(!e.feedKey.trim())throw TypeError(`Vibe backend fill requires a feedKey.`);let t=e.initialSession;if(t){if(t.feedKey!==e.feedKey)throw TypeError(`Vibe backend fill initialSession feedKey must match fill feedKey.`);kt(t.target)}}function $(e,t,n=!0){let r=e?.strategy===`backend`&&n?e.initialSession:void 0,i=t??r,a=Y(i?.nextRequestAt);return{completedPages:i?.completedPages??0,cycleId:i?.cycleId??null,...a,enabled:!!e,error:i?.error??null,feedKey:e?.strategy===`backend`?e.feedKey:null,received:i?.received??0,sequence:i?.sequence??0,sessionId:i?.sessionId??null,status:i?.status??`idle`,strategy:e?.strategy??null,target:i?Dt(i.target):null}}function jt(e){return[`cancelling`,`filling`,`restoring`,`waiting`].includes(e.status)}async function Mt({existingItems:e,initialCursor:t,loadPage:n,onDelayChange:r,onProgress:i,options:a,signal:o,target:s}){let c=[],l=[...e],u=new Set,d=0,f=t,p=t,m=0,h;for(;p!==null;){let e=Ot(f);if(u.has(e))throw Error(`Vibe fill received a repeated cursor.`);u.add(e),await nt({delayMs:tt(d,a),onChange:r,signal:o});let t=Ye(await n({cursor:f,signal:o}));d+=1;let g=q(l,t.items).slice(l.length);if(l.push(...g),c.push(...g),m=c.length,p=t.next,t.total!==void 0&&(h=t.total),i({completedPages:d,next:p,received:m}),`pages`in s&&d>=s.pages)return{completedPages:d,items:c,lastCursor:f,next:p,received:m,status:`complete`,total:h};if(p===null)return{completedPages:d,items:c,lastCursor:f,next:p,received:m,status:`pages`in s?`exhausted`:`complete`,total:h};f=p}return{completedPages:d,items:c,lastCursor:f,next:null,received:m,status:`pages`in s?`exhausted`:`complete`,total:h}}async function Nt(e,t,n,r){let i=await e.onStart(n);if(r()){if(!i.sessionId.trim())throw TypeError(`Vibe backend fill requires a sessionId.`);Object.assign(t.fill,{...Y(i.nextRequestAt),completedPages:i.completedPages??0,received:i.received??0,sequence:i.sequence??0,sessionId:i.sessionId,status:`waiting`})}}function Pt(e,t,n){return e?.strategy===`backend`&&n.feedKey===e.feedKey&&n.sessionId===t.fill.sessionId}function Ft(e){return Number.isInteger(e.completedPages)&&e.completedPages>=0&&Number.isInteger(e.received)&&e.received>=0&&Number.isInteger(e.sequence)&&e.sequence>=0}function It(e,t){if(![`complete`,`exhausted`].includes(t.status))return!0;let n=e.fill.target;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}function Lt(e,t,n){t.total!==void 0&&(e.total=t.total),[`complete`,`exhausted`].includes(t.status)&&(e.items=q(e.items,t.items??[]),e.next=t.next??null,n(t.lastCursor??null))}function Rt(e,t,n,r){return!Pt(e,t,n)||!Ft(n)||n.sequence<=t.fill.sequence||[`cancelled`,`cancelling`].includes(t.fill.status)||!It(t,n)?!1:(Lt(t,n,r),Object.assign(t.fill,{...Y(n.status===`waiting`?n.nextRequestAt:null),completedPages:n.completedPages,error:n.error??null,received:n.received,sequence:n.sequence,status:n.status}),!0)}function zt(e,t,n,r){if(e?.strategy!==`backend`||n.feedKey!==e.feedKey)return!1;let i=t.fill;return t.fill=$(e,n),!Ft(n)||!It(t,n)?(t.fill=i,!1):(Lt(t,n,r),!0)}var Bt=class{abortController=null;cycle=0;delayCountdown;requestVersion=0;constructor(e){this.options=e,this.delayCountdown=new rt(e=>{Object.assign(this.options.state.fill,e)}),this.syncBackendCountdown()}isActive(){return jt(this.options.state.fill)}applyUpdate(e){let t=Rt(this.options.fill,this.options.state,e,this.options.onLastCursor);return t&&this.syncBackendCountdown(),t}restoreSession(e){let t=zt(this.options.fill,this.options.state,e,this.options.onLastCursor);return t&&this.syncBackendCountdown(),t}async start(e){let t=this.options.fill;if(!t)throw Error(`Vibe fill is not configured.`);if(this.isActive())throw Error(`Vibe fill is already active.`);let n=kt(e),r=`vibe-fill-${Date.now().toString(36)}-${++this.cycle}`;if(this.options.state.fill={...$(t,void 0,!1),cycleId:r,status:`filling`,target:n},this.options.state.next===null){this.options.state.fill.status=`pages`in n?`exhausted`:`complete`;return}let i=++this.requestVersion,a=new AbortController;this.abortController=a;try{t.strategy===`frontend`?await this.startFrontend(t,n,a,i):(await Nt(t,this.options.state,{cycleId:r,feedKey:t.feedKey,items:[...this.options.state.items],next:this.options.state.next,signal:a.signal,target:n,total:this.options.state.total},()=>this.isCurrent(i)),this.syncBackendCountdown())}catch(e){if(a.signal.aborted||!this.isCurrent(i))return;throw this.options.state.fill.error=e,this.options.state.fill.status=`error`,e}finally{this.isCurrent(i)&&(this.abortController=null,this.options.state.isLoadingMore=!1)}}async cancel(){let{fill:e,state:t}=this.options;if(!jt(t.fill)||!t.fill.cycleId)return;let n={cycleId:t.fill.cycleId,feedKey:t.fill.feedKey??``,sessionId:t.fill.sessionId};t.fill.status=`cancelling`,this.delayCountdown.clear(),this.abortController?.abort(),this.requestVersion+=1,this.abortController=null,t.isLoadingMore=!1;try{e?.strategy===`backend`&&await e.onCancel(n),t.fill.error=null,t.fill.status=`cancelled`}catch(e){throw t.fill.error=e,t.fill.status=`error`,e}}reset(){this.abortLocalRequest(),this.delayCountdown.clear(),this.options.state.fill=$(this.options.fill,void 0,!1)}destroy(){this.abortLocalRequest(),this.delayCountdown.clear()}abortLocalRequest(){this.requestVersion+=1,this.abortController?.abort(),this.abortController=null,this.options.state.isLoadingMore=!1}isCurrent(e){return e===this.requestVersion&&![`cancelled`,`cancelling`].includes(this.options.state.fill.status)}async startFrontend(e,t,n,r){let i=this.options.loadPage;if(!i)throw Error(`Vibe frontend fill requires loadPage.`);let a=this.options.state;a.isLoadingMore=!0;let o=await Mt({existingItems:a.items,initialCursor:a.next,loadPage:i,onDelayChange:e=>{this.isCurrent(r)&&Object.assign(a.fill,e)},onProgress:e=>{this.isCurrent(r)&&Object.assign(a.fill,e)},options:e,signal:n.signal,target:t});this.isCurrent(r)&&(a.items=q(a.items,o.items),a.next=o.next,o.total!==void 0&&(a.total=o.total),this.options.onLastCursor(o.lastCursor),Object.assign(a.fill,{completedPages:o.completedPages,received:o.received,status:o.status}))}syncBackendCountdown(){let e=this.options.state.fill;this.delayCountdown.sync(e.strategy===`backend`&&e.status===`waiting`?e.nextRequestAt:null)}};function Vt(e){return{cancelAutofill:()=>e.cancelAutofill(),loadMore:()=>e.loadNext(),retry:()=>e.reload(),retryEnd:()=>e.retryEnd()}}function Ht(e){if(!Number.isFinite(e)||e<=0)throw TypeError(`Vibe reelAutoAdvance.intervalMs must be a positive number.`)}function Ut(e){e?.intervalMs!==void 0&&Ht(e.intervalMs)}function Wt(e){return{enabled:e?.enabled??!1,includePostItems:e?.includePostItems??!1,intervalMs:e?.intervalMs??5e3}}function Gt(e,t){if(typeof t==`boolean`){e.enabled=t;return}Ut(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)}function Kt(e){return{enabled:e?.enabled??!1}}function qt(e,t,n){if(n&&!t)throw Error(`Vibe cannot enable reelInfoSheet without a configured component.`);e.enabled=n}function Jt(e,t){let n=e.initialPage;return{activeReelPostId:null,autoScroll:mt(e.autoScroll),autofill:X(e.autofill),error:null,fill:$(e.fill),infiniteScroll:e.infiniteScroll??!0,isLoading:!n,isLoadingMore:!1,items:n?q([],n.items):[],layout:t===`reel`?`reel`:`masonry`,loadMoreLocked:!1,next:n?.next??null,nextPageError:null,reelAutoAdvance:Wt(e.reelAutoAdvance),reelInfoSheet:Kt(e.reelInfoSheet),reelInfoSheetOverlay:!1,reelMediaSource:`original`,reelOrigin:null,total:n?.total??null}}function Yt(e,t){if(t&&(!Number.isFinite(t.height)||t.height<=0))throw TypeError(`Vibe ${e} height must be a positive number.`)}function Xt(e){if(pt(e.autoScroll),Yt(`cardHeader`,e.cardHeader),Yt(`cardFooter`,e.cardFooter),st(e.autofill),At(e.fill),Ut(e.reelAutoAdvance),!e.initialPage&&!e.loadPage)throw TypeError(`Vibe requires either initialPage or loadPage.`);if(e.initialPage?.next!==null&&!e.loadPage)throw TypeError(`Vibe requires loadPage when initialPage has a next cursor.`);if(e.fill?.strategy===`frontend`&&!e.loadPage)throw TypeError(`Vibe frontend fill requires loadPage.`);if(e.fill?.strategy===`backend`&&e.fill.initialSession&&!e.initialPage)throw TypeError(`Vibe backend fill restoration requires initialPage.`)}function Zt(e){if(typeof e!=`string`)return e;if(typeof document>`u`)throw Error(`Vibe cannot resolve a selector without a document.`);let t=document.querySelector(e);if(!t)throw Error(`Vibe target not found: ${e}`);return t}var Qt=class{routedReelPostId=null;reelRouteIsActive=!1;constructor(e,t){this.options=e,this.state=t}syncFeed(){if(!this.options||!this.reelRouteIsActive)return;this.reelRouteIsActive=!1,this.routedReelPostId=null;let e=typeof this.options.feed==`function`?this.options.feed():this.options.feed;this.options.router.replace(e)}syncReel(e){if(!this.options)return;let t=this.state.items.findIndex(t=>t.postId===e),n=this.state.items[t];if(!n||this.reelRouteIsActive&&this.routedReelPostId===e)return;let r=this.options.reel({index:t,item:n,loadedCount:this.state.items.length,origin:this.state.reelOrigin??`reel`,total:this.state.total});if(r===null)return;let i=this.reelRouteIsActive?`replace`:`push`;this.reelRouteIsActive=!0,this.routedReelPostId=e,this.options.router[i](r)}},$t=class{app=null;autoScroll;autofillDelayCountdown;autofillCycle=0;abortController=null;pendingRequest=null;requestVersion=0;resizeObserver=null;routing;fillController;surface=null;stopStateWatcher=null;target=null;layoutMode;lastLoadedCursor=null;state;constructor(t){this.options=t,Xt(t),this.layoutMode=t.layout??`masonry`,this.state=(0,e.reactive)(Jt(t,this.layoutMode)),this.autoScroll=new ht({getScrollElement:()=>this.surface?.getAutoScrollElement()??null,state:this.state.autoScroll}),this.autofillDelayCountdown=new rt(e=>Object.assign(this.state.autofill,e)),this.syncAutofillCountdown(),this.fillController=new Bt({fill:t.fill,loadPage:t.loadPage,onLastCursor:e=>{this.lastLoadedCursor=e},state:this.state}),this.routing=new Qt(t.routing,this.state),this.startStateNotifications()}async mount(){if(this.app)throw Error(`Vibe is already mounted.`);this.startStateNotifications();let t=Zt(this.options.target);this.target=t,this.startResponsiveLayout(),this.app=(0,e.createApp)(Je,{canRetryEnd:!!this.options.loadPage,cardFooter:this.options.cardFooter,cardHeader:this.options.cardHeader,feedFooter:this.options.feedFooter,feedFooterActions:Vt(this),reelInfoSheet:this.options.reelInfoSheet,state:this.state,onActiveReelChange:e=>this.setActiveReelPost(e),onCloseReel:()=>this.closeMasonryReel(),onLoadMore:()=>{this.loadNext()},onOpenReel:e=>this.openMasonryReel(e),onReelInfoSheetChange:e=>this.setReelInfoSheet(e),onRetryEnd:()=>{this.retryEnd()}}),this.surface=this.app.mount(t),this.autoScroll.mount(),this.options.initialPage?this.options.autofill&&this.state.autofill.status===`idle`&&!this.fillController.isActive()&&await this.startInitialAutofill():await this.reload()}destroy(){this.autoScroll.destroy(),this.fillController.destroy(),this.cancelRequest(),this.stopResponsiveLayout(),this.stopStateWatcher?.(),this.stopStateWatcher=null,this.app?.unmount(),this.app=null,this.surface=null,this.target=null}getState(){return a(this.state)}nextReelMediaItem(){return this.surface?.changeActiveReelMedia(1)??!1}previousReelMediaItem(){return this.surface?.changeActiveReelMedia(-1)??!1}nextReelPost(){return this.surface?.moveActiveReelPost(1)??!1}previousReelPost(){return this.surface?.moveActiveReelPost(-1)??!1}pauseAutoScroll(){this.autoScroll.setPaused(!0)}resumeAutoScroll(){this.autoScroll.setPaused(!1)}setAutoScroll(e,t){this.autoScroll.setEnabled(e,t)}setAutoScrollSpeed(e){this.autoScroll.setSpeed(e)}applyAutofillUpdate(e){let t=vt(this.options.autofill,this.state,e);return t&&this.syncAutofillCountdown(),t}async cancelAutofill(){await ct(this.options.autofill,this.state,()=>this.cancelRequest())}applyFillUpdate(e){return this.fillController.applyUpdate(e)}cancelFill(){return this.fillController.cancel()}async fill(e){if(this.pendingRequest||Z(this.state.autofill))throw Error(`Vibe cannot fill while another page operation is active.`);await this.fillController.start(e)}restoreAutofillSession(e){let t=yt(this.options.autofill,this.state,e);return t&&this.syncAutofillCountdown(),t}restoreFillSession(e){return this.fillController.restoreSession(e)}async loadNext(){if(this.pendingRequest)return this.pendingRequest;if(!this.state.loadMoreLocked&&!(Z(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.state.next,!0)}async reload(){if(!this.options.loadPage)throw Error(`Vibe cannot reload without loadPage.`);return Z(this.state.autofill)&&await this.cancelAutofill(),this.fillController.isActive()&&await this.cancelFill(),this.cancelRequest(),this.state.autofill=X(this.options.autofill,void 0,!1),this.fillController.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(null,!1)}async retryEnd(){if(this.pendingRequest)return this.pendingRequest;if(!this.state.loadMoreLocked&&!(Z(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)}setInfiniteScroll(t){this.state.infiniteScroll=t,t&&(0,e.nextTick)(()=>this.surface?.loadIfNearBottom())}setLoadMoreLocked(t){this.state.loadMoreLocked!==t&&(this.state.loadMoreLocked=t,!t&&this.state.infiniteScroll&&(0,e.nextTick)(()=>this.surface?.loadIfNearBottom()))}setReelAutoAdvance(e){Gt(this.state.reelAutoAdvance,e)}setReelInfoSheet(e){qt(this.state.reelInfoSheet,this.options.reelInfoSheet,e)}setLayout(e){e!==this.layoutMode&&(this.layoutMode=e,e===`responsive`?this.handleResponsiveLayout():this.applyLayout(e))}applyLayout(e){e!==this.state.layout&&(e===`masonry`&&(this.state.activeReelPostId=null,this.routing.syncFeed()),this.state.reelOrigin=null,this.state.layout=e)}handleResponsiveLayout=()=>{if(!this.target)return;let e=Tt(this.target);this.state.reelInfoSheetOverlay=wt(this.target),this.state.reelMediaSource=e===`reel`?`preview`:`original`,this.layoutMode===`responsive`&&this.applyLayout(e)};startResponsiveLayout(){if(!this.target)return;this.handleResponsiveLayout();let e=this.target.ownerDocument.defaultView;e?.addEventListener(`resize`,this.handleResponsiveLayout);let t=e?.ResizeObserver??globalThis.ResizeObserver;t!==void 0&&(this.resizeObserver=new t(this.handleResponsiveLayout),this.resizeObserver.observe(this.target))}stopResponsiveLayout(){this.target?.ownerDocument.defaultView?.removeEventListener(`resize`,this.handleResponsiveLayout),this.resizeObserver?.disconnect(),this.resizeObserver=null}closeMasonryReel(){this.state.reelOrigin===`masonry`&&(this.state.activeReelPostId=null,this.state.reelOrigin=null,this.routing.syncFeed())}openMasonryReel(e){this.state.layout===`masonry`&&this.state.items.some(t=>t.postId===e)&&(this.state.activeReelPostId=e,this.state.reelOrigin=`masonry`,this.routing.syncReel(e))}setActiveReelPost(e){this.state.layout!==`reel`&&this.state.reelOrigin!==`masonry`||(this.state.activeReelPostId=e,this.routing.syncReel(e))}cancelRequest(){this.autofillDelayCountdown.clear(),this.requestVersion+=1,this.abortController?.abort(),this.abortController=null,this.pendingRequest=null,this.state.isLoading=!1,this.state.isLoadingMore=!1}async fetchPage(e,t){let n=this.options.loadPage;if(!n)return;let r=++this.requestVersion,i=new AbortController,a=this.options.autofill,o=a?this.beginAutofillCycle():null,s=!1;this.abortController=i;try{if(a?.strategy===`frontend`){let o=await ut({existingItems:t?this.state.items:[],initialCursor:e,loadPage:n,onDelayChange:e=>{r===this.requestVersion&&Object.assign(this.state.autofill,e)},onProgress:e=>{r===this.requestVersion&&Object.assign(this.state.autofill,e,{status:`filling`})},options:a,signal:i.signal});if(r!==this.requestVersion)return;this.state.items=t?q(this.state.items,o.items):[...o.items],this.lastLoadedCursor=o.lastCursor,this.state.next=o.next,o.total!==void 0&&(this.state.total=o.total),Object.assign(this.state.autofill,{missing:o.missing,received:o.received,requests:o.requests,status:o.status});return}let c=Ye(await n({cursor:e,signal:i.signal}));if(r!==this.requestVersion)return;let l=t?this.state.items:[],u=q(l,c.items),d=u.length-l.length;if(this.state.items=u,this.lastLoadedCursor=e,this.state.next=c.next,c.total!==void 0&&(this.state.total=c.total),s=!0,a?.strategy===`backend`&&o){if(Object.assign(this.state.autofill,{missing:Math.max(0,a.pageSize-d),received:d,requests:1}),d>=a.pageSize){this.state.autofill.status=`complete`;return}await gt(a,this.state,{cycleId:o,feedKey:a.feedKey,items:u.slice(l.length),missing:a.pageSize-d,next:c.next,pageSize:a.pageSize,received:d,signal:i.signal,total:this.state.total},()=>r===this.requestVersion),this.syncAutofillCountdown()}}catch(e){if(i.signal.aborted||r!==this.requestVersion)return;a&&(this.state.autofill.error=e,this.state.autofill.status=`error`),s||(t?this.state.nextPageError=e:this.state.error=e)}finally{r===this.requestVersion&&(this.abortController=null,this.state.isLoading=!1,this.state.isLoadingMore=!1)}}beginAutofillCycle(){let e=this.options.autofill;if(!e)return``;this.autofillDelayCountdown.clear();let t=`vibe-autofill-${Date.now().toString(36)}-${++this.autofillCycle}`;return this.state.autofill={...X(e,void 0,!1),cycleId:t,status:`filling`},t}syncAutofillCountdown(){let e=this.state.autofill;this.autofillDelayCountdown.sync(e.strategy===`backend`&&e.status===`waiting`?e.nextRequestAt:null)}startRequest(e,t){let n=this.fetchPage(e,t);return this.pendingRequest=n,n.finally(()=>{this.pendingRequest===n&&(this.pendingRequest=null)})}startInitialAutofill(){let e=++this.requestVersion,t=new AbortController,n=this.beginAutofillCycle();this.abortController=t,this.state.isLoadingMore=!0;let r=Et({cycleId:n,isCurrent:()=>e===this.requestVersion,onLastCursor:e=>{this.lastLoadedCursor=e},options:this.options,signal:t.signal,state:this.state}).catch(n=>{t.signal.aborted||e!==this.requestVersion||(this.state.autofill.error=n,this.state.autofill.status=`error`,this.state.nextPageError=n)}).finally(()=>{e===this.requestVersion&&(this.syncAutofillCountdown(),this.abortController=null,this.state.isLoadingMore=!1,this.pendingRequest===r&&(this.pendingRequest=null))});return this.pendingRequest=r,r}startStateNotifications(){let t=this.options.onStateChange;!t||this.stopStateWatcher||(t(this.getState()),this.stopStateWatcher=(0,e.watch)(this.state,()=>t(this.getState()),{deep:!0,flush:`post`}))}};function en(e){return new $t(e)}exports.createVibe=en;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import './vibe.css';
|
|
2
2
|
export { createVibe } from './core/createVibe';
|
|
3
|
-
export type { CreateVibeOptions, VibeAutoScrollOptions, VibeAutoScrollState, VibeAutofillOptions, VibeAutofillSessionSnapshot, VibeAutofillState, VibeAutofillStatus, VibeAutofillStrategy, VibeBackendAutofillCancelContext, VibeBackendAutofillOptions, VibeBackendAutofillSession, VibeBackendAutofillStartContext, VibeBackendAutofillUpdate, VibeBackendFillCancelContext, VibeBackendFillOptions, VibeBackendFillSession, VibeBackendFillStartContext, VibeBackendFillUpdate, VibeCardRegion, VibeCardRegionProps, VibeCursor, VibeFillOptions, VibeFillSessionSnapshot, VibeFillState, VibeFillStatus, VibeFillStrategy, VibeFillTarget, VibeFrontendFillOptions, VibeInitialPage, VibeInstance, VibeItem, VibeItemId, VibeLayout, VibeLayoutMode, VibeLifecycle, VibeFrontendAutofillOptions, VibeMediaAsset, VibeMediaSource, VibePage, VibePageLoader, VibePageRequest, VibePreview, VibeRequestDelayOptions, VibeReelRouteContext, VibeReelAutoAdvanceOptions, VibeReelAutoAdvanceState, VibeReelInfoSheetOptions, VibeReelInfoSheetProps, VibeReelInfoSheetState, VibeReelOrigin, VibeRoutingOptions, VibeState, } from './types';
|
|
3
|
+
export type { CreateVibeOptions, VibeAutoScrollOptions, VibeAutoScrollState, VibeAutofillOptions, VibeAutofillPageLimit, VibeAutofillSessionSnapshot, VibeAutofillState, VibeAutofillStatus, VibeAutofillStrategy, VibeBackendAutofillCancelContext, VibeBackendAutofillOptions, VibeBackendAutofillSession, VibeBackendAutofillStartContext, VibeBackendAutofillUpdate, VibeBackendFillCancelContext, VibeBackendFillOptions, VibeBackendFillSession, VibeBackendFillStartContext, VibeBackendFillUpdate, VibeCardRegion, VibeCardRegionProps, VibeCursor, VibeFillOptions, VibeFillSessionSnapshot, VibeFillState, VibeFillStatus, VibeFillStrategy, VibeFillTarget, VibeFeedFooter, VibeFeedFooterActions, VibeFeedFooterProps, VibeFrontendFillOptions, VibeInitialPage, VibeInstance, VibeItem, VibeItemId, VibeLayout, VibeLayoutMode, VibeLifecycle, VibeFrontendAutofillOptions, VibeMediaAsset, VibeMediaSource, VibePage, VibePageLoader, VibePageRequest, VibePreview, VibeRequestDelayOptions, VibeReelRouteContext, VibeReelAutoAdvanceOptions, VibeReelAutoAdvanceState, VibeReelInfoSheetOptions, VibeReelInfoSheetProps, VibeReelInfoSheetState, VibeReelOrigin, VibeRoutingOptions, VibeState, } from './types';
|