@therealtinhtute/baroiplayer 1.2.1 → 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.
- package/README.md +90 -71
- package/dist/components/icons/index.d.ts +36 -0
- package/dist/components/icons/index.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/ArrowLeftIcon.d.ts +4 -0
- package/dist/components/icons/svg-icons/ArrowLeftIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/ArrowRightIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/ArrowRightIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/AudioIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/AudioIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/BackwardIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/BackwardIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/CameraIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/CameraIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/CheckIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/CheckIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/EnablePiPIcon.d.ts +4 -0
- package/dist/components/icons/svg-icons/EnablePiPIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/ForwardIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/ForwardIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/FullscreenEnterIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/FullscreenEnterIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/FullscreenExitIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/FullscreenExitIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/LoadingIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/LoadingIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/PauseIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/PauseIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/PlayIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/PlayIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/PlaybackSpeedIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/PlaybackSpeedIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/QualityIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/QualityIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SettingsIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SettingsIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SliderIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SliderIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SubtitleIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SubtitleIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SubtitleOffIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SubtitleOffIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/UnPiPIcon.d.ts +4 -0
- package/dist/components/icons/svg-icons/UnPiPIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeMutedIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeMutedIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeOneIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeOneIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeThreeIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeThreeIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeTwoIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeTwoIcon.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-audio.d.ts +13 -0
- package/dist/components/variants/gradient/gradient-audio.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-controls.d.ts +4 -0
- package/dist/components/variants/gradient/gradient-controls.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-glyphs.d.ts +30 -0
- package/dist/components/variants/gradient/gradient-glyphs.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-video.d.ts +16 -0
- package/dist/components/variants/gradient/gradient-video.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +750 -5640
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +3 -0
- package/package.json +110 -114
- package/src/components/variants/gradient/gradient-audio.tsx +47 -0
- package/src/components/variants/gradient/gradient-controls.tsx +254 -0
- package/src/components/variants/gradient/gradient-glyphs.test.tsx +69 -0
- package/src/components/variants/gradient/gradient-glyphs.tsx +129 -0
- package/src/components/variants/gradient/gradient-skin.css +211 -0
- package/src/components/variants/gradient/gradient-video.tsx +70 -0
- package/src/index.ts +5 -198
- package/src/test/accessibility-utils.ts +0 -59
- package/dist/context/media.js +0 -1
- package/dist/context/media.mjs +0 -3
- package/dist/context/store.js +0 -1
- package/dist/context/store.mjs +0 -3
- package/dist/context-Bzd5QCKM.cjs +0 -7
- package/dist/context-Bzd5QCKM.cjs.map +0 -1
- package/dist/context-DD_SH4tT.js +0 -1053
- package/dist/context-DD_SH4tT.js.map +0 -1
- package/dist/core-events-BRnLMB7s.cjs +0 -2
- package/dist/core-events-BRnLMB7s.cjs.map +0 -1
- package/dist/core-events-v_mKdj5p.js +0 -417
- package/dist/core-events-v_mKdj5p.js.map +0 -1
- package/dist/core-plugins-CMBv-yVh.cjs +0 -2
- package/dist/core-plugins-CMBv-yVh.cjs.map +0 -1
- package/dist/core-plugins-CqCxLkbd.js +0 -754
- package/dist/core-plugins-CqCxLkbd.js.map +0 -1
- package/dist/core.js +0 -15
- package/dist/core.js.map +0 -1
- package/dist/core.mjs +0 -960
- package/dist/core.mjs.map +0 -1
- package/dist/enhanced-components-BwjBqSA1.js +0 -2858
- package/dist/enhanced-components-BwjBqSA1.js.map +0 -1
- package/dist/enhanced-components-C-ka-XLp.cjs +0 -2
- package/dist/enhanced-components-C-ka-XLp.cjs.map +0 -1
- package/dist/hooks-B-IIWPJr.js +0 -1842
- package/dist/hooks-B-IIWPJr.js.map +0 -1
- package/dist/hooks-DcHzmBwA.cjs +0 -4
- package/dist/hooks-DcHzmBwA.cjs.map +0 -1
- package/dist/minimal-components-BYsMQde5.js +0 -1610
- package/dist/minimal-components-BYsMQde5.js.map +0 -1
- package/dist/minimal-components-CsxQbDp7.cjs +0 -2
- package/dist/minimal-components-CsxQbDp7.cjs.map +0 -1
- package/dist/minimal-components.css +0 -1
- package/dist/mona-loading.gif +0 -0
- package/dist/performance-monitor-DCSijLJg.js +0 -312
- package/dist/performance-monitor-DCSijLJg.js.map +0 -1
- package/dist/performance-monitor-wNFKmqMr.cjs +0 -2
- package/dist/performance-monitor-wNFKmqMr.cjs.map +0 -1
- package/dist/rolldown-runtime-BmowowmI.js +0 -14
- package/dist/rolldown-runtime-mLOUI7ql.cjs +0 -1
- package/dist/utils-D2gQ7c2R.js +0 -64
- package/dist/utils-D2gQ7c2R.js.map +0 -1
- package/dist/utils-DJaAwiZ9.cjs +0 -2
- package/dist/utils-DJaAwiZ9.cjs.map +0 -1
- package/dist/utils.js +0 -1
- package/dist/utils.mjs +0 -3
- package/src/adapters/videojs-adapter.tsx +0 -470
- package/src/assets/mona-loading.gif +0 -0
- package/src/components/AnimateLoading.tsx +0 -111
- package/src/components/LoadingState.tsx +0 -239
- package/src/components/__tests__/media-player-accessibility.test.tsx +0 -510
- package/src/components/__tests__/media-player-react19.test.tsx +0 -457
- package/src/components/accessibility/keyboard-help-overlay.tsx +0 -207
- package/src/components/audio-player.tsx +0 -85
- package/src/components/basic/index.ts +0 -37
- package/src/components/enhanced/advanced-features.tsx +0 -311
- package/src/components/enhanced/debug-panel.tsx +0 -448
- package/src/components/enhanced/enhanced-controls.tsx +0 -597
- package/src/components/enhanced/enhanced-media-player.tsx +0 -566
- package/src/components/enhanced/error-handling.tsx +0 -338
- package/src/components/enhanced/index.ts +0 -39
- package/src/components/enhanced/media-player-enhanced.tsx +0 -383
- package/src/components/examples/basic-video-player.tsx +0 -50
- package/src/components/examples/custom-controls-example.tsx +0 -63
- package/src/components/examples/enhanced-controls-example.tsx +0 -100
- package/src/components/examples/enhanced-media-player-example.tsx +0 -302
- package/src/components/examples/loading-states-demo.tsx +0 -141
- package/src/components/examples/react-19-demo.tsx +0 -349
- package/src/components/examples/volume-orientation-demo.tsx +0 -105
- package/src/components/icon-demo.tsx +0 -196
- package/src/components/legacy.tsx +0 -87
- package/src/components/media-metadata-display.tsx +0 -99
- package/src/components/media-player-audio.tsx +0 -39
- package/src/components/media-player-controls.tsx +0 -223
- package/src/components/media-player-error.tsx +0 -163
- package/src/components/media-player-fullscreen.tsx +0 -109
- package/src/components/media-player-hls.tsx +0 -111
- package/src/components/media-player-loading.tsx +0 -76
- package/src/components/media-player-play.tsx +0 -75
- package/src/components/media-player-root.tsx +0 -338
- package/src/components/media-player-seek.tsx +0 -168
- package/src/components/media-player-time.tsx +0 -99
- package/src/components/media-player-tooltip.tsx +0 -58
- package/src/components/media-player-video.tsx +0 -54
- package/src/components/media-player-volume.tsx +0 -155
- package/src/components/media-player.tsx +0 -292
- package/src/components/media-suspense.tsx +0 -344
- package/src/components/player-settings-form.tsx +0 -158
- package/src/components/react-player-wrapper.tsx +0 -651
- package/src/components/simple-video-player.tsx +0 -62
- package/src/components/ui/blur-poster.tsx +0 -96
- package/src/components/ui/empty-state.tsx +0 -91
- package/src/components/ui/enhanced-seek-bar.tsx +0 -254
- package/src/components/ui/error-state.tsx +0 -124
- package/src/components/ui/fullscreen-button.tsx +0 -81
- package/src/components/ui/loading-skeleton.tsx +0 -107
- package/src/components/ui/media-resource-preloader.tsx +0 -458
- package/src/components/ui/offline-message.tsx +0 -98
- package/src/components/ui/play-button.tsx +0 -99
- package/src/components/ui/seek-bar.tsx +0 -191
- package/src/components/ui/time-display.tsx +0 -61
- package/src/components/ui/volume-control.tsx +0 -190
- package/src/components/unified/base-media-player.tsx +0 -252
- package/src/components/unified/media-player.tsx +0 -75
- package/src/components/variants/minimal/AccessibleMinimalPlayer.tsx +0 -587
- package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.tsx +0 -573
- package/src/components/variants/minimal/MinimalControls.tsx +0 -124
- package/src/components/variants/minimal/MinimalLoading.tsx +0 -28
- package/src/components/variants/minimal/MinimalMediaPlayer.tsx +0 -318
- package/src/components/variants/minimal/MinimalOverlay.tsx +0 -58
- package/src/components/variants/minimal/MinimalPlayButton.tsx +0 -56
- package/src/components/variants/minimal/MinimalSeekBar.tsx +0 -140
- package/src/components/variants/minimal/MinimalVolumeControl.tsx +0 -75
- package/src/components/variants/minimal/SimpleMinimalPlayer.tsx +0 -206
- package/src/components/variants/minimal/components/CenterPlayButton.tsx +0 -22
- package/src/components/variants/minimal/components/ControlBar.tsx +0 -142
- package/src/components/variants/minimal/components/EnhancedSettingsMenu.tsx +0 -412
- package/src/components/variants/minimal/components/PlaybackControls.tsx +0 -46
- package/src/components/variants/minimal/components/RightControls.tsx +0 -164
- package/src/components/variants/minimal/components/SeekBar.tsx +0 -127
- package/src/components/variants/minimal/components/SettingsDropdown.tsx +0 -68
- package/src/components/variants/minimal/components/SubtitleDisplay.tsx +0 -21
- package/src/components/variants/minimal/components/TimeDisplay.tsx +0 -15
- package/src/components/variants/minimal/components/VideoElement.tsx +0 -35
- package/src/components/variants/minimal/components/VolumeControl.tsx +0 -220
- package/src/components/variants/minimal/index.ts +0 -23
- package/src/components/video-player.tsx +0 -100
- package/src/context/__tests__/media-store.test.ts +0 -509
- package/src/context/error-handling.ts +0 -398
- package/src/context/media-context.tsx +0 -254
- package/src/context/media-provider.tsx +0 -264
- package/src/context/media-store.ts +0 -387
- package/src/context/persistence.ts +0 -462
- package/src/core/events/event-system.ts +0 -448
- package/src/core/events/hooks.ts +0 -325
- package/src/core/events/index.ts +0 -22
- package/src/core/events/middleware.ts +0 -286
- package/src/core/index.ts +0 -22
- package/src/core/optimization/bundle-optimizer.tsx +0 -312
- package/src/core/performance/cicd.ts +0 -98
- package/src/core/performance/index.ts +0 -38
- package/src/core/performance/media-loading-optimizer.ts +0 -545
- package/src/core/performance/performance-budgets.ts +0 -437
- package/src/core/performance/performance-monitor.tsx +0 -488
- package/src/core/performance/performance-testing.ts +0 -461
- package/src/core/plugins/__tests__/registry.test.ts +0 -595
- package/src/core/plugins/base-plugin.ts +0 -225
- package/src/core/plugins/enhanced-plugin-system.ts +0 -435
- package/src/core/plugins/examples/analytics-plugin.ts +0 -241
- package/src/core/plugins/index.ts +0 -39
- package/src/core/plugins/registry.ts +0 -546
- package/src/core/plugins/types.ts +0 -169
- package/src/core/plugins/utils.ts +0 -317
- package/src/core/progressive-loading.tsx +0 -331
- package/src/core/providers/enhanced-hls-provider.ts +0 -307
- package/src/core/providers/lazy-provider.tsx +0 -14
- package/src/core/providers/service-provider.tsx +0 -164
- package/src/core/utils.tsx +0 -34
- package/src/features/media-session/media-session-manager.ts +0 -411
- package/src/features/picture-in-picture/pip-manager.ts +0 -428
- package/src/features/playlist/playlist-manager.ts +0 -626
- package/src/features/subtitles/subtitle-manager.ts +0 -435
- package/src/features/subtitles/subtitle-parser.ts +0 -284
- package/src/features/thumbnails/thumbnail-generator.ts +0 -528
- package/src/hooks/__tests__/currentTime-fix.test.ts +0 -149
- package/src/hooks/__tests__/use-media-player.test.ts +0 -712
- package/src/hooks/__tests__/use-media-state.test.tsx +0 -316
- package/src/hooks/accessibility/index.ts +0 -27
- package/src/hooks/accessibility/use-accessibility-preferences.ts +0 -190
- package/src/hooks/accessibility/use-focus-management.ts +0 -183
- package/src/hooks/accessibility/use-keyboard-shortcuts.ts +0 -152
- package/src/hooks/accessibility/use-screen-reader.ts +0 -212
- package/src/hooks/core/index.ts +0 -47
- package/src/hooks/legacy.ts +0 -21
- package/src/hooks/use-buffer-health.ts +0 -218
- package/src/hooks/use-enhanced-media-player.ts +0 -575
- package/src/hooks/use-focus-trap.tsx +0 -162
- package/src/hooks/use-intelligent-preloading.ts +0 -387
- package/src/hooks/use-keyboard-controls.ts +0 -115
- package/src/hooks/use-keyboard-shortcuts.ts +0 -255
- package/src/hooks/use-media-actions.ts +0 -184
- package/src/hooks/use-media-metadata.ts +0 -91
- package/src/hooks/use-media-optimistic.ts +0 -264
- package/src/hooks/use-media-player.ts +0 -343
- package/src/hooks/use-media-state.ts +0 -194
- package/src/hooks/use-memory-optimization.ts +0 -360
- package/src/hooks/use-network-status.ts +0 -124
- package/src/hooks/use-optimistic-controls.ts +0 -95
- package/src/hooks/use-optimized-media.ts +0 -283
- package/src/hooks/use-smart-preload.ts +0 -229
- package/src/hooks/use-touch-gestures.ts +0 -461
- package/src/hooks/useEnhancedSubtitles.ts +0 -258
- package/src/hooks/useKeyboardShortcuts.ts +0 -106
- package/src/hooks/useMediaControls.ts +0 -52
- package/src/hooks/useScreenshot.ts +0 -77
- package/src/hooks/useSubtitles.ts +0 -91
- package/src/hooks/useVideoPlayer.ts +0 -278
- package/src/icons/components/FullscreenIcon.tsx +0 -36
- package/src/icons/components/SettingsIcon.tsx +0 -37
- package/src/icons/components/animated/LoadingIcon.tsx +0 -27
- package/src/icons/components/animated/PlayPauseIcon.tsx +0 -42
- package/src/icons/components/media/PauseIcon.tsx +0 -38
- package/src/icons/components/media/PlayIcon.tsx +0 -37
- package/src/icons/components/volume/VolumeIcon.tsx +0 -38
- package/src/icons/components/volume/VolumeOffIcon.tsx +0 -38
- package/src/icons/index.ts +0 -56
- package/src/icons/provider.tsx +0 -58
- package/src/icons/types.ts +0 -60
- package/src/index-enhanced.ts +0 -35
- package/src/index-legacy.ts +0 -324
- package/src/index.css +0 -102
- package/src/lib/__tests__/async-utils.test.ts +0 -291
- package/src/lib/async-utils.ts +0 -194
- package/src/lib/deprecation.ts +0 -51
- package/src/lib/format-time.ts +0 -37
- package/src/lib/index.ts +0 -4
- package/src/lib/utils.ts +0 -6
- package/src/styles/globals.css +0 -462
- package/src/styles/minimal-player.css +0 -621
- package/src/styles/pixel-art.css +0 -41
- package/src/styles/videojs.css +0 -100
- package/src/types/assets.d.ts +0 -29
- package/src/types/events.ts +0 -47
- package/src/types/formats.ts +0 -79
- package/src/types/index.ts +0 -203
- package/src/types/videojs-plugins.d.ts +0 -14
package/dist/core.mjs
DELETED
|
@@ -1,960 +0,0 @@
|
|
|
1
|
-
import { i as e, r as t } from "./context-DD_SH4tT.js";
|
|
2
|
-
import { a as n, i as r, n as i, o as a, r as o, s, t as c } from "./performance-monitor-DCSijLJg.js";
|
|
3
|
-
import { a as l, c as u, d, f as ee, g as te, h as f, i as p, l as m, m as h, n as g, o as _, p as ne, r as re, s as v, t as ie, u as ae } from "./core-plugins-CqCxLkbd.js";
|
|
4
|
-
import { _ as y, a as oe, c as se, d as ce, f as le, g as ue, h as de, i as fe, l as pe, m as me, n as he, o as ge, p as b, r as x, s as S, t as C, u as w, v as T, y as E } from "./core-events-v_mKdj5p.js";
|
|
5
|
-
import D, { createContext as O, lazy as k, useContext as A, useMemo as j } from "react";
|
|
6
|
-
//#region src/core/performance/performance-testing.ts
|
|
7
|
-
var M = class {
|
|
8
|
-
constructor() {
|
|
9
|
-
t(this, "results", []), t(this, "regressionDetector", new o());
|
|
10
|
-
}
|
|
11
|
-
async runTest(e, t) {
|
|
12
|
-
let n = [], r = 0, i = 0, a;
|
|
13
|
-
try {
|
|
14
|
-
for (let n = 0; n < e.warmupIterations; n++) await t();
|
|
15
|
-
global.gc && global.gc(), r = this.getMemoryUsage();
|
|
16
|
-
for (let r = 0; r < e.iterations; r++) {
|
|
17
|
-
let e = performance.now();
|
|
18
|
-
await t();
|
|
19
|
-
let r = performance.now();
|
|
20
|
-
n.push(r - e);
|
|
21
|
-
}
|
|
22
|
-
i = this.getMemoryUsage();
|
|
23
|
-
} catch (e) {
|
|
24
|
-
a = e instanceof Error ? e.message : String(e);
|
|
25
|
-
}
|
|
26
|
-
let o = n.reduce((e, t) => e + t, 0) / n.length, s = Math.min(...n), c = Math.max(...n), l = i - r, u = {
|
|
27
|
-
testName: e.name,
|
|
28
|
-
passed: !a && o <= e.expectedThreshold.renderTime && l <= e.expectedThreshold.memoryUsage,
|
|
29
|
-
metrics: {
|
|
30
|
-
averageRenderTime: o,
|
|
31
|
-
minRenderTime: isFinite(s) ? s : 0,
|
|
32
|
-
maxRenderTime: isFinite(c) ? c : 0,
|
|
33
|
-
memoryUsage: l,
|
|
34
|
-
iterations: e.iterations
|
|
35
|
-
},
|
|
36
|
-
threshold: e.expectedThreshold,
|
|
37
|
-
error: a
|
|
38
|
-
};
|
|
39
|
-
return this.results.push(u), u;
|
|
40
|
-
}
|
|
41
|
-
getMemoryUsage() {
|
|
42
|
-
return "memory" in performance && performance.memory.usedJSHeapSize || 0;
|
|
43
|
-
}
|
|
44
|
-
async testComponentRender(e, t, n = 16) {
|
|
45
|
-
let r = {
|
|
46
|
-
name: `${e} Render Performance`,
|
|
47
|
-
iterations: 100,
|
|
48
|
-
warmupIterations: 10,
|
|
49
|
-
timeout: 5e3,
|
|
50
|
-
expectedThreshold: {
|
|
51
|
-
renderTime: n,
|
|
52
|
-
memoryUsage: 1024 * 1024
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
return this.runTest(r, t);
|
|
56
|
-
}
|
|
57
|
-
async testBundleLoading(e, t = 1e3) {
|
|
58
|
-
let n = {
|
|
59
|
-
name: `Bundle Loading: ${e}`,
|
|
60
|
-
iterations: 5,
|
|
61
|
-
warmupIterations: 1,
|
|
62
|
-
timeout: 1e4,
|
|
63
|
-
expectedThreshold: {
|
|
64
|
-
renderTime: t,
|
|
65
|
-
memoryUsage: 5 * 1024 * 1024
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
return this.runTest(n, async () => {
|
|
69
|
-
let t = performance.now();
|
|
70
|
-
try {
|
|
71
|
-
let t = await fetch(e);
|
|
72
|
-
if (!t.ok) throw Error(`Failed to load bundle: ${t.status}`);
|
|
73
|
-
await t.blob();
|
|
74
|
-
} catch (t) {
|
|
75
|
-
console.warn(`Bundle loading test failed for ${e}:`, t);
|
|
76
|
-
}
|
|
77
|
-
return performance.now() - t;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
async testMemoryLeaks(e, t = 1e3) {
|
|
81
|
-
let n = {
|
|
82
|
-
name: "Memory Leak Detection",
|
|
83
|
-
iterations: t,
|
|
84
|
-
warmupIterations: 100,
|
|
85
|
-
timeout: 3e4,
|
|
86
|
-
expectedThreshold: {
|
|
87
|
-
renderTime: Infinity,
|
|
88
|
-
memoryUsage: 10 * 1024 * 1024
|
|
89
|
-
}
|
|
90
|
-
}, r = this.getMemoryUsage(), i = await this.runTest(n, e), a = this.getMemoryUsage() - r, o = a > n.expectedThreshold.memoryUsage;
|
|
91
|
-
return {
|
|
92
|
-
...i,
|
|
93
|
-
passed: i.passed && !o,
|
|
94
|
-
error: o ? `Potential memory leak detected: ${Math.round(a / 1024 / 1024)}MB increase` : i.error
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
async testInteractionDelay(e, t = 100) {
|
|
98
|
-
let n = {
|
|
99
|
-
name: "Interaction Delay",
|
|
100
|
-
iterations: 50,
|
|
101
|
-
warmupIterations: 5,
|
|
102
|
-
timeout: 5e3,
|
|
103
|
-
expectedThreshold: {
|
|
104
|
-
renderTime: t,
|
|
105
|
-
memoryUsage: 1024 * 1024
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
return this.runTest(n, e);
|
|
109
|
-
}
|
|
110
|
-
async runRegressionTests(e, t) {
|
|
111
|
-
t && this.regressionDetector.setBaseline(t);
|
|
112
|
-
let n = this.regressionDetector.detectRegression(e);
|
|
113
|
-
return {
|
|
114
|
-
passed: n.length === 0,
|
|
115
|
-
regressions: n
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
getResults() {
|
|
119
|
-
return [...this.results];
|
|
120
|
-
}
|
|
121
|
-
getSummary() {
|
|
122
|
-
let e = this.results.length, t = this.results.filter((e) => e.passed).length;
|
|
123
|
-
return {
|
|
124
|
-
totalTests: e,
|
|
125
|
-
passedTests: t,
|
|
126
|
-
failedTests: e - t,
|
|
127
|
-
passRate: e > 0 ? t / e * 100 : 0
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
clearResults() {
|
|
131
|
-
this.results = [];
|
|
132
|
-
}
|
|
133
|
-
generateReport() {
|
|
134
|
-
let e = this.getSummary(), t = "Performance Test Report\n";
|
|
135
|
-
return t += "========================\n\n", t += `Total Tests: ${e.totalTests}\n`, t += `Passed: ${e.passedTests}\n`, t += `Failed: ${e.failedTests}\n`, t += `Pass Rate: ${e.passRate.toFixed(1)}%\n\n`, this.results.length > 0 && (t += "Detailed Results:\n", t += "-----------------\n\n", this.results.forEach((e, n) => {
|
|
136
|
-
t += `${n + 1}. ${e.testName}\n`, t += ` Status: ${e.passed ? "PASS" : "FAIL"}\n`, t += ` Average Render Time: ${e.metrics.averageRenderTime.toFixed(2)}ms\n`, t += ` Min/Max Render Time: ${e.metrics.minRenderTime.toFixed(2)}ms / ${e.metrics.maxRenderTime.toFixed(2)}ms\n`, t += ` Memory Usage: ${Math.round(e.metrics.memoryUsage / 1024)} KB\n`, t += ` Iterations: ${e.metrics.iterations}\n`, e.error && (t += ` Error: ${e.error}\n`), t += "\n";
|
|
137
|
-
})), t;
|
|
138
|
-
}
|
|
139
|
-
}, N = new M(), P = {
|
|
140
|
-
async testComponent(e, t = {}, n = 16) {
|
|
141
|
-
return N.testComponentRender(e.displayName || e.name || "Component", () => ({
|
|
142
|
-
type: e,
|
|
143
|
-
props: t
|
|
144
|
-
}), n);
|
|
145
|
-
},
|
|
146
|
-
async testHook(e, t, n = 1) {
|
|
147
|
-
let r = {
|
|
148
|
-
name: `Hook Performance: ${t}`,
|
|
149
|
-
iterations: 1e3,
|
|
150
|
-
warmupIterations: 100,
|
|
151
|
-
timeout: 5e3,
|
|
152
|
-
expectedThreshold: {
|
|
153
|
-
renderTime: n,
|
|
154
|
-
memoryUsage: 1024 * 1024
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
return N.runTest(r, e);
|
|
158
|
-
},
|
|
159
|
-
async testAsyncOperation(e, t, n = 1e3) {
|
|
160
|
-
let r = {
|
|
161
|
-
name: `Async Operation: ${t}`,
|
|
162
|
-
iterations: 10,
|
|
163
|
-
warmupIterations: 2,
|
|
164
|
-
timeout: 3e4,
|
|
165
|
-
expectedThreshold: {
|
|
166
|
-
renderTime: n,
|
|
167
|
-
memoryUsage: 2 * 1024 * 1024
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
return N.runTest(r, e);
|
|
171
|
-
},
|
|
172
|
-
async measureBundleImpact(e, t, n) {
|
|
173
|
-
let r = performance.memory?.usedJSHeapSize || 0, i = performance.now();
|
|
174
|
-
e();
|
|
175
|
-
let a = performance.memory?.usedJSHeapSize || 0, o = performance.now();
|
|
176
|
-
t();
|
|
177
|
-
let s = performance.memory?.usedJSHeapSize || 0, c = performance.now();
|
|
178
|
-
return {
|
|
179
|
-
bundleIncrease: s - r,
|
|
180
|
-
memoryIncrease: a - r,
|
|
181
|
-
renderTimeImpact: c - o - (o - i)
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
}, F = class {
|
|
185
|
-
constructor() {
|
|
186
|
-
t(this, "benchmark", new M()), t(this, "suites", /* @__PURE__ */ new Map());
|
|
187
|
-
}
|
|
188
|
-
registerSuite(e, t) {
|
|
189
|
-
this.suites.set(e, t);
|
|
190
|
-
}
|
|
191
|
-
async runSuite(e, t) {
|
|
192
|
-
let n = this.suites.get(e);
|
|
193
|
-
if (!n) throw Error(`Test suite '${e}' not found`);
|
|
194
|
-
let r = [];
|
|
195
|
-
for (let e of n) {
|
|
196
|
-
let n = t.get(e.name);
|
|
197
|
-
if (!n) {
|
|
198
|
-
console.warn(`No implementation found for test '${e.name}'`);
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
let i = await this.benchmark.runTest(e, n);
|
|
202
|
-
r.push(i);
|
|
203
|
-
}
|
|
204
|
-
return r;
|
|
205
|
-
}
|
|
206
|
-
async runAllSuites(e) {
|
|
207
|
-
let t = /* @__PURE__ */ new Map();
|
|
208
|
-
for (let [n] of this.suites) {
|
|
209
|
-
let r = e.get(n);
|
|
210
|
-
if (!r) {
|
|
211
|
-
console.warn(`No implementations found for suite '${n}'`);
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
let i = await this.runSuite(n, r);
|
|
215
|
-
t.set(n, i);
|
|
216
|
-
}
|
|
217
|
-
return t;
|
|
218
|
-
}
|
|
219
|
-
generateComprehensiveReport() {
|
|
220
|
-
this.benchmark.getSummary();
|
|
221
|
-
let e = this.benchmark.generateReport();
|
|
222
|
-
if (this.suites.size > 0) {
|
|
223
|
-
e += "\nTest Suites:\n", e += "============\n\n";
|
|
224
|
-
for (let [t, n] of this.suites) e += `Suite: ${t}\n`, e += `Tests: ${n.length}\n\n`;
|
|
225
|
-
}
|
|
226
|
-
return e;
|
|
227
|
-
}
|
|
228
|
-
}, I = new F(), L = [
|
|
229
|
-
{
|
|
230
|
-
name: "Main Bundle Size (ESM)",
|
|
231
|
-
category: "bundle",
|
|
232
|
-
limit: 250 * 1024,
|
|
233
|
-
unit: "bytes",
|
|
234
|
-
severity: "error",
|
|
235
|
-
description: "Main bundle should stay under 250KB for fast initial loading"
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
name: "Main Bundle Size (CJS)",
|
|
239
|
-
category: "bundle",
|
|
240
|
-
limit: 200 * 1024,
|
|
241
|
-
unit: "bytes",
|
|
242
|
-
severity: "error",
|
|
243
|
-
description: "CJS bundle should be smaller due to better compression"
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
name: "Core Module Size",
|
|
247
|
-
category: "bundle",
|
|
248
|
-
limit: 15 * 1024,
|
|
249
|
-
unit: "bytes",
|
|
250
|
-
severity: "warning",
|
|
251
|
-
description: "Core architecture should remain lightweight"
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
name: "Enhanced Components Size",
|
|
255
|
-
category: "bundle",
|
|
256
|
-
limit: 40 * 1024,
|
|
257
|
-
unit: "bytes",
|
|
258
|
-
severity: "warning",
|
|
259
|
-
description: "Enhanced components bundle size"
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
name: "Component Render Time",
|
|
263
|
-
category: "runtime",
|
|
264
|
-
limit: 16,
|
|
265
|
-
unit: "ms",
|
|
266
|
-
severity: "error",
|
|
267
|
-
description: "Component rendering should complete within one frame"
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
name: "First Input Delay",
|
|
271
|
-
category: "runtime",
|
|
272
|
-
limit: 100,
|
|
273
|
-
unit: "ms",
|
|
274
|
-
severity: "error",
|
|
275
|
-
description: "First Input Delay should be under 100ms for good UX"
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
name: "Largest Contentful Paint",
|
|
279
|
-
category: "runtime",
|
|
280
|
-
limit: 2500,
|
|
281
|
-
unit: "ms",
|
|
282
|
-
severity: "warning",
|
|
283
|
-
description: "LCP should be under 2.5s for good Core Web Vitals score"
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
name: "Cumulative Layout Shift",
|
|
287
|
-
category: "runtime",
|
|
288
|
-
limit: .1,
|
|
289
|
-
unit: "score",
|
|
290
|
-
severity: "warning",
|
|
291
|
-
description: "CLS should be under 0.1 for good visual stability"
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
name: "Memory Usage",
|
|
295
|
-
category: "memory",
|
|
296
|
-
limit: 50 * 1024 * 1024,
|
|
297
|
-
unit: "bytes",
|
|
298
|
-
severity: "warning",
|
|
299
|
-
description: "Memory usage should stay under 50MB for good performance"
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
name: "Memory Increase Per Operation",
|
|
303
|
-
category: "memory",
|
|
304
|
-
limit: 1024 * 1024,
|
|
305
|
-
unit: "bytes",
|
|
306
|
-
severity: "error",
|
|
307
|
-
description: "Each operation should not increase memory by more than 1MB"
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
name: "Media Load Time",
|
|
311
|
-
category: "network",
|
|
312
|
-
limit: 3e3,
|
|
313
|
-
unit: "ms",
|
|
314
|
-
severity: "warning",
|
|
315
|
-
description: "Media should start loading within 3 seconds"
|
|
316
|
-
}
|
|
317
|
-
], R = class {
|
|
318
|
-
constructor(e = L, n = {
|
|
319
|
-
enabled: !0,
|
|
320
|
-
channels: [{
|
|
321
|
-
type: "console",
|
|
322
|
-
config: {}
|
|
323
|
-
}],
|
|
324
|
-
threshold: 1,
|
|
325
|
-
cooldown: 300 * 1e3
|
|
326
|
-
}) {
|
|
327
|
-
t(this, "budgets", /* @__PURE__ */ new Map()), t(this, "violations", []), t(this, "alertConfig", void 0), t(this, "lastAlertTime", 0), e.forEach((e) => {
|
|
328
|
-
this.budgets.set(e.name, e);
|
|
329
|
-
}), this.alertConfig = n;
|
|
330
|
-
}
|
|
331
|
-
checkMetric(e, t, n = "runtime") {
|
|
332
|
-
let r = [];
|
|
333
|
-
for (let [i, a] of this.budgets) if (a.category === n && (i.includes(e) || e.includes(i.split(" ")[0]?.toLowerCase() || "")) && t > a.limit) {
|
|
334
|
-
let e = {
|
|
335
|
-
budget: a,
|
|
336
|
-
actualValue: t,
|
|
337
|
-
overageAmount: t - a.limit,
|
|
338
|
-
overagePercentage: (t - a.limit) / a.limit * 100,
|
|
339
|
-
timestamp: Date.now()
|
|
340
|
-
};
|
|
341
|
-
r.push(e), this.violations.push(e);
|
|
342
|
-
}
|
|
343
|
-
return r.length > 0 && this.handleViolations(r), r;
|
|
344
|
-
}
|
|
345
|
-
async checkBundleSizes(e) {
|
|
346
|
-
let t = [];
|
|
347
|
-
return typeof window < "u" || typeof process > "u" ? (console.warn("Bundle size checking is only available in Node.js environment"), t) : (console.warn("Bundle size checking disabled - use Node.js cicdIntegration from @therealtinhtute/baroiplayer/core/performance/cicd for CI/CD environments"), t);
|
|
348
|
-
}
|
|
349
|
-
checkRuntimeMetrics(e) {
|
|
350
|
-
let t = [];
|
|
351
|
-
return e.renderTime !== void 0 && t.push(...this.checkMetric("Component Render Time", e.renderTime, "runtime")), e.fid !== void 0 && t.push(...this.checkMetric("First Input Delay", e.fid, "runtime")), e.lcp !== void 0 && t.push(...this.checkMetric("Largest Contentful Paint", e.lcp, "runtime")), e.cls !== void 0 && t.push(...this.checkMetric("Cumulative Layout Shift", e.cls, "runtime")), e.memoryUsage !== void 0 && t.push(...this.checkMetric("Memory Usage", e.memoryUsage, "memory")), e.mediaLoadTime !== void 0 && t.push(...this.checkMetric("Media Load Time", e.mediaLoadTime, "network")), t;
|
|
352
|
-
}
|
|
353
|
-
async handleViolations(e) {
|
|
354
|
-
if (!this.alertConfig.enabled) return;
|
|
355
|
-
let t = Date.now();
|
|
356
|
-
e.filter((e) => e.budget.severity === "error").length >= this.alertConfig.threshold && t - this.lastAlertTime >= this.alertConfig.cooldown && (await this.sendAlerts(e), this.lastAlertTime = t);
|
|
357
|
-
}
|
|
358
|
-
async sendAlerts(e) {
|
|
359
|
-
let t = this.formatAlertMessage(e);
|
|
360
|
-
for (let e of this.alertConfig.channels) try {
|
|
361
|
-
await this.sendAlert(e, t);
|
|
362
|
-
} catch (t) {
|
|
363
|
-
console.error(`Failed to send alert via ${e.type}:`, t);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
formatAlertMessage(e) {
|
|
367
|
-
let t = "🚨 Performance Budget Violations Detected!\n\n";
|
|
368
|
-
return e.forEach((e) => {
|
|
369
|
-
let { budget: n, actualValue: r, overageAmount: i, overagePercentage: a } = e;
|
|
370
|
-
this.getUnitDisplay(n.unit), t += `❌ ${n.name}\n`, t += ` Limit: ${this.formatValue(n.limit, n.unit)}\n`, t += ` Actual: ${this.formatValue(r, n.unit)}\n`, t += ` Overage: ${this.formatValue(i, n.unit)} (+${a.toFixed(1)}%)\n`, t += ` Severity: ${n.severity.toUpperCase()}\n\n`;
|
|
371
|
-
}), t += `Time: ${(/* @__PURE__ */ new Date()).toISOString()}\n`, t += `Total Violations: ${e.length}`, t;
|
|
372
|
-
}
|
|
373
|
-
async sendAlert(e, t) {
|
|
374
|
-
switch (e.type) {
|
|
375
|
-
case "console":
|
|
376
|
-
console.error(t);
|
|
377
|
-
break;
|
|
378
|
-
case "webhook":
|
|
379
|
-
if (e.config.url) {
|
|
380
|
-
let n = await fetch(e.config.url, {
|
|
381
|
-
method: "POST",
|
|
382
|
-
headers: { "Content-Type": "application/json" },
|
|
383
|
-
body: JSON.stringify({
|
|
384
|
-
text: t,
|
|
385
|
-
timestamp: Date.now()
|
|
386
|
-
})
|
|
387
|
-
});
|
|
388
|
-
if (!n.ok) throw Error(`Webhook failed: ${n.status}`);
|
|
389
|
-
}
|
|
390
|
-
break;
|
|
391
|
-
case "slack":
|
|
392
|
-
if (e.config.url) {
|
|
393
|
-
let n = await fetch(e.config.url, {
|
|
394
|
-
method: "POST",
|
|
395
|
-
headers: { "Content-Type": "application/json" },
|
|
396
|
-
body: JSON.stringify({
|
|
397
|
-
text: t,
|
|
398
|
-
channel: e.config.channel,
|
|
399
|
-
username: "BaroiPlayer Performance Monitor"
|
|
400
|
-
})
|
|
401
|
-
});
|
|
402
|
-
if (!n.ok) throw Error(`Slack webhook failed: ${n.status}`);
|
|
403
|
-
}
|
|
404
|
-
break;
|
|
405
|
-
default: console.warn(`Unsupported alert channel: ${e.type}`);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
formatValue(e, t) {
|
|
409
|
-
switch (t) {
|
|
410
|
-
case "bytes": return this.formatBytes(e);
|
|
411
|
-
case "ms": return `${e.toFixed(2)}ms`;
|
|
412
|
-
case "score": return e.toFixed(3);
|
|
413
|
-
case "percent": return `${e.toFixed(1)}%`;
|
|
414
|
-
default: return e.toString();
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
formatBytes(e) {
|
|
418
|
-
return e >= 1024 * 1024 ? `${(e / 1024 / 1024).toFixed(2)}MB` : e >= 1024 ? `${(e / 1024).toFixed(2)}KB` : `${e}B`;
|
|
419
|
-
}
|
|
420
|
-
getUnitDisplay(e) {
|
|
421
|
-
return {
|
|
422
|
-
bytes: "bytes",
|
|
423
|
-
ms: "milliseconds",
|
|
424
|
-
score: "score",
|
|
425
|
-
percent: "percent"
|
|
426
|
-
}[e] || e;
|
|
427
|
-
}
|
|
428
|
-
addBudget(e) {
|
|
429
|
-
this.budgets.set(e.name, e);
|
|
430
|
-
}
|
|
431
|
-
removeBudget(e) {
|
|
432
|
-
this.budgets.delete(e);
|
|
433
|
-
}
|
|
434
|
-
updateBudget(e, t) {
|
|
435
|
-
let n = this.budgets.get(e);
|
|
436
|
-
n && this.budgets.set(e, {
|
|
437
|
-
...n,
|
|
438
|
-
...t
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
getBudgets() {
|
|
442
|
-
return Array.from(this.budgets.values());
|
|
443
|
-
}
|
|
444
|
-
getViolations(e) {
|
|
445
|
-
return e ? this.violations.filter((t) => t.timestamp >= e) : [...this.violations];
|
|
446
|
-
}
|
|
447
|
-
clearViolations() {
|
|
448
|
-
this.violations = [];
|
|
449
|
-
}
|
|
450
|
-
getViolationSummary() {
|
|
451
|
-
let e = {}, t = {};
|
|
452
|
-
return this.violations.forEach((n) => {
|
|
453
|
-
let r = n.budget.category, i = n.budget.severity;
|
|
454
|
-
e[r] = (e[r] || 0) + 1, t[i] = (t[i] || 0) + 1;
|
|
455
|
-
}), {
|
|
456
|
-
total: this.violations.length,
|
|
457
|
-
byCategory: e,
|
|
458
|
-
bySeverity: t
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
}, _e = new R(), z = {
|
|
462
|
-
preloadStrategy: "metadata",
|
|
463
|
-
adaptiveBitrate: !0,
|
|
464
|
-
maxPreloadSize: 2 * 1024 * 1024,
|
|
465
|
-
networkThresholds: {
|
|
466
|
-
"2g": {
|
|
467
|
-
maxBitrate: 128,
|
|
468
|
-
preload: !1
|
|
469
|
-
},
|
|
470
|
-
"3g": {
|
|
471
|
-
maxBitrate: 500,
|
|
472
|
-
preload: !1
|
|
473
|
-
},
|
|
474
|
-
"4g": {
|
|
475
|
-
maxBitrate: 2e3,
|
|
476
|
-
preload: !0
|
|
477
|
-
},
|
|
478
|
-
"5g": {
|
|
479
|
-
maxBitrate: 1e4,
|
|
480
|
-
preload: !0
|
|
481
|
-
}
|
|
482
|
-
},
|
|
483
|
-
bufferSize: 10,
|
|
484
|
-
enableServiceWorker: !0
|
|
485
|
-
}, B = class {
|
|
486
|
-
constructor() {
|
|
487
|
-
if (t(this, "connection", void 0), t(this, "listeners", /* @__PURE__ */ new Set()), t(this, "currentInfo", void 0), typeof window > "u" || typeof navigator > "u") {
|
|
488
|
-
this.connection = null, this.currentInfo = {
|
|
489
|
-
effectiveType: "unknown",
|
|
490
|
-
downlink: 0,
|
|
491
|
-
rtt: 0,
|
|
492
|
-
saveData: !1,
|
|
493
|
-
isOnline: !0
|
|
494
|
-
};
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
this.connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection, this.currentInfo = this.getNetworkInfo(), this.initializeListeners();
|
|
498
|
-
}
|
|
499
|
-
getNetworkInfo() {
|
|
500
|
-
if (typeof navigator > "u") return {
|
|
501
|
-
effectiveType: "unknown",
|
|
502
|
-
downlink: 0,
|
|
503
|
-
rtt: 0,
|
|
504
|
-
saveData: !1,
|
|
505
|
-
isOnline: !0
|
|
506
|
-
};
|
|
507
|
-
let e = navigator.onLine;
|
|
508
|
-
return this.connection ? {
|
|
509
|
-
effectiveType: this.connection.effectiveType || "unknown",
|
|
510
|
-
downlink: this.connection.downlink || 0,
|
|
511
|
-
rtt: this.connection.rtt || 0,
|
|
512
|
-
saveData: this.connection.saveData || !1,
|
|
513
|
-
isOnline: e
|
|
514
|
-
} : {
|
|
515
|
-
effectiveType: "unknown",
|
|
516
|
-
downlink: 0,
|
|
517
|
-
rtt: 0,
|
|
518
|
-
saveData: !1,
|
|
519
|
-
isOnline: e
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
initializeListeners() {
|
|
523
|
-
typeof window > "u" || (this.connection && this.connection.addEventListener("change", this.handleNetworkChange.bind(this)), window.addEventListener("online", this.handleNetworkChange.bind(this)), window.addEventListener("offline", this.handleNetworkChange.bind(this)));
|
|
524
|
-
}
|
|
525
|
-
handleNetworkChange() {
|
|
526
|
-
let e = this.getNetworkInfo();
|
|
527
|
-
this.currentInfo = e, this.listeners.forEach((t) => t(e));
|
|
528
|
-
}
|
|
529
|
-
getCurrentNetworkInfo() {
|
|
530
|
-
return { ...this.currentInfo };
|
|
531
|
-
}
|
|
532
|
-
subscribe(e) {
|
|
533
|
-
return this.listeners.add(e), () => this.listeners.delete(e);
|
|
534
|
-
}
|
|
535
|
-
async estimateBandwidth() {
|
|
536
|
-
if (this.connection && this.connection.downlink) return this.connection.downlink * 1e3;
|
|
537
|
-
try {
|
|
538
|
-
let e = performance.now(), t = await (await fetch("/api/bandwidth-test?size=100kb")).blob(), n = (performance.now() - e) / 1e3;
|
|
539
|
-
return t.size * 8 / n / 1e3;
|
|
540
|
-
} catch (e) {
|
|
541
|
-
return console.warn("Bandwidth estimation failed:", e), 1e3;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
}, V = class {
|
|
545
|
-
constructor(e = {}) {
|
|
546
|
-
t(this, "config", void 0), t(this, "networkMonitor", void 0), t(this, "loadingMetrics", /* @__PURE__ */ new Map()), t(this, "preloadCache", /* @__PURE__ */ new Map()), this.config = {
|
|
547
|
-
...z,
|
|
548
|
-
...e
|
|
549
|
-
}, this.networkMonitor = new B(), this.initializeNetworkMonitoring();
|
|
550
|
-
}
|
|
551
|
-
initializeNetworkMonitoring() {
|
|
552
|
-
this.networkMonitor.subscribe((e) => {
|
|
553
|
-
this.handleNetworkChange(e);
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
handleNetworkChange(e) {
|
|
557
|
-
console.log("Network changed:", e), this.config.adaptiveBitrate && this.adjustQualityForNetwork(e), (e.effectiveType === "2g" || e.saveData) && this.clearPreloadCache();
|
|
558
|
-
}
|
|
559
|
-
async optimizeMediaLoading(e, t, n = {}) {
|
|
560
|
-
let r = performance.now(), i = this.networkMonitor.getCurrentNetworkInfo(), a = {
|
|
561
|
-
loadStartTime: r,
|
|
562
|
-
bytesLoaded: 0,
|
|
563
|
-
loadSpeed: 0,
|
|
564
|
-
networkType: i.effectiveType,
|
|
565
|
-
quality: n.quality || "auto",
|
|
566
|
-
bufferHealth: 0,
|
|
567
|
-
stallsCount: 0,
|
|
568
|
-
stallsDuration: 0
|
|
569
|
-
};
|
|
570
|
-
this.loadingMetrics.set(e, a);
|
|
571
|
-
try {
|
|
572
|
-
let r = this.chooseLoadingStrategy(i, n);
|
|
573
|
-
return r.shouldPreload && await this.preloadMedia(e, r.preloadAmount), t.preload = r.preloadAttribute, this.monitorLoadingProgress(t, a), this.config.adaptiveBitrate && r.suggestedQuality && this.applyQualitySettings(t, r.suggestedQuality), a;
|
|
574
|
-
} catch (e) {
|
|
575
|
-
return console.error("Media loading optimization failed:", e), a;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
chooseLoadingStrategy(e, t) {
|
|
579
|
-
let n = e.effectiveType === "unknown" ? "4g" : e.effectiveType, r = this.config.networkThresholds[n] || this.config.networkThresholds["4g"];
|
|
580
|
-
return {
|
|
581
|
-
shouldPreload: t.preload !== !1 && r.preload && !e.saveData,
|
|
582
|
-
preloadAmount: e.saveData ? 0 : this.config.maxPreloadSize,
|
|
583
|
-
preloadAttribute: this.getPreloadAttribute(e),
|
|
584
|
-
suggestedQuality: this.getSuggestedQuality(e, r.maxBitrate),
|
|
585
|
-
bufferTarget: this.getBufferTarget(e)
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
getPreloadAttribute(e) {
|
|
589
|
-
return e.saveData || e.effectiveType === "2g" ? "none" : e.effectiveType === "3g" ? "metadata" : this.config.preloadStrategy;
|
|
590
|
-
}
|
|
591
|
-
getSuggestedQuality(e, t) {
|
|
592
|
-
let n = e.downlink * 1e3;
|
|
593
|
-
return n >= t * 2 ? "high" : n >= t ? "medium" : "low";
|
|
594
|
-
}
|
|
595
|
-
getBufferTarget(e) {
|
|
596
|
-
switch (e.effectiveType) {
|
|
597
|
-
case "2g": return 2;
|
|
598
|
-
case "3g": return 5;
|
|
599
|
-
case "4g": return this.config.bufferSize;
|
|
600
|
-
case "5g": return this.config.bufferSize * 1.5;
|
|
601
|
-
default: return this.config.bufferSize;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
async preloadMedia(e, t) {
|
|
605
|
-
if (this.preloadCache.has(e)) return;
|
|
606
|
-
let n = this.fetchWithProgress(e, t);
|
|
607
|
-
this.preloadCache.set(e, n);
|
|
608
|
-
try {
|
|
609
|
-
await n;
|
|
610
|
-
} catch (t) {
|
|
611
|
-
console.warn(`Preload failed for ${e}:`, t), this.preloadCache.delete(e);
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
async fetchWithProgress(e, t) {
|
|
615
|
-
let n = await fetch(e, { headers: { Range: `bytes=0-${t - 1}` } });
|
|
616
|
-
if (!n.ok) throw Error(`Failed to preload: ${n.status}`);
|
|
617
|
-
let r = n.body?.getReader();
|
|
618
|
-
if (!r) throw Error("Response body not readable");
|
|
619
|
-
let i = [], a = 0;
|
|
620
|
-
try {
|
|
621
|
-
for (; a < t;) {
|
|
622
|
-
let { done: e, value: t } = await r.read();
|
|
623
|
-
if (e) break;
|
|
624
|
-
i.push(t), a += t.length;
|
|
625
|
-
}
|
|
626
|
-
} finally {
|
|
627
|
-
r.releaseLock();
|
|
628
|
-
}
|
|
629
|
-
return new Blob(i);
|
|
630
|
-
}
|
|
631
|
-
monitorLoadingProgress(e, t) {
|
|
632
|
-
let n = null, r = () => {
|
|
633
|
-
if (e.buffered.length > 0) {
|
|
634
|
-
let n = e.buffered.end(e.buffered.length - 1);
|
|
635
|
-
t.bufferHealth = Math.min((n - e.currentTime) / this.config.bufferSize, 1);
|
|
636
|
-
}
|
|
637
|
-
}, i = () => {
|
|
638
|
-
t.firstByteTime = performance.now();
|
|
639
|
-
}, a = () => {
|
|
640
|
-
t.loadCompleteTime = performance.now(), t.totalLoadTime = t.loadCompleteTime - t.loadStartTime, t.totalLoadTime && t.bytesLoaded > 0 && (t.loadSpeed = t.bytesLoaded / (t.totalLoadTime / 1e3));
|
|
641
|
-
}, o = () => {
|
|
642
|
-
n === null && (n = performance.now(), t.stallsCount++);
|
|
643
|
-
}, s = () => {
|
|
644
|
-
n !== null && (t.stallsDuration += performance.now() - n, n = null), r();
|
|
645
|
-
}, c = () => {
|
|
646
|
-
e.buffered.length > 0 && (t.bytesLoaded = e.buffered.end(0) * 1e3), r();
|
|
647
|
-
};
|
|
648
|
-
e.addEventListener("loadstart", i), e.addEventListener("canplay", a), e.addEventListener("waiting", o), e.addEventListener("playing", s), e.addEventListener("progress", c), setTimeout(() => {
|
|
649
|
-
e.removeEventListener("loadstart", i), e.removeEventListener("canplay", a), e.removeEventListener("waiting", o), e.removeEventListener("playing", s), e.removeEventListener("progress", c);
|
|
650
|
-
}, 300 * 1e3);
|
|
651
|
-
}
|
|
652
|
-
applyQualitySettings(e, t) {
|
|
653
|
-
console.log(`Applying quality setting: ${t} to`, e);
|
|
654
|
-
}
|
|
655
|
-
adjustQualityForNetwork(e) {
|
|
656
|
-
console.log("Adjusting quality for network conditions:", e.effectiveType);
|
|
657
|
-
}
|
|
658
|
-
clearPreloadCache() {
|
|
659
|
-
this.preloadCache.clear();
|
|
660
|
-
}
|
|
661
|
-
getLoadingMetrics(e) {
|
|
662
|
-
return this.loadingMetrics.get(e);
|
|
663
|
-
}
|
|
664
|
-
getAllMetrics() {
|
|
665
|
-
return Array.from(this.loadingMetrics.values());
|
|
666
|
-
}
|
|
667
|
-
getAverageLoadingTime() {
|
|
668
|
-
let e = this.getAllMetrics().filter((e) => e.totalLoadTime !== void 0);
|
|
669
|
-
return e.length === 0 ? 0 : e.reduce((e, t) => e + (t.totalLoadTime || 0), 0) / e.length;
|
|
670
|
-
}
|
|
671
|
-
getNetworkPerformanceStats() {
|
|
672
|
-
let e = /* @__PURE__ */ new Map();
|
|
673
|
-
return this.getAllMetrics().forEach((t) => {
|
|
674
|
-
let n = t.networkType;
|
|
675
|
-
e.has(n) || e.set(n, []), e.get(n).push(t);
|
|
676
|
-
}), Array.from(e.entries()).map(([e, t]) => ({
|
|
677
|
-
networkType: e,
|
|
678
|
-
avgLoadTime: t.reduce((e, t) => e + (t.totalLoadTime || 0), 0) / t.length,
|
|
679
|
-
avgStalls: t.reduce((e, t) => e + t.stallsCount, 0) / t.length,
|
|
680
|
-
avgBufferHealth: t.reduce((e, t) => e + t.bufferHealth, 0) / t.length
|
|
681
|
-
}));
|
|
682
|
-
}
|
|
683
|
-
}, H = new V();
|
|
684
|
-
function ve(e) {
|
|
685
|
-
let [t] = D.useState(() => e ? new V(e) : H), [n, r] = D.useState(null), [i, a] = D.useState([]);
|
|
686
|
-
return D.useEffect(() => {
|
|
687
|
-
let e = t.networkMonitor.subscribe(r);
|
|
688
|
-
r(t.networkMonitor.getCurrentNetworkInfo());
|
|
689
|
-
let n = setInterval(() => {
|
|
690
|
-
a(t.getAllMetrics());
|
|
691
|
-
}, 1e3);
|
|
692
|
-
return () => {
|
|
693
|
-
e(), clearInterval(n);
|
|
694
|
-
};
|
|
695
|
-
}, [t]), {
|
|
696
|
-
networkInfo: n,
|
|
697
|
-
loadingMetrics: i,
|
|
698
|
-
optimizeLoading: D.useCallback((e, n, r) => t.optimizeMediaLoading(e, n, r), [t]),
|
|
699
|
-
averageLoadTime: t.getAverageLoadingTime(),
|
|
700
|
-
networkStats: t.getNetworkPerformanceStats()
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
//#endregion
|
|
704
|
-
//#region src/core/providers/service-provider.tsx
|
|
705
|
-
var U = e(), ye = class {
|
|
706
|
-
get(e) {
|
|
707
|
-
try {
|
|
708
|
-
let t = localStorage.getItem(`baroi-player-${e}`);
|
|
709
|
-
return t ? JSON.parse(t) : null;
|
|
710
|
-
} catch {
|
|
711
|
-
return null;
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
set(e, t) {
|
|
715
|
-
try {
|
|
716
|
-
localStorage.setItem(`baroi-player-${e}`, JSON.stringify(t));
|
|
717
|
-
} catch (e) {
|
|
718
|
-
console.warn("Failed to store data:", e);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
remove(e) {
|
|
722
|
-
try {
|
|
723
|
-
localStorage.removeItem(`baroi-player-${e}`);
|
|
724
|
-
} catch (e) {
|
|
725
|
-
console.warn("Failed to remove data:", e);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
clear() {
|
|
729
|
-
try {
|
|
730
|
-
Object.keys(localStorage).forEach((e) => {
|
|
731
|
-
e.startsWith("baroi-player-") && localStorage.removeItem(e);
|
|
732
|
-
});
|
|
733
|
-
} catch (e) {
|
|
734
|
-
console.warn("Failed to clear data:", e);
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
}, be = class {
|
|
738
|
-
track(e, t) {
|
|
739
|
-
console.log("Analytics:", e, t);
|
|
740
|
-
}
|
|
741
|
-
identify(e, t) {
|
|
742
|
-
console.log("Analytics identify:", e, t);
|
|
743
|
-
}
|
|
744
|
-
page(e, t) {
|
|
745
|
-
console.log("Analytics page:", e, t);
|
|
746
|
-
}
|
|
747
|
-
}, W = O(null);
|
|
748
|
-
function G({ children: e, services: t = {} }) {
|
|
749
|
-
let n = j(() => {
|
|
750
|
-
let e = t.logger || new v("[BaroiPlayer]");
|
|
751
|
-
return {
|
|
752
|
-
eventBus: t.eventBus || new y(),
|
|
753
|
-
pluginRegistry: t.pluginRegistry || new _(e),
|
|
754
|
-
storage: t.storage || new ye(),
|
|
755
|
-
analytics: t.analytics || new be(),
|
|
756
|
-
logger: e
|
|
757
|
-
};
|
|
758
|
-
}, [t]);
|
|
759
|
-
return /* @__PURE__ */ (0, U.jsx)(W.Provider, {
|
|
760
|
-
value: n,
|
|
761
|
-
children: e
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
function K() {
|
|
765
|
-
let e = A(W);
|
|
766
|
-
if (!e) throw Error("useServices must be used within ServiceProvider");
|
|
767
|
-
return e;
|
|
768
|
-
}
|
|
769
|
-
function xe() {
|
|
770
|
-
return K().eventBus;
|
|
771
|
-
}
|
|
772
|
-
function Se() {
|
|
773
|
-
return K().pluginRegistry;
|
|
774
|
-
}
|
|
775
|
-
function Ce() {
|
|
776
|
-
return K().storage;
|
|
777
|
-
}
|
|
778
|
-
function we() {
|
|
779
|
-
return K().analytics;
|
|
780
|
-
}
|
|
781
|
-
function Te() {
|
|
782
|
-
return K().logger;
|
|
783
|
-
}
|
|
784
|
-
function Ee(e) {
|
|
785
|
-
return function(t) {
|
|
786
|
-
let n = K();
|
|
787
|
-
return /* @__PURE__ */ (0, U.jsx)(e, {
|
|
788
|
-
...t,
|
|
789
|
-
services: n
|
|
790
|
-
});
|
|
791
|
-
};
|
|
792
|
-
}
|
|
793
|
-
//#endregion
|
|
794
|
-
//#region src/core/utils.tsx
|
|
795
|
-
function q(e = {}) {
|
|
796
|
-
return function({ children: t }) {
|
|
797
|
-
return /* @__PURE__ */ (0, U.jsx)(G, {
|
|
798
|
-
services: e.services,
|
|
799
|
-
children: t
|
|
800
|
-
});
|
|
801
|
-
};
|
|
802
|
-
}
|
|
803
|
-
//#endregion
|
|
804
|
-
//#region src/core/progressive-loading.tsx
|
|
805
|
-
var J = {
|
|
806
|
-
SUBTITLES: "subtitles",
|
|
807
|
-
PLAYLISTS: "playlists",
|
|
808
|
-
ADVANCED_CONTROLS: "advanced_controls",
|
|
809
|
-
ANALYTICS: "analytics",
|
|
810
|
-
PICTURE_IN_PICTURE: "picture_in_picture",
|
|
811
|
-
QUALITY_SELECTOR: "quality_selector",
|
|
812
|
-
PLAYBACK_SPEED: "playback_speed",
|
|
813
|
-
CHAPTERS: "chapters",
|
|
814
|
-
THUMBNAILS: "thumbnails",
|
|
815
|
-
KEYBOARD_SHORTCUTS: "keyboard_shortcuts"
|
|
816
|
-
}, Y = {
|
|
817
|
-
enabledFeatures: [
|
|
818
|
-
J.SUBTITLES,
|
|
819
|
-
J.ADVANCED_CONTROLS,
|
|
820
|
-
J.KEYBOARD_SHORTCUTS
|
|
821
|
-
],
|
|
822
|
-
loadingStrategy: "lazy",
|
|
823
|
-
fallbackTimeout: 5e3,
|
|
824
|
-
retryAttempts: 3
|
|
825
|
-
}, De = {
|
|
826
|
-
SubtitleSelector: k(() => import("./enhanced-components-BwjBqSA1.js").then((e) => e.f).then((e) => ({ default: e.SubtitleSelector }))),
|
|
827
|
-
PlaylistManager: k(() => import("./enhanced-components-BwjBqSA1.js").then((e) => e.f).then((e) => ({ default: e.SubtitleSelector }))),
|
|
828
|
-
QualitySelector: k(() => import("./enhanced-components-BwjBqSA1.js").then((e) => e.f).then((e) => ({ default: e.QualitySelector }))),
|
|
829
|
-
PlaybackSpeedSelector: k(() => import("./enhanced-components-BwjBqSA1.js").then((e) => e.f).then((e) => ({ default: e.PlaybackSpeedSelector }))),
|
|
830
|
-
ChaptersPanel: k(() => import("./enhanced-components-BwjBqSA1.js").then((e) => e.f).then((e) => ({ default: e.ChaptersPanel }))),
|
|
831
|
-
PictureInPictureButton: k(() => import("./enhanced-components-BwjBqSA1.js").then((e) => e.f).then((e) => ({ default: e.PictureInPictureButton }))),
|
|
832
|
-
AnalyticsTracker: k(() => import("./enhanced-components-BwjBqSA1.js").then((e) => e.f).then((e) => ({ default: e.SubtitleSelector })))
|
|
833
|
-
}, X = class {
|
|
834
|
-
static async isSupported(e) {
|
|
835
|
-
if (this.cache.has(e)) return this.cache.get(e);
|
|
836
|
-
let t = await this.checkFeatureSupport(e);
|
|
837
|
-
return this.cache.set(e, t), t;
|
|
838
|
-
}
|
|
839
|
-
static async checkFeatureSupport(e) {
|
|
840
|
-
if (typeof window > "u" || typeof document > "u") return !0;
|
|
841
|
-
switch (e) {
|
|
842
|
-
case J.SUBTITLES: return "TextTrack" in window;
|
|
843
|
-
case J.PICTURE_IN_PICTURE: return "pictureInPictureEnabled" in document;
|
|
844
|
-
case J.ADVANCED_CONTROLS: return !0;
|
|
845
|
-
case J.PLAYLISTS: return "MediaSession" in window;
|
|
846
|
-
case J.ANALYTICS: return "IntersectionObserver" in window;
|
|
847
|
-
case J.QUALITY_SELECTOR: return "MediaSource" in window;
|
|
848
|
-
case J.PLAYBACK_SPEED: return !0;
|
|
849
|
-
case J.CHAPTERS: return "TextTrack" in window;
|
|
850
|
-
case J.THUMBNAILS: return "OffscreenCanvas" in window || "canvas" in document.createElement("canvas");
|
|
851
|
-
case J.KEYBOARD_SHORTCUTS: return "KeyboardEvent" in window;
|
|
852
|
-
default: return !1;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
};
|
|
856
|
-
t(X, "cache", /* @__PURE__ */ new Map());
|
|
857
|
-
var Z = class {
|
|
858
|
-
constructor(e = {}) {
|
|
859
|
-
t(this, "config", void 0), t(this, "loadedFeatures", /* @__PURE__ */ new Set()), t(this, "loadingPromises", /* @__PURE__ */ new Map()), this.config = {
|
|
860
|
-
...Y,
|
|
861
|
-
...e
|
|
862
|
-
};
|
|
863
|
-
}
|
|
864
|
-
async loadFeature(e) {
|
|
865
|
-
if (!this.config.enabledFeatures.includes(e)) return null;
|
|
866
|
-
if (this.loadedFeatures.has(e)) return this.getLoadedFeature(e);
|
|
867
|
-
if (this.loadingPromises.has(e)) return this.loadingPromises.get(e);
|
|
868
|
-
if (!await X.isSupported(e)) return console.warn(`Feature ${e} is not supported in this browser`), null;
|
|
869
|
-
let t = this.loadWithRetry(e);
|
|
870
|
-
this.loadingPromises.set(e, t);
|
|
871
|
-
try {
|
|
872
|
-
let n = await t;
|
|
873
|
-
return this.loadedFeatures.add(e), n;
|
|
874
|
-
} catch (t) {
|
|
875
|
-
return console.error(`Failed to load feature ${e}:`, t), this.loadingPromises.delete(e), null;
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
async loadWithRetry(e, t = 1) {
|
|
879
|
-
try {
|
|
880
|
-
return await this.loadFeatureModule(e);
|
|
881
|
-
} catch (n) {
|
|
882
|
-
if (t < this.config.retryAttempts) return console.warn(`Loading feature ${e} failed, retrying (${t}/${this.config.retryAttempts})`), await new Promise((e) => setTimeout(e, 1e3 * t)), this.loadWithRetry(e, t + 1);
|
|
883
|
-
throw n;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
async loadFeatureModule(e) {
|
|
887
|
-
switch (e) {
|
|
888
|
-
case J.SUBTITLES: return import("./hooks-B-IIWPJr.js").then((e) => e.d);
|
|
889
|
-
case J.PLAYLISTS: return import("./enhanced-components-BwjBqSA1.js").then((e) => e.f);
|
|
890
|
-
case J.ADVANCED_CONTROLS: return import("./enhanced-components-BwjBqSA1.js").then((e) => e.f);
|
|
891
|
-
case J.ANALYTICS: return import("./enhanced-components-BwjBqSA1.js").then((e) => e.f);
|
|
892
|
-
case J.PICTURE_IN_PICTURE: return import("./enhanced-components-BwjBqSA1.js").then((e) => e.f);
|
|
893
|
-
case J.QUALITY_SELECTOR: return import("./enhanced-components-BwjBqSA1.js").then((e) => e.f);
|
|
894
|
-
case J.PLAYBACK_SPEED: return import("./enhanced-components-BwjBqSA1.js").then((e) => e.f);
|
|
895
|
-
case J.CHAPTERS: return import("./enhanced-components-BwjBqSA1.js").then((e) => e.f);
|
|
896
|
-
case J.THUMBNAILS: return import("./enhanced-components-BwjBqSA1.js").then((e) => e.f);
|
|
897
|
-
case J.KEYBOARD_SHORTCUTS: return import("./hooks-B-IIWPJr.js").then((e) => e.b);
|
|
898
|
-
default: throw Error(`Unknown feature: ${e}`);
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
getLoadedFeature(e) {
|
|
902
|
-
return this.loadingPromises.get(e);
|
|
903
|
-
}
|
|
904
|
-
async preloadFeatures(e = this.config.enabledFeatures) {
|
|
905
|
-
let t = e.map((e) => this.loadFeature(e));
|
|
906
|
-
await Promise.allSettled(t);
|
|
907
|
-
}
|
|
908
|
-
getLoadingState() {
|
|
909
|
-
return {
|
|
910
|
-
loaded: Array.from(this.loadedFeatures),
|
|
911
|
-
loading: Array.from(this.loadingPromises.keys()),
|
|
912
|
-
enabled: this.config.enabledFeatures
|
|
913
|
-
};
|
|
914
|
-
}
|
|
915
|
-
}, Q = new Z();
|
|
916
|
-
function $(e) {
|
|
917
|
-
let [t, n] = D.useState(null), [r, i] = D.useState(!1), [a, o] = D.useState(null), s = D.useCallback(async () => {
|
|
918
|
-
if (!(r || t)) {
|
|
919
|
-
i(!0), o(null);
|
|
920
|
-
try {
|
|
921
|
-
let t = await Q.loadFeature(e);
|
|
922
|
-
n(t);
|
|
923
|
-
} catch (e) {
|
|
924
|
-
o(e);
|
|
925
|
-
} finally {
|
|
926
|
-
i(!1);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
}, [
|
|
930
|
-
e,
|
|
931
|
-
r,
|
|
932
|
-
t
|
|
933
|
-
]);
|
|
934
|
-
return D.useEffect(() => {
|
|
935
|
-
Q.config.loadingStrategy === "immediate" && s();
|
|
936
|
-
}, [s]), {
|
|
937
|
-
feature: t,
|
|
938
|
-
loading: r,
|
|
939
|
-
error: a,
|
|
940
|
-
load: s
|
|
941
|
-
};
|
|
942
|
-
}
|
|
943
|
-
function Oe(e, t, n) {
|
|
944
|
-
return function(r) {
|
|
945
|
-
let { feature: i, loading: a, error: o } = $(t);
|
|
946
|
-
if (a) return /* @__PURE__ */ (0, U.jsx)("div", { className: "h-8 animate-pulse rounded bg-gray-200" });
|
|
947
|
-
if (o || !i) {
|
|
948
|
-
let e = n;
|
|
949
|
-
return e ? /* @__PURE__ */ (0, U.jsx)(e, { ...r }) : null;
|
|
950
|
-
}
|
|
951
|
-
return /* @__PURE__ */ (0, U.jsx)(e, { ...r });
|
|
952
|
-
};
|
|
953
|
-
}
|
|
954
|
-
//#endregion
|
|
955
|
-
//#region src/core/index.ts
|
|
956
|
-
var ke = "1.0.0";
|
|
957
|
-
//#endregion
|
|
958
|
-
export { g as AnalyticsPlugin, p as BasePlugin, ke as CORE_ARCHITECTURE_VERSION, v as ConsolePluginLogger, C as EVENT_SYSTEM_VERSION, y as EventBus, T as EventDelegator, J as FEATURES, X as FeatureDetector, V as MediaLoadingOptimizer, b as MiddlewareBuilder, B as NetworkMonitor, ie as PLUGIN_SYSTEM_VERSION, M as PerformanceBenchmark, R as PerformanceBudgetMonitor, c as PerformanceDashboard, i as PerformanceMonitor, o as PerformanceRegressionDetector, F as PerformanceTestFramework, h as PluginConflictError, f as PluginDependencyError, u as PluginDevelopmentHelpers, te as PluginError, m as PluginPerformanceMonitor, _ as PluginRegistry, ae as PluginStorage, d as PluginValidator, Z as ProgressiveLoader, G as ServiceProvider, me as commonMiddlewares, re as createAnalyticsPlugin, q as createArchitecture, de as createMiddleware, l as createPlugin, E as defaultEventBus, z as defaultMediaLoadingConfig, L as defaultPerformanceBudgets, ee as defaultPerformanceMonitor, ne as defaultPluginLogger, Y as defaultProgressiveConfig, r as defaultThresholds, ue as eventMiddlewares, De as lazyComponents, H as mediaLoadingOptimizer, N as performanceBenchmark, _e as performanceBudgetMonitor, n as performanceMonitor, I as performanceTestFramework, P as performanceTestUtils, Q as progressiveLoader, we as useAnalytics, he as useConditionalEventListener, x as useEventBus, fe as useEventDebugger, oe as useEventEffect, ge as useEventEmitter, S as useEventHandlers, se as useEventHistory, pe as useEventListener, w as useEventMetrics, ce as useEventOnce, le as useEventState, Te as useLogger, ve as useMediaLoadingOptimizer, a as usePerformanceMonitor, Se as usePluginRegistry, $ as useProgressiveFeature, xe as useServiceEventBus, K as useServices, Ce as useStorage, s as withPerformanceMonitoring, Oe as withProgressiveFeature, Ee as withServices };
|
|
959
|
-
|
|
960
|
-
//# sourceMappingURL=core.mjs.map
|