@aigamo/hydrangean-diva 0.0.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +93 -0
- package/dist/App.d.ts +3 -0
- package/dist/AppRoutes.d.ts +4 -0
- package/dist/common/components/Compose.d.ts +7 -0
- package/dist/favicon.svg +39 -0
- package/dist/features/media-player/components/AddVideoButton.d.ts +7 -0
- package/dist/features/media-player/components/BottomBar.d.ts +12 -0
- package/dist/features/media-player/components/Header.d.ts +2 -0
- package/dist/features/media-player/components/HydrangeanDiva.d.ts +11 -0
- package/dist/features/media-player/components/MediaPlayerLayout.d.ts +8 -0
- package/dist/features/media-player/components/MiniPlayer.d.ts +15 -0
- package/dist/features/media-player/components/PlayQueueStoreContext.d.ts +8 -0
- package/dist/features/media-player/components/PlayQueueTable.d.ts +9 -0
- package/dist/features/media-player/components/PlayerStoreContext.d.ts +8 -0
- package/dist/features/media-player/components/index.d.ts +6 -0
- package/dist/features/media-player/index.d.ts +2 -0
- package/dist/features/media-player/pages/PlayQueuePage.d.ts +2 -0
- package/dist/features/media-player/stores/IObservableStateProvider.d.ts +4 -0
- package/dist/features/media-player/stores/IPlayQueueItemStore.d.ts +33 -0
- package/dist/features/media-player/stores/IPlayQueueStore.d.ts +15 -0
- package/dist/features/media-player/stores/MobXObservableStateProvider.d.ts +5 -0
- package/dist/features/media-player/stores/ObservableStateProvider.d.ts +5 -0
- package/dist/features/media-player/stores/PlayQueueItemStore.d.ts +39 -0
- package/dist/features/media-player/stores/PlayQueueLocalStorageState.d.ts +10 -0
- package/dist/features/media-player/stores/PlayQueueStore.d.ts +55 -0
- package/dist/features/media-player/stores/PlayerStore.d.ts +15 -0
- package/dist/features/media-player/stores/RepeatMode.d.ts +5 -0
- package/dist/features/media-player/stores/getOrAddSchema.d.ts +2 -0
- package/dist/features/media-player/stores/index.d.ts +6 -0
- package/dist/icons.d.ts +1 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1322 -0
- package/dist/index.es.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/sw.d.ts +1 -0
- package/package.json +109 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,1322 @@
|
|
|
1
|
+
var Q = Object.defineProperty;
|
|
2
|
+
var ee = (t, e, n) => e in t ? Q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var p = (t, e, n) => ee(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { useNostalgicDiva as R, findVideoService as te, NostalgicDiva as ne } from "@aigamo/nostalgic-diva";
|
|
5
|
+
import { EuiRange as j, EuiPopover as F, EuiFormRow as S, EuiFlexGroup as C, EuiButtonIcon as I, EuiIcon as E, EuiContextMenu as ie, EuiBottomBar as se, EuiFlexItem as v, EuiButton as x, EuiModal as re, EuiModalHeader as ae, EuiModalHeaderTitle as le, EuiModalBody as oe, EuiForm as ce, EuiFieldText as V, EuiModalFooter as me, EuiButtonEmpty as de, useEuiTheme as H, EuiTableHeader as ue, EuiTableHeaderCellCheckbox as he, EuiCheckbox as U, EuiTableHeaderCell as w, EuiContextMenuItem as pe, EuiContextMenuPanel as ge, EuiHorizontalRule as L, EuiTableRowCell as O, EuiTableRow as fe, EuiTableRowCellCheckbox as Ee, EuiLink as ve, EuiTable as Ie, EuiFlyout as ye, EuiCodeBlock as be, EuiSpacer as $, EuiPageTemplate as A } from "@elastic/eui";
|
|
6
|
+
import { Speaker2Regular as q, TopSpeedRegular as Te, SkipBack10Regular as xe, SkipForward30Regular as Re, DismissRegular as B, ArrowRepeat1Filled as Ce, ArrowRepeatAllFilled as ke, ArrowRepeatAllOffFilled as we, ArrowShuffleFilled as Pe, ArrowShuffleOffFilled as Se, PreviousFilled as Oe, PauseFilled as Ae, PlayFilled as ze, NextFilled as Me, MoreHorizontalFilled as J, AddRegular as N, ArrowUploadRegular as Fe, ArrowDownloadRegular as Be, PlayRegular as Ne, DeleteRegular as Ve } from "@fluentui/react-icons";
|
|
7
|
+
import { observer as h } from "mobx-react-lite";
|
|
8
|
+
import i, { useCallback as u, memo as y, useState as g, useLayoutEffect as Le, useMemo as G, createContext as W, useContext as X, useEffect as De } from "react";
|
|
9
|
+
import { ReactSortable as je } from "react-sortablejs";
|
|
10
|
+
import { makeObservable as He, action as r, computed as c, observable as b, reaction as Ue } from "mobx";
|
|
11
|
+
import { pull as D } from "lodash-es";
|
|
12
|
+
import $e from "ajv";
|
|
13
|
+
var o = /* @__PURE__ */ ((t) => (t.Off = "Off", t.All = "All", t.One = "One", t))(o || {});
|
|
14
|
+
const Y = 80, qe = h(({ playerStore: t }) => {
|
|
15
|
+
const e = R(), n = u(
|
|
16
|
+
(l) => {
|
|
17
|
+
const m = Number(l.currentTarget.value) / 100;
|
|
18
|
+
t.setPercent(m);
|
|
19
|
+
},
|
|
20
|
+
[t]
|
|
21
|
+
), s = u(
|
|
22
|
+
(l) => {
|
|
23
|
+
l.button === 0 && t.setSeeking(!0);
|
|
24
|
+
},
|
|
25
|
+
[t]
|
|
26
|
+
), a = u(
|
|
27
|
+
async (l) => {
|
|
28
|
+
if (l.button === 0) {
|
|
29
|
+
const m = Number(l.currentTarget.value) / 100;
|
|
30
|
+
t.setSeeking(!1);
|
|
31
|
+
const d = await e.getDuration();
|
|
32
|
+
d !== void 0 && await e.setCurrentTime(d * m);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
[t, e]
|
|
36
|
+
);
|
|
37
|
+
return /* @__PURE__ */ i.createElement(
|
|
38
|
+
j,
|
|
39
|
+
{
|
|
40
|
+
min: 0,
|
|
41
|
+
max: 100,
|
|
42
|
+
step: 1e-7,
|
|
43
|
+
value: t.percent * 100,
|
|
44
|
+
onChange: n,
|
|
45
|
+
onMouseDown: s,
|
|
46
|
+
onMouseUp: a,
|
|
47
|
+
fullWidth: !0,
|
|
48
|
+
showRange: !0,
|
|
49
|
+
css: { blockSize: 32 }
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}), Je = y(
|
|
53
|
+
({ button: t, isOpen: e, closePopover: n }) => {
|
|
54
|
+
const [s, a] = g("0"), l = R();
|
|
55
|
+
Le(() => {
|
|
56
|
+
e && l.getVolume().then((d) => {
|
|
57
|
+
d !== void 0 && a(Math.floor(d * 100).toString());
|
|
58
|
+
});
|
|
59
|
+
}, [e, l]);
|
|
60
|
+
const m = u(
|
|
61
|
+
async (d) => {
|
|
62
|
+
a(d.currentTarget.value), await l.setVolume(Number(d.currentTarget.value) / 100);
|
|
63
|
+
},
|
|
64
|
+
[l]
|
|
65
|
+
);
|
|
66
|
+
return /* @__PURE__ */ i.createElement(
|
|
67
|
+
F,
|
|
68
|
+
{
|
|
69
|
+
button: t,
|
|
70
|
+
isOpen: e,
|
|
71
|
+
closePopover: n,
|
|
72
|
+
anchorPosition: "upRight"
|
|
73
|
+
},
|
|
74
|
+
/* @__PURE__ */ i.createElement(S, null, /* @__PURE__ */ i.createElement(
|
|
75
|
+
C,
|
|
76
|
+
{
|
|
77
|
+
responsive: !1,
|
|
78
|
+
gutterSize: "s",
|
|
79
|
+
justifyContent: "center",
|
|
80
|
+
alignItems: "center"
|
|
81
|
+
},
|
|
82
|
+
/* @__PURE__ */ i.createElement(
|
|
83
|
+
I,
|
|
84
|
+
{
|
|
85
|
+
title: "Mute",
|
|
86
|
+
"aria-label": "Mute",
|
|
87
|
+
iconType: q,
|
|
88
|
+
size: "s",
|
|
89
|
+
iconSize: "l"
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ i.createElement(
|
|
93
|
+
j,
|
|
94
|
+
{
|
|
95
|
+
min: 0,
|
|
96
|
+
max: 100,
|
|
97
|
+
step: 1,
|
|
98
|
+
value: s,
|
|
99
|
+
onChange: m,
|
|
100
|
+
css: { blockSize: 32 }
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
))
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
), Ge = y(
|
|
107
|
+
({
|
|
108
|
+
playQueueStore: t,
|
|
109
|
+
closePopover: e
|
|
110
|
+
}) => {
|
|
111
|
+
const n = R(), s = u(async () => {
|
|
112
|
+
const f = await n.getCurrentTime();
|
|
113
|
+
f !== void 0 && await n.setCurrentTime(f - 10), e();
|
|
114
|
+
}, [n, e]), a = u(async () => {
|
|
115
|
+
const f = await n.getCurrentTime();
|
|
116
|
+
f !== void 0 && await n.setCurrentTime(f + 30), e();
|
|
117
|
+
}, [n, e]), l = u(
|
|
118
|
+
async (f) => {
|
|
119
|
+
await n.setPlaybackRate(f), e();
|
|
120
|
+
},
|
|
121
|
+
[n, e]
|
|
122
|
+
), m = u(async () => {
|
|
123
|
+
t.currentItem !== void 0 && await t.removeItems([
|
|
124
|
+
t.currentItem
|
|
125
|
+
]), e();
|
|
126
|
+
}, [t, e]), [d] = g(), T = G(
|
|
127
|
+
() => [
|
|
128
|
+
{
|
|
129
|
+
id: 0,
|
|
130
|
+
items: [
|
|
131
|
+
{
|
|
132
|
+
name: "Speed",
|
|
133
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: Te, size: "m" }),
|
|
134
|
+
panel: 1
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "Skip back 10 seconds",
|
|
138
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: xe, size: "m" }),
|
|
139
|
+
onClick: s,
|
|
140
|
+
disabled: t.isEmpty
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "Skip forward 30 seconds",
|
|
144
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: Re, size: "m" }),
|
|
145
|
+
onClick: a,
|
|
146
|
+
disabled: t.isEmpty
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
isSeparator: !0
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "Remove from play queue",
|
|
153
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: B, size: "m" }),
|
|
154
|
+
onClick: m,
|
|
155
|
+
disabled: t.isEmpty
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: 1,
|
|
161
|
+
title: "Speed",
|
|
162
|
+
items: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2].map(
|
|
163
|
+
(f) => ({
|
|
164
|
+
name: f.toString(),
|
|
165
|
+
onClick: () => l(f),
|
|
166
|
+
icon: f === d ? "check" : "empty"
|
|
167
|
+
})
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
t,
|
|
173
|
+
s,
|
|
174
|
+
a,
|
|
175
|
+
m,
|
|
176
|
+
l,
|
|
177
|
+
d
|
|
178
|
+
]
|
|
179
|
+
);
|
|
180
|
+
return /* @__PURE__ */ i.createElement(ie, { initialPanelId: 0, panels: T });
|
|
181
|
+
}
|
|
182
|
+
), We = y(
|
|
183
|
+
({
|
|
184
|
+
playQueueStore: t,
|
|
185
|
+
button: e,
|
|
186
|
+
isOpen: n,
|
|
187
|
+
closePopover: s
|
|
188
|
+
}) => /* @__PURE__ */ i.createElement(
|
|
189
|
+
F,
|
|
190
|
+
{
|
|
191
|
+
button: e,
|
|
192
|
+
isOpen: n,
|
|
193
|
+
closePopover: s,
|
|
194
|
+
panelPaddingSize: "none",
|
|
195
|
+
anchorPosition: "upRight"
|
|
196
|
+
},
|
|
197
|
+
/* @__PURE__ */ i.createElement(
|
|
198
|
+
Ge,
|
|
199
|
+
{
|
|
200
|
+
playQueueStore: t,
|
|
201
|
+
closePopover: s
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
)
|
|
205
|
+
), Xe = {
|
|
206
|
+
[o.Off]: we,
|
|
207
|
+
[o.All]: ke,
|
|
208
|
+
[o.One]: Ce
|
|
209
|
+
}, Ye = h(
|
|
210
|
+
({
|
|
211
|
+
playerStore: t,
|
|
212
|
+
playQueueStore: e
|
|
213
|
+
}) => {
|
|
214
|
+
const n = R(), s = u(async () => {
|
|
215
|
+
if (e.hasPreviousItem) {
|
|
216
|
+
const a = await n.getCurrentTime();
|
|
217
|
+
a === void 0 || a < 5 ? await e.previous() : await n.setCurrentTime(0);
|
|
218
|
+
} else
|
|
219
|
+
await n.setCurrentTime(0);
|
|
220
|
+
}, [e, n]);
|
|
221
|
+
return /* @__PURE__ */ i.createElement(
|
|
222
|
+
C,
|
|
223
|
+
{
|
|
224
|
+
responsive: !1,
|
|
225
|
+
gutterSize: "s",
|
|
226
|
+
justifyContent: "center",
|
|
227
|
+
alignItems: "center"
|
|
228
|
+
},
|
|
229
|
+
/* @__PURE__ */ i.createElement(
|
|
230
|
+
I,
|
|
231
|
+
{
|
|
232
|
+
title: `Shuffle: ${e.shuffle ? "On" : "Off"}`,
|
|
233
|
+
"aria-label": `Shuffle: ${e.shuffle ? "On" : "Off"}`,
|
|
234
|
+
iconType: e.shuffle ? Pe : Se,
|
|
235
|
+
size: "s",
|
|
236
|
+
iconSize: "l",
|
|
237
|
+
onClick: e.toggleShuffle,
|
|
238
|
+
disabled: !0
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ i.createElement(
|
|
242
|
+
I,
|
|
243
|
+
{
|
|
244
|
+
title: "Previous",
|
|
245
|
+
"aria-label": "Previous",
|
|
246
|
+
iconType: Oe,
|
|
247
|
+
size: "s",
|
|
248
|
+
iconSize: "l",
|
|
249
|
+
onClick: s,
|
|
250
|
+
disabled: e.isEmpty
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
t.playing ? /* @__PURE__ */ i.createElement(
|
|
254
|
+
I,
|
|
255
|
+
{
|
|
256
|
+
title: "Pause",
|
|
257
|
+
"aria-label": "Pause",
|
|
258
|
+
iconType: Ae,
|
|
259
|
+
size: "s",
|
|
260
|
+
iconSize: "l",
|
|
261
|
+
onClick: () => n.pause(),
|
|
262
|
+
disabled: !e.canPlay
|
|
263
|
+
}
|
|
264
|
+
) : /* @__PURE__ */ i.createElement(
|
|
265
|
+
I,
|
|
266
|
+
{
|
|
267
|
+
title: "Play",
|
|
268
|
+
"aria-label": "Play",
|
|
269
|
+
iconType: ze,
|
|
270
|
+
size: "s",
|
|
271
|
+
iconSize: "l",
|
|
272
|
+
onClick: () => n.play(),
|
|
273
|
+
disabled: !e.canPlay
|
|
274
|
+
}
|
|
275
|
+
),
|
|
276
|
+
/* @__PURE__ */ i.createElement(
|
|
277
|
+
I,
|
|
278
|
+
{
|
|
279
|
+
title: "Next",
|
|
280
|
+
"aria-label": "Next",
|
|
281
|
+
iconType: Me,
|
|
282
|
+
size: "s",
|
|
283
|
+
iconSize: "l",
|
|
284
|
+
onClick: e.next,
|
|
285
|
+
disabled: !e.hasNextItem
|
|
286
|
+
}
|
|
287
|
+
),
|
|
288
|
+
/* @__PURE__ */ i.createElement(
|
|
289
|
+
I,
|
|
290
|
+
{
|
|
291
|
+
title: `Repeat: ${e.repeat === o.All ? "All" : e.repeat === o.One ? "One" : "Off"}`,
|
|
292
|
+
"aria-label": `Repeat: ${e.repeat === o.All ? "All" : e.repeat === o.One ? "One" : "Off"}`,
|
|
293
|
+
iconType: Xe[e.repeat],
|
|
294
|
+
size: "s",
|
|
295
|
+
iconSize: "l",
|
|
296
|
+
onClick: e.toggleRepeat
|
|
297
|
+
}
|
|
298
|
+
)
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
), Ke = y(() => {
|
|
302
|
+
const [t, e] = g(!1), n = () => e(!t);
|
|
303
|
+
return /* @__PURE__ */ i.createElement(
|
|
304
|
+
Je,
|
|
305
|
+
{
|
|
306
|
+
button: /* @__PURE__ */ i.createElement(
|
|
307
|
+
I,
|
|
308
|
+
{
|
|
309
|
+
title: "Volume",
|
|
310
|
+
"aria-label": "Volume",
|
|
311
|
+
iconType: q,
|
|
312
|
+
size: "s",
|
|
313
|
+
iconSize: "l",
|
|
314
|
+
onClick: n
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
isOpen: t,
|
|
318
|
+
closePopover: () => e(!1)
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
}), Ze = y(
|
|
322
|
+
({ playQueueStore: t }) => {
|
|
323
|
+
const [e, n] = g(!1), s = () => n(!e);
|
|
324
|
+
return /* @__PURE__ */ i.createElement(
|
|
325
|
+
We,
|
|
326
|
+
{
|
|
327
|
+
playQueueStore: t,
|
|
328
|
+
button: /* @__PURE__ */ i.createElement(
|
|
329
|
+
I,
|
|
330
|
+
{
|
|
331
|
+
title: "More options",
|
|
332
|
+
"aria-label": "More options",
|
|
333
|
+
iconType: J,
|
|
334
|
+
size: "s",
|
|
335
|
+
iconSize: "l",
|
|
336
|
+
onClick: s
|
|
337
|
+
}
|
|
338
|
+
),
|
|
339
|
+
isOpen: e,
|
|
340
|
+
closePopover: () => n(!1)
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
), _e = y(
|
|
345
|
+
({ playQueueStore: t }) => /* @__PURE__ */ i.createElement(
|
|
346
|
+
C,
|
|
347
|
+
{
|
|
348
|
+
responsive: !1,
|
|
349
|
+
gutterSize: "s",
|
|
350
|
+
justifyContent: "flexEnd",
|
|
351
|
+
alignItems: "center"
|
|
352
|
+
},
|
|
353
|
+
/* @__PURE__ */ i.createElement(Ke, null),
|
|
354
|
+
/* @__PURE__ */ i.createElement(Ze, { playQueueStore: t })
|
|
355
|
+
)
|
|
356
|
+
), Pt = h(
|
|
357
|
+
({ playerStore: t, playQueueStore: e }) => /* @__PURE__ */ i.createElement(se, { paddingSize: "s" }, /* @__PURE__ */ i.createElement(C, { direction: "column", gutterSize: "none" }, /* @__PURE__ */ i.createElement(v, null, /* @__PURE__ */ i.createElement(qe, { playerStore: t })), /* @__PURE__ */ i.createElement(v, null, /* @__PURE__ */ i.createElement(C, { responsive: !1 }, /* @__PURE__ */ i.createElement(v, { css: { width: "calc(100% / 3)" } }), /* @__PURE__ */ i.createElement(v, { css: { width: "calc(100% / 3)" } }, /* @__PURE__ */ i.createElement(
|
|
358
|
+
Ye,
|
|
359
|
+
{
|
|
360
|
+
playerStore: t,
|
|
361
|
+
playQueueStore: e
|
|
362
|
+
}
|
|
363
|
+
)), /* @__PURE__ */ i.createElement(v, { css: { width: "calc(100% / 3)" } }, /* @__PURE__ */ i.createElement(
|
|
364
|
+
_e,
|
|
365
|
+
{
|
|
366
|
+
playQueueStore: e
|
|
367
|
+
}
|
|
368
|
+
))))))
|
|
369
|
+
), Qe = ({
|
|
370
|
+
onCancel: t,
|
|
371
|
+
onSave: e
|
|
372
|
+
}) => {
|
|
373
|
+
const [n, s] = g(""), [a, l] = g(""), [m, d] = g(!1);
|
|
374
|
+
return /* @__PURE__ */ React.createElement(re, { onClose: t, initialFocus: "[name=url]" }, /* @__PURE__ */ React.createElement(ae, null, /* @__PURE__ */ React.createElement(le, null, "Add video")), /* @__PURE__ */ React.createElement(oe, null, /* @__PURE__ */ React.createElement(ce, { component: "form" }, /* @__PURE__ */ React.createElement(S, { label: "URL" }, /* @__PURE__ */ React.createElement(
|
|
375
|
+
V,
|
|
376
|
+
{
|
|
377
|
+
name: "url",
|
|
378
|
+
value: n,
|
|
379
|
+
onChange: (T) => s(T.target.value)
|
|
380
|
+
}
|
|
381
|
+
)), /* @__PURE__ */ React.createElement(S, { label: "Title" }, /* @__PURE__ */ React.createElement(
|
|
382
|
+
V,
|
|
383
|
+
{
|
|
384
|
+
name: "title",
|
|
385
|
+
value: a,
|
|
386
|
+
onChange: (T) => l(T.target.value)
|
|
387
|
+
}
|
|
388
|
+
)))), /* @__PURE__ */ React.createElement(me, null, /* @__PURE__ */ React.createElement(de, { onClick: t }, "Cancel"), /* @__PURE__ */ React.createElement(
|
|
389
|
+
x,
|
|
390
|
+
{
|
|
391
|
+
type: "submit",
|
|
392
|
+
onClick: async () => {
|
|
393
|
+
try {
|
|
394
|
+
d(!0), await e({ url: n, title: a });
|
|
395
|
+
} finally {
|
|
396
|
+
d(!1);
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
fill: !0,
|
|
400
|
+
disabled: n.trim().length === 0,
|
|
401
|
+
isLoading: m
|
|
402
|
+
},
|
|
403
|
+
"Save"
|
|
404
|
+
)));
|
|
405
|
+
};
|
|
406
|
+
function et(t) {
|
|
407
|
+
return t !== null && typeof t == "object" && "title" in t && typeof t.title == "string";
|
|
408
|
+
}
|
|
409
|
+
const tt = y(
|
|
410
|
+
({ playQueueStore: t }) => {
|
|
411
|
+
const [e, n] = g(!1), s = u(
|
|
412
|
+
async (a) => {
|
|
413
|
+
const l = te(a.url);
|
|
414
|
+
if (l !== void 0) {
|
|
415
|
+
const m = l.extractVideoId(a.url);
|
|
416
|
+
if (m !== void 0) {
|
|
417
|
+
const T = await (await fetch(
|
|
418
|
+
`https://noembed.com/embed?url=${encodeURIComponent(
|
|
419
|
+
a.url
|
|
420
|
+
)}`
|
|
421
|
+
)).json();
|
|
422
|
+
await t.addItems([
|
|
423
|
+
t.createItem({
|
|
424
|
+
url: a.url,
|
|
425
|
+
type: l.type,
|
|
426
|
+
videoId: m,
|
|
427
|
+
title: a.title || (et(T) ? T.title : m)
|
|
428
|
+
})
|
|
429
|
+
]);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
n(!1);
|
|
433
|
+
},
|
|
434
|
+
[t]
|
|
435
|
+
);
|
|
436
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
437
|
+
x,
|
|
438
|
+
{
|
|
439
|
+
onClick: () => n(!0),
|
|
440
|
+
iconType: N,
|
|
441
|
+
color: "primary"
|
|
442
|
+
},
|
|
443
|
+
"Add video"
|
|
444
|
+
), e && /* @__PURE__ */ React.createElement(
|
|
445
|
+
Qe,
|
|
446
|
+
{
|
|
447
|
+
onCancel: () => n(!1),
|
|
448
|
+
onSave: s
|
|
449
|
+
}
|
|
450
|
+
));
|
|
451
|
+
}
|
|
452
|
+
), nt = h(
|
|
453
|
+
({ playQueueStore: t }) => {
|
|
454
|
+
const { euiTheme: e } = H();
|
|
455
|
+
return /* @__PURE__ */ i.createElement(
|
|
456
|
+
ue,
|
|
457
|
+
{
|
|
458
|
+
style: {
|
|
459
|
+
position: "sticky",
|
|
460
|
+
top: 112,
|
|
461
|
+
zIndex: 998,
|
|
462
|
+
background: e.colors.backgroundBasePlain
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
/* @__PURE__ */ i.createElement(he, null, /* @__PURE__ */ i.createElement(
|
|
466
|
+
U,
|
|
467
|
+
{
|
|
468
|
+
id: "",
|
|
469
|
+
checked: t.allItemsSelected,
|
|
470
|
+
onChange: (n) => {
|
|
471
|
+
t.allItemsSelected = n.target.checked;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
)),
|
|
475
|
+
/* @__PURE__ */ i.createElement(w, { width: 24 }),
|
|
476
|
+
/* @__PURE__ */ i.createElement(w, null, "Title"),
|
|
477
|
+
/* @__PURE__ */ i.createElement(w, null)
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
), it = y(
|
|
481
|
+
({
|
|
482
|
+
item: t,
|
|
483
|
+
closePopover: e
|
|
484
|
+
}) => {
|
|
485
|
+
const n = y(
|
|
486
|
+
({
|
|
487
|
+
onClick: s,
|
|
488
|
+
...a
|
|
489
|
+
}) => {
|
|
490
|
+
const l = u(
|
|
491
|
+
(m) => {
|
|
492
|
+
e(), s == null || s(m);
|
|
493
|
+
},
|
|
494
|
+
[s]
|
|
495
|
+
);
|
|
496
|
+
return /* @__PURE__ */ i.createElement(pe, { ...a, onClick: l });
|
|
497
|
+
}
|
|
498
|
+
);
|
|
499
|
+
return /* @__PURE__ */ i.createElement(ge, null, /* @__PURE__ */ i.createElement(
|
|
500
|
+
n,
|
|
501
|
+
{
|
|
502
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: "" }),
|
|
503
|
+
onClick: t.playFirst
|
|
504
|
+
},
|
|
505
|
+
"Play first"
|
|
506
|
+
), /* @__PURE__ */ i.createElement(
|
|
507
|
+
n,
|
|
508
|
+
{
|
|
509
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: "" }),
|
|
510
|
+
onClick: t.playNext
|
|
511
|
+
},
|
|
512
|
+
"Play next"
|
|
513
|
+
), /* @__PURE__ */ i.createElement(
|
|
514
|
+
n,
|
|
515
|
+
{
|
|
516
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: N }),
|
|
517
|
+
onClick: t.addToPlayQueue
|
|
518
|
+
},
|
|
519
|
+
"Add to play queue"
|
|
520
|
+
), /* @__PURE__ */ i.createElement(L, { margin: "none" }), /* @__PURE__ */ i.createElement(
|
|
521
|
+
n,
|
|
522
|
+
{
|
|
523
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: Fe }),
|
|
524
|
+
onClick: t.moveToTop,
|
|
525
|
+
disabled: !t.canMoveToTop
|
|
526
|
+
},
|
|
527
|
+
"Move to the top"
|
|
528
|
+
), /* @__PURE__ */ i.createElement(
|
|
529
|
+
n,
|
|
530
|
+
{
|
|
531
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: Be }),
|
|
532
|
+
onClick: t.moveToBottom,
|
|
533
|
+
disabled: !t.canMoveToBottom
|
|
534
|
+
},
|
|
535
|
+
"Move to the bottom"
|
|
536
|
+
), /* @__PURE__ */ i.createElement(L, { margin: "none" }), /* @__PURE__ */ i.createElement(
|
|
537
|
+
n,
|
|
538
|
+
{
|
|
539
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: "" }),
|
|
540
|
+
onClick: t.removeToTop,
|
|
541
|
+
disabled: !t.canRemoveToTop
|
|
542
|
+
},
|
|
543
|
+
"Remove to the top"
|
|
544
|
+
), /* @__PURE__ */ i.createElement(
|
|
545
|
+
n,
|
|
546
|
+
{
|
|
547
|
+
icon: /* @__PURE__ */ i.createElement(E, { type: "" }),
|
|
548
|
+
onClick: t.removeOthers,
|
|
549
|
+
disabled: !t.canRemoveOthers
|
|
550
|
+
},
|
|
551
|
+
"Remove others"
|
|
552
|
+
));
|
|
553
|
+
}
|
|
554
|
+
), st = y(
|
|
555
|
+
({ item: t }) => {
|
|
556
|
+
const [e, n] = g(!1), s = u(() => n(!e), [e]), a = u(() => n(!1), []);
|
|
557
|
+
return /* @__PURE__ */ i.createElement(
|
|
558
|
+
F,
|
|
559
|
+
{
|
|
560
|
+
button: /* @__PURE__ */ i.createElement(
|
|
561
|
+
I,
|
|
562
|
+
{
|
|
563
|
+
title: "More options",
|
|
564
|
+
"aria-label": "More options",
|
|
565
|
+
iconType: J,
|
|
566
|
+
size: "s",
|
|
567
|
+
color: "text",
|
|
568
|
+
onClick: s
|
|
569
|
+
}
|
|
570
|
+
),
|
|
571
|
+
isOpen: e,
|
|
572
|
+
closePopover: a,
|
|
573
|
+
panelPaddingSize: "none",
|
|
574
|
+
anchorPosition: "leftCenter"
|
|
575
|
+
},
|
|
576
|
+
/* @__PURE__ */ i.createElement(
|
|
577
|
+
it,
|
|
578
|
+
{
|
|
579
|
+
item: t,
|
|
580
|
+
closePopover: a
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
), rt = h(
|
|
586
|
+
({ item: t }) => {
|
|
587
|
+
const e = R();
|
|
588
|
+
return /* @__PURE__ */ i.createElement(O, { textOnly: !1, hasActions: !0, align: "right" }, /* @__PURE__ */ i.createElement(
|
|
589
|
+
x,
|
|
590
|
+
{
|
|
591
|
+
iconType: Ne,
|
|
592
|
+
size: "s",
|
|
593
|
+
onClick: async () => {
|
|
594
|
+
t.isCurrent ? await e.setCurrentTime(0) : t.play();
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
"Play"
|
|
598
|
+
), /* @__PURE__ */ i.createElement(
|
|
599
|
+
x,
|
|
600
|
+
{
|
|
601
|
+
iconType: B,
|
|
602
|
+
size: "s",
|
|
603
|
+
onClick: t.remove
|
|
604
|
+
},
|
|
605
|
+
"Remove"
|
|
606
|
+
), /* @__PURE__ */ i.createElement(st, { item: t }));
|
|
607
|
+
}
|
|
608
|
+
), at = {
|
|
609
|
+
Audio: "",
|
|
610
|
+
Dailymotion: "https://www.dailymotion.com/favicon.ico",
|
|
611
|
+
Niconico: "https://www.nicovideo.jp/favicon.ico",
|
|
612
|
+
SoundCloud: "https://soundcloud.com/favicon.ico",
|
|
613
|
+
Twitch: "https://www.twitch.tv/favicon.ico",
|
|
614
|
+
Vimeo: "https://vimeo.com/favicon.ico",
|
|
615
|
+
YouTube: "https://www.youtube.com/favicon.ico"
|
|
616
|
+
}, lt = h(
|
|
617
|
+
({ item: t }) => {
|
|
618
|
+
const e = R();
|
|
619
|
+
return /* @__PURE__ */ i.createElement(fe, { key: t.id, isSelected: t.isCurrent }, /* @__PURE__ */ i.createElement(Ee, null, /* @__PURE__ */ i.createElement(
|
|
620
|
+
U,
|
|
621
|
+
{
|
|
622
|
+
id: t.id.toString(),
|
|
623
|
+
checked: t.isSelected,
|
|
624
|
+
onChange: t.toggleSelected
|
|
625
|
+
}
|
|
626
|
+
)), /* @__PURE__ */ i.createElement(O, { textOnly: !1 }, /* @__PURE__ */ i.createElement(
|
|
627
|
+
"img",
|
|
628
|
+
{
|
|
629
|
+
src: at[t.type],
|
|
630
|
+
width: 16,
|
|
631
|
+
height: 16,
|
|
632
|
+
alt: t.type
|
|
633
|
+
}
|
|
634
|
+
)), /* @__PURE__ */ i.createElement(O, null, /* @__PURE__ */ i.createElement(
|
|
635
|
+
ve,
|
|
636
|
+
{
|
|
637
|
+
href: t.url,
|
|
638
|
+
target: "_blank",
|
|
639
|
+
external: !0,
|
|
640
|
+
onClick: () => e.pause()
|
|
641
|
+
},
|
|
642
|
+
t.title
|
|
643
|
+
)), /* @__PURE__ */ i.createElement(rt, { item: t }));
|
|
644
|
+
}
|
|
645
|
+
), ot = h(
|
|
646
|
+
({ playQueueStore: t }) => /* @__PURE__ */ i.createElement(
|
|
647
|
+
je,
|
|
648
|
+
{
|
|
649
|
+
tag: "tbody",
|
|
650
|
+
list: t.items,
|
|
651
|
+
setList: (e) => t.setItems(e)
|
|
652
|
+
},
|
|
653
|
+
t.items.map((e) => /* @__PURE__ */ i.createElement(lt, { key: e.id, item: e }))
|
|
654
|
+
)
|
|
655
|
+
), ct = h(
|
|
656
|
+
({ playQueueStore: t }) => /* @__PURE__ */ i.createElement(Ie, null, /* @__PURE__ */ i.createElement(nt, { playQueueStore: t }), /* @__PURE__ */ i.createElement(ot, { playQueueStore: t }))
|
|
657
|
+
), mt = h(
|
|
658
|
+
({ playQueueStore: t }) => {
|
|
659
|
+
const [e, n] = g(!1);
|
|
660
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, e && /* @__PURE__ */ React.createElement(
|
|
661
|
+
ye,
|
|
662
|
+
{
|
|
663
|
+
type: "push",
|
|
664
|
+
size: "s",
|
|
665
|
+
onClose: () => n(!1)
|
|
666
|
+
},
|
|
667
|
+
/* @__PURE__ */ React.createElement("div", { style: { blockSize: "100%" } }, /* @__PURE__ */ React.createElement(
|
|
668
|
+
be,
|
|
669
|
+
{
|
|
670
|
+
language: "json",
|
|
671
|
+
overflowHeight: "100%",
|
|
672
|
+
isCopyable: !0,
|
|
673
|
+
isVirtualized: !0
|
|
674
|
+
},
|
|
675
|
+
JSON.stringify(
|
|
676
|
+
t.localStorageState,
|
|
677
|
+
void 0,
|
|
678
|
+
2
|
|
679
|
+
)
|
|
680
|
+
))
|
|
681
|
+
), /* @__PURE__ */ React.createElement(tt, { playQueueStore: t }));
|
|
682
|
+
}
|
|
683
|
+
), dt = h(
|
|
684
|
+
({ playerStore: t, playQueueStore: e }) => {
|
|
685
|
+
const { euiTheme: n } = H();
|
|
686
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
687
|
+
C,
|
|
688
|
+
{
|
|
689
|
+
alignItems: "center",
|
|
690
|
+
gutterSize: "m",
|
|
691
|
+
style: {
|
|
692
|
+
position: "sticky",
|
|
693
|
+
top: 48,
|
|
694
|
+
zIndex: 998,
|
|
695
|
+
background: n.colors.backgroundBasePlain
|
|
696
|
+
}
|
|
697
|
+
},
|
|
698
|
+
/* @__PURE__ */ React.createElement(v, { grow: !1 }, /* @__PURE__ */ React.createElement(
|
|
699
|
+
x,
|
|
700
|
+
{
|
|
701
|
+
disabled: e.isEmpty || e.selectedItems.length === 0,
|
|
702
|
+
onClick: e.playSelectedItemsNext
|
|
703
|
+
},
|
|
704
|
+
"Play next"
|
|
705
|
+
)),
|
|
706
|
+
/* @__PURE__ */ React.createElement(v, { grow: !1 }, /* @__PURE__ */ React.createElement(
|
|
707
|
+
x,
|
|
708
|
+
{
|
|
709
|
+
iconType: N,
|
|
710
|
+
onClick: e.addSelectedItems,
|
|
711
|
+
disabled: e.isEmpty || e.selectedItems.length === 0
|
|
712
|
+
},
|
|
713
|
+
"Add to play queue"
|
|
714
|
+
)),
|
|
715
|
+
/* @__PURE__ */ React.createElement(v, { grow: !1 }, /* @__PURE__ */ React.createElement(
|
|
716
|
+
x,
|
|
717
|
+
{
|
|
718
|
+
iconType: B,
|
|
719
|
+
onClick: e.removeSelectedItems,
|
|
720
|
+
disabled: e.isEmpty || e.selectedItems.length === 0
|
|
721
|
+
},
|
|
722
|
+
"Remove"
|
|
723
|
+
)),
|
|
724
|
+
/* @__PURE__ */ React.createElement(v, { grow: !1 }, /* @__PURE__ */ React.createElement(
|
|
725
|
+
x,
|
|
726
|
+
{
|
|
727
|
+
iconType: Ve,
|
|
728
|
+
onClick: e.clear,
|
|
729
|
+
disabled: e.isEmpty
|
|
730
|
+
},
|
|
731
|
+
"Clear"
|
|
732
|
+
)),
|
|
733
|
+
/* @__PURE__ */ React.createElement(v, { grow: !0 }),
|
|
734
|
+
/* @__PURE__ */ React.createElement(v, { grow: !1 }, /* @__PURE__ */ React.createElement(mt, { playQueueStore: e }))
|
|
735
|
+
), !e.isEmpty && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
736
|
+
$,
|
|
737
|
+
{
|
|
738
|
+
size: "l",
|
|
739
|
+
style: {
|
|
740
|
+
position: "sticky",
|
|
741
|
+
top: 88,
|
|
742
|
+
zIndex: 998,
|
|
743
|
+
background: n.colors.backgroundBasePlain
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
), /* @__PURE__ */ React.createElement(ct, { playQueueStore: e })));
|
|
747
|
+
}
|
|
748
|
+
), St = h(
|
|
749
|
+
({ playerStore: t, playQueueStore: e }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
750
|
+
A.Header,
|
|
751
|
+
{
|
|
752
|
+
pageTitle: "Play queue",
|
|
753
|
+
rightSideItems: []
|
|
754
|
+
}
|
|
755
|
+
), /* @__PURE__ */ React.createElement(A.Section, null, /* @__PURE__ */ React.createElement(
|
|
756
|
+
dt,
|
|
757
|
+
{
|
|
758
|
+
playerStore: t,
|
|
759
|
+
playQueueStore: e
|
|
760
|
+
}
|
|
761
|
+
)))
|
|
762
|
+
), z = {
|
|
763
|
+
width: 16 * 25,
|
|
764
|
+
height: 9 * 25
|
|
765
|
+
}, Ot = h(
|
|
766
|
+
({ playerStore: t, playQueueStore: e }) => {
|
|
767
|
+
const n = R(), s = u(async () => {
|
|
768
|
+
e.interacted && await n.play();
|
|
769
|
+
}, [e, n]), a = u(async () => {
|
|
770
|
+
switch (e.repeat) {
|
|
771
|
+
case o.One:
|
|
772
|
+
await n.setCurrentTime(0);
|
|
773
|
+
break;
|
|
774
|
+
case o.Off:
|
|
775
|
+
case o.All:
|
|
776
|
+
if (e.isLastItem)
|
|
777
|
+
switch (e.repeat) {
|
|
778
|
+
case o.Off:
|
|
779
|
+
t.onEnded();
|
|
780
|
+
break;
|
|
781
|
+
case o.All:
|
|
782
|
+
e.hasMultipleItems ? await e.goToFirst() : await n.setCurrentTime(0);
|
|
783
|
+
break;
|
|
784
|
+
}
|
|
785
|
+
else
|
|
786
|
+
await e.next();
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
}, [e, t, n]), l = G(
|
|
790
|
+
() => ({
|
|
791
|
+
onLoaded: s,
|
|
792
|
+
onPlay: t.onPlay,
|
|
793
|
+
onPause: t.onPause,
|
|
794
|
+
onEnded: a,
|
|
795
|
+
onTimeUpdate: t.onTimeUpdate
|
|
796
|
+
}),
|
|
797
|
+
[t, s, a]
|
|
798
|
+
);
|
|
799
|
+
return /* @__PURE__ */ React.createElement(
|
|
800
|
+
"div",
|
|
801
|
+
{
|
|
802
|
+
css: {
|
|
803
|
+
position: "fixed",
|
|
804
|
+
right: 0,
|
|
805
|
+
bottom: Y,
|
|
806
|
+
width: z.width,
|
|
807
|
+
height: z.height,
|
|
808
|
+
zIndex: 998,
|
|
809
|
+
backgroundColor: "rgb(39, 39, 39)",
|
|
810
|
+
display: "flex",
|
|
811
|
+
flexDirection: "column"
|
|
812
|
+
}
|
|
813
|
+
},
|
|
814
|
+
/* @__PURE__ */ React.createElement("div", { css: { flexGrow: 1, backgroundColor: "black" } }, e.currentItem && /* @__PURE__ */ React.createElement(
|
|
815
|
+
ne,
|
|
816
|
+
{
|
|
817
|
+
src: e.currentItem.url,
|
|
818
|
+
options: l
|
|
819
|
+
}
|
|
820
|
+
))
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
);
|
|
824
|
+
class K {
|
|
825
|
+
makeObservable(e, n) {
|
|
826
|
+
return He(e, n);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
const k = class k {
|
|
830
|
+
constructor(e, n, s) {
|
|
831
|
+
p(this, "id");
|
|
832
|
+
p(this, "isSelected", !1);
|
|
833
|
+
this.observableStateProvider = e, this.playQueueStore = n, this.dto = s, this.id = k.nextId++, e.makeObservable(this, {
|
|
834
|
+
isSelected: b,
|
|
835
|
+
isCurrent: c,
|
|
836
|
+
index: c,
|
|
837
|
+
isFirst: c,
|
|
838
|
+
isLast: c,
|
|
839
|
+
canMoveToTop: c,
|
|
840
|
+
canMoveToBottom: c,
|
|
841
|
+
canRemoveToTop: c,
|
|
842
|
+
canRemoveOthers: c,
|
|
843
|
+
unselect: r,
|
|
844
|
+
toggleSelected: r.bound,
|
|
845
|
+
play: r,
|
|
846
|
+
remove: r.bound,
|
|
847
|
+
playFirst: r.bound,
|
|
848
|
+
playNext: r.bound,
|
|
849
|
+
addToPlayQueue: r.bound,
|
|
850
|
+
moveToTop: r.bound,
|
|
851
|
+
moveToBottom: r.bound,
|
|
852
|
+
removeToTop: r.bound,
|
|
853
|
+
removeOthers: r.bound
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
static fromDto(e, n, s) {
|
|
857
|
+
return new k(
|
|
858
|
+
e,
|
|
859
|
+
n,
|
|
860
|
+
s
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
get url() {
|
|
864
|
+
return this.dto.url;
|
|
865
|
+
}
|
|
866
|
+
get type() {
|
|
867
|
+
return this.dto.type;
|
|
868
|
+
}
|
|
869
|
+
get videoId() {
|
|
870
|
+
return this.dto.videoId;
|
|
871
|
+
}
|
|
872
|
+
get title() {
|
|
873
|
+
return this.dto.title;
|
|
874
|
+
}
|
|
875
|
+
get isCurrent() {
|
|
876
|
+
return this.playQueueStore.currentItem === this;
|
|
877
|
+
}
|
|
878
|
+
get index() {
|
|
879
|
+
return this.playQueueStore.items.indexOf(this);
|
|
880
|
+
}
|
|
881
|
+
get isFirst() {
|
|
882
|
+
return this.index === 0;
|
|
883
|
+
}
|
|
884
|
+
get isLast() {
|
|
885
|
+
return this.index === this.playQueueStore.items.length - 1;
|
|
886
|
+
}
|
|
887
|
+
get canMoveToTop() {
|
|
888
|
+
return !this.isFirst;
|
|
889
|
+
}
|
|
890
|
+
get canMoveToBottom() {
|
|
891
|
+
return !this.isLast;
|
|
892
|
+
}
|
|
893
|
+
get canRemoveToTop() {
|
|
894
|
+
return !this.isFirst;
|
|
895
|
+
}
|
|
896
|
+
get canRemoveOthers() {
|
|
897
|
+
return this.playQueueStore.hasMultipleItems;
|
|
898
|
+
}
|
|
899
|
+
clone() {
|
|
900
|
+
return this.playQueueStore.createItem(this.dto);
|
|
901
|
+
}
|
|
902
|
+
unselect() {
|
|
903
|
+
this.isSelected = !1;
|
|
904
|
+
}
|
|
905
|
+
toggleSelected() {
|
|
906
|
+
this.isSelected = !this.isSelected;
|
|
907
|
+
}
|
|
908
|
+
play() {
|
|
909
|
+
this.playQueueStore.setCurrentItem(this);
|
|
910
|
+
}
|
|
911
|
+
remove() {
|
|
912
|
+
return this.playQueueStore.removeItems([this]);
|
|
913
|
+
}
|
|
914
|
+
async playFirst() {
|
|
915
|
+
await this.playQueueStore.playFirst([this.clone()]);
|
|
916
|
+
}
|
|
917
|
+
async playNext() {
|
|
918
|
+
await this.playQueueStore.playNext([this.clone()]);
|
|
919
|
+
}
|
|
920
|
+
async addToPlayQueue() {
|
|
921
|
+
await this.playQueueStore.addItems([this.clone()]);
|
|
922
|
+
}
|
|
923
|
+
moveToTop() {
|
|
924
|
+
this.playQueueStore.moveItem(this, 0);
|
|
925
|
+
}
|
|
926
|
+
moveToBottom() {
|
|
927
|
+
this.playQueueStore.moveItem(
|
|
928
|
+
this,
|
|
929
|
+
this.playQueueStore.items.length - 1
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
removeToTop() {
|
|
933
|
+
return this.playQueueStore.removeItemsAbove(this);
|
|
934
|
+
}
|
|
935
|
+
removeOthers() {
|
|
936
|
+
return this.playQueueStore.removeOtherItems(this);
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
p(k, "nextId", 1);
|
|
940
|
+
let M = k;
|
|
941
|
+
const P = new $e({
|
|
942
|
+
coerceTypes: !0
|
|
943
|
+
});
|
|
944
|
+
function ut(t, e) {
|
|
945
|
+
let n;
|
|
946
|
+
if (n = P.getSchema(e), n === void 0 && (P.addSchema(t, e), n = P.getSchema(e)), n === void 0 || n.schema !== t)
|
|
947
|
+
throw new Error(
|
|
948
|
+
`Invalid schema. Expected: '${JSON.stringify(
|
|
949
|
+
t
|
|
950
|
+
)}', but got '${JSON.stringify(n == null ? void 0 : n.schema)}'.`
|
|
951
|
+
);
|
|
952
|
+
return n;
|
|
953
|
+
}
|
|
954
|
+
const ht = {
|
|
955
|
+
type: "object",
|
|
956
|
+
properties: {
|
|
957
|
+
version: {
|
|
958
|
+
type: "string",
|
|
959
|
+
nullable: !0
|
|
960
|
+
},
|
|
961
|
+
repeat: {
|
|
962
|
+
type: "string",
|
|
963
|
+
enum: Object.values(o),
|
|
964
|
+
nullable: !0
|
|
965
|
+
},
|
|
966
|
+
shuffle: {
|
|
967
|
+
type: "boolean",
|
|
968
|
+
nullable: !0
|
|
969
|
+
},
|
|
970
|
+
items: {
|
|
971
|
+
type: "array",
|
|
972
|
+
nullable: !0,
|
|
973
|
+
items: {
|
|
974
|
+
type: "object",
|
|
975
|
+
properties: {
|
|
976
|
+
url: {
|
|
977
|
+
type: "string"
|
|
978
|
+
},
|
|
979
|
+
type: {
|
|
980
|
+
type: "string"
|
|
981
|
+
},
|
|
982
|
+
videoId: {
|
|
983
|
+
type: "string"
|
|
984
|
+
},
|
|
985
|
+
title: {
|
|
986
|
+
type: "string"
|
|
987
|
+
}
|
|
988
|
+
},
|
|
989
|
+
required: ["url", "type", "videoId", "title"]
|
|
990
|
+
}
|
|
991
|
+
},
|
|
992
|
+
currentIndex: {
|
|
993
|
+
type: "integer",
|
|
994
|
+
nullable: !0
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}, pt = ut(
|
|
998
|
+
ht,
|
|
999
|
+
"PlayQueueStore"
|
|
1000
|
+
);
|
|
1001
|
+
class gt {
|
|
1002
|
+
constructor(e) {
|
|
1003
|
+
p(this, "interacted", !1);
|
|
1004
|
+
p(this, "items", []);
|
|
1005
|
+
p(this, "currentId");
|
|
1006
|
+
p(this, "repeat", o.Off);
|
|
1007
|
+
p(this, "shuffle", !1);
|
|
1008
|
+
this.observableStateProvider = e, e.makeObservable(this, {
|
|
1009
|
+
interacted: b,
|
|
1010
|
+
items: b,
|
|
1011
|
+
currentId: b,
|
|
1012
|
+
repeat: b,
|
|
1013
|
+
shuffle: b,
|
|
1014
|
+
localStorageState: c.struct,
|
|
1015
|
+
isEmpty: c,
|
|
1016
|
+
currentItem: c,
|
|
1017
|
+
canPlay: c,
|
|
1018
|
+
canPause: c,
|
|
1019
|
+
hasMultipleItems: c,
|
|
1020
|
+
currentIndex: c,
|
|
1021
|
+
hasPreviousItem: c,
|
|
1022
|
+
hasNextItem: c,
|
|
1023
|
+
isLastItem: c,
|
|
1024
|
+
selectedItems: c,
|
|
1025
|
+
allItemsSelected: c,
|
|
1026
|
+
selectedItemsOrAllItems: c,
|
|
1027
|
+
setItems: r,
|
|
1028
|
+
interact: r,
|
|
1029
|
+
clear: r.bound,
|
|
1030
|
+
unselectAll: r,
|
|
1031
|
+
setCurrentItem: r,
|
|
1032
|
+
setNextItems: r,
|
|
1033
|
+
clearAndSetItems: r,
|
|
1034
|
+
playNext: r,
|
|
1035
|
+
playSelectedItemsNext: r.bound,
|
|
1036
|
+
addItems: r,
|
|
1037
|
+
addSelectedItems: r.bound,
|
|
1038
|
+
playFirst: r,
|
|
1039
|
+
moveItem: r,
|
|
1040
|
+
removeItems: r,
|
|
1041
|
+
removeSelectedItems: r.bound,
|
|
1042
|
+
removeOtherItems: r,
|
|
1043
|
+
removeItemsAbove: r,
|
|
1044
|
+
toggleRepeat: r.bound,
|
|
1045
|
+
toggleShuffle: r.bound,
|
|
1046
|
+
previous: r,
|
|
1047
|
+
next: r.bound,
|
|
1048
|
+
goToFirst: r
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
createItem(e) {
|
|
1052
|
+
return M.fromDto(
|
|
1053
|
+
this.observableStateProvider,
|
|
1054
|
+
this,
|
|
1055
|
+
e
|
|
1056
|
+
);
|
|
1057
|
+
}
|
|
1058
|
+
get localStorageState() {
|
|
1059
|
+
return {
|
|
1060
|
+
version: "1.0",
|
|
1061
|
+
repeat: this.repeat,
|
|
1062
|
+
shuffle: this.shuffle,
|
|
1063
|
+
items: this.items.map((e) => e.dto),
|
|
1064
|
+
currentIndex: this.currentIndex
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
set localStorageState(e) {
|
|
1068
|
+
var n;
|
|
1069
|
+
this.repeat = e.repeat ?? o.Off, this.shuffle = e.shuffle ?? !1, this.items = ((n = e.items) == null ? void 0 : n.map((s) => this.createItem(s))) ?? [], this.currentIndex = e.currentIndex;
|
|
1070
|
+
}
|
|
1071
|
+
validateLocalStorageState(e) {
|
|
1072
|
+
return pt(e);
|
|
1073
|
+
}
|
|
1074
|
+
get isEmpty() {
|
|
1075
|
+
return this.items.length === 0;
|
|
1076
|
+
}
|
|
1077
|
+
get currentItem() {
|
|
1078
|
+
return this.items.find((e) => e.id === this.currentId);
|
|
1079
|
+
}
|
|
1080
|
+
get canPlay() {
|
|
1081
|
+
return this.currentItem !== void 0;
|
|
1082
|
+
}
|
|
1083
|
+
get canPause() {
|
|
1084
|
+
return this.currentItem !== void 0;
|
|
1085
|
+
}
|
|
1086
|
+
get hasMultipleItems() {
|
|
1087
|
+
return this.items.length > 1;
|
|
1088
|
+
}
|
|
1089
|
+
get currentIndex() {
|
|
1090
|
+
return this.currentId !== void 0 ? this.items.findIndex((e) => e.id === this.currentId) : void 0;
|
|
1091
|
+
}
|
|
1092
|
+
set currentIndex(e) {
|
|
1093
|
+
var n;
|
|
1094
|
+
this.currentId = e !== void 0 ? (n = this.items.at(e)) == null ? void 0 : n.id : void 0;
|
|
1095
|
+
}
|
|
1096
|
+
get hasPreviousItem() {
|
|
1097
|
+
return this.hasMultipleItems && this.currentIndex !== void 0 && this.currentIndex > 0;
|
|
1098
|
+
}
|
|
1099
|
+
get hasNextItem() {
|
|
1100
|
+
return this.hasMultipleItems && this.currentIndex !== void 0 && this.currentIndex < this.items.length - 1;
|
|
1101
|
+
}
|
|
1102
|
+
get isLastItem() {
|
|
1103
|
+
return this.currentIndex !== void 0 && this.currentIndex === this.items.length - 1;
|
|
1104
|
+
}
|
|
1105
|
+
get selectedItems() {
|
|
1106
|
+
return this.items.filter((e) => e.isSelected);
|
|
1107
|
+
}
|
|
1108
|
+
get allItemsSelected() {
|
|
1109
|
+
return this.selectedItems.length === this.items.length;
|
|
1110
|
+
}
|
|
1111
|
+
set allItemsSelected(e) {
|
|
1112
|
+
for (const n of this.items)
|
|
1113
|
+
n.isSelected = e;
|
|
1114
|
+
}
|
|
1115
|
+
get selectedItemsOrAllItems() {
|
|
1116
|
+
return this.selectedItems.length > 0 ? this.selectedItems : this.items;
|
|
1117
|
+
}
|
|
1118
|
+
setItems(e) {
|
|
1119
|
+
this.items = e;
|
|
1120
|
+
}
|
|
1121
|
+
interact() {
|
|
1122
|
+
this.interacted = !0;
|
|
1123
|
+
}
|
|
1124
|
+
clear() {
|
|
1125
|
+
this.interact(), this.currentIndex = void 0, this.items = [];
|
|
1126
|
+
}
|
|
1127
|
+
unselectAll() {
|
|
1128
|
+
for (const e of this.items)
|
|
1129
|
+
e.unselect();
|
|
1130
|
+
}
|
|
1131
|
+
setCurrentItem(e) {
|
|
1132
|
+
this.interact(), this.currentId = e == null ? void 0 : e.id;
|
|
1133
|
+
}
|
|
1134
|
+
setNextItems(e) {
|
|
1135
|
+
this.currentIndex !== void 0 && this.items.splice(this.currentIndex + 1, 0, ...e);
|
|
1136
|
+
}
|
|
1137
|
+
clearAndSetItems(e) {
|
|
1138
|
+
this.clear(), this.setCurrentItem(e[0]), this.setNextItems(e);
|
|
1139
|
+
}
|
|
1140
|
+
async playNext(e) {
|
|
1141
|
+
if (this.isEmpty) {
|
|
1142
|
+
this.clearAndSetItems(e);
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
this.setNextItems(e);
|
|
1146
|
+
}
|
|
1147
|
+
async playSelectedItemsNext() {
|
|
1148
|
+
await this.playNext(
|
|
1149
|
+
this.selectedItemsOrAllItems.map((e) => e.clone())
|
|
1150
|
+
), this.unselectAll();
|
|
1151
|
+
}
|
|
1152
|
+
async addItems(e) {
|
|
1153
|
+
if (this.isEmpty) {
|
|
1154
|
+
this.clearAndSetItems(e);
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
this.items.push(...e);
|
|
1158
|
+
}
|
|
1159
|
+
async addSelectedItems() {
|
|
1160
|
+
await this.addItems(
|
|
1161
|
+
this.selectedItemsOrAllItems.map((e) => e.clone())
|
|
1162
|
+
), this.unselectAll();
|
|
1163
|
+
}
|
|
1164
|
+
async playFirst(e) {
|
|
1165
|
+
if (this.isEmpty) {
|
|
1166
|
+
this.clearAndSetItems(e);
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
const { currentIndex: n } = this;
|
|
1170
|
+
n !== void 0 && (this.interact(), this.items.splice(n, 0, ...e), this.currentIndex = n);
|
|
1171
|
+
}
|
|
1172
|
+
moveItem(e, n) {
|
|
1173
|
+
const s = this.items.splice(this.items.indexOf(e), 1)[0];
|
|
1174
|
+
this.items.splice(n, 0, s);
|
|
1175
|
+
}
|
|
1176
|
+
async removeItems(e) {
|
|
1177
|
+
const { currentItem: n } = this;
|
|
1178
|
+
D(this.items, ...e.filter((l) => l !== n));
|
|
1179
|
+
const { currentIndex: s, isLastItem: a } = this;
|
|
1180
|
+
D(
|
|
1181
|
+
this.items,
|
|
1182
|
+
e.find((l) => l === n)
|
|
1183
|
+
), this.currentItem !== n && (this.interact(), a ? await this.goToFirst() : this.currentIndex = s);
|
|
1184
|
+
}
|
|
1185
|
+
async removeSelectedItems() {
|
|
1186
|
+
await this.removeItems(this.selectedItemsOrAllItems), this.unselectAll();
|
|
1187
|
+
}
|
|
1188
|
+
async removeOtherItems(e) {
|
|
1189
|
+
const n = e.id;
|
|
1190
|
+
return this.removeItems(
|
|
1191
|
+
this.items.filter((s) => s.id !== n)
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1194
|
+
async removeItemsAbove(e) {
|
|
1195
|
+
const n = this.items.indexOf(e);
|
|
1196
|
+
return this.removeItems(
|
|
1197
|
+
this.items.filter((s, a) => a < n)
|
|
1198
|
+
);
|
|
1199
|
+
}
|
|
1200
|
+
toggleRepeat() {
|
|
1201
|
+
switch (this.repeat) {
|
|
1202
|
+
case o.Off:
|
|
1203
|
+
this.repeat = o.All;
|
|
1204
|
+
break;
|
|
1205
|
+
case o.All:
|
|
1206
|
+
this.repeat = o.One;
|
|
1207
|
+
break;
|
|
1208
|
+
case o.One:
|
|
1209
|
+
this.repeat = o.Off;
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
toggleShuffle() {
|
|
1214
|
+
this.shuffle = !this.shuffle;
|
|
1215
|
+
}
|
|
1216
|
+
async previous() {
|
|
1217
|
+
this.currentIndex !== void 0 && this.hasPreviousItem && (this.interact(), this.currentIndex--);
|
|
1218
|
+
}
|
|
1219
|
+
async next() {
|
|
1220
|
+
this.currentIndex !== void 0 && this.hasNextItem && (this.interact(), this.currentIndex++);
|
|
1221
|
+
}
|
|
1222
|
+
async goToFirst() {
|
|
1223
|
+
this.currentIndex !== void 0 && (this.currentIndex = 0);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
const Z = W(void 0), At = ({
|
|
1227
|
+
children: t
|
|
1228
|
+
}) => {
|
|
1229
|
+
const [e] = g(
|
|
1230
|
+
() => new gt(new K())
|
|
1231
|
+
), n = R();
|
|
1232
|
+
return De(() => Ue(
|
|
1233
|
+
() => e.currentItem,
|
|
1234
|
+
async (s, a) => {
|
|
1235
|
+
s === void 0 || a === void 0 || s.type === a.type && s.videoId === a.videoId && await n.setCurrentTime(0);
|
|
1236
|
+
}
|
|
1237
|
+
), [e, n]), /* @__PURE__ */ React.createElement(Z.Provider, { value: e }, t);
|
|
1238
|
+
}, ft = () => X(Z), zt = h(
|
|
1239
|
+
({ children: t }) => {
|
|
1240
|
+
const e = ft();
|
|
1241
|
+
return /* @__PURE__ */ React.createElement(
|
|
1242
|
+
A,
|
|
1243
|
+
{
|
|
1244
|
+
panelled: !0,
|
|
1245
|
+
style: {
|
|
1246
|
+
minBlockSize: `max(460px, 100vh - ${Y}px)`
|
|
1247
|
+
}
|
|
1248
|
+
},
|
|
1249
|
+
t,
|
|
1250
|
+
!e.isEmpty && /* @__PURE__ */ React.createElement($, { style: { blockSize: z.height } })
|
|
1251
|
+
);
|
|
1252
|
+
}
|
|
1253
|
+
);
|
|
1254
|
+
class Et {
|
|
1255
|
+
constructor(e) {
|
|
1256
|
+
p(this, "playing", !1);
|
|
1257
|
+
p(this, "percent", 0);
|
|
1258
|
+
p(this, "seeking", !1);
|
|
1259
|
+
e.makeObservable(this, {
|
|
1260
|
+
playing: b,
|
|
1261
|
+
percent: b,
|
|
1262
|
+
seeking: b,
|
|
1263
|
+
setPlaying: r,
|
|
1264
|
+
setPercent: r,
|
|
1265
|
+
setSeeking: r,
|
|
1266
|
+
onPlay: r.bound,
|
|
1267
|
+
onPause: r.bound,
|
|
1268
|
+
onEnded: r.bound,
|
|
1269
|
+
onTimeUpdate: r.bound
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
setPlaying(e) {
|
|
1273
|
+
this.playing = e;
|
|
1274
|
+
}
|
|
1275
|
+
setPercent(e) {
|
|
1276
|
+
this.percent = e;
|
|
1277
|
+
}
|
|
1278
|
+
setSeeking(e) {
|
|
1279
|
+
this.seeking = e;
|
|
1280
|
+
}
|
|
1281
|
+
onPlay() {
|
|
1282
|
+
this.playing = !0;
|
|
1283
|
+
}
|
|
1284
|
+
onPause() {
|
|
1285
|
+
this.playing = !1;
|
|
1286
|
+
}
|
|
1287
|
+
onEnded() {
|
|
1288
|
+
this.playing = !1;
|
|
1289
|
+
}
|
|
1290
|
+
onTimeUpdate({ percent: e }) {
|
|
1291
|
+
e !== void 0 && (this.seeking || (this.percent = e));
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
const _ = W(void 0), Mt = ({
|
|
1295
|
+
children: t
|
|
1296
|
+
}) => {
|
|
1297
|
+
const [e] = g(
|
|
1298
|
+
() => new Et(new K())
|
|
1299
|
+
);
|
|
1300
|
+
return /* @__PURE__ */ React.createElement(_.Provider, { value: e }, t);
|
|
1301
|
+
}, Ft = () => X(_);
|
|
1302
|
+
class Bt {
|
|
1303
|
+
makeObservable(e, n) {
|
|
1304
|
+
return e;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
export {
|
|
1308
|
+
Pt as BottomBar,
|
|
1309
|
+
St as HydrangeanDiva,
|
|
1310
|
+
zt as MediaPlayerLayout,
|
|
1311
|
+
Ot as MiniPlayer,
|
|
1312
|
+
K as MobXObservableStateProvider,
|
|
1313
|
+
Bt as ObservableStateProvider,
|
|
1314
|
+
At as PlayQueueStoreProvider,
|
|
1315
|
+
Mt as PlayerStoreProvider,
|
|
1316
|
+
o as RepeatMode,
|
|
1317
|
+
Y as bottomBarHeight,
|
|
1318
|
+
z as miniPlayerSize,
|
|
1319
|
+
ft as usePlayQueueStore,
|
|
1320
|
+
Ft as usePlayerStore
|
|
1321
|
+
};
|
|
1322
|
+
//# sourceMappingURL=index.es.js.map
|