playron 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +287 -0
- package/dist/Docs.d.ts +2 -0
- package/dist/Docs.d.ts.map +1 -0
- package/dist/ErrorManager-CDf_sFKX.cjs +1 -0
- package/dist/ErrorManager-i9WcRsWb.js +43 -0
- package/dist/Why.d.ts +2 -0
- package/dist/Why.d.ts.map +1 -0
- package/dist/components/PlayerConfig.d.ts +34 -0
- package/dist/components/PlayerConfig.d.ts.map +1 -0
- package/dist/components/PlayronControls.d.ts +26 -0
- package/dist/components/PlayronControls.d.ts.map +1 -0
- package/dist/components/PlayronPlayer.d.ts +37 -0
- package/dist/components/PlayronPlayer.d.ts.map +1 -0
- package/dist/components/SiteHeader.d.ts +6 -0
- package/dist/components/SiteHeader.d.ts.map +1 -0
- package/dist/constants/sample-intro-outro.d.ts +3 -0
- package/dist/constants/sample-intro-outro.d.ts.map +1 -0
- package/dist/constants/source.d.ts +2 -0
- package/dist/constants/source.d.ts.map +1 -0
- package/dist/constants/sports-events.d.ts +58 -0
- package/dist/constants/sports-events.d.ts.map +1 -0
- package/dist/context/PlayerContext.d.ts +3 -0
- package/dist/context/PlayerContext.d.ts.map +1 -0
- package/dist/context/PlayerMethodsContext.d.ts +63 -0
- package/dist/context/PlayerMethodsContext.d.ts.map +1 -0
- package/dist/context/PlayerProvider.d.ts +9 -0
- package/dist/context/PlayerProvider.d.ts.map +1 -0
- package/dist/context/PlayerStateContext.d.ts +4 -0
- package/dist/context/PlayerStateContext.d.ts.map +1 -0
- package/dist/context/PlayronContext.d.ts +100 -0
- package/dist/context/PlayronContext.d.ts.map +1 -0
- package/dist/context/SubtitleStyleContext.d.ts +22 -0
- package/dist/context/SubtitleStyleContext.d.ts.map +1 -0
- package/dist/core/ConfigManager.d.ts +78 -0
- package/dist/core/ConfigManager.d.ts.map +1 -0
- package/dist/core/ErrorManager.d.ts +22 -0
- package/dist/core/ErrorManager.d.ts.map +1 -0
- package/dist/core/EventBus.d.ts +32 -0
- package/dist/core/EventBus.d.ts.map +1 -0
- package/dist/core/PlayerCore.d.ts +170 -0
- package/dist/core/PlayerCore.d.ts.map +1 -0
- package/dist/core/PlayronEventEmitter.d.ts +162 -0
- package/dist/core/PlayronEventEmitter.d.ts.map +1 -0
- package/dist/core/PluginSystem.d.ts +111 -0
- package/dist/core/PluginSystem.d.ts.map +1 -0
- package/dist/core/StallDetector.d.ts +27 -0
- package/dist/core/StallDetector.d.ts.map +1 -0
- package/dist/core/StateManager.d.ts +90 -0
- package/dist/core/StateManager.d.ts.map +1 -0
- package/dist/core/VideoEngine.d.ts +92 -0
- package/dist/core/VideoEngine.d.ts.map +1 -0
- package/dist/core/adaptive/StreamDetector.d.ts +73 -0
- package/dist/core/adaptive/StreamDetector.d.ts.map +1 -0
- package/dist/core/drm/DrmCapabilityProbe.d.ts +13 -0
- package/dist/core/drm/DrmCapabilityProbe.d.ts.map +1 -0
- package/dist/core/network/index.d.ts +6 -0
- package/dist/core/network/index.d.ts.map +1 -0
- package/dist/core/streaming/DashEngine.d.ts +149 -0
- package/dist/core/streaming/DashEngine.d.ts.map +1 -0
- package/dist/core/streaming/HlsEngine.d.ts +168 -0
- package/dist/core/streaming/HlsEngine.d.ts.map +1 -0
- package/dist/core/streaming/SubtitleManager.d.ts +88 -0
- package/dist/core/streaming/SubtitleManager.d.ts.map +1 -0
- package/dist/core/streaming/ThumbnailManager.d.ts +44 -0
- package/dist/core/streaming/ThumbnailManager.d.ts.map +1 -0
- package/dist/core/streaming/index.d.ts +11 -0
- package/dist/core/streaming/index.d.ts.map +1 -0
- package/dist/core/streaming/parsers/WebVttParser.d.ts +56 -0
- package/dist/core/streaming/parsers/WebVttParser.d.ts.map +1 -0
- package/dist/hooks/useClickOutside.d.ts +4 -0
- package/dist/hooks/useClickOutside.d.ts.map +1 -0
- package/dist/hooks/useKeyboardControls.d.ts +20 -0
- package/dist/hooks/useKeyboardControls.d.ts.map +1 -0
- package/dist/hooks/useMobileGestures.d.ts +17 -0
- package/dist/hooks/useMobileGestures.d.ts.map +1 -0
- package/dist/hooks/useMouseActivity.d.ts +10 -0
- package/dist/hooks/useMouseActivity.d.ts.map +1 -0
- package/dist/hooks/usePlayer.d.ts +6 -0
- package/dist/hooks/usePlayer.d.ts.map +1 -0
- package/dist/hooks/usePlayerMethods.d.ts +6 -0
- package/dist/hooks/usePlayerMethods.d.ts.map +1 -0
- package/dist/hooks/usePlayerState.d.ts +11 -0
- package/dist/hooks/usePlayerState.d.ts.map +1 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/layout/ControlsContainer.d.ts +9 -0
- package/dist/layout/ControlsContainer.d.ts.map +1 -0
- package/dist/layout/ControlsContainer.responsive.d.ts +8 -0
- package/dist/layout/ControlsContainer.responsive.d.ts.map +1 -0
- package/dist/layout/SeekBarContainer.d.ts +16 -0
- package/dist/layout/SeekBarContainer.d.ts.map +1 -0
- package/dist/playron.cjs.js +248 -0
- package/dist/playron.css +1 -0
- package/dist/playron.es.js +47631 -0
- package/dist/plugins/AdPlugin.d.ts +8 -0
- package/dist/plugins/AdPlugin.d.ts.map +1 -0
- package/dist/plugins/AnalyticsPlugin.d.ts +50 -0
- package/dist/plugins/AnalyticsPlugin.d.ts.map +1 -0
- package/dist/plugins/PluginManager.d.ts +2 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -0
- package/dist/plugins/SocialPlugin.d.ts +2 -0
- package/dist/plugins/SocialPlugin.d.ts.map +1 -0
- package/dist/plugins/ads/AdManager.d.ts +79 -0
- package/dist/plugins/ads/AdManager.d.ts.map +1 -0
- package/dist/plugins/ads/AdPlayer.d.ts +33 -0
- package/dist/plugins/ads/AdPlayer.d.ts.map +1 -0
- package/dist/plugins/ads/AdTracker.d.ts +34 -0
- package/dist/plugins/ads/AdTracker.d.ts.map +1 -0
- package/dist/plugins/ads/VASTParser.d.ts +52 -0
- package/dist/plugins/ads/VASTParser.d.ts.map +1 -0
- package/dist/plugins/ads/VMAPParser.d.ts +31 -0
- package/dist/plugins/ads/VMAPParser.d.ts.map +1 -0
- package/dist/plugins/ads/types.d.ts +108 -0
- package/dist/plugins/ads/types.d.ts.map +1 -0
- package/dist/poster.png +0 -0
- package/dist/test-ad.xml +37 -0
- package/dist/test-vmap.xml +30 -0
- package/dist/types/analytics.d.ts +86 -0
- package/dist/types/analytics.d.ts.map +1 -0
- package/dist/types/chapters.types.d.ts +17 -0
- package/dist/types/chapters.types.d.ts.map +1 -0
- package/dist/types/config.d.ts +23 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.types.d.ts +244 -0
- package/dist/types/config.types.d.ts.map +1 -0
- package/dist/types/controlbar.types.d.ts +5 -0
- package/dist/types/controlbar.types.d.ts.map +1 -0
- package/dist/types/drm.types.d.ts +163 -0
- package/dist/types/drm.types.d.ts.map +1 -0
- package/dist/types/events.d.ts +36 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/extended.types.d.ts +85 -0
- package/dist/types/extended.types.d.ts.map +1 -0
- package/dist/types/manifest.types.d.ts +297 -0
- package/dist/types/manifest.types.d.ts.map +1 -0
- package/dist/types/playbutton.types.d.ts +2 -0
- package/dist/types/playbutton.types.d.ts.map +1 -0
- package/dist/types/player.types.d.ts +13 -0
- package/dist/types/player.types.d.ts.map +1 -0
- package/dist/types/seekbar.types.d.ts +5 -0
- package/dist/types/seekbar.types.d.ts.map +1 -0
- package/dist/types/streaming.types.d.ts +168 -0
- package/dist/types/streaming.types.d.ts.map +1 -0
- package/dist/types/timeline.types.d.ts +46 -0
- package/dist/types/timeline.types.d.ts.map +1 -0
- package/dist/types/video-events.d.ts +51 -0
- package/dist/types/video-events.d.ts.map +1 -0
- package/dist/ui/Common/BufferingIndicator.d.ts +2 -0
- package/dist/ui/Common/BufferingIndicator.d.ts.map +1 -0
- package/dist/ui/Common/ControlBar.d.ts +3 -0
- package/dist/ui/Common/ControlBar.d.ts.map +1 -0
- package/dist/ui/Common/ControlBar.responsive.d.ts +3 -0
- package/dist/ui/Common/ControlBar.responsive.d.ts.map +1 -0
- package/dist/ui/Common/Dropdown/Dropdown.d.ts +14 -0
- package/dist/ui/Common/Dropdown/Dropdown.d.ts.map +1 -0
- package/dist/ui/Common/Dropdown/DropdownItem.d.ts +11 -0
- package/dist/ui/Common/Dropdown/DropdownItem.d.ts.map +1 -0
- package/dist/ui/Common/Dropdown/DropdownPanel.d.ts +9 -0
- package/dist/ui/Common/Dropdown/DropdownPanel.d.ts.map +1 -0
- package/dist/ui/Common/Dropdown/DropdownTrigger.d.ts +7 -0
- package/dist/ui/Common/Dropdown/DropdownTrigger.d.ts.map +1 -0
- package/dist/ui/Common/LoadingSpinner.d.ts +6 -0
- package/dist/ui/Common/LoadingSpinner.d.ts.map +1 -0
- package/dist/ui/Common/Overlay.d.ts +11 -0
- package/dist/ui/Common/Overlay.d.ts.map +1 -0
- package/dist/ui/Common/SeekBar.d.ts +15 -0
- package/dist/ui/Common/SeekBar.d.ts.map +1 -0
- package/dist/ui/Common/SeekBar.responsive.d.ts +10 -0
- package/dist/ui/Common/SeekBar.responsive.d.ts.map +1 -0
- package/dist/ui/Common/TimeDisplay.d.ts +2 -0
- package/dist/ui/Common/TimeDisplay.d.ts.map +1 -0
- package/dist/ui/Common/TimelineMarker.d.ts +11 -0
- package/dist/ui/Common/TimelineMarker.d.ts.map +1 -0
- package/dist/ui/Common/Tooltip.d.ts +2 -0
- package/dist/ui/Common/Tooltip.d.ts.map +1 -0
- package/dist/ui/Common/VolumePanel.d.ts +2 -0
- package/dist/ui/Common/VolumePanel.d.ts.map +1 -0
- package/dist/ui/Controls/AudioTrackSelector.d.ts +2 -0
- package/dist/ui/Controls/AudioTrackSelector.d.ts.map +1 -0
- package/dist/ui/Controls/CaptionsButton.d.ts +2 -0
- package/dist/ui/Controls/CaptionsButton.d.ts.map +1 -0
- package/dist/ui/Controls/CastButton.d.ts +17 -0
- package/dist/ui/Controls/CastButton.d.ts.map +1 -0
- package/dist/ui/Controls/DownloadButton.d.ts +2 -0
- package/dist/ui/Controls/DownloadButton.d.ts.map +1 -0
- package/dist/ui/Controls/EpisodeSelector.d.ts +2 -0
- package/dist/ui/Controls/EpisodeSelector.d.ts.map +1 -0
- package/dist/ui/Controls/FullscreenButton.d.ts +5 -0
- package/dist/ui/Controls/FullscreenButton.d.ts.map +1 -0
- package/dist/ui/Controls/JumpToLiveButton.d.ts +2 -0
- package/dist/ui/Controls/JumpToLiveButton.d.ts.map +1 -0
- package/dist/ui/Controls/LiveLatencyDisplay.d.ts +2 -0
- package/dist/ui/Controls/LiveLatencyDisplay.d.ts.map +1 -0
- package/dist/ui/Controls/MuteButton.d.ts +5 -0
- package/dist/ui/Controls/MuteButton.d.ts.map +1 -0
- package/dist/ui/Controls/NextEpisodeButton.d.ts +7 -0
- package/dist/ui/Controls/NextEpisodeButton.d.ts.map +1 -0
- package/dist/ui/Controls/PipButton.d.ts +5 -0
- package/dist/ui/Controls/PipButton.d.ts.map +1 -0
- package/dist/ui/Controls/PlayButton.d.ts +5 -0
- package/dist/ui/Controls/PlayButton.d.ts.map +1 -0
- package/dist/ui/Controls/PlaybackSpeedSelector.d.ts +2 -0
- package/dist/ui/Controls/PlaybackSpeedSelector.d.ts.map +1 -0
- package/dist/ui/Controls/PlaylistButton.d.ts +2 -0
- package/dist/ui/Controls/PlaylistButton.d.ts.map +1 -0
- package/dist/ui/Controls/QualitySelector.d.ts +2 -0
- package/dist/ui/Controls/QualitySelector.d.ts.map +1 -0
- package/dist/ui/Controls/SeekBar.d.ts +2 -0
- package/dist/ui/Controls/SeekBar.d.ts.map +1 -0
- package/dist/ui/Controls/SeekBarProgress.d.ts +2 -0
- package/dist/ui/Controls/SeekBarProgress.d.ts.map +1 -0
- package/dist/ui/Controls/SettingsButton.d.ts +2 -0
- package/dist/ui/Controls/SettingsButton.d.ts.map +1 -0
- package/dist/ui/Controls/SettingsPanel.d.ts +17 -0
- package/dist/ui/Controls/SettingsPanel.d.ts.map +1 -0
- package/dist/ui/Controls/SkipBackwardButton.d.ts +6 -0
- package/dist/ui/Controls/SkipBackwardButton.d.ts.map +1 -0
- package/dist/ui/Controls/SkipForwardButton.d.ts +6 -0
- package/dist/ui/Controls/SkipForwardButton.d.ts.map +1 -0
- package/dist/ui/Controls/SkipIntroButton.d.ts +7 -0
- package/dist/ui/Controls/SkipIntroButton.d.ts.map +1 -0
- package/dist/ui/Controls/SubtitleOverlay.d.ts +6 -0
- package/dist/ui/Controls/SubtitleOverlay.d.ts.map +1 -0
- package/dist/ui/Controls/SubtitlesMenu.d.ts +2 -0
- package/dist/ui/Controls/SubtitlesMenu.d.ts.map +1 -0
- package/dist/ui/Controls/TheaterModeButton.d.ts +2 -0
- package/dist/ui/Controls/TheaterModeButton.d.ts.map +1 -0
- package/dist/ui/Controls/TimeDisplay.d.ts +5 -0
- package/dist/ui/Controls/TimeDisplay.d.ts.map +1 -0
- package/dist/ui/Controls/VolumeControl.d.ts +2 -0
- package/dist/ui/Controls/VolumeControl.d.ts.map +1 -0
- package/dist/ui/Controls/VolumeSlider.d.ts +2 -0
- package/dist/ui/Controls/VolumeSlider.d.ts.map +1 -0
- package/dist/ui/Overlay/ContextMenu.d.ts +17 -0
- package/dist/ui/Overlay/ContextMenu.d.ts.map +1 -0
- package/dist/ui/Overlay/EndCard.d.ts +11 -0
- package/dist/ui/Overlay/EndCard.d.ts.map +1 -0
- package/dist/ui/Overlay/ErrorOverlay.d.ts +13 -0
- package/dist/ui/Overlay/ErrorOverlay.d.ts.map +1 -0
- package/dist/ui/Overlay/GestureHintOverlay.d.ts +14 -0
- package/dist/ui/Overlay/GestureHintOverlay.d.ts.map +1 -0
- package/dist/ui/Overlay/KeyboardShortcutsOverlay.d.ts +7 -0
- package/dist/ui/Overlay/KeyboardShortcutsOverlay.d.ts.map +1 -0
- package/dist/ui/Overlay/VideoOverlay.d.ts +9 -0
- package/dist/ui/Overlay/VideoOverlay.d.ts.map +1 -0
- package/dist/ui/Player.d.ts +19 -0
- package/dist/ui/Player.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const ve=require("react/jsx-runtime"),At=require("react");class vh{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){const n=this.listeners.get(e);n&&(n.delete(t),n.size===0&&this.listeners.delete(e))}emit(e){const t=this.listeners.get(e.type);t&&t.forEach(n=>{try{n(e)}catch(r){console.error(`Error in event listener for ${e.type}:`,r)}})}clear(){this.listeners.clear()}listenerCount(e){return this.listeners.get(e)?.size||0}}const oa=new vh,zn={PLAY:"play",PAUSE:"pause",PLAYING:"playing",ENDED:"ended",SEEKING:"seeking",SEEKED:"seeked",WAITING:"waiting",VOLUME_CHANGE:"volumechange",TIME_UPDATE:"timeupdate",DURATION_CHANGE:"durationchange",LOADED_METADATA:"loadedmetadata",LOADED_DATA:"loadeddata",CAN_PLAY:"canplay",CAN_PLAY_THROUGH:"canplaythrough",RATE_CHANGE:"ratechange",LOAD_START:"loadstart",PROGRESS:"progress",SUSPEND:"suspend",ABORT:"abort",STALLED:"stalled",ERROR:"error",EMPTIED:"emptied",RESIZE:"resize"},Ka={MEDIA_ERR_ABORTED:1,MEDIA_ERR_NETWORK:2,MEDIA_ERR_DECODE:3,MEDIA_ERR_SRC_NOT_SUPPORTED:4};function hE(u){return Object.values(zn).includes(u)}class gE{videoElement=null;isPlaying=!1;isMuted=!1;volume=1;playbackRate=1;currentTime=0;duration=0;constructor(e){this.videoElement=e,this.setupEventListeners(),this.initializeVideo()}setupEventListeners(){this.videoElement&&(this.videoElement.addEventListener(zn.PLAY,()=>{this.isPlaying=!0,this.emitPlayEvent()}),this.videoElement.addEventListener(zn.PAUSE,()=>{this.isPlaying=!1,this.emitPauseEvent()}),this.videoElement.addEventListener(zn.VOLUME_CHANGE,()=>{this.videoElement&&(this.volume=this.videoElement.volume,this.isMuted=this.videoElement.muted,this.emitVolumeChangeEvent())}),this.videoElement.addEventListener(zn.TIME_UPDATE,()=>{this.videoElement&&(this.currentTime=this.videoElement.currentTime)}),this.videoElement.addEventListener(zn.LOADED_METADATA,()=>{this.videoElement&&(this.duration=this.videoElement.duration)}),this.videoElement.addEventListener(zn.RATE_CHANGE,()=>{this.videoElement&&(this.playbackRate=this.videoElement.playbackRate)}),this.videoElement.addEventListener(zn.ERROR,e=>{console.error("Video error:",e),this.videoElement?.error&&console.error("Video error details:",{code:this.videoElement.error.code,message:this.videoElement.error.message,MEDIA_ERR_ABORTED:this.videoElement.error.code===Ka.MEDIA_ERR_ABORTED,MEDIA_ERR_NETWORK:this.videoElement.error.code===Ka.MEDIA_ERR_NETWORK,MEDIA_ERR_DECODE:this.videoElement.error.code===Ka.MEDIA_ERR_DECODE,MEDIA_ERR_SRC_NOT_SUPPORTED:this.videoElement.error.code===Ka.MEDIA_ERR_SRC_NOT_SUPPORTED})}))}initializeVideo(){this.videoElement&&(this.volume=this.videoElement.volume,this.isMuted=this.videoElement.muted,this.playbackRate=this.videoElement.playbackRate)}emitPlayEvent(){if(!this.videoElement)return;const e={type:"play",data:{currentTime:this.videoElement.currentTime,duration:this.videoElement.duration},timestamp:Date.now()};oa.emit(e)}emitPauseEvent(){if(!this.videoElement)return;const e={type:"pause",data:{currentTime:this.videoElement.currentTime,duration:this.videoElement.duration},timestamp:Date.now()};oa.emit(e)}emitVolumeChangeEvent(){const e={type:"volumechange",data:{volume:this.volume,muted:this.isMuted},timestamp:Date.now()};oa.emit(e)}emitMuteEvent(){const e={type:"mute",data:{muted:this.isMuted,volume:this.volume},timestamp:Date.now()};oa.emit(e)}async play(){if(!this.videoElement)throw new Error("Video element not found");try{await this.videoElement.play()}catch(e){throw console.error("Play failed:",e),e}}pause(){this.videoElement&&this.videoElement.pause()}toggleMute(){this.videoElement&&(this.videoElement.muted=!this.videoElement.muted,this.isMuted=this.videoElement.muted,this.emitMuteEvent())}setVolume(e){this.videoElement&&(this.videoElement.volume=Math.max(0,Math.min(1,e)))}seekTo(e){this.videoElement&&(this.videoElement.currentTime=Math.max(0,Math.min(this.duration,e)))}setPlaybackRate(e){this.videoElement&&(this.videoElement.playbackRate=Math.max(.25,Math.min(4,e)),this.playbackRate=this.videoElement.playbackRate)}setSource(e){this.videoElement&&(this.videoElement.src=e)}setPoster(e){this.videoElement&&(this.videoElement.poster=e)}setDimensions(e,t){this.videoElement&&(this.videoElement.width=typeof e=="number"?e:parseInt(e),this.videoElement.height=typeof t=="number"?t:parseInt(t))}getState(){return{isPlaying:this.isPlaying,isMuted:this.isMuted,volume:this.volume,playbackRate:this.playbackRate,currentTime:this.currentTime,duration:this.duration,src:this.videoElement?.src||"",poster:this.videoElement?.poster||""}}getVideoElement(){return this.videoElement}destroy(){this.videoElement&&(this.videoElement.removeEventListener("play",()=>{}),this.videoElement.removeEventListener("pause",()=>{}),this.videoElement.removeEventListener("volumechange",()=>{}),this.videoElement.removeEventListener("timeupdate",()=>{}),this.videoElement.removeEventListener("loadedmetadata",()=>{}),this.videoElement.removeEventListener("error",()=>{})),this.videoElement=null}}class mE{config;defaultConfig;constructor(e){this.defaultConfig=this.getDefaultConfig(),this.config=this.mergeConfig(e),this.validateConfig(this.config)}getDefaultConfig(){return{container:"",src:"",width:800,height:450,autoplay:!1,muted:!1,controls:!1,poster:"",className:""}}mergeConfig(e){return{...this.defaultConfig,...e}}validateConfig(e){if(!e.container)throw new Error("Container is required");if(!e.src)throw new Error("Source is required");const t=typeof e.width=="number"?e.width:parseInt(e.width||"800"),n=typeof e.height=="number"?e.height:parseInt(e.height||"450");if(e.width&&(t<100||t>4e3))throw new Error("Width must be between 100 and 4000");if(e.height&&(n<100||n>4e3))throw new Error("Height must be between 100 and 4000")}updateConfig(e){const t={...this.config,...e};this.validateConfig(t),this.config=t}getConfig(){return{...this.config}}get(e){return this.config[e]}set(e,t){const n={[e]:t};this.updateConfig(n)}getContainer(){return typeof this.config.container=="string"?document.querySelector(this.config.container):this.config.container}getDimensions(){return{width:typeof this.config.width=="number"?this.config.width:parseInt(this.config.width||"800"),height:typeof this.config.height=="number"?this.config.height:parseInt(this.config.height||"450")}}reset(){this.config={...this.defaultConfig}}export(){return JSON.stringify(this.config,null,2)}import(e){try{const t=JSON.parse(e);this.validateConfig(t),this.config=t}catch{throw new Error("Invalid configuration format")}}listeners=[];onChange(e){this.listeners.push(e)}offChange(e){const t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}notifyChange(){this.listeners.forEach(e=>{try{e(this.config)}catch(t){console.error("Config change listener error:",t)}})}updateConfigAndNotify(e){this.updateConfig(e),this.notifyChange()}}class pE{state;listeners=[];history=[];maxHistorySize=50;constructor(e){this.state=this.getInitialState(e)}getInitialState(e){return{...{isPlaying:!1,isMuted:!1,volume:1,currentTime:0,duration:0,playbackRate:1},...e}}updateState(e){const t={...this.state};this.state={...this.state,...e},this.addToHistory(t),this.notifyListeners()}getState(){return{...this.state}}get(e){return this.state[e]}set(e,t){this.updateState({[e]:t})}subscribe(e){this.listeners.push(e)}unsubscribe(e){const t=this.listeners.indexOf(e);t>-1&&this.listeners.splice(t,1)}notifyListeners(){this.listeners.forEach(e=>{try{e(this.state)}catch(t){console.error("State listener error:",t)}})}addToHistory(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift()}undo(){if(this.history.length===0)return!1;const e=this.history.pop();return e?(this.state=e,this.notifyListeners(),!0):!1}reset(){this.state=this.getInitialState(),this.history=[],this.notifyListeners()}setState(e){const t={...this.state};this.state={...e},this.addToHistory(t),this.notifyListeners()}clearHistory(){this.history=[]}getHistory(){return[...this.history]}isInState(e){return e(this.state)}subscribeToChanges(e,t){let n={...this.state};const r=i=>{const o={};let l=!1;e.forEach(d=>{n[d]!==i[d]&&(o[d]=i[d],l=!0)}),l&&t(o),n={...i}};this.subscribe(r)}createSnapshot(){return{...this.state}}restoreFromSnapshot(e){this.setState(e)}getStats(){return{totalListeners:this.listeners.length,historySize:this.history.length,maxHistorySize:this.maxHistorySize,lastUpdate:new Date}}}class Sh{listeners=new Map;onceListeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}once(e,t){this.onceListeners.has(e)||this.onceListeners.set(e,new Set),this.onceListeners.get(e).add(t)}off(e,t){const n=this.listeners.get(e);n&&(n.delete(t),n.size===0&&this.listeners.delete(e));const r=this.onceListeners.get(e);r&&(r.delete(t),r.size===0&&this.onceListeners.delete(e))}emit(e,t){const n=this.listeners.get(e);n&&n.forEach(i=>{try{i(t)}catch(o){console.error(`[Playron] Error in event listener for "${e}":`,o)}});const r=this.onceListeners.get(e);r&&(r.forEach(i=>{try{i(t)}catch(o){console.error(`[Playron] Error in once listener for "${e}":`,o)}}),this.onceListeners.delete(e))}removeAllListeners(e){e?(this.listeners.delete(e),this.onceListeners.delete(e)):(this.listeners.clear(),this.onceListeners.clear())}listenerCount(e){const t=this.listeners.get(e)?.size||0,n=this.onceListeners.get(e)?.size||0;return t+n}eventNames(){const e=new Set;return this.listeners.forEach((t,n)=>e.add(n)),this.onceListeners.forEach((t,n)=>e.add(n)),Array.from(e)}}class _h{async detectStream(e){const t=this.detectProtocol(e);try{if(t==="hls")return await this.detectHLS(e);if(t==="dash")return await this.detectDASH(e);if(t==="progressive")return this.detectProgressive(e)}catch(n){console.warn("[StreamDetector] Failed to detect stream type:",n)}return{type:"unknown",protocol:"unknown",isDynamic:!1,hasDVR:!1,isEngineSupported:this.preCheckCapability("unknown")}}preCheckCapability(e){if(typeof MediaSource>"u")return!1;const t=MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E"')||MediaSource.isTypeSupported('video/mp4; codecs="avc1.4d401e"')||MediaSource.isTypeSupported('video/mp4; codecs="avc1.64001F"'),n=MediaSource.isTypeSupported('video/mp4; codecs="hev1.1.6.L93.B0"')||MediaSource.isTypeSupported('video/mp4; codecs="hvc1.1.6.L93.B0"'),r=MediaSource.isTypeSupported('video/webm; codecs="vp9"')||MediaSource.isTypeSupported('video/mp4; codecs="vp09.00.10.08"'),i=t||n||r,o=/Safari/.test(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor);return e==="hls"&&o?!0:i}detectProtocol(e){const t=e.toLowerCase();return t.includes(".m3u8")||t.includes(".m3u")?"hls":t.includes(".mpd")?"dash":t.match(/\.(mp4|webm|ogg)$/)?"progressive":"unknown"}async detectHLS(e){const t=await this.fetchManifest(e);if(t.includes("#EXT-X-ENDLIST")||t.includes("#EXT-X-PLAYLIST-TYPE:VOD"))return{type:"vod",protocol:"hls",isDynamic:!1,hasDVR:!1,isEngineSupported:this.preCheckCapability("hls")};const r=t.includes("#EXT-X-MEDIA-SEQUENCE"),i=t.includes("#EXT-X-ENDLIST"),o=t.includes("#EXT-X-PLAYLIST-TYPE:EVENT"),l=this.extractTargetDuration(t),d=this.extractMediaSequence(t);return r&&!i?{type:"live",protocol:"hls",isDynamic:!0,hasDVR:o,targetDuration:l,mediaSequence:d,isEngineSupported:this.preCheckCapability("hls")}:{type:"vod",protocol:"hls",isDynamic:!1,hasDVR:!1,isEngineSupported:this.preCheckCapability("hls")}}async detectDASH(e){const t=await this.fetchManifest(e),i=t.match(/<MPD[^>]*type="(static|dynamic)"/)?.[1]==="dynamic",o=t.includes("timeShiftBufferDepth");return{type:i?"live":"vod",protocol:"dash",isDynamic:i,hasDVR:o,isEngineSupported:this.preCheckCapability("dash")}}detectProgressive(e){return{type:"vod",protocol:"progressive",isDynamic:!1,hasDVR:!1,isEngineSupported:!0}}async fetchManifest(e){const t=await fetch(e,{method:"GET",headers:{Accept:"*/*"}});if(!t.ok)throw new Error(`Failed to fetch manifest: ${t.status}`);return await t.text()}extractTargetDuration(e){const t=e.match(/#EXT-X-TARGETDURATION:(\d+)/);return t?parseInt(t[1],10):void 0}extractMediaSequence(e){const t=e.match(/#EXT-X-MEDIA-SEQUENCE:(\d+)/);return t?parseInt(t[1],10):void 0}quickDetect(e){const t=this.detectProtocol(e);return t==="progressive"?{type:"vod",protocol:"progressive",isEngineSupported:!0}:{type:"unknown",protocol:t,isEngineSupported:this.preCheckCapability(t)}}}const Ah=new _h,on=Number.isFinite||function(u){return typeof u=="number"&&isFinite(u)},yE=Number.isSafeInteger||function(u){return typeof u=="number"&&Math.abs(u)<=EE},EE=Number.MAX_SAFE_INTEGER||9007199254740991;let _n=(function(u){return u.NETWORK_ERROR="networkError",u.MEDIA_ERROR="mediaError",u.KEY_SYSTEM_ERROR="keySystemError",u.MUX_ERROR="muxError",u.OTHER_ERROR="otherError",u})({}),lt=(function(u){return u.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",u.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",u.KEY_SYSTEM_NO_SESSION="keySystemNoSession",u.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",u.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",u.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",u.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",u.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",u.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",u.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",u.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",u.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",u.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",u.MANIFEST_LOAD_ERROR="manifestLoadError",u.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",u.MANIFEST_PARSING_ERROR="manifestParsingError",u.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",u.LEVEL_EMPTY_ERROR="levelEmptyError",u.LEVEL_LOAD_ERROR="levelLoadError",u.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",u.LEVEL_PARSING_ERROR="levelParsingError",u.LEVEL_SWITCH_ERROR="levelSwitchError",u.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",u.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",u.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",u.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",u.FRAG_LOAD_ERROR="fragLoadError",u.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",u.FRAG_DECRYPT_ERROR="fragDecryptError",u.FRAG_PARSING_ERROR="fragParsingError",u.FRAG_GAP="fragGap",u.REMUX_ALLOC_ERROR="remuxAllocError",u.KEY_LOAD_ERROR="keyLoadError",u.KEY_LOAD_TIMEOUT="keyLoadTimeOut",u.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",u.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",u.BUFFER_APPEND_ERROR="bufferAppendError",u.BUFFER_APPENDING_ERROR="bufferAppendingError",u.BUFFER_STALLED_ERROR="bufferStalledError",u.BUFFER_FULL_ERROR="bufferFullError",u.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",u.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",u.ASSET_LIST_LOAD_ERROR="assetListLoadError",u.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",u.ASSET_LIST_PARSING_ERROR="assetListParsingError",u.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",u.INTERNAL_EXCEPTION="internalException",u.INTERNAL_ABORTED="aborted",u.ATTACH_MEDIA_ERROR="attachMediaError",u.UNKNOWN="unknown",u})({}),ue=(function(u){return u.MEDIA_ATTACHING="hlsMediaAttaching",u.MEDIA_ATTACHED="hlsMediaAttached",u.MEDIA_DETACHING="hlsMediaDetaching",u.MEDIA_DETACHED="hlsMediaDetached",u.MEDIA_ENDED="hlsMediaEnded",u.STALL_RESOLVED="hlsStallResolved",u.BUFFER_RESET="hlsBufferReset",u.BUFFER_CODECS="hlsBufferCodecs",u.BUFFER_CREATED="hlsBufferCreated",u.BUFFER_APPENDING="hlsBufferAppending",u.BUFFER_APPENDED="hlsBufferAppended",u.BUFFER_EOS="hlsBufferEos",u.BUFFERED_TO_END="hlsBufferedToEnd",u.BUFFER_FLUSHING="hlsBufferFlushing",u.BUFFER_FLUSHED="hlsBufferFlushed",u.MANIFEST_LOADING="hlsManifestLoading",u.MANIFEST_LOADED="hlsManifestLoaded",u.MANIFEST_PARSED="hlsManifestParsed",u.LEVEL_SWITCHING="hlsLevelSwitching",u.LEVEL_SWITCHED="hlsLevelSwitched",u.LEVEL_LOADING="hlsLevelLoading",u.LEVEL_LOADED="hlsLevelLoaded",u.LEVEL_UPDATED="hlsLevelUpdated",u.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",u.LEVELS_UPDATED="hlsLevelsUpdated",u.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",u.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",u.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",u.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",u.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",u.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",u.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",u.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",u.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",u.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",u.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",u.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",u.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",u.CUES_PARSED="hlsCuesParsed",u.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",u.INIT_PTS_FOUND="hlsInitPtsFound",u.FRAG_LOADING="hlsFragLoading",u.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",u.FRAG_LOADED="hlsFragLoaded",u.FRAG_DECRYPTED="hlsFragDecrypted",u.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",u.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",u.FRAG_PARSING_METADATA="hlsFragParsingMetadata",u.FRAG_PARSED="hlsFragParsed",u.FRAG_BUFFERED="hlsFragBuffered",u.FRAG_CHANGED="hlsFragChanged",u.FPS_DROP="hlsFpsDrop",u.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",u.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",u.ERROR="hlsError",u.DESTROYING="hlsDestroying",u.KEY_LOADING="hlsKeyLoading",u.KEY_LOADED="hlsKeyLoaded",u.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",u.BACK_BUFFER_REACHED="hlsBackBufferReached",u.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",u.ASSET_LIST_LOADING="hlsAssetListLoading",u.ASSET_LIST_LOADED="hlsAssetListLoaded",u.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",u.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",u.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",u.INTERSTITIAL_STARTED="hlsInterstitialStarted",u.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",u.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",u.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",u.INTERSTITIAL_ENDED="hlsInterstitialEnded",u.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",u.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",u.EVENT_CUE_ENTER="hlsEventCueEnter",u})({});var Un={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},hn={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class ba{constructor(e,t=0,n=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class bE{constructor(e,t,n,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ba(e),this.fast_=new ba(t),this.defaultTTFB_=r,this.ttfb_=new ba(e)}update(e,t){const{slow_:n,fast_:r,ttfb_:i}=this;n.halfLife!==e&&(this.slow_=new ba(e,n.getEstimate(),n.getTotalWeight())),r.halfLife!==t&&(this.fast_=new ba(t,r.getEstimate(),r.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new ba(e,i.getEstimate(),i.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,r=e/1e3,i=n/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function TE(u,e,t){return(e=SE(e))in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function nr(){return nr=Object.assign?Object.assign.bind():function(u){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(u[n]=t[n])}return u},nr.apply(null,arguments)}function Xd(u,e){var t=Object.keys(u);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(u);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(u,r).enumerable})),t.push.apply(t,n)}return t}function Qn(u){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xd(Object(t),!0).forEach(function(n){TE(u,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(t)):Xd(Object(t)).forEach(function(n){Object.defineProperty(u,n,Object.getOwnPropertyDescriptor(t,n))})}return u}function vE(u,e){if(typeof u!="object"||!u)return u;var t=u[Symbol.toPrimitive];if(t!==void 0){var n=t.call(u,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}function SE(u){var e=vE(u,"string");return typeof e=="symbol"?e:e+""}class Qr{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const n=`[${e}]:`;this.trace=$i,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}}const $i=function(){},_E={trace:$i,debug:$i,log:$i,warn:$i,info:$i,error:$i};function xl(){return nr({},_E)}function AE(u,e){const t=self.console[u];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${u}] >`):$i}function Qd(u,e,t){return e[u]?e[u].bind(e):AE(u,t)}const wl=xl();function IE(u,e,t){const n=xl();if(typeof console=="object"&&u===!0||typeof u=="object"){const r=["debug","log","info","warn","error"];r.forEach(i=>{n[i]=Qd(i,u,t)});try{n.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return xl()}r.forEach(i=>{wl[i]=Qd(i,u)})}else nr(wl,n);return n}const Zn=wl;function Ki(u=!0){return typeof self>"u"?void 0:(u||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function xE(u){return typeof self<"u"&&u===self.ManagedMediaSource}function Ih(u,e){const t=Object.keys(u),n=Object.keys(e),r=t.length,i=n.length;return!r||!i||r===i&&!t.some(o=>n.indexOf(o)===-1)}function qr(u,e=!1){if(typeof TextDecoder<"u"){const c=new TextDecoder("utf-8").decode(u);if(e){const g=c.indexOf("\0");return g!==-1?c.substring(0,g):c}return c.replace(/\0/g,"")}const t=u.length;let n,r,i,o="",l=0;for(;l<t;){if(n=u[l++],n===0&&e)return o;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(n);break;case 12:case 13:r=u[l++],o+=String.fromCharCode((n&31)<<6|r&63);break;case 14:r=u[l++],i=u[l++],o+=String.fromCharCode((n&15)<<12|(r&63)<<6|(i&63)<<0);break}}return o}function Ar(u){let e="";for(let t=0;t<u.length;t++){let n=u[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}function xh(u){return Uint8Array.from(u.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function wE(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var Jo={exports:{}},Zd;function RE(){return Zd||(Zd=1,(function(u,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,l={buildAbsoluteURL:function(d,c,g){if(g=g||{},d=d.trim(),c=c.trim(),!c){if(!g.alwaysNormalize)return d;var f=l.parseURL(d);if(!f)throw new Error("Error trying to parse base URL.");return f.path=l.normalizePath(f.path),l.buildURLFromParts(f)}var h=l.parseURL(c);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return g.alwaysNormalize?(h.path=l.normalizePath(h.path),l.buildURLFromParts(h)):c;var y=l.parseURL(d);if(!y)throw new Error("Error trying to parse base URL.");if(!y.netLoc&&y.path&&y.path[0]!=="/"){var E=r.exec(y.path);y.netLoc=E[1],y.path=E[2]}y.netLoc&&!y.path&&(y.path="/");var _={scheme:y.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(_.netLoc=y.netLoc,h.path[0]!=="/"))if(!h.path)_.path=y.path,h.params||(_.params=y.params,h.query||(_.query=y.query));else{var L=y.path,K=L.substring(0,L.lastIndexOf("/")+1)+h.path;_.path=l.normalizePath(K)}return _.path===null&&(_.path=g.alwaysNormalize?l.normalizePath(h.path):h.path),l.buildURLFromParts(_)},parseURL:function(d){var c=n.exec(d);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(d){for(d=d.split("").reverse().join("").replace(i,"");d.length!==(d=d.replace(o,"")).length;);return d.split("").reverse().join("")},buildURLFromParts:function(d){return d.scheme+d.netLoc+d.path+d.params+d.query+d.fragment}};u.exports=l})()})(Jo)),Jo.exports}var Kl=RE();class Yl{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var rr={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class wh{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,CE(this,"stats")}setByteRange(e,t){const n=e.split("@",2);let r;n.length===1?r=t?.byteRangeEndOffset||0:r=parseInt(n[1]),this._byteRange=[r,parseInt(n[0])+r]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[rr.AUDIO]:null,[rr.VIDEO]:null,[rr.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new Yl),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Kl.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[rr.AUDIO]=null,e[rr.VIDEO]=null,e[rr.AUDIOVIDEO]=null}}function cr(u){return u.sn!=="initSegment"}class el extends wh{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(on(e)&&on(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const n=Object.keys(t);if(n.length===1){const r=this._decryptdata=t[n[0]]||null;r&&(this._decryptdata=r.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=on(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const n=Object.keys(this.levelkeys),r=n.length;if(r>1||r===1&&(t=this.levelkeys[n[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!on(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return cr(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var n;const r=t[e];r&&!((n=this._decryptdata)!=null&&n.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,n,r,i,o=!1){const{elementaryStreams:l}=this,d=l[e];if(!d){l[e]={startPTS:t,endPTS:n,startDTS:r,endDTS:i,partial:o};return}d.startPTS=Math.min(d.startPTS,t),d.endPTS=Math.max(d.endPTS,n),d.startDTS=Math.min(d.startDTS,r),d.endDTS=Math.max(d.endDTS,i)}}class kE extends wh{constructor(e,t,n,r,i){super(n),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,i),i&&(this.fragOffset=i.fragOffset+i.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function Rh(u,e){const t=Object.getPrototypeOf(u);if(t){const n=Object.getOwnPropertyDescriptor(t,e);return n||Rh(t,e)}}function CE(u,e){const t=Rh(u,e);t&&(t.enumerable=!0,Object.defineProperty(u,e,t))}const Jd=Math.pow(2,32)-1,LE=[].push,kh={video:1,audio:2,id3:3,text:4};function pr(u){return String.fromCharCode.apply(null,u)}function Ch(u,e){const t=u[e]<<8|u[e+1];return t<0?65536+t:t}function Cn(u,e){const t=Lh(u,e);return t<0?4294967296+t:t}function ef(u,e){let t=Cn(u,e);return t*=Math.pow(2,32),t+=Cn(u,e+4),t}function Lh(u,e){return u[e]<<24|u[e+1]<<16|u[e+2]<<8|u[e+3]}function DE(u){const e=u.byteLength;for(let t=0;t<e;){const n=Cn(u,t);if(n>8&&u[t+4]===109&&u[t+5]===111&&u[t+6]===111&&u[t+7]===102)return!0;t=n>1?t+n:e}return!1}function On(u,e){const t=[];if(!e.length)return t;const n=u.byteLength;for(let r=0;r<n;){const i=Cn(u,r),o=pr(u.subarray(r+4,r+8)),l=i>1?r+i:n;if(o===e[0])if(e.length===1)t.push(u.subarray(r+8,l));else{const d=On(u.subarray(r+8,l),e.slice(1));d.length&&LE.apply(t,d)}r=l}return t}function PE(u){const e=[],t=u[0];let n=8;const r=Cn(u,n);n+=4;let i=0,o=0;t===0?(i=Cn(u,n),o=Cn(u,n+4),n+=8):(i=ef(u,n),o=ef(u,n+8),n+=16),n+=2;let l=u.length+o;const d=Ch(u,n);n+=2;for(let c=0;c<d;c++){let g=n;const f=Cn(u,g);g+=4;const h=f&2147483647;if((f&2147483648)>>>31===1)return Zn.warn("SIDX has hierarchical references (not supported)"),null;const E=Cn(u,g);g+=4,e.push({referenceSize:h,subsegmentDuration:E,info:{duration:E/r,start:l,end:l+h-1}}),l+=h,g+=4,n=g}return{earliestPresentationTime:i,timescale:r,version:t,referencesCount:d,references:e}}function Dh(u){const e=[],t=On(u,["moov","trak"]);for(let r=0;r<t.length;r++){const i=t[r],o=On(i,["tkhd"])[0];if(o){let l=o[0];const d=Cn(o,l===0?12:20),c=On(i,["mdia","mdhd"])[0];if(c){l=c[0];const g=Cn(c,l===0?12:20),f=On(i,["mdia","hdlr"])[0];if(f){const h=pr(f.subarray(8,12)),y={soun:rr.AUDIO,vide:rr.VIDEO}[h],E=On(i,["mdia","minf","stbl","stsd"])[0],_=NE(E);y?(e[d]={timescale:g,type:y,stsd:_},e[y]=Qn({timescale:g,id:d},_)):e[d]={timescale:g,type:h,stsd:_}}}}}return On(u,["moov","mvex","trex"]).forEach(r=>{const i=Cn(r,4),o=e[i];o&&(o.default={duration:Cn(r,12),flags:Cn(r,20)})}),e}function NE(u){const e=u.subarray(8),t=e.subarray(86),n=pr(e.subarray(4,8));let r=n,i;const o=n==="enca"||n==="encv";if(o){const c=On(e,[n])[0].subarray(n==="enca"?28:78);On(c,["sinf"]).forEach(f=>{const h=On(f,["schm"])[0];if(h){const y=pr(h.subarray(4,8));if(y==="cbcs"||y==="cenc"){const E=On(f,["frma"])[0];E&&(r=pr(E))}}})}const l=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const d=On(t,["avcC"])[0];d&&d.length>3&&(r+="."+Ps(d[1])+Ps(d[2])+Ps(d[3]),i=Ds(l==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const d=On(e,[n])[0],c=On(d.subarray(28),["esds"])[0];if(c&&c.length>7){let g=4;if(c[g++]!==3)break;g=tl(c,g),g+=2;const f=c[g++];if(f&128&&(g+=2),f&64&&(g+=c[g++]),c[g++]!==4)break;g=tl(c,g);const h=c[g++];if(h===64)r+="."+Ps(h);else break;if(g+=12,c[g++]!==5)break;g=tl(c,g);const y=c[g++];let E=(y&248)>>3;E===31&&(E+=1+((y&7)<<3)+((c[g]&224)>>5)),r+="."+E}break}case"hvc1":case"hev1":{const d=On(t,["hvcC"])[0];if(d&&d.length>12){const c=d[1],g=["","A","B","C"][c>>6],f=c&31,h=Cn(d,2),y=(c&32)>>5?"H":"L",E=d[12],_=d.subarray(6,12);r+="."+g+f,r+="."+ME(h).toString(16).toUpperCase(),r+="."+y+E;let L="";for(let K=_.length;K--;){const Z=_[K];(Z||L)&&(L="."+Z.toString(16).toUpperCase()+L)}r+=L}i=Ds(l=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=Ds(r,t)||r;break}case"vp09":{const d=On(t,["vpcC"])[0];if(d&&d.length>6){const c=d[4],g=d[5],f=d[6]>>4&15;r+="."+pi(c)+"."+pi(g)+"."+pi(f)}break}case"av01":{const d=On(t,["av1C"])[0];if(d&&d.length>2){const c=d[1]>>>5,g=d[1]&31,f=d[2]>>>7?"H":"M",h=(d[2]&64)>>6,y=(d[2]&32)>>5,E=c===2&&h?y?12:10:h?10:8,_=(d[2]&16)>>4,L=(d[2]&8)>>3,K=(d[2]&4)>>2,Z=d[2]&3;r+="."+c+"."+pi(g)+f+"."+pi(E)+"."+_+"."+L+K+Z+"."+pi(1)+"."+pi(1)+"."+pi(1)+"."+0,i=Ds("dav1",t)}break}}return{codec:r,encrypted:o,supplemental:i}}function Ds(u,e){const t=On(e,["dvvC"]),n=t.length?t[0]:On(e,["dvcC"])[0];if(n){const r=n[2]>>1&127,i=n[2]<<5&32|n[3]>>3&31;return u+"."+pi(r)+"."+pi(i)}}function ME(u){let e=0;for(let t=0;t<32;t++)e|=(u>>t&1)<<31-t;return e>>>0}function tl(u,e){const t=e+5;for(;u[e++]&128&&e<t;);return e}function Ps(u){return("0"+u.toString(16).toUpperCase()).slice(-2)}function pi(u){return(u<10?"0":"")+u}function OE(u,e){if(!u||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&Ph(u,(n,r)=>{const i=n.subarray(8,24);i.some(o=>o!==0)||(Zn.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${Ar(i)} -> ${Ar(t)}`),n.set(t,8))})}function FE(u){const e=[];return Ph(u,t=>e.push(t.subarray(8,24))),e}function Ph(u,e){On(u,["moov","trak"]).forEach(n=>{const r=On(n,["mdia","minf","stbl","stsd"])[0];if(!r)return;const i=r.subarray(8);let o=On(i,["enca"]);const l=o.length>0;l||(o=On(i,["encv"])),o.forEach(d=>{const c=l?d.subarray(28):d.subarray(78);On(c,["sinf"]).forEach(f=>{const h=Nh(f);h&&e(h,l)})})})}function Nh(u){const e=On(u,["schm"])[0];if(e){const t=pr(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const n=On(u,["schi","tenc"])[0];if(n)return n}}}function UE(u,e,t){const n={},r=On(u,["moof","traf"]);for(let i=0;i<r.length;i++){const o=r[i],l=On(o,["tfhd"])[0],d=Cn(l,4),c=e[d];if(!c)continue;n[d]||(n[d]={start:NaN,duration:0,sampleCount:0,timescale:c.timescale,type:c.type});const g=n[d],f=On(o,["tfdt"])[0];if(f){const ae=f[0];let pe=Cn(f,4);ae===1&&(pe===Jd?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(pe*=Jd+1,pe+=Cn(f,8))),on(pe)&&(!on(g.start)||pe<g.start)&&(g.start=pe)}const h=c.default,y=Cn(l,0)|h?.flags;let E=h?.duration||0;y&8&&(y&2?E=Cn(l,12):E=Cn(l,8));const _=On(o,["trun"]);let L=g.start||0,K=0,Z=E;for(let ae=0;ae<_.length;ae++){const pe=_[ae],xe=Cn(pe,4),ke=g.sampleCount;g.sampleCount+=xe;const Y=pe[3]&1,J=pe[3]&4,he=pe[2]&1,Ee=pe[2]&2,Le=pe[2]&4,et=pe[2]&8;let Ae=8,Ze=xe;for(Y&&(Ae+=4),J&&xe&&(!(pe[Ae+1]&1)&&g.keyFrameIndex===void 0&&(g.keyFrameIndex=ke),Ae+=4,he?(Z=Cn(pe,Ae),Ae+=4):Z=E,Ee&&(Ae+=4),et&&(Ae+=4),L+=Z,K+=Z,Ze--);Ze--;)he?(Z=Cn(pe,Ae),Ae+=4):Z=E,Ee&&(Ae+=4),Le&&(pe[Ae+1]&1||g.keyFrameIndex===void 0&&(g.keyFrameIndex=g.sampleCount-(Ze+1),g.keyFrameStart=L),Ae+=4),et&&(Ae+=4),L+=Z,K+=Z;!K&&E&&(K+=E*xe)}g.duration+=K}if(!Object.keys(n).some(i=>n[i].duration)){let i=1/0,o=0;const l=On(u,["sidx"]);for(let d=0;d<l.length;d++){const c=PE(l[d]);if(c!=null&&c.references){i=Math.min(i,c.earliestPresentationTime/c.timescale);const g=c.references.reduce((f,h)=>f+h.info.duration||0,0);o=Math.max(o,g+c.earliestPresentationTime/c.timescale)}}o&&on(o)&&Object.keys(n).forEach(d=>{n[d].duration||(n[d].duration=o*n[d].timescale-n[d].start)})}return n}function zE(u){const e={valid:null,remainder:null},t=On(u,["moof"]);if(t.length<2)return e.remainder=u,e;const n=t[t.length-1];return e.valid=u.slice(0,n.byteOffset-8),e.remainder=u.slice(n.byteOffset-8),e}function Wr(u,e){const t=new Uint8Array(u.length+e.length);return t.set(u),t.set(e,u.length),t}function tf(u,e){const t=[],n=e.samples,r=e.timescale,i=e.id;let o=!1;return On(n,["moof"]).map(d=>{const c=d.byteOffset-8;On(d,["traf"]).map(f=>{const h=On(f,["tfdt"]).map(y=>{const E=y[0];let _=Cn(y,4);return E===1&&(_*=Math.pow(2,32),_+=Cn(y,8)),_/r})[0];return h!==void 0&&(u=h),On(f,["tfhd"]).map(y=>{const E=Cn(y,4),_=Cn(y,0)&16777215,L=(_&1)!==0,K=(_&2)!==0,Z=(_&8)!==0;let ae=0;const pe=(_&16)!==0;let xe=0;const ke=(_&32)!==0;let Y=8;E===i&&(L&&(Y+=8),K&&(Y+=4),Z&&(ae=Cn(y,Y),Y+=4),pe&&(xe=Cn(y,Y),Y+=4),ke&&(Y+=4),e.type==="video"&&(o=go(e.codec)),On(f,["trun"]).map(J=>{const he=J[0],Ee=Cn(J,0)&16777215,Le=(Ee&1)!==0;let et=0;const Ae=(Ee&4)!==0,Ze=(Ee&256)!==0;let Be=0;const Ne=(Ee&512)!==0;let tt=0;const mt=(Ee&1024)!==0,Ge=(Ee&2048)!==0;let ut=0;const Xe=Cn(J,4);let nt=8;Le&&(et=Cn(J,nt),nt+=4),Ae&&(nt+=4);let Ft=et+c;for(let Xt=0;Xt<Xe;Xt++){if(Ze?(Be=Cn(J,nt),nt+=4):Be=ae,Ne?(tt=Cn(J,nt),nt+=4):tt=xe,mt&&(nt+=4),Ge&&(he===0?ut=Cn(J,nt):ut=Lh(J,nt),nt+=4),e.type===rr.VIDEO){let Pe=0;for(;Pe<tt;){const De=Cn(n,Ft);if(Ft+=4,BE(o,n[Ft])){const dt=n.subarray(Ft,Ft+De);Wl(dt,o?2:1,u+ut/r,t)}Ft+=De,Pe+=De+4}}u+=Be/r}}))})})}),t}function go(u){if(!u)return!1;const e=u.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function BE(u,e){if(u){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Wl(u,e,t,n){const r=Mh(u);let i=0;i+=e;let o=0,l=0,d=0;for(;i<r.length;){o=0;do{if(i>=r.length)break;d=r[i++],o+=d}while(d===255);l=0;do{if(i>=r.length)break;d=r[i++],l+=d}while(d===255);const c=r.length-i;let g=i;if(l<c)i+=l;else if(l>c){Zn.error(`Malformed SEI payload. ${l} is too small, only ${c} bytes left to parse.`);break}if(o===4){if(r[g++]===181){const h=Ch(r,g);if(g+=2,h===49){const y=Cn(r,g);if(g+=4,y===1195456820){const E=r[g++];if(E===3){const _=r[g++],L=31&_,K=64&_,Z=K?2+L*3:0,ae=new Uint8Array(Z);if(K){ae[0]=_;for(let pe=1;pe<Z;pe++)ae[pe]=r[g++]}n.push({type:E,payloadType:o,pts:t,bytes:ae})}}}}}else if(o===5&&l>16){const f=[];for(let E=0;E<16;E++){const _=r[g++].toString(16);f.push(_.length==1?"0"+_:_),(E===3||E===5||E===7||E===9)&&f.push("-")}const h=l-16,y=new Uint8Array(h);for(let E=0;E<h;E++)y[E]=r[g++];n.push({payloadType:o,pts:t,uuid:f.join(""),userData:qr(y),userDataBytes:y})}}}function Mh(u){const e=u.byteLength,t=[];let n=1;for(;n<e-2;)u[n]===0&&u[n+1]===0&&u[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return u;const r=e-t.length,i=new Uint8Array(r);let o=0;for(n=0;n<r;o++,n++)o===t[0]&&(o++,t.shift()),i[n]=u[o];return i}function jE(u){const e=u[0];let t="",n="",r=0,i=0,o=0,l=0,d=0,c=0;if(e===0){for(;pr(u.subarray(c,c+1))!=="\0";)t+=pr(u.subarray(c,c+1)),c+=1;for(t+=pr(u.subarray(c,c+1)),c+=1;pr(u.subarray(c,c+1))!=="\0";)n+=pr(u.subarray(c,c+1)),c+=1;n+=pr(u.subarray(c,c+1)),c+=1,r=Cn(u,12),i=Cn(u,16),l=Cn(u,20),d=Cn(u,24),c=28}else if(e===1){c+=4,r=Cn(u,c),c+=4;const f=Cn(u,c);c+=4;const h=Cn(u,c);for(c+=4,o=2**32*f+h,yE(o)||(o=Number.MAX_SAFE_INTEGER,Zn.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=Cn(u,c),c+=4,d=Cn(u,c),c+=4;pr(u.subarray(c,c+1))!=="\0";)t+=pr(u.subarray(c,c+1)),c+=1;for(t+=pr(u.subarray(c,c+1)),c+=1;pr(u.subarray(c,c+1))!=="\0";)n+=pr(u.subarray(c,c+1)),c+=1;n+=pr(u.subarray(c,c+1)),c+=1}const g=u.subarray(c,u.byteLength);return{schemeIdUri:t,value:n,timeScale:r,presentationTime:o,presentationTimeDelta:i,eventDuration:l,id:d,payload:g}}function qE(u,...e){const t=e.length;let n=8,r=t;for(;r--;)n+=e[r].byteLength;const i=new Uint8Array(n);for(i[0]=n>>24&255,i[1]=n>>16&255,i[2]=n>>8&255,i[3]=n&255,i.set(u,4),r=0,n=8;r<t;r++)i.set(e[r],n),n+=e[r].byteLength;return i}function GE(u,e,t){if(u.byteLength!==16)throw new RangeError("Invalid system id");let n,r;n=0,r=new Uint8Array;let i;n>0?(i=new Uint8Array(4),e.length>0&&new DataView(i.buffer).setUint32(0,e.length,!1)):i=new Uint8Array;const o=new Uint8Array(4);return t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),qE([112,115,115,104],new Uint8Array([n,0,0,0]),u,i,r,o,t)}function $E(u){const e=[];if(u instanceof ArrayBuffer){const t=u.byteLength;let n=0;for(;n+32<t;){const r=new DataView(u,n),i=VE(r);e.push(i),n+=i.size}}return e}function VE(u){const e=u.getUint32(0),t=u.byteOffset,n=u.byteLength;if(n<e)return{offset:t,size:n};if(u.getUint32(4)!==1886614376)return{offset:t,size:e};const i=u.getUint32(8)>>>24;if(i!==0&&i!==1)return{offset:t,size:e};const o=u.buffer,l=Ar(new Uint8Array(o,t+12,16));let d=null,c=null,g=0;if(i===0)g=28;else{const h=u.getUint32(28);if(!h||n<32+h*16)return{offset:t,size:e};d=[];for(let y=0;y<h;y++)d.push(new Uint8Array(o,t+32+y*16,16));g=32+h*16}if(!g)return{offset:t,size:e};const f=u.getUint32(g);return e-32<f?{offset:t,size:e}:(c=new Uint8Array(o,t+g+4,f),{version:i,systemId:l,kids:d,data:c,offset:t,size:e})}const Oh=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),La={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Xl(u,e){const t=La[e];return!!t&&!!t[u.slice(0,4)]}function Za(u,e,t=!0){return!u.split(",").some(n=>!Ql(n,e,t))}function Ql(u,e,t=!0){var n;const r=Ki(t);return(n=r?.isTypeSupported(Ja(u,e)))!=null?n:!1}function Ja(u,e){return`${e}/mp4;codecs=${u}`}function nf(u){if(u){const e=u.substring(0,4);return La.video[e]}return 2}function no(u){const e=Oh();return u.split(",").reduce((t,n)=>{const i=e&&go(n)?9:La.video[n];return i?(i*2+t)/(t?3:2):(La.audio[n]+t)/(t?2:1)},0)}const nl={};function HE(u,e=!0){if(nl[u])return nl[u];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[u];for(let r=0;r<t.length;r++){var n;if(Ql(t[r],"audio",e))return nl[u]=t[r],t[r];if(t[r]==="mp3"&&(n=Ki(e))!=null&&n.isTypeSupported("audio/mpeg"))return""}return u}const KE=/flac|opus|mp4a\.40\.34/i;function ro(u,e=!0){return u.replace(KE,t=>HE(t.toLowerCase(),e))}function YE(u,e){const t=[];if(u){const n=u.split(",");for(let r=0;r<n.length;r++)Xl(n[r],"video")||t.push(n[r])}return e&&t.push(e),t.join(",")}function Ks(u,e){if(u&&(u.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(u)!==-1)&&(rf(u,"audio")||rf(u,"video")))return u;if(e){const t=e.split(",");if(t.length>1){if(u){for(let n=t.length;n--;)if(t[n].substring(0,4)===u.substring(0,4))return t[n]}return t[0]}}return e||u}function rf(u,e){return Xl(u,e)&&Ql(u,e)}function WE(u){const e=u.split(",");for(let t=0;t<e.length;t++){const n=e[t].split(".");n.length>2&&n[0]==="avc1"&&(e[t]=`avc1.${parseInt(n[1]).toString(16)}${("000"+parseInt(n[2]).toString(16)).slice(-4)}`)}return e.join(",")}function XE(u){if(u.startsWith("av01.")){const e=u.split("."),t=["0","111","01","01","01","0"];for(let n=e.length;n>4&&n<10;n++)e[n]=t[n-4];return e.join(".")}return u}function af(u){const e=Ki(u)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Rl(u){return u.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const QE={supported:!0,powerEfficient:!0,smooth:!0},ZE={supported:!1,smooth:!1,powerEfficient:!1},Fh={supported:!0,configurations:[],decodingInfoResults:[QE]};function Uh(u,e){return{supported:!1,configurations:e,decodingInfoResults:[ZE],error:u}}function JE(u,e,t,n,r,i){const o=u.videoCodec,l=u.audioCodec?u.audioGroups:null,d=i?.audioCodec,c=i?.channels,g=c?parseInt(c):d?1/0:2;let f=null;if(l!=null&&l.length)try{l.length===1&&l[0]?f=e.groups[l[0]].channels:f=l.reduce((h,y)=>{if(y){const E=e.groups[y];if(!E)throw new Error(`Audio track group ${y} not found`);Object.keys(E.channels).forEach(_=>{h[_]=(h[_]||0)+E.channels[_]})}return h},{2:0})}catch{return!0}return o!==void 0&&(o.split(",").some(h=>go(h))||u.width>1920&&u.height>1088||u.height>1920&&u.width>1088||u.frameRate>Math.max(n,30)||u.videoRange!=="SDR"&&u.videoRange!==t||u.bitrate>Math.max(r,8e6))||!!f&&on(g)&&Object.keys(f).some(h=>parseInt(h)>g)}function zh(u,e,t,n={}){const r=u.videoCodec;if(!r&&!u.audioCodec||!t)return Promise.resolve(Fh);const i=[],o=eb(u),l=o.length,d=tb(u,e,l>0),c=d.length;for(let g=l||1*c||1;g--;){const f={type:"media-source"};if(l&&(f.video=o[g%l]),c){f.audio=d[g%c];const h=f.audio.bitrate;f.video&&h&&(f.video.bitrate-=h)}i.push(f)}if(r){const g=navigator.userAgent;if(r.split(",").some(f=>go(f))&&Oh())return Promise.resolve(Uh(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${g})`),i))}return Promise.all(i.map(g=>{const f=rb(g);return n[f]||(n[f]=t.decodingInfo(g))})).then(g=>({supported:!g.some(f=>!f.supported),configurations:i,decodingInfoResults:g})).catch(g=>({supported:!1,configurations:i,decodingInfoResults:[],error:g}))}function eb(u){var e;const t=(e=u.videoCodec)==null?void 0:e.split(","),n=Bh(u),r=u.width||640,i=u.height||480,o=u.frameRate||30,l=u.videoRange.toLowerCase();return t?t.map(d=>{const c={contentType:Ja(XE(d),"video"),width:r,height:i,bitrate:n,framerate:o};return l!=="sdr"&&(c.transferFunction=l),c}):[]}function tb(u,e,t){var n;const r=(n=u.audioCodec)==null?void 0:n.split(","),i=Bh(u);return r&&u.audioGroups?u.audioGroups.reduce((o,l)=>{var d;const c=l?(d=e.groups[l])==null?void 0:d.tracks:null;return c?c.reduce((g,f)=>{if(f.groupId===l){const h=parseFloat(f.channels||"");r.forEach(y=>{const E={contentType:Ja(y,"audio"),bitrate:t?nb(y,i):i};h&&(E.channels=""+h),g.push(E)})}return g},o):o},[]):[]}function nb(u,e){if(e<=1)return 1;let t=128e3;return u==="ec-3"?t=768e3:u==="ac-3"&&(t=64e4),Math.min(e/2,t)}function Bh(u){return Math.ceil(Math.max(u.bitrate*.9,u.averageBitrate)/1e3)*1e3||1}function rb(u){let e="";const{audio:t,video:n}=u;if(n){const r=Rl(n.contentType);e+=`${r}_r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction||"sd"}_${Math.ceil(n.bitrate/1e5)}`}if(t){const r=Rl(t.contentType);e+=`${n?"_":""}${r}_c${t.channels}`}return e}const kl=["NONE","TYPE-0","TYPE-1",null];function ib(u){return kl.indexOf(u)>-1}const io=["SDR","PQ","HLG"];function ab(u){return!!u&&io.indexOf(u)>-1}var Ys={No:"",Yes:"YES",v2:"v2"};function sf(u){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=u,r=n<e/2;return e&&r?t?Ys.v2:Ys.Yes:Ys.No}class of{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class es{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(n=>!!n).map(n=>n.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const n=(t=e.supplemental)==null?void 0:t.videoCodec;n&&n!==e.videoCodec&&(this.codecSet+=`,${n.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return lf(this._audioGroups,e)}hasSubtitleGroup(e){return lf(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function lf(u,e){return!e||!u?!1:u.indexOf(e)!==-1}function sb(){if(typeof matchMedia=="function"){const u=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(u.media!==e.media)return u.matches===!0}return!1}function ob(u,e){let t=!1,n=[];if(u&&(t=u!=="SDR",n=[u]),e){n=e.allowedVideoRanges||io.slice(0);const r=n.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&sb(),t||(n=["SDR"])}return{preferHDR:t,allowedVideoRanges:n}}const lb=u=>{const e=new WeakSet;return(t,n)=>{if(u&&(n=u(t,n)),typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}},ir=(u,e)=>JSON.stringify(u,lb(e));function ub(u,e,t,n,r){const i=Object.keys(u),o=n?.channels,l=n?.audioCodec,d=r?.videoCodec,c=o&&parseInt(o)===2;let g=!1,f=!1,h=1/0,y=1/0,E=1/0,_=1/0,L=0,K=[];const{preferHDR:Z,allowedVideoRanges:ae}=ob(e,r);for(let J=i.length;J--;){const he=u[i[J]];g||(g=he.channels[2]>0),h=Math.min(h,he.minHeight),y=Math.min(y,he.minFramerate),E=Math.min(E,he.minBitrate),ae.filter(Le=>he.videoRanges[Le]>0).length>0&&(f=!0)}h=on(h)?h:0,y=on(y)?y:0;const pe=Math.max(1080,h),xe=Math.max(30,y);E=on(E)?E:t,t=Math.max(E,t),f||(e=void 0);const ke=i.length>1;return{codecSet:i.reduce((J,he)=>{const Ee=u[he];if(he===J)return J;if(K=f?ae.filter(Le=>Ee.videoRanges[Le]>0):[],ke){if(Ee.minBitrate>t)return gi(he,`min bitrate of ${Ee.minBitrate} > current estimate of ${t}`),J;if(!Ee.hasDefaultAudio)return gi(he,"no renditions with default or auto-select sound found"),J;if(l&&he.indexOf(l.substring(0,4))%5!==0)return gi(he,`audio codec preference "${l}" not found`),J;if(o&&!c){if(!Ee.channels[o])return gi(he,`no renditions with ${o} channel sound found (channels options: ${Object.keys(Ee.channels)})`),J}else if((!l||c)&&g&&Ee.channels[2]===0)return gi(he,"no renditions with stereo sound found"),J;if(Ee.minHeight>pe)return gi(he,`min resolution of ${Ee.minHeight} > maximum of ${pe}`),J;if(Ee.minFramerate>xe)return gi(he,`min framerate of ${Ee.minFramerate} > maximum of ${xe}`),J;if(!K.some(Le=>Ee.videoRanges[Le]>0))return gi(he,`no variants with VIDEO-RANGE of ${ir(K)} found`),J;if(d&&he.indexOf(d.substring(0,4))%5!==0)return gi(he,`video codec preference "${d}" not found`),J;if(Ee.maxScore<L)return gi(he,`max score of ${Ee.maxScore} < selected max of ${L}`),J}return J&&(no(he)>=no(J)||Ee.fragmentError>u[J].fragmentError)?J:(_=Ee.minIndex,L=Ee.maxScore,he)},void 0),videoRanges:K,preferHDR:Z,minFramerate:y,minBitrate:E,minIndex:_}}function gi(u,e){Zn.log(`[abr] start candidates with "${u}" ignored because ${e}`)}function jh(u){return u.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const r=t.channels||"2";return n.channels[r]=(n.channels[r]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function cb(u,e,t,n){return u.slice(t,n+1).reduce((r,i,o)=>{if(!i.codecSet)return r;const l=i.audioGroups;let d=r[i.codecSet];d||(r[i.codecSet]=d={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:o,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!l,fragmentError:0}),d.minBitrate=Math.min(d.minBitrate,i.bitrate);const c=Math.min(i.height,i.width);return d.minHeight=Math.min(d.minHeight,c),d.minFramerate=Math.min(d.minFramerate,i.frameRate),d.minIndex=Math.min(d.minIndex,o),d.maxScore=Math.max(d.maxScore,i.score),d.fragmentError+=i.fragmentError,d.videoRanges[i.videoRange]=(d.videoRanges[i.videoRange]||0)+1,l&&l.forEach(g=>{if(!g)return;const f=e.groups[g];f&&(d.hasDefaultAudio=d.hasDefaultAudio||e.hasDefaultAudio?f.hasDefault:f.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(f.channels).forEach(h=>{d.channels[h]=(d.channels[h]||0)+f.channels[h]}))}),r},{})}function uf(u){if(!u)return u;const{lang:e,assocLang:t,characteristics:n,channels:r,audioCodec:i}=u;return{lang:e,assocLang:t,characteristics:n,channels:r,audioCodec:i}}function Ei(u,e,t){if("attrs"in u){const n=e.indexOf(u);if(n!==-1)return n}for(let n=0;n<e.length;n++){const r=e[n];if(la(u,r,t))return n}return-1}function la(u,e,t){const{groupId:n,name:r,lang:i,assocLang:o,default:l}=u,d=u.forced;return(n===void 0||e.groupId===n)&&(r===void 0||e.name===r)&&(i===void 0||db(i,e.lang))&&(i===void 0||e.assocLang===o)&&(l===void 0||e.default===l)&&(d===void 0||e.forced===d)&&(!("characteristics"in u)||fb(u.characteristics||"",e.characteristics))&&(t===void 0||t(u,e))}function db(u,e="--"){return u.length===e.length?u===e:u.startsWith(e)||e.startsWith(u)}function fb(u,e=""){const t=u.split(","),n=e.split(",");return t.length===n.length&&!t.some(r=>n.indexOf(r)===-1)}function sa(u,e){const{audioCodec:t,channels:n}=u;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function hb(u,e,t,n,r){const i=e[n],l=e.reduce((h,y,E)=>{const _=y.uri;return(h[_]||(h[_]=[])).push(E),h},{})[i.uri];l.length>1&&(n=Math.max.apply(Math,l));const d=i.videoRange,c=i.frameRate,g=i.codecSet.substring(0,4),f=cf(e,n,h=>{if(h.videoRange!==d||h.frameRate!==c||h.codecSet.substring(0,4)!==g)return!1;const y=h.audioGroups,E=t.filter(_=>!y||y.indexOf(_.groupId)!==-1);return Ei(u,E,r)>-1});return f>-1?f:cf(e,n,h=>{const y=h.audioGroups,E=t.filter(_=>!y||y.indexOf(_.groupId)!==-1);return Ei(u,E,r)>-1})}function cf(u,e,t){for(let n=e;n>-1;n--)if(t(u[n]))return n;for(let n=e+1;n<u.length;n++)if(t(u[n]))return n;return-1}function ao(u,e){var t;return!!u&&u!==((t=e.loadLevelObj)==null?void 0:t.uri)}class gb extends Qr{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var n;const{fragCurrent:r,partCurrent:i,hls:o}=this,{autoLevelEnabled:l,media:d}=o;if(!r||!d)return;const c=performance.now(),g=i?i.stats:r.stats,f=i?i.duration:r.duration,h=c-g.loading.start,y=o.minAutoLevel,E=r.level,_=this._nextAutoLevel;if(g.aborted||g.loaded&&g.loaded===g.total||E<=y){this.clearTimer(),this._nextAutoLevel=-1;return}if(!l)return;const L=_>-1&&_!==E,K=!!t||L;if(!K&&(d.paused||!d.playbackRate||!d.readyState))return;const Z=o.mainForwardBufferInfo;if(!K&&Z===null)return;const ae=this.bwEstimator.getEstimateTTFB(),pe=Math.abs(d.playbackRate);if(h<=Math.max(ae,1e3*(f/(pe*2))))return;const xe=Z?Z.len/pe:0,ke=g.loading.first?g.loading.first-g.loading.start:-1,Y=g.loaded&&ke>-1,J=this.getBwEstimate(),he=o.levels,Ee=he[E],Le=Math.max(g.loaded,Math.round(f*(r.bitrate||Ee.averageBitrate)/8));let et=Y?h-ke:h;et<1&&Y&&(et=Math.min(h,g.loaded*8/J));const Ae=Y?g.loaded*1e3/et:0,Ze=ae/1e3,Be=Ae?(Le-g.loaded)/Ae:Le*8/J+Ze;if(Be<=xe)return;const Ne=Ae?Ae*8:J,tt=((n=t?.details||this.hls.latestLevelDetails)==null?void 0:n.live)===!0,mt=this.hls.config.abrBandWidthUpFactor;let Ge=Number.POSITIVE_INFINITY,ut;for(ut=E-1;ut>y;ut--){const Xt=he[ut].maxBitrate,Pe=!he[ut].details||tt;if(Ge=this.getTimeToLoadFrag(Ze,Ne,f*Xt,Pe),Ge<Math.min(xe,f+Ze))break}if(Ge>=Be||Ge>f*10)return;Y?this.bwEstimator.sample(h-Math.min(ae,ke),g.loaded):this.bwEstimator.sampleTTFB(h);const Xe=he[ut].maxBitrate;this.getBwEstimate()*mt>Xe&&this.resetEstimator(Xe);const nt=this.findBestLevel(Xe,y,ut,0,xe,1,1);nt>-1&&(ut=nt),this.warn(`Fragment ${r.sn}${i?" part "+i.index:""} of level ${E} is loading too slowly;
|
|
2
|
+
Fragment duration: ${r.duration.toFixed(3)}
|
|
3
|
+
Time to underbuffer: ${xe.toFixed(3)} s
|
|
4
|
+
Estimated load time for current fragment: ${Be.toFixed(3)} s
|
|
5
|
+
Estimated load time for down switch fragment: ${Ge.toFixed(3)} s
|
|
6
|
+
TTFB estimate: ${ke|0} ms
|
|
7
|
+
Current BW estimate: ${on(J)?J|0:"Unknown"} bps
|
|
8
|
+
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
9
|
+
Switching to level ${ut} @ ${Xe|0} bps`),o.nextLoadLevel=o.nextAutoLevel=ut,this.clearTimer();const Ft=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===ut&&ut>0){const Xt=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${ut>0?"and switching down":""}
|
|
10
|
+
Fragment duration: ${r.duration.toFixed(3)} s
|
|
11
|
+
Time to underbuffer: ${Xt.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,ut>y){let Pe=this.findBestLevel(this.hls.levels[y].bitrate,y,ut,0,Xt,1,1);Pe===-1&&(Pe=y),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Pe,this.resetEstimator(this.hls.levels[Pe].bitrate)}}};L||Be>Ge*2?Ft():this.timer=self.setInterval(Ft,Ge*1e3),o.trigger(ue.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:i,stats:g})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new bE(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.FRAG_LOADING,this.onFragLoading,this),e.on(ue.FRAG_LOADED,this.onFragLoaded,this),e.on(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.on(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.on(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(ue.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.FRAG_LOADING,this.onFragLoading,this),e.off(ue.FRAG_LOADED,this.onFragLoaded,this),e.off(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.off(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.off(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(ue.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(ue.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const n=t.frag;if(!this.ignoreFragment(n)){if(!n.bitrateTest){var r;this.fragCurrent=n,this.partCurrent=(r=t.part)!=null?r:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case lt.BUFFER_ADD_CODEC_ERROR:case lt.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case lt.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:r,partCurrent:i}=this;if(n&&r&&n.sn===r.sn&&n.level===r.level){const o=performance.now(),l=i?i.stats:n.stats,d=o-l.loading.start,c=l.loading.first?l.loading.first-l.loading.start:-1;if(l.loaded&&c>-1){const f=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(d-Math.min(f,c),l.loaded)}else this.bwEstimator.sampleTTFB(d)}break}}}getTimeToLoadFrag(e,t,n,r){const i=e+n/t,o=r?e+this.lastLevelLoadSec:0;return i+o}onLevelLoaded(e,t){const n=this.hls.config,{loading:r}=t.stats,i=r.end-r.first;on(i)&&(this.lastLevelLoadSec=i/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:n}){const r=n?n.stats:t.stats;if(t.type===hn.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const i=n?n.duration:t.duration,o=this.hls.levels[t.level],l=(o.loaded?o.loaded.bytes:0)+r.loaded,d=(o.loaded?o.loaded.duration:0)+i;o.loaded={bytes:l,duration:d},o.realBitrate=Math.round(8*l/d)}if(t.bitrateTest){const i={stats:r,frag:t,part:n,id:t.type};this.onFragBuffered(ue.FRAG_BUFFERED,i),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:r}=t,i=r!=null&&r.stats.loaded?r.stats:n.stats;if(i.aborted||this.ignoreFragment(n))return;const o=i.parsing.end-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,i.loaded),i.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==hn.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,i=this.findBestLevel(n,t,e,0,r,1,1);if(i>-1)return i;const o=this.hls.firstLevel,l=Math.min(Math.max(o,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${l}`),l}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,n=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const i=n&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,i)&&o[e].loadError<=o[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:n}=this;if(n.levels.length<=1)return n.loadLevel;const{maxAutoLevel:r,config:i,minAutoLevel:o}=n,l=t?t.duration:e?e.duration:0,d=this.getBwEstimate(),c=this.getStarvationDelay();let g=i.abrBandWidthFactor,f=i.abrBandWidthUpFactor;if(c){const L=this.findBestLevel(d,o,r,c,0,g,f);if(L>=0)return this.rebufferNotice=-1,L}let h=l?Math.min(l,i.maxStarvationDelay):i.maxStarvationDelay;if(!c){const L=this.bitrateTestDelay;L&&(h=(l?Math.min(l,i.maxLoadingDelay):i.maxLoadingDelay)-L,this.info(`bitrate test took ${Math.round(1e3*L)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),g=f=1)}const y=this.findBestLevel(d,o,r,c,h,g,f);if(this.rebufferNotice!==y&&(this.rebufferNotice=y,this.info(`${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${y}`)),y>-1)return y;const E=n.levels[o],_=n.loadLevelObj;return _&&E?.bitrate<_.bitrate?o:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,r,i,o,l){var d;const c=r+i,g=this.lastLoadedFragLevel,f=g===-1?this.hls.firstLevel:g,{fragCurrent:h,partCurrent:y}=this,{levels:E,allAudioTracks:_,loadLevel:L,config:K}=this.hls;if(E.length===1)return 0;const Z=E[f],ae=!!((d=this.hls.latestLevelDetails)!=null&&d.live),pe=L===-1||g===-1;let xe,ke="SDR",Y=Z?.frameRate||0;const{audioPreference:J,videoPreference:he}=K,Ee=this.audioTracksByGroup||(this.audioTracksByGroup=jh(_));let Le=-1;if(pe){if(this.firstSelection!==-1)return this.firstSelection;const Ne=this.codecTiers||(this.codecTiers=cb(E,Ee,t,n)),tt=ub(Ne,ke,e,J,he),{codecSet:mt,videoRanges:Ge,minFramerate:ut,minBitrate:Xe,minIndex:nt,preferHDR:Ft}=tt;Le=nt,xe=mt,ke=Ft?Ge[Ge.length-1]:Ge[0],Y=ut,e=Math.max(e,Xe),this.log(`picked start tier ${ir(tt)}`)}else xe=Z?.codecSet,ke=Z?.videoRange;const et=y?y.duration:h?h.duration:0,Ae=this.bwEstimator.getEstimateTTFB()/1e3,Ze=[];for(let Ne=n;Ne>=t;Ne--){var Be;const tt=E[Ne],mt=Ne>f;if(!tt)continue;if(K.useMediaCapabilities&&!tt.supportedResult&&!tt.supportedPromise){const Pe=navigator.mediaCapabilities;typeof Pe?.decodingInfo=="function"&&JE(tt,Ee,ke,Y,e,J)?(tt.supportedPromise=zh(tt,Ee,Pe,this.supportedCache),tt.supportedPromise.then(De=>{if(!this.hls)return;tt.supportedResult=De;const dt=this.hls.levels,Q=dt.indexOf(tt);De.error?this.warn(`MediaCapabilities decodingInfo error: "${De.error}" for level ${Q} ${ir(De)}`):De.supported?De.decodingInfoResults.some(H=>H.smooth===!1||H.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Q} not smooth or powerEfficient: ${ir(De)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Q} ${ir(De)}`),Q>-1&&dt.length>1&&(this.log(`Removing unsupported level ${Q}`),this.hls.removeLevel(Q),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(De=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${De}`)})):tt.supportedResult=Fh}if((xe&&tt.codecSet!==xe||ke&&tt.videoRange!==ke||mt&&Y>tt.frameRate||!mt&&Y>0&&Y<tt.frameRate||(Be=tt.supportedResult)!=null&&(Be=Be.decodingInfoResults)!=null&&Be.some(Pe=>Pe.smooth===!1))&&(!pe||Ne!==Le)){Ze.push(Ne);continue}const Ge=tt.details,ut=(y?Ge?.partTarget:Ge?.averagetargetduration)||et;let Xe;mt?Xe=l*e:Xe=o*e;const nt=et&&r>=et*2&&i===0?tt.averageBitrate:tt.maxBitrate,Ft=this.getTimeToLoadFrag(Ae,Xe,nt*ut,Ge===void 0);if(Xe>=nt&&(Ne===g||tt.loadError===0&&tt.fragmentError===0)&&(Ft<=Ae||!on(Ft)||ae&&!this.bitrateTestDelay||Ft<c)){const Pe=this.forcedAutoLevel;return Ne!==L&&(Pe===-1||Pe!==L)&&(Ze.length&&this.trace(`Skipped level(s) ${Ze.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${E[Ze[0]].codecs}" ${E[Ze[0]].videoRange}; not compatible with "${xe}" ${ke}`),this.info(`switch candidate:${f}->${Ne} adjustedbw(${Math.round(Xe)})-bitrate=${Math.round(Xe-nt)} ttfb:${Ae.toFixed(1)} avgDuration:${ut.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${Ft.toFixed(1)} firstSelection:${pe} codecSet:${tt.codecSet} videoRange:${tt.videoRange} hls.loadLevel:${L}`)),pe&&(this.firstSelection=Ne),Ne}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),t)}}const qh={search:function(u,e){let t=0,n=u.length-1,r=null,i=null;for(;t<=n;){r=(t+n)/2|0,i=u[r];const o=e(i);if(o>0)t=r+1;else if(o<0)n=r-1;else return i}return null}};function mb(u,e,t){if(e===null||!Array.isArray(u)||!u.length||!on(e))return null;const n=u[0].programDateTime;if(e<(n||0))return null;const r=u[u.length-1].endProgramDateTime;if(e>=(r||0))return null;for(let i=0;i<u.length;++i){const o=u[i];if(yb(e,t,o))return o}return null}function ua(u,e,t=0,n=0,r=.005){let i=null;if(u){i=e[1+u.sn-e[0].sn]||null;const l=u.endDTS-t;l>0&&l<15e-7&&(t+=15e-7),i&&u.level!==i.level&&i.end<=u.end&&(i=e[2+u.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(i=e[0]);if(i&&((!u||u.level===i.level)&&df(t,n,i)===0||pb(i,u,Math.min(r,n))))return i;const o=qh.search(e,df.bind(null,t,n));return o&&(o!==u||!i)?o:i}function pb(u,e,t){if(e&&e.start===0&&e.level<u.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((r,i)=>(i[0]==="INF"&&(r+=parseFloat(i[1])),r),t);return u.start<=n}return!1}function df(u=0,e=0,t){if(t.start<=u&&t.start+t.duration>u)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=u?1:t.start-n>u&&t.start?-1:0}function yb(u,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>u}function Gh(u,e,t){if(u&&u.startCC<=e&&u.endCC>=e){let n=u.fragments;const{fragmentHint:r}=u;r&&(n=n.concat(r));let i;return qh.search(n,o=>o.cc<e?1:o.cc>e?-1:(i=o,o.end<=t?1:o.start>t?-1:0)),i||null}return null}function so(u){switch(u.details){case lt.FRAG_LOAD_TIMEOUT:case lt.KEY_LOAD_TIMEOUT:case lt.LEVEL_LOAD_TIMEOUT:case lt.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function $h(u){return u.details.startsWith("key")}function Vh(u){return $h(u)&&!!u.frag&&!u.frag.decryptdata}function ff(u,e){const t=so(e);return u.default[`${t?"timeout":"error"}Retry`]}function Zl(u,e){const t=u.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*u.retryDelayMs,u.maxRetryDelayMs)}function hf(u){return Qn(Qn({},u),{errorRetry:null,timeoutRetry:null})}function oo(u,e,t,n){if(!u)return!1;const r=n?.code,i=e<u.maxNumRetry&&(Eb(r)||!!t);return u.shouldRetry?u.shouldRetry(u,e,t,n,i):i}function Eb(u){return Cl(u)||!!u&&(u<400||u>499)}function Cl(u){return u===0&&navigator.onLine===!1}var _r={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},zr={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class bb extends Qr{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(ue.ERROR,this.onError,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(ue.ERROR,this.onError,this),e.off(ue.ERROR,this.onErrorOut,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===hn.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,n=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||n===-1?t.loadLevel:n}variantHasKey(e,t){if(e){var n;if((n=e.details)!=null&&n.hasKey(t))return!0;const r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(o=>r.indexOf(o.groupId)>=0).some(o=>{var l;return(l=o.details)==null?void 0:l.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var n;if(t.fatal)return;const r=this.hls,i=t.context;switch(t.details){case lt.FRAG_LOAD_ERROR:case lt.FRAG_LOAD_TIMEOUT:case lt.KEY_LOAD_ERROR:case lt.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case lt.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction=wa();return}case lt.FRAG_GAP:case lt.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=_r.SendAlternateToPenaltyBox;return}case lt.LEVEL_EMPTY_ERROR:case lt.LEVEL_PARSING_ERROR:{var o;const d=t.parent===hn.MAIN?t.level:r.loadLevel;t.details===lt.LEVEL_EMPTY_ERROR&&((o=t.context)!=null&&(o=o.levelDetails)!=null&&o.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,d):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,d))}return;case lt.LEVEL_LOAD_ERROR:case lt.LEVEL_LOAD_TIMEOUT:typeof i?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.level));return;case lt.AUDIO_TRACK_LOAD_ERROR:case lt.AUDIO_TRACK_LOAD_TIMEOUT:case lt.SUBTITLE_LOAD_ERROR:case lt.SUBTITLE_TRACK_LOAD_TIMEOUT:if(i){const d=r.loadLevelObj;if(d&&(i.type===Un.AUDIO_TRACK&&d.hasAudioGroup(i.groupId)||i.type===Un.SUBTITLE_TRACK&&d.hasSubtitleGroup(i.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=_r.SendAlternateToPenaltyBox,t.errorAction.flags=zr.MoveAllAlternatesMatchingHost;return}}return;case lt.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:_r.SendAlternateToPenaltyBox,flags:zr.MoveAllAlternatesMatchingHDCP};return;case lt.KEY_SYSTEM_SESSION_UPDATE_FAILED:case lt.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case lt.KEY_SYSTEM_NO_SESSION:t.errorAction={action:_r.SendAlternateToPenaltyBox,flags:zr.MoveAllAlternatesMatchingKey};return;case lt.BUFFER_ADD_CODEC_ERROR:case lt.REMUX_ALLOC_ERROR:case lt.BUFFER_APPEND_ERROR:if(!t.errorAction){var l;t.errorAction=this.getLevelSwitchAction(t,(l=t.level)!=null?l:r.loadLevel)}return;case lt.INTERNAL_EXCEPTION:case lt.BUFFER_APPENDING_ERROR:case lt.BUFFER_FULL_ERROR:case lt.LEVEL_SWITCH_ERROR:case lt.BUFFER_STALLED_ERROR:case lt.BUFFER_SEEK_OVER_HOLE:case lt.BUFFER_NUDGE_ON_STALL:t.errorAction=wa();return}t.type===_n.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=wa())}getPlaylistRetryOrSwitchAction(e,t){const n=this.hls,r=ff(n.config.playlistLoadPolicy,e),i=this.playlistError++;if(oo(r,i,so(e),e.response))return{action:_r.RetryRequest,flags:zr.None,retryConfig:r,retryCount:i};const l=this.getLevelSwitchAction(e,t);return r&&(l.retryConfig=r,l.retryCount=i),l}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),r=t.levels[n],{fragLoadPolicy:i,keyLoadPolicy:o}=t.config,l=ff($h(e)?o:i,e),d=t.levels.reduce((g,f)=>g+f.fragmentError,0);if(r&&(e.details!==lt.FRAG_GAP&&r.fragmentError++,!Vh(e)&&oo(l,d,so(e),e.response)))return{action:_r.RetryRequest,flags:zr.None,retryConfig:l,retryCount:d};const c=this.getLevelSwitchAction(e,n);return l&&(c.retryConfig=l,c.retryCount=d),c}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const r=this.hls.levels[t];if(r){var i,o;const c=e.details;r.loadError++,c===lt.BUFFER_APPEND_ERROR&&r.fragmentError++;let g=-1;const{levels:f,loadLevel:h,minAutoLevel:y,maxAutoLevel:E}=n;!n.autoLevelEnabled&&!n.config.preserveManualLevelOnError&&(n.loadLevel=-1);const _=(i=e.frag)==null?void 0:i.type,K=(_===hn.AUDIO&&c===lt.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===lt.BUFFER_ADD_CODEC_ERROR||c===lt.BUFFER_APPEND_ERROR))&&f.some(({audioCodec:ke})=>r.audioCodec!==ke),ae=e.sourceBufferName==="video"&&(c===lt.BUFFER_ADD_CODEC_ERROR||c===lt.BUFFER_APPEND_ERROR)&&f.some(({codecSet:ke,audioCodec:Y})=>r.codecSet!==ke&&r.audioCodec===Y),{type:pe,groupId:xe}=(o=e.context)!=null?o:{};for(let ke=f.length;ke--;){const Y=(ke+h)%f.length;if(Y!==h&&Y>=y&&Y<=E&&f[Y].loadError===0){var l,d;const J=f[Y];if(c===lt.FRAG_GAP&&_===hn.MAIN&&e.frag){const he=f[Y].details;if(he){const Ee=ua(e.frag,he.fragments,e.frag.start);if(Ee!=null&&Ee.gap)continue}}else{if(pe===Un.AUDIO_TRACK&&J.hasAudioGroup(xe)||pe===Un.SUBTITLE_TRACK&&J.hasSubtitleGroup(xe))continue;if(_===hn.AUDIO&&(l=r.audioGroups)!=null&&l.some(he=>J.hasAudioGroup(he))||_===hn.SUBTITLE&&(d=r.subtitleGroups)!=null&&d.some(he=>J.hasSubtitleGroup(he))||K&&r.audioCodec===J.audioCodec||ae&&r.codecSet===J.codecSet||!K&&r.codecSet!==J.codecSet)continue}g=Y;break}}if(g>-1&&n.loadLevel!==g)return e.levelRetry=!0,this.playlistError=0,{action:_r.SendAlternateToPenaltyBox,flags:zr.None,nextAutoLevel:g}}return{action:_r.SendAlternateToPenaltyBox,flags:zr.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case _r.DoNothing:break;case _r.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==lt.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,n=e.errorAction;if(!n)return;const{flags:r}=n,i=n.nextAutoLevel;switch(r){case zr.None:this.switchLevel(e,i);break;case zr.MoveAllAlternatesMatchingHDCP:{const d=this.getVariantLevelIndex(e.frag),c=t.levels[d],g=c?.attrs["HDCP-LEVEL"];if(n.hdcpLevel=g,g==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(g){t.maxHdcpLevel=kl[kl.indexOf(g)-1],n.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case zr.MoveAllAlternatesMatchingKey:{const d=e.decryptdata;if(d){const c=this.hls.levels,g=c.length;for(let h=g;h--;)if(this.variantHasKey(c[h],d)){var o,l;this.log(`Banned key found in level ${h} (${c[h].bitrate}bps) or audio group "${(o=c[h].audioGroups)==null?void 0:o.join(",")}" (${(l=e.frag)==null?void 0:l.type} fragment) ${Ar(d.keyId||[])}`),c[h].fragmentError++,c[h].loadError++,this.log(`Removing level ${h} with key error (${e.error})`),this.hls.removeLevel(h)}const f=e.frag;if(this.hls.levels.length<g)n.resolved=!0;else if(f&&f.type!==hn.MAIN){const h=f.decryptdata;h&&!d.matches(h)&&(n.resolved=!0)}}break}}n.resolved||this.switchLevel(e,i)}switchLevel(e,t){if(t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===lt.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const n=Rl(e.mimeType),r=this.hls.levels;for(let i=r.length;i--;)r[i][`${e.sourceBufferName}Codec`]===n&&(this.log(`Removing level ${i} for ${e.details} ("${n}" not supported)`),this.hls.removeLevel(i))}}}function wa(u){const e={action:_r.DoNothing,flags:zr.None};return u&&(e.resolved=!0),e}var Er={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Tb{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.BUFFER_APPENDED,this.onBufferAppended,this),e.on(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.on(ue.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.BUFFER_APPENDED,this.onBufferAppended,this),e.off(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.off(ue.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const n=this.activePartLists[t];if(n)for(let r=n.length;r--;){const i=n[r];if(!i)break;if(i.start<=e&&e<=i.end&&i.loaded)return i}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,n){const{fragments:r}=this,i=Object.keys(r);for(let o=i.length;o--;){const l=r[i[o]];if(l?.body.type===t&&(!n||l.buffered)){const d=l.body;if(d.start<=e&&e<=d.end)return d}}return null}detectEvictedFragments(e,t,n,r,i){this.timeRanges&&(this.timeRanges[e]=t);const o=r?.fragment.sn||-1;Object.keys(this.fragments).forEach(l=>{const d=this.fragments[l];if(!d||o>=d.body.sn)return;if(!d.buffered&&(!d.loaded||i)){d.body.type===n&&this.removeFragment(d.body);return}const c=d.range[e];if(c){if(c.time.length===0){this.removeFragment(d.body);return}c.time.some(g=>{const f=!this.isTimeBuffered(g.startPTS,g.endPTS,t);return f&&this.removeFragment(d.body),f})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const n=e.frag,r=Ta(n),i=this.fragments[r];if(!i||i.buffered&&n.gap)return;const o=!n.relurl;Object.keys(t).forEach(l=>{const d=n.elementaryStreams[l];if(!d)return;const c=t[l],g=o||d.partial===!0;i.range[l]=this.getBufferedTimes(n,e.part,g,c)}),i.loaded=null,Object.keys(i.range).length?(this.bufferedEnd(i,n),Ns(i)||this.removeParts(n.sn-1,n.type)):this.removeFragment(i.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const n=this.activePartLists[t];n&&(this.activePartLists[t]=gf(n,r=>r.fragment.sn>=e))}fragBuffered(e,t){const n=Ta(e);let r=this.fragments[n];!r&&t&&(r=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,this.bufferedEnd(r,e))}getBufferedTimes(e,t,n,r){const i={time:[],partial:n},o=e.start,l=e.end,d=e.minEndPTS||l,c=e.maxStartPTS||o;for(let g=0;g<r.length;g++){const f=r.start(g)-this.bufferPadding,h=r.end(g)+this.bufferPadding;if(c>=f&&d<=h){i.time.push({startPTS:Math.max(o,r.start(g)),endPTS:Math.min(l,r.end(g))});break}else if(o<h&&l>f){const y=Math.max(o,r.start(g)),E=Math.min(l,r.end(g));E>y&&(i.partial=!0,i.time.push({startPTS:y,endPTS:E}))}else if(l<=f)break}return i}getPartialFragment(e){let t=null,n,r,i,o=0;const{bufferPadding:l,fragments:d}=this;return Object.keys(d).forEach(c=>{const g=d[c];g&&Ns(g)&&(r=g.body.start-l,i=g.body.end+l,e>=r&&e<=i&&(n=Math.min(e-r,i-e),o<=n&&(t=g.body,o=n)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Ns(t))}getState(e){const t=Ta(e),n=this.fragments[t];return n?n.buffered?Ns(n)?Er.PARTIAL:Er.OK:Er.APPENDING:Er.NOT_LOADED}isTimeBuffered(e,t,n){let r,i;for(let o=0;o<n.length;o++){if(r=n.start(o)-this.bufferPadding,i=n.end(o)+this.bufferPadding,e>=r&&t<=i)return!0;if(t<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const n=t.frag,r=t.part?null:t,i=Ta(n);this.fragments[i]={body:n,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:r,timeRanges:i,type:o}=t;if(n.sn==="initSegment")return;const l=n.type;if(r){let c=this.activePartLists[l];c||(this.activePartLists[l]=c=[]),c.push(r)}this.timeRanges=i;const d=i[o];this.detectEvictedFragments(o,d,l,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Ta(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,n=Object.keys(t);if(!e)return n.length>0;for(let r=n.length;r--;){const i=t[n[r]];if(i?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,r,i){r&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const l=this.fragments[o];if(!l)return;const d=l.body;d.type!==n||r&&!d.gap||d.start<t&&d.end>e&&(l.buffered||i)&&this.removeFragment(d)})}removeFragment(e){const t=Ta(e);e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const r=e.sn;this.activePartLists[e.type]=gf(n,i=>i.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(n=>n.clearElementaryStreamInfo())}}function Ns(u){var e,t,n;return u.buffered&&!!(u.body.gap||(e=u.range.video)!=null&&e.partial||(t=u.range.audio)!=null&&t.partial||(n=u.range.audiovideo)!=null&&n.partial)}function Ta(u){return`${u.type}_${u.level}_${u.sn}`}function gf(u,e){return u.filter(t=>{const n=e(t);return n||t.clearElementaryStreamInfo(),n})}var Yi={cbc:0,ctr:1};class vb{constructor(e,t,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=n}decrypt(e,t){switch(this.aesMode){case Yi.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Yi.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function Sb(u){const e=u.byteLength,t=e&&new DataView(u.buffer).getUint8(e-1);return t?u.slice(0,e-t):u}class _b{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),n=new Uint32Array(4);for(let r=0;r<4;r++)n[r]=t.getUint32(r*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,r=n[0],i=n[1],o=n[2],l=n[3],d=this.invSubMix,c=d[0],g=d[1],f=d[2],h=d[3],y=new Uint32Array(256);let E=0,_=0,L=0;for(L=0;L<256;L++)L<128?y[L]=L<<1:y[L]=L<<1^283;for(L=0;L<256;L++){let K=_^_<<1^_<<2^_<<3^_<<4;K=K>>>8^K&255^99,e[E]=K,t[K]=E;const Z=y[E],ae=y[Z],pe=y[ae];let xe=y[K]*257^K*16843008;r[E]=xe<<24|xe>>>8,i[E]=xe<<16|xe>>>16,o[E]=xe<<8|xe>>>24,l[E]=xe,xe=pe*16843009^ae*65537^Z*257^E*16843008,c[K]=xe<<24|xe>>>8,g[K]=xe<<16|xe>>>16,f[K]=xe<<8|xe>>>24,h[K]=xe,E?(E=Z^y[y[y[pe^Z]]],_^=y[y[_]]):E=_=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,r=0;for(;r<t.length&&n;)n=t[r]===this.key[r],r++;if(n)return;this.key=t;const i=this.keySize=t.length;if(i!==4&&i!==6&&i!==8)throw new Error("Invalid aes key size="+i);const o=this.ksRows=(i+6+1)*4;let l,d;const c=this.keySchedule=new Uint32Array(o),g=this.invKeySchedule=new Uint32Array(o),f=this.sBox,h=this.rcon,y=this.invSubMix,E=y[0],_=y[1],L=y[2],K=y[3];let Z,ae;for(l=0;l<o;l++){if(l<i){Z=c[l]=t[l];continue}ae=Z,l%i===0?(ae=ae<<8|ae>>>24,ae=f[ae>>>24]<<24|f[ae>>>16&255]<<16|f[ae>>>8&255]<<8|f[ae&255],ae^=h[l/i|0]<<24):i>6&&l%i===4&&(ae=f[ae>>>24]<<24|f[ae>>>16&255]<<16|f[ae>>>8&255]<<8|f[ae&255]),c[l]=Z=(c[l-i]^ae)>>>0}for(d=0;d<o;d++)l=o-d,d&3?ae=c[l]:ae=c[l-4],d<4||l<=4?g[d]=ae:g[d]=E[f[ae>>>24]]^_[f[ae>>>16&255]]^L[f[ae>>>8&255]]^K[f[ae&255]],g[d]=g[d]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const r=this.keySize+6,i=this.invKeySchedule,o=this.invSBox,l=this.invSubMix,d=l[0],c=l[1],g=l[2],f=l[3],h=this.uint8ArrayToUint32Array_(n);let y=h[0],E=h[1],_=h[2],L=h[3];const K=new Int32Array(e),Z=new Int32Array(K.length);let ae,pe,xe,ke,Y,J,he,Ee,Le,et,Ae,Ze,Be,Ne;const tt=this.networkToHostOrderSwap;for(;t<K.length;){for(Le=tt(K[t]),et=tt(K[t+1]),Ae=tt(K[t+2]),Ze=tt(K[t+3]),Y=Le^i[0],J=Ze^i[1],he=Ae^i[2],Ee=et^i[3],Be=4,Ne=1;Ne<r;Ne++)ae=d[Y>>>24]^c[J>>16&255]^g[he>>8&255]^f[Ee&255]^i[Be],pe=d[J>>>24]^c[he>>16&255]^g[Ee>>8&255]^f[Y&255]^i[Be+1],xe=d[he>>>24]^c[Ee>>16&255]^g[Y>>8&255]^f[J&255]^i[Be+2],ke=d[Ee>>>24]^c[Y>>16&255]^g[J>>8&255]^f[he&255]^i[Be+3],Y=ae,J=pe,he=xe,Ee=ke,Be=Be+4;ae=o[Y>>>24]<<24^o[J>>16&255]<<16^o[he>>8&255]<<8^o[Ee&255]^i[Be],pe=o[J>>>24]<<24^o[he>>16&255]<<16^o[Ee>>8&255]<<8^o[Y&255]^i[Be+1],xe=o[he>>>24]<<24^o[Ee>>16&255]<<16^o[Y>>8&255]<<8^o[J&255]^i[Be+2],ke=o[Ee>>>24]<<24^o[Y>>16&255]<<16^o[J>>8&255]<<8^o[he&255]^i[Be+3],Z[t]=tt(ae^y),Z[t+1]=tt(ke^E),Z[t+2]=tt(xe^_),Z[t+3]=tt(pe^L),y=Le,E=et,_=Ae,L=Ze,t=t+4}return Z.buffer}}class Ab{constructor(e,t,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=n}expandKey(){const e=Ib(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function Ib(u){switch(u){case Yi.cbc:return"AES-CBC";case Yi.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${u}`)}}const xb=16;class Jl{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Sb(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n,r){return this.useSoftware?new Promise((i,o)=>{const l=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(l,t,n,r);const d=this.flush();d?i(d.buffer):o(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n,r)}softwareDecrypt(e,t,n,r){const{currentIV:i,currentResult:o,remainderData:l}=this;if(r!==Yi.cbc||t.byteLength!==16)return Zn.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),l&&(e=Wr(l,e),this.remainderData=null);const d=this.getValidChunk(e);if(!d.length)return null;i&&(n=i);let c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new _b),c.expandKey(t);const g=o;return this.currentResult=c.decrypt(d.buffer,0,n),this.currentIV=d.slice(-16).buffer,g||null}webCryptoDecrypt(e,t,n,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n,r));this.key=t,this.fastAesKey=new Ab(this.subtle,t,r)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new vb(this.subtle,new Uint8Array(n),r).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(Zn.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,n,r)))}onWebCryptoError(e,t,n,r){const i=this.enableSoftwareAES;if(i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n,r);const o=this.flush();if(o)return o.buffer}throw new Error("WebCrypto"+(i?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const n=e.length-e.length%xb;return n!==e.length&&(t=e.slice(0,n),this.remainderData=e.slice(n)),t}logOnce(e){this.logEnabled&&(Zn.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const mf=Math.pow(2,17);class wb{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const n=e.url;if(!n)return Promise.reject(new Li({type:_n.NETWORK_ERROR,details:lt.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,i=r.fLoader,o=r.loader;return new Promise((l,d)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(E=>E[0]==="GAP")){d(yf(e));return}else e.gap=!1;const c=this.loader=i?new i(r):new o(r),g=pf(e);e.loader=c;const f=hf(r.fragLoadPolicy.default),h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:mf};e.stats=c.stats;const y={onSuccess:(E,_,L,K)=>{this.resetLoader(e,c);let Z=E.data;L.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(Z.slice(0,16)),Z=Z.slice(16)),l({frag:e,part:null,payload:Z,networkDetails:K})},onError:(E,_,L,K)=>{this.resetLoader(e,c),d(new Li({type:_n.NETWORK_ERROR,details:lt.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Qn({url:n,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:L,stats:K}))},onAbort:(E,_,L)=>{this.resetLoader(e,c),d(new Li({type:_n.NETWORK_ERROR,details:lt.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:L,stats:E}))},onTimeout:(E,_,L)=>{this.resetLoader(e,c),d(new Li({type:_n.NETWORK_ERROR,details:lt.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:L,stats:E}))}};t&&(y.onProgress=(E,_,L,K)=>t({frag:e,part:null,payload:L,networkDetails:K})),c.load(g,h,y)})}loadPart(e,t,n){this.abort();const r=this.config,i=r.fLoader,o=r.loader;return new Promise((l,d)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){d(yf(e,t));return}const c=this.loader=i?new i(r):new o(r),g=pf(e,t);e.loader=c;const f=hf(r.fragLoadPolicy.default),h={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:mf};t.stats=c.stats,c.load(g,h,{onSuccess:(y,E,_,L)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const K={frag:e,part:t,payload:y.data,networkDetails:L};n(K),l(K)},onError:(y,E,_,L)=>{this.resetLoader(e,c),d(new Li({type:_n.NETWORK_ERROR,details:lt.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Qn({url:g.url,data:void 0},y),error:new Error(`HTTP Error ${y.code} ${y.text}`),networkDetails:_,stats:L}))},onAbort:(y,E,_)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),d(new Li({type:_n.NETWORK_ERROR,details:lt.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:_,stats:y}))},onTimeout:(y,E,_)=>{this.resetLoader(e,c),d(new Li({type:_n.NETWORK_ERROR,details:lt.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:_,stats:y}))}})})}updateStatsFromPart(e,t){const n=e.stats,r=t.stats,i=r.total;if(n.loaded+=r.loaded,i){const d=Math.round(e.duration/t.duration),c=Math.min(Math.round(n.loaded/i),d),f=(d-c)*Math.round(n.loaded/c);n.total=n.loaded+f}else n.total=Math.max(n.loaded,n.total);const o=n.loading,l=r.loading;o.start?o.first+=l.first-l.start:(o.start=l.start,o.first=l.first),o.end=l.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function pf(u,e=null){const t=e||u,n={frag:u,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,i=t.byteRangeEndOffset;if(on(r)&&on(i)){var o;let l=r,d=i;if(u.sn==="initSegment"&&Rb((o=u.decryptdata)==null?void 0:o.method)){const c=i-r;c%16&&(d=i+(16-c%16)),r!==0&&(n.resetIV=!0,l=r-16)}n.rangeStart=l,n.rangeEnd=d}return n}function yf(u,e){const t=new Error(`GAP ${u.gap?"tag":"attribute"} found`),n={type:_n.MEDIA_ERROR,details:lt.FRAG_GAP,fatal:!1,frag:u,error:t,networkDetails:null};return e&&(n.part=e),(e||u).stats.aborted=!0,new Li(n)}function Rb(u){return u==="AES-128"||u==="AES-256"}class Li extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Hh extends Qr{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class eu{constructor(e,t,n,r=0,i=-1,o=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Ms(),this.buffering={audio:Ms(),video:Ms(),audiovideo:Ms()},this.level=e,this.sn=t,this.id=n,this.size=r,this.part=i,this.partial=o}}function Ms(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Ef={length:0,start:()=>0,end:()=>0};class Dn{static isBuffered(e,t){if(e){const n=Dn.getBuffered(e);for(let r=n.length;r--;)if(t>=n.start(r)&&t<=n.end(r))return!0}return!1}static bufferedRanges(e){if(e){const t=Dn.getBuffered(e);return Dn.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}static bufferInfo(e,t,n){if(e){const r=Dn.bufferedRanges(e);if(r.length)return Dn.bufferedInfo(r,t,n)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.length>1&&e.sort((g,f)=>g.start-f.start||f.end-g.end);let r=-1,i=[];if(n)for(let g=0;g<e.length;g++){t>=e[g].start&&t<=e[g].end&&(r=g);const f=i.length;if(f){const h=i[f-1].end;e[g].start-h<n?e[g].end>h&&(i[f-1].end=e[g].end):i.push(e[g])}else i.push(e[g])}else i=e;let o=0,l,d=t,c=t;for(let g=0;g<i.length;g++){const f=i[g].start,h=i[g].end;if(r===-1&&t>=f&&t<=h&&(r=g),t+n>=f&&t<h)d=f,c=h,o=c-t;else if(t+n<f){l=f;break}}return{len:o,start:d||0,end:c||0,nextStart:l,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||Ef}catch(t){return Zn.log("failed to get media.buffered",t),Ef}}}const Kh=/\{\$([a-zA-Z0-9-_]+)\}/g;function bf(u){return Kh.test(u)}function Ll(u,e){if(u.variableList!==null||u.hasVariableRefs){const t=u.variableList;return e.replace(Kh,n=>{const r=n.substring(2,n.length-1),i=t?.[r];return i===void 0?(u.playlistParsingError||(u.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),n):i})}return e}function Tf(u,e,t){let n=u.variableList;n||(u.variableList=n={});let r,i;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(r))i=o.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(o){u.playlistParsingError||(u.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else r=e.NAME,i=e.VALUE;r in n?u.playlistParsingError||(u.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):n[r]=i||""}function kb(u,e,t){const n=e.IMPORT;if(t&&n in t){let r=u.variableList;r||(u.variableList=r={}),r[n]=t[n]}else u.playlistParsingError||(u.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}const Cb=/^(\d+)x(\d+)$/,vf=/(.+?)=(".*?"|.*?)(?:,|$)/g;class sr{constructor(e,t){typeof e=="string"&&(e=sr.parseAttrList(e,t)),nr(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const n=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)n[r]=parseInt(t.slice(r*2,r*2+2),16);return n}return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const n=this[e];return(n?n.split(/[ ,]+/):[]).reduce((r,i)=>(r[i.toLowerCase()]=!0,r),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Cb.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let n;const r={};for(vf.lastIndex=0;(n=vf.exec(e))!==null;){const o=n[1].trim();let l=n[2];const d=l.indexOf('"')===0&&l.lastIndexOf('"')===l.length-1;let c=!1;if(d)l=l.slice(1,-1);else switch(o){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":c=!0}if(t&&(d||c))l=Ll(t,l);else if(!c&&!d)switch(o){case"CLOSED-CAPTIONS":if(l==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":Zn.warn(`${e}: attribute ${o} is missing quotes`)}r[o]=l}return r}}const Lb="com.apple.hls.interstitial";function Db(u){return u!=="ID"&&u!=="CLASS"&&u!=="CUE"&&u!=="START-DATE"&&u!=="DURATION"&&u!=="END-DATE"&&u!=="END-ON-NEXT"}function Pb(u){return u==="SCTE35-OUT"||u==="SCTE35-IN"||u==="SCTE35-CMD"}class Yh{constructor(e,t,n=0){var r;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(r=t?.tagOrder)!=null?r:n,t){const i=t.attr;for(const o in i)if(Object.prototype.hasOwnProperty.call(e,o)&&e[o]!==i[o]){Zn.warn(`DATERANGE tag attribute: "${o}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=o;break}e=nr(new sr({}),i,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=t?.endDate||new Date(this.attr["END-DATE"]);on(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(Zn.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(on(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===Lb}get isValid(){return!!this.id&&!this._badValueForSameId&&on(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const Nb=10;class Mb{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let n=t.decryptdata;return n||(t.setKeyFormat(e.keyFormat),n=t.decryptdata),!!n&&e.matches(n)})}get hasProgramDateTime(){return this.fragments.length?on(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Nb}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let n=e.length;n--;)if(e[n].index>t)return e[n].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function lo(u,e){return u.length===e.length?!u.some((t,n)=>t!==e[n]):!1}function Sf(u,e){return!u&&!e?!0:!u||!e?!1:lo(u,e)}function Ra(u){return u==="AES-128"||u==="AES-256"||u==="AES-256-CTR"}function tu(u){switch(u){case"AES-128":case"AES-256":return Yi.cbc;case"AES-256-CTR":return Yi.ctr;default:throw new Error(`invalid full segment method ${u}`)}}function nu(u){return Uint8Array.from(atob(u),e=>e.charCodeAt(0))}function Dl(u){return Uint8Array.from(unescape(encodeURIComponent(u)),e=>e.charCodeAt(0))}function Ob(u){const e=Dl(u).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Wh(u){const e=function(n,r,i){const o=n[r];n[r]=n[i],n[i]=o};e(u,0,3),e(u,1,2),e(u,4,5),e(u,6,7)}function Xh(u){const e=u.split(":");let t=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),r=n[n.length-1].split(",");if(r.length===2){const i=r[0]==="base64",o=r[1];i?(n.splice(-1,1),t=nu(o)):t=Ob(o)}}return t}const uo=typeof self<"u"?self:void 0;var or={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Ir={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Ws(u){switch(u){case Ir.FAIRPLAY:return or.FAIRPLAY;case Ir.PLAYREADY:return or.PLAYREADY;case Ir.WIDEVINE:return or.WIDEVINE;case Ir.CLEARKEY:return or.CLEARKEY}}function rl(u){switch(u){case or.FAIRPLAY:return Ir.FAIRPLAY;case or.PLAYREADY:return Ir.PLAYREADY;case or.WIDEVINE:return Ir.WIDEVINE;case or.CLEARKEY:return Ir.CLEARKEY}}function Ya(u){const{drmSystems:e,widevineLicenseUrl:t}=u,n=e?[or.FAIRPLAY,or.WIDEVINE,or.PLAYREADY,or.CLEARKEY].filter(r=>!!e[r]):[];return!n[or.WIDEVINE]&&t&&n.push(or.WIDEVINE),n}const Qh=(function(u){return uo!=null&&(u=uo.navigator)!=null&&u.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function Fb(u,e,t,n){let r;switch(u){case or.FAIRPLAY:r=["cenc","sinf"];break;case or.WIDEVINE:case or.PLAYREADY:r=["cenc"];break;case or.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${u}`)}return Ub(r,e,t,n)}function Ub(u,e,t,n){return[{initDataTypes:u,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(i=>({contentType:`audio/mp4; codecs=${i}`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(i=>({contentType:`video/mp4; codecs=${i}`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function zb(u){var e;return!!u&&(u.sessionType==="persistent-license"||!!((e=u.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function Zh(u){const e=new Uint16Array(u.buffer,u.byteOffset,u.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),n=t.substring(t.indexOf("<"),t.length),o=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(o){const l=o.childNodes[0]?o.childNodes[0].nodeValue:o.getAttribute("VALUE");if(l){const d=nu(l).subarray(0,16);return Wh(d),d}}return null}let va={};class Hi{static clearKeyUriToKeyIdMap(){va={}}static setKeyIdForUri(e,t){va[e]=t}static addKeyIdForUri(e){const t=Object.keys(va).length%Number.MAX_SAFE_INTEGER,n=new Uint8Array(16);return new DataView(n.buffer,12,4).setUint32(0,t),va[e]=n,n}constructor(e,t,n,r=[1],i=null,o){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=n,this.keyFormatVersions=r,this.iv=i,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Ra(e),o!=null&&o.startsWith("0x")&&(this.keyId=new Uint8Array(xh(o)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&lo(e.keyFormatVersions,this.keyFormatVersions)&&Sf(e.iv,this.iv)&&Sf(e.keyId,this.keyId)}isSupported(){if(this.method){if(Ra(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Ir.FAIRPLAY:case Ir.WIDEVINE:case Ir.PLAYREADY:case Ir.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Ra(this.method)){let i=this.iv;return i||(typeof e!="number"&&(Zn.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),i=jb(e)),new Hi(this.method,this.uri,"identity",this.keyFormatVersions,i)}if(this.keyId){const i=va[this.uri];if(i&&!lo(this.keyId,i)&&Hi.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const n=Xh(this.uri);if(n)switch(this.keyFormat){case Ir.WIDEVINE:if(this.pssh=n,!this.keyId){const i=$E(n.buffer);if(i.length){var r;const o=i[0];this.keyId=(r=o.kids)!=null&&r.length?o.kids[0]:null}}this.keyId||(this.keyId=_f(t));break;case Ir.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=GE(i,null,n),this.keyId=Zh(n);break}default:{let i=n.subarray(0,16);if(i.length!==16){const o=new Uint8Array(16);o.set(i,16-i.length),i=o}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i;i=Bb(t),i||(i=_f(t),i||(i=va[this.uri])),i&&(this.keyId=i,Hi.setKeyIdForUri(this.uri,i))}return this}}function Bb(u){const e=u?.[Ir.WIDEVINE];return e?e.keyId:null}function _f(u){const e=u?.[Ir.PLAYREADY];if(e){const t=Xh(e.uri);if(t)return Zh(t)}return null}function jb(u){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=u>>8*(15-t)&255;return e}const Af=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,If=/#EXT-X-MEDIA:(.*)/g,qb=/^#EXT(?:INF|-X-TARGETDURATION):/m,il=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Gb=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class bi{static findGroup(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r.id===t)return r}}static resolve(e,t){return Kl.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return qb.test(e)}static parseMasterPlaylist(e,t){const n=bf(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},i=[];if(Af.lastIndex=0,!e.startsWith("#EXTM3U"))return r.playlistParsingError=new Error("no EXTM3U delimiter"),r;let o;for(;(o=Af.exec(e))!=null;)if(o[1]){var l;const c=new sr(o[1],r),g=Ll(r,o[2]),f={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:bi.resolve(g,t)},h=c.decimalResolution("RESOLUTION");h&&(f.width=h.width,f.height=h.height),Rf(c.CODECS,f);const y=c["SUPPLEMENTAL-CODECS"];y&&(f.supplemental={},Rf(y,f.supplemental)),(l=f.unknownCodecs)!=null&&l.length||i.push(f),r.levels.push(f)}else if(o[3]){const c=o[3],g=o[4];switch(c){case"SESSION-DATA":{const f=new sr(g,r),h=f["DATA-ID"];h&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[h]=f);break}case"SESSION-KEY":{const f=xf(g,t,r);f.encrypted&&f.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(f)):Zn.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${g}"`);break}case"DEFINE":{{const f=new sr(g,r);Tf(r,f,t)}break}case"CONTENT-STEERING":{const f=new sr(g,r);r.contentSteering={uri:bi.resolve(f["SERVER-URI"],t),pathwayId:f["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=wf(g);break}}}const d=i.length>0&&i.length<r.levels.length;return r.levels=d?i:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,n){let r;const i={},o=n.levels,l={AUDIO:o.map(c=>({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:o.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let d=0;for(If.lastIndex=0;(r=If.exec(e))!==null;){const c=new sr(r[1],n),g=c.TYPE;if(g){const f=l[g],h=i[g]||[];i[g]=h;const y=c.LANGUAGE,E=c["ASSOC-LANGUAGE"],_=c.CHANNELS,L=c.CHARACTERISTICS,K=c["INSTREAM-ID"],Z={attrs:c,bitrate:0,id:d++,groupId:c["GROUP-ID"]||"",name:c.NAME||y||"",type:g,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:y,url:c.URI?bi.resolve(c.URI,t):""};if(E&&(Z.assocLang=E),_&&(Z.channels=_),L&&(Z.characteristics=L),K&&(Z.instreamId=K),f!=null&&f.length){const ae=bi.findGroup(f,Z.groupId)||f[0];kf(Z,ae,"audioCodec"),kf(Z,ae,"textCodec")}h.push(Z)}}return i}static parseLevelPlaylist(e,t,n,r,i,o){var l;const d={url:t},c=new Mb(t),g=c.fragments,f=[];let h=null,y=0,E=0,_=0,L=0,K=0,Z=null,ae=new el(r,d),pe,xe,ke,Y=-1,J=!1,he=null,Ee;if(il.lastIndex=0,c.m3u8=e,c.hasVariableRefs=bf(e),((l=il.exec(e))==null?void 0:l[0])!=="#EXTM3U")return c.playlistParsingError=new Error("Missing format identifier #EXTM3U"),c;for(;(pe=il.exec(e))!==null;){J&&(J=!1,ae=new el(r,d),ae.playlistOffset=_,ae.setStart(_),ae.sn=y,ae.cc=L,K&&(ae.bitrate=K),ae.level=n,h&&(ae.initSegment=h,h.rawProgramDateTime&&(ae.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null),he&&(ae.setByteRange(he),he=null)));const Ze=pe[1];if(Ze){ae.duration=parseFloat(Ze);const Be=(" "+pe[2]).slice(1);ae.title=Be||null,ae.tagList.push(Be?["INF",Ze,Be]:["INF",Ze])}else if(pe[3]){if(on(ae.duration)){ae.playlistOffset=_,ae.setStart(_),ke&&Lf(ae,ke,c),ae.sn=y,ae.level=n,ae.cc=L,g.push(ae);const Be=(" "+pe[3]).slice(1);ae.relurl=Ll(c,Be),Pl(ae,Z,f),Z=ae,_+=ae.duration,y++,E=0,J=!0}}else{if(pe=pe[0].match(Gb),!pe){Zn.warn("No matches on slow regex match for level playlist!");continue}for(xe=1;xe<pe.length&&pe[xe]===void 0;xe++);const Be=(" "+pe[xe]).slice(1),Ne=(" "+pe[xe+1]).slice(1),tt=pe[xe+2]?(" "+pe[xe+2]).slice(1):null;switch(Be){case"BYTERANGE":Z?ae.setByteRange(Ne,Z):ae.setByteRange(Ne);break;case"PROGRAM-DATE-TIME":ae.rawProgramDateTime=Ne,ae.tagList.push(["PROGRAM-DATE-TIME",Ne]),Y===-1&&(Y=g.length);break;case"PLAYLIST-TYPE":c.type&&wi(c,Be,pe),c.type=Ne.toUpperCase();break;case"MEDIA-SEQUENCE":c.startSN!==0?wi(c,Be,pe):g.length>0&&Df(c,Be,pe),y=c.startSN=parseInt(Ne);break;case"SKIP":{c.skippedSegments&&wi(c,Be,pe);const mt=new sr(Ne,c),Ge=mt.decimalInteger("SKIPPED-SEGMENTS");if(on(Ge)){c.skippedSegments+=Ge;for(let Xe=Ge;Xe--;)g.push(null);y+=Ge}const ut=mt.enumeratedString("RECENTLY-REMOVED-DATERANGES");ut&&(c.recentlyRemovedDateranges=(c.recentlyRemovedDateranges||[]).concat(ut.split(" ")));break}case"TARGETDURATION":c.targetduration!==0&&wi(c,Be,pe),c.targetduration=Math.max(parseInt(Ne),1);break;case"VERSION":c.version!==null&&wi(c,Be,pe),c.version=parseInt(Ne);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":c.live||wi(c,Be,pe),c.live=!1;break;case"#":(Ne||tt)&&ae.tagList.push(tt?[Ne,tt]:[Ne]);break;case"DISCONTINUITY":L++,ae.tagList.push(["DIS"]);break;case"GAP":ae.gap=!0,ae.tagList.push([Be]);break;case"BITRATE":ae.tagList.push([Be,Ne]),K=parseInt(Ne)*1e3,on(K)?ae.bitrate=K:K=0;break;case"DATERANGE":{const mt=new sr(Ne,c),Ge=new Yh(mt,c.dateRanges[mt.ID],c.dateRangeTagCount);c.dateRangeTagCount++,Ge.isValid||c.skippedSegments?c.dateRanges[Ge.id]=Ge:Zn.warn(`Ignoring invalid DATERANGE tag: "${Ne}"`),ae.tagList.push(["EXT-X-DATERANGE",Ne]);break}case"DEFINE":{{const mt=new sr(Ne,c);"IMPORT"in mt?kb(c,mt,o):Tf(c,mt,t)}break}case"DISCONTINUITY-SEQUENCE":c.startCC!==0?wi(c,Be,pe):g.length>0&&Df(c,Be,pe),c.startCC=L=parseInt(Ne);break;case"KEY":{const mt=xf(Ne,t,c);if(mt.isSupported()){if(mt.method==="NONE"){ke=void 0;break}ke||(ke={});const Ge=ke[mt.keyFormat];Ge!=null&&Ge.matches(mt)||(Ge&&(ke=nr({},ke)),ke[mt.keyFormat]=mt)}else Zn.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${Ne}"`);break}case"START":c.startTimeOffset=wf(Ne);break;case"MAP":{const mt=new sr(Ne,c);if(ae.duration){const Ge=new el(r,d);Cf(Ge,mt,n,ke),h=Ge,ae.initSegment=h,h.rawProgramDateTime&&!ae.rawProgramDateTime&&(ae.rawProgramDateTime=h.rawProgramDateTime)}else{const Ge=ae.byteRangeEndOffset;if(Ge){const ut=ae.byteRangeStartOffset;he=`${Ge-ut}@${ut}`}else he=null;Cf(ae,mt,n,ke),h=ae,J=!0}h.cc=L;break}case"SERVER-CONTROL":{Ee&&wi(c,Be,pe),Ee=new sr(Ne),c.canBlockReload=Ee.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=Ee.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&Ee.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=Ee.optionalFloat("PART-HOLD-BACK",0),c.holdBack=Ee.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{c.partTarget&&wi(c,Be,pe);const mt=new sr(Ne);c.partTarget=mt.decimalFloatingPoint("PART-TARGET");break}case"PART":{let mt=c.partList;mt||(mt=c.partList=[]);const Ge=E>0?mt[mt.length-1]:void 0,ut=E++,Xe=new sr(Ne,c),nt=new kE(Xe,ae,d,ut,Ge);mt.push(nt),ae.duration+=nt.duration;break}case"PRELOAD-HINT":{const mt=new sr(Ne,c);c.preloadHint=mt;break}case"RENDITION-REPORT":{const mt=new sr(Ne,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(mt);break}default:Zn.warn(`line parsed but not handled: ${pe}`);break}}}Z&&!Z.relurl?(g.pop(),_-=Z.duration,c.partList&&(c.fragmentHint=Z)):c.partList&&(Pl(ae,Z,f),ae.cc=L,c.fragmentHint=ae,ke&&Lf(ae,ke,c)),c.targetduration||(c.playlistParsingError=new Error("Missing Target Duration"));const Le=g.length,et=g[0],Ae=g[Le-1];if(_+=c.skippedSegments*c.targetduration,_>0&&Le&&Ae){c.averagetargetduration=_/Le;const Ze=Ae.sn;c.endSN=Ze!=="initSegment"?Ze:0,c.live||(Ae.endList=!0),Y>0&&(Vb(g,Y),et&&f.unshift(et))}return c.fragmentHint&&(_+=c.fragmentHint.duration),c.totalduration=_,f.length&&c.dateRangeTagCount&&et&&Jh(f,c),c.endCC=L,c}}function Jh(u,e){let t=u.length;if(!t)if(e.hasProgramDateTime){const l=e.fragments[e.fragments.length-1];u.push(l),t++}else return;const n=u[t-1],r=e.live?1/0:e.totalduration,i=Object.keys(e.dateRanges);for(let l=i.length;l--;){const d=e.dateRanges[i[l]],c=d.startDate.getTime();d.tagAnchor=n.ref;for(let g=t;g--;){var o;if(((o=u[g])==null?void 0:o.sn)<e.startSN)break;const f=$b(e,c,u,g,r);if(f!==-1){d.tagAnchor=e.fragments[f].ref;break}}}}function $b(u,e,t,n,r){const i=t[n];if(i){const l=i.programDateTime;if(e>=l||n===0){var o;const d=(((o=t[n+1])==null?void 0:o.start)||r)-i.start;if(e<=l+d*1e3){const c=t[n].sn-u.startSN;if(c<0)return-1;const g=u.fragments;if(g.length>t.length){const h=(t[n+1]||g[g.length-1]).sn-u.startSN;for(let y=h;y>c;y--){const E=g[y].programDateTime;if(e>=E&&e<E+g[y].duration*1e3)return y}}return c}}}return-1}function xf(u,e,t){var n,r;const i=new sr(u,t),o=(n=i.METHOD)!=null?n:"",l=i.URI,d=i.hexadecimalInteger("IV"),c=i.KEYFORMATVERSIONS,g=(r=i.KEYFORMAT)!=null?r:"identity";l&&i.IV&&!d&&Zn.error(`Invalid IV: ${i.IV}`);const f=l?bi.resolve(l,e):"",h=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Hi(o,f,g,h,d,i.KEYID)}function wf(u){const t=new sr(u).decimalFloatingPoint("TIME-OFFSET");return on(t)?t:null}function Rf(u,e){let t=(u||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const r=t.filter(i=>Xl(i,n));r.length&&(e[`${n}Codec`]=r.map(i=>i.split("/")[0]).join(","),t=t.filter(i=>r.indexOf(i)===-1))}),e.unknownCodecs=t}function kf(u,e,t){const n=e[t];n&&(u[t]=n)}function Vb(u,e){let t=u[e];for(let n=e;n--;){const r=u[n];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function Pl(u,e,t){u.rawProgramDateTime?t.push(u):e!=null&&e.programDateTime&&(u.programDateTime=e.endProgramDateTime)}function Cf(u,e,t,n){u.relurl=e.URI,e.BYTERANGE&&u.setByteRange(e.BYTERANGE),u.level=t,u.sn="initSegment",n&&(u.levelkeys=n),u.initSegment=null}function Lf(u,e,t){u.levelkeys=e;const{encryptedFragments:n}=t;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&n.push(u)}function wi(u,e,t){u.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function Df(u,e,t){u.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function al(u,e){const t=e.startPTS;if(on(t)){let n=0,r;e.sn>u.sn?(n=t-u.start,r=u):(n=u.start-t,r=e),r.duration!==n&&r.setDuration(n)}else e.sn>u.sn?u.cc===e.cc&&u.minEndPTS?e.setStart(u.start+(u.minEndPTS-u.start)):e.setStart(u.start+u.duration):e.setStart(Math.max(u.start-e.duration,0))}function eg(u,e,t,n,r,i,o){n-t<=0&&(o.warn("Fragment should have a positive duration",e),n=t+e.duration,i=r+e.duration);let d=t,c=n;const g=e.startPTS,f=e.endPTS;if(on(g)){const K=Math.abs(g-t);u&&K>u.totalduration?o.warn(`media timestamps and playlist times differ by ${K}s for level ${e.level} ${u.url}`):on(e.deltaPTS)?e.deltaPTS=Math.max(K,e.deltaPTS):e.deltaPTS=K,d=Math.max(t,g),t=Math.min(t,g),r=e.startDTS!==void 0?Math.min(r,e.startDTS):r,c=Math.min(n,f),n=Math.max(n,f),i=e.endDTS!==void 0?Math.max(i,e.endDTS):i}const h=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(n-e.start),e.startPTS=t,e.maxStartPTS=d,e.startDTS=r,e.endPTS=n,e.minEndPTS=c,e.endDTS=i;const y=e.sn;if(!u||y<u.startSN||y>u.endSN)return 0;let E;const _=y-u.startSN,L=u.fragments;for(L[_]=e,E=_;E>0;E--)al(L[E],L[E-1]);for(E=_;E<L.length-1;E++)al(L[E],L[E+1]);return u.fragmentHint&&al(L[L.length-1],u.fragmentHint),u.PTSKnown=u.alignedSliding=!0,h}function Hb(u,e,t){if(u===e)return;let n=null;const r=u.fragments;for(let g=r.length-1;g>=0;g--){const f=r[g].initSegment;if(f){n=f;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;let i;Wb(u,e,(g,f,h,y)=>{if((!e.startCC||e.skippedSegments)&&f.cc!==g.cc){const E=g.cc-f.cc;for(let _=h;_<y.length;_++)y[_].cc+=E;e.endCC=y[y.length-1].cc}on(g.startPTS)&&on(g.endPTS)&&(f.setStart(f.startPTS=g.startPTS),f.startDTS=g.startDTS,f.maxStartPTS=g.maxStartPTS,f.endPTS=g.endPTS,f.endDTS=g.endDTS,f.minEndPTS=g.minEndPTS,f.setDuration(g.endPTS-g.startPTS),f.duration&&(i=f),e.PTSKnown=e.alignedSliding=!0),g.hasStreams&&(f.elementaryStreams=g.elementaryStreams),f.loader=g.loader,g.hasStats&&(f.stats=g.stats),g.initSegment&&(f.initSegment=g.initSegment,n=g.initSegment)});const o=e.fragments,l=e.fragmentHint?o.concat(e.fragmentHint):o;if(n&&l.forEach(g=>{var f;g&&(!g.initSegment||g.initSegment.relurl===((f=n)==null?void 0:f.relurl))&&(g.initSegment=n)}),e.skippedSegments){if(e.deltaUpdateFailed=o.some(g=>!g),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let g=e.skippedSegments;g--;)o.shift();e.startSN=o[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=Kb(u.dateRanges,e,t));const g=u.fragments.filter(f=>f.rawProgramDateTime);if(u.hasProgramDateTime&&!e.hasProgramDateTime)for(let f=1;f<l.length;f++)l[f].programDateTime===null&&Pl(l[f],l[f-1],g);Jh(g,e)}e.endCC=o[o.length-1].cc}if(!e.startCC){var d;const g=rg(u,e.startSN-1);e.startCC=(d=g?.cc)!=null?d:o[0].cc}Yb(u.partList,e.partList,(g,f)=>{f.elementaryStreams=g.elementaryStreams,f.stats=g.stats}),i?eg(e,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS,t):tg(u,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=u.driftStartTime,e.driftStart=u.driftStart;const c=e.advancedDateTime;if(e.advanced&&c){const g=e.edge;e.driftStart||(e.driftStartTime=c,e.driftStart=g),e.driftEndTime=c,e.driftEnd=g}else e.driftEndTime=u.driftEndTime,e.driftEnd=u.driftEnd,e.advancedDateTime=u.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=u.requestScheduled)}function Kb(u,e,t){const{dateRanges:n,recentlyRemovedDateranges:r}=e,i=nr({},u);r&&r.forEach(d=>{delete i[d]});const l=Object.keys(i).length;return l?(Object.keys(n).forEach(d=>{const c=i[d],g=new Yh(n[d].attr,c);g.isValid?(i[d]=g,c||(g.tagOrder+=l)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${ir(n[d].attr)}"`)}),i):n}function Yb(u,e,t){if(u&&e){let n=0;for(let r=0,i=u.length;r<=i;r++){const o=u[r],l=e[r+n];o&&l&&o.index===l.index&&o.fragment.sn===l.fragment.sn?t(o,l):n--}}}function Wb(u,e,t){const n=e.skippedSegments,r=Math.max(u.startSN,e.startSN)-e.startSN,i=(u.fragmentHint?1:0)+(n?e.endSN:Math.min(u.endSN,e.endSN))-e.startSN,o=e.startSN-u.startSN,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,d=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;for(let c=r;c<=i;c++){const g=d[o+c];let f=l[c];if(n&&!f&&g&&(f=e.fragments[c]=g),g&&f){t(g,f,c,l);const h=g.relurl,y=f.relurl;if(h&&Xb(h,y)){e.playlistParsingError=Pf(`media sequence mismatch ${f.sn}:`,u,e,g,f);return}else if(g.cc!==f.cc){e.playlistParsingError=Pf(`discontinuity sequence mismatch (${g.cc}!=${f.cc})`,u,e,g,f);return}}}}function Pf(u,e,t,n,r){return new Error(`${u} ${r.url}
|
|
12
|
+
Playlist starting @${e.startSN}
|
|
13
|
+
${e.m3u8}
|
|
14
|
+
|
|
15
|
+
Playlist starting @${t.startSN}
|
|
16
|
+
${t.m3u8}`)}function tg(u,e,t=!0){const n=e.startSN+e.skippedSegments-u.startSN,r=u.fragments,i=n>=0;let o=0;if(i&&n<r.length)o=r[n].start;else if(i&&e.startSN===u.endSN+1)o=u.fragmentEnd;else if(i&&t)o=u.fragmentStart+n*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)o=u.fragmentStart;else return;Nl(e,o)}function Nl(u,e){if(e){const t=u.fragments;for(let n=u.skippedSegments;n<t.length;n++)t[n].addStart(e);u.fragmentHint&&u.fragmentHint.addStart(e)}}function ng(u,e=1/0){let t=1e3*u.targetduration;if(u.updated){const n=u.fragments;if(n.length&&t*4>e){const i=n[n.length-1].duration*1e3;i<t&&(t=i)}}else t/=2;return Math.round(t)}function rg(u,e,t){if(!u)return null;let n=u.fragments[e-u.startSN];return n||(n=u.fragmentHint,n&&n.sn===e)?n:e<u.startSN&&t&&t.sn===e?t:null}function Nf(u,e,t){return u?ig(u.partList,e,t):null}function ig(u,e,t){if(u)for(let n=u.length;n--;){const r=u[n];if(r.index===t&&r.fragment.sn===e)return r}return null}function ag(u){u.forEach((e,t)=>{var n;(n=e.details)==null||n.fragments.forEach(r=>{r.level=t,r.initSegment&&(r.initSegment.level=t)})})}function Xb(u,e){return u!==e&&e?Mf(u)!==Mf(e):!1}function Mf(u){return u.replace(/\?[^?]*$/,"")}function Wa(u,e){for(let n=0,r=u.length;n<r;n++){var t;if(((t=u[n])==null?void 0:t.cc)===e)return u[n]}return null}function Qb(u,e){return!!(u&&e.startCC<u.endCC&&e.endCC>u.startCC)}function Of(u,e){const t=u.start+e;u.startPTS=t,u.setStart(t),u.endPTS=t+u.duration}function sg(u,e){const t=e.fragments;for(let n=0,r=t.length;n<r;n++)Of(t[n],u);e.fragmentHint&&Of(e.fragmentHint,u),e.alignedSliding=!0}function Zb(u,e){u&&(og(e,u),e.alignedSliding||co(e,u),!e.alignedSliding&&!e.skippedSegments&&tg(u,e,!1))}function og(u,e){if(!Qb(e,u))return;const t=Math.min(e.endCC,u.endCC),n=Wa(e.fragments,t),r=Wa(u.fragments,t);if(!n||!r)return;Zn.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const i=n.start-r.start;sg(i,u)}function co(u,e){if(!u.hasProgramDateTime||!e.hasProgramDateTime)return;const t=u.fragments,n=e.fragments;if(!t.length||!n.length)return;let r,i;const o=Math.min(e.endCC,u.endCC);e.startCC<o&&u.startCC<o&&(r=Wa(n,o),i=Wa(t,o)),(!r||!i)&&(r=n[Math.floor(n.length/2)],i=Wa(t,r.cc)||t[Math.floor(t.length/2)]);const l=r.programDateTime,d=i.programDateTime;if(!l||!d)return;const c=(d-l)/1e3-(i.start-r.start);sg(c,u)}function Cr(u,e,t){Or(u,e,t),u.addEventListener(e,t)}function Or(u,e,t){u.removeEventListener(e,t)}const Jb={toString:function(u){let e="";const t=u.length;for(let n=0;n<t;n++)e+=`[${u.start(n).toFixed(3)}-${u.end(n).toFixed(3)}]`;return e}},Ot={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class ru extends Hh{constructor(e,t,n,r,i){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Ot.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:o,fragCurrent:l,media:d,mediaBuffer:c,state:g}=this,f=d?d.currentTime:0,h=Dn.bufferInfo(c||d,f,o.maxBufferHole),y=!h.len;if(this.log(`Media seeking to ${on(f)?f.toFixed(3):f}, state: ${g}, ${y?"out of":"in"} buffer`),this.state===Ot.ENDED)this.resetLoadingState();else if(l){const E=o.maxFragLookUpTolerance,_=l.start-E,L=l.start+l.duration+E;if(y||L<h.start||_>h.end){const K=f>L;(f<_||K)&&(K&&l.loader&&(this.log(`Cancelling fragment load for seek (sn: ${l.sn})`),l.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(d){this.fragmentTracker.removeFragmentsInRange(f,1/0,this.playlistType,!0);const E=this.lastCurrentTime;if(f>E&&(this.lastCurrentTime=f),!this.loadingParts){const _=Math.max(h.end,f),L=this.shouldLoadParts(this.getLevelDetails(),_);L&&(this.log(`LL-Part loading ON after seeking to ${f.toFixed(2)} with buffer @${_.toFixed(2)}`),this.loadingParts=L)}}this.hls.hasEnoughToStart||(this.log(`Setting ${y?"startPosition":"nextLoadPosition"} to ${f} for seek without enough to start`),this.nextLoadPosition=f,y&&(this.startPosition=f)),y&&this.state===Ot.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=i,this.hls=e,this.fragmentLoader=new wb(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Jl(e.config)}registerListeners(){const{hls:e}=this;e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(ue.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===Ot.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Ot.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const n=e.end||0,r=this.config.timelineOffset||0;if(n<=r)return!1;const i=e.buffered;this.config.maxBufferHole&&i&&i.length>1&&(e=Dn.bufferedInfo(i,e.start,0));const o=e.nextStart;if(o&&o>r&&o<t.edge||this.media.currentTime<e.start)return!1;const d=t.partList;if(d!=null&&d.length){const g=d[d.length-1];return Dn.isBuffered(this.media,g.start+g.duration/2)}const c=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(c)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const n=this.media=this.mediaBuffer=t.media;Cr(n,"seeking",this.onMediaSeeking),Cr(n,"ended",this.onMediaEnded);const r=this.config;this.levels&&r.autoStartLoad&&this.state===Ot.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){const n=!!t.transferMedia,r=this.media;if(r!==null){if(r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Or(r,"seeking",this.onMediaSeeking),Or(r,"ended",this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=Ot.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,n){this.startFragRequested=!0,this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const r=i=>{const o=i.frag;if(this.fragContextChanged(o)){this.warn(`${o.type} sn: ${o.sn}${i.part?" part: "+i.part.index:""} of ${this.fragInfo(o,!1,i.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(o);return}o.stats.chunkCount++,this._handleFragmentLoadProgress(i)};this._doFragLoad(e,t,n,r).then(i=>{if(!i)return;const o=this.state,l=i.frag;if(this.fragContextChanged(l)){(o===Ot.FRAG_LOADING||!this.fragCurrent&&o===Ot.PARSING)&&(this.fragmentTracker.removeFragment(l),this.state=Ot.IDLE);return}"payload"in i&&(this.log(`Loaded ${l.type} sn: ${l.sn} of ${this.playlistLabel()} ${l.level}`),this.hls.trigger(ue.FRAG_LOADED,i)),this._handleFragmentLoadComplete(i)}).catch(i=>{this.state===Ot.STOPPED||this.state===Ot.ERROR||(this.warn(`Frag error: ${i?.message||i}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===Er.APPENDING){const i=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,i),l=Math.max(e.duration,o?o.len:this.config.maxBufferLength),d=this.backtrackFragment;((d?e.sn-d.sn:0)===1||this.reduceMaxBufferLength(l,e.duration))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===Er.PARTIAL&&n.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,n=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:n};this.hls.trigger(ue.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{const r=n?.frag;if(!r||this.fragContextChanged(r)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:r}=this,{frag:i,payload:o}=n,l=i.decryptdata;if(o&&o.byteLength>0&&l!=null&&l.key&&l.iv&&Ra(l.method)){const d=self.performance.now();return this.decrypter.decrypt(new Uint8Array(o),l.key.buffer,l.iv.buffer,tu(l.method)).catch(c=>{throw r.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.FRAG_DECRYPT_ERROR,fatal:!1,error:c,reason:c.message,frag:i}),c}).then(c=>{const g=self.performance.now();return r.trigger(ue.FRAG_DECRYPTED,{frag:i,payload:c,stats:{tstart:d,tdecrypt:g}}),n.payload=c,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===Ot.STOPPED||this.state===Ot.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state!==Ot.STOPPED&&(this.state=Ot.IDLE),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var n,r;const i=e.tracks;if(i&&!t.encrypted&&((n=i.audio)!=null&&n.encrypted||(r=i.video)!=null&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const o=this.media,l=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${o?"attached mediaKeys: "+o.mediaKeys:"detached"})`);return this.warn(l.message),!o||o.mediaKeys?!1:(this.hls.trigger(ue.ERROR,{type:_n.KEY_SYSTEM_ERROR,details:lt.KEY_SYSTEM_NO_KEYS,fatal:!1,error:l,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const n=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${n?Jb.toString(Dn.getBuffered(n)):"(detached)"})`),cr(e)){var r;if(e.type!==hn.SUBTITLE){const o=e.elementaryStreams;if(!Object.keys(o).some(l=>!!o[l])){this.state=Ot.IDLE;return}}const i=(r=this.levels)==null?void 0:r[e.level];i!=null&&i.fragmentError&&(this.log(`Resetting level fragment error count of ${i.fragmentError} on frag buffered`),i.fragmentError=0)}this.state=Ot.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:n,part:r,partsLoaded:i}=e,o=!i||i.length===0||i.some(d=>!d),l=new eu(n.level,n.sn,n.stats.chunkCount+1,0,r?r.index:-1,!o);t.flush(l)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,r){var i;this.fragCurrent=e;const o=t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let l=null;if(e.encrypted&&!((i=e.decryptdata)!=null&&i.key)){if(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Ot.KEY_LOADING,this.fragCurrent=e,l=this.keyLoader.load(e).then(h=>{if(!this.fragContextChanged(h.frag))return this.hls.trigger(ue.KEY_LOADED,h),this.state===Ot.KEY_LOADING&&(this.state=Ot.IDLE),h}),this.hls.trigger(ue.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(l=this.keyLoader.loadClear(e,o.encryptedFragments,this.startFragRequested),l&&this.log("[eme] blocking frag load until media-keys acquired"));const d=this.fragPrevious;if(cr(e)&&(!d||e.sn!==d.sn)){const h=this.shouldLoadParts(t.details,e.end);h!==this.loadingParts&&(this.log(`LL-Part loading ${h?"ON":"OFF"} loading sn ${d?.sn}->${e.sn}`),this.loadingParts=h)}if(n=Math.max(e.start,n||0),this.loadingParts&&cr(e)){const h=o.partList;if(h&&r){n>o.fragmentEnd&&o.fragmentHint&&(e=o.fragmentHint);const y=this.getNextPart(h,e,n);if(y>-1){const E=h[y];e=this.fragCurrent=E.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${E.index} (${y}/${h.length-1}) of ${this.fragInfo(e,!1,E)}) cc: ${e.cc} [${o.startSN}-${o.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=E.start+E.duration,this.state=Ot.FRAG_LOADING;let _;return l?_=l.then(L=>!L||this.fragContextChanged(L.frag)?null:this.doFragPartsLoad(e,E,t,r)).catch(L=>this.handleFragLoadError(L)):_=this.doFragPartsLoad(e,E,t,r).catch(L=>this.handleFragLoadError(L)),this.hls.trigger(ue.FRAG_LOADING,{frag:e,part:E,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):_}else if(!e.url||this.loadedEndOfParts(h,n))return Promise.resolve(null)}}if(cr(e)&&this.loadingParts){var c;this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(c=o.partList)==null?void 0:c.filter(h=>h.loaded).map(h=>`[${h.start}-${h.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+o.startSN+"-"+o.endSN+"]"}, target: ${parseFloat(n.toFixed(3))}`),on(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Ot.FRAG_LOADING;const g=this.config.progressive&&e.type!==hn.SUBTITLE;let f;return g&&l?f=l.then(h=>!h||this.fragContextChanged(h.frag)?null:this.fragmentLoader.load(e,r)).catch(h=>this.handleFragLoadError(h)):f=Promise.all([this.fragmentLoader.load(e,g?r:void 0),l]).then(([h])=>(!g&&r&&r(h),h)).catch(h=>this.handleFragLoadError(h)),this.hls.trigger(ue.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):f}doFragPartsLoad(e,t,n,r){return new Promise((i,o)=>{var l;const d=[],c=(l=n.details)==null?void 0:l.partList,g=f=>{this.fragmentLoader.loadPart(e,f,r).then(h=>{d[f.index]=h;const y=h.part;this.hls.trigger(ue.FRAG_LOADED,h);const E=Nf(n.details,e.sn,f.index+1)||ig(c,e.sn,f.index+1);if(E)g(E);else return i({frag:e,part:y,partsLoaded:d})}).catch(o)};g(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===lt.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===_n.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(ue.ERROR,t)}else this.hls.trigger(ue.ERROR,{type:_n.OTHER_ERROR,details:lt.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Ot.PARSING){!this.fragCurrent&&this.state!==Ot.STOPPED&&this.state!==Ot.ERROR&&(this.state=Ot.IDLE);return}const{frag:n,part:r,level:i}=t,o=self.performance.now();n.stats.parsing.end=o,r&&(r.stats.parsing.end=o);const l=this.getLevelDetails(),c=l&&n.sn>l.endSN||this.shouldLoadParts(l,n.end);c!==this.loadingParts&&(this.log(`LL-Part loading ${c?"ON":"OFF"} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=c),this.updateLevelTiming(n,r,i,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var n;const i=e.partList[0];if(i.fragment.type===hn.SUBTITLE)return!1;const o=i.end+(((n=e.fragmentHint)==null?void 0:n.duration)||0);if(t>=o){var r;if((this.hls.hasEnoughToStart?((r=this.media)==null?void 0:r.currentTime)||this.lastCurrentTime:this.getLoadPosition())>i.start-i.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:r,sn:i,part:o}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${i} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;const l=t[r],d=l.details,c=o>-1?Nf(d,i,o):null,g=c?c.fragment:rg(d,i,n);return g?(n&&n!==g&&(g.stats=n.stats),{frag:g,part:c,level:l}):null}bufferFragmentData(e,t,n,r,i){if(this.state!==Ot.PARSING)return;const{data1:o,data2:l}=e;let d=o;if(l&&(d=Wr(o,l)),!d.length)return;const c=this.initPTS[t.cc],g=c?-c.baseTime/c.timescale:void 0,f={type:e.type,frag:t,part:n,chunkMeta:r,offset:g,parent:t.type,data:d};if(this.hls.trigger(ue.BUFFER_APPENDING,f),e.dropped&&e.independent&&!n){if(i)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Dn.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,r=Dn.bufferInfo(t,n,0),i=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,i*.25),l=Math.max(Math.min(e.start-o,r.end-o),n+o);e.start-l>o&&this.flushMainBuffer(l,e.start)}getFwdBufferInfo(e,t){var n;const r=this.getLoadPosition();if(!on(r))return null;const o=this.lastCurrentTime>r||(n=this.media)!=null&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,o)}getFwdBufferInfoAtPos(e,t,n,r){const i=Dn.bufferInfo(e,t,r);if(i.len===0&&i.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,n);if(o&&(i.nextStart<=o.end||o.gap)){const l=Math.max(Math.min(i.nextStart,o.end)-t,r);return Dn.bufferInfo(e,t,l)}}return i}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const n=this.config,r=Math.max(Math.min(e-t,n.maxBufferLength),t),i=Math.max(e-t*3,n.maxMaxBufferLength/2,r);return i>=r?(n.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0):!1}getAppendedFrag(e,t=hn.MAIN){const n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const n=t.fragments,r=n.length;if(!r)return null;const{config:i}=this,o=n[0].start,l=i.lowLatencyMode&&!!t.partList;let d=null;if(t.live){const f=i.initialLiveManifestSize;if(r<f)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${f})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o){var c;l&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),d=this.getInitialLiveFragment(t);const h=this.hls.startPosition,y=this.hls.liveSyncPosition,E=d?(h!==-1&&h>=o?h:y)||d.start:e;this.log(`Setting startPosition to ${E} to match start frag at live edge. mainStart: ${h} liveSyncPosition: ${y} frag.start: ${(c=d)==null?void 0:c.start}`),this.startPosition=this.nextLoadPosition=E}}else e<=o&&(d=n[0]);if(!d){const f=this.loadingParts?t.partEnd:t.fragmentEnd;d=this.getFragmentAtPosition(e,f,t)}let g=this.filterReplacedPrimary(d,t);if(!g&&d){const f=d.sn-t.startSN;g=this.filterReplacedPrimary(n[f+1]||null,t)}return this.mapToInitFragWhenRequired(g)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===Er.OK||n===Er.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,r,i){let o=null;if(e.gap&&(o=this.getNextFragment(this.nextLoadPosition,t),o&&!o.gap&&n.nextStart)){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,r,0);if(l!==null&&n.len+l.len>=i){const d=o.sn;return this.loopSn!==d&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${d}`),this.loopSn=d),null}}return this.loopSn=void 0,o}get primaryPrefetch(){if(Ff(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Ff(this.config)&&e.type!==hn.SUBTITLE){const n=this.hls.interstitialsManager,r=n?.bufferingItem;if(r){const o=r.event;if(o){if(o.appendInPlace||Math.abs(e.start-r.start)>1||r.start===0)return null}else if(e.end<=r.start&&t?.live===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}const i=n?.playerQueue;if(i)for(let o=i.length;o--;){const l=i[o].interstitial;if(l.appendInPlace&&e.start>=l.startTime&&e.end<=l.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,n){let r=-1,i=!1,o=!0;for(let l=0,d=e.length;l<d;l++){const c=e[l];if(o=o&&!c.independent,r>-1&&n<c.start)break;const g=c.loaded;g?r=-1:(i||(c.independent||o)&&c.fragment===t)&&(c.fragment!==t&&this.warn(`Need buffer at ${n} but next unloaded part starts at ${c.start}`),r=l),i=g}return r}loadedEndOfParts(e,t){let n;for(let r=e.length;r--;){if(n=e[r],!n.loaded)return!1;if(t>n.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,n=this.fragPrevious;let r=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),r=mb(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const i=n.sn+1;if(i>=e.startSN&&i<=e.endSN){const o=t[i-e.startSN];n.cc===o.cc&&(r=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=Gh(e,n.cc,n.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const i=this.hls.liveSyncPosition;i!==null&&(r=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,n){const{config:r}=this;let{fragPrevious:i}=this,{fragments:o,endSN:l}=n;const{fragmentHint:d}=n,{maxFragLookUpTolerance:c}=r,g=n.partList,f=!!(this.loadingParts&&g!=null&&g.length&&d);f&&!this.bitrateTest&&g[g.length-1].fragment.sn===d.sn&&(o=o.concat(d),l=d.sn);let h;if(e<t){var y;const _=e<this.lastCurrentTime||e>t-c||(y=this.media)!=null&&y.paused||!this.startFragRequested?0:c;h=ua(i,o,e,_)}else h=o[o.length-1];if(h){const E=h.sn-n.startSN,_=this.fragmentTracker.getState(h);if((_===Er.OK||_===Er.PARTIAL&&h.gap)&&(i=h),i&&h.sn===i.sn&&(!f||g[0].fragment.sn>h.sn||!n.live)&&h.level===i.level){const K=o[E+1];h.sn<l&&this.fragmentTracker.getState(K)!==Er.OK?h=K:h=null}}return h}alignPlaylists(e,t,n){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const i=e.fragmentStart,o=!t,l=e.alignedSliding&&on(i);if(o||!l&&!i){Zb(n,e);const d=e.fragmentStart;return this.log(`Live playlist sliding: ${d.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${r}`),d}return i}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;n<t&&(n=-1);const r=this.timelineOffset;if(n===-1){const i=this.startTimeOffset!==null,o=i?this.startTimeOffset:e.startTimeOffset;o!==null&&on(o)?(n=t+o,o<0&&(n+=e.edge),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${o} found in ${i?"multivariant":"media"} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=n=0),this.lastCurrentTime=n+r}this.nextLoadPosition=n+r}getLoadPosition(){var e;const{media:t}=this;let n=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?n=t.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&cr(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==Ot.FRAG_LOADING_WAITING_RETRY)&&(this.state=Ot.IDLE)}onFragmentOrKeyLoadError(e,t){var n;if(t.chunkMeta&&!t.frag){const K=this.getCurrentContext(t.chunkMeta);K&&(t.frag=K.frag)}const r=t.frag;if(!r||r.type!==e||!this.levels)return;if(this.fragContextChanged(r)){var i;this.warn(`Frag load error must match current frag to retry ${r.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const o=t.details===lt.FRAG_GAP;o&&this.fragmentTracker.fragBuffered(r,!0);const l=t.errorAction;if(!l){this.state=Ot.ERROR;return}const{action:d,flags:c,retryCount:g=0,retryConfig:f}=l,h=!!f,y=h&&d===_r.RetryRequest,E=h&&!l.resolved&&c===zr.MoveAllAlternatesMatchingHost,_=(n=this.hls.latestLevelDetails)==null?void 0:n.live;if(!y&&E&&cr(r)&&!r.endList&&_&&!Vh(t))this.resetFragmentErrors(e),this.treatAsGap(r),l.resolved=!0;else if((y||E)&&g<f.maxNumRetry){var L;const K=Cl((L=t.response)==null?void 0:L.code),Z=Zl(f,g);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+Z,this.state=Ot.FRAG_LOADING_WAITING_RETRY,l.resolved=!0,K){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${r.sn} of ${e} ${r.level} errored with ${t.details}, retrying loading ${g+1}/${f.maxNumRetry} in ${Z}ms`)}else if(f)if(this.resetFragmentErrors(e),g<f.maxNumRetry)!o&&d!==_r.RemoveAlternatePermanently&&(l.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${g})`);return}else d===_r.SendAlternateToPenaltyBox?this.state=Ot.WAITING_LEVEL:this.state=Ot.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,n=t===1/0;(!t||e>=t||n&&!Cl(0))&&(n&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=Ot.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===Ot.PARSING||this.state===Ot.PARSED){const t=e.frag,n=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,n),i=r&&r.len>.5;i&&this.reduceMaxBufferLength(r.len,t?.duration||10);const o=!i;return o&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===hn.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Ot.STOPPED&&(this.state=Ot.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const r=Dn.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,n),this.state===Ot.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Ot.STOPPED&&(this.state=Ot.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,n,r){const i=n.details;if(!i){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((d,c)=>{const g=e.elementaryStreams[c];if(g){const f=g.endPTS-g.startPTS;if(f<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${f})`),d||!1;const h=r?0:eg(i,e,g.startPTS,g.endPTS,g.startDTS,g.endDTS,this);return this.hls.trigger(ue.LEVEL_PTS_UPDATED,{details:i,level:n,drift:h,type:c,frag:e,start:g.startPTS,end:g.endPTS}),!0}return d},!1)){var l;const d=((l=this.transmuxer)==null?void 0:l.error)===null;if((n.fragmentError===0||d&&(n.fragmentError<2||e.endList))&&this.treatAsGap(e,n),d){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Ot.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(ue.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===hn.MAIN?"level":"track"}fragInfo(e,t=!0,n){var r,i;return`${this.playlistLabel()} ${e.level} (${n?"part":"frag"}:[${((r=t&&!n?e.startPTS:(n||e).start)!=null?r:NaN).toFixed(3)}-${((i=t&&!n?e.endPTS:(n||e).end)!=null?i:NaN).toFixed(3)}]${n&&e.type==="main"?"INDEPENDENT="+(n.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function Ff(u){return!!u.interstitialsController&&u.enableInterstitialPlayback!==!1}class lg{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;if(e.length)e.length===1?n=e[0]:n=e0(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function e0(u,e){const t=new Uint8Array(e);let n=0;for(let r=0;r<u.length;r++){const i=u[r];t.set(i,n),n+=i.length}return t}var sl={exports:{}},Uf;function t0(){return Uf||(Uf=1,(function(u){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function r(d,c,g){this.fn=d,this.context=c,this.once=g||!1}function i(d,c,g,f,h){if(typeof g!="function")throw new TypeError("The listener must be a function");var y=new r(g,f||d,h),E=t?t+c:c;return d._events[E]?d._events[E].fn?d._events[E]=[d._events[E],y]:d._events[E].push(y):(d._events[E]=y,d._eventsCount++),d}function o(d,c){--d._eventsCount===0?d._events=new n:delete d._events[c]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],g,f;if(this._eventsCount===0)return c;for(f in g=this._events)e.call(g,f)&&c.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(g)):c},l.prototype.listeners=function(c){var g=t?t+c:c,f=this._events[g];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,y=f.length,E=new Array(y);h<y;h++)E[h]=f[h].fn;return E},l.prototype.listenerCount=function(c){var g=t?t+c:c,f=this._events[g];return f?f.fn?1:f.length:0},l.prototype.emit=function(c,g,f,h,y,E){var _=t?t+c:c;if(!this._events[_])return!1;var L=this._events[_],K=arguments.length,Z,ae;if(L.fn){switch(L.once&&this.removeListener(c,L.fn,void 0,!0),K){case 1:return L.fn.call(L.context),!0;case 2:return L.fn.call(L.context,g),!0;case 3:return L.fn.call(L.context,g,f),!0;case 4:return L.fn.call(L.context,g,f,h),!0;case 5:return L.fn.call(L.context,g,f,h,y),!0;case 6:return L.fn.call(L.context,g,f,h,y,E),!0}for(ae=1,Z=new Array(K-1);ae<K;ae++)Z[ae-1]=arguments[ae];L.fn.apply(L.context,Z)}else{var pe=L.length,xe;for(ae=0;ae<pe;ae++)switch(L[ae].once&&this.removeListener(c,L[ae].fn,void 0,!0),K){case 1:L[ae].fn.call(L[ae].context);break;case 2:L[ae].fn.call(L[ae].context,g);break;case 3:L[ae].fn.call(L[ae].context,g,f);break;case 4:L[ae].fn.call(L[ae].context,g,f,h);break;default:if(!Z)for(xe=1,Z=new Array(K-1);xe<K;xe++)Z[xe-1]=arguments[xe];L[ae].fn.apply(L[ae].context,Z)}}return!0},l.prototype.on=function(c,g,f){return i(this,c,g,f,!1)},l.prototype.once=function(c,g,f){return i(this,c,g,f,!0)},l.prototype.removeListener=function(c,g,f,h){var y=t?t+c:c;if(!this._events[y])return this;if(!g)return o(this,y),this;var E=this._events[y];if(E.fn)E.fn===g&&(!h||E.once)&&(!f||E.context===f)&&o(this,y);else{for(var _=0,L=[],K=E.length;_<K;_++)(E[_].fn!==g||h&&!E[_].once||f&&E[_].context!==f)&&L.push(E[_]);L.length?this._events[y]=L.length===1?L[0]:L:o(this,y)}return this},l.prototype.removeAllListeners=function(c){var g;return c?(g=t?t+c:c,this._events[g]&&o(this,g)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=t,l.EventEmitter=l,u.exports=l})(sl)),sl.exports}var n0=t0(),iu=wE(n0);const ts="1.6.15",Da={};function r0(){return typeof __HLS_WORKER_BUNDLE__=="function"}function i0(){const u=Da[ts];if(u)return u.clientCount++,u;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),r={worker:new self.Worker(t),objectURL:t,clientCount:1};return Da[ts]=r,r}function a0(u){const e=Da[u];if(e)return e.clientCount++,e;const t=new self.URL(u,self.location.href).href,r={worker:new self.Worker(t),scriptURL:t,clientCount:1};return Da[u]=r,r}function s0(u){const e=Da[u||ts];if(e&&e.clientCount--===1){const{worker:n,objectURL:r}=e;delete Da[u||ts],r&&self.URL.revokeObjectURL(r),n.terminate()}}function ug(u,e){return e+10<=u.length&&u[e]===51&&u[e+1]===68&&u[e+2]===73&&u[e+3]<255&&u[e+4]<255&&u[e+6]<128&&u[e+7]<128&&u[e+8]<128&&u[e+9]<128}function au(u,e){return e+10<=u.length&&u[e]===73&&u[e+1]===68&&u[e+2]===51&&u[e+3]<255&&u[e+4]<255&&u[e+6]<128&&u[e+7]<128&&u[e+8]<128&&u[e+9]<128}function mo(u,e){let t=0;return t=(u[e]&127)<<21,t|=(u[e+1]&127)<<14,t|=(u[e+2]&127)<<7,t|=u[e+3]&127,t}function ns(u,e){const t=e;let n=0;for(;au(u,e);){n+=10;const r=mo(u,e+6);n+=r,ug(u,e+10)&&(n+=10),e+=n}if(n>0)return u.subarray(t,t+n)}function o0(u,e,t,n){const r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],i=e[t+2],o=i>>2&15;if(o>12){const y=new Error(`invalid ADTS sampling index:${o}`);u.emit(ue.ERROR,ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.FRAG_PARSING_ERROR,fatal:!0,error:y,reason:y.message});return}const l=(i>>6&3)+1,d=e[t+3]>>6&3|(i&1)<<2,c="mp4a.40."+l,g=r[o];let f=o;(l===5||l===29)&&(f-=3);const h=[l<<3|(f&14)>>1,(f&1)<<7|d<<3];return Zn.log(`manifest codec:${n}, parsed codec:${c}, channels:${d}, rate:${g} (ADTS object type:${l} sampling index:${o})`),{config:h,samplerate:g,channelCount:d,codec:c,parsedCodec:c,manifestCodec:n}}function cg(u,e){return u[e]===255&&(u[e+1]&246)===240}function dg(u,e){return u[e+1]&1?7:9}function su(u,e){return(u[e+3]&3)<<11|u[e+4]<<3|(u[e+5]&224)>>>5}function l0(u,e){return e+5<u.length}function fo(u,e){return e+1<u.length&&cg(u,e)}function u0(u,e){return l0(u,e)&&cg(u,e)&&su(u,e)<=u.length-e}function c0(u,e){if(fo(u,e)){const t=dg(u,e);if(e+t>=u.length)return!1;const n=su(u,e);if(n<=t)return!1;const r=e+n;return r===u.length||fo(u,r)}return!1}function fg(u,e,t,n,r){if(!u.samplerate){const i=o0(e,t,n,r);if(!i)return;nr(u,i)}}function hg(u){return 1024*9e4/u}function d0(u,e){const t=dg(u,e);if(e+t<=u.length){const n=su(u,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function gg(u,e,t,n,r){const i=hg(u.samplerate),o=n+r*i,l=d0(e,t);let d;if(l){const{frameLength:f,headerLength:h}=l,y=h+f,E=Math.max(0,t+y-e.length);E?(d=new Uint8Array(y-h),d.set(e.subarray(t+h,e.length),0)):d=e.subarray(t+h,t+y);const _={unit:d,pts:o};return E||u.samples.push(_),{sample:_,length:y,missing:E}}const c=e.length-t;return d=new Uint8Array(c),d.set(e.subarray(t,e.length),0),{sample:{unit:d,pts:o},length:c,missing:-1}}function f0(u,e){return au(u,e)&&mo(u,e+6)+10<=u.length-e}function h0(u){return u instanceof ArrayBuffer?u:u.byteOffset==0&&u.byteLength==u.buffer.byteLength?u.buffer:new Uint8Array(u).buffer}function ol(u,e=0,t=1/0){return g0(u,e,t,Uint8Array)}function g0(u,e,t,n){const r=m0(u);let i=1;"BYTES_PER_ELEMENT"in n&&(i=n.BYTES_PER_ELEMENT);const o=p0(u)?u.byteOffset:0,l=(o+u.byteLength)/i,d=(o+e)/i,c=Math.floor(Math.max(0,Math.min(d,l))),g=Math.floor(Math.min(c+Math.max(t,0),l));return new n(r,c,g-c)}function m0(u){return u instanceof ArrayBuffer?u:u.buffer}function p0(u){return u&&u.buffer instanceof ArrayBuffer&&u.byteLength!==void 0&&u.byteOffset!==void 0}function y0(u){const e={key:u.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(u.size<2)return;if(u.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const n=u.data.subarray(1).indexOf(0);if(n===-1)return;const r=qr(ol(u.data,1,n)),i=u.data[2+n],o=u.data.subarray(3+n).indexOf(0);if(o===-1)return;const l=qr(ol(u.data,3+n,o));let d;return r==="-->"?d=qr(ol(u.data,4+n+o)):d=h0(u.data.subarray(4+n+o)),e.mimeType=r,e.pictureType=i,e.description=l,e.data=d,e}function E0(u){if(u.size<2)return;const e=qr(u.data,!0),t=new Uint8Array(u.data.subarray(e.length+1));return{key:u.type,info:e,data:t.buffer}}function b0(u){if(u.size<2)return;if(u.type==="TXXX"){let t=1;const n=qr(u.data.subarray(t),!0);t+=n.length+1;const r=qr(u.data.subarray(t));return{key:u.type,info:n,data:r}}const e=qr(u.data.subarray(1));return{key:u.type,info:"",data:e}}function T0(u){if(u.type==="WXXX"){if(u.size<2)return;let t=1;const n=qr(u.data.subarray(t),!0);t+=n.length+1;const r=qr(u.data.subarray(t));return{key:u.type,info:n,data:r}}const e=qr(u.data);return{key:u.type,info:"",data:e}}function v0(u){return u.type==="PRIV"?E0(u):u.type[0]==="W"?T0(u):u.type==="APIC"?y0(u):b0(u)}function S0(u){const e=String.fromCharCode(u[0],u[1],u[2],u[3]),t=mo(u,4),n=10;return{type:e,size:t,data:u.subarray(n,n+t)}}const Os=10,_0=10;function mg(u){let e=0;const t=[];for(;au(u,e);){const n=mo(u,e+6);u[e+5]>>6&1&&(e+=Os),e+=Os;const r=e+n;for(;e+_0<r;){const i=S0(u.subarray(e)),o=v0(i);o&&t.push(o),e+=i.size+Os}ug(u,e)&&(e+=Os)}return t}function pg(u){return u&&u.key==="PRIV"&&u.info==="com.apple.streaming.transportStreamTimestamp"}function A0(u){if(u.data.byteLength===8){const e=new Uint8Array(u.data),t=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}}function ou(u){const e=mg(u);for(let t=0;t<e.length;t++){const n=e[t];if(pg(n))return A0(n)}}let jr=(function(u){return u.audioId3="org.id3",u.dateRange="com.apple.quicktime.HLS",u.emsg="https://aomedia.org/emsg/ID3",u.misbklv="urn:misb:KLV:bin:1910.1",u})({});function yi(u="",e=9e4){return{type:u,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class lu{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,n,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,n){}demux(e,t){this.cachedData&&(e=Wr(this.cachedData,e),this.cachedData=null);let n=ns(e,0),r=n?n.length:0,i;const o=this._audioTrack,l=this._id3Track,d=n?ou(n):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&on(d))&&(this.basePTS=I0(d,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:jr.audioId3,duration:Number.POSITIVE_INFINITY});r<c;){if(this.canParse(e,r)){const g=this.appendFrame(o,e,r);g?(this.frameIndex++,this.lastPTS=g.sample.pts,r+=g.length,i=r):r=c}else f0(e,r)?(n=ns(e,r),l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:jr.audioId3,duration:Number.POSITIVE_INFINITY}),r+=n.length,i=r):r++;if(r===c&&i!==c){const g=e.slice(i);this.cachedData?this.cachedData=Wr(this.cachedData,g):this.cachedData=g}}return{audioTrack:o,videoTrack:yi(),id3Track:l,textTrack:yi()}}demuxSampleAes(e,t,n){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:yi(),id3Track:this._id3Track,textTrack:yi()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const I0=(u,e,t)=>{if(on(u))return u*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};let Fs=null;const x0=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],w0=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],R0=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k0=[0,1,1,4];function yg(u,e,t,n,r){if(t+24>e.length)return;const i=Eg(e,t);if(i&&t+i.frameLength<=e.length){const o=i.samplesPerFrame*9e4/i.sampleRate,l=n+r*o,d={unit:e.subarray(t,t+i.frameLength),pts:l,dts:l};return u.config=[],u.channelCount=i.channelCount,u.samplerate=i.sampleRate,u.samples.push(d),{sample:d,length:i.frameLength,missing:0}}}function Eg(u,e){const t=u[e+1]>>3&3,n=u[e+1]>>1&3,r=u[e+2]>>4&15,i=u[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&i!==3){const o=u[e+2]>>1&1,l=u[e+3]>>6,d=t===3?3-n:n===3?3:4,c=x0[d*14+r-1]*1e3,f=w0[(t===3?0:t===2?1:2)*3+i],h=l===3?1:2,y=R0[t][n],E=k0[n],_=y*8*E,L=Math.floor(y*c/f+o)*E;if(Fs===null){const ae=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Fs=ae?parseInt(ae[1]):0}return Fs&&Fs<=87&&n===2&&c>=224e3&&l===0&&(u[e+3]=u[e+3]|128),{sampleRate:f,channelCount:h,frameLength:L,samplesPerFrame:_}}}function uu(u,e){return u[e]===255&&(u[e+1]&224)===224&&(u[e+1]&6)!==0}function bg(u,e){return e+1<u.length&&uu(u,e)}function C0(u,e){return uu(u,e)&&4<=u.length-e}function Tg(u,e){if(e+1<u.length&&uu(u,e)){const n=Eg(u,e);let r=4;n!=null&&n.frameLength&&(r=n.frameLength);const i=e+r;return i===u.length||bg(u,i)}return!1}class L0 extends lu{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const n=ns(e,0);let r=n?.length||0;if(Tg(e,r))return!1;for(let i=e.length;r<i;r++)if(c0(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return u0(e,t)}appendFrame(e,t,n){fg(e,this.observer,t,n,e.manifestCodec);const r=gg(e,t,n,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const vg=(u,e)=>{let t=0,n=5;e+=n;const r=new Uint32Array(1),i=new Uint32Array(1),o=new Uint8Array(1);for(;n>0;){o[0]=u[e];const l=Math.min(n,8),d=8-l;i[0]=4278190080>>>24+d<<d,r[0]=(o[0]&i[0])>>d,t=t?t<<l|r[0]:r[0],e+=1,n-=l}return t};class D0 extends lu{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const r=Sg(e,t,n,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=ns(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&ou(t)!==void 0&&vg(e,n)<16}}function Sg(u,e,t,n,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const i=e[t+4]>>6;if(i>=3)return-1;const l=[48e3,44100,32e3][i],d=e[t+4]&63,g=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][d*3+i]*2;if(t+g>e.length)return-1;const f=e[t+6]>>5;let h=0;f===2?h+=2:(f&1&&f!==1&&(h+=2),f&4&&(h+=2));const y=(e[t+6]<<8|e[t+7])>>12-h&1,_=[2,1,2,3,3,4,4,5][f]+y,L=e[t+5]>>3,K=e[t+5]&7,Z=new Uint8Array([i<<6|L<<1|K>>2,(K&3)<<6|f<<3|y<<2|d>>4,d<<4&224]),ae=1536/l*9e4,pe=n+r*ae,xe=e.subarray(t,t+g);return u.config=Z,u.channelCount=_,u.samplerate=l,u.samples.push({unit:xe,pts:pe}),g}class P0 extends lu{resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=ns(e,0);let n=t?.length||0;if(t&&e[n]===11&&e[n+1]===119&&ou(t)!==void 0&&vg(e,n)<=16)return!1;for(let r=e.length;n<r;n++)if(Tg(e,n))return Zn.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return C0(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return yg(e,t,n,this.basePTS,this.frameIndex)}}const N0=/\/emsg[-/]ID3/i;class M0{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,n,r){const i=this.videoTrack=yi("video",1),o=this.audioTrack=yi("audio",1),l=this.txtTrack=yi("text",1);if(this.id3Track=yi("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const d=Dh(e);if(d.video){const{id:c,timescale:g,codec:f,supplemental:h}=d.video;i.id=c,i.timescale=l.timescale=g,i.codec=f,i.supplemental=h}if(d.audio){const{id:c,timescale:g,codec:f}=d.audio;o.id=c,o.timescale=g,o.codec=f}l.id=kh.text,i.sampleDuration=0,i.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return DE(e)}demux(e,t){this.timeOffset=t;let n=e;const r=this.videoTrack,i=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=Wr(this.remainderData,e));const l=zE(n);this.remainderData=l.remainder,r.samples=l.valid||new Uint8Array}else r.samples=n;const o=this.extractID3Track(r,t);return i.samples=tf(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return n.samples=tf(e,t),{videoTrack:t,audioTrack:yi(),id3Track:r,textTrack:yi()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const r=On(e.samples,["emsg"]);r&&r.forEach(i=>{const o=jE(i);if(N0.test(o.schemeIdUri)){const l=zf(o,t);let d=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;d<=.001&&(d=Number.POSITIVE_INFINITY);const c=o.payload;n.samples.push({data:c,len:c.byteLength,dts:l,pts:l,type:jr.emsg,duration:d})}else if(this.config.enableEmsgKLVMetadata&&o.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const l=zf(o,t);n.samples.push({data:o.payload,len:o.payload.byteLength,dts:l,pts:l,type:jr.misbklv,duration:Number.POSITIVE_INFINITY})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function zf(u,e){return on(u.presentationTime)?u.presentationTime/u.timeScale:e+u.presentationTimeDelta/u.timeScale}class O0{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Jl(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Yi.cbc)}decryptAacSample(e,t,n){const r=e[t].unit;if(r.length<=16)return;const i=r.subarray(16,r.length-r.length%16),o=i.buffer.slice(i.byteOffset,i.byteOffset+i.length);this.decryptBuffer(o).then(l=>{const d=new Uint8Array(l);r.set(d,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)}).catch(n)}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let r=0;for(let i=32;i<e.length-16;i+=160,r+=16)n.set(e.subarray(i,i+16),r);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let r=0;for(let i=32;i<e.length-16;i+=160,r+=16)e.set(n.subarray(r,r+16),i);return e}decryptAvcSample(e,t,n,r,i){const o=Mh(i.data),l=this.getAvcEncryptedData(o);this.decryptBuffer(l.buffer).then(d=>{i.data=this.getAvcDecryptedUnit(o,d),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,r)}).catch(r)}decryptAvcSamples(e,t,n,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){r();return}const i=e[t].units;for(;!(n>=i.length);n++){const o=i[n];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,n,r,o),!this.decrypter.isSync()))return}}}}class _g{constructor(){this.VideoSample=null}createVideoSample(e,t,n){return{key:e,frame:!1,pts:t,dts:n,units:[],length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,r;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const i=n.units;r=i[i.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,r=n.length;if(r){const i=n[r-1];e.pts=i.pts,e.dts=i.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,n){const r=t.byteLength;let i=e.naluState||0;const o=i,l=[];let d=0,c,g,f,h=-1,y=0;for(i===-1&&(h=0,y=this.getNALuType(t,0),i=0,d=1);d<r;){if(c=t[d++],!i){i=c?0:1;continue}if(i===1){i=c?0:2;continue}if(!c)i=3;else if(c===1){if(g=d-i-1,h>=0){const E={data:t.subarray(h,g),type:y};l.push(E)}else{const E=this.getLastNalUnit(e.samples);E&&(o&&d<=4-o&&E.state&&(E.data=E.data.subarray(0,E.data.byteLength-o)),g>0&&(E.data=Wr(E.data,t.subarray(0,g)),E.state=0))}d<r?(f=this.getNALuType(t,d),h=d,y=f,i=0):i=-1}else i=0}if(h>=0&&i>=0){const E={data:t.subarray(h,r),type:y,state:i};l.push(E)}if(l.length===0){const E=this.getLastNalUnit(e.samples);E&&(E.data=Wr(E.data,t))}return e.naluState=i,l}}class Xa{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,n=e.byteLength-t,r=new Uint8Array(4),i=Math.min(4,t);if(i===0)throw new Error("no bytes available");r.set(e.subarray(n,n+i)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=i*8,this.bytesAvailable-=i}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const n=this.word>>>32-t;if(e>32&&Zn.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?n<<t|this.readBits(t):n}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class F0 extends _g{parsePES(e,t,n,r){const i=this.parseNALu(e,n.data,r);let o=this.VideoSample,l,d=!1;n.data=null,o&&i.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),i.forEach(c=>{var g,f;switch(c.type){case 1:{let _=!1;l=!0;const L=c.data;if(d&&L.length>4){const K=this.readSliceType(L);(K===2||K===4||K===7||K===9)&&(_=!0)}if(_){var h;(h=o)!=null&&h.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.frame=!0,o.key=_;break}case 5:l=!0,(g=o)!=null&&g.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.key=!0,o.frame=!0;break;case 6:{l=!0,Wl(c.data,1,n.pts,t.samples);break}case 7:{var y,E;l=!0,d=!0;const _=c.data,L=this.readSPS(_);if(!e.sps||e.width!==L.width||e.height!==L.height||((y=e.pixelRatio)==null?void 0:y[0])!==L.pixelRatio[0]||((E=e.pixelRatio)==null?void 0:E[1])!==L.pixelRatio[1]){e.width=L.width,e.height=L.height,e.pixelRatio=L.pixelRatio,e.sps=[_];const K=_.subarray(1,4);let Z="avc1.";for(let ae=0;ae<3;ae++){let pe=K[ae].toString(16);pe.length<2&&(pe="0"+pe),Z+=pe}e.codec=Z}break}case 8:l=!0,e.pps=[c.data];break;case 9:l=!0,e.audFound=!0,(f=o)!=null&&f.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;case 12:l=!0;break;default:l=!1;break}o&&l&&o.units.push(c)}),r&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Xa(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let n=8,r=8,i;for(let o=0;o<e;o++)r!==0&&(i=t.readEG(),r=(n+i+256)%256),n=r===0?n:r}readSPS(e){const t=new Xa(e);let n=0,r=0,i=0,o=0,l,d,c;const g=t.readUByte.bind(t),f=t.readBits.bind(t),h=t.readUEG.bind(t),y=t.readBoolean.bind(t),E=t.skipBits.bind(t),_=t.skipEG.bind(t),L=t.skipUEG.bind(t),K=this.skipScalingList.bind(this);g();const Z=g();if(f(5),E(3),g(),L(),Z===100||Z===110||Z===122||Z===244||Z===44||Z===83||Z===86||Z===118||Z===128){const J=h();if(J===3&&E(1),L(),L(),E(1),y())for(d=J!==3?8:12,c=0;c<d;c++)y()&&(c<6?K(16,t):K(64,t))}L();const ae=h();if(ae===0)h();else if(ae===1)for(E(1),_(),_(),l=h(),c=0;c<l;c++)_();L(),E(1);const pe=h(),xe=h(),ke=f(1);ke===0&&E(1),E(1),y()&&(n=h(),r=h(),i=h(),o=h());let Y=[1,1];if(y()&&y())switch(g()){case 1:Y=[1,1];break;case 2:Y=[12,11];break;case 3:Y=[10,11];break;case 4:Y=[16,11];break;case 5:Y=[40,33];break;case 6:Y=[24,11];break;case 7:Y=[20,11];break;case 8:Y=[32,11];break;case 9:Y=[80,33];break;case 10:Y=[18,11];break;case 11:Y=[15,11];break;case 12:Y=[64,33];break;case 13:Y=[160,99];break;case 14:Y=[4,3];break;case 15:Y=[3,2];break;case 16:Y=[2,1];break;case 255:{Y=[g()<<8|g(),g()<<8|g()];break}}return{width:Math.ceil((pe+1)*16-n*2-r*2),height:(2-ke)*(xe+1)*16-(ke?2:4)*(i+o),pixelRatio:Y}}}class U0 extends _g{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,n,r){const i=this.parseNALu(e,n.data,r);let o=this.VideoSample,l,d=!1;n.data=null,o&&i.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),i.forEach(c=>{var g,f;switch(c.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:o||(o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),o.frame=!0,l=!0;break;case 16:case 17:case 18:case 21:if(l=!0,d){var h;(h=o)!=null&&h.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.key=!0,o.frame=!0;break;case 19:case 20:l=!0,(g=o)!=null&&g.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.key=!0,o.frame=!0;break;case 39:l=!0,Wl(c.data,2,n.pts,t.samples);break;case 32:l=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=nr(e.params,this.readVPS(c.data)),this.initVPS=c.data),e.vps=[c.data];break;case 33:if(l=!0,d=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],c.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const y=this.readSPS(c.data);e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.codec=y.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const E in y.params)e.params[E]=y.params[E]}this.pushParameterSet(e.sps,c.data,e.vps),o||(o=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),o.key=!0;break;case 34:if(l=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const y=this.readPPS(c.data);for(const E in y)e.params[E]=y[E]}this.pushParameterSet(e.pps,c.data,e.vps)}break;case 35:l=!0,e.audFound=!0,(f=o)!=null&&f.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;default:l=!1;break}o&&l&&o.units.push(c)}),r&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}pushParameterSet(e,t,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let n=0;for(let r=0;r<e.byteLength;r++)r>=2&&e[r]===3&&e[r-1]===0&&e[r-2]===0||(t[n]=e[r],n++);return new Uint8Array(t.buffer,0,n)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Xa(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const n=t.readBits(3),r=t.readBoolean();return{numTemporalLayers:n+1,temporalIdNested:r}}readSPS(e){const t=new Xa(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const n=t.readBits(3);t.readBoolean();const r=t.readBits(2),i=t.readBoolean(),o=t.readBits(5),l=t.readUByte(),d=t.readUByte(),c=t.readUByte(),g=t.readUByte(),f=t.readUByte(),h=t.readUByte(),y=t.readUByte(),E=t.readUByte(),_=t.readUByte(),L=t.readUByte(),K=t.readUByte(),Z=[],ae=[];for(let Ue=0;Ue<n;Ue++)Z.push(t.readBoolean()),ae.push(t.readBoolean());if(n>0)for(let Ue=n;Ue<8;Ue++)t.readBits(2);for(let Ue=0;Ue<n;Ue++)Z[Ue]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),ae[Ue]&&t.readUByte();t.readUEG();const pe=t.readUEG();pe==3&&t.skipBits(1);const xe=t.readUEG(),ke=t.readUEG(),Y=t.readBoolean();let J=0,he=0,Ee=0,Le=0;Y&&(J+=t.readUEG(),he+=t.readUEG(),Ee+=t.readUEG(),Le+=t.readUEG());const et=t.readUEG(),Ae=t.readUEG(),Ze=t.readUEG(),Be=t.readBoolean();for(let Ue=Be?0:n;Ue<=n;Ue++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let je=0;je<4;je++)for(let Oe=0;Oe<(je===3?2:6);Oe++)if(!t.readBoolean())t.readUEG();else{const st=Math.min(64,1<<4+(je<<1));je>1&&t.readEG();for(let it=0;it<st;it++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const mt=t.readUEG();let Ge=0;for(let Ue=0;Ue<mt;Ue++){let je=!1;if(Ue!==0&&(je=t.readBoolean()),je){Ue===mt&&t.readUEG(),t.readBoolean(),t.readUEG();let Oe=0;for(let He=0;He<=Ge;He++){const st=t.readBoolean();let it=!1;st||(it=t.readBoolean()),(st||it)&&Oe++}Ge=Oe}else{const Oe=t.readUEG(),He=t.readUEG();Ge=Oe+He;for(let st=0;st<Oe;st++)t.readUEG(),t.readBoolean();for(let st=0;st<He;st++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Ue=t.readUEG();for(let je=0;je<Ue;je++){for(let Oe=0;Oe<Ze+4;Oe++)t.readBits(1);t.readBits(1)}}let Xe=0,nt=1,Ft=1,Xt=!0,Pe=1,De=0;t.readBoolean(),t.readBoolean();let dt=!1;if(t.readBoolean()){if(t.readBoolean()){const Et=t.readUByte(),nn=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Ut=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Et>0&&Et<16?(nt=nn[Et-1],Ft=Ut[Et-1]):Et===255&&(nt=t.readBits(16),Ft=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),dt=t.readBoolean(),dt&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(Pe=t.readBits(32),De=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Ut=t.readBoolean(),Kt=t.readBoolean();let kt=!1;(Ut||Kt)&&(kt=t.readBoolean(),kt&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),kt&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Tn=0;Tn<=n;Tn++){Xt=t.readBoolean();const Bn=Xt||t.readBoolean();let Jn=!1;Bn?t.readEG():Jn=t.readBoolean();const gr=Jn?1:t.readUEG()+1;if(Ut)for(let dr=0;dr<gr;dr++)t.readUEG(),t.readUEG(),kt&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(Kt)for(let dr=0;dr<gr;dr++)t.readUEG(),t.readUEG(),kt&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),Xe=t.readUEG())}let H=xe,w=ke;if(Y){let Ue=1,je=1;pe===1?Ue=je=2:pe==2&&(Ue=2),H=xe-Ue*he-Ue*J,w=ke-je*Le-je*Ee}const D=r?["A","B","C"][r]:"",oe=l<<24|d<<16|c<<8|g;let F=0;for(let Ue=0;Ue<32;Ue++)F=(F|(oe>>Ue&1)<<31-Ue)>>>0;let Me=F.toString(16);return o===1&&Me==="2"&&(Me="6"),{codecString:`hvc1.${D}${o}.${Me}.${i?"H":"L"}${K}.B0`,params:{general_tier_flag:i,general_profile_idc:o,general_profile_space:r,general_profile_compatibility_flags:[l,d,c,g],general_constraint_indicator_flags:[f,h,y,E,_,L],general_level_idc:K,bit_depth:et+8,bit_depth_luma_minus8:et,bit_depth_chroma_minus8:Ae,min_spatial_segmentation_idc:Xe,chroma_format_idc:pe,frame_rate:{fixed:Xt,fps:De/Pe}},width:H,height:w,pixelRatio:[nt,Ft]}}readPPS(e){const t=new Xa(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const r=t.readBoolean(),i=t.readBoolean();let o=1;return i&&r?o=0:i?o=3:r&&(o=2),{parallelismType:o}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Tr=188;class Vi{constructor(e,t,n,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.logger=r,this.videoParser=null}static probe(e,t){const n=Vi.syncOffset(e);return n>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${n}`),n!==-1}static syncOffset(e){const t=e.length;let n=Math.min(Tr*5,t-Tr)+1,r=0;for(;r<n;){let i=!1,o=-1,l=0;for(let d=r;d<t;d+=Tr)if(e[d]===71&&(t-d===Tr||e[d+Tr]===71)){if(l++,o===-1&&(o=d,o!==0&&(n=Math.min(o+Tr*99,e.length-Tr)+1)),i||(i=Ml(e,d)===0),i&&l>1&&(o===0&&l>2||d+Tr>n))return o}else{if(l)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:kh[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Vi.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=Vi.createTrack("audio",r),this._id3Track=Vi.createTrack("id3"),this._txtTrack=Vi.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,r=!1){n||(this.sampleAes=null);let i;const o=this._videoTrack,l=this._audioTrack,d=this._id3Track,c=this._txtTrack;let g=o.pid,f=o.pesData,h=l.pid,y=d.pid,E=l.pesData,_=d.pesData,L=null,K=this.pmtParsed,Z=this._pmtId,ae=e.length;if(this.remainderData&&(e=Wr(this.remainderData,e),ae=e.length,this.remainderData=null),ae<Tr&&!r)return this.remainderData=e,{audioTrack:l,videoTrack:o,id3Track:d,textTrack:c};const pe=Math.max(0,Vi.syncOffset(e));ae-=(ae-pe)%Tr,ae<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,ae,e.buffer.byteLength-ae));let xe=0;for(let Y=pe;Y<ae;Y+=Tr)if(e[Y]===71){const J=!!(e[Y+1]&64),he=Ml(e,Y),Ee=(e[Y+3]&48)>>4;let Le;if(Ee>1){if(Le=Y+5+e[Y+4],Le===Y+Tr)continue}else Le=Y+4;switch(he){case g:J&&(f&&(i=Sa(f,this.logger))&&(this.readyVideoParser(o.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(o,c,i,!1)),f={data:[],size:0}),f&&(f.data.push(e.subarray(Le,Y+Tr)),f.size+=Y+Tr-Le);break;case h:if(J){if(E&&(i=Sa(E,this.logger)))switch(l.segmentCodec){case"aac":this.parseAACPES(l,i);break;case"mp3":this.parseMPEGPES(l,i);break;case"ac3":this.parseAC3PES(l,i);break}E={data:[],size:0}}E&&(E.data.push(e.subarray(Le,Y+Tr)),E.size+=Y+Tr-Le);break;case y:J&&(_&&(i=Sa(_,this.logger))&&this.parseID3PES(d,i),_={data:[],size:0}),_&&(_.data.push(e.subarray(Le,Y+Tr)),_.size+=Y+Tr-Le);break;case 0:J&&(Le+=e[Le]+1),Z=this._pmtId=z0(e,Le);break;case Z:{J&&(Le+=e[Le]+1);const et=B0(e,Le,this.typeSupported,n,this.observer,this.logger);g=et.videoPid,g>0&&(o.pid=g,o.segmentCodec=et.segmentVideoCodec),h=et.audioPid,h>0&&(l.pid=h,l.segmentCodec=et.segmentAudioCodec),y=et.id3Pid,y>0&&(d.pid=y),L!==null&&!K&&(this.logger.warn(`MPEG-TS PMT found at ${Y} after unknown PID '${L}'. Backtracking to sync byte @${pe} to parse all TS packets.`),L=null,Y=pe-188),K=this.pmtParsed=!0;break}case 17:case 8191:break;default:L=he;break}}else xe++;xe>0&&Ol(this.observer,new Error(`Found ${xe} TS packet/s that do not start with 0x47`),void 0,this.logger),o.pesData=f,l.pesData=E,d.pesData=_;const ke={audioTrack:l,videoTrack:o,id3Track:d,textTrack:c};return r&&this.extractRemainingSamples(ke),ke}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:n,id3Track:r,textTrack:i}=e,o=n.pesData,l=t.pesData,d=r.pesData;let c;if(o&&(c=Sa(o,this.logger))?(this.readyVideoParser(n.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(n,i,c,!0),n.pesData=null)):n.pesData=o,l&&(c=Sa(l,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break;case"ac3":this.parseAC3PES(t,c);break}t.pesData=null}else l!=null&&l.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=l;d&&(c=Sa(d,this.logger))?(this.parseID3PES(r,c),r.pesData=null):r.pesData=d}demuxSampleAes(e,t,n){const r=this.demux(e,n,!0,!this.config.progressive),i=this.sampleAes=new O0(this.observer,this.config,t);return this.decrypt(r,i)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new F0:e==="hevc"&&(this.videoParser=new U0))}decrypt(e,t){return new Promise(n=>{const{audioTrack:r,videoTrack:i}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{i.samples?t.decryptAvcSamples(i.samples,0,0,()=>{n(e)}):n(e)}):i.samples&&t.decryptAvcSamples(i.samples,0,0,()=>{n(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let n=0;const r=this.aacOverFlow;let i=t.data;if(r){this.aacOverFlow=null;const f=r.missing,h=r.sample.unit.byteLength;if(f===-1)i=Wr(r.sample.unit,i);else{const y=h-f;r.sample.unit.set(i.subarray(0,f),y),e.samples.push(r.sample),n=r.missing}}let o,l;for(o=n,l=i.length;o<l-1&&!fo(i,o);o++);if(o!==n){let f;const h=o<l-1;if(h?f=`AAC PES did not start with ADTS header,offset:${o}`:f="No ADTS header found in AAC PES",Ol(this.observer,new Error(f),h,this.logger),!h)return}fg(e,this.observer,i,o,this.audioCodec);let d;if(t.pts!==void 0)d=t.pts;else if(r){const f=hg(e.samplerate);d=r.sample.pts+f}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,g;for(;o<l;)if(g=gg(e,i,o,d,c),o+=g.length,g.missing){this.aacOverFlow=g;break}else for(c++;o<l-1&&!fo(i,o);o++);}parseMPEGPES(e,t){const n=t.data,r=n.length;let i=0,o=0;const l=t.pts;if(l===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<r;)if(bg(n,o)){const d=yg(e,n,o,l,i);if(d)o+=d.length,i++;else break}else o++}parseAC3PES(e,t){{const n=t.data,r=t.pts;if(r===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const i=n.length;let o=0,l=0,d;for(;l<i&&(d=Sg(e,n,l,r,o++))>0;)l+=d}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=nr({},t,{type:this._videoTrack?jr.emsg:jr.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function Ml(u,e){return((u[e+1]&31)<<8)+u[e+2]}function z0(u,e){return(u[e+10]&31)<<8|u[e+11]}function B0(u,e,t,n,r,i){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},l=(u[e+1]&15)<<8|u[e+2],d=e+3+l-4,c=(u[e+10]&15)<<8|u[e+11];for(e+=12+c;e<d;){const g=Ml(u,e),f=(u[e+3]&15)<<8|u[e+4];switch(u[e]){case 207:if(!n){ll("ADTS AAC",i);break}case 15:o.audioPid===-1&&(o.audioPid=g);break;case 21:o.id3Pid===-1&&(o.id3Pid=g);break;case 219:if(!n){ll("H.264",i);break}case 27:o.videoPid===-1&&(o.videoPid=g);break;case 3:case 4:!t.mpeg&&!t.mp3?i.log("MPEG audio found, not supported in this browser"):o.audioPid===-1&&(o.audioPid=g,o.segmentAudioCodec="mp3");break;case 193:if(!n){ll("AC-3",i);break}case 129:t.ac3?o.audioPid===-1&&(o.audioPid=g,o.segmentAudioCodec="ac3"):i.log("AC-3 audio found, not supported in this browser");break;case 6:if(o.audioPid===-1&&f>0){let h=e+5,y=f;for(;y>2;){u[h]===106&&(t.ac3!==!0?i.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=g,o.segmentAudioCodec="ac3"));const _=u[h+1]+2;h+=_,y-=_}}break;case 194:case 135:return Ol(r,new Error("Unsupported EC-3 in M2TS found"),void 0,i),o;case 36:o.videoPid===-1&&(o.videoPid=g,o.segmentVideoCodec="hevc",i.log("HEVC in M2TS found"));break}e+=f+5}return o}function Ol(u,e,t,n){n.warn(`parsing error: ${e.message}`),u.emit(ue.ERROR,ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function ll(u,e){e.log(`${u} with AES-128-CBC encryption found in unencrypted stream`)}function Sa(u,e){let t=0,n,r,i,o,l;const d=u.data;if(!u||u.size===0)return null;for(;d[0].length<19&&d.length>1;)d[0]=Wr(d[0],d[1]),d.splice(1,1);if(n=d[0],(n[0]<<16)+(n[1]<<8)+n[2]===1){if(r=(n[4]<<8)+n[5],r&&r>u.size-6)return null;const g=n[7];g&192&&(o=(n[9]&14)*536870912+(n[10]&255)*4194304+(n[11]&254)*16384+(n[12]&255)*128+(n[13]&254)/2,g&64?(l=(n[14]&14)*536870912+(n[15]&255)*4194304+(n[16]&254)*16384+(n[17]&255)*128+(n[18]&254)/2,o-l>60*9e4&&(e.warn(`${Math.round((o-l)/9e4)}s delta between PTS and DTS, align them`),o=l)):l=o),i=n[8];let f=i+9;if(u.size<=f)return null;u.size-=f;const h=new Uint8Array(u.size);for(let y=0,E=d.length;y<E;y++){n=d[y];let _=n.byteLength;if(f)if(f>_){f-=_;continue}else n=n.subarray(f),_-=f,f=0;h.set(n,t),t+=_}return r&&(r-=i+3),{data:h,pts:o,dts:l,len:r}}return null}class j0{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const qi=Math.pow(2,32)-1;class at{static init(){at.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in at.types)at.types.hasOwnProperty(e)&&(at.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);at.HDLR_TYPES={video:t,audio:n};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);at.STTS=at.STSC=at.STCO=i,at.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),at.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),at.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),at.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),d=new Uint8Array([0,0,0,1]);at.FTYP=at.box(at.types.ftyp,o,d,o,l),at.DINF=at.box(at.types.dinf,at.box(at.types.dref,r))}static box(e,...t){let n=8,r=t.length;const i=r;for(;r--;)n+=t[r].byteLength;const o=new Uint8Array(n);for(o[0]=n>>24&255,o[1]=n>>16&255,o[2]=n>>8&255,o[3]=n&255,o.set(e,4),r=0,n=8;r<i;r++)o.set(t[r],n),n+=t[r].byteLength;return o}static hdlr(e){return at.box(at.types.hdlr,at.HDLR_TYPES[e])}static mdat(e){return at.box(at.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(qi+1)),r=Math.floor(t%(qi+1));return at.box(at.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return at.box(at.types.mdia,at.mdhd(e.timescale||0,e.duration||0),at.hdlr(e.type),at.minf(e))}static mfhd(e){return at.box(at.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?at.box(at.types.minf,at.box(at.types.smhd,at.SMHD),at.DINF,at.stbl(e)):at.box(at.types.minf,at.box(at.types.vmhd,at.VMHD),at.DINF,at.stbl(e))}static moof(e,t,n){return at.box(at.types.moof,at.mfhd(e),at.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=at.trak(e[t]);return at.box.apply(null,[at.types.moov,at.mvhd(e[0].timescale||0,e[0].duration||0)].concat(n).concat(at.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=at.trex(e[t]);return at.box.apply(null,[at.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(qi+1)),r=Math.floor(t%(qi+1)),i=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,r>>24,r>>16&255,r>>8&255,r&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return at.box(at.types.mvhd,i)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let r,i;for(r=0;r<t.length;r++)i=t[r].flags,n[r+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return at.box(at.types.sdtp,n)}static stbl(e){return at.box(at.types.stbl,at.stsd(e),at.box(at.types.stts,at.STTS),at.box(at.types.stsc,at.STSC),at.box(at.types.stsz,at.STSZ),at.box(at.types.stco,at.STCO))}static avc1(e){let t=[],n=[],r,i,o;for(r=0;r<e.sps.length;r++)i=e.sps[r],o=i.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(i));for(r=0;r<e.pps.length;r++)i=e.pps[r],o=i.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(i));const l=at.box(at.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),d=e.width,c=e.height,g=e.pixelRatio[0],f=e.pixelRatio[1];return at.box(at.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,d>>8&255,d&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,at.box(at.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),at.box(at.types.pasp,new Uint8Array([g>>24,g>>16&255,g>>8&255,g&255,f>>24,f>>16&255,f>>8&255,f&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return at.box(at.types.mp4a,at.audioStsd(e),at.box(at.types.esds,at.esds(e)))}static mp3(e){return at.box(at.types[".mp3"],at.audioStsd(e))}static ac3(e){return at.box(at.types["ac-3"],at.audioStsd(e),at.box(at.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return at.box(at.types.stsd,at.STSD,at.mp4a(e));if(t==="ac3"&&e.config)return at.box(at.types.stsd,at.STSD,at.ac3(e));if(t==="mp3"&&e.codec==="mp3")return at.box(at.types.stsd,at.STSD,at.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return at.box(at.types.stsd,at.STSD,at.avc1(e));if(t==="hevc"&&e.vps)return at.box(at.types.stsd,at.STSD,at.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,n=(e.duration||0)*(e.timescale||0),r=e.width||0,i=e.height||0,o=Math.floor(n/(qi+1)),l=Math.floor(n%(qi+1));return at.box(at.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,l>>24,l>>16&255,l>>8&255,l&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,r&255,0,0,i>>8&255,i&255,0,0]))}static traf(e,t){const n=at.sdtp(e),r=e.id,i=Math.floor(t/(qi+1)),o=Math.floor(t%(qi+1));return at.box(at.types.traf,at.box(at.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),at.box(at.types.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,i&255,o>>24,o>>16&255,o>>8&255,o&255])),at.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,at.box(at.types.trak,at.tkhd(e),at.mdia(e))}static trex(e){const t=e.id;return at.box(at.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const n=e.samples||[],r=n.length,i=12+16*r,o=new Uint8Array(i);let l,d,c,g,f,h;for(t+=8+i,o.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),l=0;l<r;l++)d=n[l],c=d.duration,g=d.size,f=d.flags,h=d.cts,o.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,g>>>24&255,g>>>16&255,g>>>8&255,g&255,f.isLeading<<2|f.dependsOn,f.isDependedOn<<6|f.hasRedundancy<<4|f.paddingValue<<1|f.isNonSync,f.degradPrio&61440,f.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*l);return at.box(at.types.trun,o)}static initSegment(e){at.types||at.init();const t=at.moov(e);return Wr(at.FTYP,t)}static hvc1(e){const t=e.params,n=[e.vps,e.sps,e.pps],r=4,i=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),r-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),n.length]);let o=i.length;for(let E=0;E<n.length;E+=1){o+=3;for(let _=0;_<n[E].length;_+=1)o+=2+n[E][_].length}const l=new Uint8Array(o);l.set(i,0),o=i.length;const d=n.length-1;for(let E=0;E<n.length;E+=1){l.set(new Uint8Array([32+E|(E===d?128:0),0,n[E].length]),o),o+=3;for(let _=0;_<n[E].length;_+=1)l.set(new Uint8Array([n[E][_].length>>8,n[E][_].length&255]),o),o+=2,l.set(n[E][_],o),o+=n[E][_].length}const c=at.box(at.types.hvcC,l),g=e.width,f=e.height,h=e.pixelRatio[0],y=e.pixelRatio[1];return at.box(at.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,g>>8&255,g&255,f>>8&255,f&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),c,at.box(at.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),at.box(at.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,y>>24,y>>16&255,y>>8&255,y&255])))}}at.types=void 0;at.HDLR_TYPES=void 0;at.STTS=void 0;at.STSC=void 0;at.STCO=void 0;at.STSZ=void 0;at.VMHD=void 0;at.SMHD=void 0;at.STSD=void 0;at.FTYP=void 0;at.DINF=void 0;const Ag=9e4;function cu(u,e,t=1,n=!1){const r=u*e*t;return n?Math.round(r):r}function q0(u,e,t=1,n=!1){return cu(u,e,1/t,n)}function Ha(u,e=!1){return cu(u,1e3,1/Ag,e)}function G0(u,e=1){return cu(u,Ag,1/e)}function Bf(u){const{baseTime:e,timescale:t,trackId:n}=u;return`${e/t} (${e}/${t}) trackId: ${n}`}const $0=10*1e3,V0=1024,H0=1152,K0=1536;let _a=null,ul=null;function jf(u,e,t,n){return{duration:e,size:t,cts:n,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:u?2:1,isNonSync:u?0:1}}}class Xs extends Qr{constructor(e,t,n,r){if(super("mp4-remuxer",r),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=n,this.ISGenerated=!1,_a===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);_a=o?parseInt(o[1]):0}if(ul===null){const i=navigator.userAgent.match(/Safari\/(\d+)/i);ul=i?parseInt(i[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&Bf(t)} > ${e&&Bf(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const n=e[0].pts,r=e.reduce((i,o)=>{let l=o.pts,d=l-i;return d<-4294967296&&(t=!0,l=Br(l,n),d=l-i),d>0?i:l},n);return t&&this.debug("PTS rollover detected"),r}remux(e,t,n,r,i,o,l,d){let c,g,f,h,y,E,_=i,L=i;const K=e.pid>-1,Z=t.pid>-1,ae=t.samples.length,pe=e.samples.length>0,xe=l&&ae>0||ae>1;if((!K||pe)&&(!Z||xe)||this.ISGenerated||l){if(this.ISGenerated){var Y,J,he,Ee;const Ze=this.videoTrackConfig;(Ze&&(t.width!==Ze.width||t.height!==Ze.height||((Y=t.pixelRatio)==null?void 0:Y[0])!==((J=Ze.pixelRatio)==null?void 0:J[0])||((he=t.pixelRatio)==null?void 0:he[1])!==((Ee=Ze.pixelRatio)==null?void 0:Ee[1]))||!Ze&&xe||this.nextAudioTs===null&&pe)&&this.resetInitSegment()}this.ISGenerated||(f=this.generateIS(e,t,i,o));const Le=this.isVideoContiguous;let et=-1,Ae;if(xe&&(et=Y0(t.samples),!Le&&this.config.forceKeyFrameOnDiscontinuity))if(E=!0,et>0){this.warn(`Dropped ${et} out of ${ae} video samples due to a missing keyframe`);const Ze=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(et),t.dropped+=et,L+=(t.samples[0].pts-Ze)/t.inputTimeScale,Ae=L}else et===-1&&(this.warn(`No keyframe found out of ${ae} video samples`),E=!1);if(this.ISGenerated){if(pe&&xe){const Ze=this.getVideoStartPts(t.samples),Ne=(Br(e.samples[0].pts,Ze)-Ze)/t.inputTimeScale;_+=Math.max(0,Ne),L+=Math.max(0,-Ne)}if(pe){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),f=this.generateIS(e,t,i,o)),g=this.remuxAudio(e,_,this.isAudioContiguous,o,Z||xe||d===hn.AUDIO?L:void 0),xe){const Ze=g?g.endPTS-g.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),f=this.generateIS(e,t,i,o)),c=this.remuxVideo(t,L,Le,Ze)}}else xe&&(c=this.remuxVideo(t,L,Le,0));c&&(c.firstKeyFrame=et,c.independent=et!==-1,c.firstKeyFramePTS=Ae)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(y=Ig(n,i,this._initPTS,this._initDTS)),r.samples.length&&(h=xg(r,i,this._initPTS))),{audio:g,video:c,initSegment:f,independent:E,text:h,id3:y}}computeInitPts(e,t,n,r){const i=Math.round(n*t);let o=Br(e,i);if(o<i+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(i-o)/t} ${r}`);o<i+t;)o+=8589934592;return o-i}generateIS(e,t,n,r){const i=e.samples,o=t.samples,l=this.typeSupported,d={},c=this._initPTS;let g=!c||r,f="audio/mp4",h,y,E,_=-1;if(g&&(h=y=1/0),e.config&&i.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":l.mpeg?(f="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}d.audio={id:"audio",container:f,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&l.mpeg?new Uint8Array(0):at.initSegment([e]),metadata:{channelCount:e.channelCount}},g&&(_=e.id,E=e.inputTimeScale,!c||E!==c.timescale?h=y=this.computeInitPts(i[0].pts,E,n,"audio"):g=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:at.initSegment([t]),metadata:{width:t.width,height:t.height}},g)if(_=t.id,E=t.inputTimeScale,!c||E!==c.timescale){const L=this.getVideoStartPts(o),K=Br(o[0].dts,L),Z=this.computeInitPts(K,E,n,"video"),ae=this.computeInitPts(L,E,n,"video");y=Math.min(y,Z),h=Math.min(h,ae)}else g=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(d).length)return this.ISGenerated=!0,g?(c&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${n} ${h/E} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${h/E} (${h}/${E}) trackId: ${_}`),this._initPTS={baseTime:h,timescale:E,trackId:_},this._initDTS={baseTime:y,timescale:E,trackId:_}):h=E=void 0,{tracks:d,initPTS:h,timescale:E,trackId:_}}remuxVideo(e,t,n,r){const i=e.inputTimeScale,o=e.samples,l=[],d=o.length,c=this._initPTS,g=c.baseTime*i/c.timescale;let f=this.nextVideoTs,h=8,y=this.videoSampleDuration,E,_,L=Number.POSITIVE_INFINITY,K=Number.NEGATIVE_INFINITY,Z=!1;if(!n||f===null){const Xe=g+t*i,nt=o[0].pts-Br(o[0].dts,o[0].pts);_a&&f!==null&&Math.abs(Xe-nt-(f+g))<15e3?n=!0:f=Xe-nt-g}const ae=f+g;for(let Xe=0;Xe<d;Xe++){const nt=o[Xe];nt.pts=Br(nt.pts,ae),nt.dts=Br(nt.dts,ae),nt.dts<o[Xe>0?Xe-1:Xe].dts&&(Z=!0)}Z&&o.sort(function(Xe,nt){const Ft=Xe.dts-nt.dts,Xt=Xe.pts-nt.pts;return Ft||Xt}),E=o[0].dts,_=o[o.length-1].dts;const pe=_-E,xe=pe?Math.round(pe/(d-1)):y||e.inputTimeScale/30;if(n){const Xe=E-ae,nt=Xe>xe,Ft=Xe<-1;if((nt||Ft)&&(nt?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Ha(Xe,!0)} ms (${Xe}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${Ha(-Xe,!0)} ms (${Xe}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Ft||ae>=o[0].pts||_a)){E=ae;const Xt=o[0].pts-Xe;if(nt)o[0].dts=E,o[0].pts=Xt;else{let Pe=!0;for(let De=0;De<o.length&&!(o[De].dts>Xt&&Pe);De++){const dt=o[De].pts;if(o[De].dts-=Xe,o[De].pts-=Xe,De<o.length-1){const Q=o[De+1].pts,H=o[De].pts,w=Q<=H,D=Q<=dt;Pe=w==D}}}this.log(`Video: Initial PTS/DTS adjusted: ${Ha(Xt,!0)}/${Ha(E,!0)}, delta: ${Ha(Xe,!0)} ms`)}}E=Math.max(0,E);let ke=0,Y=0,J=E;for(let Xe=0;Xe<d;Xe++){const nt=o[Xe],Ft=nt.units,Xt=Ft.length;let Pe=0;for(let De=0;De<Xt;De++)Pe+=Ft[De].data.length;Y+=Pe,ke+=Xt,nt.length=Pe,nt.dts<J?(nt.dts=J,J+=xe/4|0||1):J=nt.dts,L=Math.min(nt.pts,L),K=Math.max(nt.pts,K)}_=o[d-1].dts;const he=Y+4*ke+8;let Ee;try{Ee=new Uint8Array(he)}catch(Xe){this.observer.emit(ue.ERROR,ue.ERROR,{type:_n.MUX_ERROR,details:lt.REMUX_ALLOC_ERROR,fatal:!1,error:Xe,bytes:he,reason:`fail allocating video mdat ${he}`});return}const Le=new DataView(Ee.buffer);Le.setUint32(0,he),Ee.set(at.types.mdat,4);let et=!1,Ae=Number.POSITIVE_INFINITY,Ze=Number.POSITIVE_INFINITY,Be=Number.NEGATIVE_INFINITY,Ne=Number.NEGATIVE_INFINITY;for(let Xe=0;Xe<d;Xe++){const nt=o[Xe],Ft=nt.units;let Xt=0;for(let dt=0,Q=Ft.length;dt<Q;dt++){const H=Ft[dt],w=H.data,D=H.data.byteLength;Le.setUint32(h,D),h+=4,Ee.set(w,h),h+=D,Xt+=4+D}let Pe;if(Xe<d-1)y=o[Xe+1].dts-nt.dts,Pe=o[Xe+1].pts-nt.pts;else{const dt=this.config,Q=Xe>0?nt.dts-o[Xe-1].dts:xe;if(Pe=Xe>0?nt.pts-o[Xe-1].pts:xe,dt.stretchShortVideoTrack&&this.nextAudioTs!==null){const H=Math.floor(dt.maxBufferHole*i),w=(r?L+r*i:this.nextAudioTs+g)-nt.pts;w>H?(y=w-Q,y<0?y=Q:et=!0,this.log(`It is approximately ${w/90} ms to the next segment; using duration ${y/90} ms for the last video frame.`)):y=Q}else y=Q}const De=Math.round(nt.pts-nt.dts);Ae=Math.min(Ae,y),Be=Math.max(Be,y),Ze=Math.min(Ze,Pe),Ne=Math.max(Ne,Pe),l.push(jf(nt.key,y,Xt,De))}if(l.length){if(_a){if(_a<70){const Xe=l[0].flags;Xe.dependsOn=2,Xe.isNonSync=0}}else if(ul&&Ne-Ze<Be-Ae&&xe/Be<.025&&l[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let Xe=E;for(let nt=0,Ft=l.length;nt<Ft;nt++){const Xt=Xe+l[nt].duration,Pe=Xe+l[nt].cts;if(nt<Ft-1){const De=Xt+l[nt+1].cts;l[nt].duration=De-Pe}else l[nt].duration=nt?l[nt-1].duration:xe;l[nt].cts=0,Xe=Xt}}}y=et||!y?xe:y;const tt=_+y;this.nextVideoTs=f=tt-g,this.videoSampleDuration=y,this.isVideoContiguous=!0;const ut={data1:at.moof(e.sequenceNumber++,E,nr(e,{samples:l})),data2:Ee,startPTS:(L-g)/i,endPTS:(K+y-g)/i,startDTS:(E-g)/i,endDTS:f/i,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,ut}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return H0;case"ac3":return K0;default:return V0}}remuxAudio(e,t,n,r,i){const o=e.inputTimeScale,l=e.samplerate?e.samplerate:o,d=o/l,c=this.getSamplesPerFrame(e),g=c*d,f=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,y=[],E=i!==void 0;let _=e.samples,L=h?0:8,K=this.nextAudioTs||-1;const Z=f.baseTime*o/f.timescale,ae=Z+t*o;if(this.isAudioContiguous=n=n||_.length&&K>0&&(r&&Math.abs(ae-(K+Z))<9e3||Math.abs(Br(_[0].pts,ae)-(K+Z))<20*g),_.forEach(function(Ne){Ne.pts=Br(Ne.pts,ae)}),!n||K<0){const Ne=_.length;if(_=_.filter(tt=>tt.pts>=0),Ne!==_.length&&this.warn(`Removed ${_.length-Ne} of ${Ne} samples (initPTS ${Z} / ${o})`),!_.length)return;i===0?K=0:r&&!E?K=Math.max(0,ae-Z):K=_[0].pts-Z}if(e.segmentCodec==="aac"){const Ne=this.config.maxAudioFramesDrift;for(let tt=0,mt=K+Z;tt<_.length;tt++){const Ge=_[tt],ut=Ge.pts,Xe=ut-mt,nt=Math.abs(1e3*Xe/o);if(Xe<=-Ne*g&&E)tt===0&&(this.warn(`Audio frame @ ${(ut/o).toFixed(3)}s overlaps marker by ${Math.round(1e3*Xe/o)} ms.`),this.nextAudioTs=K=ut-Z,mt=ut);else if(Xe>=Ne*g&&nt<$0&&E){let Ft=Math.round(Xe/g);for(mt=ut-Ft*g;mt<0&&Ft&&g;)Ft--,mt+=g;tt===0&&(this.nextAudioTs=K=mt-Z),this.warn(`Injecting ${Ft} audio frames @ ${((mt-Z)/o).toFixed(3)}s due to ${Math.round(1e3*Xe/o)} ms gap.`);for(let Xt=0;Xt<Ft;Xt++){let Pe=j0.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Pe||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Pe=Ge.unit.subarray()),_.splice(tt,0,{unit:Pe,pts:mt}),mt+=g,tt++}}Ge.pts=mt,mt+=g}}let pe=null,xe=null,ke,Y=0,J=_.length;for(;J--;)Y+=_[J].unit.byteLength;for(let Ne=0,tt=_.length;Ne<tt;Ne++){const mt=_[Ne],Ge=mt.unit;let ut=mt.pts;if(xe!==null){const nt=y[Ne-1];nt.duration=Math.round((ut-xe)/d)}else if(n&&e.segmentCodec==="aac"&&(ut=K+Z),pe=ut,Y>0){Y+=L;try{ke=new Uint8Array(Y)}catch(nt){this.observer.emit(ue.ERROR,ue.ERROR,{type:_n.MUX_ERROR,details:lt.REMUX_ALLOC_ERROR,fatal:!1,error:nt,bytes:Y,reason:`fail allocating audio mdat ${Y}`});return}h||(new DataView(ke.buffer).setUint32(0,Y),ke.set(at.types.mdat,4))}else return;ke.set(Ge,L);const Xe=Ge.byteLength;L+=Xe,y.push(jf(!0,c,Xe,0)),xe=ut}const he=y.length;if(!he)return;const Ee=y[y.length-1];K=xe-Z,this.nextAudioTs=K+d*Ee.duration;const Le=h?new Uint8Array(0):at.moof(e.sequenceNumber++,pe/d,nr({},e,{samples:y}));e.samples=[];const et=(pe-Z)/o,Ae=this.nextAudioTs/o,Be={data1:Le,data2:ke,startPTS:et,endPTS:Ae,startDTS:et,endDTS:Ae,type:"audio",hasAudio:!0,hasVideo:!1,nb:he};return this.isAudioContiguous=!0,Be}}function Br(u,e){let t;if(e===null)return u;for(e<u?t=-8589934592:t=8589934592;Math.abs(u-e)>4294967296;)u+=t;return u}function Y0(u){for(let e=0;e<u.length;e++)if(u[e].key)return e;return-1}function Ig(u,e,t,n){const r=u.samples.length;if(!r)return;const i=u.inputTimeScale;for(let l=0;l<r;l++){const d=u.samples[l];d.pts=Br(d.pts-t.baseTime*i/t.timescale,e*i)/i,d.dts=Br(d.dts-n.baseTime*i/n.timescale,e*i)/i}const o=u.samples;return u.samples=[],{samples:o}}function xg(u,e,t){const n=u.samples.length;if(!n)return;const r=u.inputTimeScale;for(let o=0;o<n;o++){const l=u.samples[o];l.pts=Br(l.pts-t.baseTime*r/t.timescale,e*r)/r}u.samples.sort((o,l)=>o.pts-l.pts);const i=u.samples;return u.samples=[],{samples:i}}class W0 extends Qr{constructor(e,t,n,r){super("passthrough-remuxer",r),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,n,r){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(e,r),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:n,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:i,video:o}=this.initData=Dh(e);if(t)OE(e,t);else{const d=i||o;d!=null&&d.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${d.codec}")!`)}i&&(n=qf(i,rr.AUDIO,this)),o&&(r=qf(o,rr.VIDEO,this));const l={};i&&o?l.audiovideo={container:"video/mp4",codec:n+","+r,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:i?l.audio={container:"audio/mp4",codec:n,encrypted:i.encrypted,initSegment:e,id:"audio"}:o?l.video={container:"video/mp4",codec:r,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=l}remux(e,t,n,r,i,o){var l,d;let{initPTS:c,lastEndTime:g}=this;const f={audio:void 0,video:void 0,text:r,id3:n,initSegment:void 0};on(g)||(g=this.lastEndTime=i||0);const h=t.samples;if(!h.length)return f;const y={initPTS:void 0,timescale:void 0,trackId:void 0};let E=this.initData;if((l=E)!=null&&l.length||(this.generateInitSegment(h),E=this.initData),!((d=E)!=null&&d.length))return this.warn("Failed to generate initSegment."),f;this.emitInitSegment&&(y.tracks=this.initTracks,this.emitInitSegment=!1);const _=UE(h,E,this),L=E.audio?_[E.audio.id]:null,K=E.video?_[E.video.id]:null,Z=Us(K,1/0),ae=Us(L,1/0),pe=Us(K,0,!0),xe=Us(L,0,!0);let ke=i,Y=0;const J=L&&(!K||!c&&ae<Z||c&&c.trackId===E.audio.id),he=J?L:K;if(he){const mt=he.timescale,Ge=he.start-i*mt,ut=J?E.audio.id:E.video.id;ke=he.start/mt,Y=J?xe-ae:pe-Z,(o||!c)&&(X0(c,ke,i,Y)||mt!==c.timescale)&&(c&&this.warn(`Timestamps at playlist time: ${o?"":"~"}${i} ${Ge/mt} != initPTS: ${c.baseTime/c.timescale} (${c.baseTime}/${c.timescale}) trackId: ${c.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${ke-i} (${Ge}/${mt}) trackId: ${ut}`),c=null,y.initPTS=Ge,y.timescale=mt,y.trackId=ut)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${i}`);c?(y.initPTS=c.baseTime,y.timescale=c.timescale,y.trackId=c.trackId):((!y.timescale||y.trackId===void 0||y.initPTS===void 0)&&(this.warn("Could not set initPTS"),y.initPTS=ke,y.timescale=1,y.trackId=-1),this.initPTS=c={baseTime:y.initPTS,timescale:y.timescale,trackId:y.trackId});const Ee=ke-c.baseTime/c.timescale,Le=Ee+Y;Y>0?this.lastEndTime=Le:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const et=!!E.audio,Ae=!!E.video;let Ze="";et&&(Ze+="audio"),Ae&&(Ze+="video");const Be=(E.audio?E.audio.encrypted:!1)||(E.video?E.video.encrypted:!1),Ne={data1:h,startPTS:Ee,startDTS:Ee,endPTS:Le,endDTS:Le,type:Ze,hasAudio:et,hasVideo:Ae,nb:1,dropped:0,encrypted:Be};f.audio=et&&!Ae?Ne:void 0,f.video=Ae?Ne:void 0;const tt=K?.sampleCount;if(tt){const mt=K.keyFrameIndex,Ge=mt!==-1;Ne.nb=tt,Ne.dropped=mt===0||this.isVideoContiguous?0:Ge?mt:tt,Ne.independent=Ge,Ne.firstKeyFrame=mt,Ge&&K.keyFrameStart&&(Ne.firstKeyFramePTS=(K.keyFrameStart-c.baseTime)/c.timescale),this.isVideoContiguous||(f.independent=Ge),this.isVideoContiguous||(this.isVideoContiguous=Ge),Ne.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${mt}/${tt} dropped: ${Ne.dropped} start: ${Ne.firstKeyFramePTS||"NA"}`)}return f.initSegment=y,f.id3=Ig(n,i,c,c),r.samples.length&&(f.text=xg(r,i,c)),f}}function Us(u,e,t=!1){return u?.start!==void 0?(u.start+(t?u.duration:0))/u.timescale:e}function X0(u,e,t,n){if(u===null)return!0;const r=Math.max(n,1),i=e-u.baseTime/u.timescale;return Math.abs(i-t)>r}function qf(u,e,t){const n=u.codec;return n&&n.length>4?n:e===rr.AUDIO?n==="ec-3"||n==="ac-3"||n==="alac"?n:n==="fLaC"||n==="Opus"?ro(n,!1):(t.warn(`Unhandled audio codec "${n}" in mp4 MAP`),n||"mp4a"):(t.warn(`Unhandled video codec "${n}" in mp4 MAP`),n||"avc1")}let Di;try{Di=self.performance.now.bind(self.performance)}catch{Di=Date.now}const Qs=[{demux:M0,remux:W0},{demux:Vi,remux:Xs},{demux:L0,remux:Xs},{demux:P0,remux:Xs}];Qs.splice(2,0,{demux:D0,remux:Xs});class Gf{constructor(e,t,n,r,i,o){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=n,this.id=i,this.logger=o}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,r){const i=n.transmuxing;i.executeStart=Di();let o=new Uint8Array(e);const{currentTransmuxState:l,transmuxConfig:d}=this;r&&(this.currentTransmuxState=r);const{contiguous:c,discontinuity:g,trackSwitch:f,accurateTimeOffset:h,timeOffset:y,initSegmentChange:E}=r||l,{audioCodec:_,videoCodec:L,defaultInitPts:K,duration:Z,initSegmentData:ae}=d,pe=Q0(o,t);if(pe&&Ra(pe.method)){const J=this.getDecrypter(),he=tu(pe.method);if(J.isSync()){let Ee=J.softwareDecrypt(o,pe.key.buffer,pe.iv.buffer,he);if(n.part>-1){const et=J.flush();Ee=et&&et.buffer}if(!Ee)return i.executeEnd=Di(),cl(n);o=new Uint8Array(Ee)}else return this.asyncResult=!0,this.decryptionPromise=J.webCryptoDecrypt(o,pe.key.buffer,pe.iv.buffer,he).then(Ee=>{const Le=this.push(Ee,null,n);return this.decryptionPromise=null,Le}),this.decryptionPromise}const xe=this.needsProbing(g,f);if(xe){const J=this.configureTransmuxer(o);if(J)return this.logger.warn(`[transmuxer] ${J.message}`),this.observer.emit(ue.ERROR,ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.FRAG_PARSING_ERROR,fatal:!1,error:J,reason:J.message}),i.executeEnd=Di(),cl(n)}(g||f||E||xe)&&this.resetInitSegment(ae,_,L,Z,t),(g||E||xe)&&this.resetInitialTimestamp(K),c||this.resetContiguity();const ke=this.transmux(o,pe,y,h,n);this.asyncResult=rs(ke);const Y=this.currentTransmuxState;return Y.contiguous=!0,Y.discontinuity=!1,Y.trackSwitch=!1,i.executeEnd=Di(),ke}flush(e){const t=e.transmuxing;t.executeStart=Di();const{decrypter:n,currentTransmuxState:r,decryptionPromise:i}=this;if(i)return this.asyncResult=!0,i.then(()=>this.flush(e));const o=[],{timeOffset:l}=r;if(n){const f=n.flush();f&&o.push(this.push(f.buffer,null,e))}const{demuxer:d,remuxer:c}=this;if(!d||!c){t.executeEnd=Di();const f=[cl(e)];return this.asyncResult?Promise.resolve(f):f}const g=d.flush(l);return rs(g)?(this.asyncResult=!0,g.then(f=>(this.flushRemux(o,f,e),o))):(this.flushRemux(o,g,e),this.asyncResult?Promise.resolve(o):o)}flushRemux(e,t,n){const{audioTrack:r,videoTrack:i,id3Track:o,textTrack:l}=t,{accurateTimeOffset:d,timeOffset:c}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?" part: "+n.part:""} of ${this.id===hn.MAIN?"level":"track"} ${n.level}`);const g=this.remuxer.remux(r,i,o,l,c,d,!0,this.id);e.push({remuxResult:g,chunkMeta:n}),n.transmuxing.executeEnd=Di()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,r,i){const{demuxer:o,remuxer:l}=this;!o||!l||(o.resetInitSegment(e,t,n,r),l.resetInitSegment(e,t,n,i))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,r,i){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,n,r,i):o=this.transmuxUnencrypted(e,n,r,i),o}transmuxUnencrypted(e,t,n,r){const{audioTrack:i,videoTrack:o,id3Track:l,textTrack:d}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(i,o,l,d,t,n,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,n,r,i){return this.demuxer.demuxSampleAes(e,t,n).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,n,r,!1,this.id),chunkMeta:i}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:r}=this;let i;for(let f=0,h=Qs.length;f<h;f++){var o;if((o=Qs[f].demux)!=null&&o.probe(e,this.logger)){i=Qs[f];break}}if(!i)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,d=this.remuxer,c=i.remux,g=i.demux;(!d||!(d instanceof c))&&(this.remuxer=new c(n,t,r,this.logger)),(!l||!(l instanceof g))&&(this.demuxer=new g(n,t,r,this.logger),this.probe=g.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Jl(this.config)),e}}function Q0(u,e){let t=null;return u.byteLength>0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const cl=u=>({remuxResult:{},chunkMeta:u});function rs(u){return"then"in u&&u.then instanceof Function}class Z0{constructor(e,t,n,r,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=n,this.duration=r,this.defaultInitPts=i||null}}class J0{constructor(e,t,n,r,i,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=n,this.trackSwitch=r,this.timeOffset=i,this.initSegmentChange=o}}let $f=0;class wg{constructor(e,t,n,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=$f++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=d=>{const c=d.data,g=this.hls;if(!(!g||!(c!=null&&c.event)||c.instanceNo!==this.instanceNo))switch(c.event){case"init":{var f;const h=(f=this.workerContext)==null?void 0:f.objectURL;h&&self.URL.revokeObjectURL(h);break}case"transmuxComplete":{this.handleTransmuxComplete(c.data);break}case"flush":{this.onFlush(c.data);break}case"workerLog":{g.logger[c.data.logType]&&g.logger[c.data.logType](c.data.message);break}default:{c.data=c.data||{},c.data.frag=this.frag,c.data.part=this.part,c.data.id=this.id,g.trigger(c.event,c.data);break}}},this.onWorkerError=d=>{if(!this.hls)return;const c=new Error(`${d.message} (${d.filename}:${d.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(ue.ERROR,{type:_n.OTHER_ERROR,details:lt.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:c})};const i=e.config;this.hls=e,this.id=t,this.useWorker=!!i.enableWorker,this.onTransmuxComplete=n,this.onFlush=r;const o=(d,c)=>{c=c||{},c.frag=this.frag||void 0,d===ue.ERROR&&(c=c,c.parent=this.id,c.part=this.part,this.error=c.error),this.hls.trigger(d,c)};this.observer=new iu,this.observer.on(ue.FRAG_DECRYPTED,o),this.observer.on(ue.ERROR,o);const l=af(i.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const d=this.hls.logger;if(i.workerPath||r0()){try{i.workerPath?(d.log(`loading Web Worker ${i.workerPath} for "${t}"`),this.workerContext=a0(i.workerPath)):(d.log(`injecting Web Worker for "${t}"`),this.workerContext=i0());const{worker:g}=this.workerContext;g.addEventListener("message",this.onWorkerMessage),g.addEventListener("error",this.onWorkerError),g.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:l,id:t,config:ir(i)})}catch(g){d.warn(`Error setting up "${t}" Web Worker, fallback to inline`,g),this.terminateWorker(),this.error=null,this.transmuxer=new Gf(this.observer,l,i,"",t,e.logger)}return}}this.transmuxer=new Gf(this.observer,l,i,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=$f++;const t=this.hls.config,n=af(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:n,id:this.id,config:ir(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),s0(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,n,r,i,o,l,d,c,g){var f,h;c.transmuxing.start=self.performance.now();const{instanceNo:y,transmuxer:E}=this,_=o?o.start:i.start,L=i.decryptdata,K=this.frag,Z=!(K&&i.cc===K.cc),ae=!(K&&c.level===K.level),pe=K?c.sn-K.sn:-1,xe=this.part?c.part-this.part.index:-1,ke=pe===0&&c.id>1&&c.id===K?.stats.chunkCount,Y=!ae&&(pe===1||pe===0&&(xe===1||ke&&xe<=0)),J=self.performance.now();(ae||pe||i.stats.parsing.start===0)&&(i.stats.parsing.start=J),o&&(xe||!Y)&&(o.stats.parsing.start=J);const he=!(K&&((f=i.initSegment)==null?void 0:f.url)===((h=K.initSegment)==null?void 0:h.url)),Ee=new J0(Z,Y,d,ae,_,he);if(!Y||Z||he){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${i.type} sn: ${c.sn}${c.part>-1?" part: "+c.part:""} ${this.id===hn.MAIN?"level":"track"}: ${c.level} id: ${c.id}
|
|
17
|
+
discontinuity: ${Z}
|
|
18
|
+
trackSwitch: ${ae}
|
|
19
|
+
contiguous: ${Y}
|
|
20
|
+
accurateTimeOffset: ${d}
|
|
21
|
+
timeOffset: ${_}
|
|
22
|
+
initSegmentChange: ${he}`);const Le=new Z0(n,r,t,l,g);this.configureTransmuxer(Le)}if(this.frag=i,this.part=o,this.workerContext)this.workerContext.worker.postMessage({instanceNo:y,cmd:"demux",data:e,decryptdata:L,chunkMeta:c,state:Ee},e instanceof ArrayBuffer?[e]:[]);else if(E){const Le=E.push(e,L,c,Ee);rs(Le)?Le.then(et=>{this.handleTransmuxComplete(et)}).catch(et=>{this.transmuxerError(et,c,"transmuxer-interface push error")}):this.handleTransmuxComplete(Le)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(n){const r=n.flush(e);rs(r)?r.then(i=>{this.handleFlushResult(i,e)}).catch(i=>{this.transmuxerError(i,e,"transmuxer-interface flush error")}):this.handleFlushResult(r,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Vf=100;class eT extends ru{constructor(e,t,n){super(e,t,n,"audio-stream-controller",hn.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.on(ue.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(ue.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(ue.BUFFER_RESET,this.onBufferReset,this),e.on(ue.BUFFER_CREATED,this.onBufferCreated,this),e.on(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(ue.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(ue.FRAG_LOADING,this.onFragLoading,this),e.on(ue.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.off(ue.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(ue.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(ue.BUFFER_RESET,this.onBufferReset,this),e.off(ue.BUFFER_CREATED,this.onBufferCreated,this),e.off(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(ue.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(ue.FRAG_LOADING,this.onFragLoading,this),e.off(ue.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:n,initPTS:r,timescale:i,trackId:o}){if(n===hn.MAIN){const l=t.cc,d=this.fragCurrent;if(this.initPTS[l]={baseTime:r,timescale:i,trackId:o},this.log(`InitPTS for cc: ${l} found from main: ${r/i} (${r}/${i}) trackId: ${o}`),this.mainAnchor=t,this.state===Ot.WAITING_INIT_PTS){const c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==l)&&this.syncWithAnchor(t,c?.frag)}else!this.hls.hasEnoughToStart&&d&&d.cc!==l?(d.abortRequests(),this.syncWithAnchor(t,d)):this.state===Ot.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var n;const r=((n=this.mainFragLoading)==null?void 0:n.frag)||null;if(t&&r?.cc===t.cc)return;const i=(r||e).cc,o=this.getLevelDetails(),l=this.getLoadPosition(),d=Gh(o,i,l);d&&(this.log(`Syncing with main frag at ${d.start} cc ${d.cc}`),this.startFragRequested=!1,this.nextLoadPosition=d.start,this.resetLoadingState(),this.state===Ot.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=Ot.STOPPED;return}const n=this.lastCurrentTime;this.stopLoad(),this.setInterval(Vf),n>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=Ot.IDLE):this.state=Ot.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case Ot.IDLE:this.doTickIdle();break;case Ot.WAITING_TRACK:{const{levels:e,trackId:t}=this,n=e?.[t],r=n?.details;if(r&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(r))break;this.state=Ot.WAITING_INIT_PTS}break}case Ot.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case Ot.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:n,cache:r,complete:i}=e,o=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=Ot.FRAG_LOADING;const l=r.flush().buffer,d={frag:t,part:n,payload:l,networkDetails:null};this._handleFragmentLoadProgress(d),i&&super._handleFragmentLoadComplete(d)}else o&&o.cc!==e.frag.cc&&this.syncWithAnchor(o,e.frag)}else this.state=Ot.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:n,media:r,trackId:i}=this,o=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!o.startFragPrefetch)||!(n!=null&&n[i]))return;const l=n[i],d=l.details;if(!d||this.waitForLive(l)||this.waitForCdnTuneIn(d)){this.state=Ot.WAITING_TRACK,this.startFragRequested=!1;return}const c=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&c&&(this.bufferFlushed=!1,this.afterBufferFlushed(c,rr.AUDIO,hn.AUDIO));const g=this.getFwdBufferInfo(c,hn.AUDIO);if(g===null)return;if(!this.switchingTrack&&this._streamEnded(g,d)){t.trigger(ue.BUFFER_EOS,{type:"audio"}),this.state=Ot.ENDED;return}const f=g.len,h=t.maxBufferLength,y=d.fragments,E=y[0].start,_=this.getLoadPosition(),L=this.flushing?_:g.end;if(this.switchingTrack&&r){const ae=_;d.PTSKnown&&ae<E&&(g.end>E||g.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=E+.05)}if(f>=h&&!this.switchingTrack&&L<y[y.length-1].start)return;let K=this.getNextFragment(L,d);if(K&&this.isLoopLoading(K,L)&&(K=this.getNextFragmentLoopLoading(K,d,g,hn.MAIN,h)),!K){this.bufferFlushed=!0;return}let Z=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&Z&&cr(K)&&!K.endList&&(!d.live||!this.loadingParts&&L<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(Z)===Er.OK&&(this.mainFragLoading=Z=null),Z&&cr(Z))){if(K.start>Z.end){const pe=this.fragmentTracker.getFragAtPos(L,hn.MAIN);pe&&pe.end>Z.end&&(Z=pe,this.mainFragLoading={frag:pe,targetBufferTime:null})}if(K.start>Z.end)return}this.loadFragment(K,l,L)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(n=>new es(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),n?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==Ot.STOPPED&&(this.setInterval(Vf),this.state=Ot.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(ue.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,t){var n;const{levels:r}=this,{details:i,id:o,groupId:l,track:d}=t;if(!r){this.warn(`Audio tracks reset while loading track ${o} "${d.name}" of "${l}"`);return}const c=this.mainDetails;if(!c||i.endCC>c.endCC||c.expired){this.cachedTrackLoadedData=t,this.state!==Ot.STOPPED&&(this.state=Ot.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${o} "${d.name}" of "${l}" loaded [${i.startSN},${i.endSN}]${i.lastPartSn?`[part-${i.lastPartSn}-${i.lastPartIndex}]`:""},duration:${i.totalduration}`);const g=r[o];let f=0;if(i.live||(n=g.details)!=null&&n.live){if(this.checkLiveUpdate(i),i.deltaUpdateFailed)return;if(g.details){var h;f=this.alignPlaylists(i,g.details,(h=this.levelLastLoaded)==null?void 0:h.details)}i.alignedSliding||(og(i,c),i.alignedSliding||co(i,c),f=i.fragmentStart)}g.details=i,this.levelLastLoaded=g,this.startFragRequested||this.setStartPosition(c,f),this.hls.trigger(ue.AUDIO_TRACK_UPDATED,{details:i,id:o,groupId:t.groupId}),this.state===Ot.WAITING_TRACK&&!this.waitForCdnTuneIn(i)&&(this.state=Ot.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:r,payload:i}=e,{config:o,trackId:l,levels:d}=this;if(!d){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const c=d[l];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const g=c.details;if(!g){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(n.start);return}const f=o.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new wg(this.hls,hn.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const y=this.initPTS[n.cc],E=(t=n.initSegment)==null?void 0:t.data;if(y!==void 0){const L=r?r.index:-1,K=L!==-1,Z=new eu(n.level,n.sn,n.stats.chunkCount,i.byteLength,L,K);h.push(i,E,f,"",n,r,g.totalduration,!1,Z,y)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${g.startSN} ,${g.endSN}],track ${l}`);const{cache:_}=this.waitingData=this.waitingData||{frag:n,part:r,cache:new lg,complete:!1};_.push(new Uint8Array(i)),this.state!==Ot.STOPPED&&(this.state=Ot.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===hn.MAIN&&cr(t.frag)&&(this.mainFragLoading=t,this.state===Ot.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:n,part:r}=t;if(n.type!==hn.AUDIO){!this.audioOnly&&n.type===hn.MAIN&&!n.elementaryStreams.video&&!n.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?" p: "+r.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(cr(n)){this.fragPrevious=n;const i=this.switchingTrack;i&&(this.bufferedTrack=i,this.switchingTrack=null,this.hls.trigger(ue.AUDIO_TRACK_SWITCHED,Qn({},i)))}this.fragBufferedComplete(n,r),this.media&&this.tick()}onError(e,t){var n;if(t.fatal){this.state=Ot.ERROR;return}switch(t.details){case lt.FRAG_GAP:case lt.FRAG_PARSING_ERROR:case lt.FRAG_DECRYPT_ERROR:case lt.FRAG_LOAD_ERROR:case lt.FRAG_LOAD_TIMEOUT:case lt.KEY_LOAD_ERROR:case lt.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(hn.AUDIO,t);break;case lt.AUDIO_TRACK_LOAD_ERROR:case lt.AUDIO_TRACK_LOAD_TIMEOUT:case lt.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Ot.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===Un.AUDIO_TRACK&&(this.state=Ot.IDLE);break;case lt.BUFFER_ADD_CODEC_ERROR:case lt.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case lt.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case lt.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==rr.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==rr.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Ot.ENDED&&(this.state=Ot.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,hn.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:r}=this,{remuxResult:i,chunkMeta:o}=e,l=this.getCurrentContext(o);if(!l){this.resetWhenMissingContext(o);return}const{frag:d,part:c,level:g}=l,{details:f}=g,{audio:h,text:y,id3:E,initSegment:_}=i;if(this.fragContextChanged(d)||!f){this.fragmentTracker.removeFragment(d);return}if(this.state=Ot.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),_!=null&&_.tracks){const L=d.initSegment||d;if(this.unhandledEncryptionError(_,d))return;this._bufferInitSegment(g,_.tracks,L,o),r.trigger(ue.FRAG_PARSING_INIT_SEGMENT,{frag:L,id:n,tracks:_.tracks})}if(h){const{startPTS:L,endPTS:K,startDTS:Z,endDTS:ae}=h;c&&(c.elementaryStreams[rr.AUDIO]={startPTS:L,endPTS:K,startDTS:Z,endDTS:ae}),d.setElementaryStreamInfo(rr.AUDIO,L,K,Z,ae),this.bufferFragmentData(h,d,c,o)}if(E!=null&&(t=E.samples)!=null&&t.length){const L=nr({id:n,frag:d,details:f},E);r.trigger(ue.FRAG_PARSING_METADATA,L)}if(y){const L=nr({id:n,frag:d,details:f},y);r.trigger(ue.FRAG_PARSING_USERDATA,L)}}_bufferInitSegment(e,t,n,r){if(this.state!==Ot.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const i=t.audio;i.id=hn.AUDIO;const o=e.audioCodec;this.log(`Init audio buffer, container:${i.container}, codecs[level/parsed]=[${o}/${i.codec}]`),o&&o.split(",").length===1&&(i.levelCodec=o),this.hls.trigger(ue.BUFFER_CODECS,t);const l=i.initSegment;if(l!=null&&l.byteLength){const d={type:"audio",frag:n,part:null,chunkMeta:r,parent:n.type,data:l};this.hls.trigger(ue.BUFFER_APPENDING,d)}this.tickImmediate()}loadFragment(e,t,n){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===Er.NOT_LOADED||r===Er.PARTIAL){var i;if(!cr(e))this._loadInitSegment(e,t);else if((i=t.details)!=null&&i.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Ot.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragmentStart!==t.details.fragmentStart&&co(t.details,o)}else super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:n,assocLang:r,characteristics:i,audioCodec:o,channels:l}=this.bufferedTrack;la({name:t,lang:n,assocLang:r,characteristics:i,audioCodec:o,channels:l},e,sa)||(ao(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(ue.AUDIO_TRACK_SWITCHED,Qn({},e))}}class du extends Qr{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,n){const r=t?.renditionReports;if(r){let i=-1;for(let o=0;o<r.length;o++){const l=r[o];let d;try{d=new self.URL(l.URI,t.url).href}catch(c){this.warn(`Could not construct new URL for Rendition Report: ${c}`),d=l.URI||""}if(d===e){i=o;break}else d===e.substring(0,d.length)&&(i=o)}if(i!==-1){const o=r[i],l=parseInt(o["LAST-MSN"])||t.lastPartSn;let d=parseInt(o["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const g=Math.min(t.age-t.partTarget,t.targetduration);d>=0&&g>t.partTarget&&(d+=1)}const c=n&&sf(n);return new of(l,d>=0?d:void 0,c)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(n){this.warn(`Could not construct new URL with HLS Delivery Directives: ${n}`)}return e}playlistLoaded(e,t,n){const{details:r,stats:i}=t,o=self.performance.now(),l=i.loading.first?Math.max(0,o-i.loading.first):0;r.advancedDateTime=Date.now()-l;const d=this.hls.config.timelineOffset;if(d!==r.appliedTimelineOffset){const g=Math.max(d||0,0);r.appliedTimelineOffset=g,r.fragments.forEach(f=>{f.setStart(f.playlistOffset+g)})}if(r.live||n!=null&&n.live){const g="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(n),n&&r.fragments.length>0){Hb(n,r,this);const Z=r.playlistParsingError;if(Z){this.warn(Z);const ae=this.hls;if(!ae.config.ignorePlaylistParsingErrors){var c;const{networkDetails:pe}=t;ae.trigger(ue.ERROR,{type:_n.NETWORK_ERROR,details:lt.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:Z,reason:Z.message,level:t.level||void 0,parent:(c=r.fragments[0])==null?void 0:c.type,networkDetails:pe,stats:i});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=i.loading.start);const f=this.hls.mainForwardBufferInfo,h=f?f.end-f.len:0,y=(r.edge-h)*1e3,E=ng(r,y);if(r.requestScheduled+E<o?r.requestScheduled=o:r.requestScheduled+=E,this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),!this.canLoad||!r.live)return;let _,L,K;if(r.canBlockReload&&r.endSN&&r.advanced){const Z=this.hls.config.lowLatencyMode,ae=r.lastPartSn,pe=r.endSN,xe=r.lastPartIndex,ke=xe!==-1,Y=ae===pe;ke?Y?(L=pe+1,K=Z?0:xe):(L=ae,K=Z?xe+1:r.maxPartIndex):L=pe+1;const J=r.age,he=J+r.ageHeader;let Ee=Math.min(he-r.partTarget,r.targetduration*1.5);if(Ee>0){if(he>r.targetduration*3)this.log(`Playlist last advanced ${J.toFixed(2)}s ago. Omitting segment and part directives.`),L=void 0,K=void 0;else if(n!=null&&n.tuneInGoal&&he-r.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${Ee} with playlist age: ${r.age}`),Ee=0;else{const Le=Math.floor(Ee/r.targetduration);if(L+=Le,K!==void 0){const et=Math.round(Ee%r.targetduration/r.partTarget);K+=et}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${J.toFixed(2)}s goal: ${Ee} skip sn ${Le} to part ${K}`)}r.tuneInGoal=Ee}if(_=this.getDeliveryDirectives(r,t.deliveryDirectives,L,K),Z||!Y){r.requestScheduled=o,this.loadingPlaylist(g,_);return}}else(r.canBlockReload||r.canSkipUntil)&&(_=this.getDeliveryDirectives(r,t.deliveryDirectives,L,K));_&&L!==void 0&&r.canBlockReload&&(r.requestScheduled=i.loading.first+Math.max(E-l*2,E/2)),this.scheduleLoading(g,_,r)}else this.clearTimer()}scheduleLoading(e,t,n){const r=n||e.details;if(!r){this.loadingPlaylist(e,t);return}const i=self.performance.now(),o=r.requestScheduled;if(i>=o){this.loadingPlaylist(e,t);return}const l=o-i;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(l)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),l)}getDeliveryDirectives(e,t,n,r){let i=sf(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,r=t.part,i=Ys.No),new of(n,r,i)}checkRetry(e){const t=e.details,n=so(e),r=e.errorAction,{action:i,retryCount:o=0,retryConfig:l}=r||{},d=!!r&&!!l&&(i===_r.RetryRequest||!r.resolved&&i===_r.SendAlternateToPenaltyBox);if(d){var c;if(o>=l.maxNumRetry)return!1;if(n&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${l.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const g=Zl(l,o);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),g),this.warn(`Retrying playlist loading ${o+1}/${l.maxNumRetry} after "${t}" in ${g}ms`)}e.levelRetry=!0,r.resolved=!0}return d}}function Rg(u,e){if(u.length!==e.length)return!1;for(let t=0;t<u.length;t++)if(!is(u[t].attrs,e[t].attrs))return!1;return!0}function is(u,e,t){const n=u["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>u[r]!==e[r])}function Fl(u,e){return e.label.toLowerCase()===u.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(u.lang||"").toLowerCase())}class tT extends du{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.LEVEL_LOADING,this.onLevelLoading,this),e.on(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(ue.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.LEVEL_LOADING,this.onLevelLoading,this),e.off(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(ue.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(ue.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:n,groupId:r,details:i}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==r){this.warn(`Audio track with id:${n} and group:${r} not found in active group ${o?.groupId}`);return}const l=o.details;o.details=t.details,this.log(`Audio track ${n} "${o.name}" lang:${o.lang} group:${r} loaded [${i.startSN}-${i.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,l)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const n=t.audioGroups||null,r=this.groupIds;let i=this.currentTrack;if(!n||r?.length!==n?.length||n!=null&&n.some(l=>r?.indexOf(l)===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const l=this.tracks.filter(h=>!n||n.indexOf(h.groupId)!==-1);if(l.length)this.selectDefaultTrack&&!l.some(h=>h.default)&&(this.selectDefaultTrack=!1),l.forEach((h,y)=>{h.id=y});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=l;const d=this.hls.config.audioPreference;if(!i&&d){const h=Ei(d,l,sa);if(h>-1)i=l[h];else{const y=Ei(d,this.tracks);i=this.tracks[y]}}let c=this.findTrackId(i);c===-1&&i&&(c=this.findTrackId(null));const g={audioTracks:l};this.log(`Updating audio tracks, ${l.length} track(s) found in group(s): ${n?.join(",")}`),this.hls.trigger(ue.AUDIO_TRACKS_UPDATED,g);const f=this.trackId;if(c!==-1&&f===-1)this.setAudioTrack(c);else if(l.length&&f===-1){var o;const h=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${l.length}`);this.warn(h.message),this.hls.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}}onError(e,t){t.fatal||!t.context||t.context.type===Un.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const r=this.currentTrack;if(r&&la(e,r,sa))return r;const i=Ei(e,this.tracksInGroup,sa);if(i>-1){const o=this.tracksInGroup[i];return this.setAudioTrack(i),o}else if(r){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const l=hb(e,t.levels,n,o,sa);if(l===-1)return null;t.nextLoadLevel=l}if(e.channels||e.audioCodec){const o=Ei(e,n);if(o>-1)return n[o]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,r=t[e],i=r.details&&!r.details.live;if(e===this.trackId&&r===n&&i||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(ue.AUDIO_TRACK_SWITCHING,Qn({},r)),i))return;const o=this.switchParams(r.url,n?.details,r.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const r=t[n];if(!(this.selectDefaultTrack&&!r.default)&&(!e||la(e,r,sa)))return n}if(e){const{name:n,lang:r,assocLang:i,characteristics:o,audioCodec:l,channels:d}=e;for(let c=0;c<t.length;c++){const g=t[c];if(la({name:n,lang:r,assocLang:i,characteristics:o,audioCodec:l,channels:d},g,sa))return c}for(let c=0;c<t.length;c++){const g=t[c];if(is(e.attrs,g.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(let c=0;c<t.length;c++){const g=t[c];if(is(e.attrs,g.attrs,["LANGUAGE"]))return c}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&ao(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,r=e.groupId,i=this.getUrlWithDirectives(e.url,t),o=e.details,l=o?.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${i}`),this.hls.trigger(ue.AUDIO_TRACK_LOADING,{url:i,id:n,groupId:r,deliveryDirectives:t||null,track:e})}}class nT{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,n){if(this.queues===null||this.tracks===null)return;const r=this.queues[t];r.push(e),r.length===1&&!n&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const n={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const n={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const n=(t=e[0])==null?void 0:t.label;(n==="async-blocker"||n==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const r=t[0];try{r.execute()}catch(i){var n;if(r.onError(i),this.queues===null||this.tracks===null)return;const o=(n=this.tracks[e])==null?void 0:n.buffer;o!=null&&o.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
|
|
23
|
+
${this.list("video")}
|
|
24
|
+
${this.list("audio")}
|
|
25
|
+
${this.list("audiovideo")}}`}list(e){var t,n;return(t=this.queues)!=null&&t[e]||(n=this.tracks)!=null&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const n=(t=this.tracks)==null?void 0:t[e],r=n?.buffer;return r?`SourceBuffer${r.updating?" updating":""}${n.ended?" ended":""}${n.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(n=>n.label).join(", "))||""}}const Hf=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,kg="HlsJsTrackRemovedError";class rT extends Error{constructor(e){super(e),this.name=kg}}class iT extends Qr{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=n=>{var r;this.hls&&((r=this.mediaSource)==null?void 0:r.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=n=>{const{media:r,mediaSource:i}=this;n&&this.log("Media source opened"),!(!r||!i)&&(i.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(ue.MEDIA_ATTACHED,{media:r,mediaSource:i}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:n,_objectUrl:r}=this;n!==r&&this.error(`Media element src was set while attaching MediaSource (${r} > ${n})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=xE(Ki(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.BUFFER_RESET,this.onBufferReset,this),e.on(ue.BUFFER_APPENDING,this.onBufferAppending,this),e.on(ue.BUFFER_CODECS,this.onBufferCodecs,this),e.on(ue.BUFFER_EOS,this.onBufferEos,this),e.on(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(ue.FRAG_PARSED,this.onFragParsed,this),e.on(ue.FRAG_CHANGED,this.onFragChanged,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.BUFFER_RESET,this.onBufferReset,this),e.off(ue.BUFFER_APPENDING,this.onBufferAppending,this),e.off(ue.BUFFER_CODECS,this.onBufferCodecs,this),e.off(ue.BUFFER_EOS,this.onBufferEos,this),e.off(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(ue.FRAG_PARSED,this.onFragParsed,this),e.off(ue.FRAG_CHANGED,this.onFragChanged,this),e.off(ue.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const n={};if(this.operationQueue){const i=this.isUpdating();i||this.operationQueue.removeBlockers();const o=this.isQueued();(i||o)&&this.warn(`Transfering MediaSource with${o?" operations in queue":""}${i?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?nr(n,r.tracks):this.sourceBuffers.forEach(i=>{const[o]=i;o&&(n[o]=nr({},this.tracks[o]),this.removeBuffer(o)),i[0]=i[1]=null}),{media:e,mediaSource:t,tracks:n}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var n;let r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),(n=this.transferData)!=null&&n.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){const n=this.media=t.media;this.transferData=this.overrides=void 0;const r=Ki(this.appendSource);if(r){const i=!!t.mediaSource;(i||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const o=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(o),i)this._objectUrl=n.src,this.attachTransferred();else{const l=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{n.removeAttribute("src");const d=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||d&&o instanceof d,Kf(n),aT(n,l),n.load()}catch{n.src=l}else n.src=l}n.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,n;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(n=e.constructor)==null?void 0:n.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const n=this.tracks,r=t.tracks,i=r?Object.keys(r):null,o=i?i.length:0,l=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&i&&o){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
|
|
26
|
+
required tracks: ${ir(n,(d,c)=>d==="initSegment"?void 0:c)};
|
|
27
|
+
transfer tracks: ${ir(r,(d,c)=>d==="initSegment"?void 0:c)}}`),!Ih(r,n)){t.mediaSource=null,t.tracks=void 0;const d=e.currentTime,c=this.details,g=Math.max(d,c?.fragments[0].start||0);if(g-d>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${d} -> ${g}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(n)}") start time: ${g} currentTime: ${d}`),this.onMediaDetaching(ue.MEDIA_DETACHING,{}),this.onMediaAttaching(ue.MEDIA_ATTACHING,t),e.currentTime=g;return}this.transferData=void 0,i.forEach(d=>{const c=d,g=r[c];if(g){const f=g.buffer;if(f){const h=this.fragmentTracker,y=g.id;if(h.hasFragments(y)||h.hasParts(y)){const L=Dn.getBuffered(f);h.detectEvictedFragments(c,L,y,null,!0)}const E=dl(c),_=[c,f];this.sourceBuffers[E]=_,f.updating&&this.operationQueue&&this.operationQueue.prependBlocker(c),this.trackSourceBuffer(c,g)}}}),l(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),l()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const n=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:r,mediaSource:i,_objectUrl:o}=this;if(i){if(this.log(`media source ${n?"transferring":"detaching"}`),n)this.sourceBuffers.forEach(([l])=>{l&&this.removeBuffer(l)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const l=i.readyState==="open";try{const d=i.sourceBuffers;for(let c=d.length;c--;)l&&d[c].abort(),i.removeSourceBuffer(d[c]);l&&i.endOfStream()}catch(d){this.warn(`onMediaDetaching: ${d.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(i.removeEventListener("startstreaming",this._onStartStreaming),i.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),n||(o&&self.URL.revokeObjectURL(o),this.mediaSrc===o?(r.removeAttribute("src"),this.appendSource&&Kf(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(ue.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const n=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),n)try{var r;(r=this.mediaSource)!=null&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(n)}catch(i){this.warn(`onBufferReset ${e}`,i)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[dl(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new nT(this.tracks)}onBufferCodecs(e,t){var n;const r=this.tracks,i=Object.keys(t);this.log(`BUFFER_CODECS: "${i}" (current SB count ${this.sourceBufferCount})`);const o="audiovideo"in t&&(r.audio||r.video)||r.audiovideo&&("audio"in t||"video"in t),l=!o&&this.sourceBufferCount&&this.media&&i.some(d=>!r[d]);if(o||l){this.warn(`Unsupported transition between "${Object.keys(r)}" and "${i}" SourceBuffers`);return}i.forEach(d=>{var c,g;const f=t[d],{id:h,codec:y,levelCodec:E,container:_,metadata:L,supplemental:K}=f;let Z=r[d];const ae=(c=this.transferData)==null||(c=c.tracks)==null?void 0:c[d],pe=ae!=null&&ae.buffer?ae:Z,xe=pe?.pendingCodec||pe?.codec,ke=pe?.levelCodec;Z||(Z=r[d]={buffer:void 0,listeners:[],codec:y,supplemental:K,container:_,levelCodec:E,metadata:L,id:h});const Y=Ks(xe,ke),J=Y?.replace(Hf,"$1");let he=Ks(y,E);const Ee=(g=he)==null?void 0:g.replace(Hf,"$1");he&&Y&&J!==Ee&&(d.slice(0,5)==="audio"&&(he=ro(he,this.appendSource)),this.log(`switching codec ${xe} to ${he}`),he!==(Z.pendingCodec||Z.codec)&&(Z.pendingCodec=he),Z.container=_,this.appendChangeType(d,_,he))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((n=t.audio)==null?void 0:n.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const n=this.tracks[t];return e[t]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e},{})}appendChangeType(e,t,n){const r=`${t};codecs=${n}`,i={label:`change-type=${r}`,execute:()=>{const o=this.tracks[e];if(o){const l=o.buffer;l!=null&&l.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),l.changeType(r),o.codec=n,o.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn(`Failed to change ${e} SourceBuffer type`,o)}};this.append(i,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const n=e.start,r=n+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(n,hn.MAIN))==null?void 0:t.gap)===!0)return;const o={label:"block-audio",execute:()=>{var l;const d=this.tracks.video;(this.lastVideoAppendEnd>r||d!=null&&d.buffer&&Dn.isBuffered(d.buffer,r)||((l=this.fragmentTracker.getAppendedFrag(r,hn.MAIN))==null?void 0:l.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:l=>{this.warn("Error executing block-audio operation",l)}};this.blockedAudioAppend={op:o,frag:e},this.append(o,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:n}=this,{data:r,type:i,parent:o,frag:l,part:d,chunkMeta:c,offset:g}=t,f=c.buffering[i],{sn:h,cc:y}=l,E=self.performance.now();f.start=E;const _=l.stats.buffering,L=d?d.stats.buffering:null;_.start===0&&(_.start=E),L&&L.start===0&&(L.start=E);const K=n.audio;let Z=!1;i==="audio"&&K?.container==="audio/mpeg"&&(Z=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const ae=n.video,pe=ae?.buffer;if(pe&&h!=="initSegment"){const Y=d||l,J=this.blockedAudioAppend;if(i==="audio"&&o!=="main"&&!this.blockedAudioAppend&&!(ae.ending||ae.ended)){const Ee=Y.start+Y.duration*.05,Le=pe.buffered,et=this.currentOp("video");!Le.length&&!et?this.blockAudio(Y):!et&&!Dn.isBuffered(pe,Ee)&&this.lastVideoAppendEnd<Ee&&this.blockAudio(Y)}else if(i==="video"){const he=Y.end;if(J){const Ee=J.frag.start;(he>Ee||he<this.lastVideoAppendEnd||Dn.isBuffered(pe,Ee))&&this.unblockAudio()}this.lastVideoAppendEnd=he}}const xe=(d||l).start,ke={label:`append-${i}`,execute:()=>{var Y;f.executeStart=self.performance.now();const J=(Y=this.tracks[i])==null?void 0:Y.buffer;J&&(Z?this.updateTimestampOffset(J,xe,.1,i,h,y):g!==void 0&&on(g)&&this.updateTimestampOffset(J,g,1e-6,i,h,y)),this.appendExecutor(r,i)},onStart:()=>{},onComplete:()=>{const Y=self.performance.now();f.executeEnd=f.end=Y,_.first===0&&(_.first=Y),L&&L.first===0&&(L.first=Y);const J={};this.sourceBuffers.forEach(([he,Ee])=>{he&&(J[he]=Dn.getBuffered(Ee))}),this.appendErrors[i]=0,i==="audio"||i==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(ue.BUFFER_APPENDED,{type:i,frag:l,part:d,chunkMeta:c,parent:l.type,timeRanges:J})},onError:Y=>{var J;const he={type:_n.MEDIA_ERROR,parent:l.type,details:lt.BUFFER_APPEND_ERROR,sourceBufferName:i,frag:l,part:d,chunkMeta:c,error:Y,err:Y,fatal:!1},Ee=(J=this.media)==null?void 0:J.error;if(Y.code===DOMException.QUOTA_EXCEEDED_ERR||Y.name=="QuotaExceededError"||"quota"in Y)he.details=lt.BUFFER_FULL_ERROR;else if(Y.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Ee)he.errorAction=wa(!0);else if(Y.name===kg&&this.sourceBufferCount===0)he.errorAction=wa(!0);else{const Le=++this.appendErrors[i];this.warn(`Failed ${Le}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${i}" sourceBuffer (${Ee||"no media error"})`),(Le>=this.hls.config.appendErrorMaxRetry||Ee)&&(he.fatal=!0)}this.hls.trigger(ue.ERROR,he)}};this.log(`queuing "${i}" append sn: ${h}${d?" p: "+d.index:""} of ${l.type===hn.MAIN?"level":"track"} ${l.level} cc: ${y}`),this.append(ke,i,this.isPending(this.tracks[i]))}getFlushOp(e,t,n){return this.log(`queuing "${e}" remove ${t}-${n}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(ue.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn(`Failed to remove ${t}-${n} from "${e}" SourceBuffer`,r)}}}onBufferFlushing(e,t){const{type:n,startOffset:r,endOffset:i}=t;n?this.append(this.getFlushOp(n,r,i),n):this.sourceBuffers.forEach(([o])=>{o&&this.append(this.getFlushOp(o,r,i),o)})}onFragParsed(e,t){const{frag:n,part:r}=t,i=[],o=r?r.elementaryStreams:n.elementaryStreams;o[rr.AUDIOVIDEO]?i.push("audiovideo"):(o[rr.AUDIO]&&i.push("audio"),o[rr.VIDEO]&&i.push("video"));const l=()=>{const d=self.performance.now();n.stats.buffering.end=d,r&&(r.stats.buffering.end=d);const c=r?r.stats:n.stats;this.hls.trigger(ue.FRAG_BUFFERED,{frag:n,part:r,stats:c,id:n.type})};i.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(l,i).catch(d=>{this.warn(`Fragment buffered callback ${d}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var n;this.sourceBuffers.forEach(([o])=>{if(o){const l=this.tracks[o];(!t.type||t.type===o)&&(l.ending=!0,l.ended||(l.ended=!0,this.log(`${o} buffer reached EOS`)))}});const r=((n=this.overrides)==null?void 0:n.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([o])=>{var l;return o&&!((l=this.tracks[o])!=null&&l.ended)})?r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:o}=this;if(!o||o.readyState!=="open"){o&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${o.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),o.endOfStream(),this.hls.trigger(ue.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(ue.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===lt.BUFFER_APPEND_ERROR&&t.frag){var n;const r=(n=t.errorAction)==null?void 0:n.nextAutoLevel;on(r)&&r!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:n}=this;if(!n||t===null||!this.sourceBufferCount)return;const r=e.config,i=n.currentTime,o=t.levelTargetDuration,l=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(on(l)&&l>=0){const c=Math.max(l,o),g=Math.floor(i/o)*o-c;this.flushBackBuffer(i,o,g)}const d=r.frontBufferFlushThreshold;if(on(d)&&d>0){const c=Math.max(r.maxBufferLength,d),g=Math.max(c,o),f=Math.floor(i/o)*o+g;this.flushFrontBuffer(i,o,f)}}flushBackBuffer(e,t,n){this.sourceBuffers.forEach(([r,i])=>{if(i){const l=Dn.getBuffered(i);if(l.length>0&&n>l.start(0)){var o;this.hls.trigger(ue.BACK_BUFFER_REACHED,{bufferEnd:n});const d=this.tracks[r];if((o=this.details)!=null&&o.live)this.hls.trigger(ue.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(d!=null&&d.ended){this.log(`Cannot flush ${r} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(ue.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:r})}}})}flushFrontBuffer(e,t,n){this.sourceBuffers.forEach(([r,i])=>{if(i){const o=Dn.getBuffered(i),l=o.length;if(l<2)return;const d=o.start(l-1),c=o.end(l-1);if(n>d||e>=d&&e<=c)return;this.hls.trigger(ue.BUFFER_FLUSHING,{startOffset:d,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;const{details:t,mediaSource:n}=this;if(!t||!this.media||n?.readyState!=="open")return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&n.setLiveSeekableRange){const c=Math.max(0,t.fragmentStart),g=Math.max(c,r);return{duration:1/0,start:c,end:g}}return{duration:1/0}}const i=(e=this.overrides)==null?void 0:e.duration;if(i)return on(i)?{duration:i}:null;const o=this.media.duration,l=on(n.duration)?n.duration:0;return r>l&&r>o||!on(o)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:n}){const r=this.mediaSource;!this.media||!r||r.readyState!=="open"||(r.duration!==e&&(on(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),t!==void 0&&n!==void 0&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${n}.`),r.setLiveSeekableRange(t,n)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${ir(n)}`),this.tracksReady){var r;const i=(r=this.transferData)==null?void 0:r.tracks;i&&Object.keys(i).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,n])=>{if(t){const r=this.tracks[t];e[t]={buffer:n,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.metadata}}}),this.hls.trigger(ue.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:n}=this;if(!n)throw new Error("createSourceBuffers called when mediaSource was null");for(const i in e){const o=i,l=e[o];if(this.isPending(l)){const d=this.getTrackCodec(l,o),c=`${l.container};codecs=${d}`;l.codec=d,this.log(`creating sourceBuffer(${c})${this.currentOp(o)?" Queued":""} ${ir(l)}`);try{const g=n.addSourceBuffer(c),f=dl(o),h=[o,g];t[f]=h,l.buffer=g}catch(g){var r;this.error(`error while trying to add sourceBuffer: ${g.message}`),this.shiftAndExecuteNext(o),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[o],this.hls.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:g,sourceBufferName:o,mimeType:c,parent:l.id});return}this.trackSourceBuffer(o,l)}}this.bufferCreated()}getTrackCodec(e,t){const n=e.supplemental;let r=e.codec;n&&(t==="video"||t==="audiovideo")&&Za(n,"video")&&(r=YE(r,n));const i=Ks(r,e.levelCodec);return i?t.slice(0,5)==="audio"?ro(i,this.appendSource):i:""}trackSourceBuffer(e,t){const n=t.buffer;if(!n)return;const r=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:r,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(i,o)=>{const l=o.removedRanges;l!=null&&l.length&&this.hls.trigger(ue.BUFFER_FLUSHED,{type:i})})}get mediaSrc(){var e,t;const n=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return n?.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const n=this.currentOp(e);n&&(n.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var n;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${r}`,t),this.hls.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const i=this.currentOp(e);i&&i.onError(r)}updateTimestampOffset(e,t,n,r,i,o){const l=t-e.timestampOffset;Math.abs(l)>=n&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${t} (sn: ${i} cc: ${o})`),e.timestampOffset=t)}removeExecutor(e,t,n){const{media:r,mediaSource:i}=this,o=this.tracks[e],l=o?.buffer;if(!r||!i||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const d=on(r.duration)?r.duration:1/0,c=on(i.duration)?i.duration:1/0,g=Math.max(0,t),f=Math.min(n,d,c);f>g&&(!o.ending||o.ended)?(o.ended=!1,this.log(`Removing [${g},${f}] from the ${e} SourceBuffer`),l.remove(g,f)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const n=this.tracks[t],r=n?.buffer;if(!r)throw new rT(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,r.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:n}=this,r=t.map(o=>this.appendBlocker(o));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(o=>{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var n;const r=(n=this.tracks[t])==null?void 0:n.buffer;!r||r.updating||this.shiftAndExecuteNext(t)})}append(e,t,n){this.operationQueue&&this.operationQueue.append(e,t,n)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,n){const r=this.tracks[e];if(!r)return;const i=r.buffer;if(!i)return;const o=n.bind(this,e);r.listeners.push({event:t,listener:o}),i.addEventListener(t,o)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const n=t.buffer;n&&(t.listeners.forEach(r=>{n.removeEventListener(r.event,r.listener)}),t.listeners.length=0)}}function Kf(u){const e=u.querySelectorAll("source");[].slice.call(e).forEach(t=>{u.removeChild(t)})}function aT(u,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,u.appendChild(t)}function dl(u){return u==="audio"?1:0}class fu{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(ue.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(ue.BUFFER_CODECS,this.onBufferCodecs,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(ue.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(ue.BUFFER_CODECS,this.onBufferCodecs,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&on(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const n=t.filter((r,i)=>this.isLevelAllowed(r)&&i<=e);return this.clientRect=null,fu.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const r=(l,d)=>d?l.width!==d.width||l.height!==d.height:!0;let i=e.length-1;const o=Math.max(t,n);for(let l=0;l<e.length;l+=1){const d=e[l];if((d.width>=o||d.height>=o)&&r(d,e[l+1])){i=l;break}}return i}}const sT={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Mr=sT,oT={HLS:"h"},lT=oT;class Ti{constructor(e,t){Array.isArray(e)&&(e=e.map(n=>n instanceof Ti?n:new Ti(n))),this.value=e,this.params=t}}const uT="Dict";function cT(u){return Array.isArray(u)?JSON.stringify(u):u instanceof Map?"Map{}":u instanceof Set?"Set{}":typeof u=="object"?JSON.stringify(u):String(u)}function dT(u,e,t,n){return new Error(`failed to ${u} "${cT(e)}" as ${t}`,{cause:n})}function vi(u,e,t){return dT("serialize",u,e,t)}class Cg{constructor(e){this.description=e}}const Yf="Bare Item",fT="Boolean";function hT(u){if(typeof u!="boolean")throw vi(u,fT);return u?"?1":"?0"}function gT(u){return btoa(String.fromCharCode(...u))}const mT="Byte Sequence";function pT(u){if(ArrayBuffer.isView(u)===!1)throw vi(u,mT);return`:${gT(u)}:`}const yT="Integer";function ET(u){return u<-999999999999999||999999999999999<u}function Lg(u){if(ET(u))throw vi(u,yT);return u.toString()}function bT(u){return`@${Lg(u.getTime()/1e3)}`}function Dg(u,e){if(u<0)return-Dg(-u,e);const t=Math.pow(10,e);if(Math.abs(u*t%1-.5)<Number.EPSILON){const r=Math.floor(u*t);return(r%2===0?r:r+1)/t}else return Math.round(u*t)/t}const TT="Decimal";function vT(u){const e=Dg(u,3);if(Math.floor(Math.abs(e)).toString().length>12)throw vi(u,TT);const t=e.toString();return t.includes(".")?t:`${t}.0`}const ST="String",_T=/[\x00-\x1f\x7f]+/;function AT(u){if(_T.test(u))throw vi(u,ST);return`"${u.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function IT(u){return u.description||u.toString().slice(7,-1)}const xT="Token";function Wf(u){const e=IT(u);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw vi(e,xT);return e}function Ul(u){switch(typeof u){case"number":if(!on(u))throw vi(u,Yf);return Number.isInteger(u)?Lg(u):vT(u);case"string":return AT(u);case"symbol":return Wf(u);case"boolean":return hT(u);case"object":if(u instanceof Date)return bT(u);if(u instanceof Uint8Array)return pT(u);if(u instanceof Cg)return Wf(u);default:throw vi(u,Yf)}}const wT="Key";function zl(u){if(/^[a-z*][a-z0-9\-_.*]*$/.test(u)===!1)throw vi(u,wT);return u}function hu(u){return u==null?"":Object.entries(u).map(([e,t])=>t===!0?`;${zl(e)}`:`;${zl(e)}=${Ul(t)}`).join("")}function Pg(u){return u instanceof Ti?`${Ul(u.value)}${hu(u.params)}`:Ul(u)}function RT(u){return`(${u.value.map(Pg).join(" ")})${hu(u.params)}`}function kT(u,e={whitespace:!0}){if(typeof u!="object"||u==null)throw vi(u,uT);const t=u instanceof Map?u.entries():Object.entries(u),n=e?.whitespace?" ":"";return Array.from(t).map(([r,i])=>{i instanceof Ti||(i=new Ti(i));let o=zl(r);return i.value===!0?o+=hu(i.params):(o+="=",Array.isArray(i.value)?o+=RT(i):o+=Pg(i)),o}).join(`,${n}`)}function Ng(u,e){return kT(u,e)}const mi="CMCD-Object",ur="CMCD-Request",ra="CMCD-Session",Gi="CMCD-Status",CT={br:mi,ab:mi,d:mi,ot:mi,tb:mi,tpb:mi,lb:mi,tab:mi,lab:mi,url:mi,pb:ur,bl:ur,tbl:ur,dl:ur,ltc:ur,mtp:ur,nor:ur,nrr:ur,rc:ur,sn:ur,sta:ur,su:ur,ttfb:ur,ttfbb:ur,ttlb:ur,cmsdd:ur,cmsds:ur,smrt:ur,df:ur,cs:ur,ts:ur,cid:ra,pr:ra,sf:ra,sid:ra,st:ra,v:ra,msd:ra,bs:Gi,bsd:Gi,cdn:Gi,rtp:Gi,bg:Gi,pt:Gi,ec:Gi,e:Gi},LT={REQUEST:ur};function DT(u){return Object.keys(u).reduce((e,t)=>{var n;return(n=u[t])===null||n===void 0||n.forEach(r=>e[r]=t),e},{})}function PT(u,e){const t={};if(!u)return t;const n=Object.keys(u),r=e?DT(e):{};return n.reduce((i,o)=>{var l;const d=CT[o]||r[o]||LT.REQUEST,c=(l=i[d])!==null&&l!==void 0?l:i[d]={};return c[o]=u[o],i},t)}function NT(u){return["ot","sf","st","e","sta"].includes(u)}function MT(u){return typeof u=="number"?on(u):u!=null&&u!==""&&u!==!1}const Mg="event";function OT(u,e){const t=new URL(u),n=new URL(e);if(t.origin!==n.origin)return u;const r=t.pathname.split("/").slice(1),i=n.pathname.split("/").slice(1,-1);for(;r[0]===i[0];)r.shift(),i.shift();for(;i.length;)i.shift(),r.unshift("..");return r.join("/")+t.search+t.hash}const Zs=u=>Math.round(u),Bl=(u,e)=>Array.isArray(u)?u.map(t=>Bl(t,e)):u instanceof Ti&&typeof u.value=="string"?new Ti(Bl(u.value,e),u.params):(e.baseUrl&&(u=OT(u,e.baseUrl)),e.version===1?encodeURIComponent(u):u),zs=u=>Zs(u/100)*100,FT=(u,e)=>{let t=u;return e.version>=2&&(u instanceof Ti&&typeof u.value=="string"?t=new Ti([u]):typeof u=="string"&&(t=[u])),Bl(t,e)},UT={br:Zs,d:Zs,bl:zs,dl:zs,mtp:zs,nor:FT,rtp:zs,tb:Zs},Og="request",Fg="response",gu=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],zT=["e"],BT=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function po(u){return BT.test(u)}function jT(u){return gu.includes(u)||zT.includes(u)||po(u)}const Ug=["d","dl","nor","ot","rtp","su"];function qT(u){return gu.includes(u)||Ug.includes(u)||po(u)}const GT=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function $T(u){return gu.includes(u)||Ug.includes(u)||GT.includes(u)||po(u)}const VT=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function HT(u){return VT.includes(u)||po(u)}const KT={[Fg]:$T,[Mg]:jT,[Og]:qT};function zg(u,e={}){const t={};if(u==null||typeof u!="object")return t;const n=e.version||u.v||1,r=e.reportingMode||Og,i=n===1?HT:KT[r];let o=Object.keys(u).filter(i);const l=e.filter;typeof l=="function"&&(o=o.filter(l));const d=r===Fg||r===Mg;d&&!o.includes("ts")&&o.push("ts"),n>1&&!o.includes("v")&&o.push("v");const c=nr({},UT,e.formatters),g={version:n,reportingMode:r,baseUrl:e.baseUrl};return o.sort().forEach(f=>{let h=u[f];const y=c[f];if(typeof y=="function"&&(h=y(h,g)),f==="v"){if(n===1)return;h=n}f=="pr"&&h===1||(d&&f==="ts"&&!on(h)&&(h=Date.now()),MT(h)&&(NT(f)&&typeof h=="string"&&(h=new Cg(h)),t[f]=h))}),t}function YT(u,e={}){const t={};if(!u)return t;const n=zg(u,e),r=PT(n,e?.customHeaderMap);return Object.entries(r).reduce((i,[o,l])=>{const d=Ng(l,{whitespace:!1});return d&&(i[o]=d),i},t)}function WT(u,e,t){return nr(u,YT(e,t))}const XT="CMCD";function QT(u,e={}){return u?Ng(zg(u,e),{whitespace:!1}):""}function ZT(u,e={}){if(!u)return"";const t=QT(u,e);return encodeURIComponent(t)}function JT(u,e={}){if(!u)return"";const t=ZT(u,e);return`${XT}=${t}`}const Xf=/CMCD=[^&#]+/;function ev(u,e,t){const n=JT(e,t);if(!n)return u;if(Xf.test(u))return u.replace(Xf,n);const r=u.includes("?")?"&":"?";return`${u}${r}${n}`}class tv{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=r=>{try{this.apply(r,{ot:Mr.MANIFEST,su:!this.initialized})}catch(i){this.hls.logger.warn("Could not generate manifest CMCD data.",i)}},this.applyFragmentData=r=>{try{const{frag:i,part:o}=r,l=this.hls.levels[i.level],d=this.getObjectType(i),c={d:(o||i).duration*1e3,ot:d};(d===Mr.VIDEO||d===Mr.AUDIO||d==Mr.MUXED)&&(c.br=l.bitrate/1e3,c.tb=this.getTopBandwidth(d)/1e3,c.bl=this.getBufferLength(d));const g=o?this.getNextPart(o):this.getNextFrag(i);g!=null&&g.url&&g.url!==i.url&&(c.nor=g.url),this.apply(r,c)}catch(i){this.hls.logger.warn("Could not generate segment CMCD data.",i)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHED,this.onMediaDetached,this),e.on(ue.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHED,this.onMediaDetached,this),e.off(ue.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var n,r;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:lT.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){nr(t,this.createData());const n=t.ot===Mr.INIT||t.ot===Mr.VIDEO||t.ot===Mr.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((o,l)=>(r.includes(l)&&(o[l]=t[l]),o),{}));const i={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),WT(e.headers,t,i)):e.url=ev(e.url,t,i)}getNextFrag(e){var t;const n=(t=this.hls.levels[e.level])==null?void 0:t.details;if(n){const r=e.sn-n.startSN;return n.fragments[r+1]}}getNextPart(e){var t;const{index:n,fragment:r}=e,i=(t=this.hls.levels[r.level])==null||(t=t.details)==null?void 0:t.partList;if(i){const{sn:o}=r;for(let l=i.length-1;l>=0;l--){const d=i[l];if(d.index===n&&d.fragment.sn===o)return i[l+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Mr.TIMED_TEXT;if(e.sn==="initSegment")return Mr.INIT;if(t==="audio")return Mr.AUDIO;if(t==="main")return this.hls.audioTracks.length?Mr.VIDEO:Mr.MUXED}getTopBandwidth(e){let t=0,n;const r=this.hls;if(e===Mr.AUDIO)n=r.audioTracks;else{const i=r.maxAutoLevel,o=i>-1?i+1:r.levels.length;n=r.levels.slice(0,o)}return n.forEach(i=>{i.bitrate>t&&(t=i.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,n=e===Mr.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:Dn.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(i){this.loader=void 0,this.loader=new n(i)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(i,o,l){t(i),this.loader.load(i,o,l)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(i){this.loader=void 0,this.loader=new n(i)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(i,o,l){t(i),this.loader.load(i,o,l)}}}}const nv=3e5;class rv extends Qr{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(n=>n!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if(n?.action===_r.SendAlternateToPenaltyBox&&n.flags===zr.MoveAllAlternatesMatchingHost){const r=this.levels;let i=this._pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:l,pathwayId:d,type:c}=t.context;l&&r?o=this.getPathwayForGroupId(l,c,o):d&&(o=d)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!i&&r&&(i=this.pathways()),i&&i.length>1&&(this.updatePathwayPriority(i),n.resolved=this.pathwayId!==o),t.details===lt.BUFFER_APPEND_ERROR&&!t.fatal?n.resolved=!0:n.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${r&&r.length} priorities: ${ir(i)} penalized: ${ir(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const n=this.penalizedPathways,r=performance.now();Object.keys(n).forEach(i=>{r-n[i]>nv&&delete n[i]});for(let i=0;i<e.length;i++){const o=e[i];if(o in n)continue;if(o===this.pathwayId)return;const l=this.hls.nextLoadLevel,d=this.hls.levels[l];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,ag(t),this.hls.trigger(ue.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[l];d&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==d.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==d.bitrate&&this.log(`Unstable Pathways change from bitrate ${d.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=l);break}}}getPathwayForGroupId(e,t,n){const r=this.getLevelsForPathway(n).concat(this.levels||[]);for(let i=0;i<r.length;i++)if(t===Un.AUDIO_TRACK&&r[i].hasAudioGroup(e)||t===Un.SUBTITLE_TRACK&&r[i].hasSubtitleGroup(e))return r[i].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},r={};e.forEach(i=>{const{ID:o,"BASE-ID":l,"URI-REPLACEMENT":d}=i;if(t.some(g=>g.pathwayId===o))return;const c=this.getLevelsForPathway(l).map(g=>{const f=new sr(g.attrs);f["PATHWAY-ID"]=o;const h=f.AUDIO&&`${f.AUDIO}_clone_${o}`,y=f.SUBTITLES&&`${f.SUBTITLES}_clone_${o}`;h&&(n[f.AUDIO]=h,f.AUDIO=h),y&&(r[f.SUBTITLES]=y,f.SUBTITLES=y);const E=Bg(g.uri,f["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",d),_=new es({attrs:f,audioCodec:g.audioCodec,bitrate:g.bitrate,height:g.height,name:g.name,url:E,videoCodec:g.videoCodec,width:g.width});if(g.audioGroups)for(let L=1;L<g.audioGroups.length;L++)_.addGroupId("audio",`${g.audioGroups[L]}_clone_${o}`);if(g.subtitleGroups)for(let L=1;L<g.subtitleGroups.length;L++)_.addGroupId("text",`${g.subtitleGroups[L]}_clone_${o}`);return _});t.push(...c),Qf(this.audioTracks,n,d,o),Qf(this.subtitleTracks,r,d,o)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const g=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+g)}const i={responseType:"json",url:r.href},o=t.steeringManifestLoadPolicy.default,l=o.errorRetry||o.timeoutRetry||{},d={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},c={onSuccess:(g,f,h,y)=>{this.log(`Loaded steering manifest: "${r}"`);const E=g.data;if(E?.VERSION!==1){this.log(`Steering VERSION ${E.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=E.TTL;const{"RELOAD-URI":_,"PATHWAY-CLONES":L,"PATHWAY-PRIORITY":K}=E;if(_)try{this.uri=new self.URL(_,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${_}`);return}this.scheduleRefresh(this.uri||h.url),L&&this.clonePathways(L);const Z={steeringManifest:E,url:r.toString()};this.hls.trigger(ue.STEERING_MANIFEST_LOADED,Z),K&&this.updatePathwayPriority(K)},onError:(g,f,h,y)=>{if(this.log(`Error loading steering manifest: ${g.code} ${g.text} (${f.url})`),this.stopLoad(),g.code===410){this.enabled=!1,this.log(`Steering manifest ${f.url} no longer available`);return}let E=this.timeToLoad*1e3;if(g.code===429){const _=this.loader;if(typeof _?.getResponseHeader=="function"){const L=_.getResponseHeader("Retry-After");L&&(E=parseFloat(L)*1e3)}this.log(`Steering manifest ${f.url} rate limited`);return}this.scheduleRefresh(this.uri||f.url,E)},onTimeout:(g,f,h)=>{this.log(`Timeout loading steering manifest (${f.url})`),this.scheduleRefresh(this.uri||f.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(i,d,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const r=(n=this.hls)==null?void 0:n.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Qf(u,e,t,n){u&&Object.keys(e).forEach(r=>{const i=u.filter(o=>o.groupId===r).map(o=>{const l=nr({},o);return l.details=void 0,l.attrs=new sr(l.attrs),l.url=l.attrs.URI=Bg(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),l.groupId=l.attrs["GROUP-ID"]=e[r],l.attrs["PATHWAY-ID"]=n,l});u.push(...i)})}function Bg(u,e,t,n){const{HOST:r,PARAMS:i,[t]:o}=n;let l;e&&(l=o?.[e],l&&(u=l));const d=new self.URL(u);return r&&!l&&(d.host=r),i&&Object.keys(i).sort().forEach(c=>{c&&d.searchParams.set(c,i[c])}),d.href}class ka extends Qr{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=ka.CDMCleanupPromise?[ka.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:n,initData:r}=t,i=`"${t.type}" event: init data type: "${n}"`;if(this.debug(i),r!==null){if(!this.keyFormatPromise){let o=Object.keys(this.keySystemAccessPromises);o.length||(o=Ya(this.config));const l=o.map(rl).filter(d=>!!d);this.keyFormatPromise=this.getKeyFormatPromise(l)}this.keyFormatPromise.then(o=>{const l=Ws(o);if(n!=="sinf"||l!==or.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${n}" for selected key-system ${l}`);return}let d;try{const y=pr(new Uint8Array(r)),E=nu(JSON.parse(y).sinf),_=Nh(E);if(!_)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");d=new Uint8Array(_.subarray(8,24))}catch(y){this.warn(`${i} Failed to parse sinf: ${y}`);return}const c=Ar(d),{keyIdToKeySessionPromise:g,mediaKeySessions:f}=this;let h=g[c];for(let y=0;y<f.length;y++){const E=f[y],_=E.decryptdata;if(!_.keyId)continue;const L=Ar(_.keyId);if(lo(d,_.keyId)||_.uri.replace(/-/g,"").indexOf(c)!==-1){if(h=g[L],!h)continue;if(_.pssh)break;delete g[L],_.pssh=new Uint8Array(r),_.keyId=d,h=g[c]=h.then(()=>this.generateRequestWithPreferredKeySession(E,n,r,"encrypted-event-key-match")),h.catch(K=>this.handleError(K));break}}h||this.handleError(new Error(`Key ID ${c} not encountered in playlist. Key-system sessions ${f.length}.`))}).catch(o=>this.handleError(o))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(ue.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(ue.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(ue.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(ue.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(ue.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(ue.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:n}=this.config,r=t?.[e];if(r)return r.licenseUrl;if(e===or.WIDEVINE&&n)return n}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,n=t?.[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(o,l,d)=>!!o&&d.indexOf(o)===l,r=t.map(o=>o.audioCodec).filter(n),i=t.map(o=>o.videoCodec).filter(n);return r.length+i.length===0&&i.push("avc1.42e01e"),new Promise((o,l)=>{const d=c=>{const g=c.shift();this.getMediaKeysPromise(g,r,i).then(f=>o({keySystem:g,mediaKeys:f})).catch(f=>{c.length?d(c):f instanceof Ur?l(f):l(new Ur({type:_n.KEY_SYSTEM_ERROR,details:lt.KEY_SYSTEM_NO_ACCESS,error:f,fatal:!0},f.message))})};d(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${n}`;return Qh===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return n(e,t)}getMediaKeysPromise(e,t,n){var r;const i=Fb(e,t,n,this.config.drmSystemOptions||{});let o=this.keySystemAccessPromises[e],l=(r=o)==null?void 0:r.keySystemAccess;if(!l){this.log(`Requesting encrypted media "${e}" key-system access with config: ${ir(i)}`),l=this.requestMediaKeySystemAccess(e,i);const d=o=this.keySystemAccessPromises[e]={keySystemAccess:l};return l.catch(c=>{this.log(`Failed to obtain access to key-system "${e}": ${c}`)}),l.then(c=>{this.log(`Access for key-system "${c.keySystem}" obtained`);const g=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const f=d.mediaKeys=c.createMediaKeys().then(h=>(this.log(`Media-keys created for "${e}"`),d.hasMediaKeys=!0,g.then(y=>y?this.setMediaKeysServerCertificate(h,e,y):h)));return f.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),f})}return l.then(()=>o.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${Ar(e.keyId||[])} keyUri: ${e.uri}`);const r=n.createSession(),i={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(i),i}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),r=Bs(t),i="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(n,i,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyId ${Ar(e.decryptdata.keyId||[])}
|
|
28
|
+
} (data length: ${t.byteLength})`),n.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>rl(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:n})=>this.attemptSetMediaKeys(t,n))}selectKeySystem(e){return new Promise((t,n)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:r})=>{const i=rl(r);i?t(i):n(new Error(`Unable to find format for key-system "${r}"`))}).catch(n)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=Ya(this.config),n=e.map(Ws).filter(r=>!!r&&t.indexOf(r)!==-1);return this.selectKeySystem(n)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let n=0;n<t.length;n++){const r=iv(e,t[n]);if(r)return r}}loadKey(e){const t=e.keyInfo.decryptdata,n=Bs(t),r=this.bannedKeyIds[n];if(r||this.getKeyStatus(t)==="internal-error"){const l=Zf(r||"internal-error",t);return this.handleError(l,e.frag),Promise.reject(l)}const i=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);const o=this.keyIdToKeySessionPromise[n];if(!o){const l=this.getKeySystemForKeyPromise(t).then(({keySystem:d,mediaKeys:c})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(d,c).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:d,mediaKeys:c,decryptdata:t}))))).then(d=>{const c="cenc",g=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(d,c,g,"playlist-key")});return l.catch(d=>this.handleError(d,e.frag)),this.keyIdToKeySessionPromise[n]=l,l}return o.catch(l=>{if(l instanceof Ur){const d=Qn({},l.data);this.getKeyStatus(t)==="internal-error"&&(d.decryptdata=t);const c=new Ur(d,l.message);this.handleError(c,e.frag)}}),o}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof Ur){t&&(e.data.frag=t);const n=e.data.decryptdata;this.error(`${e.message}${n?` (${Ar(n.keyId||[])})`:""}`),this.hls.trigger(ue.ERROR,e.data)}else this.error(e.message),this.hls.trigger(ue.ERROR,{type:_n.KEY_SYSTEM_ERROR,details:lt.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=Bs(e),n=this.keyIdToKeySessionPromise[t];if(!n){const r=Ws(e.keyFormat),i=r?[r]:Ya(this.config);return this.attemptKeySystemAccess(i)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=Ya(this.config)),e.length===0)throw new Ur({type:_n.KEY_SYSTEM_ERROR,details:lt.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${ir({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(n).then(()=>this.media?this.media.setMediaKeys(t):new Promise((i,o)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return o(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(i).catch(o)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(i=>n.indexOf(i)===-1)})}generateRequestWithPreferredKeySession(e,t,n,r){var i;const o=(i=this.config.drmSystems)==null||(i=i[e.keySystem])==null?void 0:i.generateRequest;if(o)try{const E=o.call(this.hls,t,n,e);if(!E)throw new Error("Invalid response from configured generateRequest filter");t=E.initDataType,n=E.initData?E.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(E){if(this.warn(E.message),this.hls&&this.hls.config.debug)throw E}if(n===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const l=Bs(e.decryptdata),d=e.decryptdata.uri;this.log(`Generating key-session request for "${r}" keyId: ${l} URI: ${d} (init data type: ${t} length: ${n.byteLength})`);const c=new iu,g=e._onmessage=E=>{const _=e.mediaKeysSession;if(!_){c.emit("error",new Error("invalid state"));return}const{messageType:L,message:K}=E;this.log(`"${L}" message event for session "${_.sessionId}" message size: ${K.byteLength}`),L==="license-request"||L==="license-renewal"?this.renewLicense(e,K).catch(Z=>{c.eventNames().length?c.emit("error",Z):this.handleError(Z)}):L==="license-release"?e.keySystem===or.FAIRPLAY&&this.updateKeySession(e,Dl("acknowledged")).then(()=>this.removeSession(e)).catch(Z=>this.handleError(Z)):this.warn(`unhandled media key message type "${L}"`)},f=(E,_)=>{_.keyStatus=E;let L;E.startsWith("usable")?c.emit("resolved"):E==="internal-error"||E==="output-restricted"||E==="output-downscaled"?L=Zf(E,_.decryptdata):E==="expired"?L=new Error(`key expired (keyId: ${l})`):E==="released"?L=new Error("key released"):E==="status-pending"||this.warn(`unhandled key status change "${E}" (keyId: ${l})`),L&&(c.eventNames().length?c.emit("error",L):this.handleError(L))},h=e._onkeystatuseschange=E=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}const L=this.getKeyStatuses(e);if(!Object.keys(L).some(pe=>L[pe]!=="status-pending"))return;if(L[l]==="expired"){this.log(`Expired key ${ir(L)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let Z=L[l];if(Z)f(Z,e);else{var ae;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(ae=e.keyStatusTimeouts)[l]||(ae[l]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const xe=this.getKeyStatus(e.decryptdata);if(xe&&xe!=="status-pending")return this.log(`No status for keyId ${l} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${xe} from other session.`),f(xe,e);this.log(`key status for ${l} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),Z="internal-error",f(Z,e)},1e3)),this.log(`No status for keyId ${l} (${ir(L)}).`)}};Cr(e.mediaKeysSession,"message",g),Cr(e.mediaKeysSession,"keystatuseschange",h);const y=new Promise((E,_)=>{c.on("error",_),c.on("resolved",E)});return e.mediaKeysSession.generateRequest(t,n).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${l} URI: ${d}`)}).catch(E=>{throw new Ur({type:_n.KEY_SYSTEM_ERROR,details:lt.KEY_SYSTEM_NO_SESSION,error:E,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${E}`)}).then(()=>y).catch(E=>(c.removeAllListeners(),this.removeSession(e).then(()=>{throw E}))).then(()=>(c.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((n,r)=>{if(typeof r=="string"&&typeof n=="object"){const l=r;r=n,n=l}const i="buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);if(e.keySystem===or.PLAYREADY&&i.length===16){const l=Ar(i);t[l]=n,Wh(i)}const o=Ar(i);n==="internal-error"&&(this.bannedKeyIds[o]=n),this.log(`key status change "${n}" for keyStatuses keyId: ${o} key-session "${e.mediaKeysSession.sessionId}"`),t[o]=n}),t}fetchServerCertificate(e){const t=this.config,n=t.loader,r=new n(t),i=this.getServerCertificateUrl(e);return i?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,l)=>{const d={responseType:"arraybuffer",url:i},c=t.certLoadPolicy.default,g={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,y,E,_)=>{o(h.data)},onError:(h,y,E,_)=>{l(new Ur({type:_n.KEY_SYSTEM_ERROR,details:lt.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:Qn({url:d.url,data:void 0},h)},`"${e}" certificate request failed (${i}). Status: ${h.code} (${h.text})`))},onTimeout:(h,y,E)=>{l(new Ur({type:_n.KEY_SYSTEM_ERROR,details:lt.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:E,response:{url:d.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(h,y,E)=>{l(new Error("aborted"))}};r.load(d,g,f)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((r,i)=>{e.setServerCertificate(n).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${n.byteLength}) on "${t}"`),r(e)}).catch(o=>{i(new Ur({type:_n.KEY_SYSTEM_ERROR,details:lt.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(r=>{throw new Ur({type:_n.KEY_SYSTEM_ERROR,details:lt.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:r,fatal:!1},r.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(n,"application/xml"),i=r.querySelectorAll("HttpHeader");if(i.length>0){let g;for(let f=0,h=i.length;f<h;f++){var o,l;g=i[f];const y=(o=g.querySelector("name"))==null?void 0:o.textContent,E=(l=g.querySelector("value"))==null?void 0:l.textContent;y&&E&&e.setRequestHeader(y,E)}}const d=r.querySelector("Challenge"),c=d?.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return Dl(atob(c))}setupLicenseXHR(e,t,n,r){const i=this.config.licenseXhrSetup;return i?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return i.call(this.hls,e,t,n,r)}).catch(o=>{if(!n.decryptdata)throw o;return e.open("POST",t,!0),i.call(this.hls,e,t,n,r)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((r,i)=>{const o=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${o}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return i(new Error("invalid state"));if(l.readyState===4)if(l.status===200){this._requestLicenseFailureCount=0;let d=l.response;this.log(`License received ${d instanceof ArrayBuffer?d.byteLength:d}`);const c=this.config.licenseResponseCallback;if(c)try{d=c.call(this.hls,l,o,e)}catch(g){this.error(g)}r(d)}else{const d=n.errorRetry,c=d?d.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||l.status>=400&&l.status<500)i(new Ur({type:_n.KEY_SYSTEM_ERROR,details:lt.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:l,response:{url:o,data:void 0,code:l.status,text:l.statusText}},`License Request XHR failed (${o}). Status: ${l.status} (${l.statusText})`));else{const g=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${g} attempts left`),this.requestLicense(e,t).then(r,i)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=l,this.setupLicenseXHR(l,o,e,t).then(({xhr:d,licenseChallenge:c})=>{e.keySystem==or.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(d,c)),d.send(c)}).catch(i)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,Cr(n,"encrypted",this.onMediaEncrypted),Cr(n,"waitingforkey",this.onWaitingForKey);const r=this.mediaResolved;r?r():this.mediaKeys=n.mediaKeys}onMediaDetached(){const e=this.media;e&&(Or(e,"encrypted",this.onMediaEncrypted),Or(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const n=this.media,r=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Hi.clearKeyUriToKeyIdMap();const i=r.length;ka.CDMCleanupPromise=Promise.all(r.map(o=>this.removeSession(o)).concat((n==null||(e=n.setMediaKeys(null))==null?void 0:e.catch(o=>{this.log(`Could not clear media keys: ${o}`),this.hls&&this.hls.trigger(ue.ERROR,{type:_n.OTHER_ERROR,details:lt.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${o}`)})}))||Promise.resolve())).catch(o=>{this.log(`Could not close sessions and clear media keys: ${o}`),this.hls&&this.hls.trigger(ue.ERROR,{type:_n.OTHER_ERROR,details:lt.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${o}`)})}).then(()=>{i&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const n=t.reduce((r,i)=>(r.indexOf(i.keyFormat)===-1&&r.push(i.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n,decryptdata:r}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${Ar(r?.keyId||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);i>-1&&this.mediaKeySessions.splice(i,1);const{keyStatusTimeouts:o}=e;o&&Object.keys(o).forEach(c=>self.clearTimeout(o[c]));const{drmSystemOptions:l}=this.config;return(zb(l)?new Promise((c,g)=>{self.setTimeout(()=>g(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(c).catch(g)}):Promise.resolve()).catch(c=>{this.log(`Could not remove session: ${c}`),this.hls&&this.hls.trigger(ue.ERROR,{type:_n.OTHER_ERROR,details:lt.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${c}`)})}).then(()=>t.close()).catch(c=>{this.log(`Could not close session: ${c}`),this.hls&&this.hls.trigger(ue.ERROR,{type:_n.OTHER_ERROR,details:lt.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${c}`)})})}return Promise.resolve()}}ka.CDMCleanupPromise=void 0;function Bs(u){if(!u)throw new Error("Could not read keyId of undefined decryptdata");if(u.keyId===null)throw new Error("keyId is null");return Ar(u.keyId)}function iv(u,e){if(u.keyId&&e.mediaKeysSession.keyStatuses.has(u.keyId))return e.mediaKeysSession.keyStatuses.get(u.keyId);if(u.matches(e.decryptdata))return e.keyStatus}class Ur extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function Zf(u,e){const t=u==="output-restricted",n=t?lt.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:lt.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Ur({type:_n.KEY_SYSTEM_ERROR,details:n,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${u}"`)}class av{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const n=this.hls.config;if(n.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,n){const r=performance.now();if(t){if(this.lastTime){const i=r-this.lastTime,o=n-this.lastDroppedFrames,l=t-this.lastDecodedFrames,d=1e3*o/i,c=this.hls;if(c.trigger(ue.FPS_DROP,{currentDropped:o,currentDecoded:l,totalDroppedFrames:n}),d>0&&o>c.config.fpsDroppedMonitoringThreshold*l){let g=c.currentLevel;c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+g),g>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=g)&&(g=g-1,c.trigger(ue.FPS_DROP_LEVEL_CAPPING,{level:g,droppedLevel:c.currentLevel}),c.autoLevelCapping=g,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=n,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function jg(u,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=u,e.dispatchEvent(t)}function qg(u,e){const t=u.mode;if(t==="disabled"&&(u.mode="hidden"),u.cues&&!u.cues.getCueById(e.id))try{if(u.addCue(e),!u.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){Zn.debug(`[texttrack-utils]: ${n}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,u.addCue(r)}catch(r){Zn.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(u.mode=t)}function xa(u,e){const t=u.mode;if(t==="disabled"&&(u.mode="hidden"),u.cues)for(let n=u.cues.length;n--;)e&&u.cues[n].removeEventListener("enter",e),u.removeCue(u.cues[n]);t==="disabled"&&(u.mode=t)}function jl(u,e,t,n){const r=u.mode;if(r==="disabled"&&(u.mode="hidden"),u.cues&&u.cues.length>0){const i=ov(u.cues,e,t);for(let o=0;o<i.length;o++)(!n||n(i[o]))&&u.removeCue(i[o])}r==="disabled"&&(u.mode=r)}function sv(u,e){if(e<=u[0].startTime)return 0;const t=u.length-1;if(e>u[t].endTime)return-1;let n=0,r=t,i;for(;n<=r;)if(i=Math.floor((r+n)/2),e<u[i].startTime)r=i-1;else if(e>u[i].startTime&&n<t)n=i+1;else return i;return u[n].startTime-e<e-u[r].startTime?n:r}function ov(u,e,t){const n=[],r=sv(u,e);if(r>-1)for(let i=r,o=u.length;i<o;i++){const l=u[i];if(l.startTime>=e&&l.endTime<=t)n.push(l);else if(l.startTime>t)return n}return n}function Js(u){const e=[];for(let t=0;t<u.length;t++){const n=u[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(u[t])}return e}class lv extends du{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const n=Js(this.media.textTracks);for(let i=0;i<n.length;i++)if(n[i].mode==="hidden")t=n[i];else if(n[i].mode==="showing"){t=n[i];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.LEVEL_LOADING,this.onLevelLoading,this),e.on(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(ue.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.LEVEL_LOADING,this.onLevelLoading,this),e.off(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(ue.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(ue.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const n=this.media;if(!n)return;const r=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,r)return;Js(n.textTracks).forEach(o=>{xa(o)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:n,groupId:r,details:i}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==r){this.warn(`Subtitle track with id:${n} and group:${r} not found in active group ${o?.groupId}`);return}const l=o.details;o.details=t.details,this.log(`Subtitle track ${n} "${o.name}" lang:${o.lang} group:${r} loaded [${i.startSN}-${i.endSN}]`),n===this.trackId&&this.playlistLoaded(n,t,l)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const n=t.subtitleGroups||null,r=this.groupIds;let i=this.currentTrack;if(!n||r?.length!==n?.length||n!=null&&n.some(o=>r?.indexOf(o)===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(g=>!n||n.indexOf(g.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(g=>g.default)&&(this.selectDefaultTrack=!1),o.forEach((g,f)=>{g.id=f});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.subtitlePreference;if(!i&&l){this.selectDefaultTrack=!1;const g=Ei(l,o);if(g>-1)i=o[g];else{const f=Ei(l,this.tracks);i=this.tracks[f]}}let d=this.findTrackId(i);d===-1&&i&&(d=this.findTrackId(null));const c={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${n?.join(",")}" group-id`),this.hls.trigger(ue.SUBTITLE_TRACKS_UPDATED,c),d!==-1&&this.trackId===-1&&this.setSubtitleTrack(d)}}findTrackId(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const i=t[r];if(!(n&&!i.default||!n&&!e)&&(!e||la(i,e)))return r}if(e){for(let r=0;r<t.length;r++){const i=t[r];if(is(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const i=t[r];if(is(e.attrs,i.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const r=t[n];if(Fl(r,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Un.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const n=this.currentTrack;if(n&&la(e,n))return n;const r=Ei(e,this.tracksInGroup);if(r>-1){const i=this.tracksInGroup[r];return this.setSubtitleTrack(r),i}else{if(n)return null;{const i=Ei(e,t);if(i>-1)return t[i]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,r=e.groupId,i=this.getUrlWithDirectives(e.url,t),o=e.details,l=o?.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${i}`),this.hls.trigger(ue.SUBTITLE_TRACK_LOADING,{url:i,id:n,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Js(e.textTracks),n=this.currentTrack;let r;if(n&&(r=t.filter(i=>Fl(n,i))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(i=>{i.mode!=="disabled"&&i!==r&&(i.mode="disabled")}),r){const i=this.subtitleDisplay?"showing":"hidden";r.mode!==i&&(r.mode=i)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!on(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(ue.SUBTITLE_TRACK_SWITCH,{id:e});return}const i=!!r.details&&!r.details.live;if(e===this.trackId&&r===n&&i)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:o,groupId:l="",name:d,type:c,url:g}=r;this.hls.trigger(ue.SUBTITLE_TRACK_SWITCH,{id:o,groupId:l,name:d,type:c,url:g});const f=this.switchParams(r.url,n?.details,r.details);this.loadPlaylist(f)}}function uv(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const i=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?i:i&3|8).toString(16)})}}}function Qa(u){let e=5381,t=u.length;for(;t;)e=e*33^u.charCodeAt(--t);return(e>>>0).toString()}const Ca=.025;let ho=(function(u){return u[u.Point=0]="Point",u[u.Range=1]="Range",u})({});function cv(u,e,t){return`${u.identifier}-${t+1}-${Qa(e)}`}class dv{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const n=this.playoutLimit;return e<=0||isNaN(n)?!1:n===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>n}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return fl(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,n=fl(t,e);return t-n<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=on(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return fl(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Ca))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?ho.Range:ho.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return fv(this)}}function fl(u,e){return u-e.start<e.duration/2&&!(Math.abs(u-(e.start+e.duration))<Ca)?e.start:e.start+e.duration}function Gg(u,e,t){const n=new self.URL(u,t);return n.protocol!=="data:"&&n.searchParams.set("_HLS_primary_id",e),n}function hl(u,e){for(;(t=u.assetList[++e])!=null&&t.error;)var t;return e}function fv(u){return`["${u.identifier}" ${u.cue.pre?"<pre>":u.cue.post?"<post>":""}${u.timelineStart.toFixed(2)}-${u.resumeTime.toFixed(2)}]`}function Ia(u){const e=u.timelineStart,t=u.duration||0;return`["${u.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class hv{constructor(e,t,n,r){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(ue.PLAYOUT_LIMIT_REACHED,{})};const i=this.hls=new e(t);this.interstitial=n,this.assetItem=r;const o=()=>{this.hasDetails=!0};i.once(ue.LEVEL_LOADED,o),i.once(ue.AUDIO_TRACK_LOADED,o),i.once(ue.SUBTITLE_TRACK_LOADED,o),i.on(ue.MEDIA_ATTACHING,(l,{media:d})=>{this.removeMediaListeners(),this.mediaAttached=d,this.interstitial.playoutLimit&&(d.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&i.on(ue.BUFFER_APPENDED,()=>{const g=this.bufferedEnd;this.reachedPlayout(g)&&(this._bufferedEosTime=g,i.trigger(ue.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=Gg(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const n=Math.min(this._bufferedEosTime||1/0,this.duration),r=this.timelineOffset,i=Dn.bufferInfo(e,r,0);return this.getAssetTime(i.end)>=n-.02}reachedPlayout(e){const n=this.interstitial.playoutLimit;return this.startOffset+e>=n}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=Dn.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const n=t-this.startOffset;if(n>0&&n<e)return n}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const n=e-t;if(Math.abs(n)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,n=this.duration;return Math.min(Math.max(0,e-t),n)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=n=>delete n.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,n){var r;(r=this.hls)==null||r.on(e,t)}once(e,t,n){var r;(r=this.hls)==null||r.once(e,t)}off(e,t,n){var r;(r=this.hls)==null||r.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${Ia(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Jf=.033;class gv extends Qr{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((n,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,n+1):n,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);const r=this.items;if(r)for(r[n]||(t===void 0&&(t=e.start),n=this.findItemIndexAtTime(t));n>=0&&(i=r[n])!=null&&i.event;){var i;n--}return n}findItemIndexAtTime(e,t){const n=this.items;if(n)for(let r=0;r<n.length;r++){let i=n[r];if(t&&t!=="primary"&&(i=i[t]),e===i.start||e>i.start&&e<i.end)return r}return-1}findJumpRestrictedIndex(e,t){const n=this.items;if(n)for(let r=e;r<=t&&n[r];r++){const i=n[r].event;if(i!=null&&i.restrictions.jump&&!i.appendInPlace)return r}return-1}findEventIndex(e){const t=this.items;if(t)for(let r=t.length;r--;){var n;if(((n=t[r].event)==null?void 0:n.identifier)===e)return r}return-1}findAssetIndex(e,t){const n=e.assetList,r=n.length;if(r>1)for(let i=0;i<r;i++){const o=n[i];if(!o.error){const l=o.timelineStart;if(t===l||t>l&&(t<l+(o.duration||0)||i===r-1))return i}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const n=t.assetList,r=n[n.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,t){const n=e.main.details,{dateRanges:r}=n,i=this.events,o=this.parseDateRanges(r,{url:n.url},t),l=Object.keys(r),d=i?i.filter(c=>!l.includes(c.identifier)):[];o.length&&o.sort((c,g)=>{const f=c.cue.pre,h=c.cue.post,y=g.cue.pre,E=g.cue.post;if(f&&!y)return-1;if(y&&!f||h&&!E)return 1;if(E&&!h)return-1;if(!f&&!y&&!h&&!E){const _=c.startTime,L=g.startTime;if(_!==L)return _-L}return c.dateRange.tagOrder-g.dateRange.tagOrder}),this.events=o,d.forEach(c=>{this.removeEvent(c)}),this.updateSchedule(e,d)}updateSchedule(e,t=[],n=!1){const r=this.events||[];if(r.length||t.length||this.length<2){const i=this.items,o=this.parseSchedule(r,e);(n||t.length||i?.length!==o.length||o.some((d,c)=>Math.abs(d.playout.start-i[c].playout.start)>.005||Math.abs(d.playout.end-i[c].playout.end)>.005))&&(this.items=o,this.onScheduleUpdate(t,i))}}parseDateRanges(e,t,n){const r=[],i=Object.keys(e);for(let o=0;o<i.length;o++){const l=i[o],d=e[l];if(d.isInterstitial){let c=this.eventMap[l];c?c.setDateRange(d):(c=new dv(d,t),this.eventMap[l]=c,n===!1&&(c.appendInPlace=n)),r.push(c)}}return r}parseSchedule(e,t){const n=[],r=t.main.details,i=r.live?1/0:r.edge;let o=0;if(e=e.filter(d=>!d.error&&!(d.cue.once&&d.hasPlayed)),e.length){this.resolveOffsets(e,t);let d=0,c=0;if(e.forEach((g,f)=>{const h=g.cue.pre,y=g.cue.post,E=e[f-1]||null,_=g.appendInPlace,L=y?i:g.startOffset,K=g.duration,Z=g.timelineOccupancy===ho.Range?K:0,ae=g.resumptionOffset,pe=E?.startTime===L,xe=L+g.cumulativeDuration;let ke=_?xe+K:L+ae;if(h||!y&&L<=0){const J=c;c+=Z,g.timelineStart=xe;const he=o;o+=K,n.push({event:g,start:xe,end:ke,playout:{start:he,end:o},integrated:{start:J,end:c}})}else if(L<=i){if(!pe){const Ee=L-d;if(Ee>Jf){const Le=d,et=c;c+=Ee;const Ae=o;o+=Ee;const Ze={previousEvent:e[f-1]||null,nextEvent:g,start:Le,end:Le+Ee,playout:{start:Ae,end:o},integrated:{start:et,end:c}};n.push(Ze)}else Ee>0&&E&&(E.cumulativeDuration+=Ee,n[n.length-1].end=L)}y&&(ke=xe),g.timelineStart=xe;const J=c;c+=Z;const he=o;o+=K,n.push({event:g,start:xe,end:ke,playout:{start:he,end:o},integrated:{start:J,end:c}})}else return;const Y=g.resumeTime;y||Y>i?d=i:d=Y}),d<i){var l;const g=d,f=c,h=i-d;c+=h;const y=o;o+=h,n.push({previousEvent:((l=n[n.length-1])==null?void 0:l.event)||null,nextEvent:null,start:d,end:g+h,playout:{start:y,end:o},integrated:{start:f,end:c}})}this.setDurations(i,o,c)}else n.push({previousEvent:null,nextEvent:null,start:0,end:i,playout:{start:0,end:i},integrated:{start:0,end:i}}),this.setDurations(i,i,i);return n}setDurations(e,t,n){this.durations={primary:e,playout:t,integrated:n}}resolveOffsets(e,t){const n=t.main.details,r=n.live?1/0:n.edge;let i=0,o=-1;e.forEach((l,d)=>{const c=l.cue.pre,g=l.cue.post,f=c?0:g?r:l.startTime;this.updateAssetDurations(l),o===f?l.cumulativeDuration=i:(i=0,o=f),!g&&l.snapOptions.in&&(l.resumeAnchor=ua(null,n.fragments,l.startOffset+l.resumptionOffset,0,0)||void 0),l.appendInPlace&&!l.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(l,t)||(l.appendInPlace=!1)),!l.appendInPlace&&d+1<e.length&&e[d+1].startTime-e[d].resumeTime<Jf&&(e[d+1].appendInPlace=!1,e[d+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${l}`));const y=on(l.resumeOffset)?l.resumeOffset:l.duration;i+=y})}primaryCanResumeInPlaceAt(e,t){const n=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(n-r)>Ca?(this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${r}`),!1):!Object.keys(t).some(o=>{const l=t[o].details,d=l.edge;if(n>=d)return this.log(`"${e.identifier}" resumption ${n} past ${o} playlist end ${d}`),!1;const c=ua(null,l.fragments,n);if(!c)return this.log(`"${e.identifier}" resumption ${n} does not align with any fragments in ${o} playlist (${l.fragStart}-${l.fragmentEnd})`),!0;const g=o==="audio"?.175:0;return Math.abs(c.start-n)<Ca+g||Math.abs(c.end-n)<Ca+g?!1:(this.log(`"${e.identifier}" resumption ${n} not aligned with ${o} fragment bounds (${c.start}-${c.end} sn: ${c.sn} cc: ${c.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let n=0,r=!1,i=!1;for(let o=0;o<e.assetList.length;o++){const l=e.assetList[o],d=t+n;l.startOffset=n,l.timelineStart=d,r||(r=l.duration===null),i||(i=!!l.error);const c=l.error?0:l.duration||0;n+=c}r&&!i?e.duration=Math.max(n,e.duration):e.duration=n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function oi(u){return`[${u.event?'"'+u.event.identifier+'"':"primary"}: ${u.start.toFixed(2)}-${u.end.toFixed(2)}]`}class mv{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const n=e.assetListUrl;let r;try{r=Gg(n,this.hls.sessionId,e.baseUrl)}catch(h){const y=this.assignAssetListError(e,lt.ASSET_LIST_LOAD_ERROR,h,n);this.hls.trigger(ue.ERROR,y);return}t&&r.protocol!=="data:"&&r.searchParams.set("_HLS_start_offset",""+t);const i=this.hls.config,o=i.loader,l=new o(i),d={responseType:"json",url:r.href},c=i.interstitialAssetListLoadPolicy.default,g={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,y,E,_)=>{const L=h.data,K=L?.ASSETS;if(!Array.isArray(K)){const Z=this.assignAssetListError(e,lt.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),E.url,y,_);this.hls.trigger(ue.ERROR,Z);return}e.assetListResponse=L,this.hls.trigger(ue.ASSET_LIST_LOADED,{event:e,assetListResponse:L,networkDetails:_})},onError:(h,y,E,_)=>{const L=this.assignAssetListError(e,lt.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${h.code} ${h.text} (${y.url})`),y.url,_,E);this.hls.trigger(ue.ERROR,L)},onTimeout:(h,y,E)=>{const _=this.assignAssetListError(e,lt.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${y.url})`),y.url,h,E);this.hls.trigger(ue.ERROR,_)}};return l.load(d,g,f),this.hls.trigger(ue.ASSET_LIST_LOADING,{event:e}),l}assignAssetListError(e,t,n,r,i,o){return e.error=n,{type:_n.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:n,networkDetails:o,stats:i}}}function eh(u){var e;u==null||(e=u.play())==null||e.catch(()=>{})}function js(u,e){return`[${u}] Advancing timeline position to ${e}`}class pv extends Qr{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled||!this.schedule)return;const r=n-this.timelinePos;if(Math.abs(r)<1/7056e5)return;const o=r<=-.01;this.timelinePos=n,this.bufferedPos=n;const l=this.playingItem;if(!l){this.checkBuffer();return}if(o&&this.schedule.resetErrorsInRange(n,n-r)&&this.updateSchedule(!0),this.checkBuffer(),o&&n<l.start||n>=l.end){var d;const y=this.findItemIndex(l);let E=this.schedule.findItemIndexAtTime(n);if(E===-1&&(E=y+(o?-1:1),this.log(`seeked ${o?"back ":""}to position not covered by schedule ${n} (resolving from ${y} to ${E})`)),!this.isInterstitial(l)&&(d=this.media)!=null&&d.paused&&(this.shouldPlay=!1),!o&&E>y){const _=this.schedule.findJumpRestrictedIndex(y+1,E);if(_>y){this.setSchedulePosition(_);return}}this.setSchedulePosition(E);return}const c=this.playingAsset;if(!c){if(this.playingLastItem&&this.isInterstitial(l)){const y=l.event.assetList[0];y&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(n,y))}return}const g=c.timelineStart,f=c.duration||0;if(o&&n<g||n>=g+f){var h;(h=l.event)!=null&&h.appendInPlace&&(this.clearAssetPlayers(l.event,l),this.flushFrontBuffer(n)),this.setScheduleToAssetAtTime(n,c)}},this.onTimeupdate=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled)return;if(n>this.timelinePos)this.timelinePos=n,n>this.bufferedPos&&this.checkBuffer();else return;const r=this.playingItem;if(!r||this.playingLastItem)return;if(n>=r.end){this.timelinePos=r.end;const l=this.findItemIndex(r);this.setSchedulePosition(l+1)}const i=this.playingAsset;if(!i)return;const o=i.timelineStart+(i.duration||0);n>=o&&this.setScheduleToAssetAtTime(n,i)},this.onScheduleUpdate=(n,r)=>{const i=this.schedule;if(!i)return;const o=this.playingItem,l=i.events||[],d=i.items||[],c=i.durations,g=n.map(_=>_.identifier),f=!!(l.length||g.length);(f||r)&&this.log(`INTERSTITIALS_UPDATED (${l.length}): ${l}
|
|
29
|
+
Schedule: ${d.map(_=>oi(_))} pos: ${this.timelinePos}`),g.length&&this.log(`Removed events ${g}`);let h=null,y=null;o&&(h=this.updateItem(o,this.timelinePos),this.itemsMatch(o,h)?this.playingItem=h:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const E=this.bufferingItem;if(E&&(y=this.updateItem(E,this.bufferedPos),this.itemsMatch(E,y)?this.bufferingItem=y:E.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(E.event,null))),n.forEach(_=>{_.assetList.forEach(L=>{this.clearAssetPlayer(L.identifier,null)})}),this.playerQueue.forEach(_=>{if(_.interstitial.appendInPlace){const L=_.assetItem.timelineStart,K=_.timelineOffset-L;if(K)try{_.timelineOffset=L}catch(Z){Math.abs(K)>Ca&&this.warn(`${Z} ("${_.assetId}" ${_.timelineOffset}->${L})`)}}}),f||r){if(this.hls.trigger(ue.INTERSTITIALS_UPDATED,{events:l.slice(0),schedule:d.slice(0),durations:c,removedIds:g}),this.isInterstitial(o)&&g.includes(o.event.identifier)){this.warn(`Interstitial "${o.event.identifier}" removed while playing`),this.primaryFallback(o.event);return}o&&this.trimInPlace(h,o),E&&y!==h&&this.trimInPlace(y,E),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new mv(e),this.schedule=new gv(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(ue.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(ue.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(ue.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(ue.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(ue.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(ue.BUFFER_APPENDED,this.onBufferAppended,this),e.on(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(ue.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(ue.MEDIA_ENDED,this.onMediaEnded,this),e.on(ue.ERROR,this.onError,this),e.on(ue.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(ue.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(ue.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(ue.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(ue.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(ue.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(ue.BUFFER_CODECS,this.onBufferCodecs,this),e.off(ue.BUFFER_APPENDED,this.onBufferAppended,this),e.off(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(ue.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(ue.MEDIA_ENDED,this.onMediaEnded,this),e.off(ue.ERROR,this.onError,this),e.off(ue.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){Or(e,"play",this.onPlay),Or(e,"pause",this.onPause),Or(e,"seeking",this.onSeeking),Or(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const n=this.media=t.media;Cr(n,"seeking",this.onSeeking),Cr(n,"timeupdate",this.onTimeupdate),Cr(n,"play",this.onPlay),Cr(n,"pause",this.onPause)}onMediaAttached(e,t){const n=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,n===null)this.checkStart();else if(!r){this.clearScheduleState();const i=this.findItemIndex(n);this.setSchedulePosition(i)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const n=!!t.transferMedia,r=this.media;if(this.media=null,!n&&(r&&this.removeMediaListeners(r),this.detachedData)){const i=this.getBufferingPlayer();i&&(this.log(`Removing schedule state for detachedData and ${i}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,i.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,n=f=>f&&e.getAssetPlayer(f.identifier),r=(f,h,y,E,_)=>{if(f){let L=f[h].start;const K=f.event;if(K){if(h==="playout"||K.timelineOccupancy!==ho.Point){const Z=n(y);Z?.interstitial===K&&(L+=Z.assetItem.startOffset+Z[_])}}else{const Z=E==="bufferedPos"?o():e[E];L+=Z-f.start}return L}return 0},i=(f,h)=>{var y;if(f!==0&&h!=="primary"&&(y=e.schedule)!=null&&y.length){var E;const _=e.schedule.findItemIndexAtTime(f),L=(E=e.schedule.items)==null?void 0:E[_];if(L){const K=L[h].start-L.start;return f+K}}return f},o=()=>{const f=e.bufferedPos;return f===Number.MAX_VALUE?l("primary"):Math.max(f,0)},l=f=>{var h,y;return(h=e.primaryDetails)!=null&&h.live?e.primaryDetails.edge:((y=e.schedule)==null?void 0:y.durations[f])||0},d=(f,h)=>{var y,E;const _=e.effectivePlayingItem;if(_!=null&&(y=_.event)!=null&&y.restrictions.skip||!e.schedule)return;e.log(`seek to ${f} "${h}"`);const L=e.effectivePlayingItem,K=e.schedule.findItemIndexAtTime(f,h),Z=(E=e.schedule.items)==null?void 0:E[K],ae=e.getBufferingPlayer(),pe=ae?.interstitial,xe=pe?.appendInPlace,ke=L&&e.itemsMatch(L,Z);if(L&&(xe||ke)){const Y=n(e.playingAsset),J=Y?.media||e.primaryMedia;if(J){const he=h==="primary"?J.currentTime:r(L,h,e.playingAsset,"timelinePos","currentTime"),Ee=f-he,Le=(xe?he:J.currentTime)+Ee;if(Le>=0&&(!Y||xe||Le<=Y.duration)){J.currentTime=Le;return}}}if(Z){let Y=f;if(h!=="primary"){const he=Z[h].start,Ee=f-he;Y=Z.start+Ee}const J=!e.isInterstitial(Z);if((!e.isInterstitial(L)||L.event.appendInPlace)&&(J||Z.event.appendInPlace)){const he=e.media||(xe?ae?.media:null);he&&(he.currentTime=Y)}else if(L){const he=e.findItemIndex(L);if(K>he){const Le=e.schedule.findJumpRestrictedIndex(he+1,K);if(Le>he){e.setSchedulePosition(Le);return}}let Ee=0;if(J)e.timelinePos=Y,e.checkBuffer();else{const Le=Z.event.assetList,et=f-(Z[h]||Z).start;for(let Ae=Le.length;Ae--;){const Ze=Le[Ae];if(Ze.duration&&et>=Ze.startOffset&&et<Ze.startOffset+Ze.duration){Ee=Ae;break}}}e.setSchedulePosition(K,Ee)}}},c=()=>{const f=e.effectivePlayingItem;if(e.isInterstitial(f))return f;const h=t();return e.isInterstitial(h)?h:null},g={get bufferedEnd(){const f=t(),h=e.bufferingItem;if(h&&h===f){var y;return r(h,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-h.playout.start||((y=e.bufferingAsset)==null?void 0:y.startOffset)||0}return 0},get currentTime(){const f=c(),h=e.effectivePlayingItem;return h&&h===f?r(h,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-h.playout.start:0},set currentTime(f){const h=c(),y=e.effectivePlayingItem;y&&y===h&&d(f+y.playout.start,"playout")},get duration(){const f=c();return f?f.playout.end-f.playout.start:0},get assetPlayers(){var f;const h=(f=c())==null?void 0:f.event.assetList;return h?h.map(y=>e.getAssetPlayer(y.identifier)):[]},get playingIndex(){var f;const h=(f=c())==null?void 0:f.event;return h&&e.effectivePlayingAsset?h.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return c()}};return this.manager={get events(){var f;return((f=e.schedule)==null||(f=f.events)==null?void 0:f.slice(0))||[]},get schedule(){var f;return((f=e.schedule)==null||(f=f.items)==null?void 0:f.slice(0))||[]},get interstitialPlayer(){return c()?g:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const f=t();return e.findItemIndex(f)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const f=e.effectivePlayingItem;return e.findItemIndex(f)},primary:{get bufferedEnd(){return o()},get currentTime(){const f=e.timelinePos;return f>0?f:0},set currentTime(f){d(f,"primary")},get duration(){return l("primary")},get seekableStart(){var f;return((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0}},integrated:{get bufferedEnd(){return r(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(f){d(f,"integrated")},get duration(){return l("integrated")},get seekableStart(){var f;return i(((f=e.primaryDetails)==null?void 0:f.fragmentStart)||0,"integrated")}},skip:()=>{const f=e.effectivePlayingItem,h=f?.event;if(h&&!h.restrictions.skip){const y=e.findItemIndex(f);if(h.appendInPlace){const E=f.playout.start+f.event.duration;d(E+.001,"playout")}else e.advanceAfterAssetEnded(h,y,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,n=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!n?!1:this.findItemIndex(t)===n.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(r=this.primaryMedia);const i=(t=r)==null?void 0:t.currentTime;if(!(i===void 0||!on(i)))return i}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,t)}transferMediaFromPlayer(e,t){const n=e.interstitial.appendInPlace,r=e.media;if(n&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}const i=e.transferMedia();this.log(`transfer MediaSource from ${e} ${ir(i)}`),this.detachedData=i}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var n,r;if(e.media===t)return;let i=null;const o=this.hls,l=e!==o,d=l&&e.interstitial.appendInPlace,c=(n=this.detachedData)==null?void 0:n.mediaSource;let g;if(o.media)d&&(i=o.transferMedia(),this.detachedData=i),g="Primary";else if(c){const E=this.getBufferingPlayer();E?(i=E.transferMedia(),g=`${E}`):g="detached MediaSource"}else g="detached media";if(!i){if(c)i=this.detachedData,this.log(`using detachedData: MediaSource ${ir(i)}`);else if(!this.detachedData||o.media===t){const E=this.playerQueue;E.length>1&&E.forEach(_=>{if(l&&_.interstitial.appendInPlace!==d){const L=_.interstitial;this.clearInterstitial(_.interstitial,null),L.appendInPlace=!1,L.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${L}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const f=i&&"mediaSource"in i&&((r=i.mediaSource)==null?void 0:r.readyState)!=="closed",h=f&&i?i:t;this.log(`${f?"transfering MediaSource":"attaching media"} to ${l?e:"Primary"} from ${g} (media.currentTime: ${t.currentTime})`);const y=this.schedule;if(h===i&&y){const E=l&&e.assetId===y.assetIdAtEnd;h.overrides={duration:y.duration,endOfStream:!l||E,cueRemoval:!l}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const n=this.timelinePos,r=this.effectivePlayingItem;if(n===-1){const i=this.hls.startPosition;if(this.log(js("checkStart",i)),this.timelinePos=i,t.length&&t[0].cue.pre){const o=e.findEventIndex(t[0].identifier);this.setSchedulePosition(o)}else if(i>=0||!this.primaryLive){const o=this.timelinePos=i>0?i:0,l=e.findItemIndexAtTime(o);this.setSchedulePosition(l)}}else if(r&&!this.playingItem){const i=e.findItemIndex(r);this.setSchedulePosition(i)}}advanceAssetBuffering(e,t){const n=e.event,r=n.findAssetIndex(t),i=hl(n,r);if(!n.isAssetPastPlayoutLimit(i))this.bufferedToEvent(e,i);else if(this.schedule){var o;const l=(o=this.schedule.items)==null?void 0:o[this.findItemIndex(e)+1];l&&this.bufferedToItem(l)}}advanceAfterAssetEnded(e,t,n){const r=hl(e,n);if(e.isAssetPastPlayoutLimit(r)){if(this.schedule){const i=this.schedule.items;if(i){const o=t+1,l=i.length;if(o>=l){this.setSchedulePosition(-1);return}const d=e.resumeTime;this.timelinePos<d&&(this.log(js("advanceAfterAssetEnded",d)),this.timelinePos=d,e.appendInPlace&&this.advanceInPlace(d),this.checkBuffer(this.bufferedPos<d)),this.setSchedulePosition(o)}}}else{if(e.appendInPlace){const i=e.assetList[r];i&&this.advanceInPlace(i.timelineStart)}this.setSchedulePosition(t,r)}}setScheduleToAssetAtTime(e,t){const n=this.schedule;if(!n)return;const r=t.parentIdentifier,i=n.getEvent(r);if(i){const o=n.findEventIndex(r),l=n.findAssetIndex(i,e);this.advanceAfterAssetEnded(i,o,l-1)}}setSchedulePosition(e,t){var n;const r=(n=this.schedule)==null?void 0:n.items;if(!r||this.playbackDisabled)return;const i=e>=0?r[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${i&&oi(i)}) pos: ${this.timelinePos}`);const o=this.waitingItem||this.playingItem,l=this.playingLastItem;if(this.isInterstitial(o)){const g=o.event,f=this.playingAsset,h=f?.identifier,y=h?this.getAssetPlayer(h):null;if(y&&h&&(!this.eventItemsMatch(o,i)||t!==void 0&&h!==g.assetList[t].identifier)){var d;const E=g.findAssetIndex(f);if(this.log(`INTERSTITIAL_ASSET_ENDED ${E+1}/${g.assetList.length} ${Ia(f)}`),this.endedAsset=f,this.playingAsset=null,this.hls.trigger(ue.INTERSTITIAL_ASSET_ENDED,{asset:f,assetListIndex:E,event:g,schedule:r.slice(0),scheduleIndex:e,player:y}),o!==this.playingItem){this.itemsMatch(o,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(g,this.findItemIndex(this.playingItem),E);return}this.retreiveMediaSource(h,i),y.media&&!((d=this.detachedData)!=null&&d.mediaSource)&&y.detachMedia()}if(!this.eventItemsMatch(o,i)&&(this.endedItem=o,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${g} ${oi(o)}`),g.hasPlayed=!0,this.hls.trigger(ue.INTERSTITIAL_ENDED,{event:g,schedule:r.slice(0),scheduleIndex:e}),g.cue.once)){var c;this.updateSchedule();const E=(c=this.schedule)==null?void 0:c.items;if(i&&E){const _=this.findItemIndex(i);this.advanceSchedule(_,E,t,o,l)}return}}this.advanceSchedule(e,r,t,o,l)}advanceSchedule(e,t,n,r,i){const o=this.schedule;if(!o)return;const l=t[e]||null,d=this.primaryMedia,c=this.playerQueue;if(c.length&&c.forEach(g=>{const f=g.interstitial,h=o.findEventIndex(f.identifier);(h<e||h>e+1)&&this.clearInterstitial(f,l)}),this.isInterstitial(l)){this.timelinePos=Math.min(Math.max(this.timelinePos,l.start),l.end);const g=l.event;if(n===void 0){n=o.findAssetIndex(g,this.timelinePos);const E=hl(g,n-1);if(g.isAssetPastPlayoutLimit(E)||g.appendInPlace&&this.timelinePos===l.end){this.advanceAfterAssetEnded(g,e,n);return}n=E}const f=this.waitingItem;this.assetsBuffered(l,d)||this.setBufferingItem(l);let h=this.preloadAssets(g,n);if(this.eventItemsMatch(l,f||r)||(this.waitingItem=l,this.log(`INTERSTITIAL_STARTED ${oi(l)} ${g.appendInPlace?"append in place":""}`),this.hls.trigger(ue.INTERSTITIAL_STARTED,{event:g,schedule:t.slice(0),scheduleIndex:e})),!g.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${g}`);return}if(g.assetListLoader&&(g.assetListLoader.destroy(),g.assetListLoader=void 0),!d){this.log(`Waiting for attachMedia to start Interstitial ${g}`);return}this.waitingItem=this.endedItem=null,this.playingItem=l;const y=g.assetList[n];if(!y){this.advanceAfterAssetEnded(g,e,n||0);return}if(h||(h=this.getAssetPlayer(y.identifier)),h===null||h.destroyed){const E=g.assetList.length;this.warn(`asset ${n+1}/${E} player destroyed ${g}`),h=this.createAssetPlayer(g,y,n),h.loadSource()}if(!this.eventItemsMatch(l,this.bufferingItem)&&g.appendInPlace&&this.isAssetBuffered(y))return;this.startAssetPlayer(h,n,t,e,d),this.shouldPlay&&eh(h.media)}else l?(this.resumePrimary(l,e,r),this.shouldPlay&&eh(this.hls.media)):i&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(o.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,n){var r,i;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${oi(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let l=this.timelinePos;(l<e.start||l>=e.end)&&(l=this.getPrimaryResumption(e,t),this.log(js("resumePrimary",l)),this.timelinePos=l),this.attachPrimary(l,e)}if(!n)return;const o=(i=this.schedule)==null?void 0:i.items;o&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${oi(e)}`),this.hls.trigger(ue.INTERSTITIALS_PRIMARY_RESUMED,{schedule:o.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const n=e.start;if(this.primaryLive){const r=this.primaryDetails;if(t===0)return this.hls.startPosition;if(r&&(n<r.fragmentStart||n>r.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:Dn.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,n){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const r=this.primaryMedia;if(!r)return;const i=this.hls;i.media?this.checkBuffer():(this.transferMediaTo(i,r),n&&this.startLoadingPrimaryAt(e,n)),n||(this.log(js("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,t){var n;const r=this.hls;!r.loadingEnabled||!r.media||Math.abs((((n=r.mainForwardBufferInfo)==null?void 0:n.start)||r.media.currentTime)-e)>.5?r.startLoad(e,t):r.bufferingEnabled||r.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(ue.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(ue.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const n=this.hls.levels[t.level];if(!n.details)return;const r=Qn(Qn({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const n=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=Qn(Qn({},this.altSelection),{},{audio:n});return}const i=Qn(Qn({},r),{},{audio:n});this.mediaSelection=i}onSubtitleTrackUpdated(e,t){const n=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=Qn(Qn({},this.altSelection),{},{subtitles:n});return}const i=Qn(Qn({},r),{},{subtitles:n});this.mediaSelection=i}onAudioTrackSwitching(e,t){const n=uf(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setAudioOption(t)||r.setAudioOption(n)))}onSubtitleTrackSwitch(e,t){const n=uf(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setSubtitleOption(t)||t.id!==-1&&r.setSubtitleOption(n)))}onBufferCodecs(e,t){const n=t.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){const r=this.timelinePos;this.bufferedPos=r,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let r=0;r<t.length;r++){const i=t[r];if(i.cue.post){var n;const o=this.schedule.findEventIndex(i.identifier),l=(n=this.schedule.items)==null?void 0:n[o];this.isInterstitial(l)&&this.eventItemsMatch(l,this.bufferingItem)&&this.bufferedToItem(l,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const n=this.findItemIndex(t);this.setSchedulePosition(n+1)}else this.shouldPlay=!1}updateItem(e,t){var n;const r=(n=this.schedule)==null?void 0:n.items;if(e&&r){const i=this.findItemIndex(e,t);return r[i]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((i,o)=>{e.event.isAssetPastPlayoutLimit(o)&&this.clearAssetPlayer(i.identifier,null)});const n=e.end+.25,r=Dn.bufferInfo(this.primaryMedia,n,0);(r.end>n||(r.nextStart||0)>n)&&(this.log(`trim buffered interstitial ${oi(e)} (was ${oi(t)})`),this.attachPrimary(n,null,!0),this.flushFrontBuffer(n))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var n;return!!t&&(e===t||e.event.identifier===((n=t.event)==null?void 0:n.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const n=this.mediaSelection;n&&((t=this.schedule)==null||t.updateSchedule(n,[],e))}checkBuffer(e){var t;const n=(t=this.schedule)==null?void 0:t.items;if(!n)return;const r=Dn.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=r.len<1),this.updateBufferedPos(r.end,n,e)}updateBufferedPos(e,t,n){const r=this.schedule,i=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(t.length===1&&this.itemsMatch(t[0],i)){this.bufferedPos=e;return}const o=this.playingItem,l=this.findItemIndex(o);let d=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var c;const g=this.findItemIndex(i),f=Math.min(g+1,t.length-1),h=t[f];if((d===-1&&i&&e>=i.end||(c=h.event)!=null&&c.appendInPlace&&e+.01>=h.start)&&(d=f),this.isInterstitial(i)){const y=i.event;if(f-l>1&&y.appendInPlace===!1||y.assetList.length===0&&y.assetListLoader)return}if(this.bufferedPos=e,d>g&&d>l)this.bufferedToItem(h);else{const y=this.primaryDetails;this.primaryLive&&y&&e>y.edge-y.targetduration&&h.start<y.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(h)&&this.preloadAssets(h.event,0)}}else n&&o&&!this.itemsMatch(o,i)&&(d===l?this.bufferedToItem(o):d===l+1&&this.bufferedToItem(t[d]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(r=>{const i=this.getAssetPlayer(r.identifier);return!(i!=null&&i.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,n=this.schedule;if(!this.itemsMatch(e,t)&&n){const{items:r,events:i}=n;if(!r||!i)return t;const o=this.isInterstitial(e),l=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const d=l?l.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${oi(e)}`+(t?` (${d.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(o){const c=n.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((g,f)=>{const h=this.getAssetPlayer(g.identifier);h&&(f===c&&h.loadSource(),h.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(c=>c.pauseBuffering());this.hls.trigger(ue.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:i.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const n=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(n!==null){this.bufferingAsset=null;const r=this.detachedData;r?r.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),n=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,t){const n=e.event,r=n.assetList.length===0&&!n.assetListLoader,i=n.cue.once;if(r||!i){const o=this.preloadAssets(n,t);if(o!=null&&o.interstitial.appendInPlace){const l=this.primaryMedia;l&&this.bufferAssetPlayer(o,l)}}}preloadAssets(e,t){const n=e.assetUrl,r=e.assetList.length,i=r===0&&!e.assetListLoader,o=e.cue.once;if(i){const d=e.timelineStart;if(e.appendInPlace){var l;const h=this.playingItem;!this.isInterstitial(h)&&(h==null||(l=h.nextEvent)==null?void 0:l.identifier)===e.identifier&&this.flushFrontBuffer(d+.25)}let c,g=0;if(!this.playingItem&&this.primaryLive&&(g=this.hls.startPosition,g===-1&&(g=this.hls.liveSyncPosition||0)),g&&!(e.cue.pre||e.cue.post)){const h=g-d;h>0&&(c=Math.round(h*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${n?1:r} ${e}${c?` live-start: ${g} start-offset: ${c}`:""}`),n)return this.createAsset(e,0,0,d,e.duration,n);const f=this.assetListLoader.loadAssetList(e,c);f&&(e.assetListLoader=f)}else if(!o&&r){for(let c=t;c<r;c++){const g=e.assetList[c],f=this.getAssetPlayerQueueIndex(g.identifier);(f===-1||this.playerQueue[f].destroyed)&&!g.error&&this.createAssetPlayer(e,g,c)}const d=e.assetList[t];if(d){const c=this.getAssetPlayer(d.identifier);return c&&c.loadSource(),c}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(r=>{this.hls.trigger(ue.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:r})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let n=0;n<t.length;n++)if(e===t[n].assetId)return n;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let n=0;n<e.length;n++)if(e[n].media===t)return e[n]}return null}createAsset(e,t,n,r,i,o){const l={parentIdentifier:e.identifier,identifier:cv(e,o,t),duration:i,startOffset:n,timelineStart:r,uri:o};return this.createAssetPlayer(e,l,t)}createAssetPlayer(e,t,n){const r=this.hls,i=r.userConfig;let o=i.videoPreference;const l=r.loadLevelObj||r.levels[r.currentLevel];(o||l)&&(o=nr({},o),l.videoCodec&&(o.videoCodec=l.videoCodec),l.videoRange&&(o.allowedVideoRanges=[l.videoRange]));const d=r.audioTracks[r.audioTrack],c=r.subtitleTracks[r.subtitleTrack];let g=0;if(this.primaryLive||e.appendInPlace){const pe=this.timelinePos-t.timelineStart;if(pe>1){const xe=t.duration;xe&&pe<xe&&(g=pe)}}const f=t.identifier,h=Qn(Qn({},i),{},{maxMaxBufferLength:Math.min(180,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:f,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:g,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:o,audioPreference:d||i.audioPreference,subtitlePreference:c||i.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(h.timelineOffset=t.timelineStart));const y=h.cmcd;y!=null&&y.sessionId&&y.contentId&&(h.cmcd=nr({},y,{contentId:Qa(t.uri)})),this.getAssetPlayer(f)&&this.warn(`Duplicate date range identifier ${e} and asset ${f}`);const E=new hv(this.HlsPlayerClass,h,e,t);this.playerQueue.push(E),e.assetList[n]=t;let _=!0;const L=pe=>{if(pe.live){var xe;const J=new Error(`Interstitials MUST be VOD assets ${e}`),he={fatal:!0,type:_n.OTHER_ERROR,details:lt.INTERSTITIAL_ASSET_ITEM_ERROR,error:J},Ee=((xe=this.schedule)==null?void 0:xe.findEventIndex(e.identifier))||-1;this.handleAssetItemError(he,e,Ee,n,J.message);return}const ke=pe.edge-pe.fragmentStart,Y=t.duration;(_||Y===null||ke>Y)&&(_=!1,this.log(`Interstitial asset "${f}" duration change ${Y} > ${ke}`),t.duration=ke,this.updateSchedule())};E.on(ue.LEVEL_UPDATED,(pe,{details:xe})=>L(xe)),E.on(ue.LEVEL_PTS_UPDATED,(pe,{details:xe})=>L(xe)),E.on(ue.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const K=(pe,xe)=>{const ke=this.getAssetPlayer(f);if(ke&&xe.tracks){ke.off(ue.BUFFER_CODECS,K),ke.tracks=xe.tracks;const Y=this.primaryMedia;this.bufferingAsset===ke.assetItem&&Y&&!ke.media&&this.bufferAssetPlayer(ke,Y)}};E.on(ue.BUFFER_CODECS,K);const Z=()=>{var pe;const xe=this.getAssetPlayer(f);if(this.log(`buffered to end of asset ${xe}`),!xe||!this.schedule)return;const ke=this.schedule.findEventIndex(e.identifier),Y=(pe=this.schedule.items)==null?void 0:pe[ke];this.isInterstitial(Y)&&this.advanceAssetBuffering(Y,t)};E.on(ue.BUFFERED_TO_END,Z);const ae=pe=>()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;this.shouldPlay=!0;const ke=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,ke,pe)};return E.once(ue.MEDIA_ENDED,ae(n)),E.once(ue.PLAYOUT_LIMIT_REACHED,ae(1/0)),E.on(ue.ERROR,(pe,xe)=>{if(!this.schedule)return;const ke=this.getAssetPlayer(f);if(xe.details===lt.BUFFER_STALLED_ERROR){if(ke!=null&&ke.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(xe,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${xe.error} ${e}`)}),E.on(ue.DESTROYING,()=>{if(!this.getAssetPlayer(f)||!this.schedule)return;const xe=new Error(`Asset player destroyed unexpectedly ${f}`),ke={fatal:!0,type:_n.OTHER_ERROR,details:lt.INTERSTITIAL_ASSET_ITEM_ERROR,error:xe};this.handleAssetItemError(ke,e,this.schedule.findEventIndex(e.identifier),n,xe.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Ia(t)}`),this.hls.trigger(ue.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:n,event:e,player:E}),E}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(n=>{this.clearAssetPlayer(n.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const n=this.playerQueue[t];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,t){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){const r=this.playerQueue[n];this.log(`clear ${r} toSegment: ${t&&oi(t)}`),this.transferMediaFromPlayer(r,t),this.playerQueue.splice(n,1),r.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,n,r,i){const{interstitial:o,assetItem:l,assetId:d}=e,c=o.assetList.length,g=this.playingAsset;this.endedAsset=null,this.playingAsset=l,(!g||g.identifier!==d)&&(g&&(this.clearAssetPlayer(g.identifier,n[r]),delete g.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${c} ${Ia(l)}`),this.hls.trigger(ue.INTERSTITIAL_ASSET_STARTED,{asset:l,assetListIndex:t,event:o,schedule:n.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,i)}bufferAssetPlayer(e,t){var n,r;if(!this.schedule)return;const{interstitial:i,assetItem:o}=e,l=this.schedule.findEventIndex(i.identifier),d=(n=this.schedule.items)==null?void 0:n[l];if(!d)return;e.loadSource(),this.setBufferingItem(d),this.bufferingAsset=o;const c=this.getBufferingPlayer();if(c===e)return;const g=i.appendInPlace;if(g&&c?.interstitial.appendInPlace===!1)return;const f=c?.tracks||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(g&&o!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(f&&!Ih(f,e.tracks)){const h=new Error(`Asset ${Ia(o)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(f)}')`),y={fatal:!0,type:_n.OTHER_ERROR,details:lt.INTERSTITIAL_ASSET_ITEM_ERROR,error:h},E=i.findAssetIndex(o);this.handleAssetItemError(y,i,l,E,h.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,n=this.primaryMedia;if(!t||!n)return;const r=n.currentTime,i=t.findAssetIndex(e,r),o=e.assetList[i];if(o){const l=this.getAssetPlayer(o.identifier);if(l){const d=l.currentTime||r-o.timelineStart,c=l.duration-d;if(this.warn(`Stalled at ${d} of ${d+c} in ${l} ${e} (media.currentTime: ${r})`),d&&(c/n.playbackRate<.5||l.bufferedInPlaceToEnd(n))&&l.hls){const g=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,g,i)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,n,r,i){if(e.details===lt.BUFFER_STALLED_ERROR)return;const o=t.assetList[r]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${o&&Ia(o)} ${e.error}`),!this.schedule)return;const l=o?.identifier||"",d=this.getAssetPlayerQueueIndex(l),c=this.playerQueue[d]||null,g=this.schedule.items,f=nr({},e,{fatal:!1,errorAction:wa(!0),asset:o,assetListIndex:r,event:t,schedule:g,scheduleIndex:n,player:c});if(this.hls.trigger(ue.INTERSTITIAL_ASSET_ERROR,f),!e.fatal)return;const h=this.playingAsset,y=this.bufferingAsset,E=new Error(i);if(o&&(this.clearAssetPlayer(l,null),o.error=E),!t.assetList.some(_=>!_.error))t.error=E;else for(let _=r;_<t.assetList.length;_++)this.resetAssetPlayer(t.assetList[_].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):h&&h.identifier===l?this.advanceAfterAssetEnded(t,n,r):y&&y.identifier===l&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,y)}primaryFallback(e){const t=e.timelineStart,n=this.effectivePlayingItem;let r=this.timelinePos;if(n){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${r} playing: ${oi(n)} error: ${e.error}`),r===-1&&(r=this.hls.startPosition);const o=this.updateItem(n,r);this.itemsMatch(n,o)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(r===-1){this.checkStart();return}if(!this.schedule)return;const i=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(i)}onAssetListLoaded(e,t){var n,r;const i=t.event,o=i.identifier,l=t.assetListResponse.ASSETS;if(!((n=this.schedule)!=null&&n.hasEvent(o)))return;const d=i.timelineStart,c=i.duration;let g=0;l.forEach((_,L)=>{const K=parseFloat(_.DURATION);this.createAsset(i,L,g,d+g,K,_.URI),g+=K}),i.duration=g,this.log(`Loaded asset-list with duration: ${g} (was: ${c}) ${i}`);const f=this.waitingItem,h=f?.event.identifier===o;this.updateSchedule();const y=(r=this.bufferingItem)==null?void 0:r.event;if(h){var E;const _=this.schedule.findEventIndex(o),L=(E=this.schedule.items)==null?void 0:E[_];if(L){if(!this.playingItem&&this.timelinePos>L.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==_){i.error=new Error(`Interstitial ${l.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${i}`),this.log(i.error.message),this.updateSchedule(!0),this.primaryFallback(i);return}this.setBufferingItem(L)}this.setSchedulePosition(_)}else if(y?.identifier===o){const _=i.assetList[0];if(_){const L=this.getAssetPlayer(_.identifier);if(y.appendInPlace){const K=this.primaryMedia;L&&K&&this.bufferAssetPlayer(L,K)}else L&&L.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case lt.ASSET_LIST_PARSING_ERROR:case lt.ASSET_LIST_LOAD_ERROR:case lt.ASSET_LIST_LOAD_TIMEOUT:{const n=t.interstitial;n&&(this.updateSchedule(!0),this.primaryFallback(n));break}case lt.BUFFER_STALLED_ERROR:{const n=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&n.event.appendInPlace){this.handleInPlaceStall(n.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const th=500;class yv extends ru{constructor(e,t,n){super(e,t,n,"subtitle-stream-controller",hn.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.on(ue.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(ue.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(ue.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(ue.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(ue.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.off(ue.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(ue.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(ue.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(ue.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(ue.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=Ot.IDLE,this.setInterval(th),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:n,success:r}=t;if(this.fragContextChanged(n)||(cr(n)&&(this.fragPrevious=n),this.state=Ot.IDLE),!r)return;const i=this.tracksBuffered[this.currentTrackId];if(!i)return;let o;const l=n.start;for(let c=0;c<i.length;c++)if(l>=i[c].start&&l<=i[c].end){o=i[c];break}const d=n.start+n.duration;o?o.end=d:(o={start:l,end:d},i.push(o)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:n,endOffset:r}=t;if(n===0&&r!==Number.POSITIVE_INFINITY){const i=r-1;if(i<=0)return;t.endOffsetSubtitles=Math.max(0,i),this.tracksBuffered.forEach(o=>{for(let l=0;l<o.length;){if(o[l].end<=i){o.shift();continue}else if(o[l].start<i)o[l].start=i;else break;l++}}),this.fragmentTracker.removeFragmentsInRange(n,i,hn.SUBTITLE)}}onError(e,t){const n=t.frag;n?.type===hn.SUBTITLE&&(t.details===lt.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Ot.STOPPED&&(this.state=Ot.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Rg(this.levels,t)){this.levels=t.map(n=>new es(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const r=new es(n);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,hn.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==Ot.STOPPED&&this.setInterval(th)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:r,levels:i}=this,{details:o,id:l}=t;if(!i){this.warn(`Subtitle tracks were reset while loading level ${l}`);return}const d=i[l];if(l>=i.length||!d)return;this.log(`Subtitle track ${l} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(o.live||(n=d.details)!=null&&n.live){if(o.deltaUpdateFailed)return;const f=this.mainDetails;if(!f){this.startFragRequested=!1;return}const h=f.fragments[0];if(!d.details)o.hasProgramDateTime&&f.hasProgramDateTime?(co(o,f),c=o.fragmentStart):h&&(c=h.start,Nl(o,c));else{var g;c=this.alignPlaylists(o,d.details,(g=this.levelLastLoaded)==null?void 0:g.details),c===0&&h&&(c=h.start,Nl(o,c))}f&&!this.startFragRequested&&this.setStartPosition(f,c)}d.details=o,this.levelLastLoaded=d,l===r&&(this.hls.trigger(ue.SUBTITLE_TRACK_UPDATED,{details:o,id:l,groupId:t.groupId}),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===Ot.IDLE&&(ua(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),d.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,r=t.decryptdata,i=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&r!=null&&r.key&&r.iv&&Ra(r.method)){const o=performance.now();this.decrypter.decrypt(new Uint8Array(n),r.key.buffer,r.iv.buffer,tu(r.method)).catch(l=>{throw i.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:t}),l}).then(l=>{const d=performance.now();i.trigger(ue.FRAG_DECRYPTED,{frag:t,payload:l,stats:{tstart:o,tdecrypt:d}})}).catch(l=>{this.warn(`${l.name}: ${l.message}`),this.state=Ot.IDLE})}}doTick(){if(!this.media){this.state=Ot.IDLE;return}if(this.state===Ot.IDLE){const{currentTrackId:e,levels:t}=this,n=t?.[e];if(!n||!t.length||!n.details||this.waitForLive(n))return;const{config:r}=this,i=this.getLoadPosition(),o=Dn.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],i,r.maxBufferHole),{end:l,len:d}=o,c=n.details,g=this.hls.maxBufferLength+c.levelTargetDuration;if(d>g)return;const f=c.fragments,h=f.length,y=c.edge;let E=null;const _=this.fragPrevious;if(l<y){const Z=r.maxFragLookUpTolerance,ae=l>y-Z?0:Z;E=ua(_,f,Math.max(f[0].start,l),ae),!E&&_&&_.start<f[0].start&&(E=f[0])}else E=f[h-1];if(E=this.filterReplacedPrimary(E,n.details),!E)return;const L=E.sn-c.startSN,K=f[L-1];if(K&&K.cc===E.cc&&this.fragmentTracker.getState(K)===Er.NOT_LOADED&&(E=K),this.fragmentTracker.getState(E)===Er.NOT_LOADED){const Z=this.mapToInitFragWhenRequired(E);Z&&this.loadFragment(Z,n,l)}}}loadFragment(e,t,n){cr(e)?super.loadFragment(e,t,n):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Ev(this.tracksBuffered[this.currentTrackId]||[])}}class Ev{constructor(e){this.buffered=void 0;const t=(n,r,i)=>{if(r=r>>>0,r>i-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${i})`);return e[r][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}const bv={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},$g=u=>String.fromCharCode(bv[u]||u),ui=15,Ri=100,Tv={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},vv={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Sv={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},_v={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Av=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Iv{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;Zn.log(`${this.time} [${e}] ${n}`)}}}const ia=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class Vg{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let n=0;n<t.length;n++){const r=t[n];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class xv{constructor(){this.uchar=" ",this.penState=new Vg}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class wv{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Vg,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Ri;t++)this.chars.push(new xv);this.logger=e}equals(e){for(let t=0;t<Ri;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Ri;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Ri;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Ri&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Ri)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=$g(e);if(this.pos>=Ri){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<Ri;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let n=0;n<Ri;n++){const r=this.chars[n].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class gl{constructor(e){this.rows=[],this.currRow=ui-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<ui;t++)this.rows.push(new wv(e));this.logger=e}reset(){for(let e=0;e<ui;e++)this.rows[e].clear();this.currRow=ui-1}equals(e){let t=!0;for(let n=0;n<ui;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<ui;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<ui;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+ir(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let l=0;l<ui;l++)this.rows[l].clear();const i=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const l=o.rows[i].cueStartTime,d=this.logger.time;if(l!==null&&d!==null&&l<d)for(let c=0;c<this.nrRollUpRows;c++)this.rows[t-this.nrRollUpRows+c+1].copy(o.rows[i+c])}}this.currRow=t;const n=this.rows[this.currRow];if(e.indent!==null){const i=e.indent,o=Math.max(i-1,0);n.setCursor(e.indent),e.color=n.chars[o].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+ir(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let n="",r=-1;for(let i=0;i<ui;i++){const o=this.rows[i].getTextString();o&&(r=i+1,e?t.push("Row "+r+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
|
|
30
|
+
`)),n}getTextAndFormat(){return this.rows}}class nh{constructor(e,t,n){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new gl(n),this.nonDisplayedMemory=new gl(n),this.lastOutputScreen=new gl(n),this.currRollUpRow=this.displayedMemory.rows[ui-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[ui-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const n=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[n]}this.logger.log(2,"MIDROW: "+ir(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class rh{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=kv(),this.logger=void 0;const r=this.logger=new Iv;this.channels=[null,new nh(e,t,r),new nh(e+1,n,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const r=t[n]&127,i=t[n+1]&127;let o=!1,l=null;if(r===0&&i===0)continue;this.logger.log(3,()=>"["+ia([t[n],t[n+1]])+"] -> ("+ia([r,i])+")");const d=this.cmdHistory;if(r>=16&&r<=31){if(Rv(r,i,d)){qs(null,null,d),this.logger.log(3,()=>"Repeated command ("+ia([r,i])+") is dropped");continue}qs(r,i,this.cmdHistory),o=this.parseCmd(r,i),o||(o=this.parseMidrow(r,i)),o||(o=this.parsePAC(r,i)),o||(o=this.parseBackgroundAttributes(r,i))}else qs(null,null,d);if(!o&&(l=this.parseChars(r,i),l)){const g=this.currentChannel;g&&g>0?this.channels[g].insertChars(l):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!o&&!l&&this.logger.log(2,()=>"Couldn't parse cleaned data "+ia([r,i])+" orig: "+ia([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=33&&t<=35;if(!(n||r))return!1;const i=e===20||e===21||e===23?1:2,o=this.channels[i];return e===20||e===21||e===28||e===29?t===32?o.ccRCL():t===33?o.ccBS():t===34?o.ccAOF():t===35?o.ccAON():t===36?o.ccDER():t===37?o.ccRU(2):t===38?o.ccRU(3):t===39?o.ccRU(4):t===40?o.ccFON():t===41?o.ccRDC():t===42?o.ccTR():t===43?o.ccRTD():t===44?o.ccEDM():t===45?o.ccCR():t===46?o.ccENM():t===47&&o.ccEOC():o.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[n];return r?(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+ia([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,i=(e===16||e===24)&&t>=64&&t<=95;if(!(r||i))return!1;const o=e<=23?1:2;t>=64&&t<=95?n=o===1?Tv[e]:Sv[e]:n=o===1?vv[e]:_v[e];const l=this.channels[o];return l?(l.setPAC(this.interpretPAC(n,t)),this.currentChannel=o,!0):!1}interpretPAC(e,t){let n;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,r.underline=(n&1)===1,n<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((n-16)/2)*4,r}parseChars(e,t){let n,r=null,i=null;if(e>=25?(n=2,i=e-8):(n=1,i=e),i>=17&&i<=19){let o;i===17?o=t+80:i===18?o=t+112:o=t+144,this.logger.log(2,()=>"Special char '"+$g(o)+"' in channel "+n),r=[o]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+ia(r).join(",")),r}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(n||r))return!1;let i;const o={};e===16||e===24?(i=Math.floor((t-32)/2),o.background=Av[i],t%2===1&&(o.background=o.background+"_semi")):t===45?o.background="transparent":(o.foreground="black",t===47&&(o.underline=!0));const l=e<=23?1:2;return this.channels[l].setBkgData(o),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}qs(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function qs(u,e,t){t.a=u,t.b=e}function Rv(u,e,t){return t.a===u&&t.b===e}function kv(){return{a:null,b:null}}var mu=(function(){if(uo!=null&&uo.VTTCue)return self.VTTCue;const u=["","lr","rl"],e=["start","middle","end","left","right"];function t(l,d){if(typeof d!="string"||!Array.isArray(l))return!1;const c=d.toLowerCase();return~l.indexOf(c)?c:!1}function n(l){return t(u,l)}function r(l){return t(e,l)}function i(l,...d){let c=1;for(;c<arguments.length;c++){const g=arguments[c];for(const f in g)l[f]=g[f]}return l}function o(l,d,c){const g=this,f={enumerable:!0};g.hasBeenReset=!1;let h="",y=!1,E=l,_=d,L=c,K=null,Z="",ae=!0,pe="auto",xe="start",ke=50,Y="middle",J=50,he="middle";Object.defineProperty(g,"id",i({},f,{get:function(){return h},set:function(Ee){h=""+Ee}})),Object.defineProperty(g,"pauseOnExit",i({},f,{get:function(){return y},set:function(Ee){y=!!Ee}})),Object.defineProperty(g,"startTime",i({},f,{get:function(){return E},set:function(Ee){if(typeof Ee!="number")throw new TypeError("Start time must be set to a number.");E=Ee,this.hasBeenReset=!0}})),Object.defineProperty(g,"endTime",i({},f,{get:function(){return _},set:function(Ee){if(typeof Ee!="number")throw new TypeError("End time must be set to a number.");_=Ee,this.hasBeenReset=!0}})),Object.defineProperty(g,"text",i({},f,{get:function(){return L},set:function(Ee){L=""+Ee,this.hasBeenReset=!0}})),Object.defineProperty(g,"region",i({},f,{get:function(){return K},set:function(Ee){K=Ee,this.hasBeenReset=!0}})),Object.defineProperty(g,"vertical",i({},f,{get:function(){return Z},set:function(Ee){const Le=n(Ee);if(Le===!1)throw new SyntaxError("An invalid or illegal string was specified.");Z=Le,this.hasBeenReset=!0}})),Object.defineProperty(g,"snapToLines",i({},f,{get:function(){return ae},set:function(Ee){ae=!!Ee,this.hasBeenReset=!0}})),Object.defineProperty(g,"line",i({},f,{get:function(){return pe},set:function(Ee){if(typeof Ee!="number"&&Ee!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");pe=Ee,this.hasBeenReset=!0}})),Object.defineProperty(g,"lineAlign",i({},f,{get:function(){return xe},set:function(Ee){const Le=r(Ee);if(!Le)throw new SyntaxError("An invalid or illegal string was specified.");xe=Le,this.hasBeenReset=!0}})),Object.defineProperty(g,"position",i({},f,{get:function(){return ke},set:function(Ee){if(Ee<0||Ee>100)throw new Error("Position must be between 0 and 100.");ke=Ee,this.hasBeenReset=!0}})),Object.defineProperty(g,"positionAlign",i({},f,{get:function(){return Y},set:function(Ee){const Le=r(Ee);if(!Le)throw new SyntaxError("An invalid or illegal string was specified.");Y=Le,this.hasBeenReset=!0}})),Object.defineProperty(g,"size",i({},f,{get:function(){return J},set:function(Ee){if(Ee<0||Ee>100)throw new Error("Size must be between 0 and 100.");J=Ee,this.hasBeenReset=!0}})),Object.defineProperty(g,"align",i({},f,{get:function(){return he},set:function(Ee){const Le=r(Ee);if(!Le)throw new SyntaxError("An invalid or illegal string was specified.");he=Le,this.hasBeenReset=!0}})),g.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o})();class Cv{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Hg(u){function e(n,r,i,o){return(n|0)*3600+(r|0)*60+(i|0)+parseFloat(o||0)}const t=u.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class Lv{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let r=0;r<n.length;++r)if(t===n[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function Kg(u,e,t,n){const r=n?u.split(n):[u];for(const i in r){if(typeof r[i]!="string")continue;const o=r[i].split(t);if(o.length!==2)continue;const l=o[0],d=o[1];e(l,d)}}const ql=new mu(0,0,""),Gs=ql.align==="middle"?"middle":"center";function Dv(u,e,t){const n=u;function r(){const l=Hg(u);if(l===null)throw new Error("Malformed timestamp: "+n);return u=u.replace(/^[^\sa-zA-Z-]+/,""),l}function i(l,d){const c=new Lv;Kg(l,function(h,y){let E;switch(h){case"region":for(let _=t.length-1;_>=0;_--)if(t[_].id===y){c.set(h,t[_].region);break}break;case"vertical":c.alt(h,y,["rl","lr"]);break;case"line":E=y.split(","),c.integer(h,E[0]),c.percent(h,E[0])&&c.set("snapToLines",!1),c.alt(h,E[0],["auto"]),E.length===2&&c.alt("lineAlign",E[1],["start",Gs,"end"]);break;case"position":E=y.split(","),c.percent(h,E[0]),E.length===2&&c.alt("positionAlign",E[1],["start",Gs,"end","line-left","line-right","auto"]);break;case"size":c.percent(h,y);break;case"align":c.alt(h,y,["start",Gs,"end","left","right"]);break}},/:/,/\s/),d.region=c.get("region",null),d.vertical=c.get("vertical","");let g=c.get("line","auto");g==="auto"&&ql.line===-1&&(g=-1),d.line=g,d.lineAlign=c.get("lineAlign","start"),d.snapToLines=c.get("snapToLines",!0),d.size=c.get("size",100),d.align=c.get("align",Gs);let f=c.get("position","auto");f==="auto"&&ql.position===50&&(f=d.align==="start"||d.align==="left"?0:d.align==="end"||d.align==="right"?100:50),d.position=f}function o(){u=u.replace(/^\s+/,"")}if(o(),e.startTime=r(),o(),u.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);u=u.slice(3),o(),e.endTime=r(),o(),i(u,e)}function Yg(u){return u.replace(/<br(?: \/)?>/gi,`
|
|
31
|
+
`)}class Pv{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Cv,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function n(){let i=t.buffer,o=0;for(i=Yg(i);o<i.length&&i[o]!=="\r"&&i[o]!==`
|
|
32
|
+
`;)++o;const l=i.slice(0,o);return i[o]==="\r"&&++o,i[o]===`
|
|
33
|
+
`&&++o,t.buffer=i.slice(o),l}function r(i){Kg(i,function(o,l){},/:/)}try{let i="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;i=n();const l=i.match(/^()?WEBVTT([ \t].*)?$/);if(!(l!=null&&l[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let o=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(o?o=!1:i=n(),t.state){case"HEADER":/:/.test(i)?r(i):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new mu(0,0,""),t.state="CUE",i.indexOf("-->")===-1){t.cue.id=i;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Dv(i,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const l=i.indexOf("-->")!==-1;if(!i||l&&(o=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
|
|
34
|
+
`),t.cue.text+=i}continue;case"BADCUE":i||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
|
|
35
|
+
|
|
36
|
+
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const Nv=/\r\n|\n\r|\n|\r/g,ml=function(e,t,n=0){return e.slice(n,n+t.length)===t},Mv=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),i=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!on(t)||!on(n)||!on(r)||!on(i))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*r,t+=3600*1e3*i,t};function pu(u,e,t){return Qa(u.toString())+Qa(e.toString())+Qa(t)}const Ov=function(e,t,n){let r=e[t],i=e[r.prevCC];if(!i||!i.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(o=i)!=null&&o.new;){var o;e.ccOffset+=r.start-i.start,r.new=!1,r=i,i=e[r.prevCC]}e.presentationOffset=n};function Fv(u,e,t,n,r,i,o){const l=new Pv,d=qr(new Uint8Array(u)).trim().replace(Nv,`
|
|
37
|
+
`).split(`
|
|
38
|
+
`),c=[],g=e?G0(e.baseTime,e.timescale):0;let f="00:00.000",h=0,y=0,E,_=!0;l.oncue=function(L){const K=t[n];let Z=t.ccOffset;const ae=(h-g)/9e4;if(K!=null&&K.new&&(y!==void 0?Z=t.ccOffset=K.start:Ov(t,n,ae)),ae){if(!e){E=new Error("Missing initPTS for VTT MPEGTS");return}Z=ae-t.presentationOffset}const pe=L.endTime-L.startTime,xe=Br((L.startTime+Z-y)*9e4,r*9e4)/9e4;L.startTime=Math.max(xe,0),L.endTime=Math.max(xe+pe,0);const ke=L.text.trim();L.text=decodeURIComponent(encodeURIComponent(ke)),L.id||(L.id=pu(L.startTime,L.endTime,ke)),L.endTime>0&&c.push(L)},l.onparsingerror=function(L){E=L},l.onflush=function(){if(E){o(E);return}i(c)},d.forEach(L=>{if(_)if(ml(L,"X-TIMESTAMP-MAP=")){_=!1,L.slice(16).split(",").forEach(K=>{ml(K,"LOCAL:")?f=K.slice(6):ml(K,"MPEGTS:")&&(h=parseInt(K.slice(7)))});try{y=Mv(f)/1e3}catch(K){E=K}return}else L===""&&(_=!1);l.parse(L+`
|
|
39
|
+
`)}),l.flush()}const pl="stpp.ttml.im1t",Wg=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Xg=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Uv={left:"start",center:"center",right:"end",start:"start",end:"end"};function ih(u,e,t,n){const r=On(new Uint8Array(u),["mdat"]);if(r.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const i=r.map(l=>qr(l)),o=q0(e.baseTime,1,e.timescale);try{i.forEach(l=>t(zv(l,o)))}catch(l){n(l)}}function zv(u,e){const r=new DOMParser().parseFromString(u,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(i).reduce((f,h)=>(f[h]=r.getAttribute(`ttp:${h}`)||i[h],f),{}),l=r.getAttribute("xml:space")!=="preserve",d=ah(yl(r,"styling","style")),c=ah(yl(r,"layout","region")),g=yl(r,"body","[begin]");return[].map.call(g,f=>{const h=Qg(f,l);if(!h||!f.hasAttribute("begin"))return null;const y=bl(f.getAttribute("begin"),o),E=bl(f.getAttribute("dur"),o);let _=bl(f.getAttribute("end"),o);if(y===null)throw sh(f);if(_===null){if(E===null)throw sh(f);_=y+E}const L=new mu(y-e,_-e,h);L.id=pu(L.startTime,L.endTime,L.text);const K=c[f.getAttribute("region")],Z=d[f.getAttribute("style")],ae=Bv(K,Z,d),{textAlign:pe}=ae;if(pe){const xe=Uv[pe];xe&&(L.lineAlign=xe),L.align=pe}return nr(L,ae),L}).filter(f=>f!==null)}function yl(u,e,t){const n=u.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function ah(u){return u.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function Qg(u,e){return[].slice.call(u.childNodes).reduce((t,n,r)=>{var i;return n.nodeName==="br"&&r?t+`
|
|
40
|
+
`:(i=n.childNodes)!=null&&i.length?Qg(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function Bv(u,e,t){const n="http://www.w3.org/ns/ttml#styling";let r=null;const i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=u!=null&&u.hasAttribute("style")?u.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(r=t[o]),i.reduce((l,d)=>{const c=El(e,n,d)||El(u,n,d)||El(r,n,d);return c&&(l[d]=c),l},{})}function El(u,e,t){return u&&u.hasAttributeNS(e,t)?u.getAttributeNS(e,t):null}function sh(u){return new Error(`Could not parse ttml timestamp ${u}`)}function bl(u,e){if(!u)return null;let t=Hg(u);return t===null&&(Wg.test(u)?t=jv(u,e):Xg.test(u)&&(t=qv(u,e))),t}function jv(u,e){const t=Wg.exec(u),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function qv(u,e){const t=Xg.exec(u),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class $s{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class Gv{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=lh(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(ue.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(ue.FRAG_LOADING,this.onFragLoading,this),e.on(ue.FRAG_LOADED,this.onFragLoaded,this),e.on(ue.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(ue.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(ue.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(ue.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(ue.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(ue.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(ue.FRAG_LOADING,this.onFragLoading,this),e.off(ue.FRAG_LOADED,this.onFragLoaded,this),e.off(ue.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(ue.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(ue.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(ue.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new $s(this,"textTrack1"),t=new $s(this,"textTrack2"),n=new $s(this,"textTrack3"),r=new $s(this,"textTrack4");this.cea608Parser1=new rh(1,e,t),this.cea608Parser2=new rh(3,n,r)}addCues(e,t,n,r,i){let o=!1;for(let l=i.length;l--;){const d=i[l],c=$v(d[0],d[1],t,n);if(c>=0&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],n),o=!0,c/(n-t)>.5))return}if(o||i.push([t,n]),this.config.renderTextTracksNatively){const l=this.captionsTracks[e];this.Cues.newCue(l,t,n,r)}else{const l=this.Cues.newCue(null,t,n,r);this.hls.trigger(ue.CUES_PARSED,{type:"captions",cues:l,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:r,timescale:i,trackId:o}){const{unparsedVttFrags:l}=this;n===hn.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:i,trackId:o}),l.length&&(this.unparsedVttFrags=[],l.forEach(d=>{this.initPTS[d.frag.cc]?this.onFragLoaded(ue.FRAG_LOADED,d):this.hls.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let r=0;r<n.textTracks.length;r++){const i=n.textTracks[r];if(oh(i,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return i}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:n,media:r}=this,{label:i,languageCode:o}=t[e],l=this.getExistingTrack(i,o);if(l)n[e]=l,xa(n[e]),jg(n[e],r);else{const d=this.createTextTrack("captions",i,o);d&&(d[e]=!0,n[e]=d)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,r={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(ue.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,n){const r=this.media;if(r)return r.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const n=!!t.transferMedia;if(this.media=null,n)return;const{captionsTracks:r}=this;Object.keys(r).forEach(i=>{xa(r[i]),delete r[i]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=lh(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let n=0;n<t.length;n++)xa(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],r=n.some(i=>i.textCodec===pl);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(Rg(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const o=this.media,l=o?Js(o.textTracks):null;if(this.tracks.forEach((d,c)=>{let g;if(l){let f=null;for(let h=0;h<l.length;h++)if(l[h]&&oh(l[h],d)){f=l[h],l[h]=null;break}f&&(g=f)}if(g)xa(g);else{const f=Zg(d);g=this.createTextTrack(f,d.name,d.lang),g&&(g.mode="disabled")}g&&this.textTracks.push(g)}),l!=null&&l.length){const d=l.filter(c=>c!==null).map(c=>c.label);d.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${d.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(l=>({label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}));this.hls.trigger(ue.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const r=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!r)return;const i=`textTrack${r[1]}`,o=this.captionsProperties[i];o&&(o.label=n.name,n.lang&&(o.languageCode=n.lang),o.media=n)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===hn.MAIN){var n,r;const{cea608Parser1:i,cea608Parser2:o,lastSn:l}=this,{cc:d,sn:c}=t.frag,g=(n=(r=t.part)==null?void 0:r.index)!=null?n:-1;i&&o&&(c!==l+1||c===l&&g!==this.lastPartIndex+1||d!==this.lastCc)&&(i.reset(),o.reset()),this.lastCc=d,this.lastSn=c,this.lastPartIndex=g}}onFragLoaded(e,t){const{frag:n,payload:r}=t;if(n.type===hn.SUBTITLE)if(r.byteLength){const i=n.decryptdata,o="stats"in t;if(i==null||!i.encrypted||o){const l=this.tracks[n.level],d=this.vttCCs;d[n.cc]||(d[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),l&&l.textCodec===pl?this._parseIMSC1(n,r):this._parseVTTs(t)}}else this.hls.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;ih(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),n.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{n.logger.log(`Failed to parse IMSC1: ${r}`),n.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:n,payload:r}=e,{initPTS:i,unparsedVttFrags:o}=this,l=i.length-1;if(!i[n.cc]&&l===-1){o.push(e);return}const d=this.hls,c=(t=n.initSegment)!=null&&t.data?Wr(n.initSegment.data,new Uint8Array(r)).buffer:r;Fv(c,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,g=>{this._appendCues(g,n.level),d.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},g=>{const f=g.message==="Missing initPTS for VTT MPEGTS";f?o.push(e):this._fallbackToIMSC1(n,r),d.logger.log(`Failed to parse VTT cue: ${g}`),!(f&&l>n.cc)&&d.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:g})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||ih(t,this.initPTS[e.cc],()=>{n.textCodec=pl,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(i=>qg(r,i))}else{const r=this.tracks[t];if(!r)return;const i=r.default?"default":"subtitles"+t;n.trigger(ue.CUES_PARSED,{type:"subtitles",cues:e,track:i})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===hn.SUBTITLE&&this.onFragLoaded(ue.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:n,samples:r}=t;if(!(n.type===hn.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let i=0;i<r.length;i++){const o=r[i].bytes;if(o){this.cea608Parser1||this.initCea608Parsers();const l=this.extractCea608Data(o);this.cea608Parser1.addData(r[i].pts,l[0]),this.cea608Parser2.addData(r[i].pts,l[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:r,type:i}){const{media:o}=this;if(!(!o||o.currentTime<n)){if(!i||i==="video"){const{captionsTracks:l}=this;Object.keys(l).forEach(d=>jl(l[d],t,n))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:l}=this;Object.keys(l).forEach(d=>jl(l[d],t,r))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let r=2;for(let i=0;i<n;i++){const o=e[r++],l=127&e[r++],d=127&e[r++];if(l===0&&d===0)continue;if((4&o)!==0){const g=3&o;(g===0||g===1)&&(t[g].push(l),t[g].push(d))}}return t}}function Zg(u){return u.characteristics&&/transcribes-spoken-dialog/gi.test(u.characteristics)&&/describes-music-and-sound/gi.test(u.characteristics)?"captions":"subtitles"}function oh(u,e){return!!u&&u.kind===Zg(e)&&Fl(e,u)}function $v(u,e,t,n){return Math.min(e,n)-Math.max(u,t)}function lh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const Vv=/\s/,Hv={newCue(u,e,t,n){const r=[];let i,o,l,d,c;const g=self.VTTCue||self.TextTrackCue;for(let h=0;h<n.rows.length;h++)if(i=n.rows[h],l=!0,d=0,c="",!i.isEmpty()){var f;for(let _=0;_<i.chars.length;_++)Vv.test(i.chars[_].uchar)&&l?d++:(c+=i.chars[_].uchar,l=!1);i.cueStartTime=e,e===t&&(t+=1e-4),d>=16?d--:d++;const y=Yg(c.trim()),E=pu(e,t,y);u!=null&&(f=u.cues)!=null&&f.getCueById(E)||(o=new g(e,t,y),o.id=E,o.line=h+1,o.align="left",o.position=10+Math.min(80,Math.floor(d*8/32)*10),r.push(o))}return u&&r.length&&(r.sort((h,y)=>h.line==="auto"||y.line==="auto"?0:h.line>8&&y.line>8?y.line-h.line:h.line-y.line),r.forEach(h=>qg(u,h))),r}};function Kv(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const Yv=/(\d+)-(\d+)\/(\d+)/;class uh{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Zv,this.controller=new self.AbortController,this.stats=new Yl}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,n){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const i=Wv(e,this.controller.signal),o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:d,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,i),self.clearTimeout(this.requestTimeout),t.timeout=d&&on(d)?d:c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(rs(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(f=>{var h;this.response=this.loader=f;const y=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},c-(y-r.loading.start)),!f.ok){const{status:_,statusText:L}=f;throw new Jv(L||"fetch, bad network response",_,f)}r.loading.first=y,r.total=Qv(f.headers)||r.total;const E=(h=this.callbacks)==null?void 0:h.onProgress;return E&&on(t.highWaterMark)?this.loadProgressively(f,r,e,t.highWaterMark,E):o?f.arrayBuffer():e.responseType==="json"?f.json():f.text()}).then(f=>{var h,y;const E=this.response;if(!E)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const _=f[l];_&&(r.loaded=r.total=_);const L={url:E.url,data:f,code:E.status},K=(h=this.callbacks)==null?void 0:h.onProgress;K&&!on(t.highWaterMark)&&K(r,e,f,E),(y=this.callbacks)==null||y.onSuccess(L,r,e,E)}).catch(f=>{var h;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const y=f&&f.code||0,E=f?f.message:null;(h=this.callbacks)==null||h.onError({code:y,text:E},e,f?f.details:null,r)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,n,r=0,i){const o=new lg,l=e.body.getReader(),d=()=>l.read().then(c=>{if(c.done)return o.dataLength&&i(t,n,o.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const g=c.value,f=g.length;return t.loaded+=f,f<r||o.dataLength?(o.push(g),o.dataLength>=r&&i(t,n,o.flush().buffer,e)):i(t,n,g.buffer,e),d()}).catch(()=>Promise.reject());return d()}}function Wv(u,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(nr({},u.headers))};return u.rangeEnd&&t.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),t}function Xv(u){const e=Yv.exec(u);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Qv(u){const e=u.get("Content-Range");if(e){const n=Xv(e);if(on(n))return n}const t=u.get("Content-Length");if(t)return parseInt(t)}function Zv(u,e){return new self.Request(u.url,e)}class Jv extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const eS=/^age:\s*[\d.]+\s*$/im;class Jg{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Yl,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,n){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const i=this.xhrSetup;i?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return i(n,t.url)}).catch(o=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),i(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(o=>{var l;(l=this.callbacks)==null||l.onError({code:n.status,text:o.message},t,n,r)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:o}=n.loadPolicy;if(r)for(const l in r)e.setRequestHeader(l,r[l]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),n.timeout=i&&on(i)?i:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const r=t.readyState,i=this.config;if(!n.aborted&&r>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const c=t.status,g=t.responseType==="text"?t.responseText:null;if(c>=200&&c<300){const E=g??t.response;if(E!=null){var o,l;n.loading.end=Math.max(self.performance.now(),n.loading.first);const _=t.responseType==="arraybuffer"?E.byteLength:E.length;n.loaded=n.total=_,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);const L=(o=this.callbacks)==null?void 0:o.onProgress;L&&L(n,e,E,t);const K={url:t.responseURL,data:E,code:c};(l=this.callbacks)==null||l.onSuccess(K,n,e,t);return}}const f=i.loadPolicy.errorRetry,h=n.retry,y={url:e.url,data:void 0,code:c};if(oo(f,h,!1,y))this.retry(f);else{var d;Zn.error(`${c} while loading ${e.url}`),(d=this.callbacks)==null||d.onError({code:c,text:t.statusText},e,t,n)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(oo(e,t,!0))this.retry(e);else{var n;Zn.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=Zl(e,n.retry),n.retry++,Zn.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${n.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&eS.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const tS={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},nS=Qn(Qn({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:Jg,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:gb,bufferController:iT,capLevelController:fu,errorController:bb,fpsController:av,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Qh,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:tS},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},rS()),{},{subtitleStreamController:yv,subtitleTrackController:lv,timelineController:Gv,audioStreamController:eT,audioTrackController:tT,emeController:ka,cmcdController:tv,contentSteeringController:rv,interstitialsController:pv});function rS(){return{cueHandler:Hv,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function iS(u,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const n=Gl(u),r=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(o=>{const l=`${o==="level"?"playlist":o}LoadPolicy`,d=e[l]===void 0,c=[];i.forEach(g=>{const f=`${o}Loading${g}`,h=e[f];if(h!==void 0&&d){c.push(f);const y=n[l].default;switch(e[l]={default:y},g){case"TimeOut":y.maxLoadTimeMs=h,y.maxTimeToFirstByteMs=h;break;case"MaxRetry":y.errorRetry.maxNumRetry=h,y.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":y.errorRetry.retryDelayMs=h,y.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":y.errorRetry.maxRetryDelayMs=h,y.timeoutRetry.maxRetryDelayMs=h;break}}}),c.length&&t.warn(`hls.js config: "${c.join('", "')}" setting(s) are deprecated, use "${l}": ${ir(e[l])}`)}),Qn(Qn({},n),e)}function Gl(u){return u&&typeof u=="object"?Array.isArray(u)?u.map(Gl):Object.keys(u).reduce((e,t)=>(e[t]=Gl(u[t]),e),{}):u}function aS(u,e){const t=u.loader;t!==uh&&t!==Jg?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1):Kv()&&(u.loader=uh,u.progressive=!0,u.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const eo=2,sS=.1,oS=.05,lS=100;class uS extends Hh{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var n;(n=this.media)!=null&&n.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var n;this.ended=((n=this.media)==null?void 0:n.currentTime)||1,this.hls.trigger(ue.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(lS),this.mediaSource=t.mediaSource;const n=this.media=t.media;Cr(n,"playing",this.onMediaPlaying),Cr(n,"waiting",this.onMediaWaiting),Cr(n,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:n}=this;n&&(Or(n,"playing",this.onMediaPlaying),Or(n,"waiting",this.onMediaWaiting),Or(n,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var n,r;const i=(n=this.hls)==null?void 0:n.config;if(!i)return;const o=this.media;if(!o)return;const{seeking:l}=o,d=this.seeking&&!l,c=!this.seeking&&l,g=o.paused&&!l||o.ended||o.playbackRate===0;if(this.seeking=l,e!==t){t&&(this.ended=0),this.moved=!0,l||(this.nudgeRetry=0,i.nudgeOnVideoHole&&!g&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(c||d){d&&this.stallResolved(e);return}if(g){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&o.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(ue.MEDIA_ENDED,{stalled:!1}));return}if(!Dn.getBuffered(o).length){this.nudgeRetry=0;return}const f=Dn.bufferInfo(o,e,0),h=f.nextStart||0,y=this.fragmentTracker;if(l&&y&&this.hls){const ke=ch(this.hls.inFlightFragments,e),Y=f.len>eo,J=!h||ke||h-e>eo&&!y.getPartialFragment(e);if(Y||J)return;this.moved=!1}const E=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&y){if(!(f.len>0)&&!h)return;const Y=Math.max(h,f.start||0)-e,he=!!(E!=null&&E.live)?E.targetduration*2:eo,Ee=Vs(e,y);if(Y>0&&(Y<=he||Ee)){o.paused||this._trySkipBufferHole(Ee);return}}const _=i.detectStallWithCurrentTimeMs,L=self.performance.now(),K=this.waiting;let Z=this.stalled;if(Z===null)if(K>0&&L-K<_)Z=this.stalled=K;else{this.stalled=L;return}const ae=L-Z;if(!l&&(ae>=_||K)&&this.hls){var pe;if(((pe=this.mediaSource)==null?void 0:pe.readyState)==="ended"&&!(E!=null&&E.live)&&Math.abs(e-(E?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(ue.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(f),!this.media||!this.hls)return}const xe=Dn.bufferInfo(o,e,i.maxBufferHole);this._tryFixBufferStall(xe,ae,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const n=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(ue.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var n;const r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(n=this.buffered.audio)!=null&&n.length&&r&&r.length>1&&e>r.end(0)){const i=Dn.bufferedInfo(Dn.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&t>=i.start){const o=Dn.timeRangesToArray(r),l=Dn.bufferedInfo(o,t,0).bufferedIndex;if(l>-1&&l<o.length-1){const d=Dn.bufferedInfo(o,e,0).bufferedIndex,c=o[l].end,g=o[l+1].start;if((d===-1||d>l)&&g-c<1&&e-c<2){const f=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${c} -> ${g} buffered index: ${d}`);this.warn(f.message),this.media.currentTime+=1e-6;let h=Vs(e,this.fragmentTracker);h&&"fragment"in h?h=h.fragment:h||(h=void 0);const y=Dn.bufferInfo(this.media,e,0);this.hls.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:f,reason:f.message,frag:h,buffer:y.len,bufferInfo:y})}}}}}_tryFixBufferStall(e,t,n){var r,i;const{fragmentTracker:o,media:l}=this,d=(r=this.hls)==null?void 0:r.config;if(!l||!o||!d)return;const c=(i=this.hls)==null?void 0:i.latestLevelDetails,g=Vs(n,o);if((g||c!=null&&c.live&&n<c.fragmentStart)&&(this._trySkipBufferHole(g)||!this.media))return;const f=e.buffered,h=this.adjacentTraversal(e,n);(f&&f.length>1&&e.len>d.maxBufferHole||e.nextStart&&(e.nextStart-n<d.maxBufferHole||h))&&(t>d.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const n=this.fragmentTracker,r=e.nextStart;if(n&&r){const i=n.getFragAtPos(t,hn.MAIN),o=n.getFragAtPos(r,hn.MAIN);if(i&&o)return o.sn-i.sn<2}return!1}_reportStall(e){const{hls:t,media:n,stallReported:r,stalled:i}=this;if(!r&&i!==null&&n&&t){this.stallReported=!0;const o=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${ir(e)})`);this.warn(o.message),t.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.BUFFER_STALLED_ERROR,fatal:!1,error:o,buffer:e.len,bufferInfo:e,stalled:{start:i}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:n,media:r}=this,i=(t=this.hls)==null?void 0:t.config;if(!r||!n||!i)return 0;const o=r.currentTime,l=Dn.bufferInfo(r,o,0),d=o<l.start?l.start:l.nextStart;if(d&&this.hls){const g=l.len<=i.maxBufferHole,f=l.len>0&&l.len<1&&r.readyState<3,h=d-o;if(h>0&&(g||f)){if(h>i.maxBufferHole){let E=!1;if(o===0){const _=n.getAppendedFrag(0,hn.MAIN);_&&d<_.end&&(E=!0)}if(!E&&e){var c;if(!((c=this.hls.loadLevelObj)!=null&&c.details)||ch(this.hls.inFlightFragments,d))return 0;let L=!1,K=e.end;for(;K<d;){const Z=Vs(K,n);if(Z)K+=Z.duration;else{L=!0;break}}if(L)return 0}}const y=Math.max(d+oS,o+sS);if(this.warn(`skipping hole, adjusting currentTime from ${o} to ${y}`),this.moved=!0,r.currentTime=y,!(e!=null&&e.gap)){const E=new Error(`fragment loaded with buffer holes, seeking from ${o} to ${y}`),_={type:_n.MEDIA_ERROR,details:lt.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:E,reason:E.message,buffer:l.len,bufferInfo:l};e&&("fragment"in e?_.part=e:_.frag=e),this.hls.trigger(ue.ERROR,_)}return y}}return 0}_tryNudgeBuffer(e){const{hls:t,media:n,nudgeRetry:r}=this,i=t?.config;if(!n||!i)return 0;const o=n.currentTime;if(this.nudgeRetry++,r<i.nudgeMaxRetry){const l=o+(r+1)*i.nudgeOffset,d=new Error(`Nudging 'currentTime' from ${o} to ${l}`);this.warn(d.message),n.currentTime=l,t.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.BUFFER_NUDGE_ON_STALL,error:d,fatal:!1,buffer:e.len,bufferInfo:e})}else{const l=new Error(`Playhead still not moving while enough data buffered @${o} after ${i.nudgeMaxRetry} nudges`);this.error(l.message),t.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.BUFFER_STALLED_ERROR,error:l,fatal:!0,buffer:e.len,bufferInfo:e})}}}function ch(u,e){const t=dh(u.main);if(t&&t.start<=e)return t;const n=dh(u.audio);return n&&n.start<=e?n:null}function dh(u){if(!u)return null;switch(u.state){case Ot.IDLE:case Ot.STOPPED:case Ot.ENDED:case Ot.ERROR:return null}return u.frag}function Vs(u,e){return e.getAppendedFrag(u,hn.MAIN)||e.getPartialFragment(u)}const cS=.25;function $l(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Tl(u,e,t,n,r){let i=new u(e,t,"");try{i.value=n,r&&(i.type=r)}catch{i=new u(e,t,ir(r?Qn({type:r},n):n))}return i}const Hs=(()=>{const u=$l();try{u&&new u(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class dS{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(ue.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(ue.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(ue.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var n;this.media=t.media,((n=t.overrides)==null?void 0:n.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&xa(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const n=e[t];if(n.kind==="metadata"&&n.label==="id3")return jg(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:n,enableID3MetadataCues:r}=this.hls.config;if(!n&&!r)return;const{samples:i}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=$l();if(o)for(let l=0;l<i.length;l++){const d=i[l].type;if(d===jr.emsg&&!n||!r)continue;const c=mg(i[l].data),g=i[l].pts;let f=g+i[l].duration;f>Hs&&(f=Hs),f-g<=0&&(f=g+cS);for(let y=0;y<c.length;y++){const E=c[y];if(!pg(E)){this.updateId3CueEnds(g,d);const _=Tl(o,g,f,E,d);_&&this.id3Track.addCue(_)}}}}updateId3CueEnds(e,t){var n;const r=(n=this.id3Track)==null?void 0:n.cues;if(r)for(let i=r.length;i--;){const o=r[i];o.type===t&&o.startTime<e&&o.endTime===Hs&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:r}){const{id3Track:i,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:l,enableID3MetadataCues:d}}=o;if(i&&(l||d)){let c;r==="audio"?c=g=>g.type===jr.audioId3&&d:r==="video"?c=g=>g.type===jr.emsg&&l:c=g=>g.type===jr.audioId3&&d||g.type===jr.emsg&&l,jl(i,t,n,c)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:n,timelineOffset:r,enableDateRangeMetadataCues:i,interstitialsController:o}=this.hls.config;if(!i)return;const l=$l();if(n&&r&&!o){const{fragmentStart:_,fragmentEnd:L}=e;let K=this.assetCue;K?(K.startTime=_,K.endTime=L):l&&(K=this.assetCue=Tl(l,_,L,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),K&&(K.id=n,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(K),K.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:d}=this,{dateRanges:c}=e,g=Object.keys(c);let f=this.dateRangeCuesAppended;if(d&&t){var h;if((h=d.cues)!=null&&h.length){const _=Object.keys(f).filter(L=>!g.includes(L));for(let L=_.length;L--;){var y;const K=_[L],Z=(y=f[K])==null?void 0:y.cues;delete f[K],Z&&Object.keys(Z).forEach(ae=>{const pe=Z[ae];if(pe){pe.removeEventListener("enter",this.onEventCueEnter);try{d.removeCue(pe)}catch{}}})}}else f=this.dateRangeCuesAppended={}}const E=e.fragments[e.fragments.length-1];if(!(g.length===0||!on(E?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let _=0;_<g.length;_++){const L=g[_],K=c[L],Z=K.startTime,ae=f[L],pe=ae?.cues||{};let xe=ae?.durationKnown||!1,ke=Hs;const{duration:Y,endDate:J}=K;if(J&&Y!==null)ke=Z+Y,xe=!0;else if(K.endOnNext&&!xe){const Ee=g.reduce((Le,et)=>{if(et!==K.id){const Ae=c[et];if(Ae.class===K.class&&Ae.startDate>K.startDate&&(!Le||K.startDate<Le.startDate))return Ae}return Le},null);Ee&&(ke=Ee.startTime,xe=!0)}const he=Object.keys(K.attr);for(let Ee=0;Ee<he.length;Ee++){const Le=he[Ee];if(!Db(Le))continue;const et=pe[Le];if(et)xe&&!(ae!=null&&ae.durationKnown)?et.endTime=ke:Math.abs(et.startTime-Z)>.01&&(et.startTime=Z,et.endTime=ke);else if(l){let Ae=K.attr[Le];Pb(Le)&&(Ae=xh(Ae));const Be=Tl(l,Z,ke,{key:Le,data:Ae},jr.dateRange);Be&&(Be.id=L,this.id3Track.addCue(Be),pe[Le]=Be,o&&(Le==="X-ASSET-LIST"||Le==="X-ASSET-URL")&&Be.addEventListener("enter",this.onEventCueEnter))}}f[L]={cues:pe,dateRange:K,durationKnown:xe}}}}}class fS{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,n=this.levelDetails;if(!t||!n)return;this.currentTime=t.currentTime;const r=this.computeLatency();if(r===null)return;this._latency=r;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:o}=this.config;if(!i||o===1||!n.live)return;const l=this.targetLatency;if(l===null)return;const d=r-l,c=Math.min(this.maxLatency,l+n.targetduration);if(d<c&&d>.05&&this.forwardBufferLength>1){const f=Math.min(2,Math.max(1,o)),h=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20,y=Math.min(f,Math.max(1,h));this.changeMediaPlaybackRate(t,y)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:n,targetduration:r}=e,{liveSyncDuration:i,liveSyncDurationCount:o,lowLatencyMode:l}=this.config,d=this.hls.userConfig;let c=l&&n||t;(this._targetLatencyUpdated||d.liveSyncDuration||d.liveSyncDurationCount||c===0)&&(c=i!==void 0?i:o*r);const g=r;return c+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,g)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const n=this.levelDetails;if(n===null)return null;const r=n.edge,i=e-t-this.edgeStalled,o=r-n.totalduration,l=r-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(o,i),l)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(ue.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(ue.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var n;t.details===lt.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(n=this.levelDetails)!=null&&n.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var n,r;e.playbackRate!==t&&((n=this.hls)==null||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(r=this.targetLatency)==null?void 0:r.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class hS extends du{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.on(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.on(ue.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.off(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.off(ue.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const n=this.hls.config.preferManagedMediaSource,r=[],i={},o={};let l=!1,d=!1,c=!1;t.levels.forEach(g=>{const f=g.attrs;let{audioCodec:h,videoCodec:y}=g;h&&(g.audioCodec=h=ro(h,n)||void 0),y&&(y=g.videoCodec=WE(y));const{width:E,height:_,unknownCodecs:L}=g,K=L?.length||0;if(l||(l=!!(E&&_)),d||(d=!!y),c||(c=!!h),K||h&&!this.isAudioSupported(h)||y&&!this.isVideoSupported(y)){this.log(`Some or all CODECS not supported "${f.CODECS}"`);return}const{CODECS:Z,"FRAME-RATE":ae,"HDCP-LEVEL":pe,"PATHWAY-ID":xe,RESOLUTION:ke,"VIDEO-RANGE":Y}=f,he=`${`${xe||"."}-`}${g.bitrate}-${ke}-${ae}-${Z}-${Y}-${pe}`;if(i[he])if(i[he].uri!==g.url&&!g.attrs["PATHWAY-ID"]){const Ee=o[he]+=1;g.attrs["PATHWAY-ID"]=new Array(Ee+1).join(".");const Le=this.createLevel(g);i[he]=Le,r.push(Le)}else i[he].addGroupId("audio",f.AUDIO),i[he].addGroupId("text",f.SUBTITLES);else{const Ee=this.createLevel(g);i[he]=Ee,o[he]=1,r.push(Ee)}}),this.filterAndSortMediaOptions(r,t,l,d,c)}createLevel(e){const t=new es(e),n=e.supplemental;if(n!=null&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){const r=new Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(r.message),t.supportedResult=Uh(r,[])}return t}isAudioSupported(e){return Za(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Za(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,n,r,i){var o;let l=[],d=[],c=e;const g=((o=t.stats)==null?void 0:o.parsing)||{};if((n||r)&&i&&(c=c.filter(({videoCodec:Z,videoRange:ae,width:pe,height:xe})=>(!!Z||!!(pe&&xe))&&ab(ae))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let Z="no level with compatible codecs found in manifest",ae=Z;t.levels.length&&(ae=`one or more CODECS in variant not supported: ${ir(t.levels.map(xe=>xe.attrs.CODECS).filter((xe,ke,Y)=>Y.indexOf(xe)===ke))}`,this.warn(ae),Z+=` (${ae})`);const pe=new Error(Z);this.hls.trigger(ue.ERROR,{type:_n.MEDIA_ERROR,details:lt.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:pe,reason:ae})}}),g.end=performance.now();return}t.audioTracks&&(l=t.audioTracks.filter(Z=>!Z.audioCodec||this.isAudioSupported(Z.audioCodec)),fh(l)),t.subtitles&&(d=t.subtitles,fh(d));const f=c.slice(0);c.sort((Z,ae)=>{if(Z.attrs["HDCP-LEVEL"]!==ae.attrs["HDCP-LEVEL"])return(Z.attrs["HDCP-LEVEL"]||"")>(ae.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&Z.height!==ae.height)return Z.height-ae.height;if(Z.frameRate!==ae.frameRate)return Z.frameRate-ae.frameRate;if(Z.videoRange!==ae.videoRange)return io.indexOf(Z.videoRange)-io.indexOf(ae.videoRange);if(Z.videoCodec!==ae.videoCodec){const pe=nf(Z.videoCodec),xe=nf(ae.videoCodec);if(pe!==xe)return xe-pe}if(Z.uri===ae.uri&&Z.codecSet!==ae.codecSet){const pe=no(Z.codecSet),xe=no(ae.codecSet);if(pe!==xe)return xe-pe}return Z.averageBitrate!==ae.averageBitrate?Z.averageBitrate-ae.averageBitrate:0});let h=f[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==f.length)){for(let Z=0;Z<f.length;Z++)if(f[Z].pathwayId===c[0].pathwayId){h=f[Z];break}}this._levels=c;for(let Z=0;Z<c.length;Z++)if(c[Z]===h){var y;this._firstLevel=Z;const ae=h.bitrate,pe=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${ae}`),((y=this.hls.userConfig)==null?void 0:y.abrEwmaDefaultEstimate)===void 0){const xe=Math.min(ae,this.hls.config.abrEwmaDefaultEstimateMax);xe>pe&&pe===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=xe)}break}const E=i&&!r,_=this.hls.config,L=!!(_.audioStreamController&&_.audioTrackController),K={levels:c,audioTracks:l,subtitleTracks:d,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:i,video:r,altAudio:L&&!E&&l.some(Z=>!!Z.url)};g.end=performance.now(),this.hls.trigger(ue.MANIFEST_PARSED,K)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const g=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(ue.ERROR,{type:_n.OTHER_ERROR,details:lt.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:g,reason:g.message}),f)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,r=this.currentLevel,i=r?r.attrs["PATHWAY-ID"]:void 0,o=t[e],l=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,n===e&&r&&i===l)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${l?" with Pathway "+l:""} from level ${n}${i?" with Pathway "+i:""}`);const d={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(ue.LEVEL_SWITCHING,d);const c=o.details;if(!c||c.live){const g=this.switchParams(o.uri,r?.details,c);this.loadPlaylist(g)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),n=e.filter(r=>t.indexOf(r)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=n}}onError(e,t){t.fatal||!t.context||t.context.type===Un.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===hn.MAIN){const n=t.elementaryStreams;if(!Object.keys(n).some(i=>!!n[i]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var n;const{level:r,details:i}=t,o=t.levelInfo;if(!o){var l;this.warn(`Invalid level index ${r}`),(l=t.deliveryDirectives)!=null&&l.skip&&(i.deltaUpdateFailed=!0);return}if(o===this.currentLevel||t.withoutMultiVariant){o.fragmentError===0&&(o.loadError=0);let d=o.details;d===t.details&&d.advanced&&(d=void 0),this.playlistLoaded(r,t,d)}else(n=t.deliveryDirectives)!=null&&n.skip&&(i.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,i=e.attrs["PATHWAY-ID"],o=e.details,l=o?.age;this.log(`Loading level index ${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${i?" Pathway "+i:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${n}`),this.hls.trigger(ue.LEVEL_LOADING,{url:n,level:r,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const n=this._levels.filter((i,o)=>o!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(l=>l.level=-1)),!1));ag(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const r=n.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(ue.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(ue.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function fh(u){const e={};u.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}function em(){return self.SourceBuffer||self.WebKitSourceBuffer}function tm(){if(!Ki())return!1;const e=em();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function gS(){if(!tm())return!1;const u=Ki();return typeof u?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>u.isTypeSupported(Ja(e,"video")))||["mp4a.40.2","fLaC"].some(e=>u.isTypeSupported(Ja(e,"audio"))))}function mS(){var u;const e=em();return typeof(e==null||(u=e.prototype)==null?void 0:u.changeType)=="function"}const pS=100;class yS extends ru{constructor(e,t,n){super(e,t,n,"stream-controller",hn.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const r=this.media,i=r?r.currentTime:null;if(i===null||!on(i)||(this.log(`Media seeked to ${i.toFixed(3)}`),!this.getBufferedFrag(i)))return;const o=this.getFwdBufferInfoAtPos(r,i,hn.MAIN,0);if(o===null||o.len===0){this.warn(`Main forward buffer length at ${i} on "seeked" event ${o?o.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.LEVEL_LOADING,this.onLevelLoading,this),e.on(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.on(ue.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(ue.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(ue.BUFFER_CREATED,this.onBufferCreated,this),e.on(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(ue.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.off(ue.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(ue.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(ue.BUFFER_CREATED,this.onBufferCreated,this),e.off(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(ue.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:n,hls:r}=this;if(this.stopLoad(),this.setInterval(pS),this.level=-1,!this.startFragRequested){let i=r.startLevel;i===-1&&(r.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=r.firstAutoLevel),r.nextLoadLevel=i,this.level=r.loadLevel,this._hasEnoughToStart=!!t}n>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=Ot.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Ot.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Ot.WAITING_LEVEL:{const{levels:e,level:t}=this,n=e?.[t],r=n?.details;if(r&&(!r.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(r))break;this.state=Ot.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Ot.IDLE;break}break}case Ot.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===Ot.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:n,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const i=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[i]))return;const o=n[i],l=this.getMainFwdBufferInfo();if(l===null)return;const d=this.getLevelDetails();if(d&&this._streamEnded(l,d)){const _={};this.altAudio===2&&(_.type="video"),this.hls.trigger(ue.BUFFER_EOS,_),this.state=Ot.ENDED;return}if(!this.buffering)return;e.loadLevel!==i&&e.manualLevel===-1&&this.log(`Adapting to level ${i} from level ${this.level}`),this.level=e.nextLoadLevel=i;const c=o.details;if(!c||this.state===Ot.WAITING_LEVEL||this.waitForLive(o)){this.level=i,this.state=Ot.WAITING_LEVEL,this.startFragRequested=!1;return}const g=l.len,f=this.getMaxBufferLength(o.maxBitrate);if(g>=f)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:l.end;let y=this.getNextFragment(h,c);if(this.couldBacktrack&&!this.fragPrevious&&y&&cr(y)&&this.fragmentTracker.getState(y)!==Er.OK){var E;const L=((E=this.backtrackFragment)!=null?E:y).sn-c.startSN,K=c.fragments[L-1];K&&y.cc===K.cc&&(y=K,this.fragmentTracker.removeFragment(K))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=null);if(y&&this.isLoopLoading(y,h)){if(!y.gap){const L=this.audioOnly&&!this.altAudio?rr.AUDIO:rr.VIDEO,K=(L===rr.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;K&&this.afterBufferFlushed(K,L,hn.MAIN)}y=this.getNextFragmentLoopLoading(y,c,l,hn.MAIN,f)}y&&(y.initSegment&&!y.initSegment.data&&!this.bitrateTest&&(y=y.initSegment),this.loadFragment(y,o,h))}loadFragment(e,t,n){const r=this.fragmentTracker.getState(e);r===Er.NOT_LOADED||r===Er.PARTIAL?cr(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,hn.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let n;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const i=this.getLevelDetails();if(i!=null&&i.live){const l=this.getMainFwdBufferInfo();if(!l||l.len<i.targetduration*2)return}if(!t.paused&&e){const l=this.hls.nextLoadLevel,d=e[l],c=this.fragLastKbps;c&&this.fragCurrent?n=this.fragCurrent.duration*d.maxBitrate/(1e3*c)+1:n=0}else n=0;const o=this.getBufferedFrag(t.currentTime+n);if(o){const l=this.followingBufferedFrag(o);if(l){this.abortCurrentFrag();const d=l.maxStartPTS?l.maxStartPTS:l.start,c=l.duration,g=Math.max(o.end,d+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(g,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Ot.KEY_LOADING:case Ot.FRAG_LOADING:case Ot.FRAG_LOADING_WAITING_RETRY:case Ot.PARSING:case Ot.PARSED:this.state=Ot.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const n=t.media;Cr(n,"playing",this.onMediaPlaying),Cr(n,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:n}=this;n&&(Or(n,"playing",this.onMediaPlaying),Or(n,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(ue.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let n=!1,r=!1;for(let i=0;i<t.levels.length;i++){const o=t.levels[i].audioCodec;o&&(n=n||o.indexOf("mp4a.40.2")!==-1,r=r||o.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=n&&r&&!mS(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:n}=this;if(!n||this.state!==Ot.IDLE)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=Ot.WAITING_LEVEL)}onLevelLoaded(e,t){var n;const{levels:r,startFragRequested:i}=this,o=t.level,l=t.details,d=l.totalduration;if(!r){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${l.startSN},${l.endSN}]${l.lastPartSn?`[part-${l.lastPartSn}-${l.lastPartIndex}]`:""}, cc [${l.startCC}, ${l.endCC}] duration:${d}`);const c=t.levelInfo,g=this.fragCurrent;g&&(this.state===Ot.FRAG_LOADING||this.state===Ot.FRAG_LOADING_WAITING_RETRY)&&g.level!==t.level&&g.loader&&this.abortCurrentFrag();let f=0;if(l.live||(n=c.details)!=null&&n.live){var h;if(this.checkLiveUpdate(l),l.deltaUpdateFailed)return;f=this.alignPlaylists(l,c.details,(h=this.levelLastLoaded)==null?void 0:h.details)}if(c.details=l,this.levelLastLoaded=c,i||this.setStartPosition(l,f),this.hls.trigger(ue.LEVEL_UPDATED,{details:l,level:o}),this.state===Ot.WAITING_LEVEL){if(this.waitForCdnTuneIn(l))return;this.state=Ot.IDLE}i&&l.live&&this.synchronizeToLiveEdge(l),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const r=this.hls.liveSyncPosition,i=this.getLoadPosition(),o=e.fragmentStart,l=e.edge,d=i>=o-t.maxFragLookUpTolerance&&i<=l;if(r!==null&&n.duration>r&&(i<r||!d)){const g=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!d&&n.readyState<4||i<l-g)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),n.readyState))if(this.warn(`Playback: ${i.toFixed(3)} is located too far from the end of live sliding playlist: ${l}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var c;const f=Dn.bufferInfo(n,r,0);if(!((c=f.buffered)!=null&&c.length)){n.currentTime=r;return}if(f.start<=i){n.currentTime=r;return}const{nextStart:y}=Dn.bufferedInfo(f.buffered,i,0);y&&(n.currentTime=y)}else n.currentTime=r}}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:r,payload:i}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const l=o[n.level];if(!l){this.warn(`Level ${n.level} not found on progress`);return}const d=l.details;if(!d){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const c=l.videoCodec,g=d.PTSKnown||!d.live,f=(t=n.initSegment)==null?void 0:t.data,h=this._getAudioCodec(l),y=this.transmuxer=this.transmuxer||new wg(this.hls,hn.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),E=r?r.index:-1,_=E!==-1,L=new eu(n.level,n.sn,n.stats.chunkCount,i.byteLength,E,_),K=this.initPTS[n.cc];y.push(i,f,h,c,n,r,d.totalduration,g,L,K)}onAudioTrackSwitching(e,t){const n=this.hls,r=this.altAudio!==0;if(ao(t.url,n))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.altAudio=0,this.fragmentTracker.removeAllFragments(),n.once(ue.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(ue.AUDIO_TRACK_SWITCHED,t)}),n.trigger(ue.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}n.trigger(ue.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=ao(t.url,this.hls);if(n){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,t){const n=t.tracks;let r,i,o=!1;for(const l in n){const d=n[l];if(d.id==="main"){if(i=l,r=d,l==="video"){const c=n[l];c&&(this.videoBuffer=c.buffer)}}else o=!0}o&&r?(this.log(`Alternate track found, use ${i}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:n,part:r}=t,i=n.type===hn.MAIN;if(i){if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?" p: "+r.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===Ot.PARSED&&(this.state=Ot.IDLE);return}const l=r?r.stats:n.stats;this.fragLastKbps=Math.round(8*l.total/(l.buffering.end-l.loading.first)),cr(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,r)}const o=this.media;o&&(!this._hasEnoughToStart&&Dn.getBuffered(o).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),i&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var n;if(t.fatal){this.state=Ot.ERROR;return}switch(t.details){case lt.FRAG_GAP:case lt.FRAG_PARSING_ERROR:case lt.FRAG_DECRYPT_ERROR:case lt.FRAG_LOAD_ERROR:case lt.FRAG_LOAD_TIMEOUT:case lt.KEY_LOAD_ERROR:case lt.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(hn.MAIN,t);break;case lt.LEVEL_LOAD_ERROR:case lt.LEVEL_LOAD_TIMEOUT:case lt.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Ot.WAITING_LEVEL&&((n=t.context)==null?void 0:n.type)===Un.LEVEL&&(this.state=Ot.IDLE);break;case lt.BUFFER_ADD_CODEC_ERROR:case lt.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case lt.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case lt.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=Ot.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==rr.AUDIO||!this.altAudio){const n=(t===rr.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;n&&(this.afterBufferFlushed(n,t,hn.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}const r=this.timelineOffset;r&&n&&(n+=r);const i=this.getLevelDetails(),o=Dn.getBuffered(e),l=o.length?o.start(0):0,d=l-n,c=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||d>0&&(d<c||this.loadingParts&&d<2*(i?.partTarget||0)))&&(this.log(`adjusting start position by ${d} to match buffer start`),n+=d,this.startPosition=n),t<n&&(this.log(`seek to target start position ${n} from current time ${t} buffer start ${l}`),e.currentTime=n)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(n=>{const{hls:r}=this,i=n?.frag;if(!i||this.fragContextChanged(i))return;t.fragmentError=0,this.state=Ot.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const o=i.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),r.trigger(ue.FRAG_LOADED,n),i.bitrateTest=!1}).catch(n=>{this.state===Ot.STOPPED||this.state===Ot.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:n}=this,{remuxResult:r,chunkMeta:i}=e,o=this.getCurrentContext(i);if(!o){this.resetWhenMissingContext(i);return}const{frag:l,part:d,level:c}=o,{video:g,text:f,id3:h,initSegment:y}=r,{details:E}=c,_=this.altAudio?void 0:r.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=Ot.PARSING,y){const L=y.tracks;if(L){const pe=l.initSegment||l;if(this.unhandledEncryptionError(y,l))return;this._bufferInitSegment(c,L,pe,i),n.trigger(ue.FRAG_PARSING_INIT_SEGMENT,{frag:pe,id:t,tracks:L})}const K=y.initPTS,Z=y.timescale,ae=this.initPTS[l.cc];if(on(K)&&(!ae||ae.baseTime!==K||ae.timescale!==Z)){const pe=y.trackId;this.initPTS[l.cc]={baseTime:K,timescale:Z,trackId:pe},n.trigger(ue.INIT_PTS_FOUND,{frag:l,id:t,initPTS:K,timescale:Z,trackId:pe})}}if(g&&E){_&&g.type==="audiovideo"&&this.logMuxedErr(l);const L=E.fragments[l.sn-1-E.startSN],K=l.sn===E.startSN,Z=!L||l.cc>L.cc;if(r.independent!==!1){const{startPTS:ae,endPTS:pe,startDTS:xe,endDTS:ke}=g;if(d)d.elementaryStreams[g.type]={startPTS:ae,endPTS:pe,startDTS:xe,endDTS:ke};else if(g.firstKeyFrame&&g.independent&&i.id===1&&!Z&&(this.couldBacktrack=!0),g.dropped&&g.independent){const Y=this.getMainFwdBufferInfo(),J=(Y?Y.end:this.getLoadPosition())+this.config.maxBufferHole,he=g.firstKeyFramePTS?g.firstKeyFramePTS:ae;if(!K&&J<he-this.config.maxBufferHole&&!Z){this.backtrack(l);return}else Z&&(l.gap=!0);l.setElementaryStreamInfo(g.type,l.start,pe,l.start,ke,!0)}else K&&ae-(E.appliedTimelineOffset||0)>eo&&(l.gap=!0);l.setElementaryStreamInfo(g.type,ae,pe,xe,ke),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(g,l,d,i,K||Z)}else if(K||Z)l.gap=!0;else{this.backtrack(l);return}}if(_){const{startPTS:L,endPTS:K,startDTS:Z,endDTS:ae}=_;d&&(d.elementaryStreams[rr.AUDIO]={startPTS:L,endPTS:K,startDTS:Z,endDTS:ae}),l.setElementaryStreamInfo(rr.AUDIO,L,K,Z,ae),this.bufferFragmentData(_,l,d,i)}if(E&&h!=null&&h.samples.length){const L={id:t,frag:l,details:E,samples:h.samples};n.trigger(ue.FRAG_PARSING_METADATA,L)}if(E&&f){const L={id:t,frag:l,details:E,samples:f.samples};n.trigger(ue.FRAG_PARSING_USERDATA,L)}}logMuxedErr(e){this.warn(`${cr(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,n,r){if(this.state!==Ot.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(n));const{audio:i,video:o,audiovideo:l}=t;if(i){const c=e.audioCodec;let g=Ks(i.codec,c);g==="mp4a"&&(g="mp4a.40.5");const f=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){g&&(g.indexOf("mp4a.40.5")!==-1?g="mp4a.40.2":g="mp4a.40.5");const h=i.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&f.indexOf("firefox")===-1&&(g="mp4a.40.5")}g&&g.indexOf("mp4a.40.5")!==-1&&f.indexOf("android")!==-1&&i.container!=="audio/mpeg"&&(g="mp4a.40.2",this.log(`Android: force audio codec to ${g}`)),c&&c!==g&&this.log(`Swapping manifest audio codec "${c}" for "${g}"`),i.levelCodec=g,i.id=hn.MAIN,this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${g||""}/${c||""}/${i.codec}]`),delete t.audiovideo}if(o){o.levelCodec=e.videoCodec,o.id=hn.MAIN;const c=o.codec;if(c?.length===4)switch(c){case"hvc1":case"hev1":o.codec="hvc1.1.6.L120.90";break;case"av01":o.codec="av01.0.04M.08";break;case"avc1":o.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${c}]${o.codec!==c?" parsed-corrected="+o.codec:""}${o.supplemental?" supplemental="+o.supplemental:""}`),delete t.audiovideo}l&&(this.log(`Init audiovideo buffer, container:${l.container}, codecs[level/parsed]=[${e.codecs}/${l.codec}]`),delete t.video,delete t.audio);const d=Object.keys(t);if(d.length){if(this.hls.trigger(ue.BUFFER_CODECS,t),!this.hls)return;d.forEach(c=>{const f=t[c].initSegment;f!=null&&f.byteLength&&this.hls.trigger(ue.BUFFER_APPENDING,{type:c,data:f,frag:n,part:null,chunkMeta:r,parent:n.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,hn.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,n=e?.[t];return n?this.getMaxBufferLength(n.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Ot.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(Dn.isBuffered(e,n)?t=this.getAppendedFrag(n):Dn.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,i=t.level;(!r||t.sn!==r.sn||r.level!==i)&&(this.fragPlaying=t,this.hls.trigger(ue.FRAG_CHANGED,{frag:t}),(!r||r.level!==i)&&this.hls.trigger(ue.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return on(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(on(t)){const n=this.getLevelDetails(),r=this.currentFrag||(n?ua(null,n.fragments,t):null);if(r){const i=r.programDateTime;if(i!==null){const o=i+(t-r.start)*1e3;return new Date(o)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class ES extends Qr{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyIdToKeyInfo){const r=this.keyIdToKeyInfo[n].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=lt.KEY_LOAD_ERROR,n,r,i){return new Li({type:_n.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:i,error:n,networkDetails:r})}loadClear(e,t,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,i=t.length;r<i;r++){const o=t[r];if(e.cc<=o.cc&&(!cr(e)||!cr(o)||e.sn<o.sn)||!n&&r==i-1)return this.emeController.selectKeySystemFormat(o).then(l=>{if(!this.emeController)return;o.setKeyFormat(l);const d=Ws(l);if(d)return this.emeController.getKeySystemAccess([d])})}if(this.config.requireKeySystemAccessOnStart){const r=Ya(this.config);if(r.length)return this.emeController.getKeySystemAccess(r)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var n,r;t&&e.setKeyFormat(t);const i=e.decryptdata;if(!i){const c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,lt.KEY_LOAD_ERROR,c))}const o=i.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,lt.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));const l=vl(i);let d=this.keyIdToKeyInfo[l];if((n=d)!=null&&n.decryptdata.key)return i.key=d.decryptdata.key,Promise.resolve({frag:e,keyInfo:d});if(this.emeController&&(r=d)!=null&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(d.decryptdata)){case"usable":case"usable-in-future":return d.keyLoadPromise.then(g=>{const{keyInfo:f}=g;return i.key=f.decryptdata.key,{frag:e,keyInfo:f}})}switch(this.log(`${this.keyIdToKeyInfo[l]?"Rel":"L"}oading${i.keyId?" keyId: "+Ar(i.keyId):""} URI: ${i.uri} from ${e.type} ${e.level}`),d=this.keyIdToKeyInfo[l]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return i.keyFormat==="identity"?this.loadKeyHTTP(d,e):this.loadKeyEME(d,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(d,e);default:return Promise.reject(this.createKeyLoadError(e,lt.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r;if(!e.decryptdata.keyId&&(r=t.initSegment)!=null&&r.data){const o=FE(t.initSegment.data);if(o.length){let l=o[0];l.some(d=>d!==0)?(this.log(`Using keyId found in init segment ${Ar(l)}`),Hi.setKeyIdForUri(e.decryptdata.uri,l)):(l=Hi.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${Ar(l)}`)),e.decryptdata.keyId=l}}if(!e.decryptdata.keyId&&!cr(t))return Promise.resolve(n);const i=this.emeController.loadKey(n);return(e.keyLoadPromise=i.then(o=>(e.mediaKeySessionContext=o,n))).catch(o=>{throw e.keyLoadPromise=null,"data"in o&&(o.data.frag=t),o})}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,r=n.loader,i=new r(n);return t.keyLoader=e.loader=i,e.keyLoadPromise=new Promise((o,l)=>{const d={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=n.keyLoadPolicy.default,g={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},f={onSuccess:(h,y,E,_)=>{const{frag:L,keyInfo:K}=E,Z=vl(K.decryptdata);if(!L.decryptdata||K!==this.keyIdToKeyInfo[Z])return l(this.createKeyLoadError(L,lt.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),_));K.decryptdata.key=L.decryptdata.key=new Uint8Array(h.data),L.keyLoader=null,K.loader=null,o({frag:L,keyInfo:K})},onError:(h,y,E,_)=>{this.resetLoader(y),l(this.createKeyLoadError(t,lt.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),E,Qn({url:d.url,data:void 0},h)))},onTimeout:(h,y,E)=>{this.resetLoader(y),l(this.createKeyLoadError(t,lt.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),E))},onAbort:(h,y,E)=>{this.resetLoader(y),l(this.createKeyLoadError(t,lt.INTERNAL_ABORTED,new Error("key loading aborted"),E))}};i.load(d,g,f)})}resetLoader(e){const{frag:t,keyInfo:n,url:r}=e,i=n.loader;t.keyLoader===i&&(t.keyLoader=null,n.loader=null);const o=vl(n.decryptdata)||r;delete this.keyIdToKeyInfo[o],i&&i.destroy()}}function vl(u){if(u.keyFormat!==Ir.FAIRPLAY){const e=u.keyId;if(e)return Ar(e)}return u.uri}function hh(u){const{type:e}=u;switch(e){case Un.AUDIO_TRACK:return hn.AUDIO;case Un.SUBTITLE_TRACK:return hn.SUBTITLE;default:return hn.MAIN}}function Sl(u,e){let t=u.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class bS{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.LEVEL_LOADING,this.onLevelLoading,this),e.on(ue.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(ue.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(ue.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.LEVEL_LOADING,this.onLevelLoading,this),e.off(ue.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(ue.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(ue.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,n=t.pLoader,r=t.loader,i=n||r,o=new i(t);return this.loaders[e.type]=o,o}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Un.MANIFEST,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:n,level:r,pathwayId:i,url:o,deliveryDirectives:l,levelInfo:d}=t;this.load({id:n,level:r,pathwayId:i,responseType:"text",type:Un.LEVEL,url:o,deliveryDirectives:l,levelOrTrack:d})}onAudioTrackLoading(e,t){const{id:n,groupId:r,url:i,deliveryDirectives:o,track:l}=t;this.load({id:n,groupId:r,level:null,responseType:"text",type:Un.AUDIO_TRACK,url:i,deliveryDirectives:o,levelOrTrack:l})}onSubtitleTrackLoading(e,t){const{id:n,groupId:r,url:i,deliveryDirectives:o,track:l}=t;this.load({id:n,groupId:r,level:null,responseType:"text",type:Un.SUBTITLE_TRACK,url:i,deliveryDirectives:o,levelOrTrack:l})}onLevelsUpdated(e,t){const n=this.loaders[Un.LEVEL];if(n){const r=n.context;r&&!t.levels.some(i=>i===r.levelOrTrack)&&(n.abort(),delete this.loaders[Un.LEVEL])}}load(e){var t;const n=this.hls.config;let r=this.getInternalLoader(e);if(r){const c=this.hls.logger,g=r.context;if(g&&g.levelOrTrack===e.levelOrTrack&&(g.url===e.url||g.deliveryDirectives&&!e.deliveryDirectives)){g.url===e.url?c.log(`[playlist-loader]: ignore ${e.url} ongoing request`):c.log(`[playlist-loader]: ignore ${e.url} in favor of ${g.url}`);return}c.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let i;if(e.type===Un.MANIFEST?i=n.manifestLoadPolicy.default:i=nr({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),on((t=e.deliveryDirectives)==null?void 0:t.part)){let c;if(e.type===Un.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===Un.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===Un.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const g=c.partTarget,f=c.targetduration;if(g&&f){const h=Math.max(g*3,f*.8)*1e3;i=nr({},i,{maxTimeToFirstByteMs:Math.min(h,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,i.maxTimeToFirstByteMs)})}}}const o=i.errorRetry||i.timeoutRetry||{},l={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},d={onSuccess:(c,g,f,h)=>{const y=this.getInternalLoader(f);this.resetInternalLoader(f.type);const E=c.data;g.parsing.start=performance.now(),bi.isMediaPlaylist(E)||f.type!==Un.MANIFEST?this.handleTrackOrLevelPlaylist(c,g,f,h||null,y):this.handleMasterPlaylist(c,g,f,h)},onError:(c,g,f,h)=>{this.handleNetworkError(g,f,!1,c,h)},onTimeout:(c,g,f)=>{this.handleNetworkError(g,f,!0,void 0,c)}};r.load(e,l,d)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,n,r){const i=this.hls,o=e.data,l=Sl(e,n),d=bi.parseMasterPlaylist(o,l);if(d.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,n,d.playlistParsingError,r,t);return}const{contentSteering:c,levels:g,sessionData:f,sessionKeys:h,startTimeOffset:y,variableList:E}=d;this.variableList=E,g.forEach(Z=>{const{unknownCodecs:ae}=Z;if(ae){const{preferManagedMediaSource:pe}=this.hls.config;let{audioCodec:xe,videoCodec:ke}=Z;for(let Y=ae.length;Y--;){const J=ae[Y];Za(J,"audio",pe)?(Z.audioCodec=xe=xe?`${xe},${J}`:J,La.audio[xe.substring(0,4)]=2,ae.splice(Y,1)):Za(J,"video",pe)&&(Z.videoCodec=ke=ke?`${ke},${J}`:J,La.video[ke.substring(0,4)]=2,ae.splice(Y,1))}}});const{AUDIO:_=[],SUBTITLES:L,"CLOSED-CAPTIONS":K}=bi.parseMasterPlaylistMedia(o,l,d);_.length&&!_.some(ae=>!ae.url)&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),_.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new sr({}),bitrate:0,url:""})),i.trigger(ue.MANIFEST_LOADED,{levels:g,audioTracks:_,subtitles:L,captions:K,contentSteering:c,url:l,stats:t,networkDetails:r,sessionData:f,sessionKeys:h,startTimeOffset:y,variableList:E})}handleTrackOrLevelPlaylist(e,t,n,r,i){const o=this.hls,{id:l,level:d,type:c}=n,g=Sl(e,n),f=on(d)?d:on(l)?l:0,h=hh(n),y=bi.parseLevelPlaylist(e.data,g,f,h,0,this.variableList);if(c===Un.MANIFEST){const E={attrs:new sr({}),bitrate:0,details:y,name:"",url:g};y.requestScheduled=t.loading.start+ng(y,0),o.trigger(ue.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:g,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=y,this.handlePlaylistLoaded(y,e,t,n,r,i)}handleManifestParsingError(e,t,n,r,i){this.hls.trigger(ue.ERROR,{type:_n.NETWORK_ERROR,details:lt.MANIFEST_PARSING_ERROR,fatal:t.type===Un.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:r,stats:i})}handleNetworkError(e,t,n=!1,r,i){let o=`A network ${n?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===Un.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Un.AUDIO_TRACK||e.type===Un.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const l=new Error(o);this.hls.logger.warn(`[playlist-loader]: ${o}`);let d=lt.UNKNOWN,c=!1;const g=this.getInternalLoader(e);switch(e.type){case Un.MANIFEST:d=n?lt.MANIFEST_LOAD_TIMEOUT:lt.MANIFEST_LOAD_ERROR,c=!0;break;case Un.LEVEL:d=n?lt.LEVEL_LOAD_TIMEOUT:lt.LEVEL_LOAD_ERROR,c=!1;break;case Un.AUDIO_TRACK:d=n?lt.AUDIO_TRACK_LOAD_TIMEOUT:lt.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case Un.SUBTITLE_TRACK:d=n?lt.SUBTITLE_TRACK_LOAD_TIMEOUT:lt.SUBTITLE_LOAD_ERROR,c=!1;break}g&&this.resetInternalLoader(e.type);const f={type:_n.NETWORK_ERROR,details:d,fatal:c,url:e.url,loader:g,context:e,error:l,networkDetails:t,stats:i};if(r){const h=t?.url||e.url;f.response=Qn({url:h,data:void 0},r)}this.hls.trigger(ue.ERROR,f)}handlePlaylistLoaded(e,t,n,r,i,o){const l=this.hls,{type:d,level:c,levelOrTrack:g,id:f,groupId:h,deliveryDirectives:y}=r,E=Sl(t,r),_=hh(r);let L=typeof r.level=="number"&&_===hn.MAIN?c:void 0;const K=e.playlistParsingError;if(K){if(this.hls.logger.warn(`${K} ${e.url}`),!l.config.ignorePlaylistParsingErrors){l.trigger(ue.ERROR,{type:_n.NETWORK_ERROR,details:lt.LEVEL_PARSING_ERROR,fatal:!1,url:E,error:K,reason:K.message,response:t,context:r,level:L,parent:_,networkDetails:i,stats:n});return}e.playlistParsingError=null}if(!e.fragments.length){const Z=e.playlistParsingError=new Error("No Segments found in Playlist");l.trigger(ue.ERROR,{type:_n.NETWORK_ERROR,details:lt.LEVEL_EMPTY_ERROR,fatal:!1,url:E,error:Z,reason:Z.message,response:t,context:r,level:L,parent:_,networkDetails:i,stats:n});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),d){case Un.MANIFEST:case Un.LEVEL:if(L){if(!g)L=0;else if(g!==l.levels[L]){const Z=l.levels.indexOf(g);Z>-1&&(L=Z)}}l.trigger(ue.LEVEL_LOADED,{details:e,levelInfo:g||l.levels[0],level:L||0,id:f||0,stats:n,networkDetails:i,deliveryDirectives:y,withoutMultiVariant:d===Un.MANIFEST});break;case Un.AUDIO_TRACK:l.trigger(ue.AUDIO_TRACK_LOADED,{details:e,track:g,id:f||0,groupId:h||"",stats:n,networkDetails:i,deliveryDirectives:y});break;case Un.SUBTITLE_TRACK:l.trigger(ue.SUBTITLE_TRACK_LOADED,{details:e,track:g,id:f||0,groupId:h||"",stats:n,networkDetails:i,deliveryDirectives:y});break}}}class yr{static get version(){return ts}static isMSESupported(){return tm()}static isSupported(){return gS()}static getMediaSource(){return Ki()}static get Events(){return ue}static get MetadataSchema(){return jr}static get ErrorTypes(){return _n}static get ErrorDetails(){return lt}static get DefaultConfig(){return yr.defaultConfig?yr.defaultConfig:nS}static set DefaultConfig(e){yr.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new iu,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=IE(e.debug||!1,"Hls instance",e.assetPlayerId),n=this.config=iS(yr.DefaultConfig,e,t);this.userConfig=e,n.progressive&&aS(n,t);const{abrController:r,bufferController:i,capLevelController:o,errorController:l,fpsController:d}=n,c=new l(this),g=this.abrController=new r(this),f=new Tb(this),h=n.interstitialsController,y=h?this.interstitialsController=new h(this,yr):null,E=this.bufferController=new i(this,f),_=this.capLevelController=new o(this),L=new d(this),K=new bS(this),Z=n.contentSteeringController,ae=Z?new Z(this):null,pe=this.levelController=new hS(this,ae),xe=new dS(this),ke=new ES(this.config,this.logger),Y=this.streamController=new yS(this,f,ke),J=this.gapController=new uS(this,f);_.setStreamController(Y),L.setStreamController(Y);const he=[K,pe,Y];y&&he.splice(1,0,y),ae&&he.splice(1,0,ae),this.networkControllers=he;const Ee=[g,E,J,_,L,xe,f];this.audioTrackController=this.createController(n.audioTrackController,he);const Le=n.audioStreamController;Le&&he.push(this.audioStreamController=new Le(this,f,ke)),this.subtitleTrackController=this.createController(n.subtitleTrackController,he);const et=n.subtitleStreamController;et&&he.push(this.subtititleStreamController=new et(this,f,ke)),this.createController(n.timelineController,Ee),ke.emeController=this.emeController=this.createController(n.emeController,Ee),this.cmcdController=this.createController(n.cmcdController,Ee),this.latencyController=this.createController(fS,Ee),this.coreComponents=Ee,he.push(c);const Ae=c.onErrorOut;typeof Ae=="function"&&this.on(ue.ERROR,Ae,c),this.on(ue.MANIFEST_LOADED,K.onManifestLoaded,K)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,r){this._emitter.off(e,t,n,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const r=e===ue.ERROR;this.trigger(ue.ERROR,{type:_n.OTHER_ERROR,details:lt.INTERNAL_EXCEPTION,fatal:r,event:e,error:n}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(ue.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const i=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(ue.ERROR,{type:_n.OTHER_ERROR,details:lt.ATTACH_MEDIA_ERROR,fatal:!0,error:i});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,n=t?e.media:e,r=t?e:{media:n};this._media=n,this.trigger(ue.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia"),this.trigger(ue.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(ue.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,n=this._url,r=this._url=Kl.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&n&&(n!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(ue.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,t),!(!this.started||!this.networkControllers));n++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[hn.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[hn.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[hn.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=uv()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){ib(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const n=e.length;for(let r=0;r<n;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,n)for(let i=r;i--;){const o=e[i].attrs["HDCP-LEVEL"];if(o&&o<=n)return i}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const n=jh(t);return zh(e,n,navigator.mediaCapabilities)}}yr.defaultConfig=void 0;class TS{hls=null;videoElement;config;listeners=new Map;destroyed=!1;activeSubtitleLanguage=null;onPlaying=()=>this.emit("state-change",{state:"playing"});onPause=()=>this.emit("state-change",{state:"paused"});onWaiting=()=>this.emit("state-change",{state:"buffering"});constructor(e,t={}){this.videoElement=e,this.config=t}async load(e){if(this.destroyed)return;if(!yr.isSupported()){if(this.videoElement.canPlayType("application/vnd.apple.mpegurl")){this.videoElement.src=e,this.attachVideoListeners();return}throw new Error("HLS is not supported in this browser")}const t=this.config.drmConfig?.widevine;return this.hls=new yr({autoStartLoad:this.config.autoStart??!0,maxBufferLength:this.config.maxBufferAhead??30,maxMaxBufferLength:60,backBufferLength:this.config.maxBufferBehind??10,enableWorker:!0,lowLatencyMode:this.config.lowLatency??!1,debug:this.config.debug??!1,enableCEA708Captions:!0,manifestLoadingMaxRetry:3,levelLoadingMaxRetry:4,fragLoadingMaxRetry:4,nudgeMaxRetry:5,...t&&{emeEnabled:!0,widevineLicenseUrl:t.licenseUrl,...t.withCredentials&&{licenseXhrSetup:n=>{n.withCredentials=!0}},...t.headers&&Object.keys(t.headers).length>0&&{licenseXhrSetup:n=>{Object.entries(t.headers).forEach(([r,i])=>n.setRequestHeader(r,i)),t.withCredentials&&(n.withCredentials=!0)}}}}),this.setupHlsListeners(),this.attachVideoListeners(),this.hls.loadSource(e),this.hls.attachMedia(this.videoElement),new Promise((n,r)=>{if(!this.hls){r(new Error("HLS instance not created"));return}const i=()=>{l(),n()},o=(d,c)=>{c.fatal&&(l(),r(new Error(c.details??"HLS manifest load failed")))},l=()=>{this.hls?.off(yr.Events.MANIFEST_PARSED,i),this.hls?.off(yr.Events.ERROR,o)};this.hls.on(yr.Events.MANIFEST_PARSED,i),this.hls.on(yr.Events.ERROR,o)})}setupHlsListeners(){this.hls&&(this.hls.on(yr.Events.LEVEL_SWITCHED,(e,t)=>{const n=this.qualityFromLevelIndex(t.level);n&&this.emit("quality-changed",{quality:n})}),this.hls.on(yr.Events.AUDIO_TRACK_SWITCHED,(e,t)=>{this.emit("audio-track-changed",{trackId:String(t.id)})}),this.hls.on(yr.Events.SUBTITLE_TRACK_SWITCH,(e,t)=>{const n=this.hls?.subtitleTracks[t.id];this.activeSubtitleLanguage=n?.lang??null,this.emit("subtitle-track-changed",{language:this.activeSubtitleLanguage})}),this.hls.on(yr.Events.ERROR,(e,t)=>{const n={code:t.details??"HLS_ERROR",message:t.error?.message??`HLS ${t.type}: ${t.details}`,fatal:t.fatal,details:t};if(t.fatal)switch(console.error("[HlsEngine] Fatal error:",t.type,t.details),t.type){case yr.ErrorTypes.NETWORK_ERROR:console.warn("[HlsEngine] Network error β retrying startLoad..."),this.hls?.startLoad();break;case yr.ErrorTypes.MEDIA_ERROR:console.warn("[HlsEngine] Media error β attempting recoverMediaError..."),this.hls?.recoverMediaError();break;default:this.emit("error",{error:n});break}else console.warn("[HlsEngine] Non-fatal:",t.details)}))}attachVideoListeners(){this.videoElement.addEventListener("playing",this.onPlaying),this.videoElement.addEventListener("pause",this.onPause),this.videoElement.addEventListener("waiting",this.onWaiting)}detachVideoListeners(){this.videoElement.removeEventListener("playing",this.onPlaying),this.videoElement.removeEventListener("pause",this.onPause),this.videoElement.removeEventListener("waiting",this.onWaiting)}getQualities(){if(!this.hls||this.hls.levels.length===0)return[];const e={id:"auto",label:"Auto",width:0,height:0,bandwidth:0,codecs:"",uri:""},t=this.hls.levels.map((n,r)=>this.mapLevelToQuality(n,r));return[e,...t]}getCurrentQuality(){return this.hls?this.hls.currentLevel===-1?{id:"auto",label:"Auto",width:0,height:0,bandwidth:0,codecs:"",uri:""}:this.qualityFromLevelIndex(this.hls.currentLevel):null}setQuality(e){if(!this.hls)return;if(e==="auto"){this.enableAutoQuality();return}const t=parseInt(e,10);if(isNaN(t)||t<0||t>=this.hls.levels.length){console.warn("[HlsEngine] Invalid quality id:",e);return}this.hls.currentLevel=t,this.hls.loadLevel=t}enableAutoQuality(){this.hls&&(this.hls.currentLevel=-1,this.hls.loadLevel=-1)}getAudioTracks(){return this.hls?this.hls.audioTracks.map((e,t)=>({id:String(t),label:e.name||e.lang||`Track ${t+1}`,language:e.lang||""})):[]}getActiveAudioTrackId(){return!this.hls||this.hls.audioTrack===-1?"":String(this.hls.audioTrack)}setAudioTrack(e){if(!this.hls)return;const t=parseInt(e,10);if(isNaN(t)||t<0||t>=this.hls.audioTracks.length){console.warn("[HlsEngine] Invalid audio track id:",e);return}this.hls.audioTrack=t}getSubtitleTracks(){return this.hls?this.hls.subtitleTracks.map(e=>({language:e.lang||"",label:e.name||e.lang||"",url:e.url||""})):[]}async setSubtitleTrack(e){if(!this.hls)return;if(e===null){this.hls.subtitleTrack=-1,this.activeSubtitleLanguage=null;return}const t=this.hls.subtitleTracks.findIndex(n=>n.lang===e||n.name===e);if(t===-1){console.warn("[HlsEngine] Subtitle track not found:",e);return}this.hls.subtitleTrack=t,this.activeSubtitleLanguage=e}getActiveSubtitleLanguage(){return this.activeSubtitleLanguage}attachCaptions(e){}attachSubtitles(e){}isLiveStream(){return this.videoElement.duration===1/0}getLiveEdgeTime(){const e=this.videoElement.seekable;return e.length>0?e.end(e.length-1):this.videoElement.duration||0}seekToLiveEdge(){if(!this.hls)return;const e=this.hls.liveSyncPosition??this.getLiveEdgeTime();this.videoElement.currentTime=e}getDVRRange(){if(!this.isLiveStream())return null;const e=this.videoElement.seekable;return e.length===0?null:{start:e.start(0),end:e.end(e.length-1)}}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,t){this.listeners.get(e)?.forEach(n=>n(t))}mapLevelToQuality(e,t){const n=e.height??0,r=e.bitrate??0;let i;n>=2160?i="4K":n>=1440?i="1440p":n>=1080?i="1080p":n>=720?i="720p":n>=480?i="480p":n>=360?i="360p":n>=240?i="240p":r>0?i=`${Math.round(r/1e3)}k`:i=`Level ${t+1}`;const o=e;return{id:String(t),label:i,width:e.width??0,height:n,bandwidth:r,codecs:e.videoCodec??"",uri:o.url?.[0]??""}}qualityFromLevelIndex(e){return!this.hls||e<0||e>=this.hls.levels.length?null:this.mapLevelToQuality(this.hls.levels[e],e)}getStats(){const e=this.hls,t=this.videoElement,n=e?Math.round((e.bandwidthEstimate??0)/1e3):0;let r=0;if(t.buffered.length>0){const f=t.currentTime;for(let h=0;h<t.buffered.length;h++)if(t.buffered.start(h)<=f&&t.buffered.end(h)>=f){r=parseFloat((t.buffered.end(h)-f).toFixed(2));break}}const i=t.getVideoPlaybackQuality?.(),o=i?.droppedVideoFrames??0,l=i?.totalVideoFrames??0;let d="",c="";if(e){const f=e.currentLevel>=0?e.currentLevel:e.nextLevel>=0?e.nextLevel:0,h=e.levels?.[f];h&&(d=h.videoCodec??h.audioCodec??"",h.width&&h.height&&(c=`${h.width}Γ${h.height}`))}const g=e?.url??t.currentSrc??"";return{bandwidth:n,bufferHealth:r,droppedFrames:o,totalFrames:l,codec:d,resolution:c,segmentUrl:g}}async destroy(){this.destroyed=!0,this.detachVideoListeners(),this.hls?.destroy(),this.hls=null,this.listeners.clear(),this.activeSubtitleLanguage=null}}var vS={7267:function(u,e){e.byteLength=function(c){var g=l(c),f=g[0],h=g[1];return 3*(f+h)/4-h},e.toByteArray=function(c){var g,f,h=l(c),y=h[0],E=h[1],_=new r((function(Z,ae,pe){return 3*(ae+pe)/4-pe})(0,y,E)),L=0,K=E>0?y-4:y;for(f=0;f<K;f+=4)g=n[c.charCodeAt(f)]<<18|n[c.charCodeAt(f+1)]<<12|n[c.charCodeAt(f+2)]<<6|n[c.charCodeAt(f+3)],_[L++]=g>>16&255,_[L++]=g>>8&255,_[L++]=255&g;return E===2&&(g=n[c.charCodeAt(f)]<<2|n[c.charCodeAt(f+1)]>>4,_[L++]=255&g),E===1&&(g=n[c.charCodeAt(f)]<<10|n[c.charCodeAt(f+1)]<<4|n[c.charCodeAt(f+2)]>>2,_[L++]=g>>8&255,_[L++]=255&g),_},e.fromByteArray=function(c){for(var g,f=c.length,h=f%3,y=[],E=16383,_=0,L=f-h;_<L;_+=E)y.push(d(c,_,_+E>L?L:_+E));return h===1?(g=c[f-1],y.push(t[g>>2]+t[g<<4&63]+"==")):h===2&&(g=(c[f-2]<<8)+c[f-1],y.push(t[g>>10]+t[g>>4&63]+t[g<<2&63]+"=")),y.join("")};for(var t=[],n=[],r=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)t[o]=i[o],n[i.charCodeAt(o)]=o;function l(c){var g=c.length;if(g%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=c.indexOf("=");return f===-1&&(f=g),[f,f===g?0:4-f%4]}function d(c,g,f){for(var h,y,E=[],_=g;_<f;_+=3)h=(c[_]<<16&16711680)+(c[_+1]<<8&65280)+(255&c[_+2]),E.push(t[(y=h)>>18&63]+t[y>>12&63]+t[y>>6&63]+t[63&y]);return E.join("")}n[45]=62,n[95]=63},44:function(u,e,t){var n=t(7267),r=t(7986),i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=d,e.SlowBuffer=function(Q){return+Q!=Q&&(Q=0),d.alloc(+Q)},e.INSPECT_MAX_BYTES=50;var o=2147483647;function l(Q){if(Q>o)throw new RangeError('The value "'+Q+'" is invalid for option "size"');var H=new Uint8Array(Q);return Object.setPrototypeOf(H,d.prototype),H}function d(Q,H,w){if(typeof Q=="number"){if(typeof H=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return f(Q)}return c(Q,H,w)}function c(Q,H,w){if(typeof Q=="string")return(function(F,Me){if(typeof Me=="string"&&Me!==""||(Me="utf8"),!d.isEncoding(Me))throw new TypeError("Unknown encoding: "+Me);var We=0|_(F,Me),Ue=l(We),je=Ue.write(F,Me);return je!==We&&(Ue=Ue.slice(0,je)),Ue})(Q,H);if(ArrayBuffer.isView(Q))return(function(F){if(Pe(F,Uint8Array)){var Me=new Uint8Array(F);return y(Me.buffer,Me.byteOffset,Me.byteLength)}return h(F)})(Q);if(Q==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Q);if(Pe(Q,ArrayBuffer)||Q&&Pe(Q.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Pe(Q,SharedArrayBuffer)||Q&&Pe(Q.buffer,SharedArrayBuffer)))return y(Q,H,w);if(typeof Q=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var D=Q.valueOf&&Q.valueOf();if(D!=null&&D!==Q)return d.from(D,H,w);var oe=(function(F){if(d.isBuffer(F)){var Me=0|E(F.length),We=l(Me);return We.length===0||F.copy(We,0,0,Me),We}return F.length!==void 0?typeof F.length!="number"||De(F.length)?l(0):h(F):F.type==="Buffer"&&Array.isArray(F.data)?h(F.data):void 0})(Q);if(oe)return oe;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Q[Symbol.toPrimitive]=="function")return d.from(Q[Symbol.toPrimitive]("string"),H,w);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Q)}function g(Q){if(typeof Q!="number")throw new TypeError('"size" argument must be of type number');if(Q<0)throw new RangeError('The value "'+Q+'" is invalid for option "size"')}function f(Q){return g(Q),l(Q<0?0:0|E(Q))}function h(Q){for(var H=Q.length<0?0:0|E(Q.length),w=l(H),D=0;D<H;D+=1)w[D]=255&Q[D];return w}function y(Q,H,w){if(H<0||Q.byteLength<H)throw new RangeError('"offset" is outside of buffer bounds');if(Q.byteLength<H+(w||0))throw new RangeError('"length" is outside of buffer bounds');var D;return D=H===void 0&&w===void 0?new Uint8Array(Q):w===void 0?new Uint8Array(Q,H):new Uint8Array(Q,H,w),Object.setPrototypeOf(D,d.prototype),D}function E(Q){if(Q>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|Q}function _(Q,H){if(d.isBuffer(Q))return Q.length;if(ArrayBuffer.isView(Q)||Pe(Q,ArrayBuffer))return Q.byteLength;if(typeof Q!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Q);var w=Q.length,D=arguments.length>2&&arguments[2]===!0;if(!D&&w===0)return 0;for(var oe=!1;;)switch(H){case"ascii":case"latin1":case"binary":return w;case"utf8":case"utf-8":return nt(Q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*w;case"hex":return w>>>1;case"base64":return Ft(Q).length;default:if(oe)return D?-1:nt(Q).length;H=(""+H).toLowerCase(),oe=!0}}function L(Q,H,w){var D=!1;if((H===void 0||H<0)&&(H=0),H>this.length||((w===void 0||w>this.length)&&(w=this.length),w<=0)||(w>>>=0)<=(H>>>=0))return"";for(Q||(Q="utf8");;)switch(Q){case"hex":return Ze(this,H,w);case"utf8":case"utf-8":return Ee(this,H,w);case"ascii":return et(this,H,w);case"latin1":case"binary":return Ae(this,H,w);case"base64":return he(this,H,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Be(this,H,w);default:if(D)throw new TypeError("Unknown encoding: "+Q);Q=(Q+"").toLowerCase(),D=!0}}function K(Q,H,w){var D=Q[H];Q[H]=Q[w],Q[w]=D}function Z(Q,H,w,D,oe){if(Q.length===0)return-1;if(typeof w=="string"?(D=w,w=0):w>2147483647?w=2147483647:w<-2147483648&&(w=-2147483648),De(w=+w)&&(w=oe?0:Q.length-1),w<0&&(w=Q.length+w),w>=Q.length){if(oe)return-1;w=Q.length-1}else if(w<0){if(!oe)return-1;w=0}if(typeof H=="string"&&(H=d.from(H,D)),d.isBuffer(H))return H.length===0?-1:ae(Q,H,w,D,oe);if(typeof H=="number")return H&=255,typeof Uint8Array.prototype.indexOf=="function"?oe?Uint8Array.prototype.indexOf.call(Q,H,w):Uint8Array.prototype.lastIndexOf.call(Q,H,w):ae(Q,[H],w,D,oe);throw new TypeError("val must be string, number or Buffer")}function ae(Q,H,w,D,oe){var F,Me=1,We=Q.length,Ue=H.length;if(D!==void 0&&((D=String(D).toLowerCase())==="ucs2"||D==="ucs-2"||D==="utf16le"||D==="utf-16le")){if(Q.length<2||H.length<2)return-1;Me=2,We/=2,Ue/=2,w/=2}function je(it,Et){return Me===1?it[Et]:it.readUInt16BE(Et*Me)}if(oe){var Oe=-1;for(F=w;F<We;F++)if(je(Q,F)===je(H,Oe===-1?0:F-Oe)){if(Oe===-1&&(Oe=F),F-Oe+1===Ue)return Oe*Me}else Oe!==-1&&(F-=F-Oe),Oe=-1}else for(w+Ue>We&&(w=We-Ue),F=w;F>=0;F--){for(var He=!0,st=0;st<Ue;st++)if(je(Q,F+st)!==je(H,st)){He=!1;break}if(He)return F}return-1}function pe(Q,H,w,D){w=Number(w)||0;var oe=Q.length-w;D?(D=Number(D))>oe&&(D=oe):D=oe;var F=H.length;D>F/2&&(D=F/2);for(var Me=0;Me<D;++Me){var We=parseInt(H.substr(2*Me,2),16);if(De(We))return Me;Q[w+Me]=We}return Me}function xe(Q,H,w,D){return Xt(nt(H,Q.length-w),Q,w,D)}function ke(Q,H,w,D){return Xt((function(oe){for(var F=[],Me=0;Me<oe.length;++Me)F.push(255&oe.charCodeAt(Me));return F})(H),Q,w,D)}function Y(Q,H,w,D){return Xt(Ft(H),Q,w,D)}function J(Q,H,w,D){return Xt((function(oe,F){for(var Me,We,Ue,je=[],Oe=0;Oe<oe.length&&!((F-=2)<0);++Oe)We=(Me=oe.charCodeAt(Oe))>>8,Ue=Me%256,je.push(Ue),je.push(We);return je})(H,Q.length-w),Q,w,D)}function he(Q,H,w){return H===0&&w===Q.length?n.fromByteArray(Q):n.fromByteArray(Q.slice(H,w))}function Ee(Q,H,w){w=Math.min(Q.length,w);for(var D=[],oe=H;oe<w;){var F,Me,We,Ue,je=Q[oe],Oe=null,He=je>239?4:je>223?3:je>191?2:1;if(oe+He<=w)switch(He){case 1:je<128&&(Oe=je);break;case 2:(192&(F=Q[oe+1]))==128&&(Ue=(31&je)<<6|63&F)>127&&(Oe=Ue);break;case 3:F=Q[oe+1],Me=Q[oe+2],(192&F)==128&&(192&Me)==128&&(Ue=(15&je)<<12|(63&F)<<6|63&Me)>2047&&(Ue<55296||Ue>57343)&&(Oe=Ue);break;case 4:F=Q[oe+1],Me=Q[oe+2],We=Q[oe+3],(192&F)==128&&(192&Me)==128&&(192&We)==128&&(Ue=(15&je)<<18|(63&F)<<12|(63&Me)<<6|63&We)>65535&&Ue<1114112&&(Oe=Ue)}Oe===null?(Oe=65533,He=1):Oe>65535&&(Oe-=65536,D.push(Oe>>>10&1023|55296),Oe=56320|1023&Oe),D.push(Oe),oe+=He}return(function(st){var it=st.length;if(it<=Le)return String.fromCharCode.apply(String,st);for(var Et="",nn=0;nn<it;)Et+=String.fromCharCode.apply(String,st.slice(nn,nn+=Le));return Et})(D)}e.kMaxLength=o,d.TYPED_ARRAY_SUPPORT=(function(){try{var Q=new Uint8Array(1),H={foo:function(){return 42}};return Object.setPrototypeOf(H,Uint8Array.prototype),Object.setPrototypeOf(Q,H),Q.foo()===42}catch{return!1}})(),d.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}}),d.poolSize=8192,d.from=function(Q,H,w){return c(Q,H,w)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array),d.alloc=function(Q,H,w){return(function(D,oe,F){return g(D),D<=0?l(D):oe!==void 0?typeof F=="string"?l(D).fill(oe,F):l(D).fill(oe):l(D)})(Q,H,w)},d.allocUnsafe=function(Q){return f(Q)},d.allocUnsafeSlow=function(Q){return f(Q)},d.isBuffer=function(Q){return Q!=null&&Q._isBuffer===!0&&Q!==d.prototype},d.compare=function(Q,H){if(Pe(Q,Uint8Array)&&(Q=d.from(Q,Q.offset,Q.byteLength)),Pe(H,Uint8Array)&&(H=d.from(H,H.offset,H.byteLength)),!d.isBuffer(Q)||!d.isBuffer(H))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Q===H)return 0;for(var w=Q.length,D=H.length,oe=0,F=Math.min(w,D);oe<F;++oe)if(Q[oe]!==H[oe]){w=Q[oe],D=H[oe];break}return w<D?-1:D<w?1:0},d.isEncoding=function(Q){switch(String(Q).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},d.concat=function(Q,H){if(!Array.isArray(Q))throw new TypeError('"list" argument must be an Array of Buffers');if(Q.length===0)return d.alloc(0);var w;if(H===void 0)for(H=0,w=0;w<Q.length;++w)H+=Q[w].length;var D=d.allocUnsafe(H),oe=0;for(w=0;w<Q.length;++w){var F=Q[w];if(Pe(F,Uint8Array))oe+F.length>D.length?d.from(F).copy(D,oe):Uint8Array.prototype.set.call(D,F,oe);else{if(!d.isBuffer(F))throw new TypeError('"list" argument must be an Array of Buffers');F.copy(D,oe)}oe+=F.length}return D},d.byteLength=_,d.prototype._isBuffer=!0,d.prototype.swap16=function(){var Q=this.length;if(Q%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var H=0;H<Q;H+=2)K(this,H,H+1);return this},d.prototype.swap32=function(){var Q=this.length;if(Q%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var H=0;H<Q;H+=4)K(this,H,H+3),K(this,H+1,H+2);return this},d.prototype.swap64=function(){var Q=this.length;if(Q%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var H=0;H<Q;H+=8)K(this,H,H+7),K(this,H+1,H+6),K(this,H+2,H+5),K(this,H+3,H+4);return this},d.prototype.toString=function(){var Q=this.length;return Q===0?"":arguments.length===0?Ee(this,0,Q):L.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(Q){if(!d.isBuffer(Q))throw new TypeError("Argument must be a Buffer");return this===Q||d.compare(this,Q)===0},d.prototype.inspect=function(){var Q="",H=e.INSPECT_MAX_BYTES;return Q=this.toString("hex",0,H).replace(/(.{2})/g,"$1 ").trim(),this.length>H&&(Q+=" ... "),"<Buffer "+Q+">"},i&&(d.prototype[i]=d.prototype.inspect),d.prototype.compare=function(Q,H,w,D,oe){if(Pe(Q,Uint8Array)&&(Q=d.from(Q,Q.offset,Q.byteLength)),!d.isBuffer(Q))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Q);if(H===void 0&&(H=0),w===void 0&&(w=Q?Q.length:0),D===void 0&&(D=0),oe===void 0&&(oe=this.length),H<0||w>Q.length||D<0||oe>this.length)throw new RangeError("out of range index");if(D>=oe&&H>=w)return 0;if(D>=oe)return-1;if(H>=w)return 1;if(this===Q)return 0;for(var F=(oe>>>=0)-(D>>>=0),Me=(w>>>=0)-(H>>>=0),We=Math.min(F,Me),Ue=this.slice(D,oe),je=Q.slice(H,w),Oe=0;Oe<We;++Oe)if(Ue[Oe]!==je[Oe]){F=Ue[Oe],Me=je[Oe];break}return F<Me?-1:Me<F?1:0},d.prototype.includes=function(Q,H,w){return this.indexOf(Q,H,w)!==-1},d.prototype.indexOf=function(Q,H,w){return Z(this,Q,H,w,!0)},d.prototype.lastIndexOf=function(Q,H,w){return Z(this,Q,H,w,!1)},d.prototype.write=function(Q,H,w,D){if(H===void 0)D="utf8",w=this.length,H=0;else if(w===void 0&&typeof H=="string")D=H,w=this.length,H=0;else{if(!isFinite(H))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");H>>>=0,isFinite(w)?(w>>>=0,D===void 0&&(D="utf8")):(D=w,w=void 0)}var oe=this.length-H;if((w===void 0||w>oe)&&(w=oe),Q.length>0&&(w<0||H<0)||H>this.length)throw new RangeError("Attempt to write outside buffer bounds");D||(D="utf8");for(var F=!1;;)switch(D){case"hex":return pe(this,Q,H,w);case"utf8":case"utf-8":return xe(this,Q,H,w);case"ascii":case"latin1":case"binary":return ke(this,Q,H,w);case"base64":return Y(this,Q,H,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return J(this,Q,H,w);default:if(F)throw new TypeError("Unknown encoding: "+D);D=(""+D).toLowerCase(),F=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Le=4096;function et(Q,H,w){var D="";w=Math.min(Q.length,w);for(var oe=H;oe<w;++oe)D+=String.fromCharCode(127&Q[oe]);return D}function Ae(Q,H,w){var D="";w=Math.min(Q.length,w);for(var oe=H;oe<w;++oe)D+=String.fromCharCode(Q[oe]);return D}function Ze(Q,H,w){var D=Q.length;(!H||H<0)&&(H=0),(!w||w<0||w>D)&&(w=D);for(var oe="",F=H;F<w;++F)oe+=dt[Q[F]];return oe}function Be(Q,H,w){for(var D=Q.slice(H,w),oe="",F=0;F<D.length-1;F+=2)oe+=String.fromCharCode(D[F]+256*D[F+1]);return oe}function Ne(Q,H,w){if(Q%1!=0||Q<0)throw new RangeError("offset is not uint");if(Q+H>w)throw new RangeError("Trying to access beyond buffer length")}function tt(Q,H,w,D,oe,F){if(!d.isBuffer(Q))throw new TypeError('"buffer" argument must be a Buffer instance');if(H>oe||H<F)throw new RangeError('"value" argument is out of bounds');if(w+D>Q.length)throw new RangeError("Index out of range")}function mt(Q,H,w,D,oe,F){if(w+D>Q.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("Index out of range")}function Ge(Q,H,w,D,oe){return H=+H,w>>>=0,oe||mt(Q,0,w,4),r.write(Q,H,w,D,23,4),w+4}function ut(Q,H,w,D,oe){return H=+H,w>>>=0,oe||mt(Q,0,w,8),r.write(Q,H,w,D,52,8),w+8}d.prototype.slice=function(Q,H){var w=this.length;(Q=~~Q)<0?(Q+=w)<0&&(Q=0):Q>w&&(Q=w),(H=H===void 0?w:~~H)<0?(H+=w)<0&&(H=0):H>w&&(H=w),H<Q&&(H=Q);var D=this.subarray(Q,H);return Object.setPrototypeOf(D,d.prototype),D},d.prototype.readUintLE=d.prototype.readUIntLE=function(Q,H,w){Q>>>=0,H>>>=0,w||Ne(Q,H,this.length);for(var D=this[Q],oe=1,F=0;++F<H&&(oe*=256);)D+=this[Q+F]*oe;return D},d.prototype.readUintBE=d.prototype.readUIntBE=function(Q,H,w){Q>>>=0,H>>>=0,w||Ne(Q,H,this.length);for(var D=this[Q+--H],oe=1;H>0&&(oe*=256);)D+=this[Q+--H]*oe;return D},d.prototype.readUint8=d.prototype.readUInt8=function(Q,H){return Q>>>=0,H||Ne(Q,1,this.length),this[Q]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(Q,H){return Q>>>=0,H||Ne(Q,2,this.length),this[Q]|this[Q+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(Q,H){return Q>>>=0,H||Ne(Q,2,this.length),this[Q]<<8|this[Q+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(Q,H){return Q>>>=0,H||Ne(Q,4,this.length),(this[Q]|this[Q+1]<<8|this[Q+2]<<16)+16777216*this[Q+3]},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(Q,H){return Q>>>=0,H||Ne(Q,4,this.length),16777216*this[Q]+(this[Q+1]<<16|this[Q+2]<<8|this[Q+3])},d.prototype.readIntLE=function(Q,H,w){Q>>>=0,H>>>=0,w||Ne(Q,H,this.length);for(var D=this[Q],oe=1,F=0;++F<H&&(oe*=256);)D+=this[Q+F]*oe;return D>=(oe*=128)&&(D-=Math.pow(2,8*H)),D},d.prototype.readIntBE=function(Q,H,w){Q>>>=0,H>>>=0,w||Ne(Q,H,this.length);for(var D=H,oe=1,F=this[Q+--D];D>0&&(oe*=256);)F+=this[Q+--D]*oe;return F>=(oe*=128)&&(F-=Math.pow(2,8*H)),F},d.prototype.readInt8=function(Q,H){return Q>>>=0,H||Ne(Q,1,this.length),128&this[Q]?-1*(255-this[Q]+1):this[Q]},d.prototype.readInt16LE=function(Q,H){Q>>>=0,H||Ne(Q,2,this.length);var w=this[Q]|this[Q+1]<<8;return 32768&w?4294901760|w:w},d.prototype.readInt16BE=function(Q,H){Q>>>=0,H||Ne(Q,2,this.length);var w=this[Q+1]|this[Q]<<8;return 32768&w?4294901760|w:w},d.prototype.readInt32LE=function(Q,H){return Q>>>=0,H||Ne(Q,4,this.length),this[Q]|this[Q+1]<<8|this[Q+2]<<16|this[Q+3]<<24},d.prototype.readInt32BE=function(Q,H){return Q>>>=0,H||Ne(Q,4,this.length),this[Q]<<24|this[Q+1]<<16|this[Q+2]<<8|this[Q+3]},d.prototype.readFloatLE=function(Q,H){return Q>>>=0,H||Ne(Q,4,this.length),r.read(this,Q,!0,23,4)},d.prototype.readFloatBE=function(Q,H){return Q>>>=0,H||Ne(Q,4,this.length),r.read(this,Q,!1,23,4)},d.prototype.readDoubleLE=function(Q,H){return Q>>>=0,H||Ne(Q,8,this.length),r.read(this,Q,!0,52,8)},d.prototype.readDoubleBE=function(Q,H){return Q>>>=0,H||Ne(Q,8,this.length),r.read(this,Q,!1,52,8)},d.prototype.writeUintLE=d.prototype.writeUIntLE=function(Q,H,w,D){Q=+Q,H>>>=0,w>>>=0,D||tt(this,Q,H,w,Math.pow(2,8*w)-1,0);var oe=1,F=0;for(this[H]=255&Q;++F<w&&(oe*=256);)this[H+F]=Q/oe&255;return H+w},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(Q,H,w,D){Q=+Q,H>>>=0,w>>>=0,D||tt(this,Q,H,w,Math.pow(2,8*w)-1,0);var oe=w-1,F=1;for(this[H+oe]=255&Q;--oe>=0&&(F*=256);)this[H+oe]=Q/F&255;return H+w},d.prototype.writeUint8=d.prototype.writeUInt8=function(Q,H,w){return Q=+Q,H>>>=0,w||tt(this,Q,H,1,255,0),this[H]=255&Q,H+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(Q,H,w){return Q=+Q,H>>>=0,w||tt(this,Q,H,2,65535,0),this[H]=255&Q,this[H+1]=Q>>>8,H+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(Q,H,w){return Q=+Q,H>>>=0,w||tt(this,Q,H,2,65535,0),this[H]=Q>>>8,this[H+1]=255&Q,H+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(Q,H,w){return Q=+Q,H>>>=0,w||tt(this,Q,H,4,4294967295,0),this[H+3]=Q>>>24,this[H+2]=Q>>>16,this[H+1]=Q>>>8,this[H]=255&Q,H+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(Q,H,w){return Q=+Q,H>>>=0,w||tt(this,Q,H,4,4294967295,0),this[H]=Q>>>24,this[H+1]=Q>>>16,this[H+2]=Q>>>8,this[H+3]=255&Q,H+4},d.prototype.writeIntLE=function(Q,H,w,D){if(Q=+Q,H>>>=0,!D){var oe=Math.pow(2,8*w-1);tt(this,Q,H,w,oe-1,-oe)}var F=0,Me=1,We=0;for(this[H]=255&Q;++F<w&&(Me*=256);)Q<0&&We===0&&this[H+F-1]!==0&&(We=1),this[H+F]=(Q/Me|0)-We&255;return H+w},d.prototype.writeIntBE=function(Q,H,w,D){if(Q=+Q,H>>>=0,!D){var oe=Math.pow(2,8*w-1);tt(this,Q,H,w,oe-1,-oe)}var F=w-1,Me=1,We=0;for(this[H+F]=255&Q;--F>=0&&(Me*=256);)Q<0&&We===0&&this[H+F+1]!==0&&(We=1),this[H+F]=(Q/Me|0)-We&255;return H+w},d.prototype.writeInt8=function(Q,H,w){return Q=+Q,H>>>=0,w||tt(this,Q,H,1,127,-128),Q<0&&(Q=255+Q+1),this[H]=255&Q,H+1},d.prototype.writeInt16LE=function(Q,H,w){return Q=+Q,H>>>=0,w||tt(this,Q,H,2,32767,-32768),this[H]=255&Q,this[H+1]=Q>>>8,H+2},d.prototype.writeInt16BE=function(Q,H,w){return Q=+Q,H>>>=0,w||tt(this,Q,H,2,32767,-32768),this[H]=Q>>>8,this[H+1]=255&Q,H+2},d.prototype.writeInt32LE=function(Q,H,w){return Q=+Q,H>>>=0,w||tt(this,Q,H,4,2147483647,-2147483648),this[H]=255&Q,this[H+1]=Q>>>8,this[H+2]=Q>>>16,this[H+3]=Q>>>24,H+4},d.prototype.writeInt32BE=function(Q,H,w){return Q=+Q,H>>>=0,w||tt(this,Q,H,4,2147483647,-2147483648),Q<0&&(Q=4294967295+Q+1),this[H]=Q>>>24,this[H+1]=Q>>>16,this[H+2]=Q>>>8,this[H+3]=255&Q,H+4},d.prototype.writeFloatLE=function(Q,H,w){return Ge(this,Q,H,!0,w)},d.prototype.writeFloatBE=function(Q,H,w){return Ge(this,Q,H,!1,w)},d.prototype.writeDoubleLE=function(Q,H,w){return ut(this,Q,H,!0,w)},d.prototype.writeDoubleBE=function(Q,H,w){return ut(this,Q,H,!1,w)},d.prototype.copy=function(Q,H,w,D){if(!d.isBuffer(Q))throw new TypeError("argument should be a Buffer");if(w||(w=0),D||D===0||(D=this.length),H>=Q.length&&(H=Q.length),H||(H=0),D>0&&D<w&&(D=w),D===w||Q.length===0||this.length===0)return 0;if(H<0)throw new RangeError("targetStart out of bounds");if(w<0||w>=this.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("sourceEnd out of bounds");D>this.length&&(D=this.length),Q.length-H<D-w&&(D=Q.length-H+w);var oe=D-w;return this===Q&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(H,w,D):Uint8Array.prototype.set.call(Q,this.subarray(w,D),H),oe},d.prototype.fill=function(Q,H,w,D){if(typeof Q=="string"){if(typeof H=="string"?(D=H,H=0,w=this.length):typeof w=="string"&&(D=w,w=this.length),D!==void 0&&typeof D!="string")throw new TypeError("encoding must be a string");if(typeof D=="string"&&!d.isEncoding(D))throw new TypeError("Unknown encoding: "+D);if(Q.length===1){var oe=Q.charCodeAt(0);(D==="utf8"&&oe<128||D==="latin1")&&(Q=oe)}}else typeof Q=="number"?Q&=255:typeof Q=="boolean"&&(Q=Number(Q));if(H<0||this.length<H||this.length<w)throw new RangeError("Out of range index");if(w<=H)return this;var F;if(H>>>=0,w=w===void 0?this.length:w>>>0,Q||(Q=0),typeof Q=="number")for(F=H;F<w;++F)this[F]=Q;else{var Me=d.isBuffer(Q)?Q:d.from(Q,D),We=Me.length;if(We===0)throw new TypeError('The value "'+Q+'" is invalid for argument "value"');for(F=0;F<w-H;++F)this[F+H]=Me[F%We]}return this};var Xe=/[^+/0-9A-Za-z-_]/g;function nt(Q,H){var w;H=H||1/0;for(var D=Q.length,oe=null,F=[],Me=0;Me<D;++Me){if((w=Q.charCodeAt(Me))>55295&&w<57344){if(!oe){if(w>56319){(H-=3)>-1&&F.push(239,191,189);continue}if(Me+1===D){(H-=3)>-1&&F.push(239,191,189);continue}oe=w;continue}if(w<56320){(H-=3)>-1&&F.push(239,191,189),oe=w;continue}w=65536+(oe-55296<<10|w-56320)}else oe&&(H-=3)>-1&&F.push(239,191,189);if(oe=null,w<128){if((H-=1)<0)break;F.push(w)}else if(w<2048){if((H-=2)<0)break;F.push(w>>6|192,63&w|128)}else if(w<65536){if((H-=3)<0)break;F.push(w>>12|224,w>>6&63|128,63&w|128)}else{if(!(w<1114112))throw new Error("Invalid code point");if((H-=4)<0)break;F.push(w>>18|240,w>>12&63|128,w>>6&63|128,63&w|128)}}return F}function Ft(Q){return n.toByteArray((function(H){if((H=(H=H.split("=")[0]).trim().replace(Xe,"")).length<2)return"";for(;H.length%4!=0;)H+="=";return H})(Q))}function Xt(Q,H,w,D){for(var oe=0;oe<D&&!(oe+w>=H.length||oe>=Q.length);++oe)H[oe+w]=Q[oe];return oe}function Pe(Q,H){return Q instanceof H||Q!=null&&Q.constructor!=null&&Q.constructor.name!=null&&Q.constructor.name===H.name}function De(Q){return Q!=Q}var dt=(function(){for(var Q="0123456789abcdef",H=new Array(256),w=0;w<16;++w)for(var D=16*w,oe=0;oe<16;++oe)H[D+oe]=Q[w]+Q[oe];return H})()},6877:function(u,e){var t={parseBuffer:function(i){return new n(i).parse()},addBoxProcessor:function(i,o){typeof i=="string"&&typeof o=="function"&&(r.prototype._boxProcessors[i]=o)},createFile:function(){return new n},createBox:function(i,o,l){var d=r.create(i);return o&&o.append(d,l),d},createFullBox:function(i,o,l){var d=t.createBox(i,o,l);return d.version=0,d.flags=0,d},Utils:{}};t.Utils.dataViewToString=function(i,o){var l=o||"utf-8";if(typeof TextDecoder<"u")return new TextDecoder(l).decode(i);var d=[],c=0;if(l==="utf-8")for(;c<i.byteLength;){var g=i.getUint8(c++);g<128||(g<224?(g=(31&g)<<6,g|=63&i.getUint8(c++)):g<240?(g=(15&g)<<12,g|=(63&i.getUint8(c++))<<6,g|=63&i.getUint8(c++)):(g=(7&g)<<18,g|=(63&i.getUint8(c++))<<12,g|=(63&i.getUint8(c++))<<6,g|=63&i.getUint8(c++))),d.push(String.fromCharCode(g))}else for(;c<i.byteLength;)d.push(String.fromCharCode(i.getUint8(c++)));return d.join("")},t.Utils.utf8ToByteArray=function(i){var o,l;if(typeof TextEncoder<"u")o=new TextEncoder().encode(i);else for(o=[],l=0;l<i.length;++l){var d=i.charCodeAt(l);d<128?o.push(d):d<2048?(o.push(192|d>>6),o.push(128|63&d)):d<65536?(o.push(224|d>>12),o.push(128|63&d>>6),o.push(128|63&d)):(o.push(240|d>>18),o.push(128|63&d>>12),o.push(128|63&d>>6),o.push(128|63&d))}return o},t.Utils.appendBox=function(i,o,l){if(o._offset=i._cursor.offset,o._root=i._root?i._root:i,o._raw=i._raw,o._parent=i,l!==-1)if(l!=null){var d,c=-1;if(typeof l=="number")c=l;else{if(typeof l=="string")d=l;else{if(typeof l!="object"||!l.type)return void i.boxes.push(o);d=l.type}for(var g=0;g<i.boxes.length;g++)if(d===i.boxes[g].type){c=g+1;break}}i.boxes.splice(c,0,o)}else i.boxes.push(o)},e.parseBuffer=t.parseBuffer,e.addBoxProcessor=t.addBoxProcessor,e.createFile=t.createFile,e.createBox=t.createBox,e.createFullBox=t.createFullBox,e.Utils=t.Utils,t.Cursor=function(i){this.offset=i===void 0?0:i};var n=function(i){this._cursor=new t.Cursor,this.boxes=[],i&&(this._raw=new DataView(i))};n.prototype.fetch=function(i){var o=this.fetchAll(i,!0);return o.length?o[0]:null},n.prototype.fetchAll=function(i,o){var l=[];return n._sweep.call(this,i,l,o),l},n.prototype.parse=function(){for(this._cursor.offset=0,this.boxes=[];this._cursor.offset<this._raw.byteLength;){var i=r.parse(this);if(i.type===void 0)break;this.boxes.push(i)}return this},n._sweep=function(i,o,l){for(var d in this.type&&this.type==i&&o.push(this),this.boxes){if(o.length&&l)return;n._sweep.call(this.boxes[d],i,o,l)}},n.prototype.write=function(){var i,o=0;for(i=0;i<this.boxes.length;i++)o+=this.boxes[i].getLength(!1);var l=new Uint8Array(o);for(this._rawo=new DataView(l.buffer),this.bytes=l,this._cursor.offset=0,i=0;i<this.boxes.length;i++)this.boxes[i].write();return l.buffer},n.prototype.append=function(i,o){t.Utils.appendBox(this,i,o)};var r=function(){this._cursor=new t.Cursor};r.parse=function(i){var o=new r;return o._offset=i._cursor.offset,o._root=i._root?i._root:i,o._raw=i._raw,o._parent=i,o._parseBox(),i._cursor.offset=o._raw.byteOffset+o._raw.byteLength,o},r.create=function(i){var o=new r;return o.type=i,o.boxes=[],o},r.prototype._boxContainers=["dinf","edts","mdia","meco","mfra","minf","moof","moov","mvex","stbl","strk","traf","trak","tref","udta","vttc","sinf","schi","encv","enca","meta","grpl","prsl"],r.prototype._boxProcessors={},r.prototype._procField=function(i,o,l){this._parsing?this[i]=this._readField(o,l):this._writeField(o,l,this[i])},r.prototype._procFieldArray=function(i,o,l,d){var c;if(this._parsing)for(this[i]=[],c=0;c<o;c++)this[i][c]=this._readField(l,d);else for(c=0;c<this[i].length;c++)this._writeField(l,d,this[i][c])},r.prototype._procFullBox=function(){this._procField("version","uint",8),this._procField("flags","uint",24)},r.prototype._procEntries=function(i,o,l){var d;if(this._parsing)for(this[i]=[],d=0;d<o;d++)this[i].push({}),l.call(this,this[i][d]);else for(d=0;d<o;d++)l.call(this,this[i][d])},r.prototype._procSubEntries=function(i,o,l,d){var c;if(this._parsing)for(i[o]=[],c=0;c<l;c++)i[o].push({}),d.call(this,i[o][c]);else for(c=0;c<l;c++)d.call(this,i[o][c])},r.prototype._procEntryField=function(i,o,l,d){this._parsing?i[o]=this._readField(l,d):this._writeField(l,d,i[o])},r.prototype._procSubBoxes=function(i,o){var l;if(this._parsing)for(this[i]=[],l=0;l<o;l++)this[i].push(r.parse(this));else for(l=0;l<o;l++)this._rawo?this[i][l].write():this.size+=this[i][l].getLength()},r.prototype._readField=function(i,o){switch(i){case"uint":return this._readUint(o);case"int":return this._readInt(o);case"template":return this._readTemplate(o);case"string":return o===-1?this._readTerminatedString():this._readString(o);case"data":return this._readData(o);case"utf8":return this._readUTF8String();case"utf8string":return this._readUTF8TerminatedString();default:return-1}},r.prototype._readInt=function(i){var o=null,l=this._cursor.offset-this._raw.byteOffset;switch(i){case 8:o=this._raw.getInt8(l);break;case 16:o=this._raw.getInt16(l);break;case 32:o=this._raw.getInt32(l);break;case 64:var d=this._raw.getInt32(l),c=this._raw.getInt32(l+4);o=d*Math.pow(2,32)+c}return this._cursor.offset+=i>>3,o},r.prototype._readUint=function(i){var o,l,d=null,c=this._cursor.offset-this._raw.byteOffset;switch(i){case 8:d=this._raw.getUint8(c);break;case 16:d=this._raw.getUint16(c);break;case 24:d=((o=this._raw.getUint16(c))<<8)+(l=this._raw.getUint8(c+2));break;case 32:d=this._raw.getUint32(c);break;case 64:o=this._raw.getUint32(c),l=this._raw.getUint32(c+4),d=o*Math.pow(2,32)+l}return this._cursor.offset+=i>>3,d},r.prototype._readString=function(i){for(var o="",l=0;l<i;l++){var d=this._readUint(8);o+=String.fromCharCode(d)}return o},r.prototype._readTemplate=function(i){return this._readUint(i/2)+this._readUint(i/2)/Math.pow(2,i/2)},r.prototype._readTerminatedString=function(){for(var i="";this._cursor.offset-this._offset<this._raw.byteLength;){var o=this._readUint(8);if(o===0)break;i+=String.fromCharCode(o)}return i},r.prototype._readData=function(i){var o=i>0?i:this._raw.byteLength-(this._cursor.offset-this._offset);if(o>0){var l=new Uint8Array(this._raw.buffer,this._cursor.offset,o);return this._cursor.offset+=o,l}return null},r.prototype._readUTF8String=function(){var i=this._raw.byteLength-(this._cursor.offset-this._offset),o=null;return i>0&&(o=new DataView(this._raw.buffer,this._cursor.offset,i),this._cursor.offset+=i),o&&t.Utils.dataViewToString(o)},r.prototype._readUTF8TerminatedString=function(){var i=this._raw.byteLength-(this._cursor.offset-this._offset),o=null;if(i>0){var l;for(o=new DataView(this._raw.buffer,this._cursor.offset,i),l=0;l<i&&o.getUint8(l)!==0;l++);o=new DataView(this._raw.buffer,this._cursor.offset,l),this._cursor.offset+=Math.min(l+1,i)}return o&&t.Utils.dataViewToString(o)},r.prototype._parseBox=function(){if(this._parsing=!0,this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)this._root._incomplete=!0;else{switch(this._procField("size","uint",32),this._procField("type","string",4),this.size===1&&this._procField("largesize","uint",64),this.type==="uuid"&&this._procFieldArray("usertype",16,"uint",8),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}this._incomplete||(this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),this._boxContainers.indexOf(this.type)!==-1?this._parseContainerBox():this._data=this._readData())}},r.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},r.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset<this._raw.byteLength;)this.boxes.push(r.parse(this))},r.prototype.append=function(i,o){t.Utils.appendBox(this,i,o)},r.prototype.getLength=function(){if(this._parsing=!1,this._rawo=null,this.size=0,this._procField("size","uint",32),this._procField("type","string",4),this.size===1&&this._procField("largesize","uint",64),this.type==="uuid"&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),this._boxContainers.indexOf(this.type)!==-1)for(var i=0;i<this.boxes.length;i++)this.size+=this.boxes[i].getLength();return this._data&&this._writeData(this._data),this.size},r.prototype.write=function(){switch(this._parsing=!1,this._cursor.offset=this._parent._cursor.offset,this.size){case 0:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.parent._rawo.byteLength-this._cursor.offset);break;case 1:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.largesize);break;default:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.size)}if(this._procField("size","uint",32),this._procField("type","string",4),this.size===1&&this._procField("largesize","uint",64),this.type==="uuid"&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),this._boxContainers.indexOf(this.type)!==-1)for(var i=0;i<this.boxes.length;i++)this.boxes[i].write();return this._data&&this._writeData(this._data),this._parent._cursor.offset+=this.size,this.size},r.prototype._writeInt=function(i,o){if(this._rawo){var l=this._cursor.offset-this._rawo.byteOffset;switch(i){case 8:this._rawo.setInt8(l,o);break;case 16:this._rawo.setInt16(l,o);break;case 32:this._rawo.setInt32(l,o);break;case 64:var d=Math.floor(o/Math.pow(2,32)),c=o-d*Math.pow(2,32);this._rawo.setUint32(l,d),this._rawo.setUint32(l+4,c)}this._cursor.offset+=i>>3}else this.size+=i>>3},r.prototype._writeUint=function(i,o){if(this._rawo){var l,d,c=this._cursor.offset-this._rawo.byteOffset;switch(i){case 8:this._rawo.setUint8(c,o);break;case 16:this._rawo.setUint16(c,o);break;case 24:l=(16776960&o)>>8,d=255&o,this._rawo.setUint16(c,l),this._rawo.setUint8(c+2,d);break;case 32:this._rawo.setUint32(c,o);break;case 64:d=o-(l=Math.floor(o/Math.pow(2,32)))*Math.pow(2,32),this._rawo.setUint32(c,l),this._rawo.setUint32(c+4,d)}this._cursor.offset+=i>>3}else this.size+=i>>3},r.prototype._writeString=function(i,o){for(var l=0;l<i;l++)this._writeUint(8,o.charCodeAt(l))},r.prototype._writeTerminatedString=function(i){if(i.length!==0){for(var o=0;o<i.length;o++)this._writeUint(8,i.charCodeAt(o));this._writeUint(8,0)}},r.prototype._writeTemplate=function(i,o){var l=Math.floor(o),d=(o-l)*Math.pow(2,i/2);this._writeUint(i/2,l),this._writeUint(i/2,d)},r.prototype._writeData=function(i){if(i)if(this._rawo){if(i instanceof Array){for(var o=this._cursor.offset-this._rawo.byteOffset,l=0;l<i.length;l++)this._rawo.setInt8(o+l,i[l]);this._cursor.offset+=i.length}i instanceof Uint8Array&&(this._root.bytes.set(i,this._cursor.offset),this._cursor.offset+=i.length)}else this.size+=i.length},r.prototype._writeUTF8String=function(i){var o=t.Utils.utf8ToByteArray(i);if(this._rawo)for(var l=new DataView(this._rawo.buffer,this._cursor.offset,o.length),d=0;d<o.length;d++)l.setUint8(d,o[d]);else this.size+=o.length},r.prototype._writeField=function(i,o,l){switch(i){case"uint":this._writeUint(o,l);break;case"int":this._writeInt(o,l);break;case"template":this._writeTemplate(o,l);break;case"string":o==-1?this._writeTerminatedString(l):this._writeString(o,l);break;case"data":this._writeData(l);break;case"utf8":this._writeUTF8String(l)}},r.prototype._boxProcessors.ardi=function(){this._procFullBox(),this._procField("audio_rendering_indication","uint",8)},r.prototype._boxProcessors.avc1=r.prototype._boxProcessors.avc2=r.prototype._boxProcessors.avc3=r.prototype._boxProcessors.avc4=r.prototype._boxProcessors.hvc1=r.prototype._boxProcessors.hev1=r.prototype._boxProcessors.encv=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procField("pre_defined1","uint",16),this._procField("reserved2","uint",16),this._procFieldArray("pre_defined2",3,"uint",32),this._procField("width","uint",16),this._procField("height","uint",16),this._procField("horizresolution","template",32),this._procField("vertresolution","template",32),this._procField("reserved3","uint",32),this._procField("frame_count","uint",16),this._procFieldArray("compressorname",32,"uint",8),this._procField("depth","uint",16),this._procField("pre_defined3","int",16),this._procField("config","data",-1)},r.prototype._boxProcessors.ctts=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(i){this._procEntryField(i,"sample_count","uint",32),this._procEntryField(i,"sample_offset",this.version===1?"int":"uint",32)}))},r.prototype._boxProcessors.dref=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},r.prototype._boxProcessors.elng=function(){this._procFullBox(),this._procField("extended_language","utf8string")},r.prototype._boxProcessors.elst=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(i){this._procEntryField(i,"segment_duration","uint",this.version===1?64:32),this._procEntryField(i,"media_time","int",this.version===1?64:32),this._procEntryField(i,"media_rate_integer","int",16),this._procEntryField(i,"media_rate_fraction","int",16)}))},r.prototype._boxProcessors.emsg=function(){this._procFullBox(),this.version==1?(this._procField("timescale","uint",32),this._procField("presentation_time","uint",64),this._procField("event_duration","uint",32),this._procField("id","uint",32),this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1)):(this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1),this._procField("timescale","uint",32),this._procField("presentation_time_delta","uint",32),this._procField("event_duration","uint",32),this._procField("id","uint",32)),this._procField("message_data","data",-1)},r.prototype._boxProcessors.free=r.prototype._boxProcessors.skip=function(){this._procField("data","data",-1)},r.prototype._boxProcessors.frma=function(){this._procField("data_format","uint",32)},r.prototype._boxProcessors.ftyp=r.prototype._boxProcessors.styp=function(){this._procField("major_brand","string",4),this._procField("minor_version","uint",32);var i=-1;this._parsing&&(i=(this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset))/4),this._procFieldArray("compatible_brands",i,"string",4)},r.prototype._boxProcessors.hdlr=function(){this._procFullBox(),this._procField("pre_defined","uint",32),this._procField("handler_type","string",4),this._procFieldArray("reserved",3,"uint",32),this._procField("name","string",-1)},r.prototype._boxProcessors.imda=function(){this._procField("imda_identifier","uint",32),this._procField("data","data",-1)},r.prototype._boxProcessors.kind=function(){this._procFullBox(),this._procField("schemeURI","utf8string"),this._procField("value","utf8string")},r.prototype._boxProcessors.labl=function(){this._procFullBox(),this.is_group_label=!!(1&this.flags),this._procField("label_id","uint",16),this._procField("language","utf8string"),this._procField("label","utf8string")},r.prototype._boxProcessors.mdat=function(){this._procField("data","data",-1)},r.prototype._boxProcessors.mdhd=function(){this._procFullBox(),this._procField("creation_time","uint",this.version==1?64:32),this._procField("modification_time","uint",this.version==1?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",this.version==1?64:32),this._parsing||typeof this.language!="string"||(this.language=this.language.charCodeAt(0)-96<<10|this.language.charCodeAt(1)-96<<5|this.language.charCodeAt(2)-96),this._procField("language","uint",16),this._parsing&&(this.language=String.fromCharCode(96+(this.language>>10&31),96+(this.language>>5&31),96+(31&this.language))),this._procField("pre_defined","uint",16)},r.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",this.version==1?64:32)},r.prototype._boxProcessors.meta=function(){this._procFullBox()},r.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},r.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},r.prototype._boxProcessors.mp4a=r.prototype._boxProcessors.enca=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procField("channelcount","uint",16),this._procField("samplesize","uint",16),this._procField("pre_defined","uint",16),this._procField("reserved3","uint",16),this._procField("samplerate","template",32),this._procField("esds","data",-1)},r.prototype._boxProcessors.mvhd=function(){this._procFullBox(),this._procField("creation_time","uint",this.version==1?64:32),this._procField("modification_time","uint",this.version==1?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",this.version==1?64:32),this._procField("rate","template",32),this._procField("volume","template",16),this._procField("reserved1","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procFieldArray("matrix",9,"template",32),this._procFieldArray("pre_defined",6,"uint",32),this._procField("next_track_ID","uint",32)},r.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},r.prototype._boxProcessors.prft=function(){this._procFullBox(),this._procField("reference_track_ID","uint",32),this._procField("ntp_timestamp_sec","uint",32),this._procField("ntp_timestamp_frac","uint",32),this._procField("media_time","uint",this.version==1?64:32)},r.prototype._boxProcessors.prsl=function(){this._procFullBox(),this._procField("group_id","uint",32),this._procField("num_entities_in_group","uint",32),this._procEntries("entities",this.num_entities_in_group,(function(i){this._procEntryField(i,"entity_id","uint",32)})),4096&this.flags&&this._procField("preselection_tag","utf8string"),8192&this.flags&&this._procField("selection_priority","uint",8),16384&this.flags&&this._procField("interleaving_tag","utf8string")},r.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},r.prototype._boxProcessors.schm=function(){this._procFullBox(),this._procField("scheme_type","uint",32),this._procField("scheme_version","uint",32),1&this.flags&&this._procField("scheme_uri","string",-1)},r.prototype._boxProcessors.sdtp=function(){this._procFullBox();var i=-1;this._parsing&&(i=this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset)),this._procFieldArray("sample_dependency_table",i,"uint",8)},r.prototype._boxProcessors.sidx=function(){this._procFullBox(),this._procField("reference_ID","uint",32),this._procField("timescale","uint",32),this._procField("earliest_presentation_time","uint",this.version==1?64:32),this._procField("first_offset","uint",this.version==1?64:32),this._procField("reserved","uint",16),this._procField("reference_count","uint",16),this._procEntries("references",this.reference_count,(function(i){this._parsing||(i.reference=(1&i.reference_type)<<31,i.reference|=2147483647&i.referenced_size,i.sap=(1&i.starts_with_SAP)<<31,i.sap|=(3&i.SAP_type)<<28,i.sap|=268435455&i.SAP_delta_time),this._procEntryField(i,"reference","uint",32),this._procEntryField(i,"subsegment_duration","uint",32),this._procEntryField(i,"sap","uint",32),this._parsing&&(i.reference_type=i.reference>>31&1,i.referenced_size=2147483647&i.reference,i.starts_with_SAP=i.sap>>31&1,i.SAP_type=i.sap>>28&7,i.SAP_delta_time=268435455&i.sap)}))},r.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},r.prototype._boxProcessors.ssix=function(){this._procFullBox(),this._procField("subsegment_count","uint",32),this._procEntries("subsegments",this.subsegment_count,(function(i){this._procEntryField(i,"ranges_count","uint",32),this._procSubEntries(i,"ranges",i.ranges_count,(function(o){this._procEntryField(o,"level","uint",8),this._procEntryField(o,"range_size","uint",24)}))}))},r.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},r.prototype._boxProcessors.sttg=function(){this._procField("settings","utf8")},r.prototype._boxProcessors.stts=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(i){this._procEntryField(i,"sample_count","uint",32),this._procEntryField(i,"sample_delta","uint",32)}))},r.prototype._boxProcessors.subs=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(i){this._procEntryField(i,"sample_delta","uint",32),this._procEntryField(i,"subsample_count","uint",16),this._procSubEntries(i,"subsamples",i.subsample_count,(function(o){this._procEntryField(o,"subsample_size","uint",this.version===1?32:16),this._procEntryField(o,"subsample_priority","uint",8),this._procEntryField(o,"discardable","uint",8),this._procEntryField(o,"codec_specific_parameters","uint",32)}))}))},r.prototype._boxProcessors.tenc=function(){this._procFullBox(),this._procField("default_IsEncrypted","uint",24),this._procField("default_IV_size","uint",8),this._procFieldArray("default_KID",16,"uint",8)},r.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",this.version==1?64:32)},r.prototype._boxProcessors.tfhd=function(){this._procFullBox(),this._procField("track_ID","uint",32),1&this.flags&&this._procField("base_data_offset","uint",64),2&this.flags&&this._procField("sample_description_offset","uint",32),8&this.flags&&this._procField("default_sample_duration","uint",32),16&this.flags&&this._procField("default_sample_size","uint",32),32&this.flags&&this._procField("default_sample_flags","uint",32)},r.prototype._boxProcessors.tfra=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._parsing||(this.reserved=0,this.reserved|=(48&this.length_size_of_traf_num)<<4,this.reserved|=(12&this.length_size_of_trun_num)<<2,this.reserved|=3&this.length_size_of_sample_num),this._procField("reserved","uint",32),this._parsing&&(this.length_size_of_traf_num=(48&this.reserved)>>4,this.length_size_of_trun_num=(12&this.reserved)>>2,this.length_size_of_sample_num=3&this.reserved),this._procField("number_of_entry","uint",32),this._procEntries("entries",this.number_of_entry,(function(i){this._procEntryField(i,"time","uint",this.version===1?64:32),this._procEntryField(i,"moof_offset","uint",this.version===1?64:32),this._procEntryField(i,"traf_number","uint",8*(this.length_size_of_traf_num+1)),this._procEntryField(i,"trun_number","uint",8*(this.length_size_of_trun_num+1)),this._procEntryField(i,"sample_number","uint",8*(this.length_size_of_sample_num+1))}))},r.prototype._boxProcessors.tkhd=function(){this._procFullBox(),this._procField("creation_time","uint",this.version==1?64:32),this._procField("modification_time","uint",this.version==1?64:32),this._procField("track_ID","uint",32),this._procField("reserved1","uint",32),this._procField("duration","uint",this.version==1?64:32),this._procFieldArray("reserved2",2,"uint",32),this._procField("layer","uint",16),this._procField("alternate_group","uint",16),this._procField("volume","template",16),this._procField("reserved3","uint",16),this._procFieldArray("matrix",9,"template",32),this._procField("width","template",32),this._procField("height","template",32)},r.prototype._boxProcessors.trex=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._procField("default_sample_description_index","uint",32),this._procField("default_sample_duration","uint",32),this._procField("default_sample_size","uint",32),this._procField("default_sample_flags","uint",32)},r.prototype._boxProcessors.trun=function(){this._procFullBox(),this._procField("sample_count","uint",32),1&this.flags&&this._procField("data_offset","int",32),4&this.flags&&this._procField("first_sample_flags","uint",32),this._procEntries("samples",this.sample_count,(function(i){256&this.flags&&this._procEntryField(i,"sample_duration","uint",32),512&this.flags&&this._procEntryField(i,"sample_size","uint",32),1024&this.flags&&this._procEntryField(i,"sample_flags","uint",32),2048&this.flags&&this._procEntryField(i,"sample_composition_time_offset",this.version===1?"int":"uint",32)}))},r.prototype._boxProcessors["url "]=r.prototype._boxProcessors["urn "]=function(){this._procFullBox(),this.type==="urn "&&this._procField("name","string",-1),this._procField("location","string",-1)},r.prototype._boxProcessors.vlab=function(){this._procField("source_label","utf8")},r.prototype._boxProcessors.vmhd=function(){this._procFullBox(),this._procField("graphicsmode","uint",16),this._procFieldArray("opcolor",3,"uint",16)},r.prototype._boxProcessors.vttC=function(){this._procField("config","utf8")},r.prototype._boxProcessors.vtte=function(){}},9826:function(u){var e,t=typeof Reflect=="object"?Reflect:null,n=t&&typeof t.apply=="function"?t.apply:function(L,K,Z){return Function.prototype.apply.call(L,K,Z)};e=t&&typeof t.ownKeys=="function"?t.ownKeys:Object.getOwnPropertySymbols?function(L){return Object.getOwnPropertyNames(L).concat(Object.getOwnPropertySymbols(L))}:function(L){return Object.getOwnPropertyNames(L)};var r=Number.isNaN||function(L){return L!=L};function i(){i.init.call(this)}u.exports=i,u.exports.once=function(L,K){return new Promise((function(Z,ae){function pe(ke){L.removeListener(K,xe),ae(ke)}function xe(){typeof L.removeListener=="function"&&L.removeListener("error",pe),Z([].slice.call(arguments))}_(L,K,xe,{once:!0}),K!=="error"&&(function(ke,Y){typeof ke.on=="function"&&_(ke,"error",Y,{once:!0})})(L,pe)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function l(L){if(typeof L!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof L)}function d(L){return L._maxListeners===void 0?i.defaultMaxListeners:L._maxListeners}function c(L,K,Z,ae){var pe,xe,ke,Y;if(l(Z),(xe=L._events)===void 0?(xe=L._events=Object.create(null),L._eventsCount=0):(xe.newListener!==void 0&&(L.emit("newListener",K,Z.listener?Z.listener:Z),xe=L._events),ke=xe[K]),ke===void 0)ke=xe[K]=Z,++L._eventsCount;else if(typeof ke=="function"?ke=xe[K]=ae?[Z,ke]:[ke,Z]:ae?ke.unshift(Z):ke.push(Z),(pe=d(L))>0&&ke.length>pe&&!ke.warned){ke.warned=!0;var J=new Error("Possible EventEmitter memory leak detected. "+ke.length+" "+String(K)+" listeners added. Use emitter.setMaxListeners() to increase limit");J.name="MaxListenersExceededWarning",J.emitter=L,J.type=K,J.count=ke.length,Y=J,console&&console.warn&&console.warn(Y)}return L}function g(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(L,K,Z){var ae={fired:!1,wrapFn:void 0,target:L,type:K,listener:Z},pe=g.bind(ae);return pe.listener=Z,ae.wrapFn=pe,pe}function h(L,K,Z){var ae=L._events;if(ae===void 0)return[];var pe=ae[K];return pe===void 0?[]:typeof pe=="function"?Z?[pe.listener||pe]:[pe]:Z?(function(xe){for(var ke=new Array(xe.length),Y=0;Y<ke.length;++Y)ke[Y]=xe[Y].listener||xe[Y];return ke})(pe):E(pe,pe.length)}function y(L){var K=this._events;if(K!==void 0){var Z=K[L];if(typeof Z=="function")return 1;if(Z!==void 0)return Z.length}return 0}function E(L,K){for(var Z=new Array(K),ae=0;ae<K;++ae)Z[ae]=L[ae];return Z}function _(L,K,Z,ae){if(typeof L.on=="function")ae.once?L.once(K,Z):L.on(K,Z);else{if(typeof L.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof L);L.addEventListener(K,(function pe(xe){ae.once&&L.removeEventListener(K,pe),Z(xe)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(L){if(typeof L!="number"||L<0||r(L))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+L+".");o=L}}),i.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(L){if(typeof L!="number"||L<0||r(L))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+L+".");return this._maxListeners=L,this},i.prototype.getMaxListeners=function(){return d(this)},i.prototype.emit=function(L){for(var K=[],Z=1;Z<arguments.length;Z++)K.push(arguments[Z]);var ae=L==="error",pe=this._events;if(pe!==void 0)ae=ae&&pe.error===void 0;else if(!ae)return!1;if(ae){var xe;if(K.length>0&&(xe=K[0]),xe instanceof Error)throw xe;var ke=new Error("Unhandled error."+(xe?" ("+xe.message+")":""));throw ke.context=xe,ke}var Y=pe[L];if(Y===void 0)return!1;if(typeof Y=="function")n(Y,this,K);else{var J=Y.length,he=E(Y,J);for(Z=0;Z<J;++Z)n(he[Z],this,K)}return!0},i.prototype.addListener=function(L,K){return c(this,L,K,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(L,K){return c(this,L,K,!0)},i.prototype.once=function(L,K){return l(K),this.on(L,f(this,L,K)),this},i.prototype.prependOnceListener=function(L,K){return l(K),this.prependListener(L,f(this,L,K)),this},i.prototype.removeListener=function(L,K){var Z,ae,pe,xe,ke;if(l(K),(ae=this._events)===void 0)return this;if((Z=ae[L])===void 0)return this;if(Z===K||Z.listener===K)--this._eventsCount==0?this._events=Object.create(null):(delete ae[L],ae.removeListener&&this.emit("removeListener",L,Z.listener||K));else if(typeof Z!="function"){for(pe=-1,xe=Z.length-1;xe>=0;xe--)if(Z[xe]===K||Z[xe].listener===K){ke=Z[xe].listener,pe=xe;break}if(pe<0)return this;pe===0?Z.shift():(function(Y,J){for(;J+1<Y.length;J++)Y[J]=Y[J+1];Y.pop()})(Z,pe),Z.length===1&&(ae[L]=Z[0]),ae.removeListener!==void 0&&this.emit("removeListener",L,ke||K)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(L){var K,Z,ae;if((Z=this._events)===void 0)return this;if(Z.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):Z[L]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete Z[L]),this;if(arguments.length===0){var pe,xe=Object.keys(Z);for(ae=0;ae<xe.length;++ae)(pe=xe[ae])!=="removeListener"&&this.removeAllListeners(pe);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(K=Z[L])=="function")this.removeListener(L,K);else if(K!==void 0)for(ae=K.length-1;ae>=0;ae--)this.removeListener(L,K[ae]);return this},i.prototype.listeners=function(L){return h(this,L,!0)},i.prototype.rawListeners=function(L){return h(this,L,!1)},i.listenerCount=function(L,K){return typeof L.listenerCount=="function"?L.listenerCount(K):y.call(L,K)},i.prototype.listenerCount=y,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},7316:function(u){u.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;i--!=0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;i--!=0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!=0;){var l=o[i];if(!e(t[l],n[l]))return!1}return!0}return t!=t&&n!=n}},7986:function(u,e){e.read=function(t,n,r,i,o){var l,d,c=8*o-i-1,g=(1<<c)-1,f=g>>1,h=-7,y=r?o-1:0,E=r?-1:1,_=t[n+y];for(y+=E,l=_&(1<<-h)-1,_>>=-h,h+=c;h>0;l=256*l+t[n+y],y+=E,h-=8);for(d=l&(1<<-h)-1,l>>=-h,h+=i;h>0;d=256*d+t[n+y],y+=E,h-=8);if(l===0)l=1-f;else{if(l===g)return d?NaN:1/0*(_?-1:1);d+=Math.pow(2,i),l-=f}return(_?-1:1)*d*Math.pow(2,l-i)},e.write=function(t,n,r,i,o,l){var d,c,g,f=8*l-o-1,h=(1<<f)-1,y=h>>1,E=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=i?0:l-1,L=i?1:-1,K=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(c=isNaN(n)?1:0,d=h):(d=Math.floor(Math.log(n)/Math.LN2),n*(g=Math.pow(2,-d))<1&&(d--,g*=2),(n+=d+y>=1?E/g:E*Math.pow(2,1-y))*g>=2&&(d++,g/=2),d+y>=h?(c=0,d=h):d+y>=1?(c=(n*g-1)*Math.pow(2,o),d+=y):(c=n*Math.pow(2,y-1)*Math.pow(2,o),d=0));o>=8;t[r+_]=255&c,_+=L,c/=256,o-=8);for(d=d<<o|c,f+=o;f>0;t[r+_]=255&d,_+=L,d/=256,f-=8);t[r+_-L]|=128*K}},5474:function(u,e,t){(function(n){n.parser=function(w,D){return new o(w,D)},n.SAXParser=o,n.SAXStream=d,n.createStream=function(w,D){return new d(w,D)},n.MAX_BUFFER_LENGTH=65536;var r,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function o(w,D){if(!(this instanceof o))return new o(w,D);var oe=this;(function(F){for(var Me=0,We=i.length;Me<We;Me++)F[i[Me]]=""})(oe),oe.q=oe.c="",oe.bufferCheckPosition=n.MAX_BUFFER_LENGTH,oe.opt=D||{},oe.opt.lowercase=oe.opt.lowercase||oe.opt.lowercasetags,oe.looseCase=oe.opt.lowercase?"toLowerCase":"toUpperCase",oe.tags=[],oe.closed=oe.closedRoot=oe.sawRoot=!1,oe.tag=oe.error=null,oe.strict=!!w,oe.noscript=!(!w&&!oe.opt.noscript),oe.state=Ae.BEGIN,oe.strictEntities=oe.opt.strictEntities,oe.ENTITIES=oe.strictEntities?Object.create(n.XML_ENTITIES):Object.create(n.ENTITIES),oe.attribList=[],oe.opt.xmlns&&(oe.ns=Object.create(Z)),oe.trackPosition=oe.opt.position!==!1,oe.trackPosition&&(oe.position=oe.line=oe.column=0),Be(oe,"onready")}n.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(w){function D(){}return D.prototype=w,new D}),Object.keys||(Object.keys=function(w){var D=[];for(var oe in w)w.hasOwnProperty(oe)&&D.push(oe);return D}),o.prototype={end:function(){ut(this)},write:function(w){var D=this;if(this.error)throw this.error;if(D.closed)return Ge(D,"Cannot write after close. Assign an onready handler.");if(w===null)return ut(D);typeof w=="object"&&(w=w.toString());for(var oe=0,F="";F=H(w,oe++),D.c=F,F;)switch(D.trackPosition&&(D.position++,F===`
|
|
41
|
+
`?(D.line++,D.column=0):D.column++),D.state){case Ae.BEGIN:if(D.state=Ae.BEGIN_WHITESPACE,F==="\uFEFF")continue;Q(D,F);continue;case Ae.BEGIN_WHITESPACE:Q(D,F);continue;case Ae.TEXT:if(D.sawRoot&&!D.closedRoot){for(var Me=oe-1;F&&F!=="<"&&F!=="&";)(F=H(w,oe++))&&D.trackPosition&&(D.position++,F===`
|
|
42
|
+
`?(D.line++,D.column=0):D.column++);D.textNode+=w.substring(Me,oe-1)}F!=="<"||D.sawRoot&&D.closedRoot&&!D.strict?(!he(c,F)||D.sawRoot&&!D.closedRoot||Xe(D,"Text data outside of root node."),F==="&"?D.state=Ae.TEXT_ENTITY:D.textNode+=F):(D.state=Ae.OPEN_WAKA,D.startTagPosition=D.position);continue;case Ae.SCRIPT:F==="<"?D.state=Ae.SCRIPT_ENDING:D.script+=F;continue;case Ae.SCRIPT_ENDING:F==="/"?D.state=Ae.CLOSE_TAG:(D.script+="<"+F,D.state=Ae.SCRIPT);continue;case Ae.OPEN_WAKA:if(F==="!")D.state=Ae.SGML_DECL,D.sgmlDecl="";else if(!J(c,F))if(J(ae,F))D.state=Ae.OPEN_TAG,D.tagName=F;else if(F==="/")D.state=Ae.CLOSE_TAG,D.tagName="";else if(F==="?")D.state=Ae.PROC_INST,D.procInstName=D.procInstBody="";else{if(Xe(D,"Unencoded <"),D.startTagPosition+1<D.position){var We=D.position-D.startTagPosition;F=new Array(We).join(" ")+F}D.textNode+="<"+F,D.state=Ae.TEXT}continue;case Ae.SGML_DECL:(D.sgmlDecl+F).toUpperCase()===E?(Ne(D,"onopencdata"),D.state=Ae.CDATA,D.sgmlDecl="",D.cdata=""):D.sgmlDecl+F==="--"?(D.state=Ae.COMMENT,D.comment="",D.sgmlDecl=""):(D.sgmlDecl+F).toUpperCase()===_?(D.state=Ae.DOCTYPE,(D.doctype||D.sawRoot)&&Xe(D,"Inappropriately located doctype declaration"),D.doctype="",D.sgmlDecl=""):F===">"?(Ne(D,"onsgmldeclaration",D.sgmlDecl),D.sgmlDecl="",D.state=Ae.TEXT):(J(h,F)&&(D.state=Ae.SGML_DECL_QUOTED),D.sgmlDecl+=F);continue;case Ae.SGML_DECL_QUOTED:F===D.q&&(D.state=Ae.SGML_DECL,D.q=""),D.sgmlDecl+=F;continue;case Ae.DOCTYPE:F===">"?(D.state=Ae.TEXT,Ne(D,"ondoctype",D.doctype),D.doctype=!0):(D.doctype+=F,F==="["?D.state=Ae.DOCTYPE_DTD:J(h,F)&&(D.state=Ae.DOCTYPE_QUOTED,D.q=F));continue;case Ae.DOCTYPE_QUOTED:D.doctype+=F,F===D.q&&(D.q="",D.state=Ae.DOCTYPE);continue;case Ae.DOCTYPE_DTD:D.doctype+=F,F==="]"?D.state=Ae.DOCTYPE:J(h,F)&&(D.state=Ae.DOCTYPE_DTD_QUOTED,D.q=F);continue;case Ae.DOCTYPE_DTD_QUOTED:D.doctype+=F,F===D.q&&(D.state=Ae.DOCTYPE_DTD,D.q="");continue;case Ae.COMMENT:F==="-"?D.state=Ae.COMMENT_ENDING:D.comment+=F;continue;case Ae.COMMENT_ENDING:F==="-"?(D.state=Ae.COMMENT_ENDED,D.comment=mt(D.opt,D.comment),D.comment&&Ne(D,"oncomment",D.comment),D.comment=""):(D.comment+="-"+F,D.state=Ae.COMMENT);continue;case Ae.COMMENT_ENDED:F!==">"?(Xe(D,"Malformed comment"),D.comment+="--"+F,D.state=Ae.COMMENT):D.state=Ae.TEXT;continue;case Ae.CDATA:F==="]"?D.state=Ae.CDATA_ENDING:D.cdata+=F;continue;case Ae.CDATA_ENDING:F==="]"?D.state=Ae.CDATA_ENDING_2:(D.cdata+="]"+F,D.state=Ae.CDATA);continue;case Ae.CDATA_ENDING_2:F===">"?(D.cdata&&Ne(D,"oncdata",D.cdata),Ne(D,"onclosecdata"),D.cdata="",D.state=Ae.TEXT):F==="]"?D.cdata+="]":(D.cdata+="]]"+F,D.state=Ae.CDATA);continue;case Ae.PROC_INST:F==="?"?D.state=Ae.PROC_INST_ENDING:J(c,F)?D.state=Ae.PROC_INST_BODY:D.procInstName+=F;continue;case Ae.PROC_INST_BODY:if(!D.procInstBody&&J(c,F))continue;F==="?"?D.state=Ae.PROC_INST_ENDING:D.procInstBody+=F;continue;case Ae.PROC_INST_ENDING:F===">"?(Ne(D,"onprocessinginstruction",{name:D.procInstName,body:D.procInstBody}),D.procInstName=D.procInstBody="",D.state=Ae.TEXT):(D.procInstBody+="?"+F,D.state=Ae.PROC_INST_BODY);continue;case Ae.OPEN_TAG:J(pe,F)?D.tagName+=F:(nt(D),F===">"?Pe(D):F==="/"?D.state=Ae.OPEN_TAG_SLASH:(he(c,F)&&Xe(D,"Invalid character in tag name"),D.state=Ae.ATTRIB));continue;case Ae.OPEN_TAG_SLASH:F===">"?(Pe(D,!0),De(D)):(Xe(D,"Forward-slash in opening tag not followed by >"),D.state=Ae.ATTRIB);continue;case Ae.ATTRIB:if(J(c,F))continue;F===">"?Pe(D):F==="/"?D.state=Ae.OPEN_TAG_SLASH:J(ae,F)?(D.attribName=F,D.attribValue="",D.state=Ae.ATTRIB_NAME):Xe(D,"Invalid attribute name");continue;case Ae.ATTRIB_NAME:F==="="?D.state=Ae.ATTRIB_VALUE:F===">"?(Xe(D,"Attribute without value"),D.attribValue=D.attribName,Xt(D),Pe(D)):J(c,F)?D.state=Ae.ATTRIB_NAME_SAW_WHITE:J(pe,F)?D.attribName+=F:Xe(D,"Invalid attribute name");continue;case Ae.ATTRIB_NAME_SAW_WHITE:if(F==="=")D.state=Ae.ATTRIB_VALUE;else{if(J(c,F))continue;Xe(D,"Attribute without value"),D.tag.attributes[D.attribName]="",D.attribValue="",Ne(D,"onattribute",{name:D.attribName,value:""}),D.attribName="",F===">"?Pe(D):J(ae,F)?(D.attribName=F,D.state=Ae.ATTRIB_NAME):(Xe(D,"Invalid attribute name"),D.state=Ae.ATTRIB)}continue;case Ae.ATTRIB_VALUE:if(J(c,F))continue;J(h,F)?(D.q=F,D.state=Ae.ATTRIB_VALUE_QUOTED):(Xe(D,"Unquoted attribute value"),D.state=Ae.ATTRIB_VALUE_UNQUOTED,D.attribValue=F);continue;case Ae.ATTRIB_VALUE_QUOTED:if(F!==D.q){F==="&"?D.state=Ae.ATTRIB_VALUE_ENTITY_Q:D.attribValue+=F;continue}Xt(D),D.q="",D.state=Ae.ATTRIB_VALUE_CLOSED;continue;case Ae.ATTRIB_VALUE_CLOSED:J(c,F)?D.state=Ae.ATTRIB:F===">"?Pe(D):F==="/"?D.state=Ae.OPEN_TAG_SLASH:J(ae,F)?(Xe(D,"No whitespace between attributes"),D.attribName=F,D.attribValue="",D.state=Ae.ATTRIB_NAME):Xe(D,"Invalid attribute name");continue;case Ae.ATTRIB_VALUE_UNQUOTED:if(he(y,F)){F==="&"?D.state=Ae.ATTRIB_VALUE_ENTITY_U:D.attribValue+=F;continue}Xt(D),F===">"?Pe(D):D.state=Ae.ATTRIB;continue;case Ae.CLOSE_TAG:if(D.tagName)F===">"?De(D):J(pe,F)?D.tagName+=F:D.script?(D.script+="</"+D.tagName,D.tagName="",D.state=Ae.SCRIPT):(he(c,F)&&Xe(D,"Invalid tagname in closing tag"),D.state=Ae.CLOSE_TAG_SAW_WHITE);else{if(J(c,F))continue;he(ae,F)?D.script?(D.script+="</"+F,D.state=Ae.SCRIPT):Xe(D,"Invalid tagname in closing tag."):D.tagName=F}continue;case Ae.CLOSE_TAG_SAW_WHITE:if(J(c,F))continue;F===">"?De(D):Xe(D,"Invalid characters in closing tag");continue;case Ae.TEXT_ENTITY:case Ae.ATTRIB_VALUE_ENTITY_Q:case Ae.ATTRIB_VALUE_ENTITY_U:var Ue,je;switch(D.state){case Ae.TEXT_ENTITY:Ue=Ae.TEXT,je="textNode";break;case Ae.ATTRIB_VALUE_ENTITY_Q:Ue=Ae.ATTRIB_VALUE_QUOTED,je="attribValue";break;case Ae.ATTRIB_VALUE_ENTITY_U:Ue=Ae.ATTRIB_VALUE_UNQUOTED,je="attribValue"}F===";"?(D[je]+=dt(D),D.entity="",D.state=Ue):J(D.entity.length?ke:xe,F)?D.entity+=F:(Xe(D,"Invalid character in entity name"),D[je]+="&"+D.entity+F,D.entity="",D.state=Ue);continue;default:throw new Error(D,"Unknown state: "+D.state)}return D.position>=D.bufferCheckPosition&&(function(Oe){for(var He=Math.max(n.MAX_BUFFER_LENGTH,10),st=0,it=0,Et=i.length;it<Et;it++){var nn=Oe[i[it]].length;if(nn>He)switch(i[it]){case"textNode":tt(Oe);break;case"cdata":Ne(Oe,"oncdata",Oe.cdata),Oe.cdata="";break;case"script":Ne(Oe,"onscript",Oe.script),Oe.script="";break;default:Ge(Oe,"Max buffer length exceeded: "+i[it])}st=Math.max(st,nn)}var Ut=n.MAX_BUFFER_LENGTH-st;Oe.bufferCheckPosition=Ut+Oe.position})(D),D},resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var w;tt(w=this),w.cdata!==""&&(Ne(w,"oncdata",w.cdata),w.cdata=""),w.script!==""&&(Ne(w,"onscript",w.script),w.script="")}};try{r=t(3515).Stream}catch{r=function(){}}var l=n.EVENTS.filter((function(w){return w!=="error"&&w!=="end"}));function d(w,D){if(!(this instanceof d))return new d(w,D);r.apply(this),this._parser=new o(w,D),this.writable=!0,this.readable=!0;var oe=this;this._parser.onend=function(){oe.emit("end")},this._parser.onerror=function(F){oe.emit("error",F),oe._parser.error=null},this._decoder=null,l.forEach((function(F){Object.defineProperty(oe,"on"+F,{get:function(){return oe._parser["on"+F]},set:function(Me){if(!Me)return oe.removeAllListeners(F),oe._parser["on"+F]=Me,Me;oe.on(F,Me)},enumerable:!0,configurable:!1})}))}d.prototype=Object.create(r.prototype,{constructor:{value:d}}),d.prototype.write=function(w){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(w)){if(!this._decoder){var D=t(748).StringDecoder;this._decoder=new D("utf8")}w=this._decoder.write(w)}return this._parser.write(w.toString()),this.emit("data",w),!0},d.prototype.end=function(w){return w&&w.length&&this.write(w),this._parser.end(),!0},d.prototype.on=function(w,D){var oe=this;return oe._parser["on"+w]||l.indexOf(w)===-1||(oe._parser["on"+w]=function(){var F=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);F.splice(0,0,w),oe.emit.apply(oe,F)}),r.prototype.on.call(oe,w,D)};var c=`\r
|
|
43
|
+
`,g="0124356789",f="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",h=`'"`,y=c+">",E="[CDATA[",_="DOCTYPE",L="http://www.w3.org/XML/1998/namespace",K="http://www.w3.org/2000/xmlns/",Z={xml:L,xmlns:K};c=Y(c),g=Y(g),f=Y(f);var ae=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,pe=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/,xe=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,ke=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;function Y(w){return w.split("").reduce((function(D,oe){return D[oe]=!0,D}),{})}function J(w,D){return(function(oe){return Object.prototype.toString.call(oe)==="[object RegExp]"})(w)?!!D.match(w):w[D]}function he(w,D){return!J(w,D)}h=Y(h),y=Y(y);var Ee,Le,et,Ae=0;for(var Ze in n.STATE={BEGIN:Ae++,BEGIN_WHITESPACE:Ae++,TEXT:Ae++,TEXT_ENTITY:Ae++,OPEN_WAKA:Ae++,SGML_DECL:Ae++,SGML_DECL_QUOTED:Ae++,DOCTYPE:Ae++,DOCTYPE_QUOTED:Ae++,DOCTYPE_DTD:Ae++,DOCTYPE_DTD_QUOTED:Ae++,COMMENT_STARTING:Ae++,COMMENT:Ae++,COMMENT_ENDING:Ae++,COMMENT_ENDED:Ae++,CDATA:Ae++,CDATA_ENDING:Ae++,CDATA_ENDING_2:Ae++,PROC_INST:Ae++,PROC_INST_BODY:Ae++,PROC_INST_ENDING:Ae++,OPEN_TAG:Ae++,OPEN_TAG_SLASH:Ae++,ATTRIB:Ae++,ATTRIB_NAME:Ae++,ATTRIB_NAME_SAW_WHITE:Ae++,ATTRIB_VALUE:Ae++,ATTRIB_VALUE_QUOTED:Ae++,ATTRIB_VALUE_CLOSED:Ae++,ATTRIB_VALUE_UNQUOTED:Ae++,ATTRIB_VALUE_ENTITY_Q:Ae++,ATTRIB_VALUE_ENTITY_U:Ae++,CLOSE_TAG:Ae++,CLOSE_TAG_SAW_WHITE:Ae++,SCRIPT:Ae++,SCRIPT_ENDING:Ae++},n.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},n.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(n.ENTITIES).forEach((function(w){var D=n.ENTITIES[w],oe=typeof D=="number"?String.fromCharCode(D):D;n.ENTITIES[w]=oe})),n.STATE)n.STATE[n.STATE[Ze]]=Ze;function Be(w,D,oe){w[D]&&w[D](oe)}function Ne(w,D,oe){w.textNode&&tt(w),Be(w,D,oe)}function tt(w){w.textNode=mt(w.opt,w.textNode),w.textNode&&Be(w,"ontext",w.textNode),w.textNode=""}function mt(w,D){return w.trim&&(D=D.trim()),w.normalize&&(D=D.replace(/\s+/g," ")),D}function Ge(w,D){return tt(w),w.trackPosition&&(D+=`
|
|
44
|
+
Line: `+w.line+`
|
|
45
|
+
Column: `+w.column+`
|
|
46
|
+
Char: `+w.c),D=new Error(D),w.error=D,Be(w,"onerror",D),w}function ut(w){return w.sawRoot&&!w.closedRoot&&Xe(w,"Unclosed root tag"),w.state!==Ae.BEGIN&&w.state!==Ae.BEGIN_WHITESPACE&&w.state!==Ae.TEXT&&Ge(w,"Unexpected end"),tt(w),w.c="",w.closed=!0,Be(w,"onend"),o.call(w,w.strict,w.opt),w}function Xe(w,D){if(typeof w!="object"||!(w instanceof o))throw new Error("bad call to strictFail");w.strict&&Ge(w,D)}function nt(w){w.strict||(w.tagName=w.tagName[w.looseCase]());var D=w.tags[w.tags.length-1]||w,oe=w.tag={name:w.tagName,attributes:{}};w.opt.xmlns&&(oe.ns=D.ns),w.attribList.length=0,Ne(w,"onopentagstart",oe)}function Ft(w,D){var oe=w.indexOf(":")<0?["",w]:w.split(":"),F=oe[0],Me=oe[1];return D&&w==="xmlns"&&(F="xmlns",Me=""),{prefix:F,local:Me}}function Xt(w){if(w.strict||(w.attribName=w.attribName[w.looseCase]()),w.attribList.indexOf(w.attribName)!==-1||w.tag.attributes.hasOwnProperty(w.attribName))w.attribName=w.attribValue="";else{if(w.opt.xmlns){var D=Ft(w.attribName,!0),oe=D.prefix,F=D.local;if(oe==="xmlns")if(F==="xml"&&w.attribValue!==L)Xe(w,"xml: prefix must be bound to "+L+`
|
|
47
|
+
Actual: `+w.attribValue);else if(F==="xmlns"&&w.attribValue!==K)Xe(w,"xmlns: prefix must be bound to "+K+`
|
|
48
|
+
Actual: `+w.attribValue);else{var Me=w.tag,We=w.tags[w.tags.length-1]||w;Me.ns===We.ns&&(Me.ns=Object.create(We.ns)),Me.ns[F]=w.attribValue}w.attribList.push([w.attribName,w.attribValue])}else w.tag.attributes[w.attribName]=w.attribValue,Ne(w,"onattribute",{name:w.attribName,value:w.attribValue});w.attribName=w.attribValue=""}}function Pe(w,D){if(w.opt.xmlns){var oe=w.tag,F=Ft(w.tagName);oe.prefix=F.prefix,oe.local=F.local,oe.uri=oe.ns[F.prefix]||"",oe.prefix&&!oe.uri&&(Xe(w,"Unbound namespace prefix: "+JSON.stringify(w.tagName)),oe.uri=F.prefix);var Me=w.tags[w.tags.length-1]||w;oe.ns&&Me.ns!==oe.ns&&Object.keys(oe.ns).forEach((function(Kt){Ne(w,"onopennamespace",{prefix:Kt,uri:oe.ns[Kt]})}));for(var We=0,Ue=w.attribList.length;We<Ue;We++){var je=w.attribList[We],Oe=je[0],He=je[1],st=Ft(Oe,!0),it=st.prefix,Et=st.local,nn=it===""?"":oe.ns[it]||"",Ut={name:Oe,value:He,prefix:it,local:Et,uri:nn};it&&it!=="xmlns"&&!nn&&(Xe(w,"Unbound namespace prefix: "+JSON.stringify(it)),Ut.uri=it),w.tag.attributes[Oe]=Ut,Ne(w,"onattribute",Ut)}w.attribList.length=0}w.tag.isSelfClosing=!!D,w.sawRoot=!0,w.tags.push(w.tag),Ne(w,"onopentag",w.tag),D||(w.noscript||w.tagName.toLowerCase()!=="script"?w.state=Ae.TEXT:w.state=Ae.SCRIPT,w.tag=null,w.tagName=""),w.attribName=w.attribValue="",w.attribList.length=0}function De(w){if(!w.tagName)return Xe(w,"Weird empty close tag."),w.textNode+="</>",void(w.state=Ae.TEXT);if(w.script){if(w.tagName!=="script")return w.script+="</"+w.tagName+">",w.tagName="",void(w.state=Ae.SCRIPT);Ne(w,"onscript",w.script),w.script=""}var D=w.tags.length,oe=w.tagName;w.strict||(oe=oe[w.looseCase]());for(var F=oe;D--&&w.tags[D].name!==F;)Xe(w,"Unexpected close tag");if(D<0)return Xe(w,"Unmatched closing tag: "+w.tagName),w.textNode+="</"+w.tagName+">",void(w.state=Ae.TEXT);w.tagName=oe;for(var Me=w.tags.length;Me-- >D;){var We=w.tag=w.tags.pop();w.tagName=w.tag.name,Ne(w,"onclosetag",w.tagName);var Ue={};for(var je in We.ns)Ue[je]=We.ns[je];var Oe=w.tags[w.tags.length-1]||w;w.opt.xmlns&&We.ns!==Oe.ns&&Object.keys(We.ns).forEach((function(He){var st=We.ns[He];Ne(w,"onclosenamespace",{prefix:He,uri:st})}))}D===0&&(w.closedRoot=!0),w.tagName=w.attribValue=w.attribName="",w.attribList.length=0,w.state=Ae.TEXT}function dt(w){var D,oe=w.entity,F=oe.toLowerCase(),Me="";return w.ENTITIES[oe]?w.ENTITIES[oe]:w.ENTITIES[F]?w.ENTITIES[F]:((oe=F).charAt(0)==="#"&&(oe.charAt(1)==="x"?(oe=oe.slice(2),Me=(D=parseInt(oe,16)).toString(16)):(oe=oe.slice(1),Me=(D=parseInt(oe,10)).toString(10))),oe=oe.replace(/^0+/,""),Me.toLowerCase()!==oe?(Xe(w,"Invalid character entity"),"&"+w.entity+";"):String.fromCodePoint(D))}function Q(w,D){D==="<"?(w.state=Ae.OPEN_WAKA,w.startTagPosition=w.position):he(c,D)&&(Xe(w,"Non-whitespace before first tag."),w.textNode=D,w.state=Ae.TEXT)}function H(w,D){var oe="";return D<w.length&&(oe=w.charAt(D)),oe}Ae=n.STATE,String.fromCodePoint||(Ee=String.fromCharCode,Le=Math.floor,et=function(){var w,D,oe=[],F=-1,Me=arguments.length;if(!Me)return"";for(var We="";++F<Me;){var Ue=Number(arguments[F]);if(!isFinite(Ue)||Ue<0||Ue>1114111||Le(Ue)!==Ue)throw RangeError("Invalid code point: "+Ue);Ue<=65535?oe.push(Ue):(w=55296+((Ue-=65536)>>10),D=Ue%1024+56320,oe.push(w,D)),(F+1===Me||oe.length>16384)&&(We+=Ee.apply(null,oe),oe.length=0)}return We},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:et,configurable:!0,writable:!0}):String.fromCodePoint=et)})(e)},6739:function(u,e,t){(function(n,r,i,o,l){function d(H){if("contents"in H)for(var w=("styleAttrs"in H)?H.styleAttrs[o.byName.ruby.qname]:null,D=H.kind==="span"&&(w==="container"||w==="textContainer"||w==="baseContainer"),oe=H.contents.length-1;oe>=0;oe--)!D||"styleAttrs"in H.contents[oe]&&o.byName.ruby.qname in H.contents[oe].styleAttrs?d(H.contents[oe]):delete H.contents[oe]}function c(H,w,D,oe){var F=oe&&oe.timeContainer==="seq",Me=0;oe&&(Me=F&&D?D.end:oe.begin),w.begin=w.explicit_begin?w.explicit_begin+Me:Me;var We=w.begin,Ue=null;if("sets"in w)for(var je=0;je<w.sets.length;je++)c(H,w.sets[je],Ue,w),We=w.timeContainer==="seq"?w.sets[je].end:Math.max(We,w.sets[je].end),Ue=w.sets[je];if("contents"in w){if("contents"in w)for(var Oe=0;Oe<w.contents.length;Oe++)c(H,w.contents[Oe],Ue,w),We=w.timeContainer==="seq"?w.contents[Oe].end:Math.max(We,w.contents[Oe].end),Ue=w.contents[Oe]}else We=F?w.begin:Number.POSITIVE_INFINITY;w.explicit_end!==null&&w.explicit_dur!==null?w.end=Math.min(w.begin+w.explicit_dur,Me+w.explicit_end):w.explicit_end===null&&w.explicit_dur!==null?w.end=w.begin+w.explicit_dur:w.explicit_end!==null&&w.explicit_dur===null?w.end=Me+w.explicit_end:w.end=We,delete w.explicit_begin,delete w.explicit_dur,delete w.explicit_end,H._registerEvent(w)}function g(H){this.node=H}function f(){this.events=[],this.head=new h,this.body=null}function h(){this.styling=new y,this.layout=new L}function y(){this.styles={},this.initials={}}function E(){this.id=null,this.styleAttrs=null,this.styleRefs=null}function _(){this.styleAttrs=null}function L(){this.regions={}}function K(H,w){Z.call(this,"image"),this.src=H,this.type=w}function Z(H){this.kind=H}function ae(H){this.id=H}function pe(H){this.regionID=H}function xe(H){this.styleAttrs=H}function ke(H){this.sets=H}function Y(H){this.contents=H}function J(H,w,D){this.explicit_begin=H,this.explicit_end=w,this.explicit_dur=D}function he(){Z.call(this,"body")}function Ee(){Z.call(this,"div")}function Le(){Z.call(this,"p")}function et(){Z.call(this,"span")}function Ae(){Z.call(this,"span")}function Ze(){Z.call(this,"br")}function Be(){}function Ne(){}function tt(H){return H&&"xml:id"in H.attributes&&H.attributes["xml:id"].value||null}function mt(H){return H&&"style"in H.attributes?H.attributes.style.value.split(" "):[]}function Ge(H,w){var D={};if(H!==null)for(var oe in H.attributes){var F=H.attributes[oe].uri+" "+H.attributes[oe].local,Me=o.byQName[F];if(Me!==void 0){var We=Me.parse(H.attributes[oe].value);We!==null?(D[F]=We,Me===o.byName.zIndex&&Pe(w,"zIndex attribute present but not used by IMSC1 since regions do not overlap")):De(w,"Cannot parse styling attribute "+F+" --> "+H.attributes[oe].value)}}return D}function ut(H,w,D){for(var oe in H.attributes)if(H.attributes[oe].uri===w&&H.attributes[oe].local===D)return H.attributes[oe].value;return null}function Xe(H,w,D){var oe,F=null;return(oe=/^(\d+(?:\.\d+)?)f$/.exec(D))!==null?w!==null&&(F=parseFloat(oe[1])/w):(oe=/^(\d+(?:\.\d+)?)t$/.exec(D))!==null?H!==null&&(F=parseFloat(oe[1])/H):(oe=/^(\d+(?:\.\d+)?)ms$/.exec(D))!==null?F=parseFloat(oe[1])/1e3:(oe=/^(\d+(?:\.\d+)?)s$/.exec(D))!==null?F=parseFloat(oe[1]):(oe=/^(\d+(?:\.\d+)?)h$/.exec(D))!==null?F=3600*parseFloat(oe[1]):(oe=/^(\d+(?:\.\d+)?)m$/.exec(D))!==null?F=60*parseFloat(oe[1]):(oe=/^(\d{2,}):(\d\d):(\d\d(?:\.\d+)?)$/.exec(D))!==null?F=3600*parseInt(oe[1])+60*parseInt(oe[2])+parseFloat(oe[3]):(oe=/^(\d{2,}):(\d\d):(\d\d)\:(\d{2,})$/.exec(D))!==null&&w!==null&&(F=3600*parseInt(oe[1])+60*parseInt(oe[2])+parseInt(oe[3])+(oe[4]===null?0:parseInt(oe[4])/w)),F}function nt(H,w,D){for(;w.styleRefs.length>0;){var oe=w.styleRefs.pop();oe in H.styles?(nt(H,H.styles[oe],D),Xt(H.styles[oe].styleAttrs,w.styleAttrs)):De(D,"Non-existant style id referenced")}}function Ft(H,w,D,oe){for(var F=w.length-1;F>=0;F--){var Me=w[F];Me in H.styles?Xt(H.styles[Me].styleAttrs,D):De(oe,"Non-existant style id referenced")}}function Xt(H,w){for(var D in H)H.hasOwnProperty(D)&&(D in w||(w[D]=H[D]))}function Pe(H,w){if(H&&H.warn&&H.warn(w))throw w}function De(H,w){if(H&&H.error&&H.error(w))throw w}function dt(H,w){throw H&&H.fatal&&H.fatal(w),w}function Q(H,w){for(var D,oe=0,F=H.length-1;oe<=F;){var Me=H[D=Math.floor((oe+F)/2)];if(Me<w)oe=D+1;else{if(!(Me>w))return{found:!0,index:D};F=D-1}}return{found:!1,index:oe}}n.fromXML=function(H,w,D){var oe=r.parser(!0,{xmlns:!0}),F=[],Me=[],We=[],Ue=0,je=null;oe.onclosetag=function(Et){if(F[0]instanceof Be)je.head!==null&&je.head.styling!==null&&Ft(je.head.styling,F[0].styleRefs,F[0].styleAttrs,w),delete F[0].styleRefs;else if(F[0]instanceof y)for(var nn in F[0].styles)F[0].styles.hasOwnProperty(nn)&&nt(F[0],F[0].styles[nn],w);else if(F[0]instanceof Le||F[0]instanceof et){if(F[0].contents.length>1){var Ut,Kt=[F[0].contents[0]];for(Ut=1;Ut<F[0].contents.length;Ut++)F[0].contents[Ut]instanceof Ae&&Kt[Kt.length-1]instanceof Ae?Kt[Kt.length-1].text+=F[0].contents[Ut].text:Kt.push(F[0].contents[Ut]);F[0].contents=Kt}F[0]instanceof et&&F[0].contents.length===1&&F[0].contents[0]instanceof Ae&&(F[0].text=F[0].contents[0].text,delete F[0].contents)}else F[0]instanceof g&&(F[0].node.uri===i.ns_tt&&F[0].node.local==="metadata"?Ue--:Ue>0&&D&&"onCloseTag"in D&&D.onCloseTag());We.shift(),Me.shift(),F.shift()},oe.ontext=function(Et){if(F[0]!==void 0)if(F[0]instanceof et||F[0]instanceof Le){if(F[0]instanceof et){var nn=F[0].styleAttrs[o.byName.ruby.qname];if(nn==="container"||nn==="textContainer"||nn==="baseContainer")return}var Ut=new Ae;Ut.initFromText(je,F[0],Et,Me[0],We[0],w),F[0].contents.push(Ut)}else F[0]instanceof g&&Ue>0&&D&&"onText"in D&&D.onText(Et)},oe.onopentag=function(Et){var nn=Et.attributes["xml:space"];nn?We.unshift(nn.value):We.length===0?We.unshift("default"):We.unshift(We[0]);var Ut=Et.attributes["xml:lang"];if(Ut?Me.unshift(Ut.value):Me.length===0?Me.unshift(""):Me.unshift(Me[0]),Et.uri===i.ns_tt)if(Et.local==="tt")je!==null&&dt(w,"Two <tt> elements at ("+this.line+","+this.column+")"),(je=new f).initFromNode(Et,Me[0],w),F.unshift(je);else if(Et.local==="head")F[0]instanceof f||dt(w,"Parent of <head> element is not <tt> at ("+this.line+","+this.column+")"),F.unshift(je.head);else if(Et.local==="styling")F[0]instanceof h||dt(w,"Parent of <styling> element is not <head> at ("+this.line+","+this.column+")"),F.unshift(je.head.styling);else if(Et.local==="style"){var Kt;F[0]instanceof y?((Kt=new E).initFromNode(Et,w),Kt.id?je.head.styling.styles[Kt.id]=Kt:De(w,"<style> element missing @id attribute"),F.unshift(Kt)):F[0]instanceof Be?((Kt=new E).initFromNode(Et,w),Xt(Kt.styleAttrs,F[0].styleAttrs),F.unshift(Kt)):dt(w,"Parent of <style> element is not <styling> or <region> at ("+this.line+","+this.column+")")}else if(Et.local==="initial"){var kt;if(F[0]instanceof y){for(var Tn in(kt=new _).initFromNode(Et,w),kt.styleAttrs)kt.styleAttrs.hasOwnProperty(Tn)&&(je.head.styling.initials[Tn]=kt.styleAttrs[Tn]);F.unshift(kt)}else dt(w,"Parent of <initial> element is not <styling> at ("+this.line+","+this.column+")")}else if(Et.local==="layout")F[0]instanceof h||dt(w,"Parent of <layout> element is not <head> at "+this.line+","+this.column+")"),F.unshift(je.head.layout);else if(Et.local==="region"){F[0]instanceof L||dt(w,"Parent of <region> element is not <layout> at "+this.line+","+this.column+")");var Bn=new Be;Bn.initFromNode(je,Et,Me[0],w),!Bn.id||Bn.id in je.head.layout.regions?De(w,"Ignoring <region> with duplicate or missing @id at "+this.line+","+this.column+")"):je.head.layout.regions[Bn.id]=Bn,F.unshift(Bn)}else if(Et.local==="body"){F[0]instanceof f||dt(w,"Parent of <body> element is not <tt> at "+this.line+","+this.column+")"),je.body!==null&&dt(w,"Second <body> element at "+this.line+","+this.column+")");var Jn=new he;Jn.initFromNode(je,Et,Me[0],w),je.body=Jn,F.unshift(Jn)}else if(Et.local==="div"){F[0]instanceof Ee||F[0]instanceof he||dt(w,"Parent of <div> element is not <body> or <div> at "+this.line+","+this.column+")");var gr=new Ee;gr.initFromNode(je,F[0],Et,Me[0],w);var dr=gr.styleAttrs[o.byName.backgroundImage.qname];dr&&(gr.contents.push(new K(dr)),delete gr.styleAttrs[o.byName.backgroundImage.qname]),F[0].contents.push(gr),F.unshift(gr)}else if(Et.local==="image"){F[0]instanceof Ee||dt(w,"Parent of <image> element is not <div> at "+this.line+","+this.column+")");var mr=new K;mr.initFromNode(je,F[0],Et,Me[0],w),F[0].contents.push(mr),F.unshift(mr)}else if(Et.local==="p"){F[0]instanceof Ee||dt(w,"Parent of <p> element is not <div> at "+this.line+","+this.column+")");var jt=new Le;jt.initFromNode(je,F[0],Et,Me[0],w),F[0].contents.push(jt),F.unshift(jt)}else if(Et.local==="span"){F[0]instanceof et||F[0]instanceof Le||dt(w,"Parent of <span> element is not <span> or <p> at "+this.line+","+this.column+")");var zt=new et;zt.initFromNode(je,F[0],Et,Me[0],We[0],w),F[0].contents.push(zt),F.unshift(zt)}else if(Et.local==="br"){F[0]instanceof et||F[0]instanceof Le||dt(w,"Parent of <br> element is not <span> or <p> at "+this.line+","+this.column+")");var St=new Ze;St.initFromNode(je,F[0],Et,Me[0],w),F[0].contents.push(St),F.unshift(St)}else if(Et.local==="set"){F[0]instanceof et||F[0]instanceof Le||F[0]instanceof Ee||F[0]instanceof he||F[0]instanceof Be||F[0]instanceof Ze||dt(w,"Parent of <set> element is not a content element or a region at "+this.line+","+this.column+")");var ht=new Ne;ht.initFromNode(je,F[0],Et,w),F[0].sets.push(ht),F.unshift(ht)}else F.unshift(new g(Et));else F.unshift(new g(Et));if(F[0]instanceof g){if(Et.uri===i.ns_tt&&Et.local==="metadata")Ue++;else if(Ue>0&&D&&"onOpenTag"in D){var qt=[];for(var Bt in Et.attributes)qt[Et.attributes[Bt].uri+" "+Et.attributes[Bt].local]={uri:Et.attributes[Bt].uri,local:Et.attributes[Bt].local,value:Et.attributes[Bt].value};D.onOpenTag(Et.uri,Et.local,qt)}}},oe.write(H).close(),delete je.head.styling.styles;var Oe=!1;for(var He in je.head.layout.regions)if(je.head.layout.regions.hasOwnProperty(He)){Oe=!0;break}if(!Oe){var st=Be.prototype.createDefaultRegion(je.lang);je.head.layout.regions[st.id]=st}for(var it in je.head.layout.regions)je.head.layout.regions.hasOwnProperty(it)&&c(je,je.head.layout.regions[it],null,null);return je.body&&c(je,je.body,null,null),je.body&&d(je.body),je},f.prototype.initFromNode=function(H,w,D){var oe=(function(Ue,je){var Oe=ut(Ue,i.ns_ttp,"cellResolution"),He=15,st=32;if(Oe!==null){var it=/(\d+) (\d+)/.exec(Oe);it!==null?(st=parseInt(it[1]),He=parseInt(it[2])):Pe(je,"Malformed cellResolution value (using initial value instead)")}return{w:st,h:He}})(H,D);this.cellLength={h:new l.ComputedLength(0,1/oe.h),w:new l.ComputedLength(1/oe.w,0)};var F=(function(Ue,je){var Oe,He=ut(Ue,i.ns_ttp,"frameRate"),st=30;He!==null&&((Oe=/(\d+)/.exec(He))!==null?st=parseInt(Oe[1]):Pe(je,"Malformed frame rate attribute (using initial value instead)"));var it=ut(Ue,i.ns_ttp,"frameRateMultiplier"),Et=1;it!==null&&((Oe=/(\d+) (\d+)/.exec(it))!==null?Et=parseInt(Oe[1])/parseInt(Oe[2]):Pe(je,"Malformed frame rate multiplier attribute (using initial value instead)"));var nn=Et*st,Ut=1,Kt=ut(Ue,i.ns_ttp,"tickRate");return Kt===null?He!==null&&(Ut=nn):(Oe=/(\d+)/.exec(Kt))!==null?Ut=parseInt(Oe[1]):Pe(je,"Malformed tick rate attribute (using initial value instead)"),{effectiveFrameRate:nn,tickRate:Ut}})(H,D);this.effectiveFrameRate=F.effectiveFrameRate,this.tickRate=F.tickRate,this.aspectRatio=(function(Ue,je){var Oe=ut(Ue,i.ns_ittp,"aspectRatio");Oe===null&&(Oe=ut(Ue,i.ns_ttp,"displayAspectRatio"));var He=null;if(Oe!==null){var st=/(\d+)\s+(\d+)/.exec(Oe);if(st!==null){var it=parseInt(st[1]),Et=parseInt(st[2]);it!==0&&Et!==0?He=it/Et:De(je,"Illegal aspectRatio values (ignoring)")}else De(je,"Malformed aspectRatio attribute (ignoring)")}return He})(H,D);var Me=ut(H,i.ns_ttp,"timeBase");Me!==null&&Me!=="media"&&dt(D,"Unsupported time base");var We=(function(Ue,je){var Oe=ut(Ue,i.ns_tts,"extent");if(Oe===null)return null;var He=Oe.split(" ");if(He.length!==2)return Pe(je,"Malformed extent (ignoring)"),null;var st=l.parseLength(He[0]),it=l.parseLength(He[1]);return it&&st?{h:it,w:st}:(Pe(je,"Malformed extent values (ignoring)"),null)})(H,D);We===null?this.pxLength={h:null,w:null}:(We.h.unit==="px"&&We.w.unit==="px"||dt(D,"Extent on TT must be in px or absent"),this.pxLength={h:new l.ComputedLength(0,1/We.h.value),w:new l.ComputedLength(1/We.w.value,0)}),this.dimensions={h:new l.ComputedLength(0,1),w:new l.ComputedLength(1,0)},this.lang=w},f.prototype._registerEvent=function(H){if(!(H.end<=H.begin)){var w=Q(this.events,H.begin);if(w.found||this.events.splice(w.index,0,H.begin),H.end!==Number.POSITIVE_INFINITY){var D=Q(this.events,H.end);D.found||this.events.splice(D.index,0,H.end)}}},f.prototype.getMediaTimeRange=function(){return[this.events[0],this.events[this.events.length-1]]},f.prototype.getMediaTimeEvents=function(){return this.events},E.prototype.initFromNode=function(H,w){this.id=tt(H),this.styleAttrs=Ge(H,w),this.styleRefs=mt(H)},_.prototype.initFromNode=function(H,w){for(var D in this.styleAttrs={},H.attributes)if(H.attributes[D].uri===i.ns_itts||H.attributes[D].uri===i.ns_ebutts||H.attributes[D].uri===i.ns_tts){var oe=H.attributes[D].uri+" "+H.attributes[D].local;this.styleAttrs[oe]=H.attributes[D].value}},K.prototype.initFromNode=function(H,w,D,oe,F){this.src="src"in D.attributes?D.attributes.src.value:null,this.src||De(F,"Invalid image@src attribute"),this.type="type"in D.attributes?D.attributes.type.value:null,this.type||De(F,"Invalid image@type attribute"),xe.prototype.initFromNode.call(this,H,w,D,F),J.prototype.initFromNode.call(this,H,w,D,F),ke.prototype.initFromNode.call(this,H,w,D,F),pe.prototype.initFromNode.call(this,H,w,D,F),this.lang=oe},ae.prototype.initFromNode=function(H,w,D,oe){this.id=tt(D)},pe.prototype.initFromNode=function(H,w,D,oe){this.regionID=(function(F){return F&&"region"in F.attributes?F.attributes.region.value:""})(D)},xe.prototype.initFromNode=function(H,w,D,oe){this.styleAttrs=Ge(D,oe),H.head!==null&&H.head.styling!==null&&Ft(H.head.styling,mt(D),this.styleAttrs,oe)},ke.prototype.initFromNode=function(H,w,D,oe){this.sets=[]},Y.prototype.initFromNode=function(H,w,D,oe){this.contents=[]},J.prototype.initFromNode=function(H,w,D,oe){var F=(function(Me,We,Ue,je){var Oe=null;Ue&&"begin"in Ue.attributes&&(Oe=Xe(Me.tickRate,Me.effectiveFrameRate,Ue.attributes.begin.value))===null&&Pe(je,"Malformed begin value "+Ue.attributes.begin.value+" (using 0)");var He=null;Ue&&"dur"in Ue.attributes&&(He=Xe(Me.tickRate,Me.effectiveFrameRate,Ue.attributes.dur.value))===null&&Pe(je,"Malformed dur value "+Ue.attributes.dur.value+" (ignoring)");var st=null;return Ue&&"end"in Ue.attributes&&(st=Xe(Me.tickRate,Me.effectiveFrameRate,Ue.attributes.end.value))===null&&Pe(je,"Malformed end value (ignoring)"),{explicit_begin:Oe,explicit_end:st,explicit_dur:He}})(H,0,D,oe);this.explicit_begin=F.explicit_begin,this.explicit_end=F.explicit_end,this.explicit_dur=F.explicit_dur,this.timeContainer=(function(Me,We){var Ue=Me&&"timeContainer"in Me.attributes?Me.attributes.timeContainer.value:null;return Ue&&Ue!=="par"?Ue==="seq"?"seq":(De(We,"Illegal value of timeContainer (assuming 'par')"),"par"):"par"})(D,oe)},he.prototype.initFromNode=function(H,w,D,oe){xe.prototype.initFromNode.call(this,H,null,w,oe),J.prototype.initFromNode.call(this,H,null,w,oe),ke.prototype.initFromNode.call(this,H,null,w,oe),pe.prototype.initFromNode.call(this,H,null,w,oe),Y.prototype.initFromNode.call(this,H,null,w,oe),this.lang=D},Ee.prototype.initFromNode=function(H,w,D,oe,F){xe.prototype.initFromNode.call(this,H,w,D,F),J.prototype.initFromNode.call(this,H,w,D,F),ke.prototype.initFromNode.call(this,H,w,D,F),pe.prototype.initFromNode.call(this,H,w,D,F),Y.prototype.initFromNode.call(this,H,w,D,F),this.lang=oe},Le.prototype.initFromNode=function(H,w,D,oe,F){xe.prototype.initFromNode.call(this,H,w,D,F),J.prototype.initFromNode.call(this,H,w,D,F),ke.prototype.initFromNode.call(this,H,w,D,F),pe.prototype.initFromNode.call(this,H,w,D,F),Y.prototype.initFromNode.call(this,H,w,D,F),this.lang=oe},et.prototype.initFromNode=function(H,w,D,oe,F,Me){xe.prototype.initFromNode.call(this,H,w,D,Me),J.prototype.initFromNode.call(this,H,w,D,Me),ke.prototype.initFromNode.call(this,H,w,D,Me),pe.prototype.initFromNode.call(this,H,w,D,Me),Y.prototype.initFromNode.call(this,H,w,D,Me),this.space=F,this.lang=oe},Ae.prototype.initFromText=function(H,w,D,oe,F,Me){J.prototype.initFromNode.call(this,H,w,null,Me),this.text=D,this.space=F,this.lang=oe},Ze.prototype.initFromNode=function(H,w,D,oe,F){pe.prototype.initFromNode.call(this,H,w,D,F),J.prototype.initFromNode.call(this,H,w,D,F),this.lang=oe},Be.prototype.createDefaultRegion=function(H){var w=new Be;return ae.call(w,""),xe.call(w,{}),ke.call(w,[]),J.call(w,0,Number.POSITIVE_INFINITY,null),this.lang=H,w},Be.prototype.initFromNode=function(H,w,D,oe){ae.prototype.initFromNode.call(this,H,null,w,oe),J.prototype.initFromNode.call(this,H,null,w,oe),ke.prototype.initFromNode.call(this,H,null,w,oe),this.styleAttrs=Ge(w,oe),this.styleRefs=mt(w),this.lang=D},Ne.prototype.initFromNode=function(H,w,D,oe){J.prototype.initFromNode.call(this,H,w,D,oe);var F=Ge(D,oe);for(var Me in this.qname=null,this.value=null,F)if(F.hasOwnProperty(Me)){if(this.qname){De(oe,"More than one style specified on set");break}this.qname=Me,this.value=F[Me]}}})(e,typeof sax>"u"?t(5474):sax,typeof imscNames>"u"?t(977):imscNames,typeof imscStyles>"u"?t(1219):imscStyles,typeof imscUtils>"u"?t(6404):imscUtils)},1612:function(u,e,t){var n=/firefox/i.test(navigator.userAgent);(function(r,i,o){function l(Y,J,he,Ee){var Le;if(he.kind==="region")(Le=document.createElement("div")).style.position="absolute";else if(he.kind==="body")Le=document.createElement("div");else if(he.kind==="div")Le=document.createElement("div");else if(he.kind==="image"){if(Le=document.createElement("img"),Y.imgResolver!==null&&he.src!==null){var et=Y.imgResolver(he.src,Le);et&&(Le.src=et),Le.height=Y.regionH,Le.width=Y.regionW}}else if(he.kind==="p")Le=document.createElement("p");else if(he.kind==="span")if(he.styleAttrs[o.byName.ruby.qname]==="container")Le=document.createElement("ruby"),Y.ruby=!0;else if(he.styleAttrs[o.byName.ruby.qname]==="base")Le=document.createElement("span");else if(he.styleAttrs[o.byName.ruby.qname]==="text")Le=document.createElement("rt");else if(he.styleAttrs[o.byName.ruby.qname]==="baseContainer")Le=document.createElement("rbc");else if(he.styleAttrs[o.byName.ruby.qname]==="textContainer")Le=document.createElement("rtc");else{if(he.styleAttrs[o.byName.ruby.qname]==="delimiter")return;Le=document.createElement("span")}else he.kind==="br"&&(Le=document.createElement("br"));if(Le){if(he.lang&&(he.kind!=="region"&&he.lang===Ee.lang||(Le.lang=he.lang)),J.appendChild(Le),Le.style.margin="0",he.kind==="region"){var Ae=he.styleAttrs[o.byName.writingMode.qname];Ae==="lrtb"||Ae==="lr"?(Y.ipd="lr",Y.bpd="tb"):Ae==="rltb"||Ae==="rl"?(Y.ipd="rl",Y.bpd="tb"):Ae==="tblr"?(Y.ipd="tb",Y.bpd="lr"):Ae!=="tbrl"&&Ae!=="tb"||(Y.ipd="tb",Y.bpd="rl")}else if(he.kind==="p"&&Y.bpd==="tb"){var Ze=he.styleAttrs[o.byName.direction.qname];Y.ipd=Ze==="ltr"?"lr":"rl"}for(var Be=0;Be<_.length;Be++){var Ne=_[Be],tt=he.styleAttrs[Ne.qname];tt!==void 0&&Ne.map!==null&&Ne.map(Y,Le,he,tt)}var mt=Le,Ge=he.styleAttrs[o.byName.linePadding.qname];if(Ge&&!Ge.isZero()){var ut=Ge.toUsedLength(Y.w,Y.h);if(ut>0){var Xe=Math.ceil(ut)+"px";Y.bpd==="tb"?(mt.style.paddingLeft=Xe,mt.style.paddingRight=Xe):(mt.style.paddingTop=Xe,mt.style.paddingBottom=Xe),Y.lp=Ge}}var nt=he.styleAttrs[o.byName.multiRowAlign.qname];if(nt&&nt!=="auto"){var Ft=document.createElement("span");Ft.style.display="inline-block",Ft.style.textAlign=nt,Le.appendChild(Ft),mt=Ft,Y.mra=nt}var Xt=he.styleAttrs[o.byName.rubyReserve.qname];if(Xt&&Xt[0]!=="none"&&(Y.rubyReserve=Xt),he.styleAttrs[o.byName.fillLineGap.qname]&&(Y.flg=!0),he.kind==="span"&&he.text){var Pe=he.styleAttrs[o.byName.textEmphasis.qname];if(Pe&&Pe.style!=="none"&&(Y.textEmphasis=!0),o.byName.textCombine.qname in he.styleAttrs&&he.styleAttrs[o.byName.textCombine.qname]==="all")Le.textContent=he.text,Le._isd_element=he,Pe&&y(Y,Le,0,Pe);else for(var De="",dt=0;dt<he.text.length;dt++){De+=he.text.charAt(dt);var Q=he.text.charCodeAt(dt);if(Q<55296||Q>56319||dt===he.text.length-1){var H=document.createElement("span");H.textContent=De,Pe&&y(Y,H,0,Pe),Le.appendChild(H),De="",H._isd_element=he}}}if("contents"in he)for(var w=0;w<he.contents.length;w++)l(Y,mt,he.contents[w],he);var D=[];if(he.kind==="p"&&(h(Y,mt,D,null),Y.rubyReserve&&((function(Ue,je){for(var Oe=0;Oe<Ue.length;Oe++){var He,st,it=document.createElement("ruby"),Et=document.createElement("span");Et.textContent="β",it.appendChild(Et);var nn,Ut=je.rubyReserve[1].toUsedLength(je.w,je.h)+"px";je.rubyReserve[0]==="both"||je.rubyReserve[0]==="outside"&&Ue.length==1?((He=document.createElement("rtc")).style[ae]=Z?"after":"under",He.textContent="β",He.style.fontSize=Ut,(st=document.createElement("rtc")).style[ae]=Z?"before":"over",st.textContent="β",st.style.fontSize=Ut,it.appendChild(He),it.appendChild(st)):((He=document.createElement("rtc")).textContent="β",He.style.fontSize=Ut,nn=je.rubyReserve[0]==="after"||je.rubyReserve[0]==="outside"&&Oe>0?Z?"after":je.bpd==="tb"||je.bpd==="rl"?"under":"over":Z?"before":je.bpd==="tb"||je.bpd==="rl"?"over":"under",He.style[ae]=nn,it.appendChild(He));for(var Kt=null,kt=0;kt<Ue[Oe].rbc.length;kt++)if(Ue[Oe].rbc[kt].localName==="ruby"){Kt=Ue[Oe].rbc[kt];for(var Tn=0;Tn<Kt.style.length;Tn++)it.style.setProperty(Kt.style.item(Tn),Kt.style.getPropertyValue(Kt.style.item(Tn)));break}(Kt=Kt||Ue[Oe].elements[0].node).parentElement.insertBefore(it,Kt)}})(D,Y),Y.rubyReserve=null),(Y.ruby||Y.rubyReserve)&&((function(Ue,je){for(var Oe=0;Oe<Ue.length;Oe++)for(var He=0;He<Ue[Oe].rbc.length;He++){var st;Ue[Oe].rbc[He].style[ae]||(st=Z?Oe===0?"before":"after":je.bpd==="tb"||je.bpd==="rl"?Oe===0?"over":"under":Oe===0?"under":"over",Ue[Oe].rbc[He].style[ae]=st)}})(D,Y),Y.ruby=null),Y.textEmphasis&&((function(Ue,je){for(var Oe=0;Oe<Ue.length;Oe++)for(var He=0;He<Ue[Oe].te.length;He++){var st;Ue[Oe].te[He].style[xe]&&Ue[Oe].te[He].style[xe]!=="none"||(st=je.bpd==="tb"?Oe===0?"left over":"left under":je.bpd==="rl"?Oe===0?"right under":"left under":Oe===0?"left under":"right under",Ue[Oe].te[He].style[xe]=st)}})(D,Y),Y.textEmphasis=null),Y.mra&&((function(Ue){for(var je=0;je<Ue.length-1;je++){var Oe=Ue[je].elements.length;if(Oe!==0&&Ue[je].br===!1){var He=document.createElement("br"),st=Ue[je].elements[Oe-1].node;st.parentElement.insertBefore(He,st.nextSibling)}}})(D),Y.mra=null),Y.lp&&((function(Ue,je,Oe){if(Ue!==null)for(var He=0;He<Ue.length;He++){var st=Ue[He].elements.length,it=Math.ceil(je)+"px",Et="-"+Math.ceil(je)+"px";if(st!==0){var nn=Ue[He].elements[Ue[He].start_elem],Ut=Ue[He].elements[Ue[He].end_elem];if(nn===Ut){var Kt=nn.node.getBoundingClientRect();if(Kt.width==0||Kt.height==0)continue}Oe.ipd==="lr"?(nn.node.style.marginLeft=Et,nn.node.style.paddingLeft=it):Oe.ipd==="rl"?(nn.node.style.paddingRight=it,nn.node.style.marginRight=Et):Oe.ipd==="tb"&&(nn.node.style.paddingTop=it,nn.node.style.marginTop=Et),Oe.ipd==="lr"?(n||(Ut.node.style.marginRight=Et),Ut.node.style.paddingRight=it):Oe.ipd==="rl"?(Ut.node.style.paddingLeft=it,n||(Ut.node.style.marginLeft=Et)):Oe.ipd==="tb"&&(Ut.node.style.paddingBottom=it,Ut.node.style.marginBottom=Et)}}})(D,Y.lp.toUsedLength(Y.w,Y.h),Y),Y.lp=null),(function(Ue,je){for(var Oe=0;Oe<Ue.length;Oe++)for(var He=Ue[Oe],st=1;st<He.elements.length;){var it=He.elements[st-1],Et=He.elements[st];c(it.node,Et.node,je)?He.elements.splice(st,1):st++}for(var nn,Ut,Kt=[],kt=0;kt<Ue.length;kt++)for(var Tn=0;Tn<Ue[kt].elements.length;Tn++)(Ut=d(nn=Ue[kt].elements[Tn].node,Kt,!1))&&(nn.style.backgroundColor=Ut);for(var Bn=0;Bn<Kt.length;Bn++)Kt[Bn].style.backgroundColor=""})(D,Y),Y.flg)){var oe=f(mt.getBoundingClientRect(),Y);(function(Ue,je,Oe,He){for(var st=Math.sign(Oe-je),it=0;it<=Ue.length;it++){var Et,nn,Ut,Kt;if(Et=it===0?Math.round(je):it===Ue.length?Math.round(Oe):Math.round((Ue[it-1].after+Ue[it].before)/2),it>0&&Ue[it-1])for(Ut=0;Ut<Ue[it-1].elements.length;Ut++)nn=st*(Et-(Kt=Ue[it-1].elements[Ut]).after)+"px",He.bpd==="lr"?Kt.node.style.paddingRight=nn:He.bpd==="rl"?Kt.node.style.paddingLeft=nn:He.bpd==="tb"&&(Kt.node.style.paddingBottom=nn);if(it<Ue.length)for(Ut=0;Ut<Ue[it].elements.length;Ut++)nn=st*((Kt=Ue[it].elements[Ut]).before-Et)+"px",He.bpd==="lr"?Kt.node.style.paddingLeft=nn:He.bpd==="rl"?Kt.node.style.paddingRight=nn:He.bpd==="tb"&&(Kt.node.style.paddingTop=nn)}})(D,oe.before,oe.after,Y),Y.flg=null}if(he.kind==="region"&&Y.bpd==="tb"&&Y.enableRollUp&&he.contents.length>0&&he.styleAttrs[o.byName.displayAlign.qname]==="after"){h(Y,mt,D,null);var F=new g(he.id===""?"_":he.id,D);if(Y.currentISDState[F.id]=F,Y.previousISDState&&F.id in Y.previousISDState&&Y.previousISDState[F.id].plist.length>0&&F.plist.length>1&&F.plist[F.plist.length-2].text===Y.previousISDState[F.id].plist[Y.previousISDState[F.id].plist.length-1].text){var Me=Le.firstElementChild,We=F.plist[F.plist.length-1].after-F.plist[F.plist.length-1].before;Me.style.bottom="-"+We+"px",Me.style.transition="transform 0.4s",Me.style.position="relative",Me.style.transform="translateY(-"+We+"px)"}}}else ke(Y.errorHandler,"Error processing ISD element kind: "+he.kind)}function d(Y,J,he){return Y.style.backgroundColor?(he&&!J.includes(Y)&&J.push(Y),Y.style.backgroundColor):Y.parentElement.nodeName==="SPAN"||Y.parentElement.nodeName==="RUBY"||Y.parentElement.nodeName==="RBC"||Y.parentElement.nodeName==="RTC"||Y.parentElement.nodeName==="RT"?d(Y.parentElement,J,!0):void 0}function c(Y,J,he){if(Y.tagName==="SPAN"&&J.tagName==="SPAN"&&Y._isd_element===J._isd_element){if(!Y._isd_element)return ke(he.errorHandler,"Internal error: HTML span is not linked to a source element; cannot merge spans."),!1;Y.textContent+=J.textContent;for(var Ee=0;Ee<J.style.length;Ee++){var Le=J.style[Ee];(Le.indexOf("border")>=0||Le.indexOf("padding")>=0||Le.indexOf("margin")>=0)&&(Y.style[Le]=J.style[Le])}return J.parentElement.removeChild(J),!0}return!1}function g(Y,J){this.id=Y,this.plist=J}function f(Y,J){var he={before:null,after:null,start:null,end:null};return J.bpd==="tb"?(he.before=Y.top,he.after=Y.bottom,J.ipd==="lr"?(he.start=Y.left,he.end=Y.right):(he.start=Y.right,he.end=Y.left)):J.bpd==="lr"?(he.before=Y.left,he.after=Y.right,he.start=Y.top,he.end=Y.bottom):J.bpd==="rl"&&(he.before=Y.right,he.after=Y.left,he.start=Y.top,he.end=Y.bottom),he}function h(Y,J,he,Ee){if(J.localName!=="rt"&&J.localName!=="rtc"){var Le,et,Ae,Ze,Be=J.style.backgroundColor||Ee;if(J.childElementCount===0)if(J.localName==="span"||J.localName==="rb"){var Ne=f(J.getBoundingClientRect(),Y);if(he.length!==0&&(Le=Ne.before,et=Ne.after,Ae=he[he.length-1].before,et<(Ze=he[he.length-1].after)&&Le>Ae||Ze<=et&&Ae>=Le)){var tt=Math.sign(Ne.after-Ne.before),mt=Math.sign(Ne.end-Ne.start);tt*(Ne.before-he[he.length-1].before)<0&&(he[he.length-1].before=Ne.before),tt*(Ne.after-he[he.length-1].after)>0&&(he[he.length-1].after=Ne.after),mt*(Ne.start-he[he.length-1].start)<0&&(he[he.length-1].start=Ne.start,he[he.length-1].start_elem=he[he.length-1].elements.length),mt*(Ne.end-he[he.length-1].end)>0&&(he[he.length-1].end=Ne.end,he[he.length-1].end_elem=he[he.length-1].elements.length)}else he.push({before:Ne.before,after:Ne.after,start:Ne.start,end:Ne.end,start_elem:0,end_elem:0,elements:[],rbc:[],te:[],text:"",br:!1});he[he.length-1].text+=J.textContent,he[he.length-1].elements.push({node:J,bgcolor:Be,before:Ne.before,after:Ne.after})}else J.localName==="br"&&he.length!==0&&(he[he.length-1].br=!0);else for(var Ge=J.firstChild;Ge;)Ge.nodeType===Node.ELEMENT_NODE&&(h(Y,Ge,he,Be),Ge.localName==="ruby"||Ge.localName==="rtc"?he.length>0&&he[he.length-1].rbc.push(Ge):Ge.localName==="span"&&Ge.style[pe]&&Ge.style[pe]!=="none"&&he.length>0&&he[he.length-1].te.push(Ge)),Ge=Ge.nextSibling}}function y(Y,J,he,Ee){var Le;Ee.style!=="none"&&(Ee.style==="auto"?J.style[pe]="filled":J.style[pe]=Ee.style+" "+Ee.symbol,(Ee.position==="before"||Ee.position==="after")&&(Le=Y.bpd==="tb"?Ee.position==="before"?"left over":"left under":Y.bpd==="rl"?Ee.position==="before"?"right under":"left under":Ee.position==="before"?"left under":"right under",J.style[xe]=Le))}function E(Y,J){this.qname=Y,this.map=J}r.render=function(Y,J,he,Ee,Le,et,Ae,Ze,Be){var Ne=Ee||J.clientHeight,tt=Le||J.clientWidth;if(Y.aspectRatio!==null){var mt=Ne*Y.aspectRatio;mt>tt?Ne=Math.round(tt/Y.aspectRatio):tt=mt}var Ge=document.createElement("div");Ge.style.position="relative",Ge.style.width=tt+"px",Ge.style.height=Ne+"px",Ge.style.margin="auto",Ge.style.top=0,Ge.style.bottom=0,Ge.style.left=0,Ge.style.right=0,Ge.style.zIndex=0;var ut={h:Ne,w:tt,regionH:null,regionW:null,imgResolver:he,displayForcedOnlyMode:et||!1,isd:Y,errorHandler:Ae,previousISDState:Ze,enableRollUp:Be||!1,currentISDState:{},flg:null,lp:null,mra:null,ipd:null,bpd:null,ruby:null,textEmphasis:null,rubyReserve:null};if(J.appendChild(Ge),"contents"in Y)for(var Xe=0;Xe<Y.contents.length;Xe++)l(ut,Ge,Y.contents[Xe],Y);return ut.currentISDState};for(var _=[new E("http://www.w3.org/ns/ttml#styling backgroundColor",(function(Y,J,he,Ee){Ee[3]!==0&&(J.style.backgroundColor="rgba("+Ee[0].toString()+","+Ee[1].toString()+","+Ee[2].toString()+","+(Ee[3]/255).toString()+")")})),new E("http://www.w3.org/ns/ttml#styling color",(function(Y,J,he,Ee){J.style.color="rgba("+Ee[0].toString()+","+Ee[1].toString()+","+Ee[2].toString()+","+(Ee[3]/255).toString()+")"})),new E("http://www.w3.org/ns/ttml#styling direction",(function(Y,J,he,Ee){J.style.direction=Ee})),new E("http://www.w3.org/ns/ttml#styling display",(function(Y,J,he,Ee){})),new E("http://www.w3.org/ns/ttml#styling displayAlign",(function(Y,J,he,Ee){J.style.display="flex",J.style.flexDirection="column",Ee==="before"?J.style.justifyContent="flex-start":Ee==="center"?J.style.justifyContent="center":Ee==="after"&&(J.style.justifyContent="flex-end")})),new E("http://www.w3.org/ns/ttml#styling extent",(function(Y,J,he,Ee){Y.regionH=Ee.h.toUsedLength(Y.w,Y.h),Y.regionW=Ee.w.toUsedLength(Y.w,Y.h);var Le=0,et=0,Ae=he.styleAttrs["http://www.w3.org/ns/ttml#styling padding"];Ae&&(Le=Ae[0].toUsedLength(Y.w,Y.h)+Ae[2].toUsedLength(Y.w,Y.h),et=Ae[1].toUsedLength(Y.w,Y.h)+Ae[3].toUsedLength(Y.w,Y.h)),J.style.height=Y.regionH-Le+"px",J.style.width=Y.regionW-et+"px"})),new E("http://www.w3.org/ns/ttml#styling fontFamily",(function(Y,J,he,Ee){for(var Le=[],et=0;et<Ee.length;et++)Ee[et]=Ee[et].trim(),Ee[et]==="monospaceSerif"?(Le.push("Courier New"),Le.push('"Liberation Mono"'),Le.push("Courier"),Le.push("monospace")):Ee[et]==="proportionalSansSerif"?(Le.push("Arial"),Le.push("Helvetica"),Le.push('"Liberation Sans"'),Le.push("sans-serif")):Ee[et]==="monospace"?Le.push("monospace"):Ee[et]==="sansSerif"?Le.push("sans-serif"):Ee[et]==="serif"?Le.push("serif"):Ee[et]==="monospaceSansSerif"?(Le.push("Consolas"),Le.push("monospace")):Ee[et]==="proportionalSerif"?Le.push("serif"):Le.push(Ee[et]);if(Le.length>0){for(var Ae=[Le[0]],Ze=1;Ze<Le.length;Ze++)Ae.indexOf(Le[Ze])==-1&&Ae.push(Le[Ze]);Le=Ae}J.style.fontFamily=Le.join(",")})),new E("http://www.w3.org/ns/ttml#styling shear",(function(Y,J,he,Ee){if(Ee!==0){var Le=-.9*Ee;Y.bpd==="tb"?J.style.transform="skewX("+Le+"deg)":J.style.transform="skewY("+Le+"deg)"}})),new E("http://www.w3.org/ns/ttml#styling fontSize",(function(Y,J,he,Ee){J.style.fontSize=Ee.toUsedLength(Y.w,Y.h)+"px"})),new E("http://www.w3.org/ns/ttml#styling fontStyle",(function(Y,J,he,Ee){J.style.fontStyle=Ee})),new E("http://www.w3.org/ns/ttml#styling fontWeight",(function(Y,J,he,Ee){J.style.fontWeight=Ee})),new E("http://www.w3.org/ns/ttml#styling lineHeight",(function(Y,J,he,Ee){J.style.lineHeight=Ee==="normal"?"normal":Ee.toUsedLength(Y.w,Y.h)+"px"})),new E("http://www.w3.org/ns/ttml#styling opacity",(function(Y,J,he,Ee){J.style.opacity=Ee})),new E("http://www.w3.org/ns/ttml#styling origin",(function(Y,J,he,Ee){J.style.top=Ee.h.toUsedLength(Y.w,Y.h)+"px",J.style.left=Ee.w.toUsedLength(Y.w,Y.h)+"px"})),new E("http://www.w3.org/ns/ttml#styling overflow",(function(Y,J,he,Ee){J.style.overflow=Ee})),new E("http://www.w3.org/ns/ttml#styling padding",(function(Y,J,he,Ee){var Le=[];Le[0]=Ee[0].toUsedLength(Y.w,Y.h)+"px",Le[1]=Ee[3].toUsedLength(Y.w,Y.h)+"px",Le[2]=Ee[2].toUsedLength(Y.w,Y.h)+"px",Le[3]=Ee[1].toUsedLength(Y.w,Y.h)+"px",J.style.padding=Le.join(" ")})),new E("http://www.w3.org/ns/ttml#styling position",(function(Y,J,he,Ee){J.style.top=Ee.h.toUsedLength(Y.w,Y.h)+"px",J.style.left=Ee.w.toUsedLength(Y.w,Y.h)+"px"})),new E("http://www.w3.org/ns/ttml#styling rubyAlign",(function(Y,J,he,Ee){J.style.rubyAlign=Ee==="spaceAround"?"space-around":"center"})),new E("http://www.w3.org/ns/ttml#styling rubyPosition",(function(Y,J,he,Ee){var Le;Ee!=="before"&&Ee!=="after"||(Le=Z?Ee:Y.bpd==="tb"||Y.bpd==="rl"?Ee==="before"?"over":"under":Ee==="before"?"under":"over",J.parentElement.style[ae]=Le)})),new E("http://www.w3.org/ns/ttml#styling showBackground",null),new E("http://www.w3.org/ns/ttml#styling textAlign",(function(Y,J,he,Ee){var Le;Le=Ee==="start"?Y.ipd==="rl"?"right":"left":Ee==="end"?Y.ipd==="rl"?"left":"right":Ee,J.style.textAlign=Le})),new E("http://www.w3.org/ns/ttml#styling textDecoration",(function(Y,J,he,Ee){J.style.textDecoration=Ee.join(" ").replace("lineThrough","line-through")})),new E("http://www.w3.org/ns/ttml#styling textOutline",(function(Y,J,he,Ee){})),new E("http://www.w3.org/ns/ttml#styling textShadow",(function(Y,J,he,Ee){var Le=he.styleAttrs[o.byName.textOutline.qname];if(Ee==="none"&&Le==="none")J.style.textShadow="";else{var et=[];if(Le!=="none"){var Ae="rgba("+Le.color[0].toString()+","+Le.color[1].toString()+","+Le.color[2].toString()+","+(Le.color[3]/255).toString()+")";et.push("1px 1px 1px "+Ae),et.push("-1px 1px 1px "+Ae),et.push("1px -1px 1px "+Ae),et.push("-1px -1px 1px "+Ae)}if(Ee!=="none")for(var Ze=0;Ze<Ee.length;Ze++)et.push(Ee[Ze].x_off.toUsedLength(Y.w,Y.h)+"px "+Ee[Ze].y_off.toUsedLength(Y.w,Y.h)+"px "+Ee[Ze].b_radius.toUsedLength(Y.w,Y.h)+"px rgba("+Ee[Ze].color[0].toString()+","+Ee[Ze].color[1].toString()+","+Ee[Ze].color[2].toString()+","+(Ee[Ze].color[3]/255).toString()+")");J.style.textShadow=et.join(",")}})),new E("http://www.w3.org/ns/ttml#styling textCombine",(function(Y,J,he,Ee){J.style.textCombineUpright=Ee})),new E("http://www.w3.org/ns/ttml#styling textEmphasis",(function(Y,J,he,Ee){})),new E("http://www.w3.org/ns/ttml#styling unicodeBidi",(function(Y,J,he,Ee){var Le;Le=Ee==="bidiOverride"?"bidi-override":Ee,J.style.unicodeBidi=Le})),new E("http://www.w3.org/ns/ttml#styling visibility",(function(Y,J,he,Ee){J.style.visibility=Ee})),new E("http://www.w3.org/ns/ttml#styling wrapOption",(function(Y,J,he,Ee){Ee==="wrap"?he.space==="preserve"?J.style.whiteSpace="pre-wrap":J.style.whiteSpace="normal":he.space==="preserve"?J.style.whiteSpace="pre":J.style.whiteSpace="noWrap"})),new E("http://www.w3.org/ns/ttml#styling writingMode",(function(Y,J,he,Ee){Ee==="lrtb"||Ee==="lr"||Ee==="rltb"||Ee==="rl"?J.style.writingMode="horizontal-tb":Ee==="tblr"?J.style.writingMode="vertical-lr":Ee!=="tbrl"&&Ee!=="tb"||(J.style.writingMode="vertical-rl")})),new E("http://www.w3.org/ns/ttml#styling zIndex",(function(Y,J,he,Ee){J.style.zIndex=Ee})),new E("http://www.w3.org/ns/ttml/profile/imsc1#styling forcedDisplay",(function(Y,J,he,Ee){Y.displayForcedOnlyMode&&Ee===!1&&(J.style.visibility="hidden")}))],L={},K=0;K<_.length;K++)L[_[K].qname]=_[K];var Z="webkitRubyPosition"in window.getComputedStyle(document.documentElement),ae=Z?"webkitRubyPosition":"rubyPosition",pe="webkitTextEmphasisStyle"in window.getComputedStyle(document.documentElement)?"webkitTextEmphasisStyle":"textEmphasisStyle",xe="webkitTextEmphasisPosition"in window.getComputedStyle(document.documentElement)?"webkitTextEmphasisPosition":"textEmphasisPosition";function ke(Y,J){if(Y&&Y.error&&Y.error(J))throw J}})(e,typeof imscNames>"u"?t(977):imscNames,typeof imscStyles>"u"?t(1219):imscStyles,typeof imscUtils>"u"?t(6404):imscUtils)},8905:function(u,e,t){(function(n,r,i,o){n.generateISD=function(E,_,L){var K,Z=new f(E),ae={},pe={},xe=E.head.styling.initials[i.byName.showBackground.qname],ke=E.head.styling.initials[i.byName.backgroundColor.qname];for(var Y in E.head.layout.regions)if(E.head.layout.regions.hasOwnProperty(Y)){var J=E.head.layout.regions[Y],he=J.styleAttrs[i.byName.showBackground.qname]||xe,Ee=J.styleAttrs[i.byName.backgroundColor.qname]||ke;pe[J.id]=(he==="always"||he===void 0)&&Ee!==void 0&&!(_<J.begin||_>=J.end)}for(var Le in E.body&&E.body.regionID&&(pe[E.body.regionID]=!0),K=E.body!==null?(function Ae(Ze,Be){if(Be.contents){var Ne={};for(var tt in Be)Be.hasOwnProperty(tt)&&(Ne[tt]=Be[tt]);return Ne.contents=[],Be.contents.filter((function(mt){return!(Ze<mt.begin||Ze>=mt.end)})).forEach((function(mt){var Ge=Ae(Ze,mt);Ge.regionID&&(pe[Ge.regionID]=!0),Ge!==null&&Ne.contents.push(Ge)})),Ne}return Be})(_,E.body):null,pe[""]!==void 0&&(pe[""]=!0),pe)if(pe[Le]){var et=d(E,_,E.head.layout.regions[Le],K,null,"",E.head.layout.regions[Le],L,ae);et!==null&&Z.contents.push(et.element)}return Z};var l=[i.byName.color.qname,i.byName.textCombine.qname,i.byName.textDecoration.qname,i.byName.textEmphasis.qname,i.byName.textOutline.qname,i.byName.textShadow.qname];function d(E,_,L,K,Z,ae,pe,xe,ke){if(_<pe.begin||_>=pe.end)return null;var Y="regionID"in pe&&pe.regionID!==""?pe.regionID:ae;if(Z!==null&&Y!==L.id&&(!("contents"in pe)||"contents"in pe&&pe.contents.length===0||Y!==""))return null;var J=new h(pe);if("sets"in pe)for(var he=0;he<pe.sets.length;he++)_<pe.sets[he].begin||_>=pe.sets[he].end||(J.styleAttrs[pe.sets[he].qname]=pe.sets[he].value);var Ee={};for(var Le in J.styleAttrs)if(J.styleAttrs.hasOwnProperty(Le)&&(Ee[Le]=!0,J.kind==="region"&&Le===i.byName.writingMode.qname&&!(i.byName.direction.qname in J.styleAttrs))){var et=J.styleAttrs[Le];et==="lrtb"||et==="lr"?J.styleAttrs[i.byName.direction.qname]="ltr":et!=="rltb"&&et!=="rl"||(J.styleAttrs[i.byName.direction.qname]="rtl")}if(Z!==null)for(var Ae=0;Ae<i.all.length;Ae++){var Ze=i.all[Ae];if(Ze.qname===i.byName.textDecoration.qname){var Be=Z.styleAttrs[Ze.qname],Ne=J.styleAttrs[Ze.qname],tt=[];Ne===void 0?tt=Be:Ne.indexOf("none")===-1?((Ne.indexOf("noUnderline")===-1&&Be.indexOf("underline")!==-1||Ne.indexOf("underline")!==-1)&&tt.push("underline"),(Ne.indexOf("noLineThrough")===-1&&Be.indexOf("lineThrough")!==-1||Ne.indexOf("lineThrough")!==-1)&&tt.push("lineThrough"),(Ne.indexOf("noOverline")===-1&&Be.indexOf("overline")!==-1||Ne.indexOf("overline")!==-1)&&tt.push("overline")):tt.push("none"),J.styleAttrs[Ze.qname]=tt}else if(Ze.qname!==i.byName.fontSize.qname||Ze.qname in J.styleAttrs||J.kind!=="span"||J.styleAttrs[i.byName.ruby.qname]!=="textContainer")if(Ze.qname!==i.byName.fontSize.qname||Ze.qname in J.styleAttrs||J.kind!=="span"||J.styleAttrs[i.byName.ruby.qname]!=="text")Ze.inherit&&Ze.qname in Z.styleAttrs&&!(Ze.qname in J.styleAttrs)&&(J.styleAttrs[Ze.qname]=Z.styleAttrs[Ze.qname]);else{var mt=Z.styleAttrs[i.byName.fontSize.qname];Z.styleAttrs[i.byName.ruby.qname]==="textContainer"?J.styleAttrs[Ze.qname]=mt:J.styleAttrs[Ze.qname]=new o.ComputedLength(.5*mt.rw,.5*mt.rh)}else{var Ge=Z.styleAttrs[i.byName.fontSize.qname];J.styleAttrs[Ze.qname]=new o.ComputedLength(.5*Ge.rw,.5*Ge.rh)}}for(var ut=0;ut<i.all.length;ut++){var Xe=i.all[ut];if(!(Xe.qname in J.styleAttrs)&&!(Xe.qname===i.byName.position.qname&&i.byName.origin.qname in J.styleAttrs||Xe.qname===i.byName.origin.qname&&i.byName.position.qname in J.styleAttrs)){var nt=E.head.styling.initials[Xe.qname]||Xe.initial;if(nt!==null&&(J.kind==="region"||Xe.inherit===!1&&nt!==null)){var Ft=Xe.parse(nt);Ft!==null?(J.styleAttrs[Xe.qname]=Ft,Ee[Xe.qname]=!0):y(xe,"Invalid initial value for '"+Xe.qname+"' on element '"+J.kind)}}}for(var Xt=0;Xt<i.all.length;Xt++){var Pe=i.all[Xt];if(Pe.qname in Ee&&Pe.compute!==null){var De=Pe.compute(E,Z,J,J.styleAttrs[Pe.qname],ke);De!==null?J.styleAttrs[Pe.qname]=De:(J.styleAttrs[Pe.qname]=Pe.compute(E,Z,J,Pe.parse(Pe.initial),ke),y(xe,"Style '"+Pe.qname+"' on element '"+J.kind+"' cannot be computed"))}}if(J.styleAttrs[i.byName.display.qname]==="none")return null;var dt=null;Z===null?dt=K===null?[]:[K]:"contents"in pe&&(dt=pe.contents);for(var Q=0;dt!==null&&Q<dt.length;Q++){var H=d(E,_,L,K,J,Y,dt[Q],xe,ke);H!==null&&J.contents.push(H.element)}for(var w in J.styleAttrs)if(J.styleAttrs.hasOwnProperty(w)){var D=!1;if(J.kind==="span"){var oe=J.styleAttrs[i.byName.ruby.qname];(D=(oe==="container"||oe==="textContainer"||oe==="baseContainer")&&l.indexOf(w)!==-1)||(D=oe!=="container"&&w===i.byName.rubyAlign.qname),D||(D=!(oe==="textContainer"||oe==="text")&&w===i.byName.rubyPosition.qname)}if(!D){var F=i.byQName[w];"applies"in F&&(D=F.applies.indexOf(J.kind)===-1)}D&&delete J.styleAttrs[w]}var Me=J.styleAttrs[i.byName.ruby.qname];if(J.kind==="p"||J.kind==="span"&&(Me==="textContainer"||Me==="text")){var We=[];c(J,We),(function(Ue){for(var je,Oe=0;Oe<Ue.length;)if((je=Ue[Oe]).kind!=="br"&&je.space!=="preserve"){var He=je.text.replace(/[\t\r\n ]+/g," ");/^[ ]/.test(He)&&(Oe===0||(st=Ue[Oe-1]).kind==="br"||/[\r\n\t ]$/.test(st.text))&&(He=He.substring(1)),je.text=He,He.length===0?Ue.splice(Oe,1):Oe++}else Oe++;var st,it;for(Oe=0;Oe<Ue.length;Oe++)(je=Ue[Oe]).kind!=="br"&&je.space!=="preserve"?/[ ]$/.test(je.text)&&(Oe===Ue.length-1||(it=Ue[Oe+1]).kind==="br"||it.space==="preserve"&&/^[\r\n]/.test(it.text))&&(je.text=je.text.slice(0,-1)):Oe++})(We),g(J)}return J.kind==="div"&&i.byName.backgroundImage.qname in J.styleAttrs||J.kind==="br"||J.kind==="image"||"contents"in J&&J.contents.length>0||J.kind==="span"&&J.text!==null||J.kind==="region"&&J.styleAttrs[i.byName.showBackground.qname]==="always"?{region_id:Y,element:J}:null}function c(E,_){if("contents"in E)for(var L=0;L<E.contents.length;L++){var K=E.contents[L],Z=K.styleAttrs[i.byName.ruby.qname];(K.kind!=="span"||Z!=="textContainer"&&Z!=="text")&&("contents"in K?c(K,_):(K.kind==="span"&&K.text.length!==0||K.kind==="br")&&_.push(K))}}function g(E){if(E.kind==="br")return!1;if("text"in E)return E.text.length===0;if("contents"in E){for(var _=E.contents.length;_--;)g(E.contents[_])&&E.contents.splice(_,1);return E.contents.length===0}}function f(E){this.contents=[],this.aspectRatio=E.aspectRatio,this.lang=E.lang}function h(E){for(var _ in this.kind=E.kind||"region",this.lang=E.lang,E.id&&(this.id=E.id),this.styleAttrs={},E.styleAttrs)E.styleAttrs.hasOwnProperty(_)&&(this.styleAttrs[_]=E.styleAttrs[_]);"src"in E&&(this.src=E.src),"type"in E&&(this.type=E.type),"text"in E?this.text=E.text:(this.kind==="region"||"contents"in E)&&(this.contents=[]),"space"in E&&(this.space=E.space)}function y(E,_){if(E&&E.error&&E.error(_))throw _}})(e,typeof imscNames>"u"?t(977):imscNames,typeof imscStyles>"u"?t(1219):imscStyles,typeof imscUtils>"u"?t(6404):imscUtils)},7640:function(u,e,t){e.generateISD=t(8905).generateISD,e.fromXML=t(6739).fromXML,e.renderHTML=t(1612).render},977:function(u,e){(function(t){t.ns_tt="http://www.w3.org/ns/ttml",t.ns_tts="http://www.w3.org/ns/ttml#styling",t.ns_ttp="http://www.w3.org/ns/ttml#parameter",t.ns_xml="http://www.w3.org/XML/1998/namespace",t.ns_itts="http://www.w3.org/ns/ttml/profile/imsc1#styling",t.ns_ittp="http://www.w3.org/ns/ttml/profile/imsc1#parameter",t.ns_smpte="http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt",t.ns_ebutts="urn:ebu:tt:style"})(e)},1219:function(u,e,t){(function(n,r,i){function o(c,g,f,h,y,E,_,L){this.name=g,this.ns=c,this.qname=c+" "+g,this.inherit=y,this.animatable=E,this.initial=f,this.applies=h,this.parse=_,this.compute=L}for(var l in n.all=[new o(r.ns_tts,"backgroundColor","transparent",["body","div","p","region","span"],!1,!0,i.parseColor,null),new o(r.ns_tts,"color","white",["span"],!0,!0,i.parseColor,null),new o(r.ns_tts,"direction","ltr",["p","span"],!0,!0,(function(c){return c}),null),new o(r.ns_tts,"display","auto",["body","div","p","region","span"],!1,!0,(function(c){return c}),null),new o(r.ns_tts,"displayAlign","before",["region"],!1,!0,(function(c){return c}),null),new o(r.ns_tts,"extent","auto",["tt","region"],!1,!0,(function(c){if(c==="auto")return c;var g=c.split(" ");if(g.length!==2)return null;var f=i.parseLength(g[0]),h=i.parseLength(g[1]);return h&&f?{h,w:f}:null}),(function(c,g,f,h,y){var E,_;if(h==="auto")E=new i.ComputedLength(0,1);else if((E=i.toComputedLength(h.h.value,h.h.unit,null,c.dimensions.h,null,c.pxLength.h))===null)return null;if(h==="auto")_=new i.ComputedLength(1,0);else if((_=i.toComputedLength(h.w.value,h.w.unit,null,c.dimensions.w,null,c.pxLength.w))===null)return null;return{h:E,w:_}})),new o(r.ns_tts,"fontFamily","default",["span","p"],!0,!0,(function(c){for(var g=c.split(","),f=[],h=0;h<g.length;h++)g[h]=g[h].trim(),g[h].charAt(0)!=="'"&&g[h].charAt(0)!=='"'&&g[h]==="default"?f.push("monospaceSerif"):f.push(g[h]);return f}),null),new o(r.ns_tts,"shear","0%",["p"],!0,!0,i.parseLength,(function(c,g,f,h){return h.unit!=="%"?null:Math.abs(h.value)>100?100*Math.sign(h.value):h.value})),new o(r.ns_tts,"fontSize","1c",["span","p"],!0,!0,i.parseLength,(function(c,g,f,h,y){return i.toComputedLength(h.value,h.unit,g!==null?g.styleAttrs[n.byName.fontSize.qname]:c.cellLength.h,g!==null?g.styleAttrs[n.byName.fontSize.qname]:c.cellLength.h,c.cellLength.h,c.pxLength.h)})),new o(r.ns_tts,"fontStyle","normal",["span","p"],!0,!0,(function(c){return c}),null),new o(r.ns_tts,"fontWeight","normal",["span","p"],!0,!0,(function(c){return c}),null),new o(r.ns_tts,"lineHeight","normal",["p"],!0,!0,(function(c){return c==="normal"?c:i.parseLength(c)}),(function(c,g,f,h,y){var E;if(h==="normal")E=h;else if((E=i.toComputedLength(h.value,h.unit,f.styleAttrs[n.byName.fontSize.qname],f.styleAttrs[n.byName.fontSize.qname],c.cellLength.h,c.pxLength.h))===null)return null;return E})),new o(r.ns_tts,"opacity",1,["region"],!1,!0,parseFloat,null),new o(r.ns_tts,"origin","auto",["region"],!1,!0,(function(c){if(c==="auto")return c;var g=c.split(" ");if(g.length!==2)return null;var f=i.parseLength(g[0]),h=i.parseLength(g[1]);return h&&f?{h,w:f}:null}),(function(c,g,f,h,y){var E,_;if(h==="auto")E=new i.ComputedLength(0,0);else if((E=i.toComputedLength(h.h.value,h.h.unit,null,c.dimensions.h,null,c.pxLength.h))===null)return null;if(h==="auto")_=new i.ComputedLength(0,0);else if((_=i.toComputedLength(h.w.value,h.w.unit,null,c.dimensions.w,null,c.pxLength.w))===null)return null;return{h:E,w:_}})),new o(r.ns_tts,"overflow","hidden",["region"],!1,!0,(function(c){return c}),null),new o(r.ns_tts,"padding","0px",["region"],!1,!0,(function(c){var g=c.split(" ");if(g.length>4)return null;for(var f=[],h=0;h<g.length;h++){var y=i.parseLength(g[h]);if(!y)return null;f.push(y)}return f}),(function(c,g,f,h,y){var E;if(h.length===1)E=[h[0],h[0],h[0],h[0]];else if(h.length===2)E=[h[0],h[1],h[0],h[1]];else if(h.length===3)E=[h[0],h[1],h[2],h[1]];else{if(h.length!==4)return null;E=[h[0],h[1],h[2],h[3]]}var _=f.styleAttrs[n.byName.writingMode.qname];if(_==="lrtb"||_==="lr")E=[E[0],E[3],E[2],E[1]];else if(_==="rltb"||_==="rl")E=[E[0],E[1],E[2],E[3]];else if(_==="tblr")E=[E[3],E[0],E[1],E[2]];else{if(_!=="tbrl"&&_!=="tb")return null;E=[E[3],E[2],E[1],E[0]]}for(var L=[],K=0;K<E.length;K++)if(E[K].value===0)L[K]=new i.ComputedLength(0,0);else if(L[K]=i.toComputedLength(E[K].value,E[K].unit,f.styleAttrs[n.byName.fontSize.qname],K===0||K===2?f.styleAttrs[n.byName.extent.qname].h:f.styleAttrs[n.byName.extent.qname].w,K===0||K===2?c.cellLength.h:c.cellLength.w,K===0||K===2?c.pxLength.h:c.pxLength.w),L[K]===null)return null;return L})),new o(r.ns_tts,"position","top left",["region"],!1,!0,(function(c){return i.parsePosition(c)}),(function(c,g,f,h){var y,E;return(y=i.toComputedLength(h.v.offset.value,h.v.offset.unit,null,new i.ComputedLength(-f.styleAttrs[n.byName.extent.qname].h.rw,c.dimensions.h.rh-f.styleAttrs[n.byName.extent.qname].h.rh),null,c.pxLength.h))===null?null:(h.v.edge==="bottom"&&(y=new i.ComputedLength(-y.rw-f.styleAttrs[n.byName.extent.qname].h.rw,c.dimensions.h.rh-y.rh-f.styleAttrs[n.byName.extent.qname].h.rh)),E=i.toComputedLength(h.h.offset.value,h.h.offset.unit,null,new i.ComputedLength(c.dimensions.w.rw-f.styleAttrs[n.byName.extent.qname].w.rw,-f.styleAttrs[n.byName.extent.qname].w.rh),null,c.pxLength.w),y===null?null:(h.h.edge==="right"&&(E=new i.ComputedLength(c.dimensions.w.rw-E.rw-f.styleAttrs[n.byName.extent.qname].w.rw,-E.rh-f.styleAttrs[n.byName.extent.qname].w.rh)),{h:y,w:E}))})),new o(r.ns_tts,"ruby","none",["span"],!1,!0,(function(c){return c}),null),new o(r.ns_tts,"rubyAlign","center",["span"],!0,!0,(function(c){return c!=="center"&&c!=="spaceAround"?null:c}),null),new o(r.ns_tts,"rubyPosition","outside",["span"],!0,!0,(function(c){return c}),null),new o(r.ns_tts,"rubyReserve","none",["p"],!0,!0,(function(c){var g=c.split(" "),f=[null,null];if(g.length===0||g.length>2||g[0]!=="none"&&g[0]!=="both"&&g[0]!=="after"&&g[0]!=="before"&&g[0]!=="outside")return null;if(f[0]=g[0],g.length===2&&g[0]!=="none"){var h=i.parseLength(g[1]);if(!h)return null;f[1]=h}return f}),(function(c,g,f,h,y){if(h[0]==="none")return h;var E;return(E=h[1]===null?new i.ComputedLength(.5*f.styleAttrs[n.byName.fontSize.qname].rw,.5*f.styleAttrs[n.byName.fontSize.qname].rh):i.toComputedLength(h[1].value,h[1].unit,f.styleAttrs[n.byName.fontSize.qname],f.styleAttrs[n.byName.fontSize.qname],c.cellLength.h,c.pxLength.h))===null?null:[h[0],E]})),new o(r.ns_tts,"showBackground","always",["region"],!1,!0,(function(c){return c}),null),new o(r.ns_tts,"textAlign","start",["p"],!0,!0,(function(c){return c}),(function(c,g,f,h,y){return h==="left"?"start":h==="right"?"end":h})),new o(r.ns_tts,"textCombine","none",["span"],!0,!0,(function(c){return c==="none"||c==="all"?c:null}),null),new o(r.ns_tts,"textDecoration","none",["span"],!0,!0,(function(c){return c.split(" ")}),null),new o(r.ns_tts,"textEmphasis","none",["span"],!0,!0,(function(c){for(var g=c.split(" "),f={style:null,symbol:null,color:null,position:null},h=0;h<g.length;h++)if(g[h]==="none"||g[h]==="auto")f.style=g[h];else if(g[h]==="filled"||g[h]==="open")f.style=g[h];else if(g[h]==="circle"||g[h]==="dot"||g[h]==="sesame")f.symbol=g[h];else if(g[h]==="current")f.color=g[h];else if(g[h]==="outside"||g[h]==="before"||g[h]==="after")f.position=g[h];else if(f.color=i.parseColor(g[h]),f.color===null)return null;return f.style==null&&f.symbol==null?f.style="auto":(f.symbol=f.symbol||"circle",f.style=f.style||"filled"),f.position=f.position||"outside",f.color=f.color||"current",f}),null),new o(r.ns_tts,"textOutline","none",["span"],!0,!0,(function(c){if(c==="none")return c;var g={},f=c.split(" ");if(f.length===0||f.length>2)return null;var h=i.parseColor(f[0]);if(g.color=h,h!==null&&f.shift(),f.length!==1)return null;var y=i.parseLength(f[0]);return y?(g.thickness=y,g):null}),(function(c,g,f,h,y){if(h==="none")return h;var E={};return h.color===null?E.color=f.styleAttrs[n.byName.color.qname]:E.color=h.color,E.thickness=i.toComputedLength(h.thickness.value,h.thickness.unit,f.styleAttrs[n.byName.fontSize.qname],f.styleAttrs[n.byName.fontSize.qname],c.cellLength.h,c.pxLength.h),E.thickness===null?null:E})),new o(r.ns_tts,"textShadow","none",["span"],!0,!0,i.parseTextShadow,(function(c,g,f,h){if(h==="none")return h;for(var y=[],E=0;E<h.length;E++){var _={};if(_.x_off=i.toComputedLength(h[E][0].value,h[E][0].unit,null,f.styleAttrs[n.byName.fontSize.qname],null,c.pxLength.w),_.x_off===null||(_.y_off=i.toComputedLength(h[E][1].value,h[E][1].unit,null,f.styleAttrs[n.byName.fontSize.qname],null,c.pxLength.h),_.y_off===null))return null;if(h[E][2]===null)_.b_radius=0;else if(_.b_radius=i.toComputedLength(h[E][2].value,h[E][2].unit,null,f.styleAttrs[n.byName.fontSize.qname],null,c.pxLength.h),_.b_radius===null)return null;h[E][3]===null?_.color=f.styleAttrs[n.byName.color.qname]:_.color=h[E][3],y.push(_)}return y})),new o(r.ns_tts,"unicodeBidi","normal",["span","p"],!1,!0,(function(c){return c}),null),new o(r.ns_tts,"visibility","visible",["body","div","p","region","span"],!0,!0,(function(c){return c}),null),new o(r.ns_tts,"wrapOption","wrap",["span"],!0,!0,(function(c){return c}),null),new o(r.ns_tts,"writingMode","lrtb",["region"],!1,!0,(function(c){return c}),null),new o(r.ns_tts,"zIndex","auto",["region"],!1,!0,(function(c){var g;return c==="auto"?g=c:(g=parseInt(c),isNaN(g)&&(g=null)),g}),null),new o(r.ns_ebutts,"linePadding","0c",["p"],!0,!1,i.parseLength,(function(c,g,f,h,y){return i.toComputedLength(h.value,h.unit,null,null,c.cellLength.w,null)})),new o(r.ns_ebutts,"multiRowAlign","auto",["p"],!0,!1,(function(c){return c}),null),new o(r.ns_smpte,"backgroundImage",null,["div"],!1,!1,(function(c){return c}),null),new o(r.ns_itts,"forcedDisplay","false",["body","div","p","region","span"],!0,!0,(function(c){return c==="true"}),null),new o(r.ns_itts,"fillLineGap","false",["p"],!0,!0,(function(c){return c==="true"}),null)],n.byQName={},n.all)n.byQName[n.all[l].qname]=n.all[l];for(var d in n.byName={},n.all)n.byName[n.all[d].name]=n.all[d]})(e,typeof imscNames>"u"?t(977):imscNames,typeof imscUtils>"u"?t(6404):imscUtils)},6404:function(u,e){(function(t){var n=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?/,r=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,i=/rgba\(\s*(\d+),\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,o={transparent:[0,0,0,0],black:[0,0,0,255],silver:[192,192,192,255],gray:[128,128,128,255],white:[255,255,255,255],maroon:[128,0,0,255],red:[255,0,0,255],purple:[128,0,128,255],fuchsia:[255,0,255,255],magenta:[255,0,255,255],green:[0,128,0,255],lime:[0,255,0,255],olive:[128,128,0,255],yellow:[255,255,0,255],navy:[0,0,128,255],blue:[0,0,255,255],teal:[0,128,128,255],aqua:[0,255,255,255],cyan:[0,255,255,255]};t.parseColor=function(d){var c,g=null,f=o[d.toLowerCase()];return f!==void 0?g=f:(c=n.exec(d))!==null?g=[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16),c[4]!==void 0?parseInt(c[4],16):255]:(c=r.exec(d))!==null?g=[parseInt(c[1]),parseInt(c[2]),parseInt(c[3]),255]:(c=i.exec(d))!==null&&(g=[parseInt(c[1]),parseInt(c[2]),parseInt(c[3]),parseInt(c[4])]),g};var l=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%|rh|rw)$/;t.parseLength=function(d){var c,g=null;return(c=l.exec(d))!==null&&(g={value:parseFloat(c[1]),unit:c[2]}),g},t.parseTextShadow=function(d){for(var c=d.match(/([^\(,\)]|\([^\)]+\))+/g),g=[],f=0;f<c.length;f++){var h=c[f].split(" ");if(h.length===1&&h[0]==="none")return"none";if(h.length>1&&h.length<5){var y=[null,null,null,null],E=t.parseLength(h.shift());if(E===null||(y[0]=E,(E=t.parseLength(h.shift()))===null))return null;if(y[1]=E,h.length===0){g.push(y);continue}if((E=t.parseLength(h[0]))!==null&&(y[2]=E,h.shift()),h.length===0){g.push(y);continue}var _=t.parseColor(h[0]);if(_===null)return null;y[3]=_,g.push(y)}}return g},t.parsePosition=function(d){var c=d.split(" "),g=function(K){return K==="center"||K==="left"||K==="top"||K==="bottom"||K==="right"};if(c.length>4)return null;for(var f=0;f<c.length;f++)if(!g(c[f])){var h=t.parseLength(c[f]);if(h===null)return null;c[f]=h}for(var y={h:{edge:"left",offset:{value:50,unit:"%"}},v:{edge:"top",offset:{value:50,unit:"%"}}},E=0;E<c.length;){var _=c[E++];if(g(_)){var L={value:0,unit:"%"};c.length!==2&&E<c.length&&!g(c[E])&&(L=c[E++]),_==="right"?(y.h.edge=_,y.h.offset=L):_==="bottom"?(y.v.edge=_,y.v.offset=L):_==="left"?y.h.offset=L:_==="top"&&(y.v.offset=L)}else{if(c.length!==1&&c.length!==2)return null;E===1?y.h.offset=_:y.v.offset=_}}return y},t.ComputedLength=function(d,c){this.rw=d,this.rh=c},t.ComputedLength.prototype.toUsedLength=function(d,c){return d*this.rw+c*this.rh},t.ComputedLength.prototype.isZero=function(){return this.rw===0&&this.rh===0},t.toComputedLength=function(d,c,g,f,h,y){return c==="%"&&f?new t.ComputedLength(f.rw*d/100,f.rh*d/100):c==="em"&&g?new t.ComputedLength(g.rw*d,g.rh*d):c==="c"&&h?new t.ComputedLength(d*h.rw,d*h.rh):c==="px"&&y?new t.ComputedLength(d*y.rw,d*y.rh):c==="rh"?new t.ComputedLength(0,d/100):c==="rw"?new t.ComputedLength(d/100,0):null}})(e)},7523:function(u){typeof Object.create=="function"?u.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:u.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},3282:function(u){function e(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}function t(r,i){for(var o,l="",d=0,c=-1,g=0,f=0;f<=r.length;++f){if(f<r.length)o=r.charCodeAt(f);else{if(o===47)break;o=47}if(o===47){if(!(c===f-1||g===1))if(c!==f-1&&g===2){if(l.length<2||d!==2||l.charCodeAt(l.length-1)!==46||l.charCodeAt(l.length-2)!==46){if(l.length>2){var h=l.lastIndexOf("/");if(h!==l.length-1){h===-1?(l="",d=0):d=(l=l.slice(0,h)).length-1-l.lastIndexOf("/"),c=f,g=0;continue}}else if(l.length===2||l.length===1){l="",d=0,c=f,g=0;continue}}i&&(l.length>0?l+="/..":l="..",d=2)}else l.length>0?l+="/"+r.slice(c+1,f):l=r.slice(c+1,f),d=f-c-1;c=f,g=0}else o===46&&g!==-1?++g:g=-1}return l}var n={resolve:function(){for(var r,i="",o=!1,l=arguments.length-1;l>=-1&&!o;l--){var d;l>=0?d=arguments[l]:(r===void 0&&(r=process.cwd()),d=r),e(d),d.length!==0&&(i=d+"/"+i,o=d.charCodeAt(0)===47)}return i=t(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(r){if(e(r),r.length===0)return".";var i=r.charCodeAt(0)===47,o=r.charCodeAt(r.length-1)===47;return(r=t(r,!i)).length!==0||i||(r="."),r.length>0&&o&&(r+="/"),i?"/"+r:r},isAbsolute:function(r){return e(r),r.length>0&&r.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var r,i=0;i<arguments.length;++i){var o=arguments[i];e(o),o.length>0&&(r===void 0?r=o:r+="/"+o)}return r===void 0?".":n.normalize(r)},relative:function(r,i){if(e(r),e(i),r===i||(r=n.resolve(r))===(i=n.resolve(i)))return"";for(var o=1;o<r.length&&r.charCodeAt(o)===47;++o);for(var l=r.length,d=l-o,c=1;c<i.length&&i.charCodeAt(c)===47;++c);for(var g=i.length-c,f=d<g?d:g,h=-1,y=0;y<=f;++y){if(y===f){if(g>f){if(i.charCodeAt(c+y)===47)return i.slice(c+y+1);if(y===0)return i.slice(c+y)}else d>f&&(r.charCodeAt(o+y)===47?h=y:y===0&&(h=0));break}var E=r.charCodeAt(o+y);if(E!==i.charCodeAt(c+y))break;E===47&&(h=y)}var _="";for(y=o+h+1;y<=l;++y)y!==l&&r.charCodeAt(y)!==47||(_.length===0?_+="..":_+="/..");return _.length>0?_+i.slice(c+h):(c+=h,i.charCodeAt(c)===47&&++c,i.slice(c))},_makeLong:function(r){return r},dirname:function(r){if(e(r),r.length===0)return".";for(var i=r.charCodeAt(0),o=i===47,l=-1,d=!0,c=r.length-1;c>=1;--c)if((i=r.charCodeAt(c))===47){if(!d){l=c;break}}else d=!1;return l===-1?o?"/":".":o&&l===1?"//":r.slice(0,l)},basename:function(r,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');e(r);var o,l=0,d=-1,c=!0;if(i!==void 0&&i.length>0&&i.length<=r.length){if(i.length===r.length&&i===r)return"";var g=i.length-1,f=-1;for(o=r.length-1;o>=0;--o){var h=r.charCodeAt(o);if(h===47){if(!c){l=o+1;break}}else f===-1&&(c=!1,f=o+1),g>=0&&(h===i.charCodeAt(g)?--g==-1&&(d=o):(g=-1,d=f))}return l===d?d=f:d===-1&&(d=r.length),r.slice(l,d)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===47){if(!c){l=o+1;break}}else d===-1&&(c=!1,d=o+1);return d===-1?"":r.slice(l,d)},extname:function(r){e(r);for(var i=-1,o=0,l=-1,d=!0,c=0,g=r.length-1;g>=0;--g){var f=r.charCodeAt(g);if(f!==47)l===-1&&(d=!1,l=g+1),f===46?i===-1?i=g:c!==1&&(c=1):i!==-1&&(c=-1);else if(!d){o=g+1;break}}return i===-1||l===-1||c===0||c===1&&i===l-1&&i===o+1?"":r.slice(i,l)},format:function(r){if(r===null||typeof r!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof r);return(function(i,o){var l=o.dir||o.root,d=o.base||(o.name||"")+(o.ext||"");return l?l===o.root?l+d:l+"/"+d:d})(0,r)},parse:function(r){e(r);var i={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return i;var o,l=r.charCodeAt(0),d=l===47;d?(i.root="/",o=1):o=0;for(var c=-1,g=0,f=-1,h=!0,y=r.length-1,E=0;y>=o;--y)if((l=r.charCodeAt(y))!==47)f===-1&&(h=!1,f=y+1),l===46?c===-1?c=y:E!==1&&(E=1):c!==-1&&(E=-1);else if(!h){g=y+1;break}return c===-1||f===-1||E===0||E===1&&c===f-1&&c===g+1?f!==-1&&(i.base=i.name=g===0&&d?r.slice(1,f):r.slice(g,f)):(g===0&&d?(i.name=r.slice(1,c),i.base=r.slice(1,f)):(i.name=r.slice(g,c),i.base=r.slice(g,f)),i.ext=r.slice(c,f)),g>0?i.dir=r.slice(0,g-1):d&&(i.dir="/"),i},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,u.exports=n},3515:function(u,e,t){u.exports=r;var n=t(9826).EventEmitter;function r(){n.call(this)}t(7523)(r,n),r.Readable=t(2762),r.Writable=t(3726),r.Duplex=t(884),r.Transform=t(6756),r.PassThrough=t(1390),r.finished=t(2896),r.pipeline=t(8460),r.Stream=r,r.prototype.pipe=function(i,o){var l=this;function d(_){i.writable&&i.write(_)===!1&&l.pause&&l.pause()}function c(){l.readable&&l.resume&&l.resume()}l.on("data",d),i.on("drain",c),i._isStdio||o&&o.end===!1||(l.on("end",f),l.on("close",h));var g=!1;function f(){g||(g=!0,i.end())}function h(){g||(g=!0,typeof i.destroy=="function"&&i.destroy())}function y(_){if(E(),n.listenerCount(this,"error")===0)throw _}function E(){l.removeListener("data",d),i.removeListener("drain",c),l.removeListener("end",f),l.removeListener("close",h),l.removeListener("error",y),i.removeListener("error",y),l.removeListener("end",E),l.removeListener("close",E),i.removeListener("close",E)}return l.on("error",y),i.on("error",y),l.on("end",E),l.on("close",E),i.on("close",E),i.emit("pipe",l),i}},1602:function(u){var e={};function t(r,i,o){o||(o=Error);var l=(function(d){var c,g;function f(h,y,E){return d.call(this,(function(_,L,K){return typeof i=="string"?i:i(_,L,K)})(h,y,E))||this}return g=d,(c=f).prototype=Object.create(g.prototype),c.prototype.constructor=c,c.__proto__=g,f})(o);l.prototype.name=o.name,l.prototype.code=r,e[r]=l}function n(r,i){if(Array.isArray(r)){var o=r.length;return r=r.map((function(l){return String(l)})),o>2?"one of ".concat(i," ").concat(r.slice(0,o-1).join(", "),", or ")+r[o-1]:o===2?"one of ".concat(i," ").concat(r[0]," or ").concat(r[1]):"of ".concat(i," ").concat(r[0])}return"of ".concat(i," ").concat(String(r))}t("ERR_INVALID_OPT_VALUE",(function(r,i){return'The value "'+i+'" is invalid for option "'+r+'"'}),TypeError),t("ERR_INVALID_ARG_TYPE",(function(r,i,o){var l,d,c,g,f;if(typeof i=="string"&&(d="not ",i.substr(0,4)===d)?(l="must not be",i=i.replace(/^not /,"")):l="must be",(function(y,E,_){return(_===void 0||_>y.length)&&(_=y.length),y.substring(_-9,_)===E})(r," argument"))c="The ".concat(r," ").concat(l," ").concat(n(i,"type"));else{var h=(typeof f!="number"&&(f=0),f+1>(g=r).length||g.indexOf(".",f)===-1?"argument":"property");c='The "'.concat(r,'" ').concat(h," ").concat(l," ").concat(n(i,"type"))}return c+". Received type ".concat(typeof o)}),TypeError),t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),t("ERR_METHOD_NOT_IMPLEMENTED",(function(r){return"The "+r+" method is not implemented"})),t("ERR_STREAM_PREMATURE_CLOSE","Premature close"),t("ERR_STREAM_DESTROYED",(function(r){return"Cannot call "+r+" after a stream was destroyed"})),t("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),t("ERR_STREAM_WRITE_AFTER_END","write after end"),t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),t("ERR_UNKNOWN_ENCODING",(function(r){return"Unknown encoding: "+r}),TypeError),t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),u.exports.codes=e},884:function(u,e,t){var n=Object.keys||function(h){var y=[];for(var E in h)y.push(E);return y};u.exports=c;var r=t(2762),i=t(3726);t(7523)(c,r);for(var o=n(i.prototype),l=0;l<o.length;l++){var d=o[l];c.prototype[d]||(c.prototype[d]=i.prototype[d])}function c(h){if(!(this instanceof c))return new c(h);r.call(this,h),i.call(this,h),this.allowHalfOpen=!0,h&&(h.readable===!1&&(this.readable=!1),h.writable===!1&&(this.writable=!1),h.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",g)))}function g(){this._writableState.ended||process.nextTick(f,this)}function f(h){h.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(h){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=h,this._writableState.destroyed=h)}})},1390:function(u,e,t){u.exports=r;var n=t(6756);function r(i){if(!(this instanceof r))return new r(i);n.call(this,i)}t(7523)(r,n),r.prototype._transform=function(i,o,l){l(null,i)}},2762:function(u,e,t){var n;u.exports=J,J.ReadableState=Y,t(9826).EventEmitter;var r,i=function(Pe,De){return Pe.listeners(De).length},o=t(2611),l=t(44).Buffer,d=(t.g!==void 0?t.g:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},c=t(7199);r=c&&c.debuglog?c.debuglog("stream"):function(){};var g,f,h,y=t(3791),E=t(2410),_=t(1749).getHighWaterMark,L=t(1602).codes,K=L.ERR_INVALID_ARG_TYPE,Z=L.ERR_STREAM_PUSH_AFTER_EOF,ae=L.ERR_METHOD_NOT_IMPLEMENTED,pe=L.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;t(7523)(J,o);var xe=E.errorOrDestroy,ke=["error","close","destroy","pause","resume"];function Y(Pe,De,dt){n=n||t(884),Pe=Pe||{},typeof dt!="boolean"&&(dt=De instanceof n),this.objectMode=!!Pe.objectMode,dt&&(this.objectMode=this.objectMode||!!Pe.readableObjectMode),this.highWaterMark=_(this,Pe,"readableHighWaterMark",dt),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=Pe.emitClose!==!1,this.autoDestroy=!!Pe.autoDestroy,this.destroyed=!1,this.defaultEncoding=Pe.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Pe.encoding&&(g||(g=t(748).StringDecoder),this.decoder=new g(Pe.encoding),this.encoding=Pe.encoding)}function J(Pe){if(n=n||t(884),!(this instanceof J))return new J(Pe);var De=this instanceof n;this._readableState=new Y(Pe,this,De),this.readable=!0,Pe&&(typeof Pe.read=="function"&&(this._read=Pe.read),typeof Pe.destroy=="function"&&(this._destroy=Pe.destroy)),o.call(this)}function he(Pe,De,dt,Q,H){r("readableAddChunk",De);var w,D=Pe._readableState;if(De===null)D.reading=!1,(function(oe,F){if(r("onEofChunk"),!F.ended){if(F.decoder){var Me=F.decoder.end();Me&&Me.length&&(F.buffer.push(Me),F.length+=F.objectMode?1:Me.length)}F.ended=!0,F.sync?Ae(oe):(F.needReadable=!1,F.emittedReadable||(F.emittedReadable=!0,Ze(oe)))}})(Pe,D);else if(H||(w=(function(oe,F){var Me,We;return We=F,l.isBuffer(We)||We instanceof d||typeof F=="string"||F===void 0||oe.objectMode||(Me=new K("chunk",["string","Buffer","Uint8Array"],F)),Me})(D,De)),w)xe(Pe,w);else if(D.objectMode||De&&De.length>0)if(typeof De=="string"||D.objectMode||Object.getPrototypeOf(De)===l.prototype||(De=(function(oe){return l.from(oe)})(De)),Q)D.endEmitted?xe(Pe,new pe):Ee(Pe,D,De,!0);else if(D.ended)xe(Pe,new Z);else{if(D.destroyed)return!1;D.reading=!1,D.decoder&&!dt?(De=D.decoder.write(De),D.objectMode||De.length!==0?Ee(Pe,D,De,!1):Be(Pe,D)):Ee(Pe,D,De,!1)}else Q||(D.reading=!1,Be(Pe,D));return!D.ended&&(D.length<D.highWaterMark||D.length===0)}function Ee(Pe,De,dt,Q){De.flowing&&De.length===0&&!De.sync?(De.awaitDrain=0,Pe.emit("data",dt)):(De.length+=De.objectMode?1:dt.length,Q?De.buffer.unshift(dt):De.buffer.push(dt),De.needReadable&&Ae(Pe)),Be(Pe,De)}Object.defineProperty(J.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(Pe){this._readableState&&(this._readableState.destroyed=Pe)}}),J.prototype.destroy=E.destroy,J.prototype._undestroy=E.undestroy,J.prototype._destroy=function(Pe,De){De(Pe)},J.prototype.push=function(Pe,De){var dt,Q=this._readableState;return Q.objectMode?dt=!0:typeof Pe=="string"&&((De=De||Q.defaultEncoding)!==Q.encoding&&(Pe=l.from(Pe,De),De=""),dt=!0),he(this,Pe,De,!1,dt)},J.prototype.unshift=function(Pe){return he(this,Pe,null,!0,!1)},J.prototype.isPaused=function(){return this._readableState.flowing===!1},J.prototype.setEncoding=function(Pe){g||(g=t(748).StringDecoder);var De=new g(Pe);this._readableState.decoder=De,this._readableState.encoding=this._readableState.decoder.encoding;for(var dt=this._readableState.buffer.head,Q="";dt!==null;)Q+=De.write(dt.data),dt=dt.next;return this._readableState.buffer.clear(),Q!==""&&this._readableState.buffer.push(Q),this._readableState.length=Q.length,this};var Le=1073741824;function et(Pe,De){return Pe<=0||De.length===0&&De.ended?0:De.objectMode?1:Pe!=Pe?De.flowing&&De.length?De.buffer.head.data.length:De.length:(Pe>De.highWaterMark&&(De.highWaterMark=(function(dt){return dt>=Le?dt=Le:(dt--,dt|=dt>>>1,dt|=dt>>>2,dt|=dt>>>4,dt|=dt>>>8,dt|=dt>>>16,dt++),dt})(Pe)),Pe<=De.length?Pe:De.ended?De.length:(De.needReadable=!0,0))}function Ae(Pe){var De=Pe._readableState;r("emitReadable",De.needReadable,De.emittedReadable),De.needReadable=!1,De.emittedReadable||(r("emitReadable",De.flowing),De.emittedReadable=!0,process.nextTick(Ze,Pe))}function Ze(Pe){var De=Pe._readableState;r("emitReadable_",De.destroyed,De.length,De.ended),De.destroyed||!De.length&&!De.ended||(Pe.emit("readable"),De.emittedReadable=!1),De.needReadable=!De.flowing&&!De.ended&&De.length<=De.highWaterMark,ut(Pe)}function Be(Pe,De){De.readingMore||(De.readingMore=!0,process.nextTick(Ne,Pe,De))}function Ne(Pe,De){for(;!De.reading&&!De.ended&&(De.length<De.highWaterMark||De.flowing&&De.length===0);){var dt=De.length;if(r("maybeReadMore read 0"),Pe.read(0),dt===De.length)break}De.readingMore=!1}function tt(Pe){var De=Pe._readableState;De.readableListening=Pe.listenerCount("readable")>0,De.resumeScheduled&&!De.paused?De.flowing=!0:Pe.listenerCount("data")>0&&Pe.resume()}function mt(Pe){r("readable nexttick read 0"),Pe.read(0)}function Ge(Pe,De){r("resume",De.reading),De.reading||Pe.read(0),De.resumeScheduled=!1,Pe.emit("resume"),ut(Pe),De.flowing&&!De.reading&&Pe.read(0)}function ut(Pe){var De=Pe._readableState;for(r("flow",De.flowing);De.flowing&&Pe.read()!==null;);}function Xe(Pe,De){return De.length===0?null:(De.objectMode?dt=De.buffer.shift():!Pe||Pe>=De.length?(dt=De.decoder?De.buffer.join(""):De.buffer.length===1?De.buffer.first():De.buffer.concat(De.length),De.buffer.clear()):dt=De.buffer.consume(Pe,De.decoder),dt);var dt}function nt(Pe){var De=Pe._readableState;r("endReadable",De.endEmitted),De.endEmitted||(De.ended=!0,process.nextTick(Ft,De,Pe))}function Ft(Pe,De){if(r("endReadableNT",Pe.endEmitted,Pe.length),!Pe.endEmitted&&Pe.length===0&&(Pe.endEmitted=!0,De.readable=!1,De.emit("end"),Pe.autoDestroy)){var dt=De._writableState;(!dt||dt.autoDestroy&&dt.finished)&&De.destroy()}}function Xt(Pe,De){for(var dt=0,Q=Pe.length;dt<Q;dt++)if(Pe[dt]===De)return dt;return-1}J.prototype.read=function(Pe){r("read",Pe),Pe=parseInt(Pe,10);var De=this._readableState,dt=Pe;if(Pe!==0&&(De.emittedReadable=!1),Pe===0&&De.needReadable&&((De.highWaterMark!==0?De.length>=De.highWaterMark:De.length>0)||De.ended))return r("read: emitReadable",De.length,De.ended),De.length===0&&De.ended?nt(this):Ae(this),null;if((Pe=et(Pe,De))===0&&De.ended)return De.length===0&&nt(this),null;var Q,H=De.needReadable;return r("need readable",H),(De.length===0||De.length-Pe<De.highWaterMark)&&r("length less than watermark",H=!0),De.ended||De.reading?r("reading or ended",H=!1):H&&(r("do read"),De.reading=!0,De.sync=!0,De.length===0&&(De.needReadable=!0),this._read(De.highWaterMark),De.sync=!1,De.reading||(Pe=et(dt,De))),(Q=Pe>0?Xe(Pe,De):null)===null?(De.needReadable=De.length<=De.highWaterMark,Pe=0):(De.length-=Pe,De.awaitDrain=0),De.length===0&&(De.ended||(De.needReadable=!0),dt!==Pe&&De.ended&&nt(this)),Q!==null&&this.emit("data",Q),Q},J.prototype._read=function(Pe){xe(this,new ae("_read()"))},J.prototype.pipe=function(Pe,De){var dt=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=Pe;break;case 1:Q.pipes=[Q.pipes,Pe];break;default:Q.pipes.push(Pe)}Q.pipesCount+=1,r("pipe count=%d opts=%j",Q.pipesCount,De);var H=De&&De.end===!1||Pe===process.stdout||Pe===process.stderr?je:w;function w(){r("onend"),Pe.end()}Q.endEmitted?process.nextTick(H):dt.once("end",H),Pe.on("unpipe",(function Oe(He,st){r("onunpipe"),He===dt&&st&&st.hasUnpiped===!1&&(st.hasUnpiped=!0,r("cleanup"),Pe.removeListener("close",We),Pe.removeListener("finish",Ue),Pe.removeListener("drain",D),Pe.removeListener("error",Me),Pe.removeListener("unpipe",Oe),dt.removeListener("end",w),dt.removeListener("end",je),dt.removeListener("data",F),oe=!0,!Q.awaitDrain||Pe._writableState&&!Pe._writableState.needDrain||D())}));var D=(function(Oe){return function(){var He=Oe._readableState;r("pipeOnDrain",He.awaitDrain),He.awaitDrain&&He.awaitDrain--,He.awaitDrain===0&&i(Oe,"data")&&(He.flowing=!0,ut(Oe))}})(dt);Pe.on("drain",D);var oe=!1;function F(Oe){r("ondata");var He=Pe.write(Oe);r("dest.write",He),He===!1&&((Q.pipesCount===1&&Q.pipes===Pe||Q.pipesCount>1&&Xt(Q.pipes,Pe)!==-1)&&!oe&&(r("false write response, pause",Q.awaitDrain),Q.awaitDrain++),dt.pause())}function Me(Oe){r("onerror",Oe),je(),Pe.removeListener("error",Me),i(Pe,"error")===0&&xe(Pe,Oe)}function We(){Pe.removeListener("finish",Ue),je()}function Ue(){r("onfinish"),Pe.removeListener("close",We),je()}function je(){r("unpipe"),dt.unpipe(Pe)}return dt.on("data",F),(function(Oe,He,st){if(typeof Oe.prependListener=="function")return Oe.prependListener(He,st);Oe._events&&Oe._events[He]?Array.isArray(Oe._events[He])?Oe._events[He].unshift(st):Oe._events[He]=[st,Oe._events[He]]:Oe.on(He,st)})(Pe,"error",Me),Pe.once("close",We),Pe.once("finish",Ue),Pe.emit("pipe",dt),Q.flowing||(r("pipe resume"),dt.resume()),Pe},J.prototype.unpipe=function(Pe){var De=this._readableState,dt={hasUnpiped:!1};if(De.pipesCount===0)return this;if(De.pipesCount===1)return Pe&&Pe!==De.pipes||(Pe||(Pe=De.pipes),De.pipes=null,De.pipesCount=0,De.flowing=!1,Pe&&Pe.emit("unpipe",this,dt)),this;if(!Pe){var Q=De.pipes,H=De.pipesCount;De.pipes=null,De.pipesCount=0,De.flowing=!1;for(var w=0;w<H;w++)Q[w].emit("unpipe",this,{hasUnpiped:!1});return this}var D=Xt(De.pipes,Pe);return D===-1||(De.pipes.splice(D,1),De.pipesCount-=1,De.pipesCount===1&&(De.pipes=De.pipes[0]),Pe.emit("unpipe",this,dt)),this},J.prototype.on=function(Pe,De){var dt=o.prototype.on.call(this,Pe,De),Q=this._readableState;return Pe==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):Pe==="readable"&&(Q.endEmitted||Q.readableListening||(Q.readableListening=Q.needReadable=!0,Q.flowing=!1,Q.emittedReadable=!1,r("on readable",Q.length,Q.reading),Q.length?Ae(this):Q.reading||process.nextTick(mt,this))),dt},J.prototype.addListener=J.prototype.on,J.prototype.removeListener=function(Pe,De){var dt=o.prototype.removeListener.call(this,Pe,De);return Pe==="readable"&&process.nextTick(tt,this),dt},J.prototype.removeAllListeners=function(Pe){var De=o.prototype.removeAllListeners.apply(this,arguments);return Pe!=="readable"&&Pe!==void 0||process.nextTick(tt,this),De},J.prototype.resume=function(){var Pe=this._readableState;return Pe.flowing||(r("resume"),Pe.flowing=!Pe.readableListening,(function(De,dt){dt.resumeScheduled||(dt.resumeScheduled=!0,process.nextTick(Ge,De,dt))})(this,Pe)),Pe.paused=!1,this},J.prototype.pause=function(){return r("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(r("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},J.prototype.wrap=function(Pe){var De=this,dt=this._readableState,Q=!1;for(var H in Pe.on("end",(function(){if(r("wrapped end"),dt.decoder&&!dt.ended){var D=dt.decoder.end();D&&D.length&&De.push(D)}De.push(null)})),Pe.on("data",(function(D){r("wrapped data"),dt.decoder&&(D=dt.decoder.write(D)),dt.objectMode&&D==null||(dt.objectMode||D&&D.length)&&(De.push(D)||(Q=!0,Pe.pause()))})),Pe)this[H]===void 0&&typeof Pe[H]=="function"&&(this[H]=(function(D){return function(){return Pe[D].apply(Pe,arguments)}})(H));for(var w=0;w<ke.length;w++)Pe.on(ke[w],this.emit.bind(this,ke[w]));return this._read=function(D){r("wrapped _read",D),Q&&(Q=!1,Pe.resume())},this},typeof Symbol=="function"&&(J.prototype[Symbol.asyncIterator]=function(){return f===void 0&&(f=t(5857)),f(this)}),Object.defineProperty(J.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(J.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(J.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(Pe){this._readableState&&(this._readableState.flowing=Pe)}}),J._fromList=Xe,Object.defineProperty(J.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(J.from=function(Pe,De){return h===void 0&&(h=t(3411)),h(J,Pe,De)})},6756:function(u,e,t){u.exports=g;var n=t(1602).codes,r=n.ERR_METHOD_NOT_IMPLEMENTED,i=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,l=n.ERR_TRANSFORM_WITH_LENGTH_0,d=t(884);function c(y,E){var _=this._transformState;_.transforming=!1;var L=_.writecb;if(L===null)return this.emit("error",new i);_.writechunk=null,_.writecb=null,E!=null&&this.push(E),L(y);var K=this._readableState;K.reading=!1,(K.needReadable||K.length<K.highWaterMark)&&this._read(K.highWaterMark)}function g(y){if(!(this instanceof g))return new g(y);d.call(this,y),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,y&&(typeof y.transform=="function"&&(this._transform=y.transform),typeof y.flush=="function"&&(this._flush=y.flush)),this.on("prefinish",f)}function f(){var y=this;typeof this._flush!="function"||this._readableState.destroyed?h(this,null,null):this._flush((function(E,_){h(y,E,_)}))}function h(y,E,_){if(E)return y.emit("error",E);if(_!=null&&y.push(_),y._writableState.length)throw new l;if(y._transformState.transforming)throw new o;return y.push(null)}t(7523)(g,d),g.prototype.push=function(y,E){return this._transformState.needTransform=!1,d.prototype.push.call(this,y,E)},g.prototype._transform=function(y,E,_){_(new r("_transform()"))},g.prototype._write=function(y,E,_){var L=this._transformState;if(L.writecb=_,L.writechunk=y,L.writeencoding=E,!L.transforming){var K=this._readableState;(L.needTransform||K.needReadable||K.length<K.highWaterMark)&&this._read(K.highWaterMark)}},g.prototype._read=function(y){var E=this._transformState;E.writechunk===null||E.transforming?E.needTransform=!0:(E.transforming=!0,this._transform(E.writechunk,E.writeencoding,E.afterTransform))},g.prototype._destroy=function(y,E){d.prototype._destroy.call(this,y,(function(_){E(_)}))}},3726:function(u,e,t){function n(Be){var Ne=this;this.next=null,this.entry=null,this.finish=function(){(function(tt,mt){var Ge=tt.entry;for(tt.entry=null;Ge;){var ut=Ge.callback;mt.pendingcb--,ut(void 0),Ge=Ge.next}mt.corkedRequestsFree.next=tt})(Ne,Be)}}var r;u.exports=J,J.WritableState=Y;var i,o={deprecate:t(9e3)},l=t(2611),d=t(44).Buffer,c=(t.g!==void 0?t.g:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},g=t(2410),f=t(1749).getHighWaterMark,h=t(1602).codes,y=h.ERR_INVALID_ARG_TYPE,E=h.ERR_METHOD_NOT_IMPLEMENTED,_=h.ERR_MULTIPLE_CALLBACK,L=h.ERR_STREAM_CANNOT_PIPE,K=h.ERR_STREAM_DESTROYED,Z=h.ERR_STREAM_NULL_VALUES,ae=h.ERR_STREAM_WRITE_AFTER_END,pe=h.ERR_UNKNOWN_ENCODING,xe=g.errorOrDestroy;function ke(){}function Y(Be,Ne,tt){r=r||t(884),Be=Be||{},typeof tt!="boolean"&&(tt=Ne instanceof r),this.objectMode=!!Be.objectMode,tt&&(this.objectMode=this.objectMode||!!Be.writableObjectMode),this.highWaterMark=f(this,Be,"writableHighWaterMark",tt),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var mt=Be.decodeStrings===!1;this.decodeStrings=!mt,this.defaultEncoding=Be.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Ge){(function(ut,Xe){var nt=ut._writableState,Ft=nt.sync,Xt=nt.writecb;if(typeof Xt!="function")throw new _;if((function(De){De.writing=!1,De.writecb=null,De.length-=De.writelen,De.writelen=0})(nt),Xe)(function(De,dt,Q,H,w){--dt.pendingcb,Q?(process.nextTick(w,H),process.nextTick(Ze,De,dt),De._writableState.errorEmitted=!0,xe(De,H)):(w(H),De._writableState.errorEmitted=!0,xe(De,H),Ze(De,dt))})(ut,nt,Ft,Xe,Xt);else{var Pe=et(nt)||ut.destroyed;Pe||nt.corked||nt.bufferProcessing||!nt.bufferedRequest||Le(ut,nt),Ft?process.nextTick(Ee,ut,nt,Pe,Xt):Ee(ut,nt,Pe,Xt)}})(Ne,Ge)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Be.emitClose!==!1,this.autoDestroy=!!Be.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function J(Be){var Ne=this instanceof(r=r||t(884));if(!Ne&&!i.call(J,this))return new J(Be);this._writableState=new Y(Be,this,Ne),this.writable=!0,Be&&(typeof Be.write=="function"&&(this._write=Be.write),typeof Be.writev=="function"&&(this._writev=Be.writev),typeof Be.destroy=="function"&&(this._destroy=Be.destroy),typeof Be.final=="function"&&(this._final=Be.final)),l.call(this)}function he(Be,Ne,tt,mt,Ge,ut,Xe){Ne.writelen=mt,Ne.writecb=Xe,Ne.writing=!0,Ne.sync=!0,Ne.destroyed?Ne.onwrite(new K("write")):tt?Be._writev(Ge,Ne.onwrite):Be._write(Ge,ut,Ne.onwrite),Ne.sync=!1}function Ee(Be,Ne,tt,mt){tt||(function(Ge,ut){ut.length===0&&ut.needDrain&&(ut.needDrain=!1,Ge.emit("drain"))})(Be,Ne),Ne.pendingcb--,mt(),Ze(Be,Ne)}function Le(Be,Ne){Ne.bufferProcessing=!0;var tt=Ne.bufferedRequest;if(Be._writev&&tt&&tt.next){var mt=Ne.bufferedRequestCount,Ge=new Array(mt),ut=Ne.corkedRequestsFree;ut.entry=tt;for(var Xe=0,nt=!0;tt;)Ge[Xe]=tt,tt.isBuf||(nt=!1),tt=tt.next,Xe+=1;Ge.allBuffers=nt,he(Be,Ne,!0,Ne.length,Ge,"",ut.finish),Ne.pendingcb++,Ne.lastBufferedRequest=null,ut.next?(Ne.corkedRequestsFree=ut.next,ut.next=null):Ne.corkedRequestsFree=new n(Ne),Ne.bufferedRequestCount=0}else{for(;tt;){var Ft=tt.chunk,Xt=tt.encoding,Pe=tt.callback;if(he(Be,Ne,!1,Ne.objectMode?1:Ft.length,Ft,Xt,Pe),tt=tt.next,Ne.bufferedRequestCount--,Ne.writing)break}tt===null&&(Ne.lastBufferedRequest=null)}Ne.bufferedRequest=tt,Ne.bufferProcessing=!1}function et(Be){return Be.ending&&Be.length===0&&Be.bufferedRequest===null&&!Be.finished&&!Be.writing}function Ae(Be,Ne){Be._final((function(tt){Ne.pendingcb--,tt&&xe(Be,tt),Ne.prefinished=!0,Be.emit("prefinish"),Ze(Be,Ne)}))}function Ze(Be,Ne){var tt=et(Ne);if(tt&&((function(Ge,ut){ut.prefinished||ut.finalCalled||(typeof Ge._final!="function"||ut.destroyed?(ut.prefinished=!0,Ge.emit("prefinish")):(ut.pendingcb++,ut.finalCalled=!0,process.nextTick(Ae,Ge,ut)))})(Be,Ne),Ne.pendingcb===0&&(Ne.finished=!0,Be.emit("finish"),Ne.autoDestroy))){var mt=Be._readableState;(!mt||mt.autoDestroy&&mt.endEmitted)&&Be.destroy()}return tt}t(7523)(J,l),Y.prototype.getBuffer=function(){for(var Be=this.bufferedRequest,Ne=[];Be;)Ne.push(Be),Be=Be.next;return Ne},(function(){try{Object.defineProperty(Y.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(i=Function.prototype[Symbol.hasInstance],Object.defineProperty(J,Symbol.hasInstance,{value:function(Be){return!!i.call(this,Be)||this===J&&Be&&Be._writableState instanceof Y}})):i=function(Be){return Be instanceof this},J.prototype.pipe=function(){xe(this,new L)},J.prototype.write=function(Be,Ne,tt){var mt,Ge=this._writableState,ut=!1,Xe=!Ge.objectMode&&(mt=Be,d.isBuffer(mt)||mt instanceof c);return Xe&&!d.isBuffer(Be)&&(Be=(function(nt){return d.from(nt)})(Be)),typeof Ne=="function"&&(tt=Ne,Ne=null),Xe?Ne="buffer":Ne||(Ne=Ge.defaultEncoding),typeof tt!="function"&&(tt=ke),Ge.ending?(function(nt,Ft){var Xt=new ae;xe(nt,Xt),process.nextTick(Ft,Xt)})(this,tt):(Xe||(function(nt,Ft,Xt,Pe){var De;return Xt===null?De=new Z:typeof Xt=="string"||Ft.objectMode||(De=new y("chunk",["string","Buffer"],Xt)),!De||(xe(nt,De),process.nextTick(Pe,De),!1)})(this,Ge,Be,tt))&&(Ge.pendingcb++,ut=(function(nt,Ft,Xt,Pe,De,dt){if(!Xt){var Q=(function(oe,F,Me){return oe.objectMode||oe.decodeStrings===!1||typeof F!="string"||(F=d.from(F,Me)),F})(Ft,Pe,De);Pe!==Q&&(Xt=!0,De="buffer",Pe=Q)}var H=Ft.objectMode?1:Pe.length;Ft.length+=H;var w=Ft.length<Ft.highWaterMark;if(w||(Ft.needDrain=!0),Ft.writing||Ft.corked){var D=Ft.lastBufferedRequest;Ft.lastBufferedRequest={chunk:Pe,encoding:De,isBuf:Xt,callback:dt,next:null},D?D.next=Ft.lastBufferedRequest:Ft.bufferedRequest=Ft.lastBufferedRequest,Ft.bufferedRequestCount+=1}else he(nt,Ft,!1,H,Pe,De,dt);return w})(this,Ge,Xe,Be,Ne,tt)),ut},J.prototype.cork=function(){this._writableState.corked++},J.prototype.uncork=function(){var Be=this._writableState;Be.corked&&(Be.corked--,Be.writing||Be.corked||Be.bufferProcessing||!Be.bufferedRequest||Le(this,Be))},J.prototype.setDefaultEncoding=function(Be){if(typeof Be=="string"&&(Be=Be.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Be+"").toLowerCase())>-1))throw new pe(Be);return this._writableState.defaultEncoding=Be,this},Object.defineProperty(J.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(J.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),J.prototype._write=function(Be,Ne,tt){tt(new E("_write()"))},J.prototype._writev=null,J.prototype.end=function(Be,Ne,tt){var mt=this._writableState;return typeof Be=="function"?(tt=Be,Be=null,Ne=null):typeof Ne=="function"&&(tt=Ne,Ne=null),Be!=null&&this.write(Be,Ne),mt.corked&&(mt.corked=1,this.uncork()),mt.ending||(function(Ge,ut,Xe){ut.ending=!0,Ze(Ge,ut),Xe&&(ut.finished?process.nextTick(Xe):Ge.once("finish",Xe)),ut.ended=!0,Ge.writable=!1})(this,mt,tt),this},Object.defineProperty(J.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(J.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(Be){this._writableState&&(this._writableState.destroyed=Be)}}),J.prototype.destroy=g.destroy,J.prototype._undestroy=g.undestroy,J.prototype._destroy=function(Be,Ne){Ne(Be)}},5857:function(u,e,t){var n;function r(Z,ae,pe){return(ae=(function(xe){var ke=(function(Y){if(typeof Y!="object"||Y===null)return Y;var J=Y[Symbol.toPrimitive];if(J!==void 0){var he=J.call(Y,"string");if(typeof he!="object")return he;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(Y)})(xe);return typeof ke=="symbol"?ke:String(ke)})(ae))in Z?Object.defineProperty(Z,ae,{value:pe,enumerable:!0,configurable:!0,writable:!0}):Z[ae]=pe,Z}var i=t(2896),o=Symbol("lastResolve"),l=Symbol("lastReject"),d=Symbol("error"),c=Symbol("ended"),g=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function y(Z,ae){return{value:Z,done:ae}}function E(Z){var ae=Z[o];if(ae!==null){var pe=Z[h].read();pe!==null&&(Z[g]=null,Z[o]=null,Z[l]=null,ae(y(pe,!1)))}}function _(Z){process.nextTick(E,Z)}var L=Object.getPrototypeOf((function(){})),K=Object.setPrototypeOf((r(n={get stream(){return this[h]},next:function(){var Z=this,ae=this[d];if(ae!==null)return Promise.reject(ae);if(this[c])return Promise.resolve(y(void 0,!0));if(this[h].destroyed)return new Promise((function(Y,J){process.nextTick((function(){Z[d]?J(Z[d]):Y(y(void 0,!0))}))}));var pe,xe=this[g];if(xe)pe=new Promise((function(Y,J){return function(he,Ee){Y.then((function(){J[c]?he(y(void 0,!0)):J[f](he,Ee)}),Ee)}})(xe,this));else{var ke=this[h].read();if(ke!==null)return Promise.resolve(y(ke,!1));pe=new Promise(this[f])}return this[g]=pe,pe}},Symbol.asyncIterator,(function(){return this})),r(n,"return",(function(){var Z=this;return new Promise((function(ae,pe){Z[h].destroy(null,(function(xe){xe?pe(xe):ae(y(void 0,!0))}))}))})),n),L);u.exports=function(Z){var ae,pe=Object.create(K,(r(ae={},h,{value:Z,writable:!0}),r(ae,o,{value:null,writable:!0}),r(ae,l,{value:null,writable:!0}),r(ae,d,{value:null,writable:!0}),r(ae,c,{value:Z._readableState.endEmitted,writable:!0}),r(ae,f,{value:function(xe,ke){var Y=pe[h].read();Y?(pe[g]=null,pe[o]=null,pe[l]=null,xe(y(Y,!1))):(pe[o]=xe,pe[l]=ke)},writable:!0}),ae));return pe[g]=null,i(Z,(function(xe){if(xe&&xe.code!=="ERR_STREAM_PREMATURE_CLOSE"){var ke=pe[l];return ke!==null&&(pe[g]=null,pe[o]=null,pe[l]=null,ke(xe)),void(pe[d]=xe)}var Y=pe[o];Y!==null&&(pe[g]=null,pe[o]=null,pe[l]=null,Y(y(void 0,!0))),pe[c]=!0})),Z.on("readable",_.bind(null,pe)),pe}},3791:function(u,e,t){function n(f,h){var y=Object.keys(f);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(f);h&&(E=E.filter((function(_){return Object.getOwnPropertyDescriptor(f,_).enumerable}))),y.push.apply(y,E)}return y}function r(f){for(var h=1;h<arguments.length;h++){var y=arguments[h]!=null?arguments[h]:{};h%2?n(Object(y),!0).forEach((function(E){i(f,E,y[E])})):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(y)):n(Object(y)).forEach((function(E){Object.defineProperty(f,E,Object.getOwnPropertyDescriptor(y,E))}))}return f}function i(f,h,y){return(h=l(h))in f?Object.defineProperty(f,h,{value:y,enumerable:!0,configurable:!0,writable:!0}):f[h]=y,f}function o(f,h){for(var y=0;y<h.length;y++){var E=h[y];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(f,l(E.key),E)}}function l(f){var h=(function(y){if(typeof y!="object"||y===null)return y;var E=y[Symbol.toPrimitive];if(E!==void 0){var _=E.call(y,"string");if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(y)})(f);return typeof h=="symbol"?h:String(h)}var d=t(44).Buffer,c=t(3779).inspect,g=c&&c.custom||"inspect";u.exports=(function(){function f(){(function(E,_){if(!(E instanceof _))throw new TypeError("Cannot call a class as a function")})(this,f),this.head=null,this.tail=null,this.length=0}var h,y;return h=f,(y=[{key:"push",value:function(E){var _={data:E,next:null};this.length>0?this.tail.next=_:this.head=_,this.tail=_,++this.length}},{key:"unshift",value:function(E){var _={data:E,next:this.head};this.length===0&&(this.tail=_),this.head=_,++this.length}},{key:"shift",value:function(){if(this.length!==0){var E=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,E}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";for(var _=this.head,L=""+_.data;_=_.next;)L+=E+_.data;return L}},{key:"concat",value:function(E){if(this.length===0)return d.alloc(0);for(var _,L,K,Z=d.allocUnsafe(E>>>0),ae=this.head,pe=0;ae;)_=ae.data,L=Z,K=pe,d.prototype.copy.call(_,L,K),pe+=ae.data.length,ae=ae.next;return Z}},{key:"consume",value:function(E,_){var L;return E<this.head.data.length?(L=this.head.data.slice(0,E),this.head.data=this.head.data.slice(E)):L=E===this.head.data.length?this.shift():_?this._getString(E):this._getBuffer(E),L}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(E){var _=this.head,L=1,K=_.data;for(E-=K.length;_=_.next;){var Z=_.data,ae=E>Z.length?Z.length:E;if(ae===Z.length?K+=Z:K+=Z.slice(0,E),(E-=ae)==0){ae===Z.length?(++L,_.next?this.head=_.next:this.head=this.tail=null):(this.head=_,_.data=Z.slice(ae));break}++L}return this.length-=L,K}},{key:"_getBuffer",value:function(E){var _=d.allocUnsafe(E),L=this.head,K=1;for(L.data.copy(_),E-=L.data.length;L=L.next;){var Z=L.data,ae=E>Z.length?Z.length:E;if(Z.copy(_,_.length-E,0,ae),(E-=ae)==0){ae===Z.length?(++K,L.next?this.head=L.next:this.head=this.tail=null):(this.head=L,L.data=Z.slice(ae));break}++K}return this.length-=K,_}},{key:g,value:function(E,_){return c(this,r(r({},_),{},{depth:0,customInspect:!1}))}}])&&o(h.prototype,y),Object.defineProperty(h,"prototype",{writable:!1}),f})()},2410:function(u){function e(r,i){n(r,i),t(r)}function t(r){r._writableState&&!r._writableState.emitClose||r._readableState&&!r._readableState.emitClose||r.emit("close")}function n(r,i){r.emit("error",i)}u.exports={destroy:function(r,i){var o=this,l=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return l||d?(i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(n,this,r)):process.nextTick(n,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,(function(c){!i&&c?o._writableState?o._writableState.errorEmitted?process.nextTick(t,o):(o._writableState.errorEmitted=!0,process.nextTick(e,o,c)):process.nextTick(e,o,c):i?(process.nextTick(t,o),i(c)):process.nextTick(t,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(r,i){var o=r._readableState,l=r._writableState;o&&o.autoDestroy||l&&l.autoDestroy?r.destroy(i):r.emit("error",i)}}},2896:function(u,e,t){var n=t(1602).codes.ERR_STREAM_PREMATURE_CLOSE;function r(){}u.exports=function i(o,l,d){if(typeof l=="function")return i(o,null,l);l||(l={}),d=(function(ae){var pe=!1;return function(){if(!pe){pe=!0;for(var xe=arguments.length,ke=new Array(xe),Y=0;Y<xe;Y++)ke[Y]=arguments[Y];ae.apply(this,ke)}}})(d||r);var c=l.readable||l.readable!==!1&&o.readable,g=l.writable||l.writable!==!1&&o.writable,f=function(){o.writable||y()},h=o._writableState&&o._writableState.finished,y=function(){g=!1,h=!0,c||d.call(o)},E=o._readableState&&o._readableState.endEmitted,_=function(){c=!1,E=!0,g||d.call(o)},L=function(ae){d.call(o,ae)},K=function(){var ae;return c&&!E?(o._readableState&&o._readableState.ended||(ae=new n),d.call(o,ae)):g&&!h?(o._writableState&&o._writableState.ended||(ae=new n),d.call(o,ae)):void 0},Z=function(){o.req.on("finish",y)};return(function(ae){return ae.setHeader&&typeof ae.abort=="function"})(o)?(o.on("complete",y),o.on("abort",K),o.req?Z():o.on("request",Z)):g&&!o._writableState&&(o.on("end",f),o.on("close",f)),o.on("end",_),o.on("finish",y),l.error!==!1&&o.on("error",L),o.on("close",K),function(){o.removeListener("complete",y),o.removeListener("abort",K),o.removeListener("request",Z),o.req&&o.req.removeListener("finish",y),o.removeListener("end",f),o.removeListener("close",f),o.removeListener("finish",y),o.removeListener("end",_),o.removeListener("error",L),o.removeListener("close",K)}}},3411:function(u){u.exports=function(){throw new Error("Readable.from is not available in the browser")}},8460:function(u,e,t){var n,r=t(1602).codes,i=r.ERR_MISSING_ARGS,o=r.ERR_STREAM_DESTROYED;function l(g){if(g)throw g}function d(g){g()}function c(g,f){return g.pipe(f)}u.exports=function(){for(var g=arguments.length,f=new Array(g),h=0;h<g;h++)f[h]=arguments[h];var y,E=(function(L){return L.length?typeof L[L.length-1]!="function"?l:L.pop():l})(f);if(Array.isArray(f[0])&&(f=f[0]),f.length<2)throw new i("streams");var _=f.map((function(L,K){var Z=K<f.length-1;return(function(ae,pe,xe,ke){ke=(function(he){var Ee=!1;return function(){Ee||(Ee=!0,he.apply(void 0,arguments))}})(ke);var Y=!1;ae.on("close",(function(){Y=!0})),n===void 0&&(n=t(2896)),n(ae,{readable:pe,writable:xe},(function(he){if(he)return ke(he);Y=!0,ke()}));var J=!1;return function(he){if(!Y&&!J)return J=!0,(function(Ee){return Ee.setHeader&&typeof Ee.abort=="function"})(ae)?ae.abort():typeof ae.destroy=="function"?ae.destroy():void ke(he||new o("pipe"))}})(L,Z,K>0,(function(ae){y||(y=ae),ae&&_.forEach(d),Z||(_.forEach(d),E(y))}))}));return f.reduce(c)}},1749:function(u,e,t){var n=t(1602).codes.ERR_INVALID_OPT_VALUE;u.exports={getHighWaterMark:function(r,i,o,l){var d=(function(c,g,f){return c.highWaterMark!=null?c.highWaterMark:g?c[f]:null})(i,l,o);if(d!=null){if(!isFinite(d)||Math.floor(d)!==d||d<0)throw new n(l?o:"highWaterMark",d);return Math.floor(d)}return r.objectMode?16:16384}}},2611:function(u,e,t){u.exports=t(9826).EventEmitter},748:function(u,e,t){var n=t(4598).Buffer,r=n.isEncoding||function(E){switch((E=""+E)&&E.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(E){var _;switch(this.encoding=(function(L){var K=(function(Z){if(!Z)return"utf8";for(var ae;;)switch(Z){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return Z;default:if(ae)return;Z=(""+Z).toLowerCase(),ae=!0}})(L);if(typeof K!="string"&&(n.isEncoding===r||!r(L)))throw new Error("Unknown encoding: "+L);return K||L})(E),this.encoding){case"utf16le":this.text=d,this.end=c,_=4;break;case"utf8":this.fillLast=l,_=4;break;case"base64":this.text=g,this.end=f,_=3;break;default:return this.write=h,void(this.end=y)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(_)}function o(E){return E<=127?0:E>>5==6?2:E>>4==14?3:E>>3==30?4:E>>6==2?-1:-2}function l(E){var _=this.lastTotal-this.lastNeed,L=(function(K,Z){if((192&Z[0])!=128)return K.lastNeed=0,"οΏ½";if(K.lastNeed>1&&Z.length>1){if((192&Z[1])!=128)return K.lastNeed=1,"οΏ½";if(K.lastNeed>2&&Z.length>2&&(192&Z[2])!=128)return K.lastNeed=2,"οΏ½"}})(this,E);return L!==void 0?L:this.lastNeed<=E.length?(E.copy(this.lastChar,_,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(E.copy(this.lastChar,_,0,E.length),void(this.lastNeed-=E.length))}function d(E,_){if((E.length-_)%2==0){var L=E.toString("utf16le",_);if(L){var K=L.charCodeAt(L.length-1);if(K>=55296&&K<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=E[E.length-2],this.lastChar[1]=E[E.length-1],L.slice(0,-1)}return L}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=E[E.length-1],E.toString("utf16le",_,E.length-1)}function c(E){var _=E&&E.length?this.write(E):"";if(this.lastNeed){var L=this.lastTotal-this.lastNeed;return _+this.lastChar.toString("utf16le",0,L)}return _}function g(E,_){var L=(E.length-_)%3;return L===0?E.toString("base64",_):(this.lastNeed=3-L,this.lastTotal=3,L===1?this.lastChar[0]=E[E.length-1]:(this.lastChar[0]=E[E.length-2],this.lastChar[1]=E[E.length-1]),E.toString("base64",_,E.length-L))}function f(E){var _=E&&E.length?this.write(E):"";return this.lastNeed?_+this.lastChar.toString("base64",0,3-this.lastNeed):_}function h(E){return E.toString(this.encoding)}function y(E){return E&&E.length?this.write(E):""}e.StringDecoder=i,i.prototype.write=function(E){if(E.length===0)return"";var _,L;if(this.lastNeed){if((_=this.fillLast(E))===void 0)return"";L=this.lastNeed,this.lastNeed=0}else L=0;return L<E.length?_?_+this.text(E,L):this.text(E,L):_||""},i.prototype.end=function(E){var _=E&&E.length?this.write(E):"";return this.lastNeed?_+"οΏ½":_},i.prototype.text=function(E,_){var L=(function(Z,ae,pe){var xe=ae.length-1;if(xe<pe)return 0;var ke=o(ae[xe]);return ke>=0?(ke>0&&(Z.lastNeed=ke-1),ke):--xe<pe||ke===-2?0:(ke=o(ae[xe]))>=0?(ke>0&&(Z.lastNeed=ke-2),ke):--xe<pe||ke===-2?0:(ke=o(ae[xe]))>=0?(ke>0&&(ke===2?ke=0:Z.lastNeed=ke-3),ke):0})(this,E,_);if(!this.lastNeed)return E.toString("utf8",_);this.lastTotal=L;var K=E.length-(L-this.lastNeed);return E.copy(this.lastChar,0,K),E.toString("utf8",_,K)},i.prototype.fillLast=function(E){if(this.lastNeed<=E.length)return E.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);E.copy(this.lastChar,this.lastTotal-this.lastNeed,0,E.length),this.lastNeed-=E.length}},4598:function(u,e,t){var n=t(44),r=n.Buffer;function i(l,d){for(var c in l)d[c]=l[c]}function o(l,d,c){return r(l,d,c)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?u.exports=n:(i(n,e),e.Buffer=o),i(r,o),o.from=function(l,d,c){if(typeof l=="number")throw new TypeError("Argument must not be a number");return r(l,d,c)},o.alloc=function(l,d,c){if(typeof l!="number")throw new TypeError("Argument must be a number");var g=r(l);return d!==void 0?typeof c=="string"?g.fill(d,c):g.fill(d):g.fill(0),g},o.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return r(l)},o.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(l)}},8571:function(u,e,t){var n;(function(r,i){var o="function",l="undefined",d="object",c="string",g="major",f="model",h="name",y="type",E="vendor",_="version",L="architecture",K="console",Z="mobile",ae="tablet",pe="smarttv",xe="wearable",ke="embedded",Y="Amazon",J="Apple",he="ASUS",Ee="BlackBerry",Le="Browser",et="Chrome",Ae="Firefox",Ze="Google",Be="Huawei",Ne="LG",tt="Microsoft",mt="Motorola",Ge="Opera",ut="Samsung",Xe="Sharp",nt="Sony",Ft="Xiaomi",Xt="Zebra",Pe="Facebook",De="Chromium OS",dt="Mac OS",Q=function(He){for(var st={},it=0;it<He.length;it++)st[He[it].toUpperCase()]=He[it];return st},H=function(He,st){return typeof He===c&&w(st).indexOf(w(He))!==-1},w=function(He){return He.toLowerCase()},D=function(He,st){if(typeof He===c)return He=He.replace(/^\s\s*/,""),typeof st===l?He:He.substring(0,500)},oe=function(He,st){for(var it,Et,nn,Ut,Kt,kt,Tn=0;Tn<st.length&&!Kt;){var Bn=st[Tn],Jn=st[Tn+1];for(it=Et=0;it<Bn.length&&!Kt&&Bn[it];)if(Kt=Bn[it++].exec(He))for(nn=0;nn<Jn.length;nn++)kt=Kt[++Et],typeof(Ut=Jn[nn])===d&&Ut.length>0?Ut.length===2?typeof Ut[1]==o?this[Ut[0]]=Ut[1].call(this,kt):this[Ut[0]]=Ut[1]:Ut.length===3?typeof Ut[1]!==o||Ut[1].exec&&Ut[1].test?this[Ut[0]]=kt?kt.replace(Ut[1],Ut[2]):i:this[Ut[0]]=kt?Ut[1].call(this,kt,Ut[2]):i:Ut.length===4&&(this[Ut[0]]=kt?Ut[3].call(this,kt.replace(Ut[1],Ut[2])):i):this[Ut]=kt||i;Tn+=2}},F=function(He,st){for(var it in st)if(typeof st[it]===d&&st[it].length>0){for(var Et=0;Et<st[it].length;Et++)if(H(st[it][Et],He))return it==="?"?i:it}else if(H(st[it],He))return it==="?"?i:it;return He},Me={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},We={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[_,[h,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[_,[h,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[h,_],[/opios[\/ ]+([\w\.]+)/i],[_,[h,Ge+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[_,[h,Ge+" GX"]],[/\bopr\/([\w\.]+)/i],[_,[h,Ge]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[_,[h,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[h,_],[/\bddg\/([\w\.]+)/i],[_,[h,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[_,[h,"UC"+Le]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[_,[h,"WeChat"]],[/konqueror\/([\w\.]+)/i],[_,[h,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[_,[h,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[_,[h,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[_,[h,"Smart Lenovo "+Le]],[/(avast|avg)\/([\w\.]+)/i],[[h,/(.+)/,"$1 Secure "+Le],_],[/\bfocus\/([\w\.]+)/i],[_,[h,Ae+" Focus"]],[/\bopt\/([\w\.]+)/i],[_,[h,Ge+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[_,[h,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[_,[h,"Dolphin"]],[/coast\/([\w\.]+)/i],[_,[h,Ge+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[_,[h,"MIUI "+Le]],[/fxios\/([-\w\.]+)/i],[_,[h,Ae]],[/\bqihu|(qi?ho?o?|360)browser/i],[[h,"360 "+Le]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[h,/(.+)/,"$1 "+Le],_],[/samsungbrowser\/([\w\.]+)/i],[_,[h,ut+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[h,/_/g," "],_],[/metasr[\/ ]?([\d\.]+)/i],[_,[h,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[h,"Sogou Mobile"],_],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[h,_],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[h],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[h,Pe],_],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[h,_],[/\bgsa\/([\w\.]+) .*safari\//i],[_,[h,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[_,[h,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[_,[h,et+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[h,et+" WebView"],_],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[_,[h,"Android "+Le]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[h,_],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[_,[h,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[_,h],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[h,[_,F,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[h,_],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[h,"Netscape"],_],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[_,[h,Ae+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[h,_],[/(cobalt)\/([\w\.]+)/i],[h,[_,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[L,"amd64"]],[/(ia32(?=;))/i],[[L,w]],[/((?:i[346]|x)86)[;\)]/i],[[L,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[L,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[L,"armhf"]],[/windows (ce|mobile); ppc;/i],[[L,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[L,/ower/,"",w]],[/(sun4\w)[;\)]/i],[[L,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[L,w]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[f,[E,ut],[y,ae]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[f,[E,ut],[y,Z]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[f,[E,J],[y,Z]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[f,[E,J],[y,ae]],[/(macintosh);/i],[f,[E,J]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[f,[E,Xe],[y,Z]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[f,[E,Be],[y,ae]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[f,[E,Be],[y,Z]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[f,/_/g," "],[E,Ft],[y,Z]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[f,/_/g," "],[E,Ft],[y,ae]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[f,[E,"OPPO"],[y,Z]],[/\b(opd2\d{3}a?) bui/i],[f,[E,"OPPO"],[y,ae]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[f,[E,"Vivo"],[y,Z]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[f,[E,"Realme"],[y,Z]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[f,[E,mt],[y,Z]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[f,[E,mt],[y,ae]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[f,[E,Ne],[y,ae]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[f,[E,Ne],[y,Z]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[f,[E,"Lenovo"],[y,ae]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[f,/_/g," "],[E,"Nokia"],[y,Z]],[/(pixel c)\b/i],[f,[E,Ze],[y,ae]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[f,[E,Ze],[y,Z]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[f,[E,nt],[y,Z]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[f,"Xperia Tablet"],[E,nt],[y,ae]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[f,[E,"OnePlus"],[y,Z]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[f,[E,Y],[y,ae]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[f,/(.+)/g,"Fire Phone $1"],[E,Y],[y,Z]],[/(playbook);[-\w\),; ]+(rim)/i],[f,E,[y,ae]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[f,[E,Ee],[y,Z]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[f,[E,he],[y,ae]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[f,[E,he],[y,Z]],[/(nexus 9)/i],[f,[E,"HTC"],[y,ae]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[E,[f,/_/g," "],[y,Z]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[f,[E,"Acer"],[y,ae]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[f,[E,"Meizu"],[y,Z]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[f,[E,"Ulefone"],[y,Z]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[E,f,[y,Z]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[E,f,[y,ae]],[/(surface duo)/i],[f,[E,tt],[y,ae]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[f,[E,"Fairphone"],[y,Z]],[/(u304aa)/i],[f,[E,"AT&T"],[y,Z]],[/\bsie-(\w*)/i],[f,[E,"Siemens"],[y,Z]],[/\b(rct\w+) b/i],[f,[E,"RCA"],[y,ae]],[/\b(venue[\d ]{2,7}) b/i],[f,[E,"Dell"],[y,ae]],[/\b(q(?:mv|ta)\w+) b/i],[f,[E,"Verizon"],[y,ae]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[f,[E,"Barnes & Noble"],[y,ae]],[/\b(tm\d{3}\w+) b/i],[f,[E,"NuVision"],[y,ae]],[/\b(k88) b/i],[f,[E,"ZTE"],[y,ae]],[/\b(nx\d{3}j) b/i],[f,[E,"ZTE"],[y,Z]],[/\b(gen\d{3}) b.+49h/i],[f,[E,"Swiss"],[y,Z]],[/\b(zur\d{3}) b/i],[f,[E,"Swiss"],[y,ae]],[/\b((zeki)?tb.*\b) b/i],[f,[E,"Zeki"],[y,ae]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[E,"Dragon Touch"],f,[y,ae]],[/\b(ns-?\w{0,9}) b/i],[f,[E,"Insignia"],[y,ae]],[/\b((nxa|next)-?\w{0,9}) b/i],[f,[E,"NextBook"],[y,ae]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[E,"Voice"],f,[y,Z]],[/\b(lvtel\-)?(v1[12]) b/i],[[E,"LvTel"],f,[y,Z]],[/\b(ph-1) /i],[f,[E,"Essential"],[y,Z]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[f,[E,"Envizen"],[y,ae]],[/\b(trio[-\w\. ]+) b/i],[f,[E,"MachSpeed"],[y,ae]],[/\btu_(1491) b/i],[f,[E,"Rotor"],[y,ae]],[/(shield[\w ]+) b/i],[f,[E,"Nvidia"],[y,ae]],[/(sprint) (\w+)/i],[E,f,[y,Z]],[/(kin\.[onetw]{3})/i],[[f,/\./g," "],[E,tt],[y,Z]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[f,[E,Xt],[y,ae]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[f,[E,Xt],[y,Z]],[/smart-tv.+(samsung)/i],[E,[y,pe]],[/hbbtv.+maple;(\d+)/i],[[f,/^/,"SmartTV"],[E,ut],[y,pe]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[E,Ne],[y,pe]],[/(apple) ?tv/i],[E,[f,J+" TV"],[y,pe]],[/crkey/i],[[f,et+"cast"],[E,Ze],[y,pe]],[/droid.+aft(\w+)( bui|\))/i],[f,[E,Y],[y,pe]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[f,[E,Xe],[y,pe]],[/(bravia[\w ]+)( bui|\))/i],[f,[E,nt],[y,pe]],[/(mitv-\w{5}) bui/i],[f,[E,Ft],[y,pe]],[/Hbbtv.*(technisat) (.*);/i],[E,f,[y,pe]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[E,D],[f,D],[y,pe]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[y,pe]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[E,f,[y,K]],[/droid.+; (shield) bui/i],[f,[E,"Nvidia"],[y,K]],[/(playstation [345portablevi]+)/i],[f,[E,nt],[y,K]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[f,[E,tt],[y,K]],[/((pebble))app/i],[E,f,[y,xe]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[f,[E,J],[y,xe]],[/droid.+; (glass) \d/i],[f,[E,Ze],[y,xe]],[/droid.+; (wt63?0{2,3})\)/i],[f,[E,Xt],[y,xe]],[/(quest( \d| pro)?)/i],[f,[E,Pe],[y,xe]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[E,[y,ke]],[/(aeobc)\b/i],[f,[E,Y],[y,ke]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[f,[y,Z]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[f,[y,ae]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[y,ae]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[y,Z]],[/(android[-\w\. ]{0,9});.+buil/i],[f,[E,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[_,[h,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[_,[h,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[h,_],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[_,h]],os:[[/microsoft (windows) (vista|xp)/i],[h,_],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[h,[_,F,Me]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[_,F,Me],[h,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[_,/_/g,"."],[h,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[h,dt],[_,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[_,h],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[h,_],[/\(bb(10);/i],[_,[h,Ee]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[_,[h,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[_,[h,Ae+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[_,[h,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[_,[h,"watchOS"]],[/crkey\/([\d\.]+)/i],[_,[h,et+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[h,De],_],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[h,_],[/(sunos) ?([\w\.\d]*)/i],[[h,"Solaris"],_],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[h,_]]},Ue=function(He,st){if(typeof He===d&&(st=He,He=i),!(this instanceof Ue))return new Ue(He,st).getResult();var it=typeof r!==l&&r.navigator?r.navigator:i,Et=He||(it&&it.userAgent?it.userAgent:""),nn=it&&it.userAgentData?it.userAgentData:i,Ut=st?(function(kt,Tn){var Bn={};for(var Jn in kt)Tn[Jn]&&Tn[Jn].length%2==0?Bn[Jn]=Tn[Jn].concat(kt[Jn]):Bn[Jn]=kt[Jn];return Bn})(We,st):We,Kt=it&&it.userAgent==Et;return this.getBrowser=function(){var kt,Tn={};return Tn[h]=i,Tn[_]=i,oe.call(Tn,Et,Ut.browser),Tn[g]=typeof(kt=Tn[_])===c?kt.replace(/[^\d\.]/g,"").split(".")[0]:i,Kt&&it&&it.brave&&typeof it.brave.isBrave==o&&(Tn[h]="Brave"),Tn},this.getCPU=function(){var kt={};return kt[L]=i,oe.call(kt,Et,Ut.cpu),kt},this.getDevice=function(){var kt={};return kt[E]=i,kt[f]=i,kt[y]=i,oe.call(kt,Et,Ut.device),Kt&&!kt[y]&&nn&&nn.mobile&&(kt[y]=Z),Kt&&kt[f]=="Macintosh"&&it&&typeof it.standalone!==l&&it.maxTouchPoints&&it.maxTouchPoints>2&&(kt[f]="iPad",kt[y]=ae),kt},this.getEngine=function(){var kt={};return kt[h]=i,kt[_]=i,oe.call(kt,Et,Ut.engine),kt},this.getOS=function(){var kt={};return kt[h]=i,kt[_]=i,oe.call(kt,Et,Ut.os),Kt&&!kt[h]&&nn&&nn.platform&&nn.platform!="Unknown"&&(kt[h]=nn.platform.replace(/chrome os/i,De).replace(/macos/i,dt)),kt},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return Et},this.setUA=function(kt){return Et=typeof kt===c&&kt.length>500?D(kt,500):kt,this},this.setUA(Et),this};Ue.VERSION="1.0.38",Ue.BROWSER=Q([h,_,g]),Ue.CPU=Q([L]),Ue.DEVICE=Q([f,E,y,K,Z,pe,ae,xe,ke]),Ue.ENGINE=Ue.OS=Q([h,_]),typeof e!==l?(u.exports&&(e=u.exports=Ue),e.UAParser=Ue):t.amdO?(n=(function(){return Ue}).call(e,t,e,u))===i||(u.exports=n):typeof r!==l&&(r.UAParser=Ue);var je=typeof r!==l&&(r.jQuery||r.Zepto);if(je&&!je.ua){var Oe=new Ue;je.ua=Oe.getResult(),je.ua.get=function(){return Oe.getUA()},je.ua.set=function(He){Oe.setUA(He);var st=Oe.getResult();for(var it in st)je.ua[it]=st[it]}}})(typeof window=="object"?window:this)},9e3:function(u,e,t){function n(r){try{if(!t.g.localStorage)return!1}catch{return!1}var i=t.g.localStorage[r];return i!=null&&String(i).toLowerCase()==="true"}u.exports=function(r,i){if(n("noDeprecation"))return r;var o=!1;return function(){if(!o){if(n("throwDeprecation"))throw new Error(i);n("traceDeprecation")?console.trace(i):console.warn(i),o=!0}return r.apply(this,arguments)}}},3779:function(){},7199:function(){},5393:function(u,e,t){t.r(e),t.d(e,{Debug:function(){return i.default},FactoryMaker:function(){return r.default},MediaPlayer:function(){return n.default}});var n=t(8200),r=t(138),i=t(649),o=t(8986),l=typeof window<"u"&&window||global,d=l.dashjs;d||(d=l.dashjs={}),d.MediaPlayer=n.default,d.FactoryMaker=r.default,d.Debug=i.default,d.Version=(0,o.getVersionString)(),e.default=d},649:function(u,e,t){t.r(e);var n=t(8850),r=t(3621),i=t(138);function o(d){d=d||{};const c=this.context,g=(0,n.default)(c).getInstance(),f=d.settings,h=[];let y,E,_,L;function K(J){return J&&J.bind?J.bind(window.console):window.console.log.bind(window.console)}function Z(...J){Y(1,this,...J)}function ae(...J){Y(2,this,...J)}function pe(...J){Y(3,this,...J)}function xe(...J){Y(4,this,...J)}function ke(...J){Y(5,this,...J)}function Y(J,he,...Ee){let Le="",et=null;E&&(et=new Date().getTime(),Le+="["+(et-L)+"]"),_&&he&&he.getClassName&&(Le+="["+he.getClassName()+"]",he.getType&&(Le+="["+he.getType()+"]")),Le.length>0&&(Le+=" "),Array.apply(null,Ee).forEach((function(Ae){Le+=Ae+" "})),h[J]&&f&&f.get().debug.logLevel>=J&&h[J](Le),f&&f.get().debug.dispatchEvent&&g.trigger(r.default.LOG,{message:Le,level:J})}return y={getLogger:function(J){return{fatal:Z.bind(J),error:ae.bind(J),warn:pe.bind(J),info:xe.bind(J),debug:ke.bind(J)}},setLogTimestampVisible:function(J){E=J},setCalleeNameVisible:function(J){_=J}},E=!0,_=!0,L=new Date().getTime(),typeof window<"u"&&window.console&&(h[1]=K(window.console.error),h[2]=K(window.console.error),h[3]=K(window.console.warn),h[4]=K(window.console.info),h[5]=K(window.console.debug)),y}o.__dashjs_factory_name="Debug";const l=i.default.getSingletonFactory(o);l.LOG_LEVEL_NONE=0,l.LOG_LEVEL_FATAL=1,l.LOG_LEVEL_ERROR=2,l.LOG_LEVEL_WARNING=3,l.LOG_LEVEL_INFO=4,l.LOG_LEVEL_DEBUG=5,i.default.updateSingletonFactory(o.__dashjs_factory_name,l),e.default=l},8850:function(u,e,t){t.r(e);var n=t(138),r=t(1191);function i(){let l={};function d(f,h,y,E={},_=!1){if(!f)throw new Error("event type cannot be null or undefined");if(!h||typeof h!="function")throw new Error("listener must be a function: "+h);let L=E.priority||0;if(g(f,h,y)>=0)return;l[f]=l[f]||[];const K={callback:h,scope:y,priority:L,executeOnlyOnce:_};y&&y.getStreamId&&(K.streamId=y.getStreamId()),y&&y.getType&&(K.mediaType=y.getType()),E&&E.mode&&(K.mode=E.mode),l[f].some(((Z,ae)=>{if(Z&&L>Z.priority)return l[f].splice(ae,0,K),!0}))||l[f].push(K)}function c(f,h,y){if(!f||!h||!l[f])return;const E=g(f,h,y);E<0||(l[f][E]=null)}function g(f,h,y){let E=-1;return l[f]&&l[f].some(((_,L)=>{if(_&&_.callback===h&&(!y||y===_.scope))return E=L,!0})),E}return{on:function(f,h,y,E={}){d(f,h,y,E)},once:function(f,h,y,E={}){d(f,h,y,E,!0)},off:c,trigger:function(f,h={},y={}){if(!f||!l[f])return;if((h=h||{}).hasOwnProperty("type"))throw new Error("'type' is a reserved word for event dispatching");h.type=f,y.streamId&&(h.streamId=y.streamId),y.mediaType&&(h.mediaType=y.mediaType);const E=[];l[f].filter((_=>!(!_||y.streamId&&_.streamId&&_.streamId!==y.streamId||y.mediaType&&_.mediaType&&_.mediaType!==y.mediaType||y.mode&&_.mode&&_.mode!==y.mode||!_.mode&&y.mode&&y.mode===r.default.EVENT_MODE_ON_RECEIVE))).forEach((_=>{_&&_.callback.call(_.scope,h),_.executeOnlyOnce&&E.push(_)})),E.forEach((_=>{c(f,_.callback,_.scope)}))},reset:function(){l={}}}}i.__dashjs_factory_name="EventBus";const o=n.default.getSingletonFactory(i);o.EVENT_PRIORITY_LOW=0,o.EVENT_PRIORITY_HIGH=5e3,n.default.updateSingletonFactory(i.__dashjs_factory_name,o),e.default=o},138:function(u,e,t){t.r(e);const n=(function(){let r,i=[];const o={},l={};function d(h,y){for(const E in i){const _=i[E];if(_.context===h&&_.name===y)return _.instance}return null}function c(h,y){return y[h]}function g(h,y,E){h in E&&(E[h]=y)}function f(h,y,E){let _;const L=h.__dashjs_factory_name,K=y[L];if(K){let Z=K.instance;if(!K.override)return Z.apply({context:y,factory:r},E);_=h.apply({context:y},E),Z=Z.apply({context:y,factory:r,parent:_},E);for(const ae in Z)_.hasOwnProperty(ae)&&(_[ae]=Z[ae])}else _=h.apply({context:y},E);return _.getClassName=function(){return L},_}return r={deleteSingletonInstances:function(h){i=i.filter((y=>y.context!==h))},extend:function(h,y,E,_){!_[h]&&y&&(_[h]={instance:y,override:E})},getClassFactory:function(h){let y=c(h.__dashjs_factory_name,l);return y||(y=function(E){return E===void 0&&(E={}),{create:function(){return f(h,E,arguments)}}},l[h.__dashjs_factory_name]=y),y},getClassFactoryByName:function(h){return c(h,l)},getSingletonFactory:function(h){let y=c(h.__dashjs_factory_name,o);return y||(y=function(E){let _;return E===void 0&&(E={}),{getInstance:function(){return _||(_=d(E,h.__dashjs_factory_name)),_||(_=f(h,E,arguments),i.push({name:h.__dashjs_factory_name,context:E,instance:_})),_}}},o[h.__dashjs_factory_name]=y),y},getSingletonFactoryByName:function(h){return c(h,o)},getSingletonInstance:d,setSingletonInstance:function(h,y,E){for(const _ in i){const L=i[_];if(L.context===h&&L.name===y)return void(i[_].instance=E)}i.push({name:y,context:h,instance:E})},updateClassFactory:function(h,y){g(h,y,l)},updateSingletonFactory:function(h,y){g(h,y,o)}},r})();e.default=n},8261:function(u,e,t){t.r(e);var n=t(138),r=t(7263),i=t(649),o=t(5212),l=t(7568),d=t(8850),c=t(3621),g=t(4246);function f(){let y;const E=this.context,_=(0,d.default)(E).getInstance(),L={"streaming.delay.liveDelay":c.default.SETTING_UPDATED_LIVE_DELAY,"streaming.delay.liveDelayFragmentCount":c.default.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT,"streaming.liveCatchup.enabled":c.default.SETTING_UPDATED_CATCHUP_ENABLED,"streaming.liveCatchup.playbackRate.min":c.default.SETTING_UPDATED_PLAYBACK_RATE_MIN,"streaming.liveCatchup.playbackRate.max":c.default.SETTING_UPDATED_PLAYBACK_RATE_MAX,"streaming.abr.rules.throughputRule.active":c.default.SETTING_UPDATED_ABR_ACTIVE_RULES,"streaming.abr.rules.bolaRule.active":c.default.SETTING_UPDATED_ABR_ACTIVE_RULES,"streaming.abr.rules.insufficientBufferRule.active":c.default.SETTING_UPDATED_ABR_ACTIVE_RULES,"streaming.abr.rules.switchHistoryRule.active":c.default.SETTING_UPDATED_ABR_ACTIVE_RULES,"streaming.abr.rules.droppedFramesRule.active":c.default.SETTING_UPDATED_ABR_ACTIVE_RULES,"streaming.abr.rules.abandonRequestsRule.active":c.default.SETTING_UPDATED_ABR_ACTIVE_RULES,"streaming.abr.rules.l2ARule.active":c.default.SETTING_UPDATED_ABR_ACTIVE_RULES,"streaming.abr.rules.loLPRule.active":c.default.SETTING_UPDATED_ABR_ACTIVE_RULES,"streaming.abr.maxBitrate.video":c.default.SETTING_UPDATED_MAX_BITRATE,"streaming.abr.maxBitrate.audio":c.default.SETTING_UPDATED_MAX_BITRATE,"streaming.abr.minBitrate.video":c.default.SETTING_UPDATED_MIN_BITRATE,"streaming.abr.minBitrate.audio":c.default.SETTING_UPDATED_MIN_BITRATE},K={debug:{logLevel:i.default.LOG_LEVEL_WARNING,dispatchEvent:!1},streaming:{abandonLoadTimeout:1e4,wallclockTimeUpdateInterval:100,manifestUpdateRetryInterval:100,liveUpdateTimeThresholdInMilliseconds:0,cacheInitSegments:!1,applyServiceDescription:!0,applyProducerReferenceTime:!0,applyContentSteering:!0,enableManifestDurationMismatchFix:!0,parseInbandPrft:!1,enableManifestTimescaleMismatchFix:!1,capabilities:{filterUnsupportedEssentialProperties:!0,supportedEssentialProperties:[{schemeIdUri:o.default.FONT_DOWNLOAD_DVB_SCHEME},{schemeIdUri:o.default.COLOUR_PRIMARIES_SCHEME_ID_URI,value:/1|5|6|7/},{schemeIdUri:o.default.URL_QUERY_INFO_SCHEME},{schemeIdUri:o.default.EXT_URL_QUERY_INFO_SCHEME},{schemeIdUri:o.default.MATRIX_COEFFICIENTS_SCHEME_ID_URI,value:/0|1|5|6/},{schemeIdUri:o.default.TRANSFER_CHARACTERISTICS_SCHEME_ID_URI,value:/1|6|13|14|15/},{schemeIdUri:o.default.SEGMENT_SEQUENCE_REPRESENTATION_SCHEME_ID_URI},...o.default.THUMBNAILS_SCHEME_ID_URIS.map((pe=>({schemeIdUri:pe})))],useMediaCapabilitiesApi:!0,filterVideoColorimetryEssentialProperties:!1,filterHDRMetadataFormatEssentialProperties:!1,filterAudioChannelConfiguration:!1},events:{eventControllerRefreshDelay:100,deleteEventMessageDataTimeout:1e4},timeShiftBuffer:{calcFromSegmentTimeline:!1,fallbackToSegmentTimeline:!0},metrics:{maxListDepth:100},delay:{liveDelayFragmentCount:NaN,liveDelay:NaN,useSuggestedPresentationDelay:!0},protection:{keepProtectionMediaKeys:!1,keepProtectionMediaKeysMaximumOpenSessions:-1,ignoreEmeEncryptedEvent:!1,detectPlayreadyMessageFormat:!0,ignoreKeyStatuses:!1},buffer:{enableSeekDecorrelationFix:!1,fastSwitchEnabled:null,flushBufferAtTrackSwitch:!1,reuseExistingSourceBuffers:!0,bufferPruningInterval:10,bufferToKeep:20,bufferTimeAtTopQuality:30,bufferTimeAtTopQualityLongForm:60,initialBufferLevel:NaN,bufferTimeDefault:18,longFormContentDurationThreshold:600,stallThreshold:.3,lowLatencyStallThreshold:.3,useAppendWindow:!0,setStallState:!0,avoidCurrentTimeRangePruning:!1,useChangeType:!0,mediaSourceDurationInfinity:!0,resetSourceBuffersForTrackSwitch:!1,syntheticStallEvents:{enabled:!1,ignoreReadyState:!1}},gaps:{jumpGaps:!0,jumpLargeGaps:!0,smallGapLimit:1.5,threshold:.3,enableSeekFix:!0,enableStallFix:!1,stallSeek:.1,seekOffset:0},utcSynchronization:{enabled:!0,useManifestDateHeaderTimeSource:!0,backgroundAttempts:2,timeBetweenSyncAttempts:30,maximumTimeBetweenSyncAttempts:600,minimumTimeBetweenSyncAttempts:2,timeBetweenSyncAttemptsAdjustmentFactor:2,maximumAllowedDrift:100,enableBackgroundSyncAfterSegmentDownloadError:!0,defaultTimingSource:{scheme:"urn:mpeg:dash:utc:http-xsdate:2014",value:"https://time.akamai.com/?iso&ms"},artificialTimeOffsetToApply:0},scheduling:{defaultTimeout:500,lowLatencyTimeout:0,scheduleWhilePaused:!0},text:{defaultEnabled:!0,dispatchForManualRendering:!1,extendSegmentedCues:!0,imsc:{displayForcedOnlyMode:!1,enableRollUp:!0},webvtt:{customRenderingEnabled:!1}},liveCatchup:{maxDrift:NaN,playbackRate:{min:NaN,max:NaN},playbackBufferMin:.5,enabled:null,mode:o.default.LIVE_CATCHUP_MODE_DEFAULT},lastBitrateCachingInfo:{enabled:!0,ttl:36e4},lastMediaSettingsCachingInfo:{enabled:!0,ttl:36e4},saveLastMediaSettingsForCurrentStreamingSession:!0,cacheLoadThresholds:{video:10,audio:5},trackSwitchMode:{audio:o.default.TRACK_SWITCH_MODE_ALWAYS_REPLACE,video:o.default.TRACK_SWITCH_MODE_NEVER_REPLACE},includePreselectionsInMediainfoArray:!0,includePreselectionsForInitialTrackSelection:!1,ignoreSelectionPriority:!1,prioritizeRoleMain:!0,assumeDefaultRoleAsMain:!0,selectionModeForInitialTrack:o.default.TRACK_SELECTION_MODE_LOWEST_STARTUP_DELAY,fragmentRequestTimeout:2e4,fragmentRequestProgressTimeout:-1,manifestRequestTimeout:1e4,retryIntervals:{[l.HTTPRequest.MPD_TYPE]:500,[l.HTTPRequest.XLINK_EXPANSION_TYPE]:500,[l.HTTPRequest.MEDIA_SEGMENT_TYPE]:1e3,[l.HTTPRequest.INIT_SEGMENT_TYPE]:1e3,[l.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE]:1e3,[l.HTTPRequest.INDEX_SEGMENT_TYPE]:1e3,[l.HTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE]:1e3,[l.HTTPRequest.LICENSE]:1e3,[l.HTTPRequest.OTHER_TYPE]:1e3,lowLatencyReductionFactor:10},retryAttempts:{[l.HTTPRequest.MPD_TYPE]:3,[l.HTTPRequest.XLINK_EXPANSION_TYPE]:1,[l.HTTPRequest.MEDIA_SEGMENT_TYPE]:3,[l.HTTPRequest.INIT_SEGMENT_TYPE]:3,[l.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE]:3,[l.HTTPRequest.INDEX_SEGMENT_TYPE]:3,[l.HTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE]:3,[l.HTTPRequest.LICENSE]:3,[l.HTTPRequest.OTHER_TYPE]:3,lowLatencyMultiplyFactor:5},abr:{limitBitrateByPortal:!1,usePixelRatioInLimitBitrateByPortal:!1,enableSupplementalPropertyAdaptationSetSwitching:!0,rules:{throughputRule:{active:!0,priority:g.default.PRIORITY.DEFAULT},bolaRule:{active:!0,priority:g.default.PRIORITY.DEFAULT},insufficientBufferRule:{active:!0,priority:g.default.PRIORITY.DEFAULT,parameters:{throughputSafetyFactor:.7,segmentIgnoreCount:2}},switchHistoryRule:{active:!0,priority:g.default.PRIORITY.DEFAULT,parameters:{sampleSize:8,switchPercentageThreshold:.075}},droppedFramesRule:{active:!1,priority:g.default.PRIORITY.DEFAULT,parameters:{minimumSampleSize:375,droppedFramesPercentageThreshold:.15}},abandonRequestsRule:{active:!0,priority:g.default.PRIORITY.DEFAULT,parameters:{abandonDurationMultiplier:1.8,minSegmentDownloadTimeThresholdInMs:500,minThroughputSamplesThreshold:6}},l2ARule:{active:!1,priority:g.default.PRIORITY.DEFAULT},loLPRule:{active:!1,priority:g.default.PRIORITY.DEFAULT}},throughput:{averageCalculationMode:o.default.THROUGHPUT_CALCULATION_MODES.EWMA,lowLatencyDownloadTimeCalculationMode:o.default.LOW_LATENCY_DOWNLOAD_TIME_CALCULATION_MODE.MOOF_PARSING,useResourceTimingApi:!0,useNetworkInformationApi:{xhr:!1,fetch:!1},useDeadTimeLatency:!0,bandwidthSafetyFactor:.9,sampleSettings:{live:3,vod:4,enableSampleSizeAdjustment:!0,decreaseScale:.7,increaseScale:1.3,maxMeasurementsToKeep:20,averageLatencySampleAmount:4},ewma:{throughputSlowHalfLifeSeconds:8,throughputFastHalfLifeSeconds:3,latencySlowHalfLifeCount:2,latencyFastHalfLifeCount:1,weightDownloadTimeMultiplicationFactor:.0015}},maxBitrate:{audio:-1,video:-1},minBitrate:{audio:-1,video:-1},initialBitrate:{audio:-1,video:-1},autoSwitchBitrate:{audio:!0,video:!0}},cmcd:{applyParametersFromMpd:!0,enabled:!1,sid:null,cid:null,rtp:null,rtpSafetyFactor:5,mode:o.default.CMCD_MODE_QUERY,enabledKeys:o.default.CMCD_AVAILABLE_KEYS,includeInRequests:["segment","mpd"],version:1},cmsd:{enabled:!1,abr:{applyMb:!1,etpWeightRatio:0}},enhancement:{enabled:!1,codecs:["lvc1"]},defaultSchemeIdUri:{viewpoint:"",audioChannelConfiguration:"urn:mpeg:mpegB:cicp:ChannelConfiguration",role:"urn:mpeg:dash:role:2011",accessibility:"urn:mpeg:dash:role:2011"}},errors:{recoverAttempts:{mediaErrorDecode:5}}};let Z=r.default.clone(K);function ae(pe,xe,ke){for(let Y in pe)pe.hasOwnProperty(Y)&&(xe.hasOwnProperty(Y)?typeof pe[Y]!="object"||pe[Y]instanceof RegExp||pe[Y]instanceof Array||pe[Y]===null?(xe[Y]=r.default.clone(pe[Y]),L[ke+Y]&&_.trigger(L[ke+Y])):ae(pe[Y],xe[Y],ke.slice()+Y+"."):console.error("Settings parameter "+ke+Y+" is not supported"))}return y={get:function(){return Z},update:function(pe){typeof pe=="object"&&ae(pe,Z,"")},reset:function(){Z=r.default.clone(K)}},y}f.__dashjs_factory_name="Settings";let h=n.default.getSingletonFactory(f);e.default=h},7263:function(u,e,t){t.r(e);var n=t(3282),r=t(8571),i=t(5212);class o{static mixin(d,c,g){let f,h={};if(d)for(let y in c)c.hasOwnProperty(y)&&(f=c[y],y in d&&(d[y]===f||y in h&&h[y]===f)||(typeof d[y]=="object"&&d[y]!==null?d[y]=o.mixin(d[y],f,g):d[y]=g(f)));return d}static clone(d){if(!d||typeof d!="object")return d;if(d instanceof RegExp)return new RegExp(d);let c;if(d instanceof Array){c=[];for(let g=0,f=d.length;g<f;++g)g in d&&c.push(o.clone(d[g]))}else c={};return o.mixin(c,d,o.clone)}static addAdditionalQueryParameterToUrl(d,c){try{if(!c||c.length===0)return d;let g=d;return c.forEach((({key:f,value:h})=>{const y=g.includes("?")?"&":"?";g+=`${y}${encodeURIComponent(f)}=${encodeURIComponent(h)}`})),g}catch{return d}}static removeQueryParameterFromUrl(d,c){if(!d||!c)return d;const g=new URL(d),f=new URLSearchParams(g.search);if(!f||f.size===0||!f.has(c))return d;f.delete(c);const h=Array.from(f.entries()).map((([E,_])=>`${E}=${_}`)).join("&"),y=`${g.origin}${g.pathname}`;return h?`${y}?${h}`:y}static parseHttpHeaders(d){let c={};if(!d)return c;let g=d.trim().split(`\r
|
|
49
|
+
`);for(let f=0,h=g.length;f<h;f++){let y=g[f],E=y.indexOf(": ");E>0&&(c[y.substring(0,E)]=y.substring(E+2))}return c}static parseQueryParams(d){const c=[],g=new URLSearchParams(d);for(const[f,h]of g.entries())c.push({key:decodeURIComponent(f),value:decodeURIComponent(h)});return c}static generateUuid(){let d=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(c){const g=(d+16*Math.random())%16|0;return d=Math.floor(d/16),(c=="x"?g:3&g|8).toString(16)}))}static generateHashCode(d){let c=0;if(d.length===0)return c;for(let g=0;g<d.length;g++)c=(c<<5)-c+d.charCodeAt(g),c|=0;return c}static getRelativeUrl(d,c){try{const g=new URL(d),f=new URL(c);if(g.protocol=f.protocol,g.origin!==f.origin)return c;let h=n.relative(g.pathname.substr(0,g.pathname.lastIndexOf("/")),f.pathname.substr(0,f.pathname.lastIndexOf("/")));const y=h.length===0?1:0;return h+=f.pathname.substr(f.pathname.lastIndexOf("/")+y,f.pathname.length-1),f.pathname.length<h.length?f.pathname:h}catch{return c}}static getHostFromUrl(d){try{return new URL(d).host}catch{return null}}static parseUserAgent(d=null){try{const c=d===null&&typeof navigator<"u"?navigator.userAgent.toLowerCase():"";return(0,r.UAParser)(c)}catch{return{}}}static stringHasProtocol(d){return/(http(s?)):\/\//i.test(d)}static bufferSourceToDataView(d){return o.toDataView(d,DataView)}static bufferSourceToInt8(d){return o.toDataView(d,Uint8Array)}static uint8ArrayToString(d){return new TextDecoder("utf-8").decode(d)}static bufferSourceToHex(d){const c=o.bufferSourceToInt8(d);let g="";for(let f of c)f=f.toString(16),f.length===1&&(f="0"+f),g+=f;return g}static toDataView(d,c){const g=o.getArrayBuffer(d);let f=1;"BYTES_PER_ELEMENT"in DataView&&(f=DataView.BYTES_PER_ELEMENT);const h=((d.byteOffset||0)+d.byteLength)/f,y=(d.byteOffset||0)/f,E=Math.floor(Math.max(0,Math.min(y,h)));return new c(g,E,Math.floor(Math.min(E+Math.max(1/0,0),h))-E)}static getArrayBuffer(d){return d instanceof ArrayBuffer?d:d.buffer}static getCodecFamily(d){const{base:c,profile:g}=o._getCodecParts(d);switch(c){case"mp4a":switch(g){case"69":case"6b":case"40.34":return i.default.CODEC_FAMILIES.MP3;case"66":case"67":case"68":case"40.2":case"40.02":case"40.5":case"40.05":case"40.29":case"40.42":return i.default.CODEC_FAMILIES.AAC;case"a5":return i.default.CODEC_FAMILIES.AC3;case"e6":return i.default.CODEC_FAMILIES.EC3;case"b2":return i.default.CODEC_FAMILIES.DTSX;case"a9":return i.default.CODEC_FAMILIES.DTSC}break;case"avc1":case"avc3":return i.default.CODEC_FAMILIES.AVC;case"hvc1":case"hvc3":return i.default.CODEC_FAMILIES.HEVC;default:return c}return c}static _getCodecParts(d){const[c,...g]=d.split(".");return{base:c,profile:g.join(".")}}}e.default=o},8986:function(u,e,t){t.r(e),t.d(e,{getVersionString:function(){return r}});const n="5.1.1";function r(){return n}},8748:function(u,e,t){t.r(e),e.default=class{extend(n,r){if(!n)return;let i=!!r&&r.override,o=!!r&&r.publicOnly;for(const l in n)!n.hasOwnProperty(l)||this[l]&&!i||o&&n[l].indexOf("public_")===-1||(this[l]=n[l])}}},5734:function(u,e,t){t.r(e);var n=t(7252);class r extends n.default{constructor(){super(),this.ATTEMPT_BACKGROUND_SYNC="attemptBackgroundSync",this.BUFFERING_COMPLETED="bufferingCompleted",this.BUFFER_CLEARED="bufferCleared",this.BUFFER_REPLACEMENT_STARTED="bufferReplacementStarted",this.BYTES_APPENDED_END_FRAGMENT="bytesAppendedEndFragment",this.CHECK_FOR_EXISTENCE_COMPLETED="checkForExistenceCompleted",this.CMSD_STATIC_HEADER="cmsdStaticHeader",this.CURRENT_TRACK_CHANGED="currentTrackChanged",this.DATA_UPDATE_COMPLETED="dataUpdateCompleted",this.INBAND_EVENTS="inbandEvents",this.INITIAL_STREAM_SWITCH="initialStreamSwitch",this.INIT_FRAGMENT_LOADED="initFragmentLoaded",this.INIT_FRAGMENT_NEEDED="initFragmentNeeded",this.INTERNAL_MANIFEST_LOADED="internalManifestLoaded",this.LOADING_ABANDONED="loadingAborted",this.LOADING_COMPLETED="loadingCompleted",this.LOADING_DATA_PROGRESS="loadingDataProgress",this.LOADING_PROGRESS="loadingProgress",this.MANIFEST_UPDATED="manifestUpdated",this.MEDIAINFO_UPDATED="mediaInfoUpdated",this.MEDIA_FRAGMENT_LOADED="mediaFragmentLoaded",this.MEDIA_FRAGMENT_NEEDED="mediaFragmentNeeded",this.ORIGINAL_MANIFEST_LOADED="originalManifestLoaded",this.QUOTA_EXCEEDED="quotaExceeded",this.SEEK_TARGET="seekTarget",this.SEGMENT_LOCATION_BLACKLIST_ADD="segmentLocationBlacklistAdd",this.SEGMENT_LOCATION_BLACKLIST_CHANGED="segmentLocationBlacklistChanged",this.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD="serviceLocationBlacklistAdd",this.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED="serviceLocationBlacklistChanged",this.SERVICE_LOCATION_LOCATION_BLACKLIST_ADD="serviceLocationLocationBlacklistAdd",this.SERVICE_LOCATION_LOCATION_BLACKLIST_CHANGED="serviceLocationLocationBlacklistChanged",this.SETTING_UPDATED_ABR_ACTIVE_RULES="settingUpdatedAbrActiveRules",this.SETTING_UPDATED_CATCHUP_ENABLED="settingUpdatedCatchupEnabled",this.SETTING_UPDATED_LIVE_DELAY="settingUpdatedLiveDelay",this.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT="settingUpdatedLiveDelayFragmentCount",this.SETTING_UPDATED_MAX_BITRATE="settingUpdatedMaxBitrate",this.SETTING_UPDATED_MIN_BITRATE="settingUpdatedMinBitrate",this.SETTING_UPDATED_PLAYBACK_RATE_MAX="settingUpdatedPlaybackRateMax",this.SETTING_UPDATED_PLAYBACK_RATE_MIN="settingUpdatedPlaybackRateMin",this.SET_FRAGMENTED_TEXT_AFTER_DISABLED="setFragmentedTextAfterDisabled",this.SET_NON_FRAGMENTED_TEXT="setNonFragmentedText",this.SOURCE_BUFFER_ERROR="sourceBufferError",this.STREAMS_COMPOSED="streamsComposed",this.STREAM_BUFFERING_COMPLETED="streamBufferingCompleted",this.STREAM_REQUESTING_COMPLETED="streamRequestingCompleted",this.TEXT_TRACKS_QUEUE_INITIALIZED="textTracksQueueInitialized",this.TIME_SYNCHRONIZATION_COMPLETED="timeSynchronizationComplete",this.UPDATE_TIME_SYNC_OFFSET="updateTimeSyncOffset",this.URL_RESOLUTION_FAILED="urlResolutionFailed",this.VIDEO_CHUNK_RECEIVED="videoChunkReceived",this.VIDEO_ELEMENT_RESIZED="videoElementResized",this.WALLCLOCK_TIME_UPDATED="wallclockTimeUpdated",this.XLINK_ELEMENT_LOADED="xlinkElementLoaded",this.XLINK_READY="xlinkReady"}}e.default=r},3621:function(u,e,t){t.r(e);var n=t(5734);class r extends n.default{}let i=new r;e.default=i},7252:function(u,e,t){t.r(e),e.default=class{extend(n,r){if(!n)return;let i=!!r&&r.override,o=!!r&&r.publicOnly;for(const l in n)!n.hasOwnProperty(l)||this[l]&&!i||o&&n[l].indexOf("public_")===-1||(this[l]=n[l])}}},8854:function(u,e,t){t.r(e),e.default={ACCESSIBILITY:"Accessibility",ADAPTATION_SET:"AdaptationSet",ADAPTATION_SETS:"adaptationSets",ADAPTATION_SET_SWITCHING_SCHEME_ID_URI:"urn:mpeg:dash:adaptation-set-switching:2016",ADD:"add",ASSET_IDENTIFIER:"AssetIdentifier",AUDIO_CHANNEL_CONFIGURATION:"AudioChannelConfiguration",AUDIO_SAMPLING_RATE:"audioSamplingRate",AVAILABILITY_END_TIME:"availabilityEndTime",AVAILABILITY_START_TIME:"availabilityStartTime",AVAILABILITY_TIME_COMPLETE:"availabilityTimeComplete",AVAILABILITY_TIME_OFFSET:"availabilityTimeOffset",BANDWITH:"bandwidth",BASE_URL:"BaseURL",BITSTREAM_SWITCHING:"BitstreamSwitching",BITSTREAM_SWITCHING_MINUS:"bitstreamSwitching",BYTE_RANGE:"byteRange",CAPTION:"caption",CENC_DEFAULT_KID:"cenc:default_KID",CLIENT_DATA_REPORTING:"ClientDataReporting",CLIENT_REQUIREMENT:"clientRequirement",CMCD_PARAMETERS:"CMCDParameters",CODECS:"codecs",CODEC_PRIVATE_DATA:"codecPrivateData",CODING_DEPENDENCY:"codingDependency",CONTENT_COMPONENT:"ContentComponent",CONTENT_PROTECTION:"ContentProtection",CONTENT_STEERING:"ContentSteering",CONTENT_STEERING_RESPONSE:{VERSION:"VERSION",TTL:"TTL",RELOAD_URI:"RELOAD-URI",PATHWAY_PRIORITY:"PATHWAY-PRIORITY",PATHWAY_CLONES:"PATHWAY-CLONES",BASE_ID:"BASE-ID",ID:"ID",URI_REPLACEMENT:"URI-REPLACEMENT",HOST:"HOST",PARAMS:"PARAMS"},CONTENT_TYPE:"contentType",DEFAULT_SERVICE_LOCATION:"defaultServiceLocation",DEPENDENCY_ID:"dependencyId",DURATION:"duration",DVB_PRIORITY:"dvb:priority",DVB_WEIGHT:"dvb:weight",DVB_URL:"dvb:url",DVB_MIMETYPE:"dvb:mimeType",DVB_FONTFAMILY:"dvb:fontFamily",DYNAMIC:"dynamic",END_NUMBER:"endNumber",ESSENTIAL_PROPERTY:"EssentialProperty",EVENT:"Event",EVENT_STREAM:"EventStream",FORCED_SUBTITLE:"forced-subtitle",FRAMERATE:"frameRate",FRAME_PACKING:"FramePacking",GROUP_LABEL:"GroupLabel",HEIGHT:"height",ID:"id",INBAND:"inband",INBAND_EVENT_STREAM:"InbandEventStream",INDEX:"index",INDEX_RANGE:"indexRange",INITIALIZATION:"Initialization",INITIALIZATION_MINUS:"initialization",LA_URL:"Laurl",LA_URL_LOWER_CASE:"laurl",LABEL:"Label",LANG:"lang",LOCATION:"Location",MAIN:"main",MAXIMUM_SAP_PERIOD:"maximumSAPPeriod",MAX_PLAYOUT_RATE:"maxPlayoutRate",MAX_SEGMENT_DURATION:"maxSegmentDuration",MAX_SUBSEGMENT_DURATION:"maxSubsegmentDuration",MEDIA:"media",MEDIA_PRESENTATION_DURATION:"mediaPresentationDuration",MEDIA_RANGE:"mediaRange",MEDIA_STREAM_STRUCTURE_ID:"mediaStreamStructureId",METRICS:"Metrics",METRICS_MINUS:"metrics",MIME_TYPE:"mimeType",MINIMUM_UPDATE_PERIOD:"minimumUpdatePeriod",MIN_BUFFER_TIME:"minBufferTime",MP4_PROTECTION_SCHEME:"urn:mpeg:dash:mp4protection:2011",MPD:"MPD",MPD_TYPE:"mpd",MPD_PATCH_TYPE:"mpdpatch",ORDER:"order",ORIGINAL_MPD_ID:"mpdId",ORIGINAL_PUBLISH_TIME:"originalPublishTime",PATCH_LOCATION:"PatchLocation",PERIOD:"Period",PRESELECTION:"Preselection",PRESELECTION_COMPONENTS:"preselectionComponents",PRESENTATION_TIME:"presentationTime",PRESENTATION_TIME_OFFSET:"presentationTimeOffset",PRO:"pro",PRODUCER_REFERENCE_TIME:"ProducerReferenceTime",PRODUCER_REFERENCE_TIME_TYPE:{ENCODER:"encoder",CAPTURED:"captured",APPLICATION:"application"},PROFILES:"profiles",PSSH:"pssh",PUBLISH_TIME:"publishTime",QUALITY_RANKING:"qualityRanking",QUERY_BEFORE_START:"queryBeforeStart",QUERY_PART:"$querypart$",RANGE:"range",RATING:"Rating",REF:"ref",REF_ID:"refId",REMOVE:"remove",REPLACE:"replace",REPORTING:"Reporting",REPRESENTATION:"Representation",REPRESENTATION_INDEX:"RepresentationIndex",ROBUSTNESS:"robustness",ROLE:"Role",S:"S",SAR:"sar",SCAN_TYPE:"scanType",SEGMENT_ALIGNMENT:"segmentAlignment",SEGMENT_BASE:"SegmentBase",SEGMENT_LIST:"SegmentList",SEGMENT_PROFILES:"segmentProfiles",SEGMENT_SEQUENCE_PROPERTIES:"SegmentSequenceProperties",SEGMENT_TEMPLATE:"SegmentTemplate",SEGMENT_TIMELINE:"SegmentTimeline",SEGMENT_TYPE:"segment",SEGMENT_URL:"SegmentURL",SERVICE_DESCRIPTION:"ServiceDescription",SERVICE_DESCRIPTION_LATENCY:"Latency",SERVICE_DESCRIPTION_OPERATING_BANDWIDTH:"OperatingBandwidth",SERVICE_DESCRIPTION_OPERATING_QUALITY:"OperatingQuality",SERVICE_DESCRIPTION_PLAYBACK_RATE:"PlaybackRate",SERVICE_DESCRIPTION_SCOPE:"Scope",SERVICE_LOCATION:"serviceLocation",SERVICE_LOCATIONS:"serviceLocations",SOURCE_URL:"sourceURL",START:"start",START_NUMBER:"startNumber",START_WITH_SAP:"startWithSAP",STATIC:"static",STEERING_TYPE:"steering",SUBSET:"Subset",SUBTITLE:"subtitle",SUB_REPRESENTATION:"SubRepresentation",SUB_SEGMENT_ALIGNMENT:"subsegmentAlignment",SUGGESTED_PRESENTATION_DELAY:"suggestedPresentationDelay",SUPPLEMENTAL_PROPERTY:"SupplementalProperty",SUPPLEMENTAL_CODECS:"scte214:supplementalCodecs",TAG:"tag",TIMESCALE:"timescale",TIMESHIFT_BUFFER_DEPTH:"timeShiftBufferDepth",TTL:"ttl",TYPE:"type",UTC_TIMING:"UTCTiming",VALUE:"value",VIEWPOINT:"Viewpoint",WALL_CLOCK_TIME:"wallClockTime",WIDTH:"width"}},5717:function(u,e,t){t.r(e),e.default=class{constructor(){this.schemeIdUri="",this.value=""}}},8200:function(u,e,t){t.r(e),t.d(e,{default:function(){return fE}});var n=t(138),r=t(4246),i={TCP_CONNECTION:"TcpList",HTTP_REQUEST:"HttpList",TRACK_SWITCH:"RepSwitchList",BUFFER_LEVEL:"BufferLevel",BUFFER_LOADED:"bufferLoaded",ABANDON_LOAD:"abandonload",ALLOW_LOAD:"allowload",BUFFER_EMPTY:"bufferStalled",BUFFER_STATE:"BufferState",DVR_INFO:"DVRInfo",DROPPED_FRAMES:"DroppedFrames",SCHEDULING_INFO:"SchedulingInfo",REQUESTS_QUEUE:"RequestsQueue",MANIFEST_UPDATE:"ManifestUpdate",MANIFEST_UPDATE_STREAM_INFO:"ManifestUpdatePeriodInfo",MANIFEST_UPDATE_TRACK_INFO:"ManifestUpdateRepresentationInfo",PLAY_LIST:"PlayList",DVB_ERRORS:"DVBErrors",HTTP_REQUEST_DVB_REPORTING_TYPE:"DVBReporting"},o=t(649),l=t(8261);function d(p){p=p||{};const m=this.context,b=p.dashMetrics;let T,v,S;return T={getSwitchRequest:function(k){try{const x=(0,r.default)(m).create();x.rule=this.getClassName();const I=k.getMediaInfo(),N=k.getMediaType(),O=b.getCurrentBufferState(N),A=k.getScheduleController(),R=k.getAbrController(),C=k.getStreamInfo(),B=C?C.id:null,$=C&&C.manifestInfo?C.manifestInfo.isDynamic:null,V=k.getThroughputController(),j=V.getSafeAverageThroughput(N),te=V.getAverageLatency(N);return isNaN(j)||!O||R.getAbandonmentStateFor(B,N)===i.ALLOW_LOAD&&(O.state===i.BUFFER_LOADED||$)&&(x.representation=R.getOptimalRepresentationForBitrate(I,j,!0),x.priority=v.get().streaming.abr.rules.throughputRule.priority,x.reason={throughput:j,latency:te,message:`[ThroughputRule]: Switching to Representation with bitrate ${x.representation?x.representation.bitrateInKbit:"n/a"} kbit/s. Throughput: ${j}`},A.setTimeToLoadDelay(0)),x}catch(x){return S.error(x),(0,r.default)(m).create()}},reset:function(){}},S=(0,o.default)(m).getInstance().getLogger(T),v=(0,l.default)(m).getInstance(),T}d.__dashjs_factory_name="ThroughputRule";var c=n.default.getClassFactory(d),g=t(8850),f=t(3621),h=t(5212),y=t(1191);function E(p){p=p||{};const m=this.context,b=(0,g.default)(m).getInstance(),T=p.dashMetrics,v=(0,l.default)(m).getInstance();let S,k,x;function I(){const A=v.get().streaming.abr.rules.insufficientBufferRule.parameters.segmentIgnoreCount;x={},x[h.default.VIDEO]={ignoreCount:A},x[h.default.AUDIO]={ignoreCount:A},x[h.default.ENHANCEMENT]={ignoreCount:A}}function N(){I()}function O(A){isNaN(A.startTime)||A.mediaType!==h.default.AUDIO&&A.mediaType!==h.default.VIDEO||x[A.mediaType].ignoreCount>0&&x[A.mediaType].ignoreCount--}return S={getSwitchRequest:function(A){const R=(0,r.default)(m).create();if(R.rule=this.getClassName(),!A||!A.hasOwnProperty("getMediaType"))return R;const C=A.getMediaType(),B=T.getCurrentBufferState(C),$=A.getRepresentation().fragmentDuration;if(!(function(te,ie,se){return!te.getLowLatencyModeEnabled()&&x[ie].ignoreCount<=0&&se})(A.getScheduleController().getPlaybackController(),C,$))return R;const V=A.getMediaInfo(),j=A.getAbrController();if(B&&B.state===i.BUFFER_EMPTY)k.debug("["+C+"] Switch to index 0; buffer is empty."),R.representation=j.getOptimalRepresentationForBitrate(V,0,!0),R.reason={message:"[InsufficientBufferRule]: Switching to lowest Representation because buffer is empty"};else{const te=A.getThroughputController(),ie=T.getCurrentBufferLevel(C),se=te.getAverageThroughput(C,null,NaN)*v.get().streaming.abr.rules.insufficientBufferRule.parameters.throughputSafetyFactor*ie/$;if(isNaN(se)||se<=0)return R;R.representation=j.getOptimalRepresentationForBitrate(V,se,!0),R.priority=v.get().streaming.abr.rules.insufficientBufferRule.priority,R.reason={message:"[InsufficientBufferRule]: Limiting maximum bitrate to avoid a buffer underrun.",bitrate:se}}return R},reset:function(){I(),b.off(y.default.PLAYBACK_SEEKING,N,S),b.off(f.default.BYTES_APPENDED_END_FRAGMENT,O,S)}},k=(0,o.default)(m).getInstance().getLogger(S),I(),b.on(y.default.PLAYBACK_SEEKING,N,S),b.on(f.default.BYTES_APPENDED_END_FRAGMENT,O,S),S}E.__dashjs_factory_name="InsufficientBufferRule";var _=n.default.getClassFactory(E);function L(p){const m=(p=p||{}).mediaPlayerModel,b=p.dashMetrics,T=this.context,v=(0,l.default)(T).getInstance();let S,k,x;function I(){x={}}return S={shouldAbandon:function(N){const O=(0,r.default)(T).create();O.rule=this.getClassName();try{if(!N)return O;const A=N.getCurrentRequest();if(!isNaN(A.index)){if(A.firstByteDate===null||x.hasOwnProperty(A.index))return O;const R=m.getBufferTimeDefault(),C=N.getMediaType();if(b.getCurrentBufferLevel(C)>R)return O;const B=Date.now()-A.firstByteDate.getTime();if(A.traces.length>=v.get().streaming.abr.rules.abandonRequestsRule.parameters.minThroughputSamplesThreshold&&B>v.get().streaming.abr.rules.abandonRequestsRule.parameters.minSegmentDownloadTimeThresholdInMs&&A.bytesLoaded<A.bytesTotal)return(function($,V,j){const te=$.getMediaInfo(),ie=$.getMediaType(),se=V.traces.reduce(((ge,X)=>ge+X.b[0]),0)-V.traces[0].b[0],de=Math.max(V.traces.reduce(((ge,X)=>ge+X.d),0)-V.traces[0].d,1),G=Math.round(8*se/de),U=Number(8*V.bytesTotal/G/1e3).toFixed(2),P=$.getRepresentation(),M=$.getAbrController();if(U<V.duration*v.get().streaming.abr.rules.abandonRequestsRule.parameters.abandonDurationMultiplier||M.isPlayingAtLowestQuality(P))return j;if(!x.hasOwnProperty(V.index)){const ge=$.getAbrController(),X=V.bytesTotal-V.bytesLoaded,be=ge.getOptimalRepresentationForBitrate(te,G,!0),fe=V.representation;X>V.bytesTotal*be.bitrateInKbit/fe.bitrateInKbit&&(j.representation=be,j.priority=v.get().streaming.abr.rules.abandonRequestsRule.priority,j.reason={throughputInKbit:G,message:`[AbandonRequestRule][${ie} is asking to abandon and switch to quality to ${be.absoluteIndex}. The measured bandwidth was ${G} kbit/s`},x[V.index]=!0)}return j})(N,A,O)}return O}catch(A){return k.error(A),O}},reset:I},k=(0,o.default)(T).getInstance().getLogger(S),I(),S}L.__dashjs_factory_name="AbandonRequestsRule";var K=n.default.getClassFactory(L);function Z(){const p=this.context,m=(0,l.default)(p).getInstance();let b;return b={getSwitchRequest:function(T){const v=(0,r.default)(p).create();if(v.rule=this.getClassName(),!T||!T.hasOwnProperty("getDroppedFramesHistory"))return v;const S=T.getDroppedFramesHistory();if(!S)return v;const k=T.getStreamInfo().id,x=T.getMediaInfo(),I=T.getAbrController(),N=S.getFrameHistory(k);if(!N||Object.keys(N).length===0)return v;let O=0,A=0;const R=I.getPossibleVoRepresentationsFilteredBySettings(x,!0);let C=null;for(let B=1;B<R.length;B++){const $=R[B];if($&&N[$.id]&&(O=N[$.id].droppedVideoFrames,A=N[$.id].totalVideoFrames,A>m.get().streaming.abr.rules.droppedFramesRule.parameters.minimumSampleSize&&O/A>m.get().streaming.abr.rules.droppedFramesRule.parameters.droppedFramesPercentageThreshold)){C=R[B-1];break}}return C&&(v.representation=C,v.priority=m.get().streaming.abr.rules.droppedFramesRule.priority,v.reason={droppedFrames:O,message:`[DroppedFramesRule]: Switching to index ${C.absoluteIndex}. Dropped Frames: ${O}, Total Frames: ${A}`}),v}},b}Z.__dashjs_factory_name="DroppedFramesRule";var ae=n.default.getClassFactory(Z);function pe(){const p=this.context,m=(0,l.default)(p).getInstance();let b;return b={getSwitchRequest:function(T){const v=(0,r.default)(p).create();if(v.rule=this.getClassName(),!T)return v;const S=T.getStreamInfo().id,k=T.getMediaType(),x=T?T.getSwitchRequestHistory():null,I=x?x.getSwitchRequests(S,k):{},N=T.getAbrController(),O=T.getMediaInfo(),A=N.getPossibleVoRepresentationsFilteredBySettings(O,!0);let R=0,C=0;for(let B=0;B<A.length;B++){const $=A[B];if($&&I[$.id]&&(R+=I[$.id].drops,C+=I[$.id].noDrops,R+C>=m.get().streaming.abr.rules.switchHistoryRule.parameters.sampleSize&&R/C>m.get().streaming.abr.rules.switchHistoryRule.parameters.switchPercentageThreshold)){v.representation=B>0&&I[$.id].drops>0?A[B-1]:$,v.priority=m.get().streaming.abr.rules.switchHistoryRule.priority,v.reason={drops:R,noDrops:C,message:`[SwitchHistoryRule]: Switch to index: ${v.representation.absoluteIndex} samples: ${R+C} drops: ${R}`};break}}return v}},b}pe.__dashjs_factory_name="SwitchHistoryRule";var xe=n.default.getClassFactory(pe),ke=t(7568);const Y="BOLA_STATE_ONE_BITRATE",J="BOLA_STATE_STARTUP",he="BOLA_STATE_STEADY",Ee=10;function Le(p){p=p||{};const m=this.context,b=p.dashMetrics,T=p.mediaPlayerModel,v=(0,g.default)(m).getInstance(),S=mr(m).getInstance();let k,x,I,N;function O(M){const ge=M.mediaType,X=M.streamId,be=ge===h.default.AUDIO?[h.default.AUDIO]:N[X];for(const fe in be)N[X]&&N[X].hasOwnProperty(fe)&&N[X][fe].state===he&&(N[X][fe].placeholderBuffer=0)}function A(M){const ge=M.streamId;for(const X in N[ge])if(N[ge].hasOwnProperty(X)){const be=N[ge][X];be.state!==Y&&(be.state=J,R(be))}}function R(M){M.placeholderBuffer=0,M.mostAdvancedSegmentStart=NaN,M.lastSegmentWasReplacement=!1,M.lastSegmentStart=NaN,M.lastSegmentDurationS=NaN,M.lastSegmentRequestTimeMs=NaN,M.lastSegmentFinishTimeMs=NaN}function C(M){try{if(M&&M.metric===i.HTTP_REQUEST&&M.value&&M.value.type===ke.HTTPRequest.MEDIA_SEGMENT_TYPE&&M.value.trace&&M.value.trace.length){const ge=N[M.value._streamId]&&N[M.value._streamId][M.mediaType]?N[M.value._streamId][M.mediaType]:null;ge&&ge.state!==Y&&(ge.lastSegmentRequestTimeMs=M.value.trequest.getTime(),ge.lastSegmentFinishTimeMs=M.value._tfinish.getTime(),B(ge,M.mediaType))}}catch(ge){x.error(ge)}}function B(M,ge){if(!isNaN(M.lastSegmentStart)&&!isNaN(M.lastSegmentRequestTimeMs)&&!isNaN(M.placeholderBuffer)){if(M.placeholderBuffer*=.99,!isNaN(M.lastSegmentFinishTimeMs)){const X=b.getCurrentBufferLevel(ge)+.001*(M.lastSegmentFinishTimeMs-M.lastSegmentRequestTimeMs),be=te(M,M.currentRepresentation),fe=Math.max(0,be-X);M.placeholderBuffer=Math.min(fe,M.placeholderBuffer)}M.lastSegmentWasReplacement&&!isNaN(M.lastSegmentDurationS)&&(M.placeholderBuffer+=M.lastSegmentDurationS),M.lastSegmentStart=NaN,M.lastSegmentRequestTimeMs=NaN}}function $(M){if(M&&N[M.streamId]&&N[M.streamId][M.mediaType]){const ge=N[M.streamId][M.mediaType];ge&&ge.state!==Y&&(ge.currentRepresentation=M.newRepresentation)}}function V(M,ge,X){const be=X.reduce(((Ce,Ie,q)=>Ie>X[Ce]?q:Ce),0);if(be===0)return null;const fe=Math.max(M,Ee+2*ge.length),Te=(X[be]-1)/(fe/Ee-1);return{gp:Te,Vp:Ee/Te}}function j(M,ge){const X=T.getBufferTimeDefault();if(M.bufferTimeDefault!==X){const be=V(X,M.representations,M.utilities);if(be.Vp!==M.Vp||be.gp!==M.gp){const fe=b.getCurrentBufferLevel(ge);let Te=fe+M.placeholderBuffer;Te-=Ee,Te*=be.Vp/M.Vp,Te+=Ee,M.bufferTimeDefault=X,M.Vp=be.Vp,M.gp=be.gp,M.placeholderBuffer=Math.max(0,Te-fe)}}}function te(M,ge){return M.Vp*(M.utilities[ge.absoluteIndex]+M.gp)}function ie(M){if(M&&M.chunk&&M.chunk.representation.mediaInfo&&N[M.streamId]){const ge=N[M.streamId][M.chunk.representation.mediaInfo.type];if(ge&&ge.state!==Y){const X=M.chunk.start;isNaN(ge.mostAdvancedSegmentStart)||X>ge.mostAdvancedSegmentStart?(ge.mostAdvancedSegmentStart=X,ge.lastSegmentWasReplacement=!1):ge.lastSegmentWasReplacement=!0,ge.lastSegmentStart=X,ge.lastSegmentDurationS=M.chunk.duration,ge.currentRepresentation=M.chunk.representation,B(ge,M.chunk.representation.mediaInfo.type)}}}function se(){P()}function de(){I.get().streaming.abr.limitBitrateByPortal&&P()}function G(M,ge){const X=ge.absoluteIndex,be=ge.bandwidth,fe=M.utilities[X];let Te=0;for(let Ce=X-1;Ce>=0;--Ce)if(M.utilities[Ce]<M.utilities[X]){const Ie=M.representations[Ce].bandwidth,q=M.utilities[Ce],W=M.Vp*(M.gp+(be*q-Ie*fe)/(be-Ie));Te=Math.max(Te,W)}return Te}function U(M){if(M&&N[M.streamId]){const ge=N[M.streamId][M.mediaType];if(ge&&ge.state!==Y){const X=b.getCurrentBufferLevel(M.mediaType);let be;be=ge.currentRepresentation.absoluteIndex>0?G(ge,ge.currentRepresentation):Ee;const fe=Math.max(0,be-X);ge.placeholderBuffer=Math.min(ge.placeholderBuffer,fe)}}}function P(){N={}}return k={getSwitchRequest:function(M){try{const ge=(0,r.default)(m).create();M.getScheduleController().setTimeToLoadDelay(0),ge.rule=this.getClassName(),ge.reason=ge.reason||{};const X=(function(be){const fe=be.getMediaType(),Te=be.getStreamInfo().id;N[Te]||(N={},N[Te]={});let Ce=N[Te][fe];return Ce?Ce.state!==Y&&j(Ce,fe):(Ce=(function(Ie){const q={},W=Ie.getMediaInfo(),re=S.getPossibleVoRepresentationsFilteredBySettings(W,!0);let ee=re.map((z=>z.bandwidth)).map((z=>Math.log(z)));ee=ee.map((z=>z-ee[0]+1));const ne=T.getBufferTimeDefault(),le=V(ne,re,ee);return le?(q.state=J,q.representations=re,q.utilities=ee,q.bufferTimeDefault=ne,q.Vp=le.Vp,q.gp=le.gp,q.currentRepresentation=null,R(q)):q.state=Y,q})(be),N[Te][fe]=Ce),Ce})(M);switch(ge.reason.state=X.state,X.state){case Y:break;case J:(function(be,fe,Te){const Ce=fe.getMediaType(),Ie=fe.getThroughputController().getSafeAverageThroughput(Ce);if(isNaN(Ie))return;const q=fe.getMediaInfo(),W=S.getOptimalRepresentationForBitrate(q,Ie,!0),re=b.getCurrentBufferLevel(Ce);be.representation=W,be.reason.throughput=Ie,Te.placeholderBuffer=Math.max(0,G(Te,W)-re),Te.currentRepresentation=W,!isNaN(Te.lastSegmentDurationS)&&re>=Te.lastSegmentDurationS&&(Te.state=he)})(ge,M,X);break;case he:(function(be,fe,Te){const Ce=fe.getMediaType(),Ie=fe.getThroughputController(),q=fe.getMediaInfo(),W=Ie.getSafeAverageThroughput(Ce),re=fe.getScheduleController();(function(ce,me){const Se=Date.now();if(isNaN(ce.lastSegmentFinishTimeMs)){if(!isNaN(ce.lastCallTimeMs)){const Re=.001*(Se-ce.lastCallTimeMs);ce.placeholderBuffer+=Math.max(0,Re)}}else{const Re=.001*(Se-ce.lastSegmentFinishTimeMs);ce.placeholderBuffer+=Math.max(0,Re)}ce.lastCallTimeMs=Se,ce.lastSegmentStart=NaN,ce.lastSegmentRequestTimeMs=NaN,ce.lastSegmentFinishTimeMs=NaN,j(ce,me)})(Te,Ce);const ee=b.getCurrentBufferLevel(Ce);let ne=(function(ce,me){const Se=ce.representations.length;let Re=NaN,we=NaN;for(let ze=0;ze<Se;++ze){let Ye=(ce.Vp*(ce.utilities[ze]-1+ce.gp)-me)/ce.representations[ze].bandwidth;(isNaN(we)||Ye>=we)&&(we=Ye,Re=ze)}return ce.representations[Re]})(Te,ee+Te.placeholderBuffer);const le=S.getOptimalRepresentationForBitrate(q,W,!0);ne.absoluteIndex>Te.currentRepresentation.absoluteIndex&&ne.absoluteIndex>le.absoluteIndex&&(ne=le.absoluteIndex>Te.currentRepresentation.absoluteIndex?le:Te.currentRepresentation);let z=Math.max(0,ee+Te.placeholderBuffer-te(Te,ne));z<=Te.placeholderBuffer?(Te.placeholderBuffer-=z,z=0):(z-=Te.placeholderBuffer,Te.placeholderBuffer=0,S.isPlayingAtTopQuality(ne)?z=0:re.setTimeToLoadDelay(1e3*z)),be.representation=ne,be.reason.throughput=W,be.reason.bufferLevel=ee,be.reason.placeholderBuffer=Te.placeholderBuffer,be.reason.delay=z,Te.currentRepresentation=ne})(ge,M,X);break;default:(function(be,fe,Te){x.debug("BOLA ABR rule invoked in bad state.");const Ce=fe.getMediaInfo(),Ie=fe.getMediaType(),q=fe.getThroughputController().getSafeAverageThroughput(Ie);be.representation=S.getOptimalRepresentationForBitrate(Ce,q,!0),be.reason.state=Te.state,be.reason.throughput=q,Te.state=J,R(Te)})(ge,M,X)}return ge.priority=I.get().streaming.abr.rules.bolaRule.priority,ge}catch(ge){return x.error(ge),(0,r.default)(m).create()}},handleNewMediaInfo:function(M){M&&M.streamInfo&&M.type&&N[M.streamInfo.id]&&N[M.streamInfo.id][M.type]&&delete N[M.streamInfo.id][M.type]},reset:function(){P(),v.off(y.default.BUFFER_EMPTY,O,k),v.off(y.default.PLAYBACK_SEEKING,A,k),v.off(y.default.METRIC_ADDED,C,k),v.off(y.default.QUALITY_CHANGE_REQUESTED,$,k),v.off(y.default.FRAGMENT_LOADING_ABANDONED,U,k),v.off(f.default.MEDIA_FRAGMENT_LOADED,ie,k),v.off(f.default.SETTING_UPDATED_MAX_BITRATE,se,k),v.off(f.default.SETTING_UPDATED_MIN_BITRATE,se,k),v.off(f.default.VIDEO_ELEMENT_RESIZED,de,k)}},x=(0,o.default)(m).getInstance().getLogger(k),I=(0,l.default)(m).getInstance(),P(),v.on(y.default.BUFFER_EMPTY,O,k),v.on(y.default.PLAYBACK_SEEKING,A,k),v.on(y.default.METRIC_ADDED,C,k),v.on(y.default.QUALITY_CHANGE_REQUESTED,$,k),v.on(y.default.FRAGMENT_LOADING_ABANDONED,U,k),v.on(f.default.MEDIA_FRAGMENT_LOADED,ie,k),v.on(f.default.SETTING_UPDATED_MAX_BITRATE,se,k),v.on(f.default.SETTING_UPDATED_MIN_BITRATE,se,k),v.on(f.default.VIDEO_ELEMENT_RESIZED,de,k),k}Le.__dashjs_factory_name="BolaRule";var et=n.default.getClassFactory(Le);const Ae="L2A_STATE_ONE_BITRATE",Ze="L2A_STATE_STARTUP",Be="L2A_STATE_STEADY",Ne=Math.pow(4,.99);function tt(p){p=p||{};const m=this.context,b=p.dashMetrics,T=(0,g.default)(m).getInstance(),v=(0,l.default)(m).getInstance();let S,k,x,I;function N(V){V.placeholderBuffer=0,V.mostAdvancedSegmentStart=NaN,V.lastSegmentWasReplacement=!1,V.lastSegmentStart=NaN,V.lastSegmentDurationS=NaN,V.lastSegmentRequestTimeMs=NaN,V.lastSegmentFinishTimeMs=NaN,V.lastSegmentUrl=""}function O(){for(const V in k)if(k.hasOwnProperty(V)){const j=k[V];j.state!==Ae&&(j.state=Ze,N(j))}}function A(V){if(V&&V.chunk&&V.chunk.representation&&V.chunk.representation.mediaInfo){const j=k[V.chunk.representation.mediaInfo.type],te=x[V.chunk.representation.mediaInfo.type];if(j&&j.state!==Ae){const ie=V.chunk.start;isNaN(j.mostAdvancedSegmentStart)||ie>j.mostAdvancedSegmentStart?(j.mostAdvancedSegmentStart=ie,j.lastSegmentWasReplacement=!1):j.lastSegmentWasReplacement=!0,j.lastSegmentStart=ie,j.lastSegmentDurationS=V.chunk.duration,j.currentRepresentation=V.chunk.representation,C(j,te)}}}function R(V){if(V&&V.metric===i.HTTP_REQUEST&&V.value&&V.value.type===ke.HTTPRequest.MEDIA_SEGMENT_TYPE&&V.value.trace&&V.value.trace.length){const j=k[V.mediaType],te=x[V.mediaType];j&&j.state!==Ae&&(j.lastSegmentRequestTimeMs=V.value.trequest.getTime(),j.lastSegmentFinishTimeMs=V.value._tfinish.getTime(),C(j,te))}}function C(V,j){isNaN(V.lastSegmentStart)||isNaN(V.lastSegmentRequestTimeMs)||(j.segment_request_start_s=.001*V.lastSegmentRequestTimeMs,j.segment_download_finish_s=.001*V.lastSegmentFinishTimeMs,V.lastSegmentStart=NaN,V.lastSegmentRequestTimeMs=NaN)}function B(V,j){if(V.length!==j.length)return-1;let te=0;for(let ie=0;ie<V.length;ie++)te+=V[ie]*j[ie];return te}function $(){k={},x={}}return S={getSwitchRequest:function(V){try{const j=(0,r.default)(m).create();j.rule=this.getClassName();const te=V.getMediaType(),ie=V.getScheduleController();if(j.reason=j.reason||{},te===h.default.AUDIO)return j;ie.setTimeToLoadDelay(0);const se=(function(de){const G=de.getMediaType();let U=k[G];return U||(U=(function(P){const M={},ge=P.getMediaInfo();return M.state=Ze,M.currentRepresentation=null,(function(X){X&&X.type&&(x[X.type]={},x[X.type].w=[],x[X.type].prev_w=[],x[X.type].Q=0,x[X.type].segment_request_start_s=0,x[X.type].segment_download_finish_s=0,x[X.type].B_target=1.5)})(ge),N(M),M})(de),k[G]=U),U})(V);if(!x[te])return j;switch(j.reason.state=se.state,se.state){case Ae:break;case Ze:(function(de,G,U){const P=de.getMediaInfo(),M=de.getMediaType(),ge=de.getThroughputController().getSafeAverageThroughput(M);if(isNaN(ge))return G;const X=de.getAbrController(),be=X.getOptimalRepresentationForBitrate(P,ge,!0),fe=b.getCurrentBufferLevel(M,!0),Te=x[M],Ce=X.getPossibleVoRepresentationsFilteredBySettings(P,!0);if(G.representation=be,G.reason.throughput=ge,U.currentRepresentation=be,!isNaN(U.lastSegmentDurationS)&&fe>=Te.B_target){U.state=Be,Te.Q=Ne;for(let Ie=0;Ie<Ce.length;++Ie)Ce[Ie].id===U.currentRepresentation.id?Te.prev_w[Ie]=1:Te.prev_w[Ie]=0}})(V,j,se);break;case Be:(function(de,G,U){let P=[];const M=de.getThroughputController(),ge=de.getMediaType();let X=M.getAverageThroughput(ge,h.default.THROUGHPUT_CALCULATION_MODES.ARITHMETIC_MEAN,1),be=b.getCurrentHttpRequest(ge),fe=null;const Te=x[ge];if(X<1&&(X=1),be.url===U.lastSegmentUrl||be.type===ke.HTTPRequest.INIT_SEGMENT_TYPE)fe=U.currentRepresentation;else{let Ce=U.lastSegmentDurationS,Ie=1;const q=de.getAbrController(),W=de.getMediaInfo(),re=q.getPossibleVoRepresentationsFilteredBySettings(W,!0);let ee=de.getVideoModel().getPlaybackRate();const ne=Math.max(Math.pow(4,1),Ne*Math.sqrt(4));for(let me=0;me<re.length;++me){const Se=re[me];ee*Se.bitrateInKbit>X&&(Ie=-1),Te.w[me]=Te.prev_w[me]+Ie*(Ce/(2*ne))*((Te.Q+Ne)*(ee*Se.bitrateInKbit/X))}Te.w=(function(me){const Se=me.length;let Re=!1,we=[];for(let Zt=0;Zt<Se;++Zt)we[Zt]=me[Zt];let ze=me.sort((function(Zt,vt){return vt-Zt})),Ye=0,ct=0,bt=[];for(let Zt=0;Zt<Se-1;++Zt)if(Ye+=ze[Zt],ct=(Ye-1)/(Zt+1),ct>=ze[Zt+1]){Re=!0;break}Re||(ct=(Ye+ze[Se-1]-1)/Se);for(let Zt=0;Zt<Se;++Zt)bt[Zt]=Math.max(we[Zt]-ct,0);return bt})(Te.w);for(let me=0;me<re.length;++me)P[me]=Te.w[me]-Te.prev_w[me],Te.prev_w[me]=Te.w[me];const le=re.map((me=>me.bandwidth));Te.Q=Math.max(0,Te.Q-Ce+Ce*ee*((B(le,Te.prev_w)+B(le,P))/X));let z=[];for(let me=0;me<le.length;++me)z[me]=Math.abs(le[me]-B(Te.w,le));const ce=z.indexOf(Math.min(...z));fe=q.getRepresentationByAbsoluteIndex(ce,W,!0),fe.absoluteIndex>U.currentRepresentation.absoluteIndex&&le[U.currentRepresentation.absoluteIndex+1]<=X&&(fe=q.getRepresentationByAbsoluteIndex(U.currentRepresentation.absoluteIndex+1,W,!0)),fe.bitrateInKbit>=X&&(Te.Q=2*Math.max(Ne,Te.Q)),U.lastSegmentUrl=be.url}G.representation=fe,U.currentRepresentation=G.representation})(V,j,se);break;default:(function(de,G,U){const P=de.getAbrController(),M=de.getMediaInfo(),ge=de.getMediaType(),X=de.getThroughputController().getSafeAverageThroughput(ge);G.representation=P.getOptimalRepresentationForBitrate(M,X,!0),G.reason.throughput=X,U.state=Ze,N(U)})(V,j,se)}return j.priority=v.get().streaming.abr.rules.l2ARule.priority,j}catch(j){return I.error(j),(0,r.default)(m).create()}},reset:function(){$(),T.off(f.default.PLAYBACK_SEEKING,O,S),T.off(f.default.MEDIA_FRAGMENT_LOADED,A,S),T.off(f.default.METRIC_ADDED,R,S)}},I=(0,o.default)(m).getInstance().getLogger(S),$(),T.on(f.default.PLAYBACK_SEEKING,O,S),T.on(f.default.MEDIA_FRAGMENT_LOADED,A,S),T.on(f.default.METRIC_ADDED,R,S),S}tt.__dashjs_factory_name="L2ARule";var mt=n.default.getClassFactory(tt);function Ge(){const p=this.context;let m,b,T,v,S,k,x,I,N;function O(){T=null,v=1,S=100,k=0,x=null,I=null,N="dynamic_weight_selection"}function A(){let V=0;if(T)for(let j=0;j<T.length;j++){let te=T[j];te.state.throughput>V&&(V=te.state.throughput)}return V}function R(V,j,te){let ie=V.map(((se,de)=>te[de]*Math.pow(se-j[de],2))).reduce(((se,de)=>se+de));return(ie<0?-1:1)*Math.sqrt(Math.abs(ie))}function C(V,j){return R([V.state.throughput,V.state.latency,V.state.rebuffer,V.state.switch],[j.state.throughput,j.state.latency,j.state.rebuffer,j.state.switch],[1,1,1,1])}function B(V,j){for(let te=0;te<T.length;te++){let ie=T[te],se=.1;const de=C(ie,V);$(ie,j,Math.exp(-1*Math.pow(de,2)/(2*Math.pow(se,2))))}}function $(V,j,te){let ie=V.state,se=[.01,.01,.01,.01];ie.throughput=ie.throughput+(j[0]-ie.throughput)*se[0]*te,ie.latency=ie.latency+(j[1]-ie.latency)*se[1]*te,ie.rebuffer=ie.rebuffer+(j[2]-ie.rebuffer)*se[2]*te,ie.switch=ie.switch+(j[3]-ie.switch)*se[3]*te}return m={getNextQuality:function(V,j,te,ie,se,de,G,U){let P=ie,M=te;(function(W,re){if(!T){T=[];const ee=re.getPossibleVoRepresentationsFilteredBySettings(W,!0),ne=ee.map((le=>le.bandwidth));k=Math.min(...ne),v=(function(le){const z=le.map((ce=>Math.pow(ce,2))).reduce(((ce,me)=>ce+me));return Math.sqrt(z)})(ne),ee.forEach((le=>{let z={representation:le,state:{throughput:le.bandwidth/v,latency:0,rebuffer:0,switch:0}};T.push(z)})),I=(function(le){let z=[],ce=(function(ze){let Ye=[];for(let ct=0;ct<ze;ct++){let bt=[Math.random()*A(),Math.random(),Math.random(),Math.random()];Ye.push(bt)}return Ye})(Math.pow(le.length,2));z.push(ce[0]);let me=[1,1,1,1];for(let ze=1;ze<le.length;ze++){let Ye=null,ct=null;for(let bt=0;bt<ce.length;bt++){let Zt=ce[bt],vt=null;for(let Qt=0;Qt<z.length;Qt++){let un=R(Zt,z[Qt],me);(vt===null||un<vt)&&(vt=un)}(ct===null||vt>ct)&&(Ye=Zt,ct=vt)}z.push(Ye)}let Se=null,Re=null;for(let ze=0;ze<z.length;ze++){let Ye=0;for(let ct=0;ct<z.length;ct++)ze!==ct&&(Ye+=R(z[ze],z[ct],me));(Se===null||Ye>Se)&&(Se=Ye,Re=ze)}let we=[];for(we.push(z[Re]),z.splice(Re,1);z.length>0;){let ze=null,Ye=null;for(let ct=0;ct<z.length;ct++){let bt=R(we[0],z[ct],me);(ze===null||bt<ze)&&(ze=bt,Ye=ct)}we.push(z[Ye]),z.splice(Ye,1)}return we})(T)}})(j,V);let ge=te/v;ge>1&&(ge=A()),ie/=S;let X=T.find((W=>W.representation.id===G.id)),be=X.representation.bandwidth*U.getSegmentDuration()/M,fe=Math.max(0,be-se);if(se-be<U.getMinBuffer())return b.debug(`Buffer is low for bitrate= ${X.representation.bandwidth} downloadTime=${be} currentBuffer=${se} rebuffer=${fe}`),(function(W,re){let ee=0,ne=W;if(T)for(let le=0;le<T.length;le++){let z=T[le];z.representation.bandwidth<W.representation.bandwidth&&z.representation.bandwidth>ee&&re>z.representation.bandwidth&&(ee=z.representation.bandwidth,ne=z)}return ne})(X,M).representation;switch(N){case"manual_weight_selection":x=[.4,.4,.4,.4];break;case"random_weight_selection":x=(function(W){let re=[],ee=Math.sqrt(2/W);for(let ne=0;ne<4;ne++)re.push(Math.random()*ee);return x=re,x})(T.length);break;default:(function(W,re,ee,ne,le,z){x||(x=I[I.length-1]);let ce=W.findWeightVector(T,re,ee,ne,le,z);ce!==null&&ce!==-1&&(x=ce)})(U,P,se,fe,M,de)}let Te=null,Ce=null,Ie=null;for(let W=0;W<T.length;W++){let re=T[W],ee=re.state,ne=[ee.throughput,ee.latency,ee.rebuffer,ee.switch],le=x.slice(),z=U.getNextBufferWithBitrate(re.representation.bandwidth,se,M),ce=z<U.getMinBuffer();ce&&b.debug(`Buffer is low for bitrate=${re.representation.bandwidth} downloadTime=${be} currentBuffer=${se} nextBuffer=${z}`),(re.representation.bandwidth>te-1e4||ce)&&re.representation.bandwidth!==k&&(le[0]=100);let me=R(ne,[ge,0,0,0],le);(Te===null||me<Te)&&(Te=me,Ce=re.representation,Ie=re)}let q=Math.abs(X.representation.bandwidth-Ie.representation.bandwidth)/v;return B(X,[ge,ie,fe,q]),B(Ie,[ge,0,0,q]),Ce},reset:function(){O()}},b=(0,o.default)(p).getInstance().getLogger(m),O(),m}Ge.__dashjs_factory_name="LearningAbrController";var ut=n.default.getClassFactory(Ge),Xe=class{constructor(){this.type=null,this.lastBitrate=null,this.weights={},this.weights.bitrateReward=null,this.weights.bitrateSwitchPenalty=null,this.weights.rebufferPenalty=null,this.weights.latencyPenalty=null,this.weights.playbackSpeedPenalty=null,this.bitrateWSum=0,this.bitrateSwitchWSum=0,this.rebufferWSum=0,this.latencyWSum=0,this.playbackSpeedWSum=0,this.totalQoe=0}};function nt(){let p,m,b,T,v;function S(){m=null,b=null,T=null,v=null}function k(I,N,O,A){let R=new Xe;return R.type=I,R.weights.bitrateReward=N||1,R.weights.bitrateSwitchPenalty=1,R.weights.rebufferPenalty=O||1e3,R.weights.latencyPenalty=[],R.weights.latencyPenalty.push({threshold:1.1,penalty:.05*A}),R.weights.latencyPenalty.push({threshold:1e8,penalty:.1*O}),R.weights.playbackSpeedPenalty=A||200,R}function x(I,N,O,A,R){R.bitrateWSum+=R.weights.bitrateReward*I,R.lastBitrate&&(R.bitrateSwitchWSum+=R.weights.bitrateSwitchPenalty*Math.abs(I-R.lastBitrate)),R.lastBitrate=I,R.rebufferWSum+=R.weights.rebufferPenalty*N;for(let C=0;C<R.weights.latencyPenalty.length;C++){let B=R.weights.latencyPenalty[C];if(O<=B.threshold){R.latencyWSum+=B.penalty*O;break}}R.playbackSpeedWSum+=R.weights.playbackSpeedPenalty*Math.abs(1-A),R.totalQoe=R.bitrateWSum-R.bitrateSwitchWSum-R.rebufferWSum-R.latencyWSum-R.playbackSpeedWSum}return p={setupPerSegmentQoe:function(I,N,O){m=k("segment",I,N,O),b=I,T=N,v=O},logSegmentMetrics:function(I,N,O,A){m&&x(I,N,O,A,m)},getPerSegmentQoe:function(){return m},calculateSingleUseQoe:function(I,N,O,A){let R=null;return b&&T&&v&&(R=k("segment",b,T,v)),R?(x(I,N,O,A,R),R.totalQoe):0},reset:function(){S()}},S(),p}nt.__dashjs_factory_name="LoLpQoeEvaluator";var Ft=n.default.getClassFactory(nt);function Xt(p){let m,b,T,v,S=p.targetLatency,k=p.bufferMin,x=p.segmentDuration,I=p.qoeEvaluator;function N(){return x}function O(A,R){const C=N();let B;return B=R>C?A-C:A+C-R,B}return m={getMinBuffer:function(){return k},getSegmentDuration:N,getNextBufferWithBitrate:function(A,R,C){return O(R,A*x/C)},getNextBuffer:O,findWeightVector:function(A,R,C,B,$,V){let j=null,te=null,ie=null,se=Math.abs(R-v);return A.forEach((de=>{T.forEach((G=>{G[0];let U,P=G[1],M=G[2],ge=(G[3],de.representation.bandwidth*x/$),X=O(C,ge);U=M===0?10:1/M;let be=U*Math.max(1e-5,ge-X);U=P===0?10:1/P;let fe=U*de.state.latency,Te=I.calculateSingleUseQoe(de.representation.bandwidth,be,fe,V);(j===null||Te>j)&&(function(Ce,Ie,q){return!(Ce>S+q)&&Ie>=k})(R,X,se)&&(j=Te,te=G,ie=de.representation.bandwidth)}))})),te===null&&ie===null&&(te=-1),v=R,te}},b=[.2,.4,.6,.8,1],T=(function(A){let R=A.map((function(B){return[B]})),C=function(B,$,V){if(V===$)return B;let j=B.length;for(let te=0;te<j;te++){let ie=B.shift();for(let se=0;se<A.length;se++)B.push(ie.concat(A[se]))}return C(B,$,V+1)};return C(R,4,1)})(b),v=0,m}Xt.__dashjs_factory_name="LoLpWeightSelector";var Pe=n.default.getClassFactory(Xt);function De(p){let m,b,T,v,S,k=(p=p||{}).dashMetrics,x=this.context;return T={getSwitchRequest:function(I){try{let N=(0,r.default)(x).create();N.rule=this.getClassName();let O=I.getMediaInfo().type,A=I.getAbrController();const R=I.getStreamInfo();let C=I.getRepresentation();const B=I.getMediaInfo(),$=k.getCurrentBufferState(O),V=I.getScheduleController(),j=k.getCurrentBufferLevel(O,!0),te=V.getPlaybackController();let ie=te.getCurrentLiveLatency();if(O===h.default.AUDIO)return N;ie||(ie=0);const se=te.getPlaybackRate(),de=I.getThroughputController().getSafeAverageThroughput(O);if(m.debug(`Throughput ${Math.round(de)} kbps`),isNaN(de)||!$||A.getAbandonmentStateFor(R.id,O)===i.ABANDON_LOAD)return N;let G=A.getPossibleVoRepresentationsFilteredBySettings(B,!0).map((Ce=>Ce.bandwidth)),U=I.getRepresentation().fragmentDuration,P=Math.min(...G)/1e3,M=Math.max(...G)/1e3,ge=C.bandwidth/1e3,X=k.getCurrentHttpRequest(O,!0),be=(X.tresponse.getTime()-X.trequest.getTime())/1e3,fe=be>U?be-U:0;S.setupPerSegmentQoe(U,M,P),S.logSegmentMetrics(ge,fe,ie,se);let Te=Pe(x).create({targetLatency:1.5,bufferMin:.3,segmentDuration:U,qoeEvaluator:S});return N.representation=v.getNextQuality(A,B,1e3*de,ie,j,se,C,Te),N.reason={throughput:de,latency:ie},N.priority=b.get().streaming.abr.rules.loLPRule.priority,V.setTimeToLoadDelay(0),N}catch(N){throw N}},reset:function(){v.reset(),S.reset()}},m=(0,o.default)(x).getInstance().getLogger(T),v=ut(x).create(),S=Ft(x).create(),b=(0,l.default)(x).getInstance(),T}De.__dashjs_factory_name="LoLPRule";var dt=n.default.getClassFactory(De);function Q(p){p=p||{};const m=this.context,b=p.mediaPlayerModel,T=p.customParametersModel,v=p.dashMetrics,S=p.settings,k=(0,g.default)(m).getInstance();let x,I,N,O;function A(){Object.values(h.default.QUALITY_SWITCH_RULES).forEach((V=>{I=R(V,I)})),Object.values(h.default.ABANDON_FRAGMENT_RULES).forEach((V=>{N=R(V,N)})),T.getAbrCustomRules().forEach((function(V){V.type===h.default.RULES_TYPES.QUALITY_SWITCH_RULES&&I.push(V.rule(m).create()),V.type===h.default.RULES_TYPES.ABANDON_FRAGMENT_RULES&&N.push(V.rule(m).create())})),I.length===0&&(I.push(et(m).create({dashMetrics:v,mediaPlayerModel:b,settings:S})),I.push(c(m).create({dashMetrics:v})))}function R(V,j){const te=V.charAt(0).toLowerCase()+V.slice(1);return S.get().streaming.abr.rules[te].active&&!(function(ie,se){return ie.filter((de=>de.getClassName()===se)).length>0})(j,V)?(j.push((function(ie){switch(ie){case h.default.QUALITY_SWITCH_RULES.BOLA_RULE:return et(m).create({dashMetrics:v,mediaPlayerModel:b,settings:S});case h.default.QUALITY_SWITCH_RULES.THROUGHPUT_RULE:return c(m).create({dashMetrics:v});case h.default.QUALITY_SWITCH_RULES.INSUFFICIENT_BUFFER_RULE:return _(m).create({dashMetrics:v,settings:S});case h.default.QUALITY_SWITCH_RULES.SWITCH_HISTORY_RULE:return xe(m).create();case h.default.QUALITY_SWITCH_RULES.DROPPED_FRAMES_RULE:return ae(m).create();case h.default.QUALITY_SWITCH_RULES.LEARN_TO_ADAPT_RULE:return mt(m).create({dashMetrics:v,settings:S});case h.default.QUALITY_SWITCH_RULES.LOL_PLUS_RULE:return dt(m).create({dashMetrics:v});case h.default.ABANDON_FRAGMENT_RULES.ABANDON_REQUEST_RULE:return K(m).create({dashMetrics:v,mediaPlayerModel:b,settings:S})}})(V)),j):S.get().streaming.abr.rules[te].active?j:(function(ie,se){return ie.filter((de=>de.getClassName()!==se))})(j,V)}function C(V){return V.filter((j=>j.representation!==r.default.NO_CHANGE))}function B(V){const j={};let te,ie,se,de=null;if(V.length!==0){for(j[r.default.PRIORITY.STRONG]=null,j[r.default.PRIORITY.WEAK]=null,j[r.default.PRIORITY.DEFAULT]=null,te=0,ie=V.length;te<ie;te+=1)se=V[te],se.representation!==r.default.NO_CHANGE&&(j[se.priority]===null||j[se.priority].representation!==r.default.NO_CHANGE&&se.representation.bitrateInKbit<j[se.priority].representation.bitrateInKbit)&&(j[se.priority]=se);return j[r.default.PRIORITY.WEAK]&&j[r.default.PRIORITY.WEAK].representation!==r.default.NO_CHANGE&&(de=j[r.default.PRIORITY.WEAK]),j[r.default.PRIORITY.DEFAULT]&&j[r.default.PRIORITY.DEFAULT].representation!==r.default.NO_CHANGE&&(de=j[r.default.PRIORITY.DEFAULT]),j[r.default.PRIORITY.STRONG]&&j[r.default.PRIORITY.STRONG].representation!==r.default.NO_CHANGE&&(de=j[r.default.PRIORITY.STRONG]),de}}function $(){A()}return x={clearDataForStream:function(V){[I,N].forEach((j=>{j&&j.length&&j.forEach((te=>te.clearDataForStream&&typeof te.clearDataForStream=="function"&&te.clearDataForStream(V)))}))},getAbandonFragmentRules:function(){return N},getBestPossibleSwitchRequest:function(V){return V&&B(C(I.filter((j=>{const te=j.getClassName();if(te!==h.default.QUALITY_SWITCH_RULES.BOLA_RULE&&te!==h.default.QUALITY_SWITCH_RULES.THROUGHPUT_RULE)return!0;const ie=V.getMediaType();return O[ie]&&te===h.default.QUALITY_SWITCH_RULES.BOLA_RULE||!O[ie]&&te===h.default.QUALITY_SWITCH_RULES.THROUGHPUT_RULE})).map((j=>j.getSwitchRequest(V)))))||(0,r.default)(m).create()},getBolaState:function(V){return O[V]},getMinSwitchRequest:B,getQualitySwitchRules:function(){return I},handleNewMediaInfo:function(V){I.forEach((j=>j.handleNewMediaInfo&&j.handleNewMediaInfo(V))),N.forEach((j=>j.handleNewMediaInfo&&j.handleNewMediaInfo(V)))},initialize:function(){I=[],N=[],O={},A(),k.on(f.default.SETTING_UPDATED_ABR_ACTIVE_RULES,$,x)},reset:function(){[I,N].forEach((V=>{V&&V.length&&V.forEach((j=>j.reset&&j.reset()))})),I=[],N=[],O={},k.off(f.default.SETTING_UPDATED_ABR_ACTIVE_RULES,$,x)},setBolaState:function(V,j){O[V]=j},shouldAbandonFragment:function(V){if(!V)return(0,r.default)(m).create();const j=B(C(N.map((te=>te.shouldAbandon(V)))));return j&&j.reason&&(j.reason.forceAbandon=!0),j||(0,r.default)(m).create()}},x}Q.__dashjs_factory_name="ABRRulesCollection";const H=n.default.getClassFactory(Q);n.default.updateSingletonFactory(Q.__dashjs_factory_name,H);var w=H;class D{constructor(m){this.action=D.ACTION_DOWNLOAD,this.availabilityEndTime=null,this.availabilityStartTime=null,this.bandwidth=NaN,this.bytesLoaded=NaN,this.bytesTotal=NaN,this.delayLoadingTime=NaN,this.duration=NaN,this.endDate=null,this.firstByteDate=null,this.index=NaN,this.isPartialSegmentRequest=!1,this.mediaStartTime=NaN,this.mediaType=null,this.presentationStartTime=NaN,this.range=null,this.representation=null,this.responseType="arraybuffer",this.retryAttempts=0,this.serviceLocation=null,this.startDate=null,this.startTime=NaN,this.timescale=NaN,this.type=null,this.url=m||null,this.wallStartTime=null}isInitializationRequest(){return this.type&&this.type===ke.HTTPRequest.INIT_SEGMENT_TYPE}setInfo(m){this.type=m&&m.init?ke.HTTPRequest.INIT_SEGMENT_TYPE:ke.HTTPRequest.MEDIA_SEGMENT_TYPE,this.url=m&&m.url?m.url:null,this.range=m&&m.range?m.range.start+"-"+m.range.end:null,this.mediaType=m&&m.mediaType?m.mediaType:null,this.representation=m&&m.representation?m.representation:null}}D.ACTION_DOWNLOAD="download",D.ACTION_COMPLETE="complete";var oe=D;const F="loading",Me="executed",We="failed";function Ue(p){const m=(p=p||{}).eventBus,b=p.events,T=p.dashMetrics,v=p.fragmentLoader,S=p.debug,k=p.streamInfo,x=p.type;let I,N,O,A;function R(G){return!!G&&(function(U){let P=!1;return U.some((M=>{if(ge=G,X=M,!isNaN(ge.index)&&ge.startTime===X.startTime&&ge.adaptationIndex===X.adaptationIndex&&ge.type===X.type||(function(be,fe){return be.representation.id===fe.representation.id})(G,M)||(function(be,fe){return be.action===oe.ACTION_COMPLETE&&be.action===fe.action})(G,M))return P=!0,P;var ge,X})),P})(O)}function C(G){return isNaN(G.duration)?.25:Math.min(G.duration/8,.5)}function B(G){O=O.filter((U=>{const P=C(U);return isNaN(U.startTime)||G!==void 0&&U.startTime>=G-P}))}function $(G,U){U<=G+.5||(O=O.filter((P=>{const M=C(P);return isNaN(P.startTime)||P.startTime>=U-M||isNaN(P.duration)||P.startTime+P.duration<=G+M})))}function V(G,U,P){for(let M=G.length-1;M>=0;M--){const ge=G[M],X=ge.startTime,be=X+ge.duration;if(P=isNaN(P)?C(ge):P,!isNaN(X)&&!isNaN(be)&&U+P>=X&&U-P<be||isNaN(X)&&isNaN(U))return ge}return null}function j(G,U){T.addSchedulingInfo(G,U),T.addRequestsQueue(G.mediaType,A,O)}function te(G){G.sender===v&&(A.splice(A.indexOf(G.request),1),G.response&&!G.error&&O.push(G.request),j(G.request,G.error?We:Me),m.trigger(b.FRAGMENT_LOADING_COMPLETED,{request:G.request,response:G.response,error:G.error,sender:this},{streamId:k.id,mediaType:x}))}function ie(G){G.sender===v&&m.trigger(b.FRAGMENT_LOADING_PROGRESS,{request:G.request,response:G.response,error:G.error,sender:this},{streamId:k.id,mediaType:x})}function se(G){G.sender===v&&m.trigger(b.FRAGMENT_LOADING_ABANDONED,{request:G.request},{streamId:k.id,mediaType:x})}function de(){O=[],A=[],v&&v.resetInitialSettings()}return I={abortRequests:function(){N.debug("abort requests"),v.abort(),A=[]},executeRequest:function(G){G.action===oe.ACTION_DOWNLOAD?(j(G,F),A.push(G),(function(U){m.trigger(b.FRAGMENT_LOADING_STARTED,{request:U},{streamId:k.id,mediaType:x}),v.load(U)})(G)):N.warn("Unknown request action.")},getRequests:function(G){const U=G?G.state instanceof Array?G.state:[G.state]:[];let P=[];return U.forEach((M=>{const ge=(function(X){let be;switch(X){case F:be=A;break;case Me:be=O;break;default:be=[]}return be})(M);P=P.concat((function(X,be){return be.hasOwnProperty("time")?[V(X,be.time,be.threshold)]:X.filter((fe=>{for(const Te in be)if(Te!=="state"&&be.hasOwnProperty(Te)&&fe[Te]!=be[Te])return!1;return!0}))})(ge,G))})),P},getStreamId:function(){return k.id},getType:function(){return x},isFragmentLoaded:R,isFragmentLoadedOrPending:function(G){let U,P=!1,M=0;if(P=R(G),!P)for(M=0;M<A.length;M++)U=A[M],G.url===U.url&&G.startTime===U.startTime&&(P=!0);return P},removeExecutedRequestsAfterTime:function(G){O=O.filter((U=>isNaN(U.startTime)||G!==void 0&&U.startTime<G))},removeExecutedRequestsBeforeTime:B,reset:function(){m.off(b.LOADING_COMPLETED,te,this),m.off(b.LOADING_DATA_PROGRESS,ie,this),m.off(b.LOADING_ABANDONED,se,this),v&&v.reset(),de()},resetInitialSettings:de,syncExecutedRequestsWithBufferedRange:function(G,U){if(!G||G.length===0)return void B();let P=0;for(let M=0,ge=G.length;M<ge;M++)$(P,G.start(M)),P=G.end(M);U>0&&$(P,U)}},N=S.getLogger(I),de(),m.on(b.LOADING_COMPLETED,te,I),m.on(b.LOADING_DATA_PROGRESS,ie,I),m.on(b.LOADING_ABANDONED,se,I),I}Ue.__dashjs_factory_name="FragmentModel";const je=n.default.getClassFactory(Ue);je.FRAGMENT_MODEL_LOADING=F,je.FRAGMENT_MODEL_EXECUTED=Me,je.FRAGMENT_MODEL_CANCELED="canceled",je.FRAGMENT_MODEL_FAILED=We,n.default.updateClassFactory(Ue.__dashjs_factory_name,je);var Oe=je;function He(p){let m;const b=(p=p||{}).abrController,T=p.throughputController,v=p.switchRequestHistory,S=p.droppedFramesHistory,k=p.currentRequest,x=p.streamProcessor?p.streamProcessor.getScheduleController():null,I=p.streamProcessor?p.streamProcessor.getRepresentation():null,N=p.videoModel?p.videoModel:null;function O(){return I?I.mediaInfo:null}return m={getAbrController:function(){return b},getCurrentRequest:function(){return k},getDroppedFramesHistory:function(){return S},getMediaInfo:O,getMediaType:function(){const A=O();return A?A.type:null},getRepresentation:function(){return I},getScheduleController:function(){return x},getStreamInfo:function(){const A=O();return A?A.streamInfo:null},getSwitchRequestHistory:function(){return v},getThroughputController:function(){return T},getVideoModel:function(){return N}},m}He.__dashjs_factory_name="RulesContext";var st=n.default.getClassFactory(He);function it(){let p={},m={};const b=this.context,T=(0,l.default)(b).getInstance();return{clearForStream:function(v){delete p[v],delete m[v]},getSwitchRequests:function(v,S){return v!=null&&S!=null&&p[v]&&p[v][S]?p[v][S]:{}},push:function(v){const S=v.currentRepresentation,k=v.newRepresentation;if(S.mediaInfo.streamInfo.id!==k.mediaInfo.streamInfo.id||k.mediaInfo.id!==S.mediaInfo.id)return;const x=S.mediaInfo.streamInfo.id;p[x]||(function($){p[$]={},m[$]={}})(x);const I=S.mediaInfo.type;p[x][I]||(function($,V){p[$][V]={},m[$][V]=[]})(x,I);const N=v.currentRepresentation.id;p[x][I][N]||(function($,V,j){p[$][V][j]={noDrops:0,drops:0,dropSize:0}})(x,I,N);let O=v.newRepresentation.absoluteIndex-v.currentRepresentation.absoluteIndex,A=O<0?1:0,R=A?-O:0,C=A?0:1;p[x][I][v.currentRepresentation.id].drops+=A,p[x][I][v.currentRepresentation.id].dropSize+=R,p[x][I][v.currentRepresentation.id].noDrops+=C,m[x][I].push({id:v.currentRepresentation.id,noDrop:C,drop:A,dropSize:R});const B=(function($,V){return m[$][V].length>T.get().streaming.abr.rules.switchHistoryRule.parameters.sampleSize?m[$][V].shift():null})(x,I);B&&(function($,V,j){p[$][V][j.id].drops-=j.drop,p[$][V][j.id].dropSize-=j.dropSize,p[$][V][j.id].noDrops-=j.noDrop})(x,I,B)},reset:function(){p={},m={}}}}it.__dashjs_factory_name="SwitchRequestHistory";var Et=n.default.getClassFactory(it);function nn(){let p={},m={},b={};return{clearForStream:function(T){delete p[T],delete m[T],delete b[T]},getFrameHistory:function(T){return p[T]},push:function(T,v,S){if(!v)return;p[T]||(function(A){p[A]=[],m[A]=0,b[A]=0})(T);let k=S&&S.droppedVideoFrames?S.droppedVideoFrames:0,x=S&&S.totalVideoFrames?S.totalVideoFrames:0,I=k-m[T];m[T]=k;let N=x-b[T];b[T]=x;const O=p[T];O[v]?(O[v].droppedVideoFrames+=I,O[v].totalVideoFrames+=N):O[v]={droppedVideoFrames:I,totalVideoFrames:N}},reset:function(){p={},m={},b={}}}}nn.__dashjs_factory_name="DroppedFramesHistory";var Ut=n.default.getClassFactory(nn);function Kt(){const p=this.context,m=(0,o.default)(p).getInstance(),b=(0,g.default)(p).getInstance();let T,v,S,k,x,I,N,O,A,R,C,B,$,V,j,te,ie,se,de,G,U;function P(){T={},se={},j=new Map,C&&C.reset(),de&&de.reset(),N=void 0,C=void 0,de=void 0,clearTimeout(v),v=null}function M(z,ce=!0){let me=ge(z,ce);return me=(function(Se){try{return(function(Re){try{if(!te.get().streaming.cmsd.enabled||!te.get().streaming.cmsd.abr.applyMb)return Re;const we=Re.filter((ze=>{const Ye=ze.mediaInfo.type;let ct=I.getMaxBitrate(Ye);if(Ye!==h.default.VIDEO||ct<0)return!0;const bt=ze.mediaInfo.streamInfo.id;return ct-=se[bt][h.default.AUDIO].getRepresentation().bitrateInKbit||0,ze.bitrateInKbit<=ct}));return we.length>0?we:Re}catch(we){return $.error(we),Re}})(Se=(function(Re){try{if(!te.get().streaming.abr.limitBitrateByPortal)return Re;const{elementWidth:we}=U.getVideoElementSize(),ze=Re.filter((Ye=>Ye.mediaInfo.type!==h.default.VIDEO||Ye.width<=we));return ze.length>0?ze:Re}catch(we){return $.error(we),Re}})(Se=(function(Re){try{const we=Re.filter((ze=>{const Ye=ze.mediaInfo.type,ct=ze.bitrateInKbit,bt=V.getAbrBitrateParameter("maxBitrate",Ye),Zt=V.getAbrBitrateParameter("minBitrate",Ye);return!(bt>-1&&ct>bt||Zt>-1&&ct<Zt)}));return we.length>0?we:Re}catch(we){return $.error(we),Re}})(Se)))}catch(Re){return $.error(Re),Se}})(me),me}function ge(z,ce){let me=[];return z&&((function(Re){try{const we=[];if(Re&&we.push(Re),!te.get().streaming.abr.enableSupplementalPropertyAdaptationSetSwitching||!Re.adaptationSetSwitchingCompatibleIds||Re.adaptationSetSwitchingCompatibleIds.length===0)return we;const ze=se[Re.streamInfo.id][Re.type].getAllMediaInfos().filter((Ye=>Re.adaptationSetSwitchingCompatibleIds.includes(Ye.id)));return we.concat(ze)}catch{return[Re]}})(z).forEach((Re=>{let we=k.getVoRepresentations(Re);we&&we.length>0&&(me=me.concat(we))})),me=(function(Re){return Re.forEach((we=>{if(we.dependentRepresentation&&we.dependentRepresentation.mediaInfo===null){let ze=we.dependentRepresentation.id,Ye=Re.find((ct=>ct.id===ze));Ye&&(we.dependentRepresentation=Ye)}})),Re})(me),me=(function(Re){return Re=(function(we){let ze=null;return we.filter((Ye=>(ze||(ze=Ye.mediaInfo),!isNaN(Ye.qualityRanking)&&k.areMediaInfosEqual(ze,Ye.mediaInfo)))).length===we.length})(Re)?(function(we){return we.sort(((ze,Ye)=>Ye.qualityRanking-ze.qualityRanking)),we})(Re):(function(we){return we.sort(((ze,Ye)=>k.areMediaInfosEqual(ze.mediaInfo,Ye.mediaInfo)?isNaN(ze.pixelsPerSecond)||isNaN(Ye.pixelsPerSecond)||ze.pixelsPerSecond===Ye.pixelsPerSecond?ze.bandwidth-Ye.bandwidth:ze.pixelsPerSecond-Ye.pixelsPerSecond:isNaN(ze.pixelsPerSecond)||isNaN(Ye.pixelsPerSecond)||ze.pixelsPerSecond===Ye.pixelsPerSecond?isNaN(ze.bitsPerPixel)||isNaN(Ye.bitsPerPixel)?ze.bandwidth-Ye.bandwidth:Ye.bitsPerPixel-ze.bitsPerPixel:ze.pixelsPerSecond-Ye.pixelsPerSecond)),we})(Re)})(me),me.forEach(((Re,we)=>{Re.absoluteIndex=we})),me=me.filter((Re=>{const we=!!ce||k.areMediaInfosEqual(Re.mediaInfo,z),ze=!Re||!Re.mediaInfo||x.areKeyIdsUsable(Re.mediaInfo);return we&&ze}))),me}function X(z){const ce=z.request.mediaType,me=z.streamId;if(!(ce&&me&&se[me]&&te.get().streaming.abr.autoSwitchBitrate[ce]))return;const Se=se[me][ce];if(!Se)return;var Re;if(!(!((Re=Se.getLastSegment())&&Re.isPartialSegment&&!isNaN(Re.totalNumberOfPartialSegments)&&!isNaN(Re.replacementSubNumber))||Re.replacementSubNumber===0))return;const we=fe(Se,z.request),ze=S.shouldAbandonFragment(we);ze&&ze.representation!==r.default.NO_CHANGE&&(function(Ye,ct,bt,Zt,vt){if(Zt.getFragmentModel().getRequests({state:Oe.FRAGMENT_MODEL_LOADING,index:Ye.request.index})[0]){const Qt=(function(un,Rn){return T[un]&&T[un][Rn]?T[un][Rn]:null})(ct,bt);Qt&&(Qt.state=i.ABANDON_LOAD),de.reset(),re(bt,ie.getActiveStreamInfo(),vt.representation,vt.reason),clearTimeout(v),v=setTimeout((()=>{Qt&&(T[ct][bt].state=i.ALLOW_LOAD),v=null}),te.get().streaming.abandonLoadTimeout)}})(z,me,ce,Se,ze)}function be(){te.get().streaming.abr.limitBitrateByPortal&&Object.keys(se).forEach((z=>{Object.keys(se[z]).forEach((ce=>{Ie(ce,z)}))}))}function fe(z,ce){return st(p).create({abrController:B,adapter:k,currentRequest:ce,droppedFramesHistory:C,streamProcessor:z,switchRequestHistory:de,throughputController:G,videoModel:U})}function Te(z){z.mediaType===h.default.VIDEO&&(W(z.streamId),N=z.newRepresentation.id)}function Ce(z){!le()||z.metric!==i.BUFFER_LEVEL||z.mediaType!==h.default.AUDIO&&z.mediaType!==h.default.VIDEO||(function(ce,me){try{const Se=V.getBufferTimeDefault(),Re=Se,we=.5*Se,ze=S.getBolaState(ce),Ye=me>=(ze?we:Re);S.setBolaState(ce,Ye),Ye!==ze&&(Ye?$.info("["+ce+"] switching from throughput to buffer occupancy ABR rule (buffer: "+me.toFixed(3)+")."):$.info("["+ce+"] switching from buffer occupancy to throughput ABR rule (buffer: "+me.toFixed(3)+")."))}catch(Se){$.error(Se)}})(z.mediaType,.001*z.value.level)}function Ie(z,ce){try{if(!(z&&se&&se[ce]&&se[ce][z]))return!1;W(ce);const me=se[ce][z],Se=me.getLastSegment(),Re=me.getRepresentationController()?.getCurrentCompositeRepresentation(),we=q(Se,Re);if(!te.get().streaming.abr.autoSwitchBitrate[z]||!we)return!1;const ze=fe(me),Ye=S.getBestPossibleSwitchRequest(ze);if(!Ye||!Ye.representation)return!1;let ct=Ye.representation;return(function(bt,Zt){de.push({currentRepresentation:bt,newRepresentation:Zt})})(Re,ct),ct.id!==Re.id&&(T[ce][z].state===i.ALLOW_LOAD||ct.absoluteIndex<Re.absoluteIndex)&&(ne(z,Re,ct,Ye.reason),!0)}catch(me){return $.error(me),!1}}function q(z,ce){return!(z&&z.isPartialSegment&&!isNaN(z.totalNumberOfPartialSegments)&&!isNaN(z.replacementSubNumber))||z.replacementSubNumber===z.totalNumberOfPartialSegments-1||(function(me,Se){if(!Se||!Se.segmentSequenceProperties||Se.segmentSequenceProperties.length<=0||Se&&Se.mediaInfo&&Se.mediaInfo.adaptationSetSwitchingCompatibleIds&&Se.mediaInfo.adaptationSetSwitchingCompatibleIds.length>0)return!1;const Re=Se.segmentSequenceProperties.filter((ze=>!isNaN(ze.sapType)&&ze.sapType<=1));if(Re.length===0)return!1;let we=(me.replacementSubNumber+1)%me.totalNumberOfPartialSegments;return Re.some((ze=>we%ze.cadence==0))})(z,ce)}function W(z){if(C){const ce=U.getPlaybackQuality();ce&&C.push(z,N,ce)}}function re(z,ce,me,Se={}){if(!(ce&&ce.id&&z&&se&&se[ce.id]&&se[ce.id][z]&&me))return!1;const Re=se[ce.id][z],we=Re.getRepresentationController()?.getCurrentCompositeRepresentation();return(!we||me.id!==we.id)&&ne(z,we,me,Se)}function ee(z,ce){return`${z}-${ce}`}function ne(z,ce,me,Se){const Re=me.mediaInfo.streamInfo.id;if(!z||!se[Re]||!se[Re][z])return!1;const we=se[Re][z].getStreamInfo(),ze=A.getCurrentBufferLevel(z),Ye=ce!==null&&!k.areMediaInfosEqual(ce.mediaInfo,me.mediaInfo),ct=ce?ce.bitrateInKbit:0;return $.info(`[AbrController]: Switching quality in period ${Re} for media type ${z}. Switch from bitrate ${ct} to bitrate ${me.bitrateInKbit}. Current buffer level: ${ze}. Reason:`+(Se?JSON.stringify(Se):"/")),b.trigger(y.default.QUALITY_CHANGE_REQUESTED,{isAdaptationSetSwitch:Ye,mediaType:z,newRepresentation:me,oldRepresentation:ce,reason:Se,streamInfo:we},{streamId:we.id,mediaType:z}),(function(bt){const Zt=G.getAverageThroughput(bt);isNaN(Zt)||R.setSavedBitrateSettings(bt,Zt)})(z),!0}function le(){return te.get().streaming.abr.rules.bolaRule.active&&te.get().streaming.abr.rules.throughputRule.active}return B={canPerformQualitySwitch:q,checkPlaybackQuality:Ie,clearDataForStream:function(z){C&&C.clearForStream(z),se[z]&&delete se[z],de&&de.clearForStream(z),T[z]&&delete T[z],S.clearDataForStream(z)},getAbandonmentStateFor:function(z,ce){return T[z]&&T[z][ce]?T[z][ce].state:null},getInitialBitrateFor:function(z){if(z===h.default.TEXT)return NaN;let ce=V.getAbrBitrateParameter("initialBitrate",z);if(ce>0)return ce;let me=NaN;if(R&&R.hasOwnProperty("getSavedBitrateSettings")&&(me=R.getSavedBitrateSettings(z)),!isNaN(me))return me;const Se=G.getAverageThroughput(z);return!isNaN(Se)&&Se>0?Se:z===h.default.VIDEO?1e3:100},getOptimalRepresentationForBitrate:function(z,ce,me=!0){const Se=M(z,me);if(!Se||Se.length===0)return null;const Re=Se.reduce(((ze,Ye)=>ze.bandwidth<Ye.bandwidth?ze:Ye));if(ce<=0)return Re;const we=Se.filter((ze=>ze.bitrateInKbit<=ce));return we&&we.length!==0?we.reduce(((ze,Ye)=>Ye.absoluteIndex>ze.absoluteIndex?Ye:ze)):Re},getPossibleVoRepresentations:function(z,ce=!0){return ge(z,ce)},getPossibleVoRepresentationsFilteredBySettings:M,getRepresentationByAbsoluteIndex:function(z,ce,me=!0){return isNaN(z)||z<0?null:M(ce,me).find((Se=>Se.absoluteIndex===z))},handleNewMediaInfo:function(z){S.handleNewMediaInfo(z)},handlePendingManualQualitySwitch:function(z,ce){try{const me=ee(z,ce);let Se=null;if(j.has(me)&&(Se=j.get(me)),!Se)return!1;const Re=se[z][ce],we=Re.getLastSegment();if(!q(we,Re.getRepresentation()))return!1;const{type:ze,streamInfo:Ye,representation:ct,reason:bt}=Se;return j.delete(me),re(ze,Ye,ct,bt),!0}catch(me){$.error(`Can not handle pending manual quality switch: ${me}`)}},initialize:function(){C=Ut(p).create(),de=Et(p).create(),S=w(p).create({dashMetrics:A,customParametersModel:O,mediaPlayerModel:V,settings:te}),S.initialize(),b.on(y.default.QUALITY_CHANGE_RENDERED,Te,B),b.on(y.default.METRIC_ADDED,Ce,B),b.on(f.default.LOADING_PROGRESS,X,B),b.on(f.default.VIDEO_ELEMENT_RESIZED,be,B)},isPlayingAtLowestQuality:function(z){return M(z.mediaInfo,!0)[0].id===z.id},isPlayingAtTopQuality:function(z){if(!z)return!0;const ce=M(z.mediaInfo,!0);return ce[ce.length-1].id===z.id},manuallySetPlaybackQuality:function(z,ce,me,Se={}){const Re=se[ce.id][z];if(q(Re.getLastSegment(),Re.getRepresentation()))return re(z,ce,me,Se);(function(we,ze,Ye,ct){try{$.debug(`[AbrController] Queuing manual quality switch for stream ${ze.id} and type ${we} to representation ${Ye.id}`);const bt=ee(ze.id,we);j.set(bt,{type:we,streamInfo:ze,representation:Ye,reason:ct})}catch(bt){$.error(`Can not queue manual quality switch: ${bt}`)}})(z,ce,me,Se)},registerStreamType:function(z,ce){const me=ce.getStreamInfo().id;se[me]||(se[me]={}),se[me][z]=ce,T[me]||(T[me]={}),T[me][z]={},T[me][z].state=i.ALLOW_LOAD,S.getBolaState(z)===void 0&&S.setBolaState(z,te.get().streaming.abr.rules.bolaRule.active&&!le())},reset:function(){P(),b.off(y.default.QUALITY_CHANGE_RENDERED,Te,B),b.off(y.default.METRIC_ADDED,Ce,B),b.off(f.default.LOADING_PROGRESS,X,B),b.off(f.default.VIDEO_ELEMENT_RESIZED,be,B),S&&S.reset()},setConfig:function(z){z&&(z.streamController&&(ie=z.streamController),z.throughputController&&(G=z.throughputController),z.domStorage&&(R=z.domStorage),z.mediaPlayerModel&&(V=z.mediaPlayerModel),z.customParametersModel&&(O=z.customParametersModel),z.cmsdModel&&(I=z.cmsdModel),z.dashMetrics&&(A=z.dashMetrics),z.adapter&&(k=z.adapter),z.videoModel&&(U=z.videoModel),z.settings&&(te=z.settings),z.capabilities&&(x=z.capabilities))},setPlaybackQuality:re,unRegisterStreamType:function(z,ce){try{se[z]&&se[z][ce]&&delete se[z][ce],T[z]&&T[z][ce]&&delete T[z][ce]}catch{}}},$=m.getLogger(B),P(),B}Kt.__dashjs_factory_name="AbrController";const kt=n.default.getSingletonFactory(Kt);n.default.updateSingletonFactory(Kt.__dashjs_factory_name,kt);var Tn,Bn,Jn,gr,dr,mr=kt,jt=function(p){for(var m=[],b=0;b<p.length;++b){var T=p.charCodeAt(b);T<128?m.push(T):T<2048?(m.push(192|T>>6),m.push(128|63&T)):T<65536?(m.push(224|T>>12),m.push(128|63&T>>6),m.push(128|63&T)):(m.push(240|T>>18),m.push(128|63&T>>12),m.push(128|63&T>>6),m.push(128|63&T))}return m},zt=function(p){for(var m=[],b=0;b<p.length;){var T=p[b++];T<128||(T<224?(T=(31&T)<<6,T|=63&p[b++]):T<240?(T=(15&T)<<12,T|=(63&p[b++])<<6,T|=63&p[b++]):(T=(7&T)<<18,T|=(63&p[b++])<<12,T|=(63&p[b++])<<6,T|=63&p[b++])),m.push(String.fromCharCode(T))}return m.join("")},St={};Tn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bn=function(p){for(var m=0,b=[],T=0|p.length/3;0<T--;){var v=(p[m]<<16)+(p[m+1]<<8)+p[m+2];m+=3,b.push(Tn.charAt(63&v>>18)),b.push(Tn.charAt(63&v>>12)),b.push(Tn.charAt(63&v>>6)),b.push(Tn.charAt(63&v))}return p.length-m==2?(v=(p[m]<<16)+(p[m+1]<<8),b.push(Tn.charAt(63&v>>18)),b.push(Tn.charAt(63&v>>12)),b.push(Tn.charAt(63&v>>6)),b.push("=")):p.length-m==1&&(v=p[m]<<16,b.push(Tn.charAt(63&v>>18)),b.push(Tn.charAt(63&v>>12)),b.push("==")),b.join("")},Jn=(function(){for(var p=[],m=0;m<64;++m)p[Tn.charCodeAt(m)]=m;return p[61]=0,p})(),gr=function(p){for(var m=0,b=[],T=0|p.length/4;0<T--;){var v=(Jn[p.charCodeAt(m)]<<18)+(Jn[p.charCodeAt(m+1)]<<12)+(Jn[p.charCodeAt(m+2)]<<6)+Jn[p.charCodeAt(m+3)];b.push(255&v>>16),b.push(255&v>>8),b.push(255&v),m+=4}return b&&(p.charAt(m-2)=="="?(b.pop(),b.pop()):p.charAt(m-1)=="="&&b.pop()),b},dr={encode:function(p){for(var m=[],b=0;b<p.length;++b)m.push(p.charCodeAt(b));return m},decode:function(p){for(var m=0;m<s.length;++m)a[m]=String.fromCharCode(a[m]);return a.join("")}},St.decodeArray=function(p){var m=gr(p);return new Uint8Array(m)},St.encodeASCII=function(p){var m=dr.encode(p);return Bn(m)},St.decodeASCII=function(p){var m=gr(p);return dr.decode(m)},St.encode=function(p){var m=jt(p);return Bn(m)},St.decode=function(p){var m=gr(p);return zt(m)},typeof exports<"u"&&(exports.decode=St.decode,exports.decodeArray=St.decodeArray,exports.encode=St.encode,exports.encodeASCII=St.encodeASCII);var ht=St,qt=t(7393);const Bt=NaN;class Vt{constructor(m,b){this.data={baseUrls:m||null,selectedIdx:b||Bt},this.children=[]}}function en(){let p,m,b,T;const v=this.context,S=(0,qt.default)(v).getInstance();function k(O,A,R){const C=x(R);O[A]?S.areEqual(C,O[A].data.baseUrls)||(O[A].data.baseUrls=C,O[A].data.selectedIdx=Bt):O[A]=new Vt(C)}function x(O){let A=b.getBaseURLsFromElement(O);const R=T.getSynthesizedBaseUrlElements(A);return R&&R.length>0&&R.forEach((C=>{const B=A.findIndex(($=>$.serviceLocation===C.serviceLocation));B!==-1?A[B]=C:A.push(C)})),A}function I(O,A){const R=A||m;O(R.data),R.children&&R.children.forEach((C=>I(O,C)))}function N(){m=new Vt}return p={reset:N,update:function(O){(function(A){(function(){if(!b||!b.hasOwnProperty("getBaseURLsFromElement")||!b.hasOwnProperty("getRepresentationSortFunction"))throw new Error("setConfig function has to be called previously")})();const R=x(A);S.areEqual(R,m.data.baseUrls)||(m.data.baseUrls=R,m.data.selectedIdx=Bt),A&&A.Period&&A.Period.forEach(((C,B)=>{k(m.children,B,C),C.AdaptationSet&&C.AdaptationSet.forEach((($,V)=>{k(m.children[B].children,V,$),$.Representation&&$.Representation.sort(b.getRepresentationSortFunction()).forEach(((j,te)=>{k(m.children[B].children[V].children,te,j)}))}))}))})(O)},getForPath:function(O){let A=m;const R=[A.data];return O&&O.forEach((C=>{A=A.children[C],A&&R.push(A.data)})),R.filter((C=>C.baseUrls.length))},invalidateSelectedIndexes:function(O){I((A=>{isNaN(A.selectedIdx)||O===A.baseUrls[A.selectedIdx].serviceLocation&&(A.selectedIdx=Bt)}))},setConfig:function(O){O.adapter&&(b=O.adapter),O.contentSteeringController&&(T=O.contentSteeringController)},getBaseUrls:function(O){return x(O)}},N(),p}en.__dashjs_factory_name="BaseURLTreeModel";var wt=n.default.getClassFactory(en),Rt=t(8748);class Ht extends Rt.default{constructor(){super(),this.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE=10,this.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE=11,this.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE=12,this.SEGMENT_BASE_LOADER_ERROR_CODE=15,this.TIME_SYNC_FAILED_ERROR_CODE=16,this.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE=17,this.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE=18,this.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE=19,this.APPEND_ERROR_CODE=20,this.REMOVE_ERROR_CODE=21,this.DATA_UPDATE_FAILED_ERROR_CODE=22,this.CAPABILITY_MEDIASOURCE_ERROR_CODE=23,this.CAPABILITY_MEDIAKEYS_ERROR_CODE=24,this.DOWNLOAD_ERROR_ID_MANIFEST_CODE=25,this.DOWNLOAD_ERROR_ID_SIDX_CODE=26,this.DOWNLOAD_ERROR_ID_CONTENT_CODE=27,this.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE=28,this.DOWNLOAD_ERROR_ID_XLINK_CODE=29,this.MANIFEST_ERROR_ID_PARSE_CODE=31,this.MANIFEST_ERROR_ID_NOSTREAMS_CODE=32,this.TIMED_TEXT_ERROR_ID_PARSE_CODE=33,this.MANIFEST_ERROR_ID_MULTIPLEXED_CODE=34,this.MEDIASOURCE_TYPE_UNSUPPORTED_CODE=35,this.NO_SUPPORTED_KEY_IDS=36,this.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE="parsing failed for ",this.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading manifest: ",this.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading Xlink element: ",this.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE="Segments update failed",this.SEGMENTS_UNAVAILABLE_ERROR_MESSAGE="no segments are available yet",this.SEGMENT_BASE_LOADER_ERROR_MESSAGE="error loading segment ranges from sidx",this.TIME_SYNC_FAILED_ERROR_MESSAGE="Failed to synchronize client and server time",this.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE="request is null",this.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE="Failed to resolve a valid URL",this.APPEND_ERROR_MESSAGE="chunk is not defined",this.REMOVE_ERROR_MESSAGE="Removing data from the SourceBuffer",this.DATA_UPDATE_FAILED_ERROR_MESSAGE="Data update failed",this.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE="mediasource is not supported",this.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE="mediakeys is not supported",this.TIMED_TEXT_ERROR_MESSAGE_PARSE="parsing error :",this.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE="Error creating source buffer of type : ",this.NO_SUPPORTED_KEY_IDS_MESSAGE="All possible Adaptation Sets have an invalid key status"}}var Jt=new Ht;function Pt(p){let m;p=p||{};let b=[];const T=(0,g.default)(this.context).getInstance(),v=p.updateEventName,S=p.addBlacklistEventName;function k(I){b.indexOf(I)===-1&&(b.push(I),T.trigger(v,{entry:I}))}function x(I){k(I.entry)}return m={add:k,remove:function(I){const N=b.indexOf(I);N!==-1&&b.splice(N,1)},contains:function(I){return!!(b.length&&I&&I.length)&&b.indexOf(I)!==-1},reset:function(){S&&T.off(S,x,m),b=[]}},S&&T.on(S,x,m),m}Pt.__dashjs_factory_name="BlackListController";var sn=n.default.getClassFactory(Pt);function An(p){let m;const b=(p=p||{}).blacklistController;return m={select:function(T){return T&&(function(v){let S,k,x=0,I=[],N=0;if(k=v.sort((function(O,A){let R=O.dvbPriority-A.dvbPriority;return isNaN(R)?0:R})).filter((function(O,A,R){return!A||R[0].dvbPriority&&O.dvbPriority&&R[0].dvbPriority===O.dvbPriority})),k.length)return k.length>1&&(k.forEach((O=>{x+=O.dvbWeight,I.push(x)})),S=Math.floor(Math.random()*(x-1)),I.every(((O,A)=>(N=A,!(S<O))))),k[N]})((function(v){let S=[];return v.filter((function(k){return!b.contains(k.serviceLocation)||(k.dvbPriority&&S.push(k.dvbPriority),!1)})).filter((function(k){return!S.length||!k.dvbPriority||S.indexOf(k.dvbPriority)===-1}))})(T))}},m}An.__dashjs_factory_name="DVBSelector";var gn=n.default.getClassFactory(An);function pn(p){let m;const b=(p=p||{}).blacklistController;return m={select:function(T){let v,S=0;return T&&T.some(((k,x)=>(S=x,!b.contains(k.serviceLocation))))&&(v=T[S]),v}},m}pn.__dashjs_factory_name="BasicSelector";var Nn=n.default.getClassFactory(pn),Wt=t(1944),gt=t(656),Je=t(7263);function $t(){let p,m;function b(){m&&(m.onloadend=m.onerror=m.onprogress=m.onload=null,m.abort(),m=null)}return p={load:function(T,v){if(m=null,m=new XMLHttpRequest,m.open(T.method,T.url,!0),T.responseType&&(m.responseType=T.responseType),T.headers)for(let S in T.headers){let k=T.headers[S];k&&m.setRequestHeader(S,k)}return m.withCredentials=T.credentials==="include",m.timeout=T.timeout,m.onload=function(){v.url=this.responseURL,v.status=this.status,v.statusText=this.statusText,v.headers=Je.default.parseHttpHeaders(this.getAllResponseHeaders()),v.data=this.response},T.customData&&(m.onloadend=T.customData.onloadend,m.onprogress=T.customData.onprogress,m.onabort=T.customData.onabort,m.ontimeout=T.customData.ontimeout),m.send(),T.customData.abort=b.bind(this),!0},abort:b,getXhr:function(){return m},reset:function(){b(),p=null},resetInitialSettings:function(){b()}},p}$t.__dashjs_factory_name="XHRLoader";var tn=n.default.getClassFactory($t);function bn(){const p=this.context,m=(0,l.default)(p).getInstance();let b,T,v;function S(A,R,C){A.customData.reader.read().then(C).catch((function(){k(A)}))}function k(A){A.customData.onloadend&&A.customData.onloadend()}function x(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function I(){if(this.customData.abortController)this.customData.abortController.abort();else if(this.customData.reader)try{this.customData.reader.cancel(),this.onabort()}catch{}}function N(A,R){try{if((A=A.filter((C=>C.bytes>R/4/A.length))).length>1){let C=0;const B=(A[A.length-1].timestamp-A[0].timestamp)/A.length;return A.forEach((($,V)=>{const j=A[V+1];if(j){const te=j.timestamp-$.timestamp;C+=te<B?te:0}})),C}return null}catch{return null}}function O(A,R){return 8*A/R}return v=(0,o.default)(p).getInstance().getLogger(b),b={abort:I,calculateDownloadedTime:N,load:function(A,R){const C=(function(V){const j=new Headers;if(V.headers)for(let te in V.headers){let ie=V.headers[te];ie&&j.append(te,ie)}return j})(A),B=(function(V){let j;return typeof window.AbortController=="function"&&(j=new AbortController,V.customData.abortController=j,j.signal.onabort=V.customData.onabort),V.customData.abort=I.bind(V),j})(A),$=(function(V,j,te){return new Request(V.url,{method:V.method,headers:j,credentials:V.credentials,signal:te?te.signal:void 0})})(A,C,B);fetch($).then((V=>{(function(j,te,ie){(function(Te,Ce){Te.status=Ce.status,Te.statusText=Ce.statusText,Te.url=Ce.url;const Ie={};for(const q of Ce.headers.keys())Ie[q]=Ce.headers.get(q);Te.headers=Ie})(ie,j),j.ok||te.customData.onloadend();let se=0,de=!1,G=new Uint8Array,U=0;te.customData.reader=j.body.getReader();let P=[],M=[],ge=[],X=!0;const be=m.get().streaming.abr.throughput.lowLatencyDownloadTimeCalculationMode,fe=({value:Te,done:Ce})=>{Ce?(function(){if(G){const Ie=(function(){let q=null;return be===h.default.LOW_LATENCY_DOWNLOAD_TIME_CALCULATION_MODE.MOOF_PARSING?q=(function(){const W=(function(re,ee){try{let ne,le;if(ne=re.slice(0,-1),le=ee.slice(0,-1),ne.length!==le.length&&v.warn(`[FetchLoader] Moof and Mdat data arrays have different lengths. Moof: ${ne.length}, Mdat: ${le.length}`),ne.length<=1)return null;let z=[],ce=0,me=0;for(let Se=0;Se<ne.length;Se++)if(ne[Se]&&le[Se]){let Re=le[Se].timestamp-ne[Se].timestamp;if(Re>1){const we=O(le[Se].bytes,Re);z.push(we),me=0}else{me===0&&(me=ne[Se].timestamp,ce=0);let we=le[Se].timestamp-me;if(we>1){ce+=le[Se].bytes;const ze=O(ce,we);z.push(ze),me=0}else ce+=le[Se].bytes}}return z.length>0?z.reduce(((Se,Re)=>Se+Re),0)/z.length:null}catch{return null}})(M,ge);return W?8*se/W:null})():be===h.default.LOW_LATENCY_DOWNLOAD_TIME_CALCULATION_MODE.DOWNLOADED_DATA&&(q=N(P,se)),q})();te.customData.onprogress({loaded:se,total:se,lengthComputable:!0,time:Ie}),ie.data=G.buffer}te.customData.onloadend()})():(Te&&Te.length>0&&(function(Ie){G=(function(W,re){if(W.length===0)return re;const ee=new Uint8Array(W.length+re.length);return ee.set(W),ee.set(re,W.length),ee})(G,Ie),se+=Ie.length,P.push({timestamp:x(),bytes:Ie.length}),be===h.default.LOW_LATENCY_DOWNLOAD_TIME_CALCULATION_MODE.MOOF_PARSING&&X&&T.findLastTopIsoBoxCompleted(["moof"],G,U).found&&(X=!1,M.push({timestamp:x()}));const q=T.findLastTopIsoBoxCompleted(["moov","mdat"],G,U);q.found?(function(W){const re=(function(ee){let ne;return ee===G.length?(ne=G,G=new Uint8Array):(ne=new Uint8Array(G.subarray(0,ee)),G=G.subarray(ee)),ne})(W.startOffsetOfLastFoundTargetBox+W.sizeOfLastFoundTargetBox);be!==h.default.LOW_LATENCY_DOWNLOAD_TIME_CALCULATION_MODE.MOOF_PARSING||X||(X=!0,ge.push({timestamp:x(),bytes:re.length})),te.customData.onprogress({data:re.buffer,lengthComputable:!1,noTrace:!0}),U=0})(q):(function(W){U=W.startOffsetOfLastCompletedBox+W.sizeOfLastCompletedBox,de||(te.customData.onprogress({lengthComputable:!1,noTrace:!0}),de=!0)})(q)})(Te),S(te,0,fe))};S(te,0,fe)})(V,A,R)})).catch((()=>{k(A)}))},reset:function(){},setConfig:function(A){T=A.boxParser}},b}bn.__dashjs_factory_name="FetchLoader";var Mn=n.default.getClassFactory(bn),$n=t(913),fr=class{constructor(){this.period=null,this.index=-1,this.id=null,this.type=null}};class Hn{constructor(m,b,T,v){this.url=m||"",this.serviceLocation=b||m||"",this.dvbPriority=T||1,this.dvbWeight=v||1,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0,this.queryParams={}}}Hn.DEFAULT_DVB_PRIORITY=1,Hn.DEFAULT_DVB_WEIGHT=1;var ar=Hn,ye=t(8854),hr=class{constructor(){this.schemeIdUri=null,this.value=null,this.id=null}init(p){p&&(this.schemeIdUri=p.schemeIdUri?p.schemeIdUri:null,this.value=p.value!==null&&p.value!==void 0?p.value.toString():null,this.id=p.id?p.id:null,p[ye.default.DVB_URL]&&(this.dvbUrl=p[ye.default.DVB_URL]),p[ye.default.DVB_MIMETYPE]&&(this.dvbMimeType=p[ye.default.DVB_MIMETYPE]),p[ye.default.DVB_FONTFAMILY]&&(this.dvbFontFamily=p[ye.default.DVB_FONTFAMILY]))}inArray(p){return!!p&&p.some((m=>this.schemeIdUri===m.schemeIdUri&&(this.value?this.value.toString().match(m.value):"".match(m.value))))}},Gr=class extends hr{constructor(){super(),this.version=null,this.sessionID=null,this.contentID=null,this.mode=null,this.keys=null,this.includeInRequests=null}init(p){super.init(p),p&&(this.version=p.version,this.sessionID=p.sessionID,this.contentID=p.contentID,this.mode=p.mode??"query",this.keys=p.keys?p.keys.split(" "):null,this.includeInRequests=p.includeInRequests?p.includeInRequests.split(" "):["segment"],this.schemeIdUri=p.schemeIdUri)}},Si=class{constructor(){this.adaptationSets=null,this.adaptationSetsArray=[],this.cmcdParameters=null,this.serviceLocations=null,this.serviceLocationsArray=[]}},xr=class extends hr{constructor(){super(),this.ref=null,this.refId=null,this.robustness=null,this.keyId=null,this.cencDefaultKid=null,this.pssh=null,this.pro=null,this.laUrl=null}init(p){super.init(p),p&&(this.ref=p.hasOwnProperty(ye.default.REF)?p[ye.default.REF]:null,this.refId=p.hasOwnProperty(ye.default.REF_ID)?p[ye.default.REF_ID]:null,this.robustness=p.hasOwnProperty(ye.default.ROBUSTNESS)?p[ye.default.ROBUSTNESS]:null,this.cencDefaultKid=p.hasOwnProperty(ye.default.CENC_DEFAULT_KID)?p[ye.default.CENC_DEFAULT_KID]:null,this.pssh=p.hasOwnProperty(ye.default.PSSH)?p[ye.default.PSSH]:null,this.pro=p.hasOwnProperty(ye.default.PRO)?p[ye.default.PRO]:null,this.laUrl=p.hasOwnProperty(ye.default.LA_URL)?p[ye.default.LA_URL]:p.hasOwnProperty(ye.default.LA_URL_LOWER_CASE)?p[ye.default.LA_URL_LOWER_CASE]:null)}mergeAttributesFromReference(p){["schemeIdUri","value","id","robustness","cencDefaultKid","pro","pssh","laUrl"].forEach((m=>{this[m]===null&&(this[m]=p[m])}))}},Wi=class{constructor(){this.defaultServiceLocation=null,this.defaultServiceLocationArray=[],this.queryBeforeStart=!1,this.serverUrl=null,this.clientRequirement=!0}},wr=class{constructor(){this.type="",this.duration=NaN,this.presentationTime=NaN,this.id=NaN,this.messageData="",this.eventStream=null,this.presentationTimeDelta=NaN,this.parsedMessageData=null}},Na=class{constructor(){this.adaptionSet=null,this.representation=null,this.period=null,this.timescale=1,this.value="",this.schemeIdUri="",this.presentationTimeOffset=0}},ss=class{constructor(){this.availabilityEndTime=Number.POSITIVE_INFINITY,this.availabilityStartTime=null,this.manifest=null,this.maxSegmentDuration=Number.POSITIVE_INFINITY,this.mediaPresentationDuration=NaN,this.minimumUpdatePeriod=NaN,this.publishTime=null,this.suggestedPresentationDelay=0,this.timeShiftBufferDepth=Number.POSITIVE_INFINITY}},Ma=class{constructor(p,m){this.url=p||"",this.serviceLocation=m||null,this.queryParams={}}},os=class{constructor(p,m,b){this.url=p||"",this.serviceLocation=m||null,this.ttl=b||NaN,this.queryParams={}}};class Oa{constructor(){this.id=null,this.index=-1,this.duration=NaN,this.start=NaN,this.mpd=null,this.nextPeriodId=null,this.isEncrypted=!1}}Oa.DEFAULT_ID="defaultId";var Pi=Oa,ls=class{constructor(){this.period=null,this.index=-1,this.id=1,this.type=null,this.tag=null,this.order="undefined",this.preselectionComponents=[]}},Nt=class{constructor(){this.id=null,this.inband=!1,this.type="encoder",this.applicationScheme=null,this.wallClockTime=null,this.presentationTime=NaN,this.UTCTiming=null}},rn=class{constructor(){this.absoluteIndex=NaN,this.adaptation=null,this.availabilityTimeComplete=!0,this.availabilityTimeOffset=0,this.bandwidth=NaN,this.bitrateInKbit=NaN,this.bitsPerPixel=NaN,this.codecFamily=null,this.codecPrivateData=null,this.codecs=null,this.dependencyId=null,this.dependentRepresentation=null,this.endNumber=null,this.essentialProperties=[],this.fragmentDuration=null,this.frameRate=null,this.height=NaN,this.id=null,this.indexRange=null,this.initialization=null,this.maxPlayoutRate=NaN,this.mediaFinishedInformation={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN},this.mediaInfo=null,this.mimeType=null,this.mseTimeOffset=NaN,this.pixelsPerSecond=NaN,this.presentationTimeOffset=0,this.qualityRanking=NaN,this.range=null,this.scanType=null,this.segments=null,this.segmentDuration=NaN,this.segmentInfoType=null,this.segmentSequenceProperties=[],this.supplementalProperties=[],this.startNumber=1,this.timescale=1,this.width=NaN}hasInitialization(){return this.initialization!==null||this.range!==null}hasSegments(){return this.segmentInfoType!==ye.default.BASE_URL&&this.segmentInfoType!==ye.default.SEGMENT_BASE&&!this.indexRange}};function yn(){let p;const m=/^[a-z][a-z0-9+\-_.]*:/i,b=/^https?:\/\//i,T=/^https:\/\//i,v=/^([a-z][a-z0-9+\-_.]*:\/\/[^\/]+)\/?/i,S=(C,B)=>{try{return new window.URL(C,B).toString()}catch{return C}},k=(C,B)=>{let $=x;if(!B||!O(C))return C;A(C)&&($=I),R(C)&&($=N);const V=$(B),j=V.charAt(V.length-1)!=="/"&&C.charAt(0)!=="/"?"/":"";return[V,C].join(j)};function x(C){const B=C.indexOf("/"),$=C.lastIndexOf("/");return B!==-1?$===B+1?C:(C.indexOf("?")!==-1&&(C=C.substring(0,C.indexOf("?"))),C.substring(0,$+1)):""}function I(C){const B=C.match(v);return B?B[1]:""}function N(C){const B=C.match(m);return B?B[0]:""}function O(C){return!m.test(C)}function A(C){return O(C)&&C.charAt(0)==="/"}function R(C){return C.indexOf("//")===0}return(function(){try{new window.URL("x","http://y"),p=S}catch{}finally{p=p||k}})(),{parseBaseUrl:x,parseOrigin:I,parseScheme:N,isRelative:O,isPathAbsolute:A,isSchemeRelative:R,isHTTPURL:function(C){return b.test(C)},isHTTPS:function(C){return T.test(C)},removeHostname:function(C){return/^(?:\w+\:\/\/)?([^\/]+)(.*)$/.exec(C)[2].substring(1)},resolve:function(C,B){return p(C,B)}}}yn.__dashjs_factory_name="DefaultURLUtils";var Pn=n.default.getSingletonFactory(yn);function Ln(){let p,m,b=[];const T=this.context;function v(S,k,x){let I=(function(N){let O;for(O=0;O<b.length;O++)if(b[O].regex.test(N))return b[O].utils;return m})(x||k);return I&&typeof I[S]=="function"?I[S](k,x):m[S](k,x)}return m=Pn(T).getInstance(),p={registerUrlRegex:function(S,k){b.push({regex:S,utils:k})},parseBaseUrl:function(S){return v("parseBaseUrl",S)},parseOrigin:function(S){return v("parseOrigin",S)},parseScheme:function(S){return v("parseScheme",S)},isRelative:function(S){return v("isRelative",S)},isPathAbsolute:function(S){return v("isPathAbsolute",S)},isSchemeRelative:function(S){return v("isSchemeRelative",S)},isHTTPURL:function(S){return v("isHTTPURL",S)},isHTTPS:function(S){return v("isHTTPS",S)},removeHostname:function(S){return v("removeHostname",S)},resolve:function(S,k){return v("resolve",S,k)}},p}Ln.__dashjs_factory_name="URLUtils";var Vn=n.default.getSingletonFactory(Ln),er=t(5717),qn=class{constructor(){this.cadence=1,this.sapType=0,this.event=!0,this.alignment=null}init(p){p&&(this.cadence=p.cadence===void 0||isNaN(p.cadence)?1:p.cadence,this.sapType=p.sapType===void 0||isNaN(p.sapType)?0:p.sapType,this.event=p.event===void 0||p.event,this.alignment=p.alignment!==void 0?p.alignment:null)}};function jn(){let p,m,b,T;const v=this.context,S=Vn(v).getInstance(),k=Number.isInteger||function(q){return typeof q=="number"&&isFinite(q)&&Math.floor(q)===q};function x(q,W){if(!q)throw new Error("adaptation is not defined");if(!W)throw new Error("type is not defined");if(q.Representation&&q.Representation.length){const ee=de(q.Representation[0]);if(ee&&ee.some((ne=>h.default.THUMBNAILS_SCHEME_ID_URIS.indexOf(ne.schemeIdUri)>=0)))return W===h.default.IMAGE}if(q.ContentComponent&&q.ContentComponent.length>0){if(q.ContentComponent.length>1)return W===h.default.MUXED;if(q.ContentComponent[0].contentType===W)return!0}const re=W===h.default.TEXT?new RegExp("(ttml|vtt|wvtt|stpp)"):new RegExp(W);if(q.Representation&&q.Representation.length){const ee=q.Representation[0].codecs;if(re.test(ee))return!0}if(q.hasOwnProperty(ye.default.MIME_TYPE))return re.test(q.mimeType);if(q.Representation){let ee;for(let ne=0;ne<q.Representation.length;ne++)if(ee=q.Representation[ne],ee.hasOwnProperty(ye.default.MIME_TYPE))return re.test(ee.mimeType)}return!1}function I(q){if(!q)throw new Error("adaptation is not defined");if(q.hasOwnProperty(ye.default.SEGMENT_TEMPLATE)||q.hasOwnProperty(ye.default.SEGMENT_TIMELINE)||q.hasOwnProperty(ye.default.SEGMENT_LIST)||q.hasOwnProperty(ye.default.SEGMENT_BASE))return!0;if(q.Representation&&q.Representation.length>0){const W=q.Representation[0];if(W.hasOwnProperty(ye.default.SEGMENT_TEMPLATE)||W.hasOwnProperty(ye.default.SEGMENT_TIMELINE)||W.hasOwnProperty(ye.default.SEGMENT_LIST)||W.hasOwnProperty(ye.default.SEGMENT_BASE))return!0}return!1}function N(q){return x(q,h.default.TEXT)}function O(q){return q&&q.Representation&&q.Representation.sort(((W,re)=>W.bandwidth-re.bandwidth)),q}function A(q,W){return q&&q.Period&&k(W)&&q.Period[W]?q.Period[W].AdaptationSet:[]}function R(q){return q&&q.Period?q.Period:[]}function C(q,W,re){let ee=null;if(q&&q.Representation&&q.Representation.length>0){const ne=k(W)&&W>=0&&W<q.Representation.length?q.Representation[W]:q.Representation[0];ne&&(ee=ne.mimeType+';codecs="'+ne.codecs+'"',re&&ne.width!==void 0&&(ee+=';width="'+ne.width+'";height="'+ne.height+'"'))}return ee&&(ee=ee.replace(/\sprofiles=[^;]*/g,"")),ee}function B(q){const W=$(q);return W&&W.length>0}function $(q){let W=[];if(!q)return W;const re=V(q);return W=W.concat(re),q.hasOwnProperty(ye.default.ADAPTATION_SET)&&q[ye.default.ADAPTATION_SET].length>0&&q[ye.default.ADAPTATION_SET].forEach((ee=>{const ne=V(ee);W=W.concat(ne)})),W}function V(q){return q&&q.hasOwnProperty(ye.default.CONTENT_PROTECTION)&&q.ContentProtection.length!==0?q[ye.default.CONTENT_PROTECTION].map((W=>{const re=new xr;return re.init(W),re})):[]}function j(q){let W=!1;return q&&q.hasOwnProperty("type")&&(W=q.type===ye.default.DYNAMIC),W}function te(q){if(!q)return null;const W=q[ye.default.FRAMERATE];if(!W)return null;if(typeof W=="string"&&W.includes("/")){const[re,ee]=W.split("/").map((ne=>parseInt(ne,10)));if(!isNaN(re)&&!isNaN(ee)&&ee!==0)return re/ee}return parseInt(W)}function ie(q,W){return W&&W.hasOwnProperty(q)&&W[q].length?W[q].map((re=>{const ee=new hr;return ee.init(re),ee})):[]}function se(q,W){if(!W)return[];let re=(function(ee,ne){if(!ne||!ne.length)return[];let le=ne[0][ee]||[];return le.length===0?[]:ne.length===1?le:le.filter((z=>ne.slice(1).every((ce=>ce.hasOwnProperty(ee)&&ce[ee].some((me=>me.schemeIdUri===z.schemeIdUri&&me.value===z.value))))))})(q,W[ye.default.REPRESENTATION]);return W.hasOwnProperty(q)&&W[q].length&&re.push(...W[q]),re.map((ee=>{const ne=new hr;return ne.init(ee),ne}))}function de(q){return ie(ye.default.ESSENTIAL_PROPERTY,q)}function G(q){return ie(ye.default.SUPPLEMENTAL_PROPERTY,q)}function U(q){return q&&q.hasOwnProperty(ye.default.SEGMENT_SEQUENCE_PROPERTIES)&&q[ye.default.SEGMENT_SEQUENCE_PROPERTIES].length?q[ye.default.SEGMENT_SEQUENCE_PROPERTIES].map((W=>{const re=new qn(W);return re.init(W),re})):[]}function P(q,W,re,ee,ne,le){const z=new rn;(function(Se,Re,we,ze,Ye){if(Se.index=Ye,Se.adaptation=we,Se.mediaInfo=ze,Re.hasOwnProperty(ye.default.ID)&&(Se.id=Re.id),Re.hasOwnProperty(ye.default.CODECS)&&(Se.codecs=Re.codecs,Se.codecFamily=Je.default.getCodecFamily(Se.codecs)),Re.hasOwnProperty(ye.default.DEPENDENCY_ID)){const ct=Re[ye.default.DEPENDENCY_ID].toString().split(" ")[0];Se.dependencyId=ct,Se.dependentRepresentation=new rn,Se.dependentRepresentation.id=ct}Re.hasOwnProperty(ye.default.MIME_TYPE)&&(Se.mimeType=Re[ye.default.MIME_TYPE]),Re.hasOwnProperty(ye.default.CODEC_PRIVATE_DATA)&&(Se.codecPrivateData=Re.codecPrivateData),Re.hasOwnProperty(ye.default.BANDWITH)&&(Se.bandwidth=Re.bandwidth,Se.bitrateInKbit=Re.bandwidth/1e3),Re.hasOwnProperty(ye.default.WIDTH)&&(Se.width=Re.width),Re.hasOwnProperty(ye.default.HEIGHT)&&(Se.height=Re.height),Re.hasOwnProperty(ye.default.SCAN_TYPE)&&(Se.scanType=Re.scanType),Re.hasOwnProperty(ye.default.FRAMERATE)&&(Se.frameRate=te(Re)),Re.hasOwnProperty(ye.default.QUALITY_RANKING)&&(Se.qualityRanking=Re[ye.default.QUALITY_RANKING]),Re.hasOwnProperty(ye.default.MAX_PLAYOUT_RATE)&&(Se.maxPlayoutRate=Re.maxPlayoutRate),Se.essentialProperties=de(Re),Se.supplementalProperties=G(Re),Se.segmentSequenceProperties=U(Re),Se.path=[we.period.index,we.index,Ye]})(z,W,re,q,le);const{segmentInfo:ce,segmentInfoType:me}=(function(Se){let Re,we;return Se.hasOwnProperty(ye.default.SEGMENT_BASE)?(Re=Se.SegmentBase,we=ye.default.SEGMENT_BASE):Se.hasOwnProperty(ye.default.SEGMENT_LIST)?(Re=Se.SegmentList,we=Re.hasOwnProperty(ye.default.SEGMENT_TIMELINE)?ye.default.SEGMENT_TIMELINE:ye.default.SEGMENT_LIST):Se.hasOwnProperty(ye.default.SEGMENT_TEMPLATE)?(Re=Se.SegmentTemplate,we=Re.hasOwnProperty(ye.default.SEGMENT_TIMELINE)?ye.default.SEGMENT_TIMELINE:ye.default.SEGMENT_TEMPLATE):we=ye.default.BASE_URL,{segmentInfo:Re,segmentInfoType:we}})(W);return z.segmentInfoType=me,(function(Se,Re,we,ze,Ye,ct){if(Se){if(Se.hasOwnProperty(ye.default.INITIALIZATION_MINUS)&&(we.initialization=Se.initialization.split("$Bandwidth$").join(Ye.bandwidth).split("$RepresentationID$").join(Ye.id)),Se.hasOwnProperty(ye.default.INITIALIZATION)){const bt=Se.Initialization;bt.hasOwnProperty(ye.default.SOURCE_URL)&&(we.initialization=bt.sourceURL),bt.hasOwnProperty(ye.default.RANGE)&&(we.range=bt.range)}else N(ze)&&I(ze)&&ze.mimeType&&ze.mimeType.indexOf("application/mp4")===-1&&(we.range=0);Se.hasOwnProperty(ye.default.TIMESCALE)&&(we.timescale=Se.timescale),Se.hasOwnProperty(ye.default.DURATION)?we.segmentDuration=Se.duration/we.timescale:Re===ye.default.SEGMENT_TIMELINE&&(we.segmentDuration=(function(bt){if(!bt||!bt.S)return NaN;let Zt=bt.S[0],vt=bt.S[1];return Zt.hasOwnProperty("d")?Zt.d:vt.t-Zt.t})(Se.SegmentTimeline)/we.timescale),Se.hasOwnProperty(ye.default.MEDIA)&&(we.media=Se.media),Se.hasOwnProperty(ye.default.START_NUMBER)&&(we.startNumber=parseInt(Se.startNumber)),Se.hasOwnProperty(ye.default.INDEX_RANGE)&&(we.indexRange=Se.indexRange),Se.hasOwnProperty(ye.default.PRESENTATION_TIME_OFFSET)&&(we.presentationTimeOffset=Se.presentationTimeOffset/we.timescale),Se.hasOwnProperty(ye.default.AVAILABILITY_TIME_OFFSET)?we.availabilityTimeOffset=Se.availabilityTimeOffset:ct&&ct.availabilityTimeOffset!==void 0&&(we.availabilityTimeOffset=ct.availabilityTimeOffset),Se.hasOwnProperty(ye.default.AVAILABILITY_TIME_COMPLETE)?we.availabilityTimeComplete=Se.availabilityTimeComplete!=="false":ct&&ct.availabilityTimeComplete!==void 0&&(we.availabilityTimeComplete=ct.availabilityTimeComplete),Se.hasOwnProperty(ye.default.END_NUMBER)&&(we.endNumber=Se[ye.default.END_NUMBER]),we.mseTimeOffset=(function(bt){const Zt=bt.presentationTimeOffset;return bt.adaptation.period.start-Zt})(we)}})(ce,me,z,ee,W,ne),(function(Se){isNaN(Se.width)||isNaN(Se.height)||isNaN(Se.frameRate)||(Se.pixelsPerSecond=Math.max(1,Se.width*Se.height*Se.frameRate),isNaN(Se.bandwidth)||(Se.bitsPerPixel=Se.bandwidth/Se.pixelsPerSecond))})(z),z}function M(q){return x(q,h.default.MUXED)?h.default.MUXED:x(q,h.default.AUDIO)?h.default.AUDIO:(function(W){return x(W,h.default.VIDEO)})(q)?h.default.VIDEO:N(q)?h.default.TEXT:(function(W){return x(W,h.default.IMAGE)})(q)?h.default.IMAGE:(m.warn("Unknown Preselection stream type"),null)}function ge(q,W){if(q&&q.hasOwnProperty(ye.default.PRESELECTION_COMPONENTS)&&Array.isArray(W))return String(q.preselectionComponents).split(" ").map((re=>W.find((ee=>ee.id===re))))}function X(q,W){if(!q||!q.hasOwnProperty(ye.default.PRESELECTION_COMPONENTS)||!Array.isArray(W))return;const re=String(q.preselectionComponents).split(" ");return W.find((ee=>ee.id===re[0]))}function be(q,W){if(!q)throw new Error("Period cannot be null or undefined");let re=Pi.DEFAULT_ID+"_"+W;return q.hasOwnProperty(ye.default.ID)&&q.id.toString().length>0&&q.id!=="__proto__"&&(re=q.id.toString()),re}function fe(q,W,re){const ee=[];let ne;if(!q)return ee;for(ne=0;ne<q.length;ne++){const le=new Na;if(le.timescale=1,le.representation=W,!q[ne].hasOwnProperty(h.default.SCHEME_ID_URI))throw new Error("Invalid EventStream. SchemeIdUri has to be set");le.schemeIdUri=q[ne].schemeIdUri,q[ne].hasOwnProperty(ye.default.TIMESCALE)&&(le.timescale=q[ne].timescale),q[ne].hasOwnProperty(ye.default.VALUE)&&(le.value=q[ne].value),ee.push(le),le.period=re}return ee}function Te(q){const W=[],re=q.BaseURL||[q.baseUri];let ee=!1;return re.some((ne=>{if(ne){const le=new ar;let z=ne.__text||ne;return S.isRelative(z)&&(ee=!0,q.baseUri&&(z=S.resolve(z,q.baseUri))),le.url=z,ne.hasOwnProperty(ye.default.SERVICE_LOCATION)&&ne.serviceLocation.length?le.serviceLocation=ne.serviceLocation:le.serviceLocation=z,ne.hasOwnProperty(ye.default.DVB_PRIORITY)&&(le.dvbPriority=ne[ye.default.DVB_PRIORITY]),ne.hasOwnProperty(ye.default.DVB_WEIGHT)&&(le.dvbWeight=ne[ye.default.DVB_WEIGHT]),ne.hasOwnProperty(ye.default.AVAILABILITY_TIME_OFFSET)&&(le.availabilityTimeOffset=ne[ye.default.AVAILABILITY_TIME_OFFSET]),ne.hasOwnProperty(ye.default.AVAILABILITY_TIME_COMPLETE)&&(le.availabilityTimeComplete=ne[ye.default.AVAILABILITY_TIME_COMPLETE]!=="false"),W.push(le),ee}})),W}function Ce(q){const W=new Wi;return W.serverUrl=q.__text,q.hasOwnProperty(ye.default.DEFAULT_SERVICE_LOCATION)&&(W.defaultServiceLocation=q[ye.default.DEFAULT_SERVICE_LOCATION],W.defaultServiceLocationArray=W.defaultServiceLocation.split(" ")),q.hasOwnProperty(ye.default.QUERY_BEFORE_START)&&(W.queryBeforeStart=q[ye.default.QUERY_BEFORE_START].toLowerCase()==="true"),q.hasOwnProperty(ye.default.CLIENT_REQUIREMENT)&&(W.clientRequirement=q[ye.default.CLIENT_REQUIREMENT].toLowerCase()!=="false"),W}function Ie(q){const W=new Si;return q.hasOwnProperty(ye.default.CMCD_PARAMETERS)&&q[ye.default.CMCD_PARAMETERS].schemeIdUri===h.default.CTA_5004_2023_SCHEME&&(W.cmcdParameters=new Gr,W.cmcdParameters.init(q[ye.default.CMCD_PARAMETERS])),q.hasOwnProperty(ye.default.SERVICE_LOCATIONS)&&q[ye.default.SERVICE_LOCATIONS]!==""&&(W.serviceLocations=q[ye.default.SERVICE_LOCATIONS],W.serviceLocationsArray=W.serviceLocations.toString().split(" ")),q.hasOwnProperty(ye.default.ADAPTATION_SETS)&&q[ye.default.ADAPTATION_SETS]!==""&&(W.adaptationSets=q[ye.default.ADAPTATION_SETS],W.adaptationSetsArray=W.adaptationSets.toString().split(" ")),W}return p={getAccessibilityForAdaptation:function(q){return q&&q.hasOwnProperty(ye.default.ACCESSIBILITY)&&q[ye.default.ACCESSIBILITY].length?q[ye.default.ACCESSIBILITY].map((W=>{const re=new hr;return re.init(W),re})):[]},getAdaptationForId:function(q,W,re){const ee=A(W,re);let ne,le;for(ne=0,le=ee.length;ne<le;ne++)if(ee[ne].hasOwnProperty(ye.default.ID)&&ee[ne].id===q)return ee[ne];return null},getAdaptationForIndex:function(q,W,re){const ee=A(W,re);return ee.length>0&&k(q)?ee[q]:null},getAdaptationsForPeriod:function(q){const W=q&&k(q.index)?q.mpd.manifest.Period[q.index]:null,re=[];let ee,ne,le;if(W&&W.AdaptationSet)for(le=0;le<W.AdaptationSet.length;le++)ne=W.AdaptationSet[le],ee=new fr,ne.hasOwnProperty(ye.default.ID)&&(ee.id=ne.id),ee.index=le,ee.period=q,ee.type=M(ne),re.push(ee);return re},getAdaptationsForType:function(q,W,re){const ee=A(q,W);let ne,le;const z=[];for(ne=0,le=ee.length;ne<le;ne++)x(ee[ne],re)&&z.push(O(ee[ne]));return z},getAudioChannelConfigurationForAdaptation:function(q){return q&&q.hasOwnProperty(ye.default.AUDIO_CHANNEL_CONFIGURATION)&&q[ye.default.AUDIO_CHANNEL_CONFIGURATION].length?q[ye.default.AUDIO_CHANNEL_CONFIGURATION].map((W=>{const re=new hr;return re.init(W),re})):[]},getAudioChannelConfigurationForRepresentation:function(q){return q&&q.hasOwnProperty(ye.default.AUDIO_CHANNEL_CONFIGURATION)&&q[ye.default.AUDIO_CHANNEL_CONFIGURATION].length?q[ye.default.AUDIO_CHANNEL_CONFIGURATION].map((W=>{const re=new hr;return re.init(W),re})):[]},getAvailabilityStartTime:function(q){return q&&q.hasOwnProperty(ye.default.AVAILABILITY_START_TIME)&&q.availabilityStartTime!==null?q.availabilityStartTime.getTime():null},getBandwidth:function(q){return q&&q.bandwidth?q.bandwidth:NaN},getBaseURLsFromElement:Te,getBitrateListForAdaptation:function(q){const W=O(q);return(W&&W.Representation?W.Representation:[]).map((re=>({bandwidth:re.bandwidth,width:re.width||0,height:re.height||0,scanType:re.scanType||null,id:re.id||null})))},getCodec:C,getCodecForPreselection:function(q,W,re){let ee=null;if(q&&W){let ne=C(X(q,W),0,re);if(q.hasOwnProperty(ye.default.CODECS)){let le=q.codecs;ee=ne.replace(/(codecs=")[^"]*(")/,`$1${le}$2`),m.info("Preselection has own codecs-attribute: replacing in MainAdaptationSet (was: "+ne+"), new Preselection codec is: "+ee)}else ee=ne}return ee},getCombinedEssentialPropertiesForAdaptationSet:function(q){return se(ye.default.ESSENTIAL_PROPERTY,q)},getCombinedSupplementalPropertiesForAdaptationSet:function(q){return se(ye.default.SUPPLEMENTAL_PROPERTY,q)},getContentProtectionByAdaptation:function(q){return V(q)},getContentProtectionByManifest:function(q){let W=[];if(!q)return W;const re=V(q);return W=W.concat(re),q.hasOwnProperty(ye.default.PERIOD)&&q[ye.default.PERIOD].length>0&&q[ye.default.PERIOD].forEach((ee=>{const ne=$(ee);W=W.concat(ne)})),W},getContentProtectionByPeriod:$,getContentSteering:function(q){if(q&&q.hasOwnProperty(ye.default.CONTENT_STEERING))return Ce(q[ye.default.CONTENT_STEERING][0])},getDuration:function(q){let W;return W=q&&q.hasOwnProperty(ye.default.MEDIA_PRESENTATION_DURATION)?q.mediaPresentationDuration:q&&q.type==="dynamic"?Number.POSITIVE_INFINITY:Number.MAX_SAFE_INTEGER||Number.MAX_VALUE,W},getEssentialProperties:de,getEventStreamForAdaptationSet:function(q,W,re){let ee,ne,le;return q&&q.Period&&W&&W.period&&k(W.period.index)&&(ne=q.Period[W.period.index],ne&&ne.AdaptationSet&&k(W.index)&&(le=ne.AdaptationSet[W.index],le&&(ee=le.InbandEventStream))),fe(ee,null,re)},getEventStreamForRepresentation:function(q,W,re){let ee,ne,le,z;return q&&q.Period&&W&&W.adaptation&&W.adaptation.period&&k(W.adaptation.period.index)&&(ne=q.Period[W.adaptation.period.index],ne&&ne.AdaptationSet&&k(W.adaptation.index)&&(le=ne.AdaptationSet[W.adaptation.index],le&&le.Representation&&k(W.index)&&(z=le.Representation[W.index],z&&(ee=z.InbandEventStream)))),fe(ee,W,re)},getEventsForPeriod:function(q){const W=q&&q.mpd&&q.mpd.manifest?q.mpd.manifest:null,re=W?W.Period:null,ee=re&&q&&k(q.index)?re[q.index].EventStream:null,ne=[];let le,z;if(ee)for(le=0;le<ee.length;le++){const ce=new Na;if(ce.period=q,ce.timescale=1,!ee[le].hasOwnProperty(h.default.SCHEME_ID_URI))throw new Error("Invalid EventStream. SchemeIdUri has to be set");for(ce.schemeIdUri=ee[le][h.default.SCHEME_ID_URI],ee[le].hasOwnProperty(ye.default.TIMESCALE)&&(ce.timescale=ee[le][ye.default.TIMESCALE]),ee[le].hasOwnProperty(ye.default.VALUE)&&(ce.value=ee[le][ye.default.VALUE]),ee[le].hasOwnProperty(ye.default.PRESENTATION_TIME_OFFSET)&&(ce.presentationTimeOffset=ee[le][ye.default.PRESENTATION_TIME_OFFSET]),z=0;ee[le].Event&&z<ee[le].Event.length;z++){const me=ee[le].Event[z],Se=new wr;Se.presentationTime=0,Se.eventStream=ce,me.hasOwnProperty(ye.default.PRESENTATION_TIME)&&(Se.presentationTime=me.presentationTime);const Re=ce.presentationTimeOffset?ce.presentationTimeOffset/ce.timescale:0;Se.calculatedPresentationTime=Se.presentationTime/ce.timescale+q.start-Re,me.hasOwnProperty(ye.default.DURATION)&&(Se.duration=me.duration/ce.timescale),me.hasOwnProperty(ye.default.ID)?Se.id=parseInt(me.id):Se.id=null,me.Signal&&me.Signal.Binary&&me.Signal.Binary.__text?Se.messageData=T.decodeArray(me.Signal.Binary.__text.toString()):Se.messageData=me.messageData||me.__cdata||me.__text,ne.push(Se)}}return ne},getFramerate:te,getId:function(q){return q&&q[ye.default.ID]||null},getIndexForAdaptation:function(q,W,re){if(!q)return-1;const ee=A(W,re);for(let ne=0;ne<ee.length;ne++)if((0,qt.default)(v).getInstance().areEqual(ee[ne],q))return ne;return-1},getIsDynamic:j,getIsFragmented:I,getIsText:N,getIsTypeOf:x,getLabelsForAdaptation:function(q){if(!q||!q.Label)return[];const W=[];for(let re=0;re<q.Label.length;re++)W.push({lang:q.Label[re].lang,text:q.Label[re].__text||q.Label[re]});return W},getLanguageForAdaptation:function(q){let W="";return q&&q.hasOwnProperty(ye.default.LANG)&&(W=q.lang),W},getLocation:function(q){return q&&q.hasOwnProperty(ye.default.LOCATION)?q[ye.default.LOCATION].map((W=>{const re=W.__text||W,ee=W.hasOwnProperty(ye.default.SERVICE_LOCATION)?W[ye.default.SERVICE_LOCATION]:null;return new Ma(re,ee)})):[]},getMainAdaptationSetForPreselection:X,getCommonRepresentationForPreselection:function(q,W){if(!q||!Array.isArray(W))return;const re=X(q,W);return re?re.Representation[0]:void 0},getManifestUpdatePeriod:function(q,W=0){let re=NaN;return q&&q.hasOwnProperty(ye.default.MINIMUM_UPDATE_PERIOD)&&(re=q.minimumUpdatePeriod),isNaN(re)?re:Math.max(re-W,1)},getMimeType:function(q){return q&&q.Representation&&q.Representation.length>0?q.Representation[0].mimeType:null},getMpd:function(q){const W=new ss;return q&&(W.manifest=q,q.hasOwnProperty(ye.default.AVAILABILITY_START_TIME)?W.availabilityStartTime=new Date(q.availabilityStartTime.getTime()):q.loadedTime&&(W.availabilityStartTime=new Date(q.loadedTime.getTime())),q.hasOwnProperty(ye.default.AVAILABILITY_END_TIME)&&(W.availabilityEndTime=new Date(q.availabilityEndTime.getTime())),q.hasOwnProperty(ye.default.MINIMUM_UPDATE_PERIOD)&&(W.minimumUpdatePeriod=q.minimumUpdatePeriod),q.hasOwnProperty(ye.default.MEDIA_PRESENTATION_DURATION)&&(W.mediaPresentationDuration=q.mediaPresentationDuration),q.hasOwnProperty(ye.default.SUGGESTED_PRESENTATION_DELAY)&&(W.suggestedPresentationDelay=q.suggestedPresentationDelay),q.hasOwnProperty(ye.default.TIMESHIFT_BUFFER_DEPTH)&&(W.timeShiftBufferDepth=q.timeShiftBufferDepth),q.hasOwnProperty(ye.default.MAX_SEGMENT_DURATION)&&(W.maxSegmentDuration=q.maxSegmentDuration),q.hasOwnProperty(ye.default.PUBLISH_TIME)&&(W.publishTime=new Date(q.publishTime))),W},getPatchLocation:function(q){return q&&q.hasOwnProperty(ye.default.PATCH_LOCATION)?q[ye.default.PATCH_LOCATION].map((W=>{const re=W.__text||W,ee=W.hasOwnProperty(ye.default.SERVICE_LOCATION)?W[ye.default.SERVICE_LOCATION]:null;let ne=W.hasOwnProperty(ye.default.TTL)?1e3*parseFloat(W[ye.default.TTL]):NaN;return new os(re,ee,ne)})):[]},getPreselectionIsTypeOf:function(q,W,re){if(!q)throw new Error("preselection is not defined");if(!W)throw new Error("adaptations is not defined");if(!re)throw new Error("type is not defined");const ee=X(q,W);return!!ee&&x(ee,re)},getPreselectionsForPeriod:function(q){const W=q&&k(q.index)?q.mpd.manifest.Period[q.index]:null,re=[];let ee,ne,le;if(W&&W.Preselection)for(le=0;le<W.Preselection.length;le++){ne=W.Preselection[le],ee=new ls;const z=ge(ne,W.AdaptationSet);z.every((ce=>!!ce))&&z.length===1?(ne.hasOwnProperty(ye.default.ID)&&(ee.id=ne.id),ee.index=le,ee.period=q,ne.hasOwnProperty(ye.default.TAG)&&(ee.tag=ne.tag),ne.hasOwnProperty(ye.default.PRESELECTION_COMPONENTS)?ee.preselectionComponents=z:m.warn("Preselection (index: "+ee.index+") missing component(s)"),ne.hasOwnProperty(ye.default.ORDER)&&(ee.order=ne.order),ee.type=M(z[0]),re.push(ee)):m.warn("Preselection removed because we don't support multi-representation preselections or not all components available.")}return re},getProducerReferenceTimesForAdaptation:function(q){const W=q&&q.hasOwnProperty(ye.default.PRODUCER_REFERENCE_TIME)?q[ye.default.PRODUCER_REFERENCE_TIME]:[];(q&&q.hasOwnProperty(ye.default.REPRESENTATION)?q[ye.default.REPRESENTATION]:[]).forEach((ee=>{ee.hasOwnProperty(ye.default.PRODUCER_REFERENCE_TIME)&&W.push(...ee[ye.default.PRODUCER_REFERENCE_TIME])}));const re=[];return W.forEach((ee=>{const ne=new Nt;ee.hasOwnProperty(ye.default.ID)&&(ne[ye.default.ID]=parseInt(ee[ye.default.ID]),ee.hasOwnProperty(ye.default.WALL_CLOCK_TIME)&&(ne[ye.default.WALL_CLOCK_TIME]=ee[ye.default.WALL_CLOCK_TIME],ee.hasOwnProperty(ye.default.PRESENTATION_TIME)&&(ne[ye.default.PRESENTATION_TIME]=ee[ye.default.PRESENTATION_TIME],ee.hasOwnProperty(ye.default.INBAND)&&(ne[ye.default.INBAND]=ee[ye.default.INBAND]!=="false"),ee.hasOwnProperty(ye.default.TYPE)&&(ne[ye.default.TYPE]=ee[ye.default.TYPE]),re.push(ne))))})),re},getPublishTime:function(q){return q&&q.hasOwnProperty(ye.default.PUBLISH_TIME)?new Date(q[ye.default.PUBLISH_TIME]):null},getRealPeriodForIndex:function(q,W){const re=R(W);return re.length>0&&k(q)?re[q]:null},getRealPeriods:R,getRegularPeriods:function(q){const W=!!q&&j(q.manifest),re=[];let ee,ne,le=null,z=null,ce=null,me=null;for(ne=0,ee=q&&q.manifest&&q.manifest.Period?q.manifest.Period.length:0;ne<ee;ne++)z=q.manifest.Period[ne],z.hasOwnProperty(ye.default.START)?(me=new Pi,me.start=z.start):le!==null&&le.hasOwnProperty(ye.default.DURATION)&&ce!==null?(me=new Pi,me.start=parseFloat((ce.start+ce.duration).toFixed(5))):ne!==0||W||(me=new Pi,me.start=0),ce!==null&&isNaN(ce.duration)&&(me!==null?ce.duration=parseFloat((me.start-ce.start).toFixed(5)):m.warn("First period duration could not be calculated because lack of start and duration period properties. This will cause timing issues during playback")),me!==null&&(me.id=be(z,ne),me.index=ne,me.mpd=q,me.isEncrypted=B(z),z.hasOwnProperty(ye.default.DURATION)&&(me.duration=z.duration),ce&&(ce.nextPeriodId=me.id),re.push(me),le=z,ce=me),z=null,me=null;return re.length===0||ce!==null&&isNaN(ce.duration)&&(ce.duration=parseFloat(((function(Se){(function(){if(!b||!b.hasOwnProperty("error"))throw new Error(h.default.MISSING_CONFIG_ERROR)})();const Re=j(Se.mpd.manifest);let we;return Se.mpd.manifest.mediaPresentationDuration?we=Se.mpd.manifest.mediaPresentationDuration:Se.duration?we=Se.duration:Re?we=Number.POSITIVE_INFINITY:b.error(new Wt.default(Jt.MANIFEST_ERROR_ID_PARSE_CODE,"Must have @mediaPresentationDuration on MPD or an explicit @duration on the last period.",Se)),we})(ce)-ce.start).toFixed(5))),re},getRepresentationCount:function(q){return q&&q.Representation?q.Representation.length:0},getRepresentationFor:function(q,W){return W&&W.Representation&&W.Representation.length>0&&k(q)?W.Representation[q]:null},getRepresentationSortFunction:function(){return(q,W)=>q.bandwidth-W.bandwidth},getRepresentationsForAdaptation:function(q,W){const re=[],ee=(function(le){if(le&&le.period&&k(le.period.index)){const z=le.period.mpd.manifest.Period[le.period.index];if(z&&z.AdaptationSet&&k(le.index))return O(z.AdaptationSet[le.index])}})(q);let ne;if(ee&&ee.Representation){if(q&&q.period&&k(q.period.index)){const le=Te(q.period.mpd.manifest);le&&(ne=le[0])}for(let le=0,z=ee.Representation.length;le<z;++le){const ce=P(W,ee.Representation[le],q,ee,ne,le);re.push(ce)}}return re},getRolesForAdaptation:function(q){return q&&q.hasOwnProperty(ye.default.ROLE)&&q[ye.default.ROLE].length?q[ye.default.ROLE].map((W=>{W.schemeIdUri===h.default.DASH_ROLE_SCHEME_ID&&W.value==="Main"&&(W.value=ye.default.MAIN);const re=new hr;return re.init(W),re})):[]},getSegmentAlignment:function(q){return!(!q||!q.hasOwnProperty(ye.default.SEGMENT_ALIGNMENT))&&q[ye.default.SEGMENT_ALIGNMENT]==="true"},getSegmentSequencePropertiesForAdaptationSet:function(q){const W=[];return q&&(W.push(...U(q)),q.Representation&&q.Representation.length&&q.Representation.forEach((re=>{W.push(...U(re))}))),W},getSelectionPriority:function(q){try{const W=q&&q.selectionPriority!==void 0?parseInt(q.selectionPriority):1;return isNaN(W)?1:W}catch{return 1}},getServiceDescriptions:function(q){const W=[];if(q&&q.hasOwnProperty(ye.default.SERVICE_DESCRIPTION))for(const re of q.ServiceDescription){let ee=null,ne=null,le=null,z=null,ce=null,me=null,Se=null,Re=null;for(const we in re)if(re.hasOwnProperty(we))if(we===ye.default.ID)ee=re[we];else if(we===ye.default.SERVICE_DESCRIPTION_SCOPE)ne=re[we].schemeIdUri;else if(we===ye.default.SERVICE_DESCRIPTION_LATENCY)le={target:parseInt(re[we].target),max:parseInt(re[we].max),min:parseInt(re[we].min),referenceId:parseInt(re[we].referenceId)};else if(we===ye.default.SERVICE_DESCRIPTION_PLAYBACK_RATE)z={max:parseFloat(re[we].max),min:parseFloat(re[we].min)};else if(we===ye.default.SERVICE_DESCRIPTION_OPERATING_QUALITY)ce={mediaType:re[we].mediaType,max:parseInt(re[we].max),min:parseInt(re[we].min),target:parseInt(re[we].target),type:re[we].type,maxQualityDifference:parseInt(re[we].maxQualityDifference)};else if(we===ye.default.SERVICE_DESCRIPTION_OPERATING_BANDWIDTH)me={mediaType:re[we].mediaType,max:parseInt(re[we].max),min:parseInt(re[we].min),target:parseInt(re[we].target)};else if(we===ye.default.CONTENT_STEERING){let ze=re[we];ze=Array.isArray(ze)?ze.at(ze.length-1):ze,Se=Ce(ze)}else we===ye.default.CLIENT_DATA_REPORTING&&(Re=Ie(re[we]));W.push({id:ee,schemeIdUri:ne,latency:le,playbackRate:z,operatingQuality:ce,operatingBandwidth:me,contentSteering:Se,clientDataReporting:Re})}return W},getSubSegmentAlignment:function(q){return!(!q||!q.hasOwnProperty(ye.default.SUB_SEGMENT_ALIGNMENT))&&q[ye.default.SUB_SEGMENT_ALIGNMENT]==="true"},getSuggestedPresentationDelay:function(q){return q&&q.hasOwnProperty(ye.default.SUGGESTED_PRESENTATION_DELAY)?q.suggestedPresentationDelay:null},getSupplementalProperties:G,getUTCTimingSources:function(q){const W=j(q),re=!!q&&q.hasOwnProperty(ye.default.AVAILABILITY_START_TIME),ee=q?q.UTCTiming:null,ne=[];return(W||re)&&ee&&ee.forEach((function(le){const z=new er.default;le.hasOwnProperty(h.default.SCHEME_ID_URI)&&(z.schemeIdUri=le.schemeIdUri,le.hasOwnProperty(ye.default.VALUE)&&(z.value=le.value.toString(),ne.push(z)))})),ne},getViewpointForAdaptation:function(q){return q&&q.hasOwnProperty(ye.default.VIEWPOINT)&&q[ye.default.VIEWPOINT].length?q[ye.default.VIEWPOINT].map((W=>{const re=new hr;return re.init(W),re})):[]},hasProfile:function(q,W){let re=!1;return q&&q.profiles&&q.profiles.length>0&&(re=q.profiles.indexOf(W)!==-1),re},isPeriodEncrypted:B,setConfig:function(q){q&&(q.errHandler&&(b=q.errHandler),q.BASE64&&(T=q.BASE64))}},m=(0,o.default)(v).getInstance().getLogger(p),p}jn.__dashjs_factory_name="DashManifestModel";var Fn=n.default.getSingletonFactory(jn);const Kn="utf-16",Zr="utf-16be",Jr="utf-16le",ei="utf-8";function _i(p,m){if(p<0)return-_i(-p,m);const b=Math.pow(10,m);if(Math.abs(p*b%1-.5)<Number.EPSILON){const T=Math.floor(p*b);return(T%2==0?T:T+1)/b}return Math.round(p*b)/b}const us=/&(?:amp|lt|gt|quot|apos|nbsp|lrm|rlm|#[xX]?[0-9a-fA-F]+);/g;function Xi(p){return p.indexOf("&")===-1?p:p.replace(us,(m=>{switch(m){case"&":return"&";case"<":return"<";case">":return">";case""":return'"';case"'":return"'";case" ":return"Β ";case"‎":return"β";case"‏":return"β";default:if(m[1]==="#"){const b=m[2]==="x"||m[2]==="X"?parseInt(m.slice(3),16):parseInt(m.slice(2),10);return String.fromCodePoint(b)}return m}}))}var Lr=class Vl{constructor(m,b){Array.isArray(m)&&(m=m.map((T=>T instanceof Vl?T:new Vl(T)))),this.value=m,this.params=b}};const Ni="Dict";function br(p,m){return{value:p,src:m}}function cs(p,m,b,T){return new Error(`failed to ${p} "${v=m,Array.isArray(v)?JSON.stringify(v):v instanceof Map?"Map{}":v instanceof Set?"Set{}":typeof v=="object"?JSON.stringify(v):String(v)}" as ${b}`,{cause:T});var v}function Yn(p,m,b){return cs("parse",p,m,b)}const Fa="Inner List",Ua="Bare Item",za="Boolean",Ba="Byte Sequence",ds="Date",ja="Decimal",fs="Integer",Wn=`${fs} or ${ja}`;function Mi(p){return p<-999999999999999||999999999999999<p}function Qi(p){let m,b=1,T="";const v=Yn(p,Wn);if(p[0]==="-"&&(b=-1,p=p.substring(1)),p.length<=0)throw v;const S=/^(\d+)?/g,k=S.exec(p);if(k[0].length===0)throw v;if(T+=k[1],(p=p.substring(S.lastIndex))[0]==="."){if(T.length>12)throw v;const x=/^(\.\d+)?/g,I=x.exec(p);if(p=p.substring(x.lastIndex),I[0].length===0||I[1].length>4||(T+=I[1],T.length>16))throw v;m=parseFloat(T)*b}else{if(T.length>15)throw v;if(m=parseInt(T)*b,Mi(m))throw Yn(T,Wn)}return br(m,p)}const $r="String",hs=/[\x00-\x1f\x7f]+/;var Dr=class{constructor(p){this.description=p}};const gs="Token";function ti(p,m){const b=p[0];if(b==='"')return(function(T){let v="",S=0;if(T[S]!=='"')throw Yn(T,$r);for(S++;T.length>S;){if(T[S]==="\\"){if(T.length<=S+1||(S++,T[S]!=='"'&&T[S]!=="\\"))throw Yn(T,$r);v+=T[S]}else{if(T[S]==='"')return br(v,T.substring(++S));if(hs.test(T[S]))throw Yn(T,$r);v+=T[S]}S++}throw Yn(T,$r)})(p);if(/^[-0-9]/.test(b))return Qi(p);if(b==="?")return(function(T){let v=0;if(T[v]!=="?")throw Yn(T,za);if(v++,T[v]==="1")return br(!0,T.substring(++v));if(T[v]==="0")return br(!1,T.substring(++v));throw Yn(T,za)})(p);if(b===":")return(function(T){if(T[0]!==":"||(T=T.substring(1)).includes(":")===!1)throw Yn(T,Ba);const v=/(^.*?)(:)/g,S=v.exec(T)[1];return T=T.substring(v.lastIndex),br(new Uint8Array([...atob(S)].map((k=>k.charCodeAt(0)))),T)})(p);if(/^[a-zA-Z*]/.test(b))return(function(T,v){if(/^[a-zA-Z*]$/.test(T[0])===!1)throw Yn(T,gs);const S=/^([!#$%&'*+\-.^_`|~\w:/]+)/g,k=S.exec(T)[1];return T=T.substring(S.lastIndex),br(Symbol.for(k),T)})(p);if(b==="@")return(function(T){let v=0;if(T[v]!=="@")throw Yn(T,ds);v++;const S=Qi(T.substring(v));if(Number.isInteger(S.value)===!1)throw Yn(T,ds);return br(new Date(1e3*S.value),S.src)})(p);throw Yn(p,Ua)}const Eu="Key";function bu(p){let m=0;if(/^[a-z*]$/.test(p[m])===!1)throw Yn(p,Eu);let b="";for(;p.length>m;){if(/^[a-z0-9_\-.*]$/.test(p[m])===!1)return br(b,p.substring(m));b+=p[m],m++}return br(b,p.substring(m))}function bo(p,m){let b;for(;p.length>0&&p[0]===";";){const T=bu(p=p.substring(1).trim()),v=T.value;let S=!0;if((p=T.src)[0]==="="){const k=ti(p=p.substring(1));S=k.value,p=k.src}b==null&&(b={}),b[v]=S}return br(b,p)}function Tu(p,m){const b=ti(p),T=bo(p=b.src);return p=T.src,br(new Lr(b.value,T.value),p)}function vu(p,m){return p[0]==="("?(function(b,T){if(b[0]!=="(")throw Yn(b,Fa);b=b.substring(1);const v=[];for(;b.length>0;){if((b=b.trim())[0]===")"){const k=bo(b=b.substring(1));return br(new Lr(v,k.value),k.src)}const S=Tu(b);if(v.push(S.value),(b=S.src)[0]!==" "&&b[0]!==")")throw Yn(b,Fa)}throw Yn(b,Fa)})(p):Tu(p)}const ms="List";function ci(p,m,b){return cs("serialize",p,m,b)}function Su(p){if(Mi(p))throw ci(p,fs);return p.toString()}function Lm(p){const m=_i(p,3);if(Math.floor(Math.abs(m)).toString().length>12)throw ci(p,ja);const b=m.toString();return b.includes(".")?b:`${b}.0`}function _u(p){return p.description||p.toString().slice(7,-1)}function Au(p){const m=_u(p);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(m)===!1)throw ci(m,gs);return m}function To(p){switch(typeof p){case"number":if(!Number.isFinite(p))throw ci(p,Ua);return Number.isInteger(p)?Su(p):Lm(p);case"string":return(function(m){if(hs.test(m))throw ci(m,$r);return`"${m.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`})(p);case"symbol":return Au(p);case"boolean":return(function(m){if(typeof m!="boolean")throw ci(m,za);return m?"?1":"?0"})(p);case"object":if(p instanceof Date)return(function(m){return`@${Su(m.getTime()/1e3)}`})(p);if(p instanceof Uint8Array)return(function(m){if(ArrayBuffer.isView(m)===!1)throw ci(m,Ba);return`:${b=m,btoa(String.fromCharCode(...b))}:`;var b})(p);if(p instanceof Dr)return Au(p);default:throw ci(p,Ua)}}function vo(p){if(/^[a-z*][a-z0-9\-_.*]*$/.test(p)===!1)throw ci(p,Eu);return p}function So(p){return p==null?"":Object.entries(p).map((([m,b])=>b===!0?`;${vo(m)}`:`;${vo(m)}=${To(b)}`)).join("")}function Iu(p){return p instanceof Lr?`${To(p.value)}${So(p.params)}`:To(p)}function xu(p,m){return(function(b,T={whitespace:!0}){if(typeof b!="object"||b==null)throw ci(b,Ni);const v=b instanceof Map?b.entries():Object.entries(b),S=T?.whitespace?" ":"";return Array.from(v).map((([k,x])=>{x instanceof Lr==0&&(x=new Lr(x));let I=vo(k);return x.value===!0?I+=So(x.params):(I+="=",Array.isArray(x.value)?I+=(function(N){return`(${N.value.map(Iu).join(" ")})${So(N.params)}`})(x):I+=Iu(x)),I})).join(`,${S}`)})(p,m)}const wu={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},ni="CMCD-Object",lr="CMCD-Request",Oi="CMCD-Session",Ai="CMCD-Status",Dm={br:ni,ab:ni,d:ni,ot:ni,tb:ni,tpb:ni,lb:ni,tab:ni,lab:ni,url:ni,pb:lr,bl:lr,tbl:lr,dl:lr,ltc:lr,mtp:lr,nor:lr,nrr:lr,rc:lr,sn:lr,sta:lr,su:lr,ttfb:lr,ttfbb:lr,ttlb:lr,cmsdd:lr,cmsds:lr,smrt:lr,df:lr,cs:lr,ts:lr,cid:Oi,pr:Oi,sf:Oi,sid:Oi,st:Oi,v:Oi,msd:Oi,bs:Ai,bsd:Ai,cdn:Ai,rtp:Ai,bg:Ai,pt:Ai,ec:Ai,e:Ai},_o={OBJECT:ni,REQUEST:lr,SESSION:Oi,STATUS:Ai},Ru="event",ps=p=>Math.round(p),Ao=(p,m)=>Array.isArray(p)?p.map((b=>Ao(b,m))):p instanceof Lr&&typeof p.value=="string"?new Lr(Ao(p.value,m),p.params):(m.baseUrl&&(p=(function(b,T){const v=new URL(b),S=new URL(T);if(v.origin!==S.origin)return b;const k=v.pathname.split("/").slice(1),x=S.pathname.split("/").slice(1,-1),I=Math.min(k.length,x.length);for(let N=0;N<I&&k[N]===x[N];N++)k.shift(),x.shift();for(;x.length;)x.shift(),k.unshift("..");return k.join("/")+v.search+v.hash})(p,m.baseUrl)),m.version===1?encodeURIComponent(p):p),ys=p=>100*ps(p/100),Pm={br:ps,d:ps,bl:ys,dl:ys,mtp:ys,nor:(p,m)=>{let b=p;return m.version>=2&&(p instanceof Lr&&typeof p.value=="string"?b=new Lr([p]):typeof p=="string"&&(b=[p])),Ao(b,m)},rtp:ys,tb:ps},ku="request",Io=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Cu=["e"],xo=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"],Nm=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function wo(p){return Nm.test(p)}const Lu=["d","dl","nor","ot","rtp","su"],Du=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function Mm(p){return Du.includes(p)||wo(p)}const Om={[Ru]:function(p){return Io.includes(p)||Cu.includes(p)||xo.includes(p)||wo(p)},[ku]:function(p){return Io.includes(p)||Lu.includes(p)||wo(p)}};function Pu(p,m={}){const b={};if(p==null||typeof p!="object")return b;const T=m.version||p.v||1,v=m.reportingMode||ku,S=T===1?Mm:Om[v];let k=Object.keys(p).filter(S);p.e&&p.e!=="rr"&&(k=k.filter((A=>!(function(R){return xo.includes(R)})(A))));const x=m.filter;typeof x=="function"&&(k=k.filter(x));const I=v===Ru;I&&!k.includes("ts")&&k.push("ts"),T>1&&!k.includes("v")&&k.push("v");const N=Object.assign({},Pm,m.formatters),O={version:T,reportingMode:v,baseUrl:m.baseUrl};return k.sort().forEach((A=>{let R=p[A];const C=N[A];if(typeof C=="function"&&(R=C(R,O)),A==="v"){if(T===1)return;R=T}A=="pr"&&R===1||(I&&A==="ts"&&!Number.isFinite(R)&&(R=Date.now()),(function(B){return typeof B=="number"?Number.isFinite(B):B!=null&&B!==""&&B!==!1})(R)&&((function(B){return["ot","sf","st","e","sta"].includes(B)})(A)&&typeof R=="string"&&(R=new Dr(R)),b[A]=R))})),b}function Fm(p,m={}){const b={};if(!p)return b;const T=(function(v,S){const k={};if(!v)return k;const x=Object.keys(v),I=S?(N=S,Object.keys(N).reduce(((O,A)=>(N[A]?.forEach((R=>O[R]=A)),O)),{})):{};var N;return x.reduce(((O,A)=>{const R=Dm[A]||I[A]||_o.REQUEST;return(O[R]??={})[A]=v[A],O}),k)})(Pu(p,m),m?.customHeaderMap);return Object.entries(T).reduce(((v,[S,k])=>{const x=xu(k,{whitespace:!1});return x&&(v[S]=x),v}),b)}const Um=new Set([...Du,...Io,...Lu,...xo,...Cu]),di=(Array.from(Um),wu),Nu={DASH:"d",HLS:"h",SMOOTH:"s",OTHER:"o"},Mu={VOD:"v",LIVE:"l"},Ou="segment";function Fu(){let p,m,b,T,v,S,k,x,I,N,O,A,R,C,B,$,V=this.context,j=(0,g.default)(V).getInstance(),te=(0,l.default)(V).getInstance(),ie=(0,o.default)(V).getInstance();function se(){T={pr:1,nor:null,st:null,sf:null,sid:`${Je.default.generateUuid()}`,cid:null},R={},A={},C={},O=void 0,B=void 0,$=!1,P()}function de(){P()}function G(){B||(B=Date.now())}function U(){B&&!T.msd&&(T.msd=Date.now()-B)}function P(){if(!k)return;const ne=k.getStreamController();if(!ne||typeof ne.getActiveStream!="function")return;const le=ne.getActiveStream();le&&(N=le.getStreamProcessors())}function M(ne){try{const le=X(),z=le.version?le.keys:te.get().streaming.cmcd.enabledKeys;return Object.keys(ne).filter((ce=>z.includes(ce))).reduce(((ce,me)=>(ce[me]=ne[me],ce)),{})}catch{return ne}}function ge(){const ne=X();return(function(le){if(Object.keys(le).length){if(parseInt(le.version)!==1)return b.error("version parameter must be defined in 1."),!1;if(!le.keys)return b.error("keys parameter must be defined."),!1}const z=le.version,ce=te.get().streaming.cmcd&&te.get().streaming.cmcd.enabled;return z||ce})(ne)&&(function(le){let z=te.get().streaming.cmcd.includeInRequests;le.version&&(z=le.includeInRequests??[Ou]);const ce=h.default.CMCD_AVAILABLE_REQUESTS,me=z.filter((Se=>!ce.includes(Se)));return me.length===z.length?(b.error("None of the request types are supported."),!1):(me.map((Se=>{b.warn(`request type ${Se} is not supported.`)})),!0)})(ne)&&(function(le){const z=h.default.CMCD_AVAILABLE_KEYS,ce=h.default.CMCD_V2_AVAILABLE_KEYS,me=le.version?le.keys:te.get().streaming.cmcd.enabledKeys,Se=te.get().streaming.cmcd.version,Re=me.filter((we=>!(z.includes(we)||Se===2&&ce.includes(we))));return Re.length===me.length&&me.length>0?(b.error(`None of the keys are implemented for CMCD version ${Se}.`),!1):(Re.map((we=>{b.warn(`key parameter ${we} is not implemented for CMCD version ${Se}.`)})),!0)})(ne)}function X(){let ne={};if(x){const le=x.getServiceDescriptionSettings();te.get().streaming.cmcd.applyParametersFromMpd&&le.clientDataReporting&&le.clientDataReporting.cmcdParameters&&(ne=le.clientDataReporting.cmcdParameters)}return ne}function be(ne){try{let z=null;if(ne.type,(le=ne.mediaType)!==h.default.VIDEO&&le!==h.default.AUDIO||O&&O!=h.default.AUDIO||(O=le),(function(ce){const me=X();let Se=te.get().streaming.cmcd.includeInRequests;me.version&&(Se=me.includeInRequests?me.includeInRequests:[Ou]);const Re={[ke.HTTPRequest.INIT_SEGMENT_TYPE]:"segment",[ke.HTTPRequest.MEDIA_SEGMENT_TYPE]:"segment",[ke.HTTPRequest.XLINK_EXPANSION_TYPE]:"xlink",[ke.HTTPRequest.MPD_TYPE]:"mpd",[ke.HTTPRequest.CONTENT_STEERING_TYPE]:"steering",[ke.HTTPRequest.OTHER_TYPE]:"other"};return Se.some((we=>Re[ce]===we))})(ne.type)){if(ne.type===ke.HTTPRequest.MPD_TYPE)return(function(){const ce=Ce();return ce.ot=di.MANIFEST,ce})();if(ne.type===ke.HTTPRequest.MEDIA_SEGMENT_TYPE)return Te(ne.mediaType),fe(ne,ne.mediaType);if(ne.type===ke.HTTPRequest.INIT_SEGMENT_TYPE)return(function(){const ce=Ce();return ce.ot=di.INIT,ce.su=!0,ce})();if(ne.type===ke.HTTPRequest.OTHER_TYPE||ne.type===ke.HTTPRequest.XLINK_EXPANSION_TYPE)return(function(){const ce=Ce();return ce.ot=di.OTHER,ce})();if(ne.type===ke.HTTPRequest.LICENSE)return(function(){const ce=Ce();return ce.ot=di.KEY,ce})();if(ne.type===ke.HTTPRequest.CONTENT_STEERING_TYPE)return(function(ce){const me=O?fe(ce,O):Ce();return me.ot=di.OTHER,me})(ne)}return z}catch{return null}var le}function fe(ne,le){Te(le);const z=Ce(),ce=(function(vt){try{return parseInt(vt.bandwidth/1e3)}catch{return null}})(ne),me=(function(vt){try{return isNaN(vt.duration)?NaN:Math.round(1e3*vt.duration)}catch{return null}})(ne),Se=(function(vt){try{return 100*parseInt(I.getSafeAverageThroughput(vt)/100)}catch{return null}})(le),Re=(function(vt){try{const Qt=T.pr,un=S.getCurrentBufferLevel(vt);return isNaN(Qt)||isNaN(un)?null:100*parseInt(un/Qt*10)}catch{return null}})(le),we=Ie(le),ze=(function(vt){try{const Qt=v.getPossibleVoRepresentationsFilteredBySettings(vt).map((un=>un.bitrateInKbit));return Math.max(...Qt)}catch{return null}})(ne.representation?.mediaInfo),Ye=T.pr,ct=(function(vt){if(N&&N.length!==0){for(let Qt of N)if(Qt.getType()===vt)return Qt.probeNextRequest()}})(le);let bt;le===h.default.VIDEO&&(bt=di.VIDEO),le===h.default.AUDIO&&(bt=di.AUDIO),ne.mediaType===h.default.ENHANCEMENT&&(bt=di.OTHER),le===h.default.TEXT&&(bt=ne.representation.mediaInfo.mimeType==="application/mp4"?di.TIMED_TEXT:di.CAPTION);let Zt=te.get().streaming.cmcd.rtp;return Zt||(Zt=(function(vt){try{let Qt=k.getPlaybackRate();Qt||(Qt=1);let{bandwidth:un,mediaType:Rn,representation:xn,duration:dn}=vt;if(!xn.mediaInfo)return NaN;let vn=Ie(Rn);vn===0&&(vn=500);let qe=un*dn/1e3/(vn/Qt/1e3),pt=te.get().streaming.cmcd.rtpSafetyFactor&&!isNaN(te.get().streaming.cmcd.rtpSafetyFactor)?te.get().streaming.cmcd.rtpSafetyFactor:5;return 100*(parseInt(qe*pt/100)+1)}catch{return NaN}})(ne)),isNaN(Zt)||(z.rtp=Zt),ct&&(ne.url!==ct.url?z.nor=encodeURIComponent(Je.default.getRelativeUrl(ne.url,ct.url)):ct.range&&(z.nrr=ct.range)),ce&&(z.br=ce),bt&&(z.ot=bt),isNaN(me)||(z.d=me),isNaN(Se)||(z.mtp=Se),isNaN(Re)||(z.dl=Re),isNaN(we)||(z.bl=we),isNaN(ze)||(z.tb=ze),isNaN(Ye)||Ye===1||(z.pr=Ye),R[le]&&(z.bs=!0,R[le]=!1),!A[le]&&C[le]||(z.su=!0,A[le]=!1,C[le]=!0),z}function Te(ne){C.hasOwnProperty(ne)||(C[ne]=!1),A.hasOwnProperty(ne)||(A[ne]=!1),R.hasOwnProperty(ne)||(R[ne]=!1)}function Ce(){const ne=X(),le={};let z=te.get().streaming.cmcd.cid?te.get().streaming.cmcd.cid:T.cid;if(z=ne.contentID?ne.contentID:z,le.v=te.get().streaming.cmcd.version??1,le.sid=te.get().streaming.cmcd.sid?te.get().streaming.cmcd.sid:T.sid,le.sid=ne.sessionID?ne.sessionID:le.sid,le.sid=`${le.sid}`,z&&(le.cid=`${z}`),isNaN(T.pr)||T.pr===1||T.pr===null||(le.pr=T.pr),T.st&&(le.st=T.st),T.sf&&(le.sf=T.sf),le.v===2){let ce=1e3*k.getCurrentLiveLatency();isNaN(ce)||(le.ltc=ce);const me=T.msd;$||isNaN(me)||(le.msd=me,$=!0)}return le}function Ie(ne){try{const le=S.getCurrentBufferLevel(ne);return isNaN(le)?null:100*parseInt(10*le)}catch{return null}}function q(ne){try{T.pr=ne.playbackRate}catch{}}function W(ne){try{const le=p.getIsDynamic(ne.data)?Mu.LIVE:Mu.VOD,z=ne.protocol&&ne.protocol==="MSS"?Nu.SMOOTH:Nu.DASH;T.st=`${le}`,T.sf=`${z}`}catch{}}function re(ne){try{ne.state&&ne.mediaType&&ne.state===y.default.BUFFER_EMPTY&&(R[ne.mediaType]||(R[ne.mediaType]=!0),A[ne.mediaType]||(A[ne.mediaType]=!0))}catch{}}function ee(){for(let ne in R)R.hasOwnProperty(ne)&&(R[ne]=!0);for(let ne in A)A.hasOwnProperty(ne)&&(A[ne]=!0)}return m={getCmcdData:be,getQueryParameter:function(ne){try{if(ge()){const le=be(ne),z=(function(ce,me={}){return ce?xu(Pu(ce,me),{whitespace:!1}):""})(M(le));return j.trigger($n.default.CMCD_DATA_GENERATED,{url:ne.url,mediaType:ne.mediaType,cmcdData:le,cmcdString:z}),{key:"CMCD",value:z}}return null}catch{return null}},getHeaderParameters:function(ne){try{if(ge()){const le=be(ne),z=Fm(M(le),te.get().streaming.cmcd.version===1?{}:{customHeaderMap:{[_o.REQUEST]:["ltc"],[_o.SESSION]:["msd"]}});return j.trigger($n.default.CMCD_DATA_GENERATED,{url:ne.url,mediaType:ne.mediaType,cmcdData:le,headers:z}),z}return null}catch{return null}},getCmcdParametersFromManifest:X,setConfig:function(ne){ne&&(ne.abrController&&(v=ne.abrController),ne.dashMetrics&&(S=ne.dashMetrics),ne.throughputController&&(I=ne.throughputController),ne.playbackController&&(k=ne.playbackController),ne.serviceDescriptionController&&(x=ne.serviceDescriptionController))},reset:function(){j.off(y.default.PLAYBACK_RATE_CHANGED,q,this),j.off(y.default.MANIFEST_LOADED,W,this),j.off(y.default.BUFFER_LEVEL_STATE_CHANGED,re,m),j.off(y.default.PLAYBACK_SEEKED,ee,m),j.off(y.default.PLAYBACK_STARTED,G,m),j.off(y.default.PLAYBACK_PLAYING,U,m),se()},initialize:function(ne){j.on(y.default.PLAYBACK_RATE_CHANGED,q,m),j.on(y.default.MANIFEST_LOADED,W,m),j.on(y.default.BUFFER_LEVEL_STATE_CHANGED,re,m),j.on(y.default.PLAYBACK_SEEKED,ee,m),j.on(y.default.PERIOD_SWITCH_COMPLETED,de,m),ne?j.on(y.default.MANIFEST_LOADING_STARTED,G,m):j.on(y.default.PLAYBACK_STARTED,G,m),j.on(y.default.PLAYBACK_PLAYING,U,m)},isCmcdEnabled:ge},p=Fn(V).getInstance(),b=ie.getLogger(m),se(),m}Fu.__dashjs_factory_name="CmcdModel";var Uu=n.default.getSingletonFactory(Fu);const qa="CMSD-Dynamic",zu="CMSD-Static",Es=wu,zm=zu.toLowerCase(),Bm=qa.toLowerCase(),jm=["mb","st","sf","v"],Ro="stream",qm={video:Es.VIDEO,audio:Es.AUDIO,text:Es.TIMED_TEXT,stream:Ro};function Bu(){const p=this.context,m=(0,g.default)(p).getInstance();let b,T,v,S;function k(){v={},S={}}function x(R){R&&Object.keys(R).forEach((C=>{jm.includes(C)||delete R[C]}))}function I(R){try{return(C=R)?Object.entries((function(B,$){try{const{src:V,value:j}=(function(te,ie){const se={};for(;te.length>0;){let de;const G=bu(te),U=G.value;if((te=G.src)[0]==="="){const P=vu(te.substring(1),ie);de=P.value,te=P.src}else{const P=bo(te,ie);de=new Lr(!0,P.value),te=P.src}if(se[U]=de,(te=te.trim()).length===0)return br(se,te);if(te[0]!==","||(te=te.substring(1).trim()).length===0||te[0]===",")throw Yn(te,Ni)}return br(se,te)})(B.trim(),$);if(V!=="")throw Yn(V,Ni);return j}catch(V){throw Yn(B,Ni,V)}})(C)).reduce(((B,[$,V])=>{const{value:j}=V;return B[$]=typeof j=="symbol"?_u(j):j,B}),{}):{}}catch(B){T.error("Failed to parse CMSD-Static response header value:",B)}var C}function N(R){try{const B=(C=R)?(function(V,j){try{const{src:te,value:ie}=(function(se,de){const G=[];for(;se.length>0;){const U=vu(se,de);if(G.push(U.value),(se=U.src.trim()).length===0)return br(G,se);if(se[0]!==","||(se=se.substring(1).trim()).length===0||se[0]===",")throw Yn(se,ms)}return br(G,se)})(V.trim(),j);if(te!=="")throw Yn(te,ms);return ie}catch(te){throw Yn(V,ms,te)}})(C):[];return B[B.length-1]?.params||{}}catch(B){return T.error("Failed to parse CMSD-Dynamic response header value:",B),{}}var C}function O(R){return qm[R]||Es.OTHER}function A(R,C,B){const $=R===zu?v:S,V=$[C]||{},j=$[Ro]||{};return V[B]||j[B]}return b={setConfig:function(){},initialize:function(){},reset:function(){k()},parseResponseHeaders:function(R,C){let B=null,$=null;for(const j in R){const te=R[j];switch(j){case zm:B=I(te),m.trigger(f.default.CMSD_STATIC_HEADER,B);break;case Bm:$||($=N(te))}}let V=Ro;return B&&B.ot?V=B.ot:C&&(V=O(C)),x(v[V]),x(S[V]),B&&(v[V]=Object.assign(v[V]||{},B)),$&&(S[V]=Object.assign(S[V]||{},$)),{static:B,dynamic:$}},getMaxBitrate:function(R){let C=O(R);return A(qa,C,"mb")||-1},getEstimatedThroughput:function(R){let C=O(R);return A(qa,C,"etp")||null},getResponseDelay:function(R){let C=O(R);return A(qa,C,"rd")||null},getRoundTripTime:function(R){let C=O(R);return A(qa,C,"rtt")||null}},T=(0,o.default)(p).getInstance().getLogger(b),k(),b}Bu.__dashjs_factory_name="CmsdModel";var ju=n.default.getSingletonFactory(Bu),ko=t(1926);function qu(){let p,m;function b(){m={}}return p={reset:function(){b()},processResponseHeaders:function(T){if(!(T&&T.headers&&T.request&&T.request.url))return;const v=T.headers[h.default.COMMON_ACCESS_TOKEN_HEADER];if(v){const S=Je.default.getHostFromUrl(T.request.url);S&&(m[S]=v)}},getCommonAccessTokenForUrl:function(T){if(!T)return null;const v=Je.default.getHostFromUrl(T);return v?m[v]?m[v]:null:void 0}},b(),p}qu.__dashjs_factory_name="CommonAccessTokenController";var Gm=n.default.getSingletonFactory(qu);function Gu(){let p,m;return p={setConfig:function(b){b&&b.serviceDescriptionController&&(m=b.serviceDescriptionController)},isAdaptationsIncluded:function(b){const{adaptationSetsArray:T}=m?.getServiceDescriptionSettings()?.clientDataReporting??{};return!T||T?.length===0||T.includes(b)},isServiceLocationIncluded:function(b,T){if(b===ke.HTTPRequest.CONTENT_STEERING_TYPE)return!0;const{serviceLocationsArray:v}=m?.getServiceDescriptionSettings()?.clientDataReporting??{};return!v||v?.length===0||v.includes(T)}},p}Gu.__dashjs_factory_name="ClientDataReportingController";var $u=n.default.getSingletonFactory(Gu);function Vu(){let p,m,b;const T=this.context;function v(S,k,x,I,N){const O=(function(A,R){let C=[];return C=R===ye.default.PERIOD?A[ye.default.SUPPLEMENTAL_PROPERTY]||[]:[...A[ye.default.ESSENTIAL_PROPERTY]||[],...A[ye.default.SUPPLEMENTAL_PROPERTY]||[]],C.find((B=>B.schemeIdUri===h.default.URL_QUERY_INFO_SCHEME&&B.UrlQueryInfo||B.schemeIdUri===h.default.EXT_URL_QUERY_INFO_SCHEME&&B.ExtUrlQueryInfo))})(k,N);(function(A,R,C,B){C.initialQueryString="";let $="";const V=A?.ExtUrlQueryInfo||A?.UrlQueryInfo;$=V&&V.queryString?R&&R.length>0?R+"&"+V.queryString:V.queryString:R,V?.useMPDUrlQuery==="true"&&B&&($=$?$+"&"+B:B),C.initialQueryString=$})(O,I.initialQueryString,S,x),(function(A,R,C){if(!A)return void(R.finalQueryString=C);const B=A?.ExtUrlQueryInfo?.queryTemplate||A?.UrlQueryInfo?.queryTemplate||"";R.finalQueryString=B===ye.default.QUERY_PART?R?.initialQueryString:""})(O,S,I.finalQueryString),S.sameOriginOnly=O?.ExtUrlQueryInfo?.sameOriginOnly,S.queryParams=Je.default.parseQueryParams(S?.finalQueryString),S.includeInRequests=(function(A,R){return A?A.ExtUrlQueryInfo?.includeInRequests?A.ExtUrlQueryInfo.includeInRequests.split(" "):[ye.default.SEGMENT_TYPE]:R})(O,I.includeInRequests)}return m=(0,o.default)(T).getInstance().getLogger(p),p={getFinalQueryString:function(S){try{if(!b)return null;if(S.type===ke.HTTPRequest.MEDIA_SEGMENT_TYPE||S.type===ke.HTTPRequest.INIT_SEGMENT_TYPE){const k=S.representation;if(!k)return null;const x=k.adaptation,I=x.period,N=b.period[I.index].adaptation[x.index].representation[k.index],O=new URL(S.url),A=!N.sameOriginOnly||b.origin===O.origin;if(N.includeInRequests.includes(ye.default.SEGMENT_TYPE)&&A)return N.queryParams}else if(S.type===ke.HTTPRequest.MPD_TYPE){if([ye.default.MPD_TYPE,ye.default.MPD_PATCH_TYPE].some((k=>b.includeInRequests.includes(k))))return b.queryParams}else if(S.type===ke.HTTPRequest.CONTENT_STEERING_TYPE&&b.includeInRequests.includes(ye.default.STEERING_TYPE))return b.queryParams}catch(k){return m.error(k),null}},createFinalQueryStrings:function(S){b={origin:new URL(S.url).origin,period:[]};const k=S.url.split("?")[1];v(b,S,k,{initialQueryString:"",includeInRequests:[]},ye.default.MPD),S.Period.forEach((x=>{const I={adaptation:[]};v(I,x,k,b,ye.default.PERIOD),x.AdaptationSet.forEach((N=>{const O={representation:[]};v(O,N,k,I,ye.default.ADAPTATION_SET),N.Representation.forEach((A=>{const R={};v(R,A,k,O,ye.default.REPRESENTATION),O.representation.push(R)})),I.adaptation.push(O)})),b.period.push(I)}))}},p}Vu.__dashjs_factory_name="ExtUrlQueryInfoController";var Hu=n.default.getSingletonFactory(Vu),Co=class{constructor(p){this.url=p.url,this.method=p.method,this.responseType=p.responseType!==void 0?p.responseType:null,this.headers=p.headers!==void 0?p.headers:{},this.credentials=p.credentials!==void 0?p.credentials:null,this.mode=p.mode!==void 0?p.mode:null,this.timeout=p.timeout!==void 0?p.timeout:0,this.cmcd=p.cmcd!==void 0?p.cmcd:null,this.customData=p.customData!==void 0?p.customData:null}},Lo=class{constructor(p){this.request=p.request,this.url=p.url!==void 0?p.url:null,this.redirected=p.redirected!==void 0&&p.redirected,this.status=p.status!==void 0?p.status:null,this.statusText=p.statusText!==void 0?p.statusText:"",this.type=p.type!==void 0?p.type:"",this.headers=p.headers!==void 0?p.headers:{},this.data=p.data!==void 0?p.data:null,this.resourceTiming=p.resourceTiming!==void 0?p.resourceTiming:null}};function Ku(p){p=p||{};const m=this.context,b=p.errHandler,T=p.dashMetrics,v=p.mediaPlayerModel,S=p.boxParser,k=p.errors,x=p.requestTimeout||0,I=(0,g.default)(m).getInstance(),N=(0,l.default)(m).getInstance();let O,A,R,C,B,$,V,j,te,ie,se,de,G,U;function P(M,ge){const X=function(){Ce()},be=function(vt){const Qt=new Date;le&&(le=!1,(!vt.lengthComputable||vt.lengthComputable&&vt.total!==vt.loaded)&&(ee.firstByteDate=Qt,we.resourceTiming.responseStart=Qt.getTime())),vt.lengthComputable&&(ee.bytesLoaded=we.length=vt.loaded,ee.bytesTotal=we.resourceTiming.encodedBodySize=vt.total,we.length=vt.total,we.resourceTiming.encodedBodySize=vt.loaded),vt.noTrace||(ne.push({s:ce,d:vt.time?vt.time:Qt.getTime()-ce.getTime(),b:[vt.loaded?vt.loaded-me:0],t:vt.throughput}),ee.traces=ne,ce=Qt,me=vt.loaded),Se&&(clearTimeout(Se),Se=null),N.get().streaming.fragmentRequestProgressTimeout>0&&(Se=setTimeout((function(){U.warn("Abort request "+Re.url+" due to progress timeout"),Ye.abort(Re),X()}),N.get().streaming.fragmentRequestProgressTimeout)),M.progress&&vt&&M.progress(vt)},fe=function(){Ce(!0)},Te=function(vt){let Qt;if(vt.lengthComputable){let un=vt.loaded/vt.total*100;Qt="Request timeout: loaded: "+vt.loaded+", out of: "+vt.total+" : "+un.toFixed(3)+"% Completed"}else Qt="Request timeout: non-computable download size";U.warn(Qt)},Ce=function(vt=!1){A.indexOf(Re)!==-1&&A.splice(A.indexOf(Re),1),Se&&(clearTimeout(Se),Se=null),se.processResponseHeaders(we),Ie(),q(),(function(Qt){const un=ie.getResponseInterceptors();return un?un.reduce(((Rn,xn)=>Rn.then((dn=>xn(dn)))),Promise.resolve(Qt)):Promise.resolve(Qt)})(we).then((Qt=>{if(we=Qt,(function(un,Rn,xn){const dn=un.customData.request,vn=N.get().streaming.cmsd&&N.get().streaming.cmsd.enabled?V.parseResponseHeaders(Rn.headers,dn.mediaType):null;T.addHttpRequest(dn,Rn.url,Rn.status,Rn.headers,xn,vn)})(Re,we,ne),vt)M.abort&&M.abort(ee);else if(ee.type===ke.HTTPRequest.MPD_TYPE&&(T.addManifestUpdate(ee),I.trigger(f.default.MANIFEST_LOADING_FINISHED,{requestObject:ee})),we.status>=200&&we.status<=299&&we.data)M.success&&M.success(we.data,we.statusText,we.url),M.complete&&M.complete(ee,we.statusText);else{try{we.status===404&&N.get().streaming.utcSynchronization.enableBackgroundSyncAfterSegmentDownloadError&&ee.type===ke.HTTPRequest.MEDIA_SEGMENT_TYPE&&v.getRetryAttemptsForType(ke.HTTPRequest.MEDIA_SEGMENT_TYPE)===ge&&I.trigger(f.default.ATTEMPT_BACKGROUND_SYNC)}catch{}re()}}))},Ie=function(){ee.startDate=z,ee.endDate=new Date,ee.firstByteDate=ee.firstByteDate||z},q=function(){we.resourceTiming.responseEnd=Date.now(),(function(vt,Qt){if(!N.get().streaming.abr.throughput.useResourceTimingApi||typeof performance>"u"||vt.range)return;const un=performance.getEntriesByType?.("resource");if(un===void 0||un.length<=0)return;let Rn=0,xn=null;for(;Rn<un.length;){if(un[Rn].name===vt.url){xn=un[Rn];break}Rn+=1}(function(dn){return dn&&!isNaN(dn.responseStart)&&dn.responseStart>0&&!isNaN(dn.responseEnd)&&dn.responseEnd>0&&!isNaN(dn.transferSize)&&dn.transferSize>0})(xn)&&(vt.customData.request.resourceTimingValues=xn,Qt.resourceTiming.startTime=xn.startTime,Qt.resourceTiming.encodedBodySize=xn.encodedBodySize,Qt.resourceTiming.responseStart=xn.startTime,Qt.resourceTiming.responseEnd=xn.responseEnd,Qt.resourceTiming.duration=xn.duration)})(Re,we)},W=function(vt,Qt,un){return new Promise((Rn=>{(function(xn){const dn=ie.getRequestInterceptors();return dn?dn.reduce(((vn,qe)=>vn.then((pt=>qe(pt)))),Promise.resolve(xn)):Promise.resolve(xn)})(Qt).then((xn=>{(Qt=xn).customData.onloadend=X,Qt.customData.onprogress=be,Qt.customData.onabort=fe,Qt.customData.ontimeout=Te,un.resourceTiming.startTime=Date.now(),vt.load(Qt,un),Rn()}))}))},re=function(){if(ge>0){ge--,M&&M.request&&(M.request.retryAttempts+=1);let vt={config:M};C.push(vt),vt.timeout=setTimeout((function(){C.indexOf(vt)!==-1&&(C.splice(C.indexOf(vt),1),P(M,ge))}),v.getRetryIntervalsForType(ee.type))}else{if(ee.type===ke.HTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE)return;b.error(new Wt.default(B[ee.type],ee.url+" is not available",{request:ee,response:we})),M.error&&M.error(ee,"error",we.statusText,we),M.complete&&M.complete(ee,we.statusText)}},ee=M.request,ne=[];let le,z,ce,me,Se,Re,we;if(ee.bytesLoaded=NaN,ee.bytesTotal=NaN,ee.firstByteDate=null,ee.traces=[],le=!0,z=new Date,ce=z,me=0,Se=null,!T||!b)throw new Error("config object is not correct or missing");const ze=(function(vt){let Qt,un;return!vt.isPartialSegmentRequest&&vt.hasOwnProperty("availabilityTimeComplete")&&vt.availabilityTimeComplete===!1&&window.fetch&&vt.responseType==="arraybuffer"&&vt.type===ke.HTTPRequest.MEDIA_SEGMENT_TYPE?(te||(te=Mn(m).create(),te.setConfig({dashMetrics:T,boxParser:S})),Qt=te,un=h.default.FILE_LOADER_TYPES.FETCH):(j||(j=tn(m).create()),Qt=j,un=h.default.FILE_LOADER_TYPES.XHR),{loader:Qt,fileLoaderType:un}})(ee),Ye=ze.loader;var ct;ee.fileLoaderType=ze.fileLoaderType,ee.headers={},(function(vt){const Qt=vt?.serviceLocation,un=vt?.mediaInfo?.id?.toString();if(de.isServiceLocationIncluded(vt.type,Qt)&&de.isAdaptationsIncluded(un)&&$.isCmcdEnabled()){const Rn=$.getCmcdParametersFromManifest(),xn=Rn.mode?Rn.mode:N.get().streaming.cmcd.mode;if(xn===h.default.CMCD_MODE_QUERY){vt.url=Je.default.removeQueryParameterFromUrl(vt.url,h.default.CMCD_QUERY_KEY);const dn=(function(vn){try{const qe=[],pt=$.getQueryParameter(vn);return pt&&qe.push(pt),qe}catch{return[]}})(vt);vt.url=Je.default.addAdditionalQueryParameterToUrl(vt.url,dn)}else xn===h.default.CMCD_MODE_HEADER&&(vt.headers=Object.assign(vt.headers,$.getHeaderParameters(vt)))}})(ct=ee),ct.retryAttempts===0&&(function(vt){let Qt=G.getFinalQueryString(vt);Qt&&(vt.url=Je.default.addAdditionalQueryParameterToUrl(vt.url,Qt))})(ct),(function(vt){if(vt.queryParams){const Qt=Object.keys(vt.queryParams).map((un=>({key:un,value:vt.queryParams[un]})));vt.url=Je.default.addAdditionalQueryParameterToUrl(vt.url,Qt)}})(ct),(function(vt){const Qt=se.getCommonAccessTokenForUrl(vt.url);Qt&&(vt.headers[h.default.COMMON_ACCESS_TOKEN_HEADER]=Qt)})(ct),ee.range&&(ee.headers.Range="bytes="+ee.range);const bt=ie.getXHRWithCredentialsForType(ee.type);Re=new Co({url:ee.url,method:ke.HTTPRequest.GET,responseType:ee.responseType,headers:ee.headers,credentials:bt?"include":"omit",timeout:x,cmcd:$.getCmcdData(ee),customData:{request:ee}}),we=new Lo({request:Re,resourceTiming:{startTime:Date.now(),encodedBodySize:0},status:0});let Zt=new Date().getTime();if(isNaN(ee.delayLoadingTime)||Zt>=ee.delayLoadingTime)return A.push(Re),W(Ye,Re,we);{let vt={httpRequest:Re,httpResponse:we};return R.push(vt),vt.delayTimeout=setTimeout((function(){if(R.indexOf(vt)!==-1){R.splice(R.indexOf(vt),1);try{z=new Date,ce=z,A.push(vt.httpRequest),W(Ye,vt.httpRequest,vt.httpResponse)}catch{vt.httpRequest.onloadend()}}}),ee.delayLoadingTime-Zt),Promise.resolve()}}return O={abort:function(){C.forEach((M=>{clearTimeout(M.timeout),M.config.request&&M.config.abort&&M.config.abort(M.config.request)})),C=[],R.forEach((M=>clearTimeout(M.delayTimeout))),R=[],A.forEach((M=>{const ge=M.customData;ge&&(ge.request&&ge.request.type===ke.HTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE||(ge.onloadend=ge.onprogress=void 0,ge.abort&&ge.abort()))})),A=[]},load:function(M){return M.request?P(M,v.getRetryAttemptsForType(M.request.type)):(M.error&&M.error(M.request,"error"),Promise.resolve())},reset:function(){A=[],R=[],C=[],j&&j.reset(),te&&te.reset(),j=null,te=null},resetInitialSettings:function(){j&&j.resetInitialSettings()},setConfig:function(M){M&&(M.commonAccessTokenController&&(se=M.commonAccessTokenController),M.extUrlQueryInfoController&&(G=M.extUrlQueryInfoController))}},U=(0,o.default)(m).getInstance().getLogger(O),A=[],R=[],C=[],$=Uu(m).getInstance(),de=$u(m).getInstance(),V=ju(m).getInstance(),ie=(0,ko.default)(m).getInstance(),se=Gm(m).getInstance(),G=Hu(m).getInstance(),B={[ke.HTTPRequest.MPD_TYPE]:k.DOWNLOAD_ERROR_ID_MANIFEST_CODE,[ke.HTTPRequest.XLINK_EXPANSION_TYPE]:k.DOWNLOAD_ERROR_ID_XLINK_CODE,[ke.HTTPRequest.INIT_SEGMENT_TYPE]:k.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE,[ke.HTTPRequest.MEDIA_SEGMENT_TYPE]:k.DOWNLOAD_ERROR_ID_CONTENT_CODE,[ke.HTTPRequest.INDEX_SEGMENT_TYPE]:k.DOWNLOAD_ERROR_ID_CONTENT_CODE,[ke.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE]:k.DOWNLOAD_ERROR_ID_CONTENT_CODE,[ke.HTTPRequest.OTHER_TYPE]:k.DOWNLOAD_ERROR_ID_CONTENT_CODE},O}Ku.__dashjs_factory_name="HTTPLoader";var $m=n.default.getClassFactory(Ku);function Yu(){let p,m;function b(){m={}}function T(){b()}return T(),p={getLoader:function(v){for(var S in m)if(m.hasOwnProperty(S)&&v.startsWith(S))return m[S];return $m},registerLoader:function(v,S){m[v]=S},unregisterLoader:function(v){m[v]&&delete m[v]},unregisterAllLoader:b,reset:T},p}Yu.__dashjs_factory_name="SchemeLoaderFactory";var Wu=n.default.getSingletonFactory(Yu);function Xu(p){p=p||{};const m=this.context;let b,T,v;return T=Wu(m).getInstance(),b={abort:function(){v&&v.abort()},load:function(S){v||(v=T.getLoader(S&&S.request?S.request.url:null)(m).create({errHandler:p.errHandler,mediaPlayerModel:p.mediaPlayerModel,dashMetrics:p.dashMetrics,boxParser:p.boxParser?p.boxParser:null,constants:p.constants?p.constants:null,dashConstants:p.dashConstants?p.dashConstants:null,urlUtils:p.urlUtils?p.urlUtils:null,requestTimeout:isNaN(p.requestTimeout)?0:p.requestTimeout,errors:p.errors})),v.load(S)},reset:function(){T&&(T.reset(),T=null),v&&typeof v.reset=="function"&&v.reset(),v=null},resetInitialSettings:function(){v&&typeof v.resetInitialSettings=="function"&&v.resetInitialSettings()}},b}Xu.__dashjs_factory_name="URLLoader";var ca=n.default.getClassFactory(Xu),Vm=class{constructor(p){this.url=p||null,this.type=ke.HTTPRequest.CONTENT_STEERING_TYPE,this.responseType="json"}},Hm=class{constructor(){this.version=null,this.ttl=300,this.reloadUri=null,this.pathwayPriority=[],this.pathwayClones=[]}};function Qu(){const p=this.context,m=Vn(p).getInstance();let b,T,v,S,k,x,I,N,O,A,R,C,B,$,V,j;function te(fe){de(fe,"baseUrl")}function ie(fe){de(fe,"location")}function se(fe){var Te,Ce;fe&&fe.throughputValues&&fe.throughputValues.serviceLocation&&(Te=fe.throughputValues.serviceLocation,Ce=fe.throughputValues,$[Te]||($[Te]=[]),$[Te].push(Ce),$[Te].length>4&&$[Te].shift())}function de(fe,Te){if(fe&&fe.request&&fe.request.serviceLocation){const Ce=fe.request.serviceLocation;C[Te].all.indexOf(Ce)===-1&&C[Te].all.push(Ce),C[Te].current=Ce}}function G(){const fe=N.getValue();let Te=b.getContentSteering(fe);return Te||(Te=R.getServiceDescriptionSettings().contentSteering),!Te&&T&&(Te=T),T=Te,Te}function U(){return new Promise((fe=>{try{const Te=G();if(!Te||!Te.serverUrl)return void fe();const Ce=(function(q){let W=q.serverUrl;v&&v.reloadUri&&(W=m.isRelative(v.reloadUri)?m.resolve(v.reloadUri,q.serverUrl):v.reloadUri);const re=[],ee=C.baseUrl.all.concat(C.location.all);if(ee.length>0){const ne=ee.map((ce=>{const me=(function(Se){if(!Se||!$[Se]||$[Se].length===0)return-1;const Re=B.getArithmeticMean($[Se],$[Se].length,!0);return parseInt(1e3*Re)})(ce);return{serviceLocation:ce,throughput:me}}));let le="",z="";ne.forEach(((ce,me)=>{me!==0&&(le+=",",z+=","),le+=ce.serviceLocation,z+=ce.throughput>-1?ce.throughput:""})),re.push({key:"_DASH_pathway",value:`"${le}"`}),re.push({key:"_DASH_throughput",value:z})}return W=Je.default.addAdditionalQueryParameterToUrl(W,re),W})(Te),Ie=new Vm(Ce);V.load({request:Ie,success:q=>{(function(W){W&&W[ye.default.CONTENT_STEERING_RESPONSE.VERSION]&&parseInt(W[ye.default.CONTENT_STEERING_RESPONSE.VERSION])===1&&(v=new Hm,v.version=W[ye.default.CONTENT_STEERING_RESPONSE.VERSION],W[ye.default.CONTENT_STEERING_RESPONSE.TTL]&&!isNaN(W[ye.default.CONTENT_STEERING_RESPONSE.TTL])&&(v.ttl=W[ye.default.CONTENT_STEERING_RESPONSE.TTL]),W[ye.default.CONTENT_STEERING_RESPONSE.RELOAD_URI]&&(v.reloadUri=W[ye.default.CONTENT_STEERING_RESPONSE.RELOAD_URI]),W[ye.default.CONTENT_STEERING_RESPONSE.PATHWAY_PRIORITY]&&(v.pathwayPriority=W[ye.default.CONTENT_STEERING_RESPONSE.PATHWAY_PRIORITY]),W[ye.default.CONTENT_STEERING_RESPONSE.PATHWAY_CLONES]&&(v.pathwayClones=W[ye.default.CONTENT_STEERING_RESPONSE.PATHWAY_CLONES],v.pathwayClones=v.pathwayClones.filter((re=>(function(ee){return ee[ye.default.CONTENT_STEERING_RESPONSE.BASE_ID]&&ee[ye.default.CONTENT_STEERING_RESPONSE.ID]&&ee[ye.default.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT]&&ee[ye.default.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT][ye.default.CONTENT_STEERING_RESPONSE.HOST]})(re)))),ge())})(q),x.trigger(y.default.CONTENT_STEERING_REQUEST_COMPLETED,{currentSteeringResponseData:v,url:Ce}),fe()},error:(q,W,re,ee)=>{(function(ne,le){try{switch(I.warn("Error fetching data from content steering server",ne),le.status){case 404:case 410:T=null;break;case 429:const z=le&&le.getResponseHeader?le.getResponseHeader("retry-after"):null;z!==null&&(v||(v={}),v.ttl=parseInt(z)),ge();break;default:ge()}}catch(z){I.error(z)}})(q,ee),fe(q)},complete:()=>{C.baseUrl.all=P(C.baseUrl),C.location.all=P(C.location)}})}catch(Te){fe(Te)}}))}function P(fe){return fe.all&&fe.all.length!==0&&fe.current?fe.all.filter((Te=>Te===fe.current)):[]}function M(fe){try{const Te=[];return fe&&fe.length!==0&&v&&v.pathwayClones&&v.pathwayClones.length!==0&&v.pathwayClones.forEach((Ce=>{let Ie=fe.filter((W=>Ce[ye.default.CONTENT_STEERING_RESPONSE.BASE_ID]===W.serviceLocation)),q=null;if(Ie&&Ie.length>0&&(q=Ie[0]),q){const W=new URL(q.url);let re=Ce[ye.default.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT][ye.default.CONTENT_STEERING_RESPONSE.HOST];re=Je.default.stringHasProtocol(re)?re:`${W.protocol}//${re}`;const ee={synthesizedUrl:`${re}${W.pathname}`,serviceLocation:Ce[ye.default.CONTENT_STEERING_RESPONSE.ID],queryParams:Ce[ye.default.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT][ye.default.CONTENT_STEERING_RESPONSE.PARAMS],reference:q};Te.push(ee)}})),Te}catch(Te){return I.error(Te),[]}}function ge(){v&&v.ttl&&!isNaN(v.ttl)&&(A&&clearTimeout(A),A=setTimeout((()=>{U()}),1e3*v.ttl))}function X(){A&&clearTimeout(A),A=null}function be(){v=null,T=null,$={},C={baseUrl:{current:null,all:[]},location:{current:null,all:[]}},X()}return j={reset:function(){be(),x.off(y.default.FRAGMENT_LOADING_STARTED,te,j),x.off(y.default.MANIFEST_LOADING_STARTED,ie,j),x.off(y.default.THROUGHPUT_MEASUREMENT_STORED,se,j)},setConfig:function(fe){fe&&(fe.adapter&&(b=fe.adapter),fe.errHandler&&(k=fe.errHandler),fe.dashMetrics&&(S=fe.dashMetrics),fe.mediaPlayerModel&&(O=fe.mediaPlayerModel),fe.manifestModel&&(N=fe.manifestModel),fe.serviceDescriptionController&&(R=fe.serviceDescriptionController),fe.throughputController&&(B=fe.throughputController),fe.eventBus&&(x=fe.eventBus))},loadSteeringData:U,getCurrentSteeringResponseData:function(){return v},shouldQueryBeforeStart:function(){const fe=G();return!!fe&&fe.queryBeforeStart},getSteeringDataFromManifest:G,stopSteeringRequestTimer:X,getSynthesizedBaseUrlElements:function(fe){try{return M(fe).map((Te=>{const Ce=new ar(Te.synthesizedUrl,Te.serviceLocation);return Ce.queryParams=Te.queryParams,Ce.dvbPriority=Te.reference.dvbPriority,Ce.dvbWeight=Te.reference.dvbWeight,Ce.availabilityTimeOffset=Te.reference.availabilityTimeOffset,Ce.availabilityTimeComplete=Te.reference.availabilityTimeComplete,Ce}))}catch(Te){return I.error(Te),[]}},getSynthesizedLocationElements:function(fe){try{return M(fe).map((Te=>{const Ce=new Ma(Te.synthesizedUrl,Te.serviceLocation);return Ce.queryParams=Te.queryParams,Ce}))}catch(Te){return I.error(Te),[]}},initialize:function(){V=ca(p).create({errHandler:k,dashMetrics:S,mediaPlayerModel:O,errors:Jt}),x.on(y.default.FRAGMENT_LOADING_STARTED,te,j),x.on(y.default.MANIFEST_LOADING_STARTED,ie,j),x.on(y.default.THROUGHPUT_MEASUREMENT_STORED,se,j)}},I=(0,o.default)(p).getInstance().getLogger(j),be(),j}Qu.__dashjs_factory_name="ContentSteeringController";var Do=n.default.getSingletonFactory(Qu);function Zu(){const p=this.context,m=(0,g.default)(p).getInstance();let b,T,v,S=[];function k(I=[],N=[]){let O=0,A=NaN;for(;O<I.length;){const R=I[O],C=N.findIndex((B=>B.serviceLocation&&B.serviceLocation===R));if(C!==-1&&!v.contains(N[C].serviceLocation)){A=C;break}O+=1}return A}function x(I){const N=T.getCurrentSteeringResponseData();if(!N)return;const O=I.entry,A=setTimeout((()=>{v.remove(O),S.splice(S.indexOf(A,1))}),1e3*N.ttl);S.push(A)}return b={selectBaseUrlIndex:function(I){let N=NaN;if(isNaN(I.selectedIdx)){const A=T.getSteeringDataFromManifest();A&&A.defaultServiceLocationArray.length>0&&(N=k(A.defaultServiceLocationArray,I.baseUrls))}const O=T.getCurrentSteeringResponseData();return I.baseUrls&&I.baseUrls.length&&O&&O.pathwayPriority&&O.pathwayPriority.length&&(N=k(O.pathwayPriority,I.baseUrls)),N},setConfig:function(I){I.blacklistController&&(v=I.blacklistController),I.contentSteeringController&&(T=I.contentSteeringController),m.on(I.addBlacklistEventName,x,b)},reset:function(){S.forEach((I=>clearTimeout(I))),S=[]}},T=Do(p).getInstance(),b}Zu.__dashjs_factory_name="ContentSteeringSelector";var Km=n.default.getClassFactory(Zu);function Ju(){const p=this.context,m=(0,g.default)(p).getInstance(),b=(0,l.default)(p).getInstance();let T,v,S,k,x,I;function N(){x.reset(),v.reset()}return T={chooseSelector:function(O){(0,gt.checkParameterType)(O,"boolean"),I=O?k:S},select:function(O){if(!O)return;if(b.get().streaming.applyContentSteering){const R=x.selectBaseUrlIndex(O);isNaN(R)||R===-1||(O.selectedIdx=R)}if(!isNaN(O.selectedIdx))return O.baseUrls[O.selectedIdx];let A=I.select(O.baseUrls);return A?(O.selectedIdx=O.baseUrls.indexOf(A),A):(m.trigger(f.default.URL_RESOLUTION_FAILED,{error:new Wt.default(Jt.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE,Jt.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE)}),void(I===S&&N()))},reset:N,setConfig:function(O){O.selector&&(I=O.selector),O.contentSteeringSelector&&(x=O.contentSteeringSelector)}},v=sn(p).create({updateEventName:f.default.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,addBlacklistEventName:f.default.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD}),S=Nn(p).create({blacklistController:v}),k=gn(p).create({blacklistController:v}),x=Km(p).create(),x.setConfig({blacklistController:v,addBlacklistEventName:f.default.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD}),I=S,T}Ju.__dashjs_factory_name="BaseURLSelector";var Ym=n.default.getClassFactory(Ju);function ec(){let p,m;const b=this.context,T=(0,g.default)(b).getInstance(),v=Vn(b).getInstance();let S,k,x;function I(O){S.update(O),k.chooseSelector(m.getIsDVB(O)),T.trigger(y.default.BASE_URLS_UPDATED,{baseUrls:N(O)})}function N(O){return S.getBaseUrls(O)}return p={reset:function(){S.reset(),k.reset()},initialize:function(O){S.setConfig({adapter:m,contentSteeringController:x}),I(O)},resolve:function(O){const A=S.getForPath(O).reduce(((R,C)=>{const B=k.select(C);return B?(v.isRelative(B.url)?R.url=v.resolve(B.url,R.url):(R.url=B.url,R.serviceLocation=B.serviceLocation),R.availabilityTimeOffset=B.availabilityTimeOffset,R.availabilityTimeComplete=B.availabilityTimeComplete,R.queryParams=B.queryParams,R):new ar}),new ar);if(!v.isRelative(A.url))return A},setConfig:function(O){O.baseURLTreeModel&&(S=O.baseURLTreeModel),O.baseURLSelector&&(k=O.baseURLSelector),O.adapter&&(m=O.adapter),O.contentSteeringController&&(x=O.contentSteeringController)},getBaseUrls:N,update:I},S=wt(b).create(),k=Ym(b).create(),T.on(f.default.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,(function(O){S.invalidateSelectedIndexes(O.entry)}),p),p}ec.__dashjs_factory_name="BaseURLController";var Wm=n.default.getClassFactory(ec);class Po{constructor(m){if(this.offset=m._offset,this.type=m.type,this.size=m.size,this.boxes=[],m.boxes)for(let b=0;b<m.boxes.length;b++)this.boxes.push(new Po(m.boxes[b]));switch(this.isComplete=!0,m.type){case"sidx":if(this.timescale=m.timescale,this.earliest_presentation_time=m.earliest_presentation_time,this.first_offset=m.first_offset,this.references=m.references,m.references){this.references=[];for(let b=0;b<m.references.length;b++){let T={reference_type:m.references[b].reference_type,referenced_size:m.references[b].referenced_size,subsegment_duration:m.references[b].subsegment_duration};this.references.push(T)}}break;case"emsg":this.id=m.id,this.version=m.version===1?1:0,this.value=m.value,this.timescale=m.timescale,this.scheme_id_uri=m.scheme_id_uri,this.presentation_time_delta=m.version===1?m.presentation_time:m.presentation_time_delta,this.event_duration=m.event_duration,this.message_data=m.message_data;break;case"mdhd":this.timescale=m.timescale;break;case"mfhd":this.sequence_number=m.sequence_number;break;case"subs":this.entry_count=m.entry_count,this.entries=m.entries;break;case"tfhd":this.base_data_offset=m.base_data_offset,this.sample_description_index=m.sample_description_index,this.default_sample_duration=m.default_sample_duration,this.default_sample_size=m.default_sample_size,this.default_sample_flags=m.default_sample_flags,this.flags=m.flags;break;case"tfdt":this.version=m.version,this.baseMediaDecodeTime=m.baseMediaDecodeTime,this.flags=m.flags;break;case"trun":if(this.sample_count=m.sample_count,this.first_sample_flags=m.first_sample_flags,this.data_offset=m.data_offset,this.flags=m.flags,this.samples=m.samples,m.samples){this.samples=[];for(let b=0,T=m.samples.length;b<T;b++){let v={sample_size:m.samples[b].sample_size,sample_duration:m.samples[b].sample_duration,sample_composition_time_offset:m.samples[b].sample_composition_time_offset};this.samples.push(v)}}break;case"prft":this.version=m.version,this.reference_track_ID=m.reference_track_ID,this.ntp_timestamp_sec=m.ntp_timestamp_sec,this.ntp_timestamp_frac=m.ntp_timestamp_frac,this.media_time=m.media_time,this.flags=m.flags}}getChildBox(m){for(let b=0;b<this.boxes.length;b++)if(this.boxes[b].type===m)return this.boxes[b]}getChildBoxes(m){let b=[];for(let T=0;T<this.boxes.length;T++)this.boxes[T].type===m&&b.push(this.boxes[T]);return b}}var Xm=Po;function tc(){let p,m;function b(v){let S=[];if(!v||!m||typeof m.fetchAll!="function")return S;let k,x=m.fetchAll(v);for(let I=0,N=x.length;I<N;I++)k=T(x[I]),k&&S.push(k);return S}function T(v){if(!v)return null;let S=new Xm(v);return v.hasOwnProperty("_incomplete")&&(S.isComplete=!v._incomplete),S}return p={getBox:function(v){return v&&m&&m.boxes&&m.boxes.length!==0&&typeof m.fetch=="function"?T(m.fetch(v)):null},getBoxes:b,setData:function(v){m=v},getLastBox:function(){if(!m||!m.boxes||!m.boxes.length)return null;let v=b(m.boxes[m.boxes.length-1].type);return v.length>0?v[v.length-1]:null}},p}tc.__dashjs_factory_name="IsoFile";var Qm=n.default.getClassFactory(tc),Ga=t(6877),No=class{constructor({found:p,sizeOfLastCompletedBox:m,sizeOfLastFoundTargetBox:b,startOffsetOfLastCompletedBox:T,startOffsetOfLastFoundTargetBox:v,typeOfLastCompletedBox:S,typeOfLastTargetBox:k}){this.found=p!==void 0&&p,this.sizeOfLastCompletedBox=m!==void 0?m:0,this.sizeOfLastFoundTargetBox=b!==void 0?b:0,this.startOffsetOfLastCompletedBox=T!==void 0?T:0,this.startOffsetOfLastFoundTargetBox=v!==void 0?v:0,this.typeOfLastCompletedBox=S!==void 0?S:null,this.typeOfLastTargetBox=k!==void 0?k:null}};function nc(){let p,m,b=this.context;function T(k){if(!k)return null;k.fileStart===void 0&&(k.fileStart=0);let x=Ga.parseBuffer(k),I=Qm(b).create();return I.setData(x),I}function v(k,x){return k[x+3]>>>0|k[x+2]<<8>>>0|k[x+1]<<16>>>0|k[x]<<24>>>0}function S(k,x){return String.fromCharCode(k[x++])+String.fromCharCode(k[x++])+String.fromCharCode(k[x++])+String.fromCharCode(k[x])}return m={findInitRange:function(k){let x,I,N=null;const O=T(k);if(!O)return N;const A=O.getBox("ftyp"),R=O.getBox("moov");return p.debug("Searching for initialization."),R&&R.isComplete&&(x=A?A.offset:R.offset,I=R.offset+R.size-1,N=x+"-"+I,p.debug("Found the initialization. Range: "+N)),N},findLastTopIsoBoxCompleted:function(k,x,I){if(I===void 0&&(I=0),!x||I+8>=x.byteLength)return new No({found:!1});const N=x instanceof ArrayBuffer?new Uint8Array(x):x;let O,A=0,R=0,C=null;for(;I<N.byteLength;){const B=v(N,I),$=S(N,I+4);if(B===0)break;I+B<=N.byteLength&&(k.indexOf($)>=0?O=new No({found:!0,startOffsetOfLastFoundTargetBox:I,sizeOfLastFoundTargetBox:B,typeOfLastTargetBox:$}):(A=I,R=B,C=$)),I+=B}return O||new No({found:!1,startOffsetOfLastCompletedBox:A,sizeOfLastCompletedBox:R,typeOfLastCompletedBox:C})},getMediaTimescaleFromMoov:function(k){let x=T(k),I=x?x.getBox("mdhd"):void 0;return I?I.timescale:NaN},getSamplesInfo:function(k){if(!k||k.byteLength===0)return{sampleList:[],lastSequenceNumber:NaN,totalDuration:NaN,numSequences:NaN};let x,I,N,O,A,R,C,B,$,V,j,te,ie,se,de,G,U,P=T(k),M=P.getBoxes("moof"),ge=P.getBoxes("mfhd");G=P.getBoxes("moof").length,de=ge[ge.length-1].sequence_number,N=0,R=[];let X=-1,be=-1;for(j=0;j<M.length;j++){let fe=M[j],Te=fe.getChildBoxes("traf");for($=0;$<Te.length;$++){let Ce=Te[$],Ie=Ce.getChildBox("tfhd"),q=Ce.getChildBox("tfdt");A=q.baseMediaDecodeTime;let W=Ce.getChildBoxes("trun"),re=Ce.getChildBoxes("subs");for(V=0;V<W.length;V++){let ee=W[V];for(N=ee.sample_count,se=(Ie.base_data_offset||0)+(ee.data_offset||0),B=0;B<N;B++){C=ee.samples[B],x=C.sample_duration!==void 0?C.sample_duration:Ie.default_sample_duration,O=C.sample_size!==void 0?C.sample_size:Ie.default_sample_size,I=C.sample_composition_time_offset!==void 0?C.sample_composition_time_offset:0;let ne={dts:A,cts:A+I,duration:x,offset:fe.offset+se,size:O,subSizes:[O]};if(re)for(te=0;te<re.length;te++){let le=re[te];if(X<le.entry_count-1&&B>be&&(X++,be+=le.entries[X].sample_delta),B==be){ne.subSizes=[];let z=le.entries[X];for(ie=0;ie<z.subsample_count;ie++)ne.subSizes.push(z.subsamples[ie].subsample_size)}}R.push(ne),se+=O,A+=x}}U=A-q.baseMediaDecodeTime}}return{sampleList:R,lastSequenceNumber:de,totalDuration:U,numSequences:G}},parse:T},p=(0,o.default)(b).getInstance().getLogger(m),m}nc.__dashjs_factory_name="BoxParser";var bs=n.default.getSingletonFactory(nc),rc=t(559);const Mo={0:void 0,1:{channels:1,lfe:0},2:{channels:2,lfe:0},3:{channels:3,lfe:0},4:{channels:4,lfe:0},5:{channels:5,lfe:0},6:{channels:5,lfe:1},7:{channels:7,lfe:1},8:{channels:2,lfe:0},9:{channels:3,lfe:0},10:{channels:4,lfe:0},11:{channels:6,lfe:1},12:{channels:7,lfe:1},13:{channels:22,lfe:2},14:{channels:7,lfe:1},15:{channels:10,lfe:2},16:{channels:9,lfe:1},17:{channels:11,lfe:1},18:{channels:13,lfe:1},19:{channels:11,lfe:1},20:{channels:13,lfe:1}};function ic(p){return p==0?0:p.toString(2).match(/1/g).length}function Oo(p,m){let b,T=parseInt("0x"+p,16),v=T&m[0],S=T&m[1];return b=ic(v)+2*ic(S),b}var ac=function(p,m=!1){let b;if(!p||!p.schemeIdUri||!p.value)return;const T=p.schemeIdUri,v=p.value;return T==="urn:mpeg:dash:23003:3:audio_channel_configuration:2011"||T==="urn:mpeg:mpegB:cicp:ChannelConfiguration"?b=Mo[v]&&Mo[v].channels+(m?Mo[v].lfe:0):T==="tag:dolby.com,2014:dash:audio_channel_configuration:2011"?b=(function(S,k){if(S.length===4)return Oo(S,[63880+(k?6:0),1648])})(v,m):T==="tag:dolby.com,2015:dash:audio_channel_configuration:2015"?b=(function(S,k){if(S.length===6)return S==="800000"?24:Oo(S,[56834+(k?4160:0),205245])})(v,m):T==="tag:dts.com,2014:dash:audio_channel_configuration:2012"?b=parseInt(v):T==="tag:dts.com,2018:uhd:audio_channel_configuration"&&(b=(function(S,k){if(!(S.length>8))return Oo(S,[4294901727+(k?65568:0),0])})(v,m)),b};function sc(){const p=this.context,m=(0,g.default)(p).getInstance();let b,T,v,S,k,x,I;function N(j,te,ie,se=void 0){const de=A(j,te,ie,se);return v.isCodecSupportedBasedOnTestedConfigurations(de,j)}function O(j,te,ie,se,de,G=void 0){const U=A(j,te,ie,G),P=JSON.stringify(U);se.has(P)||(se.add(P),de.push(U))}function A(j,te,ie,se){let de=null;switch(j){case h.default.VIDEO:de=(function(G,U,P){let M={codec:U,width:G&&G.width||null,height:G&&G.height||null,framerate:T.getFramerate(G)||null,bitrate:G&&G.bandwidth||null,isSupported:!0};if(G.tagName===ye.default.PRESELECTION&&P&&(M.width||(M.width=P.width||null),M.height||(M.height=P.height||null),M.bitrate||(M.bitrate=P.bandwidth||null),M.framerate||(M.framerate=T.getFramerate(P)||null)),S.get().streaming.capabilities.filterVideoColorimetryEssentialProperties&&(Object.assign(M,C(G)),G.tagName===ye.default.PRESELECTION&&P)){let be=C(P),fe=be.isSupported;delete be.isSupported,M.isSupported=M.isSupported&&fe,R(M,be)}let ge=M.isSupported;if(S.get().streaming.capabilities.filterHDRMetadataFormatEssentialProperties&&(Object.assign(M,B(G)),G.tagName===ye.default.PRESELECTION&&P)){let be=B(P),fe=be.isSupported;delete be.isSupported,M.isSupported=M.isSupported&&fe,R(M,be)}let X=M.isSupported;return ge&&X||(M.isSupported=!1),M})(te,ie,se);break;case h.default.AUDIO:de=(function(G,U,P){let M={codec:U,samplerate:G&&G.audioSamplingRate||null,bitrate:G&&G.bandwidth||null,isSupported:!0};return G.tagName===ye.default.PRESELECTION&&P&&(M.samplerate||(M.samplerate=P.audioSamplingRate||null),M.bitrate||(M.bitrate=P.bandwidth||null)),S.get().streaming.capabilities.filterAudioChannelConfiguration&&Object.assign(M,(function(ge,X){let be=ge[ye.default.AUDIO_CHANNEL_CONFIGURATION]||[],fe=null;be.length==0&&X&&(be=X[ye.default.AUDIO_CHANNEL_CONFIGURATION]||[]);const Te=be.map((Ce=>ac(Ce,!0)));return Te.every((Ce=>Ce==Te[0]))&&(fe=Te[0]),{channels:fe}})(G,P)),M})(te,ie,se);break;default:return de}return se&&(de=$(se,de)),$(te,de)}function R(j,te){for(const ie in te)Object.prototype.hasOwnProperty.call(te,ie)&&!(ie in j)&&(j[ie]=te[ie]);return j}function C(j){let te={colorGamut:null,transferFunction:null,isSupported:!0};for(const ie of j.EssentialProperty||[])ie.schemeIdUri===h.default.COLOUR_PRIMARIES_SCHEME_ID_URI&&["1","5","6","7"].includes(ie.value.toString())?te.colorGamut=h.default.MEDIA_CAPABILITIES_API.COLORGAMUT.SRGB:ie.schemeIdUri===h.default.COLOUR_PRIMARIES_SCHEME_ID_URI&&["11","12"].includes(ie.value.toString())?te.colorGamut=h.default.MEDIA_CAPABILITIES_API.COLORGAMUT.P3:ie.schemeIdUri===h.default.COLOUR_PRIMARIES_SCHEME_ID_URI&&["9"].includes(ie.value.toString())?te.colorGamut=h.default.MEDIA_CAPABILITIES_API.COLORGAMUT.REC2020:ie.schemeIdUri===h.default.COLOUR_PRIMARIES_SCHEME_ID_URI&&["2"].includes(ie.value.toString())?te.colorGamut=null:ie.schemeIdUri===h.default.COLOUR_PRIMARIES_SCHEME_ID_URI&&(te.isSupported=!1),ie.schemeIdUri===h.default.TRANSFER_CHARACTERISTICS_SCHEME_ID_URI&&["1","6","13","14","15"].includes(ie.value.toString())?te.transferFunction=h.default.MEDIA_CAPABILITIES_API.TRANSFERFUNCTION.SRGB:ie.schemeIdUri===h.default.TRANSFER_CHARACTERISTICS_SCHEME_ID_URI&&["16"].includes(ie.value.toString())?te.transferFunction=h.default.MEDIA_CAPABILITIES_API.TRANSFERFUNCTION.PQ:ie.schemeIdUri===h.default.TRANSFER_CHARACTERISTICS_SCHEME_ID_URI&&["18"].includes(ie.value.toString())?te.transferFunction=h.default.MEDIA_CAPABILITIES_API.TRANSFERFUNCTION.HLG:ie.schemeIdUri===h.default.TRANSFER_CHARACTERISTICS_SCHEME_ID_URI&&["2"].includes(ie.value.toString())?te.transferFunction=null:ie.schemeIdUri===h.default.TRANSFER_CHARACTERISTICS_SCHEME_ID_URI&&(te.isSupported=!1);return te}function B(j){let te={isSupported:!0,hdrMetadataType:null};for(const ie of j.EssentialProperty||[])ie.schemeIdUri===h.default.HDR_METADATA_FORMAT_SCHEME_ID_URI&&ie.value===h.default.HDR_METADATA_FORMAT_VALUES.ST2094_10?te.hdrMetadataType=h.default.MEDIA_CAPABILITIES_API.HDR_METADATATYPE.SMPTE_ST_2094_10:ie.schemeIdUri===h.default.HDR_METADATA_FORMAT_SCHEME_ID_URI&&ie.value===h.default.HDR_METADATA_FORMAT_VALUES.SL_HDR2?te.hdrMetadataType=h.default.MEDIA_CAPABILITIES_API.HDR_METADATATYPE.SLHDR2:ie.schemeIdUri===h.default.HDR_METADATA_FORMAT_SCHEME_ID_URI&&ie.value===h.default.HDR_METADATA_FORMAT_VALUES.ST2094_40?te.hdrMetadataType=h.default.MEDIA_CAPABILITIES_API.HDR_METADATATYPE.SMPTE_ST_2094_40:ie.schemeIdUri===h.default.HDR_METADATA_FORMAT_SCHEME_ID_URI&&(te.isSupported=!1);return te}function $(j,te){return x&&j&&j[ye.default.CONTENT_PROTECTION]&&j[ye.default.CONTENT_PROTECTION].length>0&&(te.keySystemsMetadata=x.getSupportedKeySystemMetadataFromContentProtection(j[ye.default.CONTENT_PROTECTION])),te}function V(j){if(!j||j.length===0)return!0;let te=0;for(;te<j.length;){if(!v.supportsEssentialProperty(j[te]))return I.debug("[Stream] EssentialProperty not supported: "+j[te].schemeIdUri),!1;te+=1}return!0}return b={setConfig:function(j){j&&(j.adapter&&(T=j.adapter),j.capabilities&&(v=j.capabilities),j.settings&&(S=j.settings),j.protectionController&&(x=j.protectionController),j.customParametersModel&&(k=j.customParametersModel))},filterUnsupportedFeatures:function(j){return new Promise((te=>{const ie=[h.default.VIDEO,h.default.AUDIO],se=[];ie.forEach((de=>{(function(U,P){if(!U||!U.Period||U.Period.length===0)return[];const M=new Set,ge=[];return U.Period.forEach((X=>{X.AdaptationSet.forEach((be=>{T.getIsTypeOf(be,P)&&be.Representation.forEach(((fe,Te)=>{const Ce=T.getCodec(be,Te,!1);O(P,fe,Ce,M,ge);const Ie=T.getSupplementalCodecs(fe);Ie.length>0&&O(P,fe,Ie[0],M,ge)}))})),X.Preselection&&X.Preselection.length&&X.Preselection.forEach((be=>{if(T.getPreselectionIsTypeOf(be,X.AdaptationSet,P)){const fe=T.getCodecForPreselection(be,X.AdaptationSet),Te=T.getCommonRepresentationForPreselection(be,X.AdaptationSet);O(P,be,fe,M,ge,Te)}}))})),ge})(j,de).forEach((U=>{se.push(v.runCodecSupportCheck(U,de))}))})),Promise.allSettled(se).then((()=>(ie.forEach((de=>{(function(G,U){U&&U.Period&&U.Period.length!==0&&U.Period.forEach((P=>{(function(M,ge){M&&M.AdaptationSet&&M.AdaptationSet.length!==0&&(M.AdaptationSet=M.AdaptationSet.filter((X=>{T.getIsTypeOf(X,ge)&&(function(fe,Te){fe.Representation&&fe.Representation.length!==0&&(fe.Representation=fe.Representation.filter(((Ce,Ie)=>{const q=T.getCodec(fe,Ie,!1),W=N(Te,Ce,q);let re=(function(ee,ne){let le=!1;const z=T.getSupplementalCodecs(ee);return z.length>0&&(z.length>1&&I.warn("[CapabilitiesFilter] Multiple supplemental codecs not supported; using the first in list"),le=N(ne,ee,z[0])),le})(Ce,Te);return re&&(I.debug(`[CapabilitiesFilter] Codec supported. Upgrading codecs string of Representation with ID ${Ce.id}`),Ce.codecs=Ce[ye.default.SUPPLEMENTAL_CODECS]),W||re||I.warn(`[CapabilitiesFilter] Codec ${q} not supported. Removing Representation with ID ${Ce.id}`),W||re})))})(X,ge);const be=X.Representation&&X.Representation.length>0;return be||(m.trigger(f.default.ADAPTATION_SET_REMOVED_NO_CAPABILITIES,{adaptationSet:X}),I.warn(`[CapabilitiesFilter] AdaptationSet with ID ${X.id?X.id:"undefined"} and codec ${X.codecs?X.codecs:"undefined"} has been removed because of no supported Representation`)),be})))})(P,G),(function(M,ge){M&&M.Preselection&&M.Preselection.length!==0&&(M.Preselection=M.Preselection.filter((X=>{if(T.getPreselectionIsTypeOf(X,M.AdaptationSet,ge)){const be=T.getCodecForPreselection(X,M.AdaptationSet);let fe=!0;if(be){let Te=T.getCommonRepresentationForPreselection(X,M.AdaptationSet);fe=N(ge,X,be,Te)}return fe||I.warn(`[CapabilitiesFilter] Preselection@codecs ${be} not supported. Removing Preselection with ID ${X.id}`),fe}return!0})))})(P,G)}))})(de,j)})),S.get().streaming.capabilities.filterUnsupportedEssentialProperties&&(function(de){de&&de.Period&&de.Period.length!==0&&de.Period.forEach((G=>{G.AdaptationSet=G.AdaptationSet.filter((U=>!U.Representation||U.Representation.length===0||!!V(T.getEssentialProperties(U))&&(U.Representation=U.Representation.filter((P=>V(T.getEssentialProperties(P)))),U.Representation&&U.Representation.length>0))),G.Preselection&&G.Preselection.length&&(G.Preselection=G.Preselection.filter((U=>!!V(T.getEssentialProperties(U))||(I.warn(`[CapabilitiesFilter] removed Preselection (id: ${U.id}) with unsupported EssentialProperty`),!1))))}))})(j),(function(de){de&&de.Period&&de.Period.length!==0&&de.Period.forEach((G=>{G.Preselection&&(G.Preselection=G.Preselection.filter((U=>{const P=String(U.preselectionComponents).split(" ").length;return P!==1&&I.warn(`Multi-Representation Preselection (id: ${U.id}) removed as not supported.`),P===1})))}))})(j),(function(de){de&&de.Period&&de.Period.length!==0&&de.Period.forEach((G=>{G.Preselection&&(G.Preselection=G.Preselection.filter((U=>{const P=String(U.preselectionComponents).split(" "),M=G.AdaptationSet.map((ge=>ge.id));return P.every((ge=>M.includes(ge)))})))}))})(j),(function(de){if(!de||!de.Period||de.Period.length===0)return Promise.resolve();const G=[];return de.Period.forEach((U=>{G.push((function(P){return new Promise((M=>{if(!P||!P.AdaptationSet||P.AdaptationSet.length===0)return void M();const ge=[];P.AdaptationSet.forEach((X=>{ge.push((function(be){return new Promise((fe=>{if(!be.Representation||be.Representation.length===0)return void fe();const Te=[];be.Representation.forEach((Ce=>{Te.push((function(Ie){const q=[],W=k.getCustomCapabilitiesFilters();return W&&W.length!==0?W.forEach((re=>{q.push(new Promise((ee=>ee(re(Ie)))))})):q.push(Promise.resolve(!0)),Promise.all(q)})(Ce))})),Promise.all(Te).then((Ce=>{be.Representation=be.Representation.filter(((Ie,q)=>{let W=Ce[q].every((re=>re));return W||I.debug("[Stream] Representation "+Ie.id+" has been removed because of unsupported CustomFilter"),W})),fe()})).catch((Ce=>{I.warn("[Stream] at least one promise rejected in CustomFilter with error: ",Ce),fe()}))}))})(X))})),Promise.all(ge).then((()=>{P.AdaptationSet=P.AdaptationSet.filter((X=>X.Representation&&X.Representation.length>0)),M()})).catch((()=>{M()}))}))})(U))})),Promise.all(G)})(j)))).then((()=>{te()})).catch((de=>{I.error(de),te()}))}))}},I=(0,o.default)(p).getInstance().getLogger(b),b}sc.__dashjs_factory_name="CapabilitiesFilter";var Zm=n.default.getSingletonFactory(sc);function oc(){const p=this.context,m=(0,g.default)(p).getInstance();let b,T,v,S,k,x,I,N,O,A;function R(){T=!1;const de=Je.default.parseUserAgent();v=de&&de.browser&&de.browser.name&&de.browser.name.toLowerCase()==="safari"}function C(){T=!1}function B(de){if(de.streamId!==x.getActiveStreamInfo().id||!O)return;const G=I.getLiveDelay();I.getBufferLevel()>G/2&&(O=!1)}function $(de){de.streamId===x.getActiveStreamInfo().id&&(O=de.state===i.BUFFER_EMPTY)}function V(){N.getCatchupModeEnabled()||S.setPlaybackRate(1)}function j(){I.getIsDynamic()&&N.getCatchupModeEnabled()&&(N.getCatchupPlaybackRates().max>0||N.getCatchupPlaybackRates().min<0)&&!I.isPaused()&&!I.isSeeking()&&(function(){try{return!I.getTime()>0||T?!1:ie()===h.default.LIVE_CATCHUP_MODE_LOLP?(function(de,G){try{return Math.abs(te())>0||de<G}catch{return!1}})(I.getBufferLevel(),k.get().streaming.liveCatchup.playbackBufferMin):(function(){try{return Math.abs(te())>0}catch{return!1}})()}catch{return!1}})()&&(function(){if(!T&&S){let de;const G=S.getPlaybackRate(),U=N.getCatchupPlaybackRates(),P=I.getBufferLevel(),M=te(),ge=N.getCatchupMaxDrift();if(!isNaN(ge)&&ge>0&&M>ge)A.info("[CatchupController]: Low Latency catchup mechanism. Latency too high, doing a seek to live point"),T=!0,I.seekToCurrentLive(!0,!1);else{const X=I.getCurrentLiveLatency(),be=I.getLiveDelay();de=ie()===h.default.LIVE_CATCHUP_MODE_LOLP?(function(Te,Ce,Ie,q,W){let re;if(W<q){const ee=Math.abs(Te.min),ne=5*(W-q);re=1-ee+2*ee/(1+Math.pow(Math.E,-ne)),A.debug("[LoL+ playback control_buffer-based] bufferLevel: "+W+", newRate: "+re)}else{if(Math.abs(Ce-Ie)<=.02*Ie)re=1;else{const ne=Ce-Ie,le=ne<0?Math.abs(Te.min):Te.max,z=5*ne;re=1-le+2*le/(1+Math.pow(Math.E,-z))}A.debug("[LoL+ playback control_latency-based] latency: "+Ce+", newRate: "+re)}return re})(U,X,be,k.get().streaming.liveCatchup.playbackBufferMin,P):(function(Te,Ce,Ie,q){if(O)return 1;const W=Ce-Ie,re=W<0?Math.abs(Te.min):Te.max,ee=5*W;let ne=1-re+2*re/(1+Math.pow(Math.E,-ee));return I.getPlaybackStalled()&&q<=Ie/2&&W>0&&(ne=1),ne})(U,X,be,P);const fe=v?.25:.02/(.5/U.max);(de&&Math.abs(G-de)>=fe||de==1)&&(A.debug(`[CatchupController]: Setting playback rate to ${de}`),S.setPlaybackRate(de))}}})()}function te(){return I.getCurrentLiveLatency()-I.getLiveDelay()}function ie(){const de=k.get().streaming.liveCatchup.playbackBufferMin;return k.get().streaming.liveCatchup.mode!==h.default.LIVE_CATCHUP_MODE_LOLP||de===null||isNaN(de)?h.default.LIVE_CATCHUP_MODE_DEFAULT:h.default.LIVE_CATCHUP_MODE_LOLP}function se(){N.getCatchupPlaybackRates(!0)}return b={reset:function(){m.off(y.default.BUFFER_LEVEL_UPDATED,B,b),m.off(y.default.BUFFER_LEVEL_STATE_CHANGED,$,b),m.off(y.default.PLAYBACK_PROGRESS,j,b),m.off(y.default.PLAYBACK_TIME_UPDATED,j,b),m.off(y.default.PLAYBACK_SEEKED,C,b),m.off(f.default.SETTING_UPDATED_CATCHUP_ENABLED,V,b),m.off(f.default.SETTING_UPDATED_PLAYBACK_RATE_MIN,se,b),m.off(f.default.SETTING_UPDATED_PLAYBACK_RATE_MAX,se,b),m.off(y.default.STREAM_INITIALIZED,se,b),R(),S.setPlaybackRate(1,!0)},setConfig:function(de){de&&(de.settings&&(k=de.settings),de.videoModel&&(S=de.videoModel),de.streamController&&(x=de.streamController),de.playbackController&&(I=de.playbackController),de.mediaPlayerModel&&(N=de.mediaPlayerModel))},initialize:function(){m.on(y.default.BUFFER_LEVEL_UPDATED,B,b),m.on(y.default.BUFFER_LEVEL_STATE_CHANGED,$,b),m.on(y.default.PLAYBACK_PROGRESS,j,b),m.on(y.default.PLAYBACK_TIME_UPDATED,j,b),m.on(y.default.PLAYBACK_SEEKED,C,b),m.on(f.default.SETTING_UPDATED_CATCHUP_ENABLED,V,b),m.on(f.default.SETTING_UPDATED_PLAYBACK_RATE_MIN,se,b),m.on(f.default.SETTING_UPDATED_PLAYBACK_RATE_MAX,se,b),m.on(y.default.STREAM_INITIALIZED,se,b),se()}},A=(0,o.default)(p).getInstance().getLogger(b),R(),b}oc.__dashjs_factory_name="CatchupController";var Jm=n.default.getSingletonFactory(oc);const ep=[{oldKey:"dashjs_vbitrate",newKey:"dashjs_video_bitrate"},{oldKey:"dashjs_abitrate",newKey:"dashjs_audio_bitrate"},{oldKey:"dashjs_vsettings",newKey:"dashjs_video_settings"},{oldKey:"dashjs_asettings",newKey:"dashjs_audio_settings"}],lc="dashjs_?_bitrate",uc="dashjs_?_settings",da="localStorage",cc="lastBitrate",dc="lastMediaSettings";function fc(p){p=p||{};const m=this.context,b=p.settings;let T,v,S;function k(O){if(S!==void 0)return S;let A;S=!1;try{typeof window<"u"&&(A=window[O])}catch(R){return v.warn("DOMStorage access denied: "+R.message),S}if(!A||O!==da)return S;try{A.setItem("1","1"),A.removeItem("1"),S=!0}catch(R){v.warn("DOMStorage is supported, but cannot be used: "+R.message)}return S}function x(){return Math.round(new Date().getTime()/6e5)*6e5}function I(O,A){return k(O)&&b.get().streaming[A+"CachingInfo"].enabled}function N(){if(!b)throw new Error(h.default.MISSING_CONFIG_ERROR)}return T={getSavedBitrateSettings:function(O){if(N(),!b.get().streaming.lastBitrateCachingInfo.enabled)return NaN;let A=NaN;if(I(da,cc)){const R=lc.replace(/\?/,O);try{const C=JSON.parse(localStorage.getItem(R))||{},B=new Date().getTime()-parseInt(C.timestamp,10)>=b.get().streaming.lastBitrateCachingInfo.ttl||!1,$=parseFloat(C.bitrate);isNaN($)||B?B&&localStorage.removeItem(R):(A=$,v.debug("Last saved bitrate for "+O+" was "+$))}catch{return null}}return A},setSavedBitrateSettings:function(O,A){if(I(da,cc)&&A){const R=lc.replace(/\?/,O);try{localStorage.setItem(R,JSON.stringify({bitrate:A.toFixed(3),timestamp:x()}))}catch(C){v.error(C.message)}}},getSavedMediaSettings:function(O){if(N(),!b.get().streaming.lastMediaSettingsCachingInfo.enabled)return null;let A=null;if(I(da,dc)){const R=uc.replace(/\?/,O);try{const C=JSON.parse(localStorage.getItem(R))||{},B=new Date().getTime()-parseInt(C.timestamp,10)>=b.get().streaming.lastMediaSettingsCachingInfo.ttl||!1;A=C.settings,B&&(localStorage.removeItem(R),A=null)}catch{return null}}return A},setSavedMediaSettings:function(O,A){if(I(da,dc)){const R=uc.replace(/\?/,O);try{localStorage.setItem(R,JSON.stringify({settings:A,timestamp:x()}))}catch(C){v.error(C.message)}}}},v=(0,o.default)(m).getInstance().getLogger(T),k(da)&&ep.forEach((O=>{const A=localStorage.getItem(O.oldKey);if(A){localStorage.removeItem(O.oldKey);try{localStorage.setItem(O.newKey,A)}catch(R){v.error(R.message)}}})),T}fc.__dashjs_factory_name="DOMStorage";var tp=n.default.getSingletonFactory(fc),Ts=class{constructor(){this.accessibility=null,this.adaptationSetSwitchingCompatibleIds=[],this.audioChannelConfiguration=null,this.bitrateList=null,this.codec=null,this.contentProtection=null,this.essentialProperties=[],this.id=null,this.index=null,this.isEmbedded=null,this.isFragmented=null,this.isPreselection=!1,this.isText=!1,this.labels=null,this.lang=null,this.mimeType=null,this.normalizedKeyIds=new Set,this.representationCount=0,this.roles=null,this.segmentAlignment=!1,this.segmentSequenceProperties=[],this.selectionPriority=1,this.streamInfo=null,this.subSegmentAlignment=!1,this.supplementalProperties=[],this.type=null,this.viewpoint=null}},hc=class{constructor(){this.id=null,this.index=null,this.start=NaN,this.duration=NaN,this.manifestInfo=null,this.isLast=!0,this.isEncrypted=!1}},np=class{constructor(){this.availableFrom=null,this.duration=NaN,this.dvrWindowSize=NaN,this.isDynamic=!1,this.loadedTime=null,this.maxFragmentDuration=null,this.minBufferTime=NaN,this.protocol=null,this.serviceDescriptions=[]}},rp=class{constructor(p){this.valid=p[0]=="/",this.path=p.split("/").filter((m=>m.length!==0)).map((m=>{let b={name:m},T=m.indexOf("[");if(T!=-1){b.name=m.substring(0,T);let v=m.substring(T+1,m.length-1);this.valid=this.valid&&v.indexOf("[")==-1;let S=v.indexOf("=");S!=-1?(b.attribute={name:v.substring(1,S),value:v.substring(S+1)},["'",'"'].indexOf(b.attribute.value[0])!=-1&&(b.attribute.value=b.attribute.value.substring(1,b.attribute.value.length-1))):b.position=parseInt(v,10)-1}return b}))}isValid(){return this.valid}findsElement(){return!this.findsAttribute()}findsAttribute(){return this.path[this.path.length-1].name.startsWith("@")}findsTextReplace(){return this.path[this.path.length-1].name==="text()"}getMpdTarget(p,m){let b=null,T=p,v=1,S="MPD";for(;v<this.path.length&&T!==null;){b=T;let k=this.path[v];if(S=k.name,v!==this.path.length-1||!S.startsWith("@")&&S!=="text()"){let x=b[S]||[];if(x.length===0&&b[S]&&x.push(b[S]),k.position)T=x[k.position]||null;else if(k.attribute){let I=k.attribute;T=x.filter((N=>N[I.name]==I.value))[0]||null}else T=Array.isArray(x)?x[0]:x}v++}return T===null?null:S.startsWith("@")?{name:S.substring(1),leaf:T,target:T}:S==="text()"?{name:"__text",leaf:T,target:T}:{name:S,leaf:T,target:m?b:T}}},ip=class{constructor(p,m,b){this.action=p,this.xpath=m,this.value=b,this.position=null}getMpdTarget(p){let m=this.action==="remove"||this.action==="replace"||this.position==="before"||this.position==="after";return this.xpath.getMpdTarget(p,m)}};function gc(){let p,m;const b=this.context;return p={getIsPatch:function(T){return T&&T.hasOwnProperty(ye.default.ORIGINAL_MPD_ID)||!1},getMpdId:function(T){return T&&T[ye.default.ORIGINAL_MPD_ID]||null},getOriginalPublishTime:function(T){return T&&T.hasOwnProperty(ye.default.ORIGINAL_PUBLISH_TIME)?new Date(T[ye.default.ORIGINAL_PUBLISH_TIME]):null},getPatchOperations:function(T){return T?(T.__children||[]).map((v=>{const S=v.tagName;if(S!=="add"&&S!=="remove"&&S!=="replace")return m.warn(`Ignoring node of invalid action: ${S}`),null;let k=v.sel;if(S==="add"&&v.type){if(!v.type.startsWith("@"))return m.warn(`Ignoring add action for prefixed namespace declaration: ${v.type}=${v.__text}`),null;k=`${k}/${v.type}`}let x=new rp(k);if(!x.isValid())return m.warn(`Ignoring action with invalid selector: ${S} - ${k}`),null;let I=null;x.findsAttribute()||x.findsTextReplace()?I=v.__text||"":S!=="remove"&&(I=v.__children.reduce(((O,A)=>{let R=A.tagName;return R!=="#text"&&(O[R]=O[R]||[],O[R].push(A)),O}),{}));let N=new ip(S,x,I);return S==="add"&&(N.position=v.pos),N})).filter((v=>!!v)):[]},getPublishTime:function(T){return T&&T.hasOwnProperty(ye.default.PUBLISH_TIME)?new Date(T[ye.default.PUBLISH_TIME]):null}},m=(0,o.default)(b).getInstance().getLogger(p),p}gc.__dashjs_factory_name="PatchManifestModel";var ap=n.default.getSingletonFactory(gc);function Zi(p={}){let m=[];if(p.irregular)return p.irregular;if(p.regular)return p.regular;if(p.language){m=m.concat(p.language,p.extendedLanguageSubtags||[],p.script||[],p.region||[],p.variants||[]);const b=p.extensions||[];let T=-1;for(;++T<b.length;){const v=b[T];v.singleton&&v.extensions&&v.extensions.length>0&&m.push(v.singleton,...v.extensions)}}return p.privateuse&&p.privateuse.length>0&&m.push("x",...p.privateuse),m.join("-")}function Pr(p){const m=typeof p=="string"?p.charCodeAt(0):p;return m>=97&&m<=122||m>=65&&m<=90}function fa(p){const m=typeof p=="string"?p.charCodeAt(0):p;return m>=48&&m<=57}function Fi(p){return Pr(p)||fa(p)}const sp=["art-lojban","cel-gaulish","no-bok","no-nyn","zh-guoyu","zh-hakka","zh-min","zh-min-nan","zh-xiang"],mc={"en-gb-oed":"en-GB-oxendict","i-ami":"ami","i-bnn":"bnn","i-default":null,"i-enochian":null,"i-hak":"hak","i-klingon":"tlh","i-lux":"lb","i-mingo":null,"i-navajo":"nv","i-pwn":"pwn","i-tao":"tao","i-tay":"tay","i-tsu":"tsu","sgn-be-fr":"sfb","sgn-be-nl":"vgt","sgn-ch-de":"sgg","art-lojban":"jbo","cel-gaulish":null,"no-bok":"nb","no-nyn":"nn","zh-guoyu":"cmn","zh-hakka":"hak","zh-min":null,"zh-min-nan":"nan","zh-xiang":"hsn"},op={}.hasOwnProperty;function Ui(p,m={}){const b={language:null,extendedLanguageSubtags:[],script:null,region:null,variants:[],extensions:[],privateuse:[],irregular:null,regular:null},T=String(p),v=T.toLowerCase();let S=0;if(p==null)throw new Error("Expected string, got `"+p+"`");if(op.call(mc,v)){const x=mc[v];return m.normalize!==void 0&&m.normalize!==null&&!m.normalize||typeof x!="string"?(b[sp.includes(v)?"regular":"irregular"]=T,b):Ui(x)}for(;Pr(v.charCodeAt(S))&&S<9;)S++;if(S>1&&S<9){if(b.language=T.slice(0,S),S<4){let x=0;for(;v.charCodeAt(S)===45&&Pr(v.charCodeAt(S+1))&&Pr(v.charCodeAt(S+2))&&Pr(v.charCodeAt(S+3))&&!Pr(v.charCodeAt(S+4));){if(x>2)return k(S,3,"Too many extended language subtags, expected at most 3 subtags");b.extendedLanguageSubtags.push(T.slice(S+1,S+4)),S+=4,x++}}for(v.charCodeAt(S)===45&&Pr(v.charCodeAt(S+1))&&Pr(v.charCodeAt(S+2))&&Pr(v.charCodeAt(S+3))&&Pr(v.charCodeAt(S+4))&&!Pr(v.charCodeAt(S+5))&&(b.script=T.slice(S+1,S+5),S+=5),v.charCodeAt(S)===45&&(Pr(v.charCodeAt(S+1))&&Pr(v.charCodeAt(S+2))&&!Pr(v.charCodeAt(S+3))?(b.region=T.slice(S+1,S+3),S+=3):fa(v.charCodeAt(S+1))&&fa(v.charCodeAt(S+2))&&fa(v.charCodeAt(S+3))&&!fa(v.charCodeAt(S+4))&&(b.region=T.slice(S+1,S+4),S+=4));v.charCodeAt(S)===45;){const x=S+1;let I=x;for(;Fi(v.charCodeAt(I));){if(I-x>7)return k(I,1,"Too long variant, expected at most 8 characters");I++}if(!(I-x>4||I-x>3&&fa(v.charCodeAt(x))))break;b.variants.push(T.slice(x,I)),S=I}for(;v.charCodeAt(S)===45&&v.charCodeAt(S+1)!==120&&Fi(v.charCodeAt(S+1))&&v.charCodeAt(S+2)===45&&Fi(v.charCodeAt(S+3));){let x=S+2,I=0;for(;v.charCodeAt(x)===45&&Fi(v.charCodeAt(x+1))&&Fi(v.charCodeAt(x+2));){const N=x+1;for(x=N+2,I++;Fi(v.charCodeAt(x));){if(x-N>7)return k(x,2,"Too long extension, expected at most 8 characters");x++}}if(!I)return k(x,4,"Empty extension, extensions must have at least 2 characters of content");b.extensions.push({singleton:T.charAt(S+1),extensions:T.slice(S+3,x).split("-")}),S=x}}else S=0;if(S===0&&v.charCodeAt(S)===120||v.charCodeAt(S)===45&&v.charCodeAt(S+1)===120){S=S?S+2:1;let x=S;for(;v.charCodeAt(x)===45&&Fi(v.charCodeAt(x+1));){const I=S+1;for(x=I;Fi(v.charCodeAt(x));){if(x-I>7)return k(x,5,"Too long private-use area, expected at most 8 characters");x++}b.privateuse.push(T.slice(S+1,x)),S=x}}return S!==T.length?k(S,6,"Found superfluous content after tag"):b;function k(x,I,N){return m.warning&&m.warning(N,I,x),m.forgiving?b:{language:null,extendedLanguageSubtags:[],script:null,region:null,variants:[],extensions:[],privateuse:[],irregular:null,regular:null}}}function lp(p,m){return function(b,T){let v=pc(b,"tag");const S=pc(T??"*","range"),k=[];let x=-1;for(;++x<S.length;){const I=S[x].toLowerCase();if(!m&&I==="*")continue;let N=-1;const O=[];for(;++N<v.length;)if(p(v[N].toLowerCase(),I)){if(!m)return v[N];k.push(v[N])}else O.push(v[N]);v=O}return m?k:void 0}}const Fo=lp((function(p,m){const b=p.split("-"),T=m.split("-");let v=0,S=0;if(T[S]!=="*"&&b[v]!==T[S])return!1;for(v++,S++;S<T.length;)if(T[S]!=="*"){if(!b[v])return!1;if(b[v]!==T[S]){if(b[v].length===1)return!1;v++}else v++,S++}else S++;return!0}),!0);function pc(p,m){const b=p&&typeof p=="string"?[p]:p;if(!b||typeof b!="object"||!("length"in b))throw new Error("Invalid "+m+" `"+b+"`, expected non-empty string");return b}const Uo=[{from:"in",to:"id"},{from:"iw",to:"he"},{from:"ji",to:"yi"},{from:"jw",to:"jv"},{from:"mo",to:"ro"},{from:"scc",to:"sr"},{from:"scr",to:"hr"},{from:"aam",to:"aas"},{from:"adp",to:"dz"},{from:"aue",to:"ktz"},{from:"ayx",to:"nun"},{from:"bgm",to:"bcg"},{from:"bjd",to:"drl"},{from:"ccq",to:"rki"},{from:"cjr",to:"mom"},{from:"cka",to:"cmr"},{from:"cmk",to:"xch"},{from:"coy",to:"pij"},{from:"cqu",to:"quh"},{from:"drh",to:"mn"},{from:"drw",to:"fa-af"},{from:"gav",to:"dev"},{from:"gfx",to:"vaj"},{from:"ggn",to:"gvr"},{from:"gti",to:"nyc"},{from:"guv",to:"duz"},{from:"hrr",to:"jal"},{from:"ibi",to:"opa"},{from:"ilw",to:"gal"},{from:"jeg",to:"oyb"},{from:"kgc",to:"tdf"},{from:"kgh",to:"kml"},{from:"koj",to:"kwv"},{from:"krm",to:"bmf"},{from:"ktr",to:"dtp"},{from:"kvs",to:"gdj"},{from:"kwq",to:"yam"},{from:"kxe",to:"tvd"},{from:"kzj",to:"dtp"},{from:"kzt",to:"dtp"},{from:"lii",to:"raq"},{from:"lmm",to:"rmx"},{from:"meg",to:"cir"},{from:"mst",to:"mry"},{from:"mwj",to:"vaj"},{from:"myt",to:"mry"},{from:"nad",to:"xny"},{from:"ncp",to:"kdz"},{from:"nnx",to:"ngv"},{from:"nts",to:"pij"},{from:"oun",to:"vaj"},{from:"pcr",to:"adx"},{from:"pmc",to:"huw"},{from:"pmu",to:"phr"},{from:"ppa",to:"bfy"},{from:"ppr",to:"lcq"},{from:"pry",to:"prt"},{from:"puz",to:"pub"},{from:"sca",to:"hle"},{from:"skk",to:"oyb"},{from:"tdu",to:"dtp"},{from:"thc",to:"tpo"},{from:"thx",to:"oyb"},{from:"tie",to:"ras"},{from:"tkk",to:"twm"},{from:"tlw",to:"weo"},{from:"tmp",to:"tyj"},{from:"tne",to:"kak"},{from:"tnf",to:"fa-af"},{from:"tsf",to:"taj"},{from:"uok",to:"ema"},{from:"xba",to:"cax"},{from:"xia",to:"acn"},{from:"xkh",to:"waw"},{from:"xsj",to:"suj"},{from:"ybd",to:"rki"},{from:"yma",to:"lrr"},{from:"ymt",to:"mtm"},{from:"yos",to:"zom"},{from:"yuu",to:"yug"},{from:"asd",to:"snz"},{from:"dit",to:"dif"},{from:"llo",to:"ngt"},{from:"myd",to:"aog"},{from:"nns",to:"nbr"},{from:"agp",to:"apf"},{from:"ais",to:"ami"},{from:"ajt",to:"aeb"},{from:"baz",to:"nvo"},{from:"bhk",to:"fbl"},{from:"bic",to:"bir"},{from:"bjq",to:"bzc"},{from:"bkb",to:"ebk"},{from:"blg",to:"iba"},{from:"btb",to:"beb"},{from:"daf",to:"dnj"},{from:"dap",to:"njz"},{from:"djl",to:"dze"},{from:"dkl",to:"aqd"},{from:"drr",to:"kzk"},{from:"dud",to:"uth"},{from:"duj",to:"dwu"},{from:"dwl",to:"dbt"},{from:"elp",to:"amq"},{from:"gbc",to:"wny"},{from:"ggo",to:"esg"},{from:"ggr",to:"gtu"},{from:"gio",to:"aou"},{from:"gli",to:"kzk"},{from:"ill",to:"ilm"},{from:"izi",to:"eza"},{from:"jar",to:"jgk"},{from:"kdv",to:"zkd"},{from:"kgd",to:"ncq"},{from:"kpp",to:"jkm"},{from:"kxl",to:"kru"},{from:"kzh",to:"dgl"},{from:"lak",to:"ksp"},{from:"leg",to:"enl"},{from:"mgx",to:"jbk"},{from:"mnt",to:"wnn"},{from:"mof",to:"xnt"},{from:"mwd",to:"dmw"},{from:"nbf",to:"nru"},{from:"nbx",to:"ekc"},{from:"nln",to:"azd"},{from:"nlr",to:"nrk"},{from:"noo",to:"dtd"},{from:"nxu",to:"bpp"},{from:"pat",to:"kxr"},{from:"rmr",to:"emx"},{from:"sap",to:"aqt"},{from:"sgl",to:"isk"},{from:"smd",to:"kmb"},{from:"snb",to:"iba"},{from:"sul",to:"sgd"},{from:"sum",to:"ulw"},{from:"tgg",to:"bjp"},{from:"thw",to:"ola"},{from:"tid",to:"itd"},{from:"unp",to:"wro"},{from:"wgw",to:"wgb"},{from:"wit",to:"nol"},{from:"wiw",to:"nwo"},{from:"xrq",to:"dmw"},{from:"yen",to:"ynq"},{from:"yiy",to:"yrm"},{from:"zir",to:"scv"},{from:"sgn-br",to:"bzs"},{from:"sgn-co",to:"csn"},{from:"sgn-de",to:"gsg"},{from:"sgn-dk",to:"dsl"},{from:"sgn-fr",to:"fsl"},{from:"sgn-gb",to:"bfi"},{from:"sgn-gr",to:"gss"},{from:"sgn-ie",to:"isg"},{from:"sgn-it",to:"ise"},{from:"sgn-jp",to:"jsl"},{from:"sgn-mx",to:"mfs"},{from:"sgn-ni",to:"ncs"},{from:"sgn-nl",to:"dse"},{from:"sgn-no",to:"nsi"},{from:"sgn-pt",to:"psr"},{from:"sgn-se",to:"swl"},{from:"sgn-us",to:"ase"},{from:"sgn-za",to:"sfs"},{from:"sgn-es",to:"ssp"},{from:"zh-cmn",to:"zh"},{from:"zh-cmn-hans",to:"zh-hans"},{from:"zh-cmn-hant",to:"zh-hant"},{from:"zh-gan",to:"gan"},{from:"zh-wuu",to:"wuu"},{from:"zh-yue",to:"yue"},{from:"no-bokmal",to:"nb"},{from:"no-nynorsk",to:"nn"},{from:"aa-saaho",to:"ssy"},{from:"sh",to:"sr-latn"},{from:"cnr",to:"sr-me"},{from:"tl",to:"fil"},{from:"aju",to:"jrb"},{from:"als",to:"sq"},{from:"arb",to:"ar"},{from:"ayr",to:"ay"},{from:"azj",to:"az"},{from:"bcc",to:"bal"},{from:"bcl",to:"bik"},{from:"bxk",to:"luy"},{from:"bxr",to:"bua"},{from:"cld",to:"syr"},{from:"cmn",to:"zh"},{from:"cwd",to:"cr"},{from:"dgo",to:"doi"},{from:"dhd",to:"mwr"},{from:"dik",to:"din"},{from:"diq",to:"zza"},{from:"lbk",to:"bnc"},{from:"ekk",to:"et"},{from:"emk",to:"man"},{from:"esk",to:"ik"},{from:"fat",to:"ak"},{from:"fuc",to:"ff"},{from:"gaz",to:"om"},{from:"gbo",to:"grb"},{from:"gno",to:"gon"},{from:"gug",to:"gn"},{from:"gya",to:"gba"},{from:"hdn",to:"hai"},{from:"hea",to:"hmn"},{from:"ike",to:"iu"},{from:"kmr",to:"ku"},{from:"knc",to:"kr"},{from:"kng",to:"kg"},{from:"knn",to:"kok"},{from:"kpv",to:"kv"},{from:"lvs",to:"lv"},{from:"mhr",to:"chm"},{from:"mup",to:"raj"},{from:"khk",to:"mn"},{from:"npi",to:"ne"},{from:"ojg",to:"oj"},{from:"ory",to:"or"},{from:"pbu",to:"ps"},{from:"pes",to:"fa"},{from:"plt",to:"mg"},{from:"pnb",to:"lah"},{from:"quz",to:"qu"},{from:"rmy",to:"rom"},{from:"spy",to:"kln"},{from:"src",to:"sc"},{from:"swh",to:"sw"},{from:"ttq",to:"tmh"},{from:"tw",to:"ak"},{from:"umu",to:"del"},{from:"uzn",to:"uz"},{from:"xpe",to:"kpe"},{from:"xsl",to:"den"},{from:"ydd",to:"yi"},{from:"zai",to:"zap"},{from:"zsm",to:"ms"},{from:"zyb",to:"za"},{from:"him",to:"srx"},{from:"mnk",to:"man"},{from:"bh",to:"bho"},{from:"prs",to:"fa-af"},{from:"swc",to:"sw-cd"},{from:"aar",to:"aa"},{from:"abk",to:"ab"},{from:"ave",to:"ae"},{from:"afr",to:"af"},{from:"aka",to:"ak"},{from:"amh",to:"am"},{from:"arg",to:"an"},{from:"ara",to:"ar"},{from:"asm",to:"as"},{from:"ava",to:"av"},{from:"aym",to:"ay"},{from:"aze",to:"az"},{from:"bak",to:"ba"},{from:"bel",to:"be"},{from:"bul",to:"bg"},{from:"bih",to:"bho"},{from:"bis",to:"bi"},{from:"bam",to:"bm"},{from:"ben",to:"bn"},{from:"bod",to:"bo"},{from:"bre",to:"br"},{from:"bos",to:"bs"},{from:"cat",to:"ca"},{from:"che",to:"ce"},{from:"cha",to:"ch"},{from:"cos",to:"co"},{from:"cre",to:"cr"},{from:"ces",to:"cs"},{from:"chu",to:"cu"},{from:"chv",to:"cv"},{from:"cym",to:"cy"},{from:"dan",to:"da"},{from:"deu",to:"de"},{from:"div",to:"dv"},{from:"dzo",to:"dz"},{from:"ewe",to:"ee"},{from:"ell",to:"el"},{from:"eng",to:"en"},{from:"epo",to:"eo"},{from:"spa",to:"es"},{from:"est",to:"et"},{from:"eus",to:"eu"},{from:"fas",to:"fa"},{from:"ful",to:"ff"},{from:"fin",to:"fi"},{from:"fij",to:"fj"},{from:"fao",to:"fo"},{from:"fra",to:"fr"},{from:"fry",to:"fy"},{from:"gle",to:"ga"},{from:"gla",to:"gd"},{from:"glg",to:"gl"},{from:"grn",to:"gn"},{from:"guj",to:"gu"},{from:"glv",to:"gv"},{from:"hau",to:"ha"},{from:"heb",to:"he"},{from:"hin",to:"hi"},{from:"hmo",to:"ho"},{from:"hrv",to:"hr"},{from:"hat",to:"ht"},{from:"hun",to:"hu"},{from:"hye",to:"hy"},{from:"her",to:"hz"},{from:"ina",to:"ia"},{from:"ind",to:"id"},{from:"ile",to:"ie"},{from:"ibo",to:"ig"},{from:"iii",to:"ii"},{from:"ipk",to:"ik"},{from:"ido",to:"io"},{from:"isl",to:"is"},{from:"ita",to:"it"},{from:"iku",to:"iu"},{from:"jpn",to:"ja"},{from:"jav",to:"jv"},{from:"kat",to:"ka"},{from:"kon",to:"kg"},{from:"kik",to:"ki"},{from:"kua",to:"kj"},{from:"kaz",to:"kk"},{from:"kal",to:"kl"},{from:"khm",to:"km"},{from:"kan",to:"kn"},{from:"kor",to:"ko"},{from:"kau",to:"kr"},{from:"kas",to:"ks"},{from:"kur",to:"ku"},{from:"kom",to:"kv"},{from:"cor",to:"kw"},{from:"kir",to:"ky"},{from:"lat",to:"la"},{from:"ltz",to:"lb"},{from:"lug",to:"lg"},{from:"lim",to:"li"},{from:"lin",to:"ln"},{from:"lao",to:"lo"},{from:"lit",to:"lt"},{from:"lub",to:"lu"},{from:"lav",to:"lv"},{from:"mlg",to:"mg"},{from:"mah",to:"mh"},{from:"mri",to:"mi"},{from:"mkd",to:"mk"},{from:"mal",to:"ml"},{from:"mon",to:"mn"},{from:"mol",to:"ro"},{from:"mar",to:"mr"},{from:"msa",to:"ms"},{from:"mlt",to:"mt"},{from:"mya",to:"my"},{from:"nau",to:"na"},{from:"nob",to:"nb"},{from:"nde",to:"nd"},{from:"nep",to:"ne"},{from:"ndo",to:"ng"},{from:"nld",to:"nl"},{from:"nno",to:"nn"},{from:"nor",to:"no"},{from:"nbl",to:"nr"},{from:"nav",to:"nv"},{from:"nya",to:"ny"},{from:"oci",to:"oc"},{from:"oji",to:"oj"},{from:"orm",to:"om"},{from:"ori",to:"or"},{from:"oss",to:"os"},{from:"pan",to:"pa"},{from:"pli",to:"pi"},{from:"pol",to:"pl"},{from:"pus",to:"ps"},{from:"por",to:"pt"},{from:"que",to:"qu"},{from:"roh",to:"rm"},{from:"run",to:"rn"},{from:"ron",to:"ro"},{from:"rus",to:"ru"},{from:"kin",to:"rw"},{from:"san",to:"sa"},{from:"srd",to:"sc"},{from:"snd",to:"sd"},{from:"sme",to:"se"},{from:"sag",to:"sg"},{from:"hbs",to:"sr-latn"},{from:"sin",to:"si"},{from:"slk",to:"sk"},{from:"slv",to:"sl"},{from:"smo",to:"sm"},{from:"sna",to:"sn"},{from:"som",to:"so"},{from:"sqi",to:"sq"},{from:"srp",to:"sr"},{from:"ssw",to:"ss"},{from:"sot",to:"st"},{from:"sun",to:"su"},{from:"swe",to:"sv"},{from:"swa",to:"sw"},{from:"tam",to:"ta"},{from:"tel",to:"te"},{from:"tgk",to:"tg"},{from:"tha",to:"th"},{from:"tir",to:"ti"},{from:"tuk",to:"tk"},{from:"tgl",to:"fil"},{from:"tsn",to:"tn"},{from:"ton",to:"to"},{from:"tur",to:"tr"},{from:"tso",to:"ts"},{from:"tat",to:"tt"},{from:"twi",to:"ak"},{from:"tah",to:"ty"},{from:"uig",to:"ug"},{from:"ukr",to:"uk"},{from:"urd",to:"ur"},{from:"uzb",to:"uz"},{from:"ven",to:"ve"},{from:"vie",to:"vi"},{from:"vol",to:"vo"},{from:"wln",to:"wa"},{from:"wol",to:"wo"},{from:"xho",to:"xh"},{from:"yid",to:"yi"},{from:"yor",to:"yo"},{from:"zha",to:"za"},{from:"zho",to:"zh"},{from:"zul",to:"zu"},{from:"alb",to:"sq"},{from:"arm",to:"hy"},{from:"baq",to:"eu"},{from:"bur",to:"my"},{from:"chi",to:"zh"},{from:"cze",to:"cs"},{from:"dut",to:"nl"},{from:"fre",to:"fr"},{from:"geo",to:"ka"},{from:"ger",to:"de"},{from:"gre",to:"el"},{from:"ice",to:"is"},{from:"mac",to:"mk"},{from:"mao",to:"mi"},{from:"may",to:"ms"},{from:"per",to:"fa"},{from:"rum",to:"ro"},{from:"slo",to:"sk"},{from:"tib",to:"bo"},{from:"wel",to:"cy"},{from:"und-aaland",to:"und-ax"},{from:"hy-arevmda",to:"hyw"},{from:"und-arevmda",to:"und"},{from:"und-arevela",to:"und"},{from:"und-lojban",to:"und"},{from:"und-saaho",to:"und"},{from:"und-bokmal",to:"und"},{from:"und-nynorsk",to:"und"},{from:"und-hakka",to:"und"},{from:"und-xiang",to:"und"},{from:"und-hepburn-heploc",to:"und-alalc97"}],$a=[{from:{field:"script",value:"qaai"},to:{field:"script",value:"zinh"}},{from:{field:"region",value:"bu"},to:{field:"region",value:"mm"}},{from:{field:"region",value:"ct"},to:{field:"region",value:"ki"}},{from:{field:"region",value:"dd"},to:{field:"region",value:"de"}},{from:{field:"region",value:"dy"},to:{field:"region",value:"bj"}},{from:{field:"region",value:"fx"},to:{field:"region",value:"fr"}},{from:{field:"region",value:"hv"},to:{field:"region",value:"bf"}},{from:{field:"region",value:"jt"},to:{field:"region",value:"um"}},{from:{field:"region",value:"mi"},to:{field:"region",value:"um"}},{from:{field:"region",value:"nh"},to:{field:"region",value:"vu"}},{from:{field:"region",value:"nq"},to:{field:"region",value:"aq"}},{from:{field:"region",value:"pu"},to:{field:"region",value:"um"}},{from:{field:"region",value:"pz"},to:{field:"region",value:"pa"}},{from:{field:"region",value:"qu"},to:{field:"region",value:"eu"}},{from:{field:"region",value:"rh"},to:{field:"region",value:"zw"}},{from:{field:"region",value:"tp"},to:{field:"region",value:"tl"}},{from:{field:"region",value:"uk"},to:{field:"region",value:"gb"}},{from:{field:"region",value:"vd"},to:{field:"region",value:"vn"}},{from:{field:"region",value:"wk"},to:{field:"region",value:"um"}},{from:{field:"region",value:"yd"},to:{field:"region",value:"ye"}},{from:{field:"region",value:"zr"},to:{field:"region",value:"cd"}},{from:{field:"region",value:"230"},to:{field:"region",value:"et"}},{from:{field:"region",value:"280"},to:{field:"region",value:"de"}},{from:{field:"region",value:"736"},to:{field:"region",value:"sd"}},{from:{field:"region",value:"886"},to:{field:"region",value:"ye"}},{from:{field:"region",value:"958"},to:{field:"region",value:"aa"}},{from:{field:"region",value:"020"},to:{field:"region",value:"ad"}},{from:{field:"region",value:"784"},to:{field:"region",value:"ae"}},{from:{field:"region",value:"004"},to:{field:"region",value:"af"}},{from:{field:"region",value:"028"},to:{field:"region",value:"ag"}},{from:{field:"region",value:"660"},to:{field:"region",value:"ai"}},{from:{field:"region",value:"008"},to:{field:"region",value:"al"}},{from:{field:"region",value:"051"},to:{field:"region",value:"am"}},{from:{field:"region",value:"024"},to:{field:"region",value:"ao"}},{from:{field:"region",value:"010"},to:{field:"region",value:"aq"}},{from:{field:"region",value:"032"},to:{field:"region",value:"ar"}},{from:{field:"region",value:"016"},to:{field:"region",value:"as"}},{from:{field:"region",value:"040"},to:{field:"region",value:"at"}},{from:{field:"region",value:"036"},to:{field:"region",value:"au"}},{from:{field:"region",value:"533"},to:{field:"region",value:"aw"}},{from:{field:"region",value:"248"},to:{field:"region",value:"ax"}},{from:{field:"region",value:"031"},to:{field:"region",value:"az"}},{from:{field:"region",value:"070"},to:{field:"region",value:"ba"}},{from:{field:"region",value:"052"},to:{field:"region",value:"bb"}},{from:{field:"region",value:"050"},to:{field:"region",value:"bd"}},{from:{field:"region",value:"056"},to:{field:"region",value:"be"}},{from:{field:"region",value:"854"},to:{field:"region",value:"bf"}},{from:{field:"region",value:"100"},to:{field:"region",value:"bg"}},{from:{field:"region",value:"048"},to:{field:"region",value:"bh"}},{from:{field:"region",value:"108"},to:{field:"region",value:"bi"}},{from:{field:"region",value:"204"},to:{field:"region",value:"bj"}},{from:{field:"region",value:"652"},to:{field:"region",value:"bl"}},{from:{field:"region",value:"060"},to:{field:"region",value:"bm"}},{from:{field:"region",value:"096"},to:{field:"region",value:"bn"}},{from:{field:"region",value:"068"},to:{field:"region",value:"bo"}},{from:{field:"region",value:"535"},to:{field:"region",value:"bq"}},{from:{field:"region",value:"076"},to:{field:"region",value:"br"}},{from:{field:"region",value:"044"},to:{field:"region",value:"bs"}},{from:{field:"region",value:"064"},to:{field:"region",value:"bt"}},{from:{field:"region",value:"104"},to:{field:"region",value:"mm"}},{from:{field:"region",value:"074"},to:{field:"region",value:"bv"}},{from:{field:"region",value:"072"},to:{field:"region",value:"bw"}},{from:{field:"region",value:"112"},to:{field:"region",value:"by"}},{from:{field:"region",value:"084"},to:{field:"region",value:"bz"}},{from:{field:"region",value:"124"},to:{field:"region",value:"ca"}},{from:{field:"region",value:"166"},to:{field:"region",value:"cc"}},{from:{field:"region",value:"180"},to:{field:"region",value:"cd"}},{from:{field:"region",value:"140"},to:{field:"region",value:"cf"}},{from:{field:"region",value:"178"},to:{field:"region",value:"cg"}},{from:{field:"region",value:"756"},to:{field:"region",value:"ch"}},{from:{field:"region",value:"384"},to:{field:"region",value:"ci"}},{from:{field:"region",value:"184"},to:{field:"region",value:"ck"}},{from:{field:"region",value:"152"},to:{field:"region",value:"cl"}},{from:{field:"region",value:"120"},to:{field:"region",value:"cm"}},{from:{field:"region",value:"156"},to:{field:"region",value:"cn"}},{from:{field:"region",value:"170"},to:{field:"region",value:"co"}},{from:{field:"region",value:"188"},to:{field:"region",value:"cr"}},{from:{field:"region",value:"192"},to:{field:"region",value:"cu"}},{from:{field:"region",value:"132"},to:{field:"region",value:"cv"}},{from:{field:"region",value:"531"},to:{field:"region",value:"cw"}},{from:{field:"region",value:"162"},to:{field:"region",value:"cx"}},{from:{field:"region",value:"196"},to:{field:"region",value:"cy"}},{from:{field:"region",value:"203"},to:{field:"region",value:"cz"}},{from:{field:"region",value:"278"},to:{field:"region",value:"de"}},{from:{field:"region",value:"276"},to:{field:"region",value:"de"}},{from:{field:"region",value:"262"},to:{field:"region",value:"dj"}},{from:{field:"region",value:"208"},to:{field:"region",value:"dk"}},{from:{field:"region",value:"212"},to:{field:"region",value:"dm"}},{from:{field:"region",value:"214"},to:{field:"region",value:"do"}},{from:{field:"region",value:"012"},to:{field:"region",value:"dz"}},{from:{field:"region",value:"218"},to:{field:"region",value:"ec"}},{from:{field:"region",value:"233"},to:{field:"region",value:"ee"}},{from:{field:"region",value:"818"},to:{field:"region",value:"eg"}},{from:{field:"region",value:"732"},to:{field:"region",value:"eh"}},{from:{field:"region",value:"232"},to:{field:"region",value:"er"}},{from:{field:"region",value:"724"},to:{field:"region",value:"es"}},{from:{field:"region",value:"231"},to:{field:"region",value:"et"}},{from:{field:"region",value:"246"},to:{field:"region",value:"fi"}},{from:{field:"region",value:"242"},to:{field:"region",value:"fj"}},{from:{field:"region",value:"238"},to:{field:"region",value:"fk"}},{from:{field:"region",value:"583"},to:{field:"region",value:"fm"}},{from:{field:"region",value:"234"},to:{field:"region",value:"fo"}},{from:{field:"region",value:"250"},to:{field:"region",value:"fr"}},{from:{field:"region",value:"249"},to:{field:"region",value:"fr"}},{from:{field:"region",value:"266"},to:{field:"region",value:"ga"}},{from:{field:"region",value:"826"},to:{field:"region",value:"gb"}},{from:{field:"region",value:"308"},to:{field:"region",value:"gd"}},{from:{field:"region",value:"268"},to:{field:"region",value:"ge"}},{from:{field:"region",value:"254"},to:{field:"region",value:"gf"}},{from:{field:"region",value:"831"},to:{field:"region",value:"gg"}},{from:{field:"region",value:"288"},to:{field:"region",value:"gh"}},{from:{field:"region",value:"292"},to:{field:"region",value:"gi"}},{from:{field:"region",value:"304"},to:{field:"region",value:"gl"}},{from:{field:"region",value:"270"},to:{field:"region",value:"gm"}},{from:{field:"region",value:"324"},to:{field:"region",value:"gn"}},{from:{field:"region",value:"312"},to:{field:"region",value:"gp"}},{from:{field:"region",value:"226"},to:{field:"region",value:"gq"}},{from:{field:"region",value:"300"},to:{field:"region",value:"gr"}},{from:{field:"region",value:"239"},to:{field:"region",value:"gs"}},{from:{field:"region",value:"320"},to:{field:"region",value:"gt"}},{from:{field:"region",value:"316"},to:{field:"region",value:"gu"}},{from:{field:"region",value:"624"},to:{field:"region",value:"gw"}},{from:{field:"region",value:"328"},to:{field:"region",value:"gy"}},{from:{field:"region",value:"344"},to:{field:"region",value:"hk"}},{from:{field:"region",value:"334"},to:{field:"region",value:"hm"}},{from:{field:"region",value:"340"},to:{field:"region",value:"hn"}},{from:{field:"region",value:"191"},to:{field:"region",value:"hr"}},{from:{field:"region",value:"332"},to:{field:"region",value:"ht"}},{from:{field:"region",value:"348"},to:{field:"region",value:"hu"}},{from:{field:"region",value:"360"},to:{field:"region",value:"id"}},{from:{field:"region",value:"372"},to:{field:"region",value:"ie"}},{from:{field:"region",value:"376"},to:{field:"region",value:"il"}},{from:{field:"region",value:"833"},to:{field:"region",value:"im"}},{from:{field:"region",value:"356"},to:{field:"region",value:"in"}},{from:{field:"region",value:"086"},to:{field:"region",value:"io"}},{from:{field:"region",value:"368"},to:{field:"region",value:"iq"}},{from:{field:"region",value:"364"},to:{field:"region",value:"ir"}},{from:{field:"region",value:"352"},to:{field:"region",value:"is"}},{from:{field:"region",value:"380"},to:{field:"region",value:"it"}},{from:{field:"region",value:"832"},to:{field:"region",value:"je"}},{from:{field:"region",value:"388"},to:{field:"region",value:"jm"}},{from:{field:"region",value:"400"},to:{field:"region",value:"jo"}},{from:{field:"region",value:"392"},to:{field:"region",value:"jp"}},{from:{field:"region",value:"404"},to:{field:"region",value:"ke"}},{from:{field:"region",value:"417"},to:{field:"region",value:"kg"}},{from:{field:"region",value:"116"},to:{field:"region",value:"kh"}},{from:{field:"region",value:"296"},to:{field:"region",value:"ki"}},{from:{field:"region",value:"174"},to:{field:"region",value:"km"}},{from:{field:"region",value:"659"},to:{field:"region",value:"kn"}},{from:{field:"region",value:"408"},to:{field:"region",value:"kp"}},{from:{field:"region",value:"410"},to:{field:"region",value:"kr"}},{from:{field:"region",value:"414"},to:{field:"region",value:"kw"}},{from:{field:"region",value:"136"},to:{field:"region",value:"ky"}},{from:{field:"region",value:"398"},to:{field:"region",value:"kz"}},{from:{field:"region",value:"418"},to:{field:"region",value:"la"}},{from:{field:"region",value:"422"},to:{field:"region",value:"lb"}},{from:{field:"region",value:"662"},to:{field:"region",value:"lc"}},{from:{field:"region",value:"438"},to:{field:"region",value:"li"}},{from:{field:"region",value:"144"},to:{field:"region",value:"lk"}},{from:{field:"region",value:"430"},to:{field:"region",value:"lr"}},{from:{field:"region",value:"426"},to:{field:"region",value:"ls"}},{from:{field:"region",value:"440"},to:{field:"region",value:"lt"}},{from:{field:"region",value:"442"},to:{field:"region",value:"lu"}},{from:{field:"region",value:"428"},to:{field:"region",value:"lv"}},{from:{field:"region",value:"434"},to:{field:"region",value:"ly"}},{from:{field:"region",value:"504"},to:{field:"region",value:"ma"}},{from:{field:"region",value:"492"},to:{field:"region",value:"mc"}},{from:{field:"region",value:"498"},to:{field:"region",value:"md"}},{from:{field:"region",value:"499"},to:{field:"region",value:"me"}},{from:{field:"region",value:"663"},to:{field:"region",value:"mf"}},{from:{field:"region",value:"450"},to:{field:"region",value:"mg"}},{from:{field:"region",value:"584"},to:{field:"region",value:"mh"}},{from:{field:"region",value:"807"},to:{field:"region",value:"mk"}},{from:{field:"region",value:"466"},to:{field:"region",value:"ml"}},{from:{field:"region",value:"496"},to:{field:"region",value:"mn"}},{from:{field:"region",value:"446"},to:{field:"region",value:"mo"}},{from:{field:"region",value:"580"},to:{field:"region",value:"mp"}},{from:{field:"region",value:"474"},to:{field:"region",value:"mq"}},{from:{field:"region",value:"478"},to:{field:"region",value:"mr"}},{from:{field:"region",value:"500"},to:{field:"region",value:"ms"}},{from:{field:"region",value:"470"},to:{field:"region",value:"mt"}},{from:{field:"region",value:"480"},to:{field:"region",value:"mu"}},{from:{field:"region",value:"462"},to:{field:"region",value:"mv"}},{from:{field:"region",value:"454"},to:{field:"region",value:"mw"}},{from:{field:"region",value:"484"},to:{field:"region",value:"mx"}},{from:{field:"region",value:"458"},to:{field:"region",value:"my"}},{from:{field:"region",value:"508"},to:{field:"region",value:"mz"}},{from:{field:"region",value:"516"},to:{field:"region",value:"na"}},{from:{field:"region",value:"540"},to:{field:"region",value:"nc"}},{from:{field:"region",value:"562"},to:{field:"region",value:"ne"}},{from:{field:"region",value:"574"},to:{field:"region",value:"nf"}},{from:{field:"region",value:"566"},to:{field:"region",value:"ng"}},{from:{field:"region",value:"558"},to:{field:"region",value:"ni"}},{from:{field:"region",value:"528"},to:{field:"region",value:"nl"}},{from:{field:"region",value:"578"},to:{field:"region",value:"no"}},{from:{field:"region",value:"524"},to:{field:"region",value:"np"}},{from:{field:"region",value:"520"},to:{field:"region",value:"nr"}},{from:{field:"region",value:"570"},to:{field:"region",value:"nu"}},{from:{field:"region",value:"554"},to:{field:"region",value:"nz"}},{from:{field:"region",value:"512"},to:{field:"region",value:"om"}},{from:{field:"region",value:"591"},to:{field:"region",value:"pa"}},{from:{field:"region",value:"604"},to:{field:"region",value:"pe"}},{from:{field:"region",value:"258"},to:{field:"region",value:"pf"}},{from:{field:"region",value:"598"},to:{field:"region",value:"pg"}},{from:{field:"region",value:"608"},to:{field:"region",value:"ph"}},{from:{field:"region",value:"586"},to:{field:"region",value:"pk"}},{from:{field:"region",value:"616"},to:{field:"region",value:"pl"}},{from:{field:"region",value:"666"},to:{field:"region",value:"pm"}},{from:{field:"region",value:"612"},to:{field:"region",value:"pn"}},{from:{field:"region",value:"630"},to:{field:"region",value:"pr"}},{from:{field:"region",value:"275"},to:{field:"region",value:"ps"}},{from:{field:"region",value:"620"},to:{field:"region",value:"pt"}},{from:{field:"region",value:"585"},to:{field:"region",value:"pw"}},{from:{field:"region",value:"600"},to:{field:"region",value:"py"}},{from:{field:"region",value:"634"},to:{field:"region",value:"qa"}},{from:{field:"region",value:"959"},to:{field:"region",value:"qm"}},{from:{field:"region",value:"960"},to:{field:"region",value:"qn"}},{from:{field:"region",value:"962"},to:{field:"region",value:"qp"}},{from:{field:"region",value:"963"},to:{field:"region",value:"qq"}},{from:{field:"region",value:"964"},to:{field:"region",value:"qr"}},{from:{field:"region",value:"965"},to:{field:"region",value:"qs"}},{from:{field:"region",value:"966"},to:{field:"region",value:"qt"}},{from:{field:"region",value:"967"},to:{field:"region",value:"eu"}},{from:{field:"region",value:"968"},to:{field:"region",value:"qv"}},{from:{field:"region",value:"969"},to:{field:"region",value:"qw"}},{from:{field:"region",value:"970"},to:{field:"region",value:"qx"}},{from:{field:"region",value:"971"},to:{field:"region",value:"qy"}},{from:{field:"region",value:"972"},to:{field:"region",value:"qz"}},{from:{field:"region",value:"638"},to:{field:"region",value:"re"}},{from:{field:"region",value:"642"},to:{field:"region",value:"ro"}},{from:{field:"region",value:"688"},to:{field:"region",value:"rs"}},{from:{field:"region",value:"643"},to:{field:"region",value:"ru"}},{from:{field:"region",value:"646"},to:{field:"region",value:"rw"}},{from:{field:"region",value:"682"},to:{field:"region",value:"sa"}},{from:{field:"region",value:"090"},to:{field:"region",value:"sb"}},{from:{field:"region",value:"690"},to:{field:"region",value:"sc"}},{from:{field:"region",value:"729"},to:{field:"region",value:"sd"}},{from:{field:"region",value:"752"},to:{field:"region",value:"se"}},{from:{field:"region",value:"702"},to:{field:"region",value:"sg"}},{from:{field:"region",value:"654"},to:{field:"region",value:"sh"}},{from:{field:"region",value:"705"},to:{field:"region",value:"si"}},{from:{field:"region",value:"744"},to:{field:"region",value:"sj"}},{from:{field:"region",value:"703"},to:{field:"region",value:"sk"}},{from:{field:"region",value:"694"},to:{field:"region",value:"sl"}},{from:{field:"region",value:"674"},to:{field:"region",value:"sm"}},{from:{field:"region",value:"686"},to:{field:"region",value:"sn"}},{from:{field:"region",value:"706"},to:{field:"region",value:"so"}},{from:{field:"region",value:"740"},to:{field:"region",value:"sr"}},{from:{field:"region",value:"728"},to:{field:"region",value:"ss"}},{from:{field:"region",value:"678"},to:{field:"region",value:"st"}},{from:{field:"region",value:"222"},to:{field:"region",value:"sv"}},{from:{field:"region",value:"534"},to:{field:"region",value:"sx"}},{from:{field:"region",value:"760"},to:{field:"region",value:"sy"}},{from:{field:"region",value:"748"},to:{field:"region",value:"sz"}},{from:{field:"region",value:"796"},to:{field:"region",value:"tc"}},{from:{field:"region",value:"148"},to:{field:"region",value:"td"}},{from:{field:"region",value:"260"},to:{field:"region",value:"tf"}},{from:{field:"region",value:"768"},to:{field:"region",value:"tg"}},{from:{field:"region",value:"764"},to:{field:"region",value:"th"}},{from:{field:"region",value:"762"},to:{field:"region",value:"tj"}},{from:{field:"region",value:"772"},to:{field:"region",value:"tk"}},{from:{field:"region",value:"626"},to:{field:"region",value:"tl"}},{from:{field:"region",value:"795"},to:{field:"region",value:"tm"}},{from:{field:"region",value:"788"},to:{field:"region",value:"tn"}},{from:{field:"region",value:"776"},to:{field:"region",value:"to"}},{from:{field:"region",value:"792"},to:{field:"region",value:"tr"}},{from:{field:"region",value:"780"},to:{field:"region",value:"tt"}},{from:{field:"region",value:"798"},to:{field:"region",value:"tv"}},{from:{field:"region",value:"158"},to:{field:"region",value:"tw"}},{from:{field:"region",value:"834"},to:{field:"region",value:"tz"}},{from:{field:"region",value:"804"},to:{field:"region",value:"ua"}},{from:{field:"region",value:"800"},to:{field:"region",value:"ug"}},{from:{field:"region",value:"581"},to:{field:"region",value:"um"}},{from:{field:"region",value:"840"},to:{field:"region",value:"us"}},{from:{field:"region",value:"858"},to:{field:"region",value:"uy"}},{from:{field:"region",value:"860"},to:{field:"region",value:"uz"}},{from:{field:"region",value:"336"},to:{field:"region",value:"va"}},{from:{field:"region",value:"670"},to:{field:"region",value:"vc"}},{from:{field:"region",value:"862"},to:{field:"region",value:"ve"}},{from:{field:"region",value:"092"},to:{field:"region",value:"vg"}},{from:{field:"region",value:"850"},to:{field:"region",value:"vi"}},{from:{field:"region",value:"704"},to:{field:"region",value:"vn"}},{from:{field:"region",value:"548"},to:{field:"region",value:"vu"}},{from:{field:"region",value:"876"},to:{field:"region",value:"wf"}},{from:{field:"region",value:"882"},to:{field:"region",value:"ws"}},{from:{field:"region",value:"973"},to:{field:"region",value:"xa"}},{from:{field:"region",value:"974"},to:{field:"region",value:"xb"}},{from:{field:"region",value:"975"},to:{field:"region",value:"xc"}},{from:{field:"region",value:"976"},to:{field:"region",value:"xd"}},{from:{field:"region",value:"977"},to:{field:"region",value:"xe"}},{from:{field:"region",value:"978"},to:{field:"region",value:"xf"}},{from:{field:"region",value:"979"},to:{field:"region",value:"xg"}},{from:{field:"region",value:"980"},to:{field:"region",value:"xh"}},{from:{field:"region",value:"981"},to:{field:"region",value:"xi"}},{from:{field:"region",value:"982"},to:{field:"region",value:"xj"}},{from:{field:"region",value:"983"},to:{field:"region",value:"xk"}},{from:{field:"region",value:"984"},to:{field:"region",value:"xl"}},{from:{field:"region",value:"985"},to:{field:"region",value:"xm"}},{from:{field:"region",value:"986"},to:{field:"region",value:"xn"}},{from:{field:"region",value:"987"},to:{field:"region",value:"xo"}},{from:{field:"region",value:"988"},to:{field:"region",value:"xp"}},{from:{field:"region",value:"989"},to:{field:"region",value:"xq"}},{from:{field:"region",value:"990"},to:{field:"region",value:"xr"}},{from:{field:"region",value:"991"},to:{field:"region",value:"xs"}},{from:{field:"region",value:"992"},to:{field:"region",value:"xt"}},{from:{field:"region",value:"993"},to:{field:"region",value:"xu"}},{from:{field:"region",value:"994"},to:{field:"region",value:"xv"}},{from:{field:"region",value:"995"},to:{field:"region",value:"xw"}},{from:{field:"region",value:"996"},to:{field:"region",value:"xx"}},{from:{field:"region",value:"997"},to:{field:"region",value:"xy"}},{from:{field:"region",value:"998"},to:{field:"region",value:"xz"}},{from:{field:"region",value:"720"},to:{field:"region",value:"ye"}},{from:{field:"region",value:"887"},to:{field:"region",value:"ye"}},{from:{field:"region",value:"175"},to:{field:"region",value:"yt"}},{from:{field:"region",value:"710"},to:{field:"region",value:"za"}},{from:{field:"region",value:"894"},to:{field:"region",value:"zm"}},{from:{field:"region",value:"716"},to:{field:"region",value:"zw"}},{from:{field:"region",value:"999"},to:{field:"region",value:"zz"}},{from:{field:"variants",value:"polytoni"},to:{field:"variants",value:"polyton"}},{from:{field:"variants",value:"heploc"},to:{field:"variants",value:"alalc97"}}],zo={region:{172:["ru","am","az","by","ge","kg","kz","md","tj","tm","ua","uz"],200:["cz","sk"],530:["cw","sx","bq"],532:["cw","sx","bq"],536:["sa","iq"],582:["fm","mh","mp","pw"],810:["ru","am","az","by","ee","ge","kz","kg","lv","lt","md","tj","tm","ua","uz"],830:["je","gg"],890:["rs","me","si","hr","mk","ba"],891:["rs","me"],an:["cw","sx","bq"],cs:["rs","me"],fq:["aq","tf"],nt:["sa","iq"],pc:["fm","mh","mp","pw"],su:["ru","am","az","by","ee","ge","kz","kg","lv","lt","md","tj","tm","ua","uz"],yu:["rs","me"],"062":["034","143"],ant:["cw","sx","bq"],scg:["rs","me"],ntz:["sa","iq"],sun:["ru","am","az","by","ee","ge","kz","kg","lv","lt","md","tj","tm","ua","uz"],yug:["rs","me"]}},vs={aa:"aa-latn-et",aaa:"aaa-latn-ng",aab:"aab-latn-ng",aac:"aac-latn-pg",aad:"aad-latn-pg",aae:"aae-latn-it","aae-grek":"aae-grek-it",aaf:"aaf-mlym-in","aaf-arab":"aaf-arab-in",aag:"aag-latn-pg",aah:"aah-latn-pg",aai:"aai-latn-zz",aak:"aak-latn-zz",aal:"aal-latn-cm",aan:"aan-latn-br",aao:"aao-arab-dz",aap:"aap-latn-br",aaq:"aaq-latn-us",aas:"aas-latn-tz",aat:"aat-grek-gr",aau:"aau-latn-zz",aaw:"aaw-latn-pg",aax:"aax-latn-id",aaz:"aaz-latn-id",ab:"ab-cyrl-ge",aba:"aba-latn-ci",abb:"abb-latn-cm",abc:"abc-latn-ph",abd:"abd-latn-ph",abe:"abe-latn-ca",abf:"abf-latn-my",abg:"abg-latn-pg",abh:"abh-arab-tj",abi:"abi-latn-zz",abl:"abl-rjng-id","abl-latn":"abl-latn-id",abm:"abm-latn-ng",abn:"abn-latn-ng",abo:"abo-latn-ng",abp:"abp-latn-ph",abq:"abq-cyrl-zz",abr:"abr-latn-gh",abs:"abs-latn-id",abt:"abt-latn-zz",abu:"abu-latn-ci",abv:"abv-arab-bh",abw:"abw-latn-pg",abx:"abx-latn-ph",aby:"aby-latn-zz",abz:"abz-latn-id",aca:"aca-latn-co",acb:"acb-latn-ng",acd:"acd-latn-zz",ace:"ace-latn-id",acf:"acf-latn-lc",ach:"ach-latn-ug",acm:"acm-arab-iq",acn:"acn-latn-cn",acp:"acp-latn-ng",acq:"acq-arab-ye",acr:"acr-latn-gt",acs:"acs-latn-br",act:"act-latn-nl",acu:"acu-latn-ec",acv:"acv-latn-us",acw:"acw-arab-sa",acx:"acx-arab-om",acy:"acy-latn-cy","acy-arab":"acy-arab-cy","acy-grek":"acy-grek-cy",acz:"acz-latn-sd",ada:"ada-latn-gh",adb:"adb-latn-tl",add:"add-latn-cm",ade:"ade-latn-zz",adf:"adf-arab-om",adg:"adg-latn-au",adh:"adh-latn-ug",adi:"adi-latn-in","adi-tibt":"adi-tibt-cn",adj:"adj-latn-zz",adl:"adl-latn-in",adn:"adn-latn-id",ado:"ado-latn-pg",adp:"adp-tibt-bt",adq:"adq-latn-gh",adr:"adr-latn-id",adt:"adt-latn-au",adu:"adu-latn-ng",adw:"adw-latn-br",adx:"adx-tibt-cn",ady:"ady-cyrl-ru",adz:"adz-latn-zz",ae:"ae-avst-ir",aea:"aea-latn-au",aeb:"aeb-arab-tn",aec:"aec-arab-eg",aee:"aee-arab-af",aek:"aek-latn-nc",ael:"ael-latn-cm",aem:"aem-latn-vn",aeq:"aeq-arab-pk",aer:"aer-latn-au",aeu:"aeu-latn-cn",aew:"aew-latn-pg",aey:"aey-latn-zz",aez:"aez-latn-pg",af:"af-latn-za",afb:"afb-arab-kw",afd:"afd-latn-pg",afe:"afe-latn-ng",afh:"afh-latn-gh",afi:"afi-latn-pg",afk:"afk-latn-pg",afn:"afn-latn-ng",afo:"afo-latn-ng",afp:"afp-latn-pg",afs:"afs-latn-mx",afu:"afu-latn-gh",afz:"afz-latn-id",aga:"aga-latn-pe",agb:"agb-latn-ng",agc:"agc-latn-zz",agd:"agd-latn-zz",age:"age-latn-pg",agf:"agf-latn-id",agg:"agg-latn-zz",agh:"agh-latn-cd",agi:"agi-deva-in",agj:"agj-ethi-et","agj-arab":"agj-arab-et",agk:"agk-latn-ph",agl:"agl-latn-pg",agm:"agm-latn-zz",agn:"agn-latn-ph",ago:"ago-latn-zz",agq:"agq-latn-cm",agr:"agr-latn-pe",ags:"ags-latn-cm",agt:"agt-latn-ph",agu:"agu-latn-gt",agv:"agv-latn-ph",agw:"agw-latn-sb",agx:"agx-cyrl-ru",agy:"agy-latn-ph",agz:"agz-latn-ph",aha:"aha-latn-zz",ahb:"ahb-latn-vu",ahg:"ahg-ethi-et",ahh:"ahh-latn-id",ahi:"ahi-latn-ci",ahk:"ahk-latn-mm","ahk-mymr":"ahk-mymr-mm","ahk-th":"ahk-latn-th","ahk-thai":"ahk-thai-th",ahl:"ahl-latn-zz",ahm:"ahm-latn-ci",ahn:"ahn-latn-ng",aho:"aho-ahom-in",ahp:"ahp-latn-ci",ahr:"ahr-deva-in",ahs:"ahs-latn-ng",aht:"aht-latn-us",aia:"aia-latn-sb",aib:"aib-arab-cn",aic:"aic-latn-pg",aid:"aid-latn-au",aie:"aie-latn-pg",aif:"aif-latn-pg",aig:"aig-latn-ag",aij:"aij-hebr-il",aik:"aik-latn-ng",ail:"ail-latn-pg",aim:"aim-latn-in",ain:"ain-kana-jp","ain-latn":"ain-latn-jp",aio:"aio-mymr-in",aip:"aip-latn-id",aiq:"aiq-arab-af",air:"air-latn-id",ait:"ait-latn-br",aiw:"aiw-latn-et","aiw-arab":"aiw-arab-et","aiw-ethi":"aiw-ethi-et",aix:"aix-latn-pg",aiy:"aiy-latn-cf",aja:"aja-latn-ss",ajg:"ajg-latn-zz",aji:"aji-latn-nc",ajn:"ajn-latn-au",ajp:"ajp-arab-jo",ajt:"ajt-arab-tn",ajw:"ajw-latn-ng",ajz:"ajz-latn-in",ak:"ak-latn-gh",akb:"akb-latn-id","akb-batk":"akb-batk-id",akc:"akc-latn-id",akd:"akd-latn-ng",ake:"ake-latn-gy",akf:"akf-latn-ng",akg:"akg-latn-id",akh:"akh-latn-pg",aki:"aki-latn-pg",akk:"akk-xsux-iq",akl:"akl-latn-ph",ako:"ako-latn-sr",akp:"akp-latn-gh",akq:"akq-latn-pg",akr:"akr-latn-vu",aks:"aks-latn-tg",akt:"akt-latn-pg",aku:"aku-latn-cm",akv:"akv-cyrl-ru",akw:"akw-latn-cg",akz:"akz-latn-us",ala:"ala-latn-zz",alc:"alc-latn-cl",ald:"ald-latn-ci",ale:"ale-latn-us",alf:"alf-latn-ng",alh:"alh-latn-au",ali:"ali-latn-zz",alj:"alj-latn-ph",alk:"alk-laoo-la",all:"all-mlym-in",alm:"alm-latn-vu",aln:"aln-latn-xk",alo:"alo-latn-id",alp:"alp-latn-id",alq:"alq-latn-ca",alr:"alr-cyrl-ru",alt:"alt-cyrl-ru",alu:"alu-latn-sb",alw:"alw-ethi-et",alx:"alx-latn-pg",aly:"aly-latn-au",alz:"alz-latn-cd",am:"am-ethi-et",ama:"ama-latn-br",amb:"amb-latn-ng",amc:"amc-latn-pe",ame:"ame-latn-pe",amf:"amf-latn-et","amf-ethi":"amf-ethi-et",amg:"amg-latn-au",ami:"ami-latn-tw",amj:"amj-latn-td",amk:"amk-latn-id",amm:"amm-latn-zz",amn:"amn-latn-zz",amo:"amo-latn-ng",amp:"amp-latn-zz",amq:"amq-latn-id",amr:"amr-latn-pe",ams:"ams-jpan-jp",amt:"amt-latn-pg",amu:"amu-latn-mx",amv:"amv-latn-id",amw:"amw-syrc-sy","amw-arab":"amw-arab-sy","amw-armi":"amw-armi-sy","amw-latn":"amw-latn-sy",amx:"amx-latn-au",amy:"amy-latn-au",amz:"amz-latn-au",an:"an-latn-es",ana:"ana-latn-co",anb:"anb-latn-pe",anc:"anc-latn-zz",and:"and-latn-id",ane:"ane-latn-nc",anf:"anf-latn-gh",ang:"ang-latn-gb",anh:"anh-latn-pg",ani:"ani-cyrl-ru",anj:"anj-latn-pg",ank:"ank-latn-zz",anl:"anl-latn-mm",anm:"anm-latn-in",ann:"ann-latn-ng",ano:"ano-latn-co",anp:"anp-deva-in",anr:"anr-deva-in",ans:"ans-latn-co",ant:"ant-latn-au",anu:"anu-ethi-et","anu-arab":"anu-arab-ss","anu-latn":"anu-latn-ss",anv:"anv-latn-cm",anw:"anw-latn-ng",anx:"anx-latn-pg",any:"any-latn-zz",anz:"anz-latn-pg",aoa:"aoa-latn-st",aob:"aob-latn-pg",aoc:"aoc-latn-ve",aod:"aod-latn-pg",aoe:"aoe-latn-pg",aof:"aof-latn-pg",aog:"aog-latn-pg",aoi:"aoi-latn-au",aoj:"aoj-latn-zz",aok:"aok-latn-nc",aol:"aol-latn-id",aom:"aom-latn-zz",aon:"aon-latn-pg",aor:"aor-latn-vu",aos:"aos-latn-id",aot:"aot-beng-bd","aot-latn":"aot-latn-in",aox:"aox-latn-gy",aoz:"aoz-latn-id",apb:"apb-latn-sb",apc:"apc-arab-sy",apd:"apd-arab-tg",ape:"ape-latn-zz",apf:"apf-latn-ph",apg:"apg-latn-id",aph:"aph-deva-np",api:"api-latn-br",apj:"apj-latn-us",apk:"apk-latn-us",apl:"apl-latn-us",apm:"apm-latn-us",apn:"apn-latn-br",apo:"apo-latn-pg",app:"app-latn-vu",apr:"apr-latn-zz",aps:"aps-latn-zz",apt:"apt-latn-in",apu:"apu-latn-br",apv:"apv-latn-br",apw:"apw-latn-us",apx:"apx-latn-id",apy:"apy-latn-br",apz:"apz-latn-zz",aqc:"aqc-cyrl-ru",aqd:"aqd-latn-ml",aqg:"aqg-latn-ng",aqk:"aqk-latn-ng",aqm:"aqm-latn-id",aqn:"aqn-latn-ph",aqr:"aqr-latn-nc",aqt:"aqt-latn-py",aqz:"aqz-latn-br",ar:"ar-arab-eg",arc:"arc-armi-ir","arc-nbat":"arc-nbat-jo","arc-palm":"arc-palm-sy",ard:"ard-latn-au",are:"are-latn-au",arh:"arh-latn-zz",ari:"ari-latn-us",arj:"arj-latn-br",ark:"ark-latn-br",arl:"arl-latn-pe",arn:"arn-latn-cl",aro:"aro-latn-bo",arp:"arp-latn-us",arq:"arq-arab-dz",arr:"arr-latn-br",ars:"ars-arab-sa",aru:"aru-latn-br",arw:"arw-latn-sr",arx:"arx-latn-br",ary:"ary-arab-ma",arz:"arz-arab-eg",as:"as-beng-in",asa:"asa-latn-tz",asb:"asb-latn-ca",asc:"asc-latn-id",ase:"ase-sgnw-us",asg:"asg-latn-zz",ash:"ash-latn-pe",asi:"asi-latn-id",asj:"asj-latn-cm",ask:"ask-arab-af",asl:"asl-latn-id",asn:"asn-latn-br",aso:"aso-latn-zz",ass:"ass-latn-cm",ast:"ast-latn-es",asu:"asu-latn-br",asv:"asv-latn-cd",asx:"asx-latn-pg",asy:"asy-latn-id",asz:"asz-latn-id",ata:"ata-latn-zz",atb:"atb-latn-cn","atb-lisu":"atb-lisu-cn",atc:"atc-latn-pe",atd:"atd-latn-ph",ate:"ate-latn-pg",atg:"atg-latn-zz",ati:"ati-latn-ci",atj:"atj-latn-ca",atk:"atk-latn-ph",atl:"atl-latn-ph",atm:"atm-latn-ph",atn:"atn-arab-ir",ato:"ato-latn-cm",atp:"atp-latn-ph",atq:"atq-latn-id",atr:"atr-latn-br",ats:"ats-latn-us",att:"att-latn-ph",atu:"atu-latn-ss",atv:"atv-cyrl-ru",atw:"atw-latn-us",atx:"atx-latn-br",aty:"aty-latn-vu",atz:"atz-latn-ph",aua:"aua-latn-sb",auc:"auc-latn-ec",aud:"aud-latn-sb",aug:"aug-latn-bj",auh:"auh-latn-zm",aui:"aui-latn-pg",auj:"auj-arab-ly","auj-latn":"auj-latn-ly","auj-tfng":"auj-tfng-ly",auk:"auk-latn-pg",aul:"aul-latn-vu",aum:"aum-latn-ng",aun:"aun-latn-pg",auo:"auo-latn-ng",aup:"aup-latn-pg",auq:"auq-latn-id",aur:"aur-latn-pg",aut:"aut-latn-pf",auu:"auu-latn-id",auw:"auw-latn-id",auy:"auy-latn-zz",auz:"auz-arab-uz",av:"av-cyrl-ru",avb:"avb-latn-pg",avd:"avd-arab-ir",avi:"avi-latn-ci",avk:"avk-latn-001",avl:"avl-arab-zz",avm:"avm-latn-au",avn:"avn-latn-zz",avo:"avo-latn-br",avs:"avs-latn-pe",avt:"avt-latn-zz",avu:"avu-latn-zz",avv:"avv-latn-br",awa:"awa-deva-in",awb:"awb-latn-zz",awc:"awc-latn-ng",awe:"awe-latn-br",awg:"awg-latn-au",awh:"awh-latn-id",awi:"awi-latn-pg",awk:"awk-latn-au",awm:"awm-latn-pg",awn:"awn-ethi-et",awo:"awo-latn-zz",awr:"awr-latn-id",aws:"aws-latn-id",awt:"awt-latn-br",awu:"awu-latn-id",awv:"awv-latn-id",aww:"aww-latn-pg",awx:"awx-latn-zz",awy:"awy-latn-id",axb:"axb-latn-ar",axe:"axe-latn-au",axg:"axg-latn-br",axk:"axk-latn-cf",axl:"axl-latn-au",axm:"axm-armn-am",axx:"axx-latn-nc",ay:"ay-latn-bo",aya:"aya-latn-pg",ayb:"ayb-latn-zz",ayc:"ayc-latn-pe",ayd:"ayd-latn-au",aye:"aye-latn-ng",ayg:"ayg-latn-tg",ayh:"ayh-arab-ye",ayi:"ayi-latn-ng",ayk:"ayk-latn-ng",ayl:"ayl-arab-ly",ayn:"ayn-arab-ye",ayo:"ayo-latn-py",ayp:"ayp-arab-iq",ayq:"ayq-latn-pg",ays:"ays-latn-ph",ayt:"ayt-latn-ph",ayu:"ayu-latn-ng",ayz:"ayz-latn-id",az:"az-latn-az","az-arab":"az-arab-ir","az-iq":"az-arab-iq","az-ir":"az-arab-ir","az-ru":"az-cyrl-ru",azb:"azb-arab-ir","azb-cyrl":"azb-cyrl-az","azb-latn":"azb-latn-az",azd:"azd-latn-mx",azg:"azg-latn-mx",azm:"azm-latn-mx",azn:"azn-latn-mx",azo:"azo-latn-cm",azt:"azt-latn-ph",azz:"azz-latn-mx",ba:"ba-cyrl-ru",baa:"baa-latn-sb",bab:"bab-latn-gw",bac:"bac-latn-id",bae:"bae-latn-ve",baf:"baf-latn-cm",bag:"bag-latn-cm",bah:"bah-latn-bs",baj:"baj-latn-id",bal:"bal-arab-pk",ban:"ban-latn-id",bao:"bao-latn-co",bap:"bap-deva-np",bar:"bar-latn-at",bas:"bas-latn-cm",bau:"bau-latn-ng",bav:"bav-latn-zz",baw:"baw-latn-cm",bax:"bax-bamu-cm",bay:"bay-latn-id",bba:"bba-latn-zz",bbb:"bbb-latn-zz",bbc:"bbc-latn-id",bbd:"bbd-latn-zz",bbe:"bbe-latn-cd",bbf:"bbf-latn-pg",bbg:"bbg-latn-ga",bbi:"bbi-latn-cm",bbj:"bbj-latn-cm",bbk:"bbk-latn-cm",bbl:"bbl-geor-ge",bbm:"bbm-latn-cd",bbn:"bbn-latn-pg",bbo:"bbo-latn-bf",bbp:"bbp-latn-zz",bbq:"bbq-latn-cm",bbr:"bbr-latn-zz",bbs:"bbs-latn-ng",bbt:"bbt-latn-ng",bbu:"bbu-latn-ng",bbv:"bbv-latn-pg",bbw:"bbw-latn-cm",bbx:"bbx-latn-cm",bby:"bby-latn-cm",bca:"bca-latn-cn","bca-hani":"bca-hani-cn",bcb:"bcb-latn-sn",bcd:"bcd-latn-id",bce:"bce-latn-cm",bcf:"bcf-latn-zz",bcg:"bcg-latn-gn",bch:"bch-latn-zz",bci:"bci-latn-ci",bcj:"bcj-latn-au",bck:"bck-latn-au",bcm:"bcm-latn-zz",bcn:"bcn-latn-zz",bco:"bco-latn-zz",bcp:"bcp-latn-cd",bcq:"bcq-ethi-zz",bcr:"bcr-latn-ca",bcs:"bcs-latn-ng",bct:"bct-latn-cd",bcu:"bcu-latn-zz",bcv:"bcv-latn-ng",bcw:"bcw-latn-cm",bcy:"bcy-latn-ng",bcz:"bcz-latn-sn",bda:"bda-latn-sn",bdb:"bdb-latn-id",bdc:"bdc-latn-co",bdd:"bdd-latn-zz",bde:"bde-latn-ng",bdf:"bdf-latn-pg",bdg:"bdg-latn-my",bdh:"bdh-latn-ss",bdi:"bdi-latn-sd",bdj:"bdj-latn-ss",bdk:"bdk-latn-az",bdl:"bdl-latn-id",bdm:"bdm-latn-td",bdn:"bdn-latn-cm",bdo:"bdo-latn-td",bdp:"bdp-latn-tz",bdq:"bdq-latn-vn",bdr:"bdr-latn-my",bds:"bds-latn-tz",bdt:"bdt-latn-cf",bdu:"bdu-latn-cm",bdv:"bdv-orya-in",bdw:"bdw-latn-id",bdx:"bdx-latn-id",bdy:"bdy-latn-au",bdz:"bdz-arab-pk",be:"be-cyrl-by",bea:"bea-latn-ca","bea-cans":"bea-cans-ca",beb:"beb-latn-cm",bec:"bec-latn-cm",bed:"bed-latn-id",bee:"bee-deva-in",bef:"bef-latn-zz",beh:"beh-latn-zz",bei:"bei-latn-id",bej:"bej-arab-sd",bek:"bek-latn-pg",bem:"bem-latn-zm",beo:"beo-latn-pg",bep:"bep-latn-id",beq:"beq-latn-cg",bes:"bes-latn-td",bet:"bet-latn-zz",beu:"beu-latn-id",bev:"bev-latn-ci",bew:"bew-latn-id",bex:"bex-latn-zz",bey:"bey-latn-pg",bez:"bez-latn-tz",bfa:"bfa-latn-ss","bfa-arab":"bfa-arab-ss",bfb:"bfb-deva-in",bfc:"bfc-latn-cn",bfd:"bfd-latn-cm",bfe:"bfe-latn-id",bff:"bff-latn-cf",bfg:"bfg-latn-id",bfh:"bfh-latn-pg",bfj:"bfj-latn-cm",bfl:"bfl-latn-cf",bfm:"bfm-latn-cm",bfn:"bfn-latn-tl",bfo:"bfo-latn-bf",bfp:"bfp-latn-cm",bfq:"bfq-taml-in",bfs:"bfs-latn-cn","bfs-hani":"bfs-hani-cn",bft:"bft-arab-pk",bfu:"bfu-tibt-in","bfu-takr":"bfu-takr-in",bfw:"bfw-orya-in",bfx:"bfx-latn-ph",bfy:"bfy-deva-in",bfz:"bfz-deva-in",bg:"bg-cyrl-bg",bga:"bga-latn-ng",bgb:"bgb-latn-id",bgc:"bgc-deva-in",bgd:"bgd-deva-in",bgf:"bgf-latn-cm",bgg:"bgg-latn-in",bgi:"bgi-latn-ph",bgj:"bgj-latn-cm",bgn:"bgn-arab-pk",bgo:"bgo-latn-gn",bgp:"bgp-arab-pk",bgq:"bgq-deva-in",bgr:"bgr-latn-in",bgs:"bgs-latn-ph",bgt:"bgt-latn-sb",bgu:"bgu-latn-ng",bgv:"bgv-latn-id",bgw:"bgw-deva-in",bgx:"bgx-grek-tr",bgy:"bgy-latn-id",bgz:"bgz-latn-id",bha:"bha-deva-in",bhb:"bhb-deva-in",bhc:"bhc-latn-id",bhd:"bhd-deva-in","bhd-arab":"bhd-arab-in","bhd-takr":"bhd-takr-in",bhe:"bhe-arab-pk",bhf:"bhf-latn-pg",bhg:"bhg-latn-zz",bhh:"bhh-cyrl-il","bhh-hebr":"bhh-hebr-il","bhh-latn":"bhh-latn-il",bhi:"bhi-deva-in",bhj:"bhj-deva-np",bhl:"bhl-latn-zz",bhm:"bhm-arab-om",bhn:"bhn-syrc-ge",bho:"bho-deva-in",bhp:"bhp-latn-id",bhq:"bhq-latn-id",bhr:"bhr-latn-mg",bhs:"bhs-latn-cm",bht:"bht-takr-in","bht-deva":"bht-deva-in","bht-latn":"bht-latn-in",bhu:"bhu-deva-in",bhv:"bhv-latn-id",bhw:"bhw-latn-id",bhy:"bhy-latn-zz",bhz:"bhz-latn-id",bi:"bi-latn-vu",bia:"bia-latn-au",bib:"bib-latn-zz",bid:"bid-latn-td",bie:"bie-latn-pg",bif:"bif-latn-gw",big:"big-latn-zz",bik:"bik-latn-ph",bil:"bil-latn-ng",bim:"bim-latn-zz",bin:"bin-latn-ng",bio:"bio-latn-zz",bip:"bip-latn-cd",biq:"biq-latn-zz",bir:"bir-latn-pg",bit:"bit-latn-pg",biu:"biu-latn-in",biv:"biv-latn-gh",biw:"biw-latn-cm",biy:"biy-deva-in",biz:"biz-latn-cd",bja:"bja-latn-cd",bjb:"bjb-latn-au",bjc:"bjc-latn-pg",bjf:"bjf-syrc-il",bjg:"bjg-latn-gw",bjh:"bjh-latn-zz",bji:"bji-ethi-zz",bjj:"bjj-deva-in",bjk:"bjk-latn-pg",bjl:"bjl-latn-pg",bjm:"bjm-arab-iq",bjn:"bjn-latn-id",bjo:"bjo-latn-zz",bjp:"bjp-latn-pg",bjr:"bjr-latn-zz",bjs:"bjs-latn-bb",bjt:"bjt-latn-sn",bju:"bju-latn-cm",bjv:"bjv-latn-td",bjw:"bjw-latn-ci",bjx:"bjx-latn-ph",bjy:"bjy-latn-au",bjz:"bjz-latn-zz",bka:"bka-latn-ng",bkc:"bkc-latn-zz",bkd:"bkd-latn-ph",bkf:"bkf-latn-cd",bkg:"bkg-latn-cf",bkh:"bkh-latn-cm",bki:"bki-latn-vu",bkj:"bkj-latn-cf",bkl:"bkl-latn-id",bkm:"bkm-latn-cm",bkn:"bkn-latn-id",bko:"bko-latn-cm",bkp:"bkp-latn-cd",bkq:"bkq-latn-zz",bkr:"bkr-latn-id",bks:"bks-latn-ph",bkt:"bkt-latn-cd",bku:"bku-latn-ph",bkv:"bkv-latn-zz",bkw:"bkw-latn-cg",bkx:"bkx-latn-tl",bky:"bky-latn-ng",bkz:"bkz-latn-id",bla:"bla-latn-ca",blb:"blb-latn-sb",blc:"blc-latn-ca",bld:"bld-latn-id",ble:"ble-latn-gw",blf:"blf-latn-id",blg:"blg-latn-my",blh:"blh-latn-lr",bli:"bli-latn-cd",blj:"blj-latn-id",blk:"blk-mymr-mm",blm:"blm-latn-ss",bln:"bln-latn-ph",blo:"blo-latn-bj",blp:"blp-latn-sb",blq:"blq-latn-pg",blr:"blr-latn-cn","blr-tale":"blr-tale-cn","blr-thai":"blr-thai-th",bls:"bls-latn-id",blt:"blt-tavt-vn",blv:"blv-latn-ao",blw:"blw-latn-ph",blx:"blx-latn-ph",bly:"bly-latn-bj",blz:"blz-latn-id",bm:"bm-latn-ml",bma:"bma-latn-ng",bmb:"bmb-latn-cd",bmc:"bmc-latn-pg",bmd:"bmd-latn-gn",bme:"bme-latn-cf",bmf:"bmf-latn-sl",bmg:"bmg-latn-cd",bmh:"bmh-latn-zz",bmi:"bmi-latn-td",bmj:"bmj-deva-np",bmk:"bmk-latn-zz",bml:"bml-latn-cd",bmm:"bmm-latn-mg",bmn:"bmn-latn-pg",bmo:"bmo-latn-cm",bmp:"bmp-latn-pg",bmq:"bmq-latn-ml",bmr:"bmr-latn-co",bms:"bms-latn-ne",bmu:"bmu-latn-zz",bmv:"bmv-latn-cm",bmw:"bmw-latn-cg",bmx:"bmx-latn-pg",bmz:"bmz-latn-pg",bn:"bn-beng-bd",bna:"bna-latn-id",bnb:"bnb-latn-my",bnc:"bnc-latn-ph",bnd:"bnd-latn-id",bne:"bne-latn-id",bnf:"bnf-latn-id",bng:"bng-latn-zz",bni:"bni-latn-cd",bnj:"bnj-latn-ph",bnk:"bnk-latn-vu",bnm:"bnm-latn-zz",bnn:"bnn-latn-tw",bno:"bno-latn-ph",bnp:"bnp-latn-zz",bnq:"bnq-latn-id",bnr:"bnr-latn-vu",bns:"bns-deva-in",bnu:"bnu-latn-id",bnv:"bnv-latn-id",bnw:"bnw-latn-pg",bnx:"bnx-latn-cd",bny:"bny-latn-my",bnz:"bnz-latn-cm",bo:"bo-tibt-cn",boa:"boa-latn-pe",bob:"bob-latn-ke",boe:"boe-latn-cm",bof:"bof-latn-bf",boh:"boh-latn-cd",boj:"boj-latn-zz",bok:"bok-latn-cg",bol:"bol-latn-ng",bom:"bom-latn-zz",bon:"bon-latn-zz",boo:"boo-latn-ml",bop:"bop-latn-pg",boq:"boq-latn-pg",bor:"bor-latn-br",bot:"bot-latn-ss",bou:"bou-latn-tz",bov:"bov-latn-gh",bow:"bow-latn-pg",box:"box-latn-bf",boy:"boy-latn-cf",boz:"boz-latn-ml","boz-arab":"boz-arab-ml",bpa:"bpa-latn-vu",bpc:"bpc-latn-cm",bpd:"bpd-latn-cf",bpe:"bpe-latn-pg",bpg:"bpg-latn-id",bph:"bph-cyrl-ru",bpi:"bpi-latn-pg",bpj:"bpj-latn-cd",bpk:"bpk-latn-nc",bpl:"bpl-latn-au",bpm:"bpm-latn-pg",bpo:"bpo-latn-id",bpp:"bpp-latn-id",bpq:"bpq-latn-id",bpr:"bpr-latn-ph",bps:"bps-latn-ph",bpt:"bpt-latn-au",bpu:"bpu-latn-pg",bpv:"bpv-latn-id",bpw:"bpw-latn-pg",bpx:"bpx-deva-in",bpy:"bpy-beng-in",bpz:"bpz-latn-id",bqa:"bqa-latn-bj",bqb:"bqb-latn-id",bqc:"bqc-latn-zz",bqd:"bqd-latn-cm",bqf:"bqf-latn-gn","bqf-arab":"bqf-arab-gn",bqg:"bqg-latn-tg",bqi:"bqi-arab-ir",bqj:"bqj-latn-sn",bqk:"bqk-latn-cf",bql:"bql-latn-pg",bqm:"bqm-latn-cm",bqo:"bqo-latn-cm",bqp:"bqp-latn-zz",bqq:"bqq-latn-id",bqr:"bqr-latn-id",bqs:"bqs-latn-pg",bqt:"bqt-latn-cm",bqu:"bqu-latn-cd",bqv:"bqv-latn-ci",bqw:"bqw-latn-ng",bqx:"bqx-latn-ng",bqz:"bqz-latn-cm",br:"br-latn-fr",bra:"bra-deva-in",brb:"brb-khmr-kh","brb-laoo":"brb-laoo-la","brb-latn":"brb-latn-vn",brc:"brc-latn-gy",brd:"brd-deva-np",brf:"brf-latn-cd",brg:"brg-latn-bo",brh:"brh-arab-pk",bri:"bri-latn-cm",brj:"brj-latn-vu",brk:"brk-arab-sd",brl:"brl-latn-bw",brm:"brm-latn-cd",brn:"brn-latn-cr",brp:"brp-latn-id",brq:"brq-latn-pg",brr:"brr-latn-sb",brs:"brs-latn-id",brt:"brt-latn-ng",bru:"bru-latn-vn","bru-laoo":"bru-laoo-la","bru-thai":"bru-thai-la",brv:"brv-laoo-la",brx:"brx-deva-in",bry:"bry-latn-pg",brz:"brz-latn-zz",bs:"bs-latn-ba",bsa:"bsa-latn-id",bsb:"bsb-latn-bn",bsc:"bsc-latn-sn",bse:"bse-latn-cm",bsf:"bsf-latn-ng",bsh:"bsh-arab-af",bsi:"bsi-latn-cm",bsj:"bsj-latn-zz",bsk:"bsk-arab-pk","bsk-latn":"bsk-latn-pk",bsl:"bsl-latn-ng",bsm:"bsm-latn-id",bsn:"bsn-latn-co",bso:"bso-latn-td",bsp:"bsp-latn-gn",bsq:"bsq-bass-lr",bsr:"bsr-latn-ng",bss:"bss-latn-cm",bst:"bst-ethi-zz",bsu:"bsu-latn-id",bsv:"bsv-latn-gn","bsv-arab":"bsv-arab-gn",bsw:"bsw-latn-et","bsw-ethi":"bsw-ethi-et",bsx:"bsx-latn-ng",bsy:"bsy-latn-my",bta:"bta-latn-ng",btc:"btc-latn-cm",btd:"btd-batk-id",bte:"bte-latn-ng",btf:"btf-latn-td",btg:"btg-latn-ci",bth:"bth-latn-my",bti:"bti-latn-id",btj:"btj-latn-id",btm:"btm-batk-id",btn:"btn-latn-ph",bto:"bto-latn-ph",btp:"btp-latn-pg",btq:"btq-latn-my",btr:"btr-latn-vu",bts:"bts-latn-id","bts-batk":"bts-batk-id",btt:"btt-latn-zz",btu:"btu-latn-ng",btv:"btv-deva-pk",btw:"btw-latn-ph",btx:"btx-latn-id","btx-batk":"btx-batk-id",bty:"bty-latn-id",btz:"btz-latn-id",bua:"bua-cyrl-ru",bub:"bub-latn-td",buc:"buc-latn-yt",bud:"bud-latn-zz",bue:"bue-latn-ca",buf:"buf-latn-cd",bug:"bug-latn-id",buh:"buh-latn-cn",bui:"bui-latn-cg",buj:"buj-latn-ng",buk:"buk-latn-zz",bum:"bum-latn-cm",bun:"bun-latn-sl",buo:"buo-latn-zz",bup:"bup-latn-id",buq:"buq-latn-pg",bus:"bus-latn-zz",but:"but-latn-pg",buu:"buu-latn-zz",buv:"buv-latn-pg",buw:"buw-latn-ga",bux:"bux-latn-ng",buy:"buy-latn-sl",buz:"buz-latn-ng",bva:"bva-latn-td",bvb:"bvb-latn-gq",bvc:"bvc-latn-sb",bvd:"bvd-latn-sb",bve:"bve-latn-id",bvf:"bvf-latn-td",bvg:"bvg-latn-cm",bvh:"bvh-latn-ng",bvi:"bvi-latn-ss",bvj:"bvj-latn-ng",bvk:"bvk-latn-id",bvm:"bvm-latn-cm",bvn:"bvn-latn-pg",bvo:"bvo-latn-td",bvq:"bvq-latn-cf",bvr:"bvr-latn-au",bvt:"bvt-latn-id",bvu:"bvu-latn-id",bvv:"bvv-latn-ve",bvw:"bvw-latn-ng",bvx:"bvx-latn-cg",bvy:"bvy-latn-ph",bvz:"bvz-latn-id",bwa:"bwa-latn-nc",bwb:"bwb-latn-fj",bwc:"bwc-latn-zm",bwd:"bwd-latn-zz",bwe:"bwe-mymr-mm","bwe-latn":"bwe-latn-mm",bwf:"bwf-latn-pg",bwg:"bwg-latn-mz",bwh:"bwh-latn-cm",bwi:"bwi-latn-ve",bwj:"bwj-latn-bf",bwk:"bwk-latn-pg",bwl:"bwl-latn-cd",bwm:"bwm-latn-pg",bwo:"bwo-latn-et","bwo-ethi":"bwo-ethi-et",bwp:"bwp-latn-id",bwq:"bwq-latn-bf",bwr:"bwr-latn-zz",bws:"bws-latn-cd",bwt:"bwt-latn-cm",bwu:"bwu-latn-gh",bww:"bww-latn-cd",bwx:"bwx-latn-cn",bwy:"bwy-latn-bf",bwz:"bwz-latn-cg",bxa:"bxa-latn-sb",bxb:"bxb-latn-ss",bxc:"bxc-latn-gq",bxf:"bxf-latn-pg",bxg:"bxg-latn-cd",bxh:"bxh-latn-zz",bxi:"bxi-latn-au",bxj:"bxj-latn-au",bxl:"bxl-latn-bf",bxm:"bxm-cyrl-mn","bxm-latn":"bxm-latn-mn","bxm-mong":"bxm-mong-mn",bxn:"bxn-latn-au",bxo:"bxo-latn-ng",bxp:"bxp-latn-cm",bxq:"bxq-latn-ng",bxs:"bxs-latn-cm",bxu:"bxu-mong-cn","bxu-cyrl":"bxu-cyrl-cn","bxu-latn":"bxu-latn-cn",bxv:"bxv-latn-td",bxw:"bxw-latn-ml",bxz:"bxz-latn-pg",bya:"bya-latn-ph",byb:"byb-latn-cm",byc:"byc-latn-ng",byd:"byd-latn-id",bye:"bye-latn-zz",byf:"byf-latn-ng",byh:"byh-deva-np",byi:"byi-latn-cd",byj:"byj-latn-ng",byk:"byk-latn-cn",byl:"byl-latn-id",bym:"bym-latn-au",byn:"byn-ethi-er",byp:"byp-latn-ng",byr:"byr-latn-zz",bys:"bys-latn-zz",byv:"byv-latn-cm",byw:"byw-deva-np",byx:"byx-latn-zz",byz:"byz-latn-pg",bza:"bza-latn-zz",bzb:"bzb-latn-id",bzc:"bzc-latn-mg",bzd:"bzd-latn-cr",bze:"bze-latn-ml",bzf:"bzf-latn-zz",bzh:"bzh-latn-zz",bzi:"bzi-thai-th",bzj:"bzj-latn-bz",bzk:"bzk-latn-ni",bzl:"bzl-latn-id",bzm:"bzm-latn-cd",bzn:"bzn-latn-id",bzo:"bzo-latn-cd",bzp:"bzp-latn-id",bzq:"bzq-latn-id",bzr:"bzr-latn-au",bzt:"bzt-latn-001",bzu:"bzu-latn-id",bzv:"bzv-latn-cm",bzw:"bzw-latn-zz",bzx:"bzx-latn-ml",bzy:"bzy-latn-ng",bzz:"bzz-latn-ng",ca:"ca-latn-es",caa:"caa-latn-gt",cab:"cab-latn-hn",cac:"cac-latn-gt",cad:"cad-latn-us",cae:"cae-latn-sn",caf:"caf-latn-ca","caf-cans":"caf-cans-ca",cag:"cag-latn-py",cah:"cah-latn-pe",caj:"caj-latn-ar",cak:"cak-latn-gt",cal:"cal-latn-mp",cam:"cam-latn-nc",can:"can-latn-zz",cao:"cao-latn-bo",cap:"cap-latn-bo",caq:"caq-latn-in",car:"car-latn-ve",cas:"cas-latn-bo",cav:"cav-latn-bo",caw:"caw-latn-bo",cax:"cax-latn-bo",cay:"cay-latn-ca",caz:"caz-latn-bo",cbb:"cbb-latn-co",cbc:"cbc-latn-co",cbd:"cbd-latn-co",cbg:"cbg-latn-co",cbi:"cbi-latn-ec",cbj:"cbj-latn-zz",cbk:"cbk-latn-ph","cbk-brai":"cbk-brai-ph",cbl:"cbl-latn-mm",cbn:"cbn-thai-th",cbo:"cbo-latn-ng",cbq:"cbq-latn-ng",cbr:"cbr-latn-pe",cbs:"cbs-latn-pe",cbt:"cbt-latn-pe",cbu:"cbu-latn-pe",cbv:"cbv-latn-co",cbw:"cbw-latn-ph",cby:"cby-latn-co",ccc:"ccc-latn-pe",ccd:"ccd-latn-br",cce:"cce-latn-mz",ccg:"ccg-latn-ng",cch:"cch-latn-ng",ccj:"ccj-latn-gw",ccl:"ccl-latn-tz",ccm:"ccm-latn-my",cco:"cco-latn-mx",ccp:"ccp-cakm-bd",ccr:"ccr-latn-sv",cde:"cde-telu-in",cdf:"cdf-latn-in","cdf-beng":"cdf-beng-in",cdh:"cdh-deva-in","cdh-takr":"cdh-takr-in",cdi:"cdi-gujr-in",cdj:"cdj-deva-in",cdm:"cdm-deva-np","cdm-latn":"cdm-latn-np",cdo:"cdo-hans-cn","cdo-hant":"cdo-hant-cn","cdo-latn":"cdo-latn-cn",cdr:"cdr-latn-ng",cdz:"cdz-beng-in",ce:"ce-cyrl-ru",cea:"cea-latn-us",ceb:"ceb-latn-ph",ceg:"ceg-latn-py",cek:"cek-latn-mm",cen:"cen-latn-ng",cet:"cet-latn-ng",cey:"cey-latn-mm",cfa:"cfa-latn-zz",cfd:"cfd-latn-ng",cfg:"cfg-latn-ng",cfm:"cfm-latn-mm","cfm-beng":"cfm-beng-in",cga:"cga-latn-pg",cgc:"cgc-latn-ph",cgg:"cgg-latn-ug",cgk:"cgk-tibt-bt",ch:"ch-latn-gu",chb:"chb-latn-co",chd:"chd-latn-mx",chf:"chf-latn-mx",chg:"chg-arab-tm",chh:"chh-latn-us",chj:"chj-latn-mx",chk:"chk-latn-fm",chl:"chl-latn-us",chm:"chm-cyrl-ru",chn:"chn-latn-us","chn-dupl":"chn-dupl-us",cho:"cho-latn-us",chp:"chp-latn-ca",chq:"chq-latn-mx",chr:"chr-cher-us",cht:"cht-latn-pe",chw:"chw-latn-mz",chx:"chx-deva-np",chy:"chy-latn-us",chz:"chz-latn-mx",cia:"cia-latn-id","cia-arab":"cia-arab-id","cia-hang":"cia-hang-id",cib:"cib-latn-bj",cic:"cic-latn-us",cie:"cie-latn-ng",cih:"cih-deva-in",cim:"cim-latn-it",cin:"cin-latn-br",cip:"cip-latn-mx",cir:"cir-latn-nc",ciw:"ciw-latn-us","ciw-cans":"ciw-cans-us",ciy:"ciy-latn-ve",cja:"cja-arab-kh",cje:"cje-latn-vn",cjh:"cjh-latn-us",cji:"cji-cyrl-ru",cjk:"cjk-latn-ao",cjm:"cjm-cham-vn",cjn:"cjn-latn-pg",cjo:"cjo-latn-pe",cjp:"cjp-latn-cr",cjs:"cjs-latn-ru","cjs-cyrl":"cjs-cyrl-ru",cjv:"cjv-latn-zz",cjy:"cjy-hans-cn","cjy-hant":"cjy-hant-cn",ckb:"ckb-arab-iq",ckl:"ckl-latn-zz",ckm:"ckm-latn-hr","ckm-glag":"ckm-glag-hr",ckn:"ckn-latn-mm",cko:"cko-latn-zz",ckq:"ckq-latn-td",ckr:"ckr-latn-pg",cks:"cks-latn-nc",ckt:"ckt-cyrl-ru",cku:"cku-latn-us",ckv:"ckv-latn-tw",ckx:"ckx-latn-cm",cky:"cky-latn-zz",ckz:"ckz-latn-gt",cla:"cla-latn-zz",clc:"clc-latn-ca",cle:"cle-latn-mx",clh:"clh-arab-pk",cli:"cli-latn-gh",clj:"clj-latn-mm",clk:"clk-latn-in","clk-tibt":"clk-tibt-cn",cll:"cll-latn-gh",clm:"clm-latn-us",clo:"clo-latn-mx",clt:"clt-latn-mm",clu:"clu-latn-ph",clw:"clw-cyrl-ru",cly:"cly-latn-mx",cma:"cma-latn-vn",cme:"cme-latn-zz",cmg:"cmg-soyo-mn",cmi:"cmi-latn-co",cml:"cml-latn-id",cmo:"cmo-latn-vn","cmo-kh":"cmo-latn-kh","cmo-khmr":"cmo-khmr-kh",cmr:"cmr-latn-mm",cms:"cms-latn-it",cmt:"cmt-latn-za",cna:"cna-tibt-in",cnb:"cnb-latn-mm",cnc:"cnc-latn-vn",cng:"cng-latn-cn",cnh:"cnh-latn-mm",cni:"cni-latn-pe",cnk:"cnk-latn-mm",cnl:"cnl-latn-mx",cnp:"cnp-hans-cn","cnp-hant":"cnp-hant-cn",cnq:"cnq-latn-cm",cns:"cns-latn-id",cnt:"cnt-latn-mx",cnw:"cnw-latn-mm",cnx:"cnx-latn-gb",co:"co-latn-fr",coa:"coa-latn-au",cob:"cob-latn-mx",coc:"coc-latn-mx",cod:"cod-latn-pe",coe:"coe-latn-co",cof:"cof-latn-ec",cog:"cog-thai-th",coh:"coh-latn-ke",coj:"coj-latn-mx",cok:"cok-latn-mx",col:"col-latn-us",com:"com-latn-us",coo:"coo-latn-ca",cop:"cop-copt-eg",coq:"coq-latn-us",cot:"cot-latn-pe",cou:"cou-latn-sn",cox:"cox-latn-pe",coz:"coz-latn-mx",cpa:"cpa-latn-mx",cpb:"cpb-latn-pe",cpc:"cpc-latn-pe",cpg:"cpg-grek-gr",cpi:"cpi-latn-nr",cpn:"cpn-latn-gh",cpo:"cpo-latn-bf",cps:"cps-latn-ph",cpu:"cpu-latn-pe",cpx:"cpx-latn-cn",cpy:"cpy-latn-pe",cqd:"cqd-latn-cn",cr:"cr-cans-ca",crb:"crb-latn-vc",crc:"crc-latn-vu",crd:"crd-latn-us",crf:"crf-latn-co",crg:"crg-latn-ca",crh:"crh-cyrl-ua",cri:"cri-latn-st",crj:"crj-cans-ca","crj-latn":"crj-latn-ca",crk:"crk-cans-ca",crl:"crl-cans-ca",crm:"crm-cans-ca",crn:"crn-latn-mx",cro:"cro-latn-us",crq:"crq-latn-ar",crs:"crs-latn-sc",crt:"crt-latn-ar",crv:"crv-latn-in",crw:"crw-latn-vn",crx:"crx-latn-ca","crx-cans":"crx-cans-ca",cry:"cry-latn-ng",crz:"crz-latn-us",cs:"cs-latn-cz",csa:"csa-latn-mx",csb:"csb-latn-pl",csh:"csh-mymr-mm","csh-latn":"csh-latn-mm",csj:"csj-latn-mm",csk:"csk-latn-sn",csm:"csm-latn-us",cso:"cso-latn-mx",csp:"csp-hans-cn","csp-hant":"csp-hant-cn",css:"css-latn-us",cst:"cst-latn-us",csv:"csv-latn-mm",csw:"csw-cans-ca",csy:"csy-latn-mm",csz:"csz-latn-us",cta:"cta-latn-mx",ctc:"ctc-latn-us",ctd:"ctd-pauc-mm",cte:"cte-latn-mx",ctg:"ctg-beng-bd","ctg-arab":"ctg-arab-bd","ctg-latn":"ctg-latn-bd",cth:"cth-latn-mm",ctl:"ctl-latn-mx",ctm:"ctm-latn-us",ctn:"ctn-deva-np",cto:"cto-latn-co",ctp:"ctp-latn-mx",cts:"cts-latn-ph",ctt:"ctt-taml-in",ctu:"ctu-latn-mx",ctz:"ctz-latn-mx",cu:"cu-cyrl-ru","cu-glag":"cu-glag-bg",cua:"cua-latn-vn",cub:"cub-latn-co",cuc:"cuc-latn-mx",cuh:"cuh-latn-ke",cui:"cui-latn-co",cuj:"cuj-latn-pe",cuk:"cuk-latn-pa",cul:"cul-latn-br",cuo:"cuo-latn-ve",cup:"cup-latn-us",cut:"cut-latn-mx",cuu:"cuu-lana-cn",cuv:"cuv-latn-cm",cux:"cux-latn-mx",cv:"cv-cyrl-ru",cvg:"cvg-latn-in","cvg-tibt":"cvg-tibt-in",cvn:"cvn-latn-mx",cwa:"cwa-latn-tz",cwb:"cwb-latn-mz",cwe:"cwe-latn-tz",cwg:"cwg-latn-my",cwt:"cwt-latn-sn",cy:"cy-latn-gb",cya:"cya-latn-mx",cyb:"cyb-latn-bo",cyo:"cyo-latn-ph",czh:"czh-hans-cn","czh-hant":"czh-hant-cn",czk:"czk-hebr-cz",czn:"czn-latn-mx",czt:"czt-latn-mm",da:"da-latn-dk",daa:"daa-latn-td",dac:"dac-latn-pg",dad:"dad-latn-zz",dae:"dae-latn-cm",daf:"daf-latn-ci",dag:"dag-latn-zz",dah:"dah-latn-zz",dai:"dai-latn-td",daj:"daj-latn-sd",dak:"dak-latn-us",dal:"dal-latn-ke",dam:"dam-latn-ng",dao:"dao-latn-mm",daq:"daq-deva-in",dar:"dar-cyrl-ru",das:"das-latn-ci",dau:"dau-latn-td",dav:"dav-latn-ke",daw:"daw-latn-ph",dax:"dax-latn-au",daz:"daz-latn-id",dba:"dba-latn-ml",dbb:"dbb-latn-ng",dbd:"dbd-latn-zz",dbe:"dbe-latn-id",dbf:"dbf-latn-id",dbg:"dbg-latn-ml",dbi:"dbi-latn-ng",dbj:"dbj-latn-my","dbj-arab":"dbj-arab-my",dbl:"dbl-latn-au",dbm:"dbm-latn-ng",dbn:"dbn-latn-id",dbo:"dbo-latn-ng",dbp:"dbp-latn-ng",dbq:"dbq-latn-zz",dbt:"dbt-latn-ml",dbu:"dbu-latn-ml",dbv:"dbv-latn-ng",dbw:"dbw-latn-ml",dby:"dby-latn-pg",dcc:"dcc-arab-in",dcr:"dcr-latn-vi",dda:"dda-latn-au",ddd:"ddd-latn-ss",dde:"dde-latn-cg",ddg:"ddg-latn-tl",ddi:"ddi-latn-pg",ddj:"ddj-latn-au",ddn:"ddn-latn-zz",ddo:"ddo-cyrl-ru",ddr:"ddr-latn-au",dds:"dds-latn-ml",ddw:"ddw-latn-id",de:"de-latn-de",dec:"dec-latn-sd",ded:"ded-latn-zz",dee:"dee-latn-lr",def:"def-arab-ir",deg:"deg-latn-ng",deh:"deh-arab-pk",dei:"dei-latn-id",dek:"dek-latn-cm",del:"del-latn-us",dem:"dem-latn-id",den:"den-latn-ca",deq:"deq-latn-cf",der:"der-beng-in","der-latn":"der-latn-in",des:"des-latn-br",dev:"dev-latn-pg",dez:"dez-latn-cd",dga:"dga-latn-zz",dgb:"dgb-latn-ml",dgc:"dgc-latn-ph",dgd:"dgd-latn-bf",dge:"dge-latn-pg",dgg:"dgg-latn-pg",dgh:"dgh-latn-zz",dgi:"dgi-latn-zz",dgk:"dgk-latn-cf",dgl:"dgl-arab-zz",dgn:"dgn-latn-au",dgr:"dgr-latn-ca",dgs:"dgs-latn-bf",dgt:"dgt-latn-au",dgw:"dgw-latn-au",dgx:"dgx-latn-pg",dgz:"dgz-latn-zz",dhg:"dhg-latn-au",dhi:"dhi-deva-np",dhl:"dhl-latn-au",dhm:"dhm-latn-ao",dhn:"dhn-gujr-in",dho:"dho-deva-in",dhr:"dhr-latn-au",dhs:"dhs-latn-tz",dhu:"dhu-latn-au",dhv:"dhv-latn-nc",dhw:"dhw-deva-np",dhx:"dhx-latn-au",dia:"dia-latn-zz",dib:"dib-latn-ss",dic:"dic-latn-ci",did:"did-latn-ss",dif:"dif-latn-au",dig:"dig-latn-ke",dih:"dih-latn-mx",dii:"dii-latn-cm",dij:"dij-latn-id",dil:"dil-latn-sd",din:"din-latn-ss","din-arab":"din-arab-ss",dio:"dio-latn-ng",dip:"dip-latn-ss",dir:"dir-latn-ng",dis:"dis-latn-in","dis-beng":"dis-beng-in",diu:"diu-latn-na",diw:"diw-latn-ss",dix:"dix-latn-vu",diy:"diy-latn-id",diz:"diz-latn-cd",dja:"dja-latn-au",djb:"djb-latn-au",djc:"djc-latn-td",djd:"djd-latn-au",dje:"dje-latn-ne",djf:"djf-latn-au",dji:"dji-latn-au",djj:"djj-latn-au",djk:"djk-latn-sr",djm:"djm-latn-ml",djn:"djn-latn-au",djo:"djo-latn-id",djr:"djr-latn-au",dju:"dju-latn-pg",djw:"djw-latn-au",dka:"dka-tibt-bt",dkg:"dkg-latn-ng",dkk:"dkk-latn-id",dkr:"dkr-latn-my",dks:"dks-latn-ss",dkx:"dkx-latn-cm",dlg:"dlg-cyrl-ru",dlm:"dlm-latn-hr",dln:"dln-latn-in",dma:"dma-latn-ga",dmb:"dmb-latn-ml",dmc:"dmc-latn-pg",dmd:"dmd-latn-au",dme:"dme-latn-cm",dmf:"dmf-medf-ng",dmg:"dmg-latn-my",dmk:"dmk-arab-pk",dml:"dml-arab-pk",dmm:"dmm-latn-cm",dmo:"dmo-latn-cm",dmr:"dmr-latn-id",dms:"dms-latn-id",dmu:"dmu-latn-id",dmv:"dmv-latn-my",dmw:"dmw-latn-au",dmx:"dmx-latn-mz",dmy:"dmy-latn-id",dna:"dna-latn-id",dnd:"dnd-latn-pg",dne:"dne-latn-tz",dng:"dng-cyrl-kg","dng-arab":"dng-arab-kg",dni:"dni-latn-id",dnj:"dnj-latn-ci",dnk:"dnk-latn-id",dnn:"dnn-latn-bf",dno:"dno-latn-cd",dnr:"dnr-latn-pg",dnt:"dnt-latn-id",dnu:"dnu-mymr-mm",dnv:"dnv-mymr-mm",dnw:"dnw-latn-id",dny:"dny-latn-br",doa:"doa-latn-pg",dob:"dob-latn-zz",doc:"doc-latn-cn",doe:"doe-latn-tz",dof:"dof-latn-pg",doh:"doh-latn-ng",doi:"doi-deva-in",dok:"dok-latn-id",dol:"dol-latn-pg",don:"don-latn-pg",doo:"doo-latn-cd",dop:"dop-latn-zz",dor:"dor-latn-sb",dos:"dos-latn-bf",dot:"dot-latn-ng",dov:"dov-latn-zw",dow:"dow-latn-zz",dox:"dox-ethi-et",doy:"doy-latn-gh",dpp:"dpp-latn-my",drc:"drc-latn-pt",dre:"dre-tibt-np",drg:"drg-latn-my",drh:"drh-mong-cn",dri:"dri-latn-zz",drl:"drl-latn-au",drn:"drn-latn-id",dro:"dro-latn-my",drq:"drq-deva-np",drs:"drs-ethi-zz",drt:"drt-latn-nl",dru:"dru-latn-tw",dry:"dry-deva-np",dsb:"dsb-latn-de",dsh:"dsh-latn-ke",dsi:"dsi-latn-td",dsn:"dsn-latn-id",dso:"dso-orya-in",dsq:"dsq-latn-ml","dsq-arab":"dsq-arab-ml",dta:"dta-latn-cn","dta-cyrl":"dta-cyrl-cn","dta-hans":"dta-hans-cn",dtb:"dtb-latn-my",dtd:"dtd-latn-ca",dth:"dth-latn-au",dti:"dti-latn-ml",dtk:"dtk-latn-ml",dtm:"dtm-latn-ml",dto:"dto-latn-ml",dtp:"dtp-latn-my",dtr:"dtr-latn-my",dts:"dts-latn-zz",dtt:"dtt-latn-ml",dtu:"dtu-latn-ml",dty:"dty-deva-np",dua:"dua-latn-cm",dub:"dub-gujr-in",duc:"duc-latn-zz",dud:"dud-latn-zz",due:"due-latn-ph",duf:"duf-latn-nc",dug:"dug-latn-zz",duh:"duh-deva-in","duh-gujr":"duh-gujr-in",dui:"dui-latn-pg",duk:"duk-latn-pg",dul:"dul-latn-ph",dum:"dum-latn-nl",dun:"dun-latn-id",duo:"duo-latn-ph",dup:"dup-latn-id",duq:"duq-latn-id",dur:"dur-latn-cm",dus:"dus-deva-np",duu:"duu-latn-cn",duv:"duv-latn-id",duw:"duw-latn-id",dux:"dux-latn-ml",duy:"duy-latn-ph",duz:"duz-latn-cm",dv:"dv-thaa-mv",dva:"dva-latn-zz",dwa:"dwa-latn-ng",dwk:"dwk-orya-in",dwr:"dwr-latn-et","dwr-ethi":"dwr-ethi-et",dws:"dws-latn-001",dwu:"dwu-latn-au",dww:"dww-latn-zz",dwy:"dwy-latn-au",dwz:"dwz-deva-np",dya:"dya-latn-bf",dyb:"dyb-latn-au",dyd:"dyd-latn-au",dyg:"dyg-latn-ph",dyi:"dyi-latn-ci",dym:"dym-latn-ml",dyn:"dyn-latn-au",dyo:"dyo-latn-sn",dyu:"dyu-latn-bf",dyy:"dyy-latn-au",dz:"dz-tibt-bt",dza:"dza-latn-ng",dze:"dze-latn-au",dzg:"dzg-latn-zz",dzl:"dzl-tibt-bt",dzn:"dzn-latn-cd",eaa:"eaa-latn-au",ebc:"ebc-latn-id",ebg:"ebg-latn-ng",ebk:"ebk-latn-ph",ebo:"ebo-latn-cg",ebr:"ebr-latn-ci",ebu:"ebu-latn-ke",ecr:"ecr-grek-gr",ecy:"ecy-cprt-cy",ee:"ee-latn-gh",efa:"efa-latn-ng",efe:"efe-latn-cd",efi:"efi-latn-ng",ega:"ega-latn-ci",egl:"egl-latn-it",egm:"egm-latn-tz",ego:"ego-latn-ng",egy:"egy-egyp-eg",ehu:"ehu-latn-ng",eip:"eip-latn-id",eit:"eit-latn-pg",eiv:"eiv-latn-pg",eja:"eja-latn-gw",eka:"eka-latn-zz",eke:"eke-latn-ng",ekg:"ekg-latn-id",eki:"eki-latn-ng",ekl:"ekl-latn-bd",ekm:"ekm-latn-cm",eko:"eko-latn-mz","eko-arab":"eko-arab-mz",ekp:"ekp-latn-ng",ekr:"ekr-latn-ng",eky:"eky-kali-mm",el:"el-grek-gr",ele:"ele-latn-pg",elk:"elk-latn-pg",elm:"elm-latn-ng",elo:"elo-latn-ke",elu:"elu-latn-pg",ema:"ema-latn-zz",emb:"emb-latn-id",eme:"eme-latn-gf",emg:"emg-deva-np",emi:"emi-latn-zz",emm:"emm-latn-mx",emn:"emn-latn-cm",emp:"emp-latn-pa",ems:"ems-latn-us","ems-cyrl":"ems-cyrl-us",emu:"emu-deva-in",emw:"emw-latn-id",emx:"emx-latn-fr",emz:"emz-latn-cm",en:"en-latn-us","en-shaw":"en-shaw-gb",ena:"ena-latn-pg",enb:"enb-latn-ke",enc:"enc-latn-vn",end:"end-latn-id",enf:"enf-cyrl-ru",enh:"enh-cyrl-ru",enl:"enl-latn-py",enm:"enm-latn-gb",enn:"enn-latn-zz",eno:"eno-latn-id",enq:"enq-latn-zz",enr:"enr-latn-id",env:"env-latn-ng",enw:"enw-latn-ng",enx:"enx-latn-py",eo:"eo-latn-001",eot:"eot-latn-ci",epi:"epi-latn-ng",era:"era-taml-in",erg:"erg-latn-vu",erh:"erh-latn-ng",eri:"eri-latn-zz",erk:"erk-latn-vu",err:"err-latn-au",ert:"ert-latn-id",erw:"erw-latn-id",es:"es-latn-es",ese:"ese-latn-bo",esg:"esg-gonm-in",esh:"esh-arab-ir",esi:"esi-latn-us",esm:"esm-latn-ci",ess:"ess-latn-us","ess-cyrl":"ess-cyrl-us",esu:"esu-latn-us",esy:"esy-latn-ph",et:"et-latn-ee",etb:"etb-latn-ng",etn:"etn-latn-vu",eto:"eto-latn-cm",etr:"etr-latn-zz",ets:"ets-latn-ng",ett:"ett-ital-it",etu:"etu-latn-zz",etx:"etx-latn-zz",etz:"etz-latn-id",eu:"eu-latn-es",eve:"eve-cyrl-ru",evh:"evh-latn-ng",evn:"evn-cyrl-ru","evn-latn":"evn-latn-cn","evn-mong":"evn-mong-cn",ewo:"ewo-latn-cm",ext:"ext-latn-es",eya:"eya-latn-us",eyo:"eyo-latn-ke",eza:"eza-latn-zz",eze:"eze-latn-ng",fa:"fa-arab-ir",faa:"faa-latn-zz",fab:"fab-latn-zz",fad:"fad-latn-pg",faf:"faf-latn-sb",fag:"fag-latn-zz",fah:"fah-latn-ng",fai:"fai-latn-zz",faj:"faj-latn-pg",fak:"fak-latn-cm",fal:"fal-latn-cm",fam:"fam-latn-ng",fan:"fan-latn-gq",fap:"fap-latn-sn",far:"far-latn-sb",fau:"fau-latn-id",fax:"fax-latn-es",fay:"fay-arab-ir",faz:"faz-arab-ir",fbl:"fbl-latn-ph",fer:"fer-latn-ss",ff:"ff-latn-sn","ff-adlm":"ff-adlm-gn",ffi:"ffi-latn-zz",ffm:"ffm-latn-ml",fgr:"fgr-latn-td",fi:"fi-latn-fi",fia:"fia-arab-sd",fie:"fie-latn-ng",fif:"fif-latn-sa",fil:"fil-latn-ph",fip:"fip-latn-tz",fir:"fir-latn-ng",fit:"fit-latn-se",fiw:"fiw-latn-pg",fj:"fj-latn-fj",fkk:"fkk-latn-ng",fkv:"fkv-latn-no",fla:"fla-latn-us",flh:"flh-latn-id",fli:"fli-latn-ng",fll:"fll-latn-cm",fln:"fln-latn-au",flr:"flr-latn-zz",fly:"fly-latn-za",fmp:"fmp-latn-zz",fmu:"fmu-deva-in",fnb:"fnb-latn-vu",fng:"fng-latn-za",fni:"fni-latn-td",fo:"fo-latn-fo",fod:"fod-latn-zz",foi:"foi-latn-pg",fom:"fom-latn-cd",fon:"fon-latn-bj",for:"for-latn-zz",fos:"fos-latn-tw",fpe:"fpe-latn-zz",fqs:"fqs-latn-zz",fr:"fr-latn-fr",frc:"frc-latn-us",frd:"frd-latn-id",frk:"frk-latn-de",frm:"frm-latn-fr",fro:"fro-latn-fr",frp:"frp-latn-fr",frq:"frq-latn-pg",frr:"frr-latn-de",frs:"frs-latn-de",frt:"frt-latn-vu",fub:"fub-arab-cm",fud:"fud-latn-wf",fue:"fue-latn-zz",fuf:"fuf-latn-gn",fuh:"fuh-latn-zz",fui:"fui-latn-td",fum:"fum-latn-ng",fun:"fun-latn-br",fuq:"fuq-latn-ne",fur:"fur-latn-it",fut:"fut-latn-vu",fuu:"fuu-latn-cd",fuv:"fuv-latn-ng",fuy:"fuy-latn-zz",fvr:"fvr-latn-sd",fwa:"fwa-latn-nc",fwe:"fwe-latn-na",fy:"fy-latn-nl",ga:"ga-latn-ie",gaa:"gaa-latn-gh",gab:"gab-latn-td",gac:"gac-latn-in","gac-deva":"gac-deva-in",gad:"gad-latn-ph",gae:"gae-latn-ve",gaf:"gaf-latn-zz",gag:"gag-latn-md",gah:"gah-latn-zz",gai:"gai-latn-pg",gaj:"gaj-latn-zz",gak:"gak-latn-id",gal:"gal-latn-tl",gam:"gam-latn-zz",gan:"gan-hans-cn",gao:"gao-latn-pg",gap:"gap-latn-pg",gaq:"gaq-orya-in",gar:"gar-latn-pg",gas:"gas-gujr-in",gat:"gat-latn-pg",gau:"gau-telu-in",gaw:"gaw-latn-zz",gax:"gax-latn-et","gax-ethi":"gax-ethi-et",gay:"gay-latn-id",gba:"gba-latn-zz",gbb:"gbb-latn-au",gbd:"gbd-latn-au",gbe:"gbe-latn-pg",gbf:"gbf-latn-zz",gbg:"gbg-latn-cf",gbh:"gbh-latn-bj",gbi:"gbi-latn-id",gbj:"gbj-orya-in",gbk:"gbk-deva-in","gbk-takr":"gbk-takr-in",gbl:"gbl-gujr-in","gbl-deva":"gbl-deva-in",gbm:"gbm-deva-in",gbn:"gbn-latn-ss",gbp:"gbp-latn-cf",gbq:"gbq-latn-cf",gbr:"gbr-latn-ng",gbs:"gbs-latn-bj",gbu:"gbu-latn-au",gbv:"gbv-latn-cf",gbw:"gbw-latn-au",gbx:"gbx-latn-bj",gby:"gby-latn-zz",gbz:"gbz-arab-ir",gcc:"gcc-latn-pg",gcd:"gcd-latn-au",gcf:"gcf-latn-gp",gcl:"gcl-latn-gd",gcn:"gcn-latn-pg",gcr:"gcr-latn-gf",gct:"gct-latn-ve",gd:"gd-latn-gb",gdb:"gdb-orya-in","gdb-telu":"gdb-telu-in",gdc:"gdc-latn-au",gdd:"gdd-latn-pg",gde:"gde-latn-zz",gdf:"gdf-latn-ng",gdg:"gdg-latn-ph",gdh:"gdh-latn-au",gdi:"gdi-latn-cf",gdj:"gdj-latn-au",gdk:"gdk-latn-td",gdl:"gdl-latn-et","gdl-ethi":"gdl-ethi-et",gdm:"gdm-latn-td",gdn:"gdn-latn-zz",gdo:"gdo-cyrl-ru",gdq:"gdq-latn-ye",gdr:"gdr-latn-zz",gdt:"gdt-latn-au",gdu:"gdu-latn-ng",gdx:"gdx-deva-in",gea:"gea-latn-ng",geb:"geb-latn-zz",gec:"gec-latn-lr",ged:"ged-latn-ng",gef:"gef-latn-id",geg:"geg-latn-ng",geh:"geh-latn-ca",gei:"gei-latn-id",gej:"gej-latn-zz",gek:"gek-latn-ng",gel:"gel-latn-zz",geq:"geq-latn-cf",ges:"ges-latn-id",gev:"gev-latn-ga",gew:"gew-latn-ng",gex:"gex-latn-so",gey:"gey-latn-cd",gez:"gez-ethi-et",gfk:"gfk-latn-zz",gga:"gga-latn-sb",ggb:"ggb-latn-lr",ggd:"ggd-latn-au",gge:"gge-latn-au",ggg:"ggg-arab-pk",ggk:"ggk-latn-au",ggl:"ggl-latn-pg",ggn:"ggn-deva-np",ggt:"ggt-latn-pg",ggu:"ggu-latn-ci",ggw:"ggw-latn-pg",gha:"gha-arab-ly","gha-latn":"gha-latn-ly","gha-tfng":"gha-tfng-ly",ghc:"ghc-latn-gb",ghe:"ghe-deva-np",ghk:"ghk-latn-mm",ghn:"ghn-latn-sb",ghr:"ghr-arab-pk",ghs:"ghs-latn-zz",ght:"ght-tibt-np",gia:"gia-latn-au",gib:"gib-latn-ng",gic:"gic-latn-za",gid:"gid-latn-cm",gie:"gie-latn-ci",gig:"gig-arab-pk",gih:"gih-latn-au",gil:"gil-latn-ki",gim:"gim-latn-zz",gin:"gin-cyrl-ru",gip:"gip-latn-pg",giq:"giq-latn-vn",gir:"gir-latn-vn",gis:"gis-latn-cm",git:"git-latn-ca",gix:"gix-latn-cd",giy:"giy-latn-au",giz:"giz-latn-cm",gjk:"gjk-arab-pk",gjm:"gjm-latn-au",gjn:"gjn-latn-zz",gjr:"gjr-latn-au",gju:"gju-arab-pk",gka:"gka-latn-pg",gkd:"gkd-latn-pg",gke:"gke-latn-cm",gkn:"gkn-latn-zz",gko:"gko-latn-au",gkp:"gkp-latn-zz",gku:"gku-latn-za",gl:"gl-latn-es",glb:"glb-latn-ng",glc:"glc-latn-td",gld:"gld-cyrl-ru",glh:"glh-arab-af",glj:"glj-latn-td",glk:"glk-arab-ir",gll:"gll-latn-au",glo:"glo-latn-ng",glr:"glr-latn-lr",glu:"glu-latn-td",glw:"glw-latn-ng",gma:"gma-latn-au",gmb:"gmb-latn-sb",gmd:"gmd-latn-ng",gmg:"gmg-latn-pg",gmh:"gmh-latn-de",gmm:"gmm-latn-zz",gmn:"gmn-latn-cm",gmr:"gmr-latn-au",gmu:"gmu-latn-pg",gmv:"gmv-ethi-zz",gmx:"gmx-latn-tz",gmy:"gmy-linb-gr",gmz:"gmz-latn-ng",gn:"gn-latn-py",gna:"gna-latn-bf",gnb:"gnb-latn-in",gnc:"gnc-latn-es",gnd:"gnd-latn-zz",gne:"gne-latn-ng",gng:"gng-latn-zz",gnh:"gnh-latn-ng",gni:"gni-latn-au",gnj:"gnj-latn-ci",gnk:"gnk-latn-bw",gnl:"gnl-latn-au",gnm:"gnm-latn-pg",gnn:"gnn-latn-au",gnq:"gnq-latn-my",gnr:"gnr-latn-au",gnt:"gnt-latn-pg",gnu:"gnu-latn-pg",gnw:"gnw-latn-bo",gnz:"gnz-latn-cf",goa:"goa-latn-ci",gob:"gob-latn-co",goc:"goc-latn-pg",god:"god-latn-zz",goe:"goe-tibt-bt",gof:"gof-ethi-zz",gog:"gog-latn-tz",goh:"goh-latn-de",goi:"goi-latn-zz",gok:"gok-deva-in",gol:"gol-latn-lr",gom:"gom-deva-in",gon:"gon-telu-in",goo:"goo-latn-fj",gop:"gop-latn-id",goq:"goq-latn-id",gor:"gor-latn-id",gos:"gos-latn-nl",got:"got-goth-ua",gou:"gou-latn-cm",gov:"gov-latn-ci",gow:"gow-latn-tz",gox:"gox-latn-cd",goy:"goy-latn-td",gpa:"gpa-latn-ng",gpe:"gpe-latn-gh",gpn:"gpn-latn-pg",gqa:"gqa-latn-ng",gqn:"gqn-latn-br",gqr:"gqr-latn-td",gra:"gra-deva-in","gra-gujr":"gra-gujr-in",grb:"grb-latn-zz",grc:"grc-cprt-cy","grc-linb":"grc-linb-gr",grd:"grd-latn-ng",grg:"grg-latn-pg",grh:"grh-latn-ng",gri:"gri-latn-sb",grj:"grj-latn-lr",grm:"grm-latn-my",grq:"grq-latn-pg",grs:"grs-latn-id",grt:"grt-beng-in",gru:"gru-ethi-et","gru-latn":"gru-latn-et",grv:"grv-latn-lr",grw:"grw-latn-zz",grx:"grx-latn-pg",gry:"gry-latn-lr",grz:"grz-latn-pg",gsl:"gsl-latn-sn",gsn:"gsn-latn-pg",gso:"gso-latn-cf",gsp:"gsp-latn-pg",gsw:"gsw-latn-ch",gta:"gta-latn-br",gtu:"gtu-latn-au",gu:"gu-gujr-in",gua:"gua-latn-ng",gub:"gub-latn-br",guc:"guc-latn-co",gud:"gud-latn-zz",gue:"gue-latn-au",guf:"guf-latn-au",guh:"guh-latn-co",gui:"gui-latn-bo",guk:"guk-latn-et","guk-ethi":"guk-ethi-et",gul:"gul-latn-us",gum:"gum-latn-co",gun:"gun-latn-br",guo:"guo-latn-co",gup:"gup-latn-au",guq:"guq-latn-py",gur:"gur-latn-gh",gut:"gut-latn-cr",guu:"guu-latn-ve",guw:"guw-latn-zz",gux:"gux-latn-zz",guz:"guz-latn-ke",gv:"gv-latn-im",gva:"gva-latn-py",gvc:"gvc-latn-br",gve:"gve-latn-pg",gvf:"gvf-latn-zz",gvj:"gvj-latn-br",gvl:"gvl-latn-td",gvm:"gvm-latn-ng",gvn:"gvn-latn-au",gvo:"gvo-latn-br",gvp:"gvp-latn-br",gvr:"gvr-deva-np",gvs:"gvs-latn-zz",gvy:"gvy-latn-au",gwa:"gwa-latn-ci",gwb:"gwb-latn-ng",gwc:"gwc-arab-zz",gwd:"gwd-latn-et",gwe:"gwe-latn-tz",gwf:"gwf-arab-pk",gwg:"gwg-latn-ng",gwi:"gwi-latn-ca",gwj:"gwj-latn-bw",gwm:"gwm-latn-au",gwn:"gwn-latn-ng",gwr:"gwr-latn-ug",gwt:"gwt-arab-zz",gwu:"gwu-latn-au",gww:"gww-latn-au",gwx:"gwx-latn-gh",gxx:"gxx-latn-ci",gyb:"gyb-latn-pg",gyd:"gyd-latn-au",gye:"gye-latn-ng",gyf:"gyf-latn-au",gyg:"gyg-latn-cf",gyi:"gyi-latn-zz",gyl:"gyl-latn-et","gyl-ethi":"gyl-ethi-et",gym:"gym-latn-pa",gyn:"gyn-latn-gy",gyo:"gyo-deva-np",gyr:"gyr-latn-bo",gyy:"gyy-latn-au",gyz:"gyz-latn-ng",gza:"gza-latn-sd",gzi:"gzi-arab-ir",gzn:"gzn-latn-id",ha:"ha-latn-ng","ha-cm":"ha-arab-cm","ha-sd":"ha-arab-sd",haa:"haa-latn-us",hac:"hac-arab-ir",had:"had-latn-id",hae:"hae-latn-et",hag:"hag-latn-zz",hah:"hah-latn-pg",hai:"hai-latn-ca",haj:"haj-latn-in","haj-beng":"haj-beng-in",hak:"hak-hans-cn",hal:"hal-latn-vn",ham:"ham-latn-zz",han:"han-latn-tz",hao:"hao-latn-pg",hap:"hap-latn-id",haq:"haq-latn-tz",har:"har-ethi-et","har-arab":"har-arab-et","har-latn":"har-latn-et",has:"has-latn-ca",hav:"hav-latn-cd",haw:"haw-latn-us",hax:"hax-latn-ca",hay:"hay-latn-tz",haz:"haz-arab-af",hba:"hba-latn-cd",hbb:"hbb-latn-zz",hbn:"hbn-latn-sd",hbo:"hbo-hebr-il",hbu:"hbu-latn-tl",hch:"hch-latn-mx",hdy:"hdy-ethi-zz",he:"he-hebr-il",hed:"hed-latn-td",heg:"heg-latn-id",heh:"heh-latn-tz",hei:"hei-latn-ca",hem:"hem-latn-cd",hgm:"hgm-latn-na",hgw:"hgw-latn-pg",hhi:"hhi-latn-pg",hhr:"hhr-latn-sn",hhy:"hhy-latn-zz",hi:"hi-deva-in","hi-latn":"hi-latn-in",hia:"hia-latn-zz",hib:"hib-latn-pe",hid:"hid-latn-us",hif:"hif-latn-fj",hig:"hig-latn-zz",hih:"hih-latn-zz",hii:"hii-takr-in","hii-deva":"hii-deva-in",hij:"hij-latn-cm",hik:"hik-latn-id",hil:"hil-latn-ph",hio:"hio-latn-bw",hir:"hir-latn-br",hit:"hit-xsux-tr",hiw:"hiw-latn-vu",hix:"hix-latn-br",hji:"hji-latn-id",hka:"hka-latn-tz",hke:"hke-latn-cd",hkh:"hkh-arab-in","hkh-deva":"hkh-deva-in","hkh-latn":"hkh-latn-in",hkk:"hkk-latn-pg",hla:"hla-latn-zz",hlb:"hlb-deva-in",hld:"hld-latn-vn",hlt:"hlt-latn-mm",hlu:"hlu-hluw-tr",hma:"hma-latn-cn",hmb:"hmb-latn-ml",hmd:"hmd-plrd-cn",hmf:"hmf-latn-vn",hmj:"hmj-bopo-cn",hmm:"hmm-latn-cn",hmn:"hmn-latn-cn","hmn-bopo":"hmn-bopo-cn","hmn-hmng":"hmn-hmng-cn",hmp:"hmp-latn-cn",hmq:"hmq-bopo-cn",hmr:"hmr-latn-in",hms:"hms-latn-cn",hmt:"hmt-latn-zz",hmu:"hmu-latn-id",hmv:"hmv-latn-vn",hmw:"hmw-latn-cn",hmy:"hmy-latn-cn",hmz:"hmz-latn-cn","hmz-plrd":"hmz-plrd-cn",hna:"hna-latn-cm",hnd:"hnd-arab-pk",hne:"hne-deva-in",hng:"hng-latn-ao",hnh:"hnh-latn-bw",hni:"hni-latn-cn",hnj:"hnj-hmnp-us","hnj-au":"hnj-laoo-au","hnj-cn":"hnj-laoo-cn","hnj-fr":"hnj-laoo-fr","hnj-gf":"hnj-laoo-gf","hnj-la":"hnj-laoo-la","hnj-laoo":"hnj-laoo-la","hnj-mm":"hnj-laoo-mm","hnj-sr":"hnj-laoo-sr","hnj-th":"hnj-laoo-th","hnj-us":"hnj-hmnp-us","hnj-vn":"hnj-laoo-vn",hnn:"hnn-latn-ph",hno:"hno-arab-pk",hns:"hns-latn-sr",ho:"ho-latn-pg",hoa:"hoa-latn-sb",hob:"hob-latn-pg",hoc:"hoc-deva-in",hod:"hod-latn-ng",hoe:"hoe-latn-ng",hoh:"hoh-arab-om",hoi:"hoi-latn-us",hoj:"hoj-deva-in",hol:"hol-latn-ao",hom:"hom-latn-ss",hoo:"hoo-latn-cd",hop:"hop-latn-us",hor:"hor-latn-td",hot:"hot-latn-zz",hov:"hov-latn-id",how:"how-hani-cn",hoy:"hoy-deva-in",hpo:"hpo-mymr-mm",hr:"hr-latn-hr",hra:"hra-latn-in",hrc:"hrc-latn-pg",hre:"hre-latn-vn",hrk:"hrk-latn-id",hrm:"hrm-latn-cn","hrm-hmng":"hrm-hmng-cn",hro:"hro-latn-vn",hrp:"hrp-latn-au",hrt:"hrt-syrc-tr",hru:"hru-latn-in",hrw:"hrw-latn-pg",hrx:"hrx-latn-br",hrz:"hrz-arab-ir",hsb:"hsb-latn-de",hsn:"hsn-hans-cn",hss:"hss-arab-om",ht:"ht-latn-ht",hti:"hti-latn-id",hto:"hto-latn-co",hts:"hts-latn-tz",htu:"htu-latn-id",htx:"htx-xsux-tr",hu:"hu-latn-hu",hub:"hub-latn-pe",huc:"huc-latn-bw",hud:"hud-latn-id",hue:"hue-latn-mx",huf:"huf-latn-pg",hug:"hug-latn-pe",huh:"huh-latn-cl",hui:"hui-latn-zz",huk:"huk-latn-id",hul:"hul-latn-pg",hum:"hum-latn-cd",hup:"hup-latn-us",hur:"hur-latn-ca",hus:"hus-latn-mx",hut:"hut-deva-np","hut-tibt":"hut-tibt-np",huu:"huu-latn-pe",huv:"huv-latn-mx",huw:"huw-latn-id",hux:"hux-latn-pe",huy:"huy-hebr-il",huz:"huz-cyrl-ru",hvc:"hvc-latn-ht",hve:"hve-latn-mx",hvk:"hvk-latn-nc",hvn:"hvn-latn-id",hvv:"hvv-latn-mx",hwa:"hwa-latn-ci",hwc:"hwc-latn-us",hwo:"hwo-latn-ng",hy:"hy-armn-am",hya:"hya-latn-cm",hyw:"hyw-armn-am",hz:"hz-latn-na",ia:"ia-latn-001",iai:"iai-latn-nc",ian:"ian-latn-zz",iar:"iar-latn-zz",iba:"iba-latn-my",ibb:"ibb-latn-ng",ibd:"ibd-latn-au",ibe:"ibe-latn-ng",ibg:"ibg-latn-ph",ibh:"ibh-latn-vn",ibl:"ibl-latn-ph",ibm:"ibm-latn-ng",ibn:"ibn-latn-ng",ibr:"ibr-latn-ng",ibu:"ibu-latn-id",iby:"iby-latn-zz",ica:"ica-latn-zz",ich:"ich-latn-zz",icr:"icr-latn-co",id:"id-latn-id",ida:"ida-latn-ke",idb:"idb-latn-in",idc:"idc-latn-ng",idd:"idd-latn-zz",ide:"ide-latn-ng",idi:"idi-latn-zz",idr:"idr-latn-ss",ids:"ids-latn-ng",idt:"idt-latn-tl",idu:"idu-latn-zz",ie:"ie-latn-001",ifa:"ifa-latn-ph",ifb:"ifb-latn-ph",ife:"ife-latn-tg",iff:"iff-latn-vu",ifk:"ifk-latn-ph",ifm:"ifm-latn-cg",ifu:"ifu-latn-ph",ify:"ify-latn-ph",ig:"ig-latn-ng",igb:"igb-latn-zz",ige:"ige-latn-zz",igg:"igg-latn-pg",igl:"igl-latn-ng",igm:"igm-latn-pg",ign:"ign-latn-bo",igo:"igo-latn-pg",igs:"igs-latn-001","igs-grek":"igs-grek-001",igw:"igw-latn-ng",ihb:"ihb-latn-id",ihi:"ihi-latn-ng",ihp:"ihp-latn-id",ihw:"ihw-latn-au",ii:"ii-yiii-cn",iin:"iin-latn-au",ijc:"ijc-latn-ng",ije:"ije-latn-ng",ijj:"ijj-latn-zz",ijn:"ijn-latn-ng",ijs:"ijs-latn-ng",ik:"ik-latn-us",iki:"iki-latn-ng",ikk:"ikk-latn-zz",ikl:"ikl-latn-ng",iko:"iko-latn-ng",ikp:"ikp-latn-ng",ikr:"ikr-latn-au",ikt:"ikt-latn-ca","ikt-cans":"ikt-cans-ca",ikv:"ikv-latn-ng",ikw:"ikw-latn-zz",ikx:"ikx-latn-zz",ikz:"ikz-latn-tz",ila:"ila-latn-id",ilb:"ilb-latn-zm",ilg:"ilg-latn-au",ili:"ili-latn-cn","ili-arab":"ili-arab-cn","ili-cyrl":"ili-cyrl-kz",ilk:"ilk-latn-ph",ilm:"ilm-latn-my",ilo:"ilo-latn-ph",ilp:"ilp-latn-ph",ilu:"ilu-latn-id",ilv:"ilv-latn-ng",imi:"imi-latn-pg",iml:"iml-latn-us",imn:"imn-latn-pg",imo:"imo-latn-zz",imr:"imr-latn-id",ims:"ims-latn-it",imt:"imt-latn-ss",imy:"imy-lyci-tr",in:"in-latn-id",inb:"inb-latn-co",ing:"ing-latn-us",inh:"inh-cyrl-ru",inj:"inj-latn-co",inn:"inn-latn-ph",ino:"ino-latn-pg",inp:"inp-latn-pe",int:"int-mymr-mm",io:"io-latn-001",ior:"ior-ethi-et",iou:"iou-latn-zz",iow:"iow-latn-us",ipi:"ipi-latn-pg",ipo:"ipo-latn-pg",iqu:"iqu-latn-pe",iqw:"iqw-latn-ng",ire:"ire-latn-id",irh:"irh-latn-id",iri:"iri-latn-zz",irk:"irk-latn-tz",irn:"irn-latn-br",iru:"iru-taml-in","iru-mlym":"iru-mlym-in",irx:"irx-latn-id",iry:"iry-latn-ph",is:"is-latn-is",isa:"isa-latn-pg",isc:"isc-latn-pe",isd:"isd-latn-ph",ish:"ish-latn-ng",isi:"isi-latn-ng",isk:"isk-arab-af","isk-cyrl":"isk-cyrl-tj",ism:"ism-latn-id",isn:"isn-latn-tz",iso:"iso-latn-ng",ist:"ist-latn-hr",isu:"isu-latn-cm",it:"it-latn-it",itb:"itb-latn-ph",itd:"itd-latn-id",ite:"ite-latn-bo",iti:"iti-latn-ph",itk:"itk-hebr-it",itl:"itl-cyrl-ru",itm:"itm-latn-ng",ito:"ito-latn-bo",itr:"itr-latn-pg",its:"its-latn-ng",itt:"itt-latn-ph",itv:"itv-latn-ph",itw:"itw-latn-ng",itx:"itx-latn-id",ity:"ity-latn-ph",itz:"itz-latn-gt",iu:"iu-cans-ca",ium:"ium-latn-cn","ium-hani":"ium-hani-cn","ium-laoo":"ium-laoo-la","ium-thai":"ium-thai-th",ivb:"ivb-latn-ph",ivv:"ivv-latn-ph",iw:"iw-hebr-il",iwk:"iwk-latn-ph",iwm:"iwm-latn-zz",iwo:"iwo-latn-id",iws:"iws-latn-zz",ixc:"ixc-latn-mx",ixl:"ixl-latn-gt",iya:"iya-latn-ng",iyo:"iyo-latn-cm",iyx:"iyx-latn-cg",izh:"izh-latn-ru",izi:"izi-latn-zz",izr:"izr-latn-ng",izz:"izz-latn-ng",ja:"ja-jpan-jp",jaa:"jaa-latn-br",jab:"jab-latn-zz",jac:"jac-latn-gt",jad:"jad-arab-gn",jae:"jae-latn-pg",jaf:"jaf-latn-ng",jah:"jah-latn-my",jaj:"jaj-latn-sb",jak:"jak-latn-my",jal:"jal-latn-id",jam:"jam-latn-jm",jan:"jan-latn-au",jao:"jao-latn-au",jaq:"jaq-latn-id",jar:"jar-latn-zz",jas:"jas-latn-nc",jat:"jat-arab-af",jau:"jau-latn-id",jax:"jax-latn-id",jay:"jay-latn-au",jaz:"jaz-latn-nc",jbe:"jbe-hebr-il",jbi:"jbi-latn-au",jbj:"jbj-latn-id",jbk:"jbk-latn-pg",jbm:"jbm-latn-ng",jbn:"jbn-arab-ly",jbo:"jbo-latn-001",jbr:"jbr-latn-id",jbt:"jbt-latn-br",jbu:"jbu-latn-zz",jbw:"jbw-latn-au",jct:"jct-cyrl-ua","jct-latn":"jct-latn-ua",jda:"jda-tibt-in",jdg:"jdg-arab-pk",jdt:"jdt-cyrl-ru","jdt-hebr":"jdt-hebr-ru","jdt-latn":"jdt-latn-az",jeb:"jeb-latn-pe",jee:"jee-deva-np",jeh:"jeh-latn-vn","jeh-laoo":"jeh-laoo-la",jei:"jei-latn-id",jek:"jek-latn-ci",jel:"jel-latn-id",jen:"jen-latn-zz",jer:"jer-latn-ng",jet:"jet-latn-pg",jeu:"jeu-latn-td",jgb:"jgb-latn-cd",jge:"jge-geor-ge","jge-hebr":"jge-hebr-il",jgk:"jgk-latn-zz",jgo:"jgo-latn-cm",jhi:"jhi-latn-my",ji:"ji-hebr-ua",jia:"jia-latn-cm",jib:"jib-latn-zz",jic:"jic-latn-hn",jid:"jid-latn-ng",jie:"jie-latn-ng",jig:"jig-latn-au",jil:"jil-latn-pg",jim:"jim-latn-cm",jit:"jit-latn-tz",jiu:"jiu-latn-cn",jiv:"jiv-latn-ec",jiy:"jiy-latn-cn",jje:"jje-hang-kr",jjr:"jjr-latn-ng",jka:"jka-latn-id",jkm:"jkm-mymr-mm","jkm-brai":"jkm-brai-mm","jkm-latn":"jkm-latn-mm",jko:"jko-latn-pg",jku:"jku-latn-ng",jle:"jle-latn-sd",jma:"jma-latn-pg",jmb:"jmb-latn-ng",jmc:"jmc-latn-tz",jmd:"jmd-latn-id",jmi:"jmi-latn-ng",jml:"jml-deva-np",jmn:"jmn-latn-mm",jmr:"jmr-latn-gh",jms:"jms-latn-ng",jmw:"jmw-latn-pg",jmx:"jmx-latn-mx",jna:"jna-takr-in",jnd:"jnd-arab-pk",jng:"jng-latn-au",jni:"jni-latn-ng",jnj:"jnj-latn-et","jnj-ethi":"jnj-ethi-et",jnl:"jnl-deva-in",jns:"jns-deva-in","jns-latn":"jns-latn-in","jns-takr":"jns-takr-in",job:"job-latn-cd",jod:"jod-latn-ci",jog:"jog-arab-pk",jor:"jor-latn-bo",jow:"jow-latn-ml",jpa:"jpa-hebr-ps",jpr:"jpr-hebr-il",jqr:"jqr-latn-pe",jra:"jra-latn-zz",jrr:"jrr-latn-ng",jrt:"jrt-latn-ng",jru:"jru-latn-ve",jua:"jua-latn-br",jub:"jub-latn-ng",jud:"jud-latn-ci",juh:"juh-latn-ng",jui:"jui-latn-au",juk:"juk-latn-ng",jul:"jul-deva-np",jum:"jum-latn-sd",jun:"jun-orya-in",juo:"juo-latn-ng",jup:"jup-latn-br",jur:"jur-latn-br",jut:"jut-latn-dk",juu:"juu-latn-ng",juw:"juw-latn-ng",juy:"juy-orya-in",jv:"jv-latn-id",jvd:"jvd-latn-id",jvn:"jvn-latn-sr",jw:"jw-latn-id",jwi:"jwi-latn-gh",jya:"jya-tibt-cn",jye:"jye-hebr-il",jyy:"jyy-latn-td",ka:"ka-geor-ge",kaa:"kaa-cyrl-uz",kab:"kab-latn-dz",kac:"kac-latn-mm",kad:"kad-latn-zz",kag:"kag-latn-my",kah:"kah-latn-cf",kai:"kai-latn-zz",kaj:"kaj-latn-ng",kak:"kak-latn-ph",kam:"kam-latn-ke",kao:"kao-latn-ml",kap:"kap-cyrl-ru",kaq:"kaq-latn-pe",kav:"kav-latn-br",kaw:"kaw-kawi-id",kax:"kax-latn-id",kay:"kay-latn-br",kba:"kba-latn-au",kbb:"kbb-latn-br",kbc:"kbc-latn-br",kbd:"kbd-cyrl-ru",kbe:"kbe-latn-au",kbh:"kbh-latn-co",kbi:"kbi-latn-id",kbj:"kbj-latn-cd",kbk:"kbk-latn-pg",kbl:"kbl-latn-td",kbm:"kbm-latn-zz",kbn:"kbn-latn-cf",kbo:"kbo-latn-ss",kbp:"kbp-latn-zz",kbq:"kbq-latn-zz",kbr:"kbr-latn-et","kbr-ethi":"kbr-ethi-et",kbs:"kbs-latn-ga",kbt:"kbt-latn-pg",kbu:"kbu-arab-pk",kbv:"kbv-latn-id",kbw:"kbw-latn-pg",kbx:"kbx-latn-zz",kby:"kby-arab-ne",kbz:"kbz-latn-ng",kca:"kca-cyrl-ru",kcb:"kcb-latn-pg",kcc:"kcc-latn-ng",kcd:"kcd-latn-id",kce:"kce-latn-ng",kcf:"kcf-latn-ng",kcg:"kcg-latn-ng",kch:"kch-latn-ng",kci:"kci-latn-ng",kcj:"kcj-latn-gw",kck:"kck-latn-zw",kcl:"kcl-latn-zz",kcm:"kcm-latn-cf",kcn:"kcn-latn-ug",kco:"kco-latn-pg",kcp:"kcp-latn-sd",kcq:"kcq-latn-ng",kcs:"kcs-latn-ng",kct:"kct-latn-zz",kcu:"kcu-latn-tz",kcv:"kcv-latn-cd",kcw:"kcw-latn-cd",kcz:"kcz-latn-tz",kda:"kda-latn-au",kdc:"kdc-latn-tz",kdd:"kdd-latn-au",kde:"kde-latn-tz",kdf:"kdf-latn-pg",kdg:"kdg-latn-cd",kdh:"kdh-latn-tg",kdi:"kdi-latn-ug",kdj:"kdj-latn-ug",kdk:"kdk-latn-nc",kdl:"kdl-latn-zz",kdm:"kdm-latn-ng",kdn:"kdn-latn-zw",kdp:"kdp-latn-ng",kdq:"kdq-beng-in",kdr:"kdr-latn-lt","kdr-cyrl":"kdr-cyrl-ua",kdt:"kdt-thai-th",kdw:"kdw-latn-id",kdx:"kdx-latn-ng",kdy:"kdy-latn-id",kdz:"kdz-latn-cm",kea:"kea-latn-cv",keb:"keb-latn-ga",kec:"kec-latn-sd",ked:"ked-latn-tz",kee:"kee-latn-us",kef:"kef-latn-tg",keg:"keg-latn-sd",keh:"keh-latn-pg",kei:"kei-latn-id",kek:"kek-latn-gt",kel:"kel-latn-cd",kem:"kem-latn-tl",ken:"ken-latn-cm",keo:"keo-latn-ug",ker:"ker-latn-td",kes:"kes-latn-ng",ket:"ket-cyrl-ru",keu:"keu-latn-tg",kew:"kew-latn-pg",kex:"kex-deva-in","kex-gujr":"kex-gujr-in",key:"key-telu-in",kez:"kez-latn-zz",kfa:"kfa-knda-in",kfb:"kfb-deva-in",kfc:"kfc-telu-in",kfd:"kfd-knda-in",kfe:"kfe-taml-in",kff:"kff-latn-in","kff-deva":"kff-deva-in","kff-orya":"kff-orya-in","kff-telu":"kff-telu-in",kfh:"kfh-mlym-in",kfi:"kfi-taml-in","kfi-knda":"kfi-knda-in",kfk:"kfk-deva-in","kfk-takr":"kfk-takr-in",kfl:"kfl-latn-cm",kfm:"kfm-arab-ir",kfn:"kfn-latn-cm",kfo:"kfo-latn-ci",kfp:"kfp-deva-in",kfq:"kfq-deva-in",kfr:"kfr-deva-in",kfs:"kfs-deva-in",kfv:"kfv-latn-in",kfw:"kfw-latn-in",kfx:"kfx-deva-in","kfx-takr":"kfx-takr-in",kfy:"kfy-deva-in",kfz:"kfz-latn-bf",kg:"kg-latn-cd",kga:"kga-latn-ci",kgb:"kgb-latn-id",kge:"kge-latn-id",kgf:"kgf-latn-zz",kgj:"kgj-deva-np",kgk:"kgk-latn-br",kgl:"kgl-latn-au",kgm:"kgm-latn-br",kgo:"kgo-latn-sd",kgp:"kgp-latn-br",kgq:"kgq-latn-id",kgr:"kgr-latn-id",kgs:"kgs-latn-au",kgt:"kgt-latn-ng",kgu:"kgu-latn-pg",kgv:"kgv-latn-id",kgw:"kgw-latn-id",kgx:"kgx-latn-id",kgy:"kgy-deva-np",kha:"kha-latn-in",khb:"khb-talu-cn",khc:"khc-latn-id",khd:"khd-latn-id",khe:"khe-latn-id",khf:"khf-thai-la",khg:"khg-tibt-cn",khh:"khh-latn-id",khj:"khj-latn-ng",khl:"khl-latn-pg",khn:"khn-deva-in",khp:"khp-latn-id",khq:"khq-latn-ml",khr:"khr-latn-in","khr-deva":"khr-deva-in",khs:"khs-latn-zz",kht:"kht-mymr-in",khu:"khu-latn-ao",khv:"khv-cyrl-ru",khw:"khw-arab-pk",khx:"khx-latn-cd",khy:"khy-latn-cd",khz:"khz-latn-zz",ki:"ki-latn-ke",kia:"kia-latn-td",kib:"kib-latn-sd",kic:"kic-latn-us",kid:"kid-latn-cm",kie:"kie-latn-td",kif:"kif-deva-np",kig:"kig-latn-id",kih:"kih-latn-pg",kij:"kij-latn-zz",kil:"kil-latn-ng",kim:"kim-cyrl-ru",kio:"kio-latn-us",kip:"kip-deva-np",kiq:"kiq-latn-id",kis:"kis-latn-pg",kit:"kit-latn-pg",kiu:"kiu-latn-tr",kiv:"kiv-latn-tz",kiw:"kiw-latn-zz",kix:"kix-latn-in",kiy:"kiy-latn-id",kiz:"kiz-latn-tz",kj:"kj-latn-na",kja:"kja-latn-id",kjb:"kjb-latn-gt",kjc:"kjc-latn-id",kjd:"kjd-latn-zz",kje:"kje-latn-id",kjg:"kjg-laoo-la",kjh:"kjh-cyrl-ru",kji:"kji-latn-sb",kjj:"kjj-latn-az",kjk:"kjk-latn-id",kjl:"kjl-deva-np",kjm:"kjm-latn-vn",kjn:"kjn-latn-au",kjo:"kjo-deva-in",kjp:"kjp-mymr-mm","kjp-thai":"kjp-thai-th",kjq:"kjq-latn-us",kjr:"kjr-latn-id",kjs:"kjs-latn-zz",kjt:"kjt-thai-th",kju:"kju-latn-us",kjx:"kjx-latn-pg",kjy:"kjy-latn-zz",kk:"kk-cyrl-kz","kk-af":"kk-arab-af","kk-arab":"kk-arab-cn","kk-cn":"kk-arab-cn","kk-ir":"kk-arab-ir","kk-mn":"kk-arab-mn",kka:"kka-latn-ng",kkb:"kkb-latn-id",kkc:"kkc-latn-zz",kkd:"kkd-latn-ng",kke:"kke-latn-gn","kke-arab":"kke-arab-gn",kkf:"kkf-tibt-in",kkg:"kkg-latn-ph",kkh:"kkh-lana-mm",kki:"kki-latn-tz",kkj:"kkj-latn-cm",kkk:"kkk-latn-sb",kkl:"kkl-latn-id",kkm:"kkm-latn-ng",kko:"kko-latn-sd",kkp:"kkp-latn-au",kkq:"kkq-latn-cd",kkr:"kkr-latn-ng",kks:"kks-latn-ng",kkt:"kkt-deva-np",kku:"kku-latn-ng",kkv:"kkv-latn-id",kkw:"kkw-latn-cg",kkx:"kkx-latn-id",kky:"kky-latn-au",kkz:"kkz-latn-ca",kl:"kl-latn-gl",kla:"kla-latn-us",klb:"klb-latn-mx",klc:"klc-latn-cm",kld:"kld-latn-au",kle:"kle-deva-np",klf:"klf-latn-td",klg:"klg-latn-ph",klh:"klh-latn-pg",kli:"kli-latn-id",klj:"klj-arab-ir",klk:"klk-latn-ng",kll:"kll-latn-ph",klm:"klm-latn-pg",kln:"kln-latn-ke",klo:"klo-latn-ng",klp:"klp-latn-pg",klq:"klq-latn-zz",klr:"klr-deva-np",kls:"kls-latn-pk","kls-arab":"kls-arab-pk",klt:"klt-latn-zz",klu:"klu-latn-lr",klv:"klv-latn-vu",klw:"klw-latn-id",klx:"klx-latn-zz",kly:"kly-latn-id",klz:"klz-latn-id",km:"km-khmr-kh",kma:"kma-latn-gh",kmb:"kmb-latn-ao",kmc:"kmc-latn-cn","kmc-hani":"kmc-hani-cn",kmd:"kmd-latn-ph",kme:"kme-latn-cm",kmf:"kmf-latn-pg",kmg:"kmg-latn-pg",kmh:"kmh-latn-zz",kmi:"kmi-latn-ng",kmj:"kmj-deva-in",kmk:"kmk-latn-ph",kml:"kml-latn-ph",kmm:"kmm-latn-in",kmn:"kmn-latn-pg",kmo:"kmo-latn-zz",kmp:"kmp-latn-cm",kmq:"kmq-latn-et",kms:"kms-latn-zz",kmt:"kmt-latn-id",kmu:"kmu-latn-zz",kmv:"kmv-latn-br",kmw:"kmw-latn-zz",kmx:"kmx-latn-pg",kmy:"kmy-latn-ng",kmz:"kmz-arab-ir",kn:"kn-knda-in",kna:"kna-latn-ng",knb:"knb-latn-ph",knd:"knd-latn-id",kne:"kne-latn-ph",knf:"knf-latn-gw",kni:"kni-latn-ng",knj:"knj-latn-gt",knk:"knk-latn-sl","knk-arab":"knk-arab-sl",knl:"knl-latn-id",knm:"knm-latn-br",kno:"kno-latn-sl",knp:"knp-latn-zz",knq:"knq-latn-my",knr:"knr-latn-pg",kns:"kns-latn-my","kns-thai":"kns-thai-th",knt:"knt-latn-br",knu:"knu-latn-gn",knv:"knv-latn-pg",knw:"knw-latn-na",knx:"knx-latn-id",kny:"kny-latn-cd",knz:"knz-latn-bf",ko:"ko-kore-kr",koa:"koa-latn-pg",koc:"koc-latn-ng",kod:"kod-latn-id",koe:"koe-latn-ss",kof:"kof-latn-ng",kog:"kog-latn-co",koh:"koh-latn-cg",koi:"koi-cyrl-ru",kok:"kok-deva-in",kol:"kol-latn-zz",koo:"koo-latn-ug",kop:"kop-latn-pg",koq:"koq-latn-ga",kos:"kos-latn-fm",kot:"kot-latn-cm",kou:"kou-latn-td",kov:"kov-latn-ng",kow:"kow-latn-ng",koy:"koy-latn-us",koz:"koz-latn-zz",kpa:"kpa-latn-ng",kpc:"kpc-latn-co",kpd:"kpd-latn-id",kpe:"kpe-latn-lr",kpf:"kpf-latn-zz",kpg:"kpg-latn-fm",kph:"kph-latn-gh",kpi:"kpi-latn-id",kpj:"kpj-latn-br",kpk:"kpk-latn-ng",kpl:"kpl-latn-cd",kpm:"kpm-latn-vn",kpn:"kpn-latn-br",kpo:"kpo-latn-zz",kpq:"kpq-latn-id",kpr:"kpr-latn-zz",kps:"kps-latn-id",kpt:"kpt-cyrl-ru",kpu:"kpu-latn-id",kpw:"kpw-latn-pg",kpx:"kpx-latn-zz",kpy:"kpy-cyrl-ru",kpz:"kpz-latn-ug",kqa:"kqa-latn-pg",kqb:"kqb-latn-zz",kqc:"kqc-latn-pg",kqd:"kqd-syrc-iq",kqe:"kqe-latn-ph",kqf:"kqf-latn-zz",kqg:"kqg-latn-bf",kqh:"kqh-latn-tz",kqi:"kqi-latn-pg",kqj:"kqj-latn-pg",kqk:"kqk-latn-bj",kql:"kql-latn-pg",kqm:"kqm-latn-ci",kqn:"kqn-latn-zm",kqo:"kqo-latn-lr",kqp:"kqp-latn-td",kqq:"kqq-latn-br",kqr:"kqr-latn-my",kqs:"kqs-latn-zz",kqt:"kqt-latn-my",kqu:"kqu-latn-za",kqv:"kqv-latn-id",kqw:"kqw-latn-pg",kqx:"kqx-latn-cm",kqy:"kqy-ethi-zz",kqz:"kqz-latn-za",kr:"kr-latn-zz",kra:"kra-deva-np",krb:"krb-latn-us",krc:"krc-cyrl-ru",krd:"krd-latn-tl",kre:"kre-latn-br",krf:"krf-latn-vu",krh:"krh-latn-ng",kri:"kri-latn-sl",krj:"krj-latn-ph",krk:"krk-cyrl-ru",krl:"krl-latn-ru",krn:"krn-latn-lr",krp:"krp-latn-ng",krr:"krr-khmr-kh",krs:"krs-latn-zz",krt:"krt-latn-ne",kru:"kru-deva-in",krv:"krv-khmr-kh",krw:"krw-latn-lr",krx:"krx-latn-sn",kry:"kry-latn-az",krz:"krz-latn-id",ks:"ks-arab-in",ksa:"ksa-latn-ng",ksb:"ksb-latn-tz",ksc:"ksc-latn-ph",ksd:"ksd-latn-zz",kse:"kse-latn-pg",ksf:"ksf-latn-cm",ksg:"ksg-latn-sb",ksh:"ksh-latn-de",ksi:"ksi-latn-pg",ksj:"ksj-latn-zz",ksk:"ksk-latn-us",ksl:"ksl-latn-pg",ksm:"ksm-latn-ng",ksn:"ksn-latn-ph",kso:"kso-latn-ng",ksp:"ksp-latn-cf",ksq:"ksq-latn-ng",ksr:"ksr-latn-zz",kss:"kss-latn-lr",kst:"kst-latn-bf",ksu:"ksu-mymr-in",ksv:"ksv-latn-cd",ksw:"ksw-mymr-mm","ksw-latn":"ksw-latn-mm",ksx:"ksx-latn-id",ksz:"ksz-deva-in",kta:"kta-latn-vn",ktb:"ktb-ethi-zz",ktc:"ktc-latn-ng",ktd:"ktd-latn-au",ktf:"ktf-latn-cd",ktg:"ktg-latn-au",kth:"kth-latn-td",kti:"kti-latn-id",ktj:"ktj-latn-ci",ktk:"ktk-latn-pg",ktl:"ktl-arab-ir",ktm:"ktm-latn-zz",ktn:"ktn-latn-br",kto:"kto-latn-zz",ktp:"ktp-plrd-cn",ktq:"ktq-latn-ph",ktr:"ktr-latn-my",kts:"kts-latn-id",ktt:"ktt-latn-id",ktu:"ktu-latn-cd",ktv:"ktv-latn-vn",ktw:"ktw-latn-us",ktx:"ktx-latn-br",kty:"kty-latn-cd",ktz:"ktz-latn-na",ku:"ku-latn-tr","ku-arab":"ku-arab-iq","ku-lb":"ku-arab-lb","ku-yezi":"ku-yezi-ge",kub:"kub-latn-zz",kuc:"kuc-latn-id",kud:"kud-latn-zz",kue:"kue-latn-zz",kuf:"kuf-laoo-la",kug:"kug-latn-ng",kuh:"kuh-latn-ng",kui:"kui-latn-br",kuj:"kuj-latn-zz",kuk:"kuk-latn-id",kul:"kul-latn-ng",kum:"kum-cyrl-ru",kun:"kun-latn-zz",kuo:"kuo-latn-pg",kup:"kup-latn-zz",kuq:"kuq-latn-br",kus:"kus-latn-zz",kut:"kut-latn-ca",kuu:"kuu-latn-us",kuv:"kuv-latn-id",kuw:"kuw-latn-cf",kux:"kux-latn-au",kuy:"kuy-latn-au",kuz:"kuz-latn-cl",kv:"kv-cyrl-ru",kva:"kva-cyrl-ru",kvb:"kvb-latn-id",kvc:"kvc-latn-pg",kvd:"kvd-latn-id",kve:"kve-latn-my",kvf:"kvf-latn-td",kvg:"kvg-latn-zz",kvh:"kvh-latn-id",kvi:"kvi-latn-td",kvj:"kvj-latn-cm",kvl:"kvl-latn-mm",kvm:"kvm-latn-cm",kvn:"kvn-latn-co",kvo:"kvo-latn-id",kvp:"kvp-latn-id",kvq:"kvq-mymr-mm","kvq-latn":"kvq-latn-mm",kvr:"kvr-latn-id",kvt:"kvt-mymr-mm",kvv:"kvv-latn-id",kvw:"kvw-latn-id",kvx:"kvx-arab-pk",kvy:"kvy-kali-mm",kvz:"kvz-latn-id",kw:"kw-latn-gb",kwa:"kwa-latn-br",kwb:"kwb-latn-ng",kwc:"kwc-latn-cg",kwd:"kwd-latn-sb",kwe:"kwe-latn-id",kwf:"kwf-latn-sb",kwg:"kwg-latn-td",kwh:"kwh-latn-id",kwi:"kwi-latn-co",kwj:"kwj-latn-zz",kwk:"kwk-latn-ca",kwl:"kwl-latn-ng",kwm:"kwm-latn-na",kwn:"kwn-latn-na",kwo:"kwo-latn-zz",kwp:"kwp-latn-ci",kwq:"kwq-latn-zz",kwr:"kwr-latn-id",kws:"kws-latn-cd",kwt:"kwt-latn-id",kwu:"kwu-latn-cm",kwv:"kwv-latn-td",kww:"kww-latn-sr",kwy:"kwy-latn-cd",kwz:"kwz-latn-ao",kxa:"kxa-latn-zz",kxb:"kxb-latn-ci",kxc:"kxc-ethi-zz",kxd:"kxd-latn-bn","kxd-arab":"kxd-arab-bn",kxe:"kxe-latn-zz",kxf:"kxf-mymr-mm","kxf-latn":"kxf-latn-mm",kxi:"kxi-latn-my",kxj:"kxj-latn-td",kxk:"kxk-mymr-mm",kxl:"kxl-deva-in",kxm:"kxm-thai-th",kxn:"kxn-latn-my",kxo:"kxo-latn-br",kxp:"kxp-arab-pk",kxq:"kxq-latn-id",kxr:"kxr-latn-pg",kxt:"kxt-latn-pg",kxv:"kxv-orya-in","kxv-latn":"kxv-latn-in","kxv-telu":"kxv-telu-in",kxw:"kxw-latn-zz",kxx:"kxx-latn-cg",kxy:"kxy-latn-vn",kxz:"kxz-latn-zz",ky:"ky-cyrl-kg","ky-arab":"ky-arab-cn","ky-cn":"ky-arab-cn","ky-latn":"ky-latn-tr","ky-tr":"ky-latn-tr",kya:"kya-latn-tz",kyb:"kyb-latn-ph",kyc:"kyc-latn-pg",kyd:"kyd-latn-id",kye:"kye-latn-zz",kyf:"kyf-latn-ci",kyg:"kyg-latn-pg",kyh:"kyh-latn-us",kyi:"kyi-latn-my",kyj:"kyj-latn-ph",kyk:"kyk-latn-ph",kyl:"kyl-latn-us",kym:"kym-latn-cf",kyn:"kyn-latn-ph",kyo:"kyo-latn-id",kyq:"kyq-latn-td",kyr:"kyr-latn-br",kys:"kys-latn-my",kyt:"kyt-latn-id",kyu:"kyu-kali-mm","kyu-latn":"kyu-latn-mm","kyu-mymr":"kyu-mymr-mm",kyv:"kyv-deva-np",kyw:"kyw-deva-in","kyw-beng":"kyw-beng-in","kyw-orya":"kyw-orya-in",kyx:"kyx-latn-zz",kyy:"kyy-latn-pg",kyz:"kyz-latn-br",kza:"kza-latn-bf",kzb:"kzb-latn-id",kzc:"kzc-latn-ci",kzd:"kzd-latn-id",kze:"kze-latn-pg",kzf:"kzf-latn-id",kzh:"kzh-arab-zz",kzi:"kzi-latn-my",kzj:"kzj-latn-my",kzk:"kzk-latn-sb",kzl:"kzl-latn-id",kzm:"kzm-latn-id",kzn:"kzn-latn-mw",kzo:"kzo-latn-ga",kzp:"kzp-latn-id",kzr:"kzr-latn-zz",kzs:"kzs-latn-my",kzt:"kzt-latn-my",kzu:"kzu-latn-id",kzv:"kzv-latn-id",kzw:"kzw-latn-br",kzx:"kzx-latn-id",kzy:"kzy-latn-cd",kzz:"kzz-latn-id",la:"la-latn-va",laa:"laa-latn-ph",lab:"lab-lina-gr",lac:"lac-latn-mx",lad:"lad-hebr-il",lae:"lae-deva-in","lae-tibt":"lae-tibt-in",lag:"lag-latn-tz",lah:"lah-arab-pk",lai:"lai-latn-mw",laj:"laj-latn-ug",lal:"lal-latn-cd",lam:"lam-latn-zm",lan:"lan-latn-ng",lap:"lap-latn-td",laq:"laq-latn-vn",lar:"lar-latn-gh",las:"las-latn-zz",lau:"lau-latn-id",law:"law-latn-id",lax:"lax-latn-in","lax-beng":"lax-beng-in",laz:"laz-latn-pg",lb:"lb-latn-lu",lbb:"lbb-latn-pg",lbc:"lbc-lisu-cn",lbe:"lbe-cyrl-ru",lbf:"lbf-deva-in","lbf-tibt":"lbf-tibt-cn",lbi:"lbi-latn-cm",lbj:"lbj-tibt-in","lbj-arab":"lbj-arab-in",lbl:"lbl-latn-ph",lbm:"lbm-deva-in",lbn:"lbn-latn-la","lbn-laoo":"lbn-laoo-la",lbo:"lbo-laoo-la","lbo-latn":"lbo-latn-us",lbq:"lbq-latn-pg",lbr:"lbr-deva-np",lbt:"lbt-latn-vn",lbu:"lbu-latn-zz",lbv:"lbv-latn-pg",lbw:"lbw-latn-id",lbx:"lbx-latn-id",lby:"lby-latn-au",lbz:"lbz-latn-au",lcc:"lcc-latn-id",lcd:"lcd-latn-id",lce:"lce-latn-id",lcf:"lcf-latn-id",lch:"lch-latn-ao",lcl:"lcl-latn-id",lcm:"lcm-latn-zz",lcp:"lcp-thai-cn",lcq:"lcq-latn-id",lcs:"lcs-latn-id",lda:"lda-latn-ci",ldb:"ldb-latn-zz",ldd:"ldd-latn-ng",ldg:"ldg-latn-ng",ldh:"ldh-latn-ng",ldi:"ldi-latn-cg",ldj:"ldj-latn-ng",ldk:"ldk-latn-ng",ldl:"ldl-latn-ng",ldm:"ldm-latn-gn",ldn:"ldn-latn-001",ldo:"ldo-latn-ng",ldp:"ldp-latn-ng",ldq:"ldq-latn-ng",lea:"lea-latn-cd",leb:"leb-latn-zm",lec:"lec-latn-bo",led:"led-latn-zz",lee:"lee-latn-zz",lef:"lef-latn-gh",leh:"leh-latn-zm",lei:"lei-latn-pg",lej:"lej-latn-cd",lek:"lek-latn-pg",lel:"lel-latn-cd",lem:"lem-latn-zz",len:"len-latn-hn",leo:"leo-latn-cm",lep:"lep-lepc-in",leq:"leq-latn-zz",ler:"ler-latn-pg",les:"les-latn-cd",let:"let-latn-pg",leu:"leu-latn-zz",lev:"lev-latn-id",lew:"lew-latn-id",lex:"lex-latn-id",ley:"ley-latn-id",lez:"lez-cyrl-ru",lfa:"lfa-latn-cm",lfn:"lfn-latn-001","lfn-cyrl":"lfn-cyrl-001",lg:"lg-latn-ug",lga:"lga-latn-sb",lgb:"lgb-latn-sb",lgg:"lgg-latn-zz",lgh:"lgh-latn-vn",lgi:"lgi-latn-id",lgk:"lgk-latn-vu",lgl:"lgl-latn-sb",lgm:"lgm-latn-cd",lgn:"lgn-latn-et",lgo:"lgo-latn-ss",lgq:"lgq-latn-gh",lgr:"lgr-latn-sb",lgt:"lgt-latn-pg",lgu:"lgu-latn-sb",lgz:"lgz-latn-cd",lha:"lha-latn-vn",lhh:"lhh-latn-id",lhi:"lhi-latn-cn",lhm:"lhm-deva-np",lhn:"lhn-latn-my",lhs:"lhs-syrc-sy",lht:"lht-latn-vu",lhu:"lhu-latn-cn",li:"li-latn-nl",lia:"lia-latn-zz",lib:"lib-latn-pg",lic:"lic-latn-cn",lid:"lid-latn-zz",lie:"lie-latn-cd",lif:"lif-deva-np","lif-limb":"lif-limb-in",lig:"lig-latn-zz",lih:"lih-latn-zz",lij:"lij-latn-it",lik:"lik-latn-cd",lil:"lil-latn-ca",lio:"lio-latn-id",lip:"lip-latn-gh",liq:"liq-latn-et",lir:"lir-latn-lr",lis:"lis-lisu-cn",liu:"liu-latn-sd",liv:"liv-latn-lv",liw:"liw-latn-id",lix:"lix-latn-id",liy:"liy-latn-cf",liz:"liz-latn-cd",lja:"lja-latn-au",lje:"lje-latn-id",lji:"lji-latn-id",ljl:"ljl-latn-id",ljp:"ljp-latn-id",ljw:"ljw-latn-au",ljx:"ljx-latn-au",lka:"lka-latn-tl",lkb:"lkb-latn-ke",lkc:"lkc-latn-vn",lkd:"lkd-latn-br",lke:"lke-latn-ug",lkh:"lkh-tibt-bt",lki:"lki-arab-ir",lkj:"lkj-latn-my",lkl:"lkl-latn-pg",lkm:"lkm-latn-au",lkn:"lkn-latn-vu",lko:"lko-latn-ke",lkr:"lkr-latn-ss",lks:"lks-latn-ke",lkt:"lkt-latn-us",lku:"lku-latn-au",lky:"lky-latn-ss",lla:"lla-latn-ng",llb:"llb-latn-mz",llc:"llc-latn-gn",lld:"lld-latn-it",lle:"lle-latn-zz",llf:"llf-latn-pg",llg:"llg-latn-id",lli:"lli-latn-cg",llj:"llj-latn-au",llk:"llk-latn-my",lll:"lll-latn-pg",llm:"llm-latn-id",lln:"lln-latn-zz",llp:"llp-latn-vu",llq:"llq-latn-id",llu:"llu-latn-sb",llx:"llx-latn-fj",lma:"lma-latn-gn",lmb:"lmb-latn-vu",lmc:"lmc-latn-au",lmd:"lmd-latn-sd",lme:"lme-latn-td",lmf:"lmf-latn-id",lmg:"lmg-latn-pg",lmh:"lmh-deva-np",lmi:"lmi-latn-cd",lmj:"lmj-latn-id",lmk:"lmk-latn-in","lmk-mymr":"lmk-mymr-in",lml:"lml-latn-vu",lmn:"lmn-telu-in",lmo:"lmo-latn-it",lmp:"lmp-latn-zz",lmq:"lmq-latn-id",lmr:"lmr-latn-id",lmu:"lmu-latn-vu",lmv:"lmv-latn-fj",lmw:"lmw-latn-us",lmx:"lmx-latn-cm",lmy:"lmy-latn-id",ln:"ln-latn-cd",lna:"lna-latn-cf",lnb:"lnb-latn-na",lnd:"lnd-latn-id",lnh:"lnh-latn-my",lni:"lni-latn-pg",lnj:"lnj-latn-au",lnl:"lnl-latn-cf",lnm:"lnm-latn-pg",lnn:"lnn-latn-vu",lns:"lns-latn-zz",lnu:"lnu-latn-zz",lnw:"lnw-latn-au",lnz:"lnz-latn-cd",lo:"lo-laoo-la",loa:"loa-latn-id",lob:"lob-latn-bf",loc:"loc-latn-ph",loe:"loe-latn-id",log:"log-latn-cd",loh:"loh-latn-ss",loi:"loi-latn-ci",loj:"loj-latn-zz",lok:"lok-latn-zz",lol:"lol-latn-cd",lom:"lom-latn-lr",lon:"lon-latn-mw",loo:"loo-latn-cd",lop:"lop-latn-ng",loq:"loq-latn-cd",lor:"lor-latn-zz",los:"los-latn-zz",lot:"lot-latn-ss","lot-arab":"lot-arab-ss",lou:"lou-latn-us",low:"low-latn-my",lox:"lox-latn-id",loy:"loy-deva-np","loy-tibt":"loy-tibt-np",loz:"loz-latn-zm",lpa:"lpa-latn-vu",lpe:"lpe-latn-id",lpn:"lpn-latn-mm",lpo:"lpo-plrd-cn","lpo-lisu":"lpo-lisu-cn",lpx:"lpx-latn-ss",lqr:"lqr-latn-ss",lra:"lra-latn-my",lrc:"lrc-arab-ir",lrg:"lrg-latn-au",lri:"lri-latn-ke",lrk:"lrk-arab-pk",lrl:"lrl-arab-ir",lrm:"lrm-latn-ke",lrn:"lrn-latn-id",lro:"lro-latn-sd",lrt:"lrt-latn-id",lrv:"lrv-latn-vu",lrz:"lrz-latn-vu",lsa:"lsa-arab-ir",lsd:"lsd-hebr-il",lse:"lse-latn-cd",lsi:"lsi-latn-mm",lsm:"lsm-latn-ug",lsr:"lsr-latn-pg",lss:"lss-arab-pk",lt:"lt-latn-lt",ltg:"ltg-latn-lv",lth:"lth-latn-ug",lti:"lti-latn-id",ltn:"ltn-latn-br",lto:"lto-latn-ke",lts:"lts-latn-ke",ltu:"ltu-latn-id",lu:"lu-latn-cd",lua:"lua-latn-cd",luc:"luc-latn-ug",lud:"lud-latn-ru",lue:"lue-latn-zm",luf:"luf-latn-pg",lui:"lui-latn-us",luj:"luj-latn-cd",luk:"luk-tibt-bt",lul:"lul-latn-ss",lum:"lum-latn-ao",lun:"lun-latn-zm",luo:"luo-latn-ke",lup:"lup-latn-ga",luq:"luq-latn-cu",lur:"lur-latn-id",lus:"lus-latn-in","lus-beng":"lus-beng-bd","lus-brai":"lus-brai-in",lut:"lut-latn-us",luu:"luu-deva-np",luv:"luv-arab-om",luw:"luw-latn-cm",luy:"luy-latn-ke",luz:"luz-arab-ir",lv:"lv-latn-lv",lva:"lva-latn-tl",lvi:"lvi-latn-la",lvk:"lvk-latn-sb",lvu:"lvu-latn-id",lwa:"lwa-latn-cd",lwe:"lwe-latn-id",lwg:"lwg-latn-ke",lwh:"lwh-latn-vn",lwl:"lwl-thai-th",lwm:"lwm-thai-cn",lwo:"lwo-latn-ss","lwo-za":"lwo-latn-za",lwt:"lwt-latn-id",lww:"lww-latn-vu",lxm:"lxm-latn-pg",lya:"lya-tibt-bt",lyn:"lyn-latn-zm",lzh:"lzh-hans-cn",lzl:"lzl-latn-vu",lzn:"lzn-latn-mm",lzz:"lzz-latn-tr",maa:"maa-latn-mx",mab:"mab-latn-mx",mad:"mad-latn-id",mae:"mae-latn-ng",maf:"maf-latn-cm",mag:"mag-deva-in",mai:"mai-deva-in",maj:"maj-latn-mx",mak:"mak-latn-id",mam:"mam-latn-gt",man:"man-latn-gm","man-gn":"man-nkoo-gn","man-nkoo":"man-nkoo-gn",maq:"maq-latn-mx",mas:"mas-latn-ke",mat:"mat-latn-mx",mau:"mau-latn-mx",mav:"mav-latn-br",maw:"maw-latn-zz",max:"max-latn-id",maz:"maz-latn-mx",mba:"mba-latn-ph",mbb:"mbb-latn-ph",mbc:"mbc-latn-br",mbd:"mbd-latn-ph",mbf:"mbf-latn-sg",mbh:"mbh-latn-zz",mbi:"mbi-latn-ph",mbj:"mbj-latn-br",mbk:"mbk-latn-pg",mbl:"mbl-latn-br",mbm:"mbm-latn-cg",mbn:"mbn-latn-co",mbo:"mbo-latn-zz",mbp:"mbp-latn-co",mbq:"mbq-latn-zz",mbr:"mbr-latn-co",mbs:"mbs-latn-ph",mbt:"mbt-latn-ph",mbu:"mbu-latn-zz",mbv:"mbv-latn-gn",mbw:"mbw-latn-zz",mbx:"mbx-latn-pg",mby:"mby-arab-pk",mbz:"mbz-latn-mx",mca:"mca-latn-py",mcb:"mcb-latn-pe",mcc:"mcc-latn-pg",mcd:"mcd-latn-pe",mce:"mce-latn-mx",mcf:"mcf-latn-pe",mcg:"mcg-latn-ve",mch:"mch-latn-ve",mci:"mci-latn-zz",mcj:"mcj-latn-ng",mck:"mck-latn-ao",mcl:"mcl-latn-co",mcm:"mcm-latn-my",mcn:"mcn-latn-td",mco:"mco-latn-mx",mcp:"mcp-latn-zz",mcq:"mcq-latn-zz",mcr:"mcr-latn-zz",mcs:"mcs-latn-cm",mct:"mct-latn-cm",mcu:"mcu-latn-zz",mcv:"mcv-latn-pg",mcw:"mcw-latn-td",mcx:"mcx-latn-cf",mcy:"mcy-latn-pg",mcz:"mcz-latn-pg",mda:"mda-latn-zz",mdb:"mdb-latn-pg",mdc:"mdc-latn-pg",mdd:"mdd-latn-cm",mde:"mde-arab-zz",mdf:"mdf-cyrl-ru",mdg:"mdg-latn-td",mdh:"mdh-latn-ph",mdi:"mdi-latn-cd",mdj:"mdj-latn-zz",mdk:"mdk-latn-cd",mdm:"mdm-latn-cd",mdn:"mdn-latn-cf",mdp:"mdp-latn-cd",mdq:"mdq-latn-cd",mdr:"mdr-latn-id",mds:"mds-latn-pg",mdt:"mdt-latn-cg",mdu:"mdu-latn-cg",mdv:"mdv-latn-mx",mdw:"mdw-latn-cg",mdx:"mdx-ethi-zz",mdy:"mdy-ethi-et","mdy-latn":"mdy-latn-et",mdz:"mdz-latn-br",mea:"mea-latn-cm",meb:"meb-latn-pg",mec:"mec-latn-au",med:"med-latn-zz",mee:"mee-latn-zz",meh:"meh-latn-mx",mej:"mej-latn-id",mek:"mek-latn-zz",mel:"mel-latn-my",mem:"mem-latn-au",men:"men-latn-sl",meo:"meo-latn-my","meo-arab":"meo-arab-my",mep:"mep-latn-au",meq:"meq-latn-cm",mer:"mer-latn-ke",mes:"mes-latn-td",met:"met-latn-zz",meu:"meu-latn-zz",mev:"mev-latn-lr",mew:"mew-latn-ng",mey:"mey-latn-mr","mey-arab":"mey-arab-mr",mez:"mez-latn-us",mfa:"mfa-arab-th",mfb:"mfb-latn-id",mfc:"mfc-latn-cd",mfd:"mfd-latn-cm",mfe:"mfe-latn-mu",mff:"mff-latn-cm",mfg:"mfg-latn-gn","mfg-arab":"mfg-arab-gn",mfh:"mfh-latn-cm",mfi:"mfi-arab-cm","mfi-latn":"mfi-latn-cm",mfj:"mfj-latn-cm",mfk:"mfk-latn-cm",mfl:"mfl-latn-ng",mfm:"mfm-latn-ng",mfn:"mfn-latn-zz",mfo:"mfo-latn-zz",mfp:"mfp-latn-id",mfq:"mfq-latn-zz",mfr:"mfr-latn-au",mft:"mft-latn-pg",mfu:"mfu-latn-ao",mfv:"mfv-latn-gw",mfw:"mfw-latn-pg",mfx:"mfx-latn-et","mfx-ethi":"mfx-ethi-et",mfy:"mfy-latn-mx",mfz:"mfz-latn-ss",mg:"mg-latn-mg",mgb:"mgb-latn-td",mgc:"mgc-latn-ss",mgd:"mgd-latn-ss","mgd-arab":"mgd-arab-ss",mge:"mge-latn-td",mgf:"mgf-latn-id",mgg:"mgg-latn-cm",mgh:"mgh-latn-mz",mgi:"mgi-latn-ng",mgj:"mgj-latn-ng",mgk:"mgk-latn-id",mgl:"mgl-latn-zz",mgm:"mgm-latn-tl",mgn:"mgn-latn-cf",mgo:"mgo-latn-cm",mgp:"mgp-deva-np",mgq:"mgq-latn-tz",mgr:"mgr-latn-zm",mgs:"mgs-latn-tz",mgt:"mgt-latn-pg",mgu:"mgu-latn-pg",mgv:"mgv-latn-tz",mgw:"mgw-latn-tz",mgy:"mgy-latn-tz",mgz:"mgz-latn-tz",mh:"mh-latn-mh",mhb:"mhb-latn-ga",mhc:"mhc-latn-mx",mhd:"mhd-latn-tz",mhe:"mhe-latn-my",mhf:"mhf-latn-pg",mhg:"mhg-latn-au",mhi:"mhi-latn-zz",mhj:"mhj-arab-af",mhk:"mhk-latn-cm",mhl:"mhl-latn-zz",mhm:"mhm-latn-mz",mhn:"mhn-latn-it",mho:"mho-latn-zm",mhp:"mhp-latn-id",mhq:"mhq-latn-us",mhs:"mhs-latn-id",mht:"mht-latn-ve",mhu:"mhu-latn-in",mhw:"mhw-latn-bw",mhx:"mhx-latn-mm",mhy:"mhy-latn-id",mhz:"mhz-latn-id",mi:"mi-latn-nz",mia:"mia-latn-us",mib:"mib-latn-mx",mic:"mic-latn-ca",mid:"mid-mand-iq",mie:"mie-latn-mx",mif:"mif-latn-zz",mig:"mig-latn-mx",mih:"mih-latn-mx",mii:"mii-latn-mx",mij:"mij-latn-cm",mik:"mik-latn-us",mil:"mil-latn-mx",mim:"mim-latn-mx",min:"min-latn-id",mio:"mio-latn-mx",mip:"mip-latn-mx",miq:"miq-latn-ni",mir:"mir-latn-mx",mit:"mit-latn-mx",miu:"miu-latn-mx",miw:"miw-latn-zz",mix:"mix-latn-mx",miy:"miy-latn-mx",miz:"miz-latn-mx",mjb:"mjb-latn-tl",mjc:"mjc-latn-mx",mjd:"mjd-latn-us",mje:"mje-latn-td",mjg:"mjg-latn-cn",mjh:"mjh-latn-tz",mji:"mji-latn-cn",mjj:"mjj-latn-pg",mjk:"mjk-latn-pg",mjl:"mjl-deva-in","mjl-takr":"mjl-takr-in",mjm:"mjm-latn-pg",mjn:"mjn-latn-pg",mjq:"mjq-mlym-in",mjr:"mjr-mlym-in",mjs:"mjs-latn-ng",mjt:"mjt-deva-in","mjt-beng":"mjt-beng-bd",mju:"mju-telu-in",mjv:"mjv-mlym-in",mjw:"mjw-latn-in",mjx:"mjx-latn-bd","mjx-beng":"mjx-beng-bd",mjy:"mjy-latn-us",mjz:"mjz-deva-np",mk:"mk-cyrl-mk",mka:"mka-latn-ci",mkb:"mkb-deva-in",mkc:"mkc-latn-pg",mke:"mke-deva-in",mkf:"mkf-latn-ng",mki:"mki-arab-zz",mkj:"mkj-latn-fm",mkk:"mkk-latn-cm",mkl:"mkl-latn-zz",mkm:"mkm-thai-th",mkn:"mkn-latn-id",mko:"mko-latn-ng",mkp:"mkp-latn-zz",mkr:"mkr-latn-pg",mks:"mks-latn-mx",mkt:"mkt-latn-nc",mku:"mku-latn-gn",mkv:"mkv-latn-vu",mkw:"mkw-latn-zz",mkx:"mkx-latn-ph",mky:"mky-latn-id",mkz:"mkz-latn-tl",ml:"ml-mlym-in",mla:"mla-latn-vu",mlb:"mlb-latn-cm",mlc:"mlc-latn-vn",mle:"mle-latn-zz",mlf:"mlf-thai-la","mlf-latn":"mlf-latn-la",mlh:"mlh-latn-pg",mli:"mli-latn-id",mlj:"mlj-latn-td",mlk:"mlk-latn-ke",mll:"mll-latn-vu",mln:"mln-latn-sb",mlo:"mlo-latn-sn",mlp:"mlp-latn-zz",mlq:"mlq-latn-sn","mlq-arab":"mlq-arab-sn",mlr:"mlr-latn-cm",mls:"mls-latn-sd",mlu:"mlu-latn-sb",mlv:"mlv-latn-vu",mlw:"mlw-latn-cm",mlx:"mlx-latn-vu",mlz:"mlz-latn-ph",mma:"mma-latn-ng",mmb:"mmb-latn-id",mmc:"mmc-latn-mx",mmd:"mmd-latn-cn","mmd-hans":"mmd-hans-cn","mmd-hant":"mmd-hant-cn",mme:"mme-latn-vu",mmf:"mmf-latn-ng",mmg:"mmg-latn-vu",mmh:"mmh-latn-br",mmi:"mmi-latn-pg",mmm:"mmm-latn-vu",mmn:"mmn-latn-ph",mmo:"mmo-latn-zz",mmp:"mmp-latn-pg",mmq:"mmq-latn-pg",mmr:"mmr-latn-cn",mmt:"mmt-latn-pg",mmu:"mmu-latn-zz",mmv:"mmv-latn-br",mmw:"mmw-latn-vu",mmx:"mmx-latn-zz",mmy:"mmy-latn-td",mmz:"mmz-latn-cd",mn:"mn-cyrl-mn","mn-cn":"mn-mong-cn","mn-mong":"mn-mong-cn",mna:"mna-latn-zz",mnb:"mnb-latn-id",mnd:"mnd-latn-br",mne:"mne-latn-td",mnf:"mnf-latn-zz",mng:"mng-latn-vn",mnh:"mnh-latn-cd",mni:"mni-beng-in",mnj:"mnj-arab-af",mnl:"mnl-latn-vu",mnm:"mnm-latn-pg",mnn:"mnn-latn-vn",mnp:"mnp-latn-cn",mnq:"mnq-latn-my",mnr:"mnr-latn-us",mns:"mns-cyrl-ru",mnu:"mnu-latn-id",mnv:"mnv-latn-sb",mnw:"mnw-mymr-mm",mnx:"mnx-latn-id",mny:"mny-latn-mz",mnz:"mnz-latn-id",mo:"mo-latn-ro",moa:"moa-latn-zz",moc:"moc-latn-ar",mod:"mod-latn-us",moe:"moe-latn-ca",mog:"mog-latn-id",moh:"moh-latn-ca",moi:"moi-latn-ng",moj:"moj-latn-cg",mok:"mok-latn-id",mom:"mom-latn-ni",moo:"moo-latn-vn",mop:"mop-latn-bz",moq:"moq-latn-id",mor:"mor-latn-sd",mos:"mos-latn-bf",mot:"mot-latn-co",mou:"mou-latn-td",mov:"mov-latn-us",mow:"mow-latn-cg",mox:"mox-latn-zz",moy:"moy-latn-et","moy-ethi":"moy-ethi-et",moz:"moz-latn-td",mpa:"mpa-latn-tz",mpb:"mpb-latn-au",mpc:"mpc-latn-au",mpd:"mpd-latn-br",mpe:"mpe-latn-et","mpe-ethi":"mpe-ethi-et",mpg:"mpg-latn-td",mph:"mph-latn-au",mpi:"mpi-latn-cm",mpj:"mpj-latn-au",mpk:"mpk-latn-td",mpl:"mpl-latn-pg",mpm:"mpm-latn-mx",mpn:"mpn-latn-pg",mpo:"mpo-latn-pg",mpp:"mpp-latn-zz",mpq:"mpq-latn-br",mpr:"mpr-latn-sb",mps:"mps-latn-zz",mpt:"mpt-latn-zz",mpu:"mpu-latn-br",mpv:"mpv-latn-pg",mpw:"mpw-latn-br",mpx:"mpx-latn-zz",mpy:"mpy-latn-id",mpz:"mpz-thai-th",mqa:"mqa-latn-id",mqb:"mqb-latn-cm",mqc:"mqc-latn-id",mqe:"mqe-latn-pg",mqf:"mqf-latn-id",mqg:"mqg-latn-id",mqh:"mqh-latn-mx",mqi:"mqi-latn-id",mqj:"mqj-latn-id",mqk:"mqk-latn-ph",mql:"mql-latn-zz",mqm:"mqm-latn-pf",mqn:"mqn-latn-id",mqo:"mqo-latn-id",mqp:"mqp-latn-id",mqq:"mqq-latn-my",mqr:"mqr-latn-id",mqs:"mqs-latn-id",mqu:"mqu-latn-ss",mqv:"mqv-latn-pg",mqw:"mqw-latn-pg",mqx:"mqx-latn-id","mqx-bugi":"mqx-bugi-id",mqy:"mqy-latn-id",mqz:"mqz-latn-pg",mr:"mr-deva-in",mra:"mra-thai-th",mrb:"mrb-latn-vu",mrc:"mrc-latn-us",mrd:"mrd-deva-np",mrf:"mrf-latn-id",mrg:"mrg-latn-in","mrg-beng":"mrg-beng-in","mrg-deva":"mrg-deva-in",mrh:"mrh-latn-in",mrj:"mrj-cyrl-ru",mrk:"mrk-latn-nc",mrl:"mrl-latn-fm",mrm:"mrm-latn-vu",mrn:"mrn-latn-sb",mro:"mro-mroo-bd",mrp:"mrp-latn-vu",mrq:"mrq-latn-pf",mrr:"mrr-deva-in",mrs:"mrs-latn-vu",mrt:"mrt-latn-ng",mru:"mru-latn-cm",mrv:"mrv-latn-pf",mrw:"mrw-latn-ph","mrw-arab":"mrw-arab-ph",mrx:"mrx-latn-id",mry:"mry-latn-ph",mrz:"mrz-latn-id",ms:"ms-latn-my","ms-cc":"ms-arab-cc",msb:"msb-latn-ph",msc:"msc-latn-gn",mse:"mse-latn-td",msf:"msf-latn-id",msg:"msg-latn-id",msh:"msh-latn-mg",msi:"msi-latn-my",msj:"msj-latn-cd",msk:"msk-latn-ph",msl:"msl-latn-id",msm:"msm-latn-ph",msn:"msn-latn-vu",mso:"mso-latn-id",msp:"msp-latn-br",msq:"msq-latn-nc",mss:"mss-latn-id",msu:"msu-latn-pg",msv:"msv-latn-cm",msw:"msw-latn-gw",msx:"msx-latn-pg",msy:"msy-latn-pg",msz:"msz-latn-pg",mt:"mt-latn-mt",mta:"mta-latn-ph",mtb:"mtb-latn-ci",mtc:"mtc-latn-zz",mtd:"mtd-latn-id",mte:"mte-latn-sb",mtf:"mtf-latn-zz",mtg:"mtg-latn-id",mth:"mth-latn-id",mti:"mti-latn-zz",mtj:"mtj-latn-id",mtk:"mtk-latn-cm",mtl:"mtl-latn-ng",mtm:"mtm-cyrl-ru",mtn:"mtn-latn-ni",mto:"mto-latn-mx",mtp:"mtp-latn-bo",mtq:"mtq-latn-vn",mtr:"mtr-deva-in",mts:"mts-latn-pe",mtt:"mtt-latn-vu",mtu:"mtu-latn-mx",mtv:"mtv-latn-pg",mtw:"mtw-latn-ph",mtx:"mtx-latn-mx",mty:"mty-latn-pg",mua:"mua-latn-cm",mub:"mub-latn-td",muc:"muc-latn-cm",mud:"mud-cyrl-ru",mue:"mue-latn-ec",mug:"mug-latn-cm",muh:"muh-latn-ss",mui:"mui-latn-id",muj:"muj-latn-td",muk:"muk-tibt-np",mum:"mum-latn-pg",muo:"muo-latn-cm",muq:"muq-latn-cn",mur:"mur-latn-zz",mus:"mus-latn-us",mut:"mut-deva-in",muu:"muu-latn-ke",muv:"muv-taml-in",mux:"mux-latn-pg",muy:"muy-latn-cm",muz:"muz-ethi-et","muz-latn":"muz-latn-et",mva:"mva-latn-zz",mvd:"mvd-latn-id",mvf:"mvf-mong-cn","mvf-phag":"mvf-phag-cn",mvg:"mvg-latn-mx",mvh:"mvh-latn-td",mvk:"mvk-latn-pg",mvl:"mvl-latn-au",mvn:"mvn-latn-zz",mvo:"mvo-latn-sb",mvp:"mvp-latn-id",mvq:"mvq-latn-pg",mvr:"mvr-latn-id",mvs:"mvs-latn-id",mvt:"mvt-latn-vu",mvu:"mvu-latn-td",mvv:"mvv-latn-my",mvw:"mvw-latn-tz",mvx:"mvx-latn-id",mvy:"mvy-arab-pk",mvz:"mvz-ethi-et","mvz-arab":"mvz-arab-et",mwa:"mwa-latn-pg",mwb:"mwb-latn-pg",mwc:"mwc-latn-pg",mwe:"mwe-latn-tz",mwf:"mwf-latn-au",mwg:"mwg-latn-pg",mwh:"mwh-latn-pg",mwi:"mwi-latn-vu",mwk:"mwk-latn-ml",mwl:"mwl-latn-pt",mwm:"mwm-latn-td",mwn:"mwn-latn-zm",mwo:"mwo-latn-vu",mwp:"mwp-latn-au",mwq:"mwq-latn-mm",mwr:"mwr-deva-in",mws:"mws-latn-ke",mwt:"mwt-mymr-mm","mwt-thai":"mwt-thai-th",mwu:"mwu-latn-ss",mwv:"mwv-latn-id",mww:"mww-hmnp-us",mwz:"mwz-latn-cd",mxa:"mxa-latn-mx",mxb:"mxb-latn-mx",mxc:"mxc-latn-zw",mxd:"mxd-latn-id",mxe:"mxe-latn-vu",mxf:"mxf-latn-cm",mxg:"mxg-latn-ao",mxh:"mxh-latn-cd",mxi:"mxi-latn-es",mxj:"mxj-latn-in",mxk:"mxk-latn-pg",mxl:"mxl-latn-bj",mxm:"mxm-latn-zz",mxn:"mxn-latn-id",mxo:"mxo-latn-zm",mxp:"mxp-latn-mx",mxq:"mxq-latn-mx",mxr:"mxr-latn-my",mxs:"mxs-latn-mx",mxt:"mxt-latn-mx",mxu:"mxu-latn-cm",mxv:"mxv-latn-mx",mxw:"mxw-latn-pg",mxx:"mxx-latn-ci",mxy:"mxy-latn-mx",mxz:"mxz-latn-id",my:"my-mymr-mm",myb:"myb-latn-td",myc:"myc-latn-cd",mye:"mye-latn-ga",myf:"myf-latn-et",myg:"myg-latn-cm",myh:"myh-latn-us",myj:"myj-latn-ss",myk:"myk-latn-zz",myl:"myl-latn-id",mym:"mym-ethi-zz",myp:"myp-latn-br",myr:"myr-latn-pe",myu:"myu-latn-br",myv:"myv-cyrl-ru",myw:"myw-latn-zz",myx:"myx-latn-ug",myy:"myy-latn-co",myz:"myz-mand-ir",mza:"mza-latn-mx",mzd:"mzd-latn-cm",mze:"mze-latn-pg",mzh:"mzh-latn-ar",mzi:"mzi-latn-mx",mzj:"mzj-latn-lr",mzk:"mzk-latn-zz",mzl:"mzl-latn-mx",mzm:"mzm-latn-zz",mzn:"mzn-arab-ir",mzo:"mzo-latn-br",mzp:"mzp-latn-zz",mzq:"mzq-latn-id",mzr:"mzr-latn-br",mzt:"mzt-latn-my",mzu:"mzu-latn-pg",mzv:"mzv-latn-cf",mzw:"mzw-latn-zz",mzx:"mzx-latn-gy",mzz:"mzz-latn-zz",na:"na-latn-nr",naa:"naa-latn-id",nab:"nab-latn-br",nac:"nac-latn-zz",nae:"nae-latn-id",naf:"naf-latn-zz",nag:"nag-latn-in",naj:"naj-latn-gn",nak:"nak-latn-zz",nal:"nal-latn-pg",nam:"nam-latn-au",nan:"nan-hans-cn",nao:"nao-deva-np",nap:"nap-latn-it",naq:"naq-latn-na",nar:"nar-latn-ng",nas:"nas-latn-zz",nat:"nat-latn-ng",naw:"naw-latn-gh",nax:"nax-latn-pg",nay:"nay-latn-au",naz:"naz-latn-mx",nb:"nb-latn-no",nba:"nba-latn-ao",nbb:"nbb-latn-ng",nbc:"nbc-latn-in",nbd:"nbd-latn-cd",nbe:"nbe-latn-in",nbh:"nbh-latn-ng",nbi:"nbi-latn-in",nbj:"nbj-latn-au",nbk:"nbk-latn-pg",nbm:"nbm-latn-cf",nbn:"nbn-latn-id",nbo:"nbo-latn-ng",nbp:"nbp-latn-ng",nbq:"nbq-latn-id",nbr:"nbr-latn-ng",nbt:"nbt-latn-in","nbt-deva":"nbt-deva-in",nbu:"nbu-latn-in",nbv:"nbv-latn-cm",nbw:"nbw-latn-cd",nby:"nby-latn-pg",nca:"nca-latn-zz",ncb:"ncb-latn-in","ncb-deva":"ncb-deva-in",ncc:"ncc-latn-pg",ncd:"ncd-deva-np",nce:"nce-latn-zz",ncf:"ncf-latn-zz",ncg:"ncg-latn-ca",nch:"nch-latn-mx",nci:"nci-latn-mx",ncj:"ncj-latn-mx",nck:"nck-latn-au",ncl:"ncl-latn-mx",ncm:"ncm-latn-pg",ncn:"ncn-latn-pg",nco:"nco-latn-zz",ncq:"ncq-laoo-la","ncq-thai":"ncq-thai-la",ncr:"ncr-latn-cm",nct:"nct-latn-in","nct-beng":"nct-beng-in",ncu:"ncu-latn-zz",ncx:"ncx-latn-mx",ncz:"ncz-latn-us",nd:"nd-latn-zw",nda:"nda-latn-cg",ndb:"ndb-latn-cm",ndc:"ndc-latn-mz",ndd:"ndd-latn-ng",ndf:"ndf-cyrl-ru",ndg:"ndg-latn-tz",ndh:"ndh-latn-tz",ndi:"ndi-latn-ng",ndj:"ndj-latn-tz",ndk:"ndk-latn-cd",ndl:"ndl-latn-cd",ndm:"ndm-latn-td",ndn:"ndn-latn-cg",ndp:"ndp-latn-ug",ndq:"ndq-latn-ao",ndr:"ndr-latn-ng",nds:"nds-latn-de",ndt:"ndt-latn-cd",ndu:"ndu-latn-cm",ndv:"ndv-latn-sn",ndw:"ndw-latn-cd",ndx:"ndx-latn-id",ndy:"ndy-latn-cf","ndy-td":"ndy-latn-td",ndz:"ndz-latn-ss",ne:"ne-deva-np",nea:"nea-latn-id",neb:"neb-latn-zz",nec:"nec-latn-id",ned:"ned-latn-ng",nee:"nee-latn-nc",neg:"neg-cyrl-ru",neh:"neh-tibt-bt",nei:"nei-xsux-tr",nej:"nej-latn-pg",nek:"nek-latn-nc",nem:"nem-latn-nc",nen:"nen-latn-nc",neo:"neo-latn-vn",neq:"neq-latn-mx",ner:"ner-latn-id",net:"net-latn-pg",neu:"neu-latn-001",new:"new-deva-np",nex:"nex-latn-zz",ney:"ney-latn-ci",nez:"nez-latn-us",nfa:"nfa-latn-id",nfd:"nfd-latn-ng",nfl:"nfl-latn-sb",nfr:"nfr-latn-zz",nfu:"nfu-latn-cm",ng:"ng-latn-na",nga:"nga-latn-zz",ngb:"ngb-latn-zz",ngc:"ngc-latn-cd",ngd:"ngd-latn-cf",nge:"nge-latn-cm",ngg:"ngg-latn-cf",ngh:"ngh-latn-za",ngi:"ngi-latn-ng",ngj:"ngj-latn-cm",ngk:"ngk-latn-au",ngl:"ngl-latn-mz",ngm:"ngm-latn-fm",ngn:"ngn-latn-cm",ngp:"ngp-latn-tz",ngq:"ngq-latn-tz",ngr:"ngr-latn-sb",ngs:"ngs-latn-ng",ngt:"ngt-laoo-la",ngu:"ngu-latn-mx",ngv:"ngv-latn-cm",ngw:"ngw-latn-ng",ngx:"ngx-latn-ng",ngy:"ngy-latn-cm",ngz:"ngz-latn-cg",nha:"nha-latn-au",nhb:"nhb-latn-zz",nhc:"nhc-latn-mx",nhd:"nhd-latn-py",nhe:"nhe-latn-mx",nhf:"nhf-latn-au",nhg:"nhg-latn-mx",nhi:"nhi-latn-mx",nhk:"nhk-latn-mx",nhm:"nhm-latn-mx",nhn:"nhn-latn-mx",nho:"nho-latn-pg",nhp:"nhp-latn-mx",nhq:"nhq-latn-mx",nhr:"nhr-latn-bw",nht:"nht-latn-mx",nhu:"nhu-latn-cm",nhv:"nhv-latn-mx",nhw:"nhw-latn-mx",nhx:"nhx-latn-mx",nhy:"nhy-latn-mx",nhz:"nhz-latn-mx",nia:"nia-latn-id",nib:"nib-latn-pg",nid:"nid-latn-au",nie:"nie-latn-td",nif:"nif-latn-zz",nig:"nig-latn-au",nih:"nih-latn-tz",nii:"nii-latn-zz",nij:"nij-latn-id",nil:"nil-latn-id",nim:"nim-latn-tz",nin:"nin-latn-zz",nio:"nio-cyrl-ru",niq:"niq-latn-ke",nir:"nir-latn-id",nis:"nis-latn-pg",nit:"nit-telu-in",niu:"niu-latn-nu",niv:"niv-cyrl-ru","niv-latn":"niv-latn-ru",niw:"niw-latn-pg",nix:"nix-latn-cd",niy:"niy-latn-zz",niz:"niz-latn-zz",nja:"nja-latn-ng",njb:"njb-latn-in",njd:"njd-latn-tz",njh:"njh-latn-in",nji:"nji-latn-au",njj:"njj-latn-cm",njl:"njl-latn-ss",njm:"njm-latn-in",njn:"njn-latn-in",njo:"njo-latn-in",njr:"njr-latn-ng",njs:"njs-latn-id",njt:"njt-latn-sr",nju:"nju-latn-au",njx:"njx-latn-cg",njy:"njy-latn-cm",njz:"njz-latn-in","njz-beng":"njz-beng-in",nka:"nka-latn-zm",nkb:"nkb-latn-in",nkc:"nkc-latn-cm",nkd:"nkd-latn-in",nke:"nke-latn-sb",nkf:"nkf-latn-in",nkg:"nkg-latn-zz",nkh:"nkh-latn-in",nki:"nki-latn-in","nki-beng":"nki-beng-in",nkj:"nkj-latn-id",nkk:"nkk-latn-vu",nkm:"nkm-latn-pg",nkn:"nkn-latn-ao",nko:"nko-latn-zz",nkq:"nkq-latn-gh",nkr:"nkr-latn-fm",nks:"nks-latn-id",nkt:"nkt-latn-tz",nku:"nku-latn-ci",nkv:"nkv-latn-mw",nkw:"nkw-latn-cd",nkx:"nkx-latn-ng",nkz:"nkz-latn-ng",nl:"nl-latn-nl",nla:"nla-latn-cm",nlc:"nlc-latn-id",nle:"nle-latn-ke",nlg:"nlg-latn-sb",nli:"nli-arab-af",nlj:"nlj-latn-cd",nlk:"nlk-latn-id",nlm:"nlm-arab-pk",nlo:"nlo-latn-cd",nlq:"nlq-latn-mm",nlu:"nlu-latn-gh",nlv:"nlv-latn-mx",nlw:"nlw-latn-au",nlx:"nlx-deva-in",nly:"nly-latn-au",nlz:"nlz-latn-sb",nma:"nma-latn-in",nmb:"nmb-latn-vu",nmc:"nmc-latn-td",nmd:"nmd-latn-ga",nme:"nme-latn-in",nmf:"nmf-latn-in",nmg:"nmg-latn-cm",nmh:"nmh-latn-in",nmi:"nmi-latn-ng",nmj:"nmj-latn-cf",nmk:"nmk-latn-vu",nml:"nml-latn-cm",nmm:"nmm-deva-np","nmm-tibt":"nmm-tibt-np",nmn:"nmn-latn-bw",nmo:"nmo-latn-in","nmo-beng":"nmo-beng-in",nmp:"nmp-latn-au",nmq:"nmq-latn-zw",nmr:"nmr-latn-cm",nms:"nms-latn-vu",nmt:"nmt-latn-fm",nmu:"nmu-latn-us",nmv:"nmv-latn-au",nmw:"nmw-latn-pg",nmx:"nmx-latn-pg",nmz:"nmz-latn-zz",nn:"nn-latn-no",nna:"nna-latn-au",nnb:"nnb-latn-cd",nnc:"nnc-latn-td",nnd:"nnd-latn-vu",nne:"nne-latn-ao",nnf:"nnf-latn-zz",nng:"nng-latn-in","nng-beng":"nng-beng-in",nnh:"nnh-latn-cm",nni:"nni-latn-id",nnj:"nnj-latn-et",nnk:"nnk-latn-zz",nnl:"nnl-latn-in",nnm:"nnm-latn-zz",nnn:"nnn-latn-td",nnp:"nnp-wcho-in",nnq:"nnq-latn-tz",nnr:"nnr-latn-au",nnt:"nnt-latn-us",nnu:"nnu-latn-gh",nnv:"nnv-latn-au",nnw:"nnw-latn-bf",nny:"nny-latn-au",nnz:"nnz-latn-cm",no:"no-latn-no",noa:"noa-latn-co",noc:"noc-latn-pg",nod:"nod-lana-th",noe:"noe-deva-in",nof:"nof-latn-pg",nog:"nog-cyrl-ru",noh:"noh-latn-pg",noi:"noi-deva-in",noj:"noj-latn-co",nok:"nok-latn-us",nom:"nom-latn-pe",non:"non-runr-se",nop:"nop-latn-zz",noq:"noq-latn-cd",nos:"nos-yiii-cn",not:"not-latn-pe",nou:"nou-latn-zz",nov:"nov-latn-001",now:"now-latn-tz",noy:"noy-latn-td",npb:"npb-tibt-bt",npg:"npg-latn-mm",nph:"nph-latn-in",npl:"npl-latn-mx",npn:"npn-latn-pg",npo:"npo-latn-in",nps:"nps-latn-id",npu:"npu-latn-in",npx:"npx-latn-sb",npy:"npy-latn-id",nqg:"nqg-latn-bj",nqk:"nqk-latn-bj",nql:"nql-latn-ao",nqm:"nqm-latn-id",nqn:"nqn-latn-pg",nqo:"nqo-nkoo-gn",nqq:"nqq-latn-mm",nqt:"nqt-latn-ng",nqy:"nqy-latn-mm",nr:"nr-latn-za",nra:"nra-latn-ga",nrb:"nrb-latn-zz",nre:"nre-latn-in",nrf:"nrf-latn-je",nrg:"nrg-latn-vu",nri:"nri-latn-in",nrk:"nrk-latn-au",nrl:"nrl-latn-au",nrm:"nrm-latn-my",nrp:"nrp-latn-it",nru:"nru-latn-cn","nru-hans":"nru-hans-cn","nru-hant":"nru-hant-cn",nrx:"nrx-latn-au",nrz:"nrz-latn-pg",nsa:"nsa-latn-in",nsb:"nsb-latn-za",nsc:"nsc-latn-ng",nsd:"nsd-yiii-cn",nse:"nse-latn-zm",nsf:"nsf-yiii-cn",nsg:"nsg-latn-tz",nsh:"nsh-latn-cm",nsk:"nsk-cans-ca",nsm:"nsm-latn-in",nsn:"nsn-latn-zz",nso:"nso-latn-za",nsq:"nsq-latn-us",nss:"nss-latn-zz",nst:"nst-tnsa-in",nsu:"nsu-latn-mx",nsv:"nsv-yiii-cn",nsw:"nsw-latn-vu",nsx:"nsx-latn-ao",nsy:"nsy-latn-id",nsz:"nsz-latn-us",ntd:"ntd-latn-my",nte:"nte-latn-mz",ntg:"ntg-latn-au",nti:"nti-latn-bf",ntj:"ntj-latn-au",ntk:"ntk-latn-tz",ntm:"ntm-latn-zz",nto:"nto-latn-cd",ntp:"ntp-latn-mx",ntr:"ntr-latn-zz",ntu:"ntu-latn-sb",ntx:"ntx-latn-mm",nty:"nty-yiii-vn",ntz:"ntz-arab-ir",nua:"nua-latn-nc",nuc:"nuc-latn-br",nud:"nud-latn-pg",nue:"nue-latn-cd",nuf:"nuf-latn-cn",nug:"nug-latn-au",nuh:"nuh-latn-ng",nui:"nui-latn-zz",nuj:"nuj-latn-ug",nuk:"nuk-latn-ca",num:"num-latn-to",nun:"nun-latn-mm",nuo:"nuo-latn-vn",nup:"nup-latn-zz",nuq:"nuq-latn-pg",nur:"nur-latn-pg",nus:"nus-latn-ss",nut:"nut-latn-vn",nuu:"nuu-latn-cd",nuv:"nuv-latn-zz",nuw:"nuw-latn-fm",nux:"nux-latn-zz",nuy:"nuy-latn-au",nuz:"nuz-latn-mx",nv:"nv-latn-us",nvh:"nvh-latn-vu",nvm:"nvm-latn-pg",nvo:"nvo-latn-cm",nwb:"nwb-latn-zz",nwc:"nwc-newa-np","nwc-brah":"nwc-brah-np","nwc-deva":"nwc-deva-np","nwc-sidd":"nwc-sidd-np",nwe:"nwe-latn-cm",nwg:"nwg-latn-au",nwi:"nwi-latn-vu",nwm:"nwm-latn-ss",nwo:"nwo-latn-au",nwr:"nwr-latn-pg",nww:"nww-latn-tz",nwx:"nwx-deva-np",nxa:"nxa-latn-tl",nxd:"nxd-latn-cd",nxe:"nxe-latn-id",nxg:"nxg-latn-id",nxi:"nxi-latn-tz",nxl:"nxl-latn-id",nxn:"nxn-latn-au",nxo:"nxo-latn-ga",nxq:"nxq-latn-cn",nxr:"nxr-latn-zz",nxx:"nxx-latn-id",ny:"ny-latn-mw",nyb:"nyb-latn-gh",nyc:"nyc-latn-cd",nyd:"nyd-latn-ke",nye:"nye-latn-ao",nyf:"nyf-latn-ke",nyg:"nyg-latn-cd",nyh:"nyh-latn-au",nyi:"nyi-latn-sd",nyj:"nyj-latn-cd",nyk:"nyk-latn-ao",nyl:"nyl-thai-th",nym:"nym-latn-tz",nyn:"nyn-latn-ug",nyo:"nyo-latn-ug",nyp:"nyp-latn-ug",nyq:"nyq-arab-ir",nyr:"nyr-latn-mw",nys:"nys-latn-au",nyt:"nyt-latn-au",nyu:"nyu-latn-mz",nyv:"nyv-latn-au",nyx:"nyx-latn-au",nyy:"nyy-latn-tz",nza:"nza-latn-cm",nzb:"nzb-latn-ga",nzd:"nzd-latn-cd",nzi:"nzi-latn-gh",nzk:"nzk-latn-cf",nzm:"nzm-latn-in",nzu:"nzu-latn-cg",nzy:"nzy-latn-td",nzz:"nzz-latn-ml",oaa:"oaa-cyrl-ru",oac:"oac-cyrl-ru",oar:"oar-syrc-sy",oav:"oav-geor-ge",obi:"obi-latn-us",obk:"obk-latn-ph",obl:"obl-latn-cm",obm:"obm-phnx-jo",obo:"obo-latn-ph",obr:"obr-mymr-mm",obt:"obt-latn-fr",obu:"obu-latn-ng",oc:"oc-latn-fr",oca:"oca-latn-pe",oco:"oco-latn-gb",ocu:"ocu-latn-mx",oda:"oda-latn-ng",odk:"odk-arab-pk",odt:"odt-latn-nl",odu:"odu-latn-ng",ofu:"ofu-latn-ng",ogb:"ogb-latn-ng",ogc:"ogc-latn-zz",ogg:"ogg-latn-ng",ogo:"ogo-latn-ng",ogu:"ogu-latn-ng",oht:"oht-xsux-tr",oia:"oia-latn-id",oie:"oie-latn-ss",oin:"oin-latn-pg",oj:"oj-cans-ca",ojb:"ojb-latn-ca","ojb-cans":"ojb-cans-ca",ojc:"ojc-latn-ca",ojs:"ojs-cans-ca",ojv:"ojv-latn-sb",ojw:"ojw-latn-ca","ojw-cans":"ojw-cans-ca",oka:"oka-latn-ca",okb:"okb-latn-ng",okc:"okc-latn-cd",okd:"okd-latn-ng",oke:"oke-latn-ng",okg:"okg-latn-au",oki:"oki-latn-ke",okk:"okk-latn-pg",okm:"okm-hang-kr",oko:"oko-hani-kr",okr:"okr-latn-zz",oks:"oks-latn-ng",oku:"oku-latn-cm",okv:"okv-latn-zz",okx:"okx-latn-ng",okz:"okz-khmr-kh",ola:"ola-deva-np","ola-tibt":"ola-tibt-cn",old:"old-latn-tz",ole:"ole-tibt-bt",olk:"olk-latn-au",olm:"olm-latn-ng",olo:"olo-latn-ru",olr:"olr-latn-vu",olt:"olt-latn-lt",olu:"olu-latn-ao",om:"om-latn-et",oma:"oma-latn-us",omb:"omb-latn-vu",omc:"omc-latn-pe",omg:"omg-latn-pe",omi:"omi-latn-cd",omk:"omk-cyrl-ru",oml:"oml-latn-cd",omo:"omo-latn-pg",omp:"omp-mtei-in",omr:"omr-modi-in",omt:"omt-latn-ke",omu:"omu-latn-pe",omw:"omw-latn-pg",ona:"ona-latn-ar",one:"one-latn-ca",ong:"ong-latn-zz",oni:"oni-latn-id",onj:"onj-latn-pg",onk:"onk-latn-pg",onn:"onn-latn-zz",ono:"ono-latn-ca",onp:"onp-latn-in","onp-deva":"onp-deva-in",onr:"onr-latn-pg",ons:"ons-latn-zz",ont:"ont-latn-pg",onu:"onu-latn-vu",onx:"onx-latn-id",ood:"ood-latn-us",oon:"oon-deva-in",oor:"oor-latn-za",opa:"opa-latn-ng",opk:"opk-latn-id",opm:"opm-latn-zz",opo:"opo-latn-pg",opt:"opt-latn-mx",opy:"opy-latn-br",or:"or-orya-in",ora:"ora-latn-sb",orc:"orc-latn-ke",ore:"ore-latn-pe",org:"org-latn-ng",orn:"orn-latn-my",oro:"oro-latn-zz",orr:"orr-latn-ng",ors:"ors-latn-my",ort:"ort-telu-in",oru:"oru-arab-zz",orv:"orv-cyrl-ru",orw:"orw-latn-br",orx:"orx-latn-ng",orz:"orz-latn-id",os:"os-cyrl-ge",osa:"osa-osge-us",osc:"osc-ital-it","osc-latn":"osc-latn-it",osi:"osi-java-id",oso:"oso-latn-ng",osp:"osp-latn-es",ost:"ost-latn-cm",osu:"osu-latn-pg",osx:"osx-latn-de",ota:"ota-arab-zz",otb:"otb-tibt-cn",otd:"otd-latn-id",ote:"ote-latn-mx",oti:"oti-latn-br",otk:"otk-orkh-mn",otl:"otl-latn-mx",otm:"otm-latn-mx",otn:"otn-latn-mx",otq:"otq-latn-mx",otr:"otr-latn-sd",ots:"ots-latn-mx",ott:"ott-latn-mx",otu:"otu-latn-br",otw:"otw-latn-ca",otx:"otx-latn-mx",oty:"oty-gran-in",otz:"otz-latn-mx",oub:"oub-latn-lr",oue:"oue-latn-pg",oui:"oui-ougr-143",oum:"oum-latn-pg",ovd:"ovd-latn-se",owi:"owi-latn-pg",owl:"owl-latn-gb",oyd:"oyd-latn-et",oym:"oym-latn-br",oyy:"oyy-latn-pg",ozm:"ozm-latn-zz",pa:"pa-guru-in","pa-arab":"pa-arab-pk","pa-pk":"pa-arab-pk",pab:"pab-latn-br",pac:"pac-latn-vn",pad:"pad-latn-br",pae:"pae-latn-cd",paf:"paf-latn-br",pag:"pag-latn-ph",pah:"pah-latn-br",pai:"pai-latn-ng",pak:"pak-latn-br",pal:"pal-phli-ir","pal-phlp":"pal-phlp-cn",pam:"pam-latn-ph",pao:"pao-latn-us",pap:"pap-latn-cw",paq:"paq-cyrl-tj",par:"par-latn-us",pas:"pas-latn-id",pau:"pau-latn-pw",pav:"pav-latn-br",paw:"paw-latn-us",pax:"pax-latn-br",pay:"pay-latn-hn",paz:"paz-latn-br",pbb:"pbb-latn-co",pbc:"pbc-latn-gy",pbe:"pbe-latn-mx",pbf:"pbf-latn-mx",pbg:"pbg-latn-ve",pbh:"pbh-latn-ve",pbi:"pbi-latn-zz",pbl:"pbl-latn-ng",pbm:"pbm-latn-mx",pbn:"pbn-latn-ng",pbo:"pbo-latn-gw",pbp:"pbp-latn-gn",pbr:"pbr-latn-tz",pbs:"pbs-latn-mx",pbt:"pbt-arab-af",pbv:"pbv-latn-in",pby:"pby-latn-pg",pca:"pca-latn-mx",pcb:"pcb-khmr-kh",pcc:"pcc-latn-cn","pcc-hani":"pcc-hani-cn",pcd:"pcd-latn-fr",pce:"pce-mymr-mm","pce-thai":"pce-thai-th",pcf:"pcf-mlym-in",pcg:"pcg-mlym-in","pcg-knda":"pcg-knda-in","pcg-taml":"pcg-taml-in",pch:"pch-deva-in",pci:"pci-deva-in","pci-orya":"pci-orya-in",pcj:"pcj-telu-in",pck:"pck-latn-in",pcm:"pcm-latn-ng",pcn:"pcn-latn-ng",pcp:"pcp-latn-bo",pcw:"pcw-latn-ng",pda:"pda-latn-pg",pdc:"pdc-latn-us",pdn:"pdn-latn-id",pdo:"pdo-latn-id",pdt:"pdt-latn-ca",pdu:"pdu-latn-mm","pdu-mymr":"pdu-mymr-mm",pea:"pea-latn-id",peb:"peb-latn-us",ped:"ped-latn-zz",pee:"pee-latn-id",peg:"peg-orya-in",pei:"pei-latn-mx",pek:"pek-latn-pg",pel:"pel-latn-id",pem:"pem-latn-cd",peo:"peo-xpeo-ir",pep:"pep-latn-pg",peq:"peq-latn-us",pev:"pev-latn-ve",pex:"pex-latn-zz",pey:"pey-latn-id",pez:"pez-latn-my",pfa:"pfa-latn-fm",pfe:"pfe-latn-cm",pfl:"pfl-latn-de",pga:"pga-latn-ss",pgd:"pgd-khar-pk",pgg:"pgg-deva-in",pgi:"pgi-latn-pg",pgk:"pgk-latn-vu",pgl:"pgl-ogam-ie",pgn:"pgn-ital-it",pgs:"pgs-latn-ng",pgu:"pgu-latn-id",phd:"phd-deva-in",phg:"phg-latn-vn",phh:"phh-latn-vn",phk:"phk-mymr-in",phl:"phl-arab-zz",phm:"phm-latn-mz",phn:"phn-phnx-lb",pho:"pho-laoo-la",phr:"phr-arab-pk",pht:"pht-thai-th",phv:"phv-arab-af",phw:"phw-deva-np",pi:"pi-sinh-in","pi-brah":"pi-brah-in","pi-deva":"pi-deva-in","pi-khar":"pi-khar-in","pi-khmr":"pi-khmr-in","pi-mymr":"pi-mymr-in","pi-thai":"pi-thai-in",pia:"pia-latn-mx",pib:"pib-latn-pe",pic:"pic-latn-ga",pid:"pid-latn-ve",pif:"pif-latn-fm",pig:"pig-latn-pe",pih:"pih-latn-nf",pij:"pij-latn-co",pil:"pil-latn-zz",pim:"pim-latn-us",pin:"pin-latn-pg",pio:"pio-latn-co",pip:"pip-latn-zz",pir:"pir-latn-br",pis:"pis-latn-sb",pit:"pit-latn-au",piu:"piu-latn-au",piv:"piv-latn-sb",piw:"piw-latn-tz",pix:"pix-latn-pg",piy:"piy-latn-ng",piz:"piz-latn-nc",pjt:"pjt-latn-au",pka:"pka-brah-in",pkb:"pkb-latn-ke",pkg:"pkg-latn-pg",pkh:"pkh-latn-bd","pkh-deva":"pkh-deva-bd",pkn:"pkn-latn-au",pko:"pko-latn-ke",pkp:"pkp-latn-ck",pkr:"pkr-mlym-in",pku:"pku-latn-id",pl:"pl-latn-pl",pla:"pla-latn-zz",plb:"plb-latn-vu",plc:"plc-latn-ph",pld:"pld-latn-gb",ple:"ple-latn-id",plg:"plg-latn-ar",plh:"plh-latn-id",plj:"plj-latn-ng",plk:"plk-arab-pk",pll:"pll-mymr-mm",pln:"pln-latn-co",plo:"plo-latn-mx",plr:"plr-latn-ci",pls:"pls-latn-mx",plu:"plu-latn-br",plv:"plv-latn-ph",plw:"plw-latn-ph",plz:"plz-latn-my",pma:"pma-latn-vu",pmb:"pmb-latn-cd",pmd:"pmd-latn-au",pme:"pme-latn-nc",pmf:"pmf-latn-id",pmh:"pmh-brah-in",pmi:"pmi-latn-cn",pmj:"pmj-latn-cn",pml:"pml-latn-tn",pmm:"pmm-latn-cm",pmn:"pmn-latn-cm",pmo:"pmo-latn-id",pmq:"pmq-latn-mx",pmr:"pmr-latn-pg",pms:"pms-latn-it",pmt:"pmt-latn-pf",pmw:"pmw-latn-us",pmx:"pmx-latn-in",pmy:"pmy-latn-id",pmz:"pmz-latn-mx",pna:"pna-latn-my",pnc:"pnc-latn-id",pnd:"pnd-latn-ao",pne:"pne-latn-my",png:"png-latn-zz",pnh:"pnh-latn-ck",pni:"pni-latn-id",pnj:"pnj-latn-au",pnk:"pnk-latn-bo",pnl:"pnl-latn-bf",pnm:"pnm-latn-my",pnn:"pnn-latn-zz",pno:"pno-latn-pe",pnp:"pnp-latn-id",pnq:"pnq-latn-bf",pnr:"pnr-latn-pg",pns:"pns-latn-id",pnt:"pnt-grek-gr",pnv:"pnv-latn-au",pnw:"pnw-latn-au",pny:"pny-latn-cm",pnz:"pnz-latn-cf",poc:"poc-latn-gt",poe:"poe-latn-mx",pof:"pof-latn-cd",pog:"pog-latn-br",poh:"poh-latn-gt",poi:"poi-latn-mx",pok:"pok-latn-br",pom:"pom-latn-us",pon:"pon-latn-fm",poo:"poo-latn-us",pop:"pop-latn-nc",poq:"poq-latn-mx",pos:"pos-latn-mx",pot:"pot-latn-us",pov:"pov-latn-gw",pow:"pow-latn-mx",poy:"poy-latn-tz",ppa:"ppa-deva-in",ppe:"ppe-latn-pg",ppi:"ppi-latn-mx",ppk:"ppk-latn-id",ppl:"ppl-latn-sv",ppm:"ppm-latn-id",ppn:"ppn-latn-pg",ppo:"ppo-latn-zz",ppp:"ppp-latn-cd",ppq:"ppq-latn-pg",pps:"pps-latn-mx",ppt:"ppt-latn-pg",pqa:"pqa-latn-ng",pqm:"pqm-latn-ca",pra:"pra-khar-pk",prc:"prc-arab-af",prd:"prd-arab-ir",pre:"pre-latn-st",prf:"prf-latn-ph",prg:"prg-latn-001",prh:"prh-latn-ph",pri:"pri-latn-nc",prk:"prk-latn-mm",prm:"prm-latn-pg",pro:"pro-latn-fr",prp:"prp-gujr-in",prq:"prq-latn-pe",prr:"prr-latn-br",prt:"prt-thai-th",pru:"pru-latn-id",prw:"prw-latn-pg",prx:"prx-arab-in","prx-tibt":"prx-tibt-in",ps:"ps-arab-af",psa:"psa-latn-id",pse:"pse-latn-id",psh:"psh-arab-af",psi:"psi-arab-af",psm:"psm-latn-bo",psn:"psn-latn-id",psq:"psq-latn-pg",pss:"pss-latn-zz",pst:"pst-arab-pk",psw:"psw-latn-vu",pt:"pt-latn-br",pta:"pta-latn-py",pth:"pth-latn-br",pti:"pti-latn-au",ptn:"ptn-latn-id",pto:"pto-latn-br",ptp:"ptp-latn-zz",ptr:"ptr-latn-vu",ptt:"ptt-latn-id",ptu:"ptu-latn-id",ptv:"ptv-latn-vu",pua:"pua-latn-mx",pub:"pub-latn-in",puc:"puc-latn-id",pud:"pud-latn-id",pue:"pue-latn-ar",puf:"puf-latn-id",pug:"pug-latn-bf",pui:"pui-latn-co",puj:"puj-latn-id",pum:"pum-deva-np",puo:"puo-latn-vn",pup:"pup-latn-pg",puq:"puq-latn-pe",pur:"pur-latn-br",put:"put-latn-id",puu:"puu-latn-ga",puw:"puw-latn-fm",pux:"pux-latn-pg",puy:"puy-latn-us",pwa:"pwa-latn-zz",pwb:"pwb-latn-ng",pwg:"pwg-latn-pg",pwm:"pwm-latn-ph",pwn:"pwn-latn-tw",pwo:"pwo-mymr-mm",pwr:"pwr-deva-in",pww:"pww-thai-th",pxm:"pxm-latn-mx",pye:"pye-latn-ci",pym:"pym-latn-ng",pyn:"pyn-latn-br",pyu:"pyu-latn-tw","pyu-hani":"pyu-hani-tw",pyx:"pyx-mymr-mm",pyy:"pyy-latn-mm",pzh:"pzh-latn-tw",pzn:"pzn-latn-mm",qu:"qu-latn-pe",qua:"qua-latn-us",qub:"qub-latn-pe",quc:"quc-latn-gt",qud:"qud-latn-ec",quf:"quf-latn-pe",qug:"qug-latn-ec",qui:"qui-latn-us",quk:"quk-latn-pe",qul:"qul-latn-bo",qum:"qum-latn-gt",qun:"qun-latn-us",qup:"qup-latn-pe",quq:"quq-latn-es",qur:"qur-latn-pe",qus:"qus-latn-ar",quv:"quv-latn-gt",quw:"quw-latn-ec",qux:"qux-latn-pe",quy:"quy-latn-pe",qva:"qva-latn-pe",qvc:"qvc-latn-pe",qve:"qve-latn-pe",qvh:"qvh-latn-pe",qvi:"qvi-latn-ec",qvj:"qvj-latn-ec",qvl:"qvl-latn-pe",qvm:"qvm-latn-pe",qvn:"qvn-latn-pe",qvo:"qvo-latn-pe",qvp:"qvp-latn-pe",qvs:"qvs-latn-pe",qvw:"qvw-latn-pe",qvz:"qvz-latn-ec",qwa:"qwa-latn-pe",qwc:"qwc-latn-pe",qwh:"qwh-latn-pe",qwm:"qwm-latn-ru","qwm-cyrl":"qwm-cyrl-ru","qwm-runr":"qwm-runr-ru",qws:"qws-latn-pe",qwt:"qwt-latn-us",qxa:"qxa-latn-pe",qxc:"qxc-latn-pe",qxh:"qxh-latn-pe",qxl:"qxl-latn-ec",qxn:"qxn-latn-pe",qxo:"qxo-latn-pe",qxp:"qxp-latn-pe",qxq:"qxq-arab-ir",qxr:"qxr-latn-ec",qxt:"qxt-latn-pe",qxu:"qxu-latn-pe",qxw:"qxw-latn-pe",qya:"qya-latn-001",qyp:"qyp-latn-us",raa:"raa-deva-np",rab:"rab-deva-np",rac:"rac-latn-id",rad:"rad-latn-vn",raf:"raf-deva-np",rag:"rag-latn-ke",rah:"rah-beng-in","rah-latn":"rah-latn-in",rai:"rai-latn-zz",raj:"raj-deva-in",rak:"rak-latn-pg",ram:"ram-latn-br",ran:"ran-latn-id",rao:"rao-latn-zz",rap:"rap-latn-cl",rar:"rar-latn-ck",rav:"rav-deva-np",raw:"raw-latn-mm",rax:"rax-latn-ng",ray:"ray-latn-pf",raz:"raz-latn-id",rbb:"rbb-mymr-mm",rbk:"rbk-latn-ph",rbl:"rbl-latn-ph",rbp:"rbp-latn-au",rcf:"rcf-latn-re",rdb:"rdb-arab-ir",rea:"rea-latn-pg",reb:"reb-latn-id",ree:"ree-latn-my",reg:"reg-latn-tz",rei:"rei-orya-in","rei-telu":"rei-telu-in",rej:"rej-latn-id",rel:"rel-latn-zz",rem:"rem-latn-pe",ren:"ren-latn-vn",res:"res-latn-zz",ret:"ret-latn-id",rey:"rey-latn-bo",rga:"rga-latn-vu",rgn:"rgn-latn-it",rgr:"rgr-latn-pe",rgs:"rgs-latn-vn",rgu:"rgu-latn-id",rhg:"rhg-rohg-mm",rhp:"rhp-latn-pg",ria:"ria-latn-in",rif:"rif-latn-ma",ril:"ril-latn-mm",rim:"rim-latn-tz",rin:"rin-latn-ng",rir:"rir-latn-id",rit:"rit-latn-au",riu:"riu-latn-id",rjg:"rjg-latn-id",rji:"rji-deva-np",rjs:"rjs-deva-np",rka:"rka-khmr-kh",rkb:"rkb-latn-br",rkh:"rkh-latn-ck",rki:"rki-mymr-mm",rkm:"rkm-latn-bf",rkt:"rkt-beng-bd",rkw:"rkw-latn-au",rm:"rm-latn-ch",rma:"rma-latn-ni",rmb:"rmb-latn-au",rmc:"rmc-latn-sk",rmd:"rmd-latn-dk",rme:"rme-latn-gb",rmf:"rmf-latn-fi",rmg:"rmg-latn-no",rmh:"rmh-latn-id",rmi:"rmi-armn-am",rmk:"rmk-latn-pg",rml:"rml-latn-pl","rml-cyrl":"rml-cyrl-by",rmm:"rmm-latn-id",rmn:"rmn-latn-rs","rmn-cyrl":"rmn-cyrl-bg","rmn-grek":"rmn-grek-gr",rmo:"rmo-latn-ch",rmp:"rmp-latn-pg",rmq:"rmq-latn-es",rmt:"rmt-arab-ir",rmu:"rmu-latn-se",rmw:"rmw-latn-gb",rmx:"rmx-latn-vn",rmz:"rmz-mymr-in",rn:"rn-latn-bi",rna:"rna-latn-zz",rnd:"rnd-latn-cd",rng:"rng-latn-mz",rnl:"rnl-latn-in",rnn:"rnn-latn-id",rnr:"rnr-latn-au",rnw:"rnw-latn-tz",ro:"ro-latn-ro",rob:"rob-latn-id",roc:"roc-latn-vn",rod:"rod-latn-ng",roe:"roe-latn-pg",rof:"rof-latn-tz",rog:"rog-latn-vn",rol:"rol-latn-ph",rom:"rom-latn-ro","rom-cyrl":"rom-cyrl-ro",roo:"roo-latn-zz",rop:"rop-latn-au",ror:"ror-latn-id",rou:"rou-latn-td",row:"row-latn-id",rpn:"rpn-latn-vu",rpt:"rpt-latn-pg",rri:"rri-latn-sb",rro:"rro-latn-zz",rrt:"rrt-latn-au",rsk:"rsk-cyrl-rs",rtc:"rtc-latn-mm",rth:"rth-latn-id",rtm:"rtm-latn-fj",rtw:"rtw-deva-in",ru:"ru-cyrl-ru",rub:"rub-latn-ug",ruc:"ruc-latn-ug",rue:"rue-cyrl-ua",ruf:"ruf-latn-tz",rug:"rug-latn-sb",rui:"rui-latn-tz",ruk:"ruk-latn-ng",ruo:"ruo-latn-hr",rup:"rup-latn-ro","rup-grek":"rup-grek-gr",ruq:"ruq-latn-gr",rut:"rut-cyrl-ru","rut-latn":"rut-latn-az",ruu:"ruu-latn-my",ruy:"ruy-latn-ng",ruz:"ruz-latn-ng",rw:"rw-latn-rw",rwa:"rwa-latn-pg",rwk:"rwk-latn-tz",rwl:"rwl-latn-tz",rwm:"rwm-latn-ug",rwo:"rwo-latn-zz",rwr:"rwr-deva-in",rxd:"rxd-latn-au",rxw:"rxw-latn-au",ryu:"ryu-kana-jp",sa:"sa-deva-in",saa:"saa-latn-td",sab:"sab-latn-pa",sac:"sac-latn-us",sad:"sad-latn-tz",sae:"sae-latn-br",saf:"saf-latn-gh",sah:"sah-cyrl-ru",saj:"saj-latn-id",sak:"sak-latn-ga",sam:"sam-samr-ps","sam-hebr":"sam-hebr-ps","sam-syrc":"sam-syrc-ps",sao:"sao-latn-id",saq:"saq-latn-ke",sar:"sar-latn-bo",sas:"sas-latn-id",sat:"sat-olck-in",sau:"sau-latn-id",sav:"sav-latn-sn",saw:"saw-latn-id",sax:"sax-latn-vu",say:"say-latn-ng",saz:"saz-saur-in",sba:"sba-latn-zz",sbb:"sbb-latn-sb",sbc:"sbc-latn-pg",sbd:"sbd-latn-bf",sbe:"sbe-latn-zz",sbg:"sbg-latn-id",sbh:"sbh-latn-pg",sbi:"sbi-latn-pg",sbj:"sbj-latn-td",sbk:"sbk-latn-tz",sbl:"sbl-latn-ph",sbm:"sbm-latn-tz",sbn:"sbn-arab-pk",sbo:"sbo-latn-my",sbp:"sbp-latn-tz",sbq:"sbq-latn-pg",sbr:"sbr-latn-id",sbs:"sbs-latn-na",sbt:"sbt-latn-id",sbu:"sbu-tibt-in","sbu-deva":"sbu-deva-in",sbv:"sbv-latn-it",sbw:"sbw-latn-ga",sbx:"sbx-latn-id",sby:"sby-latn-zm",sbz:"sbz-latn-cf",sc:"sc-latn-it",scb:"scb-latn-vn",sce:"sce-latn-cn","sce-arab":"sce-arab-cn",scf:"scf-latn-pa",scg:"scg-latn-id",sch:"sch-latn-in",sci:"sci-latn-lk",sck:"sck-deva-in",scl:"scl-arab-zz",scn:"scn-latn-it",sco:"sco-latn-gb",scp:"scp-deva-np",scs:"scs-latn-ca","scs-cans":"scs-cans-ca",sct:"sct-laoo-la",scu:"scu-takr-in",scv:"scv-latn-ng",scw:"scw-latn-ng",scx:"scx-grek-it",sd:"sd-arab-pk","sd-deva":"sd-deva-in","sd-in":"sd-deva-in","sd-khoj":"sd-khoj-in","sd-sind":"sd-sind-in",sda:"sda-latn-id",sdb:"sdb-arab-iq",sdc:"sdc-latn-it",sde:"sde-latn-ng",sdf:"sdf-arab-iq",sdg:"sdg-arab-af",sdh:"sdh-arab-ir",sdj:"sdj-latn-cg",sdk:"sdk-latn-pg",sdn:"sdn-latn-it",sdo:"sdo-latn-my",sdq:"sdq-latn-id",sds:"sds-arab-tn",sdu:"sdu-latn-id",sdx:"sdx-latn-my",se:"se-latn-no",sea:"sea-latn-my",seb:"seb-latn-ci",sec:"sec-latn-ca",sed:"sed-latn-vn",see:"see-latn-us",sef:"sef-latn-ci",seg:"seg-latn-tz",seh:"seh-latn-mz",sei:"sei-latn-mx",sej:"sej-latn-pg",sek:"sek-latn-ca","sek-cans":"sek-cans-ca",sel:"sel-cyrl-ru",sen:"sen-latn-bf",seo:"seo-latn-pg",sep:"sep-latn-bf",seq:"seq-latn-bf",ser:"ser-latn-us",ses:"ses-latn-ml",set:"set-latn-id",seu:"seu-latn-id",sev:"sev-latn-ci",sew:"sew-latn-pg",sey:"sey-latn-ec",sez:"sez-latn-mm",sfe:"sfe-latn-ph",sfm:"sfm-plrd-cn",sfw:"sfw-latn-gh",sg:"sg-latn-cf",sga:"sga-ogam-ie",sgb:"sgb-latn-ph",sgc:"sgc-latn-ke",sgd:"sgd-latn-ph",sge:"sge-latn-id",sgh:"sgh-cyrl-tj","sgh-arab":"sgh-arab-af","sgh-latn":"sgh-latn-tj",sgi:"sgi-latn-cm",sgj:"sgj-deva-in",sgm:"sgm-latn-ke",sgp:"sgp-latn-in",sgr:"sgr-arab-ir",sgs:"sgs-latn-lt",sgt:"sgt-tibt-bt",sgu:"sgu-latn-id",sgw:"sgw-ethi-zz",sgy:"sgy-arab-af",sgz:"sgz-latn-zz",sha:"sha-latn-ng",shb:"shb-latn-br",shc:"shc-latn-cd",shd:"shd-arab-pk",she:"she-latn-et",shg:"shg-latn-bw",shh:"shh-latn-us",shi:"shi-tfng-ma",shj:"shj-latn-sd",shk:"shk-latn-zz",shm:"shm-arab-ir",shn:"shn-mymr-mm",sho:"sho-latn-ng",shp:"shp-latn-pe",shq:"shq-latn-zm",shr:"shr-latn-cd",shs:"shs-latn-ca",sht:"sht-latn-us",shu:"shu-arab-zz",shv:"shv-arab-om",shw:"shw-latn-sd",shy:"shy-latn-dz","shy-arab":"shy-arab-dz","shy-tfng":"shy-tfng-dz",shz:"shz-latn-ml",si:"si-sinh-lk",sia:"sia-cyrl-ru",sib:"sib-latn-my",sid:"sid-latn-et",sie:"sie-latn-zm",sif:"sif-latn-bf",sig:"sig-latn-zz",sih:"sih-latn-nc",sii:"sii-latn-in",sij:"sij-latn-pg",sik:"sik-latn-br",sil:"sil-latn-zz",sim:"sim-latn-zz",sip:"sip-tibt-in",siq:"siq-latn-pg",sir:"sir-latn-ng",sis:"sis-latn-us",siu:"siu-latn-pg",siv:"siv-latn-pg",siw:"siw-latn-pg",six:"six-latn-pg",siy:"siy-arab-ir",siz:"siz-arab-eg",sja:"sja-latn-co",sjb:"sjb-latn-id",sjd:"sjd-cyrl-ru",sje:"sje-latn-se",sjg:"sjg-latn-td",sjl:"sjl-latn-in",sjm:"sjm-latn-ph",sjp:"sjp-deva-in","sjp-beng":"sjp-beng-in",sjr:"sjr-latn-zz",sjt:"sjt-cyrl-ru",sju:"sju-latn-se",sjw:"sjw-latn-us",sk:"sk-latn-sk",ska:"ska-latn-us",skb:"skb-thai-th",skc:"skc-latn-zz",skd:"skd-latn-us",ske:"ske-latn-vu",skf:"skf-latn-br",skg:"skg-latn-mg",skh:"skh-latn-id",ski:"ski-latn-id",skj:"skj-deva-np",skm:"skm-latn-pg",skn:"skn-latn-ph",sko:"sko-latn-id",skp:"skp-latn-my",skq:"skq-latn-bf",skr:"skr-arab-pk",sks:"sks-latn-zz",skt:"skt-latn-cd",sku:"sku-latn-vu",skv:"skv-latn-id",skw:"skw-latn-gy",skx:"skx-latn-id",sky:"sky-latn-sb",skz:"skz-latn-id",sl:"sl-latn-si",slc:"slc-latn-co",sld:"sld-latn-zz",slg:"slg-latn-id",slh:"slh-latn-us",sli:"sli-latn-pl",slj:"slj-latn-br",sll:"sll-latn-zz",slm:"slm-latn-ph",sln:"sln-latn-us",slp:"slp-latn-id",slq:"slq-arab-ir",slr:"slr-latn-cn",slu:"slu-latn-id",slw:"slw-latn-pg",slx:"slx-latn-cd",sly:"sly-latn-id",slz:"slz-latn-id",sm:"sm-latn-ws",sma:"sma-latn-se",smb:"smb-latn-pg",smc:"smc-latn-pg",smd:"smd-latn-ao",smf:"smf-latn-pg",smg:"smg-latn-pg",smh:"smh-yiii-cn",smj:"smj-latn-se",smk:"smk-latn-ph",sml:"sml-latn-ph",smn:"smn-latn-fi",smp:"smp-samr-il",smq:"smq-latn-zz",smr:"smr-latn-id",sms:"sms-latn-fi",smt:"smt-latn-in",smu:"smu-khmr-kh",smw:"smw-latn-id",smx:"smx-latn-cd",smy:"smy-arab-ir",smz:"smz-latn-pg",sn:"sn-latn-zw",snb:"snb-latn-my",snc:"snc-latn-zz",sne:"sne-latn-my",snf:"snf-latn-sn",sng:"sng-latn-cd","sng-brai":"sng-brai-cd",sni:"sni-latn-pe",snj:"snj-latn-cf",snk:"snk-latn-ml",snl:"snl-latn-ph",snm:"snm-latn-ug",snn:"snn-latn-co",sno:"sno-latn-us",snp:"snp-latn-zz",snq:"snq-latn-ga",snr:"snr-latn-pg",sns:"sns-latn-vu",snu:"snu-latn-id",snv:"snv-latn-my",snw:"snw-latn-gh",snx:"snx-latn-zz",sny:"sny-latn-zz",snz:"snz-latn-pg",so:"so-latn-so",soa:"soa-tavt-th","soa-thai":"soa-thai-th",sob:"sob-latn-id",soc:"soc-latn-cd",sod:"sod-latn-cd",soe:"soe-latn-cd",sog:"sog-sogd-uz",soi:"soi-deva-np",sok:"sok-latn-zz",sol:"sol-latn-pg",soo:"soo-latn-cd",sop:"sop-latn-cd",soq:"soq-latn-zz",sor:"sor-latn-td",sos:"sos-latn-bf",sou:"sou-thai-th",sov:"sov-latn-pw",sow:"sow-latn-pg",sox:"sox-latn-cm",soy:"soy-latn-zz",soz:"soz-latn-tz",spb:"spb-latn-id",spc:"spc-latn-ve",spd:"spd-latn-zz",spe:"spe-latn-pg",spg:"spg-latn-my",spi:"spi-latn-id",spk:"spk-latn-pg",spl:"spl-latn-zz",spm:"spm-latn-pg",spn:"spn-latn-py",spo:"spo-latn-us",spp:"spp-latn-ml",spq:"spq-latn-pe",spr:"spr-latn-id",sps:"sps-latn-zz",spt:"spt-tibt-in",spv:"spv-orya-in",sq:"sq-latn-al",sqa:"sqa-latn-ng",sqh:"sqh-latn-ng",sqm:"sqm-latn-cf",sqo:"sqo-arab-ir",sqq:"sqq-laoo-la",sqt:"sqt-arab-ye","sqt-latn":"sqt-latn-ye",squ:"squ-latn-ca",sr:"sr-cyrl-rs","sr-me":"sr-latn-me","sr-ro":"sr-latn-ro","sr-ru":"sr-latn-ru","sr-tr":"sr-latn-tr",sra:"sra-latn-pg",srb:"srb-sora-in",sre:"sre-latn-id",srf:"srf-latn-pg",srg:"srg-latn-ph",srh:"srh-arab-cn",sri:"sri-latn-co",srk:"srk-latn-my",srl:"srl-latn-id",srm:"srm-latn-sr",srn:"srn-latn-sr",sro:"sro-latn-it",srq:"srq-latn-bo",srr:"srr-latn-sn",srs:"srs-latn-ca",srt:"srt-latn-id",sru:"sru-latn-br",srv:"srv-latn-ph",srw:"srw-latn-id",srx:"srx-deva-in",sry:"sry-latn-pg",srz:"srz-arab-ir",ss:"ss-latn-za",ssb:"ssb-latn-ph",ssc:"ssc-latn-tz",ssd:"ssd-latn-zz",sse:"sse-latn-ph","sse-arab":"sse-arab-ph",ssf:"ssf-latn-tw",ssg:"ssg-latn-zz",ssh:"ssh-arab-ae",ssj:"ssj-latn-pg",ssl:"ssl-latn-gh",ssm:"ssm-latn-my",ssn:"ssn-latn-ke",sso:"sso-latn-pg",ssq:"ssq-latn-id",sss:"sss-laoo-la","sss-thai":"sss-thai-th",sst:"sst-latn-pg",ssu:"ssu-latn-pg",ssv:"ssv-latn-vu",ssx:"ssx-latn-pg",ssy:"ssy-latn-er",ssz:"ssz-latn-pg",st:"st-latn-za",sta:"sta-latn-zm",stb:"stb-latn-ph",ste:"ste-latn-id",stf:"stf-latn-pg",stg:"stg-latn-vn",sth:"sth-latn-ie",sti:"sti-latn-vn","sti-kh":"sti-latn-kh",stj:"stj-latn-bf",stk:"stk-latn-zz",stl:"stl-latn-nl",stm:"stm-latn-pg",stn:"stn-latn-sb",sto:"sto-latn-ca",stp:"stp-latn-mx",stq:"stq-latn-de",str:"str-latn-ca",sts:"sts-arab-af",stt:"stt-latn-vn",stv:"stv-ethi-et","stv-arab":"stv-arab-et",stw:"stw-latn-fm",sty:"sty-cyrl-ru",su:"su-latn-id",sua:"sua-latn-zz",sub:"sub-latn-cd",suc:"suc-latn-ph",sue:"sue-latn-zz",sug:"sug-latn-pg",sui:"sui-latn-pg",suj:"suj-latn-tz",suk:"suk-latn-tz",suo:"suo-latn-pg",suq:"suq-latn-et","suq-ethi":"suq-ethi-et",sur:"sur-latn-zz",sus:"sus-latn-gn",sut:"sut-latn-ni",suv:"suv-latn-in","suv-beng":"suv-beng-in","suv-deva":"suv-deva-in",suw:"suw-latn-tz",suy:"suy-latn-br",suz:"suz-deva-np",sv:"sv-latn-se",sva:"sva-geor-ge","sva-cyrl":"sva-cyrl-ge","sva-latn":"sva-latn-ge",svb:"svb-latn-pg",svc:"svc-latn-vc",sve:"sve-latn-id",svm:"svm-latn-it",svs:"svs-latn-sb",sw:"sw-latn-tz",swb:"swb-arab-yt",swc:"swc-latn-cd",swf:"swf-latn-cd",swg:"swg-latn-de",swi:"swi-hani-cn",swj:"swj-latn-ga",swk:"swk-latn-mw",swm:"swm-latn-pg",swo:"swo-latn-br",swp:"swp-latn-zz",swq:"swq-latn-cm",swr:"swr-latn-id",sws:"sws-latn-id",swt:"swt-latn-id",swu:"swu-latn-id",swv:"swv-deva-in",sww:"sww-latn-vu",swx:"swx-latn-br",swy:"swy-latn-td",sxb:"sxb-latn-ke",sxe:"sxe-latn-ga",sxn:"sxn-latn-id",sxr:"sxr-latn-tw",sxs:"sxs-latn-ng",sxu:"sxu-latn-de","sxu-runr":"sxu-runr-de",sxw:"sxw-latn-zz",sya:"sya-latn-id",syb:"syb-latn-ph",syc:"syc-syrc-tr",syi:"syi-latn-ga",syk:"syk-latn-ng",syl:"syl-beng-bd",sym:"sym-latn-bf",syn:"syn-syrc-ir",syo:"syo-latn-kh",syr:"syr-syrc-iq",sys:"sys-latn-td",syw:"syw-deva-np",syx:"syx-latn-ga",sza:"sza-latn-my",szb:"szb-latn-id",szc:"szc-latn-my",szd:"szd-latn-my",szg:"szg-latn-cd",szl:"szl-latn-pl",szn:"szn-latn-id",szp:"szp-latn-id",szv:"szv-latn-cm",szw:"szw-latn-id",szy:"szy-latn-tw",ta:"ta-taml-in",taa:"taa-latn-us",tab:"tab-cyrl-ru",tac:"tac-latn-mx",tad:"tad-latn-id",tae:"tae-latn-br",taf:"taf-latn-br",tag:"tag-latn-sd",taj:"taj-deva-np",tak:"tak-latn-ng",tal:"tal-latn-zz",tan:"tan-latn-zz",tao:"tao-latn-tw",tap:"tap-latn-cd",taq:"taq-latn-zz",tar:"tar-latn-mx",tas:"tas-latn-vn",tau:"tau-latn-us",tav:"tav-latn-co",taw:"taw-latn-pg",tax:"tax-latn-td",tay:"tay-latn-tw","tay-hans":"tay-hans-tw","tay-hant":"tay-hant-tw",taz:"taz-latn-sd",tba:"tba-latn-br",tbc:"tbc-latn-zz",tbd:"tbd-latn-zz",tbe:"tbe-latn-sb",tbf:"tbf-latn-zz",tbg:"tbg-latn-zz",tbh:"tbh-latn-au",tbi:"tbi-latn-sd",tbj:"tbj-latn-pg",tbk:"tbk-tagb-ph","tbk-hano":"tbk-hano-ph","tbk-latn":"tbk-latn-ph",tbl:"tbl-latn-ph",tbm:"tbm-latn-cd",tbn:"tbn-latn-co",tbo:"tbo-latn-zz",tbp:"tbp-latn-id",tbs:"tbs-latn-pg",tbt:"tbt-latn-cd",tbu:"tbu-latn-mx",tbv:"tbv-latn-pg",tbw:"tbw-latn-ph",tbx:"tbx-latn-pg",tby:"tby-latn-id",tbz:"tbz-latn-zz",tca:"tca-latn-br",tcb:"tcb-latn-us",tcc:"tcc-latn-tz",tcd:"tcd-latn-gh",tce:"tce-latn-ca",tcf:"tcf-latn-mx",tcg:"tcg-latn-id",tch:"tch-latn-tc",tci:"tci-latn-zz",tck:"tck-latn-ga",tcm:"tcm-latn-id",tcn:"tcn-tibt-np",tco:"tco-mymr-mm",tcp:"tcp-latn-mm",tcq:"tcq-latn-id",tcs:"tcs-latn-au",tcu:"tcu-latn-mx",tcw:"tcw-latn-mx",tcx:"tcx-taml-in",tcy:"tcy-knda-in",tcz:"tcz-latn-in",tda:"tda-tfng-ne","tda-arab":"tda-arab-ne","tda-latn":"tda-latn-ne",tdb:"tdb-deva-in","tdb-beng":"tdb-beng-in","tdb-kthi":"tdb-kthi-in",tdc:"tdc-latn-co",tdd:"tdd-tale-cn",tde:"tde-latn-ml",tdg:"tdg-deva-np",tdh:"tdh-deva-np",tdi:"tdi-latn-id",tdj:"tdj-latn-id",tdk:"tdk-latn-ng",tdl:"tdl-latn-ng",tdm:"tdm-latn-gy",tdn:"tdn-latn-id",tdo:"tdo-latn-ng",tdq:"tdq-latn-ng",tdr:"tdr-latn-vn",tds:"tds-latn-id",tdt:"tdt-latn-tl",tdu:"tdu-latn-my",tdv:"tdv-latn-ng",tdx:"tdx-latn-mg",tdy:"tdy-latn-ph",te:"te-telu-in",tea:"tea-latn-my",teb:"teb-latn-ec",tec:"tec-latn-ke",ted:"ted-latn-zz",tee:"tee-latn-mx",teg:"teg-latn-ga",teh:"teh-latn-ar",tei:"tei-latn-pg",tek:"tek-latn-cd",tem:"tem-latn-sl",ten:"ten-latn-co",teo:"teo-latn-ug",tep:"tep-latn-mx",teq:"teq-latn-sd",ter:"ter-latn-br",tes:"tes-java-id",tet:"tet-latn-tl",teu:"teu-latn-ug",tev:"tev-latn-id",tew:"tew-latn-us",tex:"tex-latn-ss",tey:"tey-latn-sd",tfi:"tfi-latn-zz",tfn:"tfn-latn-us",tfo:"tfo-latn-id",tfr:"tfr-latn-pa",tft:"tft-latn-id",tg:"tg-cyrl-tj","tg-arab":"tg-arab-pk","tg-pk":"tg-arab-pk",tga:"tga-latn-ke",tgb:"tgb-latn-my",tgc:"tgc-latn-zz",tgd:"tgd-latn-ng",tge:"tge-deva-np",tgf:"tgf-tibt-bt",tgh:"tgh-latn-tt",tgi:"tgi-latn-pg",tgj:"tgj-latn-in",tgn:"tgn-latn-ph",tgo:"tgo-latn-zz",tgp:"tgp-latn-vu",tgq:"tgq-latn-my",tgs:"tgs-latn-vu",tgt:"tgt-latn-ph","tgt-hano":"tgt-hano-ph","tgt-tagb":"tgt-tagb-ph",tgu:"tgu-latn-zz",tgv:"tgv-latn-br",tgw:"tgw-latn-ci",tgx:"tgx-latn-ca",tgy:"tgy-latn-ss",tgz:"tgz-latn-au",th:"th-thai-th",thd:"thd-latn-au",the:"the-deva-np",thf:"thf-deva-np",thh:"thh-latn-mx",thi:"thi-tale-la",thk:"thk-latn-ke",thl:"thl-deva-np",thm:"thm-thai-th",thp:"thp-latn-ca","thp-dupl":"thp-dupl-ca",thq:"thq-deva-np",thr:"thr-deva-np",ths:"ths-deva-np",tht:"tht-latn-ca",thu:"thu-latn-ss",thv:"thv-latn-dz","thv-arab":"thv-arab-dz","thv-tfng":"thv-tfng-dz",thy:"thy-latn-ng",thz:"thz-latn-ne","thz-tfng":"thz-tfng-ne",ti:"ti-ethi-et",tic:"tic-latn-sd",tif:"tif-latn-zz",tig:"tig-ethi-er",tih:"tih-latn-my",tii:"tii-latn-cd",tij:"tij-deva-np",tik:"tik-latn-zz",til:"til-latn-us",tim:"tim-latn-zz",tin:"tin-cyrl-ru",tio:"tio-latn-zz",tip:"tip-latn-id",tiq:"tiq-latn-bf",tis:"tis-latn-ph",tit:"tit-latn-co",tiu:"tiu-latn-ph",tiv:"tiv-latn-ng",tiw:"tiw-latn-au",tix:"tix-latn-us",tiy:"tiy-latn-ph",tja:"tja-latn-lr",tjg:"tjg-latn-id",tji:"tji-latn-cn",tjj:"tjj-latn-au",tjl:"tjl-mymr-mm",tjn:"tjn-latn-ci",tjo:"tjo-arab-dz",tjp:"tjp-latn-au",tjs:"tjs-latn-cn",tju:"tju-latn-au",tjw:"tjw-latn-au",tk:"tk-latn-tm",tka:"tka-latn-br",tkb:"tkb-deva-in",tkd:"tkd-latn-tl",tke:"tke-latn-mz",tkf:"tkf-latn-br",tkg:"tkg-latn-mg",tkl:"tkl-latn-tk",tkp:"tkp-latn-sb",tkq:"tkq-latn-ng",tkr:"tkr-latn-az",tks:"tks-arab-ir",tkt:"tkt-deva-np",tku:"tku-latn-mx",tkv:"tkv-latn-pg",tkw:"tkw-latn-sb",tkx:"tkx-latn-id",tkz:"tkz-latn-vn",tl:"tl-latn-ph",tla:"tla-latn-mx",tlb:"tlb-latn-id",tlc:"tlc-latn-mx",tld:"tld-latn-id",tlf:"tlf-latn-zz",tlg:"tlg-latn-id",tli:"tli-latn-us","tli-cyrl":"tli-cyrl-us",tlj:"tlj-latn-ug",tlk:"tlk-latn-id",tll:"tll-latn-cd",tlm:"tlm-latn-vu",tln:"tln-latn-id",tlp:"tlp-latn-mx",tlq:"tlq-latn-mm",tlr:"tlr-latn-sb",tls:"tls-latn-vu",tlt:"tlt-latn-id",tlu:"tlu-latn-id",tlv:"tlv-latn-id",tlx:"tlx-latn-zz",tly:"tly-latn-az",tma:"tma-latn-td",tmb:"tmb-latn-vu",tmc:"tmc-latn-td",tmd:"tmd-latn-pg",tme:"tme-latn-br",tmf:"tmf-latn-py",tmg:"tmg-latn-id",tmh:"tmh-latn-ne",tmi:"tmi-latn-vu",tmj:"tmj-latn-id",tmk:"tmk-deva-np",tml:"tml-latn-id",tmm:"tmm-latn-vn",tmn:"tmn-latn-id",tmo:"tmo-latn-my",tmq:"tmq-latn-pg",tmr:"tmr-syrc-il",tmt:"tmt-latn-vu",tmu:"tmu-latn-id",tmv:"tmv-latn-cd",tmw:"tmw-latn-my",tmy:"tmy-latn-zz",tmz:"tmz-latn-ve",tn:"tn-latn-za",tna:"tna-latn-bo",tnb:"tnb-latn-co",tnc:"tnc-latn-co",tnd:"tnd-latn-co",tng:"tng-latn-td",tnh:"tnh-latn-zz",tni:"tni-latn-id",tnk:"tnk-latn-vu",tnl:"tnl-latn-vu",tnm:"tnm-latn-id",tnn:"tnn-latn-vu",tno:"tno-latn-bo",tnp:"tnp-latn-vu",tnq:"tnq-latn-pr",tnr:"tnr-latn-sn",tns:"tns-latn-pg",tnt:"tnt-latn-id",tnv:"tnv-cakm-bd",tnw:"tnw-latn-id",tnx:"tnx-latn-sb",tny:"tny-latn-tz",to:"to-latn-to",tob:"tob-latn-ar",toc:"toc-latn-mx",tod:"tod-latn-gn",tof:"tof-latn-zz",tog:"tog-latn-mw",toh:"toh-latn-mz",toi:"toi-latn-zm",toj:"toj-latn-mx",tok:"tok-latn-001",tol:"tol-latn-us",tom:"tom-latn-id",too:"too-latn-mx",top:"top-latn-mx",toq:"toq-latn-zz",tor:"tor-latn-cd",tos:"tos-latn-mx",tou:"tou-latn-vn",tov:"tov-arab-ir",tow:"tow-latn-us",tox:"tox-latn-pw",toy:"toy-latn-id",toz:"toz-latn-cm",tpa:"tpa-latn-pg",tpc:"tpc-latn-mx",tpe:"tpe-latn-bd","tpe-beng":"tpe-beng-bd",tpf:"tpf-latn-id",tpg:"tpg-latn-id",tpi:"tpi-latn-pg",tpj:"tpj-latn-py",tpk:"tpk-latn-br",tpl:"tpl-latn-mx",tpm:"tpm-latn-zz",tpn:"tpn-latn-br",tpp:"tpp-latn-mx",tpr:"tpr-latn-br",tpt:"tpt-latn-mx",tpu:"tpu-khmr-kh",tpv:"tpv-latn-mp",tpx:"tpx-latn-mx",tpy:"tpy-latn-br",tpz:"tpz-latn-zz",tqb:"tqb-latn-br",tql:"tql-latn-vu",tqm:"tqm-latn-pg",tqn:"tqn-latn-us",tqo:"tqo-latn-zz",tqp:"tqp-latn-pg",tqt:"tqt-latn-mx",tqu:"tqu-latn-sb",tqw:"tqw-latn-us",tr:"tr-latn-tr",tra:"tra-arab-af",trb:"trb-latn-pg",trc:"trc-latn-mx",tre:"tre-latn-id",trf:"trf-latn-tt",trg:"trg-hebr-il",trh:"trh-latn-pg",tri:"tri-latn-sr",trj:"trj-latn-td",trl:"trl-latn-gb",trm:"trm-arab-af",trn:"trn-latn-bo",tro:"tro-latn-in",trp:"trp-latn-in","trp-beng":"trp-beng-in",trq:"trq-latn-mx",trr:"trr-latn-pe",trs:"trs-latn-mx",trt:"trt-latn-id",tru:"tru-latn-tr",trv:"trv-latn-tw",trw:"trw-arab-pk",trx:"trx-latn-my",try:"try-latn-in",trz:"trz-latn-br",ts:"ts-latn-za",tsa:"tsa-latn-cg",tsb:"tsb-latn-et",tsc:"tsc-latn-mz",tsd:"tsd-grek-gr",tsf:"tsf-deva-np",tsg:"tsg-latn-ph",tsh:"tsh-latn-cm",tsi:"tsi-latn-ca",tsj:"tsj-tibt-bt",tsl:"tsl-latn-vn",tsp:"tsp-latn-bf",tsr:"tsr-latn-vu",tst:"tst-latn-ml",tsu:"tsu-latn-tw",tsv:"tsv-latn-ga",tsw:"tsw-latn-zz",tsx:"tsx-latn-pg",tsz:"tsz-latn-mx",tt:"tt-cyrl-ru",ttb:"ttb-latn-ng",ttc:"ttc-latn-gt",ttd:"ttd-latn-zz",tte:"tte-latn-zz",ttf:"ttf-latn-cm",tth:"tth-laoo-la",tti:"tti-latn-id",ttj:"ttj-latn-ug",ttk:"ttk-latn-co",ttl:"ttl-latn-zm",ttm:"ttm-latn-ca",ttn:"ttn-latn-id",tto:"tto-laoo-la",ttp:"ttp-latn-id",ttr:"ttr-latn-zz",tts:"tts-thai-th",ttt:"ttt-latn-az",ttu:"ttu-latn-pg",ttv:"ttv-latn-pg",ttw:"ttw-latn-my",tty:"tty-latn-id",tua:"tua-latn-pg",tub:"tub-latn-us",tuc:"tuc-latn-pg",tud:"tud-latn-br",tue:"tue-latn-co",tuf:"tuf-latn-co",tug:"tug-latn-td",tuh:"tuh-latn-zz",tui:"tui-latn-cm",tuj:"tuj-latn-id",tul:"tul-latn-zz",tum:"tum-latn-mw",tun:"tun-latn-us",tuo:"tuo-latn-br",tuq:"tuq-latn-zz",tus:"tus-latn-ca",tuu:"tuu-latn-us",tuv:"tuv-latn-ke",tux:"tux-latn-br",tuy:"tuy-latn-ke",tuz:"tuz-latn-bf",tva:"tva-latn-sb",tvd:"tvd-latn-zz",tve:"tve-latn-id",tvk:"tvk-latn-vu",tvl:"tvl-latn-tv",tvm:"tvm-latn-id",tvn:"tvn-mymr-mm",tvo:"tvo-latn-id",tvs:"tvs-latn-ke",tvt:"tvt-latn-in",tvu:"tvu-latn-zz",tvw:"tvw-latn-id",tvx:"tvx-latn-tw",twa:"twa-latn-us",twb:"twb-latn-ph",twd:"twd-latn-nl",twe:"twe-latn-id",twf:"twf-latn-us",twg:"twg-latn-id",twh:"twh-latn-zz",twl:"twl-latn-mz",twm:"twm-deva-in",twn:"twn-latn-cm",two:"two-latn-bw",twp:"twp-latn-pg",twq:"twq-latn-ne",twr:"twr-latn-mx",twt:"twt-latn-br",twu:"twu-latn-id",tww:"tww-latn-pg",twx:"twx-latn-mz",twy:"twy-latn-id",txa:"txa-latn-my",txe:"txe-latn-id",txg:"txg-tang-cn",txi:"txi-latn-br",txj:"txj-latn-ng",txm:"txm-latn-id",txn:"txn-latn-id",txo:"txo-toto-in",txq:"txq-latn-id",txs:"txs-latn-id",txt:"txt-latn-id",txu:"txu-latn-br",txx:"txx-latn-my",txy:"txy-latn-mg",ty:"ty-latn-pf",tya:"tya-latn-zz",tye:"tye-latn-ng",tyh:"tyh-latn-vn",tyi:"tyi-latn-cg",tyj:"tyj-latn-vn",tyl:"tyl-latn-vn",tyn:"tyn-latn-id",typ:"typ-latn-au",tyr:"tyr-tavt-vn",tys:"tys-latn-vn",tyt:"tyt-latn-vn","tyt-tavt":"tyt-tavt-vn",tyu:"tyu-latn-bw",tyv:"tyv-cyrl-ru",tyx:"tyx-latn-cg",tyy:"tyy-latn-ng",tyz:"tyz-latn-vn",tzh:"tzh-latn-mx",tzj:"tzj-latn-gt",tzl:"tzl-latn-001",tzm:"tzm-latn-ma",tzn:"tzn-latn-id",tzo:"tzo-latn-mx",tzx:"tzx-latn-pg",uam:"uam-latn-br",uar:"uar-latn-pg",uba:"uba-latn-ng",ubi:"ubi-latn-td",ubl:"ubl-latn-ph",ubr:"ubr-latn-pg",ubu:"ubu-latn-zz",uda:"uda-latn-ng",ude:"ude-cyrl-ru",udg:"udg-mlym-in",udi:"udi-aghb-ru",udj:"udj-latn-id",udl:"udl-latn-cm",udm:"udm-cyrl-ru",udu:"udu-latn-sd",ues:"ues-latn-id",ufi:"ufi-latn-pg",ug:"ug-arab-cn","ug-cyrl":"ug-cyrl-kz","ug-kz":"ug-cyrl-kz","ug-mn":"ug-cyrl-mn",uga:"uga-ugar-sy",ugb:"ugb-latn-au",uge:"uge-latn-sb",ugh:"ugh-cyrl-ru",ugo:"ugo-thai-th",uha:"uha-latn-ng",uhn:"uhn-latn-id",uis:"uis-latn-pg",uiv:"uiv-latn-cm",uji:"uji-latn-ng",uk:"uk-cyrl-ua",uka:"uka-latn-id",ukg:"ukg-latn-pg",ukh:"ukh-latn-cf",uki:"uki-orya-in",ukk:"ukk-latn-mm",ukp:"ukp-latn-ng",ukq:"ukq-latn-ng",uku:"uku-latn-ng",ukv:"ukv-latn-ss",ukw:"ukw-latn-ng",uky:"uky-latn-au",ula:"ula-latn-ng",ulb:"ulb-latn-ng",ulc:"ulc-cyrl-ru",ule:"ule-latn-ar",ulf:"ulf-latn-id",uli:"uli-latn-fm",ulk:"ulk-latn-au",ulm:"ulm-latn-id",uln:"uln-latn-pg",ulu:"ulu-latn-id",ulw:"ulw-latn-ni",uma:"uma-latn-us",umb:"umb-latn-ao",umd:"umd-latn-au",umg:"umg-latn-au",umi:"umi-latn-my",umm:"umm-latn-ng",umn:"umn-latn-mm",umo:"umo-latn-br",ump:"ump-latn-au",umr:"umr-latn-au",ums:"ums-latn-id",una:"una-latn-pg",und:"en-latn-us","und-002":"en-latn-ng","und-003":"en-latn-us","und-005":"pt-latn-br","und-009":"en-latn-au","und-011":"en-latn-ng","und-013":"es-latn-mx","und-014":"sw-latn-tz","und-015":"ar-arab-eg","und-017":"sw-latn-cd","und-018":"en-latn-za","und-019":"en-latn-us","und-021":"en-latn-us","und-029":"es-latn-cu","und-030":"zh-hans-cn","und-034":"hi-deva-in","und-035":"id-latn-id","und-039":"it-latn-it","und-053":"en-latn-au","und-054":"en-latn-pg","und-057":"en-latn-gu","und-061":"sm-latn-ws","und-142":"zh-hans-cn","und-143":"uz-latn-uz","und-145":"ar-arab-sa","und-150":"ru-cyrl-ru","und-151":"ru-cyrl-ru","und-154":"en-latn-gb","und-155":"de-latn-de","und-202":"en-latn-ng","und-419":"es-latn-419","und-ad":"ca-latn-ad","und-adlm":"ff-adlm-gn","und-ae":"ar-arab-ae","und-af":"fa-arab-af","und-aghb":"udi-aghb-ru","und-ahom":"aho-ahom-in","und-al":"sq-latn-al","und-am":"hy-armn-am","und-ao":"pt-latn-ao","und-aq":"und-latn-aq","und-ar":"es-latn-ar","und-arab":"ar-arab-eg","und-arab-cc":"ms-arab-cc","und-arab-cn":"ug-arab-cn","und-arab-gb":"ur-arab-gb","und-arab-id":"ms-arab-id","und-arab-in":"ur-arab-in","und-arab-kh":"cja-arab-kh","und-arab-mm":"rhg-arab-mm","und-arab-mn":"kk-arab-mn","und-arab-mu":"ur-arab-mu","und-arab-ng":"ha-arab-ng","und-arab-pk":"ur-arab-pk","und-arab-tg":"apd-arab-tg","und-arab-th":"mfa-arab-th","und-arab-tj":"fa-arab-tj","und-arab-tr":"apc-arab-tr","und-arab-yt":"swb-arab-yt","und-armi":"arc-armi-ir","und-armn":"hy-armn-am","und-as":"sm-latn-as","und-at":"de-latn-at","und-avst":"ae-avst-ir","und-aw":"nl-latn-aw","und-ax":"sv-latn-ax","und-az":"az-latn-az","und-ba":"bs-latn-ba","und-bali":"ban-bali-id","und-bamu":"bax-bamu-cm","und-bass":"bsq-bass-lr","und-batk":"bbc-batk-id","und-bd":"bn-beng-bd","und-be":"nl-latn-be","und-beng":"bn-beng-bd","und-bf":"fr-latn-bf","und-bg":"bg-cyrl-bg","und-bh":"ar-arab-bh","und-bhks":"sa-bhks-in","und-bi":"rn-latn-bi","und-bj":"fr-latn-bj","und-bl":"fr-latn-bl","und-bn":"ms-latn-bn","und-bo":"es-latn-bo","und-bopo":"zh-bopo-tw","und-bq":"pap-latn-bq","und-br":"pt-latn-br","und-brah":"pka-brah-in","und-brai":"fr-brai-fr","und-bt":"dz-tibt-bt","und-bugi":"bug-bugi-id","und-buhd":"bku-buhd-ph","und-bv":"und-latn-bv","und-by":"be-cyrl-by","und-cakm":"ccp-cakm-bd","und-cans":"iu-cans-ca","und-cari":"xcr-cari-tr","und-cd":"sw-latn-cd","und-cf":"fr-latn-cf","und-cg":"fr-latn-cg","und-ch":"de-latn-ch","und-cham":"cjm-cham-vn","und-cher":"chr-cher-us","und-chrs":"xco-chrs-uz","und-ci":"fr-latn-ci","und-cl":"es-latn-cl","und-cm":"fr-latn-cm","und-cn":"zh-hans-cn","und-co":"es-latn-co","und-copt":"cop-copt-eg","und-cp":"und-latn-cp","und-cpmn":"und-cpmn-cy","und-cpmn-cy":"und-cpmn-cy","und-cprt":"grc-cprt-cy","und-cr":"es-latn-cr","und-cu":"es-latn-cu","und-cv":"pt-latn-cv","und-cw":"pap-latn-cw","und-cy":"el-grek-cy","und-cyrl":"ru-cyrl-ru","und-cyrl-al":"mk-cyrl-al","und-cyrl-ba":"sr-cyrl-ba","und-cyrl-ge":"ab-cyrl-ge","und-cyrl-gr":"mk-cyrl-gr","und-cyrl-md":"uk-cyrl-md","und-cyrl-ro":"bg-cyrl-ro","und-cyrl-sk":"uk-cyrl-sk","und-cyrl-tr":"kbd-cyrl-tr","und-cyrl-xk":"sr-cyrl-xk","und-cz":"cs-latn-cz","und-de":"de-latn-de","und-deva":"hi-deva-in","und-deva-bt":"ne-deva-bt","und-deva-fj":"hif-deva-fj","und-deva-mu":"bho-deva-mu","und-deva-pk":"btv-deva-pk","und-diak":"dv-diak-mv","und-dj":"aa-latn-dj","und-dk":"da-latn-dk","und-do":"es-latn-do","und-dogr":"doi-dogr-in","und-dupl":"fr-dupl-fr","und-dz":"ar-arab-dz","und-ea":"es-latn-ea","und-ec":"es-latn-ec","und-ee":"et-latn-ee","und-eg":"ar-arab-eg","und-egyp":"egy-egyp-eg","und-eh":"ar-arab-eh","und-elba":"sq-elba-al","und-elym":"arc-elym-ir","und-er":"ti-ethi-er","und-es":"es-latn-es","und-et":"am-ethi-et","und-ethi":"am-ethi-et","und-eu":"en-latn-ie","und-ez":"de-latn-ez","und-fi":"fi-latn-fi","und-fo":"fo-latn-fo","und-fr":"fr-latn-fr","und-ga":"fr-latn-ga","und-ge":"ka-geor-ge","und-geor":"ka-geor-ge","und-gf":"fr-latn-gf","und-gh":"ak-latn-gh","und-gl":"kl-latn-gl","und-glag":"cu-glag-bg","und-gn":"fr-latn-gn","und-gong":"wsg-gong-in","und-gonm":"esg-gonm-in","und-goth":"got-goth-ua","und-gp":"fr-latn-gp","und-gq":"es-latn-gq","und-gr":"el-grek-gr","und-gran":"sa-gran-in","und-grek":"el-grek-gr","und-grek-tr":"bgx-grek-tr","und-gs":"und-latn-gs","und-gt":"es-latn-gt","und-gujr":"gu-gujr-in","und-guru":"pa-guru-in","und-gw":"pt-latn-gw","und-hanb":"zh-hanb-tw","und-hang":"ko-hang-kr","und-hani":"zh-hani-cn","und-hano":"hnn-hano-ph","und-hans":"zh-hans-cn","und-hant":"zh-hant-tw","und-hant-ca":"yue-hant-ca","und-hebr":"he-hebr-il","und-hebr-se":"yi-hebr-se","und-hebr-ua":"yi-hebr-ua","und-hebr-us":"yi-hebr-us","und-hira":"ja-hira-jp","und-hk":"zh-hant-hk","und-hluw":"hlu-hluw-tr","und-hm":"und-latn-hm","und-hmng":"hnj-hmng-la","und-hmnp":"hnj-hmnp-us","und-hn":"es-latn-hn","und-hr":"hr-latn-hr","und-ht":"ht-latn-ht","und-hu":"hu-latn-hu","und-hung":"hu-hung-hu","und-ic":"es-latn-ic","und-id":"id-latn-id","und-il":"he-hebr-il","und-in":"hi-deva-in","und-iq":"ar-arab-iq","und-ir":"fa-arab-ir","und-is":"is-latn-is","und-it":"it-latn-it","und-ital":"ett-ital-it","und-jamo":"ko-jamo-kr","und-java":"jv-java-id","und-jo":"ar-arab-jo","und-jp":"ja-jpan-jp","und-jpan":"ja-jpan-jp","und-kali":"eky-kali-mm","und-kana":"ja-kana-jp","und-kawi":"kaw-kawi-id","und-ke":"sw-latn-ke","und-kg":"ky-cyrl-kg","und-kh":"km-khmr-kh","und-khar":"pra-khar-pk","und-khmr":"km-khmr-kh","und-khoj":"sd-khoj-in","und-kits":"zkt-kits-cn","und-km":"ar-arab-km","und-knda":"kn-knda-in","und-kore":"ko-kore-kr","und-kp":"ko-kore-kp","und-kr":"ko-kore-kr","und-kthi":"bho-kthi-in","und-kw":"ar-arab-kw","und-kz":"ru-cyrl-kz","und-la":"lo-laoo-la","und-lana":"nod-lana-th","und-laoo":"lo-laoo-la","und-laoo-au":"hnj-laoo-au","und-laoo-cn":"hnj-laoo-cn","und-laoo-fr":"hnj-laoo-fr","und-laoo-gf":"hnj-laoo-gf","und-laoo-mm":"hnj-laoo-mm","und-laoo-sr":"hnj-laoo-sr","und-laoo-th":"hnj-laoo-th","und-laoo-us":"hnj-laoo-us","und-laoo-vn":"hnj-laoo-vn","und-latn-af":"tk-latn-af","und-latn-am":"ku-latn-am","und-latn-cn":"za-latn-cn","und-latn-cy":"tr-latn-cy","und-latn-dz":"fr-latn-dz","und-latn-et":"en-latn-et","und-latn-ge":"ku-latn-ge","und-latn-ir":"tk-latn-ir","und-latn-km":"fr-latn-km","und-latn-ma":"fr-latn-ma","und-latn-mk":"sq-latn-mk","und-latn-mm":"kac-latn-mm","und-latn-mo":"pt-latn-mo","und-latn-mr":"fr-latn-mr","und-latn-ru":"krl-latn-ru","und-latn-sy":"fr-latn-sy","und-latn-tn":"fr-latn-tn","und-latn-tw":"trv-latn-tw","und-latn-ua":"pl-latn-ua","und-lb":"ar-arab-lb","und-lepc":"lep-lepc-in","und-li":"de-latn-li","und-limb":"lif-limb-in","und-lina":"lab-lina-gr","und-linb":"grc-linb-gr","und-lisu":"lis-lisu-cn","und-lk":"si-sinh-lk","und-ls":"st-latn-ls","und-lt":"lt-latn-lt","und-lu":"fr-latn-lu","und-lv":"lv-latn-lv","und-ly":"ar-arab-ly","und-lyci":"xlc-lyci-tr","und-lydi":"xld-lydi-tr","und-ma":"ar-arab-ma","und-mahj":"hi-mahj-in","und-maka":"mak-maka-id","und-mand":"myz-mand-ir","und-mani":"xmn-mani-cn","und-marc":"bo-marc-cn","und-mc":"fr-latn-mc","und-md":"ro-latn-md","und-me":"sr-latn-me","und-medf":"dmf-medf-ng","und-mend":"men-mend-sl","und-merc":"xmr-merc-sd","und-mero":"xmr-mero-sd","und-mf":"fr-latn-mf","und-mg":"mg-latn-mg","und-mk":"mk-cyrl-mk","und-ml":"bm-latn-ml","und-mlym":"ml-mlym-in","und-mm":"my-mymr-mm","und-mn":"mn-cyrl-mn","und-mo":"zh-hant-mo","und-modi":"mr-modi-in","und-mong":"mn-mong-cn","und-mq":"fr-latn-mq","und-mr":"ar-arab-mr","und-mroo":"mro-mroo-bd","und-mt":"mt-latn-mt","und-mtei":"mni-mtei-in","und-mu":"mfe-latn-mu","und-mult":"skr-mult-pk","und-mv":"dv-thaa-mv","und-mx":"es-latn-mx","und-my":"ms-latn-my","und-mymr":"my-mymr-mm","und-mymr-in":"kht-mymr-in","und-mymr-th":"mnw-mymr-th","und-mz":"pt-latn-mz","und-na":"af-latn-na","und-nagm":"unr-nagm-in","und-nand":"sa-nand-in","und-narb":"xna-narb-sa","und-nbat":"arc-nbat-jo","und-nc":"fr-latn-nc","und-ne":"ha-latn-ne","und-newa":"new-newa-np","und-ni":"es-latn-ni","und-nkoo":"man-nkoo-gn","und-nl":"nl-latn-nl","und-no":"nb-latn-no","und-np":"ne-deva-np","und-nshu":"zhx-nshu-cn","und-ogam":"sga-ogam-ie","und-olck":"sat-olck-in","und-om":"ar-arab-om","und-orkh":"otk-orkh-mn","und-orya":"or-orya-in","und-osge":"osa-osge-us","und-osma":"so-osma-so","und-ougr":"oui-ougr-143","und-pa":"es-latn-pa","und-palm":"arc-palm-sy","und-pauc":"ctd-pauc-mm","und-pe":"es-latn-pe","und-perm":"kv-perm-ru","und-pf":"fr-latn-pf","und-pg":"tpi-latn-pg","und-ph":"fil-latn-ph","und-phag":"lzh-phag-cn","und-phli":"pal-phli-ir","und-phlp":"pal-phlp-cn","und-phnx":"phn-phnx-lb","und-pk":"ur-arab-pk","und-pl":"pl-latn-pl","und-plrd":"hmd-plrd-cn","und-pm":"fr-latn-pm","und-pr":"es-latn-pr","und-prti":"xpr-prti-ir","und-ps":"ar-arab-ps","und-pt":"pt-latn-pt","und-pw":"pau-latn-pw","und-py":"gn-latn-py","und-qa":"ar-arab-qa","und-qo":"en-latn-dg","und-re":"fr-latn-re","und-rjng":"rej-rjng-id","und-ro":"ro-latn-ro","und-rohg":"rhg-rohg-mm","und-rs":"sr-cyrl-rs","und-ru":"ru-cyrl-ru","und-runr":"non-runr-se","und-rw":"rw-latn-rw","und-sa":"ar-arab-sa","und-samr":"smp-samr-il","und-sarb":"xsa-sarb-ye","und-saur":"saz-saur-in","und-sc":"fr-latn-sc","und-sd":"ar-arab-sd","und-se":"sv-latn-se","und-sgnw":"ase-sgnw-us","und-shaw":"en-shaw-gb","und-shrd":"sa-shrd-in","und-si":"sl-latn-si","und-sidd":"sa-sidd-in","und-sind":"sd-sind-in","und-sinh":"si-sinh-lk","und-sj":"nb-latn-sj","und-sk":"sk-latn-sk","und-sm":"it-latn-sm","und-sn":"fr-latn-sn","und-so":"so-latn-so","und-sogd":"sog-sogd-uz","und-sogo":"sog-sogo-uz","und-sora":"srb-sora-in","und-soyo":"cmg-soyo-mn","und-sr":"nl-latn-sr","und-st":"pt-latn-st","und-sund":"su-sund-id","und-sv":"es-latn-sv","und-sy":"ar-arab-sy","und-sylo":"syl-sylo-bd","und-syrc":"syr-syrc-iq","und-tagb":"tbw-tagb-ph","und-takr":"doi-takr-in","und-tale":"tdd-tale-cn","und-talu":"khb-talu-cn","und-taml":"ta-taml-in","und-tang":"txg-tang-cn","und-tavt":"blt-tavt-vn","und-td":"fr-latn-td","und-telu":"te-telu-in","und-tf":"fr-latn-tf","und-tfng":"zgh-tfng-ma","und-tg":"fr-latn-tg","und-tglg":"fil-tglg-ph","und-th":"th-thai-th","und-thaa":"dv-thaa-mv","und-thai":"th-thai-th","und-thai-cn":"lcp-thai-cn","und-thai-kh":"kdt-thai-kh","und-thai-la":"kdt-thai-la","und-tibt":"bo-tibt-cn","und-tirh":"mai-tirh-in","und-tj":"tg-cyrl-tj","und-tk":"tkl-latn-tk","und-tl":"pt-latn-tl","und-tm":"tk-latn-tm","und-tn":"ar-arab-tn","und-tnsa":"nst-tnsa-in","und-to":"to-latn-to","und-toto":"txo-toto-in","und-tr":"tr-latn-tr","und-tv":"tvl-latn-tv","und-tw":"zh-hant-tw","und-tz":"sw-latn-tz","und-ua":"uk-cyrl-ua","und-ug":"sw-latn-ug","und-ugar":"uga-ugar-sy","und-uy":"es-latn-uy","und-uz":"uz-latn-uz","und-va":"it-latn-va","und-vaii":"vai-vaii-lr","und-ve":"es-latn-ve","und-vith":"sq-vith-al","und-vn":"vi-latn-vn","und-vu":"bi-latn-vu","und-wara":"hoc-wara-in","und-wcho":"nnp-wcho-in","und-wf":"fr-latn-wf","und-ws":"sm-latn-ws","und-xk":"sq-latn-xk","und-xpeo":"peo-xpeo-ir","und-xsux":"akk-xsux-iq","und-ye":"ar-arab-ye","und-yezi":"ku-yezi-ge","und-yiii":"ii-yiii-cn","und-yt":"fr-latn-yt","und-zanb":"cmg-zanb-mn","und-zw":"sn-latn-zw",une:"une-latn-ng",ung:"ung-latn-au",uni:"uni-latn-pg",unk:"unk-latn-br",unm:"unm-latn-us",unn:"unn-latn-au",unr:"unr-beng-in","unr-deva":"unr-deva-np","unr-np":"unr-deva-np",unu:"unu-latn-pg",unx:"unx-beng-in",unz:"unz-latn-id",uok:"uok-latn-zz",uon:"uon-latn-tw",upi:"upi-latn-pg",upv:"upv-latn-vu",ur:"ur-arab-pk",ura:"ura-latn-pe",urb:"urb-latn-br",urc:"urc-latn-au",ure:"ure-latn-bo",urf:"urf-latn-au",urg:"urg-latn-pg",urh:"urh-latn-ng",uri:"uri-latn-zz",urk:"urk-thai-th",urm:"urm-latn-pg",urn:"urn-latn-id",uro:"uro-latn-pg",urp:"urp-latn-br",urr:"urr-latn-vu",urt:"urt-latn-zz",uru:"uru-latn-br",urv:"urv-latn-pg",urw:"urw-latn-zz",urx:"urx-latn-pg",ury:"ury-latn-id",urz:"urz-latn-br",usa:"usa-latn-zz",ush:"ush-arab-pk",usi:"usi-latn-bd","usi-beng":"usi-beng-bd",usk:"usk-latn-cm",usp:"usp-latn-gt",uss:"uss-latn-ng",usu:"usu-latn-pg",uta:"uta-latn-ng",ute:"ute-latn-us",uth:"uth-latn-zz",utp:"utp-latn-sb",utr:"utr-latn-zz",utu:"utu-latn-pg",uum:"uum-grek-ge","uum-cyrl":"uum-cyrl-ge",uur:"uur-latn-vu",uve:"uve-latn-nc",uvh:"uvh-latn-zz",uvl:"uvl-latn-zz",uwa:"uwa-latn-au",uya:"uya-latn-ng",uz:"uz-latn-uz","uz-af":"uz-arab-af","uz-arab":"uz-arab-af","uz-cn":"uz-cyrl-cn",uzs:"uzs-arab-af",vaa:"vaa-taml-in",vae:"vae-latn-cf",vaf:"vaf-arab-ir",vag:"vag-latn-zz",vah:"vah-deva-in",vai:"vai-vaii-lr",vaj:"vaj-latn-na",val:"val-latn-pg",vam:"vam-latn-pg",van:"van-latn-zz",vao:"vao-latn-vu",vap:"vap-latn-in",var:"var-latn-mx",vas:"vas-deva-in","vas-gujr":"vas-gujr-in",vau:"vau-latn-cd",vav:"vav-deva-in","vav-gujr":"vav-gujr-in",vay:"vay-deva-np",vbb:"vbb-latn-id",vbk:"vbk-latn-ph",ve:"ve-latn-za",vec:"vec-latn-it",vem:"vem-latn-ng",veo:"veo-latn-us",vep:"vep-latn-ru",ver:"ver-latn-ng",vgr:"vgr-arab-pk",vi:"vi-latn-vn",vic:"vic-latn-sx",vid:"vid-latn-tz",vif:"vif-latn-cg",vig:"vig-latn-bf",vil:"vil-latn-ar",vin:"vin-latn-tz",vit:"vit-latn-ng",viv:"viv-latn-zz",vka:"vka-latn-au",vkj:"vkj-latn-td",vkk:"vkk-latn-id",vkl:"vkl-latn-id",vkm:"vkm-latn-br",vkn:"vkn-latn-ng",vko:"vko-latn-id",vkp:"vkp-latn-in","vkp-deva":"vkp-deva-in",vkt:"vkt-latn-id",vku:"vku-latn-au",vkz:"vkz-latn-ng",vlp:"vlp-latn-vu",vls:"vls-latn-be",vma:"vma-latn-au",vmb:"vmb-latn-au",vmc:"vmc-latn-mx",vmd:"vmd-knda-in",vme:"vme-latn-id",vmf:"vmf-latn-de",vmg:"vmg-latn-pg",vmh:"vmh-arab-ir",vmi:"vmi-latn-au",vmj:"vmj-latn-mx",vmk:"vmk-latn-mz",vml:"vml-latn-au",vmm:"vmm-latn-mx",vmp:"vmp-latn-mx",vmq:"vmq-latn-mx",vmr:"vmr-latn-mz",vms:"vms-latn-id",vmu:"vmu-latn-au",vmw:"vmw-latn-mz",vmx:"vmx-latn-mx",vmy:"vmy-latn-mx",vmz:"vmz-latn-mx",vnk:"vnk-latn-sb",vnm:"vnm-latn-vu",vnp:"vnp-latn-vu",vo:"vo-latn-001",vor:"vor-latn-ng",vot:"vot-latn-ru",vra:"vra-latn-vu",vro:"vro-latn-ee",vrs:"vrs-latn-sb",vrt:"vrt-latn-vu",vto:"vto-latn-id",vum:"vum-latn-ga",vun:"vun-latn-tz",vut:"vut-latn-zz",vwa:"vwa-latn-cn","vwa-mymr":"vwa-mymr-cn",wa:"wa-latn-be",waa:"waa-latn-us",wab:"wab-latn-pg",wac:"wac-latn-us",wad:"wad-latn-id",wae:"wae-latn-ch",waf:"waf-latn-br",wag:"wag-latn-pg",wah:"wah-latn-id",wai:"wai-latn-id",waj:"waj-latn-zz",wal:"wal-ethi-et",wam:"wam-latn-us",wan:"wan-latn-zz",wap:"wap-latn-gy",waq:"waq-latn-au",war:"war-latn-ph",was:"was-latn-us",wat:"wat-latn-pg",wau:"wau-latn-br",wav:"wav-latn-ng",waw:"waw-latn-br",wax:"wax-latn-pg",way:"way-latn-sr",waz:"waz-latn-pg",wba:"wba-latn-ve",wbb:"wbb-latn-id",wbe:"wbe-latn-id",wbf:"wbf-latn-bf",wbh:"wbh-latn-tz",wbi:"wbi-latn-tz",wbj:"wbj-latn-tz",wbk:"wbk-arab-af",wbl:"wbl-latn-pk","wbl-arab":"wbl-arab-af","wbl-cyrl":"wbl-cyrl-tj",wbm:"wbm-latn-cn",wbp:"wbp-latn-au",wbq:"wbq-telu-in",wbr:"wbr-deva-in",wbt:"wbt-latn-au",wbv:"wbv-latn-au",wbw:"wbw-latn-id",wca:"wca-latn-br",wci:"wci-latn-zz",wdd:"wdd-latn-ga",wdg:"wdg-latn-pg",wdj:"wdj-latn-au",wdk:"wdk-latn-au",wdt:"wdt-latn-ca",wdu:"wdu-latn-au",wdy:"wdy-latn-au",wec:"wec-latn-ci",wed:"wed-latn-pg",weg:"weg-latn-au",weh:"weh-latn-cm",wei:"wei-latn-pg",wem:"wem-latn-bj",weo:"weo-latn-id",wep:"wep-latn-de",wer:"wer-latn-zz",wes:"wes-latn-cm",wet:"wet-latn-id",weu:"weu-latn-mm",wew:"wew-latn-id",wfg:"wfg-latn-id",wga:"wga-latn-au",wgb:"wgb-latn-pg",wgg:"wgg-latn-au",wgi:"wgi-latn-zz",wgo:"wgo-latn-id",wgu:"wgu-latn-au",wgy:"wgy-latn-au",wha:"wha-latn-id",whg:"whg-latn-zz",whk:"whk-latn-id",whu:"whu-latn-id",wib:"wib-latn-zz",wic:"wic-latn-us",wie:"wie-latn-au",wif:"wif-latn-au",wig:"wig-latn-au",wih:"wih-latn-au",wii:"wii-latn-pg",wij:"wij-latn-au",wik:"wik-latn-au",wil:"wil-latn-au",wim:"wim-latn-au",win:"win-latn-us",wir:"wir-latn-br",wiu:"wiu-latn-zz",wiv:"wiv-latn-zz",wiy:"wiy-latn-us",wja:"wja-latn-zz",wji:"wji-latn-zz",wka:"wka-latn-tz",wkd:"wkd-latn-id",wkr:"wkr-latn-au",wkw:"wkw-latn-au",wky:"wky-latn-au",wla:"wla-latn-pg",wlg:"wlg-latn-au",wlh:"wlh-latn-tl",wli:"wli-latn-id",wlm:"wlm-latn-gb",wlo:"wlo-arab-id",wlr:"wlr-latn-vu",wls:"wls-latn-wf",wlu:"wlu-latn-au",wlv:"wlv-latn-ar",wlw:"wlw-latn-id",wlx:"wlx-latn-gh",wma:"wma-latn-ng",wmb:"wmb-latn-au",wmc:"wmc-latn-pg",wmd:"wmd-latn-br",wme:"wme-deva-np",wmh:"wmh-latn-tl",wmi:"wmi-latn-au",wmm:"wmm-latn-id",wmn:"wmn-latn-nc",wmo:"wmo-latn-zz",wms:"wms-latn-id",wmt:"wmt-latn-au",wmw:"wmw-latn-mz","wmw-arab":"wmw-arab-mz",wmx:"wmx-latn-pg",wnb:"wnb-latn-pg",wnc:"wnc-latn-zz",wnd:"wnd-latn-au",wne:"wne-arab-pk",wng:"wng-latn-id",wni:"wni-arab-km",wnk:"wnk-latn-id",wnm:"wnm-latn-au",wnn:"wnn-latn-au",wno:"wno-latn-id",wnp:"wnp-latn-pg",wnu:"wnu-latn-zz",wnw:"wnw-latn-us",wny:"wny-latn-au",wo:"wo-latn-sn",woa:"woa-latn-au",wob:"wob-latn-zz",woc:"woc-latn-pg",wod:"wod-latn-id",woe:"woe-latn-fm",wof:"wof-latn-gm","wof-arab":"wof-arab-gm",wog:"wog-latn-pg",woi:"woi-latn-id",wok:"wok-latn-cm",wom:"wom-latn-ng",won:"won-latn-cd",woo:"woo-latn-id",wor:"wor-latn-id",wos:"wos-latn-zz",wow:"wow-latn-id",wpc:"wpc-latn-ve",wrb:"wrb-latn-au",wrg:"wrg-latn-au",wrh:"wrh-latn-au",wri:"wri-latn-au",wrk:"wrk-latn-au",wrl:"wrl-latn-au",wrm:"wrm-latn-au",wro:"wro-latn-au",wrp:"wrp-latn-id",wrr:"wrr-latn-au",wrs:"wrs-latn-zz",wru:"wru-latn-id",wrv:"wrv-latn-pg",wrw:"wrw-latn-au",wrx:"wrx-latn-id",wrz:"wrz-latn-au",wsa:"wsa-latn-id",wsg:"wsg-gong-in",wsi:"wsi-latn-vu",wsk:"wsk-latn-zz",wsr:"wsr-latn-pg",wss:"wss-latn-gh",wsu:"wsu-latn-br",wsv:"wsv-arab-af",wtf:"wtf-latn-pg",wth:"wth-latn-au",wti:"wti-latn-et",wtk:"wtk-latn-pg",wtm:"wtm-deva-in",wtw:"wtw-latn-id","wtw-bugi":"wtw-bugi-id",wua:"wua-latn-au",wub:"wub-latn-au",wud:"wud-latn-tg",wul:"wul-latn-id",wum:"wum-latn-ga",wun:"wun-latn-tz",wur:"wur-latn-au",wut:"wut-latn-pg",wuu:"wuu-hans-cn",wuv:"wuv-latn-zz",wux:"wux-latn-au",wuy:"wuy-latn-id",wwa:"wwa-latn-zz",wwb:"wwb-latn-au",wwo:"wwo-latn-vu",wwr:"wwr-latn-au",www:"www-latn-cm",wxw:"wxw-latn-au",wyb:"wyb-latn-au",wyi:"wyi-latn-au",wym:"wym-latn-pl",wyn:"wyn-latn-us",wyr:"wyr-latn-br",wyy:"wyy-latn-fj",xaa:"xaa-latn-es",xab:"xab-latn-ng",xai:"xai-latn-br",xaj:"xaj-latn-br",xak:"xak-latn-ve",xal:"xal-cyrl-ru",xam:"xam-latn-za",xan:"xan-ethi-et",xao:"xao-latn-vn",xar:"xar-latn-pg",xas:"xas-cyrl-ru",xat:"xat-latn-br",xau:"xau-latn-id",xav:"xav-latn-br",xaw:"xaw-latn-us",xay:"xay-latn-id",xbb:"xbb-latn-au",xbd:"xbd-latn-au",xbe:"xbe-latn-au",xbg:"xbg-latn-au",xbi:"xbi-latn-zz",xbj:"xbj-latn-au",xbm:"xbm-latn-fr",xbn:"xbn-latn-my",xbp:"xbp-latn-au",xbr:"xbr-latn-id",xbw:"xbw-latn-br",xby:"xby-latn-au",xch:"xch-latn-us",xco:"xco-chrs-uz",xcr:"xcr-cari-tr",xda:"xda-latn-au",xdk:"xdk-latn-au",xdo:"xdo-latn-ao",xdq:"xdq-cyrl-ru",xdy:"xdy-latn-id",xed:"xed-latn-cm",xeg:"xeg-latn-za",xem:"xem-latn-id",xer:"xer-latn-br",xes:"xes-latn-zz",xet:"xet-latn-br",xeu:"xeu-latn-pg",xgb:"xgb-latn-ci",xgd:"xgd-latn-au",xgg:"xgg-latn-au",xgi:"xgi-latn-au",xgm:"xgm-latn-au",xgu:"xgu-latn-au",xgw:"xgw-latn-au",xh:"xh-latn-za",xhe:"xhe-arab-pk",xhm:"xhm-khmr-kh",xhv:"xhv-latn-vn",xii:"xii-latn-za",xin:"xin-latn-gt",xir:"xir-latn-br",xis:"xis-orya-in",xiy:"xiy-latn-br",xjb:"xjb-latn-au",xjt:"xjt-latn-au",xka:"xka-arab-pk",xkb:"xkb-latn-bj",xkc:"xkc-arab-ir",xkd:"xkd-latn-id",xke:"xke-latn-id",xkg:"xkg-latn-ml",xkj:"xkj-arab-ir",xkl:"xkl-latn-id",xkn:"xkn-latn-id",xkp:"xkp-arab-ir",xkq:"xkq-latn-id",xkr:"xkr-latn-br",xks:"xks-latn-id",xkt:"xkt-latn-gh",xku:"xku-latn-cg",xkv:"xkv-latn-bw",xkw:"xkw-latn-id",xkx:"xkx-latn-pg",xky:"xky-latn-my",xkz:"xkz-latn-bt",xla:"xla-latn-zz",xlc:"xlc-lyci-tr",xld:"xld-lydi-tr",xly:"xly-elym-ir",xma:"xma-latn-so",xmb:"xmb-latn-cm",xmc:"xmc-latn-mz",xmd:"xmd-latn-cm",xmf:"xmf-geor-ge",xmg:"xmg-latn-cm",xmh:"xmh-latn-au",xmj:"xmj-latn-cm",xmm:"xmm-latn-id",xmn:"xmn-mani-cn",xmo:"xmo-latn-br",xmp:"xmp-latn-au",xmq:"xmq-latn-au",xmr:"xmr-merc-sd",xmt:"xmt-latn-id",xmu:"xmu-latn-au",xmv:"xmv-latn-mg",xmw:"xmw-latn-mg",xmx:"xmx-latn-id",xmy:"xmy-latn-au",xmz:"xmz-latn-id",xna:"xna-narb-sa",xnb:"xnb-latn-tw",xni:"xni-latn-au",xnj:"xnj-latn-tz",xnk:"xnk-latn-au",xnm:"xnm-latn-au",xnn:"xnn-latn-ph",xnq:"xnq-latn-mz",xnr:"xnr-deva-in",xnt:"xnt-latn-us",xnu:"xnu-latn-au",xny:"xny-latn-au",xnz:"xnz-latn-eg","xnz-arab":"xnz-arab-eg",xoc:"xoc-latn-ng",xod:"xod-latn-id",xog:"xog-latn-ug",xoi:"xoi-latn-pg",xok:"xok-latn-br",xom:"xom-latn-sd","xom-ethi":"xom-ethi-et",xon:"xon-latn-zz",xoo:"xoo-latn-br",xop:"xop-latn-pg",xor:"xor-latn-br",xow:"xow-latn-pg",xpa:"xpa-latn-au",xpb:"xpb-latn-au",xpd:"xpd-latn-au",xpf:"xpf-latn-au",xpg:"xpg-grek-tr",xph:"xph-latn-au",xpi:"xpi-ogam-gb",xpj:"xpj-latn-au",xpk:"xpk-latn-br",xpl:"xpl-latn-au",xpm:"xpm-cyrl-ru",xpn:"xpn-latn-br",xpo:"xpo-latn-mx",xpq:"xpq-latn-us",xpr:"xpr-prti-ir",xpt:"xpt-latn-au",xpv:"xpv-latn-au",xpw:"xpw-latn-au",xpx:"xpx-latn-au",xpz:"xpz-latn-au",xra:"xra-latn-br",xrb:"xrb-latn-zz",xrd:"xrd-latn-au",xre:"xre-latn-br",xrg:"xrg-latn-au",xri:"xri-latn-br",xrm:"xrm-cyrl-ru",xrn:"xrn-cyrl-ru",xrr:"xrr-latn-it",xru:"xru-latn-au",xrw:"xrw-latn-pg",xsa:"xsa-sarb-ye",xsb:"xsb-latn-ph",xse:"xse-latn-id",xsh:"xsh-latn-ng",xsi:"xsi-latn-zz",xsm:"xsm-latn-zz",xsn:"xsn-latn-ng",xsp:"xsp-latn-pg",xsq:"xsq-latn-mz",xsr:"xsr-deva-np",xss:"xss-cyrl-ru",xsu:"xsu-latn-ve",xsy:"xsy-latn-tw",xta:"xta-latn-mx",xtb:"xtb-latn-mx",xtc:"xtc-latn-sd",xtd:"xtd-latn-mx",xte:"xte-latn-id",xth:"xth-latn-au",xti:"xti-latn-mx",xtj:"xtj-latn-mx",xtl:"xtl-latn-mx",xtm:"xtm-latn-mx",xtn:"xtn-latn-mx",xtp:"xtp-latn-mx",xts:"xts-latn-mx",xtt:"xtt-latn-mx",xtu:"xtu-latn-mx",xtv:"xtv-latn-au",xtw:"xtw-latn-br",xty:"xty-latn-mx",xub:"xub-taml-in","xub-knda":"xub-knda-in","xub-mlym":"xub-mlym-in",xud:"xud-latn-au",xuj:"xuj-taml-in",xul:"xul-latn-au",xum:"xum-latn-it","xum-ital":"xum-ital-it",xun:"xun-latn-au",xuo:"xuo-latn-td",xut:"xut-latn-au",xuu:"xuu-latn-na",xve:"xve-ital-it",xvi:"xvi-arab-af",xvn:"xvn-latn-es",xvo:"xvo-latn-it",xvs:"xvs-latn-it",xwa:"xwa-latn-br",xwd:"xwd-latn-au",xwe:"xwe-latn-zz",xwj:"xwj-latn-au",xwk:"xwk-latn-au",xwl:"xwl-latn-bj",xwo:"xwo-cyrl-ru",xwr:"xwr-latn-id",xwt:"xwt-latn-au",xww:"xww-latn-au",xxb:"xxb-latn-gh",xxk:"xxk-latn-id",xxm:"xxm-latn-au",xxr:"xxr-latn-br",xxt:"xxt-latn-id",xya:"xya-latn-au",xyb:"xyb-latn-au",xyj:"xyj-latn-au",xyk:"xyk-latn-au",xyl:"xyl-latn-br",xyt:"xyt-latn-au",xyy:"xyy-latn-au",xzh:"xzh-marc-cn",xzp:"xzp-latn-mx",yaa:"yaa-latn-pe",yab:"yab-latn-br",yac:"yac-latn-id",yad:"yad-latn-pe",yae:"yae-latn-ve",yaf:"yaf-latn-cd",yag:"yag-latn-cl",yai:"yai-cyrl-tj",yaj:"yaj-latn-cf",yak:"yak-latn-us",yal:"yal-latn-gn","yal-arab":"yal-arab-gn",yam:"yam-latn-zz",yan:"yan-latn-ni",yao:"yao-latn-mz",yap:"yap-latn-fm",yaq:"yaq-latn-mx",yar:"yar-latn-ve",yas:"yas-latn-zz",yat:"yat-latn-zz",yau:"yau-latn-ve",yav:"yav-latn-cm",yaw:"yaw-latn-br",yax:"yax-latn-ao",yay:"yay-latn-zz",yaz:"yaz-latn-zz",yba:"yba-latn-zz",ybb:"ybb-latn-cm",ybe:"ybe-latn-cn","ybe-ougr":"ybe-ougr-cn",ybh:"ybh-deva-np",ybi:"ybi-deva-np",ybj:"ybj-latn-ng",ybl:"ybl-latn-ng",ybm:"ybm-latn-pg",ybn:"ybn-latn-br",ybo:"ybo-latn-pg",ybx:"ybx-latn-pg",yby:"yby-latn-zz",ycl:"ycl-latn-cn",ycn:"ycn-latn-co",yda:"yda-latn-au",yde:"yde-latn-pg",ydg:"ydg-arab-pk",ydk:"ydk-latn-pg",yea:"yea-mlym-in","yea-knda":"yea-knda-in",yec:"yec-latn-de",yee:"yee-latn-pg",yei:"yei-latn-cm",yej:"yej-grek-il",yel:"yel-latn-cd",yer:"yer-latn-zz",yes:"yes-latn-ng",yet:"yet-latn-id",yeu:"yeu-telu-in",yev:"yev-latn-pg",yey:"yey-latn-bw",yga:"yga-latn-au",ygi:"ygi-latn-au",ygl:"ygl-latn-pg",ygm:"ygm-latn-pg",ygp:"ygp-plrd-cn",ygr:"ygr-latn-zz",ygu:"ygu-latn-au",ygw:"ygw-latn-zz",yhd:"yhd-hebr-il",yi:"yi-hebr-001",yia:"yia-latn-au",yig:"yig-yiii-cn",yih:"yih-hebr-de",yii:"yii-latn-au",yij:"yij-latn-au",yil:"yil-latn-au",yim:"yim-latn-in",yir:"yir-latn-id",yis:"yis-latn-pg",yiv:"yiv-yiii-cn",yka:"yka-latn-ph","yka-arab":"yka-arab-ph",ykg:"ykg-cyrl-ru",yki:"yki-latn-id",ykk:"ykk-latn-pg",ykm:"ykm-latn-pg",yko:"yko-latn-zz",ykr:"ykr-latn-pg",yky:"yky-latn-cf",yla:"yla-latn-pg",ylb:"ylb-latn-pg",yle:"yle-latn-zz",ylg:"ylg-latn-zz",yli:"yli-latn-id",yll:"yll-latn-zz",ylr:"ylr-latn-au",ylu:"ylu-latn-pg",yly:"yly-latn-nc",ymb:"ymb-latn-pg",yme:"yme-latn-pe",ymg:"ymg-latn-cd",ymk:"ymk-latn-mz","ymk-arab":"ymk-arab-mz",yml:"yml-latn-zz",ymm:"ymm-latn-so",ymn:"ymn-latn-id",ymo:"ymo-latn-pg",ymp:"ymp-latn-pg",yna:"yna-plrd-cn",ynd:"ynd-latn-au",yng:"yng-latn-cd",ynk:"ynk-cyrl-ru",ynl:"ynl-latn-pg",ynq:"ynq-latn-ng",yns:"yns-latn-cd",ynu:"ynu-latn-co",yo:"yo-latn-ng",yob:"yob-latn-pg",yog:"yog-latn-ph",yoi:"yoi-jpan-jp",yok:"yok-latn-us",yol:"yol-latn-gb",yom:"yom-latn-cd",yon:"yon-latn-zz",yot:"yot-latn-ng",yoy:"yoy-thai-th",yra:"yra-latn-pg",yrb:"yrb-latn-zz",yre:"yre-latn-zz",yrk:"yrk-cyrl-ru",yrl:"yrl-latn-br",yrm:"yrm-latn-au",yro:"yro-latn-br",yrs:"yrs-latn-id",yrw:"yrw-latn-pg",yry:"yry-latn-au",ysd:"ysd-yiii-cn",ysn:"ysn-yiii-cn",ysp:"ysp-yiii-cn",ysr:"ysr-cyrl-ru",yss:"yss-latn-zz",ysy:"ysy-plrd-cn",ytw:"ytw-latn-pg",yty:"yty-latn-au",yua:"yua-latn-mx",yub:"yub-latn-au",yuc:"yuc-latn-us",yud:"yud-hebr-il",yue:"yue-hant-hk","yue-cn":"yue-hans-cn","yue-hans":"yue-hans-cn",yuf:"yuf-latn-us",yug:"yug-cyrl-ru",yui:"yui-latn-co",yuj:"yuj-latn-zz",yul:"yul-latn-cf",yum:"yum-latn-us",yun:"yun-latn-ng",yup:"yup-latn-co",yuq:"yuq-latn-bo",yur:"yur-latn-us",yut:"yut-latn-zz",yuw:"yuw-latn-zz",yux:"yux-cyrl-ru",yuz:"yuz-latn-bo",yva:"yva-latn-id",yvt:"yvt-latn-ve",ywa:"ywa-latn-pg",ywg:"ywg-latn-au",ywn:"ywn-latn-br",ywq:"ywq-plrd-cn","ywq-yiii":"ywq-yiii-cn",ywr:"ywr-latn-au",ywu:"ywu-plrd-cn","ywu-yiii":"ywu-yiii-cn",yww:"yww-latn-au",yxa:"yxa-latn-au",yxg:"yxg-latn-au",yxl:"yxl-latn-au",yxm:"yxm-latn-au",yxu:"yxu-latn-au",yxy:"yxy-latn-au",yyr:"yyr-latn-au",yyu:"yyu-latn-pg",za:"za-latn-cn",zaa:"zaa-latn-mx",zab:"zab-latn-mx",zac:"zac-latn-mx",zad:"zad-latn-mx",zae:"zae-latn-mx",zaf:"zaf-latn-mx",zag:"zag-latn-sd",zah:"zah-latn-ng",zaj:"zaj-latn-tz",zak:"zak-latn-tz",zam:"zam-latn-mx",zao:"zao-latn-mx",zap:"zap-latn-mx",zaq:"zaq-latn-mx",zar:"zar-latn-mx",zas:"zas-latn-mx",zat:"zat-latn-mx",zau:"zau-tibt-in","zau-arab":"zau-arab-in",zav:"zav-latn-mx",zaw:"zaw-latn-mx",zax:"zax-latn-mx",zay:"zay-latn-et","zay-ethi":"zay-ethi-et",zaz:"zaz-latn-ng",zba:"zba-arab-001",zbc:"zbc-latn-my",zbe:"zbe-latn-my",zbt:"zbt-latn-id",zbu:"zbu-latn-ng",zbw:"zbw-latn-my",zca:"zca-latn-mx",zch:"zch-hani-cn",zdj:"zdj-arab-km",zea:"zea-latn-nl",zeg:"zeg-latn-pg",zeh:"zeh-hani-cn",zen:"zen-tfng-mr","zen-arab":"zen-arab-mr",zga:"zga-latn-tz",zgb:"zgb-hani-cn",zgh:"zgh-tfng-ma",zgm:"zgm-hani-cn",zgn:"zgn-hani-cn",zgr:"zgr-latn-pg",zh:"zh-hans-cn","zh-au":"zh-hant-au","zh-bn":"zh-hant-bn","zh-bopo":"zh-bopo-tw","zh-gb":"zh-hant-gb","zh-gf":"zh-hant-gf","zh-hanb":"zh-hanb-tw","zh-hant":"zh-hant-tw","zh-hk":"zh-hant-hk","zh-id":"zh-hant-id","zh-mo":"zh-hant-mo","zh-pa":"zh-hant-pa","zh-pf":"zh-hant-pf","zh-ph":"zh-hant-ph","zh-sr":"zh-hant-sr","zh-th":"zh-hant-th","zh-tw":"zh-hant-tw","zh-us":"zh-hant-us","zh-vn":"zh-hant-vn",zhd:"zhd-hani-cn","zhd-latn":"zhd-latn-vn",zhi:"zhi-latn-ng",zhn:"zhn-latn-cn","zhn-hani":"zhn-hani-cn",zhw:"zhw-latn-cm",zhx:"zhx-nshu-cn",zia:"zia-latn-zz",zik:"zik-latn-pg",zil:"zil-latn-gn",zim:"zim-latn-td",zin:"zin-latn-tz",ziw:"ziw-latn-tz",ziz:"ziz-latn-ng",zka:"zka-latn-id",zkb:"zkb-cyrl-ru",zkd:"zkd-latn-mm",zko:"zko-cyrl-ru",zkp:"zkp-latn-br",zkt:"zkt-kits-cn",zku:"zku-latn-au",zkz:"zkz-cyrl-ru",zla:"zla-latn-cd",zlj:"zlj-hani-cn","zlj-latn":"zlj-latn-cn",zlm:"zlm-latn-tg",zln:"zln-hani-cn",zlq:"zlq-hani-cn",zma:"zma-latn-au",zmb:"zmb-latn-cd",zmc:"zmc-latn-au",zmd:"zmd-latn-au",zme:"zme-latn-au",zmf:"zmf-latn-cd",zmg:"zmg-latn-au",zmh:"zmh-latn-pg",zmi:"zmi-latn-my",zmj:"zmj-latn-au",zmk:"zmk-latn-au",zml:"zml-latn-au",zmm:"zmm-latn-au",zmn:"zmn-latn-ga",zmo:"zmo-latn-sd",zmp:"zmp-latn-cd",zmq:"zmq-latn-cd",zmr:"zmr-latn-au",zms:"zms-latn-cd",zmt:"zmt-latn-au",zmu:"zmu-latn-au",zmv:"zmv-latn-au",zmw:"zmw-latn-cd",zmx:"zmx-latn-cg",zmy:"zmy-latn-au",zmz:"zmz-latn-cd",zna:"zna-latn-td",zne:"zne-latn-zz",zng:"zng-latn-vn",znk:"znk-latn-au",zns:"zns-latn-ng",zoc:"zoc-latn-mx",zoh:"zoh-latn-mx",zom:"zom-latn-in",zoo:"zoo-latn-mx",zoq:"zoq-latn-mx",zor:"zor-latn-mx",zos:"zos-latn-mx",zpa:"zpa-latn-mx",zpb:"zpb-latn-mx",zpc:"zpc-latn-mx",zpd:"zpd-latn-mx",zpe:"zpe-latn-mx",zpf:"zpf-latn-mx",zpg:"zpg-latn-mx",zph:"zph-latn-mx",zpi:"zpi-latn-mx",zpj:"zpj-latn-mx",zpk:"zpk-latn-mx",zpl:"zpl-latn-mx",zpm:"zpm-latn-mx",zpn:"zpn-latn-mx",zpo:"zpo-latn-mx",zpp:"zpp-latn-mx",zpq:"zpq-latn-mx",zpr:"zpr-latn-mx",zps:"zps-latn-mx",zpt:"zpt-latn-mx",zpu:"zpu-latn-mx",zpv:"zpv-latn-mx",zpw:"zpw-latn-mx",zpx:"zpx-latn-mx",zpy:"zpy-latn-mx",zpz:"zpz-latn-mx",zqe:"zqe-hani-cn","zqe-latn":"zqe-latn-cn",zrn:"zrn-latn-td",zro:"zro-latn-ec",zrp:"zrp-hebr-fr",zrs:"zrs-latn-id",zsa:"zsa-latn-pg",zsr:"zsr-latn-mx",zsu:"zsu-latn-pg",zte:"zte-latn-mx",ztg:"ztg-latn-mx",ztl:"ztl-latn-mx",ztm:"ztm-latn-mx",ztn:"ztn-latn-mx",ztp:"ztp-latn-mx",ztq:"ztq-latn-mx",zts:"zts-latn-mx",ztt:"ztt-latn-mx",ztu:"ztu-latn-mx",ztx:"ztx-latn-mx",zty:"zty-latn-mx",zu:"zu-latn-za",zua:"zua-latn-ng",zuh:"zuh-latn-pg",zum:"zum-arab-om",zun:"zun-latn-us",zuy:"zuy-latn-cm",zyg:"zyg-hani-cn",zyj:"zyj-latn-cn","zyj-hani":"zyj-hani-cn",zyn:"zyn-hani-cn",zyp:"zyp-latn-mm",zza:"zza-latn-tr",zzj:"zzj-hani-cn"},Ss={}.hasOwnProperty;function _s(p){const{language:m,script:b,region:T}=p;let v;var S,k;return b&&T&&(v=vs[Zi({language:m,script:b,region:T})])?(p.script=void 0,p.region=void 0):b&&(v=vs[Zi({language:m,script:b})])?p.script=void 0:T&&(v=vs[Zi({language:m,region:T})])?p.region=void 0:m&&(v=vs[m]),v&&(p.language=void 0,S=p,k=Ui(v),S.language||(S.language=k.language),S.script||(S.script=k.script),S.region||(S.region=k.region),k.variants&&S.variants.push(...k.variants)),Zi(p)}function As(p,m){const b={},T=Ui(String(p||"").toLowerCase(),b),v=Zi(T);if(!v)return v;let S=-1;for(;++S<Uo.length;){let k=Uo[S].from;k.slice(0,4)==="und-"&&T.language&&(k=T.language+k.slice(3)),Fo(v,k).length>0&&up(T,k,Uo[S].to)}for(S=-1;++S<$a.length;)yc(T,$a[S].from.field,$a[S].from.value)&&Ec(T,$a[S].to.field,$a[S].to.value);if((function(k){_s(k);const{language:x,script:I,region:N}=k;if(!x)return k;const O=Zi({language:x,script:I,region:N});O===_s(Ui(x))?(k.script=void 0,k.region=void 0):N&&O===_s(Ui(x+"-"+N))?k.script=void 0:I&&O===_s(Ui(x+"-"+I))&&(k.region=void 0)})(T),T.variants.sort(),T.extensions.sort(cp),b.warning){let k;for(k in zo)if(Ss.call(zo,k)){const x=zo[k],I=T[k];if(I&&Ss.call(x,I)){const N=x[I];b.warning("Deprecated "+k+" `"+I+"`, expected one of `"+N.join("`, `")+"`",-1,7)}}}return T.script&&(T.script=T.script.charAt(0).toUpperCase()+T.script.slice(1)),T.region&&(T.region=T.region.toUpperCase()),Zi(T)}function up(p,m,b){const T=Ui(m),v=Ui(b),S=[],k=T.language;let x;for(x in T)if(Ss.call(T,x)){const I=T[x];I&&yc(p,x,I)&&S.push(x)}for(x in v)if(Ss.call(v,x)){const I=v[x];k&&I&&(S.includes(x)||!p[x])&&Ec(p,x,x==="language"&&I==="und"?k:I)}}function yc(p,m,b){let T,v=!1;if(b){const S=p[m];if(T=S,Array.isArray(S)){T=[];let k=-1;for(;++k<S.length;){const x=S[k];b.includes(x)?v=!0:T.push(x)}}else S===b&&(T=null,v=!0);p[m]=T}return v}function Ec(p,m,b){const T=p[m];if(Array.isArray(T)){const v=Array.isArray(b)?b:[b];let S=-1;for(;++S<v.length;){const k=v[S];T.includes(k)||T.push(k)}}else p[m]=b}function cp(p,m){return p.singleton>m.singleton?1:p.singleton<m.singleton?-1:0}function dp(p,m){return m+10<=p.length&&p[m]===73&&p[m+1]===68&&p[m+2]===51&&p[m+3]<255&&p[m+4]<255&&p[m+6]<128&&p[m+7]<128&&p[m+8]<128&&p[m+9]<128}function bc(p,m){let b=0;return b=(127&p[m])<<21,b|=(127&p[m+1])<<14,b|=(127&p[m+2])<<7,b|=127&p[m+3],b}function fp(p,m){return m+10<=p.length&&p[m]===51&&p[m+1]===68&&p[m+2]===73&&p[m+3]<255&&p[m+4]<255&&p[m+6]<128&&p[m+7]<128&&p[m+8]<128&&p[m+9]<128}function Bo(p,m=0,b=1/0){return(function(T,v,S,k){const x=(I=T)instanceof ArrayBuffer?I:I.buffer;var I;let N=1;"BYTES_PER_ELEMENT"in k&&(N=k.BYTES_PER_ELEMENT);const O=(B=T)&&B.buffer instanceof ArrayBuffer&&B.byteLength!==void 0&&B.byteOffset!==void 0?T.byteOffset:0,A=(O+T.byteLength)/N,R=(O+v)/N,C=Math.floor(Math.max(0,Math.min(R,A)));var B;return new k(x,C,Math.floor(Math.min(C+Math.max(S,0),A))-C)})(p,m,b,Uint8Array)}function fi(p,m=!1){const b=m?p.indexOf(0):p.length,T=(function(v,S={}){let k;k=v instanceof ArrayBuffer?new DataView(v):new DataView(v.buffer,v.byteOffset,v.byteLength);let x=0,{encoding:I}=S;if(!I){const C=k.getUint8(0),B=k.getUint8(1);C==239&&B==187&&k.getUint8(2)==191?(I=ei,x=3):C==254&&B==255?(I=Zr,x=2):C==255&&B==254?(I=Jr,x=2):I=ei}if(typeof TextDecoder<"u")return new TextDecoder(I).decode(k);const{byteLength:N}=k,O=I!==Zr;let A,R="";for(;x<N;){switch(I){case ei:if(A=k.getUint8(x),A<128)x++;else if(A>=194&&A<=223)if(x+1<N){const C=k.getUint8(x+1);C>=128&&C<=191?(A=(31&A)<<6|63&C,x+=2):x++}else x++;else if(A>=224&&A<=239)if(x+2<=N-1){const C=k.getUint8(x+1),B=k.getUint8(x+2);C>=128&&C<=191&&B>=128&&B<=191?(A=(15&A)<<12|(63&C)<<6|63&B,x+=3):x++}else x++;else if(A>=240&&A<=244)if(x+3<=N-1){const C=k.getUint8(x+1),B=k.getUint8(x+2),$=k.getUint8(x+3);C>=128&&C<=191&&B>=128&&B<=191&&$>=128&&$<=191?(A=(7&A)<<18|(63&C)<<12|(63&B)<<6|63&$,x+=4):x++}else x++;else x++;break;case Zr:case Kn:case Jr:A=k.getUint16(x,O),x+=2}R+=String.fromCodePoint(A)}return R})(new DataView(p.buffer,p.byteOffset,b),{encoding:ei});return m?T:T.replace(/\0/g,"")}function hp(p){return p.type==="PRIV"?(function(m){if(m.size<2)return;const b=fi(m.data,!0),T=new Uint8Array(m.data.subarray(b.length+1));return{key:m.type,info:b,data:T.buffer}})(p):p.type[0]==="W"?(function(m){if(m.type==="WXXX"){if(m.size<2)return;let T=1;const v=fi(m.data.subarray(T),!0);T+=v.length+1;const S=fi(m.data.subarray(T));return{key:m.type,info:v,data:S}}const b=fi(m.data);return{key:m.type,info:"",data:b}})(p):p.type==="APIC"?(function(m){const b={key:m.type,description:"",data:"",mimeType:null,pictureType:null};if(m.size<2)return;if(m.data[0]!==3)return void console.log("Ignore frame with unrecognized character encoding");const T=m.data.subarray(1).indexOf(0);if(T===-1)return;const v=fi(Bo(m.data,1,T)),S=m.data[2+T],k=m.data.subarray(3+T).indexOf(0);if(k===-1)return;const x=fi(Bo(m.data,3+T,k));let I;var N;return I=v==="-->"?fi(Bo(m.data,4+T+k)):(N=m.data.subarray(4+T+k))instanceof ArrayBuffer?N:N.byteOffset==0&&N.byteLength==N.buffer.byteLength?N.buffer:new Uint8Array(N).buffer,b.mimeType=v,b.pictureType=S,b.description=x,b.data=I,b})(p):(function(m){if(m.size<2)return;if(m.type==="TXXX"){let T=1;const{data:v}=m,S=fi(v.subarray(T),!0);T+=S.length+1;const k=fi(v.subarray(T));return{key:m.type,info:S,data:k}}const b=fi(m.data.subarray(1));return{key:m.type,info:"",data:b}})(p)}function gp(p){const m=String.fromCharCode(p[0],p[1],p[2],p[3]),b=bc(p,4);return{type:m,size:b,data:p.subarray(10,10+b)}}const Is=10,mp=10;function Tc(){let p,m,b,T,v,S,k;const x=this.context;function I(U,P){const M=P?P.index:0,ge=m.getAdaptationsForType(v[M].mpd.manifest,M,U);if(!ge||ge.length===0)return null;if(ge.length>1&&P){for(let be=0,fe=ge.length;be<fe;be++)if(X=ge[be],m.getRolesForAdaptation(X).filter((function(Te){return Te.schemeIdUri===h.default.DASH_ROLE_SCHEME_ID&&Te.value===ye.default.MAIN}))[0])return ge[be]}var X;return ge[0]}function N(U,P,M,ge,X,be){let fe,Te,Ce,Ie,q,W,re=[];if(!ge||ge.length===0)return[];const ee=m.getAdaptationsForPeriod(P);for(Ie=0,W=ge.length;Ie<W;Ie++)if(fe=ge[Ie],Ce=m.getIndexForAdaptation(fe,U,M.index),Te=V(ee[Ce]),be){let ne=Te.accessibility.length;for(q=0;q<ne;q++){if(!Te)continue;let le=Te.accessibility[q];if(le.schemeIdUri===S.ACCESSIBILITY_CEA608_SCHEME)if(le.value&&le.value!==""){let z=le.value.split(";");if(z[0].substring(0,2)==="CC")for(q=0;q<z.length;q++)Te||(Te=V.call(this,ee[Ce])),te(Te,z[q].substring(0,3),z[q].substring(4)),re.push(Te),Te=null;else for(q=0;q<z.length;q++)Te||(Te=V.call(this,ee[Ce])),te(Te,"CC"+(q+1),z[q]),re.push(Te),Te=null}else te(Te,S.CC1,"eng"),re.push(Te),Te=null}}else X===S.IMAGE?(Te.type=S.IMAGE,re.push(Te),Te=null):Te&&re.push(Te);if(T.get().streaming.includePreselectionsInMediainfoArray){const ne=m.getPreselectionsForPeriod(P);for(Ie=0,W=ne.length;Ie<W;Ie++){const le=ne[Ie];le.hasOwnProperty("type")&&le.type===X&&(Te=j(ne[Ie]),Te&&re.push(Te))}}return re}function O(U){const P=A(U);return m.getRegularPeriods(P)}function A(U){const P=C(U);return m.getMpd(P)}function R(){v=[]}function C(U){return U||(v.length>0?v[0].mpd.manifest:null)}function B(U){try{const P=$(U.streamInfo,v),M=m.getAdaptationsForPeriod(P);return U&&U.streamInfo&&U.streamInfo.id!==void 0&&M?M[U.index]:null}catch{return null}}function $(U,P){const M=P.length;for(let ge=0;ge<M;ge++){let X=P[ge];if(U&&U.id===X.id)return X}return null}function V(U){if(!U)return null;let P=new Ts;const M=U.period.mpd.manifest.Period[U.period.index].AdaptationSet[U.index];P.id=U.id,P.index=U.index,P.codec=m.getCodec(M);const ge=T.get().streaming.enhancement.codecs;return P.type=ge.some((X=>P.codec?.includes(X)))?h.default.ENHANCEMENT:U.type,P.streamInfo=ie(U.period),P.representationCount=m.getRepresentationCount(M),P.labels=m.getLabelsForAdaptation(M),P.lang=m.getLanguageForAdaptation(M),P.segmentAlignment=m.getSegmentAlignment(M),P.subSegmentAlignment=m.getSubSegmentAlignment(M),P.viewpoint=m.getViewpointForAdaptation(M),P.accessibility=m.getAccessibilityForAdaptation(M),P.accessibility.filter((function(X){if(X.schemeIdUri&&X.schemeIdUri.search("cea-608")>=0&&k!==void 0)return!0}))[0]&&(P.embeddedCaptions=!0),P.audioChannelConfiguration=m.getAudioChannelConfigurationForAdaptation(M),P.audioChannelConfiguration.length===0&&M.Representation&&M.Representation.length>0&&(P.audioChannelConfiguration=m.getAudioChannelConfigurationForRepresentation(M.Representation[0])),P.roles=m.getRolesForAdaptation(M),P.mimeType=m.getMimeType(M),P.contentProtection=m.getContentProtectionByAdaptation(M),P.bitrateList=m.getBitrateListForAdaptation(M),P.selectionPriority=m.getSelectionPriority(M),P.contentProtection&&P.contentProtection.length>0&&(P.contentProtection=(function(X,be){if(!X||!X.length||!be)return X;const fe=m.getContentProtectionByManifest(be);if(!fe||!fe.length)return X;const Te=fe.reduce(((Ce,Ie)=>(Ie.refId&&Ce.set(Ie.refId,Ie),Ce)),new Map);return X.map((Ce=>{if(Ce.ref){const Ie=Te.get(Ce.ref);Ie&&Ce.mergeAttributesFromReference(Ie)}return Ce}))})(P.contentProtection,U.period.mpd.manifest),P.contentProtection=(function(X){const be=X.map((fe=>fe.cencDefaultKid)).filter((fe=>fe!==null));if(be.length){const fe=be[0];X.forEach((Te=>{Te.keyId=fe}))}return X})(P.contentProtection),P.normalizedKeyIds=(function(X){const be=new Set;return X.forEach((fe=>{fe.cencDefaultKid&&typeof fe.cencDefaultKid=="string"&&be.add(fe.cencDefaultKid.replace(/-/g,"").toLowerCase())})),be})(P.contentProtection)),P.isText=m.getIsText(M),P.essentialProperties=m.getCombinedEssentialPropertiesForAdaptationSet(M),P.supplementalProperties=m.getCombinedSupplementalPropertiesForAdaptationSet(M),P.isFragmented=m.getIsFragmented(M),P.isEmbedded=!1,P.adaptationSetSwitchingCompatibleIds=(function(X){if(!X||!X.supplementalProperties)return[];let be=[];const fe=X.supplementalProperties.filter((Te=>Te.schemeIdUri===ye.default.ADAPTATION_SET_SWITCHING_SCHEME_ID_URI));return fe&&fe.length>0&&(be=fe[0].value.toString().split(",").map((Te=>Te))),be})(P),P.segmentSequenceProperties=m.getSegmentSequencePropertiesForAdaptationSet(M),P}function j(U){if(!U)return null;let P=new Ts;const M=U.period.mpd.manifest.Period[U.period.index].Preselection[U.index],ge=U.period.mpd.manifest.Period[U.period.index].AdaptationSet,X=m.getAdaptationsForPeriod(U.period);return P=V(m.getMainAdaptationSetForPreselection(M,X)),P&&(P.isPreselection=!0,P.tag=U.tag,P.id=U.id,P.codec=m.getCodecForPreselection(M,ge),P.selectionPriority=m.getSelectionPriority(M),P.labels=m.getLabelsForAdaptation(M),P.lang=m.getLanguageForAdaptation(M),P.viewpoint=m.getViewpointForAdaptation(M),P.accessibility=m.getAccessibilityForAdaptation(M),P.audioChannelConfiguration=m.getAudioChannelConfigurationForAdaptation(M),P.roles=m.getRolesForAdaptation(M),P.essentialProperties=m.getCombinedEssentialPropertiesForAdaptationSet(M),P.supplementalProperties=m.getCombinedSupplementalPropertiesForAdaptationSet(M)),P}function te(U,P,M){U.id=P,U.index=100+parseInt(P.substring(2,3)),U.type=S.TEXT,U.codec="cea-608-in-SEI",U.isEmbedded=!0,U.isFragmented=!1,U.lang=As(M),U.roles=[{schemeIdUri:"urn:mpeg:dash:role:2011",value:"caption"}]}function ie(U){let P=new hc;return P.id=U.id,P.index=U.index,P.start=U.start,P.duration=U.duration,P.manifestInfo=(function(M){let ge=new np;return ge.dvrWindowSize=M.timeShiftBufferDepth,ge.loadedTime=M.manifest.loadedTime,ge.availableFrom=M.availabilityStartTime,ge.minBufferTime=M.manifest.minBufferTime,ge.maxFragmentDuration=M.maxSegmentDuration,ge.duration=m.getDuration(M.manifest),ge.isDynamic=m.getIsDynamic(M.manifest),ge.serviceDescriptions=m.getServiceDescriptions(M.manifest),ge.protocol=M.manifest.protocol,ge})(U.mpd),P.isLast=U.mpd.manifest.Period.length===1||Math.abs(P.start+P.duration-P.manifestInfo.duration)<1,P.isEncrypted=U.isEncrypted,P}function se(){if(!S)throw new Error("setConfig function has to be called previously")}function de(U){return v.length>0?v[0].mpd.manifest.Period[U]:null}function G(U,P,M){let ge,X,be,fe,Te,Ce;if(U){for(X=U.AdaptationSet,Te=0;Te<X.length;Te+=1)for(ge=X[Te],fe=ge.Representation,Ce=0;Ce<fe.length;Ce+=1)if(be=fe[Ce],P===be.id)return M?Ce:be}return null}return p={applyPatchToManifest:function(U,P){b.getPatchOperations(P).forEach((M=>{let ge=M.getMpdTarget(U);if(ge===null)return;let{name:X,target:be,leaf:fe}=ge;if(M.xpath.findsAttribute()||X==="__text"){switch(M.action){case"add":case"replace":be[X]=M.value;break;case"remove":delete be[X]}return}let Te=(be[X]||[]).indexOf(fe),Ce=M.position==="prepend"||M.position==="before";if(M.action==="remove"||M.action==="replace")if(Array.isArray(be[X])){if(Te!=-1){let Ie=be[X];Ie.splice(Te,1),Ie.length>0?be[X]=Ie:delete be[X]}}else delete be[X];M.action!=="add"&&M.action!=="replace"||Object.keys(M.value).forEach((Ie=>{let q=M.value[Ie],W=be[Ie]||[];if(W.length===0&&be[Ie]&&W.push(be[Ie]),W.length===0)W=q;else{let re=W.length;re=Ie==X&&Te!=-1?Te+(Ce?0:1)+(M.action==="replace"?-1:0):Ce?0:W.length,W.splice.apply(W,[re,0].concat(q))}be[Ie]=W}))}))},areMediaInfosEqual:function(U,P){if(!U||!P)return!1;const M=U.id===P.id,ge=U.codec===P.codec,X=JSON.stringify(U.viewpoint)===JSON.stringify(P.viewpoint),be=U.lang===P.lang,fe=JSON.stringify(U.roles)===JSON.stringify(P.roles),Te=JSON.stringify(U.accessibility)===JSON.stringify(P.accessibility),Ce=JSON.stringify(U.audioChannelConfiguration)===JSON.stringify(P.audioChannelConfiguration);return M&&ge&&X&&be&&fe&&Te&&Ce},getAllMediaInfoForType:function(U,P,M){let ge=v,X=M,be=[];if(X)se(),ge=O(X);else{if(!(v.length>0))return be;X=v[0].mpd.manifest}const fe=$(U,ge);let Te=m.getAdaptationsForType(X,U?U.index:null,P);return be=N(X,fe,U,Te,P),P===S.TEXT&&(Te=m.getAdaptationsForType(X,U?U.index:null,S.VIDEO),be=be.concat(N(X,fe,U,Te,P,!0))),be},getAvailabilityStartTime:function(U){const P=A(U);return m.getAvailabilityStartTime(P)},getBandwidthForRepresentation:function(U,P){let M;return M=G(de(P),U),M?M.bandwidth:null},getBaseURLsFromElement:function(U){return m.getBaseURLsFromElement(U)},getCodec:function(U,P,M){return m.getCodec(U,P,M)},getCodecForPreselection:function(U,P){return m.getCodecForPreselection(U,P)},getContentSteering:function(U){return m.getContentSteering(U)},getDuration:function(U){const P=C(U);return m.getDuration(P)},getEssentialProperties:function(U){try{return m.getEssentialProperties(U)}catch{return[]}},getEvent:function(U,P,M,ge){try{if(!U||!P||isNaN(M)||!ge)return null;const X=U.scheme_id_uri,be=U.value;if(!P[X+"/"+be])return null;const fe=new wr,Te=U.timescale||1,Ce=ge.adaptation.period.start,Ie=P[X+"/"+be],q=isNaN(ge.presentationTimeOffset)?isNaN(Ie.presentationTimeOffset)?0:Ie.presentationTimeOffset:ge.presentationTimeOffset;let W,re=U.presentation_time_delta/Te;W=U.version===0?Ce+M-q+re:Ce-q+re;const ee=U.event_duration/Te,ne=U.id,le=U.message_data;return fe.eventStream=Ie,fe.eventStream.value=be,fe.eventStream.timescale=Te,fe.duration=ee,fe.id=ne,fe.calculatedPresentationTime=W,fe.messageData=le,fe.presentationTimeDelta=re,fe.parsedMessageData=X===h.default.ID3_SCHEME_ID_URI?(function(z){let ce=0;const me=[];for(;dp(z,ce);){const Se=bc(z,ce+6);z[ce+5]>>6&1&&(ce+=Is),ce+=Is;const Re=ce+Se;for(;ce+mp<Re;){const we=gp(z.subarray(ce)),ze=hp(we);ze&&me.push(ze),ce+=we.size+Is}fp(z,ce)&&(ce+=Is)}return me})(le):null,fe}catch{return null}},getEventsFor:function(U,P,M){let ge=[];if(v.length>0){const X=v[0].mpd.manifest;if(U instanceof hc){const be=$(U,v);ge=m.getEventsForPeriod(be)}else if(U instanceof Ts){const be=$(M,v);ge=m.getEventStreamForAdaptationSet(X,B(U),be)}else if(U instanceof rn){const be=$(M,v);ge=m.getEventStreamForRepresentation(X,P,be)}}return ge},getFramerate:function(U){return m.getFramerate(U)},getIndexForRepresentation:function(U,P){return(function(M,ge){const X=G(M,ge,!0);return X!==null?X:-1})(de(P),U)},getIsDVB:function(U){return m.hasProfile(U,"urn:dvb:dash:profile:dvb-dash:2014")},getIsDynamic:function(U){const P=C(U);return m.getIsDynamic(P)},getIsPatch:function(U){return b.getIsPatch(U)},getIsTextTrack:function(U){return m.getIsText(U)},getIsTypeOf:function(U,P){return m.getIsTypeOf(U,P)},getLocation:function(U){return m.getLocation(U)},getMainAdaptationForType:I,getMainAdaptationSetForPreselection:function(U,P){return m.getMainAdaptationSetForPreselection(U,P)},getCommonRepresentationForPreselection:function(U,P){return m.getCommonRepresentationForPreselection(U,P)},getManifestUpdatePeriod:function(U,P=0){return m.getManifestUpdatePeriod(U,P)},getMediaInfoForType:function(U,P){if(v.length===0||!U)return null;let M=$(U,v);if(!M)return null;const ge=m.getAdaptationsForPeriod(M);let X=I(P,U);return X?V(ge[m.getIndexForAdaptation(X,v[0].mpd.manifest,U.index)]):null},getMpd:A,getPatchLocation:function(U){const P=m.getPatchLocation(U),M=m.getPublishTime(U);return P&&P.length!==0&&M?P.filter((ge=>isNaN(ge.ttl)||M.getTime()+ge.ttl>new Date().getTime())):[]},getPeriodById:function(U){if(!U||v.length===0)return null;const P=v.filter((M=>M.id===U));return P&&P.length>0?P[0]:null},getPreselectionIsTypeOf:function(U,P,M){return m.getPreselectionIsTypeOf(U,P,M)},getProducerReferenceTimes:function(U,P){let M,ge;const X=$(U,v);return M=P?P.id:null,v.length>0&&X&&(ge=M?m.getAdaptationForId(M,v[0].mpd.manifest,X.index):m.getAdaptationForIndex(P?P.index:null,v[0].mpd.manifest,X.index)),ge?m.getProducerReferenceTimesForAdaptation(ge):[]},getPublishTime:function(U){return m.getPublishTime(U)},getRealAdaptation:function(U,P){let M,ge;const X=$(U,v);return M=P?P.id:null,v.length>0&&X&&(ge=M?m.getAdaptationForId(M,v[0].mpd.manifest,X.index):m.getAdaptationForIndex(P?P.index:null,v[0].mpd.manifest,X.index)),ge},getRealPeriodByIndex:function(U){return m.getRealPeriodForIndex(U,v[0].mpd.manifest)},getRegularPeriods:O,getRepresentationSortFunction:function(){return m.getRepresentationSortFunction()},getStreamsInfo:function(U,P){const M=[];let ge=v;if(U&&(se(),ge=O(U)),ge.length>0){(!P||P>ge.length)&&(P=ge.length);for(let X=0;X<P;X++)M.push(ie(ge[X]))}return M},getSuggestedPresentationDelay:function(){const U=v.length>0?v[0].mpd:null;return m.getSuggestedPresentationDelay(U)},getSupplementalCodecs:function(U){const P=U[ye.default.SUPPLEMENTAL_CODECS];return P?P.split(" ").map((M=>U.mimeType+';codecs="'+M+'"')):[]},getUTCTimingSources:function(){const U=C();return m.getUTCTimingSources(U)},getVoRepresentations:function(U){let P;const M=B(U);return P=m.getRepresentationsForAdaptation(M,U),P},isPatchValid:function(U,P){let M=m.getId(U),ge=b.getMpdId(P),X=m.getPublishTime(U),be=b.getPublishTime(P),fe=b.getOriginalPublishTime(P);return!!(M&&ge&&M==ge&&X&&fe&&X.getTime()==fe.getTime()&&be&&X.getTime()<be.getTime())},reset:R,setConfig:function(U){U&&(U.constants&&(S=U.constants),U.cea608parser&&(k=U.cea608parser),U.errHandler&&m.setConfig({errHandler:U.errHandler}),U.BASE64&&m.setConfig({BASE64:U.BASE64}))},updatePeriods:function(U){if(!U)return null;se(),v=O(U)}},m=Fn(x).getInstance(),b=ap(x).getInstance(),T=(0,l.default)(x).getInstance(),R(),p}Tc.__dashjs_factory_name="DashAdapter";var pp=n.default.getSingletonFactory(Tc);class yp{static round10(m,b){return(function(T,v,S){return S===void 0||+S==0?Math[T](v):(S=+S,(v=+v)===null||isNaN(v)||typeof S!="number"||S%1!=0?NaN:(v=v.toString().split("e"),+((v=(v=Math[T](+(v[0]+"e"+(v[1]?+v[1]-S:-S)))).toString().split("e"))[0]+"e"+(v[1]?+v[1]+S:S))))})("round",m,b)}}var Ep=class{constructor(){this.TcpList=[],this.HttpList=[],this.RepSwitchList=[],this.BufferLevel=[],this.BufferState=[],this.PlayList=[],this.DroppedFrames=[],this.SchedulingInfo=[],this.DVRInfo=[],this.ManifestUpdate=[],this.RequestsQueue=null,this.DVBErrors=[]}},bp=class{constructor(){this.t=null,this.mt=null,this.to=null,this.lto=null}},Tp=class{constructor(){this.t=null,this.level=null}},vp=class{constructor(){this.target=null,this.state=i.BUFFER_EMPTY}},Sp=class{constructor(){this.time=null,this.range=null,this.manifestInfo=null}},_p=class{constructor(){this.time=null,this.droppedFrames=null}};class Ap{constructor(){this.mediaType=null,this.type=null,this.requestTime=null,this.fetchTime=null,this.availabilityStartTime=null,this.presentationStartTime=0,this.clientTimeOffset=0,this.currentTime=null,this.buffered=null,this.latency=0,this.streamInfo=[],this.representationInfo=[]}}class Ip{constructor(){this.id=null,this.index=null,this.start=null,this.duration=null}}class xp{constructor(){this.id=null,this.index=null,this.mediaType=null,this.presentationTimeOffset=null,this.startNumber=null}}var wp=class{constructor(){this.mediaType=null,this.t=null,this.type=null,this.startTime=null,this.availabilityStartTime=null,this.duration=null,this.bandwidth=null,this.range=null,this.state=null}},Rp=class{constructor(){this.loadingRequests=[],this.executedRequests=[]}};function vc(p){const m=(p=p||{}).settings;let b,T,v=this.context,S=(0,g.default)(v).getInstance();function k(){S.trigger(f.default.METRICS_CHANGED)}function x(C){S.trigger(f.default.METRIC_CHANGED,{mediaType:C}),k()}function I(C,B,$){S.trigger(f.default.METRIC_UPDATED,{mediaType:C,metric:B,value:$}),x(C)}function N(C,B,$){S.trigger(f.default.METRIC_ADDED,{mediaType:C,metric:B,value:$}),x(C)}function O(C,B){let $=null;return C&&(T.hasOwnProperty(C)?$=T[C]:B||($=new Ep,T[C]=$)),$}function A(C,B,$){let V=O(C);V!==null&&(V[B].push($),V[B].length>m.get().streaming.metrics.maxListDepth&&V[B].shift())}function R(C,B,$){A(C,B,$),N(C,B,$)}return b={addBufferLevel:function(C,B,$){let V=new Tp;V.t=B,V.level=$,R(C,i.BUFFER_LEVEL,V)},addBufferState:function(C,B,$){let V=new vp;V.target=$,V.state=B,R(C,i.BUFFER_STATE,V)},addDVBErrors:function(C){R(h.default.STREAM,i.DVB_ERRORS,C)},addDVRInfo:function(C,B,$,V){let j=new Sp;j.time=B,j.range=V,j.manifestInfo=$,R(C,i.DVR_INFO,j)},addDroppedFrames:function(C,B){let $=new _p,V=O(C).DroppedFrames;B&&($.time=B.creationTime,$.droppedFrames=B.droppedVideoFrames,V.length>0&&V[V.length-1]==$||R(C,i.DROPPED_FRAMES,$))},addHttpRequest:function C(B,$,V,j){let te=new ke.HTTPRequest;$.url&&$.url!==B.url&&(C({mediaType:B.mediaType,type:B.type,url:B.url,serviceLocation:null,range:B.range,startDate:B.startDate,firstByteDate:null,endDate:null,duration:B.duration,fileLoaderType:B.fileLoaderType,resourceTimingValues:B.resourceTimingValues},{url:null,status:null,headers:null},null,j),te.actualurl=$.url),te.tcpid=null,te.type=B.type,te.url=B.url,te.range=B.range||null,te.trequest=B.startDate,te.tresponse=B.firstByteDate,te.responsecode=$.status,te.cmsd=j,te._tfinish=B.endDate,te._stream=B.mediaType,te._mediaduration=B.duration,te._responseHeaders="";for(const ie in $.headers)te._responseHeaders+=ie+": "+$.headers[ie]+`\r
|
|
50
|
+
`;te._serviceLocation=B.serviceLocation||null,te._fileLoaderType=B.fileLoaderType,te._resourceTimingValues=B.resourceTimingValues,te._streamId=B&&B.representation&&B.representation.mediaInfo&&B.representation.mediaInfo.streamInfo?B.representation.mediaInfo.streamInfo.id:null,V?V.forEach((ie=>{(function(se,de,G,U){let P=new ke.HTTPRequestTrace;P.s=de,P.d=G,P.b=U,se.trace.push(P),se.interval||(se.interval=0),se.interval+=G})(te,ie.s,ie.d,ie.b,ie.t)})):(delete te.interval,delete te.trace),R(B.mediaType,i.HTTP_REQUEST,te)},addManifestUpdate:function(C,B,$,V){let j=new Ap;j.mediaType=C,j.type=B,j.requestTime=$,j.fetchTime=V,A(h.default.STREAM,i.MANIFEST_UPDATE,j),N(C,i.MANIFEST_UPDATE,j)},addManifestUpdateRepresentationInfo:function(C,B,$){if(C&&C.representationInfo){const V=new xp;V.id=B?B.id:null,V.index=B?B.index:null,V.mediaType=$,V.startNumber=B?B.startNumber:null,V.presentationTimeOffset=B?B.presentationTimeOffset:null,C.representationInfo.push(V),I(C.mediaType,i.MANIFEST_UPDATE_TRACK_INFO,C)}},addManifestUpdateStreamInfo:function(C,B,$,V,j){if(C){let te=new Ip;te.id=B,te.index=$,te.start=V,te.duration=j,C.streamInfo.push(te),I(C.mediaType,i.MANIFEST_UPDATE_STREAM_INFO,C)}},addPlayList:function(C){C.trace&&Array.isArray(C.trace)?C.trace.forEach((B=>{B.hasOwnProperty("subreplevel")&&!B.subreplevel&&delete B.subreplevel})):delete C.trace,R(h.default.STREAM,i.PLAY_LIST,C)},addRepresentationSwitch:function(C,B,$,V,j){let te=new bp;te.t=B,te.mt=$,te.to=V,j?te.lto=j:delete te.lto,R(C,i.TRACK_SWITCH,te)},addRequestsQueue:function(C,B,$){let V=new Rp;V.loadingRequests=B,V.executedRequests=$,O(C).RequestsQueue=V,N(C,i.REQUESTS_QUEUE,V)},addSchedulingInfo:function(C,B,$,V,j,te,ie,se,de){let G=new wp;G.mediaType=C,G.t=B,G.type=$,G.startTime=V,G.availabilityStartTime=j,G.duration=te,G.bandwidth=ie,G.range=se,G.state=de,R(C,i.SCHEDULING_INFO,G)},clearAllCurrentMetrics:function(){T={},k()},clearCurrentMetricsForType:function(C){delete T[C],x(C)},getMetricsFor:O,updateManifestUpdateInfo:function(C,B){if(C){for(let $ in B)C[$]=B[$];I(C.mediaType,i.MANIFEST_UPDATE,C)}}},T={},b}vc.__dashjs_factory_name="MetricsModel";var kp=n.default.getSingletonFactory(vc);class zi{constructor(){this.start=null,this.mstart=null,this.starttype=null,this.trace=[]}}zi.INITIAL_PLAYOUT_START_REASON="initial_playout",zi.SEEK_START_REASON="seek",zi.RESUME_FROM_PAUSE_START_REASON="resume",zi.METRICS_COLLECTION_START_REASON="metrics_collection_start";class Rr{constructor(){this.representationid=null,this.subreplevel=null,this.start=null,this.mstart=null,this.duration=null,this.playbackspeed=null,this.stopreason=null}}function Sc(p){p=p||{};const m=this.context;let b,T,v,S,k=p.metricsModel;function x(O){const A=k.getMetricsFor(O,!0);if(!A)return null;const R=A.HttpList;let C,B=null;if(!R||R.length<=0)return null;for(C=R.length-1;C>=0;){if(R[C].responsecode){B=R[C];break}C--}return B}function I(O){const A=k.getMetricsFor(O,!0);return A&&A.HttpList?A.HttpList:[]}function N(O,A){if(!O)return null;const R=O[A];return R&&R.length!==0?R[R.length-1]:null}return b={getCurrentRepresentationSwitch:function(O){return N(k.getMetricsFor(O,!0),i.TRACK_SWITCH)},getCurrentBufferState:function(O){return N(k.getMetricsFor(O,!0),i.BUFFER_STATE)},getCurrentBufferLevel:function(O){const A=N(k.getMetricsFor(O,!0),i.BUFFER_LEVEL);return A?yp.round10(A.level/1e3,-3):0},getCurrentHttpRequest:x,getHttpRequests:I,getCurrentDroppedFrames:function(){return N(k.getMetricsFor(h.default.VIDEO,!0),i.DROPPED_FRAMES)},getCurrentSchedulingInfo:function(O){return N(k.getMetricsFor(O,!0),i.SCHEDULING_INFO)},getCurrentDVRInfo:function(O){return N(O?k.getMetricsFor(O,!0):k.getMetricsFor(h.default.VIDEO,!0)||k.getMetricsFor(h.default.AUDIO,!0),i.DVR_INFO)},getCurrentManifestUpdate:function(){return N(k.getMetricsFor(h.default.STREAM),i.MANIFEST_UPDATE)},getLatestFragmentRequestHeaderValueByID:function(O,A){if(!A)return null;let R={},C=x(O);C&&(R=Je.default.parseHttpHeaders(C._responseHeaders));const B=R[A.toLowerCase()];return B===void 0?null:B},getLatestMPDRequestHeaderValueByID:function(O){if(!O)return null;let A,R,C,B={};for(A=I(h.default.STREAM),C=A.length-1;C>=0;C--)if(R=A[C],R.type===ke.HTTPRequest.MPD_TYPE){B=Je.default.parseHttpHeaders(R._responseHeaders);break}const $=B[O.toLowerCase()];return $===void 0?null:$},addRepresentationSwitch:function(O,A,R,C,B){k.addRepresentationSwitch(O,A,R,C,B)},addDVRInfo:function(O,A,R,C){k.addDVRInfo(O,A,R,C)},updateManifestUpdateInfo:function(O){const A=this.getCurrentManifestUpdate();k.updateManifestUpdateInfo(A,O)},addManifestUpdateStreamInfo:function(O){if(O){const A=this.getCurrentManifestUpdate();k.addManifestUpdateStreamInfo(A,O.id,O.index,O.start,O.duration)}},addManifestUpdateRepresentationInfo:function(O,A){if(O){const R=this.getCurrentManifestUpdate();k.addManifestUpdateRepresentationInfo(R,O,A)}},addManifestUpdate:function(O){k.addManifestUpdate(h.default.STREAM,O.type,O.startDate,O.endDate)},addHttpRequest:function(O,A,R,C,B,$){const V={status:R,headers:C,url:A};k.addHttpRequest(O,V,B,$)},addSchedulingInfo:function(O,A){k.addSchedulingInfo(O.mediaType,new Date,O.type,O.startTime,O.availabilityStartTime,O.duration,O.bandwidth,O.range,A)},addRequestsQueue:function(O,A,R){k.addRequestsQueue(O,A,R)},addBufferLevel:function(O,A,R){k.addBufferLevel(O,A,R)},addBufferState:function(O,A,R){k.addBufferState(O,A,R)},addDroppedFrames:function(O){k.addDroppedFrames(h.default.VIDEO,O)},addPlayList:function(){S&&(k.addPlayList(S),S=null)},addDVBErrors:function(O){k.addDVBErrors(O)},createPlaylistMetrics:function(O,A){S=new zi,S.start=new Date,S.mstart=O,S.starttype=A},createPlaylistTraceMetrics:function(O,A,R){T===!0&&(T=!1,v=new Rr,v.representationid=O,v.start=new Date,v.mstart=A,v.playbackspeed=R!==null?R.toString():null)},updatePlayListTraceMetrics:function(O){if(v)for(let A in v)v[A]=O[A]},pushPlayListTraceMetrics:function(O,A){if(T===!1&&S&&v&&v.start){const R=v.start;v.duration=O.getTime()-R.getTime(),v.stopreason=A,S.trace.push(v),T=!0}},clearAllCurrentMetrics:function(){k.clearAllCurrentMetrics()}},k=k||kp(m).getInstance({settings:p.settings}),T=!0,v=null,S=null,b}Rr.REPRESENTATION_SWITCH_STOP_REASON="representation_switch",Rr.REBUFFERING_REASON="rebuffering",Rr.USER_REQUEST_STOP_REASON="user_request",Rr.END_OF_PERIOD_STOP_REASON="end_of_period",Rr.END_OF_CONTENT_STOP_REASON="end_of_content",Rr.METRICS_COLLECTION_STOP_REASON="metrics_collection_end",Rr.FAILURE_STOP_REASON="failure",Sc.__dashjs_factory_name="DashMetrics";var Cp=n.default.getSingletonFactory(Sc);function _c(){let p;const m=this.context,b=(0,g.default)(m).getInstance();return p={error:function(T){b.trigger(f.default.ERROR,{error:T})}},p}_c.__dashjs_factory_name="ErrorHandler";var Lp=n.default.getSingletonFactory(_c),Dp=t(5560);function Ac(){const p=this.context,m=(0,g.default)(p).getInstance();let b,T,v,S,k,x,I,N,O,A,R,C;function B(){C.debug("Stopping the gap controller"),k&&(clearInterval(k),k=null),(function(){m.off(f.default.WALLCLOCK_TIME_UPDATED,ie,this),m.off(f.default.INITIAL_STREAM_SWITCH,te,this),m.off(f.default.PLAYBACK_SEEKING,$,this),m.off(f.default.BUFFER_REPLACEMENT_STARTED,V,b),m.off(f.default.TRACK_CHANGE_RENDERED,j,b)})(),k=null,x=NaN,S=0,A=null,R={}}function $(){A&&(clearTimeout(A),A=null)}function V(G){try{if(G.streamId!==N.getActiveStreamInfo().id||G.mediaType!==h.default.VIDEO&&G.mediaType!==h.default.AUDIO)return;G.streamId===N.getActiveStreamInfo().id&&(R[G.mediaType]=!0)}catch(U){C.error(U)}}function j(G){G&&G.mediaType&&(R[G.mediaType]=!1)}function te(){k||(function(){try{k||(C.debug("Starting the gap controller"),k=setInterval((()=>{se()&&de(I.getTime())}),100))}catch{}})()}function ie(){if(se(v.get().streaming.gaps.enableSeekFix)&&(S++,S>=10)){const G=I.getTime();T===G?de(G,!0):(T=G,x=NaN),S=0}}function se(G=!1){if(!N.getActiveStream())return!1;const U=Object.keys(R).some((M=>R[M])),P=!!G&&(function(){const M=N.getActiveStream(),ge=parseFloat((M.getStartTime()+M.getDuration()).toFixed(5));return I.getTime()+v.get().streaming.gaps.threshold>=ge})();return!U&&v.get().streaming.gaps.jumpGaps&&N.getActiveStreamProcessors().length>0&&(!I.isSeeking()||P)&&!I.isPaused()&&!N.getIsStreamSwitchInProgress()&&!N.getHasMediaOrInitialisationError()}function de(G,U=!1){const P=v.get().streaming.gaps.enableStallFix,M=v.get().streaming.gaps.stallSeek,ge=v.get().streaming.gaps.smallGapLimit,X=v.get().streaming.gaps.jumpLargeGaps,be=v.get().streaming.gaps.seekOffset,fe=O.getBufferRange();let Te,Ce=NaN,Ie=!1;if(Te=(function(W,re){try{if(!W||W.length<=1&&re>0)return NaN;let ee=NaN,ne=0;for(;isNaN(ee)&&ne<W.length;){const le=ne>0?W.end(ne-1):0;re<W.start(ne)&&le-re<v.get().streaming.gaps.threshold&&(ee=ne),ne+=1}return ee}catch{return null}})(fe,G),!isNaN(Te)){const W=fe.start(Te),re=W-G;re>0&&(re<=ge||X)&&(Ce=W)}const q=I.getTimeToStreamEnd();if(isNaN(Ce)&&U&&isFinite(q)&&!isNaN(q)&&q<ge&&(Ce=parseFloat(I.getStreamEndTime().toFixed(5)),Ie=!0),P&&isNaN(Ce)&&U&&isNaN(Te)&&(function(W,re){for(let ee=0,ne=W.length;ee<ne;ee++)if(re>=W.start(ee)&&re<=W.end(ee))return!0;return!1})(fe,G)&&(M===0?(C.warn("Toggle play pause to break stall"),O.pause(),O.play()):(C.warn(`Jumping ${M}s to break stall`),Ce=G+M)),Ce>0&&x!==Ce&&Ce>G&&!A){const W=Ce-G;if(Ie){const re=N.getStreamForTime(Ce),ee=re&&!!re.getPreloaded();C.warn(`Jumping to end of stream because of gap from ${G} to ${Ce}. Gap duration: ${W}`),I.seek(Ce+be,!0,ee)}else{const re=I.getIsDynamic(),ee=Te>0?fe.end(Te-1):G,ne=re?1e3*Math.max(0,W-.1):0;A=window.setTimeout((()=>{I.seek(Ce+be,!0,!0);const le=N.getActiveStream();le&&C.warn(`Jumping gap occuring in period ${le.getStreamId()} starting at ${ee} and ending at ${Ce}. Jumping by: ${Ce+be-ee}`),A=null}),ne)}x=Ce}}return b={reset:B,setConfig:function(G){G&&(G.settings&&(v=G.settings),G.playbackController&&(I=G.playbackController),G.streamController&&(N=G.streamController),G.videoModel&&(O=G.videoModel))},initialize:function(){(function(){m.on(f.default.WALLCLOCK_TIME_UPDATED,ie,this),m.on(f.default.INITIAL_STREAM_SWITCH,te,this),m.on(f.default.PLAYBACK_SEEKING,$,this),m.on(f.default.BUFFER_REPLACEMENT_STARTED,V,b),m.on(f.default.TRACK_CHANGE_RENDERED,j,b)})()}},C=(0,o.default)(p).getInstance().getLogger(b),B(),b}Ac.__dashjs_factory_name="GapController";var Pp=n.default.getSingletonFactory(Ac),Ic=class extends oe{constructor(p,m){super(),this.url=p||null,this.type=m||null,this.mediaType=h.default.STREAM,this.responseType=""}};function xc(p){p=p||{};const m=this.context,b=(0,g.default)(m).getInstance();let T,v=ca(m).create({errHandler:p.errHandler,dashMetrics:p.dashMetrics,mediaPlayerModel:p.mediaPlayerModel,errors:Jt});return T={load:function(S,k,x){const I=function(N,O){k.resolved=!0,k.resolvedContent=N||null,b.trigger(f.default.XLINK_ELEMENT_LOADED,{element:k,resolveObject:x,error:N||O?null:new Wt.default(Jt.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE,Jt.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE+S)})};if(S==="urn:mpeg:dash:resolve-to-zero:2013")I(null,!0);else{const N=new Ic(S,ke.HTTPRequest.XLINK_EXPANSION_TYPE);v.load({request:N,success:function(O){I(O)},error:function(){I(null)}})}},reset:function(){v&&(v.abort(),v=null)}},T}xc.__dashjs_factory_name="XlinkLoader";var Np=n.default.getClassFactory(xc);const ha="onLoad";function wc(p){p=p||{};let m=this.context,b=(0,g.default)(m).getInstance();const T=Vn(m).getInstance();let v,S,k,x;function I(C,B,$){let V,j,te={};te.elements=C,te.type=B,te.resolveType=$,te.elements.length===0&&O(te);for(let ie=0;ie<te.elements.length;ie++)V=te.elements[ie],j=T.isHTTPURL(V.url)?V.url:V.originalContent.BaseURL+V.url,x.load(j,V,te)}function N(C){let B,$,V="";if(B=C.element,$=C.resolveObject,B.resolvedContent){let j=0;B.resolvedContent.indexOf("<?xml")===0&&(j=B.resolvedContent.indexOf("?>")+2),V=B.resolvedContent.substr(0,j)+"<response>"+B.resolvedContent.substr(j)+"</response>",B.resolvedContent=S.parseXml(V).response}(function(j){let te,ie;for(te=0;te<j.elements.length;te++)if(ie=j.elements[te],ie.resolved===!1)return!1;return!0})($)&&O($)}function O(C){let B,$,V=[];if((function(j){let te,ie,se,de,G,U,P=[];for(de=j.elements.length-1;de>=0;de--){if(te=j.elements[de],ie=te.type,te.resolvedContent){if(te.resolvedContent)for(G=0;G<te.resolvedContent[ie].length;G++)se=te.resolvedContent[ie][G],P.push(se)}else delete te.originalContent["xlink:actuate"],delete te.originalContent["xlink:href"],P.push(te.originalContent);for(te.parentElement[ie].splice(te.index,1),U=0;U<P.length;U++)te.parentElement[ie].splice(te.index+U,0,P[U]);P=[]}j.elements.length>0&&S.getIron().run(k)})(C),C.resolveType==="onActuate"&&b.trigger(f.default.XLINK_READY,{manifest:k}),C.resolveType===ha)switch(C.type){case ye.default.PERIOD:for(B=0;B<k[ye.default.PERIOD].length;B++)$=k[ye.default.PERIOD][B],$.hasOwnProperty(ye.default.ADAPTATION_SET)&&(V=V.concat(A($[ye.default.ADAPTATION_SET],$,ye.default.ADAPTATION_SET,ha))),$.hasOwnProperty(ye.default.EVENT_STREAM)&&(V=V.concat(A($[ye.default.EVENT_STREAM],$,ye.default.EVENT_STREAM,ha)));I(V,ye.default.ADAPTATION_SET,ha);break;case ye.default.ADAPTATION_SET:b.trigger(f.default.XLINK_READY,{manifest:k})}}function A(C,B,$,V){let j,te,ie,se=[];for(te=C.length-1;te>=0;te--)j=C[te],j.hasOwnProperty("xlink:href")&&j["xlink:href"]==="urn:mpeg:dash:resolve-to-zero:2013"&&C.splice(te,1);for(te=0;te<C.length;te++)j=C[te],j.hasOwnProperty("xlink:href")&&j.hasOwnProperty("xlink:actuate")&&j["xlink:actuate"]===V&&(ie=R(j["xlink:href"],B,$,te,V,j),se.push(ie));return se}function R(C,B,$,V,j,te){return{url:C,parentElement:B,type:$,index:V,resolveType:j,originalContent:te,resolvedContent:null,resolved:!1}}return v={resolveManifestOnLoad:function(C){let B;k=C,k.Period?(B=A(k.Period,k,ye.default.PERIOD,ha),I(B,ye.default.PERIOD,ha)):b.trigger(f.default.XLINK_READY,{manifest:k})},setParser:function(C){C&&(S=C)},reset:function(){b.off(f.default.XLINK_ELEMENT_LOADED,N,v),x&&(x.reset(),x=null)}},b.on(f.default.XLINK_ELEMENT_LOADED,N,v),x=Np(m).create({errHandler:p.errHandler,dashMetrics:p.dashMetrics,mediaPlayerModel:p.mediaPlayerModel,settings:p.settings}),v}wc.__dashjs_factory_name="XlinkController";var Mp=n.default.getClassFactory(wc);function Rc(p){function m(v,S){for(let k in v)S.hasOwnProperty(k)||(S[k]=v[k])}function b(v,S,k){for(let x=0,I=v.length;x<I;++x){const N=v[x];if(S[N.name])if(k[N.name]){if(N.merge){const O=S[N.name],A=k[N.name];typeof O=="object"&&typeof A=="object"?m(O,A):k[N.name]=O+A}}else k[N.name]=S[N.name]}}function T(v,S){for(let k=0,x=v.children.length;k<x;++k){const I=v.children[k],N=S[I.name];if(N)for(let O=0,A=N.length;O<A;++O){const R=N[O];b(v.properties,S,R),T(I,R)}}}return{run:function(v){if(v===null||typeof v!="object")return v;if(v.Period&&"period"in p){const S=p.period,k=v.Period;for(let x=0,I=k.length;x<I;++x){const N=k[x];if(T(S,N),"adaptationset"in p){const O=N.AdaptationSet;if(O){const A=p.adaptationset;for(let R=0,C=O.length;R<C;++R)T(A,O[R])}}}}return v}}}Rc.__dashjs_factory_name="ObjectIron";var Op=n.default.getClassFactory(Rc),xs=class{constructor(p,m){this._test=p,this._converter=m}get test(){return this._test}get converter(){return this._converter}};const kc=/^([-])?P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/;var Fp=class extends xs{constructor(){super(((p,m,b)=>{const T=[ye.default.MIN_BUFFER_TIME,ye.default.MEDIA_PRESENTATION_DURATION,ye.default.MINIMUM_UPDATE_PERIOD,ye.default.TIMESHIFT_BUFFER_DEPTH,ye.default.MAX_SEGMENT_DURATION,ye.default.MAX_SUBSEGMENT_DURATION,ye.default.SUGGESTED_PRESENTATION_DELAY,ye.default.START,h.default.START_TIME,ye.default.DURATION],v=T.length;for(let S=0;S<v;S++)if(m===T[S])return kc.test(b);return!1}),(p=>{const m=kc.exec(p);let b=31536e3*parseFloat(m[3]||0)+2592e3*parseFloat(m[5]||0)+86400*parseFloat(m[7]||0)+3600*parseFloat(m[9]||0)+60*parseFloat(m[11]||0)+parseFloat(m[13]||0);return m[1]!==void 0&&(b=-b),b}))}};const Cc=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+-])([0-9]{2})(?::?)([0-9]{2}))?/;var Up=class extends xs{constructor(){super(((p,m,b)=>Cc.test(b)),(p=>{const m=Cc.exec(p);let b;if(b=Date.UTC(parseInt(m[1],10),parseInt(m[2],10)-1,parseInt(m[3],10),parseInt(m[4],10),parseInt(m[5],10),m[6]&&parseInt(m[6],10)||0,m[7]&&1e3*parseFloat(m[7])||0),m[9]&&m[10]){const T=60*parseInt(m[9],10)+parseInt(m[10],10);b+=(m[8]==="+"?-1:1)*T*60*1e3}return new Date(b)}))}};const zp=/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/,Bp=[ye.default.ID];var jp=class extends xs{constructor(){super(((p,m,b)=>zp.test(b)&&Bp.indexOf(m)===-1),(p=>parseFloat(p)))}},qp=class extends xs{constructor(){super(((p,m)=>{const b={[ye.default.ADAPTATION_SET]:[ye.default.LANG],[ye.default.REPRESENTATION]:[ye.default.LANG],[ye.default.CONTENT_COMPONENT]:[ye.default.LANG],[ye.default.LABEL]:[ye.default.LANG],[ye.default.GROUP_LABEL]:[ye.default.LANG]};if(b.hasOwnProperty(p)){let T=b[p];return T!==void 0&&T.indexOf(m)>=0}return!1}),(p=>As(p)||String(p)))}},Gp=class{constructor(p){var m;this._name=p,this._merge=(m=p)&&m.length&&m.charAt(0)===m.charAt(0).toUpperCase()}get name(){return this._name}get merge(){return this._merge}},ga=class{constructor(p,m,b){this._name=p||"",this._properties=[],this._children=b||[],Array.isArray(m)&&m.forEach((T=>{this._properties.push(new Gp(T))}))}get name(){return this._name}get children(){return this._children}get properties(){return this._properties}},$p=class extends ga{constructor(){const p=[ye.default.AUDIO_CHANNEL_CONFIGURATION,ye.default.AUDIO_SAMPLING_RATE,ye.default.CODECS,ye.default.CODING_DEPENDENCY,ye.default.CONTENT_PROTECTION,ye.default.FRAMERATE,ye.default.FRAME_PACKING,ye.default.HEIGHT,ye.default.INBAND_EVENT_STREAM,ye.default.MAXIMUM_SAP_PERIOD,ye.default.MAX_PLAYOUT_RATE,ye.default.MIME_TYPE,ye.default.PROFILES,ye.default.SAR,ye.default.SCAN_TYPE,ye.default.SEGMENT_PROFILES,ye.default.SEGMENT_SEQUENCE_PROPERTIES,ye.default.START_WITH_SAP,ye.default.WIDTH];super(ye.default.ADAPTATION_SET,p,[new ga(ye.default.REPRESENTATION,p,[new ga(ye.default.SUB_REPRESENTATION,p)])])}},Vp=class extends ga{constructor(){const p=[ye.default.SEGMENT_BASE,ye.default.SEGMENT_TEMPLATE,ye.default.SEGMENT_LIST];super(ye.default.PERIOD,p,[new ga(ye.default.ADAPTATION_SET,p,[new ga(ye.default.REPRESENTATION,p)])])}};const Hp=[ye.default.ACCESSIBILITY,ye.default.ADAPTATION_SET,ye.default.ADD,ye.default.AUDIO_CHANNEL_CONFIGURATION,ye.default.BASE_URL,ye.default.CONTENT_COMPONENT,ye.default.CONTENT_PROTECTION,ye.default.CONTENT_STEERING,ye.default.ESSENTIAL_PROPERTY,ye.default.EVENT,ye.default.EVENT_STREAM,ye.default.INBAND_EVENT_STREAM,ye.default.LABEL,ye.default.LOCATION,ye.default.METRICS,ye.default.PATCH_LOCATION,ye.default.PERIOD,ye.default.PRESELECTION,ye.default.PRODUCER_REFERENCE_TIME,ye.default.REMOVE,ye.default.REPLACE,ye.default.REPORTING,ye.default.REPRESENTATION,ye.default.ROLE,ye.default.S,ye.default.SEGMENT_SEQUENCE_PROPERTIES,ye.default.SEGMENT_URL,ye.default.SERVICE_DESCRIPTION,ye.default.SUPPLEMENTAL_PROPERTY,ye.default.UTC_TIMING];function Lc(p){p=p||{};const m=this.context,b=p.debug;let T,v,S,k;function x(I){try{const N=(function(O){const A=(function(C,B={}){let $=B.pos||0;const V=C.length,j=!!B.keepComments,te=!!B.keepWhitespace,ie="<",se=60,de=">",G=62,U=45,P=47,M=63,ge=33,X=39,be=34,fe=91,Te=93,Ce=`\r
|
|
51
|
+
>/= `;function Ie(le,z="#text"){return{nodeName:z,nodeValue:le,attributes:{},childNodes:[]}}function q(le=""){const z=[];for(;C[$];)if(C.charCodeAt($)==se){if(C.charCodeAt($+1)===P){const me=$+2;if($=C.indexOf(de,$),!C.startsWith(le,me)){const Se=C.substring(0,$).split(`
|
|
52
|
+
`);throw new Error(`Unexpected close tag
|
|
53
|
+
Line: `+(Se.length-1)+`
|
|
54
|
+
Column: `+(Se[Se.length-1].length+1)+`
|
|
55
|
+
Char: `+C[$])}return $+1&&($+=1),z}if(C.charCodeAt($+1)===M){$=C.indexOf(de,$),$++;continue}if(C.charCodeAt($+1)===ge){if(C.charCodeAt($+2)==U){const me=$;for(;$!==-1&&(C.charCodeAt($)!==G||C.charCodeAt($-1)!=U||C.charCodeAt($-2)!=U||$==-1);)$=C.indexOf(de,$+1);$===-1&&($=V),j&&z.push(Ie(C.substring(me,$+1),"#comment"))}else{if(C.charCodeAt($+2)===fe&&C.charCodeAt($+8)===fe&&C.startsWith("CDATA",$+3)){const me=C.indexOf("]]>",$);me==-1?(z.push(Ie(C.substr($+9),"#cdata")),$=V):(z.push(Ie(C.substring($+9,me),"#cdata")),$=me+3);continue}{const me=$+1;$+=2;let Se=!1;for(;(C.charCodeAt($)!==G||Se===!0)&&C[$];)C.charCodeAt($)===fe?Se=!0:Se===!0&&C.charCodeAt($)===Te&&(Se=!1),$++;z.push(Ie(C.substring(me,$),"#doctype"))}}$++;continue}const ce=ee();z.push(ce)}else{const ce=W();if(te)ce.length>0&&z.push(Ie(ce));else{const me=ce.trim();me.length>0&&z.push(Ie(me))}$++}return z}function W(){const le=$;return $=C.indexOf(ie,$)-1,$===-2&&($=V),Xi(C.slice(le,$+1))}function re(){const le=$;for(;Ce.indexOf(C[$])===-1&&C[$];)$++;return C.slice(le,$)}function ee(){$++;const le=re();let z=le,ce=null;const me=le.indexOf(":");me!==-1&&(ce=le.slice(0,me),z=le.slice(me+1));const Se=(function(){const ze={};for(;C.charCodeAt($)!==G&&C[$];){const Ye=C.charCodeAt($);if(Ye>64&&Ye<91||Ye>96&&Ye<123){const ct=re();let bt="",Zt=C.charCodeAt($);for(;Zt!==X&&Zt!==be;)$++,Zt=C.charCodeAt($);if(Zt===X||Zt===be){if(bt=ne(),$===-1)throw new Error("Missing closing quote")}else $--;ze[ct]=Xi(bt)}$++}return ze})();let Re=[];const we=C.charCodeAt($-1);return $++,we!==P&&(Re=q(le)),{nodeName:le,nodeValue:null,attributes:Se,childNodes:Re,prefix:ce,localName:z}}function ne(){const le=C[$],z=$+1;return $=C.indexOf(le,z),C.slice(z,$)}return{nodeName:"#document",nodeValue:null,childNodes:q(""),attributes:{}}})(O),R=A.childNodes.find((C=>C.nodeName==="MPD"||C.nodeName==="Patch"))||A.childNodes[0];return(function C(B){B.nodeName.indexOf(":")!==-1&&(B.__prefix=B.prefix,B.nodeName=B.localName);const{childNodes:$,attributes:V,nodeName:j}=B;B.tagName=j;for(let ie in V){let se=V[ie];if(j==="S")se=parseInt(se);else for(let de=0,G=S.length;de<G;de++){const U=S[de];if(U.test(j,ie,se)){se=U.converter(se);break}}B[ie]=se}const te=$?.length;for(let ie=0;ie<te;ie++){const se=$[ie];if(se.nodeName==="#text"){B.__text=se.nodeValue;continue}C(se);const{nodeName:de}=se;Array.isArray(B[de])?B[de].push(se):Hp.indexOf(de)!==-1?(B[de]||(B[de]=[]),B[de].push(se)):B[de]=se}B.__children=$})(R),R})(I);return{[N.tagName]:N}}catch{return null}}return T={getIron:function(){return k},parseXml:x,parse:function(I){let N;const O=window.performance.now();if(N=x(I),!N)throw new Error("failed to parse the manifest");N.Patch?(N=N.Patch,N.add&&N.add.forEach((R=>k.run(R))),N.replace&&N.replace.forEach((R=>k.run(R)))):(N=N.MPD,k.run(N));const A=window.performance.now();return v.info("Parsing complete: "+(A-O).toPrecision(3)+"ms"),N.protocol="DASH",N}},v=b.getLogger(T),S=[new Fp,new Up,new jp,new qp],k=Op(m).create({adaptationset:new $p,period:new Vp}),T}Lc.__dashjs_factory_name="DashParser";var Kp=n.default.getClassFactory(Lc);function Dc(p){p=p||{};const m=this.context,b=p.debug,T=p.settings,v=(0,g.default)(m).getInstance(),S=Vn(m).getInstance();let k,x,I,N,O,A=p.mssHandler,R=p.errHandler;function C(B){v.trigger(f.default.INTERNAL_MANIFEST_LOADED,{manifest:B.manifest})}return k={load:function(B,$=null,V=null){const j=new Date,te=new Ic(B,ke.HTTPRequest.MPD_TYPE);$&&(te.serviceLocation=$),V&&(te.queryParams=V),te.startDate||(te.startDate=j),v.trigger(f.default.MANIFEST_LOADING_STARTED,{request:te}),I.load({request:te,success:function(ie,se,de){if(!N)return;let G,U,P;if(de&&de!==B?(U=S.parseBaseUrl(de),G=de):(S.isRelative(B)&&(B=S.resolve(B,window.location.href)),U=S.parseBaseUrl(B)),se!="No Content")if(O===null&&(O=(function(M){let ge=null;return M.indexOf("SmoothStreamingMedia")>-1?(A&&(ge=A.createMssParser(),A.createMssFragmentProcessor(),A.registerEvents()),ge):M.indexOf("MPD")>-1||M.indexOf("Patch")>-1?Kp(m).create({debug:b}):ge})(ie)),O!==null){N.setParser(O);try{P=O.parse(ie)}catch{return void v.trigger(f.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new Wt.default(Jt.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,Jt.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+`${B}`)})}if(P){if(P.url=G||B,P.originalUrl||(P.originalUrl=P.url),T&&T.get().streaming.enableManifestDurationMismatchFix&&P.mediaPresentationDuration&&P.Period.length>1){const M=P.Period.reduce(((ge,X)=>ge+X.duration),0);!isNaN(M)&&P.mediaPresentationDuration>M&&(x.warn("Media presentation duration greater than duration of all periods. Setting duration to total period duration"),P.mediaPresentationDuration=M)}P.baseUri=U,P.loadedTime=new Date,N.resolveManifestOnLoad(P),v.trigger(f.default.ORIGINAL_MANIFEST_LOADED,{originalManifest:ie})}else v.trigger(f.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new Wt.default(Jt.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,Jt.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+`${B}`)})}else v.trigger(f.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new Wt.default(Jt.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,Jt.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+`${B}`)});else v.trigger(f.default.INTERNAL_MANIFEST_LOADED,{manifest:null})},error:function(ie,se,de){v.trigger(f.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new Wt.default(Jt.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE,Jt.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE+`${B}, ${de}`)})}})},reset:function(){v.off(f.default.XLINK_READY,C,k),A&&A.reset(),N&&(N.reset(),N=null),I&&(I.abort(),I=null)}},x=b.getLogger(k),v.on(f.default.XLINK_READY,C,k),I=ca(m).create({errHandler:p.errHandler,dashMetrics:p.dashMetrics,mediaPlayerModel:p.mediaPlayerModel,urlUtils:S,constants:h.default,dashConstants:ye.default,errors:Jt,requestTimeout:p.settings.get().streaming.manifestRequestTimeout}),N=Mp(m).create({errHandler:R,dashMetrics:p.dashMetrics,mediaPlayerModel:p.mediaPlayerModel,settings:p.settings}),O=null,k}Dc.__dashjs_factory_name="ManifestLoader";var Yp=n.default.getClassFactory(Dc);function Pc(){let p,m,b=this.context,T=(0,g.default)(b).getInstance();return p={getValue:function(){return m},setValue:function(v){m=v,v&&T.trigger(f.default.MANIFEST_LOADED,{data:v})}},p}Pc.__dashjs_factory_name="ManifestModel";var Wp=n.default.getSingletonFactory(Pc);function Nc(){const p=this.context,m=(0,l.default)(p).getInstance();let b,T,v;return b={select:function(S){if(!S||S.length===0)return null;let k=null;return m.get().streaming.applyContentSteering&&(k=(function(x){const I=v.getCurrentSteeringResponseData();return I&&I.pathwayPriority&&I.pathwayPriority.length>0?(function(N=[],O=[]){let A=0,R=null;for(;A<N.length;){const C=N[A],B=O.findIndex(($=>$.serviceLocation&&$.serviceLocation===C));if(B!==-1&&!T.contains(O[B].serviceLocation)){R=O[B];break}A+=1}return R})(I.pathwayPriority,x):null})(S)),k||(k=(function(x){return x[0]})(S)),k},setConfig:function(S){S.blacklistController&&(T=S.blacklistController),S.contentSteeringController&&(v=S.contentSteeringController)},reset:function(){T.reset()}},T=sn(p).create({updateEventName:f.default.SERVICE_LOCATION_LOCATION_BLACKLIST_CHANGED,addBlacklistEventName:f.default.SERVICE_LOCATION_LOCATION_BLACKLIST_ADD}),v=Do(p).getInstance(),b}Nc.__dashjs_factory_name="LocationSelector";var Xp=n.default.getClassFactory(Nc);function Mc(){const p=this.context,m=(0,g.default)(p).getInstance(),b=Vn(p).getInstance();let T,v,S,k,x,I,N,O,A,R,C,B,$,V,j;function te(){$=NaN,O=!1,I=!0,N=!1,ie()}function ie(){V!==null&&(clearTimeout(V),V=null)}function se(fe){ie(),N||(isNaN(fe)&&!isNaN($)&&(fe=1e3*$),isNaN(fe)||(R.debug("Refresh manifest in "+fe+" milliseconds."),V=setTimeout(U,fe)))}function de(fe=!1){O=!0;const Te=B.getValue();let Ce=Te.url;Ce&&(Ce=Je.default.removeQueryParameterFromUrl(Ce,h.default.CMCD_QUERY_KEY));let Ie=null;const q=T.getPatchLocation(Te),W=A.select(q);let re=null;if(W&&!fe)Ce=W.url,Ie=W.serviceLocation,re=W.queryParams;else{const ee=(function(le){const z=T.getLocation(le),ce=v.getSynthesizedLocationElements(z);return z.concat(ce)})(Te),ne=A.select(ee);ne&&(Ce=ne.url,Ie=ne.serviceLocation,re=ne.queryParams)}b.isRelative(Ce)&&(Ce=b.resolve(Ce,Te.url)),C.load(Ce,Ie,re)}function G(fe){if(fe){if(T.getIsPatch(fe)){let Ie=fe;fe=B.getValue();let q=T.isPatchValid(fe,Ie),W=q;if(q){let re=T.getPublishTime(fe);T.applyPatchToManifest(fe,Ie);let ee=T.getPublishTime(fe);W=re.getTime()!==ee.getTime()}if(!W)return R.debug("Patch provided is invalid, performing full manifest refresh"),void de(!0);fe.loadedTime=new Date}}else(fe=B.getValue()).loadedTime=new Date;if(B.getValue()&&B.getValue().type===ye.default.DYNAMIC&&fe.type===ye.default.STATIC)return m.trigger(f.default.DYNAMIC_TO_STATIC),O=!1,void(N=!0);B.setValue(fe);const Te=new Date,Ce=(Te.getTime()-fe.loadedTime.getTime())/1e3;$=T.getManifestUpdatePeriod(fe,Ce),1e3*$>2147483647&&($=2147483647e-3),m.trigger(f.default.MANIFEST_UPDATED,{manifest:fe}),R.info("Manifest has been refreshed at "+Te+"["+Te.getTime()/1e3+"] "),I||se()}function U(){I||(O?se(j.get().streaming.manifestUpdateRetryInterval):de())}function P(fe){if(fe.error)fe.error.code===Jt.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE&&k.error(fe.error);else{const Te=fe.manifest;(function(Ce){(function(Ie){const q=S.getExternalSubtitles();if(!q||q.length===0)return;const W=Ie&&Ie.Period?Ie.Period.length:0;q.forEach((re=>{if(re.periodId===null&&W>1)R.warn(`External subtitle with id ${re.id} has no periodId and the MPD contains more than one period. Unable to add the external subtitle as it is not clear which period shall be used.`);else if(W===1)M(Ie.Period[0],re);else{const ee=Ie.Period.find((ne=>ne.id===re.periodId));ee?M(ee,re):R.warn(`External subtitle with id ${re.id} has periodId ${re.periodId} but the MPD does not contain a period with that id. Unable to add the external subtitle.`)}}))})(Ce)})(Te),G(Te)}}function M(fe,Te){if(!fe||!fe.AdaptationSet)return fe;fe.AdaptationSet.push(Te.serializeToMpdParserFormat())}function ge(){I=!1,se()}function X(){I=!j.get().streaming.scheduling.scheduleWhilePaused,I&&ie()}function be(){O=!1}return x={getIsUpdating:function(){return O},initialize:function(){te(),m.on(f.default.STREAMS_COMPOSED,be,this),m.on(y.default.PLAYBACK_STARTED,ge,this),m.on(y.default.PLAYBACK_PAUSED,X,this),m.on(f.default.INTERNAL_MANIFEST_LOADED,P,this)},refreshManifest:de,reset:function(){m.off(y.default.PLAYBACK_STARTED,ge,this),m.off(y.default.PLAYBACK_PAUSED,X,this),m.off(f.default.STREAMS_COMPOSED,be,this),m.off(f.default.INTERNAL_MANIFEST_LOADED,P,this),te()},setConfig:function(fe){fe&&(fe.manifestModel&&(B=fe.manifestModel),fe.adapter&&(T=fe.adapter),fe.manifestLoader&&(C=fe.manifestLoader),fe.errHandler&&(k=fe.errHandler),fe.locationSelector&&(A=fe.locationSelector),fe.settings&&(j=fe.settings),fe.contentSteeringController&&(v=fe.contentSteeringController),fe.customParametersModel&&(S=fe.customParametersModel))},setManifest:function(fe){G(fe)}},R=(0,o.default)(p).getInstance().getLogger(x),A=Xp(p).create(),S=(0,ko.default)(p).getInstance(),x}Mc.__dashjs_factory_name="ManifestUpdater";var Oc=n.default.getClassFactory(Mc);function jo(){const p=this.context,m=(0,g.default)(p).getInstance();let b,T,v,S,k,x,I,N,O,A,R;function C(z){if(!(z&&z.currentRepresentation&&z.currentRepresentation.mediaInfo&&z.currentRepresentation.mediaInfo.type))return;const ce=z.currentRepresentation.mediaInfo.type;I[ce]=z.currentRepresentation}function B(z,ce){return z&&v[ce]&&v[ce][z]?v[ce][z].list:[]}function $(z,ce){return z&&v[ce]&&v[ce][z]?v[ce][z].current:null}function V(z,ce={}){if(!z||!z.streamInfo)return;const me=z.type,Se=z.streamInfo.id,Re=$(me,Se);if(v[Se]&&v[Se][me]&&(v[Se][me].current=z,v[Se][me].current&&(me!==h.default.TEXT&&!ie(z,Re)||me===h.default.TEXT&&z.isFragmented)&&m.trigger(f.default.CURRENT_TRACK_CHANGED,{oldMediaInfo:Re,newMediaInfo:z,switchMode:S.get().streaming.trackSwitchMode[me],options:ce},{streamId:Se}),!ce.hasOwnProperty("noSettingsSave")||!ce.noSettingsSave)){let we=(function(ze){const Ye={lang:ze.lang,viewpoint:ze.viewpoint,roles:ze.roles,accessibility:ze.accessibility,audioChannelConfiguration:ze.audioChannelConfiguration,codec:ze.codec};return Ye.lang||Ye.viewpoint||Ye.role&&Ye.role.length>0||Ye.accessibility&&Ye.accessibility.length>0||Ye.audioChannelConfiguration&&Ye.audioChannelConfiguration.length>0?Ye:null})(z);if(!we||!v[Se][me].storeLastSettings)return;we.roles&&(we.role=we.roles[0],delete we.roles),we.accessibility&&(we.accessibility=we.accessibility[0]),we.audioChannelConfiguration&&(we.audioChannelConfiguration=we.audioChannelConfiguration[0]),x[me]=we,R.setSavedMediaSettings(me,we)}}function j(z,ce){z&&ce&&(k[z]=ce)}function te(z){return z?k[z]:null}function ie(z,ce){if(!z&&!ce)return!0;if(!z||!ce||z.isPreselection!==ce.isPreselection)return!1;const me=z.id===ce.id,Se=JSON.stringify(z.viewpoint)===JSON.stringify(ce.viewpoint),Re=z.lang===ce.lang,we=z.codec===ce.codec,ze=JSON.stringify(z.roles)===JSON.stringify(ce.roles),Ye=JSON.stringify(z.accessibility)===JSON.stringify(ce.accessibility),ct=JSON.stringify(z.audioChannelConfiguration)===JSON.stringify(ce.audioChannelConfiguration);return me&&we&&Se&&Re&&ze&&Ye&&ct}function se(){v={},x={},I={},k={audio:null,video:null,text:null},m.off(y.default.REPRESENTATION_SWITCH,C,b)}function de(z,ce,me){let Se=[];return z.forEach((function(Re){ce(me,Re)&&Se.push(Re)})),Se.length!==0||ce===ge&&S.get().streaming.assumeDefaultRoleAsMain&&le(me.role,{schemeIdUri:h.default.DASH_ROLE_SCHEME_ID,value:ye.default.MAIN})&&(T.info("no track with Role set to main - assuming main as default and searching again"),Se=de(z,X,null),Se.length!==0)?Se:(T.info("Filter-Function ("+ce.name+") resulted in no tracks; setting ignored"),z)}function G(z,ce){try{return!z.lang||z.lang instanceof RegExp?ce.lang.match(z.lang):ce.lang!==""&&Fo(ce.lang,As(z.lang)).length>0}catch{return!1}}function U(z,ce){return z.index===void 0||z.index===null||ce.index===z.index}function P(z,ce){return z.id===void 0||z.id===null||ce.id===z.id}function M(z,ce){return!z.viewpoint||!!ce.viewpoint.filter((function(me){return le(me,z.viewpoint)}))[0]}function ge(z,ce,me=!1){return!!ce.roles&&(!z.role||!!ce.roles.filter((function(Se){return le(Se,z.role)}))[0]||ce.type===h.default.AUDIO&&me)}function X(z,ce){return!ce.roles||ce.roles.length===0}function be(z,ce){let me;return me=z.accessibility?!!ce.accessibility.filter((function(Se){return le(Se,z.accessibility)}))[0]:!ce.accessibility.length,me}function fe(z,ce){return!z.audioChannelConfiguration||!!ce.audioChannelConfiguration.filter((function(me){return le(me,z.audioChannelConfiguration)}))[0]}function Te(z,ce){return!z.codec||z.codec===ce.codec}function Ce(z){let ce=0,me=[];return z.forEach((Se=>{isNaN(Se.selectionPriority)||(Se.selectionPriority>ce?(ce=Se.selectionPriority,me=[Se]):Se.selectionPriority===ce&&me.push(Se))})),me}function Ie(z){let ce,me=0,Se=[];return z.forEach((function(Re){ce=Math.max.apply(Math,Re.bitrateList.map((function(we){return we.bandwidth}))),ce>me?(me=ce,Se=[Re]):ce===me&&Se.push(Re)})),Se}function q(z){return z[0]&&z[0].type===h.default.VIDEO?(function(ce){let me,Se=1/0,Re=[];return ce.forEach((function(we){me=we.bitrateList.reduce((function(Ye,ct){const bt=Math.max(1,ct.width*ct.height);return Ye+ct.bandwidth/bt}),0)/we.bitrateList.length,me<Se?(Se=me,Re=[we]):me===Se&&Re.push(we)})),Re})(z):z[0]&&z[0].type===h.default.AUDIO?(function(ce){let me=1/0,Se=[];return ce.forEach((function(Re){let we=Re.audioChannelConfiguration.reduce((function(Ye,ct){return Ye+(ac(ct)||0)}),0)/Re.audioChannelConfiguration.length;Re.hasOwnProperty("supplementalProperties")&&Re.supplementalProperties.some((Ye=>Ye.schemeIdUri==="tag:dolby.com,2018:dash:EC3_ExtensionType:2018"&&Ye.value==="JOC"))&&(we=16),we||(we=1);let ze=Re.bitrateList.reduce((function(Ye,ct){return Ye+ct.bandwidth/we}),0)/Re.bitrateList.length;ze<me?(me=ze,Se=[Re]):ze===me&&Se.push(Re)})),Se})(z):z}function W(z){let ce,me=0,Se=[];return z.forEach((function(Re){ce=Re.representationCount,ce>me?(me=ce,Se=[Re]):ce===me&&Se.push(Re)})),Se}function re(z,ce){if(z===h.default.TEXT)return(function(Re){if(!Re||Re.length===0)return null;const we=Re.filter((ze=>!(ze&&ze.roles&&ze.roles.length>0)||ze.roles.every((Ye=>Ye.schemeIdUri!==h.default.DASH_ROLE_SCHEME_ID||Ye.value!==ye.default.FORCED_SUBTITLE))));return we.length>0?we[0]:Re[0]})(ce);let me;const Se=N.getCustomInitialTrackSelectionFunction();if(me=(function(Re){try{let we;return we=(function(ze){try{const Ye=ze.filter((ct=>{const bt=ct.type;return ct.bitrateList.some((Zt=>{const vt=O.getAbrBitrateParameter("maxBitrate",bt),Qt=O.getAbrBitrateParameter("minBitrate",bt);return!(vt>-1&&Zt.bandwidth>1e3*vt||Qt>-1&&Zt.bandwidth<1e3*Qt)}))}));return Ye.length>0?Ye:ze}catch(Ye){return T.error(Ye),ze}})(Re),we=(function(ze){try{if(!S.get().streaming.abr.limitBitrateByPortal)return ze;const{elementWidth:Ye}=A.getVideoElementSize(),ct=ze.filter((bt=>bt.type!==h.default.VIDEO||bt.bitrateList.some((Zt=>Zt.width<=Ye))));return ct.length>0?ct:ze}catch(Ye){return T.error(Ye),ze}})(we),we}catch(we){return T.error(we),Re}})(ce),Se&&typeof Se=="function")me=Se(me);else if(I[z])me=(function(Re,we){if(!Re||Re.length===0||!we||!I[we])return Re;const ze=I[we].bandwidth;if(!ze||isNaN(ze))return Re;let Ye={min:NaN,track:null};return Re.forEach((ct=>{ct.bitrateList.forEach((bt=>{const Zt=Math.abs(bt.bandwidth-ze);(isNaN(Ye.min)||Zt<Ye.min)&&(Ye.min=Zt,Ye.track=ct)}))})),Ye.track?[Ye.track]:Re})(me,z);else if(S.get().streaming.ignoreSelectionPriority||(T.info("Trying to find track with highest selectionPriority"),me=(function(Re){return Ce(Re)})(me)),me.length>1&&S.get().streaming.prioritizeRoleMain&&(T.info("Trying to find a main track"),me=de(me,ge,{role:{schemeIdUri:h.default.DASH_ROLE_SCHEME_ID,value:ye.default.MAIN}})),me.length>1){T.info("Selecting track based on selectionModeForInitialTrack");let Re=S.get().streaming.selectionModeForInitialTrack;switch(Re){case h.default.TRACK_SELECTION_MODE_HIGHEST_BITRATE:me=(function(we){let ze=Ie(we);return ze.length>1&&(ze=W(ze)),ze})(me);break;case h.default.TRACK_SELECTION_MODE_FIRST_TRACK:me=ee(me);break;case h.default.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:me=ne(me);break;case h.default.TRACK_SELECTION_MODE_WIDEST_RANGE:me=(function(we){let ze=W(we);return ze.length>1&&(ze=Ie(we)),ze})(me);break;case h.default.TRACK_SELECTION_MODE_LOWEST_STARTUP_DELAY:me=(function(we){let ze=we.filter((Ye=>!(!Ye.segmentSequenceProperties||Ye.segmentSequenceProperties.length===0)&&Ye.segmentSequenceProperties.some((ct=>ct.cadence===1&&(ct.sapType===0||ct.sapType===1)))));return ne(ze.length>0?ze:we)})(me);break;default:T.warn(`Track selection mode ${Re} is not supported. Falling back to TRACK_SELECTION_MODE_FIRST_TRACK`),me=ee(me)}}return me.length>0?me[0]:ce[0]}function ee(z){return z[0]}function ne(z){let ce=q(z);return ce.length>1&&(ce=Ie(ce)),ce}function le(z,ce){return!(!z||!ce)&&JSON.stringify({schemeIdUri:z.schemeIdUri,value:z.value})===JSON.stringify({schemeIdUri:ce.schemeIdUri,value:ce.value})}return b={addTrack:function(z){if(!z)return;T.info("addTrack with track.codec='"+z.codec+"', track.type='"+z.type+"'");const ce=z.type;if((me=ce)!==h.default.AUDIO&&me!==h.default.VIDEO&&me!==h.default.TEXT&&me!==h.default.IMAGE)return;var me;let Se=z.streamInfo.id;v[Se]||(v[Se]=(function(){const we=S.get().streaming.saveLastMediaSettingsForCurrentStreamingSession;return{audio:{list:[],storeLastSettings:we,current:null},video:{list:[],storeLastSettings:we,current:null},text:{list:[],storeLastSettings:we,current:null},image:{list:[],storeLastSettings:we,current:null}}})());const Re=v[Se][ce].list;for(let we=0,ze=Re.length;we<ze;++we)if(ie(Re[we],z))return;Re.push(z)},areTracksEqual:ie,clearDataForStream:function(z){v[z]&&delete v[z]},getCurrentTrackFor:$,getInitialSettings:te,getTracksFor:B,getTracksWithHighestSelectionPriority:Ce,getTracksWithHighestBitrate:Ie,getTracksWithHighestEfficiency:q,getTracksWithWidestRange:W,initialize:function(){m.on(y.default.REPRESENTATION_SWITCH,C,b)},isCurrentTrack:function(z){if(!z)return!1;const ce=z.type,me=z.streamInfo.id;return v[me]&&v[me][ce]&&ie(v[me][ce].current,z)},matchSettings:function(z,ce,me=!1){try{let Se=!1;if(z.lang){if(z.lang instanceof RegExp)Se=ce.lang.match(z.lang);else if(ce.lang!==""){const bt=As(z.lang);bt&&(Se=Fo(ce.lang,bt).length>0)}}else Se=!0;const Re=z.index===void 0||z.index===null||ce.index===z.index,we=!z.viewpoint||!!ce.viewpoint.filter((function(bt){return le(bt,z.viewpoint)}))[0],ze=!z.role||!!ce.roles.filter((function(bt){return le(bt,z.role)}))[0];let Ye=!z.accessibility||!!ce.accessibility.filter((function(bt){return le(bt,z.accessibility)}))[0],ct=!z.audioChannelConfiguration||!!ce.audioChannelConfiguration.filter((function(bt){return le(bt,z.audioChannelConfiguration)}))[0];return Se&&Re&&we&&(ze||ce.type===h.default.AUDIO&&me)&&Ye&&ct}catch{return!1}},matchSettingsAccessibility:be,matchSettingsAudioChannelConfig:fe,matchSettingsIndex:U,matchSettingsLang:G,matchSettingsRole:ge,matchSettingsViewPoint:M,reset:se,saveTextSettingsDisabled:function(){R.setSavedMediaSettings(h.default.TEXT,null)},selectInitialTrack:re,setConfig:function(z){z&&(z.domStorage&&(R=z.domStorage),z.settings&&(S=z.settings),z.customParametersModel&&(N=z.customParametersModel),z.mediaPlayerModel&&(O=z.mediaPlayerModel),z.videoModel&&(A=z.videoModel))},setInitialMediaSettingsForType:function(z,ce){let me=x[z]||te(z);const Se=B(z,ce.id);let Re=[];me&&Object.keys(me).length!==0||(me=R.getSavedMediaSettings(z),me&&delete me.codec,j(z,me)),Se&&Se.length!==0&&(Re=S.get().streaming.includePreselectionsForInitialTrackSelection?Array.from(Se):Se.filter((we=>!we.isPreselection)),me&&(T.info("Filtering "+Re.length+" "+z+" tracks based on settings"),Re=de(Re,P,me),Re=de(Re,G,me),Re=de(Re,U,me),Re=de(Re,M,me),z===h.default.AUDIO&&x[z]||(Re=de(Re,ge,me)),Re=de(Re,be,me),Re=de(Re,fe,me),Re=de(Re,Te,me),T.info("Filtering "+z+" tracks ended, found "+Re.length+" matching track(s).")),Re.length>1?V(re(z,Re)):V(Re[0]))},setInitialSettings:j,setTrack:V},T=(0,o.default)(p).getInstance().getLogger(b),se(),b}jo.__dashjs_factory_name="MediaController";const Fc=n.default.getSingletonFactory(jo);n.default.updateSingletonFactory(jo.__dashjs_factory_name,Fc);var Qp=Fc;function Uc(){let p,m,b,T;const v=this.context,S=(0,l.default)(v).getInstance();function k(A,R){return isNaN(A)?0:A>0?(R&&m.warn("Supplied minimum playback rate is a positive value when it should be negative or 0. The supplied rate will not be applied and set to 0: 100% playback speed."),0):A<-.5?(R&&m.warn("Supplied minimum playback rate is out of range and will be limited to -0.5: -50% playback speed."),-.5):A}function x(A,R){return isNaN(A)?0:A<0?(R&&m.warn("Supplied maximum playback rate is a negative value when it should be negative or 0. The supplied rate will not be applied and set to 0: 100% playback speed."),0):A>1?(R&&m.warn("Supplied maximum playback rate is out of range and will be limited to 1: 200% playback speed."),1):A}function I(){const A=N(),R=b.getLiveDelay();return!isNaN(R)&&R>0?Math.min(A,R):A}function N(){return S.get().streaming.buffer.bufferTimeDefault>0?S.get().streaming.buffer.bufferTimeDefault:O()?20:12}function O(){return S.get().streaming.buffer.fastSwitchEnabled!==null?S.get().streaming.buffer.fastSwitchEnabled:!b.getLowLatencyModeEnabled()}return p={getAbrBitrateParameter:function(A,R){try{const C=S.get().streaming.abr[A][R];if(!isNaN(C)&&C!==-1)return C;const B=T.getServiceDescriptionSettings();return B&&B[A]&&!isNaN(B[A][R])?B[A][R]:-1}catch{return-1}},getBufferTimeDefault:I,getBufferTimeDefaultUnadjusted:N,getCatchupMaxDrift:function(){if(!isNaN(S.get().streaming.liveCatchup.maxDrift)&&S.get().streaming.liveCatchup.maxDrift>=0)return S.get().streaming.liveCatchup.maxDrift;const A=T.getServiceDescriptionSettings();return A&&A.liveCatchup&&!isNaN(A.liveCatchup.maxDrift)&&A.liveCatchup.maxDrift>=0?A.liveCatchup.maxDrift:12},getCatchupModeEnabled:function(){return S.get().streaming.liveCatchup.enabled!==null?S.get().streaming.liveCatchup.enabled:b.getInitialCatchupModeActivated()},getCatchupPlaybackRates:function(A){const R=S.get().streaming.liveCatchup.playbackRate;if(!isNaN(R.min)||!isNaN(R.max))return{min:k(R.min,A),max:x(R.max,A)};const C=T.getServiceDescriptionSettings();if(C&&C.liveCatchup&&(!isNaN(C.liveCatchup.playbackRate.min)||!isNaN(C.liveCatchup.playbackRate.max))){const B=C.liveCatchup.playbackRate;return{min:k(B.min,A),max:x(B.max,A)}}return{min:-.5,max:.5}},getFastSwitchEnabled:O,getInitialBufferLevel:function(){const A=S.get().streaming.buffer.initialBufferLevel;return isNaN(A)||A<0?0:Math.min(I(),A)},getRetryAttemptsForType:function(A){const R=isNaN(S.get().streaming.retryAttempts.lowLatencyMultiplyFactor)?5:S.get().streaming.retryAttempts.lowLatencyMultiplyFactor;return b.getLowLatencyModeEnabled()?S.get().streaming.retryAttempts[A]*R:S.get().streaming.retryAttempts[A]},getRetryIntervalsForType:function(A){const R=isNaN(S.get().streaming.retryIntervals.lowLatencyReductionFactor)?10:S.get().streaming.retryIntervals.lowLatencyReductionFactor;return b.getLowLatencyModeEnabled()?S.get().streaming.retryIntervals[A]/R:S.get().streaming.retryIntervals[A]},getScheduleTimeout:function(){return b.getLowLatencyModeEnabled()?S.get().streaming.scheduling.lowLatencyTimeout:S.get().streaming.scheduling.defaultTimeout},reset:function(){},setConfig:function(A){A.playbackController&&(b=A.playbackController),A.serviceDescriptionController&&(T=A.serviceDescriptionController)}},m=(0,o.default)(v).getInstance().getLogger(p),p}Uc.__dashjs_factory_name="MediaPlayerModel";var Zp=n.default.getSingletonFactory(Uc);function zc(){const p=this.context,m=(0,g.default)(p).getInstance();let b,T,v,S,k,x,I,N,O,A,R,C,B,$,V,j,te,ie,se,de,G,U,P,M;function ge(){Te(),V=!1,A=0,$=0,T=0,B=!1,C=!1,S=!1,te=NaN,O=NaN,P&&(m.off(f.default.DATA_UPDATE_COMPLETED,we,k),m.off(f.default.MANIFEST_UPDATED,$e,k),m.off(f.default.STREAMS_COMPOSED,yt,k),m.off(y.default.PLAYBACK_ENDED,Yt,k),m.off(y.default.STREAM_INITIALIZING,Mt,k),m.off(y.default.REPRESENTATION_SWITCH,Fe,k),m.off(y.default.BUFFER_LEVEL_STATE_CHANGED,ct,k),Re(),P.removeEventListener("canplay",ze),P.removeEventListener("canplaythrough",Ye),P.removeEventListener("ended",ft),P.removeEventListener("error",En),P.removeEventListener("loadeddata",pt),P.removeEventListener("loadedmetadata",qe),P.removeEventListener("pause",Qt),P.removeEventListener("play",bt),P.removeEventListener("playing",vt),P.removeEventListener("progress",dn),P.removeEventListener("ratechange",vn),P.removeEventListener("seeked",Rn),P.removeEventListener("seeking",un),P.removeEventListener("stalled",Tt),P.removeEventListener("timeupdate",xn),P.removeEventListener("volumechange",_t),P.removeEventListener("waiting",Zt)),M=null,P=null,G=null,I=null}function X(Ke=null){return parseFloat((be(Ke)-W()).toFixed(5))}function be(Ke){const It=Ke||G;return It.start+It.duration}function fe(Ke=!1){G&&P&&P.getElement()?(Ke&&I&&q(W()),P.play()):V=!0}function Te(){G&&P&&P.pause()}function Ce(Ke,It=!1,Ct=!1,_e=!1){G&&P&&P.getElement()&&Ke!==(isNaN(te)?P.getTime():te)&&(x=Ct===!0,x||(te=Ke),R.info("Requesting seek to time: "+Ke+(x?" (internal)":"")),I&&_e&&q(Ke),P.setCurrentTime(Ke,It))}function Ie(){if(!G||!P||!I)return;const Ke=de&&de.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO,It=v.getCurrentDVRInfo(Ke);return It&&It.range?It.range.end:0}function q(Ke){const It=new Date(U.getClientReferenceTime()),Ct=b.getRegularPeriods()[0];A=U.calcPresentationTimeFromWallTime(It,Ct)-Ke}function W(){return G&&P?P.getTime():null}function re(){return G&&P?P.isPaused():null}function ee(){return G&&P?P.isSeeking():null}function ne(){return G&&P?P.isStalled():null}function le(){return G&&P?P.getPlaybackRate():null}function z(){return G&&P?P.getEnded():null}function ce(){return I}function me(Ke=null){if(re()||!I||P.getReadyState()===0||ee()||B)return;Ke||(Ke=de.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO);const It=W(),Ct=(function(_e,Qe){const Lt=v.getCurrentDVRInfo(Qe),Dt=Lt?Lt.range:null;let Sn;return Dt?(Sn=_e>Dt.end?Math.max(Dt.end-A,Dt.start):_e>0&&_e+.25<Dt.start&&Math.abs(_e-Dt.start)<31536e4?C?Math.max(Dt.end-A,Dt.start):Dt.start:_e,Sn):NaN})(It,Ke);!isNaN(Ct)&&Ct!==It&&!ee()&&(ne()||j||P.getReadyState()===1)&&(R.debug(`UpdateCurrentTime: Seek to actual time: ${Ct} from currentTime: ${It}`),Ce(Ct,!1,!1))}function Se(){M===null&&(M=setInterval((()=>{(function(){if(m.trigger(f.default.WALLCLOCK_TIME_UPDATED,{isDynamic:I,time:new Date}),ce()){const Ke=Date.now();(isNaN(O)||Ke>O+se.get().streaming.liveUpdateTimeThresholdInMilliseconds)&&(de.addDVRMetric(),re()?(function(){const It=Date.now();(!N||It>N+500)&&(N=It,xn())})():me(),O=Ke)}})()}),se.get().streaming.wallclockTimeUpdateInterval))}function Re(){clearInterval(M),M=null}function we(Ke){const It=Ke.currentRepresentation,Ct=It?It.mediaInfo.streamInfo:null;Ct!==null&&G.id===Ct.id&&(G=Ct)}function ze(){m.trigger(f.default.CAN_PLAY)}function Ye(){m.trigger(f.default.CAN_PLAY_THROUGH)}function ct(Ke){Ke.streamId===de.getActiveStreamInfo().id&&(j=Ke.state===i.BUFFER_EMPTY,se.get().streaming.buffer.setStallState&&P.setStallState(Ke.mediaType,Ke.state===i.BUFFER_EMPTY))}function bt(){R.info("Native video element event: play"),me(),Se(),m.trigger(f.default.PLAYBACK_STARTED,{startTime:W()})}function Zt(){R.info("Native video element event: waiting"),m.trigger(f.default.PLAYBACK_WAITING,{playingTime:W()})}function vt(){R.info("Native video element event: playing"),x=!1,m.trigger(f.default.PLAYBACK_PLAYING,{playingTime:W()})}function Qt(){R.info("Native video element event: pause"),m.trigger(f.default.PLAYBACK_PAUSED,{ended:z()})}function un(){if(x)return;let Ke=W();isNaN(te)||te===Ke||(Ke=te),te=NaN,R.info("Seeking to: "+Ke),Se(),m.trigger(f.default.PLAYBACK_SEEKING,{seekTime:Ke,streamId:G.id})}function Rn(){R.info("Native video element event: seeked"),x=!1,m.trigger(f.default.PLAYBACK_SEEKED,{streamId:G.id})}function xn(){G&&m.trigger(f.default.PLAYBACK_TIME_UPDATED,{timeToEnd:X(),time:W(),streamId:G.id})}function dn(){m.trigger(f.default.PLAYBACK_PROGRESS,{streamId:G.id})}function vn(){const Ke=le();R.info("Native video element event: ratechange: ",Ke),m.trigger(f.default.PLAYBACK_RATE_CHANGED,{playbackRate:Ke})}function qe(){R.info("Native video element event: loadedmetadata"),m.trigger(f.default.PLAYBACK_METADATA_LOADED),Se()}function pt(){R.info("Native video element event: loadeddata"),m.trigger(f.default.PLAYBACK_LOADED_DATA)}function ft(){R.info("Native video element event: ended"),Te(),Re();const Ke=de?de.getActiveStreamInfo():null;Ke&&m.trigger(f.default.PLAYBACK_ENDED,{isLast:Ke.isLast})}function _t(){m.trigger(f.default.PLAYBACK_VOLUME_CHANGED)}function Yt(Ke){if(M&&Ke.isLast){R.info("onPlaybackEnded -- PLAYBACK_ENDED but native video element didn't fire ended");const It=Ke.seekTime?Ke.seekTime:be();P.setCurrentTime(It),Te(),Re()}}function En(Ke){const It=Ke.target||Ke.srcElement;m.trigger(f.default.PLAYBACK_ERROR,{error:It.error})}function rt(){I=!1}function Tt(Ke){m.trigger(f.default.PLAYBACK_STALLED,{e:Ke})}function Mt(Ke){var It;(It=Ke.mediaInfo)&&It.supplementalProperties&&It.supplementalProperties.find((Ct=>Ct.schemeIdUri===h.default.SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME))&&(R.debug("Low Latency critical SupplementalProperty set: Enabling low Latency"),C=!0)}function Fe(Ke){const It=de.getActiveStreamInfo();Ke&&It&&Ke.currentRepresentation&&Ke.streamId&&Ke.streamId===It.id&&Ke.mediaType&&(Ke.mediaType===h.default.VIDEO||Ke.mediaType===h.default.AUDIO)&&(C=Ke.currentRepresentation.availabilityTimeComplete===!1,C&&!S&&(S=!0))}function $e(){B=!0}function yt(){B=!1}return k={computeAndSetLiveDelay:function(Ke,It){let Ct,_e,Qe;const Lt=!isNaN(Ke)&&isFinite(Ke)?Ke:NaN;let Dt=b.getSuggestedPresentationDelay();const Sn=ie.getServiceDescriptionSettings();return Ct=isNaN(se.get().streaming.delay.liveDelay)?se.get().streaming.delay.liveDelayFragmentCount===null||isNaN(se.get().streaming.delay.liveDelayFragmentCount)||isNaN(Lt)?Sn&&!isNaN(Sn.liveDelay)&&Sn.liveDelay>0?Sn.liveDelay:se.get().streaming.delay.useSuggestedPresentationDelay===!0&&Dt!==null&&!isNaN(Dt)&&Dt>0?Dt:isNaN(Lt)?It&&!isNaN(It.minBufferTime)?4*It.minBufferTime:4*G.manifestInfo.minBufferTime:4*Lt:Lt*se.get().streaming.delay.liveDelayFragmentCount:se.get().streaming.delay.liveDelay,Qe=b.getAvailabilityStartTime(),Qe!==null&&(T=Qe),_e=It&&It.dvrWindowSize>0?Math.min(Ct,It.dvrWindowSize):Ct,A=_e,$=_e,_e},getAvailabilityStartTime:function(){return T},getBufferLevel:function(Ke=null){let It=null;return de.getActiveStreamProcessors().forEach((Ct=>{if(!Ke||Ke.length===0||Ke.indexOf(Ct.getType())===-1){const _e=Ct.getBufferLevel();It=It===null?_e:Math.min(It,_e)}})),It},getCurrentLiveLatency:function(){if(!I||isNaN(T))return NaN;let Ke=W();if(isNaN(Ke)||Ke===0)return 0;const It=new Date().getTime()+1e3*U.getClientTimeOffset();return Math.max(((It-T-1e3*Ke)/1e3).toFixed(3),0)},getEnded:z,getInitialCatchupModeActivated:function(){return S},getIsDynamic:ce,getIsManifestUpdateInProgress:function(){return B},getLiveDelay:function(){return A},getLowLatencyModeEnabled:function(){return C},getOriginalLiveDelay:function(){return $},getPlaybackRate:le,getPlaybackStalled:function(){return j},getPlayedRanges:function(){return G&&P?P.getPlayedRanges():null},getStreamController:function(){return de},getStreamEndTime:be,getTime:W,getTimeToStreamEnd:X,initialize:function(Ke,It){G=Ke,It!==!0&&(P.addEventListener("canplay",ze),P.addEventListener("canplaythrough",Ye),P.addEventListener("ended",ft),P.addEventListener("error",En),P.addEventListener("loadeddata",pt),P.addEventListener("loadedmetadata",qe),P.addEventListener("pause",Qt),P.addEventListener("play",bt),P.addEventListener("playing",vt),P.addEventListener("progress",dn),P.addEventListener("ratechange",vn),P.addEventListener("seeked",Rn),P.addEventListener("seeking",un),P.addEventListener("stalled",Tt),P.addEventListener("timeupdate",xn),P.addEventListener("volumechange",_t),P.addEventListener("waiting",Zt),I=G.manifestInfo.isDynamic,j=!1,x=!1,m.on(f.default.DATA_UPDATE_COMPLETED,we,k),m.on(f.default.MANIFEST_UPDATED,$e,k),m.on(f.default.STREAMS_COMPOSED,yt,k),m.on(y.default.PLAYBACK_ENDED,Yt,k,{priority:g.default.EVENT_PRIORITY_HIGH}),m.on(y.default.STREAM_INITIALIZING,Mt,k),m.on(y.default.REPRESENTATION_SWITCH,Fe,k),m.on(y.default.BUFFER_LEVEL_STATE_CHANGED,ct,k),m.on(y.default.DYNAMIC_TO_STATIC,rt,k),V&&(V=!1,fe()))},isPaused:re,isProgressing:function(Ke=500){return new Promise((It=>{let Ct=-1,_e=null;const Qe=Dt=>{clearTimeout(_e),_e=null,m.off(y.default.PLAYBACK_TIME_UPDATED,Lt,k),It(Dt)},Lt=Dt=>{Ct<0?Ct=Dt.time:Dt.time>Ct+.1&&Qe(!0)};_e=setTimeout((()=>{Qe(!1)}),Ke),m.on(y.default.PLAYBACK_TIME_UPDATED,Lt,k)}))},isSeeking:ee,isStalled:ne,pause:Te,play:fe,reset:ge,seek:Ce,seekToCurrentLive:function(Ke=!1,It=!1,Ct=!1){const _e=Ie();_e!==0&&Ce(_e-A,Ke,It,Ct)},seekToOriginalLive:function(Ke=!1,It=!1,Ct=!1){const _e=Ie();_e!==0&&(A=$,Ce(_e-A,Ke,It,Ct))},setConfig:function(Ke){Ke&&(Ke.streamController&&(de=Ke.streamController),Ke.serviceDescriptionController&&(ie=Ke.serviceDescriptionController),Ke.dashMetrics&&(v=Ke.dashMetrics),Ke.adapter&&(b=Ke.adapter),Ke.videoModel&&(P=Ke.videoModel),Ke.timelineConverter&&(U=Ke.timelineConverter),Ke.settings&&(se=Ke.settings))},updateCurrentTime:me},R=(0,o.default)(p).getInstance().getLogger(k),ge(),k}zc.__dashjs_factory_name="PlaybackController";var Jp=n.default.getSingletonFactory(zc),Bc=class{constructor(){this.availabilityEndTime=NaN,this.availabilityStartTime=NaN,this.duration=NaN,this.index=null,this.indexRange=null,this.isPartialSegment=!1,this.media=null,this.mediaRange=null,this.mediaUrl=null,this.mediaStartTime=NaN,this.presentationStartTime=NaN,this.replacementNumber=NaN,this.replacementTime=null,this.representation=null,this.wallStartTime=NaN}assignAttributes(p){for(let m in p)p.hasOwnProperty(m)&&this.hasOwnProperty(m)&&(this[m]=p[m])}},qo=class extends Bc{constructor(){super()}};function jc(){const p=this.context;let m,b,T,v,S,k,x,I,N,O,A,R;function C(j,te,ie,se){let de=null;const G=j?R.resolve(j.path):null,U=se||{init:!0,url:G?G.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500,mediaType:te,representation:j};b.debug("Start searching for initialization.");const P=V(U);x.load({request:P,success:function(M){if(U.bytesLoaded=U.range.end,de=v.findInitRange(M),!de)return U.range.end=U.bytesLoaded+U.bytesToLoad,C(j,te,ie,U);j.range=de,ie(j)},error:function(){ie(j)}}),b.debug("Perform init search: "+U.url)}function B(j,te,ie,se,de,G){if(ie&&(ie.start===void 0||ie.end===void 0)){const fe=ie?ie.toString().split("-"):null;ie=fe?{start:parseFloat(fe[0]),end:parseFloat(fe[1])}:null}de=de||$;let U=null,P=null;const M=!!ie,ge=j?R.resolve(j.path):null,X={init:!1,url:ge?ge.url:void 0,range:M?ie:{start:0,end:1500},searching:!M,bytesLoaded:G?G.bytesLoaded:0,bytesToLoad:1500,mediaType:te,representation:j},be=V(X);x.load({request:be,success:function(fe){const Te=X.bytesToLoad,Ce=fe.byteLength;if(X.bytesLoaded=X.range.end-X.range.start,U=v.parse(fe),P=U.getBox("sidx"),P&&P.isComplete){const Ie=P.references;let q,W;if(Ie!=null&&Ie.length>0&&(q=Ie[0].reference_type===1),q){let re,ee,ne,le,z;b.debug("Initiate multiple SIDX load."),X.range.end=X.range.start+P.size;let ce=[],me=0,Se=(P.offset||X.range.start)+P.size;const Re=function(we){we?(ce=ce.concat(we),me++,me>=ee&&(ce.sort((function(ze,Ye){return ze.startTime-Ye.startTime<0?-1:0})),de(ce,j,se))):de(null,j,se)};for(re=0,ee=Ie.length;re<ee;re++)ne=Se,le=Se+Ie[re].referenced_size-1,Se+=Ie[re].referenced_size,z={start:ne,end:le},B(j,te,z,se,Re,X)}else b.debug("Parsing segments from SIDX. representation "+te+" - id: "+j.id+" for range : "+X.range.start+" - "+X.range.end),W=(function(re,ee){const ne=re.references,le=ne.length,z=re.timescale;let ce=re.earliest_presentation_time,me=ee.range.start+re.offset+re.first_offset+re.size;const Se=[];let Re,we,ze,Ye;for(let ct=0;ct<le;ct++)ze=ne[ct].subsegment_duration,Ye=ne[ct].referenced_size,Re=new qo,Re.duration=ze,Re.startTime=ce,Re.timescale=z,we=me+Ye-1,Re.mediaRange=me+"-"+we,Se.push(Re),ce+=ze,me+=Ye;return Se})(P,X),de(W,j,se)}else{if(P)X.range.start=P.offset||X.range.start,X.range.end=X.range.start+(P.size||Te);else{if(Ce<X.bytesLoaded)return void de(null,j,se);{const Ie=U.getLastBox();Ie&&Ie.size?(X.range.start=Ie.offset+Ie.size,X.range.end=X.range.start+Te):X.range.end+=Te}}B(j,te,X.range,se,null,X)}},error:function(){de(null,j,se)}}),b.debug(`Perform SIDX load for type ${te} : ${X.url} with range ${X.range.start} - ${X.range.end}`)}function $(j,te,ie){ie({segments:j,representation:te,error:j?void 0:new Wt.default(I.SEGMENT_BASE_LOADER_ERROR_CODE,I.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}function V(j){if(!j.url)return;const te=new oe;return te.setInfo(j),te}return m={setConfig:function(j){j.baseURLController&&(R=j.baseURLController),j.dashMetrics&&(S=j.dashMetrics),j.mediaPlayerModel&&(k=j.mediaPlayerModel),j.errHandler&&(T=j.errHandler),j.boxParser&&(v=j.boxParser),j.debug&&(b=j.debug.getLogger(m)),j.errors&&(I=j.errors),j.urlUtils&&(A=j.urlUtils),j.constants&&(N=j.constants),j.dashConstants&&(O=j.dashConstants)},initialize:function(){x=ca(p).create({errHandler:T,dashMetrics:S,mediaPlayerModel:k,boxParser:v,errors:I,urlUtils:A,constants:N,dashConstants:O})},loadInitialization:function(j,te){return new Promise((ie=>{C(j,te,ie)}))},loadSegments:function(j,te,ie){return new Promise((se=>{B(j,te,ie,se)}))},reset:function(){x&&(x.abort(),x=null)}},m}jc.__dashjs_factory_name="SegmentBaseLoader";var ey=n.default.getSingletonFactory(jc);function qc(p){let m;p=p||{};let b=new DataView(p.data),T=0;function v(k,x){let I,N,O=!0,A=0;if(x===void 0&&(x=!1),k.tag>16777215?(b.getUint32(T)!==k.tag&&(O=!1),A=4):k.tag>65535?(I=b.getUint16(T),N=b.getUint8(T+2),256*I+N!==k.tag&&(O=!1),A=3):k.tag>255?(b.getUint16(T)!==k.tag&&(O=!1),A=2):(b.getUint8(T)!==k.tag&&(O=!1),A=1),!O&&k.required&&!x)throw new Error("required tag not found");return O&&(T+=A),O}function S(k){let x=1,I=128,N=-1,O=0,A=b.getUint8(T),R=0;for(R=0;R<8;R+=1){if((A&I)===I){O=k===void 0?A&~I:A,N=R;break}I>>=1}for(R=0;R<N;R+=1,x+=1)O=O<<8|255&b.getUint8(T+x);return T+=x,O}return m={getPos:function(){return T},setPos:function(k){T=k},consumeTag:v,consumeTagAndSize:function(k,x){let I=v(k,x);return I&&S(),I},parseTag:function(k){let x;return v(k),x=S(),m[k.parse](x)},skipOverElement:function(k,x){let I,N=v(k,x);return N&&(I=S(),T+=I),N},getMatroskaCodedNum:S,getMatroskaFloat:function(k){let x;switch(k){case 4:x=b.getFloat32(T),T+=4;break;case 8:x=b.getFloat64(T),T+=8}return x},getMatroskaUint:function(k){if(k>4)return(function(I){const N=Math.floor(Number.MAX_SAFE_INTEGER/256);let O=0;for(let A=0;A<I;A+=1){if(O>N)throw new Error("Value exceeds safe integer limit");O*=256;const R=b.getUint8(T+A);if(O>Number.MAX_SAFE_INTEGER-R)throw new Error("Value exceeds safe integer limit");O+=R}return T+=I,O})(k);let x=0;for(let I=0;I<k;I+=1)x<<=8,x|=255&b.getUint8(T+I);return T+=k,x>>>0},moreData:function(){return T<b.byteLength}},m}qc.__dashjs_factory_name="EBMLParser";var Gc=n.default.getClassFactory(qc);function $c(){const p=this.context;let m,b,T,v,S,k,x,I,N;function O(A){const R=new oe;return R.setInfo(A),R}return m={setConfig:function(A){if(!(A.baseURLController&&A.dashMetrics&&A.mediaPlayerModel&&A.errHandler))throw new Error(h.default.MISSING_CONFIG_ERROR);N=A.baseURLController,S=A.dashMetrics,k=A.mediaPlayerModel,v=A.errHandler,I=A.errors,b=A.debug.getLogger(m)},initialize:function(){x=ca(p).create({errHandler:v,dashMetrics:S,mediaPlayerModel:k,errors:I})},loadInitialization:function(A,R){return new Promise((C=>{let B=null,$=A?N.resolve(A.path):null,V=A?A.range.split("-"):null,j={range:{start:V?parseFloat(V[0]):null,end:V?parseFloat(V[1]):null},request:B,url:$?$.url:void 0,init:!0,mediaType:R};b.info("Start loading initialization."),B=O(j),x.load({request:B,success:function(){C(A)},error:function(){C(A)}}),b.debug("Perform init load: "+j.url)}))},loadSegments:function(A,R,C){return new Promise((B=>{let $=null,V=A?N.resolve(A.path):null,j=V?V.url:void 0;$=O({bytesLoaded:0,bytesToLoad:8192,range:{start:0,end:8192},request:$,url:j,init:!1,mediaType:R,representation:A}),b.debug("Parsing ebml header"),x.load({request:$,success:function(te){(function(ie,se,de,G){if(!ie||ie.byteLength===0)return void G(null);let U,P,M,ge,X=Gc(p).create({data:ie}),be=de?de.split("-"):null,fe=null,Te={url:se,range:{start:be?parseFloat(be[0]):null,end:be?parseFloat(be[1]):null},request:fe};for(b.debug("Parse EBML header: "+Te.url),X.skipOverElement(T.EBML),X.consumeTag(T.Segment),M=X.getMatroskaCodedNum(),M+=X.getPos(),ge=X.getPos();X.moreData()&&!X.consumeTagAndSize(T.Segment.Info,!0);)if(!(X.skipOverElement(T.Segment.SeekHead,!0)||X.skipOverElement(T.Segment.Tracks,!0)||X.skipOverElement(T.Segment.Cues,!0)||X.skipOverElement(T.Void,!0)))throw new Error("no valid top level element found");for(;U===void 0;){let Ce=X.getMatroskaCodedNum(!0),Ie=X.getMatroskaCodedNum();Ce===T.Segment.Info.Duration.tag?U=X[T.Segment.Info.Duration.parse](Ie):X.setPos(X.getPos()+Ie)}fe=O(Te),x.load({request:fe,success:function(Ce){P=(function(Ie,q,W,re){let ee,ne,le,z,ce,me,Se,Re;for(ne=(function(we){let ze,Ye,ct=[],bt=Gc(p).create({data:we});for(bt.consumeTagAndSize(T.Segment.Cues);bt.moreData()&&bt.consumeTagAndSize(T.Segment.Cues.CuePoint,!0);){for(ze={},ze.CueTime=bt.parseTag(T.Segment.Cues.CuePoint.CueTime),ze.CueTracks=[];bt.moreData()&&bt.consumeTag(T.Segment.Cues.CuePoint.CueTrackPositions,!0);){const Zt=bt.getMatroskaCodedNum(),vt=bt.getPos();if(Ye={},Ye.Track=bt.parseTag(T.Segment.Cues.CuePoint.CueTrackPositions.CueTrack),Ye.Track===0)throw new Error("Cue track cannot be 0");Ye.ClusterPosition=bt.parseTag(T.Segment.Cues.CuePoint.CueTrackPositions.CueClusterPosition),ze.CueTracks.push(Ye),bt.setPos(vt+Zt)}if(ze.CueTracks.length===0)throw new Error("Mandatory cuetrack not found");ct.push(ze)}if(ct.length===0)throw new Error("mandatory cuepoint not found");return ct})(Ie),le=[],ce=0,me=ne.length;ce<me;ce+=1)z=new qo,ee=0,ee=ce<ne.length-1?ne[ce+1].CueTime-ne[ce].CueTime:re-ne[ce].CueTime,z.duration=ee,z.startTime=ne[ce].CueTime,z.timescale=1e3,Se=ne[ce].CueTracks[0].ClusterPosition+q,Re=ce<ne.length-1?ne[ce+1].CueTracks[0].ClusterPosition+q-1:W-1,z.mediaRange=Se+"-"+Re,le.push(z);return b.debug("Parsed cues: "+le.length+" cues."),le})(Ce,ge,M,U),G(P)},error:function(){b.error("Download Error: Cues "+Te.url),G(null)}}),b.debug("Perform cues load: "+Te.url+" bytes="+Te.range.start+"-"+Te.range.end)})(te,j,C,(function(ie){B({segments:ie,representation:A,error:ie?void 0:new Wt.default(I.SEGMENT_BASE_LOADER_ERROR_CODE,I.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}))},error:function(){B({representation:A,error:new Wt.default(I.SEGMENT_BASE_LOADER_ERROR_CODE,I.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}})}))},reset:function(){x&&(x.abort(),x=null)}},T={EBML:{tag:440786851,required:!0},Segment:{tag:408125543,required:!0,SeekHead:{tag:290298740,required:!0},Info:{tag:357149030,required:!0,TimecodeScale:{tag:2807729,required:!0,parse:"getMatroskaUint"},Duration:{tag:17545,required:!0,parse:"getMatroskaFloat"}},Tracks:{tag:374648427,required:!0},Cues:{tag:475249515,required:!0,CuePoint:{tag:187,required:!0,CueTime:{tag:179,required:!0,parse:"getMatroskaUint"},CueTrackPositions:{tag:183,required:!0,CueTrack:{tag:247,required:!0,parse:"getMatroskaUint"},CueClusterPosition:{tag:241,required:!0,parse:"getMatroskaUint"}}}}},Void:{tag:236,required:!0}},m}$c.__dashjs_factory_name="WebmSegmentBaseLoader";var ty=n.default.getSingletonFactory($c);function Vc(p){p=p||{};const m=this.context,b=p.eventBus,T=p.events,v=p.dashMetrics,S=p.mediaPlayerModel,k=p.errHandler,x=p.baseURLController,I=p.debug,N=p.boxParser,O=p.errors;let A,R,C;function B($){return($?$.split("/")[1]:"").toLowerCase()==="webm"}return A={initialize:function(){R.initialize(),C.initialize()},getSegmentBaseInitSegment:function($){return B($.representation.mimeType)?C.loadInitialization($.representation,$.mediaType):R.loadInitialization($.representation,$.mediaType)},getSegmentList:function($){return B($.mimeType)?C.loadSegments($.representation,$.mediaType,$.representation?$.representation.indexRange:null):R.loadSegments($.representation,$.mediaType,$.representation?$.representation.indexRange:null)},reset:function(){R.reset(),C.reset()}},R=ey(m).getInstance(),C=ty(m).getInstance(),R.setConfig({baseURLController:x,dashMetrics:v,mediaPlayerModel:S,errHandler:k,eventBus:b,events:T,errors:O,debug:I,boxParser:N}),C.setConfig({baseURLController:x,dashMetrics:v,mediaPlayerModel:S,errHandler:k,eventBus:b,events:T,errors:O,debug:I}),A}Vc.__dashjs_factory_name="SegmentBaseController";var ny=n.default.getSingletonFactory(Vc);const ry=[h.default.SERVICE_DESCRIPTION_DVB_LL_SCHEME],Hc="video",Kc="audio";function Yc(){const p=this.context;let m,b,T,v,S;function k(){b={liveDelay:NaN,liveCatchup:{maxDrift:NaN,playbackRate:{min:NaN,max:NaN}},minBitrate:{},maxBitrate:{},initialBitrate:{},contentSteering:null,clientDataReporting:null},T=[]}function x(I,N,O){try{b[I][N]=O/1e3}catch(A){v.error(A)}}return m={getServiceDescriptionSettings:function(){return b},getProducerReferenceTimeOffsets:function(){return T},calculateProducerReferenceTimeOffsets:function(I){try{let N=[];if(I&&I.length>0){const O=[h.default.VIDEO,h.default.AUDIO,h.default.TEXT],A=S.getAvailabilityStartTime()/1e3;I.forEach((R=>{const C=O.reduce(((B,$)=>B.concat(S.getAllMediaInfoForType(R,$))),[]).reduce(((B,$)=>(S.getProducerReferenceTimes(R,$).forEach((V=>{const j=S.getVoRepresentations($);if(j&&j.length>0&&j[0].adaptation&&j[0].segmentInfoType===ye.default.SEGMENT_TEMPLATE){const te=j[0],ie=new Date(V[ye.default.WALL_CLOCK_TIME]).getTime()/1e3-(V[ye.default.PRESENTATION_TIME]/te[ye.default.TIMESCALE]-te[ye.default.PRESENTATION_TIME_OFFSET]+R.start),se=A-ie;B.push({id:V[ye.default.ID],to:se})}})),B)),[]);N=N.concat(C)}))}T=N}catch(N){v.error(N),T=[]}},applyServiceDescription:function(I){if(!I||!I.serviceDescriptions)return;const N=I.serviceDescriptions.filter((R=>ry.includes(R.schemeIdUri))),O=I.serviceDescriptions.filter((R=>R.schemeIdUri==null));let A=N.length>0?N[N.length-1]:O[O.length-1];A&&(A.latency&&A.latency.target>0&&(function(R){let C;if(R.schemeIdUri,h.default.SERVICE_DESCRIPTION_DVB_LL_SCHEME,C=(function(B){return{liveDelay:B.latency.target/1e3,maxDrift:!isNaN(B.latency.max)&&B.latency.max>B.latency.target?(B.latency.max-B.latency.target+500)/1e3:NaN,referenceId:B.latency.referenceId||NaN}})(R),T.length>0){let{to:B,id:$}=(function(V){let j,te=0,ie=T.filter((se=>se.id===V.referenceId));return ie.length===0?(te=T.length>0?T[0].to:0,j=T[0].id||NaN):(te=ie[0].to||0,j=ie[0].id||NaN),{to:te,id:j}})(C);b.liveDelay=C.liveDelay-B,b.liveCatchup.maxDrift=C.maxDrift,v.debug(`
|
|
56
|
+
Found latency properties coming from service description. Applied time offset of ${B} from ProducerReferenceTime element with id ${$}.
|
|
57
|
+
Live Delay: ${C.liveDelay-B}, Live catchup max drift: ${C.maxDrift}
|
|
58
|
+
`)}else b.liveDelay=C.liveDelay,b.liveCatchup.maxDrift=C.maxDrift,v.debug(`Found latency properties coming from service description: Live Delay: ${C.liveDelay}, Live catchup max drift: ${C.maxDrift}`)})(A),A.playbackRate&&(function(R){const C=R.playbackRate.min?Math.round(1e3*(R.playbackRate.min-1))/1e3:NaN,B=R.playbackRate.max?Math.round(1e3*(R.playbackRate.max-1))/1e3:NaN;b.liveCatchup.playbackRate.min=C,b.liveCatchup.playbackRate.max=B,v.debug(`Found latency properties coming from service description: Live catchup min playback rate: ${C}`),v.debug(`Found latency properties coming from service description: Live catchup max playback rate: ${B}`)})(A),A.operatingQuality,A.operatingBandwidth&&(function(R){if(!R||!R.operatingBandwidth||!R.operatingBandwidth.mediaType||R.operatingBandwidth.mediaType==="all")return;const C={};C.minBandwidth=R.operatingBandwidth.min,C.maxBandwidth=R.operatingBandwidth.max,C.targetBandwidth=R.operatingBandwidth.target;const B=[];R.operatingBandwidth.mediaType===Hc||R.operatingBandwidth.mediaType===Kc?B.push(R.operatingBandwidth.mediaType):R.operatingBandwidth.mediaType==="any"&&(B.push(Kc),B.push(Hc)),B.forEach(($=>{isNaN(C.minBandwidth)||x("minBitrate",$,C.minBandwidth),isNaN(C.maxBandwidth)||x("maxBitrate",$,C.maxBandwidth),isNaN(C.targetBandwidth)||x("initialBitrate",$,C.targetBandwidth)}))})(A),A.contentSteering&&(function(R){b.contentSteering=R.contentSteering})(A),A.clientDataReporting&&(function(R){b.clientDataReporting=R.clientDataReporting})(A))},reset:function(){k()},setConfig:function(I){I&&I.adapter&&(S=I.adapter)}},v=(0,o.default)(p).getInstance().getLogger(m),k(),m}Yc.__dashjs_factory_name="ServiceDescriptionController";var iy=n.default.getSingletonFactory(Yc);class ay{constructor(m){this._ranges=[];for(const b of m){const T=this._ranges,v={start:b.start,end:b.end},S=T.length?T[T.length-1]:null;!S||v.start>S.end?T.push(v):S.end=v.end}}get length(){return this._ranges.length}start(m){return this._ranges[m].start}end(m){return this._ranges[m].end}}var Wc=class{constructor(p,m){this.eventBus=m,this.mimeType=p,this.updating=!1,this.chunks=[],this.appendWindowStart=0,this.appendWindowEnd=1/0,this.timestampOffset=0,this.mode="segments"}appendBuffer(p,m,b){if(this.updating)throw new Error("SourceBuffer is currently updating");this.updating=!0,this.eventBus.trigger("externalSourceBufferUpdateStart",{mimeType:this.mimeType,request:"appendBuffer",data:p,start:m,end:b}),Number.isNaN(m)||(this.chunks.push({data:p,start:m,end:b}),this.chunks.sort(((T,v)=>T.start-v.start))),setTimeout((()=>{this.updating=!1,this.eventBus.trigger("externalSourceBufferUpdating",{mimeType:this.mimeType}),this.eventBus.trigger("externalSourceBufferUpdateEnd",{mimeType:this.mimeType})}),10)}abort(){this.updating&&(this.updating=!1,this.eventBus.trigger("externalSourceBufferAbort",{mimeType:this.mimeType}),this.eventBus.trigger("externalSourceBufferUpdateEnd",{mimeType:this.mimeType}))}remove(p,m){if(this.updating)throw new Error("SourceBuffer is currently updating");this.updating=!0,this.eventBus.trigger("externalSourceBufferUpdateStart",{mimeType:this.mimeType,request:"remove",start:p,end:m}),this.chunks=this.chunks.filter((b=>b.end<=p||b.start>=m)),setTimeout((()=>{this.updating=!1,this.eventBus.trigger("externalSourceBufferUpdating",{mimeType:this.mimeType}),this.eventBus.trigger("externalSourceBufferUpdateEnd",{mimeType:this.mimeType})}),10)}get buffered(){return new ay(this.chunks)}},sy=class{constructor(p){this.eventBus=p,this.reset()}get duration(){return this._duration}set duration(p){if(this._readyState!=="open")throw new Error("ExternalMediaSource is not open");this._duration=p}get readyState(){return this._readyState}addSourceBuffer(p){if(this._readyState!=="open")throw new Error("ExternalMediaSource is not open");const m=new Wc(p,this.eventBus);return this.sourceBuffers.set(m,p),m}removeSourceBuffer(p){if(!this.sourceBuffers.has(p))throw new Error("ExternalSourceBuffer not found");this.sourceBuffers.delete(p)}open(){this._readyState="open",this.eventBus.trigger("externalMediaSourceOpen",{})}endOfStream(){if(this._readyState!=="open")throw new Error("ExternalMediaSource is not open");this._readyState="ended",this.eventBus.trigger("externalMediaSourceEnded",{})}close(){this._readyState="closed",this.eventBus.trigger("externalMediaSourceClosed",{})}reset(){this.sourceBuffers=new Map,this._duration=NaN,this._readyState="closed"}},oy=class{constructor(){this.streamId=null,this.segmentType=null,this.index=NaN,this.bytes=null,this.start=NaN,this.end=NaN,this.duration=NaN,this.representation=null,this.endFragment=null}},ly=class extends oe{constructor(p){super(p),this.checkForExistenceOnly=!0}};function Xc(p){p=p||{};const m=this.context,b=p.eventBus,T=p.events,v=p.urlUtils,S=p.errors,k=p.streamId;let x,I;return x={abort:function(){I&&I.abort()},checkForExistence:function(N){const O=function(A){b.trigger(T.CHECK_FOR_EXISTENCE_COMPLETED,{request:N,exists:A})};if(N){let A=new ly(N.url);I.load({request:A,success:function(){O(!0)},error:function(){O(!1)}})}else O(!1)},load:function(N){const O=function(A,R){b.trigger(T.LOADING_COMPLETED,{request:N,response:A||null,error:R||null,sender:x})};N?I.load({request:N,progress:function(A){b.trigger(T.LOADING_PROGRESS,{request:N,stream:A.stream,streamId:k}),A.data&&b.trigger(T.LOADING_DATA_PROGRESS,{request:N,response:A.data||null,error:null,sender:x})},success:function(A){O(A)},error:function(A,R,C){O(void 0,new Wt.default(S.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE,C,R))},abort:function(A){A&&b.trigger(T.LOADING_ABANDONED,{mediaType:A.mediaType,request:A,sender:x})}}):O(void 0,new Wt.default(S.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE,S.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE))},reset:function(){I&&(I.abort(),I.reset(),I=null)},resetInitialSettings:function(){I&&I.resetInitialSettings()}},I=ca(m).create({errHandler:p.errHandler,errors:S,dashMetrics:p.dashMetrics,mediaPlayerModel:p.mediaPlayerModel,urlUtils:v,constants:h.default,boxParser:p.boxParser,dashConstants:p.dashConstants,requestTimeout:p.settings.get().streaming.fragmentRequestTimeout}),x}Xc.__dashjs_factory_name="FragmentLoader";var uy=n.default.getClassFactory(Xc);function Qc(p){p=p||{};const m=this.context,b=(0,g.default)(m).getInstance(),T=p.errHandler,v=p.mediaPlayerModel,S=p.dashMetrics,k=(0,o.default)(m).getInstance(),x=p.streamInfo;let I,N,O;function A(){return x.id}function R(){for(let B in O)O[B].reset();O={}}function C(B){if(!B.sender)return;const $=B.request,V=B.response,j=$.isInitializationRequest(),te=$.representation.mediaInfo.streamInfo;if(B.error&&($.mediaType===h.default.AUDIO||$.mediaType===h.default.VIDEO||$.mediaType===h.default.TEXT&&$.representation.mediaInfo.isFragmented)&&b.trigger(f.default.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD,{entry:B.request.serviceLocation}),!V||!te)return void N.warn("No "+$.mediaType+" bytes to push or stream is inactive.");const ie=(function(se,de,G,U){const P=new oy;return P.streamId=G,P.segmentType=de.type,P.start=de.startTime,P.duration=de.duration,P.end=P.start+P.duration,P.bytes=se,P.index=de.index,P.representation=de.representation,P.endFragment=U,P})(V,$,x.id,B.type!==f.default.FRAGMENT_LOADING_PROGRESS);b.trigger(j?f.default.INIT_FRAGMENT_LOADED:f.default.MEDIA_FRAGMENT_LOADED,{chunk:ie,request:$},{streamId:te.id,mediaType:$.mediaType})}return I={getStreamId:A,getModel:function(B){let $=O[B];return $||($=Oe(m).create({streamInfo:x,type:B,dashMetrics:S,fragmentLoader:uy(m).create({dashMetrics:S,mediaPlayerModel:v,errHandler:T,settings:p.settings,boxParser:p.boxParser,eventBus:b,events:f.default,errors:Jt,dashConstants:p.dashConstants,urlUtils:p.urlUtils,streamId:A()}),debug:k,eventBus:b,events:f.default}),O[B]=$),$},reset:function(){b.off(y.default.FRAGMENT_LOADING_COMPLETED,C,this),b.off(y.default.FRAGMENT_LOADING_PROGRESS,C,this),R()}},N=k.getLogger(I),R(),b.on(y.default.FRAGMENT_LOADING_COMPLETED,C,I),b.on(y.default.FRAGMENT_LOADING_PROGRESS,C,I),I}Qc.__dashjs_factory_name="FragmentController";var cy=n.default.getClassFactory(Qc),Ii=class{constructor(p){this.newMediaInfo=p.newMediaInfo,this.previouslySelectedRepresentation=p.previouslySelectedRepresentation,this.newRepresentation=p.newRepresentation}};function Zc(p){const m=this.context,b=(0,l.default)(m).getInstance(),T=p.textController,v=p.eventBus;let S,k,x,I,N,O,A=[],R=[],C=!1,B=p.mediaSource,$=null;function V(X){return X.mimeType+';codecs="'+X.codecs+'"'}function j(X){return I=T.getTextSourceBuffer(X),Promise.resolve()}function te(){if(typeof I.addEventListener=="function")try{I.addEventListener("updateend",P,!1),I.addEventListener("error",M,!1),I.addEventListener("abort",M,!1)}catch{O=setInterval(P,50)}else O=setInterval(P,50)}function ie(){try{typeof I.removeEventListener=="function"&&(I.removeEventListener("updateend",P,!1),I.removeEventListener("error",M,!1),I.removeEventListener("abort",M,!1)),clearInterval(O)}catch(X){x.error(X)}}function se(X){return new Promise((be=>{I&&b.get().streaming.buffer.useAppendWindow?ge((()=>{try{if(!I)return void be();let fe=B.duration,Te=0;X&&!isNaN(X.start)&&!isNaN(X.duration)&&isFinite(X.duration)&&(fe=X.start+X.duration),X&&!isNaN(X.start)&&(Te=X.start),I.appendWindowEnd===fe&&I.appendWindowStart===Te||(I.appendWindowStart=0,I.appendWindowEnd=fe+.01,I.appendWindowStart=Math.max(Te-.1,0),x.debug(`Updated append window for ${N.type}. Set start to ${I.appendWindowStart} and end to ${I.appendWindowEnd}`)),be()}catch{x.warn("Failed to set append window"),be()}})):be()}))}function de(X){return new Promise((be=>{I?ge((()=>{try{I.timestampOffset===X||isNaN(X)||(I.timestampOffset=X,x.debug(`Set MSE timestamp offset to ${X}`)),be()}catch{be()}})):be()}))}function G(){if(!C&&R.length>0){C=!0;const X=R[0];R.splice(0,1);const be=function(){C=!1,R.length>0&&G.call(this),X&&X.data&&X.data.segmentType&&X.data.segmentType!==ke.HTTPRequest.INIT_SEGMENT_TYPE&&delete X.data.bytes,X.promise.resolve({chunk:X.data})};try{if($=X.request,X.data.bytes.byteLength===0)be.call(this);else{try{x.debug(`Appending ${X.data.segmentType} from period ${X.data.streamId} to buffer. Request URL: ${X.request.url}, Representation: ID: ${X.data.representation.id}, bitrate: ${X.data.representation.bitrateInKbit}`)}catch{}I instanceof Wc?I.appendBuffer(X.data.bytes,X.data.start,X.data.end):I.appendBuffer?I.appendBuffer(X.data.bytes):I.append(X.data.bytes,X.data),ge(be.bind(this))}}catch(fe){x.fatal('SourceBuffer append failed "'+fe+'"'),R.length>0?G():C=!1,delete X.data.bytes,X.promise.reject({chunk:X.data,error:new Wt.default(fe.code,fe.message)})}}}function U(){A.length>0&&!I.updating&&(A.shift()(),U())}function P(){I.updating||U()}function M(X){const be=X.target||{};(function(fe,Te){let Ce=Te||{};v.trigger(fe,Ce,{streamId:N.streamInfo.id,mediaType:k})})(f.default.SOURCE_BUFFER_ERROR,{error:be,lastRequestAppended:$})}function ge(X){try{A.push(X),I&&!I.updating&&U()}catch(be){x.error(be)}}return S={abort:function(){return new Promise((X=>{try{R=[],B.readyState==="open"?ge((()=>{try{I&&I.abort(),X()}catch{X()}})):(I&&I.setTextTrack&&B.readyState==="ended"&&I.abort(),X())}catch{X()}}))},abortBeforeAppend:function(){return new Promise((X=>{ge((()=>{const be=I.appendWindowStart,fe=I.appendWindowEnd;I&&(I.abort(),I.appendWindowStart=be,I.appendWindowEnd=fe),X()}))}))},append:function(X,be=null){return new Promise(((fe,Te)=>{X?(R.push({data:X,promise:{resolve:fe,reject:Te},request:be}),ge(G.bind(this))):Te({chunk:X,error:new Wt.default(Jt.APPEND_ERROR_CODE,Jt.APPEND_ERROR_MESSAGE)})}))},changeType:function(X){const be=V(X);return new Promise((fe=>{ge((()=>{I.changeType&&(x.debug(`Changing SourceBuffer codec to ${be}`),I.changeType(be)),fe()}))}))},getAllBufferRanges:function(){try{return I?.buffered}catch(X){return x.error("getAllBufferRanges exception: "+X.message),null}},getBuffer:function(){return I},getType:function(){return k},initializeForFirstUse:function(X,be){N=X;const fe=X.streamInfo;k=N.type;const Te=be?V(be):X.codec;try{if(Te.match(/application\/mp4;\s*codecs="(stpp|wvtt).*"/i))return j(fe);I=B.addSourceBuffer(Te),te();const Ce=[];return Ce.push(se(N.streamInfo)),be&&be.mseTimeOffset!==void 0&&Ce.push(de(be.mseTimeOffset)),Promise.all(Ce)}catch(Ce){return N.type==h.default.TEXT&&!N.isFragmented||Te.indexOf('codecs="stpp')!==-1||Te.indexOf('codecs="vtt')!==-1||Te.indexOf("text/vtt")!==-1?j(fe):Promise.reject(Ce)}},initializeForStreamSwitch:function(X,be,fe){N=X,k=N.type,(function(Te){I=Te.getBuffer()})(fe),te()},remove:function(X){return new Promise(((be,fe)=>{const Te=X.start,Ce=X.end;Te>=0&&Ce>Te?ge((function(){try{I.remove(Te,Ce),ge((function(){be({from:Te,to:Ce,unintended:!1}),X.resolve&&X.resolve()}))}catch(Ie){fe({from:Te,to:Ce,unintended:!1,error:new Wt.default(Jt.REMOVE_ERROR_CODE,Jt.REMOVE_ERROR_MESSAGE)}),X.reject&&X.reject(Ie)}})):be()}))},removeEventListeners:ie,reset:function(){if(I){try{A=[],ie(),C=!1,R=[],I.getClassName&&I.getClassName()==="TextSourceBuffer"||(x.debug("Removing sourcebuffer from media source"),B.removeSourceBuffer(I))}catch{}I=null}$=null},updateAppendWindow:se,updateTimestampOffset:de},x=(0,o.default)(m).getInstance().getLogger(S),S}Zc.__dashjs_factory_name="SourceBufferSink";var Jc=n.default.getClassFactory(Zc);function ed(p){const m=this.context;let b,T,v,S=[],k=p;function x(I,N){return S=S.filter((O=>!((isNaN(N)||O.start<N)&&(isNaN(I)||O.end>I)))),Promise.resolve()}return b={getAllBufferRanges:function(){let I=[];for(let O=0;O<S.length;O++){let A=S[O];I.length===0||A.start>I[I.length-1].end?I.push({start:A.start,end:A.end}):I[I.length-1].end=A.end}const N={start:function(O){return I[O].start},end:function(O){return I[O].end}};return Object.defineProperty(N,"length",{get:function(){return I.length}}),N},append:function(I){return I.segmentType!=="InitializationSegment"?(S.push(I),S.sort((function(N,O){return N.start-O.start})),v=null):v=I,T.debug("PreBufferSink appended chunk s: "+I.start+"; e: "+I.end),k&&k({chunk:I}),Promise.resolve()},remove:x,abort:function(){return Promise.resolve()},discharge:function(I,N){const O=(function(A,R){return S.filter((C=>(isNaN(R)||C.start<R)&&(isNaN(A)||C.end>A)))})(I,N);return v&&(O.push(v),v=null),x(I,N),O},reset:function(){S=[],v=null,k=null},updateTimestampOffset:function(){return Promise.resolve()},waitForUpdateEnd:function(I){I()},getBuffer:function(){return this}},T=(0,o.default)(m).getInstance().getLogger(b),b}ed.__dashjs_factory_name="PreBufferSink";var dy=n.default.getClassFactory(ed);function td(){let p={};return{save:function(m){const b=m.streamId,T=m.representation.id;p[b]=p[b]||{},p[b][T]=m},extract:function(m,b){return p&&p[m]&&p[m][b]?p[m][b]:null},reset:function(){p={}}}}td.__dashjs_factory_name="InitCache";var Go=n.default.getSingletonFactory(td);const $o=.01,nd="BufferController";function rd(p){const m=(p=p||{}).capabilities,b=this.context,T=(0,g.default)(b).getInstance(),v=p.fragmentModel,S=p.playbackController,k=p.representationController,x=p.settings,I=p.streamInfo,N=p.textController,O=p.type;let A,R,C,B,$,V,j,te,ie,se,de,G,U,P,M,ge,X,be,fe,Te,Ce;function Ie(Fe,$e=null){return new Promise(((yt,Ke)=>{V=Fe,ie&&$e&&typeof ie.discharge=="function"?(se=ie,q($e).then((()=>{yt()})).catch((It=>{Ke(It)}))):yt()}))}function q(Fe,$e=new Map,yt){return new Promise(((Ke,It)=>{be&&Fe?V?(de=!1,(function(Ct,_e,Qe){return new Promise((Lt=>{ie=Jc(b).create({mediaSource:V,textController:N,eventBus:T}),(function(Dt,Sn,ot){const Gt=k.getCurrentRepresentation();let fn=null;return O!==h.default.VIDEO&&O!==h.default.AUDIO||(fn=Sn.get(O)),fn?(function(cn,In,mn,Gn){ie.initializeForStreamSwitch(cn,In,mn);const tr=[];return tr.push(ie.abortBeforeAppend()),tr.push(qe()),tr.push(ce(In,Gn)),In&&In.mseTimeOffset!==void 0&&tr.push(vn(In)),Promise.allSettled(tr)})(Dt,Gt,fn,ot):(function(cn,In){return ie.initializeForFirstUse(cn,In)})(Dt,Gt)})(Ct,_e,Qe).then((()=>vn(k.getCurrentRepresentation()))).then((()=>{Lt(ie)})).catch((Dt=>{R.warn("Caught error on create SourceBuffer: "+Dt),Lt(ie)}))}))})(Fe,$e,yt).then((Ct=>{Ke(Ct)})).catch((Ct=>{It(Ct)}))):(de=!0,(function(){return new Promise(((Ct,_e)=>{ie=dy(b).create(le.bind(this)),vn(k.getCurrentRepresentation()).then((()=>{Ct(ie)})).catch((()=>{_e()}))}))})().then((Ct=>{Ke(Ct)})).catch((Ct=>{It(Ct)}))):Ke(null)}))}function W(Fe){x.get().streaming.cacheInitSegments&&(R.info("Init fragment finished loading saving to",O+"'s init cache"),be.save(Fe.chunk)),R.debug(`Appending init fragment for type ${O}, representationId ${Fe.chunk.representation.id} and bandwidth ${Fe.chunk.representation.bandwidth}`),ee(Fe.chunk)}function re(Fe){ee(Fe.chunk,Fe.request)}function ee(Fe,$e=null){ie&&(ie.append(Fe,$e).then((yt=>{le(yt)})).catch((yt=>{le(yt)})),Fe.representation.mediaInfo.type===h.default.VIDEO&&Tt(f.default.VIDEO_CHUNK_RECEIVED,{chunk:Fe}))}function ne(Fe){if(Fe&&Fe.length>0)for(let $e=0,yt=Fe.length;$e<yt;$e++)R.debug("Buffered range: "+Fe.start($e)+" - "+Fe.end($e)+", currentTime = ",S.getTime())}function le(Fe){if(Fe.error)return Fe.error.code===22&&(function(){if(X=!0,$=.8*Yt(),R.warn("Quota exceeded, Critical Buffer: "+$),$>0){const Ke=Math.max(.2*$,1),It=$-Ke,Ct=Math.min(x.get().streaming.buffer.bufferTimeAtTopQuality,.9*It),_e=Math.min(x.get().streaming.buffer.bufferTimeAtTopQualityLongForm,.9*It),Qe={streaming:{buffer:{bufferToKeep:parseFloat(Ke.toFixed(5)),bufferTimeAtTopQuality:parseFloat(Ct.toFixed(5)),bufferTimeAtTopQualityLongForm:parseFloat(_e.toFixed(5))}}};x.update(Qe)}})(),void(Fe.error.code!==22&&rt()||(R.warn("Clearing playback buffer to overcome quota exceed situation"),Tt(f.default.QUOTA_EXCEEDED,{criticalBufferLevel:$,quotaExceededTime:Fe.chunk.start}),Rn(un())));if(!ie||(ct(),X=!1,P=Fe.chunk,!P||!P.endFragment))return;P&&!isNaN(P.index)&&(j=Math.max(P.index,j),bt());const $e=ie.getAllBufferRanges();P.segmentType===ke.HTTPRequest.MEDIA_SEGMENT_TYPE&&(ne($e),Re(),(function(){if(isNaN(Ce)||de)return;if(O!==h.default.AUDIO&&O!==h.default.VIDEO)return void(Ce=NaN);const Ke=S.getTime(),It=Ye(Ke,0),Ct=Ye(Ce,0);if(It&&Ct&&It.start===Ct.start)return void(Ce=NaN);const _e=k.getCurrentRepresentation().segmentDuration,Qe=Ye(Ce,_e);Qe&&(x.get().streaming.buffer.enableSeekDecorrelationFix&&Math.abs(Ke-Ce)>_e?Ce<=Qe.end&&S.seek(Math.max(Ce,Qe.start),!1,!0):Ke<Qe.start&&S.seek(Qe.start,!1,!0))})());let yt=!1;G&&(G.indexOf(P)>0&&(yt=!0),G=null),P&&!yt&&Tt(f.default.BYTES_APPENDED_END_FRAGMENT,{startTime:P.start,index:P.index,bufferedRanges:$e,segmentType:P.segmentType,mediaType:O,representationId:P.representation.id})}function z(Fe,$e){const yt=[];return yt.push(vn(Fe)),yt.push(ie?ie.abort():Promise.resolve()),yt.push(ce(Fe,$e)),Promise.allSettled(yt)}function ce(Fe,$e){if(!Fe||!$e)return R.warn("BufferController._changeCodec() is missing the information about the Representations. Doing nothing"),Promise.resolve();if(Fe&&$e&&Fe.mimeType===$e.mimeType&&Fe.codecFamily===$e.codecFamily)return R.debug(`Switching to new codec ${Fe.codecs} without changeType as previous codec ${$e.codecs} is compatible.`),Promise.resolve();if(!x.get().streaming.buffer.useChangeType||!m.supportsChangeType())return R.debug("changeType() not available"),Promise.resolve();R.debug(`Using changeType() to switch from codec ${$e.codecs} to ${Fe.codecs}`);const yt=Fe.dependentRepresentation?Fe.dependentRepresentation:Fe;return ie.changeType(yt)}function me(){return new Promise(((Fe,$e)=>{let yt=Se();if(!yt||yt.length===0)return Re(),void Fe();Rn(yt).then((()=>{Fe()})).catch((Ke=>{$e(Ke)}))}))}function Se(Fe){const $e=[],yt=ie.getAllBufferRanges();if(!yt||yt.length===0)return $e;if(!Fe&&Fe!==0||isNaN(Fe))$e.push({start:yt.start(0),end:yt.end(yt.length-1)+.5});else{const Ke=(function(Ct,_e){const Qe=x.get().streaming.buffer.bufferToKeep,Lt=_e.start(0);if(Ct-Lt>Qe){let Dt=Math.max(0,Ct-Qe);const Sn=v.getRequests({state:Oe.FRAGMENT_MODEL_EXECUTED,time:Ct,threshold:$o})[0];if(Sn&&(Dt=Math.min(Sn.startTime,Dt)),Dt>0)return{start:Lt,end:Dt}}return null})(Fe,yt),It=(function(Ct,_e){const Qe=_e.end(_e.length-1)+.5,Lt=En(Ct),Dt=I.manifestInfo.duration>=x.get().streaming.buffer.longFormContentDurationThreshold?x.get().streaming.buffer.bufferTimeAtTopQualityLongForm:x.get().streaming.buffer.bufferTimeAtTopQuality;let Sn=isNaN(Lt)?Ct:Math.min(Lt,Ct+Dt);if(Sn>=_e.end(_e.length-1))return null;const ot=v.getRequests({state:Oe.FRAGMENT_MODEL_EXECUTED,time:Ct,threshold:$o})[0];if(ot&&(Sn=Math.max(ot.startTime+ot.duration,Sn)),x.get().streaming.buffer.avoidCurrentTimeRangePruning){for(let Gt=0;Gt<_e.length;Gt++)if(_e.start(Gt)<=Ct&&Ct<=_e.end(Gt)&&_e.start(Gt)<=Sn&&Sn<=_e.end(Gt)){let fn=Sn;Sn=Gt+1<_e.length?_e.start(Gt+1):_e.end(Gt)+1,R.debug("Buffered range ["+_e.start(Gt)+", "+_e.end(Gt)+"] overlaps with targetTime "+Ct+" and range to be pruned ["+fn+", "+Qe+"], using ["+Sn+", "+Qe+"] instead"+(Sn<Qe?"":" (no actual pruning)"));break}}return Sn<_e.end(_e.length-1)?{start:Sn,end:Qe}:null})(Fe,yt);Ke&&$e.push(Ke),It&&$e.push(It)}return $e}function Re(){(!Te||O===h.default.TEXT&&N.isTextEnabled())&&ct()}function we(){Zt()}function ze(){Zt(),Ce=NaN}function Ye(Fe,$e){if(!ie)return null;const yt=ie.getAllBufferRanges();let Ke,It,Ct=0,_e=0,Qe=null,Lt=null,Dt=0;const Sn=isNaN($e)?.15:$e;if(yt!=null){for(It=0,Ke=yt.length;It<Ke;It++)if(Ct=yt.start(It),_e=yt.end(It),Qe===null)Dt=Math.abs(Ct-Fe),(Fe>=Ct&&Fe<_e||Dt<=Sn)&&(Qe=Ct,Lt=_e);else{if(Dt=Ct-Lt,!(Dt<=Sn))break;Lt=_e}if(Qe!==null)return{start:Qe,end:Lt}}return null}function ct(){if(S){let Fe=S.getTime()||0;de&&(Fe=isNaN(Ce)?0:Ce);const $e=x.get().streaming.gaps.jumpGaps&&!isNaN(x.get().streaming.gaps.smallGapLimit)?x.get().streaming.gaps.smallGapLimit:NaN;B=Math.max((function(yt,Ke){let It,Ct;return x.get().streaming.gaps.jumpGaps&&(Ke=x.get().streaming.gaps.smallGapLimit),It=Ye(yt,Ke),Ct=It===null?0:It.end-yt,Ct})(Fe,$e),0),Tt(f.default.BUFFER_LEVEL_UPDATED,{mediaType:O,bufferLevel:B}),Zt()}}function bt(){const Fe=j>=te-1,$e=S.getTimeToStreamEnd(I)-B<1e-5;!Fe&&!$e||C||(_t(!0),R.debug(`checkIfBufferingCompleted trigger BUFFERING_COMPLETED for stream id ${I.id} and type ${O}`))}function Zt(){if(O!==h.default.AUDIO&&O!==h.default.VIDEO)return;const Fe=S.getLowLatencyModeEnabled()?x.get().streaming.buffer.lowLatencyStallThreshold:x.get().streaming.buffer.stallThreshold;B<=Fe&&!C?vt(i.BUFFER_EMPTY):(C||B>Fe)&&vt(i.BUFFER_LOADED)}function vt(Fe){U===Fe||Fe===i.BUFFER_EMPTY&&S.getTime()===0||O===h.default.TEXT&&!N.isTextEnabled()||(U=Fe,Tt(f.default.BUFFER_LEVEL_STATE_CHANGED,{state:Fe}),Tt(Fe===i.BUFFER_LOADED?f.default.BUFFER_LOADED:f.default.BUFFER_EMPTY),R.debug(Fe===i.BUFFER_LOADED?"Got enough buffer to start":"Waiting for more buffer before starting playback"))}function Qt(){ie&&O!==h.default.TEXT&&(C||Rn(un()))}function un(){const Fe=[],$e=ie.getAllBufferRanges();if(!$e||$e.length===0)return Fe;const yt=S.getTime();let Ke=Math.max(0,yt-x.get().streaming.buffer.bufferToKeep);const It=v.getRequests({state:Oe.FRAGMENT_MODEL_EXECUTED,time:yt,threshold:$o})[0];if(It)Ke=Math.min(It.startTime,Ke);else if(yt===0&&S.getIsDynamic())return[];if($e.start(0)<=Ke){const Ct={start:0,end:Ke};for(let _e=0;_e<$e.length&&$e.end(_e)<=Ke;_e++)Ct.end=$e.end(_e);Ct.start<Ct.end&&Fe.push(Ct)}return Fe}function Rn(Fe){return new Promise((($e,yt)=>{if(!Fe||!ie||Fe.length===0)return ct(),void $e();const Ke=[];Fe.forEach((It=>{Ke.push((function(Ct){return new Promise(((_e,Qe)=>{Ct.resolve=_e,Ct.reject=Qe,fe.push(Ct)}))})(It))})),ge||xn(),Promise.all(Ke).then((()=>{$e()})).catch((It=>{yt(It)}))}))}function xn(){try{if(fe.length===0||!ie)return R.debug("Nothing to prune, halt pruning"),fe=[],void(ge=!1);const Fe=ie.getBuffer();if(!Fe||!Fe.buffered||Fe.buffered.length===0)return R.debug("SourceBuffer is empty (or does not exist), halt pruning"),fe=[],void(ge=!1);const $e=fe.shift();R.debug(`${O}: Removing buffer from: ${$e.start} to ${$e.end}`),ge=!0,S.getTime()<$e.end&&_t(!1),ie.remove($e).then((yt=>{dn(yt)})).catch((yt=>{dn(yt)}))}catch{ge=!1}}function dn(Fe){R.debug("onRemoved buffer from:",Fe.from,"to",Fe.to),ie&&(ne(ie.getAllBufferRanges()),fe.length===0&&(ge=!1,ct()),Fe.unintended&&(R.warn("Detected unintended removal from:",Fe.from,"to",Fe.to,"setting streamprocessor time to",Fe.from),Tt(f.default.SEEK_TARGET,{time:Fe.from})),ge?xn():(Te?Te=!1:ct(),Tt(f.default.BUFFER_CLEARED,{from:Fe.from,to:Fe.to,unintended:Fe.unintended,hasEnoughSpaceToAppend:rt(),quotaExceeded:X})))}function vn(Fe){return new Promise(($e=>{Fe&&Fe.mseTimeOffset!==void 0&&ie&&ie.updateTimestampOffset?ie.updateTimestampOffset(Fe.mseTimeOffset).then((()=>{$e()})).catch((()=>{$e()})):$e()}))}function qe(){return ie&&!C?ie.updateAppendWindow(I):Promise.resolve()}function pt(){M++,M*(x.get().streaming.wallclockTimeUpdateInterval/1e3)>=x.get().streaming.buffer.bufferPruningInterval&&(M=0,Qt())}function ft(){Zt()}function _t(Fe){C=Fe,C?Tt(f.default.BUFFERING_COMPLETED):te=Number.POSITIVE_INFINITY}function Yt(){try{const Fe=ie.getAllBufferRanges();let $e,yt,Ke=0;if(!Fe)return Ke;for(yt=0,$e=Fe.length;yt<$e;yt++)Ke+=Fe.end(yt)-Fe.start(yt);return Ke}catch{return 0}}function En(Fe){try{let $e=Fe;const yt=ie.getAllBufferRanges();if(!yt||yt.length===0)return NaN;let Ke=0;for(;$e===Fe&&Ke<yt.length;){const It=yt.start(Ke),Ct=yt.end(Ke);$e>=It&&$e<=Ct&&($e=Ct),Ke+=1}return $e===Fe?NaN:$e}catch{return NaN}}function rt(){const Fe=Yt();return isNaN(Fe)||Fe<$}function Tt(Fe,$e){let yt=$e||{};T.trigger(Fe,yt,{streamId:I.id,mediaType:O})}function Mt(Fe,$e){if($=Number.POSITIVE_INFINITY,U=void 0,te=Number.POSITIVE_INFINITY,j=0,P=null,C=!1,ge=!1,X=!1,B=0,M=0,fe=[],Ce=NaN,de=!1,ie){let yt=ie;ie=null,Fe||($e?yt.removeEventListeners():yt.abort().then((()=>{yt.reset($e),yt=null})))}Te=!1}return A={appendInitSegmentFromCache:function(Fe){const $e=be.extract(I.id,Fe);return!!$e&&(R.debug(`Appending init fragment for type ${O}, representationId ${$e.representation.id} and bandwidth ${$e.representation.bandwidth}`),ee($e),!0)},clearBuffers:Rn,createBufferSink:q,dischargePreBuffer:function(){if(ie&&se&&typeof se.discharge=="function"){const Fe=se.getAllBufferRanges();if(Fe.length>0){let Ke="Beginning "+O+"PreBuffer discharge, adding buffer for:";for(let It=0;It<Fe.length;It++)Ke+=" start: "+Fe.start(It)+", end: "+Fe.end(It)+";";R.debug(Ke)}else R.debug("PreBuffer discharge requested, but there were no media segments in the PreBuffer.");G=[];let $e=se.discharge(),yt=null;for(let Ke=0;Ke<$e.length;Ke++){const It=$e[Ke];if(It.segmentType!==ke.HTTPRequest.INIT_SEGMENT_TYPE){const Ct=be.extract(It.streamId,It.representation.id);Ct&&yt!==Ct&&(G.push(Ct),ie.append(Ct),yt=Ct)}G.push(It),ie.append(It)}se.reset(),se=null}},getAllRangesWithSafetyFactor:Se,getBuffer:function(){return ie},getBufferControllerType:function(){return nd},getBufferLevel:function(){return B},getContinuousBufferTimeForTargetTime:En,getIsBufferingCompleted:function(){return C},getIsPruningInProgress:function(){return ge},getMediaSource:function(){return V},getRangeAt:Ye,getStreamId:function(){return I.id},getType:function(){return O},hasBufferAtTime:function(Fe){try{const $e=ie.getAllBufferRanges();if(!$e||$e.length===0)return!1;let yt=0;for(;yt<$e.length;){const Ke=$e.start(yt),It=$e.end(yt);if(Fe>=Ke&&Fe<=It)return!0;yt+=1}return!1}catch($e){return R.error($e),!1}},initialize:function(Fe){Ie(Fe),T.on(f.default.INIT_FRAGMENT_LOADED,W,A),T.on(f.default.MEDIA_FRAGMENT_LOADED,re,A),T.on(f.default.WALLCLOCK_TIME_UPDATED,pt,A),T.on(y.default.PLAYBACK_PLAYING,ze,A),T.on(y.default.PLAYBACK_PROGRESS,Re,A),T.on(y.default.PLAYBACK_TIME_UPDATED,Re,A),T.on(y.default.PLAYBACK_RATE_CHANGED,ft,A),T.on(y.default.PLAYBACK_STALLED,we,A)},prepareForAbandonQualitySwitch:function(Fe,$e){return z(Fe,$e)},prepareForDefaultQualitySwitch:function(Fe,$e){return z(Fe,$e)},prepareForFastQualitySwitch:function(Fe,$e){return z(Fe,$e)},prepareForForceReplacementQualitySwitch:function(Fe,$e){return new Promise((yt=>{const Ke=[];Ke.push(ie.abort()),Ke.push(qe()),Ke.push(me()),Ke.push(vn(Fe)),Ke.push(ce(Fe,$e)),Promise.allSettled(Ke).then((()=>{_t(!1),yt()}))}))},prepareForNonReplacementTrackSwitch:function(Fe,$e){return new Promise((yt=>{const Ke=[];Ke.push(qe()),Ke.push(ce(Fe,$e)),Promise.allSettled(Ke).then((()=>{yt()}))}))},prepareForPlaybackSeek:function(){return C&&_t(!1),ie.abort()},prepareForReplacementTrackSwitch:function(Fe,$e){return new Promise((yt=>{const Ke=[];Ke.push(ie.abort()),Ke.push(qe()),Ke.push(ce(Fe,$e)),Ke.push(me()),Ke.push(vn(Fe)),Promise.allSettled(Ke).then((()=>{_t(!1),yt()}))}))},pruneAllSafely:me,pruneBuffer:Qt,reset:function(Fe,$e){T.off(f.default.INIT_FRAGMENT_LOADED,W,this),T.off(f.default.MEDIA_FRAGMENT_LOADED,re,this),T.off(f.default.WALLCLOCK_TIME_UPDATED,pt,this),T.off(y.default.PLAYBACK_PLAYING,ze,this),T.off(y.default.PLAYBACK_PROGRESS,Re,this),T.off(y.default.PLAYBACK_TIME_UPDATED,Re,this),T.off(y.default.PLAYBACK_RATE_CHANGED,ft,this),T.off(y.default.PLAYBACK_STALLED,we,this),Mt(Fe,$e)},segmentRequestingCompleted:function(Fe){isNaN(Fe)||(te=Fe,bt())},setIsBufferingCompleted:_t,setMediaSource:Ie,setSeekTarget:function(Fe){Ce=Fe},updateAppendWindow:qe,updateBufferTimestampOffset:vn},R=(0,o.default)(b).getInstance().getLogger(A),be=Go(b).getInstance(),Mt(),A}rd.__dashjs_factory_name=nd;var fy=n.default.getClassFactory(rd);const id="NotFragmentedTextBufferController";function ad(p){p=p||{};const m=this.context,b=(0,g.default)(m).getInstance(),T=p.textController,v=p.errHandler,S=p.streamInfo,k=p.type;let x,I,N,O,A,R;function C(V){O=V}function B(V){I!==V&&(I=V,I&&(function(j){let te={};b.trigger(j,te,{streamId:S.id,mediaType:k})})(f.default.BUFFERING_COMPLETED))}function $(V){V.chunk.bytes&&!I&&(R.save(V.chunk),A.append(V.chunk),B(!0))}return x={initialize:function(V){C(V)},getStreamId:function(){return S.id},getType:function(){return k},getBufferControllerType:function(){return id},createBufferSink:function(V){return new Promise(((j,te)=>{try{A=Jc(m).create({mediaSource:O,textController:T,eventBus:b}),A.initializeForFirstUse(V),N||(A.getBuffer()&&typeof A.getBuffer().initialize=="function"&&A.getBuffer().initialize(),N=!0),j(A)}catch(ie){v.error(new Wt.default(Jt.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,Jt.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+k)),te(ie)}}))},dischargePreBuffer:function(){},getBuffer:function(){return A},getBufferLevel:function(){return 0},getRangeAt:function(){return null},pruneBuffer:function(){},hasBufferAtTime:function(){return!0},getAllRangesWithSafetyFactor:function(){return[]},getContinuousBufferTimeForTargetTime:function(){return Number.POSITIVE_INFINITY},setMediaSource:C,getMediaSource:function(){return O},appendInitSegmentFromCache:function(V){return R.extract(S.id,V)!==null},getIsBufferingCompleted:function(){return I},setIsBufferingCompleted:B,getIsPruningInProgress:function(){return!1},reset:function(V){b.off(f.default.INIT_FRAGMENT_LOADED,$,x),!V&&A&&(A.abort(),A.reset(),A=null)},clearBuffers:function(){return Promise.resolve()},prepareForPlaybackSeek:function(){return Promise.resolve()},prepareForReplacementTrackSwitch:function(){return I=!1,Promise.resolve()},setSeekTarget:function(){},updateAppendWindow:function(){return Promise.resolve()},pruneAllSafely:function(){return Promise.resolve()},updateBufferTimestampOffset:function(){return Promise.resolve()},segmentRequestingCompleted:function(){}},N=!1,O=null,I=!1,R=Go(m).getInstance(),b.on(f.default.INIT_FRAGMENT_LOADED,$,x),x}ad.__dashjs_factory_name=id;var hy=n.default.getClassFactory(ad);function sd(p){p=p||{};const m=this.context,b=(0,g.default)(m).getInstance(),T=p.dashMetrics,v=p.mediaPlayerModel,S=p.fragmentModel,k=p.abrController,x=p.playbackController,I=p.textController,N=p.type,O=p.bufferController,A=p.representationController,R=p.settings;let C,B,$,V,j,te,ie,se,de,G,U,P;function M(){ie=(0,o.default)(m).getInstance().getLogger(V),ne(),G=p.streamInfo}function ge(){se=!0}function X(){se=!1}function be(le){if(O.getIsBufferingCompleted())return;fe();const z=isNaN(le)?0:le;de=setTimeout(Te,z)}function fe(){de&&(clearTimeout(de),de=null)}function Te(){const le=v.getScheduleTimeout();try{if((function(){try{return N===h.default.TEXT&&!I.isTextEnabled()||x.isPaused()&&(!x.getStreamController().getInitialPlayback()||!x.getStreamController().getAutoPlay())&&!R.get().streaming.scheduling.scheduleWhilePaused}catch{return!1}})())return void fe();(function(){try{return!!se&&A.getCurrentRepresentation()&&(te==null||U||(function(){const z=A.getCurrentRepresentation();if(!N||!z)return!0;let ce=z&&z.segmentDuration&&!isNaN(z.segmentDuration)?z.segmentDuration:0;const me=T.getCurrentBufferLevel(N),Se=Ce();return(Se<=ce||x.getLowLatencyModeEnabled()||N===h.default.AUDIO&&B)&&(ce=0),me+ce<Se})())}catch{return!1}})()?(function(){if(k.handlePendingManualQualitySwitch(G.id,N))return;let z=!1;C&&(z=k.checkPlaybackQuality(N,G.id)),z||(function(){const ce=A.getCurrentRepresentation();$||ce.id!==te||U?(function(me){U?(ie.debug("Switch track for "+N+", representation id = "+me.id),U=!1):ie.debug("Quality has changed, get init request for representationid = "+me.id),b.trigger(f.default.INIT_FRAGMENT_NEEDED,{representationId:me.id,sender:V},{streamId:G.id,mediaType:N}),C=!1,$=!1})(ce):(ie.debug(`Media segment needed for ${N} and stream id ${G.id}`),b.trigger(f.default.MEDIA_FRAGMENT_NEEDED,{},{streamId:G.id,mediaType:N}),C=!0)})()})():be(le)}catch{be(le)}}function Ce(){let le=NaN;const z=A.getCurrentRepresentation();return N&&z&&(le=N===h.default.TEXT?(function(){try{if(I.isTextEnabled()){const ce=A.getCurrentRepresentation();if(isNaN(ce.fragmentDuration)){const me=T.getCurrentSchedulingInfo(i.SCHEDULING_INFO);return me?me.duration:0}return ce.fragmentDuration}return 0}catch{return 0}})():N===h.default.AUDIO&&B?(function(){try{const ce=T.getCurrentBufferLevel(h.default.VIDEO),me=A.getCurrentRepresentation();return isNaN(me.fragmentDuration)?ce+1:Math.max(ce+1,me.fragmentDuration)}catch{return 0}})():(function(){try{const ce=R.get().streaming.enhancement.enabled?A.getCurrentCompositeRepresentation():A.getCurrentRepresentation(),me=ce.mediaInfo.streamInfo;return k.isPlayingAtTopQuality(ce)?me.manifestInfo.duration>=R.get().streaming.buffer.longFormContentDurationThreshold?R.get().streaming.buffer.bufferTimeAtTopQualityLongForm:R.get().streaming.buffer.bufferTimeAtTopQuality:v.getBufferTimeDefaultUnadjusted()}catch{return v.getBufferTimeDefaultUnadjusted()}})()),le}function Ie(){q(!0)}function q(le){if(x&&S){const z=S.getRequests({state:Oe.FRAGMENT_MODEL_EXECUTED,time:x.getTime(),threshold:0})[0];z&&x.getTime()>=z.startTime&&((!j.representation||z.representation.mediaInfo.type===j.representation.mediaInfo.type&&z.representation.mediaInfo.index!==j.representation.mediaInfo.index)&&le&&(function(ce){ie.debug(`Track change rendered for streamId ${G.id} and type ${N}`),b.trigger(f.default.TRACK_CHANGE_RENDERED,{mediaType:N,oldMediaInfo:j&&j.representation&&j.representation.mediaInfo?j.representation.mediaInfo:null,newMediaInfo:ce.representation.mediaInfo,streamId:G.id})})(z),j.representation&&z.representation.id===j.representation.id||!le||(function(ce){ie.debug(`Quality change rendered for streamId ${G.id} and type ${N}`),b.trigger(f.default.QUALITY_CHANGE_RENDERED,{mediaType:N,oldRepresentation:j.representation?j.representation:null,newRepresentation:ce.representation,streamId:G.id})})(z),j.representation=z.representation)}}function W(){S.abortRequests(),fe()}function re(){R.get().streaming.scheduling.scheduleWhilePaused||be()}function ee(le){T.updatePlayListTraceMetrics({playbackspeed:le.playbackRate.toString()})}function ne(){C=!0,P=0,te=null,j={representation:null},U=!1,$=!1,se=!0}return V={clearScheduleTimer:fe,getBufferTarget:Ce,getPlaybackController:function(){return x},getStreamId:function(){return G.id},getSwitchTrack:function(){return U},getTimeToLoadDelay:function(){return P},getType:function(){return N},initialize:function(le){B=le,b.on(f.default.URL_RESOLUTION_FAILED,W,V),b.on(y.default.PLAYBACK_STARTED,re,V),b.on(y.default.PLAYBACK_RATE_CHANGED,ee,V),b.on(y.default.PLAYBACK_TIME_UPDATED,Ie,V),b.on(y.default.MANAGED_MEDIA_SOURCE_START_STREAMING,ge,V),b.on(y.default.MANAGED_MEDIA_SOURCE_END_STREAMING,X,V)},reset:function(){b.off(f.default.URL_RESOLUTION_FAILED,W,V),b.off(y.default.PLAYBACK_STARTED,re,V),b.off(y.default.PLAYBACK_RATE_CHANGED,ee,V),b.off(y.default.PLAYBACK_TIME_UPDATED,Ie,V),b.off(y.default.MANAGED_MEDIA_SOURCE_START_STREAMING,ge,V),b.off(y.default.MANAGED_MEDIA_SOURCE_END_STREAMING,X,V),fe(),q(!1),ne(),G=null},setShouldCheckPlaybackQuality:function(le){C=le},setInitSegmentRequired:function(le){$=le},setLastInitializedRepresentationId:function(le){te=le},setup:M,setSwitchTrack:function(le){U=le},setTimeToLoadDelay:function(le){P=le},startScheduleTimer:be},M(),V}sd.__dashjs_factory_name="ScheduleController";var gy=n.default.getClassFactory(sd);const my=/\$(RepresentationID|Number|SubNumber|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g;var py=class extends Bc{constructor(){super(),this.isPartialSegment=!0,this.replacementSubNumber=NaN,this.totalNumberOfPartialSegments=NaN}};function od(p){return p?p.totalNumberOfPartialSegments&&!isNaN(p.totalNumberOfPartialSegments)&&p.totalNumberOfPartialSegments>0&&!isNaN(p.subNumberOfPartialSegmentToRequest)?(function(m){const b=(function(T,v){const S=new py,k=T.segmentDurationInSeconds/T.totalNumberOfPartialSegments,{representation:x,timelineConverter:I,isDynamic:N,index:O,totalNumberOfPartialSegments:A}=T,R=ld({representation:x,segmentDurationInSeconds:k,presentationStartTime:T.presentationStartTime+v*k,presentationEndTime:T.presentationStartTime+(v+1)*k,timelineConverter:I,isDynamic:N,mediaTimeInSeconds:T.mediaTimeInSeconds+v*k,index:O});return S.assignAttributes(R),S.replacementSubNumber=v,S.totalNumberOfPartialSegments=A,S})(m,m.subNumberOfPartialSegmentToRequest);return ud(b,m),b})(p):(function(m){const b=new qo,T=ld(m);return b.assignAttributes(T),ud(b,m),b})(p):null}function ld(p){const{representation:m,segmentDurationInSeconds:b,presentationStartTime:T,presentationEndTime:v,mediaTimeInSeconds:S,timelineConverter:k,isDynamic:x,index:I}=p,N={availabilityEndTime:k.calcAvailabilityEndTimeFromPresentationTime(v+b,m,x),availabilityStartTime:k.calcAvailabilityStartTimeFromPresentationTime(v,m,x),duration:b,index:I,mediaStartTime:S,presentationStartTime:T,replacementNumber:m.startNumber+I,representation:m};return N.wallStartTime=k.calcWallTimeForSegment(N,x),N}function ud(p,m){const{tManifest:b,mediaTime:T,mediaUrl:v,mediaRange:S}=m;p.replacementTime=b||T,p.media=Va(v,p.representation.id,p.replacementNumber,p.replacementSubNumber,p.representation.bandwidth,p.replacementTime),p.mediaRange=S,p.mediaUrl=v}function cd(p,m,b,T){const v=m.adaptation.period;if(isFinite(v.duration)&&v.start+v.duration<=b.presentationStartTime)return!1;if(T){if(m.availabilityTimeOffset==="INF")return!0;const S=p.getClientReferenceTime();return b.availabilityStartTime.getTime()<=S&&(!isFinite(b.availabilityEndTime)||b.availabilityEndTime.getTime()>=S)}return!0}function Va(p,m,b,T,v,S){return p&&(function(k,x,I,N,O,A){return k.replace(my,((R,C,B,$)=>{let V,j;switch(C){case void 0:return"$";case"RepresentationID":V=x;break;case"Number":V=I;break;case"SubNumber":V=N;break;case"Bandwidth":V=O;break;case"Time":if(typeof A=="string")return A;V=A&&Math.round(A);break;default:V=null}if(V==null)return R;switch($){case void 0:case"d":case"i":case"u":j=V.toString();break;case"o":j=V.toString(8);break;case"x":j=V.toString(16);break;case"X":j=V.toString(16).toUpperCase();break;default:j=V.toString()}const te=parseInt(B,10)||1;return j.padStart(te,"0")}))})(p,m,b,T,v,S)}function dd(p){const{index:m,isDynamic:b,mediaRange:T,mediaTime:v,mediaUrl:S,representation:k,subNumberOfPartialSegmentToRequest:x,timelineConverter:I,totalNumberOfPartialSegments:N}=p;let O,A,R;O=k.segmentDuration,isNaN(O)&&(O=k.adaptation.period.duration),A=parseFloat((k.adaptation.period.start+m*O).toFixed(5)),R=parseFloat((A+O).toFixed(5));const C=od({index:m,isDynamic:b,mediaRange:T,mediaTime:v,mediaTimeInSeconds:I.calcMediaTimeFromPresentationTime(A,k),mediaUrl:S,presentationEndTime:R,presentationStartTime:A,representation:k,segmentDurationInSeconds:O,subNumberOfPartialSegmentToRequest:x,timelineConverter:I,totalNumberOfPartialSegments:N});return cd(I,k,C,b)?C:null}function Vo(p){const{durationInTimescale:m,fTimescale:b,index:T,subNumberOfPartialSegmentToRequest:v,isDynamic:S,mediaRange:k,mediaTime:x,mediaUrl:I,totalNumberOfPartialSegments:N,representation:O,tManifest:A,timelineConverter:R}=p,C=x/b,B=m/b;let $=R.calcPresentationTimeFromMediaTime(C,O),V=od({representation:O,segmentDurationInSeconds:B,presentationStartTime:$,presentationEndTime:$+B,mediaTimeInSeconds:C,timelineConverter:R,isDynamic:S,index:T,totalNumberOfPartialSegments:N,subNumberOfPartialSegmentToRequest:v,mediaUrl:I,mediaRange:k,tManifest:A,mediaTime:x});return cd(R,O,V,S)?V:null}function Ho(p){return p.k}function fd(p){const m=(p=p||{}).eventBus,b=p.events,T=p.abrController,v=p.dashMetrics,S=p.playbackController,k=p.timelineConverter,x=p.type,I=p.streamInfo,N=p.segmentsController,O=p.isDynamic;let A,R,C;function B(){return x}function $(){return C?.mediaInfo.type===x?C:(function(){let G=C?.dependentRepresentation;if(G){if(!G.mediaInfo)throw new Error("dependentRepresentation has no mediaInfo!");if(G.mediaInfo.type===x)return G}return null})()}function V(){C=null,R=[]}function j(G){return new Promise(((U,P)=>{const M=G.hasInitialization(),ge=G.hasSegments(),X=[];X.push(N.updateInitData(G,M)),X.push(N.updateSegmentData(G,ge)),Promise.all(X).then((be=>{var fe;be[0]&&!be[0].error&&(G=(function(Te,Ce){return Ce&&!Ce.error&&Ce.representation?Ce.representation:Te})(G,be[0])),be[1]&&!be[1].error&&(G=(function(Te,Ce){if(!Ce||Ce.error)return;const Ie=Ce.segments,q=[];let W,re,ee,ne,le=0;for(W=0,re=Ie?Ie.length:0;W<re;W++)ee=Ie[W],ne=Vo({durationInTimescale:ee.duration,fTimescale:ee.timescale,index:le,isDynamic:O,mediaRange:ee.mediaRange,mediaTime:ee.startTime,mediaUrl:ee.media,representation:Te,timelineConverter:k}),ne&&(q.push(ne),ne=null,le++);return q.length>0&&(Te.segments=q),Te})(G,be[1])),G.fragmentDuration=G.segmentDuration?G.segmentDuration:G.segments&&G.segments.length>0?G.segments[0].duration:NaN,(fe=G).mediaFinishedInformation=N.getMediaFinishedInformation(fe),(function(Te){let Ce,Ie=v.getCurrentManifestUpdate(),q=!1;if(Ie){for(let W=0;W<Ie.representationInfo.length;W++)if(Ce=Ie.representationInfo[W],Ce.index===Te.index&&Ce.mediaType===B()){q=!0;break}q||v.addManifestUpdateRepresentationInfo(Te,B())}})(G),U()})).catch((be=>{P(be)}))}))}function te(G){if(!R||R.length===0)return null;const U=R.filter((P=>P.id===G));return U.length>0?U[0]:null}function ie(G){m.trigger(b.DATA_UPDATE_COMPLETED,{currentRepresentation:C,error:G},{streamId:I.id,mediaType:x})}function se(G){C&&C.id===G.id||(function(U){(function(){if(!(T&&v&&S&&k))throw new Error(h.default.MISSING_CONFIG_ERROR)})();const P=new Date,M=1e3*S.getTime();U&&v.addRepresentationSwitch(U.adaptation.type,P,M,U.id),m.trigger(y.default.REPRESENTATION_SWITCH,{mediaType:x,streamId:I.id,currentRepresentation:U},{streamId:I.id,mediaType:x})})(G),C=G}function de(G){if(G.newDuration){const U=$();U&&U.adaptation.period&&(U.adaptation.period.duration=G.newDuration)}}return A={getCurrentCompositeRepresentation:function(){return C},getCurrentRepresentation:$,getRepresentationById:te,getStreamId:function(){return I.id},getType:B,prepareQualityChange:function(G){const U=R.filter((P=>P.id===G.id));U.length>0&&se(U[0])},reset:function(){m.off(y.default.MANIFEST_VALIDITY_CHANGED,de,A),V()},updateData:function(G,U,P){return new Promise(((M,ge)=>{if(R=G,se(te(P)),x!==h.default.VIDEO&&x!==h.default.ENHANCEMENT&&x!==h.default.AUDIO&&(x!==h.default.TEXT||!U))return ie(),void M();const X=[];for(let be=0,fe=R.length;be<fe;be++){const Te=R[be];X.push(j(Te))}Promise.all(X).then((()=>{(function(){T.setPlaybackQuality(x,I,C);const be=v.getCurrentDVRInfo(x);be&&v.updateManifestUpdateInfo({latency:be.range.end-S.getTime()}),ie()})(),M()})).catch((be=>{ge(be)}))}))}},V(),m.on(y.default.MANIFEST_VALIDITY_CHANGED,de,A),A}fd.__dashjs_factory_name="RepresentationController";var yy=n.default.getClassFactory(fd);function hd(p){const m=(p=p||{}).eventBus,b=p.debug,T=p.urlUtils,v=p.type,S=p.streamInfo,k=p.segmentsController,x=p.timelineConverter,I=p.baseURLController;let N,O,A,R,C;function B(){return v}function $(){A=null}function V(G,U,P){const M=I.resolve(P.path);let ge,X,be={};return M&&U!==M.url&&T.isRelative(U)?(ge=M.url,X=M.serviceLocation,be=M.queryParams,U&&(ge=T.resolve(U,ge))):ge=U,!T.isRelative(ge)&&(G.url=ge,G.serviceLocation=X,G.queryParams=be,!0)}function j(G,U,P){let M=null;if(!U||!U.segmentInfoType)return M;const ge=k.getSegmentByTime(U,P);return ge&&(A=ge,O.debug("Index for time "+P+" is "+ge.index),M=te(0,ge)),M}function te(G,U){if(U==null)return null;const P=new oe,M=U.representation,ge=M.bandwidth,X=Va(U.media,M.id,U.replacementNumber,U.replacementSubNumber,ge,U.replacementTime);return P.adaptationIndex=M.adaptation.index,P.availabilityEndTime=U.availabilityEndTime,P.availabilityStartTime=U.availabilityStartTime,P.availabilityTimeComplete=M.availabilityTimeComplete,P.bandwidth=M.bandwidth,P.duration=U.duration,P.index=U.index,P.isPartialSegmentRequest=U.isPartialSegment,P.mediaStartTime=U.mediaStartTime,P.mediaType=B(),P.presentationStartTime=U.presentationStartTime,P.range=U.mediaRange,P.representation=M,P.startTime=U.presentationStartTime,P.timescale=M.timescale,P.type=ke.HTTPRequest.MEDIA_SEGMENT_TYPE,P.wallStartTime=U.wallStartTime,V(P,X,M)?P:void 0}function ie(G){if(!G)return{indexToRequest:0,subNumberOfPartialSegmentToRequest:NaN};const U=G.isPartialSegment,P=!isNaN(G.replacementSubNumber),M=!isNaN(G.totalNumberOfPartialSegments);if(U&&P&&M){const ge=G.replacementSubNumber+1;return ge<G.totalNumberOfPartialSegments?{indexToRequest:G.index,subNumberOfPartialSegmentToRequest:ge}:{indexToRequest:G.index+1,subNumberOfPartialSegmentToRequest:0}}return{indexToRequest:G.index+1,subNumberOfPartialSegmentToRequest:NaN}}function se(G,U,P,M){let ge=null;const X=k.getSegmentByIndex(U,P,M,A);if(X)ge=te(0,X),A=X;else{if(R&&!C)return O.debug(B()+" No segment found at index: "+P+". Wait for next loop"),null;C=!0}return ge}function de(){O.debug("Dynamic stream complete"),C=!0}return N={getCurrentIndex:function(){return A?A.index:-1},getInitRequest:function(G,U){return U?(function(P,M,ge){const X=new oe,be=M.adaptation.period,fe=be.start;if(X.mediaType=ge,X.type=ke.HTTPRequest.INIT_SEGMENT_TYPE,X.range=M.range,X.availabilityStartTime=x.calcAvailabilityStartTimeFromPresentationTime(fe,M,R),X.availabilityEndTime=x.calcAvailabilityEndTimeFromPresentationTime(fe+be.duration,M,R),X.representation=M,V(X,M.initialization,M))return X.url=Va(X.url,M.id,void 0,void 0,M.bandwidth),X})(0,U,B()):null},getLastSegment:function(){return A},getNextSegmentRequest:function(G,U){if(!U||!U.segmentInfoType)return null;if((function(ge){return ge&&A&&ge.endNumber&&A.replacementNumber&&A.replacementNumber>=ge.endNumber})(U))return C=!0,null;let{indexToRequest:P,subNumberOfPartialSegmentToRequest:M}=ie(A);return se(0,U,P,M)},getNextSegmentRequestIdempotent:function(G,U){let P=null,{indexToRequest:M,subNumberOfPartialSegmentToRequest:ge}=ie(A);const X=k.getSegmentByIndex(U,M,ge,A);return X?(P=te(0,X),P):null},getSegmentRequestForTime:j,getStreamId:function(){return S.id},getStreamInfo:function(){return S},getType:B,getValidTimeAheadOfTargetTime:function(G,U,P,M){try{if(isNaN(G)||!U||!P)return NaN;if(G<0&&(G=0),isNaN(M)&&(M=.5),j(0,P,G))return G;if(P.adaptation.period.start+P.adaptation.period.duration<G)return NaN;const ge=isFinite(P.adaptation.period.duration)?P.adaptation.period.start+P.adaptation.period.duration:G+30;let X=Math.min(G+M,ge),be=NaN,fe=null;for(;X<=ge;){let Te=null;if(X<=ge&&(Te=j(0,P,X)),Te){be=X,fe=Te;break}X+=M}if(fe){const Te=fe.startTime+fe.duration;return G>fe.startTime&&Te-G>M?G:!isNaN(fe.startTime)&&G<fe.startTime&&be>fe.startTime?fe.startTime+.001:Math.min(Te-M,be)}return be}catch{return NaN}},initialize:function(G){R=G,C=!1,k.initialize(G)},isLastSegmentRequested:function(G,U){return!G||!A?!1:C?!0:!isFinite(G.adaptation.period.duration)||A.presentationStartTime+A.duration>U?!1:G.mediaFinishedInformation&&!isNaN(G.mediaFinishedInformation.numberOfSegments)&&!isNaN(A.index)&&A.index>=G.mediaFinishedInformation.numberOfSegments-1&&(!R||G.segmentInfoType===ye.default.SEGMENT_TEMPLATE||R&&G.segmentInfoType===ye.default.SEGMENT_LIST&&G.adaptation.period.nextPeriodId)?!0:!!(R&&G.adaptation.period.nextPeriodId&&G.segmentInfoType===ye.default.SEGMENT_TIMELINE&&G.mediaFinishedInformation&&!isNaN(G.mediaFinishedInformation.mediaTimeOfLastSignaledSegment)&&A&&!isNaN(A.mediaStartTime)&&!isNaN(A.duration)&&A.mediaStartTime+A.duration>=G.mediaFinishedInformation.mediaTimeOfLastSignaledSegment-.05)},repeatSegmentRequest:function(G,U){return U&&U.segmentInfoType?se(0,U,A?A.index:0,A&&A.isPartialSegment&&!isNaN(A.replacementSubNumber)?A.replacementSubNumber:NaN):null},reset:function(){$(),m.off(y.default.DYNAMIC_TO_STATIC,de,N)}},O=b.getLogger(N),$(),m.on(y.default.DYNAMIC_TO_STATIC,de,N),N}hd.__dashjs_factory_name="DashHandler";var gd=n.default.getClassFactory(hd);function md(p,m){const b=(p=p||{}).timelineConverter,T=p.dashMetrics;let v;function S(x,I){if((function(){if(!b)throw new Error(h.default.MISSING_CONFIG_ERROR)})(),!x)return null;I===void 0&&(I=null);let N=null;const O=b.calcMediaTimeFromPresentationTime(I,x);return(function(A,R){const C=(function(ge){return ge.adaptation.period.mpd.manifest.Period[ge.adaptation.period.index].AdaptationSet[ge.adaptation.index].Representation[ge.index].SegmentTemplate||ge.adaptation.period.mpd.manifest.Period[ge.adaptation.period.index].AdaptationSet[ge.adaptation.index].Representation[ge.index].SegmentList})(A),B=C.SegmentTimeline,$=C.SegmentURL;let V,j,te,ie,se,de,G=0,U=-1;de=A.timescale,V=B.S;let P=!1;const M=V.length;for(te=0;te<M&&!P;te++)for(j=V[te],se=0,j.hasOwnProperty("r")&&(se=j.r),j.hasOwnProperty("t")&&(G=j.t),se<0&&(se=k(A,V[te+1],j,de,G/de)),ie=0;ie<=se&&!P;ie++)U++,P=R({mediaTime:G,segmentBase:C,segmentURL:$,currentSElement:j,sElementCounterIncludingRepeats:U,sElementCounter:te}),P&&(A.segmentDuration=j.d/de),G+=j.d})(x,(function(A){const R=x.timescale;return(function(C,B){const{mediaTime:$,segmentBase:V,segmentURL:j,currentSElement:te,sElementCounterIncludingRepeats:ie,sElementCounter:se}=B,de=te.d,G=x.timescale;return C<$+de&&C>=$&&((function(U){const{segmentBase:P,segmentURL:M,sElementCounter:ge,currentSElement:X,mediaTime:be,durationInTimescale:fe,fTimescale:Te,requiredMediaTimeInTimescaleUnits:Ce,sElementCounterIncludingRepeats:Ie}=U;let q=(function(ne,le,z){let ce=ne.media;return le&&(ce=le[z].media||""),ce})(P,M,ge),W=(function(ne,le,z){let ce=ne.mediaRange;return le&&(ce=le[z].mediaRange),ce})(X,M,ge);const re=Ho(X),ee=(function(ne){if(!ne||ne.totalNumberOfPartialSegments===void 0||isNaN(ne.totalNumberOfPartialSegments)||ne.totalNumberOfPartialSegments<1)return;const{durationInTimescale:le,requiredMediaTimeInTimescaleUnits:z,mediaTime:ce,totalNumberOfPartialSegments:me}=ne,Se=le/me;for(let Re=0;Re<me;Re++){const we=ce+Re*Se;if(z>=we&&z<we+Se)return Re}return NaN})({durationInTimescale:fe,requiredMediaTimeInTimescaleUnits:Ce,mediaTime:be,totalNumberOfPartialSegments:re});N=Vo({timelineConverter:b,isDynamic:m,representation:x,mediaTime:be,durationInTimescale:fe,fTimescale:Te,mediaUrl:q,mediaRange:W,index:Ie,tManifest:X.tManifest,totalNumberOfPartialSegments:re,subNumberOfPartialSegmentToRequest:ee})})({segmentBase:V,segmentURL:j,sElementCounter:se,currentSElement:te,mediaTime:$,durationInTimescale:de,fTimescale:G,requiredMediaTimeInTimescaleUnits:C,sElementCounterIncludingRepeats:ie}),!0)})(parseFloat((O*R).toPrecision(15)),A)})),N}function k(x,I,N,O,A){let R;if(I&&I.hasOwnProperty("t"))R=I.t/O;else try{let C=0;if(isNaN(x.adaptation.period.start)||isNaN(x.adaptation.period.duration)||!isFinite(x.adaptation.period.duration)){const B=T.getCurrentDVRInfo();C=isNaN(B.end)?0:B.end}else C=x.adaptation.period.start+x.adaptation.period.duration;R=b.calcMediaTimeFromPresentationTime(C,x),x.segmentDuration=N.d/O}catch{R=0}return Math.max(Math.ceil((R-A)/(N.d/O))-1,0)}return v={getMediaFinishedInformation:function(x){if(!x)return 0;const I=(x.adaptation.period.mpd.manifest.Period[x.adaptation.period.index].AdaptationSet[x.adaptation.index].Representation[x.index].SegmentTemplate||x.adaptation.period.mpd.manifest.Period[x.adaptation.period.index].AdaptationSet[x.adaptation.index].Representation[x.index].SegmentList).SegmentTimeline;let N,O,A,R,C,B,$=0,V=0,j=0;B=x.timescale,N=I.S;const te=N.length;for(A=0;A<te;A++)for(O=N[A],C=0,O.hasOwnProperty("r")&&(C=O.r),O.hasOwnProperty("t")&&($=O.t,V=$/B),C<0&&(C=k(x,N[A+1],O,B,V)),R=0;R<=C;R++)j++,$+=O.d,V=$/B;return{numberOfSegments:j,mediaTimeOfLastSignaledSegment:V}},getSegmentByIndex:function(x,I){return x?S(x,I&&!isNaN(I.presentationStartTime)?I.presentationStartTime+I.duration+.01:0):null},getSegmentByTime:S},v}md.__dashjs_factory_name="TimelineSegmentsGetter";var Ey=n.default.getClassFactory(md);function pd(p,m){const b=(p=p||{}).timelineConverter;let T;function v(k,x,I){if(!k)return null;const N=S(k),O=Ho(N);O!==void 0&&O>=0&&(I=I!==void 0&&I<O?I:0);const A=dd({index:x=Math.max(x,0),isDynamic:m,mediaTime:Math.round(x*k.segmentDuration*k.timescale,10),mediaUrl:N.media,representation:k,subNumberOfPartialSegmentToRequest:I,timelineConverter:b,totalNumberOfPartialSegments:O});return A&&k.endNumber&&A.replacementNumber>k.endNumber?null:A}function S(k){return k.adaptation.period.mpd.manifest.Period[k.adaptation.period.index].AdaptationSet[k.adaptation.index].Representation[k.index].SegmentTemplate}return T={getMediaFinishedInformation:function(k){const x={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN};if(!k)return x;const I=k.segmentDuration;return isNaN(I)?x.numberOfSegments=1:x.numberOfSegments=Math.ceil(k.adaptation.period.duration/I),x},getSegmentByIndex:v,getSegmentByTime:function(k,x){if(!k)return null;const I=k.segmentDuration;if(isNaN(I))return null;let N=b.calcPeriodRelativeTimeFromMpdRelativeTime(k,x);const O=S(k),A=Math.floor(N/I),R=(function(C){if(!C||C.totalNumberOfPartialSegments===void 0||isNaN(C.totalNumberOfPartialSegments)||C.totalNumberOfPartialSegments<1)return;const{totalNumberOfPartialSegments:B,representation:$,requestedTimeRelativeToPeriodStart:V,indexWithoutStartNumber:j}=C,te=j*$.segmentDuration,ie=$.segmentDuration/B,se=V-te;let de=Math.floor(se/ie);return de=Math.max(0,Math.min(de,B-1)),de})({totalNumberOfPartialSegments:Ho(O),representation:k,requestedTimeRelativeToPeriodStart:N,indexWithoutStartNumber:A});return v(k,A,R)}},T}pd.__dashjs_factory_name="TemplateSegmentsGetter";var by=n.default.getClassFactory(pd);function yd(p,m){const b=(p=p||{}).timelineConverter;let T;function v(){if(!b||!b.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(h.default.MISSING_CONFIG_ERROR)}function S(k,x){if(v(),!k)return null;const I=k.adaptation.period.mpd.manifest.Period[k.adaptation.period.index].AdaptationSet[k.adaptation.index].Representation[k.index].SegmentList,N=I.SegmentURL.length,O=k&&!isNaN(k.startNumber)?k.startNumber:1,A=Math.max(O-1,0),R=Math.max(x-A,0);let C=null;if(R<N){const B=I.SegmentURL[R];C=dd({index:x,isDynamic:m,mediaRange:B.mediaRange,mediaTime:(O+x-1)*k.segmentDuration,representation:k,timelineConverter:b}),C&&(C.media=B.media?B.media:"",C.indexRange=B.indexRange)}return C}return T={getSegmentByIndex:S,getSegmentByTime:function(k,x){if(v(),!k)return null;const I=k.segmentDuration;if(isNaN(I))return null;const N=b.calcPeriodRelativeTimeFromMpdRelativeTime(k,x);return S(k,Math.floor(N/I))},getMediaFinishedInformation:function(k){const x={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN};if(!k)return x;const I=k.adaptation.period.mpd.manifest.Period[k.adaptation.period.index].AdaptationSet[k.adaptation.index].Representation[k.index].SegmentList,N=k&&!isNaN(k.startNumber)?k.startNumber:1,O=Math.max(N-1,0);return x.numberOfSegments=O+I.SegmentURL.length,x}},T}yd.__dashjs_factory_name="ListSegmentsGetter";var Ty=n.default.getClassFactory(yd);function Ed(p){const m=(p=p||{}).timelineConverter;let b;function T(){if(!m||!m.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(h.default.MISSING_CONFIG_ERROR)}function v(S,k){if(T(),!S)return null;const x=S.segments?S.segments.length:-1;let I;if(k<x&&(I=S.segments[k],I&&I.index===k))return I;for(let N=0;N<x;N++)if(I=S.segments[N],I&&I.index===k)return I;return null}return b={getSegmentByIndex:v,getSegmentByTime:function(S,k){T();const x=(function(I,N){if(!I)return-1;const O=I.segments,A=O?O.length:null;let R,C,B,$,V,j=-1;if(O&&A>0){for(V=0;V<A;V++)if(C=O[V],B=C.presentationStartTime,$=C.duration,R=$/2,N+R>=B&&N-R<B+$){j=C.index;break}}return j})(S,k);return v(S,x)},getMediaFinishedInformation:function(S){const k={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN};return S&&S.segments&&(k.numberOfSegments=S.segments.length),k}},b}Ed.__dashjs_factory_name="SegmentBaseGetter";var vy=n.default.getClassFactory(Ed);function bd(p){p=p||{};const m=this.context,b=p.dashConstants,T=p.type,v=p.segmentBaseController;let S,k;function x(I){return I?I.segments?k[b.SEGMENT_BASE]:k[I.segmentInfoType]:null}return S={initialize:function(I){k[b.SEGMENT_TIMELINE]=Ey(m).create(p,I),k[b.SEGMENT_TEMPLATE]=by(m).create(p,I),k[b.SEGMENT_LIST]=Ty(m).create(p,I),k[b.SEGMENT_BASE]=vy(m).create(p,I)},updateInitData:function(I,N){return N?Promise.resolve():v.getSegmentBaseInitSegment({representation:I,mediaType:T})},updateSegmentData:function(I,N){return N?Promise.resolve():v.getSegmentList({mimeType:I.mimeType,representation:I,mediaType:T})},getSegmentByIndex:function(I,N,O,A){const R=x(I);return R?I.segmentInfoType?I.segmentInfoType===b.SEGMENT_TIMELINE?R.getSegmentByIndex(I,A):I.segmentInfoType===b.SEGMENT_TEMPLATE?R.getSegmentByIndex(I,N,O):R.getSegmentByIndex(I,N):R.getSegmentByIndex(I,N):null},getSegmentByTime:function(I,N){const O=x(I);return O?O.getSegmentByTime(I,N):null},getMediaFinishedInformation:function(I){const N=x(I);return N?N.getMediaFinishedInformation(I):{numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN}}},k={},S}bd.__dashjs_factory_name="SegmentsController";var Td=n.default.getClassFactory(bd);function vd(){let p;return p={ntpToUTC:function(m){const b=new Date(Date.UTC(1900,0,1,0,0,0));return new Date(b.getTime()+m).getTime()}},p}vd.__dashjs_factory_name="TimeUtils";var Sy=n.default.getSingletonFactory(vd);function Sd(p){p=p||{};let m,b,T,v,S,k,x,I,N,O,A,R,C,B,$,V,j,te,ie=this.context,se=(0,g.default)(ie).getInstance(),de=p.abrController,G=p.adapter,U=p.boxParser,P=p.capabilities,M=p.dashMetrics,ge=p.errHandler,X=p.fragmentModel,be=p.manifestModel,fe=p.mediaController,Te=p.mediaPlayerModel,Ce=p.mimeType,Ie=p.playbackController,q=p.segmentBlacklistController,W=p.settings,re=p.streamInfo,ee=p.textController,ne=p.timelineConverter,le=p.type;function z(){return re.id}function ce(){return le}function me(){O=[],v=null,b=0,j=!1,V=!1,R=!1,k=null,te=!1,Qt()}function Se(ot){return!isNaN(ot)&&!isNaN(re.duration)&&isFinite(re.duration)&&ot>=re.start+re.duration}function Re(ot,Gt=!0){if(ot.sender){if(Ie.getIsManifestUpdateInProgress())Ye();else if((!v.isText||ee.isTextEnabled())&&m&&ot.representationId&&!m.appendInitSegmentFromCache(ot.representationId)){const fn=C.getCurrentRepresentation();if(fn.range===0)return void we();const cn=S?S.getInitRequest(v,fn):null;cn?X.executeRequest(cn):Gt&&(B.setInitSegmentRequired(!0),Ye())}}}function we(ot,Gt=!0){if(Ie.getIsManifestUpdateInProgress()||m.getIsPruningInProgress())return void Ye();let fn=(function(){let cn;if(isNaN(b)||ce()===h.default.TEXT&&!ee.isTextEnabled())return null;if(S){const In=yt();cn=j?S.getSegmentRequestForTime(v,In,b):V?S.repeatSegmentRequest(v,In):S.getNextSegmentRequest(v,In)}return cn})();fn?(j=!1,V=!1,(function(cn){isNaN(cn.startTime+cn.duration)||(b=cn.startTime+cn.duration),cn.delayLoadingTime=new Date().getTime()+B.getTimeToLoadDelay(),B.setTimeToLoadDelay(0),(function(In){let mn=In.url;return In.range&&(mn=mn.concat("_",In.range)),q.contains(mn)})(cn)?(N.warn(`Fragment request url ${cn.url} for stream id ${re.id} and media type ${le} is on the ignore list and will be skipped`),Ye()):(N.debug(`Next fragment request url for stream id ${re.id} and media type ${le} is ${cn.url} with request range ${cn.range}`),X.executeRequest(cn))})(fn)):(function(cn){const In=C.getCurrentRepresentation();try{if(W.get().streaming.gaps.enableSeekFix&&(j||Ie.getTime()===0)){let mn;if(I?I&&In.segmentInfoType===ye.default.SEGMENT_TIMELINE&&(mn=(function(Gn){return S.getValidTimeAheadOfTargetTime(b,v,Gn,W.get().streaming.gaps.threshold)})(In)):mn=(function(Gn){let tr=S.getValidTimeAheadOfTargetTime(b,v,Gn,W.get().streaming.gaps.threshold);return isNaN(tr)&&b>=Gn.adaptation.period.mpd.mediaPresentationDuration-Gn.segmentDuration&&(tr=b-.1),tr})(In),!isNaN(mn)&&mn!==b)return void(function(Gn,tr){Ie.isSeeking()||Ie.getTime()===0?(N.warn(`Adjusting playback time ${Gn} because of gap in the manifest. Seeking by ${Gn-b}`),Ie.seek(Gn,!1,!1)):(N.warn(`Adjusting buffering time ${Gn} because of gap in the manifest. Adjusting time by ${Gn-b}`),Dt(Gn),tr&&Ye())})(mn,cn)}}catch(mn){N.error(mn)}ze()||cn&&Ye()})(Gt)}function ze(){const ot=C.getCurrentRepresentation(),Gt=S.isLastSegmentRequested(ot,b);if(Gt){const fn=S.getCurrentIndex();N.debug(`Segment requesting for stream ${re.id} has finished`),se.trigger(f.default.STREAM_REQUESTING_COMPLETED,{segmentIndex:fn},{streamId:re.id,mediaType:le}),m.segmentRequestingCompleted(fn),$e()}return Gt}function Ye(){const ot=Te.getScheduleTimeout();B.startScheduleTimer(ot)}function ct(ot){M.addBufferState(le,ot.state,B.getBufferTarget()),ot.state!==i.BUFFER_EMPTY||Ie.isSeeking()||(N.info("Buffer is empty! Stalling!"),M.pushPlayListTraceMetrics(new Date,Rr.REBUFFERING_REASON))}function bt(ot){X.syncExecutedRequestsWithBufferedRange(m.getBuffer().getAllBufferRanges(),re.duration),ot.quotaExceeded&&ot.from>Ie.getTime()&&Dt(ot.from),ot.hasEnoughSpaceToAppend&&ot.quotaExceeded&&B.startScheduleTimer()}function Zt(ot){if(!ot||!ot.lastRequestAppended||!ot.lastRequestAppended.url)return;let Gt=ot.lastRequestAppended.url;ot.lastRequestAppended.range&&(Gt=Gt.concat("_",ot.lastRequestAppended.range)),N.warn(`Blacklisting segment with url ${Gt}`),q.add(Gt)}function vt(ot){if(N.debug(`Appended bytes for ${ot.mediaType} and stream id ${ot.streamId}`),ot.segmentType===ke.HTTPRequest.INIT_SEGMENT_TYPE){const Gt=ot.representationId;B.setLastInitializedRepresentationId(Gt),N.info("["+le+"] lastInitializedRepresentationId changed to "+Gt)}A&&A.enabled?pt(A.newRepresentation,A.oldRepresentation):te||B.startScheduleTimer(0)}function Qt(){A={newRepresentation:null,oldRepresentation:null,enabled:!1}}function un(ot){return new Promise((Gt=>{if(!C)return Promise.resolve();let fn=null;var cn;fn=ot.newRepresentation?{selectedRepresentation:(cn=ot).newRepresentation,currentMediaInfo:cn.newMediaInfo}:v!==null&&G.areMediaInfosEqual(v,ot.newMediaInfo)?(function(mn){return{currentMediaInfo:mn.newMediaInfo,selectedRepresentation:C.getCurrentRepresentation()}})(ot):(function(mn){let Gn=NaN;return Gn=!W.get().streaming.abr.autoSwitchBitrate[mn.newMediaInfo.type]&&mn.previouslySelectedRepresentation?mn.previouslySelectedRepresentation.bitrateInKbit:de.getInitialBitrateFor(le),{selectedRepresentation:de.getOptimalRepresentationForBitrate(mn.newMediaInfo,Gn,!1),currentMediaInfo:mn.newMediaInfo}})(ot),Rn(fn.currentMediaInfo),se.trigger(),(function(mn){k&&mn.selectedRepresentation.dependentRepresentation&&(N.info("["+le+"] selectMediaInfo : call selectMediaInfo on enhancementStreamProcessor for index = "+mn.selectedRepresentation.absoluteIndex),k.selectMediaInfo(new Ii({newMediaInfo:mn.selectedRepresentation.mediaInfo,newRepresentation:mn.selectedRepresentation})))})(fn);const In=de.getPossibleVoRepresentations(v,!1);return C.updateData(In,v.isFragmented,fn.selectedRepresentation.id).then((()=>{(function(){const mn=C.getCurrentCompositeRepresentation();m.getIsBufferingCompleted()||m.updateBufferTimestampOffset(mn)})(),Gt()})).catch((mn=>{N.error(mn),Gt()}))}))}function Rn(ot){G.areMediaInfosEqual(v,ot)||se.trigger(y.default.NEW_TRACK_SELECTED,{value:ot}),v=ot,de.handleNewMediaInfo(v),se.trigger(f.default.MEDIAINFO_UPDATED,{mediaType:le,streamId:re.id,currentMediaInfo:v})}function xn(ot){const Gt=ot.newRepresentation,fn=ot.oldRepresentation,cn=Sn();Gt&&fn||N.warn("_handleDifferentSwitchTypes() is missing the target representations"),ot.reason&&ot.reason.forceReplace?(function(In,mn){X.abortRequests(),se.trigger(f.default.BUFFER_REPLACEMENT_STARTED,{mediaType:le,streamId:re.id},{mediaType:le,streamId:re.id}),B.setShouldCheckPlaybackQuality(!1),m.prepareForForceReplacementQualitySwitch(In,mn).then((()=>{dn()})).catch((()=>{dn()}))})(Gt,fn):ot&&ot.reason&&ot.reason.forceAbandon?(function(In,mn){m.prepareForAbandonQualitySwitch(In,mn).then((()=>{vn()})).catch((()=>{vn()}))})(Gt,fn):!Te.getFastSwitchEnabled()||cn&&cn.isPartialSegment?pt(Gt,fn):(function(In,mn){const Gn=Ie.getTime();let tr=1.5*(isNaN(In.fragmentDuration)?1:In.fragmentDuration);const ri=X.getRequests({state:Oe.FRAGMENT_MODEL_EXECUTED,time:Gn+tr,threshold:0})[0];if(ri&&!v.isText){const ii=m.getBufferLevel(),hi=de.getAbandonmentStateFor(re.id,le);ri.bandwidth<In.bandwidth&&ii>=tr&&hi===i.ALLOW_LOAD?m.prepareForFastQualitySwitch(In,mn).then((()=>{qe(Gn,tr)})).catch((()=>{qe(Gn,tr)})):pt(In,mn)}else pt(In,mn)})(Gt,fn),M.pushPlayListTraceMetrics(new Date,Rr.REPRESENTATION_SWITCH_STOP_REASON),M.createPlaylistTraceMetrics(Gt.id,1e3*Ie.getTime(),Ie.getPlaybackRate())}function dn(){_e(),Qt(),R=!1}function vn(){X.abortRequests(),V=!0,B.setShouldCheckPlaybackQuality(!1),B.startScheduleTimer(),R=!1}function qe(ot,Gt){X.abortRequests(),Dt(ot+Gt),B.setShouldCheckPlaybackQuality(!1),B.startScheduleTimer(),R=!1}function pt(ot,Gt){const fn=X.getRequests({state:Oe.FRAGMENT_MODEL_LOADING});if(fn&&fn.length>0)return N.debug("Preparing for default quality switch: Waiting for ongoing segment request to be finished before applying switch."),A.newRepresentation=ot,A.oldRepresentation=Gt,void(A.enabled=!0);m.prepareForDefaultQualitySwitch(ot,Gt).then((()=>{ft()})).catch((()=>{ft()}))}function ft(){B.setShouldCheckPlaybackQuality(!1),v.segmentAlignment||v.subSegmentAlignment?B.startScheduleTimer():Qe(),Qt(),R=!1}function _t(ot){N.info("onFragmentLoadingAbandoned request: "+ot.request.url+" has been aborted"),Ie.isSeeking()||B.getSwitchTrack()||R||(N.info("onFragmentLoadingAbandoned request: "+ot.request.url+" has to be downloaded again, origin is not seeking process or switch track call"),ot.request&&ot.request.isInitializationRequest()?B.setInitSegmentRequired(!0):Dt(ot.request.startTime+ot.request.duration/2),B.startScheduleTimer(0))}function Yt(ot){N.info("OnFragmentLoadingCompleted for stream id "+re.id+" and media type "+le+" - Url:",ot.request?ot.request.url:"undefined",ot.request.range?", Range:"+ot.request.range:""),v.isText&&B.startScheduleTimer(0),ot.error&&ot.request.serviceLocation&&(function(Gt){N.info("Fragment loading completed with an error"),Gt&&Gt.request&&Gt.request.type&&(Gt.request.type===ke.HTTPRequest.INIT_SEGMENT_TYPE?Re({representationId:Gt.request.representation.id,sender:{}},!1):Gt.request.type===ke.HTTPRequest.MEDIA_SEGMENT_TYPE&&(Dt(Gt.request.startTime+Gt.request.duration/2),we(0,!1)))})(ot)}function En(){Dt(Ie.getTime()),Fe().startScheduleTimer()}function rt(ot){const Gt=ot.currentTrackInfo;if(!Gt)return;const fn=O.find((cn=>cn.index===Gt.index&&cn.lang===Gt.lang));fn&&un(new Ii({newMediaInfo:fn})).then((()=>{m.setIsBufferingCompleted(!1),Dt(Ie.getTime()),B.setInitSegmentRequired(!0),B.startScheduleTimer()}))}function Tt(ot){Dt(ot.quotaExceededTime),$e()}function Mt(){return m?m.getBuffer():null}function Fe(){return B}function $e(){B&&B.clearScheduleTimer()}function yt(ot=NaN){let Gt;return isNaN(ot)?Gt=C?C.getCurrentRepresentation():null:((0,gt.checkInteger)(ot),Gt=C?C.getRepresentationById(ot):null),Gt}function Ke(){return!!m&&m.getIsBufferingCompleted()}function It(ot){if(!W.get().streaming.enableManifestTimescaleMismatchFix)return;const Gt=ot.chunk,fn=Gt.bytes,cn=yt(Gt.representation.id);cn&&(cn.timescale=U.getMediaTimescaleFromMoov(fn))}function Ct(ot){const Gt=ot.chunk,fn=Gt.bytes,cn=yt(Gt.representation.id);if(cn){let In;if(W.get().streaming.parseInbandPrft&&ot.request.type===ke.HTTPRequest.MEDIA_SEGMENT_TYPE){In=In||U.parse(fn);const tr=(function(ri,ii){const hi=ri.getBoxes("prft"),ta=[];return hi.forEach((Bi=>{ta.push((function(Vr,ji){let Hr="unknown";switch(Vr.flags){case 0:Hr=ye.default.PRODUCER_REFERENCE_TIME_TYPE.ENCODER;break;case 16:Hr=ye.default.PRODUCER_REFERENCE_TIME_TYPE.APPLICATION;break;case 24:Hr=ye.default.PRODUCER_REFERENCE_TIME_TYPE.CAPTURED}let ai=1e3*Vr.ntp_timestamp_sec+Vr.ntp_timestamp_frac/2**32*1e3;return ai=Sy(ie).getInstance().ntpToUTC(ai),{type:Hr,ntpTimestamp:ai,mediaTime:Vr.media_time/ji}})(Bi,ii))})),ta})(In,cn.timescale);tr&&tr.length&&se.trigger(y.default.INBAND_PRFT,{data:tr},{streamId:re.id,mediaType:le})}const mn=G.getEventsFor(cn.mediaInfo,null,re),Gn=G.getEventsFor(cn,cn,re);if(mn&&mn.length>0||Gn&&Gn.length>0){const tr=ot.request;In=In||U.parse(fn);const ri=(function(ii,hi,ta,Bi){try{const Vr={},ji=[],Hr=ta.concat(Bi);for(let Nr=0,ya=Hr.length;Nr<ya;Nr++)Vr[Hr[Nr].schemeIdUri+"/"+Hr[Nr].value]=Hr[Nr];const ai=ii.getBoxes("emsg");if(!ai||ai.length===0)return ji;const Kr=ii.getBox("sidx"),pa=!Kr||isNaN(Kr.earliest_presentation_time)||isNaN(Kr.timescale)?hi&&!isNaN(hi.mediaStartTime)?hi.mediaStartTime:0:Kr.earliest_presentation_time/Kr.timescale,Cs=Math.max(pa,0),Ls=C.getCurrentRepresentation();for(let Nr=0,ya=ai.length;Nr<ya;Nr++){const na=G.getEvent(ai[Nr],Vr,Cs,Ls);na&&ji.push(na)}return ji}catch{return[]}})(In,tr,mn,Gn);se.trigger(f.default.INBAND_EVENTS,{events:ri},{streamId:re.id})}}}function _e(){const ot=Ie.getTime();W.get().streaming.buffer.flushBufferAtTrackSwitch&&Ie.seek(ot+.001,!1,!0),Dt(ot),m.setSeekTarget(ot),B.startScheduleTimer()}function Qe(){const ot=Ie.getTime(),Gt=m.getContinuousBufferTimeForTargetTime(ot);Dt(isNaN(Gt)?ot:Gt),B.startScheduleTimer()}function Lt(ot){ot&&!isNaN(ot.time)&&(Dt(ot.time),m.setSeekTarget(ot.time))}function Dt(ot){b=ot,j=!0}function Sn(){return S.getLastSegment()}return x={checkAndHandleCompletedBuffering:ze,clearScheduleTimer:$e,createBufferSinks:function(ot,Gt){const fn=Mt();return fn?Promise.resolve(fn):m?m.createBufferSink(v,ot,Gt):Promise.resolve(null)},dischargePreBuffer:function(){m.dischargePreBuffer()},finalisePlayList:function(ot,Gt){M.pushPlayListTraceMetrics(ot,Gt)},getAllMediaInfos:function(){return O},getBuffer:Mt,getBufferController:function(){return m},getBufferLevel:function(){return m?m.getBufferLevel():0},getFragmentModel:function(){return X},getLastSegment:Sn,getMediaInfo:function(){return v},getMediaSource:function(){return m.getMediaSource()},getRepresentation:yt,getRepresentationController:function(){return C},getScheduleController:Fe,getStreamId:z,getStreamInfo:function(){return re},getType:ce,initialize:function(ot,Gt,fn){$=Td(ie).create({events:f.default,eventBus:se,streamInfo:re,timelineConverter:ne,dashConstants:ye.default,segmentBaseController:p.segmentBaseController,type:le}),S=gd(ie).create({baseURLController:p.baseURLController,boxParser:U,constants:h.default,dashConstants:ye.default,dashMetrics:M,debug:(0,o.default)(ie).getInstance(),errHandler:ge,errors:Jt,eventBus:se,events:f.default,mediaPlayerModel:Te,segmentsController:$,settings:W,streamInfo:re,timelineConverter:ne,type:le,urlUtils:Vn(ie).getInstance()}),I=re.manifestInfo.isDynamic,S.initialize(I),de.registerStreamType(le,x),C=yy(ie).create({abrController:de,adapter:G,dashConstants:ye.default,dashMetrics:M,errors:Jt,eventBus:se,events:f.default,isDynamic:I,playbackController:Ie,segmentsController:$,streamInfo:re,timelineConverter:ne,type:le}),m=(function(cn,In){let mn=null;return cn?(mn=cn!==h.default.TEXT||In?fy(ie).create({abrController:de,capabilities:P,errHandler:ge,fragmentModel:X,manifestModel:be,mediaController:fe,mediaPlayerModel:Te,playbackController:Ie,representationController:C,settings:W,streamInfo:re,textController:ee,type:cn}):hy(ie).create({errHandler:ge,fragmentModel:X,mimeType:Ce,settings:W,streamInfo:re,textController:ee,type:cn}),mn):(ge.error(new Wt.default(Jt.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,Jt.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+"not properly defined")),null)})(le,fn),m&&m.initialize(ot),B=gy(ie).create({abrController:de,adapter:G,bufferController:m,dashMetrics:M,fragmentModel:X,mediaController:fe,mediaPlayerModel:Te,mimeType:Ce,playbackController:Ie,representationController:C,settings:W,streamInfo:re,textController:ee,type:le}),T=Gt,B.initialize(Gt),b=0,j=!1,V=!1},isBufferingCompleted:Ke,prepareInnerPeriodPlaybackSeeking:function(ot){return new Promise((Gt=>{if(m.hasBufferAtTime(ot.seekTime))return m.pruneBuffer(),Se(m.getContinuousBufferTimeForTargetTime(ot.seekTime))&&m.setIsBufferingCompleted(!0),void Gt();$e(),X.abortRequests(),m.prepareForPlaybackSeek().then((()=>{const fn=m.getAllRangesWithSafetyFactor(ot.seekTime);return m.clearBuffers(fn)})).then((()=>{const fn=m.getContinuousBufferTimeForTargetTime(ot.seekTime);if(Se(fn))m.setIsBufferingCompleted(!0),Gt();else{const cn=isNaN(fn)?ot.seekTime:fn;Dt(cn),m.setSeekTarget(cn);const In=[];In.push(m.updateAppendWindow());const mn=yt();In.push(m.updateBufferTimestampOffset(mn)),Promise.all(In).then((()=>{B.setInitSegmentRequired(!0),B.setShouldCheckPlaybackQuality(!1),B.startScheduleTimer(),Gt()}))}})).catch((fn=>{N.error(fn)}))}))},prepareOuterPeriodPlaybackSeeking:function(){return new Promise(((ot,Gt)=>{try{$e(),X.abortRequests(),m.prepareForPlaybackSeek().then((()=>m.pruneAllSafely())).then((()=>{ot()}))}catch(fn){Gt(fn)}}))},prepareQualityChange:function(ot){ot.newRepresentation&&((function(Gt){if(k)k.prepareQualityChange(Gt);else if(le===h.default.ENHANCEMENT){const fn=Gt.oldRepresentation.mediaInfo.type,cn=Gt.newRepresentation.mediaInfo.type;if(fn===h.default.ENHANCEMENT&&cn===h.default.VIDEO)return N.info("Stop "+le+" stream processor"),B.reset(),!0;if(fn===h.default.VIDEO&&cn===h.default.ENHANCEMENT)return N.info("Start "+le+" stream processor"),un(new Ii({newMediaInfo:Gt.newRepresentation.mediaInfo,newRepresentation:Gt.newRepresentation})).then((()=>{B.setup(),B.initialize(T),B.startScheduleTimer()})),!0}return!1})(ot)||(A&&A.enabled&&N.warn(`Canceling queued representation switch to ${A.newRepresentation.id} for ${le}`),ot.isAdaptationSetSwitch?(N.debug(`Preparing quality switch to different AdaptationSet for type ${le} from representation id ${ot.oldRepresentation.id} to ${ot.newRepresentation.id}`),(function(Gt){const fn=Gt.newRepresentation;R=!0,$e(),B.setSwitchTrack(!0);const cn=fn.mediaInfo;Rn(cn),un(new Ii({newMediaInfo:cn,newRepresentation:fn})).then((()=>{xn(Gt)}))})(ot)):(N.debug(`Preparing quality within the same AdaptationSet for type ${le} from representation id ${ot.oldRepresentation.id} to ${ot.newRepresentation.id}`),(function(Gt){const fn=Gt.newRepresentation;R=!0,$e(),C.prepareQualityChange(fn),xn(Gt)})(ot))))},prepareTrackSwitch:function(ot,Gt=!1){return new Promise((fn=>{N.debug(`Preparing track switch for type ${le}`);const cn=le===h.default.TEXT||Gt||W.get().streaming.trackSwitchMode[le]===h.default.TRACK_SWITCH_MODE_ALWAYS_REPLACE&&Ie.getTimeToStreamEnd(re)>W.get().streaming.buffer.stallThreshold;m.getIsBufferingCompleted()&&!cn?(function(In){return new Promise((mn=>{const Gn=C.getCurrentRepresentation();m.prepareForNonReplacementTrackSwitch(Gn,In).then((()=>{se.trigger(f.default.BUFFERING_COMPLETED,{},{streamId:re.id,mediaType:le}),mn()})).catch((()=>{se.trigger(f.default.BUFFERING_COMPLETED,{},{streamId:re.id,mediaType:le}),mn()}))}))})(ot).then((()=>{fn()})):(B.setSwitchTrack(!0),cn?(function(In){return new Promise((mn=>{se.trigger(f.default.BUFFER_REPLACEMENT_STARTED,{mediaType:le,streamId:re.id},{mediaType:le,streamId:re.id}),X.abortRequests();const Gn=yt();m.prepareForReplacementTrackSwitch(Gn,In).then((()=>{_e(),mn()})).catch((()=>{_e(),mn()}))}))})(ot).then((()=>{fn()})):(function(In){return new Promise((mn=>{const Gn=()=>{const tr=X.getRequests({state:Oe.FRAGMENT_MODEL_LOADING});if(tr&&tr.length!==0)se.once(y.default.FRAGMENT_LOADING_COMPLETED,Gn,x);else{const ri=yt();m.prepareForNonReplacementTrackSwitch(ri,In).then((()=>{Qe(),mn()})).catch((ii=>{N.error(ii),Qe(),mn()}))}};Gn()}))})(ot).then((()=>{fn()})))}))},probeNextRequest:function(){const ot=yt();return S.getNextSegmentRequestIdempotent(v,ot)},reset:function(ot,Gt){S&&S.reset(),m&&(m.reset(ot,Gt),m=null),B&&(B.reset(),B=null),C&&(C.reset(),C=null),$&&($=null),de&&de.unRegisterStreamType(z(),le),se.off(f.default.BUFFER_CLEARED,bt,x),se.off(f.default.BUFFER_LEVEL_STATE_CHANGED,ct,x),se.off(f.default.BYTES_APPENDED_END_FRAGMENT,vt,x),se.off(f.default.FRAGMENT_LOADING_ABANDONED,_t,x),se.off(f.default.FRAGMENT_LOADING_COMPLETED,Yt,x),se.off(f.default.INIT_FRAGMENT_LOADED,It,x),se.off(f.default.INIT_FRAGMENT_NEEDED,Re,x),se.off(f.default.MEDIA_FRAGMENT_LOADED,Ct,x),se.off(f.default.MEDIA_FRAGMENT_NEEDED,we,x),se.off(f.default.QUOTA_EXCEEDED,Tt,x),se.off(f.default.SEEK_TARGET,Lt,x),se.off(f.default.SET_FRAGMENTED_TEXT_AFTER_DISABLED,En,x),se.off(f.default.SET_NON_FRAGMENTED_TEXT,rt,x),se.off(f.default.SOURCE_BUFFER_ERROR,Zt,x),me(),le=null,re=null},selectMediaInfo:un,setEnhancementStreamProcessor:function(ot){k=ot,N.info("enhancementStreamProcessor = "+k)},setExplicitBufferingTime:Dt,setMediaInfoArray:function(ot){O=ot},setMediaSource:function(ot){return m.setMediaSource(ot,v)},setTrackSwitchInProgress:function(ot){te=ot},updateStreamInfo:function(ot){return re=ot,Ke()?Promise.resolve():m.updateAppendWindow()}},N=(0,o.default)(ie).getInstance().getLogger(x),me(),se.on(f.default.BUFFER_CLEARED,bt,x),se.on(f.default.BUFFER_LEVEL_STATE_CHANGED,ct,x),se.on(f.default.BYTES_APPENDED_END_FRAGMENT,vt,x),se.on(f.default.FRAGMENT_LOADING_ABANDONED,_t,x),se.on(f.default.FRAGMENT_LOADING_COMPLETED,Yt,x),se.on(f.default.INIT_FRAGMENT_LOADED,It,x),se.on(f.default.INIT_FRAGMENT_NEEDED,Re,x),se.on(f.default.MEDIA_FRAGMENT_LOADED,Ct,x),se.on(f.default.MEDIA_FRAGMENT_NEEDED,we,x),se.on(f.default.QUOTA_EXCEEDED,Tt,x),se.on(f.default.SEEK_TARGET,Lt,x),se.on(f.default.SET_FRAGMENTED_TEXT_AFTER_DISABLED,En,x),se.on(f.default.SET_NON_FRAGMENTED_TEXT,rt,x),se.on(f.default.SOURCE_BUFFER_ERROR,Zt,x),x}Sd.__dashjs_factory_name="StreamProcessor";var _y=n.default.getClassFactory(Sd),Ay=class{constructor(){this.url=null,this.width=null,this.height=null,this.x=null,this.y=null}},Iy=class{constructor(){this.bitrate=0,this.width=0,this.height=0,this.tilesHor=0,this.tilesVert=0,this.widthPerTile=0,this.heightPerTile=0,this.startNumber=0,this.segmentDuration=0,this.timescale=0,this.templateUrl="",this.id=""}};function _d(p){const m=this.context,b=p.adapter,T=p.baseURLController,v=p.streamInfo,S=p.timelineConverter,k=p.debug,x=p.eventBus,I=p.events,N=p.dashConstants,O=Vn(m).getInstance();let A,R,C,B,$,V,j,te,ie;function se(G,U){const P=new Iy;P.id=G.id,P.bitrate=G.bandwidth,P.width=G.width,P.height=G.height,P.tilesHor=1,P.tilesVert=1,G.essentialProperties&&G.essentialProperties.forEach((M=>{if(h.default.THUMBNAILS_SCHEME_ID_URIS.indexOf(M.schemeIdUri)>=0&&M.value){const ge=M.value.split("x");ge.length!==2||isNaN(ge[0])||isNaN(ge[1])||(P.tilesHor=parseInt(ge[0],10),P.tilesVert=parseInt(ge[1],10))}})),U?j.updateSegmentData(G).then((M=>{(function(ge,X,be){let fe=[];const Te=(function(Ce,Ie){const q=[];let W,re,ee,ne,le=0;for(W=0,re=Ce.segments.length;W<re;W++)ee=Ce.segments[W],ne=Vo({durationInTimescale:ee.duration,fTimescale:ee.timescale,index:le,isDynamic:b.getIsDynamic(),mediaRange:ee.mediaRange,mediaTime:ee.startTime,mediaUrl:ee.media,representation:Ie,timelineConverter:S}),ne&&(q.push(ne),ne=null,le++);return q})(be,X);X.segments=Te,X.fragmentDuration=X.segmentDuration||(X.segments&&X.segments.length>0?X.segments[0].duration:NaN),ge.segmentDuration=X.segments[0].duration,ge.readThumbnail=function(Ce,Ie){let q=null;fe.some((W=>{if(W.start<=Ce&&W.end>Ce)return q=W.url,!0})),q?Ie(q):X.segments.some((W=>{if(W.mediaStartTime<=Ce&&W.mediaStartTime+W.duration>Ce){const re=T.resolve(X.path),ee=new Co({method:"get",url:re.url,responseType:"arraybuffer",customData:{request:{range:W.mediaRange},onloadend:function(le){let z=ie.getSamplesInfo(le.target.response),ce=new Blob([le.target.response.slice(z.sampleList[0].offset,z.sampleList[0].offset+z.sampleList[0].size)],{type:"image/jpeg"}),me=window.URL.createObjectURL(ce);fe.push({start:W.mediaStartTime,end:W.mediaStartTime+W.duration,url:me}),Ie&&Ie(me)}}}),ne=new Lo({request:ee});return te.load(ee,ne),!0}}))}})(P,G,M)})):(P.startNumber=G.startNumber,P.segmentDuration=G.segmentDuration,P.timescale=G.timescale,P.templateUrl=(function(M){const ge=O.isRelative(M.media)?O.resolve(M.media,T.resolve(M.path).url):M.media;return ge?Va(ge,M.id):""})(G)),P.tilesHor>0&&P.tilesVert>0&&(P.widthPerTile=P.width/P.tilesHor,P.heightPerTile=P.height/P.tilesVert,R.push(P))}function de(){R=[],C=[],$=-1,V=null,B&&(B.reset(),B=null)}return A={addTracks:function(){if(!v||!b||(V=b.getMediaInfoForType(v,h.default.IMAGE),!V))return;const G=b.getVoRepresentations(V);G&&G.length>0&&G.forEach((U=>{(U.segmentInfoType===ye.default.SEGMENT_TEMPLATE&&U.segmentDuration>0&&U.media||U.segmentInfoType===ye.default.SEGMENT_TIMELINE)&&se(U),U.segmentInfoType===ye.default.SEGMENT_BASE&&se(U,!0),C.push(U)})),R.length>0&&R.sort(((U,P)=>U.bitrate-P.bitrate))},getCurrentTrack:function(){return $<0?null:R[$]},getCurrentTrackIndex:function(){return $},getRepresentations:function(){return C},getThumbnailRequestForTime:function(G){let U;const P=b.getVoRepresentations(V);for(let M=0;M<P.length;M++)if(R[$].id===P[M].id){U=P[M];break}return B.getSegmentRequestForTime(V,U,G)},getTracks:function(){return R},reset:de,setTrackById:function(G){if(!R||R.length===0)return;const U=R.findIndex((P=>P.id===G));U!==-1&&($=U)},setTrackByIndex:function(G){R&&R.length!==0&&(G>=R.length&&(G=R.length-1),$=G)}},de(),te=tn(m).create({}),ie=bs(m).getInstance(),j=Td(m).create({events:I,eventBus:x,streamInfo:v,timelineConverter:S,dashConstants:N,dashMetrics:p.dashMetrics,segmentBaseController:p.segmentBaseController,type:h.default.IMAGE}),B=gd(m).create({streamInfo:v,type:h.default.IMAGE,timelineConverter:S,segmentsController:j,baseURLController:T,debug:k,eventBus:x,events:I,dashConstants:N,urlUtils:O}),B.initialize(!!b&&b.getIsDynamic()),A}_d.__dashjs_factory_name="ThumbnailTracks";var xy=n.default.getClassFactory(_d);function Ad(p){const m=this.context,b=p.streamInfo;let T,v;function S(x){v.setTrackByIndex(x)}function k(){v&&v.reset()}return T={getCurrentTrack:function(){return v.getCurrentTrack()},getCurrentTrackIndex:function(){return v.getCurrentTrackIndex()},getPossibleVoRepresentations:function(){return v.getRepresentations()},getStreamId:function(){return b.id},initialize:function(){v.addTracks();const x=v.getTracks();x&&x.length>0&&S(0)},provide:function(x,I){if(typeof I!="function")return;const N=v.getCurrentTrack();let O,A;if(!N||N.segmentDuration<=0||x==null)return void I(null);A=v.getThumbnailRequestForTime(x),A&&(N.segmentDuration=A.duration),O=x%N.segmentDuration;const R=Math.floor(O*N.tilesHor*N.tilesVert/N.segmentDuration),C=new Ay;if(C.width=Math.floor(N.widthPerTile),C.height=Math.floor(N.heightPerTile),C.x=Math.floor(R%N.tilesHor)*N.widthPerTile,C.y=Math.floor(R/N.tilesHor)*N.heightPerTile,"readThumbnail"in N)return N.readThumbnail(x,(B=>{C.url=B,I(C)}));if(A)C.url=A.url,N.segmentDuration=NaN;else{const B=Math.floor(x/N.segmentDuration);C.url=(function($,V){const j=V+$.startNumber;return Va($.templateUrl,void 0,j,void 0,$.bandwidth,(j-1)*$.segmentDuration*$.timescale)})(N,B)}I(C)},reset:k,setTrackByIndex:S,setTrackById:function(x){v.setTrackById(x)}},k(),v=xy(m).create({streamInfo:b,adapter:p.adapter,baseURLController:p.baseURLController,timelineConverter:p.timelineConverter,debug:p.debug,eventBus:p.eventBus,events:p.events,dashConstants:p.dashConstants,dashMetrics:p.dashMetrics,segmentBaseController:p.segmentBaseController}),T}Ad.__dashjs_factory_name="ThumbnailController";var wy=n.default.getClassFactory(Ad);const Ry=[h.default.VIDEO,h.default.AUDIO,h.default.TEXT,h.default.MUXED,h.default.IMAGE];function Id(p){p=p||{};const m=this.context,b=(0,g.default)(m).getInstance(),T=Vn(m).getInstance(),v=p.manifestModel,S=p.mediaPlayerModel,k=p.dashMetrics,x=p.manifestUpdater,I=p.adapter,N=p.timelineConverter,O=p.capabilities,A=p.errHandler,R=p.abrController,C=p.playbackController,B=p.throughputController,$=p.eventController,V=p.mediaController,j=p.protectionController,te=p.textController,ie=p.videoModel;let se=p.streamInfo;const de=p.settings;let G,U,P,M,ge,X,be,fe,Te,Ce,Ie,q,W,re,ee,ne;function le(rt,Tt,Mt){return new Promise(((Fe,$e)=>{ct(),Zt();let yt=ie.getElement();const Ke=[];Ry.forEach((It=>{if((It!==h.default.TEXT||rt)&&(It!==h.default.VIDEO||!yt||yt&&/^VIDEO$/i.test(yt.nodeName))){const Ct=Mt.find((_e=>_e.mediaInfo.type===It));Ke.push(z(It,rt,Ct))}})),Promise.all(Ke).then((()=>(function(It){return new Promise((Ct=>{const _e={},Qe=re.map((Lt=>{const Dt=Lt.getRepresentation();return Lt.createBufferSinks(It,Dt)}));Promise.all(Qe).then((Lt=>{Lt.forEach((Dt=>{Dt&&(_e[Dt.getType()]=Dt)})),Ct(_e)})).catch((()=>{Ct(_e)}))}))})(Tt))).then((It=>{if(re.length===0){const Ct="No streams to play.";A.error(new Wt.default(Jt.MANIFEST_ERROR_ID_NOSTREAMS_CODE,Ct,v.getValue())),Ie.fatal(Ct)}else _t();rt&&te.createTracks(se),Fe(It)})).catch((It=>{$e(It)}))}))}function z(rt,Tt,Mt){let Fe,$e=I.getAllMediaInfoForType(se,rt),yt=[],Ke=null,It=-1;if(!$e||$e.length===0)return Ie.info("No "+rt+" data."),Promise.resolve();rt===h.default.VIDEO&&(X=!0),rt===h.default.AUDIO&&(M=!0);for(let _e=0,Qe=$e.length;_e<Qe;_e++)Ke=$e[_e],rt===h.default.TEXT&&Ke.isEmbedded&&(te.addEmbeddedTrack(se,Ke),yt.push(Ke)),ce(Ke)&&V.addTrack(Ke),Ke.type===h.default.ENHANCEMENT&&(It=_e);if(yt.length>0&&(V.setInitialMediaSettingsForType(rt,se),te.addMediaInfosToBuffer(se,rt,yt)),$e=$e.filter((_e=>!_e.isEmbedded)),$e.length===0)return Promise.resolve();if(rt===h.default.IMAGE)return ee=wy(m).create({streamInfo:se,adapter:I,baseURLController:p.baseURLController,timelineConverter:p.timelineConverter,debug:U,eventBus:b,events:f.default,dashConstants:ye.default,dashMetrics:p.dashMetrics,segmentBaseController:p.segmentBaseController}),ee.initialize(),Promise.resolve();b.trigger(f.default.STREAM_INITIALIZING,{streamInfo:se,mediaInfo:Ke}),V.setInitialMediaSettingsForType(rt,se);let Ct=me($e,Tt,rt);if(It>=0){let _e=new sy(b);_e.open(),_e.duration=se.manifestInfo.duration;let Qe=me($e,_e,h.default.ENHANCEMENT);Qe.selectMediaInfo(new Ii({newMediaInfo:$e[It]})),Ct.setEnhancementStreamProcessor(Qe)}if(Fe=V.getCurrentTrackFor(rt,se.id),Fe){const _e=rt===h.default.TEXT&&Fe.isEmbedded?$e[0]:Fe,Qe=new Ii({newMediaInfo:_e,previouslySelectedRepresentation:Mt});return Ct.selectMediaInfo(Qe)}return Promise.resolve()}function ce(rt){const Tt=rt?rt.type:null;let Mt;return Tt===h.default.MUXED?(Mt="Multiplexed representations are intentionally not supported, as they are not compliant with the DASH-AVC/264 guidelines",Ie.fatal(Mt),A.error(new Wt.default(Jt.MANIFEST_ERROR_ID_MULTIPLEXED_CODE,Mt,v.getValue())),!1):!(Tt!==h.default.TEXT&&Tt!==h.default.IMAGE&&rt.contentProtection&&rt.contentProtection.length>0&&!O.supportsEncryptedMedia()&&(A.error(new Wt.default(Jt.CAPABILITY_MEDIAKEYS_ERROR_CODE,Jt.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE)),1))}function me(rt,Tt,Mt){const Fe=rt&&rt.length>0?rt.filter((_e=>_e.type===Mt))[0]:null;let $e=P.getModel(Fe?Fe.type:null);const yt=Fe?Fe.type:null,Ke=Fe?Fe.mimeType:null,It=Fe?Fe.isFragmented:null;let Ct=_y(m).create({abrController:R,adapter:I,baseURLController:p.baseURLController,boxParser:G,capabilities:O,dashMetrics:p.dashMetrics,errHandler:A,fragmentModel:$e,manifestModel:v,mediaController:V,mediaPlayerModel:S,mimeType:Ke,playbackController:C,segmentBaseController:p.segmentBaseController,segmentBlacklistController:W,settings:de,streamInfo:se,textController:te,throughputController:B,timelineConverter:N,type:yt});return Ct.initialize(Tt,X,It),re.push(Ct),Ct.setMediaInfoArray(rt),yt===h.default.TEXT&&te.addMediaInfosToBuffer(se,yt,rt,$e),Ct}function Se(rt){let Tt=re?re.length:0;for(let Mt=0;Mt<Tt;Mt++){let Fe=re[Mt].getFragmentModel();Fe.abortRequests(),Fe.resetInitialSettings(),re[Mt].reset(!1,rt)}te&&te.deactivateStream(se),ee&&(ee.reset(),ee=null),re=[],fe=!1,ge=!1,Yt(!1),we(!1),b.trigger(f.default.STREAM_DEACTIVATED,{streamInfo:se})}function Re(rt){Se(rt),Ce=!1,X=!1,M=!1,Te=!1,ne=[]}function we(rt){Te=rt}function ze(){return se?se.start:NaN}function Ye(){return se?se.id:null}function ct(){if(!ie||!R)throw new Error(h.default.MISSING_CONFIG_ERROR)}function bt(rt){rt.error&&(A.error(rt.error),Ie.fatal(rt.error.message))}function Zt(){if($){const rt=I.getEventsFor(se);rt&&rt.length>0&&$.addInlineEvents(rt,se.id)}}function vt(rt){let Tt=Qt(rt);return Tt?Tt.getMediaInfo():null}function Qt(rt){return rt?re.find((Tt=>Tt.getType()===rt)):null}function un(){let rt=pt();const Tt=rt.length;if(Tt!==0){for(let Mt=0;Mt<Tt;Mt++)if(!rt[Mt].isBufferingCompleted()&&(rt[Mt].getType()===h.default.AUDIO||rt[Mt].getType()===h.default.VIDEO))return void Ie.debug("onBufferingCompleted - One streamProcessor has finished but",rt[Mt].getType(),"one is not buffering completed");Ie.debug("onBufferingCompleted - trigger STREAM_BUFFERING_COMPLETED"),ge=!0,b.trigger(f.default.STREAM_BUFFERING_COMPLETED,{streamInfo:se},{streamInfo:se})}else Ie.warn("onBufferingCompleted - can't trigger STREAM_BUFFERING_COMPLETED because no streamProcessor is defined")}function Rn(rt){$&&$.addInbandEvents(rt.events,se.id)}function xn(){_t()}function dn(){Zt()}function vn(rt){return rt&&rt.type?qe(rt.type):null}function qe(rt){return rt?pt().filter((function(Tt){return Tt.getType()===rt}))[0]:null}function pt(){let rt,Tt,Mt=[];for(let Fe=0;Fe<re.length;Fe++)Tt=re[Fe],rt=Tt.getType(),rt!==h.default.AUDIO&&rt!==h.default.VIDEO&&rt!==h.default.TEXT&&rt!==h.default.ENHANCEMENT||Mt.push(Tt);return Mt}function ft(){const rt=re.length;for(let Tt=0;Tt<rt&&re[Tt];Tt++)re[Tt].getScheduleController().startScheduleTimer()}function _t(){const rt=re.length;if(j){j.clearMediaInfoArray();for(let Tt=0;Tt<rt&&re[Tt];Tt++){const Mt=re[Tt].getType(),Fe=re[Tt].getMediaInfo();if(Mt===h.default.AUDIO||Mt===h.default.VIDEO||Mt===h.default.TEXT&&Fe&&Fe.isFragmented){let $e=re[Tt].getMediaInfo();$e&&j.initializeForMedia($e)}}j.handleKeySystemFromManifest()}Ce||(Ce=!0,ie.waitForReadyState(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,(()=>{b.trigger(f.default.STREAM_INITIALIZED,{streamInfo:se})})))}function Yt(rt){q=rt}function En(){return q}return be={activate:function(rt,Tt,Mt=[]){return new Promise(((Fe,$e)=>{if(!fe)return En()?(fe=!0,b.trigger(f.default.STREAM_ACTIVATED,{streamInfo:se}),void Fe()):void(function(yt,Ke,It=[]){return le(yt,Ke,It)})(rt,Tt,Mt).then((()=>{fe=!0,Mt&&Mt.length>0&&ft(),b.trigger(f.default.STREAM_ACTIVATED,{streamInfo:se}),Fe()})).catch((yt=>{$e(yt)}));Fe()}))},checkAndHandleCompletedBuffering:function(){ge||re.forEach((rt=>{rt.checkAndHandleCompletedBuffering()}))},deactivate:Se,getAdapter:function(){return I},getCurrentMediaInfoForType:function(rt){const Tt=qe(rt);return Tt?Tt.getMediaInfo():null},getCurrentRepresentationForType:function(rt){const Tt=qe(rt);return Tt?Tt.getRepresentation():null},getDuration:function(){return se?se.duration:NaN},getHasAudioTrack:function(){return M},getHasFinishedBuffering:function(){return ge},getHasVideoTrack:function(){return X},getId:Ye,getIsActive:function(){return fe},getIsEndedEventSignaled:function(){return Te},getPreloaded:En,getRepresentationForTypeById:function(rt,Tt){let Mt;if(rt===h.default.IMAGE){if(!ee)return null;Mt=ee.getPossibleVoRepresentations()}else Mt=(function(yt){let Ke=Qt(yt);return Ke?Ke.getAllMediaInfos():[]})(rt).flatMap((yt=>R.getPossibleVoRepresentationsFilteredBySettings(yt,!0)));if(!Mt||Mt.length===0)return null;const Fe=Mt.filter(($e=>$e.id===Tt));return Fe&&Fe.length>0?Fe[0]:null},getRepresentationForTypeByIndex:function(rt,Tt){let Mt;if(rt===h.default.IMAGE){if(!ee)return null;Mt=ee.getPossibleVoRepresentations()}else{const Fe=vt(rt);Mt=R.getPossibleVoRepresentationsFilteredBySettings(Fe,!0)}return Mt[Tt=Math.max(Math.min(Tt,Mt.length-1),0)]},getRepresentationsByType:function(rt){if(ct(),rt===h.default.IMAGE)return ee?ee.getPossibleVoRepresentations():[];const Tt=vt(rt);return R.getPossibleVoRepresentationsFilteredBySettings(Tt,!0)},getStartTime:ze,getStreamId:function(){return se?se.id:null},getStreamInfo:function(){return se},getStreamProcessors:pt,getThumbnailController:function(){return ee},initialize:function(){b.on(f.default.BUFFERING_COMPLETED,un,be),b.on(f.default.INBAND_EVENTS,Rn,be),b.on(f.default.DATA_UPDATE_COMPLETED,xn,be),b.on(y.default.PLAYBACK_SEEKED,dn,be),j&&(b.on(f.default.KEY_ERROR,bt,be),b.on(f.default.SERVER_CERTIFICATE_UPDATED,bt,be),b.on(f.default.LICENSE_REQUEST_COMPLETE,bt,be),b.on(f.default.KEY_SYSTEM_SELECTED,bt,be),b.on(f.default.KEY_SESSION_CREATED,bt,be)),te.initializeForStream(se),b.trigger(f.default.STREAM_UPDATED,{streamInfo:se})},initializeForTextWithMediaSource:function(rt){return new Promise(((Tt,Mt)=>{z(h.default.TEXT,rt,null).then((()=>(function(){const Fe=qe(h.default.TEXT);return Fe?Fe.createBufferSinks():Promise.resolve()})())).then((()=>{te.createTracks(se),Tt()})).catch((Fe=>{Mt(Fe)}))}))},prepareQualityChange:function(rt){const Tt=qe(rt.mediaType);Tt&&Tt.prepareQualityChange(rt)},prepareTrackChange:function(rt){if(!fe||!se)return;ge=!1;let Tt=rt.newMediaInfo,Mt=v.getValue(),Fe=vn(Tt);if(!Fe)return;let $e=C.getTime();if(Ie.info("Stream - Process track changed at current time "+$e),Mt.refreshManifestOnSwitchTrack)ne.push(rt),x.getIsUpdating()||(Ie.debug("Stream - Refreshing manifest for switch track"),x.refreshManifest());else{Fe.clearScheduleTimer(),Fe.setTrackSwitchInProgress(!0);const yt=Fe.getRepresentation();Fe.selectMediaInfo(new Ii({newMediaInfo:Tt})).then((()=>{const Ke=!!(rt&&rt.options&&rt.options.hasOwnProperty("replaceBuffer"))&&rt.options.replaceBuffer;return Fe.prepareTrackSwitch(yt,Ke)})).then((()=>{Fe.setTrackSwitchInProgress(!1)}))}},reset:function(rt){P&&(P.reset(),P=null),R&&se&&R.clearDataForStream(se.id),W&&(W.reset(),W=null),te&&se&&te.clearDataForStream(se.id),V&&se&&V.clearDataForStream(se.id),Re(rt),se=null,b.off(f.default.BUFFERING_COMPLETED,un,be),b.off(f.default.INBAND_EVENTS,Rn,be),b.off(f.default.DATA_UPDATE_COMPLETED,xn,be),b.off(y.default.PLAYBACK_SEEKED,dn,be),j&&(b.off(f.default.KEY_ERROR,bt,be),b.off(f.default.SERVER_CERTIFICATE_UPDATED,bt,be),b.off(f.default.LICENSE_REQUEST_COMPLETE,bt,be),b.off(f.default.KEY_SYSTEM_SELECTED,bt,be),b.off(f.default.KEY_SESSION_CREATED,bt,be))},setIsEndedEventSignaled:we,setMediaSource:function(rt){return new Promise(((Tt,Mt)=>{const Fe=[];for(let $e=0;$e<re.length;)ce(re[$e].getMediaInfo())?(Fe.push(re[$e].setMediaSource(rt)),$e++):(re[$e].reset(),re.splice($e,1));Promise.all(Fe).then((()=>{for(let $e=0;$e<re.length;$e++)re[$e].dischargePreBuffer();if(re.length===0){const $e="No streams to play.";A.error(new Wt.default(Jt.MANIFEST_ERROR_ID_NOSTREAMS_CODE,$e+"nostreams",v.getValue())),Ie.fatal($e)}Tt()})).catch(($e=>{Ie.error($e),Mt($e)}))}))},startPreloading:function(rt,Tt,Mt=[]){return new Promise(((Fe,$e)=>{En()?$e():(Ie.info(`[startPreloading] Preloading next stream with id ${Ye()}`),Yt(!0),le(rt,Tt,Mt).then((()=>{for(let yt=0;yt<re.length&&re[yt];yt++)re[yt].setExplicitBufferingTime(ze()),re[yt].getScheduleController().startScheduleTimer();Fe()})).catch((()=>{Yt(!1),$e()})))}))},startScheduleControllers:ft,triggerProtectionError:function(rt){bt(rt)},updateData:function(rt){return new Promise((Tt=>{se=rt,$&&Zt();let Mt,Fe=[];for(let $e=0,yt=re.length;$e<yt;$e++){let Ke=re[$e];const It=Ke.getMediaInfo();Fe.push(Ke.updateStreamInfo(se));let Ct=I.getAllMediaInfoForType(se,Ke.getType());if(Ct=Ct.filter((_e=>!_e.isEmbedded)),Ke.setMediaInfoArray(Ct),Ct)for(let _e=0;_e<Ct.length;_e++)I.areMediaInfosEqual(It,Ct[_e])&&Fe.push(Ke.selectMediaInfo(new Ii({newMediaInfo:Ct[_e]})))}Promise.all(Fe).then((()=>{let $e=[];for(;ne.length>0;){let yt=ne.pop(),Ke=yt.newMediaInfo;if(Mt=vn(yt.oldMediaInfo),!Mt)return;const It=Mt.getRepresentation();Mt.setTrackSwitchInProgress(!0),$e.push(Mt.prepareTrackSwitch(It)),$e.push(Mt.selectMediaInfo(new Ii({newMediaInfo:Ke})))}return Promise.all($e)})).then((()=>{_t(),Mt&&Mt.setTrackSwitchInProgress(!1),b.trigger(f.default.STREAM_UPDATED,{streamInfo:se}),Tt()})).catch(($e=>{A.error($e)}))}))}},(function(){try{U=(0,o.default)(m).getInstance(),Ie=U.getLogger(be),Re(),G=bs(m).getInstance(),W=sn(m).create({updateEventName:f.default.SEGMENT_LOCATION_BLACKLIST_CHANGED,addBlacklistEventName:f.default.SEGMENT_LOCATION_BLACKLIST_ADD}),P=cy(m).create({streamInfo:se,mediaPlayerModel:S,dashMetrics:k,errHandler:A,settings:de,boxParser:G,dashConstants:ye.default,urlUtils:T})}catch(rt){throw rt}})(),be}Id.__dashjs_factory_name="Stream";var ky=n.default.getClassFactory(Id);function Ko(){const p=this.context,m=(0,g.default)(p).getInstance(),b=Vn(p).getInstance();let T,v,S,k,x,I,N,O,A,R,C,B,$,V,j,te;function ie(){O=[],A=[],R=null,C=null,$=null,B=NaN,S=!1,k=!1,V=x.get().streaming.utcSynchronization.timeBetweenSyncAttempts}function se(){x.get().streaming.utcSynchronization.enabled&&!S&&!k&&$&&$.value&&$.schemeIdUri&&!isNaN(B)&&!isNaN(x.get().streaming.utcSynchronization.backgroundAttempts)&&(C&&(Date.now()-C)/1e3<30||(O=[],k=!0,de(isNaN(x.get().streaming.utcSynchronization.backgroundAttempts)?2:x.get().streaming.utcSynchronization.backgroundAttempts)))}function de(re){try{if(re<=0)return void q();const ee=Date.now();I[$.schemeIdUri]($.value,(function(ne){const le=Date.now(),z=U(ee,le,ne);O.push(z),de(re-1)}),(function(){q()}))}catch{q()}}function G(re=null){let ee=re||0;if(!A||A.length===0||ee>=A.length)return void P();let ne=A[ee];if(ne)if(I.hasOwnProperty(ne.schemeIdUri)){const le=new Date().getTime();I[ne.schemeIdUri](ne.value,(function(z){const ce=new Date().getTime(),me=U(le,ce,z);$=ne,P(me)}),(function(){G(ee+1)}))}else G(ee+1);else P()}function U(re,ee,ne){return ne-(ee-(ee-re)/2)}function P(re=NaN){let ee=isNaN(re);ee&&x.get().streaming.utcSynchronization.useManifestDateHeaderTimeSource?(function(){let ne=N.getLatestMPDRequestHeaderValueByID("Date"),le=ne!==null?new Date(ne).getTime():Number.NaN;isNaN(le)?Ie(!0):Ie(!1,le-Date.now())})():Ie(ee,re)}function M(re){let ee=Date.parse(re);return isNaN(ee)&&(ee=(function(ne){let le,z,ce=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+\-])([0-9]{2})([0-9]{2}))?/.exec(ne);return le=Date.UTC(parseInt(ce[1],10),parseInt(ce[2],10)-1,parseInt(ce[3],10),parseInt(ce[4],10),parseInt(ce[5],10),ce[6]&&(parseInt(ce[6],10)||0),ce[7]&&1e3*parseFloat(ce[7])||0),ce[9]&&ce[10]&&(z=60*parseInt(ce[9],10)+parseInt(ce[10],10),le+=(ce[8]==="+"?-1:1)*z*60*1e3),new Date(le).getTime()})(re)),ee}function ge(re){return Date.parse(re)}function X(re){return Date.parse(re)}function be(re,ee,ne){ne()}function fe(re,ee,ne){let le=M(re);isNaN(le)?ne():ee(le)}function Te(re,ee,ne,le,z){let ce,me,Se=!1,Re=new XMLHttpRequest,we=z?ke.HTTPRequest.HEAD:ke.HTTPRequest.GET,ze=ee.match(/\S+/g);if(ee=ze.shift(),ce=function(){Se||(Se=!0,ze.length?Te(re,ze.join(" "),ne,le,z):le())},me=function(){let Ye,ct;Re.status===200&&(Ye=z?Re.getResponseHeader("Date"):Re.response,ct=re(Ye),isNaN(ct)||(ne(ct),Se=!0))},b.isRelative(ee)){const Ye=te.resolve();Ye&&(ee=b.resolve(ee,Ye.url))}Re.open(we,ee),Re.timeout=5e3,Re.onload=me,Re.onloadend=ce,Re.send()}function Ce(re,ee,ne){Te(X,re,ee,ne,!0)}function Ie(re,ee){if(isNaN(B)||isNaN(ee)||re||(function(le){try{const z=W(le),ce=isNaN(V)?30:V,me=isNaN(x.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor)?2:x.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor,Se=isNaN(x.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts)?600:x.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts,Re=isNaN(x.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts)?2:x.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts;let we;z?(we=Math.min(ce*me,Se),v.debug(`Increasing timeBetweenSyncAttempts to ${we}`)):(we=Math.max(ce/me,Re),v.debug(`Decreasing timeBetweenSyncAttempts to ${we}`)),V=we}catch{}})(ee),!re&&!isNaN(ee)){R=Date.now(),S=!1;const le=isNaN(B);B=ee,le&&se(),v.debug(`Completed UTC sync. Setting client - server offset to ${ee}`)}re&&($=null,S=!1,j.error(new Wt.default(Jt.TIME_SYNC_FAILED_ERROR_CODE,Jt.TIME_SYNC_FAILED_ERROR_MESSAGE)));const ne=x.get().streaming.utcSynchronization.artificialTimeOffsetToApply;m.trigger(f.default.UPDATE_TIME_SYNC_OFFSET,{offset:ee+ne}),m.trigger(f.default.TIME_SYNCHRONIZATION_COMPLETED)}function q(){if(!O||O.length===0)return;const re=O.reduce(((ee,ne)=>ee+ne),0)/O.length;W(re)?v.debug("Completed background UTC sync. Offset is within allowed threshold and is not adjusted."):(v.debug(`Completed background UTC sync. Setting client - server offset to ${re}`),B=re,m.trigger(f.default.UPDATE_TIME_SYNC_OFFSET,{offset:B})),k=!1,C=Date.now()}function W(re){try{if(isNaN(B))return!0;const ee=x.get().streaming.utcSynchronization.maximumAllowedDrift&&!isNaN(x.get().streaming.utcSynchronization.maximumAllowedDrift)?x.get().streaming.utcSynchronization.maximumAllowedDrift:100;return re>=B-ee&&re<=B+ee}catch{return!0}}return T={initialize:function(){ie(),I={"urn:mpeg:dash:utc:http-head:2014":Ce,"urn:mpeg:dash:utc:http-xsdate:2014":Te.bind(null,M),"urn:mpeg:dash:utc:http-iso:2014":Te.bind(null,ge),"urn:mpeg:dash:utc:direct:2014":fe,"urn:mpeg:dash:utc:http-head:2012":Ce,"urn:mpeg:dash:utc:http-xsdate:2012":Te.bind(null,M),"urn:mpeg:dash:utc:http-iso:2012":Te.bind(null,ge),"urn:mpeg:dash:utc:direct:2012":fe,"urn:mpeg:dash:utc:http-ntp:2014":be,"urn:mpeg:dash:utc:ntp:2014":be,"urn:mpeg:dash:utc:sntp:2014":be}},attemptSync:function(re,ee){A=re,S||((function(ne){try{if(!ne||!x.get().streaming.utcSynchronization.enabled)return!1;const le=isNaN(V)?30:V;return!(R&&le&&!isNaN(le))||(Date.now()-R)/1e3>=le}catch{return!0}})(ee)?(S=!0,G()):m.trigger(f.default.TIME_SYNCHRONIZATION_COMPLETED))},setConfig:function(re){re&&(re.dashMetrics&&(N=re.dashMetrics),re.baseURLController&&(te=re.baseURLController),re.errHandler&&(j=re.errHandler),re.settings&&(x=re.settings))},reset:function(){ie(),m.off(f.default.ATTEMPT_BACKGROUND_SYNC,se,T)}},v=(0,o.default)(p).getInstance().getLogger(T),m.on(f.default.ATTEMPT_BACKGROUND_SYNC,se,T),T}Ko.__dashjs_factory_name="TimeSyncController";const Yo=n.default.getSingletonFactory(Ko);Yo.HTTP_TIMEOUT_MS=5e3,n.default.updateSingletonFactory(Ko.__dashjs_factory_name,Yo);var Cy=Yo;function xd(){let p,m,b,T,v;const S=this.context,k=(0,g.default)(S).getInstance();return p={attachMediaSource:function(x){let I=window.URL.createObjectURL(m);return x.setSource(I),T==="managedMediaSource"&&(x.setDisableRemotePlayback(!0),m.addEventListener("startstreaming",(()=>{k.trigger(y.default.MANAGED_MEDIA_SOURCE_START_STREAMING)})),m.addEventListener("endstreaming",(()=>{k.trigger(y.default.MANAGED_MEDIA_SOURCE_END_STREAMING)}))),I},createMediaSource:function(){let x="WebKitMediaSource"in window,I="MediaSource"in window;return"ManagedMediaSource"in window?(m=new ManagedMediaSource,T="managedMediaSource",v.info("Created ManagedMediaSource")):I?(m=new MediaSource,T="mediaSource",v.info("Created MediaSource")):x&&(m=new WebKitMediaSource,v.info("Created WebkitMediaSource")),m},detachMediaSource:function(x){x.setSource(null)},setConfig:function(x){x&&x.settings&&(b=x.settings)},setDuration:function x(I){m&&m.readyState==="open"&&(I===null&&isNaN(I)||m.duration!==I&&(I!==1/0||b.get().streaming.buffer.mediaSourceDurationInfinity||(I=Math.pow(2,32)),(function(N){let O=N.sourceBuffers;for(let A=0;A<O.length;A++)if(O[A].updating)return!0;return!1})(m)?setTimeout(x.bind(null,I),50):(v.info("Set MediaSource duration:"+I),m.duration=I)))},setSeekable:function(x,I){m&&typeof m.setLiveSeekableRange=="function"&&typeof m.clearLiveSeekableRange=="function"&&m.readyState==="open"&&x>=0&&x<I&&(m.clearLiveSeekableRange(),m.setLiveSeekableRange(x,I))},signalEndOfStream:function(x){if(!x||x.readyState!=="open")return;let I=x.sourceBuffers;for(let N=0;N<I.length;N++)if(I[N].updating||I[N].buffered.length===0)return;v.info("call to mediaSource endOfStream"),x.endOfStream()}},v=(0,o.default)(S).getInstance().getLogger(p),p}xd.__dashjs_factory_name="MediaSourceController";var Ly=n.default.getSingletonFactory(xd);function wd(){const p="urn:mpeg:dash:event:2012",b="urn:mpeg:dash:event:callback:2015",S="discarded",k="updated",x="added",I=this.context,N=(0,g.default)(I).getInstance();let O,A,R,C,B,$,V,j,te,ie,se;function de(){if(!V||!j)throw new Error("setConfig function has to be called previously")}function G(){se=!1,R={},C={},B=null,ie=!1,$=Date.now()/1e3}function U(){try{if(!ie){ie=!0;const Ie=j.getTime();let q=Ie-$;q=$>0?Math.max(0,q):0,P(C,q,Ie),P(R,q,Ie),M(C),M(R),$=Ie,ie=!1}}catch(Ie){ie=!1,A.error(Ie)}}function P(Ie,q,W){try{fe(Ie,function(ee){if(ee!==void 0){const ne=isNaN(ee.duration)?0:ee.duration;ee.calculatedPresentationTime<=W&&ee.calculatedPresentationTime+q+ne>=W?Ce(ee,y.default.EVENT_MODE_ON_START):(Te(W,ne+q,ee.calculatedPresentationTime)||(function(le){try{const z=le.eventStream.period.start+le.eventStream.period.duration;return le.calculatedPresentationTime>z}catch(z){return A.error(z),!1}})(ee))&&(A.debug(`Removing event ${ee.id} from period ${ee.eventStream.period.id} as it is expired or invalid`),(function(le,z){try{const ce=z.eventStream.schemeIdUri,me=z.eventStream.period.id,Se=z.eventStream.value,Re=z.id;le[me][ce]=le[me][ce].filter((we=>Se&&we.eventStream.value&&we.eventStream.value!==Se||we.id!==Re)),le[me][ce].length===0&&delete le[me][ce]}catch(ce){A.error(ce)}})(Ie,ee))}})}catch(re){A.error(re)}}function M(Ie){try{for(const q in Ie)Ie.hasOwnProperty(q)&&Object.keys(Ie[q]).length===0&&delete Ie[q]}catch(q){A.error(q)}}function ge(Ie,q,W=!1){const re=Ie.eventStream.schemeIdUri,ee=Ie.eventStream.value,ne=Ie.id;let le=S;q[re]||(q[re]=[]);const z=q[re].findIndex((ce=>(!ee||ce.eventStream.value&&ce.eventStream.value===ee)&&ce.id===ne));if(z===-1)q[re].push(Ie),Ie.triggeredReceivedEvent=!1,Ie.triggeredStartEvent=!1,le=x;else if(W){const ce=q[re][z];Ie.triggeredReceivedEvent=ce.triggeredReceivedEvent,Ie.triggeredStartEvent=ce.triggeredStartEvent,q[re][z]=Ie,le=k}return le}function X(Ie){try{if(Ie.eventStream.value==1){const q=Ie.calculatedPresentationTime;let W;W=Ie.calculatedPresentationTime==4294967295?NaN:Ie.calculatedPresentationTime+Ie.duration,N.trigger(y.default.MANIFEST_VALIDITY_CHANGED,{id:Ie.id,validUntil:q,newDuration:W,newManifestValidAfter:NaN},{mode:y.default.EVENT_MODE_ON_START})}}catch(q){A.error(q)}}function be(Ie){try{const q=j.getTime();fe(Ie,(function(W){const re=W.eventStream&&W.eventStream.period&&!isNaN(W.eventStream.period.duration)?W.eventStream.period.duration:NaN,ee=W.eventStream&&W.eventStream.period&&!isNaN(W.eventStream.period.start)?W.eventStream.period.start:NaN;if(isNaN(re)||isNaN(ee))return;const ne=W.calculatedPresentationTime;Math.abs(ne-q)<300&&Ce(W,y.default.EVENT_MODE_ON_START)}))}catch(q){A.error(q)}}function fe(Ie,q){try{if(Ie){const W=Object.keys(Ie);for(let re=0;re<W.length;re++){const ee=Ie[W[re]],ne=Object.keys(ee);for(let le=0;le<ne.length;le++)ee[ne[le]].forEach((z=>{z!==void 0&&q(z)}))}}}catch(W){A.error(W)}}function Te(Ie,q,W){try{return Ie-q>W}catch(re){return A.error(re),!1}}function Ce(Ie,q){try{const W=j.getTime(),re=Ie.id;if(q===y.default.EVENT_MODE_ON_RECEIVE&&!Ie.triggeredReceivedEvent)return A.debug(`Received event ${re}`),Ie.triggeredReceivedEvent=!0,void N.trigger(Ie.eventStream.schemeIdUri,{event:Ie},{mode:q});Ie.triggeredStartEvent||(Ie.eventStream.schemeIdUri===p&&Ie.eventStream.value==1?Ie.duration===0&&Ie.presentationTimeDelta===0||(A.debug(`Starting manifest refresh event ${re} at ${W}`),(function(){try{de(),V.refreshManifest()}catch(ee){A.error(ee)}})()):Ie.eventStream.schemeIdUri===b&&Ie.eventStream.value==1?(A.debug(`Starting callback event ${re} at ${W}`),(function(ee){try{let ne=tn(I).create({});const le=new Co({method:"get",url:ee,responseType:"arraybuffer",customData:{}}),z=new Lo({request:le});ne.load(le,z)}catch(ne){A.error(ne)}})(Ie.messageData instanceof Uint8Array?Je.default.uint8ArrayToString(Ie.messageData):Ie.messageData)):(A.debug(`Starting event ${re} from period ${Ie.eventStream.period.id} at ${W}`),N.trigger(Ie.eventStream.schemeIdUri,{event:Ie},{mode:q}),te.get().streaming.events.deleteEventMessageDataTimeout>-1&&setTimeout((()=>{delete Ie.messageData,delete Ie.parsedMessageData}),te.get().streaming.events.deleteEventMessageDataTimeout)),Ie.triggeredStartEvent=!0)}catch(W){A.error(W)}}return O={addInlineEvents:function(Ie,q){try{if(de(),R[q]||(R[q]={}),Ie)for(let W=0;W<Ie.length;W++){let re=Ie[W];if(!Te(j.getTime(),isNaN(re.duration)?0:re.duration,re.calculatedPresentationTime)){let ee=ge(re,R[q],!0);ee===x?(A.debug(`Added inline event with id ${re.id} from period ${q}`),Ce(re,y.default.EVENT_MODE_ON_RECEIVE)):ee===k&&A.debug(`Updated inline event with id ${re.id} from period ${q}`)}}}catch(W){throw W}},addInbandEvents:function(Ie,q){try{de(),C[q]||(C[q]={});for(let W=0;W<Ie.length;W++){let re=Ie[W];Te(j.getTime(),isNaN(re.duration)?0:re.duration,re.calculatedPresentationTime)||(ge(re,C[q],!1)===x?(re.eventStream.schemeIdUri===p&&X(re),A.debug(`Added inband event with id ${re.id} from period ${q}`),Ce(re,y.default.EVENT_MODE_ON_RECEIVE)):A.debug(`Inband event with scheme_id_uri ${re.eventStream.schemeIdUri}, value ${re.eventStream.value}, period id ${q} and event id ${re.id} was ignored because it has been added before.`))}U()}catch(W){throw W}},getInbandEvents:function(){return C},getInlineEvents:function(){return R},start:function(){try{de(),A.debug("Start Event Controller");const Ie=te.get().streaming.events.eventControllerRefreshDelay;se||isNaN(Ie)||(se=!0,B=setInterval(U,Ie))}catch(Ie){throw Ie}},setConfig:function(Ie){try{if(!Ie)return;Ie.manifestUpdater&&(V=Ie.manifestUpdater),Ie.playbackController&&(j=Ie.playbackController),Ie.settings&&(te=Ie.settings)}catch(q){throw q}},reset:function(){(function(){try{B!==null&&se&&(clearInterval(B),B=null,se=!1,(function(){try{be(C),be(R)}catch(Ie){A.error(Ie)}})())}catch(Ie){throw Ie}})(),G()}},A=(0,o.default)(I).getInstance().getLogger(O),G(),O}wd.__dashjs_factory_name="EventController";var Dy=n.default.getSingletonFactory(wd),ma={LEVELS:{WARNING:"Warning",ERROR:"Error"},EVENTS:{NO_UTC_TIMING_ELEMENT:{key:"NO_UTC_TIMING_ELEMENT",message:"No UTCTiming element is present in the manifest. You may experience playback failures. For a detailed validation use https://conformance.dashif.org/"},NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE:{key:"NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE",message:'SMPTE 2052-1:2013 defines the attribute name as "imageType" and does not define "imagetype"'},INVALID_DVR_WINDOW:{key:"INVALID_DVR_WINDOW",message:"No valid segment found when applying a specification compliant DVR window calculation. Using SegmentTimeline entries as a fallback."}}},Rd=t(445),kd=t(1923);function Cd(){const p=this.context,m=(0,g.default)(p).getInstance();let b,T,v,S,k,x,I,N,O,A,R,C,B,$,V,j,te,ie,se,de,G,U,P,M,ge,X,be,fe,Te,Ce,Ie,q,W,re,ee,ne,le,z,ce,me,Se,Re,we,ze,Ye,ct,bt,Zt;function vt(){if(!(x&&x.hasOwnProperty("load")&&U&&U.hasOwnProperty("initialize")&&U.hasOwnProperty("reset")&&U.hasOwnProperty("getClientTimeOffset")&&I&&G&&O&&ee))throw new Error(h.default.MISSING_CONFIG_ERROR)}function Qt(){(function(){try{const Ve=N.getStreamsInfo();if(!M&&Ve.length===0)throw new Error("There are no periods in the MPD");M&&Ve.length>0&&O.updateManifestUpdateInfo({currentTime:ee.getTime(),buffered:re.getBufferRange(),presentationStartTime:Ve[0].start,clientTimeOffset:U.getClientTimeOffset()}),P.length>0&&(function(an){an.length!==0?P=P.filter((ln=>{const wn=an.filter((kn=>kn.id===ln.getId())).length>0||ln.getId()===M.getId();return wn||(T.debug(`Removing stream ${ln.getId()}`),ln.reset(!0),ln=null),wn})):T.warn("No periods included in the current manifest. Skipping the filtering of outdated stream objects.")})(Ve);const xt=[];for(let an=0,ln=Ve.length;an<ln;an++){const wn=Ve[an];xt.push(Rn(wn)),O.addManifestUpdateStreamInfo(wn)}Promise.all(xt).then((()=>new Promise(((an,ln)=>{M?an():xn(Ve,an,ln)})))).then((()=>{m.trigger(f.default.STREAMS_COMPOSED),Sn()})).catch((an=>{throw an}))}catch(Ve){G.error(new Wt.default(Jt.MANIFEST_ERROR_ID_NOSTREAMS_CODE,Ve.message+" nostreamscomposed",I.getValue())),q=!0,Nr()}})()}function un(){Ye=!0}function Rn(Ve){let xt=pa(Ve.id);return xt?xt.updateData(Ve):(xt=ky(p).create({manifestModel:I,mediaPlayerModel:le,dashMetrics:O,manifestUpdater:k,adapter:N,timelineConverter:U,capabilities:v,capabilitiesFilter:S,errHandler:G,baseURLController:B,segmentBaseController:$,textController:X,abrController:j,playbackController:ee,throughputController:te,eventController:se,mediaController:ie,protectionController:ge,videoModel:re,streamInfo:Ve,settings:ze}),P.push(xt),xt.initialize(),Promise.resolve())}function xn(Ve,xt,an){try{yt();const ln=O.getCurrentDVRInfo().range;if(ln.end<ln.start)return void(function(kn,Xn,si,Yr){ct&&clearTimeout(ct);const Ea=Math.min(1e3*(-1*(kn.end-kn.start)+2),2147483647);T.debug(`Waiting for ${Ea} ms before playback can start`),m.trigger(f.default.AST_IN_FUTURE,{delay:Ea}),ct=setTimeout((()=>{xn(Xn,si,Yr)}),Ea)})(ln,Ve,xt,an);ze.get().streaming.applyProducerReferenceTime&&ne.calculateProducerReferenceTimeOffsets(Ve);const wn=Ve[0].manifestInfo;if(ze.get().streaming.applyServiceDescription&&ne.applyServiceDescription(wn),N.getIsDynamic()){const kn=tr(0,wn);ee.computeAndSetLiveDelay(kn,wn)}(ze.get().streaming.applyContentSteering&&C.shouldQueryBeforeStart()?C.loadSteeringData():Promise.resolve()).then((()=>{const kn=I.getValue();kn&&B.update(kn),dn(),xt()})).catch((kn=>{T.error(kn),dn(),xt()}))}catch(ln){an(ln)}}function dn(){const Ve=(function(){let ln;return ln=N.getIsDynamic()?(function(){let wn;const kn=O.getCurrentDVRInfo();wn=(kn&&kn.range?kn.range.end:0)-ee.getOriginalLiveDelay();const Xn=kn?kn.range:null;if(Xn){if(isNaN(bt)&&bt.toString().indexOf("posix:")===-1){const Yr=In(!0);isNaN(Yr)||(T.info(`Start time from URI parameters: ${Yr}`),wn=Math.min(wn,Yr))}else{T.info(`Start time provided by the app: ${bt}`);const Yr=mn(!0,bt);isNaN(Yr)||(wn=Math.min(wn,Yr))}const si=ze.get().streaming.timeShiftBuffer.calcFromSegmentTimeline?.1:0;wn=Math.max(wn,Xn.start+si)}return wn})():(function(){let wn=na()[0].getStreamInfo().start;if(isNaN(bt)){const kn=In(!1);isNaN(kn)||(T.info(`Start time from URI parameters: ${kn}`),wn=Math.max(wn,kn))}else{T.info(`Start time provided by the app: ${bt}`);const kn=mn(!1,bt);isNaN(kn)||(wn=Math.max(wn,kn))}return wn})(),ln})();let xt=$e(Ve);const an=xt!==null?xt:P[0];m.trigger(f.default.INITIAL_STREAM_SWITCH,{startTime:Ve}),vn(an,null,Ve),Re||(Re=setInterval((function(){!Ce&&ee.getTimeToStreamEnd()<=0&&!ee.isSeeking()&&m.trigger(f.default.PLAYBACK_ENDED,{isLast:Kr().isLast})}),200))}function vn(Ve,xt,an){try{if(Ce||!Ve||xt===Ve&&Ve.getIsActive())return;Ce=!0,m.trigger(f.default.PERIOD_SWITCH_STARTED,{fromStreamInfo:xt?xt.getStreamInfo():null,toStreamInfo:Ve.getStreamInfo()});let ln=!1,wn=[],kn=_t(xt);M=Ve,xt&&(ln=Mt(Ve,xt),wn=ft(xt),xt.deactivate(ln)),an=isNaN(an)?!ln&&xt?Ve.getStreamInfo().start:NaN:an,T.info(`Switch to stream ${Ve.getId()}. Seektime is ${an}, current playback time is ${ee.getTime()}. Seamless period switch is set to ${ln}`),we=we.filter((Xn=>Xn.getId()!==M.getId())),ee.initialize(Kr(),!!xt),re.getElement()?qe({seekTime:an,keepBuffers:ln,sourceBufferSinksFromPreviousPeriod:kn,streamActivated:!1,representationsFromPreviousPeriod:wn}):pt({seekTime:an,keepBuffers:ln,sourceBufferSinksFromPreviousPeriod:kn})}catch{Ce=!1}}function qe(Ve){let xt;function an(){if(!W||W.readyState!=="open")return;T.debug("MediaSource is open!"),window.URL.revokeObjectURL(xt),W.removeEventListener("sourceopen",an),W.removeEventListener("webkitsourceopen",an),cn();const wn=O.getCurrentDVRInfo();A.setSeekable(wn.range.start,wn.range.end),Ve.streamActivated?(isNaN(Ve.seekTime)||ee.seek(Ve.seekTime,!0,!0),M.setMediaSource(W).then((()=>{M.initializeForTextWithMediaSource(W)}))):pt(Ve)}function ln(){W.addEventListener("sourceopen",an,!1),W.addEventListener("webkitsourceopen",an,!1),xt=A.attachMediaSource(re),T.debug("MediaSource attached to element. Waiting on open...")}W?Ve.keepBuffers?pt(Ve):(A.detachMediaSource(re),ln()):(W=A.createMediaSource(),ln())}function pt(Ve){const xt=Ve.representationsFromPreviousPeriod||[];M.activate(W,Ve.sourceBufferSinksFromPreviousPeriod,xt).then((()=>{isNaN(Ve.seekTime)||(m.trigger(f.default.SEEK_TARGET,{time:Ve.seekTime},{streamId:M.getId()}),ee.seek(Ve.seekTime,!1,!0),M.startScheduleControllers()),Ce=!1,m.trigger(f.default.PERIOD_SWITCH_COMPLETED,{toStreamInfo:Kr()})}))}function ft(Ve){return(Ve?Ve.getStreamProcessors():[]).map((xt=>xt.getRepresentation()))}function _t(Ve){const xt=new Map;return Ve&&(Ve?Ve.getStreamProcessors():[]).forEach((an=>{const ln=an.getBuffer();ln&&xt.set(ln.getType(),ln)})),xt}function Yt(Ve){const xt=$e(Ve.seekTime);xt&&xt!==M?xt&&xt!==M&&(En(xt),(function(an,ln){const wn=an&&!isNaN(an.seekTime)?an.seekTime:NaN,kn=M.getStreamProcessors().map((Xn=>Xn.prepareOuterPeriodPlaybackSeeking(an)));Promise.all(kn).then((()=>{vn(ln,M,wn)})).catch((Xn=>{G.error(Xn)}))})(Ve,xt)):(En(),(function(an){M.getStreamProcessors().forEach((ln=>ln.prepareInnerPeriodPlaybackSeeking(an))),Bi(Rr.USER_REQUEST_STOP_REASON)})(Ve)),Vr(zi.SEEK_START_REASON)}function En(Ve=null){rt()}function rt(){we&&we.length>0&&(we.forEach((Ve=>{Ve.deactivate(!0)})),we=[])}function Tt(Ve){if(Ve.newMediaInfo.streamInfo.id===M.getId()){if(rt(),ze.get().streaming.buffer.resetSourceBuffersForTrackSwitch&&Ve.oldMediaInfo&&Ve.oldMediaInfo.codec!==Ve.newMediaInfo.codec){const xt=ee.getTime();return M.deactivate(!1),void qe({seekTime:xt,keepBuffers:!1,streamActivated:!1})}M.prepareTrackChange(Ve)}}function Mt(Ve,xt){try{return ze.get().streaming.buffer.reuseExistingSourceBuffers&&(v.isProtectionCompatible(xt.getStreamInfo(),Ve.getStreamInfo())||Ye)&&v.supportsChangeType()&&ze.get().streaming.buffer.useChangeType}catch{return!1}}function Fe(Ve,xt=null){if(!W||Ve.getPreloaded()||!Mt(Ve,xt))return;const an=ft(xt),ln=_t(xt);Ve.startPreloading(W,ln,an).then((()=>{we.push(Ve)}))}function $e(Ve){if(isNaN(Ve))return null;const xt=P.length;for(let an=0;an<xt;an++){const ln=P[an];if(Ve<parseFloat((ln.getStartTime()+ln.getDuration()).toFixed(5)))return ln}return null}function yt(){try{const Ve=N.getIsDynamic(),xt=N.getStreamsInfo()[0].manifestInfo,an=ee.getTime(),ln=U.calcTimeShiftBufferWindow(P,Ve),wn=Gt();if(ln.start===void 0||ln.end===void 0)return;wn&&wn.length!==0?wn.forEach((kn=>{O.addDVRInfo(kn.getType(),an,xt,ln)})):O.addDVRInfo(h.default.VIDEO,an,xt,ln)}catch{}}function Ke(Ve){if(me&&Te){const xt=le.getInitialBufferLevel(),an=[h.default.TEXT];(isNaN(xt)||xt<=ee.getBufferLevel(an)||N.getIsDynamic()&&xt>ee.getLiveDelay())&&(me=!1,Vr(zi.INITIAL_PLAYOUT_START_REASON),ee.play())}Ve&&Ve.mediaType&&O.addBufferLevel(Ve.mediaType,new Date,1e3*Ve.bufferLevel)}function It(Ve){Ve.streamInfo.id===M.getId()&&rt(),pa(Ve.streamInfo.id).prepareQualityChange(Ve)}function Ct(){if(N.getIsDynamic()&&ee.getOriginalLiveDelay()!==0&&M){const Ve=N.getStreamsInfo();if(Ve.length>0){const xt=Ve[0].manifestInfo,an=tr(0,xt);ee.computeAndSetLiveDelay(an,xt)}}}function _e(){if(hi()){const Ve=re.getPlaybackQuality();Ve&&O.addDroppedFrames(Ve)}}function Qe(){T.debug("[onPlaybackStarted]"),!me&&ce&&Vr(zi.RESUME_FROM_PAUSE_START_REASON),me&&(me=!1),Se&&(Se=!1,ze.get().streaming.applyContentSteering&&!C.shouldQueryBeforeStart()&&C.loadSteeringData()),ce=!1}function Lt(Ve){T.debug("[onPlaybackPaused]"),Ve.ended||(ce=!0,Bi(Rr.USER_REQUEST_STOP_REASON))}function Dt(Ve){T.debug(`Stream with id ${Ve.streamInfo.id} finished buffering`);const xt=Ve.streamInfo.isLast;W&&xt?(T.info("[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController."),A.signalEndOfStream(W)):Sn()}function Sn(){if(!M)return;if(!M.getHasFinishedBuffering())return void M.checkAndHandleCompletedBuffering();const Ve=(function(an=null){try{const ln=an||M||null;if(ln){const wn=ln.getStreamInfo();return P.filter((function(kn){const Xn=kn.getStreamInfo();return Xn.start>wn.start&&wn.id!==Xn.id}))}}catch{return[]}})(M);let xt=0;for(;xt<Ve.length;){const an=Ve[xt],ln=xt===0?M:Ve[xt-1];!an.getPreloaded()&&ln.getHasFinishedBuffering()&&Fe(an,ln),xt+=1}}function ot(){Re&&(clearInterval(Re),Re=null)}function Gt(){return M?M.getStreamProcessors():[]}function fn(Ve){if(M&&!M.getIsEndedEventSignaled()){M.setIsEndedEventSignaled(!0);const xt=(function(an=null){const ln=an||M||null;if(!ln)return null;const wn=ln.getStreamInfo(),kn=wn.start;let Xn=0,si=-1,Yr=NaN;for(;Xn<P.length;){const Ea=P[Xn].getStreamInfo(),Zo=Ea.start-kn;Zo>0&&(isNaN(Yr)||Zo<Yr)&&wn.id!==Ea.id&&(Yr=Zo,si=Xn),Xn+=1}return si>=0?P[si]:null})();xt?(T.debug(`StreamController onEnded, found next stream with id ${xt.getStreamInfo().id}. Switching from ${M.getStreamInfo().id} to ${xt.getStreamInfo().id}`),vn(xt,M,NaN)):(T.debug("StreamController no next stream found"),M.setIsEndedEventSignaled(!1)),Bi(xt?Rr.END_OF_PERIOD_STOP_REASON:Rr.END_OF_CONTENT_STOP_REASON)}Ve&&Ve.isLast&&(ot(),C.stopSteeringRequestTimer())}function cn(Ve){const xt=Ve||Kr().manifestInfo.duration;A.setDuration(xt)}function In(Ve){const xt=V.getURIFragmentData();if(!xt||!xt.t)return NaN;const an=na()[0].getStreamInfo().start;return xt.t=xt.t.split(",")[0],Gn(Ve,xt.t,an)}function mn(Ve,xt){let an=0;return Ve||(an=na()[0].getStreamInfo().start),Gn(Ve,xt,an)}function Gn(Ve,xt,an){const ln=N.getRegularPeriods()[0],wn=xt.toString(),kn=wn.indexOf("posix:")!==-1?wn.substring(6)==="now"?Date.now()/1e3:parseFloat(wn.substring(6)):NaN;return Ve&&!isNaN(kn)?U.calcPresentationTimeFromWallTime(new Date(1e3*kn),ln):parseFloat(wn)+an}function tr(Ve,xt){try{let an=NaN;return xt&&!isNaN(xt.maxFragmentDuration)&&isFinite(xt.maxFragmentDuration)?xt.maxFragmentDuration:isFinite(an)?an:NaN}catch{return NaN}}function ri(){const Ve=I.getValue();B.initialize(Ve)}function ii(Ve){if(Ve.error)q=!0,Nr();else{T.info("Manifest updated... updating data system wide.");const xt=Ve.manifest;N.updatePeriods(xt),S.filterUnsupportedFeatures(xt).then((()=>{B.initialize(xt);let an=N.getUTCTimingSources();!N.getIsDynamic()||an&&an.length!==0||m.trigger(y.default.CONFORMANCE_VIOLATION,{level:ma.LEVELS.WARNING,event:ma.EVENTS.NO_UTC_TIMING_ELEMENT});let ln=N.getIsDynamic()?an.concat(z.getUTCTimingSources()):an;R.attemptSync(ln,N.getIsDynamic()),fe.createFinalQueryStrings(xt)}))}}function hi(){return!!M&&M.getHasVideoTrack()}function ta(){return!!M&&M.getHasAudioTrack()}function Bi(Ve,xt){xt=xt||new Date,Gt().forEach((an=>{an.finalisePlayList(xt,Ve)})),O.addPlayList()}function Vr(Ve){O.createPlaylistMetrics(1e3*ee.getTime(),Ve)}function ji(Ve){ge.updateKeyStatusesMap(Ve),(function(){const xt=Gt();let an=!1;xt.forEach((ln=>{const wn=ln.getMediaInfo();!wn||v.areKeyIdsUsable(wn)?wn&&v.areKeyIdsExpired(wn)&&(function(kn){const Xn=pa(kn.getStreamId());Xn&&Xn.triggerProtectionError({error:new Wt.default(kd.default.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE,kd.default.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)})})(ln):(an=!0,(function(kn){const Xn=kn.getAllMediaInfos().filter((si=>v.areKeyIdsUsable(si)));if(Xn&&Xn.length!==0)ie.setTrack(Xn[0],{replaceBuffer:!0});else{const si=kn.getType();G.error(new Wt.default(Jt.NO_SUPPORTED_KEY_IDS,`Type: ${si}: ${Jt.NO_SUPPORTED_KEY_IDS_MESSAGE}`))}})(ln))})),an&&(ee.getTime()===0?m.once(y.default.FRAGMENT_LOADING_COMPLETED,(()=>{Hr()}),b):ee.isProgressing(500).then((ln=>{ln||Hr()})))})()}function Hr(){const Ve=ee.getTime();ee.seek(Ve+.01,!1,!1)}function ai(Ve){if(!Ve.error)return;let xt;switch(Ve.error.code){case 1:xt="MEDIA_ERR_ABORTED";break;case 2:xt="MEDIA_ERR_NETWORK";break;case 3:xt="MEDIA_ERR_DECODE",Zt.counts.mediaErrorDecode+=1;break;case 4:xt="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:xt="MEDIA_ERR_ENCRYPTED";break;default:xt="UNKNOWN"}xt==="MEDIA_ERR_DECODE"&&ze.get().errors.recoverAttempts.mediaErrorDecode>=Zt.counts.mediaErrorDecode?(function(){T.error("A MEDIA_ERR_DECODE occured: Resetting the MediaSource");const an=ee.getTime();M.deactivate(!1),T.info(`MediaSource has been resetted. Resuming playback from time ${an}`),qe({seekTime:an,keepBuffers:!1,streamActivated:!1})})():(Ie=!0,Ve.error.message&&(xt+=" ("+Ve.error.message+")"),Ve.error.msExtendedCode&&(xt+=" (0x"+(Ve.error.msExtendedCode>>>0).toString(16).toUpperCase()+")"),T.fatal("Video Element Error: "+xt),Ve.error&&T.fatal(Ve.error),G.error(new Wt.default(Ve.error.code,xt)),Nr())}function Kr(){return M?M.getStreamInfo():null}function pa(Ve){for(let xt=0,an=P.length;xt<an;xt++)if(P[xt].getId()===Ve)return P[xt];return null}function Cs(Ve){isNaN(Ve.newDuration)||cn(Ve.newDuration)}function Ls(){P=[],bt=NaN,ge=null,Ce=!1,M=null,Ie=!1,q=!1,me=!0,Se=!0,ce=!1,Te=!0,Re=null,Ye=!1,we=[],ct=null,Zt={counts:{mediaErrorDecode:0}}}function Nr(){vt(),R.reset(),Bi(Ie||q?Rr.FAILURE_STOP_REASON:Rr.USER_REQUEST_STOP_REASON);for(let Ve=0,xt=P?P.length:0;Ve<xt;Ve++)P[Ve].reset(Ie);m.off(y.default.PLAYBACK_TIME_UPDATED,_e,b),m.off(y.default.PLAYBACK_SEEKING,Yt,b),m.off(y.default.PLAYBACK_ERROR,ai,b),m.off(y.default.PLAYBACK_STARTED,Qe,b),m.off(y.default.PLAYBACK_PAUSED,Lt,b),m.off(y.default.PLAYBACK_ENDED,fn,b),m.off(y.default.METRIC_ADDED,ya,b),m.off(y.default.MANIFEST_VALIDITY_CHANGED,Cs,b),m.off(y.default.BUFFER_LEVEL_UPDATED,Ke,b),m.off(y.default.QUALITY_CHANGE_REQUESTED,It,b),m.off(y.default.CONTENT_STEERING_REQUEST_COMPLETED,ri,b),f.default.KEY_SESSION_UPDATED&&m.off(f.default.KEY_SESSION_UPDATED,un,b),m.off(f.default.MANIFEST_UPDATED,ii,b),m.off(f.default.STREAM_BUFFERING_COMPLETED,Dt,b),m.off(f.default.TIME_SYNCHRONIZATION_COMPLETED,Qt,b),m.off(f.default.CURRENT_TRACK_CHANGED,Tt,b),m.off(f.default.SETTING_UPDATED_LIVE_DELAY,Ct,b),m.off(f.default.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT,Ct,b),m.off(Rd.default.INTERNAL_KEY_STATUSES_CHANGED,ji,b),B.reset(),k.reset(),se.reset(),O.clearAllCurrentMetrics(),I.setValue(null),x.reset(),U.reset(),de.reset(),W&&(A.detachMediaSource(re),W=null),re=null,ge&&(ge=null,be=null,I.getValue()&&m.trigger(f.default.PROTECTION_DESTROYED,{data:I.getValue().url})),ot(),m.trigger(f.default.STREAM_TEARDOWN_COMPLETE),Ls()}function ya(Ve){if(Ve.metric===i.DVR_INFO){const xt=ta()?h.default.AUDIO:h.default.VIDEO;Ve.mediaType===xt&&A.setSeekable(Ve.value.range.start,Ve.value.range.end)}}function na(){return P}return b={addDVRMetric:yt,getActiveStream:function(){return M},getActiveStreamInfo:Kr,getActiveStreamProcessors:Gt,getAutoPlay:function(){return Te},getHasMediaOrInitialisationError:function(){return Ie||q},getInitialPlayback:function(){return me},getIsStreamSwitchInProgress:function(){return Ce},getStreamById:pa,getStreamForTime:$e,getStreams:na,getTimeRelativeToStreamId:function(Ve,xt){let an=null,ln=0,wn=0,kn=null;for(let Xn=0;Xn<P.length;Xn++){if(an=P[Xn],wn=an.getStartTime(),kn=an.getDuration(),Number.isFinite(wn)&&(ln=wn),an.getId()===xt)return Ve-ln;Number.isFinite(kn)&&(ln+=kn)}return null},hasAudioTrack:ta,hasVideoTrack:hi,initialize:function(Ve,xt){vt(),Te=Ve,be=xt,U.initialize(),k=Oc(p).create(),k.setConfig({manifestModel:I,adapter:N,manifestLoader:x,errHandler:G,settings:ze,contentSteeringController:C}),k.initialize(),se=Dy(p).getInstance(),se.setConfig({manifestUpdater:k,playbackController:ee,settings:ze}),se.start(),fe=Hu(p).getInstance(),R.setConfig({dashMetrics:O,baseURLController:B,errHandler:G,settings:ze}),R.initialize(),A.setConfig({settings:ze}),ge&&(m.trigger(f.default.PROTECTION_CREATED,{controller:ge}),ge.setMediaElement(re.getElement()),be&&ge.setProtectionData(be)),m.on(y.default.PLAYBACK_TIME_UPDATED,_e,b),m.on(y.default.PLAYBACK_SEEKING,Yt,b),m.on(y.default.PLAYBACK_ERROR,ai,b),m.on(y.default.PLAYBACK_STARTED,Qe,b),m.on(y.default.PLAYBACK_PAUSED,Lt,b),m.on(y.default.PLAYBACK_ENDED,fn,b),m.on(y.default.METRIC_ADDED,ya,b),m.on(y.default.MANIFEST_VALIDITY_CHANGED,Cs,b),m.on(y.default.BUFFER_LEVEL_UPDATED,Ke,b),m.on(y.default.QUALITY_CHANGE_REQUESTED,It,b),m.on(y.default.CONTENT_STEERING_REQUEST_COMPLETED,ri,b),f.default.KEY_SESSION_UPDATED&&m.on(f.default.KEY_SESSION_UPDATED,un,b),m.on(f.default.MANIFEST_UPDATED,ii,b),m.on(f.default.STREAM_BUFFERING_COMPLETED,Dt,b),m.on(f.default.TIME_SYNCHRONIZATION_COMPLETED,Qt,b),m.on(f.default.CURRENT_TRACK_CHANGED,Tt,b),m.on(f.default.SETTING_UPDATED_LIVE_DELAY,Ct,b),m.on(f.default.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT,Ct,b),m.on(Rd.default.INTERNAL_KEY_STATUSES_CHANGED,ji,b)},load:function(Ve,xt=NaN){vt(),bt=xt,x.load(Ve)},loadWithManifest:function(Ve,xt=NaN){(function(){if(!k||!k.hasOwnProperty("setManifest"))throw new Error("initialize function has to be called previously")})(),bt=xt,k.setManifest(Ve)},refreshManifest:function(){k.getIsUpdating()||k.refreshManifest()},reset:Nr,setConfig:function(Ve){Ve&&(Ve.capabilities&&(v=Ve.capabilities),Ve.capabilitiesFilter&&(S=Ve.capabilitiesFilter),Ve.manifestLoader&&(x=Ve.manifestLoader),Ve.manifestModel&&(I=Ve.manifestModel),Ve.mediaPlayerModel&&(le=Ve.mediaPlayerModel),Ve.customParametersModel&&(z=Ve.customParametersModel),Ve.protectionController&&(ge=Ve.protectionController),Ve.adapter&&(N=Ve.adapter),Ve.dashMetrics&&(O=Ve.dashMetrics),Ve.errHandler&&(G=Ve.errHandler),Ve.timelineConverter&&(U=Ve.timelineConverter),Ve.videoModel&&(re=Ve.videoModel),Ve.playbackController&&(ee=Ve.playbackController),Ve.throughputController&&(te=Ve.throughputController),Ve.serviceDescriptionController&&(ne=Ve.serviceDescriptionController),Ve.contentSteeringController&&(C=Ve.contentSteeringController),Ve.textController&&(X=Ve.textController),Ve.abrController&&(j=Ve.abrController),Ve.mediaController&&(ie=Ve.mediaController),Ve.settings&&(ze=Ve.settings),Ve.baseURLController&&(B=Ve.baseURLController),Ve.uriFragmentModel&&(V=Ve.uriFragmentModel),Ve.segmentBaseController&&($=Ve.segmentBaseController),Ve.manifestUpdater&&(k=Ve.manifestUpdater))},setProtectionData:function(Ve){be=Ve,ge&&ge.setProtectionData(be)},switchToVideoElement:function(Ve){M&&(ee.initialize(Kr()),qe({seekTime:Ve,keepBuffers:!1,streamActivated:!0}))}},T=(0,o.default)(p).getInstance().getLogger(b),R=Cy(p).getInstance(),A=Ly(p).getInstance(),de=Go(p).getInstance(),Ls(),b}Cd.__dashjs_factory_name="StreamController";var Ld=n.default.getSingletonFactory(Cd),Py=class extends Ts{constructor(){super(),this.captionData=null,this.label=null,this.defaultTrack=!1,this.kind=null,this.isFragmented=!1,this.isEmbedded=!1,this.isTTML=null}},Ny=t(7377);function Dd(){let p,m=0;function b(I){let N="";for(let O=0;O<I.length;++O)N+=I[O].uchar;return N.length-N.replace(/^\s+/,"").length}function T(I){return"left: "+3.125*I.x+"%; top: "+6.66*I.y1+"%; width: "+(100-3.125*I.x)+"%; height: "+6.66*Math.max(I.y2-1-I.y1,1)+"%; align-items: flex-start; overflow: visible; -webkit-writing-mode: horizontal-tb;"}function v(I){return I==="red"?"rgb(255, 0, 0)":I==="green"?"rgb(0, 255, 0)":I==="blue"?"rgb(0, 0, 255)":I==="cyan"?"rgb(0, 255, 255)":I==="magenta"?"rgb(255, 0, 255)":I==="yellow"?"rgb(255, 255, 0)":I==="white"?"rgb(255, 255, 255)":I==="black"?"rgb(0, 0, 0)":I}function S(I,N){const O=I.videoHeight/15;return N?"font-size: "+O+"px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; color: "+(N.foreground?v(N.foreground):"rgb(255, 255, 255)")+"; font-style: "+(N.italics?"italic":"normal")+"; text-decoration: "+(N.underline?"underline":"none")+"; white-space: pre; background-color: "+(N.background?v(N.background):"transparent")+";":"font-size: "+O+"px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; justify-content: flex-start; text-align: left; color: rgb(255, 255, 255); font-style: normal; white-space: pre; line-height: normal; font-weight: normal; text-decoration: none; width: 100%; display: flex;"}function k(I){return I.replace(/^\s+/g,"")}function x(I){return I.replace(/\s+$/g,"")}return p={createHTMLCaptionsFromScreen:function(I,N,O,A){let R=null,C=null,B=!1,$=-1,V={start:N,end:O,spans:[]},j="style_cea608_white_black";const te={},ie={},se=[];let de,G;for(de=0;de<15;++de){const P=A.rows[de];let M="",ge=null;if(P.isEmpty()===!1){const X=b(P.chars);R===null&&(R={x:X,y1:de,y2:de+1,p:[]}),X!==$&&B&&(R.p.push(V),V={start:N,end:O,spans:[]},R.y2=de,R.name="region_"+R.x+"_"+R.y1+"_"+R.y2,te.hasOwnProperty(R.name)===!1?(se.push(R),te[R.name]=R):(C=te[R.name],C.p.contat(R.p)),R={x:X,y1:de,y2:de+1,p:[]});for(let be=0;be<P.chars.length;++be){const fe=P.chars[be],Te=fe.penState;if(ge===null||!Te.equals(ge)){M.trim().length>0&&(V.spans.push({name:j,line:M,row:de}),M="");let Ce="style_cea608_"+Te.foreground+"_"+Te.background;Te.underline&&(Ce+="_underline"),Te.italics&&(Ce+="_italics"),ie.hasOwnProperty(Ce)||(ie[Ce]=JSON.parse(JSON.stringify(Te))),ge=Te,j=Ce}M+=fe.uchar}M.trim().length>0&&V.spans.push({name:j,line:M,row:de}),B=!0,$=X}else B=!1,$=-1,R&&(R.p.push(V),V={start:N,end:O,spans:[]},R.y2=de,R.name="region_"+R.x+"_"+R.y1+"_"+R.y2,te.hasOwnProperty(R.name)===!1?(se.push(R),te[R.name]=R):(C=te[R.name],C.p.contat(R.p)),R=null)}R&&(R.p.push(V),R.y2=de+1,R.name="region_"+R.x+"_"+R.y1+"_"+R.y2,te.hasOwnProperty(R.name)===!1?(se.push(R),te[R.name]=R):(C=te[R.name],C.p.contat(R.p)),R=null);const U=[];for(de=0;de<se.length;++de){const P=se[de],M="sub_cea608_"+m++,ge=document.createElement("div");ge.id=M;const X=T(P);ge.style.cssText="position: absolute; margin: 0; display: flex; box-sizing: border-box; pointer-events: none;"+X;const be=document.createElement("div");be.className="paragraph bodyStyle",be.style.cssText=S(I);const fe=document.createElement("div");fe.className="cueUniWrapper",fe.style.cssText="unicode-bidi: normal; direction: ltr;";for(let Ce=0;Ce<P.p.length;++Ce){const Ie=P.p[Ce];let q=0;for(G=0;G<Ie.spans.length;++G){let W=Ie.spans[G];if(W.line.length>0){if(G!==0&&q!=W.row){const le=document.createElement("br");le.className="lineBreak",fe.appendChild(le)}let re=!1;q===W.row&&(re=!0),q=W.row;const ee=ie[W.name],ne=document.createElement("span");ne.className="spanPadding "+W.name+" customSpanColor",ne.style.cssText=S(I,ee),G!==0&&re?G===Ie.spans.length-1?ne.textContent=x(W.line):ne.textContent=W.line:Ie.spans.length>1&&G<Ie.spans.length-1&&W.row===Ie.spans[G+1].row?ne.textContent=k(W.line):ne.textContent=W.line.trim(),fe.appendChild(ne)}}}be.appendChild(fe),ge.appendChild(be);const Te={bodyStyle:["%",90]};for(const Ce in ie)ie.hasOwnProperty(Ce)&&(Te[Ce]=["%",90]);U.push({type:"html",start:N,end:O,cueHTMLElement:ge,cueID:M,cellResolution:[32,15],isFromCEA608:!0,fontSize:Te,lineHeight:{},linePadding:{}})}return U}},p}Dd.__dashjs_factory_name="EmbeddedTextHtmlRender";var My=n.default.getSingletonFactory(Dd),ws=class{constructor(){this.time=null,this.verboseLevel=0}log(p,m){if(this.verboseLevel>=p){const b=typeof m=="function"?m():m;console.log(`${this.time} [${p}] ${b}`)}}},Pd=class{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(p){for(const m of["foreground","underline","italics","background","flash"])Object.prototype.hasOwnProperty.call(p,m)&&(this[m]=p[m])}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(p){return this.foreground===p.foreground&&this.underline===p.underline&&this.italics===p.italics&&this.background===p.background&&this.flash===p.flash}copy(p){this.foreground=p.foreground,this.underline=p.underline,this.italics=p.italics,this.background=p.background,this.flash=p.flash}},Oy=class{constructor(){this.uchar=" ",this.penState=new Pd}reset(){this.uchar=" ",this.penState.reset()}setChar(p,m){this.uchar=p,this.penState.copy(m)}setPenState(p){this.penState.copy(p)}equals(p){return this.uchar===p.uchar&&this.penState.equals(p.penState)}copy(p){this.uchar=p.uchar,this.penState.copy(p.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}};const xi=100,Fy={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499};function Nd(p){return String.fromCharCode(Fy[p]||p)}var Uy=class{constructor(p=new ws){this.chars=[],this.cueStartTime=null,this.pos=0,this.currPenState=new Pd;for(let m=0;m<xi;m++)this.chars.push(new Oy);this.logger=p}equals(p){for(let m=0;m<xi;m++)if(!this.chars[m].equals(p.chars[m]))return!1;return!0}copy(p){for(let m=0;m<xi;m++)this.chars[m].copy(p.chars[m])}isEmpty(){let p=!0;for(let m=0;m<xi;m++)if(!this.chars[m].isEmpty()){p=!1;break}return p}setCursor(p){this.pos!==p&&(this.pos=p),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>xi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=xi)}moveCursor(p){const m=this.pos+p;if(p>1)for(let b=this.pos+1;b<m+1;b++)this.chars[b].setPenState(this.currPenState);this.setCursor(m)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(p){p>=144&&this.backSpace();const m=Nd(p);this.pos>=xi?this.logger.log(0,(()=>"Cannot insert "+p.toString(16)+" ("+m+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(m,this.currPenState),this.moveCursor(1))}clearFromPos(p){let m;for(m=p;m<xi;m++)this.chars[m].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const p=[];let m=!0;for(let b=0;b<xi;b++){const T=this.chars[b].uchar;T!==" "&&(m=!1),p.push(T)}return m?"":p.join("")}setPenStyles(p){this.currPenState.setStyles(p),this.chars[this.pos].setPenState(this.currPenState)}};const Ji=15;var Wo=class{constructor(p=new ws){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null;for(let m=0;m<Ji;m++)this.rows.push(new Uy(p));this.logger=p}reset(){for(let p=0;p<Ji;p++)this.rows[p].clear();this.currRow=14}equals(p){let m=!0;for(let b=0;b<Ji;b++)if(!this.rows[b].equals(p.rows[b])){m=!1;break}return m}copy(p){for(let m=0;m<Ji;m++)this.rows[m].copy(p.rows[m])}isEmpty(){let p=!0;for(let m=0;m<Ji;m++)if(!this.rows[m].isEmpty()){p=!1;break}return p}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(p){this.rows[this.currRow].insertChar(p)}setPen(p){this.rows[this.currRow].setPenStyles(p)}moveCursor(p){this.rows[this.currRow].moveCursor(p)}setCursor(p){this.logger.log(2,"setCursor: "+p),this.rows[this.currRow].setCursor(p)}setPAC(p){this.logger.log(2,(()=>"pacData = "+JSON.stringify(p)));let m=p.row-1;if(this.nrRollUpRows&&m<this.nrRollUpRows-1&&(m=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==m){for(let k=0;k<Ji;k++)this.rows[k].clear();const v=this.currRow+1-this.nrRollUpRows,S=this.lastOutputScreen;if(S){const k=S.rows[v].cueStartTime,x=this.logger.time;if(k!==null&&x!==null&&k<x)for(let I=0;I<this.nrRollUpRows;I++)this.rows[m-this.nrRollUpRows+I+1].copy(S.rows[v+I])}}this.currRow=m;const b=this.rows[this.currRow];if(p.indent!==null){const v=p.indent,S=Math.max(v-1,0);b.setCursor(p.indent),p.color=b.chars[S].penState.foreground}const T={foreground:p.color,underline:p.underline,italics:p.italics,background:"black",flash:!1};this.setPen(T)}setBkgData(p){this.logger.log(2,(()=>"bkgData = "+JSON.stringify(p))),this.backSpace(),this.setPen(p),this.insertChar(32)}setRollUpRows(p){this.nrRollUpRows=p}rollUp(){if(this.nrRollUpRows===null)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const p=this.currRow+1-this.nrRollUpRows,m=this.rows.splice(p,1)[0];m.clear(),this.rows.splice(this.currRow,0,m),this.logger.log(2,"Rolling up")}getDisplayText(p){p=p||!1;const m=[];let b="",T=-1;for(let v=0;v<Ji;v++){const S=this.rows[v].getTextString();S&&(T=v+1,p?m.push("Row "+T+": '"+S+"'"):m.push(S.trim()))}return m.length>0&&(b=p?"["+m.join(" | ")+"]":m.join(`
|
|
59
|
+
`)),b}getTextAndFormat(){return this.rows}},Md=class{constructor(p,m,b=new ws){this.chNr=p,this.outputFilter=m,this.mode=null,this.displayedMemory=new Wo(b),this.nonDisplayedMemory=new Wo(b),this.lastOutputScreen=new Wo(b),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b,this.logger.log(2,"new Cea608Channel("+this.chNr+")")}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter?.reset?.(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(p){this.outputFilter=p}setPAC(p){this.writeScreen.setPAC(p)}setBkgData(p){this.writeScreen.setBkgData(p)}setMode(p){p!==this.mode&&(this.mode=p,this.logger.log(2,(()=>"MODE="+p)),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.setRollUpRows(null),this.nonDisplayedMemory.setRollUpRows(null)),this.mode=p)}insertChars(p){for(const b of p)this.writeScreen.insertChar(b);const m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(()=>m+": "+this.writeScreen.getDisplayText(!0))),this.mode!=="MODE_PAINT-ON"&&this.mode!=="MODE_ROLL-UP"||(this.logger.log(1,(()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0))),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(p){this.logger.log(2,"RU("+p+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(p)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const p=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=p,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(p){this.logger.log(2,"TO("+p+") - Tab Offset"),this.writeScreen.moveCursor(p)}ccMIDROW(p){const m={flash:!1};m.underline=p%2==1,m.italics=p>=46,m.italics?m.foreground="white":m.foreground=["white","green","blue","cyan","red","yellow","magenta"][Math.floor(p/2)-16],this.logger.log(2,"MIDROW: "+JSON.stringify(m)),this.writeScreen.setPen(m)}outputDataUpdate(p=!1){const m=this.logger.time;m!==null&&this.outputFilter&&(this.cueStartTime!==null||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,m,this.lastOutputScreen),p&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:m):this.cueStartTime=m,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(p){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,p,this.displayedMemory),this.cueStartTime=p))}};const zy=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];function By(p,m,b){return b.a===p&&b.b===m}function ea(p){const m=[];for(const b of p)m.push(b.toString(16));return m}const jy={17:2,18:4,21:6,22:8,23:10,19:13,20:15},qy={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Gy={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},$y={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14};function Rs(p,m,b){b.a=p,b.b=m}var Od=class{constructor(p,m,b){this.currentChannel=0,this.cmdHistory={a:null,b:null},this.lastTime=null;const T=this.logger=new ws;this.channels=[null,new Md(p,m,T),new Md(p+1,b,T)]}addData(p,m){this.lastTime=p,this.logger.time=p;for(let b=0;b<m.length;b+=2){const T=127&m[b],v=127&m[b+1];let S=!1,k=null;if(this.lastTime!==null&&(p=this.lastTime+.5*b*1001/3e4,this.logger.time=p),T===0&&v===0)continue;this.logger.log(3,(()=>"["+ea([m[b],m[b+1]])+"] -> ("+ea([T,v])+")"));const x=this.cmdHistory;if(T>=16&&T<=31){if(By(T,v,x)){Rs(null,null,x),this.logger.log(3,(()=>"Repeated command ("+ea([T,v])+") is dropped"));continue}Rs(T,v,this.cmdHistory),S=this.parseCmd(T,v),S||(S=this.parseMidrow(T,v)),S||(S=this.parsePAC(T,v)),S||(S=this.parseBackgroundAttributes(T,v))}else Rs(null,null,x);if(!S&&(k=this.parseChars(T,v),k.length)){const I=this.currentChannel;I&&I>0?this.channels[I].insertChars(k):this.logger.log(2,"No channel found yet. TEXT-MODE?")}S||k||this.logger.log(2,(()=>"Couldn't parse cleaned data "+ea([T,v])+" orig: "+ea([m[b],m[b+1]])))}}parseCmd(p,m){if(!((p===20||p===28||p===21||p===29)&&m>=32&&m<=47||(p===23||p===31)&&m>=33&&m<=35))return!1;const b=p===20||p===21||p===23?1:2,T=this.channels[b];return p===20||p===21||p===28||p===29?m===32?T.ccRCL():m===33?T.ccBS():m===34?T.ccAOF():m===35?T.ccAON():m===36?T.ccDER():m===37?T.ccRU(2):m===38?T.ccRU(3):m===39?T.ccRU(4):m===40?T.ccFON():m===41?T.ccRDC():m===42?T.ccTR():m===43?T.ccRTD():m===44?T.ccEDM():m===45?T.ccCR():m===46?T.ccENM():m===47&&T.ccEOC():T.ccTO(m-32),this.currentChannel=b,!0}parseMidrow(p,m){let b=0;if((p===17||p===25)&&m>=32&&m<=47){if(b=p===17?1:2,b!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const T=this.channels[b];return!!T&&(T.ccMIDROW(m),this.logger.log(3,(()=>"MIDROW ("+ea([p,m])+")")),!0)}return!1}parsePAC(p,m){let b;if(!((p>=17&&p<=23||p>=25&&p<=31)&&m>=64&&m<=127||(p===16||p===24)&&m>=64&&m<=95))return!1;const T=p<=23?1:2;b=m>=64&&m<=95?T===1?Gy[p]:$y[p]:T===1?jy[p]:qy[p];const v=this.channels[T];return!!v&&(v.setPAC(this.interpretPAC(b,m)),this.currentChannel=T,!0)}interpretPAC(p,m){let b;const T={color:null,italics:!1,indent:null,underline:!1,row:p};return b=m>95?m-96:m-64,T.underline=!(1&~b),b<=13?T.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(b/2)]:b<=15?(T.italics=!0,T.color="white"):T.indent=4*Math.floor((b-16)/2),T}parseChars(p,m){let b,T=[],v=null;if(p>=25?(b=2,v=p-8):(b=1,v=p),v>=17&&v<=19){let S;S=v===17?m+80:v===18?m+112:m+144,this.logger.log(2,(()=>"Special char '"+Nd(S)+"' in channel "+b)),T=[S]}else p>=32&&p<=127&&(T=m===0?[p]:[p,m]);return T&&this.logger.log(3,(()=>"Char codes = "+ea(T).join(","))),T}parseBackgroundAttributes(p,m){if(!((p===16||p===24)&&m>=32&&m<=47||(p===23||p===31)&&m>=45&&m<=47))return!1;let b;const T={};p===16||p===24?(b=Math.floor((m-32)/2),T.background=zy[b],m%2==1&&(T.background=T.background+"_semi")):m===45?T.background="transparent":(T.foreground="black",m===47&&(T.underline=!0));const v=p<=23?1:2;return this.channels[v].setBkgData(T),!0}reset(){for(let p=0;p<Object.keys(this.channels).length;p++){const m=this.channels[p];m&&m.reset()}Rs(null,null,this.cmdHistory)}cueSplitAtTime(p){for(const m of this.channels)m&&m.cueSplitAtTime(p)}};function Vy(p,m,b){const T=[];for(let v=m;v<b;v++)v+2<b&&p.getUint8(v)===0&&p.getUint8(v+1)===0&&p.getUint8(v+2)===3?(T.push(0),T.push(0),v+=2):T.push(p.getUint8(v));return new DataView(new Uint8Array(T).buffer)}function Hy(p,m,b,T){return!(p!==4||m<8)&&b.getUint8(T)===181&&b.getUint16(T+1)===49&&b.getUint32(T+3)===1195456820&&b.getUint8(T+7)===3}function Ky(p,m){return(127&p)>0||(127&m)>0}function Yy(p,m){let b=0;for(;b<p.byteLength;){let v,S=0,k=0;do S+=v=p.getUint8(b++);while(v===255);do k+=v=p.getUint8(b++);while(v===255);if(Hy(S,k,p,b)){const x=b+10,I=x+3*(31&p.getUint8(x-2));for(let N=x;N<I;N+=3){const O=p.getUint8(N);if(4&O){const A=3&O;if((T=A)===0||T===1){const R=p.getUint8(N+1),C=p.getUint8(N+2);Ky(R,C)&&m[A].push(R,C)}}}}b+=k}var T}function Wy(p,m,b){let T=0,v=0;const S=[[],[]];for(let k=m;k<m+b-5&&(T=p.getUint32(k),v=31&p.getUint8(k+4),!(k+5+T>m+b));k++)v===6&&k+5+T<=p.byteLength&&Yy(Vy(p,k+5,k+5+T),S),k+=T+3;return S}function Fd(p){const m=p.errHandler,b=p.manifestModel,T=p.mediaController,v=p.videoModel,S=p.textTracks,k=p.vttParser,x=p.vttCustomRenderingParser,I=p.ttmlParser,N=p.streamInfo,O=p.settings,A=this.context,R=(0,g.default)(A).getInstance();let C,B,$,V,j,te,ie,se,de,G,U,P,M,ge,X,be,fe,Te=!1;function Ce(){te=null,se=NaN,de=[],G=null,ie=!1,j=[],V=null}function Ie(me){const Se={};Se[ye.default.SUBTITLE]="subtitles",Se[ye.default.CAPTION]="captions",Se[ye.default.FORCED_SUBTITLE]="subtitles";const Re=new Py;for(let we in me)Re[we]=me[we];Re.defaultTrack=(function(we){let ze=!1;return P.length>1&&we.isEmbedded?ze=we.id&&we.id===h.default.CC1:P.length===1?we.id&&typeof we.id=="string"&&we.id.substring(0,2)==="CC"&&(ze=!0):P.length===0&&(ze=we.index===j[0].index),ze})(me),Re.isTTML=(function(we){return we.codec&&we.codec.search(h.default.STPP)>=0||we.mimeType&&we.mimeType.search(h.default.TTML)>=0})(me),Re.kind=(function(we,ze){let Ye=we.roles&&we.roles.length>0?ze[we.roles[0].value]:ze.caption;return Ye=Object.values(ze).includes(Ye)?Ye:ze.caption,Ye})(me,Se),S.addTextTrackInfo(Re)}function q(me){const Se=me.chunk;Se.representation.mediaInfo.embeddedCaptions&&re(Se.bytes,Se)}function W(me){U=me}function re(me,Se){const Re=Se.representation.mediaInfo,we=Re.type,ze=Re.mimeType,Ye=Re.codec||ze;Ye?Re.codec.indexOf("application/mp4")!==-1?(function(ct,bt,Zt){let vt,Qt;if(bt.segmentType==="InitializationSegment")ie=!0,se=$.getMediaTimescaleFromMoov(ct);else{if(!ie)return;Qt=$.getSamplesInfo(ct),vt=Qt.sampleList,vt.length>0&&(G=vt[0].cts-bt.start*se),Zt.search(h.default.STPP)>=0?(function(un,Rn,xn){let dn,vn;for(V=V!==null?V:le(xn),dn=0;dn<Rn.length;dn++){const qe=Rn[dn],pt=qe.cts,ft=ne(),_t=ft+pt/se,Yt=_t+qe.duration/se;C.buffered.add(_t,Yt);const En=new DataView(un,qe.offset,qe.subSizes[0]);let rt=Ga.Utils.dataViewToString(En,h.default.UTF8);const Tt=[];let Mt=qe.offset+qe.subSizes[0];for(vn=1;vn<qe.subSizes.length;vn++){const Fe=new Uint8Array(un,Mt,qe.subSizes[vn]),$e=String.fromCharCode.apply(null,Fe);Tt.push($e),Mt+=qe.subSizes[vn]}try{const Fe=b.getValue().ttmlTimeIsRelative?pt/se:0,$e=V.parse(rt,Fe,pt/se,(pt+qe.duration)/se,Tt);S.addCaptions(U,ft,$e)}catch(Fe){te.removeExecutedRequestsBeforeTime(),z(),B.error("TTML parser error: "+Fe)}}})(ct,vt,Zt):(function(un,Rn){let xn,dn,vn;const qe=[];for(xn=0;xn<Rn.length;xn++){const pt=Rn[xn];pt.cts-=G;const ft=ne()+pt.cts/se,_t=ft+pt.duration/se;C.buffered.add(ft,_t);const Yt=un.slice(pt.offset,pt.offset+pt.size),En=Ga.parseBuffer(Yt);for(dn=0;dn<En.boxes.length;dn++){const rt=En.boxes[dn];if(B.debug("VTT box1: "+rt.type),rt.type!=="vtte"&&rt.type==="vttc"){B.debug("VTT vttc boxes.length = "+rt.boxes.length);let Tt={styles:{}};for(vn=0;vn<rt.boxes.length;vn++){const Mt=rt.boxes[vn];if(B.debug("VTT box2: "+Mt.type),Mt.type==="payl")Tt.start=pt.cts/se,Tt.end=(pt.cts+pt.duration)/se,Tt.data=Mt.cue_text;else if(Mt.type==="sttg"&&Mt.settings&&Mt.settings!=="")try{const Fe=Mt.settings.split(" ");Tt.styles=k.getCaptionStyles(Fe)}catch{}}Tt&&Tt.data&&(qe.push(Tt),B.debug(`VTT ${Tt.start} - ${Tt.end} : ${Tt.data}`))}}}qe.length>0&&S.addCaptions(U,0,qe)})(ct,vt)}})(me,Se,Ye):we===h.default.VIDEO?(function(ct,bt){let Zt,vt;if(bt.segmentType===ke.HTTPRequest.INIT_SEGMENT_TYPE)M===0&&(M=$.getMediaTimescaleFromMoov(ct));else if(bt.segmentType===ke.HTTPRequest.MEDIA_SEGMENT_TYPE){if(M===0)return void B.warn("CEA-608: No timescale for embeddedTextTrack yet");vt=$.getSamplesInfo(ct);const Qt=vt.lastSequenceNumber,un=Math.trunc(bt.start),Rn=Math.trunc(bt.end);if(be[0]||be[1]||(function(){let xn;for(let dn=0;dn<P.length;dn++){if(xn=S.getTrackIdxForId(P[dn].id),xn===-1)return void B.warn("CEA-608: data before track is ready.");const vn=ee(xn);be[dn]=new Od(dn+1,{newCue:vn},null)}})(),M){if((function(dn,vn,qe,pt,ft){return dn!==null&&vn!==null&&pt!==null&&ft!==null&&(vn===dn?pt!==ft:vn!==dn+qe)})(ge,Qt,vt.numSequences,X,un))for(Zt=0;Zt<be.length;Zt++)be[Zt]&&be[Zt].reset();const xn=(function(dn,vn){if(vn.length===0)return null;const qe={splits:[],fields:[[],[]]},pt=new DataView(dn);for(let ft=0;ft<vn.length;ft++){const _t=vn[ft],Yt=Wy(pt,_t.offset,_t.size);let En=null,rt=0;for(let Tt=0;Tt<2;Tt++)if(Yt[Tt].length>0){_t.cts!==En?rt=0:rt+=1;const Mt=ne();qe.fields[Tt].push([_t.cts+Mt*M,Yt[Tt],rt]),En=_t.cts}}return qe.fields.forEach((function(ft){ft.sort((function(_t,Yt){return _t[0]===Yt[0]?_t[2]-Yt[2]:_t[0]-Yt[0]}))})),qe})(ct,vt.sampleList);for(let dn=0;dn<be.length;dn++){const vn=xn.fields[dn],qe=be[dn];if(qe)for(Zt=0;Zt<vn.length;Zt++)qe.addData(vn[Zt][0]/M,vn[Zt][1])}ge=Qt,X=Rn}}})(me,Se):(function(ct,bt,Zt){let vt,Qt;const un=new DataView(ct,0,ct.byteLength);Qt=Ga.Utils.dataViewToString(un,h.default.UTF8);try{vt=le(Zt).parse(Qt,0),S.addCaptions(S.getCurrentTrackIdx(),0,vt),C.buffered&&C.buffered.add(bt.start,bt.end)}catch(Rn){m.error(new Wt.default(Jt.TIMED_TEXT_ERROR_ID_PARSE_CODE,Jt.TIMED_TEXT_ERROR_MESSAGE_PARSE+Rn.message,Qt))}})(me,Se,Ye):B.error("No text type defined")}function ee(me){return function(Se,Re,we){let ze;ze=v.getTTMLRenderingDiv()?fe.createHTMLCaptionsFromScreen(v.getElement(),Se,Re,we):[{start:Se,end:Re,data:we.getDisplayText(),styles:{}}],ze&&S.addCaptions(me,0,ze)}}function ne(){return isNaN(C.timestampOffset)?0:C.timestampOffset}function le(me){let Se;return me.search(h.default.VTT)>=0?Se=O.get().streaming.text.webvtt.customRenderingEnabled&&x?x:k:(me.search(h.default.TTML)>=0||me.search(h.default.STPP)>=0)&&(Se=I),Se}function z(me,Se){me===void 0&&me===Se&&(me=C.buffered.start(0),Se=C.buffered.end(C.buffered.length-1)),C.buffered.remove(me,Se),S.deleteCuesFromTrackIdx(U,me,Se)}function ce(me){P.forEach((function(Se){const Re=S.getTrackIdxForId(Se.id);Re>=0&&S.deleteCuesFromTrackIdx(Re,me.from,me.to)}))}return C={initialize:function(){Te||(P=[],U=null,M=0,be=[],ge=null,X=null,Te=!0,fe=My(A).getInstance(),R.on(f.default.VIDEO_CHUNK_RECEIVED,q,C),R.on(f.default.BUFFER_CLEARED,ce,C))},addMediaInfos:function(me,Se,Re){if(j=j.concat(Se),me===h.default.TEXT&&Se[0].isFragmented&&!Se[0].isEmbedded){te=Re,C.buffered=(0,Ny.default)(A).create(),de=T.getTracksFor(h.default.TEXT,N.id).filter((ze=>ze.isFragmented));const we=T.getCurrentTrackFor(h.default.TEXT,N.id);for(let ze=0;ze<de.length;ze++)if(de[ze]===we){W(ze);break}}for(let we=0;we<Se.length;we++)Ie(Se[we])},resetMediaInfos:function(){j=[]},getStreamId:function(){return N.id},append:re,abort:function(){},addEmbeddedTrack:function(me){if(Te&&me)if(me.id===h.default.CC1||me.id===h.default.CC3){for(let Se=0;Se<P.length;Se++)if(P[Se].id===me.id)return;P.push(me)}else B.warn("Embedded track "+me.id+" not supported!")},resetEmbedded:function(){R.off(f.default.VIDEO_CHUNK_RECEIVED,q,C),R.off(f.default.BUFFER_CLEARED,ce,C),S&&S.deleteAllTextTracks(),Te=!1,P=[],be=[null,null],ge=null,X=null},getConfig:function(){return{fragmentModel:te,fragmentedTracks:de,videoModel:v}},setCurrentFragmentedTrackIdx:W,remove:z,reset:function(){Ce(),j=[],$=null}},B=(0,o.default)(A).getInstance().getLogger(C),$=bs(A).getInstance(),Ce(),C}Fd.__dashjs_factory_name="TextSourceBuffer";var Xy=n.default.getClassFactory(Fd);class Qy{constructor(){this.root=null,this.size=0}addCue(m){const b={start:m.startTime,end:m.endTime,cue:m,maxEnd:m.endTime,left:null,right:null,height:1},[T,v]=this._insert(b,this.root);this.root=T,v&&this.size++}removeCue(m){const[b,T]=this._remove(m,this.root);return this.root=b,T&&this.size--,T}findCuesInRange(m,b){const T=[];return this._searchRange(this.root,m,b,T),T}findCuesAtTime(m){return this.findCuesInRange(m,m)}getAllCues(){const m=[];return this._inorderTraversal(this.root,m),m}getSize(){return this.size}clear(){this.root=null,this.size=0}_compareCues(m,b){return m.startTime!==b.startTime?m.startTime-b.startTime:m.endTime!==b.endTime?m.endTime-b.endTime:typeof VTTCue<"u"&&m instanceof VTTCue&&b instanceof VTTCue||m.text&&b.text?m.text.localeCompare(b.text):0}_compareIntervals(m,b){return this._compareCues(m.cue,b.cue)}_insert(m,b){if(!b)return[m,!0];const T=this._compareIntervals(m,b);if(T<0){const[S]=this._insert(m,b.left);b.left=S}else{if(!(T>0))return[b,!1];{const[S]=this._insert(m,b.right);b.right=S}}b.height=1+Math.max(this._getHeight(b.left),this._getHeight(b.right)),b.maxEnd=Math.max(b.maxEnd,m.maxEnd);const v=this._getBalance(b);return v>1?(this._compareIntervals(m,b.left)<0||(b.left=this._leftRotate(b.left)),[this._rightRotate(b),!0]):v<-1?(this._compareIntervals(m,b.right)>0||(b.right=this._rightRotate(b.right)),[this._leftRotate(b),!0]):[b,!0]}_searchRange(m,b,T,v){m&&(this._overlaps(m,b,T)&&v.push(m.cue),m.left&&m.left.maxEnd>=b&&this._searchRange(m.left,b,T,v),m.right&&m.start<=T&&this._searchRange(m.right,b,T,v))}_inorderTraversal(m,b){m&&(this._inorderTraversal(m.left,b),b.push(m.cue),this._inorderTraversal(m.right,b))}_overlaps(m,b,T){if(T===b){const v=b;return m.start<=v&&v<m.end}return m.start<T&&b<m.end}_getHeight(m){return m?m.height:0}_getBalance(m){return m?this._getHeight(m.left)-this._getHeight(m.right):0}_leftRotate(m){const b=m.right,T=b.left;return b.left=m,m.right=T,m.height=1+Math.max(this._getHeight(m.left),this._getHeight(m.right)),b.height=1+Math.max(this._getHeight(b.left),this._getHeight(b.right)),m.maxEnd=Math.max(m.end,m.left?m.left.maxEnd:0,m.right?m.right.maxEnd:0),b.maxEnd=Math.max(b.end,b.left?b.left.maxEnd:0,b.right?b.right.maxEnd:0),b}_rightRotate(m){const b=m.left,T=b.right;return b.right=m,m.left=T,m.height=1+Math.max(this._getHeight(m.left),this._getHeight(m.right)),b.height=1+Math.max(this._getHeight(b.left),this._getHeight(b.right)),m.maxEnd=Math.max(m.end,m.left?m.left.maxEnd:0,m.right?m.right.maxEnd:0),b.maxEnd=Math.max(b.end,b.left?b.left.maxEnd:0,b.right?b.right.maxEnd:0),b}_remove(m,b){if(!b)return[null,!1];const T=this._compareCues(m,b.cue);if(T<0){const[v,S]=this._remove(m,b.left);return b.left=v,S&&this._updateNode(b),[b,S]}if(T>0){const[v,S]=this._remove(m,b.right);return b.right=v,S&&this._updateNode(b),[b,S]}if(b.left||b.right){if(b.left){if(b.right){const v=this._findMin(b.right);b.cue=v.cue,b.start=v.start,b.end=v.end;const[S]=this._remove(v.cue,b.right);return b.right=S,this._updateNode(b),[b,!0]}return[b.left,!0]}return[b.right,!0]}return[null,!0]}_findMin(m){for(;m.left;)m=m.left;return m}_updateNode(m){m.height=1+Math.max(this._getHeight(m.left),this._getHeight(m.right)),m.maxEnd=Math.max(m.end,m.left?m.left.maxEnd:0,m.right?m.right.maxEnd:0)}}var Xo=t(7640);const Ud=["text","align","fontSize","id","isd","line","lineAlign","lineHeight","linePadding","position","positionAlign","region","size","snapToLines","vertical"];function zd(p){const m=this.context,b=(0,g.default)(m).getInstance(),T=p.videoModel,v=p.streamInfo,S=p.settings;let k,x,I,N,O,A,R,C,B,$,V,j,te,ie,se,de,G,U,P,M;const ge=new Map;function X(qe){const pt=qe.kind,ft=qe.id!==void 0?qe.id:qe.lang,_t=qe.lang,Yt=qe.isTTML,En=qe.isEmbedded;return T.addTextTrack(pt,ft,_t,Yt,En)}function be(qe,pt,ft,_t,Yt,En){let rt=0,Tt=0;qe/pt>ft/_t?(Tt=pt,rt=Tt/_t*ft):(rt=qe,Tt=rt/ft*_t);let Mt=0,Fe=0,$e=0,yt=0;return rt/Tt>Yt?(yt=Tt,$e=Tt*Yt):($e=rt,yt=rt/Yt),Mt=(qe-$e)/2,Fe=(pt-yt)/2,En?{x:Mt+.1*$e,y:Fe+.1*yt,w:.8*$e,h:.8*yt}:{x:Mt,y:Fe,w:$e,h:yt}}function fe(qe,pt){const ft=T.getClientWidth(),_t=T.getClientHeight(),Yt=T.getVideoWidth(),En=T.getVideoHeight(),rt=T.getVideoRelativeOffsetTop(),Tt=T.getVideoRelativeOffsetLeft();if(Yt!==0&&En!==0){let Mt=Yt/En,Fe=!1;qe.isFromCEA608&&(Mt=3.5/3,Fe=!0);const $e=be.call(this,ft,_t,Yt,En,Mt,Fe),yt=$e.w,Ke=$e.h,It=$e.x,Ct=$e.y;if(yt!=B||Ke!=$||It!=R||Ct!=C||pt){if(R=It+Tt,C=Ct+rt,B=yt,$=Ke,V){const Qe=V.style;Qe&&(Qe.left=R+"px",Qe.top=C+"px",Qe.width=B+"px",Qe.height=$+"px",Qe.zIndex=ie&&document[ie]||se?G:null,b.trigger(y.default.CAPTION_CONTAINER_RESIZE))}const _e=qe.activeCues;if(_e){const Qe=_e.length;for(let Lt=0;Lt<Qe;++Lt){const Dt=_e[Lt];Dt.scaleCue(Dt)}}}}}function Te(qe){const pt=B,ft=$;let _t,Yt,En,rt,Tt;if(qe.cellResolution){const Mt=[pt/qe.cellResolution[0],ft/qe.cellResolution[1]];if(qe.linePadding){for(_t in qe.linePadding)if(qe.linePadding.hasOwnProperty(_t)){Yt=(qe.linePadding[_t]*Mt[0]).toString();const Fe=document.getElementsByClassName("spanPadding");for(let $e=0;$e<Fe.length;$e++)Fe[$e].style.cssText=Fe[$e].style.cssText.replace(/(padding-left\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+Yt),Fe[$e].style.cssText=Fe[$e].style.cssText.replace(/(padding-right\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+Yt)}}if(qe.fontSize){for(_t in qe.fontSize)if(qe.fontSize.hasOwnProperty(_t)){qe.fontSize[_t][0]==="%"?En=qe.fontSize[_t][1]/100:qe.fontSize[_t][0]==="c"&&(En=qe.fontSize[_t][1]),Yt=(En*Mt[1]).toString(),Tt=_t!=="defaultFontSize"?document.getElementsByClassName(_t):document.getElementsByClassName("paragraph");for(let Fe=0;Fe<Tt.length;Fe++)Tt[Fe].style.cssText=Tt[Fe].style.cssText.replace(/(font-size\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+Yt)}if(qe.lineHeight){for(_t in qe.lineHeight)if(qe.lineHeight.hasOwnProperty(_t)){qe.lineHeight[_t][0]==="%"?rt=qe.lineHeight[_t][1]/100:qe.fontSize[_t][0]==="c"&&(rt=qe.lineHeight[_t][1]),Yt=(rt*Mt[1]).toString(),Tt=document.getElementsByClassName(_t);for(let Fe=0;Fe<Tt.length;Fe++)Tt[Fe].style.cssText=Tt[Fe].style.cssText.replace(/(line-height\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+Yt)}}}}if(qe.isd){let Mt=document.getElementById(qe.cueID);Mt&&V.removeChild(Mt),Ie(qe)}}function Ce(qe,pt){const ft=/^(urn:)(mpeg:[a-z0-9][a-z0-9-]{0,31}:)(subs:)([0-9]+)$/,_t=/^#(.*)$/;if(ft.test(pt)){const Yt=ft.exec(pt),En=parseInt(Yt[4],10)-1;return"data:image/png;base64,"+btoa(qe.images[En])}if(_t.test(pt)){const Yt=_t.exec(pt)[1];return"data:image/png;base64,"+qe.embeddedImages[Yt]}return pt}function Ie(qe){if(V){dn.call(this);const pt=document.createElement("div");V.appendChild(pt),de=(0,Xo.renderHTML)(qe.isd,pt,(function(ft){return Ce(qe,ft)}),V.clientHeight,V.clientWidth,S.get().streaming.text.imsc.displayForcedOnlyMode,(function(ft){x.info("renderCaption :",ft)}),de,S.get().streaming.text.imsc.enableRollUp),pt.id=qe.cueID,b.trigger(y.default.CAPTION_RENDERED,{captionDiv:pt,currentTrackIdx:A})}}function q(qe,pt){const ft=pt.findCuesInRange(qe.startTime-.1,qe.endTime+.1);for(const _t of ft)if(W(qe,_t)&&re(qe,_t,Ud)||W(_t,qe)&&re(qe,_t,Ud))return _t;return null}function W(qe,pt){return!!pt&&pt.endTime>=qe.startTime}function re(qe,pt,ft){for(let _t=0;_t<ft.length;_t++){const Yt=ft[_t];if(JSON.stringify(qe[Yt])!==JSON.stringify(pt[Yt]))return!1}return!0}function ee(qe,pt){pt&&pt.forEach((ft=>{ft.kind&&ft.kind==="image"&&(ft.src=Ce(qe,ft.src)),ee(qe,ft.contents)}))}function ne(qe,pt,ft){const _t=ct(qe),Yt=ge.get(_t),En=S.get().streaming.text.dispatchForManualRendering;if(_t&&Yt&&Array.isArray(ft)&&ft.length!==0){for(let Mt=0;Mt<ft.length;Mt++){let Fe=null;const $e=ft[Mt];if(_t.cellResolution=$e.cellResolution,_t.isFromCEA608=$e.isFromCEA608,isNaN($e.start)||isNaN($e.end)||(En?Fe=le($e,pt):Re($e)&&V?Fe=me($e,pt,_t):$e.data&&(Fe=Se($e,pt,_t))),Fe){if(S.get().streaming.text.extendSegmentedCues){const yt=q(Fe,Yt.allCues);yt&&(Yt.allCues.removeCue(yt),Tt=Fe,(rt=yt).startTime=Math.min(rt.startTime,Tt.startTime),rt.endTime=Math.max(rt.endTime,Tt.endTime),Fe=rt)}Yt.allCues.addCue(Fe)}else x.error("Impossible to display subtitles. You might have missed setting a TTML rendering div via player.attachTTMLRenderingDiv(TTMLRenderingDiv)")}var rt,Tt;un()}}function le(qe,pt){let ft=we(qe,pt);return ft.onenter=function(){Re(qe)&&M&&M.cueID!==ft.cueID&&ce(M),delete ft.type,M=ft,z(ft)},ft.onexit=function(){ce(ft),M=null},ft}function z(qe){b.trigger(y.default.CUE_ENTER,qe)}function ce(qe){b.trigger(y.default.CUE_EXIT,{cueID:qe.cueID})}function me(qe,pt,ft){const _t=this;let Yt=we(qe,pt);return V.style.left=R+"px",V.style.top=C+"px",V.style.width=B+"px",V.style.height=$+"px",Yt.onenter=function(){ft.mode===h.default.TEXT_SHOWING&&(this.isd?(P?requestAnimationFrame((()=>Ie(this))):Ie(this),x.debug("Cue enter id:"+this.cueID)):(V.appendChild(this.cueHTMLElement),Te.call(_t,this),b.trigger(y.default.CAPTION_RENDERED,{captionDiv:this.cueHTMLElement,currentTrackIdx:A})))},Yt.onexit=function(){if(V){const En=V.childNodes;for(let rt=0;rt<En.length;++rt)En[rt].id===this.cueID&&(x.debug("Cue exit id:"+En[rt].id),V.removeChild(En[rt]),--rt)}},Yt}function Se(qe,pt,ft){let _t=we(qe,pt);if(qe.styles)try{qe.styles.align!==void 0&&"align"in _t&&(_t.align=qe.styles.align),qe.styles.line!==void 0&&"line"in _t&&(_t.line=qe.styles.line),qe.styles.lineAlign!==void 0&&(_t.lineAlign=qe.styles.lineAlign),qe.styles.snapToLines!==void 0&&"snapToLines"in _t&&(_t.snapToLines=qe.styles.snapToLines),qe.styles.position!==void 0&&"position"in _t&&(_t.position=qe.styles.position),qe.styles.positionAlign!==void 0&&(_t.positionAlign=qe.styles.positionAlign),qe.styles.size!==void 0&&"size"in _t&&(_t.size=qe.styles.size)}catch(Yt){x.error(Yt)}return _t.onenter=function(){ft.mode===h.default.TEXT_SHOWING&&b.trigger(y.default.CAPTION_RENDERED,{currentTrackIdx:A})},_t}function Re(qe){return qe.type==="html"}function we(qe,pt){return Re(qe)?(function(ft,_t){let Yt=new I(ft.start+_t,ft.end+_t,"");return Yt.cueHTMLElement=ft.cueHTMLElement,Yt.isd=ft.isd,Yt.images=ft.images,Yt.embeddedImages=ft.embeddedImages,Yt.cueID=ft.cueID,Yt.scaleCue=Te.bind(self),Yt.cellResolution=ft.cellResolution,Yt.lineHeight=ft.lineHeight,Yt.linePadding=ft.linePadding,Yt.fontSize=ft.fontSize,Yt.isd&&ee(Yt,Yt.isd.contents),Yt})(qe,pt):(function(ft,_t){let Yt=new I(ft.start-_t,ft.end-_t,ft.data);return Yt.cueID=Je.default.generateUuid(),Yt})(qe,pt)}function ze(qe){if(j){const pt=j.childNodes;for(let ft=0;ft<pt.length;++ft)pt[ft].id===qe.cueID&&(j.removeChild(pt[ft]),--ft)}}function Ye(){const qe=T.getTextTracks(),pt=[];for(const ft of qe)ft.manualMode===h.default.TEXT_SHOWING&&pt.push(ft);return pt}function ct(qe){return qe>=0&&N[qe]?T.getTextTrack(N[qe].kind,N[qe].id,N[qe].lang,N[qe].isTTML,N[qe].isEmbedded):null}function bt(qe){if(qe===A)return;A=qe;const pt=ct(A);Zt.call(this,pt),te&&(clearInterval(te),te=null),pt&&pt.renderingType==="html"&&(fe.call(this,pt,!0),window.ResizeObserver?(U=new window.ResizeObserver((()=>{fe.call(this,pt,!0)})),U.observe(T.getElement())):te=setInterval(fe.bind(this,pt),500))}function Zt(qe){dn.call(this),qe&&qe.renderingType==="html"?Rn.call(this):xn.call(this)}function vt(qe,pt,ft,_t=!0){return!!qe&&(isNaN(pt)||(_t?qe.startTime:qe.endTime)>=pt)&&(isNaN(ft)||(_t?qe.endTime:qe.startTime)<=ft)}function Qt(qe,pt,ft,_t=!0){if(!qe)return;if(qe.cues&&qe.cues.length>0)for(let En=qe.cues.length-1;En>=0;En--)vt(qe.cues[En],pt,ft,_t)&&(qe.cues[En].onexit&&qe.cues[En].onexit(),qe.removeCue(qe.cues[En]));const Yt=ge.get(qe);if(Yt){const En=Yt.activeCues,rt=En.filter((Tt=>Tt.startTime>=pt&&Tt.endTime<=ft));rt.forEach((Tt=>{S.get().streaming.text.dispatchForManualRendering?ce(Tt):ze(Tt)})),Yt.activeCues=En.filter((Tt=>!rt.includes(Tt)))}}function un(){for(const qe of ge.values())qe.lastCueWindowUpdate=-1/0}function Rn(){let qe=document.getElementById("native-cue-style");if(qe)return;qe=document.createElement("style"),qe.id="native-cue-style",document.head.appendChild(qe);const pt=qe.sheet,ft=T.getElement();try{ft&&(ft.id?pt.insertRule("#"+ft.id+"::cue {background: transparent}",0):ft.classList.length!==0?pt.insertRule("."+ft.className+"::cue {background: transparent}",0):pt.insertRule("video::cue {background: transparent}",0))}catch(_t){x.info(""+_t.message)}}function xn(){const qe=document.getElementById("native-cue-style");qe&&document.head.removeChild(qe)}function dn(){if(V)for(;V.firstChild;)V.removeChild(V.firstChild)}function vn(){return N}return k={addCaptions:ne,addTextTrackInfo:function(qe){N.push(qe)},createTracks:function(){N.sort((function(pt,ft){return pt.index-ft.index})),V=T.getTTMLRenderingDiv(),j=T.getVttRenderingDiv();let qe=-1;for(let pt=0;pt<N.length;pt++){const ft=X(N[pt]);O.push(ft),N[pt].defaultTrack&&(ft.default=!0,qe=pt);const _t=ct(pt);_t&&(_t.mode=h.default.TEXT_SHOWING,V&&(N[pt].isTTML||N[pt].isEmbedded)?_t.renderingType="html":_t.renderingType="default",ge.set(_t,{allCues:new Qy,lastCueWindowUpdate:-1/0,activeCues:[]})),ne(pt,0,N[pt].captionData),b.trigger(y.default.TEXT_TRACK_ADDED)}if(bt.call(this,qe),qe>=0){let pt=function(){const ft=ct(qe);ft&&ft.renderingType==="html"&&fe.call(this,ft,!0),b.off(y.default.PLAYBACK_METADATA_LOADED,pt,this)};b.on(y.default.PLAYBACK_METADATA_LOADED,pt,this);for(let ft=0;ft<N.length;ft++){const _t=ct(ft);if(_t){const Yt=S.get().streaming.text.dispatchForManualRendering;_t.mode=ft!==qe||Yt?h.default.TEXT_HIDDEN:h.default.TEXT_SHOWING,_t.manualMode=ft===qe?h.default.TEXT_SHOWING:h.default.TEXT_HIDDEN}}}b.trigger(f.default.TEXT_TRACKS_QUEUE_INITIALIZED,{index:A,tracks:N,streamId:v.id})},deleteAllTextTracks:function(){const qe=O?O.length:0;for(let pt=0;pt<qe;pt++){const ft=ct(pt);ft&&Qt.call(this,ft,v.start,v.start+v.duration,!1)}O=[],N=[],te&&(clearInterval(te),te=null),U&&T&&(U.unobserve(T.getElement()),U=null),A=-1,dn.call(this),ge.clear()},deleteCuesFromTrackIdx:function(qe,pt,ft){const _t=ct(qe);_t&&Qt(_t,pt,ft)},disableManualTracks:function(){const qe=Ye();if(qe&&qe.length>0){const pt=qe[0],ft=ge.get(pt);if(!ft)return;ft.activeCues.forEach((_t=>{S.get().streaming.text.dispatchForManualRendering?ce(_t):ze(_t)})),ft.activeCues=[]}},getCurrentTrackIdx:function(){return A},getCurrentTextTrackInfo:function(){return N[A]},getStreamId:function(){return v.id},getTextTrackInfos:vn,getTrackIdxForId:function(qe){let pt=-1;for(let ft=0;ft<N.length;ft++)if(N[ft].id===qe){pt=ft;break}return pt},initialize:function(){typeof window<"u"&&typeof navigator<"u"&&(I=window.VTTCue||window.TextTrackCue,N=[],O=[],A=-1,R=0,C=0,B=0,$=0,V=null,j=null,te=null,se=!1,G=2147483647,de=null,P="requestAnimationFrame"in window,ge.clear(),document.fullscreenElement!==void 0?ie="fullscreenElement":document.webkitIsFullScreen!==void 0?ie="webkitIsFullScreen":document.msFullscreenElement?ie="msFullscreenElement":document.mozFullScreen&&(ie="mozFullScreen"))},manualCueProcessing:function(qe){const pt=Ye();if(pt&&pt.length>0){const ft=pt[0],_t=ge.get(ft);if(!_t)return;const Yt=_t.activeCues,En=_t.allCues.findCuesAtTime(qe),rt=Yt.filter((Mt=>!En.includes(Mt))),Tt=En.filter((Mt=>!Yt.includes(Mt)));rt.forEach((Mt=>{S.get().streaming.text.dispatchForManualRendering?ce(Mt):ze(Mt)})),Tt.forEach((Mt=>{S.get().streaming.text.dispatchForManualRendering?z(Mt):WebVTT.processCues(window,[Mt],j,Mt.cueID)})),_t.activeCues=En}},setCurrentTrackIdx:bt,setModeForTrackIdx:function(qe,pt){const ft=ct(qe);ft&&ft.mode!==pt&&(ft.mode=pt),ft&&ft.manualMode!==pt&&(ft.manualMode=pt)},updateTextTrackWindow:function(qe,pt=!1){const ft=vn(),_t=S.get().streaming.text.webvtt.customRenderingEnabled;for(let Yt=0;Yt<ft.length;Yt++){const En=ft[Yt],rt=ct(Yt),Tt=ge.get(rt);if(!rt||!Tt||!En.isEmbedded&&_t)continue;const{bufferToKeep:Mt,bufferPruningInterval:Fe}=S.get().streaming.buffer,$e=Date.now();if(($e-Tt.lastCueWindowUpdate)/1e3<Fe&&!pt)continue;const yt=T.getPlaybackRate()||1,Ke=Math.max(0,qe-Mt/yt),It=qe+2*Fe/yt;if(rt.cues)for(;rt.cues.length>0;)rt.removeCue(rt.cues[0]);rt.mode!==h.default.TEXT_DISABLED&&Tt.allCues.findCuesInRange(Ke,It).forEach((Ct=>{rt.addCue(Ct)})),Tt.lastCueWindowUpdate=$e}},invalidateCueWindow:un},x=(0,o.default)(m).getInstance().getLogger(k),k}zd.__dashjs_factory_name="TextTracks";var Zy=n.default.getClassFactory(zd);function Bd(){const p=this.context;let m,b,T,v,S,k;function x(A){const R=A.split(":"),C=R.length-1;return A=60*parseInt(R[C-1],10)+parseFloat(R[C]),C===2&&(A+=3600*parseInt(R[0],10)),A}function I(A){const R=A.split(v),C=R[1].split(k);return C.shift(),R[1]=C[0],C.shift(),{cuePoints:R,styles:N(C)}}function N(A){const R={};return A.forEach((function(C){const B=C.split(":");if(B.length>1){const[$,V]=B;switch($){case"align":case"A":R.align=V;break;case"line":case"L":const[j,te]=V.split(","),ie=j.endsWith("%");R.line=j==="auto"?j:parseInt(j,10),ie&&(R.snapToLines=!1),te&&(R.lineAlign=te);break;case"position":case"P":const[se,de]=V.split(",");R.position=parseInt(se,10),de&&(R.positionAlign=de);break;case"size":case"S":R.size=parseInt(V,10)}}})),R}function O(A,R){let C,B=R,$="",V="";for(;A[B]!==""&&B<A.length;)B++;if(C=B-R,C>1)for(let j=0;j<C;j++){if(V=A[R+j],V.match(v)){$="";break}$+=V,j!==C-1&&($+=`
|
|
60
|
+
`)}else V=A[R],V.match(v)||($=V);return $}return m={parse:function(A){const R=[];let C,B;if(!A)return R;C=(A=A.split(T)).length,B=-1;for(let $=0;$<C;$++){let V=A[$];if(V.length>0&&V!=="WEBVTT"&&V.match(v)){const j=I(V),te=j.cuePoints,ie=j.styles,se=O(A,$+1),de=x(te[0].replace(S,"")),G=x(te[1].replace(S,""));!isNaN(de)&&!isNaN(G)&&de>=B&&G>de?se!==""?(B=de,R.push({start:de,end:G,data:se,styles:ie})):b.error("Skipping cue due to empty/malformed cue text"):b.error("Skipping cue due to incorrect cue timing")}}return R},getCaptionStyles:N},b=(0,o.default)(p).getInstance().getLogger(m),T=/(?:\r\n|\r|\n)/gm,v=/-->/,S=/(^[\s]+|[\s]+$)/g,k=/\s\b/g,m}Bd.__dashjs_factory_name="VTTParser";var Jy=n.default.getSingletonFactory(Bd);function jd(){let p,m;return p={parse:function(b){let T=[];return m.oncue=function(v){v.start=v.startTime,v.end=v.endTime,v.data=v.text,v.styles={align:v.align,line:v.line,position:v.position,size:v.size},T.push(v)},m.parse(b),T}},(function(){try{window&&window.WebVTT&&window.WebVTT.Parser&&(m=new window.WebVTT.Parser(window,window.vttjs,window.WebVTT.StringDecoder()))}catch{}})(),p}jd.__dashjs_factory_name="VttCustomRenderingParser";var eE=n.default.getSingletonFactory(jd);function qd(){const p=this.context,m=(0,g.default)(p).getInstance();let b,T,v=0;function S(){const k="cue_TTML_"+v;return v++,k}return b={parse:function(k,x,I,N,O){let A="";const R=[];let C,B,$;const V={},j={};let te="",ie="",se={onOpenTag:function(U,P,M){if(M[" imagetype"]&&!M[" imageType"]&&(m.trigger(y.default.CONFORMANCE_VIOLATION,{level:ma.LEVELS.ERROR,event:ma.EVENTS.NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE}),M[" imageType"]=M[" imagetype"]),P==="image"&&(U==="http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt"||U==="http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt")){if(!M[" imageType"]||M[" imageType"].value!=="PNG")return void T.warn("smpte-tt imageType != PNG. Discarded");te=M["http://www.w3.org/XML/1998/namespace id"].value}},onCloseTag:function(){te&&(j[te]=ie.trim()),ie="",te=""},onText:function(U){te&&(ie+=U)}};if(!k)throw A="no ttml data to parse",new Error(A);V.data=k,m.trigger(f.default.TTML_TO_PARSE,V);let de=(0,Xo.fromXML)(V.data,(function(U){A=U}),se);m.trigger(f.default.TTML_PARSED,{ttmlString:V.data,ttmlDoc:de});const G=de.getMediaTimeEvents();for($=0;$<G.length;$++){let U=(0,Xo.generateISD)(de,G[$],(function(P){A=P}));U.contents.some((P=>P.contents.length))&&(C=G[$]+x,B=G[$+1]+x,C<B&&R.push({start:C,end:B,type:"html",cueID:S(),isd:U,images:O,embeddedImages:j}))}if(A!=="")throw T.error(A),new Error(A);return R}},T=(0,o.default)(p).getInstance().getLogger(b),b}qd.__dashjs_factory_name="TTMLParser";var tE=n.default.getSingletonFactory(qd);function Gd(p){let m=this.context;const b=(0,g.default)(m).getInstance(),T=Vn(m).getInstance(),v=p.adapter,S=p.baseURLController,k="error",x="loaded",I="unloaded";let N,O,A;function R($,V){let j,te,ie=!1;if(S.resolve()){const G=v.getVoRepresentations($);G&&G.length>0&&(j=S.resolve(G[0].path).url)}const se=$.essentialProperties.filter((G=>G.schemeIdUri&&G.schemeIdUri===h.default.FONT_DOWNLOAD_DVB_SCHEME)),de=$.supplementalProperties.filter((G=>G.schemeIdUri&&G.schemeIdUri===h.default.FONT_DOWNLOAD_DVB_SCHEME));se.length>0?(ie=!0,te=se):te=de,te.forEach((G=>{if((function(M){return!(!(M.value&&parseInt(M.value)===1&&M.dvbUrl&&M.dvbUrl.length>0&&M.dvbFontFamily&&M.dvbFontFamily.length>0&&M.dvbMimeType)||M.dvbMimeType!==h.default.OFF_MIMETYPE&&M.dvbMimeType!==h.default.WOFF_MIMETYPE)})(G)){let M=(U=G.dvbUrl,P=j,T.isPathAbsolute(U)?U:T.isRelative(U)?P?T.resolve(U,P):T.resolve(U):U);A.push({fontFamily:G.dvbFontFamily,url:M,mimeType:G.dvbMimeType,trackId:$.id,streamId:V,isEssential:ie,status:I,fontFace:new FontFace(G.dvbFontFamily,`url(${M})`,{display:"swap"})})}var U,P}))}function C($,V){const j=A[$];A[$]={...j,status:V}}function B(){A=[]}return N={addFontsFromTracks:function($,V){if($&&Array.isArray($)&&V)for(let j=0;j<$.length;j++)R($[j],V)},downloadFonts:function(){for(let $=0;$<A.length;$++){let V=A[$];document.fonts.add(V.fontFace),b.trigger(y.default.DVB_FONT_DOWNLOAD_ADDED,V),V.fontFace.load().then((()=>{C($,x),b.trigger(y.default.DVB_FONT_DOWNLOAD_COMPLETE,V)}),(j=>{C($,k),O.debug("Font download error: ",j),b.trigger(y.default.DVB_FONT_DOWNLOAD_FAILED,V)}))}},getFonts:function(){return A},getFontsForTrackId:function($){return A.filter((V=>V.trackId&&V.trackId===$))},reset:function(){(function(){for(const $ of A){let V=document.fonts.delete($.fontFace);O.debug(`Removal of fontFamily: ${$.fontFamily} was ${V?"successful":"unsuccessful"}`)}})(),B()}},O=(0,o.default)(m).getInstance().getLogger(N),B(),N}Gd.__dashjs_factory_name="DVBFonts";var nE=n.default.getClassFactory(Gd);function $d(p){let m=this.context;const b=p.adapter,T=p.errHandler,v=p.manifestModel,S=p.mediaController,k=p.baseURLController,x=p.videoModel,I=p.settings;let N,O,A,R,C,B,$,V,j,te,ie,se,de,G;function U(ee){if(G.error(`Could not download ${ee.isEssential?"an essential":"a"} font - fontFamily: ${ee.fontFamily}, url: ${ee.url}`),ee.isEssential){let ne=R[ee.streamId].getTrackIdxForId(ee.trackId);R[ee.streamId].setModeForTrackIdx(ne,h.default.TEXT_DISABLED)}}function P(ee){if(G.debug(`Successfully downloaded ${ee.isEssential?"an essential":"a"} font - fontFamily: ${ee.fontFamily}, url: ${ee.url}`),ee.isEssential){let ne=R[ee.streamId].getTrackIdxForId(ee.trackId);ne===R[ee.streamId].getCurrentTrackIdx()?R[ee.streamId].setModeForTrackIdx(ne,h.default.TEXT_SHOWING):R[ee.streamId].setModeForTrackIdx(ne,h.default.TEXT_HIDDEN)}}function M(ee){let ne=ee.tracks,le=ee.index;const z=ee.streamId;if(I.get().streaming.text.defaultEnabled===!1&&!Te()||se)Ce(z,-1);else{const ce=S.getCurrentTrackFor(h.default.TEXT,z);if(ce){const me={lang:ce.lang,role:ce.roles[0],index:ce.index,codec:ce.codec,accessibility:ce.accessibility[0]};ne.some(((Se,Re)=>{if(S.matchSettings(me,Se))return Ce(z,Re),le=Re,!0}))}j=!1}O[z].lastEnabledIndex=le,V.trigger(y.default.TEXT_TRACKS_ADDED,{enabled:Te(),index:le,tracks:ne,streamId:z}),ie=!0,de.addFontsFromTracks(ne,z),de.getFonts().forEach((ce=>{if(ce.isEssential){let me=R[ce.streamId].getTrackIdxForId(ce.trackId);R[ce.streamId].setModeForTrackIdx(me,h.default.TEXT_DISABLED)}})),de.downloadFonts()}function ge(ee){try{const ne=ee.streamId,le=R[ne];if(!le||isNaN(ee.time))return;le.updateTextTrackWindow(ee.time),I.get().streaming.text.webvtt.customRenderingEnabled&&le.manualCueProcessing(ee.time)}catch{}}function X(ee){try{const ne=ee.streamId;if(!R[ne])return;R[ne].disableManualTracks()}catch{}}function be(ee){try{const ne=R[ee.streamId];if(!ne)return;const le=x.getTime()||0;ne.updateTextTrackWindow(le,!0)}catch(ne){G.error(ne)}}function fe(ee){try{if(!ee||!ee.mediaType||ee.mediaType!==h.default.AUDIO||!ee.currentMediaInfo)return;const ne=R[ee.streamId].getCurrentTextTrackInfo();let le=NaN;j?le=Ie(ee.streamId):q(ne)&&ee.currentMediaInfo.lang&&ee.currentMediaInfo.lang!==ne.lang&&(le=Ie(ee.streamId),isNaN(le)&&(le=-1)),isNaN(le)||Ce(ee.streamId,le)}catch(ne){G.error(ne)}}function Te(){let ee=!0;return j&&!te&&(ee=!1),ee}function Ce(ee,ne){j=ne===-1,j&&S&&S.saveTextSettingsDisabled();let le=W(ee);if(le===ne||!R[ee])return;R[ee].disableManualTracks(),R[ee].invalidateCueWindow();let z=R[ee].getCurrentTextTrackInfo(),ce=z?x.getTextTrack(z.kind,z.id,z.lang,z.isTTML,z.isEmbedded):null;ce&&ce.mode!==h.default.TEXT_DISABLED&&R[ee].setModeForTrackIdx(le,h.default.TEXT_HIDDEN),R[ee].setCurrentTrackIdx(ne),z=R[ee].getCurrentTextTrackInfo();const me=I.get().streaming.text.dispatchForManualRendering;if(z&&!me&&z.mode!==h.default.TEXT_DISABLED&&R[ee].setModeForTrackIdx(ne,h.default.TEXT_SHOWING),z&&z.isFragmented&&!z.isEmbedded)(function(Se,Re,we){if(!A[Se])return;let ze=A[Se].getConfig().fragmentedTracks;for(let Ye=0;Ye<ze.length;Ye++){let ct=ze[Ye];if(Re.lang===ct.lang&&(ct.id?Re.id===ct.id:Re.index===ct.index)){let bt=S.getCurrentTrackFor(h.default.TEXT,Se);(ct.id?bt.id!==ct.id:bt.index!==ct.index)?(R[Se].deleteCuesFromTrackIdx(we),A[Se].setCurrentFragmentedTrackIdx(Ye)):we===-1&&V.trigger(f.default.SET_FRAGMENTED_TEXT_AFTER_DISABLED,{},{streamId:Se,mediaType:h.default.TEXT})}}})(ee,z,le);else if(z&&!z.isFragmented)(function(Se,Re){V.trigger(f.default.SET_NON_FRAGMENTED_TEXT,{currentTrackInfo:Re},{streamId:Se,mediaType:h.default.TEXT})})(ee,z);else if(!z&&j){const Se=Ie(ee);return void(isNaN(Se)||Ce(ee,Se))}S.setTrack(z)}function Ie(ee){const ne=(function(ce){return R[ce].getTextTrackInfos().filter(((me,Se)=>(me._indexToSelect=Se,!!(me&&me.roles&&me.roles.length>0)&&q(me))))})(ee);if(!ne||ne.length<=0)return NaN;const le=S.getCurrentTrackFor(h.default.AUDIO,ee);if(!le)return NaN;const z=ne.find((ce=>le.lang===ce.lang));return z?z._indexToSelect:NaN}function q(ee){return!(!ee||!ee.roles||ee.roles.length===0)&&ee.roles.some((ne=>ne.schemeIdUri===h.default.DASH_ROLE_SCHEME_ID&&ne.value===ye.default.FORCED_SUBTITLE))}function W(ee){return R[ee].getCurrentTrackIdx()}function re(){A={},R={},O={},j=!0,ie=!1,se=!1}return N={addEmbeddedTrack:function(ee,ne){const le=ee.id;A[le]&&A[le].addEmbeddedTrack(ne)},addMediaInfosToBuffer:function(ee,ne,le,z=null){const ce=ee.id;A[ce]&&A[ce].addMediaInfos(ne,le,z)},createTracks:function(ee){const ne=ee.id;R[ne]&&R[ne].createTracks()},deactivateStream:function(ee){if(!ee)return;const ne=ee.id;A[ne]&&A[ne].resetMediaInfos(),R[ne]&&R[ne].deleteAllTextTracks()},enableForcedTextStreaming:function(ee){return(0,gt.checkParameterType)(ee,"boolean"),te=ee,!0},enableText:function(ee,ne){return(0,gt.checkParameterType)(ne,"boolean"),Te()!==ne&&(ne&&Ce(ee,O[ee].lastEnabledIndex),ne||(O[ee].lastEnabledIndex=W(ee),ie?Ce(ee,-1):se=!0)),!0},getAllTracksAreDisabled:function(){return j},getCurrentTrackIdx:W,getTextSourceBuffer:function(ee){const ne=ee.id;if(A&&A[ne])return A[ne]},initialize:function(){de=nE(m).create({adapter:b,baseURLController:k}),V.on(f.default.TEXT_TRACKS_QUEUE_INITIALIZED,M,N),V.on(f.default.DVB_FONT_DOWNLOAD_FAILED,U,N),V.on(f.default.DVB_FONT_DOWNLOAD_COMPLETE,P,N),V.on(f.default.MEDIAINFO_UPDATED,fe,N),V.on(f.default.PLAYBACK_TIME_UPDATED,ge,N),I.get().streaming.text.webvtt.customRenderingEnabled&&V.on(f.default.PLAYBACK_SEEKING,X,N),V.on(f.default.PLAYBACK_SEEKED,be,N)},initializeForStream:function(ee){const ne=ee.id,le=Zy(m).create({videoModel:x,settings:I,streamInfo:ee});le.initialize(),R[ne]=le;const z=Xy(m).create({errHandler:T,adapter:b,dvbFonts:de,manifestModel:v,mediaController:S,videoModel:x,textTracks:le,vttParser:C,vttCustomRenderingParser:B,ttmlParser:$,streamInfo:ee,settings:I});z.initialize(),A[ne]=z,O[ne]={},O[ne].lastEnabledIndex=-1},isTextEnabled:Te,reset:function(){Object.keys(A).forEach((ee=>{A[ee].resetEmbedded(),A[ee].reset()})),de.reset(),re(),V.off(f.default.TEXT_TRACKS_QUEUE_INITIALIZED,M,N),V.off(f.default.DVB_FONT_DOWNLOAD_FAILED,U,N),V.off(f.default.DVB_FONT_DOWNLOAD_COMPLETE,P,N),V.off(f.default.MEDIAINFO_UPDATED,fe,N),V.off(f.default.PLAYBACK_TIME_UPDATED,ge,N),I.get().streaming.text.webvtt.customRenderingEnabled&&V.off(f.default.PLAYBACK_SEEKING,X,N),V.off(f.default.PLAYBACK_SEEKED,be,N)},setTextTrack:Ce,clearDataForStream:function(ee){A[ee]&&(A[ee].resetEmbedded(),A[ee].reset(),delete A[ee]),R[ee]&&(R[ee].deleteAllTextTracks(),delete R[ee]),O[ee]&&delete O[ee]}},te=!1,ie=!1,se=!1,C=Jy(m).getInstance(),B=eE(m).getInstance(),$=tE(m).getInstance(),V=(0,g.default)(m).getInstance(),G=(0,o.default)(m).getInstance().getLogger(N),re(),N}$d.__dashjs_factory_name="TextController";var rE=n.default.getClassFactory($d);function Vd(p){p=p||{};const m=this.context,b=(0,o.default)(m).getInstance(),T=p.settings,v=(0,g.default)(m).getInstance();let S,k,x,I,N,O;function A(){return navigator&&navigator.connection&&!isNaN(navigator.connection.downlink)&&navigator.connection.downlink>0?1e3*navigator.connection.downlink:NaN}function R($,V,j,te){const ie=Math.pow(.5,j/te.fast);$.fastEstimate=(1-ie)*V+ie*$.fastEstimate;const se=Math.pow(.5,j/te.slow);$.slowEstimate=(1-se)*V+se*$.slowEstimate,$.totalWeight+=j}function C(){S={},k={},x={},I={}}const B={addEntry:function($,V){try{if(!($&&V&&V.trace&&V.trace.length))return;(function(ie){S[ie]=S[ie]||[],k[ie]=k[ie]||[],x[ie]=x[ie]||{fastEstimate:0,slowEstimate:0,totalWeight:0},I[ie]=I[ie]||{fastEstimate:0,slowEstimate:0,totalWeight:0}})($);const j=V.tresponse.getTime()-V.trequest.getTime()||1;let te=(function(ie,se){return ie._fileLoaderType&&ie._fileLoaderType===h.default.FILE_LOADER_TYPES.FETCH?(function(de){const G=de.trace.reduce(((M,ge)=>M+ge.b[0]),0),U=de.trace.reduce(((M,ge)=>M+ge.d),0);let P=NaN;return T.get().streaming.abr.throughput.useNetworkInformationApi.fetch&&(P=A()),isNaN(P)&&(P=Math.round(8*G/U)),{downloadedBytes:G,value:P,downloadTimeInMs:U}})(ie):(function(de,G){let U=NaN,P=NaN,M=!1;if(T.get().streaming.abr.throughput.useResourceTimingApi&&de._resourceTimingValues)U=de._resourceTimingValues.transferSize,P=de._resourceTimingValues.responseEnd-de._resourceTimingValues.responseStart,M=!0;else{if(de.trace.length<=1)return{throughput:NaN,downloadTimeInMs:NaN};U=de.trace.reduce(((X,be)=>X+be.b[0]),0)-de.trace[0].b[0],P=Math.max(de.trace.reduce(((X,be)=>X+be.d),0)-de.trace[0].d,1)}let ge=NaN;if(!M&&T.get().streaming.abr.throughput.useNetworkInformationApi.xhr&&(ge=A()),isNaN(ge)){const X=T.get().streaming.abr.throughput.useDeadTimeLatency?P:P+G;ge=Math.round(8*U/X)}return{downloadedBytes:U,value:ge,downloadTimeInMs:P}})(ie,se)})(V,j);if(te.latencyInMs=j,isNaN(te.value)||!isFinite(te.value))return;if(V.cmsd){const ie=V.cmsd.dynamic&&V.cmsd.dynamic.etp?V.cmsd.dynamic.etp:null;if(ie){const se=T.get().streaming.cmsd.abr.etpWeightRatio;se>0&&se<=1&&(te.value=te.value*(1-se)+ie*se)}}if((function(ie,se,de){return T.get().streaming.abr.throughput.useResourceTimingApi&&de._resourceTimingValues?de._resourceTimingValues.transferSize===0&&de._resourceTimingValues.decodedBodySize>0:!isNaN(se)&&(ie===h.default.VIDEO?se<T.get().streaming.cacheLoadThresholds[h.default.VIDEO]:ie===h.default.AUDIO?se<T.get().streaming.cacheLoadThresholds[h.default.AUDIO]:void 0)})($,V._tfinish.getTime()-V.trequest.getTime(),V))return void O.debug(`${$} Assuming segment ${V.url} came from cache, ignoring it for throughput calculation`);O.debug(`Added throughput entry for ${$}: ${te.value} kbit/s`),te.serviceLocation=V._serviceLocation,S[$].push(te),k[$].push({value:j}),(function(ie){S[ie].length>T.get().streaming.abr.throughput.sampleSettings.maxMeasurementsToKeep&&S[ie].shift(),k[ie].length>T.get().streaming.abr.throughput.sampleSettings.maxMeasurementsToKeep&&k[ie].shift()})($),v.trigger(y.default.THROUGHPUT_MEASUREMENT_STORED,{throughputValues:te}),V.type!==ke.HTTPRequest.MPD_TYPE&&(R(x[$],te.value,T.get().streaming.abr.throughput.ewma.weightDownloadTimeMultiplicationFactor*te.downloadTimeInMs,N.bandwidthHalfLife),R(I[$],j,1,N.latencyHalfLife))}catch(j){O.error(j)}},getThroughputDict:function($){return $?S[$]:S},getEwmaThroughputDict:function($){return $?x[$]:x},getEwmaLatencyDict:function($){return $?I[$]:I},getEwmaHalfLife:function(){return N},getLatencyDict:function($){return $?k[$]:k},reset:C};return O=b.getLogger(B),N={bandwidthHalfLife:{fast:T.get().streaming.abr.throughput.ewma.throughputFastHalfLifeSeconds,slow:T.get().streaming.abr.throughput.ewma.throughputSlowHalfLifeSeconds},latencyHalfLife:{fast:T.get().streaming.abr.throughput.ewma.latencyFastHalfLifeCount,slow:T.get().streaming.abr.throughput.ewma.latencySlowHalfLifeCount}},C(),B}Vd.__dashjs_factory_name="ThroughputModel";var iE=n.default.getClassFactory(Vd);function Hd(){const p=this.context,m=(0,g.default)(p).getInstance();let b,T,v;function S(){performance.clearResourceTimings()}function k(ie){ie.metric!==i.HTTP_REQUEST||!ie.value||ie.value.type!==ke.HTTPRequest.MPD_TYPE&&(ie.value.type!==ke.HTTPRequest.MEDIA_SEGMENT_TYPE||ie.mediaType!==h.default.AUDIO&&ie.mediaType!==h.default.VIDEO)||b.addEntry(ie.mediaType,ie.value)}function x(ie,se,de=null,G=NaN){let U,P=null,M=b.getEwmaHalfLife(),ge=null,X=!0;switch(de||(de=v.get().streaming.abr.throughput.averageCalculationMode),ie){case h.default.THROUGHPUT_TYPES.BANDWIDTH:P=de===h.default.THROUGHPUT_CALCULATION_MODES.EWMA?b.getEwmaThroughputDict(se):b.getThroughputDict(se),ge=M.bandwidthHalfLife,X=!0,G=isNaN(G)?T.getIsDynamic()?v.get().streaming.abr.throughput.sampleSettings.live:v.get().streaming.abr.throughput.sampleSettings.vod:G;break;case h.default.THROUGHPUT_TYPES.LATENCY:P=de===h.default.THROUGHPUT_CALCULATION_MODES.EWMA?b.getEwmaLatencyDict(se):b.getLatencyDict(se),ge=M.latencyHalfLife,X=!1,G=isNaN(G)?v.get().streaming.abr.throughput.sampleSettings.averageLatencySampleAmount:G}if(!P||P.length===0)return NaN;switch(de){case h.default.THROUGHPUT_CALCULATION_MODES.ARITHMETIC_MEAN:return U=I(P,G,ie),N(P,U);case h.default.THROUGHPUT_CALCULATION_MODES.BYTE_SIZE_WEIGHTED_ARITHMETIC_MEAN:return U=I(P,G,ie),O(P,U);case h.default.THROUGHPUT_CALCULATION_MODES.DATE_WEIGHTED_ARITHMETIC_MEAN:return U=I(P,G,ie),A(P,U);case h.default.THROUGHPUT_CALCULATION_MODES.HARMONIC_MEAN:return U=I(P,G,ie),R(P,U);case h.default.THROUGHPUT_CALCULATION_MODES.BYTE_SIZE_WEIGHTED_HARMONIC_MEAN:return U=I(P,G,ie),C(P,U);case h.default.THROUGHPUT_CALCULATION_MODES.DATE_WEIGHTED_HARMONIC_MEAN:return U=I(P,G,ie),B(P,U);case h.default.THROUGHPUT_CALCULATION_MODES.EWMA:return $(P,ge,X);case h.default.THROUGHPUT_CALCULATION_MODES.ZLEMA:return U=I(P,G,ie),V(P,U)}}function I(ie,se,de){if(ie){if(se>=ie.length)se=ie.length;else if(de===h.default.THROUGHPUT_TYPES.BANDWIDTH&&v.get().streaming.abr.throughput.sampleSettings.enableSampleSizeAdjustment)for(let G=1;G<se;++G){const U=ie[ie.length-G].value/ie[ie.length-G-1].value;if((U>=v.get().streaming.abr.throughput.sampleSettings.increaseScale||U<=v.get().streaming.abr.throughput.sampleSettings.decreaseScale)&&(se+=1)===ie.length)break}}else se=0;return se}function N(ie,se){let de=ie;return se!==0&&de&&de.length!==0?(de=de.slice(-se),de.reduce(((G,U)=>G+U.value),0)/de.length):NaN}function O(ie,se){let de=ie;if(se===0||!de||de.length===0)return NaN;de=de.slice(-se);let G=0;return de.reduce(((U,P)=>{let M=Math.sqrt(P.downloadedBytes);return G+=M,U+P.value*M}),0)/G}function A(ie,se){let de=ie;if(se===0||!de||de.length===0)return NaN;de=de.slice(-se);let G=0;return de.reduce(((U,P,M)=>{let ge=M+1;return G+=ge,U+P.value*ge}),0)/G}function R(ie,se){let de=ie;if(se===0||!de||de.length===0)return NaN;de=de.slice(-se);const G=de.reduce(((U,P)=>U+1/P.value),0);return de.length/G}function C(ie,se){let de=ie;if(se===0||!de||de.length===0)return NaN;de=de.slice(-se);let G=0;const U=de.reduce(((P,M)=>{let ge=Math.sqrt(M.downloadedBytes);return G+=ge,P+1/M.value*ge}),0);return G/U}function B(ie,se){let de=ie;if(se===0||!de||de.length===0)return NaN;de=de.slice(-se);let G=0;const U=de.reduce(((P,M,ge)=>{let X=ge+1;return G+=X,P+1/M.value*X}),0);return G/U}function $(ie,se,de=!0){if(!ie||ie.totalWeight<=0)return NaN;const G=ie.fastEstimate/(1-Math.pow(.5,ie.totalWeight/se.fast)),U=ie.slowEstimate/(1-Math.pow(.5,ie.totalWeight/se.slow));return de?Math.min(G,U):Math.max(G,U)}function V(ie,se){if(se===0||!ie||ie.length===0)return NaN;let de=ie.slice(-se).map((M=>M.value)),G=2/(de.length+1),U=de[de.length-1],P=de[de.length-1];for(let M=0;M<de.length;M++)U=G*de[M]+(1-G)*U,P=G*U+(1-G)*P;return P}function j(ie,se=null,de=NaN){const G=x(h.default.THROUGHPUT_TYPES.BANDWIDTH,ie,se,de);return Math.round(G)}const te={getArithmeticMean:N,getAverageLatency:function(ie,se=null,de=NaN){const G=x(h.default.THROUGHPUT_TYPES.LATENCY,ie,se,de);return Math.round(G)},getAverageThroughput:j,getByteSizeWeightedArithmeticMean:O,getByteSizeWeightedHarmonicMean:C,getDateWeightedArithmeticMean:A,getDateWeightedHarmonicMean:B,getEwma:$,getHarmonicMean:R,getRawThroughputData:function(ie){return ie?b.getThroughputDict(ie):[]},getSafeAverageThroughput:function(ie,se=null,de=NaN){let G=j(ie,se,de);return isNaN(G)||(G*=v.get().streaming.abr.throughput.bandwidthSafetyFactor),G},getZlema:V,initialize:function(){b=iE(p).create({settings:v}),m.on(y.default.METRIC_ADDED,k,te),window.performance?.addEventListener?.("resourcetimingbufferfull",S)},reset:function(){b.reset(),m.off(y.default.METRIC_ADDED,k,te),window.performance?.removeEventListener?.("resourcetimingbufferfull",S)},setConfig:function(ie){ie.settings&&(v=ie.settings),ie.playbackController&&(T=ie.playbackController)}};return te}Hd.__dashjs_factory_name="ThroughputController";var aE=n.default.getSingletonFactory(Hd);function Kd(){const p=this.context,m=(0,g.default)(p).getInstance(),b=(0,l.default)(p).getInstance();let T,v,S,k;function x(j){k=j}function I(j,te,ie,se){let de,G=te.adaptation.period.mpd;const U=G.availabilityStartTime;if(se)de=ie&&G.timeShiftBufferDepth!==Number.POSITIVE_INFINITY?new Date(U.getTime()+1e3*(j+G.timeShiftBufferDepth)):G.availabilityEndTime;else if(ie){const P=te.availabilityTimeOffset;de=new Date(U.getTime()+1e3*(j-P))}else de=U;return de}function N(j,te){return(j.getTime()-te.mpd.availabilityStartTime.getTime()+1e3*k)/1e3}function O(j,te){return j+(te.adaptation.period.start-te.presentationTimeOffset)}function A(j){const te={start:NaN,end:NaN},ie=j[0].getAdapter().getRegularPeriods()[0],se=N(new Date,ie);if(!j||j.length===0)return{range:te,now:se};j.forEach((G=>{let U=G.getCurrentRepresentationForType(h.default.VIDEO);if(U||(U=G.getCurrentRepresentationForType(h.default.AUDIO)),!U){const M=G.getAdapter(),ge=M.getMediaInfoForType(G.getStreamInfo(),h.default.VIDEO)||M.getMediaInfoForType(G.getStreamInfo(),h.default.AUDIO);U=M.getVoRepresentations(ge)[0]}let P={start:NaN,end:NaN};if(U)if(U.segmentInfoType===ye.default.SEGMENT_TIMELINE)P=(function(M){const ge=M.adaptation.period.mpd.manifest.Period[M.adaptation.period.index].AdaptationSet[M.adaptation.index],X=v.getRepresentationFor(M.index,ge),be=X.SegmentTemplate||X.SegmentList,fe=be.SegmentTimeline,Te=be.timescale,Ce=fe.S,Ie={start:0,end:0},q=Ce[0].t,W=!isNaN(q),re=W?q:0;let ee,ne,le,z,ce=0;for(W&&(Ie.start=O(re/Te,M)),le=0,z=Ce.length;le<z;le++)ee=Ce[le],ne=0,ee.hasOwnProperty("r")&&(ne=ee.r),ce+=ee.d*(1+ne);return Ie.end=O((re+ce)/Te,M),Ie})(U);else{const M=U.adaptation.period;P.start=M.start,P.end=Math.max(se,M.start+M.duration)}!isNaN(P.start)&&(isNaN(te.start)||te.start>P.start)&&(te.start=P.start),!isNaN(P.end)&&(isNaN(te.end)||te.end<P.end)&&(te.end=P.end)})),te.end=Math.min(se,te.end);const de=C(j,te.end,!0);return te.end=isNaN(de)?te.end:de,te.start=ie&&ie.mpd&&ie.mpd.timeShiftBufferDepth&&!isNaN(ie.mpd.timeShiftBufferDepth)&&!isNaN(te.end)?Math.max(te.end-ie.mpd.timeShiftBufferDepth,te.start):te.start,te.start=C(j,te.start),{range:te,now:se}}function R(j,te){S=j-te.end}function C(j,te,ie=!1){try{let se=0,de=!1,G=NaN;for(;!de&&se<j.length;){const U=j[se].getStreamInfo();U.start<=te&&(!isFinite(U.duration)||U.start+U.duration>=te)?(G=te,de=!0):!ie&&U.start>te&&(isNaN(G)||U.start<G)?G=U.start:ie&&U.start+U.duration<te&&(isNaN(G)||U.start+U.duration>G)&&(G=U.start+U.duration),se+=1}return G}catch{return te}}function B(j){j.offset===void 0||isNaN(j.offset)||x(j.offset/1e3)}function $(){k=0,S=0}function V(){m.off(f.default.UPDATE_TIME_SYNC_OFFSET,B,this),$()}return T={calcAvailabilityEndTimeFromPresentationTime:function(j,te,ie){return I(j,te,ie,!0)},calcAvailabilityStartTimeFromPresentationTime:function(j,te,ie){return I(j,te,ie)},calcMediaTimeFromPresentationTime:function(j,te){return j-te.adaptation.period.start+te.presentationTimeOffset},calcPeriodRelativeTimeFromMpdRelativeTime:function(j,te){return te-j.adaptation.period.start},calcPresentationTimeFromMediaTime:O,calcPresentationTimeFromWallTime:N,calcTimeShiftBufferWindow:function(j,te){if(!te)return(function(ie){const se={start:NaN,end:NaN};let de=0,G=NaN;return ie.forEach((U=>{const P=U.getStreamInfo();de+=P.duration,(isNaN(G)||P.start<G)&&(G=P.start)})),se.start=G,se.end=G+de,se})(j);if(b.get().streaming.timeShiftBuffer.calcFromSegmentTimeline){const ie=A(j);return R(ie.now,ie.range),ie.range}return(function(ie){const se={start:NaN,end:NaN};if(!ie||ie.length===0)return se;const de=ie[0].getAdapter().getRegularPeriods()[0],G=N(new Date,de),U=de.mpd.timeShiftBufferDepth,P=isNaN(U)?0:G-U;if(se.start=C(ie,P),se.end=!isNaN(se.start)&&G<se.start?G:C(ie,G,!0),!isNaN(U)&&se.end<G-U&&(se.end=NaN),b.get().streaming.timeShiftBuffer.fallbackToSegmentTimeline){const M=A(ie);if(M.range.end<se.start)return m.trigger(y.default.CONFORMANCE_VIOLATION,{level:ma.LEVELS.WARNING,event:ma.EVENTS.INVALID_DVR_WINDOW}),R(M.now,M.range),M.range}return se})(j)},calcWallTimeForSegment:function(j,te){let ie,se,de;return te&&(ie=j.representation.adaptation.period.mpd.suggestedPresentationDelay,se=j.presentationStartTime+ie,de=new Date(j.availabilityStartTime.getTime()+1e3*se)),de},getClientReferenceTime:function(){return Date.now()-1e3*S+1e3*k},getClientTimeOffset:function(){return k},initialize:function(){$(),m.on(f.default.UPDATE_TIME_SYNC_OFFSET,B,this)},reset:V,setClientTimeOffset:x,setConfig:function(j){j&&j.dashManifestModel&&(v=j.dashManifestModel)}},v=Fn(p).getInstance(),V(),T}Kd.__dashjs_factory_name="TimelineConverter";var sE=n.default.getSingletonFactory(Kd),oE=class{constructor(){this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null,this.r=null}};function Yd(){let p,m;return p={initialize:function(b){if(m=new oE,!b)return null;const T=b.indexOf("#");if(T!==-1){const v=b.substr(T+1).split("&");for(let S=0,k=v.length;S<k;++S){const x=v[S],I=x.indexOf("=");if(I!==-1){const N=x.substring(0,I);m.hasOwnProperty(N)&&(m[N]=x.substr(I+1))}}}},getURIFragmentData:function(){return m}},p}Yd.__dashjs_factory_name="URIFragmentModel";var lE=n.default.getSingletonFactory(Yd);const uE=new Map([[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,"loadedmetadata"],[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_CURRENT_DATA,"loadeddata"],[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,"canplay"],[h.default.VIDEO_ELEMENT_READY_STATES.HAVE_ENOUGH_DATA,"canplaythrough"]]);function Wd(){let p,m,b,T,v,S,k,x,I,N,O,A;const R=this.context,C=(0,g.default)(R).getInstance(),B=[];function $(X,be=!1){b&&(be?b.playbackRate=X:ge(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,(()=>{b.playbackRate=X})))}function V(){return B.length>0}function j(X){let be=B.indexOf(X);if(X!==null&&(be!==-1&&B.splice(be,1),N.get().streaming.buffer.syntheticStallEvents.enabled&&b&&!V())){const fe=()=>{if($(S||1,N.get().streaming.buffer.syntheticStallEvents.ignoreReadyState),!b.paused){const Te=document.createEvent("Event");Te.initEvent("playing",!0,!1),b.dispatchEvent(Te)}};N.get().streaming.buffer.syntheticStallEvents.ignoreReadyState?fe():(x&&x.func&&x.event&&se(x.event,x.func),x=ge(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,fe))}}function te(){if(b&&V()&&b.playbackRate===0){const X=document.createEvent("Event");X.initEvent("waiting",!0,!1),b.dispatchEvent(X)}}function ie(X,be){b&&b.addEventListener(X,be)}function se(X,be){b&&b.removeEventListener(X,be)}function de(){return b?b.readyState:NaN}function G(){return b?b.buffered:null}function U(){return b?b.clientWidth:NaN}function P(){return b?b.clientHeight:NaN}function M(X,be,fe,Te,Ce){if(b){for(let Ie=0;Ie<b.textTracks.length;Ie++)if(b.textTracks[Ie].kind===X&&(!be||b.textTracks[Ie].label==be)&&b.textTracks[Ie].language===fe&&b.textTracks[Ie].isTTML===Te&&b.textTracks[Ie].isEmbedded===Ce)return b.textTracks[Ie]}return null}function ge(X,be){return X===h.default.VIDEO_ELEMENT_READY_STATES.HAVE_NOTHING||de()>=X?(be(),null):(function(fe,Te){const Ce=()=>{se(fe,Ce),Te(fe)};return ie(fe,Ce),{func:Ce,event:fe}})(uE.get(X),be)}return T={addEventListener:ie,addTextTrack:function(X,be,fe,Te,Ce){if(!b)return null;let Ie=M(X,be,fe,Te,Ce);return Ie||(Ie=b.addTextTrack(X,be,fe),Ie.isEmbedded=Ce,Ie.isTTML=Te),Ie},appendChild:function(X){b&&(b.appendChild(X),X.isTTML!==void 0&&(b.textTracks[b.textTracks.length-1].isTTML=X.isTTML,b.textTracks[b.textTracks.length-1].isEmbedded=X.isEmbedded))},getBufferRange:G,getClientHeight:P,getClientWidth:U,getElement:function(){return b},getEnded:function(){return b?b.ended:null},getPlaybackQuality:function(){if(!b)return null;let X="webkitDroppedFrameCount"in b&&"webkitDecodedFrameCount"in b,be=null;return"getVideoPlaybackQuality"in b?be=b.getVideoPlaybackQuality():X&&(be={droppedVideoFrames:b.webkitDroppedFrameCount,totalVideoFrames:b.webkitDroppedFrameCount+b.webkitDecodedFrameCount,creationTime:new Date}),be},getPlaybackRate:function(){return b?b.playbackRate:null},getPlayedRanges:function(){return b?b.played:null},getReadyState:de,getSource:function(){return b?b.src:null},getTTMLRenderingDiv:function(){return p},getTextTrack:M,getTextTracks:function(){return b?b.textTracks:[]},getTime:function(){return b?isNaN(m)?b.currentTime:m:null},getVideoElementSize:function(){const X=N.get().streaming.abr.usePixelRatioInLimitBitrateByPortal&&window.hasOwnProperty("devicePixelRatio")?window.devicePixelRatio:1;return{elementWidth:U()*X,elementHeight:P()*X}},getVideoHeight:function(){return b?b.videoHeight:NaN},getVideoRelativeOffsetLeft:function(){if(b){const X=b.parentNode.host||b.parentNode;return X?b.getBoundingClientRect().left-X.getBoundingClientRect().left:NaN}return NaN},getVideoRelativeOffsetTop:function(){if(b){const X=b.parentNode.host||b.parentNode;return X?b.getBoundingClientRect().top-X.getBoundingClientRect().top:NaN}return NaN},getVideoWidth:function(){return b?b.videoWidth:NaN},getVttRenderingDiv:function(){return A},initialize:function(){C.on(f.default.PLAYBACK_PLAYING,te,this)},isPaused:function(){return b?b.paused:null},isSeeking:function(){return b?b.seeking||!isNaN(m):null},isStalled:V,pause:function(){b&&(b.pause(),b.autoplay=!1)},play:function(){if(b){b.autoplay=!0;const X=b.play();X&&X.catch&&typeof Promise<"u"&&X.catch((be=>{be.name==="NotAllowedError"&&C.trigger(f.default.PLAYBACK_NOT_ALLOWED),v.warn(`Caught pending play exception - continuing (${be})`)}))}},removeChild:function(X){b&&b.removeChild(X)},removeEventListener:se,reset:function(){clearTimeout(O),C.off(f.default.PLAYBACK_PLAYING,te,this),B.length=0,(function(){try{k&&b&&(k.unobserve(b),k.disconnect(),k=null)}catch{}})()},setConfig:function(X){X&&X.settings&&(N=X.settings)},setCurrentTime:function(X,be){b&&(I&&I.func&&I.event&&se(I.event,I.func),m=X,I=ge(h.default.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,(()=>{if(b)if(b.currentTime!==m)try{m=be?(function(fe){const Te=G();let Ce=fe,Ie=9999999999;if(Te)for(let q=0;q<Te.length;q++){const W=Te.start(q),re=Te.end(q),ee=Math.abs(W-fe),ne=Math.abs(re-fe);if(fe>=W&&fe<=re)return fe;ee<Ie&&(Ie=ee,Ce=W),ne<Ie&&(Ie=ne,Ce=re)}return Ce})(m):m,isNaN(m)||(b.currentTime=m),m=NaN}catch(fe){b.readyState===0&&fe.code===fe.INVALID_STATE_ERR&&(O=setTimeout((function(){b.currentTime=m,m=NaN}),400))}else m=NaN})))},setDisableRemotePlayback:function(X){b&&(b.disableRemotePlayback=X)},setElement:function(X){if(!(X==null||X&&/^(VIDEO|AUDIO)$/i.test(X.nodeName)))throw"element is not video or audio DOM type!";b=X,(function(be){try{if(!k||!be)return;k.observe(be)}catch{}})(b)},setPlaybackRate:$,setSource:function(X){b&&(X?b.src=X:(b.removeAttribute("src"),b.load()))},setStallState:function(X,be){(function(fe,Te){Te?(function(Ce){if(Ce!==null&&b&&!b.seeking&&B.indexOf(Ce)===-1&&(B.push(Ce),N.get().streaming.buffer.syntheticStallEvents.enabled&&b&&B.length===1&&(N.get().streaming.buffer.syntheticStallEvents.ignoreReadyState||de()>=h.default.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA))){S=b.playbackRate,$(0,!0);const Ie=document.createEvent("Event");Ie.initEvent("waiting",!0,!1),b.dispatchEvent(Ie)}})(fe):j(fe)})(X,be)},setTTMLRenderingDiv:function(X){p=X,p.style.position="absolute",p.style.display="flex",p.style.overflow="hidden",p.style.pointerEvents="none",p.style.top=0,p.style.left=0},setVttRenderingDiv:function(X){A=X},waitForReadyState:ge},v=(0,o.default)(R).getInstance().getLogger(T),N=(0,l.default)(R).getInstance(),m=NaN,(function(){try{k=new ResizeObserver((()=>{C.trigger(f.default.VIDEO_ELEMENT_RESIZED)}))}catch{}})(),T}Wd.__dashjs_factory_name="VideoModel";var cE=n.default.getSingletonFactory(Wd),dE=t(8986);function Qo(){const p="You must first call initialize() and set a source before calling this method",m="You must first call initialize() and set a valid source and view before calling this method",b="You must first call attachView() to set the video element before calling this method",T="You must first call attachSource() with a valid source before calling this method",v="MediaPlayer not initialized!",S=this.context,k=(0,g.default)(S).getInstance();let x=(0,l.default)(S).getInstance();const I=(0,o.default)(S).getInstance({settings:x});let N,O,A,R,C,B,$,V,j,te,ie,se,de,G,U,P,M,ge,X,be,fe,Te,Ce,Ie,q,W,re,ee,ne,le,z,ce,me,Se,Re,we,ze,Ye,ct,bt,Zt;function vt(){Tt(null),En(null),R=null,U&&(U.reset(),U=null),P&&(P.reset(),P=null),fe&&fe.reset(),x.reset(),ge&&(ge.reset(),ge=null)}function Qt(){return!!A&&!!ze.getElement()}function un(){return(0,dE.getVersionString)()}function Rn(){if(!$)throw m;return ne.isPaused()}function xn(){if(!$)throw m;return ne.getIsDynamic()}function dn(_e){const Qe=W&&W.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO;let Lt=me.getCurrentDVRInfo(Qe);return Lt?vn(Lt.range.start+_e,Lt):0}function vn(_e,Qe){let Lt=ne.getOriginalLiveDelay();return _e>Qe.range.end-Lt&&(_e=Qe.range.end-Lt),_e}function qe(_e=""){if(!$)throw m;let Qe=Yt().currentTime;return _e!==""&&(Qe=W.getTimeRelativeToStreamId(Qe,_e)),Qe}function pt(_e){(0,gt.checkParameterType)(_e,"boolean"),V=_e}function ft(){fe.restoreDefaultUTCTimingSources()}function _t(){return me}function Yt(){if(!ze.getElement())throw b;return ze.getElement()}function En(_e){if(!C)throw v;ze.setElement(_e),_e&&(Ke(),(function(){if(P||typeof dashjs>"u")return;let Qe=dashjs.MetricsReporting;typeof Qe=="function"&&(P=Qe(S).create().createMetricsReporting({debug:I,eventBus:k,mediaElement:Yt(),adapter:X,dashMetrics:me,mediaPlayerModel:be,events:f.default,constants:h.default,metricsConstants:i}))})(),(function(){if(M||typeof dashjs>"u")return;let Qe=dashjs.MssHandler;typeof Qe=="function"&&(Jt.extend(Qe.errors),M=Qe(S).create({eventBus:k,mediaPlayerModel:be,dashMetrics:me,manifestModel:Se,playbackController:ne,streamController:W,protectionController:U,baseURLController:Ce,errHandler:Te,events:f.default,constants:h.default,debug:I,initSegmentType:ke.HTTPRequest.INIT_SEGMENT_TYPE,BASE64:ht,ISOBoxer:Ga,settings:x}))})(),W&&W.switchToVideoElement(j)),$&&(Fe(),$e()),Ct(j)}function rt(_e){if(!B)throw p;let Qe=W.getActiveStreamInfo();return Qe?G.getTracksFor(_e,Qe.id).filter((Lt=>!U||U.areKeyIdsUsable(Lt.normalizedKeyIds))):[]}function Tt(_e,Qe=NaN){if(!C)throw v;typeof _e=="string"&&Ye.initialize(_e),Qe==null&&(Qe=NaN),isNaN(Qe)||(Qe=Math.max(0,Qe)),j=Qe,A=_e,(B||$)&&(Fe(),$e()),Qt()&&Ct(j)}function Mt(){if(!B)throw p;let _e=W.getActiveStreamInfo();return _e?W.getStreamById(_e.id):null}function Fe(){$=!1,B=!1,X.reset(),W.reset(),ee.reset(),ce.reset(),ne.reset(),le.reset(),z.reset(),te.reset(),ie.reset(),G.reset(),bt.reset(),U&&(x.get().streaming.protection.keepProtectionMediaKeys?U.stop():(U.reset(),U=null,Ke())),re.reset(),Re.reset(),we.reset()}function $e(){fe.resetPlaybackSessionSpecificSettings()}function yt(){return Yp(S).create({debug:I,errHandler:Te,dashMetrics:me,mediaPlayerModel:be,mssHandler:M,settings:x})}function Ke(){if(U)return U;if(typeof dashjs>"u")return null;let _e=dashjs.Protection;if(typeof _e=="function"){let Qe=_e(S).create();return f.default.extend(_e.events),y.default.extend(_e.events,{publicOnly:!0}),Jt.extend(_e.errors),U=Qe.createProtectionSystem({debug:I,errHandler:Te,videoModel:ze,customParametersModel:fe,capabilities:Ie,eventBus:k,events:f.default,BASE64:ht,constants:h.default,cmcdModel:Re,settings:x}),Ie||(Ie=(0,rc.default)(S).getInstance()),Ie.setProtectionController(U),U}return null}function It(){if(!C)throw v;if(ge)return ge;if(typeof dashjs>"u")return null;let _e=dashjs.OfflineController;if(typeof _e=="function"){f.default.extend(_e.events),y.default.extend(_e.events,{publicOnly:!0}),Jt.extend(_e.errors);const Qe=yt(),Lt=Oc(S).create();return Lt.setConfig({manifestModel:Se,adapter:X,manifestLoader:Qe,errHandler:Te,contentSteeringController:z}),ge=_e(S).create({debug:I,manifestUpdater:Lt,baseURLController:Ce,manifestLoader:Qe,manifestModel:Se,mediaPlayerModel:be,abrController:te,playbackController:ne,adapter:X,errHandler:Te,dashMetrics:me,timelineConverter:de,segmentBaseController:bt,schemeLoaderFactory:se,eventBus:k,events:f.default,errors:Jt,constants:h.default,settings:x,dashConstants:ye.default,urlUtils:Vn(S).getInstance()}),ge}return null}function Ct(_e=NaN){ge&&ge.resetRecords(),!B&&A&&(B=!0,O.info("Streaming Initialized"),(function(){const Qe=yt();W||(W=Ld(S).getInstance()),re||(re=rE(S).create({errHandler:Te,manifestModel:Se,adapter:X,mediaController:G,baseURLController:Ce,videoModel:ze,settings:x})),q.setConfig({capabilities:Ie,customParametersModel:fe,adapter:X,settings:x,protectionController:U,manifestModel:Se,errHandler:Te}),W.setConfig({capabilities:Ie,capabilitiesFilter:q,manifestLoader:Qe,manifestModel:Se,mediaPlayerModel:be,customParametersModel:fe,protectionController:U,textController:re,adapter:X,dashMetrics:me,errHandler:Te,timelineConverter:de,videoModel:ze,playbackController:ne,serviceDescriptionController:le,contentSteeringController:z,abrController:te,throughputController:ie,mediaController:G,settings:x,baseURLController:Ce,uriFragmentModel:Ye,segmentBaseController:bt}),ee.setConfig({settings:x,playbackController:ne,streamController:W,videoModel:ze,timelineConverter:de,adapter:X}),ne.setConfig({streamController:W,serviceDescriptionController:le,dashMetrics:me,adapter:X,videoModel:ze,timelineConverter:de,settings:x}),ce.setConfig({streamController:W,playbackController:ne,mediaPlayerModel:be,videoModel:ze,settings:x}),ie.setConfig({settings:x,playbackController:ne}),te.setConfig({streamController:W,capabilities:Ie,domStorage:ct,mediaPlayerModel:be,customParametersModel:fe,throughputController:ie,cmsdModel:we,dashMetrics:me,adapter:X,videoModel:ze,settings:x}),Re.setConfig({abrController:te,dashMetrics:me,playbackController:ne,serviceDescriptionController:le,throughputController:ie}),Zt.setConfig({serviceDescriptionController:le}),we.setConfig({}),G.initialize(),ie.initialize(),te.initialize(),W.initialize(V,R),re.initialize(),ee.initialize(),ce.initialize(),Re.initialize(V),we.initialize(),z.initialize(),bt.initialize()})(),typeof A=="string"?W.load(A,_e):W.loadWithManifest(A,_e)),!$&&Qt()&&($=!0,k.trigger(y.default.PLAYBACK_INITIALIZED),O.info("Playback Initialized"))}return N={addABRCustomRule:function(_e,Qe,Lt){fe.addAbrCustomRule(_e,Qe,Lt)},addExternalSubtitle:function(_e){_e instanceof Dp.default||O.error("Invalid external subtitle object. Must be an instance of dashjs.ExternalSubtitle"),fe.addExternalSubtitle(_e)},addRequestInterceptor:function(_e){fe.addRequestInterceptor(_e)},addResponseInterceptor:function(_e){fe.addResponseInterceptor(_e)},addUTCTimingSource:function(_e,Qe){fe.addUTCTimingSource(_e,Qe)},attachProtectionController:function(_e){U=_e},attachSource:Tt,attachTTMLRenderingDiv:function(_e){if(!ze.getElement())throw b;ze.setTTMLRenderingDiv(_e)},attachView:En,attachVttRenderingDiv:function(_e){if(!ze.getElement())throw b;ze.setVttRenderingDiv(_e)},clearDefaultUTCTimingSources:function(){fe.clearDefaultUTCTimingSources()},convertToTimeCode:function(_e){_e=Math.max(_e,0);let Qe=Math.floor(_e/3600),Lt=Math.floor(_e%3600/60),Dt=Math.floor(_e%3600%60);return(Qe===0?"":Qe<10?"0"+Qe.toString()+":":Qe.toString()+":")+(Lt<10?"0"+Lt.toString():Lt.toString())+":"+(Dt<10?"0"+Dt.toString():Dt.toString())},destroy:function(){vt(),n.default.deleteSingletonInstances(S)},duration:function(){if(!$)throw m;let _e=Yt().duration;if(ne.getIsDynamic()){const Qe=W&&W.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO;let Lt=me.getCurrentDVRInfo(Qe);_e=Lt?Lt.range.end-Lt.range.start:0}return _e},enableForcedTextStreaming:function(_e){return!(!W.getActiveStreamInfo()||!re)&&re.enableForcedTextStreaming(_e)},enableText:function(_e){const Qe=W.getActiveStreamInfo();return!(!Qe||!re)&&re.enableText(Qe.id,_e)},extend:function(_e,Qe,Lt){n.default.extend(_e,Qe,Lt,S)},formatUTC:function(_e,Qe,Lt,Dt=!1){const Sn=new Date(1e3*_e),ot=Sn.toLocaleDateString(Qe),Gt=Sn.toLocaleTimeString(Qe,{hour12:Lt});return Dt?Gt+" "+ot:Gt},getABRCustomRules:function(){return fe.getAbrCustomRules()},getActiveStream:Mt,getAutoPlay:function(){return V},getAvailableBaseUrls:function(){const _e=Se.getValue();return _e?Ce.getBaseUrls(_e):[]},getAvailableLocations:function(){const _e=Se.getValue();if(!_e)return[];const Qe=X.getLocation(_e),Lt=z.getSynthesizedLocationElements(Qe);return Qe.concat(Lt)},getAverageLatency:function(_e=h.default.VIDEO,Qe=null,Lt=NaN){return ie?ie.getAverageLatency(_e,Qe,Lt):0},getAverageThroughput:function(_e=h.default.VIDEO,Qe=null,Lt=NaN){return ie?ie.getAverageThroughput(_e,Qe,Lt):0},getBufferLength:function(_e){const Qe=[h.default.VIDEO,h.default.AUDIO,h.default.TEXT];if(_e)return Qe.indexOf(_e)!==-1?_t().getCurrentBufferLevel(_e)||NaN:(O.warn("getBufferLength requested for invalid type"),NaN);{const Lt=Qe.map((Dt=>rt(Dt).length>0?_t().getCurrentBufferLevel(Dt):Number.MAX_VALUE)).reduce(((Dt,Sn)=>Math.min(Dt,Sn)));return Lt===Number.MAX_VALUE?NaN:Lt}},getCurrentLiveLatency:function(){if(!C)throw v;return $?ne.getCurrentLiveLatency():NaN},getCurrentRepresentationForType:function(_e){if(!B)throw p;if(_e!==h.default.IMAGE&&_e!==h.default.VIDEO&&_e!==h.default.AUDIO)return null;const Qe=Mt();if(!Qe)return null;if(_e===h.default.IMAGE){const Lt=Qe.getThumbnailController();return Lt?Lt.getCurrentTrack():-1}return Qe.getCurrentRepresentationForType(_e)},getCurrentSteeringResponseData:function(){if(z)return z.getCurrentSteeringResponseData()},getCurrentTextTrackIndex:function(){let _e=NaN;const Qe=W.getActiveStreamInfo();if(Qe&&re)return _e=re.getCurrentTrackIdx(Qe.id),_e},getCurrentTrackFor:function(_e){if(!B)throw p;let Qe=W.getActiveStreamInfo();return Qe?G.getCurrentTrackFor(_e,Qe.id):null},getDashAdapter:function(){return X},getDashMetrics:_t,getDebug:function(){return I},getDvrSeekOffset:dn,getDvrWindow:function(){if(!$)throw m;const _e=W&&W.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO;let Qe=me.getCurrentDVRInfo(_e);if(!Qe)return{};let Lt=0;const Dt=ne.getIsDynamic();return Dt&&(Lt=Qe.manifestInfo.availableFrom.getTime()/1e3),{start:Qe.range.start,end:Qe.range.end,startAsUtc:Dt?Lt+Qe.range.start:NaN,endAsUtc:Dt?Lt+Qe.range.end:NaN,size:Qe.range.end-Qe.range.start}},getExternalSubtitles:function(){fe.getExternalSubtitles()},getInitialMediaSettingsFor:function(_e){if(!C)throw v;return G.getInitialSettings(_e)},getLowLatencyModeEnabled:function(){if(!$)throw m;return ne.getLowLatencyModeEnabled()},getManifest:function(){return Se.getValue()},getOfflineController:function(){return It()},getPlaybackRate:function(){return Yt().playbackRate},getProtectionController:function(){return Ke()},getRawThroughputData:function(_e=h.default.VIDEO){return ie?ie.getRawThroughputData(_e):[]},getRepresentationsByType:function(_e,Qe=null){if(!B)throw p;let Lt=Qe?W.getStreamById(Qe):Mt();return Lt?Lt.getRepresentationsByType(_e):[]},getSafeAverageThroughput:function(_e=h.default.VIDEO,Qe=null,Lt=NaN){return ie?ie.getSafeAverageThroughput(_e,Qe,Lt):0},getSettings:function(){return x.get()},getSource:function(){if(!A)throw T;return A},getStreamsFromManifest:function(_e){if(!B)throw p;return X.getStreamsInfo(_e)},getTTMLRenderingDiv:function(){return ze?ze.getTTMLRenderingDiv():null},getTargetLiveDelay:function(){if(!$)throw m;return ne.getOriginalLiveDelay()},getTracksFor:rt,getTracksForTypeFromManifest:function(_e,Qe,Lt){if(!B)throw p;return(Lt=Lt||X.getStreamsInfo(Qe,1)[0])?X.getAllMediaInfoForType(Lt,_e,Qe):[]},getVersion:un,getVideoElement:Yt,getVolume:function(){return Yt().volume},getXHRWithCredentialsForType:function(_e){return fe.getXHRWithCredentialsForType(_e)},initialize:function(_e,Qe,Lt,Dt=NaN){Ie||(Ie=(0,rc.default)(S).getInstance(),Ie.setConfig({settings:x,protectionController:U})),Te||(Te=Lp(S).getInstance()),Ie.supportsMediaSource()?(C||(C=!0,de=sE(S).getInstance(),ie||(ie=aE(S).getInstance()),te||(te=mr(S).getInstance()),se||(se=Wu(S).getInstance()),ne||(ne=Jp(S).getInstance()),G||(G=Qp(S).getInstance()),W||(W=Ld(S).getInstance()),ee||(ee=Pp(S).getInstance()),ce||(ce=Jm(S).getInstance()),le||(le=iy(S).getInstance()),z||(z=Do(S).getInstance()),q||(q=Zm(S).getInstance()),X=pp(S).getInstance(),Se=Wp(S).getInstance(),Re=Uu(S).getInstance(),we=ju(S).getInstance(),Zt=$u(S).getInstance(),me=Cp(S).getInstance({settings:x}),ct=tp(S).getInstance({settings:x}),X.setConfig({constants:h.default,cea608parser:new Od,errHandler:Te,BASE64:ht}),Ce||(Ce=Wm(S).create()),Ce.setConfig({adapter:X,contentSteeringController:z}),le.setConfig({adapter:X}),bt||(bt=ny(S).getInstance({dashMetrics:me,mediaPlayerModel:be,errHandler:Te,baseURLController:Ce,events:f.default,eventBus:k,debug:I,boxParser:bs(S).getInstance(),errors:Jt})),G.setConfig({domStorage:ct,settings:x,mediaPlayerModel:be,customParametersModel:fe,videoModel:ze}),be.setConfig({playbackController:ne,serviceDescriptionController:le}),z.setConfig({adapter:X,errHandler:Te,dashMetrics:me,mediaPlayerModel:be,manifestModel:Se,serviceDescriptionController:le,throughputController:ie,eventBus:k}),ft(),pt(Lt===void 0||Lt),It()),_e&&En(_e),Qe&&Tt(Qe,Dt),O.info("[dash.js "+un()+"] MediaPlayer has been initialized")):Te.error(new Wt.default(Jt.CAPABILITY_MEDIASOURCE_ERROR_CODE,Jt.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE))},isDynamic:xn,isMuted:function(){return Yt().muted},isPaused:Rn,isReady:Qt,isSeeking:function(){if(!$)throw m;return ne.isSeeking()},isTextEnabled:function(){const _e=W.getActiveStreamInfo();return!(!_e||!re)&&re.isTextEnabled(_e)},off:function(_e,Qe,Lt){k.off(_e,Qe,Lt)},on:function(_e,Qe,Lt,Dt){k.on(_e,Qe,Lt,Dt)},pause:function(){if(!$)throw m;ne.pause()},play:function(){if(!$)throw m;(!V||Rn()&&$)&&ne.play(!0)},preload:function(){if(!ze.getElement()&&!B){if(!A)throw T;Ct(j)}},provideThumbnail:function(_e,Qe){if(typeof Qe!="function")return;if(_e<0)return void Qe(null);const Lt=ne.getIsDynamic()?dn(_e):_e,Dt=W.getStreamForTime(Lt);if(Dt===null)return void Qe(null);const Sn=Dt.getThumbnailController();if(Sn)return Sn.provide(Lt,Qe);Qe(null)},refreshManifest:function(_e){if(!C)throw v;if(!Qt())return _e(null,T);let Qe=this;if(typeof _e=="function"){const Lt=function(Dt){k.off(f.default.INTERNAL_MANIFEST_LOADED,Lt,Qe),Dt.error?_e(null,Dt.error):_e(Dt.manifest)};k.on(f.default.INTERNAL_MANIFEST_LOADED,Lt,Qe)}W.refreshManifest()},registerCustomCapabilitiesFilter:function(_e){fe.registerCustomCapabilitiesFilter(_e)},registerLicenseRequestFilter:function(_e){fe.registerLicenseRequestFilter(_e)},registerLicenseResponseFilter:function(_e){fe.registerLicenseResponseFilter(_e)},removeABRCustomRule:function(_e){fe.removeAbrCustomRule(_e)},removeAllABRCustomRule:function(){fe.removeAllAbrCustomRule()},removeExternalSubtitleById:function(_e){fe.removeExternalSubtitleById(_e)},removeExternalSubtitleByUrl:function(_e){fe.removeExternalSubtitleByUrl(_e)},removeRequestInterceptor:function(_e){fe.removeRequestInterceptor(_e)},removeResponseInterceptor:function(_e){fe.removeResponseInterceptor(_e)},removeUTCTimingSource:function(_e,Qe){fe.removeUTCTimingSource(_e,Qe)},reset:vt,resetCustomInitialTrackSelectionFunction:function(){fe.resetCustomInitialTrackSelectionFunction(null)},resetSettings:function(){x.reset()},restoreDefaultUTCTimingSources:ft,retrieveManifest:function(_e,Qe){let Lt=yt(),Dt=this;const Sn=function(ot){ot.error?Qe(null,ot.error):Qe(ot.manifest),k.off(f.default.INTERNAL_MANIFEST_LOADED,Sn,Dt),Lt.reset()};k.on(f.default.INTERNAL_MANIFEST_LOADED,Sn,Dt),Ye.initialize(_e),Lt.load(_e)},seek:function(_e){if(!$)throw m;if((0,gt.checkParameterType)(_e,"number"),isNaN(_e))throw h.default.BAD_ARGUMENT_ERROR;_e<0&&(_e=0);let Qe=ne.getIsDynamic()?dn(_e):_e;const Lt=Yt();!ne.getIsDynamic()&&Lt.duration&&(Qe=Math.min(Lt.duration,Qe)),ne.seek(Qe,!1,!1,!0)},seekToOriginalLive:function(){$&&xn()&&ne.seekToOriginalLive()},seekToPresentationTime:function(_e){if(!$)throw m;if((0,gt.checkParameterType)(_e,"number"),isNaN(_e))throw h.default.BAD_ARGUMENT_ERROR;_e<0&&(_e=0);const Qe=Yt();if(!ne.getIsDynamic()&&Qe.duration&&(_e=Math.min(Qe.duration,_e)),ne.getIsDynamic()){const Lt=W&&W.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO;let Dt=me.getCurrentDVRInfo(Lt);if(!Dt)return;(_e=vn(_e,Dt))<Dt.range.start&&(_e=Dt.range.start)}ne.seek(_e,!1,!1,!0)},setAutoPlay:pt,setConfig:function(_e){_e&&(_e.capabilities&&(Ie=_e.capabilities),_e.capabilitiesFilter&&(q=_e.capabilitiesFilter),_e.streamController&&(W=_e.streamController),_e.textController&&(re=_e.textController),_e.gapController&&(ee=_e.gapController),_e.throughputController&&(ie=_e.throughputController),_e.playbackController&&(ne=_e.playbackController),_e.serviceDescriptionController&&(le=_e.serviceDescriptionController),_e.contentSteeringController&&(z=_e.contentSteeringController),_e.clientDataReportingController&&(Zt=_e.clientDataReportingController),_e.catchupController&&(ce=_e.catchupController),_e.mediaPlayerModel&&(be=_e.mediaPlayerModel),_e.customParametersModel&&(fe=_e.customParametersModel),_e.abrController&&(te=_e.abrController),_e.schemeLoaderFactory&&(se=_e.schemeLoaderFactory),_e.mediaController&&(G=_e.mediaController),_e.settings&&(x=_e.settings),_e.dashMetrics&&(me=_e.dashMetrics))},setCurrentTrack:function(_e,Qe=!1){if(!B)throw p;!U||U.areKeyIdsUsable(_e.normalizedKeyIds)?G.setTrack(_e,{noSettingsSave:Qe}):O.error(`Can not switch to track with index ${_e.index} because key is not usable`)},setCustomInitialTrackSelectionFunction:function(_e){fe.setCustomInitialTrackSelectionFunction(_e)},setInitialMediaSettingsFor:function(_e,Qe){if(!C)throw v;let Lt=(function(Dt){const Sn=x.get().streaming.defaultSchemeIdUri;let ot={};function Gt(fn,cn,In){let mn={};if(cn){if(cn instanceof Array)throw"Array type not supported for settings!";return cn instanceof Object?(mn.schemeIdUri=cn.schemeIdUri?cn.schemeIdUri:"",mn.value=cn.value?cn.value:""):(mn.schemeIdUri=In,mn.value=cn,O.warn("No schemeIdUri provided for "+fn+', using default "'+In+'"')),mn}return null}return Dt.id!==void 0&&(ot.id=Dt.id),Dt.lang!==void 0&&(ot.lang=Dt.lang),isNaN(Dt.index)||(ot.index=Dt.index),Dt.viewpoint!==void 0&&(ot.viewpoint=Gt("viewpoint",Dt.viewpoint,Sn.viewpoint)),Dt.audioChannelConfiguration!==void 0&&(ot.audioChannelConfiguration=Gt("audioChannelConfiguration",Dt.audioChannelConfiguration,Sn.audioChannelConfiguration)),Dt.role!==void 0&&Dt.role!==null&&(ot.role=Gt("role",Dt.role,Sn.role),ot.role.schemeIdUri===h.default.DASH_ROLE_SCHEME_ID&&ot.role.value==="Main"&&(ot.role.value=ye.default.MAIN)),Dt.accessibility!==void 0&&(ot.accessibility=Gt("accessibility",Dt.accessibility,Sn.accessibility)),ot})(Qe);G.setInitialSettings(_e,Lt)},setMute:function(_e){(0,gt.checkParameterType)(_e,"boolean"),Yt().muted=_e},setPlaybackRate:function(_e){Yt().playbackRate=_e},setProtectionData:function(_e){R=_e,W&&W.setProtectionData(R)},setRepresentationForTypeById:function(_e,Qe,Lt=!1){if(_e!==h.default.IMAGE&&_e!==h.default.VIDEO&&_e!==h.default.AUDIO)return;if(!B)throw p;const Dt=Mt();if(Dt)if(_e===h.default.IMAGE){const Sn=Dt.getThumbnailController();Sn&&Sn.setTrackById(Qe)}else{const Sn=Dt.getRepresentationForTypeById(_e,Qe);Sn&&te.manuallySetPlaybackQuality(_e,W.getActiveStreamInfo(),Sn,{forceReplace:Lt})}},setRepresentationForTypeByIndex:function(_e,Qe,Lt=!1){if(_e!==h.default.IMAGE&&_e!==h.default.VIDEO&&_e!==h.default.AUDIO)return;if(!B)throw p;const Dt=Mt();if(Dt)if(_e===h.default.IMAGE){const Sn=Dt.getThumbnailController();Sn&&Sn.setTrackByIndex(Qe)}else{const Sn=Dt.getRepresentationForTypeByIndex(_e,Qe);Sn&&te.manuallySetPlaybackQuality(_e,W.getActiveStreamInfo(),Sn,{forceReplace:Lt})}},setTextTrack:function(_e){if(!$)throw m;const Qe=W.getActiveStreamInfo();Qe&&re&&re.setTextTrack(Qe.id,_e)},setVolume:function(_e){if(typeof _e!="number"||isNaN(_e)||_e<0||_e>1)throw h.default.BAD_ARGUMENT_ERROR;Yt().volume=_e},setXHRWithCredentialsForType:function(_e,Qe){fe.setXHRWithCredentialsForType(_e,Qe)},time:qe,timeAsUTC:function(){if(!$)throw m;if(!ne.getIsDynamic()||qe()<0)return NaN;const _e=W&&W.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO;let Qe,Lt,Dt=me.getCurrentDVRInfo(_e);return Dt?(Qe=Dt.manifestInfo.availableFrom.getTime()/1e3,Lt=Qe+qe(),Lt):0},timeInDvrWindow:function(){if(!$)throw m;if(!ne.getIsDynamic())return qe();let _e=Yt().currentTime;const Qe=W&&W.hasVideoTrack()?h.default.VIDEO:h.default.AUDIO;let Lt=me.getCurrentDVRInfo(Qe);return _e=Lt===null||_e===0?0:Math.max(0,_e-Lt.range.start),_e},trigger:function(_e,Qe,Lt){k.trigger(_e,Qe,Lt)},triggerSteeringRequest:function(){if(z)return z.loadSteeringData()},unregisterCustomCapabilitiesFilter:function(_e){fe.unregisterCustomCapabilitiesFilter(_e)},unregisterLicenseRequestFilter:function(_e){fe.unregisterLicenseRequestFilter(_e)},unregisterLicenseResponseFilter:function(_e){fe.unregisterLicenseResponseFilter(_e)},updateSettings:function(_e){x.update(_e)},updateSource:function(_e){A=_e,W.load(A)}},O=I.getLogger(N),C=!1,$=!1,B=!1,V=!0,j=NaN,U=null,ge=null,R=null,X=null,bt=null,f.default.extend(y.default),be=Zp(S).getInstance(),fe=(0,ko.default)(S).getInstance(),ze=cE(S).getInstance(),Ye=lE(S).getInstance(),N}Qo.__dashjs_factory_name="MediaPlayer";const ks=n.default.getClassFactory(Qo);ks.events=y.default,ks.errors=Jt,n.default.updateClassFactory(Qo.__dashjs_factory_name,ks);var fE=ks},1191:function(u,e,t){t.r(e);var n=t(7252);class r extends n.default{constructor(){super(),this.AST_IN_FUTURE="astInFuture",this.BASE_URLS_UPDATED="baseUrlsUpdated",this.BUFFER_EMPTY="bufferStalled",this.BUFFER_LOADED="bufferLoaded",this.BUFFER_LEVEL_STATE_CHANGED="bufferStateChanged",this.BUFFER_LEVEL_UPDATED="bufferLevelUpdated",this.DVB_FONT_DOWNLOAD_ADDED="dvbFontDownloadAdded",this.DVB_FONT_DOWNLOAD_COMPLETE="dvbFontDownloadComplete",this.DVB_FONT_DOWNLOAD_FAILED="dvbFontDownloadFailed",this.DYNAMIC_TO_STATIC="dynamicToStatic",this.ERROR="error",this.FRAGMENT_LOADING_COMPLETED="fragmentLoadingCompleted",this.FRAGMENT_LOADING_PROGRESS="fragmentLoadingProgress",this.FRAGMENT_LOADING_STARTED="fragmentLoadingStarted",this.FRAGMENT_LOADING_ABANDONED="fragmentLoadingAbandoned",this.LOG="log",this.MANIFEST_LOADING_STARTED="manifestLoadingStarted",this.MANIFEST_LOADING_FINISHED="manifestLoadingFinished",this.MANIFEST_LOADED="manifestLoaded",this.METRICS_CHANGED="metricsChanged",this.METRIC_CHANGED="metricChanged",this.METRIC_ADDED="metricAdded",this.METRIC_UPDATED="metricUpdated",this.PERIOD_SWITCH_STARTED="periodSwitchStarted",this.PERIOD_SWITCH_COMPLETED="periodSwitchCompleted",this.QUALITY_CHANGE_REQUESTED="qualityChangeRequested",this.QUALITY_CHANGE_RENDERED="qualityChangeRendered",this.NEW_TRACK_SELECTED="newTrackSelected",this.TRACK_CHANGE_RENDERED="trackChangeRendered",this.STREAM_INITIALIZING="streamInitializing",this.STREAM_UPDATED="streamUpdated",this.STREAM_ACTIVATED="streamActivated",this.STREAM_DEACTIVATED="streamDeactivated",this.STREAM_INITIALIZED="streamInitialized",this.STREAM_TEARDOWN_COMPLETE="streamTeardownComplete",this.TEXT_TRACKS_ADDED="allTextTracksAdded",this.TEXT_TRACK_ADDED="textTrackAdded",this.CUE_ENTER="cueEnter",this.CUE_EXIT="cueExit",this.THROUGHPUT_MEASUREMENT_STORED="throughputMeasurementStored",this.TTML_PARSED="ttmlParsed",this.TTML_TO_PARSE="ttmlToParse",this.CAPTION_RENDERED="captionRendered",this.CAPTION_CONTAINER_RESIZE="captionContainerResize",this.CAN_PLAY="canPlay",this.CAN_PLAY_THROUGH="canPlayThrough",this.PLAYBACK_ENDED="playbackEnded",this.PLAYBACK_ERROR="playbackError",this.PLAYBACK_INITIALIZED="playbackInitialized",this.PLAYBACK_NOT_ALLOWED="playbackNotAllowed",this.PLAYBACK_METADATA_LOADED="playbackMetaDataLoaded",this.PLAYBACK_LOADED_DATA="playbackLoadedData",this.PLAYBACK_PAUSED="playbackPaused",this.PLAYBACK_PLAYING="playbackPlaying",this.PLAYBACK_PROGRESS="playbackProgress",this.PLAYBACK_RATE_CHANGED="playbackRateChanged",this.PLAYBACK_SEEKED="playbackSeeked",this.PLAYBACK_SEEKING="playbackSeeking",this.PLAYBACK_STALLED="playbackStalled",this.PLAYBACK_STARTED="playbackStarted",this.PLAYBACK_TIME_UPDATED="playbackTimeUpdated",this.PLAYBACK_VOLUME_CHANGED="playbackVolumeChanged",this.PLAYBACK_WAITING="playbackWaiting",this.MANIFEST_VALIDITY_CHANGED="manifestValidityChanged",this.EVENT_MODE_ON_START="eventModeOnStart",this.EVENT_MODE_ON_RECEIVE="eventModeOnReceive",this.CONFORMANCE_VIOLATION="conformanceViolation",this.REPRESENTATION_SWITCH="representationSwitch",this.ADAPTATION_SET_REMOVED_NO_CAPABILITIES="adaptationSetRemovedNoCapabilities",this.CONTENT_STEERING_REQUEST_COMPLETED="contentSteeringRequestCompleted",this.INBAND_PRFT="inbandPrft",this.MANAGED_MEDIA_SOURCE_START_STREAMING="managedMediaSourceStartStreaming",this.MANAGED_MEDIA_SOURCE_END_STREAMING="managedMediaSourceEndStreaming"}}let i=new r;e.default=i},5212:function(u,e,t){t.r(e),e.default={STREAM:"stream",VIDEO:"video",ENHANCEMENT:"enhancement",AUDIO:"audio",TEXT:"text",MUXED:"muxed",IMAGE:"image",STPP:"stpp",TTML:"ttml",VTT:"vtt",WVTT:"wvtt",CONTENT_STEERING:"contentSteering",LIVE_CATCHUP_MODE_DEFAULT:"liveCatchupModeDefault",LIVE_CATCHUP_MODE_LOLP:"liveCatchupModeLoLP",MOVING_AVERAGE_SLIDING_WINDOW:"slidingWindow",MOVING_AVERAGE_EWMA:"ewma",BAD_ARGUMENT_ERROR:"Invalid Arguments",MISSING_CONFIG_ERROR:"Missing config parameter(s)",TRACK_SWITCH_MODE_ALWAYS_REPLACE:"alwaysReplace",TRACK_SWITCH_MODE_NEVER_REPLACE:"neverReplace",TRACK_SELECTION_MODE_FIRST_TRACK:"firstTrack",TRACK_SELECTION_MODE_HIGHEST_BITRATE:"highestBitrate",TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:"highestEfficiency",TRACK_SELECTION_MODE_LOWEST_STARTUP_DELAY:"lowestStartupDelay",TRACK_SELECTION_MODE_WIDEST_RANGE:"widestRange",CMCD_QUERY_KEY:"CMCD",CMCD_MODE_QUERY:"query",CMCD_MODE_HEADER:"header",CMCD_AVAILABLE_KEYS:["br","d","ot","tb","bl","dl","mtp","nor","nrr","su","bs","rtp","cid","pr","sf","sid","st","v"],CMCD_V2_AVAILABLE_KEYS:["msd","ltc"],CMCD_AVAILABLE_REQUESTS:["segment","mpd","xlink","steering","other"],INITIALIZE:"initialize",TEXT_SHOWING:"showing",TEXT_HIDDEN:"hidden",TEXT_DISABLED:"disabled",ACCESSIBILITY_CEA608_SCHEME:"urn:scte:dash:cc:cea-608:2015",CC1:"CC1",CC3:"CC3",UTF8:"utf-8",SCHEME_ID_URI:"schemeIdUri",START_TIME:"starttime",SERVICE_DESCRIPTION_DVB_LL_SCHEME:"urn:dvb:dash:lowlatency:scope:2019",SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME:"urn:dvb:dash:lowlatency:critical:2019",CTA_5004_2023_SCHEME:"urn:mpeg:dash:cta-5004:2023",THUMBNAILS_SCHEME_ID_URIS:["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],FONT_DOWNLOAD_DVB_SCHEME:"urn:dvb:dash:fontdownload:2014",COLOUR_PRIMARIES_SCHEME_ID_URI:"urn:mpeg:mpegB:cicp:ColourPrimaries",URL_QUERY_INFO_SCHEME:"urn:mpeg:dash:urlparam:2014",EXT_URL_QUERY_INFO_SCHEME:"urn:mpeg:dash:urlparam:2016",MATRIX_COEFFICIENTS_SCHEME_ID_URI:"urn:mpeg:mpegB:cicp:MatrixCoefficients",TRANSFER_CHARACTERISTICS_SCHEME_ID_URI:"urn:mpeg:mpegB:cicp:TransferCharacteristics",SEGMENT_SEQUENCE_REPRESENTATION_SCHEME_ID_URI:"urn:mpeg:dash:ssr:2023",HDR_METADATA_FORMAT_SCHEME_ID_URI:"urn:dvb:dash:hdr-dmi",HDR_METADATA_FORMAT_VALUES:{ST2094_10:"ST2094-10",SL_HDR2:"SL-HDR2",ST2094_40:"ST2094-40"},MEDIA_CAPABILITIES_API:{COLORGAMUT:{SRGB:"srgb",P3:"p3",REC2020:"rec2020"},TRANSFERFUNCTION:{SRGB:"srgb",PQ:"pq",HLG:"hlg"},HDR_METADATATYPE:{SMPTE_ST_2094_10:"smpteSt2094-10",SLHDR2:"slhdr2",SMPTE_ST_2094_40:"smpteSt2094-40"}},XML:"XML",ARRAY_BUFFER:"ArrayBuffer",DVB_REPORTING_URL:"dvb:reportingUrl",DVB_PROBABILITY:"dvb:probability",OFF_MIMETYPE:"application/font-sfnt",WOFF_MIMETYPE:"application/font-woff",VIDEO_ELEMENT_READY_STATES:{HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},FILE_LOADER_TYPES:{FETCH:"fetch_loader",XHR:"xhr_loader"},THROUGHPUT_TYPES:{LATENCY:"throughput_type_latency",BANDWIDTH:"throughput_type_bandwidth"},THROUGHPUT_CALCULATION_MODES:{EWMA:"throughputCalculationModeEwma",ZLEMA:"throughputCalculationModeZlema",ARITHMETIC_MEAN:"throughputCalculationModeArithmeticMean",BYTE_SIZE_WEIGHTED_ARITHMETIC_MEAN:"throughputCalculationModeByteSizeWeightedArithmeticMean",DATE_WEIGHTED_ARITHMETIC_MEAN:"throughputCalculationModeDateWeightedArithmeticMean",HARMONIC_MEAN:"throughputCalculationModeHarmonicMean",BYTE_SIZE_WEIGHTED_HARMONIC_MEAN:"throughputCalculationModeByteSizeWeightedHarmonicMean",DATE_WEIGHTED_HARMONIC_MEAN:"throughputCalculationModeDateWeightedHarmonicMean"},LOW_LATENCY_DOWNLOAD_TIME_CALCULATION_MODE:{MOOF_PARSING:"lowLatencyDownloadTimeCalculationModeMoofParsing",DOWNLOADED_DATA:"lowLatencyDownloadTimeCalculationModeDownloadedData",AAST:"lowLatencyDownloadTimeCalculationModeAast"},RULES_TYPES:{QUALITY_SWITCH_RULES:"qualitySwitchRules",ABANDON_FRAGMENT_RULES:"abandonFragmentRules"},QUALITY_SWITCH_RULES:{BOLA_RULE:"BolaRule",THROUGHPUT_RULE:"ThroughputRule",INSUFFICIENT_BUFFER_RULE:"InsufficientBufferRule",SWITCH_HISTORY_RULE:"SwitchHistoryRule",DROPPED_FRAMES_RULE:"DroppedFramesRule",LEARN_TO_ADAPT_RULE:"L2ARule",LOL_PLUS_RULE:"LoLPRule"},ABANDON_FRAGMENT_RULES:{ABANDON_REQUEST_RULE:"AbandonRequestsRule"},ID3_SCHEME_ID_URI:"https://aomedia.org/emsg/ID3",COMMON_ACCESS_TOKEN_HEADER:"common-access-token",DASH_ROLE_SCHEME_ID:"urn:mpeg:dash:role:2011",CODEC_FAMILIES:{MP3:"mp3",AAC:"aac",AC3:"ac3",EC3:"ec3",DTSX:"dtsx",DTSC:"dtsc",AVC:"avc",HEVC:"hevc"}}},2861:function(u,e,t){t.r(e),e.default={CLEARKEY_KEYSTEM_STRING:"org.w3.clearkey",WIDEVINE_KEYSTEM_STRING:"com.widevine.alpha",PLAYREADY_KEYSTEM_STRING:"com.microsoft.playready",PLAYREADY_RECOMMENDATION_KEYSTEM_STRING:"com.microsoft.playready.recommendation",WIDEVINE_UUID:"edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",PLAYREADY_UUID:"9a04f079-9840-4286-ab92-e65be0885f95",CLEARKEY_UUID:"e2719d58-a985-b3c9-781a-b030af78d30e",W3C_CLEARKEY_UUID:"1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",INITIALIZATION_DATA_TYPE_CENC:"cenc",INITIALIZATION_DATA_TYPE_KEYIDS:"keyids",INITIALIZATION_DATA_TYPE_WEBM:"webm",ENCRYPTION_SCHEME_CENC:"cenc",ENCRYPTION_SCHEME_CBCS:"cbcs",MEDIA_KEY_MESSAGE_TYPES:{LICENSE_REQUEST:"license-request",LICENSE_RENEWAL:"license-renewal",LICENSE_RELEASE:"license-release",INDIVIDUALIZATION_REQUEST:"individualization-request"},ROBUSTNESS_STRINGS:{WIDEVINE:{SW_SECURE_CRYPTO:"SW_SECURE_CRYPTO",SW_SECURE_DECODE:"SW_SECURE_DECODE",HW_SECURE_CRYPTO:"HW_SECURE_CRYPTO",HW_SECURE_DECODE:"HW_SECURE_DECODE",HW_SECURE_ALL:"HW_SECURE_ALL"}},MEDIA_KEY_STATUSES:{USABLE:"usable",EXPIRED:"expired",RELEASED:"released",OUTPUT_RESTRICTED:"output-restricted",OUTPUT_DOWNSCALED:"output-downscaled",STATUS_PENDING:"status-pending",INTERNAL_ERROR:"internal-error"}}},4469:function(u,e,t){t.r(e),t.d(e,{default:function(){return D}});class n{constructor(){this.mpdurl=null,this.errorcode=null,this.terror=null,this.url=null,this.ipaddress=null,this.servicelocation=null}}n.SSL_CONNECTION_FAILED_PREFIX="SSL",n.DNS_RESOLUTION_FAILED="C00",n.HOST_UNREACHABLE="C01",n.CONNECTION_REFUSED="C02",n.CONNECTION_ERROR="C03",n.CORRUPT_MEDIA_ISOBMFF="M00",n.CORRUPT_MEDIA_OTHER="M01",n.BASE_URL_CHANGED="F00",n.BECAME_REPORTER="S00";var r=n,i=t(913),o=t(138);function l(oe){let F,Me;const We=(oe=oe||{}).eventBus,Ue=oe.dashMetrics,je=oe.metricsConstants,Oe=oe.events;function He(Kt){let kt=new r;if(Me){for(const Tn in Kt)Kt.hasOwnProperty(Tn)&&(kt[Tn]=Kt[Tn]);kt.mpdurl||(kt.mpdurl=Me.originalUrl||Me.url),kt.terror||(kt.terror=new Date),Ue.addDVBErrors(kt)}}function st(Kt){Kt.error||(Me=Kt.manifest)}function it(Kt){He({errorcode:r.BASE_URL_CHANGED,servicelocation:Kt.entry})}function Et(){He({errorcode:r.BECAME_REPORTER})}function nn(Kt){var kt;Kt.metric===je.HTTP_REQUEST&&((kt=Kt.value).responsecode===0||kt.responsecode==null||kt.responsecode>=400||kt.responsecode<100||kt.responsecode>=600)&&He({errorcode:kt.responsecode||r.CONNECTION_ERROR,url:kt.url,terror:kt.tresponse,servicelocation:kt._serviceLocation})}function Ut(Kt){let kt;switch(Kt.error?Kt.error.code:0){case MediaError.MEDIA_ERR_NETWORK:kt=r.CONNECTION_ERROR;break;case MediaError.MEDIA_ERR_DECODE:kt=r.CORRUPT_MEDIA_OTHER;break;default:return}He({errorcode:kt})}return F={initialize:function(){We.on(Oe.MANIFEST_UPDATED,st,F),We.on(Oe.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,it,F),We.on(Oe.METRIC_ADDED,nn,F),We.on(Oe.METRIC_UPDATED,nn,F),We.on(Oe.PLAYBACK_ERROR,Ut,F),We.on(i.default.BECAME_REPORTING_PLAYER,Et,F)},reset:function(){We.off(Oe.MANIFEST_UPDATED,st,F),We.off(Oe.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,it,F),We.off(Oe.METRIC_ADDED,nn,F),We.off(Oe.METRIC_UPDATED,nn,F),We.off(Oe.PLAYBACK_ERROR,Ut,F),We.off(i.default.BECAME_REPORTING_PLAYER,Et,F)}},F}l.__dashjs_factory_name="DVBErrorsTranslator";var d=o.default.getSingletonFactory(l),c=t(7377);function g(oe){oe=oe||{};let F,Me,We=!1,Ue=this.context,je=oe.mediaElement;return F={initialize:function(Oe){Oe&&Oe.length&&(Oe.forEach((He=>{let st=He.starttime,it=st+He.duration;Me.add(st,it)})),We=!!Oe[0]._useWallClockTime)},reset:function(){Me.clear()},isEnabled:function(){let Oe,He=Me.length;if(!He)return!0;Oe=We?new Date().getTime()/1e3:je.currentTime;for(let st=0;st<He;st+=1){let it=Me.start(st),Et=Me.end(st);if(it<=Oe&&Oe<Et)return!0}return!1}},Me=(0,c.default)(Ue).create(),F}g.__dashjs_factory_name="RangeController";var f=o.default.getClassFactory(g);function h(){return{serialise:function oe(F){let Me,We,Ue=[],je=[];for(Me in F)if(F.hasOwnProperty(Me)&&Me.indexOf("_")!==0){if(We=F[Me],We==null&&(We=""),Array.isArray(We)){if(!We.length)continue;je=[],We.forEach((function(Oe){let He=Object.prototype.toString.call(Oe).slice(8,-1)!=="Object";je.push(He?Oe:oe(Oe))})),We=je.map(encodeURIComponent).join(",")}else typeof We=="string"?We=encodeURIComponent(We):We instanceof Date?We=We.toISOString():typeof We=="number"&&(We=Math.round(We));Ue.push(Me+"="+We)}return Ue.join("&")}}}h.__dashjs_factory_name="MetricSerialiser";var y=o.default.getSingletonFactory(h);function E(){let oe,F,Me,We=window.crypto||window.msCrypto,Ue=Uint32Array,je=Math.pow(2,8*Ue.BYTES_PER_ELEMENT)-1;function Oe(){We&&(oe||(oe=new Ue(10)),We.getRandomValues(oe),F=0)}return Me={random:function(He,st){let it;return He||(He=0),st||(st=1),We?(F===oe.length&&Oe(),it=oe[F]/je,F+=1):it=Math.random(),it*(st-He)+He}},Oe(),Me}E.__dashjs_factory_name="RNG";var _=o.default.getSingletonFactory(E),L=t(1926);function K(oe){let F;oe=oe||{};let Me,We,Ue,je,Oe,He,st,it=this.context,Et=[];const nn=oe.metricsConstants;function Ut(){je=!1,Oe=!1,He=null,st=null}return F={report:function(Kt,kt){Array.isArray(kt)||(kt=[kt]),Oe&&st.isEnabled()&&kt.forEach((function(Tn){let Bn=Me.serialise(Tn);Kt!==nn.DVB_ERRORS&&(Bn=`metricname=${Kt}&${Bn}`),Bn=`${He}?${Bn}`,(function(Jn,gr,dr){let mr=new XMLHttpRequest;mr.withCredentials=We.getXHRWithCredentialsForType(nn.HTTP_REQUEST_DVB_REPORTING_TYPE);const jt=function(){let zt=Et.indexOf(mr);zt!==-1&&(Et.splice(zt,1),!(mr.status>=200&&mr.status<300)&&dr&&dr())};Et.push(mr);try{mr.open("GET",Jn),mr.onloadend=jt,mr.onerror=jt,mr.send()}catch{mr.onerror()}})(Bn,0,(function(){Oe=!1}))}))},initialize:function(Kt,kt){let Tn;if(st=kt,He=Kt.dvbReportingUrl,!He)throw new Error("required parameter missing (dvb:reportingUrl)");je||(Tn=Kt.dvbProbability,Tn&&(Tn===1e3||Tn/1e3>=Ue.random())&&(Oe=!0),je=!0)},reset:function(){Ut()}},Me=y(it).getInstance(),Ue=_(it).getInstance(),We=(0,L.default)(it).getInstance(),Ut(),F}K.__dashjs_factory_name="DVBReporting";var Z=o.default.getClassFactory(K);function ae(oe){oe=oe||{};const F={"urn:dvb:dash:reporting:2014":Z},Me=this.context;let We;const Ue=oe.debug?oe.debug.getLogger(We):{},je=oe.metricsConstants,Oe=oe.mediaPlayerModel||{};return We={create:function(He,st){let it;try{it=F[He.schemeIdUri](Me).create({metricsConstants:je,mediaPlayerModel:Oe}),it.initialize(He,st)}catch(Et){it=null,Ue.error(`ReportingFactory: could not create Reporting with schemeIdUri ${He.schemeIdUri} (${Et.message})`)}return it},register:function(He,st){F[He]=st},unregister:function(He){delete F[He]}},We}ae.__dashjs_factory_name="ReportingFactory";var pe=o.default.getSingletonFactory(ae);function xe(oe){let F,Me=[];const We=pe(this.context).getInstance(oe);return F={initialize:function(Ue,je){Ue.some((Oe=>{let He=We.create(Oe,je);if(He)return Me.push(He),!0}))},reset:function(){Me.forEach((Ue=>Ue.reset())),Me=[]},report:function(Ue,je){Me.forEach((Oe=>Oe.report(Ue,je)))}},F}xe.__dashjs_factory_name="ReportingController";var ke=o.default.getClassFactory(xe);function Y(){return{reconstructFullMetricName:function(oe,F,Me){let We=oe;return F&&(We+="("+F,Me&&Me.length&&(We+=","+Me),We+=")"),We},validateN:function(oe){if(!oe)throw new Error("missing n");if(isNaN(oe))throw new Error("n is NaN");if(oe<0)throw new Error("n must be positive");return oe}}}Y.__dashjs_factory_name="HandlerHelpers";var J=o.default.getSingletonFactory(Y);function he(oe){let F,Me,We,Ue,je,Oe;oe=oe||{};let He=this.context,st=J(He).getInstance(),it=[];const Et=oe.metricsConstants;function nn(){let Ut=(function(){try{return Object.keys(it).map((Kt=>it[Kt])).reduce(((Kt,kt)=>Kt.level<kt.level?Kt:kt))}catch{return}})();Ut&&Oe!==Ut.t&&(Oe=Ut.t,Me.report(Ue,Ut))}return F={initialize:function(Ut,Kt,kt){Kt&&(We=st.validateN(kt),Me=Kt,Ue=st.reconstructFullMetricName(Ut,kt),je=setInterval(nn,We))},reset:function(){clearInterval(je),je=null,We=0,Me=null,Oe=null},handleNewMetric:function(Ut,Kt,kt){Ut===Et.BUFFER_LEVEL&&(it[kt]=Kt)}},F}he.__dashjs_factory_name="BufferLevelHandler";var Ee=o.default.getClassFactory(he),Le=o.default.getClassFactory((function(oe){let F,Me,We=(oe=oe||{}).eventBus;const Ue=oe.metricsConstants;function je(){We.off(i.default.METRICS_INITIALISATION_COMPLETE,je,this),We.trigger(i.default.BECAME_REPORTING_PLAYER)}return F={initialize:function(Oe,He){He&&(Me=He,We.on(i.default.METRICS_INITIALISATION_COMPLETE,je,this))},reset:function(){Me=null},handleNewMetric:function(Oe,He){Oe===Ue.DVB_ERRORS&&Me&&Me.report(Oe,He)}},F}));function et(oe){let F,Me,We,Ue,je,Oe;oe=oe||{};let He=[],st=J(this.context).getInstance();const it=oe.metricsConstants;function Et(){var nn=He;nn.length&&Me&&Me.report(je,nn),He=[]}return F={initialize:function(nn,Ut,Kt,kt){Ut&&(We=st.validateN(Kt),Me=Ut,kt&&kt.length&&(Ue=kt),je=st.reconstructFullMetricName(nn,Kt,kt),Oe=setInterval(Et,We))},reset:function(){clearInterval(Oe),Oe=null,We=null,Ue=null,He=[],Me=null},handleNewMetric:function(nn,Ut){nn===it.HTTP_REQUEST&&(Ue&&Ue!==Ut.type||He.push(Ut))}},F}et.__dashjs_factory_name="HttpListHandler";var Ae=o.default.getClassFactory(et);function Ze(){let oe,F,Me;return oe={initialize:function(We,Ue){F=We,Me=Ue},reset:function(){Me=null,F=void 0},handleNewMetric:function(We,Ue){We===F&&Me&&Me.report(F,Ue)}},oe}Ze.__dashjs_factory_name="GenericMetricHandler";var Be=o.default.getClassFactory(Ze);function Ne(oe){let F;const Me=(oe=oe||{}).debug?oe.debug.getLogger(F):{};let We=/([a-zA-Z]*)(\(([0-9]*)(\,\s*([a-zA-Z]*))?\))?/;const Ue=this.context;let je={BufferLevel:Ee,DVBErrors:Le,HttpList:Ae,PlayList:Be,RepSwitchList:Be,TcpList:Be};return F={create:function(Oe,He){var st,it=Oe.match(We);if(it){try{(st=je[it[1]](Ue).create({eventBus:oe.eventBus,metricsConstants:oe.metricsConstants})).initialize(it[1],He,it[3],it[5])}catch(Et){st=null,Me.error(`MetricsHandlerFactory: Could not create handler for type ${it[1]} with args ${it[3]}, ${it[5]} (${Et.message})`)}return st}},register:function(Oe,He){je[Oe]=He},unregister:function(Oe){delete je[Oe]}},F}Ne.__dashjs_factory_name="MetricsHandlerFactory";var tt=o.default.getSingletonFactory(Ne);function mt(oe){oe=oe||{};let F,Me=[];const We=this.context,Ue=oe.eventBus,je=oe.events;let Oe=tt(We).getInstance({debug:oe.debug,eventBus:oe.eventBus,metricsConstants:oe.metricsConstants});function He(st){Me.forEach((it=>{it.handleNewMetric(st.metric,st.value,st.mediaType)}))}return F={initialize:function(st,it){st.split(",").forEach(((Et,nn,Ut)=>{let Kt;if(Et.indexOf("(")!==-1&&Et.indexOf(")")===-1){let kt=Ut[nn+1];kt&&kt.indexOf("(")===-1&&kt.indexOf(")")!==-1&&(Et+=","+kt,delete Ut[nn+1])}Kt=Oe.create(Et,it),Kt&&Me.push(Kt)})),Ue.on(je.METRIC_ADDED,He,F),Ue.on(je.METRIC_UPDATED,He,F)},reset:function(){Ue.off(je.METRIC_ADDED,He,F),Ue.off(je.METRIC_UPDATED,He,F),Me.forEach((st=>st.reset())),Me=[]}},F}mt.__dashjs_factory_name="MetricsHandlersController";var Ge=o.default.getClassFactory(mt);function ut(oe){let F,Me,We,Ue;oe=oe||{};let je=this.context;function Oe(){F&&F.reset(),Me&&Me.reset(),We&&We.reset()}return Ue={initialize:function(He){try{We=f(je).create({mediaElement:oe.mediaElement}),We.initialize(He.Range),Me=ke(je).create({debug:oe.debug,metricsConstants:oe.metricsConstants,mediaPlayerModel:oe.mediaPlayerModel}),Me.initialize(He.Reporting,We),F=Ge(je).create({debug:oe.debug,eventBus:oe.eventBus,metricsConstants:oe.metricsConstants,events:oe.events}),F.initialize(He.metrics,Me)}catch(st){throw Oe(),st}},reset:Oe},Ue}ut.__dashjs_factory_name="MetricsController";var Xe=o.default.getClassFactory(ut),nt=class{constructor(){this.metrics="",this.Range=[],this.Reporting=[]}},Ft=class{constructor(){this.starttime=0,this.duration=1/0,this._useWallClockTime=!1}},Xt=class{constructor(){this.schemeIdUri="",this.value="",this.dvbReportingUrl="",this.dvbProbability=1e3}};function Pe(oe){let F,Me=(oe=oe||{}).adapter;const We=oe.constants;return F={getMetrics:function(Ue){let je=[];return Ue&&Ue.Metrics&&Ue.Metrics.forEach((Oe=>{var He=new nt,st=Me.getIsDynamic(Ue);Oe.hasOwnProperty("metrics")&&(He.metrics=Oe.metrics,Oe.Range&&Oe.Range.forEach((it=>{var Et=new Ft;Et.starttime=(function(nn,Ut,Kt){let kt,Tn,Bn=0;return Ut?Bn=Me.getAvailabilityStartTime(nn)/1e3:(kt=Me.getRegularPeriods(nn),kt.length&&(Bn=kt[0].start)),Tn=Bn,Kt&&Kt.hasOwnProperty(We.START_TIME)&&(Tn+=Kt.starttime),Tn})(Ue,st,it),it.hasOwnProperty("duration")?Et.duration=it.duration:Et.duration=Me.getDuration(Ue),Et._useWallClockTime=st,He.Range.push(Et)})),Oe.Reporting&&(Oe.Reporting.forEach((it=>{var Et=new Xt;it.hasOwnProperty(We.SCHEME_ID_URI)&&(Et.schemeIdUri=it.schemeIdUri,it.hasOwnProperty("value")&&(Et.value=it.value),it.hasOwnProperty(We.DVB_REPORTING_URL)&&(Et.dvbReportingUrl=it[We.DVB_REPORTING_URL]),it.hasOwnProperty(We.DVB_PROBABILITY)&&(Et.dvbProbability=it[We.DVB_PROBABILITY]),He.Reporting.push(Et))})),je.push(He)))})),je}},F}Pe.__dashjs_factory_name="ManifestParsing";var De=o.default.getSingletonFactory(Pe);function dt(oe){let F;oe=oe||{};let Me={},We=this.context,Ue=oe.eventBus;const je=oe.events;function Oe(st){if(st.error)return;let it=Object.keys(Me);De(We).getInstance({adapter:oe.adapter,constants:oe.constants}).getMetrics(st.manifest).forEach((Et=>{const nn=JSON.stringify(Et);if(Me.hasOwnProperty(nn))it.splice(nn,1);else try{let Ut=Xe(We).create(oe);Ut.initialize(Et),Me[nn]=Ut}catch{}})),it.forEach((Et=>{Me[Et].reset(),delete Me[Et]})),Ue.trigger(i.default.METRICS_INITIALISATION_COMPLETE)}function He(){Object.keys(Me).forEach((st=>{Me[st].reset()})),Me={}}return F={reset:function(){Ue.off(je.MANIFEST_UPDATED,Oe,F),Ue.off(je.STREAM_TEARDOWN_COMPLETE,He,F)}},Ue.on(je.MANIFEST_UPDATED,Oe,F),Ue.on(je.STREAM_TEARDOWN_COMPLETE,He,F),F}dt.__dashjs_factory_name="MetricsCollectionController";var Q=o.default.getClassFactory(dt);function H(){let oe,F,Me=this.context;return oe={createMetricsReporting:function(We){return F=d(Me).getInstance({eventBus:We.eventBus,dashMetrics:We.dashMetrics,metricsConstants:We.metricsConstants,events:We.events}),F.initialize(),Q(Me).create(We)},getReportingFactory:function(){return pe(Me).getInstance()},getMetricsHandlerFactory:function(){return tt(Me).getInstance()}},oe}H.__dashjs_factory_name="MetricsReporting";const w=o.default.getClassFactory(H);w.events=i.default,o.default.updateClassFactory(H.__dashjs_factory_name,w);var D=w},913:function(u,e,t){t.r(e);var n=t(7252);class r extends n.default{constructor(){super(),this.METRICS_INITIALISATION_COMPLETE="internal_metricsReportingInitialized",this.BECAME_REPORTING_PLAYER="internal_becameReportingPlayer",this.CMCD_DATA_GENERATED="cmcdDataGenerated"}}let i=new r;e.default=i},1926:function(u,e,t){t.r(e);var n=t(5717),r=t(138),i=t(8261),o=t(656),l=t(5212),d=t(5560);function c(){let g,f,h,y,E,_,L,K,Z,ae,pe;const xe=this.context,ke=(0,i.default)(xe).getInstance();function Y(){y=[],E=[],_=[],L=[],K=[],pe=[],Z=null,f=[],ae=new Set}function J(Ae,Ze){let Be=-1;Ae.some(((Ne,tt)=>{if(Ne===Ze)return Be=tt,!0})),Be<0||Ae.splice(Be,1)}function he(Ae){let Ze;for(Ze=0;Ze<pe.length;Ze++)if(pe[Ze].rulename===Ae)return Ze;return-1}function Ee(Ae,Ze){let Be=!1;return ae.forEach((Ne=>{Ne[Ae]===Ze&&(Be=!0)})),Be}function Le(Ae,Ze){et(Ae,Ze);let Be=new n.default;Be.schemeIdUri=Ae,Be.value=Ze,f.push(Be)}function et(Ae,Ze){(0,o.checkParameterType)(Ae,"string"),(0,o.checkParameterType)(Ze,"string"),f.forEach((function(Be,Ne){Be.schemeIdUri===Ae&&Be.value===Ze&&f.splice(Ne,1)}))}return g={addAbrCustomRule:function(Ae,Ze,Be){if(typeof Ae!="string"||Ae!==l.default.RULES_TYPES.ABANDON_FRAGMENT_RULES&&Ae!==l.default.RULES_TYPES.QUALITY_SWITCH_RULES||typeof Ze!="string")throw l.default.BAD_ARGUMENT_ERROR;let Ne=he(Ze);Ne===-1?pe.push({type:Ae,rulename:Ze,rule:Be}):(pe[Ne].type=Ae,pe[Ne].rule=Be)},addExternalSubtitle:function(Ae){if(!(Ae&&Ae.id!==void 0&&Ae.url&&Ae.language&&Ae.mimeType&&Ae.bandwidth!==void 0))return;const Ze=new d.default(Ae);Ee("url",Ze.url)||Ee("id",Ze.id)||ae.add(Ze)},addRequestInterceptor:function(Ae){y.push(Ae)},addResponseInterceptor:function(Ae){E.push(Ae)},addUTCTimingSource:Le,clearDefaultUTCTimingSources:function(){f=[]},getAbrCustomRules:function(){return pe},getCustomCapabilitiesFilters:function(){return K},getCustomInitialTrackSelectionFunction:function(){return Z},getExternalSubtitles:function(){return ae},getLicenseRequestFilters:function(){return _},getLicenseResponseFilters:function(){return L},getRequestInterceptors:function(){return y},getResponseInterceptors:function(){return E},getUTCTimingSources:function(){return f},getXHRWithCredentialsForType:function(Ae){const Ze=h[Ae];return Ze===void 0?h.default:Ze},registerCustomCapabilitiesFilter:function(Ae){K.push(Ae)},registerLicenseRequestFilter:function(Ae){_.push(Ae)},registerLicenseResponseFilter:function(Ae){L.push(Ae)},removeAbrCustomRule:function(Ae){if(Ae){let Ze=he(Ae);Ze!==-1&&pe.splice(Ze,1)}else pe=[]},removeAllAbrCustomRule:function(){pe=[]},removeExternalSubtitleById:function(Ae){ae.forEach((Ze=>{Ze.id===Ae&&ae.delete(Ze)}))},removeExternalSubtitleByUrl:function(Ae){ae.forEach((Ze=>{Ze.url===Ae&&ae.delete(Ze)}))},removeRequestInterceptor:function(Ae){J(y,Ae)},removeResponseInterceptor:function(Ae){J(E,Ae)},removeUTCTimingSource:et,reset:function(){Y()},resetCustomInitialTrackSelectionFunction:function(){Z=null},resetPlaybackSessionSpecificSettings:function(){ae=new Set},restoreDefaultUTCTimingSources:function(){let Ae=ke.get().streaming.utcSynchronization.defaultTimingSource;Le(Ae.scheme,Ae.value)},setConfig:function(){},setCustomInitialTrackSelectionFunction:function(Ae){Z=Ae},setXHRWithCredentialsForType:function Ae(Ze,Be){Ze?h[Ze]=!!Be:Object.keys(h).forEach((Ne=>{Ae(Ne,Be)}))},unregisterCustomCapabilitiesFilter:function(Ae){J(K,Ae)},unregisterLicenseRequestFilter:function(Ae){J(_,Ae)},unregisterLicenseResponseFilter:function(Ae){J(L,Ae)}},h={default:!1},Y(),g}c.__dashjs_factory_name="CustomParametersModel",e.default=r.default.getSingletonFactory(c)},3888:function(u,e,t){t.r(e),t.d(e,{default:function(){return mr}});var n=t(8854),r=t(2861);const i={prefixes:["clearkey","dashif","ck"]};class o{static findMp4ProtectionElement(zt){let St=null;for(let ht=0;ht<zt.length;++ht){let qt=zt[ht];qt.schemeIdUri&&qt.schemeIdUri.toLowerCase()===n.default.MP4_PROTECTION_SCHEME&&qt.value&&(qt.value.toLowerCase()===r.default.ENCRYPTION_SCHEME_CENC||qt.value.toLowerCase()===r.default.ENCRYPTION_SCHEME_CBCS)&&(St=qt)}return St}static getPSSHData(zt){let St=8,ht=new DataView(zt),qt=ht.getUint8(St);return St+=20,qt>0&&(St+=4+16*ht.getUint32(St)),St+=4,zt.slice(St)}static getPSSHForKeySystem(zt,St){let ht=o.parsePSSHList(St);return zt&&ht.hasOwnProperty(zt.uuid.toLowerCase())?ht[zt.uuid.toLowerCase()]:null}static parseInitDataFromContentProtection(zt,St){return"pssh"in zt&&zt.pssh?(zt.pssh.__text=zt.pssh.__text.replace(/\r?\n|\r/g,"").replace(/\s+/g,""),St.decodeArray(zt.pssh.__text).buffer):null}static parsePSSHList(zt){if(zt==null)return[];let St=new DataView(zt.buffer||zt),ht={},qt=0;for(;;){let Bt,Vt,en,wt,Rt,Ht,Jt=qt;if(qt>=St.buffer.byteLength)break;if(Bt=St.getUint32(qt),Vt=qt+Bt,qt+=4,St.getUint32(qt)===1886614376)if(qt+=4,en=St.getUint8(qt),en===0||en===1){for(qt++,qt+=3,wt="",Rt=0;Rt<4;Rt++)Ht=St.getUint8(qt+Rt).toString(16),wt+=Ht.length===1?"0"+Ht:Ht;for(qt+=4,wt+="-",Rt=0;Rt<2;Rt++)Ht=St.getUint8(qt+Rt).toString(16),wt+=Ht.length===1?"0"+Ht:Ht;for(qt+=2,wt+="-",Rt=0;Rt<2;Rt++)Ht=St.getUint8(qt+Rt).toString(16),wt+=Ht.length===1?"0"+Ht:Ht;for(qt+=2,wt+="-",Rt=0;Rt<2;Rt++)Ht=St.getUint8(qt+Rt).toString(16),wt+=Ht.length===1?"0"+Ht:Ht;for(qt+=2,wt+="-",Rt=0;Rt<6;Rt++)Ht=St.getUint8(qt+Rt).toString(16),wt+=Ht.length===1?"0"+Ht:Ht;qt+=6,wt=wt.toLowerCase(),qt+=4,ht[wt]=St.buffer.slice(Jt,Vt),qt=Vt}else qt=Vt;else qt=Vt}return ht}static getLicenseServerUrlFromMediaInfo(zt,St){try{if(!zt||zt.length===0)return null;let ht=0,qt=null;for(;ht<zt.length&&!qt;){const Bt=zt[ht];if(Bt&&Bt.contentProtection&&Bt.contentProtection.length>0){const Vt=Bt.contentProtection.filter((en=>en.schemeIdUri&&en.schemeIdUri===St));if(Vt&&Vt.length>0){let en=0;for(;en<Vt.length&&!qt;){const wt=Vt[en];wt.laUrl&&wt.laUrl.__prefix&&i.prefixes.includes(wt.laUrl.__prefix)&&wt.laUrl.__text&&(qt=wt.laUrl.__text),en+=1}}}ht+=1}return qt}catch{return null}}static hexKidToBufferSource(zt){const St=zt.replace(/-/g,"");return new Uint8Array(St.match(/[\da-f]{2}/gi).map((function(ht){return parseInt(ht,16)}))).buffer}}var l=o,d=class{constructor(jt,zt){this.contentType=jt,this.robustness=zt}},c=class{constructor(jt,zt,St,ht,qt,Bt){this.initDataTypes=Bt&&Bt.length>0?Bt:[r.default.INITIALIZATION_DATA_TYPE_CENC],jt&&jt.length&&(this.audioCapabilities=jt),zt&&zt.length&&(this.videoCapabilities=zt),this.distinctiveIdentifier=St,this.persistentState=ht,this.sessionTypes=qt}},g=t(1923),f=t(1944),h=class{constructor(jt,zt,St,ht,qt,Bt,Vt,en){this.url=jt,this.method=zt,this.responseType=St,this.headers=ht,this.withCredentials=qt,this.messageType=Bt,this.sessionId=Vt,this.data=en}},y=class{constructor(jt,zt,St){this.url=jt,this.headers=zt,this.data=St}},E=t(7568),_=t(7263),L=t(5212),K=t(138);function Z(jt){const zt=(jt=jt||{}).BASE64,St=jt.cmcdModel,ht=jt.constants,qt=jt.customParametersModel,Bt=jt.debug,Vt=jt.eventBus,en=jt.events,wt=jt.protectionKeyController,Rt=jt.settings;let Ht,Jt,Pt,sn,An,gn,pn,Nn,Wt,gt,Je,$t,tn=jt.protectionModel,bn=[];function Mn(){if(!(Vt&&Vt.hasOwnProperty("on")&&wt&&wt.hasOwnProperty("getSupportedKeySystemMetadataFromContentProtection")))throw new Error("Missing config parameter(s)")}function $n(Nt,rn){Je||sn?Je&&fr():(function(yn,Pn){if(sn)return;var Ln;sn=!0;const Vn=(function(qn){const jn=[];for(let Fn=0;Fn<qn.length;Fn++){const Kn=Hn(qn[Fn]);jn.push({ks:qn[Fn].ks,configs:[Kn],protData:qn[Fn].protData})}return jn})(yn=(Ln=yn).sort(((qn,jn)=>(Ht&&Ht[qn.ks.systemString]&&Ht[qn.ks.systemString].priority>=0?Ht[qn.ks.systemString].priority:Ln.length)-(Ht&&Ht[jn.ks.systemString]&&Ht[jn.ks.systemString].priority>=0?Ht[jn.ks.systemString].priority:Ln.length))));let er;tn.requestKeySystemAccess(Vn).then((qn=>(er=qn.data,(function(jn){let Fn=jn&&jn.selectedSystemString?jn.selectedSystemString:jn.keySystem.systemString;return pn.info("DRM: KeySystem Access Granted for system string ("+Fn+")! Selecting key system..."),tn.selectKeySystem(jn)})(er)))).then((qn=>{(function(jn,Fn){try{Je=jn,sn=!1,Vt.trigger(en.KEY_SYSTEM_SELECTED,{data:Fn});const Kn=hr(Je);Kn&&Kn.serverCertificate&&Kn.serverCertificate.length>0&&tn.setServerCertificate(zt.decodeArray(Kn.serverCertificate).buffer),fr()}catch(Kn){pn.error(Kn)}})(qn,er)})).catch((qn=>{(function(jn,Fn){Je=null,sn=!1,Fn||Vt.trigger(en.KEY_SYSTEM_SELECTED,{data:null,error:new f.default(g.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,g.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+"Error selecting key system! -- "+jn.error)})})(qn,Pn)}))})(Nt,rn)}function fr(){let Nt;for(let yn=0;yn<Wt.length;yn++)for(Nt=0;Nt<Wt[yn].length;Nt++)if(Je===Wt[yn][Nt].ks){rn=Wt[yn][Nt],wt.isClearKey(Je)&&(function(Pn){if(Pn.protData&&Pn.protData.hasOwnProperty("clearkeys")&&Object.keys(Pn.protData.clearkeys).length!==0){const Ln={kids:Object.keys(Pn.protData.clearkeys)};Pn.initData=new TextEncoder().encode(JSON.stringify(Ln))}})(rn),rn.sessionId?ar(rn):rn.initData!==null&&ye(rn);break}var rn;Wt=[]}function Hn(Nt){const rn=Nt.protData,yn=[],Pn=[],Ln=rn&&rn.initDataTypes&&rn.initDataTypes.length>0?rn.initDataTypes:[r.default.INITIALIZATION_DATA_TYPE_CENC],Vn=rn&&rn.audioRobustness&&rn.audioRobustness.length>0?rn.audioRobustness:gt,er=rn&&rn.videoRobustness&&rn.videoRobustness.length>0?rn.videoRobustness:gt,qn=Nt.sessionType,jn=rn&&rn.distinctiveIdentifier?rn.distinctiveIdentifier:"optional",Fn=rn&&rn.persistentState?rn.persistentState:qn==="temporary"?"optional":"required";return Nn.forEach((Kn=>{Kn.type===ht.AUDIO?yn.push(new d(Kn.codec,Vn)):Kn.type===ht.VIDEO&&Pn.push(new d(Kn.codec,er))})),new c(yn,Pn,jn,Fn,[qn],Ln)}function ar(Nt){Mn(),tn.loadKeySession(Nt)}function ye(Nt){if(Nt&&(function(yn){if(!yn)return!1;try{const Pn=tn.getSessionTokens();for(let Ln=0;Ln<Pn.length;Ln++)if(Pn[Ln].getKeyId()===yn)return!0;return!1}catch{return!1}})(Nt.keyId))return;(function(){if(!Rt)return;const yn=Rt.get().streaming.protection.keepProtectionMediaKeys,Pn=Rt.get().streaming.protection.keepProtectionMediaKeysMaximumOpenSessions;if(typeof Pn!="number"||Pn<=0)return;if(!yn)return void pn.warn("DRM: keepProtectionMediaKeysMaximumOpenSessions is set to "+Pn+", but keepProtectionMediaKeys is not enabled. Therefore, keepProtectionMediaKeysMaximumOpenSessions will be ignored.");if(!tn||typeof tn.getSessionTokens!="function")return;const Ln=tn.getSessionTokens()||[];if(Ln.length<Pn)return;const Vn=Ln[0];Vn&&(pn.info("DRM: Maximum number of open MediaKeySessions reached ("+Pn+"), closing oldest session."),Si(Vn))})();const rn=l.getPSSHForKeySystem(Je,Nt?Nt.initData:null);if(rn){if(Gr(rn))return;try{Nt.initData=rn,tn.createKeySession(Nt)}catch(yn){Vt.trigger(en.KEY_SESSION_CREATED,{data:null,error:new f.default(g.default.KEY_SESSION_CREATED_ERROR_CODE,g.default.KEY_SESSION_CREATED_ERROR_MESSAGE+yn.message)})}}else Nt&&Nt.initData?tn.createKeySession(Nt):Vt.trigger(en.KEY_SESSION_CREATED,{data:null,error:new f.default(g.default.KEY_SESSION_CREATED_ERROR_CODE,g.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Selected key system is "+(Je?Je.systemString:null)+". needkey/encrypted event contains no initData corresponding to that key system!")})}function hr(Nt){if(Nt){const rn=Nt.systemString;if(Ht)return rn in Ht?Ht[rn]:null}return null}function Gr(Nt){if(!Nt)return!1;try{const rn=tn.getAllInitData();for(let yn=0;yn<rn.length;yn++)if(wt.initDataEquals(Nt,rn[yn]))return pn.debug("DRM: Ignoring initData because we have already seen it!"),!0;return!1}catch{return!1}}function Si(Nt){Mn(),tn.closeKeySession(Nt)}function xr(Nt){Mn(),Nt?(tn.setMediaElement(Nt),Vt.on(en.NEED_KEY,Pi,Jt)):Nt===null&&(tn.setMediaElement(Nt),Vt.off(en.NEED_KEY,Pi,Jt))}function Wi(Nt){pn.debug("DRM: onKeyMessage");const rn=Nt.data;Vt.trigger(en.KEY_MESSAGE,{data:rn});const yn=rn.messageType?rn.messageType:r.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_REQUEST,Pn=rn.message,Ln=rn.sessionToken,Vn=hr(Je),er=wt.getLicenseServerModelInstance(Je,Vn,yn),qn={sessionToken:Ln,messageType:yn};if(Pn&&Pn.byteLength!==0){if(!er)return pn.debug("DRM: License server request not required for this message (type = "+Nt.data.messageType+"). Session ID = "+Ln.getSessionId()),void wr(qn);if(wt.isClearKey(Je)){const jn=wt.processClearKeyLicenseRequest(Je,Vn,Pn);if(jn&&jn.keyPairs&&jn.keyPairs.length>0)return pn.debug("DRM: ClearKey license request handled by application!"),wr(qn),void tn.updateKeySession(Ln,jn)}(function(jn,Fn,Kn){const Zr=jn.sessionToken,Jr=jn.messageType?jn.messageType:r.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_REQUEST,ei={sessionToken:Zr,messageType:Jr},_i=Je?Je.systemString:null;let us=(function(Wn,Mi,Qi,$r,hs){let Dr=null;const gs=$r.message;if(Wn&&Wn.serverURL){const ti=Wn.serverURL;typeof ti=="string"&&ti!==""?Dr=ti:typeof ti=="object"&&ti.hasOwnProperty(Mi)&&(Dr=ti[Mi])}else if(Wn&&Wn.laURL&&Wn.laURL!=="")Dr=Wn.laURL;else if(Dr=l.getLicenseServerUrlFromMediaInfo(Nn,Je.schemeIdURI),!Dr&&!wt.isClearKey(Je)){const ti=l.getPSSHData(Qi.initData);Dr=Je.getLicenseServerURLFromInitData(ti),Dr||(Dr=$r.laURL)}return Dr=hs.getServerURLFromMessage(Dr,gs,Mi),Dr})(Kn,Jr,Zr,jn,Fn);if(!us)return void wr(ei,new f.default(g.default.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE,g.default.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE));const Xi={};let Lr=!1;Kn&&Ma(Xi,Kn.httpRequestHeaders);const Ni=jn.message;Ma(Xi,Je.getRequestHeadersFromMessage(Ni)),Object.keys(Xi).forEach((Wn=>{Wn.toLowerCase()==="authorization"&&(Lr=!0)})),Kn&&typeof Kn.withCredentials=="boolean"&&(Lr=Kn.withCredentials);const br=function(Wn){if(tn)if(Wn.status>=200&&Wn.status<=299){const Mi=_.default.parseHttpHeaders(Wn.getAllResponseHeaders?Wn.getAllResponseHeaders():null);let Qi=new y(Wn.responseURL,Mi,Wn.response);Oa(qt.getLicenseResponseFilters(),Qi).then((()=>{const $r=Fn.getLicenseMessage(Qi.data,_i,Jr);$r!==null?(wr(ei),tn.updateKeySession(Zr,$r)):os(Wn,ei,_i,Jr,Fn)}))}else os(Wn,ei,_i,Jr,Fn)},cs=function(Wn){wr(ei,new f.default(g.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,g.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+_i+' update, XHR aborted. status is "'+Wn.statusText+'" ('+Wn.status+"), readyState is "+Wn.readyState))},Yn=function(Wn){wr(ei,new f.default(g.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,g.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+_i+' update, XHR error. status is "'+Wn.statusText+'" ('+Wn.status+"), readyState is "+Wn.readyState))},Fa=Je.getLicenseRequestFromMessage(Ni),Ua=Fn.getHTTPMethod(Jr),za=Fn.getResponseType(_i,Jr),Ba=Kn&&!isNaN(Kn.httpTimeout)?Kn.httpTimeout:8e3,ds=Zr.getSessionId()||null;let ja=new h(us,Ua,za,Xi,Lr,Jr,ds,Fa);const fs=isNaN(Rt.get().streaming.retryAttempts[E.HTTPRequest.LICENSE])?3:Rt.get().streaming.retryAttempts[E.HTTPRequest.LICENSE];Oa(qt.getLicenseRequestFilters(),ja).then((()=>{Na(ja,fs,Ba,br,cs,Yn)}))})(rn,er,Vn)}else wr(qn,new f.default(g.default.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE,g.default.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE))}function wr(Nt,rn=null){Vt.trigger(en.LICENSE_REQUEST_COMPLETE,{data:Nt,error:rn})}function Na(Nt,rn,yn,Pn,Ln,Vn){const er=new XMLHttpRequest,qn=St.getCmcdParametersFromManifest();if(St.isCmcdEnabled()&&(qn.mode?qn.mode:Rt.get().streaming.cmcd.mode)===L.default.CMCD_MODE_QUERY){const Fn=St.getQueryParameter({url:Nt.url,type:E.HTTPRequest.LICENSE});Fn&&(Nt.url=_.default.addAdditionalQueryParameterToUrl(Nt.url,[Fn]))}er.open(Nt.method,Nt.url,!0),er.responseType=Nt.responseType,er.withCredentials=Nt.withCredentials,yn>0&&(er.timeout=yn);for(const Fn in Nt.headers)er.setRequestHeader(Fn,Nt.headers[Fn]);if(St.isCmcdEnabled()&&(qn.mode?qn.mode:Rt.get().streaming.cmcd.mode)===L.default.CMCD_MODE_HEADER){const Fn=St.getHeaderParameters({url:Nt.url,type:E.HTTPRequest.LICENSE});if(Fn)for(const Kn in Fn){let Zr=Fn[Kn];Zr&&er.setRequestHeader(Kn,Zr)}}const jn=function(){rn--;const Fn=isNaN(Rt.get().streaming.retryIntervals[E.HTTPRequest.LICENSE])?1e3:Rt.get().streaming.retryIntervals[E.HTTPRequest.LICENSE];An=setTimeout((function(){Na(Nt,rn,yn,Pn,Ln,Vn)}),Fn)};er.onload=function(){gn=null,this.status>=200&&this.status<=299||rn<=0?Pn(this):(pn.warn("License request failed ("+this.status+"). Retrying it... Pending retries: "+rn),jn())},er.ontimeout=er.onerror=function(){gn=null,rn<=0?Vn(this):(pn.warn("License request network request failed . Retrying it... Pending retries: "+rn),jn())},er.onabort=function(){Ln(this)},Vt.trigger(en.LICENSE_REQUEST_SENDING,{url:Nt.url,headers:Nt.headers,payload:Nt.data,sessionId:Nt.sessionId}),gn=er,er.send(Nt.data)}function ss(){gn&&(gn.onloadend=gn.onerror=gn.onprogress=void 0,gn.abort(),gn=null),An&&(clearTimeout(An),An=null)}function Ma(Nt,rn){if(rn)for(const yn in rn)Nt[yn]=rn[yn]}function os(Nt,rn,yn,Pn,Ln){let Vn="NONE",er=null;Nt.response&&(Vn=Ln.getErrorResponse(Nt.response,yn,Pn),er={serverResponse:Nt.response||null,responseCode:Nt.status||null,responseText:Nt.statusText||null}),wr(rn,new f.default(g.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,g.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+yn+' update, XHR complete. status is "'+Nt.statusText+'" ('+Nt.status+"), readyState is "+Nt.readyState+". Response is "+Vn,er))}function Oa(Nt,rn){return Nt?Nt.reduce(((yn,Pn)=>yn.then((()=>Pn(rn)))),Promise.resolve()):Promise.resolve()}function Pi(Nt,rn){if(Rt.get().streaming.protection.ignoreEmeEncryptedEvent)return;if(pn.debug("DRM: onNeedKey"),Nt.key.initDataType!==r.default.INITIALIZATION_DATA_TYPE_CENC)return void pn.warn("DRM: Only 'cenc' initData is supported! Ignoring initData of type: "+Nt.key.initDataType);if(Nn.length===0&&(pn.warn("DRM: onNeedKey called before initializeForMedia, wait until initialized"),(rn=rn===void 0?1:rn+1)<5))return void bn.push(setTimeout((()=>{Pi(Nt,rn)}),500));let yn=Nt.key.initData;if(ArrayBuffer.isView(yn)&&(yn=yn.buffer),Je){const Ln=l.getPSSHForKeySystem(Je,yn);if(Ln&&Gr(Ln))return}pn.debug("DRM: initData:",String.fromCharCode.apply(null,new Uint8Array(yn)));const Pn=wt.getSupportedKeySystemMetadataFromSegmentPssh(yn,Ht,$t);Pn.length!==0?(function(Ln){Wt.push(Ln),$n(Ln,!1)})(Pn):pn.debug("DRM: Received needkey event with initData, but we don't support any of the key systems!")}function ls(Nt,rn){if(Nt.size<=0)return!1;if(rn.size>0&&[...Nt].every((Pn=>{const Ln=rn.get(Pn);return Ln!==void 0&&Ln!==""})))return!0;const yn=tn.getSessionTokens();if(yn&&yn.length>0){const Pn=yn.filter((Ln=>[...Nt].includes(Ln.normalizedKeyId)));if(Pn.some((Ln=>!Ln.hasTriggeredKeyStatusMapUpdate))||Pn.length===0)return!1}return!Rt.get().streaming.protection.ignoreKeyStatuses&&Nt&&Nt.size>0&&rn&&rn.size>0}return Jt={areKeyIdsExpired:function(Nt){try{return!!ls(Nt,Pt)&&[...Nt].every((rn=>Pt.get(rn)===r.default.MEDIA_KEY_STATUSES.EXPIRED))}catch(rn){return pn.error(rn),!1}},areKeyIdsUsable:function(Nt){try{return!ls(Nt,Pt)||[...Nt].some((rn=>{const yn=Pt.get(rn);return yn&&yn!==r.default.MEDIA_KEY_STATUSES.INTERNAL_ERROR&&yn!==r.default.MEDIA_KEY_STATUSES.OUTPUT_RESTRICTED}))}catch(rn){return pn.error(rn),!0}},clearMediaInfoArray:function(){Nn=[]},closeKeySession:Si,createKeySession:ye,getKeySystems:function(){return wt?wt.getKeySystems():[]},getSupportedKeySystemMetadataFromContentProtection:function(Nt){return Mn(),wt.getSupportedKeySystemMetadataFromContentProtection(Nt,Ht,$t)},handleKeySystemFromManifest:function(){if(!Nn||Nn.length===0)return;let Nt=[];Nn.forEach((rn=>{const yn=wt.getSupportedKeySystemMetadataFromContentProtection(rn.contentProtection,Ht,$t);yn.length>0&&(Nt.length===0&&(Nt=yn),Wt.push(yn))})),Nt&&Nt.length>0&&$n(Nt,!0)},initializeForMedia:function(Nt){if(!Nt)throw new Error("mediaInfo can not be null or undefined");Mn(),Nn.push(Nt)},loadKeySession:ar,removeKeySession:function(Nt){Mn(),tn.removeKeySession(Nt)},reset:function(){Vt.off(en.INTERNAL_KEY_MESSAGE,Wi,Jt),Mn(),ss(),xr(null),Je=null,sn=!1,Pt=new Map,tn&&(tn.reset(),tn=null),bn.forEach((Nt=>clearTimeout(Nt))),bn=[],Nn=[],Wt=[]},setKeySystems:function(Nt){wt&&wt.setKeySystems(Nt)},setMediaElement:xr,setProtectionData:function(Nt){Ht=Nt,wt.setProtectionData(Nt)},setRobustnessLevel:function(Nt){gt=Nt},setServerCertificate:function(Nt){return Mn(),tn.setServerCertificate(Nt)},setSessionType:function(Nt){$t=Nt},stop:function(){ss(),tn&&tn.stop()},updateKeyStatusesMap:function(Nt){try{if(!Nt||!Nt.sessionToken||!Nt.parsedKeyStatuses)return;Nt.sessionToken.hasTriggeredKeyStatusMapUpdate=!0;const rn=Nt.parsedKeyStatuses,yn=_.default.parseUserAgent(),Pn=yn&&yn.browser&&yn.browser.name&&yn.browser.name.toLowerCase()==="edge";rn.forEach((Ln=>{Pn&&Je.uuid===r.default.PLAYREADY_UUID&&Ln.keyId&&Ln.keyId.byteLength===16&&(function(er){const qn=_.default.bufferSourceToDataView(er),jn=qn.getUint32(0,!0),Fn=qn.getUint16(4,!0),Kn=qn.getUint16(6,!0);qn.setUint32(0,jn,!1),qn.setUint16(4,Fn,!1),qn.setUint16(6,Kn,!1)})(Ln.keyId);const Vn=_.default.bufferSourceToHex(Ln.keyId).slice(0,32);Vn&&Vn!==""&&Pt.set(Vn,Ln.status)})),Vt.trigger(en.KEY_STATUSES_MAP_UPDATED,{keyStatusMap:Pt})}catch(rn){pn.error(rn)}}},pn=Bt.getLogger(Jt),Wt=[],Nn=[],$t="temporary",gt="",gn=null,An=null,Pt=new Map,Vt.on(en.INTERNAL_KEY_MESSAGE,Wi,Jt),Jt}Z.__dashjs_factory_name="ProtectionController";var ae=K.default.getClassFactory(Z),pe=class{constructor(jt,zt){this.keyID=jt,this.key=zt}},xe=class{constructor(jt,zt){if(zt&&zt!=="persistent"&&zt!=="temporary")throw new Error("Invalid ClearKey key set type! Must be one of 'persistent' or 'temporary'");this.keyPairs=jt,this.type=zt}toJWK(){let jt,zt=this.keyPairs.length,St={keys:[]};for(jt=0;jt<zt;jt++){let en={kty:"oct",alg:"A128KW",kid:this.keyPairs[jt].keyID,k:this.keyPairs[jt].key};St.keys.push(en)}this.type&&(St.type=this.type);let ht=JSON.stringify(St);const qt=ht.length;let Bt=new ArrayBuffer(qt),Vt=new Uint8Array(Bt);for(jt=0;jt<qt;jt++)Vt[jt]=ht.charCodeAt(jt);return Bt}};const ke=r.default.CLEARKEY_UUID,Y=r.default.CLEARKEY_KEYSTEM_STRING,J="urn:uuid:"+ke;function he(jt){let zt;const St=(jt=jt||{}).BASE64;return zt={uuid:ke,schemeIdURI:J,systemString:Y,getInitData:function(ht,qt){try{let Bt=l.parseInitDataFromContentProtection(ht,St);if(!Bt&&qt){const Vt={kids:[(function(en){try{let wt=en.replace(/-/g,"");return wt=btoa(wt.match(/\w{2}/g).map((Rt=>String.fromCharCode(parseInt(Rt,16)))).join("")),wt.replace(/=/g,"").replace(/\//g,"_").replace(/\+/g,"-")}catch{return null}})(qt.cencDefaultKid)]};Bt=new TextEncoder().encode(JSON.stringify(Vt))}return Bt}catch{return null}},getRequestHeadersFromMessage:function(){return{"Content-Type":"application/json"}},getLicenseRequestFromMessage:function(ht){return JSON.stringify(JSON.parse(String.fromCharCode.apply(null,new Uint8Array(ht))))},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getClearKeysFromProtectionData:function(ht,qt){let Bt=null;if(ht){const Vt=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(qt))),en=[];for(let wt=0;wt<Vt.kids.length;wt++){const Rt=Vt.kids[wt],Ht=ht.clearkeys&&ht.clearkeys.hasOwnProperty(Rt)?ht.clearkeys[Rt]:null;if(!Ht)throw new Error("DRM: ClearKey keyID ("+Rt+") is not known!");en.push(new pe(Rt,Ht))}Bt=new xe(en)}return Bt}},zt}he.__dashjs_factory_name="KeySystemClearKey";var Ee=K.default.getSingletonFactory(he);const Le=r.default.W3C_CLEARKEY_UUID,et=r.default.CLEARKEY_KEYSTEM_STRING,Ae="urn:uuid:"+Le;function Ze(jt){let zt;const St=jt.BASE64,ht=jt.debug.getLogger(zt);return zt={uuid:Le,schemeIdURI:Ae,systemString:et,getInitData:function(qt){return l.parseInitDataFromContentProtection(qt,St)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(qt){return new Uint8Array(qt)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getClearKeysFromProtectionData:function(qt,Bt){let Vt=null;if(qt){const en=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(Bt))),wt=[];for(let Rt=0;Rt<en.kids.length;Rt++){const Ht=en.kids[Rt],Jt=qt.clearkeys&&qt.clearkeys.hasOwnProperty(Ht)?qt.clearkeys[Ht]:null;if(!Jt)throw new Error("DRM: ClearKey keyID ("+Ht+") is not known!");wt.push(new pe(Ht,Jt))}Vt=new xe(wt),ht.warn("ClearKey schemeIdURI is using W3C Common PSSH systemID (1077efec-c0b2-4d02-ace3-3c1e52e2fb4b) in Content Protection. See DASH-IF IOP v4.1 section 7.6.2.4")}return Vt}},zt}Ze.__dashjs_factory_name="KeySystemW3CClearKey";var Be=K.default.getSingletonFactory(Ze);const Ne=r.default.WIDEVINE_UUID,tt=r.default.WIDEVINE_KEYSTEM_STRING,mt="urn:uuid:"+Ne;function Ge(jt){let zt;const St=(jt=jt||{}).BASE64;return zt={uuid:Ne,schemeIdURI:mt,systemString:tt,getInitData:function(ht){return l.parseInitDataFromContentProtection(ht,St)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(ht){return new Uint8Array(ht)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null}},zt}Ge.__dashjs_factory_name="KeySystemWidevine";var ut=K.default.getSingletonFactory(Ge);const Xe=r.default.PLAYREADY_UUID,nt=r.default.PLAYREADY_KEYSTEM_STRING,Ft="urn:uuid:"+Xe;function Xt(jt){let zt,St="utf-16";const ht=(jt=jt||{}).BASE64,qt=jt.settings;function Bt(){if(!ht||!ht.hasOwnProperty("decodeArray")||!ht.hasOwnProperty("decodeArray"))throw new Error("Missing config parameter(s)")}return zt={uuid:Xe,schemeIdURI:Ft,systemString:nt,getInitData:function(Vt){const en=new Uint8Array([112,115,115,104,0,0,0,0]),wt=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);let Rt,Ht,Jt,Pt,sn,An=0,gn=null;if(Bt(),!Vt)return null;if("pssh"in Vt&&Vt.pssh)return l.parseInitDataFromContentProtection(Vt,ht);if("pro"in Vt&&Vt.pro)gn=ht.decodeArray(Vt.pro.__text);else{if(!("prheader"in Vt)||!Vt.prheader)return null;gn=ht.decodeArray(Vt.prheader.__text)}return Rt=gn.length,Ht=4+en.length+wt.length+4+Rt,Jt=new ArrayBuffer(Ht),Pt=new Uint8Array(Jt),sn=new DataView(Jt),sn.setUint32(An,Ht),An+=4,Pt.set(en,An),An+=en.length,Pt.set(wt,An),An+=wt.length,sn.setUint32(An,Rt),An+=4,Pt.set(gn,An),An+=Rt,Pt.buffer},getRequestHeadersFromMessage:function(Vt){let en,wt;const Rt={},Ht=new DOMParser;if(qt&&qt.get().streaming.protection.detectPlayreadyMessageFormat&&St==="utf-16"&&Vt&&Vt.byteLength%2==1)return Rt["Content-Type"]="text/xml; charset=utf-8",Rt;const Jt=St==="utf-16"?new Uint16Array(Vt):new Uint8Array(Vt);en=String.fromCharCode.apply(null,Jt),wt=Ht.parseFromString(en,"application/xml");const Pt=wt.getElementsByTagName("name"),sn=wt.getElementsByTagName("value");for(let An=0;An<Pt.length;An++)Rt[Pt[An].childNodes[0].nodeValue]=sn[An].childNodes[0].nodeValue;return Rt.hasOwnProperty("Content")&&(Rt["Content-Type"]=Rt.Content,delete Rt.Content),Rt.hasOwnProperty("Content-Type")||(Rt["Content-Type"]="text/xml; charset=utf-8"),Rt},getLicenseRequestFromMessage:function(Vt){let en=null;const wt=new DOMParser;if(qt&&qt.get().streaming.protection.detectPlayreadyMessageFormat&&St==="utf-16"&&Vt&&Vt.byteLength%2==1)return Vt;const Rt=St==="utf-16"?new Uint16Array(Vt):new Uint8Array(Vt);Bt();const Ht=String.fromCharCode.apply(null,Rt),Jt=wt.parseFromString(Ht,"application/xml");if(!Jt.getElementsByTagName("PlayReadyKeyMessage")[0])return Vt;{const Pt=Jt.getElementsByTagName("Challenge")[0].childNodes[0].nodeValue;Pt&&(en=ht.decode(Pt))}return en},getLicenseServerURLFromInitData:function(Vt){if(Vt){const en=new DataView(Vt),wt=en.getUint16(4,!0);let Rt=6;const Ht=new DOMParser;for(let Jt=0;Jt<wt;Jt++){const Pt=en.getUint16(Rt,!0);Rt+=2;const sn=en.getUint16(Rt,!0);if(Rt+=2,Pt!==1){Rt+=sn;continue}const An=Vt.slice(Rt,Rt+sn),gn=String.fromCharCode.apply(null,new Uint16Array(An)),pn=Ht.parseFromString(gn,"application/xml");if(pn.getElementsByTagName("LA_URL")[0]){const Nn=pn.getElementsByTagName("LA_URL")[0].childNodes[0].nodeValue;if(Nn)return Nn}if(pn.getElementsByTagName("LUI_URL")[0]){const Nn=pn.getElementsByTagName("LUI_URL")[0].childNodes[0].nodeValue;if(Nn)return Nn}}}return null},getCDMData:function(Vt){let en,wt,Rt,Ht;if(Bt(),!Vt)return null;for(en=[],Ht=0;Ht<Vt.length;++Ht)en.push(Vt.charCodeAt(Ht)),en.push(0);for(en=String.fromCharCode.apply(null,en),en=ht.encode(en),wt='<PlayReadyCDMData type="LicenseAcquisition"><LicenseAcquisition version="1.0" Proactive="false"><CustomData encoding="base64encoded">%CUSTOMDATA%</CustomData></LicenseAcquisition></PlayReadyCDMData>'.replace("%CUSTOMDATA%",en),Rt=[],Ht=0;Ht<wt.length;++Ht)Rt.push(wt.charCodeAt(Ht)),Rt.push(0);return new Uint8Array(Rt).buffer},setPlayReadyMessageFormat:function(Vt){if(Vt!=="utf-8"&&Vt!=="utf-16")throw new Error('Specified message format is not one of "utf-8" or "utf-16"');St=Vt}},zt}Xt.__dashjs_factory_name="KeySystemPlayReady";var Pe=K.default.getSingletonFactory(Xt);function De(jt){const zt=(jt=jt||{}).BASE64,St={};let ht;return St[r.default.WIDEVINE_KEYSTEM_STRING]={responseType:"json",getLicenseMessage:function(qt){return zt.decodeArray(qt.license)},getErrorResponse:function(qt){return qt}},St[r.default.PLAYREADY_KEYSTEM_STRING]={responseType:"arraybuffer",getLicenseMessage:function(qt){return qt},getErrorResponse:function(qt){return String.fromCharCode.apply(null,new Uint8Array(qt))}},ht={getServerURLFromMessage:function(qt){return qt},getHTTPMethod:function(){return"POST"},getResponseType:function(qt){return St[qt].responseType},getLicenseMessage:function(qt,Bt){return(function(){if(!zt||!zt.hasOwnProperty("decodeArray"))throw new Error("Missing config parameter(s)")})(),St[Bt].getLicenseMessage(qt)},getErrorResponse:function(qt,Bt){return St[Bt].getErrorResponse(qt)}},ht}De.__dashjs_factory_name="DRMToday";var dt=K.default.getSingletonFactory(De);function Q(){let jt;const zt="http://schemas.xmlsoap.org/soap/envelope/";function St(Bt){const Vt=String.fromCharCode.apply(null,new Uint8Array(Bt));return decodeURIComponent(escape(Vt))}function ht(Bt){if(window.DOMParser){const Vt=St(Bt),en=new window.DOMParser().parseFromString(Vt,"text/xml"),wt=en?en.getElementsByTagNameNS(zt,"Envelope")[0]:null,Rt=wt?wt.getElementsByTagNameNS(zt,"Body")[0]:null;if(Rt&&Rt.getElementsByTagNameNS(zt,"Fault")[0])return null}return Bt}function qt(Bt){let Vt="",en="",wt="",Rt=-1,Ht=-1;if(window.DOMParser){const Pt=St(Bt),sn=new window.DOMParser().parseFromString(Pt,"text/xml"),An=sn?sn.getElementsByTagNameNS(zt,"Envelope")[0]:null,gn=An?An.getElementsByTagNameNS(zt,"Body")[0]:null,pn=gn?gn.getElementsByTagNameNS(zt,"Fault")[0]:null,Nn=pn?pn.getElementsByTagName("detail")[0]:null,Wt=Nn?Nn.getElementsByTagName("Exception")[0]:null;let gt=null;if(pn===null)return Pt;gt=pn.getElementsByTagName("faultstring")[0].firstChild,Vt=gt?gt.nodeValue:null,Wt!==null&&(gt=Wt.getElementsByTagName("StatusCode")[0],en=gt?gt.firstChild.nodeValue:null,gt=Wt.getElementsByTagName("Message")[0],wt=gt?gt.firstChild.nodeValue:null,Rt=wt?wt.lastIndexOf("[")+1:-1,Ht=wt?wt.indexOf("]"):-1,wt=wt?wt.substring(Rt,Ht):"")}let Jt=`code: ${en}, name: ${Vt}`;return wt&&(Jt+=`, message: ${wt}`),Jt}return jt={getServerURLFromMessage:function(Bt){return Bt},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"arraybuffer"},getLicenseMessage:function(Bt){return ht.call(this,Bt)},getErrorResponse:function(Bt){return qt.call(this,Bt)}},jt}Q.__dashjs_factory_name="PlayReady";var H=K.default.getSingletonFactory(Q);function w(){let jt;return jt={getServerURLFromMessage:function(zt){return zt},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"arraybuffer"},getLicenseMessage:function(zt){return zt},getErrorResponse:function(zt){return String.fromCharCode.apply(null,new Uint8Array(zt))}},jt}w.__dashjs_factory_name="Widevine";var D=K.default.getSingletonFactory(w);function oe(){let jt;return jt={getServerURLFromMessage:function(zt){return zt},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"json"},getLicenseMessage:function(zt){if(!zt.hasOwnProperty("keys"))return null;let St=[];for(let ht=0;ht<zt.keys.length;ht++){let qt=zt.keys[ht],Bt=qt.kid.replace(/=/g,""),Vt=qt.k.replace(/=/g,"");St.push(new pe(Bt,Vt))}return new xe(St)},getErrorResponse:function(zt){return String.fromCharCode.apply(null,new Uint8Array(zt))}},jt}oe.__dashjs_factory_name="ClearKey";var F=K.default.getSingletonFactory(oe),Me=class{constructor(jt){this.ks=jt.ks,this.keyId=jt.keyId,this.initData=jt.initData,this.protData=jt.protData,this.cdmData=jt.cdmData,this.sessionId=jt.sessionId,this.sessionType=jt.sessionType}};function We(){let jt,zt,St,ht,qt,Bt,Vt,en,wt=this.context;function Rt(Pt,sn){return sn&&Pt in sn?sn[Pt]:null}function Ht(Pt,sn){return Pt&&Pt.sessionId?Pt.sessionId:sn&&sn.sessionId?sn.sessionId:null}function Jt(Pt,sn){return Pt&&Pt.sessionType?Pt.sessionType:sn}return jt={getKeySystemBySystemString:function(Pt){for(let sn=0;sn<ht.length;sn++)if(ht[sn].systemString===Pt)return ht[sn];return null},getKeySystems:function(){return ht},getLicenseServerModelInstance:function(Pt,sn,An){if(An===r.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_RELEASE||An===r.default.MEDIA_KEY_MESSAGE_TYPES.INDIVIDUALIZATION_REQUEST)return null;let gn=null;return sn&&sn.hasOwnProperty("drmtoday")?gn=dt(wt).getInstance({BASE64:qt}):Pt.systemString===r.default.WIDEVINE_KEYSTEM_STRING?gn=D(wt).getInstance():Pt.systemString===r.default.PLAYREADY_KEYSTEM_STRING?gn=H(wt).getInstance():Pt.systemString===r.default.CLEARKEY_KEYSTEM_STRING&&(gn=F(wt).getInstance()),gn},getSupportedKeySystemMetadataFromContentProtection:function(Pt,sn,An){let gn,pn,Nn,Wt,gt=[];if(!Pt||!Pt.length)return gt;const Je=l.findMp4ProtectionElement(Pt);for(Nn=0;Nn<ht.length;Nn++){pn=ht[Nn];const $t=Rt(pn.systemString,sn);for(Wt=0;Wt<Pt.length;Wt++)if(gn=Pt[Wt],gn.schemeIdUri.toLowerCase()===pn.schemeIdURI){let tn=pn.getInitData(gn,Je);const bn=new Me({ks:ht[Nn],keyId:gn.keyId,initData:tn,protData:$t,cdmData:pn.getCDMData($t?$t.cdmData:null),sessionId:Ht($t,gn),sessionType:Jt($t,An)});$t?gt.unshift(bn):gt.push(bn)}}return gt},getSupportedKeySystemMetadataFromSegmentPssh:function(Pt,sn,An){let gn,pn,Nn=[],Wt=l.parsePSSHList(Pt);for(let gt=0;gt<ht.length;++gt){gn=ht[gt],pn=gn.systemString;const Je=Rt(pn,sn);gn.uuid in Wt&&Nn.push({ks:gn,initData:Wt[gn.uuid],protData:Je,cdmData:gn.getCDMData(Je?Je.cdmData:null),sessionId:Ht(Je),sessionType:Jt(Je,An)})}return Nn},initDataEquals:function(Pt,sn){if(Pt.byteLength===sn.byteLength){let An=new Uint8Array(Pt),gn=new Uint8Array(sn);for(let pn=0;pn<An.length;pn++)if(An[pn]!==gn[pn])return!1;return!0}return!1},initialize:function(){let Pt;ht=[],Pt=Pe(wt).getInstance({BASE64:qt,settings:Bt}),ht.push(Pt),Pt=ut(wt).getInstance({BASE64:qt}),ht.push(Pt),Pt=Ee(wt).getInstance({BASE64:qt}),ht.push(Pt),Vt=Pt,Pt=Be(wt).getInstance({BASE64:qt,debug:zt}),ht.push(Pt),en=Pt},isClearKey:function(Pt){return Pt===Vt||Pt===en},processClearKeyLicenseRequest:function(Pt,sn,An){try{return Pt.getClearKeysFromProtectionData(sn,An)}catch{return St.error("Failed to retrieve clearkeys from ProtectionData"),null}},setConfig:function(Pt){Pt&&(Pt.debug&&(zt=Pt.debug,St=zt.getLogger(jt)),Pt.BASE64&&(qt=Pt.BASE64),Pt.settings&&(Bt=Pt.settings))},setKeySystems:function(Pt){ht=Pt},setProtectionData:function(Pt){for(var sn,An,gn=0;gn<ht.length;gn++){var pn=ht[gn];pn.hasOwnProperty("init")&&pn.init((sn=pn.systemString,An=void 0,An=null,Pt&&(An=sn in Pt?Pt[sn]:null),An))}}},jt}We.__dashjs_factory_name="ProtectionKeyController";var Ue=K.default.getSingletonFactory(We),je=t(445),Oe=class{constructor(jt,zt){this.initData=jt,this.initDataType=zt}},He=class{constructor(jt,zt,St,ht){this.sessionToken=jt,this.message=zt,this.defaultURL=St,this.messageType=ht||r.default.MEDIA_KEY_MESSAGE_TYPES.LICENSE_REQUEST}},st=class{constructor(jt,zt){this.keySystem=jt,this.ksConfiguration=zt,this.nativeMediaKeySystemAccessObject=null,this.selectedSystemString=null}};const it={};function Et(jt){jt=jt||{};const zt=this.context,St=jt.eventBus,ht=jt.events,qt=jt.debug;let Bt,Vt,en,wt,Rt,Ht,Jt,Pt;function sn(gt,Je,$t,tn){if(navigator.requestMediaKeySystemAccess===void 0||typeof navigator.requestMediaKeySystemAccess!="function"){const Hn="Insecure origins are not allowed";return St.trigger(ht.KEY_SYSTEM_ACCESS_COMPLETE,{error:Hn}),void tn({error:Hn})}const bn=gt[Je].protData&>[Je].protData.systemStringPriority?gt[Je].protData.systemStringPriority:null,Mn=gt[Je].configs,$n=gt[Je].ks;let fr=$n.systemString;(function(Hn,ar){return new Promise(((ye,hr)=>{An(Hn,ar,0,ye,hr)}))})(bn||(it[fr]?it[fr]:[fr]),Mn).then((Hn=>{const ar=Hn&&Hn.nativeMediaKeySystemAccessObject&&typeof Hn.nativeMediaKeySystemAccessObject.getConfiguration=="function"?Hn.nativeMediaKeySystemAccessObject.getConfiguration():null,ye=new st($n,ar);ye.selectedSystemString=Hn.selectedSystemString,ye.nativeMediaKeySystemAccessObject=Hn.nativeMediaKeySystemAccessObject,St.trigger(ht.KEY_SYSTEM_ACCESS_COMPLETE,{data:ye}),$t({data:ye})})).catch((Hn=>{if(Je+1<gt.length)sn(gt,Je+1,$t,tn);else{const ar="Key system access denied! ";St.trigger(ht.KEY_SYSTEM_ACCESS_COMPLETE,{error:ar+Hn.message}),tn({error:ar+Hn.message})}}))}function An(gt,Je,$t,tn,bn){const Mn=gt[$t];Vt.debug(`Requesting key system access for system string ${Mn}`),navigator.requestMediaKeySystemAccess(Mn,Je).then(($n=>{tn({nativeMediaKeySystemAccessObject:$n,selectedSystemString:Mn})})).catch(($n=>{$t+1<gt.length?An(gt,Je,$t+1,tn,bn):bn($n)}))}function gn(gt){if(!gt||!gt.session)return Promise.resolve;const Je=gt.session;return Je.removeEventListener("keystatuseschange",gt),Je.removeEventListener("message",gt),Je.close()}function pn(gt){for(let Je=0;Je<Ht.length;Je++)if(Ht[Je]===gt){Ht.splice(Je,1);break}}function Nn(gt,Je){const $t={session:gt,keyId:Je.keyId,normalizedKeyId:Je&&Je.keyId&&typeof Je.keyId=="string"?Je.keyId.replace(/-/g,"").toLowerCase():"",initData:Je.initData,sessionId:Je.sessionId,sessionType:Je.sessionType,hasTriggeredKeyStatusMapUpdate:!1,handleEvent:function(tn){switch(tn.type){case"keystatuseschange":this._onKeyStatusesChange(tn);break;case"message":this._onKeyMessage(tn)}},_onKeyStatusesChange:function(tn){St.trigger(ht.KEY_STATUSES_CHANGED,{data:this});const bn=[];tn.target.keyStatuses.forEach((function(){bn.push(Wt(arguments))})),St.trigger(ht.INTERNAL_KEY_STATUSES_CHANGED,{parsedKeyStatuses:bn,sessionToken:$t})},_onKeyMessage:function(tn){let bn=ArrayBuffer.isView(tn.message)?tn.message.buffer:tn.message;St.trigger(ht.INTERNAL_KEY_MESSAGE,{data:new He(this,bn,void 0,tn.messageType)})},getKeyId:function(){return this.keyId},getSessionId:function(){return gt.sessionId},getSessionType:function(){return this.sessionType},getExpirationTime:function(){return gt.expiration},getKeyStatuses:function(){return gt.keyStatuses},getUsable:function(){let tn=!1;return gt.keyStatuses.forEach((function(){Wt(arguments).status===r.default.MEDIA_KEY_STATUSES.USABLE&&(tn=!0)})),tn}};return gt.addEventListener("keystatuseschange",$t),gt.addEventListener("message",$t),gt.closed.then((()=>{pn($t),Vt.debug("DRM: Session closed. SessionID = "+$t.getSessionId()),St.trigger(ht.KEY_SESSION_CLOSED,{data:$t.getSessionId()})})),Ht.push($t),$t}function Wt(gt){let Je,$t;return gt&>.length>0&&(gt[0]&&(typeof gt[0]=="string"?Je=gt[0]:$t=gt[0]),gt[1]&&(typeof gt[1]=="string"?Je=gt[1]:$t=gt[1])),{status:Je,keyId:$t}}return Bt={closeKeySession:function(gt){gn(gt).catch((function(Je){pn(gt),St.trigger(ht.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+gt.getSessionId()+") "+Je.name})}))},createKeySession:function(gt){if(!en||!Rt)throw new Error("Can not create sessions until you have selected a key system");const Je=Rt.createSession(gt.sessionType),$t=Nn(Je,gt),tn=en.systemString===r.default.CLEARKEY_KEYSTEM_STRING&&(gt.initData||gt.protData&>.protData.clearkeys)?r.default.INITIALIZATION_DATA_TYPE_KEYIDS:r.default.INITIALIZATION_DATA_TYPE_CENC;Je.generateRequest(tn,gt.initData).then((function(){Vt.debug("DRM: Session created. SessionID = "+$t.getSessionId()),St.trigger(ht.KEY_SESSION_CREATED,{data:$t})})).catch((function(bn){pn($t),St.trigger(ht.KEY_SESSION_CREATED,{data:null,error:new f.default(g.default.KEY_SESSION_CREATED_ERROR_CODE,g.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Error generating key request -- "+bn.name)})}))},getAllInitData:function(){const gt=[];for(let Je=0;Je<Ht.length;Je++)Ht[Je].initData&>.push(Ht[Je].initData);return gt},getSessionTokens:function(){return Ht},loadKeySession:function(gt){if(!en||!Rt)throw new Error("Can not load sessions until you have selected a key system");const Je=gt.sessionId;for(let bn=0;bn<Ht.length;bn++)if(Je===Ht[bn].sessionId)return void Vt.warn("DRM: Ignoring session ID because we have already seen it!");const $t=Rt.createSession(gt.sessionType),tn=Nn($t,gt);tn.hasTriggeredKeyStatusMapUpdate=!0,$t.load(Je).then((function(bn){bn?(Vt.debug("DRM: Session loaded. SessionID = "+tn.getSessionId()),St.trigger(ht.KEY_SESSION_CREATED,{data:tn})):(pn(tn),St.trigger(ht.KEY_SESSION_CREATED,{data:null,error:new f.default(g.default.KEY_SESSION_CREATED_ERROR_CODE,g.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Could not load session! Invalid Session ID ("+Je+")")}))})).catch((function(bn){pn(tn),St.trigger(ht.KEY_SESSION_CREATED,{data:null,error:new f.default(g.default.KEY_SESSION_CREATED_ERROR_CODE,g.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Could not load session ("+Je+")! "+bn.name)})}))},removeKeySession:function(gt){gt.session.remove().then((function(){Vt.debug("DRM: Session removed. SessionID = "+gt.getSessionId()),St.trigger(ht.KEY_SESSION_REMOVED,{data:gt.getSessionId()})}),(function(Je){St.trigger(ht.KEY_SESSION_REMOVED,{data:null,error:"Error removing session ("+gt.getSessionId()+"). "+Je.name})}))},requestKeySystemAccess:function(gt){return new Promise(((Je,$t)=>{sn(gt,0,Je,$t)}))},reset:function(){const gt=Ht.length;let Je;if(gt!==0){const $t=function(tn){pn(tn),Ht.length===0&&(wt?(wt.removeEventListener("encrypted",Jt),wt.setMediaKeys(null).then((function(){St.trigger(ht.TEARDOWN_COMPLETE)}))):St.trigger(ht.TEARDOWN_COMPLETE))};for(let tn=0;tn<gt;tn++)Je=Ht[tn],(function(bn){gn(Je),$t(bn)})(Je)}else St.trigger(ht.TEARDOWN_COMPLETE)},selectKeySystem:function(gt){return new Promise(((Je,$t)=>{gt.nativeMediaKeySystemAccessObject.createMediaKeys().then((tn=>(en=gt.keySystem,Rt=tn,wt?wt.setMediaKeys(Rt):Promise.resolve()))).then((()=>{Je(en)})).catch((function(){$t({error:"Error selecting keys system ("+gt.keySystem.systemString+")! Could not create MediaKeys -- TODO"})}))}))},setMediaElement:function(gt){wt!==gt&&(wt&&(wt.removeEventListener("encrypted",Jt),wt.setMediaKeys&&wt.setMediaKeys(null)),wt=gt,wt&&(wt.addEventListener("encrypted",Jt),wt.setMediaKeys&&Rt&&wt.setMediaKeys(Rt)))},setServerCertificate:function(gt){return new Promise((Je=>{Rt.setServerCertificate(gt).then((function(){Vt.info("DRM: License server certificate successfully updated."),St.trigger(ht.SERVER_CERTIFICATE_UPDATED),Je()})).catch(($t=>{St.trigger(ht.SERVER_CERTIFICATE_UPDATED,{error:new f.default(g.default.SERVER_CERTIFICATE_UPDATED_ERROR_CODE,g.default.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE+$t.name)}),Je()}))}))},stop:function(){let gt;for(let Je=0;Je<Ht.length;Je++)gt=Ht[Je],gt.getUsable()||(gn(gt),pn(gt))},updateKeySession:function(gt,Je){const $t=gt.session;Pt.isClearKey(en)&&(Je=Je.toJWK()),$t.update(Je).then((()=>{St.trigger(ht.KEY_SESSION_UPDATED)})).catch((function(tn){St.trigger(ht.KEY_ERROR,{error:new f.default(g.default.MEDIA_KEYERR_CODE,"Error sending update() message! "+tn.name,gt)})}))}},Vt=qt.getLogger(Bt),en=null,wt=null,Rt=null,Ht=[],Pt=Ue(zt).getInstance(),Jt={handleEvent:function(gt){if(gt.type==="encrypted"&>.initData){let Je=ArrayBuffer.isView(gt.initData)?gt.initData.buffer:gt.initData;St.trigger(ht.NEED_KEY,{key:new Oe(Je,gt.initDataType)})}}},Bt}it[r.default.PLAYREADY_KEYSTEM_STRING]=[r.default.PLAYREADY_KEYSTEM_STRING,r.default.PLAYREADY_RECOMMENDATION_KEYSTEM_STRING],it[r.default.WIDEVINE_KEYSTEM_STRING]=[r.default.WIDEVINE_KEYSTEM_STRING],it[r.default.CLEARKEY_KEYSTEM_STRING]=[r.default.CLEARKEY_KEYSTEM_STRING],Et.__dashjs_factory_name="DefaultProtectionModel";var nn=K.default.getClassFactory(Et);function Ut(jt){jt=jt||{};const zt=this.context,St=jt.eventBus,ht=jt.events,qt=jt.debug,Bt=jt.api;let Vt,en,wt,Rt,Ht,Jt,Pt,sn,An;function gn(){try{for(let Wt=0;Wt<Pt.length;Wt++)pn(Pt[Wt]);wt&&wt.removeEventListener(Bt.needkey,sn),St.trigger(ht.TEARDOWN_COMPLETE)}catch(Wt){St.trigger(ht.TEARDOWN_COMPLETE,{error:"Error tearing down key sessions and MediaKeys! -- "+Wt.message})}}function pn(Wt){const gt=Wt.session;gt.removeEventListener(Bt.error,Wt),gt.removeEventListener(Bt.message,Wt),gt.removeEventListener(Bt.ready,Wt),gt.removeEventListener(Bt.close,Wt);for(let Je=0;Je<Pt.length;Je++)if(Pt[Je]===Wt){Pt.splice(Je,1);break}gt[Bt.release]()}function Nn(){let Wt=null;const gt=function(){wt.removeEventListener("loadedmetadata",Wt),wt[Bt.setMediaKeys](Ht),St.trigger(ht.VIDEO_ELEMENT_SELECTED)};wt.readyState>=1?gt():(Wt=gt.bind(this),wt.addEventListener("loadedmetadata",Wt))}return Vt={getAllInitData:function(){const Wt=[];for(let gt=0;gt<Pt.length;gt++)Wt.push(Pt[gt].initData);return Wt},getSessionTokens:function(){return Pt},requestKeySystemAccess:function(Wt){return new Promise(((gt,Je)=>{let $t=!1;for(let tn=0;tn<Wt.length;tn++){const bn=Wt[tn].ks.systemString,Mn=Wt[tn].configs;let $n=null,fr=null;for(let Hn=0;Hn<Mn.length;Hn++){const ar=Mn[Hn].audioCapabilities,ye=Mn[Hn].videoCapabilities;if(ar&&ar.length!==0){$n=[];for(let xr=0;xr<ar.length;xr++)window[Bt.MediaKeys].isTypeSupported(bn,ar[xr].contentType)&&$n.push(ar[xr])}if(ye&&ye.length!==0){fr=[];for(let xr=0;xr<ye.length;xr++)window[Bt.MediaKeys].isTypeSupported(bn,ye[xr].contentType)&&fr.push(ye[xr])}if(!$n&&!fr||$n&&$n.length===0||fr&&fr.length===0)continue;$t=!0;const hr=new c($n,fr),Gr=An.getKeySystemBySystemString(bn),Si=new st(Gr,hr);St.trigger(ht.KEY_SYSTEM_ACCESS_COMPLETE,{data:Si}),gt({data:Si});break}}if(!$t){const tn="Key system access denied! -- No valid audio/video content configurations detected!";St.trigger(ht.KEY_SYSTEM_ACCESS_COMPLETE,{error:tn}),Je({error:tn})}}))},selectKeySystem:function(Wt){return new Promise(((gt,Je)=>{try{Ht=Wt.mediaKeys=new window[Bt.MediaKeys](Wt.keySystem.systemString),Rt=Wt.keySystem,Jt=Wt,wt&&Nn(),gt(Rt)}catch{Je({error:"Error selecting keys system ("+Rt.systemString+")! Could not create MediaKeys -- TODO"})}}))},setMediaElement:function(Wt){wt!==Wt&&(wt&&wt.removeEventListener(Bt.needkey,sn),wt=Wt,wt&&(wt.addEventListener(Bt.needkey,sn),Ht&&Nn()))},createKeySession:function(Wt){if(!Rt||!Ht||!Jt)throw new Error("Can not create sessions until you have selected a key system");let gt=null;if(Jt.ksConfiguration.videoCapabilities&&Jt.ksConfiguration.videoCapabilities.length>0&&(gt=Jt.ksConfiguration.videoCapabilities[0]),gt===null&&Jt.ksConfiguration.audioCapabilities&&Jt.ksConfiguration.audioCapabilities.length>0&&(gt=Jt.ksConfiguration.audioCapabilities[0]),gt===null)throw new Error("Can not create sessions for unknown content types.");const Je=gt.contentType,$t=Ht.createSession(Je,new Uint8Array(Wt.initData),Wt.cdmData?new Uint8Array(Wt.cdmData):null),tn=(function(bn,Mn){return{session:bn,keyId:Mn.keyId,normalizedKeyId:Mn&&Mn.keyId&&typeof Mn.keyId=="string"?Mn.keyId.replace(/-/g,"").toLowerCase():"",initData:Mn.initData,hasTriggeredKeyStatusMapUpdate:!1,getKeyId:function(){return this.keyId},getSessionId:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"},getKeyStatuses:function(){return{size:0,has:()=>!1,get:()=>{}}},handleEvent:function($n){switch($n.type){case Bt.error:let fr="KeyError";St.trigger(ht.KEY_ERROR,{error:new f.default(g.default.MEDIA_KEYERR_CODE,fr,this)});break;case Bt.message:let Hn=ArrayBuffer.isView($n.message)?$n.message.buffer:$n.message;St.trigger(ht.INTERNAL_KEY_MESSAGE,{data:new He(this,Hn,$n.destinationURL)});break;case Bt.ready:en.debug("DRM: Key added."),St.trigger(ht.KEY_ADDED);break;case Bt.close:en.debug("DRM: Session closed. SessionID = "+this.getSessionId()),St.trigger(ht.KEY_SESSION_CLOSED,{data:this.getSessionId()})}}}})($t,Wt);$t.addEventListener(Bt.error,tn),$t.addEventListener(Bt.message,tn),$t.addEventListener(Bt.ready,tn),$t.addEventListener(Bt.close,tn),Pt.push(tn),en.debug("DRM: Session created. SessionID = "+tn.getSessionId()),St.trigger(ht.KEY_SESSION_CREATED,{data:tn})},updateKeySession:function(Wt,gt){const Je=Wt.session;An.isClearKey(Rt)?Je.update(new Uint8Array(gt.toJWK())):Je.update(new Uint8Array(gt)),St.trigger(ht.KEY_SESSION_UPDATED)},closeKeySession:pn,setServerCertificate:function(){return Promise.resolve()},loadKeySession:function(){},removeKeySession:function(){},stop:gn,reset:gn},en=qt.getLogger(Vt),wt=null,Rt=null,Ht=null,Jt=null,Pt=[],An=Ue(zt).getInstance(),sn={handleEvent:function(Wt){if(Wt.type===Bt.needkey&&Wt.initData){const gt=ArrayBuffer.isView(Wt.initData)?Wt.initData.buffer:Wt.initData;St.trigger(ht.NEED_KEY,{key:new Oe(gt,r.default.INITIALIZATION_DATA_TYPE_CENC)})}}},Vt}Ut.__dashjs_factory_name="ProtectionModel_3Feb2014";var Kt=K.default.getClassFactory(Ut);function kt(jt){jt=jt||{};const zt=this.context,St=jt.eventBus,ht=jt.events,qt=jt.debug,Bt=jt.api,Vt=jt.errHandler;let en,wt,Rt,Ht,Jt,Pt,sn,An,gn;function pn(){Rt&>();for(let Je=0;Je<sn.length;Je++)Nn(sn[Je]);St.trigger(ht.TEARDOWN_COMPLETE)}function Nn(Je){try{Rt[Bt.cancelKeyRequest](Ht.systemString,Je.sessionId)}catch($t){St.trigger(ht.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+Je.sessionId+") "+$t.message})}}function Wt(Je,$t){if($t&&Je){const tn=Je.length;for(let bn=0;bn<tn;bn++)if(Je[bn].sessionId==$t)return Je[bn];return null}return null}function gt(){Rt.removeEventListener(Bt.keyerror,gn),Rt.removeEventListener(Bt.needkey,gn),Rt.removeEventListener(Bt.keymessage,gn),Rt.removeEventListener(Bt.keyadded,gn)}return en={getAllInitData:function(){const Je=[];for(let $t=0;$t<Pt.length;$t++)Je.push(Pt[$t].initData);for(let $t=0;$t<sn.length;$t++)Je.push(sn[$t].initData);return Je},getSessionTokens:function(){return sn.concat(Pt)},requestKeySystemAccess:function(Je){return new Promise((($t,tn)=>{let bn=Rt;bn||(bn=document.createElement("video"));let Mn=!1;for(let $n=0;$n<Je.length;$n++){const fr=Je[$n].ks.systemString,Hn=Je[$n].configs;let ar=null,ye=null;for(let hr=0;hr<Hn.length;hr++){const Gr=Hn[hr].videoCapabilities;if(Gr&&Gr.length!==0){ye=[];for(let wr=0;wr<Gr.length;wr++)bn.canPlayType(Gr[wr].contentType,fr)!==""&&ye.push(Gr[wr])}if(!ye||ar||ye&&ye.length===0)continue;Mn=!0;const Si=new c(ar,ye),xr=Jt.getKeySystemBySystemString(fr),Wi=new st(xr,Si);St.trigger(ht.KEY_SYSTEM_ACCESS_COMPLETE,{data:Wi}),$t({data:Wi});break}}if(!Mn){const $n="Key system access denied! -- No valid audio/video content configurations detected!";St.trigger(ht.KEY_SYSTEM_ACCESS_COMPLETE,{error:$n}),tn({error:$n})}}))},selectKeySystem:function(Je){return Ht=Je.keySystem,Promise.resolve(Ht)},setMediaElement:function(Je){if(Rt!==Je){if(Rt){gt();for(var $t=0;$t<sn.length;$t++)Nn(sn[$t]);sn=[]}Rt=Je,Rt&&(Rt.addEventListener(Bt.keyerror,gn),Rt.addEventListener(Bt.needkey,gn),Rt.addEventListener(Bt.keymessage,gn),Rt.addEventListener(Bt.keyadded,gn),St.trigger(ht.VIDEO_ELEMENT_SELECTED))}},createKeySession:function(Je){if(!Ht)throw new Error("Can not create sessions until you have selected a key system");if(An||sn.length===0){const $t={sessionId:null,keyId:Je.keyId,normalizedKeyId:Je&&Je.keyId&&typeof Je.keyId=="string"?Je.keyId.replace(/-/g,"").toLowerCase():"",initData:Je.initData,hasTriggeredKeyStatusMapUpdate:!1,getKeyId:function(){return this.keyId},getSessionId:function(){return this.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"},getKeyStatuses:function(){return{size:0,has:()=>!1,get:()=>{}}}};return Pt.push($t),Rt[Bt.generateKeyRequest](Ht.systemString,new Uint8Array(Je.initData)),$t}throw new Error("Multiple sessions not allowed!")},updateKeySession:function(Je,$t){const tn=Je.sessionId;if(Jt.isClearKey(Ht))for(let bn=0;bn<$t.keyPairs.length;bn++)Rt[Bt.addKey](Ht.systemString,$t.keyPairs[bn].key,$t.keyPairs[bn].keyID,tn);else Rt[Bt.addKey](Ht.systemString,new Uint8Array($t),new Uint8Array(Je.initData),tn);St.trigger(ht.KEY_SESSION_UPDATED)},closeKeySession:Nn,setServerCertificate:function(){return Promise.resolve()},loadKeySession:function(){},removeKeySession:function(){},stop:pn,reset:pn},wt=qt.getLogger(en),Rt=null,Ht=null,Pt=[],sn=[],Jt=Ue(zt).getInstance(),gn={handleEvent:function(Je){let $t=null;switch(Je.type){case Bt.needkey:let tn=ArrayBuffer.isView(Je.initData)?Je.initData.buffer:Je.initData;St.trigger(ht.NEED_KEY,{key:new Oe(tn,r.default.INITIALIZATION_DATA_TYPE_CENC)});break;case Bt.keyerror:if($t=Wt(sn,Je.sessionId),$t||($t=Wt(Pt,Je.sessionId)),$t){let bn=g.default.MEDIA_KEYERR_CODE,Mn="";switch(Je.errorCode.code){case 1:bn=g.default.MEDIA_KEYERR_UNKNOWN_CODE,Mn+="MEDIA_KEYERR_UNKNOWN - "+g.default.MEDIA_KEYERR_UNKNOWN_MESSAGE;break;case 2:bn=g.default.MEDIA_KEYERR_CLIENT_CODE,Mn+="MEDIA_KEYERR_CLIENT - "+g.default.MEDIA_KEYERR_CLIENT_MESSAGE;break;case 3:bn=g.default.MEDIA_KEYERR_SERVICE_CODE,Mn+="MEDIA_KEYERR_SERVICE - "+g.default.MEDIA_KEYERR_SERVICE_MESSAGE;break;case 4:bn=g.default.MEDIA_KEYERR_OUTPUT_CODE,Mn+="MEDIA_KEYERR_OUTPUT - "+g.default.MEDIA_KEYERR_OUTPUT_MESSAGE;break;case 5:bn=g.default.MEDIA_KEYERR_HARDWARECHANGE_CODE,Mn+="MEDIA_KEYERR_HARDWARECHANGE - "+g.default.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE;break;case 6:bn=g.default.MEDIA_KEYERR_DOMAIN_CODE,Mn+="MEDIA_KEYERR_DOMAIN - "+g.default.MEDIA_KEYERR_DOMAIN_MESSAGE}Mn+=" System Code = "+Je.systemCode,St.trigger(ht.KEY_ERROR,{error:new f.default(bn,Mn,$t)})}else wt.error("No session token found for key error");break;case Bt.keyadded:$t=Wt(sn,Je.sessionId),$t||($t=Wt(Pt,Je.sessionId)),$t?(wt.debug("DRM: Key added."),St.trigger(ht.KEY_ADDED,{data:$t})):wt.debug("No session token found for key added");break;case Bt.keymessage:if(An=Je.sessionId!==null&&Je.sessionId!==void 0,An?($t=Wt(sn,Je.sessionId),!$t&&Pt.length>0&&($t=Pt.shift(),sn.push($t),$t.sessionId=Je.sessionId,St.trigger(ht.KEY_SESSION_CREATED,{data:$t}))):Pt.length>0&&($t=Pt.shift(),sn.push($t),Pt.length!==0&&Vt.error(new f.default(g.default.MEDIA_KEY_MESSAGE_ERROR_CODE,g.default.MEDIA_KEY_MESSAGE_ERROR_MESSAGE))),$t){let bn=ArrayBuffer.isView(Je.message)?Je.message.buffer:Je.message;$t.keyMessage=bn,St.trigger(ht.INTERNAL_KEY_MESSAGE,{data:new He($t,bn,Je.defaultURL)})}else wt.warn("No session token found for key message")}}},en}kt.__dashjs_factory_name="ProtectionModel_01b";var Tn=K.default.getClassFactory(kt);const Bn=[{generateKeyRequest:"generateKeyRequest",addKey:"addKey",cancelKeyRequest:"cancelKeyRequest",needkey:"needkey",keyerror:"keyerror",keyadded:"keyadded",keymessage:"keymessage"},{generateKeyRequest:"webkitGenerateKeyRequest",addKey:"webkitAddKey",cancelKeyRequest:"webkitCancelKeyRequest",needkey:"webkitneedkey",keyerror:"webkitkeyerror",keyadded:"webkitkeyadded",keymessage:"webkitkeymessage"}],Jn=[{setMediaKeys:"setMediaKeys",MediaKeys:"MediaKeys",release:"close",needkey:"needkey",error:"keyerror",message:"keymessage",ready:"keyadded",close:"keyclose"},{setMediaKeys:"msSetMediaKeys",MediaKeys:"MSMediaKeys",release:"close",needkey:"msneedkey",error:"mskeyerror",message:"mskeymessage",ready:"mskeyadded",close:"mskeyclose"}];function gr(){let jt;const zt=this.context;function St(ht,qt){for(let Bt=0;Bt<qt.length;Bt++){const Vt=qt[Bt];if(typeof ht[Vt[Object.keys(Vt)[0]]]=="function")return Vt}return null}return jt={createProtectionSystem:function(ht){let qt=null;const Bt=Ue(zt).getInstance();Bt.setConfig({debug:ht.debug,BASE64:ht.BASE64,settings:ht.settings}),Bt.initialize();let Vt=(function(en){const wt=en.debug,Rt=wt.getLogger(jt),Ht=en.eventBus,Jt=en.errHandler,Pt=en.videoModel?en.videoModel.getElement():null;return Pt&&Pt.onencrypted===void 0||Pt&&Pt.mediaKeys===void 0?St(Pt,Jn)?(Rt.info("EME detected on this user agent! (ProtectionModel_3Feb2014)"),Kt(zt).create({debug:wt,eventBus:Ht,events:en.events,api:St(Pt,Jn)})):St(Pt,Bn)?(Rt.info("EME detected on this user agent! (ProtectionModel_01b)"),Tn(zt).create({debug:wt,eventBus:Ht,errHandler:Jt,events:en.events,api:St(Pt,Bn)})):(Rt.warn("No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!"),null):(Rt.info("EME detected on this user agent! (DefaultProtectionModel"),nn(zt).create({debug:wt,eventBus:Ht,events:en.events}))})(ht);return Vt&&(qt=ae(zt).create({BASE64:ht.BASE64,cmcdModel:ht.cmcdModel,constants:ht.constants,customParametersModel:ht.customParametersModel,debug:ht.debug,eventBus:ht.eventBus,events:ht.events,protectionKeyController:Bt,protectionModel:Vt,settings:ht.settings}),ht.capabilities.setEncryptedMediaSupported(!0)),qt}},jt}gr.__dashjs_factory_name="Protection";const dr=K.default.getClassFactory(gr);dr.events=je.default,dr.errors=g.default,K.default.updateClassFactory(gr.__dashjs_factory_name,dr);var mr=dr},445:function(u,e,t){t.r(e);var n=t(7252);class r extends n.default{constructor(){super(),this.INTERNAL_KEY_MESSAGE="internalKeyMessage",this.INTERNAL_KEY_STATUSES_CHANGED="internalkeyStatusesChanged",this.KEY_ADDED="public_keyAdded",this.KEY_ERROR="public_keyError",this.KEY_MESSAGE="public_keyMessage",this.KEY_SESSION_CLOSED="public_keySessionClosed",this.KEY_SESSION_CREATED="public_keySessionCreated",this.KEY_SESSION_REMOVED="public_keySessionRemoved",this.KEY_STATUSES_CHANGED="public_keyStatusesChanged",this.KEY_STATUSES_MAP_UPDATED="keyStatusesMapUpdated",this.KEY_SYSTEM_ACCESS_COMPLETE="public_keySystemAccessComplete",this.KEY_SYSTEM_SELECTED="public_keySystemSelected",this.LICENSE_REQUEST_COMPLETE="public_licenseRequestComplete",this.LICENSE_REQUEST_SENDING="public_licenseRequestSending",this.NEED_KEY="needkey",this.PROTECTION_CREATED="public_protectioncreated",this.PROTECTION_DESTROYED="public_protectiondestroyed",this.SERVER_CERTIFICATE_UPDATED="serverCertificateUpdated",this.TEARDOWN_COMPLETE="protectionTeardownComplete",this.VIDEO_ELEMENT_SELECTED="videoElementSelected",this.KEY_SESSION_UPDATED="public_keySessionUpdated"}}let i=new r;e.default=i},1923:function(u,e,t){t.r(e);var n=t(8748);class r extends n.default{constructor(){super(),this.MEDIA_KEYERR_CODE=100,this.MEDIA_KEYERR_UNKNOWN_CODE=101,this.MEDIA_KEYERR_CLIENT_CODE=102,this.MEDIA_KEYERR_SERVICE_CODE=103,this.MEDIA_KEYERR_OUTPUT_CODE=104,this.MEDIA_KEYERR_HARDWARECHANGE_CODE=105,this.MEDIA_KEYERR_DOMAIN_CODE=106,this.MEDIA_KEY_MESSAGE_ERROR_CODE=107,this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE=108,this.SERVER_CERTIFICATE_UPDATED_ERROR_CODE=109,this.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE=110,this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE=111,this.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE=112,this.KEY_SESSION_CREATED_ERROR_CODE=113,this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE=114,this.MEDIA_KEYERR_UNKNOWN_MESSAGE="An unspecified error occurred. This value is used for errors that don't match any of the other codes.",this.MEDIA_KEYERR_CLIENT_MESSAGE="The Key System could not be installed or updated.",this.MEDIA_KEYERR_SERVICE_MESSAGE="The message passed into update indicated an error from the license service.",this.MEDIA_KEYERR_OUTPUT_MESSAGE="There is no available output device with the required characteristics for the content protection system.",this.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE="A hardware configuration change caused a content protection error.",this.MEDIA_KEYERR_DOMAIN_MESSAGE="An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain.",this.MEDIA_KEY_MESSAGE_ERROR_MESSAGE="Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!",this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE="DRM: Empty key message from CDM",this.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE="Error updating server certificate -- ",this.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE="DRM: KeyStatusChange error! -- License has expired",this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE="DRM: No license server URL specified!",this.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE="DRM: KeySystem Access Denied! -- ",this.KEY_SESSION_CREATED_ERROR_MESSAGE="DRM: unable to create session! --",this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE="DRM: licenser error! --"}}let i=new r;e.default=i},4246:function(u,e,t){t.r(e);var n=t(138);const r={DEFAULT:.5,STRONG:1,WEAK:0};function i(l,d,c,g){let f,h,y,E,_;return h=l===void 0?null:l,y=(function(L){let K=r.DEFAULT;return L!==r.DEFAULT&&L!==r.STRONG&&L!==r.WEAK||(K=L),K})(c),E=d===void 0?null:d,_=g===void 0?null:g,f={representation:h,reason:E,rule:_,priority:y},f}i.__dashjs_factory_name="SwitchRequest";const o=n.default.getClassFactory(i);o.NO_CHANGE=null,o.PRIORITY=r,n.default.updateClassFactory(i.__dashjs_factory_name,o),e.default=o},559:function(u,e,t){t.r(e),t.d(e,{supportsMediaSource:function(){return d}});var n=t(138),r=t(5212),i=t(2861),o=t(7393),l=t(649);function d(){let g="ManagedMediaSource"in window,f="WebKitMediaSource"in window,h="MediaSource"in window;return g||f||h}function c(){let g,f,h,y,E,_;const L=this.context,K=(0,o.default)(L).getInstance();function Z(Y,J){let he;J===r.default.VIDEO?he=(function(Le){const et={video:{}};return Le&&(Le.width&&(et.video.width=Le.width),Le.height&&(et.video.height=Le.height),Le.framerate&&(et.video.framerate=parseFloat(Le.framerate)),Le.hdrMetadataType&&(et.video.hdrMetadataType=Le.hdrMetadataType),Le.colorGamut&&(et.video.colorGamut=Le.colorGamut),Le.transferFunction&&(et.video.transferFunction=Le.transferFunction)),et})(Y):J===r.default.AUDIO&&(he=(function(Le){const et={audio:{}};return Le.samplerate&&(et.audio.samplerate=Le.samplerate),Le.channels&&(et.audio.channels=Le.channels),et})(Y)),he[J].contentType=Y.codec,he[J].bitrate=parseInt(Y.bitrate),he.type="media-source";let Ee=Y.codec;return Y.width&&Y.height&&(Ee+=';width="'+Y.width+'";height="'+Y.height+'"'),he.mediaSourceCodecString=Ee,(function(Le,et,Ae){if(!et||!et.keySystemsMetadata||et.keySystemsMetadata.length===0)return[Le];const Ze=[];return et.keySystemsMetadata.forEach((Be=>{if(!Be.ks)return void Ze.push({...Le});const Ne=Be.protData&&Be.protData.systemStringPriority?Be.protData.systemStringPriority:null;let tt=Be.ks.systemString;(Ne||[tt]).forEach((mt=>{const Ge={...Le};Ge.keySystemConfiguration={},mt&&(Ge.keySystemConfiguration.keySystem=mt);let ut="";Be.ks.systemString===i.default.WIDEVINE_KEYSTEM_STRING&&(ut=i.default.ROBUSTNESS_STRINGS.WIDEVINE.SW_SECURE_CRYPTO);const Xe=Be.protData,nt=Xe&&Xe.audioRobustness&&Xe.audioRobustness.length>0?Xe.audioRobustness:ut,Ft=Xe&&Xe.videoRobustness&&Xe.videoRobustness.length>0?Xe.videoRobustness:ut;Ae===r.default.AUDIO?Ge.keySystemConfiguration[Ae]={robustness:nt}:Ae===r.default.VIDEO&&(Ge.keySystemConfiguration[Ae]={robustness:Ft}),Ze.push(Ge)}))})),Ze})(he,Y,J)}function ae(Y){return f.get().streaming.enhancement.codecs.some((J=>Y.includes(J)))}function pe(Y){if(y&&y.length!==0&&Y)return y.find((J=>{const he=xe(Y,J,r.default.AUDIO),Ee=xe(Y,J,r.default.VIDEO),Le=xe(Y,J,"keySystemConfiguration");return he&&Ee&&Le}))}function xe(Y,J,he){return!Y[he]&&!J[he]||!(!Y[he]||!J[he])&&K.areEqual(Y[he],J[he])}function ke(Y,J){return(Y=Y.filter((he=>!(he.schemeIdUri&&J.some((Ee=>Ee.schemeIdUri===he.schemeIdUri)))))).push(...J),Y}return g={areKeyIdsExpired:function(Y){return!!(h&&Y&&Y.normalizedKeyIds&&Y.normalizedKeyIds.size!==0)&&h.areKeyIdsExpired(Y.normalizedKeyIds)},areKeyIdsUsable:function(Y){return!(h&&Y&&Y.normalizedKeyIds&&Y.normalizedKeyIds.size!==0)||h.areKeyIdsUsable(Y.normalizedKeyIds)},isCodecSupportedBasedOnTestedConfigurations:function(Y,J){if(!Y||!Y.codec||Y.isSupported===!1)return!1;const he=Z(Y,J).map((Ee=>pe(Ee))).filter((Ee=>Ee!=null));return!(he&&he.length>0)||(function(Ee){return Ee.some((Le=>Le&&Le.decodingInfo&&Le.decodingInfo.supported))})(he)},isProtectionCompatible:function(Y,J){return!J||!(!Y.isEncrypted&&J.isEncrypted)},runCodecSupportCheck:function(Y,J){if(J!==r.default.AUDIO&&J!==r.default.VIDEO)return Promise.resolve();if(f.get().streaming.enhancement.enabled&&ae(Y.codec))return y=y.filter((Ee=>!ae(Ee.mediaSourceCodecString))),Promise.resolve(!0);const he=Z(Y,J);return(function(Ee,Le){return f.get().streaming.capabilities.useMediaCapabilitiesApi&&navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo&&(Ee.codec&&Le===r.default.AUDIO||Le===r.default.VIDEO&&Ee.codec&&Ee.width&&Ee.height&&Ee.bitrate&&Ee.framerate)})(Y,J)?(function(Ee){return new Promise((Le=>{if(!Ee||Ee.length===0)return void Le();const et=Ee.map((Ae=>(function(Ze){return new Promise((Be=>{pe(Ze)?Be():navigator.mediaCapabilities.decodingInfo(Ze).then((Ne=>{Ze.decodingInfo=Ne,y.push(Ze),Be()})).catch((Ne=>{Ze.decodingInfo={supported:!1},y.push(Ze),_.error(Ne),Be()}))}))})(Ae)));Promise.allSettled(et).then((()=>{Le()})).catch((Ae=>{_.error(Ae),Le()}))}))})(he):((function(Ee){if(!Ee||!Ee.length)return;const Le=Ee[0];if(pe(Le))return;let et={supported:!1};("ManagedMediaSource"in window&&ManagedMediaSource.isTypeSupported(Le.mediaSourceCodecString)||"MediaSource"in window&&MediaSource.isTypeSupported(Le.mediaSourceCodecString)||"WebKitMediaSource"in window&&WebKitMediaSource.isTypeSupported(Le.mediaSourceCodecString))&&(et.supported=!0),Le.decodingInfo=et,y.push(Le)})(he),Promise.resolve())},setConfig:function(Y){Y&&(Y.settings&&(f=Y.settings),Y.protectionController&&(h=Y.protectionController))},setEncryptedMediaSupported:function(Y){E=Y},setProtectionController:function(Y){h=Y},supportsChangeType:function(){return!!window.SourceBuffer&&!!SourceBuffer.prototype&&!!SourceBuffer.prototype.changeType},supportsEncryptedMedia:function(){return E},supportsEssentialProperty:function(Y){let J=f.get().streaming.capabilities.supportedEssentialProperties;f.get().streaming.capabilities.useMediaCapabilitiesApi&&f.get().streaming.capabilities.filterVideoColorimetryEssentialProperties&&(J=ke(J,[{schemeIdUri:r.default.COLOUR_PRIMARIES_SCHEME_ID_URI},{schemeIdUri:r.default.MATRIX_COEFFICIENTS_SCHEME_ID_URI},{schemeIdUri:r.default.TRANSFER_CHARACTERISTICS_SCHEME_ID_URI}])),f.get().streaming.capabilities.useMediaCapabilitiesApi&&f.get().streaming.capabilities.filterHDRMetadataFormatEssentialProperties&&(J=ke(J,[{schemeIdUri:r.default.HDR_METADATA_FORMAT_SCHEME_ID_URI}]));try{return Y.inArray(J)}catch{return!0}},supportsMediaSource:d},E=!1,y=[],_=(0,l.default)(L).getInstance().getLogger(g),g}c.__dashjs_factory_name="Capabilities",e.default=n.default.getSingletonFactory(c)},7377:function(u,e,t){t.r(e);var n=t(138),r=t(656);function i(){return{customTimeRangeArray:[],length:0,add:function(o,l){let d;for(d=0;d<this.customTimeRangeArray.length&&o>this.customTimeRangeArray[d].start;d++);for(this.customTimeRangeArray.splice(d,0,{start:o,end:l}),d=0;d<this.customTimeRangeArray.length-1;d++)this.mergeRanges(d,d+1)&&d--;this.length=this.customTimeRangeArray.length},clear:function(){this.customTimeRangeArray=[],this.length=0},remove:function(o,l){for(let d=0;d<this.customTimeRangeArray.length;d++)if(o<=this.customTimeRangeArray[d].start&&l>=this.customTimeRangeArray[d].end)this.customTimeRangeArray.splice(d,1),d--;else{if(o>this.customTimeRangeArray[d].start&&l<this.customTimeRangeArray[d].end){this.customTimeRangeArray.splice(d+1,0,{start:l,end:this.customTimeRangeArray[d].end}),this.customTimeRangeArray[d].end=o;break}o>this.customTimeRangeArray[d].start&&o<this.customTimeRangeArray[d].end?this.customTimeRangeArray[d].end=o:l>this.customTimeRangeArray[d].start&&l<this.customTimeRangeArray[d].end&&(this.customTimeRangeArray[d].start=l)}this.length=this.customTimeRangeArray.length},mergeRanges:function(o,l){let d=this.customTimeRangeArray[o],c=this.customTimeRangeArray[l];return d.start<=c.start&&c.start<=d.end&&d.end<=c.end?(d.end=c.end,this.customTimeRangeArray.splice(l,1),!0):c.start<=d.start&&d.start<=c.end&&c.end<=d.end?(d.start=c.start,this.customTimeRangeArray.splice(l,1),!0):c.start<=d.start&&d.start<=c.end&&d.end<=c.end?(this.customTimeRangeArray.splice(o,1),!0):d.start<=c.start&&c.start<=d.end&&c.end<=d.end&&(this.customTimeRangeArray.splice(l,1),!0)},start:function(o){return(0,r.checkInteger)(o),o>=this.customTimeRangeArray.length||o<0?NaN:this.customTimeRangeArray[o].start},end:function(o){return(0,r.checkInteger)(o),o>=this.customTimeRangeArray.length||o<0?NaN:this.customTimeRangeArray[o].end}}}i.__dashjs_factory_name="CustomTimeRanges",e.default=n.default.getClassFactory(i)},7393:function(u,e,t){t.r(e);var n=t(138),r=t(7316);function i(){let o;return o={areEqual:function(l,d){return r(l,d)}},o}i.__dashjs_factory_name="ObjectUtils",e.default=n.default.getSingletonFactory(i)},656:function(u,e,t){t.r(e),t.d(e,{checkInteger:function(){return i},checkIsVideoOrAudioType:function(){return l},checkParameterType:function(){return r},checkRange:function(){return o}});var n=t(5212);function r(d,c){if(typeof d!==c)throw n.default.BAD_ARGUMENT_ERROR}function i(d){if(d===null||isNaN(d)||d%1!=0)throw n.default.BAD_ARGUMENT_ERROR+" : argument is not an integer"}function o(d,c,g){if(d<c||d>g)throw n.default.BAD_ARGUMENT_ERROR+" : argument out of range"}function l(d){if(typeof d!="string"||d!==n.default.AUDIO&&d!==n.default.VIDEO)throw n.default.BAD_ARGUMENT_ERROR}},1944:function(u,e,t){t.r(e),e.default=class{constructor(n,r,i){this.code=n||null,this.message=r||null,this.data=i||null}}},5560:function(u,e,t){t.r(e);var n=t(8854);e.default=class{constructor(r){this.id=r.id,this.url=r.url,this.language=r.language,this.mimeType=r.mimeType,this.bandwidth=r.bandwidth,this.periodId=r.periodId||null}serializeToMpdParserFormat(){return{tagName:n.default.ADAPTATION_SET,mimeType:this.mimeType,lang:this.language,Representation:[{tagName:n.default.REPRESENTATION,id:this.id,bandwidth:this.bandwidth,BaseURL:[{tagName:n.default.BASE_URL,__text:this.url}],mimeType:this.mimeType}]}}}},7568:function(u,e,t){t.r(e),t.d(e,{HTTPRequest:function(){return n},HTTPRequestTrace:function(){return r}});class n{constructor(){this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.responsecode=null,this.interval=null,this.trace=[],this.cmsd=null,this._stream=null,this._tfinish=null,this._mediaduration=null,this._responseHeaders=null,this._serviceLocation=null,this._fileLoaderType=null,this._resourceTimingValues=null}}class r{constructor(){this.s=null,this.d=null,this.b=[]}}n.GET="GET",n.HEAD="HEAD",n.MPD_TYPE="MPD",n.XLINK_EXPANSION_TYPE="XLinkExpansion",n.INIT_SEGMENT_TYPE="InitializationSegment",n.INDEX_SEGMENT_TYPE="IndexSegment",n.MEDIA_SEGMENT_TYPE="MediaSegment",n.BITSTREAM_SWITCHING_SEGMENT_TYPE="BitstreamSwitchingSegment",n.MSS_FRAGMENT_INFO_SEGMENT_TYPE="FragmentInfoSegment",n.DVB_REPORTING_TYPE="DVBReporting",n.LICENSE="license",n.CONTENT_STEERING_TYPE="ContentSteering",n.OTHER_TYPE="other"}},gh={};function vr(u){var e=gh[u];if(e!==void 0)return e.exports;var t=gh[u]={exports:{}};return vS[u].call(t.exports,t,t.exports,vr),t.exports}vr.amdO={},vr.d=function(u,e){for(var t in e)vr.o(e,t)&&!vr.o(u,t)&&Object.defineProperty(u,t,{enumerable:!0,get:e[t]})},vr.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}})(),vr.o=function(u,e){return Object.prototype.hasOwnProperty.call(u,e)},vr.r=function(u){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(u,"__esModule",{value:!0})};var Xr={};vr.r(Xr),vr.d(Xr,{Constants:function(){return sm.default},Debug:function(){return am.default},ExternalSubtitle:function(){return lm.default},MediaPlayer:function(){return SS.MediaPlayer},MediaPlayerFactory:function(){return im},MetricsReporting:function(){return nm.default},Protection:function(){return rm.default},default:function(){return AS},supportsMediaSource:function(){return om.supportsMediaSource}});var SS=vr(5393),nm=vr(4469),rm=vr(3888),_S=vr(8200);let mh,to=(function(){const u="application/dash+xml";let e;function t(r,i,o){if(!r||!/^VIDEO$/i.test(r.nodeName))return null;if(r._dashjs_player)return r._dashjs_player;let l,d=r.id||r.name||"video element";if(!(i=i||[].slice.call(r.querySelectorAll("source")).filter((function(c){return c.type==u}))[0])&&r.src)(i=document.createElement("source")).src=r.src;else if(!i&&!r.src)return null;return o=o||{},l=(0,_S.default)(o).create(),l.initialize(r,i.src,r.autoplay),e||(e=l.getDebug().getLogger()),e.debug("Converted "+d+" to dash.js player and added content: "+i.src),r._dashjs_player=l,l}function n(r){return/^VIDEO$/i.test(r.nodeName)?r:n(r.parentNode)}return{create:t,createAll:function(r,i){let o=[];r=r||"[data-dashjs-player]";let l=(i=i||document).querySelectorAll(r);for(let c=0;c<l.length;c++){let g=t(l[c],null);o.push(g)}let d=i.querySelectorAll('source[type="'+u+'"]');for(let c=0;c<d.length;c++){let g=t(n(d[c]),null);o.push(g)}return o}}})();!(typeof window<"u"&&window&&window.dashjs&&window.dashjs.skipAutoCreate)&&typeof window<"u"&&window&&window.addEventListener&&(window.document.readyState==="complete"?window.dashjs?to.createAll():mh=window.setInterval((function(){window.dashjs&&(window.clearInterval(mh),to.createAll())}),500):window.addEventListener("load",(function u(){window.removeEventListener("load",u),to.createAll()})));var im=to,am=vr(649),sm=vr(5212),om=vr(559),lm=vr(5560);dashjs.Protection=rm.default,dashjs.MetricsReporting=nm.default,dashjs.MediaPlayerFactory=im,dashjs.Debug=am.default,dashjs.supportsMediaSource=om.supportsMediaSource,dashjs.Constants=sm.default,dashjs.ExternalSubtitle=lm.default;var AS=dashjs;(Xr=Xr.default).Constants;Xr.Debug;Xr.ExternalSubtitle;var IS=Xr.MediaPlayer;Xr.MediaPlayerFactory;Xr.MetricsReporting;Xr.Protection;Xr.default;Xr.supportsMediaSource;class xS{player=null;videoElement;config;listeners=new Map;destroyed=!1;activeSubtitleLanguage=null;onPlaying=()=>this.emit("state-change",{state:"playing"});onPause=()=>this.emit("state-change",{state:"paused"});onWaiting=()=>this.emit("state-change",{state:"buffering"});constructor(e,t={}){this.videoElement=e,this.config=t}async load(e){if(!this.destroyed)return this.player=IS().create(),this.player.updateSettings({streaming:{buffer:{bufferTimeAtTopQuality:this.config.maxBufferAhead??30,bufferTimeAtTopQualityLongForm:60,bufferTimeDefault:12,fastSwitchEnabled:!0},delay:this.config.lowLatency?{liveDelay:2}:{},abr:{autoSwitchBitrate:{video:!0,audio:!1}}},debug:{logLevel:this.config.debug?4:0}}),this.setupDashListeners(),this.attachVideoListeners(),this.player.initialize(this.videoElement,e,this.config.autoStart??!0),this.applyDrmConfig(),new Promise((t,n)=>{if(!this.player){n(new Error("DASH player not created"));return}const r=()=>{o(),t()},i=l=>{const d=l?.error?.code??0;[10,11,31,32].includes(d)&&(o(),n(new Error(l?.error?.message??"DASH manifest load failed")))},o=()=>{this.player?.off("streamInitialized",r),this.player?.off("error",i)};this.player.on("streamInitialized",r),this.player.on("error",i)})}applyDrmConfig(){const e=this.config.drmConfig;if(!this.player||!e)return;const t={};e.widevine&&(t["com.widevine.alpha"]={serverURL:e.widevine.licenseUrl,httpRequestHeaders:e.widevine.headers??{},withCredentials:e.widevine.withCredentials??!1}),e.playready&&(t["com.microsoft.playready"]={serverURL:e.playready.licenseUrl,httpRequestHeaders:e.playready.headers??{},withCredentials:e.playready.withCredentials??!1}),Object.keys(t).length>0&&this.player.setProtectionData(t)}setupDashListeners(){this.player&&(this.player.on("qualityChangeRendered",e=>{if(e?.mediaType!=="video")return;const t=this.getCurrentQuality();t&&this.emit("quality-changed",{quality:t})}),this.player.on("currentTrackChanged",e=>{if(e?.mediaType!=="audio")return;const n=(this.player?.getTracksFor("audio")??[]).findIndex(r=>r===e.newMediaInfo);n!==-1&&this.emit("audio-track-changed",{trackId:String(n)})}),this.player.on("error",e=>{const t=String(e?.error?.code??"DASH_ERROR"),n=String(e?.error?.message??`DASH error: ${t}`);console.error("[DashEngine] Error:",t,n,e),this.emit("error",{error:{code:t,message:n,fatal:!0,details:e}})}))}attachVideoListeners(){this.videoElement.addEventListener("playing",this.onPlaying),this.videoElement.addEventListener("pause",this.onPause),this.videoElement.addEventListener("waiting",this.onWaiting)}detachVideoListeners(){this.videoElement.removeEventListener("playing",this.onPlaying),this.videoElement.removeEventListener("pause",this.onPause),this.videoElement.removeEventListener("waiting",this.onWaiting)}getQualities(){if(!this.player)return[];const e=this.player.getRepresentationsByType("video");if(!e||e.length===0)return[];const t={id:"auto",label:"Auto",width:0,height:0,bandwidth:0,codecs:"",uri:""},n=e.map((r,i)=>this.mapRepresentationToQuality(r,i));return[t,...n]}getCurrentQuality(){if(!this.player)return null;const e=this.player.getCurrentRepresentationForType("video");if(!e)return null;const n=this.player.getRepresentationsByType("video").findIndex(r=>r.id===e.id);return this.mapRepresentationToQuality(e,n>=0?n:0)}setQuality(e){if(!this.player)return;if(e==="auto"){this.enableAutoQuality();return}const t=parseInt(e,10);if(isNaN(t)||t<0){console.warn("[DashEngine] Invalid quality id:",e);return}this.player.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),this.player.setRepresentationForTypeByIndex("video",t,!0)}enableAutoQuality(){this.player&&this.player.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}})}getAudioTracks(){return this.player?this.player.getTracksFor("audio").map((e,t)=>({id:String(t),label:e.labels?.[0]?.text||e.lang||`Track ${t+1}`,language:e.lang||""})):[]}getActiveAudioTrackId(){if(!this.player)return"";const e=this.player.getCurrentTrackFor("audio");if(!e)return"";const n=this.player.getTracksFor("audio").findIndex(r=>r===e);return n>=0?String(n):"0"}setAudioTrack(e){if(!this.player)return;const t=parseInt(e,10),n=this.player.getTracksFor("audio");if(isNaN(t)||t<0||t>=n.length){console.warn("[DashEngine] Invalid audio track id:",e);return}this.player.setCurrentTrack(n[t])}getSubtitleTracks(){return this.player?this.player.getTracksFor("text").map(e=>({language:e.lang||"",label:e.labels?.[0]?.text||e.lang||"",url:""})):[]}async setSubtitleTrack(e){if(!this.player)return;if(e===null){this.player.enableText(!1),this.activeSubtitleLanguage=null,this.emit("subtitle-track-changed",{language:null});return}const n=this.player.getTracksFor("text").findIndex(r=>r.lang===e||r.labels?.[0]?.text===e);if(n===-1){console.warn("[DashEngine] Subtitle track not found:",e);return}this.player.setTextTrack(n),this.player.enableText(!0),this.activeSubtitleLanguage=e,this.emit("subtitle-track-changed",{language:e})}getActiveSubtitleLanguage(){return this.activeSubtitleLanguage}attachCaptions(e){}attachSubtitles(e){}isLiveStream(){return this.player?.isDynamic()??!1}getLiveEdgeTime(){const e=this.videoElement.seekable;return e.length>0?e.end(e.length-1):this.videoElement.duration||0}seekToLiveEdge(){this.player&&this.player.seekToOriginalLive()}getDVRRange(){if(!this.isLiveStream())return null;const e=this.player?.getDvrWindow();return e?{start:e.start,end:e.end}:null}on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,t){this.listeners.get(e)?.forEach(n=>n(t))}mapRepresentationToQuality(e,t){const n=e.height??0,r=e.bandwidth??0;let i;return n>=2160?i="4K":n>=1440?i="1440p":n>=1080?i="1080p":n>=720?i="720p":n>=480?i="480p":n>=360?i="360p":n>=240?i="240p":r>0?i=`${Math.round(r/1e3)}k`:i=`Level ${t+1}`,{id:String(t),label:i,width:0,height:n,bandwidth:r,codecs:e.codecs??"",uri:""}}async destroy(){this.destroyed=!0,this.detachVideoListeners(),this.player&&(this.player.reset(),this.player=null),this.listeners.clear(),this.activeSubtitleLanguage=null}}class um{video;events;options;timer=null;lastTime=-1;stallDuration=0;attempts=0;isRunning=!1;constructor(e,t,n={}){this.video=e,this.events=t,this.options={pollInterval:n.pollInterval??500,stallThreshold:n.stallThreshold??3,onQualityDowngrade:n.onQualityDowngrade}}start(){this.isRunning||(this.isRunning=!0,this.reset(),this.timer=setInterval(()=>this.tick(),this.options.pollInterval))}stop(){this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.isRunning=!1,this.reset()}destroy(){this.stop()}reset(){this.lastTime=-1,this.stallDuration=0,this.attempts=0}tick(){const e=this.video;if(e.paused||e.ended||e.seeking||e.readyState<2){this.stallDuration=0,this.lastTime=e.currentTime;return}const t=e.currentTime;if(this.lastTime<0){this.lastTime=t;return}const n=t-this.lastTime;if(this.lastTime=t,n>.05){if(this.stallDuration>0){const o=this.attempts>=3?"quality":"seek";this.events.emit("stallrecovered",{duration:Math.round(this.stallDuration),method:o})}this.stallDuration=0,this.attempts=0;return}this.stallDuration+=this.options.pollInterval/1e3;const{stallThreshold:r}=this.options,i=Math.floor(this.stallDuration/r);i>this.attempts&&(this.attempts=i,this.recover())}recover(){const e=this.video;switch(this.events.emit("stall",{duration:Math.round(this.stallDuration),attempt:this.attempts}),this.attempts){case 1:e.currentTime=Math.min(e.currentTime+.5,e.duration||1/0);break;case 2:e.currentTime=Math.min(e.currentTime+2,e.duration||1/0);break;case 3:this.options.onQualityDowngrade&&this.options.onQualityDowngrade(),e.currentTime=Math.min(e.currentTime+2,e.duration||1/0);break;default:this.events.emit("error",{code:"STALL_UNRECOVERABLE",message:`Playback stalled for ${Math.round(this.stallDuration)}s and could not be recovered.`}),this.stop();break}}}class Pa{videoEngine=null;configManager=null;stateManager=null;videoElement=null;container=null;events;streamType="unknown";streamInfo=null;hlsEngine=null;dashEngine=null;airPlayAvailable=!1;airPlayActive=!1;onAirPlayAvailabilityChanged=null;onAirPlayTargetChanged=null;stallDetector=null;liveLatencyTimer=null;atLiveEdgeTolerance=10;drmConfig=null;constructor(e){this.videoElement=e,this.events=new Sh,this.initialize()}initialize(){if(!this.videoElement)return;this.videoEngine=new gE(this.videoElement);const e=this.loadPersistedVolume();e!==null&&(this.videoElement.volume=e),this.stateManager=new pE({isPlaying:!1,isMuted:this.videoElement.muted,volume:this.videoElement.volume,currentTime:0,duration:0,playbackRate:this.videoElement.playbackRate||1}),this.setupStateListeners(),this.setupAirPlay()}setupStateListeners(){!this.stateManager||!this.videoElement||(this.videoElement.addEventListener(zn.PLAY,()=>{this.events.emit("play",{timestamp:Date.now()})}),this.videoElement.addEventListener(zn.PAUSE,()=>{this.events.emit("pause",{timestamp:Date.now()})}),this.videoElement.addEventListener(zn.TIME_UPDATE,()=>{this.events.emit("timeupdate",{currentTime:this.videoElement?.currentTime||0,duration:this.videoElement?.duration||0})}),this.videoElement.addEventListener(zn.ENDED,()=>{this.events.emit("ended",{timestamp:Date.now()})}),this.videoElement.addEventListener(zn.LOADED_METADATA,()=>{this.events.emit("loadedmetadata",{duration:this.videoElement?.duration||0,videoWidth:this.videoElement?.videoWidth||0,videoHeight:this.videoElement?.videoHeight||0})}),this.videoElement.addEventListener(zn.RATE_CHANGE,()=>{const e=this.videoElement?.playbackRate||1;this.stateManager?.set("playbackRate",e),this.events.emit("ratechange",{playbackRate:e})}),this.videoElement.addEventListener(zn.ERROR,()=>{const e=this.videoElement?.error;if(e){const t=`MEDIA_ERR_${e.code===1?"ABORTED":e.code===2?"NETWORK":e.code===3?"DECODE":e.code===4?"SRC_NOT_SUPPORTED":"UNKNOWN"}`;Promise.resolve().then(()=>require("./ErrorManager-CDf_sFKX.cjs")).then(({errorManager:n})=>{n.dispatchError("Playback Error",t,e.message||"Video playback error",e)}),this.events.emit("error",{code:t,message:e.message||"Video playback error",details:e})}}),this.stateManager.subscribe(e=>{if(this.videoEngine){const t=this.videoEngine.getState();t.isPlaying!==e.isPlaying&&(e.isPlaying?this.videoEngine.play():this.videoEngine.pause()),t.isMuted!==e.isMuted&&this.videoEngine.toggleMute(),t.volume!==e.volume&&this.videoEngine.setVolume(e.volume)}}))}static createWithConfig(e){const t=typeof e.container=="string"?document.querySelector(e.container):e.container;if(!t)throw new Error(`Container not found: ${e.container}`);const n=document.createElement("video");n.id="virtus-video-player",n.src=e.src,n.width=typeof e.width=="number"?e.width:800,n.height=typeof e.height=="number"?e.height:450,n.autoplay=e.autoplay||!1,n.muted=e.muted||!1,n.controls=e.controls||!1,n.className=`playron ${e.className||""}`,e.poster&&(n.poster=e.poster),t.appendChild(n);const r=new Pa(n);return r.container=t,r.configManager=new mE(e),r}setupDrm(e){this.drmConfig=e}async play(){if(!this.videoEngine)throw new Error("VideoEngine not initialized");try{await this.videoEngine.play(),this.stateManager?.set("isPlaying",!0)}catch(e){throw console.error("Play failed:",e),e}}pause(){this.videoEngine&&(this.videoEngine.pause(),this.stateManager?.set("isPlaying",!1))}toggleMute(){if(!this.videoEngine)return;this.videoEngine.toggleMute();const e=this.videoEngine.getState();this.stateManager?.set("isMuted",e.isMuted)}setVolume(e){this.videoEngine&&(this.videoEngine.setVolume(e),this.stateManager?.set("volume",e),this.persistVolume(e))}getBufferedRanges(){if(!this.videoElement)return[];const e=[],{buffered:t}=this.videoElement;for(let n=0;n<t.length;n++)e.push({start:t.start(n),end:t.end(n)});return e}getPlayerStats(){const e=this.hlsEngine?.getStats()??{bandwidth:0,bufferHealth:0,droppedFrames:0,totalFrames:0,codec:"",resolution:"",segmentUrl:this.videoElement?.currentSrc??""};if(!this.hlsEngine&&this.videoElement){const t=this.videoElement,n=t.currentTime;for(let i=0;i<t.buffered.length;i++)if(t.buffered.start(i)<=n&&t.buffered.end(i)>=n){e.bufferHealth=parseFloat((t.buffered.end(i)-n).toFixed(2));break}const r=t.getVideoPlaybackQuality?.();e.droppedFrames=r?.droppedVideoFrames??0,e.totalFrames=r?.totalVideoFrames??0,t.videoWidth&&t.videoHeight&&!e.resolution&&(e.resolution=`${t.videoWidth}Γ${t.videoHeight}`),e.segmentUrl=t.currentSrc??""}return{...e,streamType:this.streamType}}persistVolume(e){try{localStorage.setItem("playron:volume",String(e))}catch{}}loadPersistedVolume(){try{const e=localStorage.getItem("playron:volume");if(e===null)return null;const t=parseFloat(e);return isFinite(t)?Math.max(0,Math.min(1,t)):null}catch{return null}}seekTo(e){this.videoEngine&&this.videoEngine.seekTo(e)}setPlaybackRate(e){this.videoEngine&&(this.videoEngine.setPlaybackRate(e),this.stateManager?.set("playbackRate",e))}async setSource(e){if(!this.videoEngine||!this.videoElement)return;console.log("[PlayerCore] Setting source:",e),await this.destroyStreamingEngines();const t=Ah.quickDetect(e);if(console.log("[PlayerCore] Detected protocol:",t.protocol),t.protocol==="hls"){this.hlsEngine=new TS(this.videoElement,{autoStart:!0,maxBufferAhead:30,maxBufferBehind:10,...this.drmConfig&&{drmConfig:this.drmConfig}}),this.hlsEngine.on("quality-changed",({quality:n})=>{this.events.emit("qualitychange",{from:"",to:n.label})}),this.hlsEngine.on("error",({error:n})=>{Promise.resolve().then(()=>require("./ErrorManager-CDf_sFKX.cjs")).then(({errorManager:r})=>{const i=String(n?.code??""),o=i.includes("NETWORK")||i.includes("CORS")?"Network Error":i.includes("PARSE")?"Manifest Parse Error":i.includes("FRAG")?"Frag Load Error":"Playback Error";r.dispatchError(o,String(n?.code??"HLS_ERROR"),String(n?.message??"HLS streaming error"),n?.details)}),this.events.emit("error",{code:String(n?.code??"HLS_ERROR"),message:String(n?.message??"HLS streaming error"),details:n})}),this.hlsEngine.on("state-change",({state:n})=>{n==="buffering"?this.stateManager?.set("isBuffering",!0):(n==="playing"||n==="paused")&&this.stateManager?.set("isBuffering",!1)});try{await this.hlsEngine.load(e),this.container&&(this.hlsEngine.attachCaptions(this.container),this.hlsEngine.attachSubtitles(this.container));const n=this.hlsEngine.isLiveStream();this.streamType=n?"live":"vod",this.streamInfo={type:this.streamType,protocol:"hls",isDynamic:n,hasDVR:n,isEngineSupported:!0},n&&this.startLiveLatencyTracking(this.atLiveEdgeTolerance),this.events.emit("tracksready",{hasQualities:this.hlsEngine.getQualities().length>1,hasAudioTracks:this.hlsEngine.getAudioTracks().length>1,hasSubtitleTracks:this.hlsEngine.getSubtitleTracks().length>0})}catch(n){console.error("[PlayerCore] HLS load failed:",n),this.streamType="unknown",this.streamInfo=null,await this.fallbackToNative(e,"hls")}}else if(t.protocol==="dash"){this.dashEngine=new xS(this.videoElement,{autoStart:!0,maxBufferAhead:30,lowLatency:!1,...this.drmConfig&&{drmConfig:this.drmConfig}}),this.dashEngine.on("quality-changed",({quality:n})=>{this.events.emit("qualitychange",{from:"",to:n.label})}),this.dashEngine.on("error",({error:n})=>{Promise.resolve().then(()=>require("./ErrorManager-CDf_sFKX.cjs")).then(({errorManager:r})=>{const i=String(n?.code??""),o=i.includes("NETWORK")||i.includes("27")?"Network Error":i.includes("PARSE")||i.includes("31")?"Manifest Parse Error":"Playback Error";r.dispatchError(o,String(n?.code??"DASH_ERROR"),String(n?.message??"DASH streaming error"),n?.details)}),this.events.emit("error",{code:String(n?.code??"DASH_ERROR"),message:String(n?.message??"DASH streaming error"),details:n})}),this.dashEngine.on("state-change",({state:n})=>{n==="buffering"?this.stateManager?.set("isBuffering",!0):(n==="playing"||n==="paused")&&this.stateManager?.set("isBuffering",!1)});try{await this.dashEngine.load(e),this.container&&(this.dashEngine.attachCaptions(this.container),this.dashEngine.attachSubtitles(this.container));const n=this.dashEngine.isLiveStream();this.streamType=n?"live":"vod",this.streamInfo={type:this.streamType,protocol:"dash",isDynamic:n,hasDVR:n,isEngineSupported:!0},n&&this.startLiveLatencyTracking(this.atLiveEdgeTolerance),this.events.emit("tracksready",{hasQualities:this.dashEngine.getQualities().length>1,hasAudioTracks:this.dashEngine.getAudioTracks().length>1,hasSubtitleTracks:this.dashEngine.getSubtitleTracks().length>0})}catch(n){console.error("[PlayerCore] DASH load failed:",n),this.streamType="unknown",this.streamInfo=null,await this.fallbackToNative(e,"dash")}}else this.streamType="vod",this.streamInfo={type:"vod",protocol:"progressive",isDynamic:!1,hasDVR:!1,isEngineSupported:!0},this.videoEngine.setSource(e);this.events.emit("streamTypeDetected",{type:this.streamType,info:this.streamInfo}),window.dispatchEvent(new CustomEvent("virtus:streamTypeDetected",{detail:{type:this.streamType,info:this.streamInfo}})),this.startStallDetector()}async destroyStreamingEngines(){this.stopLiveLatencyTracking(),this.hlsEngine&&(await this.hlsEngine.destroy(),this.hlsEngine=null),this.dashEngine&&(await this.dashEngine.destroy(),this.dashEngine=null)}async fallbackToNative(e,t){if(!(!this.videoElement||!this.videoEngine))try{console.log(`[PlayerCore] Attempting native fallback for ${t} stream`),this.videoEngine.setSource(e),this.streamType="vod",this.streamInfo={type:"vod",protocol:"progressive",isDynamic:!1,hasDVR:!1,isEngineSupported:!1}}catch(n){console.error("[PlayerCore] Native fallback failed:",n),this.events.emit("error",{code:"MEDIA_ERR_SRC_NOT_SUPPORTED",message:"Could not play stream natively or via fallback",details:n})}}getStreamType(){return this.streamType}getStreamInfo(){return this.streamInfo}isLive(){return this.streamType==="live"}getLiveEdgeTime(){return this.hlsEngine?.getLiveEdgeTime()??this.dashEngine?.getLiveEdgeTime()??0}getCurrentLatency(){if(!this.isLive())return 0;const e=this.getLiveEdgeTime();return e===0?0:Math.max(0,e-(this.videoElement?.currentTime??0))}isAtLiveEdge(e){return this.isLive()?this.getCurrentLatency()<=(e??this.atLiveEdgeTolerance):!1}seekToLiveEdge(){this.isLive()&&(this.hlsEngine?.seekToLiveEdge(),this.dashEngine?.seekToLiveEdge())}getDVRRange(){return this.hlsEngine?.getDVRRange()??this.dashEngine?.getDVRRange()??null}startLiveLatencyTracking(e){this.stopLiveLatencyTracking(),this.atLiveEdgeTolerance=e,this.liveLatencyTimer=setInterval(()=>{if(!this.isLive())return;const t=this.getCurrentLatency(),n=this.getLiveEdgeTime(),r=t<=this.atLiveEdgeTolerance;this.events.emit("livelatencyupdate",{latency:t,isAtLiveEdge:r,liveEdgeTime:n})},1e3)}stopLiveLatencyTracking(){this.liveLatencyTimer!==null&&(clearInterval(this.liveLatencyTimer),this.liveLatencyTimer=null)}startStallDetector(){this.stallDetector?.destroy(),this.stallDetector=new um(this.videoElement,this.events,{pollInterval:500,stallThreshold:3,onQualityDowngrade:()=>{const e=this.getAvailableQualities().filter(t=>t.id!=="auto");if(e.length>1){const t=this.getQuality();if(t&&t.id!=="auto"){const n=e.findIndex(r=>r.id===t.id);n>0&&this.setQuality(e[n-1].id)}}}}),this.stallDetector.start()}setPoster(e){this.videoEngine&&this.videoEngine.setPoster(e)}setDimensions(e,t){this.videoEngine&&this.videoEngine.setDimensions(e,t)}getState(){return this.stateManager?this.stateManager.getState():null}getVideoEngine(){return this.videoEngine}getConfigManager(){return this.configManager}getStateManager(){return this.stateManager}getVideoElement(){return this.videoElement}toggleFullscreen(){this.container&&(document.fullscreenElement?document.exitFullscreen?.():this.container.requestFullscreen?.())}async togglePip(){if(this.videoElement)try{document.pictureInPictureElement?await document.exitPictureInPicture():await this.videoElement.requestPictureInPicture()}catch(e){console.error("PiP error:",e)}}skipBackward(e=15){if(!this.videoElement)return;const t=Math.max(0,this.videoElement.currentTime-e);this.seekTo(t)}skipForward(e=15){if(!this.videoElement)return;const t=Math.min(this.videoElement.duration||0,this.videoElement.currentTime+e);this.seekTo(t)}setLoop(e){this.videoElement&&(this.videoElement.loop=e)}getLoop(){return this.videoElement?.loop||!1}setQuality(e){this.hlsEngine?e==="auto"?this.hlsEngine.enableAutoQuality():this.hlsEngine.setQuality(e):this.dashEngine&&this.dashEngine.setQuality(e)}getQuality(){return this.hlsEngine?.getCurrentQuality()??this.dashEngine?.getCurrentQuality()??null}getAvailableQualities(){return this.hlsEngine?.getQualities()??this.dashEngine?.getQualities()??[]}setAudioTrack(e){this.hlsEngine?.setAudioTrack(e),this.dashEngine?.setAudioTrack(e)}getAudioTrack(){return this.hlsEngine?.getActiveAudioTrackId()??this.dashEngine?.getActiveAudioTrackId()??""}getAvailableAudioTracks(){return this.hlsEngine?.getAudioTracks()??this.dashEngine?.getAudioTracks()??[]}getSubtitleTracks(){return this.hlsEngine?.getSubtitleTracks()??this.dashEngine?.getSubtitleTracks()??[]}async setSubtitleTrack(e){await this.hlsEngine?.setSubtitleTrack(e),await this.dashEngine?.setSubtitleTrack(e)}getActiveSubtitleLanguage(){return this.hlsEngine?.getActiveSubtitleLanguage()??this.dashEngine?.getActiveSubtitleLanguage()??null}setupAirPlay(){!this.videoElement||typeof this.videoElement.webkitShowPlaybackTargetPicker!="function"||(this.onAirPlayAvailabilityChanged=t=>{const n=t;this.airPlayAvailable=n.availability==="available",this.events.emit("airplaychange",{isAvailable:this.airPlayAvailable,isActive:this.airPlayActive})},this.onAirPlayTargetChanged=()=>{this.airPlayActive=!!this.videoElement.webkitCurrentPlaybackTargetIsWireless,this.events.emit("airplaychange",{isAvailable:this.airPlayAvailable,isActive:this.airPlayActive})},this.videoElement.addEventListener("webkitplaybacktargetavailabilitychanged",this.onAirPlayAvailabilityChanged),this.videoElement.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",this.onAirPlayTargetChanged))}showAirPlayPicker(){if(!this.videoElement)return;const e=this.videoElement;typeof e.webkitShowPlaybackTargetPicker=="function"?e.webkitShowPlaybackTargetPicker():console.warn("[PlayerCore] AirPlay not supported in this browser")}isAirPlayAvailable(){return this.airPlayAvailable}isAirPlayActive(){return this.airPlayActive}destroyAirPlay(){this.videoElement&&(this.onAirPlayAvailabilityChanged&&(this.videoElement.removeEventListener("webkitplaybacktargetavailabilitychanged",this.onAirPlayAvailabilityChanged),this.onAirPlayAvailabilityChanged=null),this.onAirPlayTargetChanged&&(this.videoElement.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",this.onAirPlayTargetChanged),this.onAirPlayTargetChanged=null))}toggleTheaterMode(){if(this.container){const e=this.container,t=e.isTheaterMode||!1;e.isTheaterMode=!t,window.dispatchEvent(new CustomEvent("virtus:theatermodechange",{detail:{isTheaterMode:!t},bubbles:!0}))}}isTheaterMode(){return this.container?.isTheaterMode||!1}destroy(){this.stallDetector?.destroy(),this.stallDetector=null,this.destroyAirPlay(),this.destroyStreamingEngines(),this.videoEngine&&(this.videoEngine.destroy(),this.videoEngine=null),this.stateManager&&(this.stateManager.reset(),this.stateManager=null),this.configManager&&(this.configManager.reset(),this.configManager=null),this.videoElement=null,this.container=null}}const cm=At.createContext(null),dm={isPlaying:!1,isMuted:!1,volume:1,currentTime:0,duration:0,isLive:!1,isAtLiveEdge:!1,liveLatency:0},fm=At.createContext(dm),hm=At.createContext(null);function gm({children:u,playerInstance:e}){const[t,n]=At.useState(dm);At.useEffect(()=>{if(!e)return;const i=e.getStateManager();if(!i)return;n(i.getState());const o=d=>{n(d)};i.subscribe(o);const l=e.getVideoElement();if(l){const d=()=>{const h=e.isLive();i.updateState({currentTime:l.currentTime,duration:l.duration||0,isLive:h})},c=()=>{i.set("isPlaying",!l.paused)},g=()=>{i.updateState({volume:l.volume,isMuted:l.muted})},f=({latency:h,isAtLiveEdge:y})=>{i.updateState({liveLatency:h,isAtLiveEdge:y,isLive:!0})};return e.events.on("livelatencyupdate",f),l.addEventListener(zn.TIME_UPDATE,d),l.addEventListener(zn.PLAY,c),l.addEventListener(zn.PAUSE,c),l.addEventListener(zn.VOLUME_CHANGE,g),l.addEventListener(zn.LOADED_METADATA,d),()=>{e.events.off("livelatencyupdate",f),l.removeEventListener(zn.TIME_UPDATE,d),l.removeEventListener(zn.PLAY,c),l.removeEventListener(zn.PAUSE,c),l.removeEventListener(zn.VOLUME_CHANGE,g),l.removeEventListener(zn.LOADED_METADATA,d),i.unsubscribe(o)}}return()=>{i.unsubscribe(o)}},[e]);const r=At.useMemo(()=>e?{play:async()=>{await e.play()},pause:()=>{e.pause()},togglePlay:async()=>{e.getState()?.isPlaying?e.pause():await e.play()},toggleMute:()=>{e.toggleMute()},setVolume:i=>{e.setVolume(i)},seekTo:i=>{e.seekTo(i)},setPlaybackRate:i=>{e.setPlaybackRate(i)},toggleFullscreen:()=>{e.toggleFullscreen()},togglePip:async()=>{await e.togglePip()},skipBackward:(i=15)=>{e.skipBackward(i)},skipForward:(i=15)=>{e.skipForward(i)},setLoop:i=>{e.setLoop(i)},getLoop:()=>e.getLoop(),setQuality:i=>{e.setQuality(i)},getQuality:()=>e.getQuality(),getAvailableQualities:()=>e.getAvailableQualities(),setAudioTrack:i=>{e.setAudioTrack(i)},getAudioTrack:()=>e.getAudioTrack(),getAvailableAudioTracks:()=>e.getAvailableAudioTracks(),toggleTheaterMode:()=>{e.toggleTheaterMode()},isTheaterMode:()=>e.isTheaterMode(),getPlayer:()=>e,getStreamType:()=>e.getStreamType(),getStreamInfo:()=>e.getStreamInfo(),isLive:()=>e.isLive(),getBufferedRanges:()=>e.getBufferedRanges(),seekToLiveEdge:()=>{e.seekToLiveEdge()},getCurrentLatency:()=>e.getCurrentLatency(),isAtLiveEdge:i=>e.isAtLiveEdge(i),getDVRRange:()=>e.getDVRRange(),getSubtitleTracks:()=>e.getSubtitleTracks(),setSubtitleTrack:async i=>{await e.setSubtitleTrack(i)},getActiveSubtitleLanguage:()=>e.getActiveSubtitleLanguage(),getPlayerStats:()=>e.getPlayerStats()}:null,[e]);return ve.jsx(cm.Provider,{value:e,children:ve.jsx(hm.Provider,{value:r,children:ve.jsx(fm.Provider,{value:t,children:u})})})}function Fr(u){const e=At.useContext(fm);if(!e)throw new Error("usePlayerState must be used within PlayerProvider");return u?u(e):e}function kr(){const u=At.useContext(hm);if(!u)throw new Error("usePlayerMethods must be used within PlayerProvider");return u}function ph({size:u=40}){return ve.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{width:`${u}px`,height:`${u}px`,animation:"spin 1s linear infinite"},children:[ve.jsx("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"}),ve.jsx("style",{children:`
|
|
61
|
+
@keyframes spin {
|
|
62
|
+
0% { transform: rotate(0deg); }
|
|
63
|
+
100% { transform: rotate(360deg); }
|
|
64
|
+
}
|
|
65
|
+
`})]})}function wS({children:u,zIndex:e=2e3,backgroundColor:t="rgba(0, 0, 0, 0.8)",onClick:n,style:r}){return ve.jsx("div",{onClick:n,style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:e,backgroundColor:t,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"all",...r},children:u})}const RS="_overlay_3mfq6_3",kS="_iconContainer_3mfq6_17",CS="_loading_3mfq6_30",LS="_icon_3mfq6_17",DS="_customIcon_3mfq6_46",ki={overlay:RS,iconContainer:kS,loading:CS,icon:LS,customIcon:DS};function PS({config:u,isAdLoading:e}){const t=Fr(pe=>pe.isPlaying),{togglePlay:n,toggleFullscreen:r,getPlayer:i}=kr(),[o,l]=At.useState(!1),[d,c]=At.useState("play"),[g,f]=At.useState(!1),h=At.useRef(null);At.useEffect(()=>{console.log("[VideoOverlay] isAdLoading changed:",e),e?(console.log("[VideoOverlay] β
Showing ad loading icon"),f(!0),c("loading"),l(!0)):(console.log("[VideoOverlay] β Hiding ad loading icon"),f(!1),l(!1))},[e]);const y=u?.ui?.overlayIcons?.playIcon,E=u?.ui?.overlayIcons?.pauseIcon,_=u?.ui?.overlayIcons?.iconSize||40,L=u?.ui?.overlayIcons?.containerSize||80;At.useEffect(()=>{const pe=i();if(!pe)return;const xe=pe.video||pe.videoElement;if(!xe)return;const ke=()=>{f(!0),c("loading"),l(!0),h.current&&clearTimeout(h.current)},Y=()=>{h.current=window.setTimeout(()=>{f(!1),l(!1)},300)},J=()=>{f(!0),c("loading"),l(!0)},he=()=>{g&&(h.current=window.setTimeout(()=>{f(!1),l(!1)},300))},Ee=()=>{g&&(h.current=window.setTimeout(()=>{f(!1),l(!1)},300))},Le=()=>{f(!0),c("loading"),l(!0)};return xe.addEventListener(zn.SEEKING,ke),xe.addEventListener(zn.SEEKED,Y),xe.addEventListener(zn.WAITING,J),xe.addEventListener(zn.PLAYING,he),xe.addEventListener(zn.CAN_PLAY,Ee),xe.addEventListener(zn.LOAD_START,Le),()=>{xe.removeEventListener(zn.SEEKING,ke),xe.removeEventListener(zn.SEEKED,Y),xe.removeEventListener(zn.WAITING,J),xe.removeEventListener(zn.PLAYING,he),xe.removeEventListener(zn.CAN_PLAY,Ee),xe.removeEventListener(zn.LOAD_START,Le),h.current&&clearTimeout(h.current)}},[i,g]),At.useEffect(()=>{if(!g){c(t?"pause":"play"),l(!0);const pe=setTimeout(()=>{l(!1)},600);return()=>clearTimeout(pe)}},[t,g]);const K=At.useCallback(async()=>{await n()},[n]),Z=At.useCallback(()=>{r()},[r]),ae=pe=>{const xe=pe==="play"?y:E;return xe?/^https?:\/\//.test(xe)||/\.(jpg|jpeg|png|svg|gif|webp)$/i.test(xe)?ve.jsx("img",{src:xe,alt:pe==="play"?"Play":"Pause",className:ki.customIcon,style:{"--icon-size":`${_}px`}}):ve.jsx("div",{dangerouslySetInnerHTML:{__html:xe},className:ki.customIcon,style:{"--icon-size":`${_}px`}}):pe==="play"?ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:ki.icon,style:{"--icon-size":`${_}px`},viewBox:"0 0 24 24",children:ve.jsx("path",{fillRule:"evenodd",d:"M8.6 5.2A1 1 0 0 0 7 6v12a1 1 0 0 0 1.6.8l8-6a1 1 0 0 0 0-1.6l-8-6Z",clipRule:"evenodd"})}):ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:ki.icon,style:{"--icon-size":`${_}px`},viewBox:"0 0 24 24",children:ve.jsx("path",{fillRule:"evenodd",d:"M8 5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2H8Zm7 0a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-1Z",clipRule:"evenodd"})})};return ve.jsxs(ve.Fragment,{children:[e&&ve.jsx(wS,{children:ve.jsx("div",{className:`${ki.iconContainer} ${ki.loading}`,style:{"--icon-container-size":`${L}px`,"--icon-size":`${_}px`},children:ve.jsx(ph,{size:_})})}),ve.jsx("div",{className:`virtus-video-overlay ${ki.overlay}`,onClick:K,onDoubleClick:Z,children:o&&!e&&ve.jsx("div",{className:`${ki.iconContainer} ${g?ki.loading:""}`,style:{"--icon-container-size":`${L}px`,"--icon-size":`${_}px`},children:d==="loading"?ve.jsx(ph,{size:_}):ae(d)})})]})}const NS=At.memo(PS);function yu(){const u=At.useContext(cm);if(!u)throw new Error("usePlayer must be used within PlayerProvider");return u}const mm=[{contentType:'video/mp4; codecs="avc1.42E01E"'}],MS=[{contentType:'audio/mp4; codecs="mp4a.40.2"'}],OS=[{initDataTypes:["cenc"],videoCapabilities:mm,audioCapabilities:MS}];async function _l(u){try{return await navigator.requestMediaKeySystemAccess(u,OS),!0}catch{return!1}}async function FS(){const[u,e,t]=await Promise.all([_l("com.widevine.alpha"),_l("com.microsoft.playready"),_l("org.w3.clearkey")]),n=await(async()=>{try{return await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:["skd"],videoCapabilities:mm}]),!0}catch{return!1}})();let r=null;return u?r="widevine":n?r="fairplay":e?r="playready":t&&(r="clearkey"),{widevine:u,fairplay:n,playready:e,clearkey:t,preferredSystem:r}}const US="_errorOverlay_4djr8_5",zS="_variant_drm_4djr8_19",BS="_variant_network_4djr8_23",jS="_variant_decode_4djr8_27",qS="_variant_generic_4djr8_31",GS="_errorContent_4djr8_37",$S="_errorIcon_4djr8_51",VS="_iconPulse_4djr8_1",HS="_drmGlow_4djr8_1",KS="_netGlow_4djr8_1",YS="_errorTitle_4djr8_86",WS="_errorMessage_4djr8_100",XS="_errorHint_4djr8_109",QS="_browserList_4djr8_117",ZS="_browserItem_4djr8_126",JS="_errorCode_4djr8_142",e_="_retryButton_4djr8_152",li={errorOverlay:US,variant_drm:zS,variant_network:BS,variant_decode:jS,variant_generic:qS,errorContent:GS,errorIcon:$S,iconPulse:VS,drmGlow:HS,netGlow:KS,errorTitle:YS,errorMessage:WS,errorHint:XS,browserList:QS,browserItem:ZS,errorCode:JS,retryButton:e_};function t_(u,e){const t=u.code.toUpperCase(),n=(u.message??"").toUpperCase();if(t.startsWith("DRM_")||t.includes("LICENSE")||t.includes("ENCRYPTED")||t.includes("KEY_SYSTEM")||t.includes("KEYSYSTEM")||t.includes("MEDIA_ERR_SRC_NOT_SUPPORTED")||n.includes("DRM")||n.includes("LICENSE")||n.includes("ENCRYPTED")||n.includes("NOT SUPPORTED")){if(e){if(e.fairplay&&!e.widevine&&!e.playready)return"drm_fairplay_needed";if(!e.widevine&&!e.fairplay&&!e.playready)return"drm_browser_unsupported"}return t.includes("LICENSE")||t==="DRM_LICENSE_FAILED"||t==="LICENSE_REQUEST_FAILED"?"drm_license_failed":"drm_generic"}return t.includes("MEDIA_ERR_NETWORK")||t.includes("NETWORK")||t.includes("FETCH")?"network":t.includes("MEDIA_ERR_DECODE")||t.includes("DECODE")||t.includes("CODEC")?"decode":"generic"}function yh(u,e){if(!u?.enabled)return null;const t=!!u.widevine,n=!!u.playready,r=!!u.fairplay;return t&&!e.widevine||n&&!e.playready&&!t?e.fairplay?"drm_fairplay_needed":"drm_browser_unsupported":r&&!e.fairplay&&!t?"drm_browser_unsupported":null}function n_(u){switch(u){case"drm_fairplay_needed":return{icon:"π",title:"DRM Protected Content",message:"This content is protected with Widevine DRM. Your browser (Safari) does not support this DRM system.",hint:"Please use one of the following browsers:",browsers:["Google Chrome","Mozilla Firefox","Microsoft Edge"],showRetry:!1,variant:"drm"};case"drm_browser_unsupported":return{icon:"π",title:"DRM Not Supported",message:"Your browser does not support the DRM system required to play this protected content.",hint:"Please try one of the following browsers:",browsers:["Google Chrome","Mozilla Firefox","Microsoft Edge"],showRetry:!1,variant:"drm"};case"drm_license_failed":return{icon:"π",title:"License Verification Failed",message:"A license could not be obtained for this content. Please check your connection and try again.",showRetry:!0,variant:"drm"};case"drm_generic":return{icon:"π",title:"Content Protection Error",message:"A DRM error occurred while trying to play this content. Please try again.",showRetry:!0,variant:"drm"};case"network":return{icon:"π‘",title:"Connection Error",message:"A network error occurred while loading the video. Please check your internet connection and try again.",showRetry:!0,variant:"network"};case"decode":return{icon:"βοΈ",title:"Format Not Supported",message:"This video format or codec is not supported by your browser.",showRetry:!1,variant:"decode"};default:return{icon:"β οΈ",title:"Playback Error",message:"An error occurred while playing the video. Please try again.",showRetry:!0,variant:"generic"}}}const r_=12e3;function i_({onRetry:u,drmConfig:e}){const t=yu(),[n,r]=At.useState(null),[i,o]=At.useState(null),l=At.useRef(null),d=At.useRef(null);d.current=n,At.useEffect(()=>{FS().then(h=>{o(h);const y=yh(e,h);y&&r({type:y,code:"DRM_NOT_SUPPORTED",rawMessage:"Browser does not support the required DRM key system.",persistent:!0})}).catch(()=>o(null))},[]),At.useEffect(()=>{if(!i||!e?.enabled)return;const h=yh(e,i);h&&!d.current&&r({type:h,code:"DRM_NOT_SUPPORTED",rawMessage:"Browser does not support the required DRM key system.",persistent:!0})},[e,i]),At.useEffect(()=>{if(!t||!e?.enabled)return;const h=t.getVideoElement();if(!h)return;const y=()=>{h.currentTime>.5||(l.current=setTimeout(()=>{if(d.current)return;const _=i,L=_?_.fairplay&&!_.widevine&&!_.playready?"drm_fairplay_needed":!_.widevine&&!_.fairplay&&!_.playready?"drm_browser_unsupported":"drm_generic":"drm_generic";r({type:L,code:"DRM_TIMEOUT",rawMessage:"Playback stalled β possible DRM or network issue.",persistent:!0})},r_))},E=()=>{l.current&&(clearTimeout(l.current),l.current=null)};return h.addEventListener("waiting",y),h.addEventListener("playing",E),h.addEventListener("timeupdate",E),()=>{h.removeEventListener("waiting",y),h.removeEventListener("playing",E),h.removeEventListener("timeupdate",E),E()}},[t,e,i]),At.useEffect(()=>{if(!t)return;const h=y=>{console.error("[ErrorOverlay] Player error:",y);const E=t_(y,i);r({type:E,code:y.code,rawMessage:y.message??"Unknown error"})};return t.events.on("error",h),()=>{t.events.off("error",h)}},[t,i]),At.useEffect(()=>{if(!t)return;const h=()=>r(y=>y?.persistent?y:null);return t.events.on("play",h),t.events.on("loadedmetadata",h),()=>{t.events.off("play",h),t.events.off("loadedmetadata",h)}},[t]);const c=At.useCallback(()=>{if(r(null),u){u();return}if(t){const h=t.getVideoElement();if(h?.src){const y=h.src;h.src="",h.load(),setTimeout(()=>{h&&(h.src=y,h.load())},100)}}},[t,u]);if(!n)return null;const g=n_(n.type),f=li[`variant_${g.variant}`]??"";return ve.jsx("div",{className:`${li.errorOverlay} ${f}`,children:ve.jsxs("div",{className:li.errorContent,children:[ve.jsx("div",{className:li.errorIcon,children:g.icon}),ve.jsx("h3",{className:li.errorTitle,children:g.title}),ve.jsx("p",{className:li.errorMessage,children:g.message}),g.hint&&ve.jsx("p",{className:li.errorHint,children:g.hint}),g.browsers&&ve.jsx("ul",{className:li.browserList,children:g.browsers.map(h=>ve.jsx("li",{className:li.browserItem,children:h},h))}),n.code&&g.variant!=="drm"&&ve.jsx("p",{className:li.errorCode,children:n.code}),g.showRetry&&ve.jsx("button",{onClick:c,className:li.retryButton,children:"β» Try Again"})]})})}const Ci={play:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("polygon",{points:"5 3 19 12 5 21 5 3"}),ve.jsx("line",{x1:"19",y1:"3",x2:"19",y2:"21"}),ve.jsx("line",{x1:"5",y1:"3",x2:"5",y2:"21"})]}),rewind:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),ve.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]}),forward:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),ve.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]}),volUp:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),ve.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),ve.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}),volDown:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),ve.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),ve.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}),mute:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),ve.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),ve.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}),fullscreen:ve.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:ve.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}),shortcuts:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),ve.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),close:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("circle",{cx:"12",cy:"12",r:"10"}),ve.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),ve.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},a_=[{key:"Space / K",description:"Play / Pause",icon:Ci.play},{key:"β",description:"Rewind 10 seconds",icon:Ci.rewind},{key:"β",description:"Forward 10 seconds",icon:Ci.forward},{key:"β",description:"Volume up 10%",icon:Ci.volUp},{key:"β",description:"Volume down 10%",icon:Ci.volDown},{key:"M",description:"Mute / Unmute",icon:Ci.mute},{key:"F",description:"Toggle fullscreen",icon:Ci.fullscreen},{key:"?",description:"Show keyboard shortcuts",icon:Ci.shortcuts},{key:"Esc",description:"Close overlays",icon:Ci.close}];function pm({isOpen:u,onClose:e}){const t=At.useCallback(n=>{n.key==="Escape"&&e()},[e]);return At.useEffect(()=>{if(u)return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[u,t]),u?ve.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",onClick:e,style:{position:"absolute",inset:0,zIndex:99999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)"},children:[ve.jsxs("div",{onClick:n=>n.stopPropagation(),style:{background:"rgba(12, 12, 20, 0.97)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:"14px",boxShadow:"0 12px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.08)",width:"320px",fontFamily:"system-ui, -apple-system, sans-serif",animation:"kbdFadeIn 0.18s ease-out",overflow:"hidden",backdropFilter:"blur(16px)"},children:[ve.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"11px 14px",borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[ve.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",color:"#fff",fontSize:"13px",fontWeight:600},children:[ve.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.6)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),ve.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Keyboard Shortcuts"]}),ve.jsx("button",{"aria-label":"Close",onClick:e,style:{background:"rgba(255,255,255,0.08)",border:"none",borderRadius:"6px",color:"rgba(255,255,255,0.6)",cursor:"pointer",width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},onMouseEnter:n=>n.currentTarget.style.background="rgba(255,255,255,0.15)",onMouseLeave:n=>n.currentTarget.style.background="rgba(255,255,255,0.08)",children:ve.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[ve.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ve.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),ve.jsx("div",{style:{padding:"4px 0"},children:a_.map(({key:n,description:r,icon:i})=>ve.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"9px 14px",gap:"10px",transition:"background 0.12s"},onMouseEnter:o=>o.currentTarget.style.background="rgba(255,255,255,0.05)",onMouseLeave:o=>o.currentTarget.style.background="transparent",children:[ve.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[ve.jsx("span",{style:{width:"28px",height:"28px",borderRadius:"7px",background:"rgba(255,255,255,0.08)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"rgba(255,255,255,0.65)"},children:i}),ve.jsx("span",{style:{color:"rgba(255,255,255,0.7)",fontSize:"13.5px"},children:r})]}),ve.jsx("kbd",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:"6px",color:"rgba(255,255,255,0.75)",fontFamily:"ui-monospace, SF Mono, monospace",fontSize:"11.5px",fontWeight:600,padding:"3px 9px",whiteSpace:"nowrap",flexShrink:0},children:n})]},n))}),ve.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid rgba(255,255,255,0.07)",fontSize:"11px",color:"rgba(255,255,255,0.28)",textAlign:"center"},children:["Press"," ",ve.jsx("kbd",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:"4px",padding:"1px 5px",fontSize:"10.5px",color:"rgba(255,255,255,0.4)",fontFamily:"monospace"},children:"?"})," ","or"," ",ve.jsx("kbd",{style:{background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:"4px",padding:"1px 5px",fontSize:"10.5px",color:"rgba(255,255,255,0.4)",fontFamily:"monospace"},children:"Esc"})," ","to dismiss"]})]}),ve.jsx("style",{children:`
|
|
66
|
+
@keyframes kbdFadeIn {
|
|
67
|
+
from { opacity: 0; transform: scale(0.96) translateY(8px); }
|
|
68
|
+
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
69
|
+
}
|
|
70
|
+
`})]}):null}function ym({x:u,y:e,isOpen:t,onClose:n,actions:r}){const i=At.useRef(null);return At.useEffect(()=>{if(!t)return;const o=l=>{if("key"in l){l.key==="Escape"&&n();return}i.current&&!i.current.contains(l.target)&&n()};return document.addEventListener("mousedown",o),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",o)}},[t,n]),t?ve.jsxs(ve.Fragment,{children:[ve.jsx("div",{ref:i,role:"menu","aria-label":"Video options",style:{position:"absolute",left:u,top:e,zIndex:99998,background:"rgba(12, 12, 20, 0.97)",backdropFilter:"blur(16px)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:"14px",boxShadow:"0 12px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.08)",minWidth:"240px",padding:"4px 0",fontFamily:"system-ui, -apple-system, sans-serif",animation:"ctxFadeIn 0.14s ease-out",overflow:"hidden"},children:r.map((o,l)=>ve.jsxs("div",{children:[ve.jsxs("button",{role:"menuitem",onClick:()=>{o.onClick(),n()},style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"9px 14px",background:"transparent",border:"none",color:o.danger?"#f87171":"#fff",fontSize:"13.5px",textAlign:"left",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:d=>{d.currentTarget.style.background=o.danger?"rgba(239,68,68,0.12)":"rgba(255,255,255,0.07)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[o.icon!==void 0&&ve.jsx("span",{style:{width:"28px",height:"28px",borderRadius:"7px",background:o.danger?"rgba(239,68,68,0.15)":"rgba(255,255,255,0.08)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:o.danger?"#f87171":"rgba(255,255,255,0.65)",fontSize:"13px",lineHeight:1},children:o.icon}),ve.jsx("span",{style:{flex:1},children:o.label})]}),o.dividerAfter&&ve.jsx("div",{style:{height:"1px",background:"rgba(255,255,255,0.07)",margin:"3px 0"}})]},l))}),ve.jsx("style",{children:`
|
|
71
|
+
@keyframes ctxFadeIn {
|
|
72
|
+
from { opacity: 0; transform: scale(0.96) translateY(-4px); }
|
|
73
|
+
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
74
|
+
}
|
|
75
|
+
`})]}):null}function Em({isVisible:u,onNextEpisode:e,onDismiss:t,countdownSec:n=5,nextTitle:r,thumbnail:i}){const[o,l]=At.useState(n),d=At.useRef(null),c=At.useCallback(()=>{d.current&&(clearInterval(d.current),d.current=null)},[]);if(At.useEffect(()=>{if(!u){c(),l(n);return}return l(n),d.current=setInterval(()=>{l(y=>y<=1?(c(),e(),0):y-1)},1e3),c},[u,n,e,c]),!u)return null;const g=16,f=2*Math.PI*g,h=(n-o)/n*f;return ve.jsxs("div",{style:{position:"absolute",inset:0,zIndex:9990,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.55)",backdropFilter:"blur(2px)",animation:"endCardIn 0.3s ease-out",fontFamily:"system-ui, -apple-system, sans-serif"},children:[ve.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"20px",maxWidth:"340px",textAlign:"center"},children:[ve.jsxs("button",{"aria-label":`Play next episode${r?`: ${r}`:""} in ${o} seconds`,onClick:e,style:{position:"relative",background:"transparent",border:"none",cursor:"pointer",padding:0,borderRadius:"12px",overflow:"hidden"},children:[i?ve.jsx("img",{src:i,alt:r||"Next episode",style:{width:"220px",height:"124px",objectFit:"cover",borderRadius:"12px",display:"block",border:"2px solid rgba(255,255,255,0.15)"}}):ve.jsx("div",{style:{width:"220px",height:"124px",borderRadius:"12px",background:"rgba(255,255,255,0.08)",border:"2px solid rgba(255,255,255,0.15)",display:"flex",alignItems:"center",justifyContent:"center"},children:ve.jsx("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"rgba(255,255,255,0.8)",children:ve.jsx("path",{d:"M8 5v14l11-7z"})})}),ve.jsxs("div",{style:{position:"absolute",top:"8px",right:"8px",width:"40px",height:"40px",background:"rgba(0,0,0,0.75)",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"},children:[ve.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",style:{position:"absolute",inset:0},children:[ve.jsx("circle",{cx:"20",cy:"20",r:g,fill:"none",stroke:"rgba(255,255,255,0.2)",strokeWidth:"3"}),ve.jsx("circle",{cx:"20",cy:"20",r:g,fill:"none",stroke:"#fff",strokeWidth:"3",strokeDasharray:f,strokeDashoffset:f-h,strokeLinecap:"round",transform:"rotate(-90 20 20)",style:{transition:"stroke-dashoffset 0.9s linear"}})]}),ve.jsx("span",{style:{color:"#fff",fontSize:"13px",fontWeight:700,position:"relative",zIndex:1},children:o})]})]}),ve.jsxs("div",{style:{color:"#fff"},children:[ve.jsx("div",{style:{fontSize:"12px",color:"rgba(255,255,255,0.55)",marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Up Next"}),r&&ve.jsx("div",{style:{fontSize:"15px",fontWeight:600,marginBottom:"6px"},children:r}),ve.jsxs("div",{style:{fontSize:"13px",color:"rgba(255,255,255,0.55)"},children:["Starting in ",o," second",o!==1?"s":"","β¦"]})]}),ve.jsxs("div",{style:{display:"flex",gap:"10px"},children:[ve.jsx("button",{onClick:e,style:{padding:"9px 20px",borderRadius:"8px",background:"#fff",color:"#000",border:"none",fontWeight:700,fontSize:"13px",cursor:"pointer"},children:"Play Now"}),ve.jsx("button",{onClick:t,style:{padding:"9px 20px",borderRadius:"8px",background:"rgba(255,255,255,0.12)",color:"#fff",border:"1px solid rgba(255,255,255,0.2)",fontWeight:600,fontSize:"13px",cursor:"pointer"},children:"Cancel"})]})]}),ve.jsx("style",{children:`
|
|
76
|
+
@keyframes endCardIn {
|
|
77
|
+
from { opacity: 0; }
|
|
78
|
+
to { opacity: 1; }
|
|
79
|
+
}
|
|
80
|
+
`})]})}function bm({type:u,value:e}){if(!u)return null;const t=u==="seek-forward"||u==="seek-backward",n=u==="seek-forward";return t?ve.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,zIndex:9985,pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:n?"flex-end":"flex-start"},children:ve.jsxs("div",{style:{width:"38%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6px",background:n?"radial-gradient(ellipse at right, rgba(255,255,255,0.18) 0%, transparent 70%)":"radial-gradient(ellipse at left, rgba(255,255,255,0.18) 0%, transparent 70%)",animation:"gestureHintFade 0.9s ease-out forwards"},children:[ve.jsx("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"rgba(255,255,255,0.9)",style:{transform:n?"none":"scaleX(-1)"},children:ve.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM12 6l6 6-6 6 1.41 1.41L20.83 12 13.41 4.59z"})}),ve.jsx("span",{style:{color:"#fff",fontWeight:700,fontSize:"16px",textShadow:"0 1px 4px rgba(0,0,0,0.6)"},children:e})]})}):ve.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,zIndex:9985,pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:"center"},children:ve.jsxs("div",{style:{background:"rgba(0,0,0,0.6)",backdropFilter:"blur(6px)",border:"1px solid rgba(255,255,255,0.15)",borderRadius:"12px",padding:"10px 18px",display:"flex",alignItems:"center",gap:"8px",animation:"gestureHintFade 0.9s ease-out forwards"},children:[ve.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"rgba(255,255,255,0.9)",children:ve.jsx("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.02z"})}),ve.jsx("span",{style:{color:"#fff",fontWeight:700,fontSize:"16px"},children:e})]})})}function Tm({player:u,skipSec:e=10}){const[t,n]=At.useState(null),r=At.useRef(null),i=At.useCallback(y=>{n(y),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n(null),900)},[]),o=At.useRef(null),l=300,d=At.useRef(null),c=150,g=At.useCallback(y=>{if(!u)return;const E=y.touches[0],_=Date.now(),L=o.current;if(L&&_-L.time<l){const ae=y.currentTarget.getBoundingClientRect();if(E.clientX-ae.left>ae.width/2){const xe=u.getVideoElement();xe&&u.seekTo(Math.min(xe.duration||0,xe.currentTime+e)),i({type:"seek-forward",value:`+${e}s`})}else{const xe=u.getVideoElement();xe&&u.seekTo(Math.max(0,xe.currentTime-e)),i({type:"seek-backward",value:`-${e}s`})}o.current=null;return}o.current={time:_,x:E.clientX};const K=u.getVideoElement();d.current={y:E.clientY,volume:K?.volume??1}},[u,e,i]),f=At.useCallback(y=>{if(!u||!d.current)return;const E=y.touches[0],L=(d.current.y-E.clientY)/c,K=Math.min(1,Math.max(0,d.current.volume+L));u.setVolume(K),i({type:"volume",value:`${Math.round(K*100)}%`})},[u,i]),h=At.useCallback(()=>{d.current=null},[]);return{onTouchStart:g,onTouchMove:f,onTouchEnd:h,gestureHint:t}}function s_(u,e){let t;return function(...n){t||(u.apply(this,n),t=!0,setTimeout(()=>t=!1,e))}}function o_({timeout:u=3e3,initialVisible:e=!0}={}){const[t,n]=At.useState(e),r=At.useRef(null),i=At.useCallback(()=>{r.current&&clearTimeout(r.current),n(!0),r.current=window.setTimeout(()=>{n(!1)},u)},[u]);return At.useEffect(()=>{const o=s_(()=>{i()},100),l=()=>{n(!0),r.current&&clearTimeout(r.current)};return window.addEventListener("mousemove",o,{passive:!0}),window.addEventListener("mouseenter",l,{passive:!0}),i(),()=>{window.removeEventListener("mousemove",o),window.removeEventListener("mouseenter",l),r.current&&clearTimeout(r.current)}},[i]),{isActive:t,setIsActive:n}}function l_({player:u,seekStep:e=10,enabled:t=!0,onShowShortcuts:n}){At.useEffect(()=>{if(!u||!t)return;const r=i=>{const o=i.target;if(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable)return;const l=u.getVideoElement();if(l)switch(i.code){case"Space":i.preventDefault(),l.paused?u.play():u.pause();break;case"ArrowLeft":i.preventDefault();const d=Math.max(0,l.currentTime-e);u.seekTo(d);break;case"ArrowRight":i.preventDefault();const c=Math.min(l.duration,l.currentTime+e);u.seekTo(c);break;case"ArrowUp":i.preventDefault();const g=l.volume;u.setVolume(Math.min(1,g+.1));break;case"ArrowDown":i.preventDefault();const f=l.volume;u.setVolume(Math.max(0,f-.1));break;case"KeyM":i.preventDefault(),u.toggleMute();break;case"KeyF":i.preventDefault(),u.toggleFullscreen();break;case"Slash":i.shiftKey&&(i.preventDefault(),n?.());break}};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[u,e,t,n])}class u_{timeout;maxWrapperDepth;constructor(e=5e3,t=5){this.timeout=e,this.maxWrapperDepth=t}async parse(e,t=0,n=0){if(t>this.maxWrapperDepth)throw new Error(`VAST wrapper depth exceeded (max: ${this.maxWrapperDepth})`);try{const i=await this.fetchVAST(e),o=this.parseXML(i),l=o.querySelector("Wrapper");if(l){const d=l.querySelector("VASTAdTagURI")?.textContent?.trim();if(!d)throw new Error("Wrapper missing VASTAdTagURI");return this.parse(d,t+1,n)}return this.parseInline(o)}catch(i){if(i instanceof Error&&i.message.includes("No ads available")&&n<2)return console.warn(`[VASTParser] β οΈ No ads on attempt ${n+1}/3, retrying in 1500ms...`),await new Promise(l=>setTimeout(l,1500)),this.parse(e,t,n+1);throw i}}async fetchVAST(e){const t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{const r=await fetch(e,{signal:t.signal,headers:{Accept:"application/xml, text/xml, */*"}});if(clearTimeout(n),!r.ok)throw new Error(`VAST fetch failed: ${r.status} ${r.statusText}`);const i=await r.text();if(!i||i.trim().length===0)throw new Error("VAST response is empty");return i}catch(r){throw clearTimeout(n),r instanceof Error&&r.name==="AbortError"?new Error("VAST request timeout"):r}}parseXML(e){const n=new DOMParser().parseFromString(e,"text/xml"),r=n.querySelector("parsererror");if(r){const l=r.textContent||"Unknown parse error";throw console.error("[VASTParser] XML parse error:",l),console.error("[VASTParser] XML content (first 500 chars):",e.substring(0,500)),new Error(`VAST XML parse error: ${l}`)}if(!n.querySelector("VAST"))throw console.error("[VASTParser] No VAST element found in XML"),console.error("[VASTParser] XML content:",e.substring(0,500)),new Error("Invalid VAST XML: No VAST element found");if(n.querySelectorAll("Ad").length===0)throw console.warn("[VASTParser] No Ad elements found in VAST response (empty ad pod)"),console.log("[VASTParser] Full XML:",e),new Error("No ads available in VAST response");return n}async parseAdPod(e){const t=await this.fetchVAST(e),n=this.parseXML(t),r=Array.from(n.querySelectorAll("Ad"));if(r.length===0)throw new Error("No ads available in VAST response");const i=[];for(const o of r)try{const l=o.querySelector("Wrapper");if(l){const d=l.querySelector("VASTAdTagURI")?.textContent?.trim();if(d){const c=await this.parse(d,1);i.push(c)}}else{const d=this.parseAdElement(o,n);d&&i.push(d)}}catch(l){console.warn("[VASTParser] Failed to parse Ad in pod, skipping:",l)}if(i.length===0)throw new Error("No ads available in VAST response");return i.sort((o,l)=>(o.podSequence??0)-(l.podSequence??0)),i}parseInline(e){const t=e.querySelector("Ad");if(!t)throw new Error("VAST Ad element not found");const n=this.parseAdElement(t,e);if(!n)throw new Error("VAST Ad element is empty (no ads available)");return n}parseAdElement(e,t){const n=e.getAttribute("sequence"),r=n!==null?parseInt(n,10):void 0,i=e.querySelector("InLine")??e.querySelector("Inline")??e.querySelector("inline")??t.querySelector("InLine")??t.querySelector("Inline");if(!i){const K=Array.from(e.children).map(Z=>Z.tagName);throw K.length===0?new Error("VAST Ad element is empty (no ads available)"):new Error(`VAST InLine not found. Found: ${K.join(", ")}`)}const o=e.getAttribute("id")||`ad-${Date.now()}`,l=i.querySelector("AdTitle")?.textContent?.trim(),d=i.querySelector("Duration")?.textContent?.trim(),c=this.parseDuration(d||"00:00:00"),{mediaFile:g,isVpaid:f,vpaidUrl:h}=this.getMediaFileInfo(i);if(!g)throw new Error("VAST MediaFile not found");const y=i.querySelector("ClickThrough")?.textContent?.trim(),E=this.parseTrackingEvents(i,t),_=this.getErrorUrls(t),L=this.parseCompanions(i);return{id:o,title:l,duration:c,mediaFile:g,clickThrough:y,trackingEvents:E,errorUrls:_,companions:L.length>0?L:void 0,isVpaid:f,vpaidUrl:h,podSequence:r}}parseCompanions(e){const t=[];return e.querySelectorAll("CompanionAds > Companion").forEach(r=>{const i=parseInt(r.getAttribute("width")||"0",10),o=parseInt(r.getAttribute("height")||"0",10),l=r.getAttribute("id")??void 0,d=r.querySelector("StaticResource"),c=r.querySelector("HTMLResource"),g=r.querySelector("IFrameResource"),f=d?.textContent?.trim()??void 0,h=c?.textContent?.trim()??void 0,y=g?.textContent?.trim()??void 0,E=d?.getAttribute("creativeType")??void 0,_=r.querySelector("CompanionClickThrough")?.textContent?.trim()??void 0,L=r.querySelector("AltText")?.textContent?.trim()??void 0,K=[];r.querySelectorAll('TrackingEvents > Tracking[event="creativeView"]').forEach(Z=>{const ae=Z.textContent?.trim();ae&&K.push(ae)}),(f||h||y)&&t.push({id:l,width:i,height:o,staticResource:f,htmlResource:h,iFrameResource:y,type:E,clickThrough:_,altText:L,viewTrackingUrls:K.length>0?K:void 0})}),t}parseDuration(e){const t=e.split(":").map(Number);if(t.length===3){const[n,r,i]=t;return n*3600+r*60+i}return 0}getMediaFileInfo(e){const t=Array.from(e.querySelectorAll("MediaFile"));if(t.length===0)return{mediaFile:null,isVpaid:!1,vpaidUrl:void 0};const n=t.find(o=>o.getAttribute("apiFramework")?.toUpperCase()==="VPAID"&&(o.getAttribute("type")?.includes("javascript")||o.getAttribute("type")?.includes("application/javascript")));if(n){const o=n.textContent?.trim()||void 0;return console.log("[VASTParser] VPAID 2.0 creative detected:",o),{mediaFile:o??null,isVpaid:!0,vpaidUrl:o}}const r=t.filter(o=>o.getAttribute("delivery")==="progressive"&&o.getAttribute("type")?.includes("mp4"));return{mediaFile:(r.length>0?r[0]:t[0]).textContent?.trim()||null,isVpaid:!1,vpaidUrl:void 0}}parseTrackingEvents(e,t){const n={},r=t.querySelectorAll("Impression");r.length>0&&(n.impression=Array.from(r).map(o=>o.textContent?.trim()).filter(Boolean));const i=["start","firstQuartile","midpoint","thirdQuartile","complete","skip","pause","resume"];return e.querySelectorAll("Tracking").forEach(o=>{const l=o.getAttribute("event"),d=o.textContent?.trim();!l||!d||!i.includes(l)||(n[l]||(n[l]=[]),n[l].push(d))}),n}getErrorUrls(e){const t=[];return e.querySelectorAll("Error").forEach(n=>{const r=n.textContent?.trim();r&&t.push(r)}),t}}class c_{timeout;constructor(e=5e3){this.timeout=e}async parse(e){const t=await this.fetchVMAP(e),n=this.parseXML(t),r="http://www.iab.net/videosuite/vmap";let i=n.querySelector("vmap\\:VMAP, VMAP");if(!i){const d=n.getElementsByTagNameNS(r,"VMAP");if(d.length>0)i=d[0];else{const c=n.getElementsByTagName("VMAP");c.length>0&&(i=c[0])}}if(!i)throw console.error("[VMAPParser] VMAP element not found. XML:",t.substring(0,500)),new Error("VMAP element not found");const o=i.getAttribute("version")||"1.0",l=this.parseAdBreaks(n);return l.length===0?(console.warn("[VMAPParser] β οΈ No ad breaks found in VMAP"),console.warn("[VMAPParser] This might mean:"),console.warn("[VMAPParser] 1. The VMAP URL returned an empty response (common with test URLs)"),console.warn("[VMAPParser] 2. The VMAP structure is different than expected"),console.warn("[VMAPParser] 3. There are no ads available at this time"),console.warn("[VMAPParser] VMAP XML (first 1000 chars):",t.substring(0,1e3)),t.includes("AdBreak")||t.includes("adBreak")||t.includes("AdSource")||(console.error("[VMAPParser] β VMAP appears to be completely empty - no AdBreak elements found"),console.error("[VMAPParser] This is likely a test URL issue. Try using a local VMAP file or a different test URL."))):console.log(`[VMAPParser] β
Successfully parsed ${l.length} ad break(s)`),{version:o,adBreaks:l}}async fetchVMAP(e){const t=new AbortController,n=setTimeout(()=>t.abort(),this.timeout);try{console.log("[VMAPParser] Fetching VMAP from:",e);const r=await fetch(e,{signal:t.signal,headers:{Accept:"application/xml, text/xml, */*"}});if(clearTimeout(n),!r.ok)throw console.error("[VMAPParser] VMAP fetch failed:",{status:r.status,statusText:r.statusText,url:e}),new Error(`VMAP fetch failed: ${r.status} ${r.statusText}`);const i=await r.text();if(!i||i.trim().length===0)throw console.error("[VMAPParser] VMAP response is empty"),new Error("VMAP response is empty");return console.log("[VMAPParser] VMAP fetched successfully, length:",i.length),i}catch(r){throw clearTimeout(n),r instanceof Error&&r.name==="AbortError"?(console.error("[VMAPParser] VMAP request timeout after",this.timeout,"ms"),new Error(`VMAP request timeout (${this.timeout}ms)`)):r instanceof TypeError?(console.error("[VMAPParser] Network error fetching VMAP:",r.message),new Error(`VMAP network error: ${r.message}`)):r}}parseXML(e){const n=new DOMParser().parseFromString(e,"text/xml"),r=n.querySelector("parsererror");if(r){const i=r.textContent||"Unknown parse error";throw console.error("[VMAPParser] XML parse error:",i),console.error("[VMAPParser] XML content (first 500 chars):",e.substring(0,500)),new Error(`VMAP XML parse error: ${i}`)}return n}parseAdBreaks(e){const t=[],n="http://www.iab.net/videosuite/vmap";let r=e.querySelectorAll("vmap\\:AdBreak, AdBreak");if(r.length===0&&e.documentElement){const o=e.getElementsByTagNameNS(n,"AdBreak");if(o.length>0)r=o;else{const l=e.getElementsByTagName("AdBreak");l.length>0&&(r=l)}}return Array.from(r).forEach(i=>{const o=this.parseAdBreak(i);o&&t.push(o)}),t}parseAdBreak(e){const t=e.getAttribute("timeOffset");if(!t)return console.warn("[VMAPParser] AdBreak missing timeOffset, skipping"),null;const n=this.parseTimeOffset(t),r="http://www.iab.net/videosuite/vmap";let i=e.querySelector("vmap\\:AdSource, AdSource");if(!i){const c=e.getElementsByTagNameNS(r,"AdSource");if(c.length>0)i=c[0];else{const g=e.getElementsByTagName("AdSource");g.length>0&&(i=g[0])}}if(!i)return console.warn("[VMAPParser] AdBreak missing AdSource, skipping"),null;let o=i.querySelector("vmap\\:AdTagURI, AdTagURI");if(!o){const c=i.getElementsByTagNameNS(r,"AdTagURI");if(c.length>0)o=c[0];else{const g=i.getElementsByTagName("AdTagURI");g.length>0&&(o=g[0])}}if(!o)return console.warn("[VMAPParser] AdSource missing AdTagURI, skipping"),console.warn("[VMAPParser] AdSource children:",Array.from(i.children).map(c=>c.tagName)),null;let l=o.textContent?.trim()||o.innerHTML?.trim();if(!l)return console.warn("[VMAPParser] AdTagURI is empty, skipping"),null;l=l.replace(/<!\\[CDATA\\[(.*?)\\]\\]>/g,"$1").trim();const d=document.createElement("textarea");return d.innerHTML=l,l=d.value,console.log("[VMAPParser] AdBreak parsed:",{timeOffset:n,timeOffsetStr:t,vastUrl:l.substring(0,100)+(l.length>100?"...":"")}),{timeOffset:n,vastUrl:l}}parseTimeOffset(e){const t=e.trim().toLowerCase();if(t==="start")return 0;if(t==="end")return-1;const n=t.split(":").map(Number);if(n.length===1)return n[0];if(n.length===2){const[r,i]=n;return r*60+i}else if(n.length===3){const[r,i,o]=n;return r*3600+i*60+o}return console.warn(`[VMAPParser] Invalid timeOffset format: ${e}, defaulting to 0`),0}}class d_{trackingEnabled;constructor(e=!0){this.trackingEnabled=e}trackImpression(e){!this.trackingEnabled||!e.trackingEvents.impression||e.trackingEvents.impression.forEach(t=>{this.fireTrackingPixel(t)})}trackStart(e){!this.trackingEnabled||!e.trackingEvents.start||e.trackingEvents.start.forEach(t=>{this.fireTrackingPixel(t)})}trackComplete(e){!this.trackingEnabled||!e.trackingEvents.complete||e.trackingEvents.complete.forEach(t=>{this.fireTrackingPixel(t)})}trackSkip(e){!this.trackingEnabled||!e.trackingEvents.skip||e.trackingEvents.skip.forEach(t=>{this.fireTrackingPixel(t)})}trackError(e,t){!this.trackingEnabled||!e.errorUrls||e.errorUrls.forEach(n=>{const r=n.replace("[ERRORCODE]",t);this.fireTrackingPixel(r)})}fireTrackingPixel(e){if(e)try{const t=new Image;t.src=e}catch(t){console.warn("[AdTracker] Failed to fire tracking pixel:",e,t)}}reset(){}}class f_{player;config;tracker;hideLoadingCallback;adVideo=null;adContainer=null;companionContainer=null;mainVideoElement=null;skipButton=null;countdownElement=null;vpaidIframe=null;vpaidCreative=null;state={isPlaying:!1,ad:null,position:null,currentTime:0,canSkip:!1,remainingTime:0};constructor(e,t,n){this.player=e,this.config=t,this.tracker=new d_(!0),this.hideLoadingCallback=n}async play(e,t){if(console.log(`[AdPlayer] Playing ${t} ad:`,e.title||e.id),this.mainVideoElement=this.player.getVideoElement(),!this.mainVideoElement&&this.player.videoElement&&(this.mainVideoElement=this.player.videoElement),!this.mainVideoElement)throw new Error("Main video element not found. Player may not be initialized.");this.player.getState()?.isPlaying&&this.player.pause(),this.state={isPlaying:!0,ad:e,position:t,currentTime:0,canSkip:!1,remainingTime:e.duration},this.tracker.reset();try{this.createAdUI(),e.companions?.length&&this.showCompanionBanners(e.companions),this.tracker.trackImpression(e),e.isVpaid&&e.vpaidUrl?await this.playVpaidCreative(e):await this.playAdVideo(e),this.tracker.trackComplete(e),console.log("[AdPlayer] Ad completed")}catch(r){throw console.error("[AdPlayer] Ad playback error:",r),this.tracker.trackError(e,"400"),r}finally{this.destroyAdUI(),this.state.isPlaying=!1,this.state.ad=null,t!=="postroll"&&setTimeout(()=>{try{this.player&&typeof this.player.play=="function"&&this.player.play().catch(r=>{console.warn("[AdPlayer] Failed to resume main video:",r.message)})}catch(r){console.warn("[AdPlayer] Error resuming main video:",r)}},100)}}async playAdPod(e,t){console.log(`[AdPlayer] Playing ad pod: ${e.length} ads at ${t}`);for(const n of e)try{await this.play(n,t)}catch(r){console.warn("[AdPlayer] Ad pod: ad failed, continuing with next:",r)}console.log("[AdPlayer] Ad pod complete")}showCompanionBanners(e){if(!this.mainVideoElement)return;const n=document.getElementById("virtus-companion-slot")??this.mainVideoElement.parentElement;if(n){this.companionContainer=document.createElement("div"),this.companionContainer.className="virtus-companion-container",this.companionContainer.style.cssText=`
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 0;
|
|
83
|
+
right: -320px;
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
gap: 8px;
|
|
87
|
+
z-index: 999;
|
|
88
|
+
`;for(const r of e){const i=this.buildCompanionElement(r);i&&this.companionContainer.appendChild(i)}this.companionContainer.children.length>0&&(n.appendChild(this.companionContainer),e.forEach(r=>{r.viewTrackingUrls?.forEach(i=>{fetch(i,{mode:"no-cors"}).catch(()=>{})})}))}}buildCompanionElement(e){const t=document.createElement("div");if(t.style.cssText=`width:${e.width}px;height:${e.height}px;overflow:hidden;`,e.htmlResource){const n=document.createElement("div");n.innerHTML=e.htmlResource,t.appendChild(n)}else if(e.iFrameResource){const n=document.createElement("iframe");n.src=e.iFrameResource,n.width=String(e.width),n.height=String(e.height),n.style.border="none",t.appendChild(n)}else if(e.staticResource){const n=document.createElement("img");if(n.src=e.staticResource,n.alt=e.altText??"Advertisement",n.width=e.width,n.height=e.height,n.style.display="block",e.clickThrough){const r=document.createElement("a");r.href=e.clickThrough,r.target="_blank",r.rel="noopener noreferrer",r.appendChild(n),t.appendChild(r)}else t.appendChild(n)}else return null;return t}async playVpaidCreative(e){return new Promise((t,n)=>{if(!e.vpaidUrl||!this.adContainer){n(new Error("VPAID URL or container missing"));return}const r=this.adContainer,i=r.clientWidth||640,o=r.clientHeight||360;this.vpaidIframe=document.createElement("iframe"),this.vpaidIframe.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:1002;",this.vpaidIframe.allow="autoplay",r.appendChild(this.vpaidIframe);const l=this.vpaidIframe.contentDocument;if(!l){n(new Error("Could not access VPAID iframe document"));return}l.open(),l.write(`<!DOCTYPE html><html><body style="margin:0;overflow:hidden;">
|
|
89
|
+
<script src="${e.vpaidUrl}"><\/script>
|
|
90
|
+
<script>
|
|
91
|
+
window.getVPAIDAd = function() { return typeof window.VPAIDCreative !== 'undefined' ? new window.VPAIDCreative() : null; };
|
|
92
|
+
<\/script>
|
|
93
|
+
</body></html>`),l.close(),this.vpaidIframe.onload=()=>{const c=this.vpaidIframe?.contentWindow?.getVPAIDAd?.()??null;if(!c){console.warn("[AdPlayer] VPAID creative not found in iframe, skipping"),this.hideLoadingCallback&&this.hideLoadingCallback(),t();return}this.vpaidCreative=c,c.handshakeVersion("2.0"),c.subscribe(t,"AdStopped"),c.subscribe(t,"AdVideoComplete"),c.subscribe(t,"AdSkipped"),c.subscribe(()=>{this.hideLoadingCallback&&this.hideLoadingCallback(),this.tracker.trackStart(e)},"AdStarted"),c.subscribe(()=>{n(new Error("VPAID AdError"))},"AdError"),c.initAd(i,o,"normal",-1,{AdParameters:""},{slot:r,videoSlot:this.adVideo,videoSlotCanAutoPlay:!0}),c.startAd()}})}createAdUI(){if(!this.mainVideoElement)return;const e=this.mainVideoElement.parentElement;if(!e)return;const t={showLabel:!0,showCountdown:!0,showSkipButton:!0,labelText:"Advertisement",labelPosition:"top-left",countdownPosition:"top-right",...this.config.ui};if(this.adContainer=document.createElement("div"),this.adContainer.className="virtus-ad-container",this.adContainer.style.cssText=`
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 0;
|
|
96
|
+
left: 0;
|
|
97
|
+
right: 0;
|
|
98
|
+
bottom: 0;
|
|
99
|
+
background: #000;
|
|
100
|
+
z-index: 1000;
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
`,this.adVideo=document.createElement("video"),this.adVideo.className="virtus-ad-video",this.adVideo.style.cssText="width: 100%; height: 100%; object-fit: contain;",this.adVideo.playsInline=!0,this.adContainer.addEventListener("click",()=>this.handleClick()),this.adContainer.appendChild(this.adVideo),t.showLabel){const n=document.createElement("div");n.className="virtus-ad-label",n.textContent=t.labelText,n.style.cssText=`
|
|
106
|
+
position: absolute;
|
|
107
|
+
top: 16px;
|
|
108
|
+
${t.labelPosition==="top-right"?"right":"left"}: 16px;
|
|
109
|
+
background: rgba(0, 0, 0, 0.7);
|
|
110
|
+
color: #fff;
|
|
111
|
+
padding: 6px 12px;
|
|
112
|
+
border-radius: 4px;
|
|
113
|
+
font-size: 12px;
|
|
114
|
+
font-weight: 600;
|
|
115
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
z-index: 1001;
|
|
118
|
+
`,this.adContainer.appendChild(n)}t.showCountdown&&(this.countdownElement=document.createElement("div"),this.countdownElement.className="virtus-ad-countdown",this.countdownElement.style.cssText=`
|
|
119
|
+
position: absolute;
|
|
120
|
+
top: 16px;
|
|
121
|
+
${t.countdownPosition==="top-right"?"right":"left"}: 16px;
|
|
122
|
+
background: rgba(0, 0, 0, 0.7);
|
|
123
|
+
color: #fff;
|
|
124
|
+
padding: 6px 12px;
|
|
125
|
+
border-radius: 4px;
|
|
126
|
+
font-size: 13px;
|
|
127
|
+
font-weight: 500;
|
|
128
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
z-index: 1001;
|
|
131
|
+
`,this.adContainer.appendChild(this.countdownElement)),t.showSkipButton&&(this.skipButton=document.createElement("button"),this.skipButton.className="virtus-ad-skip-button",this.skipButton.textContent="Skip Ad β",this.skipButton.style.cssText=`
|
|
132
|
+
position: absolute;
|
|
133
|
+
bottom: 80px;
|
|
134
|
+
right: 16px;
|
|
135
|
+
background: rgba(0, 0, 0, 0.8);
|
|
136
|
+
color: #fff;
|
|
137
|
+
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
138
|
+
padding: 10px 20px;
|
|
139
|
+
border-radius: 4px;
|
|
140
|
+
font-size: 14px;
|
|
141
|
+
font-weight: 600;
|
|
142
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
z-index: 1001;
|
|
145
|
+
display: none;
|
|
146
|
+
`,this.skipButton.addEventListener("click",n=>{n.stopPropagation(),this.skip()}),this.adContainer.appendChild(this.skipButton)),e.appendChild(this.adContainer)}async playAdVideo(e){return new Promise((t,n)=>{if(!this.adVideo){n(new Error("Ad video element not found"));return}const r=this.adVideo;let i=!1;const o=()=>{r.play().catch(E=>{i||(y(),n(E))})},l=()=>this.tracker.trackStart(e),d=()=>{console.log("[AdPlayer] Ad video playing, hiding loading..."),this.hideLoadingCallback&&this.hideLoadingCallback()},c=()=>this.updateUI(e),g=()=>{i||(y(),t())};let f=!1;const h=()=>{if(f)return;if(f=!0,i){t();return}const E=r.error?.code;if(E===4){y(),t();return}y(),n(new Error(`Ad video playback error: ${r.error?.message??"Unknown"} (code: ${E})`))},y=()=>{if(!i){i=!0;try{r.removeEventListener("canplay",o),r.removeEventListener("play",l),r.removeEventListener("playing",d),r.removeEventListener("timeupdate",c),r.removeEventListener("ended",g),r.removeEventListener("error",h),r.pause(),r.parentNode&&r.parentNode.removeChild(r)}catch{}}};r.addEventListener("canplay",o),r.addEventListener("play",l),r.addEventListener("playing",d),r.addEventListener("timeupdate",c),r.addEventListener("ended",g),r.addEventListener("error",h),r.src=e.mediaFile,r.load(),setTimeout(()=>{this.state.isPlaying&&this.state.currentTime===0&&!i&&(y(),n(new Error("Ad video timeout")))},this.config.timeout||1e4)})}updateUI(e){if(!this.adVideo||!this.state.ad)return;const t=this.adVideo.currentTime;this.state.currentTime=t,this.state.remainingTime=e.duration-t,this.countdownElement&&(this.countdownElement.textContent=`Ad: ${Math.ceil(this.state.remainingTime)}s`);const n=this.config.skipAfter??5;t>=n&&(this.state.canSkip=!0,this.skipButton&&(this.skipButton.style.display="block"))}skip(){if(!(!this.state.canSkip||!this.state.ad)){if(console.log("[AdPlayer] Ad skipped"),this.tracker.trackSkip(this.state.ad),this.vpaidCreative){try{this.vpaidCreative.skipAd()}catch{}return}this.adVideo&&(this.adVideo.pause(),this.adVideo.currentTime=this.adVideo.duration,this.adVideo.dispatchEvent(new Event("ended")))}}handleClick(){this.state.ad&&(console.log("[AdPlayer] Ad clicked"),this.state.ad.clickThrough&&window.open(this.state.ad.clickThrough,"_blank","noopener,noreferrer"))}destroyAdUI(){if(console.log("[AdPlayer] Destroying ad UI..."),this.vpaidCreative){try{this.vpaidCreative.stopAd()}catch{}this.vpaidCreative=null}if(this.vpaidIframe&&(this.vpaidIframe.remove(),this.vpaidIframe=null),this.adVideo){try{const e=this.adVideo;e.pause(),e.muted=!0,e.parentNode&&e.parentNode.removeChild(e),e.removeAttribute("src"),e.src=""}catch{}this.adVideo=null}if(this.adContainer){try{this.adContainer.remove()}catch{}this.adContainer=null}if(this.companionContainer){try{this.companionContainer.remove()}catch{}this.companionContainer=null}this.skipButton=null,this.countdownElement=null,console.log("[AdPlayer] Ad UI destroyed")}getState(){return{...this.state}}destroy(){this.destroyAdUI(),this.state={isPlaying:!1,ad:null,position:null,currentTime:0,canSkip:!1,remainingTime:0}}}class h_{player;config;vastParser;vmapParser;adPlayer;preRollPlayed=!1;midRollsPlayed=new Set;postRollPlayed=!1;vmapData=null;videoDuration=0;loadingContainer=null;onLoadingChange;constructor(e,t,n){this.player=e,this.config=t,this.onLoadingChange=n,this.vastParser=new u_(t.timeout||5e3,t.maxWrapperDepth||5),this.vmapParser=new c_(t.timeout||5e3),this.adPlayer=new f_(e,t,()=>this.hideAdLoading()),console.log("[AdManager] Initialized with config:",t)}async waitForVideoElement(e=10,t=100){for(let n=0;n<e;n++){const r=this.player.getVideoElement();if(r)return console.log(`[AdManager] Video element ready after ${n} retries`),r;console.log(`[AdManager] Waiting for video element (attempt ${n+1}/${e})...`),await new Promise(i=>setTimeout(i,t))}return null}async setup(){if(!this.config.enabled){console.log("[AdManager] Ads disabled");return}if(!this.config.vastUrl&&!this.config.vmapUrl){console.log("[AdManager] No VAST URL or VMAP URL provided");return}const e=await this.waitForVideoElement();if(!e){console.error("[AdManager] Video element not available after retries. Cannot setup ads.");return}if(console.log("[AdManager] Video element ready:",e),this.config.vmapUrl)try{if(console.log("[AdManager] Loading VMAP from:",this.config.vmapUrl),this.vmapData=await this.vmapParser.parse(this.config.vmapUrl),console.log("[AdManager] VMAP parsed successfully:",{adBreakCount:this.vmapData.adBreaks.length,version:this.vmapData.version}),this.vmapData.adBreaks.length===0)if(console.warn("[AdManager] β οΈ VMAP parsed but contains no ad breaks"),this.config.vastUrl)console.log("[AdManager] Falling back to VAST URL"),this.vmapData=null;else{console.log("[AdManager] No VAST URL fallback available, ads will be skipped");return}}catch(n){if(n instanceof Error?n.message.includes("timeout")?console.error("[AdManager] β οΈ VMAP request timeout:",n.message):n.message.includes("network")?console.error("[AdManager] β οΈ VMAP network error:",n.message):n.message.includes("empty")?console.error("[AdManager] β οΈ VMAP response is empty:",n.message):n.message.includes("parse")?console.error("[AdManager] β οΈ VMAP XML parse error:",n.message):console.error("[AdManager] β οΈ VMAP error:",n.message):console.error("[AdManager] β οΈ VMAP parse error:",n),this.config.vastUrl)console.log("[AdManager] Falling back to VAST URL");else{console.log("[AdManager] No VAST URL fallback available, ads will be skipped");return}}console.log("[AdManager] Setting up ad schedule"),this.player.events.on("loadedmetadata",n=>{this.videoDuration=n.duration||0}),this.player.events.once("play",async()=>{console.log("[AdManager] Play event received, pausing video for pre-roll..."),this.player.pause(),await this.handlePreRoll(),console.log("[AdManager] Pre-roll completed, resuming main video..."),setTimeout(()=>{const n=this.player.getVideoElement();console.log("[AdManager] Resuming main video, element:",n?.src),this.player.play().then(()=>{console.log("[AdManager] β
Main video resumed successfully")}).catch(r=>{console.error("[AdManager] β Failed to auto-resume after pre-roll:",r),setTimeout(()=>{console.log("[AdManager] Retrying main video play..."),this.player.play().catch(i=>{console.error("[AdManager] Retry failed:",i)})},500)})},300)});const t=this.player.getState();console.log("[AdManager] Current video state after setup:",{isPlaying:t?.isPlaying,currentTime:t?.currentTime,preRollPlayed:this.preRollPlayed,hasPreRollUrl:!!this.getPreRollVastUrl()}),t?.isPlaying&&!this.preRollPlayed?(console.log("[AdManager] β
Video is already playing, triggering pre-roll immediately"),this.player.pause(),setTimeout(()=>{this.handlePreRoll()},100)):t?.isPlaying?this.preRollPlayed&&console.log("[AdManager] β οΈ Pre-roll already played, skipping"):console.log("[AdManager] β
Video not playing yet, will wait for play event"),this.player.events.on("timeupdate",n=>{this.handleMidRoll(n.currentTime)}),this.player.events.on("ended",()=>{this.handlePostRoll()})}async handlePreRoll(){if(console.log("[AdManager] π¬ handlePreRoll called",{preRollPlayed:this.preRollPlayed,hasVastUrl:!!this.getPreRollVastUrl()}),this.preRollPlayed){console.log("[AdManager] βοΈ Pre-roll already played, skipping");return}const e=this.getPreRollVastUrl();if(!e){console.log("[AdManager] β οΈ No VAST URL available for pre-roll");return}if(console.log("[AdManager] πΊ Pre-roll VAST URL:",e),this.preRollPlayed=!0,!this.player.getVideoElement()){console.error("[AdManager] β Video element not available during pre-roll. Skipping ad.");return}console.log("[AdManager] β
Video element available, loading pre-roll ad..."),await this.playAd(e,"preroll")}async handleMidRoll(e){if(!this.vmapData)return;const t=this.vmapData.adBreaks.filter(r=>r.timeOffset>0&&r.timeOffset<this.videoDuration&&!this.midRollsPlayed.has(r.timeOffset)&&Math.abs(e-r.timeOffset)<1);if(t.length===0)return;const n=t[0];this.midRollsPlayed.add(n.timeOffset),console.log(`[AdManager] Loading mid-roll ad at ${n.timeOffset}s`),await this.playAd(n.vastUrl,"midroll")}async handlePostRoll(){if(this.postRollPlayed)return;const e=this.getPostRollVastUrl();e&&(this.postRollPlayed=!0,console.log("[AdManager] Loading post-roll ad"),await this.playAd(e,"postroll"))}getPreRollVastUrl(){if(this.vmapData){const e=this.vmapData.adBreaks.find(t=>t.timeOffset===0);if(e)return this.addCorrelator(e.vastUrl)}return this.addCorrelator(this.config.vastUrl||null)}addCorrelator(e){if(!e)return null;const t=Date.now();if(e.includes("correlator=")){const n=e.replace(/correlator=[^&]*/,`correlator=${t}`);return console.log("[AdManager] Updated correlator in URL:",t),n}else{const n=e.includes("?")?"&":"?",r=`${e}${n}correlator=${t}`;return console.log("[AdManager] Added correlator to URL:",t),r}}getPostRollVastUrl(){if(!this.vmapData)return null;const e=this.vmapData.adBreaks.find(t=>t.timeOffset===-1);return e?e.vastUrl:null}async playAd(e,t,n=0){console.log(`[AdManager] Playing ad at ${t} (attempt ${n+1}/3), URL:`,e),n===0&&(console.log("[AdManager] π Showing ad loading..."),this.showAdLoading());try{const o=await this.vastParser.parse(e);console.log("[AdManager] VAST parsed successfully:",o),await this.adPlayer.play(o,t)}catch(o){if(o instanceof Error){if(o.message.includes("No ads available")||o.message.includes("empty")||o.message.includes("Ad element is empty")){if(n<2)return console.warn(`[AdManager] β οΈ No ads on attempt ${n+1}/3, retrying in 1500ms...`),await new Promise(l=>setTimeout(l,1500)),this.playAd(e,t,n+1);this.hideAdLoading(),console.log("[AdManager] βΉοΈ No ads available after 3 attempts, continuing with main video");return}if(o.message.includes("Ad video playback error")||o.message.includes("timeout")){this.hideAdLoading(),console.warn(`[AdManager] β οΈ Ad playback failed for ${t}:`,o.message),console.log("[AdManager] Skipping ad and continuing with main video");return}this.hideAdLoading(),console.warn(`[AdManager] β οΈ Failed to play ${t} ad:`,o.message)}else this.hideAdLoading(),console.warn(`[AdManager] β οΈ Failed to play ${t} ad:`,o);console.log("[AdManager] Continuing with main video despite ad error")}}skipAd(){this.adPlayer.skip()}handleAdClick(){this.adPlayer.handleClick()}getAdState(){return this.adPlayer.getState()}showAdLoading(){if(this.onLoadingChange){this.onLoadingChange(!0),console.log("[AdManager] External loading callback triggered (true)");return}const e=this.player.getVideoElement();if(!e)return;const t=e.parentElement;if(t){if(this.loadingContainer=document.createElement("div"),this.loadingContainer.className="virtus-ad-loading-container",this.loadingContainer.innerHTML=`
|
|
147
|
+
<div style="
|
|
148
|
+
position: absolute;
|
|
149
|
+
top: 0;
|
|
150
|
+
left: 0;
|
|
151
|
+
right: 0;
|
|
152
|
+
bottom: 0;
|
|
153
|
+
background: #000;
|
|
154
|
+
z-index: 999;
|
|
155
|
+
display: flex;
|
|
156
|
+
flex-direction: column;
|
|
157
|
+
align-items: center;
|
|
158
|
+
justify-content: center;
|
|
159
|
+
">
|
|
160
|
+
<div style="
|
|
161
|
+
width: 50px;
|
|
162
|
+
height: 50px;
|
|
163
|
+
border: 4px solid rgba(255, 255, 255, 0.3);
|
|
164
|
+
border-top: 4px solid #fff;
|
|
165
|
+
border-radius: 50%;
|
|
166
|
+
animation: virtus-spin 1s linear infinite;
|
|
167
|
+
"></div>
|
|
168
|
+
<div style="
|
|
169
|
+
color: #fff;
|
|
170
|
+
margin-top: 16px;
|
|
171
|
+
font-size: 14px;
|
|
172
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
173
|
+
">Reklam yΓΌkleniyor...</div>
|
|
174
|
+
</div>
|
|
175
|
+
`,!document.getElementById("virtus-ad-spinner-style")){const n=document.createElement("style");n.id="virtus-ad-spinner-style",n.textContent=`
|
|
176
|
+
@keyframes virtus-spin {
|
|
177
|
+
0% { transform: rotate(0deg); }
|
|
178
|
+
100% { transform: rotate(360deg); }
|
|
179
|
+
}
|
|
180
|
+
`,document.head.appendChild(n)}t.appendChild(this.loadingContainer),console.log("[AdManager] Loading spinner shown")}}hideAdLoading(){if(this.onLoadingChange){this.onLoadingChange(!1),console.log("[AdManager] External loading callback triggered (false)");return}this.loadingContainer&&(this.loadingContainer.remove(),this.loadingContainer=null,console.log("[AdManager] Loading spinner hidden"))}destroy(){this.hideAdLoading(),this.adPlayer.destroy(),this.preRollPlayed=!1,this.midRollsPlayed.clear(),this.postRollPlayed=!1,this.vmapData=null,console.log("[AdManager] Destroyed")}}const vm={bottomOffset:40,fontSize:18,color:"#ffffff",background:"rgba(0,0,0,0.75)"},Sm=At.createContext({style:vm,setStyle:()=>{}});function g_({children:u}){const[e,t]=At.useState(vm),n=r=>t(i=>({...i,...r}));return ve.jsx(Sm.Provider,{value:{style:e,setStyle:n},children:u})}function _m(){return At.useContext(Sm)}function m_({videoElement:u}){const{style:e}=_m(),[t,n]=At.useState([]),r=At.useRef(""),i=At.useRef(0);return At.useEffect(()=>{if(!u)return;const o=()=>{const l=u.textTracks,d=[];for(let g=0;g<l.length;g++){const f=l[g];if(f.kind!=="subtitles"&&f.kind!=="captions"||f.mode==="disabled")continue;f.mode==="showing"&&(f.mode="hidden");const h=f.activeCues;if(h)for(let y=0;y<h.length;y++){const E=h[y];E.text&&d.push(E.text)}}const c=d.join("\0");c!==r.current&&(r.current=c,n(d)),i.current=requestAnimationFrame(o)};return i.current=requestAnimationFrame(o),()=>{cancelAnimationFrame(i.current)}},[u]),t.length===0?null:ve.jsx("div",{"aria-live":"polite",style:{position:"absolute",bottom:e.bottomOffset,left:"50%",transform:"translateX(-50%)",textAlign:"center",pointerEvents:"none",zIndex:200,maxWidth:"85%",display:"flex",flexDirection:"column",alignItems:"center",gap:"2px"},children:t.map((o,l)=>ve.jsx("span",{style:{display:"inline-block",fontSize:e.fontSize,lineHeight:1.4,color:e.color,background:e.background||"transparent",padding:e.background?"2px 10px":"0",borderRadius:4,whiteSpace:"pre-wrap",wordBreak:"break-word",textShadow:e.background?"none":"0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.8)"},dangerouslySetInnerHTML:{__html:o}},l))})}const yo=At.createContext(!0);function Am({src:u="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",defaultControls:e=!1,autoplay:t=!1,muted:n=!1,poster:r,className:i,children:o,config:l,onAdLoading:d,onNextEpisode:c,nextEpisodeTitle:g,nextEpisodeThumbnail:f,endCardCountdown:h=5}){const y=At.useRef(null),E=At.useRef(null),[_,L]=At.useState(null),K=At.useRef(null),[Z,ae]=At.useState(!1),[pe,xe]=At.useState(!1),ke=At.useCallback(()=>xe(!0),[]),Y=At.useCallback(()=>xe(!1),[]),[J,he]=At.useState(!1),[Ee,Le]=At.useState({x:0,y:0,open:!1}),et=At.useCallback(()=>Le(nt=>({...nt,open:!1})),[]),Ae=At.useCallback(nt=>{nt.preventDefault();const Ft=y.current?.getBoundingClientRect();if(!Ft)return;const Xt=nt.clientX-Ft.left,Pe=nt.clientY-Ft.top;Le({x:Xt,y:Pe,open:!0})},[]),Ze=At.useMemo(()=>{if(!_)return[];const nt=_.getVideoElement(),Ft=nt?.loop??!1;return[{label:Ft?"Loop: On":"Loop: Off",icon:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("polyline",{points:"17 1 21 5 17 9"}),ve.jsx("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),ve.jsx("polyline",{points:"7 23 3 19 7 15"}),ve.jsx("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"}),Ft&&ve.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",stroke:"none"})]}),onClick:()=>{if(nt){const Xt=!nt.loop;_.setLoop(Xt)}},dividerAfter:!1},{label:`Copy Speed (${nt?.playbackRate??1}Γ)`,icon:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0 1 1 0 0 0-2 0"}),ve.jsx("path",{d:"M12 2a10 10 0 0 1 7.39 16.74M12 2A10 10 0 0 0 4.61 18.74"}),ve.jsx("path",{d:"m16.24 7.76-2.12 2.12"})]}),onClick:()=>{const Xt=nt?.playbackRate??1;navigator.clipboard?.writeText(String(Xt)).catch(()=>{})},dividerAfter:!1},{label:"Copy Video URL",icon:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),ve.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),onClick:()=>{const Xt=nt?.currentSrc??u??"";navigator.clipboard?.writeText(Xt).catch(()=>{})},dividerAfter:!0},{label:"Keyboard Shortcuts",icon:ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),ve.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),onClick:()=>xe(!0),dividerAfter:!1}]},[_,u]),{onTouchStart:Be,onTouchMove:Ne,onTouchEnd:tt,gestureHint:mt}=Tm({player:_,skipSec:10}),{isActive:Ge}=o_({timeout:3e3,initialVisible:!0});l_({player:_,seekStep:10,enabled:!0,onShowShortcuts:ke});const ut=At.useMemo(()=>!l?.ads?.enabled||!l.ads.vastUrl&&!l.ads.vmapUrl?null:{enabled:!0,vastUrl:l.ads.vastUrl,vmapUrl:l.ads.vmapUrl,skipAfter:l.ads.skipAfter,timeout:l.ads.timeout,maxWrapperDepth:l.ads.maxWrapperDepth},[l?.ads?.enabled,l?.ads?.vastUrl,l?.ads?.vmapUrl,l?.ads?.skipAfter,l?.ads?.timeout,l?.ads?.maxWrapperDepth]);At.useEffect(()=>{if(!E.current||!y.current)return;console.log("[Player] Initializing PlayerCore");const nt=new Pa(E.current);return nt.container=y.current,L(nt),()=>{console.log("[Player] Cleanup called - destroying PlayerCore"),K.current&&(console.log("[Player] Destroying AdManager"),K.current.destroy(),K.current=null),nt.destroy(),L(null)}},[]),At.useEffect(()=>{if(!_||!ut)return;console.log("[Player] Setting up ads");const nt=Xt=>{ae(Xt),d?.(Xt)},Ft=new h_(_,ut,nt);return K.current=Ft,Ft.setup().catch(Xt=>{console.error("[Player] Failed to setup ads:",Xt)}),()=>{K.current&&(console.log("[Player] Cleaning up ads"),K.current.destroy(),K.current=null)}},[_,ut]);const Xe=At.useMemo(()=>l?.drm??null,[l?.drm]);return At.useEffect(()=>{!_||!Xe?.enabled||_.setupDrm(Xe)},[_,Xe]),At.useEffect(()=>{_&&u&&(console.log("[Player] Setting source:",u),_.setSource(u).catch(nt=>{console.error("[Player] setSource failed:",nt)}))},[_,u]),At.useEffect(()=>{if(!_||!c)return;const nt=_.getVideoElement();if(!nt)return;const Ft=()=>he(!0);return nt.addEventListener("ended",Ft),()=>nt.removeEventListener("ended",Ft)},[_,c]),ve.jsxs(g_,{children:[ve.jsxs("div",{ref:y,role:"region","aria-label":"Video Player",className:`playron-wrapper ${i||""}`,onContextMenu:Ae,onTouchStart:Be,onTouchMove:Ne,onTouchEnd:tt,style:{position:"relative",backgroundColor:"#000",overflow:"hidden",cursor:Ge?"default":"none"},children:[ve.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}}),ve.jsx("video",{ref:E,className:`virtus-video-element ${i||""}`,style:{width:"100%",height:"100%",display:"block",aspectRatio:"16/9",objectFit:"cover",objectPosition:"center"},autoPlay:t,muted:n,controls:e,poster:r,crossOrigin:"anonymous",tabIndex:e?0:-1}),_?ve.jsx(gm,{playerInstance:_,children:ve.jsxs(yo.Provider,{value:Ge,children:[ve.jsx(m_,{videoElement:E.current}),ve.jsx(NS,{config:l,isAdLoading:Z}),ve.jsx(bm,{type:mt?.type??null,value:mt?.value??""}),ve.jsx(i_,{drmConfig:l?.drm}),ve.jsx(pm,{isOpen:pe,onClose:Y}),c&&ve.jsx(Em,{isVisible:J,onNextEpisode:()=>{he(!1),c()},onDismiss:()=>he(!1),countdownSec:h,nextTitle:g,thumbnail:f}),ve.jsx(ym,{x:Ee.x,y:Ee.y,isOpen:Ee.open,onClose:et,actions:Ze}),o]})}):null]}),ve.jsx("style",{children:`
|
|
181
|
+
@keyframes gestureHintFade {
|
|
182
|
+
0% { opacity: 1; }
|
|
183
|
+
60% { opacity: 1; }
|
|
184
|
+
100% { opacity: 0; }
|
|
185
|
+
}
|
|
186
|
+
`})]})}function p_({children:u}){const e=At.useContext(yo);return ve.jsx("div",{className:"virtus-controlbar",style:{position:"absolute",bottom:0,left:0,right:0,display:"flex",alignItems:"center",gap:"12px",padding:"12px 20px",background:"linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%)",zIndex:50,opacity:e?1:0,transition:"opacity 0.3s ease",pointerEvents:e?"auto":"none"},children:u})}const y_="_playButton_2gfg7_3",E_={playButton:y_};function b_({className:u,onClick:e,...t}){const n=Fr(o=>o.isPlaying),{togglePlay:r}=kr(),i=async o=>{try{await r()}catch(l){console.error("Play/Pause error:",l)}e?.(o)};return ve.jsx("button",{className:`virtus-btn virtus-play-button ${E_.playButton} ${u||""}`,"aria-label":n?"Pause":"Play",onClick:i,...t,children:n?ve.jsx("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",children:ve.jsx("path",{fillRule:"evenodd",d:"M8 5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2H8Zm7 0a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-1Z",clipRule:"evenodd"})}):ve.jsx("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",children:ve.jsx("path",{fillRule:"evenodd",d:"M8.6 5.2A1 1 0 0 0 7 6v12a1 1 0 0 0 1.6.8l8-6a1 1 0 0 0 0-1.6l-8-6Z",clipRule:"evenodd"})})})}const T_="_controlButton_11qxo_3",as={controlButton:T_};function v_({className:u,onClick:e,...t}){const n=Fr(o=>o.isMuted),{toggleMute:r}=kr(),i=o=>{r(),e?.(o)};return ve.jsx("button",{className:`virtus-btn virtus-mute-button ${as.controlButton} ${u||""}`,"aria-label":n?"Unmute":"Mute",onClick:i,...t,children:n?ve.jsx("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 24 24",children:ve.jsx("path",{d:"M5.707 4.293a1 1 0 0 0-1.414 1.414l14 14a1 1 0 0 0 1.414-1.414l-.004-.005C21.57 16.498 22 13.938 22 12a9.972 9.972 0 0 0-2.929-7.071 1 1 0 1 0-1.414 1.414A7.972 7.972 0 0 1 20 12c0 1.752-.403 3.636-1.712 4.873l-1.433-1.433C17.616 14.37 18 13.107 18 12c0-1.678-.69-3.197-1.8-4.285a1 1 0 1 0-1.4 1.428A3.985 3.985 0 0 1 16 12c0 .606-.195 1.335-.59 1.996L13 11.586V6.135c0-1.696-1.978-2.622-3.28-1.536L7.698 6.284l-1.99-1.991ZM4 8h.586L13 16.414v1.451c0 1.696-1.978 2.622-3.28 1.536L5.638 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2Z"})}):ve.jsxs("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"currentColor",viewBox:"0 0 24 24",children:[ve.jsx("path",{d:"M13.5 4.06c0-1.336-1.616-2.005-2.56-1.06l-4.5 4.5H4.508c-1.141 0-2.318.664-2.66 1.905A9.76 9.76 0 0 0 1.5 12c0 .898.121 1.768.35 2.595.341 1.24 1.518 1.905 2.659 1.905h1.93l4.5 4.5c.945.945 2.561.276 2.561-1.06V4.06ZM18.584 5.106a.75.75 0 0 1 1.06 0 11.5 11.5 0 0 1 0 13.588.75.75 0 0 1-1.06-1.06 10 10 0 0 0 0-11.468.75.75 0 0 1 0-1.06Z"}),ve.jsx("path",{d:"M15.932 7.757a.75.75 0 0 1 1.061 0 6.5 6.5 0 0 1 0 8.486.75.75 0 0 1-1.06-1.06 5 5 0 0 0 0-6.366.75.75 0 0 1 0-1.06Z"})]})})}function S_({className:u,onClick:e,...t}){const{toggleFullscreen:n}=kr(),[r,i]=At.useState(!1);At.useEffect(()=>{const l=()=>{i(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",l),()=>{document.removeEventListener("fullscreenchange",l)}},[]);const o=l=>{n(),e?.(l)};return ve.jsx("button",{className:`virtus-btn virtus-fullscreen-button ${as.controlButton} ${u||""}`,"aria-label":r?"Exit Fullscreen":"Fullscreen",onClick:o,...t,children:r?ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:ve.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"})}):ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:ve.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})})}function __({className:u,onClick:e,...t}){const{togglePip:n}=kr(),[r,i]=At.useState(!1);At.useEffect(()=>{const l=()=>{i(!!document.pictureInPictureElement)};return document.addEventListener("enterpictureinpicture",l),document.addEventListener("leavepictureinpicture",l),()=>{document.removeEventListener("enterpictureinpicture",l),document.removeEventListener("leavepictureinpicture",l)}},[]);const o=async l=>{try{await n()}catch(d){console.error("PiP toggle error:",d)}e?.(l)};return ve.jsx("button",{className:`virtus-btn virtus-pip-button ${as.controlButton} ${u||""}`,"aria-label":r?"Exit Picture-in-Picture":"Picture-in-Picture",onClick:o,...t,children:ve.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[ve.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),ve.jsx("rect",{x:"13",y:"13",width:"8",height:"6",rx:"1",fill:"currentColor"})]})})}function A_(){const{toggleTheaterMode:u,isTheaterMode:e}=kr(),[t,n]=At.useState(e()),r=()=>{u(),n(!t)};return At.useEffect(()=>{const i=o=>{n(o.detail.isTheaterMode)};return window.addEventListener("virtus:theatermodechange",i),()=>{window.removeEventListener("virtus:theatermodechange",i)}},[]),ve.jsx("button",{className:"virtus-theater-button",onClick:r,style:{background:t?"rgba(59, 130, 246, 0.3)":"transparent",border:"none",color:"white",cursor:"pointer",padding:"8px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"40px",transition:"all 0.2s ease",position:"relative"},onMouseEnter:i=>{i.currentTarget.style.background=t?"rgba(59, 130, 246, 0.4)":"rgba(255, 255, 255, 0.15)",i.currentTarget.style.transform="scale(1.05)"},onMouseLeave:i=>{i.currentTarget.style.background=t?"rgba(59, 130, 246, 0.3)":"transparent",i.currentTarget.style.transform="scale(1)"},title:t?"Exit Theater Mode":"Theater Mode",children:t?ve.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:ve.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"})}):ve.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:ve.jsx("path",{d:"M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"})})})}function I_(u,e,t=!0){At.useEffect(()=>{if(!t)return;const n=i=>{u.current&&!u.current.contains(i.target)&&e()},r=i=>{i.key==="Escape"&&e()};return document.addEventListener("mousedown",n),document.addEventListener("keydown",r),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("keydown",r)}},[u,e,t])}const Eo=At.createContext({isOpen:!1,toggle:()=>{},close:()=>{},open:()=>{}});function Im({children:u}){const[e,t]=At.useState(!1),n=At.useRef(null),r=()=>t(d=>!d),i=()=>t(!1),o=()=>t(!0);I_(n,i,e);const l={isOpen:e,toggle:r,close:i,open:o};return ve.jsx(Eo.Provider,{value:l,children:ve.jsx("div",{ref:n,style:{position:"relative",display:"inline-block"},children:u})})}function xm({children:u}){const{toggle:e,close:t}=At.useContext(Eo);return ve.jsx("div",{onClick:e,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),e()),n.key==="Escape"&&t()},style:{display:"inline-block"},children:u})}function wm({children:u,title:e,placement:t="top"}){const{isOpen:n}=At.useContext(Eo);if(!n)return null;const r=()=>{const o={position:"absolute",bottom:"50px",zIndex:9999};switch(t){case"top-right":return{...o,right:0};case"top-left":return{...o,left:0};default:return{...o,left:"50%",transform:"translateX(-50%)"}}},i=()=>{switch(t){case"top-right":return"dropdownFadeInRight";case"top-left":return"dropdownFadeInLeft";default:return"dropdownFadeInCenter"}};return ve.jsxs("div",{role:"menu","aria-label":e,onKeyDown:o=>{o.key==="Escape"&&(o.stopPropagation(),close())},style:{...r(),minWidth:"200px",background:"rgba(0, 0, 0, 0.95)",backdropFilter:"blur(10px)",borderRadius:"12px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.5)",border:"1px solid rgba(255, 255, 255, 0.1)",overflow:"hidden",animation:`${i()} 0.2s ease-out`},children:[e&&ve.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(255, 255, 255, 0.1)",color:"#fff",fontSize:"13px",fontWeight:600,fontFamily:"system-ui, -apple-system, sans-serif"},children:e}),ve.jsx("div",{style:{maxHeight:"300px",overflowY:"auto"},children:u}),ve.jsx("style",{children:`
|
|
187
|
+
@keyframes dropdownFadeInCenter {
|
|
188
|
+
from {
|
|
189
|
+
opacity: 0;
|
|
190
|
+
transform: translateX(-50%) translateY(10px) scale(0.95);
|
|
191
|
+
}
|
|
192
|
+
to {
|
|
193
|
+
opacity: 1;
|
|
194
|
+
transform: translateX(-50%) translateY(0) scale(1);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@keyframes dropdownFadeInRight {
|
|
199
|
+
from {
|
|
200
|
+
opacity: 0;
|
|
201
|
+
transform: translateY(10px) scale(0.95);
|
|
202
|
+
}
|
|
203
|
+
to {
|
|
204
|
+
opacity: 1;
|
|
205
|
+
transform: translateY(0) scale(1);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@keyframes dropdownFadeInLeft {
|
|
210
|
+
from {
|
|
211
|
+
opacity: 0;
|
|
212
|
+
transform: translateY(10px) scale(0.95);
|
|
213
|
+
}
|
|
214
|
+
to {
|
|
215
|
+
opacity: 1;
|
|
216
|
+
transform: translateY(0) scale(1);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
`})]})}function Hl({children:u,onClick:e,selected:t=!1,disabled:n=!1,closeOnClick:r=!0}){const{close:i}=At.useContext(Eo),o=()=>{n||(e?.(),r&&i())};return ve.jsxs("button",{role:"menuitem","aria-disabled":n,"aria-checked":t,onClick:o,style:{width:"100%",textAlign:"left",padding:"10px 16px",color:n?"rgba(255, 255, 255, 0.4)":"#fff",fontSize:"14px",fontFamily:"system-ui, -apple-system, sans-serif",cursor:n?"not-allowed":"pointer",background:t?"rgba(59, 130, 246, 0.2)":"transparent",border:"none",transition:"background 0.15s ease",display:"flex",alignItems:"center",gap:"8px",fontWeight:t?600:400,outline:"none"},onMouseEnter:l=>{n||(l.currentTarget.style.background=t?"rgba(59, 130, 246, 0.3)":"rgba(255, 255, 255, 0.1)")},onMouseLeave:l=>{l.currentTarget.style.background=t?"rgba(59, 130, 246, 0.2)":"transparent"},onFocus:l=>{n||(l.currentTarget.style.background="rgba(255, 255, 255, 0.1)")},onBlur:l=>{l.currentTarget.style.background=t?"rgba(59, 130, 246, 0.2)":"transparent"},children:[t&&ve.jsx("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"3",children:ve.jsx("polyline",{points:"20 6 9 17 4 12"})}),u]})}function x_(){const u=kr(),e=Fr(),[t,n]=At.useState(1),[r,i]=At.useState(!1),o=[.25,.5,.75,1,1.25,1.5,1.75,2];At.useEffect(()=>{e?.playbackRate!==void 0&&n(e.playbackRate)},[e?.playbackRate]);const l=c=>{u.setPlaybackRate(c),n(c)},d=()=>{const c=!r;i(c),u.setLoop(c)};return ve.jsxs(Im,{children:[ve.jsx(xm,{children:ve.jsx("button",{className:"virtus-btn virtus-settings-button","aria-label":"Settings",style:{background:"rgba(255, 255, 255, 0.1)",border:"none",borderRadius:"8px",width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease"},onMouseEnter:c=>{c.currentTarget.style.background="rgba(255, 255, 255, 0.2)",c.currentTarget.style.transform="scale(1.05)"},onMouseLeave:c=>{c.currentTarget.style.background="rgba(255, 255, 255, 0.1)",c.currentTarget.style.transform="scale(1)"},children:ve.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"2",children:[ve.jsx("circle",{cx:"12",cy:"12",r:"3"}),ve.jsx("path",{d:"M12 1v6m0 6v6m9-9h-6m-6 0H3m15.4-6.4l-4.3 4.3M9.9 14.8l-4.2 4.2m0-12.4l4.2 4.2m4.3 4.2l4.2 4.2"})]})})}),ve.jsxs(wm,{title:"Settings",placement:"top-right",children:[ve.jsx("div",{style:{padding:"8px 16px 4px",color:"rgba(255, 255, 255, 0.6)",fontSize:"12px",fontWeight:600},children:"Playback Speed"}),o.map(c=>ve.jsxs(Hl,{selected:t===c,onClick:()=>l(c),children:[c,"x"]},c)),ve.jsx("div",{style:{height:"1px",background:"rgba(255, 255, 255, 0.1)",margin:"8px 0"}}),ve.jsxs(Hl,{selected:r,onClick:d,children:["Loop ",r?"On":"Off"]})]})]})}const w_="_timeDisplay_1wupc_3",R_="_currentTime_1wupc_16",k_="_separator_1wupc_20",C_="_duration_1wupc_25",Aa={timeDisplay:w_,currentTime:R_,separator:k_,duration:C_},Al=u=>{if(!isFinite(u)||isNaN(u))return"0:00";const e=Math.floor(u/3600),t=Math.floor(u%3600/60),n=Math.floor(u%60);return e>0?`${e}:${t.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${t}:${n.toString().padStart(2,"0")}`};function L_({className:u,...e}){const{currentTime:t,duration:n,isLive:r}=Fr();return r?ve.jsx("div",{className:`virtus-time-display ${Aa.timeDisplay} ${u||""}`,...e,children:ve.jsx("span",{className:Aa.currentTime,style:{color:"rgba(255, 255, 255, 0.7)",fontSize:"12px"},children:Al(t)})}):ve.jsxs("div",{className:`virtus-time-display ${Aa.timeDisplay} ${u||""}`,...e,children:[ve.jsx("span",{className:Aa.currentTime,children:Al(t)}),ve.jsx("span",{className:Aa.separator,children:"/"}),ve.jsx("span",{className:Aa.duration,children:Al(n)})]})}function Rm(){const{isLive:u,isAtLiveEdge:e}=Fr(),{seekToLiveEdge:t}=kr();return!u||e?null:ve.jsxs("button",{className:"virtus-jump-to-live","aria-label":"Jump to live",onClick:t,style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",background:"rgba(255, 32, 32, 0.9)",border:"none",borderRadius:"4px",color:"#fff",fontSize:"12px",fontWeight:"700",letterSpacing:"0.5px",cursor:"pointer",transition:"background 0.15s ease, box-shadow 0.15s ease",whiteSpace:"nowrap",flexShrink:0,boxShadow:"0 0 12px rgba(255,32,32,0.45)"},onMouseEnter:n=>{n.currentTarget.style.background="rgba(255, 32, 32, 1)",n.currentTarget.style.boxShadow="0 0 18px rgba(255,32,32,0.65)"},onMouseLeave:n=>{n.currentTarget.style.background="rgba(255, 32, 32, 0.9)",n.currentTarget.style.boxShadow="0 0 12px rgba(255,32,32,0.45)"},children:[ve.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:ve.jsx("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"})}),"LIVE"]})}function km(){const{isLive:u,isAtLiveEdge:e,liveLatency:t}=Fr();if(!u||e||!t||t<1)return null;const n=Math.round(t);return ve.jsxs("span",{className:"virtus-live-latency","aria-live":"polite",style:{fontSize:"11px",fontWeight:"500",color:"rgba(255, 255, 255, 0.7)",whiteSpace:"nowrap",flexShrink:0},children:[n,"s behind live"]})}const D_="_container_6dw0q_3",P_="_skipButton_6dw0q_11",Il={container:D_,skipButton:P_};function N_({introOutro:u}){const{currentTime:e}=Fr(),{seekTo:t}=kr(),[n,r]=At.useState(!1),[i,o]=At.useState(!1);At.useEffect(()=>{if(u){if(u.intro){const c=e>=u.intro.start&&e<u.intro.end;r(c)}if(u.outro){const c=e>=u.outro.start&&e<u.outro.end;o(c)}}},[e,u]);const l=At.useCallback(()=>{u?.intro&&(t(u.intro.end),r(!1))},[u,t]),d=At.useCallback(()=>{u?.outro&&(t(u.outro.end),o(!1))},[u,t]);return!n&&!i?null:ve.jsxs("div",{className:Il.container,children:[n&&ve.jsxs("button",{onClick:l,className:Il.skipButton,children:[ve.jsx("span",{children:"Skip Intro"}),ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:ve.jsx("path",{d:"M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z"})})]}),i&&ve.jsxs("button",{onClick:d,className:Il.skipButton,children:[ve.jsx("span",{children:"Skip Outro"}),ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:ve.jsx("path",{d:"M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z"})})]}),ve.jsx("style",{children:`
|
|
220
|
+
@keyframes slideInRight {
|
|
221
|
+
from {
|
|
222
|
+
opacity: 0;
|
|
223
|
+
transform: translateX(50px);
|
|
224
|
+
}
|
|
225
|
+
to {
|
|
226
|
+
opacity: 1;
|
|
227
|
+
transform: translateX(0);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
`})]})}const Eh={goal:{icon:"β½",color:"#22c55e"},yellow:{icon:"π¨",color:"#fbbf24"},red:{icon:"π₯",color:"#ef4444"},substitution:{icon:"π",color:"#3b82f6"},kickoff:{icon:"β±οΈ",color:"#9ca3af"},highlight:{icon:"β",color:"#f59e0b"},bookmark:{icon:"π",color:"#8b5cf6"},comment:{icon:"π¬",color:"#06b6d4"},event:{icon:"π―",color:"#ec4899"}};function M_({event:u,position:e,size:t=12,showTooltip:n=!0,onClick:r}){const[i,o]=At.useState(!1),l=Eh[u.type]||Eh.event,d=u.icon||l.icon,c=u.color||l.color,g=f=>{f.stopPropagation(),r&&r(u.time)};return ve.jsxs("div",{style:{position:"absolute",left:`${e}%`,top:"50%",transform:i?"translate(-50%, -50%) scale(1.2)":"translate(-50%, -50%)",cursor:"pointer",zIndex:i?12:10,transition:"all 0.2s ease",pointerEvents:"auto"},onClick:g,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[ve.jsx("div",{style:{width:`${t}px`,height:`${t}px`,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:c,border:"2px solid rgba(255, 255, 255, 0.9)",boxShadow:i?"0 4px 16px rgba(0, 0, 0, 0.4)":"0 2px 8px rgba(0, 0, 0, 0.4)",transition:"transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)",transform:i?"scale(1.3)":"scale(1)"},children:ve.jsx("span",{style:{fontSize:`${t*.8}px`,lineHeight:1,userSelect:"none",display:"inline-block",transform:"translateY(-1px)"},children:d})}),n&&i&&u.label&&ve.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 12px)",left:"50%",transform:"translateX(-50%)",padding:"6px 10px",background:"rgba(0, 0, 0, 0.85)",color:"#fff",fontSize:"12px",fontWeight:"500",whiteSpace:"nowrap",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.5)",pointerEvents:"none",zIndex:15},children:u.label})]})}class Cm{cues=[];loaded=!1;async load(e){try{const t=await fetch(e);if(!t.ok)return;const n=await t.text();this.cues=this.parseVtt(n,e),this.loaded=!0}catch{}}getThumbnailAt(e){if(!this.loaded||this.cues.length===0)return null;let t=0,n=this.cues.length-1;for(;t<=n;){const r=t+n>>>1,i=this.cues[r];if(e<i.startTime)n=r-1;else if(e>=i.endTime)t=r+1;else return i}return null}isLoaded(){return this.loaded}destroy(){this.cues=[],this.loaded=!1}parseVtt(e,t){const n=[],r=e.replace(/\r\n/g,`
|
|
231
|
+
`).replace(/\r/g,`
|
|
232
|
+
`).split(`
|
|
233
|
+
`);let i=0;for(;i<r.length&&!r[i].includes("-->");)i++;for(;i<r.length;){const o=r[i].trim();if(o.includes("-->")){const[l,d]=o.split("-->").map(y=>y.trim()),c=this.parseTime(l),g=this.parseTime(d);i++;const f=[];for(;i<r.length&&r[i].trim()!==""&&!r[i].includes("-->");)f.push(r[i].trim()),i++;const h=f.join(`
|
|
234
|
+
`).trim();if(h&&c>=0&&g>c){const y=this.parseCueLine(h,t);y&&n.push({startTime:c,endTime:g,...y})}}else i++}return n}parseCueLine(e,t){const n=e.lastIndexOf("#xywh=");let r,i=0,o=0,l=0,d=0;if(n!==-1){r=e.slice(0,n);const g=e.slice(n+6).split(",").map(Number);g.length===4&&g.every(f=>!isNaN(f))&&([i,o,l,d]=g)}else r=e;const c=this.resolveUrl(r.trim(),t);return c?{url:c,x:i,y:o,w:l,h:d}:null}resolveUrl(e,t){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//"))return e;try{return new URL(e,t).href}catch{return e}}parseTime(e){const t=e.trim().split(":").map(Number);return t.length===3?t[0]*3600+t[1]*60+t[2]:t.length===2?t[0]*60+t[1]:-1}}const bh=160,O_=90;function F_({mode:u="vod",chapters:e=[],timelineEvents:t=[],showTimelineMarkers:n=!1,markerSize:r=12,thumbnailsVttUrl:i}){const o=At.useContext(yo),l=At.useRef(null),[d,c]=At.useState(!1),[g,f]=At.useState(null),[h,y]=At.useState(null),[E,_]=At.useState([]),L=At.useRef(null),{currentTime:K,duration:Z,isLive:ae}=Fr(),{seekTo:pe,getDVRRange:xe,getBufferedRanges:ke}=kr();At.useEffect(()=>{if(!i)return;const Ge=new Cm;return L.current=Ge,Ge.load(i),()=>{Ge.destroy(),L.current=null}},[i]),At.useEffect(()=>{const Ge=setInterval(()=>{_(ke())},500);return()=>clearInterval(Ge)},[ke]);const Y=u==="live"||!!ae,J=Y?xe():null,he=J!==null&&J.end-J.start>5,Ee=he?J.end-J.start:0,Le=he&&Ee>0?(K-J.start)/Ee*100:0,et=Y?Math.min(100,Math.max(0,Le)):Z>0?K/Z*100:0,Ae=Ge=>{if(!isFinite(Ge)||isNaN(Ge))return"0:00";const ut=Math.floor(Ge/3600),Xe=Math.floor(Ge%3600/60),nt=Math.floor(Ge%60);return ut>0?`${ut}:${Xe.toString().padStart(2,"0")}:${nt.toString().padStart(2,"0")}`:`${Xe}:${nt.toString().padStart(2,"0")}`},Ze=Ge=>{if(!l.current)return 0;const ut=l.current.getBoundingClientRect(),Xe=(Ge.clientX-ut.left)/ut.width;return Math.max(0,Math.min(1,Xe))},Be=Ge=>{if(!(Y&&!he)){if(Y&&he){pe(J.start+Ge*Ee);return}Z!==0&&pe(Ge*Z)}},Ne=Ge=>{if(Y&&!he)return;Ge.preventDefault(),c(!0);const ut=Ze(Ge);Be(ut)},tt=Ge=>{if(!l.current)return;const ut=Ze(Ge);if(f(ut),L.current){const Xe=he?J.start+ut*Ee:ut*Z;y(L.current.getThumbnailAt(Xe))}},mt=()=>{f(null),y(null)};return At.useEffect(()=>{if(!d)return;const Ge=Xe=>{if(!l.current)return;const nt=Ze(Xe);f(nt),Be(nt)},ut=()=>{c(!1)};return window.addEventListener("mousemove",Ge),window.addEventListener("mouseup",ut),()=>{window.removeEventListener("mousemove",Ge),window.removeEventListener("mouseup",ut)}},[d,Z]),ve.jsxs("div",{style:{position:"absolute",bottom:"64px",left:0,right:0,padding:"0 20px",zIndex:50,opacity:o?1:0,transition:"opacity 0.3s ease",pointerEvents:o?"auto":"none"},children:[Y&&!he&&ve.jsxs("div",{style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",display:"flex",alignItems:"center",gap:"8px",padding:"6px 18px",background:"rgba(255, 30, 30, 0.95)",borderRadius:"20px",fontSize:"12px",fontWeight:"700",color:"#fff",letterSpacing:"1.5px",zIndex:10,boxShadow:"0 0 20px rgba(255, 30, 30, 0.6), 0 2px 8px rgba(0,0,0,0.4)"},children:[ve.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#fff",boxShadow:"0 0 6px rgba(255,255,255,0.8)",animation:"pulse 1.5s ease-in-out infinite"}}),ve.jsx("span",{children:"LIVE"})]}),Y&&he&&ve.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[ve.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",flexShrink:0},children:[ve.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#ff2020",boxShadow:"0 0 10px rgba(255, 32, 32, 0.8)",animation:"pulse 1.5s ease-in-out infinite"}}),ve.jsx("span",{style:{fontSize:"11px",fontWeight:"700",color:"#fff",letterSpacing:"1px"},children:"LIVE"})]}),ve.jsx(km,{}),ve.jsx("div",{style:{flex:1}}),ve.jsx(Rm,{})]}),ve.jsxs("div",{ref:l,role:Y&&!he?void 0:"slider",tabIndex:Y&&!he?void 0:0,"aria-label":Y?"DVR seek":"Seek","aria-valuemin":Y&&!he?void 0:he?Math.floor(J.start):0,"aria-valuemax":Y&&!he?void 0:he?Math.floor(J.end):Math.floor(Z)||0,"aria-valuenow":Y&&!he?void 0:Math.floor(K),"aria-valuetext":Y&&!he?"LIVE":he?`${Ae(K)} (DVR)`:`${Ae(K)} of ${Ae(Z)}`,"aria-disabled":Y&&!he?!0:void 0,onMouseDown:Ne,onMouseMove:tt,onMouseLeave:mt,onKeyDown:Ge=>{if(Y&&!he)return;const ut=5,Xe=30,nt=he?J.start:0,Ft=he?J.end:Z;if(Ft!==0)switch(Ge.key){case"ArrowLeft":case"ArrowDown":Ge.preventDefault(),pe(Math.max(nt,K-ut));break;case"ArrowRight":case"ArrowUp":Ge.preventDefault(),pe(Math.min(Ft,K+ut));break;case"PageDown":Ge.preventDefault(),pe(Math.max(nt,K-Xe));break;case"PageUp":Ge.preventDefault(),pe(Math.min(Ft,K+Xe));break;case"Home":Ge.preventDefault(),pe(nt);break;case"End":Ge.preventDefault(),pe(Ft);break}},style:{width:"100%",height:"32px",display:"flex",alignItems:"center",cursor:Y&&!he?"default":"pointer",position:"relative",outline:"none"},children:[ve.jsxs("div",{style:{position:"absolute",left:0,right:0,height:"4px",backgroundColor:"rgba(255, 255, 255, 0.3)",borderRadius:"2px"},children:[!Y&&E.map((Ge,ut)=>{if(Z<=0)return null;const Xe=Ge.start/Z*100,nt=(Ge.end-Ge.start)/Z*100;return ve.jsx("div",{style:{position:"absolute",left:`${Xe}%`,top:0,height:"100%",width:`${nt}%`,backgroundColor:"rgba(255, 255, 255, 0.25)",borderRadius:"2px",pointerEvents:"none"}},ut)}),ve.jsx("div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${et}%`,backgroundColor:Y?"#ff2020":"#6366f1",borderRadius:"2px",transition:d?"none":"width 0.1s linear"}}),!Y&&e.map(Ge=>{const ut=Z>0?Ge.startTime/Z*100:0;return ve.jsx("div",{style:{position:"absolute",left:`${ut}%`,top:"50%",transform:"translate(-50%, -50%)",width:"3px",height:"12px",backgroundColor:"rgba(255, 255, 255, 0.8)",borderRadius:"1px",pointerEvents:"none"}},Ge.id)}),n&&!Y&&Z>0&&t.map((Ge,ut)=>{const Xe=Ge.time/Z*100;return Xe<0||Xe>100?null:ve.jsx(M_,{event:Ge,position:Xe,size:r,showTooltip:!0,onClick:nt=>pe(nt)},`timeline-${ut}-${Ge.time}`)}),he&&ve.jsx("div",{style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",width:"3px",height:"14px",backgroundColor:"#ff2020",boxShadow:"0 0 8px rgba(255,32,32,0.7)",borderRadius:"1px",pointerEvents:"none",zIndex:5},title:"Live edge"}),(!Y||he)&&g!==null&&ve.jsx("div",{style:{position:"absolute",left:`${g*100}%`,top:"50%",transform:"translate(-50%, -50%)",width:"14px",height:"14px",backgroundColor:"#fff",borderRadius:"50%",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.3)",pointerEvents:"none",zIndex:999}}),(!Y||he)&&ve.jsx("div",{style:{position:"absolute",left:`${et}%`,top:"50%",transform:"translate(-50%, -50%)",width:d?"16px":"14px",height:d?"16px":"14px",backgroundColor:"#fff",borderRadius:"50%",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.3)",pointerEvents:"none",zIndex:1e3,opacity:d||g!==null?1:0,transition:d?"none":"all 0.15s ease"}})]}),(!Y||he)&&g!==null&&(()=>{const Ge=he?J.start+g*Ee:g*Z,ut=l.current?.offsetWidth??0,Xe=g*100,nt=g*ut,Ft=bh/2;let Xt="-50%";return nt<Ft?Xt="0%":ut-nt<Ft&&(Xt="-100%"),h?ve.jsxs("div",{style:{position:"absolute",left:`${Xe}%`,bottom:"24px",transform:`translateX(${Xt})`,pointerEvents:"none",zIndex:2e3,display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[ve.jsx("div",{style:{width:`${h.w||bh}px`,height:`${h.h||O_}px`,backgroundImage:`url("${h.url}")`,backgroundPosition:h.w?`-${h.x}px -${h.y}px`:"center center",backgroundRepeat:"no-repeat",backgroundSize:h.w?"auto":"cover",borderRadius:"4px",boxShadow:"0 4px 16px rgba(0,0,0,0.6)",border:"2px solid rgba(255,255,255,0.15)",overflow:"hidden",flexShrink:0}}),ve.jsx("div",{style:{padding:"2px 8px",backgroundColor:"rgba(0,0,0,0.85)",color:"#fff",fontSize:"12px",fontWeight:"600",borderRadius:"3px",whiteSpace:"nowrap"},children:Ae(Ge)})]}):ve.jsx("div",{style:{position:"absolute",left:`${Xe}%`,bottom:"20px",transform:`translateX(${Xt})`,padding:"4px 8px",backgroundColor:"rgba(0,0,0,0.85)",color:"#fff",fontSize:"12px",fontWeight:"500",borderRadius:"4px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:2e3},children:Ae(Ge)})})()]}),ve.jsx("style",{children:`
|
|
235
|
+
@keyframes pulse {
|
|
236
|
+
0%, 100% {
|
|
237
|
+
opacity: 1;
|
|
238
|
+
}
|
|
239
|
+
50% {
|
|
240
|
+
opacity: 0.5;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
`})]})}function U_({seconds:u=15}){const{skipBackward:e}=kr(),{isLive:t}=Fr();if(t)return null;const n=()=>{e(u)};return ve.jsx("button",{className:`virtus-btn virtus-skip-backward-button ${as.controlButton}`,"aria-label":`Skip Backward ${u}s`,onClick:n,style:{position:"relative"},children:ve.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[ve.jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),ve.jsx("path",{d:"M2 12l-2-2m2 2l2-2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),ve.jsx("text",{x:"12",y:"16",fontSize:"10",fill:"currentColor",textAnchor:"middle",fontWeight:"bold",children:u})]})})}function z_({seconds:u=15}){const{skipForward:e}=kr(),{isLive:t}=Fr();if(t)return null;const n=()=>{e(u)};return ve.jsx("button",{className:`virtus-btn virtus-skip-forward-button ${as.controlButton}`,"aria-label":`Skip Forward ${u}s`,onClick:n,style:{position:"relative"},children:ve.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[ve.jsx("path",{d:"M12 2c5.5 0 10 4.5 10 10s-4.5 10-10 10-10-4.5-10-10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),ve.jsx("path",{d:"M22 12l2-2m-2 2l-2-2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),ve.jsx("text",{x:"12",y:"16",fontSize:"10",fill:"currentColor",textAnchor:"middle",fontWeight:"bold",children:u})]})})}function B_(){const{isMuted:u,volume:e}=Fr(),{toggleMute:t,setVolume:n}=kr(),[r,i]=At.useState(!1),[o,l]=At.useState(!1),d=At.useRef(null),c=At.useCallback(h=>{if(!d.current)return;const y=d.current.getBoundingClientRect(),E=Math.max(0,Math.min(1,(h-y.left)/y.width));n(E)},[n]),g=At.useCallback(h=>{l(!0),c(h.clientX)},[c]);At.useEffect(()=>{if(!o)return;const h=E=>{c(E.clientX)},y=()=>{l(!1)};return window.addEventListener("mousemove",h),window.addEventListener("mouseup",y),()=>{window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",y)}},[o,c]);const f=u?0:e;return ve.jsxs("div",{className:"virtus-volume-control",style:{position:"relative",display:"flex",alignItems:"center",height:"40px",width:"40px"},children:[ve.jsx("button",{className:"virtus-btn virtus-mute-button","aria-label":u?"Unmute":"Mute",onClick:t,style:{background:"rgba(255, 255, 255, 0.1)",border:"none",borderRadius:"8px",width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"all 0.2s ease",flexShrink:0,position:"relative",zIndex:1},onMouseEnter:h=>{i(!0),h.currentTarget.style.background="rgba(255, 255, 255, 0.2)",h.currentTarget.style.transform="scale(1.05)"},onMouseLeave:h=>{h.currentTarget.style.background="rgba(255, 255, 255, 0.1)",h.currentTarget.style.transform="scale(1)"},children:u||e===0?ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"#fff",viewBox:"0 0 24 24",children:ve.jsx("path",{d:"M5.707 4.293a1 1 0 0 0-1.414 1.414l14 14a1 1 0 0 0 1.414-1.414l-.004-.005C21.57 16.498 22 13.938 22 12a9.972 9.972 0 0 0-2.929-7.071 1 1 0 1 0-1.414 1.414A7.972 7.972 0 0 1 20 12c0 1.752-.403 3.636-1.712 4.873l-1.433-1.433C17.616 14.37 18 13.107 18 12c0-1.678-.69-3.197-1.8-4.285a1 1 0 1 0-1.4 1.428A3.985 3.985 0 0 1 16 12c0 .606-.195 1.335-.59 1.996L13 11.586V6.135c0-1.696-1.978-2.622-3.28-1.536L7.698 6.284l-1.99-1.991ZM4 8h.586L13 16.414v1.451c0 1.696-1.978 2.622-3.28 1.536L5.638 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2Z"})}):e<.5?ve.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"#fff",viewBox:"0 0 24 24",children:ve.jsx("path",{d:"M13.5 4.06c0-1.336-1.616-2.005-2.56-1.06l-4.5 4.5H4.508c-1.141 0-2.318.664-2.66 1.905A9.76 9.76 0 0 0 1.5 12c0 .898.121 1.768.35 2.595.341 1.24 1.518 1.905 2.659 1.905h1.93l4.5 4.5c.945.945 2.561.276 2.561-1.06V4.06Z"})}):ve.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",fill:"#fff",viewBox:"0 0 24 24",children:[ve.jsx("path",{d:"M13.5 4.06c0-1.336-1.616-2.005-2.56-1.06l-4.5 4.5H4.508c-1.141 0-2.318.664-2.66 1.905A9.76 9.76 0 0 0 1.5 12c0 .898.121 1.768.35 2.595.341 1.24 1.518 1.905 2.659 1.905h1.93l4.5 4.5c.945.945 2.561.276 2.561-1.06V4.06Z"}),ve.jsx("path",{d:"M18.584 5.106a.75.75 0 0 1 1.06 0 11.5 11.5 0 0 1 0 13.588.75.75 0 0 1-1.06-1.06 10 10 0 0 0 0-11.468.75.75 0 0 1 0-1.06Z"}),ve.jsx("path",{d:"M15.932 7.757a.75.75 0 0 1 1.061 0 6.5 6.5 0 0 1 0 8.486.75.75 0 0 1-1.06-1.06 5 5 0 0 0 0-6.366.75.75 0 0 1 0-1.06Z"})]})}),ve.jsx("div",{onMouseEnter:()=>i(!0),onMouseLeave:()=>{o||i(!1)},style:{position:"absolute",left:"40px",top:"0",width:r||o?"118px":"0px",height:"40px",opacity:r||o?1:0,transition:"all 0.25s ease",overflow:"hidden",pointerEvents:r||o?"auto":"none",zIndex:10,paddingLeft:"8px",background:"rgba(10, 10, 20, 0.88)",backdropFilter:"blur(12px)",borderRadius:"0 8px 8px 0",border:"1px solid rgba(255,255,255,0.1)",borderLeft:"none",boxShadow:"4px 0 16px rgba(0,0,0,0.5)"},children:ve.jsx("div",{ref:d,role:"slider",tabIndex:0,"aria-label":"Volume","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(f*100),"aria-valuetext":u?"Muted":`${Math.round(f*100)}%`,onMouseDown:g,onKeyDown:h=>{switch(h.key){case"ArrowRight":case"ArrowUp":h.preventDefault(),n(Math.min(1,(u?0:e)+.05));break;case"ArrowLeft":case"ArrowDown":h.preventDefault(),n(Math.max(0,(u?0:e)-.05));break;case"PageUp":h.preventDefault(),n(Math.min(1,(u?0:e)+.2));break;case"PageDown":h.preventDefault(),n(Math.max(0,(u?0:e)-.2));break;case"Home":h.preventDefault(),n(0);break;case"End":h.preventDefault(),n(1);break;case"m":case"M":h.preventDefault(),t();break}},style:{width:"110px",height:"40px",display:"flex",alignItems:"center",cursor:"pointer",position:"relative",paddingRight:"8px",outline:"none"},children:ve.jsxs("div",{style:{width:"100%",height:"4px",backgroundColor:"rgba(255, 255, 255, 0.3)",borderRadius:"2px",position:"relative"},children:[ve.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:`${f*100}%`,backgroundColor:"#3b82f6",borderRadius:"2px",transition:o?"none":"width 0.1s ease"}}),ve.jsx("div",{style:{position:"absolute",left:`calc(${f*100}% - ${f*6}px)`,top:"50%",transform:"translateY(-50%)",width:o?"14px":"12px",height:o?"14px":"12px",backgroundColor:"#fff",borderRadius:"50%",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.3)",transition:o?"none":"all 0.2s ease"}})]})})})]})}const j_=[.25,.5,.75,1,1.25,1.5,1.75,2];function q_(){const{setPlaybackRate:u}=kr(),[e,t]=At.useState(1),n=At.useCallback(i=>{u(i),t(i)},[u]),r=e===1?"1Γ":`${e}Γ`;return ve.jsxs(Im,{children:[ve.jsx(xm,{children:ve.jsx("button",{className:"virtus-speed-button","aria-label":`Playback speed: ${r}`,"aria-haspopup":"true",style:{background:"transparent",border:"none",color:"white",cursor:"pointer",padding:"8px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",height:"40px",minWidth:"40px",transition:"all 0.2s ease",fontSize:"13px",fontWeight:"600",letterSpacing:"-0.3px",whiteSpace:"nowrap"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(255, 255, 255, 0.15)",i.currentTarget.style.transform="scale(1.05)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent",i.currentTarget.style.transform="scale(1)"},title:"Playback speed",children:r})}),ve.jsx(wm,{placement:"top-right",children:ve.jsxs("div",{style:{minWidth:"130px"},children:[ve.jsx("div",{style:{padding:"8px 12px",fontSize:"12px",fontWeight:"600",color:"rgba(255, 255, 255, 0.6)",borderBottom:"1px solid rgba(255, 255, 255, 0.1)",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Speed"}),[...j_].reverse().map(i=>ve.jsx(Hl,{selected:e===i,onClick:()=>n(i),children:ve.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:ve.jsx("span",{children:i===1?"1Γ (Normal)":`${i}Γ`})})},i))]})})]})}const G_=[.25,.5,.75,1,1.25,1.5,1.75,2],$_={position:"absolute",bottom:"52px",right:0,width:"320px",background:"rgba(12, 12, 20, 0.97)",backdropFilter:"blur(16px)",borderRadius:"14px",boxShadow:"0 12px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.1)",overflow:"hidden",zIndex:9999,animation:"settingsFadeIn 0.18s ease-out",fontFamily:"system-ui, -apple-system, sans-serif"},aa={display:"flex",alignItems:"center",gap:"8px",padding:"11px 14px",borderBottom:"1px solid rgba(255,255,255,0.08)",color:"#fff",fontSize:"13px",fontWeight:600},V_={display:"flex",alignItems:"center",width:"100%",padding:"9px 14px",background:"transparent",border:"none",cursor:"pointer",color:"#fff",fontSize:"13.5px",textAlign:"left",gap:"10px",outline:"none",transition:"background 0.12s"};function Sr({label:u,value:e,icon:t,onClick:n,selected:r=!1,isBack:i=!1}){const[o,l]=At.useState(!1);return ve.jsxs("button",{role:"menuitem","aria-checked":r,onClick:n,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{...V_,background:o?"rgba(255,255,255,0.07)":r?"rgba(99,102,241,0.15)":"transparent",fontWeight:r?600:400,justifyContent:"space-between"},children:[ve.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[i?ve.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.6)",strokeWidth:"2.5",style:{flexShrink:0},children:ve.jsx("polyline",{points:"15 18 9 12 15 6"})}):t?ve.jsx("span",{style:{width:"28px",height:"28px",borderRadius:"7px",background:r?"rgba(99,102,241,0.3)":"rgba(255,255,255,0.08)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:r?"#818cf8":"rgba(255,255,255,0.65)",transition:"background 0.15s, color 0.15s"},children:t}):r?ve.jsx("svg",{"aria-hidden":"true",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#6366f1",strokeWidth:"3",style:{flexShrink:0},children:ve.jsx("polyline",{points:"20 6 9 17 4 12"})}):ve.jsx("span",{style:{display:"inline-block",width:"14px",flexShrink:0}}),ve.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u})]}),e!==void 0&&ve.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[ve.jsx("span",{style:{fontSize:"12px",color:"rgba(255,255,255,0.45)",maxWidth:"90px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),ve.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.35)",strokeWidth:"2.5",children:ve.jsx("polyline",{points:"9 18 15 12 9 6"})})]})]})}function Th(){return ve.jsx("div",{style:{height:"1px",background:"rgba(255,255,255,0.07)",margin:"2px 0"}})}function H_(){const{setQuality:u,setAudioTrack:e,setPlaybackRate:t,setSubtitleTrack:n,getPlayerStats:r}=kr(),i=yu(),{playbackRate:o=1,isLive:l}=Fr(),{style:d,setStyle:c}=_m(),[g,f]=At.useState(!1),[h,y]=At.useState("root");At.useEffect(()=>{l&&h==="speed"&&y("root")},[l,h]);const[E,_]=At.useState([]),[L,K]=At.useState(null),[Z,ae]=At.useState([]),[pe,xe]=At.useState(""),[ke,Y]=At.useState([]),[J,he]=At.useState(null),[Ee,Le]=At.useState(null);At.useEffect(()=>{const F=()=>{_(i.getAvailableQualities()),K(i.getQuality()),ae(i.getAvailableAudioTracks()),xe(i.getAudioTrack()),Y(i.getSubtitleTracks()),he(i.getActiveSubtitleLanguage())};i.events.on("tracksready",F),i.events.on("streamTypeDetected",F),i.events.on("qualitychange",F),i.events.on("loadedmetadata",F),F();const Me=setTimeout(F,100);return()=>{i.events.off("tracksready",F),i.events.off("streamTypeDetected",F),i.events.off("qualitychange",F),i.events.off("loadedmetadata",F),clearTimeout(Me)}},[i]),At.useEffect(()=>{g&&(_(i.getAvailableQualities()),K(i.getQuality()),ae(i.getAvailableAudioTracks()),xe(i.getAudioTrack()),Y(i.getSubtitleTracks()),he(i.getActiveSubtitleLanguage()))},[g,i]);const et=Z.length>1;At.useEffect(()=>{if(h!=="statistics")return;const F=()=>Le(r());F();const Me=setInterval(F,1e3);return()=>clearInterval(Me)},[h,r]);const Ae=At.useRef(null);At.useEffect(()=>{if(!g)return;const F=Me=>{Ae.current&&!Ae.current.contains(Me.target)&&(f(!1),y("root"))};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[g]),At.useEffect(()=>{if(!g)return;const F=Me=>{Me.key==="Escape"&&(f(!1),y("root")),Me.key==="Backspace"&&h!=="root"&&y("root")};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[g,h]);const Ze=At.useCallback(()=>{f(F=>(F&&y("root"),!F))},[]),Be=L?L.id==="auto"?"Auto":L.label:"Auto",Ne=o===1?"1Γ":`${o}Γ`,tt=Z.find(F=>F.id===pe)?.label??"Auto",mt=J===null?"Off":ke.find(F=>F.language===J)?.label??J,Ge=ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),ve.jsx("path",{d:"M8 21h8M12 17v4"}),ve.jsx("path",{d:"m7 8 2 2 4-4 2 2"})]}),ut=ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0 1 1 0 0 0-2 0"}),ve.jsx("path",{d:"M12 2a10 10 0 0 1 7.39 16.74M12 2A10 10 0 0 0 4.61 18.74"}),ve.jsx("path",{d:"m16.24 7.76-2.12 2.12"})]}),Xe=ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("path",{d:"M3 18v-6a9 9 0 0 1 18 0v6"}),ve.jsx("path",{d:"M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"})]}),nt=ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),ve.jsx("line",{x1:"9",y1:"10",x2:"15",y2:"10"}),ve.jsx("line",{x1:"9",y1:"14",x2:"12",y2:"14"})]}),Ft=ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("circle",{cx:"12",cy:"12",r:"3"}),ve.jsx("path",{d:"M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"}),ve.jsx("polyline",{points:"16 16 12 20 8 16"})]}),Xt=ve.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),ve.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),ve.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]}),Pe=()=>ve.jsxs(ve.Fragment,{children:[ve.jsxs("div",{style:aa,children:[ve.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"rgba(255,255,255,0.6)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[ve.jsx("circle",{cx:"12",cy:"12",r:"3"}),ve.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),"Settings"]}),ve.jsxs("div",{style:{padding:"4px 0"},children:[ve.jsx(Sr,{icon:Ge,label:"Quality",value:Be,onClick:()=>y("quality")}),!l&&ve.jsx(Sr,{icon:ut,label:"Speed",value:Ne,onClick:()=>y("speed")}),et&&ve.jsx(Sr,{icon:Xe,label:"Audio Track",value:tt,onClick:()=>y("audio")}),ve.jsx(Th,{}),ve.jsx(Sr,{icon:nt,label:"Subtitles",value:mt,onClick:()=>y("subtitles")}),ve.jsx(Sr,{icon:Ft,label:"Subtitle Style",value:`${d.fontSize}px`,onClick:()=>y("subtitleStyle")}),ve.jsx(Th,{}),ve.jsx(Sr,{icon:Xt,label:"Statistics",onClick:()=>y("statistics")})]})]}),De=()=>ve.jsxs(ve.Fragment,{children:[ve.jsx("div",{style:aa,children:ve.jsx(Sr,{label:"Quality",isBack:!0,onClick:()=>y("root")})}),ve.jsxs("div",{style:{padding:"4px 0",maxHeight:"280px",overflowY:"auto"},children:[E.map(F=>ve.jsx(Sr,{label:F.id==="auto"?"Auto":F.label,selected:L?.id===F.id,onClick:()=>{u(F.id),K(F),f(!1),y("root")}},F.id)),E.length===0&&ve.jsx("div",{style:{padding:"10px 14px",color:"rgba(255,255,255,0.4)",fontSize:"13px"},children:"No quality levels available"})]})]}),dt=()=>ve.jsxs(ve.Fragment,{children:[ve.jsx("div",{style:aa,children:ve.jsx(Sr,{label:"Speed",isBack:!0,onClick:()=>y("root")})}),ve.jsx("div",{style:{padding:"4px 0"},children:G_.map(F=>ve.jsx(Sr,{label:F===1?"1Γ (Normal)":`${F}Γ`,selected:o===F,onClick:()=>{t(F),f(!1),y("root")}},F))})]}),Q=()=>ve.jsxs(ve.Fragment,{children:[ve.jsx("div",{style:aa,children:ve.jsx(Sr,{label:"Audio Track",isBack:!0,onClick:()=>y("root")})}),ve.jsx("div",{style:{padding:"4px 0"},children:Z.map(F=>ve.jsx(Sr,{label:F.label||F.language||F.id,selected:pe===F.id,onClick:()=>{e(F.id),xe(F.id),f(!1),y("root")}},F.id))})]}),H=()=>ve.jsxs(ve.Fragment,{children:[ve.jsx("div",{style:aa,children:ve.jsx(Sr,{label:"Subtitles",isBack:!0,onClick:()=>y("root")})}),ve.jsxs("div",{style:{padding:"4px 0"},children:[ve.jsx(Sr,{label:"Off",selected:J===null,onClick:()=>{n(null),he(null),f(!1),y("root")}},"off"),ke.map(F=>ve.jsx(Sr,{label:F.label||F.language,selected:J===F.language,onClick:()=>{n(F.language),he(F.language),f(!1),y("root")}},F.language)),ke.length===0&&ve.jsx("div",{style:{padding:"10px 14px",color:"rgba(255,255,255,0.4)",fontSize:"13px"},children:"No subtitle tracks available"})]})]}),w=()=>ve.jsxs(ve.Fragment,{children:[ve.jsx("div",{style:aa,children:ve.jsx(Sr,{label:"Subtitle Style",isBack:!0,onClick:()=>y("root")})}),ve.jsxs("div",{style:{padding:"8px 14px 12px",display:"flex",flexDirection:"column",gap:"14px"},children:[ve.jsxs("div",{children:[ve.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[ve.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Position"}),ve.jsxs("span",{style:{fontSize:"12px",color:"rgba(255,255,255,0.5)"},children:[d.bottomOffset,"px from bottom"]})]}),ve.jsx("input",{type:"range",min:10,max:200,step:5,value:d.bottomOffset,onChange:F=>c({bottomOffset:Number(F.target.value)}),style:{width:"100%",accentColor:"#3b82f6",cursor:"pointer"}})]}),ve.jsxs("div",{children:[ve.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[ve.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Font Size"}),ve.jsxs("span",{style:{fontSize:"12px",color:"rgba(255,255,255,0.5)"},children:[d.fontSize,"px"]})]}),ve.jsx("input",{type:"range",min:12,max:40,step:1,value:d.fontSize,onChange:F=>c({fontSize:Number(F.target.value)}),style:{width:"100%",accentColor:"#3b82f6",cursor:"pointer"}})]}),ve.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ve.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Background"}),ve.jsx("button",{onClick:()=>c({background:d.background?"":"rgba(0,0,0,0.75)"}),style:{padding:"4px 12px",borderRadius:"6px",border:"1px solid rgba(255,255,255,0.2)",background:d.background?"#3b82f6":"transparent",color:"#fff",fontSize:"12px",cursor:"pointer"},children:d.background?"On":"Off"})]}),ve.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[ve.jsx("span",{style:{fontSize:"13px",color:"rgba(255,255,255,0.8)"},children:"Text Color"}),ve.jsx("div",{style:{display:"flex",gap:"6px"},children:["#ffffff","#ffff00","#00ff00","#00cfff"].map(F=>ve.jsx("button",{onClick:()=>c({color:F}),title:F,style:{width:"22px",height:"22px",borderRadius:"50%",background:F,border:d.color===F?"2px solid #3b82f6":"2px solid transparent",cursor:"pointer",outline:"none",padding:0,flexShrink:0}},F))})]})]})]}),D=()=>{const F=(Me,We)=>ve.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",padding:"6px 14px",gap:"8px"},children:[ve.jsx("span",{style:{fontSize:"12px",color:"rgba(255,255,255,0.5)",flexShrink:0},children:Me}),ve.jsx("span",{style:{fontSize:"12px",color:"#fff",textAlign:"right",fontFamily:"monospace",wordBreak:"break-all",maxWidth:"160px"},children:We})]},Me);return ve.jsxs(ve.Fragment,{children:[ve.jsx("div",{style:aa,children:ve.jsx(Sr,{label:"Statistics",isBack:!0,onClick:()=>y("root")})}),ve.jsx("div",{style:{padding:"4px 0 8px"},children:Ee?ve.jsxs(ve.Fragment,{children:[F("Bandwidth",`${Ee.bandwidth.toLocaleString()} kbps`),F("Buffer Health",`${Ee.bufferHealth} s`),F("Dropped Frames",`${Ee.droppedFrames} / ${Ee.totalFrames}`),F("Codec",Ee.codec||"β"),F("Resolution",Ee.resolution||"β"),F("Stream Type",Ee.streamType||"β"),F("Segment URL",Ee.segmentUrl?Ee.segmentUrl.length>40?"β¦"+Ee.segmentUrl.slice(-40):Ee.segmentUrl:"β")]}):ve.jsx("div",{style:{padding:"10px 14px",color:"rgba(255,255,255,0.4)",fontSize:"13px"},children:"Loadingβ¦"})})]})},oe=()=>{switch(h){case"quality":return De();case"speed":return dt();case"audio":return Q();case"subtitles":return H();case"subtitleStyle":return w();case"statistics":return D();default:return Pe()}};return ve.jsxs("div",{ref:Ae,style:{position:"relative",display:"inline-block"},children:[ve.jsx("button",{className:"virtus-settings-btn","aria-label":"Settings","aria-haspopup":"menu","aria-expanded":g,onClick:Ze,style:{background:g?"rgba(255,255,255,0.18)":"transparent",border:"none",color:"white",cursor:"pointer",padding:"8px",borderRadius:"8px",display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"40px",transition:"all 0.2s ease"},onMouseEnter:F=>{F.currentTarget.style.background="rgba(255,255,255,0.15)",F.currentTarget.style.transform="scale(1.05)"},onMouseLeave:F=>{F.currentTarget.style.background=g?"rgba(255,255,255,0.18)":"transparent",F.currentTarget.style.transform="scale(1)"},title:"Settings",children:ve.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transition:"transform 0.3s ease",transform:g?"rotate(45deg)":"rotate(0deg)"},children:[ve.jsx("circle",{cx:"12",cy:"12",r:"3"}),ve.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),g&&ve.jsx("div",{role:"menu","aria-label":"Settings menu",style:$_,children:oe()}),ve.jsx("style",{children:`
|
|
244
|
+
@keyframes settingsFadeIn {
|
|
245
|
+
from { opacity: 0; transform: translateY(8px) scale(0.97); }
|
|
246
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
247
|
+
}
|
|
248
|
+
`})]})}class K_{playerCore=null;videoElement=null;container=null;constructor(e){e instanceof HTMLVideoElement?this.initWithElement(e):this.initWithConfig(e)}initWithElement(e){this.videoElement=e,this.playerCore=new Pa(e)}initWithConfig(e){this.playerCore=Pa.createWithConfig(e),this.videoElement=this.playerCore.getVideoElement(),this.container=this.playerCore.getVideoElement()?.parentElement||null}on(e,t){oa.on(e,t)}off(e,t){oa.off(e,t)}play(){return this.playerCore?.play()||Promise.reject("Player not initialized")}pause(){this.playerCore?.pause()}toggleMute(){this.playerCore?.toggleMute()}setVolume(e){this.playerCore?.setVolume(e)}getState(){return this.playerCore?.getState()||null}async setSource(e){await this.playerCore?.setSource(e)}seekTo(e){this.playerCore?.seekTo(e)}setPlaybackRate(e){this.playerCore?.setPlaybackRate(e)}setPoster(e){this.playerCore?.setPoster(e)}setDimensions(e,t){this.playerCore?.setDimensions(e,t)}destroy(){this.playerCore?.destroy(),this.videoElement&&this.container&&this.videoElement.parentNode===this.container&&this.container.removeChild(this.videoElement),this.playerCore=null,this.videoElement=null,this.container=null}}exports.ContextMenu=ym;exports.ControlBar=p_;exports.ControlsVisibilityContext=yo;exports.EndCard=Em;exports.EventBus=vh;exports.FullscreenButton=S_;exports.GestureHintOverlay=bm;exports.JumpToLiveButton=Rm;exports.KeyboardShortcutsOverlay=pm;exports.LiveLatencyDisplay=km;exports.MediaErrorCode=Ka;exports.MuteButton=v_;exports.PipButton=__;exports.PlayButton=b_;exports.PlaybackSpeedSelector=q_;exports.Player=Am;exports.PlayerCore=Pa;exports.PlayerProvider=gm;exports.Playron=K_;exports.PlayronEventEmitter=Sh;exports.SeekBar=F_;exports.SettingsButton=x_;exports.SettingsPanel=H_;exports.SkipBackwardButton=U_;exports.SkipForwardButton=z_;exports.SkipIntroButton=N_;exports.StallDetector=um;exports.StreamDetector=_h;exports.TheaterModeButton=A_;exports.ThumbnailManager=Cm;exports.TimeDisplay=L_;exports.VideoEventType=zn;exports.VolumeControl=B_;exports.default=Am;exports.eventBus=oa;exports.isVideoEventType=hE;exports.streamDetector=Ah;exports.useMobileGestures=Tm;exports.usePlayer=yu;exports.usePlayerMethods=kr;exports.usePlayerState=Fr;
|