@therealtinhtute/baroiplayer 1.2.0 → 2.0.0-beta.1

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 (305) hide show
  1. package/README.md +91 -73
  2. package/dist/components/icons/index.d.ts +36 -0
  3. package/dist/components/icons/index.d.ts.map +1 -0
  4. package/dist/components/icons/svg-icons/ArrowLeftIcon.d.ts +4 -0
  5. package/dist/components/icons/svg-icons/ArrowLeftIcon.d.ts.map +1 -0
  6. package/dist/components/icons/svg-icons/ArrowRightIcon.d.ts +5 -0
  7. package/dist/components/icons/svg-icons/ArrowRightIcon.d.ts.map +1 -0
  8. package/dist/components/icons/svg-icons/AudioIcon.d.ts +5 -0
  9. package/dist/components/icons/svg-icons/AudioIcon.d.ts.map +1 -0
  10. package/dist/components/icons/svg-icons/BackwardIcon.d.ts +5 -0
  11. package/dist/components/icons/svg-icons/BackwardIcon.d.ts.map +1 -0
  12. package/dist/components/icons/svg-icons/CameraIcon.d.ts +5 -0
  13. package/dist/components/icons/svg-icons/CameraIcon.d.ts.map +1 -0
  14. package/dist/components/icons/svg-icons/CheckIcon.d.ts +5 -0
  15. package/dist/components/icons/svg-icons/CheckIcon.d.ts.map +1 -0
  16. package/dist/components/icons/svg-icons/EnablePiPIcon.d.ts +4 -0
  17. package/dist/components/icons/svg-icons/EnablePiPIcon.d.ts.map +1 -0
  18. package/dist/components/icons/svg-icons/ForwardIcon.d.ts +5 -0
  19. package/dist/components/icons/svg-icons/ForwardIcon.d.ts.map +1 -0
  20. package/dist/components/icons/svg-icons/FullscreenEnterIcon.d.ts +5 -0
  21. package/dist/components/icons/svg-icons/FullscreenEnterIcon.d.ts.map +1 -0
  22. package/dist/components/icons/svg-icons/FullscreenExitIcon.d.ts +5 -0
  23. package/dist/components/icons/svg-icons/FullscreenExitIcon.d.ts.map +1 -0
  24. package/dist/components/icons/svg-icons/LoadingIcon.d.ts +5 -0
  25. package/dist/components/icons/svg-icons/LoadingIcon.d.ts.map +1 -0
  26. package/dist/components/icons/svg-icons/PauseIcon.d.ts +5 -0
  27. package/dist/components/icons/svg-icons/PauseIcon.d.ts.map +1 -0
  28. package/dist/components/icons/svg-icons/PlayIcon.d.ts +5 -0
  29. package/dist/components/icons/svg-icons/PlayIcon.d.ts.map +1 -0
  30. package/dist/components/icons/svg-icons/PlaybackSpeedIcon.d.ts +5 -0
  31. package/dist/components/icons/svg-icons/PlaybackSpeedIcon.d.ts.map +1 -0
  32. package/dist/components/icons/svg-icons/QualityIcon.d.ts +5 -0
  33. package/dist/components/icons/svg-icons/QualityIcon.d.ts.map +1 -0
  34. package/dist/components/icons/svg-icons/SettingsIcon.d.ts +5 -0
  35. package/dist/components/icons/svg-icons/SettingsIcon.d.ts.map +1 -0
  36. package/dist/components/icons/svg-icons/SliderIcon.d.ts +5 -0
  37. package/dist/components/icons/svg-icons/SliderIcon.d.ts.map +1 -0
  38. package/dist/components/icons/svg-icons/SubtitleIcon.d.ts +5 -0
  39. package/dist/components/icons/svg-icons/SubtitleIcon.d.ts.map +1 -0
  40. package/dist/components/icons/svg-icons/SubtitleOffIcon.d.ts +5 -0
  41. package/dist/components/icons/svg-icons/SubtitleOffIcon.d.ts.map +1 -0
  42. package/dist/components/icons/svg-icons/UnPiPIcon.d.ts +4 -0
  43. package/dist/components/icons/svg-icons/UnPiPIcon.d.ts.map +1 -0
  44. package/dist/components/icons/svg-icons/VolumeMutedIcon.d.ts +5 -0
  45. package/dist/components/icons/svg-icons/VolumeMutedIcon.d.ts.map +1 -0
  46. package/dist/components/icons/svg-icons/VolumeOneIcon.d.ts +5 -0
  47. package/dist/components/icons/svg-icons/VolumeOneIcon.d.ts.map +1 -0
  48. package/dist/components/icons/svg-icons/VolumeThreeIcon.d.ts +5 -0
  49. package/dist/components/icons/svg-icons/VolumeThreeIcon.d.ts.map +1 -0
  50. package/dist/components/icons/svg-icons/VolumeTwoIcon.d.ts +5 -0
  51. package/dist/components/icons/svg-icons/VolumeTwoIcon.d.ts.map +1 -0
  52. package/dist/components/variants/gradient/gradient-audio.d.ts +13 -0
  53. package/dist/components/variants/gradient/gradient-audio.d.ts.map +1 -0
  54. package/dist/components/variants/gradient/gradient-controls.d.ts +4 -0
  55. package/dist/components/variants/gradient/gradient-controls.d.ts.map +1 -0
  56. package/dist/components/variants/gradient/gradient-glyphs.d.ts +30 -0
  57. package/dist/components/variants/gradient/gradient-glyphs.d.ts.map +1 -0
  58. package/dist/components/variants/gradient/gradient-video.d.ts +16 -0
  59. package/dist/components/variants/gradient/gradient-video.d.ts.map +1 -0
  60. package/dist/index.css +1 -1
  61. package/dist/index.d.ts +5 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +2 -112
  64. package/dist/index.js.map +1 -1
  65. package/dist/index.mjs +786 -6271
  66. package/dist/index.mjs.map +1 -1
  67. package/dist/package.json +3 -0
  68. package/package.json +110 -108
  69. package/src/components/variants/gradient/gradient-audio.tsx +47 -0
  70. package/src/components/variants/gradient/gradient-controls.tsx +254 -0
  71. package/src/components/variants/gradient/gradient-glyphs.test.tsx +69 -0
  72. package/src/components/variants/gradient/gradient-glyphs.tsx +129 -0
  73. package/src/components/variants/gradient/gradient-skin.css +211 -0
  74. package/src/components/variants/gradient/gradient-video.tsx +70 -0
  75. package/src/index.ts +5 -198
  76. package/src/test/accessibility-utils.ts +0 -59
  77. package/dist/context/media.js +0 -2
  78. package/dist/context/media.js.map +0 -1
  79. package/dist/context/media.mjs +0 -15
  80. package/dist/context/media.mjs.map +0 -1
  81. package/dist/context/store.js +0 -2
  82. package/dist/context/store.js.map +0 -1
  83. package/dist/context/store.mjs +0 -5
  84. package/dist/context/store.mjs.map +0 -1
  85. package/dist/context-BYwDoSRX.js +0 -1172
  86. package/dist/context-BYwDoSRX.js.map +0 -1
  87. package/dist/context-eNS62_ac.cjs +0 -23
  88. package/dist/context-eNS62_ac.cjs.map +0 -1
  89. package/dist/core-events-B1iM2F46.cjs +0 -2
  90. package/dist/core-events-B1iM2F46.cjs.map +0 -1
  91. package/dist/core-events-DunPHKRE.js +0 -484
  92. package/dist/core-events-DunPHKRE.js.map +0 -1
  93. package/dist/core-plugins-By-4-kGs.cjs +0 -2
  94. package/dist/core-plugins-By-4-kGs.cjs.map +0 -1
  95. package/dist/core-plugins-DSBWcTuX.js +0 -821
  96. package/dist/core-plugins-DSBWcTuX.js.map +0 -1
  97. package/dist/core.js +0 -37
  98. package/dist/core.js.map +0 -1
  99. package/dist/core.mjs +0 -1233
  100. package/dist/core.mjs.map +0 -1
  101. package/dist/enhanced-components-B_l3cist.js +0 -1142
  102. package/dist/enhanced-components-B_l3cist.js.map +0 -1
  103. package/dist/enhanced-components-BspFs9OO.cjs +0 -2
  104. package/dist/enhanced-components-BspFs9OO.cjs.map +0 -1
  105. package/dist/hooks-BXwI8QG6.cjs +0 -4
  106. package/dist/hooks-BXwI8QG6.cjs.map +0 -1
  107. package/dist/hooks-Bpi-jDiO.js +0 -1816
  108. package/dist/hooks-Bpi-jDiO.js.map +0 -1
  109. package/dist/minimal-components-C4z900Ro.js +0 -1926
  110. package/dist/minimal-components-C4z900Ro.js.map +0 -1
  111. package/dist/minimal-components-v4qBp6jv.cjs +0 -2
  112. package/dist/minimal-components-v4qBp6jv.cjs.map +0 -1
  113. package/dist/minimal-components.css +0 -1
  114. package/dist/mona-loading.gif +0 -0
  115. package/dist/performance-monitor-C5k6FDXw.js +0 -301
  116. package/dist/performance-monitor-C5k6FDXw.js.map +0 -1
  117. package/dist/performance-monitor-lJmuUjQQ.cjs +0 -2
  118. package/dist/performance-monitor-lJmuUjQQ.cjs.map +0 -1
  119. package/dist/utils-CFOue_9K.cjs +0 -9
  120. package/dist/utils-CFOue_9K.cjs.map +0 -1
  121. package/dist/utils-Dzpl2ArK.js +0 -2844
  122. package/dist/utils-Dzpl2ArK.js.map +0 -1
  123. package/dist/utils.js +0 -2
  124. package/dist/utils.js.map +0 -1
  125. package/dist/utils.mjs +0 -11
  126. package/dist/utils.mjs.map +0 -1
  127. package/src/adapters/videojs-adapter.tsx +0 -470
  128. package/src/assets/mona-loading.gif +0 -0
  129. package/src/components/AnimateLoading.tsx +0 -107
  130. package/src/components/LoadingState.tsx +0 -239
  131. package/src/components/__tests__/media-player-accessibility.test.tsx +0 -510
  132. package/src/components/__tests__/media-player-react19.test.tsx +0 -457
  133. package/src/components/accessibility/keyboard-help-overlay.tsx +0 -207
  134. package/src/components/audio-player.tsx +0 -85
  135. package/src/components/basic/index.ts +0 -37
  136. package/src/components/enhanced/advanced-features.tsx +0 -311
  137. package/src/components/enhanced/debug-panel.tsx +0 -448
  138. package/src/components/enhanced/enhanced-controls.tsx +0 -597
  139. package/src/components/enhanced/enhanced-media-player.tsx +0 -566
  140. package/src/components/enhanced/error-handling.tsx +0 -338
  141. package/src/components/enhanced/index.ts +0 -39
  142. package/src/components/enhanced/media-player-enhanced.tsx +0 -383
  143. package/src/components/examples/basic-video-player.tsx +0 -50
  144. package/src/components/examples/custom-controls-example.tsx +0 -63
  145. package/src/components/examples/enhanced-controls-example.tsx +0 -100
  146. package/src/components/examples/enhanced-media-player-example.tsx +0 -302
  147. package/src/components/examples/loading-states-demo.tsx +0 -142
  148. package/src/components/examples/react-19-demo.tsx +0 -353
  149. package/src/components/examples/volume-orientation-demo.tsx +0 -106
  150. package/src/components/icon-demo.tsx +0 -196
  151. package/src/components/legacy.tsx +0 -87
  152. package/src/components/media-metadata-display.tsx +0 -99
  153. package/src/components/media-player-audio.tsx +0 -39
  154. package/src/components/media-player-controls.tsx +0 -223
  155. package/src/components/media-player-error.tsx +0 -163
  156. package/src/components/media-player-fullscreen.tsx +0 -109
  157. package/src/components/media-player-hls.tsx +0 -111
  158. package/src/components/media-player-loading.tsx +0 -76
  159. package/src/components/media-player-play.tsx +0 -75
  160. package/src/components/media-player-root.tsx +0 -338
  161. package/src/components/media-player-seek.tsx +0 -168
  162. package/src/components/media-player-time.tsx +0 -99
  163. package/src/components/media-player-tooltip.tsx +0 -58
  164. package/src/components/media-player-video.tsx +0 -54
  165. package/src/components/media-player-volume.tsx +0 -155
  166. package/src/components/media-player.tsx +0 -292
  167. package/src/components/media-suspense.tsx +0 -344
  168. package/src/components/player-settings-form.tsx +0 -158
  169. package/src/components/react-player-wrapper.tsx +0 -651
  170. package/src/components/simple-video-player.tsx +0 -62
  171. package/src/components/ui/blur-poster.tsx +0 -93
  172. package/src/components/ui/empty-state.tsx +0 -91
  173. package/src/components/ui/enhanced-seek-bar.tsx +0 -254
  174. package/src/components/ui/error-state.tsx +0 -124
  175. package/src/components/ui/fullscreen-button.tsx +0 -81
  176. package/src/components/ui/loading-skeleton.tsx +0 -107
  177. package/src/components/ui/media-resource-preloader.tsx +0 -458
  178. package/src/components/ui/offline-message.tsx +0 -98
  179. package/src/components/ui/play-button.tsx +0 -99
  180. package/src/components/ui/seek-bar.tsx +0 -191
  181. package/src/components/ui/time-display.tsx +0 -61
  182. package/src/components/ui/volume-control.tsx +0 -190
  183. package/src/components/unified/base-media-player.tsx +0 -252
  184. package/src/components/unified/media-player.tsx +0 -75
  185. package/src/components/variants/minimal/AccessibleMinimalPlayer.tsx +0 -587
  186. package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.tsx +0 -573
  187. package/src/components/variants/minimal/MinimalControls.tsx +0 -124
  188. package/src/components/variants/minimal/MinimalLoading.tsx +0 -28
  189. package/src/components/variants/minimal/MinimalMediaPlayer.tsx +0 -318
  190. package/src/components/variants/minimal/MinimalOverlay.tsx +0 -58
  191. package/src/components/variants/minimal/MinimalPlayButton.tsx +0 -56
  192. package/src/components/variants/minimal/MinimalSeekBar.tsx +0 -140
  193. package/src/components/variants/minimal/MinimalVolumeControl.tsx +0 -75
  194. package/src/components/variants/minimal/SimpleMinimalPlayer.tsx +0 -206
  195. package/src/components/variants/minimal/components/CenterPlayButton.tsx +0 -22
  196. package/src/components/variants/minimal/components/ControlBar.tsx +0 -142
  197. package/src/components/variants/minimal/components/EnhancedSettingsMenu.tsx +0 -412
  198. package/src/components/variants/minimal/components/PlaybackControls.tsx +0 -46
  199. package/src/components/variants/minimal/components/RightControls.tsx +0 -164
  200. package/src/components/variants/minimal/components/SeekBar.tsx +0 -127
  201. package/src/components/variants/minimal/components/SettingsDropdown.tsx +0 -68
  202. package/src/components/variants/minimal/components/SubtitleDisplay.tsx +0 -21
  203. package/src/components/variants/minimal/components/TimeDisplay.tsx +0 -15
  204. package/src/components/variants/minimal/components/VideoElement.tsx +0 -33
  205. package/src/components/variants/minimal/components/VolumeControl.tsx +0 -220
  206. package/src/components/variants/minimal/index.ts +0 -23
  207. package/src/components/video-player.tsx +0 -100
  208. package/src/context/__tests__/media-store.test.ts +0 -509
  209. package/src/context/error-handling.ts +0 -398
  210. package/src/context/media-context.tsx +0 -254
  211. package/src/context/media-provider.tsx +0 -264
  212. package/src/context/media-store.ts +0 -387
  213. package/src/context/persistence.ts +0 -462
  214. package/src/core/events/event-system.ts +0 -448
  215. package/src/core/events/hooks.ts +0 -325
  216. package/src/core/events/index.ts +0 -22
  217. package/src/core/events/middleware.ts +0 -286
  218. package/src/core/index.ts +0 -22
  219. package/src/core/optimization/bundle-optimizer.tsx +0 -312
  220. package/src/core/performance/cicd.ts +0 -98
  221. package/src/core/performance/index.ts +0 -38
  222. package/src/core/performance/media-loading-optimizer.ts +0 -544
  223. package/src/core/performance/performance-budgets.ts +0 -437
  224. package/src/core/performance/performance-monitor.tsx +0 -488
  225. package/src/core/performance/performance-testing.ts +0 -461
  226. package/src/core/plugins/__tests__/registry.test.ts +0 -595
  227. package/src/core/plugins/base-plugin.ts +0 -225
  228. package/src/core/plugins/enhanced-plugin-system.ts +0 -435
  229. package/src/core/plugins/examples/analytics-plugin.ts +0 -241
  230. package/src/core/plugins/index.ts +0 -39
  231. package/src/core/plugins/registry.ts +0 -546
  232. package/src/core/plugins/types.ts +0 -169
  233. package/src/core/plugins/utils.ts +0 -317
  234. package/src/core/progressive-loading.tsx +0 -331
  235. package/src/core/providers/enhanced-hls-provider.ts +0 -307
  236. package/src/core/providers/lazy-provider.tsx +0 -14
  237. package/src/core/providers/service-provider.tsx +0 -164
  238. package/src/core/utils.tsx +0 -34
  239. package/src/features/media-session/media-session-manager.ts +0 -411
  240. package/src/features/picture-in-picture/pip-manager.ts +0 -428
  241. package/src/features/playlist/playlist-manager.ts +0 -626
  242. package/src/features/subtitles/subtitle-manager.ts +0 -435
  243. package/src/features/subtitles/subtitle-parser.ts +0 -284
  244. package/src/features/thumbnails/thumbnail-generator.ts +0 -528
  245. package/src/hooks/__tests__/currentTime-fix.test.ts +0 -149
  246. package/src/hooks/__tests__/use-media-player.test.ts +0 -712
  247. package/src/hooks/__tests__/use-media-state.test.tsx +0 -316
  248. package/src/hooks/accessibility/index.ts +0 -27
  249. package/src/hooks/accessibility/use-accessibility-preferences.ts +0 -190
  250. package/src/hooks/accessibility/use-focus-management.ts +0 -183
  251. package/src/hooks/accessibility/use-keyboard-shortcuts.ts +0 -152
  252. package/src/hooks/accessibility/use-screen-reader.ts +0 -212
  253. package/src/hooks/core/index.ts +0 -47
  254. package/src/hooks/legacy.ts +0 -21
  255. package/src/hooks/use-buffer-health.ts +0 -218
  256. package/src/hooks/use-enhanced-media-player.ts +0 -575
  257. package/src/hooks/use-focus-trap.tsx +0 -162
  258. package/src/hooks/use-intelligent-preloading.ts +0 -387
  259. package/src/hooks/use-keyboard-controls.ts +0 -115
  260. package/src/hooks/use-keyboard-shortcuts.ts +0 -255
  261. package/src/hooks/use-media-actions.ts +0 -184
  262. package/src/hooks/use-media-metadata.ts +0 -91
  263. package/src/hooks/use-media-optimistic.ts +0 -264
  264. package/src/hooks/use-media-player.ts +0 -343
  265. package/src/hooks/use-media-state.ts +0 -194
  266. package/src/hooks/use-memory-optimization.ts +0 -360
  267. package/src/hooks/use-network-status.ts +0 -124
  268. package/src/hooks/use-optimistic-controls.ts +0 -95
  269. package/src/hooks/use-optimized-media.ts +0 -283
  270. package/src/hooks/use-smart-preload.ts +0 -229
  271. package/src/hooks/use-touch-gestures.ts +0 -461
  272. package/src/hooks/useEnhancedSubtitles.ts +0 -258
  273. package/src/hooks/useKeyboardShortcuts.ts +0 -106
  274. package/src/hooks/useMediaControls.ts +0 -52
  275. package/src/hooks/useScreenshot.ts +0 -61
  276. package/src/hooks/useSubtitles.ts +0 -91
  277. package/src/hooks/useVideoPlayer.ts +0 -278
  278. package/src/icons/components/FullscreenIcon.tsx +0 -36
  279. package/src/icons/components/SettingsIcon.tsx +0 -37
  280. package/src/icons/components/animated/LoadingIcon.tsx +0 -27
  281. package/src/icons/components/animated/PlayPauseIcon.tsx +0 -42
  282. package/src/icons/components/media/PauseIcon.tsx +0 -38
  283. package/src/icons/components/media/PlayIcon.tsx +0 -37
  284. package/src/icons/components/volume/VolumeIcon.tsx +0 -38
  285. package/src/icons/components/volume/VolumeOffIcon.tsx +0 -38
  286. package/src/icons/index.ts +0 -56
  287. package/src/icons/provider.tsx +0 -58
  288. package/src/icons/types.ts +0 -60
  289. package/src/index-enhanced.ts +0 -35
  290. package/src/index-legacy.ts +0 -324
  291. package/src/index.css +0 -102
  292. package/src/lib/__tests__/async-utils.test.ts +0 -291
  293. package/src/lib/async-utils.ts +0 -194
  294. package/src/lib/deprecation.ts +0 -51
  295. package/src/lib/format-time.ts +0 -37
  296. package/src/lib/index.ts +0 -4
  297. package/src/lib/utils.ts +0 -6
  298. package/src/styles/globals.css +0 -462
  299. package/src/styles/minimal-player.css +0 -621
  300. package/src/styles/pixel-art.css +0 -41
  301. package/src/styles/videojs.css +0 -100
  302. package/src/types/events.ts +0 -47
  303. package/src/types/formats.ts +0 -79
  304. package/src/types/index.ts +0 -203
  305. package/src/types/videojs-plugins.d.ts +0 -14
@@ -1,1172 +0,0 @@
1
- var le = Object.defineProperty;
2
- var ue = (o, e, t) => e in o ? le(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var M = (o, e, t) => ue(o, typeof e != "symbol" ? e + "" : e, t);
4
- import T from "react";
5
- var W = { exports: {} }, K = {};
6
- /**
7
- * @license React
8
- * react-jsx-runtime.production.js
9
- *
10
- * Copyright (c) Meta Platforms, Inc. and affiliates.
11
- *
12
- * This source code is licensed under the MIT license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- */
15
- var re;
16
- function Ee() {
17
- if (re) return K;
18
- re = 1;
19
- var o = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
20
- function t(r, a, n) {
21
- var E = null;
22
- if (n !== void 0 && (E = "" + n), a.key !== void 0 && (E = "" + a.key), "key" in a) {
23
- n = {};
24
- for (var c in a)
25
- c !== "key" && (n[c] = a[c]);
26
- } else n = a;
27
- return a = n.ref, {
28
- $$typeof: o,
29
- type: r,
30
- key: E,
31
- ref: a !== void 0 ? a : null,
32
- props: n
33
- };
34
- }
35
- return K.Fragment = e, K.jsx = t, K.jsxs = t, K;
36
- }
37
- var V = {};
38
- /**
39
- * @license React
40
- * react-jsx-runtime.development.js
41
- *
42
- * Copyright (c) Meta Platforms, Inc. and affiliates.
43
- *
44
- * This source code is licensed under the MIT license found in the
45
- * LICENSE file in the root directory of this source tree.
46
- */
47
- var se;
48
- function de() {
49
- return se || (se = 1, process.env.NODE_ENV !== "production" && (function() {
50
- function o(s) {
51
- if (s == null) return null;
52
- if (typeof s == "function")
53
- return s.$$typeof === l ? null : s.displayName || s.name || null;
54
- if (typeof s == "string") return s;
55
- switch (s) {
56
- case L:
57
- return "Fragment";
58
- case v:
59
- return "Profiler";
60
- case U:
61
- return "StrictMode";
62
- case C:
63
- return "Suspense";
64
- case h:
65
- return "SuspenseList";
66
- case J:
67
- return "Activity";
68
- }
69
- if (typeof s == "object")
70
- switch (typeof s.tag == "number" && console.error(
71
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
- ), s.$$typeof) {
73
- case D:
74
- return "Portal";
75
- case j:
76
- return (s.displayName || "Context") + ".Provider";
77
- case G:
78
- return (s._context.displayName || "Context") + ".Consumer";
79
- case I:
80
- var d = s.render;
81
- return s = s.displayName, s || (s = d.displayName || d.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
82
- case B:
83
- return d = s.displayName || null, d !== null ? d : o(s.type) || "Memo";
84
- case w:
85
- d = s._payload, s = s._init;
86
- try {
87
- return o(s(d));
88
- } catch {
89
- }
90
- }
91
- return null;
92
- }
93
- function e(s) {
94
- return "" + s;
95
- }
96
- function t(s) {
97
- try {
98
- var d = !1;
99
- } catch {
100
- d = !0;
101
- }
102
- if (d) {
103
- d = console;
104
- var f = d.error, R = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
105
- return f.call(
106
- d,
107
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
108
- R
109
- ), e(s);
110
- }
111
- }
112
- function r(s) {
113
- if (s === L) return "<>";
114
- if (typeof s == "object" && s !== null && s.$$typeof === w)
115
- return "<...>";
116
- try {
117
- var d = o(s);
118
- return d ? "<" + d + ">" : "<...>";
119
- } catch {
120
- return "<...>";
121
- }
122
- }
123
- function a() {
124
- var s = u.A;
125
- return s === null ? null : s.getOwner();
126
- }
127
- function n() {
128
- return Error("react-stack-top-frame");
129
- }
130
- function E(s) {
131
- if (y.call(s, "key")) {
132
- var d = Object.getOwnPropertyDescriptor(s, "key").get;
133
- if (d && d.isReactWarning) return !1;
134
- }
135
- return s.key !== void 0;
136
- }
137
- function c(s, d) {
138
- function f() {
139
- N || (N = !0, console.error(
140
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
141
- d
142
- ));
143
- }
144
- f.isReactWarning = !0, Object.defineProperty(s, "key", {
145
- get: f,
146
- configurable: !0
147
- });
148
- }
149
- function S() {
150
- var s = o(this.type);
151
- return z[s] || (z[s] = !0, console.error(
152
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
153
- )), s = this.props.ref, s !== void 0 ? s : null;
154
- }
155
- function _(s, d, f, R, k, P, $, X) {
156
- return f = P.ref, s = {
157
- $$typeof: A,
158
- type: s,
159
- key: d,
160
- props: P,
161
- _owner: k
162
- }, (f !== void 0 ? f : null) !== null ? Object.defineProperty(s, "ref", {
163
- enumerable: !1,
164
- get: S
165
- }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
166
- configurable: !1,
167
- enumerable: !1,
168
- writable: !0,
169
- value: 0
170
- }), Object.defineProperty(s, "_debugInfo", {
171
- configurable: !1,
172
- enumerable: !1,
173
- writable: !0,
174
- value: null
175
- }), Object.defineProperty(s, "_debugStack", {
176
- configurable: !1,
177
- enumerable: !1,
178
- writable: !0,
179
- value: $
180
- }), Object.defineProperty(s, "_debugTask", {
181
- configurable: !1,
182
- enumerable: !1,
183
- writable: !0,
184
- value: X
185
- }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
186
- }
187
- function p(s, d, f, R, k, P, $, X) {
188
- var m = d.children;
189
- if (m !== void 0)
190
- if (R)
191
- if (x(m)) {
192
- for (R = 0; R < m.length; R++)
193
- F(m[R]);
194
- Object.freeze && Object.freeze(m);
195
- } else
196
- console.error(
197
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
198
- );
199
- else F(m);
200
- if (y.call(d, "key")) {
201
- m = o(s);
202
- var Y = Object.keys(d).filter(function(ce) {
203
- return ce !== "key";
204
- });
205
- R = 0 < Y.length ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}", te[m + R] || (Y = 0 < Y.length ? "{" + Y.join(": ..., ") + ": ...}" : "{}", console.error(
206
- `A props object containing a "key" prop is being spread into JSX:
207
- let props = %s;
208
- <%s {...props} />
209
- React keys must be passed directly to JSX without using spread:
210
- let props = %s;
211
- <%s key={someKey} {...props} />`,
212
- R,
213
- m,
214
- Y,
215
- m
216
- ), te[m + R] = !0);
217
- }
218
- if (m = null, f !== void 0 && (t(f), m = "" + f), E(d) && (t(d.key), m = "" + d.key), "key" in d) {
219
- f = {};
220
- for (var q in d)
221
- q !== "key" && (f[q] = d[q]);
222
- } else f = d;
223
- return m && c(
224
- f,
225
- typeof s == "function" ? s.displayName || s.name || "Unknown" : s
226
- ), _(
227
- s,
228
- m,
229
- P,
230
- k,
231
- a(),
232
- f,
233
- $,
234
- X
235
- );
236
- }
237
- function F(s) {
238
- typeof s == "object" && s !== null && s.$$typeof === A && s._store && (s._store.validated = 1);
239
- }
240
- var g = T, A = Symbol.for("react.transitional.element"), D = Symbol.for("react.portal"), L = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), G = Symbol.for("react.consumer"), j = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), B = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), J = Symbol.for("react.activity"), l = Symbol.for("react.client.reference"), u = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, y = Object.prototype.hasOwnProperty, x = Array.isArray, O = console.createTask ? console.createTask : function() {
241
- return null;
242
- };
243
- g = {
244
- "react-stack-bottom-frame": function(s) {
245
- return s();
246
- }
247
- };
248
- var N, z = {}, Z = g["react-stack-bottom-frame"].bind(
249
- g,
250
- n
251
- )(), ee = O(r(n)), te = {};
252
- V.Fragment = L, V.jsx = function(s, d, f, R, k) {
253
- var P = 1e4 > u.recentlyCreatedOwnerStacks++;
254
- return p(
255
- s,
256
- d,
257
- f,
258
- !1,
259
- R,
260
- k,
261
- P ? Error("react-stack-top-frame") : Z,
262
- P ? O(r(s)) : ee
263
- );
264
- }, V.jsxs = function(s, d, f, R, k) {
265
- var P = 1e4 > u.recentlyCreatedOwnerStacks++;
266
- return p(
267
- s,
268
- d,
269
- f,
270
- !0,
271
- R,
272
- k,
273
- P ? Error("react-stack-top-frame") : Z,
274
- P ? O(r(s)) : ee
275
- );
276
- };
277
- })()), V;
278
- }
279
- var ne;
280
- function fe() {
281
- return ne || (ne = 1, process.env.NODE_ENV === "production" ? W.exports = /* @__PURE__ */ Ee() : W.exports = /* @__PURE__ */ de()), W.exports;
282
- }
283
- var ae = /* @__PURE__ */ fe();
284
- const i = {
285
- PLAY: "PLAY",
286
- PAUSE: "PAUSE",
287
- SEEK: "SEEK",
288
- SET_VOLUME: "SET_VOLUME",
289
- MUTE: "MUTE",
290
- UNMUTE: "UNMUTE",
291
- TOGGLE_MUTE: "TOGGLE_MUTE",
292
- SET_DURATION: "SET_DURATION",
293
- SET_CURRENT_TIME: "SET_CURRENT_TIME",
294
- SET_BUFFERED: "SET_BUFFERED",
295
- SET_LOADING: "SET_LOADING",
296
- SET_ERROR: "SET_ERROR",
297
- ENTER_FULLSCREEN: "ENTER_FULLSCREEN",
298
- EXIT_FULLSCREEN: "EXIT_FULLSCREEN",
299
- ENTER_PIP: "ENTER_PIP",
300
- EXIT_PIP: "EXIT_PIP",
301
- SET_PLAYBACK_RATE: "SET_PLAYBACK_RATE",
302
- SET_SUBTITLE_TRACK: "SET_SUBTITLE_TRACK",
303
- SET_RENDITION: "SET_RENDITION",
304
- TOGGLE_SUBTITLES: "TOGGLE_SUBTITLES",
305
- PREVIEW_TIME: "PREVIEW_TIME",
306
- CLEAR_PREVIEW: "CLEAR_PREVIEW",
307
- // New actions for Video.js adapter
308
- SET_BUFFERING: "SET_BUFFERING",
309
- SET_QUALITY_LEVEL: "SET_QUALITY_LEVEL",
310
- SET_BANDWIDTH_ESTIMATE: "SET_BANDWIDTH_ESTIMATE",
311
- SET_ACTIVE_TEXT_TRACKS: "SET_ACTIVE_TEXT_TRACKS"
312
- }, oe = T.createContext(null);
313
- function Se() {
314
- const o = T.useContext(oe);
315
- if (!o)
316
- throw new Error("useMediaContext must be used within a MediaPlayer");
317
- return o;
318
- }
319
- const ie = T.createContext(null);
320
- function H() {
321
- const o = T.useContext(ie);
322
- if (!o)
323
- throw new Error("useMediaStore must be used within a MediaPlayer");
324
- return o;
325
- }
326
- function Te(o, e) {
327
- if (Object.is(o, e)) return !0;
328
- if (typeof o != "object" || o === null || typeof e != "object" || e === null)
329
- return !1;
330
- const t = Object.keys(o), r = Object.keys(e);
331
- if (t.length !== r.length) return !1;
332
- for (const a of t) {
333
- if (!r.includes(a)) return !1;
334
- const n = o[a], E = e[a];
335
- if (!Object.is(n, E)) return !1;
336
- }
337
- return !0;
338
- }
339
- function ke(o) {
340
- const e = H(), t = () => o(e.getState()), r = T.useRef(void 0), a = T.useCallback(() => {
341
- const E = o(e.getState());
342
- return r.current = E, E;
343
- }, [o]), n = T.useSyncExternalStore(e.subscribe, t, a);
344
- return T.useEffect(() => {
345
- const E = r.current;
346
- E !== void 0 && Te(E, n) || (r.current = n);
347
- }, [n]), n;
348
- }
349
- function Me() {
350
- return H().dispatch;
351
- }
352
- function Le(o) {
353
- const e = H(), t = "getOptimisticState" in e, r = () => o(t ? e.getOptimisticState() : e.getState());
354
- return T.useSyncExternalStore(e.subscribe, r, r);
355
- }
356
- function Ue() {
357
- const o = H(), e = Se(), t = "getOptimisticState" in o, r = "errorHandler" in e ? e.errorHandler : null, a = "isRehydrated" in e ? e.isRehydrated : !0;
358
- return {
359
- isEnhanced: t,
360
- errorHandler: r,
361
- isRehydrated: a,
362
- actionsState: t ? o.getActionState() : null
363
- };
364
- }
365
- const Q = {
366
- isPlaying: !1,
367
- currentTime: 0,
368
- duration: 0,
369
- buffered: null,
370
- isLoading: !1,
371
- isBuffering: !1,
372
- error: null,
373
- volume: 1,
374
- isMuted: !1,
375
- isFullscreen: !1,
376
- isPictureInPicture: !1,
377
- playbackRate: 1,
378
- subtitlesShowing: !1,
379
- selectedSubtitleTrack: null,
380
- selectedRendition: null,
381
- qualityLevel: -1,
382
- bandwidthEstimate: 0,
383
- activeTextTracks: [],
384
- previewTime: null,
385
- previewImage: null,
386
- previewCoords: null,
387
- subtitlesList: [],
388
- renditionList: []
389
- }, ye = {
390
- maxRetries: 3,
391
- baseDelay: 1e3,
392
- maxDelay: 1e4,
393
- exponentialBackoff: !0,
394
- retryableErrors: [
395
- "NETWORK_ERROR",
396
- "TIMEOUT_ERROR"
397
- /* TIMEOUT_ERROR */
398
- ],
399
- retryableActions: ["PLAY", "PAUSE", "SEEK", "SET_VOLUME", "ENTER_FULLSCREEN", "EXIT_FULLSCREEN"]
400
- };
401
- class Re {
402
- canRecover(e) {
403
- return e.type === "NETWORK_ERROR" && e.retryCount < 3;
404
- }
405
- async recover(e) {
406
- navigator.onLine === !1 && await new Promise((t) => {
407
- const r = () => {
408
- window.removeEventListener("online", r), t(void 0);
409
- };
410
- window.addEventListener("online", r);
411
- }), await new Promise((t) => setTimeout(t, 2e3));
412
- }
413
- }
414
- class me {
415
- canRecover(e) {
416
- return e.type === "PLAYBACK_ERROR" && e.retryCount < 2;
417
- }
418
- async recover(e) {
419
- const t = document.querySelector("video, audio");
420
- t && (t.load(), await new Promise((r) => {
421
- const a = () => {
422
- t.removeEventListener("canplay", a), r(void 0);
423
- };
424
- t.addEventListener("canplay", a);
425
- }));
426
- }
427
- }
428
- class pe {
429
- canRecover(e) {
430
- return e.type === "PERMISSION_ERROR" && e.action?.type === "ENTER_FULLSCREEN";
431
- }
432
- async recover(e) {
433
- console.warn("Fullscreen requires user interaction");
434
- }
435
- }
436
- class ge {
437
- constructor(e = {}, t = []) {
438
- M(this, "config");
439
- M(this, "recoveryStrategies");
440
- M(this, "errorQueue", /* @__PURE__ */ new Map());
441
- M(this, "listeners", /* @__PURE__ */ new Set());
442
- this.config = { ...ye, ...e }, this.recoveryStrategies = [
443
- new Re(),
444
- new me(),
445
- new pe(),
446
- ...t
447
- ];
448
- }
449
- // Create a media error from a generic error
450
- createMediaError(e, t, r = 0) {
451
- const a = Date.now();
452
- if (e instanceof Error) {
453
- const n = this.categorizeError(e, t);
454
- return {
455
- type: n,
456
- message: e.message,
457
- action: t,
458
- timestamp: a,
459
- retryable: this.isRetryable(n, t),
460
- retryCount: r,
461
- originalError: e
462
- };
463
- }
464
- return {
465
- type: "UNKNOWN_ERROR",
466
- message: typeof e == "string" ? e : "Unknown error occurred",
467
- action: t,
468
- timestamp: a,
469
- retryable: this.isRetryable("UNKNOWN_ERROR", t),
470
- retryCount: r
471
- };
472
- }
473
- // Categorize errors based on error properties and action context
474
- categorizeError(e, t) {
475
- const r = e.message.toLowerCase();
476
- return r.includes("network") || r.includes("fetch") || r.includes("connection") || e.name === "NetworkError" ? "NETWORK_ERROR" : r.includes("permission") || r.includes("denied") || r.includes("fullscreen") || e.name === "NotAllowedError" ? "PERMISSION_ERROR" : r.includes("decode") || r.includes("format") || r.includes("codec") || t?.type === "PLAY" ? "PLAYBACK_ERROR" : r.includes("timeout") || e.name === "TimeoutError" ? "TIMEOUT_ERROR" : r.includes("not supported") || r.includes("unsupported") || e.name === "NotSupportedError" ? "NOT_SUPPORTED_ERROR" : "UNKNOWN_ERROR";
477
- }
478
- // Check if an error/action combination is retryable
479
- isRetryable(e, t) {
480
- const r = this.config.retryableErrors.includes(e), a = !t || this.config.retryableActions.includes(t.type);
481
- return r && a;
482
- }
483
- // Calculate retry delay with exponential backoff
484
- calculateRetryDelay(e) {
485
- if (!this.config.exponentialBackoff)
486
- return this.config.baseDelay;
487
- const t = this.config.baseDelay * Math.pow(2, e);
488
- return Math.min(t, this.config.maxDelay);
489
- }
490
- // Handle an error with automatic retry logic
491
- async handleError(e, t, r) {
492
- const a = this.createMediaError(e, t, t?.retryCount || 0), n = `${t?.type}-${a.timestamp}`;
493
- this.errorQueue.set(n, a), this.listeners.forEach((E) => E(a));
494
- for (const E of this.recoveryStrategies)
495
- if (E.canRecover(a))
496
- try {
497
- await E.recover(a);
498
- break;
499
- } catch (c) {
500
- console.warn("Recovery strategy failed:", c);
501
- }
502
- if (a.retryable && a.retryCount < this.config.maxRetries && r && t) {
503
- const E = this.calculateRetryDelay(a.retryCount);
504
- console.log(
505
- `Retrying action ${t.type} in ${E}ms (attempt ${a.retryCount + 1}/${this.config.maxRetries})`
506
- ), setTimeout(async () => {
507
- try {
508
- await r({
509
- ...t,
510
- retryCount: a.retryCount + 1
511
- }), this.errorQueue.delete(n);
512
- } catch (c) {
513
- await this.handleError(
514
- c,
515
- {
516
- ...t,
517
- retryCount: a.retryCount + 1
518
- },
519
- r
520
- );
521
- }
522
- }, E);
523
- }
524
- return a;
525
- }
526
- // Subscribe to error events
527
- subscribe(e) {
528
- return this.listeners.add(e), () => this.listeners.delete(e);
529
- }
530
- // Get current errors
531
- getErrors() {
532
- return Array.from(this.errorQueue.values());
533
- }
534
- // Clear specific error
535
- clearError(e) {
536
- this.errorQueue.delete(e);
537
- }
538
- // Clear all errors
539
- clearAllErrors() {
540
- this.errorQueue.clear();
541
- }
542
- // Get error statistics
543
- getErrorStats() {
544
- const e = this.getErrors(), t = Date.now(), r = 300 * 1e3, a = e.reduce(
545
- (c, S) => (c[S.type] = (c[S.type] || 0) + 1, c),
546
- {}
547
- ), n = e.filter((c) => c.retryable).length, E = e.filter((c) => t - c.timestamp < r);
548
- return {
549
- totalErrors: e.length,
550
- errorsByType: a,
551
- retryableErrors: n,
552
- recentErrors: E
553
- };
554
- }
555
- }
556
- const _e = {
557
- enabled: !0,
558
- key: "baroi-player-state",
559
- persist: ["volume", "isMuted", "playbackRate", "subtitlesShowing"],
560
- debounceMs: 500
561
- };
562
- function he(o = Q, e = {}) {
563
- let t = { ...o }, r = { ...o }, a = {
564
- pending: !1,
565
- error: null,
566
- lastAction: null,
567
- retryCount: 0
568
- };
569
- const n = { ..._e, ...e }, E = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
570
- let S = null;
571
- const _ = (l) => (E.add(l), () => E.delete(l)), p = () => {
572
- E.forEach((l) => l());
573
- }, F = () => t, g = () => r, A = () => a, D = async () => {
574
- if (!n.enabled || typeof window > "u") return;
575
- const l = n.persist.reduce(
576
- (u, y) => (u[y] = t[y], u),
577
- {}
578
- );
579
- try {
580
- localStorage.setItem(
581
- n.key,
582
- JSON.stringify({
583
- ...l,
584
- timestamp: Date.now()
585
- })
586
- );
587
- } catch (u) {
588
- console.warn("Failed to persist media state:", u);
589
- }
590
- }, L = () => {
591
- S && clearTimeout(S), S = setTimeout(D, n.debounceMs);
592
- }, U = async () => {
593
- if (!(!n.enabled || typeof window > "u"))
594
- try {
595
- const l = localStorage.getItem(n.key);
596
- if (!l) return;
597
- const u = JSON.parse(l), { timestamp: y, ...x } = u, O = 10080 * 60 * 1e3;
598
- if (y && Date.now() - y > O) {
599
- v();
600
- return;
601
- }
602
- const N = { ...t, ...x };
603
- JSON.stringify(N) !== JSON.stringify(t) && (t = N, r = { ...N }, p());
604
- } catch (l) {
605
- console.warn("Failed to rehydrate media state:", l);
606
- }
607
- }, v = () => {
608
- if (!(typeof window > "u"))
609
- try {
610
- localStorage.removeItem(n.key);
611
- } catch (l) {
612
- console.warn("Failed to clear persisted state:", l);
613
- }
614
- }, G = (l) => {
615
- Object.assign(n, l);
616
- }, j = (l) => {
617
- const u = { ...t, ...l };
618
- JSON.stringify(u) !== JSON.stringify(t) && (t = u, r = { ...u }, L(), p());
619
- }, I = (l) => {
620
- const u = `${l.type}-${Date.now()}-${Math.random()}`;
621
- c.set(u, { ...l, timestamp: Date.now() });
622
- const y = h(r, l);
623
- return r = { ...r, ...y }, p(), u;
624
- }, C = (l) => {
625
- if (c.has(l)) {
626
- c.delete(l), r = { ...t };
627
- for (const [, u] of c) {
628
- const y = h(r, u);
629
- r = { ...r, ...y };
630
- }
631
- p();
632
- }
633
- }, h = (l, u) => {
634
- switch (u.type) {
635
- case i.PLAY:
636
- return { isPlaying: !0, error: null };
637
- case i.PAUSE:
638
- return { isPlaying: !1 };
639
- case i.SEEK:
640
- return { currentTime: u.detail };
641
- case i.SET_VOLUME:
642
- return { volume: Math.max(0, Math.min(1, u.detail)) };
643
- case i.MUTE:
644
- return { isMuted: !0 };
645
- case i.UNMUTE:
646
- return { isMuted: !1 };
647
- case i.TOGGLE_MUTE:
648
- return { isMuted: !l.isMuted };
649
- case i.SET_DURATION:
650
- return { duration: u.detail };
651
- case i.SET_CURRENT_TIME:
652
- return { currentTime: u.detail };
653
- case i.SET_BUFFERED:
654
- return { buffered: u.detail };
655
- case i.SET_LOADING:
656
- return { isLoading: u.detail };
657
- case i.SET_ERROR:
658
- return { error: u.detail, isLoading: !1 };
659
- case i.ENTER_FULLSCREEN:
660
- return { isFullscreen: !0 };
661
- case i.EXIT_FULLSCREEN:
662
- return { isFullscreen: !1 };
663
- case i.ENTER_PIP:
664
- return { isPictureInPicture: !0 };
665
- case i.EXIT_PIP:
666
- return { isPictureInPicture: !1 };
667
- case i.SET_PLAYBACK_RATE:
668
- return { playbackRate: u.detail };
669
- case i.SET_SUBTITLE_TRACK:
670
- return { selectedSubtitleTrack: u.detail };
671
- case i.SET_RENDITION:
672
- return { selectedRendition: u.detail };
673
- case i.TOGGLE_SUBTITLES:
674
- return { subtitlesShowing: !l.subtitlesShowing };
675
- case i.PREVIEW_TIME:
676
- return { previewTime: u.detail };
677
- case i.CLEAR_PREVIEW:
678
- return { previewTime: null, previewImage: null, previewCoords: null };
679
- default:
680
- return console.warn(`Unknown media action type: ${u.type}`), {};
681
- }
682
- }, B = (l) => {
683
- const u = h(t, l);
684
- j(u);
685
- }, w = async (l) => {
686
- a = {
687
- pending: !0,
688
- error: null,
689
- lastAction: l,
690
- retryCount: l.retryCount || 0
691
- };
692
- const u = I(l);
693
- try {
694
- await new Promise((O) => setTimeout(O, 0));
695
- const y = h(t, l), x = { ...t, ...y };
696
- JSON.stringify(x) !== JSON.stringify(t) && (t = x, L()), c.delete(u), a = {
697
- pending: !1,
698
- error: null,
699
- lastAction: l,
700
- retryCount: 0
701
- }, r = { ...t };
702
- for (const [, O] of c) {
703
- const N = h(r, O);
704
- r = { ...r, ...N };
705
- }
706
- } catch (y) {
707
- C(u), a = {
708
- pending: !1,
709
- error: y instanceof Error ? y.message : "Unknown error occurred",
710
- lastAction: l,
711
- retryCount: (l.retryCount || 0) + 1
712
- }, a.retryCount < 3 && J(l.type) && setTimeout(() => {
713
- w({
714
- ...l,
715
- retryCount: a.retryCount
716
- });
717
- }, Math.pow(2, a.retryCount) * 1e3);
718
- }
719
- p();
720
- }, J = (l) => [
721
- i.PLAY,
722
- i.PAUSE,
723
- i.SEEK,
724
- i.SET_VOLUME,
725
- i.MUTE,
726
- i.UNMUTE,
727
- i.TOGGLE_MUTE
728
- ].includes(l);
729
- return U(), {
730
- subscribe: _,
731
- getState: F,
732
- setState: j,
733
- dispatch: B,
734
- getOptimisticState: g,
735
- dispatchOptimistic: w,
736
- rollbackOptimistic: C,
737
- getActionState: A,
738
- setPersistenceConfig: G,
739
- rehydrateFromStorage: U,
740
- clearPersistedState: v
741
- };
742
- }
743
- const b = {
744
- USER_PREFERENCES: "baroi-player-preferences",
745
- SESSION_STATE: "baroi-player-session",
746
- PLAYBACK_HISTORY: "baroi-player-history",
747
- CACHE_TIMESTAMP: "baroi-player-cache-ts"
748
- };
749
- class be {
750
- async getItem(e) {
751
- if (typeof window > "u") return null;
752
- try {
753
- return localStorage.getItem(e);
754
- } catch (t) {
755
- return console.warn("Failed to read from localStorage:", t), null;
756
- }
757
- }
758
- async setItem(e, t) {
759
- if (!(typeof window > "u"))
760
- try {
761
- localStorage.setItem(e, t);
762
- } catch (r) {
763
- console.warn("Failed to write to localStorage:", r);
764
- }
765
- }
766
- async removeItem(e) {
767
- if (!(typeof window > "u"))
768
- try {
769
- localStorage.removeItem(e);
770
- } catch (t) {
771
- console.warn("Failed to remove from localStorage:", t);
772
- }
773
- }
774
- async clear() {
775
- if (!(typeof window > "u"))
776
- try {
777
- Object.values(b).forEach((e) => {
778
- localStorage.removeItem(e);
779
- });
780
- } catch (e) {
781
- console.warn("Failed to clear localStorage:", e);
782
- }
783
- }
784
- }
785
- const we = {
786
- userPreferences: !0,
787
- sessionState: !0,
788
- playbackHistory: !0,
789
- maxHistoryItems: 50,
790
- maxCacheAge: 10080 * 60 * 1e3,
791
- // 7 days
792
- debounceMs: 1e3,
793
- storage: new be()
794
- };
795
- class Pe {
796
- constructor(e = {}) {
797
- M(this, "config");
798
- M(this, "storage");
799
- M(this, "debounceTimeouts", /* @__PURE__ */ new Map());
800
- this.config = { ...we, ...e }, this.storage = this.config.storage;
801
- }
802
- // User preferences methods
803
- async getUserPreferences() {
804
- if (!this.config.userPreferences) return null;
805
- try {
806
- const e = await this.storage.getItem(b.USER_PREFERENCES);
807
- if (!e) return null;
808
- const t = JSON.parse(e);
809
- return this.isCacheExpired(t.timestamp) ? (await this.clearUserPreferences(), null) : t.preferences;
810
- } catch (e) {
811
- return console.warn("Failed to get user preferences:", e), null;
812
- }
813
- }
814
- async saveUserPreferences(e) {
815
- this.config.userPreferences && this.debounce(b.USER_PREFERENCES, async () => {
816
- try {
817
- const r = { ...await this.getUserPreferences() || {}, ...e };
818
- await this.storage.setItem(
819
- b.USER_PREFERENCES,
820
- JSON.stringify({
821
- preferences: r,
822
- timestamp: Date.now()
823
- })
824
- );
825
- } catch (t) {
826
- console.warn("Failed to save user preferences:", t);
827
- }
828
- });
829
- }
830
- async clearUserPreferences() {
831
- try {
832
- await this.storage.removeItem(b.USER_PREFERENCES);
833
- } catch (e) {
834
- console.warn("Failed to clear user preferences:", e);
835
- }
836
- }
837
- // Session state methods
838
- async getSessionState() {
839
- if (!this.config.sessionState) return null;
840
- try {
841
- const e = await this.storage.getItem(b.SESSION_STATE);
842
- return e ? JSON.parse(e).state : null;
843
- } catch (e) {
844
- return console.warn("Failed to get session state:", e), null;
845
- }
846
- }
847
- async saveSessionState(e) {
848
- this.config.sessionState && this.debounce(b.SESSION_STATE, async () => {
849
- try {
850
- const r = { ...await this.getSessionState() || {
851
- currentTime: 0,
852
- playbackPosition: {}
853
- }, ...e };
854
- await this.storage.setItem(
855
- b.SESSION_STATE,
856
- JSON.stringify({
857
- state: r,
858
- timestamp: Date.now()
859
- })
860
- );
861
- } catch (t) {
862
- console.warn("Failed to save session state:", t);
863
- }
864
- });
865
- }
866
- async clearSessionState() {
867
- try {
868
- await this.storage.removeItem(b.SESSION_STATE);
869
- } catch (e) {
870
- console.warn("Failed to clear session state:", e);
871
- }
872
- }
873
- // Playback history methods
874
- async getPlaybackHistory() {
875
- if (!this.config.playbackHistory) return [];
876
- try {
877
- const e = await this.storage.getItem(b.PLAYBACK_HISTORY);
878
- if (!e) return [];
879
- const t = JSON.parse(e);
880
- return this.isCacheExpired(t.timestamp) ? (await this.clearPlaybackHistory(), []) : t.history || [];
881
- } catch (e) {
882
- return console.warn("Failed to get playback history:", e), [];
883
- }
884
- }
885
- async addToPlaybackHistory(e) {
886
- if (this.config.playbackHistory)
887
- try {
888
- const t = await this.getPlaybackHistory(), r = {
889
- ...e,
890
- timestamp: Date.now()
891
- }, a = t.filter((E) => E.mediaId !== e.mediaId), n = [r, ...a].slice(0, this.config.maxHistoryItems);
892
- await this.storage.setItem(
893
- b.PLAYBACK_HISTORY,
894
- JSON.stringify({
895
- history: n,
896
- timestamp: Date.now()
897
- })
898
- );
899
- } catch (t) {
900
- console.warn("Failed to add to playback history:", t);
901
- }
902
- }
903
- async clearPlaybackHistory() {
904
- try {
905
- await this.storage.removeItem(b.PLAYBACK_HISTORY);
906
- } catch (e) {
907
- console.warn("Failed to clear playback history:", e);
908
- }
909
- }
910
- // Utility methods
911
- async savePlaybackPosition(e, t) {
912
- const a = (await this.getSessionState())?.playbackPosition || {};
913
- await this.saveSessionState({
914
- playbackPosition: {
915
- ...a,
916
- [e]: t
917
- }
918
- });
919
- }
920
- async getPlaybackPosition(e) {
921
- return (await this.getSessionState())?.playbackPosition?.[e] || 0;
922
- }
923
- // Extract preferences from MediaState
924
- extractUserPreferences(e) {
925
- return {
926
- volume: e.volume,
927
- isMuted: e.isMuted,
928
- playbackRate: e.playbackRate,
929
- subtitlesShowing: e.subtitlesShowing,
930
- selectedSubtitleTrack: e.selectedSubtitleTrack?.id || null,
931
- preferredRendition: e.selectedRendition,
932
- autoplay: !1,
933
- // This would come from config
934
- keyboardShortcuts: !0
935
- // This would come from config
936
- };
937
- }
938
- // Extract session state from MediaState
939
- extractSessionState(e, t) {
940
- return {
941
- currentTime: e.currentTime,
942
- mediaId: t,
943
- playbackPosition: {}
944
- };
945
- }
946
- // Clear all persisted data
947
- async clearAll() {
948
- await this.storage.clear(), this.debounceTimeouts.clear();
949
- }
950
- // Private helper methods
951
- isCacheExpired(e) {
952
- return e ? Date.now() - e > this.config.maxCacheAge : !0;
953
- }
954
- debounce(e, t) {
955
- const r = this.debounceTimeouts.get(e);
956
- r && clearTimeout(r);
957
- const a = setTimeout(async () => {
958
- await t(), this.debounceTimeouts.delete(e);
959
- }, this.config.debounceMs);
960
- this.debounceTimeouts.set(e, a);
961
- }
962
- }
963
- function Oe(o) {
964
- const [e] = T.useState(() => new Pe(o));
965
- return T.useEffect(() => () => {
966
- e.clearAll();
967
- }, [e]), e;
968
- }
969
- function Ae(o, e, t) {
970
- const r = Oe(t), [a, n] = T.useState(!1);
971
- return T.useEffect(() => {
972
- let E = !0;
973
- return (async () => {
974
- try {
975
- const [S, _] = await Promise.all([
976
- r.getUserPreferences(),
977
- r.getSessionState()
978
- ]);
979
- if (!E) return;
980
- const p = {
981
- ...S && {
982
- volume: S.volume,
983
- isMuted: S.isMuted,
984
- playbackRate: S.playbackRate,
985
- subtitlesShowing: S.subtitlesShowing
986
- },
987
- ..._ && e === _.mediaId && {
988
- currentTime: _.currentTime
989
- }
990
- };
991
- Object.keys(p).length > 0 && console.log("Rehydrated state:", p), n(!0);
992
- } catch (S) {
993
- console.warn("Failed to rehydrate state:", S), n(!0);
994
- }
995
- })(), () => {
996
- E = !1;
997
- };
998
- }, [r, e]), T.useEffect(() => {
999
- if (!a) return;
1000
- const E = r.extractUserPreferences(o);
1001
- if (r.saveUserPreferences(E), e) {
1002
- const c = r.extractSessionState(o, e);
1003
- r.saveSessionState(c), o.currentTime > 0 && o.duration > 0 && r.savePlaybackPosition(e, o.currentTime);
1004
- }
1005
- }, [r, o, e, a]), {
1006
- manager: r,
1007
- isRehydrated: a
1008
- };
1009
- }
1010
- function ve(o = Q) {
1011
- let e = { ...o };
1012
- const t = /* @__PURE__ */ new Set(), r = (c) => (t.add(c), () => t.delete(c)), a = () => e, n = (c) => {
1013
- const S = { ...e, ...c };
1014
- JSON.stringify(S) !== JSON.stringify(e) && (e = S, t.forEach((_) => _()));
1015
- };
1016
- return { subscribe: r, getState: a, setState: n, dispatch: (c) => {
1017
- switch (c.type) {
1018
- case i.PLAY:
1019
- n({ isPlaying: !0, error: null });
1020
- break;
1021
- case i.PAUSE:
1022
- n({ isPlaying: !1 });
1023
- break;
1024
- case i.SEEK:
1025
- n({ currentTime: c.detail });
1026
- break;
1027
- case i.SET_VOLUME:
1028
- n({ volume: Math.max(0, Math.min(1, c.detail)) });
1029
- break;
1030
- case i.MUTE:
1031
- n({ isMuted: !0 });
1032
- break;
1033
- case i.UNMUTE:
1034
- n({ isMuted: !1 });
1035
- break;
1036
- case i.TOGGLE_MUTE:
1037
- n({ isMuted: !e.isMuted });
1038
- break;
1039
- case i.SET_DURATION:
1040
- n({ duration: c.detail });
1041
- break;
1042
- case i.SET_CURRENT_TIME:
1043
- n({ currentTime: c.detail });
1044
- break;
1045
- case i.SET_BUFFERED:
1046
- n({ buffered: c.detail });
1047
- break;
1048
- case i.SET_LOADING:
1049
- n({ isLoading: c.detail });
1050
- break;
1051
- case i.SET_ERROR:
1052
- n({ error: c.detail, isLoading: !1 });
1053
- break;
1054
- case i.ENTER_FULLSCREEN:
1055
- n({ isFullscreen: !0 });
1056
- break;
1057
- case i.EXIT_FULLSCREEN:
1058
- n({ isFullscreen: !1 });
1059
- break;
1060
- case i.ENTER_PIP:
1061
- n({ isPictureInPicture: !0 });
1062
- break;
1063
- case i.EXIT_PIP:
1064
- n({ isPictureInPicture: !1 });
1065
- break;
1066
- case i.SET_PLAYBACK_RATE:
1067
- n({ playbackRate: c.detail });
1068
- break;
1069
- case i.SET_SUBTITLE_TRACK:
1070
- n({ selectedSubtitleTrack: c.detail });
1071
- break;
1072
- case i.SET_RENDITION:
1073
- n({ selectedRendition: c.detail });
1074
- break;
1075
- case i.TOGGLE_SUBTITLES:
1076
- n({ subtitlesShowing: !e.subtitlesShowing });
1077
- break;
1078
- case i.PREVIEW_TIME:
1079
- n({ previewTime: c.detail });
1080
- break;
1081
- case i.CLEAR_PREVIEW:
1082
- n({ previewTime: null, previewImage: null, previewCoords: null });
1083
- break;
1084
- default:
1085
- console.warn(`Unknown media action type: ${c.type}`);
1086
- }
1087
- } };
1088
- }
1089
- function Ce({
1090
- children: o,
1091
- mediaId: e = "media-player",
1092
- labelId: t = "media-player-label",
1093
- descriptionId: r = "media-player-description",
1094
- dir: a = "ltr",
1095
- portalContainer: n,
1096
- tooltipDelayDuration: E = 700,
1097
- tooltipSideOffset: c = 4,
1098
- disabled: S = !1,
1099
- isVideo: _ = !0,
1100
- withoutTooltip: p = !1,
1101
- initialState: F = {},
1102
- // React 19 enhancements
1103
- useEnhancedStore: g = !0,
1104
- persistenceConfig: A,
1105
- retryConfig: D,
1106
- enableOptimisticUpdates: L = !0,
1107
- enableErrorRecovery: U = !0,
1108
- onStateRehydrated: v
1109
- }) {
1110
- const G = T.useRef(null), j = T.useRef(null), I = T.useMemo(() => {
1111
- const w = { ...Q, ...F };
1112
- return g ? he(w, A) : ve(w);
1113
- }, [g, A]), C = T.useMemo(() => U && g ? new ge(D) : null, [U, g, D]), h = Ae(I.getState(), e, A);
1114
- T.useEffect(() => {
1115
- if (h?.isRehydrated && v) {
1116
- const w = I.getState();
1117
- v(w);
1118
- }
1119
- }, [h?.isRehydrated, v, I]);
1120
- const B = T.useMemo(
1121
- () => ({
1122
- mediaId: e,
1123
- labelId: t,
1124
- descriptionId: r,
1125
- dir: a,
1126
- rootRef: G,
1127
- mediaRef: j,
1128
- portalContainer: n,
1129
- tooltipDelayDuration: E,
1130
- tooltipSideOffset: c,
1131
- disabled: S,
1132
- isVideo: _,
1133
- withoutTooltip: p,
1134
- // React 19 enhancements
1135
- errorHandler: C,
1136
- isEnhanced: g,
1137
- isRehydrated: h?.isRehydrated
1138
- }),
1139
- [
1140
- e,
1141
- t,
1142
- r,
1143
- a,
1144
- n,
1145
- E,
1146
- c,
1147
- S,
1148
- _,
1149
- p,
1150
- C,
1151
- g,
1152
- h?.isRehydrated
1153
- ]
1154
- );
1155
- return /* @__PURE__ */ ae.jsx(oe.Provider, { value: B, children: /* @__PURE__ */ ae.jsx(ie.Provider, { value: I, children: o }) });
1156
- }
1157
- export {
1158
- i as M,
1159
- Me as a,
1160
- ke as b,
1161
- H as c,
1162
- Ce as d,
1163
- Le as e,
1164
- he as f,
1165
- oe as g,
1166
- ie as h,
1167
- Ue as i,
1168
- ae as j,
1169
- Q as k,
1170
- Se as u
1171
- };
1172
- //# sourceMappingURL=context-BYwDoSRX.js.map