@kanorio/elements 0.0.0-stage → 1.0.0

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 (274) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -2
  3. package/dist/MediaPlayer-MWIDJORE.js +2 -0
  4. package/dist/MediaPlayer-STITRANS.js +13 -0
  5. package/dist/PDFViewerFull-HIUSAO57.js +13 -0
  6. package/dist/PDFViewerFull-L7VMOAMU.js +28062 -0
  7. package/dist/altcha-DSOKKAAV.js +3153 -0
  8. package/dist/altcha-FLBUR2LJ.js +4 -0
  9. package/dist/ar-4CBE4BWH.js +1233 -0
  10. package/dist/ar-6G7ZVSQ3.js +2 -0
  11. package/dist/ar-XCPH4WO5.js +98 -0
  12. package/dist/ar-ZVJL6XGE.js +2 -0
  13. package/dist/bg-4WPFSAMC.js +2 -0
  14. package/dist/bg-BKFL64I6.js +98 -0
  15. package/dist/bg-CB273F4D.js +1233 -0
  16. package/dist/bg-HCH4LMEX.js +2 -0
  17. package/dist/bn-HLYDEXHQ.js +1233 -0
  18. package/dist/bn-HVEVBAGM.js +98 -0
  19. package/dist/bn-OY7YGJIT.js +2 -0
  20. package/dist/bn-XX3O4VQB.js +2 -0
  21. package/dist/chunk-2UBPQBQI.js +1848 -0
  22. package/dist/chunk-5OB57Z46.js +23620 -0
  23. package/dist/chunk-6LJZ4HRF.js +1350 -0
  24. package/dist/chunk-6TUB24LJ.js +415 -0
  25. package/dist/chunk-74RRJOB4.js +15 -0
  26. package/dist/chunk-7TNRMVML.js +2 -0
  27. package/dist/chunk-BH27SBYG.js +2 -0
  28. package/dist/chunk-BQU7QZGC.js +4 -0
  29. package/dist/chunk-CHSZMJ5D.js +15103 -0
  30. package/dist/chunk-DDKQOHPW.js +930 -0
  31. package/dist/chunk-E5ZVE4VL.js +5 -0
  32. package/dist/chunk-FGBB7FT5.js +4 -0
  33. package/dist/chunk-FSH5K5FU.js +57 -0
  34. package/dist/chunk-G3PMV62Z.js +36 -0
  35. package/dist/chunk-IUB5YLUU.js +1538 -0
  36. package/dist/chunk-J7AP6FJF.js +8616 -0
  37. package/dist/chunk-LKOMEUNH.js +72 -0
  38. package/dist/chunk-NB57OIQA.js +2 -0
  39. package/dist/chunk-NLJE74VA.js +2 -0
  40. package/dist/chunk-NQBPWU5Z.js +15 -0
  41. package/dist/chunk-OJQYDPRD.js +39 -0
  42. package/dist/chunk-PDKFEXLU.js +59 -0
  43. package/dist/chunk-POG53MIA.js +2 -0
  44. package/dist/chunk-PXABHOW4.js +10871 -0
  45. package/dist/chunk-QDUG7UMV.js +363 -0
  46. package/dist/chunk-RFBBAUMM.js +2 -0
  47. package/dist/chunk-RJTKNOYT.js +67 -0
  48. package/dist/chunk-VH4656UY.js +2 -0
  49. package/dist/chunk-XAORGJWX.js +2 -0
  50. package/dist/chunk-Y77XXKLY.js +1858 -0
  51. package/dist/cs-EDLILQAV.js +1233 -0
  52. package/dist/cs-EOBDWVFI.js +2 -0
  53. package/dist/cs-Q732FDDB.js +98 -0
  54. package/dist/cs-UO3FC3H4.js +2 -0
  55. package/dist/da-43RMOYSN.js +98 -0
  56. package/dist/da-ANHSL3GD.js +2 -0
  57. package/dist/da-RBW34GCF.js +2 -0
  58. package/dist/da-SJ7YQT4L.js +1233 -0
  59. package/dist/de-2D2GW24Z.js +2 -0
  60. package/dist/de-5WGC4CMF.js +1233 -0
  61. package/dist/de-CPU2ARG7.js +98 -0
  62. package/dist/de-GVWNGUWZ.js +2 -0
  63. package/dist/deliverables-QUJISOBO.js +98 -0
  64. package/dist/deliverables-Z6ZBT6D3.js +2046 -0
  65. package/dist/el-FRNBHLQF.js +98 -0
  66. package/dist/el-HCBWOOCJ.js +1233 -0
  67. package/dist/el-KK7DBDUW.js +2 -0
  68. package/dist/el-SK362ZEN.js +2 -0
  69. package/dist/elements.css +2 -0
  70. package/dist/en-AU-BQA3DX35.js +1233 -0
  71. package/dist/en-AU-VZAXNXRA.js +2 -0
  72. package/dist/en-CA-T2VRZJVQ.js +2 -0
  73. package/dist/en-CA-ZWY5HD2Z.js +1233 -0
  74. package/dist/en-GB-CH3IGZSE.js +1233 -0
  75. package/dist/en-GB-MZQ2MGOR.js +2 -0
  76. package/dist/en-M24TV37U.js +2 -0
  77. package/dist/en-OURP64TI.js +2 -0
  78. package/dist/en-US-VWMNQOMN.js +2 -0
  79. package/dist/en-US-WJZ2OBFI.js +1233 -0
  80. package/dist/en-USCPKTM6.js +1233 -0
  81. package/dist/en-YND44PUO.js +98 -0
  82. package/dist/errors-7SQHRWKX.js +77 -0
  83. package/dist/errors-S6NFCUG2.js +2 -0
  84. package/dist/es-419-EMD4NA5M.js +2 -0
  85. package/dist/es-419-GPBJSXLV.js +2 -0
  86. package/dist/es-419-S6IHEZ4E.js +1233 -0
  87. package/dist/es-419-XPZOWYCA.js +98 -0
  88. package/dist/es-ES-EGMSPSY2.js +1233 -0
  89. package/dist/es-ES-U6NF6JHU.js +2 -0
  90. package/dist/es-es-ILD7QLKC.js +98 -0
  91. package/dist/es-es-MPX25JA6.js +2 -0
  92. package/dist/fa-5J3M6LW4.js +2 -0
  93. package/dist/fa-OC7ZPRF2.js +98 -0
  94. package/dist/fa-OFIO7IXD.js +1233 -0
  95. package/dist/fa-ZTPM4LEB.js +2 -0
  96. package/dist/fi-2V2STXSQ.js +2 -0
  97. package/dist/fi-7J4LPMG2.js +98 -0
  98. package/dist/fi-FMEAITYP.js +1233 -0
  99. package/dist/fi-N3BC4FYB.js +2 -0
  100. package/dist/fr-CA-IKSBTBHG.js +2 -0
  101. package/dist/fr-CA-S23ERMPM.js +1233 -0
  102. package/dist/fr-FR-RRTMSQWD.js +2 -0
  103. package/dist/fr-FR-SOIXFVK2.js +1233 -0
  104. package/dist/fr-ca-SUWTTOEW.js +2 -0
  105. package/dist/fr-ca-UUHAWMHI.js +98 -0
  106. package/dist/fr-fr-SGQ77PBC.js +98 -0
  107. package/dist/fr-fr-XE2V7MKM.js +2 -0
  108. package/dist/gu-RT7GQT5B.js +2 -0
  109. package/dist/gu-Z2QX2VCX.js +1233 -0
  110. package/dist/he-27MBDHSP.js +2 -0
  111. package/dist/he-E7RIZOIT.js +1233 -0
  112. package/dist/he-QGD477CH.js +98 -0
  113. package/dist/he-R3UJFF46.js +2 -0
  114. package/dist/hi-2AVAXR7K.js +1233 -0
  115. package/dist/hi-6ZBMVMGH.js +2 -0
  116. package/dist/hi-SGQH4OWG.js +98 -0
  117. package/dist/hi-XJHFN25N.js +2 -0
  118. package/dist/hls-C5FWCMHH.js +37426 -0
  119. package/dist/hls-ZQNRY2TQ.js +45 -0
  120. package/dist/hu-IOGZTF7L.js +2 -0
  121. package/dist/hu-KNZXJ7ZI.js +98 -0
  122. package/dist/hu-ORVGO3ZY.js +1233 -0
  123. package/dist/hu-PKL3T3JT.js +2 -0
  124. package/dist/id-FKFVQIN6.js +2 -0
  125. package/dist/id-JH2DLDBA.js +98 -0
  126. package/dist/id-TMOJUCBD.js +1233 -0
  127. package/dist/id-WLBO2VOW.js +2 -0
  128. package/dist/index.d.ts +2955 -0
  129. package/dist/index.js +67 -0
  130. package/dist/it-AGUEDSVA.js +2 -0
  131. package/dist/it-PJAB5BQB.js +98 -0
  132. package/dist/it-WF5BTFFJ.js +2 -0
  133. package/dist/it-YMZRYSIJ.js +1233 -0
  134. package/dist/ja-2ZVND7MB.js +2 -0
  135. package/dist/ja-555SY4AF.js +1233 -0
  136. package/dist/ja-RMBJ7E5Z.js +2 -0
  137. package/dist/ja-ZKBUQDUT.js +98 -0
  138. package/dist/kanorio-elements.js +97 -0
  139. package/dist/km-DF366BBP.js +1233 -0
  140. package/dist/km-JIUQ7MSM.js +2 -0
  141. package/dist/kn-KTJPREMQ.js +2 -0
  142. package/dist/kn-MJKASLJD.js +1233 -0
  143. package/dist/ko-CGY75OW4.js +2 -0
  144. package/dist/ko-KECCYX66.js +2 -0
  145. package/dist/ko-L5735TRU.js +98 -0
  146. package/dist/ko-S3OTZKIG.js +1233 -0
  147. package/dist/lo-7R55FKUB.js +1233 -0
  148. package/dist/lo-DNWTAFYF.js +2 -0
  149. package/dist/ml-B4BJPFVQ.js +2 -0
  150. package/dist/ml-FCTNQ4SP.js +1233 -0
  151. package/dist/mr-FJ4EDO7F.js +2 -0
  152. package/dist/mr-TZTFABWX.js +2 -0
  153. package/dist/mr-VZ5Y74YA.js +1233 -0
  154. package/dist/mr-Y464JCKX.js +98 -0
  155. package/dist/ms-VCX47GHB.js +2 -0
  156. package/dist/ms-WAJKD7ZV.js +1233 -0
  157. package/dist/my-S5L32WDK.js +2 -0
  158. package/dist/my-T7Y3Y64H.js +1233 -0
  159. package/dist/nb-53GCFBHF.js +2 -0
  160. package/dist/nb-IJDALVGX.js +99 -0
  161. package/dist/nb-LXBBUZUD.js +1233 -0
  162. package/dist/nb-PWWLEFUC.js +2 -0
  163. package/dist/ne-F7EEIDMA.js +2 -0
  164. package/dist/ne-NDLRKG6T.js +1233 -0
  165. package/dist/nl-262SKC6R.js +98 -0
  166. package/dist/nl-BE-3KOYUD6Y.js +1233 -0
  167. package/dist/nl-BE-VZJDK6CH.js +2 -0
  168. package/dist/nl-NL-3OIKN2DQ.js +2 -0
  169. package/dist/nl-NL-T7SQOLLA.js +1233 -0
  170. package/dist/nl-XKCUNU3P.js +2 -0
  171. package/dist/nn-AHWRAFXZ.js +1233 -0
  172. package/dist/nn-YH7F7UK3.js +2 -0
  173. package/dist/pa-HC24FOUI.js +2 -0
  174. package/dist/pa-J26C5J7M.js +1233 -0
  175. package/dist/pl-QSTOYTPG.js +1233 -0
  176. package/dist/pl-T7J6A26Y.js +2 -0
  177. package/dist/pl-TYHET6JJ.js +2 -0
  178. package/dist/pl-XDJJ6AUG.js +98 -0
  179. package/dist/prod-MRWX5W24.js +38 -0
  180. package/dist/prod-YHXWTKNF.js +2 -0
  181. package/dist/pt-BR-4QRR4PXU.js +2 -0
  182. package/dist/pt-BR-7JM75AGX.js +1233 -0
  183. package/dist/pt-PT-W3WZEROD.js +1233 -0
  184. package/dist/pt-PT-Z5FI4CLF.js +2 -0
  185. package/dist/pt-br-2W4P4ZAJ.js +2 -0
  186. package/dist/pt-br-JP6VI5C5.js +98 -0
  187. package/dist/pt-pt-22LJFZT5.js +98 -0
  188. package/dist/pt-pt-HOBFIPWZ.js +2 -0
  189. package/dist/ro-3KXIEYVK.js +98 -0
  190. package/dist/ro-3YUPB2TJ.js +1233 -0
  191. package/dist/ro-JXHNIBOA.js +2 -0
  192. package/dist/ro-KHPOLQC6.js +2 -0
  193. package/dist/ru-5ZVLKPFN.js +2 -0
  194. package/dist/ru-ASND25AB.js +2 -0
  195. package/dist/ru-ATGZC5LB.js +1233 -0
  196. package/dist/ru-W44AHOIC.js +98 -0
  197. package/dist/si-RHXLIDQI.js +1233 -0
  198. package/dist/si-U3O6NRHE.js +2 -0
  199. package/dist/srt-parser-6DEDUV5P.js +43 -0
  200. package/dist/srt-parser-E666S3YO.js +3 -0
  201. package/dist/ssa-parser-5GJ737XF.js +309 -0
  202. package/dist/ssa-parser-BR3CTDHR.js +5 -0
  203. package/dist/sv-5LOOKXJA.js +98 -0
  204. package/dist/sv-6GKNCPMS.js +2 -0
  205. package/dist/sv-LL3HMUIA.js +1233 -0
  206. package/dist/sv-RRJ6LYFT.js +2 -0
  207. package/dist/sw-HBNHIHPG.js +2 -0
  208. package/dist/sw-HP7MYGQ5.js +1233 -0
  209. package/dist/sw-NTSCFQXY.js +2 -0
  210. package/dist/sw-YIUB7QN3.js +98 -0
  211. package/dist/ta-4RG3PWN5.js +98 -0
  212. package/dist/ta-ARSNSDK5.js +2 -0
  213. package/dist/ta-Q2LBTDH6.js +2 -0
  214. package/dist/ta-Z5EVUBYF.js +1233 -0
  215. package/dist/te-FAWIFHVW.js +2 -0
  216. package/dist/te-FXJYUGGL.js +98 -0
  217. package/dist/te-GDV3DJFJ.js +1233 -0
  218. package/dist/te-TIMB7HBY.js +2 -0
  219. package/dist/th-7CEFYE5H.js +2 -0
  220. package/dist/th-CFAEFK3E.js +1233 -0
  221. package/dist/th-KGPTXFIF.js +2 -0
  222. package/dist/th-TC6J25FB.js +98 -0
  223. package/dist/tl-2JDK2CBL.js +2 -0
  224. package/dist/tl-SGZM4XSX.js +1233 -0
  225. package/dist/tr-27OEWIPE.js +1233 -0
  226. package/dist/tr-2MEHQO75.js +98 -0
  227. package/dist/tr-7P2UAX7U.js +2 -0
  228. package/dist/tr-NKD6C4RY.js +2 -0
  229. package/dist/uk-CXQISVJP.js +2 -0
  230. package/dist/uk-EJIGGLKY.js +1233 -0
  231. package/dist/uk-JCI3UE6Q.js +98 -0
  232. package/dist/uk-QM5BBWP7.js +2 -0
  233. package/dist/ur-5EWYHPME.js +1233 -0
  234. package/dist/ur-IIOUQYSA.js +98 -0
  235. package/dist/ur-M3QWGAPF.js +2 -0
  236. package/dist/ur-TLLPXSTM.js +2 -0
  237. package/dist/vi-AXQYYRD3.js +2 -0
  238. package/dist/vi-JALLXYS7.js +1233 -0
  239. package/dist/vi-SS65KZTI.js +2 -0
  240. package/dist/vi-YQVNQEVG.js +98 -0
  241. package/dist/vidstack-B9fTkxQO-LJP5ADOO.js +215 -0
  242. package/dist/vidstack-B9fTkxQO-OCT23G55.js +2 -0
  243. package/dist/vidstack-BmcqUMKx-A2W3TQB6.js +2 -0
  244. package/dist/vidstack-BmcqUMKx-G6TB22IC.js +286 -0
  245. package/dist/vidstack-C0fPJIzs-7AH6MOHO.js +2 -0
  246. package/dist/vidstack-C0fPJIzs-PNQOR4TK.js +11 -0
  247. package/dist/vidstack-CHcsWfRV-UAVLHO6N.js +40 -0
  248. package/dist/vidstack-CHcsWfRV-V52LFHYG.js +2 -0
  249. package/dist/vidstack-CvezEmSQ-JXKCQ4VQ.js +2 -0
  250. package/dist/vidstack-CvezEmSQ-R32NZKJ2.js +130 -0
  251. package/dist/vidstack-D2vrrUMs-7XAY5IBS.js +2 -0
  252. package/dist/vidstack-D2vrrUMs-FNQR2A5M.js +467 -0
  253. package/dist/vidstack-Di0HObvT-6ND3AXWZ.js +112 -0
  254. package/dist/vidstack-Di0HObvT-ZV7XK2OT.js +2 -0
  255. package/dist/vidstack-DiaLSJYx-H762DXYG.js +2 -0
  256. package/dist/vidstack-DiaLSJYx-S7DDW2H3.js +380 -0
  257. package/dist/vidstack-Dy74GavT-EYLL6MEF.js +2 -0
  258. package/dist/vidstack-Dy74GavT-XNIJ7PF4.js +11 -0
  259. package/dist/vidstack-GkTzay8D-C7EJKMV4.js +2 -0
  260. package/dist/vidstack-GkTzay8D-SQU5IF3P.js +482 -0
  261. package/dist/web-components.d.ts +12 -0
  262. package/dist/web-components.js +123 -0
  263. package/dist/worker.js +1 -0
  264. package/dist/zh-CN-PVVDP25S.js +2 -0
  265. package/dist/zh-CN-TLPNCXUN.js +1233 -0
  266. package/dist/zh-HK-GOKVZUJZ.js +1233 -0
  267. package/dist/zh-HK-Z5B2ANLW.js +2 -0
  268. package/dist/zh-Hant-2R7T4HJT.js +1233 -0
  269. package/dist/zh-Hant-MWAFLLDD.js +2 -0
  270. package/dist/zh-cn-D36OS2SI.js +2 -0
  271. package/dist/zh-cn-Z5YVUN62.js +98 -0
  272. package/dist/zh-tw-JWILJCBD.js +2 -0
  273. package/dist/zh-tw-X7JGMR4G.js +98 -0
  274. package/package.json +84 -3
@@ -0,0 +1,1848 @@
1
+ import {
2
+ DOMEvent,
3
+ EventsController,
4
+ EventsTarget,
5
+ __exportAll,
6
+ camelToKebabCase,
7
+ createScope,
8
+ deferredPromise,
9
+ effect,
10
+ getScope,
11
+ isArray,
12
+ isBoolean,
13
+ isFunction,
14
+ isNil,
15
+ isNull,
16
+ isNumber,
17
+ isString,
18
+ isUndefined,
19
+ listenEvent,
20
+ onDispose,
21
+ peek,
22
+ scoped,
23
+ setAttribute,
24
+ signal,
25
+ waitTimeout
26
+ } from "./chunk-IUB5YLUU.js";
27
+
28
+ // ../../node_modules/.pnpm/@vidstack+react@1.15.6_@types+react@19.2.8_react@19.2.1/node_modules/@vidstack/react/prod/chunks/vidstack-CvezEmSQ.js
29
+ var IS_SERVER = typeof document === "undefined";
30
+ var UA = IS_SERVER ? "" : navigator?.userAgent.toLowerCase() || "";
31
+ var IS_IOS = !IS_SERVER && /iphone|ipad|ipod|ios|crios|fxios/i.test(UA);
32
+ var IS_IPHONE = !IS_SERVER && /(iphone|ipod)/gi.test(navigator?.platform || "");
33
+ var IS_CHROME = !IS_SERVER && !!window.chrome;
34
+ !IS_SERVER && /crios/i.test(UA);
35
+ var IS_SAFARI = !IS_SERVER && (!!window.safari || IS_IOS);
36
+ function canOrientScreen() {
37
+ return canRotateScreen() && isFunction(screen.orientation.unlock);
38
+ }
39
+ function canRotateScreen() {
40
+ return !IS_SERVER && !isUndefined(window.screen.orientation) && !isUndefined(window.screen.orientation.lock);
41
+ }
42
+ function canPlayAudioType(audio, type) {
43
+ if (IS_SERVER) return false;
44
+ if (!audio) audio = document.createElement("audio");
45
+ return audio.canPlayType(type).length > 0;
46
+ }
47
+ function canPlayVideoType(video, type) {
48
+ if (IS_SERVER) return false;
49
+ if (!video) video = document.createElement("video");
50
+ return video.canPlayType(type).length > 0;
51
+ }
52
+ function canPlayHLSNatively(video) {
53
+ if (IS_SERVER) return false;
54
+ if (!video) video = document.createElement("video");
55
+ return video.canPlayType("application/vnd.apple.mpegurl").length > 0;
56
+ }
57
+ function canUsePictureInPicture(video) {
58
+ if (IS_SERVER) return false;
59
+ return !!document.pictureInPictureEnabled && !video?.disablePictureInPicture;
60
+ }
61
+ function canUseVideoPresentation(video) {
62
+ if (IS_SERVER) return false;
63
+ return isFunction(video?.webkitSupportsPresentationMode) && isFunction(video?.webkitSetPresentationMode);
64
+ }
65
+ async function canChangeVolume() {
66
+ const video = document.createElement("video");
67
+ video.volume = 0.5;
68
+ await waitTimeout(0);
69
+ return video.volume === 0.5;
70
+ }
71
+ function getMediaSource() {
72
+ return IS_SERVER ? void 0 : window?.ManagedMediaSource ?? window?.MediaSource ?? window?.WebKitMediaSource;
73
+ }
74
+ function getSourceBuffer() {
75
+ return IS_SERVER ? void 0 : window?.SourceBuffer ?? window?.WebKitSourceBuffer;
76
+ }
77
+ function isHLSSupported() {
78
+ if (IS_SERVER) return false;
79
+ const MediaSource = getMediaSource();
80
+ if (isUndefined(MediaSource)) return false;
81
+ const isTypeSupported = MediaSource && isFunction(MediaSource.isTypeSupported) && MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"');
82
+ const SourceBuffer = getSourceBuffer();
83
+ const isSourceBufferValid = isUndefined(SourceBuffer) || !isUndefined(SourceBuffer.prototype) && isFunction(SourceBuffer.prototype.appendBuffer) && isFunction(SourceBuffer.prototype.remove);
84
+ return !!isTypeSupported && !!isSourceBufferValid;
85
+ }
86
+ function isDASHSupported() {
87
+ return isHLSSupported();
88
+ }
89
+ var TimeRange = class {
90
+ #ranges;
91
+ get length() {
92
+ return this.#ranges.length;
93
+ }
94
+ constructor(start, end) {
95
+ if (isArray(start)) this.#ranges = start;
96
+ else if (!isUndefined(start) && !isUndefined(end)) this.#ranges = [[start, end]];
97
+ else this.#ranges = [];
98
+ }
99
+ start(index) {
100
+ return this.#ranges[index][0] ?? Infinity;
101
+ }
102
+ end(index) {
103
+ return this.#ranges[index][1] ?? Infinity;
104
+ }
105
+ };
106
+ function getTimeRangesStart(range) {
107
+ if (!range.length) return null;
108
+ let min = range.start(0);
109
+ for (let i = 1; i < range.length; i++) {
110
+ const value = range.start(i);
111
+ if (value < min) min = value;
112
+ }
113
+ return min;
114
+ }
115
+ function getTimeRangesEnd(range) {
116
+ if (!range.length) return null;
117
+ let max = range.end(0);
118
+ for (let i = 1; i < range.length; i++) {
119
+ const value = range.end(i);
120
+ if (value > max) max = value;
121
+ }
122
+ return max;
123
+ }
124
+ function normalizeTimeIntervals(intervals) {
125
+ if (intervals.length <= 1) return intervals;
126
+ intervals.sort((a, b) => a[0] - b[0]);
127
+ let normalized = [], current = intervals[0];
128
+ for (let i = 1; i < intervals.length; i++) {
129
+ const next = intervals[i];
130
+ if (current[1] >= next[0] - 1) current = [current[0], Math.max(current[1], next[1])];
131
+ else {
132
+ normalized.push(current);
133
+ current = next;
134
+ }
135
+ }
136
+ normalized.push(current);
137
+ return normalized;
138
+ }
139
+ function updateTimeIntervals(intervals, interval, value) {
140
+ let start = interval[0], end = interval[1];
141
+ if (value < start) return [value, -1];
142
+ else if (value === start) return interval;
143
+ else if (start === -1) {
144
+ interval[0] = value;
145
+ return interval;
146
+ } else if (value > start) {
147
+ interval[1] = value;
148
+ if (end === -1) intervals.push(interval);
149
+ }
150
+ normalizeTimeIntervals(intervals);
151
+ return interval;
152
+ }
153
+ var AUDIO_EXTENSIONS = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx|flac)($|\?)/i;
154
+ var AUDIO_TYPES = /* @__PURE__ */ new Set([
155
+ "audio/mpeg",
156
+ "audio/ogg",
157
+ "audio/3gp",
158
+ "audio/mp3",
159
+ "audio/webm",
160
+ "audio/flac",
161
+ "audio/m4a",
162
+ "audio/m4b",
163
+ "audio/mp4a",
164
+ "audio/mp4"
165
+ ]);
166
+ var VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i;
167
+ var VIDEO_TYPES = /* @__PURE__ */ new Set([
168
+ "video/mp4",
169
+ "video/webm",
170
+ "video/3gp",
171
+ "video/ogg",
172
+ "video/avi",
173
+ "video/mpeg"
174
+ ]);
175
+ var HLS_VIDEO_EXTENSIONS = /\.(m3u8)($|\?)/i;
176
+ var DASH_VIDEO_EXTENSIONS = /\.(mpd)($|\?)/i;
177
+ var HLS_VIDEO_TYPES = /* @__PURE__ */ new Set([
178
+ "application/vnd.apple.mpegurl",
179
+ "audio/mpegurl",
180
+ "audio/x-mpegurl",
181
+ "application/x-mpegurl",
182
+ "video/x-mpegurl",
183
+ "video/mpegurl",
184
+ "application/mpegurl"
185
+ ]);
186
+ var DASH_VIDEO_TYPES = /* @__PURE__ */ new Set(["application/dash+xml"]);
187
+ function isAudioSrc({ src, type }) {
188
+ return isString(src) ? AUDIO_EXTENSIONS.test(src) || AUDIO_TYPES.has(type) || src.startsWith("blob:") && type === "audio/object" : type === "audio/object";
189
+ }
190
+ function isVideoSrc(src) {
191
+ return isString(src.src) ? VIDEO_EXTENSIONS.test(src.src) || VIDEO_TYPES.has(src.type) || src.src.startsWith("blob:") && src.type === "video/object" || isHLSSrc(src) && (IS_SERVER || canPlayHLSNatively()) : src.type === "video/object";
192
+ }
193
+ function isHLSSrc({ src, type }) {
194
+ return isString(src) && HLS_VIDEO_EXTENSIONS.test(src) || HLS_VIDEO_TYPES.has(type);
195
+ }
196
+ function isDASHSrc({ src, type }) {
197
+ return isString(src) && DASH_VIDEO_EXTENSIONS.test(src) || DASH_VIDEO_TYPES.has(type);
198
+ }
199
+ function canGoogleCastSrc(src) {
200
+ return isString(src.src) && (isAudioSrc(src) || isVideoSrc(src) || isHLSSrc(src) || isDASHSrc(src));
201
+ }
202
+ function isMediaStream(src) {
203
+ return !IS_SERVER && typeof window.MediaStream !== "undefined" && src instanceof window.MediaStream;
204
+ }
205
+ function appendParamsToURL(baseUrl, params) {
206
+ const url = new URL(baseUrl);
207
+ for (const key of Object.keys(params)) url.searchParams.set(key, params[key] + "");
208
+ return url.toString();
209
+ }
210
+ function preconnect(url, rel = "preconnect") {
211
+ if (IS_SERVER) return false;
212
+ if (!isNull(document.querySelector(`link[href="${url}"]`))) return true;
213
+ const link = document.createElement("link");
214
+ link.rel = rel;
215
+ link.href = url;
216
+ link.crossOrigin = "true";
217
+ document.head.append(link);
218
+ return true;
219
+ }
220
+ var pendingRequests = {};
221
+ function loadScript(src) {
222
+ if (pendingRequests[src]) return pendingRequests[src].promise;
223
+ const promise = deferredPromise();
224
+ if (!isNull(document.querySelector(`script[src="${src}"]`))) {
225
+ promise.resolve();
226
+ return promise.promise;
227
+ }
228
+ pendingRequests[src] = promise;
229
+ const script = document.createElement("script");
230
+ script.src = src;
231
+ script.onload = () => {
232
+ promise.resolve();
233
+ delete pendingRequests[src];
234
+ };
235
+ script.onerror = () => {
236
+ promise.reject();
237
+ delete pendingRequests[src];
238
+ };
239
+ setTimeout(() => document.head.append(script), 0);
240
+ return promise.promise;
241
+ }
242
+ function getRequestCredentials(crossOrigin) {
243
+ return crossOrigin === "use-credentials" ? "include" : isString(crossOrigin) ? "same-origin" : void 0;
244
+ }
245
+ function getDownloadFile({ title, src, download }) {
246
+ const url = isBoolean(download) || download === "" ? src.src : isString(download) ? download : download?.url;
247
+ if (!isValidFileDownload({
248
+ url,
249
+ src,
250
+ download
251
+ })) return null;
252
+ return {
253
+ url,
254
+ name: !isBoolean(download) && !isString(download) && download?.filename || title.toLowerCase() || "media"
255
+ };
256
+ }
257
+ function isValidFileDownload({ url, src, download }) {
258
+ return isString(url) && (download && download !== true || isAudioSrc(src) || isVideoSrc(src));
259
+ }
260
+ var TextTrackSymbol = {
261
+ crossOrigin: /* @__PURE__ */ Symbol(0),
262
+ readyState: /* @__PURE__ */ Symbol(0),
263
+ updateActiveCues: /* @__PURE__ */ Symbol(0),
264
+ canLoad: /* @__PURE__ */ Symbol(0),
265
+ onModeChange: /* @__PURE__ */ Symbol(0),
266
+ native: /* @__PURE__ */ Symbol(0),
267
+ nativeHLS: /* @__PURE__ */ Symbol(0)
268
+ };
269
+ function findActiveCue(cues, time) {
270
+ for (let i = 0, len = cues.length; i < len; i++) if (isCueActive(cues[i], time)) return cues[i];
271
+ return null;
272
+ }
273
+ function isCueActive(cue, time) {
274
+ return time >= cue.startTime && time < cue.endTime;
275
+ }
276
+ function watchActiveTextTrack(tracks, kind, onChange) {
277
+ let currentTrack = null, scope = getScope();
278
+ function onModeChange() {
279
+ const kinds = isString(kind) ? [kind] : kind, track = tracks.toArray().find((track2) => kinds.includes(track2.kind) && track2.mode === "showing");
280
+ if (track === currentTrack) return;
281
+ if (!track) {
282
+ onChange(null);
283
+ currentTrack = null;
284
+ return;
285
+ }
286
+ if (track.readyState == 2) onChange(track);
287
+ else {
288
+ onChange(null);
289
+ scoped(() => {
290
+ const off = listenEvent(track, "load", () => {
291
+ onChange(track);
292
+ off();
293
+ }, { once: true });
294
+ }, scope);
295
+ }
296
+ currentTrack = track;
297
+ }
298
+ onModeChange();
299
+ return listenEvent(tracks, "mode-change", onModeChange);
300
+ }
301
+ function watchCueTextChange(tracks, kind, callback) {
302
+ watchActiveTextTrack(tracks, kind, (track) => {
303
+ if (!track) {
304
+ callback("");
305
+ return;
306
+ }
307
+ const onCueChange = () => {
308
+ const activeCue = track?.activeCues[0];
309
+ callback(activeCue?.text || "");
310
+ };
311
+ onCueChange();
312
+ listenEvent(track, "cue-change", onCueChange);
313
+ });
314
+ }
315
+ var TextTrack = class extends EventsTarget {
316
+ static createId(track) {
317
+ return `vds-${track.type}-${track.kind}-${track.src ?? track.label ?? "?"}`;
318
+ }
319
+ src;
320
+ content;
321
+ type;
322
+ encoding;
323
+ id = "";
324
+ label = "";
325
+ language = "";
326
+ kind;
327
+ default = false;
328
+ #canLoad = false;
329
+ #currentTime = 0;
330
+ #mode = "disabled";
331
+ #metadata = {};
332
+ #regions = [];
333
+ #cues = [];
334
+ #activeCues = [];
335
+ #cueIds = /* @__PURE__ */ new Set();
336
+ /** @internal */
337
+ [TextTrackSymbol.readyState] = 0;
338
+ /** @internal */
339
+ [TextTrackSymbol.crossOrigin];
340
+ /** @internal */
341
+ [TextTrackSymbol.onModeChange] = null;
342
+ /** @internal */
343
+ [TextTrackSymbol.native] = null;
344
+ get metadata() {
345
+ return this.#metadata;
346
+ }
347
+ get regions() {
348
+ return this.#regions;
349
+ }
350
+ get cues() {
351
+ return this.#cues;
352
+ }
353
+ get activeCues() {
354
+ return this.#activeCues;
355
+ }
356
+ /**
357
+ * - 0: Not Loading
358
+ * - 1: Loading
359
+ * - 2: Ready
360
+ * - 3: Error
361
+ */
362
+ get readyState() {
363
+ return this[TextTrackSymbol.readyState];
364
+ }
365
+ get mode() {
366
+ return this.#mode;
367
+ }
368
+ set mode(mode) {
369
+ this.setMode(mode);
370
+ }
371
+ constructor(init) {
372
+ super();
373
+ for (const prop of Object.keys(init)) this[prop] = init[prop];
374
+ if (!this.type) this.type = "vtt";
375
+ if (!IS_SERVER && init.content) this.#parseContent(init);
376
+ else if (!init.src) this[TextTrackSymbol.readyState] = 2;
377
+ }
378
+ addCue(cue, trigger) {
379
+ if (cue.id) {
380
+ if (this.#cueIds.has(cue.id)) return;
381
+ this.#cueIds.add(cue.id);
382
+ }
383
+ let i = 0, length = this.#cues.length;
384
+ for (i = 0; i < length; i++) if (cue.endTime <= this.#cues[i].startTime) break;
385
+ if (i === length) this.#cues.push(cue);
386
+ else this.#cues.splice(i, 0, cue);
387
+ if (!(cue instanceof TextTrackCue)) this[TextTrackSymbol.native]?.track.addCue(cue);
388
+ this.dispatchEvent(new DOMEvent("add-cue", {
389
+ detail: cue,
390
+ trigger
391
+ }));
392
+ if (isCueActive(cue, this.#currentTime)) this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);
393
+ }
394
+ removeCue(cue, trigger) {
395
+ const index = this.#cues.indexOf(cue);
396
+ if (index >= 0) {
397
+ const isActive = this.#activeCues.includes(cue);
398
+ if (cue.id) this.#cueIds.delete(cue.id);
399
+ this.#cues.splice(index, 1);
400
+ this[TextTrackSymbol.native]?.track.removeCue(cue);
401
+ this.dispatchEvent(new DOMEvent("remove-cue", {
402
+ detail: cue,
403
+ trigger
404
+ }));
405
+ if (isActive) this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);
406
+ }
407
+ }
408
+ setMode(mode, trigger) {
409
+ if (this.#mode === mode) return;
410
+ this.#mode = mode;
411
+ if (mode === "disabled") {
412
+ this.#activeCues = [];
413
+ this.#activeCuesChanged();
414
+ } else if (this.readyState === 2) this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);
415
+ else this.#load();
416
+ this.dispatchEvent(new DOMEvent("mode-change", {
417
+ detail: this,
418
+ trigger
419
+ }));
420
+ this[TextTrackSymbol.onModeChange]?.();
421
+ }
422
+ /** @internal */
423
+ [TextTrackSymbol.updateActiveCues](currentTime, trigger) {
424
+ this.#currentTime = currentTime;
425
+ if (this.mode === "disabled" || !this.#cues.length) return;
426
+ const activeCues = [];
427
+ for (let i = 0, length = this.#cues.length; i < length; i++) {
428
+ const cue = this.#cues[i];
429
+ if (isCueActive(cue, currentTime)) activeCues.push(cue);
430
+ }
431
+ let changed = activeCues.length !== this.#activeCues.length;
432
+ if (!changed) {
433
+ for (let i = 0; i < activeCues.length; i++) if (!this.#activeCues.includes(activeCues[i])) {
434
+ changed = true;
435
+ break;
436
+ }
437
+ }
438
+ this.#activeCues = activeCues;
439
+ if (changed) this.#activeCuesChanged(trigger);
440
+ }
441
+ /** @internal */
442
+ [TextTrackSymbol.canLoad]() {
443
+ this.#canLoad = true;
444
+ if (this.#mode !== "disabled") this.#load();
445
+ }
446
+ #parseContent(init) {
447
+ import("./prod-MRWX5W24.js").then(({ parseText, VTTCue, VTTRegion }) => {
448
+ if (!isString(init.content) || init.type === "json") {
449
+ this.#parseJSON(init.content, VTTCue, VTTRegion);
450
+ if (this.readyState !== 3) this.#ready();
451
+ } else parseText(init.content.split("\n").map((line) => line.trim()).join("\n").trim(), { type: init.type }).then(({ cues, regions }) => {
452
+ this.#cues = cues;
453
+ this.#regions = regions;
454
+ this.#ready();
455
+ });
456
+ });
457
+ }
458
+ async #load() {
459
+ if (!this.#canLoad || this[TextTrackSymbol.readyState] > 0) return;
460
+ this[TextTrackSymbol.readyState] = 1;
461
+ this.dispatchEvent(new DOMEvent("load-start"));
462
+ if (!this.src) {
463
+ this.#ready();
464
+ return;
465
+ }
466
+ try {
467
+ const { parseResponse, VTTCue, VTTRegion } = await import("./prod-MRWX5W24.js"), crossOrigin = this[TextTrackSymbol.crossOrigin]?.();
468
+ const response = fetch(this.src, {
469
+ headers: this.type === "json" ? { "Content-Type": "application/json" } : void 0,
470
+ credentials: getRequestCredentials(crossOrigin)
471
+ });
472
+ if (this.type === "json") this.#parseJSON(await (await response).text(), VTTCue, VTTRegion);
473
+ else {
474
+ const { errors, metadata, regions, cues } = await parseResponse(response, {
475
+ type: this.type,
476
+ encoding: this.encoding
477
+ });
478
+ if (errors[0]?.code === 0) throw errors[0];
479
+ else {
480
+ this.#metadata = metadata;
481
+ this.#regions = regions;
482
+ this.#cues = cues;
483
+ }
484
+ }
485
+ this.#ready();
486
+ } catch (error) {
487
+ this.#error(error);
488
+ }
489
+ }
490
+ #ready() {
491
+ this[TextTrackSymbol.readyState] = 2;
492
+ if (!this.src || this.type !== "vtt") {
493
+ const native = this[TextTrackSymbol.native];
494
+ if (native && !native.managed) for (const cue of this.#cues) native.track.addCue(cue);
495
+ }
496
+ const loadEvent = new DOMEvent("load");
497
+ this[TextTrackSymbol.updateActiveCues](this.#currentTime, loadEvent);
498
+ this.dispatchEvent(loadEvent);
499
+ }
500
+ #error(error) {
501
+ this[TextTrackSymbol.readyState] = 3;
502
+ this.dispatchEvent(new DOMEvent("error", { detail: error }));
503
+ }
504
+ #parseJSON(json, VTTCue, VTTRegion) {
505
+ try {
506
+ const { regions, cues } = parseJSONCaptionsFile(json, VTTCue, VTTRegion);
507
+ this.#regions = regions;
508
+ this.#cues = cues;
509
+ } catch (error) {
510
+ this.#error(error);
511
+ }
512
+ }
513
+ #activeCuesChanged(trigger) {
514
+ this.dispatchEvent(new DOMEvent("cue-change", { trigger }));
515
+ }
516
+ };
517
+ var captionRE = /captions|subtitles/;
518
+ function isTrackCaptionKind(track) {
519
+ return captionRE.test(track.kind);
520
+ }
521
+ function parseJSONCaptionsFile(json, Cue, Region) {
522
+ const content = isString(json) ? JSON.parse(json) : json;
523
+ let regions = [], cues = [];
524
+ if (content.regions && Region) regions = content.regions.map((region) => Object.assign(new Region(), region));
525
+ if (content.cues || isArray(content)) cues = (isArray(content) ? content : content.cues).filter((content2) => isNumber(content2.startTime) && isNumber(content2.endTime)).map((cue) => Object.assign(new Cue(0, 0, ""), cue));
526
+ return {
527
+ regions,
528
+ cues
529
+ };
530
+ }
531
+ var ListSymbol = {
532
+ add: /* @__PURE__ */ Symbol(0),
533
+ remove: /* @__PURE__ */ Symbol(0),
534
+ reset: /* @__PURE__ */ Symbol(0),
535
+ select: /* @__PURE__ */ Symbol(0),
536
+ readonly: /* @__PURE__ */ Symbol(0),
537
+ setReadonly: /* @__PURE__ */ Symbol(0),
538
+ onReset: /* @__PURE__ */ Symbol(0),
539
+ onRemove: /* @__PURE__ */ Symbol(0),
540
+ onUserSelect: /* @__PURE__ */ Symbol(0)
541
+ };
542
+ function round(num, decimalPlaces = 2) {
543
+ return Number(num.toFixed(decimalPlaces));
544
+ }
545
+ function getNumberOfDecimalPlaces(num) {
546
+ return String(num).split(".")[1]?.length ?? 0;
547
+ }
548
+ function clampNumber(min, value, max) {
549
+ return Math.max(min, Math.min(max, value));
550
+ }
551
+ var QualitySymbol = {
552
+ setAuto: /* @__PURE__ */ Symbol(0),
553
+ enableAuto: /* @__PURE__ */ Symbol(0)
554
+ };
555
+ var audioContext = null;
556
+ var gainNodes = [];
557
+ var elAudioSources = [];
558
+ function getOrCreateAudioCtx() {
559
+ return audioContext ??= new AudioContext();
560
+ }
561
+ function createGainNode() {
562
+ const audioCtx = getOrCreateAudioCtx(), gainNode = audioCtx.createGain();
563
+ gainNode.connect(audioCtx.destination);
564
+ gainNodes.push(gainNode);
565
+ return gainNode;
566
+ }
567
+ function createElementSource(el, gainNode) {
568
+ const src = getOrCreateAudioCtx().createMediaElementSource(el);
569
+ if (gainNode) src.connect(gainNode);
570
+ elAudioSources.push(src);
571
+ return src;
572
+ }
573
+ function destroyGainNode(node) {
574
+ const idx = gainNodes.indexOf(node);
575
+ if (idx !== -1) {
576
+ gainNodes.splice(idx, 1);
577
+ node.disconnect();
578
+ freeAudioCtxWhenAllResourcesFreed();
579
+ }
580
+ }
581
+ function destroyElementSource(src) {
582
+ const idx = elAudioSources.indexOf(src);
583
+ if (idx !== -1) {
584
+ elAudioSources.splice(idx, 1);
585
+ src.disconnect();
586
+ freeAudioCtxWhenAllResourcesFreed();
587
+ }
588
+ }
589
+ function freeAudioCtxWhenAllResourcesFreed() {
590
+ if (audioContext && gainNodes.length === 0 && elAudioSources.length === 0) audioContext.close().then(() => {
591
+ audioContext = null;
592
+ });
593
+ }
594
+ var AudioGain = class {
595
+ #media;
596
+ #onChange;
597
+ #gainNode = null;
598
+ #srcAudioNode = null;
599
+ get currentGain() {
600
+ return this.#gainNode?.gain?.value ?? null;
601
+ }
602
+ get supported() {
603
+ return true;
604
+ }
605
+ constructor(media, onChange) {
606
+ this.#media = media;
607
+ this.#onChange = onChange;
608
+ }
609
+ setGain(gain) {
610
+ const currGain = this.currentGain;
611
+ if (gain === this.currentGain) return;
612
+ if (gain === 1 && currGain !== 1) {
613
+ this.removeGain();
614
+ return;
615
+ }
616
+ if (!this.#gainNode) {
617
+ this.#gainNode = createGainNode();
618
+ if (this.#srcAudioNode) this.#srcAudioNode.connect(this.#gainNode);
619
+ }
620
+ if (!this.#srcAudioNode) this.#srcAudioNode = createElementSource(this.#media, this.#gainNode);
621
+ this.#gainNode.gain.value = gain;
622
+ this.#onChange(gain);
623
+ }
624
+ removeGain() {
625
+ if (!this.#gainNode) return;
626
+ if (this.#srcAudioNode) this.#srcAudioNode.connect(getOrCreateAudioCtx().destination);
627
+ this.#destroyGainNode();
628
+ this.#onChange(null);
629
+ }
630
+ destroy() {
631
+ this.#destroySrcNode();
632
+ this.#destroyGainNode();
633
+ }
634
+ #destroySrcNode() {
635
+ if (!this.#srcAudioNode) return;
636
+ try {
637
+ destroyElementSource(this.#srcAudioNode);
638
+ } catch (e) {
639
+ } finally {
640
+ this.#srcAudioNode = null;
641
+ }
642
+ }
643
+ #destroyGainNode() {
644
+ if (!this.#gainNode) return;
645
+ try {
646
+ destroyGainNode(this.#gainNode);
647
+ } catch (e) {
648
+ } finally {
649
+ this.#gainNode = null;
650
+ }
651
+ }
652
+ };
653
+ var PAGE_EVENTS = [
654
+ "focus",
655
+ "blur",
656
+ "visibilitychange",
657
+ "pageshow",
658
+ "pagehide"
659
+ ];
660
+ var PageVisibility = class {
661
+ #state = signal(determinePageState());
662
+ #visibility = signal(IS_SERVER ? "visible" : document.visibilityState);
663
+ #safariBeforeUnloadTimeout;
664
+ connect() {
665
+ const events = new EventsController(window), handlePageEvent = this.#handlePageEvent.bind(this);
666
+ for (const eventType of PAGE_EVENTS) events.add(eventType, handlePageEvent);
667
+ if (IS_SAFARI) events.add("beforeunload", (event) => {
668
+ this.#safariBeforeUnloadTimeout = setTimeout(() => {
669
+ if (!(event.defaultPrevented || event.returnValue.length > 0)) {
670
+ this.#state.set("hidden");
671
+ this.#visibility.set("hidden");
672
+ }
673
+ }, 0);
674
+ });
675
+ }
676
+ /**
677
+ * The current page state. Important to note we only account for a subset of page states, as
678
+ * the rest aren't valuable to the player at the moment.
679
+ *
680
+ * - **active:** A page is in the active state if it is visible and has input focus.
681
+ * - **passive:** A page is in the passive state if it is visible and does not have input focus.
682
+ * - **hidden:** A page is in the hidden state if it is not visible.
683
+ *
684
+ * @see https://developers.google.com/web/updates/2018/07/page-lifecycle-api#states
685
+ */
686
+ get pageState() {
687
+ return this.#state();
688
+ }
689
+ /**
690
+ * The current document visibility state.
691
+ *
692
+ * - **visible:** The page content may be at least partially visible. In practice, this means that
693
+ * the page is the foreground tab of a non-minimized window.
694
+ * - **hidden:** The page content is not visible to the user. In practice this means that the
695
+ * document is either a background tab or part of a minimized window, or the OS screen lock is
696
+ * active.
697
+ *
698
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState
699
+ */
700
+ get visibility() {
701
+ return this.#visibility();
702
+ }
703
+ #handlePageEvent(event) {
704
+ if (IS_SAFARI) window.clearTimeout(this.#safariBeforeUnloadTimeout);
705
+ if (event.type !== "blur" || this.#state() === "active") {
706
+ this.#state.set(determinePageState(event));
707
+ this.#visibility.set(document.visibilityState == "hidden" ? "hidden" : "visible");
708
+ }
709
+ }
710
+ };
711
+ function determinePageState(event) {
712
+ if (IS_SERVER) return "hidden";
713
+ if (event?.type === "blur" || document.visibilityState === "hidden") return "hidden";
714
+ if (document.hasFocus()) return "active";
715
+ return "passive";
716
+ }
717
+ var RAFLoop = class {
718
+ #id;
719
+ #callback;
720
+ constructor(callback) {
721
+ this.#callback = callback;
722
+ }
723
+ start() {
724
+ if (!isUndefined(this.#id)) return;
725
+ this.#loop();
726
+ }
727
+ stop() {
728
+ if (isNumber(this.#id)) window.cancelAnimationFrame(this.#id);
729
+ this.#id = void 0;
730
+ }
731
+ #loop() {
732
+ this.#id = window.requestAnimationFrame(() => {
733
+ if (isUndefined(this.#id)) return;
734
+ this.#callback();
735
+ this.#loop();
736
+ });
737
+ }
738
+ };
739
+ var HTMLMediaEvents = class {
740
+ #provider;
741
+ #ctx;
742
+ #waiting = false;
743
+ #attachedLoadStart = false;
744
+ #attachedCanPlay = false;
745
+ #timeRAF = new RAFLoop(this.#onAnimationFrame.bind(this));
746
+ #pageVisibility = new PageVisibility();
747
+ #events;
748
+ get #media() {
749
+ return this.#provider.media;
750
+ }
751
+ constructor(provider, ctx) {
752
+ this.#provider = provider;
753
+ this.#ctx = ctx;
754
+ this.#events = new EventsController(provider.media);
755
+ this.#attachInitialListeners();
756
+ this.#pageVisibility.connect();
757
+ effect(this.#attachTimeUpdate.bind(this));
758
+ onDispose(this.#onDispose.bind(this));
759
+ }
760
+ #onDispose() {
761
+ this.#attachedLoadStart = false;
762
+ this.#attachedCanPlay = false;
763
+ this.#timeRAF.stop();
764
+ this.#events.abort();
765
+ this.#devHandlers?.clear();
766
+ }
767
+ /**
768
+ * The `timeupdate` event fires surprisingly infrequently during playback, meaning your progress
769
+ * bar (or whatever else is synced to the currentTime) moves in a choppy fashion. This helps
770
+ * resolve that by retrieving time updates in a request animation frame loop.
771
+ */
772
+ #lastSeenTime = 0;
773
+ #seekedTo = -1;
774
+ #onAnimationFrame() {
775
+ const newTime = this.#media.currentTime;
776
+ if (!(IS_SAFARI && newTime - this.#seekedTo < 0.35) && this.#lastSeenTime !== newTime) {
777
+ this.#updateCurrentTime(newTime);
778
+ this.#lastSeenTime = newTime;
779
+ }
780
+ }
781
+ #attachInitialListeners() {
782
+ this.#attachEventListener("loadstart", this.#onLoadStart);
783
+ this.#attachEventListener("abort", this.#onAbort);
784
+ this.#attachEventListener("emptied", this.#onEmptied);
785
+ this.#attachEventListener("error", this.#onError);
786
+ this.#attachEventListener("volumechange", this.#onVolumeChange);
787
+ }
788
+ #attachLoadStartListeners() {
789
+ if (this.#attachedLoadStart) return;
790
+ this.#attachEventListener("loadeddata", this.#onLoadedData);
791
+ this.#attachEventListener("loadedmetadata", this.#onLoadedMetadata);
792
+ this.#attachEventListener("canplay", this.#onCanPlay);
793
+ this.#attachEventListener("canplaythrough", this.#onCanPlayThrough);
794
+ this.#attachEventListener("durationchange", this.#onDurationChange);
795
+ this.#attachEventListener("play", this.#onPlay);
796
+ this.#attachEventListener("progress", this.#onProgress);
797
+ this.#attachEventListener("stalled", this.#onStalled);
798
+ this.#attachEventListener("suspend", this.#onSuspend);
799
+ this.#attachEventListener("ratechange", this.#onRateChange);
800
+ this.#attachedLoadStart = true;
801
+ }
802
+ #attachCanPlayListeners() {
803
+ if (this.#attachedCanPlay) return;
804
+ this.#attachEventListener("pause", this.#onPause);
805
+ this.#attachEventListener("playing", this.#onPlaying);
806
+ this.#attachEventListener("seeked", this.#onSeeked);
807
+ this.#attachEventListener("seeking", this.#onSeeking);
808
+ this.#attachEventListener("ended", this.#onEnded);
809
+ this.#attachEventListener("waiting", this.#onWaiting);
810
+ this.#attachedCanPlay = true;
811
+ }
812
+ #devHandlers = void 0;
813
+ #handleDevEvent = void 0;
814
+ #attachEventListener(eventType, handler) {
815
+ this.#events.add(eventType, handler.bind(this));
816
+ }
817
+ #onDevEvent(event) {
818
+ }
819
+ #updateCurrentTime(time, trigger) {
820
+ const newTime = Math.min(time, this.#ctx.$state.seekableEnd());
821
+ this.#ctx.notify("time-change", newTime, trigger);
822
+ }
823
+ #onLoadStart(event) {
824
+ if (this.#media.networkState === 3) {
825
+ this.#onAbort(event);
826
+ return;
827
+ }
828
+ this.#attachLoadStartListeners();
829
+ this.#ctx.notify("load-start", void 0, event);
830
+ }
831
+ #onAbort(event) {
832
+ this.#ctx.notify("abort", void 0, event);
833
+ }
834
+ #onEmptied(event) {
835
+ this.#ctx.notify("emptied", void 0, event);
836
+ }
837
+ #onLoadedData(event) {
838
+ this.#ctx.notify("loaded-data", void 0, event);
839
+ }
840
+ #onLoadedMetadata(event) {
841
+ this.#lastSeenTime = 0;
842
+ this.#seekedTo = -1;
843
+ this.#attachCanPlayListeners();
844
+ this.#ctx.notify("loaded-metadata", void 0, event);
845
+ if (IS_IOS || IS_SAFARI && isHLSSrc(this.#ctx.$state.source())) this.#ctx.delegate.ready(this.#getCanPlayDetail(), event);
846
+ }
847
+ #getCanPlayDetail() {
848
+ return {
849
+ provider: peek(this.#ctx.$provider),
850
+ duration: this.#media.duration,
851
+ buffered: this.#media.buffered,
852
+ seekable: this.#media.seekable
853
+ };
854
+ }
855
+ #onPlay(event) {
856
+ if (!this.#ctx.$state.canPlay()) return;
857
+ this.#ctx.notify("play", void 0, event);
858
+ }
859
+ #onPause(event) {
860
+ if (this.#media.readyState === 1 && !this.#waiting) return;
861
+ this.#waiting = false;
862
+ this.#timeRAF.stop();
863
+ this.#ctx.notify("pause", void 0, event);
864
+ }
865
+ #onCanPlay(event) {
866
+ this.#ctx.delegate.ready(this.#getCanPlayDetail(), event);
867
+ }
868
+ #onCanPlayThrough(event) {
869
+ if (this.#ctx.$state.started()) return;
870
+ this.#ctx.notify("can-play-through", this.#getCanPlayDetail(), event);
871
+ }
872
+ #onPlaying(event) {
873
+ if (this.#media.paused) return;
874
+ this.#waiting = false;
875
+ this.#ctx.notify("playing", void 0, event);
876
+ this.#timeRAF.start();
877
+ }
878
+ #onStalled(event) {
879
+ this.#ctx.notify("stalled", void 0, event);
880
+ if (this.#media.readyState < 3) {
881
+ this.#waiting = true;
882
+ this.#ctx.notify("waiting", void 0, event);
883
+ }
884
+ }
885
+ #onWaiting(event) {
886
+ if (this.#media.readyState < 3) {
887
+ this.#waiting = true;
888
+ this.#ctx.notify("waiting", void 0, event);
889
+ }
890
+ }
891
+ #onEnded(event) {
892
+ this.#timeRAF.stop();
893
+ this.#updateCurrentTime(this.#media.duration, event);
894
+ this.#ctx.notify("end", void 0, event);
895
+ if (this.#ctx.$state.loop()) {
896
+ if (isNil(this.#media.controls)) this.#media.controls = false;
897
+ }
898
+ }
899
+ #attachTimeUpdate() {
900
+ const isPaused = this.#ctx.$state.paused(), isPageHidden = this.#pageVisibility.visibility === "hidden";
901
+ if (isPaused || isPageHidden) listenEvent(this.#media, "timeupdate", this.#onTimeUpdate.bind(this));
902
+ }
903
+ #onTimeUpdate(event) {
904
+ this.#updateCurrentTime(this.#media.currentTime, event);
905
+ }
906
+ #onDurationChange(event) {
907
+ if (this.#ctx.$state.ended()) this.#updateCurrentTime(this.#media.duration, event);
908
+ this.#ctx.notify("duration-change", this.#media.duration, event);
909
+ }
910
+ #onVolumeChange(event) {
911
+ const detail = {
912
+ volume: this.#media.volume,
913
+ muted: this.#media.muted
914
+ };
915
+ this.#ctx.notify("volume-change", detail, event);
916
+ }
917
+ #onSeeked(event) {
918
+ this.#seekedTo = this.#media.currentTime;
919
+ this.#updateCurrentTime(this.#media.currentTime, event);
920
+ this.#ctx.notify("seeked", this.#media.currentTime, event);
921
+ if (Math.trunc(this.#media.currentTime) === Math.trunc(this.#media.duration) && getNumberOfDecimalPlaces(this.#media.duration) > getNumberOfDecimalPlaces(this.#media.currentTime)) {
922
+ this.#updateCurrentTime(this.#media.duration, event);
923
+ if (!this.#media.ended) this.#ctx.player.dispatch(new DOMEvent("media-play-request", { trigger: event }));
924
+ }
925
+ }
926
+ #onSeeking(event) {
927
+ this.#ctx.notify("seeking", this.#media.currentTime, event);
928
+ }
929
+ #onProgress(event) {
930
+ const detail = {
931
+ buffered: this.#media.buffered,
932
+ seekable: this.#media.seekable
933
+ };
934
+ this.#ctx.notify("progress", detail, event);
935
+ }
936
+ #onSuspend(event) {
937
+ this.#ctx.notify("suspend", void 0, event);
938
+ }
939
+ #onRateChange(event) {
940
+ this.#ctx.notify("rate-change", this.#media.playbackRate, event);
941
+ }
942
+ #onError(event) {
943
+ const error = this.#media.error;
944
+ if (!error) return;
945
+ const detail = {
946
+ message: error.message,
947
+ code: error.code,
948
+ mediaError: error
949
+ };
950
+ this.#ctx.notify("error", detail, event);
951
+ }
952
+ };
953
+ var NativeAudioTracks = class {
954
+ #provider;
955
+ #ctx;
956
+ get #nativeTracks() {
957
+ return this.#provider.media.audioTracks;
958
+ }
959
+ constructor(provider, ctx) {
960
+ this.#provider = provider;
961
+ this.#ctx = ctx;
962
+ this.#nativeTracks.onaddtrack = this.#onAddNativeTrack.bind(this);
963
+ this.#nativeTracks.onremovetrack = this.#onRemoveNativeTrack.bind(this);
964
+ this.#nativeTracks.onchange = this.#onChangeNativeTrack.bind(this);
965
+ listenEvent(this.#ctx.audioTracks, "change", this.#onChangeTrack.bind(this));
966
+ }
967
+ #onAddNativeTrack(event) {
968
+ const nativeTrack = event.track;
969
+ if (nativeTrack.label === "") return;
970
+ const audioTrack = {
971
+ id: nativeTrack.id.toString() || `native-audio-${this.#ctx.audioTracks.length}`,
972
+ label: nativeTrack.label,
973
+ language: nativeTrack.language,
974
+ kind: nativeTrack.kind,
975
+ selected: false
976
+ };
977
+ this.#ctx.audioTracks[ListSymbol.add](audioTrack, event);
978
+ if (nativeTrack.enabled) audioTrack.selected = true;
979
+ }
980
+ #onRemoveNativeTrack(event) {
981
+ const track = this.#ctx.audioTracks.getById(event.track.id);
982
+ if (track) this.#ctx.audioTracks[ListSymbol.remove](track, event);
983
+ }
984
+ #onChangeNativeTrack(event) {
985
+ let enabledTrack = this.#getEnabledNativeTrack();
986
+ if (!enabledTrack) return;
987
+ const track = this.#ctx.audioTracks.getById(enabledTrack.id);
988
+ if (track) this.#ctx.audioTracks[ListSymbol.select](track, true, event);
989
+ }
990
+ #getEnabledNativeTrack() {
991
+ return Array.from(this.#nativeTracks).find((track) => track.enabled);
992
+ }
993
+ #onChangeTrack(event) {
994
+ const { current } = event.detail;
995
+ if (!current) return;
996
+ const track = this.#nativeTracks.getTrackById(current.id);
997
+ if (track) {
998
+ const prev = this.#getEnabledNativeTrack();
999
+ if (prev) prev.enabled = false;
1000
+ track.enabled = true;
1001
+ }
1002
+ }
1003
+ };
1004
+ var HTMLMediaProvider = class {
1005
+ media;
1006
+ ctx;
1007
+ scope = createScope();
1008
+ currentSrc = null;
1009
+ audioGain;
1010
+ constructor(media, ctx) {
1011
+ this.media = media;
1012
+ this.ctx = ctx;
1013
+ this.audioGain = new AudioGain(media, (gain) => {
1014
+ this.ctx.notify("audio-gain-change", gain);
1015
+ });
1016
+ }
1017
+ setup() {
1018
+ new HTMLMediaEvents(this, this.ctx);
1019
+ if ("audioTracks" in this.media) new NativeAudioTracks(this, this.ctx);
1020
+ onDispose(() => {
1021
+ this.audioGain.destroy();
1022
+ this.media.srcObject = null;
1023
+ this.media.removeAttribute("src");
1024
+ for (const source of this.media.querySelectorAll("source")) source.remove();
1025
+ this.media.load();
1026
+ });
1027
+ }
1028
+ get type() {
1029
+ return "";
1030
+ }
1031
+ setPlaybackRate(rate) {
1032
+ this.media.playbackRate = rate;
1033
+ }
1034
+ async play() {
1035
+ return this.media.play();
1036
+ }
1037
+ async pause() {
1038
+ return this.media.pause();
1039
+ }
1040
+ setMuted(muted) {
1041
+ this.media.muted = muted;
1042
+ }
1043
+ setVolume(volume) {
1044
+ this.media.volume = volume;
1045
+ }
1046
+ setCurrentTime(time) {
1047
+ this.media.currentTime = time;
1048
+ }
1049
+ setPlaysInline(inline) {
1050
+ setAttribute(this.media, "playsinline", inline);
1051
+ }
1052
+ async loadSource({ src, type }, preload) {
1053
+ this.media.preload = preload || "";
1054
+ if (isMediaStream(src)) {
1055
+ this.removeSource();
1056
+ this.media.srcObject = src;
1057
+ } else {
1058
+ this.media.srcObject = null;
1059
+ if (isString(src)) if (type !== "?") this.appendSource({
1060
+ src,
1061
+ type
1062
+ });
1063
+ else {
1064
+ this.removeSource();
1065
+ this.media.src = this.#appendMediaFragment(src);
1066
+ }
1067
+ else {
1068
+ this.removeSource();
1069
+ this.media.src = window.URL.createObjectURL(src);
1070
+ }
1071
+ }
1072
+ this.media.load();
1073
+ this.currentSrc = {
1074
+ src,
1075
+ type
1076
+ };
1077
+ }
1078
+ /**
1079
+ * Append source so it works when requesting AirPlay since hls.js will remove it.
1080
+ */
1081
+ appendSource(src, defaultType) {
1082
+ const prevSource = this.media.querySelector("source[data-vds]"), source = prevSource ?? document.createElement("source");
1083
+ setAttribute(source, "src", this.#appendMediaFragment(src.src));
1084
+ setAttribute(source, "type", src.type !== "?" ? src.type : defaultType);
1085
+ setAttribute(source, "data-vds", "");
1086
+ if (!prevSource) this.media.append(source);
1087
+ }
1088
+ removeSource() {
1089
+ this.media.querySelector("source[data-vds]")?.remove();
1090
+ }
1091
+ #appendMediaFragment(src) {
1092
+ const { clipStartTime, clipEndTime } = this.ctx.$state, startTime = clipStartTime(), endTime = clipEndTime();
1093
+ if (startTime > 0 && endTime > 0) return `${src}#t=${startTime},${endTime}`;
1094
+ else if (startTime > 0) return `${src}#t=${startTime}`;
1095
+ else if (endTime > 0) return `${src}#t=0,${endTime}`;
1096
+ return src;
1097
+ }
1098
+ };
1099
+ var HTMLRemotePlaybackAdapter = class {
1100
+ #media;
1101
+ #ctx;
1102
+ #state;
1103
+ #supported = signal(false);
1104
+ get supported() {
1105
+ return this.#supported();
1106
+ }
1107
+ constructor(media, ctx) {
1108
+ this.#media = media;
1109
+ this.#ctx = ctx;
1110
+ this.#setup();
1111
+ }
1112
+ #setup() {
1113
+ if (IS_SERVER || !this.#media?.remote || !this.canPrompt) return;
1114
+ this.#media.remote.watchAvailability((available) => {
1115
+ this.#supported.set(available);
1116
+ }).catch(() => {
1117
+ this.#supported.set(false);
1118
+ });
1119
+ effect(this.#watchSupported.bind(this));
1120
+ }
1121
+ #watchSupported() {
1122
+ if (!this.#supported()) return;
1123
+ const events = [
1124
+ "connecting",
1125
+ "connect",
1126
+ "disconnect"
1127
+ ], onStateChange = this.#onStateChange.bind(this);
1128
+ onStateChange();
1129
+ listenEvent(this.#media, "playing", onStateChange);
1130
+ const remoteEvents = new EventsController(this.#media.remote);
1131
+ for (const type of events) remoteEvents.add(type, onStateChange);
1132
+ }
1133
+ async prompt() {
1134
+ if (!this.supported) throw Error("Not supported on this platform.");
1135
+ if (this.type === "airplay" && this.#media.webkitShowPlaybackTargetPicker) return this.#media.webkitShowPlaybackTargetPicker();
1136
+ return this.#media.remote.prompt();
1137
+ }
1138
+ #onStateChange(event) {
1139
+ const state = this.#media.remote.state;
1140
+ if (state === this.#state) return;
1141
+ const detail = {
1142
+ type: this.type,
1143
+ state
1144
+ };
1145
+ this.#ctx.notify("remote-playback-change", detail, event);
1146
+ this.#state = state;
1147
+ }
1148
+ };
1149
+ var HTMLAirPlayAdapter = class extends HTMLRemotePlaybackAdapter {
1150
+ type = "airplay";
1151
+ get canPrompt() {
1152
+ return "WebKitPlaybackTargetAvailabilityEvent" in window;
1153
+ }
1154
+ };
1155
+ var NativeHLSTextTracks = class {
1156
+ #video;
1157
+ #ctx;
1158
+ constructor(video, ctx) {
1159
+ this.#video = video;
1160
+ this.#ctx = ctx;
1161
+ video.textTracks.onaddtrack = this.#onAddTrack.bind(this);
1162
+ onDispose(this.#onDispose.bind(this));
1163
+ }
1164
+ #onAddTrack(event) {
1165
+ const nativeTrack = event.track;
1166
+ if (!nativeTrack || findTextTrackElement(this.#video, nativeTrack)) return;
1167
+ const track = new TextTrack({
1168
+ id: nativeTrack.id,
1169
+ kind: nativeTrack.kind,
1170
+ label: nativeTrack.label ?? "",
1171
+ language: nativeTrack.language,
1172
+ type: "vtt"
1173
+ });
1174
+ track[TextTrackSymbol.native] = { track: nativeTrack };
1175
+ track[TextTrackSymbol.readyState] = 2;
1176
+ track[TextTrackSymbol.nativeHLS] = true;
1177
+ let lastIndex = 0;
1178
+ const onCueChange = (event2) => {
1179
+ if (!nativeTrack.cues) return;
1180
+ for (let i = lastIndex; i < nativeTrack.cues.length; i++) {
1181
+ track.addCue(nativeTrack.cues[i], event2);
1182
+ lastIndex++;
1183
+ }
1184
+ };
1185
+ onCueChange(event);
1186
+ nativeTrack.oncuechange = onCueChange;
1187
+ this.#ctx.textTracks.add(track, event);
1188
+ track.setMode(nativeTrack.mode, event);
1189
+ }
1190
+ #onDispose() {
1191
+ this.#video.textTracks.onaddtrack = null;
1192
+ for (const track of this.#ctx.textTracks) {
1193
+ const nativeTrack = track[TextTrackSymbol.native]?.track;
1194
+ if (nativeTrack?.oncuechange) nativeTrack.oncuechange = null;
1195
+ }
1196
+ }
1197
+ };
1198
+ function findTextTrackElement(video, track) {
1199
+ return Array.from(video.children).find((el) => el.track === track);
1200
+ }
1201
+ var VideoPictureInPicture = class {
1202
+ #video;
1203
+ #media;
1204
+ constructor(video, media) {
1205
+ this.#video = video;
1206
+ this.#media = media;
1207
+ new EventsController(video).add("enterpictureinpicture", this.#onEnter.bind(this)).add("leavepictureinpicture", this.#onExit.bind(this));
1208
+ }
1209
+ get active() {
1210
+ return document.pictureInPictureElement === this.#video;
1211
+ }
1212
+ get supported() {
1213
+ return canUsePictureInPicture(this.#video);
1214
+ }
1215
+ async enter() {
1216
+ return this.#video.requestPictureInPicture();
1217
+ }
1218
+ exit() {
1219
+ return document.exitPictureInPicture();
1220
+ }
1221
+ #onEnter(event) {
1222
+ this.#onChange(true, event);
1223
+ }
1224
+ #onExit(event) {
1225
+ this.#onChange(false, event);
1226
+ }
1227
+ #onChange = (active, event) => {
1228
+ this.#media.notify("picture-in-picture-change", active, event);
1229
+ };
1230
+ };
1231
+ var VideoPresentation = class {
1232
+ #video;
1233
+ #media;
1234
+ #mode = "inline";
1235
+ get mode() {
1236
+ return this.#mode;
1237
+ }
1238
+ constructor(video, media) {
1239
+ this.#video = video;
1240
+ this.#media = media;
1241
+ listenEvent(video, "webkitpresentationmodechanged", this.#onModeChange.bind(this));
1242
+ }
1243
+ get supported() {
1244
+ return canUseVideoPresentation(this.#video);
1245
+ }
1246
+ async setPresentationMode(mode) {
1247
+ if (this.#mode === mode) return;
1248
+ this.#video.webkitSetPresentationMode(mode);
1249
+ }
1250
+ #onModeChange(event) {
1251
+ const prevMode = this.#mode;
1252
+ this.#mode = this.#video.webkitPresentationMode;
1253
+ this.#media.player?.dispatch(new DOMEvent("video-presentation-change", {
1254
+ detail: this.#mode,
1255
+ trigger: event
1256
+ }));
1257
+ ["fullscreen", "picture-in-picture"].forEach((type) => {
1258
+ if (this.#mode === type || prevMode === type) this.#media.notify(`${type}-change`, this.#mode === type, event);
1259
+ });
1260
+ }
1261
+ };
1262
+ var FullscreenPresentationAdapter = class {
1263
+ #presentation;
1264
+ get active() {
1265
+ return this.#presentation.mode === "fullscreen";
1266
+ }
1267
+ get supported() {
1268
+ return this.#presentation.supported;
1269
+ }
1270
+ constructor(presentation) {
1271
+ this.#presentation = presentation;
1272
+ }
1273
+ async enter() {
1274
+ this.#presentation.setPresentationMode("fullscreen");
1275
+ }
1276
+ async exit() {
1277
+ this.#presentation.setPresentationMode("inline");
1278
+ }
1279
+ };
1280
+ var PIPPresentationAdapter = class {
1281
+ #presentation;
1282
+ get active() {
1283
+ return this.#presentation.mode === "picture-in-picture";
1284
+ }
1285
+ get supported() {
1286
+ return this.#presentation.supported;
1287
+ }
1288
+ constructor(presentation) {
1289
+ this.#presentation = presentation;
1290
+ }
1291
+ async enter() {
1292
+ this.#presentation.setPresentationMode("picture-in-picture");
1293
+ }
1294
+ async exit() {
1295
+ this.#presentation.setPresentationMode("inline");
1296
+ }
1297
+ };
1298
+ var provider_exports$1 = /* @__PURE__ */ __exportAll({ VideoProvider: () => VideoProvider });
1299
+ var VideoProvider = class extends HTMLMediaProvider {
1300
+ $$PROVIDER_TYPE = "VIDEO";
1301
+ get type() {
1302
+ return "video";
1303
+ }
1304
+ airPlay;
1305
+ fullscreen;
1306
+ pictureInPicture;
1307
+ constructor(video, ctx) {
1308
+ super(video, ctx);
1309
+ scoped(() => {
1310
+ this.airPlay = new HTMLAirPlayAdapter(video, ctx);
1311
+ if (canUseVideoPresentation(video)) {
1312
+ const presentation = new VideoPresentation(video, ctx);
1313
+ this.fullscreen = new FullscreenPresentationAdapter(presentation);
1314
+ this.pictureInPicture = new PIPPresentationAdapter(presentation);
1315
+ } else if (canUsePictureInPicture(video)) this.pictureInPicture = new VideoPictureInPicture(video, ctx);
1316
+ }, this.scope);
1317
+ }
1318
+ setup() {
1319
+ super.setup();
1320
+ if (canPlayHLSNatively(this.video)) new NativeHLSTextTracks(this.video, this.ctx);
1321
+ this.ctx.textRenderers.attachVideo(this.video);
1322
+ onDispose(() => {
1323
+ this.ctx.textRenderers.attachVideo(null);
1324
+ });
1325
+ if (this.type === "video") this.ctx.notify("provider-setup", this);
1326
+ }
1327
+ /**
1328
+ * The native HTML `<video>` element.
1329
+ *
1330
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement}
1331
+ */
1332
+ get video() {
1333
+ return this.media;
1334
+ }
1335
+ };
1336
+ function getLangName(langCode) {
1337
+ try {
1338
+ return new Intl.DisplayNames(navigator.languages, { type: "language" }).of(langCode) ?? null;
1339
+ } catch (err) {
1340
+ return null;
1341
+ }
1342
+ }
1343
+ var toDOMEventType = (type) => `dash-${camelToKebabCase(type)}`;
1344
+ var DASHController = class {
1345
+ #video;
1346
+ #ctx;
1347
+ #instance = null;
1348
+ #callbacks = /* @__PURE__ */ new Set();
1349
+ #stopLiveSync = null;
1350
+ config = {};
1351
+ get instance() {
1352
+ return this.#instance;
1353
+ }
1354
+ constructor(video, ctx) {
1355
+ this.#video = video;
1356
+ this.#ctx = ctx;
1357
+ }
1358
+ setup(ctor) {
1359
+ this.#instance = ctor().create();
1360
+ const dispatcher = this.#dispatchDASHEvent.bind(this);
1361
+ for (const event of Object.values(ctor.events)) this.#instance.on(event, dispatcher);
1362
+ this.#instance.on(ctor.events.ERROR, this.#onError.bind(this));
1363
+ for (const callback of this.#callbacks) callback(this.#instance);
1364
+ this.#ctx.player.dispatch("dash-instance", { detail: this.#instance });
1365
+ this.#instance.initialize(this.#video, void 0, false);
1366
+ this.#instance.updateSettings({
1367
+ streaming: {
1368
+ text: {
1369
+ defaultEnabled: false,
1370
+ dispatchForManualRendering: true
1371
+ },
1372
+ buffer: { fastSwitchEnabled: true }
1373
+ },
1374
+ ...this.config
1375
+ });
1376
+ this.#instance.on(ctor.events.FRAGMENT_LOADING_STARTED, this.#onFragmentLoadStart.bind(this));
1377
+ this.#instance.on(ctor.events.FRAGMENT_LOADING_COMPLETED, this.#onFragmentLoadComplete.bind(this));
1378
+ this.#instance.on(ctor.events.MANIFEST_LOADED, this.#onManifestLoaded.bind(this));
1379
+ this.#instance.on(ctor.events.QUALITY_CHANGE_RENDERED, this.#onQualityChange.bind(this));
1380
+ this.#instance.on(ctor.events.TEXT_TRACKS_ADDED, this.#onTextTracksAdded.bind(this));
1381
+ this.#instance.on(ctor.events.TRACK_CHANGE_RENDERED, this.#onTrackChange.bind(this));
1382
+ this.#ctx.qualities[QualitySymbol.enableAuto] = this.#enableAutoQuality.bind(this);
1383
+ listenEvent(this.#ctx.qualities, "change", this.#onUserQualityChange.bind(this));
1384
+ listenEvent(this.#ctx.audioTracks, "change", this.#onUserAudioChange.bind(this));
1385
+ this.#stopLiveSync = effect(this.#liveSync.bind(this));
1386
+ }
1387
+ #createDOMEvent(event) {
1388
+ return new DOMEvent(toDOMEventType(event.type), { detail: event });
1389
+ }
1390
+ #liveSync() {
1391
+ if (!this.#ctx.$state.live()) return;
1392
+ const raf = new RAFLoop(this.#liveSyncPosition.bind(this));
1393
+ raf.start();
1394
+ return raf.stop.bind(raf);
1395
+ }
1396
+ #liveSyncPosition() {
1397
+ if (!this.#instance) return;
1398
+ const position = this.#instance.duration() - this.#instance.time();
1399
+ this.#ctx.$state.liveSyncPosition.set(!isNaN(position) ? position : Infinity);
1400
+ }
1401
+ #dispatchDASHEvent(event) {
1402
+ this.#ctx.player?.dispatch(this.#createDOMEvent(event));
1403
+ }
1404
+ #currentTrack = null;
1405
+ #cueTracker = {};
1406
+ #onTextFragmentLoaded(event) {
1407
+ const native = this.#currentTrack?.[TextTrackSymbol.native], cues = (native?.track).cues;
1408
+ if (!native || !cues) return;
1409
+ const id = this.#currentTrack.id, startIndex = this.#cueTracker[id] ?? 0, trigger = this.#createDOMEvent(event);
1410
+ for (let i = startIndex; i < cues.length; i++) {
1411
+ const cue = cues[i];
1412
+ if (!cue.positionAlign) cue.positionAlign = "auto";
1413
+ this.#currentTrack.addCue(cue, trigger);
1414
+ }
1415
+ this.#cueTracker[id] = cues.length;
1416
+ }
1417
+ #onTextTracksAdded(event) {
1418
+ if (!this.#instance) return;
1419
+ const data = event.tracks, nativeTextTracks = [...this.#video.textTracks].filter((track) => "manualMode" in track), trigger = this.#createDOMEvent(event);
1420
+ for (let i = 0; i < nativeTextTracks.length; i++) {
1421
+ const textTrackInfo = data[i], nativeTextTrack = nativeTextTracks[i];
1422
+ const track = new TextTrack({
1423
+ id: `dash-${textTrackInfo.kind}-${i}`,
1424
+ label: textTrackInfo?.label ?? textTrackInfo.labels.find((t) => t.text)?.text ?? (textTrackInfo?.lang && getLangName(textTrackInfo.lang)) ?? textTrackInfo?.lang ?? void 0,
1425
+ language: textTrackInfo.lang ?? void 0,
1426
+ kind: textTrackInfo.kind,
1427
+ default: textTrackInfo.defaultTrack
1428
+ });
1429
+ track[TextTrackSymbol.native] = {
1430
+ managed: true,
1431
+ track: nativeTextTrack
1432
+ };
1433
+ track[TextTrackSymbol.readyState] = 2;
1434
+ track[TextTrackSymbol.onModeChange] = () => {
1435
+ if (!this.#instance) return;
1436
+ if (track.mode === "showing") {
1437
+ this.#instance.setTextTrack(i);
1438
+ this.#currentTrack = track;
1439
+ } else {
1440
+ this.#instance.setTextTrack(-1);
1441
+ this.#currentTrack = null;
1442
+ }
1443
+ };
1444
+ this.#ctx.textTracks.add(track, trigger);
1445
+ }
1446
+ }
1447
+ #onTrackChange(event) {
1448
+ const { mediaType, newMediaInfo } = event;
1449
+ if (mediaType === "audio") {
1450
+ const track = this.#ctx.audioTracks.getById(`dash-audio-${newMediaInfo.index}`);
1451
+ if (track) {
1452
+ const trigger = this.#createDOMEvent(event);
1453
+ this.#ctx.audioTracks[ListSymbol.select](track, true, trigger);
1454
+ }
1455
+ }
1456
+ }
1457
+ #onQualityChange(event) {
1458
+ if (event.mediaType !== "video") return;
1459
+ const quality = this.#ctx.qualities[event.newQuality];
1460
+ if (quality) {
1461
+ const trigger = this.#createDOMEvent(event);
1462
+ this.#ctx.qualities[ListSymbol.select](quality, true, trigger);
1463
+ }
1464
+ }
1465
+ #onManifestLoaded(event) {
1466
+ if (this.#ctx.$state.canPlay() || !this.#instance) return;
1467
+ const { type, mediaPresentationDuration } = event.data, trigger = this.#createDOMEvent(event);
1468
+ this.#ctx.notify("stream-type-change", type !== "static" ? "live" : "on-demand", trigger);
1469
+ this.#ctx.notify("duration-change", mediaPresentationDuration, trigger);
1470
+ this.#ctx.qualities[QualitySymbol.setAuto](true, trigger);
1471
+ const media = this.#instance.getVideoElement();
1472
+ const videoQualities = this.#instance.getTracksForTypeFromManifest("video", event.data);
1473
+ const supportedVideoMimeType = [...new Set(videoQualities.map((e) => e.mimeType))].find((type2) => type2 && canPlayVideoType(media, type2));
1474
+ const videoQuality = videoQualities.find((track) => supportedVideoMimeType === track.mimeType);
1475
+ let audioTracks = this.#instance.getTracksForTypeFromManifest("audio", event.data);
1476
+ const supportedAudioMimeType = [...new Set(audioTracks.map((e) => e.mimeType))].find((type2) => type2 && canPlayAudioType(media, type2));
1477
+ audioTracks = audioTracks.filter((track) => supportedAudioMimeType === track.mimeType);
1478
+ if (videoQuality) {
1479
+ videoQuality.bitrateList.forEach((bitrate, index) => {
1480
+ const quality = {
1481
+ id: bitrate.id?.toString() ?? `dash-bitrate-${index}`,
1482
+ width: bitrate.width ?? 0,
1483
+ height: bitrate.height ?? 0,
1484
+ bitrate: bitrate.bandwidth ?? 0,
1485
+ codec: videoQuality.codec,
1486
+ index
1487
+ };
1488
+ this.#ctx.qualities[ListSymbol.add](quality, trigger);
1489
+ });
1490
+ if (isNumber(videoQuality.index)) {
1491
+ const quality = this.#ctx.qualities[videoQuality.index];
1492
+ if (quality) this.#ctx.qualities[ListSymbol.select](quality, true, trigger);
1493
+ }
1494
+ }
1495
+ audioTracks.forEach((audioTrack, index) => {
1496
+ const label = audioTrack.labels.find((label2) => {
1497
+ return navigator.languages.some((language) => {
1498
+ return label2.lang && language.toLowerCase().startsWith(label2.lang.toLowerCase());
1499
+ });
1500
+ }) || audioTrack.labels[0];
1501
+ const localTrack = {
1502
+ id: `dash-audio-${audioTrack?.index}`,
1503
+ label: label?.text ?? (audioTrack.lang && getLangName(audioTrack.lang)) ?? audioTrack.lang ?? "",
1504
+ language: audioTrack.lang ?? "",
1505
+ kind: "main",
1506
+ mimeType: audioTrack.mimeType,
1507
+ codec: audioTrack.codec,
1508
+ index
1509
+ };
1510
+ this.#ctx.audioTracks[ListSymbol.add](localTrack, trigger);
1511
+ });
1512
+ media.dispatchEvent(new DOMEvent("canplay", { trigger }));
1513
+ }
1514
+ #onError(event) {
1515
+ const { type: eventType, error: data } = event;
1516
+ switch (data.code) {
1517
+ case 27:
1518
+ this.#onNetworkError(data);
1519
+ break;
1520
+ default:
1521
+ this.#onFatalError(data);
1522
+ break;
1523
+ }
1524
+ }
1525
+ #onFragmentLoadStart() {
1526
+ if (this.#retryLoadingTimer >= 0) this.#clearRetryTimer();
1527
+ }
1528
+ #onFragmentLoadComplete(event) {
1529
+ if (event.mediaType === "text") requestAnimationFrame(this.#onTextFragmentLoaded.bind(this, event));
1530
+ }
1531
+ #retryLoadingTimer = -1;
1532
+ #onNetworkError(error) {
1533
+ this.#clearRetryTimer();
1534
+ this.#instance?.play();
1535
+ this.#retryLoadingTimer = window.setTimeout(() => {
1536
+ this.#retryLoadingTimer = -1;
1537
+ this.#onFatalError(error);
1538
+ }, 5e3);
1539
+ }
1540
+ #clearRetryTimer() {
1541
+ clearTimeout(this.#retryLoadingTimer);
1542
+ this.#retryLoadingTimer = -1;
1543
+ }
1544
+ #onFatalError(error) {
1545
+ this.#ctx.notify("error", {
1546
+ message: error.message ?? "",
1547
+ code: 1,
1548
+ error
1549
+ });
1550
+ }
1551
+ #enableAutoQuality() {
1552
+ this.#switchAutoBitrate("video", true);
1553
+ const { qualities } = this.#ctx;
1554
+ this.#instance?.setQualityFor("video", qualities.selectedIndex, true);
1555
+ }
1556
+ #switchAutoBitrate(type, auto) {
1557
+ this.#instance?.updateSettings({ streaming: { abr: { autoSwitchBitrate: { [type]: auto } } } });
1558
+ }
1559
+ #onUserQualityChange() {
1560
+ const { qualities } = this.#ctx;
1561
+ if (!this.#instance || qualities.auto || !qualities.selected) return;
1562
+ this.#switchAutoBitrate("video", false);
1563
+ this.#instance.setQualityFor("video", qualities.selectedIndex, qualities.switch === "current");
1564
+ if (IS_CHROME) this.#video.currentTime = this.#video.currentTime;
1565
+ }
1566
+ #onUserAudioChange() {
1567
+ if (!this.#instance) return;
1568
+ const { audioTracks } = this.#ctx, selectedTrack = this.#instance.getTracksFor("audio").find((track) => audioTracks.selected && audioTracks.selected.id === `dash-audio-${track.index}`);
1569
+ if (selectedTrack) this.#instance.setCurrentTrack(selectedTrack);
1570
+ }
1571
+ #reset() {
1572
+ this.#clearRetryTimer();
1573
+ this.#currentTrack = null;
1574
+ this.#cueTracker = {};
1575
+ }
1576
+ onInstance(callback) {
1577
+ this.#callbacks.add(callback);
1578
+ return () => this.#callbacks.delete(callback);
1579
+ }
1580
+ loadSource(src) {
1581
+ this.#reset();
1582
+ if (!isString(src.src)) return;
1583
+ this.#instance?.attachSource(src.src);
1584
+ }
1585
+ destroy() {
1586
+ this.#reset();
1587
+ this.#instance?.destroy();
1588
+ this.#instance = null;
1589
+ this.#stopLiveSync?.();
1590
+ this.#stopLiveSync = null;
1591
+ }
1592
+ };
1593
+ function coerceToError(error) {
1594
+ return error instanceof Error ? error : Error(typeof error === "string" ? error : JSON.stringify(error));
1595
+ }
1596
+ function assert(condition, message) {
1597
+ if (!condition) throw Error(message || "Assertion failed.");
1598
+ }
1599
+ var DASHLibLoader = class {
1600
+ #lib;
1601
+ #ctx;
1602
+ #callback;
1603
+ constructor(lib, ctx, callback) {
1604
+ this.#lib = lib;
1605
+ this.#ctx = ctx;
1606
+ this.#callback = callback;
1607
+ this.#startLoading();
1608
+ }
1609
+ async #startLoading() {
1610
+ const callbacks = {
1611
+ onLoadStart: this.#onLoadStart.bind(this),
1612
+ onLoaded: this.#onLoaded.bind(this),
1613
+ onLoadError: this.#onLoadError.bind(this)
1614
+ };
1615
+ let ctor = await loadDASHScript(this.#lib, callbacks);
1616
+ if (isUndefined(ctor) && !isString(this.#lib)) ctor = await importDASH(this.#lib, callbacks);
1617
+ if (!ctor) return null;
1618
+ if (!window.dashjs.supportsMediaSource()) {
1619
+ const message = "[vidstack] `dash.js` is not supported in this environment";
1620
+ this.#ctx.player.dispatch(new DOMEvent("dash-unsupported"));
1621
+ this.#ctx.notify("error", {
1622
+ message,
1623
+ code: 4
1624
+ });
1625
+ return null;
1626
+ }
1627
+ return ctor;
1628
+ }
1629
+ #onLoadStart() {
1630
+ this.#ctx.player.dispatch(new DOMEvent("dash-lib-load-start"));
1631
+ }
1632
+ #onLoaded(ctor) {
1633
+ this.#ctx.player.dispatch(new DOMEvent("dash-lib-loaded", { detail: ctor }));
1634
+ this.#callback(ctor);
1635
+ }
1636
+ #onLoadError(e) {
1637
+ const error = coerceToError(e);
1638
+ this.#ctx.player.dispatch(new DOMEvent("dash-lib-load-error", { detail: error }));
1639
+ this.#ctx.notify("error", {
1640
+ message: error.message,
1641
+ code: 4,
1642
+ error
1643
+ });
1644
+ }
1645
+ };
1646
+ async function importDASH(loader, callbacks = {}) {
1647
+ if (isUndefined(loader)) return void 0;
1648
+ callbacks.onLoadStart?.();
1649
+ if (isDASHConstructor(loader)) {
1650
+ callbacks.onLoaded?.(loader);
1651
+ return loader;
1652
+ }
1653
+ if (isDASHNamespace(loader)) {
1654
+ const ctor = loader.MediaPlayer;
1655
+ callbacks.onLoaded?.(ctor);
1656
+ return ctor;
1657
+ }
1658
+ try {
1659
+ const ctor = (await loader())?.default;
1660
+ if (isDASHNamespace(ctor)) {
1661
+ callbacks.onLoaded?.(ctor.MediaPlayer);
1662
+ return ctor.MediaPlayer;
1663
+ }
1664
+ if (ctor) callbacks.onLoaded?.(ctor);
1665
+ else throw Error("");
1666
+ return ctor;
1667
+ } catch (err) {
1668
+ callbacks.onLoadError?.(err);
1669
+ }
1670
+ }
1671
+ async function loadDASHScript(src, callbacks = {}) {
1672
+ if (!isString(src)) return void 0;
1673
+ callbacks.onLoadStart?.();
1674
+ try {
1675
+ await loadScript(src);
1676
+ if (!isFunction(window.dashjs.MediaPlayer)) throw Error("");
1677
+ const ctor = window.dashjs.MediaPlayer;
1678
+ callbacks.onLoaded?.(ctor);
1679
+ return ctor;
1680
+ } catch (err) {
1681
+ callbacks.onLoadError?.(err);
1682
+ }
1683
+ }
1684
+ function isDASHConstructor(value) {
1685
+ return value && value.prototype && value.prototype !== Function;
1686
+ }
1687
+ function isDASHNamespace(value) {
1688
+ return value && "MediaPlayer" in value;
1689
+ }
1690
+ var provider_exports = /* @__PURE__ */ __exportAll({ DASHProvider: () => DASHProvider });
1691
+ var JS_DELIVR_CDN = "https://cdn.jsdelivr.net";
1692
+ var DASHProvider = class extends VideoProvider {
1693
+ $$PROVIDER_TYPE = "DASH";
1694
+ #ctor = null;
1695
+ #controller = new DASHController(this.video, this.ctx);
1696
+ /**
1697
+ * The `dash.js` constructor.
1698
+ */
1699
+ get ctor() {
1700
+ return this.#ctor;
1701
+ }
1702
+ /**
1703
+ * The current `dash.js` instance.
1704
+ */
1705
+ get instance() {
1706
+ return this.#controller.instance;
1707
+ }
1708
+ /**
1709
+ * Whether `dash.js` is supported in this environment.
1710
+ */
1711
+ static supported = isDASHSupported();
1712
+ get type() {
1713
+ return "dash";
1714
+ }
1715
+ get canLiveSync() {
1716
+ return true;
1717
+ }
1718
+ #library = `${JS_DELIVR_CDN}/npm/dashjs@4.7.4/dist/dash.all.min.js`;
1719
+ /**
1720
+ * The `dash.js` configuration object.
1721
+ *
1722
+ * @see {@link https://cdn.dashjs.org/latest/jsdoc/module-Settings.html}
1723
+ */
1724
+ get config() {
1725
+ return this.#controller.config;
1726
+ }
1727
+ set config(config) {
1728
+ this.#controller.config = config;
1729
+ }
1730
+ /**
1731
+ * The `dash.js` constructor (supports dynamic imports) or a URL of where it can be found.
1732
+ *
1733
+ * @defaultValue `https://cdn.jsdelivr.net/npm/dashjs@4.7.4/dist/dash.all.min.js`
1734
+ */
1735
+ get library() {
1736
+ return this.#library;
1737
+ }
1738
+ set library(library) {
1739
+ this.#library = library;
1740
+ }
1741
+ preconnect() {
1742
+ if (!isString(this.#library)) return;
1743
+ preconnect(this.#library);
1744
+ }
1745
+ setup() {
1746
+ super.setup();
1747
+ new DASHLibLoader(this.#library, this.ctx, (ctor) => {
1748
+ this.#ctor = ctor;
1749
+ this.#controller.setup(ctor);
1750
+ this.ctx.notify("provider-setup", this);
1751
+ const src = peek(this.ctx.$state.source);
1752
+ if (src) this.loadSource(src);
1753
+ });
1754
+ }
1755
+ async loadSource(src, preload) {
1756
+ if (!isString(src.src)) {
1757
+ this.removeSource();
1758
+ return;
1759
+ }
1760
+ this.media.preload = preload || "";
1761
+ this.appendSource(src, "application/x-mpegurl");
1762
+ this.#controller.loadSource(src);
1763
+ this.currentSrc = src;
1764
+ }
1765
+ /**
1766
+ * The given callback is invoked when a new `dash.js` instance is created and right before it's
1767
+ * attached to media.
1768
+ */
1769
+ onInstance(callback) {
1770
+ const instance = this.#controller.instance;
1771
+ if (instance) callback(instance);
1772
+ return this.#controller.onInstance(callback);
1773
+ }
1774
+ destroy() {
1775
+ this.#controller.destroy();
1776
+ }
1777
+ };
1778
+ function isRemotionProvider(provider) {
1779
+ return provider?.$$PROVIDER_TYPE === "REMOTION";
1780
+ }
1781
+ function isRemotionSrc(src) {
1782
+ return src?.type === "video/remotion";
1783
+ }
1784
+
1785
+ export {
1786
+ IS_SERVER,
1787
+ IS_IOS,
1788
+ IS_IPHONE,
1789
+ IS_CHROME,
1790
+ canOrientScreen,
1791
+ canRotateScreen,
1792
+ canPlayAudioType,
1793
+ canPlayVideoType,
1794
+ canPlayHLSNatively,
1795
+ canUsePictureInPicture,
1796
+ canUseVideoPresentation,
1797
+ canChangeVolume,
1798
+ isHLSSupported,
1799
+ isDASHSupported,
1800
+ TimeRange,
1801
+ getTimeRangesStart,
1802
+ getTimeRangesEnd,
1803
+ normalizeTimeIntervals,
1804
+ updateTimeIntervals,
1805
+ AUDIO_EXTENSIONS,
1806
+ AUDIO_TYPES,
1807
+ VIDEO_EXTENSIONS,
1808
+ VIDEO_TYPES,
1809
+ HLS_VIDEO_EXTENSIONS,
1810
+ DASH_VIDEO_EXTENSIONS,
1811
+ HLS_VIDEO_TYPES,
1812
+ DASH_VIDEO_TYPES,
1813
+ isAudioSrc,
1814
+ isVideoSrc,
1815
+ isHLSSrc,
1816
+ isDASHSrc,
1817
+ canGoogleCastSrc,
1818
+ isMediaStream,
1819
+ appendParamsToURL,
1820
+ preconnect,
1821
+ loadScript,
1822
+ getRequestCredentials,
1823
+ getDownloadFile,
1824
+ TextTrackSymbol,
1825
+ findActiveCue,
1826
+ isCueActive,
1827
+ watchActiveTextTrack,
1828
+ watchCueTextChange,
1829
+ TextTrack,
1830
+ isTrackCaptionKind,
1831
+ parseJSONCaptionsFile,
1832
+ ListSymbol,
1833
+ round,
1834
+ getNumberOfDecimalPlaces,
1835
+ clampNumber,
1836
+ QualitySymbol,
1837
+ RAFLoop,
1838
+ HTMLMediaProvider,
1839
+ HTMLAirPlayAdapter,
1840
+ provider_exports$1,
1841
+ VideoProvider,
1842
+ coerceToError,
1843
+ assert,
1844
+ provider_exports,
1845
+ isRemotionProvider,
1846
+ isRemotionSrc
1847
+ };
1848
+ //# sourceMappingURL=chunk-2UBPQBQI.js.map