rx-player 4.0.0-beta.0 → 4.0.0-beta.2

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 (297) hide show
  1. package/.eslintrc.js +8 -0
  2. package/CHANGELOG.md +93 -0
  3. package/CONTRIBUTING.md +48 -168
  4. package/FILES.md +40 -92
  5. package/VERSION +1 -1
  6. package/dist/_esm5.processed/compat/browser_detection.d.ts +25 -12
  7. package/dist/_esm5.processed/compat/browser_detection.js +85 -38
  8. package/dist/_esm5.processed/compat/can_reuse_media_keys.js +2 -2
  9. package/dist/_esm5.processed/compat/eme/close_session.js +2 -2
  10. package/dist/_esm5.processed/compat/eme/load_session.js +1 -1
  11. package/dist/_esm5.processed/compat/event_listeners.js +1 -1
  12. package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.d.ts +21 -0
  13. package/dist/_esm5.processed/compat/has_issues_with_high_media_source_duration.js +26 -0
  14. package/dist/_esm5.processed/config.d.ts +4 -0
  15. package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +9 -6
  16. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.d.ts +18 -1
  17. package/dist/_esm5.processed/core/adaptive/buffer_based_chooser.js +106 -25
  18. package/dist/_esm5.processed/core/adaptive/guess_based_chooser.js +6 -6
  19. package/dist/_esm5.processed/core/adaptive/network_analyzer.js +8 -5
  20. package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.d.ts +19 -1
  21. package/dist/_esm5.processed/core/adaptive/utils/representation_score_calculator.js +1 -1
  22. package/dist/_esm5.processed/core/api/debug/buffer_graph.d.ts +28 -0
  23. package/dist/_esm5.processed/core/api/debug/buffer_graph.js +175 -0
  24. package/dist/_esm5.processed/core/api/debug/buffer_size_graph.d.ts +10 -0
  25. package/dist/_esm5.processed/core/api/debug/buffer_size_graph.js +104 -0
  26. package/dist/_esm5.processed/core/api/debug/constants.d.ts +2 -0
  27. package/dist/_esm5.processed/core/api/debug/constants.js +2 -0
  28. package/dist/_esm5.processed/core/api/debug/index.d.ts +2 -0
  29. package/dist/_esm5.processed/core/api/debug/index.js +2 -0
  30. package/dist/_esm5.processed/core/api/debug/modules/general_info.d.ts +3 -0
  31. package/dist/_esm5.processed/core/api/debug/modules/general_info.js +180 -0
  32. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.d.ts +4 -0
  33. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_content.js +121 -0
  34. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.d.ts +3 -0
  35. package/dist/_esm5.processed/core/api/debug/modules/segment_buffer_size.js +35 -0
  36. package/dist/_esm5.processed/core/api/debug/render.d.ts +3 -0
  37. package/dist/_esm5.processed/core/api/debug/render.js +32 -0
  38. package/dist/_esm5.processed/core/api/debug/utils.d.ts +39 -0
  39. package/dist/_esm5.processed/core/api/debug/utils.js +57 -0
  40. package/dist/_esm5.processed/core/api/playback_observer.js +4 -2
  41. package/dist/_esm5.processed/core/api/public_api.d.ts +60 -3
  42. package/dist/_esm5.processed/core/api/public_api.js +280 -60
  43. package/dist/_esm5.processed/core/api/track_management/media_element_tracks_store.js +10 -1
  44. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.d.ts +13 -1
  45. package/dist/_esm5.processed/core/api/track_management/track_dispatcher.js +30 -15
  46. package/dist/_esm5.processed/core/api/track_management/tracks_store.d.ts +3 -1
  47. package/dist/_esm5.processed/core/api/track_management/tracks_store.js +67 -152
  48. package/dist/_esm5.processed/core/api/utils.d.ts +10 -0
  49. package/dist/_esm5.processed/core/api/utils.js +23 -3
  50. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.d.ts +27 -8
  51. package/dist/_esm5.processed/core/decrypt/__tests__/__global__/utils.js +28 -7
  52. package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +1 -1
  53. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +1 -1
  54. package/dist/_esm5.processed/core/decrypt/find_key_system.js +29 -6
  55. package/dist/_esm5.processed/core/decrypt/session_events_listener.js +42 -32
  56. package/dist/_esm5.processed/core/decrypt/utils/check_key_statuses.js +4 -0
  57. package/dist/_esm5.processed/core/decrypt/utils/clean_old_loaded_sessions.js +2 -0
  58. package/dist/_esm5.processed/core/decrypt/utils/loaded_sessions_store.js +5 -1
  59. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.d.ts +17 -8
  60. package/dist/_esm5.processed/core/fetchers/cdn_prioritizer.js +10 -6
  61. package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +5 -4
  62. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.d.ts +22 -5
  63. package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +37 -21
  64. package/dist/_esm5.processed/core/fetchers/segment/task_prioritizer.js +21 -23
  65. package/dist/_esm5.processed/core/fetchers/utils/schedule_request.js +17 -7
  66. package/dist/_esm5.processed/core/init/directfile_content_initializer.js +2 -2
  67. package/dist/_esm5.processed/core/init/media_source_content_initializer.js +74 -41
  68. package/dist/_esm5.processed/core/init/types.d.ts +9 -1
  69. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.d.ts +28 -1
  70. package/dist/_esm5.processed/core/init/utils/content_time_boundaries_observer.js +24 -11
  71. package/dist/_esm5.processed/core/init/utils/create_media_source.js +3 -12
  72. package/dist/_esm5.processed/core/init/utils/end_of_stream.js +6 -3
  73. package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +2 -1
  74. package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +9 -5
  75. package/dist/_esm5.processed/core/init/utils/initialize_content_decryption.js +2 -1
  76. package/dist/_esm5.processed/core/init/utils/media_source_duration_updater.d.ts +58 -0
  77. package/dist/_esm5.processed/core/init/utils/{media_duration_updater.js → media_source_duration_updater.js} +87 -86
  78. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.d.ts +36 -2
  79. package/dist/_esm5.processed/core/init/utils/rebuffering_controller.js +83 -3
  80. package/dist/_esm5.processed/core/init/utils/stream_events_emitter/stream_events_emitter.js +6 -4
  81. package/dist/_esm5.processed/core/init/utils/throw_on_media_error.js +1 -1
  82. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.d.ts +18 -7
  83. package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +38 -50
  84. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.d.ts +8 -0
  85. package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +16 -2
  86. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.d.ts +8 -0
  87. package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +12 -0
  88. package/dist/_esm5.processed/core/segment_buffers/implementations/types.d.ts +11 -4
  89. package/dist/_esm5.processed/core/segment_buffers/index.d.ts +2 -2
  90. package/dist/_esm5.processed/core/segment_buffers/segment_buffers_store.js +13 -9
  91. package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +30 -16
  92. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.d.ts +47 -0
  93. package/dist/_esm5.processed/core/stream/adaptation/utils/create_representation_estimator.js +70 -0
  94. package/dist/_esm5.processed/core/stream/orchestrator/stream_orchestrator.js +41 -20
  95. package/dist/_esm5.processed/core/stream/period/period_stream.js +12 -11
  96. package/dist/_esm5.processed/core/stream/representation/representation_stream.js +37 -28
  97. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.d.ts +4 -2
  98. package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +3 -3
  99. package/dist/_esm5.processed/core/stream/representation/utils/downloading_queue.js +16 -6
  100. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.d.ts +3 -2
  101. package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +8 -8
  102. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.d.ts +2 -2
  103. package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +2 -3
  104. package/dist/_esm5.processed/core/stream/utils/create_reload_request.js +1 -1
  105. package/dist/_esm5.processed/default_config.d.ts +41 -0
  106. package/dist/_esm5.processed/default_config.js +46 -2
  107. package/dist/_esm5.processed/errors/index.d.ts +2 -2
  108. package/dist/_esm5.processed/errors/media_error.d.ts +23 -1
  109. package/dist/_esm5.processed/errors/media_error.js +18 -5
  110. package/dist/_esm5.processed/experimental/features/debug_element.d.ts +8 -0
  111. package/dist/_esm5.processed/experimental/features/debug_element.js +10 -0
  112. package/dist/_esm5.processed/experimental/features/index.d.ts +1 -0
  113. package/dist/_esm5.processed/experimental/features/index.js +1 -0
  114. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.d.ts +1 -1
  115. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/load_and_push_segment.js +8 -7
  116. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.js +7 -4
  117. package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +24 -12
  118. package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/index.js +0 -2
  119. package/dist/_esm5.processed/features/features_object.js +1 -0
  120. package/dist/_esm5.processed/features/initialize_features.js +13 -10
  121. package/dist/_esm5.processed/features/types.d.ts +3 -0
  122. package/dist/_esm5.processed/manifest/adaptation.d.ts +21 -2
  123. package/dist/_esm5.processed/manifest/adaptation.js +80 -1
  124. package/dist/_esm5.processed/manifest/manifest.js +2 -0
  125. package/dist/_esm5.processed/manifest/period.js +2 -2
  126. package/dist/_esm5.processed/manifest/representation.d.ts +33 -2
  127. package/dist/_esm5.processed/manifest/representation.js +32 -4
  128. package/dist/_esm5.processed/manifest/utils.js +1 -3
  129. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_adaptation_sets.js +105 -137
  130. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +25 -5
  131. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.d.ts +1 -1
  132. package/dist/_esm5.processed/parsers/manifest/dash/js-parser/parse_from_document.js +1 -1
  133. package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.js +1 -0
  134. package/dist/_esm5.processed/public_types.d.ts +13 -3
  135. package/dist/_esm5.processed/tools/TextTrackRenderer/text_track_renderer.js +1 -1
  136. package/dist/_esm5.processed/transports/dash/add_segment_integrity_checks_to_loader.js +15 -11
  137. package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +2 -2
  138. package/dist/_esm5.processed/transports/dash/manifest_parser.js +1 -1
  139. package/dist/_esm5.processed/transports/dash/segment_loader.js +4 -4
  140. package/dist/_esm5.processed/transports/local/segment_loader.js +13 -26
  141. package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.d.ts +4 -6
  142. package/dist/_esm5.processed/transports/smooth/isobmff/create_boxes.js +4 -6
  143. package/dist/_esm5.processed/transports/smooth/segment_loader.js +4 -4
  144. package/dist/_esm5.processed/transports/utils/call_custom_manifest_loader.js +3 -3
  145. package/dist/_esm5.processed/utils/cancellable_sleep.js +4 -10
  146. package/dist/_esm5.processed/utils/create_cancellable_promise.d.ts +26 -0
  147. package/dist/_esm5.processed/utils/create_cancellable_promise.js +52 -0
  148. package/dist/_esm5.processed/utils/is_null_or_undefined.d.ts +1 -1
  149. package/dist/_esm5.processed/utils/is_null_or_undefined.js +1 -1
  150. package/dist/_esm5.processed/utils/reference.js +6 -0
  151. package/dist/_esm5.processed/utils/request/xhr.js +1 -1
  152. package/dist/_esm5.processed/utils/task_canceller.d.ts +34 -15
  153. package/dist/_esm5.processed/utils/task_canceller.js +55 -22
  154. package/dist/mpd-parser.wasm +0 -0
  155. package/dist/rx-player.js +5424 -4712
  156. package/dist/rx-player.min.js +1 -1
  157. package/jest.config.js +1 -5
  158. package/package.json +44 -40
  159. package/scripts/build/constants.d.ts +1 -0
  160. package/scripts/build/generate_build.js +1 -1
  161. package/scripts/fast_demo_build.js +40 -40
  162. package/scripts/generate_full_demo.js +1 -1
  163. package/sonar-project.properties +1 -1
  164. package/src/compat/browser_detection.ts +105 -52
  165. package/src/compat/can_reuse_media_keys.ts +5 -2
  166. package/src/compat/eme/close_session.ts +2 -2
  167. package/src/compat/eme/load_session.ts +1 -1
  168. package/src/compat/event_listeners.ts +1 -1
  169. package/src/compat/has_issues_with_high_media_source_duration.ts +27 -0
  170. package/src/core/adaptive/__tests__/buffer_based_chooser.test.ts +147 -48
  171. package/src/core/adaptive/adaptive_representation_selector.ts +11 -6
  172. package/src/core/adaptive/buffer_based_chooser.ts +144 -26
  173. package/src/core/adaptive/guess_based_chooser.ts +9 -8
  174. package/src/core/adaptive/network_analyzer.ts +9 -4
  175. package/src/core/adaptive/utils/representation_score_calculator.ts +22 -2
  176. package/src/core/api/debug/buffer_graph.ts +247 -0
  177. package/src/core/api/debug/buffer_size_graph.ts +130 -0
  178. package/src/core/api/debug/constants.ts +2 -0
  179. package/src/core/api/debug/index.ts +3 -0
  180. package/src/core/api/debug/modules/general_info.ts +184 -0
  181. package/src/core/api/debug/modules/segment_buffer_content.ts +155 -0
  182. package/src/core/api/debug/modules/segment_buffer_size.ts +48 -0
  183. package/src/core/api/debug/render.ts +40 -0
  184. package/src/core/api/debug/utils.ts +103 -0
  185. package/src/core/api/playback_observer.ts +5 -2
  186. package/src/core/api/public_api.ts +334 -73
  187. package/src/core/api/track_management/media_element_tracks_store.ts +17 -8
  188. package/src/core/api/track_management/track_dispatcher.ts +37 -14
  189. package/src/core/api/track_management/tracks_store.ts +77 -167
  190. package/src/core/api/utils.ts +29 -3
  191. package/src/core/decrypt/__tests__/__global__/utils.ts +61 -40
  192. package/src/core/decrypt/attach_media_keys.ts +1 -1
  193. package/src/core/decrypt/content_decryptor.ts +1 -1
  194. package/src/core/decrypt/find_key_system.ts +25 -11
  195. package/src/core/decrypt/session_events_listener.ts +45 -39
  196. package/src/core/decrypt/utils/check_key_statuses.ts +6 -0
  197. package/src/core/decrypt/utils/clean_old_loaded_sessions.ts +2 -1
  198. package/src/core/decrypt/utils/loaded_sessions_store.ts +8 -1
  199. package/src/core/fetchers/cdn_prioritizer.ts +18 -9
  200. package/src/core/fetchers/manifest/manifest_fetcher.ts +5 -4
  201. package/src/core/fetchers/segment/segment_fetcher.ts +36 -14
  202. package/src/core/fetchers/segment/task_prioritizer.ts +25 -30
  203. package/src/core/fetchers/utils/schedule_request.ts +18 -7
  204. package/src/core/init/directfile_content_initializer.ts +2 -1
  205. package/src/core/init/media_source_content_initializer.ts +89 -50
  206. package/src/core/init/types.ts +9 -1
  207. package/src/core/init/utils/content_time_boundaries_observer.ts +48 -12
  208. package/src/core/init/utils/create_media_source.ts +4 -16
  209. package/src/core/init/utils/end_of_stream.ts +6 -3
  210. package/src/core/init/utils/get_loaded_reference.ts +2 -1
  211. package/src/core/init/utils/initial_seek_and_play.ts +9 -5
  212. package/src/core/init/utils/initialize_content_decryption.ts +2 -1
  213. package/src/core/init/utils/{media_duration_updater.ts → media_source_duration_updater.ts} +103 -110
  214. package/src/core/init/utils/rebuffering_controller.ts +115 -4
  215. package/src/core/init/utils/stream_events_emitter/stream_events_emitter.ts +6 -4
  216. package/src/core/init/utils/throw_on_media_error.ts +1 -1
  217. package/src/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.ts +63 -66
  218. package/src/core/segment_buffers/implementations/text/html/html_text_segment_buffer.ts +20 -2
  219. package/src/core/segment_buffers/implementations/text/native/native_text_segment_buffer.ts +16 -0
  220. package/src/core/segment_buffers/implementations/types.ts +16 -4
  221. package/src/core/segment_buffers/index.ts +2 -0
  222. package/src/core/segment_buffers/segment_buffers_store.ts +16 -13
  223. package/src/core/stream/adaptation/adaptation_stream.ts +33 -19
  224. package/src/core/stream/adaptation/utils/create_representation_estimator.ts +114 -0
  225. package/src/core/stream/orchestrator/stream_orchestrator.ts +42 -20
  226. package/src/core/stream/period/period_stream.ts +13 -11
  227. package/src/core/stream/representation/representation_stream.ts +49 -37
  228. package/src/core/stream/representation/utils/append_segment_to_buffer.ts +9 -4
  229. package/src/core/stream/representation/utils/downloading_queue.ts +16 -4
  230. package/src/core/stream/representation/utils/push_init_segment.ts +11 -6
  231. package/src/core/stream/representation/utils/push_media_segment.ts +3 -3
  232. package/src/core/stream/utils/create_reload_request.ts +1 -1
  233. package/src/default_config.ts +59 -11
  234. package/src/errors/__tests__/media_error.test.ts +6 -6
  235. package/src/errors/index.ts +4 -1
  236. package/src/errors/media_error.ts +67 -1
  237. package/src/experimental/features/__tests__/debug_element.test.ts +26 -0
  238. package/src/experimental/features/debug_element.ts +13 -0
  239. package/src/experimental/features/index.ts +1 -0
  240. package/src/experimental/tools/VideoThumbnailLoader/load_and_push_segment.ts +10 -7
  241. package/src/experimental/tools/VideoThumbnailLoader/prepare_source_buffer.ts +7 -4
  242. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +25 -10
  243. package/src/experimental/tools/mediaCapabilitiesProber/index.ts +0 -4
  244. package/src/features/__tests__/initialize_features.test.ts +11 -0
  245. package/src/features/features_object.ts +1 -0
  246. package/src/features/initialize_features.ts +15 -10
  247. package/src/features/types.ts +9 -0
  248. package/src/manifest/__tests__/manifest.test.ts +7 -7
  249. package/src/manifest/__tests__/period.test.ts +90 -45
  250. package/src/manifest/adaptation.ts +96 -1
  251. package/src/manifest/manifest.ts +4 -0
  252. package/src/manifest/period.ts +4 -2
  253. package/src/manifest/representation.ts +77 -5
  254. package/src/manifest/utils.ts +1 -3
  255. package/src/parsers/manifest/dash/common/parse_adaptation_sets.ts +116 -151
  256. package/src/parsers/manifest/dash/common/parse_representations.ts +21 -4
  257. package/src/parsers/manifest/dash/js-parser/parse_from_document.ts +1 -1
  258. package/src/parsers/manifest/dash/wasm-parser/ts/dash-wasm-parser.ts +1 -0
  259. package/src/parsers/texttracks/ttml/parse_ttml.ts +1 -1
  260. package/src/public_types.ts +16 -1
  261. package/src/tools/TextTrackRenderer/text_track_renderer.ts +1 -1
  262. package/src/transports/dash/add_segment_integrity_checks_to_loader.ts +31 -22
  263. package/src/transports/dash/low_latency_segment_loader.ts +2 -2
  264. package/src/transports/dash/manifest_parser.ts +1 -1
  265. package/src/transports/dash/segment_loader.ts +4 -4
  266. package/src/transports/local/segment_loader.ts +14 -30
  267. package/src/transports/smooth/isobmff/create_boxes.ts +4 -6
  268. package/src/transports/smooth/segment_loader.ts +4 -4
  269. package/src/transports/utils/call_custom_manifest_loader.ts +3 -3
  270. package/src/typings/globals.d.ts +21 -19
  271. package/src/utils/cancellable_sleep.ts +5 -14
  272. package/src/utils/create_cancellable_promise.ts +69 -0
  273. package/src/utils/is_null_or_undefined.ts +1 -1
  274. package/src/utils/reference.ts +6 -0
  275. package/src/utils/request/xhr.ts +1 -1
  276. package/src/utils/task_canceller.ts +63 -34
  277. package/tsconfig.json +1 -1
  278. package/tsconfig.modules.json +1 -1
  279. package/dist/_esm5.processed/core/init/utils/media_duration_updater.d.ts +0 -56
  280. package/locked_reps.js +0 -46
  281. package/scripts/doc-generator/construct_table_of_contents.js +0 -76
  282. package/scripts/doc-generator/convert_MD_to_HMTL.js +0 -26
  283. package/scripts/doc-generator/create_documentation.js +0 -331
  284. package/scripts/doc-generator/create_documentation_page.js +0 -209
  285. package/scripts/doc-generator/create_page.js +0 -210
  286. package/scripts/doc-generator/generate_header_html.js +0 -147
  287. package/scripts/doc-generator/generate_page_html.js +0 -115
  288. package/scripts/doc-generator/generate_page_list_html.js +0 -92
  289. package/scripts/doc-generator/generate_sidebar_html.js +0 -85
  290. package/scripts/doc-generator/get_search_data_for_content.js +0 -137
  291. package/scripts/doc-generator/index.js +0 -34
  292. package/scripts/doc-generator/parse_doc_configs.js +0 -327
  293. package/scripts/doc-generator/scripts/lunr.js +0 -10
  294. package/scripts/doc-generator/scripts/script.js +0 -451
  295. package/scripts/doc-generator/styles/code.css +0 -99
  296. package/scripts/doc-generator/styles/style.css +0 -835
  297. package/scripts/doc-generator/utils.js +0 -74
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see rx-player.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RxPlayer=t():e.RxPlayer=t()}(self,(function(){return function(){var e={3774:function(e,t,n){"use strict";n.d(t,{J:function(){return a},c:function(){return o}});var r=n(1946),i=n(2203).Z?void 0:window,a=void 0===i?void 0:(0,r.Z)(i.MediaSource)?(0,r.Z)(i.MozMediaSource)?(0,r.Z)(i.WebKitMediaSource)?i.MSMediaSource:i.WebKitMediaSource:i.MozMediaSource:i.MediaSource,o={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4}},3666:function(e,t,n){"use strict";n.d(t,{$u:function(){return f},SB:function(){return p},YM:function(){return s},fq:function(){return o},kD:function(){return u},op:function(){return d},vS:function(){return v},vU:function(){return l},yS:function(){return c}});var r,i,a=n(2203),o=!a.Z&&void 0!==window.MSInputMethodContext&&void 0!==document.documentMode,s=!a.Z&&("Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&/(Trident|Edge)\//.test(navigator.userAgent)),u=!a.Z&&-1!==navigator.userAgent.toLowerCase().indexOf("edg/"),l=!a.Z&&-1!==navigator.userAgent.toLowerCase().indexOf("firefox"),d=!a.Z&&/SamsungBrowser/.test(navigator.userAgent),c=!a.Z&&/Tizen/.test(navigator.userAgent),f=!a.Z&&navigator.userAgent.indexOf("Web0S")>=0,v=(f&&(/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent)),f&&(/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)),!a.Z&&(Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>=0||"[object SafariRemoteNotification]"===(null===(i=null===(r=window.safari)||void 0===r?void 0:r.pushNotification)||void 0===i?void 0:i.toString()))),p=!a.Z&&"string"==typeof navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},5767:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e){var t=e.textTracks;if(!(0,i.Z)(t)){for(var n=0;n<t.length;n++)t[n].mode="disabled";if(e.hasChildNodes())for(var a=e.childNodes,o=a.length-1;o>=0;o--)if("track"===a[o].nodeName)try{e.removeChild(a[o])}catch(e){r.Z.warn("Compat: Could not remove text track child from element.")}}e.src="",e.removeAttribute("src")}},6139:function(e,t,n){"use strict";n.d(t,{N:function(){return P},Y:function(){return M}});var r,i=n(3714),a=n(811),o=n(3666),s=n(2203),u=n(5059),l=n(3144),d=function(){function e(e,t,n){this._keyType=e,this._mediaKeys=t,this._configuration=n}var t=e.prototype;return t.createMediaKeys=function(){var e=this;return new Promise((function(t){return t(e._mediaKeys)}))},t.getConfiguration=function(){return this._configuration},(0,l.Z)(e,[{key:"keySystem",get:function(){return this._keyType}}]),e}();if(!s.Z){var c=window.MSMediaKeys;void 0!==c&&void 0!==c.prototype&&"function"==typeof c.isTypeSupported&&"function"==typeof c.prototype.createSession&&(r=c)}var f,v=n(4578),p=n(1959),h=n(288),m=n(3038),g=function(e){function t(t){var n;return(n=e.call(this)||this).expiration=NaN,n.keyStatuses=new Map,n._mk=t,n._sessionClosingCanceller=new h.ZP,n.closed=new Promise((function(e){n._sessionClosingCanceller.signal.register((function(){return e()}))})),n.update=function(e){return new Promise((function(t,r){if(void 0===n._ss)return r("MediaKeySession not set.");try{t(n._ss.update(e,""))}catch(e){r(e)}}))},n}(0,v.Z)(t,e);var n=t.prototype;return n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r=t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer);n._ss=n._mk.createSession("video/mp4",r),m.RV(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"message",e)}),n._sessionClosingCanceller.signal),m.kk(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyadded",e)}),n._sessionClosingCanceller.signal),m.Dl(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyerror",e)}),n._sessionClosingCanceller.signal),e()}))},n.close=function(){var e=this;return new Promise((function(t){null!=e._ss&&(e._ss.close(),e._ss=void 0),e._sessionClosingCanceller.cancel(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},(0,l.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._ss)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(p.Z),y=function(){function e(e){if(void 0===r)throw new Error("No MSMediaKeys API.");this._mediaKeys=new r(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0!==this._videoElement.msSetMediaKeys)return this._videoElement.msSetMediaKeys(this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new g(this._mediaKeys)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();if(!s.Z){var _=window.MozMediaKeys;void 0!==_&&void 0!==_.prototype&&"function"==typeof _.isTypeSupported&&"function"==typeof _.prototype.createSession&&(f=_)}var b=n(9689),S=n(8894),E=n(3635);function T(e){return"function"==typeof e.webkitGenerateKeyRequest}var w=function(e){function t(t,n){var r;(r=e.call(this)||this)._vid=t,r._key=n,r.sessionId="",r._closeSession=S.Z,r.keyStatuses=new Map,r.expiration=NaN;var i=function(e){r.trigger(e.type,e)};return r.closed=new Promise((function(e){r._closeSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.removeEventListener(e,i),t.removeEventListener("webkit"+e,i)})),e()}})),["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.addEventListener(e,i),t.addEventListener("webkit"+e,i)})),r}(0,v.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){try{if(t._key.indexOf("clearkey")>=0){var i=e instanceof ArrayBuffer?new Uint8Array(e):e,a=JSON.parse((0,E.uR)(i)),o=(0,b.K)(a.keys[0].k),s=(0,b.K)(a.keys[0].kid);n(t._vid.webkitAddKey(t._key,o,s,""))}else n(t._vid.webkitAddKey(t._key,e,null,""))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){n._vid.webkitGenerateKeyRequest(n._key,t),e()}))},n.close=function(){var e=this;return new Promise((function(t){e._closeSession(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},t}(p.Z),k=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){if(!T(e))throw new Error("Video not attached to the MediaKeys");this._videoElement=e},t.createSession=function(){if(null==this._videoElement)throw new Error("Video not attached to the MediaKeys");return new w(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var A=n(6968);var I=n(158);function R(e,t){var n=e;if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");return n.webkitSetMediaKeys(t)}var Z=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._serverCertificate=r,i._videoElement=t,i._keyType=n,i._unbindSession=S.Z,i._closeSession=S.Z,i.closed=new Promise((function(e){i._closeSession=e})),i.keyStatuses=new Map,i.expiration=NaN,i}(0,v.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){if(void 0===t._nativeSession||void 0===t._nativeSession.update||"function"!=typeof t._nativeSession.update)return r("Unavailable WebKit key session.");try{var i;i=e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e.buffer),n(t._nativeSession.update(i))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r,i,a,o=n._videoElement;if(void 0===(null===(r=o.webkitKeys)||void 0===r?void 0:r.createSession))throw new Error("No WebKitMediaKeys API.");if("com.apple.fps.1_0"===(a=n._keyType)||"com.apple.fps.2_0"===a){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=function(e,t){var n=e instanceof Uint8Array?e:new Uint8Array(e),r=t instanceof Uint8Array?t:new Uint8Array(t);if((0,A.dN)(n,0)+4!==n.length)throw new Error("Unsupported WebKit initData.");var i=(0,E.wV)(n),a=i.indexOf("skd://"),o=a>-1?i.substring(a+6):i,s=(0,E.TZ)(o),u=0,l=new Uint8Array(n.byteLength+4+s.byteLength+4+r.byteLength);return l.set(n),u+=n.length,l.set((0,A.O_)(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set((0,A.O_)(r.byteLength),u),u+=4,l.set(r,u),l}(t,n._serverCertificate)}else i=t;var s=o.webkitKeys.createSession("video/mp4",i);if(null==s)throw new Error("Impossible to get the key sessions");n._listenEvent(s),n._nativeSession=s,e()}))},n.close=function(){var e=this;return new Promise((function(t,n){e._unbindSession(),e._closeSession(),void 0!==e._nativeSession?(e._nativeSession.close(),t()):n("No session to close.")}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},n._listenEvent=function(e){var t=this;this._unbindSession();var n=function(e){t.trigger(e.type,e)};["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.addEventListener(t,n),e.addEventListener("webkit"+t,n)})),this._unbindSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.removeEventListener(t,n),e.removeEventListener("webkit"+t,n)}))}},(0,l.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._nativeSession)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(p.Z),x=function(){function e(e){if(void 0===I.t)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new I.t(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0===this._videoElement)throw new Error("Video not attached to the MediaKeys");return R(this._videoElement,this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new Z(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();var P=null,M=function(e,t){var n=e;return"function"==typeof n.setMediaKeys?n.setMediaKeys(t):"function"==typeof n.webkitSetMediaKeys?n.webkitSetMediaKeys(t):"function"==typeof n.mozSetMediaKeys?n.mozSetMediaKeys(t):"function"==typeof n.msSetMediaKeys&&null!==t?n.msSetMediaKeys(t):void 0};if(s.Z||null!=navigator.requestMediaKeySystemAccess&&!(0,u.Z)())P=function(){var e;return(e=navigator).requestMediaKeySystemAccess.apply(e,arguments)};else{var C,D;if(T(HTMLVideoElement.prototype)){var N={isTypeSupported:function(e){var t=document.querySelector("video");return null==t&&(t=document.createElement("video")),null!=t&&"function"==typeof t.canPlayType&&!!t.canPlayType("video/mp4",e)},createCustomMediaKeys:function(e){return new k(e)},setMediaKeys:function(e,t){if(null!==t){if(!(t instanceof k))throw new Error("Custom setMediaKeys is supposed to be called with old webkit custom MediaKeys.");return t._setVideo(e)}}};C=N.isTypeSupported,D=N.createCustomMediaKeys,M=N.setMediaKeys}else if(void 0!==I.t){var O=function(){if(void 0===I.t)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:I.t.isTypeSupported,createCustomMediaKeys:function(e){return new x(e)},setMediaKeys:function(e,t){if(null===t)return R(e,t);if(!(t instanceof x))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}();C=O.isTypeSupported,D=O.createCustomMediaKeys,M=O.setMediaKeys}else if(o.fq&&void 0!==r){var L={isTypeSupported:function(e,t){if(void 0===r)throw new Error("No MSMediaKeys API.");return void 0!==t?r.isTypeSupported(e,t):r.isTypeSupported(e)},createCustomMediaKeys:function(e){return new y(e)},setMediaKeys:function(e,t){if(null!==t){if(!(t instanceof y))throw new Error("Custom setMediaKeys is supposed to be called with IE11 custom MediaKeys.");return t._setVideo(e)}}};C=L.isTypeSupported,D=L.createCustomMediaKeys,M=L.setMediaKeys}else if(void 0!==f){var U={isTypeSupported:function(e,t){if(void 0===f)throw new Error("No MozMediaKeys API.");return void 0!==t?f.isTypeSupported(e,t):f.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===f)throw new Error("No MozMediaKeys API.");return new f(e)},setMediaKeys:function(e,t){var n=e;if(void 0===n.mozSetMediaKeys||"function"!=typeof n.mozSetMediaKeys)throw new Error("Can't set video on MozMediaKeys.");return n.mozSetMediaKeys(t)}};C=U.isTypeSupported,D=U.createCustomMediaKeys,M=U.setMediaKeys}else{var B=window.MediaKeys,F=function(){if(void 0===B)throw new i.Z("MEDIA_KEYS_NOT_SUPPORTED","No `MediaKeys` implementation found in the current browser.");if(void 0===B.isTypeSupported){throw new Error("This browser seems to be unable to play encrypted contents currently. Note: Some browsers do not allow decryption in some situations, like when not using HTTPS.")}};C=function(e){return F(),(0,a.Z)("function"==typeof B.isTypeSupported),B.isTypeSupported(e)},D=function(e){return F(),new B(e)}}P=function(e,t){if(!C(e))return Promise.reject(new Error("Unsupported key type"));for(var n=0;n<t.length;n++){var r=t[n],i=r.videoCapabilities,a=r.audioCapabilities,o=r.initDataTypes,s=r.distinctiveIdentifier,u=!0;if(u=(u=u&&(null==o||o.some((function(e){return"cenc"===e}))))&&"required"!==s){var l={initDataTypes:["cenc"],distinctiveIdentifier:"not-allowed",persistentState:"required",sessionTypes:["temporary","persistent-license"]};void 0!==i&&(l.videoCapabilities=i),void 0!==a&&(l.audioCapabilities=a);var c=D(e);return Promise.resolve(new d(e,c,l))}}return Promise.reject(new Error("Unsupported configuration"))}}},158:function(e,t,n){"use strict";var r;if(n.d(t,{t:function(){return r}}),!n(2203).Z){var i=window.WebKitMediaKeys;void 0!==i&&"function"==typeof i.isTypeSupported&&"function"==typeof i.prototype.createSession&&"function"==typeof HTMLMediaElement.prototype.webkitSetMediaKeys&&(r=i)}},3038:function(e,t,n){"use strict";n.d(t,{Dl:function(){return w},M4:function(){return R},N8:function(){return y},Q$:function(){return A},RV:function(){return E},Zl:function(){return S},bD:function(){return h},bQ:function(){return I},c9:function(){return p},it:function(){return v},k6:function(){return g},kk:function(){return T},qo:function(){return k},u_:function(){return m},w0:function(){return f},x6:function(){return b},y4:function(){return _}});var r=n(6872),i=n(6923),a=n(1946),o=n(8894),s=n(5095),u=n(5059),l=["","webkit","moz","ms"];function d(e,t){return t.filter((function(t){return function(e,t){var n=document.createElement(e.tagName),r="on"+t;return r in n||(n.setAttribute(r,"return;"),"function"==typeof n[r])}(e,t)}))[0]}function c(e,t){var n,r=function(e,t){return e.reduce((function(e,n){return e.concat((void 0===t?l:t).map((function(e){return e+n})))}),[])}(e,t);return function(e,t,a){if(!a.isCancelled){if(e instanceof HTMLElement){if(void 0===n&&(n=d(e,r)),!(0,i.Z)(n))return void 0;e.addEventListener(n,t),a.register((function(){void 0!==n&&e.removeEventListener(n,t)}))}r.forEach((function(n){var r=!1;"function"==typeof e.addEventListener?e.addEventListener(n,t):(r=!0,e["on"+n]=t),a.register((function(){"function"==typeof e.removeEventListener&&e.removeEventListener(n,t),r&&delete e["on"+n]}))}))}}}function f(e,t){var n=e;if(!0===n.webkitSupportsPresentationMode&&"function"==typeof n.webkitSetPresentationMode){var r="picture-in-picture"===n.webkitPresentationMode,i=(0,s.ZP)({isEnabled:r,pipWindow:null},t);return Z(n,"webkitpresentationmodechanged",(function(){var e="picture-in-picture"===n.webkitPresentationMode;i.setValue({isEnabled:e,pipWindow:null})}),t),i}var a=document.pictureInPictureElement===n,o=(0,s.ZP)({isEnabled:a,pipWindow:null},t);return Z(n,"enterpictureinpicture",(function(e){var t;o.setValue({isEnabled:!0,pipWindow:null!==(t=e.pictureInPictureWindow)&&void 0!==t?t:null})}),t),Z(n,"leavepictureinpicture",(function(){o.setValue({isEnabled:!1,pipWindow:null})}),t),o}function v(e,t){var n,a=function(e){var t,n=document;null!=n.hidden?t="":null!=n.mozHidden?t="moz":null!=n.msHidden?t="ms":null!=n.webkitHidden&&(t="webkit");var r=(0,i.Z)(t)?t+"Hidden":"hidden",a=(0,i.Z)(t)?t+"visibilitychange":"visibilitychange",o=document[r],u=(0,s.ZP)(!o,e);return Z(document,a,(function(){var e=!document[r];u.setValueIfChanged(e)}),e),u}(t),o=(0,s.ZP)(!0,t);return t.register((function(){clearTimeout(n),n=void 0})),a.onUpdate(u,{clearSignal:t}),e.onUpdate(u,{clearSignal:t}),u(),o;function u(){if(clearTimeout(n),n=void 0,e.getValue().isEnabled||a.getValue())o.setValueIfChanged(!0);else{var t=r.Z.getCurrent().INACTIVITY_DELAY;n=window.setTimeout((function(){o.setValueIfChanged(!1)}),t)}}}function p(e){var t=null==window.devicePixelRatio||0===window.devicePixelRatio?1:window.devicePixelRatio,n=(0,s.ZP)({width:window.screen.width,height:window.screen.height,pixelRatio:t},e),r=window.setInterval((function(){var e=n.getValue();e.width===screen.width&&e.height===screen.height&&e.pixelRatio===t||n.setValue({width:screen.width,height:screen.height,pixelRatio:t})}),2e4);return e.register((function(){clearInterval(r)})),n}function h(e,t,n){var r=null==window.devicePixelRatio||0===window.devicePixelRatio?1:window.devicePixelRatio,i=(0,s.ZP)({width:e.clientWidth,height:e.clientHeight,pixelRatio:r},n),u=o.Z;t.onUpdate(d,{clearSignal:n}),Z(window,"resize",d,n),Z(e,"enterpictureinpicture",d,n),Z(e,"leavepictureinpicture",d,n);var l=window.setInterval(d,2e4);return d(),n.register((function(){u(),clearInterval(l)})),i;function d(){u();var n=t.getValue(),s=n.pipWindow;if(n.isEnabled)if((0,a.Z)(s)){var l=i.getValue();void 0===l.width&&void 0===l.height&&l.pixelRatio===r||i.setValue({width:void 0,height:void 0,pixelRatio:r})}else{var d=function(){f()};s.addEventListener("resize",d),u=function(){s.removeEventListener("resize",d),u=o.Z},f()}else{var c=i.getValue();c.width===e.clientWidth&&c.height===e.clientHeight&&c.pixelRatio===r||i.setValue({width:e.clientWidth,height:e.clientHeight,pixelRatio:r})}function f(){var e=i.getValue();e.width===(null==s?void 0:s.width)&&e.height===(null==s?void 0:s.height)&&e.pixelRatio===r||i.setValue({width:null==s?void 0:s.width,height:null==s?void 0:s.height,pixelRatio:r})}}}c(["loadedmetadata"]),c(["timeupdate"]),c(["addtrack"]),c(["removetrack"]);var m=c(["sourceopen","webkitsourceopen"]),g=c(["sourceclose","webkitsourceclose"]),y=c(["sourceended","webkitsourceended"]),_=c(["update"]),b=c(["removesourcebuffer"]),S=c((0,u.Z)()?["needkey"]:["encrypted","needkey"]),E=c(["keymessage","message"]),T=c(["keyadded","ready"]),w=c(["keyerror","error"]),k=c(["keystatuseschange"]),A=c(["seeking"]),I=c(["seeked"]),R=c(["ended"]);function Z(e,t,n,r){e.addEventListener(t,n),r.register((function(){e.removeEventListener(t,n)}))}},2203:function(e,t){"use strict";var n="undefined"==typeof window;t.Z=n},1988:function(e,t,n){"use strict";function r(e){return"function"==typeof window.VTTCue&&e instanceof window.VTTCue}n.d(t,{Z:function(){return r}})},7253:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e,t,n){if(e>=t)return r.Z.warn("Compat: Invalid cue times: "+e+" - "+t),null;if((0,i.Z)(window.VTTCue)){if((0,i.Z)(window.TextTrackCue))throw new Error("VTT cues not supported in your target");return new TextTrackCue(e,t,n)}return new VTTCue(e,t,n)}},5059:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3666),i=n(158);function a(){return(r.vS||r.SB)&&void 0!==i.t}},1669:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(3666);function i(){return r.op}},6872:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r={DEFAULT_UNMUTED_VOLUME:.1,DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_ENABLE_FAST_SWITCHING:!0,DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:-.7,video:-.1,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUTO_PLAY:!1,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_BASE_BANDWIDTH:0,INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_VIDEO_RESOLUTION_LIMIT:"none",DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,FORCE_DISCONTINUITY_SEEK_DELAY:5e3,BITRATE_REBUFFERING_RATIO:1.5,BUFFER_GC_GAPS:{CALM:240,BEEFY:30},DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:250,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.8,LOW_LATENCY:.8},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.005,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAP_REP_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5,DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE:"seamless",DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE:"seamless",DEFAULT_VIDEO_TRACK_SWITCHING_MODE:"reload",DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless"},i=n(8026);function a(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(0===n.length)return e;var s=n.shift();if(a(e)&&a(s))for(var u in s)if(a(s[u])){var l=e[u];void 0===l&&(l={},e[u]=l),o(l,s[u])}else{var d;(0,i.Z)(e,((d={})[u]=s[u],d))}return o.apply(void 0,[e].concat(n))}var s=function(){function e(){this._config=r}var t=e.prototype;return t.update=function(e){var t=o(this._config,e);this._config=t},t.getCurrent=function(){return this._config},e}(),u=new s},1932:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(4578),i=n(3666);var a=n(1959),o=n(1946),s=n(5288);function u(e,t){var n;if(t.length!==e.length)return!0;for(var r=0;r<t.length;r++)if(t[r].nativeTrack!==(null===(n=e[r])||void 0===n?void 0:n.nativeTrack))return!0;return!1}function l(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,u=null!==(t=r[o])&&void 0!==t?t:1,l="gen_audio_"+o+"_"+u.toString();r[o]=u+1;var d={language:a.language,id:l,normalized:(0,s.ZP)(a.language),audioDescription:"descriptions"===a.kind||"description"===a.kind,representations:[]};n.push({track:d,nativeTrack:a})}return n}function d(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,u=null!==(t=r[o])&&void 0!==t?t:1,l="gen_text_"+o+"_"+u.toString();r[o]=u+1;var d={language:a.language,id:l,normalized:(0,s.ZP)(a.language),closedCaption:"captions"===a.kind};n.push({track:d,nativeTrack:a})}return n}function c(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,s=null!==(t=r[o])&&void 0!==t?t:1,u="gen_video_"+o+"_"+s.toString();r[o]=s+1,n.push({track:{id:u,representations:[]},nativeTrack:a})}return n}var f=function(e){function t(t){var n,r,i,a;return(n=e.call(this)||this)._nativeAudioTracks=t.audioTracks,n._nativeVideoTracks=t.videoTracks,n._nativeTextTracks=t.textTracks,n._audioTracks=void 0!==n._nativeAudioTracks?l(n._nativeAudioTracks):[],n._videoTracks=void 0!==n._nativeVideoTracks?c(n._nativeVideoTracks):[],n._textTracks=void 0!==n._nativeTextTracks?d(n._nativeTextTracks):[],n._lastEmittedNativeAudioTrack=null===(r=n._getCurrentAudioTrack())||void 0===r?void 0:r.nativeTrack,n._lastEmittedNativeVideoTrack=null===(i=n._getCurrentVideoTrack())||void 0===i?void 0:i.nativeTrack,n._lastEmittedNativeTextTrack=null===(a=n._getCurrentTextTrack())||void 0===a?void 0:a.nativeTrack,n._handleNativeTracksCallbacks(),n}(0,r.Z)(t,e);var n=t.prototype;return n.setAudioTrackById=function(e){for(var t=0;t<this._audioTracks.length;t++){var n=this._audioTracks[t],r=n.track,i=n.nativeTrack;if(r.id===e)return this._enableAudioTrackFromIndex(t),void(this._audioTrackLockedOn=i)}throw new Error("Audio track not found.")},n.disableTextTrack=function(){v(this._textTracks),this._textTrackLockedOn=null},n.setTextTrackById=function(e){for(var t=!1,n=0;n<this._textTracks.length;n++){var r=this._textTracks[n],i=r.track,a=r.nativeTrack;i.id===e?(a.mode="showing",t=!0,this._textTrackLockedOn=a):"showing"!==a.mode&&"hidden"!==a.mode||(a.mode="disabled")}if(!t)throw new Error("Text track not found.")},n.disableVideoTrack=function(){h(this._videoTracks),this._videoTrackLockedOn=null},n.setVideoTrackById=function(e){for(var t=0;t<this._videoTracks.length;t++){var n=this._videoTracks[t],r=n.track,i=n.nativeTrack;if(r.id===e)return i.selected=!0,void(this._videoTrackLockedOn=i)}throw new Error("Video track not found.")},n.getChosenAudioTrack=function(){var e=this._getCurrentAudioTrack();return(0,o.Z)(e)?e:e.track},n.getChosenTextTrack=function(){var e=this._getCurrentTextTrack();return(0,o.Z)(e)?e:e.track},n.getChosenVideoTrack=function(){var e=this._getCurrentVideoTrack();return(0,o.Z)(e)?e:e.track},n.getAvailableAudioTracks=function(){return this._audioTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,language:t.language,normalized:t.normalized,audioDescription:t.audioDescription,active:n.enabled,representations:t.representations}}))},n.getAvailableTextTracks=function(){return this._textTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,language:t.language,normalized:t.normalized,closedCaption:t.closedCaption,active:"showing"===n.mode}}))},n.getAvailableVideoTracks=function(){return this._videoTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,representations:t.representations,active:n.selected}}))},n.dispose=function(){void 0!==this._nativeVideoTracks&&(this._nativeVideoTracks.onchange=null,this._nativeVideoTracks.onaddtrack=null,this._nativeVideoTracks.onremovetrack=null),void 0!==this._nativeAudioTracks&&(this._nativeAudioTracks.onchange=null,this._nativeAudioTracks.onaddtrack=null,this._nativeAudioTracks.onremovetrack=null),void 0!==this._nativeTextTracks&&(this._nativeTextTracks.onchange=null,this._nativeTextTracks.onaddtrack=null,this._nativeTextTracks.onremovetrack=null),this.removeEventListener()},n._getCurrentAudioTrack=function(){if(void 0!==this._nativeAudioTracks){for(var e=0;e<this._audioTracks.length;e++){var t=this._audioTracks[e];if(t.nativeTrack.enabled)return t}return null}},n._getCurrentVideoTrack=function(){if(void 0!==this._nativeVideoTracks){for(var e=0;e<this._videoTracks.length;e++){var t=this._videoTracks[e];if(t.nativeTrack.selected)return t}return null}},n._getCurrentTextTrack=function(){if(void 0!==this._nativeTextTracks){for(var e=0;e<this._textTracks.length;e++){var t=this._textTracks[e];if("showing"===t.nativeTrack.mode)return t}return null}},n._setPreviouslyLockedAudioTrack=function(){if(void 0!==this._audioTrackLockedOn)if(null===this._audioTrackLockedOn)for(var e=0;e<this._audioTracks.length;e++){this._audioTracks[e].nativeTrack.enabled=!1}else for(var t=0;t<this._audioTracks.length;t++){if(this._audioTracks[t].nativeTrack===this._audioTrackLockedOn)return void this._enableAudioTrackFromIndex(t)}},n._setPreviouslyLockedTextTrack=function(){if(void 0!==this._textTrackLockedOn)if(null!==this._textTrackLockedOn)for(var e=0;e<this._textTracks.length;e++){var t=this._textTracks[e].nativeTrack;if(t===this._textTrackLockedOn)return p(this._textTracks,t),void("showing"!==t.mode&&(t.mode="showing"))}else v(this._textTracks)},n._setPreviouslyLockedVideoTrack=function(){if(void 0!==this._videoTrackLockedOn)if(null!==this._videoTrackLockedOn)for(var e=0;e<this._videoTracks.length;e++){var t=this._videoTracks[e].nativeTrack;if(t===this._videoTrackLockedOn)return void(t.selected=!0)}else h(this._videoTracks)},n._handleNativeTracksCallbacks=function(){var e=this;void 0!==this._nativeAudioTracks&&(this._nativeAudioTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeAudioTracks){var r=l(e._nativeAudioTracks);if(u(e._audioTracks,r)){e._audioTracks=r,e._setPreviouslyLockedAudioTrack(),e.trigger("availableAudioTracksChange",e.getAvailableAudioTracks());var i=e._getCurrentAudioTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeAudioTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeAudioTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeAudioTracks){var r=l(e._nativeAudioTracks);if(u(e._audioTracks,r)){e._audioTracks=r,e.trigger("availableAudioTracksChange",e.getAvailableAudioTracks());var i=e._getCurrentAudioTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeAudioTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeAudioTracks.onchange=function(){if(void 0!==e._audioTracks)for(var t=0;t<e._audioTracks.length;t++){var n=e._audioTracks[t],r=n.track,i=n.nativeTrack;if(i.enabled)return void(i!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",r),e._lastEmittedNativeAudioTrack=i))}null!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null),e._lastEmittedNativeAudioTrack=null)}),void 0!==this._nativeTextTracks&&(this._nativeTextTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeTextTracks){var r=d(e._nativeTextTracks);if(u(e._textTracks,r)){e._textTracks=r,e._setPreviouslyLockedTextTrack(),e.trigger("availableTextTracksChange",e.getAvailableTextTracks());var i=e._getCurrentTextTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeTextTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeTextTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeTextTracks){var r=d(e._nativeTextTracks);if(u(e._textTracks,r)){e._textTracks=r,e._setPreviouslyLockedTextTrack(),e.trigger("availableTextTracksChange",e.getAvailableTextTracks());var i=e._getCurrentTextTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeTextTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeTextTracks.onchange=function(){if(void 0!==e._textTracks)for(var t=0;t<e._textTracks.length;t++){var n=e._textTracks[t],r=n.track,i=n.nativeTrack;if("showing"===i.mode)return void(i!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",r),e._lastEmittedNativeTextTrack=i))}null!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null),e._lastEmittedNativeTextTrack=null)}),void 0!==this._nativeVideoTracks&&(this._nativeVideoTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeVideoTracks){var r=c(e._nativeVideoTracks);if(u(e._videoTracks,r)){e._videoTracks=r,e._setPreviouslyLockedVideoTrack(),e.trigger("availableVideoTracksChange",e.getAvailableVideoTracks());var i=e._getCurrentVideoTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeVideoTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeVideoTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeVideoTracks){var r=c(e._nativeVideoTracks);if(u(e._videoTracks,r)){e._videoTracks=r,e._setPreviouslyLockedVideoTrack(),e.trigger("availableVideoTracksChange",e.getAvailableVideoTracks());var i=e._getCurrentVideoTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeVideoTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeVideoTracks.onchange=function(){if(void 0!==e._videoTracks)for(var t=0;t<e._videoTracks.length;t++){var n=e._videoTracks[t],r=n.track,i=n.nativeTrack;if(i.selected)return void(i!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",r),e._lastEmittedNativeVideoTrack=i))}null!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null),e._lastEmittedNativeVideoTrack=null)})},n._enableAudioTrackFromIndex=function(e){!function(e,t){for(var n=0;n<e.length;n++)i.yS&&n===t||(e[n].enabled=!1);t<0||t>=e.length||(e[t].enabled=!0)}(this._audioTracks.map((function(e){return e.nativeTrack})),e)},t}(a.Z);function v(e){for(var t=0;t<e.length;t++){e[t].nativeTrack.mode="disabled"}}function p(e,t){for(var n=0;n<e.length;n++){var r=e[n].nativeTrack;r===t||"showing"!==r.mode&&"hidden"!==r.mode||(r.mode="disabled")}}function h(e){for(var t=0;t<e.length;t++){e[t].nativeTrack.selected=!1}}},1960:function(e,t,n){"use strict";n.d(t,{u:function(){return nt},Z:function(){return it}});var r=n(5861),i=n(4578),a=n(4687),o=n.n(a),s=n(3038),u=n(3887),l=n(6490),d=n(4791),c=n(6968),f=n(3635),v=(0,c.pX)((0,f.tG)("pssh"),0);function p(e,t){for(var n=0;n<e.length;n++){var r=e[n];if((void 0===t.systemId||void 0===r.systemId||t.systemId===r.systemId)&&(0,d.Z)(t.data,r.data))return!0}return!1}function h(e){var t=e.initData,n=e.initDataType;if(null==t)return u.Z.warn("Compat: No init data found on media encrypted event."),null;var r=function(e){for(var t=[],n=0;n<e.length;){if(e.length<n+8||(0,c.pX)(e,n+4)!==v)return u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var r=(0,c.pX)(new Uint8Array(e),n);if(n+r>e.length)return u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var i=e.subarray(n,n+r),a={systemId:(0,l.Y)(i,8),data:i};p(t,a)?u.Z.warn("Compat: Duplicated PSSH found in initialization data, removing it."):t.push(a),n+=r}return n!==e.length?(u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}]):t}(new Uint8Array(t));return{type:n,values:r}}var m=n(6872),g=n(5157),y=n(5389),_=n(3274),b=n(7714),S=n(1959),E=n(1946),T=n(288),w=n(6139),k=n(770);function A(e){k.Z.setState(e,null),(0,w.Y)(e,null)}function I(){return(I=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l,d,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.keySystemOptions,a=n.loadedSessionsStore,s=n.mediaKeySystemAccess,l=n.mediaKeys,d=k.Z.getState(t),c=null!==d&&d.loadedSessionsStore!==a?d.loadedSessionsStore.closeAllSessions():Promise.resolve(),e.next=5,c;case 5:if(!r.isCancelled){e.next=7;break}throw r.cancellationError;case 7:if(k.Z.setState(t,{keySystemOptions:i,mediaKeySystemAccess:s,mediaKeys:l,loadedSessionsStore:a}),t.mediaKeys!==l){e.next=10;break}return e.abrupt("return");case 10:u.Z.info("DRM: Attaching MediaKeys to the media element"),(0,w.Y)(t,l),u.Z.info("DRM: MediaKeys attached with success");case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(e){if(""===e.sessionId)return!1;var t=e.keyStatuses,n=[];return t.forEach((function(e){n.push(e)})),n.length<=0?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses",e.sessionId),!1):(0,b.Z)(n,"expired")?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has an expired key",e.sessionId),!1):(0,b.Z)(n,"internal-error")?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has a key with an internal-error",e.sessionId),!1):(u.Z.debug("DRM: isSessionUsable: MediaKeySession is usable",e.sessionId),!0)}function Z(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?x(i,t):null===a?(u.Z.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),x(i,t)):function(e,t,n,r){return P.apply(this,arguments)}(i,a,t,r)}function x(e,t){u.Z.info("DRM: Creating a new temporary session");var n=e.createSession(t,"temporary");return Promise.resolve({type:"created-session",value:n})}function P(){return P=(0,r.Z)(o().mark((function e(t,n,i,a){var s,l,d,c,f,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(v=function(){return v=(0,r.Z)(o().mark((function e(){var r,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===a.cancellationError){e.next=2;break}throw a.cancellationError;case 2:return u.Z.info("DRM: Removing previous persistent session."),null!==(r=n.get(i))&&n.delete(r.sessionId),e.prev=5,e.next=8,t.closeSession(s.mediaKeySession);case 8:e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(5),""===s.mediaKeySession.sessionId){e.next=14;break}throw e.t0;case 14:t.removeSessionWithoutClosingIt(s.mediaKeySession);case 15:if(null===a.cancellationError){e.next=17;break}throw a.cancellationError;case 17:return l=t.createSession(i,"persistent-license"),e.abrupt("return",{type:"created-session",value:l});case 19:case"end":return e.stop()}}),e,null,[[5,10]])}))),v.apply(this,arguments)},f=function(){return v.apply(this,arguments)},null===a.cancellationError){e.next=4;break}throw a.cancellationError;case 4:if(u.Z.info("DRM: Creating persistent MediaKeySession"),s=t.createSession(i,"persistent-license"),null!==(l=n.getAndReuse(i))){e.next=9;break}return e.abrupt("return",{type:"created-session",value:s});case 9:return e.prev=9,e.next=12,t.loadPersistentSession(s.mediaKeySession,l.sessionId);case 12:if(d=e.sent){e.next=19;break}return u.Z.warn("DRM: No data stored for the loaded session"),n.delete(l.sessionId),t.removeSessionWithoutClosingIt(s.mediaKeySession),c=t.createSession(i,"persistent-license"),e.abrupt("return",{type:"created-session",value:c});case 19:if(!d||!R(s.mediaKeySession)){e.next=23;break}return n.add(i,i.keyIds,s.mediaKeySession),u.Z.info("DRM: Succeeded to load persistent session."),e.abrupt("return",{type:"loaded-persistent-session",value:s});case 23:return u.Z.warn("DRM: Previous persistent session not usable anymore."),e.abrupt("return",f());case 27:return e.prev=27,e.t0=e.catch(9),u.Z.warn("DRM: Unable to load persistent session: "+(e.t0 instanceof Error?e.t0.toString():"Unknown Error")),e.abrupt("return",f());case 31:case"end":return e.stop()}}),e,null,[[9,27]])}))),P.apply(this,arguments)}function M(e,t){return C.apply(this,arguments)}function C(){return(C=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n<0||n>=t.getLength())){e.next=2;break}return e.abrupt("return");case 2:for(r=[],i=t.getAll().slice(),a=i.length-n,s=0;s<a;s++)u=i[s],r.push(t.closeSession(u.mediaKeySession));return e.next=8,Promise.all(r);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e,t,n,r,i){return N.apply(this,arguments)}function N(){return(N=(0,r.Z)(o().mark((function e(t,n,r,i,a){var s,l,d,c,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=null,l=n.loadedSessionsStore,d=n.persistentSessionsStore,null===(c=l.reuse(t))){e.next=11;break}if(!R(s=c.mediaKeySession)){e.next=10;break}return u.Z.info("DRM: Reuse loaded session",s.sessionId),e.abrupt("return",{type:"loaded-open-session",value:{mediaKeySession:s,sessionType:c.sessionType,keySessionRecord:c.keySessionRecord}});case 10:null!==d&&""!==c.mediaKeySession.sessionId&&d.delete(c.mediaKeySession.sessionId);case 11:if(null===s){e.next=16;break}return e.next=14,l.closeSession(s);case 14:if(null===a.cancellationError){e.next=16;break}throw a.cancellationError;case 16:return e.next=18,M(l,i);case 18:if(null===a.cancellationError){e.next=20;break}throw a.cancellationError;case 20:return e.next=22,Z(n,t,r,a);case 22:return f=e.sent,e.abrupt("return",{type:f.type,value:{mediaKeySession:f.value.mediaKeySession,sessionType:f.value.sessionType,keySessionRecord:f.value.keySessionRecord}});case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var O=n(3666);function L(){return!O.$u}var U=n(9592);function B(e,t,n){var r=t.getConfiguration();if(O.fq||null==r)return null;var i=e.filter((function(e){return e.type===n.type&&(!!((0,E.Z)(e.persistentLicenseConfig)&&"required"!==e.persistentState||"required"===r.persistentState)&&("required"!==e.distinctiveIdentifier||"required"===r.distinctiveIdentifier))}))[0];return null!=i?{keySystemOptions:i,keySystemAccess:t}:null}function F(e){var t=e.keyName,n=e.keyType,r=e.keySystemOptions,i=["temporary"],a="optional",o="optional";(0,E.Z)(r.persistentLicenseConfig)||(a="required",i.push("persistent-license")),(0,E.Z)(r.persistentState)||(a=r.persistentState),(0,E.Z)(r.distinctiveIdentifier)||(o=r.distinctiveIdentifier);var s,u,l=m.Z.getCurrent(),d=l.EME_DEFAULT_WIDEVINE_ROBUSTNESSES,c=l.EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES,f=r.audioCapabilitiesConfig,v=r.videoCapabilitiesConfig;if("full"===(null==f?void 0:f.type))s=f.value;else{var p;0===(p="robustness"===(null==f?void 0:f.type)?f.value:"widevine"===t?d:"com.microsoft.playready.recommendation"===n?c:[]).length&&p.push(void 0);var h="contentType"===(null==f?void 0:f.type)?f.value:['audio/mp4;codecs="mp4a.40.2"',"audio/webm;codecs=opus"];s=(0,U.Z)(p,(function(e){return h.map((function(t){return void 0!==e?{contentType:t,robustness:e}:{contentType:t}}))}))}if("full"===(null==v?void 0:v.type))u=v.value;else{var g;0===(g="robustness"===(null==v?void 0:v.type)?v.value:"widevine"===t?d:"com.microsoft.playready.recommendation"===n?c:[]).length&&g.push(void 0);var y="contentType"===(null==v?void 0:v.type)?v.value:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/webm;codecs="vp8"'];u=(0,U.Z)(g,(function(e){return y.map((function(t){return void 0!==e?{contentType:t,robustness:e}:{contentType:t}}))}))}return[{initDataTypes:["cenc"],videoCapabilities:u,audioCapabilities:s,distinctiveIdentifier:o,persistentState:a,sessionTypes:i}]}function z(e,t,n){u.Z.info("DRM: Searching for compatible MediaKeySystemAccess");var i=k.Z.getState(e);if(null!=i){var a=B(t,i.mediaKeySystemAccess,i.keySystemOptions);if(null!==a)return u.Z.info("DRM: Found cached compatible keySystem"),Promise.resolve({type:"reuse-media-key-system-access",value:{mediaKeySystemAccess:a.keySystemAccess,options:a.keySystemOptions}})}var s=t.reduce((function(e,t){var n,r=m.Z.getCurrent().EME_KEY_SYSTEMS[t.type];if(null!=r)n=r.map((function(e){return{keyName:t.type,keyType:e,keySystemOptions:t}}));else{var i=function(e){for(var t=m.Z.getCurrent().EME_KEY_SYSTEMS,n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];if((0,b.Z)(t[i],e))return i}}(t.type);n=[{keyName:i,keyType:t.type,keySystemOptions:t}]}return e.concat(n)}),[]);return l(0);function l(e){return d.apply(this,arguments)}function d(){return(d=(0,r.Z)(o().mark((function e(t){var r,i,a,d,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>=s.length)){e.next=2;break}throw new g.Z("INCOMPATIBLE_KEYSYSTEMS","No key system compatible with your wanted configuration has been found in the current browser.");case 2:if(null!=w.N){e.next=4;break}throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");case 4:return r=s[t],i=r.keyType,a=r.keySystemOptions,d=F(r),u.Z.debug("DRM: Request keysystem access "+i+","+(t+1)+" of "+s.length),e.prev=8,e.next=11,(0,w.N)(i,d);case 11:return c=e.sent,u.Z.info("DRM: Found compatible keysystem",i,t+1),e.abrupt("return",{type:"create-media-key-system-access",value:{options:a,mediaKeySystemAccess:c}});case 16:if(e.prev=16,e.t0=e.catch(8),u.Z.debug("DRM: Rejected access to keysystem",i,t+1),null===n.cancellationError){e.next=21;break}throw n.cancellationError;case 21:return e.abrupt("return",l(t+1));case 22:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}}var V=n(2297);function K(e,t,n){var r;u.Z.debug("Compat: Calling generateRequest on the MediaKeySession");try{r=function(e){u.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");for(var t=!1,n=new Uint8Array,r=new Uint8Array,i=0;i<e.length;){if(e.length<i+8||(0,c.pX)(e,i+4)!==v)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var a=(0,c.pX)(new Uint8Array(e),i);if(i+a>e.length)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var o=e.subarray(i,i+a);if(16===e[i+12]&&119===e[i+13]&&239===e[i+14]&&236===e[i+15]&&192===e[i+16]&&178===e[i+17]&&77===e[i+18]&&2===e[i+19]&&172===e[i+20]&&227===e[i+21]&&60===e[i+22]&&30===e[i+23]&&82===e[i+24]&&226===e[i+25]&&251===e[i+26]&&75===e[i+27]){var s=(0,V.Xj)(o),l=null===s?void 0:o[s[1]];u.Z.info("Compat: CENC PSSH found with version",l),void 0===l?u.Z.warn("Compat: could not read version of CENC PSSH"):t===(1===l)?n=(0,c.zo)(n,o):1===l?(u.Z.warn("Compat: cenc version 1 encountered, removing every other cenc pssh box."),n=o,t=!0):u.Z.warn("Compat: filtering out cenc pssh box with wrong version",l)}else r=(0,c.zo)(r,o);i+=a}if(i!==e.length)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");return(0,c.zo)(r,n)}(n)}catch(e){r=n}var i=null!=t?t:"";return e.generateRequest(i,r).catch((function(t){if(""!==i||!(t instanceof TypeError))throw t;return u.Z.warn('Compat: error while calling `generateRequest` with an empty initialization data type. Retrying with a default "cenc" value.',t),e.generateRequest("cenc",r)}))}function G(e,t){return j.apply(this,arguments)}function j(){return(j=(0,r.Z)(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("Compat/DRM: Load persisted session",n),e.next=3,t.load(n);case 3:if((r=e.sent)&&!(t.keyStatuses.size>0)){e.next=6;break}return e.abrupt("return",r);case 6:return e.abrupt("return",new Promise((function(e){t.addEventListener("keystatuseschange",i);var n=setTimeout(i,100);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var H=n(7864);function W(e){var t=new T.ZP;return Promise.race([e.close().then((function(){t.cancel()})),e.closed.then((function(){t.cancel()})),function(){return n.apply(this,arguments)}()]);function n(){return(n=(0,r.Z)(o().mark((function e(){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,H.Z)(1e3,t.signal);case 3:return e.next=5,i();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),!(e.t0 instanceof T.FU)){e.next=11;break}return e.abrupt("return");case 11:n=e.t0 instanceof Error?e.t0.message:"Unknown error made it impossible to close the session",u.Z.error("DRM: "+n);case 13:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function i(){return a.apply(this,arguments)}function a(){return(a=(0,r.Z)(o().mark((function n(){return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.update(new Uint8Array(1));case 3:n.next=13;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t.isUsed){n.next=9;break}return n.abrupt("return");case 9:if(!(n.t0 instanceof Error&&"The session is already closed."===n.t0.message)){n.next=11;break}return n.abrupt("return");case 11:return n.next=13,(0,H.Z)(1e3,t.signal);case 13:if(!t.isUsed){n.next=15;break}return n.abrupt("return");case 15:throw new Error("Compat: Couldn't know if session is closed");case 16:case"end":return n.stop()}}),n,null,[[0,5]])})))).apply(this,arguments)}}var q=n(811);function Y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return X(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return X(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Q(e,t){return e===t||(0,d.Z)(e,t)}function $(e,t){return t.some((function(t){return Q(t,e)}))}function J(e,t){for(var n,r=function(){var e=n.value;if(!t.some((function(t){return Q(t,e)})))return{v:!1}},i=Y(e);!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}return!0}function ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ne=function(){function e(e){this._initializationData=e,this._keyIds=null}var t=e.prototype;return t.associateKeyIds=function(e){null===this._keyIds&&(this._keyIds=[]);for(var t=0,n=Array.from(e);t<n.length;t++){var r=n[t];this.isAssociatedWithKeyId(r)||this._keyIds.push(r)}},t.isAssociatedWithKeyId=function(e){if(null===this._keyIds)return!1;for(var t,n=ee(this._keyIds);!(t=n()).done;){if(Q(t.value,e))return!0}return!1},t.getAssociatedKeyIds=function(){return null===this._keyIds?[]:this._keyIds},t.isCompatibleWith=function(e){var t=e.keyIds;if(void 0!==t&&t.length>0){if(null!==this._keyIds&&J(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return J(t,this._initializationData.keyIds)}return this._checkInitializationDataCompatibility(e)},t._checkInitializationDataCompatibility=function(e){return void 0!==e.keyIds&&e.keyIds.length>0&&void 0!==this._initializationData.keyIds?J(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function re(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ae=function(){function e(e){this._mediaKeys=e,this._storage=[]}var t=e.prototype;return t.createSession=function(e,t){var n=this,r=new ne(e),i=this._mediaKeys.createSession(t),a={mediaKeySession:i,sessionType:t,keySessionRecord:r,isGeneratingRequest:!1,isLoadingPersistentSession:!1,closingStatus:{type:"none"}};return(0,E.Z)(i.closed)||i.closed.then((function(){var e=n.getIndex(r);e>=0&&n._storage[e].mediaKeySession===i&&n._storage.splice(e,1)})).catch((function(e){u.Z.warn("DRM-LSS: MediaKeySession.closed rejected: "+e)})),u.Z.debug("DRM-LSS: Add MediaKeySession",a.sessionType),this._storage.push(Object.assign({},a)),a},t.reuse=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.keySessionRecord.isCompatibleWith(e))return this._storage.splice(t,1),this._storage.push(n),Object.assign({},n)}return null},t.getEntryForSession=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.mediaKeySession===e)return Object.assign({},n)}return null},t.generateLicenseRequest=function(){var e=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=re(this._storage);case 1:if((s=a()).done){e.next=8;break}if((l=s.value).mediaKeySession!==t){e.next=6;break}return i=l,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==i){e.next=11;break}return u.Z.error("DRM-LSS: generateRequest error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",K(t,n,r));case 11:if(i.isGeneratingRequest=!0,"none"===i.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,K(t,n,r);case 17:e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(14),void 0!==i){e.next=23;break}throw e.t0;case 23:throw i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start(),e.t0;case 26:if(void 0!==i){e.next=28;break}return e.abrupt("return",void 0);case 28:i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start();case 30:case"end":return e.stop()}}),e,this,[[14,19]])})));return function(t,n,r){return e.apply(this,arguments)}}(),t.loadPersistentSession=function(){var e=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=re(this._storage);case 1:if((a=i()).done){e.next=8;break}if((s=a.value).mediaKeySession!==t){e.next=6;break}return r=s,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==r){e.next=11;break}return u.Z.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",G(t,n));case 11:if(r.isLoadingPersistentSession=!0,"none"===r.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,G(t,n);case 17:l=e.sent,e.next=27;break;case 20:if(e.prev=20,e.t0=e.catch(14),void 0!==r){e.next=24;break}throw e.t0;case 24:throw r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.t0;case 27:if(void 0!==r){e.next=29;break}return e.abrupt("return",l);case 29:return r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.abrupt("return",l);case 32:case"end":return e.stop()}}),e,this,[[14,20]])})));return function(t,n){return e.apply(this,arguments)}}(),t.closeSession=function(){var e=(0,r.Z)(o().mark((function e(t){var n,r,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=re(this._storage);case 1:if((i=r()).done){e.next=8;break}if((a=i.value).mediaKeySession!==t){e.next=6;break}return n=a,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==n){e.next=11;break}return u.Z.warn("DRM-LSS: No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Promise.resolve(!1));case 11:return e.abrupt("return",this._closeEntry(n));case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getLength=function(){return this._storage.length},t.getAll=function(){return this._storage},t.closeAllSessions=function(){var e=(0,r.Z)(o().mark((function e(){var t,n,r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._storage,u.Z.debug("DRM-LSS: Closing all current MediaKeySessions",t.length),this._storage=[],n=t.map((function(e){return r._closeEntry(e)})),e.next=6,Promise.all(n);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.removeSessionWithoutClosingIt=function(e){(0,q.Z)(""===e.sessionId,"Initialized `MediaKeySession`s should always be properly closed");for(var t=this._storage.length-1;t>=0;t--){if(this._storage[t].mediaKeySession===e)return this._storage.splice(t,1),!0}return!1},t.getIndex=function(e){for(var t=0;t<this._storage.length;t++){if(this._storage[t].keySessionRecord===e)return t}return-1},t._closeEntry=function(){var e=(0,r.Z)(o().mark((function e(t){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.mediaKeySession,e.abrupt("return",new Promise((function(e,r){function i(){void 0!==t&&(t.closingStatus={type:"pending"}),oe(n).then((function(){void 0!==t&&(t.closingStatus={type:"done"}),e(!0)})).catch((function(e){void 0!==t&&(t.closingStatus={type:"failed"}),r(e)}))}void 0!==t&&(t.isLoadingPersistentSession||t.isGeneratingRequest)?t.closingStatus={type:"awaiting",start:i}:i()})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e}();function oe(e){return se.apply(this,arguments)}function se(){return(se=(0,r.Z)(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.debug("DRM: Trying to close a MediaKeySession",t.sessionId),e.prev=1,e.next=4,W(t);case 4:return u.Z.debug("DRM: Succeeded to close MediaKeySession"),e.abrupt("return");case 8:return e.prev=8,e.t0=e.catch(1),u.Z.error("DRM: Could not close MediaKeySession: "+(e.t0 instanceof Error?e.t0.toString():"Unknown error")),e.abrupt("return");case 12:case"end":return e.stop()}}),e,null,[[1,8]])})))).apply(this,arguments)}var ue=n(9689),le=n(2870),de=n(6923),ce=function(){function e(e){this.initData=e}return e.prototype.toJSON=function(){return(0,ue.J)(this.initData)},e.decode=function(e){return(0,ue.K)(e)},e}();function fe(e,t){var n,r;return null!==(r=null!==(n=ve(e,t))&&void 0!==n?n:ve(t,e))&&void 0!==r&&r}function ve(e,t){if(0===e.length)return!1;if(t.length<e.length)return null;for(var n=e[0],r=0,i=0;i<t.length;i++){var a=t[i];if(a.systemId===n.systemId){if(a.hash!==n.hash)return!1;var o=n.data instanceof Uint8Array?n.data:"string"==typeof n.data?ce.decode(n.data):n.data.initData,s=a.data instanceof Uint8Array?a.data:"string"==typeof a.data?ce.decode(a.data):a.data.initData;if(!(0,d.Z)(o,s))return!1;if(t.length-i<e.length)return null;for(r=1;r<e.length;r++){var u=e[r];for(i+=1;i<t.length;i++){var l=t[i];if(u.systemId===l.systemId){if(u.hash!==l.hash)return!1;var c=u.data instanceof Uint8Array?u.data:"string"==typeof u.data?ce.decode(u.data):u.data.initData,f=l.data instanceof Uint8Array?l.data:"string"==typeof l.data?ce.decode(l.data):l.data.initData;if(!(0,d.Z)(c,f))return!1;break}}if(r===t.length)return null}return!0}}return null}function pe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return he(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return he(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var me=function(){function e(e){!function(e){(0,q.u)(e,{save:"function",load:"function"},"persistentLicenseConfig")}(e),this._entries=[],this._storage=e;try{var t=this._storage.load();Array.isArray(t)||(t=[]),this._entries=t}catch(e){u.Z.warn("DRM-PSS: Could not get entries from license storage",e instanceof Error?e:""),this.dispose()}}var t=e.prototype;return t.getLength=function(){return this._entries.length},t.getAll=function(){return this._entries},t.get=function(e){var t=this._getIndex(e);return-1===t?null:this._entries[t]},t.getAndReuse=function(e){var t=this._getIndex(e);if(-1===t)return null;var n=this._entries.splice(t,1)[0];return this._entries.push(n),n},t.add=function(e,t,n){var r;if(!(0,E.Z)(n)&&(0,de.Z)(n.sessionId)){var i=n.sessionId,a=this._getIndex(e);if(a>=0){var o=void 0===t?3:4,s=this._entries[a];if((null!==(r=s.version)&&void 0!==r?r:-1)>=o&&i===s.sessionId)return;u.Z.info("DRM-PSS: Updating session info.",i),this._entries.splice(a,1)}else u.Z.info("DRM-PSS: Add new session",i);var l=e.values.getFormattedValues().map((function(e){var t=e.systemId,n=e.data;return{systemId:t,hash:e.hash,data:new ce(n)}}));void 0===t?this._entries.push({version:3,sessionId:i,values:l,initDataType:e.type}):this._entries.push({version:4,sessionId:i,keyIds:t.map((function(e){return new ce(e)})),values:l,initDataType:e.type}),this._save()}else u.Z.warn("DRM-PSS: Invalid Persisten Session given.")},t.delete=function(e){for(var t=-1,n=0;n<this._entries.length;n++){if(this._entries[n].sessionId===e){t=n;break}}if(-1!==t){var r=this._entries[t];u.Z.warn("DRM-PSS: Delete session from store",r.sessionId),this._entries.splice(t,1),this._save()}else u.Z.warn("DRM-PSS: initData to delete not found.")},t.deleteOldSessions=function(e){u.Z.info("DRM-PSS: Deleting last "+e+" sessions."),e<=0||(e<=this._entries.length?this._entries.splice(0,e):(u.Z.warn("DRM-PSS: Asked to remove more information that it contains",e,this._entries.length),this._entries=[]),this._save())},t.dispose=function(){this._entries=[],this._save()},t._getIndex=function(e){var t=this,n=null;function r(){if(null===n){var t=e.values.constructRequestData();n={initData:t,initDataHash:(0,le.Z)(t)}}return n}for(var i=function(n){var i=t._entries[n];if(i.initDataType===e.type)switch(i.version){case 4:if(void 0!==e.keyIds){if(e.keyIds.every((function(e){for(var t,n=(0,ue.J)(e),r=pe(i.keyIds);!(t=r()).done;){var a=t.value;if("string"==typeof a){if(n===a)return!0}else if(Q(a.initData,e))return!0}return!1})))return{v:n}}else if(fe(e.values.getFormattedValues(),i.values))return{v:n};break;case 3:if(fe(e.values.getFormattedValues(),i.values))return{v:n};break;case 2:var a=r(),o=a.initData,s=a.initDataHash;if(i.initDataHash===s)try{var l="string"==typeof i.initData?ce.decode(i.initData):i.initData.initData;if((0,d.Z)(l,o))return{v:n}}catch(e){u.Z.warn("DRM-PSS: Could not decode initialization data.",e instanceof Error?e:"")}break;case 1:var c=r(),f=c.initData,v=c.initDataHash;if(i.initDataHash===v){if(void 0===i.initData.length)return{v:n};if((0,d.Z)(i.initData,f))return{v:n}}break;default:var p=r().initDataHash;if(i.initData===p)return{v:n}}},a=0;a<this._entries.length;a++){var o=i(a);if("object"==typeof o)return o.v}return-1},t._save=function(){try{this._storage.save(this._entries)}catch(t){var e=t instanceof Error?t:void 0;u.Z.warn("DRM-PSS: Could not save MediaKeySession information",e)}},e}();var ge=new WeakMap,ye=function(e){ge.set(e,null)},_e=function(e,t){var n=t instanceof Uint8Array?t:new Uint8Array(t instanceof ArrayBuffer?t:t.buffer),r=(0,le.Z)(n);ge.set(e,{hash:r,serverCertificate:n})},be=function(e){var t=ge.get(e);return void 0!==t&&(null!==t||void 0)},Se=function(e,t){var n=ge.get(e);if(null==n)return!1;var r=n.hash,i=n.serverCertificate,a=t instanceof Uint8Array?t:new Uint8Array(t instanceof ArrayBuffer?t:t.buffer);if((0,le.Z)(a)!==r||i.length!==a.length)return!1;for(var o=0;o<i.length;o++)if(i[o]!==a[o])return!1;return!0};function Ee(e){if((0,E.Z)(e.persistentLicenseConfig))return null;var t=e.persistentLicenseConfig;if(null==t)throw new g.Z("INVALID_KEY_SYSTEM","No `persistentLicenseConfig` found for persistent license.");return u.Z.debug("DRM: Set the given license storage"),new me(t)}function Te(e,t,n){return we.apply(this,arguments)}function we(){return(we=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l,d,c,f,v,p,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,z(t,n,r);case 2:if(i=e.sent,null===r.cancellationError){e.next=5;break}throw r.cancellationError;case 5:if(a=i.value,s=a.options,l=a.mediaKeySystemAccess,d=k.Z.getState(t),c=Ee(s),!L()||null===d||"reuse-media-key-system-access"!==i.type){e.next=12;break}if(f=d.mediaKeys,v=d.loadedSessionsStore,!1!==be(f)&&((0,E.Z)(s.serverCertificate)||!Se(f,s.serverCertificate))){e.next=12;break}return e.abrupt("return",{mediaKeys:f,mediaKeySystemAccess:l,stores:{loadedSessionsStore:v,persistentSessionsStore:c},options:s});case 12:return e.next=14,ke(l);case 14:return p=e.sent,u.Z.info("DRM: MediaKeys created with success"),h=new ae(p),e.abrupt("return",{mediaKeys:p,mediaKeySystemAccess:l,stores:{loadedSessionsStore:h,persistentSessionsStore:c},options:s});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ke(e){return Ae.apply(this,arguments)}function Ae(){return(Ae=(0,r.Z)(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Calling createMediaKeys on the MediaKeySystemAccess"),e.prev=1,e.next=4,t.createMediaKeys();case 4:return n=e.sent,e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.message:"Unknown error when creating MediaKeys.",new g.Z("CREATE_MEDIA_KEYS_ERROR",r);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})))).apply(this,arguments)}function Ie(){return(Ie=(0,r.Z)(o().mark((function e(t,n,r){var i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Te(t,n,r);case 2:return i=e.sent,a=i.mediaKeys,null!==t.mediaKeys&&void 0!==t.mediaKeys&&a!==t.mediaKeys&&(u.Z.debug("DRM: Disabling old MediaKeys"),A(t)),e.abrupt("return",i);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Re=n(7326),Ze=n(2146),xe=n(2572);function Pe(e){return new Promise((function(t){setTimeout(t,e)}))}var Me=n(7904),Ce=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,Re.Z)(r),t.prototype),r.reason=n,r}return(0,i.Z)(t,e),t}((0,Ze.Z)(Error)),De="expired",Ne="internal-error",Oe="output-restricted";function Le(e,t,n){var r,i=t.onKeyInternalError,a=t.onKeyOutputRestricted,o=t.onKeyExpiration,s=[],u=[],l=[];return e.keyStatuses.forEach((function(e,t){var r="string"==typeof e?[e,t]:[t,e],d=r[0],c=function(e,t){return-1!==e.indexOf("playready")&&(O.YM||O.kD)?(0,f.wO)(t):t}(n,new Uint8Array(r[1])),v={keyId:c.buffer,keyStatus:d};switch(d){case De:var p=new g.Z("KEY_STATUS_CHANGE_ERROR","A decryption key expired ("+(0,f.ci)(c)+")",{keyStatuses:[v].concat(l)});if("error"===o||void 0===o)throw p;switch(o){case"close-session":throw new Ce(p);case"fallback":s.push(c);break;default:"continue"===o||void 0===o?u.push(c):(0,Me.Z)(o)}l.push(v);break;case Ne:var h=new g.Z("KEY_STATUS_CHANGE_ERROR",'A "'+d+'" status has been encountered ('+(0,f.ci)(c)+")",{keyStatuses:[v].concat(l)});switch(i){case void 0:case"error":throw h;case"close-session":throw new Ce(h);case"fallback":s.push(c);break;case"continue":u.push(c);break;default:if(void 0===i)throw h;(0,Me.Z)(i)}l.push(v);break;case Oe:var m=new g.Z("KEY_STATUS_CHANGE_ERROR",'A "'+d+'" status has been encountered ('+(0,f.ci)(c)+")",{keyStatuses:[v].concat(l)});switch(a){case void 0:case"error":throw m;case"fallback":s.push(c);break;case"continue":u.push(c);break;default:if(void 0===a)throw m;(0,Me.Z)(a)}l.push(v);break;default:u.push(c)}})),l.length>0&&(r=new g.Z("KEY_STATUS_CHANGE_ERROR","One or several problematic key statuses have been encountered",{keyStatuses:l})),{warning:r,blacklistedKeyIds:s,whitelistedKeyIds:u}}var Ue=s.Dl,Be=s.RV,Fe=s.qo;function ze(e,t,n,i,a){u.Z.info("DRM: Binding session events",e.sessionId);var s=t.getLicenseConfig,l=void 0===s?{}:s,d=new T.ZP({cancelOn:a});(0,E.Z)(e.closed)||e.closed.then((function(){return d.cancel()})).catch((function(e){a.isCancelled||(d.cancel(),i.onError(e))})),Ue(e,(function(e){d.cancel(),i.onError(new g.Z("KEY_ERROR",e.type))}),d.signal),Fe(e,(function(){try{!function(){if(u.Z.info("DRM: keystatuseschange event received",e.sessionId),d.isUsed||0===e.keyStatuses.size)return;var r=Le(e,t,n),a=r.warning,o=r.blacklistedKeyIds,s=r.whitelistedKeyIds;if(void 0!==a&&(i.onWarning(a),d.isUsed))return;i.onKeyUpdate({whitelistedKeyIds:s,blacklistedKeyIds:o})}()}catch(e){if(a.isCancelled||d.isUsed&&e instanceof T.XG)return;d.cancel(),i.onError(e)}}),d.signal),Be(e,(function(n){var a,s=n,c=new Uint8Array(s.message),f=(0,de.Z)(s.messageType)?s.messageType:"license-request";u.Z.info("DRM: Received message event, type "+f,e.sessionId),function(e,t,n){var i=t.baseDelay,a=t.maxDelay,s=t.totalRetry,u=t.shouldRetry,l=t.onRetry,d=0;return c();function c(){return f.apply(this,arguments)}function f(){return(f=(0,r.Z)(o().mark((function t(){var r,f,v,p;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===n.cancellationError){t.next=2;break}throw n.cancellationError;case 2:return t.prev=2,t.next=5,e();case 5:return r=t.sent,t.abrupt("return",r);case 9:if(t.prev=9,t.t0=t.catch(2),null===n.cancellationError){t.next=13;break}throw n.cancellationError;case 13:if(!(!(0,E.Z)(u)&&!u(t.t0)||d++>=s)){t.next=15;break}throw t.t0;case 15:return"function"==typeof l&&l(t.t0,d),f=Math.min(i*Math.pow(2,d-1),a),v=(0,xe.Z)(f),t.next=20,Pe(v);case 20:return p=c(),t.abrupt("return",p);case 22:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}}((function(){return function(e,n){return new Promise((function(r,i){u.Z.debug("DRM: Calling `getLicense`",n);var a,o=t.getLicense(e,n),s=(0,E.Z)(l.timeout)?1e4:l.timeout;s>=0&&(a=setTimeout((function(){i(new je('"getLicense" timeout exceeded ('+s+" ms)"))}),s));try{Promise.resolve(o).then((function(e){d(),r(e)}),(function(e){d(),i(e)}))}catch(e){d(),i(e)}function d(){void 0!==a&&clearTimeout(a)}}))}(c,f)}),{totalRetry:null!=(a=l.retry)?a:2,baseDelay:200,maxDelay:3e3,shouldRetry:function(e){return e instanceof je||(0,E.Z)(e)||!0!==e.noRetry},onRetry:function(e){return i.onWarning(Ve(e))}},d.signal).then((function(t){return d.isUsed?Promise.resolve():(0,E.Z)(t)?void u.Z.info("DRM: No license given, skipping session.update"):function(e,t){return Ke.apply(this,arguments)}(e,t)})).catch((function(e){if(!d.isUsed){d.cancel();var t=Ve(e);if(!(0,E.Z)(e))if(!0===e.fallbackOnLastTry)return u.Z.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void i.onError(new Ge(t));i.onError(t)}}))}),d.signal)}function Ve(e){if(e instanceof je)return new g.Z("KEY_LOAD_TIMEOUT","The license server took too much time to respond.");var t=new g.Z("KEY_LOAD_ERROR","An error occured when calling `getLicense`.");return!(0,E.Z)(e)&&(0,de.Z)(e.message)&&(t.message=e.message),t}function Ke(){return(Ke=(0,r.Z)(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Updating MediaKeySession with message"),e.prev=1,e.next=4,t.update(n);case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.toString():"`session.update` failed",new g.Z("KEY_UPDATE_ERROR",r);case 10:u.Z.info("DRM: MediaKeySession update succeeded.");case 11:case"end":return e.stop()}}),e,null,[[1,6]])})))).apply(this,arguments)}var Ge=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,Re.Z)(r),t.prototype),r.sessionError=n,r}return(0,i.Z)(t,e),t}((0,Ze.Z)(Error)),je=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,Re.Z)(n),Ge.prototype),n.message=t,n}return(0,i.Z)(t,e),t}((0,Ze.Z)(Error)),He=n(9822);function We(e,t){return qe.apply(this,arguments)}function qe(){return(qe=(0,r.Z)(o().mark((function e(t,n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setServerCertificate(n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),u.Z.warn("DRM: mediaKeys.setServerCertificate returned an error",e.t0 instanceof Error?e.t0:""),i=e.t0 instanceof Error?e.t0.toString():"`setServerCertificate` error",new g.Z("LICENSE_SERVER_CERTIFICATE_ERROR",i);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function Ye(e,t){return Xe.apply(this,arguments)}function Xe(){return(Xe=(0,r.Z)(o().mark((function e(t,n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==be(t)){e.next=3;break}return u.Z.info("DRM: The MediaKeys already has a server certificate, skipping..."),e.abrupt("return",{type:"already-has-one"});case 3:if("function"==typeof t.setServerCertificate){e.next=6;break}return u.Z.warn("DRM: Could not set the server certificate. mediaKeys.setServerCertificate is not a function"),e.abrupt("return",{type:"method-not-implemented"});case 6:return u.Z.info("DRM: Setting server certificate on the MediaKeys"),ye(t),e.prev=8,e.next=11,We(t,n);case 11:return r=e.sent,_e(t,n),e.abrupt("return",{type:"success",value:r});case 16:return e.prev=16,e.t0=e.catch(8),i=(0,He.Z)(e.t0)?e.t0:new g.Z("LICENSE_SERVER_CERTIFICATE_ERROR","Unknown error when setting the server certificate."),e.abrupt("return",{type:"error",value:i});case 20:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}function Qe(e,t){if(!(isNaN(t)||t<0||t>=e.getLength())){var n=e.getLength(),r=n-t;u.Z.info("DRM: Too many stored persistent sessions, removing some.",n,r),e.deleteOldSessions(r)}}var $e=n(9252);var Je=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return c.zo.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return fe(this.getFormattedValues(),n)},t.getFormattedValues=function(){return null===this._lazyFormattedValues&&(this._lazyFormattedValues=this._innerValues.slice().sort((function(e,t){return e.systemId===t.systemId?0:void 0===e.systemId?1:void 0===t.systemId||e.systemId<t.systemId?-1:1})).map((function(e){var t=e.systemId,n=e.data;return{systemId:t,data:n,hash:(0,le.Z)(n)}}))),this._lazyFormattedValues},e}();function et(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return tt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var nt,rt=s.Zl,it=function(e){function t(t,n){var r;r=e.call(this)||this,u.Z.debug("DRM: Starting ContentDecryptor logic.");var i=new T.ZP;return r._currentSessions=[],r._canceller=i,r._wasAttachCalled=!1,r._initDataQueue=[],r._stateData={state:nt.Initializing,isMediaKeysAttached:!1,isInitDataQueueLocked:!0,data:null},r.error=null,rt(t,(function(e){u.Z.debug("DRM: Encrypted event received from media element.");var t=h(e);null!==t&&r.onInitializationData(t)}),i.signal),function(e,t,n){return Ie.apply(this,arguments)}(t,n,i.signal).then((function(e){var n,i,a=e.options,o=e.mediaKeySystemAccess;((0,E.Z)(a.persistentLicenseConfig)||!0===a.persistentLicenseConfig.disableRetroCompatibility)&&(i=o.keySystem,n=(0,$e.Z)(i,"com.microsoft.playready")||"com.chromecast.playready"===i||"com.youtube.playready"===i?"9a04f07998404286ab92e65be0885f95":"com.widevine.alpha"===i?"edef8ba979d64acea3c827dcd51d21ed":(0,$e.Z)(i,"com.apple.fps")?"94ce86fb07ff4f43adb893d2fa968ca2":(0,$e.Z)(i,"com.nagra.")?"adb41c242dbf4a6d958b4457c0d27b95":void 0),r.systemId=n,r._stateData.state===nt.Initializing&&(r._stateData={state:nt.WaitingForAttachment,isInitDataQueueLocked:!0,isMediaKeysAttached:!1,data:{mediaKeysInfo:e,mediaElement:t}},r.trigger("stateChange",r._stateData.state))})).catch((function(e){r._onFatalError(e)})),r}(0,i.Z)(t,e);var n=t.prototype;return n.getState=function(){return this._stateData.state},n.attach=function(){var e=this;if(this._stateData.state!==nt.WaitingForAttachment)throw new Error("`attach` should only be called when in the WaitingForAttachment state");if(this._wasAttachCalled)u.Z.warn("DRM: ContentDecryptor's `attach` method called more than once.");else{this._wasAttachCalled=!0;var t=this._stateData.data,n=t.mediaElement,i=t.mediaKeysInfo,a=i.options,s=i.mediaKeys,l=i.mediaKeySystemAccess,d={loadedSessionsStore:i.stores.loadedSessionsStore,mediaKeySystemAccess:l,mediaKeys:s,keySystemOptions:a};!0===a.disableMediaKeysAttachmentLock&&(this._stateData={state:nt.ReadyForContent,isInitDataQueueLocked:!0,isMediaKeysAttached:!1,data:null},this.trigger("stateChange",this._stateData.state),this._isStopped())||(u.Z.debug("DRM: Attaching current MediaKeys"),function(e,t,n){return I.apply(this,arguments)}(n,d,this._canceller.signal).then((0,r.Z)(o().mark((function t(){var n,r,u;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=a.serverCertificate,(0,E.Z)(n)){t.next=6;break}return t.next=4,Ye(s,n);case 4:"error"===(r=t.sent).type&&e.trigger("warning",r.value);case 6:if(!e._isStopped()){t.next=8;break}return t.abrupt("return");case 8:u=e._stateData.state,e._stateData={state:nt.ReadyForContent,isMediaKeysAttached:!0,isInitDataQueueLocked:!1,data:{mediaKeysData:i}},u!==nt.ReadyForContent&&e.trigger("stateChange",nt.ReadyForContent),e._isStopped()||e._processCurrentInitDataQueue();case 12:case"end":return t.stop()}}),t)})))).catch((function(t){e._onFatalError(t)})))}},n.dispose=function(){this.removeEventListener(),this._stateData={state:nt.Disposed,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("stateChange",this._stateData.state)},n.onInitializationData=function(e){var t=this;if(!1===this._stateData.isInitDataQueueLocked){var n=this._stateData.data.mediaKeysData,r=Object.assign(Object.assign({},e),{values:new Je(e.values)});this._processInitializationData(r,n).catch((function(e){t._onFatalError(e)}))}else{if(this._isStopped())throw new Error("ContentDecryptor either disposed or stopped.");this._initDataQueue.push(e)}},n._processInitializationData=function(){var e=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l,d,c,v,p,h,y,b,S,T,w,k,A,I,R,Z,x,P,M,C,N,O,L,U,B,F,z,V,K,G=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.mediaKeySystemAccess,i=n.stores,a=n.options,!this._tryToUseAlreadyCreatedSession(t,n)&&!this._isStopped()){e.next=3;break}return e.abrupt("return");case 3:if("content"!==a.singleLicensePer){e.next=15;break}if(void 0===(s=(0,_.Z)(this._currentSessions,(function(e){return"created-session"===e.source})))){e.next=13;break}if(void 0!==(l=t.keyIds)){e.next=10;break}return void 0===t.content?u.Z.warn("DRM: Unable to fallback from a non-decipherable quality."):st(t.content.manifest,t),e.abrupt("return");case 10:return s.record.associateKeyIds(l),void 0!==t.content&&(u.Z.hasLevel("DEBUG")&&(d=l.reduce((function(e,t){return e+", "+(0,f.ci)(t)}),""),u.Z.debug("DRM: Blacklisting new key ids",d)),ot(t.content.manifest,[],l,[])),e.abrupt("return");case 13:e.next=37;break;case 15:if("periods"!==a.singleLicensePer||void 0===t.content){e.next=37;break}c=t.content.period,v=this._currentSessions.filter((function(e){return"created-session"===e.source})),dt(p=new Set,c),h=et(v);case 21:if((y=h()).done){e.next=37;break}b=y.value,S=Array.from(p),T=0,w=S;case 25:if(!(T<w.length)){e.next=35;break}if(k=w[T],!b.record.isAssociatedWithKeyId(k)){e.next=32;break}for(b.record.associateKeyIds(p.values()),A=et(S);!(I=A()).done;)$(R=I.value,b.keyStatuses.whitelisted)||$(R,b.keyStatuses.blacklisted)||b.keyStatuses.blacklisted.push(R);return ot(t.content.manifest,b.keyStatuses.whitelisted,b.keyStatuses.blacklisted,[]),e.abrupt("return");case 32:T++,e.next=25;break;case 35:e.next=21;break;case 37:return this._lockInitDataQueue(),(0,E.Z)(a.persistentLicenseConfig)?Z="temporary":at(r)?Z="persistent-license":(u.Z.warn('DRM: Cannot create "persistent-license" session: not supported'),Z="temporary"),x=m.Z.getCurrent(),P=x.EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS,M=x.EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION,C="number"==typeof a.maxSessionCacheSize?a.maxSessionCacheSize:P,e.next=43,D(t,i,Z,C,this._canceller.signal);case 43:if(N=e.sent,!this._isStopped()){e.next=46;break}return e.abrupt("return");case 46:if(O={record:N.value.keySessionRecord,source:N.type,keyStatuses:{whitelisted:[],blacklisted:[]},blacklistedSessionError:null},this._currentSessions.push(O),L=N.value,U=L.mediaKeySession,B=L.sessionType,F=!1,ze(U,a,r.keySystem,{onKeyUpdate:function(e){var n=ut(t,O.record,a.singleLicensePer,"created-session"===O.source,e.whitelistedKeyIds,e.blacklistedKeyIds);if(O.record.associateKeyIds(n.whitelisted),O.record.associateKeyIds(n.blacklisted),O.keyStatuses={whitelisted:n.whitelisted,blacklisted:n.blacklisted},0!==O.record.getAssociatedKeyIds().length&&"persistent-license"===B&&null!==i.persistentSessionsStore&&!F){var r=i.persistentSessionsStore;Qe(r,M-1),r.add(t,O.record.getAssociatedKeyIds(),U),F=!0}void 0!==t.content&&ot(t.content.manifest,n.whitelisted,n.blacklisted,[]),G._unlockInitDataQueue()},onWarning:function(e){G.trigger("warning",e)},onError:function(e){var n;if(e instanceof Ce){u.Z.warn("DRM: A session's closing condition has been triggered"),G._lockInitDataQueue();var r=G._currentSessions.indexOf(O);return r>=0&&G._currentSessions.splice(r),void 0!==t.content&&ot(t.content.manifest,[],[],O.record.getAssociatedKeyIds()),null===(n=i.persistentSessionsStore)||void 0===n||n.delete(U.sessionId),i.loadedSessionsStore.closeSession(U).catch((function(e){var t=e instanceof Error?e:"unknown error";u.Z.warn("DRM: failed to close expired session",t)})).then((function(){return G._unlockInitDataQueue()})).catch((function(e){return G._onFatalError(e)})),void(G._isStopped()||G.trigger("warning",e.reason))}if(e instanceof Ge){if(O.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;u.Z.info("DRM: blacklisting Representations based on protection data."),st(a,t)}G._unlockInitDataQueue()}else G._onFatalError(e)}},this._canceller.signal),void 0!==a.singleLicensePer&&"init-data"!==a.singleLicensePer||this._unlockInitDataQueue(),"created-session"!==N.type){e.next=67;break}return z=t.values.constructRequestData(),e.prev=54,e.next=57,i.loadedSessionsStore.generateLicenseRequest(U,t.type,z);case 57:e.next=67;break;case 59:if(e.prev=59,e.t0=e.catch(54),null!==(V=i.loadedSessionsStore.getEntryForSession(U))&&"none"===V.closingStatus.type){e.next=66;break}return(K=this._currentSessions.indexOf(O))>=0&&this._currentSessions.splice(K,1),e.abrupt("return",Promise.resolve());case 66:throw new g.Z("KEY_GENERATE_REQUEST_ERROR",e.t0 instanceof Error?e.t0.toString():"Unknown error");case 67:return e.abrupt("return",Promise.resolve());case 68:case"end":return e.stop()}}),e,this,[[54,59]])})));return function(t,n){return e.apply(this,arguments)}}(),n._tryToUseAlreadyCreatedSession=function(e,t){var n=t.stores,r=t.options,i=(0,_.Z)(this._currentSessions,(function(t){return t.record.isCompatibleWith(e)}));if(void 0===i)return!1;var a=i.blacklistedSessionError;if(!(0,E.Z)(a))return void 0===e.type||void 0===e.content?(u.Z.error("DRM: This initialization data has already been blacklisted but the current content is not known."),!0):(u.Z.info("DRM: This initialization data has already been blacklisted. Blacklisting the related content."),st(e.content.manifest,e),!0);if(void 0!==e.keyIds){var o;if(void 0===r.singleLicensePer||"init-data"===r.singleLicensePer){var s=i.keyStatuses.blacklisted;o=function(e,t){for(var n,r=function(){var e=n.value;if(t.some((function(t){return Q(t,e)})))return{v:!0}},i=Y(e);!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}return!1}(e.keyIds,s)}else{var l=i.keyStatuses.whitelisted;o=!J(e.keyIds,l)}if(o)return void 0===e.content?(u.Z.error("DRM: Cannot forbid key id, the content is unknown."),!0):(u.Z.info("DRM: Current initialization data is linked to blacklisted keys. Marking Representations as not decipherable"),ot(e.content.manifest,[],e.keyIds,[]),!0)}if(null!==n.loadedSessionsStore.reuse(e))return u.Z.debug("DRM: Init data already processed. Skipping it."),!0;var d=this._currentSessions.indexOf(i);return-1===d?u.Z.error("DRM: Unable to remove processed init data: not found."):(u.Z.debug("DRM: A session from a processed init data is not available anymore. Re-processing it."),this._currentSessions.splice(d,1)),!1},n._onFatalError=function(e){if(!this._canceller.isUsed){var t=e instanceof Error?e:new y.Z("NONE","Unknown decryption error");this.error=t,this._initDataQueue.length=0,this._stateData={state:nt.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===nt.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===nt.Disposed||this._stateData.state===nt.Error},n._processCurrentInitDataQueue=function(){for(;!1===this._stateData.isInitDataQueueLocked;){var e=this._initDataQueue.shift();if(void 0===e)return;this.onInitializationData(e)}},n._lockInitDataQueue=function(){!1===this._stateData.isInitDataQueueLocked&&(this._stateData.isInitDataQueueLocked=!0)},n._unlockInitDataQueue=function(){!0===this._stateData.isMediaKeysAttached?(this._stateData.isInitDataQueueLocked=!1,this._processCurrentInitDataQueue()):u.Z.error("DRM: Trying to unlock in the wrong state")},t}(S.Z);function at(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&(0,b.Z)(t,"persistent-license")}function ot(e,t,n,r){e.updateRepresentationsDeciperability((function(e){if(void 0===e.contentProtections)return e.decipherable;var i=e.contentProtections.keyIds;if(void 0!==i)for(var a,o=et(i);!(a=o()).done;){for(var s,u=a.value,l=et(n);!(s=l()).done;){if(Q(s.value,u.keyId))return!1}for(var d,c=et(t);!(d=c()).done;){if(Q(d.value,u.keyId))return!0}for(var f,v=et(r);!(f=v()).done;){if(Q(f.value,u.keyId))return}}return e.decipherable}))}function st(e,t){e.updateRepresentationsDeciperability((function(e){var n,r;if(!1===e.decipherable)return!1;for(var i,a=function(){var e=i.value;if((void 0===t.type||e.type===t.type)&&t.values.getFormattedValues().every((function(t){return e.values.some((function(e){return(void 0===t.systemId||e.systemId===t.systemId)&&(0,d.Z)(e.data,t.data)}))})))return{v:!1}},o=et(null!==(r=null===(n=e.contentProtections)||void 0===n?void 0:n.initData)&&void 0!==r?r:[]);!(i=o()).done;){var s=a();if("object"==typeof s)return s.v}return e.decipherable}))}function ut(e,t,n,r,i,a){for(var o,s,l=[].concat(i,a),d=function(){var e=s.value;l.some((function(t){return Q(t,e)}))||(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",(0,f.ci)(e)),l.push(e))},c=et(t.getAssociatedKeyIds());!(s=c()).done;)d();if(void 0!==n&&"init-data"!==n){var v=e.keyIds,p=e.content;if(void 0!==v){var h=v.filter((function(e){return!l.some((function(t){return Q(t,e)}))}));h.length>0&&(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: init data keys missing in the license, blacklisting them",h.map((function(e){return(0,f.ci)(e)})).join(", ")),l.push.apply(l,h))}if(r&&void 0!==p)if("content"===n){for(var m,g=new Set,y=et(p.manifest.periods);!(m=y()).done;){dt(g,m.value)}lt(g,l)}else if("periods"===n)for(var _,b=et(p.manifest.periods);!(_=b()).done;){var S=_.value,E=new Set;if(dt(E,S),(null===(o=e.content)||void 0===o?void 0:o.period.id)===S.id)lt(E,l);else for(var T=Array.from(E),w=function(){var e=A[k];if(l.some((function(t){return Q(t,e)})))return lt(E,l),"break"},k=0,A=T;k<A.length;k++){if("break"===w())break}}}return{whitelisted:i,blacklisted:l.slice(i.length)}}function lt(e,t){for(var n=Array.from(e.values()),r=function(){var e=a[i];t.some((function(t){return Q(t,e)}))||t.push(e)},i=0,a=n;i<a.length;i++)r()}function dt(e,t){for(var n,r=et(t.getAdaptations());!(n=r()).done;)for(var i,a=et(n.value.representations);!(i=a()).done;){var o=i.value;if(void 0!==o.contentProtections&&void 0!==o.contentProtections.keyIds)for(var s,u=et(o.contentProtections.keyIds);!(s=u()).done;){var l=s.value;e.add(l.keyId)}}}!function(e){e[e.Initializing=0]="Initializing",e[e.WaitingForAttachment=1]="WaitingForAttachment",e[e.ReadyForContent=2]="ReadyForContent",e[e.Error=3]="Error",e[e.Disposed=4]="Disposed"}(nt||(nt={}))},1266:function(e,t,n){"use strict";var r=n(1960);t.ZP=r.Z},770:function(e,t){"use strict";var n=new WeakMap;t.Z={setState:function(e,t){n.set(e,t)},getState:function(e){var t=n.get(e);return void 0===t?null:t},clearState:function(e){n.set(e,null)}}},9372:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(4578),i=n(5767),a=n(3887),o=n(5095),s=n(288),u=n(379),l=n(1757),d=n(8833),c=n(8799),f=n(6199),v=n(4576),p=function(e){function t(t){var n;return(n=e.call(this)||this)._settings=t,n._initCanceller=new s.ZP,n}(0,r.Z)(t,e);var n=t.prototype;return n.prepare=function(){},n.start=function(e,t){var n=this,r=this._initCanceller.signal,s=this._settings,u=s.keySystems,l=s.speed,d=s.url;if((0,i.Z)(e),null==d)throw new Error("No URL for a DirectFile content");var p=(0,o.ZP)(null);p.finish();var h=(0,c.Z)(e,u,p,{onError:function(e){return n._onFatalError(e)},onWarning:function(e){return n.trigger("warning",e)}},r);(0,v.Z)(e,(function(e){return n._onFatalError(e)}),r);var m=new f.Z(t,null,l);m.addEventListener("stalled",(function(e){return n.trigger("stalled",e)})),m.addEventListener("unstalled",(function(){return n.trigger("unstalled",null)})),m.addEventListener("warning",(function(e){return n.trigger("warning",e)})),r.register((function(){m.destroy()})),m.start(),h.onUpdate((function(o,s){"uninitialized"!==o.initializationState.type&&(s(),a.Z.info("Setting URL to HTMLMediaElement",d),e.src=d,r.register((function(){(0,i.Z)(e)})),"awaiting-media-link"===o.initializationState.type?(o.initializationState.value.isMediaLinked.setValue(!0),h.onUpdate((function(r,i){if("initialized"===r.initializationState.type)return i(),void n._seekAndPlay(e,t)}),{emitCurrentValue:!0,clearSignal:r})):n._seekAndPlay(e,t))}),{emitCurrentValue:!0,clearSignal:r})},n.updateContentUrls=function(e,t){throw new Error("Cannot update content URL of directfile contents")},n.dispose=function(){this._initCanceller.cancel()},n._onFatalError=function(e){this._initCanceller.cancel(),this.trigger("error",e)},n._seekAndPlay=function(e,t){var n=this,r=this._initCanceller.signal,i=this._settings,o=i.autoPlay,s=i.startAt;(0,d.Z)(e,t,(function(){a.Z.debug("Init: Calculating initial time");var t=function(e,t){if(null==t)return 0;if(null!=t.position)return t.position;if(null!=t.wallClockTime)return t.wallClockTime;if(null!=t.fromFirstPosition)return t.fromFirstPosition;var n=e.duration;if(null==n||!isFinite(n))return a.Z.warn("startAt.fromLastPosition set but no known duration, beginning at 0."),0;if("number"==typeof t.fromLastPosition)return Math.max(0,n+t.fromLastPosition);if(null!=t.percentage){var r=t.percentage;return r>=100?n:r<=0?0:n*(+r/100)}return 0}(e,s);return a.Z.debug("Init: Initial time calculated:",t),t}),o,(function(e){return n.trigger("warning",e)}),r).autoPlayResult.then((function(){return(0,l.Z)(t,e,!0,r).onUpdate((function(e,t){e&&(t(),n.trigger("loaded",{segmentBuffersStore:null}))}),{emitCurrentValue:!0,clearSignal:r})})).catch((function(e){r.isCancelled||n._onFatalError(e)}))},t}(u.K)},379:function(e,t,n){"use strict";n.d(t,{K:function(){return i}});var r=n(4578),i=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t}(n(1959).Z)},1757:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(3666);var i=n(1669),a=n(5095),o=n(288);function s(e,t,n,s){var u=new o.ZP({cancelOn:s}),l=(0,a.ZP)(!1,u.signal);return e.listen((function(e){if(null===e.rebuffering&&null===e.freezing&&0!==e.readyState)return!function(e,t){return!e||!r.SB||t}(n,t.hasAttribute("playsinline"))&&t.duration>0||e.readyState>=3&&null!==e.currentRange&&(!(0,i.Z)()||t.duration>0)?(l.setValue(!0),void u.cancel()):void 0}),{includeLastObservation:!0,clearSignal:u.signal}),l}},8833:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(1669),i=n(3774),a=n(3714),o=n(3887),s=n(5095);function u(e,t,n,u,l,d){var c,f,v=new Promise((function(e,t){c=e,f=t})),p=(0,s.$l)(!1,d),h=(0,s.$l)(!1,d);return e.addEventListener("loadedmetadata",m),e.readyState>=i.c.HAVE_METADATA&&m(),d.register((function(t){e.removeEventListener("loadedmetadata",m),f(t)})),{autoPlayResult:v,initialPlayPerformed:h,initialSeekPerformed:p};function m(){e.removeEventListener("loadedmetadata",m);var i="function"==typeof n?n():n;if(o.Z.info("Init: Set initial time",i),t.setCurrentTime(i),p.setValue(!0),p.finish(),(0,r.Z)()&&0===e.duration){var s=new a.Z("MEDIA_ERR_NOT_LOADED_METADATA","Cannot load automatically: your browser falsely announced having loaded the content.");l(s)}d.isCancelled||t.listen((function(t,n){!t.seeking&&null===t.rebuffering&&t.readyState>=1&&(n(),function(){var t,n;if(o.Z.info("Init: Can begin to play content"),!u)return e.autoplay&&o.Z.warn("Init: autoplay is enabled on HTML media element. Media will play as soon as possible."),h.setValue(!0),h.finish(),c({type:"skipped"});try{n=null!==(t=e.play())&&void 0!==t?t:Promise.resolve()}catch(e){return f(e)}n.then((function(){if(!d.isCancelled)return h.setValue(!0),h.finish(),c({type:"autoplay"})})).catch((function(e){if(!d.isCancelled){if(e instanceof Error&&"NotAllowedError"===e.name){o.Z.warn("Init: Media element can't play. It may be due to browser auto-play policies.");var t=new a.Z("MEDIA_ERR_BLOCKED_AUTOPLAY","Cannot trigger auto-play automatically: your browser does not allow it.");if(l(t),d.isCancelled)return;return c({type:"autoplay-blocked"})}f(e)}}))}())}),{includeLastObservation:!0,clearSignal:d})}}},8799:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(6139);var i=n(5157),a=n(3887),o=n(5095),s=n(288),u=n(1266),l=n(1960);function d(e,t,n,d,c){if(0===t.length){n.onUpdate((function(e,t){if(null!==e){t(),a.Z.error("Init: Encrypted event but EME feature not activated");var n=new i.Z("MEDIA_IS_ENCRYPTED_ERROR","EME feature not activated.");d.onError(n)}}),{clearSignal:c});var f=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return f.finish(),f}if("function"!=typeof r.N){n.onUpdate((function(e,t){if(null!==e){t(),a.Z.error("Init: Encrypted event but no EME API available");var n=new i.Z("MEDIA_IS_ENCRYPTED_ERROR","Encryption APIs not found.");d.onError(n)}}),{clearSignal:c});var v=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return v.finish(),v}var p=new s.ZP({cancelOn:c}),h=(0,o.ZP)({initializationState:{type:"uninitialized",value:null},drmSystemId:void 0},c);a.Z.debug("Init: Creating ContentDecryptor");var m=new u.ZP(e,t);return m.addEventListener("stateChange",(function(e){if(e===l.u.WaitingForAttachment){var t=(0,o.ZP)(!1);t.onUpdate((function(t,n){t&&(n(),e===l.u.WaitingForAttachment&&m.attach())}),{clearSignal:p.signal}),h.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:m.systemId})}else e===l.u.ReadyForContent&&(h.setValue({initializationState:{type:"initialized",value:null},drmSystemId:m.systemId}),m.removeEventListener("stateChange"))})),m.addEventListener("error",(function(e){p.cancel(),d.onError(e)})),m.addEventListener("warning",(function(e){d.onWarning(e)})),n.onUpdate((function(e){null!==e&&m.onInitializationData(e)}),{clearSignal:p.signal}),p.signal.register((function(){m.dispose()})),h}},6199:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(4578),i=n(3666).yS,a=n(6872),o=n(3714),s=n(3887),u=n(1959),l=n(2829),d=n(288),c=1/60,f=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._playbackObserver=t,i._manifest=n,i._speed=r,i._discontinuitiesStore=[],i._isStarted=!1,i._canceller=new d.ZP,i}(0,r.Z)(t,e);var n=t.prototype;return n.start=function(){var e=this;if(!this._isStarted){var t;this._isStarted=!0;var n,r=null,o=new h(this._playbackObserver,this._speed);this._canceller.signal.register((function(){o.dispose()})),this._playbackObserver.listen((function(u){var d,f,v=e._discontinuitiesStore,h=u.buffered,m=u.position,g=u.readyState,y=u.rebuffering,_=u.freezing,b=a.Z.getCurrent(),S=b.BUFFER_DISCONTINUITY_THRESHOLD,E=b.FORCE_DISCONTINUITY_SEEK_DELAY,T=b.FREEZING_STALLED_DELAY,w=b.UNFREEZING_SEEK_DELAY,k=b.UNFREEZING_DELTA_POSITION;if(!u.seeking&&i&&null===r&&null!==t&&u.position<t){s.Z.debug("Init: the device appeared to have seeked back by itself.");var A=performance.now();r=A}if(t=u.seeking?Math.max(null!==(d=u.pendingInternalSeek)&&void 0!==d?d:0,u.position):null,null!==_){var I=performance.now();if(I-(null===n?_.timestamp:n.attemptTimestamp)>w&&(s.Z.warn("Init: trying to seek to un-freeze player"),e._playbackObserver.setCurrentTime(e._playbackObserver.getCurrentTime()+k),n={attemptTimestamp:I}),I-_.timestamp>T)return null===y||null!==r?o.stopRebuffering():o.startRebuffering(),void e.trigger("stalled","freezing")}else n=null;if(null===y)return o.stopRebuffering(),1===g?(f=u.seeking?null!==u.pendingInternalSeek?"internal-seek":"seeking":"not-ready",void e.trigger("stalled",f)):void e.trigger("unstalled",null);var R="seeking"===y.reason&&null!==u.pendingInternalSeek?"internal-seek":y.reason;if(null!==r){var Z=performance.now();if(Z-r<E)return o.stopRebuffering(),s.Z.debug("Init: letting the device get out of a stall by itself"),void e.trigger("stalled",R);s.Z.warn("Init: ignored stall for too long, checking discontinuity",Z-r)}if(r=null,o.startRebuffering(),null!==e._manifest){var x=y.position;if(null!=x&&e._speed.getValue()>0){var P=function(e,t,n){if(0===e.length)return null;for(var r=null,i=0;i<e.length;i++){var a=e[i].period;if(a.start>n)return r;var o=void 0;if(void 0===a.end||a.end>n){var u=e[i],l=u.discontinuity,d=u.position,f=l.start,v=l.end;if(n>=(null!=f?f:d)-c)if(null===v){var p=t.getPeriodAfter(a);null!==p?o=p.start+c:s.Z.warn("Init: discontinuity at Period's end but no next Period")}else n<v+c&&(o=v+c);void 0!==o&&(s.Z.info("Init: discontinuity found",n,o),r=null!==r&&r>o?r:o)}}return r}(v,e._manifest,x);if(null!==P){var M=P+.001;if(!(M<=e._playbackObserver.getCurrentTime()))return s.Z.warn("SA: skippable discontinuity found in the stream",m,M),e._playbackObserver.setCurrentTime(M),void e.trigger("warning",p(x,M));s.Z.info("Init: position to seek already reached, no seeking",e._playbackObserver.getCurrentTime(),M)}}var C=null!=x?x:m,D=(0,l.XS)(h,C);if(e._speed.getValue()>0&&D<S){var N=C+D+c;if(e._playbackObserver.getCurrentTime()<N)return s.Z.warn("Init: discontinuity encountered inferior to the threshold",C,N,S),e._playbackObserver.setCurrentTime(N),void e.trigger("warning",p(C,N))}for(var O=e._manifest.periods.length-2;O>=0;O--){var L=e._manifest.periods[O];if(void 0!==L.end&&L.end<=C){if(e._manifest.periods[O+1].start>C&&e._manifest.periods[O+1].start>e._playbackObserver.getCurrentTime()){var U=e._manifest.periods[O+1];return e._playbackObserver.setCurrentTime(U.start),void e.trigger("warning",p(C,U.start))}break}}e.trigger("stalled",R)}else e.trigger("stalled",R)}),{includeLastObservation:!0,clearSignal:this._canceller.signal})}},n.updateDiscontinuityInfo=function(e){this._isStarted||this.start();var t=this._playbackObserver.getReference().getValue();!function(e,t,n){for(;e.length>0&&void 0!==e[0].period.end&&e[0].period.end+10<n.position;)e.shift();var r=t.period,i=t.bufferType;if("audio"!==i&&"video"!==i)return;for(var a=0;a<e.length;a++)if(e[a].period.id===r.id){if(e[a].bufferType===i)return void(v(t)?e[a]=t:e.splice(a,1))}else if(e[a].period.start>r.start)return void(v(t)&&e.splice(a,0,t));v(t)&&e.push(t)}(this._discontinuitiesStore,e,t)},n.onLockedStream=function(e,t){var n;this._isStarted||this.start();var r=this._playbackObserver.getReference().getValue();if(!(!r.rebuffering||r.paused||this._speed.getValue()<=0||"audio"!==e&&"video"!==e)){var i=r.position,a=null!==(n=r.rebuffering.position)&&void 0!==n?n:i,o=t.start;i<o&&Math.abs(a-o)<1&&(s.Z.warn("Init: rebuffering because of a future locked stream.\nTrying to unlock by seeking to the next Period"),this._playbackObserver.setCurrentTime(o+.001))}},n.destroy=function(){this._canceller.cancel()},t}(u.Z);function v(e){return null!==e.discontinuity}function p(e,t){return new o.Z("DISCONTINUITY_ENCOUNTERED","A discontinuity has been encountered at position "+String(e)+", seeked at position "+String(t))}var h=function(){function e(e,t){this._speedUpdateCanceller=new d.ZP,this._isRebuffering=!1,this._playbackObserver=e,this._isDisposed=!1,this._speed=t,this._updateSpeed()}var t=e.prototype;return t.startRebuffering=function(){this._isRebuffering||this._isDisposed||(this._isRebuffering=!0,this._speedUpdateCanceller.cancel(),s.Z.info("Init: Pause playback to build buffer"),this._playbackObserver.setPlaybackRate(0))},t.stopRebuffering=function(){this._isRebuffering&&!this._isDisposed&&(this._isRebuffering=!1,this._speedUpdateCanceller=new d.ZP,this._updateSpeed())},t.dispose=function(){this._speedUpdateCanceller.cancel(),this._isDisposed=!0},t._updateSpeed=function(){var e=this;this._speed.onUpdate((function(t){s.Z.info("Init: Resume playback speed",t),e._playbackObserver.setPlaybackRate(t)}),{clearSignal:this._speedUpdateCanceller.signal,emitCurrentValue:!0})},e}()},4576:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3714),i=n(1946);function a(e,t,n){function a(){var n,a,o=e.error;switch((0,i.Z)(o)||(n=o.code,a=o.message),n){case 1:return a=null!=a?a:"The fetching of the associated resource was aborted by the user's request.",t(new r.Z("MEDIA_ERR_ABORTED",a));case 2:return a=null!=a?a:"A network error occurred which prevented the media from being successfully fetched",t(new r.Z("MEDIA_ERR_NETWORK",a));case 3:return a=null!=a?a:"An error occurred while trying to decode the media resource",t(new r.Z("MEDIA_ERR_DECODE",a));case 4:return a=null!=a?a:"The media resource has been found to be unsuitable.",t(new r.Z("MEDIA_ERR_SRC_NOT_SUPPORTED",a));default:return a=null!=a?a:"The HTMLMediaElement errored due to an unknown reason.",t(new r.Z("MEDIA_ERR_UNKNOWN",a))}}n.isCancelled||(e.addEventListener("error",a),n.register((function(){e.removeEventListener("error",a)})))}},5192:function(e,t,n){"use strict";n.d(t,{Z:function(){return w}});var r=n(4578),i=n(3038),a=n(3887),o=n(5095),s=n(2203).Z?void 0:window.ResizeObserver;var u=n(6872),l=n(288),d=n(9612),c=n(4309),f=n(7874);function v(e,t){return Math.abs(e-t)<=.2}function p(e,t){for(var n=e.length-1;n>=0;n--){if(e[n].start<t)return e.slice(0,n+1)}return[]}function h(e,t){for(var n=0;n<e.length;n++){if(e[n].end>t)return e.slice(n,e.length)}return[]}function m(e,t,n){var r=Math.max(e.start,t),i=p(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=h(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var g=function(){function e(){this._cuesBuffer=[]}var t=e.prototype;return t.get=function(e){for(var t=this._cuesBuffer,n=[],r=t.length-1;r>=0;r--){var i=t[r];if(e<i.end&&e>=i.start){for(var a=i.cues,o=0;o<a.length;o++)e>=a[o].start&&e<a[o].end&&n.push(a[o].element);return n}}return[]},t.remove=function(e,t){for(var n=Math.max(e,t),r=this._cuesBuffer,i=0;i<r.length;i++)if(r[i].end>e){var a=r[i];if(a.start>=n)return;if(a.end>=n){if(e<=a.start)a.cues=h(a.cues,n),a.start=n;else{var o=m(a,e,n),s=o[0],u=o[1];this._cuesBuffer[i]=s,r.splice(i+1,0,u)}return}a.start>=e?(r.splice(i,1),i--):(a.cues=p(a.cues,e),a.end=Math.max(e,a.start))}},t.insert=function(e,t,n){var r=this._cuesBuffer,i={start:t,end:n,cues:e};function a(e){var t=r[e];void 0===t||v(i.end,t.end)?r[e]=i:(t.start>=i.end||(t.cues=h(t.cues,i.end),t.start=i.end),r.splice(e,0,i))}for(var o=0;o<r.length;o++){var s=r[o];if(t<s.end){if(v(t,s.start)){if(v(n,s.end))return void(r[o]=i);if(n<s.end)return s.cues=h(s.cues,n),s.start=n,void r.splice(o,0,i);do{r.splice(o,1),s=r[o]}while(void 0!==s&&n>s.end);return void a(o)}if(t<s.start){if(n<s.start)return void r.splice(o,0,i);if(v(n,s.start))return s.start=n,void r.splice(o,0,i);if(v(n,s.end))return void r.splice(o,1,i);if(n<s.end)return s.cues=h(s.cues,n),s.start=n,void r.splice(o,0,i);do{r.splice(o,1),s=r[o]}while(void 0!==s&&n>s.end);return void a(o)}if(v(s.end,n))return s.cues=p(s.cues,t),s.end=t,void r.splice(o+1,0,i);if(s.end>n){var u=m(s,t,n),l=u[0],d=u[1];return this._cuesBuffer[o]=l,r.splice(o+1,0,i),void r.splice(o+2,0,d)}s.cues=p(s.cues,t),s.end=t;var c=o+1;for(s=r[c];void 0!==s&&n>s.end;)r.splice(c,1),s=r[c];return void a(c)}}r.push(i)},e}();function y(e,t,n,r){for(var i=[t/n.columns,e/n.rows],a=r.getElementsByClassName("proportional-style"),o=0;o<a.length;o++){var s=a[o];if(s instanceof HTMLElement){var u=s.getAttribute("data-proportional-font-size");null===u||isNaN(+u)||(s.style.fontSize=String(+u*i[1])+"px");var l=s.getAttribute("data-proportional-width");null===l||isNaN(+l)||(s.style.width=String(+l*i[0])+"px");var d=s.getAttribute("data-proportional-height");null===d||isNaN(+d)||(s.style.height=String(+d*i[1])+"px");var c=s.getAttribute("data-proportional-line-height");null===c||isNaN(+c)||(s.style.lineHeight=String(+c*i[1])+"px");var f=s.getAttribute("data-proportional-left");null===f||isNaN(+f)||(s.style.left=String(+f*i[0])+"px");var v=s.getAttribute("data-proportional-top");null===v||isNaN(+v)||(s.style.top=String(+v*i[1])+"px");var p=s.getAttribute("data-proportional-padding-top");null===p||isNaN(+p)||(s.style.paddingTop=String(+p*i[1])+"px");var h=s.getAttribute("data-proportional-padding-bottom");null===h||isNaN(+h)||(s.style.paddingBottom=String(+h*i[1])+"px");var m=s.getAttribute("data-proportional-padding-left");null===m||isNaN(+m)||(s.style.paddingLeft=String(+m*i[0])+"px");var g=s.getAttribute("data-proportional-padding-right");null===g||isNaN(+g)||(s.style.paddingRight=String(+g*i[0])+"px")}}return a.length>0}var _=i.M4,b=i.bQ,S=i.Q$;function E(e,t){try{e.removeChild(t)}catch(e){a.Z.warn("HTSB: Can't remove text track: not in the element.")}}function T(e){var t=e.getAttribute("data-resolution-rows"),n=e.getAttribute("data-resolution-columns");if(null===t||null===n)return null;var r=parseInt(t,10),i=parseInt(n,10);return null===r||null===i?null:{rows:r,columns:i}}var w=function(e){function t(t,n){var r;return a.Z.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new c.Z,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new l.ZP,r._canceller=new l.ZP,r._buffer=new g,r._currentCues=[],r.autoRefreshSubtitles(r._canceller.signal),r}(0,r.Z)(t,e);var n=t.prototype;return n.pushChunk=function(e){try{this.pushChunkSync(e)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this.removeBufferSync(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("HTSB: Disposing HTMLTextSegmentBuffer"),this._disableCurrentCues(),this._buffer.remove(0,1/0),this._buffered.remove(0,1/0),this._canceller.cancel()},n.pushChunkSync=function(e){var t,n;a.Z.debug("HTSB: Appending new html text tracks");var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk;if(null!==s){var u,l,d=s.start,c=s.end,v=s.data,p=s.type,h=s.language,m=null!==(t=o[0])&&void 0!==t?t:0,g=null!==(n=o[1])&&void 0!==n?n:1/0,y=function(e,t,n,r){a.Z.debug("HTSB: Finding parser for html text tracks:",e);var i=f.Z.htmlTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("HTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("HTTB: Parsed successfully!",o.length),o}(p,v,i,h);if(0!==m&&g!==1/0){for(var _=0;_<y.length&&y[_].end<=m;)_++;for(y.splice(0,_),_=0;_<y.length&&y[_].start<m;)y[_].start=m,_++;for(_=y.length-1;_>=0&&y[_].start>=g;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].end>g;)y[_].end=g,_--}if(void 0!==d)u=Math.max(m,d);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor start time. Aborting");a.Z.warn("HTSB: No start time given. Guessing from cues."),u=y[0].start}if(void 0!==c)l=Math.min(g,c);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor end time. Aborting");a.Z.warn("HTSB: No end time given. Guessing from cues."),l=y[y.length-1].end}l<=u?a.Z.warn("HTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."):(null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos),this._buffer.insert(y,u,l),this._buffered.insert(u,l))}},n.removeBufferSync=function(e,t){a.Z.debug("HTSB: Removing html text track data",e,t),this._buffer.remove(e,t),this._buffered.remove(e,t)},n._disableCurrentCues=function(){if(this._sizeUpdateCanceller.cancel(),this._currentCues.length>0){for(var e=0;e<this._currentCues.length;e++)E(this._textTrackElement,this._currentCues[e].element);this._currentCues=[]}},n._displayCues=function(e){if(!(this._currentCues.length===e.length&&this._currentCues.every((function(t,n){return t.element===e[n]})))){this._sizeUpdateCanceller.cancel();for(var t=0;t<this._currentCues.length;t++)E(this._textTrackElement,this._currentCues[t].element);this._currentCues=[];for(var n=0;n<e.length;n++){var r=e[n],i=T(r);this._currentCues.push({element:r,resolution:i}),this._textTrackElement.appendChild(r)}var d=this._currentCues.filter((function(e){return null!==e.resolution}));if(d.length>0){this._sizeUpdateCanceller=new l.ZP({cancelOn:this._canceller.signal});var c=u.Z.getCurrent().TEXT_TRACK_SIZE_CHECKS_INTERVAL,f=function(e,t,n){var r=e.getBoundingClientRect(),i=r.height,u=r.width,l=(0,o.ZP)({height:i,width:u},n),d=i,c=u;if(void 0!==s){var f=new s((function(e){if(0!==e.length){var t=e[0].contentRect,n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}else a.Z.error("Compat: Resized but no observed element.")}));f.observe(e),n.register((function(){f.disconnect()}))}else{var v=setInterval((function(){var t=e.getBoundingClientRect(),n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}),t);n.register((function(){clearInterval(v)}))}return l}(this._textTrackElement,c,this._sizeUpdateCanceller.signal);f.onUpdate((function(e){for(var t=e.height,n=e.width,r=0;r<d.length;r++){var i=d[r];y(t,n,i.resolution,i.element)}}),{clearSignal:this._sizeUpdateCanceller.signal,emitCurrentValue:!0})}}},n.autoRefreshSubtitles=function(e){var t=this,n=null,r=u.Z.getCurrent().MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL,i=function(){a(),n=new l.ZP({cancelOn:e});var i=setInterval((function(){return t.refreshSubtitles()}),r);n.signal.register((function(){clearInterval(i)})),t.refreshSubtitles()};function a(){null!==n&&(n.cancel(),n=null)}S(this._videoElement,(function(){a(),t._disableCurrentCues()}),e),b(this._videoElement,i,e),_(this._videoElement,i,e),i()},n.refreshSubtitles=function(){var e,t=u.Z.getCurrent().MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL;e=this._videoElement.paused||this._videoElement.playbackRate<=0?this._videoElement.currentTime:Math.max(this._videoElement.currentTime+t/1e3/2,0);var n=this._buffer.get(e);0===n.length?this._disableCurrentCues():this._displayCues(n)},t}(d.C)},9059:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(4578),i=n(3666);var a=n(3887);function o(e,t){if(i.vU&&function(e,t){var n=e.activeCues;if(null===n)return!1;for(var r=0;r<n.length;r++)if(n[r]===t)return!0;return!1}(e,t)){var n=e.mode;e.mode="hidden";try{e.removeCue(t)}catch(e){a.Z.warn("Compat: Could not remove cue from text track.")}e.mode=n}else try{e.removeCue(t)}catch(e){a.Z.warn("Compat: Could not remove cue from text track.")}}var s=n(9612),u=n(4309),l=n(7874);var d=function(e){function t(t){var n;a.Z.debug("NTSB: Creating NativeTextSegmentBuffer"),n=e.call(this)||this;var r=function(e){var t,n,r,a="subtitles";if(i.YM){var o=e.textTracks.length;(n=o>0?e.textTracks[o-1]:e.addTextTrack(a)).mode=null!==(t=n.SHOWING)&&void 0!==t?t:"showing"}else r=document.createElement("track"),e.appendChild(r),n=r.track,r.kind=a,n.mode="showing";return{track:n,trackElement:r}}(t),o=r.track,s=r.trackElement;return n.bufferType="text",n._buffered=new u.Z,n._videoElement=t,n._track=o,n._trackElement=s,n}(0,r.Z)(t,e);var n=t.prototype;return n.pushChunk=function(e){var t,n;if(a.Z.debug("NTSB: Appending new native text tracks"),null===e.data.chunk)return Promise.resolve();var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk,u=s.start,d=s.end,c=s.data,f=s.type,v=s.language,p=null!==(t=o[0])&&void 0!==t?t:0,h=null!==(n=o[1])&&void 0!==n?n:1/0;try{var m,g,y=function(e,t,n,r){a.Z.debug("NTSB: Finding parser for native text tracks:",e);var i=l.Z.nativeTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("NTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("NTSB: Parsed successfully!",o.length),o}(f,c,i,v);if(0!==p&&h!==1/0){for(var _=0;_<y.length&&y[_].endTime<=p;)_++;for(y.splice(0,_),_=0;_<y.length&&y[_].startTime<p;)y[_].startTime=p,_++;for(_=y.length-1;_>=0&&y[_].startTime>=h;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].endTime>h;)y[_].endTime=h,_--}if(void 0!==u)m=Math.max(p,u);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor start time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No start time given. Guessing from cues."),m=y[0].startTime}if(void 0!==d)g=Math.min(h,d);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor end time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No end time given. Guessing from cues."),g=y[y.length-1].endTime}if(g<=m)return a.Z.warn("NTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."),Promise.resolve();if(y.length>0){var b=y[0],S=this._track.cues;null!==S&&S.length>0&&b.startTime<S[S.length-1].startTime&&this._removeData(b.startTime,1/0);for(var E=0;E<y.length;E++)this._track.addCue(y[E])}this._buffered.insert(m,g),null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this._removeData(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("NTSB: Aborting NativeTextSegmentBuffer"),this._removeData(0,1/0);var e=this._trackElement,t=this._videoElement;if(void 0!==e&&t.hasChildNodes())try{t.removeChild(e)}catch(e){a.Z.warn("NTSB: Can't remove track element from the video")}this._track.mode="disabled",void 0!==this._trackElement&&(this._trackElement.innerHTML="")},n._removeData=function(e,t){a.Z.debug("NTSB: Removing native text track data",e,t);var n=this._track,r=n.cues;if(null!==r)for(var i=r.length-1;i>=0;i--){var s=r[i],u=s.startTime,l=s.endTime;u>=e&&u<=t&&l<=t&&o(n,s)}this._buffered.remove(e,t)},t}(s.C)},9612:function(e,t,n){"use strict";n.d(t,{C:function(){return _},f:function(){return g}});var r=n(6872),i=n(3887),a=n(520),o=n(5278);function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var l=function(){function e(e,t){this._history=[],this._lifetime=e,this._maxHistoryLength=t}var t=e.prototype;return t.addBufferedSegment=function(e,t){var n=performance.now();this._history.push({date:n,buffered:t,context:e}),this._cleanHistory(n)},t.getHistoryFor=function(e){return this._history.filter((function(t){return(0,a.z)(t.context,e)}))},t._cleanHistory=function(e){for(var t,n=e-this._lifetime,r=0,i=s(this._history);!(t=i()).done;){if(!(t.value.date<n))break;r++}if(r>0&&(this._history=this._history.splice(r)),this._history.length>this._maxHistoryLength){var a=this._history.length-this._maxHistoryLength;this._history=this._history.splice(a)}},e}();function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f=function(){function e(){var e=r.Z.getCurrent(),t=e.BUFFERED_HISTORY_RETENTION_TIME,n=e.BUFFERED_HISTORY_MAXIMUM_ENTRIES;this._inventory=[],this._bufferedHistory=new l(t,n)}var t=e.prototype;return t.reset=function(){this._inventory.length=0},t.synchronizeBuffered=function(e){for(var t=this._inventory,n=0,a=t[0],s=r.Z.getCurrent().MINIMUM_SEGMENT_SIZE,u=null==a?void 0:a.infos.adaptation.type,l=e.length,c=0;c<l;c++){if(void 0===a)return;var f=e.start(c),v=e.end(c);if(v-f<s)i.Z.warn("SI: skipped TimeRange when synchronizing because it was too small",u,f,v);else{for(var p=n;void 0!==a&&(0,o.Z)(a.bufferedEnd,a.end)-f<s;)a=t[++n];var g=null,y=n-p;if(y>0){var _=t[p+y-1];g={end:(0,o.Z)(_.bufferedEnd,_.end),precizeEnd:_.precizeEnd},i.Z.debug("SI: "+y+" segments GCed.",u);for(var b,S=d(t.splice(p,y));!(b=S()).done;){var E=b.value;void 0===E.bufferedStart&&void 0===E.bufferedEnd&&this._bufferedHistory.addBufferedSegment(E.infos,null)}n=p}if(void 0===a)return;if(v-(0,o.Z)(a.bufferedStart,a.start)>=s){if(h(a,f,g,u),n===t.length-1)return void m(a,v,u);a=t[++n];for(var T=(0,o.Z)(a.bufferedStart,a.start),w=(0,o.Z)(a.bufferedEnd,a.end),k=c<l-1?e.start(c+1):void 0;void 0!==a&&v-T>=s&&(void 0===k||v-T>=w-k);){var A=t[n-1];void 0===A.bufferedEnd&&(A.bufferedEnd=a.precizeStart?a.start:A.end,i.Z.debug("SI: calculating buffered end of contiguous segment",u,A.bufferedEnd,A.end)),a.bufferedStart=A.bufferedEnd,void 0!==(a=t[++n])&&(T=(0,o.Z)(a.bufferedStart,a.start),w=(0,o.Z)(a.bufferedEnd,a.end))}}var I=t[n-1];void 0!==I&&m(I,v,u)}}if(null!=a){i.Z.debug("SI: last segments have been GCed",u,n,t.length);for(var R,Z=d(t.splice(n,t.length-n));!(R=Z()).done;){var x=R.value;void 0===x.bufferedStart&&void 0===x.bufferedEnd&&this._bufferedHistory.addBufferedSegment(x.infos,null)}}void 0!==u&&i.Z.hasLevel("DEBUG")&&i.Z.debug("SI: current "+u+" inventory timeline:\n"+function(e){var t=1/60,n={},r=[],i=null,a=null;function o(e){var t=String.fromCharCode(r.length+65);return r.push({letter:t,periodId:e.period.id,representationId:e.representation.id,bitrate:e.representation.bitrate}),t}for(var s="",u=0;u<e.length;u++){var l=e[u];if(void 0!==l.bufferedStart&&void 0!==l.bufferedEnd){var d,c=l.infos.period.id,f=l.infos.representation.id,v=n[c],p=void 0;if(void 0===v)p=o(l.infos),n[c]=((d={})[f]=p,d);else void 0===v[f]?(p=o(l.infos),v[f]=p):p=v[f];null===i?s+=l.bufferedStart.toFixed(2)+"|"+p+"|":a===p?i.bufferedEnd+t<l.bufferedStart&&(s+=i.bufferedEnd.toFixed(2)+" ~ "+l.bufferedStart.toFixed(2)+"|"+p+"|"):s+=i.bufferedEnd.toFixed(2)+" ~ "+l.bufferedStart.toFixed(2)+"|"+p+"|",i=l,a=p}}null!==i&&(s+=String(i.end.toFixed(2)));return r.forEach((function(e){var t;s+="\n["+e.letter+"] P: "+e.periodId+" || R: "+e.representationId+"("+(null!==(t=e.bitrate)&&void 0!==t?t:"unknown bitrate")+")"})),s}(this._inventory))},t.insertChunk=function(e){var t=e.period,n=e.adaptation,r=e.representation,a=e.segment,o=e.chunkSize,s=e.start,u=e.end;if(!a.isInit){var l=n.type;if(s>=u)i.Z.warn("SI: Invalid chunked inserted: starts before it ends",l,s,u);else{for(var d=this._inventory,c={partiallyPushed:!0,chunkSize:o,splitted:!1,start:s,end:u,precizeStart:!1,precizeEnd:!1,bufferedStart:void 0,bufferedEnd:void 0,infos:{segment:a,period:t,adaptation:n,representation:r}},f=d.length-1;f>=0;f--){var v=d[f];if(v.start<=s){if(v.end<=s){for(i.Z.debug("SI: Pushing segment strictly after previous one.",l,s,v.end),this._inventory.splice(f+1,0,c),f+=2;f<d.length&&d[f].start<c.end;){if(d[f].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}if(v.start===s){if(v.end<=u){for(i.Z.debug("SI: Segment pushed replace another one",l,s,u,v.end),this._inventory.splice(f,1,c),f+=1;f<d.length&&d[f].start<c.end;){if(d[f].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}return i.Z.debug("SI: Segment pushed ends before another with the same start",l,s,u,v.end),d.splice(f,0,c),v.start=c.end,v.bufferedStart=void 0,void(v.precizeStart=v.precizeStart&&c.precizeEnd)}if(v.end<=c.end){for(i.Z.debug("SI: Segment pushed updates end of previous one",l,s,u,v.start,v.end),this._inventory.splice(f+1,0,c),v.end=c.start,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,f+=2;f<d.length&&d[f].start<c.end;){if(d[f].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}i.Z.warn("SI: Segment pushed is contained in a previous one",l,s,u,v.start,v.end);var p={partiallyPushed:v.partiallyPushed,chunkSize:v.chunkSize,splitted:!0,start:c.end,end:v.end,precizeStart:v.precizeStart&&v.precizeEnd&&c.precizeEnd,precizeEnd:v.precizeEnd,bufferedStart:void 0,bufferedEnd:v.end,infos:v.infos};return v.end=c.start,v.splitted=!0,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,d.splice(f+1,0,c),void d.splice(f+2,0,p)}}var h=this._inventory[0];if(void 0===h)return i.Z.debug("SI: first segment pushed",l,s,u),void this._inventory.push(c);if(!(h.start>=u)){if(h.end<=u){for(i.Z.debug("SI: Segment pushed starts before and completely recovers the previous first one",l,s,u,h.start,h.end),this._inventory.splice(0,1,c);d.length>1&&d[1].start<c.end;){if(d[1].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[1].start),d[1].start=c.end,d[1].bufferedStart=void 0,void(d[1].precizeStart=c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[1].start,d[1].end),d.splice(1,1)}return}return i.Z.debug("SI: Segment pushed start of the next one",l,s,u,h.start,h.end),h.start=u,h.bufferedStart=void 0,h.precizeStart=c.precizeEnd,void this._inventory.splice(0,0,c)}i.Z.debug("SI: Segment pushed comes before all previous ones",l,s,u,h.start),this._inventory.splice(0,0,c)}}},t.completeSegment=function(e,t){if(!e.segment.isInit){for(var n=this._inventory,r=[],o=0;o<n.length;o++)if((0,a.z)(n[o].infos,e)){var s=!1;r.length>0&&(s=!0,1===r.length&&(i.Z.warn("SI: Completed Segment is splitted.",e.segment.id,e.segment.time,e.segment.end),r[0].splitted=!0));var u=o,l=n[o].chunkSize;for(o+=1;o<n.length&&(0,a.z)(n[o].infos,e);){var c=n[o].chunkSize;void 0!==l&&void 0!==c&&(l+=c),o++}var f=o-1,v=f-u,p=n[f].end,h=n[f].bufferedEnd;v>0&&(this._inventory.splice(u+1,v),o-=v),this._inventory[u].partiallyPushed=!1,this._inventory[u].chunkSize=l,this._inventory[u].end=p,this._inventory[u].bufferedEnd=h,this._inventory[u].splitted=s,r.push(this._inventory[u])}if(0===r.length)i.Z.warn("SI: Completed Segment not found",e.segment.id,e.segment.time);else{this.synchronizeBuffered(t);for(var m,g=d(r);!(m=g()).done;){var y=m.value;void 0!==y.bufferedStart&&void 0!==y.bufferedEnd?this._bufferedHistory.addBufferedSegment(y.infos,{start:y.bufferedStart,end:y.bufferedEnd}):i.Z.debug("SI: buffered range not known after sync. Skipping history.",y.start,y.end)}}}},t.getInventory=function(){return this._inventory},t.getHistoryFor=function(e){return this._bufferedHistory.getHistoryFor(e)},e}();function v(e){if(void 0===e.bufferedStart||e.partiallyPushed)return!1;var t=e.start,n=e.end-t,i=r.Z.getCurrent(),a=i.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,o=i.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(t-e.bufferedStart)<=a&&(void 0===e.bufferedEnd||e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-n)<=Math.min(o,n/3))}function p(e){if(void 0===e.bufferedEnd||e.partiallyPushed)return!1;var t=e.start,n=e.end,i=n-t,a=r.Z.getCurrent(),o=a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,s=a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(n-e.bufferedEnd)<=o&&null!=e.bufferedStart&&e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-i)<=Math.min(s,i/3)}function h(e,t,n,a){var o=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedStart?(e.bufferedStart<t&&(i.Z.debug("SI: Segment partially GCed at the start",a,e.bufferedStart,t),e.bufferedStart=t),!e.precizeStart&&v(e)&&(e.start=e.bufferedStart,e.precizeStart=!0)):e.precizeStart?(i.Z.debug("SI: buffered start is precize start",a,e.start),e.bufferedStart=e.start):null!==n&&n.end>t&&(n.precizeEnd||e.start-n.end<=o)?(i.Z.debug("SI: buffered start is end of previous segment",a,t,e.start,n.end),e.bufferedStart=n.end,v(e)&&(e.start=n.end,e.precizeStart=!0)):e.start-t<=o?(i.Z.debug("SI: found true buffered start",a,t,e.start),e.bufferedStart=t,v(e)&&(e.start=t,e.precizeStart=!0)):t<e.start?i.Z.debug("SI: range start too far from expected start",a,t,e.start):(i.Z.debug("SI: Segment appears immediately garbage collected at the start",a,e.bufferedStart,t),e.bufferedStart=t)}function m(e,t,n){var a=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedEnd?(e.bufferedEnd>t&&(i.Z.debug("SI: Segment partially GCed at the end",n,e.bufferedEnd,t),e.bufferedEnd=t),!e.precizeEnd&&t-e.end<=a&&p(e)&&(e.precizeEnd=!0,e.end=t)):e.precizeEnd?(i.Z.debug("SI: buffered end is precize end",n,e.end),e.bufferedEnd=e.end):t-e.end<=a?(i.Z.debug("SI: found true buffered end",n,t,e.end),e.bufferedEnd=t,p(e)&&(e.end=t,e.precizeEnd=!0)):t>e.end?(i.Z.debug("SI: range end too far from expected end",n,t,e.end),e.bufferedEnd=e.end):(i.Z.debug("SI: Segment appears immediately garbage collected at the end",n,e.bufferedEnd,t),e.bufferedEnd=t)}var g,y=f,_=function(){function e(){this._segmentInventory=new y}var t=e.prototype;return t.synchronizeInventory=function(){this._segmentInventory.synchronizeBuffered(this.getBufferedRanges())},t.getInventory=function(){return this._segmentInventory.getInventory()},t.getPendingOperations=function(){return[]},t.getSegmentHistory=function(e){return this._segmentInventory.getHistoryFor(e)},e}();!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(g||(g={}))},4309:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2829),i=function(){function e(){this._ranges=[],this.length=0}var t=e.prototype;return t.insert=function(e,t){(0,r.kR)(this._ranges,{start:e,end:t}),this.length=this._ranges.length},t.remove=function(e,t){var n=[];e>0&&n.push({start:0,end:e}),t<1/0&&n.push({start:t,end:1/0}),this._ranges=(0,r.tn)(this._ranges,n),this.length=this._ranges.length},t.start=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].start},t.end=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].end},e}()},7839:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a){var o;return o=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(o),t.prototype),o.name="CustomLoaderError",o.message=n,o.canRetry=i,o.xhr=a,o}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},5157:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;return u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="EncryptedMediaError",u.type=o.ZB.ENCRYPTED_MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1,"string"==typeof(null==a?void 0:a.keyStatuses)&&(u.keyStatuses=a.keyStatuses),u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},5992:function(e,t,n){"use strict";n.d(t,{SM:function(){return a},ZB:function(){return r},br:function(){return i}});var r={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"},i={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"},a={PIPELINE_LOAD_ERROR:"PIPELINE_LOAD_ERROR",PIPELINE_PARSE_ERROR:"PIPELINE_PARSE_ERROR",INTEGRITY_ERROR:"INTEGRITY_ERROR",MANIFEST_PARSE_ERROR:"MANIFEST_PARSE_ERROR",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"MANIFEST_INCOMPATIBLE_CODECS_ERROR",MANIFEST_UPDATE_ERROR:"MANIFEST_UPDATE_ERROR",MANIFEST_UNSUPPORTED_ADAPTATION_TYPE:"MANIFEST_UNSUPPORTED_ADAPTATION_TYPE",MEDIA_STARTING_TIME_NOT_FOUND:"MEDIA_STARTING_TIME_NOT_FOUND",MEDIA_TIME_BEFORE_MANIFEST:"MEDIA_TIME_BEFORE_MANIFEST",MEDIA_TIME_AFTER_MANIFEST:"MEDIA_TIME_AFTER_MANIFEST",MEDIA_TIME_NOT_FOUND:"MEDIA_TIME_NOT_FOUND",NO_PLAYABLE_REPRESENTATION:"NO_PLAYABLE_REPRESENTATION",MEDIA_IS_ENCRYPTED_ERROR:"MEDIA_IS_ENCRYPTED_ERROR",CREATE_MEDIA_KEYS_ERROR:"CREATE_MEDIA_KEYS_ERROR",KEY_ERROR:"KEY_ERROR",KEY_STATUS_CHANGE_ERROR:"KEY_STATUS_CHANGE_ERROR",KEY_UPDATE_ERROR:"KEY_UPDATE_ERROR",KEY_LOAD_ERROR:"KEY_LOAD_ERROR",KEY_LOAD_TIMEOUT:"KEY_LOAD_TIMEOUT",KEY_GENERATE_REQUEST_ERROR:"KEY_GENERATE_REQUEST_ERROR",INCOMPATIBLE_KEYSYSTEMS:"INCOMPATIBLE_KEYSYSTEMS",INVALID_ENCRYPTED_EVENT:"INVALID_ENCRYPTED_EVENT",INVALID_KEY_SYSTEM:"INVALID_KEY_SYSTEM",LICENSE_SERVER_CERTIFICATE_ERROR:"LICENSE_SERVER_CERTIFICATE_ERROR",MULTIPLE_SESSIONS_SAME_INIT_DATA:"MULTIPLE_SESSIONS_SAME_INIT_DATA",BUFFER_APPEND_ERROR:"BUFFER_APPEND_ERROR",BUFFER_FULL_ERROR:"BUFFER_FULL_ERROR",BUFFER_TYPE_UNKNOWN:"BUFFER_TYPE_UNKNOWN",MEDIA_ERR_BLOCKED_AUTOPLAY:"MEDIA_ERR_BLOCKED_AUTOPLAY",MEDIA_ERR_PLAY_NOT_ALLOWED:"MEDIA_ERR_PLAY_NOT_ALLOWED",MEDIA_ERR_NOT_LOADED_METADATA:"MEDIA_ERR_NOT_LOADED_METADATA",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_UNKNOWN:"MEDIA_ERR_UNKNOWN",MEDIA_SOURCE_NOT_SUPPORTED:"MEDIA_SOURCE_NOT_SUPPORTED",MEDIA_KEYS_NOT_SUPPORTED:"MEDIA_KEYS_NOT_SUPPORTED",DISCONTINUITY_ENCOUNTERED:"DISCONTINUITY_ENCOUNTERED",NONE:"NONE"}},7367:function(e,t,n){"use strict";function r(e,t,n){return e+" ("+t+") "+n}n.d(t,{Z:function(){return r}})},8750:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(9822),i=n(5389);function a(e,t){var n=t.defaultCode,a=t.defaultReason;if((0,r.Z)(e))return e;var o=e instanceof Error?e.toString():a;return new i.Z(n,o)}},9822:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(5157),i=n(5992),a=n(3714),o=n(9362),s=n(5389);function u(e){return(e instanceof r.Z||e instanceof a.Z||e instanceof s.Z||e instanceof o.Z)&&Object.keys(i.ZB).indexOf(e.type)>=0}},3714:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="MediaError",a.type=o.ZB.MEDIA_ERROR,a.code=n,a.message=(0,s.Z)(a.name,a.code,i),a.fatal=!1,a}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9362:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="NetworkError",a.type=o.ZB.NETWORK_ERROR,a.url=i.url,a.status=i.status,a.errorType=i.type,a.code=n,a.message=(0,s.Z)(a.name,a.code,i.message),a.fatal=!1,a}return(0,i.Z)(t,e),t.prototype.isHttpError=function(e){return this.errorType===o.br.ERROR_HTTP_CODE&&this.status===e},t}((0,a.Z)(Error))},5389:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="OtherError",a.type=o.ZB.OTHER_ERROR,a.code=n,a.message=(0,s.Z)(a.name,a.code,i),a.fatal=!1,a}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9105:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a){var o;return o=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(o),t.prototype),o.name="RequestError",o.url=n,o.status=i,o.type=a,o.message=a,o}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},7273:function(e,t){"use strict";t.Z={dashParsers:{wasm:null,js:null},directfile:null,ContentDecryptor:null,htmlTextTracksBuffer:null,htmlTextTracksParsers:{},nativeTextTracksBuffer:null,nativeTextTracksParsers:{},transports:{}}},7874:function(e,t,n){"use strict";var r=n(7273);t.Z=r.Z},3887:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(8894),i=new(function(){function e(){this.error=r.Z,this.warn=r.Z,this.info=r.Z,this.debug=r.Z,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentLevel="NONE"}var t=e.prototype;return t.setLevel=function(e){var t,n=this._levels[e];"number"==typeof n?(t=n,this._currentLevel=e):(t=0,this._currentLevel="NONE"),this.error=t>=this._levels.ERROR?console.error.bind(console):r.Z,this.warn=t>=this._levels.WARNING?console.warn.bind(console):r.Z,this.info=t>=this._levels.INFO?console.info.bind(console):r.Z,this.debug=t>=this._levels.DEBUG?console.log.bind(console):r.Z},t.getLevel=function(){return this._currentLevel},t.hasLevel=function(e){return this._levels[e]>=this._levels[this._currentLevel]},e}())},9665:function(e,t,n){"use strict";n.d(t,{r:function(){return f},Z:function(){return v}});var r=n(3274),i=n(1946),a=n(5288),o=n(3774);var s=n(3887),u=n(4791);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c=function(){function e(e,t){var n;this.id=e.id,this.bitrate=e.bitrate,this.codec=e.codecs,void 0!==e.height&&(this.height=e.height),void 0!==e.width&&(this.width=e.width),void 0!==e.mimeType&&(this.mimeType=e.mimeType),void 0!==e.contentProtections&&(this.contentProtections=e.contentProtections),void 0!==e.frameRate&&(this.frameRate=e.frameRate),void 0!==e.hdrInfo&&(this.hdrInfo=e.hdrInfo),this.cdnMetadata=e.cdnMetadata,this.index=e.index,this.isSupported="audio"!==t.type&&"video"!==t.type||(n=this.getMimeTypeString(),null!=o.J&&("function"!=typeof o.J.isTypeSupported||o.J.isTypeSupported(n)))}var t=e.prototype;return t.getMimeTypeString=function(){var e,t;return(null!==(e=this.mimeType)&&void 0!==e?e:"")+';codecs="'+(null!==(t=this.codec)&&void 0!==t?t:"")+'"'},t.getEncryptionData=function(e){for(var t,n,r=this.getAllEncryptionData(),i=[],a=0;a<r.length;a++)for(var o=!1,s=r[a],u=0;u<s.values.length;u++)if(s.values[u].systemId.toLowerCase()===e.toLowerCase())if(o)i[i.length-1].values.push(s.values[u]);else{var l=null===(n=null===(t=this.contentProtections)||void 0===t?void 0:t.keyIds)||void 0===n?void 0:n.map((function(e){return e.keyId}));i.push({type:s.type,keyIds:l,values:[s.values[u]]}),o=!0}return i},t.getAllEncryptionData=function(){var e,t;if(void 0===this.contentProtections||0===this.contentProtections.initData.length)return[];var n=null===(t=null===(e=this.contentProtections)||void 0===e?void 0:e.keyIds)||void 0===t?void 0:t.map((function(e){return e.keyId}));return this.contentProtections.initData.map((function(e){return{type:e.type,keyIds:n,values:e.values}}))},t.addProtectionData=function(e,t,n){var r=!1;if(void 0===this.contentProtections)return this.contentProtections={keyIds:void 0!==t?[{keyId:t}]:[],initData:[{type:e,values:n}]},!0;if(void 0!==t){var i=this.contentProtections.keyIds;if(void 0===i)this.contentProtections.keyIds=[{keyId:t}];else{for(var a,o=!1,d=l(i);!(a=d()).done;){var c=a.value;(0,u.Z)(c.keyId,t)&&(o=!0)}o||(s.Z.warn("Manifest: found unanounced key id."),i.push({keyId:t}))}}for(var f=this.contentProtections.initData,v=0;v<f.length;v++)if(f[v].type===e){for(var p=f[v].values,h=0;h<n.length;h++){var m=n[h],g=void 0;for(g=0;g<p.length;g++)if(m.systemId===p[g].systemId){if((0,u.Z)(m.data,p[g].data))break;s.Z.warn("Manifest: different init data for the same system ID")}g===p.length&&(p.push(m),r=!0)}return r}return this.contentProtections.initData.push({type:e,values:n}),!0},t.isPlayable=function(){return this.isSupported&&!1!==this.decipherable},e}(),f=["audio","video","text"],v=function(){function e(t,n){void 0===n&&(n={});var r=t.trickModeTracks,o=n,s=o.representationFilter,u=o.isManuallyAdded;this.id=t.id,this.type=t.type,void 0!==t.isTrickModeTrack&&(this.isTrickModeTrack=t.isTrickModeTrack),void 0!==t.language&&(this.language=t.language,this.normalizedLanguage=(0,a.ZP)(t.language)),void 0!==t.closedCaption&&(this.isClosedCaption=t.closedCaption),void 0!==t.audioDescription&&(this.isAudioDescription=t.audioDescription),void 0!==t.isDub&&(this.isDub=t.isDub),void 0!==t.forcedSubtitles&&(this.isForcedSubtitles=t.forcedSubtitles),void 0!==t.isSignInterpreted&&(this.isSignInterpreted=t.isSignInterpreted),void 0!==t.label&&(this.label=t.label),void 0!==r&&r.length>0&&(this.trickModeTracks=r.map((function(t){return new e(t)})));for(var l=t.representations,d=[],f=!1,v=0;v<l.length;v++){var p=new c(l[v],{type:this.type}),h=!0;if(!(0,i.Z)(s)){var m={id:p.id,bitrate:p.bitrate,codec:p.codec,height:p.height,width:p.width,frameRate:p.frameRate,hdrInfo:p.hdrInfo};if(void 0!==p.contentProtections&&(m.contentProtections={},void 0!==p.contentProtections.keyIds)){var g=p.contentProtections.keyIds.map((function(e){return e.keyId}));m.contentProtections.keyIds=g}h=s(m,{trackType:this.type,language:this.language,normalizedLanguage:this.normalizedLanguage,isClosedCaption:this.isClosedCaption,isDub:this.isDub,isAudioDescription:this.isAudioDescription,isSignInterpreted:this.isSignInterpreted})}h&&(d.push(p),!f&&p.isSupported&&(f=!0))}d.sort((function(e,t){return e.bitrate-t.bitrate})),this.representations=d,this.isSupported=f,this.manuallyAdded=!0===u}var t=e.prototype;return t.getPlayableRepresentations=function(){return this.representations.filter((function(e){return e.isPlayable()}))},t.getRepresentation=function(e){return(0,r.Z)(this.representations,(function(t){var n=t.id;return e===n}))},e}()},8619:function(e,t,n){"use strict";n.d(t,{ZP:function(){return E}});var r,i=n(4578),a=n(3274),o=n(1959),s=n(908),u=n(8806),l=n(3714),d=n(1679),c=n(9665),f=function(){function e(e,t){var n=this;if(this.contentWarnings=[],this.id=e.id,this.adaptations=Object.keys(e.adaptations).reduce((function(r,i){var a=e.adaptations[i];if(null==a)return r;var o=a.map((function(e){var r=new c.Z(e,{representationFilter:t});if(r.representations.length>0&&!r.isSupported){var i=new l.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.");n.contentWarnings.push(i)}return r})).filter((function(e){return e.representations.length>0}));if(o.every((function(e){return!e.isSupported}))&&a.length>0&&("video"===i||"audio"===i))throw new l.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","No supported "+i+" adaptations");return o.length>0&&(r[i]=o),r}),{}),!Array.isArray(this.adaptations.video)&&!Array.isArray(this.adaptations.audio))throw new l.Z("MANIFEST_PARSE_ERROR","No supported audio and video tracks.");this.duration=e.duration,this.start=e.start,null!=this.duration&&null!=this.start&&(this.end=this.start+this.duration),this.streamEvents=void 0===e.streamEvents?[]:e.streamEvents}var t=e.prototype;return t.getAdaptations=function(){var e=this.adaptations;return(0,d.Z)(e).reduce((function(e,t){return null!=t?e.concat(t):e}),[])},t.getAdaptationsForType=function(e){var t=this.adaptations[e];return null==t?[]:t},t.getAdaptation=function(e){return(0,a.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},t.getSupportedAdaptations=function(e){if(void 0===e)return this.getAdaptations().filter((function(e){return e.isSupported}));var t=this.adaptations[e];return void 0===t?[]:t.filter((function(e){return e.isSupported}))},t.containsTime=function(e){return e>=this.start&&(void 0===this.end||e<this.end)},e}();!function(e){e[e.Full=0]="Full",e[e.Partial=1]="Partial"}(r||(r={}));var v=n(3887),p=n(5138);function h(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t,n){var i={updatedAdaptations:[],removedAdaptations:[],addedAdaptations:[]};e.start=t.start,e.end=t.end,e.duration=t.duration,e.streamEvents=t.streamEvents;for(var a=e.getAdaptations(),o=t.getAdaptations(),s=function(e){var t=a[e],s=(0,p.Z)(o,(function(e){return e.id===t.id}));if(-1===s){v.Z.warn('Manifest: Adaptation "'+a[e].id+'" not found when merging.');var l=a.splice(e,1)[0];e--,i.removedAdaptations.push(l)}else{var d=o.splice(s,1)[0],c=[],f=[],h=[];i.updatedAdaptations.push({adaptation:t,updatedRepresentations:c,addedRepresentations:f,removedRepresentations:h});for(var m,g=t.representations,y=d.representations.slice(),_=function(e){var t=g[e],i=(0,p.Z)(y,(function(e){return e.id===t.id}));if(-1===i){v.Z.warn('Manifest: Representation "'+g[e].id+'" not found when merging.');var a=g.splice(e,1)[0];e--,h.push(a)}else{var o=y.splice(i,1)[0];c.push(t),t.cdnMetadata=o.cdnMetadata,n===r.Full?t.index._replace(o.index):t.index._update(o.index)}b=e},b=0;b<g.length;b++)_(b);if(y.length>0)v.Z.warn("Manifest: "+y.length+" new Representations found when merging."),(m=t.representations).push.apply(m,y),f.push.apply(f,y)}u=e},u=0;u<a.length;u++)s(u);if(o.length>0){v.Z.warn("Manifest: "+o.length+" new Adaptations found when merging.");for(var l,d=h(o);!(l=d()).done;){var c=l.value,f=e.adaptations[c.type];void 0===f?e.adaptations[c.type]=[c]:f.push(c),i.addedAdaptations.push(c)}}return i}function y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var b=(0,s.Z)(),S=function(e){function t(t,n){var r,i;r=e.call(this)||this;var a=n.representationFilter,o=n.manifestUpdateUrl;return r.contentWarnings=[],r.id=b(),r.expired=null!==(i=t.expired)&&void 0!==i?i:null,r.transport=t.transportType,r.clockOffset=t.clockOffset,r.periods=t.periods.map((function(e){var t,n=new f(e,a);return(t=r.contentWarnings).push.apply(t,n.contentWarnings),n})).sort((function(e,t){return e.start-t.start})),r.adaptations=void 0===r.periods[0]?{}:r.periods[0].adaptations,r._timeBounds=t.timeBounds,r.isDynamic=t.isDynamic,r.isLive=t.isLive,r.isLastPeriodKnown=t.isLastPeriodKnown,r.uris=void 0===t.uris?[]:t.uris,r.updateUrl=o,r.lifetime=t.lifetime,r.suggestedPresentationDelay=t.suggestedPresentationDelay,r.availabilityStartTime=t.availabilityStartTime,r.publishTime=t.publishTime,r}(0,i.Z)(t,e);var n=t.prototype;return n.getPeriod=function(e){return(0,a.Z)(this.periods,(function(t){return e===t.id}))},n.getPeriodForTime=function(e){return(0,a.Z)(this.periods,(function(t){return e>=t.start&&(void 0===t.end||t.end>e)}))},n.getNextPeriod=function(e){return(0,a.Z)(this.periods,(function(t){return t.start>e}))},n.getPeriodAfter=function(e){var t=e.end;if(void 0===t)return null;var n=(0,a.Z)(this.periods,(function(e){return void 0===e.end||t<e.end}));return void 0===n?null:n},n.getUrls=function(){return this.uris},n.replace=function(e){this._performUpdate(e,r.Full)},n.update=function(e){this._performUpdate(e,r.Partial)},n.getMinimumSafePosition=function(){var e,t,n=this._timeBounds;if(null===n.timeshiftDepth)return null!==(e=n.minimumSafePosition)&&void 0!==e?e:0;var r,i=n.maximumTimeData;if(n.maximumTimeData.isLinear){var a=performance.now()-i.time;r=i.maximumSafePosition+a/1e3}else r=i.maximumSafePosition;var o=r-n.timeshiftDepth;return Math.max(null!==(t=n.minimumSafePosition)&&void 0!==t?t:0,o)},n.getLivePosition=function(){var e=this._timeBounds.maximumTimeData;if(this.isLive&&void 0!==e.livePosition){if(!e.isLinear)return e.livePosition;var t=performance.now()-e.time;return e.livePosition+t/1e3}},n.getMaximumSafePosition=function(){var e=this._timeBounds.maximumTimeData;if(!e.isLinear)return e.maximumSafePosition;var t=performance.now()-e.time;return e.maximumSafePosition+t/1e3},n.updateRepresentationsDeciperability=function(e){var t=function(e,t){for(var n,r=[],i=y(e.periods);!(n=i()).done;)for(var a,o=n.value,s=y(o.getAdaptations());!(a=s()).done;)for(var u,l=a.value,d=y(l.representations);!(u=d()).done;){var c=u.value,f=t(c);f!==c.decipherable&&(r.push({manifest:e,period:o,adaptation:l,representation:c}),c.decipherable=f)}return r}(this,e);t.length>0&&this.trigger("decipherabilityUpdate",t)},n.getAdaptations=function(){(0,u.Z)("manifest.getAdaptations() is deprecated. Please use manifest.period[].getAdaptations() instead");var e=this.periods[0];if(void 0===e)return[];var t=e.adaptations,n=[];for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];n.push.apply(n,i)}return n},n.getAdaptationsForType=function(e){(0,u.Z)("manifest.getAdaptationsForType(type) is deprecated. Please use manifest.period[].getAdaptationsForType(type) instead");var t=this.periods[0];if(void 0===t)return[];var n=t.adaptations[e];return void 0===n?[]:n},n.getAdaptation=function(e){return(0,u.Z)("manifest.getAdaptation(id) is deprecated. Please use manifest.period[].getAdaptation(id) instead"),(0,a.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},n._performUpdate=function(e,t){var n;if(this.availabilityStartTime=e.availabilityStartTime,this.expired=e.expired,this.isDynamic=e.isDynamic,this.isLive=e.isLive,this.isLastPeriodKnown=e.isLastPeriodKnown,this.lifetime=e.lifetime,this.contentWarnings=e.contentWarnings,this.suggestedPresentationDelay=e.suggestedPresentationDelay,this.transport=e.transport,this.publishTime=e.publishTime,t===r.Full)this._timeBounds=e._timeBounds,this.uris=e.uris,n=function(e,t){for(var n={updatedPeriods:[],addedPeriods:[],removedPeriods:[]},i=0,a=0;a<t.length;a++){for(var o=t[a],s=i,u=e[s];null!=u&&u.id!==o.id;)u=e[++s];if(null!=u){var l,d,c=g(u,o,r.Full);n.updatedPeriods.push({period:u,result:c});var f=t.slice(i,a),p=s-i,h=e.splice.apply(e,[i,p].concat(f));(l=n.removedPeriods).push.apply(l,h),(d=n.addedPeriods).push.apply(d,f),i=a+1}}if(i>e.length)return v.Z.error("Manifest: error when updating Periods"),n;if(i<e.length){var m,y=e.splice(i,e.length-i);(m=n.removedPeriods).push.apply(m,y)}var _,b=t.slice(i,t.length);return b.length>0&&(e.push.apply(e,b),(_=n.addedPeriods).push.apply(_,b)),n}(this.periods,e.periods);else{this._timeBounds.maximumTimeData=e._timeBounds.maximumTimeData,this.updateUrl=e.uris[0],n=function(e,t){var n,i={updatedPeriods:[],addedPeriods:[],removedPeriods:[]};if(0===e.length)return e.splice.apply(e,[0,0].concat(t)),(n=i.addedPeriods).push.apply(n,t),i;if(0===t.length)return i;var a=e[e.length-1];if(a.start<t[0].start){var o;if(a.end!==t[0].start)throw new l.Z("MANIFEST_UPDATE_ERROR","Cannot perform partial update: not enough data");return e.push.apply(e,t),(o=i.addedPeriods).push.apply(o,t),i}var s=(0,p.Z)(e,(function(e){return e.id===t[0].id}));if(s<0)throw new l.Z("MANIFEST_UPDATE_ERROR","Cannot perform partial update: incoherent data");var u=g(e[s],t[0],r.Partial);i.updatedPeriods.push({period:e[s],result:u});for(var d=s+1,c=1;c<t.length;c++){for(var f=t[c],h=-1,m=d;m<e.length;m++)if(f.id===e[m].id){h=m;break}if(h<0){for(var y,_=-1,b=d;b<e.length;b++)if(f.start<e[b].start){_=b;break}var S=_-d,E=e.splice(d,S,f);i.addedPeriods.push(f),(y=i.removedPeriods).push.apply(y,E)}else{if(h>d){var T;v.Z.warn("Manifest: old Periods not found in new when updating, removing");var w=e.splice(d,h-d);(T=i.removedPeriods).push.apply(T,w),h=d}var k=g(e[h],f,r.Full);i.updatedPeriods.push({period:e[h],result:k})}d++}if(d<e.length){var A;v.Z.warn("Manifest: Ending Periods not found in new when updating, removing");var I=e.splice(d,e.length-d);(A=i.removedPeriods).push.apply(A,I)}return i}(this.periods,e.periods);for(var i=this.getMinimumSafePosition();this.periods.length>0;){var a=this.periods[0];if(void 0===a.end||a.end>i)break;this.periods.shift()}}this.adaptations=void 0===this.periods[0]?{}:this.periods[0].adaptations,this.trigger("manifestUpdate",n)},t}(o.Z);var E=S},520:function(e,t,n){"use strict";n.d(t,{K:function(){return a},z:function(){return i}});var r=n(1946);function i(e,t){return e.segment.id===t.segment.id&&e.representation.id===t.representation.id&&e.adaptation.id===t.adaptation.id&&e.period.id===t.period.id}function a(e){if((0,r.Z)(e))return"";var t=e.period,n=e.adaptation,i=e.representation,a=e.segment;return n.type+" P: "+t.id+" A: "+n.id+" R: "+i.id+" S: "+(a.isInit?"init":a.complete?a.time+"-"+a.duration:""+a.time)}},2689:function(e,t,n){"use strict";n.d(t,{s:function(){return r}});var r=Math.pow(2,32)-1},2297:function(e,t,n){"use strict";n.d(t,{Qy:function(){return f},Xj:function(){return p},iz:function(){return c},lp:function(){return d},nR:function(){return v},t_:function(){return l},vA:function(){return u}});var r=n(3887),i=n(811),a=n(6968);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){for(var n,r=e,i=o(t);!(n=i()).done;){var a=l(r,n.value);if(null===a)return null;r=a}return r}function l(e,t){var n=f(e,t);return null!==n?e.subarray(n[1],n[2]):null}function d(e,t){for(var n=[],r=e;;){var a=f(r,t);if(null===a)return n;(0,i.Z)(0!==a[2]&&0!==r.length),n.push(r.subarray(a[1],a[2])),r=r.subarray(a[2])}}function c(e,t){var n=f(e,t);return null!==n?e.subarray(n[0],n[2]):null}function f(e,t){for(var n,r,i=e.length,o=0,s=0;o+8<=i;){if(r=o,s=(0,a.pX)(e,r),r+=4,n=(0,a.pX)(e,r),r+=4,0===s)s=i-o;else if(1===s){if(r+8>i)return null;s=(0,a.pV)(e,r),r+=8}if(s<0)throw new Error("ISOBMFF: Size out of range");if(n===t)return 1970628964===t&&(r+=16),[o,r,o+s];o+=s}return null}function v(e,t,n,r,i){for(var o,s=e.length,u=0;u<s;u+=o){var l=u;o=(0,a.pX)(e,l),l+=4;var d=(0,a.pX)(e,l);if(l+=4,0===o)o=s-u;else if(1===o){if(l+8>s)return;o=(0,a.pV)(e,l),l+=8}if(1970628964===d&&l+16<=s&&(0,a.pX)(e,l)===t&&(0,a.pX)(e,l+4)===n&&(0,a.pX)(e,l+8)===r&&(0,a.pX)(e,l+12)===i)return l+=16,e.subarray(l,u+o)}}function p(e){var t=e.length;if(t<8)return r.Z.warn("ISOBMFF: box inferior to 8 bytes, cannot find offsets"),null;var n=0,i=(0,a.pX)(e,n);n+=4;var o=(0,a.pX)(e,n);if(n+=4,0===i)i=t;else if(1===i){if(n+8>t)return r.Z.warn("ISOBMFF: box too short, cannot find offsets"),null;i=(0,a.pV)(e,n),n+=8}if(i<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===o&&(n+=16),[0,n,i]}},6807:function(e,t,n){"use strict";n.d(t,{E3:function(){return u},Le:function(){return o},XA:function(){return i},fs:function(){return s},uq:function(){return a}});var r=n(2297);function i(e){var t=(0,r.t_)(e,1836019558);return null===t?null:(0,r.t_)(t,1953653094)}function a(e){return(0,r.lp)(e,1836019558).reduce((function(e,t){var n=(0,r.t_)(t,1953653094);return null!==n&&e.push(n),e}),[])}function o(e){return(0,r.t_)(e,1835295092)}function s(e){var t=(0,r.t_)(e,1836019574);if(null===t)return null;var n=(0,r.t_)(t,1953653099);return null===n?null:(0,r.t_)(n,1835297121)}function u(e,t){return void 0===t&&(t=0),(0,r.t_)(e.subarray(t),1701671783)}},6490:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},Y:function(){return u}});var r=n(3887);var i="function"==typeof Uint8Array.prototype.slice?function(e,t,n){return e.slice(t,n)}:function(e,t,n){return new Uint8Array(Array.prototype.slice.call(e,t,n))},a=n(3635),o=n(2297);function s(e){var t=0,n=(0,o.t_)(e,1836019574);if(null===n)return[];for(var a=[];t<n.length;){var s=void 0;try{s=(0,o.Qy)(n,1886614376)}catch(e){var l=e instanceof Error?e:"";return r.Z.warn("Error while removing PSSH from ISOBMFF",l),a}if(null==s)return a;var d=i(n,s[0],s[2]),c=u(d,s[1]-s[0]);void 0!==c&&a.push({systemId:c,data:d}),n[s[0]+4]=102,n[s[0]+5]=114,n[s[0]+6]=101,n[s[0]+7]=101,t=s[2]}return a}function u(e,t){if(e[t]>1)r.Z.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length)){var o=i(e,n,n+16);return(0,a.ci)(o)}}}},4644:function(e,t,n){"use strict";n.d(t,{J6:function(){return m},LD:function(){return h},MM:function(){return p},Qx:function(){return f},R0:function(){return y},Wf:function(){return c},s9:function(){return g}});var r=n(3887),i=n(6968),a=n(3635),o=n(2689),s=n(2297),u=n(6807);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=(0,s.Qy)(e,1936286840);if(null===n)return null;var r=t,a=n[2]-n[0],o=n[1],u=e[o];o+=8;var l,d=(0,i.pX)(e,o);if(o+=4,0===u)l=(0,i.pX)(e,o),o+=4,r+=(0,i.pX)(e,o)+a,o+=4;else{if(1!==u)return null;l=(0,i.pV)(e,o),o+=8,r+=(0,i.pV)(e,o)+a,o+=8}var c=[];o+=2;var f=(0,i.zK)(e,o);for(o+=2;--f>=0;){var v=(0,i.pX)(e,o);o+=4;var p=2147483647&v;if(1===(2147483648&v)>>>31)throw new Error("sidx with reference_type `1` not yet implemented");var h=(0,i.pX)(e,o);o+=4,o+=4,c.push({time:l,duration:h,timescale:d,range:[r,r+p-1]}),l+=h,r+=p}return c}function f(e){var t=(0,u.XA)(e);if(null!==t){var n=(0,s.t_)(t,1952867444);if(null!==n){var r=n[0];return 1===r?(0,i.pV)(n,4):0===r?(0,i.pX)(n,4):void 0}}}function v(e){var t=(0,s.t_)(e,1952868452);if(null!==t){var n=1,r=(0,i.QI)(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),(0,i.pX)(t,n)}}function p(e){var t=(0,u.uq)(e);if(0!==t.length){for(var n,r=0,a=l(t);!(n=a()).done;){var o=n.value,d=(0,s.t_)(o,1953658222);if(null===d)return;var c=0,f=d[c];if(c+=1,f>1)return;var p=(0,i.QI)(d,c);c+=3;var h=(256&p)>0,m=0;if(!h&&void 0===(m=v(o)))return;var g=(1&p)>0,y=(4&p)>0,_=(512&p)>0,b=(1024&p)>0,S=(2048&p)>0,E=(0,i.pX)(d,c);c+=4,g&&(c+=4),y&&(c+=4);for(var T=E,w=0;T-- >0;)h?(w+=(0,i.pX)(d,c),c+=4):w+=m,_&&(c+=4),b&&(c+=4),S&&(c+=4);r+=w}return r}}function h(e){var t=(0,u.fs)(e);if(null!==t){var n=(0,s.t_)(t,1835296868);if(null!==n){var r=0,a=n[r];return r+=4,1===a?(0,i.pX)(n,r+16):0===a?(0,i.pX)(n,r+8):void 0}}}function m(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=(0,i.pX)(e,0);if(0===n){if(t>o.s){var r=new Uint8Array(t+8);return r.set((0,i.kh)(1),0),r.set(e.subarray(4,8),4),r.set((0,i.el)(t+8),8),r.set(e.subarray(8,t),16),r}return e.set((0,i.kh)(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set((0,i.el)(t),8),e}if(t<=o.s)return e.set((0,i.kh)(t),0),e;var a=new Uint8Array(t+8);return a.set((0,i.kh)(1),0),a.set(e.subarray(4,8),4),a.set((0,i.el)(t+8),8),a.set(e.subarray(8,t),16),a}function g(e){for(var t=[],n=0;n<e.length;){var o=(0,u.E3)(e,n);if(null===o)break;var s=o.length;n+=s;var l=o[0];if(0!==l)r.Z.warn("ISOBMFF: EMSG version "+l.toString()+" not supported.");else{var d=4,c=(0,a.DM)(o,d),f=c.end,v=c.string;d=f;var p=(0,a.DM)(o,d),h=p.end,m=p.string;d=h;var g=(0,i.pX)(o,d);d+=4;var y=(0,i.pX)(o,d);d+=4;var _=(0,i.pX)(o,d);d+=4;var b=(0,i.pX)(o,d);d+=4;var S={schemeIdUri:v,value:m,timescale:g,presentationTimeDelta:y,eventDuration:_,id:b,messageData:o.subarray(d,s)};t.push(S)}}if(0!==t.length)return t}function y(e){var t=(0,s.vA)(e,[1836019574,1953653099,1835297121,1835626086,1937007212,1937011556]);if(null===t)return null;var n=t.subarray(8),r=(0,s.t_)(n,1701733238),i=0;if(null===r?(i=28,r=(0,s.t_)(n,1701733217)):i=78,null===r)return null;var a=(0,s.vA)(r.subarray(i),[1936289382,1935894633,1952804451]);return null===a||a.byteLength<24?null:a.subarray(8,24)}},8337:function(e,t,n){"use strict";n.d(t,{Z:function(){return Qe}});var r=n(7904),i=n(1946),a=n(6872),o=n(3887),s=n(3274),u=n(9829);function l(e){var t=Date.parse(e)-performance.now();if(!isNaN(t))return t;o.Z.warn("DASH Parser: Invalid clock received: ",e)}function d(e){for(var t=e.representations,n=null,r=0;r<t.length;r++){var i=t[r].index.getLastAvailablePosition();if(void 0===i)return;null!==i&&(n=null==n?i:Math.min(n,i))}return null===n?null:n}function c(e){for(var t=e.representations,n=null,r=0;r<t.length;r++){var i=t[r].index.getFirstAvailablePosition();if(void 0===i)return;null!==i&&(n=null==n?i:Math.max(n,i))}return null===n?null:n}function f(e){if(0===e.length)throw new Error("DASH Parser: no period available for a dynamic content");var t=function(e){for(var t=0;t<=e.length-1;t++){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=c(r);if(void 0===u)return;a=u}if(void 0!==i){var l=c(i);if(void 0===l)return;s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return void o.Z.info("Parser utils: found Period with no segment. ","Going to next one to calculate first position");if(null!==s)return null!==a?Math.max(a,s):s;if(null!==a)return a}}}(e),n=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=d(r);if(void 0===u)return{safe:void 0,unsafe:void 0};a=u}if(void 0!==i){var l=d(i);if(void 0===l)return{safe:void 0,unsafe:void 0};s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return o.Z.info("Parser utils: found Period with no segment. ","Going to previous one to calculate last position"),{safe:void 0,unsafe:void 0};if(null!==s)return null!==a?{safe:Math.min(a,s),unsafe:Math.max(a,s)}:{safe:s,unsafe:s};if(null!==a)return{safe:a,unsafe:a}}}return{safe:void 0,unsafe:void 0}}(e);return{minimumSafePosition:t,maximumSafePosition:n.safe,maximumUnsafePosition:n.unsafe}}var v=n(9592),p=n(908),h=n(1679),m=n(3635);var g=function(){function e(e){this._isDynamic=e.isDynamic,this._timeShiftBufferDepth=e.isDynamic&&void 0!==e.timeShiftBufferDepth?e.timeShiftBufferDepth:null}var t=e.prototype;return t.setLastPosition=function(e,t){this._lastPosition=e,this._positionTime=t},t.lastPositionIsKnown=function(){return this._isDynamic?null!=this._positionTime&&null!=this._lastPosition:null!=this._lastPosition},t.estimateMinimumBound=function(){if(!this._isDynamic||null===this._timeShiftBufferDepth)return 0;var e=this.estimateMaximumBound();return void 0!==e?e-this._timeShiftBufferDepth:void 0},t.estimateMaximumBound=function(){return this._isDynamic&&null!=this._positionTime&&null!=this._lastPosition?Math.max(this._lastPosition-this._positionTime+performance.now()/1e3,0):this._lastPosition},e}(),y=n(9665),_=n(5138),b=n(7714),S=n(6923);function E(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var w=function(e,t){for(var n,r=E(t);!(n=r()).done;)for(var i,a=n.value,o=a.adaptation,s=E(a.trickModeAttachedAdaptationIds);!(i=s()).done;)for(var u,l=i.value,d=E(y.r);!(u=d()).done;){var c=e[u.value];if(void 0!==c)for(var f,v=E(c);!(f=v()).done;){var p=f.value;p.id===l&&(void 0===p.trickModeTracks&&(p.trickModeTracks=[]),p.trickModeTracks.push(o))}}},k=["subtitle","caption"];function A(e,t,n,r){function i(e,t){var n=e.split("/")[0];return(0,b.Z)(y.r,n)?n:"application/ttml+xml"===e||"application/mp4"===e&&null!=t&&null!=(0,s.Z)(t,(function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri&&(0,b.Z)(k,e.value)}))?"text":void 0}function a(e){switch(e.substring(0,3)){case"avc":case"hev":case"hvc":case"vp8":case"vp9":case"av1":return"video";case"vtt":return"text"}switch(e.substring(0,4)){case"mp4a":return"audio";case"wvtt":case"stpp":return"text"}}if(null!==t){var o=i(t,r);if(void 0!==o)return o}if(null!==n){var u=a(n);if(void 0!==u)return u}for(var l=0;l<e.length;l++){var d=e[l].attributes,c=d.mimeType,f=d.codecs;if(void 0!==c){var v=i(c,r);if(void 0!==v)return v}if(void 0!==f){var p=a(f);if(void 0!==p)return p}}}var I=n(8026);var R=n(3911);function Z(e,t){var n,r=e.initialization,i={};return void 0!==t&&(i.isEMSGWhitelisted=t),{id:"init",isInit:!0,time:0,end:0,duration:0,timescale:1,range:null!=r?r.range:void 0,indexRange:e.indexRange,url:null!==(n=null==r?void 0:r.url)&&void 0!==n?n:null,complete:!0,privateInfos:i,timestampOffset:-e.indexTimeOffset/e.timescale}}function x(e){return function(t,n,r){var i,a,o,s=(0,S.Z)(r)?parseInt(r,10):1;return i=String(e),a=s,(o=i.toString()).length>=a?o:(new Array(a+1).join("0")+o).slice(-a)}}function P(e,t,n){return function(e,t,n){return-1===e.indexOf("$")?e:e.replace(/\$\$/g,"$").replace(/\$RepresentationID\$/g,String(t)).replace(/\$Bandwidth(\%0(\d+)d)?\$/g,x(void 0===n?0:n))}(e,t,n)}function M(e,t){return function(n){return-1===n.indexOf("$")?n:n.replace(/\$\$/g,"$").replace(/\$Number(\%0(\d+)d)?\$/g,(function(e,n,r){if(void 0===t)throw new Error("Segment number not defined in a $Number$ scheme");return x(t)(e,n,r)})).replace(/\$Time(\%0(\d+)d)?\$/g,(function(t,n,r){if(void 0===e)throw new Error("Segment time not defined in a $Time$ scheme");return x(e)(t,n,r)}))}}function C(e,t,n,r,i){for(var a,o,s=(0,R.gT)(t,e),u=(0,R.gT)(t+n,e),l=e.timeline,d=e.timescale,c=e.segmentUrlTemplate,f=e.startNumber,v=e.endNumber,p=null!=f?f:1,h=[],m=l.length,g=0;g<m;g++){for(var y=l[g],_=y.duration,b=y.start,S=y.range,E=(0,R.KF)(y,l[g+1],i),T=!1!==e.availabilityTimeComplete||g!==m-1&&0!==E,w=(a=_,o=void 0,(o=s-b)>0?Math.floor(o/a):0),k=b+w*_;k<u&&w<=E;){var A=p+w;if(void 0!==v&&A>v)break;var I=null===c?null:M(k,A)(c),Z=k-e.indexTimeOffset,x=_;Z<0&&(x=_+Z,Z=0);var P={id:String(k),time:Z/d,end:(Z+x)/d,duration:x/d,isInit:!1,range:S,timescale:1,url:I,number:A,timestampOffset:-e.indexTimeOffset/d,complete:T,privateInfos:{isEMSGWhitelisted:r}};h.push(P),k=b+ ++w*_}if(k>=u)return h;if(p+=E+1,void 0!==v&&p>v)return h}return h}function D(e,t){if(t.timescale!==e.timescale){var n=e.timescale;e.timeline.push({start:t.time/t.timescale*n,duration:t.duration/t.timescale*n,repeatCount:void 0===t.count?0:t.count,range:t.range})}else e.timeline.push({start:t.time,duration:t.duration,repeatCount:void 0===t.count?0:t.count,range:t.range});return!0}var N=function(){function e(e,t){var n,r,i,a=t.periodStart,o=t.periodEnd,s=t.representationId,u=t.representationBitrate,l=t.isEMSGWhitelisted,d=null!==(n=e.timescale)&&void 0!==n?n:1,c=(null!=e.presentationTimeOffset?e.presentationTimeOffset:0)-a*d,f=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:P(e.initialization.media,s,u),v=void 0===e.media?null:P(e.media,s,u),p=void 0!==e.initialization?e.initialization.range:void 0!==e.indexRange?[0,e.indexRange[0]-1]:void 0;this._index={indexRange:e.indexRange,indexTimeOffset:c,initialization:{url:f,range:p},segmentUrlTemplate:v,startNumber:e.startNumber,endNumber:e.endNumber,timeline:null!==(i=e.timeline)&&void 0!==i?i:[],timescale:d},this._scaledPeriodStart=(0,R.gT)(a,this._index),this._scaledPeriodEnd=null==o?void 0:(0,R.gT)(o,this._index),this._isInitialized=this._index.timeline.length>0,this._isEMSGWhitelisted=l}var t=e.prototype;return t.getInitSegment=function(){return Z(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return C(this._index,e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){var e=this._index;return 0===e.timeline.length?null:(0,R.zG)(Math.max(this._scaledPeriodStart,e.timeline[0].start),e)},t.getLastAvailablePosition=function(){var e,t=this._index.timeline;if(0===t.length)return null;var n=t[t.length-1],r=Math.min((0,R.jH)(n,null,this._scaledPeriodEnd),null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return(0,R.zG)(r,this._index)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){return!0},t.isInitialized=function(){return this._isInitialized},t.initialize=function(e){if(!this._isInitialized){for(var t=0;t<e.length;t++)D(this._index,e[t]);this._isInitialized=!0}},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `BaseRepresentationIndex`")},t._replace=function(e){this._index=e._index,this._isInitialized=e._isInitialized,this._scaledPeriodEnd=e._scaledPeriodEnd,this._isEMSGWhitelisted=e._isEMSGWhitelisted},t._update=function(){o.Z.error("Base RepresentationIndex: Cannot update a SegmentList")},e}(),O=function(){function e(e,t){var n,r;if(void 0===e.duration)throw new Error("Invalid SegmentList: no duration");var i=t.periodStart,a=t.periodEnd,o=t.representationId,s=t.representationBitrate,u=t.isEMSGWhitelisted;this._isEMSGWhitelisted=u,this._periodStart=i,this._periodEnd=a;var l=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,d=null!==(n=e.timescale)&&void 0!==n?n:1,c=l-i*d,f=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:P(e.initialization.media,o,s),v=e.list.map((function(e){return{url:void 0===e.media?null:P(e.media,o,s),mediaRange:e.mediaRange}}));this._index={list:v,timescale:d,duration:e.duration,indexTimeOffset:c,indexRange:e.indexRange,initialization:null==e.initialization?void 0:{url:f,range:e.initialization.range}}}var t=e.prototype;return t.getInitSegment=function(){var e=Z(this._index);return void 0===e.privateInfos&&(e.privateInfos={}),e.privateInfos.isEMSGWhitelisted=this._isEMSGWhitelisted,e},t.getSegments=function(e,t){for(var n=this._index,r=n.duration,i=n.list,a=n.timescale,o=r/a,s=e-this._periodStart,u=(0,R.PZ)(s,t,a),l=u[0],d=u[1],c=Math.min(i.length-1,Math.floor(d/r)),f=[],v=Math.floor(l/r);v<=c;){var p=i[v].mediaRange,h=i[v].url,m=v*o+this._periodStart,g={id:String(v),time:m,isInit:!1,range:p,duration:o,timescale:1,end:m+o,url:h,timestampOffset:-n.indexTimeOffset/a,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};f.push(g),v++}return f},t.shouldRefresh=function(e,t){return!1},t.getFirstAvailablePosition=function(){return this._periodStart},t.getLastAvailablePosition=function(){var e,t=this._index,n=t.duration,r=t.list;return Math.min(r.length*n/t.timescale+this._periodStart,null!==(e=this._periodEnd)&&void 0!==e?e:1/0)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){return!0},t.isInitialized=function(){return!0},t.initialize=function(){o.Z.error("A `ListRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `ListRepresentationIndex`")},t._replace=function(e){this._index=e._index},t._update=function(){o.Z.error("A `ListRepresentationIndex` cannot be updated")},e}(),L=n(9362),U=n(811),B=n(8232),F=n(1091),z=n(5505);function V(e){return a.Z.getCurrent().DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR*e}function K(e,t,n){var r=e.start,a=e.duration,s=e.repeatCount;return void 0===r&&(null===t?r=0:(0,i.Z)(t.duration)||(r=t.start+t.duration*(t.repeatCount+1))),void 0!==a&&!isNaN(a)||null===n||void 0===n.start||isNaN(n.start)||void 0===r||isNaN(r)||(a=n.start-r),void 0===r||isNaN(r)||void 0===a||isNaN(a)||void 0!==s&&isNaN(s)?(o.Z.warn('DASH: A "S" Element could not have been parsed.'),null):{start:r,duration:a,repeatCount:void 0===s?0:s}}function G(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"t":var i=parseInt(r.value,10);isNaN(i)?o.Z.warn('DASH: invalid t ("'+r.value+'")'):t.start=i;break;case"d":var a=parseInt(r.value,10);isNaN(a)?o.Z.warn('DASH: invalid d ("'+r.value+'")'):t.duration=a;break;case"r":var s=parseInt(r.value,10);isNaN(s)?o.Z.warn('DASH: invalid r ("'+r.value+'")'):t.repeatCount=s}}return t}function j(e){for(var t=[],n=0;n<e.length;n++)t.push(G(e[n]));for(var r=[],i=0;i<t.length;i++){var a=K(t[i],void 0===r[r.length-1]?null:r[r.length-1],void 0===t[i+1]?null:t[i+1]);null!==a&&r.push(a)}return r}function H(e,t){var n,r=function(e,t){if(0===e.length||0===t.length)return null;var n=e[0].start,r=t[0].getAttribute("t"),i=null===r?null:parseInt(r,10);if(null===i||Number.isNaN(i))return null;if(n===i)return{prevSegmentsIdx:0,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(n<i)for(var a=e[0],o=0;;){if(a.repeatCount>0){var s=i-a.start;if(s%a.duration==0&&s/a.duration<=a.repeatCount)return{repeatNumberInPrevSegments:s/a.duration,prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInNewElements:0}}if(++o>=e.length)return null;if((a=e[o]).start===i)return{prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(a.start>i)return null}else for(var u=0,l=t[0],d=i;;){var c=l.getAttribute("d"),f=null===c?null:parseInt(c,10);if(null===f||Number.isNaN(f))return null;var v=l.getAttribute("r"),p=null===v?null:parseInt(v,10);if(null!==p){if(Number.isNaN(p)||p<0)return null;if(p>0){var h=n-d;if(h%f==0&&h/f<=p)return{repeatNumberInPrevSegments:0,repeatNumberInNewElements:h/f,prevSegmentsIdx:0,newElementsIdx:u}}d+=f*(p+1)}else d+=f;if(++u>=t.length)return null;var m=(l=t[u]).getAttribute("t"),g=null===m?null:parseInt(m,10);if(null!==g){if(Number.isNaN(g))return null;d=g}if(d===n)return{newElementsIdx:u,prevSegmentsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(d>i)return null}}(t,e);if(null===r)return o.Z.warn('DASH: Cannot perform "based" update. Common segment not found.'),j(e);var i=r.prevSegmentsIdx,a=r.newElementsIdx,s=r.repeatNumberInPrevSegments,u=r.repeatNumberInNewElements,l=t.length-i+a-1;if(l>=e.length)return o.Z.info('DASH: Cannot perform "based" update. New timeline too short'),j(e);var d=t.slice(i);if(s>0){var c=d[0];c.start+=c.duration*s,d[0].repeatCount-=s}if(u>0&&0!==a)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form.'),j(e);var f=d[d.length-1],v=G(e[l]),p=(null!==(n=v.repeatCount)&&void 0!==n?n:0)-u;if(v.duration!==f.duration||f.repeatCount>p)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form at the beginning.'),j(e);void 0!==v.repeatCount&&v.repeatCount>f.repeatCount&&(f.repeatCount=v.repeatCount);for(var h=[],m=[],g=l+1;g<e.length;g++)m.push(G(e[g]));for(var y=0;y<m.length;y++){var _=K(m[y],void 0===h[h.length-1]?f:h[h.length-1],void 0===m[y+1]?null:m[y+1]);null!==_&&h.push(_)}return d.concat(h)}var W=function(){function e(t,n){var r,i,a;if(!e.isTimelineIndexArgument(t))throw new Error("The given index is not compatible with a TimelineRepresentationIndex.");var o=n.availabilityTimeComplete,s=n.manifestBoundsCalculator,u=n.isDynamic,l=n.isLastPeriod,d=n.representationId,c=n.representationBitrate,f=n.periodStart,v=n.periodEnd,p=n.isEMSGWhitelisted,h=null!==(r=t.timescale)&&void 0!==r?r:1,m=(null!=t.presentationTimeOffset?t.presentationTimeOffset:0)-f*h;this._manifestBoundsCalculator=s,this._isEMSGWhitelisted=p,this._isLastPeriod=l,this._lastUpdate=null==n.receivedTime?performance.now():n.receivedTime,this._unsafelyBaseOnPreviousIndex=null,null!==n.unsafelyBaseOnPreviousRepresentation&&n.unsafelyBaseOnPreviousRepresentation.index instanceof e&&(n.unsafelyBaseOnPreviousRepresentation.index._unsafelyBaseOnPreviousIndex=null,this._unsafelyBaseOnPreviousIndex=n.unsafelyBaseOnPreviousRepresentation.index),this._isDynamic=u,this._parseTimeline=null!==(i=t.timelineParser)&&void 0!==i?i:null;var g=void 0===(null===(a=t.initialization)||void 0===a?void 0:a.media)?null:P(t.initialization.media,d,c),y=void 0===t.media?null:P(t.media,d,c);this._index={availabilityTimeComplete:o,indexRange:t.indexRange,indexTimeOffset:m,initialization:null==t.initialization?void 0:{url:g,range:t.initialization.range},segmentUrlTemplate:y,startNumber:t.startNumber,endNumber:t.endNumber,timeline:void 0===t.timeline?null:q(t.timeline,t.startNumber,t.endNumber),timescale:h},this._scaledPeriodStart=(0,R.gT)(f,this._index),this._scaledPeriodEnd=void 0===v?void 0:(0,R.gT)(v,this._index)}var t=e.prototype;return t.getInitSegment=function(){return Z(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var n=this._index;return C({segmentUrlTemplate:n.segmentUrlTemplate,startNumber:n.startNumber,endNumber:n.endNumber,timeline:n.timeline,timescale:n.timescale,indexTimeOffset:n.indexTimeOffset},e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;return 0===e.length?null:(0,R.zG)(Math.max(this._scaledPeriodStart,e[0].start),this._index)},t.getLastAvailablePosition=function(){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=e.getIndexEnd(this._index.timeline,this._scaledPeriodEnd);return null===t?null:(0,R.zG)(t,this._index)},t.getEnd=function(){if(!this._isDynamic||!this._isLastPeriod)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,U.Z)(e<=t),!this._isDynamic||!this._isLastPeriod)return!1;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var r=this._index,i=r.timeline,a=V(r.timescale),o=(0,R.gT)(t,this._index);if(i.length>0){var s=i[i.length-1];if((0,R.jH)(s,null,this._scaledPeriodEnd)+a>=Math.min(o,null!==(n=this._scaledPeriodEnd)&&void 0!==n?n:1/0))return!1}return void 0===this._scaledPeriodEnd?o+a>this._scaledPeriodStart&&void 0:(0,R.gT)(e,this._index)-a<this._scaledPeriodEnd&&o+a>this._scaledPeriodStart},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=this._index,n=t.timeline,r=t.timescale,i=t.indexTimeOffset;return(0,F.Z)(e,n,r,i)},t.checkDiscontinuity=function(e){this._refreshTimeline();var t=this._index.timeline;return null===t&&(t=this._getTimeline(),this._index.timeline=t),(0,R._j)({timeline:t,timescale:this._index.timescale,indexTimeOffset:this._index.indexTimeOffset},e,this._scaledPeriodEnd)},t.canBeOutOfSyncError=function(e){return!!this._isDynamic&&(e instanceof L.Z&&e.isHttpError(404))},t._replace=function(e){this._parseTimeline=e._parseTimeline,this._index=e._index,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._manifestBoundsCalculator=e._manifestBoundsCalculator,this._isLastPeriod=e._isLastPeriod},t._update=function(e){null===this._index.timeline&&(this._index.timeline=this._getTimeline()),null===e._index.timeline&&(e._index.timeline=e._getTimeline()),(0,z.Z)(this._index.timeline,e._index.timeline)&&(this._index.startNumber=e._index.startNumber),this._index.endNumber=e._index.endNumber,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._isLastPeriod=e._isLastPeriod},t.isFinished=function(){if(!this._isDynamic||!this._isLastPeriod)return!0;null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;if(void 0===this._scaledPeriodEnd||0===e.length)return!1;var t=e[e.length-1];return(0,R.jH)(t,null,this._scaledPeriodEnd)+V(this._index.timescale)>=this._scaledPeriodEnd},t.isInitialized=function(){return!0},t.initialize=function(){o.Z.error("A `TimelineRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `TimelineRepresentationIndex`")},e.isTimelineIndexArgument=function(e){return"function"==typeof e.timelineParser||Array.isArray(e.timeline)},t._refreshTimeline=function(){if(null===this._index.timeline&&(this._index.timeline=this._getTimeline()),this._isDynamic){var e=this._manifestBoundsCalculator.estimateMinimumBound();if(null!=e){var t=(0,R.gT)(e,this._index),n=(0,B.Z)(this._index.timeline,t);void 0!==this._index.startNumber?this._index.startNumber+=n:void 0!==this._index.endNumber&&(this._index.startNumber=n+1)}}},e.getIndexEnd=function(e,t){return e.length<=0?null:Math.min((0,R.jH)(e[e.length-1],null,t),null!=t?t:1/0)},t._getTimeline=function(){if(null===this._parseTimeline)return null!==this._index.timeline?this._index.timeline:(o.Z.error("DASH: Timeline already lazily parsed."),[]);var e=this._parseTimeline();this._parseTimeline=null;var t,n=a.Z.getCurrent().MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY;return null===this._unsafelyBaseOnPreviousIndex||e.length<n?q(j(e),this._index.startNumber,this._index.endNumber):(null===this._unsafelyBaseOnPreviousIndex._index.timeline?(t=this._unsafelyBaseOnPreviousIndex._getTimeline(),this._unsafelyBaseOnPreviousIndex._index.timeline=t):t=this._unsafelyBaseOnPreviousIndex._index.timeline,this._unsafelyBaseOnPreviousIndex=null,q(H(e,t),this._index.startNumber,this._index.endNumber))},e}();function q(e,t,n){if(void 0===n)return e;for(var r=null!=t?t:1,i=0;i<e.length;i++){var a=e[i];if((r+=a.repeatCount+1)>n){if(r===n+1)return e.slice(0,i+1);var o=e.slice(0,i),s=Object.assign({},a),u=r-a.repeatCount-1;return s.repeatCount=Math.max(0,n-u),o.push(s),o}}return e}var Y=W,X=function(){function e(e,t){var n,r,i=t.availabilityTimeOffset,a=t.manifestBoundsCalculator,o=t.isDynamic,s=t.periodEnd,u=t.periodStart,l=t.representationId,d=t.representationBitrate,c=t.isEMSGWhitelisted,f=null!==(n=e.timescale)&&void 0!==n?n:1;this._availabilityTimeOffset=i,this._manifestBoundsCalculator=a;var v=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,p=v-u*f;if(void 0===e.duration)throw new Error("Invalid SegmentTemplate: no duration");var h=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:P(e.initialization.media,l,d),m=void 0===e.media?null:P(e.media,l,d);this._index={duration:e.duration,timescale:f,indexRange:e.indexRange,indexTimeOffset:p,initialization:null==e.initialization?void 0:{url:h,range:e.initialization.range},url:m,presentationTimeOffset:v,startNumber:e.startNumber,endNumber:e.endNumber},this._isDynamic=o,this._periodStart=u,this._scaledRelativePeriodEnd=void 0===s?void 0:(s-u)*f,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return Z(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){var n=this._index,r=n.duration,i=n.startNumber,a=n.endNumber,o=n.timescale,s=n.url,u=this._periodStart*o,l=this._scaledRelativePeriodEnd,d=e*o-u,c=(e+t)*o-u,f=this._getFirstSegmentStart(),v=this._getLastSegmentStart();if(null==f||null==v)return[];var p=Math.max(f,d),h=Math.min(v,c);if(h+r<=p)return[];for(var m=[],g=null!=i?i:1,y=Math.floor(p/r),_=y*r;_<=h;_+=r){var b=y+g;if(void 0!==a&&b>a)return m;var S=null!=l&&_+r>l?l-_:r,E=_+u,T=_+this._index.presentationTimeOffset,w=null===s?null:M(T,b)(s),k={id:String(b),number:b,time:E/o,end:(E+S)/o,duration:S/o,timescale:1,isInit:!1,scaledDuration:S/o,url:w,timestampOffset:-n.indexTimeOffset/o,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};m.push(k),y++}return m},t.getFirstAvailablePosition=function(){var e=this._getFirstSegmentStart();return null==e?e:e/this._index.timescale+this._periodStart},t.getLastAvailablePosition=function(){var e=this._getLastSegmentStart();if((0,i.Z)(e))return e;var t=this._estimateRelativeScaledEnd();return Math.min(e+this._index.duration,null!=t?t:1/0)/this._index.timescale+this._periodStart},t.getEnd=function(){if(!this._isDynamic)return this.getLastAvailablePosition();var e=this._estimateRelativeScaledEnd();if(void 0!==e){var t=this._index.timescale;return(e+this._periodStart*t)/t}},t.awaitSegmentBetween=function(e,t){if((0,U.Z)(e<=t),!this._isDynamic)return!1;var n=this._index.timescale,r=V(n),i=this._periodStart*n,a=t*n-i,o=this._estimateRelativeScaledEnd();return void 0===o?a+r>=0:e*n-i-r<o},t.shouldRefresh=function(){return!1},t.checkDiscontinuity=function(){return null},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;var t=this.getSegments(e.time,.1);return 0!==t.length&&(t[0].time===e.time&&t[0].end===e.end&&t[0].number===e.number)},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){if(!this._isDynamic)return!0;var e=this._estimateRelativeScaledEnd();if(void 0===e)return!1;var t=this._index.timescale,n=this._getLastSegmentStart();return!(0,i.Z)(n)&&n+this._index.duration+V(t)>=e},t.isInitialized=function(){return!0},t.initialize=function(){o.Z.error("A `TemplateRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `TemplateRepresentationIndex`")},t._replace=function(e){this._index=e._index,this._isDynamic=e._isDynamic,this._periodStart=e._periodStart,this._scaledRelativePeriodEnd=e._scaledRelativePeriodEnd,this._manifestBoundsCalculator=e._manifestBoundsCalculator},t._update=function(e){this._replace(e)},t._getFirstSegmentStart=function(){if(!this._isDynamic)return 0;if(0===this._scaledRelativePeriodEnd||void 0===this._scaledRelativePeriodEnd){var e=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0!==e&&e<this._periodStart)return null}var t=this._index,n=t.duration,r=t.timescale,i=this._manifestBoundsCalculator.estimateMinimumBound();if(void 0!==i){var a=i>this._periodStart?(i-this._periodStart)*r:0;return Math.floor(a/n)*n}},t._getLastSegmentStart=function(){var e,t=this._index,n=t.duration,r=t.timescale,i=t.endNumber,o=t.startNumber,s=void 0===o?1:o;if(this._isDynamic){var u=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0===u)return;if(void 0!==this._scaledRelativePeriodEnd&&this._scaledRelativePeriodEnd<(u-this._periodStart)*this._index.timescale){var l=Math.ceil(this._scaledRelativePeriodEnd/n);return void 0!==i&&i-s+1<l&&(l=i-s+1),(l-1)*n}var d=(u-this._periodStart)*r;if(d<0)return null;var c=(void 0!==this._availabilityTimeOffset?this._availabilityTimeOffset:0)*r,f=Math.floor((d+c)/n);return void 0!==i&&i-s+1<f&&(f=i-s+1),f<=0?null:(f-1)*n}var v=null!==(e=this._scaledRelativePeriodEnd)&&void 0!==e?e:0,p=Math.ceil(v/n);void 0!==i&&i-s+1<p&&(p=i-s+1);var h=(p-1)*n,m=a.Z.getCurrent().MINIMUM_SEGMENT_SIZE*r;return void 0!==i||v-h>m||p<2?h:(p-2)*n},t._estimateRelativeScaledEnd=function(){var e,t;if(void 0!==this._index.endNumber){var n=this._index.endNumber-(null!==(e=this._index.startNumber)&&void 0!==e?e:1)+1;return Math.max(Math.min(n*this._index.duration,null!==(t=this._scaledRelativePeriodEnd)&&void 0!==t?t:1/0),0)}if(void 0!==this._scaledRelativePeriodEnd)return Math.max(this._scaledRelativePeriodEnd,0)},e}();function Q(e,t){var n;if(0===t.length)return e;var r=t.map((function(e){return{url:e.value}}));if(0===e.length)return r;for(var i=[],a=0;a<e.length;a++)for(var o=e[a],s=0;s<r.length;s++){var l=r[s],d=(0,u.Z)(o.url,l.url);i.push({url:d,serviceLocation:null!==(n=l.serviceLocation)&&void 0!==n?n:o.serviceLocation})}return i}function $(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return J(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return J(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ee(e){var t=e.adaptationProfiles,n=e.manifestProfiles,r=e.codecs;if(void 0!==r)return-1===((null!=t?t:"")+(null!=n?n:"")).indexOf("http://dashif.org/guidelines/dash-if-uhd#hevc-hdr-pq10")||"hvc1.2.4.L153.B0"!==r&&"hev1.2.4.L153.B0"!==r?/^vp(08|09|10)/.exec(r)?function(e){var t,n,r,i=e.split("."),a=i[0],o=(i[1],i[2],i[3]),s=(i[4],i[5]),u=i[6],l=i[7];if(("vp08"===a||"vp09"===a||"vp10"===a)&&((void 0!==o&&"10"===o||"12"===o)&&(t=parseInt(o,10)),void 0!==u&&("16"===u?n="pq":"18"===u&&(n="hlg")),void 0!==s&&void 0!==l&&"09"===s&&"09"===l&&(r="rec2020"),void 0!==t&&void 0!==n))return{colorDepth:t,eotf:n,colorSpace:r}}(r):void 0:{colorDepth:10,eotf:"pq",colorSpace:"rec2020"}}function te(e,t,n){for(var r,i,a,u,l,d=[],c=function(){for(var e=l.value,c=null!=e.attributes.id?e.attributes.id:String(e.attributes.bitrate)+(null!=e.attributes.height?"-"+e.attributes.height:"")+(null!=e.attributes.width?"-"+e.attributes.width:"")+(null!=e.attributes.mimeType?"-"+e.attributes.mimeType:"")+(null!=e.attributes.codecs?"-"+e.attributes.codecs:"");d.some((function(e){return e.id===c}));)c+="-dup";var f=null!==(i=null===(r=n.unsafelyBaseOnPreviousAdaptation)||void 0===r?void 0:r.getRepresentation(c))&&void 0!==i?i:null,v=function(e,t){var n=[];if(void 0!==e.children.inbandEventStreams&&n.push.apply(n,e.children.inbandEventStreams),void 0!==t.children.inbandEventStreams&&n.push.apply(n,t.children.inbandEventStreams),0!==n.length)return n}(e,t),p=null!==(a=e.attributes.availabilityTimeComplete)&&void 0!==a?a:n.availabilityTimeComplete,h=(null!==(u=e.attributes.availabilityTimeOffset)&&void 0!==u?u:0)+n.availabilityTimeOffset,m=function(e,t){var n,r,i,a=t.availabilityTimeOffset,o=t.manifestBoundsCalculator,s=t.isDynamic,u=t.end,l=t.start,d=t.receivedTime,c=t.timeShiftBufferDepth,f=t.unsafelyBaseOnPreviousRepresentation,v=t.inbandEventStreams,p={availabilityTimeComplete:!0,availabilityTimeOffset:a,unsafelyBaseOnPreviousRepresentation:f,isEMSGWhitelisted:function(e){return void 0!==v&&v.some((function(t){return t.schemeIdUri===e.schemeIdUri}))},isLastPeriod:t.isLastPeriod,manifestBoundsCalculator:o,isDynamic:s,periodEnd:u,periodStart:l,receivedTime:d,representationBitrate:e.attributes.bitrate,representationId:e.attributes.id,timeShiftBufferDepth:c};if(void 0!==e.children.segmentBase){var h=e.children.segmentBase;i=new N(h,p)}else if(void 0!==e.children.segmentList){var m=e.children.segmentList;i=new O(m,p)}else if(void 0!==e.children.segmentTemplate||t.parentSegmentTemplates.length>0){var g=t.parentSegmentTemplates.slice(),y=e.children.segmentTemplate;void 0!==y&&g.push(y);var _=I.Z.apply(void 0,[{}].concat(g));p.availabilityTimeComplete=null!==(n=_.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,p.availabilityTimeOffset=(null!==(r=_.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,i=Y.isTimelineIndexArgument(_)?new Y(_,p):new X(_,p)}else{var b=t.adaptation.children;if(void 0!==b.segmentBase){var S=b.segmentBase;i=new N(S,p)}else if(void 0!==b.segmentList){var E=b.segmentList;i=new O(E,p)}else i=new X({duration:Number.MAX_VALUE,timescale:1,startNumber:0,media:""},p)}return i}(e,(0,I.Z)({},n,{availabilityTimeOffset:h,availabilityTimeComplete:p,unsafelyBaseOnPreviousRepresentation:f,adaptation:t,inbandEventStreams:v})),g=void 0;null==e.attributes.bitrate?(o.Z.warn("DASH: No usable bitrate found in the Representation."),g=0):g=e.attributes.bitrate;var y=Q(n.baseURLs,e.children.baseURLs),_={bitrate:g,cdnMetadata:0===y.length?[{baseUrl:"",id:void 0}]:y.map((function(e){return{baseUrl:e.url,id:e.serviceLocation}})),index:m,id:c},b=void 0;null!=e.attributes.codecs?b=e.attributes.codecs:null!=t.attributes.codecs&&(b=t.attributes.codecs),null!=b&&(b="mp4a.40.02"===b?"mp4a.40.2":b,_.codecs=b),null!=e.attributes.frameRate?_.frameRate=e.attributes.frameRate:null!=t.attributes.frameRate&&(_.frameRate=t.attributes.frameRate),null!=e.attributes.height?_.height=e.attributes.height:null!=t.attributes.height&&(_.height=t.attributes.height),null!=e.attributes.mimeType?_.mimeType=e.attributes.mimeType:null!=t.attributes.mimeType&&(_.mimeType=t.attributes.mimeType),null!=e.attributes.width?_.width=e.attributes.width:null!=t.attributes.width&&(_.width=t.attributes.width);var S=void 0!==t.children.contentProtections?t.children.contentProtections:[];if(void 0!==e.children.contentProtections&&S.push.apply(S,e.children.contentProtections),S.length>0){var E=S.reduce((function(e,t){var n;if(void 0!==t.attributes.schemeIdUri&&"urn:uuid:"===t.attributes.schemeIdUri.substring(0,9)&&(n=t.attributes.schemeIdUri.substring(9).replace(/-/g,"").toLowerCase()),void 0!==t.attributes.keyId&&t.attributes.keyId.length>0){var r={keyId:t.attributes.keyId,systemId:n};void 0===e.keyIds?e.keyIds=[r]:e.keyIds.push(r)}if(void 0!==n){for(var i,a=[],o=$(t.children.cencPssh);!(i=o()).done;){var u=i.value;a.push({systemId:n,data:u})}if(a.length>0){var l,d=(0,s.Z)(e.initData,(function(e){return"cenc"===e.type}));if(void 0===d)e.initData.push({type:"cenc",values:a});else(l=d.values).push.apply(l,a)}}return e}),{keyIds:void 0,initData:[]});(Object.keys(E.initData).length>0||void 0!==E.keyIds&&E.keyIds.length>0)&&(_.contentProtections=E)}_.hdrInfo=ee({adaptationProfiles:t.attributes.profiles,manifestProfiles:n.manifestProfiles,codecs:b}),d.push(_)},f=$(e);!(l=f()).done;)c();return d}function ne(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return re(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ie(e){if(void 0===e)return!1;var t="urn:tva:metadata:cs:AudioPurposeCS:2007"===e.schemeIdUri&&"1"===e.value,n="urn:mpeg:dash:role:2011"===e.schemeIdUri&&"description"===e.value;return t||n}function ae(e,t){if(void 0!==e&&e.some((function(e){return"urn:tva:metadata:cs:AudioPurposeCS:2007"===e.schemeIdUri&&"2"===e.value})))return!0;if(void 0!==t&&t.some((function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri&&"caption"===e.value})))return!0;return!1}function oe(e){return void 0!==e&&("urn:mpeg:dash:role:2011"===e.schemeIdUri&&"sign"===e.value)}function se(e,t){if((0,S.Z)(e.attributes.id))return e.attributes.id;var n=t.isClosedCaption,r=t.isForcedSubtitle,i=t.isAudioDescription,a=t.isSignInterpreted,o=t.isTrickModeTrack,s=t.type;return(0,S.Z)(e.attributes.language)&&(s+="-"+e.attributes.language),!0===n&&(s+="-cc"),!0===r&&(s+="-cc"),!0===i&&(s+="-ad"),!0===a&&(s+="-si"),o&&(s+="-trickMode"),(0,S.Z)(e.attributes.contentType)&&(s+="-"+e.attributes.contentType),(0,S.Z)(e.attributes.codecs)&&(s+="-"+e.attributes.codecs),(0,S.Z)(e.attributes.mimeType)&&(s+="-"+e.attributes.mimeType),void 0!==e.attributes.frameRate&&(s+="-"+String(e.attributes.frameRate)),s}function ue(e){if(null!=e.children.supplementalProperties)for(var t,n=ne(e.children.supplementalProperties);!(t=n()).done;){var r=t.value;if("urn:mpeg:dash:adaptation-set-switching:2016"===r.schemeIdUri&&null!=r.value)return r.value.split(",").map((function(e){return e.trim()})).filter((function(e){return e}))}return[]}function le(e,t){var n=t[1].priority-e[1].priority;return 0!==n?n:e[1].isMainAdaptation!==t[1].isMainAdaptation?e[1].isMainAdaptation?-1:1:e[1].indexInMpd-t[1].indexInMpd}function de(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ce(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var fe=(0,p.Z)();function ve(e,t){var n,r,i,a,u,l,d=[],c=function(e,t){var n=[];return e.forEach((function(r,i){var a,o;if(null!=r.attributes.start)a=r.attributes.start;else if(0===i)a=t.isDynamic&&null!=t.availabilityStartTime?t.availabilityStartTime:0;else{var s=n[n.length-1];if(null==s||null==s.periodEnd)throw new Error("Missing start time when parsing periods.");a=s.periodEnd}var u=e[i+1];null!=r.attributes.duration?o=r.attributes.duration:i===e.length-1?o=t.duration:null!=u.attributes.start&&(o=u.attributes.start-a);var l=null!=o?a+o:void 0;n.push({periodStart:a,periodDuration:o,periodEnd:l})})),n}(e,t);if(c.length!==e.length)throw new Error("MPD parsing error: the time information are incoherent.");var f=t.isDynamic,p=t.timeShiftBufferDepth,E=new g({isDynamic:f,timeShiftBufferDepth:p});f||null==t.duration||E.setLastPosition(t.duration);for(var T=function(g){var T=g===e.length-1,k=e[g],I=t.xlinkInfos.get(k),R=Q(t.baseURLs,k.children.baseURLs),Z=c[g],x=Z.periodStart,P=Z.periodDuration,M=Z.periodEnd,C=void 0;for(null==k.attributes.id?(o.Z.warn("DASH: No usable id found in the Period. Generating one."),C="gen-dash-period-"+fe()):C=k.attributes.id;d.some((function(e){return e.id===C}));)C+="-dup";var D=void 0!==I?I.receivedTime:t.receivedTime,N=null!==(r=null===(n=t.unsafelyBaseOnPreviousManifest)||void 0===n?void 0:n.getPeriod(C))&&void 0!==r?r:null,O=null===(i=k.attributes.availabilityTimeComplete)||void 0===i||i,L=null!==(a=k.attributes.availabilityTimeOffset)&&void 0!==a?a:0,U=t.manifestProfiles,B=k.children.segmentTemplate,F={availabilityTimeComplete:O,availabilityTimeOffset:L,baseURLs:R,manifestBoundsCalculator:E,end:M,isDynamic:f,isLastPeriod:T,manifestProfiles:U,receivedTime:D,segmentTemplate:B,start:x,timeShiftBufferDepth:p,unsafelyBaseOnPreviousPeriod:N},z=function(e,t){for(var n,r,i,a,u,l,d,c,f={video:[],audio:[],text:[]},v=[],p={},h=[],m=-1,g=0;g<e.length;g++){var E=e[g],T=E.children,k=T.essentialProperties,I=T.roles,R=T.label,Z=Array.isArray(I)&&I.some((function(e){return"main"===e.value}))&&I.some((function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri})),x=E.children.representations,P=null!==(n=E.attributes.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,M=(null!==(r=E.attributes.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,C=E.attributes.mimeType,D=E.attributes.codecs,N=A(x,(0,S.Z)(C)?C:null,(0,S.Z)(D)?D:null,null!=T.roles?T.roles:null);if(void 0!==N){var O=null!==(i=E.attributes.selectionPriority)&&void 0!==i?i:1,L=E.attributes.id,U=void 0,B=ue(E),F=[];void 0!==t.segmentTemplate&&F.push(t.segmentTemplate),void 0!==E.children.segmentTemplate&&F.push(E.children.segmentTemplate);var z={availabilityTimeComplete:P,availabilityTimeOffset:M,baseURLs:Q(t.baseURLs,T.baseURLs),manifestBoundsCalculator:t.manifestBoundsCalculator,end:t.end,isDynamic:t.isDynamic,isLastPeriod:t.isLastPeriod,manifestProfiles:t.manifestProfiles,parentSegmentTemplates:F,receivedTime:t.receivedTime,start:t.start,timeShiftBufferDepth:t.timeShiftBufferDepth,unsafelyBaseOnPreviousAdaptation:null},V=Array.isArray(k)?(0,s.Z)(k,(function(e){return"http://dashif.org/guidelines/trickmode"===e.schemeIdUri})):void 0,K=null===(a=null==V?void 0:V.value)||void 0===a?void 0:a.split(" "),G=void 0!==K;if("video"===N&&Z&&m>=0&&f.video.length>m&&!G){var j,H=f.video[m][0];z.unsafelyBaseOnPreviousAdaptation=null!==(l=null===(u=t.unsafelyBaseOnPreviousPeriod)||void 0===u?void 0:u.getAdaptation(H.id))&&void 0!==l?l:null;var W=te(x,E,z);(j=H.representations).push.apply(j,W),U=H.id}else{var q=T.accessibilities,Y=void 0;void 0!==I&&I.some((function(e){return"dub"===e.value}))&&(Y=!0);var X=void 0;X="text"===N&&ae(q,I);var $=void 0;"text"===N&&void 0!==I&&I.some((function(e){return"forced-subtitle"===e.value||"forced_subtitle"===e.value}))&&($=!0);var J=void 0;"audio"!==N?J=!1:void 0!==q&&(J=q.some(ie));var ee=void 0;"video"!==N?ee=!1:void 0!==q&&(ee=q.some(oe));for(var re=se(E,{isAudioDescription:J,isForcedSubtitle:$,isClosedCaption:X,isSignInterpreted:ee,isTrickModeTrack:G,type:N});(0,b.Z)(h,re);)re+="-dup";U=re,h.push(re),z.unsafelyBaseOnPreviousAdaptation=null!==(c=null===(d=t.unsafelyBaseOnPreviousPeriod)||void 0===d?void 0:d.getAdaptation(re))&&void 0!==c?c:null;var de={id:re,representations:te(x,E,z),type:N,isTrickModeTrack:G};if(null!=E.attributes.language&&(de.language=E.attributes.language),null!=X&&(de.closedCaption=X),null!=J&&(de.audioDescription=J),!0===Y&&(de.isDub=!0),void 0!==$&&(de.forcedSubtitles=$),!0===ee&&(de.isSignInterpreted=!0),void 0!==R&&(de.label=R),void 0!==K)v.push({adaptation:de,trickModeAttachedAdaptationIds:K});else{for(var ce,fe=-1,ve=function(){var e=ce.value,t=p[e];if(void 0!==t&&t.newID!==U&&(0,b.Z)(t.adaptationSetSwitchingIDs,L)){fe=(0,_.Z)(f[N],(function(t){return t[0].id===e}));var n,r=f[N][fe];void 0!==r&&r[0].audioDescription===de.audioDescription&&r[0].closedCaption===de.closedCaption&&r[0].language===de.language&&(o.Z.info('DASH Parser: merging "switchable" AdaptationSets',L,e),(n=r[0].representations).push.apply(n,de.representations),"video"===N&&Z&&!r[1].isMainAdaptation&&(m=Math.max(m,fe)),r[1]={priority:Math.max(O,r[1].priority),isMainAdaptation:Z||r[1].isMainAdaptation,indexInMpd:Math.min(g,r[1].indexInMpd)})}},pe=ne(B);!(ce=pe()).done;)ve();fe<0&&(f[N].push([de,{priority:O,isMainAdaptation:Z,indexInMpd:g}]),"video"===N&&Z&&(m=f.video.length-1))}}null!=L&&null==p[L]&&(p[L]={newID:U,adaptationSetSwitchingIDs:B})}}var he=y.r.reduce((function(e,t){var n=f[t];return n.length>0&&(n.sort(le),e[t]=n.map((function(e){return e[0]}))),e}),{});return f.video.sort(le),w(he,v),he}(k.children.adaptations,F),V=(null!==(u=t.xmlNamespaces)&&void 0!==u?u:[]).concat(null!==(l=k.attributes.namespaces)&&void 0!==l?l:[]),K=function(e,t,n){for(var r,i,a,o=[],s=de(e);!(a=s()).done;)for(var u,l=a.value,d=l.attributes,c=d.schemeIdUri,f=void 0===c?"":c,v=d.timescale,p=void 0===v?1:v,h=n.concat(null!==(r=l.attributes.namespaces)&&void 0!==r?r:[]),g=de(l.children.events);!(u=g()).done;){var y=u.value;if(void 0!==y.eventStreamData){var _=(null!==(i=y.presentationTime)&&void 0!==i?i:0)/p+t,b=void 0===y.duration?void 0:_+y.duration/p,S=void 0;if(y.eventStreamData instanceof Element)S=y.eventStreamData;else{var E=h.reduce((function(e,t){return e+"xmlns:"+t.key+'="'+t.value+'" '}),"<toremove ");E+=">";var T=(0,m.uR)(new Uint8Array(y.eventStreamData));S=(new DOMParser).parseFromString(E+T+"</toremove>","application/xml").documentElement.childNodes[0]}o.push({start:_,end:b,id:y.id,data:{type:"dash-event-stream",value:{schemeIdUri:f,timescale:p,element:S}}})}}return o}(k.children.eventStreams,x,V),G={id:C,start:x,end:M,duration:P,adaptations:z,streamEvents:K};if(d.unshift(G),!E.lastPositionIsKnown()){var j=function(e){for(var t,n=null,r=!0,i=(0,h.Z)(e).filter((function(e){return null!=e})),a=de((0,v.Z)(i,(function(e){return e})));!(t=a()).done;)for(var o,s=de(t.value.representations);!(o=s()).done;){var u=o.value.index.getLastAvailablePosition();null!==u&&(r=!1,"number"==typeof u&&(n=null==n?u:Math.max(n,u)))}if(null!=n)return n;if(r)return null;return}(z);if(f)if("number"==typeof j){var H=performance.now()/1e3;E.setLastPosition(j,H)}else{var W=pe(t,x);if(void 0!==W){var q=W[0],Y=W[1];E.setLastPosition(q,Y)}}else"number"==typeof j&&E.setLastPosition(j)}},k=e.length-1;k>=0;k--)T(k);if(t.isDynamic&&!E.lastPositionIsKnown()){var I=pe(t,0);if(void 0!==I){var R=I[0],Z=I[1];E.setLastPosition(R,Z)}}return function(e){if(0===e.length)return[];for(var t=[e[0]],n=1;n<e.length;n++){for(var r=e[n],i=t[t.length-1];(void 0===i.duration||i.start+i.duration>r.start)&&(o.Z.warn("DASH: Updating overlapping Periods.",null==i?void 0:i.start,r.start),i.duration=r.start-i.start,i.end=r.start,!(i.duration>0));)t.pop(),i=t[t.length-1];t.push(r)}return t}(d)}function pe(e,t){if(null!=e.clockOffset){var n=e.clockOffset/1e3-e.availabilityStartTime,r=performance.now()/1e3,i=r+n;if(i>=t)return[i,r]}else{var a=Date.now()/1e3;if(a>=t)return o.Z.warn("DASH Parser: no clock synchronization mechanism found. Using the system clock instead."),[a-e.availabilityStartTime,performance.now()/1e3]}}function he(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return me(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return me(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ge=function e(t,n,r,i,d){void 0===d&&(d=new WeakMap);var c=t.children,v=t.attributes;if(null==n.externalClockOffset){var p="dynamic"===v.type,h=(0,s.Z)(c.utcTimings,(function(e){return"urn:mpeg:dash:utc:direct:2014"===e.schemeIdUri&&null!=e.value})),m=null!=h&&null!=h.value?l(h.value):void 0,g=null==m||isNaN(m)?void 0:m;if(null!=g&&!0!==i)n.externalClockOffset=g;else if(p&&!0!==i){var y=function(e){var t=e.children.utcTimings.filter((function(e){return("urn:mpeg:dash:utc:http-iso:2014"===e.schemeIdUri||"urn:mpeg:dash:utc:http-xsdate:2014"===e.schemeIdUri)&&void 0!==e.value}));return t.length>0?t[0].value:void 0}(t);if(null!=y&&y.length>0)return{type:"needs-clock",value:{url:y,continue:function(i){return i.success?(n.externalClockOffset=l(i.data),e(t,n,r,!0)):(r.push(i.error),o.Z.warn("DASH Parser: Error on fetching the clock ressource",i.error),e(t,n,r,!0))}}}}}for(var _=[],b=0;b<c.periods.length;b++){var S=c.periods[b].attributes,E=S.xlinkHref,T=S.xlinkActuate;null!=E&&"onLoad"===T&&_.push({index:b,ressource:E})}return 0===_.length?function(e,t,n,r){var i,s,l,d,c,v,p=e.children,h=e.attributes,m="dynamic"===h.type,g=Q(void 0!==t.url?[{url:t.url.substring(0,(0,u.$)(t.url))}]:[],p.baseURLs),y=function(e,t){return"dynamic"!==e.type?0:null==e.availabilityStartTime?null==t?0:t:e.availabilityStartTime}(h,t.referenceDateTime),_=h.timeShiftBufferDepth,b=t.externalClockOffset,S=t.unsafelyBaseOnPreviousManifest,E={availabilityStartTime:y,baseURLs:g,clockOffset:b,duration:h.duration,isDynamic:m,manifestProfiles:e.attributes.profiles,receivedTime:t.manifestReceivedTime,timeShiftBufferDepth:_,unsafelyBaseOnPreviousManifest:S,xlinkInfos:r,xmlNamespaces:e.attributes.namespaces},T=ve(p.periods,E),w=h.duration,k=null;void 0!==h.minimumUpdatePeriod&&h.minimumUpdatePeriod>=0&&(d=0===h.minimumUpdatePeriod?a.Z.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:h.minimumUpdatePeriod);var A=f(T),I=A.minimumSafePosition,R=A.maximumSafePosition,Z=A.maximumUnsafePosition,x=performance.now();if(m){var P,M;if(c=I,k=null!=_?_:null,void 0!==Z&&(M=Z),void 0!==R)P=R;else{var C=null!=y?y:0,D=t.externalClockOffset;if(void 0===D)o.Z.warn("DASH Parser: use system clock to define maximum position"),P=Date.now()/1e3-C;else P=(performance.now()+D)/1e3-C}void 0===M&&(M=P),v={isLinear:!0,maximumSafePosition:P,livePosition:M,time:x},null!==k&&void 0!==c&&P-c>k&&(k=P-c)}else{c=void 0!==I?I:void 0!==(null===(i=T[0])||void 0===i?void 0:i.start)?T[0].start:0;var N=null!=w?w:1/0;if(void 0!==T[T.length-1]){var O=T[T.length-1],L=null!==(s=O.end)&&void 0!==s?s:void 0!==O.duration?O.start+O.duration:void 0;void 0!==L&&L<N&&(N=L)}void 0!==R&&R<N&&(N=R),v={isLinear:!1,maximumSafePosition:N,livePosition:void 0,time:x}}var U=!m||void 0===e.attributes.minimumUpdatePeriod&&(void 0!==(null===(l=T[T.length-1])||void 0===l?void 0:l.end)||void 0!==e.attributes.duration);return{type:"done",value:{parsed:{availabilityStartTime:y,clockOffset:t.externalClockOffset,isDynamic:m,isLive:m,isLastPeriodKnown:U,periods:T,publishTime:h.publishTime,suggestedPresentationDelay:h.suggestedPresentationDelay,transportType:"dash",timeBounds:{minimumSafePosition:c,timeshiftDepth:k,maximumTimeData:v},lifetime:d,uris:null==t.url?p.locations:[t.url].concat(p.locations)},warnings:n}}}(t,n,r,d):{type:"needs-xlinks",value:{xlinksUrls:_.map((function(e){return e.ressource})),continue:function(a){if(a.length!==_.length)throw new Error("DASH parser: wrong number of loaded ressources.");for(var o=a.length-1;o>=0;o--){var s,u=_[o].index,l=a[o],f=l.parsed,v=l.warnings,p=l.receivedTime,h=l.sendingTime,m=l.url;v.length>0&&r.push.apply(r,v);for(var g,y=he(f);!(g=y()).done;){var b=g.value;d.set(b,{receivedTime:p,sendingTime:h,url:m})}(s=c.periods).splice.apply(s,[u,1].concat(f))}return e(t,n,r,i,d)}}}};function ye(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function _e(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"id":t.id=r.value;break;case"lang":t.language=r.value;break;case"contentType":t.contentType=r.value;break;case"par":t.par=r.value}}return t}var be=n(7326),Se=n(4578),Ee=n(2146),Te=n(9689),we=/^P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,ke=/([0-9]+)-([0-9]+)/;function Ae(e,t){return"true"===e?[!0,null]:"false"===e?[!1,null]:[!1,new Le("`"+t+'` property is not a boolean value but "'+e+'"')]}function Ie(e,t){var n=parseInt(e,10);return isNaN(n)?[null,new Le("`"+t+'` property is not an integer value but "'+e+'"')]:[n,null]}function Re(e,t){if("INF"===e)return[1/0,null];var n=parseFloat(e);return isNaN(n)?[null,new Le("`"+t+'` property is invalid: "'+e+'"')]:[n,null]}function Ze(e,t){if("true"===e)return[!0,null];if("false"===e)return[!1,null];var n=parseInt(e,10);return isNaN(n)?[null,new Le("`"+t+'` property is not a boolean nor an integer but "'+e+'"')]:[n,null]}function xe(e,t){var n=Date.parse(e);return isNaN(n)?[null,new Le("`"+t+'` is in an invalid date format: "'+e+'"')]:[new Date(Date.parse(e)).getTime()/1e3,null]}function Pe(e,t){if(!(0,S.Z)(e))return[0,new Le("`"+t+"` property is empty")];var n=we.exec(e);return null===n?[null,new Le("`"+t+'` property has an unrecognized format "'+e+'"')]:[365*parseFloat((0,S.Z)(n[2])?n[2]:"0")*24*60*60+30*parseFloat((0,S.Z)(n[4])?n[4]:"0")*24*60*60+24*parseFloat((0,S.Z)(n[6])?n[6]:"0")*60*60+60*parseFloat((0,S.Z)(n[8])?n[8]:"0")*60+60*parseFloat((0,S.Z)(n[10])?n[10]:"0")+parseFloat((0,S.Z)(n[12])?n[12]:"0"),null]}function Me(e,t){var n=ke.exec(e);return null===n?[null,new Le("`"+t+'` property has an unrecognized format "'+e+'"')]:[[+n[1],+n[2]],null]}function Ce(e,t){try{return[(0,Te.K)(e),null]}catch(n){return[null,new Le("`"+t+'` is not a valid base64 string: "'+e+'"')]}}function De(e,t){var n=/^(\d+)\/(\d+)$/.exec(e);return null!==n?[+n[1]/+n[2],null]:Re(e,t)}function Ne(e){for(var t,n,r=0;r<e.attributes.length;r++){var i=e.attributes[r];switch(i.name){case"schemeIdUri":t=i.value;break;case"value":n=i.value}}return{schemeIdUri:t,value:n}}function Oe(e,t){return function(n,r){var i=r.asKey,a=(0,r.parser)(n,r.dashName),s=a[0],u=a[1];null!==u&&(o.Z.warn(u.message),t.push(u)),null!==s&&(e[i]=s)}}var Le=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,be.Z)(r),t.prototype),r.name="MPDError",r.message=n,r}return(0,Se.Z)(t,e),t}((0,Ee.Z)(Error));function Ue(e){var t=function(e){for(var t=[],n=[],r=0;r<e.length;r++)if(e[r].nodeType===Node.ELEMENT_NODE){var i=e[r];if("cenc:pssh"===i.nodeName){var a=i.textContent;if(null!==a&&a.length>0){var s=Ce(a,"cenc:pssh"),u=s[0],l=s[1];null!==l&&(o.Z.warn(l.message),t.push(l)),null!==u&&n.push(u)}}}return[{cencPssh:n},t]}(e.childNodes),n=t[0],r=t[1];return[{children:n,attributes:function(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"schemeIdUri":t.schemeIdUri=r.value;break;case"value":t.value=r.value;break;case"cenc:default_KID":t.keyId=(0,m.nr)(r.value.replace(/-/g,""))}}return t}(e)},r]}function Be(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"range":r(a.value,{asKey:"range",parser:Me,dashName:"range"});break;case"sourceURL":t.media=a.value}}return[t,n]}function Fe(e){for(var t={},n=[],r=Oe(t,n),i=e.childNodes,a=0;a<i.length;a++)if(i[a].nodeType===Node.ELEMENT_NODE){var o=i[a];if("Initialization"===o.nodeName){var s=Be(o),u=s[0],l=s[1];t.initialization=u,n=n.concat(l)}}for(var d=0;d<e.attributes.length;d++){var c=e.attributes[d];switch(c.name){case"timescale":r(c.value,{asKey:"timescale",parser:Ie,dashName:"timescale"});break;case"presentationTimeOffset":r(c.value,{asKey:"presentationTimeOffset",parser:Re,dashName:"presentationTimeOffset"});break;case"indexRange":r(c.value,{asKey:"indexRange",parser:Me,dashName:"indexRange"});break;case"indexRangeExact":r(c.value,{asKey:"indexRangeExact",parser:Ae,dashName:"indexRangeExact"});break;case"availabilityTimeOffset":r(c.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(c.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"});break;case"duration":r(c.value,{asKey:"duration",parser:Ie,dashName:"duration"});break;case"startNumber":r(c.value,{asKey:"startNumber",parser:Ie,dashName:"startNumber"});break;case"endNumber":r(c.value,{asKey:"endNumber",parser:Ie,dashName:"endNumber"})}}return[t,n]}function ze(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"media":t.media=a.value;break;case"indexRange":r(a.value,{asKey:"indexRange",parser:Me,dashName:"indexRange"});break;case"index":t.index=a.value;break;case"mediaRange":r(a.value,{asKey:"mediaRange",parser:Me,dashName:"mediaRange"})}}return[t,n]}function Ve(e){for(var t=Fe(e),n=t[0],r=t[1],i=[],a=e.childNodes,o=0;o<a.length;o++)if(a[o].nodeType===Node.ELEMENT_NODE){var s=a[o];if("SegmentURL"===s.nodeName){var u=ze(s),l=u[0],d=u[1];i.push(l),r=r.concat(d)}}return[(0,I.Z)(n,{list:i}),r]}function Ke(e){var t=null;return function(){if(null===t){var n=e.getElementsByTagName("S");return t=n,n}return t}}function Ge(e){for(var t,n=Fe(e),r=n[0],i=n[1],a=0;a<e.childNodes.length;a++)if(e.childNodes[a].nodeType===Node.ELEMENT_NODE){var o=e.childNodes[a];"SegmentTimeline"===o.nodeName&&(t=Ke(o))}for(var s=(0,I.Z)({},r,{duration:r.duration,timelineParser:t}),u=Oe(s,i),l=0;l<e.attributes.length;l++){var d=e.attributes[l];switch(d.nodeName){case"initialization":null==s.initialization&&(s.initialization={media:d.value});break;case"index":s.index=d.value;break;case"availabilityTimeOffset":u(d.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":u(d.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"});break;case"media":s.media=d.value;break;case"bitstreamSwitching":u(d.value,{asKey:"bitstreamSwitching",parser:Ae,dashName:"bitstreamSwitching"})}}return[s,i]}function je(e){var t=function(e){for(var t={baseURLs:[]},n=[],r=[],i=0;i<e.length;i++)if(e[i].nodeType===Node.ELEMENT_NODE){var a=e[i];switch(a.nodeName){case"BaseURL":var o=ye(a),s=o[0],u=o[1];void 0!==s&&t.baseURLs.push(s),r=r.concat(u);break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Ne(a));break;case"SegmentBase":var l=Fe(a),d=l[0],c=l[1];t.segmentBase=d,c.length>0&&(r=r.concat(c));break;case"SegmentList":var f=Ve(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=Ge(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=Ue(a),_=y[0],b=y[1];b.length>0&&(r=r.concat(b)),void 0!==_&&n.push(_)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"audioSamplingRate":t.audioSamplingRate=a.value;break;case"bandwidth":r(a.value,{asKey:"bitrate",parser:Ie,dashName:"bandwidth"});break;case"codecs":t.codecs=a.value;break;case"codingDependency":r(a.value,{asKey:"codingDependency",parser:Ae,dashName:"codingDependency"});break;case"frameRate":r(a.value,{asKey:"frameRate",parser:De,dashName:"frameRate"});break;case"height":r(a.value,{asKey:"height",parser:Ie,dashName:"height"});break;case"id":t.id=a.value;break;case"maxPlayoutRate":r(a.value,{asKey:"maxPlayoutRate",parser:Re,dashName:"maxPlayoutRate"});break;case"maximumSAPPeriod":r(a.value,{asKey:"maximumSAPPeriod",parser:Re,dashName:"maximumSAPPeriod"});break;case"mimeType":t.mimeType=a.value;break;case"profiles":t.profiles=a.value;break;case"qualityRanking":r(a.value,{asKey:"qualityRanking",parser:Ie,dashName:"qualityRanking"});break;case"segmentProfiles":t.segmentProfiles=a.value;break;case"width":r(a.value,{asKey:"width",parser:Ie,dashName:"width"});break;case"availabilityTimeOffset":r(a.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(a.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"})}}return void 0===t.bitrate&&n.push(new Le("No bitrate found on a Representation")),[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function He(e){var t=function(e){for(var t={baseURLs:[],representations:[]},n=[],r=[],i=0;i<e.length;i++)if(e[i].nodeType===Node.ELEMENT_NODE){var a=e[i];switch(a.nodeName){case"Accessibility":void 0===t.accessibilities?t.accessibilities=[Ne(a)]:t.accessibilities.push(Ne(a));break;case"BaseURL":var o=ye(a),s=o[0],u=o[1];void 0!==s&&t.baseURLs.push(s),u.length>0&&(r=r.concat(u));break;case"ContentComponent":t.contentComponent=_e(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[Ne(a)]:t.essentialProperties.push(Ne(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Ne(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=je(a),c=d[0],f=d[1];t.representations.push(c),f.length>0&&(r=r.concat(f));break;case"Role":null==t.roles?t.roles=[Ne(a)]:t.roles.push(Ne(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Ne(a)]:t.supplementalProperties.push(Ne(a));break;case"SegmentBase":var v=Fe(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Ve(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=Ge(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var E=Ue(a),T=E[0],w=E[1];w.length>0&&(r=r.concat(w)),void 0!==T&&n.push(T)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"group":r(a.value,{asKey:"group",parser:Ie,dashName:"group"});break;case"lang":t.language=a.value;break;case"contentType":t.contentType=a.value;break;case"par":t.par=a.value;break;case"minBandwidth":r(a.value,{asKey:"minBitrate",parser:Ie,dashName:"minBandwidth"});break;case"maxBandwidth":r(a.value,{asKey:"maxBitrate",parser:Ie,dashName:"maxBandwidth"});break;case"minWidth":r(a.value,{asKey:"minWidth",parser:Ie,dashName:"minWidth"});break;case"maxWidth":r(a.value,{asKey:"maxWidth",parser:Ie,dashName:"maxWidth"});break;case"minHeight":r(a.value,{asKey:"minHeight",parser:Ie,dashName:"minHeight"});break;case"maxHeight":r(a.value,{asKey:"maxHeight",parser:Ie,dashName:"maxHeight"});break;case"minFrameRate":r(a.value,{asKey:"minFrameRate",parser:De,dashName:"minFrameRate"});break;case"maxFrameRate":r(a.value,{asKey:"maxFrameRate",parser:De,dashName:"maxFrameRate"});break;case"selectionPriority":r(a.value,{asKey:"selectionPriority",parser:Ie,dashName:"selectionPriority"});break;case"segmentAlignment":r(a.value,{asKey:"segmentAlignment",parser:Ze,dashName:"segmentAlignment"});break;case"subsegmentAlignment":r(a.value,{asKey:"subsegmentAlignment",parser:Ze,dashName:"subsegmentAlignment"});break;case"bitstreamSwitching":r(a.value,{asKey:"bitstreamSwitching",parser:Ae,dashName:"bitstreamSwitching"});break;case"audioSamplingRate":t.audioSamplingRate=a.value;break;case"codecs":t.codecs=a.value;break;case"codingDependency":r(a.value,{asKey:"codingDependency",parser:Ae,dashName:"codingDependency"});break;case"frameRate":r(a.value,{asKey:"frameRate",parser:De,dashName:"frameRate"});break;case"height":r(a.value,{asKey:"height",parser:Ie,dashName:"height"});break;case"maxPlayoutRate":r(a.value,{asKey:"maxPlayoutRate",parser:Re,dashName:"maxPlayoutRate"});break;case"maximumSAPPeriod":r(a.value,{asKey:"maximumSAPPeriod",parser:Re,dashName:"maximumSAPPeriod"});break;case"mimeType":t.mimeType=a.value;break;case"profiles":t.profiles=a.value;break;case"segmentProfiles":t.segmentProfiles=a.value;break;case"width":r(a.value,{asKey:"width",parser:Ie,dashName:"width"});break;case"availabilityTimeOffset":r(a.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(a.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"})}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function We(e){for(var t={children:{events:[]},attributes:{}},n=[],r=Oe(t.attributes,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"schemeIdUri":t.attributes.schemeIdUri=a.value;break;case"timescale":r(a.value,{asKey:"timescale",parser:Ie,dashName:"timescale"});break;case"value":t.attributes.value=a.value}}for(var o=0;o<e.childNodes.length;o++)if(e.childNodes[o].nodeType===Node.ELEMENT_NODE){var s=e.childNodes[o];if("Event"===s.nodeName){var u=qe(s),l=u[0],d=u[1];t.children.events.push(l),d.length>0&&(n=n.concat(d))}}return[t,n]}function qe(e){for(var t={eventStreamData:e},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"presentationTime":r(a.value,{asKey:"presentationTime",parser:Ie,dashName:"presentationTime"});break;case"duration":r(a.value,{asKey:"duration",parser:Ie,dashName:"duration"});break;case"id":t.id=a.value}}return[t,n]}function Ye(e){var t=function(e){for(var t,n=[],r=[],i=[],a=[],o=0;o<e.length;o++)if(e[o].nodeType===Node.ELEMENT_NODE){var s=e[o];switch(s.nodeName){case"BaseURL":var u=ye(s),l=u[0],d=u[1];void 0!==l&&n.push(l),i=i.concat(d);break;case"AdaptationSet":var c=He(s),f=c[0],v=c[1];r.push(f),i=i.concat(v);break;case"EventStream":var p=We(s),h=p[0],m=p[1];a.push(h),i=i.concat(m);break;case"SegmentTemplate":var g=Ge(s),y=g[0],_=g[1];t=y,_.length>0&&(i=i.concat(_))}}return[{baseURLs:n,adaptations:r,eventStreams:a,segmentTemplate:t},i]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"start":r(a.value,{asKey:"start",parser:Pe,dashName:"start"});break;case"duration":r(a.value,{asKey:"duration",parser:Pe,dashName:"duration"});break;case"bitstreamSwitching":r(a.value,{asKey:"bitstreamSwitching",parser:Ae,dashName:"bitstreamSwitching"});break;case"xlink:href":t.xlinkHref=a.value;break;case"xlink:actuate":t.xlinkActuate=a.value}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function Xe(e){var t=function(e){for(var t=[],n=[],r=[],i=[],a=[],o=0;o<e.length;o++)if(e[o].nodeType===Node.ELEMENT_NODE){var s=e[o];switch(s.nodeName){case"BaseURL":var u=ye(s),l=u[0],d=u[1];void 0!==l&&t.push(l),a=a.concat(d);break;case"Location":n.push(null===s.textContent?"":s.textContent);break;case"Period":var c=Ye(s),f=c[0],v=c[1];r.push(f),a=a.concat(v);break;case"UTCTiming":var p=Ne(s);i.push(p)}}return[{baseURLs:t,locations:n,periods:r,utcTimings:i},a]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"profiles":t.profiles=a.value;break;case"type":t.type=a.value;break;case"availabilityStartTime":r(a.value,{asKey:"availabilityStartTime",parser:xe,dashName:"availabilityStartTime"});break;case"availabilityEndTime":r(a.value,{asKey:"availabilityEndTime",parser:xe,dashName:"availabilityEndTime"});break;case"publishTime":r(a.value,{asKey:"publishTime",parser:xe,dashName:"publishTime"});break;case"mediaPresentationDuration":r(a.value,{asKey:"duration",parser:Pe,dashName:"mediaPresentationDuration"});break;case"minimumUpdatePeriod":r(a.value,{asKey:"minimumUpdatePeriod",parser:Pe,dashName:"minimumUpdatePeriod"});break;case"minBufferTime":r(a.value,{asKey:"minBufferTime",parser:Pe,dashName:"minBufferTime"});break;case"timeShiftBufferDepth":r(a.value,{asKey:"timeShiftBufferDepth",parser:Pe,dashName:"timeShiftBufferDepth"});break;case"suggestedPresentationDelay":r(a.value,{asKey:"suggestedPresentationDelay",parser:Pe,dashName:"suggestedPresentationDelay"});break;case"maxSegmentDuration":r(a.value,{asKey:"maxSegmentDuration",parser:Pe,dashName:"maxSegmentDuration"});break;case"maxSubsegmentDuration":r(a.value,{asKey:"maxSubsegmentDuration",parser:Pe,dashName:"maxSubsegmentDuration"})}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}var Qe=function(e,t){var n=e.documentElement;if((0,i.Z)(n)||"MPD"!==n.nodeName)throw new Error("DASH Parser: document root should be MPD");var a=Xe(n),o=a[0],s=a[1];return function e(t){if("done"===t.type)return t;if("needs-clock"===t.type)return{type:"needs-resources",value:{urls:[t.value.url],format:"string",continue:function(n){if(1!==n.length)throw new Error("DASH parser: wrong number of loaded ressources.");var r=t.value.continue(n[0].responseData);return e(r)}}};if("needs-xlinks"===t.type)return{type:"needs-resources",value:{urls:t.value.xlinksUrls,format:"string",continue:function(n){for(var r=[],i=0;i<n.length;i++){var a=n[i],o=a.responseData,s=a.receivedTime,u=a.sendingTime,l=a.url;if(!o.success)throw o.error;var d="<root>"+o.data+"</root>",c=(new DOMParser).parseFromString(d,"text/xml");if(null==c||0===c.children.length)throw new Error("DASH parser: Invalid external ressources");for(var f=c.children[0].children,v=[],p=[],h=0;h<f.length;h++)if(f[h].nodeType===Node.ELEMENT_NODE){var m,g=Ye(f[h]),y=g[0],_=g[1];(m=p).push.apply(m,_),v.push(y)}r.push({url:l,receivedTime:s,sendingTime:u,parsed:v,warnings:p})}var b=t.value.continue(r);return e(b)}}};(0,r.Z)(t)}(ge(o,t,s))}},8232:function(e,t,n){"use strict";function r(e,t){for(var n=0;e.length>0;){var r=e[0];if(r.start>=t)return n;if(-1===r.repeatCount)return n;if(0===r.repeatCount)e.shift(),n+=1;else{var i=e[1];if(void 0!==i&&i.start<=t)e.shift(),n+=1;else{if(r.duration<=0)return n;for(var a=r.start+r.duration,o=1;a<t&&o<=r.repeatCount;)a+=r.duration,o++;if(!(o>r.repeatCount)){var s=r.repeatCount-o;return r.start=a,r.repeatCount=s,n+=o}e.shift(),n=r.repeatCount+1}}}return n}n.d(t,{Z:function(){return r}})},3911:function(e,t,n){"use strict";n.d(t,{KF:function(){return i},PZ:function(){return u},_j:function(){return l},gT:function(){return o},jH:function(){return a},zG:function(){return s}});var r=n(1946);function i(e,t,n){var i,a=e.repeatCount;return a>=0?a:(i=(0,r.Z)(t)?void 0!==n?n:Number.MAX_VALUE:t.start,Math.ceil((i-e.start)/e.duration)-1)}function a(e,t,n){var r=e.start,a=e.duration;return a<=0?r:r+(i(e,t,n)+1)*a}function o(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function s(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function u(e,t,n){return[e*n,(e+t)*n]}function l(e,t,n){var r=e.timeline,i=o(t,e);if(i<0)return null;var u=function(e,t){for(var n=0,r=e.length;n<r;){var i=n+r>>>1;e[i].start<=t?n=i+1:r=i}return n-1}(r,i);if(u<0||u>=r.length-1)return null;var l=r[u];if(l.duration<=0)return null;var d=r[u+1];if(void 0===d)return null;var c=d.start;return i>=a(l,d,n)&&i<c?s(c,e):null}},1091:function(e,t,n){"use strict";function r(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i],o=(a.start-r)/n;if(o>e.time)return!1;if(o===e.time)return void 0===a.range?void 0===e.range:null!=e.range&&a.range[0]===e.range[0]&&a.range[1]===e.range[1];if(a.repeatCount>=0&&void 0!==a.duration){var s=(o-a.start)/a.duration-1;return s%1==0&&s<=a.repeatCount}}return!1}n.d(t,{Z:function(){return r}})},5505:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(3714),i=n(3887),a=n(3911);function o(e,t){if(0===e.length)return e.push.apply(e,t),!0;if(0===t.length)return!1;var n=e.length,o=t[0].start,s=e[n-1];if((0,a.jH)(s,t[0])<o)throw new r.Z("MANIFEST_UPDATE_ERROR","Cannot perform partial update: not enough data");for(var u=n-1;u>=0;u--){var l=e[u].start;if(l===o){var d=n-u;return e.splice.apply(e,[u,d].concat(t)),!1}if(l<o){var c=e[u];if(c.start+c.duration>o)return i.Z.warn("RepresentationIndex: Manifest update removed all previous segments"),e.splice.apply(e,[0,n].concat(t)),!0;if(void 0===c.repeatCount||c.repeatCount<=0)return c.repeatCount<0&&(c.repeatCount=Math.floor((o-c.start)/c.duration)-1),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;if(c.start+c.duration*(c.repeatCount+1)<=o)return e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;var f=(o-c.start)/c.duration-1;if(f%1==0&&c.duration===t[0].duration){var v=t[0].repeatCount<0?-1:t[0].repeatCount+f+1;return e.splice.apply(e,[u,n-u].concat(t)),e[u].start=c.start,e[u].repeatCount=v,!1}return i.Z.warn("RepresentationIndex: Manifest update removed previous segments"),e[u].repeatCount=Math.floor(f),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1}}var p=e[e.length-1],h=t[t.length-1];return void 0!==p.repeatCount&&p.repeatCount<0?p.start>h.start?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0):p.start+p.duration*(p.repeatCount+1)>=h.start+h.duration*(h.repeatCount+1)?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0)}},5734:function(e,t,n){"use strict";var r=n(6923),i=/&#([0-9]+);/g,a=/<br>/gi,o=/<style[^>]*>([\s\S]*?)<\/style[^>]*>/i,s=/\s*<p (?:class=([^>]+))?>(.*)/i,u=/<sync[^>]+?start="?([0-9]*)"?[^0-9]/i;function l(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var d,c,f=/<sync[ >]/gi,v=/<sync[ >]|<\/body>/gi,p=[],h=o.exec(e),m=Array.isArray(h)?h[1]:"";v.exec(e);var g,y=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);null!==r;){var i=r[1],a=l(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(m),_=function(e){var t=/p\s*{([^}]*)}/gi.exec(e);return null===t?"":t[1]}(m);if((0,r.Z)(n)&&void 0===(g=y[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;d=f.exec(e),c=v.exec(e),null!==d||null!==c;){if(null===d||null===c||d.index>=c.index)throw new Error("parse error");var b=e.slice(d.index,c.index),S=u.exec(b);if(!Array.isArray(S))throw new Error("parse error (sync time attribute)");var E=+S[1];if(isNaN(E))throw new Error("parse error (sync time attribute NaN)");T(b.split("\n"),E/1e3)}return p;function T(e,n){for(var o=e.length;--o>=0;){var u=s.exec(e[o]);if(Array.isArray(u)){var l=u[1],d=u[2];if(g===l)if("&nbsp;"===d)p[p.length-1].end=n;else{var c=document.createElement("DIV");c.className="rxp-texttrack-region";var f=document.createElement("DIV");f.className="rxp-texttrack-div",f.style.position="absolute",f.style.bottom="0",f.style.width="100%",f.style.color="#fff",f.style.textShadow="-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000";var v=document.createElement("div");v.className="rxp-texttrack-p",(0,r.Z)(_)&&(v.style.cssText=_);for(var h=d.split(a),m=0;m<h.length;m++){0!==m&&v.appendChild(document.createElement("BR"));var y=document.createElement("SPAN");y.className="rxp-texttrack-span",y.textContent=h[m].replace(i,(function(e,t){return String.fromCharCode(Number(t))})),v.appendChild(y)}f.appendChild(v),c.appendChild(f),p.push({element:c,start:n+t,end:-1})}}}}}},1812:function(e,t,n){"use strict";var r=n(7253),i=n(6923),a=/&#([0-9]+);/g,o=/<br>/gi,s=/<style[^>]*>([\s\S]*?)<\/style[^>]*>/i,u=/\s*<p (?:class=([^>]+))?>(.*)/i,l=/<sync[^>]+?start="?([0-9]*)"?[^0-9]/i;function d(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var c,f,v=/<sync[ >]/gi,p=/<sync[ >]|<\/body>/gi,h=[],m=s.exec(e),g=null!==m?m[1]:"";p.exec(e);var y,_=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);Array.isArray(r);){var i=r[1],a=d(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(g);if((0,i.Z)(n)&&void 0===(y=_[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;c=v.exec(e),f=p.exec(e),null!==c||null!==f;){if(null===c||null===f||c.index>=f.index)throw new Error("parse error");var b=e.slice(c.index,f.index),S=l.exec(b);if(null===S)throw new Error("parse error (sync time attribute)");var E=+S[1];if(isNaN(E))throw new Error("parse error (sync time attribute NaN)");T(b.split("\n"),E/1e3)}return function(e){for(var t=[],n=0;n<e.length;n++){var a=e[n],o=a.start,s=a.end,u=a.text;if((0,i.Z)(u)&&null!=s){var l=(0,r.Z)(o,s,u);null!=l&&t.push(l)}}return t}(h);function T(e,n){for(var r,i,s=e.length;--s>=0;)if(null!==(r=u.exec(e[s]))){var l=r,d=l[1],c=l[2];y===d&&("&nbsp;"===c?h[h.length-1].end=n:h.push({text:(i=c,i.replace(o,"\n").replace(a,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}}},2061:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}function a(e){for(var t=[],n=0;n<e.length;n++)if((0,r.Z)(e[n])){var a=i(e,n),o=e.slice(n,a);o.length>0&&(1===o.length?o[0].indexOf("--\x3e")>=0&&t.push(o):(o[1].indexOf("--\x3e")>=0||o[0].indexOf("--\x3e")>=0)&&t.push(o)),n=a}return t}},8675:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2061),i=n(788);function a(e,t){for(var n=e.split(/\r\n|\n|\r/),a=(0,r.Z)(n),s=[],u=0;u<a.length;u++){var l=(0,i.Z)(a[u],t);if(null!=l){var d=o(l);null!=d&&s.push(d)}}return s}function o(e){var t=e.start,n=e.end,r=e.payload,i=document.createElement("div");i.className="rxp-texttrack-p",i.style.fontSize="28px",i.style.position="absolute",i.style.bottom="5%",i.style.width="100%",i.style.textAlign="center",i.style.color="#fff",i.style.textShadow="-1px -1px 2px #000,1px -1px 2px #000,-1px 1px 2px #000,1px 1px 2px #000";for(var a=0;a<r.length;a++){0!==a&&i.appendChild(document.createElement("br"));var o=s(r[a]);i.appendChild(o)}return{start:t,end:n,element:i}}function s(e){var t=document.createElement("div");t.innerHTML=e;return function e(t){var n=t.childNodes,r=document.createElement("span");r.className="rxp-texttrack-span";for(var i=0;i<n.length;i++){var a=n[i];if("#text"===a.nodeName){for(var o=a.wholeText.split("\n"),s=0;s<o.length;s++)if(0!==s&&r.appendChild(document.createElement("br")),o[s].length>0){var l=document.createTextNode(o[s]);r.appendChild(l)}}else if("B"===a.nodeName){var d=e(a);d.style.fontWeight="bold",r.appendChild(d)}else if("I"===a.nodeName){var c=e(a);c.style.fontStyle="italic",r.appendChild(c)}else if("U"===a.nodeName){var f=e(a);f.style.textDecoration="underline",r.appendChild(f)}else if(u(a)&&"string"==typeof a.color){var v=e(a);v.style.color=a.color,r.appendChild(v)}else{var p=e(a);r.appendChild(p)}}return r}(t)}function u(e){return"FONT"===e.nodeName&&"color"in e}},8057:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7253),i=n(2061),a=n(788);function o(e,t){for(var n,o,s,u,l,d=e.split(/\r\n|\n|\r/),c=(0,i.Z)(d),f=[],v=0;v<c.length;v++){var p=(0,a.Z)(c[v],t);if(null!==p){var h=(o=void 0,s=void 0,u=void 0,l=void 0,o=(n=p).start,s=n.end,u=n.payload,l=u.join("\n"),(0,r.Z)(o,s,l));null!==h&&f.push(h)}}return f}},788:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e){var t=e.split(":");if((0,r.Z)(t[2])){var n=parseInt(t[0],10),i=parseInt(t[1],10),a=parseFloat(t[2].replace(",","."));if(isNaN(n)||isNaN(i)||isNaN(a))return;return 60*n*60+60*i+a}}function a(e,t){if(0===e.length)return null;var n,a,o=[];if((0,r.Z)(e[1])&&-1!==e[1].indexOf("--\x3e")){var s=e[1].split("--\x3e").map((function(e){return e.trim()}));n=s[0],a=s[1],o=e.slice(2,e.length)}if(!(0,r.Z)(n)||!(0,r.Z)(a)){var u=e[0].split("--\x3e").map((function(e){return e.trim()}));n=u[0],a=u[1],o=e.slice(1,e.length)}if(!(0,r.Z)(n)||!(0,r.Z)(a))return null;var l=i(n),d=i(a);return void 0===l||void 0===d?null:{start:l+t,end:d+t,payload:o}}},3791:function(e,t,n){"use strict";n.d(t,{U:function(){return s},b:function(){return u}});var r=n(3274),i=n(7714),a=n(6923),o=n(9252);function s(e,t,n,o){for(var s={},u=e.slice(),l=0;l<=t.length-1;l++){var d=t[l];if(void 0!==d){var c=function(){var e=void 0,t=void 0;if(d.nodeType===Node.ELEMENT_NODE)for(var l=d,c=0;c<=l.attributes.length-1;c++){var f=l.attributes[c],v=f.name;if("style"===v)e=f.value;else if("region"===v)t=f.value;else{var p=v.substring(4);if((0,i.Z)(u,p)&&(s[p]=f.value,u.splice(c,1),0===u.length))return{v:s}}}if((0,a.Z)(e)){var h=(0,r.Z)(n,(function(t){return t.id===e}));if(void 0!==h)for(var m=0;m<=u.length-1;m++){var g=u[m];if(!(0,a.Z)(s[g])&&(0,a.Z)(h.style[g])){if(s[g]=h.style[g],u.splice(m,1),0===u.length)return{v:s};m--}}}if((0,a.Z)(t)){var y=(0,r.Z)(o,(function(e){return e.id===t}));if(void 0!==y)for(var _=0;_<=u.length-1;_++){var b=u[_];if(!(0,a.Z)(s[b])&&(0,a.Z)(y.style[b])){if(s[b]=y.style[b],u.splice(_,1),0===u.length)return{v:s};_--}}}}();if("object"==typeof c)return c.v}}return s}function u(e){if(e.nodeType!==Node.ELEMENT_NODE)return{};for(var t=e,n={},r=0;r<=t.attributes.length-1;r++){var i=t.attributes[r];if((0,o.Z)(i.name,"tts"))n[i.name.substring(4)]=i.value}return n}},6177:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(6923),i=n(5336);function a(e,t){var n=e.exec(t);if(null===n||""===n[0])return null;var r=Number(n[1]);isNaN(r)&&(r=0);var i=Number(n[2]);isNaN(i)&&(i=0);var a=Number(n[3]);isNaN(a)&&(a=0);var o=Number(n[4]);return isNaN(o)&&(o=0),o/1e3+a+60*i+3600*r}var o=function(e,t){return i.gu.test(e)?function(e,t){var n=i.gu.exec(t),r=Number(n[1]),a=Number(n[2]),o=Number(n[3]),s=Number(n[4]),u=Number(n[5]);isNaN(u)&&(u=0);return s+=u/e.subFrameRate,(o+=s/e.frameRate)+60*a+3600*r}(t,e):i.KO.test(e)?a(i.KO,e):i.wf.test(e)?a(i.wf,e):i.jb.test(e)?function(e,t){var n=i.jb.exec(t);return Number(n[1])/e.frameRate}(t,e):i.Du.test(e)?function(e,t){var n=i.Du.exec(t);return Number(n[1])/e.tickRate}(t,e):i.te.test(e)?a(i.te,e):void 0};function s(e,t){var n=e.getAttribute("begin"),i=e.getAttribute("dur"),a=e.getAttribute("end"),s=(0,r.Z)(n)?o(n,t):null,u=(0,r.Z)(i)?o(i,t):null,l=(0,r.Z)(a)?o(a,t):null;if(null==s||null==l&&null==u)throw new Error("Invalid text cue");return{start:s,end:null==l?s+u:l}}},7439:function(e,t,n){"use strict";n.d(t,{Z:function(){return w}});var r=n(959);function i(e){return void 0===e.extent&&void 0===e.origin&&void 0===e.displayAlign&&void 0===e.display&&void 0===e.textAlign&&void 0===e.fontSize}function a(e){e.extent="70% 20%",e.fontSize="1c",e.origin="15% 80%",e.displayAlign="before",e.textAlign="center"}var o,s=n(6177);function u(e,t){(void 0===o&&(o=void 0!==e.classList&&"function"==typeof e.classList.add),o)?e.classList.add(t):(" "+e.className+" ").indexOf(" "+t+" ")<0&&(e.className+=" "+t)}var l=n(6923),d=n(8026),c=n(3791),f=n(1594),v=n(3887),p=n(5336);function h(e,t){var n=t;return(0,l.Z)(t)&&t.trim().endsWith("%")&&(n=t.trim().slice(0,-1),n=(parseInt(n,10)/100).toString()+"em"),"-1px -1px "+n+" "+e+",1px -1px "+n+" "+e+",-1px 1px "+n+" "+e+",1px 1px "+n+" "+e}function m(e){var t;return null!=(t=p.Dq.exec(e))?"rgba("+String(parseInt(t[1],16))+","+String(parseInt(t[2],16))+","+String(parseInt(t[3],16))+","+String(parseInt(t[4],16)/255)+")":null!=(t=p.YU.exec(e))?"rgba("+String(parseInt(t[1]+t[1],16))+","+String(parseInt(t[2]+t[2],16))+","+String(parseInt(t[3]+t[3],16))+","+String(parseInt(t[4]+t[4],16)/255)+")":null!=(t=p.GK.exec(e))?"rgb("+String(+t[1])+","+String(+t[2])+","+String(+t[3])+")":null!=(t=p.ev.exec(e))?"rgba("+String(+t[1])+","+String(+t[2])+","+String(+t[3])+","+String(+t[4]/255)+")":e}var g=["color","direction","display","fontFamily","fontSize","fontStyle","fontWeight","textDecoration","textOutline","unicodeBidi","visibility","wrapOption"];function y(e,t,n){var r=t.color;(0,l.Z)(r)&&(e.style.color=m(r));var i=t.backgroundColor;(0,l.Z)(i)&&(e.style.backgroundColor=m(i));var a=t.textOutline;if((0,l.Z)(a)){var o=a.trim().replace(/\s+/g," ").split(" "),s=o.length;if(3===s){var d=m(o[0]),c=o[1];e.style.textShadow=h(d,c)}else if((0,l.Z)(r)&&1===s){var f=o[0];e.style.textShadow=h(r,f)}else if(2===s){var g=/^[#A-Z]/i.test(o[0]);if(g!==/^[0-9]/.test(o[0]))if(g){var y=m(o[0]),_=o[1];e.style.textShadow=h(y,_)}else if((0,l.Z)(r)){var b=o[0];e.style.textShadow=h(r,b)}}}var S=t.textDecoration;if((0,l.Z)(S))switch(S){case"noUnderline":case"noLineThrough":case"noOverline":e.style.textDecoration="none";break;case"lineThrough":e.style.textDecoration="line-through";break;default:e.style.textDecoration=S}var E=t.fontFamily;if((0,l.Z)(E))switch(E){case"proportionalSansSerif":e.style.fontFamily="Arial, Helvetica, Liberation Sans, sans-serif";break;case"monospaceSansSerif":case"sansSerif":e.style.fontFamily="sans-serif";break;case"monospaceSerif":case"default":e.style.fontFamily="Courier New, Liberation Mono, monospace";break;case"proportionalSerif":e.style.fontFamily="serif";break;default:e.style.fontFamily=E}var T=t.fontStyle;(0,l.Z)(T)&&(e.style.fontStyle=T);var w=t.fontWeight;(0,l.Z)(w)&&(e.style.fontWeight=w);var k=t.fontSize;(0,l.Z)(k)?function(e,t){var n=t.trim().split(" ");if(0!==n.length){var r=p.eT.exec(n[0]);if(null!==r)if("px"===r[2]||"em"===r[2])e.style.fontSize=r[1]+r[2];else if("c"===r[2])e.style.position="relative",u(e,"proportional-style"),e.setAttribute("data-proportional-font-size",r[1]);else if("%"===r[2]){var i=Number(r[1]);isNaN(i)?v.Z.warn('TTML Parser: could not parse fontSize value "'+r[1]+'" into a number'):(e.style.position="relative",u(e,"proportional-style"),e.setAttribute("data-proportional-font-size",String(i/100)))}else v.Z.warn("TTML Parser: unhandled fontSize unit:",r[2])}}(e,k):(u(e,"proportional-style"),e.setAttribute("data-proportional-font-size","1"));var A=t.direction;(0,l.Z)(A)&&(e.style.direction=A);var I=t.unicodeBidi;if((0,l.Z)(I))switch(I){case"bidiOverride":e.style.unicodeBidi="bidi-override";break;case"embed":e.style.unicodeBidi="embed";break;default:e.style.unicodeBidi="normal"}var R=t.visibility;(0,l.Z)(R)&&(e.style.visibility=R),"none"===t.display&&(e.style.display="none");var Z=t.wrapOption;e.style.whiteSpace="noWrap"===Z?n?"nowrap":"pre":n?"normal":"pre-wrap"}function _(e,t){e.style.color="white",e.style.position="absolute";var n=t.extent;(0,l.Z)(n)&&function(e,t){var n=t.trim();if("auto"!==n){var r=n.split(" ");if(2===r.length){var i=p.eT.exec(r[0]),a=p.eT.exec(r[1]);null!==i&&null!==a&&("px"===i[2]||"%"===i[2]||"em"===i[2]?e.style.width=i[1]+i[2]:"c"===i[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-width",i[1])):v.Z.warn("TTML Parser: unhandled extent unit:",i[2]),"px"===a[2]||"%"===a[2]||"em"===a[2]?e.style.height=a[1]+a[2]:"c"===a[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-height",a[1])):v.Z.warn("TTML Parser: unhandled extent unit:",a[2]))}}}(e,n);var r=t.writingMode;(0,l.Z)(r);var i=t.overflow;e.style.overflow=(0,l.Z)(i)?i:"hidden";var a=t.padding;(0,l.Z)(a)&&function(e,t){var n=t.trim().split(" ");if(!(n.length<1)){var r=p.eT.exec(n[0]);if(null!==r){if("px"===r[2]||"%"===r[2]||"em"===r[2]){var i=r[1]+r[2];1===n.length?e.style.padding=i:2===n.length?(e.style.paddingTop=i,e.style.paddingBottom=i):e.style.paddingTop=i}else"c"===r[2]?(u(e,"proportional-style"),1===n.length?(e.setAttribute("data-proportional-padding-top",r[1]),e.setAttribute("data-proportional-padding-bottom",r[1]),e.setAttribute("data-proportional-padding-left",r[1]),e.setAttribute("data-proportional-padding-right",r[1])):2===n.length?(e.setAttribute("data-proportional-padding-top",r[1]),e.setAttribute("data-proportional-padding-bottom",r[1])):e.setAttribute("data-proportional-padding-top",r[1])):v.Z.warn("TTML Parser: unhandled padding unit:",r[2]);if(1!==n.length){var a=p.eT.exec(n[1]);if(null!==a){if("px"===a[2]||"%"===a[2]||"em"===a[2]){var o=a[1]+a[2];n.length<4?(e.style.paddingLeft=o,e.style.paddingRight=o):e.style.paddingRight=o}else"c"===a[2]?(u(e,"proportional-style"),n.length<4?(e.setAttribute("data-proportional-padding-left",a[1]),e.setAttribute("data-proportional-padding-right",a[1])):e.setAttribute("data-proportional-padding-right",a[1])):v.Z.warn("TTML Parser: unhandled padding unit:",a[2]);if(2!==n.length){var s=p.eT.exec(n[2]);if(null!==s){if("px"===s[2]||"%"===s[2]||"em"===s[2]){var l=s[1]+s[2];e.style.paddingBottom=l}else"c"===s[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-padding-bottom",s[1])):v.Z.warn("TTML Parser: unhandled padding unit:",s[2]);if(3!==n.length){var d=p.eT.exec(n[3]);if(null!==d)if("px"===d[2]||"%"===d[2]||"em"===d[2]){var c=d[1]+d[2];e.style.paddingLeft=c}else"c"===d[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-padding-left",d[1])):v.Z.warn("TTML Parser: unhandled padding unit:",d[2])}}}}}}}}(e,a);var o=t.origin;(0,l.Z)(o)&&function(e,t){var n=t.trim();if("auto"!==n){var r=n.split(" ");if(2===r.length){var i=p.eT.exec(r[0]),a=p.eT.exec(r[1]);null!==i&&null!==a&&("px"===i[2]||"%"===i[2]||"em"===i[2]?e.style.left=i[1]+i[2]:"c"===i[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-left",i[1])):v.Z.warn("TTML Parser: unhandled origin unit:",i[2]),"px"===a[2]||"%"===a[2]||"em"===a[2]?e.style.top=a[1]+a[2]:"c"===a[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-top",a[1])):v.Z.warn("TTML Parser: unhandled origin unit:",a[2]))}}}(e,o);var s=t.displayAlign;if((0,l.Z)(s))switch(e.style.display="flex",e.style.flexDirection="column",s){case"before":e.style.justifyContent="flex-start";break;case"center":e.style.justifyContent="center";break;case"after":e.style.justifyContent="flex-end"}var d=t.opacity;(0,l.Z)(d)&&(e.style.opacity=d);var c=t.visibility;(0,l.Z)(c)&&(e.style.visibility=c),"none"===t.display&&(e.style.display="none")}function b(e,t){e.style.margin="0px",u(e,"proportional-style"),e.setAttribute("data-proportional-font-size","1");var n=t.backgroundColor;(0,l.Z)(n)&&(e.style.backgroundColor=m(n));var r=t.lineHeight;(0,l.Z)(r)&&function(e,t){var n=t.trim();if("auto"!==n){var r=p.eT.exec(n[0]);null!==r&&("px"===r[2]||"%"===r[2]||"em"===r[2]?e.style.lineHeight=r[1]+r[2]:"c"===r[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-line-height",r[1])):v.Z.warn("TTML Parser: unhandled lineHeight unit:",r[2]))}}(e,r);var i=t.textAlign;if((0,l.Z)(i))switch(i){case"center":e.style.textAlign="center";break;case"left":case"start":e.style.textAlign="left";break;case"right":case"end":e.style.textAlign="right"}}function S(e,t,n){var r=document.createElement("span"),i=null===e.textContent?"":e.textContent;if(n){var a=i.trim();i=a=a.replace(/\s+/g," ")}var o=document.createTextNode(i);return r.appendChild(o),r.className="rxp-texttrack-span",y(r,t,n),r}function E(e,t,n,r,i,a){var o=a.cellResolution,s=a.shouldTrimWhiteSpace,u=(0,f.jF)(e),v=document.createElement("DIV");if(v.className="rxp-texttrack-region",v.setAttribute("data-resolution-columns",String(o.columns)),v.setAttribute("data-resolution-rows",String(o.rows)),_(v,i),null!==t){var p=(0,c.U)(["backgroundColor"],[].concat(u,[t]),r,n).bodyBackgroundColor;(0,l.Z)(p)&&(v.style.backgroundColor=m(p))}var h=document.createElement("p");h.className="rxp-texttrack-p",b(h,i);for(var y=function(e,t,n,r,i){return function e(r,i,a,o){for(var s=r.childNodes,u=[],v=0;v<s.length;v++){var p=s[v];if("#text"===p.nodeName){var h=(0,c.U)(["backgroundColor"],a,n,t).backgroundColor;(0,l.Z)(h)?i.backgroundColor=h:delete i.backgroundColor;var m=S(p,i,o);u.push(m)}else if((0,f.OE)(p)){var y=document.createElement("BR");u.push(y)}else if((0,f.jg)(p)&&p.nodeType===Node.ELEMENT_NODE&&p.childNodes.length>0){var _=p.getAttribute("xml:space"),b=(0,l.Z)(_)?"default"===_:o,E=(0,d.Z)({},i,(0,c.U)(g,[p],n,t));u.push.apply(u,e(p,E,[p].concat(a),b))}}return u}(e,(0,d.Z)({},r),[],i)}(e,n,r,i,s),E=0;E<y.length;E++)h.appendChild(y[E]);return v.appendChild(h),v}function T(e){var t=e.paragraph,n=e.ttParams,r=e.body,i=e.regionStyles,a=e.idStyles,o=e.paragraphStyle,u=e.timeOffset,l=e.shouldTrimWhiteSpace;if(!t.hasAttribute("begin")&&!t.hasAttribute("end")&&/^\s*$/.test(null===t.textContent?"":t.textContent))return null;var d=n.cellResolution,c=(0,s.Z)(t,n);return{start:c.start+u,end:c.end+u,element:E(t,r,i,a,o,{cellResolution:d,shouldTrimWhiteSpace:l})}}var w=function(e,t){for(var n=(0,r.Z)(e,t),o=[],s=0;s<n.length;s++){var u=n[s].paragraphStyle;i(u)&&a(u);var l=T(n[s]);null!==l&&o.push(l)}return o}},1570:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var r=n(959),i=n(7253),a=n(1988),o=n(6923),s=n(6177),u=n(5336),l=n(1594),d={left:"start",center:"center",right:"end",start:"start",end:"end"},c={left:"line-left",center:"center",right:"line-right"};function f(e){var t=e.paragraph,n=e.timeOffset,r=e.paragraphStyle,f=e.ttParams,v=e.shouldTrimWhiteSpace;if(!t.hasAttribute("begin")&&!t.hasAttribute("end")&&/^\s*$/.test(null===t.textContent?"":t.textContent))return null;var p=(0,s.Z)(t,f),h=p.start,m=p.end,g=function(e,t){function n(e,t){for(var r=e.childNodes,i="",a=0;a<r.length;a++){var s=r[a];if("#text"===s.nodeName){var u=s.textContent;if(null===u&&(u=""),t){var d=u.trim();u=d=d.replace(/\s+/g," ")}i+=u.replace(/&|\u0026/g,"&amp;").replace(/<|\u003C/g,"&lt;").replace(/>|\u2265/g,"&gt;").replace(/\u200E/g,"&lrm;").replace(/\u200F/g,"&rlm;").replace(/\u00A0/g,"&nbsp;")}else if((0,l.OE)(s))i+="\n";else if((0,l.jg)(s)&&s.nodeType===Node.ELEMENT_NODE&&s.childNodes.length>0){var c=s.getAttribute("xml:space");i+=n(s,(0,o.Z)(c)?"default"===c:t)}}return i}return n(e,t)}(t,v),y=(0,i.Z)(h+n,m+n,g);return null===y?null:((0,a.Z)(y)&&function(e,t){var n=t.extent;if((0,o.Z)(n)){var r=u._0.exec(n);null!=r&&(e.size=Number(r[1]))}switch(t.writingMode){case"tb":case"tblr":e.vertical="lr";break;case"tbrl":e.vertical="rl"}var i=t.origin;if((0,o.Z)(i))u._0.exec(i);var a=t.align;if((0,o.Z)(a)){e.align=a,"center"===a&&("center"!==e.align&&(e.align="middle"),e.position="auto");var s=c[a];e.positionAlign=void 0===s?"":s;var l=d[a];e.lineAlign=void 0===l?"":l}}(y,r),y)}var v=function(e,t){for(var n=(0,r.Z)(e,t),i=[],a=0;a<n.length;a++){var o=f(n[a]);null!==o&&i.push(o)}return i}},959:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var r=n(3274),i=n(6923),a=n(8026),o=n(3887),s=/(\d+) (\d+)/;var u=n(3791),l=n(5138),d=n(7714);var c=n(1594),f=["align","backgroundColor","color","direction","display","displayAlign","extent","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","opacity","origin","overflow","padding","textAlign","textDecoration","textOutline","unicodeBidi","visibility","wrapOption","writingMode"];function v(e,t){var n=[],v=(new DOMParser).parseFromString(e,"text/xml");if(null!=v){var p=v.getElementsByTagName("tt")[0];if(void 0===p)if(void 0===(p=v.getElementsByTagNameNS("*","tt")[0]))throw new Error("invalid XML");for(var h=(0,c.H)(p),m=(0,c.vU)(p),g=(0,c.DM)(p),y=(0,c.kd)(p),_=function(e){var t=e.getAttribute("ttp:frameRate"),n=e.getAttribute("ttp:subFramRate"),r=e.getAttribute("ttp:tickRate"),a=e.getAttribute("ttp:frameRateMultiplier"),u=e.getAttribute("xml:space"),l=e.getAttribute("ttp:cellResolution"),d={columns:32,rows:15};if(null!==l){var c=s.exec(l);if(null===c||c.length<3)o.Z.warn("TTML Parser: Invalid cellResolution");else{var f=parseInt(c[1],10),v=parseInt(c[2],10);isNaN(f)||isNaN(v)?o.Z.warn("TTML Parser: Invalid cellResolution"):d={columns:f,rows:v}}}if((0,i.Z)(u)&&"default"!==u&&"preserve"!==u)throw new Error("Invalid spacing style");var p=Number(t);(isNaN(p)||p<=0)&&(p=30);var h=Number(n);(isNaN(h)||h<=0)&&(h=1);var m=Number(r);(isNaN(m)||m<=0)&&(m=void 0);var g=p,y=null!=h?h:1,_=null!==u?u:"default",b=void 0!==m?m:p*h;if(null!==a){var S=/^(\d+) (\d+)$/g.exec(a);null!==S&&(g=p*(Number(S[1])/Number(S[2])))}return{cellResolution:d,tickRate:b,frameRate:g,subFrameRate:y,spaceStyle:_}}(p),b=[],S=0;S<=m.length-1;S++){var E=m[S];if(E instanceof Element){var T=E.getAttribute("xml:id");if(null!==T){var w=E.getAttribute("style"),k=null===w?[]:w.split(" ");b.push({id:T,style:(0,u.b)(E),extendsStyles:k})}}}!function(e){var t=[];function n(r,i){t.push(i);for(var s=function(i){var s=r.extendsStyles[i],u=(0,l.Z)(e,(function(e){return e.id===s}));if(u<0)o.Z.warn("TTML Parser: unknown style inheritance: "+s);else{var c=e[u];(0,d.Z)(t,u)?o.Z.warn("TTML Parser: infinite style inheritance loop avoided"):n(c,u),r.style=(0,a.Z)({},c.style,r.style)}},u=0;u<r.extendsStyles.length;u++)s(u);r.extendsStyles.length=0}for(var r=0;r<e.length;r++)n(e[r],r),t.length=0}(b);for(var A=[],I=0;I<=g.length-1;I++){var R=g[I];if(R instanceof Element){var Z=R.getAttribute("xml:id");null!==Z&&function(){var e=(0,u.b)(R),t=R.getAttribute("style");if((0,i.Z)(t)){var n=(0,r.Z)(b,(function(e){return e.id===t}));void 0!==n&&(e=(0,a.Z)({},n.style,e))}A.push({id:Z,style:e,extendsStyles:[]})}()}}for(var x=(0,u.U)(f,null!==h?[h]:[],b,A),P="default"===(null!==h?h.getAttribute("xml:space"):void 0)||"default"===_.spaceStyle,M=0;M<y.length;M++){var C=y[M];if(C instanceof Element){var D=(0,c.jF)(C),N=(0,a.Z)({},x,(0,u.U)(f,[C].concat(D),b,A)),O=C.getAttribute("xml:space"),L=(0,i.Z)(O)?"default"===O:P,U={paragraph:C,timeOffset:t,idStyles:b,regionStyles:A,body:h,paragraphStyle:N,ttParams:_,shouldTrimWhiteSpace:L};null!==U&&n.push(U)}}}return n}},5336:function(e,t,n){"use strict";n.d(t,{Dq:function(){return c},Du:function(){return s},GK:function(){return v},KO:function(){return i},YU:function(){return f},_0:function(){return l},eT:function(){return d},ev:function(){return p},gu:function(){return r},jb:function(){return o},te:function(){return u},wf:function(){return a}});var r=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,i=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,a=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,o=/^(\d*\.?\d*)f$/,s=/^(\d*\.?\d*)t$/,u=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,l=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,d=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%|rh|rw)$/,c=/^#([0-9A-f]{2})([0-9A-f]{2})([0-9A-f]{2})([0-9A-f]{2})$/,f=/^#([0-9A-f])([0-9A-f])([0-9A-f])([0-9A-f])$/,v=/^rgb\( *(\d+) *, *(\d+) *, *(\d+) *\)/,p=/^rgba\( *(\d+) *, *(\d+) *, *(\d+) *, *(\d+) *\)/},1594:function(e,t,n){"use strict";function r(e,t){if(!(e.parentNode instanceof Element))return[];return function e(n){var r=[];n.tagName.toLowerCase()===t.toLowerCase()&&r.push(n);var i=n.parentNode;return i instanceof Element&&r.push.apply(r,e(i)),r}(e.parentNode)}function i(e){var t=r(e,"div");if(0===t.length){var n=r(e,"tt:div");n.length>0&&(t=n)}return t}function a(e){var t=e.getElementsByTagName("body");if(t.length>0)return t[0];var n=e.getElementsByTagName("tt:body");return n.length>0?n[0]:null}function o(e){var t=e.getElementsByTagName("style");if(t.length>0)return t;var n=e.getElementsByTagName("tt:style");return n.length>0?n:t}function s(e){var t=e.getElementsByTagName("region");if(t.length>0)return t;var n=e.getElementsByTagName("tt:region");return n.length>0?n:t}function u(e){var t=e.getElementsByTagName("p");if(t.length>0)return t;var n=e.getElementsByTagName("tt:p");return n.length>0?n:t}function l(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function d(e){return"span"===e.nodeName||"tt:span"===e.nodeName}n.d(t,{DM:function(){return s},H:function(){return a},OE:function(){return l},jF:function(){return i},jg:function(){return d},kd:function(){return u},vU:function(){return o}})},1138:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923),i=n(360);function a(e,t){for(var n=[],a=t;a<e.length;a++)if((0,i.tq)(e,a)){var o=(0,i.$4)(e,a);n.push(e.slice(a,o)),a=o}else if((0,r.Z)(e[a]))for(;(0,r.Z)(e[a]);)a++;return n}},4099:function(e,t,n){"use strict";n.d(t,{Z:function(){return I}});var r=n(1138),i=n(6923),a=n(360);var o=n(9525),s={white:"#ffffff",lime:"#00ff00",cyan:"#00ffff",red:"#ff0000",yellow:"#ffff00",magenta:"#ff00ff",blue:"#0000ff",black:"#000000"};function u(e){var t=Object.keys(s).reduce((function(e,t){return e[t]="color: "+s[t]+";",e["bg_"+t]="background-color: "+s[t]+";",e}),{}),n="";return e.forEach((function(e){if(e.length>=2)for(var r=1;r<e.length;r++){var a=e[r];if(Array.isArray(/::cue {/.exec(a)))for(a=e[++r];(0,i.Z)(a)&&!Array.isArray(/}/.exec(a))&&0!==a.length;)n+=a,a=e[++r];else!function(){for(var n=[],o=/::cue\(\.?(.*?)\)(?:,| {)/.exec(a);(0,i.Z)(a)&&Array.isArray(o);)n.push(o[1]),a=e[++r],o=/::cue\(\.?(.*?)\)(?:,| {)/.exec(a);for(var s="";(0,i.Z)(a)&&!Array.isArray(/}/.exec(a))&&0!==a.length;)s+=a,a=e[++r];n.forEach((function(e){void 0===t[e]?t[e]=s:t[e]+=s}))}()}})),{classes:t,global:n}}var l=n(7714);function d(e,t){var n,r=["u","i","b"],a=e.nodeName.toLowerCase().split(".")[0];if((0,l.Z)(["u","i","b","c","#text"],a))if("#text"===a){var o=e.wholeText.split("\n");n=document.createElement("span");for(var s=0;s<o.length;s++)if(s>0&&n.appendChild(document.createElement("br")),o[s].length>0){var u=document.createTextNode(o[s]);n.appendChild(u)}}else{var c=e.nodeName.toLowerCase().split("."),f=[];if(c.forEach((function(e){(0,i.Z)(t[e])&&f.push(t[e])})),0!==f.length){var v=document.createAttribute("style");f.forEach((function(e){v.value+=e}));var p=(0,l.Z)(r,a)?a:"span";(n=document.createElement(p)).setAttributeNode(v)}else{var h=(0,l.Z)(r,a)?a:"span";n=document.createElement(h)}for(var m=0;m<e.childNodes.length;m++){var g=d(e.childNodes[m],t);n.appendChild(g)}}else{n=document.createElement("span");for(var y=0;y<e.childNodes.length;y++){var _=d(e.childNodes[y],t);n.appendChild(_)}}return n}var c=n(1679);var f,v,p,h=function(e){if(!(void 0!==e&&0!==(0,c.Z)(e).length))return"text-align:center";var t=m(e),n=_(e);return"position: absolute;margin: 0;transform: translate("+t.offset+"%,"+n.offset+"%);width: "+T(e.size)+"%;left: "+t.position+"%;top: "+(null!==n.position?n.position+"%":"auto")+";text-align: "+E(e.align)+";"};!function(e){e.LINE_LEFT="line-left",e.CENTER="center",e.LINE_RIGHT="line-right"}(f||(f={})),function(e){e.LEFT="left",e.CENTER="center",e.RIGHT="right"}(v||(v={})),function(e){e.START="start",e.CENTER="center",e.END="end"}(p||(p={}));var m=function(e){return{position:g(e),offset:y(e)}},g=function(e){var t,n=k(e.position);if(null!==n)return n;var r=E(e.align);return((t={})[v.LEFT]=0,t[v.CENTER]=50,t[v.RIGHT]=100,t)[r]},y=function(e){var t,n,r,i,a=((t={})[f.LINE_LEFT]=0,t[f.CENTER]=-50,t[f.LINE_RIGHT]=-100,t),o=void 0!==e.position?(r=e.position,i=/,(line-left|line-right|center)/.exec(r),!Array.isArray(i)||i.length<2?null:i[1]):null;return null!==o?a[o]:((n={})[v.LEFT]=0,n[v.CENTER]=-50,n[v.RIGHT]=-100,n)[void 0!==e.align?E(e.align):v.CENTER]},_=function(e){return{position:b(e.line),offset:S(e.line)}},b=function(e){return k(e)},S=function(e){var t,n=((t={})[p.START]=0,t[p.CENTER]=-50,t[p.END]=-100,t);if(void 0===e)return n[p.START];var r,i=(r=/,(start|center|end)/.exec(e),!Array.isArray(r)||r.length<2?null:r[1]);return null!==i?n[i]:n[p.START]},E=function(e){switch(e){case"left":case"start":return"left";case"right":case"end":return"right";default:return"center"}},T=function(e){return w(e,100)},w=function(e,t){var n=k(e);return null!==n?n:t},k=function(e){if(void 0===e)return null;var t=/^([\d.]+)%/.exec(e);return!Array.isArray(t)||t.length<2?null:parseInt(t[1],10)};function A(e,t){var n=e.start,r=e.end,a=e.settings,o=e.header,s=e.payload,u=document.createElement("div"),l=document.createAttribute("style");l.value="width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;",u.setAttributeNode(l);var c=document.createElement("p"),f=function(e){var t=document.createAttribute("style");return t.value=h(e),t}(a);c.setAttributeNode(f);var v=document.createElement("span"),p=document.createAttribute("style");p.value="background-color:rgba(0,0,0,0.8);color:white;",v.setAttributeNode(p);var m=t.global,g=t.classes,y=[m,(0,i.Z)(o)?g[o]:void 0].filter((function(e){return void 0!==e})).join("");return p.value+=y,v.setAttributeNode(p),function(e,t){for(var n=e.replace(/<[0-9]{2}:[0-9]{2}.[0-9]{3}>/,"").replace(/<([u,i,b,c])(\..*?)?(?: .*?)?>(.*?)<\/\1>/g,"<$1$2>$3</$1$2>"),r=(new DOMParser).parseFromString(n,"text/html").body.childNodes,i=[],a=0;a<r.length;a++)i.push(d(r[a],t));return i}(s.join("\n"),g).forEach((function(e){v.appendChild(e)})),u.appendChild(c),c.appendChild(v),{start:n,end:r,element:u}}var I=function(e,t){var n=e.split(/\r\n|\n|\r/g),s=[];if(null===/^WEBVTT( |\t|\n|\r|$)/.exec(n[0]))throw new Error("Can't parse WebVTT: Invalid File.");for(var l=(0,a.yE)(n),d=function(e,t){for(var n=[],r=t;r<e.length;r++)if((0,a.JF)(e,r)){var o=r;for(r++;(0,i.Z)(e[r]);)r++;var s=e.slice(o,r);n.push(s)}else if((0,i.Z)(e[r]))for(;(0,i.Z)(e[r]);)r++;return n}(n,l),c=(0,r.Z)(n,l),f=u(d),v=0;v<c.length;v++){var p=(0,o.Z)(c[v],t);if(null!=p){var h=A(p,f);s.push(h)}}return s}},9405:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1988),i=n(1138),a=n(9525),o=n(360),s=n(7714),u=n(6923);function l(e,t){if(!(0,u.Z)(e.vertical)||"rl"!==e.vertical&&"lr"!==e.vertical||(t.vertical=e.vertical),(0,u.Z)(e.line)){var n=/^(\d+(\.\d+)?)%(,([a-z]+))?/.exec(e.line);if(Array.isArray(n))t.line=Number(n[1]),t.snapToLines=!1,(0,s.Z)(["start","center","end"],n[4])&&(t.lineAlign=n[4]);else{var r=/^(-?\d+)(,([a-z]+))?/.exec(e.line);Array.isArray(r)&&(t.line=Number(r[1]),t.snapToLines=!0,(0,s.Z)(["start","center","end"],r[3])&&(t.lineAlign=r[3]))}}if((0,u.Z)(e.position)){var i=/^([\d\.]+)%(?:,(line-left|line-right|center))?$/.exec(e.position);if(Array.isArray(i)&&i.length>=2){var a=parseInt(i[1],10);isNaN(a)||(t.position=a,void 0!==i[2]&&(t.positionAlign=i[2]))}}(0,u.Z)(e.size)&&(t.size=e.size),"string"==typeof e.align&&(0,s.Z)(["start","center","end","left"],e.align)&&(t.align=e.align)}var d=n(7253);var c=function(e,t){var n=e.split(/\r\n|\n|\r/);if(!/^WEBVTT($| |\t)/.test(n[0]))throw new Error("Can't parse WebVTT: Invalid file.");for(var s,u,c,f,v=(0,o.yE)(n),p=(0,i.Z)(n,v),h=[],m=0;m<p.length;m++){var g=(0,a.Z)(p[m],t);if(null!=g){var y=(u=void 0,c=void 0,f=void 0,u=(s=g).start,c=s.end,f=s.payload.join("\n"),(0,d.Z)(u,c,f));null!=y&&((0,r.Z)(y)&&l(g.settings,y),h.push(y))}}return h}},9525:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e){var t=e.split(":").reverse();if((0,r.Z)(t[2])||(0,r.Z)(t[1])){var n=(0,r.Z)(t[2])?parseInt(t[2],10):0,i=parseInt(t[1],10),a=parseFloat(t[0].replace(",","."));if(isNaN(n)||isNaN(i)||isNaN(a))return;return 60*n*60+60*i+a}}function a(e,t){var n,r,a,o=/-->/;if(o.test(e[0]))n=e[0],r=e.slice(1,e.length);else{if(!o.test(e[1]))return null;a=e[0],n=e[1],r=e.slice(2,e.length)}var s=function(e){var t=/^([\d:.]+)[ |\t]+-->[ |\t]+([\d:.]+)[ |\t]*(.*)$/.exec(e);if(null===t)return null;var n=i(t[1]),r=i(t[2]);return null==n||null==r?null:{start:n,end:r,settings:t[3].split(/ |\t/).reduce((function(e,t){var n=t.split(":");return 2===n.length&&(e[n[0]]=n[1]),e}),{})}}(n);return null===s?null:{start:s.start+t,end:s.end+t,settings:s.settings,payload:r,header:a}}},360:function(e,t,n){"use strict";n.d(t,{$4:function(){return s},JF:function(){return a},tq:function(){return o},yE:function(){return i}});var r=n(6923);function i(e){for(var t=0;t<e.length;){if(""===e[t])return t+1;t++}return t}function a(e,t){return"string"==typeof e[t]&&/^STYLE( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}function o(e,t){var n=e[t];if(void 0===n||""===n||a(e,t)||function(e,t){return"string"==typeof e[t]&&/^REGION( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}(e,t)||function(e,t){return"string"==typeof e[t]&&/^NOTE( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}(e,t))return!1;if(n.indexOf("--\x3e")>=0)return!0;var r=e[t+1];return void 0!==r&&r.indexOf("--\x3e")>=0}function s(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}},2047:function(e,t,n){"use strict";n.d(t,{Z:function(){return te}});var r=n(7874),i=n(8791),a=n(6872),o=n(8750),s=n(3887),u=n(8619),l=n(8026),d=n(4597),c=n(3635);function f(e){var t=e.referenceDateTime,n=void 0!==e.serverSyncInfos?e.serverSyncInfos.serverTimestamp-e.serverSyncInfos.clientTime:void 0;return function(i,f,v,p,h){var m,g=i.responseData,y=f.externalClockOffset,_=null!==(m=i.url)&&void 0!==m?m:f.originalUrl,b=null!=n?n:y,S={unsafelyBaseOnPreviousManifest:f.unsafeMode?f.previousManifest:null,url:_,referenceDateTime:t,externalClockOffset:b},E=r.Z.dashParsers;if(null===E.wasm||"uninitialized"===E.wasm.status||"failure"===E.wasm.status)return s.Z.debug("DASH: WASM MPD Parser not initialized. Running JS one."),w();var T=function(e){if(e instanceof ArrayBuffer)return e;if("string"==typeof e)return(0,c.tG)(e).buffer;if(e instanceof Document)return(0,c.tG)(e.documentElement.innerHTML).buffer;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(g);return function(e){var t=new DataView(e);if(61371===t.getUint16(0)&&191===t.getUint8(2))return!0;if(65279===t.getUint16(0)||65534===t.getUint16(0))return!1;return!0}(T)?"initialized"===E.wasm.status?(s.Z.debug("DASH: Running WASM MPD Parser."),k(E.wasm.runWasmParser(T,S))):(s.Z.debug("DASH: Awaiting WASM initialization before parsing the MPD."),E.wasm.waitForInitialization().catch((function(){})).then((function(){return null===E.wasm||"initialized"!==E.wasm.status?(s.Z.warn("DASH: WASM MPD parser initialization failed. Running JS parser instead"),w()):(s.Z.debug("DASH: Running WASM MPD Parser."),k(E.wasm.runWasmParser(T,S)))}))):(s.Z.info("DASH: MPD doesn't seem to be UTF-8-encoded. Running JS parser instead of the WASM one."),w());function w(){if(null===E.js)throw new Error("No MPD parser is imported");var e=function(e){if(e instanceof ArrayBuffer)return(new DOMParser).parseFromString((0,c.uR)(new Uint8Array(e)),"text/xml");if("string"==typeof e)return(new DOMParser).parseFromString(e,"text/xml");if(e instanceof Document)return e;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(g);return k(E.js(e,S))}function k(t){if("done"===t.type)return t.value.warnings.length>0&&v(t.value.warnings),p.isCancelled?Promise.reject(p.cancellationError):{manifest:new u.ZP(t.value.parsed,e),url:_};var n=t.value,r=n.urls.map((function(e){return h((function(){var t=a.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT;return"string"===n.format?(0,d.ZP)({url:e,responseType:"text",timeout:t,cancelSignal:p}):(0,d.ZP)({url:e,responseType:"arraybuffer",timeout:t,cancelSignal:p})})).then((function(e){if("string"===n.format){if("string"!=typeof e.responseData)throw new Error("External DASH resources should have been a string");return(0,l.Z)(e,{responseData:{success:!0,data:e.responseData}})}if(!(e.responseData instanceof ArrayBuffer))throw new Error("External DASH resources should have been ArrayBuffers");return(0,l.Z)(e,{responseData:{success:!0,data:e.responseData}})}),(function(e){var t=(0,o.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"An unknown error occured when parsing ressources."});return(0,l.Z)({},{size:void 0,requestDuration:void 0,responseData:{success:!1,error:t}})}))}));return Promise.all(r).then((function(e){return n.format,k(n.continue(e))}))}}}var v=n(7839),p=n(5861),h=n(4687),m=n.n(h),g=n(9105),y=n(5992),_=n(1946),b="function"==typeof Headers?Headers:null,S="function"==typeof AbortController?AbortController:null;function E(){return"function"==typeof window.fetch&&!(0,_.Z)(S)&&!(0,_.Z)(b)}var T=n(8806),w=n(281);function k(e,t){return"audio"===e||"video"===e?"video/mp4"===t||"audio/mp4"===t?"mp4":"video/webm"===t||"audio/webm"===t?"webm":void 0:"text"===e&&"application/mp4"===t?"mp4":void 0}var A=n(288),I=n(4460);function R(e){return function(t,n,r,i,a){return new Promise((function(s,u){var l=new A.ZP({cancelOn:i}),d=l.signal.register(u);e(t,n,r,l.signal,Object.assign(Object.assign({},a),{onNewChunk:function(e){try{o(e),a.onNewChunk(e)}catch(e){d(),l.cancel(),u(e)}}})).then((function(e){if(!l.isUsed){if(d(),"segment-loaded"===e.resultType)try{o(e.resultData.responseData)}catch(e){return void u(e)}s(e)}}),(function(e){d(),u(e)}))}));function o(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&"mp4"===k(n.type,n.mimeType)&&(0,I.Z)(new Uint8Array(e),n.segment.isInit)}}}var Z=n(9829);function x(e,t){return null===e?null:null===t.url?e.baseUrl:(0,Z.Z)(e.baseUrl,t.url)}var P=n(6968);function M(e,t,n,r,i){if(void 0===t.range)return(0,d.ZP)({url:e,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(void 0===t.indexRange)return(0,d.ZP)({url:e,headers:{Range:(0,w.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(t.range[1]+1===t.indexRange[0])return(0,d.ZP)({url:e,headers:{Range:(0,w.Z)([t.range[0],t.indexRange[1]])},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));var a=(0,d.ZP)({url:e,headers:{Range:(0,w.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=(0,d.ZP)({url:e,headers:{Range:(0,w.Z)(t.indexRange)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress});return Promise.all([a,o]).then((function(t){var n=t[0],r=t[1],i=(0,P.zo)(new Uint8Array(n.responseData),new Uint8Array(r.responseData)),a=Math.min(n.sendingTime,r.sendingTime),o=Math.max(n.receivedTime,r.receivedTime);return{resultType:"segment-loaded",resultData:{url:e,responseData:i,size:n.size+r.size,requestDuration:o-a,sendingTime:a,receivedTime:o}}}))}var C=n(8766);function D(e,t,n,r,i){var a=t.segment,o=void 0!==a.range?{Range:(0,w.Z)(a.range)}:void 0,u=null;return function(e){var t;if(!(0,_.Z)(e.headers))if((0,_.Z)(b))t=e.headers;else{t=new b;for(var n=Object.keys(e.headers),r=0;r<n.length;r++){var i=n[r];t.append(i,e.headers[i])}}s.Z.debug("Fetch: Called with URL",e.url);var a,o=null,u=!1,l=performance.now(),d=(0,_.Z)(S)?null:new S;function c(){(0,_.Z)(d)?s.Z.warn("Fetch: AbortController API not available."):d.abort()}void 0!==e.timeout&&(a=window.setTimeout((function(){u=!0,c()}),e.timeout));var f=e.cancelSignal.register((function(e){o=e,c()})),v={method:"GET"};return void 0!==t&&(v.headers=t),v.signal=(0,_.Z)(d)?null:d.signal,fetch(e.url,v).then((function(t){if((0,_.Z)(a)||clearTimeout(a),t.status>=300)throw s.Z.warn("Fetch: Request HTTP Error",t.status,t.url),new g.Z(t.url,t.status,y.br.ERROR_HTTP_CODE);if((0,_.Z)(t.body))throw new g.Z(t.url,t.status,y.br.PARSE_ERROR);var n=t.headers.get("Content-Length"),r=(0,_.Z)(n)||isNaN(+n)?void 0:+n,i=t.body.getReader(),o=0;return u();function u(){return d.apply(this,arguments)}function d(){return(d=(0,p.Z)(m().mark((function n(){var a,s,d,c,v;return m().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.read();case 2:if((a=n.sent).done||(0,_.Z)(a.value)){n.next=11;break}return o+=a.value.byteLength,s=performance.now(),d={url:t.url,currentTime:s,duration:s-l,sendingTime:l,chunkSize:a.value.byteLength,chunk:a.value.buffer,size:o,totalSize:r},e.onData(d),n.abrupt("return",u());case 11:if(!a.done){n.next=16;break}return f(),c=performance.now(),v=c-l,n.abrupt("return",{requestDuration:v,receivedTime:c,sendingTime:l,size:o,status:t.status,url:t.url});case 16:return n.abrupt("return",u());case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}})).catch((function(t){if(null!==o)throw o;if(f(),u)throw s.Z.warn("Fetch: Request timeouted."),new g.Z(e.url,0,y.br.TIMEOUT);if(t instanceof g.Z)throw t;throw s.Z.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new g.Z(e.url,0,y.br.ERROR_EVENT)}))}({url:e,headers:o,onData:function(e){var t=new Uint8Array(e.chunk),n=function(e){for(var t=0,n=[];t<e.length;){var r=e.subarray(t,1/0),i=(0,C.Z)(r,1836019558);if(i<0)return[n,r];var a=t+i+(0,P.pX)(e,i+t);if(a>e.length)return[n,r];var o=(0,C.Z)(r,1835295092);if(o<0)return[n,r];var s=t+o+(0,P.pX)(e,o+t);if(s>e.length)return[n,r];var u=Math.max(a,s),l=e.subarray(t,u);n.push(l),t=u}return[n,null]}(null!==u?(0,P.zo)(u,t):t),a=n[0];u=n[1];for(var o=0;o<a.length;o++)if(r.onNewChunk(a[o]),i.isCancelled)return;r.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize}),i.isCancelled},timeout:n.timeout,cancelSignal:i}).then((function(e){return{resultType:"chunk-complete",resultData:e}}))}function N(e,t,n,r,i,a){if(t.segment.isInit)return M(e,t.segment,r,a,i);var o=k(t.type,t.mimeType);if(n&&("mp4"===o||void 0===o)){if(E())return D(e,t,r,i,a);(0,T.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}var s=t.segment;return(0,d.ZP)({url:e,responseType:"arraybuffer",headers:void 0!==s.range?{Range:(0,w.Z)(s.range)}:void 0,timeout:r.timeout,cancelSignal:a,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}var O=n(6490),L=n(4644),U=408125543,B=357149030;function F(e,t,n,r){for(var i=r[0],a=r[1],o=i;o<a;){var s=G(n,o);if(null==s)return null;var u=s.value,l=o+s.length,d=j(n,l);if(null==d)return null;var c=d,f=l+c.length,v=f+c.value;if(u===e)return[f,v];if(t.length>0)for(var p=0;p<t.length;p++){if(u===t[p])return F(e,t.slice(p+1,t.length),n,[f,v])}o=v}return null}function z(e,t){var n=F(2807729,[U,B],e,[t,e.length]);if(null==n)return null;var r=n[1]-n[0];return 1e9/H(e,n[0],r)}function V(e,t){var n=F(17545,[U,B],e,[t,e.length]);if(null==n)return null;var r=n[1]-n[0];return 4===r?function(e,t){return new DataView(e.buffer).getFloat32(t)}(e,n[0]):8===r?function(e,t){return new DataView(e.buffer).getFloat64(t)}(e,n[0]):null}function K(e,t){for(var n=1;n<=8;n++)if(e[t]>=Math.pow(2,8-n))return n}function G(e,t){var n=K(e,t);if(null==n)return s.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return s.Z.warn("webm: impossible length"),null;for(var r=0,i=0;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return{length:n,value:r}}function j(e,t){var n=K(e,t);if(null==n)return s.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return s.Z.warn("webm: impossible length"),null;for(var r=(e[t]&(1<<8-n)-1)*Math.pow(2,8*(n-1)),i=1;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return{length:n,value:r}}function H(e,t,n){for(var r=0,i=0;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return r}var W=n(5278);function q(e,t,n,r){var i=(0,L.Qx)(e);if(void 0===i||void 0===r)return null;var a,o=void 0!==n.timestampOffset?i+n.timestampOffset*r:i,u=(0,L.MM)(e);if(o<0&&(void 0!==u&&(u+=o),o=0),t||!n.complete)return void 0===u&&s.Z.warn("DASH: Chunked segments should indicate a duration through their trun boxes"),{time:o/r,duration:void 0!==u?u/r:void 0};var l=n.duration*r,d=Math.min(.9*r,l/4);return void 0!==u&&Math.abs(u-l)<=d&&(a=u),{time:o/r,duration:void 0!==a?a/r:a}}function Y(e,t){if(0!==e.length){var n=e.reduce((function(e,t){return"urn:mpeg:dash:event:2012"===t.schemeIdUri&&"1"===t.value?(void 0===e.manifestRefreshEventsFromEMSGs&&(e.manifestRefreshEventsFromEMSGs=[]),e.manifestRefreshEventsFromEMSGs.push(t)):(void 0===e.EMSGs&&(e.EMSGs=[]),e.EMSGs.push(t)),e}),{manifestRefreshEventsFromEMSGs:void 0,EMSGs:void 0}),r=n.manifestRefreshEventsFromEMSGs,i=n.EMSGs,a=null==i?void 0:i.map((function(e){return{type:"emsg",value:e}})),o=void 0!==t&&void 0!==r&&function(e,t){if(e.length<=0)return!1;for(var n=e.length,r=0;r<n;r++){var i=t,a=e[r].messageData,o=(0,c.uR)(a),s=Date.parse(o);if(void 0===i||void 0===s||isNaN(s)||s>=i)return!0}return!1}(r,t);return{inbandEvents:a,needsManifestRefresh:o}}}function X(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.segment,o=n.periodStart,s=n.periodEnd,u=e.data,l=e.isChunked,d=[o,s];if(null===u)return a.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionData:[],appendWindow:d};var c=u instanceof Uint8Array?u:new Uint8Array(u),f=k(n.type,n.mimeType),v="mp4"===f||void 0===f,p=[];if(v){var h,m=(0,O.Z)(c);a.isInit&&(h=null!==(i=(0,L.R0)(c))&&void 0!==i?i:void 0),(m.length>0||void 0!==h)&&p.push({initDataType:"cenc",keyId:h,initData:m})}if(!a.isInit){var g=v?q(c,l,a,r):null,y=(0,W.Z)(a.timestampOffset,0);if(v){var b=(0,L.s9)(c);if(void 0!==b){var S=Y(b.filter((function(e){return void 0!==a.privateInfos&&void 0!==a.privateInfos.isEMSGWhitelisted&&a.privateInfos.isEMSGWhitelisted(e)})),n.manifestPublishTime);if(void 0!==S){var E=S.needsManifestRefresh,T=S.inbandEvents;return{segmentType:"media",chunkData:c,chunkSize:c.length,chunkInfos:g,chunkOffset:y,appendWindow:d,inbandEvents:T,protectionData:p,needsManifestRefresh:E}}}}return{segmentType:"media",chunkData:c,chunkSize:c.length,chunkInfos:g,chunkOffset:y,protectionData:p,appendWindow:d}}var w,A=a.indexRange;if("webm"===f)w=function(e,t){var n=F(U,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=z(e,r);if(null==a)return null;var o=V(e,r);if(null==o)return null;var s=F(475249515,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l<s[1];){var d=F(187,[],e,[l,s[1]]);if(null==d)break;var c=F(179,[],e,[d[0],d[1]]);if(null==c)return null;var f=H(e,c[0],c[1]-c[0]),v=F(241,[183],e,[d[0],d[1]]);if(null==v)return null;var p=H(e,v[0],v[1]-v[0])+r;u.push({time:f,rangeStart:p}),l=d[1]}for(var h=[],m=0;m<u.length;m++){var g=u[m];m===u.length-1?h.push({time:g.time,timescale:a,duration:0===m?o:o-g.time,range:[g.rangeStart,1/0]}):h.push({time:g.time,timescale:a,duration:u[m+1].time-g.time,range:[g.rangeStart,u[m+1].rangeStart-1]})}return h}(c,0);else if(v&&(w=(0,L.Wf)(c,Array.isArray(A)?A[0]:0),!0===t&&null!==w&&w.length>0)){var I=w[w.length-1];Array.isArray(I.range)&&(I.range[1]=1/0)}var R=v?(0,L.LD)(c):"webm"===f?z(c,0):void 0,Z=(0,_.Z)(R)?void 0:R;return{segmentType:"init",initializationData:c,initializationDataSize:c.length,protectionData:p,initTimescale:Z,segmentList:null!=w?w:void 0}}}var Q=n(6807);function $(e,t,n,r){var i,a,o=e.segment,u=e.language,l=e.codecs;if(o.isInit)return null;null===n?r?(i=o.time,a=o.end):s.Z.warn("Transport: Unavailable time data for current text track."):(i=n.time,void 0!==n.duration?a=i+n.duration:!r&&o.complete&&(a=i+o.duration));var d=function(e){if(void 0===e)throw new Error("Cannot parse subtitles: unknown format");switch(e.toLowerCase()){case"stpp":case"stpp.ttml.im1t":return"ttml";case"wvtt":return"vtt"}throw new Error('The codec used for the subtitles "'+e+'" is not managed yet.')}(l),f=function(e){var t=(0,Q.Le)(e);return null===t?"":(0,c.uR)(t)}(t);return{data:f,type:d,language:u,start:i,end:a}}function J(e,t,n){var r,i,a=e.segment;return a.isInit?null:(n?s.Z.warn("Transport: Unavailable time data for current text track."):(r=a.time,a.complete&&(i=a.time+a.duration)),{data:t,type:function(e,t){switch(t){case"application/ttml+xml":return"ttml";case"application/x-sami":case"application/smil":return"sami";case"text/vtt":return"vtt"}if(void 0!==e&&"srt"===e.toLowerCase())return"srt";throw new Error("could not find a text-track parser for the type "+(null!=t?t:""))}(e.codecs,e.mimeType),language:e.language,start:r,end:i})}function ee(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.periodStart,o=n.periodEnd,s=n.segment,u=e.data,l=e.isChunked;if(null===u)return s.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:null!==(i=s.timestampOffset)&&void 0!==i?i:0,protectionData:[],appendWindow:[a,o]};var d=k(n.type,n.mimeType);if("webm"===d)throw new Error("Text tracks with a WEBM container are not yet handled.");return"mp4"===d?function(e,t,n,r,i){var a=n.segment,o=a.isInit,s=a.indexRange,u="string"==typeof e?(0,c.tG)(e):e instanceof Uint8Array?e:new Uint8Array(e);if(o){var l=(0,L.Wf)(u,Array.isArray(s)?s[0]:0);if(!0===i&&null!==l&&l.length>0){var d=l[l.length-1];Array.isArray(d.range)&&(d.range[1]=1/0)}return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:(0,L.LD)(u),segmentList:null!=l?l:void 0}}var f=q(u,t,a,r),v=$(n,u,f,t),p=(0,W.Z)(a.timestampOffset,0);return{segmentType:"media",chunkData:v,chunkSize:u.length,chunkInfos:f,chunkOffset:p,protectionData:[],appendWindow:[n.periodStart,n.periodEnd]}}(u,l,n,r,t):function(e,t,n){var r,i,a=n.periodStart,o=n.periodEnd,s=n.segment,u=s.timestampOffset,l=void 0===u?0:u;if(s.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0};if("string"!=typeof e){var d=e instanceof Uint8Array?e:new Uint8Array(e);r=(0,c.uR)(d),i=d.length}else r=e;return{segmentType:"media",chunkData:J(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:l,protectionData:[],appendWindow:[a,o]}}(u,l,n)}}var te=function(e){var t=(0,i.Z)({customManifestLoader:e.manifestLoader},null===r.Z.dashParsers.wasm||"initialized"!==r.Z.dashParsers.wasm.status&&"initializing"!==r.Z.dashParsers.wasm.status?"arraybuffer":"text"),n=f(e),a=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:R(r);function r(e,r,i,a,o){var s=x(e,r.segment);return null==s?Promise.resolve({resultType:"segment-created",resultData:null}):t||void 0===n?N(s,r,t,i,o,a):new Promise((function(e,u){var l,d=!1,c={reject:function(e){var t,n;if(!d&&!a.isCancelled){d=!0,a.deregister(h);var r=e,i=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching a DASH segment through a custom segmentLoader.",o=new v.Z(i,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);u(o)}},resolve:function(t){d||a.isCancelled||(d=!0,a.deregister(h),e({resultType:"segment-loaded",resultData:{responseData:t.data,size:t.size,requestDuration:t.duration}}))},progress:function(e){d||a.isCancelled||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})},fallback:function(){d||a.isCancelled||(d=!0,a.deregister(h),N(s,r,t,i,o,a).then(e,u))}};void 0!==r.segment.range&&(l=[r.segment.range],void 0!==r.segment.indexRange&&l.push(r.segment.indexRange));var f={isInit:r.segment.isInit,timeout:i.timeout,byteRanges:l,trackType:r.type,url:s},p=n(f,c);function h(e){d||(d=!0,"function"==typeof p&&p(),u(e))}a.register(h)}))}}(e),o=X(e),s=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:R(n);function n(e,n,r,i,a){var o=n.segment,s=o.range,u=x(e,o);if(null===u)return Promise.resolve({resultType:"segment-created",resultData:null});if(o.isInit)return M(u,o,r,i,a);var l=k(n.type,n.mimeType),c="mp4"===l||void 0===l;if(t&&c){if(E())return D(u,n,r,a,i);(0,T.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}return c?(0,d.ZP)({url:u,responseType:"arraybuffer",headers:Array.isArray(s)?{Range:(0,w.Z)(s)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):(0,d.ZP)({url:u,responseType:"text",headers:Array.isArray(s)?{Range:(0,w.Z)(s)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}}(e);return{manifest:{loadManifest:t,parseManifest:n},audio:{loadSegment:a,parseSegment:o},video:{loadSegment:a,parseSegment:o},text:{loadSegment:s,parseSegment:ee(e)}}}},5418:function(e,t,n){"use strict";n.d(t,{Z:function(){return le}});var r=n(3887),i=n(8619),a=n(6807),o=n(9665),s=n(7714),u=n(811),l=n(6968),d=n(6923),c=n(8026),f=n(9829),v=n(3635),p=n(5278),h=n(2689),m={};function g(e){if(null!=m[e])return m[e];var t=(0,v.tG)(e);return m[e]=t,t}function y(e,t){var n=t.length+8;return n<=h.s?(0,l.zo)((0,l.kh)(n),g(e),t):(0,l.zo)((0,l.kh)(1),g(e),(0,l.el)(n+8),t)}function _(e,t){return y(e,l.zo.apply(void 0,t))}function b(e){var t=[];e.periods.forEach((function(n){var i=n.id;if((0,s.Z)(t,i)){r.Z.warn("Two periods with the same ID found. Updating.");var a=i+"-dup";n.id=a,b(e),t.push(a)}else t.push(i);var o=n.adaptations,u=[];Object.keys(o).forEach((function(t){var n=o[t];void 0!==n&&n.forEach((function(t){var n=t.id;if((0,s.Z)(u,n)){r.Z.warn("Two adaptations with the same ID found. Updating.",n);var i=n+"-dup";t.id=i,b(e),u.push(i)}else u.push(n);var a=[];t.representations.forEach((function(t){var n=t.id;if((0,s.Z)(a,n)){r.Z.warn("Two representations with the same ID found. Updating.",n);var i=n+"-dup";t.id=i,b(e),a.push(i)}else a.push(n)}))}))}))}))}var S=n(9689);function E(e){return[{systemId:"edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",privateData:(0,l.zo)([8,1,18,16],e)}]}function T(e,t){if(void 0===t&&(t=E),null===e.firstElementChild||"ProtectionHeader"!==e.firstElementChild.nodeName)throw new Error("Protection should have ProtectionHeader child");var n=e.firstElementChild,r=(0,S.K)(null===n.textContent?"":n.textContent),i=function(e){var t=(0,l.qb)(e,8),n=(0,v.wV)(e.subarray(10,t+10)),r=(new DOMParser).parseFromString(n,"application/xml").querySelector("KID");if(null===r)throw new Error("Cannot parse PlayReady private data: invalid XML");var i=null===r.textContent?"":r.textContent,a=(0,v.wO)((0,S.K)(i));return(0,v.ci)(a).toLowerCase()}(r),a=(0,v.nr)(i),o=n.getAttribute("SystemID");return{keyId:a,keySystems:[{systemId:(null!==o?o:"").toLowerCase().replace(/\{|\}/g,""),privateData:r}].concat(t(a))}}var w=n(9362),k=n(3911),A=n(1091);function I(e,t){return e.replace(/\{start time\}/g,String(t))}function R(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function Z(e,t){var n=e.repeatCount;if(void 0!==e.duration&&n<0){var r=void 0!==t?t.start:1/0;n=Math.ceil((r-e.start)/e.duration)-1}return n}var x=function(){function e(e){var t=e.isLive,n=e.segmentPrivateInfos,r=e.media,i=e.sharedSmoothTimeline;if(this._sharedSmoothTimeline=i,this._initSegmentInfos={bitsPerSample:n.bitsPerSample,channels:n.channels,codecPrivateData:n.codecPrivateData,packetSize:n.packetSize,samplingRate:n.samplingRate,timescale:i.timescale,height:n.height,width:n.width,protection:n.protection},this._isLive=t,this._media=r,0!==i.timeline.length&&t){var a=i.timeline,o=i.validityTime,s=a[a.length-1],u=(0,k.jH)(s,null),l=o/1e3*i.timescale;this._scaledLiveGap=l-u}}var t=e.prototype;return t.getInitSegment=function(){return{id:"init",isInit:!0,privateInfos:{smoothInitSegment:this._initSegmentInfos},url:null,time:0,end:0,duration:0,timescale:1,complete:!0}},t.getSegments=function(e,t){this._refreshTimeline();for(var n,r=this._sharedSmoothTimeline,i=r.timescale,a=r.timeline,o=function(e,t,n){var r=void 0===e||0===e?1:e;return{up:t*r,to:(t+n)*r}}(i,e,t),s=o.up,u=o.to,l=this._media,d=[],c=a.length,f=void 0===this._scaledLiveGap?void 0:performance.now()/1e3*i-this._scaledLiveGap,v=0;v<c;v++){for(var p=a[v],h=p.duration,m=p.start,g=Z(p,a[v+1]),y=R(m,s,h),_=m+y*h,b=h;_<u&&y<=g&&(void 0===f||_+b<=f);){var S=_,E=void 0!==n?n+y:void 0,T={id:String(_),isInit:!1,time:S/i,end:(S+h)/i,duration:h/i,timescale:1,number:E,url:I(l,S),complete:!0,privateInfos:{smoothMediaSegment:{time:S,duration:h}}};d.push(T),_=m+ ++y*h}if(_>=u)return d;void 0!==n&&(n+=g+1)}return d},t.shouldRefresh=function(e,t){if(this._refreshTimeline(),!this._isLive)return!1;var n=this._sharedSmoothTimeline,r=n.timeline,i=n.timescale,a=r[r.length-1];if(void 0===a)return!1;var o=a.repeatCount,s=a.start+(o+1)*a.duration;return!(t*i<s)&&(e*i>=s||e*i>a.start+o*a.duration)},t.getFirstAvailablePosition=function(){this._refreshTimeline();var e=this._sharedSmoothTimeline,t=e.timeline,n=e.timescale;return 0===t.length?null:t[0].start/n},t.getLastAvailablePosition=function(){this._refreshTimeline();var e=this._sharedSmoothTimeline,t=e.timeline,n=e.timescale;if(void 0===this._scaledLiveGap){var r=t[t.length-1];return(0,k.jH)(r,null)/n}for(var i=t.length-1;i>=0;i--)for(var a=t[i],o=performance.now()/1e3*n,s=a.start,u=a.duration,l=a.repeatCount;l>=0;l--){var d=s+u*(l+1);if(d<=o-this._scaledLiveGap)return d/n}},t.getEnd=function(){if(!this._isLive)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,u.Z)(e<=t),this.isFinished())return!1;var r=this.getLastAvailablePosition();return!(void 0!==r&&t<r)&&(t>(null!==(n=this.getFirstAvailablePosition())&&void 0!==n?n:0)&&void 0)},t.checkDiscontinuity=function(e){return this._refreshTimeline(),(0,k._j)(this._sharedSmoothTimeline,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();var t=this._sharedSmoothTimeline,n=t.timeline,r=t.timescale;return(0,A.Z)(e,n,r,0)},t.canBeOutOfSyncError=function(e){return!!this._isLive&&(e instanceof w.Z&&(e.isHttpError(404)||e.isHttpError(412)))},t._replace=function(e){this._initialScaledLastPosition=e._initialScaledLastPosition,this._scaledLiveGap=e._scaledLiveGap,this._sharedSmoothTimeline.replace(e._sharedSmoothTimeline)},t._update=function(e){this._scaledLiveGap=e._scaledLiveGap,this._sharedSmoothTimeline.update(e._sharedSmoothTimeline)},t.isFinished=function(){return!this._isLive},t.isInitialized=function(){return!0},t.initialize=function(){r.Z.error("A `SmoothRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(e,t){this._sharedSmoothTimeline.addPredictedSegments(e,t)},t._refreshTimeline=function(){this._sharedSmoothTimeline.refresh()},e}(),P=n(8232),M=n(5505);function C(e,t,n,r){var i=e[e.length-1],a=n.timescale===t?{time:n.time,duration:n.duration}:{time:n.time/n.timescale*t,duration:n.duration/n.timescale*t};return!(r.time===a.time)&&(a.time>=(0,k.jH)(i,null)&&(i.duration===a.duration?i.repeatCount++:e.push({duration:a.duration,start:a.time,repeatCount:0}),!0))}var D=function(){function e(e){var t=e.timeline,n=e.timescale,r=e.timeShiftBufferDepth,i=e.manifestReceivedTime;this.timeline=t,this.timescale=n;var a=null!=i?i:performance.now();if(this.validityTime=a,this._timeShiftBufferDepth=r,0!==t.length){var o=t[t.length-1],s=(0,k.jH)(o,null);this._initialScaledLastPosition=s}}var t=e.prototype;return t.refresh=function(){if(void 0!==this._initialScaledLastPosition){var e=this._timeShiftBufferDepth,t=(performance.now()-this.validityTime)/1e3+this._initialScaledLastPosition/this.timescale;if(void 0!==e){var n=(t-e)*this.timescale;(0,P.Z)(this.timeline,n)}}},t.replace=function(e){var t=this.timeline,n=e.timeline,i=this.timescale,a=e.timescale;if(this._initialScaledLastPosition=e._initialScaledLastPosition,this.validityTime=e.validityTime,0!==t.length&&0!==n.length&&i===a){var o=t[t.length-1],s=n[n.length-1],u=(0,k.jH)(s,null);if(!((0,k.jH)(o,null)<=u))for(var l=0;l<t.length;l++){var d=t[l],c=(0,k.jH)(d,null);if(c===u)return void(this.timeline=this.timeline.concat(t.slice(l+1)));if(c>u){if(d.duration!==s.duration)return;var f=u-d.start;if(0===f)return r.Z.warn("Smooth Parser: a discontinuity detected in the previous manifest has been resolved."),void(this.timeline=this.timeline.concat(t.slice(l)));if(f<0||f%d.duration!=0)return;var v=f/d.duration-1,p=d.repeatCount-v;if(p<0)return;s.repeatCount+=p;var h=t.slice(l+1);return void(this.timeline=this.timeline.concat(h))}}}},t.update=function(e){(0,M.Z)(this.timeline,e.timeline),this._initialScaledLastPosition=e._initialScaledLastPosition,this.validityTime=e.validityTime},t.addPredictedSegments=function(e,t){var n;if(void 0!==(null===(n=t.privateInfos)||void 0===n?void 0:n.smoothMediaSegment)){this.refresh();for(var i=0;i<e.length;i++)C(this.timeline,this.timescale,e[i],t.privateInfos.smoothMediaSegment)}else r.Z.warn("Smooth Parser: should only encounter SmoothRepresentationIndex")},e}();function N(e,t,n){for(var r=e.firstElementChild,i=n;null!==r;)i=t(i,r.nodeName,r),r=r.nextElementSibling;return i}var O={audio:"audio/mp4",video:"video/mp4",text:"application/ttml+xml"},L={AACL:"audio/mp4",AVC1:"video/mp4",H264:"video/mp4",TTML:"application/ttml+xml+mp4",DFXP:"application/ttml+xml+mp4"};var U=function(e){void 0===e&&(e={});var t=void 0===e.referenceDateTime?Date.UTC(1970,0,1,0,0,0,0)/1e3:e.referenceDateTime,n=void 0===e.minRepresentationBitrate?0:e.minRepresentationBitrate,i=e.serverSyncInfos,a=void 0!==i?i.serverTimestamp-i.clientTime:void 0;function h(e,t){var n=N(e,(function(e,t,n){return"CustomAttributes"===t&&e.push.apply(e,N(n,(function(e,t,n){if("Attribute"===t){var r=n.getAttribute("Name"),i=n.getAttribute("Value");null!==r&&null!==i&&e.push(r+"="+i)}return e}),[])),e}),[]);function i(t){var n=e.getAttribute(t);return null==n?void 0:n}switch(t){case"audio":var a=i("AudioTag"),o=i("BitsPerSample"),s=i("Channels"),u=i("CodecPrivateData"),l=i("FourCC"),c=i("PacketSize"),f=i("SamplingRate"),v=i("Bitrate"),h=void 0===v||isNaN(parseInt(v,10))?0:parseInt(v,10);if(void 0!==l&&void 0===L[l]||void 0===u)return r.Z.warn("Smooth parser: Unsupported audio codec. Ignoring quality level."),null;var m=function(e,t){var n;return 0==(n="AACH"===t?5:(0,d.Z)(e)?(248&parseInt(e.substring(0,2),16))>>3:2)?"mp4a.40.2":"mp4a.40."+n}(u,l);return{audiotag:void 0!==a?parseInt(a,10):a,bitrate:h,bitsPerSample:void 0!==o?parseInt(o,10):o,channels:void 0!==s?parseInt(s,10):s,codecPrivateData:u,codecs:m,customAttributes:n,mimeType:void 0!==l?L[l]:l,packetSize:void 0!==c?parseInt(c,10):c,samplingRate:void 0!==f?parseInt(f,10):f};case"video":var g=i("CodecPrivateData"),y=i("FourCC"),_=i("MaxWidth"),b=i("MaxHeight"),S=i("Bitrate"),E=void 0===S||isNaN(parseInt(S,10))?0:parseInt(S,10);if(void 0!==y&&void 0===L[y]||void 0===g)return r.Z.warn("Smooth parser: Unsupported video codec. Ignoring quality level."),null;var T=function(e){var t=/00000001\d7([0-9a-fA-F]{6})/.exec(e);return null!==t&&(0,d.Z)(t[1])?"avc1."+t[1]:"avc1.4D401E"}(g);return{bitrate:E,customAttributes:n,mimeType:void 0!==y?L[y]:y,codecPrivateData:g,codecs:T,width:void 0!==_?parseInt(_,10):void 0,height:void 0!==b?parseInt(b,10):void 0};case"text":var w=i("CodecPrivateData"),k=i("FourCC"),A=i("Bitrate");return{bitrate:void 0===A||isNaN(parseInt(A,10))?0:parseInt(A,10),customAttributes:n,mimeType:void 0!==k?L[k]:k,codecPrivateData:(0,p.Z)(w,"")};default:return r.Z.error("Smooth Parser: Unrecognized StreamIndex type: "+t),null}}function m(e){var t=e.root,i=e.timescale,a=e.baseUrl,f=e.protections,p=e.timeShiftBufferDepth,m=e.manifestReceivedTime,g=e.isLive,_=t.getAttribute("Timescale"),b=null===_||isNaN(+_)?i:+_,S=t.getAttribute("Type");if(null===S)throw new Error("StreamIndex without type.");(0,s.Z)(o.r,S)||r.Z.warn("Smooth Parser: Unrecognized adaptation type:",S);var E=S,T=t.getAttribute("Subtype"),w=t.getAttribute("Language"),k=t.getAttribute("Url"),A=null===k?"":k;var I,R=N(t,(function(e,t,r){switch(t){case"QualityLevel":var i=h(r,E);if(null===i)return e;("video"!==E||i.bitrate>n)&&e.qualityLevels.push(i);break;case"c":e.cNodes.push(r)}return e}),{qualityLevels:[],cNodes:[]}),Z=R.qualityLevels,P=R.cNodes,M=new D({timeline:(I=P,I.reduce((function(e,t,n){var r=t.getAttribute("d"),i=t.getAttribute("t"),a=t.getAttribute("r"),o=null!==a?+a-1:0,s=null!==i?+i:void 0,u=null!==r?+r:void 0;if(0===n)s=void 0===s||isNaN(s)?0:s;else{var l=e[n-1];if(null==s||isNaN(s)){if(null==l.duration||isNaN(l.duration))throw new Error("Smooth: Invalid CNodes. Missing timestamp.");s=l.start+l.duration*(l.repeatCount+1)}}if(null==u||isNaN(u)){var c=I[n+1];if(void 0===c)return e;var f=c.getAttribute("t"),v=(0,d.Z)(f)?+f:null;if(null===v)throw new Error("Can't build index timeline from Smooth Manifest.");u=v-s}return e.push({duration:u,start:s,repeatCount:o}),e}),[])),timescale:b,timeShiftBufferDepth:p,manifestReceivedTime:m});(0,u.Z)(0!==Z.length,"Adaptation should have at least one playable representation.");var C=E+((0,d.Z)(w)?"_"+w:""),L=Z.map((function(e){var t,n,r,i,o=(t=A,n=e.bitrate,r=e.customAttributes,t.replace(/\{bitrate\}/g,String(n)).replace(/{CustomAttributes}/g,r.length>0?r[0]:"")),s=(0,d.Z)(e.mimeType)?e.mimeType:O[E],u=e.codecs,p=C+"_"+(null!=E?E+"-":"")+(null!=s?s+"-":"")+(null!=u?u+"-":"")+String(e.bitrate),h=[];f.length>0&&(i=f[0],f.forEach((function(e){var t=e.keyId;e.keySystems.forEach((function(e){h.push({keyId:t,systemId:e.systemId})}))})));var m={bitsPerSample:e.bitsPerSample,channels:e.channels,codecPrivateData:e.codecPrivateData,packetSize:e.packetSize,samplingRate:e.samplingRate,height:e.height,width:e.width,protection:null!=i?{keyId:i.keyId}:void 0},_=new x({isLive:g,sharedSmoothTimeline:M,media:o,segmentPrivateInfos:m}),b=(0,c.Z)({},e,{index:_,cdnMetadata:[{baseUrl:a}],mimeType:s,codecs:u,id:p});if(h.length>0||void 0!==i){var S=void 0===i?[]:i.keySystems.map((function(e){var t=e.systemId,n=e.privateData,r=t.replace(/-/g,""),i=function(e,t){if(32!==e.length)throw new Error("HSS: wrong system id length");var n=0;return y("pssh",(0,l.zo)([n,0,0,0],(0,v.nr)(e),(0,l.kh)(t.length),t))}(r,n);return{systemId:r,data:i}}));if(S.length>0){var T=[{type:"cenc",values:S}];b.contentProtections={keyIds:h,initData:T}}else b.contentProtections={keyIds:h,initData:[]}}return b}));if("ADVT"===T)return null;var U={id:C,type:E,representations:L,language:null==w?void 0:w};return"text"===E&&"DESC"===T&&(U.closedCaption=!0),U}return function(n,r,i){var o="";if(void 0!==r){var s=(0,f.$)(r);o=r.substring(0,s)}var u=n.documentElement;if(null==u||"SmoothStreamingMedia"!==u.nodeName)throw new Error("document root should be SmoothStreamingMedia");var l=u.getAttribute("MajorVersion"),c=u.getAttribute("MinorVersion");if(null===l||null===c||!/^[2]-[0-2]$/.test(l+"-"+c))throw new Error("Version should be 2.0, 2.1 or 2.2");var v,p,h=u.getAttribute("Timescale"),g=(0,d.Z)(h)?isNaN(+h)?1e7:+h:1e7,y=N(u,(function(t,n,r){switch(n){case"Protection":t.protections.push(T(r,e.keySystems));break;case"StreamIndex":t.adaptationNodes.push(r)}return t}),{adaptationNodes:[],protections:[]}),_=y.protections,S=y.adaptationNodes,E="boolean"==typeof(v=u.getAttribute("IsLive"))?v:"string"==typeof v&&"TRUE"===v.toUpperCase();if(E){var w=u.getAttribute("DVRWindowLength");null==w||isNaN(+w)||0==+w||(p=+w/g)}var k,A,I,R,Z,x,P,M=S.reduce((function(e,t){var n=m({root:t,baseUrl:o,timescale:g,protections:_,isLive:E,timeShiftBufferDepth:p,manifestReceivedTime:i});if(null===n)return e;var r=n.type,a=e[r];return void 0===a?e[r]=[n]:a.push(n),e}),{}),C=null,D=void 0!==M.video?M.video[0]:void 0,O=void 0!==M.audio?M.audio[0]:void 0;if(void 0!==D||void 0!==O){var L=[],U=[];if(void 0!==D){var B=D.representations[0];if(void 0!==B){var F=B.index.getFirstAvailablePosition(),z=B.index.getLastAvailablePosition();null!=F&&L.push(F),null!=z&&U.push(z)}}if(void 0!==O){var V=O.representations[0];if(void 0!==V){var K=V.index.getFirstAvailablePosition(),G=V.index.getLastAvailablePosition();null!=K&&L.push(K),null!=G&&U.push(G)}}L.length>0&&(Z=Math.max.apply(Math,L)),U.length>0&&(x=Math.min.apply(Math,U),P=Math.max.apply(Math,U))}var j=u.getAttribute("Duration"),H=null!==j&&0!=+j?+j/g:void 0;if(E){k=e.suggestedPresentationDelay,A=t,I=null!=Z?Z:A;var W=P;void 0===W&&(W=Date.now()/1e3-A);var q=x;void 0===q&&(q=W),R={isLinear:!0,maximumSafePosition:q,livePosition:W,time:performance.now()},C=null!=p?p:null}else{I=null!=Z?Z:0,R={isLinear:!1,maximumSafePosition:void 0!==x?x:void 0!==H?I+H:1/0,livePosition:void 0,time:performance.now()}}var Y=E?0:I,X=E?void 0:R.maximumSafePosition,Q={availabilityStartTime:void 0===A?0:A,clockOffset:a,isLive:E,isDynamic:E,isLastPeriodKnown:!0,timeBounds:{minimumSafePosition:I,timeshiftDepth:C,maximumTimeData:R},periods:[{adaptations:M,duration:void 0!==X?X-Y:H,end:X,id:"gen-smooth-period-0",start:Y}],suggestedPresentationDelay:k,transportType:"smooth",uris:null==r?[]:[r]};return b(Q),Q}},B=U,F=n(4597),z=n(4460),V=n(8791),K=n(4644),G=n(2297);function j(e,t,n,i,o){var s,u,d,c=[];if(o){var f=(0,a.XA)(e);null!==f?(d=function(e){var t=(0,G.nR)(e,3565190898,3392751253,2387879627,2655430559);if(void 0===t)return[];for(var n=[],r=t[0],i=t[4],a=0;a<i;a++){var o=void 0,s=void 0;1===r?(s=(0,l.pV)(t,16*a+5),o=(0,l.pV)(t,16*a+5+8)):(s=(0,l.pX)(t,8*a+5),o=(0,l.pX)(t,8*a+5+4)),n.push({time:s,duration:o})}return n}(f),u=function(e){var t=(0,G.nR)(e,1830656773,1121273062,2162299933,2952222642);if(void 0!==t)return{duration:(0,l.pV)(t,12),time:(0,l.pV)(t,4)}}(f)):r.Z.warn("smooth: could not find traf atom")}if(void 0!==d)for(var v=0;v<d.length;v++)c.push({time:d[v].time,duration:d[v].duration,timescale:n});if(void 0!==u)return{nextSegments:c,chunkInfos:{time:u.time/n,duration:u.duration/n},scaledSegmentTime:u.time};if(t||!i.complete)return{nextSegments:c,chunkInfos:null,scaledSegmentTime:void 0};var p=i.duration*n,h=Math.min(.9*n,p/4),m=(0,K.MM)(e),g=void 0!==(null===(s=i.privateInfos)||void 0===s?void 0:s.smoothMediaSegment)?i.privateInfos.smoothMediaSegment.time:Math.round(i.time*n);return{nextSegments:c,chunkInfos:void 0!==m&&Math.abs(m-p)<=h?{time:i.time,duration:m/n}:{time:i.time,duration:i.duration},scaledSegmentTime:g}}function H(e){return"string"==typeof e&&e.indexOf("mp4")>=0}var W=n(3666);function q(e,t){return y("schm",(0,l.zo)(4,(0,v.tG)(e),(0,l.kh)(t)))}function Y(e){return y("frma",(0,v.tG)(e))}function X(e){var t=[7,[e.length]];return y("stsd",l.zo.apply(void 0,t.concat(e)))}function Q(e,t,n){return y("tenc",(0,l.zo)(6,[e,t],n))}function $(e,t,n,r,i){var a=[e,t,n];return void 0!==i&&a.push(y("senc",i),function(e){if(0===e.length)return y("saiz",new Uint8Array(0));var t=(0,l.pX)(e,0),n=(0,l.pX)(e,4),r=new Uint8Array(n+9);r.set((0,l.kh)(n),5);for(var i,a,o=9,s=8;s<e.length;)s+=8,2==(2&t)?(a=2,s+=6*(i=(0,l.zK)(e,s))+2):(i=0,a=0),r[o]=6*i+8+a,o++;return y("saiz",r)}(i),function(e,t,n,r){return y("saio",(0,l.zo)(4,[0,0,0,1],(0,l.kh)(e.length+t.length+n.length+r.length+8+8+8+8)))}(r,e,t,n)),_("traf",a)}function J(e,t){var n=(0,G.Qy)(e,1836019558);if(null===n)throw new Error("Smooth: Invalid ISOBMFF given");var r=e.subarray(n[1],n[2]),i=(0,G.iz)(r,1835427940),a=(0,G.t_)(r,1953653094);if(null===a||null===i)throw new Error("Smooth: Invalid ISOBMFF given");var o=(0,G.Qy)(a,1952868452),s=(0,G.Qy)(a,1953658222);if(null===o||null===s)throw new Error("Smooth: Invalid ISOBMFF given");var u=a.subarray(o[0],o[2]),d=a.subarray(s[0],s[2]);u.set([0,0,0,1],o[1]-o[0]+4);var c=function(e){return y("tfdt",(0,l.zo)([1,0,0,0],(0,l.el)(e)))}(t),f=function(e,t){if((1&e[t+3])>0)return e;var n=new Uint8Array(e.length+4);return n.set(e.subarray(0,t+8),0),n[t+3]=1|n[t+3],n.set([0,0,0,0],t+8),n.set(e.subarray(t+8,e.length),t+12),(0,K.J6)(n)}(d,s[1]-s[0]),v=$(u,c,f,i,(0,G.nR)(a,2721664850,1520127764,2722393154,2086964724)),p=_("moof",[i,v]),h=(0,G.Qy)(p,1836019558),m=(0,G.Qy)(v,1953653094),g=(0,G.Qy)(f,1953658222);if(null===h||null===m||null===g)throw new Error("Smooth: Invalid moof, trun or traf generation");var b=h[1]-h[0]+i.length+(m[1]-m[0])+u.length+c.length+(g[1]-g[0])+8,S=n[2]-n[0],E=p.length-S,T=(0,G.Qy)(e,1835295092);if(null===T)throw new Error("Smooth: Invalid ISOBMFF given");if(!W.YM&&(0===E||E<=-8)){var w=T[1];return p.set((0,l.kh)(w),b),e.set(p,n[0]),E<=-8&&e.set(y("free",new Uint8Array(-E-8)),p.length),e}var k=T[1]+E;p.set((0,l.kh)(k),b);var A=new Uint8Array(e.length+E),I=e.subarray(0,n[0]),R=e.subarray(n[2],e.length);return A.set(I,0),A.set(p,I.length),A.set(R,I.length+p.length),A}var ee=n(7839),te=n(281);function ne(e,t,n,r,i,a){var o,s,u,d=_("stbl",[n,y("stts",new Uint8Array(8)),y("stsc",new Uint8Array(8)),y("stsz",new Uint8Array(12)),y("stco",new Uint8Array(8))]),c=function(e){return y("dref",(0,l.zo)(7,[1],e))}(y("url ",new Uint8Array([0,0,0,1]))),f=_("dinf",[c]),p=_("minf",[r,f,d]),h=function(e){var t,n;switch(e){case"video":t="vide",n="VideoHandler";break;case"audio":t="soun",n="SoundHandler";break;default:t="hint",n=""}return y("hdlr",(0,l.zo)(8,(0,v.tG)(t),12,(0,v.tG)(n),1))}(t),m=function(e){return y("mdhd",(0,l.zo)(12,(0,l.kh)(e),8))}(e),g=_("mdia",[m,h,p]),b=function(e,t,n){return y("tkhd",(0,l.zo)((0,l.kh)(7),8,(0,l.kh)(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],(0,l.XT)(e),2,(0,l.XT)(t),2))}(i,a,1),S=_("trak",[b,g]),E=_("mvex",[(o=1,y("trex",(0,l.zo)(4,(0,l.kh)(o),[0,0,0,1],12)))]),T=function(e,t){return y("mvhd",(0,l.zo)(12,(0,l.kh)(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,(0,l.XT)(t+1)))}(e,1),w=function(e,t,n){return _("moov",[e,t,n])}(T,E,S),k=(s="isom",u=["isom","iso2","iso6","avc1","dash"],y("ftyp",l.zo.apply(void 0,[(0,v.tG)(s),[0,0,0,1]].concat(u.map(v.tG)))));return(0,l.zo)(k,w)}function re(e,t,n,r,i,a,o,s){var u=o.split("00000001"),d=u[1],c=u[2];if(void 0===d||void 0===c)throw new Error("Smooth: unsupported codec private data.");var f,p,h=function(e,t,n){var r=2===n?1:4===n?3:0,i=e[1],a=e[2],o=e[3];return y("avcC",(0,l.zo)([1,i,a,o,252|r,225],(0,l.XT)(e.length),e,[1],(0,l.XT)(t.length),t))}((0,v.nr)(d),(0,v.nr)(c),a);if(void 0===s){var m=function(e,t,n,r,i,a,o){return y("avc1",(0,l.zo)(6,(0,l.XT)(1),16,(0,l.XT)(e),(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),6,[0,1,i.length],(0,v.tG)(i),31-i.length,(0,l.XT)(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,h);f=X([m])}else{var g=_("schi",[Q(1,8,s)]),b=q("cenc",65536),S=function(e,t,n,r,i,a,o,s){return y("encv",(0,l.zo)(6,(0,l.XT)(1),16,(0,l.XT)(e),(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),6,[0,1,i.length],(0,v.tG)(i),31-i.length,(0,l.XT)(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,h,_("sinf",[Y("avc1"),b,g]));f=X([S])}return ne(e,"video",f,((p=new Uint8Array(12))[3]=1,y("vmhd",p)),t,n)}var ie=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function ae(e,t,n,r,i,a,o){var s,u,d,c=function(e,t){return y("esds",(0,l.zo)(4,[3,25],(0,l.XT)(e),[0,4,17,64,21],11,[5,2],(0,v.nr)(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,d=((d=((d=(63&2)<<4)|31&ie.indexOf(s))<<4)|31&u)<<3,(0,v.ci)((0,l.XT)(d))):a),f=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return y("mp4a",(0,l.zo)(6,(0,l.XT)(e),8,(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),(0,l.XT)(i),2,a))}(1,t,n,r,i,c);return X([e])}var a=_("schi",[Q(1,8,o)]),s=q("cenc",65536),u=_("sinf",[Y("mp4a"),s,a]),d=function(e,t,n,r,i,a,o){return y("enca",(0,l.zo)(6,(0,l.XT)(e),8,(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),(0,l.XT)(i),2,a,o))}(1,t,n,r,i,c,u);return X([d])}();return ne(e,"audio",f,y("smhd",new Uint8Array(8)),0,0)}function oe(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:(0,te.Z)(s)}),(0,F.ZP)({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!H(t.mimeType)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return(0,z.Z)(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var se=function(e){var t=e.checkMediaSegmentIntegrity,n=e.customSegmentLoader;return function(e,r,i,a,o){var s=r.segment;if(s.isInit){if(void 0===s.privateInfos||void 0===s.privateInfos.smoothInitSegment)throw new Error("Smooth: Invalid segment format");var u,l=s.privateInfos.smoothInitSegment,d=l.codecPrivateData,c=l.timescale,f=l.height,v=l.width,p=l.protection,h=void 0===p?{keyId:void 0,keySystems:void 0}:p;if(void 0===d)throw new Error("Smooth: no codec private data.");switch(r.type){case"video":u=re(c,null!=v?v:0,null!=f?f:0,72,72,4,d,h.keyId);break;case"audio":var m=l.channels,g=void 0===m?0:m,y=l.bitsPerSample,_=void 0===y?0:y,b=l.packetSize,S=void 0===b?0:b,E=l.samplingRate;u=ae(c,g,_,S,void 0===E?0:E,d,h.keyId);break;default:0,u=new Uint8Array(0)}return Promise.resolve({resultType:"segment-created",resultData:u})}return null===e?Promise.resolve({resultType:"segment-created",resultData:null}):"function"!=typeof n?oe(e,r,o,i,a,t):new Promise((function(s,u){var l,d=!1,c={reject:function(e){var t,n;if(!d&&!a.isCancelled){d=!0,a.deregister(p);var r=e,i=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching a Smooth segment through a custom segmentLoader.",o=new ee.Z(i,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);u(o)}},resolve:function(e){if(!d&&!a.isCancelled){d=!0,a.deregister(p),H(r.mimeType)&&!0===t||s({resultType:"segment-loaded",resultData:{responseData:e.data,size:e.size,requestDuration:e.duration}});var n=e.data instanceof Uint8Array?e.data:new Uint8Array(e.data);(0,z.Z)(n,r.segment.isInit),s({resultType:"segment-loaded",resultData:{responseData:n,size:e.size,requestDuration:e.duration}})}},fallback:function(){d||a.isCancelled||(d=!0,a.deregister(p),oe(e,r,o,i,a,t).then(s,u))},progress:function(e){d||a.isCancelled||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})}};void 0!==r.segment.range&&(l=[r.segment.range],void 0!==r.segment.indexRange&&l.push(r.segment.indexRange));var f={isInit:r.segment.isInit,timeout:i.timeout,byteRanges:l,trackType:r.type,url:e},v=n(f,c);function p(e){d||((d=!0)||"function"!=typeof v||v(),u(e))}a.register(p)}))}};function ue(e,t){return null===e?null:null===t.url?e.baseUrl:(0,f.Z)(e.baseUrl,t.url)}var le=function(e){var t=B(e),n=se(e),o={customManifestLoader:e.manifestLoader},s={loadSegment:function(e,t,r,i,a){var o=ue(e,t.segment);return n(o,t,r,i,a)},parseSegment:function(e,t,n){var r,i,a=t.segment,o=e.data,s=e.isChunked;if(null===o)return a.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionData:[],appendWindow:[void 0,void 0]};var u=o instanceof Uint8Array?o:new Uint8Array(o);if(a.isInit){var l=null===(i=null===(r=a.privateInfos)||void 0===r?void 0:r.smoothInitSegment)||void 0===i?void 0:i.timescale;return{segmentType:"init",initializationData:o,initializationDataSize:o.byteLength,initTimescale:l,protectionData:[]}}var d=void 0!==n?j(u,s,n,a,t.isLive):null;if(null===d||null===d.chunkInfos||void 0===d.scaledSegmentTime)throw new Error("Smooth Segment without time information");var c=d.nextSegments,f=d.chunkInfos,v=J(u,d.scaledSegmentTime),p=c.length>0?c:void 0;return{segmentType:"media",chunkData:v,chunkInfos:f,chunkOffset:0,chunkSize:v.length,protectionData:[],predictedSegments:p,appendWindow:[void 0,void 0]}}};return{manifest:{loadManifest:(0,V.Z)(o,"text"),parseManifest:function(n,r){var a,o=null!==(a=n.url)&&void 0!==a?a:r.originalUrl,s=n.receivedTime,u=n.responseData,l="string"==typeof u?(new DOMParser).parseFromString(u,"text/xml"):u,d=t(l,o,s);return{manifest:new i.ZP(d,{representationFilter:e.representationFilter}),url:o}}},audio:s,video:s,text:{loadSegment:function(t,n,r,i,a){var o=n.segment,s=ue(t,o);return o.isInit||null===s?Promise.resolve({resultType:"segment-created",resultData:null}):H(n.mimeType)?(0,F.ZP)({url:s,responseType:"arraybuffer",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(t){if(!0!==e.checkMediaSegmentIntegrity)return{resultType:"segment-loaded",resultData:t};var r=new Uint8Array(t.responseData);return(0,z.Z)(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):(0,F.ZP)({url:s,responseType:"text",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))},parseSegment:function(e,t,n){var i,o,s,u=t.segment,l=t.language,d=t.mimeType,c=void 0===d?"":d,f=t.codecs,p=void 0===f?"":f,h=H(t.mimeType),m=e.data,g=e.isChunked;if(u.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0};if(null===m)return{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionData:[],appendWindow:[void 0,void 0]};var y,_,b,S,E=null;if(h){var T;o=(T="string"==typeof m?(0,v.tG)(m):m instanceof Uint8Array?m:new Uint8Array(m)).length;var w=void 0!==n?j(T,g,n,u,t.isLive):null;s=null==w?void 0:w.nextSegments,null===(E=null!==(i=null==w?void 0:w.chunkInfos)&&void 0!==i?i:null)?g?r.Z.warn("Smooth: Unavailable time data for current text track."):(y=u.time,_=u.end):(y=E.time,_=void 0!==E.duration?E.time+E.duration:u.end);var k=p.toLowerCase();if("application/ttml+xml+mp4"===c||"stpp"===k||"stpp.ttml.im1t"===k)S="ttml";else{if("wvtt"!==k)throw new Error("could not find a text-track parser for the type "+c);S="vtt"}var A=(0,a.Le)(T);b=null===A?"":(0,v.uR)(A)}else{var I;if(y=u.time,_=u.end,"string"!=typeof m){var R=m instanceof Uint8Array?m:new Uint8Array(m);o=R.length,I=(0,v.uR)(R)}else I=m;switch(c){case"application/x-sami":case"application/smil":S="sami";break;case"application/ttml+xml":S="ttml";break;case"text/vtt":S="vtt"}if(void 0===S){if("srt"!==p.toLowerCase())throw new Error("could not find a text-track parser for the type "+c);S="srt"}b=I}return{segmentType:"media",chunkData:{type:S,data:b,start:y,end:_,language:l},chunkSize:o,chunkInfos:E,chunkOffset:null!=y?y:0,protectionData:[],predictedSegments:Array.isArray(s)&&s.length>0?s:void 0,appendWindow:[void 0,void 0]}}}}}},281:function(e,t,n){"use strict";function r(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}n.d(t,{Z:function(){return r}})},4460:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(5389),i=n(8766);function a(e,t){if(t){if((0,i.Z)(e,1718909296)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `ftyp` box");if((0,i.Z)(e,1836019574)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moov` box")}else{if((0,i.Z)(e,1836019558)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moof` box");if((0,i.Z)(e,1835295092)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `mdat` box")}}},8766:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(6968);function i(e,t){for(var n=e.length,i=0;i+8<=n;){var a=(0,r.pX)(e,i);if(0===a)a=n-i;else if(1===a){if(i+16>n)return-1;a=(0,r.pV)(e,i+8)}if(isNaN(a)||a<=0)return-1;if((0,r.pX)(e,i+4)===t)return i+a<=n?i:-1;i+=a}return-1}},8791:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7904),i=n(4597),a=n(7839);function o(e,t){var n=e.customManifestLoader,o=function(e){return function(t,n,a){if(void 0===t)throw new Error("Cannot perform HTTP(s) request. URL not known");switch(e){case"arraybuffer":return(0,i.ZP)({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:a});case"text":return(0,i.ZP)({url:t,responseType:"text",timeout:n.timeout,cancelSignal:a});case"document":return(0,i.ZP)({url:t,responseType:"document",timeout:n.timeout,cancelSignal:a});default:(0,r.Z)(e)}}}(t);return"function"!=typeof n?o:function(e,t){return function(n,r,i){return new Promise((function(o,s){var u=Date.now()-performance.now(),l=!1,d={reject:function(e){var t,n;if(!l&&!i.isCancelled){l=!0,i.deregister(f);var r=e,o=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching the Manifest through a custom manifestLoader.",u=new a.Z(o,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);s(u)}},resolve:function(e){if(!l&&!i.isCancelled){l=!0,i.deregister(f);var t=void 0!==e.receivingTime?e.receivingTime-u:void 0,n=void 0!==e.sendingTime?e.sendingTime-u:void 0;o({responseData:e.data,size:e.size,requestDuration:e.duration,url:e.url,receivedTime:t,sendingTime:n})}},fallback:function(){l||i.isCancelled||(l=!0,i.deregister(f),t(n,r,i).then(o,s))}},c=e({url:n,timeout:r.timeout},d);function f(e){l||(l=!0,"function"==typeof c&&c(),s(e))}i.register(f)}))}}(n,o)}},4791:function(e,t,n){"use strict";function r(e,t){if(e.length!==t.length)return!1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}n.d(t,{Z:function(){return r}})},3274:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.find)return e.find(t,n);for(var r=e.length>>>0,i=0;i<r;i++){var a=e[i];if(t.call(n,a,i,e))return a}}n.d(t,{Z:function(){return r}})},5138:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.findIndex)return e.findIndex(t,n);for(var r=e.length>>>0,i=0;i<r;i++)if(t.call(n,e[i],i,e))return i;return-1}n.d(t,{Z:function(){return r}})},7714:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.includes)return e.includes(t,n);var r=e.length>>>0;if(0===r)return!1;for(var i,a,o=0|n,s=o>=0?Math.min(o,r-1):Math.max(r+o,0);s<r;){if((i=e[s])===(a=t)||"number"==typeof i&&"number"==typeof a&&isNaN(i)&&isNaN(a))return!0;s++}return!1}n.d(t,{Z:function(){return r}})},811:function(e,t,n){"use strict";n.d(t,{Z:function(){return i},u:function(){return a}});var r=n(1946);function i(e,t){0}function a(e,t,n){for(var a in void 0===n&&(n="object"),i((0,r.Z)(e)),t)t.hasOwnProperty(a)&&i((e[a],t[a]),t[a])}},7904:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7326),i=n(4578),a=function(e){function t(n){var i;return i=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(i),t.prototype),i.name="AssertionError",i.message=n,i}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error));function o(e){throw new a("Unreachable path taken")}},9689:function(e,t,n){"use strict";n.d(t,{J:function(){return s},K:function(){return u}});var r=n(3887),i=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],a=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function o(e){if(e>=a.length)throw new Error("Unable to parse base64 string.");var t=a[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function s(e){var t,n="",r=e.length;for(t=2;t<r;t+=3)n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2|e[t]>>6],n+=i[63&e[t]];return t===r+1&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4],n+="=="),t===r&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2],n+="="),n}function u(e){var t=e.length%4,n=e;0!==t&&(r.Z.warn("base64ToBytes: base64 given miss padding"),n+=3===t?"=":2===t?"==":"===");var i=n.indexOf("=");if(-1!==i&&i<n.length-2)throw new Error("Unable to parse base64 string.");for(var a,s=n.endsWith("==")?2:n.endsWith("=")?1:0,u=n.length,l=new Uint8Array(u/4*3),d=0,c=0;d<u;d+=4,c+=3)a=o(n.charCodeAt(d))<<18|o(n.charCodeAt(d+1))<<12|o(n.charCodeAt(d+2))<<6|o(n.charCodeAt(d+3)),l[c]=a>>16,l[c+1]=a>>8&255,l[c+2]=255&a;return l.subarray(0,l.length-s)}},6968:function(e,t,n){"use strict";function r(){for(var e,t=arguments.length,n=-1,r=0;++n<t;)r+="number"==typeof(e=n<0||arguments.length<=n?void 0:arguments[n])?e:e.length;var i=new Uint8Array(r),a=0;for(n=-1;++n<t;)"number"==typeof(e=n<0||arguments.length<=n?void 0:arguments[n])?a+=e:e.length>0&&(i.set(e,a),a+=e.length);return i}function i(e,t){return(e[t+0]<<8)+(e[t+1]<<0)}function a(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function o(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function s(e,t){return 4294967296*(16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3])+16777216*e[t+4]+65536*e[t+5]+256*e[t+6]+e[t+7]}function u(e){return new Uint8Array([e>>>8&255,255&e])}function l(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function d(e){var t=e%4294967296,n=(e-t)/4294967296;return new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function c(e,t){return(e[t+0]<<0)+(e[t+1]<<8)}function f(e,t){return e[t+0]+256*e[t+1]+65536*e[t+2]+16777216*e[t+3]}function v(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}function p(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer)}n.d(t,{O_:function(){return v},QI:function(){return a},XT:function(){return u},_f:function(){return p},dN:function(){return f},el:function(){return d},kh:function(){return l},pV:function(){return s},pX:function(){return o},qb:function(){return c},zK:function(){return i},zo:function(){return r}})},7864:function(e,t,n){"use strict";function r(e,t){return new Promise((function(n,r){var i=setTimeout((function(){a(),n()}),e),a=t.register((function(e){clearTimeout(i),r(e)}))}))}n.d(t,{Z:function(){return r}})},1959:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946),a=function(){function e(){this._listeners={}}var t=e.prototype;return t.addEventListener=function(e,t,n){var r=this,i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],void 0!==n&&n.register((function(){r.removeEventListener(e,t)}))},t.removeEventListener=function(e,t){if((0,i.Z)(e))this._listeners={};else{var n=this._listeners[e];if(Array.isArray(n))if((0,i.Z)(t))delete this._listeners[e];else{var r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&delete this._listeners[e]}}},t.trigger=function(e,t){var n=this._listeners[e];Array.isArray(n)&&n.slice().forEach((function(e){try{e(t)}catch(e){r.Z.error("EventEmitter: listener error",e instanceof Error?e:null)}}))},e}()},9592:function(e,t,n){"use strict";function r(e,t){return"function"==typeof Array.prototype.flatMap?e.flatMap(t):e.reduce((function(e,n){var r=t(n);return Array.isArray(r)?(e.push.apply(e,r),e):(e.push(r),e)}),[])}n.d(t,{Z:function(){return r}})},2572:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});function r(e){return e*(.3*(2*Math.random()-1)+1)}},2870:function(e,t,n){"use strict";function r(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e[n],t&=t;return t}n.d(t,{Z:function(){return r}})},908:function(e,t,n){"use strict";function r(){var e="",t=-1;return function(){return++t>=Number.MAX_SAFE_INTEGER&&(e+="0",t=0),e+String(t)}}n.d(t,{Z:function(){return r}})},6923:function(e,t,n){"use strict";function r(e){return"string"==typeof e&&e.length>0}n.d(t,{Z:function(){return r}})},1946:function(e,t,n){"use strict";function r(e){return null==e}n.d(t,{Z:function(){return r}})},5288:function(e,t,n){"use strict";n.d(t,{ZP:function(){return u}});var r=n(6923),i=n(1946),a={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},o={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"};function s(e){if((0,i.Z)(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=a[e];break;case 3:t=o[e]}return t}((""+e).toLowerCase().split("-")[0]);return(0,r.Z)(t)?t:e}var u=s},8894:function(e,t,n){"use strict";function r(){}n.d(t,{Z:function(){return r}})},8026:function(e,t){"use strict";t.Z="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n++){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}},1679:function(e,t,n){"use strict";t.Z="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))}},2829:function(e,t,n){"use strict";n.d(t,{A1:function(){return o},F_:function(){return v},JN:function(){return d},L7:function(){return p},Ti:function(){return s},XS:function(){return f},kR:function(){return h},rx:function(){return c},tn:function(){return g},uH:function(){return y}});function r(e,t){return Math.abs(e-t)<.016666666666666666}function i(e,t){return{start:Math.min(e.start,t.start),end:Math.max(e.end,t.end)}}function a(e,t){return e.end<=t.start}function o(e,t){for(var n=0;n<e.length;n++)if(s(e[n],t))return!0;return!1}function s(e,t){var n=e.start,r=e.end;return n<=t&&t<r}function u(e,t){return s(e,t.start)||e.start<t.end&&t.end<e.end||s(t,e.start)}function l(e,t){return r(t.start,e.end)||r(t.end,e.start)}function d(e){for(var t=[],n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}function c(e,t){for(var n=e.length-1;n>=0;n--){var r=e.start(n);if(t>=r){var i=e.end(n);if(t<i)return{start:r,end:i}}}return null}function f(e,t){for(var n=e.length,r=0;r<n;r++){var i=e.start(r);if(t<i)return i-t}return 1/0}function v(e,t){for(var n=null,r=[],i=0;i<e.length;i++){var a=e.start(i),o=e.end(i);t<a||t>=o?r.push({start:a,end:o}):n={start:a,end:o}}return{outerRanges:r,innerRange:n}}function p(e,t){var n=c(e,t);return null!==n?n.end-t:1/0}function h(e,t){if(t.start===t.end)return e;for(var n=t,r=0;r<e.length;r++){var o=e[r],s=u(n,o),d=l(n,o);if(s||d)n=i(n,o),e.splice(r--,1);else if(0===r){if(a(n,e[0]))break}else if(a(e[r-1],n)&&a(n,o))break}return e.splice(r,0,n),function(e){for(var t=1;t<e.length;t++){var n=e[t-1],r=e[t];if(l(n,r)){var a=i(n,r);e.splice(--t,2,a)}}return e}(function(e){for(var t=0;t<e.length;t++){var n=e[t];n.start===n.end&&e.splice(t--,1)}return e}(e))}function m(e,t){for(var n=[],r=0;r<t.length;r++)u(e,t[r])&&n.push(t[r]);return n}function g(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=m(i,t);if(a.length>0)for(var o=0;o<a.length;o++){var s=a[o];n.push({start:Math.max(i.start,s.start),end:Math.min(i.end,s.end)})}}return n}function y(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=[],o=m(i,t);if(o.length>0)for(var s=0;s<o.length;s++){var u=o[s];a.push({start:Math.max(i.start,u.start),end:Math.min(i.end,u.end)})}if(0===a.length)n.push(i);else{for(var l=i.start,d=0;d<a.length;d++)a[d].start>l&&n.push({start:l,end:a[d].start}),l=a[d].end;l<i.end&&n.push({start:l,end:i.end})}}return n}},5095:function(e,t,n){"use strict";function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){var n=e,i=[],a=!1;return void 0!==t&&t.register(o),{getValue:function(){return n},setValue:function(e){if(!a&&(n=e,0!==i.length))for(var t,o=r(i.slice());!(t=o()).done;){var s=t.value;try{s.hasBeenCleared||s.trigger(e,s.complete)}catch(e){}}},setValueIfChanged:function(e){e!==n&&this.setValue(e)},onUpdate:function(e,t){var r={trigger:e,complete:o,hasBeenCleared:!1};function o(){if(!r.hasBeenCleared){r.hasBeenCleared=!0;var e=i.indexOf(r);e>=0&&i.splice(e,1)}}i.push(r),!0===(null==t?void 0:t.emitCurrentValue)&&e(n,o),a||r.hasBeenCleared?o():void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.register(o)},waitUntilDefined:function(e,t){this.onUpdate((function(t,r){void 0!==t&&(r(),e(n))}),{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:!0})},finish:o};function o(){a=!0;for(var e,t=r(i.slice());!(e=t()).done;){var n=e.value;try{n.hasBeenCleared||(n.complete(),n.hasBeenCleared=!0)}catch(e){}}i.length=0}}function o(e,t,n){var r=a(t(e.getValue()),n);return e.onUpdate((function(e){r.setValue(t(e))}),{clearSignal:n}),r}n.d(t,{$l:function(){return a},ZP:function(){return a},lR:function(){return o}})},4597:function(e,t,n){"use strict";n.d(t,{ZP:function(){return o}});var r=n(9105),i=n(6923),a=n(1946);var o=function(e){var t={url:e.url,headers:e.headers,responseType:(0,a.Z)(e.responseType)?"json":e.responseType,timeout:e.timeout};return new Promise((function(n,o){var s,u=e.onProgress,l=e.cancelSignal,d=t.url,c=t.headers,f=t.responseType,v=t.timeout,p=new XMLHttpRequest;if(p.open("GET",d,!0),void 0!==v&&(p.timeout=v,s=window.setTimeout((function(){_(),o(new r.Z(d,p.status,"TIMEOUT"))}),v+3e3)),p.responseType=f,"document"===p.responseType&&p.overrideMimeType("text/xml"),!(0,a.Z)(c)){var h=c;for(var m in h)h.hasOwnProperty(m)&&p.setRequestHeader(m,h[m])}var g=performance.now(),y=null;function _(){void 0!==s&&clearTimeout(s),null!==y&&y()}void 0!==l&&(y=l.register((function(e){_(),(0,a.Z)(p)||4===p.readyState||p.abort(),o(e)})),l.isCancelled)||(p.onerror=function(){_(),o(new r.Z(d,p.status,"ERROR_EVENT"))},p.ontimeout=function(){_(),o(new r.Z(d,p.status,"TIMEOUT"))},void 0!==u&&(p.onprogress=function(e){var t=performance.now();u({url:d,duration:t-g,sendingTime:g,currentTime:t,size:e.loaded,totalSize:e.total})}),p.onload=function(e){if(4===p.readyState)if(_(),p.status>=200&&p.status<300){var t,s=performance.now(),u=p.response instanceof ArrayBuffer?p.response.byteLength:e.total,l=p.status,c=p.responseType,f=(0,i.Z)(p.responseURL)?p.responseURL:d;if(t="json"===c?"object"==typeof p.response?p.response:function(e){try{return JSON.parse(e)}catch(e){return null}}(p.responseText):p.response,(0,a.Z)(t))return void o(new r.Z(d,p.status,"PARSE_ERROR"));n({status:l,url:f,responseType:c,sendingTime:g,receivedTime:s,requestDuration:s-g,size:u,responseData:t})}else o(new r.Z(d,p.status,"ERROR_HTTP_CODE"))},p.send())}))}},9829:function(e,t,n){"use strict";n.d(t,{$:function(){return s},Z:function(){return o}});var r=/^(?:[a-z]+:)?\/\//i,i=/\/\.{1,2}\//;function a(e){if(!i.test(e))return e;for(var t=[],n=e.split("/"),r=0,a=n.length;r<a;r++)if(".."===n[r])t.pop();else{if("."===n[r])continue;t.push(n[r])}return t.join("/")}function o(){var e=arguments.length;if(0===e)return"";for(var t="",n=0;n<e;n++){var i=n<0||arguments.length<=n?void 0:arguments[n];"string"==typeof i&&""!==i&&(r.test(i)?t=i:("/"===i[0]&&(i=i.substring(1)),"/"===t[t.length-1]&&(t=t.substring(0,t.length-1)),t=t+"/"+i))}return a(t)}function s(e){var t=e.lastIndexOf("/");if(t<0)return e.length;if(r.test(e)){var n=e.indexOf("/");if(n>=0&&t===n+1)return e.length}var i=e.indexOf("?");return i>=0&&i<t?s(e.substring(0,i)):t+1}},9252:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof String.prototype.startsWith)return e.startsWith(t,n);var r="number"==typeof n?Math.max(n,0):0;return e.substring(r,r+t.length)===t}n.d(t,{Z:function(){return r}})},3635:function(e,t,n){"use strict";n.d(t,{DM:function(){return h},TZ:function(){return s},ci:function(){return v},nr:function(){return f},tG:function(){return l},uR:function(){return c},wO:function(){return p},wV:function(){return u}});var r=n(3887),i=n(811),a="object"==typeof window&&"function"==typeof window.TextDecoder,o="object"==typeof window&&"function"==typeof window.TextEncoder;function s(e){for(var t=new ArrayBuffer(2*e.length),n=new Uint8Array(t),r=0;r<n.length;r+=2){var i=e.charCodeAt(r/2);n[r]=255&i,n[r+1]=i>>8&255}return n}function u(e){if(a)try{return new TextDecoder("utf-16le").decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-16LE, fallbacking to another implementation",t)}for(var n="",i=0;i<e.length;i+=2)n+=String.fromCharCode((e[i+1]<<8)+e[i]);return n}function l(e){if(o)try{return(new TextEncoder).encode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextEncoder to encode string into UTF-8, fallbacking to another implementation",t)}var n,i=encodeURIComponent(e);if("function"==typeof unescape)n=unescape(i);else{var a=/[0-9a-fA-F]/,s=i.length;n="";for(var u=0;u<i.length;u++){var l=!1;if("%"===i[u])if(u<=s-6&&"u"===i[u+1]&&a.test(i[u+2])&&a.test(i[u+3])&&a.test(i[u+4])&&a.test(i[u+5])){var d=parseInt(i.substring(u+1,u+6),16);n+=String.fromCharCode(d),l=!0,u+=5}else if(u<=s-3&&a.test(i[u+1])&&a.test(i[u+2])){var c=parseInt(i.substring(u+1,u+3),16);n+=String.fromCharCode(c),l=!0,u+=2}l||(n+=i[u])}}for(var f=new Uint8Array(n.length),v=0;v<n.length;v++)f[v]=255&n.charCodeAt(v);return f}function d(e,t){var n=e.toString(16);return n.length>=t?n:new Array(t-n.length+1).join("0")+n}function c(e){if(a)try{return(new TextDecoder).decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-8, fallbacking to another implementation",t)}var n=e;239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));var i,o=function(e){for(var t="",n=0;n<e.length;n+=16e3){var r=e.subarray(n,n+16e3);t+=String.fromCharCode.apply(null,r)}return t}(n);if("function"==typeof escape)i=escape(o);else{var s=/[A-Za-z0-9*_\+-\.\/]/;i="";for(var u=0;u<o.length;u++)if(s.test(o[u]))i+=o[u];else{var l=o.charCodeAt(u);i+=l>=256?"%u"+d(l,4):"%"+d(l,2)}}return decodeURIComponent(i)}function f(e){for(var t=e.length,n=new Uint8Array(t/2),r=0,i=0;r<t;r+=2,i++)n[i]=255&parseInt(e.substring(r,r+2),16);return n}function v(e,t){void 0===t&&(t="");for(var n="",r=0;r<e.byteLength;r++)n+=(e[r]>>>4).toString(16),n+=(15&e[r]).toString(16),t.length>0&&r<e.byteLength-1&&(n+=t);return n}function p(e){(0,i.Z)(16===e.length,"GUID length should be 16");var t=e[0],n=e[1],r=e[2],a=e[3],o=e[4],s=e[5],u=e[6],l=e[7],d=new Uint8Array(16);return d[0]=a,d[1]=r,d[2]=n,d[3]=t,d[4]=s,d[5]=o,d[6]=l,d[7]=u,d.set(e.subarray(8,16),8),d}function h(e,t){for(var n=t;n<e.length;){if(0===e[n])break;n+=1}return{end:n+1,string:c(e.subarray(t,n))}}},5278:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(1946);function i(){for(var e=0,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];for(var a=n.length;e<a;){var o=n[e];if(!(0,r.Z)(o))return o;e++}}},288:function(e,t,n){"use strict";n.d(t,{FU:function(){return d},XG:function(){return l},ZP:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(811),s=n(8894),u=function(){function e(e){var t,n=this,r=(t=s.Z,[function(e){t(e)},function(e){t=e}]),i=r[0],a=r[1];if(this.isUsed=!1,this._trigger=i,this.signal=new l(a),void 0!==(null==e?void 0:e.cancelOn)){var o=e.cancelOn.register((function(){n.cancel()}));this.signal.register(o)}}return e.prototype.cancel=function(e){if(!this.isUsed){this.isUsed=!0;var t=null!=e?e:new d;this._trigger(t)}},e.isCancellationError=function(e){return e instanceof d},e}(),l=function(){function e(e){var t=this;this.isCancelled=!1,this.cancellationError=null,this._listeners=[],e((function(e){for(t.cancellationError=e,t.isCancelled=!0;t._listeners.length>0;){(0,t._listeners.splice(t._listeners.length-1,1)[0])(e)}}))}var t=e.prototype;return t.register=function(e){var t=this;return this.isCancelled&&((0,o.Z)(null!==this.cancellationError),e(this.cancellationError)),this._listeners.push(e),function(){return t.deregister(e)}},t.deregister=function(e){if(!this.isCancelled)for(var t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)},e}(),d=function(e){function t(){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(n),t.prototype),n.name="CancellationError",n.message="This task was cancelled.",n}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},8806:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7714),i=[];function a(e){(0,r.Z)(i,e)||(console.warn(e),i.push(e))}},7473:function(e){"use strict";var t=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},n=function(e){var n,r,i=document.createTextNode(""),a=0;return new e((function(){var e;if(n)r&&(n=r.concat(n));else{if(!r)return;n=r}if(r=n,n=null,"function"==typeof r)return e=r,r=null,void e();for(i.data=a=++a%2;r;)e=r.shift(),r.length||(r=null),e()})).observe(i,{characterData:!0}),function(e){t(e),n?"function"==typeof n?n=[n,e]:n.push(e):(n=e,i.data=a=++a%2)}};e.exports=function(){if("object"==typeof process&&process&&"function"==typeof process.nextTick)return process.nextTick;if("function"==typeof queueMicrotask)return function(e){queueMicrotask(t(e))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return n(MutationObserver);if("function"==typeof WebKitMutationObserver)return n(WebKitMutationObserver)}return"function"==typeof setImmediate?function(e){setImmediate(t(e))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(e){setTimeout(t(e),0)}:null}()},7061:function(e,t,n){var r=n(8698).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof p?t:p,a=Object.create(i.prototype),o=new A(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return R()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=T(o,n);if(s){if(s===v)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=f(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===v)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,o),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var v={};function p(){}function h(){}function m(){}var g={};d(g,s,(function(){return this}));var y=Object.getPrototypeOf,_=y&&y(y(I([])));_&&_!==n&&a.call(_,s)&&(g=_);var b=m.prototype=p.prototype=Object.create(g);function S(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,o,s,u){var l=f(e[i],e,o);if("throw"!==l.type){var d=l.arg,c=d.value;return c&&"object"==r(c)&&a.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(c).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;this._invoke=function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return v;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var r=f(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,v;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,v):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,v)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function I(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:R}}function R(){return{value:void 0,done:!0}}return h.prototype=m,d(b,"constructor",m),d(m,"constructor",h),h.displayName=d(m,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,d(e,l,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},S(E.prototype),d(E.prototype,u,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new E(c(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},S(b),d(b,l,"Generator"),d(b,s,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=I,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:I(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),v}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,n){var r=n(7061)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},7326:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,{Z:function(){return r}})},5861:function(e,t,n){"use strict";function r(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,u,"next",e)}function u(e){r(o,i,a,s,u,"throw",e)}s(void 0)}))}}n.d(t,{Z:function(){return i}})},3144:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.d(t,{Z:function(){return i}})},4578:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(9611);function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(0,r.Z)(e,t)}},9611:function(e,t,n){"use strict";function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}n.d(t,{Z:function(){return r}})},2146:function(e,t,n){"use strict";function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}n.d(t,{Z:function(){return s}});var i=n(9611);function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function o(e,t,n){return o=a()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&(0,i.Z)(a,n.prototype),a},o.apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return s=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,a)}function a(){return o(e,arguments,r(this).constructor)}return a.prototype=Object.create(e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),(0,i.Z)(a,e)},s(e)}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};return function(){"use strict";n.d(r,{default:function(){return Fn}});var e=n(3144),t=n(4578),i=n(3038);function a(e){var t=e;if("function"==typeof t.getStartDate){var n=t.getStartDate();if("object"==typeof n&&null!==n){var r=+n;if(!isNaN(r))return r/1e3}else if("number"==typeof n&&!isNaN(n))return n}}var o=n(3666),s=n(3887);function u(){if(!o.vU)return!0;var e=function(){if(!o.vU)return s.Z.warn("Compat: Can't access Firefox version on no firefox browser."),null;var e=navigator.userAgent,t=/Firefox\/([0-9]+)\./.exec(e);if(null===t)return-1;var n=parseInt(t[1],10);return isNaN(n)?-1:n}();if(null===e||e<67)return!0;var t=null===HTMLVideoElement||void 0===HTMLVideoElement?void 0:HTMLVideoElement.prototype;return void 0!==(null==t?void 0:t.requirePictureInPicture)}var l=n(6872),d=n(8750),c=n(3714),f=n(5992),v=n(7874),p=n(811),h=n(7904),m=n(1959),g=n(908),y=n(1946),_=n(8026),b=n(2829),S=n(5095),E=n(288),T=n(5861),w=n(4687),k=n.n(w),A=n(6139),I=n(770);function R(e){return Z.apply(this,arguments)}function Z(){return(Z=(0,T.Z)(k().mark((function e(t){var n,r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==(n=I.Z.getState(t))){e.next=3;break}return e.abrupt("return");case 3:return s.Z.info("DRM: Disposing of the current MediaKeys"),r=n.loadedSessionsStore,I.Z.clearState(t),e.next=8,r.closeAllSessions();case 8:(0,A.Y)(t,null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function x(e){var t=I.Z.getState(e);return null===t?null:[t.mediaKeySystemAccess.keySystem,t.mediaKeySystemAccess.getConfiguration()]}function P(e){if(s.Z.info("DRM: Clearing-up DRM session."),o.fq)return s.Z.info("DRM: disposing current MediaKeys."),R(e);var t=I.Z.getState(e);return null!==t&&!0===t.keySystemOptions.closeSessionsOnStop?(s.Z.info("DRM: closing all current sessions."),t.loadedSessionsStore.closeAllSessions()):(s.Z.info("DRM: Nothing to clear. Returning right away. No state =",null===t),Promise.resolve())}var M=n(8894),C=n(5278),D=n(5138);function N(e){var t=e.map((function(t){return Math.log(t/e[0])})),n=t.map((function(e){return e-t[0]+1})),r=(n[n.length-1]-1)/(2*e.length+10),i=1/r;return e.map((function(e,t){return a(t)}));function a(t){if(0===t)return 0;var o=Math.min(Math.max(1,t),e.length-1);return e[o]===e[o-1]?a(t-1):i*(r+(e[o]*n[o-1]-e[o-1]*n[o])/(e[o]-e[o-1]))+4}}var O=function(){function e(e){this._levelsMap=N(e),this._bitrates=e,s.Z.debug("ABR: Steps for buffer based chooser.",this._levelsMap.map((function(t,n){return"bufferLevel: "+t+", bitrate: "+e[n]})).join(" ,"))}return e.prototype.getEstimate=function(e){var t=this._levelsMap,n=this._bitrates,r=e.bufferGap,i=e.currentBitrate,a=e.currentScore,o=e.speed;if(null==i)return n[0];var u,l=(0,D.Z)(n,(function(e){return e===i}));if(l<0||n.length!==t.length)return s.Z.error("ABR: Current Bitrate not found in the calculated levels"),n[0];if(null!=a&&(u=0===o?a:a/o),null!=u&&u>1){var d=t[l],c=function(){for(var e=l+1;e<t.length;e++)if(t[e]>d)return e}();if(null!=c)if(r>=t[c])return n[c]}if((null==u||u<1.15)&&r<t[l]){for(var f=l-1;f>=0;f--)if(n[f]<i)return n[f];return i}return i},e}(),L=n(3274),U=function(){function e(e){this._alpha=Math.exp(Math.log(.5)/e),this._lastEstimate=0,this._totalWeight=0}var t=e.prototype;return t.addSample=function(e,t){var n=Math.pow(this._alpha,e),r=t*(1-n)+n*this._lastEstimate;isNaN(r)||(this._lastEstimate=r,this._totalWeight+=e)},t.getEstimate=function(){var e=1-Math.pow(this._alpha,this._totalWeight);return this._lastEstimate/e},e}();function B(e){if(!(e.progress.length<5)){for(var t=new U(2),n=e.progress,r=1;r<n.length;r++){var i=n[r].size-n[r-1].size,a=n[r].timestamp-n[r-1].timestamp,o=8*i/(a/1e3);t.addSample(a/1e3,o)}return t.getEstimate()}}function F(e,t){var n=8*(e.totalSize-e.size);return Math.max(n/t,0)}var z=function(){function e(e,t){var n=l.Z.getCurrent(),r=n.ABR_STARVATION_GAP,i=n.OUT_OF_STARVATION_GAP,a=n.ABR_STARVATION_FACTOR,o=n.ABR_REGULAR_FACTOR;this._initialBitrate=e,this._inStarvationMode=!1,this._lowLatencyMode=t,this._config=t?{starvationGap:r.LOW_LATENCY,outOfStarvationGap:i.LOW_LATENCY,starvationBitrateFactor:a.LOW_LATENCY,regularBitrateFactor:o.LOW_LATENCY}:{starvationGap:r.DEFAULT,outOfStarvationGap:i.DEFAULT,starvationBitrateFactor:a.DEFAULT,regularBitrateFactor:o.DEFAULT}}var t=e.prototype;return t.getBandwidthEstimate=function(e,t,n,r,i){var a,o,u=this._config,d=e.bufferGap,c=e.position,f=e.duration,v=isFinite(d)?d:0,p=l.Z.getCurrent().ABR_STARVATION_DURATION_DELTA;return isNaN(f)||v+c.last<f-p?!this._inStarvationMode&&v<=u.starvationGap?(s.Z.info("ABR: enter starvation mode."),this._inStarvationMode=!0):this._inStarvationMode&&v>=u.outOfStarvationGap&&(s.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1):this._inStarvationMode&&(s.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1),this._inStarvationMode&&(o=function(e,t,n,r,i){if(!r){var a=t.bufferGap,o=t.speed,s=t.position,u=isFinite(a)?a:0,l=function(e,t){for(var n=-1,r=0;r<e.length;r++){var i=e[r].content.segment;if(!(i.duration<=0)){var a=i.time+i.duration;if(!i.complete&&r===e.length-1&&t-i.time>-1.2){n=r;break}if(a>t&&t-i.time>-1.2){n=r;break}}}if(n<0)return[];for(var o=e[n],s=o.content.segment.time,u=[o],l=n+1;l<e.length&&e[l].content.segment.time===s;l++)u.push(e[l]);return u}(e,s.last+u);if(1===l.length){var d=l[0],c=performance.now(),f=d.progress.length>0?d.progress[d.progress.length-1]:void 0,v=B(d);if(void 0!==f&&void 0!==v){var p=F(f,v);if((c-f.timestamp)/1e3<=p&&p-u/o>2e3)return v}if(d.content.segment.complete){var h=d.content.segment.duration,m=(c-d.requestTimestamp)/1e3;if(null!=n&&!(m<=(1.5*h+2)/o)){var g=h/m,y=n.bitrate*Math.min(.7,g);return void 0===i||y<i?y:void 0}}}}}(r,e,n,this._lowLatencyMode,i),null!=o&&(s.Z.info("ABR: starvation mode emergency estimate:",o),t.reset(),a=null==n?o:Math.min(o,n.bitrate))),null==a&&(a=null!=(o=t.getEstimate())?o*(this._inStarvationMode?u.starvationBitrateFactor:u.regularBitrateFactor):null!=i?i*(this._inStarvationMode?u.starvationBitrateFactor:u.regularBitrateFactor):this._initialBitrate),e.speed>1&&(a/=e.speed),{bandwidthEstimate:o,bitrateChosen:a}},t.isUrgent=function(e,t,n,r){return null===t||e!==t.bitrate&&(e>t.bitrate?!this._inStarvationMode:function(e,t,n){if(n)return!0;var r=isFinite(e.bufferGap)?e.bufferGap:0,i=e.position.last+r,a=(0,L.Z)(t,(function(e){var t=e.content;return t.segment.duration>0&&t.segment.time+t.segment.duration>i}));if(void 0===a)return!0;var o=performance.now(),s=a.progress.length>0?a.progress[a.progress.length-1]:void 0,u=B(a);if(void 0===s||void 0===u)return!0;var l=F(s,u);return(o-s.timestamp)/1e3>1.2*l||l-r/e.speed>-1.5}(r,n,this._lowLatencyMode))},e}();function V(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return K(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return K(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var G=function(){function e(e,t){this._scoreCalculator=e,this._lastAbrEstimate=t,this._consecutiveWrongGuesses=0,this._blockGuessesUntil=0,this._lastMaintanableBitrate=null}var t=e.prototype;return t.getGuess=function(e,t,n,r,i){var a=t.bufferGap,o=t.speed,u=this._lastAbrEstimate.representation;if(null===u)return null;if(r>u.bitrate)return 2===this._lastAbrEstimate.algorithmType&&(null!==this._lastAbrEstimate.representation&&(this._lastMaintanableBitrate=this._lastAbrEstimate.representation.bitrate),this._consecutiveWrongGuesses=0),null;var l=this._scoreCalculator.getEstimate(n);if(2!==this._lastAbrEstimate.algorithmType){if(void 0===l)return null;if(this._canGuessHigher(a,o,l)){var d=j(e,n);if(null!==d)return d}return null}if(this._isLastGuessValidated(u,r,l)&&(s.Z.debug("ABR: Guessed Representation validated",u.bitrate),this._lastMaintanableBitrate=u.bitrate,this._consecutiveWrongGuesses=0),n.id!==u.id)return u;if(this._shouldStopGuess(n,l,a,i))return this._consecutiveWrongGuesses++,this._blockGuessesUntil=performance.now()+Math.min(15e3*this._consecutiveWrongGuesses,12e4),function(e,t){var n=(0,D.Z)(e,(function(e){return e.id===t.id}));if(n<0)return s.Z.error("ABR: Current Representation not found."),null;for(;--n>=0;)if(e[n].bitrate<t.bitrate)return e[n];return null}(e,n);if(void 0===l)return n;if(this._canGuessHigher(a,o,l)){var c=j(e,n);if(null!==c)return c}return n},t._canGuessHigher=function(e,t,n){var r=n[0],i=n[1];return isFinite(e)&&e>=2.5&&performance.now()>this._blockGuessesUntil&&1===i&&r/t>1.01},t._shouldStopGuess=function(e,t,n,r){if(void 0!==t&&t[0]<1.01)return!0;if((void 0===t||t[0]<1.2)&&n<.6)return!0;for(var i,a=r.filter((function(t){return t.content.representation.id===e.id})),o=performance.now(),s=V(a);!(i=s()).done;){var u=i.value,l=o-u.requestTimestamp;if(u.content.segment.isInit){if(l>1e3)return!0}else{if(l>1e3*u.content.segment.duration+200)return!0;var d=B(u);if(void 0!==d&&d<.8*e.bitrate)return!0}}return!1},t._isLastGuessValidated=function(e,t,n){return void 0!==n&&1===n[1]&&n[0]>1.5||t>=e.bitrate&&(null===this._lastMaintanableBitrate||this._lastMaintanableBitrate<e.bitrate)},e}();function j(e,t){var n=e.length,r=(0,D.Z)(e,(function(e){return e.id===t.id}));if(r<0)return s.Z.error("ABR: Current Representation not found."),null;for(;++r<n;)if(e[r].bitrate>t.bitrate)return e[r];return null}var H=function(){function e(){var e=l.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new U(t),this._slowEWMA=new U(n),this._bytesSampled=0}var t=e.prototype;return t.addSample=function(e,t){if(!(t<l.Z.getCurrent().ABR_MINIMUM_CHUNK_SIZE)){var n=8e3*t/e,r=e/1e3;this._bytesSampled+=t,this._fastEWMA.addSample(r,n),this._slowEWMA.addSample(r,n)}},t.getEstimate=function(){var e=l.Z.getCurrent().ABR_MINIMUM_TOTAL_BYTES;if(!(this._bytesSampled<e))return Math.min(this._fastEWMA.getEstimate(),this._slowEWMA.getEstimate())},t.reset=function(){var e=l.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new U(t),this._slowEWMA=new U(n),this._bytesSampled=0},e}();var W=function(){function e(){this.bandwidth=void 0,this.representation=null,this.algorithmType=3}return e.prototype.update=function(e,t,n){this.representation=e,this.bandwidth=t,this.algorithmType=n},e}(),q=n(1679),Y=function(){function e(){this._currentRequests={}}var t=e.prototype;return t.add=function(e){var t=e.id,n=e.requestTimestamp,r=e.content;this._currentRequests[t]={requestTimestamp:n,progress:[],content:r}},t.addProgress=function(e){var t=this._currentRequests[e.id];null!=t?t.progress.push(e):s.Z.warn("ABR: progress for a request not added")},t.remove=function(e){null==this._currentRequests[e]&&s.Z.warn("ABR: can't remove unknown request"),delete this._currentRequests[e]},t.getRequests=function(){return(0,q.Z)(this._currentRequests).filter((function(e){return null!=e})).sort((function(e,t){return e.content.segment.time-t.content.segment.time}))},e}(),X=function(){function e(){this._currentRepresentationData=null,this._lastRepresentationWithGoodScore=null}var t=e.prototype;return t.addSample=function(e,t,n){var r,i=n/t,a=this._currentRepresentationData;null!==a&&a.representation.id===e.id?(r=a.ewma,a.ewma.addSample(t,i),a.loadedDuration+=n,a.loadedSegments++):((r=new U(5)).addSample(t,i),this._currentRepresentationData={representation:e,ewma:r,loadedDuration:n,loadedSegments:0}),r.getEstimate()>1&&this._lastRepresentationWithGoodScore!==e&&(s.Z.debug("ABR: New last stable representation",e.bitrate),this._lastRepresentationWithGoodScore=e)},t.getEstimate=function(e){if(null!==this._currentRepresentationData&&this._currentRepresentationData.representation.id===e.id){var t=this._currentRepresentationData,n=t.ewma,r=t.loadedSegments,i=t.loadedDuration;return[n.getEstimate(),r>=5&&i>=10?1:0]}},t.getLastStableRepresentation=function(){return this._lastRepresentationWithGoodScore},e}();function Q(e,t){var n=(0,D.Z)(e,(function(e){return e.bitrate>t}));return-1===n?e[e.length-1]:0===n?e[0]:e[n-1]}var $=(0,S.ZP)(void 0);$.finish();var J=(0,S.ZP)(1/0);J.finish();var ee=function(e){var t={},n=e.initialBitrates,r=e.throttlers,i=e.lowLatencyMode;return function(e,a,o,u,l){var d=e.adaptation.type,c=function(e){var n=t[e];if(null==n){s.Z.debug("ABR: Creating new BandwidthEstimator for ",e);var r=new H;return t[e]=r,r}return n}(d),f=(0,C.Z)(n[d],0);return function(e,t){var n=e.bandwidthEstimator,r=e.context,i=e.currentRepresentation,a=e.filters,o=e.initialBitrate,u=e.lowLatencyMode,l=e.playbackObserver,d=e.representations,c=new X,f=new z(null!=o?o:0,u),v=new Y,p=M.Z,h={metrics:T,requestBegin:w,requestProgress:k,requestEnd:A,addedSegment:function(e){p(e)}},m=new E.ZP({cancelOn:t}),g=y(d.getValue(),m.signal);return d.onUpdate(_,{clearSignal:t}),{estimates:g,callbacks:h};function y(e,t){if(1===e.length)return(0,S.ZP)({bitrate:void 0,representation:e[0],urgent:!0,knownStableBitrate:void 0});var o,d=!1,h=e.map((function(e){return e.bitrate})),m=new O(h),g=new W,y=new G(c,g),_=l.getReference().getValue(),E=(0,S.ZP)(w());return l.listen((function(e){_=e,T()}),{includeLastObservation:!1,clearSignal:t}),p=function(e){if(null!==_){var t=_,n=t.position,r=t.speed,i=e.buffered,a=(0,b.L7)(i,n.last),s=e.content.representation,u=c.getEstimate(s),l=null==u?void 0:u[0],d={bufferGap:a,currentBitrate:s.bitrate,currentScore:l,speed:r};o=m.getEstimate(d),T()}},t.register((function(){p=M.Z})),a.throttleBitrate.onUpdate(T,{clearSignal:t}),a.limitResolution.onUpdate(T,{clearSignal:t}),E;function T(){E.setValue(w())}function w(){var t=_,l=t.bufferGap,p=t.position,h=t.maximumPosition,m=a.limitResolution.getValue(),b=a.throttleBitrate.getValue(),S=i.getValue(),E=function(e,t,n){var r=e;void 0!==n&&n<1/0&&(r=function(e,t){if(0===e.length)return[];e.sort((function(e,t){return e.bitrate-t.bitrate}));var n=e[0].bitrate,r=Math.max(t,n),i=(0,D.Z)(e,(function(e){return e.bitrate>r}));return-1===i?e:e.slice(0,i)}(r,n));void 0!==t&&(r=function(e,t){if(void 0===t.width||void 0===t.height)return e;var n=t.width*t.pixelRatio,r=t.height*t.pixelRatio,i=e.slice().sort((function(e,t){return(0,C.Z)(e.width,0)-(0,C.Z)(t.width,0)})),a=(0,L.Z)(i,(function(e){return"number"==typeof e.width&&e.width>=n&&"number"==typeof e.height&&e.height>=r}));if(void 0===a)return e;var o="number"==typeof a.width?a.width:0;return e.filter((function(e){return"number"!=typeof e.width||e.width<=o}))}(r,t));return r}(e,m,b),T=v.getRequests(),w=f.getBandwidthEstimate(_,n,S,T,g.bandwidth),k=w.bandwidthEstimate,A=w.bitrateChosen,I=c.getLastStableRepresentation(),R=null===I?void 0:I.bitrate/(_.speed>0?_.speed:1);d&&l<=5?d=!1:!d&&isFinite(l)&&l>10&&(d=!0);var Z=Q(E,A),x=Z.bitrate,P=null;d&&void 0!==o&&o>x&&(x=(P=Q(E,o)).bitrate);var M=null;return u&&null!==S&&r.manifest.isDynamic&&h-p.last<40&&(M=y.getGuess(e,_,S,x,T)),null!==M&&M.bitrate>x?(s.Z.debug("ABR: Choosing representation with guess-based estimation.",M.bitrate,M.id),g.update(M,k,2),{bitrate:k,representation:M,urgent:null===S||M.bitrate<S.bitrate,knownStableBitrate:R}):null!==P?(s.Z.debug("ABR: Choosing representation with buffer-based estimation.",P.bitrate,P.id),g.update(P,k,0),{bitrate:k,representation:P,urgent:f.isUrgent(P.bitrate,S,T,_),knownStableBitrate:R}):(s.Z.debug("ABR: Choosing representation with bandwidth estimation.",Z.bitrate,Z.id),g.update(Z,k,1),{bitrate:k,representation:Z,urgent:f.isUrgent(Z.bitrate,S,T,_),knownStableBitrate:R})}}function _(){var e=d.getValue();m.cancel(),y(e,(m=new E.ZP({cancelOn:t})).signal).onUpdate((function(e){g.setValue(e)}),{clearSignal:m.signal,emitCurrentValue:!0})}function T(e){var t=e.requestDuration,r=e.segmentDuration,i=e.size,a=e.content;if(n.addSample(t,i),!a.segment.isInit){var o=a.segment,s=a.representation;if(void 0===r&&!o.complete)return;var u=null!=r?r:o.duration;c.addSample(s,t/1e3,u)}}function w(e){v.add(e)}function k(e){v.addProgress(e)}function A(e){v.remove(e.id)}}({bandwidthEstimator:c,context:e,currentRepresentation:a,filters:{limitResolution:(0,C.Z)(r.limitResolution[d],$),throttleBitrate:(0,C.Z)(r.throttleBitrate[d],J)},initialBitrate:f,playbackObserver:u,representations:o,lowLatencyMode:i},l)}},te=n(8619),ne=n(9105),re=n(9362);function ie(e){return e instanceof ne.Z?new re.Z("PIPELINE_LOAD_ERROR",e):(0,d.Z)(e,{defaultCode:"PIPELINE_LOAD_ERROR",defaultReason:"Unknown error when fetching the Manifest"})}var ae=n(7839),oe=n(9822),se=n(7864),ue=n(2572);function le(e){return e instanceof ne.Z?e.type===f.br.ERROR_HTTP_CODE?e.status>=500||404===e.status||415===e.status||412===e.status:e.type===f.br.TIMEOUT||e.type===f.br.ERROR_EVENT:e instanceof ae.Z?"boolean"==typeof e.canRetry?e.canRetry:void 0!==e.xhr&&(e.xhr.status>=500||404===e.xhr.status||415===e.xhr.status||412===e.xhr.status):(0,oe.Z)(e)&&"INTEGRITY_ERROR"===e.code}function de(e,t,n,r,i){return ce.apply(this,arguments)}function ce(){return ce=(0,T.Z)(k().mark((function e(t,n,r,i,a){var o,u,l,d,c,f,v,p,h,m,g,y,_;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(_=function(e){var t;if(0===c.size)return e[0];var n=performance.now();return null===(t=e.filter((function(e){var t;return!0!==(null===(t=c.get(e))||void 0===t?void 0:t.isBlacklisted)})).reduce((function(e,t){var r,i=null===(r=c.get(t))||void 0===r?void 0:r.blockedUntil;return void 0!==i&&i<=n&&(i=void 0),void 0===e?[t,i]:void 0===i?void 0===e[1]?e:[t,void 0]:void 0===e[1]?e:i<e[1]?[t,i]:e}),void 0))||void 0===t?void 0:t[0]},y=function(e,t){var r=c.get(e);if(void 0===r||void 0===r.blockedUntil)return p(e);var i=performance.now(),o=r.blockedUntil-i;if(o<=0)return p(e);var s=new E.ZP({cancelOn:a});return new Promise((function(r,i){null==n||n.addEventListener("priorityChange",(function(){var n=v();if(a.isCancelled)throw a.cancellationError;if(void 0===n)return i(t);n!==e&&(s.cancel(),y(n,t).then(r,i))}),s.signal),(0,se.Z)(o,s.signal).then((function(){return p(e).then(r,i)}),M.Z)}))},g=function(){return(g=(0,T.Z)(k().mark((function e(t){var n;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=v(),!a.isCancelled){e.next=3;break}throw a.cancellationError;case 3:if(void 0!==n){e.next=5;break}throw t;case 5:if(d(t),!a.isCancelled){e.next=8;break}throw a.cancellationError;case 8:return e.abrupt("return",y(n,t));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)},m=function(e){return g.apply(this,arguments)},h=function(){return(h=(0,T.Z)(k().mark((function e(t){var i,s,d,f,v;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r(t,a);case 3:return i=e.sent,e.abrupt("return",i);case 7:if(e.prev=7,e.t0=e.catch(0),!E.ZP.isCancellationError(e.t0)){e.next=11;break}throw e.t0;case 11:if(null!==t&&null!==n&&n.downgradeCdn(t),void 0===(s=c.get(t))?(s={errorCounter:1,blockedUntil:void 0,isBlacklisted:!1},c.set(t,s)):s.errorCounter++,le(e.t0)){e.next=18;break}return s.blockedUntil=void 0,s.isBlacklisted=!0,e.abrupt("return",m(e.t0));case 18:return s.errorCounter>l?(s.blockedUntil=void 0,s.isBlacklisted=!0):(d=s.errorCounter,f=Math.min(o*Math.pow(2,d-1),u),v=(0,ue.Z)(f),s.blockedUntil=performance.now()+v),e.abrupt("return",m(e.t0));case 20:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)},p=function(e){return h.apply(this,arguments)},v=function(){if(null===t){var e=c.get(null);if(void 0!==e&&e.isBlacklisted)return;return null}if(null===n)return _(t);var r=n.getCdnPreferenceForResource(t);return _(r)},null===a.cancellationError){e.next=9;break}return e.abrupt("return",Promise.reject(a.cancellationError));case 9:if(o=i.baseDelay,u=i.maxDelay,l=i.maxRetry,d=i.onRetry,null!==t&&0===t.length&&s.Z.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`."),c=new Map,void 0!==(f=v())){e.next=15;break}throw new Error("No CDN to request");case 15:return e.abrupt("return",p(f));case 16:case"end":return e.stop()}}),e)}))),ce.apply(this,arguments)}function fe(e,t,n){return de(null,null,e,t,n)}function ve(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pe(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var he=function(e){function n(t,n,r){var i;return(i=e.call(this)||this).scheduleManualRefresh=M.Z,i._manifestUrls=t,i._pipelines=n.manifest,i._settings=r,i._canceller=new E.ZP,i._isStarted=!1,i._isRefreshPending=!1,i._consecutiveUnsafeMode=0,i._prioritizedContentUrl=null,i}(0,t.Z)(n,e);var r=n.prototype;return r.dispose=function(){this._canceller.cancel(),this.removeEventListener()},r.start=function(){var e=this;if(!this._isStarted){this._isStarted=!0;var t=this._settings.initialManifest;(t instanceof te.ZP?Promise.resolve({manifest:t}):void 0!==t?this.parse(t,{previousManifest:null,unsafeMode:!1},void 0):this._fetchManifest(void 0).then((function(e){return e.parse({previousManifest:null,unsafeMode:!1})}))).then((function(t){e.trigger("manifestReady",t.manifest),e._canceller.isUsed||e._recursivelyRefreshManifest(t.manifest,t)})).catch((function(t){return e._onFatalError(t)}))}},r.updateContentUrls=function(e,t){var n;this._prioritizedContentUrl=null!==(n=null==e?void 0:e[0])&&void 0!==n?n:void 0,t&&this.scheduleManualRefresh({enablePartialRefresh:!1,delay:0,canUseUnsafeMode:!1})},r._fetchManifest=function(){var e=(0,T.Z)(k().mark((function e(t){var n,r,i,a,o,s,u,d,c=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=function(e){var t=a.loadManifest,n=(0,y.Z)(i.requestTimeout)?l.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT:i.requestTimeout;n<0&&(n=void 0);return fe((function(){return t(e,{timeout:n},r)}),s,r)},r=this._canceller.signal,i=this._settings,a=this._pipelines,o=null!=t?t:null===(n=this._manifestUrls)||void 0===n?void 0:n[0],s=this._getBackoffSetting((function(e){c.trigger("warning",ie(e))})),e.prev=6,e.next=9,d(o);case 9:return u=e.sent,e.abrupt("return",{parse:function(e){return c._parseLoadedManifest(u,e,o)}});case 13:throw e.prev=13,e.t0=e.catch(6),ie(e.t0);case 16:case"end":return e.stop()}}),e,this,[[6,13]])})));return function(t){return e.apply(this,arguments)}}(),r.parse=function(e,t,n){return this._parseLoadedManifest({responseData:e,size:void 0,requestDuration:void 0},t,n)},r._parseLoadedManifest=function(){var e=(0,T.Z)(k().mark((function e(t,n,r){var i,a,o,u,l,c,f,v,p,h,m,g,y,_,b,S,E=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(S=function(e){b(e.contentWarnings);var t=performance.now()-a;return s.Z.info("MF: Manifest parsed in "+t+"ms"),{manifest:e,sendingTime:l,receivedTime:c,parsingTime:t}},b=function(e){for(var t,n=ve(e);!(t=n()).done;){var r=t.value;if(o.isCancelled)return;var i=(0,d.Z)(r,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown error when parsing the Manifest"});u("warning",i)}},_=function(){return(_=(0,T.Z)(k().mark((function e(t){var n;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fe(t,f,o);case 3:return n=e.sent,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),ie(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)},y=function(e){return _.apply(this,arguments)},a=performance.now(),o=this._canceller.signal,u=this.trigger.bind(this),l=t.sendingTime,c=t.receivedTime,f=this._getBackoffSetting((function(e){E.trigger("warning",ie(e))})),v=null!=r?r:null===(i=this._manifestUrls)||void 0===i?void 0:i[0],p={externalClockOffset:n.externalClockOffset,unsafeMode:n.unsafeMode,previousManifest:n.previousManifest,originalUrl:v},e.prev=11,h=this._pipelines.parseManifest(t,p,b,o,y),h instanceof Promise){e.next=17;break}return e.abrupt("return",S(h.manifest));case 17:return e.next=19,h;case 19:return m=e.sent,g=m.manifest,e.abrupt("return",S(g));case 22:e.next=28;break;case 24:throw e.prev=24,e.t0=e.catch(11),(0,d.Z)(e.t0,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown error when parsing the Manifest"});case 28:case"end":return e.stop()}}),e,this,[[11,24]])})));return function(t,n,r){return e.apply(this,arguments)}}(),r._getBackoffSetting=function(e){var t=l.Z.getCurrent(),n=t.DEFAULT_MAX_MANIFEST_REQUEST_RETRY,r=t.INITIAL_BACKOFF_DELAY_BASE,i=t.MAX_BACKOFF_DELAY_BASE,a=this._settings,o=a.lowLatencyMode,s=a.maxRetry;return{onRetry:e,baseDelay:o?r.LOW_LATENCY:r.REGULAR,maxDelay:o?i.LOW_LATENCY:i.REGULAR,maxRetry:null!=s?s:n}},r._recursivelyRefreshManifest=function(e,t){var n=this,r=t.sendingTime,i=t.parsingTime,a=t.updatingTime,o=l.Z.getCurrent(),u=o.MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE,d=o.MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE,c=void 0!==i?i+(null!=a?a:0):void 0,f=this._consecutiveUnsafeMode>0?this._consecutiveUnsafeMode<u:void 0!==c&&c>=d,v=void 0===r?0:performance.now()-r,p=Math.max(this._settings.minimumManifestUpdateInterval-v,0),h=new E.ZP({cancelOn:this._canceller.signal});if(this.scheduleManualRefresh=function(t){var i=t.enablePartialRefresh,a=t.delay,o=t.canUseUnsafeMode&&f,s=void 0===r?0:performance.now()-r,u=Math.max(n._settings.minimumManifestUpdateInterval-s,0),l=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:i,unsafeMode:o})}),Math.max((null!=a?a:0)-s,u));h.signal.register((function(){clearTimeout(l)}))},null!==e.expired){var m=setTimeout((function(){var t;null===(t=e.expired)||void 0===t||t.then((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),M.Z)}),p);h.signal.register((function(){clearTimeout(m)}))}if(void 0!==e.lifetime&&e.lifetime>=0){var g,y=1e3*e.lifetime-v;void 0===c?g=y:e.lifetime<3&&c>=100?(g=Math.min(Math.max(3e3-v,Math.max(y,0)+c),6*y),s.Z.info("MUS: Manifest update rythm is too frequent. Postponing next request.",y,g)):c>=1e3*e.lifetime/10?(g=Math.min(Math.max(y,0)+c,6*y),s.Z.info("MUS: Manifest took too long to parse. Postponing next request",g,g)):g=y;var _=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),Math.max(g,p));h.signal.register((function(){clearTimeout(_)}))}},r._triggerNextManifestRefresh=function(e,t){var n,r,i=this,a=t.enablePartialRefresh,o=t.unsafeMode,u=e.updateUrl;null!==this._prioritizedContentUrl?(n=!0,r=this._prioritizedContentUrl,this._prioritizedContentUrl=null):r=(n=!a||void 0===u)?e.getUrls()[0]:u;var d=e.clockOffset;o?(this._consecutiveUnsafeMode+=1,s.Z.info('Init: Refreshing the Manifest in "unsafeMode" for the '+String(this._consecutiveUnsafeMode)+" consecutive time.")):this._consecutiveUnsafeMode>0&&(s.Z.info('Init: Not parsing the Manifest in "unsafeMode" anymore after '+String(this._consecutiveUnsafeMode)+" consecutive times."),this._consecutiveUnsafeMode=0),this._isRefreshPending||(this._isRefreshPending=!0,this._fetchManifest(r).then((function(t){return t.parse({externalClockOffset:d,previousManifest:e,unsafeMode:o})})).then((function(t){i._isRefreshPending=!1;var r=t.manifest,a=t.sendingTime,o=t.parsingTime,u=performance.now();if(n)e.replace(r);else try{e.update(r)}catch(t){var d=t instanceof Error?t.message:"unknown error";s.Z.warn("MUS: Attempt to update Manifest failed: "+d,"Re-downloading the Manifest fully");var c=l.Z.getCurrent().FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY,f=void 0===a?0:performance.now()-a,v=Math.max(i._settings.minimumManifestUpdateInterval-f,0),p=M.Z,h=setTimeout((function(){p(),i._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:!1})}),Math.max(c-f,v));return void(p=i._canceller.signal.register((function(){clearTimeout(h)})))}var m=performance.now()-u;i._recursivelyRefreshManifest(e,{sendingTime:a,parsingTime:o,updatingTime:m})})).catch((function(e){i._isRefreshPending=!1,i._onFatalError(e)})))},r._onFatalError=function(e){this._canceller.isUsed||(this.trigger("error",e),this.dispose())},n}(m.Z);var me=he;function ge(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ye(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ye(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var _e=function(e){function n(t){var n;return(n=e.call(this)||this)._downgradedCdnList={metadata:[],timeouts:[]},t.register((function(){for(var e,t=ge(n._downgradedCdnList.timeouts);!(e=t()).done;){var r=e.value;clearTimeout(r)}n._downgradedCdnList={metadata:[],timeouts:[]}})),n}(0,t.Z)(n,e);var r=n.prototype;return r.getCdnPreferenceForResource=function(e){return e.length<=1?e:this._innerGetCdnPreferenceForResource(e)},r.downgradeCdn=function(e){var t=this,n=be(this._downgradedCdnList.metadata,e);n>=0&&this._removeIndexFromDowngradeList(n);var r=l.Z.getCurrent().DEFAULT_CDN_DOWNGRADE_TIME;this._downgradedCdnList.metadata.push(e);var i=window.setTimeout((function(){var n=be(t._downgradedCdnList.metadata,e);n>=0&&t._removeIndexFromDowngradeList(n),t.trigger("priorityChange",null)}),r);this._downgradedCdnList.timeouts.push(i),this.trigger("priorityChange",null)},r._innerGetCdnPreferenceForResource=function(e){var t=this,n=e.reduce((function(e,n){return t._downgradedCdnList.metadata.some((function(e){return e.id===n.id&&e.baseUrl===n.baseUrl}))?e[1].push(n):e[0].push(n),e}),[[],[]]),r=n[0],i=n[1];return r.concat(i)},r._removeIndexFromDowngradeList=function(e){this._downgradedCdnList.metadata.splice(e,1);var t=this._downgradedCdnList.timeouts.splice(e,1);clearTimeout(t[0])},n}(m.Z);function be(e,t){return 0===e.length?-1:void 0!==t.id?(0,D.Z)(e,(function(e){return e.id===t.id})):(0,D.Z)(e,(function(e){return e.baseUrl===t.baseUrl}))}var Se=n(520),Ee=n(7714),Te=function(){function e(){this._cache=new WeakMap}var t=e.prototype;return t.add=function(e,t){var n=e.representation;e.segment.isInit&&this._cache.set(n,t)},t.get=function(e){var t=e.representation;if(e.segment.isInit){var n=this._cache.get(t);if(void 0!==n)return n}return null},e}(),we=(0,g.Z)();var ke=function(){function e(e){var t=e.prioritySteps;if(this._minPendingPriority=null,this._waitingQueue=[],this._pendingTasks=[],this._prioritySteps=t,this._prioritySteps.high>=this._prioritySteps.low)throw new Error("TP: the max high level priority should be given a lowerpriority number than the min low priority.")}var t=e.prototype;return t.create=function(e,t,n,r){var i,a=this;return new Promise((function(o,s){var u=r.register((function(e){a._endTask(i),s(e)})),l=function(){u(),a._endTask(i)},d=function(e){n.beforeEnded(),l(),o(e)},c=function(e){l(),s(e)};i={hasEnded:!1,priority:t,trigger:function(){if(i.hasEnded)u();else{var e=new E.ZP({cancelOn:r});i.interrupter=e,e.signal.register((function(){i.interrupter=null,r.isCancelled||n.beforeInterrupted()})),a._minPendingPriority=null===a._minPendingPriority?i.priority:Math.min(a._minPendingPriority,i.priority),a._pendingTasks.push(i),i.taskFn(e.signal).then(d).catch((function(t){!r.isCancelled&&e.isUsed&&t instanceof E.FU||c(t)}))}},taskFn:e,interrupter:null},a._canBeStartedNow(i)?(i.trigger(),a._isRunningHighPriorityTasks()&&a._interruptCancellableTasks()):a._waitingQueue.push(i)}))},t._endTask=function(e){e.hasEnded=!0;var t=Ae(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=Ae(e.taskFn,this._pendingTasks);if(n<0)return;this._pendingTasks.splice(n,1),this._pendingTasks.length>0?this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))):this._minPendingPriority=null,this._loopThroughWaitingQueue()}},t.updatePriority=function(e,t){var n=Ae(e,this._waitingQueue);if(n>=0){var r=this._waitingQueue[n];if(r.priority===t)return;if(r.priority=t,!this._canBeStartedNow(r))return;return this._findAndRunWaitingQueueTask(n),void(this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks())}var i=Ae(e,this._pendingTasks);if(i<0)s.Z.warn("TP: request to update the priority of a non-existent task");else{var a=this._pendingTasks[i];if(a.priority!==t){var o=a.priority;a.priority=t,null===this._minPendingPriority||t<this._minPendingPriority?this._minPendingPriority=t:this._minPendingPriority===o&&(1===this._pendingTasks.length?this._minPendingPriority=t:this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority}))),this._loopThroughWaitingQueue()),this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks()}}},t._loopThroughWaitingQueue=function(){var e=this._waitingQueue.reduce((function(e,t){return null===e||e>t.priority?t.priority:e}),null);if(!(null===e||null!==this._minPendingPriority&&this._minPendingPriority<e))for(var t=0;t<this._waitingQueue.length;t++){var n=null===this._minPendingPriority?e:Math.min(this._minPendingPriority,e);this._waitingQueue[t].priority<=n&&(this._findAndRunWaitingQueueTask(t),t--)}},t._interruptCancellableTasks=function(){for(var e=0;e<this._pendingTasks.length;e++){var t=this._pendingTasks[e];if(t.priority>=this._prioritySteps.low)return this._interruptPendingTask(t),this._interruptCancellableTasks()}},t._findAndRunWaitingQueueTask=function(e){return e>=this._waitingQueue.length||e<0?(s.Z.warn("TP : Tried to start a non existing task"),!1):(this._waitingQueue.splice(e,1)[0].trigger(),!0)},t._interruptPendingTask=function(e){var t,n=Ae(e.taskFn,this._pendingTasks);n<0?s.Z.warn("TP: Interrupting a non-existent pending task. Aborting..."):(this._pendingTasks.splice(n,1),this._waitingQueue.push(e),0===this._pendingTasks.length?this._minPendingPriority=null:this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))),null===(t=e.interrupter)||void 0===t||t.cancel())},t._canBeStartedNow=function(e){return null===this._minPendingPriority||e.priority<=this._minPendingPriority},t._isRunningHighPriorityTasks=function(){return null!==this._minPendingPriority&&this._minPendingPriority<=this._prioritySteps.high},e}();function Ae(e,t){return(0,D.Z)(t,(function(t){return t.taskFn===e}))}var Ie=function(){function e(e,t,n){var r=new _e(n),i=l.Z.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new ke({prioritySteps:{high:o,low:a}}),this._cdnPrioritizer=r,this._backoffOptions=t}return e.prototype.createSegmentFetcher=function(e,t){var n,r,i,a,o,u,c,f,v,p,h,m,g=(n=this._backoffOptions,r=n.maxRetry,i=n.lowLatencyMode,a=n.requestTimeout,o=l.Z.getCurrent(),u=o.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,c=o.DEFAULT_REQUEST_TIMEOUT,f=o.INITIAL_BACKOFF_DELAY_BASE,v=o.MAX_BACKOFF_DELAY_BASE,{maxRetry:null!=r?r:u,baseDelay:i?f.LOW_LATENCY:f.REGULAR,maxDelay:i?v.LOW_LATENCY:v.REGULAR,requestTimeout:(0,y.Z)(a)?c:a}),b=function(e,t,n,r,i){var a={timeout:i.requestTimeout<0?void 0:i.requestTimeout},o=(0,Ee.Z)(["audio","video"],e)?new Te:void 0,u=t.loadSegment,l=t.parseSegment;return function(){var e=(0,T.Z)(k().mark((function e(t,c,f){var v,p,h,m,g,b,S,T,w,A,I,R,Z,x,P,M,C,D,N,O,L,U;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(U=function(){var e;Z||!(0,y.Z)(A)&&void 0!==A.size&&void 0!==A.requestDuration&&I.length>0&&I.every((function(e){return e}))&&(Z=!0,null===(e=r.onMetrics)||void 0===e||e.call(r,{size:A.size,requestDuration:A.requestDuration,content:t,segmentDuration:R}))},L=function(e){c.onRetry(ie(e))},O=function(e,t){I.push(!1);var n=I.length-1;return function(r){var i={data:e,isChunked:t};try{var a=l(i,x,r);return I[n]||(R=void 0!==R&&"media"===a.segmentType&&null!==a.chunkInfos&&void 0!==a.chunkInfos.duration?R+a.chunkInfos.duration:void 0,I[n]=!0,U()),a}catch(e){throw(0,d.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown parsing error"})}}},N=function(e){return u(e,x,a,f,P)},h=t.segment,m=t.adaptation,g=t.representation,b=t.manifest,S=t.period,T=(0,Se.K)(t),w=we(),I=[],R=0,Z=!1,x={segment:h,type:m.type,language:m.language,isLive:b.isLive,periodStart:S.start,periodEnd:S.end,mimeType:g.mimeType,codecs:g.codec,manifestPublishTime:b.publishTime},P={onProgress:function(e){var t;void 0===A&&void 0!==e.totalSize&&e.size<e.totalSize&&(null===(t=r.onProgress)||void 0===t||t.call(r,{duration:e.duration,size:e.size,totalSize:e.totalSize,timestamp:performance.now(),id:w}))},onNewChunk:function(e){c.onChunk(O(e,!0))}},null===(M=void 0!==o?o.get(t):null)){e.next=17;break}return s.Z.debug("SF: Found wanted segment in cache",T),c.onChunk(O(M,!1)),e.abrupt("return",Promise.resolve());case 17:return s.Z.debug("SF: Beginning request",T),null===(v=r.onRequestBegin)||void 0===v||v.call(r,{requestTimestamp:performance.now(),id:w,content:t}),f.register((function(){var e;void 0===A&&(s.Z.debug("SF: Segment request cancelled",T),A=null,null===(e=r.onRequestEnd)||void 0===e||e.call(r,{id:w}))})),e.prev=20,e.next=23,de(t.representation.cdnMetadata,n,N,(0,_.Z)({onRetry:L},i),f);case 23:"segment-loaded"===(C=e.sent).resultType?(D=C.resultData.responseData,void 0!==o&&o.add(t,C.resultData.responseData),c.onChunk(O(D,!1))):"segment-created"===C.resultType&&c.onChunk(O(C.resultData,!1)),s.Z.debug("SF: Segment request ended with success",T),c.onAllChunksReceived(),"segment-created"!==C.resultType?(A=C.resultData,U()):A=null,f.isCancelled||null===(p=r.onRequestEnd)||void 0===p||p.call(r,{id:w}),e.next=39;break;case 31:if(e.prev=31,e.t0=e.catch(20),A=null,!(e.t0 instanceof E.FU)){e.next=37;break}throw s.Z.debug("SF: Segment request aborted",T),e.t0;case 37:throw s.Z.debug("SF: Segment request failed",T),ie(e.t0);case 39:case"end":return e.stop()}}),e,null,[[20,31]])})));return function(t,n,r){return e.apply(this,arguments)}}()}(e,this._transport[e],this._cdnPrioritizer,t,g);return p=this._prioritizer,h=b,m=new WeakMap,{createRequest:function(e,t,n,r){var i=function(t){return h(e,n,t)},a=p.create(i,t,n,r);return m.set(a,i),a},updatePriority:function(e,t){var n=m.get(e);void 0!==n?p.updatePriority(n,t):s.Z.warn("Fetchers: Cannot update the priority of a request: task not found.")}}},e}(),Re=Ie,Ze=n(7326);var xe=n(4791),Pe=n(6968),Me=n(2870),Ce=n(9612);var De=function(e){function n(t,n,r){var i;i=e.call(this)||this;var a=r.addSourceBuffer(n);i._canceller=new E.ZP,i.bufferType=t,i._mediaSource=r,i._sourceBuffer=a,i._queue=[],i._pendingTask=null,i._lastInitSegment=null,i.codec=n;var o=i._onPendingTaskError.bind((0,Ze.Z)(i)),s=i._flush.bind((0,Ze.Z)(i)),u=l.Z.getCurrent().SOURCE_BUFFER_FLUSHING_INTERVAL,d=setInterval(s,u);return i._sourceBuffer.addEventListener("error",o),i._sourceBuffer.addEventListener("updateend",s),i._canceller.signal.register((function(){clearInterval(d),i._sourceBuffer.removeEventListener("error",o),i._sourceBuffer.removeEventListener("updateend",s)})),i}(0,t.Z)(n,e);var r=n.prototype;return r.pushChunk=function(e,t){return s.Z.debug("AVSB: receiving order to push data to the SourceBuffer",this.bufferType,(0,Se.K)(e.inventoryInfos)),this._addToQueue({type:Ce.f.Push,value:e},t)},r.removeBuffer=function(e,t,n){return s.Z.debug("AVSB: receiving order to remove data from the SourceBuffer",this.bufferType,e,t),this._addToQueue({type:Ce.f.Remove,value:{start:e,end:t}},n)},r.endOfSegment=function(e,t){return s.Z.debug("AVSB: receiving order for validating end of segment",this.bufferType,(0,Se.K)(e)),this._addToQueue({type:Ce.f.EndOfSegment,value:e},t)},r.getBufferedRanges=function(){return this._sourceBuffer.buffered},r.getPendingOperations=function(){var e=function(e){switch(e.type){case Ce.f.Push:case Ce.f.Remove:case Ce.f.EndOfSegment:return{type:e.type,value:e.value}}},t=this._queue.map(e);return null===this._pendingTask?t:[e(this._pendingTask)].concat(t)},r.dispose=function(){for(this._canceller.cancel(),null!==this._pendingTask&&(this._pendingTask.reject(new E.FU),this._pendingTask=null);this._queue.length>0;){var e=this._queue.shift();void 0!==e&&e.reject(new E.FU)}if("open"===this._mediaSource.readyState)try{this._sourceBuffer.abort()}catch(e){s.Z.warn("AVSB: Failed to abort a "+this.bufferType+" SourceBuffer:",e instanceof Error?e:"")}},r._onPendingTaskError=function(e){if(this._lastInitSegment=null,null!==this._pendingTask){var t=e instanceof Error?e:new Error("An unknown error occured when doing operations on the SourceBuffer");this._pendingTask.reject(t)}},r._addToQueue=function(e,t){var n=this;return new Promise((function(r,i){if(null!==t.cancellationError)return i(t.cancellationError);var a=0===n._queue.length&&null===n._pendingTask,o=(0,_.Z)({resolve:r,reject:i},e);n._queue.push(o),t.register((function(e){var t=n._queue.indexOf(o);t>=0&&n._queue.splice(t,1),o.resolve=M.Z,o.reject=M.Z,i(e)})),a&&n._flush()}))},r._flush=function(){if(!this._sourceBuffer.updating){if(null!==this._pendingTask){var e=this._pendingTask;if(e.type!==Ce.f.Push||0===e.data.length){switch(e.type){case Ce.f.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData);break;case Ce.f.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case Ce.f.Remove:this.synchronizeInventory();break;default:(0,h.Z)(e)}var t=e.resolve;return this._pendingTask=null,t(),void this._flush()}}else{var n=this._queue.shift();if(void 0===n)return;if(n.type!==Ce.f.Push)this._pendingTask=n;else{var r,i=n.value;try{r=this._preparePushOperation(i.data)}catch(e){this._pendingTask=(0,_.Z)({data:[],inventoryData:i.inventoryInfos},n);var a=e instanceof Error?e:new Error("An unknown error occured when preparing a push operation");return this._lastInitSegment=null,void n.reject(a)}this._pendingTask=(0,_.Z)({data:r,inventoryData:i.inventoryInfos},n)}}try{switch(this._pendingTask.type){case Ce.f.EndOfSegment:return s.Z.debug("AVSB: Acknowledging complete segment",(0,Se.K)(this._pendingTask.value)),void this._flush();case Ce.f.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();s.Z.debug("AVSB: pushing segment",this.bufferType,(0,Se.K)(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case Ce.f.Remove:var u=this._pendingTask.value,l=u.start,d=u.end;s.Z.debug("AVSB: removing data from SourceBuffer",this.bufferType,l,d),this._sourceBuffer.remove(l,d);break;default:(0,h.Z)(this._pendingTask)}}catch(e){this._onPendingTaskError(e)}}},r._preparePushOperation=function(e){var t=[],n=e.codec,r=e.timestampOffset,i=e.appendWindow,a=!1;if(void 0!==n&&n!==this.codec&&(s.Z.debug("AVSB: updating codec",n),a=function(e,t){if("function"==typeof e.changeType){try{e.changeType(t)}catch(e){return s.Z.warn("Could not call 'changeType' on the given SourceBuffer:",e instanceof Error?e:""),!1}return!0}return!1}(this._sourceBuffer,n),a?this.codec=n:s.Z.debug("AVSB: could not update codec",n,this.codec)),this._sourceBuffer.timestampOffset!==r){var o=r;s.Z.debug("AVSB: updating timestampOffset",this.bufferType,this._sourceBuffer.timestampOffset,o),this._sourceBuffer.timestampOffset=o}if(void 0===i[0]?this._sourceBuffer.appendWindowStart>0&&(this._sourceBuffer.appendWindowStart=0):i[0]!==this._sourceBuffer.appendWindowStart&&(i[0]>=this._sourceBuffer.appendWindowEnd&&(this._sourceBuffer.appendWindowEnd=i[0]+1),this._sourceBuffer.appendWindowStart=i[0]),void 0===i[1]?this._sourceBuffer.appendWindowEnd!==1/0&&(this._sourceBuffer.appendWindowEnd=1/0):i[1]!==this._sourceBuffer.appendWindowEnd&&(this._sourceBuffer.appendWindowEnd=i[1]),null!==e.initSegment&&(a||!this._isLastInitSegment(e.initSegment))){var u=e.initSegment;t.push(u);var l=(0,Pe._f)(u);this._lastInitSegment={data:l,hash:(0,Me.Z)(l)}}return null!==e.chunk&&t.push(e.chunk),t},r._isLastInitSegment=function(e){if(null===this._lastInitSegment)return!1;if(this._lastInitSegment.data===e)return!0;var t=this._lastInitSegment.data;if(t.byteLength===e.byteLength){var n=(0,Pe._f)(e);if((0,Me.Z)(n)===this._lastInitSegment.hash&&(0,xe.Z)(t,n))return!0}return!1},n}(Ce.C),Ne=["audio","video","text"];function Oe(e){return"audio"===e||"video"===e}var Le=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return Oe(e)};var t=e.prototype;return t.getBufferTypes=function(){var e=this.getNativeBufferTypes();return null==v.Z.nativeTextTracksBuffer&&null==v.Z.htmlTextTracksBuffer||e.push("text"),e},t.getNativeBufferTypes=function(){return"AUDIO"===this._mediaElement.nodeName?["audio"]:["video","audio"]},t.getStatus=function(e){var t=this._initializedSegmentBuffers[e];return void 0===t?{type:"uninitialized"}:null===t?{type:"disabled"}:{type:"initialized",value:t}},t.waitForUsableBuffers=function(e){var t=this;return this._areNativeBuffersUsable()?Promise.resolve():new Promise((function(n,r){var i=function(){t._areNativeBuffersUsable()&&n()};t._onNativeBufferAddedOrDisabled.push(i),e.register((function(e){var n=t._onNativeBufferAddedOrDisabled.indexOf(i);n>=0&&t._onNativeBufferAddedOrDisabled.splice(n,1),r(e)}))}))},t.disableSegmentBuffer=function(t){var n=this._initializedSegmentBuffers[t];if(null!==n){if(void 0!==n)throw new Error("Cannot disable an active SegmentBuffer.");this._initializedSegmentBuffers[t]=null,e.isNative(t)&&this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()}))}else s.Z.warn("SBS: The "+t+" SegmentBuffer was already disabled.")},t.createSegmentBuffer=function(e,t,n){void 0===n&&(n={});var r,i=this._initializedSegmentBuffers[e];if(Oe(e)){if(null!=i)return i instanceof De&&i.codec!==t?s.Z.warn("SB: Reusing native SegmentBuffer with codec",i.codec,"for codec",t):s.Z.info("SB: Reusing native SegmentBuffer with codec",t),i;s.Z.info("SB: Adding native SegmentBuffer with codec",t);var a=new De(e,t,this._mediaSource);return this._initializedSegmentBuffers[e]=a,this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()})),a}if(null!=i)return s.Z.info("SB: Reusing a previous custom SegmentBuffer for the type",e),i;if("text"===e){if(s.Z.info("SB: Creating a new text SegmentBuffer"),"html"===n.textTrackMode){if(null==v.Z.htmlTextTracksBuffer)throw new Error("HTML Text track feature not activated");r=new v.Z.htmlTextTracksBuffer(this._mediaElement,n.textTrackElement)}else{if(null==v.Z.nativeTextTracksBuffer)throw new Error("Native Text track feature not activated");r=new v.Z.nativeTextTracksBuffer(this._mediaElement)}return this._initializedSegmentBuffers.text=r,r}throw s.Z.error("SB: Unknown buffer type:",e),new c.Z("BUFFER_TYPE_UNKNOWN","The player wants to create a SegmentBuffer of an unknown type.")},t.disposeSegmentBuffer=function(e){var t=this._initializedSegmentBuffers[e];null!=t?(s.Z.info("SB: Aborting SegmentBuffer",e),t.dispose(),delete this._initializedSegmentBuffers[e]):s.Z.warn("SB: Trying to dispose a SegmentBuffer that does not exist")},t.disposeAll=function(){var e=this;Ne.forEach((function(t){"initialized"===e.getStatus(t).type&&e.disposeSegmentBuffer(t)}))},t._areNativeBuffersUsable=function(){var e=this,t=this.getNativeBufferTypes();return!t.some((function(t){return void 0===e._initializedSegmentBuffers[t]}))&&!t.every((function(t){return null===e._initializedSegmentBuffers[t]}))},e}(),Ue=n(7473),Be=n.n(Ue),Fe=function(){function e(e){this._array=[],this._sortingFn=e}var t=e.prototype;return t.add=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.sort(this._sortingFn);for(var r=0,i=0;i<t.length;i++){for(var a=t[i],o=!1;!o&&r<this._array.length;)this._sortingFn(a,this._array[r])<0?(this._array.splice(r,0,a),o=!0):r++;o||this._array.push(a)}},t.length=function(){return this._array.length},t.get=function(e){if(e<0||e>=this._array.length)throw new Error("Invalid index.");return this._array[e]},t.toArray=function(){return this._array.slice()},t.findFirst=function(e){return(0,L.Z)(this._array,e)},t.has=function(e){return(0,Ee.Z)(this._array,e)},t.removeElement=function(e){var t=this._array.indexOf(e);if(t>=0)return this._array.splice(t,1),t},t.head=function(){return this._array[0]},t.last=function(){return this._array[this._array.length-1]},t.shift=function(){return this._array.shift()},t.pop=function(){return this._array.pop()},e}(),ze=function(){function e(e){this._weakMap=new WeakMap,this._fn=e}var t=e.prototype;return t.get=function(e){var t=this._weakMap.get(e);if(void 0===t){var n=this._fn(e);return this._weakMap.set(e,n),n}return t},t.destroy=function(e){this._weakMap.delete(e)},e}();function Ve(e,t){var n,r=e.segmentBuffer,i=e.playbackObserver,a=e.maxBufferBehind,o=e.maxBufferAhead;function u(){(function(e,t,n,r,i){return Ke.apply(this,arguments)})(r,n,a.getValue(),o.getValue(),t).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";s.Z.error("Could not run BufferGarbageCollector:",t)}))}i.listen((function(e){var t;n=null!==(t=e.position.pending)&&void 0!==t?t:e.position.last,u()}),{includeLastObservation:!0,clearSignal:t}),a.onUpdate(u,{clearSignal:t}),o.onUpdate(u,{clearSignal:t}),u()}function Ke(){return(Ke=(0,T.Z)(k().mark((function e(t,n,r,i,a){var o,u,l,d,c,f,v,p;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(isFinite(r)||isFinite(i)){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:o=[],u=(0,b.F_)(t.getBufferedRanges(),n),l=u.innerRange,d=u.outerRanges,c=function(){if(isFinite(i)){for(var e=0;e<d.length;e++){var t=d[e];n+i<=t.start?o.push(t):n<=t.start&&n+i<t.end&&n+i>t.start&&o.push({start:n+i,end:t.end})}null!=l&&n+i<l.end&&o.push({start:n+i,end:l.end})}},function(){if(isFinite(r)){for(var e=0;e<d.length;e++){var t=d[e];n-r>=t.end?o.push(t):n>=t.end&&n-r>t.start&&n-r<t.end&&o.push({start:t.start,end:n-r})}null!=l&&n-r>l.start&&o.push({start:l.start,end:n-r})}}(),c(),f=0,v=o;case 9:if(!(f<v.length)){e.next=20;break}if(!((p=v[f]).start<p.end)){e.next=17;break}if(s.Z.debug("GC: cleaning range from SegmentBuffer",p.start,p.end),null===a.cancellationError){e.next=15;break}throw a.cancellationError;case 15:return e.next=17,t.removeBuffer(p.start,p.end,a);case 17:f++,e.next=9;break;case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ge=function(e){function n(t,n,r,i){var a;return(a=e.call(this)||this)._content=t,a._currentCanceller=null,a._downloadQueue=n,a._initSegmentRequest=null,a._mediaSegmentRequest=null,a._segmentFetcher=r,a._initSegmentInfoRef=(0,S.ZP)(void 0),a._mediaSegmentAwaitingInitMetadata=null,i||a._initSegmentInfoRef.setValue(null),a}(0,t.Z)(n,e);var r=n.prototype;return r.getRequestedInitSegment=function(){return null===this._initSegmentRequest?null:this._initSegmentRequest.segment},r.getRequestedMediaSegment=function(){return null===this._mediaSegmentRequest?null:this._mediaSegmentRequest.segment},r.start=function(){var e=this;null===this._currentCanceller&&(this._currentCanceller=new E.ZP,this._downloadQueue.onUpdate((function(t){var n=t.segmentQueue;if(!(n.length>0&&n[0].segment.id===e._mediaSegmentAwaitingInitMetadata)){var r=e._mediaSegmentRequest;if(0===n.length){if(null===r)return;return s.Z.debug("Stream: no more media segment to request. Cancelling queue.",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()}if(null===r)return s.Z.debug("Stream: Media segments now need to be requested. Starting queue.",e._content.adaptation.type,n.length),void e._restartMediaSegmentDownloadingQueue();var i=n[0];return r.segment.id!==i.segment.id?(s.Z.debug("Stream: Next media segment changed, cancelling previous",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()):void(r.priority!==i.priority&&(s.Z.debug("Stream: Priority of next media segment changed, updating",e._content.adaptation.type,r.priority,i.priority),e._segmentFetcher.updatePriority(r.request,i.priority)))}}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}),this._downloadQueue.onUpdate((function(t){var n,r=e._initSegmentRequest;null===t.initSegment||null===r?(null===(n=t.initSegment)||void 0===n?void 0:n.segment.id)!==(null==r?void 0:r.segment.id)&&(null===t.initSegment&&s.Z.debug("Stream: no more init segment to request. Cancelling queue.",e._content.adaptation.type),e._restartInitSegmentDownloadingQueue(t.initSegment)):t.initSegment.priority!==r.priority&&e._segmentFetcher.updatePriority(r.request,t.initSegment.priority)}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}))},r.stop=function(){var e;null===(e=this._currentCanceller)||void 0===e||e.cancel()},r._restartMediaSegmentDownloadingQueue=function(){var e=this;null!==this._mediaSegmentRequest&&this._mediaSegmentRequest.canceller.cancel();!function t(n){var r;if(null!==e._currentCanceller&&e._currentCanceller.isUsed)e._mediaSegmentRequest=null;else{if(void 0===n)return e._mediaSegmentRequest=null,void e.trigger("emptyQueue",null);var i=new E.ZP({cancelOn:null===(r=e._currentCanceller)||void 0===r?void 0:r.signal}),a=n.segment,o=n.priority,u=(0,_.Z)({segment:a},e._content),l=!1,d=!1;i.signal.register((function(){e._mediaSegmentRequest=null,l||(e._mediaSegmentAwaitingInitMetadata===a.id&&(e._mediaSegmentAwaitingInitMetadata=null),l=!0,d=!1)}));var c=function(t){(0,p.Z)("media"===t.segmentType,"Should have loaded a media segment."),e.trigger("parsedMediaSegment",(0,_.Z)({},t,{segment:a}))},f=function(){var n=e._downloadQueue.getValue().segmentQueue;if(0===n.length)return l=!0,void e.trigger("emptyQueue",null);n[0].segment.id===a.id&&n.shift(),l=!0,t(n[0])},v=e._segmentFetcher.createRequest(u,o,{onRetry:function(t){e.trigger("requestRetry",{segment:a,error:t})},beforeInterrupted:function(){s.Z.info("Stream: segment request interrupted temporarly.",a.id,a.time)},onChunk:function(t){var n=e._initSegmentInfoRef.getValue();void 0!==n?c(t(null!=n?n:void 0)):(d=!0,e._initSegmentInfoRef.waitUntilDefined((function(e){c(t(null!=e?e:void 0))}),{clearSignal:i.signal}))},onAllChunksReceived:function(){d?(e._mediaSegmentAwaitingInitMetadata=a.id,e._initSegmentInfoRef.waitUntilDefined((function(){e._mediaSegmentAwaitingInitMetadata=null,d=!1,e.trigger("fullyLoadedSegment",a)}),{clearSignal:i.signal})):e.trigger("fullyLoadedSegment",a)},beforeEnded:function(){e._mediaSegmentRequest=null,d?e._initSegmentInfoRef.waitUntilDefined(f,{clearSignal:i.signal}):f()}},i.signal);v.catch((function(t){l||(l=!0,e.stop(),e.trigger("error",t))})),e._mediaSegmentRequest={segment:a,priority:o,request:v,canceller:i}}}(this._downloadQueue.getValue().segmentQueue[0])},r._restartInitSegmentDownloadingQueue=function(e){var t,n=this;if((null===this._currentCanceller||!this._currentCanceller.isUsed)&&(null!==this._initSegmentRequest&&this._initSegmentRequest.canceller.cancel(),null!==e)){var r=new E.ZP({cancelOn:null===(t=this._currentCanceller)||void 0===t?void 0:t.signal}),i=e.segment,a=e.priority,o=(0,_.Z)({segment:i},this._content),u=!1,l=this._segmentFetcher.createRequest(o,a,{onRetry:function(e){n.trigger("requestRetry",{segment:i,error:e})},beforeInterrupted:function(){s.Z.info("Stream: init segment request interrupted temporarly.",i.id)},beforeEnded:function(){n._initSegmentRequest=null,u=!0},onChunk:function(e){var t,r=e(void 0);(0,p.Z)("init"===r.segmentType,"Should have loaded an init segment."),n.trigger("parsedInitSegment",(0,_.Z)({},r,{segment:i})),"init"===r.segmentType&&n._initSegmentInfoRef.setValue(null!==(t=r.initTimescale)&&void 0!==t?t:null)},onAllChunksReceived:function(){n.trigger("fullyLoadedSegment",i)}},r.signal);l.catch((function(e){u||(u=!0,n.stop(),n.trigger("error",e))})),r.signal.register((function(){n._initSegmentRequest=null,u||(u=!0)})),this._initSegmentRequest={segment:i,priority:a,request:l,canceller:r}}},n}(m.Z);function je(e,t,n,r,i){var a=e.period,o=e.adaptation,u=e.representation,l=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(void 0===r.bufferedStart||void 0===r.bufferedEnd||r.bufferedStart>=t.end)return null;if(r.bufferedEnd>t.start)return n}return null}(i,t);if(null===l){if(null===n){if(r&&void 0!==a.end&&t.end>=a.end)return{start:void 0,end:null};var d=u.index.checkDiscontinuity(t.start);if(null!==d)return{start:void 0,end:d}}return null}var c=i[l];if(void 0!==c.bufferedStart&&c.bufferedStart>t.start&&(null===n||c.infos.segment.end<=n)){var f=c.bufferedStart;return r||!1===u.index.awaitSegmentBetween(t.start,f)?(s.Z.debug("RS: current discontinuity encountered",o.type,c.bufferedStart),{start:void 0,end:f}):null}var v=function(e,t,n){if(n<=0)return s.Z.error("RS: Asked to check a discontinuity before the first chunk."),null;for(var r=n;r<e.length;r++){var i=e[r],a=e[r-1];if(void 0===i.bufferedStart||void 0===a.bufferedEnd||i.bufferedStart>=t.end)return null;if(i.bufferedStart-a.bufferedEnd>0)return r}return null}(i,t,l+1);if(null!==v){var p=i[v-1],h=i[v];if(null===n||h.infos.segment.end<=n){if(!r&&!1!==u.index.awaitSegmentBetween(p.infos.segment.end,h.infos.segment.time))return null;var m=p.bufferedEnd,g=h.bufferedStart;return s.Z.debug("RS: future discontinuity encountered",o.type,m,g),{start:m,end:g}}}if(null===n){if(r&&void 0!==a.end){if(t.end<a.end)return null;var y=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(void 0===r.bufferedStart)return null;if(r.bufferedStart<t)return n}return null}(i,a.end);if(null!==y){var _=i[y];if(void 0!==_.bufferedEnd&&_.bufferedEnd<a.end)return s.Z.debug("RS: discontinuity encountered at the end of the current period",o.type,_.bufferedEnd,a.end),{start:_.bufferedEnd,end:null}}}if(void 0!==a.end&&t.end>=a.end)return null;for(var b=i.length-1;b>=0;b--){var S=i[b];if(void 0===S.bufferedStart)break;if(S.bufferedStart<t.end){if(void 0!==S.bufferedEnd&&S.bufferedEnd<t.end){var E=u.index.checkDiscontinuity(t.end);if(null!==E)return{start:S.bufferedEnd,end:E}}return null}}}return null}function He(e){var t=e.bufferedSegments,n=e.content,r=e.currentPlaybackTime,i=e.fastSwitchThreshold,a=e.getBufferedHistory,o=e.neededRange,u=e.segmentsBeingPushed,d=e.maxBufferSize,c=n.adaptation,f=n.representation,v=function(e,t,n){var r=8e3*n;return r-=t.reduce((function(e,t){return e+t.representation.bitrate*t.segment.duration}),0),e.reduce((function(e,t){return void 0!==t.chunkSize?e-8*t.chunkSize:e}),r)}(t,u,d),p=f.index.getSegments(o.start,o.end-o.start),h=t.filter((function(e){return!qe(e.infos,n,r,i)})).filter((function(e,t,n){var r=0===t?null:n[t-1],i=t>=n.length-1?null:n[t+1],u=null;if(function(e,t,n){var r=l.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedStart)return s.Z.warn("Stream: Start of a segment unknown. Assuming it is garbage collected by default.",e.start),!0;if(null!==t&&void 0!==t.bufferedEnd&&e.bufferedStart-t.bufferedEnd<.1)return!1;if(n<e.bufferedStart&&e.bufferedStart-e.start>r)return s.Z.info("Stream: The start of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,r,o.start)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.start;if(void 0!==t&&void 0!==a&&t-a>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.start;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(u=a(e.infos),e.bufferedStart))return!1;s.Z.debug("Stream: skipping segment gc-ed at the start",e.start,e.bufferedStart)}if(function(e,t,n){var r=l.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedEnd)return s.Z.warn("Stream: End of a segment unknown. Assuming it is garbage collected by default.",e.end),!0;if(null!==t&&void 0!==t.bufferedStart&&t.bufferedStart-e.bufferedEnd<.1)return!1;if(n>e.bufferedEnd&&e.end-e.bufferedEnd>r)return s.Z.info("Stream: The end of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,i,o.end)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.end;if(void 0!==t&&void 0!==a&&a-t>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.end;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(u=null!=u?u:a(e.infos),e.bufferedEnd))return!1;s.Z.debug("Stream: skipping segment gc-ed at the end",e.end,e.bufferedEnd)}return!0})),m=l.Z.getCurrent(),g=m.MINIMUM_SEGMENT_SIZE,y=m.MIN_BUFFER_AHEAD,b=!1,S=Math.min(1/60,g),E=!1,T=[],w=p.filter((function(e){var t=(0,_.Z)({segment:e},n);if(u.length>0&&u.some((function(e){return(0,Se.z)(t,e)})))return!1;var l=e.duration,d=e.time,p=e.end;if(e.isInit)return!0;if(b)return T.push(e),!1;if(e.complete&&l<g)return!1;if(u.length>0&&u.some((function(e){if(e.period.id!==n.period.id||e.adaptation.id!==n.adaptation.id)return!1;var a=e.segment;return!(a.time-S>d)&&(!(a.end+S<p)&&!qe(e,t,r,i))})))return!1;for(var m=0;m<h.length;m++){var w=h[m];if(w.infos.period.id===n.period.id){var k=w.infos.segment;if(d-k.time>-S&&k.end-p>-S)return!1}}var A=l*n.representation.bitrate;if(v-A<0&&(E=!0,d>o.start+y))return b=!0,T.push(e),!1;var I=a(t);if(I.length>1){var R=I[I.length-1],Z=I[I.length-2];if(null===R.buffered&&null===Z.buffered)return s.Z.warn("Stream: Segment GCed multiple times in a row, ignoring it.","If this happens a lot and lead to unpleasant experience, please check your device's available memory. If it's low when this message is emitted, you might want to update the RxPlayer's settings (`maxBufferAhead`, `maxVideoBufferSize` etc.) so less memory is used by regular media data buffering."+c.type,f.id,e.time),!1}for(var x=0;x<h.length;x++){var P=h[x];if(P.end+S>d){var M=P.start>d+S||We(h,x).end<p-S;return M&&(v-=A),M}}return v-=A,!0}));return{segmentsToLoad:w,segmentsOnHold:T,isBufferFull:E}}function We(e,t){for(var n=t+1,r=l.Z.getCurrent().MINIMUM_SEGMENT_SIZE,i=Math.min(1/60,r);n<e.length-1&&e[n-1].end+i>e[n].start;)n++;return e[--n]}function qe(e,t,n,r){var i=l.Z.getCurrent().CONTENT_REPLACEMENT_PADDING;return e.period.id===t.period.id&&(!(e.segment.time<n+i)&&(e.adaptation.id!==t.adaptation.id||function(e,t,n){var r=e.bitrate,i=l.Z.getCurrent().BITRATE_REBUFFERING_RATIO;if(void 0===n){var a=r*i;return t.bitrate>a}return r<n&&t.bitrate>r}(e.representation,t.representation,r)))}function Ye(e,t){for(var n=e-t,r=l.Z.getCurrent().SEGMENT_PRIORITIES_STEPS,i=0;i<r.length;i++)if(n<r[i])return i;return r.length}function Xe(e,t,n,r,i,a,o){o.synchronizeInventory();var s=e.representation,u=n.getIsPaused()||n.getPlaybackRate()<=0?t-.1:t,d=function(e,t,n){var r,i,a=e.manifest,o=e.period,s=e.representation,u=s.index.getLastAvailablePosition(),l=s.index;i=!(0,y.Z)(u)&&t>=u&&l.isInitialized()&&l.isFinished()&&function(e,t,n){var r;return t.containsTime(n)&&e.isLastPeriodKnown&&t.id===(null===(r=e.periods[e.periods.length-1])||void 0===r?void 0:r.id)}(a,o,t)?u-1:t-.1;var d,c=i+n;d=!(!s.index.isInitialized()||!s.index.isFinished()||void 0===o.end)&&(void 0===u?c>=o.end:null===u||c>=u);return{start:Math.max(i,o.start),end:Math.min(c,null!==(r=o.end)&&void 0!==r?r:1/0),hasReachedPeriodEnd:d}}(e,u,i),c=s.index.shouldRefresh(d.start,d.end),f=o.getPendingOperations().filter((function(e){return e.type===Ce.f.EndOfSegment})).map((function(e){return e.value})),v=function(e,t){for(var n=l.Z.getCurrent().MINIMUM_SEGMENT_SIZE,r=Math.max(1/60,n),i=e.start+r,a=e.end-r,o=[],s=t.length-1;s>=0;s--){var u=t[s],d=u.infos.representation;if(!u.partiallyPushed&&!1!==d.decipherable&&d.isSupported){var c=u.infos.segment,f=c.time/c.timescale;((c.complete?f+c.duration/c.timescale:u.end)>i&&f<a||u.end>i&&u.start<a)&&o.unshift(u)}}return o}({start:Math.max(d.start-.5,0),end:d.end+.5},o.getInventory()),p=He({content:e,bufferedSegments:v,currentPlaybackTime:n.getCurrentTime(),fastSwitchThreshold:r,getBufferedHistory:o.getSegmentHistory.bind(o),neededRange:d,segmentsBeingPushed:f,maxBufferSize:a}),h=p.segmentsToLoad,m=p.segmentsOnHold,g=p.isBufferFull,_=h.map((function(e){return{priority:Ye(e.time,u),segment:e}})),b=s.index.isInitialized()&&s.index.isFinished()&&d.hasReachedPeriodEnd&&0===_.length&&0===m.length,S=null;return f.length>0&&(S=Math.min.apply(Math,f.map((function(e){return e.segment.time})))),m.length>0&&(S=null!==S?Math.min(S,m[0].time):m[0].time),_.length>0&&(S=null!==S?Math.min(S,_[0].segment.time):_[0].segment.time),{imminentDiscontinuity:je(e,d,S,b,v),hasFinishedLoading:b,neededSegments:_,isBufferFull:g,shouldRefreshManifest:c}}function Qe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return $e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $e(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function $e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Je(e,t,n){return et.apply(this,arguments)}function et(){return(et=(0,T.Z)(k().mark((function e(t,n,r){var i,a,o,u,d,c,f,v,p;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=l.Z.getCurrent().BUFFER_GC_GAPS.CALM,a=l.Z.getCurrent().BUFFER_GC_GAPS.BEEFY,s.Z.warn("Stream: Running garbage collector"),o=n.getBufferedRanges(),0===(u=tt(t,o,i)).length&&(u=tt(t,o,a)),s.Z.hasLevel("DEBUG")&&s.Z.debug("Stream: GC cleaning",u.map((function(e){return"start: "+e.start+" - end "+e.end})).join(", ")),d=Qe(u);case 8:if((c=d()).done){e.next=16;break}if(f=c.value,v=f.start,p=f.end,!(v<p)){e.next=14;break}return e.next=14,n.removeBuffer(v,p,r);case 14:e.next=8;break;case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function tt(e,t,n){for(var r=(0,b.F_)(t,e),i=r.innerRange,a=r.outerRanges,o=[],u=0;u<a.length;u++){var l=a[u];(e-n>l.end||e+n<l.start)&&o.push(l)}return null!==i&&(s.Z.hasLevel("DEBUG")&&s.Z.debug("Stream: GC removing part of inner range",o.map((function(e){return"start: "+e.start+" - end "+e.end})).join(", ")),e-n>i.start&&o.push({start:i.start,end:e-n}),e+n<i.end&&o.push({start:e+n,end:i.end})),o}function nt(e,t,n,r){return rt.apply(this,arguments)}function rt(){return(rt=(0,T.Z)(k().mark((function e(t,n,r,i){var a,o,s,u,l,d;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n.pushChunk(r,i);case 3:case 21:e.next=27;break;case 5:if(e.prev=5,e.t0=e.catch(0),!(i.isCancelled&&e.t0 instanceof E.FU)){e.next=11;break}throw e.t0;case 11:if(e.t0 instanceof Error&&"QuotaExceededError"===e.t0.name){e.next=14;break}throw o=e.t0 instanceof Error?e.t0.toString():"An unknown error happened when pushing content",new c.Z("BUFFER_APPEND_ERROR",o);case 14:return s=t.getReference().getValue(),u=s.position,l=null!==(a=u.pending)&&void 0!==a?a:u.last,e.prev=16,e.next=19,Je(l,n,i);case 19:return e.next=21,n.pushChunk(r,i);case 23:throw e.prev=23,e.t1=e.catch(16),d=e.t1 instanceof Error?e.t1.toString():"Could not clean the buffer",new c.Z("BUFFER_FULL_ERROR",d);case 27:case"end":return e.stop()}}),e,null,[[0,5],[16,23]])})))).apply(this,arguments)}function it(){return it=(0,T.Z)(k().mark((function e(t,n){var r,i,a,o,s,u,l,d;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.playbackObserver,i=t.content,a=t.segment,o=t.segmentData,s=t.segmentBuffer,null!==o){e.next=3;break}return e.abrupt("return",null);case 3:if(null===n.cancellationError){e.next=5;break}throw n.cancellationError;case 5:return u=i.representation.getMimeTypeString(),l={initSegment:o,chunk:null,timestampOffset:0,appendWindow:[void 0,void 0],codec:u},e.next=9,nt(r,s,{data:l,inventoryInfos:null},n);case 9:return d=s.getBufferedRanges(),e.abrupt("return",{content:i,segment:a,buffered:d,segmentData:o});case 11:case"end":return e.stop()}}),e)}))),it.apply(this,arguments)}function at(){return at=(0,T.Z)(k().mark((function e(t,n){var r,i,a,o,s,u,d,c,f,v,p,h,m,g,y,b,S,E,T,w,A,I,R;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.playbackObserver,i=t.content,a=t.initSegmentData,o=t.parsedSegment,s=t.segment,u=t.segmentBuffer,null!==o.chunkData){e.next=3;break}return e.abrupt("return",null);case 3:if(null===n.cancellationError){e.next=5;break}throw n.cancellationError;case 5:return f=o.chunkData,v=o.chunkInfos,p=o.chunkOffset,h=o.chunkSize,m=o.appendWindow,g=i.representation.getMimeTypeString(),y=l.Z.getCurrent(),b=y.APPEND_WINDOW_SECURITIES,S=[void 0!==m[0]?Math.max(0,m[0]-b.START):void 0,void 0!==m[1]?m[1]+b.END:void 0],E={initSegment:a,chunk:f,timestampOffset:p,appendWindow:S,codec:g},T=null!==(d=null==v?void 0:v.time)&&void 0!==d?d:s.time,w=null!==(c=null==v?void 0:v.duration)&&void 0!==c?c:s.duration,A=T+w,void 0!==S[0]&&(T=Math.max(T,S[0])),void 0!==S[1]&&(A=Math.min(A,S[1])),I=(0,_.Z)({segment:s,chunkSize:h,start:T,end:A},i),e.next=18,nt(r,u,{data:E,inventoryInfos:I},n);case 18:return R=u.getBufferedRanges(),e.abrupt("return",{content:i,segment:s,buffered:R,segmentData:f});case 20:case"end":return e.stop()}}),e)}))),at.apply(this,arguments)}function ot(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return st(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return st(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function st(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ut=function(e,t,n){var r=e.content,i=e.options,a=e.playbackObserver,o=e.segmentBuffer,u=e.segmentFetcher,d=e.terminate,c=r.period,f=r.adaptation,v=r.representation,p=i.bufferGoal,h=i.maxBufferSize,m=i.drmSystemId,g=i.fastSwitchThreshold,y=f.type,b=new E.ZP({cancelOn:n}),T=new E.ZP({cancelOn:b.signal}),w={segment:v.index.getInitSegment(),segmentData:null,isLoaded:!1},k=(0,S.$l)({initSegment:null,segmentQueue:[]},T.signal),A=null!==w.segment;A||(w.segmentData=null,w.isLoaded=!0);var I=!1;if(void 0!==m){var R=v.getEncryptionData(m);if(R.length>0&&R.every((function(e){return void 0!==e.keyIds}))&&(I=!0,t.encryptionDataEncountered(R.map((function(e){return(0,_.Z)({content:r},e)}))),b.isUsed))return}var Z=new Ge(r,k,u,A);return Z.addEventListener("error",(function(e){T.signal.isCancelled||(b.cancel(),t.error(e))})),Z.addEventListener("parsedInitSegment",P),Z.addEventListener("parsedMediaSegment",P),Z.addEventListener("emptyQueue",x),Z.addEventListener("requestRetry",(function(e){if(t.warning(e.error),!T.signal.isCancelled){var n=e.segment,r=v.index;!1===r.isSegmentStillAvailable(n)?x():r.canBeOutOfSyncError(e.error,n)&&t.manifestMightBeOufOfSync()}})),Z.addEventListener("fullyLoadedSegment",(function(e){o.endOfSegment((0,_.Z)({segment:e},r),b.signal).catch(M)})),Z.start(),T.signal.register((function(){Z.removeEventListener(),Z.stop()})),a.listen(x,{includeLastObservation:!1,clearSignal:T.signal}),p.onUpdate(x,{emitCurrentValue:!1,clearSignal:T.signal}),h.onUpdate(x,{emitCurrentValue:!1,clearSignal:T.signal}),d.onUpdate(x,{emitCurrentValue:!1,clearSignal:T.signal}),void x();function x(){var e,n;if(!T.isUsed){var i=a.getReference().getValue(),u=null!==(e=i.position.pending)&&void 0!==e?e:i.position.last,f=Xe(r,u,a,g.getValue(),p.getValue(),h.getValue(),o),m=f.neededSegments,_=null;if(v.index.isInitialized()){if(m.length>0&&!w.isLoaded&&null!==w.segment){var b=m[0].priority;_={segment:w.segment,priority:b}}}else if(null===w.segment)s.Z.warn("Stream: Uninitialized index without an initialization segment");else if(w.isLoaded)s.Z.warn("Stream: Uninitialized index with an already loaded initialization segment");else{var S=null!==(n=i.position.pending)&&void 0!==n?n:i.position.last;_={segment:w.segment,priority:Ye(c.start,S)}}var E=d.getValue();if(null===E)k.setValue({initSegment:_,segmentQueue:m});else{if(E.urgent)return s.Z.debug("Stream: Urgent switch, terminate now.",y),k.setValue({initSegment:null,segmentQueue:[]}),k.finish(),T.cancel(),void t.terminating();var A=m[0],I=Z.getRequestedInitSegment(),R=Z.getRequestedMediaSegment(),x=null===R||void 0===A||R.id!==A.segment.id?[]:[A],P=null===I?null:_;if(k.setValue({initSegment:P,segmentQueue:x}),0===x.length&&null===P)return s.Z.debug("Stream: No request left, terminate",y),k.finish(),T.cancel(),void t.terminating()}if(t.streamStatusUpdate({period:c,position:i.position.last,bufferType:y,imminentDiscontinuity:f.imminentDiscontinuity,isEmptyStream:!1,hasFinishedLoading:f.hasFinishedLoading,neededSegments:f.neededSegments}),!T.signal.isCancelled){var C=l.Z.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;if(f.isBufferFull){var D=Math.max(0,u-C);D>0&&o.removeBuffer(0,D,T.signal).catch(M)}f.shouldRefreshManifest&&t.needsManifestRefresh()}}}function P(e){if(!b.isUsed){for(var n,i=ot(e.protectionData);!(n=i()).done;){var s=n.value;v.addProtectionData(s.initDataType,s.keyId,s.initData)}if(!I){var u=v.getAllEncryptionData();if(u.length>0&&(t.encryptionDataEncountered(u.map((function(e){return(0,_.Z)({content:r},e)}))),I=!0,b.isUsed))return}if("init"===e.segmentType)return v.index.isInitialized()||void 0===e.segmentList||v.index.initialize(e.segmentList),w.segmentData=e.initializationData,w.isLoaded=!0,function(e,t){return it.apply(this,arguments)}({playbackObserver:a,content:r,segment:e.segment,segmentData:e.initializationData,segmentBuffer:o},b.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(M),void x();var l=e.inbandEvents,d=e.predictedSegments,c=e.needsManifestRefresh;if(!(void 0!==d&&v.index.addPredictedSegments(d,e.segment),!0===c&&(t.needsManifestRefresh(),b.isUsed)||void 0!==l&&l.length>0&&(t.inbandEvent(l),b.isUsed))){var f=w.segmentData;(function(e,t){return at.apply(this,arguments)})({playbackObserver:a,content:r,initSegmentData:f,parsedSegment:e,segment:e.segment,segmentBuffer:o},b.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(M)}}}function M(e){b.isUsed&&e instanceof E.FU||(b.cancel(),t.error(e))}};function lt(e,t,n,r,i){i.isCancelled||Be()((function(){e.listen((function(i){var a,o,s,u=e.getCurrentTime()+n;u=Math.min(Math.max(null!==(a=r.start)&&void 0!==a?a:0,u),null!==(o=r.end)&&void 0!==o?o:1/0);var l=!(null!==(s=i.paused.pending)&&void 0!==s?s:e.getIsPaused());t({position:u,autoPlay:l})}),{includeLastObservation:!0,clearSignal:i})}))}function dt(e,t){for(var n=0;n<e.length;n++)if(e[n].infos.period.start>=t.start)return n>0?e[n-1]:null;return e.length>0?e[e.length-1]:null}function ct(e,t){for(var n=0;n<e.length;n++)if(e[n].infos.period.start>t.start)return e[n];return null}function ft(e,t,n,r,i){if("lazy"===n.switchingMode)return{type:"continue",value:void 0};var a=r.getBufferedRanges();if(0===a.length)return{type:"continue",value:void 0};var o=(0,b.JN)(a),s=e.start,u=null==e.end?1/0:e.end,d=(0,b.tn)(o,[{start:s,end:u}]);if(0===d.length)return{type:"continue",value:void 0};r.synchronizeInventory();var c=r.getInventory(),f=function(e,t,n,r){return e.reduce((function(e,i){if(i.infos.period.id!==t.id||i.infos.adaptation.id!==n.id||!r.some((function(e){return e.id===i.infos.representation.id})))return e;var a=i.bufferedStart,o=i.bufferedEnd;return void 0===a||void 0===o||e.push({start:a,end:o}),e}),[])}(c,e,t,n.representations),v=(0,b.uH)(d,f);if(0===v.length)return{type:"continue",value:void 0};var p=i.getCurrentTime(),h=i.getReadyState();if("reload"===n.switchingMode&&(0,b.Ti)({start:s,end:u},p)&&h>1&&!(0,b.A1)(f,p))return{type:"needs-reload",value:void 0};var m="direct"===n.switchingMode,g=[],y=dt(c,e);if(null!==y&&(void 0===y.bufferedEnd||e.start-y.bufferedEnd<1)&&g.push({start:0,end:e.start+1}),!m){var _=l.Z.getCurrent().ADAP_REP_SWITCH_BUFFER_PADDINGS,S=t.type,E=_[S].before;null==E&&(E=0);var T=_[S].after;null==T&&(T=0),g.push({start:p-E,end:p+T})}if(void 0!==e.end){var w=ct(c,e);null!==w&&(void 0===w.bufferedStart||w.bufferedStart-e.end<1)&&g.push({start:e.end-1,end:Number.MAX_VALUE})}var k=(0,b.uH)(v,g);return 0===k.length?{type:"continue",value:void 0}:m?{type:"flush-buffer",value:k}:{type:"clean-buffer",value:k}}function vt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return pt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function pt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ht=function(e,t,n){var r,i,a=e.playbackObserver,o=e.content,u=e.options,c=e.representationEstimator,f=e.segmentBuffer,v=e.segmentFetcherCreator,p=e.wantedBufferAhead,m=e.maxVideoBufferSize,g=o.manifest,y=o.period,b=o.adaptation,w=new E.ZP({cancelOn:n}),A=new Map,I=(0,S.$l)(null,w.signal),R=(0,S.$l)(o.representations.getValue().representations,w.signal),Z=c({manifest:g,period:y,adaptation:b},I,R,a,w.signal),x=Z.estimates,P=Z.callbacks,M=v.createSegmentFetcher(b.type,{onRequestBegin:P.requestBegin,onRequestEnd:P.requestEnd,onProgress:P.requestProgress,onMetrics:P.metrics}),C=(0,S.$l)(0);return x.onUpdate((function(e){var n=e.bitrate,i=e.knownStableBitrate;u.enableFastSwitching&&C.setValueIfChanged(i),void 0!==n&&n!==r&&(r=n,s.Z.debug("Stream: new "+b.type+" bitrate estimate",n),t.bitrateEstimateChange({type:b.type,bitrate:n}))}),{emitCurrentValue:!0,clearSignal:w.signal}),void o.representations.onUpdate((function(e){void 0!==i&&i.cancel(),R.setValueIfChanged(e.representations),function(e,t){return D.apply(this,arguments)}(e,(i=new E.ZP({cancelOn:w.signal})).signal).catch((function(e){!0===(null==i?void 0:i.isUsed)&&E.ZP.isCancellationError(e)||(w.cancel(),t.error(e))}))}),{clearSignal:w.signal,emitCurrentValue:!0});function D(){return(D=(0,T.Z)(k().mark((function e(n,r){var i,o,s,u,d,c,v;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=ft(y,b,n,f,a),e.t0=i.type,e.next="continue"===e.t0?4:"needs-reload"===e.t0?5:"flush-buffer"===e.t0||"clean-buffer"===e.t0?8:22;break;case 4:return e.abrupt("break",23);case 5:return o=l.Z.getCurrent(),s=o.DELTA_POSITION_AFTER_RELOAD,u=b.type,e.abrupt("return",lt(a,(function(e){var n=e.position,r=e.autoPlay;t.waitingMediaSourceReload({bufferType:u,period:y,position:n,autoPlay:r})}),s.bitrateSwitch,y,r));case 8:d=vt(i.value);case 9:if((c=d()).done){e.next=17;break}return v=c.value,e.next=13,f.removeBuffer(v.start,v.end,r);case 13:if(!r.isCancelled){e.next=15;break}return e.abrupt("return");case 15:e.next=9;break;case 17:if("flush-buffer"!==i.type){e.next=21;break}if(t.needsBufferFlush(),!r.isCancelled){e.next=21;break}return e.abrupt("return");case 21:return e.abrupt("break",23);case 22:(0,h.Z)(i);case 23:N(r);case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(e){var n=new E.ZP({cancelOn:e}),r=x.getValue().representation;if(null!==r){var i=(0,S.$l)(null,n.signal);x.onUpdate((function(e){if(null!==e.representation&&e.representation.id!==r.id)return e.urgent?(s.Z.info("Stream: urgent Representation switch",b.type),i.setValue({urgent:!0})):(s.Z.info("Stream: slow Representation switch",b.type),i.setValue({urgent:!1}))}),{clearSignal:n.signal,emitCurrentValue:!0});var a={type:b.type,period:y,representation:r};if(I.setValue(r),!w.isUsed&&(t.representationChange(a),!w.isUsed)){var o={streamStatusUpdate:t.streamStatusUpdate,encryptionDataEncountered:t.encryptionDataEncountered,manifestMightBeOufOfSync:t.manifestMightBeOufOfSync,needsManifestRefresh:t.needsManifestRefresh,inbandEvent:t.inbandEvent,warning:t.warning,error:function(e){w.cancel(),t.error(e)},addedSegment:function(e){P.addedSegment(e),w.isUsed||t.addedSegment(e)},terminating:function(){if(!n.isUsed)return n.cancel(),N(e)}};O(r,i,o,e)}}}function O(e,n,r,i){var o=new E.ZP({cancelOn:i}),l=(0,S.lR)(p,(function(t){return t*function(e){var t=A.get(e.id),n=void 0!==t?t:1;void 0===t&&A.set(e.id,n);return n}(e)}),o.signal),c="video"===b.type?m:(0,S.$l)(1/0);s.Z.info("Stream: changing representation",b.type,e.id,e.bitrate);var v=(0,_.Z)({},r,{error:function(t){var a,o=(0,d.Z)(t,{defaultCode:"NONE",defaultReason:"Unknown `RepresentationStream` error"});if("BUFFER_FULL_ERROR"===o.code){var s=p.getValue(),u=null!==(a=A.get(e.id))&&void 0!==a?a:1;if(u<=.25||s*u<=2)throw o;return A.set(e.id,u-.25),O(e,n,r,i)}r.error(t)},terminating:function(){o.cancel(),r.terminating()}});ut({playbackObserver:a,content:{representation:e,adaptation:b,period:y,manifest:g},segmentBuffer:f,segmentFetcher:M,terminate:n,options:{bufferGoal:l,maxBufferSize:c,drmSystemId:u.drmSystemId,fastSwitchThreshold:C}},v,i),g.addEventListener("manifestUpdate",(function(e){for(var n,r=vt(e.updatedPeriods);!(n=r()).done;){var o=n.value;if(o.period.id===y.id)for(var s,u=vt(o.result.removedAdaptations);!(s=u()).done;){if(s.value.id===b.id){var l=function(){var e=b.type;return{v:lt(a,(function(n){var r=n.position,i=n.autoPlay;t.waitingMediaSourceReload({bufferType:e,period:y,position:r,autoPlay:i})}),0,y,i)}}();if("object"==typeof l)return l.v}}else if(o.period.start>y.start)break}}),i)}},mt=n(9252);var gt=function(e,t){var n=e.split(";"),r=n[0],i=n.slice(1),a=t.split(";"),o=a[0],s=a.slice(1);if(r!==o)return!1;var u=(0,L.Z)(i,(function(e){return(0,mt.Z)(e,"codecs=")})),l=(0,L.Z)(s,(function(e){return(0,mt.Z)(e,"codecs=")}));if(void 0===u||void 0===l)return!1;var d=u.substring(7),c=l.substring(7);return d.split(".")[0]===c.split(".")[0]};function yt(e,t,n,r,i,a){if(void 0!==e.codec&&"reload"===a.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return gt(e.getMimeTypeString(),t)}))}(n,e.codec))return{type:"needs-reload",value:void 0};var o=e.getBufferedRanges();if(0===o.length)return{type:"continue",value:void 0};var s=(0,b.JN)(o),u=t.start,d=null==t.end?1/0:t.end,c=(0,b.tn)(s,[{start:u,end:d}]);if(0===c.length)return{type:"continue",value:void 0};e.synchronizeInventory();var f=e.getInventory();if(!f.some((function(e){return e.infos.period.id===t.id&&e.infos.adaptation.id!==n.id})))return{type:"continue",value:void 0};var v=function(e,t,n){return e.reduce((function(e,r){if(r.infos.period.id!==t.id||r.infos.adaptation.id!==n.id)return e;var i=r.bufferedStart,a=r.bufferedEnd;return void 0===i||void 0===a||e.push({start:i,end:a}),e}),[])}(f,t,n),p=(0,b.uH)(c,v);if(0===p.length)return{type:"continue",value:void 0};var h=i.currentTime;if("reload"===r&&(0,b.Ti)({start:u,end:d},h)&&(i.readyState>1||!n.getPlayableRepresentations().some((function(t){var n;return gt(t.getMimeTypeString(),null!==(n=e.codec)&&void 0!==n?n:"")})))&&!(0,b.A1)(v,h))return{type:"needs-reload",value:void 0};var m="direct"===r,g=[],y=dt(f,t);null!==y&&(void 0===y.bufferedEnd||t.start-y.bufferedEnd<1)&&g.push({start:0,end:t.start+1});var _=n.type,S=l.Z.getCurrent().ADAP_REP_SWITCH_BUFFER_PADDINGS,E=S[_].before;null==E&&(E=0);var T=S[_].after;if(null==T&&(T=0),m||g.push({start:h-E,end:h+T}),void 0!==t.end){var w=ct(f,t);null!==w&&(void 0===w.bufferedStart||w.bufferedStart-t.end<1)&&g.push({start:t.end-1,end:Number.MAX_VALUE})}var k=(0,b.uH)(p,g);return 0===k.length?{type:"continue",value:void 0}:m&&"text"!==n.type?{type:"flush-buffer",value:k}:{type:"clean-buffer",value:k}}function _t(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function St(e,t,n,r){var i=e.getStatus(t);if("initialized"===i.type)return s.Z.info("Stream: Reusing a previous SegmentBuffer for the type",t),i.value;var a=function(e){var t=e.getPlayableRepresentations();if(0===t.length){throw new c.Z("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+e.type+" Adaptation can be played")}return t[0].getMimeTypeString()}(n),o="text"===t?r.textTrackOptions:void 0;return e.createSegmentBuffer(t,a,o)}function Et(e,t,n,r,i,a){var o=r.period,u=!1;function l(){var r=e.getReference().getValue(),a=t.getValue(),l=r.position.last;void 0!==o.end&&l+a>=o.end&&(s.Z.debug('Stream: full "empty" AdaptationStream',n),u=!0),i.streamStatusUpdate({period:o,bufferType:n,position:l,imminentDiscontinuity:null,isEmptyStream:!0,hasFinishedLoading:u,neededSegments:[]})}t.onUpdate(l,{emitCurrentValue:!1,clearSignal:a}),e.listen(l,{includeLastObservation:!1,clearSignal:a}),l()}var Tt=function(e,t,n){var r=e.bufferType,i=e.content,a=e.garbageCollectors,o=e.playbackObserver,u=e.representationEstimator,c=e.segmentFetcherCreator,f=e.segmentBuffersStore,v=e.options,p=e.wantedBufferAhead,h=e.maxVideoBufferSize,m=i.manifest,g=i.period,y=(0,S.ZP)(void 0,n);if(t.periodStreamReady({type:r,manifest:m,period:g,adaptationRef:y}),!n.isCancelled){var w,A=!0;y.onUpdate((function(e){(0,T.Z)(k().mark((function i(){var u,d,c,h,y,_,b,S,T,R,Z,x,P,M,C,D,N,O;return k().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(void 0!==e){i.next=2;break}return i.abrupt("return");case 2:if(d=new E.ZP({cancelOn:n}),null==w||w.cancel(),w=d,null!==e){i.next=33;break}if(s.Z.info("Stream: Set no "+r+" Adaptation. P:",g.start),"initialized"!==(c=f.getStatus(r)).type){i.next=25;break}if(s.Z.info("Stream: Clearing previous "+r+" SegmentBuffer"),!Le.isNative(r)){i.next=14;break}return i.abrupt("return",lt(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),0,g,d.signal));case 14:if(h=null!==(u=g.end)&&void 0!==u?u:1/0,!(g.start>h)){i.next=19;break}s.Z.warn("Stream: Can't free buffer: period's start is after its end"),i.next=23;break;case 19:return i.next=21,c.value.removeBuffer(g.start,h,d.signal);case 21:if(!d.isUsed){i.next=23;break}return i.abrupt("return");case 23:i.next=29;break;case 25:if("uninitialized"!==c.type){i.next=29;break}if(f.disableSegmentBuffer(r),!d.isUsed){i.next=29;break}return i.abrupt("return");case 29:if(t.adaptationChange({type:r,adaptation:null,period:g}),!d.isUsed){i.next=32;break}return i.abrupt("return");case 32:return i.abrupt("return",Et(o,p,r,{period:g},t,d.signal));case 33:if(y=l.Z.getCurrent(),_=y.DELTA_POSITION_AFTER_RELOAD,b=A?0:"audio"===r?_.trackSwitch.audio:"video"===r?_.trackSwitch.video:_.trackSwitch.other,A=!1,!Le.isNative(r)||"disabled"!==f.getStatus(r).type){i.next=38;break}return i.abrupt("return",lt(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),b,g,d.signal));case 38:if(m.addEventListener("manifestUpdate",(function(e){for(var n,i=_t(e.updatedPeriods);!(n=i()).done;){var a=n.value;if(a.period.id===g.id)for(var s,u=_t(a.result.removedAdaptations);!(s=u()).done;){if(s.value.id===S.id)return lt(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),b,g,d.signal)}else if(a.period.start>g.start)break}}),w.signal),S=e.adaptation,T=e.representations,s.Z.info("Stream: Updating "+r+" adaptation","A: "+S.id,"P: "+g.start),t.adaptationChange({type:r,adaptation:S,period:g}),!d.isUsed){i.next=44;break}return i.abrupt("return");case 44:if(R=o.getReadyState(),Z=St(f,r,S,v),x={currentTime:o.getCurrentTime(),readyState:R},"needs-reload"!==(P=yt(Z,g,S,e.switchingMode,x,v)).type){i.next=50;break}return i.abrupt("return",lt(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),b,g,d.signal));case 50:return i.next=52,f.waitForUsableBuffers(d.signal);case 52:if(!d.isUsed){i.next=54;break}return i.abrupt("return");case 54:if("flush-buffer"!==P.type&&"clean-buffer"!==P.type){i.next=68;break}M=_t(P.value);case 56:if((C=M()).done){i.next=64;break}return D=C.value,N=D.start,O=D.end,i.next=60,Z.removeBuffer(N,O,d.signal);case 60:if(!d.isUsed){i.next=62;break}return i.abrupt("return");case 62:i.next=56;break;case 64:if("flush-buffer"!==P.type){i.next=68;break}if(t.needsBufferFlush(),!d.isUsed){i.next=68;break}return i.abrupt("return");case 68:a.get(Z)(d.signal),I(S,T,Z,d.signal);case 70:case"end":return i.stop()}}),i)})))().catch((function(e){e instanceof E.FU||(null==w||w.cancel(),t.error(e))}))}),{clearSignal:n,emitCurrentValue:!0})}function I(e,n,i,a){var l=function(e,t){return e.deriveReadOnlyObserver((function(e,n){var r=(0,S.ZP)(i(),n);return e.onUpdate(a,{clearSignal:n,emitCurrentValue:!1}),r;function i(){var n=e.getValue(),r=t.getBufferedRanges(),i=(0,b.L7)(r,n.position.last);return(0,_.Z)({},n,{bufferGap:i})}function a(){r.setValue(i())}}))}(o,i);ht({content:{manifest:m,period:g,adaptation:e,representations:n},options:v,playbackObserver:l,representationEstimator:u,segmentBuffer:i,segmentFetcherCreator:c,wantedBufferAhead:p,maxVideoBufferSize:h},Object.assign(Object.assign({},t),{error:function(e){if(!Le.isNative(r)){s.Z.error("Stream: "+r+" Stream crashed. Aborting it.",e instanceof Error?e:""),f.disposeSegmentBuffer(r);var n=(0,d.Z)(e,{defaultCode:"NONE",defaultReason:"Unknown `AdaptationStream` error"});if(t.warning(n),a.isCancelled)return;return Et(o,p,r,{period:g},t,a)}s.Z.error("Stream: "+r+" Stream crashed. Stopping playback.",e instanceof Error?e:""),t.error(e)}}),a)}};function wt(e,t){if(0===t.length)return[];e.synchronizeInventory();for(var n=[],r=e.getInventory(),i=function(i){var a=r[i];if(t.some((function(e){return a.infos.period.id===e.period.id&&a.infos.adaptation.id===e.adaptation.id&&a.infos.representation.id===e.representation.id}))){var o=a.bufferedStart,u=a.bufferedEnd;if(void 0===o||void 0===u){s.Z.warn("SO: No buffered start or end found from a segment.");var l=e.getBufferedRanges(),d=l.length;return 0===d?{v:[]}:{v:[{start:l.start(0),end:l.end(d-1)}]}}var c=n[n.length-1];void 0!==c&&c.end===o?c.end=u:n.push({start:o,end:u})}},a=0;a<r.length;a++){var o=i(a);if("object"==typeof o)return o.v}return n}function kt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return At(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return At(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function At(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function It(e,t){if(0===t.length)return!1;var n=e.position.last;return e.speed>=0?t[t.length-1].end>=n-5:t[0].start<=n+5}var Rt=function(e,t,n,r,i,a,o,u){var d=e.manifest,f=e.initialPeriod,v=a.maxBufferAhead,p=a.maxBufferBehind,h=a.wantedBufferAhead,m=a.maxVideoBufferSize,g=l.Z.getCurrent(),y=g.MAXIMUM_MAX_BUFFER_AHEAD,_=g.MAXIMUM_MAX_BUFFER_BEHIND,b=new ze((function(e){var n=e.bufferType,r=null!=_[n]?_[n]:1/0,i=null!=y[n]?y[n]:1/0;return function(n){Ve({segmentBuffer:e,playbackObserver:t,maxBufferBehind:(0,S.lR)(p,(function(e){return Math.min(e,r)}),n),maxBufferAhead:(0,S.lR)(v,(function(e){return Math.min(e,i)}),n)},n)}}));function w(e,o,u,l){s.Z.info("Stream: Creating new Stream for",e,o.start);var c=null,f=new E.ZP({cancelOn:l});t.listen((function(t,n){var r,i,a=t.position;void 0!==o.end&&(null!==(r=a.pending)&&void 0!==r?r:a.last)>=o.end&&(s.Z.info("Stream: Destroying PeriodStream as the current playhead moved above it",e,o.start,null!==(i=a.pending)&&void 0!==i?i:a.last,o.end),n(),u.periodStreamCleared({type:e,manifest:d,period:o}),f.cancel())}),{clearSignal:l,includeLastObservation:!0});var v,p={bufferType:e,content:{manifest:d,period:o},garbageCollectors:b,maxVideoBufferSize:m,segmentFetcherCreator:i,segmentBuffersStore:r,options:a,playbackObserver:t,representationEstimator:n,wantedBufferAhead:h},g=Object.assign(Object.assign({},u),{streamStatusUpdate:function(t){if(t.hasFinishedLoading){if(null===c){var n=d.getPeriodAfter(o);null!==n&&function(t){null!==c&&(s.Z.warn("Stream: Creating next `PeriodStream` while it was already created."),u.periodStreamCleared({type:e,manifest:d,period:c.period}),c.canceller.cancel());c={canceller:new E.ZP({cancelOn:l}),period:t},w(e,t,u,c.canceller.signal)}(n)}}else null!==c&&(s.Z.info("Stream: Destroying next PeriodStream due to current one being active",e,c.period.start),u.periodStreamCleared({type:e,manifest:d,period:c.period}),c.canceller.cancel(),c=null);u.streamStatusUpdate(t)},error:function(e){null!==c&&(c.canceller.cancel(),c=null),f.cancel(),u.error(e)}});Tt(p,g,f.signal),v=f.signal,d.addEventListener("manifestUpdate",(function(n){for(var r,i=function(){var n=r.value;if(n.id===o.id)d.periods.length>0&&d.periods[0].start<=n.start&&lt(t,(function(t){var r=t.position,i=t.autoPlay;u.waitingMediaSourceReload({bufferType:e,period:n,position:r,autoPlay:i})}),0,{start:void 0,end:void 0},v);else if(n.start>o.start)return"break"},a=kt(n.removedPeriods);!(r=a()).done&&"break"!==i(););if(n.addedPeriods.length>0&&null!==c){var l=d.getPeriodAfter(o);null!==l&&c.period.id===l.id||(s.Z.warn("Stream: Destroying next PeriodStream due to new one being added",e,c.period.start),u.periodStreamCleared({type:e,manifest:d,period:c.period}),c.canceller.cancel(),c=null)}}),v)}r.getBufferTypes().map((function(e){!function(e,n){var i=new Fe((function(e,t){return e.start-t.start})),a=!1,l=new E.ZP({cancelOn:u});return t.listen((function(t){var n,r,c=t.position,p=null!==(n=c.pending)&&void 0!==n?n:c.last;if(a&&v(p)){for(s.Z.info("Stream: Destroying all PeriodStreams due to out of bounds situation",e,p),a=!1;i.length()>0;){var h=i.get(i.length()-1);i.removeElement(h),o.periodStreamCleared({type:e,manifest:d,period:h})}l.cancel(),l=new E.ZP({cancelOn:u});var m=null!==(r=d.getPeriodForTime(p))&&void 0!==r?r:d.getNextPeriod(p);void 0!==m?f(m):s.Z.warn("Stream: The wanted position is not found in the Manifest.")}}),{clearSignal:u,includeLastObservation:!0}),d.addEventListener("decipherabilityUpdate",(function(e){p(e).catch((function(e){l.cancel(),o.error(e)}))}),u),f(n);function f(t){var n=Object.assign(Object.assign({},o),{waitingMediaSourceReload:function(e){var t=i.head();if(void 0===t||t.id!==e.period.id)o.lockedStream({bufferType:e.bufferType,period:e.period});else{var n=e.position,r=e.autoPlay;o.needsMediaSourceReload({position:n,autoPlay:r})}},periodStreamReady:function(e){a=!0,i.add(e.period),o.periodStreamReady(e)},periodStreamCleared:function(e){i.removeElement(e.period),o.periodStreamCleared(e)},error:function(e){l.cancel(),o.error(e)}});w(e,t,n,l.signal)}function v(e){var t=i.head(),n=i.last();return null==t||null==n||(t.start>e||(null==n.end?1/0:n.end)<e)}function p(e){return h.apply(this,arguments)}function h(){return h=(0,T.Z)(k().mark((function n(v){var p,h,m,g,y,_,b,S,T,w,A,I,R;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(p=r.getStatus(e),0!==(h=v.filter((function(t){return t.adaptation.type===e}))).length&&"initialized"===p.type){n.next=4;break}return n.abrupt("return");case 4:for(m=p.value,g=h.filter((function(e){return void 0===e.representation.decipherable})),y=h.filter((function(e){return!1===e.representation.decipherable})),_=wt(m,y),b=wt(m,g),a=!1,s.Z.info("Stream: Destroying all PeriodStreams for decipherability matters",e);i.length()>0;)S=i.get(i.length()-1),i.removeElement(S),o.periodStreamCleared({type:e,manifest:d,period:S});l.cancel(),l=new E.ZP({cancelOn:u}),T=0,w=[].concat(_,b);case 15:if(!(T<w.length)){n.next=23;break}if(A=w[T],I=A.start,R=A.end,!(I<R)){n.next=20;break}return n.next=20,m.removeBuffer(I,R,u);case 20:T++,n.next=15;break;case 23:Be()((function(){var e,n;if(!u.isCancelled){var r=t.getReference().getValue();if(It(r,_)){var i=!(null!==(e=r.paused.pending)&&void 0!==e?e:t.getIsPaused());if(o.needsDecipherabilityFlush({position:r.position.last,autoPlay:i,duration:r.duration}),u.isCancelled)return}else if(It(r,b)&&(o.needsBufferFlush(),u.isCancelled))return;var a=null!==(n=r.position.pending)&&void 0!==n?n:r.position.last,s=d.getPeriodForTime(a);null!=s?f(s):o.error(new c.Z("MEDIA_TIME_NOT_FOUND","The wanted position is not found in the Manifest."))}}));case 24:case"end":return n.stop()}}),n)}))),h.apply(this,arguments)}}(e,f)}))},Zt=Rt,xt=n(379);function Pt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Mt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Mt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Mt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ct=function(e){function n(t,n,r){var i;(i=e.call(this)||this)._canceller=new E.ZP,i._manifest=t,i._activeStreams=new Map,i._allBufferTypes=r,i._lastCurrentPeriodId=null;var a=new Dt(t);i._maximumPositionCalculator=a;var o=i._canceller.signal;return n.listen((function(e){var n,r=e.position,o=null!==(n=r.pending)&&void 0!==n?n:r.last;if(o<t.getMinimumSafePosition()){var s=new c.Z("MEDIA_TIME_BEFORE_MANIFEST","The current position is behind the earliest time announced in the Manifest.");i.trigger("warning",s)}else if(o>a.getMaximumAvailablePosition()){var u=new c.Z("MEDIA_TIME_AFTER_MANIFEST","The current position is after the latest time announced in the Manifest.");i.trigger("warning",u)}}),{includeLastObservation:!0,clearSignal:o}),t.addEventListener("manifestUpdate",(function(){i.trigger("durationUpdate",t.isDynamic?a.getMaximumAvailablePosition():a.getEndingPosition()),o.isCancelled||i._checkEndOfStream()}),o),i}(0,t.Z)(n,e);var r=n.prototype;return r.onAdaptationChange=function(e,t,n){if(this._manifest.isLastPeriodKnown){var r=this._manifest.periods[this._manifest.periods.length-1];if(t.id===(null==r?void 0:r.id)&&("audio"===e||"video"===e)){"audio"===e?this._maximumPositionCalculator.updateLastAudioAdaptation(n):this._maximumPositionCalculator.updateLastVideoAdaptation(n);var i=this._manifest.isDynamic?this._maximumPositionCalculator.getMaximumAvailablePosition():this._maximumPositionCalculator.getEndingPosition();this.trigger("durationUpdate",i)}}this._canceller.isUsed||null===n&&this._addActivelyLoadedPeriod(t,e)},r.onRepresentationChange=function(e,t){this._addActivelyLoadedPeriod(t,e)},r.onPeriodCleared=function(e,t){this._removeActivelyLoadedPeriod(t,e)},r.onLastSegmentFinishedLoading=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod||(t.hasFinishedLoadingLastPeriod=!0,this._checkEndOfStream())},r.onLastSegmentLoadingResume=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod&&(t.hasFinishedLoadingLastPeriod=!1,this._checkEndOfStream())},r.dispose=function(){this.removeEventListener(),this._canceller.cancel()},r._addActivelyLoadedPeriod=function(e,t){var n=this._lazilyCreateActiveStreamInfo(t);n.activePeriods.has(e)||(n.activePeriods.add(e),this._checkCurrentPeriod())},r._removeActivelyLoadedPeriod=function(e,t){var n=this._activeStreams.get(t);void 0!==n&&n.activePeriods.has(e)&&(n.activePeriods.removeElement(e),this._checkCurrentPeriod())},r._checkCurrentPeriod=function(){var e=this;if(0!==this._allBufferTypes.length){var t=this._activeStreams.get(this._allBufferTypes[0]);if(void 0!==t)for(var n,r=function(){for(var t=n.value,r=!0,i=1;i<e._allBufferTypes.length;i++){var a=e._activeStreams.get(e._allBufferTypes[i]);if(void 0===a)return{v:void 0};if(!a.activePeriods.toArray().some((function(e){return e.id===t.id}))){r=!1;break}}if(r)return e._lastCurrentPeriodId!==t.id&&(e._lastCurrentPeriodId=t.id,e.trigger("periodChange",t)),{v:void 0}},i=Pt(t.activePeriods.toArray());!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}}},r._lazilyCreateActiveStreamInfo=function(e){var t=this._activeStreams.get(e);return void 0===t&&(t={activePeriods:new Fe((function(e,t){return e.start-t.start})),hasFinishedLoadingLastPeriod:!1},this._activeStreams.set(e,t)),t},r._checkEndOfStream=function(){var e=this;this._manifest.isLastPeriodKnown&&(this._allBufferTypes.every((function(t){var n=e._activeStreams.get(t);return void 0!==n&&n.hasFinishedLoadingLastPeriod}))?this.trigger("endOfStream",null):this.trigger("resumeStream",null))},n}(m.Z),Dt=function(){function e(e){this._manifest=e,this._lastAudioAdaptation=void 0,this._lastVideoAdaptation=void 0}var t=e.prototype;return t.updateLastAudioAdaptation=function(e){this._lastAudioAdaptation=e},t.updateLastVideoAdaptation=function(e){this._lastVideoAdaptation=e},t.getMaximumAvailablePosition=function(){var e;if(this._manifest.isDynamic)return null!==(e=this._manifest.getLivePosition())&&void 0!==e?e:this._manifest.getMaximumSafePosition();if(void 0===this._lastVideoAdaptation||void 0===this._lastAudioAdaptation)return this._manifest.getMaximumSafePosition();if(null===this._lastAudioAdaptation){if(null===this._lastVideoAdaptation)return this._manifest.getMaximumSafePosition();var t=Nt(this._lastVideoAdaptation);return"number"!=typeof t?this._manifest.getMaximumSafePosition():t}if(null===this._lastVideoAdaptation){var n=Nt(this._lastAudioAdaptation);return"number"!=typeof n?this._manifest.getMaximumSafePosition():n}var r=Nt(this._lastAudioAdaptation),i=Nt(this._lastVideoAdaptation);return"number"!=typeof r||"number"!=typeof i?this._manifest.getMaximumSafePosition():Math.min(r,i)},t.getEndingPosition=function(){var e,t;if(!this._manifest.isDynamic)return this.getMaximumAvailablePosition();if(void 0!==this._lastVideoAdaptation&&void 0!==this._lastAudioAdaptation){if(null===this._lastAudioAdaptation)return null===this._lastVideoAdaptation?void 0:null!==(e=Ot(this._lastVideoAdaptation))&&void 0!==e?e:void 0;if(null===this._lastVideoAdaptation)return null!==(t=Ot(this._lastAudioAdaptation))&&void 0!==t?t:void 0;var n=Ot(this._lastAudioAdaptation),r=Ot(this._lastVideoAdaptation);return"number"!=typeof n||"number"!=typeof r?void 0:Math.min(n,r)}},e}();function Nt(e){for(var t,n=e.representations,r=null,i=0;i<n.length;i++)if(n[i].index!==t){t=n[i].index;var a=n[i].index.getLastAvailablePosition();if(void 0===a)return;null!==a&&(r=(0,y.Z)(r)?a:Math.min(r,a))}return r}function Ot(e){for(var t,n=e.representations,r=null,i=0;i<n.length;i++)if(n[i].index!==t){t=n[i].index;var a=n[i].index.getEnd();if(void 0===a)return;null!==a&&(r=(0,y.Z)(r)?a:Math.min(r,a))}return r}var Lt=n(5767),Ut=n(3774),Bt=n(6923);function Ft(e,t,n){if(null!==t&&"closed"!==t.readyState){for(var r=t.readyState,i=t.sourceBuffers,a=i.length-1;a>=0;a--){var o=i[a];try{"open"===r&&(s.Z.info("Init: Removing SourceBuffer from mediaSource"),o.abort()),t.removeSourceBuffer(o)}catch(e){s.Z.warn("Init: Error while disposing SourceBuffer",e instanceof Error?e:"")}}i.length>0&&s.Z.warn("Init: Not all SourceBuffers could have been removed.")}if((0,Lt.Z)(e),null!==n)try{s.Z.debug("Init: Revoking previous URL"),URL.revokeObjectURL(n)}catch(e){s.Z.warn("Init: Error while revoking the media source URL",e instanceof Error?e:"")}}function zt(e,t){return new Promise((function(n,r){var a=!1,o=function(e,t){if(null==Ut.J)throw new c.Z("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=(0,Bt.Z)(e.src)?e.src:null;Ft(e,null,n),s.Z.info("Init: Creating MediaSource");var r=new Ut.J,i=URL.createObjectURL(r);return s.Z.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){Ft(e,r,i)})),r}(e,t),u=new E.ZP({cancelOn:t});i.u_(o,(function(){u.cancel(),a=!0,n(o)}),u.signal),t.register((function(e){a||r(e)}))}))}function Vt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Kt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Gt=i.x6,jt=i.u_,Ht=i.y4;function Wt(e,t){if(s.Z.debug("Init: Trying to call endOfStream"),"open"===e.readyState){var n=e.sourceBuffers,r=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r.updating&&t.push(r)}return t}(n);if(0===r.length)return s.Z.info("Init: Triggering end of stream"),void e.endOfStream();s.Z.debug("Init: Waiting SourceBuffers to be updated before calling endOfStream.");for(var i,a=new E.ZP({cancelOn:t}),o=Vt(r);!(i=o()).done;){var u=i.value;Ht(u,(function(){a.cancel(),Wt(e,t)}),a.signal)}Gt(n,(function(){a.cancel(),Wt(e,t)}),a.signal)}else s.Z.debug("Init: MediaSource not open, cancel endOfStream")}function qt(e,t,n){if(!(0,y.Z)(n)){var r,i=e.getMinimumSafePosition();if(e.isLive&&(r=e.getLivePosition()),void 0===r&&(r=e.getMaximumSafePosition()),!(0,y.Z)(n.position))return s.Z.debug("Init: using startAt.minimumPosition"),Math.max(Math.min(n.position,r),i);if(!(0,y.Z)(n.wallClockTime)){s.Z.debug("Init: using startAt.wallClockTime");var a=void 0===e.availabilityStartTime?0:e.availabilityStartTime,o=n.wallClockTime-a;return Math.max(Math.min(o,r),i)}if(!(0,y.Z)(n.fromFirstPosition)){s.Z.debug("Init: using startAt.fromFirstPosition");var u=n.fromFirstPosition;return u<=0?i:Math.min(r,i+u)}if(!(0,y.Z)(n.fromLastPosition)){s.Z.debug("Init: using startAt.fromLastPosition");var d=n.fromLastPosition;return d>=0?r:Math.max(i,r+d)}if(!(0,y.Z)(n.percentage)){s.Z.debug("Init: using startAt.percentage");var c=n.percentage;return c>100?r:c<0?i:i+(r-i)*(+c/100)}}var f=e.getMinimumSafePosition();if(e.isLive){var v,p=e.suggestedPresentationDelay,h=e.clockOffset,m=e.getMaximumSafePosition(),g=l.Z.getCurrent().DEFAULT_LIVE_GAP;if(void 0===h)s.Z.info("Init: no clock offset found for a live content, starting close to maximum available position"),v=m;else{s.Z.info("Init: clock offset found for a live content, checking if we can start close to it");var _=void 0===e.availabilityStartTime?0:e.availabilityStartTime,b=(performance.now()+h)/1e3-_;v=Math.min(m,b)}var S=void 0!==p?p:t?g.LOW_LATENCY:g.DEFAULT;return s.Z.debug("Init: "+v+" defined as the live time, applying a live gap of "+S),Math.max(v-S,f)}return s.Z.info("Init: starting at the minimum available position:",f),f}var Yt=n(1757),Xt=n(8833),Qt=n(8799),$t=function(){function e(e,t){var n=new E.ZP,r=(0,S.ZP)(void 0,n.signal);this._canceller=n,this._currentKnownDuration=r;var a=function(e,t){var n=(0,S.ZP)("open"===e.readyState,t);return(0,i.u_)(e,(function(){n.setValueIfChanged(!0)}),t),(0,i.N8)(e,(function(){n.setValueIfChanged(!1)}),t),(0,i.k6)(e,(function(){n.setValueIfChanged(!1)}),t),n}(t,this._canceller.signal),o=new E.ZP({cancelOn:this._canceller.signal});function s(n){var i=function(e,t){if(0===e.length){var n=(0,S.ZP)(!1);return n.finish(),n}var r=(0,S.ZP)(!1,t);o();for(var i=function(n){var r=e[n];r.addEventListener("updatestart",o),r.addEventListener("update",o),t.register((function(){r.removeEventListener("updatestart",o),r.removeEventListener("update",o)}))},a=0;a<e.length;a++)i(a);return r;function o(){for(var t=0;t<e.length;t++){if(e[t].updating)return void r.setValueIfChanged(!0)}r.setValueIfChanged(!1)}}(t.sourceBuffers,n),a=new E.ZP({cancelOn:n});return i.onUpdate((function(i){a.cancel(),a=new E.ZP({cancelOn:n}),i||Jt(t,e,r.getValue(),n)}),{clearSignal:n,emitCurrentValue:!0})}a.onUpdate((function(){if(o.cancel(),!a.getValue())return;o=new E.ZP({cancelOn:n.signal});var t=new E.ZP({cancelOn:o.signal}),i=function(){t.cancel(),s((t=new E.ZP({cancelOn:o.signal})).signal)};r.onUpdate(i,{emitCurrentValue:!1,clearSignal:o.signal}),e.addEventListener("manifestUpdate",i,o.signal),s(t.signal)}),{emitCurrentValue:!0,clearSignal:this._canceller.signal})}var t=e.prototype;return t.updateKnownDuration=function(e){this._currentKnownDuration.setValueIfChanged(e)},t.stop=function(){this._canceller.cancel()},e}();function Jt(e,t,n,r){var i=function(e,t,n){var r,i=n;if(void 0===i)if(t.isDynamic){var a=null!==(r=t.getLivePosition())&&void 0!==r?r:t.getMaximumSafePosition();i=Math.max(Math.pow(2,32),a+31536e3)}else i=t.getMaximumSafePosition();for(var o=0,u=0;u<e.sourceBuffers.length;u++){var l=e.sourceBuffers[u],d=l.buffered.length;d>0&&(o=Math.max(l.buffered.end(d-1)))}if(i===e.duration)return"success";if(o>i){if(o<e.duration)try{s.Z.info("Init: Updating duration to what is currently buffered",o),e.duration=i}catch(e){return s.Z.warn("Duration Updater: Can't update duration on the MediaSource.",e instanceof Error?e:""),"failed"}return"partial"}var c=e.duration;try{s.Z.info("Init: Updating duration",i),e.duration=i}catch(e){return s.Z.warn("Duration Updater: Can't update duration on the MediaSource.",e instanceof Error?e:""),"failed"}var f=Math.abs(e.duration-i);return f>=.1?f<Math.abs(e.duration-c)?"partial":"failed":"success"}(e,t,n);if("success"!==i)var a=setTimeout((function(){o(),Jt(e,t,n,r)}),2e3),o=r.register((function(){clearTimeout(a)}))}var en=n(6199);var tn=function(e,t){return e.id===t.id&&e.start===t.start&&e.end===t.end};var nn=function(e,t){for(var n=[],r=t.periods,i=0;i<r.length;i++){r[i].streamEvents.forEach((function(t){for(var r=t.start,i=t.end,a=t.id,o=t.data,s=0;s<e.length;s++){var u=e[s];if(tn(u,{id:a,start:r,end:i}))return void n.push(u)}if(void 0===i){var l={start:r,id:a,data:o,publicEvent:{start:r,data:o}};n.push(l)}else{var d={start:r,end:i,id:a,data:o,publicEvent:{start:r,end:i,data:o}};n.push(d)}}))}return n};function rn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return an(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return an(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function an(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function on(e){return void 0!==e.end}var sn=function(e,t,n,r,i,a){var o=new WeakMap,s=(0,S.ZP)(nn([],e),a);e.addEventListener("manifestUpdate",(function(){var t=s.getValue();s.setValue(nn(t,e))}),a);var u=!1,d=new E.ZP({cancelOn:a});s.onUpdate((function(e){if(0!==e.length){if(!u){u=!0;var c=h(),f=l.Z.getCurrent().STREAM_EVENT_EMITTER_POLL_INTERVAL,v=setInterval(p,f);n.listen(p,{includeLastObservation:!1,clearSignal:d.signal}),d.signal.register((function(){clearInterval(v)}))}}else u&&(d.cancel(),d=new E.ZP({cancelOn:a}),u=!1);function p(){var e=h();!function(e,t,n,a){for(var s=t.currentTime,u=n.isSeeking,l=n.currentTime,d=[],c=[],f=0;f<e.length;f++){var v=e[f],p=v.start,h=on(v)?v.end:void 0;o.has(v)?(p>l||void 0!==h&&l>=h)&&(on(v)&&c.push(v.publicEvent),o.delete(v)):p<=l&&void 0!==h&&l<h?(d.push({type:"stream-event",value:v.publicEvent}),o.set(v,!0)):s<p&&l>=(null!=h?h:p)&&(u?d.push({type:"stream-event-skip",value:v.publicEvent}):(d.push({type:"stream-event",value:v.publicEvent}),on(v)&&c.push(v.publicEvent)))}if(d.length>0)for(var m,g=rn(d);!(m=g()).done;){var y=m.value;if("stream-event"===y.type?r(y.value):i(y.value),a.isCancelled)return}if(c.length>0)for(var _,b=rn(c);!(_=b()).done;){var S=_.value;if("function"==typeof S.onExit&&S.onExit(),a.isCancelled)return}}(s.getValue(),c,e,d.signal),c=e}function h(){var e=n.getReference().getValue().seeking;return{currentTime:t.currentTime,isSeeking:e}}}),{emitCurrentValue:!0,clearSignal:a})},un=n(4576);function ln(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return dn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function dn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var cn=function(e){function n(t){var n;(n=e.call(this)||this)._settings=t,n._initCanceller=new E.ZP,n._initialManifestProm=null;var r=void 0===t.url?void 0:[t.url];return n._manifestFetcher=new me(r,t.transport,t.manifestRequestSettings),n}(0,t.Z)(n,e);var r=n.prototype;return r.prepare=function(){var e=this;null===this._initialManifestProm&&(this._initialManifestProm=new Promise((function(t,n){e._initCanceller.signal.register((function(t){e._manifestFetcher.dispose(),n(t)})),e._manifestFetcher.addEventListener("warning",(function(t){return e.trigger("warning",t)})),e._manifestFetcher.addEventListener("error",(function(t){e.trigger("error",t),n(t)})),e._manifestFetcher.addEventListener("manifestReady",(function(e){t(e)})),e._manifestFetcher.start()})))},r.start=function(e,t){var n=this;this.prepare(),(0,un.Z)(e,(function(e){return n._onFatalError(e)}),this._initCanceller.signal);var r=(0,S.ZP)(null,this._initCanceller.signal);this._initializeMediaSourceAndDecryption(e,r).then((function(i){return n._onInitialMediaSourceReady(e,i.mediaSource,t,i.drmSystemId,r,i.unlinkMediaSource)})).catch((function(e){n._onFatalError(e)}))},r.updateContentUrls=function(e,t){this._manifestFetcher.updateContentUrls(e,t)},r.dispose=function(){this._initCanceller.cancel()},r._onFatalError=function(e){this._initCanceller.isUsed||(this._initCanceller.cancel(),this.trigger("error",e))},r._initializeMediaSourceAndDecryption=function(e,t){var n=this;return new Promise((function(r,i){var a=n._settings.keySystems,o=n._initCanceller,s=o.signal.register((function(e){i(e)})),u=(0,Qt.Z)(e,a,t,{onWarning:function(e){return n.trigger("warning",e)},onError:function(e){return n._onFatalError(e)}},o.signal);u.onUpdate((function(t,i){if("uninitialized"!==t.initializationState.type){i();var a=new E.ZP({cancelOn:o.signal});zt(e,a.signal).then((function(e){var n=u.getValue();if("awaiting-media-link"===n.initializationState.type)n.initializationState.value.isMediaLinked.setValue(!0),u.onUpdate((function(t,n){if("initialized"===t.initializationState.type)return n(),s(),void r({mediaSource:e,drmSystemId:t.drmSystemId,unlinkMediaSource:a})}),{emitCurrentValue:!0,clearSignal:o.signal});else if("initialized"===t.initializationState.type)return s(),void r({mediaSource:e,drmSystemId:t.drmSystemId,unlinkMediaSource:a})})).catch((function(e){a.isUsed||n._onFatalError(e)}))}}),{emitCurrentValue:!0,clearSignal:o.signal})}))},r._onInitialMediaSourceReady=function(){var e=(0,T.Z)(k().mark((function e(t,n,r,i,a,o){var u,l,d,c,f,v,h,m,g,y,b,S,T,w,A,I,R,Z,x,P,M,C=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return M=function(e,n,i,o){Z({mediaElement:t,playbackObserver:r,mediaSource:e,initialTime:n,autoPlay:i,manifest:T,representationEstimator:A,segmentFetcherCreator:R,speed:h,protectionRef:a,bufferOptions:I},(function(e){if(o.cancel(),b.isUsed)return;if(x("reloadingMediaSource",null),b.isUsed)return;var n=new E.ZP({cancelOn:b.signal});zt(t,n.signal).then((function(t){M(t,e.position,e.autoPlay,n)})).catch((function(e){n.isUsed||P(e)}))}),o.signal)},u=this._settings,l=u.adaptiveOptions,d=u.autoPlay,c=u.bufferOptions,f=u.lowLatencyMode,v=u.segmentRequestOptions,h=u.speed,m=u.startAt,g=u.textTrackOptions,y=u.transport,b=this._initCanceller,(0,p.Z)(null!==this._initialManifestProm),S=this._initialManifestProm,e.prev=5,e.next=8,S;case 8:T=e.sent,e.next=14;break;case 11:return e.prev=11,e.t0=e.catch(5),e.abrupt("return");case 14:if(T.addEventListener("manifestUpdate",(function(){C.trigger("manifestUpdate",null)}),b.signal),s.Z.debug("Init: Calculating initial time"),w=qt(T,f,m),s.Z.debug("Init: Initial time calculated:",w),A=ee(l),I=(0,_.Z)({textTrackOptions:g,drmSystemId:i},c),R=new Re(y,v,b.signal),this.trigger("manifestReady",T),!b.isUsed){e.next=24;break}return e.abrupt("return");case 24:Z=this._startBufferingOnMediaSource.bind(this),x=this.trigger.bind(this),P=this._onFatalError.bind(this),M(n,w,d,o);case 28:case"end":return e.stop()}}),e,this,[[5,11]])})));return function(t,n,r,i,a,o){return e.apply(this,arguments)}}(),r._startBufferingOnMediaSource=function(e,t,n){var r,i=this,a=e.autoPlay,o=e.bufferOptions,s=e.initialTime,u=e.manifest,d=e.mediaElement,f=e.mediaSource,v=e.playbackObserver,p=e.protectionRef,h=e.representationEstimator,m=e.segmentFetcherCreator,g=e.speed,y=null!==(r=u.getPeriodForTime(s))&&void 0!==r?r:u.getNextPeriod(s);if(void 0===y){var _=new c.Z("MEDIA_STARTING_TIME_NOT_FOUND","Wanted starting time not found in the Manifest.");return this._onFatalError(_)}var b=new Le(d,f);n.register((function(){b.disposeAll()}));var E=(0,Xt.Z)(d,v,s,a,(function(e){return i.trigger("warning",e)}),n),T=E.autoPlayResult,w=E.initialPlayPerformed,k=E.initialSeekPerformed;if(!n.isCancelled){w.onUpdate((function(e,t){e&&(t(),sn(u,d,v,(function(e){return i.trigger("streamEvent",e)}),(function(e){return i.trigger("streamEventSkip",e)}),n))}),{clearSignal:n,emitCurrentValue:!0});var A=function(e,t,n){var r=n.autoPlay,i=n.initialPlayPerformed,a=n.initialSeekPerformed,o=n.speed,s=n.startTime;return t.deriveReadOnlyObserver((function(t,n){var u=(0,S.ZP)(l(),n);return o.onUpdate(d,{clearSignal:n,emitCurrentValue:!1}),t.onUpdate(d,{clearSignal:n,emitCurrentValue:!1}),u;function l(){var n,u=t.getValue(),l=o.getValue();if(a.getValue()){if(!e.isDynamic||e.isLastPeriodKnown){var d=e.periods[e.periods.length-1];void 0!==d&&void 0!==d.end&&u.position>d.end&&(n=d.end-1)}}else n=s;return{maximumPosition:e.getMaximumSafePosition(),position:{last:u.position,pending:n},duration:u.duration,paused:{last:u.paused,pending:i.getValue()||!r===u.paused?void 0:!r},readyState:u.readyState,speed:l}}function d(){u.setValue(l())}}))}(u,v,{autoPlay:a,initialPlayPerformed:w,initialSeekPerformed:k,speed:g,startTime:s}),I=this._createRebufferingController(v,u,g,n),R=this._createContentTimeBoundariesObserver(u,f,A,b,n);T.then((function(){(0,Yt.Z)(v,d,!1,n).onUpdate((function(e,t){e&&(t(),i.trigger("loaded",{segmentBuffersStore:b}))}),{emitCurrentValue:!0,clearSignal:n})})).catch((function(e){n.isCancelled||i._onFatalError(e)}));var Z=this;Zt({manifest:u,initialPeriod:y},A,h,b,m,o,{needsBufferFlush:function(){return v.setCurrentTime(d.currentTime+.001)},streamStatusUpdate:function(e){var t=e.period,r=e.bufferType,i=e.imminentDiscontinuity,a=e.position;I.updateDiscontinuityInfo({period:t,bufferType:r,discontinuity:i,position:a}),n.isCancelled||u.isLastPeriodKnown&&e.period.id===u.periods[u.periods.length-1].id&&(e.hasFinishedLoading||e.isEmptyStream?R.onLastSegmentFinishedLoading(e.bufferType):R.onLastSegmentLoadingResume(e.bufferType))},needsManifestRefresh:function(){return Z._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!0,canUseUnsafeMode:!0})},manifestMightBeOufOfSync:function(){var e=l.Z.getCurrent().OUT_OF_SYNC_MANIFEST_REFRESH_DELAY;Z._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!1,canUseUnsafeMode:!1,delay:e})},lockedStream:function(e){return I.onLockedStream(e.bufferType,e.period)},adaptationChange:function(e){Z.trigger("adaptationChange",e),n.isCancelled||R.onAdaptationChange(e.type,e.period,e.adaptation)},representationChange:function(e){Z.trigger("representationChange",e),n.isCancelled||R.onRepresentationChange(e.type,e.period)},inbandEvent:function(e){return Z.trigger("inbandEvents",e)},warning:function(e){return Z.trigger("warning",e)},periodStreamReady:function(e){return Z.trigger("periodStreamReady",e)},periodStreamCleared:function(e){R.onPeriodCleared(e.type,e.period),n.isCancelled||Z.trigger("periodStreamCleared",e)},bitrateEstimateChange:function(e){return Z.trigger("bitrateEstimateChange",e)},addedSegment:function(e){return Z.trigger("addedSegment",e)},needsMediaSourceReload:function(e){return t(e)},needsDecipherabilityFlush:function(e){var n,r=x(d);void 0===(n=null==r?void 0:r[0])||n.indexOf("widevine")<0?t(e):e.position+.001<e.duration?v.setCurrentTime(d.currentTime+.001):v.setCurrentTime(e.position)},encryptionDataEncountered:function(e){for(var t,r=ln(e);!(t=r()).done;){var i=t.value;if(p.setValue(i),n.isCancelled)return}},error:function(e){return Z._onFatalError(e)}},n)}},r._createContentTimeBoundariesObserver=function(e,t,n,r,i){var a=this,o=new $t(e,t);i.register((function(){o.stop()}));var u=null,l=new Ct(e,n,r.getBufferTypes());return i.register((function(){l.dispose()})),l.addEventListener("warning",(function(e){return a.trigger("warning",e)})),l.addEventListener("periodChange",(function(e){a.trigger("activePeriodChanged",{period:e})})),l.addEventListener("durationUpdate",(function(e){s.Z.debug("Init: Duration has to be updated.",e),o.updateKnownDuration(e)})),l.addEventListener("endOfStream",(function(){null===u&&(u=new E.ZP({cancelOn:i}),s.Z.debug("Init: end-of-stream order received."),function(e,t){var n=new E.ZP({cancelOn:t});jt(e,(function(){n.cancel(),n=new E.ZP({cancelOn:t}),Wt(e,n.signal)}),t),Wt(e,n.signal)}(t,u.signal))})),l.addEventListener("resumeStream",(function(){null!==u&&(s.Z.debug("Init: resume-stream order received."),u.cancel(),u=null)})),l},r._createRebufferingController=function(e,t,n,r){var i=this,a=new en.Z(e,t,n);return a.addEventListener("stalled",(function(e){return i.trigger("stalled",e)})),a.addEventListener("unstalled",(function(){return i.trigger("unstalled",null)})),a.addEventListener("warning",(function(e){return i.trigger("warning",e)})),r.register((function(){return a.destroy()})),a.start(),a},n}(xt.K);function fn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return vn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function vn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var pn=["canplay","ended","play","pause","seeking","seeked","loadedmetadata","ratechange"],hn=function(){function e(e,t){this._internalSeeksIncoming=[],this._mediaElement=e,this._withMediaSource=t.withMediaSource,this._lowLatencyMode=t.lowLatencyMode,this._canceller=new E.ZP,this._observationRef=this._createSharedReference()}var t=e.prototype;return t.stop=function(){this._canceller.cancel()},t.getCurrentTime=function(){return this._mediaElement.currentTime},t.getPlaybackRate=function(){return this._mediaElement.playbackRate},t.getIsPaused=function(){return this._mediaElement.paused},t.setCurrentTime=function(e){this._internalSeeksIncoming.push(e),this._mediaElement.currentTime=e},t.setPlaybackRate=function(e){this._mediaElement.playbackRate=e},t.getReadyState=function(){return this._mediaElement.readyState},t.getReference=function(){return this._observationRef},t.listen=function(e,t){var n;if(this._canceller.isUsed||!0===(null===(n=null==t?void 0:t.clearSignal)||void 0===n?void 0:n.isCancelled))return M.Z;this._observationRef.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},t.deriveReadOnlyObserver=function(e){return yn(this,e,this._canceller.signal)},t._createSharedReference=function(){var e,t=this;if(void 0!==this._observationRef)return this._observationRef;var n=l.Z.getCurrent(),r=n.SAMPLING_INTERVAL_MEDIASOURCE,i=n.SAMPLING_INTERVAL_LOW_LATENCY,a=n.SAMPLING_INTERVAL_NO_MEDIASOURCE,o=function(n){var r,i=n;"seeking"===i&&t._internalSeeksIncoming.length>0&&(i="internal-seeking",r=t._internalSeeksIncoming.shift());var a=null!=e?e:t._generateInitialObservation(),o=gn(t._mediaElement,i,t._withMediaSource),u=null;o.seeking&&("number"==typeof r?u=r:null!==a.pendingInternalSeek&&"seeking"!==n&&(u=a.pendingInternalSeek));var d=function(e,t,n){var r,i,a=n.withMediaSource,o=n.lowLatencyMode,s=l.Z.getCurrent().REBUFFERING_GAP,u=t.event,d=t.position,c=t.bufferGap,f=t.currentRange,v=t.duration,p=t.paused,h=t.readyState,m=t.ended,g=e.rebuffering,y=e.event,_=e.position,b=function(e,t,n,r,i){var a=l.Z.getCurrent().REBUFFERING_GAP,o=i?"LOW_LATENCY":"DEFAULT";if(void 0===t)return n&&Math.abs(r-e)<=a[o];return null!==t&&r-t.end<=a[o]}(d,f,m,v,o),S=h>=1&&"loadedmetadata"!==u&&null===g&&!(b||m),E=null,T=o?s.LOW_LATENCY:s.DEFAULT;if(a){if(S)c===1/0?(r=!0,E=d):void 0===c?h<3&&(r=!0,E=void 0):c<=T&&(r=!0,E=d+c);else if(null!==g){var w=mn(g,o);!0!==r&&null!==g&&h>1&&(b||m||void 0!==c&&isFinite(c)&&c>w)||void 0===c&&h>=3?i=!0:void 0===c?E=void 0:c===1/0?E=d:c<=w&&(E=d+c)}}else S&&(!p&&"timeupdate"===u&&"timeupdate"===y&&d===_||"seeking"===u&&(c===1/0||void 0===c&&h<3))?r=!0:null!==g&&("seeking"!==u&&d!==_||"canplay"===u||void 0===c&&h>=3||void 0!==c&&c<1/0&&(c>mn(g,o)||b||m))&&(i=!0);if(!0===i)return null;var k;if(!0===r||null!==g)return k="seeking"===u||null!==g&&"seeking"===g.reason||t.seeking?"seeking":1===h?"not-ready":"buffering",null!==g&&g.reason===k?{reason:g.reason,timestamp:g.timestamp,position:E}:{reason:k,timestamp:performance.now(),position:E};return null}(a,o,{lowLatencyMode:t._lowLatencyMode,withMediaSource:t._withMediaSource}),c=function(e,t){var n=l.Z.getCurrent().MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;if(e.freezing)return t.ended||t.paused||0===t.readyState||0===t.playbackRate||e.position!==t.position?null:e.freezing;return"timeupdate"===t.event&&void 0!==t.bufferGap&&t.bufferGap>n&&!t.ended&&!t.paused&&t.readyState>=1&&0!==t.playbackRate&&t.position===e.position?{timestamp:performance.now()}:null}(a,o),f=(0,_.Z)({},{rebuffering:d,freezing:c,pendingInternalSeek:u},o);return s.Z.hasLevel("DEBUG")&&s.Z.debug("API: current media element state tick","event",f.event,"position",f.position,"seeking",f.seeking,"internalSeek",f.pendingInternalSeek,"rebuffering",null!==f.rebuffering,"freezing",null!==f.freezing,"ended",f.ended,"paused",f.paused,"playbackRate",f.playbackRate,"readyState",f.readyState),f},u=(0,S.ZP)(o("init"),this._canceller.signal),d=function(t){var n=o(t);s.Z.hasLevel("DEBUG")&&s.Z.debug("API: current playback timeline:\n"+function(e,t){for(var n="",r="",i=0;i<e.length;i++){var a=e.start(i),o=e.end(i),s=a.toFixed(2),u=o.toFixed(2),l=s+"|=="+(o-a).toFixed(2)+"==|"+u;if(n+=l,0===r.length&&o>t){var d=n.length-Math.floor(l.length/2);r=" ".repeat(d)+"^"+t}if(i<e.length-1){var c=e.start(i+1),f=" ~"+(c-o).toFixed(2)+"~ ";if(n+=f,0===r.length&&t<c){var v=n.length-Math.floor(f.length/2);r=" ".repeat(v)+"^"+t}}}0===r.length&&(r=" ".repeat(n.length)+"^"+t);return n+"\n"+r}(n.buffered,n.position),"\n"+t),e=n,u.setValue(n)},c=this._lowLatencyMode?i:this._withMediaSource?r:a,f=setInterval(p,c),v=pn.map((function(e){function n(){clearInterval(f),f=setInterval(p,c),d(e)}return t._mediaElement.addEventListener(e,n),function(){t._mediaElement.removeEventListener(e,n)}}));return this._canceller.signal.register((function(){clearInterval(f),v.forEach((function(e){return e()})),u.finish()})),u;function p(){d("timeupdate")}},t._generateInitialObservation=function(){return(0,_.Z)(gn(this._mediaElement,"init",this._withMediaSource),{rebuffering:null,freezing:null,pendingInternalSeek:null})},e}();function mn(e,t){if(null===e)return 0;var n=t?"LOW_LATENCY":"DEFAULT",r=l.Z.getCurrent(),i=r.RESUME_GAP_AFTER_SEEKING,a=r.RESUME_GAP_AFTER_NOT_ENOUGH_DATA,o=r.RESUME_GAP_AFTER_BUFFERING;switch(e.reason){case"seeking":return i[n];case"not-ready":return a[n];case"buffering":return o[n]}}function gn(e,t,n){var r,i,a=e.buffered,o=e.currentTime,s=e.duration,u=e.ended,l=e.paused,d=e.playbackRate,c=e.readyState,f=e.seeking;return!n&&0===a.length&&c>=3?(r=void 0,i=void 0):i=null!==(r=(0,b.rx)(a,o))?r.end-o:1/0,{bufferGap:i,buffered:a,currentRange:r,position:o,duration:s,ended:u,paused:l,playbackRate:d,readyState:c,seeking:f,event:t}}function yn(e,t,n){var r=t(e.getReference(),n);return{getCurrentTime:function(){return e.getCurrentTime()},getReadyState:function(){return e.getReadyState()},getPlaybackRate:function(){return e.getPlaybackRate()},getIsPaused:function(){return e.getIsPaused()},getReference:function(){return r},listen:function(e,t){var i;n.isCancelled||!0===(null===(i=null==t?void 0:t.clearSignal)||void 0===i?void 0:i.isCancelled)||r.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},deriveReadOnlyObserver:function(e){return yn(this,e,n)}}}var _n=function(e){function n(t,n,r){var i;if((i=e.call(this)||this)._canceller=new E.ZP,i._manifest=t,i._adaptationRef=n,null===r)return i._lastEmitted=r,n.setValue(null),(0,Ze.Z)(i);var a=i._constructLockedRepresentationsReference(r);return i._lastEmitted={adaptation:r.adaptation,switchingMode:r.switchingMode,lockedRepresentations:null},n.setValue({adaptation:r.adaptation,switchingMode:r.switchingMode,representations:a}),i}(0,t.Z)(n,e);var r=n.prototype;return r.updateTrack=function(e){if(null===e){if(null===this._lastEmitted)return;return this._canceller.cancel(),this._canceller=new E.ZP,this._lastEmitted=null,void this._adaptationRef.setValue(null)}var t=e.adaptation,n=e.switchingMode;this._canceller.cancel(),this._canceller=new E.ZP;var r=this._constructLockedRepresentationsReference(e);this._lastEmitted={adaptation:t,switchingMode:n,lockedRepresentations:null},this._adaptationRef.setValue({adaptation:t,switchingMode:n,representations:r})},r._constructLockedRepresentationsReference=function(e){var t=this._manifest,n=(0,S.ZP)({representations:[],switchingMode:"lazy"}),r=this;return t.addEventListener("decipherabilityUpdate",i),t.addEventListener("manifestUpdate",i),this._canceller.signal.register((function(){t.removeEventListener("decipherabilityUpdate",i),t.removeEventListener("manifestUpdate",i)})),e.lockedRepresentations.onUpdate(i,{clearSignal:this._canceller.signal,emitCurrentValue:!1}),i(),n;function i(){var t,i,a=e.lockedRepresentations.getValue();if(null===a)i=e.adaptation.getPlayableRepresentations(),t="lazy";else{var o=a.representations;if(t=a.switchingMode,0===(i=o.filter((function(e){return e.isPlayable()}))).length)return void r.trigger("noPlayableLockedRepresentation",null)}if(i.length<=0){var s=e.adaptation.type;throw new c.Z("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+s+" Adaptation can be played")}var u=n.getValue(),l=i.slice().sort();if(l.length===u.representations.length){for(var d=0;d<l.length;d++)if(u.representations[d].id!==l[d].id)return void n.setValue({representations:l,switchingMode:t})}else n.setValue({representations:l,switchingMode:t})}},r.dispose=function(){this.removeEventListener(),this._canceller.cancel(),this._adaptationRef.finish()},n}(m.Z),bn=function(e){function n(t){var n,r;return(n=e.call(this)||this)._storedPeriodInfo=[],n._isDisposed=!1,n._cachedPeriodInfo=new WeakMap,n._isTrickModeTrackEnabled=t.preferTrickModeTracks,n._defaultAudioTrackSwitchingMode=null!==(r=t.defaultAudioTrackSwitchingMode)&&void 0!==r?r:l.Z.getCurrent().DEFAULT_AUDIO_TRACK_SWITCHING_MODE,n}(0,t.Z)(n,e);var r=n.prototype;return r.getAvailablePeriods=function(){return this._storedPeriodInfo.map((function(e){return In(e.period)}))},r.updatePeriodList=function(e){for(var t,n,r,i=this,a=l.Z.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,o=e.periods,u=[],d=0,c=0;c<this._storedPeriodInfo.length;c++){var f=this._storedPeriodInfo[c].period,v=o[d];if(void 0===v)for(var p=this._storedPeriodInfo.length-1;p>=c;p--)this._storedPeriodInfo[p].inManifest=!1,Tn(this._storedPeriodInfo[p])&&this._removePeriodObject(p);else if(f===v){var h=function(){d++;var e=i._storedPeriodInfo[c].text.storedSettings;if(null!==e&&!v.getSupportedAdaptations("text").some((function(t){return t.id===e.adaptation.id}))){s.Z.warn("TracksStore: Chosen text Adaptation not available anymore");var o=i._storedPeriodInfo[c];if(o.text.storedSettings=null,i.trigger("trackUpdate",{period:In(v),trackType:"text",reason:"missing"}),i._isDisposed)return{v:void 0};var u=Sn(i._storedPeriodInfo,o.period.id);void 0!==u&&null===u.text.storedSettings&&(null===(t=u.text.dispatcher)||void 0===t||t.updateTrack(null))}var l=i._storedPeriodInfo[c].video.storedSettings;if(null!==l){var f=v.getSupportedAdaptations("video");if(!f.some((function(e){return e.id===l.adaptation.id}))){s.Z.warn("TracksStore: Chosen video Adaptation not available anymore");var p,h=i._storedPeriodInfo[c];if(0===f.length)p=null;else{var m=f[0],g=kn(m,i._isTrickModeTrackEnabled),y=(0,S.ZP)(null);p={adaptationBase:m,adaptation:g,switchingMode:a,lockedRepresentations:y}}if(h.video.storedSettings=p,i.trigger("trackUpdate",{period:In(v),trackType:"video",reason:"missing"}),i._isDisposed)return{v:void 0};var _=Sn(i._storedPeriodInfo,h.period.id);void 0!==_&&_.video.storedSettings===p&&(null===(n=_.video.dispatcher)||void 0===n||n.updateTrack(p))}}var b=i._storedPeriodInfo[c].audio.storedSettings;if(null!==b){var E=v.getSupportedAdaptations("audio");if(!E.some((function(e){return e.id===b.adaptation.id}))){s.Z.warn("TracksStore: Chosen audio Adaptation not available anymore");var T=i._storedPeriodInfo[c],w=0===E.length?null:{adaptation:E[0],switchingMode:i._defaultAudioTrackSwitchingMode,lockedRepresentations:(0,S.ZP)(null)};if(T.audio.storedSettings=w,i.trigger("trackUpdate",{period:In(v),trackType:"audio",reason:"missing"}),i._isDisposed)return{v:void 0};var k=Sn(i._storedPeriodInfo,T.period.id);void 0!==k&&k.audio.storedSettings===w&&(null===(r=k.audio.dispatcher)||void 0===r||r.updateTrack(w))}}}();if("object"==typeof h)return h.v}else if(f.start<=v.start)this._storedPeriodInfo[c].inManifest=!1,Tn(this._storedPeriodInfo[c])&&(this._removePeriodObject(c),c--);else{var m=An(v,!0,this._isTrickModeTrackEnabled,this._defaultAudioTrackSwitchingMode);this._storedPeriodInfo.splice(c,0,m),u.push(m),d++}}if(d<o.length){var g,y=o.slice(d).map((function(e){return An(e,!0,i._isTrickModeTrackEnabled,i._defaultAudioTrackSwitchingMode)}));(g=this._storedPeriodInfo).push.apply(g,y),u.push.apply(u,y)}var _=u.reduce((function(e,t){return t.isRemoved||e.push({id:t.period.id,start:t.period.start,end:t.period.end}),e}),[]);_.length>0&&this.trigger("newAvailablePeriods",_)},r.addTrackReference=function(e,t,n,r){var i=this,a=Sn(this._storedPeriodInfo,n.id);if(void 0===a&&(a=this._addPeriod(n),this.trigger("newAvailablePeriods",[{id:n.id,start:n.start,end:n.end}])),null===a[e].dispatcher){var o=a[e].storedSettings,u=new _n(t,r,o);a[e].dispatcher=u,u.addEventListener("noPlayableLockedRepresentation",(function(){null==o||o.lockedRepresentations.setValue(null),i.trigger("brokenRepresentationsLock",{period:{id:n.id,start:n.start,end:n.end},trackType:e})}))}else s.Z.error("TracksStore: Subject already added for "+e+" and Period "+n.start)},r.removeTrackReference=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){if(e[n].period.id===t.id)return n}}(this._storedPeriodInfo,t);if(void 0!==n){var r=this._storedPeriodInfo[n],i=r[e];null!==(null==i?void 0:i.dispatcher)?(i.dispatcher.dispose(),i.dispatcher=null,Tn(r)&&this._removePeriodObject(n)):s.Z.warn("TracksStore: TrackDispatcher already removed for "+e+" and Period "+t.start)}else s.Z.warn("TracksStore: "+e+" not found for period",t.start)},r.getPeriodObjectFromPeriod=function(e){var t=Sn(this._storedPeriodInfo,e.id);return void 0===t&&void 0!==e?this._cachedPeriodInfo.get(e):t},r.getPeriodObjectFromId=function(e){return Sn(this._storedPeriodInfo,e)},r.disableVideoTrickModeTracks=function(){this._isTrickModeTrackEnabled&&(this._isTrickModeTrackEnabled=!1,this._resetVideoTrackChoices("trickmode-disabled"))},r.enableVideoTrickModeTracks=function(){this._isTrickModeTrackEnabled||(this._isTrickModeTrackEnabled=!0,this._resetVideoTrackChoices("trickmode-enabled"))},r.resetPeriodObjects=function(){for(var e,t,n,r=this._storedPeriodInfo.length-1;r>=0;r--){var i=this._storedPeriodInfo[r];null===(e=i.audio.dispatcher)||void 0===e||e.dispose(),i.audio.dispatcher=null,null===(t=i.video.dispatcher)||void 0===t||t.dispose(),i.video.dispatcher=null,null===(n=i.text.dispatcher)||void 0===n||n.dispose(),i.text.dispatcher=null,i.inManifest||this._removePeriodObject(r)}},r.isTrickModeEnabled=function(){return this._isTrickModeTrackEnabled},r.setAudioTrack=function(e,t,n,r){return this._setAudioOrTextTrack("audio",e,t,null!=n?n:this._defaultAudioTrackSwitchingMode,r)},r.setTextTrack=function(e,t){return this._setAudioOrTextTrack("text",e,t,"direct",null)},r._setAudioOrTextTrack=function(e,t,n,r,i){var a,o=t.period,s=(0,L.Z)(o.getSupportedAdaptations(e),(function(e){return e.id===n}));if(void 0===s)throw new Error("Wanted "+e+" track not found.");var u,l=t[e];if(null===i)u=(0,S.ZP)(null);else{var d=this._getRepresentationsToLock(s,i),c="audio"===e?this._defaultAudioTrackSwitchingMode:"direct";u=(0,S.ZP)({representations:d,switchingMode:c})}var f={adaptation:s,switchingMode:r,lockedRepresentations:u};if(l.storedSettings=f,this.trigger("trackUpdate",{period:In(o),trackType:e,reason:"manual"}),!this._isDisposed){var v=Sn(this._storedPeriodInfo,o.id);void 0!==v&&v[e].storedSettings===f&&(null===(a=v[e].dispatcher)||void 0===a||a.updateTrack(f))}},r.setVideoTrack=function(e,t,n,r){var i,a=e.period,o=(0,L.Z)(a.getSupportedAdaptations("video"),(function(e){return e.id===t}));if(void 0===o)throw new Error("Wanted video track not found.");var s,u=l.Z.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,d=e.video,c=kn(o,this._isTrickModeTrackEnabled);if(null===r)s=(0,S.ZP)(null);else{var f=this._getRepresentationsToLock(o,r),v=u;s=(0,S.ZP)({representations:f,switchingMode:v})}var p={adaptationBase:o,switchingMode:null!=n?n:u,adaptation:c,lockedRepresentations:s};if(d.storedSettings=p,this.trigger("trackUpdate",{period:In(a),trackType:"video",reason:"manual"}),!this._isDisposed){var h=Sn(this._storedPeriodInfo,a.id);void 0!==h&&h.video.storedSettings===p&&(null===(i=h.video.dispatcher)||void 0===i||i.updateTrack(p))}},r.disableTrack=function(e,t){var n,r,i=e[t];if(null!==i.storedSettings&&("text"!==t&&(null===(n=e[t].storedSettings)||void 0===n||n.lockedRepresentations.finish()),i.storedSettings=null,this.trigger("trackUpdate",{period:In(e.period),trackType:t,reason:"manual"}),!this._isDisposed)){var a=Sn(this._storedPeriodInfo,e.period.id);void 0!==a&&null===a[t].storedSettings&&(null===(r=a[t].dispatcher)||void 0===r||r.updateTrack(null))}},r.getChosenAudioTrack=function(e){return null===e.audio.storedSettings?null:function(e){var t={language:(0,C.Z)(e.language,""),normalized:(0,C.Z)(e.normalizedLanguage,""),audioDescription:!0===e.isAudioDescription,id:e.id,representations:e.representations.map(wn),label:e.label};!0===e.isDub&&(t.dub=!0);return t}(e.audio.storedSettings.adaptation)},r.getChosenTextTrack=function(e){return null===e.text.storedSettings?null:function(e){var t,n,r={language:null!==(t=e.language)&&void 0!==t?t:"",normalized:null!==(n=e.normalizedLanguage)&&void 0!==n?n:"",closedCaption:!0===e.isClosedCaption,id:e.id,label:e.label};void 0!==e.isForcedSubtitles&&(r.forced=e.isForcedSubtitles);return r}(e.text.storedSettings.adaptation)},r.getChosenVideoTrack=function(e){return null===e.video.storedSettings?null:function(e){var t=void 0!==e.trickModeTracks?e.trickModeTracks.map((function(e){var t=e.getPlayableRepresentations().map(En),n={id:e.id,representations:t,isTrickModeTrack:!0};return!0===e.isSignInterpreted&&(n.signInterpreted=!0),n})):void 0,n={id:e.id,representations:e.getPlayableRepresentations().map(En),label:e.label};!0===e.isSignInterpreted&&(n.signInterpreted=!0);!0===e.isTrickModeTrack&&(n.isTrickModeTrack=!0);void 0!==t&&(n.trickModeTracks=t);return n}(e.video.storedSettings.adaptation)},r.getAvailableAudioTracks=function(e){var t=e.audio.storedSettings,n=null!==t?t.adaptation.id:null;return e.period.getSupportedAdaptations("audio").map((function(e){var t={language:(0,C.Z)(e.language,""),normalized:(0,C.Z)(e.normalizedLanguage,""),audioDescription:!0===e.isAudioDescription,id:e.id,active:null!==n&&n===e.id,representations:e.getPlayableRepresentations().map(wn),label:e.label};return!0===e.isDub&&(t.dub=!0),t}))},r.getAvailableTextTracks=function(e){var t=e.text.storedSettings,n=null!==t?t.adaptation.id:null;return e.period.getSupportedAdaptations("text").map((function(e){var t={language:(0,C.Z)(e.language,""),normalized:(0,C.Z)(e.normalizedLanguage,""),closedCaption:!0===e.isClosedCaption,id:e.id,active:null!==n&&n===e.id,label:e.label};return void 0!==e.isForcedSubtitles&&(t.forced=e.isForcedSubtitles),t}))},r.getAvailableVideoTracks=function(e){var t=e.video.storedSettings,n=null===t?void 0:t.adaptation.id;return e.period.getSupportedAdaptations("video").map((function(e){var t=void 0!==e.trickModeTracks?e.trickModeTracks.map((function(e){var t=null!==n&&n===e.id,r=e.getPlayableRepresentations().map(En),i={id:e.id,representations:r,isTrickModeTrack:!0,active:t};return!0===e.isSignInterpreted&&(i.signInterpreted=!0),i})):void 0,r={id:e.id,active:null!==n&&n===e.id,representations:e.getPlayableRepresentations().map(En),label:e.label};return!0===e.isSignInterpreted&&(r.signInterpreted=!0),void 0!==t&&(r.trickModeTracks=t),r}))},r.getLockedAudioRepresentations=function(e){var t=e.audio.storedSettings;if(null===t)return null;var n=t.lockedRepresentations.getValue();return null===n?null:n.representations.map((function(e){return e.id}))},r.getLockedVideoRepresentations=function(e){var t=e.video.storedSettings;if(null===t)return null;var n=t.lockedRepresentations.getValue();return null===n?null:n.representations.map((function(e){return e.id}))},r.lockAudioRepresentations=function(e,t){var n,r=e.audio.storedSettings;if(null!==r){var i=l.Z.getCurrent().DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE,a=this._getRepresentationsToLock(r.adaptation,t.representations),o=null!==(n=t.switchingMode)&&void 0!==n?n:i;r.lockedRepresentations.setValue({representations:a,switchingMode:o})}},r.lockVideoRepresentations=function(e,t){var n,r=e.video.storedSettings;if(null!==r){var i=l.Z.getCurrent().DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE,a=this._getRepresentationsToLock(r.adaptation,t.representations),o=null!==(n=t.switchingMode)&&void 0!==n?n:i;r.lockedRepresentations.setValue({representations:a,switchingMode:o})}},r.unlockAudioRepresentations=function(e){var t=e.audio.storedSettings;null!==t&&null!==t.lockedRepresentations.getValue()&&t.lockedRepresentations.setValue(null)},r.unlockVideoRepresentations=function(e){var t=e.video.storedSettings;null!==t&&null!==t.lockedRepresentations.getValue()&&t.lockedRepresentations.setValue(null)},r.dispose=function(){for(this._isDisposed=!0;;){var e=this._storedPeriodInfo.pop();if(void 0===e)return;e.isRemoved=!0}},r._addPeriod=function(e){for(var t=An(e,!1,this._isTrickModeTrackEnabled,this._defaultAudioTrackSwitchingMode),n=0;n<this._storedPeriodInfo.length;n++)if(this._storedPeriodInfo[n].period.start>e.start)return this._storedPeriodInfo.splice(n,0,t),t;return this._storedPeriodInfo.push(t),t},r._resetVideoTrackChoices=function(e){for(var t,n=0;n<this._storedPeriodInfo.length;n++){var r=this._storedPeriodInfo[n];if(null!==r.video.storedSettings){var i=r.video.storedSettings.adaptationBase;if(null!==i){var a=kn(i,this._isTrickModeTrackEnabled);r.video.storedSettings.adaptationBase=i,r.video.storedSettings.adaptation=a}}}for(var o=this._storedPeriodInfo.slice(),s=0;s<o.length;s++){var u=o[s].period,l=o[s].video.storedSettings;if(this.trigger("trackUpdate",{period:In(u),trackType:"video",reason:e}),this._isDisposed)return;var d=Sn(this._storedPeriodInfo,u.id);void 0!==d&&d.video.storedSettings===l&&(null===(t=d.video.dispatcher)||void 0===t||t.updateTrack(l))}},r._removePeriodObject=function(e){var t=this._storedPeriodInfo[e];this._storedPeriodInfo[e].isRemoved=!0,this._storedPeriodInfo.splice(e,1),this._cachedPeriodInfo.set(t.period,t)},r._getRepresentationsToLock=function(e,t){var n=t.reduce((function(t,n){var r=(0,L.Z)(e.representations,(function(e){return e.id===n}));return void 0===r?s.Z.warn("API: Wanted locked Representation not found."):t.push(r),t}),[]);if(0===n.length)throw new Error("Cannot lock Representations: None of the given Representation id are found");return n},n}(m.Z);function Sn(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.period.id===t)return r}}function En(e){return{id:e.id,bitrate:e.bitrate,frameRate:e.frameRate,width:e.width,height:e.height,codec:e.codec,hdrInfo:e.hdrInfo}}function Tn(e){var t,n,r;return!e.inManifest&&null===(null===(t=e.text)||void 0===t?void 0:t.dispatcher)&&null===(null===(n=e.audio)||void 0===n?void 0:n.dispatcher)&&null===(null===(r=e.video)||void 0===r?void 0:r.dispatcher)}function wn(e){return{id:e.id,bitrate:e.bitrate,codec:e.codec}}function kn(e,t){var n;return t&&void 0!==(null===(n=e.trickModeTracks)||void 0===n?void 0:n[0])?e.trickModeTracks[0]:e}function An(e,t,n,r){var i,a=e.getSupportedAdaptations("audio")[0],o=e.getSupportedAdaptations("video")[0],s=kn(o,n),u=l.Z.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,d=void 0!==a?{adaptation:a,switchingMode:r,lockedRepresentations:(0,S.ZP)(null)}:null,c=void 0!==s?{adaptation:s,adaptationBase:o,switchingMode:u,lockedRepresentations:(0,S.ZP)(null)}:null,f=null,v=e.getAdaptationsForType("text").filter((function(e){return!0===e.isForcedSubtitles}));if(v.length>0){if(null!=a){var p=(0,L.Z)(v,(function(e){return e.normalizedLanguage===a.normalizedLanguage}));void 0!==p&&(f=p)}null===f&&(f=null!==(i=(0,L.Z)(v,(function(e){return void 0===e.normalizedLanguage})))&&void 0!==i?i:null)}var h=null;return null!==f&&(h={adaptation:f,switchingMode:"direct",lockedRepresentations:(0,S.ZP)(null)}),{period:e,inManifest:t,isRemoved:!1,audio:{storedSettings:d,dispatcher:null},video:{storedSettings:c,dispatcher:null},text:{storedSettings:h,dispatcher:null}}}function In(e){return{start:e.start,end:e.end,id:e.id}}function Rn(e,t){var n=l.Z.getCurrent().FORCED_ENDED_THRESHOLD;if(e.ended)return"ENDED";if(null!==t){var r=Math.abs(e.duration-e.currentTime);return null!=n&&r<n?"ENDED":"seeking"===t?"SEEKING":"freezing"===t?"FREEZING":"BUFFERING"}return e.paused?"PAUSED":"PLAYING"}function Zn(e){return"LOADING"!==e&&"RELOADING"!==e&&"STOPPED"!==e}function xn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Mn=(0,g.Z)(),Cn=i.w0,Dn=i.it,Nn=i.bD,On=i.c9,Ln=function(n){function r(e){var t;void 0===e&&(e={}),t=n.call(this)||this;var r=function(e){var t,n,r,i,a,o,s=l.Z.getCurrent(),u=s.DEFAULT_BASE_BANDWIDTH,d=s.DEFAULT_VIDEO_RESOLUTION_LIMIT,c=s.DEFAULT_MAX_BUFFER_AHEAD,f=s.DEFAULT_MAX_BUFFER_BEHIND,v=s.DEFAULT_MAX_VIDEO_BUFFER_SIZE,p=s.DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN,h=s.DEFAULT_WANTED_BUFFER_AHEAD;if((0,y.Z)(e.maxBufferAhead))t=c;else if(t=Number(e.maxBufferAhead),isNaN(t))throw new Error("Invalid maxBufferAhead parameter. Should be a number.");if((0,y.Z)(e.maxBufferBehind))n=f;else if(n=Number(e.maxBufferBehind),isNaN(n))throw new Error("Invalid maxBufferBehind parameter. Should be a number.");if((0,y.Z)(e.wantedBufferAhead))r=h;else if(r=Number(e.wantedBufferAhead),isNaN(r))throw new Error("Invalid wantedBufferAhead parameter. Should be a number.");if((0,y.Z)(e.maxVideoBufferSize))i=v;else if(i=Number(e.maxVideoBufferSize),isNaN(i))throw new Error("Invalid maxVideoBufferSize parameter. Should be a number.");var m=(0,y.Z)(e.videoResolutionLimit)?d:e.videoResolutionLimit,g=(0,y.Z)(e.throttleVideoBitrateWhenHidden)?p:!!e.throttleVideoBitrateWhenHidden;if((0,y.Z)(e.videoElement))a=document.createElement("video");else{if(!(e.videoElement instanceof HTMLMediaElement))throw new Error("Invalid videoElement parameter. Should be a HTMLMediaElement.");a=e.videoElement}if((0,y.Z)(e.baseBandwidth))o=u;else if(o=Number(e.baseBandwidth),isNaN(o))throw new Error("Invalid baseBandwidth parameter. Should be a number.");return{maxBufferAhead:t,maxBufferBehind:n,videoResolutionLimit:m,videoElement:a,wantedBufferAhead:r,maxVideoBufferSize:i,throttleVideoBitrateWhenHidden:g,baseBandwidth:o}}(e),i=r.baseBandwidth,a=r.videoResolutionLimit,o=r.maxBufferAhead,u=r.maxBufferBehind,d=r.throttleVideoBitrateWhenHidden,c=r.videoElement,f=r.wantedBufferAhead,v=r.maxVideoBufferSize,p=l.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;c.preload="auto",t.version="4.0.0-beta.0",t.log=s.Z,t.state="STOPPED",t.videoElement=c;var h=new E.ZP;return t._destroyCanceller=h,t._priv_pictureInPictureRef=Cn(c,h.signal),t._priv_speed=(0,S.ZP)(c.playbackRate,t._destroyCanceller.signal),t._priv_preferTrickModeTracks=!1,t._priv_contentLock=(0,S.ZP)(!1,t._destroyCanceller.signal),t._priv_bufferOptions={wantedBufferAhead:(0,S.ZP)(f,t._destroyCanceller.signal),maxBufferAhead:(0,S.ZP)(o,t._destroyCanceller.signal),maxBufferBehind:(0,S.ZP)(u,t._destroyCanceller.signal),maxVideoBufferSize:(0,S.ZP)(v,t._destroyCanceller.signal)},t._priv_bitrateInfos={lastBitrates:{audio:i,video:i}},t._priv_throttleVideoBitrateWhenHidden=d,t._priv_videoResolutionLimit=a,t._priv_mutedMemory=p,t._priv_currentError=null,t._priv_contentInfos=null,t._priv_contentEventsMemory={},t._priv_setPlayerState("STOPPED"),t._priv_reloadingMetadata={},t}(0,t.Z)(r,n);var i=r.prototype;return i.addEventListener=function(e,t){return n.prototype.addEventListener.call(this,e,t)},i.stop=function(){null!==this._priv_contentInfos&&this._priv_contentInfos.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),"STOPPED"!==this.state&&this._priv_setPlayerState("STOPPED")},i.dispose=function(){this.stop(),null!==this.videoElement&&R(this.videoElement).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";s.Z.error("API: Could not dispose decryption resources: "+t)})),this._destroyCanceller.cancel(),this._priv_reloadingMetadata={},this.videoElement=null},i.loadVideo=function(e){var t=function(e){var t,n,r,i,a,o,u,d,c,f=l.Z.getCurrent(),v=f.DEFAULT_AUTO_PLAY,p=f.DEFAULT_CODEC_SWITCHING_BEHAVIOR,h=f.DEFAULT_ENABLE_FAST_SWITCHING,m=f.DEFAULT_TEXT_TRACK_MODE;if((0,y.Z)(e))throw new Error("No option set on loadVideo");if((0,y.Z)(e.url)){if((0,y.Z)(e.initialManifest)&&(0,y.Z)(e.manifestLoader))throw new Error("Unable to load a content: no url set on loadVideo.\nPlease provide at least either an `url` argument, a `initialManifest` option or a `manifestLoader` option so the RxPlayer can load the content.")}else i=String(e.url);if((0,y.Z)(e.transport))throw new Error("No transport set on loadVideo");a=String(e.transport);var g=(0,y.Z)(e.autoPlay)?v:!!e.autoPlay;if((0,y.Z)(e.keySystems))o=[];else for(var b,S=fn(o=Array.isArray(e.keySystems)?e.keySystems:[e.keySystems]);!(b=S()).done;){var E=b.value;if("string"!=typeof E.type||"function"!=typeof E.getLicense)throw new Error("Invalid key system given: Missing type string or getLicense callback")}var T=void 0!==e.lowLatencyMode&&!!e.lowLatencyMode,w=e.initialManifest,k=null!==(t=e.minimumManifestUpdateInterval)&&void 0!==t?t:0,A=null!==(n=e.defaultAudioTrackSwitchingMode)&&void 0!==n?n:void 0;void 0===A||(0,Ee.Z)(["seamless","direct","reload"],A)||(s.Z.warn("The `defaultAudioTrackSwitchingMode` loadVideo option must match one of the following strategy name:\n- `seamless`\n- `direct`\n- `reload`"),A=void 0);var I=(0,y.Z)(e.onCodecSwitch)?p:e.onCodecSwitch;if((0,Ee.Z)(["continue","reload"],I)||(s.Z.warn("The `onCodecSwitch` loadVideo option must match one of the following string:\n- `continue`\n- `reload`\nIf badly set, "+p+" will be used as default"),I=p),(0,y.Z)(e.textTrackMode))u=m;else{if("native"!==e.textTrackMode&&"html"!==e.textTrackMode)throw new Error("Invalid textTrackMode.");u=e.textTrackMode}var R=(0,y.Z)(e.enableFastSwitching)?h:e.enableFastSwitching;if("html"===u){if((0,y.Z)(e.textTrackElement))throw new Error('You have to provide a textTrackElement in "html" textTrackMode.');if(!(e.textTrackElement instanceof HTMLElement))throw new Error("textTrackElement should be an HTMLElement.");d=e.textTrackElement}else(0,y.Z)(e.textTrackElement)||s.Z.warn('API: You have set a textTrackElement without being in an "html" textTrackMode. It will be ignored.');if(!(0,y.Z)(e.startAt))if(e.startAt.wallClockTime instanceof Date){var Z=e.startAt.wallClockTime.getTime()/1e3;c=(0,_.Z)({},e.startAt,{wallClockTime:Z})}else c=e.startAt;var x=null!==(r=e.requestConfig)&&void 0!==r?r:{};return{__priv_patchLastSegmentInSidx:e.__priv_patchLastSegmentInSidx,checkMediaSegmentIntegrity:e.checkMediaSegmentIntegrity,autoPlay:g,defaultAudioTrackSwitchingMode:A,enableFastSwitching:R,initialManifest:w,keySystems:o,lowLatencyMode:T,manifestLoader:e.manifestLoader,manifestUpdateUrl:e.manifestUpdateUrl,minimumManifestUpdateInterval:k,requestConfig:x,onCodecSwitch:I,referenceDateTime:e.referenceDateTime,representationFilter:e.representationFilter,segmentLoader:e.segmentLoader,serverSyncInfos:e.serverSyncInfos,startAt:c,textTrackElement:d,textTrackMode:u,transport:a,url:i}}(e);s.Z.info("API: Calling loadvideo",t.url,t.transport),this._priv_reloadingMetadata={options:t},this._priv_initializeContentPlayback(t)},i.reload=function(e){var t,n,r,i,a=this._priv_reloadingMetadata,o=a.options,s=a.manifest,u=a.reloadPosition,l=a.reloadInPause;if(void 0===o)throw new Error("API: Can't reload without having previously loaded a content.");if(function(e){var t,n,r,i;if(null===e||"object"!=typeof e&&void 0!==e)throw new Error("API: reload - Invalid options format.");if(null===(null==e?void 0:e.reloadAt)||"object"!=typeof(null==e?void 0:e.reloadAt)&&void 0!==(null==e?void 0:e.reloadAt))throw new Error("API: reload - Invalid 'reloadAt' option format.");if("number"!=typeof(null===(t=null==e?void 0:e.reloadAt)||void 0===t?void 0:t.position)&&void 0!==(null===(n=null==e?void 0:e.reloadAt)||void 0===n?void 0:n.position))throw new Error("API: reload - Invalid 'reloadAt.position' option format.");if("number"!=typeof(null===(r=null==e?void 0:e.reloadAt)||void 0===r?void 0:r.relative)&&void 0!==(null===(i=null==e?void 0:e.reloadAt)||void 0===i?void 0:i.relative))throw new Error("API: reload - Invalid 'reloadAt.relative' option format.")}(e),void 0!==(null===(t=null==e?void 0:e.reloadAt)||void 0===t?void 0:t.position))r={position:e.reloadAt.position};else if(void 0!==(null===(n=null==e?void 0:e.reloadAt)||void 0===n?void 0:n.relative)){if(void 0===u)throw new Error("Can't reload to a relative position when previous content was not loaded.");r={position:e.reloadAt.relative+u}}else void 0!==u&&(r={position:u});void 0!==(null==e?void 0:e.autoPlay)?i=e.autoPlay:void 0!==l&&(i=!l);var d=Object.assign(Object.assign({},o),{initialManifest:s});void 0!==r&&(d.startAt=r),void 0!==i&&(d.autoPlay=i),this._priv_initializeContentPlayback(d)},i._priv_initializeContentPlayback=function(e){var t,n,r,i,a=this,o=e.autoPlay,l=e.defaultAudioTrackSwitchingMode,c=e.enableFastSwitching,f=e.initialManifest,p=e.keySystems,h=e.lowLatencyMode,m=e.minimumManifestUpdateInterval,g=e.requestConfig,y=e.onCodecSwitch,b=e.startAt,T=e.transport,w=e.checkMediaSegmentIntegrity,k=e.manifestLoader,A=e.manifestUpdateUrl,I=e.referenceDateTime,R=e.representationFilter,Z=e.segmentLoader,x=e.serverSyncInfos,P=e.__priv_patchLastSegmentInSidx,M=e.url;if(null===this.videoElement)throw new Error("the attached video element is disposed");var C,D="directfile"===T,N=new E.ZP,O=this.videoElement,L=null;if(D){if(null===v.Z.directfile)throw this.stop(),this._priv_currentError=null,new Error("DirectFile feature not activated in your build.");if(L=this._priv_initializeMediaElementTracksStore(N.signal),N.isUsed)return;C=new v.Z.directfile.initDirectFile({autoPlay:o,keySystems:p,speed:this._priv_speed,startAt:b,url:M})}else{var U=v.Z.transports[T];if("function"!=typeof U)throw this.stop(),this._priv_currentError=null,new Error('transport "'+T+'" not supported');var B=U({lowLatencyMode:h,checkMediaSegmentIntegrity:w,manifestLoader:k,manifestUpdateUrl:A,referenceDateTime:I,representationFilter:R,segmentLoader:Z,serverSyncInfos:x,__priv_patchLastSegmentInSidx:P}),F={lowLatencyMode:h,maxRetry:null===(t=g.manifest)||void 0===t?void 0:t.maxRetry,requestTimeout:null===(n=g.manifest)||void 0===n?void 0:n.timeout,minimumManifestUpdateInterval:m,initialManifest:f},z=u(),V={throttleBitrate:{},limitResolution:{}};this._priv_throttleVideoBitrateWhenHidden&&(z?V.throttleBitrate={video:(0,S.lR)(Dn(this._priv_pictureInPictureRef,N.signal),(function(e){return e?1/0:0}),N.signal)}:s.Z.warn("API: Can't apply throttleVideoBitrateWhenHidden because browser can't be trusted for visibility.")),"videoElement"===this._priv_videoResolutionLimit?z?V.limitResolution={video:Nn(O,this._priv_pictureInPictureRef,N.signal)}:s.Z.warn("API: Can't apply videoResolutionLimit because browser can't be trusted for video size."):"screen"===this._priv_videoResolutionLimit&&(V.limitResolution={video:On(N.signal)});var K={initialBitrates:this._priv_bitrateInfos.lastBitrates,lowLatencyMode:h,throttlers:V},G="native"===e.textTrackMode?{textTrackMode:"native"}:{textTrackMode:"html",textTrackElement:e.textTrackElement},j=(0,_.Z)({enableFastSwitching:c,onCodecSwitch:y},this._priv_bufferOptions),H={lowLatencyMode:h,maxRetry:null===(r=g.segment)||void 0===r?void 0:r.maxRetry,requestTimeout:null===(i=g.segment)||void 0===i?void 0:i.timeout};C=new cn({adaptiveOptions:K,autoPlay:o,bufferOptions:j,keySystems:p,lowLatencyMode:h,manifestRequestSettings:F,transport:B,segmentRequestOptions:H,speed:this._priv_speed,startAt:b,textTrackOptions:G,url:M})}var W={contentId:Mn(),originalUrl:M,currentContentCanceller:N,defaultAudioTrackSwitchingMode:l,initializer:C,isDirectFile:D,segmentBuffersStore:null,manifest:null,currentPeriod:null,activeAdaptations:null,activeRepresentations:null,tracksStore:null,mediaElementTracksStore:L};C.addEventListener("error",(function(e){var t=(0,d.Z)(e,{defaultCode:"NONE",defaultReason:"An unknown error stopped content playback."});t.fatal=!0,W.currentContentCanceller.cancel(),a._priv_cleanUpCurrentContentState(),a._priv_currentError=t,s.Z.error("API: The player stopped because of an error",e instanceof Error?e:""),a._priv_setPlayerState("STOPPED"),a._priv_currentError===t&&a.trigger("error",t)})),C.addEventListener("warning",(function(e){var t=(0,d.Z)(e,{defaultCode:"NONE",defaultReason:"An unknown error happened."});s.Z.warn("API: Sending warning:",t),a.trigger("warning",t)})),C.addEventListener("reloadingMediaSource",(function(){W.segmentBuffersStore=null,null!==W.tracksStore&&W.tracksStore.resetPeriodObjects()})),C.addEventListener("inbandEvents",(function(e){return a.trigger("inbandEvents",e)})),C.addEventListener("streamEvent",(function(e){return a.trigger("streamEvent",e)})),C.addEventListener("streamEventSkip",(function(e){return a.trigger("streamEventSkip",e)})),C.addEventListener("activePeriodChanged",(function(e){return a._priv_onActivePeriodChanged(W,e)})),C.addEventListener("periodStreamReady",(function(e){return a._priv_onPeriodStreamReady(W,e)})),C.addEventListener("periodStreamCleared",(function(e){return a._priv_onPeriodStreamCleared(W,e)})),C.addEventListener("representationChange",(function(e){return a._priv_onRepresentationChange(W,e)})),C.addEventListener("adaptationChange",(function(e){return a._priv_onAdaptationChange(W,e)})),C.addEventListener("bitrateEstimateChange",(function(e){return a._priv_onBitrateEstimateChange(e)})),C.addEventListener("manifestReady",(function(e){return a._priv_onManifestReady(W,e)})),C.addEventListener("loaded",(function(e){W.segmentBuffersStore=e.segmentBuffersStore})),C.prepare(),this.stop();var q=new hn(O,{withMediaSource:!D,lowLatencyMode:h});N.signal.register((function(){q.stop()}));var Y=function(e,t,n,r){var i=(0,S.ZP)("LOADING",r);e.addEventListener("loaded",(function(){if("LOADING"===i.getValue()){if(i.setValue("LOADED"),!r.isCancelled){var e=Rn(t,null);"PAUSED"!==e&&i.setValue(e)}}else"RELOADING"===i.getValue()?i.setValue(Rn(t,null)):o(null)}),r),e.addEventListener("reloadingMediaSource",(function(){Zn(i.getValue())&&i.setValueIfChanged("RELOADING")}),r);var a=null;return e.addEventListener("stalled",(function(e){e!==a&&(o(e),a=e)}),r),e.addEventListener("unstalled",(function(){null!==a&&(o(null),a=null)}),r),n.listen((function(e){(0,Ee.Z)(["seeking","ended","play","pause"],e.event)&&o(a)}),{clearSignal:r}),i;function o(e){if(Zn(i.getValue())){var n=Rn(t,e);"LOADED"===i.getValue()&&"PAUSED"===n||i.setValueIfChanged(n)}}}(C,O,q,N.signal);N.signal.register((function(){C.dispose()}));var X=function(e){switch(e){case"STOPPED":case"RELOADING":case"LOADING":break;case"ENDED":a._priv_reloadingMetadata.reloadInPause=!0,a._priv_reloadingMetadata.reloadPosition=q.getReference().getValue().position;break;default:var t=q.getReference().getValue();a._priv_reloadingMetadata.reloadInPause=t.paused,a._priv_reloadingMetadata.reloadPosition=t.position}},Q=null;Y.onUpdate((function(e){X(e),a._priv_setPlayerState(e),N.isUsed||(null!==Q?Zn(a.state)||(Q.cancel(),Q=null):Zn(a.state)&&(Q=new E.ZP({cancelOn:N.signal}),function(e,t,n,r,i){if(!i.isCancelled&&null!==e){var a=t.getReference().getValue().seeking;a&&(n(),i.isCancelled)||t.listen((function(e){"seeking"===e.event?(a=!0,n()):a&&"seeked"===e.event&&(a=!1,r())}),{includeLastObservation:!0,clearSignal:i})}}(O,q,(function(){return a.trigger("seeking",null)}),(function(){return a.trigger("seeked",null)}),Q.signal)))}),{emitCurrentValue:!0,clearSignal:N.signal}),q.listen((function(e){X(a.state),a._priv_triggerPositionUpdate(W,e)}),{clearSignal:N.signal}),this._priv_currentError=null,this._priv_contentInfos=W,N.signal.register((function(){C.removeEventListener()})),this._priv_contentLock.onUpdate((function(e,t){e||(t(),C.start(O,q))}),{emitCurrentValue:!0,clearSignal:N.signal})},i.getError=function(){return this._priv_currentError},i.getVideoElement=function(){return this.videoElement},i.getPlayerState=function(){return this.state},i.isLive=function(){if(null===this._priv_contentInfos)return!1;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;return!t&&null!==n&&n.isLive},i.areTrickModeTracksEnabled=function(){return this._priv_preferTrickModeTracks},i.getContentUrls=function(){if(null!==this._priv_contentInfos){var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest,r=e.originalUrl;return t?void 0===r?void 0:[r]:null!==n?n.getUrls():void 0}},i.updateContentUrls=function(e,t){if(null===this._priv_contentInfos)throw new Error("No content loaded");var n=!0===(null==t?void 0:t.refresh);this._priv_contentInfos.initializer.updateContentUrls(e,n)},i.getMediaDuration=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration},i.getCurrentBufferGap=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement,t=(0,b.L7)(e.buffered,e.currentTime);return t===1/0?0:t},i.getWallClockTime=function(){if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)return this.videoElement.currentTime;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){var r=a(this.videoElement);return(null!=r?r:0)+this.videoElement.currentTime}return null!==n?this.videoElement.currentTime+(void 0!==n.availabilityStartTime?n.availabilityStartTime:0):0},i.getPosition=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.currentTime},i.getPlaybackRate=function(){return this._priv_speed.getValue()},i.setPlaybackRate=function(e,t){var n;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);var r=null==t?void 0:t.preferTrickModeTracks;if("boolean"==typeof r){this._priv_preferTrickModeTracks=r;var i=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.tracksStore;(0,y.Z)(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}},i.getVideoRepresentation=function(){var e=this._priv_getCurrentRepresentations();if(null!==e)return e.video},i.getAudioRepresentation=function(){var e=this._priv_getCurrentRepresentations();if(null!==e)return e.audio},i.play=function(){var e=this;if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement.play();return(0,y.Z)(t)||"function"!=typeof t.catch?Promise.resolve():t.catch((function(t){if("NotAllowedError"===t.name){var n=new c.Z("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());e.trigger("warning",n)}throw t}))},i.pause=function(){if(null===this.videoElement)throw new Error("Disposed player");this.videoElement.pause()},i.seekTo=function(e){var t;if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)throw new Error("player: no content loaded");var n,r=this._priv_contentInfos,i=r.isDirectFile,o=r.manifest;if(!i&&null===o)throw new Error("player: the content did not load yet");if("number"==typeof e)n=e;else if("object"==typeof e){var s=e,u=this.videoElement.currentTime;if((0,y.Z)(s.relative))if((0,y.Z)(s.position)){if((0,y.Z)(s.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(null!==o)n=s.wallClockTime-(null!==(t=o.availabilityStartTime)&&void 0!==t?t:0);else if(i&&null!==this.videoElement){var l=a(this.videoElement);void 0!==l&&(n=s.wallClockTime-l)}void 0===n&&(n=s.wallClockTime)}else n=s.position;else n=u+s.relative}if(void 0===n)throw new Error("invalid time given");return this.videoElement.currentTime=n,n},i.getVolume=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.volume},i.setVolume=function(e){if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement;e!==t.volume&&(t.volume=e,this.trigger("volumeChange",e))},i.isMute=function(){return 0===this.getVolume()},i.mute=function(){this._priv_mutedMemory=this.getVolume(),this.setVolume(0)},i.unMute=function(){var e=l.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;0===this.getVolume()&&this.setVolume(0===this._priv_mutedMemory?e:this._priv_mutedMemory)},i.setMaxBufferBehind=function(e){this._priv_bufferOptions.maxBufferBehind.setValue(e)},i.setMaxBufferAhead=function(e){this._priv_bufferOptions.maxBufferAhead.setValue(e)},i.setWantedBufferAhead=function(e){this._priv_bufferOptions.wantedBufferAhead.setValue(e)},i.setMaxVideoBufferSize=function(e){this._priv_bufferOptions.maxVideoBufferSize.setValue(e)},i.getMaxBufferBehind=function(){return this._priv_bufferOptions.maxBufferBehind.getValue()},i.getMaxBufferAhead=function(){return this._priv_bufferOptions.maxBufferAhead.getValue()},i.getWantedBufferAhead=function(){return this._priv_bufferOptions.wantedBufferAhead.getValue()},i.getMaxVideoBufferSize=function(){return this._priv_bufferOptions.maxVideoBufferSize.getValue()},i.getCurrentPeriod=function(){var e,t=null===(e=this._priv_contentInfos)||void 0===e?void 0:e.currentPeriod;return(0,y.Z)(t)?null:{id:t.id,start:t.start,end:t.end}},i.getKeySystemConfiguration=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=x(this.videoElement);return null===e?null:{keySystem:e[0],configuration:e[1]}},i.getAvailablePeriods=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.isDirectFile,n=e.tracksStore;return t||null===n?[]:n.getAvailablePeriods().slice()},i.getAvailableAudioTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableAudioTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableAudioTracks(t))&&void 0!==n?n:[]}))},i.getAvailableTextTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableTextTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableTextTracks(t))&&void 0!==n?n:[]}))},i.getAvailableVideoTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableVideoTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableVideoTracks(t))&&void 0!==n?n:[]}))},i.getAudioTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenAudioTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenAudioTrack(t)}))}},i.getTextTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenTextTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenTextTrack(t)}))}},i.getVideoTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenVideoTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenVideoTrack(t)}))}},i.setAudioTrack=function(e){var t;if(null===this._priv_contentInfos)throw new Error("No content loaded");var n,r,i,a=this._priv_contentInfos,o=a.isDirectFile,s=a.mediaElementTracksStore;if(o)try{var u="string"==typeof e?e:e.trackId;return void(null==s||s.setAudioTrackById(u))}catch(e){throw new Error("player: unknown audio track")}var l=null;return"string"==typeof e?r=e:(r=e.trackId,n=e.periodId,i=e.switchingMode,l=null!==(t=e.lockedRepresentations)&&void 0!==t?t:null),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,t){return e.setAudioTrack(t,r,i,l)}))},i.setTextTrack=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r=this._priv_contentInfos,i=r.isDirectFile,a=r.mediaElementTracksStore;if(i)try{var o="string"==typeof e?e:e.trackId;return void(null==a||a.setTextTrackById(o))}catch(e){throw new Error("player: unknown text track")}return"string"==typeof e?n=e:(n=e.trackId,t=e.periodId),this._priv_callTracksStoreGetterSetter(t,void 0,(function(e,t){return e.setTextTrack(t,n)}))},i.disableTextTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(!n)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.disableTrack(t,"text")}));null==r||r.disableTextTrack()}},i.setVideoTrack=function(e){var t;if(null===this._priv_contentInfos)throw new Error("No content loaded");var n,r,i,a=this._priv_contentInfos,o=a.isDirectFile,s=a.mediaElementTracksStore;if(o)try{var u="string"==typeof e?e:e.trackId;return void(null==s||s.setVideoTrackById(u))}catch(e){throw new Error("player: unknown video track")}var l=null;return"string"==typeof e?r=e:(r=e.trackId,n=e.periodId,i=e.switchingMode,l=null!==(t=e.lockedRepresentations)&&void 0!==t?t:null),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,t){return e.setVideoTrack(t,r,i,l)}))},i.disableVideoTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;return n&&null!==r?r.disableVideoTrack():this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.disableTrack(t,"video")}))}},i.lockVideoRepresentations=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r;if(this._priv_contentInfos.isDirectFile)throw new Error("Cannot lock video Representations in directfile mode.");return Array.isArray(e)?(t=e,n=void 0):(t=e.representations,n=e.periodId,r=e.switchingMode),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,n){return e.lockVideoRepresentations(n,{representations:t,switchingMode:r})}))},i.lockAudioRepresentations=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r;if(this._priv_contentInfos.isDirectFile)throw new Error("Cannot lock audio Representations in directfile mode.");return Array.isArray(e)?(t=e,n=void 0):(t=e.representations,n=e.periodId,r=e.switchingMode),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,n){return e.lockAudioRepresentations(n,{representations:t,switchingMode:r})}))},i.getLockedVideoRepresentations=function(e){return null===this._priv_contentInfos||this._priv_contentInfos.isDirectFile?null:this._priv_callTracksStoreGetterSetter(e,null,(function(e,t){return e.getLockedVideoRepresentations(t)}))},i.getLockedAudioRepresentations=function(e){return null===this._priv_contentInfos||this._priv_contentInfos.isDirectFile?null:this._priv_callTracksStoreGetterSetter(e,null,(function(e,t){return e.getLockedAudioRepresentations(t)}))},i.unlockVideoRepresentations=function(e){if(null!==this._priv_contentInfos&&!this._priv_contentInfos.isDirectFile)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.unlockVideoRepresentations(t)}))},i.unlockAudioRepresentations=function(e){if(null!==this._priv_contentInfos&&!this._priv_contentInfos.isDirectFile)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.unlockAudioRepresentations(t)}))},i.getMinimumPosition=function(){if(null===this._priv_contentInfos)return null;if(this._priv_contentInfos.isDirectFile)return 0;var e=this._priv_contentInfos.manifest;return null!==e?e.getMinimumSafePosition():null},i.getMaximumPosition=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration}return null!==n?n.isDynamic||null===this.videoElement?n.getMaximumSafePosition():this.videoElement.duration:null},i.__priv_getSegmentBufferContent=function(e){if(null===this._priv_contentInfos||null===this._priv_contentInfos.segmentBuffersStore)return null;var t=this._priv_contentInfos.segmentBuffersStore.getStatus(e);return"initialized"===t.type?t.value.getInventory():null},i.__priv_getManifest=function(){return null===this._priv_contentInfos?null:this._priv_contentInfos.manifest},i._priv_cleanUpCurrentContentState=function(){var e,t,n,r,i=this;s.Z.debug("Locking `contentLock` to clean-up the current content."),this._priv_contentLock.setValue(!0),null===(t=null===(e=this._priv_contentInfos)||void 0===e?void 0:e.tracksStore)||void 0===t||t.dispose(),null===(r=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.mediaElementTracksStore)||void 0===r||r.dispose(),this._priv_contentInfos=null,this._priv_contentEventsMemory={};var a=function(){null!==i.videoElement&&(s.Z.debug("Unlocking `contentLock`. Next content can begin."),i._priv_contentLock.setValue(!1))};(0,y.Z)(this.videoElement)?a():P(this.videoElement).then((function(){s.Z.debug("API: DRM session cleaned-up with success!"),a()}),(function(e){s.Z.error("API: An error arised when trying to clean-up the DRM session:"+(e instanceof Error?e.toString():"Unknown Error")),a()}))},i._priv_onManifestReady=function(e,t){var n,r=this;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.manifest=t;var i=e.currentContentCanceller.signal;this._priv_reloadingMetadata.manifest=t,e.tracksStore=new bn({preferTrickModeTracks:this._priv_preferTrickModeTracks,defaultAudioTrackSwitchingMode:e.defaultAudioTrackSwitchingMode}),e.tracksStore.addEventListener("newAvailablePeriods",(function(e){r.trigger("newAvailablePeriods",e)})),e.tracksStore.addEventListener("brokenRepresentationsLock",(function(e){r.trigger("brokenRepresentationsLock",e)})),e.tracksStore.addEventListener("trackUpdate",(function(e){r.trigger("trackUpdate",e)})),e.tracksStore.updatePeriodList(t),t.addEventListener("manifestUpdate",(function(n){var a,o,s;(0,y.Z)(null==e?void 0:e.tracksStore)||e.tracksStore.updatePeriodList(t);var u=null!==(o=null===(a=r._priv_contentInfos)||void 0===a?void 0:a.currentPeriod)&&void 0!==o?o:void 0,l=null===(s=r._priv_contentInfos)||void 0===s?void 0:s.tracksStore;if(void 0!==u&&!(0,y.Z)(l))for(var d,c=xn(n.updatedPeriods);!(d=c()).done;){var f=d.value;if(f.period.id===u.id&&(f.result.addedAdaptations.length>0||f.result.removedAdaptations.length>0)){var v=l.getPeriodObjectFromPeriod(u);if(void 0===v)return;var p=l.getAvailableAudioTracks(v);r._priv_triggerEventIfNotStopped("availableAudioTracksChange",null!=p?p:[],i);var h=l.getAvailableTextTracks(v);r._priv_triggerEventIfNotStopped("availableTextTracksChange",null!=h?h:[],i);var m=l.getAvailableVideoTracks(v);r._priv_triggerEventIfNotStopped("availableVideoTracksChange",null!=m?m:[],i)}return}}),e.currentContentCanceller.signal)}},i._priv_onActivePeriodChanged=function(e,t){var n,r,i,a,o,s,u=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.currentPeriod=u;var l=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==u&&(this._priv_contentEventsMemory.periodChange=u,this._priv_triggerEventIfNotStopped("periodChange",{start:u.start,end:u.end,id:u.id},l)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),l),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),l),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),l);var d=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.tracksStore;if((0,y.Z)(d))this._priv_triggerEventIfNotStopped("audioTrackChange",null,l),this._priv_triggerEventIfNotStopped("textTrackChange",null,l),this._priv_triggerEventIfNotStopped("videoTrackChange",null,l);else{var c=d.getPeriodObjectFromPeriod(u);if(c){var f=d.getChosenAudioTrack(c);this._priv_triggerEventIfNotStopped("audioTrackChange",f,l);var v=d.getChosenTextTrack(c);this._priv_triggerEventIfNotStopped("textTrackChange",v,l);var p=d.getChosenVideoTrack(c);this._priv_triggerEventIfNotStopped("videoTrackChange",p,l)}}var h=null!==(a=null===(i=this._priv_getCurrentRepresentations())||void 0===i?void 0:i.audio)&&void 0!==a?a:null;if(this._priv_triggerEventIfNotStopped("audioRepresentationChange",h,l),!e.currentContentCanceller.isUsed){var m=null!==(s=null===(o=this._priv_getCurrentRepresentations())||void 0===o?void 0:o.video)&&void 0!==s?s:null;this._priv_triggerEventIfNotStopped("videoRepresentationChange",m,l)}}},i._priv_onPeriodStreamReady=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.manifest,a=t.period,o=t.adaptationRef,u=e.tracksStore;switch(r){case"video":case"audio":case"text":(0,y.Z)(u)?(s.Z.error("API: TracksStore not instanciated for a new "+r+" period"),o.setValue(null)):u.addTrackReference(r,i,a,o);break;default:(0,h.Z)(r)}}},i._priv_onPeriodStreamCleared=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=e.tracksStore;switch(r){case"audio":case"text":case"video":(0,y.Z)(a)||a.removeTrackReference(r,i)}var o=e.activeAdaptations,s=e.activeRepresentations;if(!(0,y.Z)(o)&&!(0,y.Z)(o[i.id])){var u=o[i.id];delete u[r],0===Object.keys(u).length&&delete o[i.id]}if(!(0,y.Z)(s)&&!(0,y.Z)(s[i.id])){var l=s[i.id];delete l[r],0===Object.keys(l).length&&delete s[i.id]}}},i._priv_onAdaptationChange=function(e,t){var n,r=t.type,i=t.adaptation,a=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeAdaptations&&(e.activeAdaptations={});var o,s=e.activeAdaptations,u=e.currentPeriod,l=s[a.id];if((0,y.Z)(l))s[a.id]=((o={})[r]=i,o);else l[r]=i;var d=e.tracksStore,c=e.currentContentCanceller.signal;if(null!==d&&null!==u&&!(0,y.Z)(a)&&a.id===u.id){var f=d.getPeriodObjectFromPeriod(a);if(void 0===f)return;switch(r){case"audio":var v=d.getChosenAudioTrack(f);this._priv_triggerEventIfNotStopped("audioTrackChange",v,c);break;case"text":var p=d.getChosenTextTrack(f);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);break;case"video":var h=d.getChosenVideoTrack(f);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c)}}}},i._priv_onRepresentationChange=function(e,t){var n,r=t.type,i=t.period,a=t.representation;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeRepresentations&&(e.activeRepresentations={});var o,s=e.activeRepresentations,u=e.currentPeriod,l=s[i.id];if((0,y.Z)(l))s[i.id]=((o={})[r]=a,o);else l[r]=a;if(!(0,y.Z)(i)&&null!==u&&u.id===i.id){var d=this._priv_contentInfos.currentContentCanceller.signal;"video"===r?this._priv_triggerEventIfNotStopped("videoRepresentationChange",a,d):"audio"===r&&this._priv_triggerEventIfNotStopped("audioRepresentationChange",a,d)}}},i._priv_onBitrateEstimateChange=function(e){var t=e.type,n=e.bitrate;void 0!==n&&(this._priv_bitrateInfos.lastBitrates[t]=n),this.trigger("__priv_bitrateEstimateChange",{type:t,bitrate:n})},i._priv_setPlayerState=function(e){this.state!==e&&(this.state=e,s.Z.info("API: playerStateChange event",e),this.trigger("playerStateChange",e))},i._priv_triggerPositionUpdate=function(e,t){var n,r;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var i=e.isDirectFile,o=e.manifest;if((i||null!==o)&&!(0,y.Z)(t)){var s=null!==o?o.getMaximumSafePosition():void 0,u={position:t.position,duration:t.duration,playbackRate:t.playbackRate,maximumPosition:s,bufferGap:void 0!==t.bufferGap&&isFinite(t.bufferGap)?t.bufferGap:0};if(null!==o&&o.isLive&&t.position>0){var l=null!==(r=o.availabilityStartTime)&&void 0!==r?r:0;u.wallClockTime=t.position+l;var d=o.getLivePosition();void 0!==d&&(u.liveGap=d-t.position)}else if(i&&null!==this.videoElement){var c=a(this.videoElement);void 0!==c&&(u.wallClockTime=c+t.position)}this.trigger("positionUpdate",u)}}},i._priv_getCurrentRepresentations=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeRepresentations;return null===t||null===n||(0,y.Z)(n[t.id])?null:n[t.id]},i._priv_triggerEventIfNotStopped=function(e,t,n){n.isCancelled||this.trigger(e,t)},i._priv_initializeMediaElementTracksStore=function(e){var t,n,r,i=this;(0,p.Z)(null!==v.Z.directfile,"Initializing `MediaElementTracksStore` without Directfile feature"),(0,p.Z)(null!==this.videoElement,"Initializing `MediaElementTracksStore` on a disposed RxPlayer");var a=new v.Z.directfile.mediaElementTracksStore(this.videoElement);return this._priv_triggerEventIfNotStopped("availableAudioTracksChange",a.getAvailableAudioTracks(),e),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",a.getAvailableVideoTracks(),e),this._priv_triggerEventIfNotStopped("availableTextTracksChange",a.getAvailableTextTracks(),e),this._priv_triggerEventIfNotStopped("audioTrackChange",null!==(t=a.getChosenAudioTrack())&&void 0!==t?t:null,e),this._priv_triggerEventIfNotStopped("textTrackChange",null!==(n=a.getChosenTextTrack())&&void 0!==n?n:null,e),this._priv_triggerEventIfNotStopped("videoTrackChange",null!==(r=a.getChosenVideoTrack())&&void 0!==r?r:null,e),a.addEventListener("availableVideoTracksChange",(function(e){return i.trigger("availableVideoTracksChange",e)})),a.addEventListener("availableAudioTracksChange",(function(e){return i.trigger("availableAudioTracksChange",e)})),a.addEventListener("availableTextTracksChange",(function(e){return i.trigger("availableTextTracksChange",e)})),a.addEventListener("audioTrackChange",(function(e){return i.trigger("audioTrackChange",e)})),a.addEventListener("videoTrackChange",(function(e){return i.trigger("videoTrackChange",e)})),a.addEventListener("textTrackChange",(function(e){return i.trigger("textTrackChange",e)})),a},i._priv_callTracksStoreGetterSetter=function(e,t,n){var r,i;if(null===this._priv_contentInfos||null===this._priv_contentInfos.tracksStore)return s.Z.warn("API: Trying to call track API too soon"),t;var a=this._priv_contentInfos.tracksStore,o=null!==(i=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.currentPeriod)&&void 0!==i?i:void 0,u=null!=e?e:null==o?void 0:o.id;if(void 0===u)return t;var l=u===(null==o?void 0:o.id)?a.getPeriodObjectFromPeriod(o):a.getPeriodObjectFromId(u);return void 0===l?t:n(a,l)},(0,e.Z)(r,null,[{key:"ErrorTypes",get:function(){return f.ZB}},{key:"ErrorCodes",get:function(){return f.SM}},{key:"LogLevel",get:function(){return s.Z.getLevel()},set:function(e){s.Z.setLevel(e)}}]),r}(m.Z);Ln.version="4.0.0-beta.0";var Un=Ln,Bn=n(7273);!function(){Bn.Z.ContentDecryptor=n(1266).ZP,Bn.Z.transports.smooth=n(5418).Z,Bn.Z.transports.dash=n(2047).Z,Bn.Z.dashParsers.js=n(8337).Z,Bn.Z.nativeTextTracksBuffer=n(9059).Z,Bn.Z.nativeTextTracksParsers.vtt=n(9405).Z,Bn.Z.nativeTextTracksParsers.ttml=n(1570).Z,Bn.Z.nativeTextTracksParsers.sami=n(1812).Z,Bn.Z.nativeTextTracksParsers.srt=n(8057).Z,Bn.Z.htmlTextTracksBuffer=n(5192).Z,Bn.Z.htmlTextTracksParsers.sami=n(5734).Z,Bn.Z.htmlTextTracksParsers.ttml=n(7439).Z,Bn.Z.htmlTextTracksParsers.srt=n(8675).Z,Bn.Z.htmlTextTracksParsers.vtt=n(4099).Z;var e=n(9372).Z,t=n(1932).Z;Bn.Z.directfile={initDirectFile:e,mediaElementTracksStore:t}}(),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&s.Z.setLevel("DEBUG");var Fn=Un}(),r=r.default}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.RxPlayer=t():e.RxPlayer=t()}(self,(function(){return function(){var e={3774:function(e,t,n){"use strict";n.d(t,{J:function(){return a},c:function(){return o}});var r=n(1946),i=n(2203).Z?void 0:window,a=void 0===i?void 0:(0,r.Z)(i.MediaSource)?(0,r.Z)(i.MozMediaSource)?(0,r.Z)(i.WebKitMediaSource)?i.MSMediaSource:i.WebKitMediaSource:i.MozMediaSource:i.MediaSource,o={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4}},3666:function(e,t,n){"use strict";n.d(t,{$u:function(){return p},SB:function(){return c},YM:function(){return u},fq:function(){return s},kD:function(){return o},lV:function(){return m},l_:function(){return h},op:function(){return f},vS:function(){return d},vU:function(){return l},yS:function(){return v}});var r,i,a=n(2203),o=!1,s=!1,u=!1,l=!1,d=!1,c=!1,f=!1,v=!1,p=!1,h=!1,m=!1;a.Z||(void 0!==window.MSInputMethodContext&&void 0!==document.documentMode?(s=!0,u=!0):"Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&/(Trident|Edge)\//.test(navigator.userAgent)?u=!0:-1!==navigator.userAgent.toLowerCase().indexOf("edg/")?o=!0:-1!==navigator.userAgent.toLowerCase().indexOf("firefox")?l=!0:"string"==typeof navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)?c=!0:(Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>=0||"[object SafariRemoteNotification]"===(null===(i=null===(r=window.safari)||void 0===r?void 0:r.pushNotification)||void 0===i?void 0:i.toString()))&&(d=!0),/SamsungBrowser/.test(navigator.userAgent)&&(f=!0),-1!==navigator.userAgent.indexOf("PlayStation 5")?m=!0:/Tizen/.test(navigator.userAgent)?v=!0:/[Ww]eb[O0]S/.test(navigator.userAgent)?(p=!0,/[Ww]eb[O0]S.TV-2022/.test(navigator.userAgent)||/[Cc]hr[o0]me\/87/.test(navigator.userAgent)||(/[Ww]eb[O0]S.TV-2021/.test(navigator.userAgent)||/[Cc]hr[o0]me\/79/.test(navigator.userAgent))):/[Pp]anasonic/.test(navigator.userAgent)&&(h=!0))},5767:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e){var t=e.textTracks;if(!(0,i.Z)(t)){for(var n=0;n<t.length;n++)t[n].mode="disabled";if(e.hasChildNodes())for(var a=e.childNodes,o=a.length-1;o>=0;o--)if("track"===a[o].nodeName)try{e.removeChild(a[o])}catch(e){r.Z.warn("Compat: Could not remove text track child from element.")}}e.src="",e.removeAttribute("src")}},6139:function(e,t,n){"use strict";n.d(t,{N:function(){return P},Y:function(){return M}});var r,i=n(3714),a=n(811),o=n(3666),s=n(2203),u=n(5059),l=n(1656),d=function(){function e(e,t,n){this._keyType=e,this._mediaKeys=t,this._configuration=n}var t=e.prototype;return t.createMediaKeys=function(){var e=this;return new Promise((function(t){return t(e._mediaKeys)}))},t.getConfiguration=function(){return this._configuration},(0,l.Z)(e,[{key:"keySystem",get:function(){return this._keyType}}]),e}();if(!s.Z){var c=window.MSMediaKeys;void 0!==c&&void 0!==c.prototype&&"function"==typeof c.isTypeSupported&&"function"==typeof c.prototype.createSession&&(r=c)}var f,v=n(4578),p=n(1959),h=n(288),m=n(3038),g=function(e){function t(t){var n;return(n=e.call(this)||this).expiration=NaN,n.keyStatuses=new Map,n._mk=t,n._sessionClosingCanceller=new h.ZP,n.closed=new Promise((function(e){n._sessionClosingCanceller.signal.register((function(){return e()}))})),n.update=function(e){return new Promise((function(t,r){if(void 0===n._ss)return r("MediaKeySession not set.");try{t(n._ss.update(e,""))}catch(e){r(e)}}))},n}(0,v.Z)(t,e);var n=t.prototype;return n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r=t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer);n._ss=n._mk.createSession("video/mp4",r),m.RV(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"message",e)}),n._sessionClosingCanceller.signal),m.kk(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyadded",e)}),n._sessionClosingCanceller.signal),m.Dl(n._ss,(function(e){var t;n.trigger(null!==(t=e.type)&&void 0!==t?t:"keyerror",e)}),n._sessionClosingCanceller.signal),e()}))},n.close=function(){var e=this;return new Promise((function(t){null!=e._ss&&(e._ss.close(),e._ss=void 0),e._sessionClosingCanceller.cancel(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},(0,l.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._ss)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(p.Z),y=function(){function e(e){if(void 0===r)throw new Error("No MSMediaKeys API.");this._mediaKeys=new r(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0!==this._videoElement.msSetMediaKeys)return this._videoElement.msSetMediaKeys(this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new g(this._mediaKeys)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();if(!s.Z){var _=window.MozMediaKeys;void 0!==_&&void 0!==_.prototype&&"function"==typeof _.isTypeSupported&&"function"==typeof _.prototype.createSession&&(f=_)}var b=n(9689),S=n(8894),E=n(3635);function T(e){return"function"==typeof e.webkitGenerateKeyRequest}var k=function(e){function t(t,n){var r;(r=e.call(this)||this)._vid=t,r._key=n,r.sessionId="",r._closeSession=S.Z,r.keyStatuses=new Map,r.expiration=NaN;var i=function(e){r.trigger(e.type,e)};return r.closed=new Promise((function(e){r._closeSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.removeEventListener(e,i),t.removeEventListener("webkit"+e,i)})),e()}})),["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(e){t.addEventListener(e,i),t.addEventListener("webkit"+e,i)})),r}(0,v.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){try{if(t._key.indexOf("clearkey")>=0){var i=e instanceof ArrayBuffer?new Uint8Array(e):e,a=JSON.parse((0,E.uR)(i)),o=(0,b.K)(a.keys[0].k),s=(0,b.K)(a.keys[0].kid);n(t._vid.webkitAddKey(t._key,o,s,""))}else n(t._vid.webkitAddKey(t._key,e,null,""))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){n._vid.webkitGenerateKeyRequest(n._key,t),e()}))},n.close=function(){var e=this;return new Promise((function(t){e._closeSession(),t()}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},t}(p.Z),w=function(){function e(e){this._keySystem=e}var t=e.prototype;return t._setVideo=function(e){if(!T(e))throw new Error("Video not attached to the MediaKeys");this._videoElement=e},t.createSession=function(){if(null==this._videoElement)throw new Error("Video not attached to the MediaKeys");return new k(this._videoElement,this._keySystem)},t.setServerCertificate=function(){throw new Error("Server certificate is not implemented in your browser")},e}();var A=n(6968);var I=n(158);function R(e,t){var n=e;if(void 0===n.webkitSetMediaKeys)throw new Error("No webKitMediaKeys API.");return n.webkitSetMediaKeys(t)}var Z=function(e){function t(t,n,r){var i;return(i=e.call(this)||this)._serverCertificate=r,i._videoElement=t,i._keyType=n,i._unbindSession=S.Z,i._closeSession=S.Z,i.closed=new Promise((function(e){i._closeSession=e})),i.keyStatuses=new Map,i.expiration=NaN,i}(0,v.Z)(t,e);var n=t.prototype;return n.update=function(e){var t=this;return new Promise((function(n,r){if(void 0===t._nativeSession||void 0===t._nativeSession.update||"function"!=typeof t._nativeSession.update)return r("Unavailable WebKit key session.");try{var i;i=e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e.buffer),n(t._nativeSession.update(i))}catch(e){r(e)}}))},n.generateRequest=function(e,t){var n=this;return new Promise((function(e){var r,i,a,o=n._videoElement;if(void 0===(null===(r=o.webkitKeys)||void 0===r?void 0:r.createSession))throw new Error("No WebKitMediaKeys API.");if("com.apple.fps.1_0"===(a=n._keyType)||"com.apple.fps.2_0"===a){if(void 0===n._serverCertificate)throw new Error("A server certificate is needed for creating fairplay session.");i=function(e,t){var n=e instanceof Uint8Array?e:new Uint8Array(e),r=t instanceof Uint8Array?t:new Uint8Array(t);if((0,A.dN)(n,0)+4!==n.length)throw new Error("Unsupported WebKit initData.");var i=(0,E.wV)(n),a=i.indexOf("skd://"),o=a>-1?i.substring(a+6):i,s=(0,E.TZ)(o),u=0,l=new Uint8Array(n.byteLength+4+s.byteLength+4+r.byteLength);return l.set(n),u+=n.length,l.set((0,A.O_)(s.byteLength),u),u+=4,l.set(s,u),u+=s.byteLength,l.set((0,A.O_)(r.byteLength),u),u+=4,l.set(r,u),l}(t,n._serverCertificate)}else i=t;var s=o.webkitKeys.createSession("video/mp4",i);if(null==s)throw new Error("Impossible to get the key sessions");n._listenEvent(s),n._nativeSession=s,e()}))},n.close=function(){var e=this;return new Promise((function(t,n){e._unbindSession(),e._closeSession(),void 0!==e._nativeSession?(e._nativeSession.close(),t()):n("No session to close.")}))},n.load=function(){return Promise.resolve(!1)},n.remove=function(){return Promise.resolve()},n._listenEvent=function(e){var t=this;this._unbindSession();var n=function(e){t.trigger(e.type,e)};["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.addEventListener(t,n),e.addEventListener("webkit"+t,n)})),this._unbindSession=function(){["keymessage","message","keyadded","ready","keyerror","error"].forEach((function(t){e.removeEventListener(t,n),e.removeEventListener("webkit"+t,n)}))}},(0,l.Z)(t,[{key:"sessionId",get:function(){var e,t;return null!==(t=null===(e=this._nativeSession)||void 0===e?void 0:e.sessionId)&&void 0!==t?t:""}}]),t}(p.Z),x=function(){function e(e){if(void 0===I.t)throw new Error("No WebKitMediaKeys API.");this._keyType=e,this._mediaKeys=new I.t(e)}var t=e.prototype;return t._setVideo=function(e){if(this._videoElement=e,void 0===this._videoElement)throw new Error("Video not attached to the MediaKeys");return R(this._videoElement,this._mediaKeys)},t.createSession=function(){if(void 0===this._videoElement||void 0===this._mediaKeys)throw new Error("Video not attached to the MediaKeys");return new Z(this._videoElement,this._keyType,this._serverCertificate)},t.setServerCertificate=function(e){return this._serverCertificate=e,Promise.resolve()},e}();var P=null,M=function(e,t){var n=e;return"function"==typeof n.setMediaKeys?n.setMediaKeys(t):"function"==typeof n.webkitSetMediaKeys?n.webkitSetMediaKeys(t):"function"==typeof n.mozSetMediaKeys?n.mozSetMediaKeys(t):"function"==typeof n.msSetMediaKeys&&null!==t?n.msSetMediaKeys(t):void 0};if(s.Z||null!=navigator.requestMediaKeySystemAccess&&!(0,u.Z)())P=function(){var e;return(e=navigator).requestMediaKeySystemAccess.apply(e,arguments)};else{var C,D;if(T(HTMLVideoElement.prototype)){var N={isTypeSupported:function(e){var t=document.querySelector("video");return null==t&&(t=document.createElement("video")),null!=t&&"function"==typeof t.canPlayType&&!!t.canPlayType("video/mp4",e)},createCustomMediaKeys:function(e){return new w(e)},setMediaKeys:function(e,t){if(null!==t){if(!(t instanceof w))throw new Error("Custom setMediaKeys is supposed to be called with old webkit custom MediaKeys.");return t._setVideo(e)}}};C=N.isTypeSupported,D=N.createCustomMediaKeys,M=N.setMediaKeys}else if(void 0!==I.t){var O=function(){if(void 0===I.t)throw new Error("No WebKitMediaKeys API.");return{isTypeSupported:I.t.isTypeSupported,createCustomMediaKeys:function(e){return new x(e)},setMediaKeys:function(e,t){if(null===t)return R(e,t);if(!(t instanceof x))throw new Error("Custom setMediaKeys is supposed to be called with webkit custom MediaKeys.");return t._setVideo(e)}}}();C=O.isTypeSupported,D=O.createCustomMediaKeys,M=O.setMediaKeys}else if(o.fq&&void 0!==r){var L={isTypeSupported:function(e,t){if(void 0===r)throw new Error("No MSMediaKeys API.");return void 0!==t?r.isTypeSupported(e,t):r.isTypeSupported(e)},createCustomMediaKeys:function(e){return new y(e)},setMediaKeys:function(e,t){if(null!==t){if(!(t instanceof y))throw new Error("Custom setMediaKeys is supposed to be called with IE11 custom MediaKeys.");return t._setVideo(e)}}};C=L.isTypeSupported,D=L.createCustomMediaKeys,M=L.setMediaKeys}else if(void 0!==f){var U={isTypeSupported:function(e,t){if(void 0===f)throw new Error("No MozMediaKeys API.");return void 0!==t?f.isTypeSupported(e,t):f.isTypeSupported(e)},createCustomMediaKeys:function(e){if(void 0===f)throw new Error("No MozMediaKeys API.");return new f(e)},setMediaKeys:function(e,t){var n=e;if(void 0===n.mozSetMediaKeys||"function"!=typeof n.mozSetMediaKeys)throw new Error("Can't set video on MozMediaKeys.");return n.mozSetMediaKeys(t)}};C=U.isTypeSupported,D=U.createCustomMediaKeys,M=U.setMediaKeys}else{var B=window.MediaKeys,F=function(){if(void 0===B)throw new i.Z("MEDIA_KEYS_NOT_SUPPORTED","No `MediaKeys` implementation found in the current browser.");if(void 0===B.isTypeSupported){throw new Error("This browser seems to be unable to play encrypted contents currently. Note: Some browsers do not allow decryption in some situations, like when not using HTTPS.")}};C=function(e){return F(),(0,a.Z)("function"==typeof B.isTypeSupported),B.isTypeSupported(e)},D=function(e){return F(),new B(e)}}P=function(e,t){if(!C(e))return Promise.reject(new Error("Unsupported key type"));for(var n=0;n<t.length;n++){var r=t[n],i=r.videoCapabilities,a=r.audioCapabilities,o=r.initDataTypes,s=r.distinctiveIdentifier,u=!0;if(u=(u=u&&(null==o||o.some((function(e){return"cenc"===e}))))&&"required"!==s){var l={initDataTypes:["cenc"],distinctiveIdentifier:"not-allowed",persistentState:"required",sessionTypes:["temporary","persistent-license"]};void 0!==i&&(l.videoCapabilities=i),void 0!==a&&(l.audioCapabilities=a);var c=D(e);return Promise.resolve(new d(e,c,l))}}return Promise.reject(new Error("Unsupported configuration"))}}},158:function(e,t,n){"use strict";var r;if(n.d(t,{t:function(){return r}}),!n(2203).Z){var i=window.WebKitMediaKeys;void 0!==i&&"function"==typeof i.isTypeSupported&&"function"==typeof i.prototype.createSession&&"function"==typeof HTMLMediaElement.prototype.webkitSetMediaKeys&&(r=i)}},3038:function(e,t,n){"use strict";n.d(t,{Dl:function(){return k},M4:function(){return R},N8:function(){return y},Q$:function(){return A},RV:function(){return E},Zl:function(){return S},bD:function(){return h},bQ:function(){return I},c9:function(){return p},it:function(){return v},k6:function(){return g},kk:function(){return T},qo:function(){return w},u_:function(){return m},w0:function(){return f},x6:function(){return b},y4:function(){return _}});var r=n(6872),i=n(6923),a=n(1946),o=n(8894),s=n(5095),u=n(5059),l=["","webkit","moz","ms"];function d(e,t){return t.filter((function(t){return function(e,t){var n=document.createElement(e.tagName),r="on"+t;return r in n||(n.setAttribute(r,"return;"),"function"==typeof n[r])}(e,t)}))[0]}function c(e,t){var n,r=function(e,t){return e.reduce((function(e,n){return e.concat((void 0===t?l:t).map((function(e){return e+n})))}),[])}(e,t);return function(e,t,a){if(!a.isCancelled()){if(e instanceof HTMLElement){if(void 0===n&&(n=d(e,r)),!(0,i.Z)(n))return void 0;e.addEventListener(n,t),a.register((function(){void 0!==n&&e.removeEventListener(n,t)}))}r.forEach((function(n){var r=!1;"function"==typeof e.addEventListener?e.addEventListener(n,t):(r=!0,e["on"+n]=t),a.register((function(){"function"==typeof e.removeEventListener&&e.removeEventListener(n,t),r&&delete e["on"+n]}))}))}}}function f(e,t){var n=e;if(!0===n.webkitSupportsPresentationMode&&"function"==typeof n.webkitSetPresentationMode){var r="picture-in-picture"===n.webkitPresentationMode,i=(0,s.ZP)({isEnabled:r,pipWindow:null},t);return Z(n,"webkitpresentationmodechanged",(function(){var e="picture-in-picture"===n.webkitPresentationMode;i.setValue({isEnabled:e,pipWindow:null})}),t),i}var a=document.pictureInPictureElement===n,o=(0,s.ZP)({isEnabled:a,pipWindow:null},t);return Z(n,"enterpictureinpicture",(function(e){var t;o.setValue({isEnabled:!0,pipWindow:null!==(t=e.pictureInPictureWindow)&&void 0!==t?t:null})}),t),Z(n,"leavepictureinpicture",(function(){o.setValue({isEnabled:!1,pipWindow:null})}),t),o}function v(e,t){var n,a=function(e){var t,n=document;null!=n.hidden?t="":null!=n.mozHidden?t="moz":null!=n.msHidden?t="ms":null!=n.webkitHidden&&(t="webkit");var r=(0,i.Z)(t)?t+"Hidden":"hidden",a=(0,i.Z)(t)?t+"visibilitychange":"visibilitychange",o=document[r],u=(0,s.ZP)(!o,e);return Z(document,a,(function(){var e=!document[r];u.setValueIfChanged(e)}),e),u}(t),o=(0,s.ZP)(!0,t);return t.register((function(){clearTimeout(n),n=void 0})),a.onUpdate(u,{clearSignal:t}),e.onUpdate(u,{clearSignal:t}),u(),o;function u(){if(clearTimeout(n),n=void 0,e.getValue().isEnabled||a.getValue())o.setValueIfChanged(!0);else{var t=r.Z.getCurrent().INACTIVITY_DELAY;n=window.setTimeout((function(){o.setValueIfChanged(!1)}),t)}}}function p(e){var t=null==window.devicePixelRatio||0===window.devicePixelRatio?1:window.devicePixelRatio,n=(0,s.ZP)({width:window.screen.width,height:window.screen.height,pixelRatio:t},e),r=window.setInterval((function(){var e=n.getValue();e.width===screen.width&&e.height===screen.height&&e.pixelRatio===t||n.setValue({width:screen.width,height:screen.height,pixelRatio:t})}),2e4);return e.register((function(){clearInterval(r)})),n}function h(e,t,n){var r=null==window.devicePixelRatio||0===window.devicePixelRatio?1:window.devicePixelRatio,i=(0,s.ZP)({width:e.clientWidth,height:e.clientHeight,pixelRatio:r},n),u=o.Z;t.onUpdate(d,{clearSignal:n}),Z(window,"resize",d,n),Z(e,"enterpictureinpicture",d,n),Z(e,"leavepictureinpicture",d,n);var l=window.setInterval(d,2e4);return d(),n.register((function(){u(),clearInterval(l)})),i;function d(){u();var n=t.getValue(),s=n.pipWindow;if(n.isEnabled)if((0,a.Z)(s)){var l=i.getValue();void 0===l.width&&void 0===l.height&&l.pixelRatio===r||i.setValue({width:void 0,height:void 0,pixelRatio:r})}else{var d=function(){f()};s.addEventListener("resize",d),u=function(){s.removeEventListener("resize",d),u=o.Z},f()}else{var c=i.getValue();c.width===e.clientWidth&&c.height===e.clientHeight&&c.pixelRatio===r||i.setValue({width:e.clientWidth,height:e.clientHeight,pixelRatio:r})}function f(){var e=i.getValue();e.width===(null==s?void 0:s.width)&&e.height===(null==s?void 0:s.height)&&e.pixelRatio===r||i.setValue({width:null==s?void 0:s.width,height:null==s?void 0:s.height,pixelRatio:r})}}}c(["loadedmetadata"]),c(["timeupdate"]),c(["addtrack"]),c(["removetrack"]);var m=c(["sourceopen","webkitsourceopen"]),g=c(["sourceclose","webkitsourceclose"]),y=c(["sourceended","webkitsourceended"]),_=c(["update"]),b=c(["removesourcebuffer"]),S=c((0,u.Z)()?["needkey"]:["encrypted","needkey"]),E=c(["keymessage","message"]),T=c(["keyadded","ready"]),k=c(["keyerror","error"]),w=c(["keystatuseschange"]),A=c(["seeking"]),I=c(["seeked"]),R=c(["ended"]);function Z(e,t,n,r){e.addEventListener(t,n),r.register((function(){e.removeEventListener(t,n)}))}},2203:function(e,t){"use strict";var n="undefined"==typeof window;t.Z=n},1988:function(e,t,n){"use strict";function r(e){return"function"==typeof window.VTTCue&&e instanceof window.VTTCue}n.d(t,{Z:function(){return r}})},7253:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946);function a(e,t,n){if(e>=t)return r.Z.warn("Compat: Invalid cue times: "+e+" - "+t),null;if((0,i.Z)(window.VTTCue)){if((0,i.Z)(window.TextTrackCue))throw new Error("VTT cues not supported in your target");return new TextTrackCue(e,t,n)}return new VTTCue(e,t,n)}},5059:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3666),i=n(158);function a(){return(r.vS||r.SB)&&void 0!==i.t}},1669:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(3666);function i(){return r.op}},6872:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r={DEFAULT_UNMUTED_VOLUME:.1,DEFAULT_REQUEST_TIMEOUT:3e4,DEFAULT_TEXT_TRACK_MODE:"native",DEFAULT_ENABLE_FAST_SWITCHING:!0,DELTA_POSITION_AFTER_RELOAD:{bitrateSwitch:-.1,trackSwitch:{audio:-.7,video:-.1,other:0}},DEFAULT_CODEC_SWITCHING_BEHAVIOR:"continue",DEFAULT_AUTO_PLAY:!1,DEFAULT_WANTED_BUFFER_AHEAD:30,DEFAULT_MAX_BUFFER_AHEAD:1/0,DEFAULT_MAX_BUFFER_BEHIND:1/0,DEFAULT_MAX_VIDEO_BUFFER_SIZE:1/0,MAXIMUM_MAX_BUFFER_AHEAD:{text:18e3},MAXIMUM_MAX_BUFFER_BEHIND:{text:18e3},DEFAULT_BASE_BANDWIDTH:0,INACTIVITY_DELAY:6e4,DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN:!1,DEFAULT_VIDEO_RESOLUTION_LIMIT:"none",DEFAULT_LIVE_GAP:{DEFAULT:10,LOW_LATENCY:3.5},BUFFER_DISCONTINUITY_THRESHOLD:.2,FORCE_DISCONTINUITY_SEEK_DELAY:5e3,BITRATE_REBUFFERING_RATIO:1.5,BUFFER_GC_GAPS:{CALM:240,BEEFY:30},DEFAULT_MAX_MANIFEST_REQUEST_RETRY:4,DEFAULT_CDN_DOWNGRADE_TIME:60,DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR:4,INITIAL_BACKOFF_DELAY_BASE:{REGULAR:200,LOW_LATENCY:50},MAX_BACKOFF_DELAY_BASE:{REGULAR:3e3,LOW_LATENCY:1e3},SAMPLING_INTERVAL_MEDIASOURCE:1e3,SAMPLING_INTERVAL_LOW_LATENCY:250,SAMPLING_INTERVAL_NO_MEDIASOURCE:500,ABR_ENTER_BUFFER_BASED_ALGO:10,ABR_EXIT_BUFFER_BASED_ALGO:5,ABR_MINIMUM_TOTAL_BYTES:15e4,ABR_MINIMUM_CHUNK_SIZE:16e3,ABR_STARVATION_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_REGULAR_FACTOR:{DEFAULT:.72,LOW_LATENCY:.72},ABR_STARVATION_GAP:{DEFAULT:5,LOW_LATENCY:5},OUT_OF_STARVATION_GAP:{DEFAULT:7,LOW_LATENCY:7},ABR_STARVATION_DURATION_DELTA:.1,ABR_FAST_EMA:2,ABR_SLOW_EMA:10,RESUME_GAP_AFTER_SEEKING:{DEFAULT:1.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_NOT_ENOUGH_DATA:{DEFAULT:.5,LOW_LATENCY:.5},RESUME_GAP_AFTER_BUFFERING:{DEFAULT:5,LOW_LATENCY:.5},REBUFFERING_GAP:{DEFAULT:.5,LOW_LATENCY:.2},MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING:2,UNFREEZING_SEEK_DELAY:6e3,FREEZING_STALLED_DELAY:600,UNFREEZING_DELTA_POSITION:.001,MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT:.15,MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE:.4,MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE:.3,MINIMUM_SEGMENT_SIZE:.005,APPEND_WINDOW_SECURITIES:{START:.2,END:.1},MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL:50,TEXT_TRACK_SIZE_CHECKS_INTERVAL:250,BUFFER_PADDING:{audio:1,video:3,other:1},SEGMENT_PRIORITIES_STEPS:[2,4,8,12,18,25],MAX_HIGH_PRIORITY_LEVEL:1,MIN_CANCELABLE_PRIORITY:3,EME_DEFAULT_VIDEO_CODECS:['video/mp4;codecs="avc1.4d401e"','video/mp4;codecs="avc1.42e01e"','video/webm;codecs="vp8"'],EME_DEFAULT_AUDIO_CODECS:['audio/mp4;codecs="mp4a.40.2"',"audio/webm;codecs=opus"],EME_DEFAULT_WIDEVINE_ROBUSTNESSES:["HW_SECURE_ALL","HW_SECURE_DECODE","HW_SECURE_CRYPTO","SW_SECURE_DECODE","SW_SECURE_CRYPTO"],EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES:["3000","2000"],EME_KEY_SYSTEMS:{clearkey:["webkit-org.w3.clearkey","org.w3.clearkey"],widevine:["com.widevine.alpha"],playready:["com.microsoft.playready.recommendation","com.microsoft.playready","com.chromecast.playready","com.youtube.playready"],fairplay:["com.apple.fps.1_0"]},MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE:10,MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE:200,MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY:300,OUT_OF_SYNC_MANIFEST_REFRESH_DELAY:3e3,FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY:3e3,DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:3,EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS:15,EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION:1e3,EME_WAITING_DELAY_LOADED_SESSION_EMPTY_KEYSTATUSES:100,FORCED_ENDED_THRESHOLD:8e-4,ADAP_REP_SWITCH_BUFFER_PADDINGS:{video:{before:5,after:5},audio:{before:2,after:2.5},text:{before:0,after:0}},SOURCE_BUFFER_FLUSHING_INTERVAL:500,CONTENT_REPLACEMENT_PADDING:1.2,CACHE_LOAD_DURATION_THRESHOLDS:{video:50,audio:10},STREAM_EVENT_EMITTER_POLL_INTERVAL:250,DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR:.001,BUFFERED_HISTORY_RETENTION_TIME:6e4,BUFFERED_HISTORY_MAXIMUM_ENTRIES:200,MIN_BUFFER_AHEAD:5,UPTO_CURRENT_POSITION_CLEANUP:5,DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE:"seamless",DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE:"seamless",DEFAULT_VIDEO_TRACK_SWITCHING_MODE:"reload",DEFAULT_AUDIO_TRACK_SWITCHING_MODE:"seamless"},i=n(8026);function a(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function o(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(0===n.length)return e;var s=n.shift();if(a(e)&&a(s))for(var u in s)if(a(s[u])){var l=e[u];void 0===l&&(l={},e[u]=l),o(l,s[u])}else{var d;(0,i.Z)(e,((d={})[u]=s[u],d))}return o.apply(void 0,[e].concat(n))}var s=function(){function e(){this._config=r}var t=e.prototype;return t.update=function(e){var t=o(this._config,e);this._config=t},t.getCurrent=function(){return this._config},e}(),u=new s},1932:function(e,t,n){"use strict";n.d(t,{Z:function(){return f}});var r=n(4578),i=n(3666);var a=n(1959),o=n(1946),s=n(5288);function u(e,t){var n;if(t.length!==e.length)return!0;for(var r=0;r<t.length;r++)if(t[r].nativeTrack!==(null===(n=e[r])||void 0===n?void 0:n.nativeTrack))return!0;return!1}function l(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,u=null!==(t=r[o])&&void 0!==t?t:1,l="gen_audio_"+o+"_"+u.toString();r[o]=u+1;var d={language:a.language,id:l,normalized:(0,s.ZP)(a.language),audioDescription:"descriptions"===a.kind||"description"===a.kind,representations:[]};n.push({track:d,nativeTrack:a})}return n}function d(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,u=null!==(t=r[o])&&void 0!==t?t:1,l="gen_text_"+o+"_"+u.toString();r[o]=u+1;var d="forced"===a.kind||void 0,c={language:a.language,forced:d,label:a.label,id:l,normalized:(0,s.ZP)(a.language),closedCaption:"captions"===a.kind};n.push({track:c,nativeTrack:a})}return n}function c(e){for(var t,n=[],r={},i=0;i<e.length;i++){var a=e[i],o=""===a.language?"nolang":a.language,s=null!==(t=r[o])&&void 0!==t?t:1,u="gen_video_"+o+"_"+s.toString();r[o]=s+1,n.push({track:{id:u,representations:[]},nativeTrack:a})}return n}var f=function(e){function t(t){var n,r,i,a;return(n=e.call(this)||this)._nativeAudioTracks=t.audioTracks,n._nativeVideoTracks=t.videoTracks,n._nativeTextTracks=t.textTracks,n._audioTracks=void 0!==n._nativeAudioTracks?l(n._nativeAudioTracks):[],n._videoTracks=void 0!==n._nativeVideoTracks?c(n._nativeVideoTracks):[],n._textTracks=void 0!==n._nativeTextTracks?d(n._nativeTextTracks):[],n._lastEmittedNativeAudioTrack=null===(r=n._getCurrentAudioTrack())||void 0===r?void 0:r.nativeTrack,n._lastEmittedNativeVideoTrack=null===(i=n._getCurrentVideoTrack())||void 0===i?void 0:i.nativeTrack,n._lastEmittedNativeTextTrack=null===(a=n._getCurrentTextTrack())||void 0===a?void 0:a.nativeTrack,n._handleNativeTracksCallbacks(),n}(0,r.Z)(t,e);var n=t.prototype;return n.setAudioTrackById=function(e){for(var t=0;t<this._audioTracks.length;t++){var n=this._audioTracks[t],r=n.track,i=n.nativeTrack;if(r.id===e)return this._enableAudioTrackFromIndex(t),void(this._audioTrackLockedOn=i)}throw new Error("Audio track not found.")},n.disableTextTrack=function(){v(this._textTracks),this._textTrackLockedOn=null},n.setTextTrackById=function(e){for(var t=!1,n=0;n<this._textTracks.length;n++){var r=this._textTracks[n],i=r.track,a=r.nativeTrack;i.id===e?(a.mode="showing",t=!0,this._textTrackLockedOn=a):"showing"!==a.mode&&"hidden"!==a.mode||(a.mode="disabled")}if(!t)throw new Error("Text track not found.")},n.disableVideoTrack=function(){h(this._videoTracks),this._videoTrackLockedOn=null},n.setVideoTrackById=function(e){for(var t=0;t<this._videoTracks.length;t++){var n=this._videoTracks[t],r=n.track,i=n.nativeTrack;if(r.id===e)return i.selected=!0,void(this._videoTrackLockedOn=i)}throw new Error("Video track not found.")},n.getChosenAudioTrack=function(){var e=this._getCurrentAudioTrack();return(0,o.Z)(e)?e:e.track},n.getChosenTextTrack=function(){var e=this._getCurrentTextTrack();return(0,o.Z)(e)?e:e.track},n.getChosenVideoTrack=function(){var e=this._getCurrentVideoTrack();return(0,o.Z)(e)?e:e.track},n.getAvailableAudioTracks=function(){return this._audioTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,language:t.language,normalized:t.normalized,audioDescription:t.audioDescription,active:n.enabled,representations:t.representations}}))},n.getAvailableTextTracks=function(){return this._textTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,label:t.label,forced:t.forced,language:t.language,normalized:t.normalized,closedCaption:t.closedCaption,active:"showing"===n.mode}}))},n.getAvailableVideoTracks=function(){return this._videoTracks.map((function(e){var t=e.track,n=e.nativeTrack;return{id:t.id,representations:t.representations,active:n.selected}}))},n.dispose=function(){void 0!==this._nativeVideoTracks&&(this._nativeVideoTracks.onchange=null,this._nativeVideoTracks.onaddtrack=null,this._nativeVideoTracks.onremovetrack=null),void 0!==this._nativeAudioTracks&&(this._nativeAudioTracks.onchange=null,this._nativeAudioTracks.onaddtrack=null,this._nativeAudioTracks.onremovetrack=null),void 0!==this._nativeTextTracks&&(this._nativeTextTracks.onchange=null,this._nativeTextTracks.onaddtrack=null,this._nativeTextTracks.onremovetrack=null),this.removeEventListener()},n._getCurrentAudioTrack=function(){if(void 0!==this._nativeAudioTracks){for(var e=0;e<this._audioTracks.length;e++){var t=this._audioTracks[e];if(t.nativeTrack.enabled)return t}return null}},n._getCurrentVideoTrack=function(){if(void 0!==this._nativeVideoTracks){for(var e=0;e<this._videoTracks.length;e++){var t=this._videoTracks[e];if(t.nativeTrack.selected)return t}return null}},n._getCurrentTextTrack=function(){if(void 0!==this._nativeTextTracks){for(var e=0;e<this._textTracks.length;e++){var t=this._textTracks[e];if("showing"===t.nativeTrack.mode)return t}return null}},n._setPreviouslyLockedAudioTrack=function(){if(void 0!==this._audioTrackLockedOn)if(null===this._audioTrackLockedOn)for(var e=0;e<this._audioTracks.length;e++){this._audioTracks[e].nativeTrack.enabled=!1}else for(var t=0;t<this._audioTracks.length;t++){if(this._audioTracks[t].nativeTrack===this._audioTrackLockedOn)return void this._enableAudioTrackFromIndex(t)}},n._setPreviouslyLockedTextTrack=function(){if(void 0!==this._textTrackLockedOn)if(null!==this._textTrackLockedOn)for(var e=0;e<this._textTracks.length;e++){var t=this._textTracks[e].nativeTrack;if(t===this._textTrackLockedOn)return p(this._textTracks,t),void("showing"!==t.mode&&(t.mode="showing"))}else v(this._textTracks)},n._setPreviouslyLockedVideoTrack=function(){if(void 0!==this._videoTrackLockedOn)if(null!==this._videoTrackLockedOn)for(var e=0;e<this._videoTracks.length;e++){var t=this._videoTracks[e].nativeTrack;if(t===this._videoTrackLockedOn)return void(t.selected=!0)}else h(this._videoTracks)},n._handleNativeTracksCallbacks=function(){var e=this;void 0!==this._nativeAudioTracks&&(this._nativeAudioTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeAudioTracks){var r=l(e._nativeAudioTracks);if(u(e._audioTracks,r)){e._audioTracks=r,e._setPreviouslyLockedAudioTrack(),e.trigger("availableAudioTracksChange",e.getAvailableAudioTracks());var i=e._getCurrentAudioTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeAudioTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeAudioTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeAudioTracks){var r=l(e._nativeAudioTracks);if(u(e._audioTracks,r)){e._audioTracks=r,e.trigger("availableAudioTracksChange",e.getAvailableAudioTracks());var i=e._getCurrentAudioTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeAudioTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeAudioTracks.onchange=function(){if(void 0!==e._audioTracks)for(var t=0;t<e._audioTracks.length;t++){var n=e._audioTracks[t],r=n.track,i=n.nativeTrack;if(i.enabled)return void(i!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",r),e._lastEmittedNativeAudioTrack=i))}null!==e._lastEmittedNativeAudioTrack&&(e.trigger("audioTrackChange",null),e._lastEmittedNativeAudioTrack=null)}),void 0!==this._nativeTextTracks&&(this._nativeTextTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeTextTracks){var r=d(e._nativeTextTracks);if(u(e._textTracks,r)){e._textTracks=r,e._setPreviouslyLockedTextTrack(),e.trigger("availableTextTracksChange",e.getAvailableTextTracks());var i=e._getCurrentTextTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeTextTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeTextTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeTextTracks){var r=d(e._nativeTextTracks);if(u(e._textTracks,r)){e._textTracks=r,e._setPreviouslyLockedTextTrack(),e.trigger("availableTextTracksChange",e.getAvailableTextTracks());var i=e._getCurrentTextTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeTextTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeTextTracks.onchange=function(){if(void 0!==e._textTracks)for(var t=0;t<e._textTracks.length;t++){var n=e._textTracks[t],r=n.track,i=n.nativeTrack;if("showing"===i.mode)return void(i!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",r),e._lastEmittedNativeTextTrack=i))}null!==e._lastEmittedNativeTextTrack&&(e.trigger("textTrackChange",null),e._lastEmittedNativeTextTrack=null)}),void 0!==this._nativeVideoTracks&&(this._nativeVideoTracks.onaddtrack=function(){var t,n;if(void 0!==e._nativeVideoTracks){var r=c(e._nativeVideoTracks);if(u(e._videoTracks,r)){e._videoTracks=r,e._setPreviouslyLockedVideoTrack(),e.trigger("availableVideoTracksChange",e.getAvailableVideoTracks());var i=e._getCurrentVideoTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeVideoTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeVideoTracks.onremovetrack=function(){var t,n;if(void 0!==e._nativeVideoTracks){var r=c(e._nativeVideoTracks);if(u(e._videoTracks,r)){e._videoTracks=r,e._setPreviouslyLockedVideoTrack(),e.trigger("availableVideoTracksChange",e.getAvailableVideoTracks());var i=e._getCurrentVideoTrack();(null==i?void 0:i.nativeTrack)!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null!==(t=null==i?void 0:i.track)&&void 0!==t?t:null),e._lastEmittedNativeVideoTrack=null!==(n=null==i?void 0:i.nativeTrack)&&void 0!==n?n:null)}}},this._nativeVideoTracks.onchange=function(){if(void 0!==e._videoTracks)for(var t=0;t<e._videoTracks.length;t++){var n=e._videoTracks[t],r=n.track,i=n.nativeTrack;if(i.selected)return void(i!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",r),e._lastEmittedNativeVideoTrack=i))}null!==e._lastEmittedNativeVideoTrack&&(e.trigger("videoTrackChange",null),e._lastEmittedNativeVideoTrack=null)})},n._enableAudioTrackFromIndex=function(e){!function(e,t){for(var n=0;n<e.length;n++)i.yS&&n===t||(e[n].enabled=!1);t<0||t>=e.length||(e[t].enabled=!0)}(this._audioTracks.map((function(e){return e.nativeTrack})),e)},t}(a.Z);function v(e){for(var t=0;t<e.length;t++){e[t].nativeTrack.mode="disabled"}}function p(e,t){for(var n=0;n<e.length;n++){var r=e[n].nativeTrack;r===t||"showing"!==r.mode&&"hidden"!==r.mode||(r.mode="disabled")}}function h(e){for(var t=0;t<e.length;t++){e[t].nativeTrack.selected=!1}}},276:function(e,t,n){"use strict";n.d(t,{u:function(){return Qe},Z:function(){return Je}});var r=n(5861),i=n(4578),a=n(4687),o=n.n(a),s=n(3038),u=n(3887),l=n(6490),d=n(4791),c=n(6968),f=n(3635),v=(0,c.pX)((0,f.tG)("pssh"),0);function p(e,t){for(var n=0;n<e.length;n++){var r=e[n];if((void 0===t.systemId||void 0===r.systemId||t.systemId===r.systemId)&&(0,d.Z)(t.data,r.data))return!0}return!1}function h(e){var t=e.initData,n=e.initDataType;if(null==t)return u.Z.warn("Compat: No init data found on media encrypted event."),null;var r=function(e){for(var t=[],n=0;n<e.length;){if(e.length<n+8||(0,c.pX)(e,n+4)!==v)return u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var r=(0,c.pX)(new Uint8Array(e),n);if(n+r>e.length)return u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}];var i=e.subarray(n,n+r),a={systemId:(0,l.Y)(i,8),data:i};p(t,a)?u.Z.warn("Compat: Duplicated PSSH found in initialization data, removing it."):t.push(a),n+=r}return n!==e.length?(u.Z.warn("Compat: Unrecognized initialization data. Use as is."),[{systemId:void 0,data:e}]):t}(new Uint8Array(t));return{type:n,values:r}}var m=n(6872),g=n(5157),y=n(5389),_=n(3274),b=n(7714),S=n(1959),E=n(1946),T=n(288),k=n(6139),w=n(770);function A(e){w.Z.setState(e,null),(0,k.Y)(e,null)}function I(){return(I=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l,d,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.keySystemOptions,a=n.loadedSessionsStore,s=n.mediaKeySystemAccess,l=n.mediaKeys,d=w.Z.getState(t),c=null!==d&&d.loadedSessionsStore!==a?d.loadedSessionsStore.closeAllSessions():Promise.resolve(),e.next=5,c;case 5:if(!r.isCancelled()){e.next=7;break}throw r.cancellationError;case 7:if(w.Z.setState(t,{keySystemOptions:i,mediaKeySystemAccess:s,mediaKeys:l,loadedSessionsStore:a}),t.mediaKeys!==l){e.next=10;break}return e.abrupt("return");case 10:u.Z.info("DRM: Attaching MediaKeys to the media element"),(0,k.Y)(t,l),u.Z.info("DRM: MediaKeys attached with success");case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(e){if(""===e.sessionId)return!1;var t=e.keyStatuses,n=[];return t.forEach((function(e){n.push(e)})),n.length<=0?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has an empty keyStatuses",e.sessionId),!1):(0,b.Z)(n,"expired")?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has an expired key",e.sessionId),!1):(0,b.Z)(n,"internal-error")?(u.Z.debug("DRM: isSessionUsable: MediaKeySession given has a key with an internal-error",e.sessionId),!1):(u.Z.debug("DRM: isSessionUsable: MediaKeySession is usable",e.sessionId),!0)}function Z(e,t,n,r){var i=e.loadedSessionsStore,a=e.persistentSessionsStore;return"temporary"===n?x(i,t):null===a?(u.Z.warn("DRM: Cannot create persistent MediaKeySession, PersistentSessionsStore not created."),x(i,t)):function(e,t,n,r){return P.apply(this,arguments)}(i,a,t,r)}function x(e,t){u.Z.info("DRM: Creating a new temporary session");var n=e.createSession(t,"temporary");return Promise.resolve({type:"created-session",value:n})}function P(){return P=(0,r.Z)(o().mark((function e(t,n,i,a){var s,l,d,c,f,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(v=function(){return v=(0,r.Z)(o().mark((function e(){var r,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===a.cancellationError){e.next=2;break}throw a.cancellationError;case 2:return u.Z.info("DRM: Removing previous persistent session."),null!==(r=n.get(i))&&n.delete(r.sessionId),e.prev=5,e.next=8,t.closeSession(s.mediaKeySession);case 8:e.next=15;break;case 10:if(e.prev=10,e.t0=e.catch(5),""===s.mediaKeySession.sessionId){e.next=14;break}throw e.t0;case 14:t.removeSessionWithoutClosingIt(s.mediaKeySession);case 15:if(null===a.cancellationError){e.next=17;break}throw a.cancellationError;case 17:return l=t.createSession(i,"persistent-license"),e.abrupt("return",{type:"created-session",value:l});case 19:case"end":return e.stop()}}),e,null,[[5,10]])}))),v.apply(this,arguments)},f=function(){return v.apply(this,arguments)},null===a.cancellationError){e.next=4;break}throw a.cancellationError;case 4:if(u.Z.info("DRM: Creating persistent MediaKeySession"),s=t.createSession(i,"persistent-license"),null!==(l=n.getAndReuse(i))){e.next=9;break}return e.abrupt("return",{type:"created-session",value:s});case 9:return e.prev=9,e.next=12,t.loadPersistentSession(s.mediaKeySession,l.sessionId);case 12:if(d=e.sent){e.next=19;break}return u.Z.warn("DRM: No data stored for the loaded session"),n.delete(l.sessionId),t.removeSessionWithoutClosingIt(s.mediaKeySession),c=t.createSession(i,"persistent-license"),e.abrupt("return",{type:"created-session",value:c});case 19:if(!d||!R(s.mediaKeySession)){e.next=23;break}return n.add(i,i.keyIds,s.mediaKeySession),u.Z.info("DRM: Succeeded to load persistent session."),e.abrupt("return",{type:"loaded-persistent-session",value:s});case 23:return u.Z.warn("DRM: Previous persistent session not usable anymore."),e.abrupt("return",f());case 27:return e.prev=27,e.t0=e.catch(9),u.Z.warn("DRM: Unable to load persistent session: "+(e.t0 instanceof Error?e.t0.toString():"Unknown Error")),e.abrupt("return",f());case 31:case"end":return e.stop()}}),e,null,[[9,27]])}))),P.apply(this,arguments)}function M(e,t){return C.apply(this,arguments)}function C(){return(C=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n<0||n>=t.getLength())){e.next=2;break}return e.abrupt("return");case 2:for(u.Z.info("DRM: LSS cache limit exceeded",n,t.getLength()),r=[],i=t.getAll().slice(),a=i.length-n,s=0;s<a;s++)l=i[s],r.push(t.closeSession(l.mediaKeySession));return e.next=9,Promise.all(r);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e,t,n,r,i){return N.apply(this,arguments)}function N(){return(N=(0,r.Z)(o().mark((function e(t,n,r,i,a){var s,l,d,c,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=null,l=n.loadedSessionsStore,d=n.persistentSessionsStore,null===(c=l.reuse(t))){e.next=11;break}if(!R(s=c.mediaKeySession)){e.next=10;break}return u.Z.info("DRM: Reuse loaded session",s.sessionId),e.abrupt("return",{type:"loaded-open-session",value:{mediaKeySession:s,sessionType:c.sessionType,keySessionRecord:c.keySessionRecord}});case 10:null!==d&&""!==c.mediaKeySession.sessionId&&d.delete(c.mediaKeySession.sessionId);case 11:if(null===s){e.next=16;break}return e.next=14,l.closeSession(s);case 14:if(null===a.cancellationError){e.next=16;break}throw a.cancellationError;case 16:return e.next=18,M(l,i);case 18:if(null===a.cancellationError){e.next=20;break}throw a.cancellationError;case 20:return e.next=22,Z(n,t,r,a);case 22:return f=e.sent,e.abrupt("return",{type:f.type,value:{mediaKeySession:f.value.mediaKeySession,sessionType:f.value.sessionType,keySessionRecord:f.value.keySessionRecord}});case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var O=n(3666);var L=n(9592);function U(e,t,n){var r=t.getConfiguration();if(O.fq||null==r)return null;var i=e.filter((function(e){return e.type===n.type&&(!!((0,E.Z)(e.persistentLicenseConfig)&&"required"!==e.persistentState||"required"===r.persistentState)&&("required"!==e.distinctiveIdentifier||"required"===r.distinctiveIdentifier))}))[0];return null!=i?{keySystemOptions:i,keySystemAccess:t}:null}function B(e){var t=e.keyName,n=e.keyType,r=e.keySystemOptions,i=["temporary"],a="optional",o="optional";(0,E.Z)(r.persistentLicenseConfig)||(a="required",i.push("persistent-license")),(0,E.Z)(r.persistentState)||(a=r.persistentState),(0,E.Z)(r.distinctiveIdentifier)||(o=r.distinctiveIdentifier);var s,u,l=m.Z.getCurrent(),d=l.EME_DEFAULT_AUDIO_CODECS,c=l.EME_DEFAULT_VIDEO_CODECS,f=l.EME_DEFAULT_WIDEVINE_ROBUSTNESSES,v=l.EME_DEFAULT_PLAYREADY_RECOMMENDATION_ROBUSTNESSES,p=r.audioCapabilitiesConfig,h=r.videoCapabilitiesConfig;if("full"===(null==p?void 0:p.type))s=p.value;else{var g;0===(g="robustness"===(null==p?void 0:p.type)?p.value:"widevine"===t?f:"com.microsoft.playready.recommendation"===n?v:[]).length&&g.push(void 0);var y="contentType"===(null==p?void 0:p.type)?p.value:d;s=(0,L.Z)(g,(function(e){return y.map((function(t){return void 0!==e?{contentType:t,robustness:e}:{contentType:t}}))}))}if("full"===(null==h?void 0:h.type))u=h.value;else{var _;0===(_="robustness"===(null==h?void 0:h.type)?h.value:"widevine"===t?f:"com.microsoft.playready.recommendation"===n?v:[]).length&&_.push(void 0);var b="contentType"===(null==h?void 0:h.type)?h.value:c;u=(0,L.Z)(_,(function(e){return b.map((function(t){return void 0!==e?{contentType:t,robustness:e}:{contentType:t}}))}))}var S={initDataTypes:["cenc"],videoCapabilities:u,audioCapabilities:s,distinctiveIdentifier:o,persistentState:a,sessionTypes:i};return[S,Object.assign(Object.assign({},S),{audioCapabilities:void 0,videoCapabilities:void 0})]}function F(e,t,n){u.Z.info("DRM: Searching for compatible MediaKeySystemAccess");var i=w.Z.getState(e);if(null!=i){var a=U(t,i.mediaKeySystemAccess,i.keySystemOptions);if(null!==a)return u.Z.info("DRM: Found cached compatible keySystem"),Promise.resolve({type:"reuse-media-key-system-access",value:{mediaKeySystemAccess:a.keySystemAccess,options:a.keySystemOptions}})}var s=t.reduce((function(e,t){var n,r=m.Z.getCurrent().EME_KEY_SYSTEMS[t.type];if(null!=r)n=r.map((function(e){return{keyName:t.type,keyType:e,keySystemOptions:t}}));else{var i=function(e){for(var t=m.Z.getCurrent().EME_KEY_SYSTEMS,n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];if((0,b.Z)(t[i],e))return i}}(t.type);n=[{keyName:i,keyType:t.type,keySystemOptions:t}]}return e.concat(n)}),[]);return l(0);function l(e){return d.apply(this,arguments)}function d(){return(d=(0,r.Z)(o().mark((function e(t){var r,i,a,d,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>=s.length)){e.next=2;break}throw new g.Z("INCOMPATIBLE_KEYSYSTEMS","No key system compatible with your wanted configuration has been found in the current browser.");case 2:if(null!=k.N){e.next=4;break}throw new Error("requestMediaKeySystemAccess is not implemented in your browser.");case 4:return r=s[t],i=r.keyType,a=r.keySystemOptions,d=B(r),u.Z.debug("DRM: Request keysystem access "+i+","+(t+1)+" of "+s.length),e.prev=8,e.next=11,(0,k.N)(i,d);case 11:return c=e.sent,u.Z.info("DRM: Found compatible keysystem",i,t+1),e.abrupt("return",{type:"create-media-key-system-access",value:{options:a,mediaKeySystemAccess:c}});case 16:if(e.prev=16,e.t0=e.catch(8),u.Z.debug("DRM: Rejected access to keysystem",i,t+1),null===n.cancellationError){e.next=21;break}throw n.cancellationError;case 21:return e.abrupt("return",l(t+1));case 22:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}}var z=n(2297);function V(e,t,n){var r;u.Z.debug("Compat: Calling generateRequest on the MediaKeySession");try{r=function(e){u.Z.info("Compat: Trying to move CENC PSSH from init data at the end of it.");for(var t=!1,n=new Uint8Array,r=new Uint8Array,i=0;i<e.length;){if(e.length<i+8||(0,c.pX)(e,i+4)!==v)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var a=(0,c.pX)(new Uint8Array(e),i);if(i+a>e.length)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");var o=e.subarray(i,i+a);if(16===e[i+12]&&119===e[i+13]&&239===e[i+14]&&236===e[i+15]&&192===e[i+16]&&178===e[i+17]&&77===e[i+18]&&2===e[i+19]&&172===e[i+20]&&227===e[i+21]&&60===e[i+22]&&30===e[i+23]&&82===e[i+24]&&226===e[i+25]&&251===e[i+26]&&75===e[i+27]){var s=(0,z.Xj)(o),l=null===s?void 0:o[s[1]];u.Z.info("Compat: CENC PSSH found with version",l),void 0===l?u.Z.warn("Compat: could not read version of CENC PSSH"):t===(1===l)?n=(0,c.zo)(n,o):1===l?(u.Z.warn("Compat: cenc version 1 encountered, removing every other cenc pssh box."),n=o,t=!0):u.Z.warn("Compat: filtering out cenc pssh box with wrong version",l)}else r=(0,c.zo)(r,o);i+=a}if(i!==e.length)throw u.Z.warn("Compat: unrecognized initialization data. Cannot patch it."),new Error("Compat: unrecognized initialization data. Cannot patch it.");return(0,c.zo)(r,n)}(n)}catch(e){r=n}var i=null!=t?t:"";return e.generateRequest(i,r).catch((function(t){if(""!==i||!(t instanceof TypeError))throw t;return u.Z.warn('Compat: error while calling `generateRequest` with an empty initialization data type. Retrying with a default "cenc" value.',t),e.generateRequest("cenc",r)}))}var K=100;function G(e,t){return j.apply(this,arguments)}function j(){return(j=(0,r.Z)(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Load persisted session",n),e.next=3,t.load(n);case 3:if((r=e.sent)&&!(t.keyStatuses.size>0)){e.next=6;break}return e.abrupt("return",r);case 6:return e.abrupt("return",new Promise((function(e){t.addEventListener("keystatuseschange",i);var n=setTimeout(i,K);function i(){clearTimeout(n),t.removeEventListener("keystatuseschange",i),e(r)}})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var H=n(7864);function W(e){var t=new T.ZP;return Promise.race([e.close().then((function(){t.cancel()})),e.closed.then((function(){t.cancel()})),function(){return n.apply(this,arguments)}()]);function n(){return(n=(0,r.Z)(o().mark((function e(){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,H.Z)(1e3,t.signal);case 3:return e.next=5,i();case 5:e.next=13;break;case 7:if(e.prev=7,e.t0=e.catch(0),!(e.t0 instanceof T.FU)){e.next=11;break}return e.abrupt("return");case 11:n=e.t0 instanceof Error?e.t0.message:"Unknown error made it impossible to close the session",u.Z.error("DRM: "+n);case 13:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function i(){return a.apply(this,arguments)}function a(){return(a=(0,r.Z)(o().mark((function n(){return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.update(new Uint8Array(1));case 3:n.next=13;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t.isUsed()){n.next=9;break}return n.abrupt("return");case 9:if(!(n.t0 instanceof Error&&"The session is already closed."===n.t0.message)){n.next=11;break}return n.abrupt("return");case 11:return n.next=13,(0,H.Z)(1e3,t.signal);case 13:if(!t.isUsed()){n.next=15;break}return n.abrupt("return");case 15:throw new Error("Compat: Couldn't know if session is closed");case 16:case"end":return n.stop()}}),n,null,[[0,5]])})))).apply(this,arguments)}}var q=n(811);function Y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return X(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return X(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Q(e,t){return e===t||(0,d.Z)(e,t)}function $(e,t){return t.some((function(t){return Q(t,e)}))}function J(e,t){for(var n,r=function(){var e=n.value;if(!t.some((function(t){return Q(t,e)})))return{v:!1}},i=Y(e);!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}return!0}function ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ne=function(){function e(e){this._initializationData=e,this._keyIds=null}var t=e.prototype;return t.associateKeyIds=function(e){null===this._keyIds&&(this._keyIds=[]);for(var t=0,n=Array.from(e);t<n.length;t++){var r=n[t];this.isAssociatedWithKeyId(r)||this._keyIds.push(r)}},t.isAssociatedWithKeyId=function(e){if(null===this._keyIds)return!1;for(var t,n=ee(this._keyIds);!(t=n()).done;){if(Q(t.value,e))return!0}return!1},t.getAssociatedKeyIds=function(){return null===this._keyIds?[]:this._keyIds},t.isCompatibleWith=function(e){var t=e.keyIds;if(void 0!==t&&t.length>0){if(null!==this._keyIds&&J(t,this._keyIds))return!0;if(void 0!==this._initializationData.keyIds)return J(t,this._initializationData.keyIds)}return this._checkInitializationDataCompatibility(e)},t._checkInitializationDataCompatibility=function(e){return void 0!==e.keyIds&&e.keyIds.length>0&&void 0!==this._initializationData.keyIds?J(e.keyIds,this._initializationData.keyIds):this._initializationData.type===e.type&&this._initializationData.values.isCompatibleWith(e.values)},e}();function re(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ie(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ae=function(){function e(e){this._mediaKeys=e,this._storage=[]}var t=e.prototype;return t.createSession=function(e,t){var n=this,r=new ne(e);u.Z.debug("DRM-LSS: calling `createSession`",t);var i=this._mediaKeys.createSession(t),a={mediaKeySession:i,sessionType:t,keySessionRecord:r,isGeneratingRequest:!1,isLoadingPersistentSession:!1,closingStatus:{type:"none"}};return(0,E.Z)(i.closed)||i.closed.then((function(){u.Z.info("DRM-LSS: session was closed, removing it.",i.sessionId);var e=n.getIndex(r);e>=0&&n._storage[e].mediaKeySession===i&&n._storage.splice(e,1)})).catch((function(e){u.Z.warn("DRM-LSS: MediaKeySession.closed rejected: "+e)})),this._storage.push(Object.assign({},a)),u.Z.debug("DRM-LSS: MediaKeySession added",a.sessionType,this._storage.length),a},t.reuse=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.keySessionRecord.isCompatibleWith(e))return this._storage.splice(t,1),this._storage.push(n),u.Z.debug("DRM-LSS: Reusing session:",n.mediaKeySession.sessionId,n.sessionType),Object.assign({},n)}return null},t.getEntryForSession=function(e){for(var t=this._storage.length-1;t>=0;t--){var n=this._storage[t];if(n.mediaKeySession===e)return Object.assign({},n)}return null},t.generateLicenseRequest=function(){var e=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=re(this._storage);case 1:if((s=a()).done){e.next=8;break}if((l=s.value).mediaKeySession!==t){e.next=6;break}return i=l,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==i){e.next=11;break}return u.Z.error("DRM-LSS: generateRequest error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",V(t,n,r));case 11:if(i.isGeneratingRequest=!0,"none"===i.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,V(t,n,r);case 17:e.next=26;break;case 19:if(e.prev=19,e.t0=e.catch(14),void 0!==i){e.next=23;break}throw e.t0;case 23:throw i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start(),e.t0;case 26:if(void 0!==i){e.next=28;break}return e.abrupt("return",void 0);case 28:i.isGeneratingRequest=!1,"awaiting"===i.closingStatus.type&&i.closingStatus.start();case 30:case"end":return e.stop()}}),e,this,[[14,19]])})));return function(t,n,r){return e.apply(this,arguments)}}(),t.loadPersistentSession=function(){var e=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=re(this._storage);case 1:if((a=i()).done){e.next=8;break}if((s=a.value).mediaKeySession!==t){e.next=6;break}return r=s,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==r){e.next=11;break}return u.Z.error("DRM-LSS: loadPersistentSession error. No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",G(t,n));case 11:if(r.isLoadingPersistentSession=!0,"none"===r.closingStatus.type){e.next=14;break}throw new Error("The `MediaKeySession` is being closed.");case 14:return e.prev=14,e.next=17,G(t,n);case 17:l=e.sent,e.next=27;break;case 20:if(e.prev=20,e.t0=e.catch(14),void 0!==r){e.next=24;break}throw e.t0;case 24:throw r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.t0;case 27:if(void 0!==r){e.next=29;break}return e.abrupt("return",l);case 29:return r.isLoadingPersistentSession=!1,"awaiting"===r.closingStatus.type&&r.closingStatus.start(),e.abrupt("return",l);case 32:case"end":return e.stop()}}),e,this,[[14,20]])})));return function(t,n){return e.apply(this,arguments)}}(),t.closeSession=function(){var e=(0,r.Z)(o().mark((function e(t){var n,r,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=re(this._storage);case 1:if((i=r()).done){e.next=8;break}if((a=i.value).mediaKeySession!==t){e.next=6;break}return n=a,e.abrupt("break",8);case 6:e.next=1;break;case 8:if(void 0!==n){e.next=11;break}return u.Z.warn("DRM-LSS: No MediaKeySession found with the given initData and initDataType"),e.abrupt("return",Promise.resolve(!1));case 11:return e.abrupt("return",this._closeEntry(n));case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.getLength=function(){return this._storage.length},t.getAll=function(){return this._storage},t.closeAllSessions=function(){var e=(0,r.Z)(o().mark((function e(){var t,n,r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._storage,u.Z.debug("DRM-LSS: Closing all current MediaKeySessions",t.length),this._storage=[],n=t.map((function(e){return r._closeEntry(e)})),e.next=6,Promise.all(n);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.removeSessionWithoutClosingIt=function(e){(0,q.Z)(""===e.sessionId,"Initialized `MediaKeySession`s should always be properly closed");for(var t=this._storage.length-1;t>=0;t--){if(this._storage[t].mediaKeySession===e)return u.Z.debug("DRM-LSS: Removing session without closing it",e.sessionId),this._storage.splice(t,1),!0}return!1},t.getIndex=function(e){for(var t=0;t<this._storage.length;t++){if(this._storage[t].keySessionRecord===e)return t}return-1},t._closeEntry=function(){var e=(0,r.Z)(o().mark((function e(t){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.mediaKeySession,e.abrupt("return",new Promise((function(e,r){function i(){void 0!==t&&(t.closingStatus={type:"pending"}),oe(n).then((function(){void 0!==t&&(t.closingStatus={type:"done"}),e(!0)})).catch((function(e){void 0!==t&&(t.closingStatus={type:"failed"}),r(e)}))}void 0!==t&&(t.isLoadingPersistentSession||t.isGeneratingRequest)?t.closingStatus={type:"awaiting",start:i}:i()})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e}();function oe(e){return se.apply(this,arguments)}function se(){return(se=(0,r.Z)(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.debug("DRM: Trying to close a MediaKeySession",t.sessionId),e.prev=1,e.next=4,W(t);case 4:return u.Z.debug("DRM: Succeeded to close MediaKeySession"),e.abrupt("return");case 8:return e.prev=8,e.t0=e.catch(1),u.Z.error("DRM: Could not close MediaKeySession: "+(e.t0 instanceof Error?e.t0.toString():"Unknown error")),e.abrupt("return");case 12:case"end":return e.stop()}}),e,null,[[1,8]])})))).apply(this,arguments)}var ue=n(9689);function le(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e[n],t&=t;return t}var de=n(6923),ce=function(){function e(e){this.initData=e}return e.prototype.toJSON=function(){return(0,ue.J)(this.initData)},e.decode=function(e){return(0,ue.K)(e)},e}();function fe(e,t){var n,r;return null!==(r=null!==(n=ve(e,t))&&void 0!==n?n:ve(t,e))&&void 0!==r&&r}function ve(e,t){if(0===e.length)return!1;if(t.length<e.length)return null;for(var n=e[0],r=0,i=0;i<t.length;i++){var a=t[i];if(a.systemId===n.systemId){if(a.hash!==n.hash)return!1;var o=n.data instanceof Uint8Array?n.data:"string"==typeof n.data?ce.decode(n.data):n.data.initData,s=a.data instanceof Uint8Array?a.data:"string"==typeof a.data?ce.decode(a.data):a.data.initData;if(!(0,d.Z)(o,s))return!1;if(t.length-i<e.length)return null;for(r=1;r<e.length;r++){var u=e[r];for(i+=1;i<t.length;i++){var l=t[i];if(u.systemId===l.systemId){if(u.hash!==l.hash)return!1;var c=u.data instanceof Uint8Array?u.data:"string"==typeof u.data?ce.decode(u.data):u.data.initData,f=l.data instanceof Uint8Array?l.data:"string"==typeof l.data?ce.decode(l.data):l.data.initData;if(!(0,d.Z)(c,f))return!1;break}}if(r===t.length)return null}return!0}}return null}function pe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return he(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return he(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var me=function(){function e(e){!function(e){(0,q.u)(e,{save:"function",load:"function"},"persistentLicenseConfig")}(e),this._entries=[],this._storage=e;try{var t=this._storage.load();Array.isArray(t)||(t=[]),this._entries=t}catch(e){u.Z.warn("DRM-PSS: Could not get entries from license storage",e instanceof Error?e:""),this.dispose()}}var t=e.prototype;return t.getLength=function(){return this._entries.length},t.getAll=function(){return this._entries},t.get=function(e){var t=this._getIndex(e);return-1===t?null:this._entries[t]},t.getAndReuse=function(e){var t=this._getIndex(e);if(-1===t)return null;var n=this._entries.splice(t,1)[0];return this._entries.push(n),n},t.add=function(e,t,n){var r;if(!(0,E.Z)(n)&&(0,de.Z)(n.sessionId)){var i=n.sessionId,a=this._getIndex(e);if(a>=0){var o=void 0===t?3:4,s=this._entries[a];if((null!==(r=s.version)&&void 0!==r?r:-1)>=o&&i===s.sessionId)return;u.Z.info("DRM-PSS: Updating session info.",i),this._entries.splice(a,1)}else u.Z.info("DRM-PSS: Add new session",i);var l=e.values.getFormattedValues().map((function(e){var t=e.systemId,n=e.data;return{systemId:t,hash:e.hash,data:new ce(n)}}));void 0===t?this._entries.push({version:3,sessionId:i,values:l,initDataType:e.type}):this._entries.push({version:4,sessionId:i,keyIds:t.map((function(e){return new ce(e)})),values:l,initDataType:e.type}),this._save()}else u.Z.warn("DRM-PSS: Invalid Persisten Session given.")},t.delete=function(e){for(var t=-1,n=0;n<this._entries.length;n++){if(this._entries[n].sessionId===e){t=n;break}}if(-1!==t){var r=this._entries[t];u.Z.warn("DRM-PSS: Delete session from store",r.sessionId),this._entries.splice(t,1),this._save()}else u.Z.warn("DRM-PSS: initData to delete not found.")},t.deleteOldSessions=function(e){u.Z.info("DRM-PSS: Deleting last "+e+" sessions."),e<=0||(e<=this._entries.length?this._entries.splice(0,e):(u.Z.warn("DRM-PSS: Asked to remove more information that it contains",e,this._entries.length),this._entries=[]),this._save())},t.dispose=function(){this._entries=[],this._save()},t._getIndex=function(e){var t=this,n=null;function r(){if(null===n){var t=e.values.constructRequestData();n={initData:t,initDataHash:le(t)}}return n}for(var i=function(){var n=t._entries[a];if(n.initDataType===e.type)switch(n.version){case 4:if(void 0!==e.keyIds){if(e.keyIds.every((function(e){for(var t,r=(0,ue.J)(e),i=pe(n.keyIds);!(t=i()).done;){var a=t.value;if("string"==typeof a){if(r===a)return!0}else if(Q(a.initData,e))return!0}return!1})))return{v:a}}else if(fe(e.values.getFormattedValues(),n.values))return{v:a};break;case 3:if(fe(e.values.getFormattedValues(),n.values))return{v:a};break;case 2:var i=r(),o=i.initData,s=i.initDataHash;if(n.initDataHash===s)try{var l="string"==typeof n.initData?ce.decode(n.initData):n.initData.initData;if((0,d.Z)(l,o))return{v:a}}catch(e){u.Z.warn("DRM-PSS: Could not decode initialization data.",e instanceof Error?e:"")}break;case 1:var c=r(),f=c.initData,v=c.initDataHash;if(n.initDataHash===v){if(void 0===n.initData.length)return{v:a};if((0,d.Z)(n.initData,f))return{v:a}}break;default:var p=r().initDataHash;if(n.initData===p)return{v:a}}},a=0;a<this._entries.length;a++){var o=i();if("object"==typeof o)return o.v}return-1},t._save=function(){try{this._storage.save(this._entries)}catch(t){var e=t instanceof Error?t:void 0;u.Z.warn("DRM-PSS: Could not save MediaKeySession information",e)}},e}();var ge=new WeakMap,ye={prepare:function(e){ge.set(e,null)},set:function(e,t){var n=t instanceof Uint8Array?t:new Uint8Array(t instanceof ArrayBuffer?t:t.buffer),r=le(n);ge.set(e,{hash:r,serverCertificate:n})},hasOne:function(e){var t=ge.get(e);return void 0!==t&&(null!==t||void 0)},has:function(e,t){var n=ge.get(e);if(null==n)return!1;var r=n.hash,i=n.serverCertificate,a=t instanceof Uint8Array?t:new Uint8Array(t instanceof ArrayBuffer?t:t.buffer);if(le(a)!==r||i.length!==a.length)return!1;for(var o=0;o<i.length;o++)if(i[o]!==a[o])return!1;return!0}};function _e(e){if((0,E.Z)(e.persistentLicenseConfig))return null;var t=e.persistentLicenseConfig;if(null==t)throw new g.Z("INVALID_KEY_SYSTEM","No `persistentLicenseConfig` found for persistent license.");return u.Z.debug("DRM: Set the given license storage"),new me(t)}function be(e,t,n){return Se.apply(this,arguments)}function Se(){return(Se=(0,r.Z)(o().mark((function e(t,n,r){var i,a,s,l,d,c,f,v,p,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F(t,n,r);case 2:if(i=e.sent,null===r.cancellationError){e.next=5;break}throw r.cancellationError;case 5:if(a=i.value,s=a.options,l=a.mediaKeySystemAccess,d=w.Z.getState(t),c=_e(s),O.$u||O.l_||null===d||"reuse-media-key-system-access"!==i.type){e.next=12;break}if(f=d.mediaKeys,v=d.loadedSessionsStore,!1!==ye.hasOne(f)&&((0,E.Z)(s.serverCertificate)||!ye.has(f,s.serverCertificate))){e.next=12;break}return e.abrupt("return",{mediaKeys:f,mediaKeySystemAccess:l,stores:{loadedSessionsStore:v,persistentSessionsStore:c},options:s});case 12:return e.next=14,Ee(l);case 14:return p=e.sent,u.Z.info("DRM: MediaKeys created with success"),h=new ae(p),e.abrupt("return",{mediaKeys:p,mediaKeySystemAccess:l,stores:{loadedSessionsStore:h,persistentSessionsStore:c},options:s});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ee(e){return Te.apply(this,arguments)}function Te(){return(Te=(0,r.Z)(o().mark((function e(t){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Calling createMediaKeys on the MediaKeySystemAccess"),e.prev=1,e.next=4,t.createMediaKeys();case 4:return n=e.sent,e.abrupt("return",n);case 8:throw e.prev=8,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.message:"Unknown error when creating MediaKeys.",new g.Z("CREATE_MEDIA_KEYS_ERROR",r);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})))).apply(this,arguments)}function ke(){return(ke=(0,r.Z)(o().mark((function e(t,n,r){var i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,be(t,n,r);case 2:return i=e.sent,a=i.mediaKeys,null!==t.mediaKeys&&void 0!==t.mediaKeys&&a!==t.mediaKeys&&(u.Z.debug("DRM: Disabling old MediaKeys"),A(t)),e.abrupt("return",i);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var we=n(7326),Ae=n(2146),Ie=n(2572);function Re(e){return new Promise((function(t){setTimeout(t,e)}))}var Ze=n(7904),xe=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,we.Z)(r),t.prototype),r.reason=n,r}return(0,i.Z)(t,e),t}((0,Ae.Z)(Error)),Pe={EXPIRED:"expired",INTERNAL_ERROR:"internal-error",OUTPUT_RESTRICTED:"output-restricted"};function Me(e,t,n){var r,i=t.onKeyInternalError,a=t.onKeyOutputRestricted,o=t.onKeyExpiration,s=[],l=[],d=[];return e.keyStatuses.forEach((function(e,t){var r="string"==typeof e?[e,t]:[t,e],c=r[0],v=function(e,t){return-1!==e.indexOf("playready")&&(O.YM||O.kD)?(0,f.wO)(t):t}(n,new Uint8Array(r[1])),p={keyId:v.buffer,keyStatus:c};switch(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: key status update ("+(0,f.ci)(v)+"): "+c),c){case Pe.EXPIRED:var h=new g.Z("KEY_STATUS_CHANGE_ERROR","A decryption key expired ("+(0,f.ci)(v)+")",{keyStatuses:[p].concat(d)});if("error"===o||void 0===o)throw h;switch(o){case"close-session":throw new xe(h);case"fallback":s.push(v);break;default:"continue"===o||void 0===o?l.push(v):(0,Ze.Z)(o)}d.push(p);break;case Pe.INTERNAL_ERROR:var m=new g.Z("KEY_STATUS_CHANGE_ERROR",'A "'+c+'" status has been encountered ('+(0,f.ci)(v)+")",{keyStatuses:[p].concat(d)});switch(i){case void 0:case"error":throw m;case"close-session":throw new xe(m);case"fallback":s.push(v);break;case"continue":l.push(v);break;default:if(void 0===i)throw m;(0,Ze.Z)(i)}d.push(p);break;case Pe.OUTPUT_RESTRICTED:var y=new g.Z("KEY_STATUS_CHANGE_ERROR",'A "'+c+'" status has been encountered ('+(0,f.ci)(v)+")",{keyStatuses:[p].concat(d)});switch(a){case void 0:case"error":throw y;case"fallback":s.push(v);break;case"continue":l.push(v);break;default:if(void 0===a)throw y;(0,Ze.Z)(a)}d.push(p);break;default:l.push(v)}})),d.length>0&&(r=new g.Z("KEY_STATUS_CHANGE_ERROR","One or several problematic key statuses have been encountered",{keyStatuses:d})),{warning:r,blacklistedKeyIds:s,whitelistedKeyIds:l}}var Ce=s.Dl,De=s.RV,Ne=s.qo;function Oe(e,t,n,i,a){u.Z.info("DRM: Binding session events",e.sessionId);var s=t.getLicenseConfig,l=void 0===s?{}:s,d=new T.ZP;return d.linkToSignal(a),(0,E.Z)(e.closed)||e.closed.then((function(){return d.cancel()})).catch((function(e){a.isCancelled()||(d.cancel(),i.onError(e))})),Ce(e,(function(e){d.cancel(),i.onError(new g.Z("KEY_ERROR",e.type))}),d.signal),Ne(e,(function(){try{c()}catch(e){if(a.isCancelled()||d.isUsed()&&e instanceof T.XG)return;d.cancel(),i.onError(e)}}),d.signal),De(e,(function(n){var a,s=n,c=new Uint8Array(s.message),f=(0,de.Z)(s.messageType)?s.messageType:"license-request";u.Z.info("DRM: Received message event, type "+f,e.sessionId),function(e,t,n){var i=t.baseDelay,a=t.maxDelay,s=t.totalRetry,u=t.shouldRetry,l=t.onRetry,d=0;return c();function c(){return f.apply(this,arguments)}function f(){return(f=(0,r.Z)(o().mark((function t(){var r,f,v,p;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===n.cancellationError){t.next=2;break}throw n.cancellationError;case 2:return t.prev=2,t.next=5,e();case 5:return r=t.sent,t.abrupt("return",r);case 9:if(t.prev=9,t.t0=t.catch(2),null===n.cancellationError){t.next=13;break}throw n.cancellationError;case 13:if(!(!(0,E.Z)(u)&&!u(t.t0)||d++>=s)){t.next=15;break}throw t.t0;case 15:return"function"==typeof l&&l(t.t0,d),f=Math.min(i*Math.pow(2,d-1),a),v=(0,Ie.Z)(f),t.next=20,Re(v);case 20:return p=c(),t.abrupt("return",p);case 22:case"end":return t.stop()}}),t,null,[[2,9]])})))).apply(this,arguments)}}((function(){return function(e,n){var r;return new Promise((function(i,a){try{u.Z.debug("DRM: Calling `getLicense`",n);var o=t.getLicense(e,n),s=(0,E.Z)(l.timeout)?1e4:l.timeout;s>=0&&(r=setTimeout((function(){a(new Fe('"getLicense" timeout exceeded ('+s+" ms)"))}),s)),Promise.resolve(o).then(d,c)}catch(e){c(e)}function d(e){void 0!==r&&clearTimeout(r),i(e)}function c(e){void 0!==r&&clearTimeout(r),a(e)}}))}(c,f)}),{totalRetry:null!=(a=l.retry)?a:2,baseDelay:200,maxDelay:3e3,shouldRetry:function(e){return e instanceof Fe||(0,E.Z)(e)||!0!==e.noRetry},onRetry:function(e){return i.onWarning(Le(e))}},d.signal).then((function(t){if(d.isUsed())return Promise.resolve();if((0,E.Z)(t))u.Z.info("DRM: No license given, skipping session.update");else try{return function(e,t){return Ue.apply(this,arguments)}(e,t)}catch(e){d.cancel(),i.onError(e)}})).catch((function(e){if(!d.isUsed()){d.cancel();var t=Le(e);if(!(0,E.Z)(e))if(!0===e.fallbackOnLastTry)return u.Z.warn("DRM: Last `getLicense` attempt failed. Blacklisting the current session."),void i.onError(new Be(t));i.onError(t)}}))}),d.signal),void c();function c(){if(u.Z.info("DRM: keystatuseschange event received",e.sessionId),!d.isUsed()&&0!==e.keyStatuses.size){var r=Me(e,t,n),a=r.warning,o=r.blacklistedKeyIds,s=r.whitelistedKeyIds;void 0!==a&&(i.onWarning(a),d.isUsed())||i.onKeyUpdate({whitelistedKeyIds:s,blacklistedKeyIds:o})}}}function Le(e){if(e instanceof Fe)return new g.Z("KEY_LOAD_TIMEOUT","The license server took too much time to respond.");var t=new g.Z("KEY_LOAD_ERROR","An error occured when calling `getLicense`.");return!(0,E.Z)(e)&&(0,de.Z)(e.message)&&(t.message=e.message),t}function Ue(){return(Ue=(0,r.Z)(o().mark((function e(t,n){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.Z.info("DRM: Updating MediaKeySession with message"),e.prev=1,e.next=4,t.update(n);case 4:e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(1),r=e.t0 instanceof Error?e.t0.toString():"`session.update` failed",new g.Z("KEY_UPDATE_ERROR",r);case 10:u.Z.info("DRM: MediaKeySession update succeeded.");case 11:case"end":return e.stop()}}),e,null,[[1,6]])})))).apply(this,arguments)}var Be=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,we.Z)(r),t.prototype),r.sessionError=n,r}return(0,i.Z)(t,e),t}((0,Ae.Z)(Error)),Fe=function(e){function t(t){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,we.Z)(n),Be.prototype),n.message=t,n}return(0,i.Z)(t,e),t}((0,Ae.Z)(Error)),ze=n(9822);function Ve(e,t){return Ke.apply(this,arguments)}function Ke(){return(Ke=(0,r.Z)(o().mark((function e(t,n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.setServerCertificate(n);case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),u.Z.warn("DRM: mediaKeys.setServerCertificate returned an error",e.t0 instanceof Error?e.t0:""),i=e.t0 instanceof Error?e.t0.toString():"`setServerCertificate` error",new g.Z("LICENSE_SERVER_CERTIFICATE_ERROR",i);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function Ge(e,t){return je.apply(this,arguments)}function je(){return(je=(0,r.Z)(o().mark((function e(t,n){var r,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==ye.hasOne(t)){e.next=3;break}return u.Z.info("DRM: The MediaKeys already has a server certificate, skipping..."),e.abrupt("return",{type:"already-has-one"});case 3:if("function"==typeof t.setServerCertificate){e.next=6;break}return u.Z.warn("DRM: Could not set the server certificate. mediaKeys.setServerCertificate is not a function"),e.abrupt("return",{type:"method-not-implemented"});case 6:return u.Z.info("DRM: Setting server certificate on the MediaKeys"),ye.prepare(t),e.prev=8,e.next=11,Ve(t,n);case 11:return r=e.sent,ye.set(t,n),e.abrupt("return",{type:"success",value:r});case 16:return e.prev=16,e.t0=e.catch(8),i=(0,ze.Z)(e.t0)?e.t0:new g.Z("LICENSE_SERVER_CERTIFICATE_ERROR","Unknown error when setting the server certificate."),e.abrupt("return",{type:"error",value:i});case 20:case"end":return e.stop()}}),e,null,[[8,16]])})))).apply(this,arguments)}function He(e,t){if(!(isNaN(t)||t<0||t>=e.getLength())){var n=e.getLength(),r=n-t;u.Z.info("DRM: Too many stored persistent sessions, removing some.",n,r),e.deleteOldSessions(r)}}var We=n(9252);var qe=function(){function e(e){this._innerValues=e,this._lazyFormattedValues=null}var t=e.prototype;return t.constructRequestData=function(){return c.zo.apply(void 0,this._innerValues.map((function(e){return e.data})))},t.isCompatibleWith=function(t){var n=t instanceof e?t.getFormattedValues():t;return fe(this.getFormattedValues(),n)},t.getFormattedValues=function(){return null===this._lazyFormattedValues&&(this._lazyFormattedValues=this._innerValues.slice().sort((function(e,t){return e.systemId===t.systemId?0:void 0===e.systemId?1:void 0===t.systemId||e.systemId<t.systemId?-1:1})).map((function(e){var t=e.systemId,n=e.data;return{systemId:t,data:n,hash:le(n)}}))),this._lazyFormattedValues},e}();function Ye(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Xe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xe(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Qe,$e=s.Zl,Je=function(e){function t(t,n){var r;r=e.call(this)||this,u.Z.debug("DRM: Starting ContentDecryptor logic.");var i=new T.ZP;return r._currentSessions=[],r._canceller=i,r._wasAttachCalled=!1,r._initDataQueue=[],r._stateData={state:Qe.Initializing,isMediaKeysAttached:!1,isInitDataQueueLocked:!0,data:null},r.error=null,$e(t,(function(e){u.Z.debug("DRM: Encrypted event received from media element.");var t=h(e);null!==t&&r.onInitializationData(t)}),i.signal),function(e,t,n){return ke.apply(this,arguments)}(t,n,i.signal).then((function(e){var n,i,a=e.options,o=e.mediaKeySystemAccess;((0,E.Z)(a.persistentLicenseConfig)||!0===a.persistentLicenseConfig.disableRetroCompatibility)&&(i=o.keySystem,n=(0,We.Z)(i,"com.microsoft.playready")||"com.chromecast.playready"===i||"com.youtube.playready"===i?"9a04f07998404286ab92e65be0885f95":"com.widevine.alpha"===i?"edef8ba979d64acea3c827dcd51d21ed":(0,We.Z)(i,"com.apple.fps")?"94ce86fb07ff4f43adb893d2fa968ca2":(0,We.Z)(i,"com.nagra.")?"adb41c242dbf4a6d958b4457c0d27b95":void 0),r.systemId=n,r._stateData.state===Qe.Initializing&&(r._stateData={state:Qe.WaitingForAttachment,isInitDataQueueLocked:!0,isMediaKeysAttached:!1,data:{mediaKeysInfo:e,mediaElement:t}},r.trigger("stateChange",r._stateData.state))})).catch((function(e){r._onFatalError(e)})),r}(0,i.Z)(t,e);var n=t.prototype;return n.getState=function(){return this._stateData.state},n.attach=function(){var e=this;if(this._stateData.state!==Qe.WaitingForAttachment)throw new Error("`attach` should only be called when in the WaitingForAttachment state");if(this._wasAttachCalled)u.Z.warn("DRM: ContentDecryptor's `attach` method called more than once.");else{this._wasAttachCalled=!0;var t=this._stateData.data,n=t.mediaElement,i=t.mediaKeysInfo,a=i.options,s=i.mediaKeys,l=i.mediaKeySystemAccess,d={loadedSessionsStore:i.stores.loadedSessionsStore,mediaKeySystemAccess:l,mediaKeys:s,keySystemOptions:a};!0===a.disableMediaKeysAttachmentLock&&(this._stateData={state:Qe.ReadyForContent,isInitDataQueueLocked:!0,isMediaKeysAttached:!1,data:null},this.trigger("stateChange",this._stateData.state),this._isStopped())||(u.Z.debug("DRM: Attaching current MediaKeys"),function(e,t,n){return I.apply(this,arguments)}(n,d,this._canceller.signal).then((0,r.Z)(o().mark((function t(){var n,r,u;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=a.serverCertificate,(0,E.Z)(n)){t.next=6;break}return t.next=4,Ge(s,n);case 4:"error"===(r=t.sent).type&&e.trigger("warning",r.value);case 6:if(!e._isStopped()){t.next=8;break}return t.abrupt("return");case 8:u=e._stateData.state,e._stateData={state:Qe.ReadyForContent,isMediaKeysAttached:!0,isInitDataQueueLocked:!1,data:{mediaKeysData:i}},u!==Qe.ReadyForContent&&e.trigger("stateChange",Qe.ReadyForContent),e._isStopped()||e._processCurrentInitDataQueue();case 12:case"end":return t.stop()}}),t)})))).catch((function(t){e._onFatalError(t)})))}},n.dispose=function(){this.removeEventListener(),this._stateData={state:Qe.Disposed,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("stateChange",this._stateData.state)},n.onInitializationData=function(e){var t=this;if(!1===this._stateData.isInitDataQueueLocked){var n=this._stateData.data.mediaKeysData,r=Object.assign(Object.assign({},e),{values:new qe(e.values)});this._processInitializationData(r,n).catch((function(e){t._onFatalError(e)}))}else{if(this._isStopped())throw new Error("ContentDecryptor either disposed or stopped.");this._initDataQueue.push(e)}},n._processInitializationData=function(){var e=(0,r.Z)(o().mark((function e(t,n){var r,i,a,s,l,d,c,v,p,h,y,b,S,T,k,w,A,I,R,Z,x,P,M,C,N,O,L,U,B,F,z,V,K,G=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.mediaKeySystemAccess,i=n.stores,a=n.options,!this._tryToUseAlreadyCreatedSession(t,n)&&!this._isStopped()){e.next=3;break}return e.abrupt("return");case 3:if("content"!==a.singleLicensePer){e.next=15;break}if(void 0===(s=(0,_.Z)(this._currentSessions,(function(e){return"created-session"===e.source})))){e.next=13;break}if(void 0!==(l=t.keyIds)){e.next=10;break}return void 0===t.content?u.Z.warn("DRM: Unable to fallback from a non-decipherable quality."):nt(t.content.manifest,t),e.abrupt("return");case 10:return s.record.associateKeyIds(l),void 0!==t.content&&(u.Z.hasLevel("DEBUG")&&(d=l.reduce((function(e,t){return e+", "+(0,f.ci)(t)}),""),u.Z.debug("DRM: Blacklisting new key ids",d)),tt(t.content.manifest,[],l,[])),e.abrupt("return");case 13:e.next=37;break;case 15:if("periods"!==a.singleLicensePer||void 0===t.content){e.next=37;break}c=t.content.period,v=this._currentSessions.filter((function(e){return"created-session"===e.source})),at(p=new Set,c),h=Ye(v);case 21:if((y=h()).done){e.next=37;break}b=y.value,S=Array.from(p),T=0,k=S;case 25:if(!(T<k.length)){e.next=35;break}if(w=k[T],!b.record.isAssociatedWithKeyId(w)){e.next=32;break}for(b.record.associateKeyIds(p.values()),A=Ye(S);!(I=A()).done;)$(R=I.value,b.keyStatuses.whitelisted)||$(R,b.keyStatuses.blacklisted)||b.keyStatuses.blacklisted.push(R);return tt(t.content.manifest,b.keyStatuses.whitelisted,b.keyStatuses.blacklisted,[]),e.abrupt("return");case 32:T++,e.next=25;break;case 35:e.next=21;break;case 37:return this._lockInitDataQueue(),(0,E.Z)(a.persistentLicenseConfig)?Z="temporary":et(r)?Z="persistent-license":(u.Z.warn('DRM: Cannot create "persistent-license" session: not supported'),Z="temporary"),x=m.Z.getCurrent(),P=x.EME_DEFAULT_MAX_SIMULTANEOUS_MEDIA_KEY_SESSIONS,M=x.EME_MAX_STORED_PERSISTENT_SESSION_INFORMATION,C="number"==typeof a.maxSessionCacheSize?a.maxSessionCacheSize:P,e.next=43,D(t,i,Z,C,this._canceller.signal);case 43:if(N=e.sent,!this._isStopped()){e.next=46;break}return e.abrupt("return");case 46:if(O={record:N.value.keySessionRecord,source:N.type,keyStatuses:{whitelisted:[],blacklisted:[]},blacklistedSessionError:null},this._currentSessions.push(O),L=N.value,U=L.mediaKeySession,B=L.sessionType,F=!1,Oe(U,a,r.keySystem,{onKeyUpdate:function(e){var n=rt(t,O.record,a.singleLicensePer,"created-session"===O.source,e.whitelistedKeyIds,e.blacklistedKeyIds);if(O.record.associateKeyIds(n.whitelisted),O.record.associateKeyIds(n.blacklisted),O.keyStatuses={whitelisted:n.whitelisted,blacklisted:n.blacklisted},0!==O.record.getAssociatedKeyIds().length&&"persistent-license"===B&&null!==i.persistentSessionsStore&&!F){var r=i.persistentSessionsStore;He(r,M-1),r.add(t,O.record.getAssociatedKeyIds(),U),F=!0}void 0!==t.content&&tt(t.content.manifest,n.whitelisted,n.blacklisted,[]),G._unlockInitDataQueue()},onWarning:function(e){G.trigger("warning",e)},onError:function(e){var n;if(e instanceof xe){u.Z.warn("DRM: A session's closing condition has been triggered"),G._lockInitDataQueue();var r=G._currentSessions.indexOf(O);return r>=0&&G._currentSessions.splice(r),void 0!==t.content&&tt(t.content.manifest,[],[],O.record.getAssociatedKeyIds()),null===(n=i.persistentSessionsStore)||void 0===n||n.delete(U.sessionId),i.loadedSessionsStore.closeSession(U).catch((function(e){var t=e instanceof Error?e:"unknown error";u.Z.warn("DRM: failed to close expired session",t)})).then((function(){return G._unlockInitDataQueue()})).catch((function(e){return G._onFatalError(e)})),void(G._isStopped()||G.trigger("warning",e.reason))}if(e instanceof Be){if(O.blacklistedSessionError=e,void 0!==t.content){var a=t.content.manifest;u.Z.info("DRM: blacklisting Representations based on protection data."),nt(a,t)}G._unlockInitDataQueue()}else G._onFatalError(e)}},this._canceller.signal),void 0!==a.singleLicensePer&&"init-data"!==a.singleLicensePer||this._unlockInitDataQueue(),"created-session"!==N.type){e.next=67;break}return z=t.values.constructRequestData(),e.prev=54,e.next=57,i.loadedSessionsStore.generateLicenseRequest(U,t.type,z);case 57:e.next=67;break;case 59:if(e.prev=59,e.t0=e.catch(54),null!==(V=i.loadedSessionsStore.getEntryForSession(U))&&"none"===V.closingStatus.type){e.next=66;break}return(K=this._currentSessions.indexOf(O))>=0&&this._currentSessions.splice(K,1),e.abrupt("return",Promise.resolve());case 66:throw new g.Z("KEY_GENERATE_REQUEST_ERROR",e.t0 instanceof Error?e.t0.toString():"Unknown error");case 67:return e.abrupt("return",Promise.resolve());case 68:case"end":return e.stop()}}),e,this,[[54,59]])})));return function(t,n){return e.apply(this,arguments)}}(),n._tryToUseAlreadyCreatedSession=function(e,t){var n=t.stores,r=t.options,i=(0,_.Z)(this._currentSessions,(function(t){return t.record.isCompatibleWith(e)}));if(void 0===i)return!1;var a=i.blacklistedSessionError;if(!(0,E.Z)(a))return void 0===e.type||void 0===e.content?(u.Z.error("DRM: This initialization data has already been blacklisted but the current content is not known."),!0):(u.Z.info("DRM: This initialization data has already been blacklisted. Blacklisting the related content."),nt(e.content.manifest,e),!0);if(void 0!==e.keyIds){var o;if(void 0===r.singleLicensePer||"init-data"===r.singleLicensePer){var s=i.keyStatuses.blacklisted;o=function(e,t){for(var n,r=function(){var e=n.value;if(t.some((function(t){return Q(t,e)})))return{v:!0}},i=Y(e);!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}return!1}(e.keyIds,s)}else{var l=i.keyStatuses.whitelisted;o=!J(e.keyIds,l)}if(o)return void 0===e.content?(u.Z.error("DRM: Cannot forbid key id, the content is unknown."),!0):(u.Z.info("DRM: Current initialization data is linked to blacklisted keys. Marking Representations as not decipherable"),tt(e.content.manifest,[],e.keyIds,[]),!0)}if(null!==n.loadedSessionsStore.reuse(e))return u.Z.debug("DRM: Init data already processed. Skipping it."),!0;var d=this._currentSessions.indexOf(i);return-1===d?u.Z.error("DRM: Unable to remove processed init data: not found."):(u.Z.debug("DRM: A session from a processed init data is not available anymore. Re-processing it."),this._currentSessions.splice(d,1)),!1},n._onFatalError=function(e){if(!this._canceller.isUsed()){var t=e instanceof Error?e:new y.Z("NONE","Unknown decryption error");this.error=t,this._initDataQueue.length=0,this._stateData={state:Qe.Error,isMediaKeysAttached:void 0,isInitDataQueueLocked:void 0,data:null},this._canceller.cancel(),this.trigger("error",t),this._stateData.state===Qe.Error&&this.trigger("stateChange",this._stateData.state)}},n._isStopped=function(){return this._stateData.state===Qe.Disposed||this._stateData.state===Qe.Error},n._processCurrentInitDataQueue=function(){for(;!1===this._stateData.isInitDataQueueLocked;){var e=this._initDataQueue.shift();if(void 0===e)return;this.onInitializationData(e)}},n._lockInitDataQueue=function(){!1===this._stateData.isInitDataQueueLocked&&(this._stateData.isInitDataQueueLocked=!0)},n._unlockInitDataQueue=function(){!0===this._stateData.isMediaKeysAttached?(this._stateData.isInitDataQueueLocked=!1,this._processCurrentInitDataQueue()):u.Z.error("DRM: Trying to unlock in the wrong state")},t}(S.Z);function et(e){var t=e.getConfiguration().sessionTypes;return void 0!==t&&(0,b.Z)(t,"persistent-license")}function tt(e,t,n,r){e.updateRepresentationsDeciperability((function(e){if(void 0===e.contentProtections)return e.decipherable;var i=e.contentProtections.keyIds;if(void 0!==i)for(var a,o=Ye(i);!(a=o()).done;){for(var s,u=a.value,l=Ye(n);!(s=l()).done;){if(Q(s.value,u.keyId))return!1}for(var d,c=Ye(t);!(d=c()).done;){if(Q(d.value,u.keyId))return!0}for(var f,v=Ye(r);!(f=v()).done;){if(Q(f.value,u.keyId))return}}return e.decipherable}))}function nt(e,t){e.updateRepresentationsDeciperability((function(e){var n,r;if(!1===e.decipherable)return!1;for(var i,a=function(){var e=i.value;if((void 0===t.type||e.type===t.type)&&t.values.getFormattedValues().every((function(t){return e.values.some((function(e){return(void 0===t.systemId||e.systemId===t.systemId)&&(0,d.Z)(e.data,t.data)}))})))return{v:!1}},o=Ye(null!==(r=null===(n=e.contentProtections)||void 0===n?void 0:n.initData)&&void 0!==r?r:[]);!(i=o()).done;){var s=a();if("object"==typeof s)return s.v}return e.decipherable}))}function rt(e,t,n,r,i,a){for(var o,s,l=[].concat(i,a),d=function(){var e=s.value;l.some((function(t){return Q(t,e)}))||(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: KeySessionRecord's key missing in the license, blacklisting it",(0,f.ci)(e)),l.push(e))},c=Ye(t.getAssociatedKeyIds());!(s=c()).done;)d();if(void 0!==n&&"init-data"!==n){var v=e.keyIds,p=e.content;if(void 0!==v){var h=v.filter((function(e){return!l.some((function(t){return Q(t,e)}))}));h.length>0&&(u.Z.hasLevel("DEBUG")&&u.Z.debug("DRM: init data keys missing in the license, blacklisting them",h.map((function(e){return(0,f.ci)(e)})).join(", ")),l.push.apply(l,h))}if(r&&void 0!==p)if("content"===n){for(var m,g=new Set,y=Ye(p.manifest.periods);!(m=y()).done;){at(g,m.value)}it(g,l)}else if("periods"===n)for(var _,b=Ye(p.manifest.periods);!(_=b()).done;){var S=_.value,E=new Set;if(at(E,S),(null===(o=e.content)||void 0===o?void 0:o.period.id)===S.id)it(E,l);else for(var T=Array.from(E),k=function(){var e=A[w];if(l.some((function(t){return Q(t,e)})))return it(E,l),"break"},w=0,A=T;w<A.length;w++){if("break"===k())break}}}return{whitelisted:i,blacklisted:l.slice(i.length)}}function it(e,t){for(var n=Array.from(e.values()),r=function(){var e=a[i];t.some((function(t){return Q(t,e)}))||t.push(e)},i=0,a=n;i<a.length;i++)r()}function at(e,t){for(var n,r=Ye(t.getAdaptations());!(n=r()).done;)for(var i,a=Ye(n.value.representations);!(i=a()).done;){var o=i.value;if(void 0!==o.contentProtections&&void 0!==o.contentProtections.keyIds)for(var s,u=Ye(o.contentProtections.keyIds);!(s=u()).done;){var l=s.value;e.add(l.keyId)}}}!function(e){e[e.Initializing=0]="Initializing",e[e.WaitingForAttachment=1]="WaitingForAttachment",e[e.ReadyForContent=2]="ReadyForContent",e[e.Error=3]="Error",e[e.Disposed=4]="Disposed"}(Qe||(Qe={}))},1266:function(e,t,n){"use strict";var r=n(276);t.ZP=r.Z},770:function(e,t){"use strict";var n=new WeakMap;t.Z={setState:function(e,t){n.set(e,t)},getState:function(e){var t=n.get(e);return void 0===t?null:t},clearState:function(e){n.set(e,null)}}},9372:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(4578),i=n(5767),a=n(3887),o=n(5095),s=n(288),u=n(379),l=n(1757),d=n(8833),c=n(8799),f=n(6199),v=n(4576),p=function(e){function t(t){var n;return(n=e.call(this)||this)._settings=t,n._initCanceller=new s.ZP,n}(0,r.Z)(t,e);var n=t.prototype;return n.prepare=function(){},n.start=function(e,t){var n=this,r=this._initCanceller.signal,s=this._settings,u=s.keySystems,l=s.speed,d=s.url;if((0,i.Z)(e),null==d)throw new Error("No URL for a DirectFile content");var p=(0,o.ZP)(null);p.finish();var h=(0,c.Z)(e,u,p,{onError:function(e){return n._onFatalError(e)},onWarning:function(e){return n.trigger("warning",e)}},r);(0,v.Z)(e,(function(e){return n._onFatalError(e)}),r);var m=new f.Z(t,null,null,l);m.addEventListener("stalled",(function(e){return n.trigger("stalled",e)})),m.addEventListener("unstalled",(function(){return n.trigger("unstalled",null)})),m.addEventListener("warning",(function(e){return n.trigger("warning",e)})),r.register((function(){m.destroy()})),m.start(),h.onUpdate((function(o,s){"uninitialized"!==o.initializationState.type&&(s(),a.Z.info("Setting URL to HTMLMediaElement",d),e.src=d,r.register((function(){(0,i.Z)(e)})),"awaiting-media-link"===o.initializationState.type?(o.initializationState.value.isMediaLinked.setValue(!0),h.onUpdate((function(r,i){if("initialized"===r.initializationState.type)return i(),void n._seekAndPlay(e,t)}),{emitCurrentValue:!0,clearSignal:r})):n._seekAndPlay(e,t))}),{emitCurrentValue:!0,clearSignal:r})},n.updateContentUrls=function(e,t){throw new Error("Cannot update content URL of directfile contents")},n.dispose=function(){this._initCanceller.cancel()},n._onFatalError=function(e){this._initCanceller.cancel(),this.trigger("error",e)},n._seekAndPlay=function(e,t){var n=this,r=this._initCanceller.signal,i=this._settings,o=i.autoPlay,s=i.startAt;(0,d.Z)(e,t,(function(){a.Z.debug("Init: Calculating initial time");var t=function(e,t){if(null==t)return 0;if(null!=t.position)return t.position;if(null!=t.wallClockTime)return t.wallClockTime;if(null!=t.fromFirstPosition)return t.fromFirstPosition;var n=e.duration;if(null==n||!isFinite(n))return a.Z.warn("startAt.fromLastPosition set but no known duration, beginning at 0."),0;if("number"==typeof t.fromLastPosition)return Math.max(0,n+t.fromLastPosition);if(null!=t.percentage){var r=t.percentage;return r>=100?n:r<=0?0:n*(+r/100)}return 0}(e,s);return a.Z.debug("Init: Initial time calculated:",t),t}),o,(function(e){return n.trigger("warning",e)}),r).autoPlayResult.then((function(){return(0,l.Z)(t,e,!0,r).onUpdate((function(e,t){e&&(t(),n.trigger("loaded",{segmentBuffersStore:null}))}),{emitCurrentValue:!0,clearSignal:r})})).catch((function(e){r.isCancelled()||n._onFatalError(e)}))},t}(u.K)},379:function(e,t,n){"use strict";n.d(t,{K:function(){return i}});var r=n(4578),i=function(e){function t(){return e.apply(this,arguments)||this}return(0,r.Z)(t,e),t}(n(1959).Z)},1757:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(3666);var i=n(1669),a=n(5095),o=n(288);function s(e,t,n,s){var u=new o.ZP;u.linkToSignal(s);var l=(0,a.ZP)(!1,u.signal);return e.listen((function(e){if(null===e.rebuffering&&null===e.freezing&&0!==e.readyState)return!function(e,t){return!e||!r.SB||t}(n,t.hasAttribute("playsinline"))&&t.duration>0||e.readyState>=3&&null!==e.currentRange&&(!(0,i.Z)()||t.duration>0)?(l.setValue(!0),void u.cancel()):void 0}),{includeLastObservation:!0,clearSignal:u.signal}),l}},8833:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(1669),i=n(3774),a=n(3714),o=n(3887),s=n(5095);function u(e,t,n,u,l,d){var c,f,v=new Promise((function(e,t){c=e,f=t})),p=(0,s.$l)(!1,d),h=(0,s.$l)(!1,d);e.addEventListener("loadedmetadata",g),e.readyState>=i.c.HAVE_METADATA&&g();var m=d.register((function(t){e.removeEventListener("loadedmetadata",g),f(t)}));return{autoPlayResult:v,initialPlayPerformed:h,initialSeekPerformed:p};function g(){e.removeEventListener("loadedmetadata",g);var i="function"==typeof n?n():n;if(o.Z.info("Init: Set initial time",i),t.setCurrentTime(i),p.setValue(!0),p.finish(),(0,r.Z)()&&0===e.duration){var s=new a.Z("MEDIA_ERR_NOT_LOADED_METADATA","Cannot load automatically: your browser falsely announced having loaded the content.");l(s)}d.isCancelled()||t.listen((function(t,n){!t.seeking&&null===t.rebuffering&&t.readyState>=1&&(n(),function(){var t,n;if(o.Z.info("Init: Can begin to play content"),!u)return e.autoplay&&o.Z.warn("Init: autoplay is enabled on HTML media element. Media will play as soon as possible."),h.setValue(!0),h.finish(),m(),c({type:"skipped"});try{n=null!==(t=e.play())&&void 0!==t?t:Promise.resolve()}catch(e){return m(),f(e)}n.then((function(){if(!d.isCancelled())return h.setValue(!0),h.finish(),m(),c({type:"autoplay"})})).catch((function(e){if(m(),!d.isCancelled()){if(e instanceof Error&&"NotAllowedError"===e.name){o.Z.warn("Init: Media element can't play. It may be due to browser auto-play policies.");var t=new a.Z("MEDIA_ERR_BLOCKED_AUTOPLAY","Cannot trigger auto-play automatically: your browser does not allow it.");if(l(t),d.isCancelled())return;return c({type:"autoplay-blocked"})}f(e)}}))}())}),{includeLastObservation:!0,clearSignal:d})}}},8799:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(6139);var i=n(5157),a=n(3887),o=n(5095),s=n(288),u=n(1266),l=n(276);function d(e,t,n,d,c){if(0===t.length){n.onUpdate((function(e,t){if(null!==e){t(),a.Z.error("Init: Encrypted event but EME feature not activated");var n=new i.Z("MEDIA_IS_ENCRYPTED_ERROR","EME feature not activated.");d.onError(n)}}),{clearSignal:c});var f=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return f.finish(),f}if("function"!=typeof r.N){n.onUpdate((function(e,t){if(null!==e){t(),a.Z.error("Init: Encrypted event but no EME API available");var n=new i.Z("MEDIA_IS_ENCRYPTED_ERROR","Encryption APIs not found.");d.onError(n)}}),{clearSignal:c});var v=(0,o.ZP)({initializationState:{type:"initialized",value:null},drmSystemId:void 0});return v.finish(),v}var p=new s.ZP;p.linkToSignal(c);var h=(0,o.ZP)({initializationState:{type:"uninitialized",value:null},drmSystemId:void 0},c);a.Z.debug("Init: Creating ContentDecryptor");var m=new u.ZP(e,t);return m.addEventListener("stateChange",(function(e){if(e===l.u.WaitingForAttachment){var t=(0,o.ZP)(!1);t.onUpdate((function(t,n){t&&(n(),e===l.u.WaitingForAttachment&&m.attach())}),{clearSignal:p.signal}),h.setValue({initializationState:{type:"awaiting-media-link",value:{isMediaLinked:t}},drmSystemId:m.systemId})}else e===l.u.ReadyForContent&&(h.setValue({initializationState:{type:"initialized",value:null},drmSystemId:m.systemId}),m.removeEventListener("stateChange"))})),m.addEventListener("error",(function(e){p.cancel(),d.onError(e)})),m.addEventListener("warning",(function(e){d.onWarning(e)})),n.onUpdate((function(e){null!==e&&m.onInitializationData(e)}),{clearSignal:p.signal}),p.signal.register((function(){m.dispose()})),h}},6199:function(e,t,n){"use strict";n.d(t,{Z:function(){return p}});var r=n(4578),i=n(3666).yS,a=n(6872),o=n(3714),s=n(3887),u=n(1959),l=n(2829),d=n(288);function c(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var v=1/60,p=function(e){function t(t,n,r,i){var a;return(a=e.call(this)||this)._playbackObserver=t,a._manifest=n,a._segmentBuffersStore=r,a._speed=i,a._discontinuitiesStore=[],a._isStarted=!1,a._canceller=new d.ZP,a._currentFreezeTimestamp=null,a}(0,r.Z)(t,e);var n=t.prototype;return n.start=function(){var e=this;if(!this._isStarted){var t;this._isStarted=!0;var n=null,r=new g(this._playbackObserver,this._speed);this._canceller.signal.register((function(){r.dispose()}));var o=null;this._playbackObserver.listen((function(u){var d,c=e._discontinuitiesStore,f=u.buffered,p=u.position,h=u.readyState,g=u.rebuffering,y=u.freezing,_=a.Z.getCurrent(),b=_.BUFFER_DISCONTINUITY_THRESHOLD,S=_.FORCE_DISCONTINUITY_SEEK_DELAY,E=_.FREEZING_STALLED_DELAY,T=_.UNFREEZING_SEEK_DELAY,k=_.UNFREEZING_DELTA_POSITION;if(!u.seeking&&i&&null===n&&null!==t&&u.position<t){s.Z.debug("Init: the device appeared to have seeked back by itself.");var w=performance.now();n=w}if(t=u.seeking?Math.max(null!==(d=u.pendingInternalSeek)&&void 0!==d?d:0,u.position):null,!e._checkDecipherabilityFreeze(u)){if(null!==y){var A=performance.now();if(A-(null===o?y.timestamp:o.attemptTimestamp)>T&&(s.Z.warn("Init: trying to seek to un-freeze player"),e._playbackObserver.setCurrentTime(e._playbackObserver.getCurrentTime()+k),o={attemptTimestamp:A}),A-y.timestamp>E)return null===g||null!==n?r.stopRebuffering():r.startRebuffering(),void e.trigger("stalled","freezing")}else o=null;var I;if(null===g)return r.stopRebuffering(),1===h?(I=u.seeking?null!==u.pendingInternalSeek?"internal-seek":"seeking":"not-ready",void e.trigger("stalled",I)):void e.trigger("unstalled",null);var R="seeking"===g.reason&&null!==u.pendingInternalSeek?"internal-seek":g.reason;if(null!==n){var Z=performance.now();if(Z-n<S)return r.stopRebuffering(),s.Z.debug("Init: letting the device get out of a stall by itself"),void e.trigger("stalled",R);s.Z.warn("Init: ignored stall for too long, considering it",Z-n)}if(n=null,r.startRebuffering(),null!==e._manifest){var x=g.position;if(null!=x&&e._speed.getValue()>0){var P=function(e,t,n){if(0===e.length)return null;for(var r=null,i=0;i<e.length;i++){var a=e[i].period;if(a.start>n)return r;var o=void 0;if(void 0===a.end||a.end>n){var u=e[i],l=u.discontinuity,d=u.position,c=l.start,f=l.end;if(n>=(null!=c?c:d)-v)if(null===f){var p=t.getPeriodAfter(a);null!==p?o=p.start+v:s.Z.warn("Init: discontinuity at Period's end but no next Period")}else n<f+v&&(o=f+v);void 0!==o&&(s.Z.info("Init: discontinuity found",n,o),r=null!==r&&r>o?r:o)}}return r}(c,e._manifest,x);if(null!==P){var M=P+.001;if(!(M<=e._playbackObserver.getCurrentTime()))return s.Z.warn("SA: skippable discontinuity found in the stream",p,M),e._playbackObserver.setCurrentTime(M),void e.trigger("warning",m(x,M));s.Z.info("Init: position to seek already reached, no seeking",e._playbackObserver.getCurrentTime(),M)}}var C=null!=x?x:p,D=(0,l.XS)(f,C);if(e._speed.getValue()>0&&D<b){var N=C+D+v;if(e._playbackObserver.getCurrentTime()<N)return s.Z.warn("Init: discontinuity encountered inferior to the threshold",C,N,b),e._playbackObserver.setCurrentTime(N),void e.trigger("warning",m(C,N))}for(var O=e._manifest.periods.length-2;O>=0;O--){var L=e._manifest.periods[O];if(void 0!==L.end&&L.end<=C){if(e._manifest.periods[O+1].start>C&&e._manifest.periods[O+1].start>e._playbackObserver.getCurrentTime()){var U=e._manifest.periods[O+1];return e._playbackObserver.setCurrentTime(U.start),void e.trigger("warning",m(C,U.start))}break}}e.trigger("stalled",R)}else e.trigger("stalled",R)}}),{includeLastObservation:!0,clearSignal:this._canceller.signal})}},n.updateDiscontinuityInfo=function(e){this._isStarted||this.start();var t=this._playbackObserver.getReference().getValue();!function(e,t,n){for(;e.length>0&&void 0!==e[0].period.end&&e[0].period.end+10<n.position;)e.shift();var r=t.period,i=t.bufferType;if("audio"!==i&&"video"!==i)return;for(var a=0;a<e.length;a++)if(e[a].period.id===r.id){if(e[a].bufferType===i)return void(h(t)?e[a]=t:e.splice(a,1))}else if(e[a].period.start>r.start)return void(h(t)&&e.splice(a,0,t));h(t)&&e.push(t)}(this._discontinuitiesStore,e,t)},n.onLockedStream=function(e,t){var n;this._isStarted||this.start();var r=this._playbackObserver.getReference().getValue();if(!(!r.rebuffering||r.paused||this._speed.getValue()<=0||"audio"!==e&&"video"!==e)){var i=r.position,a=null!==(n=r.rebuffering.position)&&void 0!==n?n:i,o=t.start;i<o&&Math.abs(a-o)<1&&(s.Z.warn("Init: rebuffering because of a future locked stream.\nTrying to unlock by seeking to the next Period"),this._playbackObserver.setCurrentTime(o+.001))}},n.destroy=function(){this._canceller.cancel()},n._checkDecipherabilityFreeze=function(e){var t=e.readyState,n=e.rebuffering,r=e.freezing,i=void 0!==e.bufferGap&&isFinite(e.bufferGap)?e.bufferGap:0;if(null===this._segmentBuffersStore||i<6||null===n&&null===r||t>1)return this._currentFreezeTimestamp=null,!1;var a=performance.now();null===this._currentFreezeTimestamp&&(this._currentFreezeTimestamp=a);var o=null!==n&&a-n.timestamp>4e3,u=null!==r&&a-r.timestamp>4e3;if((o||u)&&performance.now()-this._currentFreezeTimestamp>4e3){for(var l=!0,d=!0,f=0,v=[this._segmentBuffersStore.getStatus("audio"),this._segmentBuffersStore.getStatus("video")];f<v.length;f++){var p=v[f];if("initialized"===p.type)for(var h,m=c(p.value.getInventory());!(h=m()).done;){var g=h.value.infos.representation;if(!1===g.decipherable)return s.Z.warn("Init: we have undecipherable segments left in the buffer, reloading"),this._currentFreezeTimestamp=null,this.trigger("needsReload",null),!0;void 0!==g.contentProtections&&(d=!1,!0!==g.decipherable&&(l=!1))}}if(!d&&l)return s.Z.warn("Init: we are frozen despite only having decipherable segments left in the buffer, reloading"),this._currentFreezeTimestamp=null,this.trigger("needsReload",null),!0}return!1},t}(u.Z);function h(e){return null!==e.discontinuity}function m(e,t){return new o.Z("DISCONTINUITY_ENCOUNTERED","A discontinuity has been encountered at position "+String(e)+", seeked at position "+String(t))}var g=function(){function e(e,t){this._speedUpdateCanceller=new d.ZP,this._isRebuffering=!1,this._playbackObserver=e,this._isDisposed=!1,this._speed=t,this._updateSpeed()}var t=e.prototype;return t.startRebuffering=function(){this._isRebuffering||this._isDisposed||(this._isRebuffering=!0,this._speedUpdateCanceller.cancel(),s.Z.info("Init: Pause playback to build buffer"),this._playbackObserver.setPlaybackRate(0))},t.stopRebuffering=function(){this._isRebuffering&&!this._isDisposed&&(this._isRebuffering=!1,this._speedUpdateCanceller=new d.ZP,this._updateSpeed())},t.dispose=function(){this._speedUpdateCanceller.cancel(),this._isDisposed=!0},t._updateSpeed=function(){var e=this;this._speed.onUpdate((function(t){s.Z.info("Init: Resume playback speed",t),e._playbackObserver.setPlaybackRate(t)}),{clearSignal:this._speedUpdateCanceller.signal,emitCurrentValue:!0})},e}()},4576:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3714),i=n(1946);function a(e,t,n){function a(){var n,a,o=e.error;switch((0,i.Z)(o)||(n=o.code,a=o.message),n){case 1:return a=null!=a?a:"The fetching of the associated resource was aborted by the user's request.",t(new r.Z("MEDIA_ERR_ABORTED",a));case 2:return a=null!=a?a:"A network error occurred which prevented the media from being successfully fetched",t(new r.Z("MEDIA_ERR_NETWORK",a));case 3:return a=null!=a?a:"An error occurred while trying to decode the media resource",t(new r.Z("MEDIA_ERR_DECODE",a));case 4:return a=null!=a?a:"The media resource has been found to be unsuitable.",t(new r.Z("MEDIA_ERR_SRC_NOT_SUPPORTED",a));default:return a=null!=a?a:"The HTMLMediaElement errored due to an unknown reason.",t(new r.Z("MEDIA_ERR_UNKNOWN",a))}}n.isCancelled()||(e.addEventListener("error",a),n.register((function(){e.removeEventListener("error",a)})))}},5192:function(e,t,n){"use strict";n.d(t,{Z:function(){return k}});var r=n(4578),i=n(3038),a=n(3887),o=n(5095),s=n(2203).Z?void 0:window.ResizeObserver;var u=n(6872),l=n(288),d=n(9612),c=n(4309),f=n(7874);function v(e,t){return Math.abs(e-t)<=.2}function p(e,t){for(var n=e.length-1;n>=0;n--){if(e[n].start<t)return e.slice(0,n+1)}return[]}function h(e,t){for(var n=0;n<e.length;n++){if(e[n].end>t)return e.slice(n,e.length)}return[]}function m(e,t,n){var r=Math.max(e.start,t),i=p(e.cues,t),a={start:e.start,end:r,cues:i},o=Math.min(n,e.end),s=h(e.cues,n);return[a,{start:o,end:e.end,cues:s}]}var g=function(){function e(){this._cuesBuffer=[]}var t=e.prototype;return t.get=function(e){for(var t=this._cuesBuffer,n=[],r=t.length-1;r>=0;r--){var i=t[r];if(e<i.end&&e>=i.start){for(var a=i.cues,o=0;o<a.length;o++)e>=a[o].start&&e<a[o].end&&n.push(a[o].element);return n}}return[]},t.remove=function(e,t){for(var n=Math.max(e,t),r=this._cuesBuffer,i=0;i<r.length;i++)if(r[i].end>e){var a=r[i];if(a.start>=n)return;if(a.end>=n){if(e<=a.start)a.cues=h(a.cues,n),a.start=n;else{var o=m(a,e,n),s=o[0],u=o[1];this._cuesBuffer[i]=s,r.splice(i+1,0,u)}return}a.start>=e?(r.splice(i,1),i--):(a.cues=p(a.cues,e),a.end=Math.max(e,a.start))}},t.insert=function(e,t,n){var r=this._cuesBuffer,i={start:t,end:n,cues:e};function a(e){var t=r[e];void 0===t||v(i.end,t.end)?r[e]=i:(t.start>=i.end||(t.cues=h(t.cues,i.end),t.start=i.end),r.splice(e,0,i))}for(var o=0;o<r.length;o++){var s=r[o];if(t<s.end){if(v(t,s.start)){if(v(n,s.end))return void(r[o]=i);if(n<s.end)return s.cues=h(s.cues,n),s.start=n,void r.splice(o,0,i);do{r.splice(o,1),s=r[o]}while(void 0!==s&&n>s.end);return void a(o)}if(t<s.start){if(n<s.start)return void r.splice(o,0,i);if(v(n,s.start))return s.start=n,void r.splice(o,0,i);if(v(n,s.end))return void r.splice(o,1,i);if(n<s.end)return s.cues=h(s.cues,n),s.start=n,void r.splice(o,0,i);do{r.splice(o,1),s=r[o]}while(void 0!==s&&n>s.end);return void a(o)}if(v(s.end,n))return s.cues=p(s.cues,t),s.end=t,void r.splice(o+1,0,i);if(s.end>n){var u=m(s,t,n),l=u[0],d=u[1];return this._cuesBuffer[o]=l,r.splice(o+1,0,i),void r.splice(o+2,0,d)}s.cues=p(s.cues,t),s.end=t;var c=o+1;for(s=r[c];void 0!==s&&n>s.end;)r.splice(c,1),s=r[c];return void a(c)}}r.push(i)},e}();function y(e,t,n,r){for(var i=[t/n.columns,e/n.rows],a=r.getElementsByClassName("proportional-style"),o=0;o<a.length;o++){var s=a[o];if(s instanceof HTMLElement){var u=s.getAttribute("data-proportional-font-size");null===u||isNaN(+u)||(s.style.fontSize=String(+u*i[1])+"px");var l=s.getAttribute("data-proportional-width");null===l||isNaN(+l)||(s.style.width=String(+l*i[0])+"px");var d=s.getAttribute("data-proportional-height");null===d||isNaN(+d)||(s.style.height=String(+d*i[1])+"px");var c=s.getAttribute("data-proportional-line-height");null===c||isNaN(+c)||(s.style.lineHeight=String(+c*i[1])+"px");var f=s.getAttribute("data-proportional-left");null===f||isNaN(+f)||(s.style.left=String(+f*i[0])+"px");var v=s.getAttribute("data-proportional-top");null===v||isNaN(+v)||(s.style.top=String(+v*i[1])+"px");var p=s.getAttribute("data-proportional-padding-top");null===p||isNaN(+p)||(s.style.paddingTop=String(+p*i[1])+"px");var h=s.getAttribute("data-proportional-padding-bottom");null===h||isNaN(+h)||(s.style.paddingBottom=String(+h*i[1])+"px");var m=s.getAttribute("data-proportional-padding-left");null===m||isNaN(+m)||(s.style.paddingLeft=String(+m*i[0])+"px");var g=s.getAttribute("data-proportional-padding-right");null===g||isNaN(+g)||(s.style.paddingRight=String(+g*i[0])+"px")}}return a.length>0}var _=i.M4,b=i.bQ,S=i.Q$;function E(e,t){try{e.removeChild(t)}catch(e){a.Z.warn("HTSB: Can't remove text track: not in the element.")}}function T(e){var t=e.getAttribute("data-resolution-rows"),n=e.getAttribute("data-resolution-columns");if(null===t||null===n)return null;var r=parseInt(t,10),i=parseInt(n,10);return null===r||null===i?null:{rows:r,columns:i}}var k=function(e){function t(t,n){var r;return a.Z.debug("HTSB: Creating HTMLTextSegmentBuffer"),(r=e.call(this)||this).bufferType="text",r._buffered=new c.Z,r._videoElement=t,r._textTrackElement=n,r._sizeUpdateCanceller=new l.ZP,r._canceller=new l.ZP,r._buffer=new g,r._currentCues=[],r.autoRefreshSubtitles(r._canceller.signal),r}(0,r.Z)(t,e);var n=t.prototype;return n.declareInitSegment=function(e){a.Z.warn("ISB: Declaring initialization segment for image SegmentBuffer",e)},n.freeInitSegment=function(e){a.Z.warn("ISB: Freeing initialization segment for image SegmentBuffer",e)},n.pushChunk=function(e){try{this.pushChunkSync(e)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this.removeBufferSync(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("HTSB: Disposing HTMLTextSegmentBuffer"),this._disableCurrentCues(),this._buffer.remove(0,1/0),this._buffered.remove(0,1/0),this._canceller.cancel()},n.pushChunkSync=function(e){var t,n;a.Z.debug("HTSB: Appending new html text tracks");var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk;if(null!==s){var u,l,d=s.start,c=s.end,v=s.data,p=s.type,h=s.language,m=null!==(t=o[0])&&void 0!==t?t:0,g=null!==(n=o[1])&&void 0!==n?n:1/0,y=function(e,t,n,r){a.Z.debug("HTSB: Finding parser for html text tracks:",e);var i=f.Z.htmlTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("HTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("HTTB: Parsed successfully!",o.length),o}(p,v,i,h);if(0!==m&&g!==1/0){for(var _=0;_<y.length&&y[_].end<=m;)_++;for(y.splice(0,_),_=0;_<y.length&&y[_].start<m;)y[_].start=m,_++;for(_=y.length-1;_>=0&&y[_].start>=g;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].end>g;)y[_].end=g,_--}if(void 0!==d)u=Math.max(m,d);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor start time. Aborting");a.Z.warn("HTSB: No start time given. Guessing from cues."),u=y[0].start}if(void 0!==c)l=Math.min(g,c);else{if(y.length<=0)return void a.Z.warn("HTSB: Current text tracks have no cues nor end time. Aborting");a.Z.warn("HTSB: No end time given. Guessing from cues."),l=y[y.length-1].end}l<=u?a.Z.warn("HTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."):(null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos),this._buffer.insert(y,u,l),this._buffered.insert(u,l))}},n.removeBufferSync=function(e,t){a.Z.debug("HTSB: Removing html text track data",e,t),this._buffer.remove(e,t),this._buffered.remove(e,t)},n._disableCurrentCues=function(){if(this._sizeUpdateCanceller.cancel(),this._currentCues.length>0){for(var e=0;e<this._currentCues.length;e++)E(this._textTrackElement,this._currentCues[e].element);this._currentCues=[]}},n._displayCues=function(e){if(!(this._currentCues.length===e.length&&this._currentCues.every((function(t,n){return t.element===e[n]})))){this._sizeUpdateCanceller.cancel();for(var t=0;t<this._currentCues.length;t++)E(this._textTrackElement,this._currentCues[t].element);this._currentCues=[];for(var n=0;n<e.length;n++){var r=e[n],i=T(r);this._currentCues.push({element:r,resolution:i}),this._textTrackElement.appendChild(r)}var d=this._currentCues.filter((function(e){return null!==e.resolution}));if(d.length>0){this._sizeUpdateCanceller=new l.ZP,this._sizeUpdateCanceller.linkToSignal(this._canceller.signal);var c=u.Z.getCurrent().TEXT_TRACK_SIZE_CHECKS_INTERVAL,f=function(e,t,n){var r=e.getBoundingClientRect(),i=r.height,u=r.width,l=(0,o.ZP)({height:i,width:u},n),d=i,c=u;if(void 0!==s){var f=new s((function(e){if(0!==e.length){var t=e[0].contentRect,n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}else a.Z.error("Compat: Resized but no observed element.")}));f.observe(e),n.register((function(){f.disconnect()}))}else{var v=setInterval((function(){var t=e.getBoundingClientRect(),n=t.height,r=t.width;n===d&&r===c||(d=n,c=r,l.setValue({height:n,width:r}))}),t);n.register((function(){clearInterval(v)}))}return l}(this._textTrackElement,c,this._sizeUpdateCanceller.signal);f.onUpdate((function(e){for(var t=e.height,n=e.width,r=0;r<d.length;r++){var i=d[r];y(t,n,i.resolution,i.element)}}),{clearSignal:this._sizeUpdateCanceller.signal,emitCurrentValue:!0})}}},n.autoRefreshSubtitles=function(e){var t=this,n=null,r=u.Z.getCurrent().MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL,i=function(){a(),(n=new l.ZP).linkToSignal(e);var i=setInterval((function(){return t.refreshSubtitles()}),r);n.signal.register((function(){clearInterval(i)})),t.refreshSubtitles()};function a(){null!==n&&(n.cancel(),n=null)}S(this._videoElement,(function(){a(),t._disableCurrentCues()}),e),b(this._videoElement,i,e),_(this._videoElement,i,e),i()},n.refreshSubtitles=function(){var e,t=u.Z.getCurrent().MAXIMUM_HTML_TEXT_TRACK_UPDATE_INTERVAL;e=this._videoElement.paused||this._videoElement.playbackRate<=0?this._videoElement.currentTime:Math.max(this._videoElement.currentTime+t/1e3/2,0);var n=this._buffer.get(e);0===n.length?this._disableCurrentCues():this._displayCues(n)},t}(d.C)},9059:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(4578),i=n(3666);var a=n(3887);function o(e,t){if(i.vU&&function(e,t){var n=e.activeCues;if(null===n)return!1;for(var r=0;r<n.length;r++)if(n[r]===t)return!0;return!1}(e,t)){var n=e.mode;e.mode="hidden";try{e.removeCue(t)}catch(e){a.Z.warn("Compat: Could not remove cue from text track.")}e.mode=n}else try{e.removeCue(t)}catch(e){a.Z.warn("Compat: Could not remove cue from text track.")}}var s=n(9612),u=n(4309),l=n(7874);var d=function(e){function t(t){var n;a.Z.debug("NTSB: Creating NativeTextSegmentBuffer"),n=e.call(this)||this;var r=function(e){var t,n,r,a="subtitles";if(i.YM){var o=e.textTracks.length;(n=o>0?e.textTracks[o-1]:e.addTextTrack(a)).mode=null!==(t=n.SHOWING)&&void 0!==t?t:"showing"}else r=document.createElement("track"),e.appendChild(r),n=r.track,r.kind=a,n.mode="showing";return{track:n,trackElement:r}}(t),o=r.track,s=r.trackElement;return n.bufferType="text",n._buffered=new u.Z,n._videoElement=t,n._track=o,n._trackElement=s,n}(0,r.Z)(t,e);var n=t.prototype;return n.declareInitSegment=function(e){a.Z.warn("ISB: Declaring initialization segment for image SegmentBuffer",e)},n.freeInitSegment=function(e){a.Z.warn("ISB: Freeing initialization segment for image SegmentBuffer",e)},n.pushChunk=function(e){var t,n;if(a.Z.debug("NTSB: Appending new native text tracks"),null===e.data.chunk)return Promise.resolve();var r=e.data,i=r.timestampOffset,o=r.appendWindow,s=r.chunk,u=s.start,d=s.end,c=s.data,f=s.type,v=s.language,p=null!==(t=o[0])&&void 0!==t?t:0,h=null!==(n=o[1])&&void 0!==n?n:1/0;try{var m,g,y=function(e,t,n,r){a.Z.debug("NTSB: Finding parser for native text tracks:",e);var i=l.Z.nativeTextTracksParsers[e];if("function"!=typeof i)throw new Error("no parser found for the given text track");a.Z.debug("NTSB: Parser found, parsing...");var o=i(t,n,r);return a.Z.debug("NTSB: Parsed successfully!",o.length),o}(f,c,i,v);if(0!==p&&h!==1/0){for(var _=0;_<y.length&&y[_].endTime<=p;)_++;for(y.splice(0,_),_=0;_<y.length&&y[_].startTime<p;)y[_].startTime=p,_++;for(_=y.length-1;_>=0&&y[_].startTime>=h;)_--;for(y.splice(_,y.length),_=y.length-1;_>=0&&y[_].endTime>h;)y[_].endTime=h,_--}if(void 0!==u)m=Math.max(p,u);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor start time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No start time given. Guessing from cues."),m=y[0].startTime}if(void 0!==d)g=Math.min(h,d);else{if(y.length<=0)return a.Z.warn("NTSB: Current text tracks have no cues nor end time. Aborting"),Promise.resolve();a.Z.warn("NTSB: No end time given. Guessing from cues."),g=y[y.length-1].endTime}if(g<=m)return a.Z.warn("NTSB: Invalid text track appended: ","the start time is inferior or equal to the end time."),Promise.resolve();if(y.length>0){var b=y[0],S=this._track.cues;null!==S&&S.length>0&&b.startTime<S[S.length-1].startTime&&this._removeData(b.startTime,1/0);for(var E=0;E<y.length;E++)this._track.addCue(y[E])}this._buffered.insert(m,g),null!==e.inventoryInfos&&this._segmentInventory.insertChunk(e.inventoryInfos)}catch(e){return Promise.reject(e)}return Promise.resolve()},n.removeBuffer=function(e,t){return this._removeData(e,t),Promise.resolve()},n.endOfSegment=function(e){return this._segmentInventory.completeSegment(e,this._buffered),Promise.resolve()},n.getBufferedRanges=function(){return this._buffered},n.dispose=function(){a.Z.debug("NTSB: Aborting NativeTextSegmentBuffer"),this._removeData(0,1/0);var e=this._trackElement,t=this._videoElement;if(void 0!==e&&t.hasChildNodes())try{t.removeChild(e)}catch(e){a.Z.warn("NTSB: Can't remove track element from the video")}this._track.mode="disabled",void 0!==this._trackElement&&(this._trackElement.innerHTML="")},n._removeData=function(e,t){a.Z.debug("NTSB: Removing native text track data",e,t);var n=this._track,r=n.cues;if(null!==r)for(var i=r.length-1;i>=0;i--){var s=r[i],u=s.startTime,l=s.endTime;u>=e&&u<=t&&l<=t&&o(n,s)}this._buffered.remove(e,t)},t}(s.C)},9612:function(e,t,n){"use strict";n.d(t,{C:function(){return _},f:function(){return g}});var r=n(6872),i=n(3887),a=n(520),o=n(5278);function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var l=function(){function e(e,t){this._history=[],this._lifetime=e,this._maxHistoryLength=t}var t=e.prototype;return t.addBufferedSegment=function(e,t){var n=performance.now();this._history.push({date:n,buffered:t,context:e}),this._cleanHistory(n)},t.getHistoryFor=function(e){return this._history.filter((function(t){return(0,a.z)(t.context,e)}))},t._cleanHistory=function(e){for(var t,n=e-this._lifetime,r=0,i=s(this._history);!(t=i()).done;){if(!(t.value.date<n))break;r++}if(r>0&&(this._history=this._history.splice(r)),this._history.length>this._maxHistoryLength){var a=this._history.length-this._maxHistoryLength;this._history=this._history.splice(a)}},e}();function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f=function(){function e(){var e=r.Z.getCurrent(),t=e.BUFFERED_HISTORY_RETENTION_TIME,n=e.BUFFERED_HISTORY_MAXIMUM_ENTRIES;this._inventory=[],this._bufferedHistory=new l(t,n)}var t=e.prototype;return t.reset=function(){this._inventory.length=0},t.synchronizeBuffered=function(e){for(var t=this._inventory,n=0,a=t[0],s=r.Z.getCurrent().MINIMUM_SEGMENT_SIZE,u=null==a?void 0:a.infos.adaptation.type,l=e.length,c=0;c<l;c++){if(void 0===a)return;var f=e.start(c),v=e.end(c);if(v-f<s)i.Z.warn("SI: skipped TimeRange when synchronizing because it was too small",u,f,v);else{for(var p=n;void 0!==a&&(0,o.Z)(a.bufferedEnd,a.end)-f<s;)a=t[++n];var g=null,y=n-p;if(y>0){var _=t[p+y-1];g={end:(0,o.Z)(_.bufferedEnd,_.end),precizeEnd:_.precizeEnd},i.Z.debug("SI: "+y+" segments GCed.",u);for(var b,S=d(t.splice(p,y));!(b=S()).done;){var E=b.value;void 0===E.bufferedStart&&void 0===E.bufferedEnd&&this._bufferedHistory.addBufferedSegment(E.infos,null)}n=p}if(void 0===a)return;if(v-(0,o.Z)(a.bufferedStart,a.start)>=s){if(h(a,f,g,u),n===t.length-1)return void m(a,v,u);a=t[++n];for(var T=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end),w=c<l-1?e.start(c+1):void 0;void 0!==a&&v-T>=s&&(void 0===w||v-T>=k-w);){var A=t[n-1];void 0===A.bufferedEnd&&(A.bufferedEnd=a.precizeStart?a.start:A.end,i.Z.debug("SI: calculating buffered end of contiguous segment",u,A.bufferedEnd,A.end)),a.bufferedStart=A.bufferedEnd,void 0!==(a=t[++n])&&(T=(0,o.Z)(a.bufferedStart,a.start),k=(0,o.Z)(a.bufferedEnd,a.end))}}var I=t[n-1];void 0!==I&&m(I,v,u)}}if(null!=a){i.Z.debug("SI: last segments have been GCed",u,n,t.length);for(var R,Z=d(t.splice(n,t.length-n));!(R=Z()).done;){var x=R.value;void 0===x.bufferedStart&&void 0===x.bufferedEnd&&this._bufferedHistory.addBufferedSegment(x.infos,null)}}void 0!==u&&i.Z.hasLevel("DEBUG")&&i.Z.debug("SI: current "+u+" inventory timeline:\n"+function(e){var t=1/60,n={},r=[],i=null,a=null;function o(e){var t=String.fromCharCode(r.length+65);return r.push({letter:t,periodId:e.period.id,representationId:e.representation.id,bitrate:e.representation.bitrate}),t}for(var s="",u=0;u<e.length;u++){var l=e[u];if(void 0!==l.bufferedStart&&void 0!==l.bufferedEnd){var d,c=l.infos.period.id,f=l.infos.representation.id,v=n[c],p=void 0;if(void 0===v)p=o(l.infos),n[c]=((d={})[f]=p,d);else void 0===v[f]?(p=o(l.infos),v[f]=p):p=v[f];null===i?s+=l.bufferedStart.toFixed(2)+"|"+p+"|":a===p?i.bufferedEnd+t<l.bufferedStart&&(s+=i.bufferedEnd.toFixed(2)+" ~ "+l.bufferedStart.toFixed(2)+"|"+p+"|"):s+=i.bufferedEnd.toFixed(2)+" ~ "+l.bufferedStart.toFixed(2)+"|"+p+"|",i=l,a=p}}null!==i&&(s+=String(i.end.toFixed(2)));return r.forEach((function(e){var t;s+="\n["+e.letter+"] P: "+e.periodId+" || R: "+e.representationId+"("+(null!==(t=e.bitrate)&&void 0!==t?t:"unknown bitrate")+")"})),s}(this._inventory))},t.insertChunk=function(e){var t=e.period,n=e.adaptation,r=e.representation,a=e.segment,o=e.chunkSize,s=e.start,u=e.end;if(!a.isInit){var l=n.type;if(s>=u)i.Z.warn("SI: Invalid chunked inserted: starts before it ends",l,s,u);else{for(var d=this._inventory,c={partiallyPushed:!0,chunkSize:o,splitted:!1,start:s,end:u,precizeStart:!1,precizeEnd:!1,bufferedStart:void 0,bufferedEnd:void 0,infos:{segment:a,period:t,adaptation:n,representation:r}},f=d.length-1;f>=0;f--){var v=d[f];if(v.start<=s){if(v.end<=s){for(i.Z.debug("SI: Pushing segment strictly after previous one.",l,s,v.end),this._inventory.splice(f+1,0,c),f+=2;f<d.length&&d[f].start<c.end;){if(d[f].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}if(v.start===s){if(v.end<=u){for(i.Z.debug("SI: Segment pushed replace another one",l,s,u,v.end),this._inventory.splice(f,1,c),f+=1;f<d.length&&d[f].start<c.end;){if(d[f].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}return i.Z.debug("SI: Segment pushed ends before another with the same start",l,s,u,v.end),d.splice(f,0,c),v.start=c.end,v.bufferedStart=void 0,void(v.precizeStart=v.precizeStart&&c.precizeEnd)}if(v.end<=c.end){for(i.Z.debug("SI: Segment pushed updates end of previous one",l,s,u,v.start,v.end),this._inventory.splice(f+1,0,c),v.end=c.start,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,f+=2;f<d.length&&d[f].start<c.end;){if(d[f].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[f].start),d[f].start=c.end,d[f].bufferedStart=void 0,void(d[f].precizeStart=d[f].precizeStart&&c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[f].start,d[f].end),d.splice(f,1)}return}i.Z.warn("SI: Segment pushed is contained in a previous one",l,s,u,v.start,v.end);var p={partiallyPushed:v.partiallyPushed,chunkSize:v.chunkSize,splitted:!0,start:c.end,end:v.end,precizeStart:v.precizeStart&&v.precizeEnd&&c.precizeEnd,precizeEnd:v.precizeEnd,bufferedStart:void 0,bufferedEnd:v.end,infos:v.infos};return v.end=c.start,v.splitted=!0,v.bufferedEnd=void 0,v.precizeEnd=v.precizeEnd&&c.precizeStart,d.splice(f+1,0,c),void d.splice(f+2,0,p)}}var h=this._inventory[0];if(void 0===h)return i.Z.debug("SI: first segment pushed",l,s,u),void this._inventory.push(c);if(!(h.start>=u)){if(h.end<=u){for(i.Z.debug("SI: Segment pushed starts before and completely recovers the previous first one",l,s,u,h.start,h.end),this._inventory.splice(0,1,c);d.length>1&&d[1].start<c.end;){if(d[1].end>c.end)return i.Z.debug("SI: Segment pushed updates the start of the next one",l,c.end,d[1].start),d[1].start=c.end,d[1].bufferedStart=void 0,void(d[1].precizeStart=c.precizeEnd);i.Z.debug("SI: Segment pushed removes the next one",l,s,u,d[1].start,d[1].end),d.splice(1,1)}return}return i.Z.debug("SI: Segment pushed start of the next one",l,s,u,h.start,h.end),h.start=u,h.bufferedStart=void 0,h.precizeStart=c.precizeEnd,void this._inventory.splice(0,0,c)}i.Z.debug("SI: Segment pushed comes before all previous ones",l,s,u,h.start),this._inventory.splice(0,0,c)}}},t.completeSegment=function(e,t){if(!e.segment.isInit){for(var n=this._inventory,r=[],o=0;o<n.length;o++)if((0,a.z)(n[o].infos,e)){var s=!1;r.length>0&&(s=!0,1===r.length&&(i.Z.warn("SI: Completed Segment is splitted.",e.segment.id,e.segment.time,e.segment.end),r[0].splitted=!0));var u=o,l=n[o].chunkSize;for(o+=1;o<n.length&&(0,a.z)(n[o].infos,e);){var c=n[o].chunkSize;void 0!==l&&void 0!==c&&(l+=c),o++}var f=o-1,v=f-u,p=n[f].end,h=n[f].bufferedEnd;v>0&&(this._inventory.splice(u+1,v),o-=v),this._inventory[u].partiallyPushed=!1,this._inventory[u].chunkSize=l,this._inventory[u].end=p,this._inventory[u].bufferedEnd=h,this._inventory[u].splitted=s,r.push(this._inventory[u])}if(0===r.length)i.Z.warn("SI: Completed Segment not found",e.segment.id,e.segment.time);else{this.synchronizeBuffered(t);for(var m,g=d(r);!(m=g()).done;){var y=m.value;void 0!==y.bufferedStart&&void 0!==y.bufferedEnd?this._bufferedHistory.addBufferedSegment(y.infos,{start:y.bufferedStart,end:y.bufferedEnd}):i.Z.debug("SI: buffered range not known after sync. Skipping history.",y.start,y.end)}}}},t.getInventory=function(){return this._inventory},t.getHistoryFor=function(e){return this._bufferedHistory.getHistoryFor(e)},e}();function v(e){if(void 0===e.bufferedStart||e.partiallyPushed)return!1;var t=e.start,n=e.end-t,i=r.Z.getCurrent(),a=i.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,o=i.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(t-e.bufferedStart)<=a&&(void 0===e.bufferedEnd||e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-n)<=Math.min(o,n/3))}function p(e){if(void 0===e.bufferedEnd||e.partiallyPushed)return!1;var t=e.start,n=e.end,i=n-t,a=r.Z.getCurrent(),o=a.MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE,s=a.MAX_MANIFEST_BUFFERED_DURATION_DIFFERENCE;return Math.abs(n-e.bufferedEnd)<=o&&null!=e.bufferedStart&&e.bufferedEnd>e.bufferedStart&&Math.abs(e.bufferedEnd-e.bufferedStart-i)<=Math.min(s,i/3)}function h(e,t,n,a){var o=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedStart?(e.bufferedStart<t&&(i.Z.debug("SI: Segment partially GCed at the start",a,e.bufferedStart,t),e.bufferedStart=t),!e.precizeStart&&v(e)&&(e.start=e.bufferedStart,e.precizeStart=!0)):e.precizeStart?(i.Z.debug("SI: buffered start is precize start",a,e.start),e.bufferedStart=e.start):null!==n&&n.end>t&&(n.precizeEnd||e.start-n.end<=o)?(i.Z.debug("SI: buffered start is end of previous segment",a,t,e.start,n.end),e.bufferedStart=n.end,v(e)&&(e.start=n.end,e.precizeStart=!0)):e.start-t<=o?(i.Z.debug("SI: found true buffered start",a,t,e.start),e.bufferedStart=t,v(e)&&(e.start=t,e.precizeStart=!0)):t<e.start?i.Z.debug("SI: range start too far from expected start",a,t,e.start):(i.Z.debug("SI: Segment appears immediately garbage collected at the start",a,e.bufferedStart,t),e.bufferedStart=t)}function m(e,t,n){var a=r.Z.getCurrent().MAX_MANIFEST_BUFFERED_START_END_DIFFERENCE;void 0!==e.bufferedEnd?(e.bufferedEnd>t&&(i.Z.debug("SI: Segment partially GCed at the end",n,e.bufferedEnd,t),e.bufferedEnd=t),!e.precizeEnd&&t-e.end<=a&&p(e)&&(e.precizeEnd=!0,e.end=t)):e.precizeEnd?(i.Z.debug("SI: buffered end is precize end",n,e.end),e.bufferedEnd=e.end):t-e.end<=a?(i.Z.debug("SI: found true buffered end",n,t,e.end),e.bufferedEnd=t,p(e)&&(e.end=t,e.precizeEnd=!0)):t>e.end?(i.Z.debug("SI: range end too far from expected end",n,t,e.end),e.bufferedEnd=e.end):(i.Z.debug("SI: Segment appears immediately garbage collected at the end",n,e.bufferedEnd,t),e.bufferedEnd=t)}var g,y=f,_=function(){function e(){this._segmentInventory=new y}var t=e.prototype;return t.synchronizeInventory=function(){this._segmentInventory.synchronizeBuffered(this.getBufferedRanges())},t.getInventory=function(){return this._segmentInventory.getInventory()},t.getPendingOperations=function(){return[]},t.getSegmentHistory=function(e){return this._segmentInventory.getHistoryFor(e)},e}();!function(e){e[e.Push=0]="Push",e[e.Remove=1]="Remove",e[e.EndOfSegment=2]="EndOfSegment"}(g||(g={}))},4309:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2829),i=function(){function e(){this._ranges=[],this.length=0}var t=e.prototype;return t.insert=function(e,t){(0,r.kR)(this._ranges,{start:e,end:t}),this.length=this._ranges.length},t.remove=function(e,t){var n=[];e>0&&n.push({start:0,end:e}),t<1/0&&n.push({start:t,end:1/0}),this._ranges=(0,r.tn)(this._ranges,n),this.length=this._ranges.length},t.start=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].start},t.end=function(e){if(e>=this._ranges.length)throw new Error("INDEX_SIZE_ERROR");return this._ranges[e].end},e}()},7839:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a){var o;return o=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(o),t.prototype),o.name="CustomLoaderError",o.message=n,o.canRetry=i,o.xhr=a,o}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},5157:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;return u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="EncryptedMediaError",u.type=o.ZB.ENCRYPTED_MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1,"string"==typeof(null==a?void 0:a.keyStatuses)&&(u.keyStatuses=a.keyStatuses),u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},5992:function(e,t,n){"use strict";n.d(t,{SM:function(){return a},ZB:function(){return r},br:function(){return i}});var r={NETWORK_ERROR:"NETWORK_ERROR",MEDIA_ERROR:"MEDIA_ERROR",ENCRYPTED_MEDIA_ERROR:"ENCRYPTED_MEDIA_ERROR",OTHER_ERROR:"OTHER_ERROR"},i={TIMEOUT:"TIMEOUT",ERROR_EVENT:"ERROR_EVENT",ERROR_HTTP_CODE:"ERROR_HTTP_CODE",PARSE_ERROR:"PARSE_ERROR"},a={PIPELINE_LOAD_ERROR:"PIPELINE_LOAD_ERROR",PIPELINE_PARSE_ERROR:"PIPELINE_PARSE_ERROR",INTEGRITY_ERROR:"INTEGRITY_ERROR",MANIFEST_PARSE_ERROR:"MANIFEST_PARSE_ERROR",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"MANIFEST_INCOMPATIBLE_CODECS_ERROR",MANIFEST_UPDATE_ERROR:"MANIFEST_UPDATE_ERROR",MANIFEST_UNSUPPORTED_ADAPTATION_TYPE:"MANIFEST_UNSUPPORTED_ADAPTATION_TYPE",MEDIA_STARTING_TIME_NOT_FOUND:"MEDIA_STARTING_TIME_NOT_FOUND",MEDIA_TIME_BEFORE_MANIFEST:"MEDIA_TIME_BEFORE_MANIFEST",MEDIA_TIME_AFTER_MANIFEST:"MEDIA_TIME_AFTER_MANIFEST",MEDIA_TIME_NOT_FOUND:"MEDIA_TIME_NOT_FOUND",NO_PLAYABLE_REPRESENTATION:"NO_PLAYABLE_REPRESENTATION",MEDIA_IS_ENCRYPTED_ERROR:"MEDIA_IS_ENCRYPTED_ERROR",CREATE_MEDIA_KEYS_ERROR:"CREATE_MEDIA_KEYS_ERROR",KEY_ERROR:"KEY_ERROR",KEY_STATUS_CHANGE_ERROR:"KEY_STATUS_CHANGE_ERROR",KEY_UPDATE_ERROR:"KEY_UPDATE_ERROR",KEY_LOAD_ERROR:"KEY_LOAD_ERROR",KEY_LOAD_TIMEOUT:"KEY_LOAD_TIMEOUT",KEY_GENERATE_REQUEST_ERROR:"KEY_GENERATE_REQUEST_ERROR",INCOMPATIBLE_KEYSYSTEMS:"INCOMPATIBLE_KEYSYSTEMS",INVALID_ENCRYPTED_EVENT:"INVALID_ENCRYPTED_EVENT",INVALID_KEY_SYSTEM:"INVALID_KEY_SYSTEM",LICENSE_SERVER_CERTIFICATE_ERROR:"LICENSE_SERVER_CERTIFICATE_ERROR",MULTIPLE_SESSIONS_SAME_INIT_DATA:"MULTIPLE_SESSIONS_SAME_INIT_DATA",BUFFER_APPEND_ERROR:"BUFFER_APPEND_ERROR",BUFFER_FULL_ERROR:"BUFFER_FULL_ERROR",BUFFER_TYPE_UNKNOWN:"BUFFER_TYPE_UNKNOWN",MEDIA_ERR_BLOCKED_AUTOPLAY:"MEDIA_ERR_BLOCKED_AUTOPLAY",MEDIA_ERR_PLAY_NOT_ALLOWED:"MEDIA_ERR_PLAY_NOT_ALLOWED",MEDIA_ERR_NOT_LOADED_METADATA:"MEDIA_ERR_NOT_LOADED_METADATA",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_UNKNOWN:"MEDIA_ERR_UNKNOWN",MEDIA_SOURCE_NOT_SUPPORTED:"MEDIA_SOURCE_NOT_SUPPORTED",MEDIA_KEYS_NOT_SUPPORTED:"MEDIA_KEYS_NOT_SUPPORTED",DISCONTINUITY_ENCOUNTERED:"DISCONTINUITY_ENCOUNTERED",NONE:"NONE"}},7367:function(e,t,n){"use strict";function r(e,t,n){return e+" ("+t+") "+n}n.d(t,{Z:function(){return r}})},8750:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(9822),i=n(5389);function a(e,t){var n=t.defaultCode,a=t.defaultReason;if((0,r.Z)(e))return e;var o=e instanceof Error?e.toString():a;return new i.Z(n,o)}},9822:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(5157),i=n(5992),a=n(3714),o=n(9362),s=n(5389);function u(e){return(e instanceof r.Z||e instanceof a.Z||e instanceof s.Z||e instanceof o.Z)&&Object.keys(i.ZB).indexOf(e.type)>=0}},3714:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i,a){var u;u=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(u),t.prototype),u.name="MediaError",u.type=o.ZB.MEDIA_ERROR,u.code=n,u.message=(0,s.Z)(u.name,u.code,i),u.fatal=!1;var l=null==a?void 0:a.adaptation;if(void 0!==l)switch(l.type){case"audio":u.trackInfo={type:"audio",track:l.toAudioTrack(!1)};break;case"video":u.trackInfo={type:"video",track:l.toVideoTrack(!1)};break;case"text":u.trackInfo={type:"text",track:l.toTextTrack()}}return u}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9362:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="NetworkError",a.type=o.ZB.NETWORK_ERROR,a.url=i.url,a.status=i.status,a.errorType=i.type,a.code=n,a.message=(0,s.Z)(a.name,a.code,i.message),a.fatal=!1,a}return(0,i.Z)(t,e),t.prototype.isHttpError=function(e){return this.errorType===o.br.ERROR_HTTP_CODE&&this.status===e},t}((0,a.Z)(Error))},5389:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(7326),i=n(4578),a=n(2146),o=n(5992),s=n(7367),u=function(e){function t(n,i){var a;return a=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(a),t.prototype),a.name="OtherError",a.type=o.ZB.OTHER_ERROR,a.code=n,a.message=(0,s.Z)(a.name,a.code,i),a.fatal=!1,a}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},9105:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7326),i=n(4578),a=function(e){function t(n,i,a){var o;return o=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(o),t.prototype),o.name="RequestError",o.url=n,o.status=i,o.type=a,o.message=a,o}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error))},7273:function(e,t){"use strict";t.Z={dashParsers:{wasm:null,js:null},createDebugElement:null,directfile:null,ContentDecryptor:null,htmlTextTracksBuffer:null,htmlTextTracksParsers:{},nativeTextTracksBuffer:null,nativeTextTracksParsers:{},transports:{}}},7874:function(e,t,n){"use strict";var r=n(7273);t.Z=r.Z},3887:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(8894),i=new(function(){function e(){this.error=r.Z,this.warn=r.Z,this.info=r.Z,this.debug=r.Z,this._levels={NONE:0,ERROR:1,WARNING:2,INFO:3,DEBUG:4},this._currentLevel="NONE"}var t=e.prototype;return t.setLevel=function(e){var t,n=this._levels[e];"number"==typeof n?(t=n,this._currentLevel=e):(t=0,this._currentLevel="NONE"),this.error=t>=this._levels.ERROR?console.error.bind(console):r.Z,this.warn=t>=this._levels.WARNING?console.warn.bind(console):r.Z,this.info=t>=this._levels.INFO?console.info.bind(console):r.Z,this.debug=t>=this._levels.DEBUG?console.log.bind(console):r.Z},t.getLevel=function(){return this._currentLevel},t.hasLevel=function(e){return this._levels[e]>=this._levels[this._currentLevel]},e}())},9665:function(e,t,n){"use strict";n.d(t,{r:function(){return v},Z:function(){return p}});var r=n(3887),i=n(3274),a=n(1946),o=n(5288),s=n(3774);var u=n(4791);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var c=(0,n(908).Z)(),f=function(){function e(e,t){if(this.id=e.id,this.uniqueId=c(),this.bitrate=e.bitrate,this.codec=e.codecs,void 0!==e.height&&(this.height=e.height),void 0!==e.width&&(this.width=e.width),void 0!==e.mimeType&&(this.mimeType=e.mimeType),void 0!==e.contentProtections&&(this.contentProtections=e.contentProtections),void 0!==e.frameRate&&(this.frameRate=e.frameRate),void 0!==e.hdrInfo&&(this.hdrInfo=e.hdrInfo),this.cdnMetadata=e.cdnMetadata,this.index=e.index,"audio"===t.type||"video"===t.type){var n=this.getMimeTypeString(),i=(a=n,null!=s.J&&("function"!=typeof s.J.isTypeSupported||s.J.isTypeSupported(a)));i||r.Z.info("Unsupported Representation",n,this.id,this.bitrate),this.isSupported=i}else this.isSupported=!0;var a}var t=e.prototype;return t.getMimeTypeString=function(){var e,t;return(null!==(e=this.mimeType)&&void 0!==e?e:"")+';codecs="'+(null!==(t=this.codec)&&void 0!==t?t:"")+'"'},t.getEncryptionData=function(e){for(var t,n,r=this.getAllEncryptionData(),i=[],a=0;a<r.length;a++)for(var o=!1,s=r[a],u=0;u<s.values.length;u++)if(s.values[u].systemId.toLowerCase()===e.toLowerCase())if(o)i[i.length-1].values.push(s.values[u]);else{var l=null===(n=null===(t=this.contentProtections)||void 0===t?void 0:t.keyIds)||void 0===n?void 0:n.map((function(e){return e.keyId}));i.push({type:s.type,keyIds:l,values:[s.values[u]]}),o=!0}return i},t.getAllEncryptionData=function(){var e,t;if(void 0===this.contentProtections||0===this.contentProtections.initData.length)return[];var n=null===(t=null===(e=this.contentProtections)||void 0===e?void 0:e.keyIds)||void 0===t?void 0:t.map((function(e){return e.keyId}));return this.contentProtections.initData.map((function(e){return{type:e.type,keyIds:n,values:e.values}}))},t.addProtectionData=function(e,t,n){var i=!1;if(void 0===this.contentProtections)return this.contentProtections={keyIds:void 0!==t?[{keyId:t}]:[],initData:[{type:e,values:n}]},!0;if(void 0!==t){var a=this.contentProtections.keyIds;if(void 0===a)this.contentProtections.keyIds=[{keyId:t}];else{for(var o,s=!1,d=l(a);!(o=d()).done;){var c=o.value;(0,u.Z)(c.keyId,t)&&(s=!0)}s||(r.Z.warn("Manifest: found unanounced key id."),a.push({keyId:t}))}}for(var f=this.contentProtections.initData,v=0;v<f.length;v++)if(f[v].type===e){for(var p=f[v].values,h=0;h<n.length;h++){var m=n[h],g=void 0;for(g=0;g<p.length;g++)if(m.systemId===p[g].systemId){if((0,u.Z)(m.data,p[g].data))break;r.Z.warn("Manifest: different init data for the same system ID")}g===p.length&&(p.push(m),i=!0)}return i}return this.contentProtections.initData.push({type:e,values:n}),!0},t.toAudioRepresentation=function(){return{id:this.id,bitrate:this.bitrate,codec:this.codec,isCodecSupported:this.isSupported,seemsDecipherable:this.decipherable}},t.toVideoRepresentation=function(){return{id:this.id,bitrate:this.bitrate,frameRate:this.frameRate,width:this.width,height:this.height,codec:this.codec,hdrInfo:this.hdrInfo,isCodecSupported:this.isSupported,seemsDecipherable:this.decipherable}},t.isPlayable=function(){return this.isSupported&&!1!==this.decipherable},e}(),v=["audio","video","text"],p=function(){function e(t,n){void 0===n&&(n={});var i=t.trickModeTracks,s=n,u=s.representationFilter,l=s.isManuallyAdded;this.id=t.id,this.type=t.type,void 0!==t.isTrickModeTrack&&(this.isTrickModeTrack=t.isTrickModeTrack),void 0!==t.language&&(this.language=t.language,this.normalizedLanguage=(0,o.ZP)(t.language)),void 0!==t.closedCaption&&(this.isClosedCaption=t.closedCaption),void 0!==t.audioDescription&&(this.isAudioDescription=t.audioDescription),void 0!==t.isDub&&(this.isDub=t.isDub),void 0!==t.forcedSubtitles&&(this.isForcedSubtitles=t.forcedSubtitles),void 0!==t.isSignInterpreted&&(this.isSignInterpreted=t.isSignInterpreted),void 0!==t.label&&(this.label=t.label),void 0!==i&&i.length>0&&(this.trickModeTracks=i.map((function(t){return new e(t)})));for(var d=t.representations,c=[],v=!1,p=0;p<d.length;p++){var h=new f(d[p],{type:this.type}),m=!0;if(!(0,a.Z)(u)){var g={id:h.id,bitrate:h.bitrate,codec:h.codec,height:h.height,width:h.width,frameRate:h.frameRate,hdrInfo:h.hdrInfo};if(void 0!==h.contentProtections&&(g.contentProtections={},void 0!==h.contentProtections.keyIds)){var y=h.contentProtections.keyIds.map((function(e){return e.keyId}));g.contentProtections.keyIds=y}m=u(g,{trackType:this.type,language:this.language,normalizedLanguage:this.normalizedLanguage,isClosedCaption:this.isClosedCaption,isDub:this.isDub,isAudioDescription:this.isAudioDescription,isSignInterpreted:this.isSignInterpreted})}m?(c.push(h),!v&&h.isSupported&&(v=!0)):r.Z.debug("Filtering Representation due to representationFilter",this.type,"Adaptation: "+this.id,"Representation: "+h.id,"("+h.bitrate+")")}c.sort((function(e,t){return e.bitrate-t.bitrate})),this.representations=c,this.isSupported=v,this.manuallyAdded=!0===l}var t=e.prototype;return t.getPlayableRepresentations=function(){return this.representations.filter((function(e){return e.isPlayable()}))},t.getRepresentation=function(e){return(0,i.Z)(this.representations,(function(t){var n=t.id;return e===n}))},t.toAudioTrack=function(e){var t,n,r={language:null!==(t=this.language)&&void 0!==t?t:"",normalized:null!==(n=this.normalizedLanguage)&&void 0!==n?n:"",audioDescription:!0===this.isAudioDescription,id:this.id,representations:(e?this.getPlayableRepresentations():this.representations).map((function(e){return e.toAudioRepresentation()})),label:this.label};return!0===this.isDub&&(r.dub=!0),r},t.toTextTrack=function(){var e,t;return{language:null!==(e=this.language)&&void 0!==e?e:"",normalized:null!==(t=this.normalizedLanguage)&&void 0!==t?t:"",closedCaption:!0===this.isClosedCaption,id:this.id,label:this.label,forced:this.isForcedSubtitles}},t.toVideoTrack=function(e){var t=void 0!==this.trickModeTracks?this.trickModeTracks.map((function(t){var n=(e?t.getPlayableRepresentations():t.representations).map((function(e){return e.toVideoRepresentation()})),r={id:t.id,representations:n,isTrickModeTrack:!0};return!0===t.isSignInterpreted&&(r.signInterpreted=!0),r})):void 0,n={id:this.id,representations:(e?this.getPlayableRepresentations():this.representations).map((function(e){return e.toVideoRepresentation()})),label:this.label};return!0===this.isSignInterpreted&&(n.signInterpreted=!0),!0===this.isTrickModeTrack&&(n.isTrickModeTrack=!0),void 0!==t&&(n.trickModeTracks=t),n},e}()},8619:function(e,t,n){"use strict";n.d(t,{ZP:function(){return E}});var r,i=n(4578),a=n(3887),o=n(3274),s=n(1959),u=n(908),l=n(8806),d=n(3714),c=n(1679),f=n(9665),v=function(){function e(e,t){var n=this;if(this.contentWarnings=[],this.id=e.id,this.adaptations=Object.keys(e.adaptations).reduce((function(r,i){var a=e.adaptations[i];if(null==a)return r;var o=a.map((function(e){var r=new f.Z(e,{representationFilter:t});if(r.representations.length>0&&!r.isSupported){var i=new d.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","An Adaptation contains only incompatible codecs.",{adaptation:r});n.contentWarnings.push(i)}return r})).filter((function(e){return e.representations.length>0}));if(o.every((function(e){return!e.isSupported}))&&a.length>0&&("video"===i||"audio"===i))throw new d.Z("MANIFEST_INCOMPATIBLE_CODECS_ERROR","No supported "+i+" adaptations",{adaptation:void 0});return o.length>0&&(r[i]=o),r}),{}),!Array.isArray(this.adaptations.video)&&!Array.isArray(this.adaptations.audio))throw new d.Z("MANIFEST_PARSE_ERROR","No supported audio and video tracks.");this.duration=e.duration,this.start=e.start,null!=this.duration&&null!=this.start&&(this.end=this.start+this.duration),this.streamEvents=void 0===e.streamEvents?[]:e.streamEvents}var t=e.prototype;return t.getAdaptations=function(){var e=this.adaptations;return(0,c.Z)(e).reduce((function(e,t){return null!=t?e.concat(t):e}),[])},t.getAdaptationsForType=function(e){var t=this.adaptations[e];return null==t?[]:t},t.getAdaptation=function(e){return(0,o.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},t.getSupportedAdaptations=function(e){if(void 0===e)return this.getAdaptations().filter((function(e){return e.isSupported}));var t=this.adaptations[e];return void 0===t?[]:t.filter((function(e){return e.isSupported}))},t.containsTime=function(e){return e>=this.start&&(void 0===this.end||e<this.end)},e}();!function(e){e[e.Full=0]="Full",e[e.Partial=1]="Partial"}(r||(r={}));var p=n(5138);function h(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t,n){var i={updatedAdaptations:[],removedAdaptations:[],addedAdaptations:[]};e.start=t.start,e.end=t.end,e.duration=t.duration,e.streamEvents=t.streamEvents;for(var o=e.getAdaptations(),s=t.getAdaptations(),u=function(e){var t=o[e],u=(0,p.Z)(s,(function(e){return e.id===t.id}));if(-1===u){a.Z.warn('Manifest: Adaptation "'+o[e].id+'" not found when merging.');var d=o.splice(e,1)[0];e--,i.removedAdaptations.push(d)}else{var c=s.splice(u,1)[0],f=[],v=[],h=[];i.updatedAdaptations.push({adaptation:t,updatedRepresentations:f,addedRepresentations:v,removedRepresentations:h});for(var m,g=t.representations,y=c.representations.slice(),_=function(e){var t=g[e],i=(0,p.Z)(y,(function(e){return e.id===t.id}));if(-1===i){a.Z.warn('Manifest: Representation "'+g[e].id+'" not found when merging.');var o=g.splice(e,1)[0];e--,h.push(o)}else{var s=y.splice(i,1)[0];f.push(t),t.cdnMetadata=s.cdnMetadata,n===r.Full?t.index._replace(s.index):t.index._update(s.index)}b=e},b=0;b<g.length;b++)_(b);if(y.length>0)a.Z.warn("Manifest: "+y.length+" new Representations found when merging."),(m=t.representations).push.apply(m,y),v.push.apply(v,y)}l=e},l=0;l<o.length;l++)u(l);if(s.length>0){a.Z.warn("Manifest: "+s.length+" new Adaptations found when merging.");for(var d,c=h(s);!(d=c()).done;){var f=d.value,v=e.adaptations[f.type];void 0===v?e.adaptations[f.type]=[f]:v.push(f),i.addedAdaptations.push(f)}}return i}function y(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var b=(0,u.Z)(),S=function(e){function t(t,n){var r,i;r=e.call(this)||this;var a=n.representationFilter,o=n.manifestUpdateUrl;return r.contentWarnings=[],r.id=b(),r.expired=null!==(i=t.expired)&&void 0!==i?i:null,r.transport=t.transportType,r.clockOffset=t.clockOffset,r.periods=t.periods.map((function(e){var t,n=new v(e,a);return(t=r.contentWarnings).push.apply(t,n.contentWarnings),n})).sort((function(e,t){return e.start-t.start})),r.adaptations=void 0===r.periods[0]?{}:r.periods[0].adaptations,r._timeBounds=t.timeBounds,r.isDynamic=t.isDynamic,r.isLive=t.isLive,r.isLastPeriodKnown=t.isLastPeriodKnown,r.uris=void 0===t.uris?[]:t.uris,r.updateUrl=o,r.lifetime=t.lifetime,r.suggestedPresentationDelay=t.suggestedPresentationDelay,r.availabilityStartTime=t.availabilityStartTime,r.publishTime=t.publishTime,r}(0,i.Z)(t,e);var n=t.prototype;return n.getPeriod=function(e){return(0,o.Z)(this.periods,(function(t){return e===t.id}))},n.getPeriodForTime=function(e){return(0,o.Z)(this.periods,(function(t){return e>=t.start&&(void 0===t.end||t.end>e)}))},n.getNextPeriod=function(e){return(0,o.Z)(this.periods,(function(t){return t.start>e}))},n.getPeriodAfter=function(e){var t=e.end;if(void 0===t)return null;var n=(0,o.Z)(this.periods,(function(e){return void 0===e.end||t<e.end}));return void 0===n?null:n},n.getUrls=function(){return this.uris},n.replace=function(e){this._performUpdate(e,r.Full)},n.update=function(e){this._performUpdate(e,r.Partial)},n.getMinimumSafePosition=function(){var e,t,n=this._timeBounds;if(null===n.timeshiftDepth)return null!==(e=n.minimumSafePosition)&&void 0!==e?e:0;var r,i=n.maximumTimeData;if(n.maximumTimeData.isLinear){var a=performance.now()-i.time;r=i.maximumSafePosition+a/1e3}else r=i.maximumSafePosition;var o=r-n.timeshiftDepth;return Math.max(null!==(t=n.minimumSafePosition)&&void 0!==t?t:0,o)},n.getLivePosition=function(){var e=this._timeBounds.maximumTimeData;if(this.isLive&&void 0!==e.livePosition){if(!e.isLinear)return e.livePosition;var t=performance.now()-e.time;return e.livePosition+t/1e3}},n.getMaximumSafePosition=function(){var e=this._timeBounds.maximumTimeData;if(!e.isLinear)return e.maximumSafePosition;var t=performance.now()-e.time;return e.maximumSafePosition+t/1e3},n.updateRepresentationsDeciperability=function(e){var t=function(e,t){for(var n,r=[],i=y(e.periods);!(n=i()).done;)for(var o,s=n.value,u=y(s.getAdaptations());!(o=u()).done;)for(var l,d=o.value,c=y(d.representations);!(l=c()).done;){var f=l.value,v=t(f);v!==f.decipherable&&(r.push({manifest:e,period:s,adaptation:d,representation:f}),f.decipherable=v,a.Z.debug('Decipherability changed for "'+f.id+'"',"("+f.bitrate+")",String(f.decipherable)))}return r}(this,e);t.length>0&&this.trigger("decipherabilityUpdate",t)},n.getAdaptations=function(){(0,l.Z)("manifest.getAdaptations() is deprecated. Please use manifest.period[].getAdaptations() instead");var e=this.periods[0];if(void 0===e)return[];var t=e.adaptations,n=[];for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];n.push.apply(n,i)}return n},n.getAdaptationsForType=function(e){(0,l.Z)("manifest.getAdaptationsForType(type) is deprecated. Please use manifest.period[].getAdaptationsForType(type) instead");var t=this.periods[0];if(void 0===t)return[];var n=t.adaptations[e];return void 0===n?[]:n},n.getAdaptation=function(e){return(0,l.Z)("manifest.getAdaptation(id) is deprecated. Please use manifest.period[].getAdaptation(id) instead"),(0,o.Z)(this.getAdaptations(),(function(t){var n=t.id;return e===n}))},n._performUpdate=function(e,t){var n;if(this.availabilityStartTime=e.availabilityStartTime,this.expired=e.expired,this.isDynamic=e.isDynamic,this.isLive=e.isLive,this.isLastPeriodKnown=e.isLastPeriodKnown,this.lifetime=e.lifetime,this.contentWarnings=e.contentWarnings,this.suggestedPresentationDelay=e.suggestedPresentationDelay,this.transport=e.transport,this.publishTime=e.publishTime,t===r.Full)this._timeBounds=e._timeBounds,this.uris=e.uris,n=function(e,t){for(var n={updatedPeriods:[],addedPeriods:[],removedPeriods:[]},i=0,o=0;o<t.length;o++){for(var s=t[o],u=i,l=e[u];null!=l&&l.id!==s.id;)l=e[++u];if(null!=l){var d,c,f=g(l,s,r.Full);n.updatedPeriods.push({period:l,result:f});var v=t.slice(i,o),p=u-i,h=e.splice.apply(e,[i,p].concat(v));(d=n.removedPeriods).push.apply(d,h),(c=n.addedPeriods).push.apply(c,v),i=o+1}}if(i>e.length)return a.Z.error("Manifest: error when updating Periods"),n;if(i<e.length){var m,y=e.splice(i,e.length-i);(m=n.removedPeriods).push.apply(m,y)}var _,b=t.slice(i,t.length);return b.length>0&&(e.push.apply(e,b),(_=n.addedPeriods).push.apply(_,b)),n}(this.periods,e.periods);else{this._timeBounds.maximumTimeData=e._timeBounds.maximumTimeData,this.updateUrl=e.uris[0],n=function(e,t){var n,i={updatedPeriods:[],addedPeriods:[],removedPeriods:[]};if(0===e.length)return e.splice.apply(e,[0,0].concat(t)),(n=i.addedPeriods).push.apply(n,t),i;if(0===t.length)return i;var o=e[e.length-1];if(o.start<t[0].start){var s;if(o.end!==t[0].start)throw new d.Z("MANIFEST_UPDATE_ERROR","Cannot perform partial update: not enough data");return e.push.apply(e,t),(s=i.addedPeriods).push.apply(s,t),i}var u=(0,p.Z)(e,(function(e){return e.id===t[0].id}));if(u<0)throw new d.Z("MANIFEST_UPDATE_ERROR","Cannot perform partial update: incoherent data");var l=g(e[u],t[0],r.Partial);i.updatedPeriods.push({period:e[u],result:l});for(var c=u+1,f=1;f<t.length;f++){for(var v=t[f],h=-1,m=c;m<e.length;m++)if(v.id===e[m].id){h=m;break}if(h<0){for(var y,_=-1,b=c;b<e.length;b++)if(v.start<e[b].start){_=b;break}var S=_-c,E=e.splice(c,S,v);i.addedPeriods.push(v),(y=i.removedPeriods).push.apply(y,E)}else{if(h>c){var T;a.Z.warn("Manifest: old Periods not found in new when updating, removing");var k=e.splice(c,h-c);(T=i.removedPeriods).push.apply(T,k),h=c}var w=g(e[h],v,r.Full);i.updatedPeriods.push({period:e[h],result:w})}c++}if(c<e.length){var A;a.Z.warn("Manifest: Ending Periods not found in new when updating, removing");var I=e.splice(c,e.length-c);(A=i.removedPeriods).push.apply(A,I)}return i}(this.periods,e.periods);for(var i=this.getMinimumSafePosition();this.periods.length>0;){var o=this.periods[0];if(void 0===o.end||o.end>i)break;this.periods.shift()}}this.adaptations=void 0===this.periods[0]?{}:this.periods[0].adaptations,this.trigger("manifestUpdate",n)},t}(s.Z);var E=S},520:function(e,t,n){"use strict";n.d(t,{K:function(){return a},z:function(){return i}});var r=n(1946);function i(e,t){return e.segment.id===t.segment.id&&e.representation.uniqueId===t.representation.uniqueId}function a(e){if((0,r.Z)(e))return"";var t=e.period,n=e.adaptation,i=e.representation,a=e.segment;return n.type+" P: "+t.id+" A: "+n.id+" R: "+i.id+" S: "+(a.isInit?"init":a.complete?a.time+"-"+a.duration:""+a.time)}},2689:function(e,t,n){"use strict";n.d(t,{s:function(){return r}});var r=Math.pow(2,32)-1},2297:function(e,t,n){"use strict";n.d(t,{Qy:function(){return f},Xj:function(){return p},iz:function(){return c},lp:function(){return d},nR:function(){return v},t_:function(){return l},vA:function(){return u}});var r=n(3887),i=n(811),a=n(6968);function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){for(var n,r=e,i=o(t);!(n=i()).done;){var a=l(r,n.value);if(null===a)return null;r=a}return r}function l(e,t){var n=f(e,t);return null!==n?e.subarray(n[1],n[2]):null}function d(e,t){for(var n=[],r=e;;){var a=f(r,t);if(null===a)return n;(0,i.Z)(0!==a[2]&&0!==r.length),n.push(r.subarray(a[1],a[2])),r=r.subarray(a[2])}}function c(e,t){var n=f(e,t);return null!==n?e.subarray(n[0],n[2]):null}function f(e,t){for(var n,r,i=e.length,o=0,s=0;o+8<=i;){if(r=o,s=(0,a.pX)(e,r),r+=4,n=(0,a.pX)(e,r),r+=4,0===s)s=i-o;else if(1===s){if(r+8>i)return null;s=(0,a.pV)(e,r),r+=8}if(s<0)throw new Error("ISOBMFF: Size out of range");if(n===t)return 1970628964===t&&(r+=16),[o,r,o+s];o+=s}return null}function v(e,t,n,r,i){for(var o,s=e.length,u=0;u<s;u+=o){var l=u;o=(0,a.pX)(e,l),l+=4;var d=(0,a.pX)(e,l);if(l+=4,0===o)o=s-u;else if(1===o){if(l+8>s)return;o=(0,a.pV)(e,l),l+=8}if(1970628964===d&&l+16<=s&&(0,a.pX)(e,l)===t&&(0,a.pX)(e,l+4)===n&&(0,a.pX)(e,l+8)===r&&(0,a.pX)(e,l+12)===i)return l+=16,e.subarray(l,u+o)}}function p(e){var t=e.length;if(t<8)return r.Z.warn("ISOBMFF: box inferior to 8 bytes, cannot find offsets"),null;var n=0,i=(0,a.pX)(e,n);n+=4;var o=(0,a.pX)(e,n);if(n+=4,0===i)i=t;else if(1===i){if(n+8>t)return r.Z.warn("ISOBMFF: box too short, cannot find offsets"),null;i=(0,a.pV)(e,n),n+=8}if(i<0)throw new Error("ISOBMFF: Size out of range");return 1970628964===o&&(n+=16),[0,n,i]}},6807:function(e,t,n){"use strict";n.d(t,{E3:function(){return u},Le:function(){return o},XA:function(){return i},fs:function(){return s},uq:function(){return a}});var r=n(2297);function i(e){var t=(0,r.t_)(e,1836019558);return null===t?null:(0,r.t_)(t,1953653094)}function a(e){return(0,r.lp)(e,1836019558).reduce((function(e,t){var n=(0,r.t_)(t,1953653094);return null!==n&&e.push(n),e}),[])}function o(e){return(0,r.t_)(e,1835295092)}function s(e){var t=(0,r.t_)(e,1836019574);if(null===t)return null;var n=(0,r.t_)(t,1953653099);return null===n?null:(0,r.t_)(n,1835297121)}function u(e,t){return void 0===t&&(t=0),(0,r.t_)(e.subarray(t),1701671783)}},6490:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},Y:function(){return u}});var r=n(3887);var i="function"==typeof Uint8Array.prototype.slice?function(e,t,n){return e.slice(t,n)}:function(e,t,n){return new Uint8Array(Array.prototype.slice.call(e,t,n))},a=n(3635),o=n(2297);function s(e){var t=0,n=(0,o.t_)(e,1836019574);if(null===n)return[];for(var a=[];t<n.length;){var s=void 0;try{s=(0,o.Qy)(n,1886614376)}catch(e){var l=e instanceof Error?e:"";return r.Z.warn("Error while removing PSSH from ISOBMFF",l),a}if(null==s)return a;var d=i(n,s[0],s[2]),c=u(d,s[1]-s[0]);void 0!==c&&a.push({systemId:c,data:d}),n[s[0]+4]=102,n[s[0]+5]=114,n[s[0]+6]=101,n[s[0]+7]=101,t=s[2]}return a}function u(e,t){if(e[t]>1)r.Z.warn("ISOBMFF: un-handled PSSH version");else{var n=t+4;if(!(n+16>e.length)){var o=i(e,n,n+16);return(0,a.ci)(o)}}}},4644:function(e,t,n){"use strict";n.d(t,{J6:function(){return m},LD:function(){return h},MM:function(){return p},Qx:function(){return f},R0:function(){return y},Wf:function(){return c},s9:function(){return g}});var r=n(3887),i=n(6968),a=n(3635),o=n(2689),s=n(2297),u=n(6807);function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=(0,s.Qy)(e,1936286840);if(null===n)return null;var r=t,a=n[2]-n[0],o=n[1],u=e[o];o+=8;var l,d=(0,i.pX)(e,o);if(o+=4,0===u)l=(0,i.pX)(e,o),o+=4,r+=(0,i.pX)(e,o)+a,o+=4;else{if(1!==u)return null;l=(0,i.pV)(e,o),o+=8,r+=(0,i.pV)(e,o)+a,o+=8}var c=[];o+=2;var f=(0,i.zK)(e,o);for(o+=2;--f>=0;){var v=(0,i.pX)(e,o);o+=4;var p=2147483647&v;if(1===(2147483648&v)>>>31)throw new Error("sidx with reference_type `1` not yet implemented");var h=(0,i.pX)(e,o);o+=4,o+=4,c.push({time:l,duration:h,timescale:d,range:[r,r+p-1]}),l+=h,r+=p}return c}function f(e){var t=(0,u.XA)(e);if(null!==t){var n=(0,s.t_)(t,1952867444);if(null!==n){var r=n[0];return 1===r?(0,i.pV)(n,4):0===r?(0,i.pX)(n,4):void 0}}}function v(e){var t=(0,s.t_)(e,1952868452);if(null!==t){var n=1,r=(0,i.QI)(t,n);if(n+=3,(8&r)>0)return n+=4,(1&r)>0&&(n+=8),(2&r)>0&&(n+=4),(0,i.pX)(t,n)}}function p(e){var t=(0,u.uq)(e);if(0!==t.length){for(var n,r=0,a=l(t);!(n=a()).done;){var o=n.value,d=(0,s.t_)(o,1953658222);if(null===d)return;var c=0,f=d[c];if(c+=1,f>1)return;var p=(0,i.QI)(d,c);c+=3;var h=(256&p)>0,m=0;if(!h&&void 0===(m=v(o)))return;var g=(1&p)>0,y=(4&p)>0,_=(512&p)>0,b=(1024&p)>0,S=(2048&p)>0,E=(0,i.pX)(d,c);c+=4,g&&(c+=4),y&&(c+=4);for(var T=E,k=0;T-- >0;)h?(k+=(0,i.pX)(d,c),c+=4):k+=m,_&&(c+=4),b&&(c+=4),S&&(c+=4);r+=k}return r}}function h(e){var t=(0,u.fs)(e);if(null!==t){var n=(0,s.t_)(t,1835296868);if(null!==n){var r=0,a=n[r];return r+=4,1===a?(0,i.pX)(n,r+16):0===a?(0,i.pX)(n,r+8):void 0}}}function m(e){var t=e.length;if(t<4)throw new Error("Cannot update box length: box too short");var n=(0,i.pX)(e,0);if(0===n){if(t>o.s){var r=new Uint8Array(t+8);return r.set((0,i.kh)(1),0),r.set(e.subarray(4,8),4),r.set((0,i.el)(t+8),8),r.set(e.subarray(8,t),16),r}return e.set((0,i.kh)(t),0),e}if(1===n){if(t<16)throw new Error("Cannot update box length: box too short");return e.set((0,i.el)(t),8),e}if(t<=o.s)return e.set((0,i.kh)(t),0),e;var a=new Uint8Array(t+8);return a.set((0,i.kh)(1),0),a.set(e.subarray(4,8),4),a.set((0,i.el)(t+8),8),a.set(e.subarray(8,t),16),a}function g(e){for(var t=[],n=0;n<e.length;){var o=(0,u.E3)(e,n);if(null===o)break;var s=o.length;n+=s;var l=o[0];if(0!==l)r.Z.warn("ISOBMFF: EMSG version "+l.toString()+" not supported.");else{var d=4,c=(0,a.DM)(o,d),f=c.end,v=c.string;d=f;var p=(0,a.DM)(o,d),h=p.end,m=p.string;d=h;var g=(0,i.pX)(o,d);d+=4;var y=(0,i.pX)(o,d);d+=4;var _=(0,i.pX)(o,d);d+=4;var b=(0,i.pX)(o,d);d+=4;var S={schemeIdUri:v,value:m,timescale:g,presentationTimeDelta:y,eventDuration:_,id:b,messageData:o.subarray(d,s)};t.push(S)}}if(0!==t.length)return t}function y(e){var t=(0,s.vA)(e,[1836019574,1953653099,1835297121,1835626086,1937007212,1937011556]);if(null===t)return null;var n=t.subarray(8),r=(0,s.t_)(n,1701733238),i=0;if(null===r?(i=28,r=(0,s.t_)(n,1701733217)):i=78,null===r)return null;var a=(0,s.vA)(r.subarray(i),[1936289382,1935894633,1952804451]);return null===a||a.byteLength<24?null:a.subarray(8,24)}},8337:function(e,t,n){"use strict";n.d(t,{Z:function(){return Qe}});var r=n(7904),i=n(1946),a=n(6872),o=n(3887),s=n(3274),u=n(9829);function l(e){var t=Date.parse(e)-performance.now();if(!isNaN(t))return t;o.Z.warn("DASH Parser: Invalid clock received: ",e)}function d(e){for(var t=e.representations,n=null,r=0;r<t.length;r++){var i=t[r].index.getLastAvailablePosition();if(void 0===i)return;null!==i&&(n=null==n?i:Math.min(n,i))}return null===n?null:n}function c(e){for(var t=e.representations,n=null,r=0;r<t.length;r++){var i=t[r].index.getFirstAvailablePosition();if(void 0===i)return;null!==i&&(n=null==n?i:Math.max(n,i))}return null===n?null:n}function f(e){if(0===e.length)throw new Error("DASH Parser: no period available for a dynamic content");var t=function(e){for(var t=0;t<=e.length-1;t++){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=c(r);if(void 0===u)return;a=u}if(void 0!==i){var l=c(i);if(void 0===l)return;s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return void o.Z.info("Parser utils: found Period with no segment. ","Going to next one to calculate first position");if(null!==s)return null!==a?Math.max(a,s):s;if(null!==a)return a}}}(e),n=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t].adaptations,r=void 0===n.audio?void 0:n.audio[0],i=void 0===n.video?void 0:n.video[0];if(void 0!==r||void 0!==i){var a=null,s=null;if(void 0!==r){var u=d(r);if(void 0===u)return{safe:void 0,unsafe:void 0};a=u}if(void 0!==i){var l=d(i);if(void 0===l)return{safe:void 0,unsafe:void 0};s=l}if(void 0!==r&&null===a||void 0!==i&&null===s)return o.Z.info("Parser utils: found Period with no segment. ","Going to previous one to calculate last position"),{safe:void 0,unsafe:void 0};if(null!==s)return null!==a?{safe:Math.min(a,s),unsafe:Math.max(a,s)}:{safe:s,unsafe:s};if(null!==a)return{safe:a,unsafe:a}}}return{safe:void 0,unsafe:void 0}}(e);return{minimumSafePosition:t,maximumSafePosition:n.safe,maximumUnsafePosition:n.unsafe}}var v=n(9592),p=n(908),h=n(1679),m=n(3635);var g=function(){function e(e){this._isDynamic=e.isDynamic,this._timeShiftBufferDepth=e.isDynamic&&void 0!==e.timeShiftBufferDepth?e.timeShiftBufferDepth:null}var t=e.prototype;return t.setLastPosition=function(e,t){this._lastPosition=e,this._positionTime=t},t.lastPositionIsKnown=function(){return this._isDynamic?null!=this._positionTime&&null!=this._lastPosition:null!=this._lastPosition},t.estimateMinimumBound=function(){if(!this._isDynamic||null===this._timeShiftBufferDepth)return 0;var e=this.estimateMaximumBound();return void 0!==e?e-this._timeShiftBufferDepth:void 0},t.estimateMaximumBound=function(){return this._isDynamic&&null!=this._positionTime&&null!=this._lastPosition?Math.max(this._lastPosition-this._positionTime+performance.now()/1e3,0):this._lastPosition},e}(),y=n(9665),_=n(5138),b=n(7714),S=n(6923);function E(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var k=function(e,t){for(var n,r=E(t);!(n=r()).done;)for(var i,a=n.value,o=a.adaptation,s=E(a.trickModeAttachedAdaptationIds);!(i=s()).done;)for(var u,l=i.value,d=E(y.r);!(u=d()).done;){var c=e[u.value];if(void 0!==c)for(var f,v=E(c);!(f=v()).done;){var p=f.value;p.id===l&&(void 0===p.trickModeTracks&&(p.trickModeTracks=[]),p.trickModeTracks.push(o))}}},w=["subtitle","caption"];function A(e,t,n,r){function i(e,t){var n=e.split("/")[0];return(0,b.Z)(y.r,n)?n:"application/ttml+xml"===e||"application/mp4"===e&&null!=t&&null!=(0,s.Z)(t,(function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri&&(0,b.Z)(w,e.value)}))?"text":void 0}function a(e){switch(e.substring(0,3)){case"avc":case"hev":case"hvc":case"vp8":case"vp9":case"av1":return"video";case"vtt":return"text"}switch(e.substring(0,4)){case"mp4a":return"audio";case"wvtt":case"stpp":return"text"}}if(null!==t){var o=i(t,r);if(void 0!==o)return o}if(null!==n){var u=a(n);if(void 0!==u)return u}for(var l=0;l<e.length;l++){var d=e[l].attributes,c=d.mimeType,f=d.codecs;if(void 0!==c){var v=i(c,r);if(void 0!==v)return v}if(void 0!==f){var p=a(f);if(void 0!==p)return p}}}var I=n(8026);var R=n(3911);function Z(e,t){var n,r=e.initialization,i={};return void 0!==t&&(i.isEMSGWhitelisted=t),{id:"init",isInit:!0,time:0,end:0,duration:0,timescale:1,range:null!=r?r.range:void 0,indexRange:e.indexRange,url:null!==(n=null==r?void 0:r.url)&&void 0!==n?n:null,complete:!0,privateInfos:i,timestampOffset:-e.indexTimeOffset/e.timescale}}function x(e){return function(t,n,r){var i,a,o,s=(0,S.Z)(r)?parseInt(r,10):1;return i=String(e),a=s,(o=i.toString()).length>=a?o:(new Array(a+1).join("0")+o).slice(-a)}}function P(e,t,n){return function(e,t,n){return-1===e.indexOf("$")?e:e.replace(/\$\$/g,"$").replace(/\$RepresentationID\$/g,String(t)).replace(/\$Bandwidth(\%0(\d+)d)?\$/g,x(void 0===n?0:n))}(e,t,n)}function M(e,t){return function(n){return-1===n.indexOf("$")?n:n.replace(/\$\$/g,"$").replace(/\$Number(\%0(\d+)d)?\$/g,(function(e,n,r){if(void 0===t)throw new Error("Segment number not defined in a $Number$ scheme");return x(t)(e,n,r)})).replace(/\$Time(\%0(\d+)d)?\$/g,(function(t,n,r){if(void 0===e)throw new Error("Segment time not defined in a $Time$ scheme");return x(e)(t,n,r)}))}}function C(e,t,n,r,i){for(var a,o,s=(0,R.gT)(t,e),u=(0,R.gT)(t+n,e),l=e.timeline,d=e.timescale,c=e.segmentUrlTemplate,f=e.startNumber,v=e.endNumber,p=null!=f?f:1,h=[],m=l.length,g=0;g<m;g++){for(var y=l[g],_=y.duration,b=y.start,S=y.range,E=(0,R.KF)(y,l[g+1],i),T=!1!==e.availabilityTimeComplete||g!==m-1&&0!==E,k=(a=_,o=void 0,(o=s-b)>0?Math.floor(o/a):0),w=b+k*_;w<u&&k<=E;){var A=p+k;if(void 0!==v&&A>v)break;var I=null===c?null:M(w,A)(c),Z=w-e.indexTimeOffset,x=_;Z<0&&(x=_+Z,Z=0);var P={id:String(w),time:Z/d,end:(Z+x)/d,duration:x/d,isInit:!1,range:S,timescale:1,url:I,number:A,timestampOffset:-e.indexTimeOffset/d,complete:T,privateInfos:{isEMSGWhitelisted:r}};h.push(P),w=b+ ++k*_}if(w>=u)return h;if(p+=E+1,void 0!==v&&p>v)return h}return h}function D(e,t){if(t.timescale!==e.timescale){var n=e.timescale;e.timeline.push({start:t.time/t.timescale*n,duration:t.duration/t.timescale*n,repeatCount:void 0===t.count?0:t.count,range:t.range})}else e.timeline.push({start:t.time,duration:t.duration,repeatCount:void 0===t.count?0:t.count,range:t.range});return!0}var N=function(){function e(e,t){var n,r,i,a=t.periodStart,o=t.periodEnd,s=t.representationId,u=t.representationBitrate,l=t.isEMSGWhitelisted,d=null!==(n=e.timescale)&&void 0!==n?n:1,c=(null!=e.presentationTimeOffset?e.presentationTimeOffset:0)-a*d,f=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:P(e.initialization.media,s,u),v=void 0===e.media?null:P(e.media,s,u),p=void 0!==e.initialization?e.initialization.range:void 0!==e.indexRange?[0,e.indexRange[0]-1]:void 0;this._index={indexRange:e.indexRange,indexTimeOffset:c,initialization:{url:f,range:p},segmentUrlTemplate:v,startNumber:e.startNumber,endNumber:e.endNumber,timeline:null!==(i=e.timeline)&&void 0!==i?i:[],timescale:d},this._scaledPeriodStart=(0,R.gT)(a,this._index),this._scaledPeriodEnd=null==o?void 0:(0,R.gT)(o,this._index),this._isInitialized=this._index.timeline.length>0,this._isEMSGWhitelisted=l}var t=e.prototype;return t.getInitSegment=function(){return Z(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){return C(this._index,e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){var e=this._index;return 0===e.timeline.length?null:(0,R.zG)(Math.max(this._scaledPeriodStart,e.timeline[0].start),e)},t.getLastAvailablePosition=function(){var e,t=this._index.timeline;if(0===t.length)return null;var n=t[t.length-1],r=Math.min((0,R.jH)(n,null,this._scaledPeriodEnd),null!==(e=this._scaledPeriodEnd)&&void 0!==e?e:1/0);return(0,R.zG)(r,this._index)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){return!0},t.isInitialized=function(){return this._isInitialized},t.initialize=function(e){if(!this._isInitialized){for(var t=0;t<e.length;t++)D(this._index,e[t]);this._isInitialized=!0}},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `BaseRepresentationIndex`")},t._replace=function(e){this._index=e._index,this._isInitialized=e._isInitialized,this._scaledPeriodEnd=e._scaledPeriodEnd,this._isEMSGWhitelisted=e._isEMSGWhitelisted},t._update=function(){o.Z.error("Base RepresentationIndex: Cannot update a SegmentList")},e}(),O=function(){function e(e,t){var n,r;if(void 0===e.duration)throw new Error("Invalid SegmentList: no duration");var i=t.periodStart,a=t.periodEnd,o=t.representationId,s=t.representationBitrate,u=t.isEMSGWhitelisted;this._isEMSGWhitelisted=u,this._periodStart=i,this._periodEnd=a;var l=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,d=null!==(n=e.timescale)&&void 0!==n?n:1,c=l-i*d,f=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:P(e.initialization.media,o,s),v=e.list.map((function(e){return{url:void 0===e.media?null:P(e.media,o,s),mediaRange:e.mediaRange}}));this._index={list:v,timescale:d,duration:e.duration,indexTimeOffset:c,indexRange:e.indexRange,initialization:null==e.initialization?void 0:{url:f,range:e.initialization.range}}}var t=e.prototype;return t.getInitSegment=function(){var e=Z(this._index);return void 0===e.privateInfos&&(e.privateInfos={}),e.privateInfos.isEMSGWhitelisted=this._isEMSGWhitelisted,e},t.getSegments=function(e,t){for(var n=this._index,r=n.duration,i=n.list,a=n.timescale,o=r/a,s=e-this._periodStart,u=(0,R.PZ)(s,t,a),l=u[0],d=u[1],c=Math.min(i.length-1,Math.floor(d/r)),f=[],v=Math.floor(l/r);v<=c;){var p=i[v].mediaRange,h=i[v].url,m=v*o+this._periodStart,g={id:String(v),time:m,isInit:!1,range:p,duration:o,timescale:1,end:m+o,url:h,timestampOffset:-n.indexTimeOffset/a,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};f.push(g),v++}return f},t.shouldRefresh=function(e,t){return!1},t.getFirstAvailablePosition=function(){return this._periodStart},t.getLastAvailablePosition=function(){var e,t=this._index,n=t.duration,r=t.list;return Math.min(r.length*n/t.timescale+this._periodStart,null!==(e=this._periodEnd)&&void 0!==e?e:1/0)},t.getEnd=function(){return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(){return!1},t.isSegmentStillAvailable=function(){return!0},t.checkDiscontinuity=function(){return null},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){return!0},t.isInitialized=function(){return!0},t.initialize=function(){o.Z.error("A `ListRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `ListRepresentationIndex`")},t._replace=function(e){this._index=e._index},t._update=function(){o.Z.error("A `ListRepresentationIndex` cannot be updated")},e}(),L=n(9362),U=n(811),B=n(8232),F=n(1091),z=n(5505);function V(e){return a.Z.getCurrent().DEFAULT_MAXIMUM_TIME_ROUNDING_ERROR*e}function K(e,t,n){var r=e.start,a=e.duration,s=e.repeatCount;return void 0===r&&(null===t?r=0:(0,i.Z)(t.duration)||(r=t.start+t.duration*(t.repeatCount+1))),void 0!==a&&!isNaN(a)||null===n||void 0===n.start||isNaN(n.start)||void 0===r||isNaN(r)||(a=n.start-r),void 0===r||isNaN(r)||void 0===a||isNaN(a)||void 0!==s&&isNaN(s)?(o.Z.warn('DASH: A "S" Element could not have been parsed.'),null):{start:r,duration:a,repeatCount:void 0===s?0:s}}function G(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"t":var i=parseInt(r.value,10);isNaN(i)?o.Z.warn('DASH: invalid t ("'+r.value+'")'):t.start=i;break;case"d":var a=parseInt(r.value,10);isNaN(a)?o.Z.warn('DASH: invalid d ("'+r.value+'")'):t.duration=a;break;case"r":var s=parseInt(r.value,10);isNaN(s)?o.Z.warn('DASH: invalid r ("'+r.value+'")'):t.repeatCount=s}}return t}function j(e){for(var t=[],n=0;n<e.length;n++)t.push(G(e[n]));for(var r=[],i=0;i<t.length;i++){var a=K(t[i],void 0===r[r.length-1]?null:r[r.length-1],void 0===t[i+1]?null:t[i+1]);null!==a&&r.push(a)}return r}function H(e,t){var n,r=function(e,t){if(0===e.length||0===t.length)return null;var n=e[0].start,r=t[0].getAttribute("t"),i=null===r?null:parseInt(r,10);if(null===i||Number.isNaN(i))return null;if(n===i)return{prevSegmentsIdx:0,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(n<i)for(var a=e[0],o=0;;){if(a.repeatCount>0){var s=i-a.start;if(s%a.duration==0&&s/a.duration<=a.repeatCount)return{repeatNumberInPrevSegments:s/a.duration,prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInNewElements:0}}if(++o>=e.length)return null;if((a=e[o]).start===i)return{prevSegmentsIdx:o,newElementsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(a.start>i)return null}else for(var u=0,l=t[0],d=i;;){var c=l.getAttribute("d"),f=null===c?null:parseInt(c,10);if(null===f||Number.isNaN(f))return null;var v=l.getAttribute("r"),p=null===v?null:parseInt(v,10);if(null!==p){if(Number.isNaN(p)||p<0)return null;if(p>0){var h=n-d;if(h%f==0&&h/f<=p)return{repeatNumberInPrevSegments:0,repeatNumberInNewElements:h/f,prevSegmentsIdx:0,newElementsIdx:u}}d+=f*(p+1)}else d+=f;if(++u>=t.length)return null;var m=(l=t[u]).getAttribute("t"),g=null===m?null:parseInt(m,10);if(null!==g){if(Number.isNaN(g))return null;d=g}if(d===n)return{newElementsIdx:u,prevSegmentsIdx:0,repeatNumberInPrevSegments:0,repeatNumberInNewElements:0};if(d>i)return null}}(t,e);if(null===r)return o.Z.warn('DASH: Cannot perform "based" update. Common segment not found.'),j(e);var i=r.prevSegmentsIdx,a=r.newElementsIdx,s=r.repeatNumberInPrevSegments,u=r.repeatNumberInNewElements,l=t.length-i+a-1;if(l>=e.length)return o.Z.info('DASH: Cannot perform "based" update. New timeline too short'),j(e);var d=t.slice(i);if(s>0){var c=d[0];c.start+=c.duration*s,d[0].repeatCount-=s}if(u>0&&0!==a)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form.'),j(e);var f=d[d.length-1],v=G(e[l]),p=(null!==(n=v.repeatCount)&&void 0!==n?n:0)-u;if(v.duration!==f.duration||f.repeatCount>p)return o.Z.info('DASH: Cannot perform "based" update. The new timeline has a different form at the beginning.'),j(e);void 0!==v.repeatCount&&v.repeatCount>f.repeatCount&&(f.repeatCount=v.repeatCount);for(var h=[],m=[],g=l+1;g<e.length;g++)m.push(G(e[g]));for(var y=0;y<m.length;y++){var _=K(m[y],void 0===h[h.length-1]?f:h[h.length-1],void 0===m[y+1]?null:m[y+1]);null!==_&&h.push(_)}return d.concat(h)}var W=function(){function e(t,n){var r,i,a;if(!e.isTimelineIndexArgument(t))throw new Error("The given index is not compatible with a TimelineRepresentationIndex.");var o=n.availabilityTimeComplete,s=n.manifestBoundsCalculator,u=n.isDynamic,l=n.isLastPeriod,d=n.representationId,c=n.representationBitrate,f=n.periodStart,v=n.periodEnd,p=n.isEMSGWhitelisted,h=null!==(r=t.timescale)&&void 0!==r?r:1,m=(null!=t.presentationTimeOffset?t.presentationTimeOffset:0)-f*h;this._manifestBoundsCalculator=s,this._isEMSGWhitelisted=p,this._isLastPeriod=l,this._lastUpdate=null==n.receivedTime?performance.now():n.receivedTime,this._unsafelyBaseOnPreviousIndex=null,null!==n.unsafelyBaseOnPreviousRepresentation&&n.unsafelyBaseOnPreviousRepresentation.index instanceof e&&(n.unsafelyBaseOnPreviousRepresentation.index._unsafelyBaseOnPreviousIndex=null,this._unsafelyBaseOnPreviousIndex=n.unsafelyBaseOnPreviousRepresentation.index),this._isDynamic=u,this._parseTimeline=null!==(i=t.timelineParser)&&void 0!==i?i:null;var g=void 0===(null===(a=t.initialization)||void 0===a?void 0:a.media)?null:P(t.initialization.media,d,c),y=void 0===t.media?null:P(t.media,d,c);this._index={availabilityTimeComplete:o,indexRange:t.indexRange,indexTimeOffset:m,initialization:null==t.initialization?void 0:{url:g,range:t.initialization.range},segmentUrlTemplate:y,startNumber:t.startNumber,endNumber:t.endNumber,timeline:void 0===t.timeline?null:q(t.timeline,t.startNumber,t.endNumber),timescale:h},this._scaledPeriodStart=(0,R.gT)(f,this._index),this._scaledPeriodEnd=void 0===v?void 0:(0,R.gT)(v,this._index)}var t=e.prototype;return t.getInitSegment=function(){return Z(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var n=this._index;return C({segmentUrlTemplate:n.segmentUrlTemplate,startNumber:n.startNumber,endNumber:n.endNumber,timeline:n.timeline,timescale:n.timescale,indexTimeOffset:n.indexTimeOffset},e,t,this._isEMSGWhitelisted,this._scaledPeriodEnd)},t.shouldRefresh=function(){return!1},t.getFirstAvailablePosition=function(){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;return 0===e.length?null:(0,R.zG)(Math.max(this._scaledPeriodStart,e[0].start),this._index)},t.getLastAvailablePosition=function(){this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=e.getIndexEnd(this._index.timeline,this._scaledPeriodEnd);return null===t?null:(0,R.zG)(t,this._index)},t.getEnd=function(){if(!this._isDynamic||!this._isLastPeriod)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,U.Z)(e<=t),!this._isDynamic||!this._isLastPeriod)return!1;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var r=this._index,i=r.timeline,a=V(r.timescale),o=(0,R.gT)(t,this._index);if(i.length>0){var s=i[i.length-1];if((0,R.jH)(s,null,this._scaledPeriodEnd)+a>=Math.min(o,null!==(n=this._scaledPeriodEnd)&&void 0!==n?n:1/0))return!1}return void 0===this._scaledPeriodEnd?o+a>this._scaledPeriodStart&&void 0:(0,R.gT)(e,this._index)-a<this._scaledPeriodEnd&&o+a>this._scaledPeriodStart},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline(),null===this._index.timeline&&(this._index.timeline=this._getTimeline());var t=this._index,n=t.timeline,r=t.timescale,i=t.indexTimeOffset;return(0,F.Z)(e,n,r,i)},t.checkDiscontinuity=function(e){this._refreshTimeline();var t=this._index.timeline;return null===t&&(t=this._getTimeline(),this._index.timeline=t),(0,R._j)({timeline:t,timescale:this._index.timescale,indexTimeOffset:this._index.indexTimeOffset},e,this._scaledPeriodEnd)},t.canBeOutOfSyncError=function(e){return!!this._isDynamic&&(e instanceof L.Z&&e.isHttpError(404))},t._replace=function(e){this._parseTimeline=e._parseTimeline,this._index=e._index,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._manifestBoundsCalculator=e._manifestBoundsCalculator,this._isLastPeriod=e._isLastPeriod},t._update=function(e){null===this._index.timeline&&(this._index.timeline=this._getTimeline()),null===e._index.timeline&&(e._index.timeline=e._getTimeline()),(0,z.Z)(this._index.timeline,e._index.timeline)&&(this._index.startNumber=e._index.startNumber),this._index.endNumber=e._index.endNumber,this._isDynamic=e._isDynamic,this._scaledPeriodStart=e._scaledPeriodStart,this._scaledPeriodEnd=e._scaledPeriodEnd,this._lastUpdate=e._lastUpdate,this._isLastPeriod=e._isLastPeriod},t.isFinished=function(){if(!this._isDynamic||!this._isLastPeriod)return!0;null===this._index.timeline&&(this._index.timeline=this._getTimeline());var e=this._index.timeline;if(void 0===this._scaledPeriodEnd||0===e.length)return!1;var t=e[e.length-1];return(0,R.jH)(t,null,this._scaledPeriodEnd)+V(this._index.timescale)>=this._scaledPeriodEnd},t.isInitialized=function(){return!0},t.initialize=function(){o.Z.error("A `TimelineRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `TimelineRepresentationIndex`")},e.isTimelineIndexArgument=function(e){return"function"==typeof e.timelineParser||Array.isArray(e.timeline)},t._refreshTimeline=function(){if(null===this._index.timeline&&(this._index.timeline=this._getTimeline()),this._isDynamic){var e=this._manifestBoundsCalculator.estimateMinimumBound();if(null!=e){var t=(0,R.gT)(e,this._index),n=(0,B.Z)(this._index.timeline,t);void 0!==this._index.startNumber?this._index.startNumber+=n:void 0!==this._index.endNumber&&(this._index.startNumber=n+1)}}},e.getIndexEnd=function(e,t){return e.length<=0?null:Math.min((0,R.jH)(e[e.length-1],null,t),null!=t?t:1/0)},t._getTimeline=function(){if(null===this._parseTimeline)return null!==this._index.timeline?this._index.timeline:(o.Z.error("DASH: Timeline already lazily parsed."),[]);var e=this._parseTimeline();this._parseTimeline=null;var t,n=a.Z.getCurrent().MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY;return null===this._unsafelyBaseOnPreviousIndex||e.length<n?q(j(e),this._index.startNumber,this._index.endNumber):(null===this._unsafelyBaseOnPreviousIndex._index.timeline?(t=this._unsafelyBaseOnPreviousIndex._getTimeline(),this._unsafelyBaseOnPreviousIndex._index.timeline=t):t=this._unsafelyBaseOnPreviousIndex._index.timeline,this._unsafelyBaseOnPreviousIndex=null,q(H(e,t),this._index.startNumber,this._index.endNumber))},e}();function q(e,t,n){if(void 0===n)return e;for(var r=null!=t?t:1,i=0;i<e.length;i++){var a=e[i];if((r+=a.repeatCount+1)>n){if(r===n+1)return e.slice(0,i+1);var o=e.slice(0,i),s=Object.assign({},a),u=r-a.repeatCount-1;return s.repeatCount=Math.max(0,n-u),o.push(s),o}}return e}var Y=W,X=function(){function e(e,t){var n,r,i=t.availabilityTimeOffset,a=t.manifestBoundsCalculator,o=t.isDynamic,s=t.periodEnd,u=t.periodStart,l=t.representationId,d=t.representationBitrate,c=t.isEMSGWhitelisted,f=null!==(n=e.timescale)&&void 0!==n?n:1;this._availabilityTimeOffset=i,this._manifestBoundsCalculator=a;var v=null!=e.presentationTimeOffset?e.presentationTimeOffset:0,p=v-u*f;if(void 0===e.duration)throw new Error("Invalid SegmentTemplate: no duration");var h=void 0===(null===(r=e.initialization)||void 0===r?void 0:r.media)?null:P(e.initialization.media,l,d),m=void 0===e.media?null:P(e.media,l,d);this._index={duration:e.duration,timescale:f,indexRange:e.indexRange,indexTimeOffset:p,initialization:null==e.initialization?void 0:{url:h,range:e.initialization.range},url:m,presentationTimeOffset:v,startNumber:e.startNumber,endNumber:e.endNumber},this._isDynamic=o,this._periodStart=u,this._scaledRelativePeriodEnd=void 0===s?void 0:(s-u)*f,this._isEMSGWhitelisted=c}var t=e.prototype;return t.getInitSegment=function(){return Z(this._index,this._isEMSGWhitelisted)},t.getSegments=function(e,t){var n=this._index,r=n.duration,i=n.startNumber,a=n.endNumber,o=n.timescale,s=n.url,u=this._periodStart*o,l=this._scaledRelativePeriodEnd,d=e*o-u,c=(e+t)*o-u,f=this._getFirstSegmentStart(),v=this._getLastSegmentStart();if(null==f||null==v)return[];var p=Math.max(f,d),h=Math.min(v,c);if(h+r<=p)return[];for(var m=[],g=null!=i?i:1,y=Math.floor(p/r),_=y*r;_<=h;_+=r){var b=y+g;if(void 0!==a&&b>a)return m;var S=null!=l&&_+r>l?l-_:r,E=_+u,T=_+this._index.presentationTimeOffset,k=null===s?null:M(T,b)(s),w={id:String(b),number:b,time:E/o,end:(E+S)/o,duration:S/o,timescale:1,isInit:!1,scaledDuration:S/o,url:k,timestampOffset:-n.indexTimeOffset/o,complete:!0,privateInfos:{isEMSGWhitelisted:this._isEMSGWhitelisted}};m.push(w),y++}return m},t.getFirstAvailablePosition=function(){var e=this._getFirstSegmentStart();return null==e?e:e/this._index.timescale+this._periodStart},t.getLastAvailablePosition=function(){var e=this._getLastSegmentStart();if((0,i.Z)(e))return e;var t=this._estimateRelativeScaledEnd();return Math.min(e+this._index.duration,null!=t?t:1/0)/this._index.timescale+this._periodStart},t.getEnd=function(){if(!this._isDynamic)return this.getLastAvailablePosition();var e=this._estimateRelativeScaledEnd();if(void 0!==e){var t=this._index.timescale;return(e+this._periodStart*t)/t}},t.awaitSegmentBetween=function(e,t){if((0,U.Z)(e<=t),!this._isDynamic)return!1;var n=this._index.timescale,r=V(n),i=this._periodStart*n,a=t*n-i,o=this._estimateRelativeScaledEnd();return void 0===o?a+r>=0:e*n-i-r<o},t.shouldRefresh=function(){return!1},t.checkDiscontinuity=function(){return null},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;var t=this.getSegments(e.time,.1);return 0!==t.length&&(t[0].time===e.time&&t[0].end===e.end&&t[0].number===e.number)},t.canBeOutOfSyncError=function(){return!1},t.isFinished=function(){if(!this._isDynamic)return!0;var e=this._estimateRelativeScaledEnd();if(void 0===e)return!1;var t=this._index.timescale,n=this._getLastSegmentStart();return!(0,i.Z)(n)&&n+this._index.duration+V(t)>=e},t.isInitialized=function(){return!0},t.initialize=function(){o.Z.error("A `TemplateRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(){o.Z.warn("Cannot add predicted segments to a `TemplateRepresentationIndex`")},t._replace=function(e){this._index=e._index,this._isDynamic=e._isDynamic,this._periodStart=e._periodStart,this._scaledRelativePeriodEnd=e._scaledRelativePeriodEnd,this._manifestBoundsCalculator=e._manifestBoundsCalculator},t._update=function(e){this._replace(e)},t._getFirstSegmentStart=function(){if(!this._isDynamic)return 0;if(0===this._scaledRelativePeriodEnd||void 0===this._scaledRelativePeriodEnd){var e=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0!==e&&e<this._periodStart)return null}var t=this._index,n=t.duration,r=t.timescale,i=this._manifestBoundsCalculator.estimateMinimumBound();if(void 0!==i){var a=i>this._periodStart?(i-this._periodStart)*r:0;return Math.floor(a/n)*n}},t._getLastSegmentStart=function(){var e,t=this._index,n=t.duration,r=t.timescale,i=t.endNumber,o=t.startNumber,s=void 0===o?1:o;if(this._isDynamic){var u=this._manifestBoundsCalculator.estimateMaximumBound();if(void 0===u)return;if(void 0!==this._scaledRelativePeriodEnd&&this._scaledRelativePeriodEnd<(u-this._periodStart)*this._index.timescale){var l=Math.ceil(this._scaledRelativePeriodEnd/n);return void 0!==i&&i-s+1<l&&(l=i-s+1),(l-1)*n}var d=(u-this._periodStart)*r;if(d<0)return null;var c=(void 0!==this._availabilityTimeOffset?this._availabilityTimeOffset:0)*r,f=Math.floor((d+c)/n);return void 0!==i&&i-s+1<f&&(f=i-s+1),f<=0?null:(f-1)*n}var v=null!==(e=this._scaledRelativePeriodEnd)&&void 0!==e?e:0,p=Math.ceil(v/n);void 0!==i&&i-s+1<p&&(p=i-s+1);var h=(p-1)*n,m=a.Z.getCurrent().MINIMUM_SEGMENT_SIZE*r;return void 0!==i||v-h>m||p<2?h:(p-2)*n},t._estimateRelativeScaledEnd=function(){var e,t;if(void 0!==this._index.endNumber){var n=this._index.endNumber-(null!==(e=this._index.startNumber)&&void 0!==e?e:1)+1;return Math.max(Math.min(n*this._index.duration,null!==(t=this._scaledRelativePeriodEnd)&&void 0!==t?t:1/0),0)}if(void 0!==this._scaledRelativePeriodEnd)return Math.max(this._scaledRelativePeriodEnd,0)},e}();function Q(e,t){var n;if(0===t.length)return e;var r=t.map((function(e){return{url:e.value}}));if(0===e.length)return r;for(var i=[],a=0;a<e.length;a++)for(var o=e[a],s=0;s<r.length;s++){var l=r[s],d=(0,u.Z)(o.url,l.url);i.push({url:d,serviceLocation:null!==(n=l.serviceLocation)&&void 0!==n?n:o.serviceLocation})}return i}function $(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return J(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return J(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ee(e){var t=e.adaptationProfiles,n=e.essentialProperties,r=e.supplementalProperties,i=e.manifestProfiles,a=e.codecs;if(-1!==((null!=t?t:"")+(null!=i?i:"")).indexOf("http://dashif.org/guidelines/dash-if-uhd#hevc-hdr-pq10")&&("hvc1.2.4.L153.B0"===a||"hev1.2.4.L153.B0"===a))return{colorDepth:10,eotf:"pq",colorSpace:"rec2020"};var o=(0,s.Z)([].concat(null!=n?n:[],null!=r?r:[]),(function(e){return"urn:mpeg:mpegB:cicp:TransferCharacteristics"===e.schemeIdUri}));if(void 0!==o)switch(o.value){case"15":return;case"16":return{eotf:"pq"};case"18":return{eotf:"hlg"}}return void 0!==a&&/^vp(08|09|10)/.exec(a)?function(e){var t,n,r,i=e.split("."),a=i[0],o=(i[1],i[2],i[3]),s=(i[4],i[5]),u=i[6],l=i[7];if(("vp08"===a||"vp09"===a||"vp10"===a)&&((void 0!==o&&"10"===o||"12"===o)&&(t=parseInt(o,10)),void 0!==u&&("16"===u?n="pq":"18"===u&&(n="hlg")),void 0!==s&&void 0!==l&&"09"===s&&"09"===l&&(r="rec2020"),void 0!==t&&void 0!==n))return{colorDepth:t,eotf:n,colorSpace:r}}(a):void 0}function te(e,t,n){for(var r,i,a,u,l,d=[],c=function(){for(var e=l.value,c=null!=e.attributes.id?e.attributes.id:String(e.attributes.bitrate)+(null!=e.attributes.height?"-"+e.attributes.height:"")+(null!=e.attributes.width?"-"+e.attributes.width:"")+(null!=e.attributes.mimeType?"-"+e.attributes.mimeType:"")+(null!=e.attributes.codecs?"-"+e.attributes.codecs:"");d.some((function(e){return e.id===c}));)c+="-dup";var f,v=null!==(i=null===(r=n.unsafelyBaseOnPreviousAdaptation)||void 0===r?void 0:r.getRepresentation(c))&&void 0!==i?i:null,p=function(e,t){var n=[];if(void 0!==e.children.inbandEventStreams&&n.push.apply(n,e.children.inbandEventStreams),void 0!==t.children.inbandEventStreams&&n.push.apply(n,t.children.inbandEventStreams),0!==n.length)return n}(e,t),h=null!==(a=e.attributes.availabilityTimeComplete)&&void 0!==a?a:n.availabilityTimeComplete,m=(null!==(u=e.attributes.availabilityTimeOffset)&&void 0!==u?u:0)+n.availabilityTimeOffset,g=function(e,t){var n,r,i,a=t.availabilityTimeOffset,o=t.manifestBoundsCalculator,s=t.isDynamic,u=t.end,l=t.start,d=t.receivedTime,c=t.timeShiftBufferDepth,f=t.unsafelyBaseOnPreviousRepresentation,v=t.inbandEventStreams,p={availabilityTimeComplete:!0,availabilityTimeOffset:a,unsafelyBaseOnPreviousRepresentation:f,isEMSGWhitelisted:function(e){return void 0!==v&&v.some((function(t){return t.schemeIdUri===e.schemeIdUri}))},isLastPeriod:t.isLastPeriod,manifestBoundsCalculator:o,isDynamic:s,periodEnd:u,periodStart:l,receivedTime:d,representationBitrate:e.attributes.bitrate,representationId:e.attributes.id,timeShiftBufferDepth:c};if(void 0!==e.children.segmentBase){var h=e.children.segmentBase;i=new N(h,p)}else if(void 0!==e.children.segmentList){var m=e.children.segmentList;i=new O(m,p)}else if(void 0!==e.children.segmentTemplate||t.parentSegmentTemplates.length>0){var g=t.parentSegmentTemplates.slice(),y=e.children.segmentTemplate;void 0!==y&&g.push(y);var _=I.Z.apply(void 0,[{}].concat(g));p.availabilityTimeComplete=null!==(n=_.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,p.availabilityTimeOffset=(null!==(r=_.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,i=Y.isTimelineIndexArgument(_)?new Y(_,p):new X(_,p)}else{var b=t.adaptation.children;if(void 0!==b.segmentBase){var S=b.segmentBase;i=new N(S,p)}else if(void 0!==b.segmentList){var E=b.segmentList;i=new O(E,p)}else i=new X({duration:Number.MAX_VALUE,timescale:1,startNumber:0,media:""},p)}return i}(e,(0,I.Z)({},n,{availabilityTimeOffset:m,availabilityTimeComplete:h,unsafelyBaseOnPreviousRepresentation:v,adaptation:t,inbandEventStreams:p}));null==e.attributes.bitrate?(o.Z.warn("DASH: No usable bitrate found in the Representation."),f=0):f=e.attributes.bitrate;var y,_=Q(n.baseURLs,e.children.baseURLs),b={bitrate:f,cdnMetadata:0===_.length?[{baseUrl:"",id:void 0}]:_.map((function(e){return{baseUrl:e.url,id:e.serviceLocation}})),index:g,id:c};null!=e.attributes.codecs?y=e.attributes.codecs:null!=t.attributes.codecs&&(y=t.attributes.codecs),null!=y&&(y="mp4a.40.02"===y?"mp4a.40.2":y,b.codecs=y),null!=e.attributes.frameRate?b.frameRate=e.attributes.frameRate:null!=t.attributes.frameRate&&(b.frameRate=t.attributes.frameRate),null!=e.attributes.height?b.height=e.attributes.height:null!=t.attributes.height&&(b.height=t.attributes.height),null!=e.attributes.mimeType?b.mimeType=e.attributes.mimeType:null!=t.attributes.mimeType&&(b.mimeType=t.attributes.mimeType),null!=e.attributes.width?b.width=e.attributes.width:null!=t.attributes.width&&(b.width=t.attributes.width);var S=void 0!==t.children.contentProtections?t.children.contentProtections:[];if(void 0!==e.children.contentProtections&&S.push.apply(S,e.children.contentProtections),S.length>0){var E=S.reduce((function(e,t){var n;if(void 0!==t.attributes.schemeIdUri&&"urn:uuid:"===t.attributes.schemeIdUri.substring(0,9)&&(n=t.attributes.schemeIdUri.substring(9).replace(/-/g,"").toLowerCase()),void 0!==t.attributes.keyId&&t.attributes.keyId.length>0){var r={keyId:t.attributes.keyId,systemId:n};void 0===e.keyIds?e.keyIds=[r]:e.keyIds.push(r)}if(void 0!==n){for(var i,a=[],o=$(t.children.cencPssh);!(i=o()).done;){var u=i.value;a.push({systemId:n,data:u})}if(a.length>0){var l,d=(0,s.Z)(e.initData,(function(e){return"cenc"===e.type}));if(void 0===d)e.initData.push({type:"cenc",values:a});else(l=d.values).push.apply(l,a)}}return e}),{keyIds:void 0,initData:[]});(Object.keys(E.initData).length>0||void 0!==E.keyIds&&E.keyIds.length>0)&&(b.contentProtections=E)}b.hdrInfo=ee({adaptationProfiles:t.attributes.profiles,supplementalProperties:t.children.supplementalProperties,essentialProperties:t.children.essentialProperties,manifestProfiles:n.manifestProfiles,codecs:y}),d.push(b)},f=$(e);!(l=f()).done;)c();return d}function ne(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return re(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ie(e){if(void 0===e)return!1;var t="urn:tva:metadata:cs:AudioPurposeCS:2007"===e.schemeIdUri&&"1"===e.value,n="urn:mpeg:dash:role:2011"===e.schemeIdUri&&"description"===e.value;return t||n}function ae(e,t){if(void 0!==e&&e.some((function(e){return"urn:tva:metadata:cs:AudioPurposeCS:2007"===e.schemeIdUri&&"2"===e.value})))return!0;if(void 0!==t&&t.some((function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri&&"caption"===e.value})))return!0;return!1}function oe(e){return void 0!==e&&("urn:mpeg:dash:role:2011"===e.schemeIdUri&&"sign"===e.value)}function se(e,t){if((0,S.Z)(e.attributes.id))return e.attributes.id;var n=t.isClosedCaption,r=t.isForcedSubtitle,i=t.isAudioDescription,a=t.isSignInterpreted,o=t.isTrickModeTrack,s=t.type;return(0,S.Z)(e.attributes.language)&&(s+="-"+e.attributes.language),!0===n&&(s+="-cc"),!0===r&&(s+="-cc"),!0===i&&(s+="-ad"),!0===a&&(s+="-si"),o&&(s+="-trickMode"),(0,S.Z)(e.attributes.contentType)&&(s+="-"+e.attributes.contentType),(0,S.Z)(e.attributes.codecs)&&(s+="-"+e.attributes.codecs),(0,S.Z)(e.attributes.mimeType)&&(s+="-"+e.attributes.mimeType),void 0!==e.attributes.frameRate&&(s+="-"+String(e.attributes.frameRate)),s}function ue(e){if(null!=e.children.supplementalProperties)for(var t,n=ne(e.children.supplementalProperties);!(t=n()).done;){var r=t.value;if("urn:mpeg:dash:adaptation-set-switching:2016"===r.schemeIdUri&&null!=r.value)return r.value.split(",").map((function(e){return e.trim()})).filter((function(e){return e}))}return[]}function le(e,t){var n=t[1].priority-e[1].priority;return 0!==n?n:e[1].isMainAdaptation!==t[1].isMainAdaptation?e[1].isMainAdaptation?-1:1:e[1].indexInMpd-t[1].indexInMpd}function de(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ce(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var fe=(0,p.Z)();function ve(e,t){var n,r,i,a,u,l,d=[],c=function(e,t){var n=[];return e.forEach((function(r,i){var a,o;if(null!=r.attributes.start)a=r.attributes.start;else if(0===i)a=t.isDynamic&&null!=t.availabilityStartTime?t.availabilityStartTime:0;else{var s=n[n.length-1];if(null==s||null==s.periodEnd)throw new Error("Missing start time when parsing periods.");a=s.periodEnd}var u=e[i+1];null!=r.attributes.duration?o=r.attributes.duration:i===e.length-1?o=t.duration:null!=u.attributes.start&&(o=u.attributes.start-a);var l=null!=o?a+o:void 0;n.push({periodStart:a,periodDuration:o,periodEnd:l})})),n}(e,t);if(c.length!==e.length)throw new Error("MPD parsing error: the time information are incoherent.");var f=t.isDynamic,p=t.timeShiftBufferDepth,E=new g({isDynamic:f,timeShiftBufferDepth:p});f||null==t.duration||E.setLastPosition(t.duration);for(var T=function(){var g,T=w===e.length-1,I=e[w],R=t.xlinkInfos.get(I),Z=Q(t.baseURLs,I.children.baseURLs),x=c[w],P=x.periodStart,M=x.periodDuration,C=x.periodEnd;for(null==I.attributes.id?(o.Z.warn("DASH: No usable id found in the Period. Generating one."),g="gen-dash-period-"+fe()):g=I.attributes.id;d.some((function(e){return e.id===g}));)g+="-dup";var D=void 0!==R?R.receivedTime:t.receivedTime,N=null!==(r=null===(n=t.unsafelyBaseOnPreviousManifest)||void 0===n?void 0:n.getPeriod(g))&&void 0!==r?r:null,O=null===(i=I.attributes.availabilityTimeComplete)||void 0===i||i,L=null!==(a=I.attributes.availabilityTimeOffset)&&void 0!==a?a:0,U=t.manifestProfiles,B=I.children.segmentTemplate,F={availabilityTimeComplete:O,availabilityTimeOffset:L,baseURLs:Z,manifestBoundsCalculator:E,end:C,isDynamic:f,isLastPeriod:T,manifestProfiles:U,receivedTime:D,segmentTemplate:B,start:P,timeShiftBufferDepth:p,unsafelyBaseOnPreviousPeriod:N},z=function(e,t){for(var n,r,i,a,u,l,d={video:[],audio:[],text:[]},c=[],f={},v=[],p=0;p<e.length;p++){var h=e[p],m=h.children,g=m.essentialProperties,E=m.roles,T=m.label,w=Array.isArray(E)&&E.some((function(e){return"main"===e.value}))&&E.some((function(e){return"urn:mpeg:dash:role:2011"===e.schemeIdUri})),I=h.children.representations,R=null!==(n=h.attributes.availabilityTimeComplete)&&void 0!==n?n:t.availabilityTimeComplete,Z=(null!==(r=h.attributes.availabilityTimeOffset)&&void 0!==r?r:0)+t.availabilityTimeOffset,x=h.attributes.mimeType,P=h.attributes.codecs,M=A(I,(0,S.Z)(x)?x:null,(0,S.Z)(P)?P:null,null!=m.roles?m.roles:null);if(void 0!==M){var C=null!==(i=h.attributes.selectionPriority)&&void 0!==i?i:1,D=h.attributes.id,N=ue(h),O=[];void 0!==t.segmentTemplate&&O.push(t.segmentTemplate),void 0!==h.children.segmentTemplate&&O.push(h.children.segmentTemplate);var L={availabilityTimeComplete:R,availabilityTimeOffset:Z,baseURLs:Q(t.baseURLs,m.baseURLs),manifestBoundsCalculator:t.manifestBoundsCalculator,end:t.end,isDynamic:t.isDynamic,isLastPeriod:t.isLastPeriod,manifestProfiles:t.manifestProfiles,parentSegmentTemplates:O,receivedTime:t.receivedTime,start:t.start,timeShiftBufferDepth:t.timeShiftBufferDepth,unsafelyBaseOnPreviousAdaptation:null},U=Array.isArray(g)?(0,s.Z)(g,(function(e){return"http://dashif.org/guidelines/trickmode"===e.schemeIdUri})):void 0,B=null===(a=null==U?void 0:U.value)||void 0===a?void 0:a.split(" "),F=void 0!==B,z=m.accessibilities,V=void 0;void 0!==E&&E.some((function(e){return"dub"===e.value}))&&(V=!0);var K=void 0;K="text"===M&&ae(z,E);var G=void 0;"text"===M&&void 0!==E&&E.some((function(e){return"forced-subtitle"===e.value||"forced_subtitle"===e.value}))&&(G=!0);var j=void 0;"audio"!==M?j=!1:void 0!==z&&(j=z.some(ie));var H=void 0;"video"!==M?H=!1:void 0!==z&&(H=z.some(oe));for(var W=se(h,{isAudioDescription:j,isForcedSubtitle:G,isClosedCaption:K,isSignInterpreted:H,isTrickModeTrack:F,type:M});(0,b.Z)(v,W);)W+="-dup";var q=W;v.push(W),L.unsafelyBaseOnPreviousAdaptation=null!==(l=null===(u=t.unsafelyBaseOnPreviousPeriod)||void 0===u?void 0:u.getAdaptation(W))&&void 0!==l?l:null;var Y={id:W,representations:te(I,h,L),type:M,isTrickModeTrack:F};if(null!=h.attributes.language&&(Y.language=h.attributes.language),null!=K&&(Y.closedCaption=K),null!=j&&(Y.audioDescription=j),!0===V&&(Y.isDub=!0),void 0!==G&&(Y.forcedSubtitles=G),!0===H&&(Y.isSignInterpreted=!0),void 0!==T&&(Y.label=T),void 0!==B)c.push({adaptation:Y,trickModeAttachedAdaptationIds:B});else{for(var X,$=-1,J=function(){var e=X.value,t=f[e];if(void 0!==t&&t.newID!==q&&(0,b.Z)(t.adaptationSetSwitchingIDs,D)){$=(0,_.Z)(d[M],(function(t){return t[0].id===e}));var n,r=d[M][$];void 0!==r&&r[0].audioDescription===Y.audioDescription&&r[0].closedCaption===Y.closedCaption&&r[0].language===Y.language&&(o.Z.info('DASH Parser: merging "switchable" AdaptationSets',D,e),(n=r[0].representations).push.apply(n,Y.representations),r[1]={priority:Math.max(C,r[1].priority),isMainAdaptation:w||r[1].isMainAdaptation,indexInMpd:Math.min(p,r[1].indexInMpd)})}},ee=ne(N);!(X=ee()).done;)J();$<0&&d[M].push([Y,{priority:C,isMainAdaptation:w,indexInMpd:p}])}null!=D&&null==f[D]&&(f[D]={newID:q,adaptationSetSwitchingIDs:N})}}var re=y.r.reduce((function(e,t){var n=d[t];return n.length>0&&(n.sort(le),e[t]=n.map((function(e){return e[0]}))),e}),{});return d.video.sort(le),k(re,c),re}(I.children.adaptations,F),V=(null!==(u=t.xmlNamespaces)&&void 0!==u?u:[]).concat(null!==(l=I.attributes.namespaces)&&void 0!==l?l:[]),K=function(e,t,n){for(var r,i,a,o=[],s=de(e);!(a=s()).done;)for(var u,l=a.value,d=l.attributes,c=d.schemeIdUri,f=void 0===c?"":c,v=d.timescale,p=void 0===v?1:v,h=n.concat(null!==(r=l.attributes.namespaces)&&void 0!==r?r:[]),g=de(l.children.events);!(u=g()).done;){var y=u.value;if(void 0!==y.eventStreamData){var _=(null!==(i=y.presentationTime)&&void 0!==i?i:0)/p+t,b=void 0===y.duration?void 0:_+y.duration/p,S=void 0;if(y.eventStreamData instanceof Element)S=y.eventStreamData;else{var E=h.reduce((function(e,t){return e+"xmlns:"+t.key+'="'+t.value+'" '}),"<toremove ");E+=">";var T=(0,m.uR)(new Uint8Array(y.eventStreamData));S=(new DOMParser).parseFromString(E+T+"</toremove>","application/xml").documentElement.childNodes[0]}o.push({start:_,end:b,id:y.id,data:{type:"dash-event-stream",value:{schemeIdUri:f,timescale:p,element:S}}})}}return o}(I.children.eventStreams,P,V),G={id:g,start:P,end:C,duration:M,adaptations:z,streamEvents:K};if(d.unshift(G),!E.lastPositionIsKnown()){var j=function(e){for(var t,n=null,r=!0,i=(0,h.Z)(e).filter((function(e){return null!=e})),a=de((0,v.Z)(i,(function(e){return e})));!(t=a()).done;)for(var o,s=de(t.value.representations);!(o=s()).done;){var u=o.value.index.getLastAvailablePosition();null!==u&&(r=!1,"number"==typeof u&&(n=null==n?u:Math.max(n,u)))}if(null!=n)return n;if(r)return null;return}(z);if(f)if("number"==typeof j){var H=performance.now()/1e3;E.setLastPosition(j,H)}else{var W=pe(t,P);if(void 0!==W){var q=W[0],Y=W[1];E.setLastPosition(q,Y)}}else"number"==typeof j&&E.setLastPosition(j)}},w=e.length-1;w>=0;w--)T();if(t.isDynamic&&!E.lastPositionIsKnown()){var I=pe(t,0);if(void 0!==I){var R=I[0],Z=I[1];E.setLastPosition(R,Z)}}return function(e){if(0===e.length)return[];for(var t=[e[0]],n=1;n<e.length;n++){for(var r=e[n],i=t[t.length-1];(void 0===i.duration||i.start+i.duration>r.start)&&(o.Z.warn("DASH: Updating overlapping Periods.",null==i?void 0:i.start,r.start),i.duration=r.start-i.start,i.end=r.start,!(i.duration>0));)t.pop(),i=t[t.length-1];t.push(r)}return t}(d)}function pe(e,t){if(null!=e.clockOffset){var n=e.clockOffset/1e3-e.availabilityStartTime,r=performance.now()/1e3,i=r+n;if(i>=t)return[i,r]}else{var a=Date.now()/1e3;if(a>=t)return o.Z.warn("DASH Parser: no clock synchronization mechanism found. Using the system clock instead."),[a-e.availabilityStartTime,performance.now()/1e3]}}function he(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return me(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return me(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ge=function e(t,n,r,i,d){void 0===d&&(d=new WeakMap);var c=t.children,v=t.attributes;if(null==n.externalClockOffset){var p="dynamic"===v.type,h=(0,s.Z)(c.utcTimings,(function(e){return"urn:mpeg:dash:utc:direct:2014"===e.schemeIdUri&&null!=e.value})),m=null!=h&&null!=h.value?l(h.value):void 0,g=null==m||isNaN(m)?void 0:m;if(null!=g&&!0!==i)n.externalClockOffset=g;else if(p&&!0!==i){var y=function(e){var t=e.children.utcTimings.filter((function(e){return("urn:mpeg:dash:utc:http-iso:2014"===e.schemeIdUri||"urn:mpeg:dash:utc:http-xsdate:2014"===e.schemeIdUri)&&void 0!==e.value}));return t.length>0?t[0].value:void 0}(t);if(null!=y&&y.length>0)return{type:"needs-clock",value:{url:y,continue:function(i){return i.success?(n.externalClockOffset=l(i.data),e(t,n,r,!0)):(r.push(i.error),o.Z.warn("DASH Parser: Error on fetching the clock ressource",i.error),e(t,n,r,!0))}}}}}for(var _=[],b=0;b<c.periods.length;b++){var S=c.periods[b].attributes,E=S.xlinkHref,T=S.xlinkActuate;null!=E&&"onLoad"===T&&_.push({index:b,ressource:E})}return 0===_.length?function(e,t,n,r){var i,s,l,d,c,v,p=e.children,h=e.attributes,m="dynamic"===h.type,g=void 0!==t.url?[{url:t.url.substring(0,(0,u.$)(t.url))}]:[],y=Q(g,p.baseURLs),_=function(e,t){return"dynamic"!==e.type?0:null==e.availabilityStartTime?null==t?0:t:e.availabilityStartTime}(h,t.referenceDateTime),b=h.timeShiftBufferDepth,S=t.externalClockOffset,E=t.unsafelyBaseOnPreviousManifest,T={availabilityStartTime:_,baseURLs:y,clockOffset:S,duration:h.duration,isDynamic:m,manifestProfiles:e.attributes.profiles,receivedTime:t.manifestReceivedTime,timeShiftBufferDepth:b,unsafelyBaseOnPreviousManifest:E,xlinkInfos:r,xmlNamespaces:e.attributes.namespaces},k=ve(p.periods,T),w=h.duration,A=null;void 0!==h.minimumUpdatePeriod&&h.minimumUpdatePeriod>=0&&(d=0===h.minimumUpdatePeriod?a.Z.getCurrent().DASH_FALLBACK_LIFETIME_WHEN_MINIMUM_UPDATE_PERIOD_EQUAL_0:h.minimumUpdatePeriod);var I=f(k),R=I.minimumSafePosition,Z=I.maximumSafePosition,x=I.maximumUnsafePosition,P=performance.now();if(m){var M,C;if(c=R,A=null!=b?b:null,void 0!==x&&(C=x),void 0!==Z)M=Z;else{var D=null!=_?_:0,N=t.externalClockOffset;if(void 0===N)o.Z.warn("DASH Parser: use system clock to define maximum position"),M=Date.now()/1e3-D;else M=(performance.now()+N)/1e3-D}void 0===C&&(C=M),v={isLinear:!0,maximumSafePosition:M,livePosition:C,time:P},null!==A&&void 0!==c&&M-c>A&&(A=M-c)}else{c=void 0!==R?R:void 0!==(null===(i=k[0])||void 0===i?void 0:i.start)?k[0].start:0;var O=null!=w?w:1/0;if(void 0!==k[k.length-1]){var L=k[k.length-1],U=null!==(s=L.end)&&void 0!==s?s:void 0!==L.duration?L.start+L.duration:void 0;void 0!==U&&U<O&&(O=U)}void 0!==Z&&Z<O&&(O=Z),v={isLinear:!1,maximumSafePosition:O,livePosition:void 0,time:P}}var B=!m||void 0===e.attributes.minimumUpdatePeriod&&(void 0!==(null===(l=k[k.length-1])||void 0===l?void 0:l.end)||void 0!==e.attributes.duration),F={availabilityStartTime:_,clockOffset:t.externalClockOffset,isDynamic:m,isLive:m,isLastPeriodKnown:B,periods:k,publishTime:h.publishTime,suggestedPresentationDelay:h.suggestedPresentationDelay,transportType:"dash",timeBounds:{minimumSafePosition:c,timeshiftDepth:A,maximumTimeData:v},lifetime:d,uris:null==t.url?p.locations:[t.url].concat(p.locations)};return{type:"done",value:{parsed:F,warnings:n}}}(t,n,r,d):{type:"needs-xlinks",value:{xlinksUrls:_.map((function(e){return e.ressource})),continue:function(a){if(a.length!==_.length)throw new Error("DASH parser: wrong number of loaded ressources.");for(var o=a.length-1;o>=0;o--){var s,u=_[o].index,l=a[o],f=l.parsed,v=l.warnings,p=l.receivedTime,h=l.sendingTime,m=l.url;v.length>0&&r.push.apply(r,v);for(var g,y=he(f);!(g=y()).done;){var b=g.value;d.set(b,{receivedTime:p,sendingTime:h,url:m})}(s=c.periods).splice.apply(s,[u,1].concat(f))}return e(t,n,r,i,d)}}}};function ye(e){var t=e.textContent,n=[];return null===t||0===t.length?[void 0,n]:[{value:t},n]}function _e(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"id":t.id=r.value;break;case"lang":t.language=r.value;break;case"contentType":t.contentType=r.value;break;case"par":t.par=r.value}}return t}var be=n(7326),Se=n(4578),Ee=n(2146),Te=n(9689),ke=/^P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,we=/([0-9]+)-([0-9]+)/;function Ae(e,t){return"true"===e?[!0,null]:"false"===e?[!1,null]:[!1,new Le("`"+t+'` property is not a boolean value but "'+e+'"')]}function Ie(e,t){var n=parseInt(e,10);return isNaN(n)?[null,new Le("`"+t+'` property is not an integer value but "'+e+'"')]:[n,null]}function Re(e,t){if("INF"===e)return[1/0,null];var n=parseFloat(e);return isNaN(n)?[null,new Le("`"+t+'` property is invalid: "'+e+'"')]:[n,null]}function Ze(e,t){if("true"===e)return[!0,null];if("false"===e)return[!1,null];var n=parseInt(e,10);return isNaN(n)?[null,new Le("`"+t+'` property is not a boolean nor an integer but "'+e+'"')]:[n,null]}function xe(e,t){var n=Date.parse(e);return isNaN(n)?[null,new Le("`"+t+'` is in an invalid date format: "'+e+'"')]:[new Date(Date.parse(e)).getTime()/1e3,null]}function Pe(e,t){if(!(0,S.Z)(e))return[0,new Le("`"+t+"` property is empty")];var n=ke.exec(e);return null===n?[null,new Le("`"+t+'` property has an unrecognized format "'+e+'"')]:[365*parseFloat((0,S.Z)(n[2])?n[2]:"0")*24*60*60+30*parseFloat((0,S.Z)(n[4])?n[4]:"0")*24*60*60+24*parseFloat((0,S.Z)(n[6])?n[6]:"0")*60*60+60*parseFloat((0,S.Z)(n[8])?n[8]:"0")*60+60*parseFloat((0,S.Z)(n[10])?n[10]:"0")+parseFloat((0,S.Z)(n[12])?n[12]:"0"),null]}function Me(e,t){var n=we.exec(e);return null===n?[null,new Le("`"+t+'` property has an unrecognized format "'+e+'"')]:[[+n[1],+n[2]],null]}function Ce(e,t){try{return[(0,Te.K)(e),null]}catch(n){return[null,new Le("`"+t+'` is not a valid base64 string: "'+e+'"')]}}function De(e,t){var n=/^(\d+)\/(\d+)$/.exec(e);return null!==n?[+n[1]/+n[2],null]:Re(e,t)}function Ne(e){for(var t,n,r=0;r<e.attributes.length;r++){var i=e.attributes[r];switch(i.name){case"schemeIdUri":t=i.value;break;case"value":n=i.value}}return{schemeIdUri:t,value:n}}function Oe(e,t){return function(n,r){var i=r.asKey,a=(0,r.parser)(n,r.dashName),s=a[0],u=a[1];null!==u&&(o.Z.warn(u.message),t.push(u)),null!==s&&(e[i]=s)}}var Le=function(e){function t(n){var r;return r=e.call(this)||this,Object.setPrototypeOf((0,be.Z)(r),t.prototype),r.name="MPDError",r.message=n,r}return(0,Se.Z)(t,e),t}((0,Ee.Z)(Error));function Ue(e){var t=function(e){for(var t=[],n=[],r=0;r<e.length;r++)if(e[r].nodeType===Node.ELEMENT_NODE){var i=e[r];if("cenc:pssh"===i.nodeName){var a=i.textContent;if(null!==a&&a.length>0){var s=Ce(a,"cenc:pssh"),u=s[0],l=s[1];null!==l&&(o.Z.warn(l.message),t.push(l)),null!==u&&n.push(u)}}}return[{cencPssh:n},t]}(e.childNodes),n=t[0],r=t[1];return[{children:n,attributes:function(e){for(var t={},n=0;n<e.attributes.length;n++){var r=e.attributes[n];switch(r.name){case"schemeIdUri":t.schemeIdUri=r.value;break;case"value":t.value=r.value;break;case"cenc:default_KID":t.keyId=(0,m.nr)(r.value.replace(/-/g,""))}}return t}(e)},r]}function Be(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"range":r(a.value,{asKey:"range",parser:Me,dashName:"range"});break;case"sourceURL":t.media=a.value}}return[t,n]}function Fe(e){for(var t={},n=[],r=Oe(t,n),i=e.childNodes,a=0;a<i.length;a++)if(i[a].nodeType===Node.ELEMENT_NODE){var o=i[a];if("Initialization"===o.nodeName){var s=Be(o),u=s[0],l=s[1];t.initialization=u,n=n.concat(l)}}for(var d=0;d<e.attributes.length;d++){var c=e.attributes[d];switch(c.name){case"timescale":r(c.value,{asKey:"timescale",parser:Ie,dashName:"timescale"});break;case"presentationTimeOffset":r(c.value,{asKey:"presentationTimeOffset",parser:Re,dashName:"presentationTimeOffset"});break;case"indexRange":r(c.value,{asKey:"indexRange",parser:Me,dashName:"indexRange"});break;case"indexRangeExact":r(c.value,{asKey:"indexRangeExact",parser:Ae,dashName:"indexRangeExact"});break;case"availabilityTimeOffset":r(c.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(c.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"});break;case"duration":r(c.value,{asKey:"duration",parser:Ie,dashName:"duration"});break;case"startNumber":r(c.value,{asKey:"startNumber",parser:Ie,dashName:"startNumber"});break;case"endNumber":r(c.value,{asKey:"endNumber",parser:Ie,dashName:"endNumber"})}}return[t,n]}function ze(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"media":t.media=a.value;break;case"indexRange":r(a.value,{asKey:"indexRange",parser:Me,dashName:"indexRange"});break;case"index":t.index=a.value;break;case"mediaRange":r(a.value,{asKey:"mediaRange",parser:Me,dashName:"mediaRange"})}}return[t,n]}function Ve(e){for(var t=Fe(e),n=t[0],r=t[1],i=[],a=e.childNodes,o=0;o<a.length;o++)if(a[o].nodeType===Node.ELEMENT_NODE){var s=a[o];if("SegmentURL"===s.nodeName){var u=ze(s),l=u[0],d=u[1];i.push(l),r=r.concat(d)}}return[(0,I.Z)(n,{list:i}),r]}function Ke(e){var t=null;return function(){if(null===t){var n=e.getElementsByTagName("S");return t=n,n}return t}}function Ge(e){for(var t,n=Fe(e),r=n[0],i=n[1],a=0;a<e.childNodes.length;a++)if(e.childNodes[a].nodeType===Node.ELEMENT_NODE){var o=e.childNodes[a];"SegmentTimeline"===o.nodeName&&(t=Ke(o))}for(var s=(0,I.Z)({},r,{duration:r.duration,timelineParser:t}),u=Oe(s,i),l=0;l<e.attributes.length;l++){var d=e.attributes[l];switch(d.nodeName){case"initialization":null==s.initialization&&(s.initialization={media:d.value});break;case"index":s.index=d.value;break;case"availabilityTimeOffset":u(d.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":u(d.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"});break;case"media":s.media=d.value;break;case"bitstreamSwitching":u(d.value,{asKey:"bitstreamSwitching",parser:Ae,dashName:"bitstreamSwitching"})}}return[s,i]}function je(e){var t=function(e){for(var t={baseURLs:[]},n=[],r=[],i=0;i<e.length;i++)if(e[i].nodeType===Node.ELEMENT_NODE){var a=e[i];switch(a.nodeName){case"BaseURL":var o=ye(a),s=o[0],u=o[1];void 0!==s&&t.baseURLs.push(s),r=r.concat(u);break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Ne(a));break;case"SegmentBase":var l=Fe(a),d=l[0],c=l[1];t.segmentBase=d,c.length>0&&(r=r.concat(c));break;case"SegmentList":var f=Ve(a),v=f[0],p=f[1];r=r.concat(p),t.segmentList=v;break;case"SegmentTemplate":var h=Ge(a),m=h[0],g=h[1];r=r.concat(g),t.segmentTemplate=m;break;case"ContentProtection":var y=Ue(a),_=y[0],b=y[1];b.length>0&&(r=r.concat(b)),void 0!==_&&n.push(_)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"audioSamplingRate":t.audioSamplingRate=a.value;break;case"bandwidth":r(a.value,{asKey:"bitrate",parser:Ie,dashName:"bandwidth"});break;case"codecs":t.codecs=a.value;break;case"codingDependency":r(a.value,{asKey:"codingDependency",parser:Ae,dashName:"codingDependency"});break;case"frameRate":r(a.value,{asKey:"frameRate",parser:De,dashName:"frameRate"});break;case"height":r(a.value,{asKey:"height",parser:Ie,dashName:"height"});break;case"id":t.id=a.value;break;case"maxPlayoutRate":r(a.value,{asKey:"maxPlayoutRate",parser:Re,dashName:"maxPlayoutRate"});break;case"maximumSAPPeriod":r(a.value,{asKey:"maximumSAPPeriod",parser:Re,dashName:"maximumSAPPeriod"});break;case"mimeType":t.mimeType=a.value;break;case"profiles":t.profiles=a.value;break;case"qualityRanking":r(a.value,{asKey:"qualityRanking",parser:Ie,dashName:"qualityRanking"});break;case"segmentProfiles":t.segmentProfiles=a.value;break;case"width":r(a.value,{asKey:"width",parser:Ie,dashName:"width"});break;case"availabilityTimeOffset":r(a.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(a.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"})}}return void 0===t.bitrate&&n.push(new Le("No bitrate found on a Representation")),[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function He(e){var t=function(e){for(var t={baseURLs:[],representations:[]},n=[],r=[],i=0;i<e.length;i++)if(e[i].nodeType===Node.ELEMENT_NODE){var a=e[i];switch(a.nodeName){case"Accessibility":void 0===t.accessibilities?t.accessibilities=[Ne(a)]:t.accessibilities.push(Ne(a));break;case"BaseURL":var o=ye(a),s=o[0],u=o[1];void 0!==s&&t.baseURLs.push(s),u.length>0&&(r=r.concat(u));break;case"ContentComponent":t.contentComponent=_e(a);break;case"EssentialProperty":null==t.essentialProperties?t.essentialProperties=[Ne(a)]:t.essentialProperties.push(Ne(a));break;case"InbandEventStream":void 0===t.inbandEventStreams&&(t.inbandEventStreams=[]),t.inbandEventStreams.push(Ne(a));break;case"Label":var l=a.textContent;null!=l&&(t.label=l);break;case"Representation":var d=je(a),c=d[0],f=d[1];t.representations.push(c),f.length>0&&(r=r.concat(f));break;case"Role":null==t.roles?t.roles=[Ne(a)]:t.roles.push(Ne(a));break;case"SupplementalProperty":null==t.supplementalProperties?t.supplementalProperties=[Ne(a)]:t.supplementalProperties.push(Ne(a));break;case"SegmentBase":var v=Fe(a),p=v[0],h=v[1];t.segmentBase=p,h.length>0&&(r=r.concat(h));break;case"SegmentList":var m=Ve(a),g=m[0],y=m[1];t.segmentList=g,y.length>0&&(r=r.concat(y));break;case"SegmentTemplate":var _=Ge(a),b=_[0],S=_[1];t.segmentTemplate=b,S.length>0&&(r=r.concat(S));break;case"ContentProtection":var E=Ue(a),T=E[0],k=E[1];k.length>0&&(r=r.concat(k)),void 0!==T&&n.push(T)}}return n.length>0&&(t.contentProtections=n),[t,r]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"group":r(a.value,{asKey:"group",parser:Ie,dashName:"group"});break;case"lang":t.language=a.value;break;case"contentType":t.contentType=a.value;break;case"par":t.par=a.value;break;case"minBandwidth":r(a.value,{asKey:"minBitrate",parser:Ie,dashName:"minBandwidth"});break;case"maxBandwidth":r(a.value,{asKey:"maxBitrate",parser:Ie,dashName:"maxBandwidth"});break;case"minWidth":r(a.value,{asKey:"minWidth",parser:Ie,dashName:"minWidth"});break;case"maxWidth":r(a.value,{asKey:"maxWidth",parser:Ie,dashName:"maxWidth"});break;case"minHeight":r(a.value,{asKey:"minHeight",parser:Ie,dashName:"minHeight"});break;case"maxHeight":r(a.value,{asKey:"maxHeight",parser:Ie,dashName:"maxHeight"});break;case"minFrameRate":r(a.value,{asKey:"minFrameRate",parser:De,dashName:"minFrameRate"});break;case"maxFrameRate":r(a.value,{asKey:"maxFrameRate",parser:De,dashName:"maxFrameRate"});break;case"selectionPriority":r(a.value,{asKey:"selectionPriority",parser:Ie,dashName:"selectionPriority"});break;case"segmentAlignment":r(a.value,{asKey:"segmentAlignment",parser:Ze,dashName:"segmentAlignment"});break;case"subsegmentAlignment":r(a.value,{asKey:"subsegmentAlignment",parser:Ze,dashName:"subsegmentAlignment"});break;case"bitstreamSwitching":r(a.value,{asKey:"bitstreamSwitching",parser:Ae,dashName:"bitstreamSwitching"});break;case"audioSamplingRate":t.audioSamplingRate=a.value;break;case"codecs":t.codecs=a.value;break;case"codingDependency":r(a.value,{asKey:"codingDependency",parser:Ae,dashName:"codingDependency"});break;case"frameRate":r(a.value,{asKey:"frameRate",parser:De,dashName:"frameRate"});break;case"height":r(a.value,{asKey:"height",parser:Ie,dashName:"height"});break;case"maxPlayoutRate":r(a.value,{asKey:"maxPlayoutRate",parser:Re,dashName:"maxPlayoutRate"});break;case"maximumSAPPeriod":r(a.value,{asKey:"maximumSAPPeriod",parser:Re,dashName:"maximumSAPPeriod"});break;case"mimeType":t.mimeType=a.value;break;case"profiles":t.profiles=a.value;break;case"segmentProfiles":t.segmentProfiles=a.value;break;case"width":r(a.value,{asKey:"width",parser:Ie,dashName:"width"});break;case"availabilityTimeOffset":r(a.value,{asKey:"availabilityTimeOffset",parser:Re,dashName:"availabilityTimeOffset"});break;case"availabilityTimeComplete":r(a.value,{asKey:"availabilityTimeComplete",parser:Ae,dashName:"availabilityTimeComplete"})}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function We(e){for(var t={children:{events:[]},attributes:{}},n=[],r=Oe(t.attributes,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"schemeIdUri":t.attributes.schemeIdUri=a.value;break;case"timescale":r(a.value,{asKey:"timescale",parser:Ie,dashName:"timescale"});break;case"value":t.attributes.value=a.value}}for(var o=0;o<e.childNodes.length;o++)if(e.childNodes[o].nodeType===Node.ELEMENT_NODE){var s=e.childNodes[o];if("Event"===s.nodeName){var u=qe(s),l=u[0],d=u[1];t.children.events.push(l),d.length>0&&(n=n.concat(d))}}return[t,n]}function qe(e){for(var t={eventStreamData:e},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"presentationTime":r(a.value,{asKey:"presentationTime",parser:Ie,dashName:"presentationTime"});break;case"duration":r(a.value,{asKey:"duration",parser:Ie,dashName:"duration"});break;case"id":t.id=a.value}}return[t,n]}function Ye(e){var t=function(e){for(var t,n=[],r=[],i=[],a=[],o=0;o<e.length;o++)if(e[o].nodeType===Node.ELEMENT_NODE){var s=e[o];switch(s.nodeName){case"BaseURL":var u=ye(s),l=u[0],d=u[1];void 0!==l&&n.push(l),i=i.concat(d);break;case"AdaptationSet":var c=He(s),f=c[0],v=c[1];r.push(f),i=i.concat(v);break;case"EventStream":var p=We(s),h=p[0],m=p[1];a.push(h),i=i.concat(m);break;case"SegmentTemplate":var g=Ge(s),y=g[0],_=g[1];t=y,_.length>0&&(i=i.concat(_))}}return[{baseURLs:n,adaptations:r,eventStreams:a,segmentTemplate:t},i]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"start":r(a.value,{asKey:"start",parser:Pe,dashName:"start"});break;case"duration":r(a.value,{asKey:"duration",parser:Pe,dashName:"duration"});break;case"bitstreamSwitching":r(a.value,{asKey:"bitstreamSwitching",parser:Ae,dashName:"bitstreamSwitching"});break;case"xlink:href":t.xlinkHref=a.value;break;case"xlink:actuate":t.xlinkActuate=a.value}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}function Xe(e){var t=function(e){for(var t=[],n=[],r=[],i=[],a=[],o=0;o<e.length;o++)if(e[o].nodeType===Node.ELEMENT_NODE){var s=e[o];switch(s.nodeName){case"BaseURL":var u=ye(s),l=u[0],d=u[1];void 0!==l&&t.push(l),a=a.concat(d);break;case"Location":n.push(null===s.textContent?"":s.textContent);break;case"Period":var c=Ye(s),f=c[0],v=c[1];r.push(f),a=a.concat(v);break;case"UTCTiming":var p=Ne(s);i.push(p)}}return[{baseURLs:t,locations:n,periods:r,utcTimings:i},a]}(e.childNodes),n=t[0],r=t[1],i=function(e){for(var t={},n=[],r=Oe(t,n),i=0;i<e.attributes.length;i++){var a=e.attributes[i];switch(a.name){case"id":t.id=a.value;break;case"profiles":t.profiles=a.value;break;case"type":t.type=a.value;break;case"availabilityStartTime":r(a.value,{asKey:"availabilityStartTime",parser:xe,dashName:"availabilityStartTime"});break;case"availabilityEndTime":r(a.value,{asKey:"availabilityEndTime",parser:xe,dashName:"availabilityEndTime"});break;case"publishTime":r(a.value,{asKey:"publishTime",parser:xe,dashName:"publishTime"});break;case"mediaPresentationDuration":r(a.value,{asKey:"duration",parser:Pe,dashName:"mediaPresentationDuration"});break;case"minimumUpdatePeriod":r(a.value,{asKey:"minimumUpdatePeriod",parser:Pe,dashName:"minimumUpdatePeriod"});break;case"minBufferTime":r(a.value,{asKey:"minBufferTime",parser:Pe,dashName:"minBufferTime"});break;case"timeShiftBufferDepth":r(a.value,{asKey:"timeShiftBufferDepth",parser:Pe,dashName:"timeShiftBufferDepth"});break;case"suggestedPresentationDelay":r(a.value,{asKey:"suggestedPresentationDelay",parser:Pe,dashName:"suggestedPresentationDelay"});break;case"maxSegmentDuration":r(a.value,{asKey:"maxSegmentDuration",parser:Pe,dashName:"maxSegmentDuration"});break;case"maxSubsegmentDuration":r(a.value,{asKey:"maxSubsegmentDuration",parser:Pe,dashName:"maxSubsegmentDuration"})}}return[t,n]}(e),a=i[0],o=i[1];return[{children:n,attributes:a},r.concat(o)]}var Qe=function(e,t){var n=e.documentElement;if((0,i.Z)(n)||"MPD"!==n.nodeName)throw new Error("DASH Parser: document root should be MPD");var a=Xe(n),o=a[0],s=a[1];return function e(t){if("done"===t.type)return t;if("needs-clock"===t.type)return{type:"needs-resources",value:{urls:[t.value.url],format:"string",continue:function(n){if(1!==n.length)throw new Error("DASH parser: wrong number of loaded ressources.");var r=t.value.continue(n[0].responseData);return e(r)}}};if("needs-xlinks"===t.type)return{type:"needs-resources",value:{urls:t.value.xlinksUrls,format:"string",continue:function(n){for(var r=[],i=0;i<n.length;i++){var a=n[i],o=a.responseData,s=a.receivedTime,u=a.sendingTime,l=a.url;if(!o.success)throw o.error;var d="<root>"+o.data+"</root>",c=(new DOMParser).parseFromString(d,"text/xml");if(null==c||0===c.children.length)throw new Error("DASH parser: Invalid external ressources");for(var f=c.children[0].children,v=[],p=[],h=0;h<f.length;h++)if(f[h].nodeType===Node.ELEMENT_NODE){var m=Ye(f[h]),g=m[0],y=m[1];p.push.apply(p,y),v.push(g)}r.push({url:l,receivedTime:s,sendingTime:u,parsed:v,warnings:p})}var _=t.value.continue(r);return e(_)}}};(0,r.Z)(t)}(ge(o,t,s))}},8232:function(e,t,n){"use strict";function r(e,t){for(var n=0;e.length>0;){var r=e[0];if(r.start>=t)return n;if(-1===r.repeatCount)return n;if(0===r.repeatCount)e.shift(),n+=1;else{var i=e[1];if(void 0!==i&&i.start<=t)e.shift(),n+=1;else{if(r.duration<=0)return n;for(var a=r.start+r.duration,o=1;a<t&&o<=r.repeatCount;)a+=r.duration,o++;if(!(o>r.repeatCount)){var s=r.repeatCount-o;return r.start=a,r.repeatCount=s,n+=o}e.shift(),n=r.repeatCount+1}}}return n}n.d(t,{Z:function(){return r}})},3911:function(e,t,n){"use strict";n.d(t,{KF:function(){return i},PZ:function(){return u},_j:function(){return l},gT:function(){return o},jH:function(){return a},zG:function(){return s}});var r=n(1946);function i(e,t,n){var i,a=e.repeatCount;return a>=0?a:(i=(0,r.Z)(t)?void 0!==n?n:Number.MAX_VALUE:t.start,Math.ceil((i-e.start)/e.duration)-1)}function a(e,t,n){var r=e.start,a=e.duration;return a<=0?r:r+(i(e,t,n)+1)*a}function o(e,t){var n;return e*t.timescale+(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0)}function s(e,t){var n;return(e-(null!==(n=t.indexTimeOffset)&&void 0!==n?n:0))/t.timescale}function u(e,t,n){return[e*n,(e+t)*n]}function l(e,t,n){var r=e.timeline,i=o(t,e);if(i<0)return null;var u=function(e,t){for(var n=0,r=e.length;n<r;){var i=n+r>>>1;e[i].start<=t?n=i+1:r=i}return n-1}(r,i);if(u<0||u>=r.length-1)return null;var l=r[u];if(l.duration<=0)return null;var d=r[u+1];if(void 0===d)return null;var c=d.start;return i>=a(l,d,n)&&i<c?s(c,e):null}},1091:function(e,t,n){"use strict";function r(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i],o=(a.start-r)/n;if(o>e.time)return!1;if(o===e.time)return void 0===a.range?void 0===e.range:null!=e.range&&a.range[0]===e.range[0]&&a.range[1]===e.range[1];if(a.repeatCount>=0&&void 0!==a.duration){var s=(o-a.start)/a.duration-1;return s%1==0&&s<=a.repeatCount}}return!1}n.d(t,{Z:function(){return r}})},5505:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(3714),i=n(3887),a=n(3911);function o(e,t){if(0===e.length)return e.push.apply(e,t),!0;if(0===t.length)return!1;var n=e.length,o=t[0].start,s=e[n-1];if((0,a.jH)(s,t[0])<o)throw new r.Z("MANIFEST_UPDATE_ERROR","Cannot perform partial update: not enough data");for(var u=n-1;u>=0;u--){var l=e[u].start;if(l===o){var d=n-u;return e.splice.apply(e,[u,d].concat(t)),!1}if(l<o){var c=e[u];if(c.start+c.duration>o)return i.Z.warn("RepresentationIndex: Manifest update removed all previous segments"),e.splice.apply(e,[0,n].concat(t)),!0;if(void 0===c.repeatCount||c.repeatCount<=0)return c.repeatCount<0&&(c.repeatCount=Math.floor((o-c.start)/c.duration)-1),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;if(c.start+c.duration*(c.repeatCount+1)<=o)return e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1;var f=(o-c.start)/c.duration-1;if(f%1==0&&c.duration===t[0].duration){var v=t[0].repeatCount<0?-1:t[0].repeatCount+f+1;return e.splice.apply(e,[u,n-u].concat(t)),e[u].start=c.start,e[u].repeatCount=v,!1}return i.Z.warn("RepresentationIndex: Manifest update removed previous segments"),e[u].repeatCount=Math.floor(f),e.splice.apply(e,[u+1,n-(u+1)].concat(t)),!1}}var p=e[e.length-1],h=t[t.length-1];return void 0!==p.repeatCount&&p.repeatCount<0?p.start>h.start?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0):p.start+p.duration*(p.repeatCount+1)>=h.start+h.duration*(h.repeatCount+1)?(i.Z.warn("RepresentationIndex: The new index is older than the previous one"),!1):(i.Z.warn('RepresentationIndex: The new index is "bigger" than the previous one'),e.splice.apply(e,[0,n].concat(t)),!0)}},5734:function(e,t,n){"use strict";var r=n(6923),i=/&#([0-9]+);/g,a=/<br>/gi,o=/<style[^>]*>([\s\S]*?)<\/style[^>]*>/i,s=/\s*<p (?:class=([^>]+))?>(.*)/i,u=/<sync[^>]+?start="?([0-9]*)"?[^0-9]/i;function l(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var d,c,f=/<sync[ >]/gi,v=/<sync[ >]|<\/body>/gi,p=[],h=o.exec(e),m=Array.isArray(h)?h[1]:"";v.exec(e);var g,y=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);null!==r;){var i=r[1],a=l(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(m),_=function(e){var t=/p\s*{([^}]*)}/gi.exec(e);return null===t?"":t[1]}(m);if((0,r.Z)(n)&&void 0===(g=y[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;d=f.exec(e),c=v.exec(e),null!==d||null!==c;){if(null===d||null===c||d.index>=c.index)throw new Error("parse error");var b=e.slice(d.index,c.index),S=u.exec(b);if(!Array.isArray(S))throw new Error("parse error (sync time attribute)");var E=+S[1];if(isNaN(E))throw new Error("parse error (sync time attribute NaN)");T(b.split("\n"),E/1e3)}return p;function T(e,n){for(var o=e.length;--o>=0;){var u=s.exec(e[o]);if(Array.isArray(u)){var l=u[1],d=u[2];if(g===l)if("&nbsp;"===d)p[p.length-1].end=n;else{var c=document.createElement("DIV");c.className="rxp-texttrack-region";var f=document.createElement("DIV");f.className="rxp-texttrack-div",f.style.position="absolute",f.style.bottom="0",f.style.width="100%",f.style.color="#fff",f.style.textShadow="-1px -1px 0 #000,1px -1px 0 #000,-1px 1px 0 #000,1px 1px 0 #000";var v=document.createElement("div");v.className="rxp-texttrack-p",(0,r.Z)(_)&&(v.style.cssText=_);for(var h=d.split(a),m=0;m<h.length;m++){0!==m&&v.appendChild(document.createElement("BR"));var y=document.createElement("SPAN");y.className="rxp-texttrack-span",y.textContent=h[m].replace(i,(function(e,t){return String.fromCharCode(Number(t))})),v.appendChild(y)}f.appendChild(v),c.appendChild(f),p.push({element:c,start:n+t,end:-1})}}}}}},1812:function(e,t,n){"use strict";var r=n(7253),i=n(6923),a=/&#([0-9]+);/g,o=/<br>/gi,s=/<style[^>]*>([\s\S]*?)<\/style[^>]*>/i,u=/\s*<p (?:class=([^>]+))?>(.*)/i,l=/<sync[^>]+?start="?([0-9]*)"?[^0-9]/i;function d(e,t){var n=new RegExp("\\s*"+t+":\\s*(\\S+);","i").exec(e);return Array.isArray(n)?n[1]:null}t.Z=function(e,t,n){var c,f,v=/<sync[ >]/gi,p=/<sync[ >]|<\/body>/gi,h=[],m=s.exec(e),g=null!==m?m[1]:"";p.exec(e);var y,_=function(e){for(var t=/\.(\S+)\s*{([^}]*)}/gi,n={},r=t.exec(e);Array.isArray(r);){var i=r[1],a=d(r[2],"lang");null!=i&&null!=a&&(n[a]=i),r=t.exec(e)}return n}(g);if((0,i.Z)(n)&&void 0===(y=_[n]))throw new Error("sami: could not find lang "+n+" in CSS");for(;c=v.exec(e),f=p.exec(e),null!==c||null!==f;){if(null===c||null===f||c.index>=f.index)throw new Error("parse error");var b=e.slice(c.index,f.index),S=l.exec(b);if(null===S)throw new Error("parse error (sync time attribute)");var E=+S[1];if(isNaN(E))throw new Error("parse error (sync time attribute NaN)");T(b.split("\n"),E/1e3)}return function(e){for(var t=[],n=0;n<e.length;n++){var a=e[n],o=a.start,s=a.end,u=a.text;if((0,i.Z)(u)&&null!=s){var l=(0,r.Z)(o,s,u);null!=l&&t.push(l)}}return t}(h);function T(e,n){for(var r,i,s=e.length;--s>=0;)if(null!==(r=u.exec(e[s]))){var l=r,d=l[1],c=l[2];y===d&&("&nbsp;"===c?h[h.length-1].end=n:h.push({text:(i=c,i.replace(o,"\n").replace(a,(function(e,t){return String.fromCharCode(Number(t))}))),start:n+t}))}}}},2061:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}function a(e){for(var t=[],n=0;n<e.length;n++)if((0,r.Z)(e[n])){var a=i(e,n),o=e.slice(n,a);o.length>0&&(1===o.length?o[0].indexOf("--\x3e")>=0&&t.push(o):(o[1].indexOf("--\x3e")>=0||o[0].indexOf("--\x3e")>=0)&&t.push(o)),n=a}return t}},8675:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(2061),i=n(788);function a(e,t){for(var n=e.split(/\r\n|\n|\r/),a=(0,r.Z)(n),s=[],u=0;u<a.length;u++){var l=(0,i.Z)(a[u],t);if(null!=l){var d=o(l);null!=d&&s.push(d)}}return s}function o(e){var t=e.start,n=e.end,r=e.payload,i=document.createElement("div");i.className="rxp-texttrack-p",i.style.fontSize="28px",i.style.position="absolute",i.style.bottom="5%",i.style.width="100%",i.style.textAlign="center",i.style.color="#fff",i.style.textShadow="-1px -1px 2px #000,1px -1px 2px #000,-1px 1px 2px #000,1px 1px 2px #000";for(var a=0;a<r.length;a++){0!==a&&i.appendChild(document.createElement("br"));var o=s(r[a]);i.appendChild(o)}return{start:t,end:n,element:i}}function s(e){var t=document.createElement("div");t.innerHTML=e;return function e(t){var n=t.childNodes,r=document.createElement("span");r.className="rxp-texttrack-span";for(var i=0;i<n.length;i++){var a=n[i];if("#text"===a.nodeName){for(var o=a.wholeText.split("\n"),s=0;s<o.length;s++)if(0!==s&&r.appendChild(document.createElement("br")),o[s].length>0){var l=document.createTextNode(o[s]);r.appendChild(l)}}else if("B"===a.nodeName){var d=e(a);d.style.fontWeight="bold",r.appendChild(d)}else if("I"===a.nodeName){var c=e(a);c.style.fontStyle="italic",r.appendChild(c)}else if("U"===a.nodeName){var f=e(a);f.style.textDecoration="underline",r.appendChild(f)}else if(u(a)&&"string"==typeof a.color){var v=e(a);v.style.color=a.color,r.appendChild(v)}else{var p=e(a);r.appendChild(p)}}return r}(t)}function u(e){return"FONT"===e.nodeName&&"color"in e}},8057:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7253),i=n(2061),a=n(788);function o(e,t){for(var n,o,s,u,l,d=e.split(/\r\n|\n|\r/),c=(0,i.Z)(d),f=[],v=0;v<c.length;v++){var p=(0,a.Z)(c[v],t);if(null!==p){var h=(o=void 0,s=void 0,u=void 0,l=void 0,o=(n=p).start,s=n.end,u=n.payload,l=u.join("\n"),(0,r.Z)(o,s,l));null!==h&&f.push(h)}}return f}},788:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e){var t=e.split(":");if((0,r.Z)(t[2])){var n=parseInt(t[0],10),i=parseInt(t[1],10),a=parseFloat(t[2].replace(",","."));if(isNaN(n)||isNaN(i)||isNaN(a))return;return 60*n*60+60*i+a}}function a(e,t){if(0===e.length)return null;var n,a,o=[];if((0,r.Z)(e[1])&&-1!==e[1].indexOf("--\x3e")){var s=e[1].split("--\x3e").map((function(e){return e.trim()}));n=s[0],a=s[1],o=e.slice(2,e.length)}if(!(0,r.Z)(n)||!(0,r.Z)(a)){var u=e[0].split("--\x3e").map((function(e){return e.trim()}));n=u[0],a=u[1],o=e.slice(1,e.length)}if(!(0,r.Z)(n)||!(0,r.Z)(a))return null;var l=i(n),d=i(a);return void 0===l||void 0===d?null:{start:l+t,end:d+t,payload:o}}},3791:function(e,t,n){"use strict";n.d(t,{U:function(){return s},b:function(){return u}});var r=n(3274),i=n(7714),a=n(6923),o=n(9252);function s(e,t,n,o){for(var s={},u=e.slice(),l=function(){var e=t[d];if(void 0!==e){var l,c;if(e.nodeType===Node.ELEMENT_NODE)for(var f=e,v=0;v<=f.attributes.length-1;v++){var p=f.attributes[v],h=p.name;if("style"===h)l=p.value;else if("region"===h)c=p.value;else{var m=h.substring(4);if((0,i.Z)(u,m)&&(s[m]=p.value,u.splice(v,1),0===u.length))return{v:s}}}if((0,a.Z)(l)){var g=(0,r.Z)(n,(function(e){return e.id===l}));if(void 0!==g)for(var y=0;y<=u.length-1;y++){var _=u[y];if(!(0,a.Z)(s[_])&&(0,a.Z)(g.style[_])){if(s[_]=g.style[_],u.splice(y,1),0===u.length)return{v:s};y--}}}if((0,a.Z)(c)){var b=(0,r.Z)(o,(function(e){return e.id===c}));if(void 0!==b)for(var S=0;S<=u.length-1;S++){var E=u[S];if(!(0,a.Z)(s[E])&&(0,a.Z)(b.style[E])){if(s[E]=b.style[E],u.splice(S,1),0===u.length)return{v:s};S--}}}}},d=0;d<=t.length-1;d++){var c=l();if("object"==typeof c)return c.v}return s}function u(e){if(e.nodeType!==Node.ELEMENT_NODE)return{};for(var t=e,n={},r=0;r<=t.attributes.length-1;r++){var i=t.attributes[r];if((0,o.Z)(i.name,"tts"))n[i.name.substring(4)]=i.value}return n}},6177:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(6923),i=n(5336);function a(e,t){var n=e.exec(t);if(null===n||""===n[0])return null;var r=Number(n[1]);isNaN(r)&&(r=0);var i=Number(n[2]);isNaN(i)&&(i=0);var a=Number(n[3]);isNaN(a)&&(a=0);var o=Number(n[4]);return isNaN(o)&&(o=0),o/1e3+a+60*i+3600*r}var o=function(e,t){return i.gu.test(e)?function(e,t){var n=i.gu.exec(t),r=Number(n[1]),a=Number(n[2]),o=Number(n[3]),s=Number(n[4]),u=Number(n[5]);isNaN(u)&&(u=0);return s+=u/e.subFrameRate,o+=s/e.frameRate,o+60*a+3600*r}(t,e):i.KO.test(e)?a(i.KO,e):i.wf.test(e)?a(i.wf,e):i.jb.test(e)?function(e,t){var n=i.jb.exec(t);return Number(n[1])/e.frameRate}(t,e):i.Du.test(e)?function(e,t){var n=i.Du.exec(t);return Number(n[1])/e.tickRate}(t,e):i.te.test(e)?a(i.te,e):void 0};function s(e,t){var n=e.getAttribute("begin"),i=e.getAttribute("dur"),a=e.getAttribute("end"),s=(0,r.Z)(n)?o(n,t):null,u=(0,r.Z)(i)?o(i,t):null,l=(0,r.Z)(a)?o(a,t):null;if(null==s||null==l&&null==u)throw new Error("Invalid text cue");return{start:s,end:null==l?s+u:l}}},7439:function(e,t,n){"use strict";n.d(t,{Z:function(){return k}});var r=n(959);function i(e){return void 0===e.extent&&void 0===e.origin&&void 0===e.displayAlign&&void 0===e.display&&void 0===e.textAlign&&void 0===e.fontSize}function a(e){e.extent="70% 20%",e.fontSize="1c",e.origin="15% 80%",e.displayAlign="before",e.textAlign="center"}var o,s=n(6177);function u(e,t){(void 0===o&&(o=void 0!==e.classList&&"function"==typeof e.classList.add),o)?e.classList.add(t):(" "+e.className+" ").indexOf(" "+t+" ")<0&&(e.className+=" "+t)}var l=n(6923),d=n(8026),c=n(3791),f=n(1594),v=n(3887),p=n(5336);function h(e,t){var n=t;return(0,l.Z)(t)&&t.trim().endsWith("%")&&(n=t.trim().slice(0,-1),n=(parseInt(n,10)/100).toString()+"em"),"-1px -1px "+n+" "+e+",1px -1px "+n+" "+e+",-1px 1px "+n+" "+e+",1px 1px "+n+" "+e}function m(e){var t;return null!=(t=p.Dq.exec(e))?"rgba("+String(parseInt(t[1],16))+","+String(parseInt(t[2],16))+","+String(parseInt(t[3],16))+","+String(parseInt(t[4],16)/255)+")":null!=(t=p.YU.exec(e))?"rgba("+String(parseInt(t[1]+t[1],16))+","+String(parseInt(t[2]+t[2],16))+","+String(parseInt(t[3]+t[3],16))+","+String(parseInt(t[4]+t[4],16)/255)+")":null!=(t=p.GK.exec(e))?"rgb("+String(+t[1])+","+String(+t[2])+","+String(+t[3])+")":null!=(t=p.ev.exec(e))?"rgba("+String(+t[1])+","+String(+t[2])+","+String(+t[3])+","+String(+t[4]/255)+")":e}var g=["color","direction","display","fontFamily","fontSize","fontStyle","fontWeight","textDecoration","textOutline","unicodeBidi","visibility","wrapOption"];function y(e,t,n){var r=t.color;(0,l.Z)(r)&&(e.style.color=m(r));var i=t.backgroundColor;(0,l.Z)(i)&&(e.style.backgroundColor=m(i));var a=t.textOutline;if((0,l.Z)(a)){var o=a.trim().replace(/\s+/g," ").split(" "),s=o.length;if(3===s){var d=m(o[0]),c=o[1];e.style.textShadow=h(d,c)}else if((0,l.Z)(r)&&1===s){var f=o[0];e.style.textShadow=h(r,f)}else if(2===s){var g=/^[#A-Z]/i.test(o[0]);if(g!==/^[0-9]/.test(o[0]))if(g){var y=m(o[0]),_=o[1];e.style.textShadow=h(y,_)}else if((0,l.Z)(r)){var b=o[0];e.style.textShadow=h(r,b)}}}var S=t.textDecoration;if((0,l.Z)(S))switch(S){case"noUnderline":case"noLineThrough":case"noOverline":e.style.textDecoration="none";break;case"lineThrough":e.style.textDecoration="line-through";break;default:e.style.textDecoration=S}var E=t.fontFamily;if((0,l.Z)(E))switch(E){case"proportionalSansSerif":e.style.fontFamily="Arial, Helvetica, Liberation Sans, sans-serif";break;case"monospaceSansSerif":case"sansSerif":e.style.fontFamily="sans-serif";break;case"monospaceSerif":case"default":e.style.fontFamily="Courier New, Liberation Mono, monospace";break;case"proportionalSerif":e.style.fontFamily="serif";break;default:e.style.fontFamily=E}var T=t.fontStyle;(0,l.Z)(T)&&(e.style.fontStyle=T);var k=t.fontWeight;(0,l.Z)(k)&&(e.style.fontWeight=k);var w=t.fontSize;(0,l.Z)(w)?function(e,t){var n=t.trim().split(" ");if(0!==n.length){var r=p.eT.exec(n[0]);if(null!==r)if("px"===r[2]||"em"===r[2])e.style.fontSize=r[1]+r[2];else if("c"===r[2])e.style.position="relative",u(e,"proportional-style"),e.setAttribute("data-proportional-font-size",r[1]);else if("%"===r[2]){var i=Number(r[1]);isNaN(i)?v.Z.warn('TTML Parser: could not parse fontSize value "'+r[1]+'" into a number'):(e.style.position="relative",u(e,"proportional-style"),e.setAttribute("data-proportional-font-size",String(i/100)))}else v.Z.warn("TTML Parser: unhandled fontSize unit:",r[2])}}(e,w):(u(e,"proportional-style"),e.setAttribute("data-proportional-font-size","1"));var A=t.direction;(0,l.Z)(A)&&(e.style.direction=A);var I=t.unicodeBidi;if((0,l.Z)(I))switch(I){case"bidiOverride":e.style.unicodeBidi="bidi-override";break;case"embed":e.style.unicodeBidi="embed";break;default:e.style.unicodeBidi="normal"}var R=t.visibility;(0,l.Z)(R)&&(e.style.visibility=R),"none"===t.display&&(e.style.display="none");var Z=t.wrapOption;e.style.whiteSpace="noWrap"===Z?n?"nowrap":"pre":n?"normal":"pre-wrap"}function _(e,t){e.style.color="white",e.style.position="absolute";var n=t.extent;(0,l.Z)(n)&&function(e,t){var n=t.trim();if("auto"!==n){var r=n.split(" ");if(2===r.length){var i=p.eT.exec(r[0]),a=p.eT.exec(r[1]);null!==i&&null!==a&&("px"===i[2]||"%"===i[2]||"em"===i[2]?e.style.width=i[1]+i[2]:"c"===i[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-width",i[1])):v.Z.warn("TTML Parser: unhandled extent unit:",i[2]),"px"===a[2]||"%"===a[2]||"em"===a[2]?e.style.height=a[1]+a[2]:"c"===a[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-height",a[1])):v.Z.warn("TTML Parser: unhandled extent unit:",a[2]))}}}(e,n);var r=t.writingMode;(0,l.Z)(r);var i=t.overflow;e.style.overflow=(0,l.Z)(i)?i:"hidden";var a=t.padding;(0,l.Z)(a)&&function(e,t){var n=t.trim().split(" ");if(!(n.length<1)){var r=p.eT.exec(n[0]);if(null!==r){if("px"===r[2]||"%"===r[2]||"em"===r[2]){var i=r[1]+r[2];1===n.length?e.style.padding=i:2===n.length?(e.style.paddingTop=i,e.style.paddingBottom=i):e.style.paddingTop=i}else"c"===r[2]?(u(e,"proportional-style"),1===n.length?(e.setAttribute("data-proportional-padding-top",r[1]),e.setAttribute("data-proportional-padding-bottom",r[1]),e.setAttribute("data-proportional-padding-left",r[1]),e.setAttribute("data-proportional-padding-right",r[1])):2===n.length?(e.setAttribute("data-proportional-padding-top",r[1]),e.setAttribute("data-proportional-padding-bottom",r[1])):e.setAttribute("data-proportional-padding-top",r[1])):v.Z.warn("TTML Parser: unhandled padding unit:",r[2]);if(1!==n.length){var a=p.eT.exec(n[1]);if(null!==a){if("px"===a[2]||"%"===a[2]||"em"===a[2]){var o=a[1]+a[2];n.length<4?(e.style.paddingLeft=o,e.style.paddingRight=o):e.style.paddingRight=o}else"c"===a[2]?(u(e,"proportional-style"),n.length<4?(e.setAttribute("data-proportional-padding-left",a[1]),e.setAttribute("data-proportional-padding-right",a[1])):e.setAttribute("data-proportional-padding-right",a[1])):v.Z.warn("TTML Parser: unhandled padding unit:",a[2]);if(2!==n.length){var s=p.eT.exec(n[2]);if(null!==s){if("px"===s[2]||"%"===s[2]||"em"===s[2]){var l=s[1]+s[2];e.style.paddingBottom=l}else"c"===s[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-padding-bottom",s[1])):v.Z.warn("TTML Parser: unhandled padding unit:",s[2]);if(3!==n.length){var d=p.eT.exec(n[3]);if(null!==d)if("px"===d[2]||"%"===d[2]||"em"===d[2]){var c=d[1]+d[2];e.style.paddingLeft=c}else"c"===d[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-padding-left",d[1])):v.Z.warn("TTML Parser: unhandled padding unit:",d[2])}}}}}}}}(e,a);var o=t.origin;(0,l.Z)(o)&&function(e,t){var n=t.trim();if("auto"!==n){var r=n.split(" ");if(2===r.length){var i=p.eT.exec(r[0]),a=p.eT.exec(r[1]);null!==i&&null!==a&&("px"===i[2]||"%"===i[2]||"em"===i[2]?e.style.left=i[1]+i[2]:"c"===i[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-left",i[1])):v.Z.warn("TTML Parser: unhandled origin unit:",i[2]),"px"===a[2]||"%"===a[2]||"em"===a[2]?e.style.top=a[1]+a[2]:"c"===a[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-top",a[1])):v.Z.warn("TTML Parser: unhandled origin unit:",a[2]))}}}(e,o);var s=t.displayAlign;if((0,l.Z)(s))switch(e.style.display="flex",e.style.flexDirection="column",s){case"before":e.style.justifyContent="flex-start";break;case"center":e.style.justifyContent="center";break;case"after":e.style.justifyContent="flex-end"}var d=t.opacity;(0,l.Z)(d)&&(e.style.opacity=d);var c=t.visibility;(0,l.Z)(c)&&(e.style.visibility=c),"none"===t.display&&(e.style.display="none")}function b(e,t){e.style.margin="0px",u(e,"proportional-style"),e.setAttribute("data-proportional-font-size","1");var n=t.backgroundColor;(0,l.Z)(n)&&(e.style.backgroundColor=m(n));var r=t.lineHeight;(0,l.Z)(r)&&function(e,t){var n=t.trim();if("auto"!==n){var r=p.eT.exec(n[0]);null!==r&&("px"===r[2]||"%"===r[2]||"em"===r[2]?e.style.lineHeight=r[1]+r[2]:"c"===r[2]?(u(e,"proportional-style"),e.setAttribute("data-proportional-line-height",r[1])):v.Z.warn("TTML Parser: unhandled lineHeight unit:",r[2]))}}(e,r);var i=t.textAlign;if((0,l.Z)(i))switch(i){case"center":e.style.textAlign="center";break;case"left":case"start":e.style.textAlign="left";break;case"right":case"end":e.style.textAlign="right"}}function S(e,t,n){var r=document.createElement("span"),i=null===e.textContent?"":e.textContent;if(n){var a=i.trim();i=a=a.replace(/\s+/g," ")}var o=document.createTextNode(i);return r.appendChild(o),r.className="rxp-texttrack-span",y(r,t,n),r}function E(e,t,n,r,i,a){var o=a.cellResolution,s=a.shouldTrimWhiteSpace,u=(0,f.jF)(e),v=document.createElement("DIV");if(v.className="rxp-texttrack-region",v.setAttribute("data-resolution-columns",String(o.columns)),v.setAttribute("data-resolution-rows",String(o.rows)),_(v,i),null!==t){var p=(0,c.U)(["backgroundColor"],[].concat(u,[t]),r,n).bodyBackgroundColor;(0,l.Z)(p)&&(v.style.backgroundColor=m(p))}var h=document.createElement("p");h.className="rxp-texttrack-p",b(h,i);for(var y=function(e,t,n,r,i){return function e(r,i,a,o){for(var s=r.childNodes,u=[],v=0;v<s.length;v++){var p=s[v];if("#text"===p.nodeName){var h=(0,c.U)(["backgroundColor"],a,n,t).backgroundColor;(0,l.Z)(h)?i.backgroundColor=h:delete i.backgroundColor;var m=S(p,i,o);u.push(m)}else if((0,f.OE)(p)){var y=document.createElement("BR");u.push(y)}else if((0,f.jg)(p)&&p.nodeType===Node.ELEMENT_NODE&&p.childNodes.length>0){var _=p.getAttribute("xml:space"),b=(0,l.Z)(_)?"default"===_:o,E=(0,d.Z)({},i,(0,c.U)(g,[p],n,t));u.push.apply(u,e(p,E,[p].concat(a),b))}}return u}(e,(0,d.Z)({},r),[],i)}(e,n,r,i,s),E=0;E<y.length;E++)h.appendChild(y[E]);return v.appendChild(h),v}function T(e){var t=e.paragraph,n=e.ttParams,r=e.body,i=e.regionStyles,a=e.idStyles,o=e.paragraphStyle,u=e.timeOffset,l=e.shouldTrimWhiteSpace;if(!t.hasAttribute("begin")&&!t.hasAttribute("end")&&/^\s*$/.test(null===t.textContent?"":t.textContent))return null;var d=n.cellResolution,c=(0,s.Z)(t,n);return{start:c.start+u,end:c.end+u,element:E(t,r,i,a,o,{cellResolution:d,shouldTrimWhiteSpace:l})}}var k=function(e,t){for(var n=(0,r.Z)(e,t),o=[],s=0;s<n.length;s++){var u=n[s].paragraphStyle;i(u)&&a(u);var l=T(n[s]);null!==l&&o.push(l)}return o}},1570:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var r=n(959),i=n(7253),a=n(1988),o=n(6923),s=n(6177),u=n(5336),l=n(1594),d={left:"start",center:"center",right:"end",start:"start",end:"end"},c={left:"line-left",center:"center",right:"line-right"};function f(e){var t=e.paragraph,n=e.timeOffset,r=e.paragraphStyle,f=e.ttParams,v=e.shouldTrimWhiteSpace;if(!t.hasAttribute("begin")&&!t.hasAttribute("end")&&/^\s*$/.test(null===t.textContent?"":t.textContent))return null;var p=(0,s.Z)(t,f),h=p.start,m=p.end,g=function(e,t){function n(e,t){for(var r=e.childNodes,i="",a=0;a<r.length;a++){var s=r[a];if("#text"===s.nodeName){var u=s.textContent;if(null===u&&(u=""),t){var d=u.trim();u=d=d.replace(/\s+/g," ")}i+=u.replace(/&|\u0026/g,"&amp;").replace(/<|\u003C/g,"&lt;").replace(/>|\u2265/g,"&gt;").replace(/\u200E/g,"&lrm;").replace(/\u200F/g,"&rlm;").replace(/\u00A0/g,"&nbsp;")}else if((0,l.OE)(s))i+="\n";else if((0,l.jg)(s)&&s.nodeType===Node.ELEMENT_NODE&&s.childNodes.length>0){var c=s.getAttribute("xml:space");i+=n(s,(0,o.Z)(c)?"default"===c:t)}}return i}return n(e,t)}(t,v),y=(0,i.Z)(h+n,m+n,g);return null===y?null:((0,a.Z)(y)&&function(e,t){var n=t.extent;if((0,o.Z)(n)){var r=u._0.exec(n);null!=r&&(e.size=Number(r[1]))}switch(t.writingMode){case"tb":case"tblr":e.vertical="lr";break;case"tbrl":e.vertical="rl"}var i=t.origin;if((0,o.Z)(i))u._0.exec(i);var a=t.align;if((0,o.Z)(a)){e.align=a,"center"===a&&("center"!==e.align&&(e.align="middle"),e.position="auto");var s=c[a];e.positionAlign=void 0===s?"":s;var l=d[a];e.lineAlign=void 0===l?"":l}}(y,r),y)}var v=function(e,t){for(var n=(0,r.Z)(e,t),i=[],a=0;a<n.length;a++){var o=f(n[a]);null!==o&&i.push(o)}return i}},959:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var r=n(3274),i=n(6923),a=n(8026),o=n(3887),s=/(\d+) (\d+)/;var u=n(3791),l=n(5138),d=n(7714);var c=n(1594),f=["align","backgroundColor","color","direction","display","displayAlign","extent","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","opacity","origin","overflow","padding","textAlign","textDecoration","textOutline","unicodeBidi","visibility","wrapOption","writingMode"];function v(e,t){var n=[],v=(new DOMParser).parseFromString(e,"text/xml");if(null!=v){var p=v.getElementsByTagName("tt")[0];if(void 0===p)if(void 0===(p=v.getElementsByTagNameNS("*","tt")[0]))throw new Error("invalid XML");for(var h=(0,c.H)(p),m=(0,c.vU)(p),g=(0,c.DM)(p),y=(0,c.kd)(p),_=function(e){var t=e.getAttribute("ttp:frameRate"),n=e.getAttribute("ttp:subFramRate"),r=e.getAttribute("ttp:tickRate"),a=e.getAttribute("ttp:frameRateMultiplier"),u=e.getAttribute("xml:space"),l=e.getAttribute("ttp:cellResolution"),d={columns:32,rows:15};if(null!==l){var c=s.exec(l);if(null===c||c.length<3)o.Z.warn("TTML Parser: Invalid cellResolution");else{var f=parseInt(c[1],10),v=parseInt(c[2],10);isNaN(f)||isNaN(v)?o.Z.warn("TTML Parser: Invalid cellResolution"):d={columns:f,rows:v}}}if((0,i.Z)(u)&&"default"!==u&&"preserve"!==u)throw new Error("Invalid spacing style");var p=Number(t);(isNaN(p)||p<=0)&&(p=30);var h=Number(n);(isNaN(h)||h<=0)&&(h=1);var m=Number(r);(isNaN(m)||m<=0)&&(m=void 0);var g=p,y=null!=h?h:1,_=null!==u?u:"default",b=void 0!==m?m:p*h;if(null!==a){var S=/^(\d+) (\d+)$/g.exec(a);null!==S&&(g=p*(Number(S[1])/Number(S[2])))}return{cellResolution:d,tickRate:b,frameRate:g,subFrameRate:y,spaceStyle:_}}(p),b=[],S=0;S<=m.length-1;S++){var E=m[S];if(E instanceof Element){var T=E.getAttribute("xml:id");if(null!==T){var k=E.getAttribute("style"),w=null===k?[]:k.split(" ");b.push({id:T,style:(0,u.b)(E),extendsStyles:w})}}}!function(e){var t=[];function n(r,i){t.push(i);for(var s=function(){var i=r.extendsStyles[u],s=(0,l.Z)(e,(function(e){return e.id===i}));if(s<0)o.Z.warn("TTML Parser: unknown style inheritance: "+i);else{var c=e[s];(0,d.Z)(t,s)?o.Z.warn("TTML Parser: infinite style inheritance loop avoided"):n(c,s),r.style=(0,a.Z)({},c.style,r.style)}},u=0;u<r.extendsStyles.length;u++)s();r.extendsStyles.length=0}for(var r=0;r<e.length;r++)n(e[r],r),t.length=0}(b);for(var A=[],I=function(){var e=g[R];if(e instanceof Element){var t=e.getAttribute("xml:id");if(null!==t){var n=(0,u.b)(e),o=e.getAttribute("style");if((0,i.Z)(o)){var s=(0,r.Z)(b,(function(e){return e.id===o}));void 0!==s&&(n=(0,a.Z)({},s.style,n))}A.push({id:t,style:n,extendsStyles:[]})}}},R=0;R<=g.length-1;R++)I();for(var Z=(0,u.U)(f,null!==h?[h]:[],b,A),x="default"===(null!==h?h.getAttribute("xml:space"):void 0)||"default"===_.spaceStyle,P=0;P<y.length;P++){var M=y[P];if(M instanceof Element){var C=(0,c.jF)(M),D=(0,a.Z)({},Z,(0,u.U)(f,[M].concat(C),b,A)),N=M.getAttribute("xml:space"),O=(0,i.Z)(N)?"default"===N:x,L={paragraph:M,timeOffset:t,idStyles:b,regionStyles:A,body:h,paragraphStyle:D,ttParams:_,shouldTrimWhiteSpace:O};null!==L&&n.push(L)}}}return n}},5336:function(e,t,n){"use strict";n.d(t,{Dq:function(){return c},Du:function(){return s},GK:function(){return v},KO:function(){return i},YU:function(){return f},_0:function(){return l},eT:function(){return d},ev:function(){return p},gu:function(){return r},jb:function(){return o},te:function(){return u},wf:function(){return a}});var r=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,i=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,a=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,o=/^(\d*\.?\d*)f$/,s=/^(\d*\.?\d*)t$/,u=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,l=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,d=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%|rh|rw)$/,c=/^#([0-9A-f]{2})([0-9A-f]{2})([0-9A-f]{2})([0-9A-f]{2})$/,f=/^#([0-9A-f])([0-9A-f])([0-9A-f])([0-9A-f])$/,v=/^rgb\( *(\d+) *, *(\d+) *, *(\d+) *\)/,p=/^rgba\( *(\d+) *, *(\d+) *, *(\d+) *, *(\d+) *\)/},1594:function(e,t,n){"use strict";function r(e,t){if(!(e.parentNode instanceof Element))return[];return function e(n){var r=[];n.tagName.toLowerCase()===t.toLowerCase()&&r.push(n);var i=n.parentNode;return i instanceof Element&&r.push.apply(r,e(i)),r}(e.parentNode)}function i(e){var t=r(e,"div");if(0===t.length){var n=r(e,"tt:div");n.length>0&&(t=n)}return t}function a(e){var t=e.getElementsByTagName("body");if(t.length>0)return t[0];var n=e.getElementsByTagName("tt:body");return n.length>0?n[0]:null}function o(e){var t=e.getElementsByTagName("style");if(t.length>0)return t;var n=e.getElementsByTagName("tt:style");return n.length>0?n:t}function s(e){var t=e.getElementsByTagName("region");if(t.length>0)return t;var n=e.getElementsByTagName("tt:region");return n.length>0?n:t}function u(e){var t=e.getElementsByTagName("p");if(t.length>0)return t;var n=e.getElementsByTagName("tt:p");return n.length>0?n:t}function l(e){return"br"===e.nodeName||"tt:br"===e.nodeName}function d(e){return"span"===e.nodeName||"tt:span"===e.nodeName}n.d(t,{DM:function(){return s},H:function(){return a},OE:function(){return l},jF:function(){return i},jg:function(){return d},kd:function(){return u},vU:function(){return o}})},1138:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923),i=n(360);function a(e,t){for(var n=[],a=t;a<e.length;a++)if((0,i.tq)(e,a)){var o=(0,i.$4)(e,a);n.push(e.slice(a,o)),a=o}else if((0,r.Z)(e[a]))for(;(0,r.Z)(e[a]);)a++;return n}},4099:function(e,t,n){"use strict";n.d(t,{Z:function(){return I}});var r=n(1138),i=n(6923),a=n(360);var o=n(9525),s={white:"#ffffff",lime:"#00ff00",cyan:"#00ffff",red:"#ff0000",yellow:"#ffff00",magenta:"#ff00ff",blue:"#0000ff",black:"#000000"};function u(e){var t=Object.keys(s).reduce((function(e,t){return e[t]="color: "+s[t]+";",e["bg_"+t]="background-color: "+s[t]+";",e}),{}),n="";return e.forEach((function(e){if(e.length>=2)for(var r=function(r){var o=e[r];if(Array.isArray(/::cue {/.exec(o)))for(o=e[++r];(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)n+=o,o=e[++r];else{for(var s=[],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);(0,i.Z)(o)&&Array.isArray(u);)s.push(u[1]),o=e[++r],u=/::cue\(\.?(.*?)\)(?:,| {)/.exec(o);for(var l="";(0,i.Z)(o)&&!Array.isArray(/}/.exec(o))&&0!==o.length;)l+=o,o=e[++r];s.forEach((function(e){void 0===t[e]?t[e]=l:t[e]+=l}))}a=r},a=1;a<e.length;a++)r(a)})),{classes:t,global:n}}var l=n(7714);function d(e,t){var n,r=["u","i","b"],a=e.nodeName.toLowerCase().split(".")[0];if((0,l.Z)(["u","i","b","c","#text"],a))if("#text"===a){var o=e.wholeText.split("\n");n=document.createElement("span");for(var s=0;s<o.length;s++)if(s>0&&n.appendChild(document.createElement("br")),o[s].length>0){var u=document.createTextNode(o[s]);n.appendChild(u)}}else{var c=e.nodeName.toLowerCase().split("."),f=[];if(c.forEach((function(e){(0,i.Z)(t[e])&&f.push(t[e])})),0!==f.length){var v=document.createAttribute("style");f.forEach((function(e){v.value+=e}));var p=(0,l.Z)(r,a)?a:"span";(n=document.createElement(p)).setAttributeNode(v)}else{var h=(0,l.Z)(r,a)?a:"span";n=document.createElement(h)}for(var m=0;m<e.childNodes.length;m++){var g=d(e.childNodes[m],t);n.appendChild(g)}}else{n=document.createElement("span");for(var y=0;y<e.childNodes.length;y++){var _=d(e.childNodes[y],t);n.appendChild(_)}}return n}var c=n(1679);var f,v,p,h=function(e){if(!(void 0!==e&&0!==(0,c.Z)(e).length))return"text-align:center";var t=m(e),n=_(e);return"position: absolute;margin: 0;transform: translate("+t.offset+"%,"+n.offset+"%);width: "+T(e.size)+"%;left: "+t.position+"%;top: "+(null!==n.position?n.position+"%":"auto")+";text-align: "+E(e.align)+";"};!function(e){e.LINE_LEFT="line-left",e.CENTER="center",e.LINE_RIGHT="line-right"}(f||(f={})),function(e){e.LEFT="left",e.CENTER="center",e.RIGHT="right"}(v||(v={})),function(e){e.START="start",e.CENTER="center",e.END="end"}(p||(p={}));var m=function(e){return{position:g(e),offset:y(e)}},g=function(e){var t,n=w(e.position);if(null!==n)return n;var r=E(e.align);return((t={})[v.LEFT]=0,t[v.CENTER]=50,t[v.RIGHT]=100,t)[r]},y=function(e){var t,n,r,i,a=((t={})[f.LINE_LEFT]=0,t[f.CENTER]=-50,t[f.LINE_RIGHT]=-100,t),o=void 0!==e.position?(r=e.position,i=/,(line-left|line-right|center)/.exec(r),!Array.isArray(i)||i.length<2?null:i[1]):null;return null!==o?a[o]:((n={})[v.LEFT]=0,n[v.CENTER]=-50,n[v.RIGHT]=-100,n)[void 0!==e.align?E(e.align):v.CENTER]},_=function(e){return{position:b(e.line),offset:S(e.line)}},b=function(e){return w(e)},S=function(e){var t,n=((t={})[p.START]=0,t[p.CENTER]=-50,t[p.END]=-100,t);if(void 0===e)return n[p.START];var r,i=(r=/,(start|center|end)/.exec(e),!Array.isArray(r)||r.length<2?null:r[1]);return null!==i?n[i]:n[p.START]},E=function(e){switch(e){case"left":case"start":return"left";case"right":case"end":return"right";default:return"center"}},T=function(e){return k(e,100)},k=function(e,t){var n=w(e);return null!==n?n:t},w=function(e){if(void 0===e)return null;var t=/^([\d.]+)%/.exec(e);return!Array.isArray(t)||t.length<2?null:parseInt(t[1],10)};function A(e,t){var n=e.start,r=e.end,a=e.settings,o=e.header,s=e.payload,u=document.createElement("div"),l=document.createAttribute("style");l.value="width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;",u.setAttributeNode(l);var c=document.createElement("p"),f=function(e){var t=document.createAttribute("style");return t.value=h(e),t}(a);c.setAttributeNode(f);var v=document.createElement("span"),p=document.createAttribute("style");p.value="background-color:rgba(0,0,0,0.8);color:white;",v.setAttributeNode(p);var m=t.global,g=t.classes,y=[m,(0,i.Z)(o)?g[o]:void 0].filter((function(e){return void 0!==e})).join("");return p.value+=y,v.setAttributeNode(p),function(e,t){for(var n=e.replace(/<[0-9]{2}:[0-9]{2}.[0-9]{3}>/,"").replace(/<([u,i,b,c])(\..*?)?(?: .*?)?>(.*?)<\/\1>/g,"<$1$2>$3</$1$2>"),r=(new DOMParser).parseFromString(n,"text/html").body.childNodes,i=[],a=0;a<r.length;a++)i.push(d(r[a],t));return i}(s.join("\n"),g).forEach((function(e){v.appendChild(e)})),u.appendChild(c),c.appendChild(v),{start:n,end:r,element:u}}var I=function(e,t){var n=e.split(/\r\n|\n|\r/g),s=[];if(null===/^WEBVTT( |\t|\n|\r|$)/.exec(n[0]))throw new Error("Can't parse WebVTT: Invalid File.");for(var l=(0,a.yE)(n),d=function(e,t){for(var n=[],r=t;r<e.length;r++)if((0,a.JF)(e,r)){var o=r;for(r++;(0,i.Z)(e[r]);)r++;var s=e.slice(o,r);n.push(s)}else if((0,i.Z)(e[r]))for(;(0,i.Z)(e[r]);)r++;return n}(n,l),c=(0,r.Z)(n,l),f=u(d),v=0;v<c.length;v++){var p=(0,o.Z)(c[v],t);if(null!=p){var h=A(p,f);s.push(h)}}return s}},9405:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(1988),i=n(1138),a=n(9525),o=n(360),s=n(7714),u=n(6923);function l(e,t){if(!(0,u.Z)(e.vertical)||"rl"!==e.vertical&&"lr"!==e.vertical||(t.vertical=e.vertical),(0,u.Z)(e.line)){var n=/^(\d+(\.\d+)?)%(,([a-z]+))?/.exec(e.line);if(Array.isArray(n))t.line=Number(n[1]),t.snapToLines=!1,(0,s.Z)(["start","center","end"],n[4])&&(t.lineAlign=n[4]);else{var r=/^(-?\d+)(,([a-z]+))?/.exec(e.line);Array.isArray(r)&&(t.line=Number(r[1]),t.snapToLines=!0,(0,s.Z)(["start","center","end"],r[3])&&(t.lineAlign=r[3]))}}if((0,u.Z)(e.position)){var i=/^([\d\.]+)%(?:,(line-left|line-right|center))?$/.exec(e.position);if(Array.isArray(i)&&i.length>=2){var a=parseInt(i[1],10);isNaN(a)||(t.position=a,void 0!==i[2]&&(t.positionAlign=i[2]))}}(0,u.Z)(e.size)&&(t.size=e.size),"string"==typeof e.align&&(0,s.Z)(["start","center","end","left"],e.align)&&(t.align=e.align)}var d=n(7253);var c=function(e,t){var n=e.split(/\r\n|\n|\r/);if(!/^WEBVTT($| |\t)/.test(n[0]))throw new Error("Can't parse WebVTT: Invalid file.");for(var s,u,c,f,v=(0,o.yE)(n),p=(0,i.Z)(n,v),h=[],m=0;m<p.length;m++){var g=(0,a.Z)(p[m],t);if(null!=g){var y=(u=void 0,c=void 0,f=void 0,u=(s=g).start,c=s.end,f=s.payload.join("\n"),(0,d.Z)(u,c,f));null!=y&&((0,r.Z)(y)&&l(g.settings,y),h.push(y))}}return h}},9525:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(6923);function i(e){var t=e.split(":").reverse();if((0,r.Z)(t[2])||(0,r.Z)(t[1])){var n=(0,r.Z)(t[2])?parseInt(t[2],10):0,i=parseInt(t[1],10),a=parseFloat(t[0].replace(",","."));if(isNaN(n)||isNaN(i)||isNaN(a))return;return 60*n*60+60*i+a}}function a(e,t){var n,r,a,o=/-->/;if(o.test(e[0]))n=e[0],r=e.slice(1,e.length);else{if(!o.test(e[1]))return null;a=e[0],n=e[1],r=e.slice(2,e.length)}var s=function(e){var t=/^([\d:.]+)[ |\t]+-->[ |\t]+([\d:.]+)[ |\t]*(.*)$/.exec(e);if(null===t)return null;var n=i(t[1]),r=i(t[2]);return null==n||null==r?null:{start:n,end:r,settings:t[3].split(/ |\t/).reduce((function(e,t){var n=t.split(":");return 2===n.length&&(e[n[0]]=n[1]),e}),{})}}(n);return null===s?null:{start:s.start+t,end:s.end+t,settings:s.settings,payload:r,header:a}}},360:function(e,t,n){"use strict";n.d(t,{$4:function(){return s},JF:function(){return a},tq:function(){return o},yE:function(){return i}});var r=n(6923);function i(e){for(var t=0;t<e.length;){if(""===e[t])return t+1;t++}return t}function a(e,t){return"string"==typeof e[t]&&/^STYLE( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}function o(e,t){var n=e[t];if(void 0===n||""===n||a(e,t)||function(e,t){return"string"==typeof e[t]&&/^REGION( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}(e,t)||function(e,t){return"string"==typeof e[t]&&/^NOTE( .*)?$/g.test(e[t])&&(void 0===e[t+1]||e[t+1].indexOf("--\x3e")<0)}(e,t))return!1;if(n.indexOf("--\x3e")>=0)return!0;var r=e[t+1];return void 0!==r&&r.indexOf("--\x3e")>=0}function s(e,t){for(var n=t+1;(0,r.Z)(e[n]);)n++;return n}},2047:function(e,t,n){"use strict";n.d(t,{Z:function(){return ue}});var r=n(7874),i=n(8791),a=n(6872),o=n(8750),s=n(3887),u=n(8619),l=n(8026),d=n(4597),c=n(3635);function f(e){var t=e.referenceDateTime,n=void 0!==e.serverSyncInfos?e.serverSyncInfos.serverTimestamp-e.serverSyncInfos.clientTime:void 0;return function(i,f,v,p,h){var m,g=i.responseData,y=f.externalClockOffset,_=null!==(m=i.url)&&void 0!==m?m:f.originalUrl,b=null!=n?n:y,S={unsafelyBaseOnPreviousManifest:f.unsafeMode?f.previousManifest:null,url:_,referenceDateTime:t,externalClockOffset:b},E=r.Z.dashParsers;if(null===E.wasm||"uninitialized"===E.wasm.status||"failure"===E.wasm.status)return s.Z.debug("DASH: WASM MPD Parser not initialized. Running JS one."),k();var T=function(e){if(e instanceof ArrayBuffer)return e;if("string"==typeof e)return(0,c.tG)(e).buffer;if(e instanceof Document)return(0,c.tG)(e.documentElement.innerHTML).buffer;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(g);return function(e){var t=new DataView(e);if(61371===t.getUint16(0)&&191===t.getUint8(2))return!0;if(65279===t.getUint16(0)||65534===t.getUint16(0))return!1;return!0}(T)?"initialized"===E.wasm.status?(s.Z.debug("DASH: Running WASM MPD Parser."),w(E.wasm.runWasmParser(T,S))):(s.Z.debug("DASH: Awaiting WASM initialization before parsing the MPD."),E.wasm.waitForInitialization().catch((function(){})).then((function(){return null===E.wasm||"initialized"!==E.wasm.status?(s.Z.warn("DASH: WASM MPD parser initialization failed. Running JS parser instead"),k()):(s.Z.debug("DASH: Running WASM MPD Parser."),w(E.wasm.runWasmParser(T,S)))}))):(s.Z.info("DASH: MPD doesn't seem to be UTF-8-encoded. Running JS parser instead of the WASM one."),k());function k(){if(null===E.js)throw new Error("No MPD parser is imported");var e=function(e){if(e instanceof ArrayBuffer)return(new DOMParser).parseFromString((0,c.uR)(new Uint8Array(e)),"text/xml");if("string"==typeof e)return(new DOMParser).parseFromString(e,"text/xml");if(e instanceof Document)return e;throw new Error("DASH Manifest Parser: Unrecognized Manifest format")}(g);return w(E.js(e,S))}function w(t){if("done"===t.type)return t.value.warnings.length>0&&v(t.value.warnings),p.isCancelled()?Promise.reject(p.cancellationError):{manifest:new u.ZP(t.value.parsed,e),url:_};var n=t.value,r=n.urls.map((function(e){return h((function(){var t=a.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT;return"string"===n.format?(0,d.ZP)({url:e,responseType:"text",timeout:t,cancelSignal:p}):(0,d.ZP)({url:e,responseType:"arraybuffer",timeout:t,cancelSignal:p})})).then((function(e){if("string"===n.format){if("string"!=typeof e.responseData)throw new Error("External DASH resources should have been a string");return(0,l.Z)(e,{responseData:{success:!0,data:e.responseData}})}if(!(e.responseData instanceof ArrayBuffer))throw new Error("External DASH resources should have been ArrayBuffers");return(0,l.Z)(e,{responseData:{success:!0,data:e.responseData}})}),(function(e){var t=(0,o.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"An unknown error occured when parsing ressources."});return(0,l.Z)({},{size:void 0,requestDuration:void 0,responseData:{success:!1,error:t}})}))}));return Promise.all(r).then((function(e){return n.format,w(n.continue(e))}))}}}var v=n(7839),p=n(5861),h=n(4687),m=n.n(h),g=n(9105),y=n(5992),_=n(1946),b="function"==typeof Headers?Headers:null,S="function"==typeof AbortController?AbortController:null;function E(){return"function"==typeof window.fetch&&!(0,_.Z)(S)&&!(0,_.Z)(b)}var T=n(8806),k=n(281);function w(e,t){return"audio"===e||"video"===e?"video/mp4"===t||"audio/mp4"===t?"mp4":"video/webm"===t||"audio/webm"===t?"webm":void 0:"text"===e&&"application/mp4"===t?"mp4":void 0}var A=n(288),I=n(4460);function R(e){return function(t,n,r,i,a){return new Promise((function(s,u){var l=new A.ZP,d=l.linkToSignal(i);function c(){l.signal.deregister(u),d()}l.signal.register(u),e(t,n,r,l.signal,Object.assign(Object.assign({},a),{onNewChunk:function(e){try{o(e),a.onNewChunk(e)}catch(e){c(),l.cancel(),u(e)}}})).then((function(e){if(c(),!l.isUsed()){if("segment-loaded"===e.resultType)try{o(e.resultData.responseData)}catch(e){return void u(e)}s(e)}}),(function(e){c(),u(e)}))}));function o(e){(e instanceof ArrayBuffer||e instanceof Uint8Array)&&"mp4"===w(n.type,n.mimeType)&&(0,I.Z)(new Uint8Array(e),n.segment.isInit)}}}var Z=n(9829);function x(e,t){return null===e?null:null===t.url?e.baseUrl:(0,Z.Z)(e.baseUrl,t.url)}var P=n(6968);function M(e,t,n,r,i){if(void 0===t.range)return(0,d.ZP)({url:e,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(void 0===t.indexRange)return(0,d.ZP)({url:e,headers:{Range:(0,k.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));if(t.range[1]+1===t.indexRange[0])return(0,d.ZP)({url:e,headers:{Range:(0,k.Z)([t.range[0],t.indexRange[1]])},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}));var a=(0,d.ZP)({url:e,headers:{Range:(0,k.Z)(t.range)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress}),o=(0,d.ZP)({url:e,headers:{Range:(0,k.Z)(t.indexRange)},responseType:"arraybuffer",timeout:n.timeout,cancelSignal:r,onProgress:i.onProgress});return Promise.all([a,o]).then((function(t){var n=t[0],r=t[1],i=(0,P.zo)(new Uint8Array(n.responseData),new Uint8Array(r.responseData)),a=Math.min(n.sendingTime,r.sendingTime),o=Math.max(n.receivedTime,r.receivedTime);return{resultType:"segment-loaded",resultData:{url:e,responseData:i,size:n.size+r.size,requestDuration:o-a,sendingTime:a,receivedTime:o}}}))}var C=n(8766);function D(e,t,n,r,i){var a=t.segment,o=void 0!==a.range?{Range:(0,k.Z)(a.range)}:void 0,u=null;return function(e){var t;if(!(0,_.Z)(e.headers))if((0,_.Z)(b))t=e.headers;else{t=new b;for(var n=Object.keys(e.headers),r=0;r<n.length;r++){var i=n[r];t.append(i,e.headers[i])}}s.Z.debug("Fetch: Called with URL",e.url);var a,o=null,u=!1,l=performance.now(),d=(0,_.Z)(S)?null:new S;function c(){(0,_.Z)(d)?s.Z.warn("Fetch: AbortController API not available."):d.abort()}void 0!==e.timeout&&(a=window.setTimeout((function(){u=!0,c()}),e.timeout));var f=e.cancelSignal.register((function(e){o=e,c()})),v={method:"GET"};return void 0!==t&&(v.headers=t),v.signal=(0,_.Z)(d)?null:d.signal,fetch(e.url,v).then((function(t){if((0,_.Z)(a)||clearTimeout(a),t.status>=300)throw s.Z.warn("Fetch: Request HTTP Error",t.status,t.url),new g.Z(t.url,t.status,y.br.ERROR_HTTP_CODE);if((0,_.Z)(t.body))throw new g.Z(t.url,t.status,y.br.PARSE_ERROR);var n=t.headers.get("Content-Length"),r=(0,_.Z)(n)||isNaN(+n)?void 0:+n,i=t.body.getReader(),o=0;return u();function u(){return d.apply(this,arguments)}function d(){return(d=(0,p.Z)(m().mark((function n(){var a,s,d,c,v;return m().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.read();case 2:if((a=n.sent).done||(0,_.Z)(a.value)){n.next=11;break}return o+=a.value.byteLength,s=performance.now(),d={url:t.url,currentTime:s,duration:s-l,sendingTime:l,chunkSize:a.value.byteLength,chunk:a.value.buffer,size:o,totalSize:r},e.onData(d),n.abrupt("return",u());case 11:if(!a.done){n.next=16;break}return f(),c=performance.now(),v=c-l,n.abrupt("return",{requestDuration:v,receivedTime:c,sendingTime:l,size:o,status:t.status,url:t.url});case 16:return n.abrupt("return",u());case 17:case"end":return n.stop()}}),n)})))).apply(this,arguments)}})).catch((function(t){if(null!==o)throw o;if(f(),u)throw s.Z.warn("Fetch: Request timeouted."),new g.Z(e.url,0,y.br.TIMEOUT);if(t instanceof g.Z)throw t;throw s.Z.warn("Fetch: Request Error",t instanceof Error?t.toString():""),new g.Z(e.url,0,y.br.ERROR_EVENT)}))}({url:e,headers:o,onData:function(e){var t=new Uint8Array(e.chunk),n=function(e){for(var t=0,n=[];t<e.length;){var r=e.subarray(t,1/0),i=(0,C.Z)(r,1836019558);if(i<0)return[n,r];var a=t+i+(0,P.pX)(e,i+t);if(a>e.length)return[n,r];var o=(0,C.Z)(r,1835295092);if(o<0)return[n,r];var s=t+o+(0,P.pX)(e,o+t);if(s>e.length)return[n,r];var u=Math.max(a,s),l=e.subarray(t,u);n.push(l),t=u}return[n,null]}(null!==u?(0,P.zo)(u,t):t),a=n[0];u=n[1];for(var o=0;o<a.length;o++)if(r.onNewChunk(a[o]),i.isCancelled())return;r.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize}),i.isCancelled()},timeout:n.timeout,cancelSignal:i}).then((function(e){return{resultType:"chunk-complete",resultData:e}}))}function N(e,t,n,r,i,a){if(t.segment.isInit)return M(e,t.segment,r,a,i);var o=w(t.type,t.mimeType);if(n&&("mp4"===o||void 0===o)){if(E())return D(e,t,r,i,a);(0,T.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}var s=t.segment;return(0,d.ZP)({url:e,responseType:"arraybuffer",headers:void 0!==s.range?{Range:(0,k.Z)(s.range)}:void 0,timeout:r.timeout,cancelSignal:a,onProgress:i.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}var O=n(6490),L=n(4644),U=408125543,B=357149030,F=2807729,z=17545,V=475249515,K=187,G=179,j=183,H=241;function W(e,t,n,r){for(var i=r[0],a=r[1],o=i;o<a;){var s=Q(n,o);if(null==s)return null;var u=s.value,l=o+s.length,d=$(n,l);if(null==d)return null;var c=l+d.length,f=c+d.value;if(u===e)return[c,f];if(t.length>0)for(var v=0;v<t.length;v++){if(u===t[v])return W(e,t.slice(v+1,t.length),n,[c,f])}o=f}return null}function q(e,t){var n=W(F,[U,B],e,[t,e.length]);if(null==n)return null;var r=n[1]-n[0];return 1e9/J(e,n[0],r)}function Y(e,t){var n=W(z,[U,B],e,[t,e.length]);if(null==n)return null;var r=n[1]-n[0];return 4===r?function(e,t){return new DataView(e.buffer).getFloat32(t)}(e,n[0]):8===r?function(e,t){return new DataView(e.buffer).getFloat64(t)}(e,n[0]):null}function X(e,t){for(var n=1;n<=8;n++)if(e[t]>=Math.pow(2,8-n))return n}function Q(e,t){var n=X(e,t);if(null==n)return s.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return s.Z.warn("webm: impossible length"),null;for(var r=0,i=0;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return{length:n,value:r}}function $(e,t){var n=X(e,t);if(null==n)return s.Z.warn("webm: unrepresentable length"),null;if(t+n>e.length)return s.Z.warn("webm: impossible length"),null;for(var r=(e[t]&(1<<8-n)-1)*Math.pow(2,8*(n-1)),i=1;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return{length:n,value:r}}function J(e,t,n){for(var r=0,i=0;i<n;i++)r=e[t+i]*Math.pow(2,8*(n-i-1))+r;return r}var ee=n(5278);function te(e,t,n,r){var i=(0,L.Qx)(e);if(void 0===i||void 0===r)return null;var a,o=void 0!==n.timestampOffset?i+n.timestampOffset*r:i,u=(0,L.MM)(e);if(o<0&&(void 0!==u&&(u+=o),o=0),t||!n.complete)return void 0===u&&s.Z.warn("DASH: Chunked segments should indicate a duration through their trun boxes"),{time:o/r,duration:void 0!==u?u/r:void 0};var l=n.duration*r,d=Math.min(.9*r,l/4);return void 0!==u&&Math.abs(u-l)<=d&&(a=u),{time:o/r,duration:void 0!==a?a/r:a}}function ne(e,t){if(0!==e.length){var n=e.reduce((function(e,t){return"urn:mpeg:dash:event:2012"===t.schemeIdUri&&"1"===t.value?(void 0===e.manifestRefreshEventsFromEMSGs&&(e.manifestRefreshEventsFromEMSGs=[]),e.manifestRefreshEventsFromEMSGs.push(t)):(void 0===e.EMSGs&&(e.EMSGs=[]),e.EMSGs.push(t)),e}),{manifestRefreshEventsFromEMSGs:void 0,EMSGs:void 0}),r=n.manifestRefreshEventsFromEMSGs,i=n.EMSGs,a=null==i?void 0:i.map((function(e){return{type:"emsg",value:e}})),o=void 0!==t&&void 0!==r&&function(e,t){if(e.length<=0)return!1;for(var n=e.length,r=0;r<n;r++){var i=t,a=e[r].messageData,o=(0,c.uR)(a),s=Date.parse(o);if(void 0===i||void 0===s||isNaN(s)||s>=i)return!0}return!1}(r,t);return{inbandEvents:a,needsManifestRefresh:o}}}function re(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.segment,o=n.periodStart,s=n.periodEnd,u=e.data,l=e.isChunked,d=[o,s];if(null===u)return a.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:0,protectionData:[],appendWindow:d};var c=u instanceof Uint8Array?u:new Uint8Array(u),f=w(n.type,n.mimeType),v="mp4"===f||void 0===f,p=[];if(v){var h,m=(0,O.Z)(c);a.isInit&&(h=null!==(i=(0,L.R0)(c))&&void 0!==i?i:void 0),(m.length>0||void 0!==h)&&p.push({initDataType:"cenc",keyId:h,initData:m})}if(!a.isInit){var g=v?te(c,l,a,r):null,y=(0,ee.Z)(a.timestampOffset,0);if(v){var b=(0,L.s9)(c);if(void 0!==b){var S=ne(b.filter((function(e){return void 0!==a.privateInfos&&void 0!==a.privateInfos.isEMSGWhitelisted&&a.privateInfos.isEMSGWhitelisted(e)})),n.manifestPublishTime);if(void 0!==S){var E=S.needsManifestRefresh,T=S.inbandEvents;return{segmentType:"media",chunkData:c,chunkSize:c.length,chunkInfos:g,chunkOffset:y,appendWindow:d,inbandEvents:T,protectionData:p,needsManifestRefresh:E}}}}return{segmentType:"media",chunkData:c,chunkSize:c.length,chunkInfos:g,chunkOffset:y,protectionData:p,appendWindow:d}}var k,A=a.indexRange;if("webm"===f)k=function(e,t){var n=W(U,[],e,[t,e.length]);if(null==n)return null;var r=n[0],i=n[1],a=q(e,r);if(null==a)return null;var o=Y(e,r);if(null==o)return null;var s=W(V,[],e,[r,i]);if(null==s)return null;for(var u=[],l=s[0];l<s[1];){var d=W(K,[],e,[l,s[1]]);if(null==d)break;var c=W(G,[],e,[d[0],d[1]]);if(null==c)return null;var f=J(e,c[0],c[1]-c[0]),v=W(H,[j],e,[d[0],d[1]]);if(null==v)return null;var p=J(e,v[0],v[1]-v[0])+r;u.push({time:f,rangeStart:p}),l=d[1]}for(var h=[],m=0;m<u.length;m++){var g=u[m];m===u.length-1?h.push({time:g.time,timescale:a,duration:0===m?o:o-g.time,range:[g.rangeStart,1/0]}):h.push({time:g.time,timescale:a,duration:u[m+1].time-g.time,range:[g.rangeStart,u[m+1].rangeStart-1]})}return h}(c,0);else if(v&&(k=(0,L.Wf)(c,Array.isArray(A)?A[0]:0),!0===t&&null!==k&&k.length>0)){var I=k[k.length-1];Array.isArray(I.range)&&(I.range[1]=1/0)}var R=v?(0,L.LD)(c):"webm"===f?q(c,0):void 0,Z=(0,_.Z)(R)?void 0:R;return{segmentType:"init",initializationData:c,initializationDataSize:c.length,protectionData:p,initTimescale:Z,segmentList:null!=k?k:void 0}}}var ie=n(6807);function ae(e,t,n,r){var i,a,o=e.segment,u=e.language,l=e.codecs;if(o.isInit)return null;null===n?r?(i=o.time,a=o.end):s.Z.warn("Transport: Unavailable time data for current text track."):(i=n.time,void 0!==n.duration?a=i+n.duration:!r&&o.complete&&(a=i+o.duration));var d=function(e){if(void 0===e)throw new Error("Cannot parse subtitles: unknown format");switch(e.toLowerCase()){case"stpp":case"stpp.ttml.im1t":return"ttml";case"wvtt":return"vtt"}throw new Error('The codec used for the subtitles "'+e+'" is not managed yet.')}(l),f=function(e){var t=(0,ie.Le)(e);return null===t?"":(0,c.uR)(t)}(t);return{data:f,type:d,language:u,start:i,end:a}}function oe(e,t,n){var r,i,a=e.segment;return a.isInit?null:(n?s.Z.warn("Transport: Unavailable time data for current text track."):(r=a.time,a.complete&&(i=a.time+a.duration)),{data:t,type:function(e,t){switch(t){case"application/ttml+xml":return"ttml";case"application/x-sami":case"application/smil":return"sami";case"text/vtt":return"vtt"}if(void 0!==e&&"srt"===e.toLowerCase())return"srt";throw new Error("could not find a text-track parser for the type "+(null!=t?t:""))}(e.codecs,e.mimeType),language:e.language,start:r,end:i})}function se(e){var t=e.__priv_patchLastSegmentInSidx;return function(e,n,r){var i,a=n.periodStart,o=n.periodEnd,s=n.segment,u=e.data,l=e.isChunked;if(null===u)return s.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkSize:0,chunkInfos:null,chunkOffset:null!==(i=s.timestampOffset)&&void 0!==i?i:0,protectionData:[],appendWindow:[a,o]};var d=w(n.type,n.mimeType);if("webm"===d)throw new Error("Text tracks with a WEBM container are not yet handled.");return"mp4"===d?function(e,t,n,r,i){var a=n.segment,o=a.isInit,s=a.indexRange,u="string"==typeof e?(0,c.tG)(e):e instanceof Uint8Array?e:new Uint8Array(e);if(o){var l=(0,L.Wf)(u,Array.isArray(s)?s[0]:0);if(!0===i&&null!==l&&l.length>0){var d=l[l.length-1];Array.isArray(d.range)&&(d.range[1]=1/0)}return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:(0,L.LD)(u),segmentList:null!=l?l:void 0}}var f=te(u,t,a,r),v=ae(n,u,f,t),p=(0,ee.Z)(a.timestampOffset,0);return{segmentType:"media",chunkData:v,chunkSize:u.length,chunkInfos:f,chunkOffset:p,protectionData:[],appendWindow:[n.periodStart,n.periodEnd]}}(u,l,n,r,t):function(e,t,n){var r,i,a=n.periodStart,o=n.periodEnd,s=n.segment,u=s.timestampOffset,l=void 0===u?0:u;if(s.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0};if("string"!=typeof e){var d=e instanceof Uint8Array?e:new Uint8Array(e);r=(0,c.uR)(d),i=d.length}else r=e;return{segmentType:"media",chunkData:oe(n,r,t),chunkSize:i,chunkInfos:null,chunkOffset:l,protectionData:[],appendWindow:[a,o]}}(u,l,n)}}var ue=function(e){var t=(0,i.Z)({customManifestLoader:e.manifestLoader},null===r.Z.dashParsers.wasm||"initialized"!==r.Z.dashParsers.wasm.status&&"initializing"!==r.Z.dashParsers.wasm.status?"arraybuffer":"text"),n=f(e),a=function(e){var t=e.lowLatencyMode,n=e.segmentLoader;return!0!==e.checkMediaSegmentIntegrity?r:R(r);function r(e,r,i,a,o){var s=x(e,r.segment);return null==s?Promise.resolve({resultType:"segment-created",resultData:null}):t||void 0===n?N(s,r,t,i,o,a):new Promise((function(e,u){var l,d=!1,c={reject:function(e){var t,n;if(!d&&!a.isCancelled()){d=!0,a.deregister(h);var r=e,i=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching a DASH segment through a custom segmentLoader.",o=new v.Z(i,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);u(o)}},resolve:function(t){d||a.isCancelled()||(d=!0,a.deregister(h),e({resultType:"segment-loaded",resultData:{responseData:t.data,size:t.size,requestDuration:t.duration}}))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(h),N(s,r,t,i,o,a).then(e,u))}};void 0!==r.segment.range&&(l=[r.segment.range],void 0!==r.segment.indexRange&&l.push(r.segment.indexRange));var f={isInit:r.segment.isInit,timeout:i.timeout,byteRanges:l,trackType:r.type,url:s},p=n(f,c);function h(e){d||(d=!0,"function"==typeof p&&p(),u(e))}a.register(h)}))}}(e),o=re(e),s=function(e){var t=e.lowLatencyMode;return!0!==e.checkMediaSegmentIntegrity?n:R(n);function n(e,n,r,i,a){var o=n.segment,s=o.range,u=x(e,o);if(null===u)return Promise.resolve({resultType:"segment-created",resultData:null});if(o.isInit)return M(u,o,r,i,a);var l=w(n.type,n.mimeType),c="mp4"===l||void 0===l;if(t&&c){if(E())return D(u,n,r,a,i);(0,T.Z)("DASH: Your browser does not have the fetch API. You will have a higher chance of rebuffering when playing close to the live edge")}return c?(0,d.ZP)({url:u,responseType:"arraybuffer",headers:Array.isArray(s)?{Range:(0,k.Z)(s)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}})):(0,d.ZP)({url:u,responseType:"text",headers:Array.isArray(s)?{Range:(0,k.Z)(s)}:null,timeout:r.timeout,onProgress:a.onProgress,cancelSignal:i}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))}}(e);return{manifest:{loadManifest:t,parseManifest:n},audio:{loadSegment:a,parseSegment:o},video:{loadSegment:a,parseSegment:o},text:{loadSegment:s,parseSegment:se(e)}}}},5418:function(e,t,n){"use strict";n.d(t,{Z:function(){return le}});var r=n(3887),i=n(8619),a=n(6807),o=n(9665),s=n(7714),u=n(811),l=n(6968),d=n(6923),c=n(8026),f=n(9829),v=n(3635),p=n(5278),h=n(2689),m={};function g(e){if(null!=m[e])return m[e];var t=(0,v.tG)(e);return m[e]=t,t}function y(e,t){var n=t.length+8;return n<=h.s?(0,l.zo)((0,l.kh)(n),g(e),t):(0,l.zo)((0,l.kh)(1),g(e),(0,l.el)(n+8),t)}function _(e,t){return y(e,l.zo.apply(void 0,t))}function b(e){var t=[];e.periods.forEach((function(n){var i=n.id;if((0,s.Z)(t,i)){r.Z.warn("Two periods with the same ID found. Updating.");var a=i+"-dup";n.id=a,b(e),t.push(a)}else t.push(i);var o=n.adaptations,u=[];Object.keys(o).forEach((function(t){var n=o[t];void 0!==n&&n.forEach((function(t){var n=t.id;if((0,s.Z)(u,n)){r.Z.warn("Two adaptations with the same ID found. Updating.",n);var i=n+"-dup";t.id=i,b(e),u.push(i)}else u.push(n);var a=[];t.representations.forEach((function(t){var n=t.id;if((0,s.Z)(a,n)){r.Z.warn("Two representations with the same ID found. Updating.",n);var i=n+"-dup";t.id=i,b(e),a.push(i)}else a.push(n)}))}))}))}))}var S=n(9689);function E(e){return[{systemId:"edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",privateData:(0,l.zo)([8,1,18,16],e)}]}function T(e,t){if(void 0===t&&(t=E),null===e.firstElementChild||"ProtectionHeader"!==e.firstElementChild.nodeName)throw new Error("Protection should have ProtectionHeader child");var n=e.firstElementChild,r=(0,S.K)(null===n.textContent?"":n.textContent),i=function(e){var t=(0,l.qb)(e,8),n=(0,v.wV)(e.subarray(10,t+10)),r=(new DOMParser).parseFromString(n,"application/xml").querySelector("KID");if(null===r)throw new Error("Cannot parse PlayReady private data: invalid XML");var i=null===r.textContent?"":r.textContent,a=(0,v.wO)((0,S.K)(i));return(0,v.ci)(a).toLowerCase()}(r),a=(0,v.nr)(i),o=n.getAttribute("SystemID");return{keyId:a,keySystems:[{systemId:(null!==o?o:"").toLowerCase().replace(/\{|\}/g,""),privateData:r}].concat(t(a))}}var k=n(9362),w=n(3911),A=n(1091);function I(e,t){return e.replace(/\{start time\}/g,String(t))}function R(e,t,n){var r=t-e;return r>0?Math.floor(r/n):0}function Z(e,t){var n=e.repeatCount;if(void 0!==e.duration&&n<0){var r=void 0!==t?t.start:1/0;n=Math.ceil((r-e.start)/e.duration)-1}return n}var x=function(){function e(e){var t=e.isLive,n=e.segmentPrivateInfos,r=e.media,i=e.sharedSmoothTimeline;if(this._sharedSmoothTimeline=i,this._initSegmentInfos={bitsPerSample:n.bitsPerSample,channels:n.channels,codecPrivateData:n.codecPrivateData,packetSize:n.packetSize,samplingRate:n.samplingRate,timescale:i.timescale,height:n.height,width:n.width,protection:n.protection},this._isLive=t,this._media=r,0!==i.timeline.length&&t){var a=i.timeline,o=i.validityTime,s=a[a.length-1],u=(0,w.jH)(s,null),l=o/1e3*i.timescale;this._scaledLiveGap=l-u}}var t=e.prototype;return t.getInitSegment=function(){return{id:"init",isInit:!0,privateInfos:{smoothInitSegment:this._initSegmentInfos},url:null,time:0,end:0,duration:0,timescale:1,complete:!0}},t.getSegments=function(e,t){this._refreshTimeline();for(var n,r=this._sharedSmoothTimeline,i=r.timescale,a=r.timeline,o=function(e,t,n){var r=void 0===e||0===e?1:e;return{up:t*r,to:(t+n)*r}}(i,e,t),s=o.up,u=o.to,l=this._media,d=[],c=a.length,f=void 0===this._scaledLiveGap?void 0:performance.now()/1e3*i-this._scaledLiveGap,v=0;v<c;v++){for(var p=a[v],h=p.duration,m=p.start,g=Z(p,a[v+1]),y=R(m,s,h),_=m+y*h,b=h;_<u&&y<=g&&(void 0===f||_+b<=f);){var S=_,E=void 0!==n?n+y:void 0,T={id:String(_),isInit:!1,time:S/i,end:(S+h)/i,duration:h/i,timescale:1,number:E,url:I(l,S),complete:!0,privateInfos:{smoothMediaSegment:{time:S,duration:h}}};d.push(T),_=m+ ++y*h}if(_>=u)return d;void 0!==n&&(n+=g+1)}return d},t.shouldRefresh=function(e,t){if(this._refreshTimeline(),!this._isLive)return!1;var n=this._sharedSmoothTimeline,r=n.timeline,i=n.timescale,a=r[r.length-1];if(void 0===a)return!1;var o=a.repeatCount,s=a.start+(o+1)*a.duration;return!(t*i<s)&&(e*i>=s||e*i>a.start+o*a.duration)},t.getFirstAvailablePosition=function(){this._refreshTimeline();var e=this._sharedSmoothTimeline,t=e.timeline,n=e.timescale;return 0===t.length?null:t[0].start/n},t.getLastAvailablePosition=function(){this._refreshTimeline();var e=this._sharedSmoothTimeline,t=e.timeline,n=e.timescale;if(void 0===this._scaledLiveGap){var r=t[t.length-1];return(0,w.jH)(r,null)/n}for(var i=t.length-1;i>=0;i--)for(var a=t[i],o=performance.now()/1e3*n,s=a.start,u=a.duration,l=a.repeatCount;l>=0;l--){var d=s+u*(l+1);if(d<=o-this._scaledLiveGap)return d/n}},t.getEnd=function(){if(!this._isLive)return this.getLastAvailablePosition()},t.awaitSegmentBetween=function(e,t){var n;if((0,u.Z)(e<=t),this.isFinished())return!1;var r=this.getLastAvailablePosition();return!(void 0!==r&&t<r)&&(t>(null!==(n=this.getFirstAvailablePosition())&&void 0!==n?n:0)&&void 0)},t.checkDiscontinuity=function(e){return this._refreshTimeline(),(0,w._j)(this._sharedSmoothTimeline,e,void 0)},t.isSegmentStillAvailable=function(e){if(e.isInit)return!0;this._refreshTimeline();var t=this._sharedSmoothTimeline,n=t.timeline,r=t.timescale;return(0,A.Z)(e,n,r,0)},t.canBeOutOfSyncError=function(e){return!!this._isLive&&(e instanceof k.Z&&(e.isHttpError(404)||e.isHttpError(412)))},t._replace=function(e){this._initialScaledLastPosition=e._initialScaledLastPosition,this._scaledLiveGap=e._scaledLiveGap,this._sharedSmoothTimeline.replace(e._sharedSmoothTimeline)},t._update=function(e){this._scaledLiveGap=e._scaledLiveGap,this._sharedSmoothTimeline.update(e._sharedSmoothTimeline)},t.isFinished=function(){return!this._isLive},t.isInitialized=function(){return!0},t.initialize=function(){r.Z.error("A `SmoothRepresentationIndex` does not need to be initialized")},t.addPredictedSegments=function(e,t){this._sharedSmoothTimeline.addPredictedSegments(e,t)},t._refreshTimeline=function(){this._sharedSmoothTimeline.refresh()},e}(),P=n(8232),M=n(5505);function C(e,t,n,r){var i=e[e.length-1],a=n.timescale===t?{time:n.time,duration:n.duration}:{time:n.time/n.timescale*t,duration:n.duration/n.timescale*t};return!(r.time===a.time)&&(a.time>=(0,w.jH)(i,null)&&(i.duration===a.duration?i.repeatCount++:e.push({duration:a.duration,start:a.time,repeatCount:0}),!0))}var D=function(){function e(e){var t=e.timeline,n=e.timescale,r=e.timeShiftBufferDepth,i=e.manifestReceivedTime;this.timeline=t,this.timescale=n;var a=null!=i?i:performance.now();if(this.validityTime=a,this._timeShiftBufferDepth=r,0!==t.length){var o=t[t.length-1],s=(0,w.jH)(o,null);this._initialScaledLastPosition=s}}var t=e.prototype;return t.refresh=function(){if(void 0!==this._initialScaledLastPosition){var e=this._timeShiftBufferDepth,t=(performance.now()-this.validityTime)/1e3+this._initialScaledLastPosition/this.timescale;if(void 0!==e){var n=(t-e)*this.timescale;(0,P.Z)(this.timeline,n)}}},t.replace=function(e){var t=this.timeline,n=e.timeline,i=this.timescale,a=e.timescale;if(this._initialScaledLastPosition=e._initialScaledLastPosition,this.validityTime=e.validityTime,0!==t.length&&0!==n.length&&i===a){var o=t[t.length-1],s=n[n.length-1],u=(0,w.jH)(s,null);if(!((0,w.jH)(o,null)<=u))for(var l=0;l<t.length;l++){var d=t[l],c=(0,w.jH)(d,null);if(c===u)return void(this.timeline=this.timeline.concat(t.slice(l+1)));if(c>u){if(d.duration!==s.duration)return;var f=u-d.start;if(0===f)return r.Z.warn("Smooth Parser: a discontinuity detected in the previous manifest has been resolved."),void(this.timeline=this.timeline.concat(t.slice(l)));if(f<0||f%d.duration!=0)return;var v=f/d.duration-1,p=d.repeatCount-v;if(p<0)return;s.repeatCount+=p;var h=t.slice(l+1);return void(this.timeline=this.timeline.concat(h))}}}},t.update=function(e){(0,M.Z)(this.timeline,e.timeline),this._initialScaledLastPosition=e._initialScaledLastPosition,this.validityTime=e.validityTime},t.addPredictedSegments=function(e,t){var n;if(void 0!==(null===(n=t.privateInfos)||void 0===n?void 0:n.smoothMediaSegment)){this.refresh();for(var i=0;i<e.length;i++)C(this.timeline,this.timescale,e[i],t.privateInfos.smoothMediaSegment)}else r.Z.warn("Smooth Parser: should only encounter SmoothRepresentationIndex")},e}();function N(e,t,n){for(var r=e.firstElementChild,i=n;null!==r;)i=t(i,r.nodeName,r),r=r.nextElementSibling;return i}var O={audio:"audio/mp4",video:"video/mp4",text:"application/ttml+xml"},L={AACL:"audio/mp4",AVC1:"video/mp4",H264:"video/mp4",TTML:"application/ttml+xml+mp4",DFXP:"application/ttml+xml+mp4"};var U=function(e){void 0===e&&(e={});var t=void 0===e.referenceDateTime?Date.UTC(1970,0,1,0,0,0,0)/1e3:e.referenceDateTime,n=void 0===e.minRepresentationBitrate?0:e.minRepresentationBitrate,i=e.serverSyncInfos,a=void 0!==i?i.serverTimestamp-i.clientTime:void 0;function h(e,t){var n=N(e,(function(e,t,n){return"CustomAttributes"===t&&e.push.apply(e,N(n,(function(e,t,n){if("Attribute"===t){var r=n.getAttribute("Name"),i=n.getAttribute("Value");null!==r&&null!==i&&e.push(r+"="+i)}return e}),[])),e}),[]);function i(t){var n=e.getAttribute(t);return null==n?void 0:n}switch(t){case"audio":var a=i("AudioTag"),o=i("BitsPerSample"),s=i("Channels"),u=i("CodecPrivateData"),l=i("FourCC"),c=i("PacketSize"),f=i("SamplingRate"),v=i("Bitrate"),h=void 0===v||isNaN(parseInt(v,10))?0:parseInt(v,10);if(void 0!==l&&void 0===L[l]||void 0===u)return r.Z.warn("Smooth parser: Unsupported audio codec. Ignoring quality level."),null;var m=function(e,t){var n;return 0==(n="AACH"===t?5:(0,d.Z)(e)?(248&parseInt(e.substring(0,2),16))>>3:2)?"mp4a.40.2":"mp4a.40."+n}(u,l);return{audiotag:void 0!==a?parseInt(a,10):a,bitrate:h,bitsPerSample:void 0!==o?parseInt(o,10):o,channels:void 0!==s?parseInt(s,10):s,codecPrivateData:u,codecs:m,customAttributes:n,mimeType:void 0!==l?L[l]:l,packetSize:void 0!==c?parseInt(c,10):c,samplingRate:void 0!==f?parseInt(f,10):f};case"video":var g=i("CodecPrivateData"),y=i("FourCC"),_=i("MaxWidth"),b=i("MaxHeight"),S=i("Bitrate"),E=void 0===S||isNaN(parseInt(S,10))?0:parseInt(S,10);if(void 0!==y&&void 0===L[y]||void 0===g)return r.Z.warn("Smooth parser: Unsupported video codec. Ignoring quality level."),null;var T=function(e){var t=/00000001\d7([0-9a-fA-F]{6})/.exec(e);return null!==t&&(0,d.Z)(t[1])?"avc1."+t[1]:"avc1.4D401E"}(g);return{bitrate:E,customAttributes:n,mimeType:void 0!==y?L[y]:y,codecPrivateData:g,codecs:T,width:void 0!==_?parseInt(_,10):void 0,height:void 0!==b?parseInt(b,10):void 0};case"text":var k=i("CodecPrivateData"),w=i("FourCC"),A=i("Bitrate");return{bitrate:void 0===A||isNaN(parseInt(A,10))?0:parseInt(A,10),customAttributes:n,mimeType:void 0!==w?L[w]:w,codecPrivateData:(0,p.Z)(k,"")};default:return r.Z.error("Smooth Parser: Unrecognized StreamIndex type: "+t),null}}function m(e){var t=e.root,i=e.timescale,a=e.baseUrl,f=e.protections,p=e.timeShiftBufferDepth,m=e.manifestReceivedTime,g=e.isLive,_=t.getAttribute("Timescale"),b=null===_||isNaN(+_)?i:+_,S=t.getAttribute("Type");if(null===S)throw new Error("StreamIndex without type.");(0,s.Z)(o.r,S)||r.Z.warn("Smooth Parser: Unrecognized adaptation type:",S);var E=S,T=t.getAttribute("Subtype"),k=t.getAttribute("Language"),w=t.getAttribute("Url"),A=null===w?"":w;var I,R=N(t,(function(e,t,r){switch(t){case"QualityLevel":var i=h(r,E);if(null===i)return e;("video"!==E||i.bitrate>n)&&e.qualityLevels.push(i);break;case"c":e.cNodes.push(r)}return e}),{qualityLevels:[],cNodes:[]}),Z=R.qualityLevels,P=R.cNodes,M=new D({timeline:(I=P,I.reduce((function(e,t,n){var r=t.getAttribute("d"),i=t.getAttribute("t"),a=t.getAttribute("r"),o=null!==a?+a-1:0,s=null!==i?+i:void 0,u=null!==r?+r:void 0;if(0===n)s=void 0===s||isNaN(s)?0:s;else{var l=e[n-1];if(null==s||isNaN(s)){if(null==l.duration||isNaN(l.duration))throw new Error("Smooth: Invalid CNodes. Missing timestamp.");s=l.start+l.duration*(l.repeatCount+1)}}if(null==u||isNaN(u)){var c=I[n+1];if(void 0===c)return e;var f=c.getAttribute("t"),v=(0,d.Z)(f)?+f:null;if(null===v)throw new Error("Can't build index timeline from Smooth Manifest.");u=v-s}return e.push({duration:u,start:s,repeatCount:o}),e}),[])),timescale:b,timeShiftBufferDepth:p,manifestReceivedTime:m});(0,u.Z)(0!==Z.length,"Adaptation should have at least one playable representation.");var C=E+((0,d.Z)(k)?"_"+k:""),L=Z.map((function(e){var t,n,r,i,o=(t=A,n=e.bitrate,r=e.customAttributes,t.replace(/\{bitrate\}/g,String(n)).replace(/{CustomAttributes}/g,r.length>0?r[0]:"")),s=(0,d.Z)(e.mimeType)?e.mimeType:O[E],u=e.codecs,p=C+"_"+(null!=E?E+"-":"")+(null!=s?s+"-":"")+(null!=u?u+"-":"")+String(e.bitrate),h=[];f.length>0&&(i=f[0],f.forEach((function(e){var t=e.keyId;e.keySystems.forEach((function(e){h.push({keyId:t,systemId:e.systemId})}))})));var m={bitsPerSample:e.bitsPerSample,channels:e.channels,codecPrivateData:e.codecPrivateData,packetSize:e.packetSize,samplingRate:e.samplingRate,height:e.height,width:e.width,protection:null!=i?{keyId:i.keyId}:void 0},_=new x({isLive:g,sharedSmoothTimeline:M,media:o,segmentPrivateInfos:m}),b=(0,c.Z)({},e,{index:_,cdnMetadata:[{baseUrl:a}],mimeType:s,codecs:u,id:p});if(h.length>0||void 0!==i){var S=void 0===i?[]:i.keySystems.map((function(e){var t=e.systemId,n=e.privateData,r=t.replace(/-/g,""),i=function(e,t){if(32!==e.length)throw new Error("HSS: wrong system id length");var n=0;return y("pssh",(0,l.zo)([n,0,0,0],(0,v.nr)(e),(0,l.kh)(t.length),t))}(r,n);return{systemId:r,data:i}}));if(S.length>0){var T=[{type:"cenc",values:S}];b.contentProtections={keyIds:h,initData:T}}else b.contentProtections={keyIds:h,initData:[]}}return b}));if("ADVT"===T)return null;var U={id:C,type:E,representations:L,language:null==k?void 0:k};return"text"===E&&"DESC"===T&&(U.closedCaption=!0),U}return function(n,r,i){var o="";if(void 0!==r){var s=(0,f.$)(r);o=r.substring(0,s)}var u=n.documentElement;if(null==u||"SmoothStreamingMedia"!==u.nodeName)throw new Error("document root should be SmoothStreamingMedia");var l=u.getAttribute("MajorVersion"),c=u.getAttribute("MinorVersion");if(null===l||null===c||!/^[2]-[0-2]$/.test(l+"-"+c))throw new Error("Version should be 2.0, 2.1 or 2.2");var v,p,h=u.getAttribute("Timescale"),g=(0,d.Z)(h)?isNaN(+h)?1e7:+h:1e7,y=N(u,(function(t,n,r){switch(n){case"Protection":t.protections.push(T(r,e.keySystems));break;case"StreamIndex":t.adaptationNodes.push(r)}return t}),{adaptationNodes:[],protections:[]}),_=y.protections,S=y.adaptationNodes,E="boolean"==typeof(v=u.getAttribute("IsLive"))?v:"string"==typeof v&&"TRUE"===v.toUpperCase();if(E){var k=u.getAttribute("DVRWindowLength");null==k||isNaN(+k)||0==+k||(p=+k/g)}var w,A,I,R,Z,x,P,M=S.reduce((function(e,t){var n=m({root:t,baseUrl:o,timescale:g,protections:_,isLive:E,timeShiftBufferDepth:p,manifestReceivedTime:i});if(null===n)return e;var r=n.type,a=e[r];return void 0===a?e[r]=[n]:a.push(n),e}),{}),C=null,D=void 0!==M.video?M.video[0]:void 0,O=void 0!==M.audio?M.audio[0]:void 0;if(void 0!==D||void 0!==O){var L=[],U=[];if(void 0!==D){var B=D.representations[0];if(void 0!==B){var F=B.index.getFirstAvailablePosition(),z=B.index.getLastAvailablePosition();null!=F&&L.push(F),null!=z&&U.push(z)}}if(void 0!==O){var V=O.representations[0];if(void 0!==V){var K=V.index.getFirstAvailablePosition(),G=V.index.getLastAvailablePosition();null!=K&&L.push(K),null!=G&&U.push(G)}}L.length>0&&(Z=Math.max.apply(Math,L)),U.length>0&&(x=Math.min.apply(Math,U),P=Math.max.apply(Math,U))}var j=u.getAttribute("Duration"),H=null!==j&&0!=+j?+j/g:void 0;if(E){w=e.suggestedPresentationDelay,A=t,I=null!=Z?Z:A;var W=P;void 0===W&&(W=Date.now()/1e3-A);var q=x;void 0===q&&(q=W),R={isLinear:!0,maximumSafePosition:q,livePosition:W,time:performance.now()},C=null!=p?p:null}else{I=null!=Z?Z:0,R={isLinear:!1,maximumSafePosition:void 0!==x?x:void 0!==H?I+H:1/0,livePosition:void 0,time:performance.now()}}var Y=E?0:I,X=E?void 0:R.maximumSafePosition,Q={availabilityStartTime:void 0===A?0:A,clockOffset:a,isLive:E,isDynamic:E,isLastPeriodKnown:!0,timeBounds:{minimumSafePosition:I,timeshiftDepth:C,maximumTimeData:R},periods:[{adaptations:M,duration:void 0!==X?X-Y:H,end:X,id:"gen-smooth-period-0",start:Y}],suggestedPresentationDelay:w,transportType:"smooth",uris:null==r?[]:[r]};return b(Q),Q}},B=U,F=n(4597),z=n(4460),V=n(8791),K=n(4644),G=n(2297);function j(e,t,n,i,o){var s,u,d,c=[];if(o){var f=(0,a.XA)(e);null!==f?(d=function(e){var t=(0,G.nR)(e,3565190898,3392751253,2387879627,2655430559);if(void 0===t)return[];for(var n=[],r=t[0],i=t[4],a=0;a<i;a++){var o=void 0,s=void 0;1===r?(s=(0,l.pV)(t,16*a+5),o=(0,l.pV)(t,16*a+5+8)):(s=(0,l.pX)(t,8*a+5),o=(0,l.pX)(t,8*a+5+4)),n.push({time:s,duration:o})}return n}(f),u=function(e){var t=(0,G.nR)(e,1830656773,1121273062,2162299933,2952222642);if(void 0!==t)return{duration:(0,l.pV)(t,12),time:(0,l.pV)(t,4)}}(f)):r.Z.warn("smooth: could not find traf atom")}if(void 0!==d)for(var v=0;v<d.length;v++)c.push({time:d[v].time,duration:d[v].duration,timescale:n});if(void 0!==u)return{nextSegments:c,chunkInfos:{time:u.time/n,duration:u.duration/n},scaledSegmentTime:u.time};if(t||!i.complete)return{nextSegments:c,chunkInfos:null,scaledSegmentTime:void 0};var p=i.duration*n,h=Math.min(.9*n,p/4),m=(0,K.MM)(e),g=void 0!==(null===(s=i.privateInfos)||void 0===s?void 0:s.smoothMediaSegment)?i.privateInfos.smoothMediaSegment.time:Math.round(i.time*n);return{nextSegments:c,chunkInfos:void 0!==m&&Math.abs(m-p)<=h?{time:i.time,duration:m/n}:{time:i.time,duration:i.duration},scaledSegmentTime:g}}function H(e){return"string"==typeof e&&e.indexOf("mp4")>=0}var W=n(3666);function q(e,t){return y("schm",(0,l.zo)(4,(0,v.tG)(e),(0,l.kh)(t)))}function Y(e){return y("frma",(0,v.tG)(e))}function X(e){var t=[7,[e.length]];return y("stsd",l.zo.apply(void 0,t.concat(e)))}function Q(e,t,n){return y("tenc",(0,l.zo)(6,[e,t],n))}function $(e,t,n,r,i){var a=[e,t,n];return void 0!==i&&a.push(y("senc",i),function(e){if(0===e.length)return y("saiz",new Uint8Array(0));var t=(0,l.pX)(e,0),n=(0,l.pX)(e,4),r=new Uint8Array(n+9);r.set((0,l.kh)(n),5);for(var i,a,o=9,s=8;s<e.length;)s+=8,2==(2&t)?(a=2,s+=6*(i=(0,l.zK)(e,s))+2):(i=0,a=0),r[o]=6*i+8+a,o++;return y("saiz",r)}(i),function(e,t,n,r){return y("saio",(0,l.zo)(4,[0,0,0,1],(0,l.kh)(e.length+t.length+n.length+r.length+8+8+8+8)))}(r,e,t,n)),_("traf",a)}function J(e,t){var n=(0,G.Qy)(e,1836019558);if(null===n)throw new Error("Smooth: Invalid ISOBMFF given");var r=e.subarray(n[1],n[2]),i=(0,G.iz)(r,1835427940),a=(0,G.t_)(r,1953653094);if(null===a||null===i)throw new Error("Smooth: Invalid ISOBMFF given");var o=(0,G.Qy)(a,1952868452),s=(0,G.Qy)(a,1953658222);if(null===o||null===s)throw new Error("Smooth: Invalid ISOBMFF given");var u=a.subarray(o[0],o[2]),d=a.subarray(s[0],s[2]);u.set([0,0,0,1],o[1]-o[0]+4);var c=function(e){return y("tfdt",(0,l.zo)([1,0,0,0],(0,l.el)(e)))}(t),f=function(e,t){var n=(1&e[t+3])>0;if(n)return e;var r=new Uint8Array(e.length+4);return r.set(e.subarray(0,t+8),0),r[t+3]=1|r[t+3],r.set([0,0,0,0],t+8),r.set(e.subarray(t+8,e.length),t+12),(0,K.J6)(r)}(d,s[1]-s[0]),v=$(u,c,f,i,(0,G.nR)(a,2721664850,1520127764,2722393154,2086964724)),p=_("moof",[i,v]),h=(0,G.Qy)(p,1836019558),m=(0,G.Qy)(v,1953653094),g=(0,G.Qy)(f,1953658222);if(null===h||null===m||null===g)throw new Error("Smooth: Invalid moof, trun or traf generation");var b=h[1]-h[0]+i.length+(m[1]-m[0])+u.length+c.length+(g[1]-g[0])+8,S=n[2]-n[0],E=p.length-S,T=(0,G.Qy)(e,1835295092);if(null===T)throw new Error("Smooth: Invalid ISOBMFF given");if(!W.YM&&(0===E||E<=-8)){var k=T[1];return p.set((0,l.kh)(k),b),e.set(p,n[0]),E<=-8&&e.set(y("free",new Uint8Array(-E-8)),p.length),e}var w=T[1]+E;p.set((0,l.kh)(w),b);var A=new Uint8Array(e.length+E),I=e.subarray(0,n[0]),R=e.subarray(n[2],e.length);return A.set(I,0),A.set(p,I.length),A.set(R,I.length+p.length),A}var ee=n(7839),te=n(281);function ne(e,t,n,r,i,a){var o,s,u,d=_("stbl",[n,y("stts",new Uint8Array(8)),y("stsc",new Uint8Array(8)),y("stsz",new Uint8Array(12)),y("stco",new Uint8Array(8))]),c=function(e){return y("dref",(0,l.zo)(7,[1],e))}(y("url ",new Uint8Array([0,0,0,1]))),f=_("dinf",[c]),p=_("minf",[r,f,d]),h=function(e){var t,n;switch(e){case"video":t="vide",n="VideoHandler";break;case"audio":t="soun",n="SoundHandler";break;default:t="hint",n=""}return y("hdlr",(0,l.zo)(8,(0,v.tG)(t),12,(0,v.tG)(n),1))}(t),m=function(e){return y("mdhd",(0,l.zo)(12,(0,l.kh)(e),8))}(e),g=_("mdia",[m,h,p]),b=function(e,t,n){return y("tkhd",(0,l.zo)((0,l.kh)(7),8,(0,l.kh)(n),20,[1,0,0,0],[0,1,0,0],12,[0,1,0,0],12,[64,0,0,0],(0,l.XT)(e),2,(0,l.XT)(t),2))}(i,a,1),S=_("trak",[b,g]),E=_("mvex",[(o=1,y("trex",(0,l.zo)(4,(0,l.kh)(o),[0,0,0,1],12)))]),T=function(e,t){return y("mvhd",(0,l.zo)(12,(0,l.kh)(e),4,[0,1],2,[1,0],10,[0,1],14,[0,1],14,[64,0,0,0],26,(0,l.XT)(t+1)))}(e,1),k=function(e,t,n){return _("moov",[e,t,n])}(T,E,S),w=(s="isom",u=["isom","iso2","iso6","avc1","dash"],y("ftyp",l.zo.apply(void 0,[(0,v.tG)(s),[0,0,0,1]].concat(u.map(v.tG)))));return(0,l.zo)(w,k)}function re(e,t,n,r,i,a,o,s){var u=o.split("00000001"),d=u[1],c=u[2];if(void 0===d||void 0===c)throw new Error("Smooth: unsupported codec private data.");var f,p,h=function(e,t,n){var r=2===n?1:4===n?3:0,i=e[1],a=e[2],o=e[3];return y("avcC",(0,l.zo)([1,i,a,o,252|r,225],(0,l.XT)(e.length),e,[1],(0,l.XT)(t.length),t))}((0,v.nr)(d),(0,v.nr)(c),a);if(void 0===s){var m=function(e,t,n,r,i,a,o){return y("avc1",(0,l.zo)(6,(0,l.XT)(1),16,(0,l.XT)(e),(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),6,[0,1,i.length],(0,v.tG)(i),31-i.length,(0,l.XT)(a),[255,255],o))}(t,n,r,i,"AVC Coding",24,h);f=X([m])}else{var g=_("schi",[Q(1,8,s)]),b=q("cenc",65536),S=function(e,t,n,r,i,a,o,s){return y("encv",(0,l.zo)(6,(0,l.XT)(1),16,(0,l.XT)(e),(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),6,[0,1,i.length],(0,v.tG)(i),31-i.length,(0,l.XT)(a),[255,255],o,s))}(t,n,r,i,"AVC Coding",24,h,_("sinf",[Y("avc1"),b,g]));f=X([S])}return ne(e,"video",f,((p=new Uint8Array(12))[3]=1,y("vmhd",p)),t,n)}var ie=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function ae(e,t,n,r,i,a,o){var s,u,d,c=function(e,t){return y("esds",(0,l.zo)(4,[3,25],(0,l.XT)(e),[0,4,17,64,21],11,[5,2],(0,v.nr)(t),[6,1,2]))}(1,0===a.length?(s=i,u=t,d=((d=((d=(63&2)<<4)|31&ie.indexOf(s))<<4)|31&u)<<3,(0,v.ci)((0,l.XT)(d))):a),f=function(){if(void 0===o){var e=function(e,t,n,r,i,a){return y("mp4a",(0,l.zo)(6,(0,l.XT)(e),8,(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),(0,l.XT)(i),2,a))}(1,t,n,r,i,c);return X([e])}var a=_("schi",[Q(1,8,o)]),s=q("cenc",65536),u=_("sinf",[Y("mp4a"),s,a]),d=function(e,t,n,r,i,a,o){return y("enca",(0,l.zo)(6,(0,l.XT)(e),8,(0,l.XT)(t),(0,l.XT)(n),2,(0,l.XT)(r),(0,l.XT)(i),2,a,o))}(1,t,n,r,i,c,u);return X([d])}();return ne(e,"audio",f,y("smhd",new Uint8Array(8)),0,0)}function oe(e,t,n,r,i,a){var o,s=t.segment.range;return Array.isArray(s)&&(o={Range:(0,te.Z)(s)}),(0,F.ZP)({url:e,responseType:"arraybuffer",headers:o,timeout:r.timeout,cancelSignal:i,onProgress:n.onProgress}).then((function(e){if(!H(t.mimeType)||!0!==a)return{resultType:"segment-loaded",resultData:e};var n=new Uint8Array(e.responseData);return(0,z.Z)(n,t.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},e),{responseData:n})}}))}var se=function(e){var t=e.checkMediaSegmentIntegrity,n=e.customSegmentLoader;return function(e,r,i,a,o){var s=r.segment;if(s.isInit){if(void 0===s.privateInfos||void 0===s.privateInfos.smoothInitSegment)throw new Error("Smooth: Invalid segment format");var u,l=s.privateInfos.smoothInitSegment,d=l.codecPrivateData,c=l.timescale,f=l.height,v=l.width,p=l.protection,h=void 0===p?{keyId:void 0,keySystems:void 0}:p;if(void 0===d)throw new Error("Smooth: no codec private data.");switch(r.type){case"video":u=re(c,null!=v?v:0,null!=f?f:0,72,72,4,d,h.keyId);break;case"audio":var m=l.channels,g=void 0===m?0:m,y=l.bitsPerSample,_=void 0===y?0:y,b=l.packetSize,S=void 0===b?0:b,E=l.samplingRate;u=ae(c,g,_,S,void 0===E?0:E,d,h.keyId);break;default:0,u=new Uint8Array(0)}return Promise.resolve({resultType:"segment-created",resultData:u})}return null===e?Promise.resolve({resultType:"segment-created",resultData:null}):"function"!=typeof n?oe(e,r,o,i,a,t):new Promise((function(s,u){var l,d=!1,c={reject:function(e){var t,n;if(!d&&!a.isCancelled()){d=!0,a.deregister(p);var r=e,i=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching a Smooth segment through a custom segmentLoader.",o=new ee.Z(i,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);u(o)}},resolve:function(e){if(!d&&!a.isCancelled()){d=!0,a.deregister(p),H(r.mimeType)&&!0===t||s({resultType:"segment-loaded",resultData:{responseData:e.data,size:e.size,requestDuration:e.duration}});var n=e.data instanceof Uint8Array?e.data:new Uint8Array(e.data);(0,z.Z)(n,r.segment.isInit),s({resultType:"segment-loaded",resultData:{responseData:n,size:e.size,requestDuration:e.duration}})}},fallback:function(){d||a.isCancelled()||(d=!0,a.deregister(p),oe(e,r,o,i,a,t).then(s,u))},progress:function(e){d||a.isCancelled()||o.onProgress({duration:e.duration,size:e.size,totalSize:e.totalSize})}};void 0!==r.segment.range&&(l=[r.segment.range],void 0!==r.segment.indexRange&&l.push(r.segment.indexRange));var f={isInit:r.segment.isInit,timeout:i.timeout,byteRanges:l,trackType:r.type,url:e},v=n(f,c);function p(e){d||((d=!0)||"function"!=typeof v||v(),u(e))}a.register(p)}))}};function ue(e,t){return null===e?null:null===t.url?e.baseUrl:(0,f.Z)(e.baseUrl,t.url)}var le=function(e){var t=B(e),n=se(e),o={customManifestLoader:e.manifestLoader},s={loadSegment:function(e,t,r,i,a){var o=ue(e,t.segment);return n(o,t,r,i,a)},parseSegment:function(e,t,n){var r,i,a=t.segment,o=e.data,s=e.isChunked;if(null===o)return a.isInit?{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0}:{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionData:[],appendWindow:[void 0,void 0]};var u=o instanceof Uint8Array?o:new Uint8Array(o);if(a.isInit){var l=null===(i=null===(r=a.privateInfos)||void 0===r?void 0:r.smoothInitSegment)||void 0===i?void 0:i.timescale;return{segmentType:"init",initializationData:o,initializationDataSize:o.byteLength,initTimescale:l,protectionData:[]}}var d=void 0!==n?j(u,s,n,a,t.isLive):null;if(null===d||null===d.chunkInfos||void 0===d.scaledSegmentTime)throw new Error("Smooth Segment without time information");var c=d.nextSegments,f=d.chunkInfos,v=J(u,d.scaledSegmentTime),p=c.length>0?c:void 0;return{segmentType:"media",chunkData:v,chunkInfos:f,chunkOffset:0,chunkSize:v.length,protectionData:[],predictedSegments:p,appendWindow:[void 0,void 0]}}};return{manifest:{loadManifest:(0,V.Z)(o,"text"),parseManifest:function(n,r){var a,o=null!==(a=n.url)&&void 0!==a?a:r.originalUrl,s=n.receivedTime,u=n.responseData,l="string"==typeof u?(new DOMParser).parseFromString(u,"text/xml"):u,d=t(l,o,s);return{manifest:new i.ZP(d,{representationFilter:e.representationFilter}),url:o}}},audio:s,video:s,text:{loadSegment:function(t,n,r,i,a){var o=n.segment,s=ue(t,o);return o.isInit||null===s?Promise.resolve({resultType:"segment-created",resultData:null}):H(n.mimeType)?(0,F.ZP)({url:s,responseType:"arraybuffer",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(t){if(!0!==e.checkMediaSegmentIntegrity)return{resultType:"segment-loaded",resultData:t};var r=new Uint8Array(t.responseData);return(0,z.Z)(r,n.segment.isInit),{resultType:"segment-loaded",resultData:Object.assign(Object.assign({},t),{responseData:r})}})):(0,F.ZP)({url:s,responseType:"text",timeout:r.timeout,cancelSignal:i,onProgress:a.onProgress}).then((function(e){return{resultType:"segment-loaded",resultData:e}}))},parseSegment:function(e,t,n){var i,o,s,u=t.segment,l=t.language,d=t.mimeType,c=void 0===d?"":d,f=t.codecs,p=void 0===f?"":f,h=H(t.mimeType),m=e.data,g=e.isChunked;if(u.isInit)return{segmentType:"init",initializationData:null,initializationDataSize:0,protectionData:[],initTimescale:void 0};if(null===m)return{segmentType:"media",chunkData:null,chunkInfos:null,chunkOffset:0,chunkSize:0,protectionData:[],appendWindow:[void 0,void 0]};var y,_,b,S,E=null;if(h){var T;o=(T="string"==typeof m?(0,v.tG)(m):m instanceof Uint8Array?m:new Uint8Array(m)).length;var k=void 0!==n?j(T,g,n,u,t.isLive):null;s=null==k?void 0:k.nextSegments,null===(E=null!==(i=null==k?void 0:k.chunkInfos)&&void 0!==i?i:null)?g?r.Z.warn("Smooth: Unavailable time data for current text track."):(y=u.time,_=u.end):(y=E.time,_=void 0!==E.duration?E.time+E.duration:u.end);var w=p.toLowerCase();if("application/ttml+xml+mp4"===c||"stpp"===w||"stpp.ttml.im1t"===w)S="ttml";else{if("wvtt"!==w)throw new Error("could not find a text-track parser for the type "+c);S="vtt"}var A=(0,a.Le)(T);b=null===A?"":(0,v.uR)(A)}else{var I;if(y=u.time,_=u.end,"string"!=typeof m){var R=m instanceof Uint8Array?m:new Uint8Array(m);o=R.length,I=(0,v.uR)(R)}else I=m;switch(c){case"application/x-sami":case"application/smil":S="sami";break;case"application/ttml+xml":S="ttml";break;case"text/vtt":S="vtt"}if(void 0===S){if("srt"!==p.toLowerCase())throw new Error("could not find a text-track parser for the type "+c);S="srt"}b=I}return{segmentType:"media",chunkData:{type:S,data:b,start:y,end:_,language:l},chunkSize:o,chunkInfos:E,chunkOffset:null!=y?y:0,protectionData:[],predictedSegments:Array.isArray(s)&&s.length>0?s:void 0,appendWindow:[void 0,void 0]}}}}}},281:function(e,t,n){"use strict";function r(e){var t=e[0],n=e[1];return n===1/0?"bytes="+t+"-":"bytes="+t+"-"+n}n.d(t,{Z:function(){return r}})},4460:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(5389),i=n(8766);function a(e,t){if(t){if((0,i.Z)(e,1718909296)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `ftyp` box");if((0,i.Z)(e,1836019574)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moov` box")}else{if((0,i.Z)(e,1836019558)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `moof` box");if((0,i.Z)(e,1835295092)<0)throw new r.Z("INTEGRITY_ERROR","Incomplete `mdat` box")}}},8766:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(6968);function i(e,t){for(var n=e.length,i=0;i+8<=n;){var a=(0,r.pX)(e,i);if(0===a)a=n-i;else if(1===a){if(i+16>n)return-1;a=(0,r.pV)(e,i+8)}if(isNaN(a)||a<=0)return-1;if((0,r.pX)(e,i+4)===t)return i+a<=n?i:-1;i+=a}return-1}},8791:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7904),i=n(4597),a=n(7839);function o(e,t){var n=e.customManifestLoader,o=function(e){return function(t,n,a){if(void 0===t)throw new Error("Cannot perform HTTP(s) request. URL not known");switch(e){case"arraybuffer":return(0,i.ZP)({url:t,responseType:"arraybuffer",timeout:n.timeout,cancelSignal:a});case"text":return(0,i.ZP)({url:t,responseType:"text",timeout:n.timeout,cancelSignal:a});case"document":return(0,i.ZP)({url:t,responseType:"document",timeout:n.timeout,cancelSignal:a});default:(0,r.Z)(e)}}}(t);return"function"!=typeof n?o:function(e,t){return function(n,r,i){return new Promise((function(o,s){var u=Date.now()-performance.now(),l=!1,d={reject:function(e){var t,n;if(!l&&!i.isCancelled()){l=!0,i.deregister(f);var r=e,o=null!==(t=null==r?void 0:r.message)&&void 0!==t?t:"Unknown error when fetching the Manifest through a custom manifestLoader.",u=new a.Z(o,null!==(n=null==r?void 0:r.canRetry)&&void 0!==n&&n,null==r?void 0:r.xhr);s(u)}},resolve:function(e){if(!l&&!i.isCancelled()){l=!0,i.deregister(f);var t=void 0!==e.receivingTime?e.receivingTime-u:void 0,n=void 0!==e.sendingTime?e.sendingTime-u:void 0;o({responseData:e.data,size:e.size,requestDuration:e.duration,url:e.url,receivedTime:t,sendingTime:n})}},fallback:function(){l||i.isCancelled()||(l=!0,i.deregister(f),t(n,r,i).then(o,s))}},c=e({url:n,timeout:r.timeout},d);function f(e){l||(l=!0,"function"==typeof c&&c(),s(e))}i.register(f)}))}}(n,o)}},4791:function(e,t,n){"use strict";function r(e,t){if(e.length!==t.length)return!1;for(var n=e.length-1;n>=0;n--)if(e[n]!==t[n])return!1;return!0}n.d(t,{Z:function(){return r}})},3274:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.find)return e.find(t,n);for(var r=e.length>>>0,i=0;i<r;i++){var a=e[i];if(t.call(n,a,i,e))return a}}n.d(t,{Z:function(){return r}})},5138:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.findIndex)return e.findIndex(t,n);for(var r=e.length>>>0,i=0;i<r;i++)if(t.call(n,e[i],i,e))return i;return-1}n.d(t,{Z:function(){return r}})},7714:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof Array.prototype.includes)return e.includes(t,n);var r=e.length>>>0;if(0===r)return!1;for(var i,a,o=0|n,s=o>=0?Math.min(o,r-1):Math.max(r+o,0);s<r;){if((i=e[s])===(a=t)||"number"==typeof i&&"number"==typeof a&&isNaN(i)&&isNaN(a))return!0;s++}return!1}n.d(t,{Z:function(){return r}})},811:function(e,t,n){"use strict";n.d(t,{Z:function(){return i},u:function(){return a}});var r=n(1946);function i(e,t){0}function a(e,t,n){for(var a in void 0===n&&(n="object"),i((0,r.Z)(e)),t)t.hasOwnProperty(a)&&i((e[a],t[a]),t[a])}},7904:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(7326),i=n(4578),a=function(e){function t(n){var i;return i=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(i),t.prototype),i.name="AssertionError",i.message=n,i}return(0,i.Z)(t,e),t}((0,n(2146).Z)(Error));function o(e){throw new a("Unreachable path taken")}},9689:function(e,t,n){"use strict";n.d(t,{J:function(){return s},K:function(){return u}});var r=n(3887),i=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],a=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];function o(e){if(e>=a.length)throw new Error("Unable to parse base64 string.");var t=a[e];if(255===t)throw new Error("Unable to parse base64 string.");return t}function s(e){var t,n="",r=e.length;for(t=2;t<r;t+=3)n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2|e[t]>>6],n+=i[63&e[t]];return t===r+1&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4],n+="=="),t===r&&(n+=i[e[t-2]>>2],n+=i[(3&e[t-2])<<4|e[t-1]>>4],n+=i[(15&e[t-1])<<2],n+="="),n}function u(e){var t=e.length%4,n=e;0!==t&&(r.Z.warn("base64ToBytes: base64 given miss padding"),n+=3===t?"=":2===t?"==":"===");var i=n.indexOf("=");if(-1!==i&&i<n.length-2)throw new Error("Unable to parse base64 string.");for(var a,s=n.endsWith("==")?2:n.endsWith("=")?1:0,u=n.length,l=new Uint8Array(u/4*3),d=0,c=0;d<u;d+=4,c+=3)a=o(n.charCodeAt(d))<<18|o(n.charCodeAt(d+1))<<12|o(n.charCodeAt(d+2))<<6|o(n.charCodeAt(d+3)),l[c]=a>>16,l[c+1]=a>>8&255,l[c+2]=255&a;return l.subarray(0,l.length-s)}},6968:function(e,t,n){"use strict";function r(){for(var e,t=arguments.length,n=-1,r=0;++n<t;)r+="number"==typeof(e=n<0||arguments.length<=n?void 0:arguments[n])?e:e.length;var i=new Uint8Array(r),a=0;for(n=-1;++n<t;)"number"==typeof(e=n<0||arguments.length<=n?void 0:arguments[n])?a+=e:e.length>0&&(i.set(e,a),a+=e.length);return i}function i(e,t){return(e[t+0]<<8)+(e[t+1]<<0)}function a(e,t){return 65536*e[t+0]+256*e[t+1]+e[t+2]}function o(e,t){return 16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3]}function s(e,t){return 4294967296*(16777216*e[t+0]+65536*e[t+1]+256*e[t+2]+e[t+3])+16777216*e[t+4]+65536*e[t+5]+256*e[t+6]+e[t+7]}function u(e){return new Uint8Array([e>>>8&255,255&e])}function l(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}function d(e){var t=e%4294967296,n=(e-t)/4294967296;return new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t])}function c(e,t){return(e[t+0]<<0)+(e[t+1]<<8)}function f(e,t){return e[t+0]+256*e[t+1]+65536*e[t+2]+16777216*e[t+3]}function v(e){return new Uint8Array([255&e,e>>>8&255,e>>>16&255,e>>>24&255])}n.d(t,{O_:function(){return v},QI:function(){return a},XT:function(){return u},dN:function(){return f},el:function(){return d},kh:function(){return l},pV:function(){return s},pX:function(){return o},qb:function(){return c},zK:function(){return i},zo:function(){return r}})},7864:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(7733);function i(e,t){return(0,r.Z)(t,(function(t){var n=setTimeout((function(){return t()}),e);return function(){return clearTimeout(n)}}))}},7733:function(e,t,n){"use strict";function r(e,t){var n;return new Promise((function(r,i){if(null!==e.cancellationError)return i(e.cancellationError);var a=!1;function o(e){void 0!==n&&n(),i(e)}n=t((function(t){e.deregister(o),a=!0,r(t)}),(function(t){e.deregister(o),a=!0,i(t)})),a||e.register(o)}))}n.d(t,{Z:function(){return r}})},1959:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(3887),i=n(1946),a=function(){function e(){this._listeners={}}var t=e.prototype;return t.addEventListener=function(e,t,n){var r=this,i=this._listeners[e];Array.isArray(i)?i.push(t):this._listeners[e]=[t],void 0!==n&&n.register((function(){r.removeEventListener(e,t)}))},t.removeEventListener=function(e,t){if((0,i.Z)(e))this._listeners={};else{var n=this._listeners[e];if(Array.isArray(n))if((0,i.Z)(t))delete this._listeners[e];else{var r=n.indexOf(t);-1!==r&&n.splice(r,1),0===n.length&&delete this._listeners[e]}}},t.trigger=function(e,t){var n=this._listeners[e];Array.isArray(n)&&n.slice().forEach((function(e){try{e(t)}catch(e){r.Z.error("EventEmitter: listener error",e instanceof Error?e:null)}}))},e}()},9592:function(e,t,n){"use strict";function r(e,t){return"function"==typeof Array.prototype.flatMap?e.flatMap(t):e.reduce((function(e,n){var r=t(n);return Array.isArray(r)?(e.push.apply(e,r),e):(e.push(r),e)}),[])}n.d(t,{Z:function(){return r}})},2572:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=.3;function i(e){return e*((2*Math.random()-1)*r+1)}},908:function(e,t,n){"use strict";function r(){var e="",t=-1;return function(){return++t>=Number.MAX_SAFE_INTEGER&&(e+="0",t=0),e+String(t)}}n.d(t,{Z:function(){return r}})},6923:function(e,t,n){"use strict";function r(e){return"string"==typeof e&&e.length>0}n.d(t,{Z:function(){return r}})},1946:function(e,t,n){"use strict";function r(e){return null==e}n.d(t,{Z:function(){return r}})},5288:function(e,t,n){"use strict";n.d(t,{ZP:function(){return u}});var r=n(6923),i=n(1946),a={aa:"aar",ab:"abk",ae:"ave",af:"afr",ak:"aka",am:"amh",an:"arg",ar:"ara",as:"asm",av:"ava",ay:"aym",az:"aze",ba:"bak",be:"bel",bg:"bul",bi:"bis",bm:"bam",bn:"ben",bo:"bod",br:"bre",bs:"bos",ca:"cat",ce:"che",ch:"cha",co:"cos",cr:"cre",cs:"ces",cu:"chu",cv:"chv",cy:"cym",da:"dan",de:"deu",dv:"div",dz:"dzo",ee:"ewe",el:"ell",en:"eng",eo:"epo",es:"spa",et:"est",eu:"eus",fa:"fas",ff:"ful",fi:"fin",fj:"fij",fo:"fao",fr:"fra",fy:"fry",ga:"gle",gd:"gla",gl:"glg",gn:"grn",gu:"guj",gv:"glv",ha:"hau",he:"heb",hi:"hin",ho:"hmo",hr:"hrv",ht:"hat",hu:"hun",hy:"hye",hz:"her",ia:"ina",id:"ind",ie:"ile",ig:"ibo",ii:"iii",ik:"ipk",io:"ido",is:"isl",it:"ita",iu:"iku",ja:"jpn",jv:"jav",ka:"kat",kg:"kon",ki:"kik",kj:"kua",kk:"kaz",kl:"kal",km:"khm",kn:"kan",ko:"kor",kr:"kau",ks:"kas",ku:"kur",kv:"kom",kw:"cor",ky:"kir",la:"lat",lb:"ltz",lg:"lug",li:"lim",ln:"lin",lo:"lao",lt:"lit",lu:"lub",lv:"lav",mg:"mlg",mh:"mah",mi:"mri",mk:"mkd",ml:"mal",mn:"mon",mr:"mar",ms:"msa",mt:"mlt",my:"mya",na:"nau",nb:"nob",nd:"nde",ne:"nep",ng:"ndo",nl:"nld",nn:"nno",no:"nor",nr:"nbl",nv:"nav",ny:"nya",oc:"oci",oj:"oji",om:"orm",or:"ori",os:"oss",pa:"pan",pi:"pli",pl:"pol",ps:"pus",pt:"por",qu:"que",rm:"roh",rn:"run",ro:"ron",ru:"rus",rw:"kin",sa:"san",sc:"srd",sd:"snd",se:"sme",sg:"sag",si:"sin",sk:"slk",sl:"slv",sm:"smo",sn:"sna",so:"som",sq:"sqi",sr:"srp",ss:"ssw",st:"sot",su:"sun",sv:"swe",sw:"swa",ta:"tam",te:"tel",tg:"tgk",th:"tha",ti:"tir",tk:"tuk",tl:"tgl",tn:"tsn",to:"ton",tr:"tur",ts:"tso",tt:"tat",tw:"twi",ty:"tah",ug:"uig",uk:"ukr",ur:"urd",uz:"uzb",ve:"ven",vi:"vie",vo:"vol",wa:"wln",wo:"wol",xh:"xho",yi:"yid",yo:"yor",za:"zha",zh:"zho",zu:"zul"},o={alb:"sqi",arm:"hye",baq:"eus",bur:"mya",chi:"zho",cze:"ces",dut:"nld",fre:"fra",geo:"kat",ger:"deu",gre:"ell",ice:"isl",mac:"mkd",mao:"mri",may:"msa",per:"fas",slo:"slk",rum:"ron",tib:"bod",wel:"cym"};function s(e){if((0,i.Z)(e)||""===e)return"";var t=function(e){var t;switch(e.length){case 2:t=a[e];break;case 3:t=o[e]}return t}((""+e).toLowerCase().split("-")[0]);return(0,r.Z)(t)?t:e}var u=s},8894:function(e,t,n){"use strict";function r(){}n.d(t,{Z:function(){return r}})},8026:function(e,t){"use strict";t.Z="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=0;n<(arguments.length<=1?0:arguments.length-1);n++){var r=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}},1679:function(e,t,n){"use strict";t.Z="function"==typeof Object.values?Object.values:function(e){return Object.keys(e).map((function(t){return e[t]}))}},2829:function(e,t,n){"use strict";n.d(t,{A1:function(){return s},F_:function(){return p},JN:function(){return c},L7:function(){return h},Ti:function(){return u},XS:function(){return v},kR:function(){return m},rx:function(){return f},tn:function(){return y},uH:function(){return _}});var r=1/60;function i(e,t){return Math.abs(e-t)<r}function a(e,t){return{start:Math.min(e.start,t.start),end:Math.max(e.end,t.end)}}function o(e,t){return e.end<=t.start}function s(e,t){for(var n=0;n<e.length;n++)if(u(e[n],t))return!0;return!1}function u(e,t){var n=e.start,r=e.end;return n<=t&&t<r}function l(e,t){return u(e,t.start)||e.start<t.end&&t.end<e.end||u(t,e.start)}function d(e,t){return i(t.start,e.end)||i(t.end,e.start)}function c(e){for(var t=[],n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}function f(e,t){for(var n=e.length-1;n>=0;n--){var r=e.start(n);if(t>=r){var i=e.end(n);if(t<i)return{start:r,end:i}}}return null}function v(e,t){for(var n=e.length,r=0;r<n;r++){var i=e.start(r);if(t<i)return i-t}return 1/0}function p(e,t){for(var n=null,r=[],i=0;i<e.length;i++){var a=e.start(i),o=e.end(i);t<a||t>=o?r.push({start:a,end:o}):n={start:a,end:o}}return{outerRanges:r,innerRange:n}}function h(e,t){var n=f(e,t);return null!==n?n.end-t:1/0}function m(e,t){if(t.start===t.end)return e;for(var n=t,r=0;r<e.length;r++){var i=e[r],s=l(n,i),u=d(n,i);if(s||u)n=a(n,i),e.splice(r--,1);else if(0===r){if(o(n,e[0]))break}else if(o(e[r-1],n)&&o(n,i))break}return e.splice(r,0,n),function(e){for(var t=1;t<e.length;t++){var n=e[t-1],r=e[t];if(d(n,r)){var i=a(n,r);e.splice(--t,2,i)}}return e}(function(e){for(var t=0;t<e.length;t++){var n=e[t];n.start===n.end&&e.splice(t--,1)}return e}(e))}function g(e,t){for(var n=[],r=0;r<t.length;r++)l(e,t[r])&&n.push(t[r]);return n}function y(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=g(i,t);if(a.length>0)for(var o=0;o<a.length;o++){var s=a[o];n.push({start:Math.max(i.start,s.start),end:Math.min(i.end,s.end)})}}return n}function _(e,t){for(var n=[],r=0;r<e.length;r++){var i=e[r],a=[],o=g(i,t);if(o.length>0)for(var s=0;s<o.length;s++){var u=o[s];a.push({start:Math.max(i.start,u.start),end:Math.min(i.end,u.end)})}if(0===a.length)n.push(i);else{for(var l=i.start,d=0;d<a.length;d++)a[d].start>l&&n.push({start:l,end:a[d].start}),l=a[d].end;l<i.end&&n.push({start:l,end:i.end})}}return n}},5095:function(e,t,n){"use strict";function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){var n=e,i=[],a=!1;return void 0!==t&&t.register(o),{getValue:function(){return n},setValue:function(e){if(!a&&(n=e,0!==i.length))for(var t,o=r(i.slice());!(t=o()).done;){var s=t.value;try{s.hasBeenCleared||s.trigger(e,s.complete)}catch(e){}}},setValueIfChanged:function(e){e!==n&&this.setValue(e)},onUpdate:function(e,t){var r={trigger:e,complete:o,hasBeenCleared:!1};function o(){if(void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.deregister(o),!r.hasBeenCleared){r.hasBeenCleared=!0;var e=i.indexOf(r);e>=0&&i.splice(e,1)}}i.push(r),!0===(null==t?void 0:t.emitCurrentValue)&&e(n,o),a||r.hasBeenCleared?o():void 0!==(null==t?void 0:t.clearSignal)&&t.clearSignal.register(o)},waitUntilDefined:function(e,t){this.onUpdate((function(t,r){void 0!==t&&(r(),e(n))}),{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:!0})},finish:o};function o(){void 0!==t&&t.deregister(o),a=!0;for(var e,n=r(i.slice());!(e=n()).done;){var s=e.value;try{s.hasBeenCleared||(s.complete(),s.hasBeenCleared=!0)}catch(e){}}i.length=0}}function o(e,t,n){var r=a(t(e.getValue()),n);return e.onUpdate((function(e){r.setValue(t(e))}),{clearSignal:n}),r}n.d(t,{$l:function(){return a},ZP:function(){return a},lR:function(){return o}})},4597:function(e,t,n){"use strict";n.d(t,{ZP:function(){return o}});var r=n(9105),i=n(6923),a=n(1946);var o=function(e){var t={url:e.url,headers:e.headers,responseType:(0,a.Z)(e.responseType)?"json":e.responseType,timeout:e.timeout};return new Promise((function(n,o){var s,u=e.onProgress,l=e.cancelSignal,d=t.url,c=t.headers,f=t.responseType,v=t.timeout,p=new XMLHttpRequest;if(p.open("GET",d,!0),void 0!==v&&(p.timeout=v,s=window.setTimeout((function(){_(),o(new r.Z(d,p.status,"TIMEOUT"))}),v+3e3)),p.responseType=f,"document"===p.responseType&&p.overrideMimeType("text/xml"),!(0,a.Z)(c)){var h=c;for(var m in h)h.hasOwnProperty(m)&&p.setRequestHeader(m,h[m])}var g=performance.now(),y=null;function _(){void 0!==s&&clearTimeout(s),null!==y&&y()}void 0!==l&&(y=l.register((function(e){_(),(0,a.Z)(p)||4===p.readyState||p.abort(),o(e)})),l.isCancelled())||(p.onerror=function(){_(),o(new r.Z(d,p.status,"ERROR_EVENT"))},p.ontimeout=function(){_(),o(new r.Z(d,p.status,"TIMEOUT"))},void 0!==u&&(p.onprogress=function(e){var t=performance.now();u({url:d,duration:t-g,sendingTime:g,currentTime:t,size:e.loaded,totalSize:e.total})}),p.onload=function(e){if(4===p.readyState)if(_(),p.status>=200&&p.status<300){var t,s=performance.now(),u=p.response instanceof ArrayBuffer?p.response.byteLength:e.total,l=p.status,c=p.responseType,f=(0,i.Z)(p.responseURL)?p.responseURL:d;if(t="json"===c?"object"==typeof p.response?p.response:function(e){try{return JSON.parse(e)}catch(e){return null}}(p.responseText):p.response,(0,a.Z)(t))return void o(new r.Z(d,p.status,"PARSE_ERROR"));n({status:l,url:f,responseType:c,sendingTime:g,receivedTime:s,requestDuration:s-g,size:u,responseData:t})}else o(new r.Z(d,p.status,"ERROR_HTTP_CODE"))},p.send())}))}},9829:function(e,t,n){"use strict";n.d(t,{$:function(){return o},Z:function(){return a}});var r=/^(?:[a-z]+:)?\/\//i,i=/\/\.{1,2}\//;function a(){var e=arguments.length;if(0===e)return"";for(var t="",n=0;n<e;n++){var a=n<0||arguments.length<=n?void 0:arguments[n];"string"==typeof a&&""!==a&&(r.test(a)?t=a:("/"===a[0]&&(a=a.substring(1)),"/"===t[t.length-1]&&(t=t.substring(0,t.length-1)),t=t+"/"+a))}return function(e){if(!i.test(e))return e;for(var t=[],n=e.split("/"),r=0,a=n.length;r<a;r++)if(".."===n[r])t.pop();else{if("."===n[r])continue;t.push(n[r])}return t.join("/")}(t)}function o(e){var t=e.lastIndexOf("/");if(t<0)return e.length;if(r.test(e)){var n=e.indexOf("/");if(n>=0&&t===n+1)return e.length}var i=e.indexOf("?");return i>=0&&i<t?o(e.substring(0,i)):t+1}},9252:function(e,t,n){"use strict";function r(e,t,n){if("function"==typeof String.prototype.startsWith)return e.startsWith(t,n);var r="number"==typeof n?Math.max(n,0):0;return e.substring(r,r+t.length)===t}n.d(t,{Z:function(){return r}})},3635:function(e,t,n){"use strict";n.d(t,{DM:function(){return h},TZ:function(){return s},ci:function(){return v},nr:function(){return f},tG:function(){return l},uR:function(){return c},wO:function(){return p},wV:function(){return u}});var r=n(3887),i=n(811),a="object"==typeof window&&"function"==typeof window.TextDecoder,o="object"==typeof window&&"function"==typeof window.TextEncoder;function s(e){for(var t=new ArrayBuffer(2*e.length),n=new Uint8Array(t),r=0;r<n.length;r+=2){var i=e.charCodeAt(r/2);n[r]=255&i,n[r+1]=i>>8&255}return n}function u(e){if(a)try{return new TextDecoder("utf-16le").decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-16LE, fallbacking to another implementation",t)}for(var n="",i=0;i<e.length;i+=2)n+=String.fromCharCode((e[i+1]<<8)+e[i]);return n}function l(e){if(o)try{return(new TextEncoder).encode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextEncoder to encode string into UTF-8, fallbacking to another implementation",t)}var n,i=encodeURIComponent(e);if("function"==typeof unescape)n=unescape(i);else{var a=/[0-9a-fA-F]/,s=i.length;n="";for(var u=0;u<i.length;u++){var l=!1;if("%"===i[u])if(u<=s-6&&"u"===i[u+1]&&a.test(i[u+2])&&a.test(i[u+3])&&a.test(i[u+4])&&a.test(i[u+5])){var d=parseInt(i.substring(u+1,u+6),16);n+=String.fromCharCode(d),l=!0,u+=5}else if(u<=s-3&&a.test(i[u+1])&&a.test(i[u+2])){var c=parseInt(i.substring(u+1,u+3),16);n+=String.fromCharCode(c),l=!0,u+=2}l||(n+=i[u])}}for(var f=new Uint8Array(n.length),v=0;v<n.length;v++)f[v]=255&n.charCodeAt(v);return f}function d(e,t){var n=e.toString(16);return n.length>=t?n:new Array(t-n.length+1).join("0")+n}function c(e){if(a)try{return(new TextDecoder).decode(e)}catch(e){var t=e instanceof Error?e:"";r.Z.warn("Utils: could not use TextDecoder to parse UTF-8, fallbacking to another implementation",t)}var n=e;239===n[0]&&187===n[1]&&191===n[2]&&(n=n.subarray(3));var i,o=function(e){for(var t="",n=0;n<e.length;n+=16e3){var r=e.subarray(n,n+16e3);t+=String.fromCharCode.apply(null,r)}return t}(n);if("function"==typeof escape)i=escape(o);else{var s=/[A-Za-z0-9*_\+-\.\/]/;i="";for(var u=0;u<o.length;u++)if(s.test(o[u]))i+=o[u];else{var l=o.charCodeAt(u);i+=l>=256?"%u"+d(l,4):"%"+d(l,2)}}return decodeURIComponent(i)}function f(e){for(var t=e.length,n=new Uint8Array(t/2),r=0,i=0;r<t;r+=2,i++)n[i]=255&parseInt(e.substring(r,r+2),16);return n}function v(e,t){void 0===t&&(t="");for(var n="",r=0;r<e.byteLength;r++)n+=(e[r]>>>4).toString(16),n+=(15&e[r]).toString(16),t.length>0&&r<e.byteLength-1&&(n+=t);return n}function p(e){(0,i.Z)(16===e.length,"GUID length should be 16");var t=e[0],n=e[1],r=e[2],a=e[3],o=e[4],s=e[5],u=e[6],l=e[7],d=new Uint8Array(16);return d[0]=a,d[1]=r,d[2]=n,d[3]=t,d[4]=s,d[5]=o,d[6]=l,d[7]=u,d.set(e.subarray(8,16),8),d}function h(e,t){for(var n=t;n<e.length;){if(0===e[n])break;n+=1}return{end:n+1,string:c(e.subarray(t,n))}}},5278:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(1946);function i(){for(var e=0,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];for(var a=n.length;e<a;){var o=n[e];if(!(0,r.Z)(o))return o;e++}}},288:function(e,t,n){"use strict";n.d(t,{FU:function(){return c},XG:function(){return d},ZP:function(){return l}});var r=n(7326),i=n(4578),a=n(2146),o=n(3887),s=n(811),u=n(8894),l=function(){function e(){var e,t=(e=u.Z,[function(t){e(t)},function(t){e=t}]),n=t[0],r=t[1];this._isUsed=!1,this._trigger=n,this.signal=new d(r)}var t=e.prototype;return t.isUsed=function(){return this._isUsed},t.linkToSignal=function(e){var t=this,n=e.register((function(){t.cancel()}));return this.signal.register(n),n},t.cancel=function(e){if(!this._isUsed){this._isUsed=!0;var t=null!=e?e:new c;this._trigger(t)}},e.isCancellationError=function(e){return e instanceof c},e}(),d=function(){function e(e){var t=this;this._isCancelled=!1,this.cancellationError=null,this._listeners=[],e((function(e){for(t.cancellationError=e,t._isCancelled=!0;t._listeners.length>0;)try{var n=t._listeners.pop();null==n||n(e)}catch(e){o.Z.error("Error while calling clean up listener",e instanceof Error?e.toString():"Unknown error")}}))}var t=e.prototype;return t.isCancelled=function(){return this._isCancelled},t.register=function(e){var t=this;return this._isCancelled?((0,s.Z)(null!==this.cancellationError),e(this.cancellationError),u.Z):(this._listeners.push(e),function(){return t.deregister(e)})},t.deregister=function(e){for(var t=this._listeners.length-1;t>=0;t--)this._listeners[t]===e&&this._listeners.splice(t,1)},e}(),c=function(e){function t(){var n;return n=e.call(this)||this,Object.setPrototypeOf((0,r.Z)(n),t.prototype),n.name="CancellationError",n.message="This task was cancelled.",n}return(0,i.Z)(t,e),t}((0,a.Z)(Error))},8806:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(7714),i=[];function a(e){(0,r.Z)(i,e)||(console.warn(e),i.push(e))}},7473:function(e){"use strict";var t=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e},n=function(e){var n,r,i=document.createTextNode(""),a=0;return new e((function(){var e;if(n)r&&(n=r.concat(n));else{if(!r)return;n=r}if(r=n,n=null,"function"==typeof r)return e=r,r=null,void e();for(i.data=a=++a%2;r;)e=r.shift(),r.length||(r=null),e()})).observe(i,{characterData:!0}),function(e){t(e),n?"function"==typeof n?n=[n,e]:n.push(e):(n=e,i.data=a=++a%2)}};e.exports=function(){if("object"==typeof process&&process&&"function"==typeof process.nextTick)return process.nextTick;if("function"==typeof queueMicrotask)return function(e){queueMicrotask(t(e))};if("object"==typeof document&&document){if("function"==typeof MutationObserver)return n(MutationObserver);if("function"==typeof WebKitMutationObserver)return n(WebKitMutationObserver)}return"function"==typeof setImmediate?function(e){setImmediate(t(e))}:"function"==typeof setTimeout||"object"==typeof setTimeout?function(e){setTimeout(t(e),0)}:null}()},7061:function(e,t,n){var r=n(8698).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",d=s.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:k(e,n,s)}),a}function v(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var p={};function h(){}function m(){}function g(){}var y={};c(y,u,(function(){return this}));var _=Object.getPrototypeOf,b=_&&_(_(Z([])));b&&b!==n&&a.call(b,u)&&(y=b);var S=g.prototype=h.prototype=Object.create(y);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(i,o,s,u){var l=v(e[i],e,o);if("throw"!==l.type){var d=l.arg,c=d.value;return c&&"object"==r(c)&&a.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(c).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function k(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return x()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=v(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=v(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function Z(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:x}}function x(){return{value:void 0,done:!0}}return m.prototype=g,o(S,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:m,configurable:!0}),m.displayName=c(g,d,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,d,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},E(T.prototype),c(T.prototype,l,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new T(f(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},E(S),c(S,d,"Generator"),c(S,u,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=Z,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:Z(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:function(e,t,n){var r=n(7061)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},7326:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,{Z:function(){return r}})},5861:function(e,t,n){"use strict";function r(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function s(e){r(o,i,a,s,u,"next",e)}function u(e){r(o,i,a,s,u,"throw",e)}s(void 0)}))}}n.d(t,{Z:function(){return i}})},1656:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e){var t=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===r(t)?t:String(t)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.d(t,{Z:function(){return o}})},4578:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(9611);function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,(0,r.Z)(e,t)}},9611:function(e,t,n){"use strict";function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}n.d(t,{Z:function(){return r}})},2146:function(e,t,n){"use strict";function r(e){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},r(e)}n.d(t,{Z:function(){return o}});var i=n(9611);function a(e,t,n){return a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&(0,i.Z)(a,n.prototype),a},a.apply(null,arguments)}function o(e){var t="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return a(e,arguments,r(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),(0,i.Z)(o,e)},o(e)}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};return function(){"use strict";n.d(r,{default:function(){return Bn}});var e=n(1656),t=n(4578),i=n(3038);function a(e){var t=e;if("function"==typeof t.getStartDate){var n=t.getStartDate();if("object"==typeof n&&null!==n){var r=+n;if(!isNaN(r))return r/1e3}else if("number"==typeof n&&!isNaN(n))return n}}var o=n(3666),s=n(3887);function u(){if(!o.vU)return!0;var e=function(){if(!o.vU)return s.Z.warn("Compat: Can't access Firefox version on no firefox browser."),null;var e=navigator.userAgent,t=/Firefox\/([0-9]+)\./.exec(e);if(null===t)return-1;var n=parseInt(t[1],10);return isNaN(n)?-1:n}();if(null===e||e<67)return!0;var t=null===HTMLVideoElement||void 0===HTMLVideoElement?void 0:HTMLVideoElement.prototype;return void 0!==(null==t?void 0:t.requirePictureInPicture)}var l=n(6872),d=n(8750),c=n(3714),f=n(5992),v=n(7874),p=n(3274),h=n(7714),m=n(811),g=n(7904),y=n(1959),_=n(908),b=n(1946),S=n(8026),E=n(2829),T=n(5095),k=n(288),w=n(5861),A=n(4687),I=n.n(A),R=n(6139),Z=n(770);function x(e){return P.apply(this,arguments)}function P(){return(P=(0,w.Z)(I().mark((function e(t){var n,r;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==(n=Z.Z.getState(t))){e.next=3;break}return e.abrupt("return");case 3:return s.Z.info("DRM: Disposing of the current MediaKeys"),r=n.loadedSessionsStore,Z.Z.clearState(t),e.next=8,r.closeAllSessions();case 8:(0,R.Y)(t,null);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(e){var t=Z.Z.getState(e);return null===t?null:[t.mediaKeySystemAccess.keySystem,t.mediaKeySystemAccess.getConfiguration()]}function C(e){if(s.Z.info("DRM: Clearing-up DRM session."),o.fq)return s.Z.info("DRM: disposing current MediaKeys."),x(e);var t=Z.Z.getState(e);return null!==t&&!0===t.keySystemOptions.closeSessionsOnStop?(s.Z.info("DRM: closing all current sessions."),t.loadedSessionsStore.closeAllSessions()):(s.Z.info("DRM: Nothing to clear. Returning right away. No state =",null===t),Promise.resolve())}var D=n(7733),N=n(8894),O=n(5278),L=n(5138);function U(e){var t=e.map((function(t){return Math.log(t/e[0])})),n=t.map((function(e){return e-t[0]+1})),r=(n[n.length-1]-1)/(2*e.length+10),i=1/r;return e.map((function(e,t){return a(t)}));function a(t){if(0===t)return 0;var o=Math.min(Math.max(1,t),e.length-1);return e[o]===e[o-1]?a(t-1):i*(r+(e[o]*n[o-1]-e[o-1]*n[o])/(e[o]-e[o-1]))+4}}var B=function(){function e(e){this._levelsMap=U(e).map((function(e){return e+4})),this._bitrates=e,this._lastUnsuitableQualityTimestamp=void 0,this._blockRaiseDelay=6e3,s.Z.debug("ABR: Steps for buffer based chooser.",this._levelsMap.map((function(t,n){return"bufferLevel: "+t+", bitrate: "+e[n]})).join(" ,"))}return e.prototype.getEstimate=function(e){var t=this._levelsMap,n=this._bitrates,r=e.bufferGap,i=e.currentBitrate,a=e.currentScore,o=e.speed;if(null==i)return n[0];for(var u,l=-1,d=0;d<n.length;d++){var c=n[d];if(c===i)l=d;else if(c>i)break}if(l<0||n.length!==t.length)return s.Z.error("ABR: Current Bitrate not found in the calculated levels"),n[0];void 0!==a&&(u=0===o?a.score:a.score/o);var f=isFinite(r)?r:0,v=performance.now();if(f<t[l]||void 0!==u&&u<1&&1===(null==a?void 0:a.confidenceLevel)){if((void 0===this._lastUnsuitableQualityTimestamp?-1:v-this._lastUnsuitableQualityTimestamp)<this._blockRaiseDelay+9e3){var p=this._blockRaiseDelay+3e3;this._blockRaiseDelay=Math.min(p,15e3),s.Z.debug("ABR: Incrementing blocking raise in BufferBasedChooser due to unstable quality",this._blockRaiseDelay)}else{var h=this._blockRaiseDelay-1e3;this._blockRaiseDelay=Math.max(6e3,h),s.Z.debug("ABR: Lowering quality in BufferBasedChooser",this._blockRaiseDelay)}this._lastUnsuitableQualityTimestamp=v;for(var m=(0,L.Z)(n,(function(e){return e===i}))-1;m>=0;m--)if(f>=t[m])return n[m];return n[0]}if(void 0!==this._lastUnsuitableQualityTimestamp&&v-this._lastUnsuitableQualityTimestamp<this._blockRaiseDelay||void 0===u||u<1.15||1!==(null==a?void 0:a.confidenceLevel))return i;var g=t[l],y=function(){for(var e=l+1;e<t.length;e++)if(t[e]>g)return e}();if(void 0!==y&&r>=t[y])return s.Z.debug("ABR: Raising quality in BufferBasedChooser",n[y]),n[y];return i},e}(),F=function(){function e(e){this._alpha=Math.exp(Math.log(.5)/e),this._lastEstimate=0,this._totalWeight=0}var t=e.prototype;return t.addSample=function(e,t){var n=Math.pow(this._alpha,e),r=t*(1-n)+n*this._lastEstimate;isNaN(r)||(this._lastEstimate=r,this._totalWeight+=e)},t.getEstimate=function(){var e=1-Math.pow(this._alpha,this._totalWeight);return this._lastEstimate/e},e}();function z(e){if(!(e.progress.length<5)){for(var t=new F(2),n=e.progress,r=1;r<n.length;r++){var i=n[r].size-n[r-1].size,a=n[r].timestamp-n[r-1].timestamp,o=8*i/(a/1e3);t.addSample(a/1e3,o)}return t.getEstimate()}}function V(e,t){var n=8*(e.totalSize-e.size);return Math.max(n/t,0)}var K=function(){function e(e,t){var n=l.Z.getCurrent(),r=n.ABR_STARVATION_GAP,i=n.OUT_OF_STARVATION_GAP,a=n.ABR_STARVATION_FACTOR,o=n.ABR_REGULAR_FACTOR;this._initialBitrate=e,this._inStarvationMode=!1,this._lowLatencyMode=t,this._config=t?{starvationGap:r.LOW_LATENCY,outOfStarvationGap:i.LOW_LATENCY,starvationBitrateFactor:a.LOW_LATENCY,regularBitrateFactor:o.LOW_LATENCY}:{starvationGap:r.DEFAULT,outOfStarvationGap:i.DEFAULT,starvationBitrateFactor:a.DEFAULT,regularBitrateFactor:o.DEFAULT}}var t=e.prototype;return t.getBandwidthEstimate=function(e,t,n,r,i){var a,o,u=this._config,d=e.bufferGap,c=e.position,f=e.duration,v=isFinite(d)?d:0,p=l.Z.getCurrent().ABR_STARVATION_DURATION_DELTA;return isNaN(f)||v+c.last<f-p?!this._inStarvationMode&&v<=u.starvationGap?(s.Z.info("ABR: enter starvation mode."),this._inStarvationMode=!0):this._inStarvationMode&&v>=u.outOfStarvationGap&&(s.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1):this._inStarvationMode&&(s.Z.info("ABR: exit starvation mode."),this._inStarvationMode=!1),this._inStarvationMode&&(o=function(e,t,n,r,i){if(!r){var a=t.bufferGap,o=t.speed,s=t.position,u=isFinite(a)?a:0,l=function(e,t){for(var n=-1,r=0;r<e.length;r++){var i=e[r].content.segment;if(!(i.duration<=0)){var a=i.time+i.duration;if(!i.complete&&r===e.length-1&&t-i.time>-1.2){n=r;break}if(a>t&&t-i.time>-1.2){n=r;break}}}if(n<0)return[];for(var o=e[n],s=o.content.segment.time,u=[o],l=n+1;l<e.length&&e[l].content.segment.time===s;l++)u.push(e[l]);return u}(e,s.last+u);if(1===l.length){var d=l[0],c=performance.now(),f=1.5*d.content.segment.duration;if(f=Math.min(f,3e3),f=Math.max(f,12e3),!(c-d.requestTimestamp<f)){var v=d.progress.length>0?d.progress[d.progress.length-1]:void 0,p=z(d);if(void 0!==v&&void 0!==p){var h=V(v,p);if((c-v.timestamp)/1e3<=h&&h-u/o>2500)return p}if(d.content.segment.complete){var m=d.content.segment.duration,g=(c-d.requestTimestamp)/1e3;if(null!=n&&!(g<=(1.5*m+2)/o)){var y=m/g,_=n.bitrate*Math.min(.7,y);return void 0===i||_<i?_:void 0}}}}}}(r,e,n,this._lowLatencyMode,i),null!=o&&(s.Z.info("ABR: starvation mode emergency estimate:",o),t.reset(),a=null==n?o:Math.min(o,n.bitrate))),null==a&&(a=null!=(o=t.getEstimate())?o*(this._inStarvationMode?u.starvationBitrateFactor:u.regularBitrateFactor):null!=i?i*(this._inStarvationMode?u.starvationBitrateFactor:u.regularBitrateFactor):this._initialBitrate),e.speed>1&&(a/=e.speed),{bandwidthEstimate:o,bitrateChosen:a}},t.isUrgent=function(e,t,n,r){return null===t||!(e>=t.bitrate)&&function(e,t,n){if(n)return!0;var r=isFinite(e.bufferGap)?e.bufferGap:0,i=e.position.last+r,a=(0,p.Z)(t,(function(e){var t=e.content;return t.segment.duration>0&&t.segment.time+t.segment.duration>i}));if(void 0===a)return!0;var o=performance.now(),s=a.progress.length>0?a.progress[a.progress.length-1]:void 0,u=z(a);if(void 0===s||void 0===u)return!0;var l=V(s,u);return(o-s.timestamp)/1e3>1.2*l||l-r/e.speed>-1.5}(r,n,this._lowLatencyMode)},e}();function G(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var H=function(){function e(e,t){this._scoreCalculator=e,this._lastAbrEstimate=t,this._consecutiveWrongGuesses=0,this._blockGuessesUntil=0,this._lastMaintanableBitrate=null}var t=e.prototype;return t.getGuess=function(e,t,n,r,i){var a=t.bufferGap,o=t.speed,u=this._lastAbrEstimate.representation;if(null===u)return null;if(r>u.bitrate)return 2===this._lastAbrEstimate.algorithmType&&(null!==this._lastAbrEstimate.representation&&(this._lastMaintanableBitrate=this._lastAbrEstimate.representation.bitrate),this._consecutiveWrongGuesses=0),null;var l=this._scoreCalculator.getEstimate(n);if(2!==this._lastAbrEstimate.algorithmType){if(void 0===l)return null;if(this._canGuessHigher(a,o,l)){var d=W(e,n);if(null!==d)return d}return null}if(this._isLastGuessValidated(u,r,l)&&(s.Z.debug("ABR: Guessed Representation validated",u.bitrate),this._lastMaintanableBitrate=u.bitrate,this._consecutiveWrongGuesses=0),n.id!==u.id)return u;if(this._shouldStopGuess(n,l,a,i))return this._consecutiveWrongGuesses++,this._blockGuessesUntil=performance.now()+Math.min(15e3*this._consecutiveWrongGuesses,12e4),function(e,t){var n=(0,L.Z)(e,(function(e){return e.id===t.id}));if(n<0)return s.Z.error("ABR: Current Representation not found."),null;for(;--n>=0;)if(e[n].bitrate<t.bitrate)return e[n];return null}(e,n);if(void 0===l)return n;if(this._canGuessHigher(a,o,l)){var c=W(e,n);if(null!==c)return c}return n},t._canGuessHigher=function(e,t,n){var r=n.score,i=n.confidenceLevel;return isFinite(e)&&e>=2.5&&performance.now()>this._blockGuessesUntil&&1===i&&r/t>1.01},t._shouldStopGuess=function(e,t,n,r){if(void 0!==t&&t.score<1.01)return!0;if((void 0===t||t.score<1.2)&&n<.6)return!0;for(var i,a=r.filter((function(t){return t.content.representation.id===e.id})),o=performance.now(),s=G(a);!(i=s()).done;){var u=i.value,l=o-u.requestTimestamp;if(u.content.segment.isInit){if(l>1e3)return!0}else{if(l>1e3*u.content.segment.duration+200)return!0;var d=z(u);if(void 0!==d&&d<.8*e.bitrate)return!0}}return!1},t._isLastGuessValidated=function(e,t,n){return void 0!==n&&1===n.confidenceLevel&&n.score>1.5||t>=e.bitrate&&(null===this._lastMaintanableBitrate||this._lastMaintanableBitrate<e.bitrate)},e}();function W(e,t){var n=e.length,r=(0,L.Z)(e,(function(e){return e.id===t.id}));if(r<0)return s.Z.error("ABR: Current Representation not found."),null;for(;++r<n;)if(e[r].bitrate>t.bitrate)return e[r];return null}var q=function(){function e(){var e=l.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new F(t),this._slowEWMA=new F(n),this._bytesSampled=0}var t=e.prototype;return t.addSample=function(e,t){if(!(t<l.Z.getCurrent().ABR_MINIMUM_CHUNK_SIZE)){var n=8e3*t/e,r=e/1e3;this._bytesSampled+=t,this._fastEWMA.addSample(r,n),this._slowEWMA.addSample(r,n)}},t.getEstimate=function(){var e=l.Z.getCurrent().ABR_MINIMUM_TOTAL_BYTES;if(!(this._bytesSampled<e))return Math.min(this._fastEWMA.getEstimate(),this._slowEWMA.getEstimate())},t.reset=function(){var e=l.Z.getCurrent(),t=e.ABR_FAST_EMA,n=e.ABR_SLOW_EMA;this._fastEWMA=new F(t),this._slowEWMA=new F(n),this._bytesSampled=0},e}();var Y=function(){function e(){this.bandwidth=void 0,this.representation=null,this.algorithmType=3}return e.prototype.update=function(e,t,n){this.representation=e,this.bandwidth=t,this.algorithmType=n},e}(),X=n(1679),Q=function(){function e(){this._currentRequests={}}var t=e.prototype;return t.add=function(e){var t=e.id,n=e.requestTimestamp,r=e.content;this._currentRequests[t]={requestTimestamp:n,progress:[],content:r}},t.addProgress=function(e){var t=this._currentRequests[e.id];null!=t?t.progress.push(e):s.Z.warn("ABR: progress for a request not added")},t.remove=function(e){null==this._currentRequests[e]&&s.Z.warn("ABR: can't remove unknown request"),delete this._currentRequests[e]},t.getRequests=function(){return(0,X.Z)(this._currentRequests).filter((function(e){return null!=e})).sort((function(e,t){return e.content.segment.time-t.content.segment.time}))},e}(),$=function(){function e(){this._currentRepresentationData=null,this._lastRepresentationWithGoodScore=null}var t=e.prototype;return t.addSample=function(e,t,n){var r,i=n/t,a=this._currentRepresentationData;null!==a&&a.representation.id===e.id?(r=a.ewma,a.ewma.addSample(t,i),a.loadedDuration+=n,a.loadedSegments++):((r=new F(5)).addSample(t,i),this._currentRepresentationData={representation:e,ewma:r,loadedDuration:n,loadedSegments:0}),r.getEstimate()>1&&this._lastRepresentationWithGoodScore!==e&&(s.Z.debug("ABR: New last stable representation",e.bitrate),this._lastRepresentationWithGoodScore=e)},t.getEstimate=function(e){if(null!==this._currentRepresentationData&&this._currentRepresentationData.representation.id===e.id){var t=this._currentRepresentationData,n=t.ewma,r=t.loadedSegments,i=t.loadedDuration;return{score:n.getEstimate(),confidenceLevel:r>=5&&i>=10?1:0}}},t.getLastStableRepresentation=function(){return this._lastRepresentationWithGoodScore},e}();function J(e,t){var n=(0,L.Z)(e,(function(e){return e.bitrate>t}));return-1===n?e[e.length-1]:0===n?e[0]:e[n-1]}var ee=(0,T.ZP)(void 0);ee.finish();var te=(0,T.ZP)(1/0);te.finish();var ne=function(e){var t={},n=e.initialBitrates,r=e.throttlers,i=e.lowLatencyMode;return function(e,a,o,u,d){var c=e.adaptation.type,f=function(e){var n=t[e];if(null==n){s.Z.debug("ABR: Creating new BandwidthEstimator for ",e);var r=new q;return t[e]=r,r}return n}(c),v=(0,O.Z)(n[c],0);return function(e,t){var n=e.bandwidthEstimator,r=e.context,i=e.currentRepresentation,a=e.filters,o=e.initialBitrate,u=e.lowLatencyMode,d=e.playbackObserver,c=e.representations,f=new $,v=new K(null!=o?o:0,u),h=new Q,m=N.Z,g={metrics:w,requestBegin:A,requestProgress:I,requestEnd:R,addedSegment:function(e){m(e)}},y=new k.ZP;y.linkToSignal(t);var _=b(c.getValue(),y.signal);return c.onUpdate(S,{clearSignal:t}),{estimates:_,callbacks:g};function b(e,t){if(1===e.length)return(0,T.ZP)({bitrate:void 0,representation:e[0],urgent:!0,knownStableBitrate:void 0});var o,c=!1,g=e.map((function(e){return e.bitrate})),y=new B(g),_=new Y,b=new H(f,_),S=d.getReference().getValue(),k=(0,T.ZP)(A());return d.listen((function(e){S=e,w()}),{includeLastObservation:!1,clearSignal:t}),m=function(e){if(null!==S){var t=S,n=t.position,r=t.speed,i=e.buffered,a=(0,E.L7)(i,n.last),s=e.content.representation,u=f.getEstimate(s),l={bufferGap:a,currentBitrate:s.bitrate,currentScore:u,speed:r};o=y.getEstimate(l),w()}},t.register((function(){m=N.Z})),a.throttleBitrate.onUpdate(w,{clearSignal:t}),a.limitResolution.onUpdate(w,{clearSignal:t}),k;function w(){k.setValue(A())}function A(){var t=S,d=t.bufferGap,m=t.position,g=t.maximumPosition,y=a.limitResolution.getValue(),E=a.throttleBitrate.getValue(),T=i.getValue(),k=function(e,t,n){var r=e;void 0!==n&&n<1/0&&(r=function(e,t){if(0===e.length)return[];e.sort((function(e,t){return e.bitrate-t.bitrate}));var n=e[0].bitrate,r=Math.max(t,n),i=(0,L.Z)(e,(function(e){return e.bitrate>r}));return-1===i?e:e.slice(0,i)}(r,n));void 0!==t&&(r=function(e,t){if(void 0===t.width||void 0===t.height)return e;var n=t.width*t.pixelRatio,r=t.height*t.pixelRatio,i=e.slice().sort((function(e,t){return(0,O.Z)(e.width,0)-(0,O.Z)(t.width,0)})),a=(0,p.Z)(i,(function(e){return"number"==typeof e.width&&e.width>=n&&"number"==typeof e.height&&e.height>=r}));if(void 0===a)return e;var o="number"==typeof a.width?a.width:0;return e.filter((function(e){return"number"!=typeof e.width||e.width<=o}))}(r,t));return r}(e,y,E),w=h.getRequests(),A=v.getBandwidthEstimate(S,n,T,w,_.bandwidth),I=A.bandwidthEstimate,R=A.bitrateChosen,Z=f.getLastStableRepresentation(),x=null===Z?void 0:Z.bitrate/(S.speed>0?S.speed:1),P=l.Z.getCurrent(),M=P.ABR_ENTER_BUFFER_BASED_ALGO,C=P.ABR_EXIT_BUFFER_BASED_ALGO;c&&d<=C?c=!1:!c&&isFinite(d)&&d>=M&&(c=!0);var D=J(k,R),N=D.bitrate,U=null;c&&void 0!==o&&o>N&&(N=(U=J(k,o)).bitrate);var B=null;return u&&null!==T&&r.manifest.isDynamic&&g-m.last<40&&(B=b.getGuess(e,S,T,N,w)),null!==B&&B.bitrate>N?(s.Z.debug("ABR: Choosing representation with guess-based estimation.",B.bitrate,B.id),_.update(B,I,2),{bitrate:I,representation:B,urgent:null===T||B.bitrate<T.bitrate,knownStableBitrate:x}):null!==U?(s.Z.debug("ABR: Choosing representation with buffer-based estimation.",U.bitrate,U.id),_.update(U,I,0),{bitrate:I,representation:U,urgent:v.isUrgent(U.bitrate,T,w,S),knownStableBitrate:x}):(s.Z.debug("ABR: Choosing representation with bandwidth estimation.",D.bitrate,D.id),_.update(D,I,1),{bitrate:I,representation:D,urgent:v.isUrgent(D.bitrate,T,w,S),knownStableBitrate:x})}}function S(){var e=c.getValue();y.cancel(),(y=new k.ZP).linkToSignal(t),b(e,y.signal).onUpdate((function(e){_.setValue(e)}),{clearSignal:y.signal,emitCurrentValue:!0})}function w(e){var t=e.requestDuration,r=e.segmentDuration,i=e.size,a=e.content;if(n.addSample(t,i),!a.segment.isInit){var o=a.segment,s=a.representation;if(void 0===r&&!o.complete)return;var u=null!=r?r:o.duration;f.addSample(s,t/1e3,u)}}function A(e){h.add(e)}function I(e){h.addProgress(e)}function R(e){h.remove(e.id)}}({bandwidthEstimator:f,context:e,currentRepresentation:a,filters:{limitResolution:(0,O.Z)(r.limitResolution[c],ee),throttleBitrate:(0,O.Z)(r.throttleBitrate[c],te)},initialBitrate:v,playbackObserver:u,representations:o,lowLatencyMode:i},d)}},re=n(8619),ie=n(9105),ae=n(9362);function oe(e){return e instanceof ie.Z?new ae.Z("PIPELINE_LOAD_ERROR",e):(0,d.Z)(e,{defaultCode:"PIPELINE_LOAD_ERROR",defaultReason:"Unknown error when fetching the Manifest"})}var se=n(7839),ue=n(9822),le=n(7864),de=n(2572);function ce(e,t,n,r,i){return fe.apply(this,arguments)}function fe(){return fe=(0,w.Z)(I().mark((function e(t,n,r,i,a){var o,u,l,d,c,v,p,h,m,g,y,_,b;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(b=function(e){var t;if(0===c.size)return e[0];var n=performance.now();return null===(t=e.filter((function(e){var t;return!0!==(null===(t=c.get(e))||void 0===t?void 0:t.isBlacklisted)})).reduce((function(e,t){var r,i=null===(r=c.get(t))||void 0===r?void 0:r.blockedUntil;return void 0!==i&&i<=n&&(i=void 0),void 0===e?[t,i]:void 0===i?void 0===e[1]?e:[t,void 0]:void 0===e[1]?e:i<e[1]?[t,i]:e}),void 0))||void 0===t?void 0:t[0]},_=function(e,t){var r=c.get(e);if(void 0===r||void 0===r.blockedUntil)return h(e);var i=performance.now(),o=r.blockedUntil-i;if(o<=0)return h(e);var s=new k.ZP,u=s.linkToSignal(a);return new Promise((function(r,i){function l(e){u(),r(e)}function d(e){u(),i(e)}null==n||n.addEventListener("priorityChange",(function(){var n=p();if(a.isCancelled())throw a.cancellationError;if(void 0===n)return d(t);n!==e&&(s.cancel(),_(n,t).then(l,d))}),s.signal),(0,le.Z)(o,s.signal).then((function(){return h(e).then(l,d)}),N.Z)}))},y=function(){return(y=(0,w.Z)(I().mark((function e(t){var n;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=p(),!a.isCancelled()){e.next=3;break}throw a.cancellationError;case 3:if(void 0!==n){e.next=5;break}throw t;case 5:if(d(t),!a.isCancelled()){e.next=8;break}throw a.cancellationError;case 8:return e.abrupt("return",_(n,t));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)},g=function(e){return y.apply(this,arguments)},m=function(){return(m=(0,w.Z)(I().mark((function e(t){var i,s,d,v,p;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r(t,a);case 3:return i=e.sent,e.abrupt("return",i);case 7:if(e.prev=7,e.t0=e.catch(0),!k.ZP.isCancellationError(e.t0)){e.next=11;break}throw e.t0;case 11:if(null!==t&&null!==n&&n.downgradeCdn(t),void 0===(s=c.get(t))?(s={errorCounter:1,blockedUntil:void 0,isBlacklisted:!1},c.set(t,s)):s.errorCounter++,(h=e.t0)instanceof ie.Z?h.type===f.br.ERROR_HTTP_CODE?h.status>=500||404===h.status||415===h.status||412===h.status:h.type===f.br.TIMEOUT||h.type===f.br.ERROR_EVENT:h instanceof se.Z?"boolean"==typeof h.canRetry?h.canRetry:void 0!==h.xhr&&(h.xhr.status>=500||404===h.xhr.status||415===h.xhr.status||412===h.xhr.status):(0,ue.Z)(h)&&"INTEGRITY_ERROR"===h.code){e.next=18;break}return s.blockedUntil=void 0,s.isBlacklisted=!0,e.abrupt("return",g(e.t0));case 18:return s.errorCounter>l?(s.blockedUntil=void 0,s.isBlacklisted=!0):(d=s.errorCounter,v=Math.min(o*Math.pow(2,d-1),u),p=(0,de.Z)(v),s.blockedUntil=performance.now()+p),e.abrupt("return",g(e.t0));case 20:case"end":return e.stop()}var h}),e,null,[[0,7]])})))).apply(this,arguments)},h=function(e){return m.apply(this,arguments)},p=function(){if(null===t){var e=c.get(null);if(void 0!==e&&e.isBlacklisted)return;return null}if(null===n)return b(t);var r=n.getCdnPreferenceForResource(t);return b(r)},null===a.cancellationError){e.next=9;break}return e.abrupt("return",Promise.reject(a.cancellationError));case 9:if(o=i.baseDelay,u=i.maxDelay,l=i.maxRetry,d=i.onRetry,null!==t&&0===t.length&&s.Z.warn("Fetchers: no CDN given to `scheduleRequestWithCdns`."),c=new Map,void 0!==(v=p())){e.next=15;break}throw new Error("No CDN to request");case 15:return e.abrupt("return",h(v));case 16:case"end":return e.stop()}}),e)}))),fe.apply(this,arguments)}function ve(e,t,n){return ce(null,null,e,t,n)}function pe(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return he(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return he(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var me=function(e){function n(t,n,r){var i;return(i=e.call(this)||this).scheduleManualRefresh=N.Z,i._manifestUrls=t,i._pipelines=n.manifest,i._settings=r,i._canceller=new k.ZP,i._isStarted=!1,i._isRefreshPending=!1,i._consecutiveUnsafeMode=0,i._prioritizedContentUrl=null,i}(0,t.Z)(n,e);var r=n.prototype;return r.dispose=function(){this._canceller.cancel(),this.removeEventListener()},r.start=function(){var e=this;if(!this._isStarted){this._isStarted=!0;var t=this._settings.initialManifest;(t instanceof re.ZP?Promise.resolve({manifest:t}):void 0!==t?this.parse(t,{previousManifest:null,unsafeMode:!1},void 0):this._fetchManifest(void 0).then((function(e){return e.parse({previousManifest:null,unsafeMode:!1})}))).then((function(t){e.trigger("manifestReady",t.manifest),e._canceller.isUsed()||e._recursivelyRefreshManifest(t.manifest,t)})).catch((function(t){return e._onFatalError(t)}))}},r.updateContentUrls=function(e,t){var n;this._prioritizedContentUrl=null!==(n=null==e?void 0:e[0])&&void 0!==n?n:void 0,t&&this.scheduleManualRefresh({enablePartialRefresh:!1,delay:0,canUseUnsafeMode:!1})},r._fetchManifest=function(){var e=(0,w.Z)(I().mark((function e(t){var n,r,i,a,o,s,u,d,c=this;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=function(e){var t=a.loadManifest,n=(0,b.Z)(i.requestTimeout)?l.Z.getCurrent().DEFAULT_REQUEST_TIMEOUT:i.requestTimeout;n<0&&(n=void 0);return ve((function(){return t(e,{timeout:n},r)}),s,r)},r=this._canceller.signal,i=this._settings,a=this._pipelines,o=null!=t?t:null===(n=this._manifestUrls)||void 0===n?void 0:n[0],s=this._getBackoffSetting((function(e){c.trigger("warning",oe(e))})),e.prev=6,e.next=9,d(o);case 9:return u=e.sent,e.abrupt("return",{parse:function(e){return c._parseLoadedManifest(u,e,o)}});case 13:throw e.prev=13,e.t0=e.catch(6),oe(e.t0);case 16:case"end":return e.stop()}}),e,this,[[6,13]])})));return function(t){return e.apply(this,arguments)}}(),r.parse=function(e,t,n){return this._parseLoadedManifest({responseData:e,size:void 0,requestDuration:void 0},t,n)},r._parseLoadedManifest=function(){var e=(0,w.Z)(I().mark((function e(t,n,r){var i,a,o,u,l,c,f,v,p,h,m,g,y,_,b,S,E=this;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(S=function(e){b(e.contentWarnings);var t=performance.now()-a;return s.Z.info("MF: Manifest parsed in "+t+"ms"),{manifest:e,sendingTime:l,receivedTime:c,parsingTime:t}},b=function(e){for(var t,n=pe(e);!(t=n()).done;){var r=t.value;if(o.isCancelled())return;var i=(0,d.Z)(r,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown error when parsing the Manifest"});u("warning",i)}},_=function(){return(_=(0,w.Z)(I().mark((function e(t){var n;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ve(t,f,o);case 3:return n=e.sent,e.abrupt("return",n);case 7:throw e.prev=7,e.t0=e.catch(0),oe(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)},y=function(e){return _.apply(this,arguments)},a=performance.now(),o=this._canceller.signal,u=this.trigger.bind(this),l=t.sendingTime,c=t.receivedTime,f=this._getBackoffSetting((function(e){E.trigger("warning",oe(e))})),v=null!=r?r:null===(i=this._manifestUrls)||void 0===i?void 0:i[0],p={externalClockOffset:n.externalClockOffset,unsafeMode:n.unsafeMode,previousManifest:n.previousManifest,originalUrl:v},e.prev=11,h=this._pipelines.parseManifest(t,p,b,o,y),h instanceof Promise){e.next=17;break}return e.abrupt("return",S(h.manifest));case 17:return e.next=19,h;case 19:return m=e.sent,g=m.manifest,e.abrupt("return",S(g));case 22:e.next=28;break;case 24:throw e.prev=24,e.t0=e.catch(11),(0,d.Z)(e.t0,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown error when parsing the Manifest"});case 28:case"end":return e.stop()}}),e,this,[[11,24]])})));return function(t,n,r){return e.apply(this,arguments)}}(),r._getBackoffSetting=function(e){var t=l.Z.getCurrent(),n=t.DEFAULT_MAX_MANIFEST_REQUEST_RETRY,r=t.INITIAL_BACKOFF_DELAY_BASE,i=t.MAX_BACKOFF_DELAY_BASE,a=this._settings,o=a.lowLatencyMode,s=a.maxRetry;return{onRetry:e,baseDelay:o?r.LOW_LATENCY:r.REGULAR,maxDelay:o?i.LOW_LATENCY:i.REGULAR,maxRetry:null!=s?s:n}},r._recursivelyRefreshManifest=function(e,t){var n=this,r=t.sendingTime,i=t.parsingTime,a=t.updatingTime,o=l.Z.getCurrent(),u=o.MAX_CONSECUTIVE_MANIFEST_PARSING_IN_UNSAFE_MODE,d=o.MIN_MANIFEST_PARSING_TIME_TO_ENTER_UNSAFE_MODE,c=void 0!==i?i+(null!=a?a:0):void 0,f=this._consecutiveUnsafeMode>0?this._consecutiveUnsafeMode<u:void 0!==c&&c>=d,v=void 0===r?0:performance.now()-r,p=Math.max(this._settings.minimumManifestUpdateInterval-v,0),h=new k.ZP;if(h.linkToSignal(this._canceller.signal),this.scheduleManualRefresh=function(t){var i=t.enablePartialRefresh,a=t.delay,o=t.canUseUnsafeMode&&f,s=void 0===r?0:performance.now()-r,u=Math.max(n._settings.minimumManifestUpdateInterval-s,0),l=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:i,unsafeMode:o})}),Math.max((null!=a?a:0)-s,u));h.signal.register((function(){clearTimeout(l)}))},null!==e.expired){var m=setTimeout((function(){var t;null===(t=e.expired)||void 0===t||t.then((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),N.Z)}),p);h.signal.register((function(){clearTimeout(m)}))}if(void 0!==e.lifetime&&e.lifetime>=0){var g,y=1e3*e.lifetime-v;void 0===c?g=y:e.lifetime<3&&c>=100?(g=Math.min(Math.max(3e3-v,Math.max(y,0)+c),6*y),s.Z.info("MUS: Manifest update rythm is too frequent. Postponing next request.",y,g)):c>=1e3*e.lifetime/10?(g=Math.min(Math.max(y,0)+c,6*y),s.Z.info("MUS: Manifest took too long to parse. Postponing next request",g,g)):g=y;var _=setTimeout((function(){h.cancel(),n._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:f})}),Math.max(g,p));h.signal.register((function(){clearTimeout(_)}))}},r._triggerNextManifestRefresh=function(e,t){var n,r,i=this,a=t.enablePartialRefresh,o=t.unsafeMode,u=e.updateUrl;null!==this._prioritizedContentUrl?(n=!0,r=this._prioritizedContentUrl,this._prioritizedContentUrl=null):r=(n=!a||void 0===u)?e.getUrls()[0]:u;var d=e.clockOffset;o?(this._consecutiveUnsafeMode+=1,s.Z.info('Init: Refreshing the Manifest in "unsafeMode" for the '+String(this._consecutiveUnsafeMode)+" consecutive time.")):this._consecutiveUnsafeMode>0&&(s.Z.info('Init: Not parsing the Manifest in "unsafeMode" anymore after '+String(this._consecutiveUnsafeMode)+" consecutive times."),this._consecutiveUnsafeMode=0),this._isRefreshPending||(this._isRefreshPending=!0,this._fetchManifest(r).then((function(t){return t.parse({externalClockOffset:d,previousManifest:e,unsafeMode:o})})).then((function(t){i._isRefreshPending=!1;var r=t.manifest,a=t.sendingTime,o=t.parsingTime,u=performance.now();if(n)e.replace(r);else try{e.update(r)}catch(t){var d=t instanceof Error?t.message:"unknown error";s.Z.warn("MUS: Attempt to update Manifest failed: "+d,"Re-downloading the Manifest fully");var c=l.Z.getCurrent().FAILED_PARTIAL_UPDATE_MANIFEST_REFRESH_DELAY,f=void 0===a?0:performance.now()-a,v=Math.max(i._settings.minimumManifestUpdateInterval-f,0),p=N.Z,h=setTimeout((function(){p(),i._triggerNextManifestRefresh(e,{enablePartialRefresh:!1,unsafeMode:!1})}),Math.max(c-f,v));return void(p=i._canceller.signal.register((function(){clearTimeout(h)})))}var m=performance.now()-u;i._recursivelyRefreshManifest(e,{sendingTime:a,parsingTime:o,updatingTime:m})})).catch((function(e){i._isRefreshPending=!1,i._onFatalError(e)})))},r._onFatalError=function(e){this._canceller.isUsed()||(this.trigger("error",e),this.dispose())},n}(y.Z);var ge=me;function ye(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return _e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _e(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var be=function(e){function n(t){var n;return(n=e.call(this)||this)._downgradedCdnList={metadata:[],timeouts:[]},t.register((function(){for(var e,t=ye(n._downgradedCdnList.timeouts);!(e=t()).done;){var r=e.value;clearTimeout(r)}n._downgradedCdnList={metadata:[],timeouts:[]}})),n}(0,t.Z)(n,e);var r=n.prototype;return r.getCdnPreferenceForResource=function(e){return e.length<=1?e:this._innerGetCdnPreferenceForResource(e)},r.downgradeCdn=function(e){var t=this,n=Se(this._downgradedCdnList.metadata,e);n>=0&&this._removeIndexFromDowngradeList(n);var r=l.Z.getCurrent().DEFAULT_CDN_DOWNGRADE_TIME;this._downgradedCdnList.metadata.push(e);var i=window.setTimeout((function(){var n=Se(t._downgradedCdnList.metadata,e);n>=0&&t._removeIndexFromDowngradeList(n),t.trigger("priorityChange",null)}),r);this._downgradedCdnList.timeouts.push(i),this.trigger("priorityChange",null)},r._innerGetCdnPreferenceForResource=function(e){var t=this,n=e.reduce((function(e,n){return t._downgradedCdnList.metadata.some((function(e){return e.id===n.id&&e.baseUrl===n.baseUrl}))?e[1].push(n):e[0].push(n),e}),[[],[]]),r=n[0],i=n[1];return r.concat(i)},r._removeIndexFromDowngradeList=function(e){this._downgradedCdnList.metadata.splice(e,1);var t=this._downgradedCdnList.timeouts.splice(e,1);clearTimeout(t[0])},n}(y.Z);function Se(e,t){return 0===e.length?-1:void 0!==t.id?(0,L.Z)(e,(function(e){return e.id===t.id})):(0,L.Z)(e,(function(e){return e.baseUrl===t.baseUrl}))}var Ee=n(520),Te=function(){function e(){this._cache=new WeakMap}var t=e.prototype;return t.add=function(e,t){var n=e.representation;e.segment.isInit&&this._cache.set(n,t)},t.get=function(e){var t=e.representation;if(e.segment.isInit){var n=this._cache.get(t);if(void 0!==n)return n}return null},e}(),ke=(0,_.Z)();var we=function(){function e(e){var t=e.prioritySteps;if(this._minPendingPriority=null,this._waitingQueue=[],this._pendingTasks=[],this._prioritySteps=t,this._prioritySteps.high>=this._prioritySteps.low)throw new Error("TP: the max high level priority should be given a lowerpriority number than the min low priority.")}var t=e.prototype;return t.create=function(e,t,n,r){var i,a=this;return(0,D.Z)(r,(function(o,s){return i={hasEnded:!1,priority:t,trigger:function(){if(!i.hasEnded){var e=function(){u(),a._endTask(i)},t=new k.ZP,u=t.linkToSignal(r);i.interrupter=t,t.signal.register((function(){i.interrupter=null,r.isCancelled()||n.beforeInterrupted()})),a._minPendingPriority=null===a._minPendingPriority?i.priority:Math.min(a._minPendingPriority,i.priority),a._pendingTasks.push(i),i.taskFn(t.signal).then((function(t){n.beforeEnded(),e(),o(t)})).catch((function(n){!r.isCancelled()&&t.isUsed()&&n instanceof k.FU||function(t){e(),s(t)}(n)}))}},taskFn:e,interrupter:null},a._canBeStartedNow(i)?(i.trigger(),a._isRunningHighPriorityTasks()&&a._interruptCancellableTasks()):a._waitingQueue.push(i),function(){return a._endTask(i)}}))},t._endTask=function(e){e.hasEnded=!0;var t=Ae(e.taskFn,this._waitingQueue);if(t>=0)this._waitingQueue.splice(t,1);else{var n=Ae(e.taskFn,this._pendingTasks);if(n<0)return;this._pendingTasks.splice(n,1),this._pendingTasks.length>0?this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))):this._minPendingPriority=null,this._loopThroughWaitingQueue()}},t.updatePriority=function(e,t){var n=Ae(e,this._waitingQueue);if(n>=0){var r=this._waitingQueue[n];if(r.priority===t)return;if(r.priority=t,!this._canBeStartedNow(r))return;return this._findAndRunWaitingQueueTask(n),void(this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks())}var i=Ae(e,this._pendingTasks);if(i<0)s.Z.warn("TP: request to update the priority of a non-existent task");else{var a=this._pendingTasks[i];if(a.priority!==t){var o=a.priority;a.priority=t,null===this._minPendingPriority||t<this._minPendingPriority?this._minPendingPriority=t:this._minPendingPriority===o&&(1===this._pendingTasks.length?this._minPendingPriority=t:this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority}))),this._loopThroughWaitingQueue()),this._isRunningHighPriorityTasks()&&this._interruptCancellableTasks()}}},t._loopThroughWaitingQueue=function(){var e=this._waitingQueue.reduce((function(e,t){return null===e||e>t.priority?t.priority:e}),null);if(!(null===e||null!==this._minPendingPriority&&this._minPendingPriority<e))for(var t=0;t<this._waitingQueue.length;t++){var n=null===this._minPendingPriority?e:Math.min(this._minPendingPriority,e);this._waitingQueue[t].priority<=n&&(this._findAndRunWaitingQueueTask(t),t--)}},t._interruptCancellableTasks=function(){for(var e=0;e<this._pendingTasks.length;e++){var t=this._pendingTasks[e];if(t.priority>=this._prioritySteps.low)return this._interruptPendingTask(t),this._interruptCancellableTasks()}},t._findAndRunWaitingQueueTask=function(e){return e>=this._waitingQueue.length||e<0?(s.Z.warn("TP : Tried to start a non existing task"),!1):(this._waitingQueue.splice(e,1)[0].trigger(),!0)},t._interruptPendingTask=function(e){var t,n=Ae(e.taskFn,this._pendingTasks);n<0?s.Z.warn("TP: Interrupting a non-existent pending task. Aborting..."):(this._pendingTasks.splice(n,1),this._waitingQueue.push(e),0===this._pendingTasks.length?this._minPendingPriority=null:this._minPendingPriority===e.priority&&(this._minPendingPriority=Math.min.apply(Math,this._pendingTasks.map((function(e){return e.priority})))),null===(t=e.interrupter)||void 0===t||t.cancel())},t._canBeStartedNow=function(e){return null===this._minPendingPriority||e.priority<=this._minPendingPriority},t._isRunningHighPriorityTasks=function(){return null!==this._minPendingPriority&&this._minPendingPriority<=this._prioritySteps.high},e}();function Ae(e,t){return(0,L.Z)(t,(function(t){return t.taskFn===e}))}var Ie=function(){function e(e,t,n){var r=new be(n),i=l.Z.getCurrent(),a=i.MIN_CANCELABLE_PRIORITY,o=i.MAX_HIGH_PRIORITY_LEVEL;this._transport=e,this._prioritizer=new we({prioritySteps:{high:o,low:a}}),this._cdnPrioritizer=r,this._backoffOptions=t}return e.prototype.createSegmentFetcher=function(e,t){var n,r,i,a,o,u,c,f,v,p,m,g,y=(n=this._backoffOptions,r=n.maxRetry,i=n.lowLatencyMode,a=n.requestTimeout,o=l.Z.getCurrent(),u=o.DEFAULT_MAX_REQUESTS_RETRY_ON_ERROR,c=o.DEFAULT_REQUEST_TIMEOUT,f=o.INITIAL_BACKOFF_DELAY_BASE,v=o.MAX_BACKOFF_DELAY_BASE,{maxRetry:null!=r?r:u,baseDelay:i?f.LOW_LATENCY:f.REGULAR,maxDelay:i?v.LOW_LATENCY:v.REGULAR,requestTimeout:(0,b.Z)(a)?c:a}),_=function(e,t,n,r,i){var a={timeout:i.requestTimeout<0?void 0:i.requestTimeout},o=(0,h.Z)(["audio","video"],e)?new Te:void 0,u=t.loadSegment,l=t.parseSegment;return function(){var e=(0,w.Z)(I().mark((function e(t,c,f){var v,p,h,m,g,y,_,E,T,w,A,R,Z,x,P,M,C,D,N,O,L,U,B,F;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(F=function(){var e;x||!(0,b.Z)(A)&&void 0!==A.size&&void 0!==A.requestDuration&&R.length>0&&R.every((function(e){return e}))&&(x=!0,null===(e=r.onMetrics)||void 0===e||e.call(r,{size:A.size,requestDuration:A.requestDuration,content:t,segmentDuration:Z}))},B=function(e){c.onRetry(oe(e))},U=function(e,t){R.push(!1);var n=R.length-1;return function(r){var i={data:e,isChunked:t};try{var a=l(i,P,r);return R[n]||(Z=void 0!==Z&&"media"===a.segmentType&&null!==a.chunkInfos&&void 0!==a.chunkInfos.duration?Z+a.chunkInfos.duration:void 0,R[n]=!0,F()),a}catch(e){throw(0,d.Z)(e,{defaultCode:"PIPELINE_PARSE_ERROR",defaultReason:"Unknown parsing error"})}}},L=function(e){return u(e,P,a,f,M)},O=function(){var e;void 0===A&&(s.Z.debug("SF: Segment request cancelled",T),A=null,null===(e=r.onRequestEnd)||void 0===e||e.call(r,{id:w}))},m=t.segment,g=t.adaptation,y=t.representation,_=t.manifest,E=t.period,T=(0,Ee.K)(t),w=ke(),R=[],Z=0,x=!1,P={segment:m,type:g.type,language:g.language,isLive:_.isLive,periodStart:E.start,periodEnd:E.end,mimeType:y.mimeType,codecs:y.codec,manifestPublishTime:_.publishTime},M={onProgress:function(e){var t;void 0===A&&void 0!==e.totalSize&&e.size<e.totalSize&&(null===(t=r.onProgress)||void 0===t||t.call(r,{duration:e.duration,size:e.size,totalSize:e.totalSize,timestamp:performance.now(),id:w}))},onNewChunk:function(e){c.onChunk(U(e,!0))}},null===(C=void 0!==o?o.get(t):null)){e.next=18;break}return s.Z.debug("SF: Found wanted segment in cache",T),c.onChunk(U(C,!1)),e.abrupt("return",Promise.resolve());case 18:return s.Z.debug("SF: Beginning request",T),null===(v=r.onRequestBegin)||void 0===v||v.call(r,{requestTimestamp:performance.now(),id:w,content:t}),f.register(O),e.prev=21,e.next=24,ce(t.representation.cdnMetadata,n,L,(0,S.Z)({onRetry:B},i),f);case 24:"segment-loaded"===(D=e.sent).resultType?(N=D.resultData.responseData,void 0!==o&&o.add(t,D.resultData.responseData),c.onChunk(U(N,!1))):"segment-created"===D.resultType&&c.onChunk(U(D.resultData,!1)),s.Z.debug("SF: Segment request ended with success",T),c.onAllChunksReceived(),"segment-created"!==D.resultType?(A=D.resultData,F()):A=null,f.isCancelled()||null===(p=r.onRequestEnd)||void 0===p||p.call(r,{id:w}),f.deregister(O),e.next=43;break;case 33:if(e.prev=33,e.t0=e.catch(21),f.deregister(O),A=null,!(e.t0 instanceof k.FU)){e.next=40;break}throw s.Z.debug("SF: Segment request aborted",T),e.t0;case 40:throw s.Z.debug("SF: Segment request failed",T),null===(h=r.onRequestEnd)||void 0===h||h.call(r,{id:w}),oe(e.t0);case 43:case"end":return e.stop()}}),e,null,[[21,33]])})));return function(t,n,r){return e.apply(this,arguments)}}()}(e,this._transport[e],this._cdnPrioritizer,t,y);return p=this._prioritizer,m=_,g=new WeakMap,{createRequest:function(e,t,n,r){var i=function(t){return m(e,n,t)},a=p.create(i,t,n,r);return g.set(a,i),a},updatePriority:function(e,t){var n=g.get(e);void 0!==n?p.updatePriority(n,t):s.Z.warn("Fetchers: Cannot update the priority of a request: task not found.")}}},e}(),Re=Ie,Ze=n(7326);var xe=n(9612);function Pe(e){}var Me=function(e){function n(t,n,r){var i;i=e.call(this)||this;var a=r.addSourceBuffer(n);i._canceller=new k.ZP,i.bufferType=t,i._mediaSource=r,i._sourceBuffer=a,i._queue=[],i._pendingTask=null,i._lastInitSegmentUniqueId=null,i.codec=n,i._initSegmentsMap=new Map;var o=i._onPendingTaskError.bind((0,Ze.Z)(i)),s=i._flush.bind((0,Ze.Z)(i)),u=l.Z.getCurrent().SOURCE_BUFFER_FLUSHING_INTERVAL,d=setInterval(s,u);return i._sourceBuffer.addEventListener("error",o),i._sourceBuffer.addEventListener("updateend",s),i._canceller.signal.register((function(){clearInterval(d),i._sourceBuffer.removeEventListener("error",o),i._sourceBuffer.removeEventListener("updateend",s)})),i}(0,t.Z)(n,e);var r=n.prototype;return r.declareInitSegment=function(e,t){Pe(t),this._initSegmentsMap.set(e,t)},r.freeInitSegment=function(e){this._initSegmentsMap.delete(e)},r.pushChunk=function(e,t){return Pe(e.data.chunk),s.Z.debug("AVSB: receiving order to push data to the SourceBuffer",this.bufferType,(0,Ee.K)(e.inventoryInfos)),this._addToQueue({type:xe.f.Push,value:e},t)},r.removeBuffer=function(e,t,n){return s.Z.debug("AVSB: receiving order to remove data from the SourceBuffer",this.bufferType,e,t),this._addToQueue({type:xe.f.Remove,value:{start:e,end:t}},n)},r.endOfSegment=function(e,t){return s.Z.debug("AVSB: receiving order for validating end of segment",this.bufferType,(0,Ee.K)(e)),this._addToQueue({type:xe.f.EndOfSegment,value:e},t)},r.getBufferedRanges=function(){return this._sourceBuffer.buffered},r.getPendingOperations=function(){var e=function(e){switch(e.type){case xe.f.Push:case xe.f.Remove:case xe.f.EndOfSegment:return{type:e.type,value:e.value}}},t=this._queue.map(e);return null===this._pendingTask?t:[e(this._pendingTask)].concat(t)},r.dispose=function(){for(this._canceller.cancel(),null!==this._pendingTask&&(this._pendingTask.reject(new k.FU),this._pendingTask=null);this._queue.length>0;){var e=this._queue.shift();void 0!==e&&e.reject(new k.FU)}if("open"===this._mediaSource.readyState)try{this._sourceBuffer.abort()}catch(e){s.Z.warn("AVSB: Failed to abort a "+this.bufferType+" SourceBuffer:",e instanceof Error?e:"")}},r._onPendingTaskError=function(e){if(this._lastInitSegmentUniqueId=null,null!==this._pendingTask){var t=e instanceof Error?e:new Error("An unknown error occured when doing operations on the SourceBuffer");this._pendingTask.reject(t)}},r._addToQueue=function(e,t){var n=this;return(0,D.Z)(t,(function(t,r){var i=0===n._queue.length&&null===n._pendingTask,a=(0,S.Z)({resolve:t,reject:r},e);return n._queue.push(a),i&&n._flush(),function(){var e=n._queue.indexOf(a);e>=0&&n._queue.splice(e,1),a.resolve=N.Z,a.reject=N.Z}}))},r._flush=function(){if(!this._sourceBuffer.updating){if(null!==this._pendingTask){var e=this._pendingTask;if(e.type!==xe.f.Push||0===e.data.length){switch(e.type){case xe.f.Push:null!==e.inventoryData&&this._segmentInventory.insertChunk(e.inventoryData);break;case xe.f.EndOfSegment:this._segmentInventory.completeSegment(e.value,this.getBufferedRanges());break;case xe.f.Remove:this.synchronizeInventory();break;default:(0,g.Z)(e)}var t=e.resolve;return this._pendingTask=null,t(),void this._flush()}}else{var n=this._queue.shift();if(void 0===n)return;if(n.type!==xe.f.Push)this._pendingTask=n;else{var r,i=n.value;try{r=this._preparePushOperation(i.data)}catch(e){this._pendingTask=(0,S.Z)({data:[],inventoryData:i.inventoryInfos},n);var a=e instanceof Error?e:new Error("An unknown error occured when preparing a push operation");return this._lastInitSegmentUniqueId=null,void n.reject(a)}this._pendingTask=(0,S.Z)({data:r,inventoryData:i.inventoryInfos},n)}}try{switch(this._pendingTask.type){case xe.f.EndOfSegment:return s.Z.debug("AVSB: Acknowledging complete segment",(0,Ee.K)(this._pendingTask.value)),void this._flush();case xe.f.Push:var o=this._pendingTask.data.shift();if(void 0===o)return void this._flush();s.Z.debug("AVSB: pushing segment",this.bufferType,(0,Ee.K)(this._pendingTask.inventoryData)),this._sourceBuffer.appendBuffer(o);break;case xe.f.Remove:var u=this._pendingTask.value,l=u.start,d=u.end;s.Z.debug("AVSB: removing data from SourceBuffer",this.bufferType,l,d),this._sourceBuffer.remove(l,d);break;default:(0,g.Z)(this._pendingTask)}}catch(e){this._onPendingTaskError(e)}}},r._preparePushOperation=function(e){var t=[],n=e.codec,r=e.timestampOffset,i=e.appendWindow,a=!1;if(void 0!==n&&n!==this.codec&&(s.Z.debug("AVSB: updating codec",n),a=function(e,t){if("function"==typeof e.changeType){try{e.changeType(t)}catch(e){return s.Z.warn("Could not call 'changeType' on the given SourceBuffer:",e instanceof Error?e:""),!1}return!0}return!1}(this._sourceBuffer,n),a?this.codec=n:s.Z.debug("AVSB: could not update codec",n,this.codec)),this._sourceBuffer.timestampOffset!==r){var o=r;s.Z.debug("AVSB: updating timestampOffset",this.bufferType,this._sourceBuffer.timestampOffset,o),this._sourceBuffer.timestampOffset=o}if(void 0===i[0]?this._sourceBuffer.appendWindowStart>0&&(this._sourceBuffer.appendWindowStart=0):i[0]!==this._sourceBuffer.appendWindowStart&&(i[0]>=this._sourceBuffer.appendWindowEnd&&(this._sourceBuffer.appendWindowEnd=i[0]+1),this._sourceBuffer.appendWindowStart=i[0]),void 0===i[1]?this._sourceBuffer.appendWindowEnd!==1/0&&(this._sourceBuffer.appendWindowEnd=1/0):i[1]!==this._sourceBuffer.appendWindowEnd&&(this._sourceBuffer.appendWindowEnd=i[1]),null!==e.initSegmentUniqueId&&(a||!this._isLastInitSegment(e.initSegmentUniqueId))){var u=this._initSegmentsMap.get(e.initSegmentUniqueId);if(void 0===u)throw new Error("Invalid initialization segment uniqueId");t.push(u),this._lastInitSegmentUniqueId=e.initSegmentUniqueId}return null!==e.chunk&&t.push(e.chunk),t},r._isLastInitSegment=function(e){return null!==this._lastInitSegmentUniqueId&&this._lastInitSegmentUniqueId===e},n}(xe.C),Ce=["audio","video","text"];function De(e){return"audio"===e||"video"===e}var Ne=function(){function e(e,t){this._mediaElement=e,this._mediaSource=t,this._initializedSegmentBuffers={},this._onNativeBufferAddedOrDisabled=[]}e.isNative=function(e){return De(e)};var t=e.prototype;return t.getBufferTypes=function(){var e=this.getNativeBufferTypes();return null==v.Z.nativeTextTracksBuffer&&null==v.Z.htmlTextTracksBuffer||e.push("text"),e},t.getNativeBufferTypes=function(){return"AUDIO"===this._mediaElement.nodeName?["audio"]:["video","audio"]},t.getStatus=function(e){var t=this._initializedSegmentBuffers[e];return void 0===t?{type:"uninitialized"}:null===t?{type:"disabled"}:{type:"initialized",value:t}},t.waitForUsableBuffers=function(e){var t=this;return this._areNativeBuffersUsable()?Promise.resolve():(0,D.Z)(e,(function(e){var n,r=function(){var e=t._onNativeBufferAddedOrDisabled.indexOf(n);e>=0&&t._onNativeBufferAddedOrDisabled.splice(e,1)};return n=function(){t._areNativeBuffersUsable()&&(r(),e())},t._onNativeBufferAddedOrDisabled.push(n),r}))},t.disableSegmentBuffer=function(t){var n=this._initializedSegmentBuffers[t];if(null!==n){if(void 0!==n)throw new Error("Cannot disable an active SegmentBuffer.");this._initializedSegmentBuffers[t]=null,e.isNative(t)&&this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()}))}else s.Z.warn("SBS: The "+t+" SegmentBuffer was already disabled.")},t.createSegmentBuffer=function(e,t,n){void 0===n&&(n={});var r,i=this._initializedSegmentBuffers[e];if(De(e)){if(null!=i)return i instanceof Me&&i.codec!==t?s.Z.warn("SB: Reusing native SegmentBuffer with codec",i.codec,"for codec",t):s.Z.info("SB: Reusing native SegmentBuffer with codec",t),i;s.Z.info("SB: Adding native SegmentBuffer with codec",t);var a=new Me(e,t,this._mediaSource);return this._initializedSegmentBuffers[e]=a,this._onNativeBufferAddedOrDisabled.forEach((function(e){return e()})),a}if(null!=i)return s.Z.info("SB: Reusing a previous custom SegmentBuffer for the type",e),i;if("text"===e){if(s.Z.info("SB: Creating a new text SegmentBuffer"),"html"===n.textTrackMode){if(null==v.Z.htmlTextTracksBuffer)throw new Error("HTML Text track feature not activated");r=new v.Z.htmlTextTracksBuffer(this._mediaElement,n.textTrackElement)}else{if(null==v.Z.nativeTextTracksBuffer)throw new Error("Native Text track feature not activated");r=new v.Z.nativeTextTracksBuffer(this._mediaElement)}return this._initializedSegmentBuffers.text=r,r}throw s.Z.error("SB: Unknown buffer type:",e),new c.Z("BUFFER_TYPE_UNKNOWN","The player wants to create a SegmentBuffer of an unknown type.")},t.disposeSegmentBuffer=function(e){var t=this._initializedSegmentBuffers[e];null!=t?(s.Z.info("SB: Aborting SegmentBuffer",e),t.dispose(),delete this._initializedSegmentBuffers[e]):s.Z.warn("SB: Trying to dispose a SegmentBuffer that does not exist")},t.disposeAll=function(){var e=this;Ce.forEach((function(t){"initialized"===e.getStatus(t).type&&e.disposeSegmentBuffer(t)}))},t._areNativeBuffersUsable=function(){var e=this,t=this.getNativeBufferTypes();return!t.some((function(t){return void 0===e._initializedSegmentBuffers[t]}))&&!t.every((function(t){return null===e._initializedSegmentBuffers[t]}))},e}(),Oe=n(7473),Le=n.n(Oe),Ue=function(){function e(e){this._array=[],this._sortingFn=e}var t=e.prototype;return t.add=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.sort(this._sortingFn);for(var r=0,i=0;i<t.length;i++){for(var a=t[i],o=!1;!o&&r<this._array.length;)this._sortingFn(a,this._array[r])<0?(this._array.splice(r,0,a),o=!0):r++;o||this._array.push(a)}},t.length=function(){return this._array.length},t.get=function(e){if(e<0||e>=this._array.length)throw new Error("Invalid index.");return this._array[e]},t.toArray=function(){return this._array.slice()},t.findFirst=function(e){return(0,p.Z)(this._array,e)},t.has=function(e){return(0,h.Z)(this._array,e)},t.removeElement=function(e){var t=this._array.indexOf(e);if(t>=0)return this._array.splice(t,1),t},t.head=function(){return this._array[0]},t.last=function(){return this._array[this._array.length-1]},t.shift=function(){return this._array.shift()},t.pop=function(){return this._array.pop()},e}(),Be=function(){function e(e){this._weakMap=new WeakMap,this._fn=e}var t=e.prototype;return t.get=function(e){var t=this._weakMap.get(e);if(void 0===t){var n=this._fn(e);return this._weakMap.set(e,n),n}return t},t.destroy=function(e){this._weakMap.delete(e)},e}();function Fe(e,t){var n,r=e.segmentBuffer,i=e.playbackObserver,a=e.maxBufferBehind,o=e.maxBufferAhead;function u(){(function(e,t,n,r,i){return ze.apply(this,arguments)})(r,n,a.getValue(),o.getValue(),t).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";s.Z.error("Could not run BufferGarbageCollector:",t)}))}i.listen((function(e){var t;n=null!==(t=e.position.pending)&&void 0!==t?t:e.position.last,u()}),{includeLastObservation:!0,clearSignal:t}),a.onUpdate(u,{clearSignal:t}),o.onUpdate(u,{clearSignal:t}),u()}function ze(){return(ze=(0,w.Z)(I().mark((function e(t,n,r,i,a){var o,u,l,d,c,f,v,p;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(isFinite(r)||isFinite(i)){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:o=[],u=(0,E.F_)(t.getBufferedRanges(),n),l=u.innerRange,d=u.outerRanges,c=function(){if(isFinite(i)){for(var e=0;e<d.length;e++){var t=d[e];n+i<=t.start?o.push(t):n<=t.start&&n+i<t.end&&n+i>t.start&&o.push({start:n+i,end:t.end})}null!=l&&n+i<l.end&&o.push({start:n+i,end:l.end})}},function(){if(isFinite(r)){for(var e=0;e<d.length;e++){var t=d[e];n-r>=t.end?o.push(t):n>=t.end&&n-r>t.start&&n-r<t.end&&o.push({start:t.start,end:n-r})}null!=l&&n-r>l.start&&o.push({start:l.start,end:n-r})}}(),c(),f=0,v=o;case 9:if(!(f<v.length)){e.next=20;break}if(!((p=v[f]).start<p.end)){e.next=17;break}if(s.Z.debug("GC: cleaning range from SegmentBuffer",p.start,p.end),null===a.cancellationError){e.next=15;break}throw a.cancellationError;case 15:return e.next=17,t.removeBuffer(p.start,p.end,a);case 17:f++,e.next=9;break;case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ve=function(e){function n(t,n,r,i){var a;return(a=e.call(this)||this)._content=t,a._currentCanceller=null,a._downloadQueue=n,a._initSegmentRequest=null,a._mediaSegmentRequest=null,a._segmentFetcher=r,a._initSegmentInfoRef=(0,T.ZP)(void 0),a._mediaSegmentAwaitingInitMetadata=null,i||a._initSegmentInfoRef.setValue(null),a}(0,t.Z)(n,e);var r=n.prototype;return r.getRequestedInitSegment=function(){return null===this._initSegmentRequest?null:this._initSegmentRequest.segment},r.getRequestedMediaSegment=function(){return null===this._mediaSegmentRequest?null:this._mediaSegmentRequest.segment},r.start=function(){var e=this;null===this._currentCanceller&&(this._currentCanceller=new k.ZP,this._downloadQueue.onUpdate((function(t){var n=t.segmentQueue;if(!(n.length>0&&n[0].segment.id===e._mediaSegmentAwaitingInitMetadata)){var r=e._mediaSegmentRequest;if(0===n.length){if(null===r)return;return s.Z.debug("Stream: no more media segment to request. Cancelling queue.",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()}if(null===r)return s.Z.debug("Stream: Media segments now need to be requested. Starting queue.",e._content.adaptation.type,n.length),void e._restartMediaSegmentDownloadingQueue();var i=n[0];return r.segment.id!==i.segment.id?(s.Z.debug("Stream: Next media segment changed, cancelling previous",e._content.adaptation.type),void e._restartMediaSegmentDownloadingQueue()):void(r.priority!==i.priority&&(s.Z.debug("Stream: Priority of next media segment changed, updating",e._content.adaptation.type,r.priority,i.priority),e._segmentFetcher.updatePriority(r.request,i.priority)))}}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}),this._downloadQueue.onUpdate((function(t){var n,r=e._initSegmentRequest;null===t.initSegment||null===r?(null===(n=t.initSegment)||void 0===n?void 0:n.segment.id)!==(null==r?void 0:r.segment.id)&&(null===t.initSegment&&s.Z.debug("Stream: no more init segment to request. Cancelling queue.",e._content.adaptation.type),e._restartInitSegmentDownloadingQueue(t.initSegment)):t.initSegment.priority!==r.priority&&e._segmentFetcher.updatePriority(r.request,t.initSegment.priority)}),{emitCurrentValue:!0,clearSignal:this._currentCanceller.signal}))},r.stop=function(){var e;null===(e=this._currentCanceller)||void 0===e||e.cancel(),this._currentCanceller=null},r._restartMediaSegmentDownloadingQueue=function(){var e=this;null!==this._mediaSegmentRequest&&this._mediaSegmentRequest.canceller.cancel();!function t(n){if(null!==e._currentCanceller&&e._currentCanceller.isUsed())e._mediaSegmentRequest=null;else{if(void 0===n)return e._mediaSegmentRequest=null,void e.trigger("emptyQueue",null);var r=new k.ZP,i=null===e._currentCanceller?N.Z:r.linkToSignal(e._currentCanceller.signal),a=n.segment,o=n.priority,u=(0,S.Z)({segment:a},e._content),l=!1,d=!1;r.signal.register((function(){e._mediaSegmentRequest=null,l||(e._mediaSegmentAwaitingInitMetadata===a.id&&(e._mediaSegmentAwaitingInitMetadata=null),l=!0,d=!1)}));var c=function(t){(0,m.Z)("media"===t.segmentType,"Should have loaded a media segment."),e.trigger("parsedMediaSegment",(0,S.Z)({},t,{segment:a}))},f=function(){var n=e._downloadQueue.getValue().segmentQueue;if(0===n.length)return l=!0,void e.trigger("emptyQueue",null);n[0].segment.id===a.id&&n.shift(),l=!0,t(n[0])},v=e._segmentFetcher.createRequest(u,o,{onRetry:function(t){e.trigger("requestRetry",{segment:a,error:t})},beforeInterrupted:function(){s.Z.info("Stream: segment request interrupted temporarly.",a.id,a.time)},onChunk:function(t){var n=e._initSegmentInfoRef.getValue();void 0!==n?c(t(null!=n?n:void 0)):(d=!0,e._initSegmentInfoRef.waitUntilDefined((function(e){c(t(null!=e?e:void 0))}),{clearSignal:r.signal}))},onAllChunksReceived:function(){d?(e._mediaSegmentAwaitingInitMetadata=a.id,e._initSegmentInfoRef.waitUntilDefined((function(){e._mediaSegmentAwaitingInitMetadata=null,d=!1,e.trigger("fullyLoadedSegment",a)}),{clearSignal:r.signal})):e.trigger("fullyLoadedSegment",a)},beforeEnded:function(){i(),e._mediaSegmentRequest=null,d?e._initSegmentInfoRef.waitUntilDefined(f,{clearSignal:r.signal}):f()}},r.signal);v.catch((function(t){i(),l||(l=!0,e.stop(),e.trigger("error",t))})),e._mediaSegmentRequest={segment:a,priority:o,request:v,canceller:r}}}(this._downloadQueue.getValue().segmentQueue[0])},r._restartInitSegmentDownloadingQueue=function(e){var t=this;if((null===this._currentCanceller||!this._currentCanceller.isUsed())&&(null!==this._initSegmentRequest&&this._initSegmentRequest.canceller.cancel(),null!==e)){var n=new k.ZP,r=null===this._currentCanceller?N.Z:n.linkToSignal(this._currentCanceller.signal),i=e.segment,a=e.priority,o=(0,S.Z)({segment:i},this._content),u=!1,l=this._segmentFetcher.createRequest(o,a,{onRetry:function(e){t.trigger("requestRetry",{segment:i,error:e})},beforeInterrupted:function(){s.Z.info("Stream: init segment request interrupted temporarly.",i.id)},beforeEnded:function(){r(),t._initSegmentRequest=null,u=!0},onChunk:function(e){var n,r=e(void 0);(0,m.Z)("init"===r.segmentType,"Should have loaded an init segment."),t.trigger("parsedInitSegment",(0,S.Z)({},r,{segment:i})),"init"===r.segmentType&&t._initSegmentInfoRef.setValue(null!==(n=r.initTimescale)&&void 0!==n?n:null)},onAllChunksReceived:function(){t.trigger("fullyLoadedSegment",i)}},n.signal);l.catch((function(e){r(),u||(u=!0,t.stop(),t.trigger("error",e))})),n.signal.register((function(){t._initSegmentRequest=null,u||(u=!0)})),this._initSegmentRequest={segment:i,priority:a,request:l,canceller:n}}},n}(y.Z);function Ke(e,t,n,r,i){var a=e.period,o=e.adaptation,u=e.representation,l=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(void 0===r.bufferedStart||void 0===r.bufferedEnd||r.bufferedStart>=t.end)return null;if(r.bufferedEnd>t.start)return n}return null}(i,t);if(null===l){if(null===n){if(r&&void 0!==a.end&&t.end>=a.end)return{start:void 0,end:null};var d=u.index.checkDiscontinuity(t.start);if(null!==d)return{start:void 0,end:d}}return null}var c=i[l];if(void 0!==c.bufferedStart&&c.bufferedStart>t.start&&(null===n||c.infos.segment.end<=n)){var f=c.bufferedStart;return r||!1===u.index.awaitSegmentBetween(t.start,f)?(s.Z.debug("RS: current discontinuity encountered",o.type,c.bufferedStart),{start:void 0,end:f}):null}var v=function(e,t,n){if(n<=0)return s.Z.error("RS: Asked to check a discontinuity before the first chunk."),null;for(var r=n;r<e.length;r++){var i=e[r],a=e[r-1];if(void 0===i.bufferedStart||void 0===a.bufferedEnd||i.bufferedStart>=t.end)return null;if(i.bufferedStart-a.bufferedEnd>0)return r}return null}(i,t,l+1);if(null!==v){var p=i[v-1],h=i[v];if(null===n||h.infos.segment.end<=n){if(!r&&!1!==u.index.awaitSegmentBetween(p.infos.segment.end,h.infos.segment.time))return null;var m=p.bufferedEnd,g=h.bufferedStart;return s.Z.debug("RS: future discontinuity encountered",o.type,m,g),{start:m,end:g}}}if(null===n){if(r&&void 0!==a.end){if(t.end<a.end)return null;var y=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(void 0===r.bufferedStart)return null;if(r.bufferedStart<t)return n}return null}(i,a.end);if(null!==y){var _=i[y];if(void 0!==_.bufferedEnd&&_.bufferedEnd<a.end)return s.Z.debug("RS: discontinuity encountered at the end of the current period",o.type,_.bufferedEnd,a.end),{start:_.bufferedEnd,end:null}}}if(void 0!==a.end&&t.end>=a.end)return null;for(var b=i.length-1;b>=0;b--){var S=i[b];if(void 0===S.bufferedStart)break;if(S.bufferedStart<t.end){if(void 0!==S.bufferedEnd&&S.bufferedEnd<t.end){var E=u.index.checkDiscontinuity(t.end);if(null!==E)return{start:S.bufferedEnd,end:E}}return null}}}return null}function Ge(e){var t=e.bufferedSegments,n=e.content,r=e.currentPlaybackTime,i=e.fastSwitchThreshold,a=e.getBufferedHistory,o=e.neededRange,u=e.segmentsBeingPushed,d=e.maxBufferSize,c=n.adaptation,f=n.representation,v=function(e,t,n){var r=8e3*n;return r-=t.reduce((function(e,t){return e+t.representation.bitrate*t.segment.duration}),0),e.reduce((function(e,t){return void 0!==t.chunkSize?e-8*t.chunkSize:e}),r)}(t,u,d),p=f.index.getSegments(o.start,o.end-o.start),h=t.filter((function(e){return!He(e.infos,n,r,i)})).filter((function(e,t,n){var r=0===t?null:n[t-1],i=t>=n.length-1?null:n[t+1],u=null;if(function(e,t,n){var r=l.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedStart)return s.Z.warn("Stream: Start of a segment unknown. Assuming it is garbage collected by default.",e.start),!0;if(null!==t&&void 0!==t.bufferedEnd&&e.bufferedStart-t.bufferedEnd<.1)return!1;if(n<e.bufferedStart&&e.bufferedStart-e.start>r)return s.Z.info("Stream: The start of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,r,o.start)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.start;if(void 0!==t&&void 0!==a&&t-a>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.start;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(u=a(e.infos),e.bufferedStart))return!1;s.Z.debug("Stream: skipping segment gc-ed at the start",e.start,e.bufferedStart)}if(function(e,t,n){var r=l.Z.getCurrent().MAX_TIME_MISSING_FROM_COMPLETE_SEGMENT;if(void 0===e.bufferedEnd)return s.Z.warn("Stream: End of a segment unknown. Assuming it is garbage collected by default.",e.end),!0;if(null!==t&&void 0!==t.bufferedStart&&t.bufferedStart-e.bufferedEnd<.1)return!1;if(n>e.bufferedEnd&&e.end-e.bufferedEnd>r)return s.Z.info("Stream: The end of the wanted segment has been garbage collected",e.start,e.bufferedStart),!0;return!1}(e,i,o.end)){if(function(e,t){var n,r;if(e.length<2)return!0;var i=e[e.length-1],a=null===(n=i.buffered)||void 0===n?void 0:n.end;if(void 0!==t&&void 0!==a&&a-t>.05)return!0;var o=e[e.length-2],s=null===(r=o.buffered)||void 0===r?void 0:r.end;if(void 0===s||void 0===a)return!0;return Math.abs(s-a)>.01}(u=null!=u?u:a(e.infos),e.bufferedEnd))return!1;s.Z.debug("Stream: skipping segment gc-ed at the end",e.end,e.bufferedEnd)}return!0})),m=l.Z.getCurrent(),g=m.MINIMUM_SEGMENT_SIZE,y=m.MIN_BUFFER_AHEAD,_=!1,b=Math.min(1/60,g),E=!1,T=[],k=p.filter((function(e){var t=(0,S.Z)({segment:e},n);if(u.length>0&&u.some((function(e){return(0,Ee.z)(t,e)})))return!1;var l=e.duration,d=e.time,p=e.end;if(e.isInit)return!0;if(_)return T.push(e),!1;if(e.complete&&l<g)return!1;if(u.length>0&&u.some((function(e){if(e.period.id!==n.period.id||e.adaptation.id!==n.adaptation.id)return!1;var a=e.segment;return!(a.time-b>d)&&(!(a.end+b<p)&&!He(e,t,r,i))})))return!1;for(var m=0;m<h.length;m++){var k=h[m];if(k.infos.period.id===n.period.id){var w=k.infos.segment;if(d-w.time>-b&&w.end-p>-b)return!1}}var A=l*n.representation.bitrate;if(v-A<0&&(E=!0,d>o.start+y))return _=!0,T.push(e),!1;var I=a(t);if(I.length>1){var R=I[I.length-1],Z=I[I.length-2];if(null===R.buffered&&null===Z.buffered)return s.Z.warn("Stream: Segment GCed multiple times in a row, ignoring it.","If this happens a lot and lead to unpleasant experience, please check your device's available memory. If it's low when this message is emitted, you might want to update the RxPlayer's settings (`maxBufferAhead`, `maxVideoBufferSize` etc.) so less memory is used by regular media data buffering."+c.type,f.id,e.time),!1}for(var x=0;x<h.length;x++){var P=h[x];if(P.end+b>d){var M=P.start>d+b||je(h,x).end<p-b;return M&&(v-=A),M}}return v-=A,!0}));return{segmentsToLoad:k,segmentsOnHold:T,isBufferFull:E}}function je(e,t){for(var n=t+1,r=l.Z.getCurrent().MINIMUM_SEGMENT_SIZE,i=Math.min(1/60,r);n<e.length-1&&e[n-1].end+i>e[n].start;)n++;return e[--n]}function He(e,t,n,r){var i=l.Z.getCurrent().CONTENT_REPLACEMENT_PADDING;return e.period.id===t.period.id&&(!(e.segment.time<n+i)&&(e.adaptation.id!==t.adaptation.id||function(e,t,n){var r=e.bitrate,i=l.Z.getCurrent().BITRATE_REBUFFERING_RATIO;if(void 0===n){var a=r*i;return t.bitrate>a}return r<n&&t.bitrate>r}(e.representation,t.representation,r)))}function We(e,t){for(var n=e-t,r=l.Z.getCurrent().SEGMENT_PRIORITIES_STEPS,i=0;i<r.length;i++)if(n<r[i])return i;return r.length}function qe(e,t,n,r,i,a,o){o.synchronizeInventory();var s=e.representation,u=n.getIsPaused()||n.getPlaybackRate()<=0?t-.1:t,d=function(e,t,n){var r,i,a=e.manifest,o=e.period,s=e.representation,u=s.index.getLastAvailablePosition(),l=s.index;i=!(0,b.Z)(u)&&t>=u&&l.isInitialized()&&l.isFinished()&&function(e,t,n){var r;return t.containsTime(n)&&e.isLastPeriodKnown&&t.id===(null===(r=e.periods[e.periods.length-1])||void 0===r?void 0:r.id)}(a,o,t)?u-1:t-.1;var d,c=i+n;d=!(!s.index.isInitialized()||!s.index.isFinished()||void 0===o.end)&&(void 0===u?c>=o.end:null===u||c>=u);return{start:Math.max(i,o.start),end:Math.min(c,null!==(r=o.end)&&void 0!==r?r:1/0),hasReachedPeriodEnd:d}}(e,u,i),c=s.index.shouldRefresh(d.start,d.end),f=o.getPendingOperations().filter((function(e){return e.type===xe.f.EndOfSegment})).map((function(e){return e.value})),v=function(e,t){for(var n=l.Z.getCurrent().MINIMUM_SEGMENT_SIZE,r=Math.max(1/60,n),i=e.start+r,a=e.end-r,o=[],s=t.length-1;s>=0;s--){var u=t[s],d=u.infos.representation;if(!u.partiallyPushed&&!1!==d.decipherable&&d.isSupported){var c=u.infos.segment,f=c.time/c.timescale;((c.complete?f+c.duration/c.timescale:u.end)>i&&f<a||u.end>i&&u.start<a)&&o.unshift(u)}}return o}({start:Math.max(d.start-.5,0),end:d.end+.5},o.getInventory()),p=Ge({content:e,bufferedSegments:v,currentPlaybackTime:n.getCurrentTime(),fastSwitchThreshold:r,getBufferedHistory:o.getSegmentHistory.bind(o),neededRange:d,segmentsBeingPushed:f,maxBufferSize:a}),h=p.segmentsToLoad,m=p.segmentsOnHold,g=p.isBufferFull,y=h.map((function(e){return{priority:We(e.time,u),segment:e}})),_=s.index.isInitialized()&&s.index.isFinished()&&d.hasReachedPeriodEnd&&0===y.length&&0===m.length,S=null;return f.length>0&&(S=Math.min.apply(Math,f.map((function(e){return e.segment.time})))),m.length>0&&(S=null!==S?Math.min(S,m[0].time):m[0].time),y.length>0&&(S=null!==S?Math.min(S,y[0].segment.time):y[0].segment.time),{imminentDiscontinuity:Ke(e,d,S,_,v),hasFinishedLoading:_,neededSegments:y,isBufferFull:g,shouldRefreshManifest:c}}function Ye(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Xe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xe(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Qe(e,t,n){return $e.apply(this,arguments)}function $e(){return($e=(0,w.Z)(I().mark((function e(t,n,r){var i,a,o,u,d,c,f,v,p;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=l.Z.getCurrent().BUFFER_GC_GAPS.CALM,a=l.Z.getCurrent().BUFFER_GC_GAPS.BEEFY,s.Z.warn("Stream: Running garbage collector"),o=n.getBufferedRanges(),0===(u=Je(t,o,i)).length&&(u=Je(t,o,a)),s.Z.hasLevel("DEBUG")&&s.Z.debug("Stream: GC cleaning",u.map((function(e){return"start: "+e.start+" - end "+e.end})).join(", ")),d=Ye(u);case 8:if((c=d()).done){e.next=16;break}if(f=c.value,v=f.start,p=f.end,!(v<p)){e.next=14;break}return e.next=14,n.removeBuffer(v,p,r);case 14:e.next=8;break;case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Je(e,t,n){for(var r=(0,E.F_)(t,e),i=r.innerRange,a=r.outerRanges,o=[],u=0;u<a.length;u++){var l=a[u];(e-n>l.end||e+n<l.start)&&o.push(l)}return null!==i&&(s.Z.hasLevel("DEBUG")&&s.Z.debug("Stream: GC removing part of inner range",o.map((function(e){return"start: "+e.start+" - end "+e.end})).join(", ")),e-n>i.start&&o.push({start:i.start,end:e-n}),e+n<i.end&&o.push({start:e+n,end:i.end})),o}function et(e,t,n,r){return tt.apply(this,arguments)}function tt(){return(tt=(0,w.Z)(I().mark((function e(t,n,r,i){var a,o,s,u,l,d;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n.pushChunk(r,i);case 3:case 21:e.next=27;break;case 5:if(e.prev=5,e.t0=e.catch(0),!(i.isCancelled()&&e.t0 instanceof k.FU)){e.next=11;break}throw e.t0;case 11:if(e.t0 instanceof Error&&"QuotaExceededError"===e.t0.name){e.next=14;break}throw o=e.t0 instanceof Error?e.t0.toString():"An unknown error happened when pushing content",new c.Z("BUFFER_APPEND_ERROR",o,{adaptation:r.inventoryInfos.adaptation});case 14:return s=t.getReference().getValue(),u=s.position,l=null!==(a=u.pending)&&void 0!==a?a:u.last,e.prev=16,e.next=19,Qe(l,n,i);case 19:return e.next=21,n.pushChunk(r,i);case 23:throw e.prev=23,e.t1=e.catch(16),d=e.t1 instanceof Error?e.t1.toString():"Could not clean the buffer",new c.Z("BUFFER_FULL_ERROR",d,{adaptation:r.inventoryInfos.adaptation});case 27:case"end":return e.stop()}}),e,null,[[0,5],[16,23]])})))).apply(this,arguments)}function nt(){return nt=(0,w.Z)(I().mark((function e(t,n){var r,i,a,o,s,u,l,d,c,f;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.playbackObserver,i=t.content,a=t.initSegmentUniqueId,o=t.segment,s=t.segmentData,u=t.segmentBuffer,null===n.cancellationError){e.next=3;break}throw n.cancellationError;case 3:return l=i.representation.getMimeTypeString(),d={initSegmentUniqueId:a,chunk:null,timestampOffset:0,appendWindow:[void 0,void 0],codec:l},c=(0,S.Z)({segment:o,chunkSize:void 0,start:0,end:0},i),e.next=8,et(r,u,{data:d,inventoryInfos:c},n);case 8:return f=u.getBufferedRanges(),e.abrupt("return",{content:i,segment:o,buffered:f,segmentData:s});case 10:case"end":return e.stop()}}),e)}))),nt.apply(this,arguments)}function rt(){return rt=(0,w.Z)(I().mark((function e(t,n){var r,i,a,o,s,u,d,c,f,v,p,h,m,g,y,_,b,E,T,k,w,A,R;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.playbackObserver,i=t.content,a=t.initSegmentUniqueId,o=t.parsedSegment,s=t.segment,u=t.segmentBuffer,null!==o.chunkData){e.next=3;break}return e.abrupt("return",null);case 3:if(null===n.cancellationError){e.next=5;break}throw n.cancellationError;case 5:return f=o.chunkData,v=o.chunkInfos,p=o.chunkOffset,h=o.chunkSize,m=o.appendWindow,g=i.representation.getMimeTypeString(),y=l.Z.getCurrent(),_=y.APPEND_WINDOW_SECURITIES,b=[void 0!==m[0]?Math.max(0,m[0]-_.START):void 0,void 0!==m[1]?m[1]+_.END:void 0],E={initSegmentUniqueId:a,chunk:f,timestampOffset:p,appendWindow:b,codec:g},T=null!==(d=null==v?void 0:v.time)&&void 0!==d?d:s.time,k=null!==(c=null==v?void 0:v.duration)&&void 0!==c?c:s.duration,w=T+k,void 0!==b[0]&&(T=Math.max(T,b[0])),void 0!==b[1]&&(w=Math.min(w,b[1])),A=(0,S.Z)({segment:s,chunkSize:h,start:T,end:w},i),e.next=18,et(r,u,{data:E,inventoryInfos:A},n);case 18:return R=u.getBufferedRanges(),e.abrupt("return",{content:i,segment:s,buffered:R,segmentData:f});case 20:case"end":return e.stop()}}),e)}))),rt.apply(this,arguments)}function it(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return at(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return at(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ot=function(e,t,n){var r=e.content,i=e.options,a=e.playbackObserver,o=e.segmentBuffer,u=e.segmentFetcher,d=e.terminate,c=r.period,f=r.adaptation,v=r.representation,p=i.bufferGoal,h=i.maxBufferSize,m=i.drmSystemId,g=i.fastSwitchThreshold,y=f.type,_=new k.ZP;_.linkToSignal(n);var b=new k.ZP;b.linkToSignal(_.signal);var E={segment:v.index.getInitSegment(),uniqueId:null,isLoaded:!1};_.signal.register((function(){null!==E.uniqueId&&o.freeInitSegment(E.uniqueId)}));var w=(0,T.$l)({initSegment:null,segmentQueue:[]},b.signal),A=null!==E.segment;A||(E.isLoaded=!0);var I=!1;if(void 0!==m){var R=v.getEncryptionData(m);if(R.length>0&&R.every((function(e){return void 0!==e.keyIds}))&&(I=!0,t.encryptionDataEncountered(R.map((function(e){return(0,S.Z)({content:r},e)}))),_.isUsed()))return}var Z=new Ve(r,w,u,A);return Z.addEventListener("error",(function(e){b.signal.isCancelled()||(_.cancel(),t.error(e))})),Z.addEventListener("parsedInitSegment",P),Z.addEventListener("parsedMediaSegment",P),Z.addEventListener("emptyQueue",x),Z.addEventListener("requestRetry",(function(e){if(t.warning(e.error),!b.signal.isCancelled()){var n=e.segment,r=v.index;!1===r.isSegmentStillAvailable(n)?x():r.canBeOutOfSyncError(e.error,n)&&t.manifestMightBeOufOfSync()}})),Z.addEventListener("fullyLoadedSegment",(function(e){o.endOfSegment((0,S.Z)({segment:e},r),_.signal).catch(M)})),Z.start(),b.signal.register((function(){Z.removeEventListener(),Z.stop()})),a.listen(x,{includeLastObservation:!1,clearSignal:b.signal}),p.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),h.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),d.onUpdate(x,{emitCurrentValue:!1,clearSignal:b.signal}),void x();function x(){var e,n;if(!b.isUsed()){var i=a.getReference().getValue(),u=null!==(e=i.position.pending)&&void 0!==e?e:i.position.last,f=qe(r,u,a,g.getValue(),p.getValue(),h.getValue(),o),m=f.neededSegments,S=null;if(v.index.isInitialized()){if(m.length>0&&!E.isLoaded&&null!==E.segment){var T=m[0].priority;S={segment:E.segment,priority:T}}}else if(null===E.segment)s.Z.warn("Stream: Uninitialized index without an initialization segment");else if(E.isLoaded)s.Z.warn("Stream: Uninitialized index with an already loaded initialization segment");else{var k=null!==(n=i.position.pending)&&void 0!==n?n:i.position.last;S={segment:E.segment,priority:We(c.start,k)}}var A=d.getValue();if(null===A)w.setValue({initSegment:S,segmentQueue:m});else{if(A.urgent)return s.Z.debug("Stream: Urgent switch, terminate now.",y),w.setValue({initSegment:null,segmentQueue:[]}),w.finish(),b.cancel(),void t.terminating();var I=m[0],R=Z.getRequestedInitSegment(),x=Z.getRequestedMediaSegment(),P=null===x||void 0===I||x.id!==I.segment.id?[]:[I],C=null===R?null:S;if(w.setValue({initSegment:C,segmentQueue:P}),0===P.length&&null===C)return s.Z.debug("Stream: No request left, terminate",y),w.finish(),b.cancel(),void t.terminating()}if(t.streamStatusUpdate({period:c,position:i.position.last,bufferType:y,imminentDiscontinuity:f.imminentDiscontinuity,isEmptyStream:!1,hasFinishedLoading:f.hasFinishedLoading,neededSegments:f.neededSegments}),!b.signal.isCancelled()){var D=l.Z.getCurrent().UPTO_CURRENT_POSITION_CLEANUP;if(f.isBufferFull){var N=Math.max(0,u-D);N>0&&o.removeBuffer(0,N,_.signal).catch(M)}f.shouldRefreshManifest&&t.needsManifestRefresh()}}}function P(e){if(!_.isUsed()){for(var n,i=it(e.protectionData);!(n=i()).done;){var s=n.value;v.addProtectionData(s.initDataType,s.keyId,s.initData)}if(!I){var u=v.getAllEncryptionData();if(u.length>0&&(t.encryptionDataEncountered(u.map((function(e){return(0,S.Z)({content:r},e)}))),I=!0,_.isUsed()))return}if("init"!==e.segmentType){var l=e.inbandEvents,d=e.predictedSegments,c=e.needsManifestRefresh;if(!(void 0!==d&&v.index.addPredictedSegments(d,e.segment),!0===c&&(t.needsManifestRefresh(),_.isUsed())||void 0!==l&&l.length>0&&(t.inbandEvent(l),_.isUsed()))){var f=E.uniqueId;(function(e,t){return rt.apply(this,arguments)})({playbackObserver:a,content:r,initSegmentUniqueId:f,parsedSegment:e,segment:e.segment,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(M)}}else{if(v.index.isInitialized()||void 0===e.segmentList||v.index.initialize(e.segmentList),E.isLoaded=!0,null!==e.initializationData){var p=v.uniqueId;E.uniqueId=p,o.declareInitSegment(p,e.initializationData),function(e,t){return nt.apply(this,arguments)}({playbackObserver:a,content:r,initSegmentUniqueId:p,segment:e.segment,segmentData:e.initializationData,segmentBuffer:o},_.signal).then((function(e){null!==e&&t.addedSegment(e)})).catch(M)}x()}}}function M(e){_.isUsed()&&e instanceof k.FU||(_.cancel(),t.error(e))}};function st(e,t,n,r,i){i.isCancelled()||Le()((function(){e.listen((function(i){var a,o,s,u=e.getCurrentTime()+n;u=Math.min(Math.max(null!==(a=r.start)&&void 0!==a?a:0,u),null!==(o=r.end)&&void 0!==o?o:1/0);var l=!(null!==(s=i.paused.pending)&&void 0!==s?s:e.getIsPaused());t({position:u,autoPlay:l})}),{includeLastObservation:!0,clearSignal:i})}))}function ut(e,t){for(var n=0;n<e.length;n++)if(e[n].infos.period.start>=t.start)return n>0?e[n-1]:null;return e.length>0?e[e.length-1]:null}function lt(e,t){for(var n=0;n<e.length;n++)if(e[n].infos.period.start>t.start)return e[n];return null}function dt(e,t,n,r,i){if("lazy"===n.switchingMode)return{type:"continue",value:void 0};var a=r.getBufferedRanges();if(0===a.length)return{type:"continue",value:void 0};var o=(0,E.JN)(a),s=e.start,u=null==e.end?1/0:e.end,d=(0,E.tn)(o,[{start:s,end:u}]);if(0===d.length)return{type:"continue",value:void 0};r.synchronizeInventory();var c=r.getInventory(),f=function(e,t,n,r){return e.reduce((function(e,i){if(i.infos.period.id!==t.id||i.infos.adaptation.id!==n.id||!r.some((function(e){return e.id===i.infos.representation.id})))return e;var a=i.bufferedStart,o=i.bufferedEnd;return void 0===a||void 0===o||e.push({start:a,end:o}),e}),[])}(c,e,t,n.representations),v=(0,E.uH)(d,f);if(0===v.length)return{type:"continue",value:void 0};var p=i.getCurrentTime(),h=i.getReadyState();if("reload"===n.switchingMode&&(0,E.Ti)({start:s,end:u},p)&&h>1&&!(0,E.A1)(f,p))return{type:"needs-reload",value:void 0};var m="direct"===n.switchingMode,g=[],y=ut(c,e);if(null!==y&&(void 0===y.bufferedEnd||e.start-y.bufferedEnd<1)&&g.push({start:0,end:e.start+1}),!m){var _=l.Z.getCurrent().ADAP_REP_SWITCH_BUFFER_PADDINGS,b=t.type,S=_[b].before;null==S&&(S=0);var T=_[b].after;null==T&&(T=0),g.push({start:p-S,end:p+T})}if(void 0!==e.end){var k=lt(c,e);null!==k&&(void 0===k.bufferedStart||k.bufferedStart-e.end<1)&&g.push({start:e.end-1,end:Number.MAX_VALUE})}var w=(0,E.uH)(v,g);return 0===w.length?{type:"continue",value:void 0}:m?{type:"flush-buffer",value:w}:{type:"clean-buffer",value:w}}function ct(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return ft(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ft(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ft(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var vt=function(e,t,n){var r=e.playbackObserver,i=e.content,a=e.options,o=e.representationEstimator,u=e.segmentBuffer,c=e.segmentFetcherCreator,f=e.wantedBufferAhead,v=e.maxVideoBufferSize,p=i.manifest,h=i.period,m=i.adaptation,y=new k.ZP;y.linkToSignal(n);var _,b,E=new Map,A=(0,T.$l)(null,y.signal),R=(0,T.$l)(i.representations.getValue().representations,y.signal),Z=o({manifest:p,period:h,adaptation:m},A,R,r,y.signal),x=Z.estimates,P=Z.callbacks,M=c.createSegmentFetcher(m.type,{onRequestBegin:P.requestBegin,onRequestEnd:P.requestEnd,onProgress:P.requestProgress,onMetrics:P.metrics}),C=(0,T.$l)(0);return x.onUpdate((function(e){var n=e.bitrate,r=e.knownStableBitrate;a.enableFastSwitching&&C.setValueIfChanged(r),void 0!==n&&n!==_&&(_=n,s.Z.debug("Stream: new "+m.type+" bitrate estimate",n),t.bitrateEstimateChange({type:m.type,bitrate:n}))}),{emitCurrentValue:!0,clearSignal:y.signal}),void i.representations.onUpdate((function(e){void 0!==b&&b.cancel(),R.setValueIfChanged(e.representations),(b=new k.ZP).linkToSignal(y.signal),function(e,t){return D.apply(this,arguments)}(e,b.signal).catch((function(e){!0===(null==b?void 0:b.isUsed())&&k.ZP.isCancellationError(e)||(y.cancel(),t.error(e))}))}),{clearSignal:y.signal,emitCurrentValue:!0});function D(){return(D=(0,w.Z)(I().mark((function e(n,i){var a,o,s,d,c,f,v;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=dt(h,m,n,u,r),e.t0=a.type,e.next="continue"===e.t0?4:"needs-reload"===e.t0?5:"flush-buffer"===e.t0||"clean-buffer"===e.t0?8:22;break;case 4:return e.abrupt("break",23);case 5:return o=l.Z.getCurrent(),s=o.DELTA_POSITION_AFTER_RELOAD,d=m.type,e.abrupt("return",st(r,(function(e){var n=e.position,r=e.autoPlay;t.waitingMediaSourceReload({bufferType:d,period:h,position:n,autoPlay:r})}),s.bitrateSwitch,h,i));case 8:c=ct(a.value);case 9:if((f=c()).done){e.next=17;break}return v=f.value,e.next=13,u.removeBuffer(v.start,v.end,i);case 13:if(!i.isCancelled()){e.next=15;break}return e.abrupt("return");case 15:e.next=9;break;case 17:if("flush-buffer"!==a.type){e.next=21;break}if(t.needsBufferFlush(),!i.isCancelled()){e.next=21;break}return e.abrupt("return");case 21:return e.abrupt("break",23);case 22:(0,g.Z)(a);case 23:O(i);case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e){var n=new k.ZP;n.linkToSignal(e);var r=x.getValue().representation;if(null!==r){var i=(0,T.$l)(null,n.signal);x.onUpdate((function(e){if(null!==e.representation&&e.representation.id!==r.id)return e.urgent?(s.Z.info("Stream: urgent Representation switch",m.type),i.setValue({urgent:!0})):(s.Z.info("Stream: slow Representation switch",m.type),i.setValue({urgent:!1}))}),{clearSignal:n.signal,emitCurrentValue:!0});var a={type:m.type,period:h,representation:r};if(A.setValue(r),!y.isUsed()&&(t.representationChange(a),!y.isUsed())){var o={streamStatusUpdate:t.streamStatusUpdate,encryptionDataEncountered:t.encryptionDataEncountered,manifestMightBeOufOfSync:t.manifestMightBeOufOfSync,needsManifestRefresh:t.needsManifestRefresh,inbandEvent:t.inbandEvent,warning:t.warning,error:function(e){y.cancel(),t.error(e)},addedSegment:function(e){P.addedSegment(e),y.isUsed()||t.addedSegment(e)},terminating:function(){if(!n.isUsed())return n.cancel(),O(e)}};L(r,i,o,e)}}}function L(e,n,i,o){var l=new k.ZP;l.linkToSignal(o);var c=(0,T.lR)(f,(function(t){return t*function(e){var t=E.get(e.id),n=void 0!==t?t:1;void 0===t&&E.set(e.id,n);return n}(e)}),l.signal),g="video"===m.type?v:(0,T.$l)(1/0);s.Z.info("Stream: changing representation",m.type,e.id,e.bitrate);var _=(0,S.Z)({},i,{error:function(t){var r,a=(0,d.Z)(t,{defaultCode:"NONE",defaultReason:"Unknown `RepresentationStream` error"});if("BUFFER_FULL_ERROR"!==a.code)i.error(t);else{var s=f.getValue(),u=.7*(null!==(r=E.get(e.id))&&void 0!==r?r:1);if(u<=.05||s*u<=2)throw a;E.set(e.id,u),(0,le.Z)(4e3,y.signal).then((function(){return L(e,n,i,o)})).catch(N.Z)}},terminating:function(){l.cancel(),i.terminating()}});ot({playbackObserver:r,content:{representation:e,adaptation:m,period:h,manifest:p},segmentBuffer:u,segmentFetcher:M,terminate:n,options:{bufferGoal:c,maxBufferSize:g,drmSystemId:a.drmSystemId,fastSwitchThreshold:C}},_,o),p.addEventListener("manifestUpdate",(function(e){for(var n,i=ct(e.updatedPeriods);!(n=i()).done;){var a=n.value;if(a.period.id===h.id)for(var s,u=function(){if(s.value.id===m.id){var e=m.type;return{v:st(r,(function(n){var r=n.position,i=n.autoPlay;t.waitingMediaSourceReload({bufferType:e,period:h,position:r,autoPlay:i})}),0,h,o)}}},l=ct(a.result.removedAdaptations);!(s=l()).done;){var d=u();if("object"==typeof d)return d.v}else if(a.period.start>h.start)break}}),o)}},pt=n(9252);var ht=function(e,t){var n=e.split(";"),r=n[0],i=n.slice(1),a=t.split(";"),o=a[0],s=a.slice(1);if(r!==o)return!1;var u=(0,p.Z)(i,(function(e){return(0,pt.Z)(e,"codecs=")})),l=(0,p.Z)(s,(function(e){return(0,pt.Z)(e,"codecs=")}));if(void 0===u||void 0===l)return!1;var d=u.substring(7),c=l.substring(7);return d.split(".")[0]===c.split(".")[0]};function mt(e,t,n,r,i,a){if(void 0!==e.codec&&"reload"===a.onCodecSwitch&&!function(e,t){return e.getPlayableRepresentations().some((function(e){return ht(e.getMimeTypeString(),t)}))}(n,e.codec))return{type:"needs-reload",value:void 0};var o=e.getBufferedRanges();if(0===o.length)return{type:"continue",value:void 0};var s=(0,E.JN)(o),u=t.start,d=null==t.end?1/0:t.end,c=(0,E.tn)(s,[{start:u,end:d}]);if(0===c.length)return{type:"continue",value:void 0};e.synchronizeInventory();var f=e.getInventory();if(!f.some((function(e){return e.infos.period.id===t.id&&e.infos.adaptation.id!==n.id})))return{type:"continue",value:void 0};var v=function(e,t,n){return e.reduce((function(e,r){if(r.infos.period.id!==t.id||r.infos.adaptation.id!==n.id)return e;var i=r.bufferedStart,a=r.bufferedEnd;return void 0===i||void 0===a||e.push({start:i,end:a}),e}),[])}(f,t,n),p=(0,E.uH)(c,v);if(0===p.length)return{type:"continue",value:void 0};var h=i.currentTime;if("reload"===r&&(0,E.Ti)({start:u,end:d},h)&&(i.readyState>1||!n.getPlayableRepresentations().some((function(t){var n;return ht(t.getMimeTypeString(),null!==(n=e.codec)&&void 0!==n?n:"")})))&&!(0,E.A1)(v,h))return{type:"needs-reload",value:void 0};var m="direct"===r,g=[],y=ut(f,t);null!==y&&(void 0===y.bufferedEnd||t.start-y.bufferedEnd<1)&&g.push({start:0,end:t.start+1});var _=n.type,b=l.Z.getCurrent().ADAP_REP_SWITCH_BUFFER_PADDINGS,S=b[_].before;null==S&&(S=0);var T=b[_].after;if(null==T&&(T=0),m||g.push({start:h-S,end:h+T}),void 0!==t.end){var k=lt(f,t);null!==k&&(void 0===k.bufferedStart||k.bufferedStart-t.end<1)&&g.push({start:t.end-1,end:Number.MAX_VALUE})}var w=(0,E.uH)(p,g);return 0===w.length?{type:"continue",value:void 0}:m&&"text"!==n.type?{type:"flush-buffer",value:w}:{type:"clean-buffer",value:w}}function gt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return yt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _t(e,t,n,r){var i=e.getStatus(t);if("initialized"===i.type)return s.Z.info("Stream: Reusing a previous SegmentBuffer for the type",t),i.value;var a=function(e){var t=e.getPlayableRepresentations();if(0===t.length){throw new c.Z("NO_PLAYABLE_REPRESENTATION","No Representation in the chosen "+e.type+" Adaptation can be played",{adaptation:e})}return t[0].getMimeTypeString()}(n),o="text"===t?r.textTrackOptions:void 0;return e.createSegmentBuffer(t,a,o)}function bt(e,t,n,r,i,a){var o=r.period,u=!1;function l(){var r=e.getReference().getValue(),a=t.getValue(),l=r.position.last;void 0!==o.end&&l+a>=o.end&&(s.Z.debug('Stream: full "empty" AdaptationStream',n),u=!0),i.streamStatusUpdate({period:o,bufferType:n,position:l,imminentDiscontinuity:null,isEmptyStream:!0,hasFinishedLoading:u,neededSegments:[]})}t.onUpdate(l,{emitCurrentValue:!1,clearSignal:a}),e.listen(l,{includeLastObservation:!1,clearSignal:a}),l()}var St=function(e,t,n){var r=e.bufferType,i=e.content,a=e.garbageCollectors,o=e.playbackObserver,u=e.representationEstimator,c=e.segmentFetcherCreator,f=e.segmentBuffersStore,v=e.options,p=e.wantedBufferAhead,h=e.maxVideoBufferSize,m=i.manifest,g=i.period,y=(0,T.ZP)(void 0,n);if(t.periodStreamReady({type:r,manifest:m,period:g,adaptationRef:y}),!n.isCancelled()){var _,b=!0;y.onUpdate((function(e){(0,w.Z)(I().mark((function i(){var u,d,c,h,y,S,E,T,w,R,Z,x,P,M,C,D,N,O;return I().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(void 0!==e){i.next=2;break}return i.abrupt("return");case 2:if((d=new k.ZP).linkToSignal(n),null==_||_.cancel(),_=d,null!==e){i.next=34;break}if(s.Z.info("Stream: Set no "+r+" Adaptation. P:",g.start),"initialized"!==(c=f.getStatus(r)).type){i.next=26;break}if(s.Z.info("Stream: Clearing previous "+r+" SegmentBuffer"),!Ne.isNative(r)){i.next=15;break}return i.abrupt("return",st(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),0,g,d.signal));case 15:if(h=null!==(u=g.end)&&void 0!==u?u:1/0,!(g.start>h)){i.next=20;break}s.Z.warn("Stream: Can't free buffer: period's start is after its end"),i.next=24;break;case 20:return i.next=22,c.value.removeBuffer(g.start,h,d.signal);case 22:if(!d.isUsed()){i.next=24;break}return i.abrupt("return");case 24:i.next=30;break;case 26:if("uninitialized"!==c.type){i.next=30;break}if(f.disableSegmentBuffer(r),!d.isUsed()){i.next=30;break}return i.abrupt("return");case 30:if(t.adaptationChange({type:r,adaptation:null,period:g}),!d.isUsed()){i.next=33;break}return i.abrupt("return");case 33:return i.abrupt("return",bt(o,p,r,{period:g},t,d.signal));case 34:if(y=l.Z.getCurrent(),S=y.DELTA_POSITION_AFTER_RELOAD,E=b?0:"audio"===r?S.trackSwitch.audio:"video"===r?S.trackSwitch.video:S.trackSwitch.other,b=!1,!Ne.isNative(r)||"disabled"!==f.getStatus(r).type){i.next=39;break}return i.abrupt("return",st(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),E,g,d.signal));case 39:if(m.addEventListener("manifestUpdate",(function(e){for(var n,i=gt(e.updatedPeriods);!(n=i()).done;){var a=n.value;if(a.period.id===g.id)for(var s,u=gt(a.result.removedAdaptations);!(s=u()).done;){if(s.value.id===T.id)return st(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),E,g,d.signal)}else if(a.period.start>g.start)break}}),_.signal),T=e.adaptation,w=e.representations,s.Z.info("Stream: Updating "+r+" adaptation","A: "+T.id,"P: "+g.start),t.adaptationChange({type:r,adaptation:T,period:g}),!d.isUsed()){i.next=45;break}return i.abrupt("return");case 45:if(R=o.getReadyState(),Z=_t(f,r,T,v),x={currentTime:o.getCurrentTime(),readyState:R},"needs-reload"!==(P=mt(Z,g,T,e.switchingMode,x,v)).type){i.next=51;break}return i.abrupt("return",st(o,(function(e){var n=e.position,i=e.autoPlay;t.waitingMediaSourceReload({bufferType:r,period:g,position:n,autoPlay:i})}),E,g,d.signal));case 51:return i.next=53,f.waitForUsableBuffers(d.signal);case 53:if(!d.isUsed()){i.next=55;break}return i.abrupt("return");case 55:if("flush-buffer"!==P.type&&"clean-buffer"!==P.type){i.next=69;break}M=gt(P.value);case 57:if((C=M()).done){i.next=65;break}return D=C.value,N=D.start,O=D.end,i.next=61,Z.removeBuffer(N,O,d.signal);case 61:if(!d.isUsed()){i.next=63;break}return i.abrupt("return");case 63:i.next=57;break;case 65:if("flush-buffer"!==P.type){i.next=69;break}if(t.needsBufferFlush(),!d.isUsed()){i.next=69;break}return i.abrupt("return");case 69:a.get(Z)(d.signal),A(T,w,Z,d.signal);case 71:case"end":return i.stop()}}),i)})))().catch((function(e){e instanceof k.FU||(null==_||_.cancel(),t.error(e))}))}),{clearSignal:n,emitCurrentValue:!0})}function A(e,n,i,a){var l=function(e,t){return e.deriveReadOnlyObserver((function(e,n){var r=(0,T.ZP)(i(),n);return e.onUpdate(a,{clearSignal:n,emitCurrentValue:!1}),r;function i(){var n=e.getValue(),r=t.getBufferedRanges(),i=(0,E.L7)(r,n.position.last);return(0,S.Z)({},n,{bufferGap:i})}function a(){r.setValue(i())}}))}(o,i);vt({content:{manifest:m,period:g,adaptation:e,representations:n},options:v,playbackObserver:l,representationEstimator:u,segmentBuffer:i,segmentFetcherCreator:c,wantedBufferAhead:p,maxVideoBufferSize:h},Object.assign(Object.assign({},t),{error:function(e){if(!Ne.isNative(r)){s.Z.error("Stream: "+r+" Stream crashed. Aborting it.",e instanceof Error?e:""),f.disposeSegmentBuffer(r);var n=(0,d.Z)(e,{defaultCode:"NONE",defaultReason:"Unknown `AdaptationStream` error"});if(t.warning(n),a.isCancelled())return;return bt(o,p,r,{period:g},t,a)}s.Z.error("Stream: "+r+" Stream crashed. Stopping playback.",e instanceof Error?e:""),t.error(e)}}),a)}};function Et(e,t){if(0===t.length)return[];e.synchronizeInventory();for(var n=[],r=e.getInventory(),i=function(){var i=r[a];if(t.some((function(e){return i.infos.period.id===e.period.id&&i.infos.adaptation.id===e.adaptation.id&&i.infos.representation.id===e.representation.id}))){var o=i.bufferedStart,u=i.bufferedEnd;if(void 0===o||void 0===u){s.Z.warn("SO: No buffered start or end found from a segment.");var l=e.getBufferedRanges(),d=l.length;return 0===d?{v:[]}:{v:[{start:l.start(0),end:l.end(d-1)}]}}var c=n[n.length-1];void 0!==c&&c.end===o?c.end=u:n.push({start:o,end:u})}},a=0;a<r.length;a++){var o=i();if("object"==typeof o)return o.v}return n}function Tt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return kt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function wt(e,t){if(0===t.length)return!1;var n=e.position.last;return e.speed>=0?t[t.length-1].end>=n-5:t[0].start<=n+5}var At=function(e,t,n,r,i,a,o,u){for(var d,f=e.manifest,v=e.initialPeriod,p=a.maxBufferAhead,h=a.maxBufferBehind,m=a.wantedBufferAhead,g=a.maxVideoBufferSize,y=l.Z.getCurrent(),_=y.MAXIMUM_MAX_BUFFER_AHEAD,b=y.MAXIMUM_MAX_BUFFER_BEHIND,S=new Be((function(e){var n=e.bufferType,r=null!=b[n]?b[n]:1/0,i=null!=_[n]?_[n]:1/0;return function(n){Fe({segmentBuffer:e,playbackObserver:t,maxBufferBehind:(0,T.lR)(h,(function(e){return Math.min(e,r)}),n),maxBufferAhead:(0,T.lR)(p,(function(e){return Math.min(e,i)}),n)},n)}})),E=Tt(r.getBufferTypes());!(d=E()).done;){A(d.value,v)}function A(e,n){var i=new Ue((function(e,t){return e.start-t.start})),a=!1,l=new k.ZP;return l.linkToSignal(u),t.listen((function(t){var n,r,c=t.position,v=null!==(n=c.pending)&&void 0!==n?n:c.last;if(a&&function(e){var t=i.head(),n=i.last();if(null==t||null==n)return!0;return t.start>e||(null==n.end?1/0:n.end)<e}(v)){for(s.Z.info("Stream: Destroying all PeriodStreams due to out of bounds situation",e,v),a=!1;i.length()>0;){var p=i.get(i.length()-1);i.removeElement(p),o.periodStreamCleared({type:e,manifest:f,period:p})}l.cancel(),(l=new k.ZP).linkToSignal(u);var h=null!==(r=f.getPeriodForTime(v))&&void 0!==r?r:f.getNextPeriod(v);void 0!==h?d(h):s.Z.warn("Stream: The wanted position is not found in the Manifest.")}}),{clearSignal:u,includeLastObservation:!0}),f.addEventListener("decipherabilityUpdate",(function(e){u.isCancelled()||function(e){return v.apply(this,arguments)}(e).catch((function(e){u.isCancelled()||(l.cancel(),o.error(e))}))}),u),d(n);function d(t){var n=Object.assign(Object.assign({},o),{waitingMediaSourceReload:function(e){var t=i.head();if(void 0===t||t.id!==e.period.id)o.lockedStream({bufferType:e.bufferType,period:e.period});else{var n=e.position,r=e.autoPlay;o.needsMediaSourceReload({position:n,autoPlay:r})}},periodStreamReady:function(e){a=!0,i.add(e.period),o.periodStreamReady(e)},periodStreamCleared:function(e){i.removeElement(e.period),o.periodStreamCleared(e)},error:function(e){l.cancel(),o.error(e)}});R(e,t,n,l.signal)}function v(){return v=(0,w.Z)(I().mark((function n(v){var p,h,m,g,y,_,b,S,E,T,w,A,R;return I().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(p=r.getStatus(e),0!==(h=v.filter((function(t){return t.adaptation.type===e}))).length&&"initialized"===p.type&&!h.every((function(e){return!0===e.representation.decipherable}))){n.next=4;break}return n.abrupt("return");case 4:for(m=p.value,g=h.filter((function(e){return void 0===e.representation.decipherable})),y=h.filter((function(e){return!1===e.representation.decipherable})),_=Et(m,y),b=Et(m,g),a=!1,s.Z.info("Stream: Destroying all PeriodStreams for decipherability matters",e);i.length()>0;)S=i.get(i.length()-1),i.removeElement(S),o.periodStreamCleared({type:e,manifest:f,period:S});l.cancel(),(l=new k.ZP).linkToSignal(u),E=0,T=[].concat(_,b);case 16:if(!(E<T.length)){n.next=24;break}if(w=T[E],A=w.start,R=w.end,!(A<R)){n.next=21;break}return n.next=21,m.removeBuffer(A,R,u);case 21:E++,n.next=16;break;case 24:Le()((function(){var e,n;if(!u.isCancelled()){var r=t.getReference().getValue();if(wt(r,_)){var i=!(null!==(e=r.paused.pending)&&void 0!==e?e:t.getIsPaused());if(o.needsDecipherabilityFlush({position:r.position.last,autoPlay:i,duration:r.duration}),u.isCancelled())return}else if(wt(r,b)&&(o.needsBufferFlush(),u.isCancelled()))return;var a=null!==(n=r.position.pending)&&void 0!==n?n:r.position.last,s=f.getPeriodForTime(a);null!=s?d(s):o.error(new c.Z("MEDIA_TIME_NOT_FOUND","The wanted position is not found in the Manifest."))}}));case 25:case"end":return n.stop()}}),n)}))),v.apply(this,arguments)}}function R(e,o,u,l){s.Z.info("Stream: Creating new Stream for",e,o.start);var d=null,c=new k.ZP;c.linkToSignal(l),t.listen((function(t,n){var r,i,a=t.position;void 0!==o.end&&(null!==(r=a.pending)&&void 0!==r?r:a.last)>=o.end&&(s.Z.info("Stream: Destroying PeriodStream as the current playhead moved above it",e,o.start,null!==(i=a.pending)&&void 0!==i?i:a.last,o.end),n(),u.periodStreamCleared({type:e,manifest:f,period:o}),c.cancel())}),{clearSignal:l,includeLastObservation:!0});var v,p={bufferType:e,content:{manifest:f,period:o},garbageCollectors:S,maxVideoBufferSize:g,segmentFetcherCreator:i,segmentBuffersStore:r,options:a,playbackObserver:t,representationEstimator:n,wantedBufferAhead:m},h=Object.assign(Object.assign({},u),{streamStatusUpdate:function(t){if(t.hasFinishedLoading){var n=f.getPeriodAfter(o);null!==n&&function(t){if(null!==d){if(d.period.id===t.id)return;s.Z.warn("Stream: Creating next `PeriodStream` while one was already created.",e,t.id,d.period.id),u.periodStreamCleared({type:e,manifest:f,period:d.period}),d.canceller.cancel()}var n=new k.ZP;n.linkToSignal(l),d={canceller:n,period:t},R(e,t,u,d.canceller.signal)}(n)}else null!==d&&(s.Z.info("Stream: Destroying next PeriodStream due to current one being active",e,d.period.start),u.periodStreamCleared({type:e,manifest:f,period:d.period}),d.canceller.cancel(),d=null);u.streamStatusUpdate(t)},error:function(e){null!==d&&(d.canceller.cancel(),d=null),c.cancel(),u.error(e)}});St(p,h,c.signal),v=c.signal,f.addEventListener("manifestUpdate",(function(n){for(var r,i=function(){var n=r.value;if(n.id===o.id)f.periods.length>0&&f.periods[0].start<=n.start&&st(t,(function(t){var r=t.position,i=t.autoPlay;u.waitingMediaSourceReload({bufferType:e,period:n,position:r,autoPlay:i})}),0,{start:void 0,end:void 0},v);else if(n.start>o.start)return"break"},a=Tt(n.removedPeriods);!(r=a()).done&&"break"!==i(););if(n.addedPeriods.length>0&&null!==d){var l=f.getPeriodAfter(o);null!==l&&d.period.id===l.id||(s.Z.warn("Stream: Destroying next PeriodStream due to new one being added",e,d.period.start),u.periodStreamCleared({type:e,manifest:f,period:d.period}),d.canceller.cancel(),d=null)}}),v)}},It=At,Rt=n(379);function Zt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return xt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function xt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Pt=function(e){function n(t,n,r){var i;(i=e.call(this)||this)._canceller=new k.ZP,i._manifest=t,i._activeStreams=new Map,i._allBufferTypes=r,i._lastCurrentPeriodId=null;var a=new Mt(t);i._maximumPositionCalculator=a;var o=i._canceller.signal;return n.listen((function(e){var n,r=e.position,o=null!==(n=r.pending)&&void 0!==n?n:r.last;if(o<t.getMinimumSafePosition()){var s=new c.Z("MEDIA_TIME_BEFORE_MANIFEST","The current position is behind the earliest time announced in the Manifest.");i.trigger("warning",s)}else if(o>a.getMaximumAvailablePosition()){var u=new c.Z("MEDIA_TIME_AFTER_MANIFEST","The current position is after the latest time announced in the Manifest.");i.trigger("warning",u)}}),{includeLastObservation:!0,clearSignal:o}),t.addEventListener("manifestUpdate",(function(){i.trigger("durationUpdate",i._getManifestDuration()),o.isCancelled()||i._checkEndOfStream()}),o),i}(0,t.Z)(n,e);var r=n.prototype;return r.getCurrentDuration=function(){return this._getManifestDuration()},r.onAdaptationChange=function(e,t,n){if(this._manifest.isLastPeriodKnown){var r=this._manifest.periods[this._manifest.periods.length-1];if(t.id===(null==r?void 0:r.id)&&("audio"===e||"video"===e)){"audio"===e?this._maximumPositionCalculator.updateLastAudioAdaptation(n):this._maximumPositionCalculator.updateLastVideoAdaptation(n);var i=this._maximumPositionCalculator.getEndingPosition(),a=void 0!==i?{isEnd:!0,duration:i}:{isEnd:!1,duration:this._maximumPositionCalculator.getMaximumAvailablePosition()};this.trigger("durationUpdate",a)}}this._canceller.isUsed()||null===n&&this._addActivelyLoadedPeriod(t,e)},r.onRepresentationChange=function(e,t){this._addActivelyLoadedPeriod(t,e)},r.onPeriodCleared=function(e,t){this._removeActivelyLoadedPeriod(t,e)},r.onLastSegmentFinishedLoading=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod||(t.hasFinishedLoadingLastPeriod=!0,this._checkEndOfStream())},r.onLastSegmentLoadingResume=function(e){var t=this._lazilyCreateActiveStreamInfo(e);t.hasFinishedLoadingLastPeriod&&(t.hasFinishedLoadingLastPeriod=!1,this._checkEndOfStream())},r.dispose=function(){this.removeEventListener(),this._canceller.cancel()},r._addActivelyLoadedPeriod=function(e,t){var n=this._lazilyCreateActiveStreamInfo(t);n.activePeriods.has(e)||(n.activePeriods.add(e),this._checkCurrentPeriod())},r._removeActivelyLoadedPeriod=function(e,t){var n=this._activeStreams.get(t);void 0!==n&&n.activePeriods.has(e)&&(n.activePeriods.removeElement(e),this._checkCurrentPeriod())},r._checkCurrentPeriod=function(){var e=this;if(0!==this._allBufferTypes.length){var t=this._activeStreams.get(this._allBufferTypes[0]);if(void 0!==t)for(var n,r=function(){for(var t=n.value,r=!0,i=1;i<e._allBufferTypes.length;i++){var a=e._activeStreams.get(e._allBufferTypes[i]);if(void 0===a)return{v:void 0};if(!a.activePeriods.toArray().some((function(e){return e.id===t.id}))){r=!1;break}}if(r)return e._lastCurrentPeriodId!==t.id&&(e._lastCurrentPeriodId=t.id,e.trigger("periodChange",t)),{v:void 0}},i=Zt(t.activePeriods.toArray());!(n=i()).done;){var a=r();if("object"==typeof a)return a.v}}},r._getManifestDuration=function(){var e=this._maximumPositionCalculator.getEndingPosition();return void 0!==e?{isEnd:!0,duration:e}:{isEnd:!1,duration:this._maximumPositionCalculator.getMaximumAvailablePosition()}},r._lazilyCreateActiveStreamInfo=function(e){var t=this._activeStreams.get(e);return void 0===t&&(t={activePeriods:new Ue((function(e,t){return e.start-t.start})),hasFinishedLoadingLastPeriod:!1},this._activeStreams.set(e,t)),t},r._checkEndOfStream=function(){var e=this;this._manifest.isLastPeriodKnown&&(this._allBufferTypes.every((function(t){var n=e._activeStreams.get(t);return void 0!==n&&n.hasFinishedLoadingLastPeriod}))?this.trigger("endOfStream",null):this.trigger("resumeStream",null))},n}(y.Z),Mt=function(){function e(e){this._manifest=e,this._lastAudioAdaptation=void 0,this._lastVideoAdaptation=void 0}var t=e.prototype;return t.updateLastAudioAdaptation=function(e){this._lastAudioAdaptation=e},t.updateLastVideoAdaptation=function(e){this._lastVideoAdaptation=e},t.getMaximumAvailablePosition=function(){var e;if(this._manifest.isDynamic)return null!==(e=this._manifest.getLivePosition())&&void 0!==e?e:this._manifest.getMaximumSafePosition();if(void 0===this._lastVideoAdaptation||void 0===this._lastAudioAdaptation)return this._manifest.getMaximumSafePosition();if(null===this._lastAudioAdaptation){if(null===this._lastVideoAdaptation)return this._manifest.getMaximumSafePosition();var t=Ct(this._lastVideoAdaptation);return"number"!=typeof t?this._manifest.getMaximumSafePosition():t}if(null===this._lastVideoAdaptation){var n=Ct(this._lastAudioAdaptation);return"number"!=typeof n?this._manifest.getMaximumSafePosition():n}var r=Ct(this._lastAudioAdaptation),i=Ct(this._lastVideoAdaptation);return"number"!=typeof r||"number"!=typeof i?this._manifest.getMaximumSafePosition():Math.min(r,i)},t.getEndingPosition=function(){var e,t;if(!this._manifest.isDynamic)return this.getMaximumAvailablePosition();if(void 0!==this._lastVideoAdaptation&&void 0!==this._lastAudioAdaptation){if(null===this._lastAudioAdaptation)return null===this._lastVideoAdaptation?void 0:null!==(e=Dt(this._lastVideoAdaptation))&&void 0!==e?e:void 0;if(null===this._lastVideoAdaptation)return null!==(t=Dt(this._lastAudioAdaptation))&&void 0!==t?t:void 0;var n=Dt(this._lastAudioAdaptation),r=Dt(this._lastVideoAdaptation);return"number"!=typeof n||"number"!=typeof r?void 0:Math.min(n,r)}},e}();function Ct(e){for(var t,n=e.representations,r=null,i=0;i<n.length;i++)if(n[i].index!==t){t=n[i].index;var a=n[i].index.getLastAvailablePosition();if(void 0===a)return;null!==a&&(r=(0,b.Z)(r)?a:Math.min(r,a))}return r}function Dt(e){for(var t,n=e.representations,r=null,i=0;i<n.length;i++)if(n[i].index!==t){t=n[i].index;var a=n[i].index.getEnd();if(void 0===a)return;null!==a&&(r=(0,b.Z)(r)?a:Math.min(r,a))}return r}var Nt=n(5767),Ot=n(3774),Lt=n(6923);function Ut(e,t,n){if(null!==t&&"closed"!==t.readyState){for(var r=t.readyState,i=t.sourceBuffers,a=i.length-1;a>=0;a--){var o=i[a];try{"open"===r&&(s.Z.info("Init: Removing SourceBuffer from mediaSource"),o.abort()),t.removeSourceBuffer(o)}catch(e){s.Z.warn("Init: Error while disposing SourceBuffer",e instanceof Error?e:"")}}i.length>0&&s.Z.warn("Init: Not all SourceBuffers could have been removed.")}if((0,Nt.Z)(e),null!==n)try{s.Z.debug("Init: Revoking previous URL"),URL.revokeObjectURL(n)}catch(e){s.Z.warn("Init: Error while revoking the media source URL",e instanceof Error?e:"")}}function Bt(e,t){return(0,D.Z)(t,(function(n){var r=function(e,t){if(null==Ot.J)throw new c.Z("MEDIA_SOURCE_NOT_SUPPORTED","No MediaSource Object was found in the current browser.");var n=(0,Lt.Z)(e.src)?e.src:null;Ut(e,null,n),s.Z.info("Init: Creating MediaSource");var r=new Ot.J,i=URL.createObjectURL(r);return s.Z.info("Init: Attaching MediaSource URL to the media element",i),e.src=i,t.register((function(){Ut(e,r,i)})),r}(e,t);i.u_(r,(function(){n(r)}),t)}))}function Ft(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return zt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function zt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Vt=i.x6,Kt=i.u_,Gt=i.y4;function jt(e,t){if(s.Z.debug("Init: Trying to call endOfStream"),"open"===e.readyState){var n=e.sourceBuffers,r=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];r.updating&&t.push(r)}return t}(n);if(0===r.length)return s.Z.info("Init: Triggering end of stream"),void e.endOfStream();s.Z.debug("Init: Waiting SourceBuffers to be updated before calling endOfStream.");var i=new k.ZP;i.linkToSignal(t);for(var a,o=Ft(r);!(a=o()).done;){var u=a.value;Gt(u,(function(){i.cancel(),jt(e,t)}),i.signal)}Vt(n,(function(){i.cancel(),jt(e,t)}),i.signal)}else s.Z.debug("Init: MediaSource not open, cancel endOfStream")}function Ht(e,t,n){if(!(0,b.Z)(n)){var r,i=e.getMinimumSafePosition();if(e.isLive&&(r=e.getLivePosition()),void 0===r&&(r=e.getMaximumSafePosition()),!(0,b.Z)(n.position))return s.Z.debug("Init: using startAt.minimumPosition"),Math.max(Math.min(n.position,r),i);if(!(0,b.Z)(n.wallClockTime)){s.Z.debug("Init: using startAt.wallClockTime");var a=void 0===e.availabilityStartTime?0:e.availabilityStartTime,o=n.wallClockTime-a;return Math.max(Math.min(o,r),i)}if(!(0,b.Z)(n.fromFirstPosition)){s.Z.debug("Init: using startAt.fromFirstPosition");var u=n.fromFirstPosition;return u<=0?i:Math.min(r,i+u)}if(!(0,b.Z)(n.fromLastPosition)){s.Z.debug("Init: using startAt.fromLastPosition");var d=n.fromLastPosition;return d>=0?r:Math.max(i,r+d)}if(!(0,b.Z)(n.percentage)){s.Z.debug("Init: using startAt.percentage");var c=n.percentage;return c>100?r:c<0?i:i+(r-i)*(+c/100)}}var f=e.getMinimumSafePosition();if(e.isLive){var v,p=e.suggestedPresentationDelay,h=e.clockOffset,m=e.getMaximumSafePosition(),g=l.Z.getCurrent().DEFAULT_LIVE_GAP;if(void 0===h)s.Z.info("Init: no clock offset found for a live content, starting close to maximum available position"),v=m;else{s.Z.info("Init: clock offset found for a live content, checking if we can start close to it");var y=void 0===e.availabilityStartTime?0:e.availabilityStartTime,_=(performance.now()+h)/1e3-y;v=Math.min(m,_)}var S=void 0!==p?p:t?g.LOW_LATENCY:g.DEFAULT;return s.Z.debug("Init: "+v+" defined as the live time, applying a live gap of "+S),Math.max(v-S,f)}return s.Z.info("Init: starting at the minimum available position:",f),f}var Wt=n(1757),qt=n(8833),Yt=n(8799);var Xt=31536e3,Qt=function(){function e(e){this._mediaSource=e,this._currentMediaSourceDurationUpdateCanceller=null}var t=e.prototype;return t.updateDuration=function(e,t){null!==this._currentMediaSourceDurationUpdateCanceller&&this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=new k.ZP;var n=this._mediaSource,r=this._currentMediaSourceDurationUpdateCanceller.signal,a=function(e,t){var n=(0,T.ZP)("open"===e.readyState,t);return(0,i.u_)(e,(function(){n.setValueIfChanged(!0)}),t),(0,i.N8)(e,(function(){n.setValueIfChanged(!1)}),t),(0,i.k6)(e,(function(){n.setValueIfChanged(!1)}),t),n}(n,r),o=new k.ZP;o.linkToSignal(r),a.onUpdate((function(){if(o.cancel(),!a.getValue())return;(o=new k.ZP).linkToSignal(r);var i=function(e,t){if(0===e.length){var n=(0,T.ZP)(!1);return n.finish(),n}var r=(0,T.ZP)(!1,t);o();for(var i=function(){var n=e[a];n.addEventListener("updatestart",o),n.addEventListener("update",o),t.register((function(){n.removeEventListener("updatestart",o),n.removeEventListener("update",o)}))},a=0;a<e.length;a++)i();return r;function o(){for(var t=0;t<e.length;t++){if(e[t].updating)return void r.setValueIfChanged(!0)}r.setValueIfChanged(!1)}}(n.sourceBuffers,o.signal),s=new k.ZP;return s.linkToSignal(o.signal),i.onUpdate((function(r){s.cancel(),(s=new k.ZP).linkToSignal(o.signal),r||Jt(n,e,t,s.signal)}),{clearSignal:o.signal,emitCurrentValue:!0})}),{emitCurrentValue:!0,clearSignal:r})},t.stopUpdating=function(){null!==this._currentMediaSourceDurationUpdateCanceller&&(this._currentMediaSourceDurationUpdateCanceller.cancel(),this._currentMediaSourceDurationUpdateCanceller=null)},e}();function $t(e,t,n){var r=t;n||(r=o.lV?1/0:en(t));for(var i=0,a=0;a<e.sourceBuffers.length;a++){var u=e.sourceBuffers[a],l=u.buffered.length;l>0&&(i=Math.max(u.buffered.end(l-1)))}if(r===e.duration)return"success";if(i>r){if(i<e.duration)try{s.Z.info("Init: Updating duration to what is currently buffered",i),e.duration=i}catch(e){return s.Z.warn("Duration Updater: Can't update duration on the MediaSource.",e instanceof Error?e:""),"failed"}return"partial"}var d=e.duration;try{s.Z.info("Init: Updating duration",r),e.duration=r,"open"!==e.readyState||isFinite(r)||e.setLiveSeekableRange(0,en(t))}catch(e){return s.Z.warn("Duration Updater: Can't update duration on the MediaSource.",e instanceof Error?e:""),"failed"}var c=Math.abs(e.duration-r);return c>=.1?c<Math.abs(e.duration-d)?"partial":"failed":"success"}function Jt(e,t,n,r){if("success"!==$t(e,t,n))var i=setTimeout((function(){a(),Jt(e,t,n,r)}),2e3),a=r.register((function(){clearTimeout(i)}))}function en(e){return Math.max(Math.pow(2,32),e+Xt)}var tn=n(6199);var nn=function(e,t){return e.id===t.id&&e.start===t.start&&e.end===t.end};var rn=function(e,t){for(var n=[],r=t.periods,i=0;i<r.length;i++){r[i].streamEvents.forEach((function(t){for(var r=t.start,i=t.end,a=t.id,o=t.data,s=0;s<e.length;s++){var u=e[s];if(nn(u,{id:a,start:r,end:i}))return void n.push(u)}if(void 0===i){var l={start:r,id:a,data:o,publicEvent:{start:r,data:o}};n.push(l)}else{var d={start:r,end:i,id:a,data:o,publicEvent:{start:r,end:i,data:o}};n.push(d)}}))}return n};function an(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return on(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return on(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function on(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function sn(e){return void 0!==e.end}var un=function(e,t,n,r,i,a){var o=new WeakMap,s=(0,T.ZP)(rn([],e),a);e.addEventListener("manifestUpdate",(function(){var t=s.getValue();s.setValue(rn(t,e))}),a);var u=!1,d=new k.ZP;d.linkToSignal(a),s.onUpdate((function(e){if(0!==e.length){if(!u){u=!0;var c=h(),f=l.Z.getCurrent().STREAM_EVENT_EMITTER_POLL_INTERVAL,v=setInterval(p,f);n.listen(p,{includeLastObservation:!1,clearSignal:d.signal}),d.signal.register((function(){clearInterval(v)}))}}else u&&(d.cancel(),(d=new k.ZP).linkToSignal(a),u=!1);function p(){var e=h();!function(e,t,n,a){for(var s=t.currentTime,u=n.isSeeking,l=n.currentTime,d=[],c=[],f=0;f<e.length;f++){var v=e[f],p=v.start,h=sn(v)?v.end:void 0;o.has(v)?(p>l||void 0!==h&&l>=h)&&(sn(v)&&c.push(v.publicEvent),o.delete(v)):p<=l&&void 0!==h&&l<h?(d.push({type:"stream-event",value:v.publicEvent}),o.set(v,!0)):s<p&&l>=(null!=h?h:p)&&(u?d.push({type:"stream-event-skip",value:v.publicEvent}):(d.push({type:"stream-event",value:v.publicEvent}),sn(v)&&c.push(v.publicEvent)))}if(d.length>0)for(var m,g=an(d);!(m=g()).done;){var y=m.value;if("stream-event"===y.type?r(y.value):i(y.value),a.isCancelled())return}if(c.length>0)for(var _,b=an(c);!(_=b()).done;){var S=_.value;if("function"==typeof S.onExit&&S.onExit(),a.isCancelled())return}}(s.getValue(),c,e,d.signal),c=e}function h(){var e=n.getReference().getValue().seeking;return{currentTime:t.currentTime,isSeeking:e}}}),{emitCurrentValue:!0,clearSignal:a})},ln=n(4576);function dn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return cn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var fn=function(e){function n(t){var n;(n=e.call(this)||this)._settings=t,n._initCanceller=new k.ZP,n._initialManifestProm=null;var r=void 0===t.url?void 0:[t.url];return n._manifestFetcher=new ge(r,t.transport,t.manifestRequestSettings),n}(0,t.Z)(n,e);var r=n.prototype;return r.prepare=function(){var e=this;null===this._initialManifestProm&&(this._initialManifestProm=(0,D.Z)(this._initCanceller.signal,(function(t,n){e._manifestFetcher.addEventListener("warning",(function(t){return e.trigger("warning",t)})),e._manifestFetcher.addEventListener("error",(function(t){e.trigger("error",t),n(t)})),e._manifestFetcher.addEventListener("manifestReady",(function(e){t(e)}))})),this._manifestFetcher.start(),this._initCanceller.signal.register((function(){e._manifestFetcher.dispose()})))},r.start=function(e,t){var n=this;this.prepare(),(0,ln.Z)(e,(function(e){return n._onFatalError(e)}),this._initCanceller.signal);var r=(0,T.ZP)(null,this._initCanceller.signal);this._initializeMediaSourceAndDecryption(e,r).then((function(i){return n._onInitialMediaSourceReady(e,i.mediaSource,t,i.drmSystemId,r,i.unlinkMediaSource)})).catch((function(e){n._onFatalError(e)}))},r.updateContentUrls=function(e,t){this._manifestFetcher.updateContentUrls(e,t)},r.dispose=function(){this._initCanceller.cancel()},r._onFatalError=function(e){this._initCanceller.isUsed()||(this._initCanceller.cancel(),this.trigger("error",e))},r._initializeMediaSourceAndDecryption=function(e,t){var n=this,r=this._initCanceller;return(0,D.Z)(r.signal,(function(i){var a=n._settings.keySystems,o=(0,Yt.Z)(e,a,t,{onWarning:function(e){return n.trigger("warning",e)},onError:function(e){return n._onFatalError(e)}},r.signal);o.onUpdate((function(t,a){if("uninitialized"!==t.initializationState.type){a();var s=new k.ZP;s.linkToSignal(r.signal),Bt(e,s.signal).then((function(e){var n=o.getValue();if("awaiting-media-link"===n.initializationState.type)n.initializationState.value.isMediaLinked.setValue(!0),o.onUpdate((function(t,n){if("initialized"===t.initializationState.type)return n(),void i({mediaSource:e,drmSystemId:t.drmSystemId,unlinkMediaSource:s})}),{emitCurrentValue:!0,clearSignal:r.signal});else if("initialized"===t.initializationState.type)return void i({mediaSource:e,drmSystemId:t.drmSystemId,unlinkMediaSource:s})})).catch((function(e){s.isUsed()||n._onFatalError(e)}))}}),{emitCurrentValue:!0,clearSignal:r.signal})}))},r._onInitialMediaSourceReady=function(){var e=(0,w.Z)(I().mark((function e(t,n,r,i,a,o){var u,l,d,c,f,v,p,h,g,y,_,b,E,T,w,A,R,Z,x,P,M,C=this;return I().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return M=function(e,n,i,o){Z({mediaElement:t,playbackObserver:r,mediaSource:e,initialTime:n,autoPlay:i,manifest:E,representationEstimator:w,segmentFetcherCreator:R,speed:p,protectionRef:a,bufferOptions:A},(function(e){if(o.cancel(),_.isUsed())return;if(x("reloadingMediaSource",e),_.isUsed())return;var n=new k.ZP;n.linkToSignal(_.signal),Bt(t,n.signal).then((function(t){M(t,e.position,e.autoPlay,n)})).catch((function(e){n.isUsed()||P(e)}))}),o.signal)},u=this._settings,l=u.adaptiveOptions,d=u.autoPlay,c=u.bufferOptions,f=u.lowLatencyMode,v=u.segmentRequestOptions,p=u.speed,h=u.startAt,g=u.textTrackOptions,y=u.transport,_=this._initCanceller,(0,m.Z)(null!==this._initialManifestProm),b=this._initialManifestProm,e.prev=5,e.next=8,b;case 8:E=e.sent,e.next=14;break;case 11:return e.prev=11,e.t0=e.catch(5),e.abrupt("return");case 14:if(E.addEventListener("manifestUpdate",(function(){C.trigger("manifestUpdate",null)}),_.signal),s.Z.debug("Init: Calculating initial time"),T=Ht(E,f,h),s.Z.debug("Init: Initial time calculated:",T),w=ne(l),A=(0,S.Z)({textTrackOptions:g,drmSystemId:i},c),R=new Re(y,v,_.signal),this.trigger("manifestReady",E),!_.isUsed()){e.next=24;break}return e.abrupt("return");case 24:Z=this._startBufferingOnMediaSource.bind(this),x=this.trigger.bind(this),P=this._onFatalError.bind(this),M(n,T,d,o);case 28:case"end":return e.stop()}}),e,this,[[5,11]])})));return function(t,n,r,i,a,o){return e.apply(this,arguments)}}(),r._startBufferingOnMediaSource=function(e,t,n){var r,i=this,a=e.autoPlay,o=e.bufferOptions,s=e.initialTime,u=e.manifest,d=e.mediaElement,f=e.mediaSource,v=e.playbackObserver,p=e.protectionRef,h=e.representationEstimator,m=e.segmentFetcherCreator,g=e.speed,y=null!==(r=u.getPeriodForTime(s))&&void 0!==r?r:u.getNextPeriod(s);if(void 0===y){var _=new c.Z("MEDIA_STARTING_TIME_NOT_FOUND","Wanted starting time not found in the Manifest.");return this._onFatalError(_)}var b=new Ne(d,f);n.register((function(){b.disposeAll()}));var S=(0,qt.Z)(d,v,s,a,(function(e){return i.trigger("warning",e)}),n),E=S.autoPlayResult,k=S.initialPlayPerformed,w=S.initialSeekPerformed;if(!n.isCancelled()){k.onUpdate((function(e,t){e&&(t(),un(u,d,v,(function(e){return i.trigger("streamEvent",e)}),(function(e){return i.trigger("streamEventSkip",e)}),n))}),{clearSignal:n,emitCurrentValue:!0});var A=function(e,t,n){var r=n.autoPlay,i=n.initialPlayPerformed,a=n.initialSeekPerformed,o=n.speed,s=n.startTime;return t.deriveReadOnlyObserver((function(t,n){var u=(0,T.ZP)(l(),n);return o.onUpdate(d,{clearSignal:n,emitCurrentValue:!1}),t.onUpdate(d,{clearSignal:n,emitCurrentValue:!1}),u;function l(){var n,u=t.getValue(),l=o.getValue();if(a.getValue()){if(!e.isDynamic||e.isLastPeriodKnown){var d=e.periods[e.periods.length-1];void 0!==d&&void 0!==d.end&&u.position>d.end&&(n=d.end-1)}}else n=s;return{maximumPosition:e.getMaximumSafePosition(),position:{last:u.position,pending:n},duration:u.duration,paused:{last:u.paused,pending:i.getValue()||!r===u.paused?void 0:!r},readyState:u.readyState,speed:l}}function d(){u.setValue(l())}}))}(u,v,{autoPlay:a,initialPlayPerformed:k,initialSeekPerformed:w,speed:g,startTime:s}),I=this._createRebufferingController(v,u,b,g,n);I.addEventListener("needsReload",(function(){var e=w.getValue()?v.getCurrentTime():s,n=k.getValue()?!v.getIsPaused():a;t({position:e,autoPlay:n})}),n);var R=this._createContentTimeBoundariesObserver(u,f,A,b,n);E.then((function(){(0,Wt.Z)(v,d,!1,n).onUpdate((function(e,t){e&&(t(),i.trigger("loaded",{segmentBuffersStore:b}))}),{emitCurrentValue:!0,clearSignal:n})})).catch((function(e){n.isCancelled()||i._onFatalError(e)}));var Z=this;It({manifest:u,initialPeriod:y},A,h,b,m,o,{needsBufferFlush:function(){var e=d.currentTime+.001;v.setCurrentTime(e),v.listen((function(t,n){(null!==t.currentRange||t.position>e+.1)&&(n(),v.setCurrentTime(t.position+.001))}),{includeLastObservation:!1,clearSignal:n})},streamStatusUpdate:function(e){var t=e.period,r=e.bufferType,i=e.imminentDiscontinuity,a=e.position;I.updateDiscontinuityInfo({period:t,bufferType:r,discontinuity:i,position:a}),n.isCancelled()||u.isLastPeriodKnown&&e.period.id===u.periods[u.periods.length-1].id&&(e.hasFinishedLoading||e.isEmptyStream?R.onLastSegmentFinishedLoading(e.bufferType):R.onLastSegmentLoadingResume(e.bufferType))},needsManifestRefresh:function(){return Z._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!0,canUseUnsafeMode:!0})},manifestMightBeOufOfSync:function(){var e=l.Z.getCurrent().OUT_OF_SYNC_MANIFEST_REFRESH_DELAY;Z._manifestFetcher.scheduleManualRefresh({enablePartialRefresh:!1,canUseUnsafeMode:!1,delay:e})},lockedStream:function(e){return I.onLockedStream(e.bufferType,e.period)},adaptationChange:function(e){Z.trigger("adaptationChange",e),n.isCancelled()||R.onAdaptationChange(e.type,e.period,e.adaptation)},representationChange:function(e){Z.trigger("representationChange",e),n.isCancelled()||R.onRepresentationChange(e.type,e.period)},inbandEvent:function(e){return Z.trigger("inbandEvents",e)},warning:function(e){return Z.trigger("warning",e)},periodStreamReady:function(e){return Z.trigger("periodStreamReady",e)},periodStreamCleared:function(e){R.onPeriodCleared(e.type,e.period),n.isCancelled()||Z.trigger("periodStreamCleared",e)},bitrateEstimateChange:function(e){return Z.trigger("bitrateEstimateChange",e)},addedSegment:function(e){return Z.trigger("addedSegment",e)},needsMediaSourceReload:function(e){return t(e)},needsDecipherabilityFlush:function(e){var n,r=M(d);void 0===(n=null==r?void 0:r[0])||n.indexOf("widevine")<0?t(e):e.position+.001<e.duration?v.setCurrentTime(d.currentTime+.001):v.setCurrentTime(e.position)},encryptionDataEncountered:function(e){for(var t,r=dn(e);!(t=r()).done;){var i=t.value;if(p.setValue(i),n.isCancelled())return}},error:function(e){return Z._onFatalError(e)}},n)}},r._createContentTimeBoundariesObserver=function(e,t,n,r,i){var a=this,o=new Qt(t);i.register((function(){o.stopUpdating()}));var u=null,l=new Pt(e,n,r.getBufferTypes());i.register((function(){l.dispose()})),l.addEventListener("warning",(function(e){return a.trigger("warning",e)})),l.addEventListener("periodChange",(function(e){a.trigger("activePeriodChanged",{period:e})})),l.addEventListener("durationUpdate",(function(e){o.updateDuration(e.duration,e.isEnd)})),l.addEventListener("endOfStream",(function(){null===u&&((u=new k.ZP).linkToSignal(i),s.Z.debug("Init: end-of-stream order received."),function(e,t){var n=new k.ZP;n.linkToSignal(t),Kt(e,(function(){n.cancel(),(n=new k.ZP).linkToSignal(t),jt(e,n.signal)}),t),jt(e,n.signal)}(t,u.signal))})),l.addEventListener("resumeStream",(function(){null!==u&&(s.Z.debug("Init: resume-stream order received."),u.cancel(),u=null)}));var d=l.getCurrentDuration();return o.updateDuration(d.duration,d.isEnd),l},r._createRebufferingController=function(e,t,n,r,i){var a=this,o=new tn.Z(e,t,n,r);return o.addEventListener("stalled",(function(e){return a.trigger("stalled",e)})),o.addEventListener("unstalled",(function(){return a.trigger("unstalled",null)})),o.addEventListener("warning",(function(e){return a.trigger("warning",e)})),i.register((function(){return o.destroy()})),o.start(),o},n}(Rt.K);function vn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var hn=["canplay","ended","play","pause","seeking","seeked","loadedmetadata","ratechange"],mn=function(){function e(e,t){this._internalSeeksIncoming=[],this._mediaElement=e,this._withMediaSource=t.withMediaSource,this._lowLatencyMode=t.lowLatencyMode,this._canceller=new k.ZP,this._observationRef=this._createSharedReference()}var t=e.prototype;return t.stop=function(){this._canceller.cancel()},t.getCurrentTime=function(){return this._mediaElement.currentTime},t.getPlaybackRate=function(){return this._mediaElement.playbackRate},t.getIsPaused=function(){return this._mediaElement.paused},t.setCurrentTime=function(e){this._internalSeeksIncoming.push(e),s.Z.info("API: Seeking internally",e),this._mediaElement.currentTime=e},t.setPlaybackRate=function(e){this._mediaElement.playbackRate=e},t.getReadyState=function(){return this._mediaElement.readyState},t.getReference=function(){return this._observationRef},t.listen=function(e,t){var n;if(this._canceller.isUsed()||!0===(null===(n=null==t?void 0:t.clearSignal)||void 0===n?void 0:n.isCancelled()))return N.Z;this._observationRef.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},t.deriveReadOnlyObserver=function(e){return _n(this,e,this._canceller.signal)},t._createSharedReference=function(){var e,t=this;if(void 0!==this._observationRef)return this._observationRef;var n=l.Z.getCurrent(),r=n.SAMPLING_INTERVAL_MEDIASOURCE,i=n.SAMPLING_INTERVAL_LOW_LATENCY,a=n.SAMPLING_INTERVAL_NO_MEDIASOURCE,o=function(n){var r,i=n;"seeking"===i&&t._internalSeeksIncoming.length>0&&(i="internal-seeking",r=t._internalSeeksIncoming.shift());var a=null!=e?e:t._generateInitialObservation(),o=yn(t._mediaElement,i,t._withMediaSource),u=null;o.seeking&&("number"==typeof r?u=r:null!==a.pendingInternalSeek&&"seeking"!==n&&(u=a.pendingInternalSeek));var d=function(e,t,n){var r,i,a=n.withMediaSource,o=n.lowLatencyMode,s=l.Z.getCurrent().REBUFFERING_GAP,u=t.event,d=t.position,c=t.bufferGap,f=t.currentRange,v=t.duration,p=t.paused,h=t.readyState,m=t.ended,g=e.rebuffering,y=e.event,_=e.position,b=function(e,t,n,r,i){var a=l.Z.getCurrent().REBUFFERING_GAP,o=i?"LOW_LATENCY":"DEFAULT";if(void 0===t)return n&&Math.abs(r-e)<=a[o];return null!==t&&r-t.end<=a[o]}(d,f,m,v,o),S=h>=1&&"loadedmetadata"!==u&&null===g&&!(b||m),E=null,T=o?s.LOW_LATENCY:s.DEFAULT;if(a){if(S)c===1/0?(r=!0,E=d):void 0===c?h<3&&(r=!0,E=void 0):c<=T&&(r=!0,E=d+c);else if(null!==g){var k=gn(g,o);!0!==r&&null!==g&&h>1&&(b||m||void 0!==c&&isFinite(c)&&c>k)||void 0===c&&h>=3?i=!0:void 0===c?E=void 0:c===1/0?E=d:c<=k&&(E=d+c)}}else S&&(!p&&"timeupdate"===u&&"timeupdate"===y&&d===_||"seeking"===u&&(c===1/0||void 0===c&&h<3))?r=!0:null!==g&&("seeking"!==u&&d!==_||"canplay"===u||void 0===c&&h>=3||void 0!==c&&c<1/0&&(c>gn(g,o)||b||m))&&(i=!0);if(!0===i)return null;var w;if(!0===r||null!==g)return w="seeking"===u||null!==g&&"seeking"===g.reason||t.seeking?"seeking":1===h?"not-ready":"buffering",null!==g&&g.reason===w?{reason:g.reason,timestamp:g.timestamp,position:E}:{reason:w,timestamp:performance.now(),position:E};return null}(a,o,{lowLatencyMode:t._lowLatencyMode,withMediaSource:t._withMediaSource}),c=function(e,t){var n=l.Z.getCurrent().MINIMUM_BUFFER_AMOUNT_BEFORE_FREEZING;if(e.freezing)return t.ended||t.paused||0===t.readyState||0===t.playbackRate||e.position!==t.position?null:e.freezing;return"timeupdate"===t.event&&void 0!==t.bufferGap&&t.bufferGap>n&&!t.ended&&!t.paused&&t.readyState>=1&&0!==t.playbackRate&&t.position===e.position?{timestamp:performance.now()}:null}(a,o),f=(0,S.Z)({},{rebuffering:d,freezing:c,pendingInternalSeek:u},o);return s.Z.hasLevel("DEBUG")&&s.Z.debug("API: current media element state tick","event",f.event,"position",f.position,"seeking",f.seeking,"internalSeek",f.pendingInternalSeek,"rebuffering",null!==f.rebuffering,"freezing",null!==f.freezing,"ended",f.ended,"paused",f.paused,"playbackRate",f.playbackRate,"readyState",f.readyState),f},u=(0,T.ZP)(o("init"),this._canceller.signal),d=function(t){var n=o(t);s.Z.hasLevel("DEBUG")&&s.Z.debug("API: current playback timeline:\n"+function(e,t){for(var n="",r="",i=0;i<e.length;i++){var a=e.start(i),o=e.end(i),s=a.toFixed(2),u=o.toFixed(2),l=s+"|=="+(o-a).toFixed(2)+"==|"+u;if(n+=l,0===r.length&&o>t){var d=n.length-Math.floor(l.length/2);r=" ".repeat(d)+"^"+t}if(i<e.length-1){var c=e.start(i+1),f=" ~"+(c-o).toFixed(2)+"~ ";if(n+=f,0===r.length&&t<c){var v=n.length-Math.floor(f.length/2);r=" ".repeat(v)+"^"+t}}}0===r.length&&(r=" ".repeat(n.length)+"^"+t);return n+"\n"+r}(n.buffered,n.position),"\n"+t),e=n,u.setValue(n)},c=this._lowLatencyMode?i:this._withMediaSource?r:a,f=setInterval(p,c),v=hn.map((function(e){function n(){clearInterval(f),f=setInterval(p,c),d(e)}return t._mediaElement.addEventListener(e,n),function(){t._mediaElement.removeEventListener(e,n)}}));return this._canceller.signal.register((function(){clearInterval(f),v.forEach((function(e){return e()})),u.finish()})),u;function p(){d("timeupdate")}},t._generateInitialObservation=function(){return(0,S.Z)(yn(this._mediaElement,"init",this._withMediaSource),{rebuffering:null,freezing:null,pendingInternalSeek:null})},e}();function gn(e,t){if(null===e)return 0;var n=t?"LOW_LATENCY":"DEFAULT",r=l.Z.getCurrent(),i=r.RESUME_GAP_AFTER_SEEKING,a=r.RESUME_GAP_AFTER_NOT_ENOUGH_DATA,o=r.RESUME_GAP_AFTER_BUFFERING;switch(e.reason){case"seeking":return i[n];case"not-ready":return a[n];case"buffering":return o[n]}}function yn(e,t,n){var r,i,a=e.buffered,o=e.currentTime,s=e.duration,u=e.ended,l=e.paused,d=e.playbackRate,c=e.readyState,f=e.seeking;return!n&&0===a.length&&c>=3?(r=void 0,i=void 0):i=null!==(r=(0,E.rx)(a,o))?r.end-o:1/0,{bufferGap:i,buffered:a,currentRange:r,position:o,duration:s,ended:u,paused:l,playbackRate:d,readyState:c,seeking:f,event:t}}function _n(e,t,n){var r=t(e.getReference(),n);return{getCurrentTime:function(){return e.getCurrentTime()},getReadyState:function(){return e.getReadyState()},getPlaybackRate:function(){return e.getPlaybackRate()},getIsPaused:function(){return e.getIsPaused()},getReference:function(){return r},listen:function(e,t){var i;n.isCancelled()||!0===(null===(i=null==t?void 0:t.clearSignal)||void 0===i?void 0:i.isCancelled())||r.onUpdate(e,{clearSignal:null==t?void 0:t.clearSignal,emitCurrentValue:null==t?void 0:t.includeLastObservation})},deriveReadOnlyObserver:function(e){return _n(this,e,n)}}}var bn=function(e){function n(t,n){var r;return(r=e.call(this)||this)._canceller=new k.ZP,r._manifest=t,r._adaptationRef=n,r._updateToken=!1,r}(0,t.Z)(n,e);var r=n.prototype;return r.start=function(e){if(this._updateToken=!0,null===e)return this._lastEmitted=null,this._updateToken=!1,void this._adaptationRef.setValue(null);var t=this._constructLockedRepresentationsReference(e);this._updateToken&&(this._lastEmitted={adaptation:e.adaptation,switchingMode:e.switchingMode,lockedRepresentations:null},this._updateToken=!1,this._adaptationRef.setValue({adaptation:e.adaptation,switchingMode:e.switchingMode,representations:t}))},r.updateTrack=function(e){if(this._updateToken=!0,null===e){if(null===this._lastEmitted)return;return this._updateToken=!1,this._canceller.cancel(),this._canceller=new k.ZP,this._lastEmitted=null,void this._adaptationRef.setValue(null)}var t=e.adaptation,n=e.switchingMode;this._canceller.cancel(),this._canceller=new k.ZP;var r=this._constructLockedRepresentationsReference(e);this._updateToken&&(this._lastEmitted={adaptation:t,switchingMode:n,lockedRepresentations:null},this._updateToken=!1,this._adaptationRef.setValue({adaptation:t,switchingMode:n,representations:r}))},r._constructLockedRepresentationsReference=function(e){var t=this._manifest,n=(0,T.ZP)({representations:[],switchingMode:"lazy"}),r=this;return t.addEventListener("decipherabilityUpdate",i),t.addEventListener("manifestUpdate",i),this._canceller.signal.register((function(){t.removeEventListener("decipherabilityUpdate",i),t.removeEventListener("manifestUpdate",i)})),e.lockedRepresentations.onUpdate(i,{clearSignal:this._canceller.signal,emitCurrentValue:!1}),i(),n;function i(){var t,i,a=e.lockedRepresentations.getValue();if(null===a)i=e.adaptation.getPlayableRepresentations(),t="lazy";else{var o=a.representations;if(t=a.switchingMode,0===(i=o.filter((function(e){return e.isPlayable()}))).length)return void r.trigger("noPlayableLockedRepresentation",null)}if(i.length<=0)return e.adaptation.isSupported=!1,void r.trigger("noPlayableRepresentation",null);var s=n.getValue(),u=i.slice().sort();if(u.length===s.representations.length){for(var l=0;l<u.length;l++)if(s.representations[l].id!==u[l].id)return void n.setValue({representations:u,switchingMode:t})}else n.setValue({representations:u,switchingMode:t})}},r.dispose=function(){this.removeEventListener(),this._canceller.cancel(),this._adaptationRef.finish()},n}(y.Z),Sn=function(e){function n(t){var n,r;return(n=e.call(this)||this)._storedPeriodInfo=[],n._isDisposed=!1,n._cachedPeriodInfo=new WeakMap,n._isTrickModeTrackEnabled=t.preferTrickModeTracks,n._defaultAudioTrackSwitchingMode=null!==(r=t.defaultAudioTrackSwitchingMode)&&void 0!==r?r:l.Z.getCurrent().DEFAULT_AUDIO_TRACK_SWITCHING_MODE,n}(0,t.Z)(n,e);var r=n.prototype;return r.getAvailablePeriods=function(){return this._storedPeriodInfo.map((function(e){return An(e.period)}))},r.updatePeriodList=function(e){for(var t,n,r,i=this,a=l.Z.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,o=e.periods,u=[],d=0,c=function(e){var l=i._storedPeriodInfo[e].period,c=o[d];if(void 0===c)for(var v=i._storedPeriodInfo.length-1;v>=e;v--)i._storedPeriodInfo[v].inManifest=!1,Tn(i._storedPeriodInfo[v])&&i._removePeriodObject(v);else if(l===c){d++;var p=i._storedPeriodInfo[e].text.storedSettings;if(null!==p)if(!c.getSupportedAdaptations("text").some((function(e){return e.id===p.adaptation.id}))){s.Z.warn("TS: Chosen text Adaptation not available anymore");var h=i._storedPeriodInfo[e];if(h.text.storedSettings=null,i.trigger("trackUpdate",{period:An(c),trackType:"text",reason:"missing"}),i._isDisposed)return{v:void 0};var m=En(i._storedPeriodInfo,h.period.id);void 0!==m&&null===m.text.storedSettings&&(null===(t=m.text.dispatcher)||void 0===t||t.updateTrack(null))}var g=i._storedPeriodInfo[e].video.storedSettings;if(null!==g){var y=c.getSupportedAdaptations("video");if(!y.some((function(e){return e.id===g.adaptation.id}))){s.Z.warn("TS: Chosen video Adaptation not available anymore");var _,b=i._storedPeriodInfo[e];if(0===y.length)_=null;else{var S=y[0],E=kn(S,i._isTrickModeTrackEnabled),k=(0,T.ZP)(null);_={adaptationBase:S,adaptation:E,switchingMode:a,lockedRepresentations:k}}if(b.video.storedSettings=_,i.trigger("trackUpdate",{period:An(c),trackType:"video",reason:"missing"}),i._isDisposed)return{v:void 0};var w=En(i._storedPeriodInfo,b.period.id);void 0!==w&&w.video.storedSettings===_&&(null===(n=w.video.dispatcher)||void 0===n||n.updateTrack(_))}}var A=i._storedPeriodInfo[e].audio.storedSettings;if(null!==A){var I=c.getSupportedAdaptations("audio");if(!I.some((function(e){return e.id===A.adaptation.id}))){s.Z.warn("TS: Chosen audio Adaptation not available anymore");var R=i._storedPeriodInfo[e],Z=0===I.length?null:{adaptation:I[0],switchingMode:i._defaultAudioTrackSwitchingMode,lockedRepresentations:(0,T.ZP)(null)};if(R.audio.storedSettings=Z,i.trigger("trackUpdate",{period:An(c),trackType:"audio",reason:"missing"}),i._isDisposed)return{v:void 0};var x=En(i._storedPeriodInfo,R.period.id);void 0!==x&&x.audio.storedSettings===Z&&(null===(r=x.audio.dispatcher)||void 0===r||r.updateTrack(Z))}}}else if(l.start<=c.start)i._storedPeriodInfo[e].inManifest=!1,Tn(i._storedPeriodInfo[e])&&(i._removePeriodObject(e),e--);else{var P=wn(c,!0,i._isTrickModeTrackEnabled,i._defaultAudioTrackSwitchingMode);i._storedPeriodInfo.splice(e,0,P),u.push(P),d++}f=e},f=0;f<this._storedPeriodInfo.length;f++){var v=c(f);if("object"==typeof v)return v.v}if(d<o.length){var p,h=o.slice(d).map((function(e){return wn(e,!0,i._isTrickModeTrackEnabled,i._defaultAudioTrackSwitchingMode)}));(p=this._storedPeriodInfo).push.apply(p,h),u.push.apply(u,h)}var m=u.reduce((function(e,t){return t.isRemoved||e.push({id:t.period.id,start:t.period.start,end:t.period.end}),e}),[]);m.length>0&&this.trigger("newAvailablePeriods",m)},r.addTrackReference=function(e,t,n,r){var i=this,a=En(this._storedPeriodInfo,n.id);if(void 0===a&&(a=this._addPeriod(n),this.trigger("newAvailablePeriods",[{id:n.id,start:n.start,end:n.end}])),null===a[e].dispatcher){var o=a[e].storedSettings,u=new bn(t,r);a[e].dispatcher=u,u.addEventListener("noPlayableRepresentation",(function(){var t,r,a,o=(0,p.Z)(n.getAdaptationsForType(e),(function(e){return e.getPlayableRepresentations().length>0}));if(void 0===o){var s=new c.Z("NO_PLAYABLE_REPRESENTATION","No "+e+" Representation can be played",{adaptation:void 0});return i.trigger("error",s),void i.dispose()}var u=null===(t=En(i._storedPeriodInfo,n.id))||void 0===t?void 0:t[e];if(!(0,b.Z)(u)){var l={adaptation:o,switchingMode:"audio"===e?i._defaultAudioTrackSwitchingMode:"reload",lockedRepresentations:(0,T.ZP)(null)};u.storedSettings=l,i.trigger("trackUpdate",{period:An(n),trackType:e,reason:"no-playable-representation"}),i._isDisposed||(u=null===(r=En(i._storedPeriodInfo,n.id))||void 0===r?void 0:r[e],(0,b.Z)(u)||u.storedSettings!==l||null===(a=u.dispatcher)||void 0===a||a.updateTrack(l))}})),u.addEventListener("noPlayableLockedRepresentation",(function(){null==o||o.lockedRepresentations.setValue(null),i.trigger("brokenRepresentationsLock",{period:{id:n.id,start:n.start,end:n.end},trackType:e})})),u.start(o)}else s.Z.error("TS: Subject already added for "+e+" and Period "+n.start)},r.removeTrackReference=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){if(e[n].period.id===t.id)return n}}(this._storedPeriodInfo,t);if(void 0!==n){var r=this._storedPeriodInfo[n],i=r[e];null!==(null==i?void 0:i.dispatcher)?(i.dispatcher.dispose(),i.dispatcher=null,Tn(r)&&this._removePeriodObject(n)):s.Z.warn("TS: TrackDispatcher already removed for "+e+" and Period "+t.start)}else s.Z.warn("TS: "+e+" not found for period",t.start)},r.getPeriodObjectFromPeriod=function(e){var t=En(this._storedPeriodInfo,e.id);return void 0===t&&void 0!==e?this._cachedPeriodInfo.get(e):t},r.getPeriodObjectFromId=function(e){return En(this._storedPeriodInfo,e)},r.disableVideoTrickModeTracks=function(){this._isTrickModeTrackEnabled&&(this._isTrickModeTrackEnabled=!1,this._resetVideoTrackChoices("trickmode-disabled"))},r.enableVideoTrickModeTracks=function(){this._isTrickModeTrackEnabled||(this._isTrickModeTrackEnabled=!0,this._resetVideoTrackChoices("trickmode-enabled"))},r.resetPeriodObjects=function(){for(var e,t,n,r=this._storedPeriodInfo.length-1;r>=0;r--){var i=this._storedPeriodInfo[r];null===(e=i.audio.dispatcher)||void 0===e||e.dispose(),i.audio.dispatcher=null,null===(t=i.video.dispatcher)||void 0===t||t.dispose(),i.video.dispatcher=null,null===(n=i.text.dispatcher)||void 0===n||n.dispose(),i.text.dispatcher=null,i.inManifest||this._removePeriodObject(r)}},r.isTrickModeEnabled=function(){return this._isTrickModeTrackEnabled},r.setAudioTrack=function(e,t,n,r){return this._setAudioOrTextTrack("audio",e,t,null!=n?n:this._defaultAudioTrackSwitchingMode,r)},r.setTextTrack=function(e,t){return this._setAudioOrTextTrack("text",e,t,"direct",null)},r._setAudioOrTextTrack=function(e,t,n,r,i){var a,o=t.period,s=(0,p.Z)(o.getSupportedAdaptations(e),(function(e){return e.id===n}));if(void 0===s)throw new Error("Wanted "+e+" track not found.");var u,l=t[e];if(null===i)u=(0,T.ZP)(null);else{var d=this._getRepresentationsToLock(s,i),c="audio"===e?this._defaultAudioTrackSwitchingMode:"direct";u=(0,T.ZP)({representations:d,switchingMode:c})}var f={adaptation:s,switchingMode:r,lockedRepresentations:u};if(l.storedSettings=f,this.trigger("trackUpdate",{period:An(o),trackType:e,reason:"manual"}),!this._isDisposed){var v=En(this._storedPeriodInfo,o.id);void 0!==v&&v[e].storedSettings===f&&(null===(a=v[e].dispatcher)||void 0===a||a.updateTrack(f))}},r.setVideoTrack=function(e,t,n,r){var i,a=e.period,o=(0,p.Z)(a.getSupportedAdaptations("video"),(function(e){return e.id===t}));if(void 0===o)throw new Error("Wanted video track not found.");var s,u=l.Z.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,d=e.video,c=kn(o,this._isTrickModeTrackEnabled);if(null===r)s=(0,T.ZP)(null);else{var f=this._getRepresentationsToLock(o,r),v=u;s=(0,T.ZP)({representations:f,switchingMode:v})}var h={adaptationBase:o,switchingMode:null!=n?n:u,adaptation:c,lockedRepresentations:s};if(d.storedSettings=h,this.trigger("trackUpdate",{period:An(a),trackType:"video",reason:"manual"}),!this._isDisposed){var m=En(this._storedPeriodInfo,a.id);void 0!==m&&m.video.storedSettings===h&&(null===(i=m.video.dispatcher)||void 0===i||i.updateTrack(h))}},r.disableTrack=function(e,t){var n,r,i=e[t];if(null!==i.storedSettings&&("text"!==t&&(null===(n=e[t].storedSettings)||void 0===n||n.lockedRepresentations.finish()),i.storedSettings=null,this.trigger("trackUpdate",{period:An(e.period),trackType:t,reason:"manual"}),!this._isDisposed)){var a=En(this._storedPeriodInfo,e.period.id);void 0!==a&&null===a[t].storedSettings&&(null===(r=a[t].dispatcher)||void 0===r||r.updateTrack(null))}},r.getChosenAudioTrack=function(e){return null===e.audio.storedSettings?null:e.audio.storedSettings.adaptation.toAudioTrack(!0)},r.getChosenTextTrack=function(e){return null===e.text.storedSettings?null:e.text.storedSettings.adaptation.toTextTrack()},r.getChosenVideoTrack=function(e){return null===e.video.storedSettings?null:e.video.storedSettings.adaptation.toVideoTrack(!0)},r.getAvailableAudioTracks=function(e){var t=e.audio.storedSettings,n=null!==t?t.adaptation.id:null;return e.period.getSupportedAdaptations("audio").map((function(e){var t=null!==n&&n===e.id;return(0,S.Z)(e.toAudioTrack(!0),{active:t})}))},r.getAvailableTextTracks=function(e){var t=e.text.storedSettings,n=null!==t?t.adaptation.id:null;return e.period.getSupportedAdaptations("text").map((function(e){var t=null!==n&&n===e.id;return(0,S.Z)(e.toTextTrack(),{active:t})}))},r.getAvailableVideoTracks=function(e){var t=e.video.storedSettings,n=null===t?void 0:t.adaptation.id;return e.period.getSupportedAdaptations("video").map((function(e){var t=null!==n&&n===e.id,r=e.toVideoTrack(!0),i=void 0!==r.trickModeTracks?r.trickModeTracks.map((function(e){var t=null!==n&&n===e.id;return(0,S.Z)(e,{active:t})})):[],a=(0,S.Z)(r,{active:t});return void 0!==i&&(a.trickModeTracks=i),a}))},r.getLockedAudioRepresentations=function(e){var t=e.audio.storedSettings;if(null===t)return null;var n=t.lockedRepresentations.getValue();return null===n?null:n.representations.map((function(e){return e.id}))},r.getLockedVideoRepresentations=function(e){var t=e.video.storedSettings;if(null===t)return null;var n=t.lockedRepresentations.getValue();return null===n?null:n.representations.map((function(e){return e.id}))},r.lockAudioRepresentations=function(e,t){var n,r=e.audio.storedSettings;if(null!==r){var i=l.Z.getCurrent().DEFAULT_AUDIO_REPRESENTATIONS_SWITCHING_MODE,a=this._getRepresentationsToLock(r.adaptation,t.representations),o=null!==(n=t.switchingMode)&&void 0!==n?n:i;r.lockedRepresentations.setValue({representations:a,switchingMode:o})}},r.lockVideoRepresentations=function(e,t){var n,r=e.video.storedSettings;if(null!==r){var i=l.Z.getCurrent().DEFAULT_VIDEO_REPRESENTATIONS_SWITCHING_MODE,a=this._getRepresentationsToLock(r.adaptation,t.representations),o=null!==(n=t.switchingMode)&&void 0!==n?n:i;r.lockedRepresentations.setValue({representations:a,switchingMode:o})}},r.unlockAudioRepresentations=function(e){var t=e.audio.storedSettings;null!==t&&null!==t.lockedRepresentations.getValue()&&t.lockedRepresentations.setValue(null)},r.unlockVideoRepresentations=function(e){var t=e.video.storedSettings;null!==t&&null!==t.lockedRepresentations.getValue()&&t.lockedRepresentations.setValue(null)},r.dispose=function(){for(this._isDisposed=!0;;){var e=this._storedPeriodInfo.pop();if(void 0===e)return;e.isRemoved=!0}},r._addPeriod=function(e){for(var t=wn(e,!1,this._isTrickModeTrackEnabled,this._defaultAudioTrackSwitchingMode),n=0;n<this._storedPeriodInfo.length;n++)if(this._storedPeriodInfo[n].period.start>e.start)return this._storedPeriodInfo.splice(n,0,t),t;return this._storedPeriodInfo.push(t),t},r._resetVideoTrackChoices=function(e){for(var t,n=0;n<this._storedPeriodInfo.length;n++){var r=this._storedPeriodInfo[n];if(null!==r.video.storedSettings){var i=r.video.storedSettings.adaptationBase;if(null!==i){var a=kn(i,this._isTrickModeTrackEnabled);r.video.storedSettings.adaptationBase=i,r.video.storedSettings.adaptation=a}}}for(var o=this._storedPeriodInfo.slice(),s=0;s<o.length;s++){var u=o[s].period,l=o[s].video.storedSettings;if(this.trigger("trackUpdate",{period:An(u),trackType:"video",reason:e}),this._isDisposed)return;var d=En(this._storedPeriodInfo,u.id);void 0!==d&&d.video.storedSettings===l&&(null===(t=d.video.dispatcher)||void 0===t||t.updateTrack(l))}},r._removePeriodObject=function(e){var t=this._storedPeriodInfo[e];this._storedPeriodInfo[e].isRemoved=!0,this._storedPeriodInfo.splice(e,1),this._cachedPeriodInfo.set(t.period,t)},r._getRepresentationsToLock=function(e,t){var n=t.reduce((function(t,n){var r=(0,p.Z)(e.representations,(function(e){return e.id===n}));return void 0===r?s.Z.warn("API: Wanted locked Representation not found."):t.push(r),t}),[]);if(0===n.length)throw new Error("Cannot lock Representations: None of the given Representation id are found");return n},n}(y.Z);function En(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.period.id===t)return r}}function Tn(e){var t,n,r;return!e.inManifest&&null===(null===(t=e.text)||void 0===t?void 0:t.dispatcher)&&null===(null===(n=e.audio)||void 0===n?void 0:n.dispatcher)&&null===(null===(r=e.video)||void 0===r?void 0:r.dispatcher)}function kn(e,t){var n;return t&&void 0!==(null===(n=e.trickModeTracks)||void 0===n?void 0:n[0])?e.trickModeTracks[0]:e}function wn(e,t,n,r){var i,a=e.getSupportedAdaptations("audio")[0],o=e.getSupportedAdaptations("video")[0],s=kn(o,n),u=l.Z.getCurrent().DEFAULT_VIDEO_TRACK_SWITCHING_MODE,d=void 0!==a?{adaptation:a,switchingMode:r,lockedRepresentations:(0,T.ZP)(null)}:null,c=void 0!==s?{adaptation:s,adaptationBase:o,switchingMode:u,lockedRepresentations:(0,T.ZP)(null)}:null,f=null,v=e.getAdaptationsForType("text").filter((function(e){return!0===e.isForcedSubtitles}));if(v.length>0){if(null!=a){var h=(0,p.Z)(v,(function(e){return e.normalizedLanguage===a.normalizedLanguage}));void 0!==h&&(f=h)}null===f&&(f=null!==(i=(0,p.Z)(v,(function(e){return void 0===e.normalizedLanguage})))&&void 0!==i?i:null)}var m=null;return null!==f&&(m={adaptation:f,switchingMode:"direct",lockedRepresentations:(0,T.ZP)(null)}),{period:e,inManifest:t,isRemoved:!1,audio:{storedSettings:d,dispatcher:null},video:{storedSettings:c,dispatcher:null},text:{storedSettings:m,dispatcher:null}}}function An(e){return{start:e.start,end:e.end,id:e.id}}function In(e,t){var n=l.Z.getCurrent().FORCED_ENDED_THRESHOLD;if(e.ended)return"ENDED";if(null!==t){var r=Math.abs(e.duration-e.currentTime);return null!=n&&r<n?"ENDED":"seeking"===t?"SEEKING":"freezing"===t?"FREEZING":"BUFFERING"}return e.paused?"PAUSED":"PLAYING"}function Rn(e){return"LOADING"!==e&&"RELOADING"!==e&&"STOPPED"!==e}function Zn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return xn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function xn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Pn=(0,_.Z)(),Mn=i.w0,Cn=i.it,Dn=i.bD,Nn=i.c9,On=function(n){function r(e){var t;void 0===e&&(e={}),t=n.call(this)||this;var r=function(e){var t,n,r,i,a,o,s=l.Z.getCurrent(),u=s.DEFAULT_BASE_BANDWIDTH,d=s.DEFAULT_VIDEO_RESOLUTION_LIMIT,c=s.DEFAULT_MAX_BUFFER_AHEAD,f=s.DEFAULT_MAX_BUFFER_BEHIND,v=s.DEFAULT_MAX_VIDEO_BUFFER_SIZE,p=s.DEFAULT_THROTTLE_VIDEO_BITRATE_WHEN_HIDDEN,h=s.DEFAULT_WANTED_BUFFER_AHEAD;if((0,b.Z)(e.maxBufferAhead))t=c;else if(t=Number(e.maxBufferAhead),isNaN(t))throw new Error("Invalid maxBufferAhead parameter. Should be a number.");if((0,b.Z)(e.maxBufferBehind))n=f;else if(n=Number(e.maxBufferBehind),isNaN(n))throw new Error("Invalid maxBufferBehind parameter. Should be a number.");if((0,b.Z)(e.wantedBufferAhead))r=h;else if(r=Number(e.wantedBufferAhead),isNaN(r))throw new Error("Invalid wantedBufferAhead parameter. Should be a number.");if((0,b.Z)(e.maxVideoBufferSize))i=v;else if(i=Number(e.maxVideoBufferSize),isNaN(i))throw new Error("Invalid maxVideoBufferSize parameter. Should be a number.");var m=(0,b.Z)(e.videoResolutionLimit)?d:e.videoResolutionLimit,g=(0,b.Z)(e.throttleVideoBitrateWhenHidden)?p:!!e.throttleVideoBitrateWhenHidden;if((0,b.Z)(e.videoElement))a=document.createElement("video");else{if(!(e.videoElement instanceof HTMLMediaElement))throw new Error("Invalid videoElement parameter. Should be a HTMLMediaElement.");a=e.videoElement}if((0,b.Z)(e.baseBandwidth))o=u;else if(o=Number(e.baseBandwidth),isNaN(o))throw new Error("Invalid baseBandwidth parameter. Should be a number.");return{maxBufferAhead:t,maxBufferBehind:n,videoResolutionLimit:m,videoElement:a,wantedBufferAhead:r,maxVideoBufferSize:i,throttleVideoBitrateWhenHidden:g,baseBandwidth:o}}(e),i=r.baseBandwidth,a=r.videoResolutionLimit,o=r.maxBufferAhead,u=r.maxBufferBehind,d=r.throttleVideoBitrateWhenHidden,c=r.videoElement,f=r.wantedBufferAhead,v=r.maxVideoBufferSize,p=l.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;c.preload="auto",t.version="4.0.0-beta.2",t.log=s.Z,t.state="STOPPED",t.videoElement=c;var h=new k.ZP;return t._destroyCanceller=h,t._priv_pictureInPictureRef=Mn(c,h.signal),t._priv_speed=(0,T.ZP)(c.playbackRate,t._destroyCanceller.signal),t._priv_preferTrickModeTracks=!1,t._priv_contentLock=(0,T.ZP)(!1,t._destroyCanceller.signal),t._priv_bufferOptions={wantedBufferAhead:(0,T.ZP)(f,t._destroyCanceller.signal),maxBufferAhead:(0,T.ZP)(o,t._destroyCanceller.signal),maxBufferBehind:(0,T.ZP)(u,t._destroyCanceller.signal),maxVideoBufferSize:(0,T.ZP)(v,t._destroyCanceller.signal)},t._priv_bitrateInfos={lastBitrates:{audio:i,video:i}},t._priv_throttleVideoBitrateWhenHidden=d,t._priv_videoResolutionLimit=a,t._priv_mutedMemory=p,t._priv_currentError=null,t._priv_contentInfos=null,t._priv_contentEventsMemory={},t._priv_setPlayerState("STOPPED"),t._priv_reloadingMetadata={},t._priv_lastAutoPlay=!1,t}(0,t.Z)(r,n);var i=r.prototype;return i.addEventListener=function(e,t){return n.prototype.addEventListener.call(this,e,t)},i.stop=function(){null!==this._priv_contentInfos&&this._priv_contentInfos.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),"STOPPED"!==this.state&&this._priv_setPlayerState("STOPPED")},i.dispose=function(){this.stop(),null!==this.videoElement&&x(this.videoElement).catch((function(e){var t=e instanceof Error?e.message:"Unknown error";s.Z.error("API: Could not dispose decryption resources: "+t)})),this._destroyCanceller.cancel(),this._priv_reloadingMetadata={},this.videoElement=null},i.loadVideo=function(e){var t=function(e){var t,n,r,i,a,o,u,d,c,f=l.Z.getCurrent(),v=f.DEFAULT_AUTO_PLAY,p=f.DEFAULT_CODEC_SWITCHING_BEHAVIOR,m=f.DEFAULT_ENABLE_FAST_SWITCHING,g=f.DEFAULT_TEXT_TRACK_MODE;if((0,b.Z)(e))throw new Error("No option set on loadVideo");if((0,b.Z)(e.url)){if((0,b.Z)(e.initialManifest)&&(0,b.Z)(e.manifestLoader))throw new Error("Unable to load a content: no url set on loadVideo.\nPlease provide at least either an `url` argument, a `initialManifest` option or a `manifestLoader` option so the RxPlayer can load the content.")}else i=String(e.url);if((0,b.Z)(e.transport))throw new Error("No transport set on loadVideo");a=String(e.transport);var y=(0,b.Z)(e.autoPlay)?v:!!e.autoPlay;if((0,b.Z)(e.keySystems))o=[];else for(var _,E=vn(o=Array.isArray(e.keySystems)?e.keySystems:[e.keySystems]);!(_=E()).done;){var T=_.value;if("string"!=typeof T.type||"function"!=typeof T.getLicense)throw new Error("Invalid key system given: Missing type string or getLicense callback")}var k=void 0!==e.lowLatencyMode&&!!e.lowLatencyMode,w=e.initialManifest,A=null!==(t=e.minimumManifestUpdateInterval)&&void 0!==t?t:0,I=null!==(n=e.defaultAudioTrackSwitchingMode)&&void 0!==n?n:void 0;void 0===I||(0,h.Z)(["seamless","direct","reload"],I)||(s.Z.warn("The `defaultAudioTrackSwitchingMode` loadVideo option must match one of the following strategy name:\n- `seamless`\n- `direct`\n- `reload`"),I=void 0);var R=(0,b.Z)(e.onCodecSwitch)?p:e.onCodecSwitch;if((0,h.Z)(["continue","reload"],R)||(s.Z.warn("The `onCodecSwitch` loadVideo option must match one of the following string:\n- `continue`\n- `reload`\nIf badly set, "+p+" will be used as default"),R=p),(0,b.Z)(e.textTrackMode))u=g;else{if("native"!==e.textTrackMode&&"html"!==e.textTrackMode)throw new Error("Invalid textTrackMode.");u=e.textTrackMode}var Z=(0,b.Z)(e.enableFastSwitching)?m:e.enableFastSwitching;if("html"===u){if((0,b.Z)(e.textTrackElement))throw new Error('You have to provide a textTrackElement in "html" textTrackMode.');if(!(e.textTrackElement instanceof HTMLElement))throw new Error("textTrackElement should be an HTMLElement.");d=e.textTrackElement}else(0,b.Z)(e.textTrackElement)||s.Z.warn('API: You have set a textTrackElement without being in an "html" textTrackMode. It will be ignored.');if(!(0,b.Z)(e.startAt))if(e.startAt.wallClockTime instanceof Date){var x=e.startAt.wallClockTime.getTime()/1e3;c=(0,S.Z)({},e.startAt,{wallClockTime:x})}else c=e.startAt;var P=null!==(r=e.requestConfig)&&void 0!==r?r:{};return{__priv_patchLastSegmentInSidx:e.__priv_patchLastSegmentInSidx,checkMediaSegmentIntegrity:e.checkMediaSegmentIntegrity,autoPlay:y,defaultAudioTrackSwitchingMode:I,enableFastSwitching:Z,initialManifest:w,keySystems:o,lowLatencyMode:k,manifestLoader:e.manifestLoader,manifestUpdateUrl:e.manifestUpdateUrl,minimumManifestUpdateInterval:A,requestConfig:P,onCodecSwitch:R,referenceDateTime:e.referenceDateTime,representationFilter:e.representationFilter,segmentLoader:e.segmentLoader,serverSyncInfos:e.serverSyncInfos,startAt:c,textTrackElement:d,textTrackMode:u,transport:a,url:i}}(e);s.Z.info("API: Calling loadvideo",t.url,t.transport),this._priv_reloadingMetadata={options:t},this._priv_initializeContentPlayback(t),this._priv_lastAutoPlay=t.autoPlay},i.reload=function(e){var t,n,r,i,a=this._priv_reloadingMetadata,o=a.options,s=a.manifest,u=a.reloadPosition,l=a.reloadInPause;if(void 0===o)throw new Error("API: Can't reload without having previously loaded a content.");if(function(e){var t,n,r,i;if(null===e||"object"!=typeof e&&void 0!==e)throw new Error("API: reload - Invalid options format.");if(null===(null==e?void 0:e.reloadAt)||"object"!=typeof(null==e?void 0:e.reloadAt)&&void 0!==(null==e?void 0:e.reloadAt))throw new Error("API: reload - Invalid 'reloadAt' option format.");if("number"!=typeof(null===(t=null==e?void 0:e.reloadAt)||void 0===t?void 0:t.position)&&void 0!==(null===(n=null==e?void 0:e.reloadAt)||void 0===n?void 0:n.position))throw new Error("API: reload - Invalid 'reloadAt.position' option format.");if("number"!=typeof(null===(r=null==e?void 0:e.reloadAt)||void 0===r?void 0:r.relative)&&void 0!==(null===(i=null==e?void 0:e.reloadAt)||void 0===i?void 0:i.relative))throw new Error("API: reload - Invalid 'reloadAt.relative' option format.")}(e),void 0!==(null===(t=null==e?void 0:e.reloadAt)||void 0===t?void 0:t.position))r={position:e.reloadAt.position};else if(void 0!==(null===(n=null==e?void 0:e.reloadAt)||void 0===n?void 0:n.relative)){if(void 0===u)throw new Error("Can't reload to a relative position when previous content was not loaded.");r={position:e.reloadAt.relative+u}}else void 0!==u&&(r={position:u});void 0!==(null==e?void 0:e.autoPlay)?i=e.autoPlay:void 0!==l&&(i=!l);var d=Object.assign(Object.assign({},o),{initialManifest:s});void 0!==r&&(d.startAt=r),void 0!==i&&(d.autoPlay=i),this._priv_initializeContentPlayback(d)},i.createDebugElement=function(e){if(null===v.Z.createDebugElement)throw new Error("Feature `DEBUG_ELEMENT` not added to the RxPlayer");var t=new k.ZP;return v.Z.createDebugElement(e,this,t.signal),{dispose:function(){t.cancel()}}},i._priv_initializeContentPlayback=function(e){var t,n,r,i,a=this,o=e.autoPlay,l=e.defaultAudioTrackSwitchingMode,c=e.enableFastSwitching,f=e.initialManifest,p=e.keySystems,m=e.lowLatencyMode,g=e.minimumManifestUpdateInterval,y=e.requestConfig,_=e.onCodecSwitch,b=e.startAt,E=e.transport,w=e.checkMediaSegmentIntegrity,A=e.manifestLoader,I=e.manifestUpdateUrl,R=e.referenceDateTime,Z=e.representationFilter,x=e.segmentLoader,P=e.serverSyncInfos,M=e.__priv_patchLastSegmentInSidx,C=e.url;if(null===this.videoElement)throw new Error("the attached video element is disposed");var D,N="directfile"===E,O=new k.ZP,L=this.videoElement,U=null;if(N){if(null===v.Z.directfile)throw this.stop(),this._priv_currentError=null,new Error("DirectFile feature not activated in your build.");if(U=this._priv_initializeMediaElementTracksStore(O.signal),O.isUsed())return;D=new v.Z.directfile.initDirectFile({autoPlay:o,keySystems:p,speed:this._priv_speed,startAt:b,url:C})}else{var B=v.Z.transports[E];if("function"!=typeof B)throw this.stop(),this._priv_currentError=null,new Error('transport "'+E+'" not supported');var F=B({lowLatencyMode:m,checkMediaSegmentIntegrity:w,manifestLoader:A,manifestUpdateUrl:I,referenceDateTime:R,representationFilter:Z,segmentLoader:x,serverSyncInfos:P,__priv_patchLastSegmentInSidx:M}),z={lowLatencyMode:m,maxRetry:null===(t=y.manifest)||void 0===t?void 0:t.maxRetry,requestTimeout:null===(n=y.manifest)||void 0===n?void 0:n.timeout,minimumManifestUpdateInterval:g,initialManifest:f},V=u(),K={throttleBitrate:{},limitResolution:{}};this._priv_throttleVideoBitrateWhenHidden&&(V?K.throttleBitrate={video:(0,T.lR)(Cn(this._priv_pictureInPictureRef,O.signal),(function(e){return e?1/0:0}),O.signal)}:s.Z.warn("API: Can't apply throttleVideoBitrateWhenHidden because browser can't be trusted for visibility.")),"videoElement"===this._priv_videoResolutionLimit?V?K.limitResolution={video:Dn(L,this._priv_pictureInPictureRef,O.signal)}:s.Z.warn("API: Can't apply videoResolutionLimit because browser can't be trusted for video size."):"screen"===this._priv_videoResolutionLimit&&(K.limitResolution={video:Nn(O.signal)});var G={initialBitrates:this._priv_bitrateInfos.lastBitrates,lowLatencyMode:m,throttlers:K},j="native"===e.textTrackMode?{textTrackMode:"native"}:{textTrackMode:"html",textTrackElement:e.textTrackElement},H=(0,S.Z)({enableFastSwitching:c,onCodecSwitch:_},this._priv_bufferOptions),W={lowLatencyMode:m,maxRetry:null===(r=y.segment)||void 0===r?void 0:r.maxRetry,requestTimeout:null===(i=y.segment)||void 0===i?void 0:i.timeout};D=new fn({adaptiveOptions:G,autoPlay:o,bufferOptions:H,keySystems:p,lowLatencyMode:m,manifestRequestSettings:z,transport:F,segmentRequestOptions:W,speed:this._priv_speed,startAt:b,textTrackOptions:j,url:C})}var q={contentId:Pn(),originalUrl:C,currentContentCanceller:O,defaultAudioTrackSwitchingMode:l,initializer:D,isDirectFile:N,segmentBuffersStore:null,manifest:null,currentPeriod:null,activeAdaptations:null,activeRepresentations:null,tracksStore:null,mediaElementTracksStore:U};D.addEventListener("error",(function(e){a._priv_onFatalError(e,q)})),D.addEventListener("warning",(function(e){var t=(0,d.Z)(e,{defaultCode:"NONE",defaultReason:"An unknown error happened."});s.Z.warn("API: Sending warning:",t),a.trigger("warning",t)})),D.addEventListener("reloadingMediaSource",(function(e){q.segmentBuffersStore=null,null!==q.tracksStore&&q.tracksStore.resetPeriodObjects(),a._priv_lastAutoPlay=e.autoPlay})),D.addEventListener("inbandEvents",(function(e){return a.trigger("inbandEvents",e)})),D.addEventListener("streamEvent",(function(e){return a.trigger("streamEvent",e)})),D.addEventListener("streamEventSkip",(function(e){return a.trigger("streamEventSkip",e)})),D.addEventListener("activePeriodChanged",(function(e){return a._priv_onActivePeriodChanged(q,e)})),D.addEventListener("periodStreamReady",(function(e){return a._priv_onPeriodStreamReady(q,e)})),D.addEventListener("periodStreamCleared",(function(e){return a._priv_onPeriodStreamCleared(q,e)})),D.addEventListener("representationChange",(function(e){return a._priv_onRepresentationChange(q,e)})),D.addEventListener("adaptationChange",(function(e){return a._priv_onAdaptationChange(q,e)})),D.addEventListener("bitrateEstimateChange",(function(e){return a._priv_onBitrateEstimateChange(e)})),D.addEventListener("manifestReady",(function(e){return a._priv_onManifestReady(q,e)})),D.addEventListener("loaded",(function(e){q.segmentBuffersStore=e.segmentBuffersStore})),D.prepare(),this.stop();var Y=new mn(L,{withMediaSource:!N,lowLatencyMode:m});O.signal.register((function(){Y.stop()}));var X=function(e,t,n,r){var i=(0,T.ZP)("LOADING",r);e.addEventListener("loaded",(function(){if("LOADING"===i.getValue()){if(i.setValue("LOADED"),!r.isCancelled()){var e=In(t,null);"PAUSED"!==e&&i.setValue(e)}}else"RELOADING"===i.getValue()?i.setValue(In(t,null)):o(null)}),r),e.addEventListener("reloadingMediaSource",(function(){Rn(i.getValue())&&i.setValueIfChanged("RELOADING")}),r);var a=null;return e.addEventListener("stalled",(function(e){e!==a&&(o(e),a=e)}),r),e.addEventListener("unstalled",(function(){null!==a&&(o(null),a=null)}),r),n.listen((function(e){(0,h.Z)(["seeking","ended","play","pause"],e.event)&&o(a)}),{clearSignal:r}),i;function o(e){if(Rn(i.getValue())){var n=In(t,e);"LOADED"===i.getValue()&&"PAUSED"===n||i.setValueIfChanged(n)}}}(D,L,Y,O.signal);O.signal.register((function(){D.dispose()}));var Q=function(e){switch(e){case"STOPPED":case"RELOADING":case"LOADING":break;case"ENDED":a._priv_reloadingMetadata.reloadInPause=!0,a._priv_reloadingMetadata.reloadPosition=Y.getReference().getValue().position;break;default:var t=Y.getReference().getValue();a._priv_reloadingMetadata.reloadInPause=t.paused,a._priv_reloadingMetadata.reloadPosition=t.position}},$=null,J=function(e){null!==$&&($.cancel(),$=null),X.onUpdate((function(t,n){var r,i,o,s;Rn(t)&&(n(),null!==$&&$.cancel(),($=new k.ZP).linkToSignal(O.signal),e!==!L.paused&&(L.paused?a.trigger("pause",null):a.trigger("play",null)),r=L,i=function(){return a.trigger("play",null)},o=function(){return a.trigger("pause",null)},(s=O.signal).isCancelled()||null===r||(r.addEventListener("play",i),r.addEventListener("pause",o),s.register((function(){r.removeEventListener("play",i),r.removeEventListener("pause",o)}))))}),{emitCurrentValue:!1,clearSignal:O.signal})};J(o),D.addEventListener("reloadingMediaSource",(function(e){J(e.autoPlay)}));var ee=null;X.onUpdate((function(e){Q(e),a._priv_setPlayerState(e),O.isUsed()||(null!==ee?Rn(a.state)||(ee.cancel(),ee=null):Rn(a.state)&&((ee=new k.ZP).linkToSignal(O.signal),function(e,t,n,r,i){if(!i.isCancelled()&&null!==e){var a=t.getReference().getValue().seeking;a&&(n(),i.isCancelled())||t.listen((function(e){"seeking"===e.event?(a=!0,n()):a&&"seeked"===e.event&&(a=!1,r())}),{includeLastObservation:!0,clearSignal:i})}}(L,Y,(function(){return a.trigger("seeking",null)}),(function(){return a.trigger("seeked",null)}),ee.signal)))}),{emitCurrentValue:!0,clearSignal:O.signal}),Y.listen((function(e){Q(a.state),a._priv_triggerPositionUpdate(q,e)}),{clearSignal:O.signal}),this._priv_currentError=null,this._priv_contentInfos=q,O.signal.register((function(){D.removeEventListener()})),this._priv_contentLock.onUpdate((function(e,t){e||(t(),D.start(L,Y))}),{emitCurrentValue:!0,clearSignal:O.signal})},i.getError=function(){return this._priv_currentError},i.getVideoElement=function(){return this.videoElement},i.getPlayerState=function(){return this.state},i.isContentLoaded=function(){return!(0,h.Z)(["LOADING","RELOADING","STOPPED"],this.state)},i.isBuffering=function(){return(0,h.Z)(["BUFFERING","SEEKING","LOADING","RELOADING"],this.state)},i.isPaused=function(){return!this.videoElement||((0,h.Z)(["LOADING","RELOADING"],this.state)?!this._priv_lastAutoPlay:this.videoElement.paused)},i.isLive=function(){if(null===this._priv_contentInfos)return!1;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;return!t&&null!==n&&n.isLive},i.areTrickModeTracksEnabled=function(){return this._priv_preferTrickModeTracks},i.getContentUrls=function(){if(null!==this._priv_contentInfos){var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest,r=e.originalUrl;return t?void 0===r?void 0:[r]:null!==n?n.getUrls():void 0}},i.updateContentUrls=function(e,t){if(null===this._priv_contentInfos)throw new Error("No content loaded");var n=!0===(null==t?void 0:t.refresh);this._priv_contentInfos.initializer.updateContentUrls(e,n)},i.getMediaDuration=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration},i.getCurrentBufferGap=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=this.videoElement,t=(0,E.L7)(e.buffered,e.currentTime);return t===1/0?0:t},i.getWallClockTime=function(){if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)return this.videoElement.currentTime;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){var r=a(this.videoElement);return(null!=r?r:0)+this.videoElement.currentTime}return null!==n?this.videoElement.currentTime+(void 0!==n.availabilityStartTime?n.availabilityStartTime:0):0},i.getPosition=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.currentTime},i.getLastStoredContentPosition=function(){return this._priv_reloadingMetadata.reloadPosition},i.getPlaybackRate=function(){return this._priv_speed.getValue()},i.setPlaybackRate=function(e,t){var n;e!==this._priv_speed.getValue()&&this._priv_speed.setValue(e);var r=null==t?void 0:t.preferTrickModeTracks;if("boolean"==typeof r){this._priv_preferTrickModeTracks=r;var i=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.tracksStore;(0,b.Z)(i)||(r&&!i.isTrickModeEnabled()?i.enableVideoTrickModeTracks():!r&&i.isTrickModeEnabled()&&i.disableVideoTrickModeTracks())}},i.getVideoRepresentation=function(){var e=this.__priv_getCurrentRepresentations();if(null!==e)return e.video},i.getAudioRepresentation=function(){var e=this.__priv_getCurrentRepresentations();if(null!==e)return e.audio},i.play=function(){var e=this;if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement.play();return(0,b.Z)(t)||"function"!=typeof t.catch?Promise.resolve():t.catch((function(t){if("NotAllowedError"===t.name){var n=new c.Z("MEDIA_ERR_PLAY_NOT_ALLOWED",t.toString());e.trigger("warning",n)}throw t}))},i.pause=function(){if(null===this.videoElement)throw new Error("Disposed player");this.videoElement.pause()},i.seekTo=function(e){var t;if(null===this.videoElement)throw new Error("Disposed player");if(null===this._priv_contentInfos)throw new Error("player: no content loaded");var n,r=this._priv_contentInfos,i=r.isDirectFile,o=r.manifest;if(!i&&null===o)throw new Error("player: the content did not load yet");if("number"==typeof e)n=e;else if("object"==typeof e){var u=e,l=this.videoElement.currentTime;if((0,b.Z)(u.relative))if((0,b.Z)(u.position)){if((0,b.Z)(u.wallClockTime))throw new Error('invalid time object. You must set one of the following properties: "relative", "position" or "wallClockTime"');if(null!==o)n=u.wallClockTime-(null!==(t=o.availabilityStartTime)&&void 0!==t?t:0);else if(i&&null!==this.videoElement){var d=a(this.videoElement);void 0!==d&&(n=u.wallClockTime-d)}void 0===n&&(n=u.wallClockTime)}else n=u.position;else n=l+u.relative}if(void 0===n)throw new Error("invalid time given");return s.Z.info("API: API Seek to",n),this.videoElement.currentTime=n,n},i.getVolume=function(){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.volume},i.setVolume=function(e){if(null===this.videoElement)throw new Error("Disposed player");var t=this.videoElement;e!==t.volume&&(t.volume=e,this.trigger("volumeChange",e))},i.isMute=function(){return 0===this.getVolume()},i.mute=function(){this._priv_mutedMemory=this.getVolume(),this.setVolume(0)},i.unMute=function(){var e=l.Z.getCurrent().DEFAULT_UNMUTED_VOLUME;0===this.getVolume()&&this.setVolume(0===this._priv_mutedMemory?e:this._priv_mutedMemory)},i.setMaxBufferBehind=function(e){this._priv_bufferOptions.maxBufferBehind.setValue(e)},i.setMaxBufferAhead=function(e){this._priv_bufferOptions.maxBufferAhead.setValue(e)},i.setWantedBufferAhead=function(e){this._priv_bufferOptions.wantedBufferAhead.setValue(e)},i.setMaxVideoBufferSize=function(e){this._priv_bufferOptions.maxVideoBufferSize.setValue(e)},i.getMaxBufferBehind=function(){return this._priv_bufferOptions.maxBufferBehind.getValue()},i.getMaxBufferAhead=function(){return this._priv_bufferOptions.maxBufferAhead.getValue()},i.getWantedBufferAhead=function(){return this._priv_bufferOptions.wantedBufferAhead.getValue()},i.getMaxVideoBufferSize=function(){return this._priv_bufferOptions.maxVideoBufferSize.getValue()},i.getCurrentPeriod=function(){var e,t=null===(e=this._priv_contentInfos)||void 0===e?void 0:e.currentPeriod;return(0,b.Z)(t)?null:{id:t.id,start:t.start,end:t.end}},i.getKeySystemConfiguration=function(){if(null===this.videoElement)throw new Error("Disposed player");var e=M(this.videoElement);return null===e?null:{keySystem:e[0],configuration:e[1]}},i.getAvailablePeriods=function(){if(null===this._priv_contentInfos)return[];var e=this._priv_contentInfos,t=e.isDirectFile,n=e.tracksStore;return t||null===n?[]:n.getAvailablePeriods().slice()},i.getAvailableAudioTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableAudioTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableAudioTracks(t))&&void 0!==n?n:[]}))},i.getAvailableTextTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableTextTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableTextTracks(t))&&void 0!==n?n:[]}))},i.getAvailableVideoTracks=function(e){var t;if(null===this._priv_contentInfos)return[];var n=this._priv_contentInfos,r=n.isDirectFile,i=n.mediaElementTracksStore;return r?null!==(t=null==i?void 0:i.getAvailableVideoTracks())&&void 0!==t?t:[]:this._priv_callTracksStoreGetterSetter(e,[],(function(e,t){var n;return null!==(n=e.getAvailableVideoTracks(t))&&void 0!==n?n:[]}))},i.getAudioTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenAudioTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenAudioTrack(t)}))}},i.getTextTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenTextTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenTextTrack(t)}))}},i.getVideoTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(n){if(null===r)return;return r.getChosenVideoTrack()}return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.getChosenVideoTrack(t)}))}},i.setAudioTrack=function(e){var t;if(null===this._priv_contentInfos)throw new Error("No content loaded");var n,r,i,a=this._priv_contentInfos,o=a.isDirectFile,s=a.mediaElementTracksStore;if(o)try{var u="string"==typeof e?e:e.trackId;return void(null==s||s.setAudioTrackById(u))}catch(e){throw new Error("player: unknown audio track")}var l=null;return"string"==typeof e?r=e:(r=e.trackId,n=e.periodId,i=e.switchingMode,l=null!==(t=e.lockedRepresentations)&&void 0!==t?t:null),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,t){return e.setAudioTrack(t,r,i,l)}))},i.setTextTrack=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r=this._priv_contentInfos,i=r.isDirectFile,a=r.mediaElementTracksStore;if(i)try{var o="string"==typeof e?e:e.trackId;return void(null==a||a.setTextTrackById(o))}catch(e){throw new Error("player: unknown text track")}return"string"==typeof e?n=e:(n=e.trackId,t=e.periodId),this._priv_callTracksStoreGetterSetter(t,void 0,(function(e,t){return e.setTextTrack(t,n)}))},i.disableTextTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;if(!n)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.disableTrack(t,"text")}));null==r||r.disableTextTrack()}},i.setVideoTrack=function(e){var t;if(null===this._priv_contentInfos)throw new Error("No content loaded");var n,r,i,a=this._priv_contentInfos,o=a.isDirectFile,s=a.mediaElementTracksStore;if(o)try{var u="string"==typeof e?e:e.trackId;return void(null==s||s.setVideoTrackById(u))}catch(e){throw new Error("player: unknown video track")}var l=null;return"string"==typeof e?r=e:(r=e.trackId,n=e.periodId,i=e.switchingMode,l=null!==(t=e.lockedRepresentations)&&void 0!==t?t:null),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,t){return e.setVideoTrack(t,r,i,l)}))},i.disableVideoTrack=function(e){if(null!==this._priv_contentInfos){var t=this._priv_contentInfos,n=t.isDirectFile,r=t.mediaElementTracksStore;return n&&null!==r?r.disableVideoTrack():this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.disableTrack(t,"video")}))}},i.lockVideoRepresentations=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r;if(this._priv_contentInfos.isDirectFile)throw new Error("Cannot lock video Representations in directfile mode.");return Array.isArray(e)?(t=e,n=void 0):(t=e.representations,n=e.periodId,r=e.switchingMode),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,n){return e.lockVideoRepresentations(n,{representations:t,switchingMode:r})}))},i.lockAudioRepresentations=function(e){if(null===this._priv_contentInfos)throw new Error("No content loaded");var t,n,r;if(this._priv_contentInfos.isDirectFile)throw new Error("Cannot lock audio Representations in directfile mode.");return Array.isArray(e)?(t=e,n=void 0):(t=e.representations,n=e.periodId,r=e.switchingMode),this._priv_callTracksStoreGetterSetter(n,void 0,(function(e,n){return e.lockAudioRepresentations(n,{representations:t,switchingMode:r})}))},i.getLockedVideoRepresentations=function(e){return null===this._priv_contentInfos||this._priv_contentInfos.isDirectFile?null:this._priv_callTracksStoreGetterSetter(e,null,(function(e,t){return e.getLockedVideoRepresentations(t)}))},i.getLockedAudioRepresentations=function(e){return null===this._priv_contentInfos||this._priv_contentInfos.isDirectFile?null:this._priv_callTracksStoreGetterSetter(e,null,(function(e,t){return e.getLockedAudioRepresentations(t)}))},i.unlockVideoRepresentations=function(e){if(null!==this._priv_contentInfos&&!this._priv_contentInfos.isDirectFile)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.unlockVideoRepresentations(t)}))},i.unlockAudioRepresentations=function(e){if(null!==this._priv_contentInfos&&!this._priv_contentInfos.isDirectFile)return this._priv_callTracksStoreGetterSetter(e,void 0,(function(e,t){return e.unlockAudioRepresentations(t)}))},i.getMinimumPosition=function(){if(null===this._priv_contentInfos)return null;if(this._priv_contentInfos.isDirectFile)return 0;var e=this._priv_contentInfos.manifest;return null!==e?e.getMinimumSafePosition():null},i.getMaximumPosition=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.isDirectFile,n=e.manifest;if(t){if(null===this.videoElement)throw new Error("Disposed player");return this.videoElement.duration}return null!==n?n.isDynamic||null===this.videoElement?n.getMaximumSafePosition():this.videoElement.duration:null},i.__priv_getSegmentBufferContent=function(e){if(null===this._priv_contentInfos||null===this._priv_contentInfos.segmentBuffersStore)return null;var t=this._priv_contentInfos.segmentBuffersStore.getStatus(e);return"initialized"===t.type?t.value.getInventory():null},i.__priv_getManifest=function(){return null===this._priv_contentInfos?null:this._priv_contentInfos.manifest},i.__priv_getCurrentAdaptation=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeAdaptations;return null===t||null===n||(0,b.Z)(n[t.id])?null:n[t.id]},i.__priv_getCurrentRepresentations=function(){if(null===this._priv_contentInfos)return null;var e=this._priv_contentInfos,t=e.currentPeriod,n=e.activeRepresentations;return null===t||null===n||(0,b.Z)(n[t.id])?null:n[t.id]},i._priv_cleanUpCurrentContentState=function(){var e,t,n,r,i=this;s.Z.debug("Locking `contentLock` to clean-up the current content."),this._priv_contentLock.setValue(!0),null===(t=null===(e=this._priv_contentInfos)||void 0===e?void 0:e.tracksStore)||void 0===t||t.dispose(),null===(r=null===(n=this._priv_contentInfos)||void 0===n?void 0:n.mediaElementTracksStore)||void 0===r||r.dispose(),this._priv_contentInfos=null,this._priv_contentEventsMemory={};var a=function(){null!==i.videoElement&&(s.Z.debug("Unlocking `contentLock`. Next content can begin."),i._priv_contentLock.setValue(!1))};(0,b.Z)(this.videoElement)?a():C(this.videoElement).then((function(){s.Z.debug("API: DRM session cleaned-up with success!"),a()}),(function(e){s.Z.error("API: An error arised when trying to clean-up the DRM session:"+(e instanceof Error?e.toString():"Unknown Error")),a()}))},i._priv_onManifestReady=function(e,t){var n,r=this;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.manifest=t,this._priv_reloadingMetadata.manifest=t;var i=new Sn({preferTrickModeTracks:this._priv_preferTrickModeTracks,defaultAudioTrackSwitchingMode:e.defaultAudioTrackSwitchingMode});e.tracksStore=i,i.addEventListener("newAvailablePeriods",(function(e){r.trigger("newAvailablePeriods",e)})),i.addEventListener("brokenRepresentationsLock",(function(e){r.trigger("brokenRepresentationsLock",e)})),i.addEventListener("trackUpdate",(function(e){var t,n;r.trigger("trackUpdate",e);var i=null!==(n=null===(t=r._priv_contentInfos)||void 0===t?void 0:t.currentPeriod)&&void 0!==n?n:void 0;"no-playable-representation"===e.reason&&e.period.id===(null==i?void 0:i.id)&&r._priv_onAvailableTracksMayHaveChanged(e.trackType)})),e.tracksStore.addEventListener("warning",(function(e){r.trigger("warning",e)})),e.tracksStore.addEventListener("error",(function(t){r._priv_onFatalError(t,e)})),e.tracksStore.updatePeriodList(t),t.addEventListener("manifestUpdate",(function(n){var i,a,o;(0,b.Z)(null==e?void 0:e.tracksStore)||e.tracksStore.updatePeriodList(t);var s=null!==(a=null===(i=r._priv_contentInfos)||void 0===i?void 0:i.currentPeriod)&&void 0!==a?a:void 0,u=null===(o=r._priv_contentInfos)||void 0===o?void 0:o.tracksStore;if(void 0!==s&&!(0,b.Z)(u))for(var l,d=Zn(n.updatedPeriods);!(l=d()).done;){var c=l.value;if(c.period.id===s.id&&(c.result.addedAdaptations.length>0||c.result.removedAdaptations.length>0)){if(void 0===u.getPeriodObjectFromPeriod(s))return;r._priv_onAvailableTracksMayHaveChanged("audio"),r._priv_onAvailableTracksMayHaveChanged("text"),r._priv_onAvailableTracksMayHaveChanged("video")}return}}),e.currentContentCanceller.signal),t.addEventListener("decipherabilityUpdate",(function(t){for(var n,i=t.reduce((function(t,n){var r,i,a;if(!(void 0===(0,p.Z)(t,(function(e){return e[0].id===n.period.id&&e[1]===n.adaptation.type})))){var o=e.tracksStore;if(null===o)return t;var s=!1,u=o.getPeriodObjectFromPeriod(n.period);if(void 0===u)return t;switch(n.adaptation.type){case"audio":s=(null===(r=o.getChosenAudioTrack(u))||void 0===r?void 0:r.id)===n.adaptation.id;break;case"video":s=(null===(i=o.getChosenVideoTrack(u))||void 0===i?void 0:i.id)===n.adaptation.id;break;case"text":s=(null===(a=o.getChosenTextTrack(u))||void 0===a?void 0:a.id)===n.adaptation.id}s&&t.push([n.period,n.adaptation.type])}return t}),[]),a=Zn(i);!(n=a()).done;){var o=n.value,s=o[0],u=o[1];r._priv_triggerEventIfNotStopped("representationListUpdate",{period:s,trackType:u,reason:"decipherability-update"},e.currentContentCanceller.signal)}}),e.currentContentCanceller.signal)}},i._priv_onActivePeriodChanged=function(e,t){var n,r,i,a,o,s,u=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){e.currentPeriod=u;var l=e.currentContentCanceller.signal;this._priv_contentEventsMemory.periodChange!==u&&(this._priv_contentEventsMemory.periodChange=u,this._priv_triggerEventIfNotStopped("periodChange",{start:u.start,end:u.end,id:u.id},l)),this._priv_triggerEventIfNotStopped("availableAudioTracksChange",this.getAvailableAudioTracks(),l),this._priv_triggerEventIfNotStopped("availableTextTracksChange",this.getAvailableTextTracks(),l),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",this.getAvailableVideoTracks(),l);var d=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.tracksStore;if((0,b.Z)(d))this._priv_triggerEventIfNotStopped("audioTrackChange",null,l),this._priv_triggerEventIfNotStopped("textTrackChange",null,l),this._priv_triggerEventIfNotStopped("videoTrackChange",null,l);else{var c=d.getPeriodObjectFromPeriod(u);if(c){var f=d.getChosenAudioTrack(c);this._priv_triggerEventIfNotStopped("audioTrackChange",f,l);var v=d.getChosenTextTrack(c);this._priv_triggerEventIfNotStopped("textTrackChange",v,l);var p=d.getChosenVideoTrack(c);this._priv_triggerEventIfNotStopped("videoTrackChange",p,l)}}var h=null!==(a=null===(i=this.__priv_getCurrentRepresentations())||void 0===i?void 0:i.audio)&&void 0!==a?a:null;this._priv_triggerEventIfNotStopped("audioRepresentationChange",h,l);var m=null!==(s=null===(o=this.__priv_getCurrentRepresentations())||void 0===o?void 0:o.video)&&void 0!==s?s:null;this._priv_triggerEventIfNotStopped("videoRepresentationChange",m,l)}},i._priv_onPeriodStreamReady=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.manifest,a=t.period,o=t.adaptationRef,u=e.tracksStore;switch(r){case"video":case"audio":case"text":(0,b.Z)(u)?(s.Z.error("API: TracksStore not instanciated for a new "+r+" period"),o.setValue(null)):u.addTrackReference(r,i,a,o);break;default:(0,g.Z)(r)}}},i._priv_onPeriodStreamCleared=function(e,t){var n;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var r=t.type,i=t.period,a=e.tracksStore;switch(r){case"audio":case"text":case"video":(0,b.Z)(a)||a.removeTrackReference(r,i)}var o=e.activeAdaptations,s=e.activeRepresentations;if(!(0,b.Z)(o)&&!(0,b.Z)(o[i.id])){var u=o[i.id];delete u[r],0===Object.keys(u).length&&delete o[i.id]}if(!(0,b.Z)(s)&&!(0,b.Z)(s[i.id])){var l=s[i.id];delete l[r],0===Object.keys(l).length&&delete s[i.id]}}},i._priv_onAdaptationChange=function(e,t){var n,r=t.type,i=t.adaptation,a=t.period;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeAdaptations&&(e.activeAdaptations={});var o,s=e.activeAdaptations,u=e.currentPeriod,l=s[a.id];if((0,b.Z)(l))s[a.id]=((o={})[r]=i,o);else l[r]=i;var d=e.tracksStore,c=e.currentContentCanceller.signal;if(null!==d&&null!==u&&!(0,b.Z)(a)&&a.id===u.id){var f=d.getPeriodObjectFromPeriod(a);if(void 0===f)return;switch(r){case"audio":var v=d.getChosenAudioTrack(f);this._priv_triggerEventIfNotStopped("audioTrackChange",v,c);break;case"text":var p=d.getChosenTextTrack(f);this._priv_triggerEventIfNotStopped("textTrackChange",p,c);break;case"video":var h=d.getChosenVideoTrack(f);this._priv_triggerEventIfNotStopped("videoTrackChange",h,c)}}}},i._priv_onRepresentationChange=function(e,t){var n,r=t.type,i=t.period,a=t.representation;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){null===e.activeRepresentations&&(e.activeRepresentations={});var o,s=e.activeRepresentations,u=e.currentPeriod,l=s[i.id];if((0,b.Z)(l))s[i.id]=((o={})[r]=a,o);else l[r]=a;if(!(0,b.Z)(i)&&null!==u&&u.id===i.id){var d=this._priv_contentInfos.currentContentCanceller.signal;"video"===r?this._priv_triggerEventIfNotStopped("videoRepresentationChange",a,d):"audio"===r&&this._priv_triggerEventIfNotStopped("audioRepresentationChange",a,d)}}},i._priv_onBitrateEstimateChange=function(e){var t=e.type,n=e.bitrate;void 0!==n&&(this._priv_bitrateInfos.lastBitrates[t]=n),this.trigger("__priv_bitrateEstimateChange",{type:t,bitrate:n})},i._priv_setPlayerState=function(e){this.state!==e&&(this.state=e,s.Z.info("API: playerStateChange event",e),this.trigger("playerStateChange",e))},i._priv_triggerPositionUpdate=function(e,t){var n,r;if(e.contentId===(null===(n=this._priv_contentInfos)||void 0===n?void 0:n.contentId)){var i=e.isDirectFile,o=e.manifest;if((i||null!==o)&&!(0,b.Z)(t)){var s=null!==o?o.getMaximumSafePosition():void 0,u={position:t.position,duration:t.duration,playbackRate:t.playbackRate,maximumPosition:s,bufferGap:void 0!==t.bufferGap&&isFinite(t.bufferGap)?t.bufferGap:0};if(null!==o&&o.isLive&&t.position>0){var l=null!==(r=o.availabilityStartTime)&&void 0!==r?r:0;u.wallClockTime=t.position+l;var d=o.getLivePosition();void 0!==d&&(u.liveGap=d-t.position)}else if(i&&null!==this.videoElement){var c=a(this.videoElement);void 0!==c&&(u.wallClockTime=c+t.position)}this.trigger("positionUpdate",u)}}},i._priv_triggerEventIfNotStopped=function(e,t,n){n.isCancelled()||this.trigger(e,t)},i._priv_initializeMediaElementTracksStore=function(e){var t,n,r,i=this;(0,m.Z)(null!==v.Z.directfile,"Initializing `MediaElementTracksStore` without Directfile feature"),(0,m.Z)(null!==this.videoElement,"Initializing `MediaElementTracksStore` on a disposed RxPlayer");var a=new v.Z.directfile.mediaElementTracksStore(this.videoElement);return this._priv_triggerEventIfNotStopped("availableAudioTracksChange",a.getAvailableAudioTracks(),e),this._priv_triggerEventIfNotStopped("availableVideoTracksChange",a.getAvailableVideoTracks(),e),this._priv_triggerEventIfNotStopped("availableTextTracksChange",a.getAvailableTextTracks(),e),this._priv_triggerEventIfNotStopped("audioTrackChange",null!==(t=a.getChosenAudioTrack())&&void 0!==t?t:null,e),this._priv_triggerEventIfNotStopped("textTrackChange",null!==(n=a.getChosenTextTrack())&&void 0!==n?n:null,e),this._priv_triggerEventIfNotStopped("videoTrackChange",null!==(r=a.getChosenVideoTrack())&&void 0!==r?r:null,e),a.addEventListener("availableVideoTracksChange",(function(e){return i.trigger("availableVideoTracksChange",e)})),a.addEventListener("availableAudioTracksChange",(function(e){return i.trigger("availableAudioTracksChange",e)})),a.addEventListener("availableTextTracksChange",(function(e){return i.trigger("availableTextTracksChange",e)})),a.addEventListener("audioTrackChange",(function(e){return i.trigger("audioTrackChange",e)})),a.addEventListener("videoTrackChange",(function(e){return i.trigger("videoTrackChange",e)})),a.addEventListener("textTrackChange",(function(e){return i.trigger("textTrackChange",e)})),a},i._priv_callTracksStoreGetterSetter=function(e,t,n){var r,i;if(null===this._priv_contentInfos||null===this._priv_contentInfos.tracksStore)return s.Z.warn("API: Trying to call track API too soon"),t;var a=this._priv_contentInfos.tracksStore,o=null!==(i=null===(r=this._priv_contentInfos)||void 0===r?void 0:r.currentPeriod)&&void 0!==i?i:void 0,u=null!=e?e:null==o?void 0:o.id;if(void 0===u)return t;var l=u===(null==o?void 0:o.id)?a.getPeriodObjectFromPeriod(o):a.getPeriodObjectFromId(u);return void 0===l?t:n(a,l)},i._priv_onAvailableTracksMayHaveChanged=function(e,t){var n=this._priv_contentInfos;if(null!==n){var r=n.currentPeriod,i=n.tracksStore,a=n.currentContentCanceller.signal;if(!(0,b.Z)(r)&&null!==i){var o=null!=t?t:i.getPeriodObjectFromPeriod(r);if(void 0!==o)switch(e){case"video":var s=i.getAvailableVideoTracks(o);this._priv_triggerEventIfNotStopped("availableVideoTracksChange",null!=s?s:[],a);break;case"audio":var u=i.getAvailableAudioTracks(o);this._priv_triggerEventIfNotStopped("availableAudioTracksChange",null!=u?u:[],a);break;case"text":var l=i.getAvailableTextTracks(o);this._priv_triggerEventIfNotStopped("availableTextTracksChange",null!=l?l:[],a);break;default:(0,g.Z)(e)}}}},i._priv_onFatalError=function(e,t){var n=(0,d.Z)(e,{defaultCode:"NONE",defaultReason:"An unknown error stopped content playback."});n.fatal=!0,t.currentContentCanceller.cancel(),this._priv_cleanUpCurrentContentState(),this._priv_currentError=n,s.Z.error("API: The player stopped because of an error",n),this._priv_setPlayerState("STOPPED"),this._priv_currentError===n&&this.trigger("error",n)},(0,e.Z)(r,null,[{key:"ErrorTypes",get:function(){return f.ZB}},{key:"ErrorCodes",get:function(){return f.SM}},{key:"LogLevel",get:function(){return s.Z.getLevel()},set:function(e){s.Z.setLevel(e)}}]),r}(y.Z);On.version="4.0.0-beta.2";var Ln=On,Un=n(7273);!function(){Un.Z.ContentDecryptor=n(1266).ZP,Un.Z.transports.smooth=n(5418).Z,Un.Z.transports.dash=n(2047).Z,Un.Z.dashParsers.js=n(8337).Z,Un.Z.nativeTextTracksBuffer=n(9059).Z,Un.Z.nativeTextTracksParsers.vtt=n(9405).Z,Un.Z.nativeTextTracksParsers.ttml=n(1570).Z,Un.Z.nativeTextTracksParsers.sami=n(1812).Z,Un.Z.nativeTextTracksParsers.srt=n(8057).Z,Un.Z.htmlTextTracksBuffer=n(5192).Z,Un.Z.htmlTextTracksParsers.sami=n(5734).Z,Un.Z.htmlTextTracksParsers.ttml=n(7439).Z,Un.Z.htmlTextTracksParsers.srt=n(8675).Z,Un.Z.htmlTextTracksParsers.vtt=n(4099).Z;var e=n(9372).Z,t=n(1932).Z;Un.Z.directfile={initDirectFile:e,mediaElementTracksStore:t}}(),"boolean"==typeof __RX_PLAYER_DEBUG_MODE__&&__RX_PLAYER_DEBUG_MODE__&&s.Z.setLevel("DEBUG");var Bn=Ln}(),r=r.default}()}));