@bazza-ui/react 0.0.0 → 0.1.0-canary.3

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.
Files changed (87) hide show
  1. package/dist/ListboxStore-BtcTXpzi.d.cts +351 -0
  2. package/dist/ListboxStore-DPqpLlAL.d.ts +351 -0
  3. package/dist/adapters/index.cjs +2 -0
  4. package/dist/adapters/index.cjs.map +1 -0
  5. package/dist/adapters/index.d.cts +363 -0
  6. package/dist/adapters/index.d.ts +363 -0
  7. package/dist/adapters/index.js +2 -0
  8. package/dist/adapters/index.js.map +1 -0
  9. package/dist/chunk-4C666HHU.js +2 -0
  10. package/dist/chunk-4C666HHU.js.map +1 -0
  11. package/dist/chunk-AVZ64JQ3.js +2 -0
  12. package/dist/chunk-AVZ64JQ3.js.map +1 -0
  13. package/dist/chunk-BGJJC6GX.cjs +2 -0
  14. package/dist/chunk-BGJJC6GX.cjs.map +1 -0
  15. package/dist/chunk-FWWOE2SW.cjs +2 -0
  16. package/dist/chunk-FWWOE2SW.cjs.map +1 -0
  17. package/dist/chunk-JSPKF52O.cjs +2 -0
  18. package/dist/chunk-JSPKF52O.cjs.map +1 -0
  19. package/dist/chunk-KWGD24VS.js +2 -0
  20. package/dist/chunk-KWGD24VS.js.map +1 -0
  21. package/dist/chunk-M4G6J7DP.cjs +2 -0
  22. package/dist/chunk-M4G6J7DP.cjs.map +1 -0
  23. package/dist/chunk-WKAPAKUL.js +2 -0
  24. package/dist/chunk-WKAPAKUL.js.map +1 -0
  25. package/dist/combobox/index.cjs +2 -0
  26. package/dist/combobox/index.cjs.map +1 -0
  27. package/dist/combobox/index.d.cts +1039 -0
  28. package/dist/combobox/index.d.ts +1039 -0
  29. package/dist/combobox/index.js +2 -0
  30. package/dist/combobox/index.js.map +1 -0
  31. package/dist/command-score-Dgo3ZS3Z.d.ts +36 -0
  32. package/dist/command-score-YjNr3ZWi.d.cts +36 -0
  33. package/dist/context-menu/index.cjs +2 -0
  34. package/dist/context-menu/index.cjs.map +1 -0
  35. package/dist/context-menu/index.d.cts +658 -0
  36. package/dist/context-menu/index.d.ts +658 -0
  37. package/dist/context-menu/index.js +2 -0
  38. package/dist/context-menu/index.js.map +1 -0
  39. package/dist/data-surface-B-eIGTBi.d.cts +678 -0
  40. package/dist/data-surface-D1OilMDu.d.ts +678 -0
  41. package/dist/dropdown-menu/index.cjs +2 -0
  42. package/dist/dropdown-menu/index.cjs.map +1 -0
  43. package/dist/dropdown-menu/index.d.cts +700 -0
  44. package/dist/dropdown-menu/index.d.ts +700 -0
  45. package/dist/dropdown-menu/index.js +2 -0
  46. package/dist/dropdown-menu/index.js.map +1 -0
  47. package/dist/events-BPr8sRGH.d.cts +166 -0
  48. package/dist/events-BPr8sRGH.d.ts +166 -0
  49. package/dist/input-BoIK003I.d.cts +41 -0
  50. package/dist/input-DF7D8YzW.d.ts +41 -0
  51. package/dist/internal/listbox/index.cjs +2 -0
  52. package/dist/internal/listbox/index.cjs.map +1 -0
  53. package/dist/internal/listbox/index.d.cts +269 -0
  54. package/dist/internal/listbox/index.d.ts +269 -0
  55. package/dist/internal/listbox/index.js +2 -0
  56. package/dist/internal/listbox/index.js.map +1 -0
  57. package/dist/internal/popup-menu/index.cjs +2 -0
  58. package/dist/internal/popup-menu/index.cjs.map +1 -0
  59. package/dist/internal/popup-menu/index.d.cts +846 -0
  60. package/dist/internal/popup-menu/index.d.ts +846 -0
  61. package/dist/internal/popup-menu/index.js +2 -0
  62. package/dist/internal/popup-menu/index.js.map +1 -0
  63. package/dist/item-equality-B6TbXlBT.d.cts +7 -0
  64. package/dist/item-equality-B6TbXlBT.d.ts +7 -0
  65. package/dist/loading-DphSt8MY.d.cts +27 -0
  66. package/dist/loading-TsgH6v92.d.ts +27 -0
  67. package/dist/select/index.cjs +2 -0
  68. package/dist/select/index.cjs.map +1 -0
  69. package/dist/select/index.d.cts +927 -0
  70. package/dist/select/index.d.ts +927 -0
  71. package/dist/select/index.js +2 -0
  72. package/dist/select/index.js.map +1 -0
  73. package/dist/separator-B4Ot84B0.d.ts +748 -0
  74. package/dist/separator-BmbUeeaT.d.cts +748 -0
  75. package/dist/types-9vS1uLIK.d.cts +1557 -0
  76. package/dist/types-lQCIvWW8.d.ts +1557 -0
  77. package/dist/use-listbox-item-BIi4eRPI.d.cts +182 -0
  78. package/dist/use-listbox-item-BIi4eRPI.d.ts +182 -0
  79. package/dist/video-player/index.cjs +3 -0
  80. package/dist/video-player/index.cjs.map +1 -0
  81. package/dist/video-player/index.d.cts +1379 -0
  82. package/dist/video-player/index.d.ts +1379 -0
  83. package/dist/video-player/index.js +3 -0
  84. package/dist/video-player/index.js.map +1 -0
  85. package/package.json +56 -12
  86. package/dist/index.d.ts +0 -2
  87. package/dist/index.js +0 -2
@@ -0,0 +1,182 @@
1
+ import * as React from 'react';
2
+
3
+ interface ItemContextValue {
4
+ /** Unique ID for this item (for DOM id attribute) */
5
+ id: string;
6
+ /** Whether the item is highlighted */
7
+ highlighted: boolean;
8
+ /** Whether the item is disabled */
9
+ disabled: boolean;
10
+ /** Keyboard shortcut for this item */
11
+ shortcut?: string;
12
+ }
13
+ declare const ItemContext: React.Context<ItemContextValue | null>;
14
+ declare function useItemContext(): ItemContextValue;
15
+ declare function useMaybeItemContext(): ItemContextValue | null;
16
+
17
+ /**
18
+ * Aim guard refs for submenu navigation.
19
+ * Optional - only needed for popup menus with submenus.
20
+ */
21
+ interface AimGuardRefs {
22
+ /** Whether aim guard is currently active */
23
+ aimGuardActiveRef: React.RefObject<boolean>;
24
+ /** The depth at which aim guard is active (null when not guarding) */
25
+ guardedDepthRef: React.RefObject<number | null>;
26
+ }
27
+ /**
28
+ * Parameters for the useListboxItem hook.
29
+ */
30
+ interface UseListboxItemParams {
31
+ /**
32
+ * Explicit unique identifier for this item in the store.
33
+ * Takes highest priority for item registration.
34
+ * Used by data-first APIs to ensure consistent IDs.
35
+ */
36
+ id?: string;
37
+ /**
38
+ * Unique value for this item used as identifier and for filtering.
39
+ * If not provided, will be inferred from textContent.
40
+ * Used for registration when `id` is not provided.
41
+ */
42
+ value?: string;
43
+ /**
44
+ * Additional keywords to match against when filtering.
45
+ * Useful for aliases or synonyms.
46
+ */
47
+ keywords?: string[];
48
+ /**
49
+ * Whether this item is disabled.
50
+ * Disabled items are not selectable and are skipped during keyboard navigation.
51
+ */
52
+ disabled?: boolean;
53
+ /**
54
+ * Whether to force render this item regardless of filter results.
55
+ * @default false
56
+ */
57
+ forceMount?: boolean;
58
+ /**
59
+ * Keyboard shortcut to trigger this item.
60
+ * When the menu is focused and the user presses this key, the item will be selected.
61
+ * Should be a single character (e.g., "1", "a", etc.).
62
+ */
63
+ shortcut?: string;
64
+ /**
65
+ * Forces this row's relative order during score-based sorting.
66
+ * Lower values appear earlier.
67
+ * @default 0
68
+ */
69
+ forceOrder?: number;
70
+ /**
71
+ * Overrides this row's computed fuzzy-match score.
72
+ * Useful for pinning or manually ranking rows in score-based views.
73
+ */
74
+ forceScore?: number;
75
+ /**
76
+ * Whether this item is a submenu trigger (for store registration).
77
+ * @default false
78
+ */
79
+ isSubmenuTrigger?: boolean;
80
+ /**
81
+ * Callback when this item is selected (via click or Enter key).
82
+ * For simple items, pass this directly. For checkbox/radio items,
83
+ * use registerSelect() to register a dynamic handler.
84
+ */
85
+ onSelect?: () => void;
86
+ /**
87
+ * Whether selecting this item should close the menu.
88
+ * @default true
89
+ */
90
+ closeOnClick?: boolean;
91
+ /**
92
+ * Callback invoked after selection occurs (via click).
93
+ * Called with the item's ID. The consumer handles any
94
+ * post-selection behavior like closing menus.
95
+ */
96
+ onAfterSelect?: (itemId: string) => void;
97
+ /**
98
+ * Children (used for text content inference when value is not provided).
99
+ */
100
+ children?: React.ReactNode;
101
+ /**
102
+ * Optional aim guard refs for popup menu navigation.
103
+ * When provided, pointer move events will respect the aim guard.
104
+ */
105
+ aimGuard?: AimGuardRefs;
106
+ }
107
+ /**
108
+ * Return value from the useListboxItem hook.
109
+ */
110
+ interface UseListboxItemReturn {
111
+ /** Unique ID for this item (DOM ID for aria-activedescendant) */
112
+ id: string;
113
+ /**
114
+ * Store identifier for this item.
115
+ * Use this when calling store methods like setHighlightedId, registerSubmenuOpen, etc.
116
+ * This is the `value` prop (or inferred from textContent).
117
+ */
118
+ storeId: string;
119
+ /** Ref to attach to the item element */
120
+ ref: React.RefObject<HTMLDivElement | null>;
121
+ /** Whether item is currently highlighted */
122
+ isHighlighted: boolean;
123
+ /** Whether item should be rendered (passes filter) */
124
+ isVisible: boolean;
125
+ /** Context value to provide to children via ItemContext.Provider */
126
+ contextValue: ItemContextValue;
127
+ /**
128
+ * Event handlers to spread on the element.
129
+ * These handle click, pointer move, and pointer down events.
130
+ */
131
+ handlers: {
132
+ onClick: React.MouseEventHandler<HTMLDivElement>;
133
+ onPointerMove: React.PointerEventHandler<HTMLDivElement>;
134
+ onPointerDown: React.PointerEventHandler<HTMLDivElement>;
135
+ };
136
+ /**
137
+ * Register a custom onSelect handler.
138
+ * This is useful for checkbox/radio items where the select behavior
139
+ * needs to be customized (e.g., toggle checked state).
140
+ * Returns an unregister function.
141
+ */
142
+ registerSelect: (handler: (() => void) | undefined) => () => void;
143
+ }
144
+ /**
145
+ * Hook that provides all shared logic for navigatable/highlightable listbox items.
146
+ *
147
+ * This hook handles:
148
+ * - Item registration with the listbox store
149
+ * - Highlight state management (keyboard and pointer)
150
+ * - Filter/search visibility
151
+ * - Scroll into view on keyboard navigation
152
+ * - Click, pointer move, and pointer down event handlers
153
+ * - Optional aim guard integration (for submenu navigation)
154
+ *
155
+ * @example
156
+ * ```tsx
157
+ * function CustomItem(props) {
158
+ * const item = useListboxItem({
159
+ * value: props.value,
160
+ * disabled: props.disabled,
161
+ * onSelect: props.onSelect,
162
+ * })
163
+ *
164
+ * if (!item.isVisible) return null
165
+ *
166
+ * return (
167
+ * <ItemContext.Provider value={item.contextValue}>
168
+ * <div
169
+ * ref={item.ref}
170
+ * {...item.handlers}
171
+ * data-highlighted={item.isHighlighted || undefined}
172
+ * >
173
+ * {props.children}
174
+ * </div>
175
+ * </ItemContext.Provider>
176
+ * )
177
+ * }
178
+ * ```
179
+ */
180
+ declare function useListboxItem(params: UseListboxItemParams): UseListboxItemReturn;
181
+
182
+ export { type AimGuardRefs as A, type ItemContextValue as I, type UseListboxItemParams as U, useMaybeItemContext as a, ItemContext as b, type UseListboxItemReturn as c, useListboxItem as d, useItemContext as u };
@@ -0,0 +1,182 @@
1
+ import * as React from 'react';
2
+
3
+ interface ItemContextValue {
4
+ /** Unique ID for this item (for DOM id attribute) */
5
+ id: string;
6
+ /** Whether the item is highlighted */
7
+ highlighted: boolean;
8
+ /** Whether the item is disabled */
9
+ disabled: boolean;
10
+ /** Keyboard shortcut for this item */
11
+ shortcut?: string;
12
+ }
13
+ declare const ItemContext: React.Context<ItemContextValue | null>;
14
+ declare function useItemContext(): ItemContextValue;
15
+ declare function useMaybeItemContext(): ItemContextValue | null;
16
+
17
+ /**
18
+ * Aim guard refs for submenu navigation.
19
+ * Optional - only needed for popup menus with submenus.
20
+ */
21
+ interface AimGuardRefs {
22
+ /** Whether aim guard is currently active */
23
+ aimGuardActiveRef: React.RefObject<boolean>;
24
+ /** The depth at which aim guard is active (null when not guarding) */
25
+ guardedDepthRef: React.RefObject<number | null>;
26
+ }
27
+ /**
28
+ * Parameters for the useListboxItem hook.
29
+ */
30
+ interface UseListboxItemParams {
31
+ /**
32
+ * Explicit unique identifier for this item in the store.
33
+ * Takes highest priority for item registration.
34
+ * Used by data-first APIs to ensure consistent IDs.
35
+ */
36
+ id?: string;
37
+ /**
38
+ * Unique value for this item used as identifier and for filtering.
39
+ * If not provided, will be inferred from textContent.
40
+ * Used for registration when `id` is not provided.
41
+ */
42
+ value?: string;
43
+ /**
44
+ * Additional keywords to match against when filtering.
45
+ * Useful for aliases or synonyms.
46
+ */
47
+ keywords?: string[];
48
+ /**
49
+ * Whether this item is disabled.
50
+ * Disabled items are not selectable and are skipped during keyboard navigation.
51
+ */
52
+ disabled?: boolean;
53
+ /**
54
+ * Whether to force render this item regardless of filter results.
55
+ * @default false
56
+ */
57
+ forceMount?: boolean;
58
+ /**
59
+ * Keyboard shortcut to trigger this item.
60
+ * When the menu is focused and the user presses this key, the item will be selected.
61
+ * Should be a single character (e.g., "1", "a", etc.).
62
+ */
63
+ shortcut?: string;
64
+ /**
65
+ * Forces this row's relative order during score-based sorting.
66
+ * Lower values appear earlier.
67
+ * @default 0
68
+ */
69
+ forceOrder?: number;
70
+ /**
71
+ * Overrides this row's computed fuzzy-match score.
72
+ * Useful for pinning or manually ranking rows in score-based views.
73
+ */
74
+ forceScore?: number;
75
+ /**
76
+ * Whether this item is a submenu trigger (for store registration).
77
+ * @default false
78
+ */
79
+ isSubmenuTrigger?: boolean;
80
+ /**
81
+ * Callback when this item is selected (via click or Enter key).
82
+ * For simple items, pass this directly. For checkbox/radio items,
83
+ * use registerSelect() to register a dynamic handler.
84
+ */
85
+ onSelect?: () => void;
86
+ /**
87
+ * Whether selecting this item should close the menu.
88
+ * @default true
89
+ */
90
+ closeOnClick?: boolean;
91
+ /**
92
+ * Callback invoked after selection occurs (via click).
93
+ * Called with the item's ID. The consumer handles any
94
+ * post-selection behavior like closing menus.
95
+ */
96
+ onAfterSelect?: (itemId: string) => void;
97
+ /**
98
+ * Children (used for text content inference when value is not provided).
99
+ */
100
+ children?: React.ReactNode;
101
+ /**
102
+ * Optional aim guard refs for popup menu navigation.
103
+ * When provided, pointer move events will respect the aim guard.
104
+ */
105
+ aimGuard?: AimGuardRefs;
106
+ }
107
+ /**
108
+ * Return value from the useListboxItem hook.
109
+ */
110
+ interface UseListboxItemReturn {
111
+ /** Unique ID for this item (DOM ID for aria-activedescendant) */
112
+ id: string;
113
+ /**
114
+ * Store identifier for this item.
115
+ * Use this when calling store methods like setHighlightedId, registerSubmenuOpen, etc.
116
+ * This is the `value` prop (or inferred from textContent).
117
+ */
118
+ storeId: string;
119
+ /** Ref to attach to the item element */
120
+ ref: React.RefObject<HTMLDivElement | null>;
121
+ /** Whether item is currently highlighted */
122
+ isHighlighted: boolean;
123
+ /** Whether item should be rendered (passes filter) */
124
+ isVisible: boolean;
125
+ /** Context value to provide to children via ItemContext.Provider */
126
+ contextValue: ItemContextValue;
127
+ /**
128
+ * Event handlers to spread on the element.
129
+ * These handle click, pointer move, and pointer down events.
130
+ */
131
+ handlers: {
132
+ onClick: React.MouseEventHandler<HTMLDivElement>;
133
+ onPointerMove: React.PointerEventHandler<HTMLDivElement>;
134
+ onPointerDown: React.PointerEventHandler<HTMLDivElement>;
135
+ };
136
+ /**
137
+ * Register a custom onSelect handler.
138
+ * This is useful for checkbox/radio items where the select behavior
139
+ * needs to be customized (e.g., toggle checked state).
140
+ * Returns an unregister function.
141
+ */
142
+ registerSelect: (handler: (() => void) | undefined) => () => void;
143
+ }
144
+ /**
145
+ * Hook that provides all shared logic for navigatable/highlightable listbox items.
146
+ *
147
+ * This hook handles:
148
+ * - Item registration with the listbox store
149
+ * - Highlight state management (keyboard and pointer)
150
+ * - Filter/search visibility
151
+ * - Scroll into view on keyboard navigation
152
+ * - Click, pointer move, and pointer down event handlers
153
+ * - Optional aim guard integration (for submenu navigation)
154
+ *
155
+ * @example
156
+ * ```tsx
157
+ * function CustomItem(props) {
158
+ * const item = useListboxItem({
159
+ * value: props.value,
160
+ * disabled: props.disabled,
161
+ * onSelect: props.onSelect,
162
+ * })
163
+ *
164
+ * if (!item.isVisible) return null
165
+ *
166
+ * return (
167
+ * <ItemContext.Provider value={item.contextValue}>
168
+ * <div
169
+ * ref={item.ref}
170
+ * {...item.handlers}
171
+ * data-highlighted={item.isHighlighted || undefined}
172
+ * >
173
+ * {props.children}
174
+ * </div>
175
+ * </ItemContext.Provider>
176
+ * )
177
+ * }
178
+ * ```
179
+ */
180
+ declare function useListboxItem(params: UseListboxItemParams): UseListboxItemReturn;
181
+
182
+ export { type AimGuardRefs as A, type ItemContextValue as I, type UseListboxItemParams as U, useMaybeItemContext as a, ItemContext as b, type UseListboxItemReturn as c, useListboxItem as d, useItemContext as u };
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkM4G6J7DPcjs = require('../chunk-M4G6J7DP.cjs');var _react = require('react'); var Be = _interopRequireWildcard(_react); var we = _interopRequireWildcard(_react); var Jt = _interopRequireWildcard(_react); var Ie = _interopRequireWildcard(_react); var ie = _interopRequireWildcard(_react); var se = _interopRequireWildcard(_react); var _ = _interopRequireWildcard(_react); var G = _interopRequireWildcard(_react); var Ae = _interopRequireWildcard(_react); var le = _interopRequireWildcard(_react); var z = _interopRequireWildcard(_react); var We = _interopRequireWildcard(_react); var Qe = _interopRequireWildcard(_react); var ue = _interopRequireWildcard(_react); var $e = _interopRequireWildcard(_react); var Ne = _interopRequireWildcard(_react); var ce = _interopRequireWildcard(_react); var p = _interopRequireWildcard(_react); var je = _interopRequireWildcard(_react); var S = _interopRequireWildcard(_react); var I = _interopRequireWildcard(_react); var tt = _interopRequireWildcard(_react); var N = _interopRequireWildcard(_react); var oe = _interopRequireWildcard(_react); var L = _interopRequireWildcard(_react);var at=Be.createContext(null);function P(d){let e=Be.useContext(at);if(!e)throw new Error(`<VideoPlayer.${d}> must be used within <VideoPlayer.Root>`);return e}function ne(){return P("useVideoPlayer")}var Hr={};_chunkM4G6J7DPcjs.a.call(void 0, Hr,{BufferedIndicator:()=>Gt,Captions:()=>Zt,CaptionsButton:()=>er,CaptionsDataAttributes:()=>Le,CaptionsMenu:()=>tr,CaptionsMenuItem:()=>De,Controls:()=>rr,ControlsDataAttributes:()=>Oe,FullscreenButton:()=>nr,MuteButton:()=>or,Overlay:()=>ar,OverlayDataAttributes:()=>Fe,PictureInPictureButton:()=>ir,PlayButton:()=>sr,PlaybackRateButton:()=>lr,PlaybackRateMenu:()=>ur,PlaybackRateMenuItem:()=>st,Portal:()=>cr,Poster:()=>dr,QualityMenu:()=>pr,QualityMenuItem:()=>ut,Root:()=>mr,RootDataAttributes:()=>_e,SeekSlider:()=>yr,SeekSliderBuffered:()=>vr,SeekSliderControl:()=>Sr,SeekSliderCssVars:()=>Ke,SeekSliderDataAttributes:()=>Xe,SeekSliderHover:()=>xr,SeekSliderPreviewThumb:()=>Tr,SeekSliderPreviewThumbDataAttributes:()=>Ye,SeekSliderPreviewTooltip:()=>de,SeekSliderPreviewTooltipPopup:()=>Je,SeekSliderPreviewTooltipPortal:()=>Ge,SeekSliderPreviewTooltipPositioner:()=>ze,SeekSliderProgress:()=>kr,SeekSliderThumb:()=>gr,SeekSliderTrack:()=>br,Thumbnail:()=>hr,ThumbnailDataAttributes:()=>Ze,TimeDisplay:()=>Cr,TimeDisplayDataAttributes:()=>et,Track:()=>Mr,Video:()=>Er,VolumeSlider:()=>Vr,VolumeSliderControl:()=>Br,VolumeSliderCssVars:()=>rt,VolumeSliderDataAttributes:()=>nt,VolumeSliderRange:()=>Lr,VolumeSliderThumb:()=>Ir,VolumeSliderTrack:()=>wr,useTransitionStatus:()=>j,useVideoPlayer:()=>ne});var _jsxruntime = require('react/jsx-runtime');var Gt=we.forwardRef(function(e,n){let{render:i,...s}=e,c=P("BufferedIndicator"),t=we.useMemo(()=>{if(!c.buffered||c.buffered.length===0)return 0;for(let u=0;u<c.buffered.length;u++)if(c.buffered.start(u)<=c.currentTime&&c.currentTime<=c.buffered.end(u))return c.buffered.end(u);return c.buffered.end(0)},[c.buffered,c.currentTime]),a=c.duration>0?t/c.duration*100:0,r={buffered:c.buffered,duration:c.duration,bufferedPercentage:a,bufferedEnd:t},o={"--buffered-percentage":`${a}%`,"--buffered-end":t,...s.style},l={ref:n,style:o,"aria-hidden":!0};return i?i(l,r):_jsxruntime.jsx.call(void 0, "div",{ref:n,"aria-hidden":"true",...s,style:o})});var Le=(e=>(e.active="data-active",e))(Le||{});var Zt=Jt.forwardRef(function(e,n){let{render:i,children:s,...c}=e,a=P("Captions").activeCues,r=a.map(f=>f.text).join(`
2
+ `),o=a.length>0,l={active:o,cueText:r,cues:a},u={ref:n,"aria-live":"polite","aria-atomic":!0,role:"status",style:{pointerEvents:"none"},"data-active":o||void 0};return i?i(u,l):s?_jsxruntime.jsx.call(void 0, "div",{...u,...c,children:s}):_jsxruntime.jsx.call(void 0, "div",{...u,...c,children:r})});var er=Ie.forwardRef(function(e,n){let{render:i,onClick:s,...c}=e,t=P("CaptionsButton"),a=t.registeredTracks.length>0,r=t.activeTextTrack!==null,o={active:r,available:a,trackCount:t.registeredTracks.length},l=Ie.useCallback(f=>{if(_optionalChain([s, 'optionalCall', _2 => _2(f)]),!f.defaultPrevented){if(r)t.setTextTrack(null);else if(t.registeredTracks.length>0){let y=t.registeredTracks[0];_optionalChain([y, 'optionalAccess', _3 => _3.textTrack])&&t.setTextTrack(y.textTrack)}}},[s,t,r]),u={ref:n,type:"button","aria-label":r?"Disable captions":"Enable captions","aria-pressed":r,disabled:!a,"data-active":r||void 0,"data-available":a||void 0,onClick:l};return i?i(u,o):_jsxruntime.jsx.call(void 0, "button",{...u,...c})});var tr=ie.forwardRef(function(e,n){let{render:i,children:s,...c}=e,t=P("CaptionsMenu"),a={registeredTracks:t.registeredTracks,activeTextTrack:t.activeTextTrack},r={ref:n,role:"menu","aria-label":"Captions","data-active":t.activeTextTrack!==null||void 0};return i?i(r,a):_jsxruntime.jsx.call(void 0, "div",{...r,...c,children:_nullishCoalesce(s, () => (_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, De,{track:null,children:"Off"}),t.registeredTracks.map(o=>_jsxruntime.jsx.call(void 0, De,{track:o.textTrack,children:o.label},o.id))]})))})}),De=ie.forwardRef(function(e,n){let{track:i,onClick:s,children:c,...t}=e,a=P("CaptionsMenuItem"),r=a.activeTextTrack===i,o=ie.useCallback(l=>{_optionalChain([s, 'optionalCall', _4 => _4(l)]),l.defaultPrevented||a.setTextTrack(i)},[s,a,i]);return _jsxruntime.jsx.call(void 0, "button",{ref:n,type:"button",role:"menuitemradio","aria-checked":r,"data-active":r||void 0,...t,onClick:o,children:c})});var Oe=(r=>(r.open="data-open",r.closed="data-closed",r.idle="data-idle",r.playing="data-playing",r.paused="data-paused",r.ended="data-ended",r.startingStyle="data-starting-style",r.endingStyle="data-ending-style",r))(Oe||{});function Xr(d){let e=[...d.getAnimations(),...Array.from(d.querySelectorAll("*")).flatMap(n=>n.getAnimations())];return e.length===0?Promise.resolve():Promise.all(e.map(n=>n.finished)).then(()=>{}).catch(()=>{})}function j(d){let{open:e,keepMounted:n=!1}=d,[i,s]=_.useState(e||n),[c,t]=_.useState(e?"starting":void 0),a=_.useRef(null),r=_.useRef(!1);return _.useEffect(()=>{if(e){r.current=!1,s(!0),t("starting");let o=requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(void 0)})});return()=>cancelAnimationFrame(o)}},[e]),_.useEffect(()=>{if(!e&&i&&!r.current){t("ending");let o=a.current;if(!o){t(void 0),n||s(!1);return}r.current=!0;let l=requestAnimationFrame(()=>{requestAnimationFrame(()=>{Xr(o).then(()=>{r.current&&(r.current=!1,t(void 0),n||s(!1))})})});return()=>{cancelAnimationFrame(l)}}},[e,i,n]),_.useEffect(()=>{n&&!i&&!e&&s(!0)},[n,i,e]),{mounted:i||n,transitionStatus:c,elementRef:a}}var rr=se.forwardRef(function(e,n){let{idleTimeout:i,keepMounted:s=!1,render:c,children:t,...a}=e,r=P("Controls"),l=(_nullishCoalesce(i, () => (r.idleTimeout)))===0||!r.idle,{mounted:u,transitionStatus:f,elementRef:y}=j({open:l,keepMounted:s}),R=se.useCallback(V=>{y.current=V,typeof n=="function"?n(V):n&&(n.current=V)},[n,y]),{onClick:g,...m}=a,x=se.useCallback(V=>{V.stopPropagation(),_optionalChain([g, 'optionalCall', _5 => _5(V)])},[g]),v={open:l,idle:r.idle,playing:r.playing,paused:r.paused,ended:r.ended},b={ref:R,onClick:x,"data-open":l||void 0,"data-closed":!l||void 0,"data-idle":r.idle||void 0,"data-playing":r.playing||void 0,"data-paused":r.paused||void 0,"data-ended":r.ended||void 0,"data-starting-style":f==="starting"||void 0,"data-ending-style":f==="ending"||void 0};return u?c?c(b,v):_jsxruntime.jsx.call(void 0, "div",{...b,...m,children:t}):null});var nr=G.forwardRef(function(e,n){let{render:i,onClick:s,children:c,...t}=e,a=P("FullscreenButton"),[r,o]=G.useState(!1);G.useEffect(()=>{o("fullscreenEnabled"in document&&document.fullscreenEnabled)},[]);let l=G.useCallback(y=>{_optionalChain([s, 'optionalCall', _6 => _6(y)]),y.defaultPrevented||a.toggleFullscreen()},[s,a]),u={fullscreen:a.fullscreen,supported:r},f={ref:n,type:"button","aria-label":a.fullscreen?"Exit fullscreen":"Enter fullscreen","aria-pressed":a.fullscreen,disabled:!r,"data-fullscreen":a.fullscreen||void 0,"data-supported":r||void 0,onClick:l};return i?i(f,u):_jsxruntime.jsx.call(void 0, "button",{...f,...t,children:c})});var or=Ae.forwardRef(function(e,n){let{render:i,onClick:s,...c}=e,t=P("MuteButton"),a={muted:t.muted,volume:t.volume},r=Ae.useCallback(m=>{_optionalChain([s, 'optionalCall', _7 => _7(m)]),m.defaultPrevented||t.toggleMute()},[s,t]),o=t.volume,l=t.muted,u=o===0||l,f=o>0&&!l,y=!l&&o>0&&o<.5,R=!l&&o>=.5,g={ref:n,type:"button","aria-label":t.muted?"Unmute":"Mute","aria-pressed":t.muted,"data-muted":l||void 0,"data-volume-off":u||void 0,"data-volume-on":f||void 0,"data-volume-low":y||void 0,"data-volume-high":R||void 0,onClick:r};return i?i(g,a):_jsxruntime.jsx.call(void 0, "button",{...g,...c})});var Fe=(u=>(u.open="data-open",u.closed="data-closed",u.playing="data-playing",u.paused="data-paused",u.ended="data-ended",u.waiting="data-waiting",u.seeking="data-seeking",u.fullscreen="data-fullscreen",u.pip="data-pip",u.startingStyle="data-starting-style",u.endingStyle="data-ending-style",u))(Fe||{});var ar=le.forwardRef(function(e,n){let{idleTimeout:i,keepMounted:s=!1,render:c,onClick:t,children:a,...r}=e,o=P("Overlay"),u=(_nullishCoalesce(i, () => (o.idleTimeout)))===0||!o.idle,{mounted:f,transitionStatus:y,elementRef:R}=j({open:u,keepMounted:s}),g=le.useCallback(b=>{R.current=b,typeof n=="function"?n(b):n&&(n.current=b)},[n,R]),m=le.useCallback(b=>{_optionalChain([t, 'optionalCall', _8 => _8(b)]),b.defaultPrevented||o.toggle()},[t,o]),x={playing:o.playing,paused:o.paused,ended:o.ended,waiting:o.waiting,seeking:o.seeking,fullscreen:o.fullscreen,pictureInPicture:o.pictureInPicture,open:u},v={ref:g,onClick:m,"data-playing":o.playing||void 0,"data-paused":o.paused||void 0,"data-ended":o.ended||void 0,"data-waiting":o.waiting||void 0,"data-seeking":o.seeking||void 0,"data-fullscreen":o.fullscreen||void 0,"data-pip":o.pictureInPicture||void 0,"data-open":u||void 0,"data-closed":!u||void 0,"data-starting-style":y==="starting"||void 0,"data-ending-style":y==="ending"||void 0};return f?c?c(v,x):_jsxruntime.jsx.call(void 0, "div",{...v,...r,children:a}):null});var ir=z.forwardRef(function(e,n){let{render:i,onClick:s,...c}=e,t=P("PictureInPictureButton"),[a,r]=z.useState(!1);z.useEffect(()=>{r("pictureInPictureEnabled"in document&&document.pictureInPictureEnabled)},[]);let o={pictureInPicture:t.pictureInPicture,supported:a},l=z.useCallback(f=>{_optionalChain([s, 'optionalCall', _9 => _9(f)]),f.defaultPrevented||t.togglePictureInPicture()},[s,t]),u={ref:n,type:"button","aria-label":t.pictureInPicture?"Exit picture-in-picture":"Enter picture-in-picture","aria-pressed":t.pictureInPicture,disabled:!a,"data-pip":t.pictureInPicture||void 0,"data-supported":a||void 0,onClick:l};return i?i(u,o):_jsxruntime.jsx.call(void 0, "button",{...u,...c})});var sr=We.forwardRef(function(e,n){let{render:i,onClick:s,children:c,...t}=e,a=P("PlayButton"),r=We.useCallback(u=>{_optionalChain([s, 'optionalCall', _10 => _10(u)]),u.defaultPrevented||a.toggle()},[s,a]),o={playing:a.playing,paused:a.paused,ended:a.ended,waiting:a.waiting},l={ref:n,type:"button","aria-label":a.playing?"Pause":"Play","data-playing":a.playing||void 0,"data-paused":a.paused||void 0,"data-ended":a.ended||void 0,"data-waiting":a.waiting||void 0,onClick:r};return i?i(l,o):_jsxruntime.jsx.call(void 0, "button",{...l,...t,children:c})});var tn=[.25,.5,.75,1,1.25,1.5,1.75,2],lr=Qe.forwardRef(function(e,n){let{rates:i=tn,render:s,onClick:c,children:t,...a}=e,r=P("PlaybackRateButton"),o={playbackRate:r.playbackRate,rates:i},l=Qe.useCallback(f=>{if(_optionalChain([c, 'optionalCall', _11 => _11(f)]),!f.defaultPrevented){let R=(i.indexOf(r.playbackRate)+1)%i.length,g=_nullishCoalesce(_nullishCoalesce(i[R], () => (i[0])), () => (r.playbackRate));r.setPlaybackRate(g)}},[c,r,i]),u={ref:n,type:"button","aria-label":`Playback speed: ${r.playbackRate}x`,"data-rate":r.playbackRate,onClick:l};return s?s(u,o):_jsxruntime.jsx.call(void 0, "button",{...u,...a,children:_nullishCoalesce(t, () => (`${r.playbackRate}x`))})});var nn=[.25,.5,.75,1,1.25,1.5,1.75,2],ur=ue.forwardRef(function(e,n){let{rates:i=nn,render:s,children:c,...t}=e,a=P("PlaybackRateMenu"),r={playbackRate:a.playbackRate,rates:i},o={ref:n,role:"menu","aria-label":"Playback speed","data-rate":a.playbackRate};return s?s(o,r):_jsxruntime.jsx.call(void 0, "div",{...o,...t,children:_nullishCoalesce(c, () => (i.map(l=>_jsxruntime.jsx.call(void 0, st,{rate:l},l))))})}),st=ue.forwardRef(function(e,n){let{rate:i,onClick:s,children:c,...t}=e,a=P("PlaybackRateMenuItem"),r=a.playbackRate===i,o=ue.useCallback(l=>{_optionalChain([s, 'optionalCall', _12 => _12(l)]),l.defaultPrevented||a.setPlaybackRate(i)},[s,a,i]);return _jsxruntime.jsx.call(void 0, "button",{ref:n,type:"button",role:"menuitemradio","aria-checked":r,"data-active":r||void 0,...t,onClick:o,children:_nullishCoalesce(c, () => (`${i}x`))})});var _reactdom = require('react-dom'); var Pr = _interopRequireWildcard(_reactdom);function cr(d){let{children:e,container:n}=d,[i,s]=$e.useState(!1);if($e.useEffect(()=>(s(!0),()=>s(!1)),[]),!i)return null;let c=_nullishCoalesce(n, () => ((typeof document<"u"?document.body:null)));return c?_reactdom.createPortal.call(void 0, e,c):null}var dr=Ne.forwardRef(function(e,n){let{keepMounted:i=!1,render:s,children:c,...t}=e,a=P("Poster"),r=!a.canPlay,o=a.canPlay,{mounted:l,transitionStatus:u,elementRef:f}=j({open:r,keepMounted:i}),y=an(n,f),R={loading:r,loaded:o,transitionStatus:u},g={ref:y,"aria-hidden":!0,"data-loading":r||void 0,"data-loaded":o||void 0,"data-starting-style":u==="starting"||void 0,"data-ending-style":u==="ending"||void 0};return l?s?s(g,R):_jsxruntime.jsx.call(void 0, "div",{...g,...t,children:c}):null});function an(...d){return Ne.useCallback(e=>{for(let n of d)typeof n=="function"?n(e):n!=null&&(n.current=e)},d)}var pr=ce.forwardRef(function(e,n){let{render:i,children:s,...c}=e,t=P("QualityMenu"),a={qualities:t.qualities,activeQuality:t.activeQuality},r={ref:n,role:"menu","aria-label":"Video quality","data-quality":_nullishCoalesce(_optionalChain([t, 'access', _13 => _13.activeQuality, 'optionalAccess', _14 => _14.label]), () => (void 0))};return i?i(r,a):_jsxruntime.jsx.call(void 0, "div",{...r,...c,children:_nullishCoalesce(s, () => (t.qualities.map(o=>_jsxruntime.jsx.call(void 0, ut,{quality:o,children:o.label},o.label))))})}),ut=ce.forwardRef(function(e,n){let{quality:i,onClick:s,children:c,...t}=e,a=P("QualityMenuItem"),r=_optionalChain([a, 'access', _15 => _15.activeQuality, 'optionalAccess', _16 => _16.label])===i.label,o=ce.useCallback(l=>{_optionalChain([s, 'optionalCall', _17 => _17(l)]),l.defaultPrevented||a.setQuality(i)},[s,a,i]);return _jsxruntime.jsx.call(void 0, "button",{ref:n,type:"button",role:"menuitemradio","aria-checked":r,"data-active":r||void 0,...t,onClick:o,children:c})});var _e=(o=>(o.playing="data-playing",o.paused="data-paused",o.ended="data-ended",o.waiting="data-waiting",o.seeking="data-seeking",o.fullscreen="data-fullscreen",o.pip="data-pip",o.muted="data-muted",o.idle="data-idle",o))(_e||{});function fr(d,e){let n=ne(),i=je.useRef(n);i.current=n,je.useEffect(()=>{if(e==="none")return;let s=t=>{let a=t.target;if(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable)return;let r=i.current;switch(t.key){case" ":t.preventDefault(),r.toggle();break;case"f":case"F":t.preventDefault(),r.toggleFullscreen();break;case"ArrowUp":t.preventDefault(),r.setVolume(Math.min(r.volume+.1,1));break;case"ArrowDown":t.preventDefault(),r.setVolume(Math.max(r.volume-.1,0));break;case"ArrowRight":t.preventDefault(),r.seek(Math.min(r.currentTime+5,r.duration));break;case"ArrowLeft":t.preventDefault(),r.seek(Math.max(r.currentTime-5,0));break;default:return}r.resetIdle()};if(e==="global")return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s);let c=d.current;if(c)return c.addEventListener("keydown",s),()=>c.removeEventListener("keydown",s)},[e,d])}function Ue(d,e,n){let[i,s]=p.useState(e),c=d!==void 0,t=c?d:i,a=p.useCallback(r=>{let o=typeof r=="function"?r(t):r;c||s(o),_optionalChain([n, 'optionalCall', _18 => _18(o)])},[c,t,n]);return[t,a]}function ln({rootRef:d,videoRef:e,actionsRef:n,defaultPlaying:i=!1,defaultVolume:s=1,defaultMuted:c=!1,defaultPlaybackRate:t=1,playing:a,onPlayingChange:r,volume:o,onVolumeChange:l,muted:u,onMutedChange:f,playbackRate:y,onPlaybackRateChange:R,currentTime:g,onCurrentTimeChange:m,idleTimeout:x=3e3,preventIdleWhenPaused:v=!1,idle:b,onIdleChange:V,onEnded:C,onWaiting:B,onSeeking:D,onSeeked:q,onFullscreenChange:K,onPictureInPictureChange:T,children:W}){let O=p.useRef(1),[E,H]=p.useState("paused"),[Y,$]=p.useState(i?"play":"pause");p.useEffect(()=>{a!==void 0&&($(a?"play":"pause"),E!=="waiting"&&H(a?"playing":"paused"))},[a,E]);let[h,A]=Ue(o,s,l),[X,ae]=Ue(u,c,f),[fe,pt]=Ue(y,t,R),[Dr,Z]=Ue(b,!0,V),ee=p.useRef(null),me=p.useCallback(()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),ft=p.useCallback(()=>{x!==0&&(me(),ee.current=setTimeout(()=>{Z(!0)},x))},[x,me,Z]),mt=p.useCallback(()=>{Z(!1),ft()},[Z,ft]),Pt=p.useCallback(()=>{me(),Z(!0)},[me,Z]);p.useEffect(()=>(x>0&&(ee.current=setTimeout(()=>{Z(!0)},x)),()=>{ee.current&&clearTimeout(ee.current)}),[]);let Rt=v&&E!=="playing"?!1:Dr,[yt,St]=p.useState(0),[Pe,bt]=p.useState(0),[kt,Or]=p.useState(null),[Re,Ar]=p.useState(null),[gt,Fr]=p.useState(!1),[vt,Tt]=p.useState(!1),[ye,Wr]=p.useState(!1),[Se,xt]=p.useState(!1),[ht,ot]=p.useState([]),[te,Qr]=p.useState(null),[Ct,be]=p.useState([]),[Mt,hn]=p.useState([]),[Et,$r]=p.useState(null);p.useEffect(()=>{g!==void 0&&e.current&&(e.current.currentTime=g)},[g,e]),p.useEffect(()=>{let k=()=>{let M=document.fullscreenElement===d.current;Wr(M),_optionalChain([K, 'optionalCall', _19 => _19(M)])};return document.addEventListener("fullscreenchange",k),()=>document.removeEventListener("fullscreenchange",k)},[K,d]),p.useEffect(()=>{let k=e.current;if(!k)return;let M=()=>{xt(!0),_optionalChain([T, 'optionalCall', _20 => _20(!0)])},F=()=>{xt(!1),_optionalChain([T, 'optionalCall', _21 => _21(!1)])};return k.addEventListener("enterpictureinpicture",M),k.addEventListener("leavepictureinpicture",F),()=>{k.removeEventListener("enterpictureinpicture",M),k.removeEventListener("leavepictureinpicture",F)}},[T,e]);let ke=p.useCallback(async()=>{e.current&&($("play"),await e.current.play(),H("playing"),_optionalChain([r, 'optionalCall', _22 => _22(!0)]))},[e,r]),ge=p.useCallback(()=>{e.current&&($("pause"),e.current.pause(),H("paused"),_optionalChain([r, 'optionalCall', _23 => _23(!1)]))},[e,r]),ve=p.useCallback(async()=>{E==="playing"?ge():await ke()},[E,ke,ge]),Te=p.useCallback(k=>{e.current&&(e.current.currentTime=k,St(k),_optionalChain([m, 'optionalCall', _24 => _24(k)]))},[m,e]),xe=p.useCallback(k=>{let M=Math.max(0,Math.min(1,k));e.current&&(e.current.volume=M),A(M)},[A,e]),Vt=p.useCallback(()=>{if(!(X||h===0))O.current=h,e.current&&(e.current.muted=!0),ae(!0);else{let M=O.current>0?O.current:1;e.current&&(e.current.volume=M,e.current.muted=!1),A(M),ae(!1)}},[X,h,ae,A,e]),he=p.useCallback(async()=>{_optionalChain([d, 'access', _25 => _25.current, 'optionalAccess', _26 => _26.requestFullscreen])&&await d.current.requestFullscreen()},[d]),Ce=p.useCallback(async()=>{document.exitFullscreen&&await document.exitFullscreen()},[]),Me=p.useCallback(async()=>{ye?await Ce():await he()},[ye,he,Ce]),Ee=p.useCallback(async()=>{_optionalChain([e, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.requestPictureInPicture])&&await e.current.requestPictureInPicture()},[e]),Ve=p.useCallback(async()=>{document.pictureInPictureElement&&await document.exitPictureInPicture()},[]),Bt=p.useCallback(async()=>{Se?await Ve():await Ee()},[Se,Ee,Ve]),wt=p.useCallback(k=>{e.current&&(e.current.playbackRate=k),pt(k)},[pt,e]),Lt=p.useCallback(k=>{if(e.current){for(let M=0;M<e.current.textTracks.length;M++){let F=e.current.textTracks[M];F&&(F.mode="disabled")}k&&(k.mode="hidden")}Qr(k),be([])},[e]),It=p.useCallback(k=>{$r(k)},[]),Ht=p.useCallback(k=>{ot(M=>M.some(F=>F.id===k.id)?M:[...M,k])},[]),Dt=p.useCallback(k=>{ot(M=>M.filter(F=>F.id!==k))},[]),Ot=p.useCallback((k,M)=>{ot(F=>F.map(re=>re.id===k?{...re,textTrack:M}:re))},[]);p.useEffect(()=>{if(!te){be([]);return}let k=()=>{let M=te.activeCues;if(!M){be([]);return}let F=[];for(let re=0;re<M.length;re++){let Yt=M[re];Yt instanceof VTTCue&&F.push(Yt)}be(F)};return k(),te.addEventListener("cuechange",k),()=>{te.removeEventListener("cuechange",k)}},[te]),p.useImperativeHandle(n,()=>({toggle:ve,seek:Te,setVolume:xe,toggleFullscreen:Me}),[ve,Te,xe,Me]);let At=p.useCallback(()=>{if(e.current){let k=e.current.currentTime;St(k),_optionalChain([m, 'optionalCall', _29 => _29(k)])}},[m,e]),Ft=p.useCallback(()=>{e.current&&bt(e.current.duration)},[e]),Wt=p.useCallback(()=>{e.current&&Or(e.current.buffered)},[e]),Qt=p.useCallback(()=>{$("play"),H("playing"),_optionalChain([r, 'optionalCall', _30 => _30(!0)])},[r]),$t=p.useCallback(()=>{E!=="ended"&&(H("paused"),_optionalChain([r, 'optionalCall', _31 => _31(!1)]))},[E,r]),Nt=p.useCallback(()=>{$("pause"),H("ended"),_optionalChain([r, 'optionalCall', _32 => _32(!1)]),_optionalChain([C, 'optionalCall', _33 => _33()])},[r,C]),_t=p.useCallback(()=>{H("waiting"),_optionalChain([B, 'optionalCall', _34 => _34()])},[B]),jt=p.useCallback(()=>{if(E==="waiting"){let k=Y==="play"?"playing":"paused";H(k),_optionalChain([r, 'optionalCall', _35 => _35(k==="playing")])}Fr(!0)},[E,Y,r]),Ut=p.useCallback(()=>{Tt(!0),E==="ended"&&H("paused"),_optionalChain([D, 'optionalCall', _36 => _36()])},[E,D]),qt=p.useCallback(()=>{if(Tt(!1),e.current){let{currentTime:k,duration:M}=e.current;M>0&&M-k<.01&&H("ended")}_optionalChain([q, 'optionalCall', _37 => _37()])},[q,e]),Kt=p.useCallback(()=>{e.current&&(A(e.current.volume),ae(e.current.muted))},[A,ae,e]),Xt=p.useCallback(()=>{e.current&&bt(e.current.duration)},[e]),Nr=p.useMemo(()=>({playbackStatus:E,playbackIntent:Y,playing:E==="playing",paused:E==="paused",ended:E==="ended",waiting:E==="waiting",seeking:vt,canPlay:gt,currentTime:yt,duration:Pe,buffered:kt,hoverTime:Re,hoverProgress:Re!==null&&Pe>0?Re/Pe*100:null,volume:h,muted:X,fullscreen:ye,pictureInPicture:Se,idle:Rt,idleTimeout:x,preventIdleWhenPaused:v,registeredTracks:ht,activeTextTrack:te,activeCues:Ct,playbackRate:fe,qualities:Mt,activeQuality:Et,videoRef:e,rootRef:d,play:ke,pause:ge,toggle:ve,seek:Te,setVolume:xe,toggleMute:Vt,enterFullscreen:he,exitFullscreen:Ce,toggleFullscreen:Me,enterPictureInPicture:Ee,exitPictureInPicture:Ve,togglePictureInPicture:Bt,setPlaybackRate:wt,setTextTrack:Lt,setQuality:It,registerTrack:Ht,unregisterTrack:Dt,updateTrackRef:Ot,resetIdle:mt,setHoverTime:Ar,_handlers:{onTimeUpdate:At,onDurationChange:Ft,onProgress:Wt,onPlay:Qt,onPause:$t,onEnded:Nt,onWaiting:_t,onCanPlay:jt,onSeeking:Ut,onSeeked:qt,onVolumeChange:Kt,onLoadedMetadata:Xt,onRootMouseLeave:Pt}}),[E,Y,vt,gt,yt,Pe,kt,Re,h,X,ye,Se,Rt,x,v,ht,te,Ct,fe,Mt,Et,e,d,ke,ge,ve,Te,xe,Vt,he,Ce,Me,Ee,Ve,Bt,wt,Lt,It,Ht,Dt,Ot,mt,At,Ft,Wt,Qt,$t,Nt,_t,jt,Ut,qt,Kt,Xt,Pt]);return _jsxruntime.jsx.call(void 0, at.Provider,{value:Nr,children:W})}var mr=p.forwardRef(function(e,n){let{actionsRef:i,keyboardShortcuts:s="focused",defaultPlaying:c,defaultVolume:t,defaultMuted:a,defaultPlaybackRate:r,playing:o,onPlayingChange:l,volume:u,onVolumeChange:f,muted:y,onMutedChange:R,playbackRate:g,onPlaybackRateChange:m,currentTime:x,onCurrentTimeChange:v,idleTimeout:b,preventIdleWhenPaused:V,hideCursorWhenIdle:C="fullscreen",idle:B,onIdleChange:D,onEnded:q,onWaiting:K,onSeeking:T,onSeeked:W,onFullscreenChange:O,onPictureInPictureChange:E,children:H,...Y}=e,$=p.useRef(null),h=p.useRef(null);return _jsxruntime.jsx.call(void 0, ln,{actionsRef:i,defaultPlaying:c,defaultVolume:t,defaultMuted:a,defaultPlaybackRate:r,playing:o,onPlayingChange:l,volume:u,onVolumeChange:f,muted:y,onMutedChange:R,playbackRate:g,onPlaybackRateChange:m,currentTime:x,onCurrentTimeChange:v,idleTimeout:b,preventIdleWhenPaused:V,idle:B,onIdleChange:D,onEnded:q,onWaiting:K,onSeeking:T,onSeeked:W,onFullscreenChange:O,onPictureInPictureChange:E,rootRef:$,videoRef:h,children:_jsxruntime.jsx.call(void 0, un,{ref:n,rootRef:$,keyboardShortcuts:s,hideCursorWhenIdle:C,...Y,children:H})})}),un=p.forwardRef(function({rootRef:e,keyboardShortcuts:n,hideCursorWhenIdle:i,children:s,className:c,style:t,...a},r){let o=ne(),l=cn(r,e),u=p.useRef(null);fr(e,n);let f=p.useCallback(b=>{let{clientX:V,clientY:C}=b,B=u.current;B&&B.x===V&&B.y===C||(u.current={x:V,y:C},o.resetIdle())},[o]),y=p.useCallback(b=>{let{clientX:V,clientY:C}=b,B=u.current;B&&B.x===V&&B.y===C||(u.current={x:V,y:C},o.resetIdle())},[o]),R=p.useCallback(()=>{o._handlers.onRootMouseLeave()},[o._handlers]),g=p.useCallback(()=>{o.resetIdle()},[o]),m={"data-playing":o.playing||void 0,"data-paused":o.paused||void 0,"data-ended":o.ended||void 0,"data-waiting":o.waiting||void 0,"data-seeking":o.seeking||void 0,"data-fullscreen":o.fullscreen||void 0,"data-pip":o.pictureInPicture||void 0,"data-muted":o.muted||void 0,"data-idle":o.idle||void 0},x=i!==!1&&o.idle&&(i==="always"||i==="fullscreen"&&o.fullscreen),v=p.useId();return _jsxruntime.jsxs.call(void 0, "div",{ref:l,tabIndex:n==="focused"?0:void 0,className:c,style:t,"data-video-player-scope":v,...m,...a,onMouseMove:f,onMouseEnter:y,onMouseLeave:R,onClick:g,children:[x&&_jsxruntime.jsx.call(void 0, "style",{children:`[data-video-player-scope="${v}"], [data-video-player-scope="${v}"] * { cursor: none !important; }`}),s]})});function cn(...d){return p.useCallback(e=>{for(let n of d)typeof n=="function"?n(e):n!=null&&(n.current=e)},d)}var Ke=(t=>(t.progress="--seek-progress",t.buffered="--seek-buffered",t.currentTime="--seek-current-time",t.duration="--seek-duration",t.hoverProgress="--seek-hover-progress",t.hoverTime="--seek-hover-time",t))(Ke||{});var Xe=(s=>(s.seeking="data-seeking",s.hovering="data-hovering",s.pressing="data-pressing",s.dragging="data-dragging",s))(Xe||{});var _slider = require('@base-ui/react/slider');var _react2 = require('@floating-ui/react');var Ye=(s=>(s.open="data-open",s.closed="data-closed",s.startingStyle="data-starting-style",s.endingStyle="data-ending-style",s))(Ye||{});var ct=S.createContext(null);function Rr(d){let e=S.useContext(ct);if(!e)throw new Error(`${d} must be used within SeekSlider`);return e}var yr=S.forwardRef(function(e,n){let{render:i,children:s,onPointerMove:c,onPointerLeave:t,onPointerDown:a,onValueCommitted:r,...o}=e,l=P("SeekSlider"),u=S.useRef(null),[f,y]=S.useState(null),[R,g]=S.useState(!1),[m,x]=S.useState(!1),v=S.useRef(!1);S.useEffect(()=>{if(!R)return;let h=()=>{g(!1),x(!1),v.current=!1};return window.addEventListener("pointerup",h),()=>window.removeEventListener("pointerup",h)},[R]);let b=l.duration>0?l.currentTime/l.duration*100:0,V=S.useCallback(h=>{let A=typeof h=="number"?h:h[0];A!==void 0&&(l.seek(A),l.resetIdle(),v.current&&x(!0))},[l]),C=S.useCallback(h=>{if(_optionalChain([c, 'optionalCall', _38 => _38(h)]),!u.current||l.duration===0)return;let A=u.current.getBoundingClientRect(),X=h.clientX-A.left,fe=Math.max(0,Math.min(1,X/A.width))*l.duration;l.setHoverTime(fe)},[c,l]),B=S.useCallback(h=>{_optionalChain([t, 'optionalCall', _39 => _39(h)]),l.setHoverTime(null)},[t,l]),D=S.useCallback(h=>{_optionalChain([a, 'optionalCall', _40 => _40(h)]),g(!0),v.current=!0},[a]),q=S.useCallback((h,A)=>{let X=typeof h=="number"?h:h[0];X!==void 0&&(_optionalChain([r, 'optionalCall', _41 => _41(X,A)]),g(!1),x(!1),v.current=!1)},[r]),K=S.useMemo(()=>{if(!l.buffered||l.buffered.length===0)return 0;for(let h=0;h<l.buffered.length;h++)if(l.buffered.start(h)<=l.currentTime&&l.currentTime<=l.buffered.end(h))return l.buffered.end(h);return l.buffered.end(0)},[l.buffered,l.currentTime]),T=l.duration>0?K/l.duration*100:0;S.useLayoutEffect(()=>{typeof n=="function"?n(u.current):n&&(n.current=u.current)});let W={currentTime:l.currentTime,duration:l.duration,progress:b,seeking:l.seeking,pressing:R,dragging:m,hoverTime:l.hoverTime,hoverProgress:l.hoverProgress},O=l.hoverProgress!==null,E=_nullishCoalesce(l.hoverProgress, () => (0)),H=S.useMemo(()=>({sliderRef:u,previewThumbElement:f,setPreviewThumbElement:y,hoverProgress:E,open:O}),[u,f,y,E,O]),Y={position:"relative","--seek-progress":`${b}%`,"--seek-buffered":`${T}%`,"--seek-current-time":l.currentTime,"--seek-duration":l.duration,"--seek-hover-progress":l.hoverProgress!==null?`${l.hoverProgress}%`:void 0,"--seek-hover-time":_nullishCoalesce(l.hoverTime, () => (void 0)),...o.style},$={"data-seeking":l.seeking||void 0,"data-hovering":l.hoverTime!==null||void 0,"data-pressing":R||void 0,"data-dragging":m||void 0,style:Y};return i?_jsxruntime.jsx.call(void 0, ct.Provider,{value:H,children:_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:u,min:0,max:l.duration||100,step:.1,value:l.currentTime,onValueChange:V,onValueCommitted:q,onPointerMove:C,onPointerLeave:B,onPointerDown:D,"aria-label":"Seek",render:h=>i({...h,...$,style:{...h.style,...$.style}},W)})}):_jsxruntime.jsx.call(void 0, ct.Provider,{value:H,children:_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:u,min:0,max:l.duration||100,step:.1,value:l.currentTime,onValueChange:V,onValueCommitted:q,onPointerMove:C,onPointerLeave:B,onPointerDown:D,"aria-label":"Seek",...$,...o,children:_nullishCoalesce(s, () => (_jsxruntime.jsx.call(void 0, _slider.Slider.Control,{children:_jsxruntime.jsxs.call(void 0, _slider.Slider.Track,{style:{position:"relative"},children:[_jsxruntime.jsx.call(void 0, "div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${T}%`}}),_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{}),_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{})]})})))})})}),Sr=_slider.Slider.Control,br=S.forwardRef(function(e,n){let{render:i,children:s,style:c,...t}=e,a={},r={position:"relative",...c},o={ref:n,style:r};return i?_jsxruntime.jsx.call(void 0, _slider.Slider.Track,{render:l=>i({...l,...o},a)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Track,{ref:n,style:r,...t,children:s})}),kr=S.forwardRef(function(e,n){let{render:i,children:s,style:c,...t}=e,a=P("SeekSliderProgress"),o={progress:a.duration>0?a.currentTime/a.duration*100:0},l={height:"100%",...c},u={ref:n,style:l};return i?_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{render:f=>i({...f,...u,style:{...f.style,...l}},o)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{ref:n,style:l,...t,children:s})}),gr=S.forwardRef(function(e,n){let{render:i,children:s,style:c,...t}=e,a={},r={ref:n,style:_nullishCoalesce(c, () => ({}))};return i?_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{render:o=>i({...o,...r,style:{...o.style,...c}},a)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{ref:n,style:c,...t,children:s})}),vr=S.forwardRef(function(e,n){let{render:i,children:s,...c}=e,t=P("SeekSliderBuffered"),a=S.useMemo(()=>{if(!t.buffered||t.buffered.length===0)return 0;for(let f=0;f<t.buffered.length;f++)if(t.buffered.start(f)<=t.currentTime&&t.currentTime<=t.buffered.end(f))return t.buffered.end(f);return t.buffered.end(0)},[t.buffered,t.currentTime]),r=t.duration>0?a/t.duration*100:0,o={bufferedPercentage:r},l={position:"absolute",left:0,top:0,height:"100%",width:`${r}%`,...c.style},u={ref:n,style:l};return i?i(u,o):_jsxruntime.jsx.call(void 0, "div",{...u,...c,children:s})}),Tr=S.forwardRef(function(e,n){let{keepMounted:i=!1,render:s,children:c,...t}=e,a=P("SeekSliderPreviewThumb"),r=Rr("SeekSliderPreviewThumb"),o=a.hoverProgress!==null,l=S.useRef(0);a.hoverProgress!==null&&(l.current=a.hoverProgress);let u=_nullishCoalesce(a.hoverProgress, () => (l.current)),{mounted:f,transitionStatus:y,elementRef:R}=j({open:o,keepMounted:i}),g=S.useCallback(b=>{R.current=b,r.setPreviewThumbElement(b),typeof n=="function"?n(b):n&&(n.current=b)},[n,R,r]),m={open:o,transitionStatus:y,hoverProgress:u},x={position:"absolute",left:`${u}%`,transform:"translateX(-50%)",pointerEvents:"none",...t.style},v={ref:g,style:x,"data-open":o||void 0,"data-closed":!o||void 0,"data-starting-style":y==="starting"||void 0,"data-ending-style":y==="ending"||void 0};return f?s?s(v,m):_jsxruntime.jsx.call(void 0, "span",{...v,...t,children:c}):null}),xr=S.forwardRef(function(e,n){let{render:i,children:s,style:c,...t}=e,a=P("SeekSliderHover"),r=a.hoverProgress!==null,o=_nullishCoalesce(a.hoverProgress, () => (0)),l={hovering:r,hoverProgress:a.hoverProgress,hoverTime:a.hoverTime},u={position:"absolute",left:0,top:0,height:"100%",width:`${o}%`,pointerEvents:"none",...c},f={ref:n,style:u,"data-hovering":r||void 0};return i?i(f,l):_jsxruntime.jsx.call(void 0, "div",{...f,...t,children:s})});function Ge({children:d,container:e}){let n=P("SeekSliderPreviewTooltipPortal"),[i,s]=S.useState(!1);if(S.useEffect(()=>{s(!0)},[]),!i)return null;let c=_nullishCoalesce(_nullishCoalesce(e, () => (n.rootRef.current)), () => (document.body));return Pr.createPortal(d,c)}var ze=S.forwardRef(function(e,n){let{sideOffset:i=8,collisionPadding:s=0,collisionBoundary:c,keepMounted:t=!1,children:a,style:r,...o}=e,l=Rr("SeekSliderPreviewTooltipPositioner"),{previewThumbElement:u,open:f,hoverProgress:y}=l,[R,g]=S.useState(null),{refs:m,floatingStyles:x,update:v}=_react2.useFloating.call(void 0, {placement:"top",middleware:[_react2.offset.call(void 0, i),_react2.shift.call(void 0, {boundary:c,padding:s})]});S.useLayoutEffect(()=>{u&&m.setReference(u)},[u,m]),S.useEffect(()=>{if(f&&u&&R)return _react2.autoUpdate.call(void 0, u,R,v)},[f,u,R,v]),S.useLayoutEffect(()=>{f&&u&&R&&v()},[y,f,u,R,v]);let b=S.useCallback(C=>{m.setFloating(C),g(C),typeof n=="function"?n(C):n&&(n.current=C)},[m,n]);return(t||f)&&!!u?_jsxruntime.jsx.call(void 0, "div",{ref:b,style:{...x,...r},"data-seek-slider-preview-tooltip-positioner":!0,"data-open":f||void 0,"data-closed":!f||void 0,...o,children:a}):null}),Je=S.forwardRef(function(e,n){let{children:i,...s}=e;return _jsxruntime.jsx.call(void 0, "div",{ref:n,"data-seek-slider-preview-tooltip-popup":!0,...s,children:i})});function de({sideOffset:d,collisionPadding:e,collisionBoundary:n,keepMounted:i,container:s,children:c,...t}){return _jsxruntime.jsx.call(void 0, Ge,{container:s,children:_jsxruntime.jsx.call(void 0, ze,{sideOffset:d,collisionPadding:e,collisionBoundary:n,keepMounted:i,children:_jsxruntime.jsx.call(void 0, Je,{...t,children:c})})})}de.Portal=Ge;de.Positioner=ze;de.Popup=Je;var Ze=(i=>(i.loading="data-loading",i.ready="data-ready",i.error="data-error",i))(Ze||{});var hr=I.forwardRef(function(e,n){let{time:i,crossOrigin:s="anonymous",render:c,children:t,width:a,height:r,...o}=e,l=P("Thumbnail"),u=I.useRef(null),f=I.useRef(null),y=I.useRef(null),[R,g]=I.useState("idle"),[m,x]=I.useState({width:160,height:90}),v=i!==void 0?i:l.hoverTime,b=I.useMemo(()=>{let T=l.videoRef.current;return T?T.currentSrc||T.src:null},[l.videoRef]);I.useEffect(()=>{if(!b)return;let T=document.createElement("video");T.src=b,T.crossOrigin=s,T.preload="metadata",T.muted=!0,T.playsInline=!0;let W=()=>{x({width:T.videoWidth,height:T.videoHeight})},O=()=>{g("error")};return T.addEventListener("loadedmetadata",W),T.addEventListener("error",O),f.current=T,()=>{T.removeEventListener("loadedmetadata",W),T.removeEventListener("error",O),T.src="",f.current=null}},[b,s]),I.useEffect(()=>{let T=f.current,W=u.current;if(!T||!W||v===null||v===void 0||y.current!==null&&Math.abs(y.current-v)<.1)return;g("loading");let O=()=>{let E=W.getContext("2d");if(E)try{E.drawImage(T,0,0,W.width,W.height),y.current=v,g("ready")}catch (e2){g("error")}};return T.addEventListener("seeked",O,{once:!0}),T.currentTime=v,()=>{T.removeEventListener("seeked",O)}},[v]);let V=I.useCallback(T=>{u.current=T,typeof n=="function"?n(T):n&&(n.current=T)},[n]),C=m.width/m.height,B=_nullishCoalesce(a, () => (160)),D=_nullishCoalesce(r, () => (Math.round(B/C)));typeof B=="string"&&(B=160),typeof D=="string"&&(D=90);let q={loading:R==="loading",ready:R==="ready",error:R==="error",time:v,videoWidth:m.width,videoHeight:m.height},K={ref:V,width:B,height:D,"data-loading":R==="loading"||void 0,"data-ready":R==="ready"||void 0,"data-error":R==="error"||void 0};return c?c(K,q):_jsxruntime.jsx.call(void 0, "canvas",{...K,...o,children:t})});var et=(e=>(e.hovering="data-hovering",e))(et||{});var Cr=tt.forwardRef(function(e,n){let{format:i="current / duration",fixedWidth:s=!0,align:c="left",render:t,...a}=e,r=P("TimeDisplay"),o=tt.useRef(0);r.hoverTime!==null&&(o.current=r.hoverTime);let l=r.duration-r.currentTime,u=pe(r.currentTime),f=pe(r.duration),y=pe(l),R=r.hoverTime!==null?pe(r.hoverTime):pe(o.current),g={currentTime:r.currentTime,duration:r.duration,remaining:l,hoverTime:r.hoverTime,hovering:r.hoverTime!==null,formattedCurrent:u,formattedDuration:f,formattedRemaining:y,formattedHover:R},m=()=>{switch(i){case"current":return u;case"duration":return f;case"remaining":return`-${y}`;case"current / duration":return`${u} / ${f}`;case"current / remaining":return`${u} / -${y}`;case"hover":return R;default:return`${u} / ${f}`}},x=()=>{let b=bn(r.duration);switch(i){case"current":case"duration":case"hover":return b;case"remaining":return`-${b}`;case"current / duration":return`${b} / ${b}`;case"current / remaining":return`${b} / -${b}`;default:return`${b} / ${b}`}},v={ref:n,style:{position:s?"relative":void 0,userSelect:"none",fontVariantNumeric:"tabular-nums",...a.style},"data-hovering":g.hovering||void 0};return t?t(v,g):_jsxruntime.jsx.call(void 0, "span",{ref:n,"data-hovering":g.hovering||void 0,...a,style:{position:s?"relative":void 0,userSelect:"none",fontVariantNumeric:"tabular-nums",...a.style},children:s?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{"aria-hidden":!0,style:{visibility:"hidden"},children:x()}),_jsxruntime.jsx.call(void 0, "span",{style:Sn(c),children:m()})]}):m()})});function Sn(d){let e={position:"absolute"};switch(d){case"left":return{...e,left:0};case"right":return{...e,right:0};case"center":return{...e,left:"50%",transform:"translateX(-50%)"}}}function pe(d){if(!Number.isFinite(d)||Number.isNaN(d))return"0:00";let e=Math.floor(d/3600),n=Math.floor(d%3600/60),i=Math.floor(d%60);return e>0?`${e}:${n.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`:`${n}:${i.toString().padStart(2,"0")}`}function bn(d){if(!Number.isFinite(d)||Number.isNaN(d)||d<=0)return"0:00";let e=Math.floor(d/3600),n=Math.floor(d%3600/60);if(e>0){let s=String(e).length;return`${"0".repeat(s)}:00:00`}let i=String(n).length;return`${"0".repeat(i)}:00`}var Mr=N.forwardRef(function(e,n){let{kind:i="captions",src:s,label:c,srcLang:t,default:a,...r}=e,{registerTrack:o,unregisterTrack:l,updateTrackRef:u,setTextTrack:f}=P("Track"),y=N.useRef(null),R=N.useId(),g=N.useCallback(m=>{typeof n=="function"?n(m):n&&(n.current=m),y.current=m},[n]);return N.useEffect(()=>(o({id:R,kind:i,label:c,srcLang:t,src:s,textTrack:null}),()=>{l(R)}),[R,i,c,t,s,o,l]),N.useEffect(()=>{let m=y.current;if(!m)return;let x=()=>{m.track&&(m.track.mode="disabled",u(R,m.track),a&&f(m.track))};return m.track&&x(),m.addEventListener("load",x),()=>{m.removeEventListener("load",x)}},[R,a,u,f]),_jsxruntime.jsx.call(void 0, "track",{ref:g,kind:i,src:s,label:c,srcLang:t,default:a,...r})});var Er=oe.forwardRef(function(e,n){let{toggleOnClick:i=!0,onClick:s,...c}=e,t=P("Video"),a=oe.useRef(!1),r=oe.useCallback(u=>{typeof n=="function"?n(u):n&&(n.current=u),t.videoRef.current=u,u&&!a.current&&(a.current=!0,u.readyState>=1&&u.duration&&(t._handlers.onLoadedMetadata(),t._handlers.onDurationChange()),u.readyState>=3&&t._handlers.onCanPlay())},[n,t.videoRef,t._handlers]),o=oe.useCallback(u=>{_optionalChain([s, 'optionalCall', _42 => _42(u)]),!u.defaultPrevented&&i&&t.toggle()},[s,i,t]),l={"data-playing":t.playing||void 0,"data-paused":t.paused||void 0,"data-ended":t.ended||void 0,"data-waiting":t.waiting||void 0,"data-seeking":t.seeking||void 0};return _jsxruntime.jsx.call(void 0, "video",{ref:r,preload:"metadata",...l,...c,onClick:o,onTimeUpdate:t._handlers.onTimeUpdate,onDurationChange:t._handlers.onDurationChange,onProgress:t._handlers.onProgress,onPlay:t._handlers.onPlay,onPause:t._handlers.onPause,onEnded:t._handlers.onEnded,onWaiting:t._handlers.onWaiting,onCanPlay:t._handlers.onCanPlay,onSeeking:t._handlers.onSeeking,onSeeked:t._handlers.onSeeked,onVolumeChange:t._handlers.onVolumeChange,onLoadedMetadata:t._handlers.onLoadedMetadata})});var rt=(n=>(n.volume="--volume",n.volumePercentage="--volume-percentage",n))(rt||{});var nt=(s=>(s.muted="data-muted",s.volume="data-volume",s.pressing="data-pressing",s.dragging="data-dragging",s))(nt||{});var Vr=L.forwardRef(function(e,n){let{render:i,children:s,onPointerDown:c,...t}=e,a=P("VolumeSlider"),r=L.useRef(null),[o,l]=L.useState(!1),[u,f]=L.useState(!1),y=L.useRef(!1);L.useEffect(()=>{if(!o)return;let C=()=>{l(!1),f(!1),y.current=!1};return window.addEventListener("pointerup",C),()=>window.removeEventListener("pointerup",C)},[o]),L.useLayoutEffect(()=>{typeof n=="function"?n(r.current):n&&(n.current=r.current)});let R=a.volume*100,g={volume:a.volume,muted:a.muted,percentage:R,pressing:o,dragging:u},m=L.useCallback(C=>{let B=typeof C=="number"?C:C[0];if(B!==void 0){if(a.muted){let D=a.videoRef.current;D&&(D.muted=!1)}a.setVolume(B),a.resetIdle(),y.current&&f(!0)}},[a]),x=L.useCallback(C=>{_optionalChain([c, 'optionalCall', _43 => _43(C)]),l(!0),y.current=!0},[c]),v={"data-muted":a.muted||void 0,"data-volume":a.volume,"data-pressing":o||void 0,"data-dragging":u||void 0},b={position:"relative","--volume":a.volume,"--volume-percentage":`${R}%`,...t.style},V={"data-muted":a.muted||void 0,"data-volume":a.volume,"data-pressing":o||void 0,"data-dragging":u||void 0,style:b};return i?_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:r,min:0,max:1,step:.01,value:a.muted?0:a.volume,onValueChange:m,onPointerDown:x,"aria-label":"Volume",render:C=>i({...C,...V},g)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:r,min:0,max:1,step:.01,value:a.muted?0:a.volume,onValueChange:m,onPointerDown:x,"aria-label":"Volume",...v,...t,style:b,children:_nullishCoalesce(s, () => (_jsxruntime.jsx.call(void 0, _slider.Slider.Control,{children:_jsxruntime.jsxs.call(void 0, _slider.Slider.Track,{children:[_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{}),_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{})]})})))})}),Br=_slider.Slider.Control,wr=L.forwardRef(function(e,n){let{style:i,...s}=e,c={position:"relative",...i};return _jsxruntime.jsx.call(void 0, _slider.Slider.Track,{ref:n,style:c,...s})}),Lr=L.forwardRef(function(e,n){return _jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{ref:n,...e})}),Ir=L.forwardRef(function(e,n){return _jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{ref:n,...e})});exports.VideoPlayer = Hr; exports.useVideoPlayer = ne;
3
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/ui/ui/packages/react/dist/video-player/index.cjs","../../src/video-player/contexts/video-player-context.ts","../../src/video-player/hooks/use-video-player.ts","../../src/video-player/index.parts.ts","../../src/video-player/components/buffered-indicator/buffered-indicator.tsx","../../src/video-player/hooks/use-transition-status.ts"],"names":["VideoPlayerContext","useVideoPlayerContext","component","context","useVideoPlayer","index_parts_exports","__export","BufferedIndicator","Captions","CaptionsButton","CaptionsDataAttributes","CaptionsMenu","CaptionsMenuItem","Controls","ControlsDataAttributes","FullscreenButton","MuteButton","Overlay","OverlayDataAttributes","PictureInPictureButton","PlayButton","PlaybackRateButton","PlaybackRateMenu","PlaybackRateMenuItem","Portal","Poster","QualityMenu","QualityMenuItem","VideoPlayerRoot","RootDataAttributes","SeekSlider","SeekSliderBuffered","SeekSliderControl","SeekSliderCssVars","SeekSliderDataAttributes","SeekSliderHover","SeekSliderPreviewThumb","SeekSliderPreviewThumbDataAttributes","SeekSliderPreviewTooltip","SeekSliderPreviewTooltipPopup","SeekSliderPreviewTooltipPortal","SeekSliderPreviewTooltipPositioner","SeekSliderProgress","SeekSliderThumb","SeekSliderTrack","Thumbnail","ThumbnailDataAttributes","TimeDisplay","TimeDisplayDataAttributes","Track","Video","VolumeSlider","VolumeSliderControl","VolumeSliderCssVars","VolumeSliderDataAttributes","VolumeSliderRange","VolumeSliderThumb","VolumeSliderTrack","useTransitionStatus","props","forwardedRef","render","divProps","bufferedEnd","i","bufferedPercentage","state","style"],"mappings":"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","file":"/home/runner/work/ui/ui/packages/react/dist/video-player/index.cjs","sourcesContent":[null,"'use client'\n\nimport * as React from 'react'\nimport type { VideoPlayerContextValue } from '../types.js'\n\nexport const VideoPlayerContext =\n React.createContext<VideoPlayerContextValue | null>(null)\n\nexport function useVideoPlayerContext(\n component: string,\n): VideoPlayerContextValue {\n const context = React.useContext(VideoPlayerContext)\n if (!context) {\n throw new Error(\n `<VideoPlayer.${component}> must be used within <VideoPlayer.Root>`,\n )\n }\n return context\n}\n","'use client'\n\nimport { useVideoPlayerContext } from '../contexts/video-player-context.js'\nimport type { VideoPlayerContextValue } from '../types.js'\n\n/**\n * Hook to access the VideoPlayer context from custom components.\n *\n * @example\n * ```tsx\n * function CustomControl() {\n * const { playing, toggle, currentTime, duration } = useVideoPlayer()\n *\n * return (\n * <div>\n * {playing ? 'Playing' : 'Paused'} - {currentTime}s / {duration}s\n * <button onClick={toggle}>Toggle</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useVideoPlayer(): VideoPlayerContextValue {\n return useVideoPlayerContext('useVideoPlayer')\n}\n","// ============================================================================\n// VideoPlayer Composable Parts\n// ============================================================================\n//\n// Import like: import * as VideoPlayer from './video-player/index.parts.js'\n//\n// Usage:\n// <VideoPlayer.Root>\n// <VideoPlayer.Video src=\"...\" />\n// <VideoPlayer.Controls>\n// <VideoPlayer.PlayButton />\n// <VideoPlayer.SeekSlider />\n// <VideoPlayer.TimeDisplay />\n// </VideoPlayer.Controls>\n// </VideoPlayer.Root>\n//\n\nexport { BufferedIndicator } from './components/buffered-indicator/buffered-indicator.js'\nexport { CaptionsDataAttributes } from './components/captions/captions.data-attributes.js'\nexport { Captions } from './components/captions/captions.js'\n// Captions\nexport { CaptionsButton } from './components/captions-button/captions-button.js'\nexport {\n CaptionsMenu,\n CaptionsMenuItem,\n} from './components/captions-menu/captions-menu.js'\nexport { ControlsDataAttributes } from './components/controls/controls.data-attributes.js'\nexport { Controls } from './components/controls/controls.js'\n// Display Controls\nexport { FullscreenButton } from './components/fullscreen-button/fullscreen-button.js'\nexport { MuteButton } from './components/mute-button/mute-button.js'\nexport { OverlayDataAttributes } from './components/overlay/overlay.data-attributes.js'\nexport { Overlay } from './components/overlay/overlay.js'\nexport { PictureInPictureButton } from './components/picture-in-picture-button/picture-in-picture-button.js'\n// Playback Controls\nexport { PlayButton } from './components/play-button/play-button.js'\n// Playback Rate\nexport { PlaybackRateButton } from './components/playback-rate-button/playback-rate-button.js'\nexport {\n PlaybackRateMenu,\n PlaybackRateMenuItem,\n} from './components/playback-rate-menu/playback-rate-menu.js'\n// Layout\nexport { Portal } from './components/portal/portal.js'\nexport { Poster } from './components/poster/poster.js'\n// Quality\nexport {\n QualityMenu,\n QualityMenuItem,\n} from './components/quality-menu/quality-menu.js'\n// Data Attributes & CSS Variables\nexport { RootDataAttributes } from './components/root/root.data-attributes.js'\n// Core\nexport { VideoPlayerRoot as Root } from './components/root/root.js'\nexport { SeekSliderCssVars } from './components/seek-slider/seek-slider.css-vars.js'\nexport { SeekSliderDataAttributes } from './components/seek-slider/seek-slider.data-attributes.js'\nexport {\n SeekSlider,\n SeekSliderBuffered,\n SeekSliderControl,\n SeekSliderHover,\n SeekSliderPreviewThumb,\n SeekSliderPreviewTooltip,\n SeekSliderPreviewTooltipPopup,\n SeekSliderPreviewTooltipPortal,\n SeekSliderPreviewTooltipPositioner,\n SeekSliderProgress,\n SeekSliderThumb,\n SeekSliderTrack,\n} from './components/seek-slider/seek-slider.js'\nexport { SeekSliderPreviewThumbDataAttributes } from './components/seek-slider/seek-slider-preview-thumb.data-attributes.js'\nexport { ThumbnailDataAttributes } from './components/thumbnail/thumbnail.data-attributes.js'\nexport { Thumbnail } from './components/thumbnail/thumbnail.js'\nexport { TimeDisplayDataAttributes } from './components/time-display/time-display.data-attributes.js'\nexport { TimeDisplay } from './components/time-display/time-display.js'\nexport { Track } from './components/track/track.js'\nexport { Video } from './components/video/video.js'\nexport { VolumeSliderCssVars } from './components/volume-slider/volume-slider.css-vars.js'\nexport { VolumeSliderDataAttributes } from './components/volume-slider/volume-slider.data-attributes.js'\n// Audio Controls\nexport {\n VolumeSlider,\n VolumeSliderControl,\n VolumeSliderRange,\n VolumeSliderThumb,\n VolumeSliderTrack,\n} from './components/volume-slider/volume-slider.js'\nexport {\n type TransitionStatus,\n type UseTransitionStatusOptions,\n type UseTransitionStatusReturn,\n useTransitionStatus,\n} from './hooks/use-transition-status.js'\n// Hooks\nexport { useVideoPlayer } from './hooks/use-video-player.js'\n// Types\nexport type {\n PlaybackIntent,\n PlaybackStatus,\n RenderProp,\n TrackInfo,\n VideoPlayerActions,\n VideoPlayerContextValue,\n VideoPlayerRootProps,\n VideoPlayerState,\n VideoQuality,\n VideoTextTrack,\n} from './types.js'\n","'use client'\n\nimport * as React from 'react'\nimport { useVideoPlayerContext } from '../../contexts/video-player-context.js'\nimport type { RenderProp } from '../../types.js'\n\n// ============================================================================\n// BufferedIndicator Props\n// ============================================================================\n\nexport interface BufferedIndicatorProps\n extends React.ComponentPropsWithRef<'div'> {\n render?: RenderProp<BufferedIndicatorRenderProps, BufferedIndicatorState>\n}\n\nexport interface BufferedIndicatorRenderProps {\n ref: React.Ref<HTMLElement>\n style: React.CSSProperties\n 'aria-hidden': true\n}\n\nexport interface BufferedIndicatorState {\n buffered: TimeRanges | null\n duration: number\n bufferedPercentage: number\n bufferedEnd: number\n}\n\n// ============================================================================\n// BufferedIndicator Component\n// ============================================================================\n\nexport const BufferedIndicator = React.forwardRef<\n HTMLDivElement,\n BufferedIndicatorProps\n>(function BufferedIndicator(props, forwardedRef) {\n const { render, ...divProps } = props\n const context = useVideoPlayerContext('BufferedIndicator')\n\n // Calculate buffered end position (for progress bar display)\n const bufferedEnd = React.useMemo(() => {\n if (!context.buffered || context.buffered.length === 0) return 0\n\n // Find the buffer range that contains current playback position\n for (let i = 0; i < context.buffered.length; i++) {\n if (\n context.buffered.start(i) <= context.currentTime &&\n context.currentTime <= context.buffered.end(i)\n ) {\n return context.buffered.end(i)\n }\n }\n\n // Fallback to end of first range\n return context.buffered.end(0)\n }, [context.buffered, context.currentTime])\n\n const bufferedPercentage =\n context.duration > 0 ? (bufferedEnd / context.duration) * 100 : 0\n\n const state: BufferedIndicatorState = {\n buffered: context.buffered,\n duration: context.duration,\n bufferedPercentage,\n bufferedEnd,\n }\n\n // CSS custom properties for styling\n const style = {\n '--buffered-percentage': `${bufferedPercentage}%`,\n '--buffered-end': bufferedEnd,\n ...divProps.style,\n } as React.CSSProperties\n\n const renderProps: BufferedIndicatorRenderProps = {\n ref: forwardedRef,\n style,\n 'aria-hidden': true,\n }\n\n if (render) {\n return render(renderProps, state)\n }\n\n return (\n <div ref={forwardedRef} aria-hidden=\"true\" {...divProps} style={style} />\n )\n})\n\n// ============================================================================\n// Namespace\n// ============================================================================\n\nexport namespace BufferedIndicator {\n export type Props = BufferedIndicatorProps\n export type State = BufferedIndicatorState\n}\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type TransitionStatus = 'starting' | 'ending' | undefined\n\nexport interface UseTransitionStatusOptions {\n /**\n * Whether the element should be visible/open.\n */\n open: boolean\n /**\n * Keep the element always mounted in the DOM, even when closed.\n * Only needed for JavaScript animation libraries (e.g., Framer Motion).\n * CSS transitions and animations work automatically without this.\n * @default false\n */\n keepMounted?: boolean\n}\n\nexport interface UseTransitionStatusReturn {\n /**\n * Whether the element should be rendered in the DOM.\n * Stays true during exit animations.\n */\n mounted: boolean\n /**\n * Current transition status:\n * - 'starting': First frame of enter animation\n * - 'ending': Exit animation in progress\n * - undefined: Idle state\n */\n transitionStatus: TransitionStatus\n /**\n * Ref to attach to the animated element.\n * Used to detect when CSS animations/transitions complete.\n */\n elementRef: React.RefObject<HTMLElement | null>\n}\n\n// ============================================================================\n// Utility: Wait for Animations\n// ============================================================================\n\n/**\n * Returns a promise that resolves when all CSS animations and transitions\n * on the element and its descendants have completed.\n */\nfunction waitForAnimations(element: HTMLElement): Promise<void> {\n // Collect animations from the element and all descendants\n const animations = [\n ...element.getAnimations(),\n ...Array.from(element.querySelectorAll('*')).flatMap((el) =>\n (el as HTMLElement).getAnimations(),\n ),\n ]\n\n if (animations.length === 0) {\n return Promise.resolve()\n }\n return Promise.all(animations.map((a) => a.finished))\n .then(() => {})\n .catch(() => {\n // Animation was cancelled (e.g., element removed or animation interrupted)\n })\n}\n\n// ============================================================================\n// Hook: useTransitionStatus\n// ============================================================================\n\nexport function useTransitionStatus(\n options: UseTransitionStatusOptions,\n): UseTransitionStatusReturn {\n const { open, keepMounted = false } = options\n\n const [mounted, setMounted] = React.useState(open || keepMounted)\n const [transitionStatus, setTransitionStatus] =\n React.useState<TransitionStatus>(open ? 'starting' : undefined)\n\n const elementRef = React.useRef<HTMLElement | null>(null)\n\n // Track if we're currently waiting for animations\n const waitingForAnimationsRef = React.useRef(false)\n\n // Handle open → true (enter)\n React.useEffect(() => {\n if (open) {\n // Cancel any pending exit\n waitingForAnimationsRef.current = false\n\n setMounted(true)\n setTransitionStatus('starting')\n\n // Clear starting style after first paint (double RAF for reliability)\n const raf = requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n setTransitionStatus(undefined)\n })\n })\n\n return () => cancelAnimationFrame(raf)\n }\n }, [open])\n\n // Handle open → false (exit)\n React.useEffect(() => {\n if (!open && mounted && !waitingForAnimationsRef.current) {\n setTransitionStatus('ending')\n\n const element = elementRef.current\n\n if (!element) {\n // No element ref, unmount immediately\n setTransitionStatus(undefined)\n if (!keepMounted) {\n setMounted(false)\n }\n return\n }\n\n waitingForAnimationsRef.current = true\n\n // Wait a frame for the browser to process style changes and start animations\n const raf = requestAnimationFrame(() => {\n // Double RAF for reliability (like enter animation)\n requestAnimationFrame(() => {\n waitForAnimations(element).then(() => {\n // Check if we're still supposed to be unmounting\n // (user might have re-opened during animation)\n if (!waitingForAnimationsRef.current) return\n\n waitingForAnimationsRef.current = false\n setTransitionStatus(undefined)\n\n if (!keepMounted) {\n setMounted(false)\n }\n })\n })\n })\n\n return () => {\n cancelAnimationFrame(raf)\n }\n }\n }, [open, mounted, keepMounted])\n\n // Handle keepMounted change\n React.useEffect(() => {\n if (keepMounted && !mounted && !open) {\n setMounted(true)\n }\n }, [keepMounted, mounted, open])\n\n return {\n mounted: mounted || keepMounted,\n transitionStatus,\n elementRef,\n }\n}\n"]}