@aigamo/hydrangean-diva 0.0.1-alpha.70 → 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 (102) hide show
  1. package/dist/index.cjs.js +1 -1
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +1347 -1347
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/src/features/{media-player.play-queue → media-player}/components/AddVideoButton.d.ts +1 -1
  6. package/dist/src/features/{media-player.play-queue → media-player}/components/AddVideoModal.d.ts +1 -1
  7. package/dist/src/features/{media-player.bottom-bar → media-player}/components/BottomBarCenterControls.d.ts +1 -1
  8. package/dist/src/features/{media-player.playlists → media-player}/components/DeletePlaylistConfirmModal.d.ts +1 -1
  9. package/dist/src/features/{media-player.play-queue → media-player}/components/PlayQueueCommandBar.d.ts +1 -1
  10. package/dist/src/features/{media-player.play-queue → media-player}/components/PlayQueueSection.d.ts +1 -1
  11. package/dist/src/features/{media-player.play-queue → media-player}/components/PlayQueueTable.d.ts +1 -1
  12. package/dist/src/features/{media-player.playlists → media-player}/components/PlaylistCommandBar.d.ts +1 -1
  13. package/dist/src/features/{media-player.playlists → media-player}/components/PlaylistListTable.d.ts +1 -1
  14. package/dist/src/features/{media-player.playlists → media-player}/components/PlaylistSection.d.ts +1 -1
  15. package/dist/src/features/{media-player.playlists → media-player}/components/PlaylistTable.d.ts +1 -1
  16. package/dist/src/features/{media-player.playlists → media-player}/components/RenamePlaylistModal.d.ts +1 -1
  17. package/dist/src/features/media-player/helpers/findVideoService.d.ts +1 -0
  18. package/dist/src/features/media-player/index.d.ts +19 -1
  19. package/dist/src/features/{media-player.bottom-bar.abstractions → media-player}/interfaces/IBottomBarStore.d.ts +2 -2
  20. package/dist/src/features/{media-player.mini-player.abstractions → media-player}/interfaces/IMiniPlayerStore.d.ts +1 -1
  21. package/dist/src/features/{media-player.playlists.abstractions → media-player}/interfaces/IPlaylistItemStore.d.ts +1 -1
  22. package/dist/src/features/{media-player.playlists.abstractions → media-player}/interfaces/IPlaylistStore.d.ts +1 -1
  23. package/dist/src/features/{media-player.playlists → media-player}/pages/PlaylistDetailsPage.d.ts +1 -1
  24. package/dist/src/features/{media-player.bottom-bar → media-player}/stores/BottomBarStore.d.ts +5 -5
  25. package/dist/src/features/{media-player.mini-player → media-player}/stores/MiniPlayerStore.d.ts +5 -5
  26. package/dist/src/features/{media-player.play-queue → media-player}/stores/PlayQueueItemStore.d.ts +3 -3
  27. package/dist/src/features/{media-player.play-queue → media-player}/stores/PlayQueueStore.d.ts +4 -4
  28. package/dist/src/features/{media-player.player → media-player}/stores/PlayerStore.d.ts +1 -1
  29. package/dist/src/features/{media-player.playlists → media-player}/stores/PlaylistItemStore.d.ts +4 -4
  30. package/dist/src/features/{media-player.playlists → media-player}/stores/PlaylistListItemStore.d.ts +2 -2
  31. package/dist/src/features/{media-player.playlists → media-player}/stores/PlaylistListStore.d.ts +2 -2
  32. package/dist/src/features/{media-player.playlists → media-player}/stores/PlaylistStore.d.ts +4 -4
  33. package/dist/src/index.d.ts +1 -1
  34. package/package.json +4 -4
  35. package/dist/src/features/common/helpers/index.d.ts +0 -2
  36. package/dist/src/features/common/index.d.ts +0 -1
  37. package/dist/src/features/index.d.ts +0 -11
  38. package/dist/src/features/media-player/components/index.d.ts +0 -2
  39. package/dist/src/features/media-player.bottom-bar/components/index.d.ts +0 -1
  40. package/dist/src/features/media-player.bottom-bar/index.d.ts +0 -1
  41. package/dist/src/features/media-player.bottom-bar.abstractions/index.d.ts +0 -1
  42. package/dist/src/features/media-player.bottom-bar.abstractions/interfaces/index.d.ts +0 -1
  43. package/dist/src/features/media-player.mini-player/components/index.d.ts +0 -1
  44. package/dist/src/features/media-player.mini-player/index.d.ts +0 -1
  45. package/dist/src/features/media-player.mini-player.abstractions/index.d.ts +0 -1
  46. package/dist/src/features/media-player.mini-player.abstractions/interfaces/index.d.ts +0 -1
  47. package/dist/src/features/media-player.play-queue/components/index.d.ts +0 -1
  48. package/dist/src/features/media-player.play-queue/index.d.ts +0 -2
  49. package/dist/src/features/media-player.play-queue/pages/index.d.ts +0 -1
  50. package/dist/src/features/media-player.play-queue.abstractions/contexts/index.d.ts +0 -1
  51. package/dist/src/features/media-player.play-queue.abstractions/index.d.ts +0 -2
  52. package/dist/src/features/media-player.play-queue.abstractions/interfaces/index.d.ts +0 -3
  53. package/dist/src/features/media-player.player.abstractions/index.d.ts +0 -1
  54. package/dist/src/features/media-player.player.abstractions/interfaces/index.d.ts +0 -1
  55. package/dist/src/features/media-player.playlists/index.d.ts +0 -1
  56. package/dist/src/features/media-player.playlists/pages/index.d.ts +0 -2
  57. package/dist/src/features/media-player.playlists.abstractions/contexts/index.d.ts +0 -1
  58. package/dist/src/features/media-player.playlists.abstractions/index.d.ts +0 -1
  59. /package/dist/src/features/{media-player.bottom-bar → media-player}/components/BottomBar.d.ts +0 -0
  60. /package/dist/src/features/{media-player.bottom-bar → media-player}/components/BottomBarLeftControls.d.ts +0 -0
  61. /package/dist/src/features/{media-player.bottom-bar → media-player}/components/BottomBarRightControls.d.ts +0 -0
  62. /package/dist/src/features/{media-player.mini-player → media-player}/components/CookieConsentPanel.d.ts +0 -0
  63. /package/dist/src/features/{media-player.playlists → media-player}/components/CreatePlaylistButton.d.ts +0 -0
  64. /package/dist/src/features/{media-player.playlists → media-player}/components/CreatePlaylistModal.d.ts +0 -0
  65. /package/dist/src/features/{media-player.play-queue → media-player}/components/DeveloperToolsButton.d.ts +0 -0
  66. /package/dist/src/features/{media-player.mini-player → media-player}/components/MiniPlayer.d.ts +0 -0
  67. /package/dist/src/features/{media-player.bottom-bar → media-player}/components/SeekBar.d.ts +0 -0
  68. /package/dist/src/features/{media-player.bottom-bar.abstractions → media-player}/contexts/BottomBarContext.d.ts +0 -0
  69. /package/dist/src/features/{media-player.mini-player.abstractions → media-player}/contexts/MiniPlayerContext.d.ts +0 -0
  70. /package/dist/src/features/{media-player.play-queue.abstractions → media-player}/contexts/PlayQueueContext.d.ts +0 -0
  71. /package/dist/src/features/{media-player.player.abstractions → media-player}/contexts/PlayerContext.d.ts +0 -0
  72. /package/dist/src/features/{media-player.playlists.abstractions → media-player}/contexts/PlaylistListContext.d.ts +0 -0
  73. /package/dist/src/features/{common → media-player}/helpers/bottomBarHeight.d.ts +0 -0
  74. /package/dist/src/features/{common → media-player}/helpers/commandBarHeight.d.ts +0 -0
  75. /package/dist/src/features/{common → media-player}/helpers/commandBarSpacerHeight.d.ts +0 -0
  76. /package/dist/src/features/{common → media-player}/helpers/headerHeight.d.ts +0 -0
  77. /package/dist/src/features/{media-player.play-queue → media-player}/helpers/isNoembedResult.d.ts +0 -0
  78. /package/dist/src/features/{common → media-player}/helpers/miniPlayerSize.d.ts +0 -0
  79. /package/dist/src/features/{common → media-player}/helpers/videoServiceIcons.d.ts +0 -0
  80. /package/dist/src/features/{media-player.play-queue.abstractions → media-player}/interfaces/IPlayQueueItemStore.d.ts +0 -0
  81. /package/dist/src/features/{media-player.play-queue.abstractions → media-player}/interfaces/IPlayQueueStore.d.ts +0 -0
  82. /package/dist/src/features/{media-player.player.abstractions → media-player}/interfaces/IPlayerStore.d.ts +0 -0
  83. /package/dist/src/features/{media-player.playlists.abstractions → media-player}/interfaces/IPlaylistListItemStore.d.ts +0 -0
  84. /package/dist/src/features/{media-player.playlists.abstractions → media-player}/interfaces/IPlaylistListStore.d.ts +0 -0
  85. /package/dist/src/features/{media-player.play-queue.abstractions → media-player}/interfaces/PlayQueueDto.d.ts +0 -0
  86. /package/dist/src/features/{media-player.play-queue.abstractions → media-player}/interfaces/PlayQueueItemDto.d.ts +0 -0
  87. /package/dist/src/features/{media-player.play-queue.abstractions → media-player}/interfaces/RepeatMode.d.ts +0 -0
  88. /package/dist/src/features/{media-player.play-queue → media-player}/pages/PlayQueuePage.d.ts +0 -0
  89. /package/dist/src/features/{media-player.playlists → media-player}/pages/PlaylistListPage.d.ts +0 -0
  90. /package/dist/src/features/{media-player.bottom-bar/components → media-player/providers}/BottomBarProvider.d.ts +0 -0
  91. /package/dist/src/features/media-player/{components → providers}/HydrangeanDivaProvider.d.ts +0 -0
  92. /package/dist/src/features/{media-player.mini-player/components → media-player/providers}/MiniPlayerProvider.d.ts +0 -0
  93. /package/dist/src/features/{media-player.play-queue/components → media-player/providers}/PlayQueueProvider.d.ts +0 -0
  94. /package/dist/src/features/{media-player.player/components → media-player/providers}/PlayerProvider.d.ts +0 -0
  95. /package/dist/src/features/{media-player.playlists/components → media-player/providers}/PlaylistListProvider.d.ts +0 -0
  96. /package/dist/src/{features/media-player.header/components → layout}/Header.d.ts +0 -0
  97. /package/dist/src/{common → shared}/components/AppLink.d.ts +0 -0
  98. /package/dist/src/{common → shared}/components/AppPageTemplateHeader.d.ts +0 -0
  99. /package/dist/src/{features/common → shared}/components/Compose.d.ts +0 -0
  100. /package/dist/src/{features/common/helpers → shared/lib}/featureFlags.d.ts +0 -0
  101. /package/dist/src/{features/common → shared}/stores/getOrAddSchema.d.ts +0 -0
  102. /package/dist/src/{features/common → shared}/stores/localStorageStateKeys.d.ts +0 -0
package/dist/index.es.js CHANGED
@@ -1,850 +1,179 @@
1
- import { Fragment as e, jsx as t, jsxs as n } from "@emotion/react/jsx-runtime";
2
- import { createContext as r, memo as i, useCallback as a, useContext as o, useEffect as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
3
- import ee from "ajv";
4
- import { action as f, computed as p, makeObservable as m, observable as h, reaction as te } from "mobx";
5
- import { useLocalStorageState as ne } from "@aigamo/route-sphere";
6
- import { pull as re } from "lodash-es";
7
- import { NostalgicDiva as ie, NostalgicDivaProvider as ae, findVideoService as oe, nullPlayerController as se, useNostalgicDiva as g } from "@aigamo/nostalgic-diva";
8
- import { EuiBottomBar as ce, EuiButton as _, EuiButtonEmpty as v, EuiButtonIcon as y, EuiCheckbox as b, EuiConfirmModal as le, EuiContextMenu as x, EuiEmptyPrompt as ue, EuiFieldText as S, EuiFlexGroup as C, EuiFlexItem as w, EuiForm as de, EuiFormRow as T, EuiHideFor as E, EuiIcon as D, EuiLink as fe, EuiModal as pe, EuiModalBody as me, EuiModalFooter as he, EuiModalHeader as ge, EuiModalHeaderTitle as _e, EuiPageTemplate as O, EuiPopover as k, EuiRange as ve, EuiShowFor as ye, EuiSpacer as be, EuiTable as xe, EuiTableHeader as Se, EuiTableHeaderCell as A, EuiTableHeaderCellCheckbox as Ce, EuiTableHeaderMobile as we, EuiTableRow as Te, EuiTableRowCell as j, EuiTableRowCellCheckbox as Ee, useEuiTheme as M, useGeneratedHtmlId as De } from "@elastic/eui";
9
- import { observer as N } from "mobx-react-lite";
10
- import { AddRegular as P, ArrowDownloadRegular as Oe, ArrowRepeat1Filled as ke, ArrowRepeatAllFilled as Ae, ArrowRepeatAllOffFilled as je, ArrowShuffleFilled as Me, ArrowShuffleOffFilled as Ne, ArrowUploadRegular as Pe, DeleteRegular as Fe, DismissRegular as F, MoreHorizontalFilled as I, NavigationPlayRegular as Ie, NextFilled as Le, OpenRegular as Re, PauseFilled as ze, PlayFilled as Be, PlayRegular as L, PreviousFilled as Ve, RenameRegular as He, SkipBack10Regular as Ue, SkipForward30Regular as We, Speaker2Regular as Ge, TopSpeedRegular as Ke } from "@fluentui/react-icons";
11
- import R from "ez-modal-react";
12
- import { ReactSortable as qe } from "react-sortablejs";
13
- import { useRouter as Je } from "@tanstack/react-router";
14
- //#region src/features/common/helpers/bottomBarHeight.ts
15
- var Ye = 81, z = new Map(Object.entries({
16
- Audio: "",
17
- Dailymotion: "https://www.dailymotion.com/favicon.ico",
18
- Niconico: "https://www.nicovideo.jp/favicon.ico",
19
- SoundCloud: "https://soundcloud.com/favicon.ico",
20
- Spotify: "https://storage.googleapis.com/pr-newsroom-wp/1/2023/05/Spotify_Primary_Logo_RGB_Green.png",
21
- Twitch: "https://www.twitch.tv/favicon.ico",
22
- Vimeo: "https://vimeo.com/favicon.ico",
23
- YouTube: "https://www.youtube.com/favicon.ico"
24
- })), Xe = ({ components: n = [], children: r }) => /* @__PURE__ */ t(e, { children: n.reduceRight((e, n) => /* @__PURE__ */ t(n, { children: e }), r) }), B = {
25
- playQueue: "PlayQueueStore",
26
- bottomBar: "BottomBarStore",
27
- playlistList: "PlaylistListStore",
28
- playlist: (e) => `PlaylistStore/${e}`
29
- }, Ze = r(void 0), V = () => o(Ze), Qe = new ee({ coerceTypes: !0 });
30
- function $e(e, t) {
31
- let n;
32
- if (n = Qe.getSchema(t), n === void 0 && (Qe.addSchema(e, t), n = Qe.getSchema(t)), n === void 0 || n.schema !== e) throw Error(`Invalid schema. Expected: '${JSON.stringify(e)}', but got '${JSON.stringify(n?.schema)}'.`);
33
- return n;
34
- }
35
- //#endregion
36
- //#region src/features/media-player.play-queue.abstractions/interfaces/RepeatMode.ts
37
- var H = /* @__PURE__ */ function(e) {
38
- return e.Off = "Off", e.All = "All", e.One = "One", e;
39
- }({});
40
- //#endregion
41
- //#region \0@oxc-project+runtime@0.130.0/helpers/decorate.js
42
- function U(e, t, n, r) {
43
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
44
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
45
- 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);
46
- return i > 3 && a && Object.defineProperty(t, n, a), a;
47
- }
48
- //#endregion
49
- //#region src/features/media-player.bottom-bar/stores/BottomBarStore.ts
50
- var et = {
51
- type: "object",
52
- properties: {
53
- repeat: {
54
- type: "string",
55
- enum: Object.values(H),
56
- nullable: !0
57
- },
58
- shuffle: {
59
- type: "boolean",
60
- nullable: !0
61
- }
62
- }
63
- }, tt = class {
64
- bottomBar;
65
- constructor(e) {
66
- this.bottomBar = e, m(this);
67
- }
68
- get state() {
69
- return {
70
- repeat: this.bottomBar.repeat,
71
- shuffle: this.bottomBar.shuffle
72
- };
73
- }
74
- set state(e) {
75
- this.bottomBar.repeat = e.repeat ?? H.Off, this.bottomBar.shuffle = e.shuffle ?? !1;
76
- }
77
- validateState(e) {
78
- return $e(et, "BottomBarLocalStorageState")(e);
79
- }
80
- };
81
- U([p.struct], tt.prototype, "state", null);
82
- var W = class {
83
- player;
84
- playQueue;
85
- localStorageState;
86
- repeat = H.Off;
87
- shuffle = !1;
88
- constructor(e, t) {
89
- this.player = e, this.playQueue = t, m(this), this.localStorageState = new tt(this);
90
- }
91
- get controller() {
92
- return this.player.controller;
93
- }
94
- get playing() {
95
- return this.player.playing;
96
- }
97
- get percent() {
98
- return this.player.percent;
99
- }
100
- get canSeek() {
101
- return !this.playQueue.isEmpty && this.controller.supports("setCurrentTime");
102
- }
103
- get currentItem() {
104
- return this.playQueue.currentItem;
105
- }
106
- get canToggleRepeat() {
107
- return !0;
108
- }
109
- get canToggleShuffle() {
110
- return !1;
111
- }
112
- get canPlay() {
113
- return this.playQueue.canPlay && this.controller.supports("play");
114
- }
115
- get canPause() {
116
- return this.playQueue.canPause && this.controller.supports("pause");
117
- }
118
- get canPrevious() {
119
- return !this.playQueue.isEmpty;
120
- }
121
- get canNext() {
122
- return this.playQueue.hasNextItem;
123
- }
124
- get canSkipBack10() {
125
- return this.canSeek;
126
- }
127
- get canSkipForward30() {
128
- return this.canSeek;
129
- }
130
- get canRemoveFromPlayQueue() {
131
- return !this.playQueue.isEmpty;
132
- }
133
- setPercent(e) {
134
- this.player.setPercent(e);
135
- }
136
- setSeeking(e) {
137
- this.player.setSeeking(e);
138
- }
139
- toggleRepeat() {
140
- switch (this.repeat) {
141
- case H.Off:
142
- this.repeat = H.All;
143
- break;
144
- case H.All:
145
- this.repeat = H.One;
146
- break;
147
- case H.One:
148
- this.repeat = H.Off;
149
- break;
150
- }
151
- }
152
- toggleShuffle() {
153
- this.shuffle = !this.shuffle;
154
- }
155
- play() {
156
- return this.controller.play();
157
- }
158
- pause() {
159
- return this.controller.pause();
160
- }
161
- async previous() {
162
- if (this.playQueue.hasPreviousItem) {
163
- let e = await this.controller.getCurrentTime();
164
- e === void 0 || e < 5 ? await this.playQueue.previous() : await this.controller.setCurrentTime(0);
165
- } else await this.controller.setCurrentTime(0);
166
- }
167
- next() {
168
- return this.playQueue.next();
169
- }
170
- async skipBack10() {
171
- let e = await this.controller.getCurrentTime();
172
- e !== void 0 && await this.controller.setCurrentTime(e - 10);
173
- }
174
- async skipForward30() {
175
- let e = await this.controller.getCurrentTime();
176
- e !== void 0 && await this.controller.setCurrentTime(e + 30);
177
- }
178
- async removeFromPlayQueue() {
179
- this.currentItem !== void 0 && await this.playQueue.removeItems([this.currentItem]);
180
- }
181
- };
182
- U([h], W.prototype, "repeat", void 0), U([h], W.prototype, "shuffle", void 0), U([p], W.prototype, "controller", null), U([p], W.prototype, "playing", null), U([p], W.prototype, "percent", null), U([p], W.prototype, "canSeek", null), U([p], W.prototype, "currentItem", null), U([p], W.prototype, "canToggleRepeat", null), U([p], W.prototype, "canToggleShuffle", null), U([p], W.prototype, "canPlay", null), U([p], W.prototype, "canPause", null), U([p], W.prototype, "canPrevious", null), U([p], W.prototype, "canNext", null), U([p], W.prototype, "canSkipBack10", null), U([p], W.prototype, "canSkipForward30", null), U([p], W.prototype, "canRemoveFromPlayQueue", null), U([f.bound], W.prototype, "setPercent", null), U([f.bound], W.prototype, "setSeeking", null), U([f.bound], W.prototype, "toggleRepeat", null), U([f.bound], W.prototype, "toggleShuffle", null), U([f.bound], W.prototype, "play", null), U([f.bound], W.prototype, "pause", null), U([f.bound], W.prototype, "previous", null), U([f.bound], W.prototype, "next", null), U([f.bound], W.prototype, "skipBack10", null), U([f.bound], W.prototype, "skipForward30", null), U([f.bound], W.prototype, "removeFromPlayQueue", null);
183
- //#endregion
184
- //#region src/features/media-player.play-queue.abstractions/contexts/PlayQueueContext.ts
185
- var nt = r(void 0), G = () => o(nt), rt = r(void 0), it = () => o(rt), at = ({ children: e }) => {
186
- let n = it(), r = G(), [i] = d(() => new W(n, r));
187
- return ne(B.bottomBar, i.localStorageState), /* @__PURE__ */ t(Ze.Provider, {
188
- value: i,
189
- children: e
190
- });
191
- }, ot = r(void 0), st = () => o(ot), K = class {
192
- player;
193
- playQueue;
194
- bottomBar;
195
- constructor(e, t, n) {
196
- this.player = e, this.playQueue = t, this.bottomBar = n, m(this);
197
- }
198
- get interacted() {
199
- return this.playQueue.interacted;
200
- }
201
- get controller() {
202
- return this.player.controller;
203
- }
204
- get currentItem() {
205
- return this.playQueue.currentItem;
206
- }
207
- async onLoaded() {
208
- this.interacted && await this.controller.play();
209
- }
210
- onPlay() {
211
- this.player.onPlay();
212
- }
213
- onPause() {
214
- this.player.onPause();
215
- }
216
- async onEnded() {
217
- switch (this.bottomBar.repeat) {
218
- case H.One:
219
- await this.controller.setCurrentTime(0);
220
- break;
221
- case H.Off:
222
- case H.All:
223
- if (this.playQueue.isLastItem) switch (this.bottomBar.repeat) {
224
- case H.Off:
225
- this.player.onEnded();
226
- break;
227
- case H.All:
228
- this.playQueue.hasMultipleItems ? await this.playQueue.goToFirst() : await this.controller.setCurrentTime(0);
229
- break;
230
- }
231
- else await this.playQueue.next();
232
- break;
233
- }
234
- }
235
- onTimeUpdate(e) {
236
- this.player.onTimeUpdate(e);
237
- }
238
- onControllerChange(e) {
239
- this.player.onControllerChange(e);
240
- }
241
- };
242
- U([p], K.prototype, "interacted", null), U([p], K.prototype, "controller", null), U([p], K.prototype, "currentItem", null), U([f.bound], K.prototype, "onLoaded", null), U([f.bound], K.prototype, "onPlay", null), U([f.bound], K.prototype, "onPause", null), U([f.bound], K.prototype, "onEnded", null), U([f.bound], K.prototype, "onTimeUpdate", null), U([f.bound], K.prototype, "onControllerChange", null);
243
- //#endregion
244
- //#region src/features/media-player.mini-player/components/MiniPlayerProvider.tsx
245
- var ct = ({ children: e }) => {
246
- let n = it(), r = G(), i = V(), [a] = d(() => new K(n, r, i));
247
- return /* @__PURE__ */ t(ot.Provider, {
248
- value: a,
249
- children: e
250
- });
251
- }, lt = {
252
- type: "object",
253
- properties: {
254
- url: { type: "string" },
255
- type: { type: "string" },
256
- videoId: { type: "string" },
257
- title: { type: "string" }
258
- },
259
- required: [
260
- "url",
261
- "type",
262
- "videoId",
263
- "title"
264
- ]
265
- }, ut = {
266
- type: "object",
267
- properties: {
268
- version: {
269
- type: "string",
270
- nullable: !0
271
- },
272
- repeat: {
273
- type: "string",
274
- enum: Object.values(H),
275
- nullable: !0
276
- },
277
- shuffle: {
278
- type: "boolean",
279
- nullable: !0
280
- },
281
- items: {
282
- type: "array",
283
- nullable: !0,
284
- items: lt
285
- },
286
- currentIndex: {
287
- type: "integer",
288
- nullable: !0
289
- }
290
- }
291
- }, q = class e {
292
- playQueue;
293
- dto;
294
- static nextId = 1;
295
- id;
296
- isSelected = !1;
297
- constructor(t, n) {
298
- this.playQueue = t, this.dto = n, m(this), this.id = e.nextId++;
299
- }
300
- static fromDto(t, n) {
301
- return new e(t, n);
302
- }
303
- get url() {
304
- return this.dto.url;
305
- }
306
- get type() {
307
- return this.dto.type;
308
- }
309
- get videoId() {
310
- return this.dto.videoId;
311
- }
312
- get title() {
313
- return this.dto.title;
314
- }
315
- get isCurrent() {
316
- return this.playQueue.currentItem === this;
317
- }
318
- get index() {
319
- return this.playQueue.items.indexOf(this);
320
- }
321
- get isFirst() {
322
- return this.index === 0;
323
- }
324
- get isLast() {
325
- return this.index === this.playQueue.items.length - 1;
326
- }
327
- get canMoveToTop() {
328
- return !this.isFirst;
329
- }
330
- get canMoveToBottom() {
331
- return !this.isLast;
332
- }
333
- get canRemoveToTop() {
334
- return !this.isFirst;
335
- }
336
- get canRemoveOthers() {
337
- return this.playQueue.hasMultipleItems;
338
- }
339
- clone() {
340
- return this.playQueue.createItemFromDto(this.dto);
341
- }
342
- unselect() {
343
- this.isSelected = !1;
344
- }
345
- select() {
346
- this.isSelected = !0;
347
- }
348
- toggleSelected() {
349
- this.isSelected = !this.isSelected;
350
- }
351
- play() {
352
- return this.playQueue.setCurrentItem(this), Promise.resolve();
353
- }
354
- remove() {
355
- return this.playQueue.removeItems([this]);
356
- }
357
- playFirst() {
358
- return this.playQueue.playFirst([this.clone()]);
359
- }
360
- playNext() {
361
- return this.playQueue.playNext([this.clone()]);
362
- }
363
- addToPlayQueue() {
364
- return this.playQueue.addItems([this.clone()]);
365
- }
366
- moveToTop() {
367
- this.playQueue.moveItem(this, 0);
368
- }
369
- moveToBottom() {
370
- this.playQueue.moveItem(this, this.playQueue.items.length - 1);
371
- }
372
- removeToTop() {
373
- return this.playQueue.removeItemsAbove(this);
374
- }
375
- removeOthers() {
376
- return this.playQueue.removeOtherItems(this);
377
- }
378
- };
379
- U([h], q.prototype, "isSelected", void 0), U([p], q.prototype, "isCurrent", null), U([p], q.prototype, "index", null), U([p], q.prototype, "isFirst", null), U([p], q.prototype, "isLast", null), U([p], q.prototype, "canMoveToTop", null), U([p], q.prototype, "canMoveToBottom", null), U([p], q.prototype, "canRemoveToTop", null), U([p], q.prototype, "canRemoveOthers", null), U([f.bound], q.prototype, "unselect", null), U([f.bound], q.prototype, "select", null), U([f.bound], q.prototype, "toggleSelected", null), U([f.bound], q.prototype, "play", null), U([f.bound], q.prototype, "remove", null), U([f.bound], q.prototype, "playFirst", null), U([f.bound], q.prototype, "playNext", null), U([f.bound], q.prototype, "addToPlayQueue", null), U([f.bound], q.prototype, "moveToTop", null), U([f.bound], q.prototype, "moveToBottom", null), U([f.bound], q.prototype, "removeToTop", null), U([f.bound], q.prototype, "removeOthers", null);
380
- //#endregion
381
- //#region src/features/media-player.play-queue/stores/PlayQueueStore.ts
382
- var dt = class {
383
- playQueue;
384
- constructor(e) {
385
- this.playQueue = e, m(this);
386
- }
387
- get state() {
388
- return {
389
- version: "1.0",
390
- items: this.playQueue.items.map((e) => e.dto),
391
- currentIndex: this.playQueue.currentIndex
392
- };
393
- }
394
- set state(e) {
395
- this.playQueue.items = e.items?.map((e) => this.playQueue.createItemFromDto(e)) ?? [], this.playQueue.currentIndex = e.currentIndex;
396
- }
397
- validateState(e) {
398
- return $e(ut, "PlayQueueDto")(e);
399
- }
400
- };
401
- U([p.struct], dt.prototype, "state", null);
402
- var J = class {
403
- interacted = !1;
404
- localStorageState;
405
- items = [];
406
- currentId;
407
- constructor() {
408
- m(this), this.localStorageState = new dt(this);
409
- }
410
- createItemFromDto(e) {
411
- return q.fromDto(this, {
412
- url: e.url,
413
- type: e.type,
414
- videoId: e.videoId,
415
- title: e.title
416
- });
417
- }
418
- get isEmpty() {
419
- return this.items.length === 0;
420
- }
421
- get canClear() {
422
- return !this.isEmpty;
423
- }
424
- get currentItem() {
425
- return this.items.find((e) => e.id === this.currentId);
426
- }
427
- get canPlay() {
428
- return this.currentItem !== void 0;
429
- }
430
- get canPause() {
431
- return this.currentItem !== void 0;
432
- }
433
- get hasMultipleItems() {
434
- return this.items.length > 1;
435
- }
436
- get currentIndex() {
437
- return this.currentId === void 0 ? void 0 : this.items.findIndex((e) => e.id === this.currentId);
438
- }
439
- set currentIndex(e) {
440
- this.currentId = e === void 0 ? void 0 : this.items.at(e)?.id;
441
- }
442
- get hasPreviousItem() {
443
- return this.hasMultipleItems && this.currentIndex !== void 0 && this.currentIndex > 0;
444
- }
445
- get hasNextItem() {
446
- return this.hasMultipleItems && this.currentIndex !== void 0 && this.currentIndex < this.items.length - 1;
447
- }
448
- get isLastItem() {
449
- return this.currentIndex !== void 0 && this.currentIndex === this.items.length - 1;
450
- }
451
- get selectedItems() {
452
- return this.items.filter((e) => e.isSelected);
453
- }
454
- get allItemsSelected() {
455
- return this.selectedItems.length === this.items.length;
456
- }
457
- get hasSelectedItems() {
458
- return this.selectedItems.length > 0;
459
- }
460
- get selectedItemsOrAllItems() {
461
- return this.hasSelectedItems ? this.selectedItems : this.items;
462
- }
463
- get canAddSelectedItems() {
464
- return !this.isEmpty && this.hasSelectedItems;
465
- }
466
- get canPlaySelectedItemsNext() {
467
- return !this.isEmpty && this.hasSelectedItems;
468
- }
469
- get canRemoveSelectedItems() {
470
- return !this.isEmpty && this.hasSelectedItems;
471
- }
472
- setItems(e) {
473
- this.items = e;
474
- }
475
- interact() {
476
- this.interacted = !0;
477
- }
478
- clear() {
479
- this.interact(), this.currentIndex = void 0, this.items = [];
480
- }
481
- unselectAll() {
482
- for (let e of this.items) e.unselect();
483
- }
484
- selectAll() {
485
- for (let e of this.items) e.select();
486
- }
487
- setCurrentItem(e) {
488
- this.interact(), this.currentId = e?.id;
489
- }
490
- setNextItems(e) {
491
- this.currentIndex !== void 0 && this.items.splice(this.currentIndex + 1, 0, ...e);
492
- }
493
- clearAndSetItems(e) {
494
- this.clear(), this.setCurrentItem(e[0]), this.setNextItems(e);
495
- }
496
- async playNext(e) {
497
- if (this.isEmpty) {
498
- this.clearAndSetItems(e);
499
- return;
500
- }
501
- this.setNextItems(e);
502
- }
503
- async playSelectedItemsNext() {
504
- await this.playNext(this.selectedItemsOrAllItems.map((e) => e.clone())), this.unselectAll();
505
- }
506
- async addItems(e) {
507
- if (this.isEmpty) {
508
- this.clearAndSetItems(e);
509
- return;
510
- }
511
- this.items.push(...e);
512
- }
513
- async addSelectedItems() {
514
- await this.addItems(this.selectedItemsOrAllItems.map((e) => e.clone())), this.unselectAll();
515
- }
516
- async playFirst(e) {
517
- if (this.isEmpty) {
518
- this.clearAndSetItems(e);
519
- return;
520
- }
521
- let { currentIndex: t } = this;
522
- t !== void 0 && (this.interact(), this.items.splice(t, 0, ...e), this.currentIndex = t);
523
- }
524
- moveItem(e, t) {
525
- let n = this.items.splice(this.items.indexOf(e), 1)[0];
526
- this.items.splice(t, 0, n);
527
- }
528
- async goToFirst() {
529
- this.currentIndex !== void 0 && (this.currentIndex = 0);
530
- }
531
- async removeItems(e) {
532
- let { currentItem: t } = this;
533
- re(this.items, ...e.filter((e) => e !== t));
534
- let { currentIndex: n, isLastItem: r } = this;
535
- re(this.items, e.find((e) => e === t)), this.currentItem !== t && (this.interact(), r ? await this.goToFirst() : this.currentIndex = n);
536
- }
537
- async removeSelectedItems() {
538
- await this.removeItems(this.selectedItemsOrAllItems), this.unselectAll();
539
- }
540
- async removeOtherItems(e) {
541
- let t = e.id;
542
- return this.removeItems(this.items.filter((e) => e.id !== t));
543
- }
544
- async removeItemsAbove(e) {
545
- let t = this.items.indexOf(e);
546
- return this.removeItems(this.items.filter((e, n) => n < t));
547
- }
548
- async previous() {
549
- this.currentIndex !== void 0 && this.hasPreviousItem && (this.interact(), this.currentIndex--);
550
- }
551
- async next() {
552
- this.currentIndex !== void 0 && this.hasNextItem && (this.interact(), this.currentIndex++);
553
- }
554
- addItemFromDto(e) {
555
- let t = this.createItemFromDto(e);
556
- return this.addItems([t]);
557
- }
558
- };
559
- U([h], J.prototype, "interacted", void 0), U([h], J.prototype, "items", void 0), U([h], J.prototype, "currentId", void 0), U([p], J.prototype, "isEmpty", null), U([p], J.prototype, "canClear", null), U([p], J.prototype, "currentItem", null), U([p], J.prototype, "canPlay", null), U([p], J.prototype, "canPause", null), U([p], J.prototype, "hasMultipleItems", null), U([p], J.prototype, "currentIndex", null), U([p], J.prototype, "hasPreviousItem", null), U([p], J.prototype, "hasNextItem", null), U([p], J.prototype, "isLastItem", null), U([p], J.prototype, "selectedItems", null), U([p], J.prototype, "allItemsSelected", null), U([p], J.prototype, "hasSelectedItems", null), U([p], J.prototype, "selectedItemsOrAllItems", null), U([p], J.prototype, "canAddSelectedItems", null), U([p], J.prototype, "canPlaySelectedItemsNext", null), U([p], J.prototype, "canRemoveSelectedItems", null), U([f.bound], J.prototype, "setItems", null), U([f.bound], J.prototype, "interact", null), U([f.bound], J.prototype, "clear", null), U([f.bound], J.prototype, "unselectAll", null), U([f.bound], J.prototype, "selectAll", null), U([f.bound], J.prototype, "setCurrentItem", null), U([f.bound], J.prototype, "setNextItems", null), U([f.bound], J.prototype, "clearAndSetItems", null), U([f.bound], J.prototype, "playNext", null), U([f.bound], J.prototype, "playSelectedItemsNext", null), U([f.bound], J.prototype, "addItems", null), U([f.bound], J.prototype, "addSelectedItems", null), U([f.bound], J.prototype, "playFirst", null), U([f.bound], J.prototype, "moveItem", null), U([f.bound], J.prototype, "goToFirst", null), U([f.bound], J.prototype, "removeItems", null), U([f.bound], J.prototype, "removeSelectedItems", null), U([f.bound], J.prototype, "removeOtherItems", null), U([f.bound], J.prototype, "removeItemsAbove", null), U([f.bound], J.prototype, "previous", null), U([f.bound], J.prototype, "next", null), U([f.bound], J.prototype, "addItemFromDto", null);
560
- //#endregion
561
- //#region src/features/media-player.play-queue/components/PlayQueueProvider.tsx
562
- var ft = ({ children: e }) => {
563
- let [n] = d(() => new J());
564
- ne(B.playQueue, n.localStorageState);
565
- let r = g();
566
- return s(() => te(() => n.currentItem, async (e, t) => {
567
- e === void 0 || t === void 0 || e.type === t.type && e.videoId === t.videoId && await r.setCurrentTime(0);
568
- }), [n, r]), /* @__PURE__ */ t(nt.Provider, {
569
- value: n,
570
- children: e
571
- });
572
- }, Y = class {
573
- controller = se;
574
- playing = !1;
575
- percent = 0;
576
- seeking = !1;
577
- constructor() {
578
- m(this);
579
- }
580
- setPlaying(e) {
581
- this.playing = e;
582
- }
583
- setPercent(e) {
584
- this.percent = e;
585
- }
586
- setSeeking(e) {
587
- this.seeking = e;
588
- }
589
- onControllerChange(e) {
590
- this.controller = e;
591
- }
592
- onPlay() {
593
- this.playing = !0;
594
- }
595
- onPause() {
596
- this.playing = !1;
597
- }
598
- onEnded() {
599
- this.playing = !1;
600
- }
601
- onTimeUpdate({ percent: e }) {
602
- e !== void 0 && (this.seeking || (this.percent = e));
603
- }
604
- };
605
- U([h], Y.prototype, "controller", void 0), U([h], Y.prototype, "playing", void 0), U([h], Y.prototype, "percent", void 0), U([h], Y.prototype, "seeking", void 0), U([f.bound], Y.prototype, "setPlaying", null), U([f.bound], Y.prototype, "setPercent", null), U([f.bound], Y.prototype, "setSeeking", null), U([f.bound], Y.prototype, "onControllerChange", null), U([f.bound], Y.prototype, "onPlay", null), U([f.bound], Y.prototype, "onPause", null), U([f.bound], Y.prototype, "onEnded", null), U([f.bound], Y.prototype, "onTimeUpdate", null);
606
- //#endregion
607
- //#region src/features/media-player.player/components/PlayerProvider.tsx
608
- var pt = ({ children: e }) => {
609
- let [n] = d(() => new Y());
610
- return /* @__PURE__ */ t(rt.Provider, {
611
- value: n,
612
- children: e
613
- });
614
- }, mt = r(void 0), ht = () => o(mt), X = class {
615
- playlistList;
616
- id;
617
- name;
618
- constructor(e, t, n) {
619
- this.playlistList = e, m(this), this.id = t, this.name = n;
620
- }
621
- async rename(e) {
622
- this.name = e;
623
- }
624
- remove() {
625
- return this.playlistList.removeItem(this);
626
- }
627
- };
628
- U([h], X.prototype, "id", void 0), U([h], X.prototype, "name", void 0), U([f.bound], X.prototype, "rename", null), U([f.bound], X.prototype, "remove", null);
629
- //#endregion
630
- //#region src/features/media-player.playlists/stores/PlaylistListStore.ts
631
- var gt = class {
632
- playlistList;
633
- constructor(e) {
634
- this.playlistList = e, m(this);
635
- }
636
- get state() {
637
- return { items: this.playlistList.items.map((e) => ({
638
- id: e.id,
639
- name: e.name
640
- })) };
641
- }
642
- set state(e) {
643
- this.playlistList.items = e.items?.map((e) => new X(this.playlistList, e.id, e.name)) ?? [];
644
- }
645
- validateState(e) {
646
- return !0;
647
- }
648
- };
649
- U([p.struct], gt.prototype, "state", null);
650
- var Z = class {
651
- localStorageState;
652
- items = [];
653
- constructor() {
654
- m(this), this.localStorageState = new gt(this);
655
- }
656
- createItem(e) {
657
- return new X(this, crypto.randomUUID(), e);
658
- }
659
- setItems(e) {
660
- this.items = e;
661
- }
662
- async addItem(e) {
663
- this.items.push(e);
664
- }
665
- async removeItem(e) {
666
- re(this.items, e);
667
- }
668
- };
669
- U([h], Z.prototype, "items", void 0), U([f.bound], Z.prototype, "setItems", null), U([f.bound], Z.prototype, "addItem", null), U([f.bound], Z.prototype, "removeItem", null);
670
- //#endregion
671
- //#region src/features/media-player.playlists/components/PlaylistListProvider.tsx
672
- var _t = ({ children: e }) => {
673
- let [n] = d(() => new Z());
674
- return ne(B.playlistList, n.localStorageState), /* @__PURE__ */ t(mt.Provider, {
675
- value: n,
676
- children: e
677
- });
678
- }, vt = ({ children: e, nostalgicDivaProps: n }) => /* @__PURE__ */ t(ae, {
679
- ...n,
680
- children: /* @__PURE__ */ t(Xe, {
681
- components: [
682
- pt,
683
- ft,
684
- at,
685
- ct,
686
- _t
687
- ],
688
- children: e
689
- })
690
- }), yt = {
691
- width: 400,
692
- height: 225
693
- }, bt = N(({ children: e }) => /* @__PURE__ */ n(O, {
694
- panelled: !0,
695
- style: { minBlockSize: "max(460px, 100vh - 81px)" },
696
- children: [e, !G().isEmpty && /* @__PURE__ */ t(be, { style: { blockSize: yt.height } })]
697
- })), xt = N(() => {
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(() => {
698
18
  let e = V();
699
- return /* @__PURE__ */ t(y, {
19
+ return /* @__PURE__ */ j(f, {
700
20
  title: `Shuffle: ${e.shuffle ? "On" : "Off"}`,
701
21
  "aria-label": `Shuffle: ${e.shuffle ? "On" : "Off"}`,
702
- iconType: e.shuffle ? Me : Ne,
22
+ iconType: e.shuffle ? we : Te,
703
23
  size: "s",
704
24
  iconSize: "l",
705
25
  onClick: e.toggleShuffle,
706
26
  disabled: !e.canToggleShuffle
707
27
  });
708
- }), St = N(() => {
28
+ }), Xe = k(() => {
709
29
  let e = V();
710
- return /* @__PURE__ */ t(y, {
30
+ return /* @__PURE__ */ j(f, {
711
31
  title: "Previous",
712
32
  "aria-label": "Previous",
713
- iconType: Ve,
33
+ iconType: Ne,
714
34
  size: "s",
715
35
  iconSize: "l",
716
36
  onClick: e.previous,
717
37
  disabled: !e.canPrevious
718
38
  });
719
- }), Ct = N(() => {
39
+ }), Ze = k(() => {
720
40
  let e = V();
721
- return /* @__PURE__ */ t(y, {
41
+ return /* @__PURE__ */ j(f, {
722
42
  title: "Skip back 10 seconds",
723
43
  "aria-label": "Skip back 10 seconds",
724
- iconType: Ue,
44
+ iconType: Fe,
725
45
  size: "s",
726
46
  iconSize: "l",
727
47
  onClick: e.skipBack10,
728
48
  disabled: !e.canSkipBack10
729
49
  });
730
- }), wt = N(() => {
50
+ }), Qe = k(() => {
731
51
  let e = V();
732
- return /* @__PURE__ */ t(y, {
52
+ return /* @__PURE__ */ j(f, {
733
53
  title: "Pause",
734
54
  "aria-label": "Pause",
735
- iconType: ze,
55
+ iconType: je,
736
56
  size: "s",
737
57
  iconSize: "l",
738
58
  onClick: e.pause,
739
59
  disabled: !e.canPause
740
60
  });
741
- }), Tt = N(() => {
61
+ }), $e = k(() => {
742
62
  let e = V();
743
- return /* @__PURE__ */ t(y, {
63
+ return /* @__PURE__ */ j(f, {
744
64
  title: "Play",
745
65
  "aria-label": "Play",
746
- iconType: Be,
66
+ iconType: Me,
747
67
  size: "s",
748
68
  iconSize: "l",
749
69
  onClick: e.play,
750
70
  disabled: !e.canPlay
751
71
  });
752
- }), Et = N(() => {
72
+ }), et = k(() => {
753
73
  let e = V();
754
- return /* @__PURE__ */ t(y, {
74
+ return /* @__PURE__ */ j(f, {
755
75
  title: "Skip forward 30 seconds",
756
76
  "aria-label": "Skip forward 30 seconds",
757
- iconType: We,
77
+ iconType: Ie,
758
78
  size: "s",
759
79
  iconSize: "l",
760
80
  onClick: e.skipForward30,
761
81
  disabled: !e.canSkipForward30
762
82
  });
763
- }), Dt = N(() => {
83
+ }), tt = k(() => {
764
84
  let e = V();
765
- return /* @__PURE__ */ t(y, {
85
+ return /* @__PURE__ */ j(f, {
766
86
  title: "Next",
767
87
  "aria-label": "Next",
768
- iconType: Le,
88
+ iconType: ke,
769
89
  size: "s",
770
90
  iconSize: "l",
771
91
  onClick: e.next,
772
92
  disabled: !e.canNext
773
93
  });
774
- }), Ot = {
775
- [H.Off]: je,
776
- [H.All]: Ae,
777
- [H.One]: ke
778
- }, kt = N(() => {
94
+ }), nt = {
95
+ [H.Off]: Ce,
96
+ [H.All]: Se,
97
+ [H.One]: xe
98
+ }, rt = k(() => {
779
99
  let e = V();
780
- return /* @__PURE__ */ t(y, {
100
+ return /* @__PURE__ */ j(f, {
781
101
  title: `Repeat: ${e.repeat === H.All ? "All" : e.repeat === H.One ? "One" : "Off"}`,
782
102
  "aria-label": `Repeat: ${e.repeat === H.All ? "All" : e.repeat === H.One ? "One" : "Off"}`,
783
- iconType: Ot[e.repeat],
103
+ iconType: nt[e.repeat],
784
104
  size: "s",
785
105
  iconSize: "l",
786
106
  onClick: e.toggleRepeat,
787
107
  disabled: !e.canToggleRepeat
788
108
  });
789
- }), At = N(() => {
109
+ }), it = k(() => {
790
110
  let e = V();
791
- return /* @__PURE__ */ n(C, {
111
+ return /* @__PURE__ */ M(h, {
792
112
  responsive: !1,
793
113
  gutterSize: "s",
794
114
  justifyContent: "center",
795
115
  alignItems: "center",
796
116
  children: [
797
- /* @__PURE__ */ t(E, {
117
+ /* @__PURE__ */ j(v, {
798
118
  sizes: ["xs"],
799
- children: /* @__PURE__ */ t(xt, {})
119
+ children: /* @__PURE__ */ j(Ye, {})
800
120
  }),
801
- /* @__PURE__ */ t(St, {}),
802
- /* @__PURE__ */ t(E, {
121
+ /* @__PURE__ */ j(Xe, {}),
122
+ /* @__PURE__ */ j(v, {
803
123
  sizes: ["xs"],
804
- children: /* @__PURE__ */ t(Ct, {})
124
+ children: /* @__PURE__ */ j(Ze, {})
805
125
  }),
806
- e.playing ? /* @__PURE__ */ t(wt, {}) : /* @__PURE__ */ t(Tt, {}),
807
- /* @__PURE__ */ t(E, {
126
+ e.playing ? /* @__PURE__ */ j(Qe, {}) : /* @__PURE__ */ j($e, {}),
127
+ /* @__PURE__ */ j(v, {
808
128
  sizes: ["xs"],
809
- children: /* @__PURE__ */ t(Et, {})
129
+ children: /* @__PURE__ */ j(et, {})
810
130
  }),
811
- /* @__PURE__ */ t(Dt, {}),
812
- /* @__PURE__ */ t(E, {
131
+ /* @__PURE__ */ j(tt, {}),
132
+ /* @__PURE__ */ j(v, {
813
133
  sizes: ["xs"],
814
- children: /* @__PURE__ */ t(kt, {})
134
+ children: /* @__PURE__ */ j(rt, {})
815
135
  })
816
136
  ]
817
137
  });
818
- }), jt = i(({ item: e, closePopover: n }) => {
819
- let r = a(({ name: e, icon: t, onClick: r }) => ({
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 }) => ({
820
149
  name: e,
821
- icon: t,
150
+ icon: n,
822
151
  onClick: async (e) => {
823
- n(), r(e);
152
+ t(), r(e);
824
153
  }
825
- }), [n]);
826
- return /* @__PURE__ */ t(x, {
154
+ }), [t]);
155
+ return /* @__PURE__ */ j(m, {
827
156
  initialPanelId: 0,
828
- panels: l(() => [{
157
+ panels: o(() => [{
829
158
  id: 0,
830
159
  items: [
831
160
  r({
832
161
  name: "Open in new tab",
833
- icon: /* @__PURE__ */ t(D, { type: Re }),
162
+ icon: /* @__PURE__ */ j(y, { type: Ae }),
834
163
  onClick: async () => {
835
164
  window.open(e.dto.url, "_blank");
836
165
  }
837
166
  }),
838
167
  r({
839
168
  name: "Copy link address",
840
- icon: /* @__PURE__ */ t(D, { type: "" }),
169
+ icon: /* @__PURE__ */ j(y, { type: "" }),
841
170
  onClick: async () => {
842
171
  await navigator.clipboard.writeText(e.dto.url);
843
172
  }
844
173
  }),
845
174
  r({
846
175
  name: "Copy link text",
847
- icon: /* @__PURE__ */ t(D, { type: "" }),
176
+ icon: /* @__PURE__ */ j(y, { type: "" }),
848
177
  onClick: async () => {
849
178
  await navigator.clipboard.writeText(e.dto.title);
850
179
  }
@@ -852,97 +181,97 @@ var _t = ({ children: e }) => {
852
181
  ]
853
182
  }], [r, e])
854
183
  });
855
- }), Mt = i(({ item: e }) => {
856
- let [n, r] = d(!1), i = a(() => r(!n), [n]), o = a(() => r(!1), []);
857
- return /* @__PURE__ */ t(k, {
858
- button: /* @__PURE__ */ t(v, {
859
- iconType: z.get(e.type),
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),
860
189
  size: "s",
861
190
  onClick: i,
862
191
  children: e.title
863
192
  }),
864
- isOpen: n,
865
- closePopover: o,
193
+ isOpen: t,
194
+ closePopover: a,
866
195
  panelPaddingSize: "none",
867
196
  anchorPosition: "upLeft",
868
- children: /* @__PURE__ */ t(jt, {
197
+ children: /* @__PURE__ */ j(ot, {
869
198
  item: e,
870
- closePopover: o
199
+ closePopover: a
871
200
  })
872
201
  });
873
- }), Nt = N(() => {
202
+ }), ct = k(() => {
874
203
  let e = V();
875
- return /* @__PURE__ */ t(C, {
204
+ return /* @__PURE__ */ j(h, {
876
205
  responsive: !1,
877
206
  gutterSize: "s",
878
207
  justifyContent: "flexStart",
879
208
  alignItems: "center",
880
- children: e.currentItem && /* @__PURE__ */ t(Mt, { item: e.currentItem })
209
+ children: e.currentItem && /* @__PURE__ */ j(st, { item: e.currentItem })
881
210
  });
882
- }), Pt = N(() => /* @__PURE__ */ t(y, {
211
+ }), lt = k(() => /* @__PURE__ */ j(f, {
883
212
  title: "Mute",
884
213
  "aria-label": "Mute",
885
- iconType: Ge,
214
+ iconType: Le,
886
215
  size: "s",
887
216
  iconSize: "l",
888
217
  disabled: !V().controller.supports("setMuted")
889
- })), Ft = N(({ button: e, isOpen: r, closePopover: i }) => {
890
- let o = V(), [s, l] = d("0"), u = g();
891
- c(() => {
892
- r && u.getVolume().then((e) => {
893
- e !== void 0 && l(Math.floor(e * 100).toString());
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());
894
223
  });
895
- }, [r, u]);
896
- let ee = a(async (e) => {
897
- l(e.currentTarget.value), await u.setVolume(Number(e.currentTarget.value) / 100);
898
- }, [u]);
899
- return /* @__PURE__ */ t(k, {
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, {
900
229
  button: e,
901
- isOpen: r,
902
- closePopover: i,
230
+ isOpen: t,
231
+ closePopover: r,
903
232
  anchorPosition: "upRight",
904
- children: /* @__PURE__ */ t(T, { children: /* @__PURE__ */ n(C, {
233
+ children: /* @__PURE__ */ j(_, { children: /* @__PURE__ */ M(h, {
905
234
  responsive: !1,
906
235
  gutterSize: "s",
907
236
  justifyContent: "center",
908
237
  alignItems: "center",
909
- children: [/* @__PURE__ */ t(Pt, {}), /* @__PURE__ */ t(ve, {
238
+ children: [/* @__PURE__ */ j(lt, {}), /* @__PURE__ */ j(ue, {
910
239
  min: 0,
911
240
  max: 100,
912
241
  step: 1,
913
- value: s,
914
- onChange: ee,
242
+ value: o,
243
+ onChange: u,
915
244
  css: { blockSize: 32 },
916
- disabled: !o.controller.supports("setVolume")
245
+ disabled: !i.controller.supports("setVolume")
917
246
  })]
918
247
  }) })
919
248
  });
920
- }), It = N(() => {
921
- let e = V(), [n, r] = d(!1);
922
- return /* @__PURE__ */ t(Ft, {
923
- button: /* @__PURE__ */ t(y, {
249
+ }), dt = k(() => {
250
+ let e = V(), [t, n] = c(!1);
251
+ return /* @__PURE__ */ j(ut, {
252
+ button: /* @__PURE__ */ j(f, {
924
253
  title: "Volume",
925
254
  "aria-label": "Volume",
926
- iconType: Ge,
255
+ iconType: Le,
927
256
  size: "s",
928
257
  iconSize: "l",
929
- onClick: () => r(!n),
258
+ onClick: () => n(!t),
930
259
  disabled: !e.controller.supports("getVolume")
931
260
  }),
932
- isOpen: n,
933
- closePopover: () => r(!1)
261
+ isOpen: t,
262
+ closePopover: () => n(!1)
934
263
  });
935
- }), Lt = ({ onClickPlayQueueButton: e }) => /* @__PURE__ */ t(y, {
264
+ }), ft = ({ onClickPlayQueueButton: e }) => /* @__PURE__ */ j(f, {
936
265
  title: "Play queue",
937
266
  "aria-label": "Play queue",
938
- iconType: Ie,
267
+ iconType: Oe,
939
268
  size: "s",
940
269
  iconSize: "l",
941
270
  onClick: e
942
- }), Rt = N(({ closePopover: e }) => {
943
- let n = V(), r = g(), [i, o] = d(), s = a(async () => {
944
- await n.controller.getPlaybackRate().then((e) => o(e));
945
- }, [n]), c = a(({ name: t, icon: n, onClick: r, disabled: i, className: a }) => ({
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 }) => ({
946
275
  name: t,
947
276
  icon: n,
948
277
  onClick: async () => {
@@ -951,50 +280,50 @@ var _t = ({ children: e }) => {
951
280
  disabled: i,
952
281
  className: a
953
282
  }), [e]);
954
- return /* @__PURE__ */ t(x, {
283
+ return /* @__PURE__ */ j(m, {
955
284
  initialPanelId: 0,
956
- panels: l(() => [{
285
+ panels: o(() => [{
957
286
  id: 0,
958
287
  items: [
959
288
  {
960
289
  name: "Speed",
961
- icon: /* @__PURE__ */ t(D, { type: Ke }),
290
+ icon: /* @__PURE__ */ j(y, { type: Re }),
962
291
  panel: 1,
963
292
  onClick: s,
964
- disabled: !n.controller.supports("getPlaybackRate")
293
+ disabled: !t.controller.supports("getPlaybackRate")
965
294
  },
966
- c({
295
+ l({
967
296
  name: "Skip back 10 seconds",
968
- icon: /* @__PURE__ */ t(D, { type: Ue }),
969
- onClick: n.skipBack10,
970
- disabled: !n.canSkipBack10
297
+ icon: /* @__PURE__ */ j(y, { type: Fe }),
298
+ onClick: t.skipBack10,
299
+ disabled: !t.canSkipBack10
971
300
  }),
972
- c({
301
+ l({
973
302
  name: "Skip forward 30 seconds",
974
- icon: /* @__PURE__ */ t(D, { type: We }),
975
- onClick: n.skipForward30,
976
- disabled: !n.canSkipForward30
303
+ icon: /* @__PURE__ */ j(y, { type: Ie }),
304
+ onClick: t.skipForward30,
305
+ disabled: !t.canSkipForward30
977
306
  }),
978
- c({
979
- name: `Shuffle: ${n.shuffle ? "On" : "Off"}`,
980
- icon: /* @__PURE__ */ t(D, { type: n.shuffle ? Me : Ne }),
981
- onClick: n.toggleShuffle,
982
- disabled: !n.canToggleShuffle,
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,
983
312
  className: "eui-showFor--xs--flex"
984
313
  }),
985
- c({
986
- name: `Repeat: ${n.repeat === H.All ? "All" : n.repeat === H.One ? "One" : "Off"}`,
987
- icon: /* @__PURE__ */ t(D, { type: Ot[n.repeat] }),
988
- onClick: n.toggleRepeat,
989
- disabled: !n.canToggleRepeat,
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,
990
319
  className: "eui-showFor--xs--flex"
991
320
  }),
992
321
  { isSeparator: !0 },
993
- c({
322
+ l({
994
323
  name: "Remove from play queue",
995
- icon: /* @__PURE__ */ t(D, { type: F }),
996
- onClick: n.removeFromPlayQueue,
997
- disabled: !n.canRemoveFromPlayQueue
324
+ icon: /* @__PURE__ */ j(y, { type: E }),
325
+ onClick: t.removeFromPlayQueue,
326
+ disabled: !t.canRemoveFromPlayQueue
998
327
  })
999
328
  ]
1000
329
  }, {
@@ -1009,271 +338,278 @@ var _t = ({ children: e }) => {
1009
338
  1.5,
1010
339
  1.75,
1011
340
  2
1012
- ].map((e) => c({
341
+ ].map((e) => l({
1013
342
  name: e.toString(),
1014
343
  onClick: () => r.setPlaybackRate(e),
1015
344
  icon: e === i ? "check" : "empty",
1016
- disabled: !n.controller.supports("setPlaybackRate")
345
+ disabled: !t.controller.supports("setPlaybackRate")
1017
346
  }))
1018
347
  }], [
1019
- n,
1020
- c,
348
+ t,
349
+ l,
1021
350
  s,
1022
351
  r,
1023
352
  i
1024
353
  ])
1025
354
  });
1026
- }), zt = i(({ button: e, isOpen: n, closePopover: r }) => /* @__PURE__ */ t(k, {
355
+ }), mt = t(({ button: e, isOpen: t, closePopover: n }) => /* @__PURE__ */ j(x, {
1027
356
  button: e,
1028
- isOpen: n,
1029
- closePopover: r,
357
+ isOpen: t,
358
+ closePopover: n,
1030
359
  panelPaddingSize: "none",
1031
360
  anchorPosition: "upRight",
1032
- children: /* @__PURE__ */ t(Rt, { closePopover: r })
1033
- })), Bt = i(() => {
1034
- let [e, n] = d(!1);
1035
- return /* @__PURE__ */ t(zt, {
1036
- button: /* @__PURE__ */ t(y, {
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, {
1037
366
  title: "More options",
1038
367
  "aria-label": "More options",
1039
- iconType: I,
368
+ iconType: D,
1040
369
  size: "s",
1041
370
  iconSize: "l",
1042
- onClick: () => n(!e)
371
+ onClick: () => t(!e)
1043
372
  }),
1044
373
  isOpen: e,
1045
- closePopover: () => n(!1)
374
+ closePopover: () => t(!1)
1046
375
  });
1047
- }), Vt = i(({ onClickPlayQueueButton: e }) => /* @__PURE__ */ n(C, {
376
+ }), gt = t(({ onClickPlayQueueButton: e }) => /* @__PURE__ */ M(h, {
1048
377
  responsive: !1,
1049
378
  gutterSize: "s",
1050
379
  justifyContent: "flexEnd",
1051
380
  alignItems: "center",
1052
381
  children: [
1053
- /* @__PURE__ */ t(It, {}),
1054
- e && /* @__PURE__ */ t(Lt, { onClickPlayQueueButton: e }),
1055
- /* @__PURE__ */ t(Bt, {})
382
+ /* @__PURE__ */ j(dt, {}),
383
+ e && /* @__PURE__ */ j(ft, { onClickPlayQueueButton: e }),
384
+ /* @__PURE__ */ j(ht, {})
1056
385
  ]
1057
- })), Ht = N(() => {
1058
- let e = V(), n = g(), r = a((t) => {
386
+ })), _t = k(() => {
387
+ let e = V(), t = N(), r = n((t) => {
1059
388
  let n = Number(t.currentTarget.value) / 100;
1060
389
  e.setPercent(n);
1061
- }, [e]), i = a((t) => {
390
+ }, [e]), i = n((t) => {
1062
391
  t.button === 0 && e.setSeeking(!0);
1063
- }, [e]), o = a(async (t) => {
1064
- if (t.button === 0) {
1065
- let r = Number(t.currentTarget.value) / 100;
392
+ }, [e]), a = n(async (n) => {
393
+ if (n.button === 0) {
394
+ let r = Number(n.currentTarget.value) / 100;
1066
395
  e.setSeeking(!1);
1067
- let i = await n.getDuration();
1068
- i !== void 0 && await n.setCurrentTime(i * r);
396
+ let i = await t.getDuration();
397
+ i !== void 0 && await t.setCurrentTime(i * r);
1069
398
  }
1070
- }, [e, n]);
1071
- return /* @__PURE__ */ t(ve, {
399
+ }, [e, t]);
400
+ return /* @__PURE__ */ j(ue, {
1072
401
  min: 0,
1073
402
  max: 100,
1074
403
  step: 1e-7,
1075
404
  value: e.percent * 100,
1076
405
  onChange: r,
1077
406
  onMouseDown: i,
1078
- onMouseUp: o,
407
+ onMouseUp: a,
1079
408
  fullWidth: !0,
1080
409
  showRange: !0,
1081
410
  css: { blockSize: 32 },
1082
411
  disabled: !e.canSeek
1083
412
  });
1084
- }), Ut = N(({ onClickPlayQueueButton: e }) => /* @__PURE__ */ t(ce, {
413
+ }), vt = k(({ onClickPlayQueueButton: e }) => /* @__PURE__ */ j(l, {
1085
414
  paddingSize: "s",
1086
- children: /* @__PURE__ */ n(C, {
415
+ children: /* @__PURE__ */ M(h, {
1087
416
  direction: "column",
1088
417
  gutterSize: "none",
1089
- children: [/* @__PURE__ */ t(w, { children: /* @__PURE__ */ t(Ht, {}) }), /* @__PURE__ */ t(w, { children: /* @__PURE__ */ n(C, {
418
+ children: [/* @__PURE__ */ j(g, { children: /* @__PURE__ */ j(_t, {}) }), /* @__PURE__ */ j(g, { children: /* @__PURE__ */ M(h, {
1090
419
  responsive: !1,
1091
420
  children: [
1092
- /* @__PURE__ */ t(w, {
421
+ /* @__PURE__ */ j(g, {
1093
422
  css: { width: "calc(100% / 3)" },
1094
- children: /* @__PURE__ */ t(Nt, {})
423
+ children: /* @__PURE__ */ j(ct, {})
1095
424
  }),
1096
- /* @__PURE__ */ t(w, {
425
+ /* @__PURE__ */ j(g, {
1097
426
  css: { width: "calc(100% / 3)" },
1098
- children: /* @__PURE__ */ t(At, {})
427
+ children: /* @__PURE__ */ j(it, {})
1099
428
  }),
1100
- /* @__PURE__ */ t(w, {
429
+ /* @__PURE__ */ j(g, {
1101
430
  css: { width: "calc(100% / 3)" },
1102
- children: /* @__PURE__ */ t(Vt, { onClickPlayQueueButton: e })
431
+ children: /* @__PURE__ */ j(gt, { onClickPlayQueueButton: e })
1103
432
  })
1104
433
  ]
1105
434
  }) })]
1106
435
  })
1107
- })), Wt = N(() => {
1108
- let e = st(), n = l(() => ({
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(() => ({
1109
445
  onLoaded: e.onLoaded,
1110
446
  onPlay: e.onPlay,
1111
447
  onPause: e.onPause,
1112
448
  onEnded: e.onEnded,
1113
449
  onTimeUpdate: e.onTimeUpdate
1114
450
  }), [e]);
1115
- return /* @__PURE__ */ t("div", {
451
+ return /* @__PURE__ */ j("div", {
1116
452
  css: {
1117
453
  position: "fixed",
1118
454
  right: 0,
1119
455
  bottom: 81,
1120
- width: yt.width,
1121
- height: yt.height,
456
+ width: xt.width,
457
+ height: xt.height,
1122
458
  zIndex: 998,
1123
459
  backgroundColor: "rgb(39, 39, 39)",
1124
460
  display: "flex",
1125
461
  flexDirection: "column"
1126
462
  },
1127
- children: /* @__PURE__ */ t("div", {
463
+ children: /* @__PURE__ */ j("div", {
1128
464
  css: {
1129
465
  flexGrow: 1,
1130
466
  backgroundColor: "black"
1131
467
  },
1132
- children: e.currentItem && /* @__PURE__ */ t(ie, {
468
+ children: e.currentItem && /* @__PURE__ */ j(ze, {
1133
469
  src: e.currentItem.url,
1134
- options: n,
470
+ options: t,
1135
471
  onControllerChange: e.onControllerChange
1136
472
  })
1137
473
  })
1138
474
  });
1139
475
  });
1140
476
  //#endregion
1141
- //#region src/features/media-player.play-queue/helpers/isNoembedResult.ts
1142
- function Gt(e) {
477
+ //#region src/features/media-player/helpers/isNoembedResult.ts
478
+ function Et(e) {
1143
479
  return typeof e == "object" && !!e && "title" in e && typeof e.title == "string";
1144
480
  }
1145
481
  //#endregion
1146
- //#region src/features/media-player.play-queue/components/AddVideoModal.tsx
1147
- var Kt = R.create(({ remove: e, resolve: r }) => {
1148
- let i = De({ prefix: "modalForm" }), [a, o] = d(""), [s, c] = d(""), [l, u] = d(!1);
1149
- return /* @__PURE__ */ n(pe, {
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, {
1150
486
  onClose: e,
1151
487
  initialFocus: "[name=url]",
1152
488
  children: [
1153
- /* @__PURE__ */ t(ge, { children: /* @__PURE__ */ t(_e, { children: "Add video" }) }),
1154
- /* @__PURE__ */ t(me, { children: /* @__PURE__ */ n(de, {
1155
- id: i,
489
+ /* @__PURE__ */ j(ce, { children: /* @__PURE__ */ j(le, { children: "Add video" }) }),
490
+ /* @__PURE__ */ j(oe, { children: /* @__PURE__ */ M(re, {
491
+ id: n,
1156
492
  component: "form",
1157
- onSubmit: async (t) => {
1158
- t.preventDefault();
493
+ onSubmit: async (n) => {
494
+ n.preventDefault();
1159
495
  try {
1160
- u(!0);
1161
- let t = oe(a);
1162
- if (t === void 0) return;
1163
- let n = t.extractVideoId(a);
496
+ l(!0);
497
+ let n = He(r);
1164
498
  if (n === void 0) return;
1165
- let i = await (await fetch(`https://noembed.com/embed?url=${encodeURIComponent(a)}`)).json();
1166
- r({
1167
- url: a,
1168
- type: t.type,
1169
- videoId: n,
1170
- title: s || (Gt(i) ? i.title : n)
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)
1171
507
  }), e();
1172
508
  } finally {
1173
- u(!1);
509
+ l(!1);
1174
510
  }
1175
511
  },
1176
- children: [/* @__PURE__ */ t(T, {
512
+ children: [/* @__PURE__ */ j(_, {
1177
513
  label: "URL",
1178
- children: /* @__PURE__ */ t(S, {
514
+ children: /* @__PURE__ */ j(ne, {
1179
515
  name: "url",
1180
- value: a,
1181
- onChange: (e) => o(e.target.value)
516
+ value: r,
517
+ onChange: (e) => i(e.target.value)
1182
518
  })
1183
- }), /* @__PURE__ */ t(T, {
519
+ }), /* @__PURE__ */ j(_, {
1184
520
  label: "Title",
1185
- children: /* @__PURE__ */ t(S, {
521
+ children: /* @__PURE__ */ j(ne, {
1186
522
  name: "title",
1187
- value: s,
1188
- onChange: (e) => c(e.target.value)
523
+ value: a,
524
+ onChange: (e) => o(e.target.value)
1189
525
  })
1190
526
  })]
1191
527
  }) }),
1192
- /* @__PURE__ */ n(he, { children: [/* @__PURE__ */ t(v, {
528
+ /* @__PURE__ */ M(se, { children: [/* @__PURE__ */ j(d, {
1193
529
  onClick: e,
1194
530
  children: "Cancel"
1195
- }), /* @__PURE__ */ t(_, {
531
+ }), /* @__PURE__ */ j(u, {
1196
532
  type: "submit",
1197
- form: i,
533
+ form: n,
1198
534
  fill: !0,
1199
- disabled: a.trim().length === 0,
1200
- isLoading: l,
535
+ disabled: r.trim().length === 0,
536
+ isLoading: s,
1201
537
  children: "Add video"
1202
538
  })] })
1203
539
  ]
1204
540
  });
1205
- }), qt = i(({ onFulfilled: e }) => /* @__PURE__ */ t(_, {
1206
- onClick: () => R.show(Kt).then(e),
1207
- iconType: P,
541
+ }), Ot = t(({ onFulfilled: e }) => /* @__PURE__ */ j(u, {
542
+ onClick: () => P.show(Dt).then(e),
543
+ iconType: T,
1208
544
  color: "primary",
1209
545
  children: "Add video"
1210
- })), Jt = N(({ playQueue: e }) => /* @__PURE__ */ t(_, {
1211
- iconType: P,
546
+ })), kt = k(({ playQueue: e }) => /* @__PURE__ */ j(u, {
547
+ iconType: T,
1212
548
  onClick: e.addSelectedItems,
1213
549
  disabled: !e.canAddSelectedItems,
1214
550
  children: "Add to play queue"
1215
- })), Yt = N(({ playQueue: e, closePopover: n }) => {
1216
- let r = a(({ name: e, icon: t, disabled: r, onClick: i }) => ({
551
+ })), At = k(({ playQueue: e, closePopover: t }) => {
552
+ let r = n(({ name: e, icon: n, disabled: r, onClick: i }) => ({
1217
553
  name: e,
1218
- icon: t,
554
+ icon: n,
1219
555
  disabled: r,
1220
556
  onClick: async (e) => {
1221
- n(), i(e);
557
+ t(), i(e);
1222
558
  }
1223
- }), [n]);
1224
- return /* @__PURE__ */ t(x, {
559
+ }), [t]);
560
+ return /* @__PURE__ */ j(m, {
1225
561
  initialPanelId: 0,
1226
- panels: l(() => [{
562
+ panels: o(() => [{
1227
563
  id: 0,
1228
564
  items: [
1229
565
  r({
1230
566
  name: "Play next",
1231
- icon: /* @__PURE__ */ t(D, { type: "" }),
567
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1232
568
  disabled: !e.canPlaySelectedItemsNext,
1233
569
  onClick: e.playSelectedItemsNext
1234
570
  }),
1235
571
  r({
1236
572
  name: "Add to play queue",
1237
- icon: /* @__PURE__ */ t(D, { type: P }),
573
+ icon: /* @__PURE__ */ j(y, { type: T }),
1238
574
  onClick: e.addSelectedItems,
1239
575
  disabled: !e.canAddSelectedItems
1240
576
  }),
1241
577
  r({
1242
578
  name: "Remove",
1243
- icon: /* @__PURE__ */ t(D, { type: F }),
579
+ icon: /* @__PURE__ */ j(y, { type: E }),
1244
580
  onClick: e.removeSelectedItems,
1245
581
  disabled: !e.canRemoveSelectedItems
1246
582
  }),
1247
583
  r({
1248
584
  name: "Clear",
1249
- icon: /* @__PURE__ */ t(D, { type: Fe }),
585
+ icon: /* @__PURE__ */ j(y, { type: De }),
1250
586
  onClick: e.clear,
1251
587
  disabled: !e.canClear
1252
588
  })
1253
589
  ]
1254
590
  }], [r, e])
1255
591
  });
1256
- }), Xt = i(({ playQueue: e }) => {
1257
- let [n, r] = d(!1), i = a(() => r(!n), [n]), o = a(() => r(!1), []);
1258
- return /* @__PURE__ */ t(k, {
1259
- button: /* @__PURE__ */ t(y, {
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, {
1260
596
  display: "base",
1261
597
  size: "m",
1262
- iconType: I,
598
+ iconType: D,
1263
599
  onClick: i
1264
600
  }),
1265
- isOpen: n,
1266
- closePopover: o,
601
+ isOpen: t,
602
+ closePopover: a,
1267
603
  panelPaddingSize: "none",
1268
604
  anchorPosition: "downLeft",
1269
- children: /* @__PURE__ */ t(Yt, {
605
+ children: /* @__PURE__ */ j(At, {
1270
606
  playQueue: e,
1271
- closePopover: o
607
+ closePopover: a
1272
608
  })
1273
609
  });
1274
- }), Zt = N(({ playQueue: e }) => {
1275
- let { euiTheme: r } = M();
1276
- return /* @__PURE__ */ n(C, {
610
+ }), Mt = k(({ playQueue: e }) => {
611
+ let { euiTheme: t } = w();
612
+ return /* @__PURE__ */ M(h, {
1277
613
  alignItems: "center",
1278
614
  gutterSize: "m",
1279
615
  responsive: !1,
@@ -1281,37 +617,37 @@ var Kt = R.create(({ remove: e, resolve: r }) => {
1281
617
  position: "sticky",
1282
618
  top: 48,
1283
619
  zIndex: 998,
1284
- background: r.colors.backgroundBasePlain
620
+ background: t.colors.backgroundBasePlain
1285
621
  },
1286
622
  children: [
1287
- /* @__PURE__ */ n(E, {
623
+ /* @__PURE__ */ M(v, {
1288
624
  sizes: ["xs"],
1289
625
  children: [
1290
- /* @__PURE__ */ t(w, {
626
+ /* @__PURE__ */ j(g, {
1291
627
  grow: !1,
1292
- children: /* @__PURE__ */ t(_, {
628
+ children: /* @__PURE__ */ j(u, {
1293
629
  disabled: !e.canPlaySelectedItemsNext,
1294
630
  onClick: e.playSelectedItemsNext,
1295
631
  children: "Play next"
1296
632
  })
1297
633
  }),
1298
- /* @__PURE__ */ t(w, {
634
+ /* @__PURE__ */ j(g, {
1299
635
  grow: !1,
1300
- children: /* @__PURE__ */ t(Jt, { playQueue: e })
636
+ children: /* @__PURE__ */ j(kt, { playQueue: e })
1301
637
  }),
1302
- /* @__PURE__ */ t(w, {
638
+ /* @__PURE__ */ j(g, {
1303
639
  grow: !1,
1304
- children: /* @__PURE__ */ t(_, {
1305
- iconType: F,
640
+ children: /* @__PURE__ */ j(u, {
641
+ iconType: E,
1306
642
  onClick: e.removeSelectedItems,
1307
643
  disabled: !e.canRemoveSelectedItems,
1308
644
  children: "Remove"
1309
645
  })
1310
646
  }),
1311
- /* @__PURE__ */ t(w, {
647
+ /* @__PURE__ */ j(g, {
1312
648
  grow: !1,
1313
- children: /* @__PURE__ */ t(_, {
1314
- iconType: Fe,
649
+ children: /* @__PURE__ */ j(u, {
650
+ iconType: De,
1315
651
  onClick: e.clear,
1316
652
  disabled: !e.canClear,
1317
653
  children: "Clear"
@@ -1319,342 +655,342 @@ var Kt = R.create(({ remove: e, resolve: r }) => {
1319
655
  })
1320
656
  ]
1321
657
  }),
1322
- /* @__PURE__ */ t(ye, {
658
+ /* @__PURE__ */ j(de, {
1323
659
  sizes: ["xs"],
1324
- children: /* @__PURE__ */ t(Xt, { playQueue: e })
660
+ children: /* @__PURE__ */ j(jt, { playQueue: e })
1325
661
  }),
1326
- /* @__PURE__ */ t(w, { grow: !0 }),
1327
- /* @__PURE__ */ t(w, {
662
+ /* @__PURE__ */ j(g, { grow: !0 }),
663
+ /* @__PURE__ */ j(g, {
1328
664
  grow: !1,
1329
- children: /* @__PURE__ */ t(qt, { onFulfilled: e.addItemFromDto })
665
+ children: /* @__PURE__ */ j(Ot, { onFulfilled: e.addItemFromDto })
1330
666
  })
1331
667
  ]
1332
668
  });
1333
- }), Qt = N(({ playQueue: r }) => {
1334
- let { euiTheme: i } = M();
1335
- return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(we, { children: /* @__PURE__ */ t(C, {
669
+ }), Nt = k(({ playQueue: e }) => {
670
+ let { euiTheme: t } = w();
671
+ return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(ge, { children: /* @__PURE__ */ j(h, {
1336
672
  responsive: !1,
1337
673
  justifyContent: "spaceBetween",
1338
674
  alignItems: "baseline",
1339
- children: /* @__PURE__ */ t(w, {
675
+ children: /* @__PURE__ */ j(g, {
1340
676
  grow: !1,
1341
- children: /* @__PURE__ */ t(b, {
677
+ children: /* @__PURE__ */ j(p, {
1342
678
  id: "",
1343
- checked: r.allItemsSelected,
1344
- onChange: (e) => {
1345
- e.target.checked ? r.selectAll() : r.unselectAll();
679
+ checked: e.allItemsSelected,
680
+ onChange: (t) => {
681
+ t.target.checked ? e.selectAll() : e.unselectAll();
1346
682
  }
1347
683
  })
1348
684
  })
1349
- }) }), /* @__PURE__ */ n(Se, {
685
+ }) }), /* @__PURE__ */ M(me, {
1350
686
  style: {
1351
687
  position: "sticky",
1352
688
  top: 112,
1353
689
  zIndex: 998,
1354
- background: i.colors.backgroundBasePlain
690
+ background: t.colors.backgroundBasePlain
1355
691
  },
1356
692
  children: [
1357
- /* @__PURE__ */ t(Ce, { children: /* @__PURE__ */ t(b, {
693
+ /* @__PURE__ */ j(he, { children: /* @__PURE__ */ j(p, {
1358
694
  id: "",
1359
- checked: r.allItemsSelected,
1360
- onChange: (e) => {
1361
- e.target.checked ? r.selectAll() : r.unselectAll();
695
+ checked: e.allItemsSelected,
696
+ onChange: (t) => {
697
+ t.target.checked ? e.selectAll() : e.unselectAll();
1362
698
  }
1363
699
  }) }),
1364
- /* @__PURE__ */ t(A, { width: 24 }),
1365
- /* @__PURE__ */ t(A, { children: "Title" }),
1366
- /* @__PURE__ */ t(A, {})
700
+ /* @__PURE__ */ j(S, { width: 24 }),
701
+ /* @__PURE__ */ j(S, { children: "Title" }),
702
+ /* @__PURE__ */ j(S, {})
1367
703
  ]
1368
704
  })] });
1369
- }), $t = N(({ item: e, closePopover: n }) => {
1370
- let r = a(({ name: e, icon: t, disabled: r, onClick: i, className: a }) => ({
705
+ }), Pt = k(({ item: e, closePopover: t }) => {
706
+ let r = n(({ name: e, icon: n, disabled: r, onClick: i, className: a }) => ({
1371
707
  name: e,
1372
- icon: t,
708
+ icon: n,
1373
709
  disabled: r,
1374
710
  onClick: async (e) => {
1375
- n(), i(e);
711
+ t(), i(e);
1376
712
  },
1377
713
  className: a
1378
- }), [n]);
1379
- return /* @__PURE__ */ t(x, {
714
+ }), [t]);
715
+ return /* @__PURE__ */ j(m, {
1380
716
  initialPanelId: 0,
1381
- panels: l(() => [{
717
+ panels: o(() => [{
1382
718
  id: 0,
1383
719
  items: [
1384
720
  r({
1385
721
  name: "Play",
1386
- icon: /* @__PURE__ */ t(D, { type: L }),
722
+ icon: /* @__PURE__ */ j(y, { type: O }),
1387
723
  onClick: e.play,
1388
724
  className: "eui-showFor--xs--flex"
1389
725
  }),
1390
726
  r({
1391
727
  name: "Play first",
1392
- icon: /* @__PURE__ */ t(D, { type: "" }),
728
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1393
729
  onClick: e.playFirst
1394
730
  }),
1395
731
  r({
1396
732
  name: "Play next",
1397
- icon: /* @__PURE__ */ t(D, { type: "" }),
733
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1398
734
  onClick: e.playNext
1399
735
  }),
1400
736
  r({
1401
737
  name: "Add to play queue",
1402
- icon: /* @__PURE__ */ t(D, { type: P }),
738
+ icon: /* @__PURE__ */ j(y, { type: T }),
1403
739
  onClick: e.addToPlayQueue
1404
740
  }),
1405
741
  { isSeparator: !0 },
1406
742
  r({
1407
743
  name: "Move to the top",
1408
- icon: /* @__PURE__ */ t(D, { type: Pe }),
744
+ icon: /* @__PURE__ */ j(y, { type: Ee }),
1409
745
  onClick: e.moveToTop,
1410
746
  disabled: !e.canMoveToTop
1411
747
  }),
1412
748
  r({
1413
749
  name: "Move to the bottom",
1414
- icon: /* @__PURE__ */ t(D, { type: Oe }),
750
+ icon: /* @__PURE__ */ j(y, { type: be }),
1415
751
  onClick: e.moveToBottom,
1416
752
  disabled: !e.canMoveToBottom
1417
753
  }),
1418
754
  { isSeparator: !0 },
1419
755
  r({
1420
756
  name: "Remove",
1421
- icon: /* @__PURE__ */ t(D, { type: F }),
757
+ icon: /* @__PURE__ */ j(y, { type: E }),
1422
758
  onClick: e.remove,
1423
759
  className: "eui-showFor--xs--flex"
1424
760
  }),
1425
761
  r({
1426
762
  name: "Remove to the top",
1427
- icon: /* @__PURE__ */ t(D, { type: "" }),
763
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1428
764
  onClick: e.removeToTop,
1429
765
  disabled: !e.canRemoveToTop
1430
766
  }),
1431
767
  r({
1432
768
  name: "Remove others",
1433
- icon: /* @__PURE__ */ t(D, { type: "" }),
769
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1434
770
  onClick: e.removeOthers,
1435
771
  disabled: !e.canRemoveOthers
1436
772
  })
1437
773
  ]
1438
774
  }], [r, e])
1439
775
  });
1440
- }), en = i(({ item: e }) => {
1441
- let [n, r] = d(!1), i = a(() => r(!n), [n]), o = a(() => r(!1), []);
1442
- return /* @__PURE__ */ t(k, {
1443
- button: /* @__PURE__ */ t(y, {
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, {
1444
780
  title: "More options",
1445
781
  "aria-label": "More options",
1446
- iconType: I,
782
+ iconType: D,
1447
783
  size: "s",
1448
784
  color: "text",
1449
785
  onClick: i
1450
786
  }),
1451
- isOpen: n,
1452
- closePopover: o,
787
+ isOpen: t,
788
+ closePopover: a,
1453
789
  panelPaddingSize: "none",
1454
790
  anchorPosition: "leftCenter",
1455
- children: /* @__PURE__ */ t($t, {
791
+ children: /* @__PURE__ */ j(Pt, {
1456
792
  item: e,
1457
- closePopover: o
793
+ closePopover: a
1458
794
  })
1459
795
  });
1460
- }), tn = N(({ item: e }) => {
1461
- let r = g();
1462
- return /* @__PURE__ */ n(j, {
796
+ }), It = k(({ item: e }) => {
797
+ let t = N();
798
+ return /* @__PURE__ */ M(C, {
1463
799
  textOnly: !1,
1464
800
  hasActions: !0,
1465
801
  align: "right",
1466
- children: [/* @__PURE__ */ n(E, {
802
+ children: [/* @__PURE__ */ M(v, {
1467
803
  sizes: ["xs"],
1468
- children: [/* @__PURE__ */ t(_, {
1469
- iconType: L,
804
+ children: [/* @__PURE__ */ j(u, {
805
+ iconType: O,
1470
806
  size: "s",
1471
807
  onClick: async () => {
1472
- e.isCurrent ? await r.setCurrentTime(0) : await e.play();
808
+ e.isCurrent ? await t.setCurrentTime(0) : await e.play();
1473
809
  },
1474
810
  children: "Play"
1475
- }), /* @__PURE__ */ t(_, {
1476
- iconType: F,
811
+ }), /* @__PURE__ */ j(u, {
812
+ iconType: E,
1477
813
  size: "s",
1478
814
  onClick: e.remove,
1479
815
  children: "Remove"
1480
816
  })]
1481
- }), /* @__PURE__ */ t(en, { item: e })]
817
+ }), /* @__PURE__ */ j(Ft, { item: e })]
1482
818
  });
1483
- }), nn = N(({ item: e }) => {
1484
- let r = u(null), { isCurrent: i } = e;
1485
- return s(() => {
1486
- i && r.current?.closest("tr")?.scrollIntoView({
819
+ }), Lt = k(({ item: e }) => {
820
+ let t = s(null), { isCurrent: n } = e;
821
+ return i(() => {
822
+ n && t.current?.closest("tr")?.scrollIntoView({
1487
823
  behavior: "smooth",
1488
824
  block: "center"
1489
825
  });
1490
- }, [i]), /* @__PURE__ */ n(Te, {
826
+ }, [n]), /* @__PURE__ */ M(_e, {
1491
827
  isSelected: e.isCurrent,
1492
828
  hasSelection: !0,
1493
829
  hasActions: !0,
1494
830
  children: [
1495
- /* @__PURE__ */ t(Ee, { children: /* @__PURE__ */ t(b, {
831
+ /* @__PURE__ */ j(ve, { children: /* @__PURE__ */ j(p, {
1496
832
  id: e.id.toString(),
1497
833
  checked: e.isSelected,
1498
834
  onChange: e.toggleSelected
1499
835
  }) }),
1500
- /* @__PURE__ */ t(j, {
836
+ /* @__PURE__ */ j(C, {
1501
837
  textOnly: !1,
1502
- children: /* @__PURE__ */ t("img", {
1503
- ref: r,
1504
- src: z.get(e.type),
838
+ children: /* @__PURE__ */ j("img", {
839
+ ref: t,
840
+ src: at.get(e.type),
1505
841
  width: 16,
1506
842
  height: 16,
1507
843
  alt: e.type
1508
844
  })
1509
845
  }),
1510
- /* @__PURE__ */ t(j, {
846
+ /* @__PURE__ */ j(C, {
1511
847
  mobileOptions: {
1512
848
  header: !1,
1513
849
  enlarge: !0,
1514
850
  width: "100%"
1515
851
  },
1516
- children: /* @__PURE__ */ t(fe, {
852
+ children: /* @__PURE__ */ j(ie, {
1517
853
  href: e.url,
1518
854
  target: "_blank",
1519
855
  external: !0,
1520
856
  children: e.title
1521
857
  })
1522
858
  }),
1523
- /* @__PURE__ */ t(tn, { item: e })
859
+ /* @__PURE__ */ j(It, { item: e })
1524
860
  ]
1525
861
  });
1526
- }), rn = N(({ playQueue: e }) => /* @__PURE__ */ t(qe, {
862
+ }), Rt = k(({ playQueue: e }) => /* @__PURE__ */ j(We, {
1527
863
  tag: "tbody",
1528
864
  list: e.items,
1529
865
  setList: (t) => e.setItems(t),
1530
- children: e.items.map((e) => /* @__PURE__ */ t(nn, { item: e }, e.id))
1531
- })), an = N(({ playQueue: e }) => /* @__PURE__ */ n(xe, { children: [/* @__PURE__ */ t(Qt, { playQueue: e }), /* @__PURE__ */ t(rn, { playQueue: e })] })), on = N(({ playQueue: e }) => {
1532
- let { euiTheme: r } = M();
1533
- return /* @__PURE__ */ n(O.Section, { children: [
1534
- /* @__PURE__ */ t(Zt, { playQueue: e }),
1535
- /* @__PURE__ */ t(be, {
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, {
1536
872
  size: "l",
1537
873
  style: {
1538
874
  position: "sticky",
1539
875
  top: 88,
1540
876
  zIndex: 998,
1541
- background: r.colors.backgroundBasePlain
877
+ background: t.colors.backgroundBasePlain
1542
878
  }
1543
879
  }),
1544
- e.isEmpty ? /* @__PURE__ */ t(ue, {
1545
- title: /* @__PURE__ */ t("h2", { children: "We couldn't find any videos" }),
1546
- body: /* @__PURE__ */ t("p", { children: "Your video library doesn't contain any video content." }),
1547
- actions: /* @__PURE__ */ t(qt, { onFulfilled: e.addItemFromDto })
1548
- }) : /* @__PURE__ */ t(an, { playQueue: e })
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 })
1549
885
  ] });
1550
- }), sn = ({ breadcrumbs: e, tabs: n, ...r }) => {
1551
- let i = Je();
1552
- return /* @__PURE__ */ t(O.Header, {
1553
- ...r,
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,
1554
890
  breadcrumbs: e?.map(({ linkProps: e, ...t }) => ({
1555
891
  ...t,
1556
- href: e === void 0 ? void 0 : i.buildLocation(e).href,
892
+ href: e === void 0 ? void 0 : r.buildLocation(e).href,
1557
893
  onClick: e === void 0 ? void 0 : async (t) => {
1558
- t.preventDefault(), await i.navigate(e);
894
+ t.preventDefault(), await r.navigate(e);
1559
895
  }
1560
896
  })),
1561
- tabs: n?.map(({ linkProps: e, ...t }) => ({
897
+ tabs: t?.map(({ linkProps: e, ...t }) => ({
1562
898
  ...t,
1563
- href: e === void 0 ? void 0 : i.buildLocation(e).href,
899
+ href: e === void 0 ? void 0 : r.buildLocation(e).href,
1564
900
  onClick: e === void 0 ? void 0 : async (t) => {
1565
- t.preventDefault(), await i.navigate(e);
901
+ t.preventDefault(), await r.navigate(e);
1566
902
  }
1567
903
  }))
1568
904
  });
1569
- }, cn = () => {
1570
- let r = G();
1571
- return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(sn, {
905
+ }, Wt = () => {
906
+ let e = U();
907
+ return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(Ut, {
1572
908
  pageTitle: "Play queue",
1573
909
  rightSideItems: []
1574
- }), /* @__PURE__ */ t(on, { playQueue: r })] });
1575
- }, ln = R.create(({ remove: e, resolve: r, playlistListItem: i }) => {
1576
- let [o, s] = d(!1);
1577
- return /* @__PURE__ */ t(le, {
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, {
1578
914
  title: "Delete playlist permanently?",
1579
915
  onCancel: e,
1580
- onConfirm: a(async () => {
916
+ onConfirm: n(async () => {
1581
917
  try {
1582
- s(!0), r(), e();
918
+ a(!0), t(), e();
1583
919
  } finally {
1584
- s(!1);
920
+ a(!1);
1585
921
  }
1586
- }, [r, e]),
922
+ }, [t, e]),
1587
923
  cancelButtonText: "Cancel",
1588
924
  confirmButtonText: "Delete",
1589
925
  buttonColor: "danger",
1590
- isLoading: o,
1591
- children: /* @__PURE__ */ n("p", { children: [
926
+ isLoading: i,
927
+ children: /* @__PURE__ */ M("p", { children: [
1592
928
  "Are you sure you want to delete this playlist? If you delete '",
1593
- i.name,
929
+ r.name,
1594
930
  "', you won't be able to recover it."
1595
931
  ] })
1596
932
  });
1597
- }), un = N(({ playlist: e }) => /* @__PURE__ */ t(_, {
1598
- iconType: P,
933
+ }), Kt = k(({ playlist: e }) => /* @__PURE__ */ j(u, {
934
+ iconType: T,
1599
935
  onClick: e.addSelectedItems,
1600
936
  disabled: !e.canAddSelectedItems,
1601
937
  children: "Add to play queue"
1602
- })), dn = N(({ playlist: e, closePopover: n }) => {
1603
- let r = a(({ name: e, icon: t, disabled: r, onClick: i }) => ({
938
+ })), qt = k(({ playlist: e, closePopover: t }) => {
939
+ let r = n(({ name: e, icon: n, disabled: r, onClick: i }) => ({
1604
940
  name: e,
1605
- icon: t,
941
+ icon: n,
1606
942
  disabled: r,
1607
943
  onClick: async (e) => {
1608
- n(), i(e);
944
+ t(), i(e);
1609
945
  }
1610
- }), [n]);
1611
- return /* @__PURE__ */ t(x, {
946
+ }), [t]);
947
+ return /* @__PURE__ */ j(m, {
1612
948
  initialPanelId: 0,
1613
- panels: l(() => [{
949
+ panels: o(() => [{
1614
950
  id: 0,
1615
951
  items: [
1616
952
  r({
1617
953
  name: "Play next",
1618
- icon: /* @__PURE__ */ t(D, { type: "" }),
954
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1619
955
  disabled: !e.canPlaySelectedItemsNext,
1620
956
  onClick: e.playSelectedItemsNext
1621
957
  }),
1622
958
  r({
1623
959
  name: "Add to play queue",
1624
- icon: /* @__PURE__ */ t(D, { type: P }),
960
+ icon: /* @__PURE__ */ j(y, { type: T }),
1625
961
  onClick: e.addSelectedItems,
1626
962
  disabled: !e.canAddSelectedItems
1627
963
  }),
1628
964
  r({
1629
965
  name: "Remove",
1630
- icon: /* @__PURE__ */ t(D, { type: F }),
966
+ icon: /* @__PURE__ */ j(y, { type: E }),
1631
967
  onClick: e.removeSelectedItems,
1632
968
  disabled: !e.canRemoveSelectedItems
1633
969
  })
1634
970
  ]
1635
971
  }], [r, e])
1636
972
  });
1637
- }), fn = i(({ playlist: e }) => {
1638
- let [n, r] = d(!1), i = a(() => r(!n), [n]), o = a(() => r(!1), []);
1639
- return /* @__PURE__ */ t(k, {
1640
- button: /* @__PURE__ */ t(y, {
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, {
1641
977
  display: "base",
1642
978
  size: "m",
1643
- iconType: I,
979
+ iconType: D,
1644
980
  onClick: i
1645
981
  }),
1646
- isOpen: n,
1647
- closePopover: o,
982
+ isOpen: t,
983
+ closePopover: a,
1648
984
  panelPaddingSize: "none",
1649
985
  anchorPosition: "downLeft",
1650
- children: /* @__PURE__ */ t(dn, {
986
+ children: /* @__PURE__ */ j(qt, {
1651
987
  playlist: e,
1652
- closePopover: o
988
+ closePopover: a
1653
989
  })
1654
990
  });
1655
- }), pn = N(({ playlist: e }) => {
1656
- let { euiTheme: r } = M();
1657
- return /* @__PURE__ */ n(C, {
991
+ }), Yt = k(({ playlist: e }) => {
992
+ let { euiTheme: t } = w();
993
+ return /* @__PURE__ */ M(h, {
1658
994
  alignItems: "center",
1659
995
  gutterSize: "m",
1660
996
  responsive: !1,
@@ -1662,28 +998,28 @@ var Kt = R.create(({ remove: e, resolve: r }) => {
1662
998
  position: "sticky",
1663
999
  top: 48,
1664
1000
  zIndex: 998,
1665
- background: r.colors.backgroundBasePlain
1001
+ background: t.colors.backgroundBasePlain
1666
1002
  },
1667
1003
  children: [
1668
- /* @__PURE__ */ n(E, {
1004
+ /* @__PURE__ */ M(v, {
1669
1005
  sizes: ["xs"],
1670
1006
  children: [
1671
- /* @__PURE__ */ t(w, {
1007
+ /* @__PURE__ */ j(g, {
1672
1008
  grow: !1,
1673
- children: /* @__PURE__ */ t(_, {
1009
+ children: /* @__PURE__ */ j(u, {
1674
1010
  disabled: !e.canPlaySelectedItemsNext,
1675
1011
  onClick: e.playSelectedItemsNext,
1676
1012
  children: "Play next"
1677
1013
  })
1678
1014
  }),
1679
- /* @__PURE__ */ t(w, {
1015
+ /* @__PURE__ */ j(g, {
1680
1016
  grow: !1,
1681
- children: /* @__PURE__ */ t(un, { playlist: e })
1017
+ children: /* @__PURE__ */ j(Kt, { playlist: e })
1682
1018
  }),
1683
- /* @__PURE__ */ t(w, {
1019
+ /* @__PURE__ */ j(g, {
1684
1020
  grow: !1,
1685
- children: /* @__PURE__ */ t(_, {
1686
- iconType: F,
1021
+ children: /* @__PURE__ */ j(u, {
1022
+ iconType: E,
1687
1023
  onClick: e.removeSelectedItems,
1688
1024
  disabled: !e.canRemoveSelectedItems,
1689
1025
  children: "Remove"
@@ -1691,257 +1027,857 @@ var Kt = R.create(({ remove: e, resolve: r }) => {
1691
1027
  })
1692
1028
  ]
1693
1029
  }),
1694
- /* @__PURE__ */ t(ye, {
1030
+ /* @__PURE__ */ j(de, {
1695
1031
  sizes: ["xs"],
1696
- children: /* @__PURE__ */ t(fn, { playlist: e })
1032
+ children: /* @__PURE__ */ j(Jt, { playlist: e })
1697
1033
  }),
1698
- /* @__PURE__ */ t(w, { grow: !0 }),
1699
- /* @__PURE__ */ t(w, {
1034
+ /* @__PURE__ */ j(g, { grow: !0 }),
1035
+ /* @__PURE__ */ j(g, {
1700
1036
  grow: !1,
1701
- children: /* @__PURE__ */ t(qt, { onFulfilled: e.addItemFromDto })
1037
+ children: /* @__PURE__ */ j(Ot, { onFulfilled: e.addItemFromDto })
1702
1038
  })
1703
1039
  ]
1704
1040
  });
1705
- }), mn = N(({ playlist: r }) => /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(we, { children: /* @__PURE__ */ t(C, {
1041
+ }), Xt = k(({ playlist: e }) => /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(ge, { children: /* @__PURE__ */ j(h, {
1706
1042
  responsive: !1,
1707
1043
  justifyContent: "spaceBetween",
1708
1044
  alignItems: "baseline",
1709
- children: /* @__PURE__ */ t(w, {
1045
+ children: /* @__PURE__ */ j(g, {
1710
1046
  grow: !1,
1711
- children: /* @__PURE__ */ t(b, {
1047
+ children: /* @__PURE__ */ j(p, {
1712
1048
  id: "",
1713
- checked: r.allItemsSelected,
1714
- onChange: (e) => {
1715
- e.target.checked ? r.selectAll() : r.unselectAll();
1049
+ checked: e.allItemsSelected,
1050
+ onChange: (t) => {
1051
+ t.target.checked ? e.selectAll() : e.unselectAll();
1716
1052
  }
1717
1053
  })
1718
1054
  })
1719
- }) }), /* @__PURE__ */ n(Se, { children: [
1720
- /* @__PURE__ */ t(Ce, { children: /* @__PURE__ */ t(b, {
1055
+ }) }), /* @__PURE__ */ M(me, { children: [
1056
+ /* @__PURE__ */ j(he, { children: /* @__PURE__ */ j(p, {
1721
1057
  id: "",
1722
- checked: r.allItemsSelected,
1723
- onChange: (e) => {
1724
- e.target.checked ? r.selectAll() : r.unselectAll();
1058
+ checked: e.allItemsSelected,
1059
+ onChange: (t) => {
1060
+ t.target.checked ? e.selectAll() : e.unselectAll();
1725
1061
  }
1726
1062
  }) }),
1727
- /* @__PURE__ */ t(A, { width: 24 }),
1728
- /* @__PURE__ */ t(A, { children: "Title" }),
1729
- /* @__PURE__ */ t(A, {})
1730
- ] })] })), hn = i(({ item: e, closePopover: n }) => {
1731
- let r = a(({ name: e, icon: t, disabled: r, onClick: i, className: a }) => ({
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 }) => ({
1732
1068
  name: e,
1733
- icon: t,
1069
+ icon: n,
1734
1070
  disabled: r,
1735
1071
  onClick: async (e) => {
1736
- n(), i(e);
1072
+ t(), i(e);
1737
1073
  },
1738
1074
  className: a
1739
- }), [n]);
1740
- return /* @__PURE__ */ t(x, {
1075
+ }), [t]);
1076
+ return /* @__PURE__ */ j(m, {
1741
1077
  initialPanelId: 0,
1742
- panels: l(() => [{
1078
+ panels: o(() => [{
1743
1079
  id: 0,
1744
1080
  items: [
1745
1081
  r({
1746
1082
  name: "Play",
1747
- icon: /* @__PURE__ */ t(D, { type: L }),
1083
+ icon: /* @__PURE__ */ j(y, { type: O }),
1748
1084
  onClick: e.play,
1749
1085
  className: "eui-showFor--xs--flex"
1750
1086
  }),
1751
1087
  r({
1752
1088
  name: "Play first",
1753
- icon: /* @__PURE__ */ t(D, { type: "" }),
1089
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1754
1090
  onClick: e.playFirst
1755
1091
  }),
1756
1092
  r({
1757
1093
  name: "Play next",
1758
- icon: /* @__PURE__ */ t(D, { type: "" }),
1094
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1759
1095
  onClick: e.playNext
1760
1096
  }),
1761
1097
  r({
1762
1098
  name: "Add to play queue",
1763
- icon: /* @__PURE__ */ t(D, { type: P }),
1099
+ icon: /* @__PURE__ */ j(y, { type: T }),
1764
1100
  onClick: e.addToPlayQueue
1765
1101
  }),
1766
1102
  { isSeparator: !0 },
1767
1103
  r({
1768
1104
  name: "Move to the top",
1769
- icon: /* @__PURE__ */ t(D, { type: Pe }),
1105
+ icon: /* @__PURE__ */ j(y, { type: Ee }),
1770
1106
  onClick: e.moveToTop,
1771
1107
  disabled: !e.canMoveToTop
1772
1108
  }),
1773
1109
  r({
1774
1110
  name: "Move to the bottom",
1775
- icon: /* @__PURE__ */ t(D, { type: Oe }),
1111
+ icon: /* @__PURE__ */ j(y, { type: be }),
1776
1112
  onClick: e.moveToBottom,
1777
1113
  disabled: !e.canMoveToBottom
1778
1114
  }),
1779
1115
  { isSeparator: !0 },
1780
1116
  r({
1781
1117
  name: "Remove",
1782
- icon: /* @__PURE__ */ t(D, { type: F }),
1118
+ icon: /* @__PURE__ */ j(y, { type: E }),
1783
1119
  onClick: e.remove,
1784
1120
  className: "eui-showFor--xs--flex"
1785
1121
  }),
1786
1122
  r({
1787
1123
  name: "Remove to the top",
1788
- icon: /* @__PURE__ */ t(D, { type: "" }),
1124
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1789
1125
  onClick: e.removeToTop,
1790
1126
  disabled: !e.canRemoveToTop
1791
1127
  }),
1792
1128
  r({
1793
1129
  name: "Remove others",
1794
- icon: /* @__PURE__ */ t(D, { type: "" }),
1130
+ icon: /* @__PURE__ */ j(y, { type: "" }),
1795
1131
  onClick: e.removeOthers,
1796
1132
  disabled: !e.canRemoveOthers
1797
1133
  })
1798
1134
  ]
1799
1135
  }], [r, e])
1800
1136
  });
1801
- }), gn = i(({ item: e }) => {
1802
- let [n, r] = d(!1), i = a(() => r(!n), [n]), o = a(() => r(!1), []);
1803
- return /* @__PURE__ */ t(k, {
1804
- button: /* @__PURE__ */ t(y, {
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, {
1805
1141
  title: "More options",
1806
1142
  "aria-label": "More options",
1807
- iconType: I,
1143
+ iconType: D,
1808
1144
  size: "s",
1809
1145
  color: "text",
1810
1146
  onClick: i
1811
1147
  }),
1812
- isOpen: n,
1813
- closePopover: o,
1148
+ isOpen: t,
1149
+ closePopover: a,
1814
1150
  panelPaddingSize: "none",
1815
1151
  anchorPosition: "leftCenter",
1816
- children: /* @__PURE__ */ t(hn, {
1152
+ children: /* @__PURE__ */ j(Zt, {
1817
1153
  item: e,
1818
- closePopover: o
1154
+ closePopover: a
1819
1155
  })
1820
1156
  });
1821
- }), _n = N(({ item: e }) => /* @__PURE__ */ n(j, {
1157
+ }), $t = k(({ item: e }) => /* @__PURE__ */ M(C, {
1822
1158
  textOnly: !1,
1823
1159
  hasActions: !0,
1824
1160
  align: "right",
1825
- children: [/* @__PURE__ */ n(E, {
1161
+ children: [/* @__PURE__ */ M(v, {
1826
1162
  sizes: ["xs"],
1827
- children: [/* @__PURE__ */ t(_, {
1828
- iconType: L,
1163
+ children: [/* @__PURE__ */ j(u, {
1164
+ iconType: O,
1829
1165
  size: "s",
1830
1166
  onClick: e.play,
1831
1167
  children: "Play"
1832
- }), /* @__PURE__ */ t(_, {
1833
- iconType: F,
1168
+ }), /* @__PURE__ */ j(u, {
1169
+ iconType: E,
1834
1170
  size: "s",
1835
1171
  onClick: e.remove,
1836
1172
  children: "Remove"
1837
1173
  })]
1838
- }), /* @__PURE__ */ t(gn, { item: e })]
1839
- })), vn = N(({ item: e }) => /* @__PURE__ */ n(Te, {
1174
+ }), /* @__PURE__ */ j(Qt, { item: e })]
1175
+ })), en = k(({ item: e }) => /* @__PURE__ */ M(_e, {
1840
1176
  isSelected: e.isCurrent,
1841
1177
  hasSelection: !0,
1842
1178
  hasActions: !0,
1843
1179
  children: [
1844
- /* @__PURE__ */ t(Ee, { children: /* @__PURE__ */ t(b, {
1180
+ /* @__PURE__ */ j(ve, { children: /* @__PURE__ */ j(p, {
1845
1181
  id: e.id.toString(),
1846
1182
  checked: e.isSelected,
1847
1183
  onChange: e.toggleSelected
1848
1184
  }) }),
1849
- /* @__PURE__ */ t(j, {
1185
+ /* @__PURE__ */ j(C, {
1850
1186
  textOnly: !1,
1851
- children: /* @__PURE__ */ t("img", {
1852
- src: z.get(e.type),
1187
+ children: /* @__PURE__ */ j("img", {
1188
+ src: at.get(e.type),
1853
1189
  width: 16,
1854
1190
  height: 16,
1855
1191
  alt: e.type
1856
1192
  })
1857
1193
  }),
1858
- /* @__PURE__ */ t(j, {
1194
+ /* @__PURE__ */ j(C, {
1859
1195
  mobileOptions: {
1860
1196
  header: !1,
1861
1197
  enlarge: !0,
1862
1198
  width: "100%"
1863
1199
  },
1864
- children: /* @__PURE__ */ t(fe, {
1200
+ children: /* @__PURE__ */ j(ie, {
1865
1201
  href: e.url,
1866
1202
  target: "_blank",
1867
1203
  external: !0,
1868
1204
  children: e.title
1869
1205
  })
1870
1206
  }),
1871
- /* @__PURE__ */ t(_n, { item: e })
1207
+ /* @__PURE__ */ j($t, { item: e })
1872
1208
  ]
1873
- })), yn = N(({ playlist: e }) => /* @__PURE__ */ t(qe, {
1209
+ })), tn = k(({ playlist: e }) => /* @__PURE__ */ j(We, {
1874
1210
  tag: "tbody",
1875
1211
  list: e.items,
1876
1212
  setList: (t) => e.setItems(t),
1877
- children: e.items.map((e) => /* @__PURE__ */ t(vn, { item: e }, e.id))
1878
- })), bn = N(({ playlist: e }) => /* @__PURE__ */ n(xe, { children: [/* @__PURE__ */ t(mn, { playlist: e }), /* @__PURE__ */ t(yn, { playlist: e })] })), xn = N(({ playlist: r }) => {
1879
- let { euiTheme: i } = M();
1880
- return /* @__PURE__ */ n(O.Section, { children: [
1881
- /* @__PURE__ */ t(pn, { playlist: r }),
1882
- /* @__PURE__ */ t(be, {
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, {
1883
1219
  size: "l",
1884
1220
  style: {
1885
1221
  position: "sticky",
1886
1222
  top: 88,
1887
1223
  zIndex: 998,
1888
- background: i.colors.backgroundBasePlain
1224
+ background: t.colors.backgroundBasePlain
1889
1225
  }
1890
1226
  }),
1891
- r.isEmpty ? /* @__PURE__ */ t(e, {}) : /* @__PURE__ */ t(bn, { playlist: r })
1227
+ e.isEmpty ? /* @__PURE__ */ j(A, {}) : /* @__PURE__ */ j(nn, { playlist: e })
1892
1228
  ] });
1893
- }), Sn = R.create(({ remove: e, resolve: r, playlistListItem: i }) => {
1894
- let a = De({ prefix: "modalForm" }), [o, s] = d(i.name), [c, l] = d(!1);
1895
- return /* @__PURE__ */ n(pe, {
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
+ ]
1283
+ };
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;
1291
+ }
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
+ }
1379
+ };
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;
1388
+ }
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
+ }
1421
+ };
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
+ }
1508
+ };
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, {
1896
1563
  onClose: e,
1897
1564
  initialFocus: "[name=name]",
1898
1565
  children: [
1899
- /* @__PURE__ */ t(ge, { children: /* @__PURE__ */ t(_e, { children: "Rename playlist" }) }),
1900
- /* @__PURE__ */ t(me, { children: /* @__PURE__ */ t(de, {
1901
- id: a,
1566
+ /* @__PURE__ */ j(ce, { children: /* @__PURE__ */ j(le, { children: "Create playlist" }) }),
1567
+ /* @__PURE__ */ j(oe, { children: /* @__PURE__ */ j(re, {
1568
+ id: n,
1902
1569
  component: "form",
1903
- onSubmit: async (t) => {
1904
- t.preventDefault();
1570
+ onSubmit: async (n) => {
1571
+ n.preventDefault();
1905
1572
  try {
1906
- l(!0), r(o), e();
1573
+ o(!0), t(r), e();
1907
1574
  } finally {
1908
- l(!1);
1575
+ o(!1);
1909
1576
  }
1910
1577
  },
1911
- children: /* @__PURE__ */ t(T, {
1578
+ children: /* @__PURE__ */ j(_, {
1912
1579
  label: "Name",
1913
- children: /* @__PURE__ */ t(S, {
1580
+ children: /* @__PURE__ */ j(ne, {
1914
1581
  name: "name",
1915
- value: o,
1916
- onChange: (e) => s(e.target.value)
1582
+ value: r,
1583
+ onChange: (e) => i(e.target.value)
1917
1584
  })
1918
1585
  })
1919
1586
  }) }),
1920
- /* @__PURE__ */ n(he, { children: [/* @__PURE__ */ t(v, {
1587
+ /* @__PURE__ */ M(se, { children: [/* @__PURE__ */ j(d, {
1921
1588
  onClick: e,
1922
1589
  children: "Cancel"
1923
- }), /* @__PURE__ */ t(_, {
1590
+ }), /* @__PURE__ */ j(u, {
1924
1591
  type: "submit",
1925
- form: a,
1592
+ form: n,
1926
1593
  fill: !0,
1927
- disabled: o.trim().length === 0,
1928
- isLoading: c,
1929
- children: "Rename"
1594
+ disabled: r.trim().length === 0,
1595
+ isLoading: a,
1596
+ children: "Create playlist"
1930
1597
  })] })
1931
1598
  ]
1932
1599
  });
1933
- }), Q = class e {
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
+ }
1673
+ };
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 {
1934
1871
  playQueue;
1935
- playlist;
1936
1872
  dto;
1937
1873
  static nextId = 1;
1938
1874
  id;
1939
1875
  isSelected = !1;
1940
- constructor(t, n, r) {
1941
- this.playQueue = t, this.playlist = n, this.dto = r, m(this), this.id = e.nextId++;
1876
+ constructor(t, n) {
1877
+ this.playQueue = t, this.dto = n, L(this), this.id = e.nextId++;
1942
1878
  }
1943
- static fromDto(t, n, r) {
1944
- return new e(t, n, r);
1879
+ static fromDto(t, n) {
1880
+ return new e(t, n);
1945
1881
  }
1946
1882
  get url() {
1947
1883
  return this.dto.url;
@@ -1956,16 +1892,16 @@ var Kt = R.create(({ remove: e, resolve: r }) => {
1956
1892
  return this.dto.title;
1957
1893
  }
1958
1894
  get isCurrent() {
1959
- return !1;
1895
+ return this.playQueue.currentItem === this;
1960
1896
  }
1961
1897
  get index() {
1962
- return this.playlist.items.indexOf(this);
1898
+ return this.playQueue.items.indexOf(this);
1963
1899
  }
1964
1900
  get isFirst() {
1965
1901
  return this.index === 0;
1966
1902
  }
1967
1903
  get isLast() {
1968
- return this.index === this.playlist.items.length - 1;
1904
+ return this.index === this.playQueue.items.length - 1;
1969
1905
  }
1970
1906
  get canMoveToTop() {
1971
1907
  return !this.isFirst;
@@ -1977,7 +1913,10 @@ var Kt = R.create(({ remove: e, resolve: r }) => {
1977
1913
  return !this.isFirst;
1978
1914
  }
1979
1915
  get canRemoveOthers() {
1980
- return this.playlist.hasMultipleItems;
1916
+ return this.playQueue.hasMultipleItems;
1917
+ }
1918
+ clone() {
1919
+ return this.playQueue.createItemFromDto(this.dto);
1981
1920
  }
1982
1921
  unselect() {
1983
1922
  this.isSelected = !1;
@@ -1989,77 +1928,66 @@ var Kt = R.create(({ remove: e, resolve: r }) => {
1989
1928
  this.isSelected = !this.isSelected;
1990
1929
  }
1991
1930
  play() {
1992
- return this.playQueue.clearAndSetItems([this.playQueue.createItemFromDto(this.dto)]), Promise.resolve();
1931
+ return this.playQueue.setCurrentItem(this), Promise.resolve();
1993
1932
  }
1994
1933
  remove() {
1995
- return this.playlist.removeItems([this]);
1934
+ return this.playQueue.removeItems([this]);
1996
1935
  }
1997
1936
  playFirst() {
1998
- return this.playQueue.playFirst([this.playQueue.createItemFromDto(this.dto)]);
1937
+ return this.playQueue.playFirst([this.clone()]);
1999
1938
  }
2000
1939
  playNext() {
2001
- return this.playQueue.playNext([this.playQueue.createItemFromDto(this.dto)]);
1940
+ return this.playQueue.playNext([this.clone()]);
2002
1941
  }
2003
1942
  addToPlayQueue() {
2004
- return this.playQueue.addItems([this.playQueue.createItemFromDto(this.dto)]);
1943
+ return this.playQueue.addItems([this.clone()]);
2005
1944
  }
2006
1945
  moveToTop() {
2007
- this.playlist.moveItem(this, 0);
1946
+ this.playQueue.moveItem(this, 0);
2008
1947
  }
2009
1948
  moveToBottom() {
2010
- this.playlist.moveItem(this, this.playlist.items.length - 1);
1949
+ this.playQueue.moveItem(this, this.playQueue.items.length - 1);
2011
1950
  }
2012
1951
  removeToTop() {
2013
- return this.playlist.removeItemsAbove(this);
1952
+ return this.playQueue.removeItemsAbove(this);
2014
1953
  }
2015
1954
  removeOthers() {
2016
- return this.playlist.removeOtherItems(this);
1955
+ return this.playQueue.removeOtherItems(this);
2017
1956
  }
2018
1957
  };
2019
- U([h], Q.prototype, "isSelected", void 0), U([p], Q.prototype, "isCurrent", null), U([p], Q.prototype, "index", null), U([p], Q.prototype, "isFirst", null), U([p], Q.prototype, "isLast", null), U([p], Q.prototype, "canMoveToTop", null), U([p], Q.prototype, "canMoveToBottom", null), U([p], Q.prototype, "canRemoveToTop", null), U([p], Q.prototype, "canRemoveOthers", null), U([f.bound], Q.prototype, "unselect", null), U([f.bound], Q.prototype, "select", null), U([f.bound], Q.prototype, "toggleSelected", null), U([f.bound], Q.prototype, "play", null), U([f.bound], Q.prototype, "remove", null), U([f.bound], Q.prototype, "playFirst", null), U([f.bound], Q.prototype, "playNext", null), U([f.bound], Q.prototype, "addToPlayQueue", null), U([f.bound], Q.prototype, "moveToTop", null), U([f.bound], Q.prototype, "moveToBottom", null), U([f.bound], Q.prototype, "removeToTop", null), U([f.bound], Q.prototype, "removeOthers", null);
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);
2020
1959
  //#endregion
2021
- //#region src/features/media-player.playlists/stores/PlaylistStore.ts
2022
- var Cn = {
2023
- type: "object",
2024
- properties: {
2025
- version: {
2026
- type: "string",
2027
- nullable: !0
2028
- },
2029
- items: {
2030
- type: "array",
2031
- nullable: !0,
2032
- items: lt
2033
- }
2034
- }
2035
- }, wn = class {
2036
- playlist;
1960
+ //#region src/features/media-player/stores/PlayQueueStore.ts
1961
+ var Nn = class {
1962
+ playQueue;
2037
1963
  constructor(e) {
2038
- this.playlist = e, m(this);
1964
+ this.playQueue = e, L(this);
2039
1965
  }
2040
1966
  get state() {
2041
1967
  return {
2042
1968
  version: "1.0",
2043
- items: this.playlist.items.map((e) => e.dto)
1969
+ items: this.playQueue.items.map((e) => e.dto),
1970
+ currentIndex: this.playQueue.currentIndex
2044
1971
  };
2045
1972
  }
2046
1973
  set state(e) {
2047
- this.playlist.items = e.items?.map((e) => this.playlist.createItemFromDto(e)) ?? [];
1974
+ this.playQueue.items = e.items?.map((e) => this.playQueue.createItemFromDto(e)) ?? [], this.playQueue.currentIndex = e.currentIndex;
2048
1975
  }
2049
1976
  validateState(e) {
2050
- return $e(Cn, "PlaylistLocalStorageState")(e);
1977
+ return cn(Mn, "PlayQueueDto")(e);
2051
1978
  }
2052
1979
  };
2053
- U([p.struct], wn.prototype, "state", null);
2054
- var $ = class {
2055
- playQueue;
1980
+ W([I.struct], Nn.prototype, "state", null);
1981
+ var X = class {
1982
+ interacted = !1;
2056
1983
  localStorageState;
2057
1984
  items = [];
2058
- constructor(e) {
2059
- this.playQueue = e, m(this), this.localStorageState = new wn(this);
1985
+ currentId;
1986
+ constructor() {
1987
+ L(this), this.localStorageState = new Nn(this);
2060
1988
  }
2061
1989
  createItemFromDto(e) {
2062
- return Q.fromDto(this.playQueue, this, {
1990
+ return Y.fromDto(this, {
2063
1991
  url: e.url,
2064
1992
  type: e.type,
2065
1993
  videoId: e.videoId,
@@ -2069,9 +1997,36 @@ var $ = class {
2069
1997
  get isEmpty() {
2070
1998
  return this.items.length === 0;
2071
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
+ }
2072
2012
  get hasMultipleItems() {
2073
2013
  return this.items.length > 1;
2074
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
+ }
2075
2030
  get selectedItems() {
2076
2031
  return this.items.filter((e) => e.isSelected);
2077
2032
  }
@@ -2096,27 +2051,67 @@ var $ = class {
2096
2051
  setItems(e) {
2097
2052
  this.items = e;
2098
2053
  }
2054
+ interact() {
2055
+ this.interacted = !0;
2056
+ }
2057
+ clear() {
2058
+ this.interact(), this.currentIndex = void 0, this.items = [];
2059
+ }
2099
2060
  unselectAll() {
2100
2061
  for (let e of this.items) e.unselect();
2101
2062
  }
2102
2063
  selectAll() {
2103
2064
  for (let e of this.items) e.select();
2104
2065
  }
2105
- async playSelectedItemsNext() {
2106
- await this.playQueue.playNext(this.selectedItemsOrAllItems.map((e) => this.playQueue.createItemFromDto(e.dto))), this.unselectAll();
2066
+ setCurrentItem(e) {
2067
+ this.interact(), this.currentId = e?.id;
2107
2068
  }
2108
- async addSelectedItems() {
2109
- await this.playQueue.addItems(this.selectedItemsOrAllItems.map((e) => this.playQueue.createItemFromDto(e.dto))), this.unselectAll();
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();
2110
2084
  }
2111
2085
  async addItems(e) {
2086
+ if (this.isEmpty) {
2087
+ this.clearAndSetItems(e);
2088
+ return;
2089
+ }
2112
2090
  this.items.push(...e);
2113
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
+ }
2114
2103
  moveItem(e, t) {
2115
2104
  let n = this.items.splice(this.items.indexOf(e), 1)[0];
2116
2105
  this.items.splice(t, 0, n);
2117
2106
  }
2107
+ async goToFirst() {
2108
+ this.currentIndex !== void 0 && (this.currentIndex = 0);
2109
+ }
2118
2110
  async removeItems(e) {
2119
- re(this.items, ...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);
2120
2115
  }
2121
2116
  async removeSelectedItems() {
2122
2117
  await this.removeItems(this.selectedItemsOrAllItems), this.unselectAll();
@@ -2129,145 +2124,150 @@ var $ = class {
2129
2124
  let t = this.items.indexOf(e);
2130
2125
  return this.removeItems(this.items.filter((e, n) => n < t));
2131
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
+ }
2132
2133
  addItemFromDto(e) {
2133
2134
  let t = this.createItemFromDto(e);
2134
2135
  return this.addItems([t]);
2135
2136
  }
2136
- playAll() {
2137
- return this.playQueue.clearAndSetItems(this.items.map((e) => this.playQueue.createItemFromDto(e.dto))), Promise.resolve();
2137
+ };
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));
2138
2182
  }
2139
2183
  };
2140
- U([h], $.prototype, "items", void 0), U([p], $.prototype, "isEmpty", null), U([p], $.prototype, "hasMultipleItems", null), U([p], $.prototype, "selectedItems", null), U([p], $.prototype, "allItemsSelected", null), U([p], $.prototype, "hasSelectedItems", null), U([p], $.prototype, "selectedItemsOrAllItems", null), U([p], $.prototype, "canAddSelectedItems", null), U([p], $.prototype, "canPlaySelectedItemsNext", null), U([p], $.prototype, "canRemoveSelectedItems", null), U([f.bound], $.prototype, "setItems", null), U([f.bound], $.prototype, "unselectAll", null), U([f.bound], $.prototype, "selectAll", null), U([f.bound], $.prototype, "playSelectedItemsNext", null), U([f.bound], $.prototype, "addSelectedItems", null), U([f.bound], $.prototype, "addItems", null), U([f.bound], $.prototype, "moveItem", null), U([f.bound], $.prototype, "removeItems", null), U([f.bound], $.prototype, "removeSelectedItems", null), U([f.bound], $.prototype, "removeOtherItems", null), U([f.bound], $.prototype, "removeItemsAbove", null), U([f.bound], $.prototype, "addItemFromDto", null), U([f.bound], $.prototype, "playAll", null);
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);
2141
2185
  //#endregion
2142
- //#region src/features/media-player.playlists/pages/PlaylistDetailsPage.tsx
2143
- var Tn = ({ onClick: e }) => /* @__PURE__ */ t(_, {
2144
- onClick: e,
2145
- iconType: L,
2146
- fill: !0,
2147
- children: "Play all"
2148
- }), En = ({ playlistListItem: e, onFulfilled: n }) => /* @__PURE__ */ t(_, {
2149
- onClick: () => R.show(Sn, { playlistListItem: e }).then(n),
2150
- iconType: He,
2151
- children: "Rename"
2152
- }), Dn = ({ playlistListItem: e, onFulfilled: n }) => /* @__PURE__ */ t(_, {
2153
- onClick: () => R.show(ln, { playlistListItem: e }).then(n),
2154
- iconType: Fe,
2155
- children: "Delete"
2156
- }), On = N(({ playlistListItem: r }) => {
2157
- let i = B.playlist(r.id), o = G(), [s] = d(() => new $(o));
2158
- ne(i, s.localStorageState);
2159
- let c = Je(), l = a(async (e) => {
2160
- await r.rename(e);
2161
- }, [r]), u = a(async () => {
2162
- await c.navigate({ to: "/playlists" }), window.localStorage.removeItem(i), await r.remove();
2163
- }, [
2164
- r,
2165
- c,
2166
- i
2167
- ]);
2168
- return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(sn, {
2169
- pageTitle: r.name,
2170
- breadcrumbs: [{
2171
- text: "Playlists",
2172
- linkProps: { to: "/playlists" }
2173
- }, { text: r.name }],
2174
- rightSideItems: [
2175
- /* @__PURE__ */ t(Tn, { onClick: s.playAll }),
2176
- /* @__PURE__ */ t(En, {
2177
- playlistListItem: r,
2178
- onFulfilled: l
2179
- }),
2180
- /* @__PURE__ */ t(Dn, {
2181
- playlistListItem: r,
2182
- onFulfilled: u
2183
- })
2184
- ]
2185
- }), /* @__PURE__ */ t(xn, { playlist: s })] });
2186
- }), kn = R.create(({ remove: e, resolve: r }) => {
2187
- let i = De({ prefix: "modalForm" }), [a, o] = d(""), [s, c] = d(!1);
2188
- return /* @__PURE__ */ n(pe, {
2189
- onClose: e,
2190
- initialFocus: "[name=name]",
2191
- children: [
2192
- /* @__PURE__ */ t(ge, { children: /* @__PURE__ */ t(_e, { children: "Create playlist" }) }),
2193
- /* @__PURE__ */ t(me, { children: /* @__PURE__ */ t(de, {
2194
- id: i,
2195
- component: "form",
2196
- onSubmit: async (t) => {
2197
- t.preventDefault();
2198
- try {
2199
- c(!0), r(a), e();
2200
- } finally {
2201
- c(!1);
2202
- }
2203
- },
2204
- children: /* @__PURE__ */ t(T, {
2205
- label: "Name",
2206
- children: /* @__PURE__ */ t(S, {
2207
- name: "name",
2208
- value: a,
2209
- onChange: (e) => o(e.target.value)
2210
- })
2211
- })
2212
- }) }),
2213
- /* @__PURE__ */ n(he, { children: [/* @__PURE__ */ t(v, {
2214
- onClick: e,
2215
- children: "Cancel"
2216
- }), /* @__PURE__ */ t(_, {
2217
- type: "submit",
2218
- form: i,
2219
- fill: !0,
2220
- disabled: a.trim().length === 0,
2221
- isLoading: s,
2222
- children: "Create playlist"
2223
- })] })
2224
- ]
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
2225
2192
  });
2226
- }), An = ({ children: e, onFulfilled: n }) => /* @__PURE__ */ t(_, {
2227
- onClick: () => R.show(kn).then(n),
2228
- iconType: P,
2229
- fill: !0,
2230
- children: e
2231
- }), jn = ({ linkProps: e, ...n }) => {
2232
- let r = Je(), i = async (t) => {
2233
- t.preventDefault(), await r.navigate(e);
2234
- };
2235
- return /* @__PURE__ */ t(fe, {
2236
- ...n,
2237
- href: r.buildLocation(e).href,
2238
- onClick: i
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
2239
2256
  });
2240
- }, Mn = N(({ playlistList: e }) => /* @__PURE__ */ t(Se, { children: /* @__PURE__ */ t(A, { children: "Name" }) })), Nn = N(({ item: e }) => /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(jn, {
2241
- linkProps: {
2242
- to: "/playlists/$playlistId",
2243
- params: { playlistId: e.id }
2244
- },
2245
- children: e.name
2246
- }) }) }, e.id)), Pn = N(({ playlistList: e }) => /* @__PURE__ */ t(qe, {
2247
- tag: "tbody",
2248
- list: e.items,
2249
- setList: (t) => e.setItems(t),
2250
- children: e.items.map((e) => /* @__PURE__ */ t(Nn, { item: e }, e.id))
2251
- })), Fn = N(({ playlistList: e }) => /* @__PURE__ */ n(xe, { children: [/* @__PURE__ */ t(Mn, { playlistList: e }), /* @__PURE__ */ t(Pn, { playlistList: e })] })), In = () => /* @__PURE__ */ t(sn, {
2252
- pageTitle: "Playlists",
2253
- breadcrumbs: [{ text: "Playlists" }]
2254
- }), Ln = N(({ playlistList: e }) => {
2255
- let r = a(async (t) => {
2256
- await e.addItem(e.createItem(t));
2257
- }, [e]);
2258
- return /* @__PURE__ */ n(O.Section, { children: [
2259
- /* @__PURE__ */ t(An, {
2260
- onFulfilled: r,
2261
- children: "New playlist"
2262
- }),
2263
- /* @__PURE__ */ t(be, { size: "l" }),
2264
- /* @__PURE__ */ t(Fn, { playlistList: e })
2265
- ] });
2266
- }), Rn = i(() => {
2267
- let r = ht();
2268
- return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(In, {}), /* @__PURE__ */ t(Ln, { playlistList: r })] });
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
2269
  });
2270
2270
  //#endregion
2271
- export { Ut as BottomBar, vt as HydrangeanDivaProvider, bt as MediaPlayerLayout, Wt as MiniPlayer, nt as PlayQueueContext, cn as PlayQueuePage, on as PlayQueueSection, On as PlaylistDetailsPage, mt as PlaylistListContext, Rn as PlaylistListPage, H as RepeatMode, Ye as bottomBarHeight, G as usePlayQueue, ht as usePlaylistList, z as videoServiceIcons };
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
2272
 
2273
2273
  //# sourceMappingURL=index.es.js.map