eb-player 1.54.57 → 2.0.1

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 (202) hide show
  1. package/README.md +2 -6
  2. package/dist/build/default.js +1 -1
  3. package/dist/build/eb-player.css +2066 -0
  4. package/dist/build/ebplayer-engines.bundle.js +2393 -0
  5. package/dist/build/ebplayer-engines.bundle.js.map +1 -0
  6. package/dist/build/ebplayer.bundle.js +6603 -0
  7. package/dist/build/ebplayer.bundle.js.map +1 -0
  8. package/dist/build/theme-forja.css +10 -0
  9. package/dist/build/theme-forja.js +1 -0
  10. package/dist/build/theme-modern.css +520 -0
  11. package/dist/build/theme-radio.css +11 -0
  12. package/dist/build/theme-radio.js +1 -0
  13. package/dist/build/theme-snrt.css +11 -0
  14. package/dist/build/theme-snrt.js +1 -0
  15. package/dist/build/theme-v2.css +661 -0
  16. package/dist/build/types/config.d.ts +139 -0
  17. package/dist/build/types/config.d.ts.map +1 -0
  18. package/dist/build/types/core/command-handler.d.ts +49 -0
  19. package/dist/build/types/core/command-handler.d.ts.map +1 -0
  20. package/dist/build/types/core/config.d.ts +174 -0
  21. package/dist/build/types/core/config.d.ts.map +1 -0
  22. package/dist/build/types/core/css/theme-forja.entry.d.ts +2 -0
  23. package/dist/build/types/core/css/theme-forja.entry.d.ts.map +1 -0
  24. package/dist/build/types/core/css/theme-radio.entry.d.ts +2 -0
  25. package/dist/build/types/core/css/theme-radio.entry.d.ts.map +1 -0
  26. package/dist/build/types/core/css/theme-snrt.entry.d.ts +2 -0
  27. package/dist/build/types/core/css/theme-snrt.entry.d.ts.map +1 -0
  28. package/dist/build/types/core/engine-state-sync.d.ts +38 -0
  29. package/dist/build/types/core/engine-state-sync.d.ts.map +1 -0
  30. package/dist/build/types/core/event-bus.d.ts +87 -0
  31. package/dist/build/types/core/event-bus.d.ts.map +1 -0
  32. package/dist/build/types/core/fsm.d.ts +27 -0
  33. package/dist/build/types/core/fsm.d.ts.map +1 -0
  34. package/dist/build/types/core/i18n.d.ts +51 -0
  35. package/dist/build/types/core/i18n.d.ts.map +1 -0
  36. package/dist/build/types/core/index.d.ts +23 -0
  37. package/dist/build/types/core/index.d.ts.map +1 -0
  38. package/dist/build/types/core/lifecycle.d.ts +96 -0
  39. package/dist/build/types/core/lifecycle.d.ts.map +1 -0
  40. package/dist/build/types/core/player-state.d.ts +15 -0
  41. package/dist/build/types/core/player-state.d.ts.map +1 -0
  42. package/dist/build/types/core/types.d.ts +84 -0
  43. package/dist/build/types/core/types.d.ts.map +1 -0
  44. package/dist/build/types/eb-player-standalone.d.ts +12 -0
  45. package/dist/build/types/eb-player-standalone.d.ts.map +1 -0
  46. package/dist/build/types/eb-player.d.ts +43 -0
  47. package/dist/build/types/eb-player.d.ts.map +1 -0
  48. package/dist/build/types/engine-state-sync.d.ts +38 -0
  49. package/dist/build/types/engine-state-sync.d.ts.map +1 -0
  50. package/dist/build/types/engines/abr/dash.d.ts +56 -0
  51. package/dist/build/types/engines/abr/dash.d.ts.map +1 -0
  52. package/dist/build/types/engines/abr/hls.d.ts +105 -0
  53. package/dist/build/types/engines/abr/hls.d.ts.map +1 -0
  54. package/dist/build/types/engines/base-engine.d.ts +56 -0
  55. package/dist/build/types/engines/base-engine.d.ts.map +1 -0
  56. package/dist/build/types/engines/cdn-loader.d.ts +20 -0
  57. package/dist/build/types/engines/cdn-loader.d.ts.map +1 -0
  58. package/dist/build/types/engines/cdn-token-manager.d.ts +136 -0
  59. package/dist/build/types/engines/cdn-token-manager.d.ts.map +1 -0
  60. package/dist/build/types/engines/dash.d.ts +79 -0
  61. package/dist/build/types/engines/dash.d.ts.map +1 -0
  62. package/dist/build/types/engines/drm.d.ts +54 -0
  63. package/dist/build/types/engines/drm.d.ts.map +1 -0
  64. package/dist/build/types/engines/hls-discontinuity-patch.d.ts +43 -0
  65. package/dist/build/types/engines/hls-discontinuity-patch.d.ts.map +1 -0
  66. package/dist/build/types/engines/hls.d.ts +45 -0
  67. package/dist/build/types/engines/hls.d.ts.map +1 -0
  68. package/dist/build/types/engines/index.d.ts +26 -0
  69. package/dist/build/types/engines/index.d.ts.map +1 -0
  70. package/dist/build/types/engines/ios/hls.d.ts +20 -0
  71. package/dist/build/types/engines/ios/hls.d.ts.map +1 -0
  72. package/dist/build/types/engines/poster/hls.d.ts +35 -0
  73. package/dist/build/types/engines/poster/hls.d.ts.map +1 -0
  74. package/dist/build/types/engines/retry/dash.d.ts +39 -0
  75. package/dist/build/types/engines/retry/dash.d.ts.map +1 -0
  76. package/dist/build/types/engines/retry/hls.d.ts +35 -0
  77. package/dist/build/types/engines/retry/hls.d.ts.map +1 -0
  78. package/dist/build/types/engines/snapshot/dash.d.ts +55 -0
  79. package/dist/build/types/engines/snapshot/dash.d.ts.map +1 -0
  80. package/dist/build/types/engines/snapshot/hls.d.ts +108 -0
  81. package/dist/build/types/engines/snapshot/hls.d.ts.map +1 -0
  82. package/dist/build/types/engines/stall-watchdog.d.ts +41 -0
  83. package/dist/build/types/engines/stall-watchdog.d.ts.map +1 -0
  84. package/dist/build/types/event-bus.d.ts +54 -0
  85. package/dist/build/types/event-bus.d.ts.map +1 -0
  86. package/dist/build/types/fsm.d.ts +27 -0
  87. package/dist/build/types/fsm.d.ts.map +1 -0
  88. package/dist/build/types/i18n.d.ts +51 -0
  89. package/dist/build/types/i18n.d.ts.map +1 -0
  90. package/dist/build/types/index.d.ts +21 -0
  91. package/dist/build/types/index.d.ts.map +1 -0
  92. package/dist/build/types/integrations/ads-manager.d.ts +32 -0
  93. package/dist/build/types/integrations/ads-manager.d.ts.map +1 -0
  94. package/dist/build/types/integrations/chromecast-manager.d.ts +50 -0
  95. package/dist/build/types/integrations/chromecast-manager.d.ts.map +1 -0
  96. package/dist/build/types/integrations/epg-manager.d.ts +22 -0
  97. package/dist/build/types/integrations/epg-manager.d.ts.map +1 -0
  98. package/dist/build/types/integrations/index.d.ts +6 -0
  99. package/dist/build/types/integrations/index.d.ts.map +1 -0
  100. package/dist/build/types/integrations/p2p-manager.d.ts +33 -0
  101. package/dist/build/types/integrations/p2p-manager.d.ts.map +1 -0
  102. package/dist/build/types/integrations/playlist-manager.d.ts +21 -0
  103. package/dist/build/types/integrations/playlist-manager.d.ts.map +1 -0
  104. package/dist/build/types/lifecycle.d.ts +64 -0
  105. package/dist/build/types/lifecycle.d.ts.map +1 -0
  106. package/dist/build/types/player-state.d.ts +15 -0
  107. package/dist/build/types/player-state.d.ts.map +1 -0
  108. package/dist/build/types/skin/bars/bottom-bar.d.ts +16 -0
  109. package/dist/build/types/skin/bars/bottom-bar.d.ts.map +1 -0
  110. package/dist/build/types/skin/bars/middle-bar.d.ts +16 -0
  111. package/dist/build/types/skin/bars/middle-bar.d.ts.map +1 -0
  112. package/dist/build/types/skin/bars/top-bar.d.ts +15 -0
  113. package/dist/build/types/skin/bars/top-bar.d.ts.map +1 -0
  114. package/dist/build/types/skin/base-component.d.ts +69 -0
  115. package/dist/build/types/skin/base-component.d.ts.map +1 -0
  116. package/dist/build/types/skin/brand/forja-playlist-bar.d.ts +15 -0
  117. package/dist/build/types/skin/brand/forja-playlist-bar.d.ts.map +1 -0
  118. package/dist/build/types/skin/brand/snrt-radio-carousel.d.ts +16 -0
  119. package/dist/build/types/skin/brand/snrt-radio-carousel.d.ts.map +1 -0
  120. package/dist/build/types/skin/component-registry.d.ts +16 -0
  121. package/dist/build/types/skin/component-registry.d.ts.map +1 -0
  122. package/dist/build/types/skin/controllers/auto-hide.d.ts +27 -0
  123. package/dist/build/types/skin/controllers/auto-hide.d.ts.map +1 -0
  124. package/dist/build/types/skin/controllers/keyboard.d.ts +29 -0
  125. package/dist/build/types/skin/controllers/keyboard.d.ts.map +1 -0
  126. package/dist/build/types/skin/controls/cast-button.d.ts +15 -0
  127. package/dist/build/types/skin/controls/cast-button.d.ts.map +1 -0
  128. package/dist/build/types/skin/controls/forward-button.d.ts +15 -0
  129. package/dist/build/types/skin/controls/forward-button.d.ts.map +1 -0
  130. package/dist/build/types/skin/controls/fullscreen-button.d.ts +17 -0
  131. package/dist/build/types/skin/controls/fullscreen-button.d.ts.map +1 -0
  132. package/dist/build/types/skin/controls/info-button.d.ts +10 -0
  133. package/dist/build/types/skin/controls/info-button.d.ts.map +1 -0
  134. package/dist/build/types/skin/controls/live-sync-button.d.ts +20 -0
  135. package/dist/build/types/skin/controls/live-sync-button.d.ts.map +1 -0
  136. package/dist/build/types/skin/controls/pip-button.d.ts +21 -0
  137. package/dist/build/types/skin/controls/pip-button.d.ts.map +1 -0
  138. package/dist/build/types/skin/controls/play-pause-button.d.ts +14 -0
  139. package/dist/build/types/skin/controls/play-pause-button.d.ts.map +1 -0
  140. package/dist/build/types/skin/controls/rewind-button.d.ts +15 -0
  141. package/dist/build/types/skin/controls/rewind-button.d.ts.map +1 -0
  142. package/dist/build/types/skin/controls/seekbar.d.ts +43 -0
  143. package/dist/build/types/skin/controls/seekbar.d.ts.map +1 -0
  144. package/dist/build/types/skin/controls/settings-panel.d.ts +45 -0
  145. package/dist/build/types/skin/controls/settings-panel.d.ts.map +1 -0
  146. package/dist/build/types/skin/controls/share-button.d.ts +11 -0
  147. package/dist/build/types/skin/controls/share-button.d.ts.map +1 -0
  148. package/dist/build/types/skin/controls/time-display.d.ts +19 -0
  149. package/dist/build/types/skin/controls/time-display.d.ts.map +1 -0
  150. package/dist/build/types/skin/controls/volume-control.d.ts +21 -0
  151. package/dist/build/types/skin/controls/volume-control.d.ts.map +1 -0
  152. package/dist/build/types/skin/icons/icons-modern.d.ts +10 -0
  153. package/dist/build/types/skin/icons/icons-modern.d.ts.map +1 -0
  154. package/dist/build/types/skin/icons/icons.d.ts +10 -0
  155. package/dist/build/types/skin/icons/icons.d.ts.map +1 -0
  156. package/dist/build/types/skin/icons/sprite.d.ts +39 -0
  157. package/dist/build/types/skin/icons/sprite.d.ts.map +1 -0
  158. package/dist/build/types/skin/index.d.ts +24 -0
  159. package/dist/build/types/skin/index.d.ts.map +1 -0
  160. package/dist/build/types/skin/overlays/error-message.d.ts +14 -0
  161. package/dist/build/types/skin/overlays/error-message.d.ts.map +1 -0
  162. package/dist/build/types/skin/overlays/info-overlay.d.ts +15 -0
  163. package/dist/build/types/skin/overlays/info-overlay.d.ts.map +1 -0
  164. package/dist/build/types/skin/overlays/loading-spinner.d.ts +17 -0
  165. package/dist/build/types/skin/overlays/loading-spinner.d.ts.map +1 -0
  166. package/dist/build/types/skin/overlays/socials-overlay.d.ts +17 -0
  167. package/dist/build/types/skin/overlays/socials-overlay.d.ts.map +1 -0
  168. package/dist/build/types/skin/overlays/toast-notification.d.ts +18 -0
  169. package/dist/build/types/skin/overlays/toast-notification.d.ts.map +1 -0
  170. package/dist/build/types/skin/skin-root.d.ts +80 -0
  171. package/dist/build/types/skin/skin-root.d.ts.map +1 -0
  172. package/dist/build/types/types.d.ts +41 -0
  173. package/dist/build/types/types.d.ts.map +1 -0
  174. package/dist/build/types/utils/chapters.d.ts +16 -0
  175. package/dist/build/types/utils/chapters.d.ts.map +1 -0
  176. package/dist/build/types/utils/format-duration.d.ts +9 -0
  177. package/dist/build/types/utils/format-duration.d.ts.map +1 -0
  178. package/dist/build/types/utils/format-wall-clock.d.ts +6 -0
  179. package/dist/build/types/utils/format-wall-clock.d.ts.map +1 -0
  180. package/dist/build/types/utils/settings-helpers.d.ts +41 -0
  181. package/dist/build/types/utils/settings-helpers.d.ts.map +1 -0
  182. package/dist/dev/default.js +6451 -0
  183. package/dist/dev/default.js.map +1 -0
  184. package/dist/dev/easybroadcast.js +6677 -0
  185. package/dist/dev/easybroadcast.js.map +1 -0
  186. package/dist/dev/index.html +24 -0
  187. package/dist/eb-player.css +2066 -0
  188. package/dist/players/default/default.js +400 -1
  189. package/dist/players/default/index.html +1 -5
  190. package/dist/players/forja/forja.js +310 -0
  191. package/dist/players/forja/index.html +1 -0
  192. package/dist/players/videos/equipe/EB_lequipe-preprod.js +1 -0
  193. package/dist/players/videos/equipe/EB_lequipe.js +1 -1
  194. package/dist/players/videos/equipe/equipe.js +1 -1
  195. package/dist/theme-forja.css +10 -0
  196. package/dist/theme-modern.css +520 -0
  197. package/dist/theme-radio.css +11 -0
  198. package/dist/theme-snrt.css +11 -0
  199. package/dist/theme-v2.css +661 -0
  200. package/package.json +34 -3
  201. package/dist/build/forja.js +0 -1
  202. package/dist/players/videos/equipe/EB_lequipe-preprod copy.js +0 -1
@@ -1,5 +1 @@
1
- <!doctype html><html><head><meta charset="UTF-8"><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><title>Easybroadcast Player</title><style>html, body {
2
- margin: 0;
3
- background-color: black;
4
- height: 100%;
5
- }</style><script defer="defer" src="default.js"></script></head><body><div id="eb_player"></div></body></html>
1
+ <!doctype html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>EBPlayer</title><style>html,body{margin:0;background-color:black;height:100vh}#eb_player{width:100%;height:100vh}</style><script defer src="default.js"></script></head><body><div id="eb_player"></div></body></html>
@@ -0,0 +1,310 @@
1
+ var EBPlayerBundle=function(e){"use strict";function t(e,t){void 0===t&&(t={});var s=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===s&&i.firstChild?i.insertBefore(n,i.firstChild):i.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}t(".eb-player{--eb-color-primary:#1fa9dd;--eb-color-progress:var(--eb-color-primary);--eb-color-volume:var(--eb-color-primary);--eb-color-background:rgba(0,0,0,.8);--eb-color-text:#fff;--eb-color-icon:#fff;--eb-radius-control:4px;--eb-duration-transition:200ms;--eb-font-family:Arial,sans-serif;--eb-font-size-base:14px;box-sizing:border-box;color:var(--eb-color-text);font-family:var(--eb-font-family);font-size:var(--eb-font-size-base);overflow:hidden;position:relative}.eb-player *,.eb-player :after,.eb-player :before{box-sizing:inherit}.eb-player__container{background-color:var(--eb-color-background);height:100%;position:relative;width:100%}.eb-player__video{display:block;height:100%;object-fit:contain;width:100%}");t(".eb-player{background:#000;box-sizing:border-box;color:#fff;font-family:sans-serif;height:100%;overflow:hidden;position:relative;user-select:none;width:100%}.eb-player video.eb-video{display:block;height:100%;left:0;object-fit:contain;position:absolute;top:0;width:100%}.eb-overlay-zone{align-items:center;display:flex;justify-content:center;z-index:10}.eb-overlay-zone,.eb-poster{inset:0;pointer-events:none;position:absolute}.eb-poster{height:100%;object-fit:cover;width:100%}.eb-ads-container{inset:0;pointer-events:none;position:absolute;z-index:20}.eb-top-bar{align-items:center;background:linear-gradient(180deg,rgba(0,0,0,.6),transparent);display:flex;flex-direction:row;justify-content:space-between;left:0;padding:8px 12px;pointer-events:auto;position:absolute;right:0;top:0;z-index:30}.eb-top-bar__logo{display:block;height:28px;width:auto}.eb-top-bar__logo-link{display:inline-flex;text-decoration:none}.eb-top-bar__actions{align-items:center;display:flex;gap:4px;margin-left:auto}.eb-bottom-bar{display:flex;flex-direction:column;pointer-events:auto;z-index:30}.eb-bottom-bar,.eb-bottom-bar__gradient{bottom:0;left:0;position:absolute;right:0}.eb-bottom-bar__gradient{background:linear-gradient(0deg,rgba(0,0,0,.7),transparent);height:100px;pointer-events:none;z-index:-1}.eb-bottom-bar__seekbar-zone{padding:0 12px}.eb-bottom-bar__controls-row{align-items:center;display:flex;flex-direction:row;gap:4px;padding:4px 8px 8px}.eb-spacer{flex:1}.eb-middle-bar{left:50%;pointer-events:auto;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:25}.eb-middle-bar__play-btn{align-items:center;background:rgba(0,0,0,.5);border-radius:50%;display:flex;height:64px;justify-content:center;width:64px}.eb-extension-bottom-extra,.eb-extension-controls-extra,.eb-extension-overlay,.eb-extension-top-extra{pointer-events:auto;position:absolute;z-index:35}.eb-extension-top-extra{left:0;right:0;top:0}.eb-extension-bottom-extra{bottom:0;left:0;right:0}.eb-extension-overlay{align-items:center;display:flex;inset:0;justify-content:center}.eb-extension-controls-extra{align-items:center;bottom:0;display:flex;gap:4px;padding:4px 8px 8px;right:0}.eb-icon{fill:currentColor;display:block;flex-shrink:0;height:20px;pointer-events:none;width:20px}.eb-button{-webkit-tap-highlight-color:transparent;align-items:center;background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;display:flex;justify-content:center;padding:6px;transition:background .15s}.eb-button:hover{background:hsla(0,0%,100%,.15)}.eb-button:active{background:hsla(0,0%,100%,.25)}.eb-radio-overlay{align-items:center;background:#000;display:flex;inset:0;justify-content:center;position:absolute;z-index:15}.eb-radio-bars{align-items:flex-end;display:flex;gap:4px;height:40px}.eb-radio-bar{animation:eb-radio-bar-bounce .8s ease-in-out infinite;background:#fff;border-radius:3px;display:block;width:6px}.eb-radio-bar:first-child{animation-delay:0s;height:20px}.eb-radio-bar:nth-child(2){animation-delay:.1s;height:32px}.eb-radio-bar:nth-child(3){animation-delay:.2s;height:40px}.eb-radio-bar:nth-child(4){animation-delay:.3s;height:28px}.eb-radio-bar:nth-child(5){animation-delay:.4s;height:16px}@keyframes eb-radio-bar-bounce{0%,to{opacity:.7;transform:scaleY(.4)}50%{opacity:1;transform:scaleY(1)}}.eb-controls-visible .eb-bottom-bar,.eb-controls-visible .eb-middle-bar,.eb-controls-visible .eb-top-bar{opacity:1;transition:opacity .3s}.eb-controls-hidden .eb-bottom-bar,.eb-controls-hidden .eb-middle-bar,.eb-controls-hidden .eb-top-bar{opacity:0;pointer-events:none;transition:opacity .3s}.eb-ios-native .eb-bottom-bar,.eb-ios-native .eb-middle-bar,.eb-ios-native .eb-overlay-zone,.eb-ios-native .eb-top-bar{display:none}[dir=rtl] .eb-bottom-bar__controls-row,[dir=rtl] .eb-top-bar{flex-direction:row-reverse}.eb-player,.eb-player video{max-height:100%;max-width:100%}");const s={idle:["loading"],loading:["playing","error","idle"],playing:["paused","buffering","ended","error","idle"],paused:["playing","loading","idle"],buffering:["playing","paused","idle","error"],error:["loading","idle"],ended:["loading","idle"]};class i{constructor(){this.listeners=new Map}on(e,t,s){this.listeners.has(e)||this.listeners.set(e,new Set);const i=this.listeners.get(e);i.add(t);const n=s?.signal;if(void 0!==n){const e=()=>{i.delete(t)};n.addEventListener("abort",e,{once:!0})}}notify(e,t,s){const i=this.listeners.get(e);if(void 0!==i)for(const e of i)e(t,s)}}const n={playbackState:"idle",volume:1,currentTime:0,duration:0,muted:!1,bufferedEnd:0,isLive:!1,qualityLevels:[],currentQuality:-1,audioTracks:[],currentAudioTrack:-1,subtitleTracks:[],currentSubtitleTrack:-1,playbackRate:1,error:null,src:"",isFullscreen:!1,isPip:!1,isCasting:!1,controlsVisible:!0,settingsOpen:!1,socialsOpen:!1,infoOpen:!1,adPlaying:!1,castAvailable:!1,isRtl:!1,isRadio:!1,isIOS:!1,isSyncWithLive:!1,epgPrograms:[],epgFetchedAt:0,chapters:[],playlist:[],currentEpisode:-1};function r(e){const t={...n,...e},r=new i;return new Proxy(t,{get:(e,t)=>"on"===t?r.on.bind(r):e[t],set(e,t,i){const n=t;if(!function(e){if(null==e||"object"!=typeof e)return!0;if(Array.isArray(e))return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(i))throw new TypeError(`PlayerState: cannot assign a non-plain object (class instance) to "${String(t)}". Only primitives, plain objects, arrays, null, and undefined are allowed. Driver instances (hls.js, dash.js) must never enter the state store.`);if("playbackState"===n){const t=e.playbackState,n=i;if(a=n,!s[t].includes(a))throw new Error(`FSM: invalid playbackState transition from "${t}" to "${n}". This transition is not allowed by the FSM transition map.`)}var a;const o=e[n];return o===i||(e[String(n)]=i,r.notify(n,i,o)),!0}})}class a{constructor(){this.listeners=new Map}on(e,t,s){const i=s?.signal;if(!0===i?.aborted)return;this.listeners.has(e)||this.listeners.set(e,new Set);const n=this.listeners.get(e),r=t;n.add(r),void 0!==i&&i.addEventListener("abort",()=>{n.delete(r)},{once:!0})}emit(...e){const[t,s]=e,i=this.listeners.get(t);if(void 0!==i&&0!==i.size)for(const e of i)void 0!==s?e(s):e()}dispose(){this.listeners.clear()}}const o={template:"",el:"#eb_player",skin:"default",start:!0,forceAutoplayAudio:!1,style:void 0,css:"",dashjs:"https://reference.dashif.org/dash.js/v4.7.4/dist/dash.all.min.js",hlsjs:"https://cdn.jsdelivr.net/npm/hls.js@1.6.10/dist/hls.min.js",engineSettings:{liveSyncDurationCount:8},chromecast:"https://cdnjs.cloudflare.com/ajax/libs/castjs/5.3.0/cast.min.js",chromecastApp:void 0,chromecastMetadata:void 0,src:void 0,autoplay:!0,muted:!0,image:!1,loop:!1,startAt:void 0,loading:!0,logo:void 0,logoLink:void 0,logoPositions:["top-left"],about:"Powered by EasyBroadcast.",primaryColor:"#1FA9DD",skinColor:"",skinColors:{general:"",progressBar:"",volumeBar:""},socials:!1,customSocialsShare:!1,seekbar:!0,middlebar:!0,pip:!0,retry:!0,lowLatency:!1,ad:void 0,radio:!1,token:void 0,tokenType:void 0,srcInTokenRequest:!1,defaultAudio:void 0,defaultSubtitle:void 0,forceAutoplay:!1,forceQuality:!1,liveButton:!1,syncLiveMargin:300,isLive:void 0,noUi:!1,preroll:!1,prerollSkip:1/0,prerollLink:!1,posterStream:!1,speed:!0,chapters:null,skippableChapters:[],supportHotKeys:!1,useGeoblockingErrorHandle:!1,extraParamsCallback:void 0,licenseXhrSetup:void 0,volume:1,lib:void 0,manager:"wss://manager.kube.easybroadcast.fr/easybroadcast/Xc152ogNOWvOZSH",stats:"https://stats.easybroadcast.fr",origin:"easybroadcast",content:void 0,libSettings:{resourceManager:{timeoutV2V:4500,storageSize:300,randomWaitForPeers:[1e3,3e3],partialRequest:!0,setEnableV2V:!0}},hasPlaylistPicker:!1,disableCustomAbr:!1,lang:void 0,epgContentId:void 0,epgPolling:null,epgDefaultLang:"en",showEpgTitlePreview:!1,showProgressThumb:!1};function l(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function c(e,t){if("function"==typeof t)return t;if(Array.isArray(t))return[...t];if(l(t)&&l(e)){const s={};for(const t of Object.keys(e))s[t]=e[t];for(const i of Object.keys(t))s[i]=c(e[i],t[i]);return s}if(l(t)){const e={};for(const s of Object.keys(t))e[s]=c(void 0,t[s]);return e}return void 0!==t?t:e}function h(...e){let t={};for(const s of e)null!=s&&(t=c(t,s));return t}const d=["en","fr","ar","es"],u={"error.start":{en:"An error occurred while trying to start the video.",fr:"Une erreur est survenue lors de la tentative de demarrage de la video.",ar:"An error occurred while trying to start the video.",es:"Ocurrió un error al intentar iniciar el video."}};function p(e){if(void 0===e||""===e)return"en";const t=e.split(/[-_]/)[0].toLowerCase();return d.includes(t)?t:"en"}class g{constructor(e){this.currentLocale=p(e),this.translations={...u}}addTranslations(e){for(const t of Object.keys(e))this.translations[t]={...this.translations[t],...e[t]}}t(e,t){const s=this.translations[e];let i;return i=void 0===s?e:void 0!==s[this.currentLocale]?s[this.currentLocale]:void 0!==s.en?s.en:e,void 0===t||0===Object.keys(t).length?i:this.interpolate(i,t)}interpolate(e,t){return e.replace(/\{(\w+)\}/g,(e,s)=>{const i=t[s];return void 0!==i?String(i):e})}setLocale(e){this.currentLocale=p(e)}getLocale(){return this.currentLocale}}
2
+ /**
3
+ * @license
4
+ * Copyright 2017 Google LLC
5
+ * SPDX-License-Identifier: BSD-3-Clause
6
+ */const b=globalThis,f=e=>e,m=b.trustedTypes,v=m?m.createPolicy("lit-html",{createHTML:e=>e}):void 0,y="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,x="?"+k,L=`<${x}>`,E=document,w=()=>E.createComment(""),A=e=>null===e||"object"!=typeof e&&"function"!=typeof e,C=Array.isArray,T="[ \t\n\f\r]",$=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,S=/>/g,M=RegExp(`>|${T}(?:([^\\s"'>=/]+)(${T}*=${T}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),P=/'/g,R=/"/g,B=/^(?:script|style|textarea|title)$/i,D=e=>(t,...s)=>({_$litType$:e,strings:t,values:s}),F=D(1),z=D(2),I=Symbol.for("lit-noChange"),N=Symbol.for("lit-nothing"),V=new WeakMap,H=E.createTreeWalker(E,129);function O(e,t){if(!C(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==v?v.createHTML(t):t}const U=(e,t)=>{const s=e.length-1,i=[];let n,r=2===t?"<svg>":3===t?"<math>":"",a=$;for(let t=0;t<s;t++){const s=e[t];let o,l,c=-1,h=0;for(;h<s.length&&(a.lastIndex=h,l=a.exec(s),null!==l);)h=a.lastIndex,a===$?"!--"===l[1]?a=_:void 0!==l[1]?a=S:void 0!==l[2]?(B.test(l[2])&&(n=RegExp("</"+l[2],"g")),a=M):void 0!==l[3]&&(a=M):a===M?">"===l[0]?(a=n??$,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?M:'"'===l[3]?R:P):a===R||a===P?a=M:a===_||a===S?a=$:(a=M,n=void 0);const d=a===M&&e[t+1].startsWith("/>")?" ":"";r+=a===$?s+L:c>=0?(i.push(o),s.slice(0,c)+y+s.slice(c)+k+d):s+k+(-2===c?t:d)}return[O(e,r+(e[s]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};class j{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,r=0;const a=e.length-1,o=this.parts,[l,c]=U(e,t);if(this.el=j.createElement(l,s),H.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=H.nextNode())&&o.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(y)){const t=c[r++],s=i.getAttribute(e).split(k),a=/([.?@])?(.*)/.exec(t);o.push({type:1,index:n,name:a[2],strings:s,ctor:"."===a[1]?Q:"?"===a[1]?X:"@"===a[1]?K:Y}),i.removeAttribute(e)}else e.startsWith(k)&&(o.push({type:6,index:n}),i.removeAttribute(e));if(B.test(i.tagName)){const e=i.textContent.split(k),t=e.length-1;if(t>0){i.textContent=m?m.emptyScript:"";for(let s=0;s<t;s++)i.append(e[s],w()),H.nextNode(),o.push({type:2,index:++n});i.append(e[t],w())}}}else if(8===i.nodeType)if(i.data===x)o.push({type:2,index:n});else{let e=-1;for(;-1!==(e=i.data.indexOf(k,e+1));)o.push({type:7,index:n}),e+=k.length-1}n++}}static createElement(e,t){const s=E.createElement("template");return s.innerHTML=e,s}}function q(e,t,s=e,i){if(t===I)return t;let n=void 0!==i?s._$Co?.[i]:s._$Cl;const r=A(t)?void 0:t._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),void 0===r?n=void 0:(n=new r(e),n._$AT(e,s,i)),void 0!==i?(s._$Co??=[])[i]=n:s._$Cl=n),void 0!==n&&(t=q(e,n._$AS(e,t.values),n,i)),t}class W{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??E).importNode(t,!0);H.currentNode=i;let n=H.nextNode(),r=0,a=0,o=s[0];for(;void 0!==o;){if(r===o.index){let t;2===o.type?t=new G(n,n.nextSibling,this,e):1===o.type?t=new o.ctor(n,o.name,o.strings,this,e):6===o.type&&(t=new J(n,this,e)),this._$AV.push(t),o=s[++a]}r!==o?.index&&(n=H.nextNode(),r++)}return H.currentNode=E,i}p(e){let t=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class G{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=N,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=q(this,e,t),A(e)?e===N||null==e||""===e?(this._$AH!==N&&this._$AR(),this._$AH=N):e!==this._$AH&&e!==I&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>C(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==N&&A(this._$AH)?this._$AA.nextSibling.data=e:this.T(E.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i="number"==typeof s?this._$AC(e):(void 0===s.el&&(s.el=j.createElement(O(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new W(i,this),s=e.u(this.options);e.p(t),this.T(s),this._$AH=e}}_$AC(e){let t=V.get(e.strings);return void 0===t&&V.set(e.strings,t=new j(e)),t}k(e){C(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new G(this.O(w()),this.O(w()),this,this.options)):s=t[i],s._$AI(n),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=f(e).nextSibling;f(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class Y{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=N,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=N}_$AI(e,t=this,s,i){const n=this.strings;let r=!1;if(void 0===n)e=q(this,e,t,0),r=!A(e)||e!==this._$AH&&e!==I,r&&(this._$AH=e);else{const i=e;let a,o;for(e=n[0],a=0;a<n.length-1;a++)o=q(this,i[s+a],t,a),o===I&&(o=this._$AH[a]),r||=!A(o)||o!==this._$AH[a],o===N?e=N:e!==N&&(e+=(o??"")+n[a+1]),this._$AH[a]=o}r&&!i&&this.j(e)}j(e){e===N?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Q extends Y{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===N?void 0:e}}class X extends Y{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==N)}}class K extends Y{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=q(this,e,t,0)??N)===I)return;const s=this._$AH,i=e===N&&s!==N||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==N&&(s===N||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class J{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){q(this,e)}}const Z=b.litHtmlPolyfillSupport;Z?.(j,G),(b.litHtmlVersions??=[]).push("3.3.2");class ee{constructor(){this.el=null,this.state=null,this.bus=null,this.config=null,this.abortController=null}get signal(){return this.abortController.signal}connect(e,t,s,i){this.el=e,this.state=t,this.bus=s,this.config=i,this.abortController=new AbortController,this.onConnect()}disconnect(){this.abortController?.abort(),this.abortController=null,this.el=null,this.state=null,this.bus=null,this.config=null}render(){null!==this.el&&((e,t)=>{const s=t;let i=s._$litPart$;if(void 0===i){const e=null;s._$litPart$=i=new G(t.insertBefore(w(),e),e,void 0,{})}i._$AI(e)})(this.template(),this.el)}}let te=!1,se={play:'<symbol id="eb-play" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></symbol>',pause:'<symbol id="eb-pause" viewBox="0 0 24 24"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></symbol>',"volume-high":'<symbol id="eb-volume-high" viewBox="0 0 24 24"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></symbol>',"volume-low":'<symbol id="eb-volume-low" viewBox="0 0 24 24"><path d="M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z"/></symbol>',"volume-mute":'<symbol id="eb-volume-mute" viewBox="0 0 24 24"><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/></symbol>',fullscreen:'<symbol id="eb-fullscreen" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></symbol>',"fullscreen-exit":'<symbol id="eb-fullscreen-exit" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/></symbol>',settings:'<symbol id="eb-settings" viewBox="0 0 24 24"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/></symbol>',pip:'<symbol id="eb-pip" viewBox="0 0 24 24"><path d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"/></symbol>',cast:'<symbol id="eb-cast" viewBox="0 0 24 24"><path d="M1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19V7zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11zm20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/></symbol>',close:'<symbol id="eb-close" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></symbol>',share:'<symbol id="eb-share" viewBox="0 0 24 24"><path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"/></symbol>',info:'<symbol id="eb-info" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/></symbol>',speed:'<symbol id="eb-speed" viewBox="0 0 24 24"><path d="M20.38 8.57l-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44zm-9.79 6.84a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83z"/></symbol>',check:'<symbol id="eb-check" viewBox="0 0 24 24"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></symbol>',"chevron-left":'<symbol id="eb-chevron-left" viewBox="0 0 24 24"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></symbol>',"chevron-right":'<symbol id="eb-chevron-right" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></symbol>',spinner:'<symbol id="eb-spinner" viewBox="0 0 24 24"><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/></symbol>',live:'<symbol id="eb-live" viewBox="0 0 24 24"><circle cx="12" cy="12" r="8"/><path d="M4.93 4.93C3.12 6.74 2 9.24 2 12s1.12 5.26 2.93 7.07l1.41-1.41C4.9 16.22 4 14.22 4 12s.9-4.22 2.34-5.66L4.93 4.93zm14.14 0l-1.41 1.41C19.1 7.78 20 9.78 20 12s-.9 4.22-2.34 5.66l1.41 1.41C20.88 17.26 22 14.76 22 12s-1.12-5.26-2.93-7.07z"/></symbol>',"skip-forward":'<symbol id="eb-skip-forward" viewBox="0 0 24 24"><path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z"/></symbol>',"skip-back":'<symbol id="eb-skip-back" viewBox="0 0 24 24"><path d="M6 6h2v12H6zm3.5 6l8.5 6V6z"/></symbol>',"radio-bars":'<symbol id="eb-radio-bars" viewBox="0 0 24 24"><path d="M20 6H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-8 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm8-9H4V8h16v.5z"/><path d="M4 4h2v2H4zm14 0h2v2h-2z"/></symbol>',subtitle:'<symbol id="eb-subtitle" viewBox="0 0 24 24"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM4 12h2v2H4v-2zm10 6H4v-2h10v2zm6 0h-4v-2h4v2zm0-4H10v-2h10v2z"/></symbol>',audio:'<symbol id="eb-audio" viewBox="0 0 24 24"><path d="M12 3v9.28c-.47-.17-.97-.28-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7z"/></symbol>',quality:'<symbol id="eb-quality" viewBox="0 0 24 24"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 3l1.5 3h3.5l-2.86 2.08 1.08 3.34L12 12.93l-3.22 2.49 1.08-3.34L7 10h3.5L12 6z"/></symbol>'};function ie(e){if(te&&void 0===e)return;const t=(s=se,`<svg xmlns="http://www.w3.org/2000/svg" style="display:none"><defs>${Object.values(s).join("")}</defs></svg>`);var s;const i=document.getElementById("eb-sprite");if(null!==i)i.innerHTML=t;else{const e=document.createElement("div");e.id="eb-sprite",e.style.display="none",e.innerHTML=t,document.body.prepend(e)}te=!0}function ne(e,t){return z`<svg class="${"eb-icon"}" aria-hidden="true"><use href="#eb-${e}"></use></svg>`}class re extends ee{onConnect(){this.render();const{signal:e}=this;this.state.on("controlsVisible",()=>this.render(),{signal:e})}template(){const e=this.config,t=void 0!==e.logo,s=!1!==e.socials;return F`
7
+ <div class="eb-top-bar">
8
+ ${t?F`
9
+ ${void 0!==e.logoLink?F`<a class="eb-top-bar__logo-link" href="${e.logoLink}" target="_blank" rel="noopener">
10
+ <img class="eb-top-bar__logo" src="${e.logo}" alt="" />
11
+ </a>`:F`<img class="eb-top-bar__logo" src="${e.logo}" alt="" />`}
12
+ `:""}
13
+
14
+ <div class="eb-top-bar__actions">
15
+ ${s?F`<button
16
+ class="eb-button eb-top-bar__btn-share"
17
+ @click="${()=>{this.state.socialsOpen=!this.state.socialsOpen}}"
18
+ aria-label="Share"
19
+ >${ne("share")}</button>`:""}
20
+
21
+ <button
22
+ class="eb-button eb-top-bar__btn-info"
23
+ @click="${()=>{this.state.infoOpen=!this.state.infoOpen}}"
24
+ aria-label="Info"
25
+ >${ne("info")}</button>
26
+ </div>
27
+ </div>
28
+ `}}class ae extends ee{onConnect(){this.render();const{signal:e}=this;this.state.on("controlsVisible",()=>this.render(),{signal:e})}template(){return F`
29
+ <div class="eb-bottom-bar">
30
+ <div class="eb-bottom-bar__gradient"></div>
31
+ <div class="eb-bottom-bar__seekbar-zone"></div>
32
+ <div class="eb-bottom-bar__controls-row">
33
+ <div class="eb-slot-play-pause"></div>
34
+ <div class="eb-slot-volume"></div>
35
+ <div class="eb-slot-time"></div>
36
+ <div class="eb-slot-live-sync"></div>
37
+ <div class="eb-spacer"></div>
38
+ <div class="eb-slot-settings"></div>
39
+ <div class="eb-slot-pip"></div>
40
+ <div class="eb-slot-cast"></div>
41
+ <div class="eb-slot-fullscreen"></div>
42
+ </div>
43
+ </div>
44
+ `}}class oe extends ee{onConnect(){this.render();const{signal:e}=this;this.state.on("playbackState",()=>this.render(),{signal:e})}template(){const e="playing"===this.state.playbackState;return F`
45
+ <div class="eb-middle-bar">
46
+ <button
47
+ class="eb-button eb-middle-bar__play-btn"
48
+ @click="${()=>this.handleClick()}"
49
+ aria-label="${e?"Pause":"Play"}"
50
+ >
51
+ ${ne(e?"pause":"play")}
52
+ </button>
53
+ </div>
54
+ `}handleClick(){const e=this.state,t=this.bus;"playing"===e.playbackState?t.emit("pause"):t.emit("play")}}class le extends ee{onConnect(){this.state.on("playbackState",()=>this.render(),{signal:this.signal}),this.render()}template(){const e="playing"===this.state.playbackState;return F`
55
+ <button
56
+ class="eb-play-pause"
57
+ aria-label="${e?"Pause":"Play"}"
58
+ @click="${()=>this.bus.emit(e?"pause":"play")}"
59
+ >
60
+ ${ne(e?"pause":"play")}
61
+ </button>
62
+ `}}class ce extends ee{constructor(){super(...arguments),this.trackRect=null,this.onPointerMove=null,this.onPointerUp=null}onConnect(){this.state.on("volume",()=>this.render(),{signal:this.signal}),this.state.on("muted",()=>this.render(),{signal:this.signal}),this.signal.addEventListener("abort",()=>{null!==this.onPointerMove&&document.removeEventListener("pointermove",this.onPointerMove),null!==this.onPointerUp&&document.removeEventListener("pointerup",this.onPointerUp)}),this.render()}eventToVolume(e){const t=(e-this.trackRect.left)/this.trackRect.width;return Math.min(1,Math.max(0,t))}handlePointerDown(e){const t=e.currentTarget;this.trackRect=t.getBoundingClientRect(),this.onPointerMove=e=>{this.state.volume=this.eventToVolume(e.clientX)},this.onPointerUp=e=>{this.state.volume=this.eventToVolume(e.clientX),document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),this.onPointerMove=null,this.onPointerUp=null,this.trackRect=null},document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp)}getVolumeIcon(){return this.state.muted||0===this.state.volume?"volume-mute":this.state.volume<.5?"volume-low":"volume-high"}template(){const e=this.state.muted?0:this.state.volume,t=`${Math.round(100*e)}%`,s=this.getVolumeIcon();return F`
63
+ <div class="eb-volume-control">
64
+ <button
65
+ class="eb-volume-mute"
66
+ aria-label="${this.state.muted?"Unmute":"Mute"}"
67
+ @click="${()=>this.bus.emit("mute-toggle")}"
68
+ >
69
+ ${ne(s)}
70
+ </button>
71
+ <div
72
+ class="eb-volume-track"
73
+ @pointerdown="${e=>this.handlePointerDown(e)}"
74
+ >
75
+ <div class="eb-volume-fill" style="width: ${t}"></div>
76
+ <div class="eb-volume-thumb" style="left: ${t}"></div>
77
+ </div>
78
+ </div>
79
+ `}}function he(e){if(!Number.isFinite(e)||e<0)return"0:00";const t=Math.floor(e),s=Math.floor(t/3600),i=Math.floor(t%3600/60),n=String(t%60).padStart(2,"0");if(s>0){return`${s}:${String(i).padStart(2,"0")}:${n}`}return`${i}:${n}`}class de extends ee{constructor(){super(...arguments),this.rafPending=!1}onConnect(){this.state.on("currentTime",()=>this.scheduleRender(),{signal:this.signal}),this.state.on("duration",()=>this.scheduleRender(),{signal:this.signal}),this.state.on("isLive",()=>this.scheduleRender(),{signal:this.signal}),this.state.on("isSyncWithLive",()=>this.scheduleRender(),{signal:this.signal}),this.render()}scheduleRender(){this.rafPending||(this.rafPending=!0,requestAnimationFrame(()=>{this.rafPending=!1,this.render()}))}template(){const{currentTime:e,duration:t,isLive:s,isSyncWithLive:i}=this.state;let n;if(s)if(i)n="Live";else{n=`-${he(t-e)}`}else n=`${he(e)} / ${he(t)}`;return F`<div class="eb-time-display">${n}</div>`}}class ue extends ee{onConnect(){this.state.on("isLive",()=>this.render(),{signal:this.signal}),this.state.on("isSyncWithLive",()=>this.render(),{signal:this.signal}),this.render()}template(){const{isLive:e,isSyncWithLive:t}=this.state;return e?F`
80
+ <button
81
+ class="${t?"eb-live-sync eb-live-synced":"eb-live-sync"}"
82
+ aria-label="Go to live"
83
+ @click="${()=>this.bus.emit("sync-live")}"
84
+ >
85
+ ${ne("live")}
86
+ </button>
87
+ `:F`<button class="eb-live-sync" hidden style="display:none">${ne("live")}</button>`}}const pe=[.25,.5,.75,1,1.25,1.5,1.75,2];class ge extends ee{constructor(){super(...arguments),this.mode="root"}onConnect(){this.state.on("settingsOpen",()=>{this.state.settingsOpen||(this.mode="root"),this.render()},{signal:this.signal}),this.state.on("qualityLevels",()=>this.render(),{signal:this.signal}),this.state.on("currentQuality",()=>this.render(),{signal:this.signal}),this.state.on("audioTracks",()=>this.render(),{signal:this.signal}),this.state.on("currentAudioTrack",()=>this.render(),{signal:this.signal}),this.state.on("subtitleTracks",()=>this.render(),{signal:this.signal}),this.state.on("currentSubtitleTrack",()=>this.render(),{signal:this.signal}),this.state.on("playbackRate",()=>this.render(),{signal:this.signal}),this.render()}navigateTo(e){this.mode=e,this.render()}navigateBack(){this.mode="root",this.render()}renderRootMenu(){const e=this.state.qualityLevels,t=this.state.audioTracks,s=this.state.subtitleTracks,i=e.length>0,n=!0===this.config.speed,r=t.length>1,a=s.length>0;return F`
88
+ <ul class="eb-settings-menu eb-settings-root">
89
+ ${i?F`
90
+ <li>
91
+ <button class="eb-settings-category" @click="${()=>this.navigateTo("quality")}">
92
+ Quality
93
+ </button>
94
+ </li>
95
+ `:""}
96
+ ${n?F`
97
+ <li>
98
+ <button class="eb-settings-category" @click="${()=>this.navigateTo("speed")}">
99
+ Speed
100
+ </button>
101
+ </li>
102
+ `:""}
103
+ ${r?F`
104
+ <li>
105
+ <button class="eb-settings-category" @click="${()=>this.navigateTo("audio")}">
106
+ Audio
107
+ </button>
108
+ </li>
109
+ `:""}
110
+ ${a?F`
111
+ <li>
112
+ <button class="eb-settings-category" @click="${()=>this.navigateTo("subtitles")}">
113
+ Subtitles
114
+ </button>
115
+ </li>
116
+ `:""}
117
+ </ul>
118
+ `}renderSubMenu(e,t,s){return F`
119
+ <div class="eb-settings-submenu">
120
+ <button class="eb-settings-back" @click="${()=>this.navigateBack()}">
121
+ ${e}
122
+ </button>
123
+ <ul class="eb-settings-menu">
124
+ ${t.map(e=>F`
125
+ <li>
126
+ <button
127
+ class="eb-settings-item ${e.selected?"eb-settings-item--selected":""}"
128
+ @click="${()=>s(e)}"
129
+ >
130
+ ${e.label}
131
+ </button>
132
+ </li>
133
+ `)}
134
+ </ul>
135
+ </div>
136
+ `}renderQualityMenu(){const e=function(e,t){const s=e.map((e,s)=>({label:e.height?`${e.height}p`:`${Math.round((e.bitrate??0)/1e3)} kbps`,value:s,selected:s===t}));return s.push({label:"Auto",value:-1,selected:-1===t}),s}(this.state.qualityLevels,this.state.currentQuality);return this.renderSubMenu("Quality",e,e=>{this.bus.emit("settings-select-quality",{index:e.value})})}renderSpeedMenu(){const e=function(e){return pe.map(t=>({label:1===t?"Normal":`${t}x`,value:t,selected:t===e}))}(this.state.playbackRate);return this.renderSubMenu("Speed",e,e=>{this.bus.emit("settings-select-speed",{rate:e.value})})}renderAudioMenu(){const e=function(e,t){return e.map((e,s)=>({label:e.name||e.lang||`Track ${s}`,value:s,selected:s===t}))}(this.state.audioTracks,this.state.currentAudioTrack);return this.renderSubMenu("Audio",e,e=>{this.bus.emit("settings-select-audio",{index:e.value})})}renderSubtitlesMenu(){const e=function(e,t){const s=e.map((e,s)=>({label:e.name||e.lang||`Track ${s}`,value:s,selected:s===t}));return s.push({label:"Off",value:-1,selected:-1===t}),s}(this.state.subtitleTracks,this.state.currentSubtitleTrack);return this.renderSubMenu("Subtitles",e,e=>{this.bus.emit("settings-select-subtitle",{index:e.value})})}template(){if(!this.state.settingsOpen)return F`<div class="eb-settings-panel" hidden aria-hidden="true"></div>`;let e;return e="quality"===this.mode?this.renderQualityMenu():"speed"===this.mode?this.renderSpeedMenu():"audio"===this.mode?this.renderAudioMenu():"subtitles"===this.mode?this.renderSubtitlesMenu():this.renderRootMenu(),F`
137
+ <div class="eb-settings-panel">
138
+ ${e}
139
+ </div>
140
+ `}}class be extends ee{constructor(){super(...arguments),this.pipEnabled=!1,this.videoEl=null,this.enterHandler=null,this.leaveHandler=null}onConnect(){this.pipEnabled=!0===this.config.pip&&!0===document.pictureInPictureEnabled,this.pipEnabled&&(this.videoEl=this.el.querySelector("video"),null!==this.videoEl&&(this.enterHandler=()=>{this.state.isPip=!0},this.leaveHandler=()=>{this.state.isPip=!1},this.videoEl.addEventListener("enterpictureinpicture",this.enterHandler),this.videoEl.addEventListener("leavepictureinpicture",this.leaveHandler),this.signal.addEventListener("abort",()=>{this.videoEl.removeEventListener("enterpictureinpicture",this.enterHandler),this.videoEl.removeEventListener("leavepictureinpicture",this.leaveHandler),this.enterHandler=null,this.leaveHandler=null,this.videoEl=null}))),this.state.on("isPip",()=>this.render(),{signal:this.signal}),this.render()}handleClick(){if(this.state.isPip)document.exitPictureInPicture();else{const e=this.el.querySelector("video");null!==e&&e.requestPictureInPicture()}}template(){if(!this.pipEnabled)return F`<button class="eb-pip" hidden aria-hidden="true">${ne("pip")}</button>`;const e=this.state.isPip?"Exit picture-in-picture":"Picture-in-picture";return F`
141
+ <button
142
+ class="${this.state.isPip?"eb-pip eb-pip-active":"eb-pip"}"
143
+ aria-label="${e}"
144
+ @click="${()=>this.handleClick()}"
145
+ >
146
+ ${ne("pip")}
147
+ </button>
148
+ `}}class fe extends ee{onConnect(){this.state.on("castAvailable",()=>this.render(),{signal:this.signal}),this.state.on("isCasting",()=>this.render(),{signal:this.signal}),this.render()}template(){const{castAvailable:e,isCasting:t,src:s}=this.state;return e?F`
149
+ <button
150
+ class="${t?"eb-cast eb-cast-active":"eb-cast"}"
151
+ aria-label="${t?"Stop casting":"Cast"}"
152
+ @click="${()=>this.bus.emit("cast-start",{src:s})}"
153
+ >
154
+ ${ne("cast")}
155
+ </button>
156
+ `:F`<button class="eb-cast" hidden aria-hidden="true">${ne("cast")}</button>`}}const me=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],ve=(()=>{if("undefined"==typeof document)return!1;const e=me[0],t={};for(const s of me){const i=s?.[1];if(i in document){for(const[i,n]of s.entries())t[e[i]]=n;return t}}return!1})(),ye={change:ve.fullscreenchange,error:ve.fullscreenerror};let ke={request:(e=document.documentElement,t)=>new Promise((s,i)=>{const n=()=>{ke.off("change",n),s()};ke.on("change",n);const r=e[ve.requestFullscreen](t);r instanceof Promise&&r.then(n).catch(i)}),exit:()=>new Promise((e,t)=>{if(!ke.isFullscreen)return void e();const s=()=>{ke.off("change",s),e()};ke.on("change",s);const i=document[ve.exitFullscreen]();i instanceof Promise&&i.then(s).catch(t)}),toggle:(e,t)=>ke.isFullscreen?ke.exit():ke.request(e,t),onchange(e){ke.on("change",e)},onerror(e){ke.on("error",e)},on(e,t){const s=ye[e];s&&document.addEventListener(s,t,!1)},off(e,t){const s=ye[e];s&&document.removeEventListener(s,t,!1)},raw:ve};Object.defineProperties(ke,{isFullscreen:{get:()=>Boolean(document[ve.fullscreenElement])},element:{enumerable:!0,get:()=>document[ve.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[ve.fullscreenEnabled])}}),ve||(ke={isEnabled:!1});var xe=ke;class Le extends ee{constructor(){super(...arguments),this.changeHandler=null}onConnect(){this.state.on("isFullscreen",()=>this.render(),{signal:this.signal}),xe.isEnabled&&(this.changeHandler=()=>{this.state.isFullscreen=xe.isFullscreen,this.render()},xe.on("change",this.changeHandler),this.signal.addEventListener("abort",()=>{xe.off("change",this.changeHandler),this.changeHandler=null})),this.render()}handleClick(){if(!xe.isEnabled)return;const e=this.el.closest(".eb-player")??this.el;xe.toggle(e)}template(){if(!xe.isEnabled)return F`<button class="eb-fullscreen" hidden aria-hidden="true">${ne("fullscreen")}</button>`;const e=this.state.isFullscreen;return F`
157
+ <button
158
+ class="eb-fullscreen"
159
+ aria-label="${e?"Exit fullscreen":"Fullscreen"}"
160
+ @click="${()=>this.handleClick()}"
161
+ >
162
+ ${ne(e?"fullscreen-exit":"fullscreen")}
163
+ </button>
164
+ `}}class Ee extends ee{constructor(){super(...arguments),this.isDragging=!1,this.dragValue=0,this.rafPending=!1,this.tooltipVisible=!1,this.tooltipTime=0,this.tooltipX=0,this.previewVideoEl=null}onConnect(){this.state.on("currentTime",()=>this.scheduleRender(),{signal:this.signal}),this.state.on("duration",()=>this.scheduleRender(),{signal:this.signal}),this.state.on("bufferedEnd",()=>this.scheduleRender(),{signal:this.signal}),this.state.on("isRtl",()=>this.scheduleRender(),{signal:this.signal}),this.state.on("adPlaying",()=>this.scheduleRender(),{signal:this.signal}),this.state.on("chapters",()=>this.scheduleRender(),{signal:this.signal}),this.state.on("epgPrograms",()=>this.scheduleRender(),{signal:this.signal}),this.render()}scheduleRender(){this.rafPending||(this.rafPending=!0,requestAnimationFrame(()=>{this.rafPending=!1,this.render()}))}eventToTime(e,t){const s=t.getBoundingClientRect(),i=(e.clientX-s.left)/s.width,n=this.state.isRtl?1-i:i;return Math.min(1,Math.max(0,n))*this.state.duration}handlePointerDown(e){if(this.state.adPlaying)return;const t=e.currentTarget;"function"==typeof t.setPointerCapture&&t.setPointerCapture(e.pointerId),this.isDragging=!0,this.dragValue=this.eventToTime(e,t),this.render()}handlePointerMove(e){if(this.isDragging){const t=e.currentTarget;this.dragValue=this.eventToTime(e,t),this.scheduleRender()}this.updateTooltip(e)}handlePointerUp(e){if(!this.isDragging)return;const t=e.currentTarget,s=this.eventToTime(e,t);this.isDragging=!1,this.bus.emit("seek",{time:s}),this.render()}handlePointerLeave(){this.tooltipVisible=!1,this.render()}updateTooltip(e){const t=e.currentTarget.getBoundingClientRect(),s=(e.clientX-t.left)/t.width,i=Math.min(1,Math.max(0,s));this.tooltipTime=this.state.isRtl?(1-i)*this.state.duration:i*this.state.duration,this.tooltipX=Math.min(t.width,Math.max(0,e.clientX-t.left)),this.tooltipVisible=!0,this.config.showProgressThumb&&null===this.previewVideoEl&&(this.previewVideoEl=document.createElement("video"),this.previewVideoEl.className="eb-seekbar-preview",this.previewVideoEl.muted=!0),this.render()}findActiveChapter(e){const t=this.state.currentTime;for(const s of e)if(t>=s.startTime&&t<=s.endTime)return s;return null}findSkippableChapter(e){const t=this.config.skippableChapters;for(const s of t)if(s.chapter===e.title)return s;return null}renderEpgSegments(e){if(0===e.length)return[];const t=e[0].start,s=e[e.length-1].end-t;if(s<=0)return[];const i=Date.now();return e.map(e=>{const n=(e.start-t)/s*100,r=(e.end-e.start)/s*100,a=i>=e.start&&i<e.end;return F`
165
+ <div
166
+ class="eb-epg-segment${a?" eb-epg-current":""}"
167
+ style="left: ${n.toFixed(2)}%; width: ${r.toFixed(2)}%"
168
+ title="${e.title}"
169
+ ></div>
170
+ `})}template(){const{currentTime:e,duration:t,bufferedEnd:s,adPlaying:i,chapters:n,epgPrograms:r}=this.state,a=!this.config.seekbar,o=i,l=t>0?(this.isDragging?this.dragValue:e)/t*100:0,c=t>0?s/t*100:0,h=this.findActiveChapter(n),d=null!==h?this.findSkippableChapter(h):null,u=n.map(e=>{const s=t>0?e.startTime/t*100:0;return F`
171
+ <div
172
+ class="eb-chapter-marker${e===h?" eb-chapter-active":""}"
173
+ style="left: ${s.toFixed(2)}%"
174
+ title="${e.title}"
175
+ ></div>
176
+ `}),p=null!==h&&null!==d?F`
177
+ <button
178
+ class="eb-chapter-skip"
179
+ @click="${()=>this.bus.emit("seek",{time:h.endTime})}"
180
+ >${d.message}</button>
181
+ `:F``,g=this.renderEpgSegments(r),b=F`
182
+ <div
183
+ class="eb-seekbar-tooltip"
184
+ style="left: ${this.tooltipX}px"
185
+ ?hidden="${!this.tooltipVisible}"
186
+ >
187
+ ${he(this.tooltipTime)}
188
+ ${this.config.showProgressThumb&&null!==this.previewVideoEl?this.previewVideoEl:F``}
189
+ </div>
190
+ `;return F`
191
+ <div
192
+ class="eb-seekbar${o?" eb-seekbar-disabled":""}"
193
+ ?hidden="${a}"
194
+ >
195
+ <div
196
+ class="eb-seekbar-track"
197
+ @pointerdown="${e=>this.handlePointerDown(e)}"
198
+ @pointermove="${e=>this.handlePointerMove(e)}"
199
+ @pointerup="${e=>this.handlePointerUp(e)}"
200
+ @pointerleave="${()=>this.handlePointerLeave()}"
201
+ >
202
+ <div class="eb-seekbar-buffered" style="width: ${c.toFixed(2)}%"></div>
203
+ <div class="eb-seekbar-progress" style="width: ${l.toFixed(2)}%">
204
+ <div class="eb-seekbar-thumb"></div>
205
+ </div>
206
+ ${u}
207
+ ${g}
208
+ ${b}
209
+ </div>
210
+ ${p}
211
+ </div>
212
+ `}}class we extends ee{onConnect(){this.state.on("playbackState",()=>this.render(),{signal:this.signal}),this.render()}template(){return"buffering"===this.state.playbackState?F`<div class="eb-loading" role="status" aria-label="Loading">${ne("spinner")}</div>`:F`<div class="eb-loading" hidden aria-hidden="true">${ne("spinner")}</div>`}}class Ae extends ee{onConnect(){this.state.on("error",()=>this.render(),{signal:this.signal}),this.render()}template(){const e=this.state.error;return null===e?F`<div class="eb-error" hidden aria-hidden="true"></div>`:F`
213
+ <div class="eb-error" role="alert">
214
+ <p class="eb-error-message">${e}</p>
215
+ <button
216
+ class="eb-error-retry"
217
+ @click="${()=>this.bus.emit("request-reload")}"
218
+ >
219
+ Retry
220
+ </button>
221
+ </div>
222
+ `}}class Ce extends ee{onConnect(){this.state.on("socialsOpen",()=>this.render(),{signal:this.signal}),this.render()}template(){if(!this.state.socialsOpen)return F`<div class="eb-socials-overlay" hidden aria-hidden="true"></div>`;const e=this.config.socials,t=!1!==e?Object.entries(e).map(([e,t])=>F`
223
+ <a
224
+ class="eb-socials-link eb-socials-link--${e}"
225
+ href="${t}"
226
+ target="_blank"
227
+ rel="noopener noreferrer"
228
+ >
229
+ ${e}
230
+ </a>
231
+ `):[];return F`
232
+ <div class="eb-socials-overlay" role="dialog" aria-label="Share">
233
+ <div class="eb-socials-links">
234
+ ${t}
235
+ </div>
236
+ <button
237
+ class="eb-socials-close"
238
+ aria-label="Close"
239
+ @click="${()=>{this.state.socialsOpen=!1}}"
240
+ >
241
+ Close
242
+ </button>
243
+ </div>
244
+ `}}class Te extends ee{onConnect(){this.state.on("infoOpen",()=>this.render(),{signal:this.signal}),this.render()}template(){if(!this.state.infoOpen)return F`<div class="eb-info-overlay" hidden aria-hidden="true"></div>`;const e=this.config.about;return F`
245
+ <div class="eb-info-overlay" role="dialog" aria-label="About">
246
+ <div class="eb-info-content">${e}</div>
247
+ <button
248
+ class="eb-info-close"
249
+ aria-label="Close"
250
+ @click="${()=>{this.state.infoOpen=!1}}"
251
+ >
252
+ Close
253
+ </button>
254
+ </div>
255
+ `}}class $e extends ee{constructor(){super(...arguments),this.videoElement=null,this.adsContainerElement=null,this.extensionCleanups=[],this.childComponents=[]}getVideoElement(){return this.videoElement}getAdsContainer(){return this.adsContainerElement}onConnect(){ie(),this.render(),this.bindElementRefs(),this.connectChildComponents(),this.subscribeToState(),this.invokeExtensions()}template(){const e=this.config,t=this.state;if(e.noUi)return this.renderNoUiTemplate();const s=t.isRtl,i=t.isIOS,n=e.middlebar,r=!1!==e.image&&"idle"===t.playbackState,a=t.isRadio;return F`
256
+ <div
257
+ class="eb-player${i?" eb-ios-native":""}"
258
+ dir="${s?"rtl":""}"
259
+ >
260
+ <video
261
+ class="eb-video"
262
+ playsinline
263
+ ?muted="${e.muted}"
264
+ ?autoplay="${e.autoplay}"
265
+ ?controls="${i}"
266
+ ></video>
267
+
268
+ <div class="eb-overlay-zone">
269
+ ${!1!==e.image?F`<img
270
+ class="eb-poster"
271
+ src="${e.image}"
272
+ style="${r?"":"display:none"}"
273
+ alt=""
274
+ />`:""}
275
+ ${a?F`<div class="eb-radio-overlay">
276
+ <div class="eb-radio-bars">
277
+ <span class="eb-radio-bar"></span>
278
+ <span class="eb-radio-bar"></span>
279
+ <span class="eb-radio-bar"></span>
280
+ <span class="eb-radio-bar"></span>
281
+ <span class="eb-radio-bar"></span>
282
+ </div>
283
+ </div>`:""}
284
+ </div>
285
+
286
+ <div class="eb-ads-container"></div>
287
+
288
+ <div class="eb-top-bar-zone">
289
+ ${void 0!==e.logo?F`<img class="eb-logo" src="${e.logo}" alt="" />`:""}
290
+ </div>
291
+
292
+ ${n?F`<div class="eb-middle-bar-zone"></div>`:""}
293
+
294
+ <div class="eb-bottom-bar-zone"></div>
295
+
296
+ <div class="eb-extension-top-extra"></div>
297
+ <div class="eb-extension-bottom-extra"></div>
298
+ <div class="eb-extension-overlay"></div>
299
+ <div class="eb-extension-controls-extra"></div>
300
+ </div>
301
+ `}connectChildComponents(){const e=this.config;if(e.noUi)return;const t=this.el?.firstElementChild;if(null==t)return;const s=this.state,i=this.bus,n=(n,r)=>{const a=t.querySelector(r);return null!==a&&(n.connect(a,s,i,e),this.childComponents.push(n),!0)};n(new re,".eb-top-bar-zone");if(n(new ae,".eb-bottom-bar-zone")){const n=t.querySelector(".eb-bottom-bar-zone");if(null!==n){const t=(t,r)=>{const a=n.querySelector(r);null!==a&&(t.connect(a,s,i,e),this.childComponents.push(t))};t(new Ee,".eb-bottom-bar__seekbar-zone"),t(new le,".eb-slot-play-pause"),t(new ce,".eb-slot-volume"),t(new de,".eb-slot-time"),t(new ue,".eb-slot-live-sync"),t(new ge,".eb-slot-settings"),t(new be,".eb-slot-pip"),t(new fe,".eb-slot-cast"),t(new Le,".eb-slot-fullscreen")}}e.middlebar&&n(new oe,".eb-middle-bar-zone");const r=t.querySelector(".eb-overlay-zone");if(null!==r){const t=[[new we,"eb-loading-slot"],[new Ae,"eb-error-slot"],[new Ce,"eb-socials-slot"],[new Te,"eb-info-slot"]];for(const[n,a]of t){const t=document.createElement("div");t.className=a,r.appendChild(t),n.connect(t,s,i,e),this.childComponents.push(n)}}}renderNoUiTemplate(){const e=this.config;return F`
302
+ <div class="eb-player">
303
+ <video
304
+ class="eb-video"
305
+ playsinline
306
+ ?muted="${e.muted}"
307
+ ?autoplay="${e.autoplay}"
308
+ ></video>
309
+ </div>
310
+ `}bindElementRefs(){const e=this.el?.firstElementChild;this.videoElement=null!==e?e.querySelector("video"):null,this.adsContainerElement=null!==e?e.querySelector(".eb-ads-container"):null}subscribeToState(){const e=this.state,{signal:t}=this;e.on("isRtl",()=>{this.applyRtl()},{signal:t}),e.on("isIOS",()=>{this.render(),this.bindElementRefs()},{signal:t}),e.on("playbackState",()=>{this.render()},{signal:t}),e.on("isRadio",()=>{this.render()},{signal:t})}applyRtl(){const e=this.el?.firstElementChild;if(null==e)return;this.state.isRtl?e.setAttribute("dir","rtl"):e.removeAttribute("dir")}invokeExtensions(){const e=this.config.extensions;if(void 0===e)return;const t=this.el?.firstElementChild;if(null==t)return;const s={"top-extra":".eb-extension-top-extra","bottom-extra":".eb-extension-bottom-extra",overlay:".eb-extension-overlay","controls-extra":".eb-extension-controls-extra"};for(const[i,n]of Object.entries(e)){const e=s[i];if(void 0===e)continue;const r=t.querySelector(e);if(null===r)continue;const a=n(r,this.state,this.bus,this.signal);"function"==typeof a&&this.extensionCleanups.push(a)}}disconnect(){for(const e of this.childComponents)e.disconnect();this.childComponents=[];for(const e of this.extensionCleanups)e();this.extensionCleanups=[],this.videoElement=null,this.adsContainerElement=null,super.disconnect()}}class _e{constructor(e,t,s){this.timer=0,this.state=t,this.container=e,this.onActivity=()=>this.show(),e.addEventListener("pointermove",this.onActivity),e.addEventListener("touchstart",this.onActivity),e.addEventListener("keyup",this.onActivity),s.addEventListener("abort",()=>{this.container.removeEventListener("pointermove",this.onActivity),this.container.removeEventListener("touchstart",this.onActivity),this.container.removeEventListener("keyup",this.onActivity),clearTimeout(this.timer),this.timer=0},{once:!0}),this.show()}show(){this.state.controlsVisible=!0,clearTimeout(this.timer),this.timer=setTimeout(()=>{this.hide()},3e3)}hide(){this.state.settingsOpen||this.state.socialsOpen||this.state.infoOpen||this.state.adPlaying||(this.state.controlsVisible=!1)}}class Se{constructor(e,t,s,i,n){e.tabIndex<0&&(e.tabIndex=0);const r=e=>{const n=e;if(!t.adPlaying){if(" "===n.key)return n.preventDefault(),void("playing"===t.playbackState?s.emit("pause"):s.emit("play"));if(i.supportHotKeys)if("m"!==n.key){if("ArrowLeft"===n.key){const e=Math.max(t.currentTime-15,0);return void s.emit("seek",{time:e})}if("ArrowRight"===n.key){const e=Math.min(t.currentTime+15,t.duration);return void s.emit("seek",{time:e})}}else s.emit("mute-toggle")}};e.addEventListener("keyup",r),n.addEventListener("abort",()=>{e.removeEventListener("keyup",r)},{once:!0})}}function Me(e,t,s={}){const i=window;if(void 0!==i[t])return Promise.resolve(i[t]);const n=s.timeout??1e4;return new Promise((s,r)=>{let a;const o=()=>{clearTimeout(a)},l=document.createElement("script");l.src=e,l.onload=()=>{o();const n=i[t];void 0===n?r(new Error(`CDN: '${t}' not on window after loading ${e}`)):s(n)},l.onerror=()=>{o(),r(new Error(`CDN: failed to load ${e}`))},a=setTimeout(()=>{r(new Error(`CDN: timeout loading ${e}`))},n),document.head.appendChild(l)})}let Pe=null;class Re{constructor(e){this.localDriver=null,this.signal=e.signal}async init(e,t,s){if(!e.chromecast)return;const i=await Me(e.chromecast,"Castjs");null===Pe&&(Pe=new i({receiver:e.chromecastApp??"00197684"})),this.localDriver=Pe,this.applyMetadata(e.chromecastMetadata),this.bindDriverEvents(t,s),this.registerAbortCleanup()}toggleCast(e){const t=this.localDriver;if(null!==t)if(t.connected)t.disconnect();else if(e.castAvailable){const s=this.buildCastOptions(e);t.cast(e.src??"",s)}}applyMetadata(e){if(void 0===e||null===this.localDriver)return;const t=this.localDriver;void 0!==e.title&&(t.title=e.title),void 0!==e.description&&(t.description=e.description),void 0!==e.poster&&(t.poster=e.poster)}bindDriverEvents(e,t){const s=this.localDriver;s.on("available",()=>{e.castAvailable=!0}),s.on("connect",()=>{e.isCasting=!0}),s.on("disconnect",()=>{e.isCasting=!1,t.emit("cast-stop")})}buildCastOptions(e){const t=this.localDriver;return{title:t?.title,description:t?.description,poster:e.image}}registerAbortCleanup(){this.signal.addEventListener("abort",()=>{const e=this.localDriver;null!==e&&e.connected&&e.disconnect(),this.localDriver=null},{once:!0})}}class Be{constructor(){this.pollTimer=null}async start(e,t,s){void 0!==e.epgContentId&&(await this.fetchEpg(e,t),null!==e.epgPolling&&void 0!==e.epgPolling&&(this.pollTimer=setInterval(()=>{this.fetchEpg(e,t)},e.epgPolling),s.addEventListener("abort",()=>{clearInterval(this.pollTimer),this.pollTimer=null},{once:!0})))}async fetchEpg(e,t){const s=`https://epg.dev.easybroadcast.io/channels/${e.epgContentId}/last-24-h-programs`;try{const e=await fetch(s,{mode:"cors"});if(!e.ok)throw new Error(`EPG fetch failed with status: ${e.status}`);const i=await e.json();t.epgPrograms=i,t.epgFetchedAt=Date.now()}catch(e){console.error("EBPlayer: Error fetching EPG data:",e)}}}class De{init(e,t,s,i){const n=e.playlist;n&&0!==n.length&&(t.playlist=n,t.currentEpisode=0,s.on("playlist-next",()=>{this.advance(t,1)},{signal:i}),s.on("playlist-prev",()=>{this.advance(t,-1)},{signal:i}))}advance(e,t){const s=e.playlist.length,i=(e.currentEpisode+t+s)%s;e.currentEpisode=i,e.src=e.playlist[i].src}}class Fe{constructor(){this.imaAdsManager=null,this.imaDisplayContainer=null}async init(e,t,s,i,n,r){if(!e.preroll)return;if(!e.autoplay&&(await this.waitForUserGesture(i,r),r.aborted))return;const a=await Me("https://imasdk.googleapis.com/js/sdkloader/ima3.js","google"),{ima:o}=a,l=new o.AdDisplayContainer(n,i);this.imaDisplayContainer=l,l.initialize();const c=new o.AdsLoader(l);c.addEventListener(o.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e=>{const n=e.getAdsManager(i);this.imaAdsManager=n;const{width:r,height:a}=i.getBoundingClientRect?i.getBoundingClientRect():{width:640,height:360};n.addEventListener(o.AdEvent.Type.CONTENT_PAUSE_REQUESTED,()=>{t.adPlaying=!0}),n.addEventListener(o.AdEvent.Type.CONTENT_RESUME_REQUESTED,()=>{t.adPlaying=!1,i.play()}),n.addEventListener(o.AdEvent.Type.ALL_ADS_COMPLETED,()=>{t.adPlaying=!1,s.emit("ad-complete")}),n.init(r,a),n.start()});const h=new o.AdsRequest;h.adTagUrl=e.preroll,c.requestAds(h),r.addEventListener("abort",()=>{null!==this.imaAdsManager&&(this.imaAdsManager.destroy(),this.imaAdsManager=null),null!==this.imaDisplayContainer&&(this.imaDisplayContainer.destroy(),this.imaDisplayContainer=null)},{once:!0})}waitForUserGesture(e,t){return new Promise(s=>{const i=()=>{e.removeEventListener("click",i),s()};e.addEventListener("click",i),t.addEventListener("abort",()=>{e.removeEventListener("click",i),s()},{once:!0})})}}class ze{get signal(){return this.abortController.signal}get container(){return this._container}constructor(e){this.config=h(o,e),this.state=r(),this.bus=new a,this.i18n=new g(this.config.lang),this.abortController=new AbortController,this._container=null,this.engineSync=null,this.skinRoot=null}mount(e){this._container=e,this.config.skin&&"default"!==this.config.skin&&e.setAttribute("data-theme",this.config.skin);const t=this.config.skinColors;if(this.config.primaryColor&&e.style.setProperty("--eb-color-primary",this.config.primaryColor),t?.general&&e.style.setProperty("--eb-color-primary",t.general),t?.progressBar&&e.style.setProperty("--eb-color-progress",t.progressBar),t?.volumeBar&&e.style.setProperty("--eb-color-volume",t.volumeBar),this.state.isRtl="ar"===this.config.lang,this.state.isRadio=!0===this.config.radio,!this.config.noUi){const t=new $e;this.skinRoot=t,t.connect(e,this.state,this.bus,this.config),new _e(e,this.state,this.signal),new Se(e,this.state,this.bus,this.config,this.signal)}this.initIntegrations()}setEngineSync(e){null!==this.engineSync&&this.engineSync.detach(),this.engineSync=e,e.attach(this.state,this.signal)}dispose(){null!==this.engineSync&&(this.engineSync.detach(),this.engineSync=null),this.bus.dispose(),this.abortController.abort(),null!==this.skinRoot&&(this.skinRoot.disconnect(),this.skinRoot=null),this._container=null,this.abortController=new AbortController}initIntegrations(){const{config:e,state:t,bus:s,signal:i}=this;if(e.chromecast){new Re(this.abortController).init(e,t,s).catch(e=>{console.error("EBPlayer: ChromecastManager init failed:",e)})}if(e.epgContentId){(new Be).start(e,t,i).catch(e=>{console.error("EBPlayer: EpgManager start failed:",e)})}const n=e.playlist;if(n&&n.length>0){(new De).init(e,t,s,i)}if(e.preroll&&null!==this.skinRoot){const n=new Fe,r=this.skinRoot.getVideoElement(),a=this.skinRoot.getAdsContainer();null!==r&&null!==a&&n.init(e,t,s,r,a,i).catch(e=>{console.error("EBPlayer: AdsManager init failed:",e)})}}}class Ie{}class Ne{constructor(e){this.intervalId=null,this.lastTime=null,this.stallAttempts=0,this.video=e.video,this.onRecoverAttempt=e.onRecoverAttempt,this.onReloadRequired=e.onReloadRequired,this.isCasting=e.isCasting}start(){this.stop(),this.intervalId=setInterval(()=>{this.tick()},1e4)}stop(){null!==this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.lastTime=null,this.stallAttempts=0}tick(){if(this.video.paused||this.isCasting())return void(this.lastTime=null);const e=this.video.currentTime;null!==this.lastTime&&e===this.lastTime?(this.stallAttempts+=1,this.stallAttempts<=2?this.onRecoverAttempt(this.stallAttempts):(this.onReloadRequired(),this.stop())):(this.stallAttempts=0,this.lastTime=e)}}class Ve extends Ie{constructor(){super(...arguments),this.video=null,this.state=null,this.signal=null,this.bus=null,this.config=null,this.watchdog=null}attach(e,t){this.state=e,this.signal=t,this.onAttach()}detach(){this.watchdog?.stop(),this.watchdog=null,this.onDetach(),this.video=null,this.state=null,this.signal=null,this.bus=null,this.config=null}startWatchdog(){if(!this.video||!this.bus)return;const e=this.bus;this.watchdog=new Ne({video:this.video,onRecoverAttempt:e=>{this.recoverFromStall(e)},onReloadRequired:()=>{e.emit("request-reload")},isCasting:()=>this.state?.isCasting??!1}),this.watchdog.start()}stopWatchdog(){this.watchdog?.stop(),this.watchdog=null}setConfig(e){this.config=e}setBus(e){this.bus=e}setVideo(e){this.video=e}bindVideoEvents(e,t,s){e.addEventListener("timeupdate",()=>{t.currentTime=Math.round(e.currentTime)},{signal:s}),e.addEventListener("durationchange",()=>{t.duration=Math.ceil(e.duration)},{signal:s}),e.addEventListener("volumechange",()=>{t.volume=e.volume,t.muted=e.muted},{signal:s}),e.addEventListener("progress",()=>{e.buffered.length>0&&(t.bufferedEnd=e.buffered.end(e.buffered.length-1))},{signal:s}),e.addEventListener("ratechange",()=>{t.playbackRate=e.playbackRate},{signal:s}),e.addEventListener("playing",()=>{t.playbackState="playing"},{signal:s}),e.addEventListener("pause",()=>{t.playbackState="paused"},{signal:s}),e.addEventListener("waiting",()=>{t.playbackState="buffering"},{signal:s}),e.addEventListener("ended",()=>{t.playbackState="ended"},{signal:s})}}const He=Object.freeze({EASY_B:"easy_b",BUNNY:"bunny",AKAMAI:"akamai",VENOM:"venom"}),Oe=Object.freeze({UNKNOWN:"unknown",MAX_RETRY:"max_retry",FORBIDDEN:"forbidden"});class Ue extends Error{constructor({status:e="unknown",errorCode:t="unknown",errorType:s=Oe.UNKNOWN,message:i=null}){super(i??`TokenError: ${e} - ${t}`),this.status=e,this.errorCode=t,this.errorType=s}}class je{constructor({src:e,responseParameters:t,error:s=null,extras:i={}}){if(this.src=e,this.responseParameters=t,this.extras=i??{},null!==s&&!(s instanceof Ue))throw new Error("TokenResponse error must be an instance of TokenError");this.error=s}static fromJson({src:e,json:t}){const s=JSON.parse(t),i={token:s.token??null,tokenPath:s.token_path??null,expires:s.expires??null},n=new je({src:e,responseParameters:i});for(const e of Object.keys(s))["token","expires","token_path"].includes(e)||(n.extras[e]=s[e]);return n}static fromAkamai({src:e,text:t}){const s=qe({src:e,text:t});return new je({src:e,responseParameters:s})}static fromText({src:e,text:t}){if(t.trim().startsWith("{"))return je.fromJson({src:e,json:t});const s=new URLSearchParams(t.trim().replace(/^\?/,"")),i=s.get("token")??null,n=s.get("expires"),r=n?parseInt(n,10):null,a=s.get("token_path")??null,o=new je({src:e,responseParameters:{token:i,tokenPath:a,expires:r}});return s.forEach((e,t)=>{["token","expires","token_path"].includes(t)||(o.extras[t]=e)}),o}static fromDefault({src:e,text:t}){const s=new URLSearchParams(t.trim().replace(/^\?/,"")),i=s.get("expires"),n={verify:s.get("verify")??null,expires:i?parseInt(i,10):null},r=new je({src:e,responseParameters:n});return s.forEach((e,t)=>{["verify","expires"].includes(t)||(r.extras[t]=e)}),r}static fromError({src:e,error:t}){const s=t instanceof Ue?t:new Ue(t);return new je({src:e,error:s})}}function qe({src:e,text:t}){const s=new URL(`${e}${t?`?${t}`:""}`);let i=null,n=null,r=null,a=null,o=null;const l=new URLSearchParams(s.search);if(i=l.get("hdntl"),o=l.get("hdnea"),!i&&!o){const e=s.pathname.split("/");for(const t of e){if(t.startsWith("hdntl=")){i=t.substring(6);break}if(t.startsWith("hdnea=")){o=t.substring(6);break}}}const c=i??o;if(c){const e=c.match(/exp=(\d+)/);e&&(n=e[1]);const t=c.match(/hmac=([a-f0-9]+)/);t&&(r=t[1]);const s=c.match(/acl=([^~]+)/);s&&(a=s[1])}return{expires:n,hdntl:c,hmac:r,acl:a,hdnea:o}}function We(e){return new Promise(t=>{setTimeout(t,e)})}class Ge{constructor({token:e,tokenType:t,srcInTokenRequest:s=!1,extraParamsCallback:i=null,onCDNTokenError:n,maxRetries:r=3,retryInterval:a=1e4,expirationMarginInSeconds:o=30}){const l=Object.values(He);void 0!==t&&l.includes(t)?this.tokenType=t:this.tokenType=void 0,this.tokenGeneratorUrl=e,this.srcInTokenRequest=s,this.extraParamsCallback=i&&"function"==typeof i?i:null,this.callbackError=n&&"function"==typeof n?n:null,this.attempt=0,this.maxRetries=r,this.retryInterval=a,this.expirationMarginInSeconds=o,this.lastTokenResponse=null,this.resetAttemptCounterTimeout=null}resetAttemptCounter(){this.resetAttemptCounterTimeout||(this.resetAttemptCounterTimeout=setTimeout(()=>{this.attempt=0},3e4))}async _fetchDefaultToken(e,t=null){const s=new URL(e);if(["verify","expires"].forEach(e=>s.searchParams.delete(e)),this.attempt>=this.maxRetries)return this.resetAttemptCounter(),je.fromError({src:s.toString(),error:new Ue({status:t?.status,errorCode:"Unauthorized",errorType:Oe.MAX_RETRY})});try{let t;if(this.attempt+=1,t=!0===this.srcInTokenRequest?await fetch(`${this.tokenGeneratorUrl}?url=${encodeURIComponent(s.toString())}`):await fetch(this.tokenGeneratorUrl),403===t.status)return await We(this.retryInterval),this._fetchDefaultToken(e,t);if(t.status>=400)return je.fromError({src:s.toString(),error:new Ue({status:t.status})});this.attempt=0;const i=await t.text();return je.fromDefault({src:s.toString(),text:i})}catch(e){return console.error("CDNToken: Error fetching default token ",e),je.fromError({src:s.toString(),error:e})}}async _fetchEasyBToken(e,t=null){if(this.attempt>=this.maxRetries)return this.resetAttemptCounter(),je.fromError({src:e,error:new Ue({status:t?.error?.status,errorCode:t?.error?.errorCode??"Unauthorized",errorType:Oe.MAX_RETRY})});try{this.attempt+=1;const s={};if(this.extraParamsCallback){const e=await this.extraParamsCallback(t?.error?.status);e?.accessToken&&(s.Authorization=`Bearer ${String(e.accessToken)}`)}else console.warn("CDNToken: no extraParamsCallback provided");let i;if(i=!0===this.srcInTokenRequest?await fetch(`${this.tokenGeneratorUrl}?url=${encodeURIComponent(e)}`,{method:"GET",headers:s}):await fetch(this.tokenGeneratorUrl,{method:"POST",headers:s,body:JSON.stringify({streamUrl:e})}),i.status>=400){const t=je.fromError({src:e,error:new Ue({status:i.status})});return 403===i.status?(await We(this.retryInterval),this._fetchEasyBToken(e,t)):t}this.attempt=0;const n=await i.text();return je.fromText({src:e,text:n})}catch(t){return console.error("CDNToken: Error fetching token ",t),je.fromError({src:e,error:t})}}async _fetchAkamaiToken(e,t=null){if(this.attempt>=this.maxRetries)return this.resetAttemptCounter(),je.fromError({src:e,error:new Ue({status:t?.status,errorCode:"Unauthorized",errorType:Oe.MAX_RETRY})});try{this.attempt+=1;const t=await fetch(`${this.tokenGeneratorUrl}?url=${encodeURIComponent(e)}`);if(403===t.status)return await We(this.retryInterval),this._fetchAkamaiToken(e,t);if(t.status>=400)return je.fromError({src:e,error:new Ue({status:t.status})});this.attempt=0;const s=await t.text();return je.fromAkamai({src:e,text:s})}catch(t){return console.error("CDNToken: Error fetching token ",t),je.fromError({src:e,error:t})}}async _fetchBunnyToken(e,t=null){if(this.attempt>=this.maxRetries)return this.resetAttemptCounter(),je.fromError({src:e,error:new Ue({status:t?.error?.status,errorCode:t?.error?.errorCode??"Unauthorized",errorType:Oe.MAX_RETRY})});try{this.attempt+=1;const s={"Content-Type":"application/json"};if(this.extraParamsCallback){const e=await this.extraParamsCallback(t?.error?.status);e?.accessToken&&(s.Authorization=`Bearer ${String(e.accessToken)}`)}else console.warn("CDNToken: no extraParamsCallback provided");const i=await fetch(this.tokenGeneratorUrl,{method:"POST",headers:s,body:JSON.stringify({streamUrl:e})});if(i.status>=400){const t=i.headers.get("content-type"),s=t?.includes("application/json")?await i.json():await i.text(),n="object"==typeof s&&null!==s?s.error?.errorCode??"Unauthorized":"Unauthorized",r="object"==typeof s&&null!==s?s.error?.__type??Oe.UNKNOWN:Oe.UNKNOWN,a=new Ue({status:i.status,errorCode:n,errorType:r}),o=je.fromError({src:e,error:a});return[403,401,498].includes(i.status)?(this.callbackError?this.callbackError({status:a.status,errorCode:a.errorCode,errorType:a.errorType}):console.warn(`CDNToken: Bunny token fetch attempt ${this.attempt} for ${e} failed with status ${i.status}, retrying in ${this.retryInterval/1e3}s`),await We(this.retryInterval),this._fetchBunnyToken(e,o)):(console.error(`CDNToken: error generating Bunny token on attempt ${this.attempt}`,JSON.stringify(o)),o)}const n=await i.json();return this.attempt=0,Number.isInteger(n.max_retries)&&n.max_retries>0&&(this.maxRetries=n.max_retries),Number.isInteger(n.retry_interval)&&n.retry_interval>0&&(this.retryInterval=1e3*n.retry_interval),je.fromJson({src:e,json:JSON.stringify(n)})}catch(t){return console.error("CDNToken: Error fetching bunny token:",t),je.fromError({src:e,error:t})}}async fetchToken({src:e}){if(!e)return console.warn("CDNToken: Missing src to tokenize"),null;switch(this.tokenType){case He.BUNNY:this.lastTokenResponse=await this._fetchBunnyToken(e);break;case He.AKAMAI:this.lastTokenResponse=await this._fetchAkamaiToken(e);break;case He.VENOM:case He.EASY_B:this.lastTokenResponse=await this._fetchEasyBToken(e);break;default:this.lastTokenResponse=await this._fetchDefaultToken(e)}return this.lastTokenResponse}async updateUrlWithTokenParams({url:e}){const t=new URL(e),s=t.searchParams.get("expires");switch(this.tokenType){case He.AKAMAI:{const s=qe({src:e,text:""});if(!this.isTokenExpired(s.expires))return e;const i=t.pathname.split("/");t.pathname=i.filter(e=>!e.startsWith("hdntl=")&&!e.startsWith("hdnea=")).join("/");break}case He.EASY_B:case He.VENOM:case He.BUNNY:{if(!this.isTokenExpired(s))return e;["token","expires","token_path"].forEach(e=>t.searchParams.delete(e));const i=this.lastTokenResponse;if(i){const t=i.responseParameters;if(t&&!this.isTokenExpired(t.expires)){const{token:s,expires:i,tokenPath:n}=t;return Ge.appendTokenParams(e,s,i,n)}}break}default:if(!this.isTokenExpired(s))return e}try{const s=await this.fetchToken({src:t.toString()});if(null===s)return e;if(s.error)return this.callbackError&&this.callbackError({status:s.error.status,errorCode:s.error.errorCode,errorType:s.error.errorType}),e;switch(this.tokenType){case He.BUNNY:case He.VENOM:case He.EASY_B:{const t=s.responseParameters;return Ge.appendTokenParams(e,t.token,t.expires,t.tokenPath)}case He.AKAMAI:{const t=s.responseParameters;return Ge.appendAkamaiTokenParams(e,t.hdntl??t.hdnea??"")}default:return Ge.appendDefaultTokenParams(e,s)}}catch(t){return console.error("CDNToken: Error while fetching new token:",t),e}}isTokenExpired(e){if(null==e)return!0;const t=Math.floor(Date.now()/1e3)+this.expirationMarginInSeconds;return Number(e)<t}destroy(){this.resetAttemptCounterTimeout&&(clearTimeout(this.resetAttemptCounterTimeout),this.resetAttemptCounterTimeout=null),this.attempt=0,this.lastTokenResponse=null,console.log("CDNTokenManager: destroyed")}static appendTokenParams(e,t,s,i){const n=new URL(e);return t&&(n.searchParams.set("token",t),null!==s&&n.searchParams.set("expires",String(s)),i&&n.searchParams.set("token_path",i)),n.toString()}static appendAkamaiTokenParams(e,t){const s=new URL(e);return s.searchParams.delete("hdnea"),s.searchParams.delete("hdntl"),s.searchParams.set("hdnea",t),s.toString()}static appendDefaultTokenParams(e,t){const s=new URL(e),i=t.responseParameters;return i?.verify&&s.searchParams.set("verify",i.verify),null!=i?.expires&&s.searchParams.set("expires",String(i.expires)),s.toString()}}class Ye{constructor(e){this.tokenManager=e}buildHlsConfig(e){if(!e.emeEnabled)return{};const t=this.tokenManager;return{emeEnabled:e.emeEnabled,...void 0!==e.drmSystems&&{drmSystems:e.drmSystems},licenseXhrSetup:async(e,s)=>{if(t?.extraParamsCallback){const s=await t.extraParamsCallback().catch(e=>(console.error("DrmConfigurator: extraParamsCallback error:",e),null));s?.accessToken&&e.setRequestHeader("Authorization",`Bearer ${s.accessToken}`)}const i=t?.lastTokenResponse?.extras?.drm_custom_data;if(i){const t=new URL(s);t.searchParams.delete("customdata"),t.searchParams.append("customdata",i),e.open("POST",t.toString(),!0)}else e.open("POST",s,!0)}}}}class Qe extends Ve{constructor(){super(...arguments),this.driver=null,this.tokenManager=null,this.eventState=null}async onAttach(){if(this.state){this.state.playbackState="loading";try{await this.init()}catch(e){console.error("HlsEngine: init failed",e),this.state&&(this.state.error=e instanceof Error?e.message:String(e))}}}onDetach(){if(this.stopWatchdog(),null!==this.driver){try{this.driver.detachMedia(),this.driver.destroy()}catch(e){console.error("HlsEngine: error during driver teardown",e)}this.driver=null}this.tokenManager=null,this.eventState=null}recoverFromStall(e){this.driver&&(1===e?(console.warn("HlsEngine stall recovery: recoverMediaError"),this.driver.recoverMediaError()):(console.warn("HlsEngine stall recovery: startLoad"),this.driver.startLoad(this.video?.currentTime??-1)))}async init(){const{config:e,video:t,state:s,signal:i}=this;if(!(e&&t&&s&&i))return;const n=e.hlsjs;if(!n)throw new Error("HlsEngine: config.hlsjs URL is required");e.token&&(this.tokenManager=new Ge({token:e.token,tokenType:e.tokenType,srcInTokenRequest:e.srcInTokenRequest,extraParamsCallback:e.extraParamsCallback,onCDNTokenError:e.engineSettings.onCDNTokenError}),e.src&&await this.tokenManager.fetchToken({src:e.src})),console.info("HlsEngine: loading hls.js from",n);const r=await Me(n,"Hls"),a=new Ye(this.tokenManager).buildHlsConfig(e.engineSettings),o=this.tokenManager;class l extends r.DefaultConfig.loader{constructor(e){super(e);const t=this.load.bind(this);this.load=async function(e,s,i){if(!e.url||!o)return void t(e,s,i);new URL(e.url).pathname.split("/").pop().endsWith(".m3u8")?(e.url=await o.updateUrlWithTokenParams({url:e.url}),t(e,s,i)):t(e,s,i)}}}const c=e.engineSettings,h={autoStartLoad:!e.startAt,enableWorker:!0,backBufferLength:30,...c,...a,startPosition:e.startAt,pLoader:l};if(!e.disableCustomAbr)try{const{createHlsAbrController:e}=await Promise.resolve().then(function(){return ot});h.abrController=e(r)}catch(e){console.warn("HlsEngine: failed to load custom ABR controller, using default",e)}const d=new r(h);this.driver=d,function(e,t){const s=e.trigger;e.trigger=function(e,i){if(e===t.AUDIO_TRACK_LOADED){const e=i;if(e?.details){const t=this.currentLevel>=0?this.currentLevel:0,s=this.levels?.[t]?.details;if(s&&e.details.endCC>s.endCC){const t=s.endCC,i=e.details.fragments;if(i)for(let e=0;e<i.length;e++)i[e].cc>t&&(i[e].cc=t);void 0!==e.details.fragmentHint?.cc&&e.details.fragmentHint.cc>t&&(e.details.fragmentHint.cc=t),e.details.endCC=t}}}return s.call(this,e,i)}}(d,r.Events),e.retry&&function(e){e.on("hlsError",(t,s)=>{if(console.warn(`HLS Retry: Error occured; ${s.fatal?"fatal, trying to fix now":"non fatal, monitor it"}.`,t,s),s.fatal)setTimeout(()=>{"mediaError"===s.type?e.recoverMediaError():e.startLoad()},1e3);else{const i=e.media?.currentTime;setTimeout(()=>{i===e.media?.currentTime?(console.warn("HLS Retry: Looks like stream is stuck, trying to fix",t,s),"mediaError"===s?.type?e?.recoverMediaError():e.startLoad()):console.info("HLS Retry: Stream is playing so this is fine",t,s)},3e3)}})}(d),this.bindVideoEvents(t,s,i),d.attachMedia(t);let u=e.src??"";this.tokenManager&&u&&(u=await this.tokenManager.updateUrlWithTokenParams({url:u})),d.loadSource(u),this.registerDriverEvents(r,s),this.startWatchdog()}registerDriverEvents(e,t){const s=this.driver;if(!s)return;this.eventState=t;const{Events:i}=e;s.on(i.MANIFEST_LOADED,this._onManifestLoaded.bind(this)),s.on(i.LEVEL_LOADED,this._onLevelLoaded.bind(this)),s.on(i.LEVEL_SWITCHED,this._onLevelSwitched.bind(this)),s.on(i.AUDIO_TRACKS_UPDATED,this._onAudioTracksUpdated.bind(this)),s.on(i.AUDIO_TRACK_SWITCHED,this._onAudioTrackSwitched.bind(this)),s.on(i.SUBTITLE_TRACKS_UPDATED,this._onSubtitleTracksUpdated.bind(this)),s.on(i.SUBTITLE_TRACK_SWITCH,this._onSubtitleTrackSwitch.bind(this))}_onManifestLoaded(e,t){const s=this.eventState,i=this.driver;if(!s)return;const n=t.levels??i?.levels??[];s.qualityLevels=n.map((e,t)=>({name:e.name??`${e.height}p`,id:t,bitrate:e.bitrate,height:e.height,width:e.width}))}_onLevelLoaded(e,t){const s=this.eventState;if(!s)return;const i=t;void 0!==i?.details?.live&&(s.isLive=i.details.live)}_onLevelSwitched(e,t){const s=this.eventState;if(!s)return;const i=t;s.currentQuality=i.level}_onAudioTracksUpdated(e,t){const s=this.eventState,i=this.driver;if(!s)return;const n=t.audioTracks??i?.audioTracks??[];s.audioTracks=n.map(e=>({id:e.id,name:e.name,lang:e.lang}))}_onAudioTrackSwitched(e,t){const s=this.eventState;if(!s)return;const i=t;s.currentAudioTrack=i.id}_onSubtitleTracksUpdated(e,t){const s=this.eventState,i=this.driver;if(!s)return;const n=t.subtitleTracks??i?.subtitleTracks??[];s.subtitleTracks=n.map(e=>({id:e.id,name:e.name,lang:e.lang}))}_onSubtitleTrackSwitch(e,t){const s=this.eventState;if(!s)return;const i=t;s.currentSubtitleTrack=i.id}}const Xe=(e,t,s,i,n,r)=>{if(r<=0)return;const[{bandwidth:a},{bandwidth:o}]=t.getMediaInfo().bitrateList;return r>2&&.8*s>=a&&s<=o?e<8?r:r-1:1===r?i.getCurrentBufferLevel("video",!0)>1.5*n&&e<8?r:r-1:void 0};function Ke(e){const t=e.FactoryMaker.getClassFactoryByName("SwitchRequest"),s=e.FactoryMaker.getSingletonFactoryByName("StreamController"),i=e.FactoryMaker.getSingletonFactoryByName("DashMetrics"),n=new Set;let r=0,a=15,o=15;const l=function(){return{getMaxIndex:e=>{const l=t(this.context).create();l.priority=t.PRIORITY.STRONG;const c=e.getMediaInfo().type,h=i(this.context).getInstance(),d=s(this.context).getInstance(),u=e.getAbrController();if(setInterval(()=>{var e;void 0!==(e=h.getCurrentBufferLevel("video",!0))&&(a<e&&(n.add(o),a=e,o=e),e<o&&(o=e,a=o))},1e3),"video"===c){let s,i=0;try{const[t,a]=(({requests:e,count:t,rulesContext:s,currentValue:i,dashMetrics:a})=>{if(!e)return[""];let o=null;for(let t=e.length-1;t>=0&&null===o;t--){const[{_tfinish:s,trequest:i,tresponse:n,trace:r}]=e[t];s&&i&&n&&r&&r.length&&(o=e[t])}if(null===o)return["No valid request made for this stream yet, bailing"];const l=(o[0]._tfinish.getTime()-o[0].trequest.getTime())/1e3,c=(o[0]._tfinish.getTime()-o[0].tresponse.getTime())/1e3;if("InitializationSegment"===o[0].type||"MediaSegment"===o[0].type){if(l<=0)return["Last segment not downloaded, probable network problem: Switching to lowest quality",0];if(n.size>=3){const o=Array.from(n),h=o.reduce((e,t)=>e+t,0)/n.size,d=((e,t)=>{const[{type:s,_tfinish:i,trequest:n,tresponse:r,trace:a}]=e[0];return"MediaSegment"!==s&&i&&n&&r&&a&&a.length?8*a.reduce((e,t)=>e+t.b[0],0)/t:0})(e,l),u=Math.sqrt(o.map(e=>(e-h)**2).reduce((e,t)=>e+t,0)/n.size);return n.clear(),h<=1.5?["Avg. Buffer < 10% of max buffer, switching to lowest quality",0]:h<=4.5?["Maintaining the current Bitrate",i]:h<=10.5&&s.getMediaInfo().bitrateList[i].bandwidth<d&&(r<t-1||u<=8)?["Switching to optimised quality level",r?Xe(u,s,d,a,c,t):r+1]:["Switching to optimised quality level",Xe(u,s,d,a,c,t)]}return["Maintaining the last loaded level"]}return["Last Loaded segment was not a media segment of initialization segment"]})({requests:h.getHttpRequests(c),count:e.getMediaInfo().representationCount,currentValue:u.getQualityFor(c,d.getActiveStreamInfo()),rulesContext:e,dashMetrics:h});s=t,i=a??r,r=i}catch{return n.clear(),{quality:0,reason:"Error in ABR rule",priority:t.PRIORITY.STRONG}}return l.quality=i,l.reason=s,l}return l.quality=0,l.reason="Audio Request",l}}};return l.__dashjs_factory_name="CustomAbrRule",e.FactoryMaker.getClassFactory(l)}class Je extends Ve{constructor(){super(...arguments),this.driver=null,this.dvrErrorHandler=null}setConfig(e){this.config=e}setBus(e){this.bus=e}setVideo(e){this.video=e}async onAttach(){if(this.state){this.state.playbackState="loading";try{await this.init()}catch(e){console.error("DashEngine: init failed",e),this.state&&(this.state.error=e instanceof Error?e.message:String(e))}}}onDetach(){if(this.stopWatchdog(),null!==this.driver){try{this.driver.reset(),this.driver.destroy()}catch(e){console.error("DashEngine: error during driver teardown",e)}this.driver=null}null!==this.dvrErrorHandler&&(window.removeEventListener("unhandledrejection",this.dvrErrorHandler),this.dvrErrorHandler=null)}recoverFromStall(e){null!==this.video&&(1===e?(console.warn("DashEngine stall recovery: seek nudge"),this.video.currentTime+=.1):(console.warn("DashEngine stall recovery: refreshManifest"),this.driver?.refreshManifest()))}async init(){const{config:e,video:t,state:s,signal:i}=this;if(!(e&&t&&s&&i))return;const n=e.dashjs;if(!n)throw new Error("DashEngine: config.dashjs URL is required");this.dvrErrorHandler=e=>{const t=e.reason;(t?.message?.includes("getCurrentDVRInfo")||String(e.reason).includes("getCurrentDVRInfo"))&&(e.preventDefault(),console.warn("DashEngine: suppressed DVR unhandledrejection"))},window.addEventListener("unhandledrejection",this.dvrErrorHandler,{signal:i}),console.info("DashEngine: loading dashjs from",n);const r=await Me(n,"dashjs"),a=r.MediaPlayer().create();if(!a)throw new Error("DashEngine: dash.js MediaPlayer could not be created");var o;if(this.driver=a,a.initialize(t,e.src??"",e.autoplay??!1),e.retry&&((o=a).updateSettings({streaming:{retryIntervals:{MPD:1e3,XLinkExpansion:1e3,InitializationSegment:1e3,IndexSegment:1e3,MediaSegment:1e3,BitstreamSwitchingSegment:1e3,other:1e3,lowLatencyReductionFactor:1}}}),o.updateSettings({streaming:{retryAttempts:{MPD:1/0,XLinkExpansion:1/0,InitializationSegment:1/0,IndexSegment:1/0,MediaSegment:1/0,BitstreamSwitchingSegment:1/0,other:1/0,lowLatencyMultiplyFactor:1}}})),!e.disableCustomAbr){const e=Ke(r);a.addABRCustomRule("qualitySwitchRules","CustomAbrRule",e)}e.lowLatency&&a.updateSettings({streaming:{lowLatencyEnabled:!0,liveDelay:30,liveCatchUpPlaybackRate:.01}}),this.registerDriverEvents(r,s,a),this.bindVideoEvents(t,s,i),this.startWatchdog(),await new Promise(e=>{const t=()=>{a.off(r.MediaPlayer.events.STREAM_INITIALIZED,t),e()};a.on(r.MediaPlayer.events.STREAM_INITIALIZED,t)})}registerDriverEvents(e,t,s){const i=e.MediaPlayer.events;s.on(i.STREAM_INITIALIZED,()=>{const e=s.getBitrateInfoListFor("video");t.qualityLevels=e.map((e,t)=>({name:`${e.height}p`,id:t,bitrate:e.bitrate}));const i=s.getTracksFor("audio");t.audioTracks=i.map(e=>({name:e.lang??"",id:e.id??e.index??0}));const n=s.getTracksFor("fragmentedText");t.subtitleTracks=n.map(e=>({name:e.lang??"",id:e.id??e.index??0}));const r=s.duration();t.duration=Number.isFinite(r)?Math.ceil(r):0;const a=s.getCurrentLiveLatency();"boolean"==typeof this.config?.isLive?t.isLive=this.config.isLive:t.isLive=!Number.isNaN(a),t.playbackState="playing"}),s.on(i.PLAYBACK_TIME_UPDATED,()=>{t.currentTime=Math.round(s.time())}),s.on(i.QUALITY_CHANGE_REQUESTED,()=>{t.currentQuality=s.getQualityFor("video")}),s.on(i.TRACK_CHANGE_RENDERED,()=>{t.currentAudioTrack=s.getQualityFor("audio")}),s.on(i.ERROR,e=>{const t=e;console.warn("DashEngine error:",t?.error?.message??t?.error??t)})}}let Ze=null,et=null;function tt(e){null!==Ze&&it();const t=h(o,e),s=new ze(e),i=function(e){if(null!=e&&"object"==typeof e&&"nodeType"in e)return e;const t="string"==typeof e?e:"#eb_player",s=document.querySelector(t);if(null===s)throw new Error(`EBPlayer: container element not found for selector "${t}". Ensure the element exists in the DOM before calling start().`);return s}(e.el);s.mount(i);const n=i.querySelector("video");Ze=s,et=null;return{open(e){null!==et&&(et.detach(),et=null);const i=function(e,t){return e.includes(".mpd")&&!1!==t.dashjs?new Je:new Qe}(e,t);null!==n&&i.setVideo(n),i.setBus(s.bus),i.setConfig(t),s.setEngineSync(i),et=i},close(){null!==et&&(et.detach(),et=null)},get state(){return s.state}}}function st(){null!==et&&(et.detach(),et=null)}function it(){null!==et&&(et.detach(),et=null),null!==Ze&&(Ze.dispose(),Ze=null)}"undefined"!=typeof window&&(window.EBPlayer={start:tt,stop:st,destroy:it});const nt=h(o,{template:"/Volumes/Dev-ext/dev/players/web/player-master/configs/videos/forja/demo/index.html",el:"#forja_player",skin:"forja",start:!0,polyfill:{ie:"11"},drivers:{dash:!1,hls:!1},engineSettings:{liveSyncDurationCount:8},chromecast:"https://cdnjs.cloudflare.com/ajax/libs/castjs/5.3.0/cast.min.js",src:"https://live.easybroadcast.fr/hls/live/playlist.m3u8",autoplay:!0,muted:!0,quality:!0,about:!1,primaryColor:"#FC013B",socials:{facebook:"https://www.facebook.com/sharer/sharer.php?u=https://www.easybroadcast.fr",twitter:"https://twitter.com/Easy_Broadcast"},seekbar:!0,middlebar:!1,pip:!1,retry:!0,lowLatency:!1,forceAutoplay:!1,forceQuality:!1,preroll:!1,prerollSkip:null,prerollLink:!1,speed:!0,lib:"https://libs.easybroadcast.io/assets/js/eblib/hls1/latest/eblib.bundle.js",manager:!1,stats:"https://stats.easybroadcast.fr",origin:"easybroadcast",libSettings:{resourceManager:{timeoutV2V:4500,storageSize:300,randomWaitForPeers:[1e3,3e3],partialRequest:!0,setEnableV2V:!0}},disableCustomAbr:!1});nt.start&&tt(nt);const rt="main",at={bufferInfo(e,t,s){if(!e.buffered||0===e.buffered.length)return{end:0,start:0,len:0,nextStart:0};for(let i=0;i<e.buffered.length;i++){const n=e.buffered.start(i),r=e.buffered.end(i);if(t>=n-s&&t<=r+s)return{end:r,start:n,len:r-t,nextStart:0}}return{end:0,start:0,len:0,nextStart:0}}};var ot=Object.freeze({__proto__:null,createHlsAbrController:function(e){const t=e.DefaultConfig.abrController;if(!t)return class{constructor(e){}get nextAutoLevel(){return-1}set nextAutoLevel(e){}destroy(){}};const{Events:s}=e;return class extends t{constructor(e){super(e,s.FRAG_LOADING,s.FRAG_LOADED,s.FRAG_BUFFERED,s.ERROR),this.hls=e,this.lastLoadedLevel=1,this._nextAutoLevel=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.onBufferCheckTick=this._onBufferCheckTick.bind(this),this.bufferCheckLastPlayPos=0,this.bufferCheckCurrentPlayPos=0,this.bufferCheckBufferingDetected=!1,this.lastDuration=6,this.setBufferValues=new Set,this.setBitrate=new Set,this.loading=!1,this.playingTime=0,this.minBufferValue=30,this.maxBufferValue=0,this.lastBufferValue=30,this.maxBufferLength=30,this.rebuffering=0,this.rebufferingRatio=.15,this.pastBufferFactor=5,this.bitrateTestDelay=0,this.timer=void 0,this.bufferCheckTimer=void 0,this.init=!0,this.fraglastBuffered=0,this.lastLoadedFragLevel=1,this.fragCurrent=null,this.partCurrent=null,this.bufferCheckVideo=null,this.registerCustomListeners()}destroy(){this.unregisterCustomListeners(),this.clearCustomTimer(),void 0!==this.bufferCheckTimer&&(clearInterval(this.bufferCheckTimer),this.bufferCheckTimer=void 0),"function"==typeof super.destroy&&super.destroy()}registerCustomListeners(){this.hls.on(s.FRAG_LOADING,this.onFragLoading,this),this.hls.on(s.FRAG_LOADED,this.onFragLoaded,this),this.hls.on(s.FRAG_BUFFERED,this.onFragBuffered,this),this.hls.on(s.LEVEL_LOADED,this.onLevelLoaded,this),this.hls.on(s.ERROR,this.onError,this)}unregisterCustomListeners(){this.hls.off(s.FRAG_LOADING,this.onFragLoading,this),this.hls.off(s.FRAG_LOADED,this.onFragLoaded,this),this.hls.off(s.FRAG_BUFFERED,this.onFragBuffered,this),this.hls.off(s.LEVEL_LOADED,this.onLevelLoaded,this),this.hls.off(s.ERROR,this.onError,this)}clearCustomTimer(){void 0!==this.timer&&(clearInterval(this.timer),this.timer=void 0)}onFragLoading(e,t){const s=t,{frag:i}=s;this.loading=!0,i.type===rt&&(this.timer||(this.fragCurrent=i,this.partCurrent=s.part??null,this.timer=setInterval(this.onCheck,100)))}getBuffer(){if(!this.hls.media)return 0;const e=this.hls.media.playbackRate||1,t=this.hls.media.currentTime;return(at.bufferInfo(this.hls.media,t,this.maxBufferLength).end-t)/e}_abandonRulesCheck(){const{hls:e}=this,t=e.media,s=this.fragCurrent,i=this.partCurrent;if(!s||!t)return;if((i?i.stats:s.stats).aborted)return this.clearCustomTimer(),void(this._nextAutoLevel=-1);e.autoLevelEnabled&&!t.paused&&t.playbackRate&&t.readyState&&s.type===rt&&"initSegment"!==s.sn&&(this.bufferCheckLastPlayPos=0,this.bufferCheckCurrentPlayPos=0,this.bufferCheckBufferingDetected=!1,this.bufferCheckVideo=t,this.bufferCheckTimer=setInterval(this.onBufferCheckTick,1e3))}_onBufferCheckTick(){if(!this.hls)return;if(!1===this.loading){const e=this.getBuffer();this.getBufferMinMaxValue(e)}const e=this.bufferCheckVideo;e&&(this.playingTime+=1,this.bufferCheckCurrentPlayPos=e.currentTime,this.bufferCheckLastPlayPos>0&&e.paused&&!this.bufferCheckBufferingDetected&&this.bufferCheckCurrentPlayPos<=this.bufferCheckLastPlayPos&&(this.rebuffering+=1,this.bufferCheckBufferingDetected=!0,this.hls.currentLevel>0&&(this.reset(),0!==this.lastLoadedFragLevel&&this.clearCustomTimer())),this.bufferCheckLastPlayPos>0&&this.bufferCheckBufferingDetected&&!e.paused&&this.bufferCheckCurrentPlayPos>this.bufferCheckLastPlayPos&&(this.bufferCheckBufferingDetected=!1),this.bufferCheckLastPlayPos=this.bufferCheckCurrentPlayPos)}onFragLoaded(e,t){const i=t,{frag:n,part:r}=i,a=r?r.stats:n.stats,o=r?r.duration:n.duration;if(this.loading=!1,n.type===rt&&"number"==typeof n.sn){this.clearCustomTimer(),this.lastLoadedFragLevel=n.level,this._nextAutoLevel=-1;const e=this.hls.levels[n.level];if(e){const t=(e.loaded?e.loaded.bytes:0)+a.loaded,s=(e.loaded?e.loaded.duration:0)+o;e.loaded={bytes:t,duration:s},e.realBitrate=Math.round(8*t/s),this.setBitrate.add(e.realBitrate),this.lastDuration=o,this.maxBufferLength=10*this.lastDuration}this.onFragBuffered(s.FRAG_BUFFERED,{stats:a,frag:n,part:r,id:n.type})}}getBufferMinMaxValue(e){this.lastBufferValue<e&&(this.setBufferValues.add(this.minBufferValue),this.maxBufferValue=e,this.lastBufferValue=e,this.minBufferValue=e),e>this.maxBufferValue&&(this.maxBufferValue=e),e<this.minBufferValue&&(this.minBufferValue=e,this.lastBufferValue=this.minBufferValue)}reset(){this.setBufferValues.clear(),this.setBitrate.clear()}onError(e,t){if("fragLoadTimeOut"===t.details)this.clearCustomTimer()}onLevelLoaded(e,t){}onFragBuffered(e,t){const s=t,{frag:i,part:n}=s,r=n?n.stats:s.stats??i.stats;if(r.aborted)return;if(i.type!==rt||"initSegment"===i.sn)return;const a=r.loading?.start??0,o=(r.parsing?.end??0)-a;this.bitrateTestDelay=o/1e3,this.fraglastBuffered=Date.now()}findNextBestLevel(e){const t=this.hls.levels;for(let s=0;s<t.length;s++){if(s<t.length-2&&.8*this.avgBitrate>=t[s].bitrate&&this.avgBitrate<=t[s+1].bitrate)return this.reset(),this.lastLoadedFragLevel=e<3?s:s-1,this.lastLoadedFragLevel;if(s===t.length-1){return this.getBuffer()>this.lastDuration+this.lastDuration/2&&e<3?this.lastLoadedFragLevel=s:this.lastLoadedFragLevel=s-1,this.reset(),this.lastLoadedFragLevel}}return this.lastLoadedFragLevel}get avgBitrate(){return 0===this.setBitrate.size?0:Array.from(this.setBitrate).reduce((e,t)=>e+t,0)/this.setBitrate.size}set avgBitrate(e){}findBestLevel(){if(!this.hls)return 0;const e=this.hls.levels.length-1,t=this.getBuffer();if(t<.1*this.hls.config.maxBufferLength)return this.reset(),this.lastLoadedFragLevel=Math.max(this.lastLoadedFragLevel-1,0),this.lastLoadedFragLevel=Math.min(Math.max(this.lastLoadedFragLevel,0),e),this.lastLoadedFragLevel;if(!0===this.init)return this.init=!1,this.lastLoadedFragLevel=e,this.lastLoadedFragLevel;if(t>.3*this.hls.config.maxBufferLength)return this.lastLoadedFragLevel=this.findNextBestLevel(5),this.lastLoadedFragLevel=Math.min(Math.max(this.lastLoadedFragLevel,0),e),this.lastLoadedFragLevel;if(this.setBufferValues.size>=this.pastBufferFactor)try{const t=Array.from(this.setBufferValues).reduce((e,t)=>e+t,0)/this.setBufferValues.size,s=function(e){const t=e.reduce((e,t)=>e+t,0)/e.length,s=e.map(e=>(e-t)**2);return Math.sqrt(s.reduce((e,t)=>e+t,0)/(e.length-1))}(Array.from(this.setBufferValues));this.setBufferValues.clear();const i=this.hls.levels[this.hls.currentLevel]?.bitrate??0;return t<=.1*this.hls.config.maxBufferLength&&i>=this.hls.levels[0].bitrate?(this.reset(),this.lastLoadedFragLevel=Math.max(this.lastLoadedFragLevel-1,0),this.lastLoadedFragLevel=Math.min(Math.max(this.lastLoadedFragLevel,0),e),this.lastLoadedFragLevel):t<=.3*this.hls.config.maxBufferLength?(this.reset(),this.lastLoadedFragLevel):t<=.7*this.hls.config.maxBufferLength&&i<this.avgBitrate?(this.reset(),this.lastLoadedFragLevel=this.findNextBestLevel(s),this.lastLoadedFragLevel=Math.min(Math.max(this.lastLoadedFragLevel,0),e),this.lastLoadedFragLevel):t>.7*this.hls.config.maxBufferLength&&i<.8*this.avgBitrate?(this.lastLoadedFragLevel=this.findNextBestLevel(s),this.lastLoadedFragLevel=Math.min(Math.max(this.lastLoadedFragLevel,0),e),this.lastLoadedFragLevel):(this.reset(),this.lastLoadedFragLevel=Math.min(Math.max(this.lastLoadedFragLevel,0),e),this.lastLoadedFragLevel)}catch(t){return console.warn("HLS ABR: findBestLevel error",t),this.lastLoadedFragLevel=this.findNextBestLevel(3),this.lastLoadedFragLevel=Math.min(Math.max(this.lastLoadedFragLevel,0),e),this.lastLoadedFragLevel}return this.lastLoadedFragLevel=Math.min(Math.max(this.lastLoadedFragLevel,0),e),this.lastLoadedFragLevel}get _nextABRAutoLevel(){try{return this.playingTime>0&&this.rebuffering/this.playingTime>this.rebufferingRatio?(this.lastLoadedFragLevel=0,0):(this.setBitrate.size>0&&(this.lastLoadedFragLevel=this.findBestLevel()),this.lastLoadedFragLevel)}catch(e){return console.warn("HLS ABR: Could not define level, using last loaded level",e),this.lastLoadedFragLevel}}get nextAutoLevel(){return this._nextABRAutoLevel}set nextAutoLevel(e){this._nextAutoLevel=e}}}});return e.destroy=it,e.start=tt,e.stop=st,e}({});
@@ -0,0 +1 @@
1
+ <!doctype html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>EBPlayer</title><style>html,body{margin:0;background-color:black;height:100%}</style><script defer src="forja.js"></script></head><body><div id="eb_player"></div></body></html>