@apollosproject/canvas-embeds 2.1.3049 → 2.1.3050-staging.44931104445.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/widget/index.js +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apollosproject/canvas-embeds",
3
3
  "description": "Apollos React embed widgets",
4
- "version": "2.1.3049",
4
+ "version": "2.1.3050-staging.44931104445.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/widget/index.js CHANGED
@@ -428,7 +428,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
428
428
  `),l=[],u=t?aNr(t.baseTime,t.timescale):0,d=`00:00.000`,f=0,p=0,m,h=!0;s.oncue=function(e){let a=n[r],o=n.ccOffset,s=(f-u)/9e4;if(a!=null&&a.new&&(p===void 0?CPr(n,r,s):o=n.ccOffset=a.start),s){if(!t){m=Error(`Missing initPTS for VTT MPEGTS`);return}o=s-n.presentationOffset}let c=e.endTime-e.startTime,d=K5((e.startTime+o-p)*9e4,i*9e4)/9e4;e.startTime=Math.max(d,0),e.endTime=Math.max(d+c,0);let h=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(h)),e.id||=SPr(e.startTime,e.endTime,h),e.endTime>0&&l.push(e)},s.onparsingerror=function(e){m=e},s.onflush=function(){m?o(m):a(l)},c.forEach(e=>{if(h){if(yPr(e,`X-TIMESTAMP-MAP=`)){h=!1,e.slice(16).split(`,`).forEach(e=>{yPr(e,`LOCAL:`)?d=e.slice(6):yPr(e,`MPEGTS:`)&&(f=parseInt(e.slice(7)))});try{p=bPr(d)/1e3}catch(e){m=e}return}e===``&&(h=!1)}s.parse(e+`
429
429
  `)}),s.flush()}var TPr=`stpp.ttml.im1t`,EPr=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,DPr=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,OPr={left:`start`,center:`center`,right:`end`,start:`start`,end:`end`};function kPr(e,t,n,r){let i=g5(new Uint8Array(e),[`mdat`]);if(i.length===0){r(Error(`Could not parse IMSC1 mdat`));return}let a=i.map(e=>f5(e)),o=iNr(t.baseTime,1,t.timescale);try{a.forEach(e=>n(APr(e,o)))}catch(e){r(e)}}function APr(e,t){let n=new DOMParser().parseFromString(e,`text/xml`).getElementsByTagName(`tt`)[0];if(!n)throw Error(`Invalid ttml`);let r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(r).reduce((e,t)=>(e[t]=n.getAttribute(`ttp:${t}`)||r[t],e),{}),a=n.getAttribute(`xml:space`)!==`preserve`,o=MPr(jPr(n,`styling`,`style`)),s=MPr(jPr(n,`layout`,`region`)),c=jPr(n,`body`,`[begin]`);return[].map.call(c,e=>{let n=NPr(e,a);if(!n||!e.hasAttribute(`begin`))return null;let r=LPr(e.getAttribute(`begin`),i),c=LPr(e.getAttribute(`dur`),i),l=LPr(e.getAttribute(`end`),i);if(r===null)throw IPr(e);if(l===null){if(c===null)throw IPr(e);l=r+c}let u=new cPr(r-t,l-t,n);u.id=SPr(u.startTime,u.endTime,u.text);let d=s[e.getAttribute(`region`)],f=o[e.getAttribute(`style`)],p=PPr(d,f,o),{textAlign:m}=p;if(m){let e=OPr[m];e&&(u.lineAlign=e),u.align=m}return e5(u,p),u}).filter(e=>e!==null)}function jPr(e,t,n){let r=e.getElementsByTagName(t)[0];return r?[].slice.call(r.querySelectorAll(n)):[]}function MPr(e){return e.reduce((e,t)=>{let n=t.getAttribute(`xml:id`);return n&&(e[n]=t),e},{})}function NPr(e,t){return[].slice.call(e.childNodes).reduce((e,n,r)=>{var i;return n.nodeName===`br`&&r?e+`
430
430
  `:(i=n.childNodes)!=null&&i.length?NPr(n,t):t?e+n.textContent.trim().replace(/\s+/g,` `):e+n.textContent},``)}function PPr(e,t,n){let r=`http://www.w3.org/ns/ttml#styling`,i=null,a=[`displayAlign`,`textAlign`,`color`,`backgroundColor`,`fontSize`,`fontFamily`],o=e!=null&&e.hasAttribute(`style`)?e.getAttribute(`style`):null;return o&&n.hasOwnProperty(o)&&(i=n[o]),a.reduce((n,a)=>{let o=FPr(t,r,a)||FPr(e,r,a)||FPr(i,r,a);return o&&(n[a]=o),n},{})}function FPr(e,t,n){return e&&e.hasAttributeNS(t,n)?e.getAttributeNS(t,n):null}function IPr(e){return Error(`Could not parse ttml timestamp ${e}`)}function LPr(e,t){if(!e)return null;let n=uPr(e);return n===null&&(EPr.test(e)?n=RPr(e,t):DPr.test(e)&&(n=zPr(e,t))),n}function RPr(e,t){let n=EPr.exec(e),r=(n[4]|0)+(n[5]|0)/t.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+r/t.frameRate}function zPr(e,t){let n=DPr.exec(e),r=Number(n[1]);switch(n[2]){case`h`:return r*3600;case`m`:return r*60;case`ms`:return r*1e3;case`f`:return r/t.frameRate;case`t`:return r/t.tickRate}return r}var BPr=class{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=WPr(),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(X.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(X.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(X.MANIFEST_LOADING,this.onManifestLoading,this),e.on(X.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(X.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(X.FRAG_LOADING,this.onFragLoading,this),e.on(X.FRAG_LOADED,this.onFragLoaded,this),e.on(X.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(X.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(X.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(X.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(X.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){let{hls:e}=this;e.off(X.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(X.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(X.MANIFEST_LOADING,this.onManifestLoading,this),e.off(X.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(X.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(X.FRAG_LOADING,this.onFragLoading,this),e.off(X.FRAG_LOADED,this.onFragLoaded,this),e.off(X.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(X.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(X.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(X.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(X.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){let e=new sPr(this,`textTrack1`),t=new sPr(this,`textTrack2`),n=new sPr(this,`textTrack3`),r=new sPr(this,`textTrack4`);this.cea608Parser1=new rPr(1,e,t),this.cea608Parser2=new rPr(3,n,r)}}addCues(e,t,n,r,i){let a=!1;for(let e=i.length;e--;){let r=i[e],o=UPr(r[0],r[1],t,n);if(o>=0&&(r[0]=Math.min(r[0],t),r[1]=Math.max(r[1],n),a=!0,o/(n-t)>.5))return}if(a||i.push([t,n]),this.config.renderTextTracksNatively){let i=this.captionsTracks[e];this.Cues.newCue(i,t,n,r)}else{let i=this.Cues.newCue(null,t,n,r);this.hls.trigger(X.CUES_PARSED,{type:`captions`,cues:i,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:r,timescale:i}){let{unparsedVttFrags:a}=this;n===`main`&&(this.initPTS[t.cc]={baseTime:r,timescale:i}),a.length&&(this.unparsedVttFrags=[],a.forEach(e=>{this.onFragLoaded(X.FRAG_LOADED,e)}))}getExistingTrack(e,t){let{media:n}=this;if(n)for(let r=0;r<n.textTracks.length;r++){let i=n.textTracks[r];if(HPr(i,{name:e,lang:t,attrs:{}}))return i}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;let{captionsProperties:t,captionsTracks:n,media:r}=this,{label:i,languageCode:a}=t[e],o=this.getExistingTrack(i,a);if(o)n[e]=o,T5(n[e]),TAr(n[e],r);else{let t=this.createTextTrack(`captions`,i,a);t&&(t[e]=!0,n[e]=t)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;let t=this.captionsProperties[e];if(!t)return;let n={_id:e,label:t.label,kind:`captions`,default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(X.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,n){let r=this.media;if(r)return r.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){let{captionsTracks:e}=this;Object.keys(e).forEach(t=>{T5(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=WPr(),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(){let{media:e}=this;if(!e)return;let t=e.textTracks;if(t)for(let e=0;e<t.length;e++)T5(t[e])}onSubtitleTracksUpdated(e,t){let n=t.subtitleTracks||[],r=n.some(e=>e.textCodec===TPr);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(ANr(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){let e=this.media,t=e?AAr(e.textTracks):null;if(this.tracks.forEach((e,n)=>{let r;if(t){let n=null;for(let r=0;r<t.length;r++)if(t[r]&&HPr(t[r],e)){n=t[r],t[r]=null;break}n&&(r=n)}if(r)T5(r);else{let t=VPr(e);r=this.createTextTrack(t,e.name,e.lang),r&&(r.mode=`disabled`)}r&&this.textTracks.push(r)}),t!=null&&t.length){let e=t.filter(e=>e!==null).map(e=>e.label);e.length&&Q.warn(`Media element contains unused subtitle tracks: ${e.join(`, `)}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){let e=this.tracks.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(X.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{let t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;let n=`textTrack${t[1]}`,r=this.captionsProperties[n];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.media=e)})}closedCaptionsForLevel(e){return this.hls.levels[e.level]?.attrs[`CLOSED-CAPTIONS`]}onFragLoading(e,t){if(this.enabled&&t.frag.type===w5.MAIN){let{cea608Parser1:e,cea608Parser2:n,lastSn:r}=this,{cc:i,sn:a}=t.frag,o=t.part?.index??-1;e&&n&&(a!==r+1||a===r&&o!==this.lastPartIndex+1||i!==this.lastCc)&&(e.reset(),n.reset()),this.lastCc=i,this.lastSn=a,this.lastPartIndex=o}}onFragLoaded(e,t){let{frag:n,payload:r}=t;if(n.type===w5.SUBTITLE){if(r.byteLength){let e=n.decryptdata,i=`stats`in t;if(e==null||!e.encrypted||i){let e=this.tracks[n.level],i=this.vttCCs;i[n.cc]||(i[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),e&&e.textCodec===TPr?this._parseIMSC1(n,r):this._parseVTTs(t)}}else this.hls.trigger(X.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:Error(`Empty subtitle payload`)})}}_parseIMSC1(e,t){let n=this.hls;kPr(t,this.initPTS[e.cc],t=>{this._appendCues(t,e.level),n.trigger(X.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},t=>{Q.log(`Failed to parse IMSC1: ${t}`),n.trigger(X.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})})}_parseVTTs(e){var t;let{frag:n,payload:r}=e,{initPTS:i,unparsedVttFrags:a}=this,o=i.length-1;if(!i[n.cc]&&o===-1){a.push(e);return}let s=this.hls;wPr((t=n.initSegment)!=null&&t.data?v5(n.initSegment.data,new Uint8Array(r)):r,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,e=>{this._appendCues(e,n.level),s.trigger(X.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},t=>{let i=t.message===`Missing initPTS for VTT MPEGTS`;i?a.push(e):this._fallbackToIMSC1(n,r),Q.log(`Failed to parse VTT cue: ${t}`),i&&o>n.cc||s.trigger(X.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:t})})}_fallbackToIMSC1(e,t){let n=this.tracks[e.level];n.textCodec||kPr(t,this.initPTS[e.cc],()=>{n.textCodec=TPr,this._parseIMSC1(e,t)},()=>{n.textCodec=`wvtt`})}_appendCues(e,t){let n=this.hls;if(this.config.renderTextTracksNatively){let n=this.textTracks[t];if(!n||n.mode===`disabled`)return;e.forEach(e=>EAr(n,e))}else{let r=this.tracks[t];if(!r)return;let i=r.default?`default`:`subtitles`+t;n.trigger(X.CUES_PARSED,{type:`subtitles`,cues:e,track:i})}}onFragDecrypted(e,t){let{frag:n}=t;n.type===w5.SUBTITLE&&this.onFragLoaded(X.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();let{cea608Parser1:n,cea608Parser2:r}=this;if(!this.enabled||!n||!r)return;let{frag:i,samples:a}=t;if(i.type!==w5.MAIN||this.closedCaptionsForLevel(i)!==`NONE`)for(let e=0;e<a.length;e++){let t=a[e].bytes;if(t){let i=this.extractCea608Data(t);n.addData(a[e].pts,i[0]),r.addData(a[e].pts,i[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:r,type:i}){let{media:a}=this;if(!(!a||a.currentTime<n)){if(!i||i===`video`){let{captionsTracks:e}=this;Object.keys(e).forEach(r=>DAr(e[r],t,n))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){let{textTracks:e}=this;Object.keys(e).forEach(n=>DAr(e[n],t,r))}}}extractCea608Data(e){let t=[[],[]],n=e[0]&31,r=2;for(let i=0;i<n;i++){let n=e[r++],i=127&e[r++],a=127&e[r++];if((i!==0||a!==0)&&4&n){let e=3&n;(e===0||e===1)&&(t[e].push(i),t[e].push(a))}}return t}};function VPr(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?`captions`:`subtitles`}function HPr(e,t){return!!e&&e.kind===VPr(t)&&jNr(t,e)}function UPr(e,t,n,r){return Math.min(t,r)-Math.max(e,n)}function WPr(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}var GPr=class e{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=1/0,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(){let{hls:e}=this;e.on(X.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(X.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(X.MANIFEST_PARSED,this.onManifestParsed,this),e.on(X.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(X.BUFFER_CODECS,this.onBufferCodecs,this),e.on(X.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){let{hls:e}=this;e.off(X.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(X.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(X.MANIFEST_PARSED,this.onManifestParsed,this),e.off(X.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(X.BUFFER_CODECS,this.onBufferCodecs,this),e.off(X.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){let 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){let n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&t5(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}let e=this.hls.levels;if(e.length){let t=this.hls,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&Q.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(t){let n=this.hls.levels;if(!n.length)return-1;let r=n.filter((e,n)=>this.isLevelAllowed(e)&&n<=t);return this.clientRect=null,e.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=1/0,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=1/0,this.timer&&=(self.clearInterval(this.timer),void 0)}getDimensions(){if(this.clientRect)return this.clientRect;let e=this.media,t={width:0,height:0};if(e){let 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 e}isLevelAllowed(e){return!this.restrictedLevels.some(t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;let r=(e,t)=>!t||e.width!==t.width||e.height!==t.height,i=e.length-1,a=Math.max(t,n);for(let t=0;t<e.length;t+=1){let n=e[t];if((n.width>=a||n.height>=a)&&r(n,e[t+1])){i=t;break}}return i}},KPr=class{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(X.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(X.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){let n=this.hls.config;if(n.capLevelOnFPSDrop){let e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&typeof e.getVideoPlaybackQuality==`function`&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,n){let r=performance.now();if(t){if(this.lastTime){let e=r-this.lastTime,i=n-this.lastDroppedFrames,a=t-this.lastDecodedFrames,o=1e3*i/e,s=this.hls;if(s.trigger(X.FPS_DROP,{currentDropped:i,currentDecoded:a,totalDroppedFrames:n}),o>0&&i>s.config.fpsDroppedMonitoringThreshold*a){let e=s.currentLevel;Q.warn(`drop FPS ratio greater than max allowed value for currentLevel: `+e),e>0&&(s.autoLevelCapping===-1||s.autoLevelCapping>=e)&&(--e,s.trigger(X.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:s.currentLevel}),s.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=n,this.lastDecodedFrames=t}}checkFPSInterval(){let e=this.media;if(e){if(this.isVideoPlaybackQualityAvailable){let t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}},qPr=`[eme]`,JPr=class e{constructor(t){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=e.CDMCleanupPromise?[e.CDMCleanupPromise]:[],this.debug=Q.debug.bind(Q,qPr),this.log=Q.log.bind(Q,qPr),this.warn=Q.warn.bind(Q,qPr),this.error=Q.error.bind(Q,qPr),this.onMediaEncrypted=e=>{let{initDataType:t,initData:n}=e,r=`"${e.type}" event: init data type: "${t}"`;if(this.debug(r),n!==null){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=KOr(this.config));let t=e.map(GOr).filter(e=>!!e);this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then(i=>{let a=HOr(i),o,s;if(t===`sinf`){if(a!==c5.FAIRPLAY){this.warn(`Ignoring unexpected "${e.type}" event with init data type: "${t}" for selected key-system ${a}`);return}let i=m5(new Uint8Array(n));try{let e=Ekr(LOr(JSON.parse(i).sinf));if(!e)throw Error(`'schm' box missing or not cbcs/cenc with schi > tenc`);o=e.subarray(8,24),s=c5.FAIRPLAY}catch(e){this.warn(`${r} Failed to parse sinf: ${e}`);return}}else{if(a!==c5.WIDEVINE&&a!==c5.PLAYREADY){this.warn(`Ignoring unexpected "${e.type}" event with init data type: "${t}" for selected key-system ${a}`);return}let i=Bkr(n),c=i.filter(e=>!!e.systemId&&WOr(e.systemId)===a);c.length>1&&this.warn(`${r} Using first of ${c.length} pssh found for selected key-system ${a}`);let l=c[0];if(!l){i.length===0||i.some(e=>!e.systemId)?this.warn(`${r} contains incomplete or invalid pssh data`):this.log(`ignoring ${r} for ${i.map(e=>WOr(e.systemId)).join(`,`)} pssh data in favor of playlist keys`);return}if(s=WOr(l.systemId),l.version===0&&l.data){if(s===c5.WIDEVINE){let e=l.data.length-22;o=l.data.subarray(e,e+16)}else s===c5.PLAYREADY&&(o=XOr(l.data))}}if(!s||!o){this.log(`Unable to handle ${r} with key-system ${a}`);return}let c=p5.hexDump(o),{keyIdToKeySessionPromise:l,mediaKeySessions:u}=this,d=l[c];for(let e=0;e<u.length;e++){let r=u[e],i=r.decryptdata;if(!i.keyId)continue;let a=p5.hexDump(i.keyId);if(c===a||i.uri.replace(/-/g,``).indexOf(c)!==-1){if(d=l[a],i.pssh)break;delete l[a],i.pssh=new Uint8Array(n),i.keyId=o,d=l[c]=d.then(()=>this.generateRequestWithPreferredKeySession(r,t,n,`encrypted-event-key-match`)),d.catch(e=>this.handleError(e));break}}if(!d){if(s!==a){this.log(`Ignoring "${r}" with ${s} init data for selected key-system ${a}`);return}d=l[c]=this.getKeySystemSelectionPromise([s]).then(({keySystem:e,mediaKeys:r})=>{this.throwIfDestroyed();let i=new Ukr(`ISO-23001-7`,c,GOr(e)??``);return i.pssh=new Uint8Array(n),i.keyId=o,this.attemptSetMediaKeys(e,r).then(()=>{this.throwIfDestroyed();let a=this.createMediaKeySessionContext({decryptdata:i,keySystem:e,mediaKeys:r});return this.generateRequestWithPreferredKeySession(a,t,n,`encrypted-event-no-match`)})}),d.catch(e=>this.handleError(e))}})}},this.onWaitingForKey=e=>{this.log(`"${e.type}" event`)},this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();let 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(X.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(X.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(X.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(X.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(X.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(X.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(X.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(X.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){let{drmSystems:t,widevineLicenseUrl:n}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===c5.WIDEVINE&&n)return n}getLicenseServerUrlOrThrow(e){let t=this.getLicenseServerUrl(e);if(t===void 0)throw Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){let{drmSystems:t}=this.config,n=t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){let t=this.hls.levels,n=(e,t,n)=>!!e&&n.indexOf(e)===t,r=t.map(e=>e.audioCodec).filter(n),i=t.map(e=>e.videoCodec).filter(n);return r.length+i.length===0&&i.push(`avc1.42e01e`),new Promise((t,n)=>{let a=e=>{let o=e.shift();this.getMediaKeysPromise(o,r,i).then(e=>t({keySystem:o,mediaKeys:e})).catch(t=>{e.length?a(e):t instanceof Q5?n(t):n(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})};a(e)})}requestMediaKeySystemAccess(e,t){let{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!=`function`){let e=`Configured requestMediaKeySystemAccess is not a function ${n}`;return qOr===null&&self.location.protocol===`http:`&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(Error(e))}return n(e,t)}getMediaKeysPromise(e,t,n){let r=JOr(e,t,n,this.config.drmSystemOptions),i=this.keySystemAccessPromises[e],a=i?.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(r)}`),a=this.requestMediaKeySystemAccess(e,r);let t=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)}),a.then(n=>{this.log(`Access for key-system "${n.keySystem}" obtained`);let r=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),t.mediaKeys=n.createMediaKeys().then(t=>(this.log(`Media-keys created for "${e}"`),r.then(n=>n?this.setMediaKeysServerCertificate(t,e,n):t))),t.mediaKeys.catch(t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)}),t.mediaKeys})}return a.then(()=>i.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${p5.hexDump(e.keyId||[])}`);let r={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:n.createSession(),keyStatus:`status-pending`};return this.mediaKeySessions.push(r),r}renewKeySession(e){let t=e.decryptdata;if(t.pssh){let n=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t);this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(n,`cenc`,t.pssh,`expired`)}else this.warn(`Could not renew expired session. Missing pssh initData.`);this.removeSession(e)}getKeyIdString(e){if(!e)throw Error(`Could not read keyId of undefined decryptdata`);if(e.keyId===null)throw Error(`keyId is null`);return p5.hexDump(e.keyId)}updateKeySession(e,t){let n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${p5.hexDump(e.decryptdata?.keyId||[])}
431
- } (data length: ${t&&t.byteLength})`),n.update(t)}selectKeySystemFormat(e){let 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.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,n)=>{let r=KOr(this.config),i=e.map(HOr).filter(e=>!!e&&r.indexOf(e)!==-1);return this.getKeySystemSelectionPromise(i).then(({keySystem:e})=>{let r=GOr(e);r?t(r):n(Error(`Unable to find format for key-system "${e}"`))}).catch(n)})}loadKey(e){let t=e.keyInfo.decryptdata,n=this.getKeyIdString(t),r=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let i=this.keyIdToKeySessionPromise[n];return i||(i=this.keyIdToKeySessionPromise[n]=this.getKeySystemForKeyPromise(t).then(({keySystem:n,mediaKeys:i})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(n,i).then(()=>{this.throwIfDestroyed();let e=this.createMediaKeySessionContext({keySystem:n,mediaKeys:i,decryptdata:t});return this.generateRequestWithPreferredKeySession(e,`cenc`,t.pssh,`playlist-key`)}))),i.catch(e=>this.handleError(e))),i}throwIfDestroyed(e=`Invalid state`){if(!this.hls)throw Error(`invalid state`)}handleError(e){this.hls&&(this.error(e.message),e instanceof Q5?this.hls.trigger(X.ERROR,e.data):this.hls.trigger(X.ERROR,{type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){let t=this.getKeyIdString(e),n=this.keyIdToKeySessionPromise[t];if(!n){let t=HOr(e.keyFormat),n=t?[t]:KOr(this.config);return this.attemptKeySystemAccess(n)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=KOr(this.config)),e.length===0)throw new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){let n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);let r=Promise.all(n).then(()=>{if(!this.media)throw Error(`Attempted to set mediaKeys without media element attached`);return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>n.indexOf(e)===-1)})}generateRequestWithPreferredKeySession(e,t,n,r){let i=this.config.drmSystems?.[e.keySystem]?.generateRequest;if(i)try{let r=i.call(this.hls,t,n,e);if(!r)throw Error(`Invalid response from configured generateRequest filter`);t=r.initDataType,n=e.decryptdata.pssh=r.initData?new Uint8Array(r.initData):null}catch(e){var a;if(this.warn(e.message),(a=this.hls)!=null&&a.config.debug)throw e}if(n===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);let o=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${o} (init data type: ${t} length: ${n?n.byteLength:null})`);let s=new ONr,c=e._onmessage=t=>{let n=e.mediaKeysSession;if(!n){s.emit(`error`,Error(`invalid state`));return}let{messageType:r,message:i}=t;this.log(`"${r}" message event for session "${n.sessionId}" message size: ${i.byteLength}`),r===`license-request`||r===`license-renewal`?this.renewLicense(e,i).catch(e=>{this.handleError(e),s.emit(`error`,e)}):r===`license-release`?e.keySystem===c5.FAIRPLAY&&(this.updateKeySession(e,VOr(`acknowledged`)),this.removeSession(e)):this.warn(`unhandled media key message type "${r}"`)},l=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession){s.emit(`error`,Error(`invalid state`));return}this.onKeyStatusChange(e);let n=e.keyStatus;s.emit(`keyStatus`,n),n===`expired`&&(this.warn(`${e.keySystem} expired for key ${o}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener(`message`,c),e.mediaKeysSession.addEventListener(`keystatuseschange`,l);let u=new Promise((e,t)=>{s.on(`error`,t),s.on(`keyStatus`,n=>{n.startsWith(`usable`)?e():n===`output-restricted`?t(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},`HDCP level output restricted`)):n===`internal-error`?t(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${n}"`)):n===`expired`?t(Error(`key expired while generating request`)):this.warn(`unhandled key status change "${n}"`)})});return e.mediaKeysSession.generateRequest(t,n).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession?.sessionId}" keyId: ${o}`)}).catch(e=>{throw new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},`Error generating key-session request: ${e}`)}).then(()=>u).catch(t=>{throw s.removeAllListeners(),this.removeSession(e),t}).then(()=>(s.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,n)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${p5.hexDump(`buffer`in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))} session keyId: ${p5.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){let 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((n,a)=>{let o={responseType:`arraybuffer`,url:i},s=t.certLoadPolicy.default,c={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};r.load(o,c,{onSuccess:(e,t,r,i)=>{n(e.data)},onError:(t,n,r,s)=>{a(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:$8({url:o.url,data:void 0},t)},`"${e}" certificate request failed (${i}). Status: ${t.code} (${t.text})`))},onTimeout:(t,n,r)=>{a(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:o.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(e,t,n)=>{a(Error(`aborted`))}})})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((r,i)=>{e.setServerCertificate(n).then(i=>{this.log(`setServerCertificate ${i?`success`:`not supported by CDM`} (${n?.byteLength}) on "${t}"`),r(e)}).catch(e=>{i(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(t=>this.updateKeySession(e,new Uint8Array(t)).catch(e=>{throw new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))}unpackPlayReadyKeyMessage(e,t){let n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes(`PlayReadyKeyMessage`))return e.setRequestHeader(`Content-Type`,`text/xml; charset=utf-8`),t;let r=new DOMParser().parseFromString(n,`application/xml`),i=r.querySelectorAll(`HttpHeader`);if(i.length>0){let t;for(let n=0,r=i.length;n<r;n++){t=i[n];let r=t.querySelector(`name`)?.textContent,a=t.querySelector(`value`)?.textContent;r&&a&&e.setRequestHeader(r,a)}}let a=r.querySelector(`Challenge`)?.textContent;if(!a)throw Error(`Cannot find <Challenge> in key message`);return VOr(atob(a))}setupLicenseXHR(e,t,n,r){let i=this.config.licenseXhrSetup;return i?Promise.resolve().then(()=>{if(!n.decryptdata)throw Error(`Key removed`);return i.call(this.hls,e,t,n,r)}).catch(a=>{if(!n.decryptdata)throw a;return e.open(`POST`,t,!0),i.call(this.hls,e,t,n,r)}).then(n=>(e.readyState||e.open(`POST`,t,!0),{xhr:e,licenseChallenge:n||r})):(e.open(`POST`,t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){let n=this.config.keyLoadPolicy.default;return new Promise((r,i)=>{let a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);let o=new XMLHttpRequest;o.responseType=`arraybuffer`,o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return i(Error(`invalid state`));if(o.readyState===4){if(o.status===200){this._requestLicenseFailureCount=0;let t=o.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);let n=this.config.licenseResponseCallback;if(n)try{t=n.call(this.hls,o,a,e)}catch(e){this.error(e)}r(t)}else{let s=n.errorRetry,c=s?s.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||o.status>=400&&o.status<500)i(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{let n=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${n} attempts left`),this.requestLicense(e,t).then(r,i)}}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:t,licenseChallenge:n})=>{e.keySystem==c5.PLAYREADY&&(n=this.unpackPlayReadyKeyMessage(t,n)),t.send(n)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;let n=t.media;this.media=n,n.removeEventListener(`encrypted`,this.onMediaEncrypted),n.removeEventListener(`waitingforkey`,this.onWaitingForKey),n.addEventListener(`encrypted`,this.onMediaEncrypted),n.addEventListener(`waitingforkey`,this.onWaitingForKey)}onMediaDetached(){let t=this.media,n=this.mediaKeySessions;t&&(t.removeEventListener(`encrypted`,this.onMediaEncrypted),t.removeEventListener(`waitingforkey`,this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ukr.clearKeyUriToKeyIdMap();let r=n.length;e.CDMCleanupPromise=Promise.all(n.map(e=>this.removeSession(e)).concat(t?.setMediaKeys(null).catch(e=>{this.log(`Could not clear media keys: ${e}`)}))).then(()=>{r&&(this.log(`finished closing key sessions and clearing media keys`),n.length=0)}).catch(e=>{this.log(`Could not close sessions and clear media keys: ${e}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){let e=t.reduce((e,t)=>(e.indexOf(t.keyFormat)===-1&&e.push(t.keyFormat),e),[]);this.log(`Selecting key-system from session-keys ${e.join(`, `)}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){let{mediaKeysSession:t,licenseXhr:n}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&=(t.removeEventListener(`message`,e._onmessage),void 0),e._onkeystatuseschange&&=(t.removeEventListener(`keystatuseschange`,e._onkeystatuseschange),void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;let r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(e=>{this.log(`Could not remove session: ${e}`)}).then(()=>t.close()).catch(e=>{this.log(`Could not close session: ${e}`)})}}};JPr.CDMCleanupPromise=void 0;var Q5=class extends Error{constructor(e,t){super(t),this.data=void 0,e.error||=Error(t),this.data=e,e.err=e.error}},$5;(function(e){e.MANIFEST=`m`,e.AUDIO=`a`,e.VIDEO=`v`,e.MUXED=`av`,e.INIT=`i`,e.CAPTION=`c`,e.TIMED_TEXT=`tt`,e.KEY=`k`,e.OTHER=`o`})($5||={});var YPr;(function(e){e.DASH=`d`,e.HLS=`h`,e.SMOOTH=`s`,e.OTHER=`o`})(YPr||={});var e7;(function(e){e.OBJECT=`CMCD-Object`,e.REQUEST=`CMCD-Request`,e.SESSION=`CMCD-Session`,e.STATUS=`CMCD-Status`})(e7||={});var XPr={[e7.OBJECT]:[`br`,`d`,`ot`,`tb`],[e7.REQUEST]:[`bl`,`dl`,`mtp`,`nor`,`nrr`,`su`],[e7.SESSION]:[`cid`,`pr`,`sf`,`sid`,`st`,`v`],[e7.STATUS]:[`bs`,`rtp`]},ZPr=class e{constructor(t,n){this.value=void 0,this.params=void 0,Array.isArray(t)&&(t=t.map(t=>t instanceof e?t:new e(t))),this.value=t,this.params=n}},QPr=class{constructor(e){this.description=void 0,this.description=e}},$Pr=`Dict`;function eFr(e){return Array.isArray(e)?JSON.stringify(e):e instanceof Map?`Map{}`:e instanceof Set?`Set{}`:typeof e==`object`?JSON.stringify(e):String(e)}function tFr(e,t,n,r){return Error(`failed to ${e} "${eFr(t)}" as ${n}`,{cause:r})}var nFr=`Bare Item`,rFr=`Boolean`,iFr=`Byte Sequence`,aFr=`Decimal`,oFr=`Integer`;function sFr(e){return e<-999999999999999||999999999999999<e}var cFr=/[\x00-\x1f\x7f]+/,lFr=`Token`,uFr=`Key`;function t7(e,t,n){return tFr(`serialize`,e,t,n)}function dFr(e){if(typeof e!=`boolean`)throw t7(e,rFr);return e?`?1`:`?0`}function fFr(e){return btoa(String.fromCharCode(...e))}function pFr(e){if(ArrayBuffer.isView(e)===!1)throw t7(e,iFr);return`:${fFr(e)}:`}function mFr(e){if(sFr(e))throw t7(e,oFr);return e.toString()}function hFr(e){return`@${mFr(e.getTime()/1e3)}`}function gFr(e,t){if(e<0)return-gFr(-e,t);let n=10**t;if(Math.abs(e*n%1-.5)<2**-52){let t=Math.floor(e*n);return(t%2==0?t:t+1)/n}return Math.round(e*n)/n}function _Fr(e){let t=gFr(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw t7(e,aFr);let n=t.toString();return n.includes(`.`)?n:`${n}.0`}var vFr=`String`;function yFr(e){if(cFr.test(e))throw t7(e,vFr);return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function bFr(e){return e.description||e.toString().slice(7,-1)}function xFr(e){let t=bFr(e);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t)===!1)throw t7(t,lFr);return t}function SFr(e){switch(typeof e){case`number`:if(!t5(e))throw t7(e,nFr);return Number.isInteger(e)?mFr(e):_Fr(e);case`string`:return yFr(e);case`symbol`:return xFr(e);case`boolean`:return dFr(e);case`object`:if(e instanceof Date)return hFr(e);if(e instanceof Uint8Array)return pFr(e);if(e instanceof QPr)return xFr(e);default:throw t7(e,nFr)}}function CFr(e){if(/^[a-z*][a-z0-9\-_.*]*$/.test(e)===!1)throw t7(e,uFr);return e}function wFr(e){return e==null?``:Object.entries(e).map(([e,t])=>t===!0?`;${CFr(e)}`:`;${CFr(e)}=${SFr(t)}`).join(``)}function TFr(e){return e instanceof ZPr?`${SFr(e.value)}${wFr(e.params)}`:SFr(e)}function EFr(e){return`(${e.value.map(TFr).join(` `)})${wFr(e.params)}`}function DFr(e,t={whitespace:!0}){if(typeof e!=`object`)throw t7(e,$Pr);let n=e instanceof Map?e.entries():Object.entries(e),r=t!=null&&t.whitespace?` `:``;return Array.from(n).map(([e,t])=>{t instanceof ZPr||(t=new ZPr(t));let n=CFr(e);return t.value===!0?n+=wFr(t.params):(n+=`=`,Array.isArray(t.value)?n+=EFr(t):n+=TFr(t)),n}).join(`,${r}`)}function OFr(e,t){return DFr(e,t)}var kFr=e=>e===`ot`||e===`sf`||e===`st`,AFr=e=>typeof e==`number`?t5(e):e!=null&&e!==``&&e!==!1;function jFr(e,t){let n=new URL(e),r=new URL(t);if(n.origin!==r.origin)return e;let i=n.pathname.split(`/`).slice(1),a=r.pathname.split(`/`).slice(1,-1);for(;i[0]===a[0];)i.shift(),a.shift();for(;a.length;)a.shift(),i.unshift(`..`);return i.join(`/`)}function MFr(){try{return crypto.randomUUID()}catch{try{let e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf(`/`)+1)}catch{let e=new Date().getTime();return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t==`x`?n:n&3|8).toString(16)})}}}var NFr=e=>Math.round(e),PFr=(e,t)=>(t!=null&&t.baseUrl&&(e=jFr(e,t.baseUrl)),encodeURIComponent(e)),FFr=e=>NFr(e/100)*100,IFr={br:NFr,d:NFr,bl:FFr,dl:FFr,mtp:FFr,nor:PFr,rtp:FFr,tb:NFr};function LFr(e,t){let n={};if(typeof e!=`object`||!e)return n;let r=Object.keys(e).sort(),i=e5({},IFr,t?.formatters),a=t?.filter;return r.forEach(r=>{if(a!=null&&a(r))return;let o=e[r],s=i[r];s&&(o=s(o,t)),r===`v`&&o===1||r==`pr`&&o===1||!AFr(o)||(kFr(r)&&typeof o==`string`&&(o=new QPr(o)),n[r]=o)}),n}function RFr(e,t={}){return e?OFr(LFr(e,t),e5({whitespace:!1},t)):``}function zFr(e,t={}){if(!e)return{};let n=Object.entries(e),r=Object.entries(XPr).concat(Object.entries(t?.customHeaderMap||{})),i=n.reduce((e,t)=>{let[n,i]=t,a=r.find(e=>e[1].includes(n))?.[0]||e7.REQUEST;return e[a]??(e[a]={}),e[a][n]=i,e},{});return Object.entries(i).reduce((e,[n,r])=>(e[n]=RFr(r,t),e),{})}function BFr(e,t,n){return e5(e,zFr(t,n))}var VFr=`CMCD`;function HFr(e,t={}){if(!e)return``;let n=RFr(e,t);return`${VFr}=${encodeURIComponent(n)}`}var UFr=/CMCD=[^&#]+/;function WFr(e,t,n){let r=HFr(t,n);return r?UFr.test(e)?e.replace(UFr,r):`${e}${e.includes(`?`)?`&`:`?`}${r}`:e}var GFr=class{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||=!0,this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:$5.MANIFEST,su:!this.initialized})}catch(e){Q.warn(`Could not generate manifest CMCD data.`,e)}},this.applyFragmentData=e=>{try{let t=e.frag,n=this.hls.levels[t.level],r=this.getObjectType(t),i={d:t.duration*1e3,ot:r};(r===$5.VIDEO||r===$5.AUDIO||r==$5.MUXED)&&(i.br=n.bitrate/1e3,i.tb=this.getTopBandwidth(r)/1e3,i.bl=this.getBufferLength(r)),this.apply(e,i)}catch(e){Q.warn(`Could not generate segment CMCD data.`,e)}},this.hls=e;let t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||MFr(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){let e=this.hls;e.on(X.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(X.MEDIA_DETACHED,this.onMediaDetached,this),e.on(X.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){let e=this.hls;e.off(X.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(X.MEDIA_DETACHED,this.onMediaDetached,this),e.off(X.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=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),null)}onBufferCreated(e,t){this.audioBuffer=t.tracks.audio?.buffer,this.videoBuffer=t.tracks.video?.buffer}createData(){return{v:1,sf:YPr.HLS,sid:this.sid,cid:this.cid,pr:this.media?.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){e5(t,this.createData());let n=t.ot===$5.INIT||t.ot===$5.VIDEO||t.ot===$5.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su??(t.su=this.buffering);let{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((e,n)=>(r.includes(n)&&(e[n]=t[n]),e),{})),this.useHeaders?(e.headers||={},BFr(e.headers,t)):e.url=WFr(e.url,t)}getObjectType(e){let{type:t}=e;if(t===`subtitle`)return $5.TIMED_TEXT;if(e.sn===`initSegment`)return $5.INIT;if(t===`audio`)return $5.AUDIO;if(t===`main`)return this.hls.audioTracks.length?$5.VIDEO:$5.MUXED}getTopBandwidth(e){let t=0,n,r=this.hls;if(e===$5.AUDIO)n=r.audioTracks;else{let e=r.maxAutoLevel,t=e>-1?e+1:r.levels.length;n=r.levels.slice(0,t)}for(let e of n)e.bitrate>t&&(t=e.bitrate);return t>0?t:NaN}getBufferLength(e){let t=this.hls.media,n=e===$5.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:L5.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){let{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new n(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,n,r){t(e),this.loader.load(e,n,r)}}}createFragmentLoader(){let{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new n(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,n,r){t(e),this.loader.load(e,n,r)}}}},KFr=3e5,qFr=class{constructor(e){this.hls=void 0,this.log=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.log=Q.log.bind(Q,`[content-steering]:`),this.registerListeners()}registerListeners(){let e=this.hls;e.on(X.MANIFEST_LOADING,this.onManifestLoading,this),e.on(X.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(X.MANIFEST_PARSED,this.onManifestParsed,this),e.on(X.ERROR,this.onError,this)}unregisterListeners(){let e=this.hls;e&&(e.off(X.MANIFEST_LOADING,this.onManifestLoading,this),e.off(X.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(X.MANIFEST_PARSED,this.onManifestParsed,this),e.off(X.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){let 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(),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){let t=this.levels;t&&(this.levels=t.filter(t=>t!==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){let{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){let{errorAction:n}=t;if(n?.action===O5.SendAlternateToPenaltyBox&&n.flags===k5.MoveAllAlternatesMatchingHost){let e=this.levels,r=this.pathwayPriority,i=this.pathwayId;if(t.context){let{groupId:n,pathwayId:r,type:a}=t.context;n&&e?i=this.getPathwayForGroupId(n,a,i):r&&(i=r)}i in this.penalizedPathways||(this.penalizedPathways[i]=performance.now()),!r&&e&&(r=e.reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])),r&&r.length>1&&(this.updatePathwayPriority(r),n.resolved=this.pathwayId!==i),n.resolved||Q.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${i} levels: ${e&&e.length} priorities: ${JSON.stringify(r)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){let 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,n=this.penalizedPathways,r=performance.now();Object.keys(n).forEach(e=>{r-n[e]>KFr&&delete n[e]});for(let r=0;r<e.length;r++){let i=e[r];if(i in n)continue;if(i===this.pathwayId)return;let a=this.hls.nextLoadLevel,o=this.hls.levels[a];if(t=this.getLevelsForPathway(i),t.length>0){this.log(`Setting Pathway to "${i}"`),this.pathwayId=i,ajr(t),this.hls.trigger(X.LEVELS_UPDATED,{levels:t});let e=this.hls.levels[a];o&&e&&this.levels&&(e.attrs[`STABLE-VARIANT-ID`]!==o.attrs[`STABLE-VARIANT-ID`]&&e.bitrate!==o.bitrate&&this.log(`Unstable Pathways change from bitrate ${o.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,n){let r=this.getLevelsForPathway(n).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===C5.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===C5.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return n}clonePathways(e){let t=this.levels;if(!t)return;let n={},r={};e.forEach(e=>{let{ID:i,"BASE-ID":a,"URI-REPLACEMENT":o}=e;if(t.some(e=>e.pathwayId===i))return;let s=this.getLevelsForPathway(a).map(e=>{let t=new a5(e.attrs);t[`PATHWAY-ID`]=i;let a=t.AUDIO&&`${t.AUDIO}_clone_${i}`,s=t.SUBTITLES&&`${t.SUBTITLES}_clone_${i}`;a&&(n[t.AUDIO]=a,t.AUDIO=a),s&&(r[t.SUBTITLES]=s,t.SUBTITLES=s);let c=YFr(e.uri,t[`STABLE-VARIANT-ID`],`PER-VARIANT-URIS`,o),l=new D5({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:c,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t<e.audioGroups.length;t++)l.addGroupId(`audio`,`${e.audioGroups[t]}_clone_${i}`);if(e.subtitleGroups)for(let t=1;t<e.subtitleGroups.length;t++)l.addGroupId(`text`,`${e.subtitleGroups[t]}_clone_${i}`);return l});t.push(...s),JFr(this.audioTracks,n,o,i),JFr(this.subtitleTracks,r,o,i)})}loadSteeringManifest(e){let 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:`){let e=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set(`_HLS_pathway`,this.pathwayId),r.searchParams.set(`_HLS_throughput`,``+e)}let i={responseType:`json`,url:r.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},s={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0};this.log(`Requesting steering manifest: ${r}`),this.loader.load(i,s,{onSuccess:(e,t,n,i)=>{this.log(`Loaded steering manifest: "${r}"`);let a=e.data;if(a.VERSION!==1){this.log(`Steering VERSION ${a.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=a.TTL;let{"RELOAD-URI":o,"PATHWAY-CLONES":s,"PATHWAY-PRIORITY":c}=a;if(o)try{this.uri=new self.URL(o,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${o}`);return}this.scheduleRefresh(this.uri||n.url),s&&this.clonePathways(s);let l={steeringManifest:a,url:r.toString()};this.hls.trigger(X.STEERING_MANIFEST_LOADED,l),c&&this.updatePathwayPriority(c)},onError:(e,t,n,r)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),e.code===410){this.enabled=!1,this.log(`Steering manifest ${t.url} no longer available`);return}let i=this.timeToLoad*1e3;if(e.code===429){let e=this.loader;if(typeof e?.getResponseHeader==`function`){let t=e.getResponseHeader(`Retry-After`);t&&(i=parseFloat(t)*1e3)}this.log(`Steering manifest ${t.url} rate limited`)}else this.scheduleRefresh(this.uri||t.url,i)},onTimeout:(e,t,n)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}})}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{let t=this.hls?.media;t&&!t.ended?this.loadSteeringManifest(e):this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}};function JFr(e,t,n,r){e&&Object.keys(t).forEach(i=>{let a=e.filter(e=>e.groupId===i).map(e=>{let a=e5({},e);return a.details=void 0,a.attrs=new a5(a.attrs),a.url=a.attrs.URI=YFr(e.url,e.attrs[`STABLE-RENDITION-ID`],`PER-RENDITION-URIS`,n),a.groupId=a.attrs[`GROUP-ID`]=t[i],a.attrs[`PATHWAY-ID`]=r,a});e.push(...a)})}function YFr(e,t,n,r){let{HOST:i,PARAMS:a,[n]:o}=r,s;t&&(s=o?.[t],s&&(e=s));let c=new self.URL(e);return i&&!s&&(c.host=i),a&&Object.keys(a).sort().forEach(e=>{e&&c.searchParams.set(e,a[e])}),c.href}var XFr=/^age:\s*[\d.]+\s*$/im,ZFr=class{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 jOr,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){let 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 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(){let{config:e,context:t}=this;if(!e||!t)return;let n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;let i=this.xhrSetup;i?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return i(n,t.url)}).catch(e=>{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(e=>{this.callbacks.onError({code:n.status,text:e.message},t,n,r)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open(`GET`,t.url,!0);let r=t.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:a}=n.loadPolicy;if(r)for(let t in r)e.setRequestHeader(t,r[t]);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&&t5(i)?i:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:n}=this;if(!e||!t)return;let 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;let r=t.status,a=t.responseType===`text`?t.responseText:null;if(r>=200&&r<300){let i=a??t.response;if(i!=null){if(n.loading.end=Math.max(self.performance.now(),n.loading.first),n.loaded=n.total=t.responseType===`arraybuffer`?i.byteLength:i.length,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first),!this.callbacks)return;let a=this.callbacks.onProgress;if(a&&a(n,e,i,t),!this.callbacks)return;let o={url:t.responseURL,data:i,code:r};this.callbacks.onSuccess(o,n,e,t);return}}let o=i.loadPolicy.errorRetry,s=n.retry;ujr(o,s,!1,{url:e.url,data:void 0,code:r})?this.retry(o):(Q.error(`${r} while loading ${e.url}`),this.callbacks.onError({code:r,text:t.statusText},e,t,n))}}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(ujr(e,t,!0))this.retry(e);else{Q.warn(`timeout while loading ${this.context?.url}`);let e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){let{context:t,stats:n}=this;this.retryDelay=cjr(e,n.retry),n.retry++,Q.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){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&XFr.test(this.loader.getAllResponseHeaders())){let t=this.loader.getResponseHeader(`age`);e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&RegExp(`^${e}:\\s*[\\d.]+\\s*$`,`im`).test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}};function QFr(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}var $Fr=/(\d+)-(\d+)\/(\d+)/,eIr=class{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||iIr,this.controller=new self.AbortController,this.stats=new jOr}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){let r=this.stats;if(r.loading.start)throw Error(`Loader can only be used once.`);r.loading.start=self.performance.now();let i=tIr(e,this.controller.signal),a=n.onProgress,o=e.responseType===`arraybuffer`,s=o?`byteLength`:`length`,{maxTimeToFirstByteMs:c,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,i),self.clearTimeout(this.requestTimeout),t.timeout=c&&t5(c)?c:l,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(i=>{this.response=this.loader=i;let s=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(r,e,this.response)},l-(s-r.loading.start)),!i.ok){let{status:e,statusText:t}=i;throw new aIr(t||`fetch, bad network response`,e,i)}return r.loading.first=s,r.total=rIr(i.headers)||r.total,a&&t5(t.highWaterMark)?this.loadProgressively(i,r,e,t.highWaterMark,a):o?i.arrayBuffer():e.responseType===`json`?i.json():i.text()}).then(i=>{let o=this.response;if(!o)throw Error(`loader destroyed`);self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);let c=i[s];c&&(r.loaded=r.total=c);let l={url:o.url,data:i,code:o.status};a&&!t5(t.highWaterMark)&&a(r,e,i,o),n.onSuccess(l,r,e,o)}).catch(t=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;let i=t&&t.code||0,a=t?t.message:null;n.onError({code:i,text:a},e,t?t.details:null,r)})}getCacheAge(){let e=null;if(this.response){let 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){let a=new cMr,o=e.body.getReader(),s=()=>o.read().then(o=>{if(o.done)return a.dataLength&&i(t,n,a.flush(),e),Promise.resolve(new ArrayBuffer(0));let c=o.value,l=c.length;return t.loaded+=l,l<r||a.dataLength?(a.push(c),a.dataLength>=r&&i(t,n,a.flush(),e)):i(t,n,c,e),s()}).catch(()=>Promise.reject());return s()}};function tIr(e,t){let n={method:`GET`,mode:`cors`,credentials:`same-origin`,signal:t,headers:new self.Headers(e5({},e.headers))};return e.rangeEnd&&n.headers.set(`Range`,`bytes=`+e.rangeStart+`-`+String(e.rangeEnd-1)),n}function nIr(e){let t=$Fr.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}function rIr(e){let t=e.get(`Content-Range`);if(t){let e=nIr(t);if(t5(e))return e}let n=e.get(`Content-Length`);if(n)return parseInt(n)}function iIr(e,t){return new self.Request(e.url,t)}var aIr=class extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}},oIr=/\s/,sIr={newCue(e,t,n,r){let i=[],a,o,s,c,l,u=self.VTTCue||self.TextTrackCue;for(let f=0;f<r.rows.length;f++)if(a=r.rows[f],s=!0,c=0,l=``,!a.isEmpty()){var d;for(let e=0;e<a.chars.length;e++)oIr.test(a.chars[e].uchar)&&s?c++:(l+=a.chars[e].uchar,s=!1);a.cueStartTime=t,t===n&&(n+=1e-4),c>=16?c--:c++;let r=gPr(l.trim()),p=SPr(t,n,r);e!=null&&(d=e.cues)!=null&&d.getCueById(p)||(o=new u(t,n,r),o.id=p,o.line=f+1,o.align=`left`,o.position=10+Math.min(80,Math.floor(c*8/32)*10),i.push(o))}return e&&i.length&&(i.sort((e,t)=>e.line===`auto`||t.line===`auto`?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),i.forEach(t=>EAr(e,t))),i}},cIr=$8($8({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,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,loader:ZFr,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Fjr,bufferController:VNr,capLevelController:GPr,errorController:yjr,fpsController:KPr,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:qOr,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},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}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},lIr()),{},{subtitleStreamController:INr,subtitleTrackController:RNr,timelineController:BPr,audioStreamController:NNr,audioTrackController:PNr,emeController:JPr,cmcdController:GFr,contentSteeringController:qFr});function lIr(){return{cueHandler:sIr,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 uIr(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw Error(`Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration`);if(t.liveMaxLatencyDurationCount!==void 0&&(t.liveSyncDurationCount===void 0||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw Error(`Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"`);if(t.liveMaxLatencyDuration!==void 0&&(t.liveSyncDuration===void 0||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw Error(`Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"`);let n=dIr(e),r=[`manifest`,`level`,`frag`],i=[`TimeOut`,`MaxRetry`,`RetryDelay`,`MaxRetryTimeout`];return r.forEach(e=>{let r=`${e===`level`?`playlist`:e}LoadPolicy`,a=t[r]===void 0,o=[];i.forEach(i=>{let s=`${e}Loading${i}`,c=t[s];if(c!==void 0&&a){o.push(s);let e=n[r].default;switch(t[r]={default:e},i){case`TimeOut`:e.maxLoadTimeMs=c,e.maxTimeToFirstByteMs=c;break;case`MaxRetry`:e.errorRetry.maxNumRetry=c,e.timeoutRetry.maxNumRetry=c;break;case`RetryDelay`:e.errorRetry.retryDelayMs=c,e.timeoutRetry.retryDelayMs=c;break;case`MaxRetryTimeout`:e.errorRetry.maxRetryDelayMs=c,e.timeoutRetry.maxRetryDelayMs=c}}}),o.length&&Q.warn(`hls.js config: "${o.join(`", "`)}" setting(s) are deprecated, use "${r}": ${JSON.stringify(t[r])}`)}),$8($8({},n),t)}function dIr(e){return e&&typeof e==`object`?Array.isArray(e)?e.map(dIr):Object.keys(e).reduce((t,n)=>(t[n]=dIr(e[n]),t),{}):e}function fIr(e){let t=e.loader;t!==eIr&&t!==ZFr?(Q.log(`[config]: Custom loader detected, cannot enable progressive streaming`),e.progressive=!1):QFr()&&(e.loader=eIr,e.progressive=!0,e.enableSoftwareAES=!0,Q.log(`[config]: Progressive streaming enabled, using FetchLoader`))}var pIr,mIr=class extends bjr{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(){let{hls:e}=this;e.on(X.MANIFEST_LOADING,this.onManifestLoading,this),e.on(X.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(X.LEVEL_LOADED,this.onLevelLoaded,this),e.on(X.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(X.FRAG_BUFFERED,this.onFragBuffered,this),e.on(X.ERROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(X.MANIFEST_LOADING,this.onManifestLoading,this),e.off(X.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(X.LEVEL_LOADED,this.onLevelLoaded,this),e.off(X.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(X.FRAG_BUFFERED,this.onFragBuffered,this),e.off(X.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.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){let n=this.hls.config.preferManagedMediaSource,r=[],i={},a={},o=!1,s=!1,c=!1;t.levels.forEach(e=>{let t=e.attrs,{audioCodec:l,videoCodec:u}=e;l?.indexOf(`mp4a.40.34`)!==-1&&(pIr||=/chrome|firefox/i.test(navigator.userAgent),pIr&&(e.audioCodec=l=void 0)),l&&(e.audioCodec=l=oAr(l,n)),u?.indexOf(`avc1`)===0&&(u=e.videoCodec=cAr(u));let{width:d,height:f,unknownCodecs:p}=e;if(o||=!!(d&&f),s||=!!u,c||=!!l,p!=null&&p.length||l&&!$kr(l,`audio`,n)||u&&!$kr(u,`video`,n))return;let{CODECS:m,"FRAME-RATE":h,"HDCP-LEVEL":g,"PATHWAY-ID":_,RESOLUTION:v,"VIDEO-RANGE":y}=t,b=`${`${_||`.`}-`}${e.bitrate}-${v}-${h}-${m}-${y}-${g}`;if(!i[b]){let t=new D5(e);i[b]=t,a[b]=1,r.push(t)}else if(i[b].uri!==e.url&&!e.attrs[`PATHWAY-ID`]){let t=a[b]+=1;e.attrs[`PATHWAY-ID`]=Array(t+1).join(`.`);let n=new D5(e);i[b]=n,r.push(n)}else i[b].addGroupId(`audio`,t.AUDIO),i[b].addGroupId(`text`,t.SUBTITLES)}),this.filterAndSortMediaOptions(r,t,o,s,c)}filterAndSortMediaOptions(e,t,n,r,i){let a=[],o=[],s=e;if((n||r)&&i&&(s=s.filter(({videoCodec:e,videoRange:t,width:n,height:r})=>(!!e||!!(n&&r))&&HAr(t))),s.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);let e=Error(`no level with compatible codecs found in manifest`);this.hls.trigger(X.ERROR,{type:n5.MEDIA_ERROR,details:Z.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}});return}if(t.audioTracks){let{preferManagedMediaSource:e}=this.hls.config;a=t.audioTracks.filter(t=>!t.audioCodec||$kr(t.audioCodec,`audio`,e)),hIr(a)}t.subtitles&&(o=t.subtitles,hIr(o));let c=s.slice(0);s.sort((e,t)=>{if(e.attrs[`HDCP-LEVEL`]!==t.attrs[`HDCP-LEVEL`])return(e.attrs[`HDCP-LEVEL`]||``)>(t.attrs[`HDCP-LEVEL`]||``)?1:-1;if(n&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return VAr.indexOf(e.videoRange)-VAr.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){let n=tAr(e.videoCodec),r=tAr(t.videoCodec);if(n!==r)return r-n}if(e.uri===t.uri&&e.codecSet!==t.codecSet){let n=nAr(e.codecSet),r=nAr(t.codecSet);if(n!==r)return r-n}return e.averageBitrate===t.averageBitrate?0:e.averageBitrate-t.averageBitrate});let l=c[0];if(this.steering&&(s=this.steering.filterParsedLevels(s),s.length!==c.length)){for(let e=0;e<c.length;e++)if(c[e].pathwayId===s[0].pathwayId){l=c[e];break}}this._levels=s;for(let e=0;e<s.length;e++)if(s[e]===l){this._firstLevel=e;let t=l.bitrate,n=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${s.length} level(s) found, first bitrate: ${t}`),this.hls.userConfig?.abrEwmaDefaultEstimate===void 0){let e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>n&&n===cIr.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}let u=i&&!r,d={levels:s,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:i,video:r,altAudio:!u&&a.some(e=>!!e.url)};this.hls.trigger(X.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){let t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){let n=Error(`invalid level idx`),r=e<0;if(this.hls.trigger(X.ERROR,{type:n5.OTHER_ERROR,details:Z.LEVEL_SWITCH_ERROR,level:e,fatal:r,error:n,reason:n.message}),r)return;e=Math.min(e,t.length-1)}let n=this.currentLevelIndex,r=this.currentLevel,i=r?r.attrs[`PATHWAY-ID`]:void 0,a=t[e],o=a.attrs[`PATHWAY-ID`];if(this.currentLevelIndex=e,this.currentLevel=a,n===e&&a.details&&r&&i===o)return;this.log(`Switching to level ${e} (${a.height?a.height+`p `:``}${a.videoRange?a.videoRange+` `:``}${a.codecSet?a.codecSet+` `:``}@${a.bitrate})${o?` with Pathway `+o:``} from level ${n}${i?` with Pathway `+i:``}`);let s={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(X.LEVEL_SWITCHING,s);let c=a.details;if(!c||c.live){let e=this.switchParams(a.uri,r?.details,c);this.loadPlaylist(e)}}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){let e=this.hls.config.startLevel;return e===void 0?this.hls.firstAutoLevel:e}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){!t.fatal&&t.context&&t.context.type===C5.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===w5.MAIN){let e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;let n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var n;let{level:r,details:i}=t,a=this._levels[r];if(a)r===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0),this.playlistLoaded(r,t,a.details)):(n=t.deliveryDirectives)!=null&&n.skip&&(i.deltaUpdateFailed=!0);else{var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(i.deltaUpdateFailed=!0)}}loadPlaylist(e){super.loadPlaylist();let t=this.currentLevelIndex,n=this.currentLevel;if(n&&this.shouldLoadPlaylist(n)){let r=n.uri;if(e)try{r=e.addDirectives(r)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}let i=n.attrs[`PATHWAY-ID`];this.log(`Loading level index ${t}${e?.msn===void 0?``:` at sn `+e.msn+` part `+e.part} with${i?` Pathway `+i:``} ${r}`),this.clearTimer(),this.hls.trigger(X.LEVEL_LOADING,{url:r,level:t,pathwayId:n.attrs[`PATHWAY-ID`],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex===-1?this.hls.nextAutoLevel:this.manualLevelIndex}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;let n=this._levels.filter((t,n)=>n!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1));ajr(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(X.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(X.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}};function hIr(e){let t={};e.forEach(e=>{let n=e.groupId||``;e.id=t[n]=t[n]||0,t[n]++})}var gIr=class{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(let t in this.keyUriToKeyInfo){let n=this.keyUriToKeyInfo[t].loader;if(n){if(e&&e!==n.context?.frag.type)return;n.abort()}}}detach(){for(let e in this.keyUriToKeyInfo){let t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(let e in this.keyUriToKeyInfo){let t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=Z.KEY_LOAD_ERROR,n,r,i){return new R5({type:n5.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:i,error:n,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){let{sn:n,cc:r}=e;for(let e=0;e<t.length;e++){let i=t[e];if(r<=i.cc&&(n===`initSegment`||i.sn===`initSegment`||n<i.sn)){this.emeController.selectKeySystemFormat(i).then(e=>{i.setKeyFormat(e)});break}}}}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);let i=e.decryptdata;if(!i){let n=Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading`);return Promise.reject(this.createKeyLoadError(e,Z.KEY_LOAD_ERROR,n))}let a=i.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,Z.KEY_LOAD_ERROR,Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if((n=o)!=null&&n.decryptdata.key)return i.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((r=o)!=null&&r.keyLoadPromise)switch(o.mediaKeySessionContext?.keyStatus){case void 0:case`status-pending`:case`usable`:case`usable-in-future`:return o.keyLoadPromise.then(t=>(i.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}switch(o=this.keyUriToKeyInfo[a]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case`ISO-23001-7`:case`SAMPLE-AES`:case`SAMPLE-AES-CENC`:case`SAMPLE-AES-CTR`:return i.keyFormat===`identity`?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case`AES-128`:return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,Z.KEY_LOAD_ERROR,Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(e,t){let n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){let t=this.emeController.loadKey(n);if(t)return(e.keyLoadPromise=t.then(t=>(e.mediaKeySessionContext=t,n))).catch(t=>{throw e.keyLoadPromise=null,t})}return Promise.resolve(n)}loadKeyHTTP(e,t){let n=this.config,r=n.loader,i=new r(n);return t.keyLoader=e.loader=i,e.keyLoadPromise=new Promise((r,a)=>{let o={keyInfo:e,frag:t,responseType:`arraybuffer`,url:e.decryptdata.uri},s=n.keyLoadPolicy.default,c={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};i.load(o,c,{onSuccess:(e,t,n,i)=>{let{frag:o,keyInfo:s,url:c}=n;if(!o.decryptdata||s!==this.keyUriToKeyInfo[c])return a(this.createKeyLoadError(o,Z.KEY_LOAD_ERROR,Error(`after key load, decryptdata unset or changed`),i));s.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=null,s.loader=null,r({frag:o,keyInfo:s})},onError:(e,n,r,i)=>{this.resetLoader(n),a(this.createKeyLoadError(t,Z.KEY_LOAD_ERROR,Error(`HTTP Error ${e.code} loading key ${e.text}`),r,$8({url:o.url,data:void 0},e)))},onTimeout:(e,n,r)=>{this.resetLoader(n),a(this.createKeyLoadError(t,Z.KEY_LOAD_TIMEOUT,Error(`key loading timed out`),r))},onAbort:(e,n,r)=>{this.resetLoader(n),a(this.createKeyLoadError(t,Z.INTERNAL_ABORTED,Error(`key loading aborted`),r))}})})}resetLoader(e){let{frag:t,keyInfo:n,url:r}=e,i=n.loader;t.keyLoader===i&&(t.keyLoader=null,n.loader=null),delete this.keyUriToKeyInfo[r],i&&i.destroy()}};function _Ir(){return self.SourceBuffer||self.WebKitSourceBuffer}function vIr(){if(!b5())return!1;let e=_Ir();return!e||e.prototype&&typeof e.prototype.appendBuffer==`function`&&typeof e.prototype.remove==`function`}function yIr(){if(!vIr())return!1;let e=b5();return typeof e?.isTypeSupported==`function`&&([`avc1.42E01E,mp4a.40.2`,`av01.0.01M.08`,`vp09.00.50.08`].some(t=>e.isTypeSupported(x5(t,`video`)))||[`mp4a.40.2`,`fLaC`].some(t=>e.isTypeSupported(x5(t,`audio`))))}function bIr(){return typeof _Ir()?.prototype?.changeType==`function`}var xIr=250,SIr=2,CIr=.1,wIr=.05,TIr=class{constructor(e,t,n,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=n,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){let{config:n,media:r,stalled:i}=this;if(r===null)return;let{currentTime:a,seeking:o}=r,s=this.seeking&&!o,c=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,o||(this.nudgeRetry=0),i!==null){if(this.stallReported){let e=self.performance.now()-i;Q.warn(`playback not stuck anymore @${a}, after ${Math.round(e)}ms`),this.stallReported=!1}this.stalled=null}return}if(c||s){this.stalled=null;return}if(r.paused&&!o||r.ended||r.playbackRate===0||!L5.getBuffered(r).length){this.nudgeRetry=0;return}let l=L5.bufferInfo(r,a,0),u=l.nextStart||0;if(o){let e=l.len>SIr,n=!u||t&&t.start<=a||u-a>SIr&&!this.fragmentTracker.getPartialFragment(a);if(e||n)return;this.moved=!1}if(!this.moved&&this.stalled!==null){if(!(l.len>0)&&!u)return;let e=Math.max(u,l.start||0)-a,t=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,n=t!=null&&t.details?.live?t.details.targetduration*2:SIr,i=this.fragmentTracker.getPartialFragment(a);if(e>0&&(e<=n||i)){r.paused||this._trySkipBufferHole(i);return}}let d=self.performance.now();if(i===null){this.stalled=d;return}let f=d-i;if(!o&&f>=xIr&&(this._reportStall(l),!this.media))return;let p=L5.bufferInfo(r,a,n.maxBufferHole);this._tryFixBufferStall(p,f)}_tryFixBufferStall(e,t){let{config:n,fragmentTracker:r,media:i}=this;if(i===null)return;let a=i.currentTime,o=r.getPartialFragment(a);(!o||!this._trySkipBufferHole(o)&&this.media)&&(e.len>n.maxBufferHole||e.nextStart&&e.nextStart-a<n.maxBufferHole)&&t>n.highBufferWatchdogPeriod*1e3&&(Q.warn(`Trying to nudge playhead over buffer-hole`),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){let{hls:t,media:n,stallReported:r}=this;if(!r&&n){this.stallReported=!0;let r=Error(`Playback stalling at @${n.currentTime} due to low buffer (${JSON.stringify(e)})`);Q.warn(r.message),t.trigger(X.ERROR,{type:n5.MEDIA_ERROR,details:Z.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len})}}_trySkipBufferHole(e){let{config:t,hls:n,media:r}=this;if(r===null)return 0;let i=r.currentTime,a=L5.bufferInfo(r,i,0),o=i<a.start?a.start:a.nextStart;if(o){let s=a.len<=t.maxBufferHole,c=a.len>0&&a.len<1&&r.readyState<3,l=o-i;if(l>0&&(s||c)){if(l>t.maxBufferHole){let{fragmentTracker:t}=this,n=!1;if(i===0){let e=t.getAppendedFrag(0,w5.MAIN);e&&o<e.end&&(n=!0)}if(!n){let n=e||t.getAppendedFrag(i,w5.MAIN);if(n){let e=!1,r=n.end;for(;r<o;){let n=t.getPartialFragment(r);if(n)r+=n.duration;else{e=!0;break}}if(e)return 0}}}let a=Math.max(o+wIr,i+CIr);if(Q.warn(`skipping hole, adjusting currentTime from ${i} to ${a}`),this.moved=!0,this.stalled=null,r.currentTime=a,e&&!e.gap){let t=Error(`fragment loaded with buffer holes, seeking from ${i} to ${a}`);n.trigger(X.ERROR,{type:n5.MEDIA_ERROR,details:Z.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:t,reason:t.message,frag:e})}return a}}return 0}_tryNudgeBuffer(){let{config:e,hls:t,media:n,nudgeRetry:r}=this;if(n===null)return;let i=n.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){let a=i+(r+1)*e.nudgeOffset,o=Error(`Nudging 'currentTime' from ${i} to ${a}`);Q.warn(o.message),n.currentTime=a,t.trigger(X.ERROR,{type:n5.MEDIA_ERROR,details:Z.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{let n=Error(`Playhead still not moving while enough data buffered @${i} after ${e.nudgeMaxRetry} nudges`);Q.error(n.message),t.trigger(X.ERROR,{type:n5.MEDIA_ERROR,details:Z.BUFFER_STALLED_ERROR,error:n,fatal:!0})}}},EIr=100,DIr=class extends sMr{constructor(e,t,n){super(e,t,n,`[stream-controller]`,w5.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){let{hls:e}=this;e.on(X.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(X.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(X.MANIFEST_LOADING,this.onManifestLoading,this),e.on(X.MANIFEST_PARSED,this.onManifestParsed,this),e.on(X.LEVEL_LOADING,this.onLevelLoading,this),e.on(X.LEVEL_LOADED,this.onLevelLoaded,this),e.on(X.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(X.ERROR,this.onError,this),e.on(X.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(X.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(X.BUFFER_CREATED,this.onBufferCreated,this),e.on(X.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(X.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(X.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){let{hls:e}=this;e.off(X.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(X.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(X.MANIFEST_LOADING,this.onManifestLoading,this),e.off(X.MANIFEST_PARSED,this.onManifestParsed,this),e.off(X.LEVEL_LOADED,this.onLevelLoaded,this),e.off(X.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(X.ERROR,this.onError,this),e.off(X.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(X.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(X.BUFFER_CREATED,this.onBufferCreated,this),e.off(X.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(X.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(X.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){let{lastCurrentTime:t,hls:n}=this;if(this.stopLoad(),this.setInterval(EIr),this.level=-1,!this.startFragRequested){let e=n.startLevel;e===-1&&(n.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=n.firstAutoLevel),n.nextLoadLevel=e,this.level=n.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=$.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=$.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case $.WAITING_LEVEL:{let{levels:e,level:t}=this,n=e?.[t],r=n?.details;if(r&&(!r.live||this.levelLastLoaded===n)){if(this.waitForCdnTuneIn(r))break;this.state=$.IDLE;break}if(this.hls.nextLoadLevel!==this.level){this.state=$.IDLE;break}break}case $.FRAG_LOADING_WAITING_RETRY:{var e;let t=self.performance.now(),n=this.retryDate;if(!n||t>=n||(e=this.media)!=null&&e.seeking){let{levels:e,level:t}=this,n=e?.[t];this.resetStartWhenNotLoaded(n||null),this.state=$.IDLE}}}this.state===$.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:n,media:r}=this;if(t===null||!r&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;let i=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[i]))return;let a=n[i],o=this.getMainFwdBufferInfo();if(o===null)return;let s=this.getLevelDetails();if(s&&this._streamEnded(o,s)){let e={};this.altAudio&&(e.type=`video`),this.hls.trigger(X.BUFFER_EOS,e),this.state=$.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;let c=a.details;if(!c||this.state===$.WAITING_LEVEL||c.live&&this.levelLastLoaded!==a){this.level=i,this.state=$.WAITING_LEVEL;return}let l=o.len,u=this.getMaxBufferLength(a.maxBitrate);if(l>=u)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);let d=this.backtrackFragment?this.backtrackFragment.start:o.end,f=this.getNextFragment(d,c);if(this.couldBacktrack&&!this.fragPrevious&&f&&f.sn!==`initSegment`&&this.fragmentTracker.getState(f)!==F5.OK){let e=(this.backtrackFragment??f).sn-c.startSN,t=c.fragments[e-1];t&&f.cc===t.cc&&(f=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,d)){if(!f.gap){let e=this.audioOnly&&!this.altAudio?o5.AUDIO:o5.VIDEO,t=(e===o5.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,w5.MAIN)}f=this.getNextFragmentLoopLoading(f,c,o,w5.MAIN,u)}f&&(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,a,d))}loadFragment(e,t,n){let r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===F5.NOT_LOADED||r===F5.PARTIAL?e.sn===`initSegment`?this._loadInitSegment(e,t):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)):(this.startFragRequested=!0,super.loadFragment(e,t,n)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,w5.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,1/0)}nextLevelSwitch(){let{levels:e,media:t}=this;if(t!=null&&t.readyState){let n,r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);let i=this.getLevelDetails();if(i!=null&&i.live){let e=this.getMainFwdBufferInfo();if(!e||e.len<i.targetduration*2)return}if(!t.paused&&e){let t=e[this.hls.nextLoadLevel],r=this.fragLastKbps;n=r&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*r)+1:0}else n=0;let a=this.getBufferedFrag(t.currentTime+n);if(a){let e=this.followingBufferedFrag(a);if(e){this.abortCurrentFrag();let t=e.maxStartPTS?e.maxStartPTS:e.start,n=e.duration,r=Math.max(a.end,t+Math.min(Math.max(n-this.config.maxFragLookUpTolerance,n*(this.couldBacktrack?.5:.125)),n*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(r,1/0)}}}}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case $.KEY_LOADING:case $.FRAG_LOADING:case $.FRAG_LOADING_WAITING_RETRY:case $.PARSING:case $.PARSED:this.state=$.IDLE}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?`video`:null)}onMediaAttached(e,t){super.onMediaAttached(e,t);let n=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener(`playing`,this.onvplaying),n.addEventListener(`seeked`,this.onvseeked),this.gapController=new TIr(this.config,n,this.fragmentTracker,this.hls)}onMediaDetaching(){let{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener(`playing`,this.onvplaying),e.removeEventListener(`seeked`,this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&=(this.gapController.destroy(),null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){let e=this.media,t=e?e.currentTime:null;t5(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);let n=this.getMainFwdBufferInfo();n===null||n.len===0?this.warn(`Main forward buffer length on "seeked" event ${n?n.len:`empty`})`):this.tick()}onManifestLoading(){this.log(`Trigger BUFFER_RESET`),this.hls.trigger(X.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let n=!1,r=!1;t.levels.forEach(e=>{let t=e.audioCodec;t&&(n||=t.indexOf(`mp4a.40.2`)!==-1,r||=t.indexOf(`mp4a.40.5`)!==-1)}),this.audioCodecSwitch=n&&r&&!bIr(),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){let{levels:n}=this;if(!n||this.state!==$.IDLE)return;let r=n[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=$.WAITING_LEVEL)}onLevelLoaded(e,t){var n;let{levels:r}=this,i=t.level,a=t.details,o=a.totalduration;if(!r){this.warn(`Levels were reset while loading level ${i}`);return}this.log(`Level ${i} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:``}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);let s=r[i],c=this.fragCurrent;c&&(this.state===$.FRAG_LOADING||this.state===$.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.loader&&this.abortCurrentFrag();let l=0;if(a.live||(n=s.details)!=null&&n.live){if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;l=this.alignPlaylists(a,s.details,this.levelLastLoaded?.details)}if(s.details=a,this.levelLastLoaded=s,this.hls.trigger(X.LEVEL_UPDATED,{details:a,level:i}),this.state===$.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=$.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,l),this.tick()}_handleFragmentLoadProgress(e){let{frag:t,part:n,payload:r}=e,{levels:i}=this;if(!i){this.warn(`Levels were reset while fragment load was in progress. Fragment ${t.sn} of level ${t.level} will not be buffered`);return}let a=i[t.level],o=a.details;if(!o){this.warn(`Dropping fragment ${t.sn} of level ${t.level} after level details were reset`),this.fragmentTracker.removeFragment(t);return}let s=a.videoCodec,c=o.PTSKnown||!o.live,l=t.initSegment?.data,u=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new kNr(this.hls,w5.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=n?n.index:-1,p=f!==-1,m=new Bjr(t.level,t.sn,t.stats.chunkCount,r.byteLength,f,p),h=this.initPTS[t.cc];d.push(r,l,u,s,t,n,o.totalduration,c,m,h)}onAudioTrackSwitching(e,t){let n=this.altAudio;if(!t.url){if(this.mediaBuffer!==this.media){this.log(`Switching on main audio, use media.buffered to schedule main fragment loading`),this.mediaBuffer=this.media;let e=this.fragCurrent;e&&(this.log(`Switching to main audio track, cancel main fragment load`),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();let e=this.hls;n&&(e.trigger(X.BUFFER_FLUSHING,{startOffset:0,endOffset:1/0,type:null}),this.fragmentTracker.removeAllFragments()),e.trigger(X.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let n=t.id,r=!!this.hls.audioTracks[n].url;if(r){let e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log(`Switching on alternate audio, use video.buffered to schedule main fragment loading`),this.mediaBuffer=e)}this.altAudio=r,this.tick()}onBufferCreated(e,t){let n=t.tracks,r,i,a=!1;for(let e in n){let t=n[e];if(t.id===`main`){if(i=e,r=t,e===`video`){let t=n[e];t&&(this.videoBuffer=t.buffer)}}else a=!0}a&&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){let{frag:n,part:r}=t;if(n&&n.type!==w5.MAIN)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}`),this.state===$.PARSED&&(this.state=$.IDLE);return}let i=r?r.stats:n.stats;this.fragLastKbps=Math.round(8*i.total/(i.buffering.end-i.loading.first)),n.sn!==`initSegment`&&(this.fragPrevious=n),this.fragBufferedComplete(n,r)}onError(e,t){if(t.fatal)this.state=$.ERROR;else switch(t.details){case Z.FRAG_GAP:case Z.FRAG_PARSING_ERROR:case Z.FRAG_DECRYPT_ERROR:case Z.FRAG_LOAD_ERROR:case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_ERROR:case Z.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w5.MAIN,t);break;case Z.LEVEL_LOAD_ERROR:case Z.LEVEL_LOAD_TIMEOUT:case Z.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===$.WAITING_LEVEL&&t.context?.type===C5.LEVEL&&(this.state=$.IDLE);break;case Z.BUFFER_APPEND_ERROR:case Z.BUFFER_FULL_ERROR:if(!t.parent||t.parent!==`main`)return;if(t.details===Z.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,1/0);break;case Z.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}checkBuffer(){let{media:e,gapController:t}=this;if(e&&t&&e.readyState){if(this.loadedmetadata||!L5.getBuffered(e).length){let e=this.state===$.IDLE?null:this.fragCurrent;t.poll(this.lastCurrentTime,e)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=$.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==o5.AUDIO||this.audioOnly&&!this.altAudio){let e=(t===o5.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(e,t,w5.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){let{media:e}=this;if(!e)return;let t=e.currentTime,n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}let r=L5.getBuffered(e),i=(r.length?r.start(0):0)-n;i>0&&(i<this.config.maxBufferHole||i<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${i} to match buffer start`),n+=i,this.startPosition=n),this.log(`seek to target start position ${n} from current time ${t}`),e.currentTime=n}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log(`Swapping audio codec`),t=t.indexOf(`mp4a.40.5`)===-1?`mp4a.40.5`:`mp4a.40.2`),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(n=>{let{hls:r}=this;if(!n||this.fragContextChanged(e))return;t.fragmentError=0,this.state=$.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;let i=e.stats;i.parsing.start=i.parsing.end=i.buffering.start=i.buffering.end=self.performance.now(),r.trigger(X.FRAG_LOADED,n),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;let n=`main`,{hls:r}=this,{remuxResult:i,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}let{frag:s,part:c,level:l}=o,{video:u,text:d,id3:f,initSegment:p}=i,{details:m}=l,h=this.altAudio?void 0:i.audio;if(this.fragContextChanged(s))this.fragmentTracker.removeFragment(s);else{if(this.state=$.PARSING,p){if(p!=null&&p.tracks){let e=s.initSegment||s;this._bufferInitSegment(l,p.tracks,e,a),r.trigger(X.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:n,tracks:p.tracks})}let e=p.initPTS,t=p.timescale;t5(e)&&(this.initPTS[s.cc]={baseTime:e,timescale:t},r.trigger(X.INIT_PTS_FOUND,{frag:s,id:n,initPTS:e,timescale:t}))}if(u&&m&&s.sn!==`initSegment`){let e=m.fragments[s.sn-1-m.startSN],t=s.sn===m.startSN,n=!e||s.cc>e.cc;if(i.independent!==!1){let{startPTS:e,endPTS:r,startDTS:i,endDTS:o}=u;if(c)c.elementaryStreams[u.type]={startPTS:e,endPTS:r,startDTS:i,endDTS:o};else if(u.firstKeyFrame&&u.independent&&a.id===1&&!n&&(this.couldBacktrack=!0),u.dropped&&u.independent){let i=this.getMainFwdBufferInfo(),a=(i?i.end:this.getLoadPosition())+this.config.maxBufferHole,c=u.firstKeyFramePTS?u.firstKeyFramePTS:e;if(!t&&a<c-this.config.maxBufferHole&&!n){this.backtrack(s);return}n&&(s.gap=!0),s.setElementaryStreamInfo(u.type,s.start,r,s.start,o,!0)}else t&&e>SIr&&(s.gap=!0);s.setElementaryStreamInfo(u.type,e,r,i,o),this.backtrackFragment&&=s,this.bufferFragmentData(u,s,c,a,t||n)}else if(t||n)s.gap=!0;else{this.backtrack(s);return}}if(h){let{startPTS:e,endPTS:t,startDTS:n,endDTS:r}=h;c&&(c.elementaryStreams[o5.AUDIO]={startPTS:e,endPTS:t,startDTS:n,endDTS:r}),s.setElementaryStreamInfo(o5.AUDIO,e,t,n,r),this.bufferFragmentData(h,s,c,a)}if(m&&f!=null&&(t=f.samples)!=null&&t.length){let e={id:n,frag:s,details:m,samples:f.samples};r.trigger(X.FRAG_PARSING_METADATA,e)}if(m&&d){let e={id:n,frag:s,details:m,samples:d.samples};r.trigger(X.FRAG_PARSING_USERDATA,e)}}}_bufferInitSegment(e,t,n,r){if(this.state!==$.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;let{audio:i,video:a,audiovideo:o}=t;if(i){let t=e.audioCodec,n=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){t&&=t.indexOf(`mp4a.40.5`)===-1?`mp4a.40.5`:`mp4a.40.2`;let e=i.metadata;e&&`channelCount`in e&&(e.channelCount||1)!==1&&n.indexOf(`firefox`)===-1&&(t=`mp4a.40.5`)}t&&t.indexOf(`mp4a.40.5`)!==-1&&n.indexOf(`android`)!==-1&&i.container!==`audio/mpeg`&&(t=`mp4a.40.2`,this.log(`Android: force audio codec to ${t}`)),e.audioCodec&&e.audioCodec!==t&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${t}"`),i.levelCodec=t,i.id=`main`,this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${t||``}/${e.audioCodec||``}/${i.codec}]`)}a&&(a.levelCodec=e.videoCodec,a.id=`main`,this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||``}/${a.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(X.BUFFER_CODECS,t),Object.keys(t).forEach(e=>{let i=t[e].initSegment;i!=null&&i.byteLength&&this.hls.trigger(X.BUFFER_APPENDING,{type:e,data:i,frag:n,part:null,chunkMeta:r,parent:n.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,w5.MAIN)}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=$.IDLE}checkFragmentChanged(){let e=this.media,t=null;if(e&&e.readyState>1&&e.seeking===!1){let n=e.currentTime;if(L5.isBuffered(e,n)?t=this.getAppendedFrag(n):L5.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;let e=this.fragPlaying,n=t.level;e&&t.sn===e.sn&&e.level===n||(this.fragPlaying=t,this.hls.trigger(X.FRAG_CHANGED,{frag:t}),e&&e.level===n||this.hls.trigger(X.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){let e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){let e=this.media;if(e){let t=e.currentTime,n=this.currentFrag;if(n&&t5(t)&&t5(n.programDateTime)){let e=n.programDateTime+(t-n.start)*1e3;return new Date(e)}}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}},OIr=class e{static get version(){return`1.5.19`}static isMSESupported(){return vIr()}static isSupported(){return yIr()}static getMediaSource(){return b5()}static get Events(){return X}static get ErrorTypes(){return n5}static get ErrorDetails(){return Z}static get DefaultConfig(){return e.defaultConfig?e.defaultConfig:cIr}static set DefaultConfig(t){e.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new ONr,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.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,TOr(t.debug||!1,`Hls instance`);let n=this.config=uIr(e.DefaultConfig,t);this.userConfig=t,n.progressive&&fIr(n);let{abrController:r,bufferController:i,capLevelController:a,errorController:o,fpsController:s}=n,c=new o(this),l=this.abrController=new r(this),u=this.bufferController=new i(this),d=this.capLevelController=new a(this),f=new s(this),p=new wAr(this),m=new LAr(this),h=n.contentSteeringController,g=h?new h(this):null,_=this.levelController=new mIr(this,g),v=new Ljr(this),y=new gIr(this.config),b=this.streamController=new DIr(this,v,y);d.setStreamController(b),f.setStreamController(b);let x=[p,_,b];g&&x.splice(1,0,g),this.networkControllers=x;let S=[l,u,d,f,m,v];this.audioTrackController=this.createController(n.audioTrackController,x);let C=n.audioStreamController;C&&x.push(new C(this,v,y)),this.subtitleTrackController=this.createController(n.subtitleTrackController,x);let w=n.subtitleStreamController;w&&x.push(new w(this,v,y)),this.createController(n.timelineController,S),y.emeController=this.emeController=this.createController(n.emeController,S),this.cmcdController=this.createController(n.cmcdController,S),this.latencyController=this.createController(RAr,S),this.coreComponents=S,x.push(c);let T=c.onErrorOut;typeof T==`function`&&this.on(X.ERROR,T,c)}createController(e,t){if(e){let 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(t){if(Q.error(`An internal error happened while handling event `+e+`. Error message: "`+t.message+`". Here is a stacktrace:`,t),!this.triggeringException){this.triggeringException=!0;let n=e===X.ERROR;this.trigger(X.ERROR,{type:n5.OTHER_ERROR,details:Z.INTERNAL_EXCEPTION,fatal:n,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){Q.log(`destroy`),this.trigger(X.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;let e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){Q.log(`attachMedia`),this._media=e,this.trigger(X.MEDIA_ATTACHING,{media:e})}detachMedia(){Q.log(`detachMedia`),this.trigger(X.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();let t=this.media,n=this.url,r=this.url=hOr.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,Q.log(`loadSource:${r}`),t&&n&&(n!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(X.MANIFEST_LOADING,{url:e})}startLoad(e=-1){Q.log(`startLoad(${e})`),this.started=!0,this.resumeBuffering();for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].startLoad(e),this.started&&this.networkControllers);t++);}stopLoad(){Q.log(`stopLoad`),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!this.started&&this.networkControllers);e++);}resumeBuffering(){Q.log(`resume buffering`),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()})}pauseBuffering(){Q.log(`pause buffering`),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()})}swapAudioCodec(){Q.log(`swapAudioCodec`),this.streamController.swapAudioCodec()}recoverMediaError(){Q.log(`recoverMediaError`);let e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){return this.levelController.levels||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){Q.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){Q.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){Q.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){Q.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){let e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){Q.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){let 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(){let{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(Q.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){BAr(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(){let{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;let n=e.length;for(let r=0;r<n;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){let{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this,r;if(r=t===-1&&e!=null&&e.length?e.length-1:t,n)for(let t=r;t--;){let r=e[t].attrs[`HDCP-LEVEL`];if(r&&r<=n)return t}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()}setAudioOption(e){return this.audioTrackController?.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){let e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){let e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){let e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){let t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){let e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){let e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){let e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){let t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){let e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){let 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}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}};OIr.defaultConfig=void 0;var kIr=s(((e,t)=>{t.exports=function(e,t,a){var o=document.head||document.getElementsByTagName(`head`)[0],s=document.createElement(`script`);typeof t==`function`&&(a=t,t={}),t||={},a||=function(){},s.type=t.type||`text/javascript`,s.charset=t.charset||`utf8`,s.async=`async`in t?!!t.async:!0,s.src=e,t.attrs&&n(s,t.attrs),t.text&&(s.text=``+t.text),(`onload`in s?r:i)(s,a),s.onload||r(s,a),o.appendChild(s)};function n(e,t){for(var n in t)e.setAttribute(n,t[n])}function r(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(Error(`Failed to load `+this.src),e)}}function i(e,t){e.onreadystatechange=function(){(this.readyState==`complete`||this.readyState==`loaded`)&&(this.onreadystatechange=null,t(null,e))}}})),AIr=s(((e,t)=>{var n=function(e){return r(e)&&!i(e)};function r(e){return!!e&&typeof e==`object`}function i(e){var t=Object.prototype.toString.call(e);return t===`[object RegExp]`||t===`[object Date]`||o(e)}var a=typeof Symbol==`function`&&Symbol.for?Symbol.for(`react.element`):60103;function o(e){return e.$$typeof===a}function s(e){return Array.isArray(e)?[]:{}}function c(e,t){return t.clone!==!1&&t.isMergeableObject(e)?g(s(e),e,t):e}function l(e,t,n){return e.concat(t).map(function(e){return c(e,n)})}function u(e,t){if(!t.customMerge)return g;var n=t.customMerge(e);return typeof n==`function`?n:g}function d(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function f(e){return Object.keys(e).concat(d(e))}function p(e,t){try{return t in e}catch{return!1}}function m(e,t){return p(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function h(e,t,n){var r={};return n.isMergeableObject(e)&&f(e).forEach(function(t){r[t]=c(e[t],n)}),f(t).forEach(function(i){m(e,i)||(r[i]=p(e,i)&&n.isMergeableObject(t[i])?u(i,n)(e[i],t[i],n):c(t[i],n))}),r}function g(e,t,r){r||={},r.arrayMerge=r.arrayMerge||l,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=c;var i=Array.isArray(t);return i===Array.isArray(e)?i?r.arrayMerge(e,t,r):h(e,t,r):c(t,r)}g.all=function(e,t){if(!Array.isArray(e))throw Error(`first argument should be an array`);return e.reduce(function(e,n){return g(e,n,t)},{})},t.exports=g})),n7=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{callPlayer:()=>N,getConfig:()=>j,getSDK:()=>A,isBlobUrl:()=>P,isMediaStream:()=>ee,lazy:()=>_,omit:()=>M,parseEndTime:()=>T,parseStartTime:()=>w,queryString:()=>D,randomString:()=>E,supportsWebKitPresentationMode:()=>te}),t.exports=d(f);var p=u(m()),h=u(kIr()),g=u(AIr()),_=e=>p.default.lazy(async()=>{let t=await e();return typeof t.default==`function`?t:t.default}),v=/[?&#](?:start|t)=([0-9hms]+)/,y=/[?&#]end=([0-9hms]+)/,b=/(\d+)(h|m|s)/g,x=/^\d+$/;function S(e,t){if(e instanceof Array)return;let n=e.match(t);if(n){let e=n[1];if(e.match(b))return C(e);if(x.test(e))return parseInt(e)}}function C(e){let t=0,n=b.exec(e);for(;n!==null;){let[,r,i]=n;i===`h`&&(t+=parseInt(r,10)*60*60),i===`m`&&(t+=parseInt(r,10)*60),i===`s`&&(t+=parseInt(r,10)),n=b.exec(e)}return t}function w(e){return S(e,v)}function T(e){return S(e,y)}function E(){return Math.random().toString(36).substr(2,5)}function D(e){return Object.keys(e).map(t=>`${t}=${e[t]}`).join(`&`)}function O(e){return window[e]?window[e]:window.exports&&window.exports[e]?window.exports[e]:window.module&&window.module.exports&&window.module.exports[e]?window.module.exports[e]:null}var k={},A=ne(function(e,t,n=null,r=()=>!0,i=h.default){let a=O(t);return a&&r(a)?Promise.resolve(a):new Promise((r,a)=>{if(k[e]){k[e].push({resolve:r,reject:a});return}k[e]=[{resolve:r,reject:a}];let o=t=>{k[e].forEach(e=>e.resolve(t))};if(n){let e=window[n];window[n]=function(){e&&e(),o(O(t))}}i(e,r=>{r?(k[e].forEach(e=>e.reject(r)),k[e]=null):n||o(O(t))})})});function j(e,t){return(0,g.default)(t.config,e.config)}function M(e,...t){let n=[].concat(...t),r={},i=Object.keys(e);for(let t of i)n.indexOf(t)===-1&&(r[t]=e[t]);return r}function N(e,...t){if(!this.player||!this.player[e]){let t=`ReactPlayer: ${this.constructor.displayName} player could not call %c${e}%c \u2013 `;return this.player?this.player[e]||(t+=`The method was not available`):t+=`The player was not available`,console.warn(t,`font-weight: bold`,``),null}return this.player[e](...t)}function ee(e){return typeof window<`u`&&window.MediaStream!==void 0&&e instanceof window.MediaStream}function P(e){return/^blob:/.test(e)}function te(e=document.createElement(`video`)){let t=/iPhone|iPod/.test(navigator.userAgent)===!1;return e.webkitSupportsPresentationMode&&typeof e.webkitSetPresentationMode==`function`&&t}function ne(e){return e}})),r7=s(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AUDIO_EXTENSIONS:()=>T,DASH_EXTENSIONS:()=>O,FLV_EXTENSIONS:()=>k,HLS_EXTENSIONS:()=>D,MATCH_URL_DAILYMOTION:()=>x,MATCH_URL_FACEBOOK:()=>h,MATCH_URL_FACEBOOK_WATCH:()=>g,MATCH_URL_KALTURA:()=>w,MATCH_URL_MIXCLOUD:()=>S,MATCH_URL_MUX:()=>m,MATCH_URL_SOUNDCLOUD:()=>f,MATCH_URL_STREAMABLE:()=>_,MATCH_URL_TWITCH_CHANNEL:()=>b,MATCH_URL_TWITCH_VIDEO:()=>y,MATCH_URL_VIDYARD:()=>C,MATCH_URL_VIMEO:()=>p,MATCH_URL_WISTIA:()=>v,MATCH_URL_YOUTUBE:()=>d,VIDEO_EXTENSIONS:()=>E,canPlay:()=>j}),t.exports=c(l);var u=n7(),d=/(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//,f=/(?:soundcloud\.com|snd\.sc)\/[^.]+$/,p=/vimeo\.com\/(?!progressive_redirect).+/,m=/stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/,h=/^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/,g=/^https?:\/\/fb\.watch\/.+$/,_=/streamable\.com\/([a-z0-9]+)$/,v=/(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/,y=/(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/,b=/(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/,x=/^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?(?:[\w.#_-]+)?/,S=/mixcloud\.com\/([^/]+\/[^/]+)/,C=/vidyard.com\/(?:watch\/)?([a-zA-Z0-9-_]+)/,w=/^https?:\/\/[a-zA-Z]+\.kaltura.(com|org)\/p\/([0-9]+)\/sp\/([0-9]+)00\/embedIframeJs\/uiconf_id\/([0-9]+)\/partner_id\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_].*)$/,T=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,E=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,D=/\.(m3u8)($|\?)/i,O=/\.(mpd)($|\?)/i,k=/\.(flv)($|\?)/i,A=e=>{if(e instanceof Array){for(let t of e)if(typeof t==`string`&&A(t)||A(t.src))return!0;return!1}return(0,u.isMediaStream)(e)||(0,u.isBlobUrl)(e)?!0:T.test(e)||E.test(e)||D.test(e)||O.test(e)||k.test(e)},j={youtube:e=>e instanceof Array?e.every(e=>d.test(e)):d.test(e),soundcloud:e=>f.test(e)&&!T.test(e),vimeo:e=>p.test(e)&&!E.test(e)&&!D.test(e),mux:e=>m.test(e),facebook:e=>h.test(e)||g.test(e),streamable:e=>_.test(e),wistia:e=>v.test(e),twitch:e=>y.test(e)||b.test(e),dailymotion:e=>x.test(e),mixcloud:e=>S.test(e),vidyard:e=>C.test(e),kaltura:e=>w.test(e),file:A}})),jIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>E}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://www.youtube.com/iframe_api`,b=`YT`,x=`onYouTubeIframeAPIReady`,S=/[?&](?:list|channel)=([a-zA-Z0-9_-]+)/,C=/user\/([a-zA-Z0-9_-]+)\/?/,w=/youtube-nocookie\.com/,T=`https://www.youtube-nocookie.com`,E=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`parsePlaylist`,e=>{if(e instanceof Array)return{listType:`playlist`,playlist:e.map(this.getID).join(`,`)};if(S.test(e)){let[,t]=e.match(S);return{listType:`playlist`,list:t.replace(/^UC/,`UU`)}}if(C.test(e)){let[,t]=e.match(C);return{listType:`user_uploads`,list:t}}return{}}),p(this,`onStateChange`,e=>{let{data:t}=e,{onPlay:n,onPause:r,onBuffer:i,onBufferEnd:a,onEnded:o,onReady:s,loop:c,config:{playerVars:l,onUnstarted:u}}=this.props,{UNSTARTED:d,PLAYING:f,PAUSED:p,BUFFERING:m,ENDED:h,CUED:g}=window[b].PlayerState;if(t===d&&u(),t===f&&(n(),a()),t===p&&r(),t===m&&i(),t===h){let e=!!this.callPlayer(`getPlaylist`);c&&!e&&(l.start?this.seekTo(l.start):this.play()),o()}t===g&&s()}),p(this,`mute`,()=>{this.callPlayer(`mute`)}),p(this,`unmute`,()=>{this.callPlayer(`unMute`)}),p(this,`ref`,e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}getID(e){return!e||e instanceof Array||S.test(e)?null:e.match(v.MATCH_URL_YOUTUBE)[1]}load(e,t){let{playing:n,muted:r,playsinline:i,controls:a,loop:o,config:s,onError:c}=this.props,{playerVars:l,embedOptions:u}=s,d=this.getID(e);if(t){if(S.test(e)||C.test(e)||e instanceof Array){this.player.loadPlaylist(this.parsePlaylist(e));return}this.player.cueVideoById({videoId:d,startSeconds:(0,_.parseStartTime)(e)||l.start,endSeconds:(0,_.parseEndTime)(e)||l.end})}else(0,_.getSDK)(y,b,x,e=>e.loaded).then(t=>{this.container&&(this.player=new t.Player(this.container,{width:`100%`,height:`100%`,videoId:d,playerVars:{autoplay:+!!n,mute:+!!r,controls:+!!a,start:(0,_.parseStartTime)(e),end:(0,_.parseEndTime)(e),origin:window.location.origin,playsinline:+!!i,...this.parsePlaylist(e),...l},events:{onReady:()=>{o&&this.player.setLoop(!0),this.props.onReady()},onPlaybackRateChange:e=>this.props.onPlaybackRateChange(e.data),onPlaybackQualityChange:e=>this.props.onPlaybackQualityChange(e),onStateChange:this.onStateChange,onError:e=>c(e.data)},host:w.test(e)?T:void 0,...u}))},c),u.events&&console.warn("Using `embedOptions.events` will likely break things. Use ReactPlayer’s callback props instead, eg onReady, onPlay, onPause")}play(){this.callPlayer(`playVideo`)}pause(){this.callPlayer(`pauseVideo`)}stop(){document.body.contains(this.callPlayer(`getIframe`))&&this.callPlayer(`stopVideo`)}seekTo(e,t=!1){this.callPlayer(`seekTo`,e),!t&&!this.props.playing&&this.pause()}setVolume(e){this.callPlayer(`setVolume`,e*100)}setPlaybackRate(e){this.callPlayer(`setPlaybackRate`,e)}setLoop(e){this.callPlayer(`setLoop`,e)}getDuration(){return this.callPlayer(`getDuration`)}getCurrentTime(){return this.callPlayer(`getCurrentTime`)}getSecondsLoaded(){return this.callPlayer(`getVideoLoadedFraction`)*this.getDuration()}render(){let{display:e}=this.props,t={width:`100%`,height:`100%`,display:e};return g.default.createElement(`div`,{style:t},g.default.createElement(`div`,{ref:this.ref}))}};p(E,`displayName`,`YouTube`),p(E,`canPlay`,v.canPlay.youtube)})),MIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>x}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://w.soundcloud.com/player/api.js`,b=`SC`,x=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`duration`,null),p(this,`currentTime`,null),p(this,`fractionLoaded`,null),p(this,`mute`,()=>{this.setVolume(0)}),p(this,`unmute`,()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),p(this,`ref`,e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,t){(0,_.getSDK)(y,b).then(n=>{if(!this.iframe)return;let{PLAY:r,PLAY_PROGRESS:i,PAUSE:a,FINISH:o,ERROR:s}=n.Widget.Events;t||(this.player=n.Widget(this.iframe),this.player.bind(r,this.props.onPlay),this.player.bind(a,()=>{this.duration-this.currentTime<.05||this.props.onPause()}),this.player.bind(i,e=>{this.currentTime=e.currentPosition/1e3,this.fractionLoaded=e.loadedProgress}),this.player.bind(o,()=>this.props.onEnded()),this.player.bind(s,e=>this.props.onError(e))),this.player.load(e,{...this.props.config.options,callback:()=>{this.player.getDuration(e=>{this.duration=e/1e3,this.props.onReady()})}})})}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`seekTo`,e*1e3),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e*100)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.fractionLoaded*this.duration}render(){let{display:e}=this.props,t={width:`100%`,height:`100%`,display:e};return g.default.createElement(`iframe`,{ref:this.ref,src:`https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,style:t,frameBorder:0,allow:`autoplay`})}};p(x,`displayName`,`SoundCloud`),p(x,`canPlay`,v.canPlay.soundcloud),p(x,`loopOnEnded`,!0)})),NIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>S}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://player.vimeo.com/api/player.js`,b=`Vimeo`,x=e=>e.replace(`/manage/videos`,``),S=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`duration`,null),p(this,`currentTime`,null),p(this,`secondsLoaded`,null),p(this,`mute`,()=>{this.setMuted(!0)}),p(this,`unmute`,()=>{this.setMuted(!1)}),p(this,`ref`,e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){this.duration=null,(0,_.getSDK)(y,b).then(t=>{if(!this.container)return;let{playerOptions:n,title:r}=this.props.config;this.player=new t.Player(this.container,{url:x(e),autoplay:this.props.playing,muted:this.props.muted,loop:this.props.loop,playsinline:this.props.playsinline,controls:this.props.controls,...n}),this.player.ready().then(()=>{let e=this.container.querySelector(`iframe`);e.style.width=`100%`,e.style.height=`100%`,r&&(e.title=r)}).catch(this.props.onError),this.player.on(`loaded`,()=>{this.props.onReady(),this.refreshDuration()}),this.player.on(`play`,()=>{this.props.onPlay(),this.refreshDuration()}),this.player.on(`pause`,this.props.onPause),this.player.on(`seeked`,e=>this.props.onSeek(e.seconds)),this.player.on(`ended`,this.props.onEnded),this.player.on(`error`,this.props.onError),this.player.on(`timeupdate`,({seconds:e})=>{this.currentTime=e}),this.player.on(`progress`,({seconds:e})=>{this.secondsLoaded=e}),this.player.on(`bufferstart`,this.props.onBuffer),this.player.on(`bufferend`,this.props.onBufferEnd),this.player.on(`playbackratechange`,e=>this.props.onPlaybackRateChange(e.playbackRate))},this.props.onError)}refreshDuration(){this.player.getDuration().then(e=>{this.duration=e})}play(){let e=this.callPlayer(`play`);e&&e.catch(this.props.onError)}pause(){this.callPlayer(`pause`)}stop(){this.callPlayer(`unload`)}seekTo(e,t=!0){this.callPlayer(`setCurrentTime`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}setMuted(e){this.callPlayer(`setMuted`,e)}setLoop(e){this.callPlayer(`setLoop`,e)}setPlaybackRate(e){this.callPlayer(`setPlaybackRate`,e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){let{display:e}=this.props,t={width:`100%`,height:`100%`,overflow:`hidden`,display:e};return g.default.createElement(`div`,{key:this.props.url,ref:this.ref,style:t})}};p(S,`displayName`,`Vimeo`),p(S,`canPlay`,v.canPlay.vimeo),p(S,`forceLoad`,!0)})),PIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>y}),t.exports=f(h);var g=d(m()),_=r7(),v=`https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs`,y=class extends g.Component{constructor(){super(...arguments),p(this,`onReady`,(...e)=>this.props.onReady(...e)),p(this,`onPlay`,(...e)=>this.props.onPlay(...e)),p(this,`onBuffer`,(...e)=>this.props.onBuffer(...e)),p(this,`onBufferEnd`,(...e)=>this.props.onBufferEnd(...e)),p(this,`onPause`,(...e)=>this.props.onPause(...e)),p(this,`onEnded`,(...e)=>this.props.onEnded(...e)),p(this,`onError`,(...e)=>this.props.onError(...e)),p(this,`onPlayBackRateChange`,e=>this.props.onPlaybackRateChange(e.target.playbackRate)),p(this,`onEnablePIP`,(...e)=>this.props.onEnablePIP(...e)),p(this,`onSeek`,e=>{this.props.onSeek(e.target.currentTime)}),p(this,`onDurationChange`,()=>{let e=this.getDuration();this.props.onDuration(e)}),p(this,`mute`,()=>{this.player.muted=!0}),p(this,`unmute`,()=>{this.player.muted=!1}),p(this,`ref`,e=>{this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);let e=this.getPlaybackId(this.props.url);e&&(this.player.playbackId=e)}componentWillUnmount(){this.player.playbackId=null,this.removeListeners(this.player)}addListeners(e){let{playsinline:t}=this.props;e.addEventListener(`play`,this.onPlay),e.addEventListener(`waiting`,this.onBuffer),e.addEventListener(`playing`,this.onBufferEnd),e.addEventListener(`pause`,this.onPause),e.addEventListener(`seeked`,this.onSeek),e.addEventListener(`ended`,this.onEnded),e.addEventListener(`error`,this.onError),e.addEventListener(`ratechange`,this.onPlayBackRateChange),e.addEventListener(`enterpictureinpicture`,this.onEnablePIP),e.addEventListener(`leavepictureinpicture`,this.onDisablePIP),e.addEventListener(`webkitpresentationmodechanged`,this.onPresentationModeChange),e.addEventListener(`canplay`,this.onReady),t&&e.setAttribute(`playsinline`,``)}removeListeners(e){e.removeEventListener(`canplay`,this.onReady),e.removeEventListener(`play`,this.onPlay),e.removeEventListener(`waiting`,this.onBuffer),e.removeEventListener(`playing`,this.onBufferEnd),e.removeEventListener(`pause`,this.onPause),e.removeEventListener(`seeked`,this.onSeek),e.removeEventListener(`ended`,this.onEnded),e.removeEventListener(`error`,this.onError),e.removeEventListener(`ratechange`,this.onPlayBackRateChange),e.removeEventListener(`enterpictureinpicture`,this.onEnablePIP),e.removeEventListener(`leavepictureinpicture`,this.onDisablePIP),e.removeEventListener(`canplay`,this.onReady)}async load(e){let{onError:t,config:n}=this.props;if(!globalThis.customElements?.get(`mux-player`))try{await import(`${v.replace(`VERSION`,n.version)}`),this.props.onLoaded()}catch(e){t(e)}let[,r]=e.match(_.MATCH_URL_MUX);this.player.playbackId=r}play(){let e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.playbackId=null}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player&&this.player.requestPictureInPicture()}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player&&document.exitPictureInPicture()}setPlaybackRate(e){try{this.player.playbackRate=e}catch(e){this.props.onError(e)}}getDuration(){if(!this.player)return null;let{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;let{buffered:e}=this.player;if(e.length===0)return 0;let t=e.end(e.length-1),n=this.getDuration();return t>n?n:t}getPlaybackId(e){let[,t]=e.match(_.MATCH_URL_MUX);return t}render(){let{url:e,playing:t,loop:n,controls:r,muted:i,config:a,width:o,height:s}=this.props,c={width:o===`auto`?o:`100%`,height:s===`auto`?s:`100%`};return r===!1&&(c[`--controls`]=`none`),g.default.createElement(`mux-player`,{ref:this.ref,"playback-id":this.getPlaybackId(e),style:c,preload:`auto`,autoPlay:t||void 0,muted:i?``:void 0,loop:n?``:void 0,...a.attributes})}};p(y,`displayName`,`Mux`),p(y,`canPlay`,_.canPlay.mux)})),FIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>C}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://connect.facebook.net/en_US/sdk.js`,b=`FB`,x=`fbAsyncInit`,S=`facebook-player-`,C=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`playerID`,this.props.config.playerId||`${S}${(0,_.randomString)()}`),p(this,`mute`,()=>{this.callPlayer(`mute`)}),p(this,`unmute`,()=>{this.callPlayer(`unmute`)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,t){t?(0,_.getSDK)(y,b,x).then(e=>e.XFBML.parse()):(0,_.getSDK)(y,b,x).then(e=>{e.init({appId:this.props.config.appId,xfbml:!0,version:this.props.config.version}),e.Event.subscribe(`xfbml.render`,e=>{this.props.onLoaded()}),e.Event.subscribe(`xfbml.ready`,e=>{e.type===`video`&&e.id===this.playerID&&(this.player=e.instance,this.player.subscribe(`startedPlaying`,this.props.onPlay),this.player.subscribe(`paused`,this.props.onPause),this.player.subscribe(`finishedPlaying`,this.props.onEnded),this.player.subscribe(`startedBuffering`,this.props.onBuffer),this.player.subscribe(`finishedBuffering`,this.props.onBufferEnd),this.player.subscribe(`error`,this.props.onError),this.props.muted?this.callPlayer(`mute`):this.callPlayer(`unmute`),this.props.onReady(),document.getElementById(this.playerID).querySelector(`iframe`).style.visibility=`visible`)})})}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`seek`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}getDuration(){return this.callPlayer(`getDuration`)}getCurrentTime(){return this.callPlayer(`getCurrentPosition`)}getSecondsLoaded(){return null}render(){let{attributes:e}=this.props.config;return g.default.createElement(`div`,{style:{width:`100%`,height:`100%`},id:this.playerID,className:`fb-video`,"data-href":this.props.url,"data-autoplay":this.props.playing?`true`:`false`,"data-allowfullscreen":`true`,"data-controls":this.props.controls?`true`:`false`,...e})}};p(C,`displayName`,`Facebook`),p(C,`canPlay`,v.canPlay.facebook),p(C,`loopOnEnded`,!0)})),IIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>x}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://cdn.embed.ly/player-0.1.0.min.js`,b=`playerjs`,x=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`duration`,null),p(this,`currentTime`,null),p(this,`secondsLoaded`,null),p(this,`mute`,()=>{this.callPlayer(`mute`)}),p(this,`unmute`,()=>{this.callPlayer(`unmute`)}),p(this,`ref`,e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,_.getSDK)(y,b).then(e=>{this.iframe&&(this.player=new e.Player(this.iframe),this.player.setLoop(this.props.loop),this.player.on(`ready`,this.props.onReady),this.player.on(`play`,this.props.onPlay),this.player.on(`pause`,this.props.onPause),this.player.on(`seeked`,this.props.onSeek),this.player.on(`ended`,this.props.onEnded),this.player.on(`error`,this.props.onError),this.player.on(`timeupdate`,({duration:e,seconds:t})=>{this.duration=e,this.currentTime=t}),this.player.on(`buffered`,({percent:e})=>{this.duration&&(this.secondsLoaded=this.duration*e)}),this.props.muted&&this.player.mute())},this.props.onError)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`setCurrentTime`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e*100)}setLoop(e){this.callPlayer(`setLoop`,e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){let e=this.props.url.match(v.MATCH_URL_STREAMABLE)[1];return g.default.createElement(`iframe`,{ref:this.ref,src:`https://streamable.com/o/${e}`,frameBorder:`0`,scrolling:`no`,style:{width:`100%`,height:`100%`},allow:`encrypted-media; autoplay; fullscreen;`})}};p(x,`displayName`,`Streamable`),p(x,`canPlay`,v.canPlay.streamable)})),LIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>S}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://fast.wistia.com/assets/external/E-v1.js`,b=`Wistia`,x=`wistia-player-`,S=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`playerID`,this.props.config.playerId||`${x}${(0,_.randomString)()}`),p(this,`onPlay`,(...e)=>this.props.onPlay(...e)),p(this,`onPause`,(...e)=>this.props.onPause(...e)),p(this,`onSeek`,(...e)=>this.props.onSeek(...e)),p(this,`onEnded`,(...e)=>this.props.onEnded(...e)),p(this,`onPlaybackRateChange`,(...e)=>this.props.onPlaybackRateChange(...e)),p(this,`mute`,()=>{this.callPlayer(`mute`)}),p(this,`unmute`,()=>{this.callPlayer(`unmute`)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){let{playing:t,muted:n,controls:r,onReady:i,config:a,onError:o}=this.props;(0,_.getSDK)(y,b).then(e=>{a.customControls&&a.customControls.forEach(t=>e.defineControl(t)),window._wq=window._wq||[],window._wq.push({id:this.playerID,options:{autoPlay:t,silentAutoPlay:`allow`,muted:n,controlsVisibleOnLoad:r,fullscreenButton:r,playbar:r,playbackRateControl:r,qualityControl:r,volumeControl:r,settingsControl:r,smallPlayButton:r,...a.options},onReady:e=>{this.player=e,this.unbind(),this.player.bind(`play`,this.onPlay),this.player.bind(`pause`,this.onPause),this.player.bind(`seek`,this.onSeek),this.player.bind(`end`,this.onEnded),this.player.bind(`playbackratechange`,this.onPlaybackRateChange),i()}})},o)}unbind(){this.player.unbind(`play`,this.onPlay),this.player.unbind(`pause`,this.onPause),this.player.unbind(`seek`,this.onSeek),this.player.unbind(`end`,this.onEnded),this.player.unbind(`playbackratechange`,this.onPlaybackRateChange)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){this.unbind(),this.callPlayer(`remove`)}seekTo(e,t=!0){this.callPlayer(`time`,e),t||this.pause()}setVolume(e){this.callPlayer(`volume`,e)}setPlaybackRate(e){this.callPlayer(`playbackRate`,e)}getDuration(){return this.callPlayer(`duration`)}getCurrentTime(){return this.callPlayer(`time`)}getSecondsLoaded(){return null}render(){let{url:e}=this.props,t=e&&e.match(v.MATCH_URL_WISTIA)[1],n=`wistia_embed wistia_async_${t}`;return g.default.createElement(`div`,{id:this.playerID,key:t,className:n,style:{width:`100%`,height:`100%`}})}};p(S,`displayName`,`Wistia`),p(S,`canPlay`,v.canPlay.wistia),p(S,`loopOnEnded`,!0)})),RIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>S}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://player.twitch.tv/js/embed/v1.js`,b=`Twitch`,x=`twitch-player-`,S=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`playerID`,this.props.config.playerId||`${x}${(0,_.randomString)()}`),p(this,`mute`,()=>{this.callPlayer(`setMuted`,!0)}),p(this,`unmute`,()=>{this.callPlayer(`setMuted`,!1)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,t){let{playsinline:n,onError:r,config:i,controls:a}=this.props,o=v.MATCH_URL_TWITCH_CHANNEL.test(e),s=o?e.match(v.MATCH_URL_TWITCH_CHANNEL)[1]:e.match(v.MATCH_URL_TWITCH_VIDEO)[1];t?o?this.player.setChannel(s):this.player.setVideo(`v`+s):(0,_.getSDK)(y,b).then(t=>{this.player=new t.Player(this.playerID,{video:o?``:s,channel:o?s:``,height:`100%`,width:`100%`,playsinline:n,autoplay:this.props.playing,muted:this.props.muted,controls:o?!0:a,time:(0,_.parseStartTime)(e),...i.options});let{READY:r,PLAYING:c,PAUSE:l,ENDED:u,ONLINE:d,OFFLINE:f,SEEK:p}=t.Player;this.player.addEventListener(r,this.props.onReady),this.player.addEventListener(c,this.props.onPlay),this.player.addEventListener(l,this.props.onPause),this.player.addEventListener(u,this.props.onEnded),this.player.addEventListener(p,this.props.onSeek),this.player.addEventListener(d,this.props.onLoaded),this.player.addEventListener(f,this.props.onLoaded)},r)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){this.callPlayer(`pause`)}seekTo(e,t=!0){this.callPlayer(`seek`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}getDuration(){return this.callPlayer(`getDuration`)}getCurrentTime(){return this.callPlayer(`getCurrentTime`)}getSecondsLoaded(){return null}render(){return g.default.createElement(`div`,{style:{width:`100%`,height:`100%`},id:this.playerID})}};p(S,`displayName`,`Twitch`),p(S,`canPlay`,v.canPlay.twitch),p(S,`loopOnEnded`,!0)})),zIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>S}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://api.dmcdn.net/all.js`,b=`DM`,x=`dmAsyncInit`,S=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`onDurationChange`,()=>{let e=this.getDuration();this.props.onDuration(e)}),p(this,`mute`,()=>{this.callPlayer(`setMuted`,!0)}),p(this,`unmute`,()=>{this.callPlayer(`setMuted`,!1)}),p(this,`ref`,e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){let{controls:t,config:n,onError:r,playing:i}=this.props,[,a]=e.match(v.MATCH_URL_DAILYMOTION);this.player?this.player.load(a,{start:(0,_.parseStartTime)(e),autoplay:i}):(0,_.getSDK)(y,b,x,e=>e.player).then(i=>{if(!this.container)return;let o=i.player;this.player=new o(this.container,{width:`100%`,height:`100%`,video:a,params:{controls:t,autoplay:this.props.playing,mute:this.props.muted,start:(0,_.parseStartTime)(e),origin:window.location.origin,...n.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:e=>r(e)}})},r)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`seek`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){let{display:e}=this.props,t={width:`100%`,height:`100%`,display:e};return g.default.createElement(`div`,{style:t},g.default.createElement(`div`,{ref:this.ref}))}};p(S,`displayName`,`DailyMotion`),p(S,`canPlay`,v.canPlay.dailymotion),p(S,`loopOnEnded`,!0)})),BIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>x}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://widget.mixcloud.com/media/js/widgetApi.js`,b=`Mixcloud`,x=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`duration`,null),p(this,`currentTime`,null),p(this,`secondsLoaded`,null),p(this,`mute`,()=>{}),p(this,`unmute`,()=>{}),p(this,`ref`,e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,_.getSDK)(y,b).then(e=>{this.player=e.PlayerWidget(this.iframe),this.player.ready.then(()=>{this.player.events.play.on(this.props.onPlay),this.player.events.pause.on(this.props.onPause),this.player.events.ended.on(this.props.onEnded),this.player.events.error.on(this.props.error),this.player.events.progress.on((e,t)=>{this.currentTime=e,this.duration=t}),this.props.onReady()})},this.props.onError)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`seek`,e),t||this.pause()}setVolume(e){}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return null}render(){let{url:e,config:t}=this.props,n=e.match(v.MATCH_URL_MIXCLOUD)[1],r={width:`100%`,height:`100%`},i=(0,_.queryString)({...t.options,feed:`/${n}/`});return g.default.createElement(`iframe`,{key:n,ref:this.ref,style:r,src:`https://player-widget.mixcloud.com/widget/iframe/?${i}`,frameBorder:`0`,allow:`autoplay`})}};p(x,`displayName`,`Mixcloud`),p(x,`canPlay`,v.canPlay.mixcloud),p(x,`loopOnEnded`,!0)})),VIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>S}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://play.vidyard.com/embed/v4.js`,b=`VidyardV4`,x=`onVidyardAPI`,S=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`mute`,()=>{this.setVolume(0)}),p(this,`unmute`,()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),p(this,`ref`,e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){let{playing:t,config:n,onError:r,onDuration:i}=this.props,a=e&&e.match(v.MATCH_URL_VIDYARD)[1];this.player&&this.stop(),(0,_.getSDK)(y,b,x).then(e=>{this.container&&(e.api.addReadyListener((e,t)=>{this.player||(this.player=t,this.player.on(`ready`,this.props.onReady),this.player.on(`play`,this.props.onPlay),this.player.on(`pause`,this.props.onPause),this.player.on(`seek`,this.props.onSeek),this.player.on(`playerComplete`,this.props.onEnded))},a),e.api.renderPlayer({uuid:a,container:this.container,autoplay:+!!t,...n.options}),e.api.getPlayerMetadata(a).then(e=>{this.duration=e.length_in_seconds,i(e.length_in_seconds)}))},r)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){window.VidyardV4.api.destroyPlayer(this.player)}seekTo(e,t=!0){this.callPlayer(`seek`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}setPlaybackRate(e){this.callPlayer(`setPlaybackSpeed`,e)}getDuration(){return this.duration}getCurrentTime(){return this.callPlayer(`currentTime`)}getSecondsLoaded(){return null}render(){let{display:e}=this.props,t={width:`100%`,height:`100%`,display:e};return g.default.createElement(`div`,{style:t},g.default.createElement(`div`,{ref:this.ref}))}};p(S,`displayName`,`Vidyard`),p(S,`canPlay`,v.canPlay.vidyard)})),HIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>x}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://cdn.embed.ly/player-0.1.0.min.js`,b=`playerjs`,x=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`duration`,null),p(this,`currentTime`,null),p(this,`secondsLoaded`,null),p(this,`mute`,()=>{this.callPlayer(`mute`)}),p(this,`unmute`,()=>{this.callPlayer(`unmute`)}),p(this,`ref`,e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,_.getSDK)(y,b).then(e=>{this.iframe&&(this.player=new e.Player(this.iframe),this.player.on(`ready`,()=>{setTimeout(()=>{this.player.isReady=!0,this.player.setLoop(this.props.loop),this.props.muted&&this.player.mute(),this.addListeners(this.player,this.props),this.props.onReady()},500)}))},this.props.onError)}addListeners(e,t){e.on(`play`,t.onPlay),e.on(`pause`,t.onPause),e.on(`ended`,t.onEnded),e.on(`error`,t.onError),e.on(`timeupdate`,({duration:e,seconds:t})=>{this.duration=e,this.currentTime=t})}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`setCurrentTime`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}setLoop(e){this.callPlayer(`setLoop`,e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){return g.default.createElement(`iframe`,{ref:this.ref,src:this.props.url,frameBorder:`0`,scrolling:`no`,style:{width:`100%`,height:`100%`},allow:`encrypted-media; autoplay; fullscreen;`,referrerPolicy:`no-referrer-when-downgrade`})}};p(x,`displayName`,`Kaltura`),p(x,`canPlay`,v.canPlay.kaltura)})),UIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>M}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=typeof navigator<`u`,b=y&&navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,x=y&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||b)&&!window.MSStream,S=y&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!window.MSStream,C=`https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js`,w=`Hls`,T=`https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js`,E=`dashjs`,D=`https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js`,O=`flvjs`,k=/www\.dropbox\.com\/.+/,A=/https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/,j=`https://videodelivery.net/{id}/manifest/video.m3u8`,M=class extends g.Component{constructor(){super(...arguments),p(this,`onReady`,(...e)=>this.props.onReady(...e)),p(this,`onPlay`,(...e)=>this.props.onPlay(...e)),p(this,`onBuffer`,(...e)=>this.props.onBuffer(...e)),p(this,`onBufferEnd`,(...e)=>this.props.onBufferEnd(...e)),p(this,`onPause`,(...e)=>this.props.onPause(...e)),p(this,`onEnded`,(...e)=>this.props.onEnded(...e)),p(this,`onError`,(...e)=>this.props.onError(...e)),p(this,`onPlayBackRateChange`,e=>this.props.onPlaybackRateChange(e.target.playbackRate)),p(this,`onEnablePIP`,(...e)=>this.props.onEnablePIP(...e)),p(this,`onDisablePIP`,e=>{let{onDisablePIP:t,playing:n}=this.props;t(e),n&&this.play()}),p(this,`onPresentationModeChange`,e=>{if(this.player&&(0,_.supportsWebKitPresentationMode)(this.player)){let{webkitPresentationMode:t}=this.player;t===`picture-in-picture`?this.onEnablePIP(e):t===`inline`&&this.onDisablePIP(e)}}),p(this,`onSeek`,e=>{this.props.onSeek(e.target.currentTime)}),p(this,`mute`,()=>{this.player.muted=!0}),p(this,`unmute`,()=>{this.player.muted=!1}),p(this,`renderSourceElement`,(e,t)=>typeof e==`string`?g.default.createElement(`source`,{key:t,src:e}):g.default.createElement(`source`,{key:t,...e})),p(this,`renderTrack`,(e,t)=>g.default.createElement(`track`,{key:t,...e})),p(this,`ref`,e=>{this.player&&(this.prevPlayer=this.player),this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);let e=this.getSource(this.props.url);e&&(this.player.src=e),(x||this.props.config.forceDisableHls)&&this.player.load()}componentDidUpdate(e){this.shouldUseAudio(this.props)!==this.shouldUseAudio(e)&&(this.removeListeners(this.prevPlayer,e.url),this.addListeners(this.player)),this.props.url!==e.url&&!(0,_.isMediaStream)(this.props.url)&&!(this.props.url instanceof Array)&&(this.player.srcObject=null)}componentWillUnmount(){this.player.removeAttribute(`src`),this.removeListeners(this.player),this.hls&&this.hls.destroy()}addListeners(e){let{url:t,playsinline:n}=this.props;e.addEventListener(`play`,this.onPlay),e.addEventListener(`waiting`,this.onBuffer),e.addEventListener(`playing`,this.onBufferEnd),e.addEventListener(`pause`,this.onPause),e.addEventListener(`seeked`,this.onSeek),e.addEventListener(`ended`,this.onEnded),e.addEventListener(`error`,this.onError),e.addEventListener(`ratechange`,this.onPlayBackRateChange),e.addEventListener(`enterpictureinpicture`,this.onEnablePIP),e.addEventListener(`leavepictureinpicture`,this.onDisablePIP),e.addEventListener(`webkitpresentationmodechanged`,this.onPresentationModeChange),this.shouldUseHLS(t)||e.addEventListener(`canplay`,this.onReady),n&&(e.setAttribute(`playsinline`,``),e.setAttribute(`webkit-playsinline`,``),e.setAttribute(`x5-playsinline`,``))}removeListeners(e,t){e.removeEventListener(`canplay`,this.onReady),e.removeEventListener(`play`,this.onPlay),e.removeEventListener(`waiting`,this.onBuffer),e.removeEventListener(`playing`,this.onBufferEnd),e.removeEventListener(`pause`,this.onPause),e.removeEventListener(`seeked`,this.onSeek),e.removeEventListener(`ended`,this.onEnded),e.removeEventListener(`error`,this.onError),e.removeEventListener(`ratechange`,this.onPlayBackRateChange),e.removeEventListener(`enterpictureinpicture`,this.onEnablePIP),e.removeEventListener(`leavepictureinpicture`,this.onDisablePIP),e.removeEventListener(`webkitpresentationmodechanged`,this.onPresentationModeChange),this.shouldUseHLS(t)||e.removeEventListener(`canplay`,this.onReady)}shouldUseAudio(e){return e.config.forceVideo||e.config.attributes.poster?!1:v.AUDIO_EXTENSIONS.test(e.url)||e.config.forceAudio}shouldUseHLS(e){return S&&this.props.config.forceSafariHLS||this.props.config.forceHLS?!0:x||this.props.config.forceDisableHls?!1:v.HLS_EXTENSIONS.test(e)||A.test(e)}shouldUseDASH(e){return v.DASH_EXTENSIONS.test(e)||this.props.config.forceDASH}shouldUseFLV(e){return v.FLV_EXTENSIONS.test(e)||this.props.config.forceFLV}load(e){let{hlsVersion:t,hlsOptions:n,dashVersion:r,flvVersion:i}=this.props.config;if(this.hls&&this.hls.destroy(),this.dash&&this.dash.reset(),this.shouldUseHLS(e)&&(0,_.getSDK)(C.replace(`VERSION`,t),w).then(t=>{if(this.hls=new t(n),this.hls.on(t.Events.MANIFEST_PARSED,()=>{this.props.onReady()}),this.hls.on(t.Events.ERROR,(e,n)=>{this.props.onError(e,n,this.hls,t)}),A.test(e)){let t=e.match(A)[1];this.hls.loadSource(j.replace(`{id}`,t))}else this.hls.loadSource(e);this.hls.attachMedia(this.player),this.props.onLoaded()}),this.shouldUseDASH(e)&&(0,_.getSDK)(T.replace(`VERSION`,r),E).then(t=>{this.dash=t.MediaPlayer().create(),this.dash.initialize(this.player,e,this.props.playing),this.dash.on(`error`,this.props.onError),parseInt(r)<3?this.dash.getDebug().setLogToBrowserConsole(!1):this.dash.updateSettings({debug:{logLevel:t.Debug.LOG_LEVEL_NONE}}),this.props.onLoaded()}),this.shouldUseFLV(e)&&(0,_.getSDK)(D.replace(`VERSION`,i),O).then(t=>{this.flv=t.createPlayer({type:`flv`,url:e}),this.flv.attachMediaElement(this.player),this.flv.on(t.Events.ERROR,(e,n)=>{this.props.onError(e,n,this.flv,t)}),this.flv.load(),this.props.onLoaded()}),e instanceof Array)this.player.load();else if((0,_.isMediaStream)(e))try{this.player.srcObject=e}catch{this.player.src=window.URL.createObjectURL(e)}}play(){let e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.removeAttribute(`src`),this.dash&&this.dash.reset()}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player?this.player.requestPictureInPicture():(0,_.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!==`picture-in-picture`&&this.player.webkitSetPresentationMode(`picture-in-picture`)}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player?document.exitPictureInPicture():(0,_.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!==`inline`&&this.player.webkitSetPresentationMode(`inline`)}setPlaybackRate(e){try{this.player.playbackRate=e}catch(e){this.props.onError(e)}}getDuration(){if(!this.player)return null;let{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;let{buffered:e}=this.player;if(e.length===0)return 0;let t=e.end(e.length-1),n=this.getDuration();return t>n?n:t}getSource(e){let t=this.shouldUseHLS(e),n=this.shouldUseDASH(e),r=this.shouldUseFLV(e);if(!(e instanceof Array||(0,_.isMediaStream)(e)||t||n||r))return k.test(e)?e.replace(`www.dropbox.com`,`dl.dropboxusercontent.com`):e}render(){let{url:e,playing:t,loop:n,controls:r,muted:i,config:a,width:o,height:s}=this.props,c=this.shouldUseAudio(this.props)?`audio`:`video`,l={width:o===`auto`?o:`100%`,height:s===`auto`?s:`100%`};return g.default.createElement(c,{ref:this.ref,src:this.getSource(e),style:l,preload:`auto`,autoPlay:t||void 0,controls:r,muted:i,loop:n,...a.attributes},e instanceof Array&&e.map(this.renderSourceElement),a.tracks.map(this.renderTrack))}};p(M,`displayName`,`FilePlayer`),p(M,`canPlay`,v.canPlay.file)})),WIr=s(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{default:()=>p}),t.exports=c(l);var d=n7(),f=r7(),p=[{key:`youtube`,name:`YouTube`,canPlay:f.canPlay.youtube,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(jIr())))},{key:`soundcloud`,name:`SoundCloud`,canPlay:f.canPlay.soundcloud,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(MIr())))},{key:`vimeo`,name:`Vimeo`,canPlay:f.canPlay.vimeo,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(NIr())))},{key:`mux`,name:`Mux`,canPlay:f.canPlay.mux,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(PIr())))},{key:`facebook`,name:`Facebook`,canPlay:f.canPlay.facebook,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(FIr())))},{key:`streamable`,name:`Streamable`,canPlay:f.canPlay.streamable,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(IIr())))},{key:`wistia`,name:`Wistia`,canPlay:f.canPlay.wistia,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(LIr())))},{key:`twitch`,name:`Twitch`,canPlay:f.canPlay.twitch,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(RIr())))},{key:`dailymotion`,name:`DailyMotion`,canPlay:f.canPlay.dailymotion,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(zIr())))},{key:`mixcloud`,name:`Mixcloud`,canPlay:f.canPlay.mixcloud,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(BIr())))},{key:`vidyard`,name:`Vidyard`,canPlay:f.canPlay.vidyard,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(VIr())))},{key:`kaltura`,name:`Kaltura`,canPlay:f.canPlay.kaltura,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(HIr())))},{key:`file`,name:`FilePlayer`,canPlay:f.canPlay.file,canEnablePIP:e=>f.canPlay.file(e)&&(document.pictureInPictureEnabled||(0,d.supportsWebKitPresentationMode)())&&!f.AUDIO_EXTENSIONS.test(e),lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(UIr())))}]})),GIr=c({default:()=>JIr});function KIr(e,t){return!!(e===t||YIr(e)&&YIr(t))}function qIr(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!KIr(e[n],t[n]))return!1;return!0}function JIr(e,t){t===void 0&&(t=qIr);var n,r=[],i,a=!1;function o(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return a&&n===this&&t(o,r)||(i=e.apply(this,o),a=!0,n=this,r=o),i}return o}var YIr,XIr=o((()=>{YIr=Number.isNaN||function(e){return typeof e==`number`&&e!==e}})),ZIr=s(((e,t)=>{var n=typeof Element<`u`,r=typeof Map==`function`,i=typeof Set==`function`,a=typeof ArrayBuffer==`function`&&!!ArrayBuffer.isView;function o(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(e.constructor!==t.constructor)return!1;var s,c,l;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(c=s;c--!==0;)if(!o(e[c],t[c]))return!1;return!0}var u;if(r&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(u=e.entries();!(c=u.next()).done;)if(!t.has(c.value[0]))return!1;for(u=e.entries();!(c=u.next()).done;)if(!o(c.value[1],t.get(c.value[0])))return!1;return!0}if(i&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(u=e.entries();!(c=u.next()).done;)if(!t.has(c.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(s=e.length,s!=t.length)return!1;for(c=s;c--!==0;)if(e[c]!==t[c])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf==`function`&&typeof t.valueOf==`function`)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString==`function`&&typeof t.toString==`function`)return e.toString()===t.toString();if(l=Object.keys(e),s=l.length,s!==Object.keys(t).length)return!1;for(c=s;c--!==0;)if(!Object.prototype.hasOwnProperty.call(t,l[c]))return!1;if(n&&e instanceof Element)return!1;for(c=s;c--!==0;)if((l[c]!==`_owner`&&l[c]!==`__v`&&l[c]!==`__o`||!e.$$typeof)&&!o(e[l[c]],t[l[c]]))return!1;return!0}return e!==e&&t!==t}t.exports=function(e,t){try{return o(e,t)}catch(e){if((e.message||``).match(/stack|recursion/i))return console.warn(`react-fast-compare cannot handle circular refs`),!1;throw e}}})),QIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{defaultProps:()=>w,propTypes:()=>S}),t.exports=d(f);var{string:p,bool:m,number:h,array:g,oneOfType:_,shape:v,object:y,func:b,node:x}=u(jy()).default,S={url:_([p,g,y]),playing:m,loop:m,controls:m,volume:h,muted:m,playbackRate:h,width:_([p,h]),height:_([p,h]),style:y,progressInterval:h,playsinline:m,pip:m,stopOnUnmount:m,light:_([m,p,y]),playIcon:x,previewTabIndex:h,previewAriaLabel:p,fallback:x,oEmbedUrl:p,wrapper:_([p,b,v({render:b.isRequired})]),config:v({soundcloud:v({options:y}),youtube:v({playerVars:y,embedOptions:y,onUnstarted:b}),facebook:v({appId:p,version:p,playerId:p,attributes:y}),dailymotion:v({params:y}),vimeo:v({playerOptions:y,title:p}),mux:v({attributes:y,version:p}),file:v({attributes:y,tracks:g,forceVideo:m,forceAudio:m,forceHLS:m,forceSafariHLS:m,forceDisableHls:m,forceDASH:m,forceFLV:m,hlsOptions:y,hlsVersion:p,dashVersion:p,flvVersion:p}),wistia:v({options:y,playerId:p,customControls:g}),mixcloud:v({options:y}),twitch:v({options:y,playerId:p}),vidyard:v({options:y})}),onReady:b,onStart:b,onPlay:b,onPause:b,onBuffer:b,onBufferEnd:b,onEnded:b,onError:b,onDuration:b,onSeek:b,onPlaybackRateChange:b,onPlaybackQualityChange:b,onProgress:b,onClickPreview:b,onEnablePIP:b,onDisablePIP:b},C=()=>{},w={playing:!1,loop:!1,controls:!1,volume:null,muted:!1,playbackRate:1,width:`640px`,height:`360px`,style:{},progressInterval:1e3,playsinline:!1,pip:!1,stopOnUnmount:!0,light:!1,fallback:null,wrapper:`div`,previewTabIndex:0,previewAriaLabel:``,oEmbedUrl:`https://noembed.com/embed?url={url}`,config:{soundcloud:{options:{visual:!0,buying:!1,liking:!1,download:!1,sharing:!1,show_comments:!1,show_playcount:!1}},youtube:{playerVars:{playsinline:1,showinfo:0,rel:0,iv_load_policy:3,modestbranding:1},embedOptions:{},onUnstarted:C},facebook:{appId:`1309697205772819`,version:`v3.3`,playerId:null,attributes:{}},dailymotion:{params:{api:1,"endscreen-enable":!1}},vimeo:{playerOptions:{autopause:!1,byline:!1,portrait:!1,title:!1},title:null},mux:{attributes:{},version:`2`},file:{attributes:{},tracks:[],forceVideo:!1,forceAudio:!1,forceHLS:!1,forceDASH:!1,forceFLV:!1,hlsOptions:{},hlsVersion:`1.1.4`,dashVersion:`3.1.3`,flvVersion:`1.5.0`,forceDisableHls:!1},wistia:{options:{},playerId:null,customControls:null},mixcloud:{options:{hide_cover:1}},twitch:{options:{},playerId:null},vidyard:{options:{}}},onReady:C,onStart:C,onPlay:C,onPause:C,onBuffer:C,onBufferEnd:C,onEnded:C,onError:C,onDuration:C,onSeek:C,onPlaybackRateChange:C,onPlaybackQualityChange:C,onProgress:C,onClickPreview:C,onEnablePIP:C,onDisablePIP:C}})),$Ir=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>x}),t.exports=f(h);var g=d(m()),_=d(ZIr()),v=QIr(),y=n7(),b=5e3,x=class extends g.Component{constructor(){super(...arguments),p(this,`mounted`,!1),p(this,`isReady`,!1),p(this,`isPlaying`,!1),p(this,`isLoading`,!0),p(this,`loadOnReady`,null),p(this,`startOnPlay`,!0),p(this,`seekOnPlay`,null),p(this,`onDurationCalled`,!1),p(this,`handlePlayerMount`,e=>{this.player||(this.player=e,this.player.load(this.props.url)),this.progress()}),p(this,`getInternalPlayer`,e=>this.player?this.player[e]:null),p(this,`progress`,()=>{if(this.props.url&&this.player&&this.isReady){let e=this.getCurrentTime()||0,t=this.getSecondsLoaded(),n=this.getDuration();if(n){let r={playedSeconds:e,played:e/n};t!==null&&(r.loadedSeconds=t,r.loaded=t/n),(r.playedSeconds!==this.prevPlayed||r.loadedSeconds!==this.prevLoaded)&&this.props.onProgress(r),this.prevPlayed=r.playedSeconds,this.prevLoaded=r.loadedSeconds}}this.progressTimeout=setTimeout(this.progress,this.props.progressFrequency||this.props.progressInterval)}),p(this,`handleReady`,()=>{if(!this.mounted)return;this.isReady=!0,this.isLoading=!1;let{onReady:e,playing:t,volume:n,muted:r}=this.props;e(),!r&&n!==null&&this.player.setVolume(n),this.loadOnReady?(this.player.load(this.loadOnReady,!0),this.loadOnReady=null):t&&this.player.play(),this.handleDurationCheck()}),p(this,`handlePlay`,()=>{this.isPlaying=!0,this.isLoading=!1;let{onStart:e,onPlay:t,playbackRate:n}=this.props;this.startOnPlay&&=(this.player.setPlaybackRate&&n!==1&&this.player.setPlaybackRate(n),e(),!1),t(),this.seekOnPlay&&=(this.seekTo(this.seekOnPlay),null),this.handleDurationCheck()}),p(this,`handlePause`,e=>{this.isPlaying=!1,this.isLoading||this.props.onPause(e)}),p(this,`handleEnded`,()=>{let{activePlayer:e,loop:t,onEnded:n}=this.props;e.loopOnEnded&&t&&this.seekTo(0),t||(this.isPlaying=!1,n())}),p(this,`handleError`,(...e)=>{this.isLoading=!1,this.props.onError(...e)}),p(this,`handleDurationCheck`,()=>{clearTimeout(this.durationCheckTimeout);let e=this.getDuration();e?this.onDurationCalled||=(this.props.onDuration(e),!0):this.durationCheckTimeout=setTimeout(this.handleDurationCheck,100)}),p(this,`handleLoaded`,()=>{this.isLoading=!1})}componentDidMount(){this.mounted=!0}componentWillUnmount(){clearTimeout(this.progressTimeout),clearTimeout(this.durationCheckTimeout),this.isReady&&this.props.stopOnUnmount&&(this.player.stop(),this.player.disablePIP&&this.player.disablePIP()),this.mounted=!1}componentDidUpdate(e){if(!this.player)return;let{url:t,playing:n,volume:r,muted:i,playbackRate:a,pip:o,loop:s,activePlayer:c,disableDeferredLoading:l}=this.props;if(!(0,_.default)(e.url,t)){if(this.isLoading&&!c.forceLoad&&!l&&!(0,y.isMediaStream)(t)){console.warn(`ReactPlayer: the attempt to load ${t} is being deferred until the player has loaded`),this.loadOnReady=t;return}this.isLoading=!0,this.startOnPlay=!0,this.onDurationCalled=!1,this.player.load(t,this.isReady)}!e.playing&&n&&!this.isPlaying&&this.player.play(),e.playing&&!n&&this.isPlaying&&this.player.pause(),!e.pip&&o&&this.player.enablePIP&&this.player.enablePIP(),e.pip&&!o&&this.player.disablePIP&&this.player.disablePIP(),e.volume!==r&&r!==null&&this.player.setVolume(r),e.muted!==i&&(i?this.player.mute():(this.player.unmute(),r!==null&&setTimeout(()=>this.player.setVolume(r)))),e.playbackRate!==a&&this.player.setPlaybackRate&&this.player.setPlaybackRate(a),e.loop!==s&&this.player.setLoop&&this.player.setLoop(s)}getDuration(){return this.isReady?this.player.getDuration():null}getCurrentTime(){return this.isReady?this.player.getCurrentTime():null}getSecondsLoaded(){return this.isReady?this.player.getSecondsLoaded():null}seekTo(e,t,n){if(!this.isReady)e!==0&&(this.seekOnPlay=e,setTimeout(()=>{this.seekOnPlay=null},b));else if(t?t===`fraction`:e>0&&e<1){let t=this.player.getDuration();if(!t){console.warn(`ReactPlayer: could not seek using fraction –\xA0duration not yet available`);return}this.player.seekTo(t*e,n)}else this.player.seekTo(e,n)}render(){let e=this.props.activePlayer;return e?g.default.createElement(e,{...this.props,onMount:this.handlePlayerMount,onReady:this.handleReady,onPlay:this.handlePlay,onPause:this.handlePause,onEnded:this.handleEnded,onLoaded:this.handleLoaded,onError:this.handleError}):null}};p(x,`displayName`,`Player`),p(x,`propTypes`,v.propTypes),p(x,`defaultProps`,v.defaultProps)})),eLr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>y}),t.exports=f(h);var g=d(m()),_=`64px`,v={},y=class extends g.Component{constructor(){super(...arguments),p(this,`mounted`,!1),p(this,`state`,{image:null}),p(this,`handleKeyPress`,e=>{(e.key===`Enter`||e.key===` `)&&this.props.onClick()})}componentDidMount(){this.mounted=!0,this.fetchImage(this.props)}componentDidUpdate(e){let{url:t,light:n}=this.props;(e.url!==t||e.light!==n)&&this.fetchImage(this.props)}componentWillUnmount(){this.mounted=!1}fetchImage({url:e,light:t,oEmbedUrl:n}){if(!g.default.isValidElement(t)){if(typeof t==`string`)this.setState({image:t});else if(v[e])this.setState({image:v[e]});else return this.setState({image:null}),window.fetch(n.replace(`{url}`,e)).then(e=>e.json()).then(t=>{if(t.thumbnail_url&&this.mounted){let n=t.thumbnail_url.replace(`height=100`,`height=480`).replace(`-d_295x166`,`-d_640`);this.setState({image:n}),v[e]=n}})}}render(){let{light:e,onClick:t,playIcon:n,previewTabIndex:r,previewAriaLabel:i}=this.props,{image:a}=this.state,o=g.default.isValidElement(e),s={display:`flex`,alignItems:`center`,justifyContent:`center`},c={preview:{width:`100%`,height:`100%`,backgroundImage:a&&!o?`url(${a})`:void 0,backgroundSize:`cover`,backgroundPosition:`center`,cursor:`pointer`,...s},shadow:{background:`radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)`,borderRadius:_,width:_,height:_,position:o?`absolute`:void 0,...s},playIcon:{borderStyle:`solid`,borderWidth:`16px 0 16px 26px`,borderColor:`transparent transparent transparent white`,marginLeft:`7px`}},l=g.default.createElement(`div`,{style:c.shadow,className:`react-player__shadow`},g.default.createElement(`div`,{style:c.playIcon,className:`react-player__play-icon`}));return g.default.createElement(`div`,{style:c.preview,className:`react-player__preview`,onClick:t,tabIndex:r,onKeyPress:this.handleKeyPress,...i?{"aria-label":i}:{}},o?e:null,n||l)}}})),tLr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},p=(e,t,i)=>(i=e==null?{}:n(o(e)),f(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),h=e=>f(r({},`__esModule`,{value:!0}),e),g=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),_={};l(_,{createReactPlayer:()=>j}),t.exports=h(_);var v=p(m()),y=p(AIr()),b=p((XIr(),d(GIr))),x=p(ZIr()),S=QIr(),C=n7(),w=p($Ir()),T=(0,C.lazy)(()=>Promise.resolve().then(()=>u(eLr()))),E=typeof window<`u`&&window.document&&typeof document<`u`,D=typeof global<`u`&&global.window&&global.window.document,O=Object.keys(S.propTypes),k=E||D?v.Suspense:()=>null,A=[],j=(e,t)=>{var n=class extends v.Component{constructor(){super(...arguments),g(this,`state`,{showPreview:!!this.props.light}),g(this,`references`,{wrapper:e=>{this.wrapper=e},player:e=>{this.player=e}}),g(this,`handleClickPreview`,e=>{this.setState({showPreview:!1}),this.props.onClickPreview(e)}),g(this,`showPreview`,()=>{this.setState({showPreview:!0})}),g(this,`getDuration`,()=>this.player?this.player.getDuration():null),g(this,`getCurrentTime`,()=>this.player?this.player.getCurrentTime():null),g(this,`getSecondsLoaded`,()=>this.player?this.player.getSecondsLoaded():null),g(this,`getInternalPlayer`,(e=`player`)=>this.player?this.player.getInternalPlayer(e):null),g(this,`seekTo`,(e,t,n)=>{if(!this.player)return null;this.player.seekTo(e,t,n)}),g(this,`handleReady`,()=>{this.props.onReady(this)}),g(this,`getActivePlayer`,(0,b.default)(n=>{for(let t of[...A,...e])if(t.canPlay(n))return t;return t||null})),g(this,`getConfig`,(0,b.default)((e,t)=>{let{config:n}=this.props;return y.default.all([S.defaultProps.config,S.defaultProps.config[t]||{},n,n[t]||{}])})),g(this,`getAttributes`,(0,b.default)(e=>(0,C.omit)(this.props,O))),g(this,`renderActivePlayer`,e=>{if(!e)return null;let t=this.getActivePlayer(e);if(!t)return null;let n=this.getConfig(e,t.key);return v.default.createElement(w.default,{...this.props,key:t.key,ref:this.references.player,config:n,activePlayer:t.lazyPlayer||t,onReady:this.handleReady})})}shouldComponentUpdate(e,t){return!(0,x.default)(this.props,e)||!(0,x.default)(this.state,t)}componentDidUpdate(e){let{light:t}=this.props;!e.light&&t&&this.setState({showPreview:!0}),e.light&&!t&&this.setState({showPreview:!1})}renderPreview(e){if(!e)return null;let{light:t,playIcon:n,previewTabIndex:r,oEmbedUrl:i,previewAriaLabel:a}=this.props;return v.default.createElement(T,{url:e,light:t,playIcon:n,previewTabIndex:r,previewAriaLabel:a,oEmbedUrl:i,onClick:this.handleClickPreview})}render(){let{url:e,style:t,width:n,height:r,fallback:i,wrapper:a}=this.props,{showPreview:o}=this.state,s=this.getAttributes(e),c=typeof a==`string`?this.references.wrapper:void 0;return v.default.createElement(a,{ref:c,style:{...t,width:n,height:r},...s},v.default.createElement(k,{fallback:i},o?this.renderPreview(e):this.renderActivePlayer(e)))}};return g(n,`displayName`,`ReactPlayer`),g(n,`propTypes`,S.propTypes),g(n,`defaultProps`,S.defaultProps),g(n,`addCustomPlayer`,e=>{A.push(e)}),g(n,`removeCustomPlayers`,()=>{A.length=0}),g(n,`canPlay`,t=>{for(let n of[...A,...e])if(n.canPlay(t))return!0;return!1}),g(n,`canEnablePIP`,t=>{for(let n of[...A,...e])if(n.canEnablePIP&&n.canEnablePIP(t))return!0;return!1}),n}})),nLr=u(s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{default:()=>g}),t.exports=d(f);var p=u(WIr()),m=tLr(),h=p.default[p.default.length-1],g=(0,m.createReactPlayer)(p.default,h)}))(),1),rLr=e=>{if(!e)return!1;try{return new URL(e.trim()).protocol===`https:`}catch{return!1}},iLr=e=>{if(e.nodeName!==`IFRAME`)return;let t=e;rLr(t.getAttribute(`src`))||t.remove()},aLr=e=>{if(!e)return``;HNe.default.addHook(`uponSanitizeElement`,iLr);try{return HNe.default.sanitize(e,{ADD_TAGS:[`iframe`],ADD_ATTR:[`allow`,`allowfullscreen`,`frameborder`,`referrerpolicy`],FORBID_TAGS:[`script`,`object`,`embed`]}).trim()}finally{HNe.default.removeHook(`uponSanitizeElement`,iLr)}},oLr=/(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((?:\w|-){11})/,sLr=/youtube\.com\/playlist\?list=|youtube\.com\/user\//,cLr=/[?&](?:list|channel)=/,lLr=new Set([`videoseries`,`live_stream`]),uLr=e=>{let t=e?.match(oLr)?.[1];return t&&!lLr.has(t)?t:null},dLr=e=>{try{let t=new URL(e??``).searchParams,[,n,r,i]=(t.get(`t`)??t.get(`start`)??``).match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s?)?$/)??[],a=Number(n??0)*3600+Number(r??0)*60+Number(i??0);return a>0?a:null}catch{return null}},fLr=e=>{try{let t=new URL(e).searchParams,n=t.get(`t`)??t.get(`start`);return n?`&t=${encodeURIComponent(n)}`:``}catch{return``}},pLr=e=>{if(!e)return{url:void 0};let t=e.match(oLr)?.[1],n=!!t&&lLr.has(t),r=n?void 0:t;return r&&cLr.test(e)?{url:`https://www.youtube.com/watch?v=${r}${fLr(e)}`}:n||!r&&sLr.test(e)?{url:e,embedOptions:{videoId:``}}:{url:e}},mLr=1e4,hLr=/^https:\/\/(customer-[a-z0-9]+\.cloudflarestream\.com)\/([a-f0-9]{32})\/manifest\/video\.m3u8$/i,gLr=e=>{let t=e?.match(hLr);return t?`https://${t[1]}/${t[2]}/lifecycle`:null},_Lr=e=>{let t=gLr(e),[n,r]=(0,S.useState)(t?null:!1);return(0,S.useEffect)(()=>{if(!t){r(!1);return}let e=!1,n=async()=>{try{let n=await(await fetch(t)).json();e||r(n?.isInput===!0&&!n.live)}catch{e||r(e=>e??!1)}};n();let i=setInterval(n,mLr);return()=>{e=!0,clearInterval(i)}},[t]),n},vLr=c({default:()=>eRr});function yLr(e,t){return e.indexOf(t.toLowerCase())===0?e:`${t.toLowerCase()}${e.substr(0,1).toUpperCase()}${e.substr(1)}`}function bLr(e){return!!(e&&e.nodeType===1&&`nodeName`in e&&e.ownerDocument&&e.ownerDocument.defaultView)}function xLr(e){return!isNaN(parseFloat(e))&&isFinite(e)&&Math.floor(e)==e}function i7(e){return/^(https?:)?\/\/((((player|www)\.)?vimeo\.com)|((player\.)?[a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))(?=$|\/)/.test(e)}function SLr(e){return/^https:\/\/player\.((vimeo\.com)|([a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))\/video\/\d+/.test(e)}function CLr(e){let t=(e||``).match(/^(?:https?:)?(?:\/\/)?([^/?]+)/),n=(t&&t[1]||``).replace(`player.`,``);for(let e of[`.videoji.hk`,`.vimeo.work`,`.videoji.cn`])if(n.endsWith(e))return n;return`vimeo.com`}function wLr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.id,n=e.url,r=t||n;if(!r)throw Error(`An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.`);if(xLr(r))return`https://vimeo.com/${r}`;if(i7(r))return r.replace(`http:`,`https:`);throw TypeError(t?`“${t}” is not a valid video id.`:`“${r}” is not a vimeo.com url.`)}function TLr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document;if(!e||!t||typeof t.querySelectorAll!=`function`)return null;let n=t.querySelectorAll(`iframe`);for(let t=0;t<n.length;t++)if(n[t]&&n[t].contentWindow===e)return n[t];return null}function ELr(e,t){return t={exports:{}},e(t,t.exports),t.exports}function a7(e,t,n){let r=l7.get(e.element)||{};t in r||(r[t]=[]),r[t].push(n),l7.set(e.element,r)}function DLr(e,t){return(l7.get(e.element)||{})[t]||[]}function OLr(e,t,n){let r=l7.get(e.element)||{};if(!r[t])return!0;if(!n)return r[t]=[],l7.set(e.element,r),!0;let i=r[t].indexOf(n);return i!==-1&&r[t].splice(i,1),l7.set(e.element,r),r[t]&&r[t].length===0}function kLr(e,t){let n=DLr(e,t);if(n.length<1)return!1;let r=n.shift();return OLr(e,t,r),r}function ALr(e,t){let n=l7.get(e);l7.set(t,n),l7.delete(e)}function o7(e){if(typeof e==`string`)try{e=JSON.parse(e)}catch(e){return console.warn(e),{}}return e}function s7(e,t,n){if(!e.element.contentWindow||!e.element.contentWindow.postMessage)return;let r={method:t};n!==void 0&&(r.value=n);let i=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,`$1`));i>=8&&i<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.origin)}function jLr(e,t){t=o7(t);let n=[],r;if(t.event)t.event===`error`&&DLr(e,t.data.method).forEach(n=>{let r=Error(t.data.message);r.name=t.data.name,n.reject(r),OLr(e,t.data.method,n)}),n=DLr(e,`event:${t.event}`),r=t.data;else if(t.method){let i=kLr(e,t.method);i&&(n.push(i),r=t.value)}n.forEach(t=>{try{if(typeof t==`function`){t.call(e,r);return}t.resolve(r)}catch{}})}function MLr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return XLr.reduce((t,n)=>{let r=e.getAttribute(`data-vimeo-${n}`);return(r||r===``)&&(t[n]=r===``?1:r),t},t)}function NLr(e,t){let{html:n}=e;if(!t)throw TypeError(`An element must be provided`);if(t.getAttribute(`data-vimeo-initialized`)!==null)return t.querySelector(`iframe`);let r=document.createElement(`div`);return r.innerHTML=n,t.appendChild(r.firstChild),t.setAttribute(`data-vimeo-initialized`,`true`),t.querySelector(`iframe`)}function PLr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return new Promise((r,i)=>{if(!i7(e))throw TypeError(`“${e}” is not a vimeo.com url.`);let a=`https://${CLr(e)}/api/oembed.json?url=${encodeURIComponent(e)}`;for(let e in t)t.hasOwnProperty(e)&&(a+=`&${e}=${encodeURIComponent(t[e])}`);let o=`XDomainRequest`in window?new XDomainRequest:new XMLHttpRequest;o.open(`GET`,a,!0),o.onload=function(){if(o.status===404)i(Error(`“${e}” was not found.`));else if(o.status===403)i(Error(`“${e}” is not embeddable.`));else try{let t=JSON.parse(o.responseText);if(t.domain_status_code===403){NLr(t,n),i(Error(`“${e}” is not embeddable.`));return}r(t)}catch(e){i(e)}},o.onerror=function(){let e=o.status?` (${o.status})`:``;i(Error(`There was an error fetching the embed code from Vimeo${e}.`))},o.send()})}function FLr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document,t=[].slice.call(e.querySelectorAll(`[data-vimeo-id], [data-vimeo-url]`)),n=e=>{`console`in window&&console.error&&console.error(`There was an error creating an embed: ${e}`)};t.forEach(e=>{try{if(e.getAttribute(`data-vimeo-defer`)!==null)return;let t=MLr(e);PLr(wLr(t),t,e).then(t=>NLr(t,e)).catch(n)}catch(e){n(e)}})}function ILr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;window.VimeoPlayerResizeEmbeds_||(window.VimeoPlayerResizeEmbeds_=!0,window.addEventListener(`message`,t=>{if(!i7(t.origin)||!t.data||t.data.event!==`spacechange`)return;let n=t.source?TLr(t.source,e):null;if(n){let e=n.parentElement;e.style.paddingBottom=`${t.data.data[0].bottom}px`}}))}function LLr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;window.VimeoSeoMetadataAppended||(window.VimeoSeoMetadataAppended=!0,window.addEventListener(`message`,t=>{if(!i7(t.origin))return;let n=o7(t.data);if(!n||n.event!==`ready`)return;let r=t.source?TLr(t.source,e):null;r&&SLr(r.src)&&new eRr(r).callMethod(`appendVideoMetadata`,window.location.href)}))}function RLr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;if(window.VimeoCheckedUrlTimeParam)return;window.VimeoCheckedUrlTimeParam=!0;let t=e=>{`console`in window&&console.error&&console.error(`There was an error getting video Id: ${e}`)};window.addEventListener(`message`,n=>{if(!i7(n.origin))return;let r=o7(n.data);if(!r||r.event!==`ready`)return;let i=n.source?TLr(n.source,e):null;if(i&&SLr(i.src)){let e=new eRr(i);e.getVideoId().then(t=>{let n=RegExp(`[?&]vimeo_t_${t}=([^&#]*)`).exec(window.location.href);if(n&&n[1]){let t=decodeURI(n[1]);e.setCurrentTime(t)}}).catch(t)}})}function zLr(){window.VimeoDRMEmbedsUpdated||(window.VimeoDRMEmbedsUpdated=!0,window.addEventListener(`message`,e=>{if(!i7(e.origin))return;let t=o7(e.data);if(!t||t.event!==`drminitfailed`)return;let n=e.source?TLr(e.source):null;if(!n)return;let r=n.getAttribute(`allow`)||``;if(!r.includes(`encrypted-media`)){n.setAttribute(`allow`,`${r}; encrypted-media`);let e=new URL(n.getAttribute(`src`));e.searchParams.set(`forcereload`,`drm`),n.setAttribute(`src`,e.toString())}}))}function BLr(){let e=function(){let e,t=[[`requestFullscreen`,`exitFullscreen`,`fullscreenElement`,`fullscreenEnabled`,`fullscreenchange`,`fullscreenerror`],[`webkitRequestFullscreen`,`webkitExitFullscreen`,`webkitFullscreenElement`,`webkitFullscreenEnabled`,`webkitfullscreenchange`,`webkitfullscreenerror`],[`webkitRequestFullScreen`,`webkitCancelFullScreen`,`webkitCurrentFullScreenElement`,`webkitCancelFullScreen`,`webkitfullscreenchange`,`webkitfullscreenerror`],[`mozRequestFullScreen`,`mozCancelFullScreen`,`mozFullScreenElement`,`mozFullScreenEnabled`,`mozfullscreenchange`,`mozfullscreenerror`],[`msRequestFullscreen`,`msExitFullscreen`,`msFullscreenElement`,`msFullscreenEnabled`,`MSFullscreenChange`,`MSFullscreenError`]],n=0,r=t.length,i={};for(;n<r;n++)if(e=t[n],e&&e[1]in document){for(n=0;n<e.length;n++)i[t[0][n]]=e[n];return i}return!1}(),t={fullscreenchange:e.fullscreenchange,fullscreenerror:e.fullscreenerror},n={request(t){return new Promise((r,i)=>{let a=function(){n.off(`fullscreenchange`,a),r()};n.on(`fullscreenchange`,a),t||=document.documentElement;let o=t[e.requestFullscreen]();o instanceof Promise&&o.then(a).catch(i)})},exit(){return new Promise((t,r)=>{if(!n.isFullscreen){t();return}let i=function(){n.off(`fullscreenchange`,i),t()};n.on(`fullscreenchange`,i);let a=document[e.exitFullscreen]();a instanceof Promise&&a.then(i).catch(r)})},on(e,n){let r=t[e];r&&document.addEventListener(r,n)},off(e,n){let r=t[e];r&&document.removeEventListener(r,n)}};return Object.defineProperties(n,{isFullscreen:{get(){return!!document[e.fullscreenElement]}},element:{enumerable:!0,get(){return document[e.fullscreenElement]}},isEnabled:{enumerable:!0,get(){return!!document[e.fullscreenEnabled]}}}),n}var VLr,HLr,ULr,WLr,GLr,KLr,qLr,JLr,YLr,c7,l7,XLr,ZLr,QLr,u7,$Lr,d7,eRr,tRr=o((()=>{if(VLr=typeof global<`u`&&{}.toString.call(global)===`[object global]`,HLr=typeof Bun<`u`,ULr=typeof Deno<`u`,WLr=typeof WebSocketPair==`function`&&caches?.default!==void 0,GLr=VLr||HLr||ULr||WLr,KLr=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`addEventListener`,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:`removeEventListener`,a=typeof t==`string`?[t]:t;return a.forEach(t=>{e[r](t,n)}),{cancel:()=>a.forEach(t=>e[i](t,n))}},qLr=Array.prototype.indexOf!==void 0,JLr=typeof window<`u`&&window.postMessage!==void 0,!GLr&&(!qLr||!JLr))throw Error(`Sorry, the Vimeo Player API is not available in this browser.`);YLr=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},(function(e){if(e.WeakMap)return;var t=Object.prototype.hasOwnProperty,n=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{value:1}).x===1}catch{}}(),r=function(e,t,r){n?Object.defineProperty(e,t,{configurable:!0,writable:!0,value:r}):e[t]=r};e.WeakMap=function(){function e(){if(this===void 0)throw TypeError(`Constructor WeakMap requires 'new'`);if(r(this,`_id`,a(`_WeakMap`)),arguments.length>0)throw TypeError(`WeakMap iterable is not supported`)}r(e.prototype,`delete`,function(e){if(n(this,`delete`),!i(e))return!1;var t=e[this._id];return t&&t[0]===e?(delete e[this._id],!0):!1}),r(e.prototype,`get`,function(e){if(n(this,`get`),i(e)){var t=e[this._id];if(t&&t[0]===e)return t[1]}}),r(e.prototype,`has`,function(e){if(n(this,`has`),!i(e))return!1;var t=e[this._id];return!!(t&&t[0]===e)}),r(e.prototype,`set`,function(e,t){if(n(this,`set`),!i(e))throw TypeError(`Invalid value used as weak map key`);var a=e[this._id];return a&&a[0]===e?(a[1]=t,this):(r(e,this._id,[e,t]),this)});function n(e,n){if(!i(e)||!t.call(e,`_id`))throw TypeError(n+` method called on incompatible receiver `+typeof e)}function a(e){return e+`_`+o()+`.`+o()}function o(){return Math.random().toString().substring(2)}return r(e,`_polyfill`,!0),e}();function i(e){return Object(e)===e}})(typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:YLr),c7=ELr(function(e){(function(t,n,r){n[t]=n[t]||r(),e.exports&&=n[t]})(`Promise`,YLr,function(){var e,t,n,r=Object.prototype.toString,i=typeof setImmediate<`u`?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,t,n,r){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:r!==!1})}}catch{e=function(e,t,n){return e[t]=n,e}}n=function(){var e,n,r;function i(e,t){this.fn=e,this.self=t,this.next=void 0}return{add:function(t,a){r=new i(t,a),n?n.next=r:e=r,n=r,r=void 0},drain:function(){var r=e;for(e=n=t=void 0;r;)r.fn.call(r.self),r=r.next}}}();function a(e,r){n.add(e,r),t||=i(n.drain)}function o(e){var t,n=typeof e;return e!=null&&(n==`object`||n==`function`)&&(t=e.then),typeof t==`function`&&t}function s(){for(var e=0;e<this.chain.length;e++)c(this,this.state===1?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function c(e,t,n){var r,i;try{t===!1?n.reject(e.msg):(r=t===!0?e.msg:t.call(void 0,e.msg),r===n.promise?n.reject(TypeError(`Promise-chain cycle`)):(i=o(r))?i.call(r,n.resolve,n.reject):n.resolve(r))}catch(e){n.reject(e)}}function l(e){var t,n=this;if(!n.triggered){n.triggered=!0,n.def&&(n=n.def);try{(t=o(e))?a(function(){var r=new f(n);try{t.call(e,function(){l.apply(r,arguments)},function(){u.apply(r,arguments)})}catch(e){u.call(r,e)}}):(n.msg=e,n.state=1,n.chain.length>0&&a(s,n))}catch(e){u.call(new f(n),e)}}}function u(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&a(s,t))}function d(e,t,n,r){for(var i=0;i<t.length;i++)(function(i){e.resolve(t[i]).then(function(e){n(i,e)},r)})(i)}function f(e){this.def=e,this.triggered=!1}function p(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function m(e){if(typeof e!=`function`)throw TypeError(`Not a function`);if(this.__NPO__!==0)throw TypeError(`Not a promise`);this.__NPO__=1;var t=new p(this);this.then=function(e,n){var r={success:typeof e!=`function`||e,failure:typeof n==`function`&&n};return r.promise=new this.constructor(function(e,t){if(typeof e!=`function`||typeof t!=`function`)throw TypeError(`Not a function`);r.resolve=e,r.reject=t}),t.chain.push(r),t.state!==0&&a(s,t),r.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){l.call(t,e)},function(e){u.call(t,e)})}catch(e){u.call(t,e)}}var h=e({},`constructor`,m,!1);return m.prototype=h,e(h,`__NPO__`,0,!1),e(m,`resolve`,function(e){var t=this;return e&&typeof e==`object`&&e.__NPO__===1?e:new t(function(t,n){if(typeof t!=`function`||typeof n!=`function`)throw TypeError(`Not a function`);t(e)})}),e(m,`reject`,function(e){return new this(function(t,n){if(typeof t!=`function`||typeof n!=`function`)throw TypeError(`Not a function`);n(e)})}),e(m,`all`,function(e){var t=this;return r.call(e)==`[object Array]`?e.length===0?t.resolve([]):new t(function(n,r){if(typeof n!=`function`||typeof r!=`function`)throw TypeError(`Not a function`);var i=e.length,a=Array(i),o=0;d(t,e,function(e,t){a[e]=t,++o===i&&n(a)},r)}):t.reject(TypeError(`Not an array`))}),e(m,`race`,function(e){var t=this;return r.call(e)==`[object Array]`?new t(function(n,r){if(typeof n!=`function`||typeof r!=`function`)throw TypeError(`Not a function`);d(t,e,function(e,t){n(t)},r)}):t.reject(TypeError(`Not an array`))}),m})}),l7=new WeakMap,XLr=`airplay.audio_tracks.audiotrack.autopause.autoplay.background.byline.cc.chapter_id.chapters.chromecast.color.colors.controls.disable_context_menu.dnt.end_time.fullscreen.height.id.initial_quality.interactive_params.keyboard.loop.maxheight.max_quality.maxwidth.min_quality.muted.play_button_position.playsinline.portrait.preload.progress_bar.quality.quality_selector.responsive.skipping_forward.speed.start_time.texttrack.thumbnail_id.title.transcript.transparent.unmute_button.url.vimeo_logo.volume.watch_full_video.width`.split(`.`),ZLr={role:`viewer`,autoPlayMuted:!0,allowedDrift:.3,maxAllowedDrift:1,minCheckInterval:.1,maxRateAdjustment:.2,maxTimeToCatchUp:1},QLr=class extends EventTarget{logger;constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;super(),this.logger=r,this.init(t,e,{...ZLr,...n})}disconnect(){this.dispatchEvent(new Event(`disconnect`))}async init(e,t,n){if(await this.waitForTOReadyState(e,`open`),n.role===`viewer`){await this.updatePlayer(e,t,n);let r=KLr(e,`change`,()=>this.updatePlayer(e,t,n)),i=this.maintainPlaybackPosition(e,t,n);this.addEventListener(`disconnect`,()=>{i.cancel(),r.cancel()})}else{await this.updateTimingObject(e,t);let n=KLr(t,[`seeked`,`play`,`pause`,`ratechange`],()=>this.updateTimingObject(e,t),`on`,`off`);this.addEventListener(`disconnect`,()=>n.cancel())}}async updateTimingObject(e,t){let[n,r,i]=await Promise.all([t.getCurrentTime(),t.getPaused(),t.getPlaybackRate()]);e.update({position:n,velocity:r?0:i})}async updatePlayer(e,t,n){let{position:r,velocity:i}=e.query();typeof r==`number`&&t.setCurrentTime(r),typeof i==`number`&&(i===0?await t.getPaused()===!1&&t.pause():i>0&&(await t.getPaused()===!0&&(await t.play().catch(async e=>{e.name===`NotAllowedError`&&n.autoPlayMuted&&(await t.setMuted(!0),await t.play().catch(e=>console.error(`Couldn't play the video from TimingSrcConnector. Error:`,e)))}),this.updatePlayer(e,t,n)),await t.getPlaybackRate()!==i&&t.setPlaybackRate(i)))}maintainPlaybackPosition(e,t,n){let{allowedDrift:r,maxAllowedDrift:i,minCheckInterval:a,maxRateAdjustment:o,maxTimeToCatchUp:s}=n,c=Math.min(s,Math.max(a,i))*1e3,l=async()=>{if(e.query().velocity===0||await t.getPaused()===!0)return;let n=e.query().position-await t.getCurrentTime(),a=Math.abs(n);if(this.log(`Drift: ${n}`),a>i)await this.adjustSpeed(t,0),t.setCurrentTime(e.query().position),this.log(`Resync by currentTime`);else if(a>r){let e=a/s,r=o,i=e<r?(r-e)/2:r;await this.adjustSpeed(t,i*Math.sign(n)),this.log(`Resync by playbackRate`)}},u=setInterval(()=>l(),c);return{cancel:()=>clearInterval(u)}}log(e){this.logger?.(`TimingSrcConnector: ${e}`)}speedAdjustment=0;adjustSpeed=async(e,t)=>{if(this.speedAdjustment===t)return;let n=await e.getPlaybackRate()-this.speedAdjustment+t;this.log(`New playbackRate: ${n}`),await e.setPlaybackRate(n),this.speedAdjustment=t};waitForTOReadyState(e,t){return new Promise(n=>{let r=()=>{e.readyState===t?n():e.addEventListener(`readystatechange`,r,{once:!0})};r()})}},u7=new WeakMap,$Lr=new WeakMap,d7={},eRr=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(window.jQuery&&e instanceof jQuery&&(e.length>1&&window.console&&console.warn&&console.warn(`A jQuery object with multiple elements was passed, using the first element.`),e=e[0]),typeof document<`u`&&typeof e==`string`&&(e=document.getElementById(e)),!bLr(e))throw TypeError(`You must pass either a valid element or a valid id.`);if(e.nodeName!==`IFRAME`){let t=e.querySelector(`iframe`);t&&(e=t)}if(e.nodeName===`IFRAME`&&!i7(e.getAttribute(`src`)||``))throw Error(`The player element passed isn’t a Vimeo embed.`);if(u7.has(e))return u7.get(e);this._window=e.ownerDocument.defaultView,this.element=e,this.origin=`*`;let n=new c7((n,r)=>{if(this._onMessage=e=>{if(!i7(e.origin)||this.element.contentWindow!==e.source)return;this.origin===`*`&&(this.origin=e.origin);let t=o7(e.data);if(t&&t.event===`error`&&t.data&&t.data.method===`ready`){let e=Error(t.data.message);e.name=t.data.name,r(e);return}let i=t&&t.event===`ready`,a=t&&t.method===`ping`;i||a?(this.element.setAttribute(`data-ready`,`true`),n()):jLr(this,t)},this._window.addEventListener(`message`,this._onMessage),this.element.nodeName!==`IFRAME`){let n=MLr(e,t);PLr(wLr(n),n,e).then(t=>{let n=NLr(t,e);return this.element=n,this._originalElement=e,ALr(e,n),u7.set(this.element,this),t}).catch(r)}});if($Lr.set(this,n),u7.set(this.element,this),this.element.nodeName===`IFRAME`&&s7(this,`ping`),d7.isEnabled){let e=()=>d7.exit();this.fullscreenchangeHandler=()=>{d7.isFullscreen?a7(this,`event:exitFullscreen`,e):OLr(this,`event:exitFullscreen`,e),this.ready().then(()=>{s7(this,`fullscreenchange`,d7.isFullscreen)})},d7.on(`fullscreenchange`,this.fullscreenchangeHandler)}return this}static isVimeoUrl(e){return i7(e)}callMethod(e){var t=[...arguments].slice(1);if(e==null)throw TypeError(`You must pass a method name.`);return new c7((n,r)=>this.ready().then(()=>{a7(this,e,{resolve:n,reject:r}),t.length===0?t={}:t.length===1&&(t=t[0]),s7(this,e,t)}).catch(r))}get(e){return new c7((t,n)=>(e=yLr(e,`get`),this.ready().then(()=>{a7(this,e,{resolve:t,reject:n}),s7(this,e)}).catch(n)))}set(e,t){return new c7((n,r)=>{if(e=yLr(e,`set`),t==null)throw TypeError(`There must be a value to set.`);return this.ready().then(()=>{a7(this,e,{resolve:n,reject:r}),s7(this,e,t)}).catch(r)})}on(e,t){if(!e)throw TypeError(`You must pass an event name.`);if(!t)throw TypeError(`You must pass a callback function.`);if(typeof t!=`function`)throw TypeError(`The callback must be a function.`);DLr(this,`event:${e}`).length===0&&this.callMethod(`addEventListener`,e).catch(()=>{}),a7(this,`event:${e}`,t)}off(e,t){if(!e)throw TypeError(`You must pass an event name.`);if(t&&typeof t!=`function`)throw TypeError(`The callback must be a function.`);OLr(this,`event:${e}`,t)&&this.callMethod(`removeEventListener`,e).catch(e=>{})}loadVideo(e){return this.callMethod(`loadVideo`,e)}ready(){let e=$Lr.get(this)||new c7((e,t)=>{t(Error(`Unknown player. Probably unloaded.`))});return c7.resolve(e)}addCuePoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.callMethod(`addCuePoint`,{time:e,data:t})}removeCuePoint(e){return this.callMethod(`removeCuePoint`,e)}enableTextTrack(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e)throw TypeError(`You must pass a language.`);return this.callMethod(`enableTextTrack`,{language:e,kind:t,showing:n})}disableTextTrack(){return this.callMethod(`disableTextTrack`)}selectAudioTrack(e,t){if(!e)throw TypeError(`You must pass a language.`);return this.callMethod(`selectAudioTrack`,{language:e,kind:t})}selectDefaultAudioTrack(){return this.callMethod(`selectDefaultAudioTrack`)}pause(){return this.callMethod(`pause`)}play(){return this.callMethod(`play`)}requestFullscreen(){return d7.isEnabled?d7.request(this.element):this.callMethod(`requestFullscreen`)}exitFullscreen(){return d7.isEnabled?d7.exit():this.callMethod(`exitFullscreen`)}getFullscreen(){return d7.isEnabled?c7.resolve(d7.isFullscreen):this.get(`fullscreen`)}requestPictureInPicture(){return this.callMethod(`requestPictureInPicture`)}exitPictureInPicture(){return this.callMethod(`exitPictureInPicture`)}getPictureInPicture(){return this.get(`pictureInPicture`)}remotePlaybackPrompt(){return this.callMethod(`remotePlaybackPrompt`)}unload(){return this.callMethod(`unload`)}destroy(){return new c7(e=>{if($Lr.delete(this),u7.delete(this.element),this._originalElement&&(u7.delete(this._originalElement),this._originalElement.removeAttribute(`data-vimeo-initialized`)),this.element&&this.element.nodeName===`IFRAME`&&this.element.parentNode&&(this.element.parentNode.parentNode&&this._originalElement&&this._originalElement!==this.element.parentNode?this.element.parentNode.parentNode.removeChild(this.element.parentNode):this.element.parentNode.removeChild(this.element)),this.element&&this.element.nodeName===`DIV`&&this.element.parentNode){this.element.removeAttribute(`data-vimeo-initialized`);let e=this.element.querySelector(`iframe`);e&&e.parentNode&&(e.parentNode.parentNode&&this._originalElement&&this._originalElement!==e.parentNode?e.parentNode.parentNode.removeChild(e.parentNode):e.parentNode.removeChild(e))}this._window.removeEventListener(`message`,this._onMessage),d7.isEnabled&&d7.off(`fullscreenchange`,this.fullscreenchangeHandler),e()})}getAutopause(){return this.get(`autopause`)}setAutopause(e){return this.set(`autopause`,e)}getBuffered(){return this.get(`buffered`)}getCameraProps(){return this.get(`cameraProps`)}setCameraProps(e){return this.set(`cameraProps`,e)}getChapters(){return this.get(`chapters`)}getCurrentChapter(){return this.get(`currentChapter`)}getColor(){return this.get(`color`)}getColors(){return c7.all([this.get(`colorOne`),this.get(`colorTwo`),this.get(`colorThree`),this.get(`colorFour`)])}setColor(e){return this.set(`color`,e)}setColors(e){if(!Array.isArray(e))return new c7((e,t)=>t(TypeError(`Argument must be an array.`)));let t=new c7(e=>e(null)),n=[e[0]?this.set(`colorOne`,e[0]):t,e[1]?this.set(`colorTwo`,e[1]):t,e[2]?this.set(`colorThree`,e[2]):t,e[3]?this.set(`colorFour`,e[3]):t];return c7.all(n)}getCuePoints(){return this.get(`cuePoints`)}getCurrentTime(){return this.get(`currentTime`)}setCurrentTime(e){return this.set(`currentTime`,e)}getDuration(){return this.get(`duration`)}getEnded(){return this.get(`ended`)}getLoop(){return this.get(`loop`)}setLoop(e){return this.set(`loop`,e)}setMuted(e){return this.set(`muted`,e)}getMuted(){return this.get(`muted`)}getPaused(){return this.get(`paused`)}getPlaybackRate(){return this.get(`playbackRate`)}setPlaybackRate(e){return this.set(`playbackRate`,e)}getPlayed(){return this.get(`played`)}getQualities(){return this.get(`qualities`)}getQuality(){return this.get(`quality`)}setQuality(e){return this.set(`quality`,e)}getRemotePlaybackAvailability(){return this.get(`remotePlaybackAvailability`)}getRemotePlaybackState(){return this.get(`remotePlaybackState`)}getSeekable(){return this.get(`seekable`)}getSeeking(){return this.get(`seeking`)}getTextTracks(){return this.get(`textTracks`)}getAudioTracks(){return this.get(`audioTracks`)}getEnabledAudioTrack(){return this.get(`enabledAudioTrack`)}getDefaultAudioTrack(){return this.get(`defaultAudioTrack`)}getVideoEmbedCode(){return this.get(`videoEmbedCode`)}getVideoId(){return this.get(`videoId`)}getVideoTitle(){return this.get(`videoTitle`)}getVideoWidth(){return this.get(`videoWidth`)}getVideoHeight(){return this.get(`videoHeight`)}getVideoUrl(){return this.get(`videoUrl`)}getVolume(){return this.get(`volume`)}setVolume(e){return this.set(`volume`,e)}async setTimingSrc(e,t){if(!e)throw TypeError(`A Timing Object must be provided.`);await this.ready();let n=new QLr(this,e,t);return s7(this,`notifyTimingObjectConnect`),n.addEventListener(`disconnect`,()=>s7(this,`notifyTimingObjectDisconnect`)),n}},GLr||(d7=BLr(),FLr(),ILr(),LLr(),RLr(),zLr())})),nRr=/vimeo\.com\/(?!progressive_redirect).+/,rRr=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,iRr=/\.(m3u8)($|\?)/i,aRr=e=>!!e&&nRr.test(e)&&!rRr.test(e)&&!iRr.test(e),oRr=()=>typeof window<`u`&&!!window.Vimeo?.Player,sRr=null,cRr=()=>(sRr??=Promise.resolve().then(()=>(tRr(),vLr)).then(({default:e})=>{let t=window;t.Vimeo={...t.Vimeo,Player:e}}).catch(()=>void 0),sRr),lRr=e=>{let t=aRr(e),[n,r]=(0,S.useState)(()=>!t||oRr()),[i,a]=(0,S.useState)(t);return t!==i&&(a(t),r(!t||oRr())),(0,S.useEffect)(()=>{if(!t||oRr()){r(!0);return}let e=!0;return r(!1),cRr().then(()=>{e&&r(!0)}),()=>{e=!1}},[t]),n};JQ();var uRr=Wje(nLr.default),dRr={wrapper:`rounded-xl w-full overflow-hidden relative`,video:`aspect-video`};typeof window<`u`&&(window.Hls=OIr);var fRr=e=>e&&`embedHtml`in e?e.embedHtml:null,pRr=e=>e&&`userProgress`in e&&e.userProgress?.playhead||0,mRr=({media:e,coverImage:t,livestream:n,content:r,shouldSendInteractions:i,...a})=>{let o=(0,S.useRef)(null),s=(0,S.useRef)({getCurrentTime:()=>o.current?.getCurrentTime(),getDuration:()=>o.current?.getDuration()}).current,{playing:c,...l}=a,{isPlaying:u,setIsPlaying:d,hasPlayed:f,handlePlayed:p,handlePaused:m,handleEnded:h,handleSeekStart:g,handleSeek:_,handleProgress:v,handleError:y,handlePlaybackRateChange:b}=dOr({media:e,livestream:n,content:r,clock:s,shouldSendInteractions:i,initialPlaying:typeof c==`boolean`&&c}),x=(0,S.useRef)(0),[C,w]=(0,S.useState)(!1);(0,S.useEffect)(()=>w(!0),[]);let T=lRr(e?.sources?.[0]?.uri),E=_Lr(n?e?.sources?.[0]?.uri:void 0),D=(0,S.useRef)(!1);E&&(D.current=!0);let O=D.current&&typeof navigator<`u`&&navigator.userActivation?.hasBeenActive===!1,k=async()=>{if(n)P();else{let t=pRr(e);t>0&&!f&&x.current!==t&&(x.current=t,o.current?.seekTo(t))}},A=(e,...t)=>{console.error(`Video error`,e,t),y()},j=fRr(e),M=(0,S.useMemo)(()=>aLr(j),[j]);if(j&&!M)return null;if(M)return(0,q.jsx)(`div`,{className:qx(dRr.wrapper),dangerouslySetInnerHTML:{__html:M}});let N=!!e?.sources?.[0]?.uri,ee=!N||!C||!T||E!==!1,P=()=>{if(!n?.start||!o.current)return;let e=new Date(n.start),t=(new Date().getTime()-e.getTime())/1e3;o.current?.seekTo(t)},te=t?.sources?.[0]?.uri,ne=pLr(e?.sources?.[0]?.uri),re={file:{attributes:{...n?{autoPlay:!0}:{}},hlsVersion:`1.5.19`},...ne.embedOptions?{youtube:{embedOptions:ne.embedOptions}}:{}};return(0,q.jsxs)(`div`,{className:qx(dRr.wrapper,dRr.video),children:[ee?(0,q.jsx)(X8,{image:t??void 0,className:`h-full w-full object-cover`}):(0,q.jsx)(uRr,{ref:o,url:ne.url,controls:!0,config:re,playing:n?!0:typeof c==`boolean`?c:u,playsinline:!0,width:`100%`,height:`100%`,onReady:k,onEnded:h,onPlay:p,onPause:m,onSeeking:g,onSeeked:_,onProgress:v,onError:A,onPlaybackRateChange:b,light:!1,muted:O,...l}),E?(0,q.jsxs)(`div`,{...Y8(`starting-soon`),role:`status`,className:`absolute inset-0 flex flex-col items-center justify-center gap-1 bg-black/60 p-4 text-center text-white`,children:[(0,q.jsx)(`span`,{className:`font-semibold`,children:`Starting soon`}),(0,q.jsx)(`span`,{className:`text-sm`,children:`This livestream will play when it begins.`})]}):null,te&&N&&!n&&!f?(0,q.jsxs)(`button`,{type:`button`,...Y8(`poster`),className:`absolute inset-0 flex items-center justify-center bg-black/40`,style:{backgroundImage:`url(${te})`,backgroundSize:`cover`,backgroundPosition:`center`,backgroundRepeat:`no-repeat`},onClick:()=>{d(!0)},children:[(0,q.jsx)(`span`,{className:`sr-only`,children:`Play video`}),(0,q.jsx)(qQ,{weight:`fill`,size:60,className:`text-white drop-shadow-lg`})]}):null]})},hRr=({feature:e,isInteractionEnabled:t=!1})=>e.media?(0,q.jsx)(`div`,{className:`print:hidden`,children:(0,q.jsx)(mRr,{media:e.media,shouldSendInteractions:t})}):null;Tw(`
431
+ } (data length: ${t&&t.byteLength})`),n.update(t)}selectKeySystemFormat(e){let 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.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,n)=>{let r=KOr(this.config),i=e.map(HOr).filter(e=>!!e&&r.indexOf(e)!==-1);return this.getKeySystemSelectionPromise(i).then(({keySystem:e})=>{let r=GOr(e);r?t(r):n(Error(`Unable to find format for key-system "${e}"`))}).catch(n)})}loadKey(e){let t=e.keyInfo.decryptdata,n=this.getKeyIdString(t),r=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let i=this.keyIdToKeySessionPromise[n];return i||(i=this.keyIdToKeySessionPromise[n]=this.getKeySystemForKeyPromise(t).then(({keySystem:n,mediaKeys:i})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(n,i).then(()=>{this.throwIfDestroyed();let e=this.createMediaKeySessionContext({keySystem:n,mediaKeys:i,decryptdata:t});return this.generateRequestWithPreferredKeySession(e,`cenc`,t.pssh,`playlist-key`)}))),i.catch(e=>this.handleError(e))),i}throwIfDestroyed(e=`Invalid state`){if(!this.hls)throw Error(`invalid state`)}handleError(e){this.hls&&(this.error(e.message),e instanceof Q5?this.hls.trigger(X.ERROR,e.data):this.hls.trigger(X.ERROR,{type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){let t=this.getKeyIdString(e),n=this.keyIdToKeySessionPromise[t];if(!n){let t=HOr(e.keyFormat),n=t?[t]:KOr(this.config);return this.attemptKeySystemAccess(n)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=KOr(this.config)),e.length===0)throw new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){let n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);let r=Promise.all(n).then(()=>{if(!this.media)throw Error(`Attempted to set mediaKeys without media element attached`);return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>n.indexOf(e)===-1)})}generateRequestWithPreferredKeySession(e,t,n,r){let i=this.config.drmSystems?.[e.keySystem]?.generateRequest;if(i)try{let r=i.call(this.hls,t,n,e);if(!r)throw Error(`Invalid response from configured generateRequest filter`);t=r.initDataType,n=e.decryptdata.pssh=r.initData?new Uint8Array(r.initData):null}catch(e){var a;if(this.warn(e.message),(a=this.hls)!=null&&a.config.debug)throw e}if(n===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);let o=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${o} (init data type: ${t} length: ${n?n.byteLength:null})`);let s=new ONr,c=e._onmessage=t=>{let n=e.mediaKeysSession;if(!n){s.emit(`error`,Error(`invalid state`));return}let{messageType:r,message:i}=t;this.log(`"${r}" message event for session "${n.sessionId}" message size: ${i.byteLength}`),r===`license-request`||r===`license-renewal`?this.renewLicense(e,i).catch(e=>{this.handleError(e),s.emit(`error`,e)}):r===`license-release`?e.keySystem===c5.FAIRPLAY&&(this.updateKeySession(e,VOr(`acknowledged`)),this.removeSession(e)):this.warn(`unhandled media key message type "${r}"`)},l=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession){s.emit(`error`,Error(`invalid state`));return}this.onKeyStatusChange(e);let n=e.keyStatus;s.emit(`keyStatus`,n),n===`expired`&&(this.warn(`${e.keySystem} expired for key ${o}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener(`message`,c),e.mediaKeysSession.addEventListener(`keystatuseschange`,l);let u=new Promise((e,t)=>{s.on(`error`,t),s.on(`keyStatus`,n=>{n.startsWith(`usable`)?e():n===`output-restricted`?t(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},`HDCP level output restricted`)):n===`internal-error`?t(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${n}"`)):n===`expired`?t(Error(`key expired while generating request`)):this.warn(`unhandled key status change "${n}"`)})});return e.mediaKeysSession.generateRequest(t,n).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession?.sessionId}" keyId: ${o}`)}).catch(e=>{throw new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},`Error generating key-session request: ${e}`)}).then(()=>u).catch(t=>{throw s.removeAllListeners(),this.removeSession(e),t}).then(()=>(s.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,n)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${p5.hexDump(`buffer`in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))} session keyId: ${p5.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){let 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((n,a)=>{let o={responseType:`arraybuffer`,url:i},s=t.certLoadPolicy.default,c={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};r.load(o,c,{onSuccess:(e,t,r,i)=>{n(e.data)},onError:(t,n,r,s)=>{a(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:$8({url:o.url,data:void 0},t)},`"${e}" certificate request failed (${i}). Status: ${t.code} (${t.text})`))},onTimeout:(t,n,r)=>{a(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:o.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(e,t,n)=>{a(Error(`aborted`))}})})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((r,i)=>{e.setServerCertificate(n).then(i=>{this.log(`setServerCertificate ${i?`success`:`not supported by CDM`} (${n?.byteLength}) on "${t}"`),r(e)}).catch(e=>{i(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(t=>this.updateKeySession(e,new Uint8Array(t)).catch(e=>{throw new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))}unpackPlayReadyKeyMessage(e,t){let n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes(`PlayReadyKeyMessage`))return e.setRequestHeader(`Content-Type`,`text/xml; charset=utf-8`),t;let r=new DOMParser().parseFromString(n,`application/xml`),i=r.querySelectorAll(`HttpHeader`);if(i.length>0){let t;for(let n=0,r=i.length;n<r;n++){t=i[n];let r=t.querySelector(`name`)?.textContent,a=t.querySelector(`value`)?.textContent;r&&a&&e.setRequestHeader(r,a)}}let a=r.querySelector(`Challenge`)?.textContent;if(!a)throw Error(`Cannot find <Challenge> in key message`);return VOr(atob(a))}setupLicenseXHR(e,t,n,r){let i=this.config.licenseXhrSetup;return i?Promise.resolve().then(()=>{if(!n.decryptdata)throw Error(`Key removed`);return i.call(this.hls,e,t,n,r)}).catch(a=>{if(!n.decryptdata)throw a;return e.open(`POST`,t,!0),i.call(this.hls,e,t,n,r)}).then(n=>(e.readyState||e.open(`POST`,t,!0),{xhr:e,licenseChallenge:n||r})):(e.open(`POST`,t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){let n=this.config.keyLoadPolicy.default;return new Promise((r,i)=>{let a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);let o=new XMLHttpRequest;o.responseType=`arraybuffer`,o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return i(Error(`invalid state`));if(o.readyState===4){if(o.status===200){this._requestLicenseFailureCount=0;let t=o.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);let n=this.config.licenseResponseCallback;if(n)try{t=n.call(this.hls,o,a,e)}catch(e){this.error(e)}r(t)}else{let s=n.errorRetry,c=s?s.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||o.status>=400&&o.status<500)i(new Q5({type:n5.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{let n=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${n} attempts left`),this.requestLicense(e,t).then(r,i)}}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:t,licenseChallenge:n})=>{e.keySystem==c5.PLAYREADY&&(n=this.unpackPlayReadyKeyMessage(t,n)),t.send(n)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;let n=t.media;this.media=n,n.removeEventListener(`encrypted`,this.onMediaEncrypted),n.removeEventListener(`waitingforkey`,this.onWaitingForKey),n.addEventListener(`encrypted`,this.onMediaEncrypted),n.addEventListener(`waitingforkey`,this.onWaitingForKey)}onMediaDetached(){let t=this.media,n=this.mediaKeySessions;t&&(t.removeEventListener(`encrypted`,this.onMediaEncrypted),t.removeEventListener(`waitingforkey`,this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ukr.clearKeyUriToKeyIdMap();let r=n.length;e.CDMCleanupPromise=Promise.all(n.map(e=>this.removeSession(e)).concat(t?.setMediaKeys(null).catch(e=>{this.log(`Could not clear media keys: ${e}`)}))).then(()=>{r&&(this.log(`finished closing key sessions and clearing media keys`),n.length=0)}).catch(e=>{this.log(`Could not close sessions and clear media keys: ${e}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){let e=t.reduce((e,t)=>(e.indexOf(t.keyFormat)===-1&&e.push(t.keyFormat),e),[]);this.log(`Selecting key-system from session-keys ${e.join(`, `)}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){let{mediaKeysSession:t,licenseXhr:n}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&=(t.removeEventListener(`message`,e._onmessage),void 0),e._onkeystatuseschange&&=(t.removeEventListener(`keystatuseschange`,e._onkeystatuseschange),void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;let r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(e=>{this.log(`Could not remove session: ${e}`)}).then(()=>t.close()).catch(e=>{this.log(`Could not close session: ${e}`)})}}};JPr.CDMCleanupPromise=void 0;var Q5=class extends Error{constructor(e,t){super(t),this.data=void 0,e.error||=Error(t),this.data=e,e.err=e.error}},$5;(function(e){e.MANIFEST=`m`,e.AUDIO=`a`,e.VIDEO=`v`,e.MUXED=`av`,e.INIT=`i`,e.CAPTION=`c`,e.TIMED_TEXT=`tt`,e.KEY=`k`,e.OTHER=`o`})($5||={});var YPr;(function(e){e.DASH=`d`,e.HLS=`h`,e.SMOOTH=`s`,e.OTHER=`o`})(YPr||={});var e7;(function(e){e.OBJECT=`CMCD-Object`,e.REQUEST=`CMCD-Request`,e.SESSION=`CMCD-Session`,e.STATUS=`CMCD-Status`})(e7||={});var XPr={[e7.OBJECT]:[`br`,`d`,`ot`,`tb`],[e7.REQUEST]:[`bl`,`dl`,`mtp`,`nor`,`nrr`,`su`],[e7.SESSION]:[`cid`,`pr`,`sf`,`sid`,`st`,`v`],[e7.STATUS]:[`bs`,`rtp`]},ZPr=class e{constructor(t,n){this.value=void 0,this.params=void 0,Array.isArray(t)&&(t=t.map(t=>t instanceof e?t:new e(t))),this.value=t,this.params=n}},QPr=class{constructor(e){this.description=void 0,this.description=e}},$Pr=`Dict`;function eFr(e){return Array.isArray(e)?JSON.stringify(e):e instanceof Map?`Map{}`:e instanceof Set?`Set{}`:typeof e==`object`?JSON.stringify(e):String(e)}function tFr(e,t,n,r){return Error(`failed to ${e} "${eFr(t)}" as ${n}`,{cause:r})}var nFr=`Bare Item`,rFr=`Boolean`,iFr=`Byte Sequence`,aFr=`Decimal`,oFr=`Integer`;function sFr(e){return e<-999999999999999||999999999999999<e}var cFr=/[\x00-\x1f\x7f]+/,lFr=`Token`,uFr=`Key`;function t7(e,t,n){return tFr(`serialize`,e,t,n)}function dFr(e){if(typeof e!=`boolean`)throw t7(e,rFr);return e?`?1`:`?0`}function fFr(e){return btoa(String.fromCharCode(...e))}function pFr(e){if(ArrayBuffer.isView(e)===!1)throw t7(e,iFr);return`:${fFr(e)}:`}function mFr(e){if(sFr(e))throw t7(e,oFr);return e.toString()}function hFr(e){return`@${mFr(e.getTime()/1e3)}`}function gFr(e,t){if(e<0)return-gFr(-e,t);let n=10**t;if(Math.abs(e*n%1-.5)<2**-52){let t=Math.floor(e*n);return(t%2==0?t:t+1)/n}return Math.round(e*n)/n}function _Fr(e){let t=gFr(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw t7(e,aFr);let n=t.toString();return n.includes(`.`)?n:`${n}.0`}var vFr=`String`;function yFr(e){if(cFr.test(e))throw t7(e,vFr);return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function bFr(e){return e.description||e.toString().slice(7,-1)}function xFr(e){let t=bFr(e);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t)===!1)throw t7(t,lFr);return t}function SFr(e){switch(typeof e){case`number`:if(!t5(e))throw t7(e,nFr);return Number.isInteger(e)?mFr(e):_Fr(e);case`string`:return yFr(e);case`symbol`:return xFr(e);case`boolean`:return dFr(e);case`object`:if(e instanceof Date)return hFr(e);if(e instanceof Uint8Array)return pFr(e);if(e instanceof QPr)return xFr(e);default:throw t7(e,nFr)}}function CFr(e){if(/^[a-z*][a-z0-9\-_.*]*$/.test(e)===!1)throw t7(e,uFr);return e}function wFr(e){return e==null?``:Object.entries(e).map(([e,t])=>t===!0?`;${CFr(e)}`:`;${CFr(e)}=${SFr(t)}`).join(``)}function TFr(e){return e instanceof ZPr?`${SFr(e.value)}${wFr(e.params)}`:SFr(e)}function EFr(e){return`(${e.value.map(TFr).join(` `)})${wFr(e.params)}`}function DFr(e,t={whitespace:!0}){if(typeof e!=`object`)throw t7(e,$Pr);let n=e instanceof Map?e.entries():Object.entries(e),r=t!=null&&t.whitespace?` `:``;return Array.from(n).map(([e,t])=>{t instanceof ZPr||(t=new ZPr(t));let n=CFr(e);return t.value===!0?n+=wFr(t.params):(n+=`=`,Array.isArray(t.value)?n+=EFr(t):n+=TFr(t)),n}).join(`,${r}`)}function OFr(e,t){return DFr(e,t)}var kFr=e=>e===`ot`||e===`sf`||e===`st`,AFr=e=>typeof e==`number`?t5(e):e!=null&&e!==``&&e!==!1;function jFr(e,t){let n=new URL(e),r=new URL(t);if(n.origin!==r.origin)return e;let i=n.pathname.split(`/`).slice(1),a=r.pathname.split(`/`).slice(1,-1);for(;i[0]===a[0];)i.shift(),a.shift();for(;a.length;)a.shift(),i.unshift(`..`);return i.join(`/`)}function MFr(){try{return crypto.randomUUID()}catch{try{let e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf(`/`)+1)}catch{let e=new Date().getTime();return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t==`x`?n:n&3|8).toString(16)})}}}var NFr=e=>Math.round(e),PFr=(e,t)=>(t!=null&&t.baseUrl&&(e=jFr(e,t.baseUrl)),encodeURIComponent(e)),FFr=e=>NFr(e/100)*100,IFr={br:NFr,d:NFr,bl:FFr,dl:FFr,mtp:FFr,nor:PFr,rtp:FFr,tb:NFr};function LFr(e,t){let n={};if(typeof e!=`object`||!e)return n;let r=Object.keys(e).sort(),i=e5({},IFr,t?.formatters),a=t?.filter;return r.forEach(r=>{if(a!=null&&a(r))return;let o=e[r],s=i[r];s&&(o=s(o,t)),r===`v`&&o===1||r==`pr`&&o===1||!AFr(o)||(kFr(r)&&typeof o==`string`&&(o=new QPr(o)),n[r]=o)}),n}function RFr(e,t={}){return e?OFr(LFr(e,t),e5({whitespace:!1},t)):``}function zFr(e,t={}){if(!e)return{};let n=Object.entries(e),r=Object.entries(XPr).concat(Object.entries(t?.customHeaderMap||{})),i=n.reduce((e,t)=>{let[n,i]=t,a=r.find(e=>e[1].includes(n))?.[0]||e7.REQUEST;return e[a]??(e[a]={}),e[a][n]=i,e},{});return Object.entries(i).reduce((e,[n,r])=>(e[n]=RFr(r,t),e),{})}function BFr(e,t,n){return e5(e,zFr(t,n))}var VFr=`CMCD`;function HFr(e,t={}){if(!e)return``;let n=RFr(e,t);return`${VFr}=${encodeURIComponent(n)}`}var UFr=/CMCD=[^&#]+/;function WFr(e,t,n){let r=HFr(t,n);return r?UFr.test(e)?e.replace(UFr,r):`${e}${e.includes(`?`)?`&`:`?`}${r}`:e}var GFr=class{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||=!0,this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:$5.MANIFEST,su:!this.initialized})}catch(e){Q.warn(`Could not generate manifest CMCD data.`,e)}},this.applyFragmentData=e=>{try{let t=e.frag,n=this.hls.levels[t.level],r=this.getObjectType(t),i={d:t.duration*1e3,ot:r};(r===$5.VIDEO||r===$5.AUDIO||r==$5.MUXED)&&(i.br=n.bitrate/1e3,i.tb=this.getTopBandwidth(r)/1e3,i.bl=this.getBufferLength(r)),this.apply(e,i)}catch(e){Q.warn(`Could not generate segment CMCD data.`,e)}},this.hls=e;let t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||MFr(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){let e=this.hls;e.on(X.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(X.MEDIA_DETACHED,this.onMediaDetached,this),e.on(X.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){let e=this.hls;e.off(X.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(X.MEDIA_DETACHED,this.onMediaDetached,this),e.off(X.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=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),null)}onBufferCreated(e,t){this.audioBuffer=t.tracks.audio?.buffer,this.videoBuffer=t.tracks.video?.buffer}createData(){return{v:1,sf:YPr.HLS,sid:this.sid,cid:this.cid,pr:this.media?.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){e5(t,this.createData());let n=t.ot===$5.INIT||t.ot===$5.VIDEO||t.ot===$5.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su??(t.su=this.buffering);let{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((e,n)=>(r.includes(n)&&(e[n]=t[n]),e),{})),this.useHeaders?(e.headers||={},BFr(e.headers,t)):e.url=WFr(e.url,t)}getObjectType(e){let{type:t}=e;if(t===`subtitle`)return $5.TIMED_TEXT;if(e.sn===`initSegment`)return $5.INIT;if(t===`audio`)return $5.AUDIO;if(t===`main`)return this.hls.audioTracks.length?$5.VIDEO:$5.MUXED}getTopBandwidth(e){let t=0,n,r=this.hls;if(e===$5.AUDIO)n=r.audioTracks;else{let e=r.maxAutoLevel,t=e>-1?e+1:r.levels.length;n=r.levels.slice(0,t)}for(let e of n)e.bitrate>t&&(t=e.bitrate);return t>0?t:NaN}getBufferLength(e){let t=this.hls.media,n=e===$5.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:L5.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){let{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new n(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,n,r){t(e),this.loader.load(e,n,r)}}}createFragmentLoader(){let{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new n(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,n,r){t(e),this.loader.load(e,n,r)}}}},KFr=3e5,qFr=class{constructor(e){this.hls=void 0,this.log=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.log=Q.log.bind(Q,`[content-steering]:`),this.registerListeners()}registerListeners(){let e=this.hls;e.on(X.MANIFEST_LOADING,this.onManifestLoading,this),e.on(X.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(X.MANIFEST_PARSED,this.onManifestParsed,this),e.on(X.ERROR,this.onError,this)}unregisterListeners(){let e=this.hls;e&&(e.off(X.MANIFEST_LOADING,this.onManifestLoading,this),e.off(X.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(X.MANIFEST_PARSED,this.onManifestParsed,this),e.off(X.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){let 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(),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){let t=this.levels;t&&(this.levels=t.filter(t=>t!==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){let{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){let{errorAction:n}=t;if(n?.action===O5.SendAlternateToPenaltyBox&&n.flags===k5.MoveAllAlternatesMatchingHost){let e=this.levels,r=this.pathwayPriority,i=this.pathwayId;if(t.context){let{groupId:n,pathwayId:r,type:a}=t.context;n&&e?i=this.getPathwayForGroupId(n,a,i):r&&(i=r)}i in this.penalizedPathways||(this.penalizedPathways[i]=performance.now()),!r&&e&&(r=e.reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])),r&&r.length>1&&(this.updatePathwayPriority(r),n.resolved=this.pathwayId!==i),n.resolved||Q.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${i} levels: ${e&&e.length} priorities: ${JSON.stringify(r)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){let 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,n=this.penalizedPathways,r=performance.now();Object.keys(n).forEach(e=>{r-n[e]>KFr&&delete n[e]});for(let r=0;r<e.length;r++){let i=e[r];if(i in n)continue;if(i===this.pathwayId)return;let a=this.hls.nextLoadLevel,o=this.hls.levels[a];if(t=this.getLevelsForPathway(i),t.length>0){this.log(`Setting Pathway to "${i}"`),this.pathwayId=i,ajr(t),this.hls.trigger(X.LEVELS_UPDATED,{levels:t});let e=this.hls.levels[a];o&&e&&this.levels&&(e.attrs[`STABLE-VARIANT-ID`]!==o.attrs[`STABLE-VARIANT-ID`]&&e.bitrate!==o.bitrate&&this.log(`Unstable Pathways change from bitrate ${o.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,n){let r=this.getLevelsForPathway(n).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===C5.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===C5.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return n}clonePathways(e){let t=this.levels;if(!t)return;let n={},r={};e.forEach(e=>{let{ID:i,"BASE-ID":a,"URI-REPLACEMENT":o}=e;if(t.some(e=>e.pathwayId===i))return;let s=this.getLevelsForPathway(a).map(e=>{let t=new a5(e.attrs);t[`PATHWAY-ID`]=i;let a=t.AUDIO&&`${t.AUDIO}_clone_${i}`,s=t.SUBTITLES&&`${t.SUBTITLES}_clone_${i}`;a&&(n[t.AUDIO]=a,t.AUDIO=a),s&&(r[t.SUBTITLES]=s,t.SUBTITLES=s);let c=YFr(e.uri,t[`STABLE-VARIANT-ID`],`PER-VARIANT-URIS`,o),l=new D5({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:c,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t<e.audioGroups.length;t++)l.addGroupId(`audio`,`${e.audioGroups[t]}_clone_${i}`);if(e.subtitleGroups)for(let t=1;t<e.subtitleGroups.length;t++)l.addGroupId(`text`,`${e.subtitleGroups[t]}_clone_${i}`);return l});t.push(...s),JFr(this.audioTracks,n,o,i),JFr(this.subtitleTracks,r,o,i)})}loadSteeringManifest(e){let 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:`){let e=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set(`_HLS_pathway`,this.pathwayId),r.searchParams.set(`_HLS_throughput`,``+e)}let i={responseType:`json`,url:r.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},s={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0};this.log(`Requesting steering manifest: ${r}`),this.loader.load(i,s,{onSuccess:(e,t,n,i)=>{this.log(`Loaded steering manifest: "${r}"`);let a=e.data;if(a.VERSION!==1){this.log(`Steering VERSION ${a.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=a.TTL;let{"RELOAD-URI":o,"PATHWAY-CLONES":s,"PATHWAY-PRIORITY":c}=a;if(o)try{this.uri=new self.URL(o,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${o}`);return}this.scheduleRefresh(this.uri||n.url),s&&this.clonePathways(s);let l={steeringManifest:a,url:r.toString()};this.hls.trigger(X.STEERING_MANIFEST_LOADED,l),c&&this.updatePathwayPriority(c)},onError:(e,t,n,r)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),e.code===410){this.enabled=!1,this.log(`Steering manifest ${t.url} no longer available`);return}let i=this.timeToLoad*1e3;if(e.code===429){let e=this.loader;if(typeof e?.getResponseHeader==`function`){let t=e.getResponseHeader(`Retry-After`);t&&(i=parseFloat(t)*1e3)}this.log(`Steering manifest ${t.url} rate limited`)}else this.scheduleRefresh(this.uri||t.url,i)},onTimeout:(e,t,n)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}})}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{let t=this.hls?.media;t&&!t.ended?this.loadSteeringManifest(e):this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}};function JFr(e,t,n,r){e&&Object.keys(t).forEach(i=>{let a=e.filter(e=>e.groupId===i).map(e=>{let a=e5({},e);return a.details=void 0,a.attrs=new a5(a.attrs),a.url=a.attrs.URI=YFr(e.url,e.attrs[`STABLE-RENDITION-ID`],`PER-RENDITION-URIS`,n),a.groupId=a.attrs[`GROUP-ID`]=t[i],a.attrs[`PATHWAY-ID`]=r,a});e.push(...a)})}function YFr(e,t,n,r){let{HOST:i,PARAMS:a,[n]:o}=r,s;t&&(s=o?.[t],s&&(e=s));let c=new self.URL(e);return i&&!s&&(c.host=i),a&&Object.keys(a).sort().forEach(e=>{e&&c.searchParams.set(e,a[e])}),c.href}var XFr=/^age:\s*[\d.]+\s*$/im,ZFr=class{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 jOr,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){let 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 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(){let{config:e,context:t}=this;if(!e||!t)return;let n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;let i=this.xhrSetup;i?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return i(n,t.url)}).catch(e=>{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(e=>{this.callbacks.onError({code:n.status,text:e.message},t,n,r)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open(`GET`,t.url,!0);let r=t.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:a}=n.loadPolicy;if(r)for(let t in r)e.setRequestHeader(t,r[t]);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&&t5(i)?i:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:n}=this;if(!e||!t)return;let 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;let r=t.status,a=t.responseType===`text`?t.responseText:null;if(r>=200&&r<300){let i=a??t.response;if(i!=null){if(n.loading.end=Math.max(self.performance.now(),n.loading.first),n.loaded=n.total=t.responseType===`arraybuffer`?i.byteLength:i.length,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first),!this.callbacks)return;let a=this.callbacks.onProgress;if(a&&a(n,e,i,t),!this.callbacks)return;let o={url:t.responseURL,data:i,code:r};this.callbacks.onSuccess(o,n,e,t);return}}let o=i.loadPolicy.errorRetry,s=n.retry;ujr(o,s,!1,{url:e.url,data:void 0,code:r})?this.retry(o):(Q.error(`${r} while loading ${e.url}`),this.callbacks.onError({code:r,text:t.statusText},e,t,n))}}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(ujr(e,t,!0))this.retry(e);else{Q.warn(`timeout while loading ${this.context?.url}`);let e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){let{context:t,stats:n}=this;this.retryDelay=cjr(e,n.retry),n.retry++,Q.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){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&XFr.test(this.loader.getAllResponseHeaders())){let t=this.loader.getResponseHeader(`age`);e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&RegExp(`^${e}:\\s*[\\d.]+\\s*$`,`im`).test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}};function QFr(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}var $Fr=/(\d+)-(\d+)\/(\d+)/,eIr=class{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||iIr,this.controller=new self.AbortController,this.stats=new jOr}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){let r=this.stats;if(r.loading.start)throw Error(`Loader can only be used once.`);r.loading.start=self.performance.now();let i=tIr(e,this.controller.signal),a=n.onProgress,o=e.responseType===`arraybuffer`,s=o?`byteLength`:`length`,{maxTimeToFirstByteMs:c,maxLoadTimeMs:l}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,i),self.clearTimeout(this.requestTimeout),t.timeout=c&&t5(c)?c:l,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(i=>{this.response=this.loader=i;let s=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=l,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(r,e,this.response)},l-(s-r.loading.start)),!i.ok){let{status:e,statusText:t}=i;throw new aIr(t||`fetch, bad network response`,e,i)}return r.loading.first=s,r.total=rIr(i.headers)||r.total,a&&t5(t.highWaterMark)?this.loadProgressively(i,r,e,t.highWaterMark,a):o?i.arrayBuffer():e.responseType===`json`?i.json():i.text()}).then(i=>{let o=this.response;if(!o)throw Error(`loader destroyed`);self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);let c=i[s];c&&(r.loaded=r.total=c);let l={url:o.url,data:i,code:o.status};a&&!t5(t.highWaterMark)&&a(r,e,i,o),n.onSuccess(l,r,e,o)}).catch(t=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;let i=t&&t.code||0,a=t?t.message:null;n.onError({code:i,text:a},e,t?t.details:null,r)})}getCacheAge(){let e=null;if(this.response){let 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){let a=new cMr,o=e.body.getReader(),s=()=>o.read().then(o=>{if(o.done)return a.dataLength&&i(t,n,a.flush(),e),Promise.resolve(new ArrayBuffer(0));let c=o.value,l=c.length;return t.loaded+=l,l<r||a.dataLength?(a.push(c),a.dataLength>=r&&i(t,n,a.flush(),e)):i(t,n,c,e),s()}).catch(()=>Promise.reject());return s()}};function tIr(e,t){let n={method:`GET`,mode:`cors`,credentials:`same-origin`,signal:t,headers:new self.Headers(e5({},e.headers))};return e.rangeEnd&&n.headers.set(`Range`,`bytes=`+e.rangeStart+`-`+String(e.rangeEnd-1)),n}function nIr(e){let t=$Fr.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}function rIr(e){let t=e.get(`Content-Range`);if(t){let e=nIr(t);if(t5(e))return e}let n=e.get(`Content-Length`);if(n)return parseInt(n)}function iIr(e,t){return new self.Request(e.url,t)}var aIr=class extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}},oIr=/\s/,sIr={newCue(e,t,n,r){let i=[],a,o,s,c,l,u=self.VTTCue||self.TextTrackCue;for(let f=0;f<r.rows.length;f++)if(a=r.rows[f],s=!0,c=0,l=``,!a.isEmpty()){var d;for(let e=0;e<a.chars.length;e++)oIr.test(a.chars[e].uchar)&&s?c++:(l+=a.chars[e].uchar,s=!1);a.cueStartTime=t,t===n&&(n+=1e-4),c>=16?c--:c++;let r=gPr(l.trim()),p=SPr(t,n,r);e!=null&&(d=e.cues)!=null&&d.getCueById(p)||(o=new u(t,n,r),o.id=p,o.line=f+1,o.align=`left`,o.position=10+Math.min(80,Math.floor(c*8/32)*10),i.push(o))}return e&&i.length&&(i.sort((e,t)=>e.line===`auto`||t.line===`auto`?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),i.forEach(t=>EAr(e,t))),i}},cIr=$8($8({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,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,loader:ZFr,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Fjr,bufferController:VNr,capLevelController:GPr,errorController:yjr,fpsController:KPr,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:qOr,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},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}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},lIr()),{},{subtitleStreamController:INr,subtitleTrackController:RNr,timelineController:BPr,audioStreamController:NNr,audioTrackController:PNr,emeController:JPr,cmcdController:GFr,contentSteeringController:qFr});function lIr(){return{cueHandler:sIr,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 uIr(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw Error(`Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration`);if(t.liveMaxLatencyDurationCount!==void 0&&(t.liveSyncDurationCount===void 0||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw Error(`Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"`);if(t.liveMaxLatencyDuration!==void 0&&(t.liveSyncDuration===void 0||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw Error(`Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"`);let n=dIr(e),r=[`manifest`,`level`,`frag`],i=[`TimeOut`,`MaxRetry`,`RetryDelay`,`MaxRetryTimeout`];return r.forEach(e=>{let r=`${e===`level`?`playlist`:e}LoadPolicy`,a=t[r]===void 0,o=[];i.forEach(i=>{let s=`${e}Loading${i}`,c=t[s];if(c!==void 0&&a){o.push(s);let e=n[r].default;switch(t[r]={default:e},i){case`TimeOut`:e.maxLoadTimeMs=c,e.maxTimeToFirstByteMs=c;break;case`MaxRetry`:e.errorRetry.maxNumRetry=c,e.timeoutRetry.maxNumRetry=c;break;case`RetryDelay`:e.errorRetry.retryDelayMs=c,e.timeoutRetry.retryDelayMs=c;break;case`MaxRetryTimeout`:e.errorRetry.maxRetryDelayMs=c,e.timeoutRetry.maxRetryDelayMs=c}}}),o.length&&Q.warn(`hls.js config: "${o.join(`", "`)}" setting(s) are deprecated, use "${r}": ${JSON.stringify(t[r])}`)}),$8($8({},n),t)}function dIr(e){return e&&typeof e==`object`?Array.isArray(e)?e.map(dIr):Object.keys(e).reduce((t,n)=>(t[n]=dIr(e[n]),t),{}):e}function fIr(e){let t=e.loader;t!==eIr&&t!==ZFr?(Q.log(`[config]: Custom loader detected, cannot enable progressive streaming`),e.progressive=!1):QFr()&&(e.loader=eIr,e.progressive=!0,e.enableSoftwareAES=!0,Q.log(`[config]: Progressive streaming enabled, using FetchLoader`))}var pIr,mIr=class extends bjr{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(){let{hls:e}=this;e.on(X.MANIFEST_LOADING,this.onManifestLoading,this),e.on(X.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(X.LEVEL_LOADED,this.onLevelLoaded,this),e.on(X.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(X.FRAG_BUFFERED,this.onFragBuffered,this),e.on(X.ERROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(X.MANIFEST_LOADING,this.onManifestLoading,this),e.off(X.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(X.LEVEL_LOADED,this.onLevelLoaded,this),e.off(X.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(X.FRAG_BUFFERED,this.onFragBuffered,this),e.off(X.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.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){let n=this.hls.config.preferManagedMediaSource,r=[],i={},a={},o=!1,s=!1,c=!1;t.levels.forEach(e=>{let t=e.attrs,{audioCodec:l,videoCodec:u}=e;l?.indexOf(`mp4a.40.34`)!==-1&&(pIr||=/chrome|firefox/i.test(navigator.userAgent),pIr&&(e.audioCodec=l=void 0)),l&&(e.audioCodec=l=oAr(l,n)),u?.indexOf(`avc1`)===0&&(u=e.videoCodec=cAr(u));let{width:d,height:f,unknownCodecs:p}=e;if(o||=!!(d&&f),s||=!!u,c||=!!l,p!=null&&p.length||l&&!$kr(l,`audio`,n)||u&&!$kr(u,`video`,n))return;let{CODECS:m,"FRAME-RATE":h,"HDCP-LEVEL":g,"PATHWAY-ID":_,RESOLUTION:v,"VIDEO-RANGE":y}=t,b=`${`${_||`.`}-`}${e.bitrate}-${v}-${h}-${m}-${y}-${g}`;if(!i[b]){let t=new D5(e);i[b]=t,a[b]=1,r.push(t)}else if(i[b].uri!==e.url&&!e.attrs[`PATHWAY-ID`]){let t=a[b]+=1;e.attrs[`PATHWAY-ID`]=Array(t+1).join(`.`);let n=new D5(e);i[b]=n,r.push(n)}else i[b].addGroupId(`audio`,t.AUDIO),i[b].addGroupId(`text`,t.SUBTITLES)}),this.filterAndSortMediaOptions(r,t,o,s,c)}filterAndSortMediaOptions(e,t,n,r,i){let a=[],o=[],s=e;if((n||r)&&i&&(s=s.filter(({videoCodec:e,videoRange:t,width:n,height:r})=>(!!e||!!(n&&r))&&HAr(t))),s.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);let e=Error(`no level with compatible codecs found in manifest`);this.hls.trigger(X.ERROR,{type:n5.MEDIA_ERROR,details:Z.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}});return}if(t.audioTracks){let{preferManagedMediaSource:e}=this.hls.config;a=t.audioTracks.filter(t=>!t.audioCodec||$kr(t.audioCodec,`audio`,e)),hIr(a)}t.subtitles&&(o=t.subtitles,hIr(o));let c=s.slice(0);s.sort((e,t)=>{if(e.attrs[`HDCP-LEVEL`]!==t.attrs[`HDCP-LEVEL`])return(e.attrs[`HDCP-LEVEL`]||``)>(t.attrs[`HDCP-LEVEL`]||``)?1:-1;if(n&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return VAr.indexOf(e.videoRange)-VAr.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){let n=tAr(e.videoCodec),r=tAr(t.videoCodec);if(n!==r)return r-n}if(e.uri===t.uri&&e.codecSet!==t.codecSet){let n=nAr(e.codecSet),r=nAr(t.codecSet);if(n!==r)return r-n}return e.averageBitrate===t.averageBitrate?0:e.averageBitrate-t.averageBitrate});let l=c[0];if(this.steering&&(s=this.steering.filterParsedLevels(s),s.length!==c.length)){for(let e=0;e<c.length;e++)if(c[e].pathwayId===s[0].pathwayId){l=c[e];break}}this._levels=s;for(let e=0;e<s.length;e++)if(s[e]===l){this._firstLevel=e;let t=l.bitrate,n=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${s.length} level(s) found, first bitrate: ${t}`),this.hls.userConfig?.abrEwmaDefaultEstimate===void 0){let e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>n&&n===cIr.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}let u=i&&!r,d={levels:s,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:i,video:r,altAudio:!u&&a.some(e=>!!e.url)};this.hls.trigger(X.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){let t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){let n=Error(`invalid level idx`),r=e<0;if(this.hls.trigger(X.ERROR,{type:n5.OTHER_ERROR,details:Z.LEVEL_SWITCH_ERROR,level:e,fatal:r,error:n,reason:n.message}),r)return;e=Math.min(e,t.length-1)}let n=this.currentLevelIndex,r=this.currentLevel,i=r?r.attrs[`PATHWAY-ID`]:void 0,a=t[e],o=a.attrs[`PATHWAY-ID`];if(this.currentLevelIndex=e,this.currentLevel=a,n===e&&a.details&&r&&i===o)return;this.log(`Switching to level ${e} (${a.height?a.height+`p `:``}${a.videoRange?a.videoRange+` `:``}${a.codecSet?a.codecSet+` `:``}@${a.bitrate})${o?` with Pathway `+o:``} from level ${n}${i?` with Pathway `+i:``}`);let s={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(X.LEVEL_SWITCHING,s);let c=a.details;if(!c||c.live){let e=this.switchParams(a.uri,r?.details,c);this.loadPlaylist(e)}}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){let e=this.hls.config.startLevel;return e===void 0?this.hls.firstAutoLevel:e}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){!t.fatal&&t.context&&t.context.type===C5.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===w5.MAIN){let e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;let n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var n;let{level:r,details:i}=t,a=this._levels[r];if(a)r===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0),this.playlistLoaded(r,t,a.details)):(n=t.deliveryDirectives)!=null&&n.skip&&(i.deltaUpdateFailed=!0);else{var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(i.deltaUpdateFailed=!0)}}loadPlaylist(e){super.loadPlaylist();let t=this.currentLevelIndex,n=this.currentLevel;if(n&&this.shouldLoadPlaylist(n)){let r=n.uri;if(e)try{r=e.addDirectives(r)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}let i=n.attrs[`PATHWAY-ID`];this.log(`Loading level index ${t}${e?.msn===void 0?``:` at sn `+e.msn+` part `+e.part} with${i?` Pathway `+i:``} ${r}`),this.clearTimer(),this.hls.trigger(X.LEVEL_LOADING,{url:r,level:t,pathwayId:n.attrs[`PATHWAY-ID`],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex===-1?this.hls.nextAutoLevel:this.manualLevelIndex}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;let n=this._levels.filter((t,n)=>n!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1));ajr(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(X.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(X.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}};function hIr(e){let t={};e.forEach(e=>{let n=e.groupId||``;e.id=t[n]=t[n]||0,t[n]++})}var gIr=class{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(let t in this.keyUriToKeyInfo){let n=this.keyUriToKeyInfo[t].loader;if(n){if(e&&e!==n.context?.frag.type)return;n.abort()}}}detach(){for(let e in this.keyUriToKeyInfo){let t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(let e in this.keyUriToKeyInfo){let t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=Z.KEY_LOAD_ERROR,n,r,i){return new R5({type:n5.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:i,error:n,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){let{sn:n,cc:r}=e;for(let e=0;e<t.length;e++){let i=t[e];if(r<=i.cc&&(n===`initSegment`||i.sn===`initSegment`||n<i.sn)){this.emeController.selectKeySystemFormat(i).then(e=>{i.setKeyFormat(e)});break}}}}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);let i=e.decryptdata;if(!i){let n=Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading`);return Promise.reject(this.createKeyLoadError(e,Z.KEY_LOAD_ERROR,n))}let a=i.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,Z.KEY_LOAD_ERROR,Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if((n=o)!=null&&n.decryptdata.key)return i.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((r=o)!=null&&r.keyLoadPromise)switch(o.mediaKeySessionContext?.keyStatus){case void 0:case`status-pending`:case`usable`:case`usable-in-future`:return o.keyLoadPromise.then(t=>(i.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}switch(o=this.keyUriToKeyInfo[a]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case`ISO-23001-7`:case`SAMPLE-AES`:case`SAMPLE-AES-CENC`:case`SAMPLE-AES-CTR`:return i.keyFormat===`identity`?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case`AES-128`:return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,Z.KEY_LOAD_ERROR,Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(e,t){let n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){let t=this.emeController.loadKey(n);if(t)return(e.keyLoadPromise=t.then(t=>(e.mediaKeySessionContext=t,n))).catch(t=>{throw e.keyLoadPromise=null,t})}return Promise.resolve(n)}loadKeyHTTP(e,t){let n=this.config,r=n.loader,i=new r(n);return t.keyLoader=e.loader=i,e.keyLoadPromise=new Promise((r,a)=>{let o={keyInfo:e,frag:t,responseType:`arraybuffer`,url:e.decryptdata.uri},s=n.keyLoadPolicy.default,c={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};i.load(o,c,{onSuccess:(e,t,n,i)=>{let{frag:o,keyInfo:s,url:c}=n;if(!o.decryptdata||s!==this.keyUriToKeyInfo[c])return a(this.createKeyLoadError(o,Z.KEY_LOAD_ERROR,Error(`after key load, decryptdata unset or changed`),i));s.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=null,s.loader=null,r({frag:o,keyInfo:s})},onError:(e,n,r,i)=>{this.resetLoader(n),a(this.createKeyLoadError(t,Z.KEY_LOAD_ERROR,Error(`HTTP Error ${e.code} loading key ${e.text}`),r,$8({url:o.url,data:void 0},e)))},onTimeout:(e,n,r)=>{this.resetLoader(n),a(this.createKeyLoadError(t,Z.KEY_LOAD_TIMEOUT,Error(`key loading timed out`),r))},onAbort:(e,n,r)=>{this.resetLoader(n),a(this.createKeyLoadError(t,Z.INTERNAL_ABORTED,Error(`key loading aborted`),r))}})})}resetLoader(e){let{frag:t,keyInfo:n,url:r}=e,i=n.loader;t.keyLoader===i&&(t.keyLoader=null,n.loader=null),delete this.keyUriToKeyInfo[r],i&&i.destroy()}};function _Ir(){return self.SourceBuffer||self.WebKitSourceBuffer}function vIr(){if(!b5())return!1;let e=_Ir();return!e||e.prototype&&typeof e.prototype.appendBuffer==`function`&&typeof e.prototype.remove==`function`}function yIr(){if(!vIr())return!1;let e=b5();return typeof e?.isTypeSupported==`function`&&([`avc1.42E01E,mp4a.40.2`,`av01.0.01M.08`,`vp09.00.50.08`].some(t=>e.isTypeSupported(x5(t,`video`)))||[`mp4a.40.2`,`fLaC`].some(t=>e.isTypeSupported(x5(t,`audio`))))}function bIr(){return typeof _Ir()?.prototype?.changeType==`function`}var xIr=250,SIr=2,CIr=.1,wIr=.05,TIr=class{constructor(e,t,n,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=n,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){let{config:n,media:r,stalled:i}=this;if(r===null)return;let{currentTime:a,seeking:o}=r,s=this.seeking&&!o,c=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,o||(this.nudgeRetry=0),i!==null){if(this.stallReported){let e=self.performance.now()-i;Q.warn(`playback not stuck anymore @${a}, after ${Math.round(e)}ms`),this.stallReported=!1}this.stalled=null}return}if(c||s){this.stalled=null;return}if(r.paused&&!o||r.ended||r.playbackRate===0||!L5.getBuffered(r).length){this.nudgeRetry=0;return}let l=L5.bufferInfo(r,a,0),u=l.nextStart||0;if(o){let e=l.len>SIr,n=!u||t&&t.start<=a||u-a>SIr&&!this.fragmentTracker.getPartialFragment(a);if(e||n)return;this.moved=!1}if(!this.moved&&this.stalled!==null){if(!(l.len>0)&&!u)return;let e=Math.max(u,l.start||0)-a,t=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,n=t!=null&&t.details?.live?t.details.targetduration*2:SIr,i=this.fragmentTracker.getPartialFragment(a);if(e>0&&(e<=n||i)){r.paused||this._trySkipBufferHole(i);return}}let d=self.performance.now();if(i===null){this.stalled=d;return}let f=d-i;if(!o&&f>=xIr&&(this._reportStall(l),!this.media))return;let p=L5.bufferInfo(r,a,n.maxBufferHole);this._tryFixBufferStall(p,f)}_tryFixBufferStall(e,t){let{config:n,fragmentTracker:r,media:i}=this;if(i===null)return;let a=i.currentTime,o=r.getPartialFragment(a);(!o||!this._trySkipBufferHole(o)&&this.media)&&(e.len>n.maxBufferHole||e.nextStart&&e.nextStart-a<n.maxBufferHole)&&t>n.highBufferWatchdogPeriod*1e3&&(Q.warn(`Trying to nudge playhead over buffer-hole`),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){let{hls:t,media:n,stallReported:r}=this;if(!r&&n){this.stallReported=!0;let r=Error(`Playback stalling at @${n.currentTime} due to low buffer (${JSON.stringify(e)})`);Q.warn(r.message),t.trigger(X.ERROR,{type:n5.MEDIA_ERROR,details:Z.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len})}}_trySkipBufferHole(e){let{config:t,hls:n,media:r}=this;if(r===null)return 0;let i=r.currentTime,a=L5.bufferInfo(r,i,0),o=i<a.start?a.start:a.nextStart;if(o){let s=a.len<=t.maxBufferHole,c=a.len>0&&a.len<1&&r.readyState<3,l=o-i;if(l>0&&(s||c)){if(l>t.maxBufferHole){let{fragmentTracker:t}=this,n=!1;if(i===0){let e=t.getAppendedFrag(0,w5.MAIN);e&&o<e.end&&(n=!0)}if(!n){let n=e||t.getAppendedFrag(i,w5.MAIN);if(n){let e=!1,r=n.end;for(;r<o;){let n=t.getPartialFragment(r);if(n)r+=n.duration;else{e=!0;break}}if(e)return 0}}}let a=Math.max(o+wIr,i+CIr);if(Q.warn(`skipping hole, adjusting currentTime from ${i} to ${a}`),this.moved=!0,this.stalled=null,r.currentTime=a,e&&!e.gap){let t=Error(`fragment loaded with buffer holes, seeking from ${i} to ${a}`);n.trigger(X.ERROR,{type:n5.MEDIA_ERROR,details:Z.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:t,reason:t.message,frag:e})}return a}}return 0}_tryNudgeBuffer(){let{config:e,hls:t,media:n,nudgeRetry:r}=this;if(n===null)return;let i=n.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){let a=i+(r+1)*e.nudgeOffset,o=Error(`Nudging 'currentTime' from ${i} to ${a}`);Q.warn(o.message),n.currentTime=a,t.trigger(X.ERROR,{type:n5.MEDIA_ERROR,details:Z.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{let n=Error(`Playhead still not moving while enough data buffered @${i} after ${e.nudgeMaxRetry} nudges`);Q.error(n.message),t.trigger(X.ERROR,{type:n5.MEDIA_ERROR,details:Z.BUFFER_STALLED_ERROR,error:n,fatal:!0})}}},EIr=100,DIr=class extends sMr{constructor(e,t,n){super(e,t,n,`[stream-controller]`,w5.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){let{hls:e}=this;e.on(X.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(X.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(X.MANIFEST_LOADING,this.onManifestLoading,this),e.on(X.MANIFEST_PARSED,this.onManifestParsed,this),e.on(X.LEVEL_LOADING,this.onLevelLoading,this),e.on(X.LEVEL_LOADED,this.onLevelLoaded,this),e.on(X.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(X.ERROR,this.onError,this),e.on(X.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(X.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(X.BUFFER_CREATED,this.onBufferCreated,this),e.on(X.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(X.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(X.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){let{hls:e}=this;e.off(X.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(X.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(X.MANIFEST_LOADING,this.onManifestLoading,this),e.off(X.MANIFEST_PARSED,this.onManifestParsed,this),e.off(X.LEVEL_LOADED,this.onLevelLoaded,this),e.off(X.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(X.ERROR,this.onError,this),e.off(X.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(X.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(X.BUFFER_CREATED,this.onBufferCreated,this),e.off(X.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(X.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(X.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){let{lastCurrentTime:t,hls:n}=this;if(this.stopLoad(),this.setInterval(EIr),this.level=-1,!this.startFragRequested){let e=n.startLevel;e===-1&&(n.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=n.firstAutoLevel),n.nextLoadLevel=e,this.level=n.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=$.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=$.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case $.WAITING_LEVEL:{let{levels:e,level:t}=this,n=e?.[t],r=n?.details;if(r&&(!r.live||this.levelLastLoaded===n)){if(this.waitForCdnTuneIn(r))break;this.state=$.IDLE;break}if(this.hls.nextLoadLevel!==this.level){this.state=$.IDLE;break}break}case $.FRAG_LOADING_WAITING_RETRY:{var e;let t=self.performance.now(),n=this.retryDate;if(!n||t>=n||(e=this.media)!=null&&e.seeking){let{levels:e,level:t}=this,n=e?.[t];this.resetStartWhenNotLoaded(n||null),this.state=$.IDLE}}}this.state===$.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:n,media:r}=this;if(t===null||!r&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;let i=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[i]))return;let a=n[i],o=this.getMainFwdBufferInfo();if(o===null)return;let s=this.getLevelDetails();if(s&&this._streamEnded(o,s)){let e={};this.altAudio&&(e.type=`video`),this.hls.trigger(X.BUFFER_EOS,e),this.state=$.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;let c=a.details;if(!c||this.state===$.WAITING_LEVEL||c.live&&this.levelLastLoaded!==a){this.level=i,this.state=$.WAITING_LEVEL;return}let l=o.len,u=this.getMaxBufferLength(a.maxBitrate);if(l>=u)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);let d=this.backtrackFragment?this.backtrackFragment.start:o.end,f=this.getNextFragment(d,c);if(this.couldBacktrack&&!this.fragPrevious&&f&&f.sn!==`initSegment`&&this.fragmentTracker.getState(f)!==F5.OK){let e=(this.backtrackFragment??f).sn-c.startSN,t=c.fragments[e-1];t&&f.cc===t.cc&&(f=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,d)){if(!f.gap){let e=this.audioOnly&&!this.altAudio?o5.AUDIO:o5.VIDEO,t=(e===o5.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,w5.MAIN)}f=this.getNextFragmentLoopLoading(f,c,o,w5.MAIN,u)}f&&(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,a,d))}loadFragment(e,t,n){let r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===F5.NOT_LOADED||r===F5.PARTIAL?e.sn===`initSegment`?this._loadInitSegment(e,t):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)):(this.startFragRequested=!0,super.loadFragment(e,t,n)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,w5.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,1/0)}nextLevelSwitch(){let{levels:e,media:t}=this;if(t!=null&&t.readyState){let n,r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);let i=this.getLevelDetails();if(i!=null&&i.live){let e=this.getMainFwdBufferInfo();if(!e||e.len<i.targetduration*2)return}if(!t.paused&&e){let t=e[this.hls.nextLoadLevel],r=this.fragLastKbps;n=r&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*r)+1:0}else n=0;let a=this.getBufferedFrag(t.currentTime+n);if(a){let e=this.followingBufferedFrag(a);if(e){this.abortCurrentFrag();let t=e.maxStartPTS?e.maxStartPTS:e.start,n=e.duration,r=Math.max(a.end,t+Math.min(Math.max(n-this.config.maxFragLookUpTolerance,n*(this.couldBacktrack?.5:.125)),n*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(r,1/0)}}}}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case $.KEY_LOADING:case $.FRAG_LOADING:case $.FRAG_LOADING_WAITING_RETRY:case $.PARSING:case $.PARSED:this.state=$.IDLE}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?`video`:null)}onMediaAttached(e,t){super.onMediaAttached(e,t);let n=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener(`playing`,this.onvplaying),n.addEventListener(`seeked`,this.onvseeked),this.gapController=new TIr(this.config,n,this.fragmentTracker,this.hls)}onMediaDetaching(){let{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener(`playing`,this.onvplaying),e.removeEventListener(`seeked`,this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&=(this.gapController.destroy(),null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){let e=this.media,t=e?e.currentTime:null;t5(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);let n=this.getMainFwdBufferInfo();n===null||n.len===0?this.warn(`Main forward buffer length on "seeked" event ${n?n.len:`empty`})`):this.tick()}onManifestLoading(){this.log(`Trigger BUFFER_RESET`),this.hls.trigger(X.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let n=!1,r=!1;t.levels.forEach(e=>{let t=e.audioCodec;t&&(n||=t.indexOf(`mp4a.40.2`)!==-1,r||=t.indexOf(`mp4a.40.5`)!==-1)}),this.audioCodecSwitch=n&&r&&!bIr(),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){let{levels:n}=this;if(!n||this.state!==$.IDLE)return;let r=n[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=$.WAITING_LEVEL)}onLevelLoaded(e,t){var n;let{levels:r}=this,i=t.level,a=t.details,o=a.totalduration;if(!r){this.warn(`Levels were reset while loading level ${i}`);return}this.log(`Level ${i} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:``}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);let s=r[i],c=this.fragCurrent;c&&(this.state===$.FRAG_LOADING||this.state===$.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.loader&&this.abortCurrentFrag();let l=0;if(a.live||(n=s.details)!=null&&n.live){if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;l=this.alignPlaylists(a,s.details,this.levelLastLoaded?.details)}if(s.details=a,this.levelLastLoaded=s,this.hls.trigger(X.LEVEL_UPDATED,{details:a,level:i}),this.state===$.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=$.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,l),this.tick()}_handleFragmentLoadProgress(e){let{frag:t,part:n,payload:r}=e,{levels:i}=this;if(!i){this.warn(`Levels were reset while fragment load was in progress. Fragment ${t.sn} of level ${t.level} will not be buffered`);return}let a=i[t.level],o=a.details;if(!o){this.warn(`Dropping fragment ${t.sn} of level ${t.level} after level details were reset`),this.fragmentTracker.removeFragment(t);return}let s=a.videoCodec,c=o.PTSKnown||!o.live,l=t.initSegment?.data,u=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new kNr(this.hls,w5.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=n?n.index:-1,p=f!==-1,m=new Bjr(t.level,t.sn,t.stats.chunkCount,r.byteLength,f,p),h=this.initPTS[t.cc];d.push(r,l,u,s,t,n,o.totalduration,c,m,h)}onAudioTrackSwitching(e,t){let n=this.altAudio;if(!t.url){if(this.mediaBuffer!==this.media){this.log(`Switching on main audio, use media.buffered to schedule main fragment loading`),this.mediaBuffer=this.media;let e=this.fragCurrent;e&&(this.log(`Switching to main audio track, cancel main fragment load`),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();let e=this.hls;n&&(e.trigger(X.BUFFER_FLUSHING,{startOffset:0,endOffset:1/0,type:null}),this.fragmentTracker.removeAllFragments()),e.trigger(X.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let n=t.id,r=!!this.hls.audioTracks[n].url;if(r){let e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log(`Switching on alternate audio, use video.buffered to schedule main fragment loading`),this.mediaBuffer=e)}this.altAudio=r,this.tick()}onBufferCreated(e,t){let n=t.tracks,r,i,a=!1;for(let e in n){let t=n[e];if(t.id===`main`){if(i=e,r=t,e===`video`){let t=n[e];t&&(this.videoBuffer=t.buffer)}}else a=!0}a&&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){let{frag:n,part:r}=t;if(n&&n.type!==w5.MAIN)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}`),this.state===$.PARSED&&(this.state=$.IDLE);return}let i=r?r.stats:n.stats;this.fragLastKbps=Math.round(8*i.total/(i.buffering.end-i.loading.first)),n.sn!==`initSegment`&&(this.fragPrevious=n),this.fragBufferedComplete(n,r)}onError(e,t){if(t.fatal)this.state=$.ERROR;else switch(t.details){case Z.FRAG_GAP:case Z.FRAG_PARSING_ERROR:case Z.FRAG_DECRYPT_ERROR:case Z.FRAG_LOAD_ERROR:case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_ERROR:case Z.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(w5.MAIN,t);break;case Z.LEVEL_LOAD_ERROR:case Z.LEVEL_LOAD_TIMEOUT:case Z.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===$.WAITING_LEVEL&&t.context?.type===C5.LEVEL&&(this.state=$.IDLE);break;case Z.BUFFER_APPEND_ERROR:case Z.BUFFER_FULL_ERROR:if(!t.parent||t.parent!==`main`)return;if(t.details===Z.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,1/0);break;case Z.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}checkBuffer(){let{media:e,gapController:t}=this;if(e&&t&&e.readyState){if(this.loadedmetadata||!L5.getBuffered(e).length){let e=this.state===$.IDLE?null:this.fragCurrent;t.poll(this.lastCurrentTime,e)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=$.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==o5.AUDIO||this.audioOnly&&!this.altAudio){let e=(t===o5.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(e,t,w5.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){let{media:e}=this;if(!e)return;let t=e.currentTime,n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}let r=L5.getBuffered(e),i=(r.length?r.start(0):0)-n;i>0&&(i<this.config.maxBufferHole||i<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${i} to match buffer start`),n+=i,this.startPosition=n),this.log(`seek to target start position ${n} from current time ${t}`),e.currentTime=n}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log(`Swapping audio codec`),t=t.indexOf(`mp4a.40.5`)===-1?`mp4a.40.5`:`mp4a.40.2`),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(n=>{let{hls:r}=this;if(!n||this.fragContextChanged(e))return;t.fragmentError=0,this.state=$.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;let i=e.stats;i.parsing.start=i.parsing.end=i.buffering.start=i.buffering.end=self.performance.now(),r.trigger(X.FRAG_LOADED,n),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;let n=`main`,{hls:r}=this,{remuxResult:i,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}let{frag:s,part:c,level:l}=o,{video:u,text:d,id3:f,initSegment:p}=i,{details:m}=l,h=this.altAudio?void 0:i.audio;if(this.fragContextChanged(s))this.fragmentTracker.removeFragment(s);else{if(this.state=$.PARSING,p){if(p!=null&&p.tracks){let e=s.initSegment||s;this._bufferInitSegment(l,p.tracks,e,a),r.trigger(X.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:n,tracks:p.tracks})}let e=p.initPTS,t=p.timescale;t5(e)&&(this.initPTS[s.cc]={baseTime:e,timescale:t},r.trigger(X.INIT_PTS_FOUND,{frag:s,id:n,initPTS:e,timescale:t}))}if(u&&m&&s.sn!==`initSegment`){let e=m.fragments[s.sn-1-m.startSN],t=s.sn===m.startSN,n=!e||s.cc>e.cc;if(i.independent!==!1){let{startPTS:e,endPTS:r,startDTS:i,endDTS:o}=u;if(c)c.elementaryStreams[u.type]={startPTS:e,endPTS:r,startDTS:i,endDTS:o};else if(u.firstKeyFrame&&u.independent&&a.id===1&&!n&&(this.couldBacktrack=!0),u.dropped&&u.independent){let i=this.getMainFwdBufferInfo(),a=(i?i.end:this.getLoadPosition())+this.config.maxBufferHole,c=u.firstKeyFramePTS?u.firstKeyFramePTS:e;if(!t&&a<c-this.config.maxBufferHole&&!n){this.backtrack(s);return}n&&(s.gap=!0),s.setElementaryStreamInfo(u.type,s.start,r,s.start,o,!0)}else t&&e>SIr&&(s.gap=!0);s.setElementaryStreamInfo(u.type,e,r,i,o),this.backtrackFragment&&=s,this.bufferFragmentData(u,s,c,a,t||n)}else if(t||n)s.gap=!0;else{this.backtrack(s);return}}if(h){let{startPTS:e,endPTS:t,startDTS:n,endDTS:r}=h;c&&(c.elementaryStreams[o5.AUDIO]={startPTS:e,endPTS:t,startDTS:n,endDTS:r}),s.setElementaryStreamInfo(o5.AUDIO,e,t,n,r),this.bufferFragmentData(h,s,c,a)}if(m&&f!=null&&(t=f.samples)!=null&&t.length){let e={id:n,frag:s,details:m,samples:f.samples};r.trigger(X.FRAG_PARSING_METADATA,e)}if(m&&d){let e={id:n,frag:s,details:m,samples:d.samples};r.trigger(X.FRAG_PARSING_USERDATA,e)}}}_bufferInitSegment(e,t,n,r){if(this.state!==$.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;let{audio:i,video:a,audiovideo:o}=t;if(i){let t=e.audioCodec,n=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){t&&=t.indexOf(`mp4a.40.5`)===-1?`mp4a.40.5`:`mp4a.40.2`;let e=i.metadata;e&&`channelCount`in e&&(e.channelCount||1)!==1&&n.indexOf(`firefox`)===-1&&(t=`mp4a.40.5`)}t&&t.indexOf(`mp4a.40.5`)!==-1&&n.indexOf(`android`)!==-1&&i.container!==`audio/mpeg`&&(t=`mp4a.40.2`,this.log(`Android: force audio codec to ${t}`)),e.audioCodec&&e.audioCodec!==t&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${t}"`),i.levelCodec=t,i.id=`main`,this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${t||``}/${e.audioCodec||``}/${i.codec}]`)}a&&(a.levelCodec=e.videoCodec,a.id=`main`,this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||``}/${a.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(X.BUFFER_CODECS,t),Object.keys(t).forEach(e=>{let i=t[e].initSegment;i!=null&&i.byteLength&&this.hls.trigger(X.BUFFER_APPENDING,{type:e,data:i,frag:n,part:null,chunkMeta:r,parent:n.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,w5.MAIN)}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=$.IDLE}checkFragmentChanged(){let e=this.media,t=null;if(e&&e.readyState>1&&e.seeking===!1){let n=e.currentTime;if(L5.isBuffered(e,n)?t=this.getAppendedFrag(n):L5.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;let e=this.fragPlaying,n=t.level;e&&t.sn===e.sn&&e.level===n||(this.fragPlaying=t,this.hls.trigger(X.FRAG_CHANGED,{frag:t}),e&&e.level===n||this.hls.trigger(X.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){let e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){let e=this.media;if(e){let t=e.currentTime,n=this.currentFrag;if(n&&t5(t)&&t5(n.programDateTime)){let e=n.programDateTime+(t-n.start)*1e3;return new Date(e)}}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}},OIr=class e{static get version(){return`1.5.19`}static isMSESupported(){return vIr()}static isSupported(){return yIr()}static getMediaSource(){return b5()}static get Events(){return X}static get ErrorTypes(){return n5}static get ErrorDetails(){return Z}static get DefaultConfig(){return e.defaultConfig?e.defaultConfig:cIr}static set DefaultConfig(t){e.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new ONr,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.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,TOr(t.debug||!1,`Hls instance`);let n=this.config=uIr(e.DefaultConfig,t);this.userConfig=t,n.progressive&&fIr(n);let{abrController:r,bufferController:i,capLevelController:a,errorController:o,fpsController:s}=n,c=new o(this),l=this.abrController=new r(this),u=this.bufferController=new i(this),d=this.capLevelController=new a(this),f=new s(this),p=new wAr(this),m=new LAr(this),h=n.contentSteeringController,g=h?new h(this):null,_=this.levelController=new mIr(this,g),v=new Ljr(this),y=new gIr(this.config),b=this.streamController=new DIr(this,v,y);d.setStreamController(b),f.setStreamController(b);let x=[p,_,b];g&&x.splice(1,0,g),this.networkControllers=x;let S=[l,u,d,f,m,v];this.audioTrackController=this.createController(n.audioTrackController,x);let C=n.audioStreamController;C&&x.push(new C(this,v,y)),this.subtitleTrackController=this.createController(n.subtitleTrackController,x);let w=n.subtitleStreamController;w&&x.push(new w(this,v,y)),this.createController(n.timelineController,S),y.emeController=this.emeController=this.createController(n.emeController,S),this.cmcdController=this.createController(n.cmcdController,S),this.latencyController=this.createController(RAr,S),this.coreComponents=S,x.push(c);let T=c.onErrorOut;typeof T==`function`&&this.on(X.ERROR,T,c)}createController(e,t){if(e){let 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(t){if(Q.error(`An internal error happened while handling event `+e+`. Error message: "`+t.message+`". Here is a stacktrace:`,t),!this.triggeringException){this.triggeringException=!0;let n=e===X.ERROR;this.trigger(X.ERROR,{type:n5.OTHER_ERROR,details:Z.INTERNAL_EXCEPTION,fatal:n,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){Q.log(`destroy`),this.trigger(X.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>e.destroy()),this.coreComponents.length=0;let e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){Q.log(`attachMedia`),this._media=e,this.trigger(X.MEDIA_ATTACHING,{media:e})}detachMedia(){Q.log(`detachMedia`),this.trigger(X.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();let t=this.media,n=this.url,r=this.url=hOr.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,Q.log(`loadSource:${r}`),t&&n&&(n!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(X.MANIFEST_LOADING,{url:e})}startLoad(e=-1){Q.log(`startLoad(${e})`),this.started=!0,this.resumeBuffering();for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].startLoad(e),this.started&&this.networkControllers);t++);}stopLoad(){Q.log(`stopLoad`),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!this.started&&this.networkControllers);e++);}resumeBuffering(){Q.log(`resume buffering`),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()})}pauseBuffering(){Q.log(`pause buffering`),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()})}swapAudioCodec(){Q.log(`swapAudioCodec`),this.streamController.swapAudioCodec()}recoverMediaError(){Q.log(`recoverMediaError`);let e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){return this.levelController.levels||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){Q.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){Q.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){Q.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){Q.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){let e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){Q.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){let 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(){let{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(Q.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){BAr(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(){let{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;let n=e.length;for(let r=0;r<n;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){let{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this,r;if(r=t===-1&&e!=null&&e.length?e.length-1:t,n)for(let t=r;t--;){let r=e[t].attrs[`HDCP-LEVEL`];if(r&&r<=n)return t}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()}setAudioOption(e){return this.audioTrackController?.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){let e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){let e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){let e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){let t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){let e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){let e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){let e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){let t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){let e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){let 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}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}};OIr.defaultConfig=void 0;var kIr=s(((e,t)=>{t.exports=function(e,t,a){var o=document.head||document.getElementsByTagName(`head`)[0],s=document.createElement(`script`);typeof t==`function`&&(a=t,t={}),t||={},a||=function(){},s.type=t.type||`text/javascript`,s.charset=t.charset||`utf8`,s.async=`async`in t?!!t.async:!0,s.src=e,t.attrs&&n(s,t.attrs),t.text&&(s.text=``+t.text),(`onload`in s?r:i)(s,a),s.onload||r(s,a),o.appendChild(s)};function n(e,t){for(var n in t)e.setAttribute(n,t[n])}function r(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(Error(`Failed to load `+this.src),e)}}function i(e,t){e.onreadystatechange=function(){(this.readyState==`complete`||this.readyState==`loaded`)&&(this.onreadystatechange=null,t(null,e))}}})),AIr=s(((e,t)=>{var n=function(e){return r(e)&&!i(e)};function r(e){return!!e&&typeof e==`object`}function i(e){var t=Object.prototype.toString.call(e);return t===`[object RegExp]`||t===`[object Date]`||o(e)}var a=typeof Symbol==`function`&&Symbol.for?Symbol.for(`react.element`):60103;function o(e){return e.$$typeof===a}function s(e){return Array.isArray(e)?[]:{}}function c(e,t){return t.clone!==!1&&t.isMergeableObject(e)?g(s(e),e,t):e}function l(e,t,n){return e.concat(t).map(function(e){return c(e,n)})}function u(e,t){if(!t.customMerge)return g;var n=t.customMerge(e);return typeof n==`function`?n:g}function d(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function f(e){return Object.keys(e).concat(d(e))}function p(e,t){try{return t in e}catch{return!1}}function m(e,t){return p(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function h(e,t,n){var r={};return n.isMergeableObject(e)&&f(e).forEach(function(t){r[t]=c(e[t],n)}),f(t).forEach(function(i){m(e,i)||(r[i]=p(e,i)&&n.isMergeableObject(t[i])?u(i,n)(e[i],t[i],n):c(t[i],n))}),r}function g(e,t,r){r||={},r.arrayMerge=r.arrayMerge||l,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=c;var i=Array.isArray(t);return i===Array.isArray(e)?i?r.arrayMerge(e,t,r):h(e,t,r):c(t,r)}g.all=function(e,t){if(!Array.isArray(e))throw Error(`first argument should be an array`);return e.reduce(function(e,n){return g(e,n,t)},{})},t.exports=g})),n7=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{callPlayer:()=>N,getConfig:()=>j,getSDK:()=>A,isBlobUrl:()=>P,isMediaStream:()=>ee,lazy:()=>_,omit:()=>M,parseEndTime:()=>T,parseStartTime:()=>w,queryString:()=>D,randomString:()=>E,supportsWebKitPresentationMode:()=>te}),t.exports=d(f);var p=u(m()),h=u(kIr()),g=u(AIr()),_=e=>p.default.lazy(async()=>{let t=await e();return typeof t.default==`function`?t:t.default}),v=/[?&#](?:start|t)=([0-9hms]+)/,y=/[?&#]end=([0-9hms]+)/,b=/(\d+)(h|m|s)/g,x=/^\d+$/;function S(e,t){if(e instanceof Array)return;let n=e.match(t);if(n){let e=n[1];if(e.match(b))return C(e);if(x.test(e))return parseInt(e)}}function C(e){let t=0,n=b.exec(e);for(;n!==null;){let[,r,i]=n;i===`h`&&(t+=parseInt(r,10)*60*60),i===`m`&&(t+=parseInt(r,10)*60),i===`s`&&(t+=parseInt(r,10)),n=b.exec(e)}return t}function w(e){return S(e,v)}function T(e){return S(e,y)}function E(){return Math.random().toString(36).substr(2,5)}function D(e){return Object.keys(e).map(t=>`${t}=${e[t]}`).join(`&`)}function O(e){return window[e]?window[e]:window.exports&&window.exports[e]?window.exports[e]:window.module&&window.module.exports&&window.module.exports[e]?window.module.exports[e]:null}var k={},A=ne(function(e,t,n=null,r=()=>!0,i=h.default){let a=O(t);return a&&r(a)?Promise.resolve(a):new Promise((r,a)=>{if(k[e]){k[e].push({resolve:r,reject:a});return}k[e]=[{resolve:r,reject:a}];let o=t=>{k[e].forEach(e=>e.resolve(t))};if(n){let e=window[n];window[n]=function(){e&&e(),o(O(t))}}i(e,r=>{r?(k[e].forEach(e=>e.reject(r)),k[e]=null):n||o(O(t))})})});function j(e,t){return(0,g.default)(t.config,e.config)}function M(e,...t){let n=[].concat(...t),r={},i=Object.keys(e);for(let t of i)n.indexOf(t)===-1&&(r[t]=e[t]);return r}function N(e,...t){if(!this.player||!this.player[e]){let t=`ReactPlayer: ${this.constructor.displayName} player could not call %c${e}%c \u2013 `;return this.player?this.player[e]||(t+=`The method was not available`):t+=`The player was not available`,console.warn(t,`font-weight: bold`,``),null}return this.player[e](...t)}function ee(e){return typeof window<`u`&&window.MediaStream!==void 0&&e instanceof window.MediaStream}function P(e){return/^blob:/.test(e)}function te(e=document.createElement(`video`)){let t=/iPhone|iPod/.test(navigator.userAgent)===!1;return e.webkitSupportsPresentationMode&&typeof e.webkitSetPresentationMode==`function`&&t}function ne(e){return e}})),r7=s(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AUDIO_EXTENSIONS:()=>T,DASH_EXTENSIONS:()=>O,FLV_EXTENSIONS:()=>k,HLS_EXTENSIONS:()=>D,MATCH_URL_DAILYMOTION:()=>x,MATCH_URL_FACEBOOK:()=>h,MATCH_URL_FACEBOOK_WATCH:()=>g,MATCH_URL_KALTURA:()=>w,MATCH_URL_MIXCLOUD:()=>S,MATCH_URL_MUX:()=>m,MATCH_URL_SOUNDCLOUD:()=>f,MATCH_URL_STREAMABLE:()=>_,MATCH_URL_TWITCH_CHANNEL:()=>b,MATCH_URL_TWITCH_VIDEO:()=>y,MATCH_URL_VIDYARD:()=>C,MATCH_URL_VIMEO:()=>p,MATCH_URL_WISTIA:()=>v,MATCH_URL_YOUTUBE:()=>d,VIDEO_EXTENSIONS:()=>E,canPlay:()=>j}),t.exports=c(l);var u=n7(),d=/(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//,f=/(?:soundcloud\.com|snd\.sc)\/[^.]+$/,p=/vimeo\.com\/(?!progressive_redirect).+/,m=/stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/,h=/^https?:\/\/(www\.)?facebook\.com.*\/(video(s)?|watch|story)(\.php?|\/).+$/,g=/^https?:\/\/fb\.watch\/.+$/,_=/streamable\.com\/([a-z0-9]+)$/,v=/(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/,y=/(?:www\.|go\.)?twitch\.tv\/videos\/(\d+)($|\?)/,b=/(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/,x=/^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?(?:[\w.#_-]+)?/,S=/mixcloud\.com\/([^/]+\/[^/]+)/,C=/vidyard.com\/(?:watch\/)?([a-zA-Z0-9-_]+)/,w=/^https?:\/\/[a-zA-Z]+\.kaltura.(com|org)\/p\/([0-9]+)\/sp\/([0-9]+)00\/embedIframeJs\/uiconf_id\/([0-9]+)\/partner_id\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_].*)$/,T=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i,E=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,D=/\.(m3u8)($|\?)/i,O=/\.(mpd)($|\?)/i,k=/\.(flv)($|\?)/i,A=e=>{if(e instanceof Array){for(let t of e)if(typeof t==`string`&&A(t)||A(t.src))return!0;return!1}return(0,u.isMediaStream)(e)||(0,u.isBlobUrl)(e)?!0:T.test(e)||E.test(e)||D.test(e)||O.test(e)||k.test(e)},j={youtube:e=>e instanceof Array?e.every(e=>d.test(e)):d.test(e),soundcloud:e=>f.test(e)&&!T.test(e),vimeo:e=>p.test(e)&&!E.test(e)&&!D.test(e),mux:e=>m.test(e),facebook:e=>h.test(e)||g.test(e),streamable:e=>_.test(e),wistia:e=>v.test(e),twitch:e=>y.test(e)||b.test(e),dailymotion:e=>x.test(e),mixcloud:e=>S.test(e),vidyard:e=>C.test(e),kaltura:e=>w.test(e),file:A}})),jIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>E}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://www.youtube.com/iframe_api`,b=`YT`,x=`onYouTubeIframeAPIReady`,S=/[?&](?:list|channel)=([a-zA-Z0-9_-]+)/,C=/user\/([a-zA-Z0-9_-]+)\/?/,w=/youtube-nocookie\.com/,T=`https://www.youtube-nocookie.com`,E=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`parsePlaylist`,e=>{if(e instanceof Array)return{listType:`playlist`,playlist:e.map(this.getID).join(`,`)};if(S.test(e)){let[,t]=e.match(S);return{listType:`playlist`,list:t.replace(/^UC/,`UU`)}}if(C.test(e)){let[,t]=e.match(C);return{listType:`user_uploads`,list:t}}return{}}),p(this,`onStateChange`,e=>{let{data:t}=e,{onPlay:n,onPause:r,onBuffer:i,onBufferEnd:a,onEnded:o,onReady:s,loop:c,config:{playerVars:l,onUnstarted:u}}=this.props,{UNSTARTED:d,PLAYING:f,PAUSED:p,BUFFERING:m,ENDED:h,CUED:g}=window[b].PlayerState;if(t===d&&u(),t===f&&(n(),a()),t===p&&r(),t===m&&i(),t===h){let e=!!this.callPlayer(`getPlaylist`);c&&!e&&(l.start?this.seekTo(l.start):this.play()),o()}t===g&&s()}),p(this,`mute`,()=>{this.callPlayer(`mute`)}),p(this,`unmute`,()=>{this.callPlayer(`unMute`)}),p(this,`ref`,e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}getID(e){return!e||e instanceof Array||S.test(e)?null:e.match(v.MATCH_URL_YOUTUBE)[1]}load(e,t){let{playing:n,muted:r,playsinline:i,controls:a,loop:o,config:s,onError:c}=this.props,{playerVars:l,embedOptions:u}=s,d=this.getID(e);if(t){if(S.test(e)||C.test(e)||e instanceof Array){this.player.loadPlaylist(this.parsePlaylist(e));return}this.player.cueVideoById({videoId:d,startSeconds:(0,_.parseStartTime)(e)||l.start,endSeconds:(0,_.parseEndTime)(e)||l.end})}else(0,_.getSDK)(y,b,x,e=>e.loaded).then(t=>{this.container&&(this.player=new t.Player(this.container,{width:`100%`,height:`100%`,videoId:d,playerVars:{autoplay:+!!n,mute:+!!r,controls:+!!a,start:(0,_.parseStartTime)(e),end:(0,_.parseEndTime)(e),origin:window.location.origin,playsinline:+!!i,...this.parsePlaylist(e),...l},events:{onReady:()=>{o&&this.player.setLoop(!0),this.props.onReady()},onPlaybackRateChange:e=>this.props.onPlaybackRateChange(e.data),onPlaybackQualityChange:e=>this.props.onPlaybackQualityChange(e),onStateChange:this.onStateChange,onError:e=>c(e.data)},host:w.test(e)?T:void 0,...u}))},c),u.events&&console.warn("Using `embedOptions.events` will likely break things. Use ReactPlayer’s callback props instead, eg onReady, onPlay, onPause")}play(){this.callPlayer(`playVideo`)}pause(){this.callPlayer(`pauseVideo`)}stop(){document.body.contains(this.callPlayer(`getIframe`))&&this.callPlayer(`stopVideo`)}seekTo(e,t=!1){this.callPlayer(`seekTo`,e),!t&&!this.props.playing&&this.pause()}setVolume(e){this.callPlayer(`setVolume`,e*100)}setPlaybackRate(e){this.callPlayer(`setPlaybackRate`,e)}setLoop(e){this.callPlayer(`setLoop`,e)}getDuration(){return this.callPlayer(`getDuration`)}getCurrentTime(){return this.callPlayer(`getCurrentTime`)}getSecondsLoaded(){return this.callPlayer(`getVideoLoadedFraction`)*this.getDuration()}render(){let{display:e}=this.props,t={width:`100%`,height:`100%`,display:e};return g.default.createElement(`div`,{style:t},g.default.createElement(`div`,{ref:this.ref}))}};p(E,`displayName`,`YouTube`),p(E,`canPlay`,v.canPlay.youtube)})),MIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>x}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://w.soundcloud.com/player/api.js`,b=`SC`,x=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`duration`,null),p(this,`currentTime`,null),p(this,`fractionLoaded`,null),p(this,`mute`,()=>{this.setVolume(0)}),p(this,`unmute`,()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),p(this,`ref`,e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,t){(0,_.getSDK)(y,b).then(n=>{if(!this.iframe)return;let{PLAY:r,PLAY_PROGRESS:i,PAUSE:a,FINISH:o,ERROR:s}=n.Widget.Events;t||(this.player=n.Widget(this.iframe),this.player.bind(r,this.props.onPlay),this.player.bind(a,()=>{this.duration-this.currentTime<.05||this.props.onPause()}),this.player.bind(i,e=>{this.currentTime=e.currentPosition/1e3,this.fractionLoaded=e.loadedProgress}),this.player.bind(o,()=>this.props.onEnded()),this.player.bind(s,e=>this.props.onError(e))),this.player.load(e,{...this.props.config.options,callback:()=>{this.player.getDuration(e=>{this.duration=e/1e3,this.props.onReady()})}})})}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`seekTo`,e*1e3),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e*100)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.fractionLoaded*this.duration}render(){let{display:e}=this.props,t={width:`100%`,height:`100%`,display:e};return g.default.createElement(`iframe`,{ref:this.ref,src:`https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,style:t,frameBorder:0,allow:`autoplay`})}};p(x,`displayName`,`SoundCloud`),p(x,`canPlay`,v.canPlay.soundcloud),p(x,`loopOnEnded`,!0)})),NIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>S}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://player.vimeo.com/api/player.js`,b=`Vimeo`,x=e=>e.replace(`/manage/videos`,``),S=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`duration`,null),p(this,`currentTime`,null),p(this,`secondsLoaded`,null),p(this,`mute`,()=>{this.setMuted(!0)}),p(this,`unmute`,()=>{this.setMuted(!1)}),p(this,`ref`,e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){this.duration=null,(0,_.getSDK)(y,b).then(t=>{if(!this.container)return;let{playerOptions:n,title:r}=this.props.config;this.player=new t.Player(this.container,{url:x(e),autoplay:this.props.playing,muted:this.props.muted,loop:this.props.loop,playsinline:this.props.playsinline,controls:this.props.controls,...n}),this.player.ready().then(()=>{let e=this.container.querySelector(`iframe`);e.style.width=`100%`,e.style.height=`100%`,r&&(e.title=r)}).catch(this.props.onError),this.player.on(`loaded`,()=>{this.props.onReady(),this.refreshDuration()}),this.player.on(`play`,()=>{this.props.onPlay(),this.refreshDuration()}),this.player.on(`pause`,this.props.onPause),this.player.on(`seeked`,e=>this.props.onSeek(e.seconds)),this.player.on(`ended`,this.props.onEnded),this.player.on(`error`,this.props.onError),this.player.on(`timeupdate`,({seconds:e})=>{this.currentTime=e}),this.player.on(`progress`,({seconds:e})=>{this.secondsLoaded=e}),this.player.on(`bufferstart`,this.props.onBuffer),this.player.on(`bufferend`,this.props.onBufferEnd),this.player.on(`playbackratechange`,e=>this.props.onPlaybackRateChange(e.playbackRate))},this.props.onError)}refreshDuration(){this.player.getDuration().then(e=>{this.duration=e})}play(){let e=this.callPlayer(`play`);e&&e.catch(this.props.onError)}pause(){this.callPlayer(`pause`)}stop(){this.callPlayer(`unload`)}seekTo(e,t=!0){this.callPlayer(`setCurrentTime`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}setMuted(e){this.callPlayer(`setMuted`,e)}setLoop(e){this.callPlayer(`setLoop`,e)}setPlaybackRate(e){this.callPlayer(`setPlaybackRate`,e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){let{display:e}=this.props,t={width:`100%`,height:`100%`,overflow:`hidden`,display:e};return g.default.createElement(`div`,{key:this.props.url,ref:this.ref,style:t})}};p(S,`displayName`,`Vimeo`),p(S,`canPlay`,v.canPlay.vimeo),p(S,`forceLoad`,!0)})),PIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>y}),t.exports=f(h);var g=d(m()),_=r7(),v=`https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs`,y=class extends g.Component{constructor(){super(...arguments),p(this,`onReady`,(...e)=>this.props.onReady(...e)),p(this,`onPlay`,(...e)=>this.props.onPlay(...e)),p(this,`onBuffer`,(...e)=>this.props.onBuffer(...e)),p(this,`onBufferEnd`,(...e)=>this.props.onBufferEnd(...e)),p(this,`onPause`,(...e)=>this.props.onPause(...e)),p(this,`onEnded`,(...e)=>this.props.onEnded(...e)),p(this,`onError`,(...e)=>this.props.onError(...e)),p(this,`onPlayBackRateChange`,e=>this.props.onPlaybackRateChange(e.target.playbackRate)),p(this,`onEnablePIP`,(...e)=>this.props.onEnablePIP(...e)),p(this,`onSeek`,e=>{this.props.onSeek(e.target.currentTime)}),p(this,`onDurationChange`,()=>{let e=this.getDuration();this.props.onDuration(e)}),p(this,`mute`,()=>{this.player.muted=!0}),p(this,`unmute`,()=>{this.player.muted=!1}),p(this,`ref`,e=>{this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);let e=this.getPlaybackId(this.props.url);e&&(this.player.playbackId=e)}componentWillUnmount(){this.player.playbackId=null,this.removeListeners(this.player)}addListeners(e){let{playsinline:t}=this.props;e.addEventListener(`play`,this.onPlay),e.addEventListener(`waiting`,this.onBuffer),e.addEventListener(`playing`,this.onBufferEnd),e.addEventListener(`pause`,this.onPause),e.addEventListener(`seeked`,this.onSeek),e.addEventListener(`ended`,this.onEnded),e.addEventListener(`error`,this.onError),e.addEventListener(`ratechange`,this.onPlayBackRateChange),e.addEventListener(`enterpictureinpicture`,this.onEnablePIP),e.addEventListener(`leavepictureinpicture`,this.onDisablePIP),e.addEventListener(`webkitpresentationmodechanged`,this.onPresentationModeChange),e.addEventListener(`canplay`,this.onReady),t&&e.setAttribute(`playsinline`,``)}removeListeners(e){e.removeEventListener(`canplay`,this.onReady),e.removeEventListener(`play`,this.onPlay),e.removeEventListener(`waiting`,this.onBuffer),e.removeEventListener(`playing`,this.onBufferEnd),e.removeEventListener(`pause`,this.onPause),e.removeEventListener(`seeked`,this.onSeek),e.removeEventListener(`ended`,this.onEnded),e.removeEventListener(`error`,this.onError),e.removeEventListener(`ratechange`,this.onPlayBackRateChange),e.removeEventListener(`enterpictureinpicture`,this.onEnablePIP),e.removeEventListener(`leavepictureinpicture`,this.onDisablePIP),e.removeEventListener(`canplay`,this.onReady)}async load(e){let{onError:t,config:n}=this.props;if(!globalThis.customElements?.get(`mux-player`))try{await import(`${v.replace(`VERSION`,n.version)}`),this.props.onLoaded()}catch(e){t(e)}let[,r]=e.match(_.MATCH_URL_MUX);this.player.playbackId=r}play(){let e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.playbackId=null}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player&&this.player.requestPictureInPicture()}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player&&document.exitPictureInPicture()}setPlaybackRate(e){try{this.player.playbackRate=e}catch(e){this.props.onError(e)}}getDuration(){if(!this.player)return null;let{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;let{buffered:e}=this.player;if(e.length===0)return 0;let t=e.end(e.length-1),n=this.getDuration();return t>n?n:t}getPlaybackId(e){let[,t]=e.match(_.MATCH_URL_MUX);return t}render(){let{url:e,playing:t,loop:n,controls:r,muted:i,config:a,width:o,height:s}=this.props,c={width:o===`auto`?o:`100%`,height:s===`auto`?s:`100%`};return r===!1&&(c[`--controls`]=`none`),g.default.createElement(`mux-player`,{ref:this.ref,"playback-id":this.getPlaybackId(e),style:c,preload:`auto`,autoPlay:t||void 0,muted:i?``:void 0,loop:n?``:void 0,...a.attributes})}};p(y,`displayName`,`Mux`),p(y,`canPlay`,_.canPlay.mux)})),FIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>C}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://connect.facebook.net/en_US/sdk.js`,b=`FB`,x=`fbAsyncInit`,S=`facebook-player-`,C=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`playerID`,this.props.config.playerId||`${S}${(0,_.randomString)()}`),p(this,`mute`,()=>{this.callPlayer(`mute`)}),p(this,`unmute`,()=>{this.callPlayer(`unmute`)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,t){t?(0,_.getSDK)(y,b,x).then(e=>e.XFBML.parse()):(0,_.getSDK)(y,b,x).then(e=>{e.init({appId:this.props.config.appId,xfbml:!0,version:this.props.config.version}),e.Event.subscribe(`xfbml.render`,e=>{this.props.onLoaded()}),e.Event.subscribe(`xfbml.ready`,e=>{e.type===`video`&&e.id===this.playerID&&(this.player=e.instance,this.player.subscribe(`startedPlaying`,this.props.onPlay),this.player.subscribe(`paused`,this.props.onPause),this.player.subscribe(`finishedPlaying`,this.props.onEnded),this.player.subscribe(`startedBuffering`,this.props.onBuffer),this.player.subscribe(`finishedBuffering`,this.props.onBufferEnd),this.player.subscribe(`error`,this.props.onError),this.props.muted?this.callPlayer(`mute`):this.callPlayer(`unmute`),this.props.onReady(),document.getElementById(this.playerID).querySelector(`iframe`).style.visibility=`visible`)})})}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`seek`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}getDuration(){return this.callPlayer(`getDuration`)}getCurrentTime(){return this.callPlayer(`getCurrentPosition`)}getSecondsLoaded(){return null}render(){let{attributes:e}=this.props.config;return g.default.createElement(`div`,{style:{width:`100%`,height:`100%`},id:this.playerID,className:`fb-video`,"data-href":this.props.url,"data-autoplay":this.props.playing?`true`:`false`,"data-allowfullscreen":`true`,"data-controls":this.props.controls?`true`:`false`,...e})}};p(C,`displayName`,`Facebook`),p(C,`canPlay`,v.canPlay.facebook),p(C,`loopOnEnded`,!0)})),IIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>x}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://cdn.embed.ly/player-0.1.0.min.js`,b=`playerjs`,x=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`duration`,null),p(this,`currentTime`,null),p(this,`secondsLoaded`,null),p(this,`mute`,()=>{this.callPlayer(`mute`)}),p(this,`unmute`,()=>{this.callPlayer(`unmute`)}),p(this,`ref`,e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,_.getSDK)(y,b).then(e=>{this.iframe&&(this.player=new e.Player(this.iframe),this.player.setLoop(this.props.loop),this.player.on(`ready`,this.props.onReady),this.player.on(`play`,this.props.onPlay),this.player.on(`pause`,this.props.onPause),this.player.on(`seeked`,this.props.onSeek),this.player.on(`ended`,this.props.onEnded),this.player.on(`error`,this.props.onError),this.player.on(`timeupdate`,({duration:e,seconds:t})=>{this.duration=e,this.currentTime=t}),this.player.on(`buffered`,({percent:e})=>{this.duration&&(this.secondsLoaded=this.duration*e)}),this.props.muted&&this.player.mute())},this.props.onError)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`setCurrentTime`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e*100)}setLoop(e){this.callPlayer(`setLoop`,e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){let e=this.props.url.match(v.MATCH_URL_STREAMABLE)[1];return g.default.createElement(`iframe`,{ref:this.ref,src:`https://streamable.com/o/${e}`,frameBorder:`0`,scrolling:`no`,style:{width:`100%`,height:`100%`},allow:`encrypted-media; autoplay; fullscreen;`})}};p(x,`displayName`,`Streamable`),p(x,`canPlay`,v.canPlay.streamable)})),LIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>S}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://fast.wistia.com/assets/external/E-v1.js`,b=`Wistia`,x=`wistia-player-`,S=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`playerID`,this.props.config.playerId||`${x}${(0,_.randomString)()}`),p(this,`onPlay`,(...e)=>this.props.onPlay(...e)),p(this,`onPause`,(...e)=>this.props.onPause(...e)),p(this,`onSeek`,(...e)=>this.props.onSeek(...e)),p(this,`onEnded`,(...e)=>this.props.onEnded(...e)),p(this,`onPlaybackRateChange`,(...e)=>this.props.onPlaybackRateChange(...e)),p(this,`mute`,()=>{this.callPlayer(`mute`)}),p(this,`unmute`,()=>{this.callPlayer(`unmute`)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){let{playing:t,muted:n,controls:r,onReady:i,config:a,onError:o}=this.props;(0,_.getSDK)(y,b).then(e=>{a.customControls&&a.customControls.forEach(t=>e.defineControl(t)),window._wq=window._wq||[],window._wq.push({id:this.playerID,options:{autoPlay:t,silentAutoPlay:`allow`,muted:n,controlsVisibleOnLoad:r,fullscreenButton:r,playbar:r,playbackRateControl:r,qualityControl:r,volumeControl:r,settingsControl:r,smallPlayButton:r,...a.options},onReady:e=>{this.player=e,this.unbind(),this.player.bind(`play`,this.onPlay),this.player.bind(`pause`,this.onPause),this.player.bind(`seek`,this.onSeek),this.player.bind(`end`,this.onEnded),this.player.bind(`playbackratechange`,this.onPlaybackRateChange),i()}})},o)}unbind(){this.player.unbind(`play`,this.onPlay),this.player.unbind(`pause`,this.onPause),this.player.unbind(`seek`,this.onSeek),this.player.unbind(`end`,this.onEnded),this.player.unbind(`playbackratechange`,this.onPlaybackRateChange)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){this.unbind(),this.callPlayer(`remove`)}seekTo(e,t=!0){this.callPlayer(`time`,e),t||this.pause()}setVolume(e){this.callPlayer(`volume`,e)}setPlaybackRate(e){this.callPlayer(`playbackRate`,e)}getDuration(){return this.callPlayer(`duration`)}getCurrentTime(){return this.callPlayer(`time`)}getSecondsLoaded(){return null}render(){let{url:e}=this.props,t=e&&e.match(v.MATCH_URL_WISTIA)[1],n=`wistia_embed wistia_async_${t}`;return g.default.createElement(`div`,{id:this.playerID,key:t,className:n,style:{width:`100%`,height:`100%`}})}};p(S,`displayName`,`Wistia`),p(S,`canPlay`,v.canPlay.wistia),p(S,`loopOnEnded`,!0)})),RIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>S}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://player.twitch.tv/js/embed/v1.js`,b=`Twitch`,x=`twitch-player-`,S=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`playerID`,this.props.config.playerId||`${x}${(0,_.randomString)()}`),p(this,`mute`,()=>{this.callPlayer(`setMuted`,!0)}),p(this,`unmute`,()=>{this.callPlayer(`setMuted`,!1)})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,t){let{playsinline:n,onError:r,config:i,controls:a}=this.props,o=v.MATCH_URL_TWITCH_CHANNEL.test(e),s=o?e.match(v.MATCH_URL_TWITCH_CHANNEL)[1]:e.match(v.MATCH_URL_TWITCH_VIDEO)[1];t?o?this.player.setChannel(s):this.player.setVideo(`v`+s):(0,_.getSDK)(y,b).then(t=>{this.player=new t.Player(this.playerID,{video:o?``:s,channel:o?s:``,height:`100%`,width:`100%`,playsinline:n,autoplay:this.props.playing,muted:this.props.muted,controls:o?!0:a,time:(0,_.parseStartTime)(e),...i.options});let{READY:r,PLAYING:c,PAUSE:l,ENDED:u,ONLINE:d,OFFLINE:f,SEEK:p}=t.Player;this.player.addEventListener(r,this.props.onReady),this.player.addEventListener(c,this.props.onPlay),this.player.addEventListener(l,this.props.onPause),this.player.addEventListener(u,this.props.onEnded),this.player.addEventListener(p,this.props.onSeek),this.player.addEventListener(d,this.props.onLoaded),this.player.addEventListener(f,this.props.onLoaded)},r)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){this.callPlayer(`pause`)}seekTo(e,t=!0){this.callPlayer(`seek`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}getDuration(){return this.callPlayer(`getDuration`)}getCurrentTime(){return this.callPlayer(`getCurrentTime`)}getSecondsLoaded(){return null}render(){return g.default.createElement(`div`,{style:{width:`100%`,height:`100%`},id:this.playerID})}};p(S,`displayName`,`Twitch`),p(S,`canPlay`,v.canPlay.twitch),p(S,`loopOnEnded`,!0)})),zIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>S}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://api.dmcdn.net/all.js`,b=`DM`,x=`dmAsyncInit`,S=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`onDurationChange`,()=>{let e=this.getDuration();this.props.onDuration(e)}),p(this,`mute`,()=>{this.callPlayer(`setMuted`,!0)}),p(this,`unmute`,()=>{this.callPlayer(`setMuted`,!1)}),p(this,`ref`,e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){let{controls:t,config:n,onError:r,playing:i}=this.props,[,a]=e.match(v.MATCH_URL_DAILYMOTION);this.player?this.player.load(a,{start:(0,_.parseStartTime)(e),autoplay:i}):(0,_.getSDK)(y,b,x,e=>e.player).then(i=>{if(!this.container)return;let o=i.player;this.player=new o(this.container,{width:`100%`,height:`100%`,video:a,params:{controls:t,autoplay:this.props.playing,mute:this.props.muted,start:(0,_.parseStartTime)(e),origin:window.location.origin,...n.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:e=>r(e)}})},r)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`seek`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){let{display:e}=this.props,t={width:`100%`,height:`100%`,display:e};return g.default.createElement(`div`,{style:t},g.default.createElement(`div`,{ref:this.ref}))}};p(S,`displayName`,`DailyMotion`),p(S,`canPlay`,v.canPlay.dailymotion),p(S,`loopOnEnded`,!0)})),BIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>x}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://widget.mixcloud.com/media/js/widgetApi.js`,b=`Mixcloud`,x=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`duration`,null),p(this,`currentTime`,null),p(this,`secondsLoaded`,null),p(this,`mute`,()=>{}),p(this,`unmute`,()=>{}),p(this,`ref`,e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,_.getSDK)(y,b).then(e=>{this.player=e.PlayerWidget(this.iframe),this.player.ready.then(()=>{this.player.events.play.on(this.props.onPlay),this.player.events.pause.on(this.props.onPause),this.player.events.ended.on(this.props.onEnded),this.player.events.error.on(this.props.error),this.player.events.progress.on((e,t)=>{this.currentTime=e,this.duration=t}),this.props.onReady()})},this.props.onError)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`seek`,e),t||this.pause()}setVolume(e){}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return null}render(){let{url:e,config:t}=this.props,n=e.match(v.MATCH_URL_MIXCLOUD)[1],r={width:`100%`,height:`100%`},i=(0,_.queryString)({...t.options,feed:`/${n}/`});return g.default.createElement(`iframe`,{key:n,ref:this.ref,style:r,src:`https://player-widget.mixcloud.com/widget/iframe/?${i}`,frameBorder:`0`,allow:`autoplay`})}};p(x,`displayName`,`Mixcloud`),p(x,`canPlay`,v.canPlay.mixcloud),p(x,`loopOnEnded`,!0)})),VIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>S}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://play.vidyard.com/embed/v4.js`,b=`VidyardV4`,x=`onVidyardAPI`,S=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`mute`,()=>{this.setVolume(0)}),p(this,`unmute`,()=>{this.props.volume!==null&&this.setVolume(this.props.volume)}),p(this,`ref`,e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){let{playing:t,config:n,onError:r,onDuration:i}=this.props,a=e&&e.match(v.MATCH_URL_VIDYARD)[1];this.player&&this.stop(),(0,_.getSDK)(y,b,x).then(e=>{this.container&&(e.api.addReadyListener((e,t)=>{this.player||(this.player=t,this.player.on(`ready`,this.props.onReady),this.player.on(`play`,this.props.onPlay),this.player.on(`pause`,this.props.onPause),this.player.on(`seek`,this.props.onSeek),this.player.on(`playerComplete`,this.props.onEnded))},a),e.api.renderPlayer({uuid:a,container:this.container,autoplay:+!!t,...n.options}),e.api.getPlayerMetadata(a).then(e=>{this.duration=e.length_in_seconds,i(e.length_in_seconds)}))},r)}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){window.VidyardV4.api.destroyPlayer(this.player)}seekTo(e,t=!0){this.callPlayer(`seek`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}setPlaybackRate(e){this.callPlayer(`setPlaybackSpeed`,e)}getDuration(){return this.duration}getCurrentTime(){return this.callPlayer(`currentTime`)}getSecondsLoaded(){return null}render(){let{display:e}=this.props,t={width:`100%`,height:`100%`,display:e};return g.default.createElement(`div`,{style:t},g.default.createElement(`div`,{ref:this.ref}))}};p(S,`displayName`,`Vidyard`),p(S,`canPlay`,v.canPlay.vidyard)})),HIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>x}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=`https://cdn.embed.ly/player-0.1.0.min.js`,b=`playerjs`,x=class extends g.Component{constructor(){super(...arguments),p(this,`callPlayer`,_.callPlayer),p(this,`duration`,null),p(this,`currentTime`,null),p(this,`secondsLoaded`,null),p(this,`mute`,()=>{this.callPlayer(`mute`)}),p(this,`unmute`,()=>{this.callPlayer(`unmute`)}),p(this,`ref`,e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,_.getSDK)(y,b).then(e=>{this.iframe&&(this.player=new e.Player(this.iframe),this.player.on(`ready`,()=>{setTimeout(()=>{this.player.isReady=!0,this.player.setLoop(this.props.loop),this.props.muted&&this.player.mute(),this.addListeners(this.player,this.props),this.props.onReady()},500)}))},this.props.onError)}addListeners(e,t){e.on(`play`,t.onPlay),e.on(`pause`,t.onPause),e.on(`ended`,t.onEnded),e.on(`error`,t.onError),e.on(`timeupdate`,({duration:e,seconds:t})=>{this.duration=e,this.currentTime=t})}play(){this.callPlayer(`play`)}pause(){this.callPlayer(`pause`)}stop(){}seekTo(e,t=!0){this.callPlayer(`setCurrentTime`,e),t||this.pause()}setVolume(e){this.callPlayer(`setVolume`,e)}setLoop(e){this.callPlayer(`setLoop`,e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){return g.default.createElement(`iframe`,{ref:this.ref,src:this.props.url,frameBorder:`0`,scrolling:`no`,style:{width:`100%`,height:`100%`},allow:`encrypted-media; autoplay; fullscreen;`,referrerPolicy:`no-referrer-when-downgrade`})}};p(x,`displayName`,`Kaltura`),p(x,`canPlay`,v.canPlay.kaltura)})),UIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>M}),t.exports=f(h);var g=d(m()),_=n7(),v=r7(),y=typeof navigator<`u`,b=y&&navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,x=y&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||b)&&!window.MSStream,S=y&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!window.MSStream,C=`https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js`,w=`Hls`,T=`https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js`,E=`dashjs`,D=`https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js`,O=`flvjs`,k=/www\.dropbox\.com\/.+/,A=/https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/,j=`https://videodelivery.net/{id}/manifest/video.m3u8`,M=class extends g.Component{constructor(){super(...arguments),p(this,`onReady`,(...e)=>this.props.onReady(...e)),p(this,`onPlay`,(...e)=>this.props.onPlay(...e)),p(this,`onBuffer`,(...e)=>this.props.onBuffer(...e)),p(this,`onBufferEnd`,(...e)=>this.props.onBufferEnd(...e)),p(this,`onPause`,(...e)=>this.props.onPause(...e)),p(this,`onEnded`,(...e)=>this.props.onEnded(...e)),p(this,`onError`,(...e)=>this.props.onError(...e)),p(this,`onPlayBackRateChange`,e=>this.props.onPlaybackRateChange(e.target.playbackRate)),p(this,`onEnablePIP`,(...e)=>this.props.onEnablePIP(...e)),p(this,`onDisablePIP`,e=>{let{onDisablePIP:t,playing:n}=this.props;t(e),n&&this.play()}),p(this,`onPresentationModeChange`,e=>{if(this.player&&(0,_.supportsWebKitPresentationMode)(this.player)){let{webkitPresentationMode:t}=this.player;t===`picture-in-picture`?this.onEnablePIP(e):t===`inline`&&this.onDisablePIP(e)}}),p(this,`onSeek`,e=>{this.props.onSeek(e.target.currentTime)}),p(this,`mute`,()=>{this.player.muted=!0}),p(this,`unmute`,()=>{this.player.muted=!1}),p(this,`renderSourceElement`,(e,t)=>typeof e==`string`?g.default.createElement(`source`,{key:t,src:e}):g.default.createElement(`source`,{key:t,...e})),p(this,`renderTrack`,(e,t)=>g.default.createElement(`track`,{key:t,...e})),p(this,`ref`,e=>{this.player&&(this.prevPlayer=this.player),this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);let e=this.getSource(this.props.url);e&&(this.player.src=e),(x||this.props.config.forceDisableHls)&&this.player.load()}componentDidUpdate(e){this.shouldUseAudio(this.props)!==this.shouldUseAudio(e)&&(this.removeListeners(this.prevPlayer,e.url),this.addListeners(this.player)),this.props.url!==e.url&&!(0,_.isMediaStream)(this.props.url)&&!(this.props.url instanceof Array)&&(this.player.srcObject=null)}componentWillUnmount(){this.player.removeAttribute(`src`),this.removeListeners(this.player),this.hls&&this.hls.destroy()}addListeners(e){let{url:t,playsinline:n}=this.props;e.addEventListener(`play`,this.onPlay),e.addEventListener(`waiting`,this.onBuffer),e.addEventListener(`playing`,this.onBufferEnd),e.addEventListener(`pause`,this.onPause),e.addEventListener(`seeked`,this.onSeek),e.addEventListener(`ended`,this.onEnded),e.addEventListener(`error`,this.onError),e.addEventListener(`ratechange`,this.onPlayBackRateChange),e.addEventListener(`enterpictureinpicture`,this.onEnablePIP),e.addEventListener(`leavepictureinpicture`,this.onDisablePIP),e.addEventListener(`webkitpresentationmodechanged`,this.onPresentationModeChange),this.shouldUseHLS(t)||e.addEventListener(`canplay`,this.onReady),n&&(e.setAttribute(`playsinline`,``),e.setAttribute(`webkit-playsinline`,``),e.setAttribute(`x5-playsinline`,``))}removeListeners(e,t){e.removeEventListener(`canplay`,this.onReady),e.removeEventListener(`play`,this.onPlay),e.removeEventListener(`waiting`,this.onBuffer),e.removeEventListener(`playing`,this.onBufferEnd),e.removeEventListener(`pause`,this.onPause),e.removeEventListener(`seeked`,this.onSeek),e.removeEventListener(`ended`,this.onEnded),e.removeEventListener(`error`,this.onError),e.removeEventListener(`ratechange`,this.onPlayBackRateChange),e.removeEventListener(`enterpictureinpicture`,this.onEnablePIP),e.removeEventListener(`leavepictureinpicture`,this.onDisablePIP),e.removeEventListener(`webkitpresentationmodechanged`,this.onPresentationModeChange),this.shouldUseHLS(t)||e.removeEventListener(`canplay`,this.onReady)}shouldUseAudio(e){return e.config.forceVideo||e.config.attributes.poster?!1:v.AUDIO_EXTENSIONS.test(e.url)||e.config.forceAudio}shouldUseHLS(e){return S&&this.props.config.forceSafariHLS||this.props.config.forceHLS?!0:x||this.props.config.forceDisableHls?!1:v.HLS_EXTENSIONS.test(e)||A.test(e)}shouldUseDASH(e){return v.DASH_EXTENSIONS.test(e)||this.props.config.forceDASH}shouldUseFLV(e){return v.FLV_EXTENSIONS.test(e)||this.props.config.forceFLV}load(e){let{hlsVersion:t,hlsOptions:n,dashVersion:r,flvVersion:i}=this.props.config;if(this.hls&&this.hls.destroy(),this.dash&&this.dash.reset(),this.shouldUseHLS(e)&&(0,_.getSDK)(C.replace(`VERSION`,t),w).then(t=>{if(this.hls=new t(n),this.hls.on(t.Events.MANIFEST_PARSED,()=>{this.props.onReady()}),this.hls.on(t.Events.ERROR,(e,n)=>{this.props.onError(e,n,this.hls,t)}),A.test(e)){let t=e.match(A)[1];this.hls.loadSource(j.replace(`{id}`,t))}else this.hls.loadSource(e);this.hls.attachMedia(this.player),this.props.onLoaded()}),this.shouldUseDASH(e)&&(0,_.getSDK)(T.replace(`VERSION`,r),E).then(t=>{this.dash=t.MediaPlayer().create(),this.dash.initialize(this.player,e,this.props.playing),this.dash.on(`error`,this.props.onError),parseInt(r)<3?this.dash.getDebug().setLogToBrowserConsole(!1):this.dash.updateSettings({debug:{logLevel:t.Debug.LOG_LEVEL_NONE}}),this.props.onLoaded()}),this.shouldUseFLV(e)&&(0,_.getSDK)(D.replace(`VERSION`,i),O).then(t=>{this.flv=t.createPlayer({type:`flv`,url:e}),this.flv.attachMediaElement(this.player),this.flv.on(t.Events.ERROR,(e,n)=>{this.props.onError(e,n,this.flv,t)}),this.flv.load(),this.props.onLoaded()}),e instanceof Array)this.player.load();else if((0,_.isMediaStream)(e))try{this.player.srcObject=e}catch{this.player.src=window.URL.createObjectURL(e)}}play(){let e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.removeAttribute(`src`),this.dash&&this.dash.reset()}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player?this.player.requestPictureInPicture():(0,_.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!==`picture-in-picture`&&this.player.webkitSetPresentationMode(`picture-in-picture`)}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player?document.exitPictureInPicture():(0,_.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!==`inline`&&this.player.webkitSetPresentationMode(`inline`)}setPlaybackRate(e){try{this.player.playbackRate=e}catch(e){this.props.onError(e)}}getDuration(){if(!this.player)return null;let{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;let{buffered:e}=this.player;if(e.length===0)return 0;let t=e.end(e.length-1),n=this.getDuration();return t>n?n:t}getSource(e){let t=this.shouldUseHLS(e),n=this.shouldUseDASH(e),r=this.shouldUseFLV(e);if(!(e instanceof Array||(0,_.isMediaStream)(e)||t||n||r))return k.test(e)?e.replace(`www.dropbox.com`,`dl.dropboxusercontent.com`):e}render(){let{url:e,playing:t,loop:n,controls:r,muted:i,config:a,width:o,height:s}=this.props,c=this.shouldUseAudio(this.props)?`audio`:`video`,l={width:o===`auto`?o:`100%`,height:s===`auto`?s:`100%`};return g.default.createElement(c,{ref:this.ref,src:this.getSource(e),style:l,preload:`auto`,autoPlay:t||void 0,controls:r,muted:i,loop:n,...a.attributes},e instanceof Array&&e.map(this.renderSourceElement),a.tracks.map(this.renderTrack))}};p(M,`displayName`,`FilePlayer`),p(M,`canPlay`,v.canPlay.file)})),WIr=s(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{default:()=>p}),t.exports=c(l);var d=n7(),f=r7(),p=[{key:`youtube`,name:`YouTube`,canPlay:f.canPlay.youtube,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(jIr())))},{key:`soundcloud`,name:`SoundCloud`,canPlay:f.canPlay.soundcloud,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(MIr())))},{key:`vimeo`,name:`Vimeo`,canPlay:f.canPlay.vimeo,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(NIr())))},{key:`mux`,name:`Mux`,canPlay:f.canPlay.mux,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(PIr())))},{key:`facebook`,name:`Facebook`,canPlay:f.canPlay.facebook,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(FIr())))},{key:`streamable`,name:`Streamable`,canPlay:f.canPlay.streamable,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(IIr())))},{key:`wistia`,name:`Wistia`,canPlay:f.canPlay.wistia,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(LIr())))},{key:`twitch`,name:`Twitch`,canPlay:f.canPlay.twitch,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(RIr())))},{key:`dailymotion`,name:`DailyMotion`,canPlay:f.canPlay.dailymotion,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(zIr())))},{key:`mixcloud`,name:`Mixcloud`,canPlay:f.canPlay.mixcloud,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(BIr())))},{key:`vidyard`,name:`Vidyard`,canPlay:f.canPlay.vidyard,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(VIr())))},{key:`kaltura`,name:`Kaltura`,canPlay:f.canPlay.kaltura,lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(HIr())))},{key:`file`,name:`FilePlayer`,canPlay:f.canPlay.file,canEnablePIP:e=>f.canPlay.file(e)&&(document.pictureInPictureEnabled||(0,d.supportsWebKitPresentationMode)())&&!f.AUDIO_EXTENSIONS.test(e),lazyPlayer:(0,d.lazy)(()=>Promise.resolve().then(()=>u(UIr())))}]})),GIr=c({default:()=>JIr});function KIr(e,t){return!!(e===t||YIr(e)&&YIr(t))}function qIr(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!KIr(e[n],t[n]))return!1;return!0}function JIr(e,t){t===void 0&&(t=qIr);var n,r=[],i,a=!1;function o(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return a&&n===this&&t(o,r)||(i=e.apply(this,o),a=!0,n=this,r=o),i}return o}var YIr,XIr=o((()=>{YIr=Number.isNaN||function(e){return typeof e==`number`&&e!==e}})),ZIr=s(((e,t)=>{var n=typeof Element<`u`,r=typeof Map==`function`,i=typeof Set==`function`,a=typeof ArrayBuffer==`function`&&!!ArrayBuffer.isView;function o(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(e.constructor!==t.constructor)return!1;var s,c,l;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(c=s;c--!==0;)if(!o(e[c],t[c]))return!1;return!0}var u;if(r&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(u=e.entries();!(c=u.next()).done;)if(!t.has(c.value[0]))return!1;for(u=e.entries();!(c=u.next()).done;)if(!o(c.value[1],t.get(c.value[0])))return!1;return!0}if(i&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(u=e.entries();!(c=u.next()).done;)if(!t.has(c.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(s=e.length,s!=t.length)return!1;for(c=s;c--!==0;)if(e[c]!==t[c])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf==`function`&&typeof t.valueOf==`function`)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString==`function`&&typeof t.toString==`function`)return e.toString()===t.toString();if(l=Object.keys(e),s=l.length,s!==Object.keys(t).length)return!1;for(c=s;c--!==0;)if(!Object.prototype.hasOwnProperty.call(t,l[c]))return!1;if(n&&e instanceof Element)return!1;for(c=s;c--!==0;)if((l[c]!==`_owner`&&l[c]!==`__v`&&l[c]!==`__o`||!e.$$typeof)&&!o(e[l[c]],t[l[c]]))return!1;return!0}return e!==e&&t!==t}t.exports=function(e,t){try{return o(e,t)}catch(e){if((e.message||``).match(/stack|recursion/i))return console.warn(`react-fast-compare cannot handle circular refs`),!1;throw e}}})),QIr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{defaultProps:()=>w,propTypes:()=>S}),t.exports=d(f);var{string:p,bool:m,number:h,array:g,oneOfType:_,shape:v,object:y,func:b,node:x}=u(jy()).default,S={url:_([p,g,y]),playing:m,loop:m,controls:m,volume:h,muted:m,playbackRate:h,width:_([p,h]),height:_([p,h]),style:y,progressInterval:h,playsinline:m,pip:m,stopOnUnmount:m,light:_([m,p,y]),playIcon:x,previewTabIndex:h,previewAriaLabel:p,fallback:x,oEmbedUrl:p,wrapper:_([p,b,v({render:b.isRequired})]),config:v({soundcloud:v({options:y}),youtube:v({playerVars:y,embedOptions:y,onUnstarted:b}),facebook:v({appId:p,version:p,playerId:p,attributes:y}),dailymotion:v({params:y}),vimeo:v({playerOptions:y,title:p}),mux:v({attributes:y,version:p}),file:v({attributes:y,tracks:g,forceVideo:m,forceAudio:m,forceHLS:m,forceSafariHLS:m,forceDisableHls:m,forceDASH:m,forceFLV:m,hlsOptions:y,hlsVersion:p,dashVersion:p,flvVersion:p}),wistia:v({options:y,playerId:p,customControls:g}),mixcloud:v({options:y}),twitch:v({options:y,playerId:p}),vidyard:v({options:y})}),onReady:b,onStart:b,onPlay:b,onPause:b,onBuffer:b,onBufferEnd:b,onEnded:b,onError:b,onDuration:b,onSeek:b,onPlaybackRateChange:b,onPlaybackQualityChange:b,onProgress:b,onClickPreview:b,onEnablePIP:b,onDisablePIP:b},C=()=>{},w={playing:!1,loop:!1,controls:!1,volume:null,muted:!1,playbackRate:1,width:`640px`,height:`360px`,style:{},progressInterval:1e3,playsinline:!1,pip:!1,stopOnUnmount:!0,light:!1,fallback:null,wrapper:`div`,previewTabIndex:0,previewAriaLabel:``,oEmbedUrl:`https://noembed.com/embed?url={url}`,config:{soundcloud:{options:{visual:!0,buying:!1,liking:!1,download:!1,sharing:!1,show_comments:!1,show_playcount:!1}},youtube:{playerVars:{playsinline:1,showinfo:0,rel:0,iv_load_policy:3,modestbranding:1},embedOptions:{},onUnstarted:C},facebook:{appId:`1309697205772819`,version:`v3.3`,playerId:null,attributes:{}},dailymotion:{params:{api:1,"endscreen-enable":!1}},vimeo:{playerOptions:{autopause:!1,byline:!1,portrait:!1,title:!1},title:null},mux:{attributes:{},version:`2`},file:{attributes:{},tracks:[],forceVideo:!1,forceAudio:!1,forceHLS:!1,forceDASH:!1,forceFLV:!1,hlsOptions:{},hlsVersion:`1.1.4`,dashVersion:`3.1.3`,flvVersion:`1.5.0`,forceDisableHls:!1},wistia:{options:{},playerId:null,customControls:null},mixcloud:{options:{hide_cover:1}},twitch:{options:{},playerId:null},vidyard:{options:{}}},onReady:C,onStart:C,onPlay:C,onPause:C,onBuffer:C,onBufferEnd:C,onEnded:C,onError:C,onDuration:C,onSeek:C,onPlaybackRateChange:C,onPlaybackQualityChange:C,onProgress:C,onClickPreview:C,onEnablePIP:C,onDisablePIP:C}})),$Ir=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>x}),t.exports=f(h);var g=d(m()),_=d(ZIr()),v=QIr(),y=n7(),b=5e3,x=class extends g.Component{constructor(){super(...arguments),p(this,`mounted`,!1),p(this,`isReady`,!1),p(this,`isPlaying`,!1),p(this,`isLoading`,!0),p(this,`loadOnReady`,null),p(this,`startOnPlay`,!0),p(this,`seekOnPlay`,null),p(this,`onDurationCalled`,!1),p(this,`handlePlayerMount`,e=>{this.player||(this.player=e,this.player.load(this.props.url)),this.progress()}),p(this,`getInternalPlayer`,e=>this.player?this.player[e]:null),p(this,`progress`,()=>{if(this.props.url&&this.player&&this.isReady){let e=this.getCurrentTime()||0,t=this.getSecondsLoaded(),n=this.getDuration();if(n){let r={playedSeconds:e,played:e/n};t!==null&&(r.loadedSeconds=t,r.loaded=t/n),(r.playedSeconds!==this.prevPlayed||r.loadedSeconds!==this.prevLoaded)&&this.props.onProgress(r),this.prevPlayed=r.playedSeconds,this.prevLoaded=r.loadedSeconds}}this.progressTimeout=setTimeout(this.progress,this.props.progressFrequency||this.props.progressInterval)}),p(this,`handleReady`,()=>{if(!this.mounted)return;this.isReady=!0,this.isLoading=!1;let{onReady:e,playing:t,volume:n,muted:r}=this.props;e(),!r&&n!==null&&this.player.setVolume(n),this.loadOnReady?(this.player.load(this.loadOnReady,!0),this.loadOnReady=null):t&&this.player.play(),this.handleDurationCheck()}),p(this,`handlePlay`,()=>{this.isPlaying=!0,this.isLoading=!1;let{onStart:e,onPlay:t,playbackRate:n}=this.props;this.startOnPlay&&=(this.player.setPlaybackRate&&n!==1&&this.player.setPlaybackRate(n),e(),!1),t(),this.seekOnPlay&&=(this.seekTo(this.seekOnPlay),null),this.handleDurationCheck()}),p(this,`handlePause`,e=>{this.isPlaying=!1,this.isLoading||this.props.onPause(e)}),p(this,`handleEnded`,()=>{let{activePlayer:e,loop:t,onEnded:n}=this.props;e.loopOnEnded&&t&&this.seekTo(0),t||(this.isPlaying=!1,n())}),p(this,`handleError`,(...e)=>{this.isLoading=!1,this.props.onError(...e)}),p(this,`handleDurationCheck`,()=>{clearTimeout(this.durationCheckTimeout);let e=this.getDuration();e?this.onDurationCalled||=(this.props.onDuration(e),!0):this.durationCheckTimeout=setTimeout(this.handleDurationCheck,100)}),p(this,`handleLoaded`,()=>{this.isLoading=!1})}componentDidMount(){this.mounted=!0}componentWillUnmount(){clearTimeout(this.progressTimeout),clearTimeout(this.durationCheckTimeout),this.isReady&&this.props.stopOnUnmount&&(this.player.stop(),this.player.disablePIP&&this.player.disablePIP()),this.mounted=!1}componentDidUpdate(e){if(!this.player)return;let{url:t,playing:n,volume:r,muted:i,playbackRate:a,pip:o,loop:s,activePlayer:c,disableDeferredLoading:l}=this.props;if(!(0,_.default)(e.url,t)){if(this.isLoading&&!c.forceLoad&&!l&&!(0,y.isMediaStream)(t)){console.warn(`ReactPlayer: the attempt to load ${t} is being deferred until the player has loaded`),this.loadOnReady=t;return}this.isLoading=!0,this.startOnPlay=!0,this.onDurationCalled=!1,this.player.load(t,this.isReady)}!e.playing&&n&&!this.isPlaying&&this.player.play(),e.playing&&!n&&this.isPlaying&&this.player.pause(),!e.pip&&o&&this.player.enablePIP&&this.player.enablePIP(),e.pip&&!o&&this.player.disablePIP&&this.player.disablePIP(),e.volume!==r&&r!==null&&this.player.setVolume(r),e.muted!==i&&(i?this.player.mute():(this.player.unmute(),r!==null&&setTimeout(()=>this.player.setVolume(r)))),e.playbackRate!==a&&this.player.setPlaybackRate&&this.player.setPlaybackRate(a),e.loop!==s&&this.player.setLoop&&this.player.setLoop(s)}getDuration(){return this.isReady?this.player.getDuration():null}getCurrentTime(){return this.isReady?this.player.getCurrentTime():null}getSecondsLoaded(){return this.isReady?this.player.getSecondsLoaded():null}seekTo(e,t,n){if(!this.isReady)e!==0&&(this.seekOnPlay=e,setTimeout(()=>{this.seekOnPlay=null},b));else if(t?t===`fraction`:e>0&&e<1){let t=this.player.getDuration();if(!t){console.warn(`ReactPlayer: could not seek using fraction –\xA0duration not yet available`);return}this.player.seekTo(t*e,n)}else this.player.seekTo(e,n)}render(){let e=this.props.activePlayer;return e?g.default.createElement(e,{...this.props,onMount:this.handlePlayerMount,onReady:this.handleReady,onPlay:this.handlePlay,onPause:this.handlePause,onEnded:this.handleEnded,onLoaded:this.handleLoaded,onError:this.handleError}):null}};p(x,`displayName`,`Player`),p(x,`propTypes`,v.propTypes),p(x,`defaultProps`,v.defaultProps)})),eLr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>u(r({},`__esModule`,{value:!0}),e),p=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),h={};l(h,{default:()=>y}),t.exports=f(h);var g=d(m()),_=`64px`,v={},y=class extends g.Component{constructor(){super(...arguments),p(this,`mounted`,!1),p(this,`state`,{image:null}),p(this,`handleKeyPress`,e=>{(e.key===`Enter`||e.key===` `)&&this.props.onClick()})}componentDidMount(){this.mounted=!0,this.fetchImage(this.props)}componentDidUpdate(e){let{url:t,light:n}=this.props;(e.url!==t||e.light!==n)&&this.fetchImage(this.props)}componentWillUnmount(){this.mounted=!1}fetchImage({url:e,light:t,oEmbedUrl:n}){if(!g.default.isValidElement(t)){if(typeof t==`string`)this.setState({image:t});else if(v[e])this.setState({image:v[e]});else return this.setState({image:null}),window.fetch(n.replace(`{url}`,e)).then(e=>e.json()).then(t=>{if(t.thumbnail_url&&this.mounted){let n=t.thumbnail_url.replace(`height=100`,`height=480`).replace(`-d_295x166`,`-d_640`);this.setState({image:n}),v[e]=n}})}}render(){let{light:e,onClick:t,playIcon:n,previewTabIndex:r,previewAriaLabel:i}=this.props,{image:a}=this.state,o=g.default.isValidElement(e),s={display:`flex`,alignItems:`center`,justifyContent:`center`},c={preview:{width:`100%`,height:`100%`,backgroundImage:a&&!o?`url(${a})`:void 0,backgroundSize:`cover`,backgroundPosition:`center`,cursor:`pointer`,...s},shadow:{background:`radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)`,borderRadius:_,width:_,height:_,position:o?`absolute`:void 0,...s},playIcon:{borderStyle:`solid`,borderWidth:`16px 0 16px 26px`,borderColor:`transparent transparent transparent white`,marginLeft:`7px`}},l=g.default.createElement(`div`,{style:c.shadow,className:`react-player__shadow`},g.default.createElement(`div`,{style:c.playIcon,className:`react-player__play-icon`}));return g.default.createElement(`div`,{style:c.preview,className:`react-player__preview`,onClick:t,tabIndex:r,onKeyPress:this.handleKeyPress,...i?{"aria-label":i}:{}},o?e:null,n||l)}}})),tLr=s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},p=(e,t,i)=>(i=e==null?{}:n(o(e)),f(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),h=e=>f(r({},`__esModule`,{value:!0}),e),g=(e,t,n)=>(c(e,typeof t==`symbol`?t:t+``,n),n),_={};l(_,{createReactPlayer:()=>j}),t.exports=h(_);var v=p(m()),y=p(AIr()),b=p((XIr(),d(GIr))),x=p(ZIr()),S=QIr(),C=n7(),w=p($Ir()),T=(0,C.lazy)(()=>Promise.resolve().then(()=>u(eLr()))),E=typeof window<`u`&&window.document&&typeof document<`u`,D=typeof global<`u`&&global.window&&global.window.document,O=Object.keys(S.propTypes),k=E||D?v.Suspense:()=>null,A=[],j=(e,t)=>{var n=class extends v.Component{constructor(){super(...arguments),g(this,`state`,{showPreview:!!this.props.light}),g(this,`references`,{wrapper:e=>{this.wrapper=e},player:e=>{this.player=e}}),g(this,`handleClickPreview`,e=>{this.setState({showPreview:!1}),this.props.onClickPreview(e)}),g(this,`showPreview`,()=>{this.setState({showPreview:!0})}),g(this,`getDuration`,()=>this.player?this.player.getDuration():null),g(this,`getCurrentTime`,()=>this.player?this.player.getCurrentTime():null),g(this,`getSecondsLoaded`,()=>this.player?this.player.getSecondsLoaded():null),g(this,`getInternalPlayer`,(e=`player`)=>this.player?this.player.getInternalPlayer(e):null),g(this,`seekTo`,(e,t,n)=>{if(!this.player)return null;this.player.seekTo(e,t,n)}),g(this,`handleReady`,()=>{this.props.onReady(this)}),g(this,`getActivePlayer`,(0,b.default)(n=>{for(let t of[...A,...e])if(t.canPlay(n))return t;return t||null})),g(this,`getConfig`,(0,b.default)((e,t)=>{let{config:n}=this.props;return y.default.all([S.defaultProps.config,S.defaultProps.config[t]||{},n,n[t]||{}])})),g(this,`getAttributes`,(0,b.default)(e=>(0,C.omit)(this.props,O))),g(this,`renderActivePlayer`,e=>{if(!e)return null;let t=this.getActivePlayer(e);if(!t)return null;let n=this.getConfig(e,t.key);return v.default.createElement(w.default,{...this.props,key:t.key,ref:this.references.player,config:n,activePlayer:t.lazyPlayer||t,onReady:this.handleReady})})}shouldComponentUpdate(e,t){return!(0,x.default)(this.props,e)||!(0,x.default)(this.state,t)}componentDidUpdate(e){let{light:t}=this.props;!e.light&&t&&this.setState({showPreview:!0}),e.light&&!t&&this.setState({showPreview:!1})}renderPreview(e){if(!e)return null;let{light:t,playIcon:n,previewTabIndex:r,oEmbedUrl:i,previewAriaLabel:a}=this.props;return v.default.createElement(T,{url:e,light:t,playIcon:n,previewTabIndex:r,previewAriaLabel:a,oEmbedUrl:i,onClick:this.handleClickPreview})}render(){let{url:e,style:t,width:n,height:r,fallback:i,wrapper:a}=this.props,{showPreview:o}=this.state,s=this.getAttributes(e),c=typeof a==`string`?this.references.wrapper:void 0;return v.default.createElement(a,{ref:c,style:{...t,width:n,height:r},...s},v.default.createElement(k,{fallback:i},o?this.renderPreview(e):this.renderActivePlayer(e)))}};return g(n,`displayName`,`ReactPlayer`),g(n,`propTypes`,S.propTypes),g(n,`defaultProps`,S.defaultProps),g(n,`addCustomPlayer`,e=>{A.push(e)}),g(n,`removeCustomPlayers`,()=>{A.length=0}),g(n,`canPlay`,t=>{for(let n of[...A,...e])if(n.canPlay(t))return!0;return!1}),g(n,`canEnablePIP`,t=>{for(let n of[...A,...e])if(n.canEnablePIP&&n.canEnablePIP(t))return!0;return!1}),n}})),nLr=u(s(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},u=(e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),d=e=>l(r({},`__esModule`,{value:!0}),e),f={};c(f,{default:()=>g}),t.exports=d(f);var p=u(WIr()),m=tLr(),h=p.default[p.default.length-1],g=(0,m.createReactPlayer)(p.default,h)}))(),1),rLr=e=>{if(!e)return!1;try{return new URL(e.trim()).protocol===`https:`}catch{return!1}},iLr=e=>{if(e.nodeName!==`IFRAME`)return;let t=e;rLr(t.getAttribute(`src`))||t.remove()},aLr=e=>{if(!e)return``;HNe.default.addHook(`uponSanitizeElement`,iLr);try{return HNe.default.sanitize(e,{ADD_TAGS:[`iframe`],ADD_ATTR:[`allow`,`allowfullscreen`,`frameborder`,`referrerpolicy`],FORBID_TAGS:[`script`,`object`,`embed`]}).trim()}finally{HNe.default.removeHook(`uponSanitizeElement`,iLr)}},oLr=/(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((?:\w|-){11})/,sLr=/youtube\.com\/playlist\?list=|youtube\.com\/user\//,cLr=/[?&](?:list|channel)=/,lLr=new Set([`videoseries`,`live_stream`]),uLr=e=>{let t=e?.match(oLr)?.[1];return t&&!lLr.has(t)?t:null},dLr=e=>{try{let t=new URL(e??``).searchParams,[,n,r,i]=(t.get(`t`)??t.get(`start`)??``).match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s?)?$/)??[],a=Number(n??0)*3600+Number(r??0)*60+Number(i??0);return a>0?a:null}catch{return null}},fLr=e=>{try{let t=new URL(e).searchParams,n=t.get(`t`)??t.get(`start`);return n?`&t=${encodeURIComponent(n)}`:``}catch{return``}},pLr=e=>{if(!e)return{url:void 0};let t=e.match(oLr)?.[1],n=!!t&&lLr.has(t),r=n?void 0:t;return r&&cLr.test(e)?{url:`https://www.youtube.com/watch?v=${r}${fLr(e)}`}:n||!r&&sLr.test(e)?{url:e,embedOptions:{videoId:``}}:{url:e}},mLr=1e4,hLr=/^https:\/\/(customer-[a-z0-9]+\.cloudflarestream\.com)\/([a-f0-9]{32})\/manifest\/video\.m3u8$/i,gLr=e=>{let t=e?.match(hLr);return t?`https://${t[1]}/${t[2]}/lifecycle`:null},_Lr=e=>{let t=gLr(e),[n,r]=(0,S.useState)(t?null:!1),[i,a]=(0,S.useState)(t);return t!==i&&(a(t),r(t?null:!1)),(0,S.useEffect)(()=>{if(!t)return;let e=!1,n=async()=>{try{let n=await(await fetch(t)).json();if(e)return;r(n?.isInput===!0&&!n.live),n?.isInput===!1&&clearInterval(i)}catch{e||r(!1)}};n();let i=setInterval(n,mLr);return()=>{e=!0,clearInterval(i)}},[t]),n},vLr=c({default:()=>eRr});function yLr(e,t){return e.indexOf(t.toLowerCase())===0?e:`${t.toLowerCase()}${e.substr(0,1).toUpperCase()}${e.substr(1)}`}function bLr(e){return!!(e&&e.nodeType===1&&`nodeName`in e&&e.ownerDocument&&e.ownerDocument.defaultView)}function xLr(e){return!isNaN(parseFloat(e))&&isFinite(e)&&Math.floor(e)==e}function i7(e){return/^(https?:)?\/\/((((player|www)\.)?vimeo\.com)|((player\.)?[a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))(?=$|\/)/.test(e)}function SLr(e){return/^https:\/\/player\.((vimeo\.com)|([a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))\/video\/\d+/.test(e)}function CLr(e){let t=(e||``).match(/^(?:https?:)?(?:\/\/)?([^/?]+)/),n=(t&&t[1]||``).replace(`player.`,``);for(let e of[`.videoji.hk`,`.vimeo.work`,`.videoji.cn`])if(n.endsWith(e))return n;return`vimeo.com`}function wLr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.id,n=e.url,r=t||n;if(!r)throw Error(`An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.`);if(xLr(r))return`https://vimeo.com/${r}`;if(i7(r))return r.replace(`http:`,`https:`);throw TypeError(t?`“${t}” is not a valid video id.`:`“${r}” is not a vimeo.com url.`)}function TLr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document;if(!e||!t||typeof t.querySelectorAll!=`function`)return null;let n=t.querySelectorAll(`iframe`);for(let t=0;t<n.length;t++)if(n[t]&&n[t].contentWindow===e)return n[t];return null}function ELr(e,t){return t={exports:{}},e(t,t.exports),t.exports}function a7(e,t,n){let r=l7.get(e.element)||{};t in r||(r[t]=[]),r[t].push(n),l7.set(e.element,r)}function DLr(e,t){return(l7.get(e.element)||{})[t]||[]}function OLr(e,t,n){let r=l7.get(e.element)||{};if(!r[t])return!0;if(!n)return r[t]=[],l7.set(e.element,r),!0;let i=r[t].indexOf(n);return i!==-1&&r[t].splice(i,1),l7.set(e.element,r),r[t]&&r[t].length===0}function kLr(e,t){let n=DLr(e,t);if(n.length<1)return!1;let r=n.shift();return OLr(e,t,r),r}function ALr(e,t){let n=l7.get(e);l7.set(t,n),l7.delete(e)}function o7(e){if(typeof e==`string`)try{e=JSON.parse(e)}catch(e){return console.warn(e),{}}return e}function s7(e,t,n){if(!e.element.contentWindow||!e.element.contentWindow.postMessage)return;let r={method:t};n!==void 0&&(r.value=n);let i=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,`$1`));i>=8&&i<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.origin)}function jLr(e,t){t=o7(t);let n=[],r;if(t.event)t.event===`error`&&DLr(e,t.data.method).forEach(n=>{let r=Error(t.data.message);r.name=t.data.name,n.reject(r),OLr(e,t.data.method,n)}),n=DLr(e,`event:${t.event}`),r=t.data;else if(t.method){let i=kLr(e,t.method);i&&(n.push(i),r=t.value)}n.forEach(t=>{try{if(typeof t==`function`){t.call(e,r);return}t.resolve(r)}catch{}})}function MLr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return XLr.reduce((t,n)=>{let r=e.getAttribute(`data-vimeo-${n}`);return(r||r===``)&&(t[n]=r===``?1:r),t},t)}function NLr(e,t){let{html:n}=e;if(!t)throw TypeError(`An element must be provided`);if(t.getAttribute(`data-vimeo-initialized`)!==null)return t.querySelector(`iframe`);let r=document.createElement(`div`);return r.innerHTML=n,t.appendChild(r.firstChild),t.setAttribute(`data-vimeo-initialized`,`true`),t.querySelector(`iframe`)}function PLr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return new Promise((r,i)=>{if(!i7(e))throw TypeError(`“${e}” is not a vimeo.com url.`);let a=`https://${CLr(e)}/api/oembed.json?url=${encodeURIComponent(e)}`;for(let e in t)t.hasOwnProperty(e)&&(a+=`&${e}=${encodeURIComponent(t[e])}`);let o=`XDomainRequest`in window?new XDomainRequest:new XMLHttpRequest;o.open(`GET`,a,!0),o.onload=function(){if(o.status===404)i(Error(`“${e}” was not found.`));else if(o.status===403)i(Error(`“${e}” is not embeddable.`));else try{let t=JSON.parse(o.responseText);if(t.domain_status_code===403){NLr(t,n),i(Error(`“${e}” is not embeddable.`));return}r(t)}catch(e){i(e)}},o.onerror=function(){let e=o.status?` (${o.status})`:``;i(Error(`There was an error fetching the embed code from Vimeo${e}.`))},o.send()})}function FLr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document,t=[].slice.call(e.querySelectorAll(`[data-vimeo-id], [data-vimeo-url]`)),n=e=>{`console`in window&&console.error&&console.error(`There was an error creating an embed: ${e}`)};t.forEach(e=>{try{if(e.getAttribute(`data-vimeo-defer`)!==null)return;let t=MLr(e);PLr(wLr(t),t,e).then(t=>NLr(t,e)).catch(n)}catch(e){n(e)}})}function ILr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;window.VimeoPlayerResizeEmbeds_||(window.VimeoPlayerResizeEmbeds_=!0,window.addEventListener(`message`,t=>{if(!i7(t.origin)||!t.data||t.data.event!==`spacechange`)return;let n=t.source?TLr(t.source,e):null;if(n){let e=n.parentElement;e.style.paddingBottom=`${t.data.data[0].bottom}px`}}))}function LLr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;window.VimeoSeoMetadataAppended||(window.VimeoSeoMetadataAppended=!0,window.addEventListener(`message`,t=>{if(!i7(t.origin))return;let n=o7(t.data);if(!n||n.event!==`ready`)return;let r=t.source?TLr(t.source,e):null;r&&SLr(r.src)&&new eRr(r).callMethod(`appendVideoMetadata`,window.location.href)}))}function RLr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document;if(window.VimeoCheckedUrlTimeParam)return;window.VimeoCheckedUrlTimeParam=!0;let t=e=>{`console`in window&&console.error&&console.error(`There was an error getting video Id: ${e}`)};window.addEventListener(`message`,n=>{if(!i7(n.origin))return;let r=o7(n.data);if(!r||r.event!==`ready`)return;let i=n.source?TLr(n.source,e):null;if(i&&SLr(i.src)){let e=new eRr(i);e.getVideoId().then(t=>{let n=RegExp(`[?&]vimeo_t_${t}=([^&#]*)`).exec(window.location.href);if(n&&n[1]){let t=decodeURI(n[1]);e.setCurrentTime(t)}}).catch(t)}})}function zLr(){window.VimeoDRMEmbedsUpdated||(window.VimeoDRMEmbedsUpdated=!0,window.addEventListener(`message`,e=>{if(!i7(e.origin))return;let t=o7(e.data);if(!t||t.event!==`drminitfailed`)return;let n=e.source?TLr(e.source):null;if(!n)return;let r=n.getAttribute(`allow`)||``;if(!r.includes(`encrypted-media`)){n.setAttribute(`allow`,`${r}; encrypted-media`);let e=new URL(n.getAttribute(`src`));e.searchParams.set(`forcereload`,`drm`),n.setAttribute(`src`,e.toString())}}))}function BLr(){let e=function(){let e,t=[[`requestFullscreen`,`exitFullscreen`,`fullscreenElement`,`fullscreenEnabled`,`fullscreenchange`,`fullscreenerror`],[`webkitRequestFullscreen`,`webkitExitFullscreen`,`webkitFullscreenElement`,`webkitFullscreenEnabled`,`webkitfullscreenchange`,`webkitfullscreenerror`],[`webkitRequestFullScreen`,`webkitCancelFullScreen`,`webkitCurrentFullScreenElement`,`webkitCancelFullScreen`,`webkitfullscreenchange`,`webkitfullscreenerror`],[`mozRequestFullScreen`,`mozCancelFullScreen`,`mozFullScreenElement`,`mozFullScreenEnabled`,`mozfullscreenchange`,`mozfullscreenerror`],[`msRequestFullscreen`,`msExitFullscreen`,`msFullscreenElement`,`msFullscreenEnabled`,`MSFullscreenChange`,`MSFullscreenError`]],n=0,r=t.length,i={};for(;n<r;n++)if(e=t[n],e&&e[1]in document){for(n=0;n<e.length;n++)i[t[0][n]]=e[n];return i}return!1}(),t={fullscreenchange:e.fullscreenchange,fullscreenerror:e.fullscreenerror},n={request(t){return new Promise((r,i)=>{let a=function(){n.off(`fullscreenchange`,a),r()};n.on(`fullscreenchange`,a),t||=document.documentElement;let o=t[e.requestFullscreen]();o instanceof Promise&&o.then(a).catch(i)})},exit(){return new Promise((t,r)=>{if(!n.isFullscreen){t();return}let i=function(){n.off(`fullscreenchange`,i),t()};n.on(`fullscreenchange`,i);let a=document[e.exitFullscreen]();a instanceof Promise&&a.then(i).catch(r)})},on(e,n){let r=t[e];r&&document.addEventListener(r,n)},off(e,n){let r=t[e];r&&document.removeEventListener(r,n)}};return Object.defineProperties(n,{isFullscreen:{get(){return!!document[e.fullscreenElement]}},element:{enumerable:!0,get(){return document[e.fullscreenElement]}},isEnabled:{enumerable:!0,get(){return!!document[e.fullscreenEnabled]}}}),n}var VLr,HLr,ULr,WLr,GLr,KLr,qLr,JLr,YLr,c7,l7,XLr,ZLr,QLr,u7,$Lr,d7,eRr,tRr=o((()=>{if(VLr=typeof global<`u`&&{}.toString.call(global)===`[object global]`,HLr=typeof Bun<`u`,ULr=typeof Deno<`u`,WLr=typeof WebSocketPair==`function`&&caches?.default!==void 0,GLr=VLr||HLr||ULr||WLr,KLr=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`addEventListener`,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:`removeEventListener`,a=typeof t==`string`?[t]:t;return a.forEach(t=>{e[r](t,n)}),{cancel:()=>a.forEach(t=>e[i](t,n))}},qLr=Array.prototype.indexOf!==void 0,JLr=typeof window<`u`&&window.postMessage!==void 0,!GLr&&(!qLr||!JLr))throw Error(`Sorry, the Vimeo Player API is not available in this browser.`);YLr=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},(function(e){if(e.WeakMap)return;var t=Object.prototype.hasOwnProperty,n=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{value:1}).x===1}catch{}}(),r=function(e,t,r){n?Object.defineProperty(e,t,{configurable:!0,writable:!0,value:r}):e[t]=r};e.WeakMap=function(){function e(){if(this===void 0)throw TypeError(`Constructor WeakMap requires 'new'`);if(r(this,`_id`,a(`_WeakMap`)),arguments.length>0)throw TypeError(`WeakMap iterable is not supported`)}r(e.prototype,`delete`,function(e){if(n(this,`delete`),!i(e))return!1;var t=e[this._id];return t&&t[0]===e?(delete e[this._id],!0):!1}),r(e.prototype,`get`,function(e){if(n(this,`get`),i(e)){var t=e[this._id];if(t&&t[0]===e)return t[1]}}),r(e.prototype,`has`,function(e){if(n(this,`has`),!i(e))return!1;var t=e[this._id];return!!(t&&t[0]===e)}),r(e.prototype,`set`,function(e,t){if(n(this,`set`),!i(e))throw TypeError(`Invalid value used as weak map key`);var a=e[this._id];return a&&a[0]===e?(a[1]=t,this):(r(e,this._id,[e,t]),this)});function n(e,n){if(!i(e)||!t.call(e,`_id`))throw TypeError(n+` method called on incompatible receiver `+typeof e)}function a(e){return e+`_`+o()+`.`+o()}function o(){return Math.random().toString().substring(2)}return r(e,`_polyfill`,!0),e}();function i(e){return Object(e)===e}})(typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:YLr),c7=ELr(function(e){(function(t,n,r){n[t]=n[t]||r(),e.exports&&=n[t]})(`Promise`,YLr,function(){var e,t,n,r=Object.prototype.toString,i=typeof setImmediate<`u`?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,t,n,r){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:r!==!1})}}catch{e=function(e,t,n){return e[t]=n,e}}n=function(){var e,n,r;function i(e,t){this.fn=e,this.self=t,this.next=void 0}return{add:function(t,a){r=new i(t,a),n?n.next=r:e=r,n=r,r=void 0},drain:function(){var r=e;for(e=n=t=void 0;r;)r.fn.call(r.self),r=r.next}}}();function a(e,r){n.add(e,r),t||=i(n.drain)}function o(e){var t,n=typeof e;return e!=null&&(n==`object`||n==`function`)&&(t=e.then),typeof t==`function`&&t}function s(){for(var e=0;e<this.chain.length;e++)c(this,this.state===1?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function c(e,t,n){var r,i;try{t===!1?n.reject(e.msg):(r=t===!0?e.msg:t.call(void 0,e.msg),r===n.promise?n.reject(TypeError(`Promise-chain cycle`)):(i=o(r))?i.call(r,n.resolve,n.reject):n.resolve(r))}catch(e){n.reject(e)}}function l(e){var t,n=this;if(!n.triggered){n.triggered=!0,n.def&&(n=n.def);try{(t=o(e))?a(function(){var r=new f(n);try{t.call(e,function(){l.apply(r,arguments)},function(){u.apply(r,arguments)})}catch(e){u.call(r,e)}}):(n.msg=e,n.state=1,n.chain.length>0&&a(s,n))}catch(e){u.call(new f(n),e)}}}function u(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&a(s,t))}function d(e,t,n,r){for(var i=0;i<t.length;i++)(function(i){e.resolve(t[i]).then(function(e){n(i,e)},r)})(i)}function f(e){this.def=e,this.triggered=!1}function p(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function m(e){if(typeof e!=`function`)throw TypeError(`Not a function`);if(this.__NPO__!==0)throw TypeError(`Not a promise`);this.__NPO__=1;var t=new p(this);this.then=function(e,n){var r={success:typeof e!=`function`||e,failure:typeof n==`function`&&n};return r.promise=new this.constructor(function(e,t){if(typeof e!=`function`||typeof t!=`function`)throw TypeError(`Not a function`);r.resolve=e,r.reject=t}),t.chain.push(r),t.state!==0&&a(s,t),r.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,function(e){l.call(t,e)},function(e){u.call(t,e)})}catch(e){u.call(t,e)}}var h=e({},`constructor`,m,!1);return m.prototype=h,e(h,`__NPO__`,0,!1),e(m,`resolve`,function(e){var t=this;return e&&typeof e==`object`&&e.__NPO__===1?e:new t(function(t,n){if(typeof t!=`function`||typeof n!=`function`)throw TypeError(`Not a function`);t(e)})}),e(m,`reject`,function(e){return new this(function(t,n){if(typeof t!=`function`||typeof n!=`function`)throw TypeError(`Not a function`);n(e)})}),e(m,`all`,function(e){var t=this;return r.call(e)==`[object Array]`?e.length===0?t.resolve([]):new t(function(n,r){if(typeof n!=`function`||typeof r!=`function`)throw TypeError(`Not a function`);var i=e.length,a=Array(i),o=0;d(t,e,function(e,t){a[e]=t,++o===i&&n(a)},r)}):t.reject(TypeError(`Not an array`))}),e(m,`race`,function(e){var t=this;return r.call(e)==`[object Array]`?new t(function(n,r){if(typeof n!=`function`||typeof r!=`function`)throw TypeError(`Not a function`);d(t,e,function(e,t){n(t)},r)}):t.reject(TypeError(`Not an array`))}),m})}),l7=new WeakMap,XLr=`airplay.audio_tracks.audiotrack.autopause.autoplay.background.byline.cc.chapter_id.chapters.chromecast.color.colors.controls.disable_context_menu.dnt.end_time.fullscreen.height.id.initial_quality.interactive_params.keyboard.loop.maxheight.max_quality.maxwidth.min_quality.muted.play_button_position.playsinline.portrait.preload.progress_bar.quality.quality_selector.responsive.skipping_forward.speed.start_time.texttrack.thumbnail_id.title.transcript.transparent.unmute_button.url.vimeo_logo.volume.watch_full_video.width`.split(`.`),ZLr={role:`viewer`,autoPlayMuted:!0,allowedDrift:.3,maxAllowedDrift:1,minCheckInterval:.1,maxRateAdjustment:.2,maxTimeToCatchUp:1},QLr=class extends EventTarget{logger;constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;super(),this.logger=r,this.init(t,e,{...ZLr,...n})}disconnect(){this.dispatchEvent(new Event(`disconnect`))}async init(e,t,n){if(await this.waitForTOReadyState(e,`open`),n.role===`viewer`){await this.updatePlayer(e,t,n);let r=KLr(e,`change`,()=>this.updatePlayer(e,t,n)),i=this.maintainPlaybackPosition(e,t,n);this.addEventListener(`disconnect`,()=>{i.cancel(),r.cancel()})}else{await this.updateTimingObject(e,t);let n=KLr(t,[`seeked`,`play`,`pause`,`ratechange`],()=>this.updateTimingObject(e,t),`on`,`off`);this.addEventListener(`disconnect`,()=>n.cancel())}}async updateTimingObject(e,t){let[n,r,i]=await Promise.all([t.getCurrentTime(),t.getPaused(),t.getPlaybackRate()]);e.update({position:n,velocity:r?0:i})}async updatePlayer(e,t,n){let{position:r,velocity:i}=e.query();typeof r==`number`&&t.setCurrentTime(r),typeof i==`number`&&(i===0?await t.getPaused()===!1&&t.pause():i>0&&(await t.getPaused()===!0&&(await t.play().catch(async e=>{e.name===`NotAllowedError`&&n.autoPlayMuted&&(await t.setMuted(!0),await t.play().catch(e=>console.error(`Couldn't play the video from TimingSrcConnector. Error:`,e)))}),this.updatePlayer(e,t,n)),await t.getPlaybackRate()!==i&&t.setPlaybackRate(i)))}maintainPlaybackPosition(e,t,n){let{allowedDrift:r,maxAllowedDrift:i,minCheckInterval:a,maxRateAdjustment:o,maxTimeToCatchUp:s}=n,c=Math.min(s,Math.max(a,i))*1e3,l=async()=>{if(e.query().velocity===0||await t.getPaused()===!0)return;let n=e.query().position-await t.getCurrentTime(),a=Math.abs(n);if(this.log(`Drift: ${n}`),a>i)await this.adjustSpeed(t,0),t.setCurrentTime(e.query().position),this.log(`Resync by currentTime`);else if(a>r){let e=a/s,r=o,i=e<r?(r-e)/2:r;await this.adjustSpeed(t,i*Math.sign(n)),this.log(`Resync by playbackRate`)}},u=setInterval(()=>l(),c);return{cancel:()=>clearInterval(u)}}log(e){this.logger?.(`TimingSrcConnector: ${e}`)}speedAdjustment=0;adjustSpeed=async(e,t)=>{if(this.speedAdjustment===t)return;let n=await e.getPlaybackRate()-this.speedAdjustment+t;this.log(`New playbackRate: ${n}`),await e.setPlaybackRate(n),this.speedAdjustment=t};waitForTOReadyState(e,t){return new Promise(n=>{let r=()=>{e.readyState===t?n():e.addEventListener(`readystatechange`,r,{once:!0})};r()})}},u7=new WeakMap,$Lr=new WeakMap,d7={},eRr=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(window.jQuery&&e instanceof jQuery&&(e.length>1&&window.console&&console.warn&&console.warn(`A jQuery object with multiple elements was passed, using the first element.`),e=e[0]),typeof document<`u`&&typeof e==`string`&&(e=document.getElementById(e)),!bLr(e))throw TypeError(`You must pass either a valid element or a valid id.`);if(e.nodeName!==`IFRAME`){let t=e.querySelector(`iframe`);t&&(e=t)}if(e.nodeName===`IFRAME`&&!i7(e.getAttribute(`src`)||``))throw Error(`The player element passed isn’t a Vimeo embed.`);if(u7.has(e))return u7.get(e);this._window=e.ownerDocument.defaultView,this.element=e,this.origin=`*`;let n=new c7((n,r)=>{if(this._onMessage=e=>{if(!i7(e.origin)||this.element.contentWindow!==e.source)return;this.origin===`*`&&(this.origin=e.origin);let t=o7(e.data);if(t&&t.event===`error`&&t.data&&t.data.method===`ready`){let e=Error(t.data.message);e.name=t.data.name,r(e);return}let i=t&&t.event===`ready`,a=t&&t.method===`ping`;i||a?(this.element.setAttribute(`data-ready`,`true`),n()):jLr(this,t)},this._window.addEventListener(`message`,this._onMessage),this.element.nodeName!==`IFRAME`){let n=MLr(e,t);PLr(wLr(n),n,e).then(t=>{let n=NLr(t,e);return this.element=n,this._originalElement=e,ALr(e,n),u7.set(this.element,this),t}).catch(r)}});if($Lr.set(this,n),u7.set(this.element,this),this.element.nodeName===`IFRAME`&&s7(this,`ping`),d7.isEnabled){let e=()=>d7.exit();this.fullscreenchangeHandler=()=>{d7.isFullscreen?a7(this,`event:exitFullscreen`,e):OLr(this,`event:exitFullscreen`,e),this.ready().then(()=>{s7(this,`fullscreenchange`,d7.isFullscreen)})},d7.on(`fullscreenchange`,this.fullscreenchangeHandler)}return this}static isVimeoUrl(e){return i7(e)}callMethod(e){var t=[...arguments].slice(1);if(e==null)throw TypeError(`You must pass a method name.`);return new c7((n,r)=>this.ready().then(()=>{a7(this,e,{resolve:n,reject:r}),t.length===0?t={}:t.length===1&&(t=t[0]),s7(this,e,t)}).catch(r))}get(e){return new c7((t,n)=>(e=yLr(e,`get`),this.ready().then(()=>{a7(this,e,{resolve:t,reject:n}),s7(this,e)}).catch(n)))}set(e,t){return new c7((n,r)=>{if(e=yLr(e,`set`),t==null)throw TypeError(`There must be a value to set.`);return this.ready().then(()=>{a7(this,e,{resolve:n,reject:r}),s7(this,e,t)}).catch(r)})}on(e,t){if(!e)throw TypeError(`You must pass an event name.`);if(!t)throw TypeError(`You must pass a callback function.`);if(typeof t!=`function`)throw TypeError(`The callback must be a function.`);DLr(this,`event:${e}`).length===0&&this.callMethod(`addEventListener`,e).catch(()=>{}),a7(this,`event:${e}`,t)}off(e,t){if(!e)throw TypeError(`You must pass an event name.`);if(t&&typeof t!=`function`)throw TypeError(`The callback must be a function.`);OLr(this,`event:${e}`,t)&&this.callMethod(`removeEventListener`,e).catch(e=>{})}loadVideo(e){return this.callMethod(`loadVideo`,e)}ready(){let e=$Lr.get(this)||new c7((e,t)=>{t(Error(`Unknown player. Probably unloaded.`))});return c7.resolve(e)}addCuePoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.callMethod(`addCuePoint`,{time:e,data:t})}removeCuePoint(e){return this.callMethod(`removeCuePoint`,e)}enableTextTrack(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e)throw TypeError(`You must pass a language.`);return this.callMethod(`enableTextTrack`,{language:e,kind:t,showing:n})}disableTextTrack(){return this.callMethod(`disableTextTrack`)}selectAudioTrack(e,t){if(!e)throw TypeError(`You must pass a language.`);return this.callMethod(`selectAudioTrack`,{language:e,kind:t})}selectDefaultAudioTrack(){return this.callMethod(`selectDefaultAudioTrack`)}pause(){return this.callMethod(`pause`)}play(){return this.callMethod(`play`)}requestFullscreen(){return d7.isEnabled?d7.request(this.element):this.callMethod(`requestFullscreen`)}exitFullscreen(){return d7.isEnabled?d7.exit():this.callMethod(`exitFullscreen`)}getFullscreen(){return d7.isEnabled?c7.resolve(d7.isFullscreen):this.get(`fullscreen`)}requestPictureInPicture(){return this.callMethod(`requestPictureInPicture`)}exitPictureInPicture(){return this.callMethod(`exitPictureInPicture`)}getPictureInPicture(){return this.get(`pictureInPicture`)}remotePlaybackPrompt(){return this.callMethod(`remotePlaybackPrompt`)}unload(){return this.callMethod(`unload`)}destroy(){return new c7(e=>{if($Lr.delete(this),u7.delete(this.element),this._originalElement&&(u7.delete(this._originalElement),this._originalElement.removeAttribute(`data-vimeo-initialized`)),this.element&&this.element.nodeName===`IFRAME`&&this.element.parentNode&&(this.element.parentNode.parentNode&&this._originalElement&&this._originalElement!==this.element.parentNode?this.element.parentNode.parentNode.removeChild(this.element.parentNode):this.element.parentNode.removeChild(this.element)),this.element&&this.element.nodeName===`DIV`&&this.element.parentNode){this.element.removeAttribute(`data-vimeo-initialized`);let e=this.element.querySelector(`iframe`);e&&e.parentNode&&(e.parentNode.parentNode&&this._originalElement&&this._originalElement!==e.parentNode?e.parentNode.parentNode.removeChild(e.parentNode):e.parentNode.removeChild(e))}this._window.removeEventListener(`message`,this._onMessage),d7.isEnabled&&d7.off(`fullscreenchange`,this.fullscreenchangeHandler),e()})}getAutopause(){return this.get(`autopause`)}setAutopause(e){return this.set(`autopause`,e)}getBuffered(){return this.get(`buffered`)}getCameraProps(){return this.get(`cameraProps`)}setCameraProps(e){return this.set(`cameraProps`,e)}getChapters(){return this.get(`chapters`)}getCurrentChapter(){return this.get(`currentChapter`)}getColor(){return this.get(`color`)}getColors(){return c7.all([this.get(`colorOne`),this.get(`colorTwo`),this.get(`colorThree`),this.get(`colorFour`)])}setColor(e){return this.set(`color`,e)}setColors(e){if(!Array.isArray(e))return new c7((e,t)=>t(TypeError(`Argument must be an array.`)));let t=new c7(e=>e(null)),n=[e[0]?this.set(`colorOne`,e[0]):t,e[1]?this.set(`colorTwo`,e[1]):t,e[2]?this.set(`colorThree`,e[2]):t,e[3]?this.set(`colorFour`,e[3]):t];return c7.all(n)}getCuePoints(){return this.get(`cuePoints`)}getCurrentTime(){return this.get(`currentTime`)}setCurrentTime(e){return this.set(`currentTime`,e)}getDuration(){return this.get(`duration`)}getEnded(){return this.get(`ended`)}getLoop(){return this.get(`loop`)}setLoop(e){return this.set(`loop`,e)}setMuted(e){return this.set(`muted`,e)}getMuted(){return this.get(`muted`)}getPaused(){return this.get(`paused`)}getPlaybackRate(){return this.get(`playbackRate`)}setPlaybackRate(e){return this.set(`playbackRate`,e)}getPlayed(){return this.get(`played`)}getQualities(){return this.get(`qualities`)}getQuality(){return this.get(`quality`)}setQuality(e){return this.set(`quality`,e)}getRemotePlaybackAvailability(){return this.get(`remotePlaybackAvailability`)}getRemotePlaybackState(){return this.get(`remotePlaybackState`)}getSeekable(){return this.get(`seekable`)}getSeeking(){return this.get(`seeking`)}getTextTracks(){return this.get(`textTracks`)}getAudioTracks(){return this.get(`audioTracks`)}getEnabledAudioTrack(){return this.get(`enabledAudioTrack`)}getDefaultAudioTrack(){return this.get(`defaultAudioTrack`)}getVideoEmbedCode(){return this.get(`videoEmbedCode`)}getVideoId(){return this.get(`videoId`)}getVideoTitle(){return this.get(`videoTitle`)}getVideoWidth(){return this.get(`videoWidth`)}getVideoHeight(){return this.get(`videoHeight`)}getVideoUrl(){return this.get(`videoUrl`)}getVolume(){return this.get(`volume`)}setVolume(e){return this.set(`volume`,e)}async setTimingSrc(e,t){if(!e)throw TypeError(`A Timing Object must be provided.`);await this.ready();let n=new QLr(this,e,t);return s7(this,`notifyTimingObjectConnect`),n.addEventListener(`disconnect`,()=>s7(this,`notifyTimingObjectDisconnect`)),n}},GLr||(d7=BLr(),FLr(),ILr(),LLr(),RLr(),zLr())})),nRr=/vimeo\.com\/(?!progressive_redirect).+/,rRr=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,iRr=/\.(m3u8)($|\?)/i,aRr=e=>!!e&&nRr.test(e)&&!rRr.test(e)&&!iRr.test(e),oRr=()=>typeof window<`u`&&!!window.Vimeo?.Player,sRr=null,cRr=()=>(sRr??=Promise.resolve().then(()=>(tRr(),vLr)).then(({default:e})=>{let t=window;t.Vimeo={...t.Vimeo,Player:e}}).catch(()=>void 0),sRr),lRr=e=>{let t=aRr(e),[n,r]=(0,S.useState)(()=>!t||oRr()),[i,a]=(0,S.useState)(t);return t!==i&&(a(t),r(!t||oRr())),(0,S.useEffect)(()=>{if(!t||oRr()){r(!0);return}let e=!0;return r(!1),cRr().then(()=>{e&&r(!0)}),()=>{e=!1}},[t]),n};JQ();var uRr=Wje(nLr.default),dRr={wrapper:`rounded-xl w-full overflow-hidden relative`,video:`aspect-video`};typeof window<`u`&&(window.Hls=OIr);var fRr=e=>e&&`embedHtml`in e?e.embedHtml:null,pRr=e=>e&&`userProgress`in e&&e.userProgress?.playhead||0,mRr=({media:e,coverImage:t,livestream:n,content:r,shouldSendInteractions:i,...a})=>{let o=(0,S.useRef)(null),s=(0,S.useRef)({getCurrentTime:()=>o.current?.getCurrentTime(),getDuration:()=>o.current?.getDuration()}).current,{playing:c,...l}=a,{isPlaying:u,setIsPlaying:d,hasPlayed:f,handlePlayed:p,handlePaused:m,handleEnded:h,handleSeekStart:g,handleSeek:_,handleProgress:v,handleError:y,handlePlaybackRateChange:b}=dOr({media:e,livestream:n,content:r,clock:s,shouldSendInteractions:i,initialPlaying:typeof c==`boolean`&&c}),x=(0,S.useRef)(0),[C,w]=(0,S.useState)(!1);(0,S.useEffect)(()=>w(!0),[]);let T=lRr(e?.sources?.[0]?.uri),E=_Lr(n?e?.sources?.[0]?.uri:void 0),D=(0,S.useRef)(!1);E&&(D.current=!0);let O=D.current&&typeof navigator<`u`&&navigator.userActivation?.hasBeenActive===!1,k=async()=>{if(n)P();else{let t=pRr(e);t>0&&!f&&x.current!==t&&(x.current=t,o.current?.seekTo(t))}},A=(e,...t)=>{console.error(`Video error`,e,t),y()},j=fRr(e),M=(0,S.useMemo)(()=>aLr(j),[j]);if(j&&!M)return null;if(M)return(0,q.jsx)(`div`,{className:qx(dRr.wrapper),dangerouslySetInnerHTML:{__html:M}});let N=!!e?.sources?.[0]?.uri,ee=!N||!C||!T||E!==!1,P=()=>{if(!n?.start||!o.current)return;let e=new Date(n.start),t=(new Date().getTime()-e.getTime())/1e3;o.current?.seekTo(t)},te=t?.sources?.[0]?.uri,ne=pLr(e?.sources?.[0]?.uri),re={file:{attributes:{...n?{autoPlay:!0}:{}},hlsVersion:`1.5.19`},...ne.embedOptions?{youtube:{embedOptions:ne.embedOptions}}:{}};return(0,q.jsxs)(`div`,{className:qx(dRr.wrapper,dRr.video),children:[ee?(0,q.jsx)(X8,{image:t??void 0,className:`h-full w-full object-cover`}):(0,q.jsx)(uRr,{ref:o,url:ne.url,controls:!0,config:re,playing:n?!0:typeof c==`boolean`?c:u,playsinline:!0,width:`100%`,height:`100%`,onReady:k,onEnded:h,onPlay:p,onPause:m,onSeeking:g,onSeeked:_,onProgress:v,onError:A,onPlaybackRateChange:b,light:!1,muted:O,...l}),E?(0,q.jsxs)(`div`,{...Y8(`starting-soon`),role:`status`,className:`absolute inset-0 flex flex-col items-center justify-center gap-1 bg-black/60 p-4 text-center text-white`,children:[(0,q.jsx)(`span`,{className:`font-semibold`,children:`Starting soon`}),(0,q.jsx)(`span`,{className:`text-sm`,children:`This livestream will play when it begins.`})]}):null,te&&N&&!n&&!f?(0,q.jsxs)(`button`,{type:`button`,...Y8(`poster`),className:`absolute inset-0 flex items-center justify-center bg-black/40`,style:{backgroundImage:`url(${te})`,backgroundSize:`cover`,backgroundPosition:`center`,backgroundRepeat:`no-repeat`},onClick:()=>{d(!0)},children:[(0,q.jsx)(`span`,{className:`sr-only`,children:`Play video`}),(0,q.jsx)(qQ,{weight:`fill`,size:60,className:`text-white drop-shadow-lg`})]}):null]})},hRr=({feature:e,isInteractionEnabled:t=!1})=>e.media?(0,q.jsx)(`div`,{className:`print:hidden`,children:(0,q.jsx)(mRr,{media:e.media,shouldSendInteractions:t})}):null;Tw(`
432
432
  fragment VideoFeatureFragment on VideoFeature {
433
433
  id
434
434
  media {