@aigamo/hydrangean-diva 0.0.1-alpha.7 → 0.0.1-alpha.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/index.cjs.js +2 -45
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +2 -1
  4. package/dist/index.es.js +2264 -2463
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/src/App.d.ts +9 -0
  7. package/dist/src/features/media-player/components/AddVideoButton.d.ts +7 -0
  8. package/dist/src/features/media-player/components/AddVideoModal.d.ts +5 -0
  9. package/dist/src/features/media-player/components/BottomBar.d.ts +8 -0
  10. package/dist/src/features/media-player/components/BottomBarCenterControls.d.ts +7 -0
  11. package/dist/src/features/media-player/components/BottomBarLeftControls.d.ts +4 -0
  12. package/dist/src/features/media-player/components/BottomBarRightControls.d.ts +6 -0
  13. package/dist/src/features/media-player/components/CookieConsentPanel.d.ts +8 -0
  14. package/dist/src/features/media-player/components/CreatePlaylistButton.d.ts +7 -0
  15. package/dist/src/features/media-player/components/CreatePlaylistModal.d.ts +4 -0
  16. package/dist/src/features/media-player/components/DeletePlaylistConfirmModal.d.ts +7 -0
  17. package/dist/src/features/media-player/components/DeveloperToolsButton.d.ts +9 -0
  18. package/dist/src/features/media-player/components/MiniPlayer.d.ts +4 -0
  19. package/dist/src/features/media-player/components/PlayQueueCommandBar.d.ts +9 -0
  20. package/dist/src/features/media-player/components/PlayQueueSection.d.ts +9 -0
  21. package/dist/src/features/media-player/components/PlayQueueTable.d.ts +9 -0
  22. package/dist/src/features/media-player/components/PlaylistCommandBar.d.ts +9 -0
  23. package/dist/src/features/media-player/components/PlaylistListTable.d.ts +9 -0
  24. package/dist/src/features/media-player/components/PlaylistSection.d.ts +9 -0
  25. package/dist/src/features/media-player/components/PlaylistTable.d.ts +9 -0
  26. package/dist/src/features/media-player/components/RenamePlaylistModal.d.ts +7 -0
  27. package/dist/{AppRoutes.d.ts → src/features/media-player/components/SeekBar.d.ts} +1 -1
  28. package/dist/src/features/media-player/contexts/BottomBarContext.d.ts +3 -0
  29. package/dist/src/features/media-player/contexts/MiniPlayerContext.d.ts +3 -0
  30. package/dist/src/features/media-player/contexts/PlayQueueContext.d.ts +3 -0
  31. package/dist/src/features/media-player/contexts/PlayerContext.d.ts +3 -0
  32. package/dist/src/features/media-player/contexts/PlaylistListContext.d.ts +3 -0
  33. package/dist/src/features/media-player/helpers/bottomBarHeight.d.ts +1 -0
  34. package/dist/src/features/media-player/helpers/commandBarHeight.d.ts +1 -0
  35. package/dist/src/features/media-player/helpers/commandBarSpacerHeight.d.ts +1 -0
  36. package/dist/src/features/media-player/helpers/findVideoService.d.ts +1 -0
  37. package/dist/src/features/media-player/helpers/headerHeight.d.ts +1 -0
  38. package/dist/src/features/media-player/helpers/isNoembedResult.d.ts +5 -0
  39. package/dist/src/features/media-player/helpers/miniPlayerSize.d.ts +4 -0
  40. package/dist/src/features/media-player/helpers/videoServiceIcons.d.ts +2 -0
  41. package/dist/src/features/media-player/index.d.ts +19 -0
  42. package/dist/src/features/media-player/interfaces/IBottomBarStore.d.ts +32 -0
  43. package/dist/src/features/media-player/interfaces/IMiniPlayerStore.d.ts +12 -0
  44. package/dist/{features/media-player/stores → src/features/media-player/interfaces}/IPlayQueueItemStore.d.ts +4 -8
  45. package/dist/src/features/media-player/interfaces/IPlayQueueStore.d.ts +46 -0
  46. package/dist/src/features/media-player/interfaces/IPlayerStore.d.ts +13 -0
  47. package/dist/src/features/media-player/interfaces/IPlaylistItemStore.d.ts +28 -0
  48. package/dist/src/features/media-player/interfaces/IPlaylistListItemStore.d.ts +6 -0
  49. package/dist/src/features/media-player/interfaces/IPlaylistListStore.d.ts +8 -0
  50. package/dist/src/features/media-player/interfaces/IPlaylistStore.d.ts +26 -0
  51. package/dist/src/features/media-player/interfaces/PlayQueueDto.d.ts +11 -0
  52. package/dist/src/features/media-player/interfaces/PlayQueueItemDto.d.ts +9 -0
  53. package/dist/src/features/media-player/pages/PlaylistDetailsPage.d.ts +9 -0
  54. package/dist/src/features/media-player/pages/PlaylistListPage.d.ts +2 -0
  55. package/dist/src/features/media-player/providers/BottomBarProvider.d.ts +6 -0
  56. package/dist/src/features/media-player/providers/HydrangeanDivaProvider.d.ts +7 -0
  57. package/dist/src/features/media-player/providers/MiniPlayerProvider.d.ts +6 -0
  58. package/dist/src/features/media-player/providers/PlayQueueProvider.d.ts +6 -0
  59. package/dist/src/features/media-player/providers/PlayerProvider.d.ts +6 -0
  60. package/dist/src/features/media-player/providers/PlaylistListProvider.d.ts +6 -0
  61. package/dist/src/features/media-player/stores/BottomBarStore.d.ts +54 -0
  62. package/dist/src/features/media-player/stores/MiniPlayerStore.d.ts +21 -0
  63. package/dist/{features → src/features}/media-player/stores/PlayQueueItemStore.d.ts +8 -9
  64. package/dist/{features → src/features}/media-player/stores/PlayQueueStore.d.ts +25 -19
  65. package/dist/src/features/media-player/stores/PlayerStore.d.ts +17 -0
  66. package/dist/src/features/media-player/stores/PlaylistItemStore.d.ts +39 -0
  67. package/dist/src/features/media-player/stores/PlaylistListItemStore.d.ts +10 -0
  68. package/dist/src/features/media-player/stores/PlaylistListStore.d.ts +26 -0
  69. package/dist/src/features/media-player/stores/PlaylistStore.d.ts +46 -0
  70. package/dist/src/index.d.ts +1 -0
  71. package/dist/src/routeTree.gen.d.ts +91 -0
  72. package/dist/src/routes/__root.d.ts +1 -0
  73. package/dist/src/routes/_authenticated/index.d.ts +1 -0
  74. package/dist/src/routes/_authenticated/play-queue.d.ts +1 -0
  75. package/dist/src/routes/_authenticated/playlists/$playlistId.index.d.ts +1 -0
  76. package/dist/src/routes/_authenticated/playlists/index.d.ts +1 -0
  77. package/dist/src/routes/_authenticated.d.ts +1 -0
  78. package/dist/src/shared/components/AppLink.d.ts +6 -0
  79. package/dist/src/shared/components/AppPageTemplateHeader.d.ts +18 -0
  80. package/dist/src/shared/lib/featureFlags.d.ts +5 -0
  81. package/dist/src/shared/stores/localStorageStateKeys.d.ts +6 -0
  82. package/dist/test/features/media-player/stores/PlayQueueStore.test.d.ts +1 -0
  83. package/dist/test/features/media-player/stores/PlayerStore.test.d.ts +1 -0
  84. package/package.json +59 -47
  85. package/dist/App.d.ts +0 -3
  86. package/dist/features/media-player/components/AddVideoButton.d.ts +0 -7
  87. package/dist/features/media-player/components/BottomBar.d.ts +0 -12
  88. package/dist/features/media-player/components/HydrangeanDiva.d.ts +0 -11
  89. package/dist/features/media-player/components/MiniPlayer.d.ts +0 -15
  90. package/dist/features/media-player/components/PlayQueueStoreContext.d.ts +0 -8
  91. package/dist/features/media-player/components/PlayQueueTable.d.ts +0 -9
  92. package/dist/features/media-player/components/PlayerStoreContext.d.ts +0 -8
  93. package/dist/features/media-player/components/index.d.ts +0 -6
  94. package/dist/features/media-player/index.d.ts +0 -2
  95. package/dist/features/media-player/stores/IObservableStateProvider.d.ts +0 -4
  96. package/dist/features/media-player/stores/IPlayQueueStore.d.ts +0 -15
  97. package/dist/features/media-player/stores/MobXObservableStateProvider.d.ts +0 -5
  98. package/dist/features/media-player/stores/ObservableStateProvider.d.ts +0 -5
  99. package/dist/features/media-player/stores/PlayQueueLocalStorageState.d.ts +0 -10
  100. package/dist/features/media-player/stores/PlayerStore.d.ts +0 -15
  101. package/dist/features/media-player/stores/index.d.ts +0 -6
  102. /package/dist/{features → src/features}/media-player/components/MediaPlayerLayout.d.ts +0 -0
  103. /package/dist/{features/media-player/stores → src/features/media-player/interfaces}/RepeatMode.d.ts +0 -0
  104. /package/dist/{features → src/features}/media-player/pages/PlayQueuePage.d.ts +0 -0
  105. /package/dist/{features/media-player/components → src/layout}/Header.d.ts +0 -0
  106. /package/dist/{main.d.ts → src/main.d.ts} +0 -0
  107. /package/dist/{common → src/shared}/components/Compose.d.ts +0 -0
  108. /package/dist/{features/media-player → src/shared}/stores/getOrAddSchema.d.ts +0 -0
  109. /package/dist/{sw.d.ts → src/sw.d.ts} +0 -0
  110. /package/dist/{icons.d.ts → test/features/media-player/stores/PlayQueueItemStore.test.d.ts} +0 -0
package/dist/index.es.js CHANGED
@@ -1,2472 +1,2273 @@
1
- var Tr = Object.defineProperty;
2
- var Cr = (t, e, n) => e in t ? Tr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var V = (t, e, n) => Cr(t, typeof e != "symbol" ? e + "" : e, n);
4
- import * as Z from "react";
5
- import Ft, { forwardRef as Sr, useContext as at, useCallback as $, memo as K, useState as Y, useLayoutEffect as Ir, useMemo as $t, createContext as jt, useEffect as Rr } from "react";
6
- import Pr from "@emotion/cache";
7
- import { useNostalgicDiva as te, findVideoService as wr, NostalgicDiva as _r } from "@aigamo/nostalgic-diva";
8
- import { EuiRange as Nt, EuiButtonIcon as G, EuiFlexGroup as de, EuiFlexItem as U, EuiBottomBar as Or, EuiFormRow as Ze, EuiPopover as st, EuiIcon as W, EuiContextMenu as Ar, EuiButton as ee, EuiModalHeaderTitle as kr, EuiModalHeader as Mr, EuiForm as Fr, EuiFieldText as St, EuiModalBody as $r, EuiModalFooter as jr, EuiButtonEmpty as Nr, EuiModal as Dr, useEuiTheme as Dt, EuiCheckbox as zt, EuiTableHeaderCellCheckbox as zr, EuiTableHeaderCell as Je, EuiTableHeader as Lr, EuiContextMenuItem as Vr, EuiHorizontalRule as It, EuiContextMenuPanel as Yr, EuiTableRowCell as Qe, EuiTableRowCellCheckbox as Br, EuiLink as Wr, EuiTableRow as Ur, EuiTable as qr, EuiCodeBlock as Hr, EuiFlyout as Gr, EuiSpacer as Lt, EuiPageTemplate as et } from "@elastic/eui";
9
- import { ArrowRepeat1Filled as Jr, ArrowRepeatAllFilled as Kr, ArrowRepeatAllOffFilled as Xr, ArrowShuffleFilled as Zr, ArrowShuffleOffFilled as Qr, PreviousFilled as en, PauseFilled as tn, PlayFilled as rn, NextFilled as nn, Speaker2Regular as Vt, MoreHorizontalFilled as Yt, TopSpeedRegular as on, SkipBack10Regular as an, SkipForward30Regular as sn, DismissRegular as lt, AddRegular as ct, ArrowUploadRegular as ln, ArrowDownloadRegular as cn, PlayRegular as un, DeleteRegular as dn } from "@fluentui/react-icons";
10
- import { observer as D } from "mobx-react-lite";
11
- import { ReactSortable as fn } from "react-sortablejs";
12
- import { makeObservable as mn, action as y, computed as w, observable as Q, reaction as hn } from "mobx";
13
- import { pull as Rt } from "lodash-es";
14
- import vn from "ajv";
15
- var tt = { exports: {} }, xe = {};
16
- /**
17
- * @license React
18
- * react-jsx-runtime.production.min.js
19
- *
20
- * Copyright (c) Facebook, Inc. and its affiliates.
21
- *
22
- * This source code is licensed under the MIT license found in the
23
- * LICENSE file in the root directory of this source tree.
24
- */
25
- var Pt;
26
- function pn() {
27
- if (Pt) return xe;
28
- Pt = 1;
29
- var t = Ft, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, a = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
30
- function f(m, h, p) {
31
- var C, R = {}, B = null, j = null;
32
- p !== void 0 && (B = "" + p), h.key !== void 0 && (B = "" + h.key), h.ref !== void 0 && (j = h.ref);
33
- for (C in h) i.call(h, C) && !l.hasOwnProperty(C) && (R[C] = h[C]);
34
- if (m && m.defaultProps) for (C in h = m.defaultProps, h) R[C] === void 0 && (R[C] = h[C]);
35
- return { $$typeof: e, type: m, key: B, ref: j, props: R, _owner: a.current };
36
- }
37
- return xe.Fragment = n, xe.jsx = f, xe.jsxs = f, xe;
38
- }
39
- var Te = {};
40
- /**
41
- * @license React
42
- * react-jsx-runtime.development.js
43
- *
44
- * Copyright (c) Facebook, Inc. and its affiliates.
45
- *
46
- * This source code is licensed under the MIT license found in the
47
- * LICENSE file in the root directory of this source tree.
48
- */
49
- var wt;
50
- function yn() {
51
- return wt || (wt = 1, process.env.NODE_ENV !== "production" && function() {
52
- var t = Ft, e = Symbol.for("react.element"), n = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), f = Symbol.for("react.provider"), m = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), p = Symbol.for("react.suspense"), C = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), B = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), z = Symbol.iterator, fe = "@@iterator";
53
- function me(r) {
54
- if (r === null || typeof r != "object")
55
- return null;
56
- var s = z && r[z] || r[fe];
57
- return typeof s == "function" ? s : null;
58
- }
59
- var q = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
60
- function A(r) {
61
- {
62
- for (var s = arguments.length, c = new Array(s > 1 ? s - 1 : 0), v = 1; v < s; v++)
63
- c[v - 1] = arguments[v];
64
- M("error", r, c);
65
- }
66
- }
67
- function M(r, s, c) {
68
- {
69
- var v = q.ReactDebugCurrentFrame, E = v.getStackAddendum();
70
- E !== "" && (s += "%s", c = c.concat([E]));
71
- var S = c.map(function(b) {
72
- return String(b);
73
- });
74
- S.unshift("Warning: " + s), Function.prototype.apply.call(console[r], console, S);
75
- }
76
- }
77
- var k = !1, u = !1, re = !1, Ne = !1, De = !1, Pe;
78
- Pe = Symbol.for("react.module.reference");
79
- function ze(r) {
80
- return !!(typeof r == "string" || typeof r == "function" || r === i || r === l || De || r === a || r === p || r === C || Ne || r === j || k || u || re || typeof r == "object" && r !== null && (r.$$typeof === B || r.$$typeof === R || r.$$typeof === f || r.$$typeof === m || r.$$typeof === h || // This needs to include all possible module reference object
81
- // types supported by any Flight configuration anywhere since
82
- // we don't know which Flight build this will end up being used
83
- // with.
84
- r.$$typeof === Pe || r.getModuleId !== void 0));
85
- }
86
- function Le(r, s, c) {
87
- var v = r.displayName;
88
- if (v)
89
- return v;
90
- var E = s.displayName || s.name || "";
91
- return E !== "" ? c + "(" + E + ")" : c;
92
- }
93
- function we(r) {
94
- return r.displayName || "Context";
95
- }
96
- function H(r) {
97
- if (r == null)
98
- return null;
99
- if (typeof r.tag == "number" && A("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof r == "function")
100
- return r.displayName || r.name || null;
101
- if (typeof r == "string")
102
- return r;
103
- switch (r) {
104
- case i:
105
- return "Fragment";
106
- case n:
107
- return "Portal";
108
- case l:
109
- return "Profiler";
110
- case a:
111
- return "StrictMode";
112
- case p:
113
- return "Suspense";
114
- case C:
115
- return "SuspenseList";
116
- }
117
- if (typeof r == "object")
118
- switch (r.$$typeof) {
119
- case m:
120
- var s = r;
121
- return we(s) + ".Consumer";
122
- case f:
123
- var c = r;
124
- return we(c._context) + ".Provider";
125
- case h:
126
- return Le(r, r.render, "ForwardRef");
127
- case R:
128
- var v = r.displayName || null;
129
- return v !== null ? v : H(r.type) || "Memo";
130
- case B: {
131
- var E = r, S = E._payload, b = E._init;
132
- try {
133
- return H(b(S));
134
- } catch {
135
- return null;
136
- }
137
- }
138
- }
139
- return null;
140
- }
141
- var X = Object.assign, ne = 0, _e, Oe, he, Ae, ve, ke, Me;
142
- function Fe() {
143
- }
144
- Fe.__reactDisabledLog = !0;
145
- function Ve() {
146
- {
147
- if (ne === 0) {
148
- _e = console.log, Oe = console.info, he = console.warn, Ae = console.error, ve = console.group, ke = console.groupCollapsed, Me = console.groupEnd;
149
- var r = {
150
- configurable: !0,
151
- enumerable: !0,
152
- value: Fe,
153
- writable: !0
154
- };
155
- Object.defineProperties(console, {
156
- info: r,
157
- log: r,
158
- warn: r,
159
- error: r,
160
- group: r,
161
- groupCollapsed: r,
162
- groupEnd: r
163
- });
164
- }
165
- ne++;
166
- }
167
- }
168
- function Ye() {
169
- {
170
- if (ne--, ne === 0) {
171
- var r = {
172
- configurable: !0,
173
- enumerable: !0,
174
- writable: !0
175
- };
176
- Object.defineProperties(console, {
177
- log: X({}, r, {
178
- value: _e
179
- }),
180
- info: X({}, r, {
181
- value: Oe
182
- }),
183
- warn: X({}, r, {
184
- value: he
185
- }),
186
- error: X({}, r, {
187
- value: Ae
188
- }),
189
- group: X({}, r, {
190
- value: ve
191
- }),
192
- groupCollapsed: X({}, r, {
193
- value: ke
194
- }),
195
- groupEnd: X({}, r, {
196
- value: Me
197
- })
198
- });
199
- }
200
- ne < 0 && A("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
201
- }
202
- }
203
- var pe = q.ReactCurrentDispatcher, ye;
204
- function ae(r, s, c) {
205
- {
206
- if (ye === void 0)
207
- try {
208
- throw Error();
209
- } catch (E) {
210
- var v = E.stack.trim().match(/\n( *(at )?)/);
211
- ye = v && v[1] || "";
212
- }
213
- return `
214
- ` + ye + r;
215
- }
216
- }
217
- var ge = !1, se;
218
- {
219
- var Be = typeof WeakMap == "function" ? WeakMap : Map;
220
- se = new Be();
221
- }
222
- function d(r, s) {
223
- if (!r || ge)
224
- return "";
225
- {
226
- var c = se.get(r);
227
- if (c !== void 0)
228
- return c;
229
- }
230
- var v;
231
- ge = !0;
232
- var E = Error.prepareStackTrace;
233
- Error.prepareStackTrace = void 0;
234
- var S;
235
- S = pe.current, pe.current = null, Ve();
236
- try {
237
- if (s) {
238
- var b = function() {
239
- throw Error();
240
- };
241
- if (Object.defineProperty(b.prototype, "props", {
242
- set: function() {
243
- throw Error();
244
- }
245
- }), typeof Reflect == "object" && Reflect.construct) {
246
- try {
247
- Reflect.construct(b, []);
248
- } catch (N) {
249
- v = N;
250
- }
251
- Reflect.construct(r, [], b);
252
- } else {
253
- try {
254
- b.call();
255
- } catch (N) {
256
- v = N;
257
- }
258
- r.call(b.prototype);
259
- }
260
- } else {
261
- try {
262
- throw Error();
263
- } catch (N) {
264
- v = N;
265
- }
266
- r();
267
- }
268
- } catch (N) {
269
- if (N && v && typeof N.stack == "string") {
270
- for (var g = N.stack.split(`
271
- `), F = v.stack.split(`
272
- `), P = g.length - 1, _ = F.length - 1; P >= 1 && _ >= 0 && g[P] !== F[_]; )
273
- _--;
274
- for (; P >= 1 && _ >= 0; P--, _--)
275
- if (g[P] !== F[_]) {
276
- if (P !== 1 || _ !== 1)
277
- do
278
- if (P--, _--, _ < 0 || g[P] !== F[_]) {
279
- var L = `
280
- ` + g[P].replace(" at new ", " at ");
281
- return r.displayName && L.includes("<anonymous>") && (L = L.replace("<anonymous>", r.displayName)), typeof r == "function" && se.set(r, L), L;
282
- }
283
- while (P >= 1 && _ >= 0);
284
- break;
285
- }
286
- }
287
- } finally {
288
- ge = !1, pe.current = S, Ye(), Error.prepareStackTrace = E;
289
- }
290
- var ue = r ? r.displayName || r.name : "", oe = ue ? ae(ue) : "";
291
- return typeof r == "function" && se.set(r, oe), oe;
292
- }
293
- function be(r, s, c) {
294
- return d(r, !1);
295
- }
296
- function le(r) {
297
- var s = r.prototype;
298
- return !!(s && s.isReactComponent);
299
- }
300
- function ie(r, s, c) {
301
- if (r == null)
302
- return "";
303
- if (typeof r == "function")
304
- return d(r, le(r));
305
- if (typeof r == "string")
306
- return ae(r);
307
- switch (r) {
308
- case p:
309
- return ae("Suspense");
310
- case C:
311
- return ae("SuspenseList");
312
- }
313
- if (typeof r == "object")
314
- switch (r.$$typeof) {
315
- case h:
316
- return be(r.render);
317
- case R:
318
- return ie(r.type, s, c);
319
- case B: {
320
- var v = r, E = v._payload, S = v._init;
321
- try {
322
- return ie(S(E), s, c);
323
- } catch {
324
- }
325
- }
326
- }
327
- return "";
328
- }
329
- var Ee = Object.prototype.hasOwnProperty, ut = {}, dt = q.ReactDebugCurrentFrame;
330
- function $e(r) {
331
- if (r) {
332
- var s = r._owner, c = ie(r.type, r._source, s ? s.type : null);
333
- dt.setExtraStackFrame(c);
334
- } else
335
- dt.setExtraStackFrame(null);
336
- }
337
- function er(r, s, c, v, E) {
338
- {
339
- var S = Function.call.bind(Ee);
340
- for (var b in r)
341
- if (S(r, b)) {
342
- var g = void 0;
343
- try {
344
- if (typeof r[b] != "function") {
345
- var F = Error((v || "React class") + ": " + c + " type `" + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof r[b] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
346
- throw F.name = "Invariant Violation", F;
347
- }
348
- g = r[b](s, b, v, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
349
- } catch (P) {
350
- g = P;
351
- }
352
- g && !(g instanceof Error) && ($e(E), A("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", v || "React class", c, b, typeof g), $e(null)), g instanceof Error && !(g.message in ut) && (ut[g.message] = !0, $e(E), A("Failed %s type: %s", c, g.message), $e(null));
353
- }
354
- }
355
- }
356
- var tr = Array.isArray;
357
- function We(r) {
358
- return tr(r);
359
- }
360
- function rr(r) {
361
- {
362
- var s = typeof Symbol == "function" && Symbol.toStringTag, c = s && r[Symbol.toStringTag] || r.constructor.name || "Object";
363
- return c;
364
- }
365
- }
366
- function nr(r) {
367
- try {
368
- return ft(r), !1;
369
- } catch {
370
- return !0;
371
- }
372
- }
373
- function ft(r) {
374
- return "" + r;
375
- }
376
- function mt(r) {
377
- if (nr(r))
378
- return A("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", rr(r)), ft(r);
379
- }
380
- var ht = q.ReactCurrentOwner, ir = {
381
- key: !0,
382
- ref: !0,
383
- __self: !0,
384
- __source: !0
385
- }, vt, pt;
386
- function or(r) {
387
- if (Ee.call(r, "ref")) {
388
- var s = Object.getOwnPropertyDescriptor(r, "ref").get;
389
- if (s && s.isReactWarning)
390
- return !1;
391
- }
392
- return r.ref !== void 0;
393
- }
394
- function ar(r) {
395
- if (Ee.call(r, "key")) {
396
- var s = Object.getOwnPropertyDescriptor(r, "key").get;
397
- if (s && s.isReactWarning)
398
- return !1;
399
- }
400
- return r.key !== void 0;
401
- }
402
- function sr(r, s) {
403
- typeof r.ref == "string" && ht.current;
404
- }
405
- function lr(r, s) {
406
- {
407
- var c = function() {
408
- vt || (vt = !0, A("%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://reactjs.org/link/special-props)", s));
409
- };
410
- c.isReactWarning = !0, Object.defineProperty(r, "key", {
411
- get: c,
412
- configurable: !0
413
- });
414
- }
415
- }
416
- function cr(r, s) {
417
- {
418
- var c = function() {
419
- pt || (pt = !0, A("%s: `ref` 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://reactjs.org/link/special-props)", s));
420
- };
421
- c.isReactWarning = !0, Object.defineProperty(r, "ref", {
422
- get: c,
423
- configurable: !0
424
- });
425
- }
426
- }
427
- var ur = function(r, s, c, v, E, S, b) {
428
- var g = {
429
- // This tag allows us to uniquely identify this as a React Element
430
- $$typeof: e,
431
- // Built-in properties that belong on the element
432
- type: r,
433
- key: s,
434
- ref: c,
435
- props: b,
436
- // Record the component responsible for creating this element.
437
- _owner: S
438
- };
439
- return g._store = {}, Object.defineProperty(g._store, "validated", {
440
- configurable: !1,
441
- enumerable: !1,
442
- writable: !0,
443
- value: !1
444
- }), Object.defineProperty(g, "_self", {
445
- configurable: !1,
446
- enumerable: !1,
447
- writable: !1,
448
- value: v
449
- }), Object.defineProperty(g, "_source", {
450
- configurable: !1,
451
- enumerable: !1,
452
- writable: !1,
453
- value: E
454
- }), Object.freeze && (Object.freeze(g.props), Object.freeze(g)), g;
455
- };
456
- function dr(r, s, c, v, E) {
457
- {
458
- var S, b = {}, g = null, F = null;
459
- c !== void 0 && (mt(c), g = "" + c), ar(s) && (mt(s.key), g = "" + s.key), or(s) && (F = s.ref, sr(s, E));
460
- for (S in s)
461
- Ee.call(s, S) && !ir.hasOwnProperty(S) && (b[S] = s[S]);
462
- if (r && r.defaultProps) {
463
- var P = r.defaultProps;
464
- for (S in P)
465
- b[S] === void 0 && (b[S] = P[S]);
466
- }
467
- if (g || F) {
468
- var _ = typeof r == "function" ? r.displayName || r.name || "Unknown" : r;
469
- g && lr(b, _), F && cr(b, _);
470
- }
471
- return ur(r, g, F, E, v, ht.current, b);
472
- }
473
- }
474
- var Ue = q.ReactCurrentOwner, yt = q.ReactDebugCurrentFrame;
475
- function ce(r) {
476
- if (r) {
477
- var s = r._owner, c = ie(r.type, r._source, s ? s.type : null);
478
- yt.setExtraStackFrame(c);
479
- } else
480
- yt.setExtraStackFrame(null);
481
- }
482
- var qe;
483
- qe = !1;
484
- function He(r) {
485
- return typeof r == "object" && r !== null && r.$$typeof === e;
486
- }
487
- function gt() {
488
- {
489
- if (Ue.current) {
490
- var r = H(Ue.current.type);
491
- if (r)
492
- return `
493
-
494
- Check the render method of \`` + r + "`.";
495
- }
496
- return "";
497
- }
498
- }
499
- function fr(r) {
500
- return "";
501
- }
502
- var bt = {};
503
- function mr(r) {
504
- {
505
- var s = gt();
506
- if (!s) {
507
- var c = typeof r == "string" ? r : r.displayName || r.name;
508
- c && (s = `
509
-
510
- Check the top-level render call using <` + c + ">.");
511
- }
512
- return s;
513
- }
514
- }
515
- function Et(r, s) {
516
- {
517
- if (!r._store || r._store.validated || r.key != null)
518
- return;
519
- r._store.validated = !0;
520
- var c = mr(s);
521
- if (bt[c])
522
- return;
523
- bt[c] = !0;
524
- var v = "";
525
- r && r._owner && r._owner !== Ue.current && (v = " It was passed a child from " + H(r._owner.type) + "."), ce(r), A('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', c, v), ce(null);
526
- }
527
- }
528
- function xt(r, s) {
529
- {
530
- if (typeof r != "object")
531
- return;
532
- if (We(r))
533
- for (var c = 0; c < r.length; c++) {
534
- var v = r[c];
535
- He(v) && Et(v, s);
536
- }
537
- else if (He(r))
538
- r._store && (r._store.validated = !0);
539
- else if (r) {
540
- var E = me(r);
541
- if (typeof E == "function" && E !== r.entries)
542
- for (var S = E.call(r), b; !(b = S.next()).done; )
543
- He(b.value) && Et(b.value, s);
544
- }
545
- }
546
- }
547
- function hr(r) {
548
- {
549
- var s = r.type;
550
- if (s == null || typeof s == "string")
551
- return;
552
- var c;
553
- if (typeof s == "function")
554
- c = s.propTypes;
555
- else if (typeof s == "object" && (s.$$typeof === h || // Note: Memo only checks outer props here.
556
- // Inner props are checked in the reconciler.
557
- s.$$typeof === R))
558
- c = s.propTypes;
559
- else
560
- return;
561
- if (c) {
562
- var v = H(s);
563
- er(c, r.props, "prop", v, r);
564
- } else if (s.PropTypes !== void 0 && !qe) {
565
- qe = !0;
566
- var E = H(s);
567
- A("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", E || "Unknown");
568
- }
569
- typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && A("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
570
- }
571
- }
572
- function vr(r) {
573
- {
574
- for (var s = Object.keys(r.props), c = 0; c < s.length; c++) {
575
- var v = s[c];
576
- if (v !== "children" && v !== "key") {
577
- ce(r), A("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", v), ce(null);
578
- break;
579
- }
580
- }
581
- r.ref !== null && (ce(r), A("Invalid attribute `ref` supplied to `React.Fragment`."), ce(null));
582
- }
583
- }
584
- var Tt = {};
585
- function Ct(r, s, c, v, E, S) {
586
- {
587
- var b = ze(r);
588
- if (!b) {
589
- var g = "";
590
- (r === void 0 || typeof r == "object" && r !== null && Object.keys(r).length === 0) && (g += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
591
- var F = fr();
592
- F ? g += F : g += gt();
593
- var P;
594
- r === null ? P = "null" : We(r) ? P = "array" : r !== void 0 && r.$$typeof === e ? (P = "<" + (H(r.type) || "Unknown") + " />", g = " Did you accidentally export a JSX literal instead of a component?") : P = typeof r, A("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", P, g);
595
- }
596
- var _ = dr(r, s, c, E, S);
597
- if (_ == null)
598
- return _;
599
- if (b) {
600
- var L = s.children;
601
- if (L !== void 0)
602
- if (v)
603
- if (We(L)) {
604
- for (var ue = 0; ue < L.length; ue++)
605
- xt(L[ue], r);
606
- Object.freeze && Object.freeze(L);
607
- } else
608
- A("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
609
- else
610
- xt(L, r);
611
- }
612
- if (Ee.call(s, "key")) {
613
- var oe = H(r), N = Object.keys(s).filter(function(xr) {
614
- return xr !== "key";
615
- }), Ge = N.length > 0 ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}";
616
- if (!Tt[oe + Ge]) {
617
- var Er = N.length > 0 ? "{" + N.join(": ..., ") + ": ...}" : "{}";
618
- A(`A props object containing a "key" prop is being spread into JSX:
619
- let props = %s;
620
- <%s {...props} />
621
- React keys must be passed directly to JSX without using spread:
622
- let props = %s;
623
- <%s key={someKey} {...props} />`, Ge, oe, Er, oe), Tt[oe + Ge] = !0;
624
- }
625
- }
626
- return r === i ? vr(_) : hr(_), _;
627
- }
628
- }
629
- function pr(r, s, c) {
630
- return Ct(r, s, c, !0);
631
- }
632
- function yr(r, s, c) {
633
- return Ct(r, s, c, !1);
634
- }
635
- var gr = yr, br = pr;
636
- Te.Fragment = i, Te.jsx = gr, Te.jsxs = br;
637
- }()), Te;
638
- }
639
- process.env.NODE_ENV === "production" ? tt.exports = pn() : tt.exports = yn();
640
- var Se = tt.exports, rt = { exports: {} }, x = {};
641
- /** @license React v16.13.1
642
- * react-is.production.min.js
643
- *
644
- * Copyright (c) Facebook, Inc. and its affiliates.
645
- *
646
- * This source code is licensed under the MIT license found in the
647
- * LICENSE file in the root directory of this source tree.
648
- */
649
- var _t;
650
- function gn() {
651
- if (_t) return x;
652
- _t = 1;
653
- var t = typeof Symbol == "function" && Symbol.for, e = t ? Symbol.for("react.element") : 60103, n = t ? Symbol.for("react.portal") : 60106, i = t ? Symbol.for("react.fragment") : 60107, a = t ? Symbol.for("react.strict_mode") : 60108, l = t ? Symbol.for("react.profiler") : 60114, f = t ? Symbol.for("react.provider") : 60109, m = t ? Symbol.for("react.context") : 60110, h = t ? Symbol.for("react.async_mode") : 60111, p = t ? Symbol.for("react.concurrent_mode") : 60111, C = t ? Symbol.for("react.forward_ref") : 60112, R = t ? Symbol.for("react.suspense") : 60113, B = t ? Symbol.for("react.suspense_list") : 60120, j = t ? Symbol.for("react.memo") : 60115, z = t ? Symbol.for("react.lazy") : 60116, fe = t ? Symbol.for("react.block") : 60121, me = t ? Symbol.for("react.fundamental") : 60117, q = t ? Symbol.for("react.responder") : 60118, A = t ? Symbol.for("react.scope") : 60119;
654
- function M(u) {
655
- if (typeof u == "object" && u !== null) {
656
- var re = u.$$typeof;
657
- switch (re) {
658
- case e:
659
- switch (u = u.type, u) {
660
- case h:
661
- case p:
662
- case i:
663
- case l:
664
- case a:
665
- case R:
666
- return u;
667
- default:
668
- switch (u = u && u.$$typeof, u) {
669
- case m:
670
- case C:
671
- case z:
672
- case j:
673
- case f:
674
- return u;
675
- default:
676
- return re;
677
- }
678
- }
679
- case n:
680
- return re;
681
- }
682
- }
683
- }
684
- function k(u) {
685
- return M(u) === p;
686
- }
687
- return x.AsyncMode = h, x.ConcurrentMode = p, x.ContextConsumer = m, x.ContextProvider = f, x.Element = e, x.ForwardRef = C, x.Fragment = i, x.Lazy = z, x.Memo = j, x.Portal = n, x.Profiler = l, x.StrictMode = a, x.Suspense = R, x.isAsyncMode = function(u) {
688
- return k(u) || M(u) === h;
689
- }, x.isConcurrentMode = k, x.isContextConsumer = function(u) {
690
- return M(u) === m;
691
- }, x.isContextProvider = function(u) {
692
- return M(u) === f;
693
- }, x.isElement = function(u) {
694
- return typeof u == "object" && u !== null && u.$$typeof === e;
695
- }, x.isForwardRef = function(u) {
696
- return M(u) === C;
697
- }, x.isFragment = function(u) {
698
- return M(u) === i;
699
- }, x.isLazy = function(u) {
700
- return M(u) === z;
701
- }, x.isMemo = function(u) {
702
- return M(u) === j;
703
- }, x.isPortal = function(u) {
704
- return M(u) === n;
705
- }, x.isProfiler = function(u) {
706
- return M(u) === l;
707
- }, x.isStrictMode = function(u) {
708
- return M(u) === a;
709
- }, x.isSuspense = function(u) {
710
- return M(u) === R;
711
- }, x.isValidElementType = function(u) {
712
- return typeof u == "string" || typeof u == "function" || u === i || u === p || u === l || u === a || u === R || u === B || typeof u == "object" && u !== null && (u.$$typeof === z || u.$$typeof === j || u.$$typeof === f || u.$$typeof === m || u.$$typeof === C || u.$$typeof === me || u.$$typeof === q || u.$$typeof === A || u.$$typeof === fe);
713
- }, x.typeOf = M, x;
714
- }
715
- var T = {};
716
- /** @license React v16.13.1
717
- * react-is.development.js
718
- *
719
- * Copyright (c) Facebook, Inc. and its affiliates.
720
- *
721
- * This source code is licensed under the MIT license found in the
722
- * LICENSE file in the root directory of this source tree.
723
- */
724
- var Ot;
725
- function bn() {
726
- return Ot || (Ot = 1, process.env.NODE_ENV !== "production" && function() {
727
- var t = typeof Symbol == "function" && Symbol.for, e = t ? Symbol.for("react.element") : 60103, n = t ? Symbol.for("react.portal") : 60106, i = t ? Symbol.for("react.fragment") : 60107, a = t ? Symbol.for("react.strict_mode") : 60108, l = t ? Symbol.for("react.profiler") : 60114, f = t ? Symbol.for("react.provider") : 60109, m = t ? Symbol.for("react.context") : 60110, h = t ? Symbol.for("react.async_mode") : 60111, p = t ? Symbol.for("react.concurrent_mode") : 60111, C = t ? Symbol.for("react.forward_ref") : 60112, R = t ? Symbol.for("react.suspense") : 60113, B = t ? Symbol.for("react.suspense_list") : 60120, j = t ? Symbol.for("react.memo") : 60115, z = t ? Symbol.for("react.lazy") : 60116, fe = t ? Symbol.for("react.block") : 60121, me = t ? Symbol.for("react.fundamental") : 60117, q = t ? Symbol.for("react.responder") : 60118, A = t ? Symbol.for("react.scope") : 60119;
728
- function M(d) {
729
- return typeof d == "string" || typeof d == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
730
- d === i || d === p || d === l || d === a || d === R || d === B || typeof d == "object" && d !== null && (d.$$typeof === z || d.$$typeof === j || d.$$typeof === f || d.$$typeof === m || d.$$typeof === C || d.$$typeof === me || d.$$typeof === q || d.$$typeof === A || d.$$typeof === fe);
731
- }
732
- function k(d) {
733
- if (typeof d == "object" && d !== null) {
734
- var be = d.$$typeof;
735
- switch (be) {
736
- case e:
737
- var le = d.type;
738
- switch (le) {
739
- case h:
740
- case p:
741
- case i:
742
- case l:
743
- case a:
744
- case R:
745
- return le;
746
- default:
747
- var ie = le && le.$$typeof;
748
- switch (ie) {
749
- case m:
750
- case C:
751
- case z:
752
- case j:
753
- case f:
754
- return ie;
755
- default:
756
- return be;
757
- }
758
- }
759
- case n:
760
- return be;
761
- }
762
- }
763
- }
764
- var u = h, re = p, Ne = m, De = f, Pe = e, ze = C, Le = i, we = z, H = j, X = n, ne = l, _e = a, Oe = R, he = !1;
765
- function Ae(d) {
766
- return he || (he = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), ve(d) || k(d) === h;
767
- }
768
- function ve(d) {
769
- return k(d) === p;
770
- }
771
- function ke(d) {
772
- return k(d) === m;
773
- }
774
- function Me(d) {
775
- return k(d) === f;
776
- }
777
- function Fe(d) {
778
- return typeof d == "object" && d !== null && d.$$typeof === e;
779
- }
780
- function Ve(d) {
781
- return k(d) === C;
782
- }
783
- function Ye(d) {
784
- return k(d) === i;
785
- }
786
- function pe(d) {
787
- return k(d) === z;
788
- }
789
- function ye(d) {
790
- return k(d) === j;
791
- }
792
- function ae(d) {
793
- return k(d) === n;
794
- }
795
- function ge(d) {
796
- return k(d) === l;
797
- }
798
- function se(d) {
799
- return k(d) === a;
800
- }
801
- function Be(d) {
802
- return k(d) === R;
803
- }
804
- T.AsyncMode = u, T.ConcurrentMode = re, T.ContextConsumer = Ne, T.ContextProvider = De, T.Element = Pe, T.ForwardRef = ze, T.Fragment = Le, T.Lazy = we, T.Memo = H, T.Portal = X, T.Profiler = ne, T.StrictMode = _e, T.Suspense = Oe, T.isAsyncMode = Ae, T.isConcurrentMode = ve, T.isContextConsumer = ke, T.isContextProvider = Me, T.isElement = Fe, T.isForwardRef = Ve, T.isFragment = Ye, T.isLazy = pe, T.isMemo = ye, T.isPortal = ae, T.isProfiler = ge, T.isStrictMode = se, T.isSuspense = Be, T.isValidElementType = M, T.typeOf = k;
805
- }()), T;
806
- }
807
- process.env.NODE_ENV === "production" ? rt.exports = gn() : rt.exports = bn();
808
- var En = rt.exports, Bt = En, xn = {
809
- $$typeof: !0,
810
- render: !0,
811
- defaultProps: !0,
812
- displayName: !0,
813
- propTypes: !0
814
- }, Tn = {
815
- $$typeof: !0,
816
- compare: !0,
817
- defaultProps: !0,
818
- displayName: !0,
819
- propTypes: !0,
820
- type: !0
821
- }, Wt = {};
822
- Wt[Bt.ForwardRef] = xn;
823
- Wt[Bt.Memo] = Tn;
824
- var Cn = !0;
825
- function Sn(t, e, n) {
826
- var i = "";
827
- return n.split(" ").forEach(function(a) {
828
- t[a] !== void 0 ? e.push(t[a] + ";") : a && (i += a + " ");
829
- }), i;
1
+ import { createContext as e, memo as t, useCallback as n, useContext as r, useEffect as i, useLayoutEffect as a, useMemo as o, useRef as s, useState as c } from "react";
2
+ import { EuiBottomBar as l, EuiButton as u, EuiButtonEmpty as d, EuiButtonIcon as f, EuiCheckbox as p, EuiConfirmModal as ee, EuiContextMenu as m, EuiEmptyPrompt as te, EuiFieldText as ne, EuiFlexGroup as h, EuiFlexItem as g, EuiForm as re, EuiFormRow as _, EuiHideFor as v, EuiIcon as y, EuiLink as ie, EuiModal as ae, EuiModalBody as oe, EuiModalFooter as se, EuiModalHeader as ce, EuiModalHeaderTitle as le, EuiPageTemplate as b, EuiPopover as x, EuiRange as ue, EuiShowFor as de, EuiSpacer as fe, EuiTable as pe, EuiTableHeader as me, EuiTableHeaderCell as S, EuiTableHeaderCellCheckbox as he, EuiTableHeaderMobile as ge, EuiTableRow as _e, EuiTableRowCell as C, EuiTableRowCellCheckbox as ve, useEuiTheme as w, useGeneratedHtmlId as ye } from "@elastic/eui";
3
+ import { AddRegular as T, ArrowDownloadRegular as be, ArrowRepeat1Filled as xe, ArrowRepeatAllFilled as Se, ArrowRepeatAllOffFilled as Ce, ArrowShuffleFilled as we, ArrowShuffleOffFilled as Te, ArrowUploadRegular as Ee, DeleteRegular as De, DismissRegular as E, MoreHorizontalFilled as D, NavigationPlayRegular as Oe, NextFilled as ke, OpenRegular as Ae, PauseFilled as je, PlayFilled as Me, PlayRegular as O, PreviousFilled as Ne, RenameRegular as Pe, SkipBack10Regular as Fe, SkipForward30Regular as Ie, Speaker2Regular as Le, TopSpeedRegular as Re } from "@fluentui/react-icons";
4
+ import { observer as k } from "mobx-react-lite";
5
+ import { Fragment as A, jsx as j, jsxs as M } from "@emotion/react/jsx-runtime";
6
+ import { NostalgicDiva as ze, NostalgicDivaProvider as Be, findVideoService as Ve, findVideoService as He, nullPlayerController as Ue, useNostalgicDiva as N } from "@aigamo/nostalgic-diva";
7
+ import P from "ez-modal-react";
8
+ import { ReactSortable as We } from "react-sortablejs";
9
+ import { useRouter as Ge } from "@tanstack/react-router";
10
+ import { action as F, computed as I, makeObservable as L, observable as R, reaction as Ke } from "mobx";
11
+ import qe from "ajv";
12
+ import { pull as z } from "lodash-es";
13
+ import { useLocalStorageState as B } from "@aigamo/route-sphere";
14
+ //#region src/features/media-player/contexts/BottomBarContext.ts
15
+ var Je = e(void 0), V = () => r(Je), H = /* @__PURE__ */ function(e) {
16
+ return e.Off = "Off", e.All = "All", e.One = "One", e;
17
+ }({}), Ye = k(() => {
18
+ let e = V();
19
+ return /* @__PURE__ */ j(f, {
20
+ title: `Shuffle: ${e.shuffle ? "On" : "Off"}`,
21
+ "aria-label": `Shuffle: ${e.shuffle ? "On" : "Off"}`,
22
+ iconType: e.shuffle ? we : Te,
23
+ size: "s",
24
+ iconSize: "l",
25
+ onClick: e.toggleShuffle,
26
+ disabled: !e.canToggleShuffle
27
+ });
28
+ }), Xe = k(() => {
29
+ let e = V();
30
+ return /* @__PURE__ */ j(f, {
31
+ title: "Previous",
32
+ "aria-label": "Previous",
33
+ iconType: Ne,
34
+ size: "s",
35
+ iconSize: "l",
36
+ onClick: e.previous,
37
+ disabled: !e.canPrevious
38
+ });
39
+ }), Ze = k(() => {
40
+ let e = V();
41
+ return /* @__PURE__ */ j(f, {
42
+ title: "Skip back 10 seconds",
43
+ "aria-label": "Skip back 10 seconds",
44
+ iconType: Fe,
45
+ size: "s",
46
+ iconSize: "l",
47
+ onClick: e.skipBack10,
48
+ disabled: !e.canSkipBack10
49
+ });
50
+ }), Qe = k(() => {
51
+ let e = V();
52
+ return /* @__PURE__ */ j(f, {
53
+ title: "Pause",
54
+ "aria-label": "Pause",
55
+ iconType: je,
56
+ size: "s",
57
+ iconSize: "l",
58
+ onClick: e.pause,
59
+ disabled: !e.canPause
60
+ });
61
+ }), $e = k(() => {
62
+ let e = V();
63
+ return /* @__PURE__ */ j(f, {
64
+ title: "Play",
65
+ "aria-label": "Play",
66
+ iconType: Me,
67
+ size: "s",
68
+ iconSize: "l",
69
+ onClick: e.play,
70
+ disabled: !e.canPlay
71
+ });
72
+ }), et = k(() => {
73
+ let e = V();
74
+ return /* @__PURE__ */ j(f, {
75
+ title: "Skip forward 30 seconds",
76
+ "aria-label": "Skip forward 30 seconds",
77
+ iconType: Ie,
78
+ size: "s",
79
+ iconSize: "l",
80
+ onClick: e.skipForward30,
81
+ disabled: !e.canSkipForward30
82
+ });
83
+ }), tt = k(() => {
84
+ let e = V();
85
+ return /* @__PURE__ */ j(f, {
86
+ title: "Next",
87
+ "aria-label": "Next",
88
+ iconType: ke,
89
+ size: "s",
90
+ iconSize: "l",
91
+ onClick: e.next,
92
+ disabled: !e.canNext
93
+ });
94
+ }), nt = {
95
+ [H.Off]: Ce,
96
+ [H.All]: Se,
97
+ [H.One]: xe
98
+ }, rt = k(() => {
99
+ let e = V();
100
+ return /* @__PURE__ */ j(f, {
101
+ title: `Repeat: ${e.repeat === H.All ? "All" : e.repeat === H.One ? "One" : "Off"}`,
102
+ "aria-label": `Repeat: ${e.repeat === H.All ? "All" : e.repeat === H.One ? "One" : "Off"}`,
103
+ iconType: nt[e.repeat],
104
+ size: "s",
105
+ iconSize: "l",
106
+ onClick: e.toggleRepeat,
107
+ disabled: !e.canToggleRepeat
108
+ });
109
+ }), it = k(() => {
110
+ let e = V();
111
+ return /* @__PURE__ */ M(h, {
112
+ responsive: !1,
113
+ gutterSize: "s",
114
+ justifyContent: "center",
115
+ alignItems: "center",
116
+ children: [
117
+ /* @__PURE__ */ j(v, {
118
+ sizes: ["xs"],
119
+ children: /* @__PURE__ */ j(Ye, {})
120
+ }),
121
+ /* @__PURE__ */ j(Xe, {}),
122
+ /* @__PURE__ */ j(v, {
123
+ sizes: ["xs"],
124
+ children: /* @__PURE__ */ j(Ze, {})
125
+ }),
126
+ e.playing ? /* @__PURE__ */ j(Qe, {}) : /* @__PURE__ */ j($e, {}),
127
+ /* @__PURE__ */ j(v, {
128
+ sizes: ["xs"],
129
+ children: /* @__PURE__ */ j(et, {})
130
+ }),
131
+ /* @__PURE__ */ j(tt, {}),
132
+ /* @__PURE__ */ j(v, {
133
+ sizes: ["xs"],
134
+ children: /* @__PURE__ */ j(rt, {})
135
+ })
136
+ ]
137
+ });
138
+ }), at = new Map(Object.entries({
139
+ Audio: "",
140
+ Dailymotion: "https://www.dailymotion.com/favicon.ico",
141
+ Niconico: "https://www.nicovideo.jp/favicon.ico",
142
+ SoundCloud: "https://soundcloud.com/favicon.ico",
143
+ Spotify: "https://storage.googleapis.com/pr-newsroom-wp/1/2023/05/Spotify_Primary_Logo_RGB_Green.png",
144
+ Twitch: "https://www.twitch.tv/favicon.ico",
145
+ Vimeo: "https://vimeo.com/favicon.ico",
146
+ YouTube: "https://www.youtube.com/favicon.ico"
147
+ })), ot = t(({ item: e, closePopover: t }) => {
148
+ let r = n(({ name: e, icon: n, onClick: r }) => ({
149
+ name: e,
150
+ icon: n,
151
+ onClick: async (e) => {
152
+ t(), r(e);
153
+ }
154
+ }), [t]);
155
+ return /* @__PURE__ */ j(m, {
156
+ initialPanelId: 0,
157
+ panels: o(() => [{
158
+ id: 0,
159
+ items: [
160
+ r({
161
+ name: "Open in new tab",
162
+ icon: /* @__PURE__ */ j(y, { type: Ae }),
163
+ onClick: async () => {
164
+ window.open(e.dto.url, "_blank");
165
+ }
166
+ }),
167
+ r({
168
+ name: "Copy link address",
169
+ icon: /* @__PURE__ */ j(y, { type: "" }),
170
+ onClick: async () => {
171
+ await navigator.clipboard.writeText(e.dto.url);
172
+ }
173
+ }),
174
+ r({
175
+ name: "Copy link text",
176
+ icon: /* @__PURE__ */ j(y, { type: "" }),
177
+ onClick: async () => {
178
+ await navigator.clipboard.writeText(e.dto.title);
179
+ }
180
+ })
181
+ ]
182
+ }], [r, e])
183
+ });
184
+ }), st = t(({ item: e }) => {
185
+ let [t, r] = c(!1), i = n(() => r(!t), [t]), a = n(() => r(!1), []);
186
+ return /* @__PURE__ */ j(x, {
187
+ button: /* @__PURE__ */ j(d, {
188
+ iconType: at.get(e.type),
189
+ size: "s",
190
+ onClick: i,
191
+ children: e.title
192
+ }),
193
+ isOpen: t,
194
+ closePopover: a,
195
+ panelPaddingSize: "none",
196
+ anchorPosition: "upLeft",
197
+ children: /* @__PURE__ */ j(ot, {
198
+ item: e,
199
+ closePopover: a
200
+ })
201
+ });
202
+ }), ct = k(() => {
203
+ let e = V();
204
+ return /* @__PURE__ */ j(h, {
205
+ responsive: !1,
206
+ gutterSize: "s",
207
+ justifyContent: "flexStart",
208
+ alignItems: "center",
209
+ children: e.currentItem && /* @__PURE__ */ j(st, { item: e.currentItem })
210
+ });
211
+ }), lt = k(() => /* @__PURE__ */ j(f, {
212
+ title: "Mute",
213
+ "aria-label": "Mute",
214
+ iconType: Le,
215
+ size: "s",
216
+ iconSize: "l",
217
+ disabled: !V().controller.supports("setMuted")
218
+ })), ut = k(({ button: e, isOpen: t, closePopover: r }) => {
219
+ let i = V(), [o, s] = c("0"), l = N();
220
+ a(() => {
221
+ t && l.getVolume().then((e) => {
222
+ e !== void 0 && s(Math.floor(e * 100).toString());
223
+ });
224
+ }, [t, l]);
225
+ let u = n(async (e) => {
226
+ s(e.currentTarget.value), await l.setVolume(Number(e.currentTarget.value) / 100);
227
+ }, [l]);
228
+ return /* @__PURE__ */ j(x, {
229
+ button: e,
230
+ isOpen: t,
231
+ closePopover: r,
232
+ anchorPosition: "upRight",
233
+ children: /* @__PURE__ */ j(_, { children: /* @__PURE__ */ M(h, {
234
+ responsive: !1,
235
+ gutterSize: "s",
236
+ justifyContent: "center",
237
+ alignItems: "center",
238
+ children: [/* @__PURE__ */ j(lt, {}), /* @__PURE__ */ j(ue, {
239
+ min: 0,
240
+ max: 100,
241
+ step: 1,
242
+ value: o,
243
+ onChange: u,
244
+ css: { blockSize: 32 },
245
+ disabled: !i.controller.supports("setVolume")
246
+ })]
247
+ }) })
248
+ });
249
+ }), dt = k(() => {
250
+ let e = V(), [t, n] = c(!1);
251
+ return /* @__PURE__ */ j(ut, {
252
+ button: /* @__PURE__ */ j(f, {
253
+ title: "Volume",
254
+ "aria-label": "Volume",
255
+ iconType: Le,
256
+ size: "s",
257
+ iconSize: "l",
258
+ onClick: () => n(!t),
259
+ disabled: !e.controller.supports("getVolume")
260
+ }),
261
+ isOpen: t,
262
+ closePopover: () => n(!1)
263
+ });
264
+ }), ft = ({ onClickPlayQueueButton: e }) => /* @__PURE__ */ j(f, {
265
+ title: "Play queue",
266
+ "aria-label": "Play queue",
267
+ iconType: Oe,
268
+ size: "s",
269
+ iconSize: "l",
270
+ onClick: e
271
+ }), pt = k(({ closePopover: e }) => {
272
+ let t = V(), r = N(), [i, a] = c(), s = n(async () => {
273
+ await t.controller.getPlaybackRate().then((e) => a(e));
274
+ }, [t]), l = n(({ name: t, icon: n, onClick: r, disabled: i, className: a }) => ({
275
+ name: t,
276
+ icon: n,
277
+ onClick: async () => {
278
+ e(), r();
279
+ },
280
+ disabled: i,
281
+ className: a
282
+ }), [e]);
283
+ return /* @__PURE__ */ j(m, {
284
+ initialPanelId: 0,
285
+ panels: o(() => [{
286
+ id: 0,
287
+ items: [
288
+ {
289
+ name: "Speed",
290
+ icon: /* @__PURE__ */ j(y, { type: Re }),
291
+ panel: 1,
292
+ onClick: s,
293
+ disabled: !t.controller.supports("getPlaybackRate")
294
+ },
295
+ l({
296
+ name: "Skip back 10 seconds",
297
+ icon: /* @__PURE__ */ j(y, { type: Fe }),
298
+ onClick: t.skipBack10,
299
+ disabled: !t.canSkipBack10
300
+ }),
301
+ l({
302
+ name: "Skip forward 30 seconds",
303
+ icon: /* @__PURE__ */ j(y, { type: Ie }),
304
+ onClick: t.skipForward30,
305
+ disabled: !t.canSkipForward30
306
+ }),
307
+ l({
308
+ name: `Shuffle: ${t.shuffle ? "On" : "Off"}`,
309
+ icon: /* @__PURE__ */ j(y, { type: t.shuffle ? we : Te }),
310
+ onClick: t.toggleShuffle,
311
+ disabled: !t.canToggleShuffle,
312
+ className: "eui-showFor--xs--flex"
313
+ }),
314
+ l({
315
+ name: `Repeat: ${t.repeat === H.All ? "All" : t.repeat === H.One ? "One" : "Off"}`,
316
+ icon: /* @__PURE__ */ j(y, { type: nt[t.repeat] }),
317
+ onClick: t.toggleRepeat,
318
+ disabled: !t.canToggleRepeat,
319
+ className: "eui-showFor--xs--flex"
320
+ }),
321
+ { isSeparator: !0 },
322
+ l({
323
+ name: "Remove from play queue",
324
+ icon: /* @__PURE__ */ j(y, { type: E }),
325
+ onClick: t.removeFromPlayQueue,
326
+ disabled: !t.canRemoveFromPlayQueue
327
+ })
328
+ ]
329
+ }, {
330
+ id: 1,
331
+ title: "Speed",
332
+ items: [
333
+ .25,
334
+ .5,
335
+ .75,
336
+ 1,
337
+ 1.25,
338
+ 1.5,
339
+ 1.75,
340
+ 2
341
+ ].map((e) => l({
342
+ name: e.toString(),
343
+ onClick: () => r.setPlaybackRate(e),
344
+ icon: e === i ? "check" : "empty",
345
+ disabled: !t.controller.supports("setPlaybackRate")
346
+ }))
347
+ }], [
348
+ t,
349
+ l,
350
+ s,
351
+ r,
352
+ i
353
+ ])
354
+ });
355
+ }), mt = t(({ button: e, isOpen: t, closePopover: n }) => /* @__PURE__ */ j(x, {
356
+ button: e,
357
+ isOpen: t,
358
+ closePopover: n,
359
+ panelPaddingSize: "none",
360
+ anchorPosition: "upRight",
361
+ children: /* @__PURE__ */ j(pt, { closePopover: n })
362
+ })), ht = t(() => {
363
+ let [e, t] = c(!1);
364
+ return /* @__PURE__ */ j(mt, {
365
+ button: /* @__PURE__ */ j(f, {
366
+ title: "More options",
367
+ "aria-label": "More options",
368
+ iconType: D,
369
+ size: "s",
370
+ iconSize: "l",
371
+ onClick: () => t(!e)
372
+ }),
373
+ isOpen: e,
374
+ closePopover: () => t(!1)
375
+ });
376
+ }), gt = t(({ onClickPlayQueueButton: e }) => /* @__PURE__ */ M(h, {
377
+ responsive: !1,
378
+ gutterSize: "s",
379
+ justifyContent: "flexEnd",
380
+ alignItems: "center",
381
+ children: [
382
+ /* @__PURE__ */ j(dt, {}),
383
+ e && /* @__PURE__ */ j(ft, { onClickPlayQueueButton: e }),
384
+ /* @__PURE__ */ j(ht, {})
385
+ ]
386
+ })), _t = k(() => {
387
+ let e = V(), t = N(), r = n((t) => {
388
+ let n = Number(t.currentTarget.value) / 100;
389
+ e.setPercent(n);
390
+ }, [e]), i = n((t) => {
391
+ t.button === 0 && e.setSeeking(!0);
392
+ }, [e]), a = n(async (n) => {
393
+ if (n.button === 0) {
394
+ let r = Number(n.currentTarget.value) / 100;
395
+ e.setSeeking(!1);
396
+ let i = await t.getDuration();
397
+ i !== void 0 && await t.setCurrentTime(i * r);
398
+ }
399
+ }, [e, t]);
400
+ return /* @__PURE__ */ j(ue, {
401
+ min: 0,
402
+ max: 100,
403
+ step: 1e-7,
404
+ value: e.percent * 100,
405
+ onChange: r,
406
+ onMouseDown: i,
407
+ onMouseUp: a,
408
+ fullWidth: !0,
409
+ showRange: !0,
410
+ css: { blockSize: 32 },
411
+ disabled: !e.canSeek
412
+ });
413
+ }), vt = k(({ onClickPlayQueueButton: e }) => /* @__PURE__ */ j(l, {
414
+ paddingSize: "s",
415
+ children: /* @__PURE__ */ M(h, {
416
+ direction: "column",
417
+ gutterSize: "none",
418
+ children: [/* @__PURE__ */ j(g, { children: /* @__PURE__ */ j(_t, {}) }), /* @__PURE__ */ j(g, { children: /* @__PURE__ */ M(h, {
419
+ responsive: !1,
420
+ children: [
421
+ /* @__PURE__ */ j(g, {
422
+ css: { width: "calc(100% / 3)" },
423
+ children: /* @__PURE__ */ j(ct, {})
424
+ }),
425
+ /* @__PURE__ */ j(g, {
426
+ css: { width: "calc(100% / 3)" },
427
+ children: /* @__PURE__ */ j(it, {})
428
+ }),
429
+ /* @__PURE__ */ j(g, {
430
+ css: { width: "calc(100% / 3)" },
431
+ children: /* @__PURE__ */ j(gt, { onClickPlayQueueButton: e })
432
+ })
433
+ ]
434
+ }) })]
435
+ })
436
+ })), yt = e(void 0), U = () => r(yt), bt = 81, xt = {
437
+ width: 400,
438
+ height: 225
439
+ }, St = k(({ children: e }) => /* @__PURE__ */ M(b, {
440
+ panelled: !0,
441
+ style: { minBlockSize: "max(460px, 100vh - 81px)" },
442
+ children: [e, !U().isEmpty && /* @__PURE__ */ j(fe, { style: { blockSize: xt.height } })]
443
+ })), Ct = e(void 0), wt = () => r(Ct), Tt = k(() => {
444
+ let e = wt(), t = o(() => ({
445
+ onLoaded: e.onLoaded,
446
+ onPlay: e.onPlay,
447
+ onPause: e.onPause,
448
+ onEnded: e.onEnded,
449
+ onTimeUpdate: e.onTimeUpdate
450
+ }), [e]);
451
+ return /* @__PURE__ */ j("div", {
452
+ css: {
453
+ position: "fixed",
454
+ right: 0,
455
+ bottom: 81,
456
+ width: xt.width,
457
+ height: xt.height,
458
+ zIndex: 998,
459
+ backgroundColor: "rgb(39, 39, 39)",
460
+ display: "flex",
461
+ flexDirection: "column"
462
+ },
463
+ children: /* @__PURE__ */ j("div", {
464
+ css: {
465
+ flexGrow: 1,
466
+ backgroundColor: "black"
467
+ },
468
+ children: e.currentItem && /* @__PURE__ */ j(ze, {
469
+ src: e.currentItem.url,
470
+ options: t,
471
+ onControllerChange: e.onControllerChange
472
+ })
473
+ })
474
+ });
475
+ });
476
+ //#endregion
477
+ //#region src/features/media-player/helpers/isNoembedResult.ts
478
+ function Et(e) {
479
+ return typeof e == "object" && !!e && "title" in e && typeof e.title == "string";
830
480
  }
831
- var Ut = function(e, n, i) {
832
- var a = e.key + "-" + n.name;
833
- // we only need to add the styles to the registered cache if the
834
- // class name could be used further down
835
- // the tree but if it's a string tag, we know it won't
836
- // so we don't have to add it to registered cache.
837
- // this improves memory usage since we can avoid storing the whole style string
838
- (i === !1 || // we need to always store it if we're in compat mode and
839
- // in node since emotion-server relies on whether a style is in
840
- // the registered cache to know whether a style is global or not
841
- // also, note that this check will be dead code eliminated in the browser
842
- Cn === !1) && e.registered[a] === void 0 && (e.registered[a] = n.styles);
843
- }, In = function(e, n, i) {
844
- Ut(e, n, i);
845
- var a = e.key + "-" + n.name;
846
- if (e.inserted[n.name] === void 0) {
847
- var l = n;
848
- do
849
- e.insert(n === l ? "." + a : "", l, e.sheet, !0), l = l.next;
850
- while (l !== void 0);
851
- }
481
+ //#endregion
482
+ //#region src/features/media-player/components/AddVideoModal.tsx
483
+ var Dt = P.create(({ remove: e, resolve: t }) => {
484
+ let n = ye({ prefix: "modalForm" }), [r, i] = c(""), [a, o] = c(""), [s, l] = c(!1);
485
+ return /* @__PURE__ */ M(ae, {
486
+ onClose: e,
487
+ initialFocus: "[name=url]",
488
+ children: [
489
+ /* @__PURE__ */ j(ce, { children: /* @__PURE__ */ j(le, { children: "Add video" }) }),
490
+ /* @__PURE__ */ j(oe, { children: /* @__PURE__ */ M(re, {
491
+ id: n,
492
+ component: "form",
493
+ onSubmit: async (n) => {
494
+ n.preventDefault();
495
+ try {
496
+ l(!0);
497
+ let n = He(r);
498
+ if (n === void 0) return;
499
+ let i = n.extractVideoId(r);
500
+ if (i === void 0) return;
501
+ let o = await (await fetch(`https://noembed.com/embed?url=${encodeURIComponent(r)}`)).json();
502
+ t({
503
+ url: r,
504
+ type: n.type,
505
+ videoId: i,
506
+ title: a || (Et(o) ? o.title : i)
507
+ }), e();
508
+ } finally {
509
+ l(!1);
510
+ }
511
+ },
512
+ children: [/* @__PURE__ */ j(_, {
513
+ label: "URL",
514
+ children: /* @__PURE__ */ j(ne, {
515
+ name: "url",
516
+ value: r,
517
+ onChange: (e) => i(e.target.value)
518
+ })
519
+ }), /* @__PURE__ */ j(_, {
520
+ label: "Title",
521
+ children: /* @__PURE__ */ j(ne, {
522
+ name: "title",
523
+ value: a,
524
+ onChange: (e) => o(e.target.value)
525
+ })
526
+ })]
527
+ }) }),
528
+ /* @__PURE__ */ M(se, { children: [/* @__PURE__ */ j(d, {
529
+ onClick: e,
530
+ children: "Cancel"
531
+ }), /* @__PURE__ */ j(u, {
532
+ type: "submit",
533
+ form: n,
534
+ fill: !0,
535
+ disabled: r.trim().length === 0,
536
+ isLoading: s,
537
+ children: "Add video"
538
+ })] })
539
+ ]
540
+ });
541
+ }), Ot = t(({ onFulfilled: e }) => /* @__PURE__ */ j(u, {
542
+ onClick: () => P.show(Dt).then(e),
543
+ iconType: T,
544
+ color: "primary",
545
+ children: "Add video"
546
+ })), kt = k(({ playQueue: e }) => /* @__PURE__ */ j(u, {
547
+ iconType: T,
548
+ onClick: e.addSelectedItems,
549
+ disabled: !e.canAddSelectedItems,
550
+ children: "Add to play queue"
551
+ })), At = k(({ playQueue: e, closePopover: t }) => {
552
+ let r = n(({ name: e, icon: n, disabled: r, onClick: i }) => ({
553
+ name: e,
554
+ icon: n,
555
+ disabled: r,
556
+ onClick: async (e) => {
557
+ t(), i(e);
558
+ }
559
+ }), [t]);
560
+ return /* @__PURE__ */ j(m, {
561
+ initialPanelId: 0,
562
+ panels: o(() => [{
563
+ id: 0,
564
+ items: [
565
+ r({
566
+ name: "Play next",
567
+ icon: /* @__PURE__ */ j(y, { type: "" }),
568
+ disabled: !e.canPlaySelectedItemsNext,
569
+ onClick: e.playSelectedItemsNext
570
+ }),
571
+ r({
572
+ name: "Add to play queue",
573
+ icon: /* @__PURE__ */ j(y, { type: T }),
574
+ onClick: e.addSelectedItems,
575
+ disabled: !e.canAddSelectedItems
576
+ }),
577
+ r({
578
+ name: "Remove",
579
+ icon: /* @__PURE__ */ j(y, { type: E }),
580
+ onClick: e.removeSelectedItems,
581
+ disabled: !e.canRemoveSelectedItems
582
+ }),
583
+ r({
584
+ name: "Clear",
585
+ icon: /* @__PURE__ */ j(y, { type: De }),
586
+ onClick: e.clear,
587
+ disabled: !e.canClear
588
+ })
589
+ ]
590
+ }], [r, e])
591
+ });
592
+ }), jt = t(({ playQueue: e }) => {
593
+ let [t, r] = c(!1), i = n(() => r(!t), [t]), a = n(() => r(!1), []);
594
+ return /* @__PURE__ */ j(x, {
595
+ button: /* @__PURE__ */ j(f, {
596
+ display: "base",
597
+ size: "m",
598
+ iconType: D,
599
+ onClick: i
600
+ }),
601
+ isOpen: t,
602
+ closePopover: a,
603
+ panelPaddingSize: "none",
604
+ anchorPosition: "downLeft",
605
+ children: /* @__PURE__ */ j(At, {
606
+ playQueue: e,
607
+ closePopover: a
608
+ })
609
+ });
610
+ }), Mt = k(({ playQueue: e }) => {
611
+ let { euiTheme: t } = w();
612
+ return /* @__PURE__ */ M(h, {
613
+ alignItems: "center",
614
+ gutterSize: "m",
615
+ responsive: !1,
616
+ style: {
617
+ position: "sticky",
618
+ top: 48,
619
+ zIndex: 998,
620
+ background: t.colors.backgroundBasePlain
621
+ },
622
+ children: [
623
+ /* @__PURE__ */ M(v, {
624
+ sizes: ["xs"],
625
+ children: [
626
+ /* @__PURE__ */ j(g, {
627
+ grow: !1,
628
+ children: /* @__PURE__ */ j(u, {
629
+ disabled: !e.canPlaySelectedItemsNext,
630
+ onClick: e.playSelectedItemsNext,
631
+ children: "Play next"
632
+ })
633
+ }),
634
+ /* @__PURE__ */ j(g, {
635
+ grow: !1,
636
+ children: /* @__PURE__ */ j(kt, { playQueue: e })
637
+ }),
638
+ /* @__PURE__ */ j(g, {
639
+ grow: !1,
640
+ children: /* @__PURE__ */ j(u, {
641
+ iconType: E,
642
+ onClick: e.removeSelectedItems,
643
+ disabled: !e.canRemoveSelectedItems,
644
+ children: "Remove"
645
+ })
646
+ }),
647
+ /* @__PURE__ */ j(g, {
648
+ grow: !1,
649
+ children: /* @__PURE__ */ j(u, {
650
+ iconType: De,
651
+ onClick: e.clear,
652
+ disabled: !e.canClear,
653
+ children: "Clear"
654
+ })
655
+ })
656
+ ]
657
+ }),
658
+ /* @__PURE__ */ j(de, {
659
+ sizes: ["xs"],
660
+ children: /* @__PURE__ */ j(jt, { playQueue: e })
661
+ }),
662
+ /* @__PURE__ */ j(g, { grow: !0 }),
663
+ /* @__PURE__ */ j(g, {
664
+ grow: !1,
665
+ children: /* @__PURE__ */ j(Ot, { onFulfilled: e.addItemFromDto })
666
+ })
667
+ ]
668
+ });
669
+ }), Nt = k(({ playQueue: e }) => {
670
+ let { euiTheme: t } = w();
671
+ return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(ge, { children: /* @__PURE__ */ j(h, {
672
+ responsive: !1,
673
+ justifyContent: "spaceBetween",
674
+ alignItems: "baseline",
675
+ children: /* @__PURE__ */ j(g, {
676
+ grow: !1,
677
+ children: /* @__PURE__ */ j(p, {
678
+ id: "",
679
+ checked: e.allItemsSelected,
680
+ onChange: (t) => {
681
+ t.target.checked ? e.selectAll() : e.unselectAll();
682
+ }
683
+ })
684
+ })
685
+ }) }), /* @__PURE__ */ M(me, {
686
+ style: {
687
+ position: "sticky",
688
+ top: 112,
689
+ zIndex: 998,
690
+ background: t.colors.backgroundBasePlain
691
+ },
692
+ children: [
693
+ /* @__PURE__ */ j(he, { children: /* @__PURE__ */ j(p, {
694
+ id: "",
695
+ checked: e.allItemsSelected,
696
+ onChange: (t) => {
697
+ t.target.checked ? e.selectAll() : e.unselectAll();
698
+ }
699
+ }) }),
700
+ /* @__PURE__ */ j(S, { width: 24 }),
701
+ /* @__PURE__ */ j(S, { children: "Title" }),
702
+ /* @__PURE__ */ j(S, {})
703
+ ]
704
+ })] });
705
+ }), Pt = k(({ item: e, closePopover: t }) => {
706
+ let r = n(({ name: e, icon: n, disabled: r, onClick: i, className: a }) => ({
707
+ name: e,
708
+ icon: n,
709
+ disabled: r,
710
+ onClick: async (e) => {
711
+ t(), i(e);
712
+ },
713
+ className: a
714
+ }), [t]);
715
+ return /* @__PURE__ */ j(m, {
716
+ initialPanelId: 0,
717
+ panels: o(() => [{
718
+ id: 0,
719
+ items: [
720
+ r({
721
+ name: "Play",
722
+ icon: /* @__PURE__ */ j(y, { type: O }),
723
+ onClick: e.play,
724
+ className: "eui-showFor--xs--flex"
725
+ }),
726
+ r({
727
+ name: "Play first",
728
+ icon: /* @__PURE__ */ j(y, { type: "" }),
729
+ onClick: e.playFirst
730
+ }),
731
+ r({
732
+ name: "Play next",
733
+ icon: /* @__PURE__ */ j(y, { type: "" }),
734
+ onClick: e.playNext
735
+ }),
736
+ r({
737
+ name: "Add to play queue",
738
+ icon: /* @__PURE__ */ j(y, { type: T }),
739
+ onClick: e.addToPlayQueue
740
+ }),
741
+ { isSeparator: !0 },
742
+ r({
743
+ name: "Move to the top",
744
+ icon: /* @__PURE__ */ j(y, { type: Ee }),
745
+ onClick: e.moveToTop,
746
+ disabled: !e.canMoveToTop
747
+ }),
748
+ r({
749
+ name: "Move to the bottom",
750
+ icon: /* @__PURE__ */ j(y, { type: be }),
751
+ onClick: e.moveToBottom,
752
+ disabled: !e.canMoveToBottom
753
+ }),
754
+ { isSeparator: !0 },
755
+ r({
756
+ name: "Remove",
757
+ icon: /* @__PURE__ */ j(y, { type: E }),
758
+ onClick: e.remove,
759
+ className: "eui-showFor--xs--flex"
760
+ }),
761
+ r({
762
+ name: "Remove to the top",
763
+ icon: /* @__PURE__ */ j(y, { type: "" }),
764
+ onClick: e.removeToTop,
765
+ disabled: !e.canRemoveToTop
766
+ }),
767
+ r({
768
+ name: "Remove others",
769
+ icon: /* @__PURE__ */ j(y, { type: "" }),
770
+ onClick: e.removeOthers,
771
+ disabled: !e.canRemoveOthers
772
+ })
773
+ ]
774
+ }], [r, e])
775
+ });
776
+ }), Ft = t(({ item: e }) => {
777
+ let [t, r] = c(!1), i = n(() => r(!t), [t]), a = n(() => r(!1), []);
778
+ return /* @__PURE__ */ j(x, {
779
+ button: /* @__PURE__ */ j(f, {
780
+ title: "More options",
781
+ "aria-label": "More options",
782
+ iconType: D,
783
+ size: "s",
784
+ color: "text",
785
+ onClick: i
786
+ }),
787
+ isOpen: t,
788
+ closePopover: a,
789
+ panelPaddingSize: "none",
790
+ anchorPosition: "leftCenter",
791
+ children: /* @__PURE__ */ j(Pt, {
792
+ item: e,
793
+ closePopover: a
794
+ })
795
+ });
796
+ }), It = k(({ item: e }) => {
797
+ let t = N();
798
+ return /* @__PURE__ */ M(C, {
799
+ textOnly: !1,
800
+ hasActions: !0,
801
+ align: "right",
802
+ children: [/* @__PURE__ */ M(v, {
803
+ sizes: ["xs"],
804
+ children: [/* @__PURE__ */ j(u, {
805
+ iconType: O,
806
+ size: "s",
807
+ onClick: async () => {
808
+ e.isCurrent ? await t.setCurrentTime(0) : await e.play();
809
+ },
810
+ children: "Play"
811
+ }), /* @__PURE__ */ j(u, {
812
+ iconType: E,
813
+ size: "s",
814
+ onClick: e.remove,
815
+ children: "Remove"
816
+ })]
817
+ }), /* @__PURE__ */ j(Ft, { item: e })]
818
+ });
819
+ }), Lt = k(({ item: e }) => {
820
+ let t = s(null), { isCurrent: n } = e;
821
+ return i(() => {
822
+ n && t.current?.closest("tr")?.scrollIntoView({
823
+ behavior: "smooth",
824
+ block: "center"
825
+ });
826
+ }, [n]), /* @__PURE__ */ M(_e, {
827
+ isSelected: e.isCurrent,
828
+ hasSelection: !0,
829
+ hasActions: !0,
830
+ children: [
831
+ /* @__PURE__ */ j(ve, { children: /* @__PURE__ */ j(p, {
832
+ id: e.id.toString(),
833
+ checked: e.isSelected,
834
+ onChange: e.toggleSelected
835
+ }) }),
836
+ /* @__PURE__ */ j(C, {
837
+ textOnly: !1,
838
+ children: /* @__PURE__ */ j("img", {
839
+ ref: t,
840
+ src: at.get(e.type),
841
+ width: 16,
842
+ height: 16,
843
+ alt: e.type
844
+ })
845
+ }),
846
+ /* @__PURE__ */ j(C, {
847
+ mobileOptions: {
848
+ header: !1,
849
+ enlarge: !0,
850
+ width: "100%"
851
+ },
852
+ children: /* @__PURE__ */ j(ie, {
853
+ href: e.url,
854
+ target: "_blank",
855
+ external: !0,
856
+ children: e.title
857
+ })
858
+ }),
859
+ /* @__PURE__ */ j(It, { item: e })
860
+ ]
861
+ });
862
+ }), Rt = k(({ playQueue: e }) => /* @__PURE__ */ j(We, {
863
+ tag: "tbody",
864
+ list: e.items,
865
+ setList: (t) => e.setItems(t),
866
+ children: e.items.map((e) => /* @__PURE__ */ j(Lt, { item: e }, e.id))
867
+ })), zt = k(({ playQueue: e }) => /* @__PURE__ */ M(pe, { children: [/* @__PURE__ */ j(Nt, { playQueue: e }), /* @__PURE__ */ j(Rt, { playQueue: e })] })), Bt = k(({ playQueue: e }) => {
868
+ let { euiTheme: t } = w();
869
+ return /* @__PURE__ */ M(b.Section, { children: [
870
+ /* @__PURE__ */ j(Mt, { playQueue: e }),
871
+ /* @__PURE__ */ j(fe, {
872
+ size: "l",
873
+ style: {
874
+ position: "sticky",
875
+ top: 88,
876
+ zIndex: 998,
877
+ background: t.colors.backgroundBasePlain
878
+ }
879
+ }),
880
+ e.isEmpty ? /* @__PURE__ */ j(te, {
881
+ title: /* @__PURE__ */ j("h2", { children: "We couldn't find any videos" }),
882
+ body: /* @__PURE__ */ j("p", { children: "Your video library doesn't contain any video content." }),
883
+ actions: /* @__PURE__ */ j(Ot, { onFulfilled: e.addItemFromDto })
884
+ }) : /* @__PURE__ */ j(zt, { playQueue: e })
885
+ ] });
886
+ }), Vt = e(void 0), Ht = () => r(Vt), Ut = ({ breadcrumbs: e, tabs: t, ...n }) => {
887
+ let r = Ge();
888
+ return /* @__PURE__ */ j(b.Header, {
889
+ ...n,
890
+ breadcrumbs: e?.map(({ linkProps: e, ...t }) => ({
891
+ ...t,
892
+ href: e === void 0 ? void 0 : r.buildLocation(e).href,
893
+ onClick: e === void 0 ? void 0 : async (t) => {
894
+ t.preventDefault(), await r.navigate(e);
895
+ }
896
+ })),
897
+ tabs: t?.map(({ linkProps: e, ...t }) => ({
898
+ ...t,
899
+ href: e === void 0 ? void 0 : r.buildLocation(e).href,
900
+ onClick: e === void 0 ? void 0 : async (t) => {
901
+ t.preventDefault(), await r.navigate(e);
902
+ }
903
+ }))
904
+ });
905
+ }, Wt = () => {
906
+ let e = U();
907
+ return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(Ut, {
908
+ pageTitle: "Play queue",
909
+ rightSideItems: []
910
+ }), /* @__PURE__ */ j(Bt, { playQueue: e })] });
911
+ }, Gt = P.create(({ remove: e, resolve: t, playlistListItem: r }) => {
912
+ let [i, a] = c(!1);
913
+ return /* @__PURE__ */ j(ee, {
914
+ title: "Delete playlist permanently?",
915
+ onCancel: e,
916
+ onConfirm: n(async () => {
917
+ try {
918
+ a(!0), t(), e();
919
+ } finally {
920
+ a(!1);
921
+ }
922
+ }, [t, e]),
923
+ cancelButtonText: "Cancel",
924
+ confirmButtonText: "Delete",
925
+ buttonColor: "danger",
926
+ isLoading: i,
927
+ children: /* @__PURE__ */ M("p", { children: [
928
+ "Are you sure you want to delete this playlist? If you delete '",
929
+ r.name,
930
+ "', you won't be able to recover it."
931
+ ] })
932
+ });
933
+ }), Kt = k(({ playlist: e }) => /* @__PURE__ */ j(u, {
934
+ iconType: T,
935
+ onClick: e.addSelectedItems,
936
+ disabled: !e.canAddSelectedItems,
937
+ children: "Add to play queue"
938
+ })), qt = k(({ playlist: e, closePopover: t }) => {
939
+ let r = n(({ name: e, icon: n, disabled: r, onClick: i }) => ({
940
+ name: e,
941
+ icon: n,
942
+ disabled: r,
943
+ onClick: async (e) => {
944
+ t(), i(e);
945
+ }
946
+ }), [t]);
947
+ return /* @__PURE__ */ j(m, {
948
+ initialPanelId: 0,
949
+ panels: o(() => [{
950
+ id: 0,
951
+ items: [
952
+ r({
953
+ name: "Play next",
954
+ icon: /* @__PURE__ */ j(y, { type: "" }),
955
+ disabled: !e.canPlaySelectedItemsNext,
956
+ onClick: e.playSelectedItemsNext
957
+ }),
958
+ r({
959
+ name: "Add to play queue",
960
+ icon: /* @__PURE__ */ j(y, { type: T }),
961
+ onClick: e.addSelectedItems,
962
+ disabled: !e.canAddSelectedItems
963
+ }),
964
+ r({
965
+ name: "Remove",
966
+ icon: /* @__PURE__ */ j(y, { type: E }),
967
+ onClick: e.removeSelectedItems,
968
+ disabled: !e.canRemoveSelectedItems
969
+ })
970
+ ]
971
+ }], [r, e])
972
+ });
973
+ }), Jt = t(({ playlist: e }) => {
974
+ let [t, r] = c(!1), i = n(() => r(!t), [t]), a = n(() => r(!1), []);
975
+ return /* @__PURE__ */ j(x, {
976
+ button: /* @__PURE__ */ j(f, {
977
+ display: "base",
978
+ size: "m",
979
+ iconType: D,
980
+ onClick: i
981
+ }),
982
+ isOpen: t,
983
+ closePopover: a,
984
+ panelPaddingSize: "none",
985
+ anchorPosition: "downLeft",
986
+ children: /* @__PURE__ */ j(qt, {
987
+ playlist: e,
988
+ closePopover: a
989
+ })
990
+ });
991
+ }), Yt = k(({ playlist: e }) => {
992
+ let { euiTheme: t } = w();
993
+ return /* @__PURE__ */ M(h, {
994
+ alignItems: "center",
995
+ gutterSize: "m",
996
+ responsive: !1,
997
+ style: {
998
+ position: "sticky",
999
+ top: 48,
1000
+ zIndex: 998,
1001
+ background: t.colors.backgroundBasePlain
1002
+ },
1003
+ children: [
1004
+ /* @__PURE__ */ M(v, {
1005
+ sizes: ["xs"],
1006
+ children: [
1007
+ /* @__PURE__ */ j(g, {
1008
+ grow: !1,
1009
+ children: /* @__PURE__ */ j(u, {
1010
+ disabled: !e.canPlaySelectedItemsNext,
1011
+ onClick: e.playSelectedItemsNext,
1012
+ children: "Play next"
1013
+ })
1014
+ }),
1015
+ /* @__PURE__ */ j(g, {
1016
+ grow: !1,
1017
+ children: /* @__PURE__ */ j(Kt, { playlist: e })
1018
+ }),
1019
+ /* @__PURE__ */ j(g, {
1020
+ grow: !1,
1021
+ children: /* @__PURE__ */ j(u, {
1022
+ iconType: E,
1023
+ onClick: e.removeSelectedItems,
1024
+ disabled: !e.canRemoveSelectedItems,
1025
+ children: "Remove"
1026
+ })
1027
+ })
1028
+ ]
1029
+ }),
1030
+ /* @__PURE__ */ j(de, {
1031
+ sizes: ["xs"],
1032
+ children: /* @__PURE__ */ j(Jt, { playlist: e })
1033
+ }),
1034
+ /* @__PURE__ */ j(g, { grow: !0 }),
1035
+ /* @__PURE__ */ j(g, {
1036
+ grow: !1,
1037
+ children: /* @__PURE__ */ j(Ot, { onFulfilled: e.addItemFromDto })
1038
+ })
1039
+ ]
1040
+ });
1041
+ }), Xt = k(({ playlist: e }) => /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(ge, { children: /* @__PURE__ */ j(h, {
1042
+ responsive: !1,
1043
+ justifyContent: "spaceBetween",
1044
+ alignItems: "baseline",
1045
+ children: /* @__PURE__ */ j(g, {
1046
+ grow: !1,
1047
+ children: /* @__PURE__ */ j(p, {
1048
+ id: "",
1049
+ checked: e.allItemsSelected,
1050
+ onChange: (t) => {
1051
+ t.target.checked ? e.selectAll() : e.unselectAll();
1052
+ }
1053
+ })
1054
+ })
1055
+ }) }), /* @__PURE__ */ M(me, { children: [
1056
+ /* @__PURE__ */ j(he, { children: /* @__PURE__ */ j(p, {
1057
+ id: "",
1058
+ checked: e.allItemsSelected,
1059
+ onChange: (t) => {
1060
+ t.target.checked ? e.selectAll() : e.unselectAll();
1061
+ }
1062
+ }) }),
1063
+ /* @__PURE__ */ j(S, { width: 24 }),
1064
+ /* @__PURE__ */ j(S, { children: "Title" }),
1065
+ /* @__PURE__ */ j(S, {})
1066
+ ] })] })), Zt = t(({ item: e, closePopover: t }) => {
1067
+ let r = n(({ name: e, icon: n, disabled: r, onClick: i, className: a }) => ({
1068
+ name: e,
1069
+ icon: n,
1070
+ disabled: r,
1071
+ onClick: async (e) => {
1072
+ t(), i(e);
1073
+ },
1074
+ className: a
1075
+ }), [t]);
1076
+ return /* @__PURE__ */ j(m, {
1077
+ initialPanelId: 0,
1078
+ panels: o(() => [{
1079
+ id: 0,
1080
+ items: [
1081
+ r({
1082
+ name: "Play",
1083
+ icon: /* @__PURE__ */ j(y, { type: O }),
1084
+ onClick: e.play,
1085
+ className: "eui-showFor--xs--flex"
1086
+ }),
1087
+ r({
1088
+ name: "Play first",
1089
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1090
+ onClick: e.playFirst
1091
+ }),
1092
+ r({
1093
+ name: "Play next",
1094
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1095
+ onClick: e.playNext
1096
+ }),
1097
+ r({
1098
+ name: "Add to play queue",
1099
+ icon: /* @__PURE__ */ j(y, { type: T }),
1100
+ onClick: e.addToPlayQueue
1101
+ }),
1102
+ { isSeparator: !0 },
1103
+ r({
1104
+ name: "Move to the top",
1105
+ icon: /* @__PURE__ */ j(y, { type: Ee }),
1106
+ onClick: e.moveToTop,
1107
+ disabled: !e.canMoveToTop
1108
+ }),
1109
+ r({
1110
+ name: "Move to the bottom",
1111
+ icon: /* @__PURE__ */ j(y, { type: be }),
1112
+ onClick: e.moveToBottom,
1113
+ disabled: !e.canMoveToBottom
1114
+ }),
1115
+ { isSeparator: !0 },
1116
+ r({
1117
+ name: "Remove",
1118
+ icon: /* @__PURE__ */ j(y, { type: E }),
1119
+ onClick: e.remove,
1120
+ className: "eui-showFor--xs--flex"
1121
+ }),
1122
+ r({
1123
+ name: "Remove to the top",
1124
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1125
+ onClick: e.removeToTop,
1126
+ disabled: !e.canRemoveToTop
1127
+ }),
1128
+ r({
1129
+ name: "Remove others",
1130
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1131
+ onClick: e.removeOthers,
1132
+ disabled: !e.canRemoveOthers
1133
+ })
1134
+ ]
1135
+ }], [r, e])
1136
+ });
1137
+ }), Qt = t(({ item: e }) => {
1138
+ let [t, r] = c(!1), i = n(() => r(!t), [t]), a = n(() => r(!1), []);
1139
+ return /* @__PURE__ */ j(x, {
1140
+ button: /* @__PURE__ */ j(f, {
1141
+ title: "More options",
1142
+ "aria-label": "More options",
1143
+ iconType: D,
1144
+ size: "s",
1145
+ color: "text",
1146
+ onClick: i
1147
+ }),
1148
+ isOpen: t,
1149
+ closePopover: a,
1150
+ panelPaddingSize: "none",
1151
+ anchorPosition: "leftCenter",
1152
+ children: /* @__PURE__ */ j(Zt, {
1153
+ item: e,
1154
+ closePopover: a
1155
+ })
1156
+ });
1157
+ }), $t = k(({ item: e }) => /* @__PURE__ */ M(C, {
1158
+ textOnly: !1,
1159
+ hasActions: !0,
1160
+ align: "right",
1161
+ children: [/* @__PURE__ */ M(v, {
1162
+ sizes: ["xs"],
1163
+ children: [/* @__PURE__ */ j(u, {
1164
+ iconType: O,
1165
+ size: "s",
1166
+ onClick: e.play,
1167
+ children: "Play"
1168
+ }), /* @__PURE__ */ j(u, {
1169
+ iconType: E,
1170
+ size: "s",
1171
+ onClick: e.remove,
1172
+ children: "Remove"
1173
+ })]
1174
+ }), /* @__PURE__ */ j(Qt, { item: e })]
1175
+ })), en = k(({ item: e }) => /* @__PURE__ */ M(_e, {
1176
+ isSelected: e.isCurrent,
1177
+ hasSelection: !0,
1178
+ hasActions: !0,
1179
+ children: [
1180
+ /* @__PURE__ */ j(ve, { children: /* @__PURE__ */ j(p, {
1181
+ id: e.id.toString(),
1182
+ checked: e.isSelected,
1183
+ onChange: e.toggleSelected
1184
+ }) }),
1185
+ /* @__PURE__ */ j(C, {
1186
+ textOnly: !1,
1187
+ children: /* @__PURE__ */ j("img", {
1188
+ src: at.get(e.type),
1189
+ width: 16,
1190
+ height: 16,
1191
+ alt: e.type
1192
+ })
1193
+ }),
1194
+ /* @__PURE__ */ j(C, {
1195
+ mobileOptions: {
1196
+ header: !1,
1197
+ enlarge: !0,
1198
+ width: "100%"
1199
+ },
1200
+ children: /* @__PURE__ */ j(ie, {
1201
+ href: e.url,
1202
+ target: "_blank",
1203
+ external: !0,
1204
+ children: e.title
1205
+ })
1206
+ }),
1207
+ /* @__PURE__ */ j($t, { item: e })
1208
+ ]
1209
+ })), tn = k(({ playlist: e }) => /* @__PURE__ */ j(We, {
1210
+ tag: "tbody",
1211
+ list: e.items,
1212
+ setList: (t) => e.setItems(t),
1213
+ children: e.items.map((e) => /* @__PURE__ */ j(en, { item: e }, e.id))
1214
+ })), nn = k(({ playlist: e }) => /* @__PURE__ */ M(pe, { children: [/* @__PURE__ */ j(Xt, { playlist: e }), /* @__PURE__ */ j(tn, { playlist: e })] })), rn = k(({ playlist: e }) => {
1215
+ let { euiTheme: t } = w();
1216
+ return /* @__PURE__ */ M(b.Section, { children: [
1217
+ /* @__PURE__ */ j(Yt, { playlist: e }),
1218
+ /* @__PURE__ */ j(fe, {
1219
+ size: "l",
1220
+ style: {
1221
+ position: "sticky",
1222
+ top: 88,
1223
+ zIndex: 998,
1224
+ background: t.colors.backgroundBasePlain
1225
+ }
1226
+ }),
1227
+ e.isEmpty ? /* @__PURE__ */ j(A, {}) : /* @__PURE__ */ j(nn, { playlist: e })
1228
+ ] });
1229
+ }), an = P.create(({ remove: e, resolve: t, playlistListItem: n }) => {
1230
+ let r = ye({ prefix: "modalForm" }), [i, a] = c(n.name), [o, s] = c(!1);
1231
+ return /* @__PURE__ */ M(ae, {
1232
+ onClose: e,
1233
+ initialFocus: "[name=name]",
1234
+ children: [
1235
+ /* @__PURE__ */ j(ce, { children: /* @__PURE__ */ j(le, { children: "Rename playlist" }) }),
1236
+ /* @__PURE__ */ j(oe, { children: /* @__PURE__ */ j(re, {
1237
+ id: r,
1238
+ component: "form",
1239
+ onSubmit: async (n) => {
1240
+ n.preventDefault();
1241
+ try {
1242
+ s(!0), t(i), e();
1243
+ } finally {
1244
+ s(!1);
1245
+ }
1246
+ },
1247
+ children: /* @__PURE__ */ j(_, {
1248
+ label: "Name",
1249
+ children: /* @__PURE__ */ j(ne, {
1250
+ name: "name",
1251
+ value: i,
1252
+ onChange: (e) => a(e.target.value)
1253
+ })
1254
+ })
1255
+ }) }),
1256
+ /* @__PURE__ */ M(se, { children: [/* @__PURE__ */ j(d, {
1257
+ onClick: e,
1258
+ children: "Cancel"
1259
+ }), /* @__PURE__ */ j(u, {
1260
+ type: "submit",
1261
+ form: r,
1262
+ fill: !0,
1263
+ disabled: i.trim().length === 0,
1264
+ isLoading: o,
1265
+ children: "Rename"
1266
+ })] })
1267
+ ]
1268
+ });
1269
+ }), on = {
1270
+ type: "object",
1271
+ properties: {
1272
+ url: { type: "string" },
1273
+ type: { type: "string" },
1274
+ videoId: { type: "string" },
1275
+ title: { type: "string" }
1276
+ },
1277
+ required: [
1278
+ "url",
1279
+ "type",
1280
+ "videoId",
1281
+ "title"
1282
+ ]
852
1283
  };
853
- function Rn(t) {
854
- for (var e = 0, n, i = 0, a = t.length; a >= 4; ++i, a -= 4)
855
- n = t.charCodeAt(i) & 255 | (t.charCodeAt(++i) & 255) << 8 | (t.charCodeAt(++i) & 255) << 16 | (t.charCodeAt(++i) & 255) << 24, n = /* Math.imul(k, m): */
856
- (n & 65535) * 1540483477 + ((n >>> 16) * 59797 << 16), n ^= /* k >>> r: */
857
- n >>> 24, e = /* Math.imul(k, m): */
858
- (n & 65535) * 1540483477 + ((n >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
859
- (e & 65535) * 1540483477 + ((e >>> 16) * 59797 << 16);
860
- switch (a) {
861
- case 3:
862
- e ^= (t.charCodeAt(i + 2) & 255) << 16;
863
- case 2:
864
- e ^= (t.charCodeAt(i + 1) & 255) << 8;
865
- case 1:
866
- e ^= t.charCodeAt(i) & 255, e = /* Math.imul(h, m): */
867
- (e & 65535) * 1540483477 + ((e >>> 16) * 59797 << 16);
868
- }
869
- return e ^= e >>> 13, e = /* Math.imul(h, m): */
870
- (e & 65535) * 1540483477 + ((e >>> 16) * 59797 << 16), ((e ^ e >>> 15) >>> 0).toString(36);
1284
+ //#endregion
1285
+ //#region \0@oxc-project+runtime@0.130.0/helpers/decorate.js
1286
+ function W(e, t, n, r) {
1287
+ var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
1288
+ if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
1289
+ else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
1290
+ return i > 3 && a && Object.defineProperty(t, n, a), a;
871
1291
  }
872
- var Pn = {
873
- animationIterationCount: 1,
874
- aspectRatio: 1,
875
- borderImageOutset: 1,
876
- borderImageSlice: 1,
877
- borderImageWidth: 1,
878
- boxFlex: 1,
879
- boxFlexGroup: 1,
880
- boxOrdinalGroup: 1,
881
- columnCount: 1,
882
- columns: 1,
883
- flex: 1,
884
- flexGrow: 1,
885
- flexPositive: 1,
886
- flexShrink: 1,
887
- flexNegative: 1,
888
- flexOrder: 1,
889
- gridRow: 1,
890
- gridRowEnd: 1,
891
- gridRowSpan: 1,
892
- gridRowStart: 1,
893
- gridColumn: 1,
894
- gridColumnEnd: 1,
895
- gridColumnSpan: 1,
896
- gridColumnStart: 1,
897
- msGridRow: 1,
898
- msGridRowSpan: 1,
899
- msGridColumn: 1,
900
- msGridColumnSpan: 1,
901
- fontWeight: 1,
902
- lineHeight: 1,
903
- opacity: 1,
904
- order: 1,
905
- orphans: 1,
906
- scale: 1,
907
- tabSize: 1,
908
- widows: 1,
909
- zIndex: 1,
910
- zoom: 1,
911
- WebkitLineClamp: 1,
912
- // SVG-related properties
913
- fillOpacity: 1,
914
- floodOpacity: 1,
915
- stopOpacity: 1,
916
- strokeDasharray: 1,
917
- strokeDashoffset: 1,
918
- strokeMiterlimit: 1,
919
- strokeOpacity: 1,
920
- strokeWidth: 1
1292
+ //#endregion
1293
+ //#region src/features/media-player/stores/PlaylistItemStore.ts
1294
+ var G = class e {
1295
+ playQueue;
1296
+ playlist;
1297
+ dto;
1298
+ static nextId = 1;
1299
+ id;
1300
+ isSelected = !1;
1301
+ constructor(t, n, r) {
1302
+ this.playQueue = t, this.playlist = n, this.dto = r, L(this), this.id = e.nextId++;
1303
+ }
1304
+ static fromDto(t, n, r) {
1305
+ return new e(t, n, r);
1306
+ }
1307
+ get url() {
1308
+ return this.dto.url;
1309
+ }
1310
+ get type() {
1311
+ return this.dto.type;
1312
+ }
1313
+ get videoId() {
1314
+ return this.dto.videoId;
1315
+ }
1316
+ get title() {
1317
+ return this.dto.title;
1318
+ }
1319
+ get isCurrent() {
1320
+ return !1;
1321
+ }
1322
+ get index() {
1323
+ return this.playlist.items.indexOf(this);
1324
+ }
1325
+ get isFirst() {
1326
+ return this.index === 0;
1327
+ }
1328
+ get isLast() {
1329
+ return this.index === this.playlist.items.length - 1;
1330
+ }
1331
+ get canMoveToTop() {
1332
+ return !this.isFirst;
1333
+ }
1334
+ get canMoveToBottom() {
1335
+ return !this.isLast;
1336
+ }
1337
+ get canRemoveToTop() {
1338
+ return !this.isFirst;
1339
+ }
1340
+ get canRemoveOthers() {
1341
+ return this.playlist.hasMultipleItems;
1342
+ }
1343
+ unselect() {
1344
+ this.isSelected = !1;
1345
+ }
1346
+ select() {
1347
+ this.isSelected = !0;
1348
+ }
1349
+ toggleSelected() {
1350
+ this.isSelected = !this.isSelected;
1351
+ }
1352
+ play() {
1353
+ return this.playQueue.clearAndSetItems([this.playQueue.createItemFromDto(this.dto)]), Promise.resolve();
1354
+ }
1355
+ remove() {
1356
+ return this.playlist.removeItems([this]);
1357
+ }
1358
+ playFirst() {
1359
+ return this.playQueue.playFirst([this.playQueue.createItemFromDto(this.dto)]);
1360
+ }
1361
+ playNext() {
1362
+ return this.playQueue.playNext([this.playQueue.createItemFromDto(this.dto)]);
1363
+ }
1364
+ addToPlayQueue() {
1365
+ return this.playQueue.addItems([this.playQueue.createItemFromDto(this.dto)]);
1366
+ }
1367
+ moveToTop() {
1368
+ this.playlist.moveItem(this, 0);
1369
+ }
1370
+ moveToBottom() {
1371
+ this.playlist.moveItem(this, this.playlist.items.length - 1);
1372
+ }
1373
+ removeToTop() {
1374
+ return this.playlist.removeItemsAbove(this);
1375
+ }
1376
+ removeOthers() {
1377
+ return this.playlist.removeOtherItems(this);
1378
+ }
921
1379
  };
922
- function wn(t) {
923
- var e = /* @__PURE__ */ Object.create(null);
924
- return function(n) {
925
- return e[n] === void 0 && (e[n] = t(n)), e[n];
926
- };
1380
+ W([R], G.prototype, "isSelected", void 0), W([I], G.prototype, "isCurrent", null), W([I], G.prototype, "index", null), W([I], G.prototype, "isFirst", null), W([I], G.prototype, "isLast", null), W([I], G.prototype, "canMoveToTop", null), W([I], G.prototype, "canMoveToBottom", null), W([I], G.prototype, "canRemoveToTop", null), W([I], G.prototype, "canRemoveOthers", null), W([F.bound], G.prototype, "unselect", null), W([F.bound], G.prototype, "select", null), W([F.bound], G.prototype, "toggleSelected", null), W([F.bound], G.prototype, "play", null), W([F.bound], G.prototype, "remove", null), W([F.bound], G.prototype, "playFirst", null), W([F.bound], G.prototype, "playNext", null), W([F.bound], G.prototype, "addToPlayQueue", null), W([F.bound], G.prototype, "moveToTop", null), W([F.bound], G.prototype, "moveToBottom", null), W([F.bound], G.prototype, "removeToTop", null), W([F.bound], G.prototype, "removeOthers", null);
1381
+ //#endregion
1382
+ //#region src/shared/stores/getOrAddSchema.ts
1383
+ var sn = new qe({ coerceTypes: !0 });
1384
+ function cn(e, t) {
1385
+ let n;
1386
+ if (n = sn.getSchema(t), n === void 0 && (sn.addSchema(e, t), n = sn.getSchema(t)), n === void 0 || n.schema !== e) throw Error(`Invalid schema. Expected: '${JSON.stringify(e)}', but got '${JSON.stringify(n?.schema)}'.`);
1387
+ return n;
927
1388
  }
928
- var _n = /[A-Z]|^ms/g, On = /_EMO_([^_]+?)_([^]*?)_EMO_/g, qt = function(e) {
929
- return e.charCodeAt(1) === 45;
930
- }, At = function(e) {
931
- return e != null && typeof e != "boolean";
932
- }, Ke = /* @__PURE__ */ wn(function(t) {
933
- return qt(t) ? t : t.replace(_n, "-$&").toLowerCase();
934
- }), kt = function(e, n) {
935
- switch (e) {
936
- case "animation":
937
- case "animationName":
938
- if (typeof n == "string")
939
- return n.replace(On, function(i, a, l) {
940
- return J = {
941
- name: a,
942
- styles: l,
943
- next: J
944
- }, a;
945
- });
946
- }
947
- return Pn[e] !== 1 && !qt(e) && typeof n == "number" && n !== 0 ? n + "px" : n;
1389
+ //#endregion
1390
+ //#region src/features/media-player/stores/PlaylistStore.ts
1391
+ var ln = {
1392
+ type: "object",
1393
+ properties: {
1394
+ version: {
1395
+ type: "string",
1396
+ nullable: !0
1397
+ },
1398
+ items: {
1399
+ type: "array",
1400
+ nullable: !0,
1401
+ items: on
1402
+ }
1403
+ }
1404
+ }, un = class {
1405
+ playlist;
1406
+ constructor(e) {
1407
+ this.playlist = e, L(this);
1408
+ }
1409
+ get state() {
1410
+ return {
1411
+ version: "1.0",
1412
+ items: this.playlist.items.map((e) => e.dto)
1413
+ };
1414
+ }
1415
+ set state(e) {
1416
+ this.playlist.items = e.items?.map((e) => this.playlist.createItemFromDto(e)) ?? [];
1417
+ }
1418
+ validateState(e) {
1419
+ return cn(ln, "PlaylistLocalStorageState")(e);
1420
+ }
948
1421
  };
949
- function Ie(t, e, n) {
950
- if (n == null)
951
- return "";
952
- var i = n;
953
- if (i.__emotion_styles !== void 0)
954
- return i;
955
- switch (typeof n) {
956
- case "boolean":
957
- return "";
958
- case "object": {
959
- var a = n;
960
- if (a.anim === 1)
961
- return J = {
962
- name: a.name,
963
- styles: a.styles,
964
- next: J
965
- }, a.name;
966
- var l = n;
967
- if (l.styles !== void 0) {
968
- var f = l.next;
969
- if (f !== void 0)
970
- for (; f !== void 0; )
971
- J = {
972
- name: f.name,
973
- styles: f.styles,
974
- next: J
975
- }, f = f.next;
976
- var m = l.styles + ";";
977
- return m;
978
- }
979
- return An(t, e, n);
980
- }
981
- case "function": {
982
- if (t !== void 0) {
983
- var h = J, p = n(t);
984
- return J = h, Ie(t, e, p);
985
- }
986
- break;
987
- }
988
- }
989
- var C = n;
990
- return C;
991
- }
992
- function An(t, e, n) {
993
- var i = "";
994
- if (Array.isArray(n))
995
- for (var a = 0; a < n.length; a++)
996
- i += Ie(t, e, n[a]) + ";";
997
- else
998
- for (var l in n) {
999
- var f = n[l];
1000
- if (typeof f != "object") {
1001
- var m = f;
1002
- At(m) && (i += Ke(l) + ":" + kt(l, m) + ";");
1003
- } else if (Array.isArray(f) && typeof f[0] == "string" && e == null)
1004
- for (var h = 0; h < f.length; h++)
1005
- At(f[h]) && (i += Ke(l) + ":" + kt(l, f[h]) + ";");
1006
- else {
1007
- var p = Ie(t, e, f);
1008
- switch (l) {
1009
- case "animation":
1010
- case "animationName": {
1011
- i += Ke(l) + ":" + p + ";";
1012
- break;
1013
- }
1014
- default:
1015
- i += l + "{" + p + "}";
1016
- }
1017
- }
1018
- }
1019
- return i;
1020
- }
1021
- var Mt = /label:\s*([^\s;{]+)\s*(;|$)/g, J;
1022
- function kn(t, e, n) {
1023
- if (t.length === 1 && typeof t[0] == "object" && t[0] !== null && t[0].styles !== void 0)
1024
- return t[0];
1025
- var i = !0, a = "";
1026
- J = void 0;
1027
- var l = t[0];
1028
- if (l == null || l.raw === void 0)
1029
- i = !1, a += Ie(n, e, l);
1030
- else {
1031
- var f = l;
1032
- a += f[0];
1033
- }
1034
- for (var m = 1; m < t.length; m++)
1035
- if (a += Ie(n, e, t[m]), i) {
1036
- var h = l;
1037
- a += h[m];
1038
- }
1039
- Mt.lastIndex = 0;
1040
- for (var p = "", C; (C = Mt.exec(a)) !== null; )
1041
- p += "-" + C[1];
1042
- var R = Rn(a) + p;
1043
- return {
1044
- name: R,
1045
- styles: a,
1046
- next: J
1047
- };
1048
- }
1049
- var Mn = function(e) {
1050
- return e();
1051
- }, Fn = Z.useInsertionEffect ? Z.useInsertionEffect : !1, $n = Fn || Mn, Ht = /* @__PURE__ */ Z.createContext(
1052
- // we're doing this to avoid preconstruct's dead code elimination in this one case
1053
- // because this module is primarily intended for the browser and node
1054
- // but it's also required in react native and similar environments sometimes
1055
- // and we could have a special build just for that
1056
- // but this is much easier and the native packages
1057
- // might use a different theme context in the future anyway
1058
- typeof HTMLElement < "u" ? /* @__PURE__ */ Pr({
1059
- key: "css"
1060
- }) : null
1061
- );
1062
- Ht.Provider;
1063
- var jn = function(e) {
1064
- return /* @__PURE__ */ Sr(function(n, i) {
1065
- var a = at(Ht);
1066
- return e(n, a, i);
1067
- });
1068
- }, Nn = /* @__PURE__ */ Z.createContext({}), je = {}.hasOwnProperty, nt = "__EMOTION_TYPE_PLEASE_DO_NOT_USE__", Gt = function(e, n) {
1069
- var i = {};
1070
- for (var a in n)
1071
- je.call(n, a) && (i[a] = n[a]);
1072
- return i[nt] = e, i;
1073
- }, Dn = function(e) {
1074
- var n = e.cache, i = e.serialized, a = e.isStringTag;
1075
- return Ut(n, i, a), $n(function() {
1076
- return In(n, i, a);
1077
- }), null;
1078
- }, zn = /* @__PURE__ */ jn(function(t, e, n) {
1079
- var i = t.css;
1080
- typeof i == "string" && e.registered[i] !== void 0 && (i = e.registered[i]);
1081
- var a = t[nt], l = [i], f = "";
1082
- typeof t.className == "string" ? f = Sn(e.registered, l, t.className) : t.className != null && (f = t.className + " ");
1083
- var m = kn(l, void 0, Z.useContext(Nn));
1084
- f += e.key + "-" + m.name;
1085
- var h = {};
1086
- for (var p in t)
1087
- je.call(t, p) && p !== "css" && p !== nt && (h[p] = t[p]);
1088
- return h.className = f, n && (h.ref = n), /* @__PURE__ */ Z.createElement(Z.Fragment, null, /* @__PURE__ */ Z.createElement(Dn, {
1089
- cache: e,
1090
- serialized: m,
1091
- isStringTag: typeof a == "string"
1092
- }), /* @__PURE__ */ Z.createElement(a, h));
1093
- }), Jt = zn, Re = Se.Fragment, o = function(e, n, i) {
1094
- return je.call(n, "css") ? Se.jsx(Jt, Gt(e, n), i) : Se.jsx(e, n, i);
1095
- }, O = function(e, n, i) {
1096
- return je.call(n, "css") ? Se.jsxs(Jt, Gt(e, n), i) : Se.jsxs(e, n, i);
1097
- }, I = /* @__PURE__ */ ((t) => (t.Off = "Off", t.All = "All", t.One = "One", t))(I || {});
1098
- const Kt = 80, Ln = D(({ playerStore: t }) => {
1099
- const e = te(), n = $(
1100
- (l) => {
1101
- const f = Number(l.currentTarget.value) / 100;
1102
- t.setPercent(f);
1103
- },
1104
- [t]
1105
- ), i = $(
1106
- (l) => {
1107
- l.button === 0 && t.setSeeking(!0);
1108
- },
1109
- [t]
1110
- ), a = $(
1111
- async (l) => {
1112
- if (l.button === 0) {
1113
- const f = Number(l.currentTarget.value) / 100;
1114
- t.setSeeking(!1);
1115
- const m = await e.getDuration();
1116
- m !== void 0 && await e.setCurrentTime(m * f);
1117
- }
1118
- },
1119
- [t, e]
1120
- );
1121
- return /* @__PURE__ */ o(
1122
- Nt,
1123
- {
1124
- min: 0,
1125
- max: 100,
1126
- step: 1e-7,
1127
- value: t.percent * 100,
1128
- onChange: n,
1129
- onMouseDown: i,
1130
- onMouseUp: a,
1131
- fullWidth: !0,
1132
- showRange: !0,
1133
- css: { blockSize: 32 }
1134
- }
1135
- );
1136
- }), Vn = K(
1137
- ({ button: t, isOpen: e, closePopover: n }) => {
1138
- const [i, a] = Y("0"), l = te();
1139
- Ir(() => {
1140
- e && l.getVolume().then((m) => {
1141
- m !== void 0 && a(Math.floor(m * 100).toString());
1142
- });
1143
- }, [e, l]);
1144
- const f = $(
1145
- async (m) => {
1146
- a(m.currentTarget.value), await l.setVolume(Number(m.currentTarget.value) / 100);
1147
- },
1148
- [l]
1149
- );
1150
- return /* @__PURE__ */ o(
1151
- st,
1152
- {
1153
- button: t,
1154
- isOpen: e,
1155
- closePopover: n,
1156
- anchorPosition: "upRight",
1157
- children: /* @__PURE__ */ o(Ze, { children: /* @__PURE__ */ O(
1158
- de,
1159
- {
1160
- responsive: !1,
1161
- gutterSize: "s",
1162
- justifyContent: "center",
1163
- alignItems: "center",
1164
- children: [
1165
- /* @__PURE__ */ o(
1166
- G,
1167
- {
1168
- title: "Mute",
1169
- "aria-label": "Mute",
1170
- iconType: Vt,
1171
- size: "s",
1172
- iconSize: "l"
1173
- }
1174
- ),
1175
- /* @__PURE__ */ o(
1176
- Nt,
1177
- {
1178
- min: 0,
1179
- max: 100,
1180
- step: 1,
1181
- value: i,
1182
- onChange: f,
1183
- css: { blockSize: 32 }
1184
- }
1185
- )
1186
- ]
1187
- }
1188
- ) })
1189
- }
1190
- );
1191
- }
1192
- ), Yn = K(
1193
- ({
1194
- playQueueStore: t,
1195
- closePopover: e
1196
- }) => {
1197
- const n = te(), i = $(async () => {
1198
- const p = await n.getCurrentTime();
1199
- p !== void 0 && await n.setCurrentTime(p - 10), e();
1200
- }, [n, e]), a = $(async () => {
1201
- const p = await n.getCurrentTime();
1202
- p !== void 0 && await n.setCurrentTime(p + 30), e();
1203
- }, [n, e]), l = $(
1204
- async (p) => {
1205
- await n.setPlaybackRate(p), e();
1206
- },
1207
- [n, e]
1208
- ), f = $(async () => {
1209
- t.currentItem !== void 0 && await t.removeItems([
1210
- t.currentItem
1211
- ]), e();
1212
- }, [t, e]), [m] = Y(), h = $t(
1213
- () => [
1214
- {
1215
- id: 0,
1216
- items: [
1217
- {
1218
- name: "Speed",
1219
- icon: /* @__PURE__ */ o(W, { type: on, size: "m" }),
1220
- panel: 1
1221
- },
1222
- {
1223
- name: "Skip back 10 seconds",
1224
- icon: /* @__PURE__ */ o(W, { type: an, size: "m" }),
1225
- onClick: i,
1226
- disabled: t.isEmpty
1227
- },
1228
- {
1229
- name: "Skip forward 30 seconds",
1230
- icon: /* @__PURE__ */ o(W, { type: sn, size: "m" }),
1231
- onClick: a,
1232
- disabled: t.isEmpty
1233
- },
1234
- {
1235
- isSeparator: !0
1236
- },
1237
- {
1238
- name: "Remove from play queue",
1239
- icon: /* @__PURE__ */ o(W, { type: lt, size: "m" }),
1240
- onClick: f,
1241
- disabled: t.isEmpty
1242
- }
1243
- ]
1244
- },
1245
- {
1246
- id: 1,
1247
- title: "Speed",
1248
- items: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2].map(
1249
- (p) => ({
1250
- name: p.toString(),
1251
- onClick: () => l(p),
1252
- icon: p === m ? "check" : "empty"
1253
- })
1254
- )
1255
- }
1256
- ],
1257
- [
1258
- t,
1259
- i,
1260
- a,
1261
- f,
1262
- l,
1263
- m
1264
- ]
1265
- );
1266
- return /* @__PURE__ */ o(Ar, { initialPanelId: 0, panels: h });
1267
- }
1268
- ), Bn = K(
1269
- ({
1270
- playQueueStore: t,
1271
- button: e,
1272
- isOpen: n,
1273
- closePopover: i
1274
- }) => /* @__PURE__ */ o(
1275
- st,
1276
- {
1277
- button: e,
1278
- isOpen: n,
1279
- closePopover: i,
1280
- panelPaddingSize: "none",
1281
- anchorPosition: "upRight",
1282
- children: /* @__PURE__ */ o(
1283
- Yn,
1284
- {
1285
- playQueueStore: t,
1286
- closePopover: i
1287
- }
1288
- )
1289
- }
1290
- )
1291
- ), Wn = {
1292
- [I.Off]: Xr,
1293
- [I.All]: Kr,
1294
- [I.One]: Jr
1295
- }, Un = D(
1296
- ({
1297
- playerStore: t,
1298
- playQueueStore: e
1299
- }) => {
1300
- const n = te(), i = $(async () => {
1301
- if (e.hasPreviousItem) {
1302
- const a = await n.getCurrentTime();
1303
- a === void 0 || a < 5 ? await e.previous() : await n.setCurrentTime(0);
1304
- } else
1305
- await n.setCurrentTime(0);
1306
- }, [e, n]);
1307
- return /* @__PURE__ */ O(
1308
- de,
1309
- {
1310
- responsive: !1,
1311
- gutterSize: "s",
1312
- justifyContent: "center",
1313
- alignItems: "center",
1314
- children: [
1315
- /* @__PURE__ */ o(
1316
- G,
1317
- {
1318
- title: `Shuffle: ${e.shuffle ? "On" : "Off"}`,
1319
- "aria-label": `Shuffle: ${e.shuffle ? "On" : "Off"}`,
1320
- iconType: e.shuffle ? Zr : Qr,
1321
- size: "s",
1322
- iconSize: "l",
1323
- onClick: e.toggleShuffle,
1324
- disabled: !0
1325
- }
1326
- ),
1327
- /* @__PURE__ */ o(
1328
- G,
1329
- {
1330
- title: "Previous",
1331
- "aria-label": "Previous",
1332
- iconType: en,
1333
- size: "s",
1334
- iconSize: "l",
1335
- onClick: i,
1336
- disabled: e.isEmpty
1337
- }
1338
- ),
1339
- t.playing ? /* @__PURE__ */ o(
1340
- G,
1341
- {
1342
- title: "Pause",
1343
- "aria-label": "Pause",
1344
- iconType: tn,
1345
- size: "s",
1346
- iconSize: "l",
1347
- onClick: () => n.pause(),
1348
- disabled: !e.canPlay
1349
- }
1350
- ) : /* @__PURE__ */ o(
1351
- G,
1352
- {
1353
- title: "Play",
1354
- "aria-label": "Play",
1355
- iconType: rn,
1356
- size: "s",
1357
- iconSize: "l",
1358
- onClick: () => n.play(),
1359
- disabled: !e.canPlay
1360
- }
1361
- ),
1362
- /* @__PURE__ */ o(
1363
- G,
1364
- {
1365
- title: "Next",
1366
- "aria-label": "Next",
1367
- iconType: nn,
1368
- size: "s",
1369
- iconSize: "l",
1370
- onClick: e.next,
1371
- disabled: !e.hasNextItem
1372
- }
1373
- ),
1374
- /* @__PURE__ */ o(
1375
- G,
1376
- {
1377
- title: `Repeat: ${e.repeat === I.All ? "All" : e.repeat === I.One ? "One" : "Off"}`,
1378
- "aria-label": `Repeat: ${e.repeat === I.All ? "All" : e.repeat === I.One ? "One" : "Off"}`,
1379
- iconType: Wn[e.repeat],
1380
- size: "s",
1381
- iconSize: "l",
1382
- onClick: e.toggleRepeat
1383
- }
1384
- )
1385
- ]
1386
- }
1387
- );
1388
- }
1389
- ), qn = K(() => {
1390
- const [t, e] = Y(!1);
1391
- return /* @__PURE__ */ o(
1392
- Vn,
1393
- {
1394
- button: /* @__PURE__ */ o(
1395
- G,
1396
- {
1397
- title: "Volume",
1398
- "aria-label": "Volume",
1399
- iconType: Vt,
1400
- size: "s",
1401
- iconSize: "l",
1402
- onClick: () => e(!t)
1403
- }
1404
- ),
1405
- isOpen: t,
1406
- closePopover: () => e(!1)
1407
- }
1408
- );
1409
- }), Hn = K(
1410
- ({ playQueueStore: t }) => {
1411
- const [e, n] = Y(!1);
1412
- return /* @__PURE__ */ o(
1413
- Bn,
1414
- {
1415
- playQueueStore: t,
1416
- button: /* @__PURE__ */ o(
1417
- G,
1418
- {
1419
- title: "More options",
1420
- "aria-label": "More options",
1421
- iconType: Yt,
1422
- size: "s",
1423
- iconSize: "l",
1424
- onClick: () => n(!e)
1425
- }
1426
- ),
1427
- isOpen: e,
1428
- closePopover: () => n(!1)
1429
- }
1430
- );
1431
- }
1432
- ), Gn = K(
1433
- ({ playQueueStore: t }) => /* @__PURE__ */ O(
1434
- de,
1435
- {
1436
- responsive: !1,
1437
- gutterSize: "s",
1438
- justifyContent: "flexEnd",
1439
- alignItems: "center",
1440
- children: [
1441
- /* @__PURE__ */ o(qn, {}),
1442
- /* @__PURE__ */ o(Hn, { playQueueStore: t })
1443
- ]
1444
- }
1445
- )
1446
- ), Ii = D(
1447
- ({ playerStore: t, playQueueStore: e }) => /* @__PURE__ */ o(Or, { paddingSize: "s", children: /* @__PURE__ */ O(de, { direction: "column", gutterSize: "none", children: [
1448
- /* @__PURE__ */ o(U, { children: /* @__PURE__ */ o(Ln, { playerStore: t }) }),
1449
- /* @__PURE__ */ o(U, { children: /* @__PURE__ */ O(de, { responsive: !1, children: [
1450
- /* @__PURE__ */ o(U, { css: { width: "calc(100% / 3)" } }),
1451
- /* @__PURE__ */ o(U, { css: { width: "calc(100% / 3)" }, children: /* @__PURE__ */ o(
1452
- Un,
1453
- {
1454
- playerStore: t,
1455
- playQueueStore: e
1456
- }
1457
- ) }),
1458
- /* @__PURE__ */ o(U, { css: { width: "calc(100% / 3)" }, children: /* @__PURE__ */ o(
1459
- Gn,
1460
- {
1461
- playQueueStore: e
1462
- }
1463
- ) })
1464
- ] }) })
1465
- ] }) })
1466
- ), Jn = ({
1467
- onCancel: t,
1468
- onSave: e
1469
- }) => {
1470
- const [n, i] = Y(""), [a, l] = Y(""), [f, m] = Y(!1);
1471
- return /* @__PURE__ */ O(Dr, { onClose: t, initialFocus: "[name=url]", children: [
1472
- /* @__PURE__ */ o(Mr, { children: /* @__PURE__ */ o(kr, { children: "Add video" }) }),
1473
- /* @__PURE__ */ o($r, { children: /* @__PURE__ */ O(Fr, { component: "form", children: [
1474
- /* @__PURE__ */ o(Ze, { label: "URL", children: /* @__PURE__ */ o(
1475
- St,
1476
- {
1477
- name: "url",
1478
- value: n,
1479
- onChange: (h) => i(h.target.value)
1480
- }
1481
- ) }),
1482
- /* @__PURE__ */ o(Ze, { label: "Title", children: /* @__PURE__ */ o(
1483
- St,
1484
- {
1485
- name: "title",
1486
- value: a,
1487
- onChange: (h) => l(h.target.value)
1488
- }
1489
- ) })
1490
- ] }) }),
1491
- /* @__PURE__ */ O(jr, { children: [
1492
- /* @__PURE__ */ o(Nr, { onClick: t, children: "Cancel" }),
1493
- /* @__PURE__ */ o(
1494
- ee,
1495
- {
1496
- type: "submit",
1497
- onClick: async () => {
1498
- try {
1499
- m(!0), await e({ url: n, title: a });
1500
- } finally {
1501
- m(!1);
1502
- }
1503
- },
1504
- fill: !0,
1505
- disabled: n.trim().length === 0,
1506
- isLoading: f,
1507
- children: "Save"
1508
- }
1509
- )
1510
- ] })
1511
- ] });
1422
+ W([I.struct], un.prototype, "state", null);
1423
+ var K = class {
1424
+ playQueue;
1425
+ localStorageState;
1426
+ items = [];
1427
+ constructor(e) {
1428
+ this.playQueue = e, L(this), this.localStorageState = new un(this);
1429
+ }
1430
+ createItemFromDto(e) {
1431
+ return G.fromDto(this.playQueue, this, {
1432
+ url: e.url,
1433
+ type: e.type,
1434
+ videoId: e.videoId,
1435
+ title: e.title
1436
+ });
1437
+ }
1438
+ get isEmpty() {
1439
+ return this.items.length === 0;
1440
+ }
1441
+ get hasMultipleItems() {
1442
+ return this.items.length > 1;
1443
+ }
1444
+ get selectedItems() {
1445
+ return this.items.filter((e) => e.isSelected);
1446
+ }
1447
+ get allItemsSelected() {
1448
+ return this.selectedItems.length === this.items.length;
1449
+ }
1450
+ get hasSelectedItems() {
1451
+ return this.selectedItems.length > 0;
1452
+ }
1453
+ get selectedItemsOrAllItems() {
1454
+ return this.hasSelectedItems ? this.selectedItems : this.items;
1455
+ }
1456
+ get canAddSelectedItems() {
1457
+ return !this.isEmpty && this.hasSelectedItems;
1458
+ }
1459
+ get canPlaySelectedItemsNext() {
1460
+ return !this.isEmpty && this.hasSelectedItems;
1461
+ }
1462
+ get canRemoveSelectedItems() {
1463
+ return !this.isEmpty && this.hasSelectedItems;
1464
+ }
1465
+ setItems(e) {
1466
+ this.items = e;
1467
+ }
1468
+ unselectAll() {
1469
+ for (let e of this.items) e.unselect();
1470
+ }
1471
+ selectAll() {
1472
+ for (let e of this.items) e.select();
1473
+ }
1474
+ async playSelectedItemsNext() {
1475
+ await this.playQueue.playNext(this.selectedItemsOrAllItems.map((e) => this.playQueue.createItemFromDto(e.dto))), this.unselectAll();
1476
+ }
1477
+ async addSelectedItems() {
1478
+ await this.playQueue.addItems(this.selectedItemsOrAllItems.map((e) => this.playQueue.createItemFromDto(e.dto))), this.unselectAll();
1479
+ }
1480
+ async addItems(e) {
1481
+ this.items.push(...e);
1482
+ }
1483
+ moveItem(e, t) {
1484
+ let n = this.items.splice(this.items.indexOf(e), 1)[0];
1485
+ this.items.splice(t, 0, n);
1486
+ }
1487
+ async removeItems(e) {
1488
+ z(this.items, ...e);
1489
+ }
1490
+ async removeSelectedItems() {
1491
+ await this.removeItems(this.selectedItemsOrAllItems), this.unselectAll();
1492
+ }
1493
+ async removeOtherItems(e) {
1494
+ let t = e.id;
1495
+ return this.removeItems(this.items.filter((e) => e.id !== t));
1496
+ }
1497
+ async removeItemsAbove(e) {
1498
+ let t = this.items.indexOf(e);
1499
+ return this.removeItems(this.items.filter((e, n) => n < t));
1500
+ }
1501
+ addItemFromDto(e) {
1502
+ let t = this.createItemFromDto(e);
1503
+ return this.addItems([t]);
1504
+ }
1505
+ playAll() {
1506
+ return this.playQueue.clearAndSetItems(this.items.map((e) => this.playQueue.createItemFromDto(e.dto))), Promise.resolve();
1507
+ }
1512
1508
  };
1513
- function Kn(t) {
1514
- return t !== null && typeof t == "object" && "title" in t && typeof t.title == "string";
1515
- }
1516
- const Xn = K(
1517
- ({ playQueueStore: t }) => {
1518
- const [e, n] = Y(!1), i = $(
1519
- async (a) => {
1520
- const l = wr(a.url);
1521
- if (l !== void 0) {
1522
- const f = l.extractVideoId(a.url);
1523
- if (f !== void 0) {
1524
- const h = await (await fetch(
1525
- `https://noembed.com/embed?url=${encodeURIComponent(
1526
- a.url
1527
- )}`
1528
- )).json();
1529
- await t.addItems([
1530
- t.createItem({
1531
- url: a.url,
1532
- type: l.type,
1533
- videoId: f,
1534
- title: a.title || (Kn(h) ? h.title : f)
1535
- })
1536
- ]);
1537
- }
1538
- }
1539
- n(!1);
1540
- },
1541
- [t]
1542
- );
1543
- return /* @__PURE__ */ O(Re, { children: [
1544
- /* @__PURE__ */ o(
1545
- ee,
1546
- {
1547
- onClick: () => n(!0),
1548
- iconType: ct,
1549
- color: "primary",
1550
- children: "Add video"
1551
- }
1552
- ),
1553
- e && /* @__PURE__ */ o(
1554
- Jn,
1555
- {
1556
- onCancel: () => n(!1),
1557
- onSave: i
1558
- }
1559
- )
1560
- ] });
1561
- }
1562
- ), Zn = D(
1563
- ({ playQueueStore: t }) => {
1564
- const { euiTheme: e } = Dt();
1565
- return /* @__PURE__ */ O(
1566
- Lr,
1567
- {
1568
- style: {
1569
- position: "sticky",
1570
- top: 112,
1571
- zIndex: 998,
1572
- background: e.colors.backgroundBasePlain
1573
- },
1574
- children: [
1575
- /* @__PURE__ */ o(zr, { children: /* @__PURE__ */ o(
1576
- zt,
1577
- {
1578
- id: "",
1579
- checked: t.allItemsSelected,
1580
- onChange: (n) => {
1581
- t.allItemsSelected = n.target.checked;
1582
- }
1583
- }
1584
- ) }),
1585
- /* @__PURE__ */ o(Je, { width: 24 }),
1586
- /* @__PURE__ */ o(Je, { children: "Title" }),
1587
- /* @__PURE__ */ o(Je, {})
1588
- ]
1589
- }
1590
- );
1591
- }
1592
- ), Qn = K(
1593
- ({
1594
- item: t,
1595
- closePopover: e
1596
- }) => {
1597
- const n = K(
1598
- ({
1599
- onClick: i,
1600
- ...a
1601
- }) => {
1602
- const l = $(
1603
- (f) => {
1604
- e(), i == null || i(f);
1605
- },
1606
- [i]
1607
- );
1608
- return /* @__PURE__ */ o(Vr, { ...a, onClick: l });
1609
- }
1610
- );
1611
- return /* @__PURE__ */ O(Yr, { children: [
1612
- /* @__PURE__ */ o(
1613
- n,
1614
- {
1615
- icon: /* @__PURE__ */ o(W, { type: "" }),
1616
- onClick: t.playFirst,
1617
- children: "Play first"
1618
- }
1619
- ),
1620
- /* @__PURE__ */ o(
1621
- n,
1622
- {
1623
- icon: /* @__PURE__ */ o(W, { type: "" }),
1624
- onClick: t.playNext,
1625
- children: "Play next"
1626
- }
1627
- ),
1628
- /* @__PURE__ */ o(
1629
- n,
1630
- {
1631
- icon: /* @__PURE__ */ o(W, { type: ct }),
1632
- onClick: t.addToPlayQueue,
1633
- children: "Add to play queue"
1634
- }
1635
- ),
1636
- /* @__PURE__ */ o(It, { margin: "none" }),
1637
- /* @__PURE__ */ o(
1638
- n,
1639
- {
1640
- icon: /* @__PURE__ */ o(W, { type: ln }),
1641
- onClick: t.moveToTop,
1642
- disabled: !t.canMoveToTop,
1643
- children: "Move to the top"
1644
- }
1645
- ),
1646
- /* @__PURE__ */ o(
1647
- n,
1648
- {
1649
- icon: /* @__PURE__ */ o(W, { type: cn }),
1650
- onClick: t.moveToBottom,
1651
- disabled: !t.canMoveToBottom,
1652
- children: "Move to the bottom"
1653
- }
1654
- ),
1655
- /* @__PURE__ */ o(It, { margin: "none" }),
1656
- /* @__PURE__ */ o(
1657
- n,
1658
- {
1659
- icon: /* @__PURE__ */ o(W, { type: "" }),
1660
- onClick: t.removeToTop,
1661
- disabled: !t.canRemoveToTop,
1662
- children: "Remove to the top"
1663
- }
1664
- ),
1665
- /* @__PURE__ */ o(
1666
- n,
1667
- {
1668
- icon: /* @__PURE__ */ o(W, { type: "" }),
1669
- onClick: t.removeOthers,
1670
- disabled: !t.canRemoveOthers,
1671
- children: "Remove others"
1672
- }
1673
- )
1674
- ] });
1675
- }
1676
- ), ei = K(
1677
- ({ item: t }) => {
1678
- const [e, n] = Y(!1), i = $(() => n(!e), [e]), a = $(() => n(!1), []);
1679
- return /* @__PURE__ */ o(
1680
- st,
1681
- {
1682
- button: /* @__PURE__ */ o(
1683
- G,
1684
- {
1685
- title: "More options",
1686
- "aria-label": "More options",
1687
- iconType: Yt,
1688
- size: "s",
1689
- color: "text",
1690
- onClick: i
1691
- }
1692
- ),
1693
- isOpen: e,
1694
- closePopover: a,
1695
- panelPaddingSize: "none",
1696
- anchorPosition: "leftCenter",
1697
- children: /* @__PURE__ */ o(
1698
- Qn,
1699
- {
1700
- item: t,
1701
- closePopover: a
1702
- }
1703
- )
1704
- }
1705
- );
1706
- }
1707
- ), ti = D(
1708
- ({ item: t }) => {
1709
- const e = te();
1710
- return /* @__PURE__ */ O(Qe, { textOnly: !1, hasActions: !0, align: "right", children: [
1711
- /* @__PURE__ */ o(
1712
- ee,
1713
- {
1714
- iconType: un,
1715
- size: "s",
1716
- onClick: async () => {
1717
- t.isCurrent ? await e.setCurrentTime(0) : t.play();
1718
- },
1719
- children: "Play"
1720
- }
1721
- ),
1722
- /* @__PURE__ */ o(
1723
- ee,
1724
- {
1725
- iconType: lt,
1726
- size: "s",
1727
- onClick: t.remove,
1728
- children: "Remove"
1729
- }
1730
- ),
1731
- /* @__PURE__ */ o(ei, { item: t })
1732
- ] });
1733
- }
1734
- ), ri = {
1735
- Audio: "",
1736
- Dailymotion: "https://www.dailymotion.com/favicon.ico",
1737
- Niconico: "https://www.nicovideo.jp/favicon.ico",
1738
- SoundCloud: "https://soundcloud.com/favicon.ico",
1739
- Twitch: "https://www.twitch.tv/favicon.ico",
1740
- Vimeo: "https://vimeo.com/favicon.ico",
1741
- YouTube: "https://www.youtube.com/favicon.ico"
1742
- }, ni = D(
1743
- ({ item: t }) => {
1744
- const e = te();
1745
- return /* @__PURE__ */ O(Ur, { isSelected: t.isCurrent, children: [
1746
- /* @__PURE__ */ o(Br, { children: /* @__PURE__ */ o(
1747
- zt,
1748
- {
1749
- id: t.id.toString(),
1750
- checked: t.isSelected,
1751
- onChange: t.toggleSelected
1752
- }
1753
- ) }),
1754
- /* @__PURE__ */ o(Qe, { textOnly: !1, children: /* @__PURE__ */ o(
1755
- "img",
1756
- {
1757
- src: ri[t.type],
1758
- width: 16,
1759
- height: 16,
1760
- alt: t.type
1761
- }
1762
- ) }),
1763
- /* @__PURE__ */ o(Qe, { children: /* @__PURE__ */ o(
1764
- Wr,
1765
- {
1766
- href: t.url,
1767
- target: "_blank",
1768
- external: !0,
1769
- onClick: () => e.pause(),
1770
- children: t.title
1771
- }
1772
- ) }),
1773
- /* @__PURE__ */ o(ti, { item: t })
1774
- ] }, t.id);
1775
- }
1776
- ), ii = D(
1777
- ({ playQueueStore: t }) => /* @__PURE__ */ o(
1778
- fn,
1779
- {
1780
- tag: "tbody",
1781
- list: t.items,
1782
- setList: (e) => t.setItems(e),
1783
- children: t.items.map((e) => /* @__PURE__ */ o(ni, { item: e }, e.id))
1784
- }
1785
- )
1786
- ), oi = D(
1787
- ({ playQueueStore: t }) => /* @__PURE__ */ O(qr, { children: [
1788
- /* @__PURE__ */ o(Zn, { playQueueStore: t }),
1789
- /* @__PURE__ */ o(ii, { playQueueStore: t })
1790
- ] })
1791
- ), ai = D(
1792
- ({ playQueueStore: t }) => {
1793
- const [e, n] = Y(!1);
1794
- return /* @__PURE__ */ O(Re, { children: [
1795
- e && /* @__PURE__ */ o(
1796
- Gr,
1797
- {
1798
- type: "push",
1799
- size: "s",
1800
- onClose: () => n(!1),
1801
- children: /* @__PURE__ */ o("div", { style: { blockSize: "100%" }, children: /* @__PURE__ */ o(
1802
- Hr,
1803
- {
1804
- language: "json",
1805
- overflowHeight: "100%",
1806
- isCopyable: !0,
1807
- isVirtualized: !0,
1808
- children: JSON.stringify(
1809
- t.localStorageState,
1810
- void 0,
1811
- 2
1812
- )
1813
- }
1814
- ) })
1815
- }
1816
- ),
1817
- /* @__PURE__ */ o(Xn, { playQueueStore: t })
1818
- ] });
1819
- }
1820
- ), si = D(
1821
- ({ playerStore: t, playQueueStore: e }) => {
1822
- const { euiTheme: n } = Dt();
1823
- return /* @__PURE__ */ O(Re, { children: [
1824
- /* @__PURE__ */ O(
1825
- de,
1826
- {
1827
- alignItems: "center",
1828
- gutterSize: "m",
1829
- style: {
1830
- position: "sticky",
1831
- top: 48,
1832
- zIndex: 998,
1833
- background: n.colors.backgroundBasePlain
1834
- },
1835
- children: [
1836
- /* @__PURE__ */ o(U, { grow: !1, children: /* @__PURE__ */ o(
1837
- ee,
1838
- {
1839
- disabled: e.isEmpty || e.selectedItems.length === 0,
1840
- onClick: e.playSelectedItemsNext,
1841
- children: "Play next"
1842
- }
1843
- ) }),
1844
- /* @__PURE__ */ o(U, { grow: !1, children: /* @__PURE__ */ o(
1845
- ee,
1846
- {
1847
- iconType: ct,
1848
- onClick: e.addSelectedItems,
1849
- disabled: e.isEmpty || e.selectedItems.length === 0,
1850
- children: "Add to play queue"
1851
- }
1852
- ) }),
1853
- /* @__PURE__ */ o(U, { grow: !1, children: /* @__PURE__ */ o(
1854
- ee,
1855
- {
1856
- iconType: lt,
1857
- onClick: e.removeSelectedItems,
1858
- disabled: e.isEmpty || e.selectedItems.length === 0,
1859
- children: "Remove"
1860
- }
1861
- ) }),
1862
- /* @__PURE__ */ o(U, { grow: !1, children: /* @__PURE__ */ o(
1863
- ee,
1864
- {
1865
- iconType: dn,
1866
- onClick: e.clear,
1867
- disabled: e.isEmpty,
1868
- children: "Clear"
1869
- }
1870
- ) }),
1871
- /* @__PURE__ */ o(U, { grow: !0 }),
1872
- /* @__PURE__ */ o(U, { grow: !1, children: /* @__PURE__ */ o(ai, { playQueueStore: e }) })
1873
- ]
1874
- }
1875
- ),
1876
- !e.isEmpty && /* @__PURE__ */ O(Re, { children: [
1877
- /* @__PURE__ */ o(
1878
- Lt,
1879
- {
1880
- size: "l",
1881
- style: {
1882
- position: "sticky",
1883
- top: 88,
1884
- zIndex: 998,
1885
- background: n.colors.backgroundBasePlain
1886
- }
1887
- }
1888
- ),
1889
- /* @__PURE__ */ o(oi, { playQueueStore: e })
1890
- ] })
1891
- ] });
1892
- }
1893
- ), Ri = D(
1894
- ({ playerStore: t, playQueueStore: e }) => /* @__PURE__ */ O(Re, { children: [
1895
- /* @__PURE__ */ o(
1896
- et.Header,
1897
- {
1898
- pageTitle: "Play queue",
1899
- rightSideItems: []
1900
- }
1901
- ),
1902
- /* @__PURE__ */ o(et.Section, { children: /* @__PURE__ */ o(
1903
- si,
1904
- {
1905
- playerStore: t,
1906
- playQueueStore: e
1907
- }
1908
- ) })
1909
- ] })
1910
- ), it = {
1911
- width: 16 * 25,
1912
- height: 9 * 25
1913
- }, Pi = D(
1914
- ({ playerStore: t, playQueueStore: e }) => {
1915
- const n = te(), i = $(async () => {
1916
- e.interacted && await n.play();
1917
- }, [e, n]), a = $(async () => {
1918
- switch (e.repeat) {
1919
- case I.One:
1920
- await n.setCurrentTime(0);
1921
- break;
1922
- case I.Off:
1923
- case I.All:
1924
- if (e.isLastItem)
1925
- switch (e.repeat) {
1926
- case I.Off:
1927
- t.onEnded();
1928
- break;
1929
- case I.All:
1930
- e.hasMultipleItems ? await e.goToFirst() : await n.setCurrentTime(0);
1931
- break;
1932
- }
1933
- else
1934
- await e.next();
1935
- break;
1936
- }
1937
- }, [e, t, n]), l = $t(
1938
- () => ({
1939
- onLoaded: i,
1940
- onPlay: t.onPlay,
1941
- onPause: t.onPause,
1942
- onEnded: a,
1943
- onTimeUpdate: t.onTimeUpdate
1944
- }),
1945
- [t, i, a]
1946
- );
1947
- return /* @__PURE__ */ o(
1948
- "div",
1949
- {
1950
- css: {
1951
- position: "fixed",
1952
- right: 0,
1953
- bottom: Kt,
1954
- width: it.width,
1955
- height: it.height,
1956
- zIndex: 998,
1957
- backgroundColor: "rgb(39, 39, 39)",
1958
- display: "flex",
1959
- flexDirection: "column"
1960
- },
1961
- children: /* @__PURE__ */ o("div", { css: { flexGrow: 1, backgroundColor: "black" }, children: e.currentItem && /* @__PURE__ */ o(
1962
- _r,
1963
- {
1964
- src: e.currentItem.url,
1965
- options: l
1966
- }
1967
- ) })
1968
- }
1969
- );
1970
- }
1971
- );
1972
- class Xt {
1973
- makeObservable(e, n) {
1974
- return mn(e, n);
1975
- }
1976
- }
1977
- const Ce = class Ce {
1978
- constructor(e, n, i) {
1979
- V(this, "id");
1980
- V(this, "isSelected", !1);
1981
- this.observableStateProvider = e, this.playQueueStore = n, this.dto = i, this.id = Ce.nextId++, e.makeObservable(this, {
1982
- isSelected: Q,
1983
- isCurrent: w,
1984
- index: w,
1985
- isFirst: w,
1986
- isLast: w,
1987
- canMoveToTop: w,
1988
- canMoveToBottom: w,
1989
- canRemoveToTop: w,
1990
- canRemoveOthers: w,
1991
- unselect: y,
1992
- toggleSelected: y.bound,
1993
- play: y,
1994
- remove: y.bound,
1995
- playFirst: y.bound,
1996
- playNext: y.bound,
1997
- addToPlayQueue: y.bound,
1998
- moveToTop: y.bound,
1999
- moveToBottom: y.bound,
2000
- removeToTop: y.bound,
2001
- removeOthers: y.bound
2002
- });
2003
- }
2004
- static fromDto(e, n, i) {
2005
- return new Ce(
2006
- e,
2007
- n,
2008
- i
2009
- );
2010
- }
2011
- get url() {
2012
- return this.dto.url;
2013
- }
2014
- get type() {
2015
- return this.dto.type;
2016
- }
2017
- get videoId() {
2018
- return this.dto.videoId;
2019
- }
2020
- get title() {
2021
- return this.dto.title;
2022
- }
2023
- get isCurrent() {
2024
- return this.playQueueStore.currentItem === this;
2025
- }
2026
- get index() {
2027
- return this.playQueueStore.items.indexOf(this);
2028
- }
2029
- get isFirst() {
2030
- return this.index === 0;
2031
- }
2032
- get isLast() {
2033
- return this.index === this.playQueueStore.items.length - 1;
2034
- }
2035
- get canMoveToTop() {
2036
- return !this.isFirst;
2037
- }
2038
- get canMoveToBottom() {
2039
- return !this.isLast;
2040
- }
2041
- get canRemoveToTop() {
2042
- return !this.isFirst;
2043
- }
2044
- get canRemoveOthers() {
2045
- return this.playQueueStore.hasMultipleItems;
2046
- }
2047
- clone() {
2048
- return this.playQueueStore.createItem(this.dto);
2049
- }
2050
- unselect() {
2051
- this.isSelected = !1;
2052
- }
2053
- toggleSelected() {
2054
- this.isSelected = !this.isSelected;
2055
- }
2056
- play() {
2057
- this.playQueueStore.setCurrentItem(this);
2058
- }
2059
- remove() {
2060
- return this.playQueueStore.removeItems([this]);
2061
- }
2062
- async playFirst() {
2063
- await this.playQueueStore.playFirst([this.clone()]);
2064
- }
2065
- async playNext() {
2066
- await this.playQueueStore.playNext([this.clone()]);
2067
- }
2068
- async addToPlayQueue() {
2069
- await this.playQueueStore.addItems([this.clone()]);
2070
- }
2071
- moveToTop() {
2072
- this.playQueueStore.moveItem(this, 0);
2073
- }
2074
- moveToBottom() {
2075
- this.playQueueStore.moveItem(
2076
- this,
2077
- this.playQueueStore.items.length - 1
2078
- );
2079
- }
2080
- removeToTop() {
2081
- return this.playQueueStore.removeItemsAbove(this);
2082
- }
2083
- removeOthers() {
2084
- return this.playQueueStore.removeOtherItems(this);
2085
- }
1509
+ W([R], K.prototype, "items", void 0), W([I], K.prototype, "isEmpty", null), W([I], K.prototype, "hasMultipleItems", null), W([I], K.prototype, "selectedItems", null), W([I], K.prototype, "allItemsSelected", null), W([I], K.prototype, "hasSelectedItems", null), W([I], K.prototype, "selectedItemsOrAllItems", null), W([I], K.prototype, "canAddSelectedItems", null), W([I], K.prototype, "canPlaySelectedItemsNext", null), W([I], K.prototype, "canRemoveSelectedItems", null), W([F.bound], K.prototype, "setItems", null), W([F.bound], K.prototype, "unselectAll", null), W([F.bound], K.prototype, "selectAll", null), W([F.bound], K.prototype, "playSelectedItemsNext", null), W([F.bound], K.prototype, "addSelectedItems", null), W([F.bound], K.prototype, "addItems", null), W([F.bound], K.prototype, "moveItem", null), W([F.bound], K.prototype, "removeItems", null), W([F.bound], K.prototype, "removeSelectedItems", null), W([F.bound], K.prototype, "removeOtherItems", null), W([F.bound], K.prototype, "removeItemsAbove", null), W([F.bound], K.prototype, "addItemFromDto", null), W([F.bound], K.prototype, "playAll", null);
1510
+ //#endregion
1511
+ //#region src/shared/stores/localStorageStateKeys.ts
1512
+ var dn = {
1513
+ playQueue: "PlayQueueStore",
1514
+ bottomBar: "BottomBarStore",
1515
+ playlistList: "PlaylistListStore",
1516
+ playlist: (e) => `PlaylistStore/${e}`
1517
+ }, fn = ({ onClick: e }) => /* @__PURE__ */ j(u, {
1518
+ onClick: e,
1519
+ iconType: O,
1520
+ fill: !0,
1521
+ children: "Play all"
1522
+ }), pn = ({ playlistListItem: e, onFulfilled: t }) => /* @__PURE__ */ j(u, {
1523
+ onClick: () => P.show(an, { playlistListItem: e }).then(t),
1524
+ iconType: Pe,
1525
+ children: "Rename"
1526
+ }), mn = ({ playlistListItem: e, onFulfilled: t }) => /* @__PURE__ */ j(u, {
1527
+ onClick: () => P.show(Gt, { playlistListItem: e }).then(t),
1528
+ iconType: De,
1529
+ children: "Delete"
1530
+ }), hn = k(({ playlistListItem: e }) => {
1531
+ let t = dn.playlist(e.id), r = U(), [i] = c(() => new K(r));
1532
+ B(t, i.localStorageState);
1533
+ let a = Ge(), o = n(async (t) => {
1534
+ await e.rename(t);
1535
+ }, [e]), s = n(async () => {
1536
+ await a.navigate({ to: "/playlists" }), window.localStorage.removeItem(t), await e.remove();
1537
+ }, [
1538
+ e,
1539
+ a,
1540
+ t
1541
+ ]);
1542
+ return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(Ut, {
1543
+ pageTitle: e.name,
1544
+ breadcrumbs: [{
1545
+ text: "Playlists",
1546
+ linkProps: { to: "/playlists" }
1547
+ }, { text: e.name }],
1548
+ rightSideItems: [
1549
+ /* @__PURE__ */ j(fn, { onClick: i.playAll }),
1550
+ /* @__PURE__ */ j(pn, {
1551
+ playlistListItem: e,
1552
+ onFulfilled: o
1553
+ }),
1554
+ /* @__PURE__ */ j(mn, {
1555
+ playlistListItem: e,
1556
+ onFulfilled: s
1557
+ })
1558
+ ]
1559
+ }), /* @__PURE__ */ j(rn, { playlist: i })] });
1560
+ }), gn = P.create(({ remove: e, resolve: t }) => {
1561
+ let n = ye({ prefix: "modalForm" }), [r, i] = c(""), [a, o] = c(!1);
1562
+ return /* @__PURE__ */ M(ae, {
1563
+ onClose: e,
1564
+ initialFocus: "[name=name]",
1565
+ children: [
1566
+ /* @__PURE__ */ j(ce, { children: /* @__PURE__ */ j(le, { children: "Create playlist" }) }),
1567
+ /* @__PURE__ */ j(oe, { children: /* @__PURE__ */ j(re, {
1568
+ id: n,
1569
+ component: "form",
1570
+ onSubmit: async (n) => {
1571
+ n.preventDefault();
1572
+ try {
1573
+ o(!0), t(r), e();
1574
+ } finally {
1575
+ o(!1);
1576
+ }
1577
+ },
1578
+ children: /* @__PURE__ */ j(_, {
1579
+ label: "Name",
1580
+ children: /* @__PURE__ */ j(ne, {
1581
+ name: "name",
1582
+ value: r,
1583
+ onChange: (e) => i(e.target.value)
1584
+ })
1585
+ })
1586
+ }) }),
1587
+ /* @__PURE__ */ M(se, { children: [/* @__PURE__ */ j(d, {
1588
+ onClick: e,
1589
+ children: "Cancel"
1590
+ }), /* @__PURE__ */ j(u, {
1591
+ type: "submit",
1592
+ form: n,
1593
+ fill: !0,
1594
+ disabled: r.trim().length === 0,
1595
+ isLoading: a,
1596
+ children: "Create playlist"
1597
+ })] })
1598
+ ]
1599
+ });
1600
+ }), _n = ({ children: e, onFulfilled: t }) => /* @__PURE__ */ j(u, {
1601
+ onClick: () => P.show(gn).then(t),
1602
+ iconType: T,
1603
+ fill: !0,
1604
+ children: e
1605
+ }), vn = ({ linkProps: e, ...t }) => {
1606
+ let n = Ge(), r = async (t) => {
1607
+ t.preventDefault(), await n.navigate(e);
1608
+ };
1609
+ return /* @__PURE__ */ j(ie, {
1610
+ ...t,
1611
+ href: n.buildLocation(e).href,
1612
+ onClick: r
1613
+ });
1614
+ }, yn = k(() => /* @__PURE__ */ j(me, { children: /* @__PURE__ */ j(S, { children: "Name" }) })), bn = k(({ item: e }) => /* @__PURE__ */ j(_e, { children: /* @__PURE__ */ j(C, { children: /* @__PURE__ */ j(vn, {
1615
+ linkProps: {
1616
+ to: "/playlists/$playlistId",
1617
+ params: { playlistId: e.id }
1618
+ },
1619
+ children: e.name
1620
+ }) }) }, e.id)), xn = k(({ playlistList: e }) => /* @__PURE__ */ j(We, {
1621
+ tag: "tbody",
1622
+ list: e.items,
1623
+ setList: (t) => e.setItems(t),
1624
+ children: e.items.map((e) => /* @__PURE__ */ j(bn, { item: e }, e.id))
1625
+ })), Sn = k(({ playlistList: e }) => /* @__PURE__ */ M(pe, { children: [/* @__PURE__ */ j(yn, {}), /* @__PURE__ */ j(xn, { playlistList: e })] })), Cn = () => /* @__PURE__ */ j(Ut, {
1626
+ pageTitle: "Playlists",
1627
+ breadcrumbs: [{ text: "Playlists" }]
1628
+ }), wn = k(({ playlistList: e }) => {
1629
+ let t = n(async (t) => {
1630
+ await e.addItem(e.createItem(t));
1631
+ }, [e]);
1632
+ return /* @__PURE__ */ M(b.Section, { children: [
1633
+ /* @__PURE__ */ j(_n, {
1634
+ onFulfilled: t,
1635
+ children: "New playlist"
1636
+ }),
1637
+ /* @__PURE__ */ j(fe, { size: "l" }),
1638
+ /* @__PURE__ */ j(Sn, { playlistList: e })
1639
+ ] });
1640
+ }), Tn = t(() => {
1641
+ let e = Ht();
1642
+ return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(Cn, {}), /* @__PURE__ */ j(wn, { playlistList: e })] });
1643
+ }), En = e(void 0), Dn = () => r(En), On = {
1644
+ type: "object",
1645
+ properties: {
1646
+ repeat: {
1647
+ type: "string",
1648
+ enum: Object.values(H),
1649
+ nullable: !0
1650
+ },
1651
+ shuffle: {
1652
+ type: "boolean",
1653
+ nullable: !0
1654
+ }
1655
+ }
1656
+ }, kn = class {
1657
+ bottomBar;
1658
+ constructor(e) {
1659
+ this.bottomBar = e, L(this);
1660
+ }
1661
+ get state() {
1662
+ return {
1663
+ repeat: this.bottomBar.repeat,
1664
+ shuffle: this.bottomBar.shuffle
1665
+ };
1666
+ }
1667
+ set state(e) {
1668
+ this.bottomBar.repeat = e.repeat ?? H.Off, this.bottomBar.shuffle = e.shuffle ?? !1;
1669
+ }
1670
+ validateState(e) {
1671
+ return cn(On, "BottomBarLocalStorageState")(e);
1672
+ }
2086
1673
  };
2087
- V(Ce, "nextId", 1);
2088
- let ot = Ce;
2089
- const Xe = new vn({
2090
- coerceTypes: !0
2091
- });
2092
- function li(t, e) {
2093
- let n;
2094
- if (n = Xe.getSchema(e), n === void 0 && (Xe.addSchema(t, e), n = Xe.getSchema(e)), n === void 0 || n.schema !== t)
2095
- throw new Error(
2096
- `Invalid schema. Expected: '${JSON.stringify(
2097
- t
2098
- )}', but got '${JSON.stringify(n == null ? void 0 : n.schema)}'.`
2099
- );
2100
- return n;
2101
- }
2102
- const ci = {
2103
- type: "object",
2104
- properties: {
2105
- version: {
2106
- type: "string",
2107
- nullable: !0
2108
- },
2109
- repeat: {
2110
- type: "string",
2111
- enum: Object.values(I),
2112
- nullable: !0
2113
- },
2114
- shuffle: {
2115
- type: "boolean",
2116
- nullable: !0
2117
- },
2118
- items: {
2119
- type: "array",
2120
- nullable: !0,
2121
- items: {
2122
- type: "object",
2123
- properties: {
2124
- url: {
2125
- type: "string"
2126
- },
2127
- type: {
2128
- type: "string"
2129
- },
2130
- videoId: {
2131
- type: "string"
2132
- },
2133
- title: {
2134
- type: "string"
2135
- }
2136
- },
2137
- required: ["url", "type", "videoId", "title"]
2138
- }
2139
- },
2140
- currentIndex: {
2141
- type: "integer",
2142
- nullable: !0
2143
- }
2144
- }
2145
- }, ui = li(
2146
- ci,
2147
- "PlayQueueStore"
2148
- );
2149
- class di {
2150
- constructor(e) {
2151
- V(this, "interacted", !1);
2152
- V(this, "items", []);
2153
- V(this, "currentId");
2154
- V(this, "repeat", I.Off);
2155
- V(this, "shuffle", !1);
2156
- this.observableStateProvider = e, e.makeObservable(this, {
2157
- interacted: Q,
2158
- items: Q,
2159
- currentId: Q,
2160
- repeat: Q,
2161
- shuffle: Q,
2162
- localStorageState: w.struct,
2163
- isEmpty: w,
2164
- currentItem: w,
2165
- canPlay: w,
2166
- canPause: w,
2167
- hasMultipleItems: w,
2168
- currentIndex: w,
2169
- hasPreviousItem: w,
2170
- hasNextItem: w,
2171
- isLastItem: w,
2172
- selectedItems: w,
2173
- allItemsSelected: w,
2174
- selectedItemsOrAllItems: w,
2175
- setItems: y,
2176
- interact: y,
2177
- clear: y.bound,
2178
- unselectAll: y,
2179
- setCurrentItem: y,
2180
- setNextItems: y,
2181
- clearAndSetItems: y,
2182
- playNext: y,
2183
- playSelectedItemsNext: y.bound,
2184
- addItems: y,
2185
- addSelectedItems: y.bound,
2186
- playFirst: y,
2187
- moveItem: y,
2188
- removeItems: y,
2189
- removeSelectedItems: y.bound,
2190
- removeOtherItems: y,
2191
- removeItemsAbove: y,
2192
- toggleRepeat: y.bound,
2193
- toggleShuffle: y.bound,
2194
- previous: y,
2195
- next: y.bound,
2196
- goToFirst: y
2197
- });
2198
- }
2199
- createItem(e) {
2200
- return ot.fromDto(
2201
- this.observableStateProvider,
2202
- this,
2203
- e
2204
- );
2205
- }
2206
- get localStorageState() {
2207
- return {
2208
- version: "1.0",
2209
- repeat: this.repeat,
2210
- shuffle: this.shuffle,
2211
- items: this.items.map((e) => e.dto),
2212
- currentIndex: this.currentIndex
2213
- };
2214
- }
2215
- set localStorageState(e) {
2216
- var n;
2217
- this.repeat = e.repeat ?? I.Off, this.shuffle = e.shuffle ?? !1, this.items = ((n = e.items) == null ? void 0 : n.map((i) => this.createItem(i))) ?? [], this.currentIndex = e.currentIndex;
2218
- }
2219
- validateLocalStorageState(e) {
2220
- return ui(e);
2221
- }
2222
- get isEmpty() {
2223
- return this.items.length === 0;
2224
- }
2225
- get currentItem() {
2226
- return this.items.find((e) => e.id === this.currentId);
2227
- }
2228
- get canPlay() {
2229
- return this.currentItem !== void 0;
2230
- }
2231
- get canPause() {
2232
- return this.currentItem !== void 0;
2233
- }
2234
- get hasMultipleItems() {
2235
- return this.items.length > 1;
2236
- }
2237
- get currentIndex() {
2238
- return this.currentId !== void 0 ? this.items.findIndex((e) => e.id === this.currentId) : void 0;
2239
- }
2240
- set currentIndex(e) {
2241
- var n;
2242
- this.currentId = e !== void 0 ? (n = this.items.at(e)) == null ? void 0 : n.id : void 0;
2243
- }
2244
- get hasPreviousItem() {
2245
- return this.hasMultipleItems && this.currentIndex !== void 0 && this.currentIndex > 0;
2246
- }
2247
- get hasNextItem() {
2248
- return this.hasMultipleItems && this.currentIndex !== void 0 && this.currentIndex < this.items.length - 1;
2249
- }
2250
- get isLastItem() {
2251
- return this.currentIndex !== void 0 && this.currentIndex === this.items.length - 1;
2252
- }
2253
- get selectedItems() {
2254
- return this.items.filter((e) => e.isSelected);
2255
- }
2256
- get allItemsSelected() {
2257
- return this.selectedItems.length === this.items.length;
2258
- }
2259
- set allItemsSelected(e) {
2260
- for (const n of this.items)
2261
- n.isSelected = e;
2262
- }
2263
- get selectedItemsOrAllItems() {
2264
- return this.selectedItems.length > 0 ? this.selectedItems : this.items;
2265
- }
2266
- setItems(e) {
2267
- this.items = e;
2268
- }
2269
- interact() {
2270
- this.interacted = !0;
2271
- }
2272
- clear() {
2273
- this.interact(), this.currentIndex = void 0, this.items = [];
2274
- }
2275
- unselectAll() {
2276
- for (const e of this.items)
2277
- e.unselect();
2278
- }
2279
- setCurrentItem(e) {
2280
- this.interact(), this.currentId = e == null ? void 0 : e.id;
2281
- }
2282
- setNextItems(e) {
2283
- this.currentIndex !== void 0 && this.items.splice(this.currentIndex + 1, 0, ...e);
2284
- }
2285
- clearAndSetItems(e) {
2286
- this.clear(), this.setCurrentItem(e[0]), this.setNextItems(e);
2287
- }
2288
- async playNext(e) {
2289
- if (this.isEmpty) {
2290
- this.clearAndSetItems(e);
2291
- return;
2292
- }
2293
- this.setNextItems(e);
2294
- }
2295
- async playSelectedItemsNext() {
2296
- await this.playNext(
2297
- this.selectedItemsOrAllItems.map((e) => e.clone())
2298
- ), this.unselectAll();
2299
- }
2300
- async addItems(e) {
2301
- if (this.isEmpty) {
2302
- this.clearAndSetItems(e);
2303
- return;
2304
- }
2305
- this.items.push(...e);
2306
- }
2307
- async addSelectedItems() {
2308
- await this.addItems(
2309
- this.selectedItemsOrAllItems.map((e) => e.clone())
2310
- ), this.unselectAll();
2311
- }
2312
- async playFirst(e) {
2313
- if (this.isEmpty) {
2314
- this.clearAndSetItems(e);
2315
- return;
2316
- }
2317
- const { currentIndex: n } = this;
2318
- n !== void 0 && (this.interact(), this.items.splice(n, 0, ...e), this.currentIndex = n);
2319
- }
2320
- moveItem(e, n) {
2321
- const i = this.items.splice(this.items.indexOf(e), 1)[0];
2322
- this.items.splice(n, 0, i);
2323
- }
2324
- async removeItems(e) {
2325
- const { currentItem: n } = this;
2326
- Rt(this.items, ...e.filter((l) => l !== n));
2327
- const { currentIndex: i, isLastItem: a } = this;
2328
- Rt(
2329
- this.items,
2330
- e.find((l) => l === n)
2331
- ), this.currentItem !== n && (this.interact(), a ? await this.goToFirst() : this.currentIndex = i);
2332
- }
2333
- async removeSelectedItems() {
2334
- await this.removeItems(this.selectedItemsOrAllItems), this.unselectAll();
2335
- }
2336
- async removeOtherItems(e) {
2337
- const n = e.id;
2338
- return this.removeItems(
2339
- this.items.filter((i) => i.id !== n)
2340
- );
2341
- }
2342
- async removeItemsAbove(e) {
2343
- const n = this.items.indexOf(e);
2344
- return this.removeItems(
2345
- this.items.filter((i, a) => a < n)
2346
- );
2347
- }
2348
- toggleRepeat() {
2349
- switch (this.repeat) {
2350
- case I.Off:
2351
- this.repeat = I.All;
2352
- break;
2353
- case I.All:
2354
- this.repeat = I.One;
2355
- break;
2356
- case I.One:
2357
- this.repeat = I.Off;
2358
- break;
2359
- }
2360
- }
2361
- toggleShuffle() {
2362
- this.shuffle = !this.shuffle;
2363
- }
2364
- async previous() {
2365
- this.currentIndex !== void 0 && this.hasPreviousItem && (this.interact(), this.currentIndex--);
2366
- }
2367
- async next() {
2368
- this.currentIndex !== void 0 && this.hasNextItem && (this.interact(), this.currentIndex++);
2369
- }
2370
- async goToFirst() {
2371
- this.currentIndex !== void 0 && (this.currentIndex = 0);
2372
- }
2373
- }
2374
- const Zt = jt(void 0), wi = ({
2375
- children: t
2376
- }) => {
2377
- const [e] = Y(
2378
- () => new di(new Xt())
2379
- ), n = te();
2380
- return Rr(() => hn(
2381
- () => e.currentItem,
2382
- async (i, a) => {
2383
- i === void 0 || a === void 0 || i.type === a.type && i.videoId === a.videoId && await n.setCurrentTime(0);
2384
- }
2385
- ), [e, n]), /* @__PURE__ */ o(Zt.Provider, { value: e, children: t });
2386
- }, fi = () => at(Zt), _i = D(
2387
- ({ children: t }) => {
2388
- const e = fi();
2389
- return /* @__PURE__ */ O(
2390
- et,
2391
- {
2392
- panelled: !0,
2393
- style: {
2394
- minBlockSize: `max(460px, 100vh - ${Kt}px)`
2395
- },
2396
- children: [
2397
- t,
2398
- !e.isEmpty && /* @__PURE__ */ o(Lt, { style: { blockSize: it.height } })
2399
- ]
2400
- }
2401
- );
2402
- }
2403
- );
2404
- class mi {
2405
- constructor(e) {
2406
- V(this, "playing", !1);
2407
- V(this, "percent", 0);
2408
- V(this, "seeking", !1);
2409
- e.makeObservable(this, {
2410
- playing: Q,
2411
- percent: Q,
2412
- seeking: Q,
2413
- setPlaying: y,
2414
- setPercent: y,
2415
- setSeeking: y,
2416
- onPlay: y.bound,
2417
- onPause: y.bound,
2418
- onEnded: y.bound,
2419
- onTimeUpdate: y.bound
2420
- });
2421
- }
2422
- setPlaying(e) {
2423
- this.playing = e;
2424
- }
2425
- setPercent(e) {
2426
- this.percent = e;
2427
- }
2428
- setSeeking(e) {
2429
- this.seeking = e;
2430
- }
2431
- onPlay() {
2432
- this.playing = !0;
2433
- }
2434
- onPause() {
2435
- this.playing = !1;
2436
- }
2437
- onEnded() {
2438
- this.playing = !1;
2439
- }
2440
- onTimeUpdate({ percent: e }) {
2441
- e !== void 0 && (this.seeking || (this.percent = e));
2442
- }
2443
- }
2444
- const Qt = jt(void 0), Oi = ({
2445
- children: t
2446
- }) => {
2447
- const [e] = Y(
2448
- () => new mi(new Xt())
2449
- );
2450
- return /* @__PURE__ */ o(Qt.Provider, { value: e, children: t });
2451
- }, Ai = () => at(Qt);
2452
- class ki {
2453
- makeObservable(e, n) {
2454
- return e;
2455
- }
2456
- }
2457
- export {
2458
- Ii as BottomBar,
2459
- Ri as HydrangeanDiva,
2460
- _i as MediaPlayerLayout,
2461
- Pi as MiniPlayer,
2462
- Xt as MobXObservableStateProvider,
2463
- ki as ObservableStateProvider,
2464
- wi as PlayQueueStoreProvider,
2465
- Oi as PlayerStoreProvider,
2466
- I as RepeatMode,
2467
- Kt as bottomBarHeight,
2468
- it as miniPlayerSize,
2469
- fi as usePlayQueueStore,
2470
- Ai as usePlayerStore
1674
+ W([I.struct], kn.prototype, "state", null);
1675
+ var q = class {
1676
+ player;
1677
+ playQueue;
1678
+ localStorageState;
1679
+ repeat = H.Off;
1680
+ shuffle = !1;
1681
+ constructor(e, t) {
1682
+ this.player = e, this.playQueue = t, L(this), this.localStorageState = new kn(this);
1683
+ }
1684
+ get controller() {
1685
+ return this.player.controller;
1686
+ }
1687
+ get playing() {
1688
+ return this.player.playing;
1689
+ }
1690
+ get percent() {
1691
+ return this.player.percent;
1692
+ }
1693
+ get canSeek() {
1694
+ return !this.playQueue.isEmpty && this.controller.supports("setCurrentTime");
1695
+ }
1696
+ get currentItem() {
1697
+ return this.playQueue.currentItem;
1698
+ }
1699
+ get canToggleRepeat() {
1700
+ return !0;
1701
+ }
1702
+ get canToggleShuffle() {
1703
+ return !1;
1704
+ }
1705
+ get canPlay() {
1706
+ return this.playQueue.canPlay && this.controller.supports("play");
1707
+ }
1708
+ get canPause() {
1709
+ return this.playQueue.canPause && this.controller.supports("pause");
1710
+ }
1711
+ get canPrevious() {
1712
+ return !this.playQueue.isEmpty;
1713
+ }
1714
+ get canNext() {
1715
+ return this.playQueue.hasNextItem;
1716
+ }
1717
+ get canSkipBack10() {
1718
+ return this.canSeek;
1719
+ }
1720
+ get canSkipForward30() {
1721
+ return this.canSeek;
1722
+ }
1723
+ get canRemoveFromPlayQueue() {
1724
+ return !this.playQueue.isEmpty;
1725
+ }
1726
+ setPercent(e) {
1727
+ this.player.setPercent(e);
1728
+ }
1729
+ setSeeking(e) {
1730
+ this.player.setSeeking(e);
1731
+ }
1732
+ toggleRepeat() {
1733
+ switch (this.repeat) {
1734
+ case H.Off:
1735
+ this.repeat = H.All;
1736
+ break;
1737
+ case H.All:
1738
+ this.repeat = H.One;
1739
+ break;
1740
+ case H.One:
1741
+ this.repeat = H.Off;
1742
+ break;
1743
+ }
1744
+ }
1745
+ toggleShuffle() {
1746
+ this.shuffle = !this.shuffle;
1747
+ }
1748
+ play() {
1749
+ return this.controller.play();
1750
+ }
1751
+ pause() {
1752
+ return this.controller.pause();
1753
+ }
1754
+ async previous() {
1755
+ if (this.playQueue.hasPreviousItem) {
1756
+ let e = await this.controller.getCurrentTime();
1757
+ e === void 0 || e < 5 ? await this.playQueue.previous() : await this.controller.setCurrentTime(0);
1758
+ } else await this.controller.setCurrentTime(0);
1759
+ }
1760
+ next() {
1761
+ return this.playQueue.next();
1762
+ }
1763
+ async skipBack10() {
1764
+ let e = await this.controller.getCurrentTime();
1765
+ e !== void 0 && await this.controller.setCurrentTime(e - 10);
1766
+ }
1767
+ async skipForward30() {
1768
+ let e = await this.controller.getCurrentTime();
1769
+ e !== void 0 && await this.controller.setCurrentTime(e + 30);
1770
+ }
1771
+ async removeFromPlayQueue() {
1772
+ this.currentItem !== void 0 && await this.playQueue.removeItems([this.currentItem]);
1773
+ }
1774
+ };
1775
+ W([R], q.prototype, "repeat", void 0), W([R], q.prototype, "shuffle", void 0), W([I], q.prototype, "controller", null), W([I], q.prototype, "playing", null), W([I], q.prototype, "percent", null), W([I], q.prototype, "canSeek", null), W([I], q.prototype, "currentItem", null), W([I], q.prototype, "canToggleRepeat", null), W([I], q.prototype, "canToggleShuffle", null), W([I], q.prototype, "canPlay", null), W([I], q.prototype, "canPause", null), W([I], q.prototype, "canPrevious", null), W([I], q.prototype, "canNext", null), W([I], q.prototype, "canSkipBack10", null), W([I], q.prototype, "canSkipForward30", null), W([I], q.prototype, "canRemoveFromPlayQueue", null), W([F.bound], q.prototype, "setPercent", null), W([F.bound], q.prototype, "setSeeking", null), W([F.bound], q.prototype, "toggleRepeat", null), W([F.bound], q.prototype, "toggleShuffle", null), W([F.bound], q.prototype, "play", null), W([F.bound], q.prototype, "pause", null), W([F.bound], q.prototype, "previous", null), W([F.bound], q.prototype, "next", null), W([F.bound], q.prototype, "skipBack10", null), W([F.bound], q.prototype, "skipForward30", null), W([F.bound], q.prototype, "removeFromPlayQueue", null);
1776
+ //#endregion
1777
+ //#region src/features/media-player/providers/BottomBarProvider.tsx
1778
+ var An = ({ children: e }) => {
1779
+ let t = Dn(), n = U(), [r] = c(() => new q(t, n));
1780
+ return B(dn.bottomBar, r.localStorageState), /* @__PURE__ */ j(Je.Provider, {
1781
+ value: r,
1782
+ children: e
1783
+ });
1784
+ }, J = class {
1785
+ player;
1786
+ playQueue;
1787
+ bottomBar;
1788
+ constructor(e, t, n) {
1789
+ this.player = e, this.playQueue = t, this.bottomBar = n, L(this);
1790
+ }
1791
+ get interacted() {
1792
+ return this.playQueue.interacted;
1793
+ }
1794
+ get controller() {
1795
+ return this.player.controller;
1796
+ }
1797
+ get currentItem() {
1798
+ return this.playQueue.currentItem;
1799
+ }
1800
+ async onLoaded() {
1801
+ this.interacted && await this.controller.play();
1802
+ }
1803
+ onPlay() {
1804
+ this.player.onPlay();
1805
+ }
1806
+ onPause() {
1807
+ this.player.onPause();
1808
+ }
1809
+ async onEnded() {
1810
+ switch (this.bottomBar.repeat) {
1811
+ case H.One:
1812
+ await this.controller.setCurrentTime(0);
1813
+ break;
1814
+ case H.Off:
1815
+ case H.All:
1816
+ if (this.playQueue.isLastItem) switch (this.bottomBar.repeat) {
1817
+ case H.Off:
1818
+ this.player.onEnded();
1819
+ break;
1820
+ case H.All:
1821
+ this.playQueue.hasMultipleItems ? await this.playQueue.goToFirst() : await this.controller.setCurrentTime(0);
1822
+ break;
1823
+ }
1824
+ else await this.playQueue.next();
1825
+ break;
1826
+ }
1827
+ }
1828
+ onTimeUpdate(e) {
1829
+ this.player.onTimeUpdate(e);
1830
+ }
1831
+ onControllerChange(e) {
1832
+ this.player.onControllerChange(e);
1833
+ }
1834
+ };
1835
+ W([I], J.prototype, "interacted", null), W([I], J.prototype, "controller", null), W([I], J.prototype, "currentItem", null), W([F.bound], J.prototype, "onLoaded", null), W([F.bound], J.prototype, "onPlay", null), W([F.bound], J.prototype, "onPause", null), W([F.bound], J.prototype, "onEnded", null), W([F.bound], J.prototype, "onTimeUpdate", null), W([F.bound], J.prototype, "onControllerChange", null);
1836
+ //#endregion
1837
+ //#region src/features/media-player/providers/MiniPlayerProvider.tsx
1838
+ var jn = ({ children: e }) => {
1839
+ let t = Dn(), n = U(), r = V(), [i] = c(() => new J(t, n, r));
1840
+ return /* @__PURE__ */ j(Ct.Provider, {
1841
+ value: i,
1842
+ children: e
1843
+ });
1844
+ }, Mn = {
1845
+ type: "object",
1846
+ properties: {
1847
+ version: {
1848
+ type: "string",
1849
+ nullable: !0
1850
+ },
1851
+ repeat: {
1852
+ type: "string",
1853
+ enum: Object.values(H),
1854
+ nullable: !0
1855
+ },
1856
+ shuffle: {
1857
+ type: "boolean",
1858
+ nullable: !0
1859
+ },
1860
+ items: {
1861
+ type: "array",
1862
+ nullable: !0,
1863
+ items: on
1864
+ },
1865
+ currentIndex: {
1866
+ type: "integer",
1867
+ nullable: !0
1868
+ }
1869
+ }
1870
+ }, Y = class e {
1871
+ playQueue;
1872
+ dto;
1873
+ static nextId = 1;
1874
+ id;
1875
+ isSelected = !1;
1876
+ constructor(t, n) {
1877
+ this.playQueue = t, this.dto = n, L(this), this.id = e.nextId++;
1878
+ }
1879
+ static fromDto(t, n) {
1880
+ return new e(t, n);
1881
+ }
1882
+ get url() {
1883
+ return this.dto.url;
1884
+ }
1885
+ get type() {
1886
+ return this.dto.type;
1887
+ }
1888
+ get videoId() {
1889
+ return this.dto.videoId;
1890
+ }
1891
+ get title() {
1892
+ return this.dto.title;
1893
+ }
1894
+ get isCurrent() {
1895
+ return this.playQueue.currentItem === this;
1896
+ }
1897
+ get index() {
1898
+ return this.playQueue.items.indexOf(this);
1899
+ }
1900
+ get isFirst() {
1901
+ return this.index === 0;
1902
+ }
1903
+ get isLast() {
1904
+ return this.index === this.playQueue.items.length - 1;
1905
+ }
1906
+ get canMoveToTop() {
1907
+ return !this.isFirst;
1908
+ }
1909
+ get canMoveToBottom() {
1910
+ return !this.isLast;
1911
+ }
1912
+ get canRemoveToTop() {
1913
+ return !this.isFirst;
1914
+ }
1915
+ get canRemoveOthers() {
1916
+ return this.playQueue.hasMultipleItems;
1917
+ }
1918
+ clone() {
1919
+ return this.playQueue.createItemFromDto(this.dto);
1920
+ }
1921
+ unselect() {
1922
+ this.isSelected = !1;
1923
+ }
1924
+ select() {
1925
+ this.isSelected = !0;
1926
+ }
1927
+ toggleSelected() {
1928
+ this.isSelected = !this.isSelected;
1929
+ }
1930
+ play() {
1931
+ return this.playQueue.setCurrentItem(this), Promise.resolve();
1932
+ }
1933
+ remove() {
1934
+ return this.playQueue.removeItems([this]);
1935
+ }
1936
+ playFirst() {
1937
+ return this.playQueue.playFirst([this.clone()]);
1938
+ }
1939
+ playNext() {
1940
+ return this.playQueue.playNext([this.clone()]);
1941
+ }
1942
+ addToPlayQueue() {
1943
+ return this.playQueue.addItems([this.clone()]);
1944
+ }
1945
+ moveToTop() {
1946
+ this.playQueue.moveItem(this, 0);
1947
+ }
1948
+ moveToBottom() {
1949
+ this.playQueue.moveItem(this, this.playQueue.items.length - 1);
1950
+ }
1951
+ removeToTop() {
1952
+ return this.playQueue.removeItemsAbove(this);
1953
+ }
1954
+ removeOthers() {
1955
+ return this.playQueue.removeOtherItems(this);
1956
+ }
1957
+ };
1958
+ W([R], Y.prototype, "isSelected", void 0), W([I], Y.prototype, "isCurrent", null), W([I], Y.prototype, "index", null), W([I], Y.prototype, "isFirst", null), W([I], Y.prototype, "isLast", null), W([I], Y.prototype, "canMoveToTop", null), W([I], Y.prototype, "canMoveToBottom", null), W([I], Y.prototype, "canRemoveToTop", null), W([I], Y.prototype, "canRemoveOthers", null), W([F.bound], Y.prototype, "unselect", null), W([F.bound], Y.prototype, "select", null), W([F.bound], Y.prototype, "toggleSelected", null), W([F.bound], Y.prototype, "play", null), W([F.bound], Y.prototype, "remove", null), W([F.bound], Y.prototype, "playFirst", null), W([F.bound], Y.prototype, "playNext", null), W([F.bound], Y.prototype, "addToPlayQueue", null), W([F.bound], Y.prototype, "moveToTop", null), W([F.bound], Y.prototype, "moveToBottom", null), W([F.bound], Y.prototype, "removeToTop", null), W([F.bound], Y.prototype, "removeOthers", null);
1959
+ //#endregion
1960
+ //#region src/features/media-player/stores/PlayQueueStore.ts
1961
+ var Nn = class {
1962
+ playQueue;
1963
+ constructor(e) {
1964
+ this.playQueue = e, L(this);
1965
+ }
1966
+ get state() {
1967
+ return {
1968
+ version: "1.0",
1969
+ items: this.playQueue.items.map((e) => e.dto),
1970
+ currentIndex: this.playQueue.currentIndex
1971
+ };
1972
+ }
1973
+ set state(e) {
1974
+ this.playQueue.items = e.items?.map((e) => this.playQueue.createItemFromDto(e)) ?? [], this.playQueue.currentIndex = e.currentIndex;
1975
+ }
1976
+ validateState(e) {
1977
+ return cn(Mn, "PlayQueueDto")(e);
1978
+ }
1979
+ };
1980
+ W([I.struct], Nn.prototype, "state", null);
1981
+ var X = class {
1982
+ interacted = !1;
1983
+ localStorageState;
1984
+ items = [];
1985
+ currentId;
1986
+ constructor() {
1987
+ L(this), this.localStorageState = new Nn(this);
1988
+ }
1989
+ createItemFromDto(e) {
1990
+ return Y.fromDto(this, {
1991
+ url: e.url,
1992
+ type: e.type,
1993
+ videoId: e.videoId,
1994
+ title: e.title
1995
+ });
1996
+ }
1997
+ get isEmpty() {
1998
+ return this.items.length === 0;
1999
+ }
2000
+ get canClear() {
2001
+ return !this.isEmpty;
2002
+ }
2003
+ get currentItem() {
2004
+ return this.items.find((e) => e.id === this.currentId);
2005
+ }
2006
+ get canPlay() {
2007
+ return this.currentItem !== void 0;
2008
+ }
2009
+ get canPause() {
2010
+ return this.currentItem !== void 0;
2011
+ }
2012
+ get hasMultipleItems() {
2013
+ return this.items.length > 1;
2014
+ }
2015
+ get currentIndex() {
2016
+ return this.currentId === void 0 ? void 0 : this.items.findIndex((e) => e.id === this.currentId);
2017
+ }
2018
+ set currentIndex(e) {
2019
+ this.currentId = e === void 0 ? void 0 : this.items.at(e)?.id;
2020
+ }
2021
+ get hasPreviousItem() {
2022
+ return this.hasMultipleItems && this.currentIndex !== void 0 && this.currentIndex > 0;
2023
+ }
2024
+ get hasNextItem() {
2025
+ return this.hasMultipleItems && this.currentIndex !== void 0 && this.currentIndex < this.items.length - 1;
2026
+ }
2027
+ get isLastItem() {
2028
+ return this.currentIndex !== void 0 && this.currentIndex === this.items.length - 1;
2029
+ }
2030
+ get selectedItems() {
2031
+ return this.items.filter((e) => e.isSelected);
2032
+ }
2033
+ get allItemsSelected() {
2034
+ return this.selectedItems.length === this.items.length;
2035
+ }
2036
+ get hasSelectedItems() {
2037
+ return this.selectedItems.length > 0;
2038
+ }
2039
+ get selectedItemsOrAllItems() {
2040
+ return this.hasSelectedItems ? this.selectedItems : this.items;
2041
+ }
2042
+ get canAddSelectedItems() {
2043
+ return !this.isEmpty && this.hasSelectedItems;
2044
+ }
2045
+ get canPlaySelectedItemsNext() {
2046
+ return !this.isEmpty && this.hasSelectedItems;
2047
+ }
2048
+ get canRemoveSelectedItems() {
2049
+ return !this.isEmpty && this.hasSelectedItems;
2050
+ }
2051
+ setItems(e) {
2052
+ this.items = e;
2053
+ }
2054
+ interact() {
2055
+ this.interacted = !0;
2056
+ }
2057
+ clear() {
2058
+ this.interact(), this.currentIndex = void 0, this.items = [];
2059
+ }
2060
+ unselectAll() {
2061
+ for (let e of this.items) e.unselect();
2062
+ }
2063
+ selectAll() {
2064
+ for (let e of this.items) e.select();
2065
+ }
2066
+ setCurrentItem(e) {
2067
+ this.interact(), this.currentId = e?.id;
2068
+ }
2069
+ setNextItems(e) {
2070
+ this.currentIndex !== void 0 && this.items.splice(this.currentIndex + 1, 0, ...e);
2071
+ }
2072
+ clearAndSetItems(e) {
2073
+ this.clear(), this.setCurrentItem(e[0]), this.setNextItems(e);
2074
+ }
2075
+ async playNext(e) {
2076
+ if (this.isEmpty) {
2077
+ this.clearAndSetItems(e);
2078
+ return;
2079
+ }
2080
+ this.setNextItems(e);
2081
+ }
2082
+ async playSelectedItemsNext() {
2083
+ await this.playNext(this.selectedItemsOrAllItems.map((e) => e.clone())), this.unselectAll();
2084
+ }
2085
+ async addItems(e) {
2086
+ if (this.isEmpty) {
2087
+ this.clearAndSetItems(e);
2088
+ return;
2089
+ }
2090
+ this.items.push(...e);
2091
+ }
2092
+ async addSelectedItems() {
2093
+ await this.addItems(this.selectedItemsOrAllItems.map((e) => e.clone())), this.unselectAll();
2094
+ }
2095
+ async playFirst(e) {
2096
+ if (this.isEmpty) {
2097
+ this.clearAndSetItems(e);
2098
+ return;
2099
+ }
2100
+ let { currentIndex: t } = this;
2101
+ t !== void 0 && (this.interact(), this.items.splice(t, 0, ...e), this.currentIndex = t);
2102
+ }
2103
+ moveItem(e, t) {
2104
+ let n = this.items.splice(this.items.indexOf(e), 1)[0];
2105
+ this.items.splice(t, 0, n);
2106
+ }
2107
+ async goToFirst() {
2108
+ this.currentIndex !== void 0 && (this.currentIndex = 0);
2109
+ }
2110
+ async removeItems(e) {
2111
+ let { currentItem: t } = this;
2112
+ z(this.items, ...e.filter((e) => e !== t));
2113
+ let { currentIndex: n, isLastItem: r } = this;
2114
+ z(this.items, e.find((e) => e === t)), this.currentItem !== t && (this.interact(), r ? await this.goToFirst() : this.currentIndex = n);
2115
+ }
2116
+ async removeSelectedItems() {
2117
+ await this.removeItems(this.selectedItemsOrAllItems), this.unselectAll();
2118
+ }
2119
+ async removeOtherItems(e) {
2120
+ let t = e.id;
2121
+ return this.removeItems(this.items.filter((e) => e.id !== t));
2122
+ }
2123
+ async removeItemsAbove(e) {
2124
+ let t = this.items.indexOf(e);
2125
+ return this.removeItems(this.items.filter((e, n) => n < t));
2126
+ }
2127
+ async previous() {
2128
+ this.currentIndex !== void 0 && this.hasPreviousItem && (this.interact(), this.currentIndex--);
2129
+ }
2130
+ async next() {
2131
+ this.currentIndex !== void 0 && this.hasNextItem && (this.interact(), this.currentIndex++);
2132
+ }
2133
+ addItemFromDto(e) {
2134
+ let t = this.createItemFromDto(e);
2135
+ return this.addItems([t]);
2136
+ }
2471
2137
  };
2472
- //# sourceMappingURL=index.es.js.map
2138
+ W([R], X.prototype, "interacted", void 0), W([R], X.prototype, "items", void 0), W([R], X.prototype, "currentId", void 0), W([I], X.prototype, "isEmpty", null), W([I], X.prototype, "canClear", null), W([I], X.prototype, "currentItem", null), W([I], X.prototype, "canPlay", null), W([I], X.prototype, "canPause", null), W([I], X.prototype, "hasMultipleItems", null), W([I], X.prototype, "currentIndex", null), W([I], X.prototype, "hasPreviousItem", null), W([I], X.prototype, "hasNextItem", null), W([I], X.prototype, "isLastItem", null), W([I], X.prototype, "selectedItems", null), W([I], X.prototype, "allItemsSelected", null), W([I], X.prototype, "hasSelectedItems", null), W([I], X.prototype, "selectedItemsOrAllItems", null), W([I], X.prototype, "canAddSelectedItems", null), W([I], X.prototype, "canPlaySelectedItemsNext", null), W([I], X.prototype, "canRemoveSelectedItems", null), W([F.bound], X.prototype, "setItems", null), W([F.bound], X.prototype, "interact", null), W([F.bound], X.prototype, "clear", null), W([F.bound], X.prototype, "unselectAll", null), W([F.bound], X.prototype, "selectAll", null), W([F.bound], X.prototype, "setCurrentItem", null), W([F.bound], X.prototype, "setNextItems", null), W([F.bound], X.prototype, "clearAndSetItems", null), W([F.bound], X.prototype, "playNext", null), W([F.bound], X.prototype, "playSelectedItemsNext", null), W([F.bound], X.prototype, "addItems", null), W([F.bound], X.prototype, "addSelectedItems", null), W([F.bound], X.prototype, "playFirst", null), W([F.bound], X.prototype, "moveItem", null), W([F.bound], X.prototype, "goToFirst", null), W([F.bound], X.prototype, "removeItems", null), W([F.bound], X.prototype, "removeSelectedItems", null), W([F.bound], X.prototype, "removeOtherItems", null), W([F.bound], X.prototype, "removeItemsAbove", null), W([F.bound], X.prototype, "previous", null), W([F.bound], X.prototype, "next", null), W([F.bound], X.prototype, "addItemFromDto", null);
2139
+ //#endregion
2140
+ //#region src/features/media-player/providers/PlayQueueProvider.tsx
2141
+ var Pn = ({ children: e }) => {
2142
+ let [t] = c(() => new X());
2143
+ B(dn.playQueue, t.localStorageState);
2144
+ let n = N();
2145
+ return i(() => Ke(() => t.currentItem, async (e, t) => {
2146
+ e === void 0 || t === void 0 || e.type === t.type && e.videoId === t.videoId && await n.setCurrentTime(0);
2147
+ }), [t, n]), /* @__PURE__ */ j(yt.Provider, {
2148
+ value: t,
2149
+ children: e
2150
+ });
2151
+ }, Z = class {
2152
+ controller = Ue;
2153
+ playing = !1;
2154
+ percent = 0;
2155
+ seeking = !1;
2156
+ constructor() {
2157
+ L(this);
2158
+ }
2159
+ setPlaying(e) {
2160
+ this.playing = e;
2161
+ }
2162
+ setPercent(e) {
2163
+ this.percent = e;
2164
+ }
2165
+ setSeeking(e) {
2166
+ this.seeking = e;
2167
+ }
2168
+ onControllerChange(e) {
2169
+ this.controller = e;
2170
+ }
2171
+ onPlay() {
2172
+ this.playing = !0;
2173
+ }
2174
+ onPause() {
2175
+ this.playing = !1;
2176
+ }
2177
+ onEnded() {
2178
+ this.playing = !1;
2179
+ }
2180
+ onTimeUpdate({ percent: e }) {
2181
+ e !== void 0 && (this.seeking || (this.percent = e));
2182
+ }
2183
+ };
2184
+ W([R], Z.prototype, "controller", void 0), W([R], Z.prototype, "playing", void 0), W([R], Z.prototype, "percent", void 0), W([R], Z.prototype, "seeking", void 0), W([F.bound], Z.prototype, "setPlaying", null), W([F.bound], Z.prototype, "setPercent", null), W([F.bound], Z.prototype, "setSeeking", null), W([F.bound], Z.prototype, "onControllerChange", null), W([F.bound], Z.prototype, "onPlay", null), W([F.bound], Z.prototype, "onPause", null), W([F.bound], Z.prototype, "onEnded", null), W([F.bound], Z.prototype, "onTimeUpdate", null);
2185
+ //#endregion
2186
+ //#region src/features/media-player/providers/PlayerProvider.tsx
2187
+ var Fn = ({ children: e }) => {
2188
+ let [t] = c(() => new Z());
2189
+ return /* @__PURE__ */ j(En.Provider, {
2190
+ value: t,
2191
+ children: e
2192
+ });
2193
+ }, Q = class {
2194
+ playlistList;
2195
+ id;
2196
+ name;
2197
+ constructor(e, t, n) {
2198
+ this.playlistList = e, L(this), this.id = t, this.name = n;
2199
+ }
2200
+ async rename(e) {
2201
+ this.name = e;
2202
+ }
2203
+ remove() {
2204
+ return this.playlistList.removeItem(this);
2205
+ }
2206
+ };
2207
+ W([R], Q.prototype, "id", void 0), W([R], Q.prototype, "name", void 0), W([F.bound], Q.prototype, "rename", null), W([F.bound], Q.prototype, "remove", null);
2208
+ //#endregion
2209
+ //#region src/features/media-player/stores/PlaylistListStore.ts
2210
+ var In = class {
2211
+ playlistList;
2212
+ constructor(e) {
2213
+ this.playlistList = e, L(this);
2214
+ }
2215
+ get state() {
2216
+ return { items: this.playlistList.items.map((e) => ({
2217
+ id: e.id,
2218
+ name: e.name
2219
+ })) };
2220
+ }
2221
+ set state(e) {
2222
+ this.playlistList.items = e.items?.map((e) => new Q(this.playlistList, e.id, e.name)) ?? [];
2223
+ }
2224
+ validateState(e) {
2225
+ return !0;
2226
+ }
2227
+ };
2228
+ W([I.struct], In.prototype, "state", null);
2229
+ var $ = class {
2230
+ localStorageState;
2231
+ items = [];
2232
+ constructor() {
2233
+ L(this), this.localStorageState = new In(this);
2234
+ }
2235
+ createItem(e) {
2236
+ return new Q(this, crypto.randomUUID(), e);
2237
+ }
2238
+ setItems(e) {
2239
+ this.items = e;
2240
+ }
2241
+ async addItem(e) {
2242
+ this.items.push(e);
2243
+ }
2244
+ async removeItem(e) {
2245
+ z(this.items, e);
2246
+ }
2247
+ };
2248
+ W([R], $.prototype, "items", void 0), W([F.bound], $.prototype, "setItems", null), W([F.bound], $.prototype, "addItem", null), W([F.bound], $.prototype, "removeItem", null);
2249
+ //#endregion
2250
+ //#region src/features/media-player/providers/PlaylistListProvider.tsx
2251
+ var Ln = ({ children: e }) => {
2252
+ let [t] = c(() => new $());
2253
+ return B(dn.playlistList, t.localStorageState), /* @__PURE__ */ j(Vt.Provider, {
2254
+ value: t,
2255
+ children: e
2256
+ });
2257
+ }, Rn = ({ components: e = [], children: t }) => /* @__PURE__ */ j(A, { children: e.reduceRight((e, t) => /* @__PURE__ */ j(t, { children: e }), t) }), zn = ({ children: e, nostalgicDivaProps: t }) => /* @__PURE__ */ j(Be, {
2258
+ ...t,
2259
+ children: /* @__PURE__ */ j(Rn, {
2260
+ components: [
2261
+ Fn,
2262
+ Pn,
2263
+ An,
2264
+ jn,
2265
+ Ln
2266
+ ],
2267
+ children: e
2268
+ })
2269
+ });
2270
+ //#endregion
2271
+ export { vt as BottomBar, zn as HydrangeanDivaProvider, St as MediaPlayerLayout, Tt as MiniPlayer, yt as PlayQueueContext, Wt as PlayQueuePage, Bt as PlayQueueSection, hn as PlaylistDetailsPage, Vt as PlaylistListContext, Tn as PlaylistListPage, H as RepeatMode, bt as bottomBarHeight, Ve as findVideoService, U as usePlayQueue, Ht as usePlaylistList, at as videoServiceIcons };
2272
+
2273
+ //# sourceMappingURL=index.es.js.map