@locpd/vidstack 1.12.14

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 (242) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/analyze.json.d.ts +8 -0
  4. package/bundle.d.ts +1 -0
  5. package/cdn/chunks/vidstack-2f5gzOW6.js +1 -0
  6. package/cdn/chunks/vidstack-BYgY9wmd.js +1 -0
  7. package/cdn/chunks/vidstack-BfBBPhXV.js +1 -0
  8. package/cdn/chunks/vidstack-Bjo5esRp.js +1 -0
  9. package/cdn/chunks/vidstack-BuL67v3q.js +1 -0
  10. package/cdn/chunks/vidstack-C0msPRTd.js +3 -0
  11. package/cdn/chunks/vidstack-CJNLoJPa.js +1 -0
  12. package/cdn/chunks/vidstack-CQSpZ7X8.js +16 -0
  13. package/cdn/chunks/vidstack-C_AxqLKV.js +1 -0
  14. package/cdn/chunks/vidstack-CioT3Yw2.js +1 -0
  15. package/cdn/chunks/vidstack-CrqkytHl.js +1 -0
  16. package/cdn/chunks/vidstack-D0M8R0ZU.js +1 -0
  17. package/cdn/chunks/vidstack-D40FSa5B.js +3 -0
  18. package/cdn/chunks/vidstack-DD2JwFVU.js +1 -0
  19. package/cdn/chunks/vidstack-DRH_1tFW.js +1 -0
  20. package/cdn/chunks/vidstack-DfDZuHNP.js +1 -0
  21. package/cdn/chunks/vidstack-DiNS2Vx5.js +1 -0
  22. package/cdn/chunks/vidstack-xjJ-ui_l.js +1 -0
  23. package/cdn/providers/vidstack-audio-2Dt_Ivbp.js +1 -0
  24. package/cdn/providers/vidstack-dash-CUtD4e6q.js +1 -0
  25. package/cdn/providers/vidstack-google-cast-BdORATUX.js +1 -0
  26. package/cdn/providers/vidstack-hls-R25Kb6DP.js +1 -0
  27. package/cdn/providers/vidstack-html-DaAUJYsD.js +1 -0
  28. package/cdn/providers/vidstack-video-Csvox7SO.js +1 -0
  29. package/cdn/providers/vidstack-vimeo-D4Z96kg2.js +1 -0
  30. package/cdn/providers/vidstack-youtube-DiND6h3s.js +1 -0
  31. package/cdn/vidstack.js +1 -0
  32. package/cdn/with-layouts/chunks/vidstack-2f5gzOW6.js +1 -0
  33. package/cdn/with-layouts/chunks/vidstack-45yH5los.js +1 -0
  34. package/cdn/with-layouts/chunks/vidstack-BBVMdOnf.js +1 -0
  35. package/cdn/with-layouts/chunks/vidstack-BB_ulI_T.js +1 -0
  36. package/cdn/with-layouts/chunks/vidstack-BcAewM33.js +1 -0
  37. package/cdn/with-layouts/chunks/vidstack-BfBBPhXV.js +1 -0
  38. package/cdn/with-layouts/chunks/vidstack-Bxv1Qnxe.js +1 -0
  39. package/cdn/with-layouts/chunks/vidstack-C2ZbG62f.js +3 -0
  40. package/cdn/with-layouts/chunks/vidstack-CCYIOKgL.js +1 -0
  41. package/cdn/with-layouts/chunks/vidstack-CL6PeIO1.js +1 -0
  42. package/cdn/with-layouts/chunks/vidstack-C_AxqLKV.js +1 -0
  43. package/cdn/with-layouts/chunks/vidstack-CifDkwDH.js +795 -0
  44. package/cdn/with-layouts/chunks/vidstack-Cry7aD59.js +3 -0
  45. package/cdn/with-layouts/chunks/vidstack-D065okCn.js +1 -0
  46. package/cdn/with-layouts/chunks/vidstack-DGuMoXmI.js +1 -0
  47. package/cdn/with-layouts/chunks/vidstack-DRH_1tFW.js +1 -0
  48. package/cdn/with-layouts/chunks/vidstack-DVBs1XoQ.js +1 -0
  49. package/cdn/with-layouts/chunks/vidstack-Dge3KT8k.js +1 -0
  50. package/cdn/with-layouts/chunks/vidstack-DiNS2Vx5.js +1 -0
  51. package/cdn/with-layouts/chunks/vidstack-HvYfJoen.js +1 -0
  52. package/cdn/with-layouts/providers/vidstack-audio-DE5vKIzW.js +1 -0
  53. package/cdn/with-layouts/providers/vidstack-dash-CA2agUuZ.js +1 -0
  54. package/cdn/with-layouts/providers/vidstack-google-cast-CGs-t8HM.js +1 -0
  55. package/cdn/with-layouts/providers/vidstack-hls-BHMbMFFR.js +1 -0
  56. package/cdn/with-layouts/providers/vidstack-html-Dm9gmNk6.js +1 -0
  57. package/cdn/with-layouts/providers/vidstack-video-C5it_Lbl.js +1 -0
  58. package/cdn/with-layouts/providers/vidstack-vimeo-BabLn9sy.js +1 -0
  59. package/cdn/with-layouts/providers/vidstack-youtube-D8UlccUL.js +1 -0
  60. package/cdn/with-layouts/vidstack.js +1 -0
  61. package/dev/chunks/vidstack-B7Zi3v_O.js +104 -0
  62. package/dev/chunks/vidstack-BFg1ZqiG.js +91 -0
  63. package/dev/chunks/vidstack-BGB2pa9s.js +58 -0
  64. package/dev/chunks/vidstack-BaIbHZE3.js +1519 -0
  65. package/dev/chunks/vidstack-Bb2rASIc.js +5188 -0
  66. package/dev/chunks/vidstack-Bcmx8pmK.js +224 -0
  67. package/dev/chunks/vidstack-Bl4b0Nen.js +29 -0
  68. package/dev/chunks/vidstack-Bo5OTJ06.js +58 -0
  69. package/dev/chunks/vidstack-BoAGnlRt.js +58 -0
  70. package/dev/chunks/vidstack-Bpr4fI4n.js +7 -0
  71. package/dev/chunks/vidstack-Bt8MP2DK.js +204 -0
  72. package/dev/chunks/vidstack-Bu2kfzUd.js +1637 -0
  73. package/dev/chunks/vidstack-C-ffXlSV.js +2995 -0
  74. package/dev/chunks/vidstack-C-ztJq-f.js +109 -0
  75. package/dev/chunks/vidstack-CFNlaVTR.js +55 -0
  76. package/dev/chunks/vidstack-C_l97D5j.js +254 -0
  77. package/dev/chunks/vidstack-CjhKISI0.js +114 -0
  78. package/dev/chunks/vidstack-CofXIJAy.js +57 -0
  79. package/dev/chunks/vidstack-CwTj4H1w.js +18 -0
  80. package/dev/chunks/vidstack-DDwbYVHV.js +66 -0
  81. package/dev/chunks/vidstack-DFImIcIL.js +11 -0
  82. package/dev/chunks/vidstack-DGDvUbvO.js +33 -0
  83. package/dev/chunks/vidstack-DO0kqA99.js +107 -0
  84. package/dev/chunks/vidstack-DXxIKXmd.js +50 -0
  85. package/dev/chunks/vidstack-DajrMUR0.js +297 -0
  86. package/dev/chunks/vidstack-DbBJlz7I.js +10 -0
  87. package/dev/chunks/vidstack-Dihypf8P.js +11 -0
  88. package/dev/chunks/vidstack-DlAhl87f.js +1193 -0
  89. package/dev/chunks/vidstack-Dm1xEU9Q.js +34 -0
  90. package/dev/chunks/vidstack-Dv_LIPFu.js +14 -0
  91. package/dev/chunks/vidstack-igYn0Apa.js +254 -0
  92. package/dev/chunks/vidstack-krOAtKMi.js +32 -0
  93. package/dev/chunks/vidstack-qh1N5_f_.js +26 -0
  94. package/dev/chunks/vidstack-rB-wqXw1.js +107 -0
  95. package/dev/chunks/vidstack-zG6PIeGg.js +66 -0
  96. package/dev/define/plyr-layout.js +51 -0
  97. package/dev/define/templates/plyr-layout.js +571 -0
  98. package/dev/define/templates/vidstack-audio-layout.js +167 -0
  99. package/dev/define/templates/vidstack-video-layout.js +390 -0
  100. package/dev/define/vidstack-icons.js +1 -0
  101. package/dev/define/vidstack-player-default-layout.js +21 -0
  102. package/dev/define/vidstack-player-layouts.js +25 -0
  103. package/dev/define/vidstack-player-ui.js +70 -0
  104. package/dev/define/vidstack-player.js +19 -0
  105. package/dev/global/plyr.js +501 -0
  106. package/dev/global/vidstack-player.js +129 -0
  107. package/dev/providers/vidstack-audio.js +35 -0
  108. package/dev/providers/vidstack-dash.js +516 -0
  109. package/dev/providers/vidstack-google-cast.js +474 -0
  110. package/dev/providers/vidstack-hls.js +408 -0
  111. package/dev/providers/vidstack-html.js +567 -0
  112. package/dev/providers/vidstack-video.js +207 -0
  113. package/dev/providers/vidstack-vimeo.js +554 -0
  114. package/dev/providers/vidstack-youtube.js +286 -0
  115. package/dev/vidstack-elements.js +36 -0
  116. package/dev/vidstack.js +91 -0
  117. package/dom.d.ts +91 -0
  118. package/elements.d.ts +1433 -0
  119. package/empty.vtt +1 -0
  120. package/global/player.d.ts +52 -0
  121. package/global/plyr.d.ts +343 -0
  122. package/google-cast.d.ts +1422 -0
  123. package/icons.d.ts +1 -0
  124. package/index.d.ts +402 -0
  125. package/package.json +199 -0
  126. package/player/index.d.ts +3 -0
  127. package/player/layouts/default.d.ts +3 -0
  128. package/player/layouts/index.d.ts +3 -0
  129. package/player/layouts/plyr.d.ts +3 -0
  130. package/player/styles/base.css +153 -0
  131. package/player/styles/default/buffering.css +55 -0
  132. package/player/styles/default/buttons.css +175 -0
  133. package/player/styles/default/captions.css +181 -0
  134. package/player/styles/default/chapter-title.css +26 -0
  135. package/player/styles/default/controls.css +56 -0
  136. package/player/styles/default/gestures.css +19 -0
  137. package/player/styles/default/icons.css +6 -0
  138. package/player/styles/default/keyboard.css +148 -0
  139. package/player/styles/default/layouts/audio.css +417 -0
  140. package/player/styles/default/layouts/video.css +590 -0
  141. package/player/styles/default/menus.css +959 -0
  142. package/player/styles/default/poster.css +52 -0
  143. package/player/styles/default/sliders.css +391 -0
  144. package/player/styles/default/theme.css +2461 -0
  145. package/player/styles/default/thumbnail.css +40 -0
  146. package/player/styles/default/time.css +45 -0
  147. package/player/styles/default/tooltips.css +141 -0
  148. package/player/styles/plyr/theme.css +1237 -0
  149. package/player/ui.d.ts +3 -0
  150. package/plugins.d.ts +19 -0
  151. package/plugins.js +13 -0
  152. package/prod/chunks/vidstack-B01xzxC4.js +7 -0
  153. package/prod/chunks/vidstack-BCeb7ryV.js +201 -0
  154. package/prod/chunks/vidstack-BGSTndAW.js +1590 -0
  155. package/prod/chunks/vidstack-BPitBBjh.js +1519 -0
  156. package/prod/chunks/vidstack-BQlOPwOu.js +45 -0
  157. package/prod/chunks/vidstack-BSDzlwxO.js +4778 -0
  158. package/prod/chunks/vidstack-BT0m6zEi.js +109 -0
  159. package/prod/chunks/vidstack-BTigPj2h.js +55 -0
  160. package/prod/chunks/vidstack-BiyXcJ_M.js +107 -0
  161. package/prod/chunks/vidstack-BoVf5n1M.js +2985 -0
  162. package/prod/chunks/vidstack-Bq6c3Bam.js +58 -0
  163. package/prod/chunks/vidstack-ByLCIBtB.js +297 -0
  164. package/prod/chunks/vidstack-C2US-gSO.js +248 -0
  165. package/prod/chunks/vidstack-C9vIqaYT.js +10 -0
  166. package/prod/chunks/vidstack-CF6fixCQ.js +1193 -0
  167. package/prod/chunks/vidstack-CTojmhKq.js +66 -0
  168. package/prod/chunks/vidstack-ChQTHmIQ.js +77 -0
  169. package/prod/chunks/vidstack-Cm6_unwd.js +246 -0
  170. package/prod/chunks/vidstack-CwTj4H1w.js +18 -0
  171. package/prod/chunks/vidstack-D3ltXc3a.js +33 -0
  172. package/prod/chunks/vidstack-D5EzK014.js +14 -0
  173. package/prod/chunks/vidstack-DDXt6fpN.js +58 -0
  174. package/prod/chunks/vidstack-DJDnh4xT.js +11 -0
  175. package/prod/chunks/vidstack-DXxIKXmd.js +50 -0
  176. package/prod/chunks/vidstack-D_-9AA6_.js +29 -0
  177. package/prod/chunks/vidstack-DbkZGjSn.js +107 -0
  178. package/prod/chunks/vidstack-Dihypf8P.js +11 -0
  179. package/prod/chunks/vidstack-Dm1xEU9Q.js +34 -0
  180. package/prod/chunks/vidstack-Dq5Yu0Vr.js +205 -0
  181. package/prod/chunks/vidstack-DqAw8m9J.js +26 -0
  182. package/prod/chunks/vidstack-DsPOyKtl.js +57 -0
  183. package/prod/chunks/vidstack-krOAtKMi.js +32 -0
  184. package/prod/chunks/vidstack-nLyr4NEP.js +58 -0
  185. package/prod/chunks/vidstack-xMS8dnYq.js +114 -0
  186. package/prod/chunks/vidstack-yEGTpgeA.js +104 -0
  187. package/prod/define/plyr-layout.js +51 -0
  188. package/prod/define/templates/plyr-layout.js +571 -0
  189. package/prod/define/templates/vidstack-audio-layout.js +167 -0
  190. package/prod/define/templates/vidstack-video-layout.js +390 -0
  191. package/prod/define/vidstack-icons.js +1 -0
  192. package/prod/define/vidstack-player-default-layout.js +21 -0
  193. package/prod/define/vidstack-player-layouts.js +25 -0
  194. package/prod/define/vidstack-player-ui.js +70 -0
  195. package/prod/define/vidstack-player.js +19 -0
  196. package/prod/global/plyr.js +493 -0
  197. package/prod/global/vidstack-player.js +129 -0
  198. package/prod/providers/vidstack-audio.js +35 -0
  199. package/prod/providers/vidstack-dash.js +501 -0
  200. package/prod/providers/vidstack-google-cast.js +468 -0
  201. package/prod/providers/vidstack-hls.js +393 -0
  202. package/prod/providers/vidstack-html.js +555 -0
  203. package/prod/providers/vidstack-video.js +204 -0
  204. package/prod/providers/vidstack-vimeo.js +548 -0
  205. package/prod/providers/vidstack-youtube.js +286 -0
  206. package/prod/vidstack-elements.js +36 -0
  207. package/prod/vidstack.js +158 -0
  208. package/server/chunks/vidstack-6juFdkKy.js +29 -0
  209. package/server/chunks/vidstack-B7iHmv7_.js +307 -0
  210. package/server/chunks/vidstack-BmxyML9v.js +1619 -0
  211. package/server/chunks/vidstack-BskfxwD3.js +566 -0
  212. package/server/chunks/vidstack-BvLV0SMz.js +4642 -0
  213. package/server/chunks/vidstack-BvWwluXZ.js +205 -0
  214. package/server/chunks/vidstack-C-413dj2.js +8 -0
  215. package/server/chunks/vidstack-C26K8z_-.js +55 -0
  216. package/server/chunks/vidstack-CJJiksDz.js +107 -0
  217. package/server/chunks/vidstack-CUNv52x1.js +141 -0
  218. package/server/chunks/vidstack-CqyBCODe.js +295 -0
  219. package/server/chunks/vidstack-CwTj4H1w.js +18 -0
  220. package/server/chunks/vidstack-DHAyGSOl.js +1502 -0
  221. package/server/chunks/vidstack-DLU3cjcp.js +381 -0
  222. package/server/chunks/vidstack-DXxIKXmd.js +50 -0
  223. package/server/chunks/vidstack-DbtDXDS2.js +104 -0
  224. package/server/chunks/vidstack-Dm1xEU9Q.js +34 -0
  225. package/server/chunks/vidstack-DzTHw_bw.js +207 -0
  226. package/server/chunks/vidstack-Wn3NH5Sg.js +1566 -0
  227. package/server/chunks/vidstack-krOAtKMi.js +32 -0
  228. package/server/chunks/vidstack-wNViAkr4.js +3045 -0
  229. package/server/define/plyr-layout.js +16 -0
  230. package/server/define/vidstack-icons.js +1 -0
  231. package/server/define/vidstack-player-default-layout.js +13 -0
  232. package/server/define/vidstack-player-layouts.js +16 -0
  233. package/server/define/vidstack-player-ui.js +11 -0
  234. package/server/define/vidstack-player.js +6 -0
  235. package/server/global/plyr.js +322 -0
  236. package/server/global/vidstack-player.js +58 -0
  237. package/server/vidstack-elements.js +46 -0
  238. package/server/vidstack.js +148 -0
  239. package/tailwind.cjs +101 -0
  240. package/tailwind.d.cts +15 -0
  241. package/types/vidstack-BOvzfZjK.d.ts +1269 -0
  242. package/types/vidstack-Cttpg6GU.d.ts +7474 -0
@@ -0,0 +1,107 @@
1
+ import { createContext, useContext, Component, provideContext, signal, effect, createDisposalBin } from './vidstack-BGSTndAW.js';
2
+ import { useMediaContext } from './vidstack-DJDnh4xT.js';
3
+
4
+ const plyrLayoutContext = createContext();
5
+ function usePlyrLayoutContext() {
6
+ return useContext(plyrLayoutContext);
7
+ }
8
+
9
+ const plyrLayoutProps = {
10
+ clickToPlay: true,
11
+ clickToFullscreen: true,
12
+ controls: [
13
+ "play-large",
14
+ "play",
15
+ "progress",
16
+ "current-time",
17
+ "mute+volume",
18
+ "captions",
19
+ "settings",
20
+ "pip",
21
+ "airplay",
22
+ "fullscreen"
23
+ ],
24
+ customIcons: false,
25
+ displayDuration: false,
26
+ download: null,
27
+ markers: null,
28
+ invertTime: true,
29
+ thumbnails: null,
30
+ toggleTime: true,
31
+ translations: null,
32
+ seekTime: 10,
33
+ speed: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
34
+ };
35
+
36
+ class PlyrLayout extends Component {
37
+ static props = plyrLayoutProps;
38
+ #media;
39
+ onSetup() {
40
+ this.#media = useMediaContext();
41
+ provideContext(plyrLayoutContext, {
42
+ ...this.$props,
43
+ previewTime: signal(0)
44
+ });
45
+ }
46
+ }
47
+ function usePlyrLayoutClasses(el, media) {
48
+ const {
49
+ canAirPlay,
50
+ canFullscreen,
51
+ canPictureInPicture,
52
+ controlsHidden,
53
+ currentTime,
54
+ fullscreen,
55
+ hasCaptions,
56
+ isAirPlayConnected,
57
+ paused,
58
+ pictureInPicture,
59
+ playing,
60
+ pointer,
61
+ poster,
62
+ textTrack,
63
+ viewType,
64
+ waiting
65
+ } = media.$state;
66
+ el.classList.add("plyr");
67
+ el.classList.add("plyr--full-ui");
68
+ const classes = {
69
+ "plyr--airplay-active": isAirPlayConnected,
70
+ "plyr--airplay-supported": canAirPlay,
71
+ "plyr--fullscreen-active": fullscreen,
72
+ "plyr--fullscreen-enabled": canFullscreen,
73
+ "plyr--hide-controls": controlsHidden,
74
+ "plyr--is-touch": () => pointer() === "coarse",
75
+ "plyr--loading": waiting,
76
+ "plyr--paused": paused,
77
+ "plyr--pip-active": pictureInPicture,
78
+ "plyr--pip-enabled": canPictureInPicture,
79
+ "plyr--playing": playing,
80
+ "plyr__poster-enabled": poster,
81
+ "plyr--stopped": () => paused() && currentTime() === 0,
82
+ "plyr--captions-active": textTrack,
83
+ "plyr--captions-enabled": hasCaptions
84
+ };
85
+ const disposal = createDisposalBin();
86
+ for (const token of Object.keys(classes)) {
87
+ disposal.add(effect(() => void el.classList.toggle(token, !!classes[token]())));
88
+ }
89
+ disposal.add(
90
+ effect(() => {
91
+ const token = `plyr--${viewType()}`;
92
+ el.classList.add(token);
93
+ return () => el.classList.remove(token);
94
+ }),
95
+ effect(() => {
96
+ const { $provider } = media, type = $provider()?.type, token = `plyr--${isHTMLProvider(type) ? "html5" : type}`;
97
+ el.classList.toggle(token, !!type);
98
+ return () => el.classList.remove(token);
99
+ })
100
+ );
101
+ return () => disposal.empty();
102
+ }
103
+ function isHTMLProvider(type) {
104
+ return type === "audio" || type === "video";
105
+ }
106
+
107
+ export { PlyrLayout, usePlyrLayoutClasses, usePlyrLayoutContext };
@@ -0,0 +1,11 @@
1
+ function round(num, decimalPlaces = 2) {
2
+ return Number(num.toFixed(decimalPlaces));
3
+ }
4
+ function getNumberOfDecimalPlaces(num) {
5
+ return String(num).split(".")[1]?.length ?? 0;
6
+ }
7
+ function clampNumber(min, value, max) {
8
+ return Math.max(min, Math.min(max, value));
9
+ }
10
+
11
+ export { clampNumber, getNumberOfDecimalPlaces, round };
@@ -0,0 +1,34 @@
1
+ const videoIdRE = /(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)(?:\/shorts)?\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/;
2
+ const posterCache = /* @__PURE__ */ new Map();
3
+ const pendingFetch = /* @__PURE__ */ new Map();
4
+ function resolveYouTubeVideoId(src) {
5
+ return src.match(videoIdRE)?.[1];
6
+ }
7
+ async function findYouTubePoster(videoId, abort) {
8
+ if (posterCache.has(videoId)) return posterCache.get(videoId);
9
+ if (pendingFetch.has(videoId)) return pendingFetch.get(videoId);
10
+ const pending = new Promise(async (resolve) => {
11
+ const sizes = ["maxresdefault", "sddefault", "hqdefault"];
12
+ for (const size of sizes) {
13
+ for (const webp of [true, false]) {
14
+ const url = resolveYouTubePosterURL(videoId, size, webp), response = await fetch(url, {
15
+ mode: "no-cors",
16
+ signal: abort.signal
17
+ });
18
+ if (response.status < 400) {
19
+ posterCache.set(videoId, url);
20
+ resolve(url);
21
+ return;
22
+ }
23
+ }
24
+ }
25
+ }).catch(() => "").finally(() => pendingFetch.delete(videoId));
26
+ pendingFetch.set(videoId, pending);
27
+ return pending;
28
+ }
29
+ function resolveYouTubePosterURL(videoId, size, webp) {
30
+ const type = webp ? "webp" : "jpg";
31
+ return `https://i.ytimg.com/${webp ? "vi_webp" : "vi"}/${videoId}/${size}.${type}`;
32
+ }
33
+
34
+ export { findYouTubePoster, resolveYouTubeVideoId };
@@ -0,0 +1,205 @@
1
+ import { computed, peek, effect, onDispose, isDOMNode, animationFrameThrottle, isString } from './vidstack-BGSTndAW.js';
2
+ import { nothing, render, html } from 'lit-html';
3
+ import { ifDefined } from 'lit-html/directives/if-defined.js';
4
+ import { unsafeSVG } from 'lit-html/directives/unsafe-svg.js';
5
+ import { directive, AsyncDirective, PartType } from 'lit-html/async-directive.js';
6
+ import { useMediaContext } from './vidstack-DJDnh4xT.js';
7
+
8
+ class SignalDirective extends AsyncDirective {
9
+ #signal = null;
10
+ #isAttr = false;
11
+ #stop = null;
12
+ constructor(part) {
13
+ super(part);
14
+ this.#isAttr = part.type === PartType.ATTRIBUTE || part.type === PartType.BOOLEAN_ATTRIBUTE;
15
+ }
16
+ render(signal) {
17
+ if (signal !== this.#signal) {
18
+ this.disconnected();
19
+ this.#signal = signal;
20
+ if (this.isConnected) this.#watch();
21
+ }
22
+ return this.#signal ? this.#resolveValue(peek(this.#signal)) : nothing;
23
+ }
24
+ reconnected() {
25
+ this.#watch();
26
+ }
27
+ disconnected() {
28
+ this.#stop?.();
29
+ this.#stop = null;
30
+ }
31
+ #watch() {
32
+ if (!this.#signal) return;
33
+ this.#stop = effect(this.#onValueChange.bind(this));
34
+ }
35
+ #resolveValue(value) {
36
+ return this.#isAttr ? ifDefined(value) : value;
37
+ }
38
+ #setValue(value) {
39
+ this.setValue(this.#resolveValue(value));
40
+ }
41
+ #onValueChange() {
42
+ {
43
+ this.#setValue(this.#signal?.());
44
+ }
45
+ }
46
+ }
47
+ function $signal(compute) {
48
+ return directive(SignalDirective)(computed(compute));
49
+ }
50
+
51
+ class SlotObserver {
52
+ #roots;
53
+ #callback;
54
+ elements = /* @__PURE__ */ new Set();
55
+ constructor(roots, callback) {
56
+ this.#roots = roots;
57
+ this.#callback = callback;
58
+ }
59
+ connect() {
60
+ this.#update();
61
+ const observer = new MutationObserver(this.#onMutation);
62
+ for (const root of this.#roots) observer.observe(root, { childList: true, subtree: true });
63
+ onDispose(() => observer.disconnect());
64
+ onDispose(this.disconnect.bind(this));
65
+ }
66
+ disconnect() {
67
+ this.elements.clear();
68
+ }
69
+ assign(template, slot) {
70
+ if (isDOMNode(template)) {
71
+ slot.textContent = "";
72
+ slot.append(template);
73
+ } else {
74
+ render(null, slot);
75
+ render(template, slot);
76
+ }
77
+ if (!slot.style.display) {
78
+ slot.style.display = "contents";
79
+ }
80
+ const el = slot.firstElementChild;
81
+ if (!el) return;
82
+ const classList = slot.getAttribute("data-class");
83
+ if (classList) el.classList.add(...classList.split(" "));
84
+ }
85
+ #onMutation = animationFrameThrottle(this.#update.bind(this));
86
+ #update(entries) {
87
+ if (entries && !entries.some((e) => e.addedNodes.length)) return;
88
+ let changed = false, slots = this.#roots.flatMap((root) => [...root.querySelectorAll("slot")]);
89
+ for (const slot of slots) {
90
+ if (!slot.hasAttribute("name") || this.elements.has(slot)) continue;
91
+ this.elements.add(slot);
92
+ changed = true;
93
+ }
94
+ if (changed) this.#callback(this.elements);
95
+ }
96
+ }
97
+
98
+ let id = 0, slotIdAttr = "data-slot-id";
99
+ class SlotManager {
100
+ #roots;
101
+ slots;
102
+ constructor(roots) {
103
+ this.#roots = roots;
104
+ this.slots = new SlotObserver(roots, this.#update.bind(this));
105
+ }
106
+ connect() {
107
+ this.slots.connect();
108
+ this.#update();
109
+ const mutations = new MutationObserver(this.#onMutation);
110
+ for (const root of this.#roots) mutations.observe(root, { childList: true });
111
+ onDispose(() => mutations.disconnect());
112
+ }
113
+ #onMutation = animationFrameThrottle(this.#update.bind(this));
114
+ #update() {
115
+ for (const root of this.#roots) {
116
+ for (const node of root.children) {
117
+ if (node.nodeType !== 1) continue;
118
+ const name = node.getAttribute("slot");
119
+ if (!name) continue;
120
+ node.style.display = "none";
121
+ let slotId = node.getAttribute(slotIdAttr);
122
+ if (!slotId) {
123
+ node.setAttribute(slotIdAttr, slotId = ++id + "");
124
+ }
125
+ for (const slot of this.slots.elements) {
126
+ if (slot.getAttribute("name") !== name || slot.getAttribute(slotIdAttr) === slotId) {
127
+ continue;
128
+ }
129
+ const clone = document.importNode(node, true);
130
+ if (name.includes("-icon")) clone.classList.add("vds-icon");
131
+ clone.style.display = "";
132
+ clone.removeAttribute("slot");
133
+ this.slots.assign(clone, slot);
134
+ slot.setAttribute(slotIdAttr, slotId);
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
140
+
141
+ function Icon({ name, class: _class, state, paths, viewBox = "0 0 32 32" }) {
142
+ return html`<svg
143
+ class="${"vds-icon" + (_class ? ` ${_class}` : "")}"
144
+ viewBox="${viewBox}"
145
+ fill="none"
146
+ aria-hidden="true"
147
+ focusable="false"
148
+ xmlns="http://www.w3.org/2000/svg"
149
+ data-icon=${ifDefined(name ?? state)}
150
+ >
151
+ ${!isString(paths) ? $signal(paths) : unsafeSVG(paths)}
152
+ </svg>`;
153
+ }
154
+
155
+ class IconsLoader {
156
+ #icons = {};
157
+ #loaded = false;
158
+ slots;
159
+ constructor(roots) {
160
+ this.slots = new SlotObserver(roots, this.#insertIcons.bind(this));
161
+ }
162
+ connect() {
163
+ this.slots.connect();
164
+ }
165
+ load() {
166
+ this.loadIcons().then((icons) => {
167
+ this.#icons = icons;
168
+ this.#loaded = true;
169
+ this.#insertIcons();
170
+ });
171
+ }
172
+ *#iterate() {
173
+ for (const iconName of Object.keys(this.#icons)) {
174
+ const slotName = `${iconName}-icon`;
175
+ for (const slot of this.slots.elements) {
176
+ if (slot.name !== slotName) continue;
177
+ yield { icon: this.#icons[iconName], slot };
178
+ }
179
+ }
180
+ }
181
+ #insertIcons() {
182
+ if (!this.#loaded) return;
183
+ for (const { icon, slot } of this.#iterate()) {
184
+ this.slots.assign(icon, slot);
185
+ }
186
+ }
187
+ }
188
+
189
+ class LayoutIconsLoader extends IconsLoader {
190
+ connect() {
191
+ super.connect();
192
+ const { player } = useMediaContext();
193
+ if (!player.el) return;
194
+ let dispose, observer = new IntersectionObserver((entries) => {
195
+ if (!entries[0]?.isIntersecting) return;
196
+ dispose?.();
197
+ dispose = void 0;
198
+ this.load();
199
+ });
200
+ observer.observe(player.el);
201
+ dispose = onDispose(() => observer.disconnect());
202
+ }
203
+ }
204
+
205
+ export { $signal, Icon, LayoutIconsLoader, SlotManager };
@@ -0,0 +1,26 @@
1
+ import { isUndefined, isNumber } from './vidstack-BGSTndAW.js';
2
+
3
+ class RAFLoop {
4
+ #id;
5
+ #callback;
6
+ constructor(callback) {
7
+ this.#callback = callback;
8
+ }
9
+ start() {
10
+ if (!isUndefined(this.#id)) return;
11
+ this.#loop();
12
+ }
13
+ stop() {
14
+ if (isNumber(this.#id)) window.cancelAnimationFrame(this.#id);
15
+ this.#id = void 0;
16
+ }
17
+ #loop() {
18
+ this.#id = window.requestAnimationFrame(() => {
19
+ if (isUndefined(this.#id)) return;
20
+ this.#callback();
21
+ this.#loop();
22
+ });
23
+ }
24
+ }
25
+
26
+ export { RAFLoop };
@@ -0,0 +1,57 @@
1
+ import { signal, listenEvent, ViewController, effect, setAttribute, EventsController } from './vidstack-BGSTndAW.js';
2
+
3
+ let $keyboard = signal(false);
4
+ {
5
+ listenEvent(document, "pointerdown", () => {
6
+ $keyboard.set(false);
7
+ });
8
+ listenEvent(document, "keydown", (e) => {
9
+ if (e.metaKey || e.altKey || e.ctrlKey) return;
10
+ $keyboard.set(true);
11
+ });
12
+ }
13
+ class FocusVisibleController extends ViewController {
14
+ #focused = signal(false);
15
+ onConnect(el) {
16
+ effect(() => {
17
+ const events = new EventsController(el);
18
+ if (!$keyboard()) {
19
+ this.#focused.set(false);
20
+ updateFocusAttr(el, false);
21
+ events.add("pointerenter", this.#onPointerEnter.bind(this)).add("pointerleave", this.#onPointerLeave.bind(this));
22
+ return;
23
+ }
24
+ const active = document.activeElement === el;
25
+ this.#focused.set(active);
26
+ updateFocusAttr(el, active);
27
+ events.add("focus", this.#onFocus.bind(this)).add("blur", this.#onBlur.bind(this));
28
+ });
29
+ }
30
+ focused() {
31
+ return this.#focused();
32
+ }
33
+ #onFocus() {
34
+ this.#focused.set(true);
35
+ updateFocusAttr(this.el, true);
36
+ }
37
+ #onBlur() {
38
+ this.#focused.set(false);
39
+ updateFocusAttr(this.el, false);
40
+ }
41
+ #onPointerEnter() {
42
+ updateHoverAttr(this.el, true);
43
+ }
44
+ #onPointerLeave() {
45
+ updateHoverAttr(this.el, false);
46
+ }
47
+ }
48
+ function updateFocusAttr(el, isFocused) {
49
+ setAttribute(el, "data-focus", isFocused);
50
+ setAttribute(el, "data-hocus", isFocused);
51
+ }
52
+ function updateHoverAttr(el, isHovering) {
53
+ setAttribute(el, "data-hocus", isHovering);
54
+ setAttribute(el, "data-hover", isHovering);
55
+ }
56
+
57
+ export { $keyboard, FocusVisibleController };
@@ -0,0 +1,32 @@
1
+ const videoIdRE = /(?:https:\/\/)?(?:player\.)?vimeo(?:\.com)?\/(?:video\/)?(\d+)(?:(?:\?hash=|\?h=|\/)(.*))?/;
2
+ const infoCache = /* @__PURE__ */ new Map();
3
+ const pendingFetch = /* @__PURE__ */ new Map();
4
+ function resolveVimeoVideoId(src) {
5
+ const matches = src.match(videoIdRE);
6
+ return { videoId: matches?.[1], hash: matches?.[2] };
7
+ }
8
+ async function getVimeoVideoInfo(videoId, abort, videoHash) {
9
+ if (infoCache.has(videoId)) return infoCache.get(videoId);
10
+ if (pendingFetch.has(videoId)) return pendingFetch.get(videoId);
11
+ let oembedSrc = `https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/${videoId}`;
12
+ if (videoHash) {
13
+ oembedSrc = oembedSrc.concat(`?h=${videoHash}`);
14
+ }
15
+ const promise = window.fetch(oembedSrc, {
16
+ mode: "cors",
17
+ signal: abort.signal
18
+ }).then((response) => response.json()).then((data) => {
19
+ const thumnailRegex = /vimeocdn.com\/video\/(.*)?_/, thumbnailId = data?.thumbnail_url?.match(thumnailRegex)?.[1], poster = thumbnailId ? `https://i.vimeocdn.com/video/${thumbnailId}_1920x1080.webp` : "", info = {
20
+ title: data?.title ?? "",
21
+ duration: data?.duration ?? 0,
22
+ poster,
23
+ pro: data.account_type !== "basic"
24
+ };
25
+ infoCache.set(videoId, info);
26
+ return info;
27
+ }).finally(() => pendingFetch.delete(videoId));
28
+ pendingFetch.set(videoId, promise);
29
+ return promise;
30
+ }
31
+
32
+ export { getVimeoVideoInfo, resolveVimeoVideoId };
@@ -0,0 +1,58 @@
1
+ import { listenEvent, scoped, isString, getScope } from './vidstack-BGSTndAW.js';
2
+
3
+ function findActiveCue(cues, time) {
4
+ for (let i = 0, len = cues.length; i < len; i++) {
5
+ if (isCueActive(cues[i], time)) return cues[i];
6
+ }
7
+ return null;
8
+ }
9
+ function isCueActive(cue, time) {
10
+ return time >= cue.startTime && time < cue.endTime;
11
+ }
12
+ function watchActiveTextTrack(tracks, kind, onChange) {
13
+ let currentTrack = null, scope = getScope();
14
+ function onModeChange() {
15
+ const kinds = isString(kind) ? [kind] : kind, track = tracks.toArray().find((track2) => kinds.includes(track2.kind) && track2.mode === "showing");
16
+ if (track === currentTrack) return;
17
+ if (!track) {
18
+ onChange(null);
19
+ currentTrack = null;
20
+ return;
21
+ }
22
+ if (track.readyState == 2) {
23
+ onChange(track);
24
+ } else {
25
+ onChange(null);
26
+ scoped(() => {
27
+ const off = listenEvent(
28
+ track,
29
+ "load",
30
+ () => {
31
+ onChange(track);
32
+ off();
33
+ },
34
+ { once: true }
35
+ );
36
+ }, scope);
37
+ }
38
+ currentTrack = track;
39
+ }
40
+ onModeChange();
41
+ return listenEvent(tracks, "mode-change", onModeChange);
42
+ }
43
+ function watchCueTextChange(tracks, kind, callback) {
44
+ watchActiveTextTrack(tracks, kind, (track) => {
45
+ if (!track) {
46
+ callback("");
47
+ return;
48
+ }
49
+ const onCueChange = () => {
50
+ const activeCue = track?.activeCues[0];
51
+ callback(activeCue?.text || "");
52
+ };
53
+ onCueChange();
54
+ listenEvent(track, "cue-change", onCueChange);
55
+ });
56
+ }
57
+
58
+ export { findActiveCue, isCueActive, watchActiveTextTrack, watchCueTextChange };
@@ -0,0 +1,114 @@
1
+ import { isFunction, isUndefined, waitTimeout, isString } from './vidstack-BGSTndAW.js';
2
+
3
+ const UA = navigator?.userAgent.toLowerCase() || "";
4
+ const IS_IOS = /iphone|ipad|ipod|ios|crios|fxios/i.test(UA);
5
+ const IS_IPHONE = /(iphone|ipod)/gi.test(navigator?.platform || "");
6
+ const IS_CHROME = !!window.chrome;
7
+ const IS_SAFARI = !!window.safari || IS_IOS;
8
+ function canOrientScreen() {
9
+ return canRotateScreen() && isFunction(screen.orientation.unlock);
10
+ }
11
+ function canRotateScreen() {
12
+ return !isUndefined(window.screen.orientation) && !isUndefined(window.screen.orientation.lock);
13
+ }
14
+ function canPlayAudioType(audio, type) {
15
+ if (!audio) audio = document.createElement("audio");
16
+ return audio.canPlayType(type).length > 0;
17
+ }
18
+ function canPlayVideoType(video, type) {
19
+ if (!video) video = document.createElement("video");
20
+ return video.canPlayType(type).length > 0;
21
+ }
22
+ function canPlayHLSNatively(video) {
23
+ if (!video) video = document.createElement("video");
24
+ return video.canPlayType("application/vnd.apple.mpegurl").length > 0;
25
+ }
26
+ function canUsePictureInPicture(video) {
27
+ return !!document.pictureInPictureEnabled && !video?.disablePictureInPicture;
28
+ }
29
+ function canUseVideoPresentation(video) {
30
+ return isFunction(video?.webkitSupportsPresentationMode) && isFunction(video?.webkitSetPresentationMode);
31
+ }
32
+ async function canChangeVolume() {
33
+ const video = document.createElement("video");
34
+ video.volume = 0.5;
35
+ await waitTimeout(0);
36
+ return video.volume === 0.5;
37
+ }
38
+ function getMediaSource() {
39
+ return window?.ManagedMediaSource ?? window?.MediaSource ?? window?.WebKitMediaSource;
40
+ }
41
+ function getSourceBuffer() {
42
+ return window?.SourceBuffer ?? window?.WebKitSourceBuffer;
43
+ }
44
+ function isHLSSupported() {
45
+ const MediaSource = getMediaSource();
46
+ if (isUndefined(MediaSource)) return false;
47
+ const isTypeSupported = MediaSource && isFunction(MediaSource.isTypeSupported) && MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"');
48
+ const SourceBuffer = getSourceBuffer();
49
+ const isSourceBufferValid = isUndefined(SourceBuffer) || !isUndefined(SourceBuffer.prototype) && isFunction(SourceBuffer.prototype.appendBuffer) && isFunction(SourceBuffer.prototype.remove);
50
+ return !!isTypeSupported && !!isSourceBufferValid;
51
+ }
52
+ function isDASHSupported() {
53
+ return isHLSSupported();
54
+ }
55
+
56
+ const AUDIO_EXTENSIONS = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx|flac)($|\?)/i;
57
+ const AUDIO_TYPES = /* @__PURE__ */ new Set([
58
+ "audio/mpeg",
59
+ "audio/ogg",
60
+ "audio/3gp",
61
+ "audio/mp3",
62
+ "audio/webm",
63
+ "audio/flac",
64
+ "audio/m4a",
65
+ "audio/m4b",
66
+ "audio/mp4a",
67
+ "audio/mp4"
68
+ ]);
69
+ const VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i;
70
+ const VIDEO_TYPES = /* @__PURE__ */ new Set([
71
+ "video/mp4",
72
+ "video/webm",
73
+ "video/3gp",
74
+ "video/ogg",
75
+ "video/avi",
76
+ "video/mpeg"
77
+ ]);
78
+ const HLS_VIDEO_EXTENSIONS = /\.(m3u8)($|\?)/i;
79
+ const DASH_VIDEO_EXTENSIONS = /\.(mpd)($|\?)/i;
80
+ const HLS_VIDEO_TYPES = /* @__PURE__ */ new Set([
81
+ // Apple sanctioned
82
+ "application/vnd.apple.mpegurl",
83
+ // Apple sanctioned for backwards compatibility
84
+ "audio/mpegurl",
85
+ // Very common
86
+ "audio/x-mpegurl",
87
+ // Very common
88
+ "application/x-mpegurl",
89
+ // Included for completeness
90
+ "video/x-mpegurl",
91
+ "video/mpegurl",
92
+ "application/mpegurl"
93
+ ]);
94
+ const DASH_VIDEO_TYPES = /* @__PURE__ */ new Set(["application/dash+xml"]);
95
+ function isAudioSrc({ src, type }) {
96
+ return isString(src) ? AUDIO_EXTENSIONS.test(src) || AUDIO_TYPES.has(type) || src.startsWith("blob:") && type === "audio/object" : type === "audio/object";
97
+ }
98
+ function isVideoSrc(src) {
99
+ return isString(src.src) ? VIDEO_EXTENSIONS.test(src.src) || VIDEO_TYPES.has(src.type) || src.src.startsWith("blob:") && src.type === "video/object" || isHLSSrc(src) && canPlayHLSNatively() : src.type === "video/object";
100
+ }
101
+ function isHLSSrc({ src, type }) {
102
+ return isString(src) && HLS_VIDEO_EXTENSIONS.test(src) || HLS_VIDEO_TYPES.has(type);
103
+ }
104
+ function isDASHSrc({ src, type }) {
105
+ return isString(src) && DASH_VIDEO_EXTENSIONS.test(src) || DASH_VIDEO_TYPES.has(type);
106
+ }
107
+ function canGoogleCastSrc(src) {
108
+ return isString(src.src) && (isAudioSrc(src) || isVideoSrc(src) || isHLSSrc(src));
109
+ }
110
+ function isMediaStream(src) {
111
+ return typeof window.MediaStream !== "undefined" && src instanceof window.MediaStream;
112
+ }
113
+
114
+ export { AUDIO_EXTENSIONS, AUDIO_TYPES, DASH_VIDEO_EXTENSIONS, DASH_VIDEO_TYPES, HLS_VIDEO_EXTENSIONS, HLS_VIDEO_TYPES, IS_CHROME, IS_IOS, IS_IPHONE, IS_SAFARI, VIDEO_EXTENSIONS, VIDEO_TYPES, canChangeVolume, canGoogleCastSrc, canOrientScreen, canPlayAudioType, canPlayHLSNatively, canPlayVideoType, canRotateScreen, canUsePictureInPicture, canUseVideoPresentation, isAudioSrc, isDASHSrc, isDASHSupported, isHLSSrc, isHLSSupported, isMediaStream, isVideoSrc };