@therealtinhtute/baroiplayer 1.2.0 → 1.2.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 +1 -2
- package/dist/context/media.js +1 -2
- package/dist/context/media.mjs +3 -15
- package/dist/context/store.js +1 -2
- package/dist/context/store.mjs +3 -5
- package/dist/context-Bzd5QCKM.cjs +7 -0
- package/dist/context-Bzd5QCKM.cjs.map +1 -0
- package/dist/context-DD_SH4tT.js +1053 -0
- package/dist/context-DD_SH4tT.js.map +1 -0
- package/dist/core-events-BRnLMB7s.cjs +2 -0
- package/dist/core-events-BRnLMB7s.cjs.map +1 -0
- package/dist/core-events-v_mKdj5p.js +417 -0
- package/dist/core-events-v_mKdj5p.js.map +1 -0
- package/dist/core-plugins-CMBv-yVh.cjs +2 -0
- package/dist/core-plugins-CMBv-yVh.cjs.map +1 -0
- package/dist/core-plugins-CqCxLkbd.js +754 -0
- package/dist/core-plugins-CqCxLkbd.js.map +1 -0
- package/dist/core.js +7 -29
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +947 -1220
- package/dist/core.mjs.map +1 -1
- package/dist/enhanced-components-BwjBqSA1.js +2858 -0
- package/dist/enhanced-components-BwjBqSA1.js.map +1 -0
- package/dist/enhanced-components-C-ka-XLp.cjs +2 -0
- package/dist/enhanced-components-C-ka-XLp.cjs.map +1 -0
- package/dist/hooks-B-IIWPJr.js +1842 -0
- package/dist/hooks-B-IIWPJr.js.map +1 -0
- package/dist/hooks-DcHzmBwA.cjs +4 -0
- package/dist/hooks-DcHzmBwA.cjs.map +1 -0
- package/dist/index.js +27 -97
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5613 -6208
- package/dist/index.mjs.map +1 -1
- package/dist/minimal-components-BYsMQde5.js +1610 -0
- package/dist/minimal-components-BYsMQde5.js.map +1 -0
- package/dist/minimal-components-CsxQbDp7.cjs +2 -0
- package/dist/minimal-components-CsxQbDp7.cjs.map +1 -0
- package/dist/performance-monitor-DCSijLJg.js +312 -0
- package/dist/performance-monitor-DCSijLJg.js.map +1 -0
- package/dist/performance-monitor-wNFKmqMr.cjs +2 -0
- package/dist/performance-monitor-wNFKmqMr.cjs.map +1 -0
- package/dist/rolldown-runtime-BmowowmI.js +14 -0
- package/dist/rolldown-runtime-mLOUI7ql.cjs +1 -0
- package/dist/utils-D2gQ7c2R.js +64 -0
- package/dist/utils-D2gQ7c2R.js.map +1 -0
- package/dist/utils-DJaAwiZ9.cjs +2 -0
- package/dist/utils-DJaAwiZ9.cjs.map +1 -0
- package/dist/utils.js +1 -2
- package/dist/utils.mjs +3 -11
- package/package.json +28 -22
- package/src/components/AnimateLoading.tsx +14 -10
- package/src/components/examples/loading-states-demo.tsx +1 -2
- package/src/components/examples/react-19-demo.tsx +6 -10
- package/src/components/examples/volume-orientation-demo.tsx +1 -2
- package/src/components/ui/blur-poster.tsx +18 -15
- package/src/components/variants/minimal/components/VideoElement.tsx +3 -1
- package/src/core/performance/media-loading-optimizer.ts +2 -1
- package/src/hooks/useScreenshot.ts +60 -44
- package/src/types/assets.d.ts +29 -0
- package/dist/context/media.js.map +0 -1
- package/dist/context/media.mjs.map +0 -1
- package/dist/context/store.js.map +0 -1
- package/dist/context/store.mjs.map +0 -1
- package/dist/context-BYwDoSRX.js +0 -1172
- package/dist/context-BYwDoSRX.js.map +0 -1
- package/dist/context-eNS62_ac.cjs +0 -23
- package/dist/context-eNS62_ac.cjs.map +0 -1
- package/dist/core-events-B1iM2F46.cjs +0 -2
- package/dist/core-events-B1iM2F46.cjs.map +0 -1
- package/dist/core-events-DunPHKRE.js +0 -484
- package/dist/core-events-DunPHKRE.js.map +0 -1
- package/dist/core-plugins-By-4-kGs.cjs +0 -2
- package/dist/core-plugins-By-4-kGs.cjs.map +0 -1
- package/dist/core-plugins-DSBWcTuX.js +0 -821
- package/dist/core-plugins-DSBWcTuX.js.map +0 -1
- package/dist/enhanced-components-B_l3cist.js +0 -1142
- package/dist/enhanced-components-B_l3cist.js.map +0 -1
- package/dist/enhanced-components-BspFs9OO.cjs +0 -2
- package/dist/enhanced-components-BspFs9OO.cjs.map +0 -1
- package/dist/hooks-BXwI8QG6.cjs +0 -4
- package/dist/hooks-BXwI8QG6.cjs.map +0 -1
- package/dist/hooks-Bpi-jDiO.js +0 -1816
- package/dist/hooks-Bpi-jDiO.js.map +0 -1
- package/dist/minimal-components-C4z900Ro.js +0 -1926
- package/dist/minimal-components-C4z900Ro.js.map +0 -1
- package/dist/minimal-components-v4qBp6jv.cjs +0 -2
- package/dist/minimal-components-v4qBp6jv.cjs.map +0 -1
- package/dist/performance-monitor-C5k6FDXw.js +0 -301
- package/dist/performance-monitor-C5k6FDXw.js.map +0 -1
- package/dist/performance-monitor-lJmuUjQQ.cjs +0 -2
- package/dist/performance-monitor-lJmuUjQQ.cjs.map +0 -1
- package/dist/utils-CFOue_9K.cjs +0 -9
- package/dist/utils-CFOue_9K.cjs.map +0 -1
- package/dist/utils-Dzpl2ArK.js +0 -2844
- package/dist/utils-Dzpl2ArK.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/dist/utils.mjs.map +0 -1
package/dist/context-BYwDoSRX.js
DELETED
|
@@ -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
|