WordPress.org

Plugin Directory

Changeset 1734145


Ignore:
Timestamp:
09/22/17 08:42:55 (4 weeks ago)
Author:
s3bubble
Message:

New modal links in text

Location:
s3bubble-amazon-web-services-oembed-media-streaming-support/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • s3bubble-amazon-web-services-oembed-media-streaming-support/trunk/dist/js/s3bubble.min.js

    r1732336 r1734145  
    1 function s3bubbleGlobals(){var defaults={api:"https://s3bubbleapi.com"},helpers={};return helpers.extend=function(og,so){for(var key in so)"object"==typeof og[key]?helpers.extend(og[key],so[key]):og[key]=so[key];return og},helpers.isScrolledIntoView=function(el){var elemTop=el.getBoundingClientRect().top,elemBottom=el.getBoundingClientRect().bottom;return elemTop<window.innerHeight&&elemBottom>=0},helpers.setFontSize=function(options){var elw=document.getElementById(options.id).offsetWidth,defaults={maximum:9999,minimum:1,maxFont:9999,minFont:1,fontRatio:35};if(options.hasOwnProperty("elements"))for(var elms=options.elements,i=elms.length-1;i>=0;i--)if(elms[i].hasOwnProperty("fontRatio")&&elms[i].hasOwnProperty("el")){var fontBase=(elw>defaults.maximum?defaults.maximum:elw<defaults.minimum?defaults.minimum:elw)/elms[i].fontRatio,fontSize=fontBase>defaults.maxFont?defaults.maxFont:fontBase<defaults.minFont?defaults.minFont:fontBase;elms[i].el.style.fontSize=fontSize+"px"}},helpers.addScripts=function(){var ima3=document.createElement("script");ima3.type="text/javascript",ima3.src="//imasdk.googleapis.com/js/sdkloader/ima3.js";var googleAnalytics=document.createElement("script");googleAnalytics.type="text/javascript",googleAnalytics.async=!0,googleAnalytics.src="//www.google-analytics.com/analytics.js",document.getElementsByTagName("head")[0].setAttribute("data-cast-api-enabled","true");var chromeCastSDK=document.createElement("script");chromeCastSDK.type="text/javascript",chromeCastSDK.async=!0,chromeCastSDK.src="//www.gstatic.com/cv/js/sender/v1/cast_sender.js",function(){try{return window.self!==window.top}catch(e){return!0}}()||(document.head.appendChild(ima3),document.head.appendChild(googleAnalytics),document.head.appendChild(chromeCastSDK));var s3bubbleMain=document.getElementsByClassName("s3bubble");for(i=0;i<s3bubbleMain.length;i++)if(s3bubbleMain[i].getAttribute("data-setup")){setup=JSON.parse(s3bubbleMain[i].getAttribute("data-setup"));s3bubble(s3bubbleMain[i].getAttribute("id")).video(setup)}var s3bubbleModal=document.getElementsByClassName("s3bubble-modal");for(i=0;i<s3bubbleModal.length;i++)if(s3bubbleModal[i].getAttribute("data-setup")){setup=JSON.parse(s3bubbleModal[i].getAttribute("data-setup"));s3bubble("s3bubble-modal").modal(setup)}var s3bubbleService=document.getElementsByClassName("s3bubble-service");for(i=0;i<s3bubbleService.length;i++)if(s3bubbleService[i].getAttribute("data-setup")){setup=JSON.parse(s3bubbleService[i].getAttribute("data-setup"));s3bubble(s3bubbleService[i].getAttribute("id")).service(setup)}var s3bubbleAudio=document.getElementsByClassName("s3bubble-audio");for(i=0;i<s3bubbleAudio.length;i++)if(s3bubbleAudio[i].getAttribute("data-setup")){setup=JSON.parse(s3bubbleAudio[i].getAttribute("data-setup"));s3bubble(s3bubbleAudio[i].getAttribute("id")).audio(setup)}var s3bubbleLive=document.getElementsByClassName("s3bubble-live");for(i=0;i<s3bubbleLive.length;i++)if(s3bubbleLive[i].getAttribute("data-setup")){setup=JSON.parse(s3bubbleLive[i].getAttribute("data-setup"));s3bubble(s3bubbleLive[i].getAttribute("id")).live(setup)}var s3bubblePlaylist=document.getElementsByClassName("s3bubble-playlist");for(i=0;i<s3bubblePlaylist.length;i++)if(s3bubblePlaylist[i].getAttribute("data-setup")){setup=JSON.parse(s3bubblePlaylist[i].getAttribute("data-setup"));s3bubble(s3bubblePlaylist[i].getAttribute("id")).playlist(setup)}var i,s3bubbleLazyPlaylist=document.getElementsByClassName("s3bubble-lazy");for(i=0;i<s3bubbleLazyPlaylist.length;i++)if(s3bubbleLazyPlaylist[i].getAttribute("data-setup")){var setup=JSON.parse(s3bubbleLazyPlaylist[i].getAttribute("data-setup"));s3bubble(s3bubbleLazyPlaylist[i].getAttribute("id")).lazy(setup)}},helpers.getData=function(data,callback){var xhr=new XMLHttpRequest;xhr.open("POST",defaults.api+"/api/"+data.uri),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.onload=function(){if(200===xhr.status){var data=JSON.parse(xhr.responseText);callback(data.error?{error:!0,message:data.message}:data)}else 200!==xhr.status&&callback({error:!0,message:"Request failed.  Returned status of "+xhr.status})},data.location=location.host.indexOf("www.")&&location.host||location.host.replace("www.",""),xhr.send(function(object){var encodedString="";for(var prop in object)object.hasOwnProperty(prop)&&(encodedString.length>0&&(encodedString+="&"),encodedString+=encodeURI(prop+"="+object[prop]));return encodedString}(data))},helpers.getJson=function(data,callback){var xhr=new XMLHttpRequest;xhr.open("GET",data.waveform),xhr.setRequestHeader("Content-Type","application/json"),xhr.onload=function(){if(200===xhr.status){var data=JSON.parse(xhr.responseText);callback(data.error?{error:!0,message:data.message}:data)}else 200!==xhr.status&&callback({error:!0,message:"Request failed.  Returned status of "+xhr.status})},xhr.send()},helpers.swipedetect=function(el,callback){var swipedir,startX,startY,distX,distY,elapsedTime,startTime,touchsurface=el,handleswipe=callback||function(swipedir){};touchsurface.addEventListener("touchstart",function(e){var touchobj=e.changedTouches[0];swipedir="none",dist=0,startX=touchobj.pageX,startY=touchobj.pageY,startTime=(new Date).getTime(),e.preventDefault()},!1),touchsurface.addEventListener("touchmove",function(e){e.preventDefault()},!1),touchsurface.addEventListener("touchend",function(e){var touchobj=e.changedTouches[0];distX=touchobj.pageX-startX,distY=touchobj.pageY-startY,(elapsedTime=(new Date).getTime()-startTime)<=300&&(Math.abs(distX)>=150&&Math.abs(distY)<=100?swipedir=distX<0?"left":"right":Math.abs(distY)>=150&&Math.abs(distX)<=100&&(swipedir=distY<0?"up":"down")),handleswipe(swipedir),e.preventDefault()},!1)},helpers.s3bubbleCleanFilename=function(name){if(""===name||void 0===name||!1===name)return null;try{return name=decodeURIComponent(name),name=name.replace(/\\/g,""),name=name.replace(/\_/g," "),name=name.replace(/\-/g," ")}catch(err){return name=name.replace(/\\/g,""),name=name.replace(/\_/g," "),name=name.replace(/\-/g," ")}},helpers.hasClass=function(ele,cls){if(ele)return!!ele.className.match(new RegExp("(\\s|^)"+cls+"(\\s|$)"))},helpers.addClass=function(ele,cls){ele&&(helpers.hasClass(ele,cls)||(ele.className+=" "+cls))},helpers.removeClass=function(ele,cls){if(ele&&helpers.hasClass(ele,cls)){var reg=new RegExp("(\\s|^)"+cls+"(\\s|$)");ele.className=ele.className.replace(reg," ")}},helpers.isAndroid=function(){return navigator.userAgent.match(/Android/i)},helpers.isBlackBerry=function(){return navigator.userAgent.match(/BlackBerry/i)},helpers.isIOS=function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},helpers.isOpera=function(){return navigator.userAgent.match(/Opera Mini/i)},helpers.isWindows=function(){return navigator.userAgent.match(/IEMobile/i)||navigator.userAgent.match(/WPDesktop/i)},helpers.isMobile=function(){return helpers.isAndroid()||helpers.isBlackBerry()||helpers.isIOS()||helpers.isOpera()||helpers.isWindows()},helpers.getExternalService=function(url){if(url.match(/(http:\/\/|https:\/\/|)(player.|www.)?(dailymotion\.com|vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),RegExp.$3.indexOf("youtu")>-1)type="youtube";else if(RegExp.$3.indexOf("vimeo")>-1)type="vimeo";else if(RegExp.$3.indexOf("dailymotion")>-1)var type="dailymotion";return{type:type,id:RegExp.$6}},helpers}function s3bubble(div){var s3bubble={};return videojs.browser.IS_ANY_SAFARI||(videojs.options.hls.overrideNative=!0,videojs.options.html5.nativeAudioTracks=!1,videojs.options.html5.nativeTextTracks=!1),s3bubble.playlist=function(options,callback){if(options.hasOwnProperty("code")){var getPlayerDiv=document.getElementById(div);null!==getPlayerDiv?s3bubbleHelpers.getData({uri:"playlist_codes",id:options.code},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),player=videojs("aws-player"),player.errorsPlugin(),void player.error({code:7,message:_response.message});options.codes=_response.codes,options.options=_response.options,options.meta=_response.meta,options.brand=_response.brand,options.source=_response.source,options.playlist=!0,options.hasOwnProperty("type")&&"audio"===options.type?s3bubble.audio(options,callback):s3bubble.video(options,callback)}):console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: Code is a required option")},s3bubble.modal=function(options,callback){if(options.hasOwnProperty("codes"))if(options.hasOwnProperty("modal")){var text="";options.modal.hasOwnProperty("text")&&(text="<p style='margin-top:10px;'>"+options.modal.text+"</p>"),options.modal.html="<div id='"+div+"' class='s3bubbble-prepare-16-9'></div>"+text,options.options.prepare=!0;var link=null;if(options.modal.hasOwnProperty("link")&&(link=options.modal.link,delete options.modal.link),options.modal.hasOwnProperty("delay")){var delay=options.modal.delay;delete options.modal.delay,setTimeout(function(){if(s3bubbleswal(options.modal).then(function(){link&&window.open(link,"_self")}),!options.modal.hasOwnProperty("title")){var removeTitle=document.querySelector(".s3bubble-swal2-title");null!=removeTitle&&removeTitle.parentNode.removeChild(removeTitle)}options.hasOwnProperty("type")&&"audio"===options.type?s3bubble.audio(options,callback):s3bubble.video(options,callback)},delay)}else{if(s3bubbleswal(options.modal).then(function(){link&&window.open(link,"_self")}),!options.modal.hasOwnProperty("title")){var removeTitle=document.querySelector(".s3bubble-swal2-title");null!=removeTitle&&removeTitle.parentNode.removeChild(removeTitle)}options.hasOwnProperty("type")&&"audio"===options.type?s3bubble.audio(options,callback):s3bubble.video(options,callback)}}else options.options.prepare=!0,s3bubbleswal({html:"<div id='"+div+"' class='s3bubbble-prepare-16-9'></div>",width:600}),options.hasOwnProperty("type")&&"audio"===options.type?s3bubble.audio(options,callback):s3bubble.video(options,callback);else console.log("ERROR: Code is a required option")},s3bubble.audio=function(options,callback){var settings,video,player,searchForOldPlayers=document.querySelector("#"+div);if(null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),options.hasOwnProperty("codes")){"string"==typeof options.codes&&(options.codes=[options.codes]);var getPlayerDiv=document.getElementById(div);if(null!==getPlayerDiv){var int=0;options.hasOwnProperty("setIndex")&&(int=parseInt(options.setIndex)),s3bubbleHelpers.getData({uri:"player",code:options.codes[int]},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),(player=videojs("aws-player")).errorsPlugin(),void player.error({code:7,message:_response.message});(settings=s3bubbleHelpers.extend(_response,options)).index=0,settings.length=0,window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create",settings.options.googleUaCode,"auto","s3bubble"),ga("s3bubble.send","pageview"),ga("s3bubble.send","event","s3bubble.init","video.code",settings.options.code),ga("s3bubble.send","event","s3bubble.init","video.bucket",settings.options.bucket),ga("s3bubble.send","event","s3bubble.init","video.title",s3bubbleHelpers.s3bubbleCleanFilename(settings.meta.title)),ga("s3bubble.send","event","s3bubble.init","video.key",settings.options.key),ga("s3bubble.send","event","s3bubble.init","video.vpaid",settings.options.vpaid),(video=document.createElement("video")).id=div+"-player",video.className="video-js vjs-default-skin",video.poster=settings.source.poster,video.controls=settings.options.controls,video.muted=settings.options.muted,video.preload=settings.options.preload,video.crossorigin="anonymous",video.playsinline=!0,video.addEventListener("contextmenu",function(e){e.preventDefault()},!1),settings.options.hasOwnProperty("prepare")&&(video.style.position="absolute",video.style.top="0px"),getPlayerDiv.appendChild(video),s3bubbleHelpers.swipedetect(getPlayerDiv,function(swipedir){"right"===swipedir&&window.history.back()});var videoOptions={autoplay:settings.options.autoplay,playbackRates:settings.options.playbackRates,loop:settings.options.loop,nativeControlsForTouch:!1,plugins:{chromecast:{appId:settings.options.hasOwnProperty("chromecast")?settings.options.chromecast:"E14DC85B"}}};settings.options.hasOwnProperty("width")&&(videoOptions.width=settings.options.width),settings.options.hasOwnProperty("height")&&(videoOptions.height=settings.options.height),settings.options.hasOwnProperty("height")||settings.options.hasOwnProperty("width")||(settings.options.hasOwnProperty("aspect")?video.classList.add("vjs-"+settings.options.aspect):video.classList.add("vjs-16-9")),settings.options.fluid&&video.classList.add("vjs-s3bubble-fullscreen");var css=".vjs-default-skin.vjs-user-inactive .vjs-control-bar {opacity:1 !important;}.video-js .vjs-control-bar {display:inline-flex !important;}",head=document.head||document.getElementsByTagName("head")[0],style=document.createElement("style");style.type="text/css",style.styleSheet?style.styleSheet.cssText=css:style.appendChild(document.createTextNode(css)),head.appendChild(style),(player=videojs(div+"-player",videoOptions,function(){this.one("durationchange",function(){if(settings.hasOwnProperty("startTime")){var skipToPercentage=this.duration()/100*settings.startTime;this.currentTime(Math.round(parseInt(skipToPercentage)))}}),settings.hasOwnProperty("popit")&&this.popitPlugin(div,settings.popit),this.playlistPlugin(settings),this.airplayPlugin(),this.ga({code:settings.options.code}),callback&&callback(this)})).src(settings.source),player.errorsPlugin(),player.waveformPlugin(div,settings),settings.source.hasOwnProperty("download")&&"application/x-mpegURL"!=settings.source.type&&(settings.meta.download=settings.source.download),player.s3BubbleMetaOverlay(settings.meta),player.brandPlugin(settings.brand),s3bubbleHelpers.isMobile()&&(player.el().getElementsByClassName("vjs-big-play-button")[0].style.display="none"),settings.hasOwnProperty("playlist")||(player.previewPlugin(settings.preview),player.buttonsPlugin(settings.buttons));var startEvent=settings.options.autoplay?"loadedmetadata":"click";(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(startEvent="touchend"),player.one(startEvent,function(_event){this.vPaidPlugin(div+"-player",settings)}),player.on("loadedmetadata",function(_event){this.ratesSwitcherPlugin(settings)}),player.playlistSkip=function(ind){var that=this;settings.index=ind;var code=settings.codes.indexOf(ind);-1!=code&&(settings.index=code);var getPlaylist=that.el().getElementsByClassName("vjs-s3bubble-playlist");if(getPlaylist){var i,playlistChildren=getPlaylist[0].childNodes;for(i=0;i<playlistChildren.length;i++)parseInt(playlistChildren[i].getAttribute("id"))===parseInt(settings.index)?s3bubbleHelpers.addClass(playlistChildren[i],"vjs-selected"):s3bubbleHelpers.removeClass(playlistChildren[i],"vjs-selected")}that.pause(),s3bubbleHelpers.getData({uri:"player",code:settings.codes[settings.index]},function(_response){_response.error?console.log("ERROR: ",_response.message):(settings.hasOwnProperty("playlist")?(that.src(_response.source),that.load(),_response.brand=settings.brand,that.waveformPlugin(div,_response)):(that.src(_response.source),that.load(),that.poster(_response.source.poster),that.s3BubbleMetaOverlay(_response.meta),that.updatePreview(_response.preview),_response.brand=settings.brand,that.waveformPlugin(div,_response)),that.play())})},player.reload=function(ind){var that=this;that.pause(),s3bubbleHelpers.getData({uri:"player",code:settings.codes[0]},function(_response){_response.error?console.log("ERROR: ",_response.message):(settings.hasOwnProperty("playlist")?(that.src(_response.source),that.load(),that.waveformPlugin(div,_response)):(that.src(_response.source),that.load(),that.waveformPlugin(div,_response),that.poster(_response.source.poster),that.s3BubbleMetaOverlay(_response.meta),that.updatePreview(_response.preview)),that.play())})}})}else console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: Codes is a required option")},s3bubble.video=function(options,callback){var settings,video,player,searchForOldPlayers=document.querySelector("#"+div);if(null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),options.hasOwnProperty("codes")){"string"==typeof options.codes&&(options.codes=[options.codes]);var getPlayerDiv=document.getElementById(div);if(null!==getPlayerDiv){var int=0;options.hasOwnProperty("setIndex")&&(int=parseInt(options.setIndex)),s3bubbleHelpers.getData({uri:"player",code:options.codes[int]},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),(player=videojs("aws-player")).errorsPlugin(),void player.error({code:7,message:_response.message});(settings=s3bubbleHelpers.extend(_response,options)).index=0,settings.length=0,window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create",settings.options.googleUaCode,"auto","s3bubble"),ga("s3bubble.send","pageview"),ga("s3bubble.send","event","s3bubble.init","video.code",settings.options.code),ga("s3bubble.send","event","s3bubble.init","video.bucket",settings.options.bucket),ga("s3bubble.send","event","s3bubble.init","video.title",s3bubbleHelpers.s3bubbleCleanFilename(settings.meta.title)),ga("s3bubble.send","event","s3bubble.init","video.key",settings.options.key),ga("s3bubble.send","event","s3bubble.init","video.vpaid",settings.options.vpaid),(video=document.createElement("video")).id=div+"-player",settings.options.background?video.className="video-js vjs-s3bubble-background":video.className="video-js vjs-default-skin",video.poster=settings.source.poster,video.controls=settings.options.controls,video.muted=settings.options.muted,video.preload=settings.options.preload,video.crossorigin="anonymous",video.addEventListener("contextmenu",function(e){e.preventDefault()},!1),settings.options.hasOwnProperty("prepare")&&(video.style.position="absolute",video.style.top="0px"),getPlayerDiv.appendChild(video),s3bubbleHelpers.swipedetect(getPlayerDiv,function(swipedir){"right"===swipedir&&window.history.back()});var videoOptions={autoplay:settings.options.autoplay,playbackRates:settings.options.playbackRates,loop:settings.options.loop,nativeControlsForTouch:!1,plugins:{chromecast:{appId:settings.options.hasOwnProperty("chromecast")?settings.options.chromecast:"E14DC85B"}}};settings.options.hasOwnProperty("width")&&(videoOptions.width=settings.options.width),settings.options.hasOwnProperty("height")&&(videoOptions.height=settings.options.height),settings.options.hasOwnProperty("height")||settings.options.hasOwnProperty("width")||(settings.options.hasOwnProperty("aspect")?video.classList.add("vjs-"+settings.options.aspect):video.classList.add("vjs-16-9")),settings.options.fluid&&video.classList.add("vjs-s3bubble-fullscreen"),player=videojs(div+"-player",videoOptions,function(){this.one("durationchange",function(){if(settings.hasOwnProperty("startTime")){var skipToPercentage=this.duration()/100*settings.startTime;this.currentTime(Math.round(parseInt(skipToPercentage)))}}),settings.hasOwnProperty("popit")&&this.popitPlugin(div,settings.popit),this.playlistPlugin(settings),this.airplayPlugin(),this.ga({code:settings.options.code}),this.getThumbs(0),this.getCaptions(0),this.s3BubbleMultiAdvertsLoad(settings),callback&&callback(this)}),"video/quicktime"===settings.source.type&&(settings.source.type="video/mp4");var sources=[];sources.push(settings.source),"application/x-mpegURL"===settings.source.type&&settings.hasOwnProperty("fallback")&&sources.push(settings.fallback),player.src(sources),player.errorsPlugin(),settings.source.hasOwnProperty("download")&&"application/x-mpegURL"!=settings.source.type&&(settings.meta.download=settings.source.download),player.s3BubbleMetaOverlay(settings.meta),player.brandPlugin(settings.brand),player.s3BubbleMultiAdvertsInit(settings.brand),settings.hasOwnProperty("playlist")||(player.previewPlugin(settings.preview),player.buttonsPlugin(settings.buttons));var startEvent=settings.options.autoplay?"loadedmetadata":"click";(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(startEvent="touchend"),player.one(startEvent,function(_event){this.vPaidPlugin(div+"-player",settings)}),player.on("loadedmetadata",function(_event){this.ratesSwitcherPlugin(settings)}),player.getCaptions=function(ind){var that=this;s3bubbleHelpers.getData({uri:"captions",code:settings.codes[ind]},function(_response){if(_response.error)console.log("ERROR: ",_response.message);else{if(!that.el())return;var captionsButton=that.el().getElementsByClassName("vjs-captions-button");if(captionsButton.length>0){var S3BubbleVideo=that.el().getElementsByClassName("vjs-tech");S3BubbleVideo.length>0&&(S3BubbleVideo[0].crossOrigin="anonymous"),that.tech_.hasOwnProperty("textTracks_")&&that.tech_.textTracks_.hasOwnProperty("tracks_")&&(captionsButton[0].style.display="none",that.tech_.textTracks_.tracks_=[]);var captions=_response.captions;if(captions.length>0){captionsButton[0].style.display="block";for(var i=captions.length-1;i>=0;i--)that.addRemoteTextTrack({kind:"captions",language:captions[i].lang,label:captions[i].label,src:captions[i].src},!0)}}}})},player.getThumbs=function(ind){var that=this;s3bubbleHelpers.getData({uri:"thumbs",code:settings.codes[ind]},function(_response){if(_response.error)console.log("ERROR: ",_response.message);else{var thumbs=_response.thumbs,tu=[];if(thumbs.length>0)for(var i=thumbs.length-1;i>=0;i--){var build=thumbs[i],element={src:build.src};tu[build.time]=element}that.thumbnails(tu)}})},player.playlistSkip=function(ind){var that=this;settings.index=ind;var code=settings.codes.indexOf(ind);-1!=code&&(settings.index=code);var getPlaylist=that.el().getElementsByClassName("vjs-s3bubble-playlist");if(getPlaylist){var i,playlistChildren=getPlaylist[0].childNodes;for(i=0;i<playlistChildren.length;i++)parseInt(playlistChildren[i].getAttribute("id"))===parseInt(settings.index)?s3bubbleHelpers.addClass(playlistChildren[i],"vjs-selected"):s3bubbleHelpers.removeClass(playlistChildren[i],"vjs-selected")}that.pause(),s3bubbleHelpers.getData({uri:"player",code:settings.codes[settings.index]},function(_response){_response.error?console.log("ERROR: ",_response.message):(settings.hasOwnProperty("playlist")?(that.src(_response.source),that.load(),that.s3BubbleMultiAdvertsLoad(_response),that.getThumbs(settings.index),that.getCaptions(settings.index)):(that.src(_response.source),that.load(),_response.source.hasOwnProperty("download")&&"application/x-mpegURL"!=_response.source.type&&(_response.meta.download=_response.source.download),that.s3BubbleMetaOverlay(_response.meta),that.s3BubbleMultiAdvertsLoad(_response),that.updatePreview(_response.preview),that.getThumbs(settings.index),that.getCaptions(settings.index)),that.play())})},player.reload=function(ind){var that=this;that.pause(),s3bubbleHelpers.getData({uri:"player",code:settings.codes[0]},function(_response){_response.error?console.log("ERROR: ",_response.message):(settings.hasOwnProperty("playlist")?(that.src(_response.source),that.load(),that.getThumbs(settings.index),that.getCaptions(settings.index)):(that.src(_response.source),that.load(),_response.source.hasOwnProperty("download")&&"application/x-mpegURL"!=_response.source.type&&(_response.meta.download=_response.source.download),that.s3BubbleMetaOverlay(_response.meta),that.updatePreview(_response.preview),that.getThumbs(settings.index),that.getCaptions(settings.index)),that.play())})}})}else console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: Codes is a required option")},s3bubble.service=function(options,callback){var settings,video,player,searchForOldPlayers=document.querySelector("#"+div);if(null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),options.hasOwnProperty("codes")){"string"==typeof options.codes&&(options.codes=[options.codes]);var getPlayerDiv=document.getElementById(div);if(null!==getPlayerDiv){var service=s3bubbleHelpers.getExternalService(options.codes[0]);void 0!==service.type?s3bubbleHelpers.getData({uri:"globals"},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),(player=videojs("aws-player")).errorsPlugin(),void player.error({code:7,message:_response.message});(settings=s3bubbleHelpers.extend(_response,options)).index=0,settings.length=0,window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create",settings.options.googleUaCode,"auto","s3bubble"),ga("s3bubble.send","pageview"),ga("s3bubble.send","event","s3bubble.service","video.code",settings.codes[settings.index]),(video=document.createElement("video")).id=div+"-player",settings.options.background?video.className="video-js vjs-s3bubble-background":video.className="video-js vjs-default-skin vjs-16-9 "+(settings.options.fluid?"vjs-s3bubble-fullscreen ":" "),video.poster=settings.source.poster,video.controls=settings.options.controls,video.muted=settings.options.muted,video.preload=settings.options.preload,video.addEventListener("contextmenu",function(e){e.preventDefault()},!1),video.crossorigin="anonymous",getPlayerDiv.appendChild(video),s3bubbleHelpers.swipedetect(getPlayerDiv,function(swipedir){"right"===swipedir&&window.history.back()}),(player=videojs(div+"-player",{techOrder:["youtube","vimeo","dailymotion"],sources:[{type:"video/"+service.type,src:settings.codes[settings.index]}],autoplay:settings.options.autoplay,playbackRates:settings.options.playbackRates,loop:settings.options.loop,nativeControlsForTouch:!1,plugins:{chromecast:{appId:settings.options.hasOwnProperty("chromecast")?settings.options.chromecast:"E14DC85B"}}},function(){this.one("durationchange",function(){if(settings.hasOwnProperty("startTime")){var skipToPercentage=this.duration()/100*settings.startTime;this.currentTime(Math.round(parseInt(skipToPercentage)))}}),this.brandPlugin(settings.brand),settings.hasOwnProperty("meta")&&(settings.source.hasOwnProperty("download")&&(settings.meta.download=settings.source.download),this.s3BubbleMetaOverlay(settings.meta)),this.ga({code:settings.codes[settings.index]}),callback&&callback(this)})).on("ended",function(){if(parseInt(settings.index)<settings.codes.length-1){settings.index++;var service=s3bubbleHelpers.getExternalService(settings.codes[settings.index]);if(void 0===service.type)return void console.log("ERROR: Please enter the full url");var vimeoFrame=player.el().getElementsByClassName("vimeoFrame")[0];void 0!==vimeoFrame&&(vimeoFrame.style.display="youtube"===service.type?"none":"block"),this.src({type:"video/"+service.type,src:settings.codes[settings.index]}),this.play()}})}):console.log("ERROR: Please enter the full url")}else console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: Codes is a required option")},s3bubble.lazy=function(options,callback){var settings,video,player,searchForOldPlayers=document.querySelector("#"+div);if(null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),options.hasOwnProperty("code")){var getPlayerDiv=document.getElementById(div);null!==getPlayerDiv?s3bubbleHelpers.getData({uri:"lazy",code:options.code,types:options.types},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),(player=videojs("aws-player")).errorsPlugin(),void player.error({code:7,message:_response.message});(settings=s3bubbleHelpers.extend(_response,options)).index=0,settings.length=0,window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create",settings.options.googleUaCode,"auto","s3bubble"),ga("s3bubble.send","pageview"),(video=document.createElement("video")).id=div+"-player",settings.options.background?video.className="video-js vjs-s3bubble-background":video.className="video-js vjs-default-skin vjs-16-9 "+(settings.options.fluid?"vjs-s3bubble-fullscreen ":" "),video.poster=settings.source.poster,video.controls=settings.options.controls,video.muted=settings.options.muted,video.preload=settings.options.preload,video.addEventListener("contextmenu",function(e){e.preventDefault()},!1),video.crossorigin="anonymous",getPlayerDiv.appendChild(video),s3bubbleHelpers.swipedetect(getPlayerDiv,function(swipedir){"right"===swipedir&&window.history.back()}),(player=videojs(div+"-player",{autoplay:settings.options.autoplay,playbackRates:settings.options.playbackRates,loop:settings.options.loop,nativeControlsForTouch:!1,plugins:{chromecast:{appId:settings.options.hasOwnProperty("chromecast")?settings.options.chromecast:"E14DC85B"}}},function(){this.playlistPluginLazy(settings),this.brandPlugin(settings.brand),settings.hasOwnProperty("meta")&&(settings.source.hasOwnProperty("download")&&(settings.meta.download=settings.source.download),this.s3BubbleMetaOverlay(settings.meta)),callback&&callback(this)})).src(_response.codes[0]),player.playlistSkip=function(ind){var that=this;settings.index=ind;var code=settings.codes.indexOf(ind);-1!=code&&(settings.index=code),player.src(settings.codes[ind]);var getPlaylist=that.el().getElementsByClassName("vjs-s3bubble-playlist-lazy");if(getPlaylist){var i,playlistChildren=getPlaylist[0].childNodes;for(i=0;i<playlistChildren.length;i++)parseInt(playlistChildren[i].getAttribute("id"))===parseInt(settings.index)?s3bubbleHelpers.addClass(playlistChildren[i],"vjs-selected"):s3bubbleHelpers.removeClass(playlistChildren[i],"vjs-selected")}that.s3BubbleMetaOverlay(settings.codes[ind].meta),that.play()},player.on("ended",function(){})}):console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: Codes is a required option")},s3bubble.live=function(options,callback){var settings,video,player,searchForOldPlayers=document.querySelector("#"+div);if(null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),options.hasOwnProperty("stream")){var getPlayerDiv=document.getElementById(div);null!==getPlayerDiv?s3bubbleHelpers.getData({uri:"stream",code:options.stream},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),(player=videojs("aws-player")).errorsPlugin(),void player.error({code:7,message:_response.message});var protocol=(settings=s3bubbleHelpers.extend(_response,options)).source.protocol,address=settings.source.address,stream=settings.source.stream;settings.source.streamer;window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create",settings.options.googleUaCode,"auto","s3bubble"),ga("s3bubble.send","pageview"),ga("s3bubble.send","event","s3bubble.live","video.code",settings.options.stream),ga("s3bubble.send","event","s3bubble.live","video.title",s3bubbleHelpers.s3bubbleCleanFilename(settings.meta.title)),(video=document.createElement("video")).id=div+"-player",settings.options.background?video.className="video-js vjs-s3bubble-background":video.className="video-js vjs-default-skin vjs-16-9 "+(settings.options.fluid?"vjs-s3bubble-fullscreen ":" "),video.poster=settings.source.poster,video.controls=settings.options.controls,video.muted=settings.options.muted,video.preload=settings.options.preload,video.addEventListener("contextmenu",function(e){e.preventDefault()},!1),video.crossorigin="anonymous",getPlayerDiv.appendChild(video),s3bubbleHelpers.swipedetect(getPlayerDiv,function(swipedir){"right"===swipedir&&window.history.back()}),(player=videojs(div+"-player",{autoplay:settings.options.autoplay,nativeControlsForTouch:!1,plugins:{chromecast:{appId:settings.options.hasOwnProperty("chromecast")?settings.options.chromecast:"E14DC85B"}}},function(){var removeProgress=this.el().getElementsByClassName("vjs-progress-control")[0];removeProgress.style.opacity="0",this.el().getElementsByClassName("vjs-remaining-time-display")[0].innerHTML="LIVE";var remainingTime=this.el().getElementsByClassName("vjs-remaining-time")[0];removeProgress.parentNode.insertBefore(remainingTime,removeProgress),this.brandPlugin(settings.brand),this.airplayPlugin(),this.ga({code:stream}),callback&&callback(this)})).src({type:"application/x-mpegURL",src:protocol+"://"+address+"/hls/"+stream+".m3u8"}),player.errorsPlugin();var startEvent=settings.options.autoplay?"loadedmetadata":"click";(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(startEvent="touchend"),player.one(startEvent,function(_event){this.vPaidPlugin(div+"-player",settings)}),player.one("loadstart",function(){this.s3BubbleMetaOverlay(settings.meta)});var last_value=0,offline_test=0;player.on("timeupdate",function(){this.currentTime()===last_value?(offline_test>3&&(this.userActive(!0),this.el().getElementsByClassName("vjs-live-display")[0].innerHTML="OFFLINE",offline_test=0),offline_test++):(offline_test=0,this.el().getElementsByClassName("vjs-live-display")[0].innerHTML="LIVE: HLS"),last_value=this.currentTime()})}):console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: No address was sent")},s3bubble}void 0===window.HTMLVideoElement&&(document.createElement("video"),document.createElement("audio"),document.createElement("track")),function(root,factory){"use strict";"function"==typeof define&&define.amd?define(factory):"object"==typeof exports?module.exports=factory():root.returnExports=factory()}(this,function(){var isCallable,$Array=Array,ArrayPrototype=$Array.prototype,$Object=Object,ObjectPrototype=$Object.prototype,FunctionPrototype=Function.prototype,$String=String,StringPrototype=$String.prototype,$Number=Number,NumberPrototype=$Number.prototype,array_slice=ArrayPrototype.slice,array_splice=ArrayPrototype.splice,array_push=ArrayPrototype.push,array_unshift=ArrayPrototype.unshift,array_concat=ArrayPrototype.concat,call=FunctionPrototype.call,apply=FunctionPrototype.apply,max=Math.max,min=Math.min,to_string=ObjectPrototype.toString,hasToStringTag="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,fnToStr=Function.prototype.toString,tryFunctionObject=function(value){try{return fnToStr.call(value),!0}catch(e){return!1}};isCallable=function(value){if("function"!=typeof value)return!1;if(hasToStringTag)return tryFunctionObject(value);var strClass=to_string.call(value);return"[object Function]"===strClass||"[object GeneratorFunction]"===strClass};var isRegex,regexExec=RegExp.prototype.exec,tryRegexExec=function(value){try{return regexExec.call(value),!0}catch(e){return!1}};isRegex=function(value){return"object"==typeof value&&(hasToStringTag?tryRegexExec(value):"[object RegExp]"===to_string.call(value))};var isString,strValue=String.prototype.valueOf,tryStringObject=function(value){try{return strValue.call(value),!0}catch(e){return!1}};isString=function(value){return"string"==typeof value||"object"==typeof value&&(hasToStringTag?tryStringObject(value):"[object String]"===to_string.call(value))};var supportsDescriptors=$Object.defineProperty&&function(){try{var obj={};$Object.defineProperty(obj,"x",{enumerable:!1,value:obj});for(var _ in obj)return!1;return obj.x===obj}catch(e){return!1}}(),defineProperties=function(has){var defineProperty;return defineProperty=supportsDescriptors?function(object,name,method,forceAssign){!forceAssign&&name in object||$Object.defineProperty(object,name,{configurable:!0,enumerable:!1,writable:!0,value:method})}:function(object,name,method,forceAssign){!forceAssign&&name in object||(object[name]=method)},function(object,map,forceAssign){for(var name in map)has.call(map,name)&&defineProperty(object,name,map[name],forceAssign)}}(ObjectPrototype.hasOwnProperty),isPrimitive=function(input){var type=typeof input;return null===input||"object"!==type&&"function"!==type},isActualNaN=$Number.isNaN||function(x){return x!==x},ES={ToInteger:function(num){var n=+num;return isActualNaN(n)?n=0:0!==n&&n!==1/0&&n!==-1/0&&(n=(n>0||-1)*Math.floor(Math.abs(n))),n},ToPrimitive:function(input){var val,valueOf,toStr;if(isPrimitive(input))return input;if(valueOf=input.valueOf,isCallable(valueOf)&&(val=valueOf.call(input),isPrimitive(val)))return val;if(toStr=input.toString,isCallable(toStr)&&(val=toStr.call(input),isPrimitive(val)))return val;throw new TypeError},ToObject:function(o){if(null==o)throw new TypeError("can't convert "+o+" to object");return $Object(o)},ToUint32:function(x){return x>>>0}},Empty=function(){};defineProperties(FunctionPrototype,{bind:function(that){var target=this;if(!isCallable(target))throw new TypeError("Function.prototype.bind called on incompatible "+target);for(var bound,args=array_slice.call(arguments,1),boundLength=max(0,target.length-args.length),boundArgs=[],i=0;i<boundLength;i++)array_push.call(boundArgs,"$"+i);return bound=Function("binder","return function ("+boundArgs.join(",")+"){ return binder.apply(this, arguments); }")(function(){if(this instanceof bound){var result=target.apply(this,array_concat.call(args,array_slice.call(arguments)));return $Object(result)===result?result:this}return target.apply(that,array_concat.call(args,array_slice.call(arguments)))}),target.prototype&&(Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null),bound}});var owns=call.bind(ObjectPrototype.hasOwnProperty),toStr=call.bind(ObjectPrototype.toString),arraySlice=call.bind(array_slice),arraySliceApply=apply.bind(array_slice),strSlice=call.bind(StringPrototype.slice),strSplit=call.bind(StringPrototype.split),strIndexOf=call.bind(StringPrototype.indexOf),pushCall=call.bind(array_push),isEnum=call.bind(ObjectPrototype.propertyIsEnumerable),arraySort=call.bind(ArrayPrototype.sort),isArray=$Array.isArray||function(obj){return"[object Array]"===toStr(obj)},hasUnshiftReturnValueBug=1!==[].unshift(0);defineProperties(ArrayPrototype,{unshift:function(){return array_unshift.apply(this,arguments),this.length}},hasUnshiftReturnValueBug),defineProperties($Array,{isArray:isArray});var boxedString=$Object("a"),splitString="a"!==boxedString[0]||!(0 in boxedString),properlyBoxesContext=function(method){var properlyBoxesNonStrict=!0,properlyBoxesStrict=!0,threwException=!1;if(method)try{method.call("foo",function(_,__,context){"object"!=typeof context&&(properlyBoxesNonStrict=!1)}),method.call([1],function(){"use strict";properlyBoxesStrict="string"==typeof this},"x")}catch(e){threwException=!0}return!!method&&!threwException&&properlyBoxesNonStrict&&properlyBoxesStrict};defineProperties(ArrayPrototype,{forEach:function(callbackfn){var T,object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,i=-1,length=ES.ToUint32(self.length);if(arguments.length>1&&(T=arguments[1]),!isCallable(callbackfn))throw new TypeError("Array.prototype.forEach callback must be a function");for(;++i<length;)i in self&&(void 0===T?callbackfn(self[i],i,object):callbackfn.call(T,self[i],i,object))}},!properlyBoxesContext(ArrayPrototype.forEach)),defineProperties(ArrayPrototype,{map:function(callbackfn){var T,object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length),result=$Array(length);if(arguments.length>1&&(T=arguments[1]),!isCallable(callbackfn))throw new TypeError("Array.prototype.map callback must be a function");for(var i=0;i<length;i++)i in self&&(result[i]=void 0===T?callbackfn(self[i],i,object):callbackfn.call(T,self[i],i,object));return result}},!properlyBoxesContext(ArrayPrototype.map)),defineProperties(ArrayPrototype,{filter:function(callbackfn){var value,T,object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length),result=[];if(arguments.length>1&&(T=arguments[1]),!isCallable(callbackfn))throw new TypeError("Array.prototype.filter callback must be a function");for(var i=0;i<length;i++)i in self&&(value=self[i],(void 0===T?callbackfn(value,i,object):callbackfn.call(T,value,i,object))&&pushCall(result,value));return result}},!properlyBoxesContext(ArrayPrototype.filter)),defineProperties(ArrayPrototype,{every:function(callbackfn){var T,object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length);if(arguments.length>1&&(T=arguments[1]),!isCallable(callbackfn))throw new TypeError("Array.prototype.every callback must be a function");for(var i=0;i<length;i++)if(i in self&&!(void 0===T?callbackfn(self[i],i,object):callbackfn.call(T,self[i],i,object)))return!1;return!0}},!properlyBoxesContext(ArrayPrototype.every)),defineProperties(ArrayPrototype,{some:function(callbackfn){var T,object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length);if(arguments.length>1&&(T=arguments[1]),!isCallable(callbackfn))throw new TypeError("Array.prototype.some callback must be a function");for(var i=0;i<length;i++)if(i in self&&(void 0===T?callbackfn(self[i],i,object):callbackfn.call(T,self[i],i,object)))return!0;return!1}},!properlyBoxesContext(ArrayPrototype.some));var reduceCoercesToObject=!1;ArrayPrototype.reduce&&(reduceCoercesToObject="object"==typeof ArrayPrototype.reduce.call("es5",function(_,__,___,list){return list})),defineProperties(ArrayPrototype,{reduce:function(callbackfn){var object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length);if(!isCallable(callbackfn))throw new TypeError("Array.prototype.reduce callback must be a function");if(0===length&&1===arguments.length)throw new TypeError("reduce of empty array with no initial value");var result,i=0;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError("reduce of empty array with no initial value")}for(;i<length;i++)i in self&&(result=callbackfn(result,self[i],i,object));return result}},!reduceCoercesToObject);var reduceRightCoercesToObject=!1;ArrayPrototype.reduceRight&&(reduceRightCoercesToObject="object"==typeof ArrayPrototype.reduceRight.call("es5",function(_,__,___,list){return list})),defineProperties(ArrayPrototype,{reduceRight:function(callbackfn){var object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length);if(!isCallable(callbackfn))throw new TypeError("Array.prototype.reduceRight callback must be a function");if(0===length&&1===arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i--];break}if(--i<0)throw new TypeError("reduceRight of empty array with no initial value")}if(i<0)return result;do{i in self&&(result=callbackfn(result,self[i],i,object))}while(i--);return result}},!reduceRightCoercesToObject);var hasFirefox2IndexOfBug=ArrayPrototype.indexOf&&-1!==[0,1].indexOf(1,2);defineProperties(ArrayPrototype,{indexOf:function(searchElement){var self=splitString&&isString(this)?strSplit(this,""):ES.ToObject(this),length=ES.ToUint32(self.length);if(0===length)return-1;var i=0;for(arguments.length>1&&(i=ES.ToInteger(arguments[1])),i=i>=0?i:max(0,length+i);i<length;i++)if(i in self&&self[i]===searchElement)return i;return-1}},hasFirefox2IndexOfBug);var hasFirefox2LastIndexOfBug=ArrayPrototype.lastIndexOf&&-1!==[0,1].lastIndexOf(0,-3);defineProperties(ArrayPrototype,{lastIndexOf:function(searchElement){var self=splitString&&isString(this)?strSplit(this,""):ES.ToObject(this),length=ES.ToUint32(self.length);if(0===length)return-1;var i=length-1;for(arguments.length>1&&(i=min(i,ES.ToInteger(arguments[1]))),i=i>=0?i:length-Math.abs(i);i>=0;i--)if(i in self&&searchElement===self[i])return i;return-1}},hasFirefox2LastIndexOfBug);var spliceNoopReturnsEmptyArray=function(){var a=[1,2],result=a.splice();return 2===a.length&&isArray(result)&&0===result.length}();defineProperties(ArrayPrototype,{splice:function(start,deleteCount){return 0===arguments.length?[]:array_splice.apply(this,arguments)}},!spliceNoopReturnsEmptyArray);var spliceWorksWithEmptyObject=function(){var obj={};return ArrayPrototype.splice.call(obj,0,0,1),1===obj.length}();defineProperties(ArrayPrototype,{splice:function(start,deleteCount){if(0===arguments.length)return[];var args=arguments;return this.length=max(ES.ToInteger(this.length),0),arguments.length>0&&"number"!=typeof deleteCount&&((args=arraySlice(arguments)).length<2?pushCall(args,this.length-start):args[1]=ES.ToInteger(deleteCount)),array_splice.apply(this,args)}},!spliceWorksWithEmptyObject);var spliceWorksWithLargeSparseArrays=function(){var arr=new $Array(1e5);return arr[8]="x",arr.splice(1,1),7===arr.indexOf("x")}(),spliceWorksWithSmallSparseArrays=function(){var arr=[];return arr[256]="a",arr.splice(257,0,"b"),"a"===arr[256]}();defineProperties(ArrayPrototype,{splice:function(start,deleteCount){for(var from,O=ES.ToObject(this),A=[],len=ES.ToUint32(O.length),relativeStart=ES.ToInteger(start),actualStart=relativeStart<0?max(len+relativeStart,0):min(relativeStart,len),actualDeleteCount=min(max(ES.ToInteger(deleteCount),0),len-actualStart),k=0;k<actualDeleteCount;)from=$String(actualStart+k),owns(O,from)&&(A[k]=O[from]),k+=1;var to,items=arraySlice(arguments,2),itemCount=items.length;if(itemCount<actualDeleteCount){for(k=actualStart;k<len-actualDeleteCount;)from=$String(k+actualDeleteCount),to=$String(k+itemCount),owns(O,from)?O[to]=O[from]:delete O[to],k+=1;for(k=len;k>len-actualDeleteCount+itemCount;)delete O[k-1],k-=1}else if(itemCount>actualDeleteCount)for(k=len-actualDeleteCount;k>actualStart;)from=$String(k+actualDeleteCount-1),to=$String(k+itemCount-1),owns(O,from)?O[to]=O[from]:delete O[to],k-=1;k=actualStart;for(var i=0;i<items.length;++i)O[k]=items[i],k+=1;return O.length=len-actualDeleteCount+itemCount,A}},!spliceWorksWithLargeSparseArrays||!spliceWorksWithSmallSparseArrays);var hasStringJoinBug,originalJoin=ArrayPrototype.join;try{hasStringJoinBug="1,2,3"!==Array.prototype.join.call("123",",")}catch(e){hasStringJoinBug=!0}hasStringJoinBug&&defineProperties(ArrayPrototype,{join:function(separator){var sep=void 0===separator?",":separator;return originalJoin.call(isString(this)?strSplit(this,""):this,sep)}},hasStringJoinBug);var hasJoinUndefinedBug="1,2"!==[1,2].join(void 0);hasJoinUndefinedBug&&defineProperties(ArrayPrototype,{join:function(separator){var sep=void 0===separator?",":separator;return originalJoin.call(this,sep)}},hasJoinUndefinedBug);var pushShim=function(item){for(var O=ES.ToObject(this),n=ES.ToUint32(O.length),i=0;i<arguments.length;)O[n+i]=arguments[i],i+=1;return O.length=n+i,n+i},pushIsNotGeneric=function(){var obj={};return 1!==Array.prototype.push.call(obj,void 0)||1!==obj.length||void 0!==obj[0]||!owns(obj,0)}();defineProperties(ArrayPrototype,{push:function(item){return isArray(this)?array_push.apply(this,arguments):pushShim.apply(this,arguments)}},pushIsNotGeneric);var pushUndefinedIsWeird=function(){var arr=[];return 1!==arr.push(void 0)||1!==arr.length||void 0!==arr[0]||!owns(arr,0)}();defineProperties(ArrayPrototype,{push:pushShim},pushUndefinedIsWeird),defineProperties(ArrayPrototype,{slice:function(start,end){var arr=isString(this)?strSplit(this,""):this;return arraySliceApply(arr,arguments)}},splitString);var sortIgnoresNonFunctions=function(){try{return[1,2].sort(null),[1,2].sort({}),!0}catch(e){}return!1}(),sortThrowsOnRegex=function(){try{return[1,2].sort(/a/),!1}catch(e){}return!0}(),sortIgnoresUndefined=function(){try{return[1,2].sort(void 0),!0}catch(e){}return!1}();defineProperties(ArrayPrototype,{sort:function(compareFn){if(void 0===compareFn)return arraySort(this);if(!isCallable(compareFn))throw new TypeError("Array.prototype.sort callback must be a function");return arraySort(this,compareFn)}},sortIgnoresNonFunctions||!sortIgnoresUndefined||!sortThrowsOnRegex);var hasDontEnumBug=!{toString:null}.propertyIsEnumerable("toString"),hasProtoEnumBug=function(){}.propertyIsEnumerable("prototype"),hasStringEnumBug=!owns("x","0"),equalsConstructorPrototype=function(o){var ctor=o.constructor;return ctor&&ctor.prototype===o},blacklistedKeys={$window:!0,$console:!0,$parent:!0,$self:!0,$frame:!0,$frames:!0,$frameElement:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$external:!0},hasAutomationEqualityBug=function(){if("undefined"==typeof window)return!1;for(var k in window)try{!blacklistedKeys["$"+k]&&owns(window,k)&&null!==window[k]&&"object"==typeof window[k]&&equalsConstructorPrototype(window[k])}catch(e){return!0}return!1}(),equalsConstructorPrototypeIfNotBuggy=function(object){if("undefined"==typeof window||!hasAutomationEqualityBug)return equalsConstructorPrototype(object);try{return equalsConstructorPrototype(object)}catch(e){return!1}},dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length,isStandardArguments=function(value){return"[object Arguments]"===toStr(value)},isArguments=isStandardArguments(arguments)?isStandardArguments:function(value){return null!==value&&"object"==typeof value&&"number"==typeof value.length&&value.length>=0&&!isArray(value)&&isCallable(value.callee)};defineProperties($Object,{keys:function(object){var isFn=isCallable(object),isArgs=isArguments(object),isObject=null!==object&&"object"==typeof object,isStr=isObject&&isString(object);if(!isObject&&!isFn&&!isArgs)throw new TypeError("Object.keys called on a non-object");var theKeys=[],skipProto=hasProtoEnumBug&&isFn;if(isStr&&hasStringEnumBug||isArgs)for(var i=0;i<object.length;++i)pushCall(theKeys,$String(i));if(!isArgs)for(var name in object)skipProto&&"prototype"===name||!owns(object,name)||pushCall(theKeys,$String(name));if(hasDontEnumBug)for(var skipConstructor=equalsConstructorPrototypeIfNotBuggy(object),j=0;j<dontEnumsLength;j++){var dontEnum=dontEnums[j];skipConstructor&&"constructor"===dontEnum||!owns(object,dontEnum)||pushCall(theKeys,dontEnum)}return theKeys}});var keysWorksWithArguments=$Object.keys&&function(){return 2===$Object.keys(arguments).length}(1,2),keysHasArgumentsLengthBug=$Object.keys&&function(){var argKeys=$Object.keys(arguments);return 1!==arguments.length||1!==argKeys.length||1!==argKeys[0]}(1),originalKeys=$Object.keys;defineProperties($Object,{keys:function(object){return originalKeys(isArguments(object)?arraySlice(object):object)}},!keysWorksWithArguments||keysHasArgumentsLengthBug);var hasToDateStringFormatBug,hasToStringFormatBug,hasNegativeMonthYearBug=0!==new Date(-0xc782b5b342b24).getUTCMonth(),aNegativeTestDate=new Date(-0x55d318d56a724),aPositiveTestDate=new Date(14496624e5),hasToUTCStringFormatBug="Mon, 01 Jan -45875 11:59:59 GMT"!==aNegativeTestDate.toUTCString();aNegativeTestDate.getTimezoneOffset()<-720?(hasToDateStringFormatBug="Tue Jan 02 -45875"!==aNegativeTestDate.toDateString(),hasToStringFormatBug=!/^Thu Dec 10 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/.test(aPositiveTestDate.toString())):(hasToDateStringFormatBug="Mon Jan 01 -45875"!==aNegativeTestDate.toDateString(),hasToStringFormatBug=!/^Wed Dec 09 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/.test(aPositiveTestDate.toString()));var originalGetFullYear=call.bind(Date.prototype.getFullYear),originalGetMonth=call.bind(Date.prototype.getMonth),originalGetDate=call.bind(Date.prototype.getDate),originalGetUTCFullYear=call.bind(Date.prototype.getUTCFullYear),originalGetUTCMonth=call.bind(Date.prototype.getUTCMonth),originalGetUTCDate=call.bind(Date.prototype.getUTCDate),originalGetUTCDay=call.bind(Date.prototype.getUTCDay),originalGetUTCHours=call.bind(Date.prototype.getUTCHours),originalGetUTCMinutes=call.bind(Date.prototype.getUTCMinutes),originalGetUTCSeconds=call.bind(Date.prototype.getUTCSeconds),originalGetUTCMilliseconds=call.bind(Date.prototype.getUTCMilliseconds),dayName=["Sun","Mon","Tue","Wed","Thu","Fri"],monthName=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],daysInMonth=function(month,year){return originalGetDate(new Date(year,month,0))};defineProperties(Date.prototype,{getFullYear:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetFullYear(this);return year<0&&originalGetMonth(this)>11?year+1:year},getMonth:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetFullYear(this),month=originalGetMonth(this);return year<0&&month>11?0:month},getDate:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetFullYear(this),month=originalGetMonth(this),date=originalGetDate(this);return year<0&&month>11?12===month?date:daysInMonth(0,year+1)-date+1:date},getUTCFullYear:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetUTCFullYear(this);return year<0&&originalGetUTCMonth(this)>11?year+1:year},getUTCMonth:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetUTCFullYear(this),month=originalGetUTCMonth(this);return year<0&&month>11?0:month},getUTCDate:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetUTCFullYear(this),month=originalGetUTCMonth(this),date=originalGetUTCDate(this);return year<0&&month>11?12===month?date:daysInMonth(0,year+1)-date+1:date}},hasNegativeMonthYearBug),defineProperties(Date.prototype,{toUTCString:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var day=originalGetUTCDay(this),date=originalGetUTCDate(this),month=originalGetUTCMonth(this),year=originalGetUTCFullYear(this),hour=originalGetUTCHours(this),minute=originalGetUTCMinutes(this),second=originalGetUTCSeconds(this);return dayName[day]+", "+(date<10?"0"+date:date)+" "+monthName[month]+" "+year+" "+(hour<10?"0"+hour:hour)+":"+(minute<10?"0"+minute:minute)+":"+(second<10?"0"+second:second)+" GMT"}},hasNegativeMonthYearBug||hasToUTCStringFormatBug),defineProperties(Date.prototype,{toDateString:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var day=this.getDay(),date=this.getDate(),month=this.getMonth(),year=this.getFullYear();return dayName[day]+" "+monthName[month]+" "+(date<10?"0"+date:date)+" "+year}},hasNegativeMonthYearBug||hasToDateStringFormatBug),(hasNegativeMonthYearBug||hasToStringFormatBug)&&(Date.prototype.toString=function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var day=this.getDay(),date=this.getDate(),month=this.getMonth(),year=this.getFullYear(),hour=this.getHours(),minute=this.getMinutes(),second=this.getSeconds(),timezoneOffset=this.getTimezoneOffset(),hoursOffset=Math.floor(Math.abs(timezoneOffset)/60),minutesOffset=Math.floor(Math.abs(timezoneOffset)%60);return dayName[day]+" "+monthName[month]+" "+(date<10?"0"+date:date)+" "+year+" "+(hour<10?"0"+hour:hour)+":"+(minute<10?"0"+minute:minute)+":"+(second<10?"0"+second:second)+" GMT"+(timezoneOffset>0?"-":"+")+(hoursOffset<10?"0"+hoursOffset:hoursOffset)+(minutesOffset<10?"0"+minutesOffset:minutesOffset)},supportsDescriptors&&$Object.defineProperty(Date.prototype,"toString",{configurable:!0,enumerable:!1,writable:!0}));var hasNegativeDateBug=Date.prototype.toISOString&&-1===new Date(-621987552e5).toISOString().indexOf("-000001"),hasSafari51DateBug=Date.prototype.toISOString&&"1969-12-31T23:59:59.999Z"!==new Date(-1).toISOString();defineProperties(Date.prototype,{toISOString:function(){if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");var year=originalGetUTCFullYear(this),month=originalGetUTCMonth(this);year+=Math.floor(month/12);var result=[(month=(month%12+12)%12)+1,originalGetUTCDate(this),originalGetUTCHours(this),originalGetUTCMinutes(this),originalGetUTCSeconds(this)];year=(year<0?"-":year>9999?"+":"")+strSlice("00000"+Math.abs(year),0<=year&&year<=9999?-4:-6);for(var i=0;i<result.length;++i)result[i]=strSlice("00"+result[i],-2);return year+"-"+arraySlice(result,0,2).join("-")+"T"+arraySlice(result,2).join(":")+"."+strSlice("000"+originalGetUTCMilliseconds(this),-3)+"Z"}},hasNegativeDateBug||hasSafari51DateBug),function(){try{return Date.prototype.toJSON&&null===new Date(NaN).toJSON()&&-1!==new Date(-621987552e5).toJSON().indexOf("-000001")&&Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(e){return!1}}()||(Date.prototype.toJSON=function(key){var O=$Object(this),tv=ES.ToPrimitive(O);if("number"==typeof tv&&!isFinite(tv))return null;var toISO=O.toISOString;if(!isCallable(toISO))throw new TypeError("toISOString property is not callable");return toISO.call(O)});var supportsExtendedYears=1e15===Date.parse("+033658-09-27T01:46:40.000Z"),acceptsInvalidDates=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z"))||!isNaN(Date.parse("2012-12-31T23:59:60.000Z"));if(isNaN(Date.parse("2000-01-01T00:00:00.000Z"))||acceptsInvalidDates||!supportsExtendedYears){var maxSafeUnsigned32Bit=Math.pow(2,31)-1,hasSafariSignedIntBug=isActualNaN(new Date(1970,0,1,0,0,0,maxSafeUnsigned32Bit+1).getTime());Date=function(NativeDate){var DateShim=function(Y,M,D,h,m,s,ms){var date,length=arguments.length;if(this instanceof NativeDate){var seconds=s,millis=ms;if(hasSafariSignedIntBug&&length>=7&&ms>maxSafeUnsigned32Bit){var msToShift=Math.floor(ms/maxSafeUnsigned32Bit)*maxSafeUnsigned32Bit,sToShift=Math.floor(msToShift/1e3);seconds+=sToShift,millis-=1e3*sToShift}date=1===length&&$String(Y)===Y?new NativeDate(DateShim.parse(Y)):length>=7?new NativeDate(Y,M,D,h,m,seconds,millis):length>=6?new NativeDate(Y,M,D,h,m,seconds):length>=5?new NativeDate(Y,M,D,h,m):length>=4?new NativeDate(Y,M,D,h):length>=3?new NativeDate(Y,M,D):length>=2?new NativeDate(Y,M):length>=1?new NativeDate(Y):new NativeDate}else date=NativeDate.apply(this,arguments);return isPrimitive(date)||defineProperties(date,{constructor:DateShim},!0),date},isoDateExpression=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),months=[0,31,59,90,120,151,181,212,243,273,304,334,365],dayFromMonth=function(year,month){var t=month>1?1:0;return months[month]+Math.floor((year-1969+t)/4)-Math.floor((year-1901+t)/100)+Math.floor((year-1601+t)/400)+365*(year-1970)},toUTC=function(t){var s=0,ms=t;if(hasSafariSignedIntBug&&ms>maxSafeUnsigned32Bit){var msToShift=Math.floor(ms/maxSafeUnsigned32Bit)*maxSafeUnsigned32Bit,sToShift=Math.floor(msToShift/1e3);s+=sToShift,ms-=1e3*sToShift}return $Number(new NativeDate(1970,0,1,0,0,s,ms))};for(var key in NativeDate)owns(NativeDate,key)&&(DateShim[key]=NativeDate[key]);defineProperties(DateShim,{now:NativeDate.now,UTC:NativeDate.UTC},!0),DateShim.prototype=NativeDate.prototype,defineProperties(DateShim.prototype,{constructor:DateShim},!0);return defineProperties(DateShim,{parse:function(string){var match=isoDateExpression.exec(string);if(match){var result,year=$Number(match[1]),month=$Number(match[2]||1)-1,day=$Number(match[3]||1)-1,hour=$Number(match[4]||0),minute=$Number(match[5]||0),second=$Number(match[6]||0),millisecond=Math.floor(1e3*$Number(match[7]||0)),isLocalTime=Boolean(match[4]&&!match[8]),signOffset="-"===match[9]?1:-1,hourOffset=$Number(match[10]||0),minuteOffset=$Number(match[11]||0);return hour<(minute>0||second>0||millisecond>0?24:25)&&minute<60&&second<60&&millisecond<1e3&&month>-1&&month<12&&hourOffset<24&&minuteOffset<60&&day>-1&&day<dayFromMonth(year,month+1)-dayFromMonth(year,month)&&(result=60*(24*(dayFromMonth(year,month)+day)+hour+hourOffset*signOffset),result=1e3*(60*(result+minute+minuteOffset*signOffset)+second)+millisecond,isLocalTime&&(result=toUTC(result)),-864e13<=result&&result<=864e13)?result:NaN}return NativeDate.parse.apply(this,arguments)}}),DateShim}(Date)}Date.now||(Date.now=function(){return(new Date).getTime()});var hasToFixedBugs=NumberPrototype.toFixed&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0)),toFixedHelpers={base:1e7,size:6,data:[0,0,0,0,0,0],multiply:function(n,c){for(var i=-1,c2=c;++i<toFixedHelpers.size;)c2+=n*toFixedHelpers.data[i],toFixedHelpers.data[i]=c2%toFixedHelpers.base,c2=Math.floor(c2/toFixedHelpers.base)},divide:function(n){for(var i=toFixedHelpers.size,c=0;--i>=0;)c+=toFixedHelpers.data[i],toFixedHelpers.data[i]=Math.floor(c/n),c=c%n*toFixedHelpers.base},numToString:function(){for(var i=toFixedHelpers.size,s="";--i>=0;)if(""!==s||0===i||0!==toFixedHelpers.data[i]){var t=$String(toFixedHelpers.data[i]);""===s?s=t:s+=strSlice("0000000",0,7-t.length)+t}return s},pow:function pow(x,n,acc){return 0===n?acc:n%2==1?pow(x,n-1,acc*x):pow(x*x,n/2,acc)},log:function(x){for(var n=0,x2=x;x2>=4096;)n+=12,x2/=4096;for(;x2>=2;)n+=1,x2/=2;return n}};defineProperties(NumberPrototype,{toFixed:function(fractionDigits){var f,x,s,m,e,z,j,k;if(f=$Number(fractionDigits),(f=isActualNaN(f)?0:Math.floor(f))<0||f>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(x=$Number(this),isActualNaN(x))return"NaN";if(x<=-1e21||x>=1e21)return $String(x);if(s="",x<0&&(s="-",x=-x),m="0",x>1e-21)if(e=toFixedHelpers.log(x*toFixedHelpers.pow(2,69,1))-69,z=e<0?x*toFixedHelpers.pow(2,-e,1):x/toFixedHelpers.pow(2,e,1),z*=4503599627370496,(e=52-e)>0){for(toFixedHelpers.multiply(0,z),j=f;j>=7;)toFixedHelpers.multiply(1e7,0),j-=7;for(toFixedHelpers.multiply(toFixedHelpers.pow(10,j,1),0),j=e-1;j>=23;)toFixedHelpers.divide(1<<23),j-=23;toFixedHelpers.divide(1<<j),toFixedHelpers.multiply(1,1),toFixedHelpers.divide(2),m=toFixedHelpers.numToString()}else toFixedHelpers.multiply(0,z),toFixedHelpers.multiply(1<<-e,0),m=toFixedHelpers.numToString()+strSlice("0.00000000000000000000",2,2+f);return m=f>0?(k=m.length)<=f?s+strSlice("0.0000000000000000000",0,f-k+2)+m:s+strSlice(m,0,k-f)+"."+strSlice(m,k-f):s+m}},hasToFixedBugs);var hasToPrecisionUndefinedBug=function(){try{return"1"===1..toPrecision(void 0)}catch(e){return!0}}(),originalToPrecision=NumberPrototype.toPrecision;defineProperties(NumberPrototype,{toPrecision:function(precision){return void 0===precision?originalToPrecision.call(this):originalToPrecision.call(this,precision)}},hasToPrecisionUndefinedBug),2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?function(){var compliantExecNpcg=void 0===/()??/.exec("")[1],maxSafe32BitInt=Math.pow(2,32)-1;StringPrototype.split=function(separator,limit){var string=String(this);if(void 0===separator&&0===limit)return[];if(!isRegex(separator))return strSplit(this,separator,limit);var separator2,match,lastIndex,lastLength,output=[],flags=(separator.ignoreCase?"i":"")+(separator.multiline?"m":"")+(separator.unicode?"u":"")+(separator.sticky?"y":""),lastLastIndex=0,separatorCopy=new RegExp(separator.source,flags+"g");compliantExecNpcg||(separator2=new RegExp("^"+separatorCopy.source+"$(?!\\s)",flags));var splitLimit=void 0===limit?maxSafe32BitInt:ES.ToUint32(limit);for(match=separatorCopy.exec(string);match&&!((lastIndex=match.index+match[0].length)>lastLastIndex&&(pushCall(output,strSlice(string,lastLastIndex,match.index)),!compliantExecNpcg&&match.length>1&&match[0].replace(separator2,function(){for(var i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(match[i]=void 0)}),match.length>1&&match.index<string.length&&array_push.apply(output,arraySlice(match,1)),lastLength=match[0].length,lastLastIndex=lastIndex,output.length>=splitLimit));)separatorCopy.lastIndex===match.index&&separatorCopy.lastIndex++,match=separatorCopy.exec(string);return lastLastIndex===string.length?!lastLength&&separatorCopy.test("")||pushCall(output,""):pushCall(output,strSlice(string,lastLastIndex)),output.length>splitLimit?strSlice(output,0,splitLimit):output}}():"0".split(void 0,0).length&&(StringPrototype.split=function(separator,limit){return void 0===separator&&0===limit?[]:strSplit(this,separator,limit)});var str_replace=StringPrototype.replace;(function(){var groups=[];return"x".replace(/x(.)?/g,function(match,group){pushCall(groups,group)}),1===groups.length&&void 0===groups[0]})()||(StringPrototype.replace=function(searchValue,replaceValue){var isFn=isCallable(replaceValue),hasCapturingGroups=isRegex(searchValue)&&/\)[*?]/.test(searchValue.source);if(isFn&&hasCapturingGroups){return str_replace.call(this,searchValue,function(match){var length=arguments.length,originalLastIndex=searchValue.lastIndex;searchValue.lastIndex=0;var args=searchValue.exec(match)||[];return searchValue.lastIndex=originalLastIndex,pushCall(args,arguments[length-2],arguments[length-1]),replaceValue.apply(this,args)})}return str_replace.call(this,searchValue,replaceValue)});var string_substr=StringPrototype.substr,hasNegativeSubstrBug="".substr&&"b"!=="0b".substr(-1);defineProperties(StringPrototype,{substr:function(start,length){var normalizedStart=start;return start<0&&(normalizedStart=max(this.length+start,0)),string_substr.call(this,normalizedStart,length)}},hasNegativeSubstrBug);var ws="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff",wsRegexChars="["+ws+"]",trimBeginRegexp=new RegExp("^"+wsRegexChars+wsRegexChars+"*"),trimEndRegexp=new RegExp(wsRegexChars+wsRegexChars+"*$"),hasTrimWhitespaceBug=StringPrototype.trim&&(ws.trim()||!"​".trim());defineProperties(StringPrototype,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return $String(this).replace(trimBeginRegexp,"").replace(trimEndRegexp,"")}},hasTrimWhitespaceBug);var trim=call.bind(String.prototype.trim),hasLastIndexBug=StringPrototype.lastIndexOf&&-1!=="abcあい".lastIndexOf("あい",2);defineProperties(StringPrototype,{lastIndexOf:function(searchString){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");for(var S=$String(this),searchStr=$String(searchString),numPos=arguments.length>1?$Number(arguments[1]):NaN,pos=isActualNaN(numPos)?1/0:ES.ToInteger(numPos),start=min(max(pos,0),S.length),searchLen=searchStr.length,k=start+searchLen;k>0;){k=max(0,k-searchLen);var index=strIndexOf(strSlice(S,k,start+searchLen),searchStr);if(-1!==index)return k+index}return-1}},hasLastIndexBug);var originalLastIndexOf=StringPrototype.lastIndexOf;if(defineProperties(StringPrototype,{lastIndexOf:function(searchString){return originalLastIndexOf.apply(this,arguments)}},1!==StringPrototype.lastIndexOf.length),8===parseInt(ws+"08")&&22===parseInt(ws+"0x16")||(parseInt=function(origParseInt){var hexRegex=/^[\-+]?0[xX]/;return function(str,radix){var string=trim(str),defaultedRadix=$Number(radix)||(hexRegex.test(string)?16:10);return origParseInt(string,defaultedRadix)}}(parseInt)),1/parseFloat("-0")!=-1/0&&(parseFloat=function(origParseFloat){return function(string){var inputString=trim(string),result=origParseFloat(inputString);return 0===result&&"-"===strSlice(inputString,0,1)?-0:result}}(parseFloat)),"RangeError: test"!==String(new RangeError("test"))){Error.prototype.toString=function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");var name=this.name;void 0===name?name="Error":"string"!=typeof name&&(name=$String(name));var msg=this.message;return void 0===msg?msg="":"string"!=typeof msg&&(msg=$String(msg)),name?msg?name+": "+msg:name:msg}}if(supportsDescriptors){var ensureNonEnumerable=function(obj,prop){if(isEnum(obj,prop)){var desc=Object.getOwnPropertyDescriptor(obj,prop);desc.enumerable=!1,Object.defineProperty(obj,prop,desc)}};ensureNonEnumerable(Error.prototype,"message"),""!==Error.prototype.message&&(Error.prototype.message=""),ensureNonEnumerable(Error.prototype,"name")}if("/a/gim"!==String(/a/gim)){RegExp.prototype.toString=function(){var str="/"+this.source+"/";return this.global&&(str+="g"),this.ignoreCase&&(str+="i"),this.multiline&&(str+="m"),str}}}),function(root,factory){"use strict";"function"==typeof define&&define.amd?define(factory):"object"==typeof exports?module.exports=factory():root.returnExports=factory()}(this,function(){var defineGetter,defineSetter,lookupGetter,lookupSetter,call=Function.call,prototypeOfObject=Object.prototype,owns=call.bind(prototypeOfObject.hasOwnProperty),isEnumerable=call.bind(prototypeOfObject.propertyIsEnumerable),toStr=call.bind(prototypeOfObject.toString),supportsAccessors=owns(prototypeOfObject,"__defineGetter__");supportsAccessors&&(defineGetter=call.bind(prototypeOfObject.__defineGetter__),defineSetter=call.bind(prototypeOfObject.__defineSetter__),lookupGetter=call.bind(prototypeOfObject.__lookupGetter__),lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)),Object.getPrototypeOf||(Object.getPrototypeOf=function(object){var proto=object.__proto__;return proto||null===proto?proto:"[object Function]"===toStr(object.constructor)?object.constructor.prototype:object instanceof Object?prototypeOfObject:null});var doesGetOwnPropertyDescriptorWork=function(object){try{return object.sentinel=0,0===Object.getOwnPropertyDescriptor(object,"sentinel").value}catch(exception){return!1}};if(Object.defineProperty){var getOwnPropertyDescriptorWorksOnObject=doesGetOwnPropertyDescriptorWork({});if(!("undefined"==typeof document||doesGetOwnPropertyDescriptorWork(document.createElement("div")))||!getOwnPropertyDescriptorWorksOnObject)var getOwnPropertyDescriptorFallback=Object.getOwnPropertyDescriptor}if(!Object.getOwnPropertyDescriptor||getOwnPropertyDescriptorFallback){Object.getOwnPropertyDescriptor=function(object,property){if("object"!=typeof object&&"function"!=typeof object||null===object)throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object: "+object);if(getOwnPropertyDescriptorFallback)try{return getOwnPropertyDescriptorFallback.call(Object,object,property)}catch(exception){}var descriptor;if(!owns(object,property))return descriptor;if(descriptor={enumerable:isEnumerable(object,property),configurable:!0},supportsAccessors){var prototype=object.__proto__,notPrototypeOfObject=object!==prototypeOfObject;notPrototypeOfObject&&(object.__proto__=prototypeOfObject);var getter=lookupGetter(object,property),setter=lookupSetter(object,property);if(notPrototypeOfObject&&(object.__proto__=prototype),getter||setter)return getter&&(descriptor.get=getter),setter&&(descriptor.set=setter),descriptor}return descriptor.value=object[property],descriptor.writable=!0,descriptor}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(object){return Object.keys(object)}),!Object.create){var createEmpty,supportsProto=!({__proto__:null}instanceof Object),shouldUseActiveX=function(){if(!document.domain)return!1;try{return!!new ActiveXObject("htmlfile")}catch(exception){return!1}},getEmptyViaActiveX=function(){var empty,xDoc;return(xDoc=new ActiveXObject("htmlfile")).write("<script><\/script>"),xDoc.close(),empty=xDoc.parentWindow.Object.prototype,xDoc=null,empty},getEmptyViaIFrame=function(){var empty,iframe=document.createElement("iframe"),parent=document.body||document.documentElement;return iframe.style.display="none",parent.appendChild(iframe),iframe.src="javascript:",empty=iframe.contentWindow.Object.prototype,parent.removeChild(iframe),iframe=null,empty};createEmpty=supportsProto||"undefined"==typeof document?function(){return{__proto__:null}}:function(){var empty=shouldUseActiveX()?getEmptyViaActiveX():getEmptyViaIFrame();delete empty.constructor,delete empty.hasOwnProperty,delete empty.propertyIsEnumerable,delete empty.isPrototypeOf,delete empty.toLocaleString,delete empty.toString,delete empty.valueOf;var Empty=function(){};return Empty.prototype=empty,createEmpty=function(){return new Empty},new Empty},Object.create=function(prototype,properties){var object,Type=function(){};if(null===prototype)object=createEmpty();else{if("object"!=typeof prototype&&"function"!=typeof prototype)throw new TypeError("Object prototype may only be an Object or null");Type.prototype=prototype,(object=new Type).__proto__=prototype}return void 0!==properties&&Object.defineProperties(object,properties),object}}var doesDefinePropertyWork=function(object){try{return Object.defineProperty(object,"sentinel",{}),"sentinel"in object}catch(exception){return!1}};if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({}),definePropertyWorksOnDom="undefined"==typeof document||doesDefinePropertyWork(document.createElement("div"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom)var definePropertyFallback=Object.defineProperty,definePropertiesFallback=Object.defineProperties}if(!Object.defineProperty||definePropertyFallback){Object.defineProperty=function(object,property,descriptor){if("object"!=typeof object&&"function"!=typeof object||null===object)throw new TypeError("Object.defineProperty called on non-object: "+object);if("object"!=typeof descriptor&&"function"!=typeof descriptor||null===descriptor)throw new TypeError("Property description must be an object: "+descriptor);if(definePropertyFallback)try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}if("value"in descriptor)if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject,delete object[property],object[property]=descriptor.value,object.__proto__=prototype}else object[property]=descriptor.value;else{if(!supportsAccessors&&("get"in descriptor||"set"in descriptor))throw new TypeError("getters & setters can not be defined on this javascript engine");"get"in descriptor&&defineGetter(object,property,descriptor.get),"set"in descriptor&&defineSetter(object,property,descriptor.set)}return object}}Object.defineProperties&&!definePropertiesFallback||(Object.defineProperties=function(object,properties){if(definePropertiesFallback)try{return definePropertiesFallback.call(Object,object,properties)}catch(exception){}return Object.keys(properties).forEach(function(property){"__proto__"!==property&&Object.defineProperty(object,property,properties[property])}),object}),Object.seal||(Object.seal=function(object){if(Object(object)!==object)throw new TypeError("Object.seal can only be called on Objects.");return object}),Object.freeze||(Object.freeze=function(object){if(Object(object)!==object)throw new TypeError("Object.freeze can only be called on Objects.");return object});try{Object.freeze(function(){})}catch(exception){Object.freeze=function(freezeObject){return function(object){return"function"==typeof object?object:freezeObject(object)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(object){if(Object(object)!==object)throw new TypeError("Object.preventExtensions can only be called on Objects.");return object}),Object.isSealed||(Object.isSealed=function(object){if(Object(object)!==object)throw new TypeError("Object.isSealed can only be called on Objects.");return!1}),Object.isFrozen||(Object.isFrozen=function(object){if(Object(object)!==object)throw new TypeError("Object.isFrozen can only be called on Objects.");return!1}),Object.isExtensible||(Object.isExtensible=function(object){if(Object(object)!==object)throw new TypeError("Object.isExtensible can only be called on Objects.");for(var name="";owns(object,name);)name+="?";object[name]=!0;var returnValue=owns(object,name);return delete object[name],returnValue})}),function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).videojs=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _button2=_interopRequireDefault(_dereq_(2)),_component2=_interopRequireDefault(_dereq_(5)),BigPlayButton=function(_Button){function BigPlayButton(player,options){_classCallCheck(this,BigPlayButton);var _this=_possibleConstructorReturn(this,_Button.call(this,player,options));return _this.mouseused_=!1,_this.on("mousedown",_this.handleMouseDown),_this}return _inherits(BigPlayButton,_Button),BigPlayButton.prototype.buildCSSClass=function(){return"vjs-big-play-button"},BigPlayButton.prototype.handleClick=function(event){var playPromise=this.player_.play();if(!(this.mouseused_&&event.clientX&&event.clientY)){var cb=this.player_.getChild("controlBar"),playToggle=cb&&cb.getChild("playToggle");if(playToggle){var playFocus=function(){return playToggle.focus()};if(playPromise&&playPromise.then){playPromise.then(playFocus,function(){})}else this.setTimeout(playFocus,1)}else this.player_.focus()}},BigPlayButton.prototype.handleKeyPress=function(event){this.mouseused_=!1,_Button.prototype.handleKeyPress.call(this,event)},BigPlayButton.prototype.handleMouseDown=function(event){this.mouseused_=!0},BigPlayButton}(_button2.default);BigPlayButton.prototype.controlText_="Play Video",_component2.default.registerComponent("BigPlayButton",BigPlayButton),exports.default=BigPlayButton},{2:2,5:5}],2:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _clickableComponent2=_interopRequireDefault(_dereq_(3)),_component2=_interopRequireDefault(_dereq_(5)),_log2=_interopRequireDefault(_dereq_(86)),_obj=_dereq_(88),Button=function(_ClickableComponent){function Button(){return _classCallCheck(this,Button),_possibleConstructorReturn(this,_ClickableComponent.apply(this,arguments))}return _inherits(Button,_ClickableComponent),Button.prototype.createEl=function(){var tag=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"button",props=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};props=(0,_obj.assign)({className:this.buildCSSClass()},props),"button"!==tag&&(_log2.default.warn("Creating a Button with an HTML element of "+tag+" is deprecated; use ClickableComponent instead."),props=(0,_obj.assign)({tabIndex:0},props),attributes=(0,_obj.assign)({role:"button"},attributes)),attributes=(0,_obj.assign)({type:"button","aria-live":"polite"},attributes);var el=_component2.default.prototype.createEl.call(this,tag,props,attributes);return this.createControlTextEl(el),el},Button.prototype.addChild=function(child){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},className=this.constructor.name;return _log2.default.warn("Adding an actionable (user controllable) child to a Button ("+className+") is not supported; use a ClickableComponent instead."),_component2.default.prototype.addChild.call(this,child,options)},Button.prototype.enable=function(){_ClickableComponent.prototype.enable.call(this),this.el_.removeAttribute("disabled")},Button.prototype.disable=function(){_ClickableComponent.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},Button.prototype.handleKeyPress=function(event){32!==event.which&&13!==event.which&&_ClickableComponent.prototype.handleKeyPress.call(this,event)},Button}(_clickableComponent2.default);_component2.default.registerComponent("Button",Button),exports.default=Button},{3:3,5:5,86:86,88:88}],3:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),Dom=_interopRequireWildcard(_dereq_(81)),Events=_interopRequireWildcard(_dereq_(82)),Fn=_interopRequireWildcard(_dereq_(83)),_log2=_interopRequireDefault(_dereq_(86)),_document2=_interopRequireDefault(_dereq_(94)),_obj=_dereq_(88),ClickableComponent=function(_Component){function ClickableComponent(player,options){_classCallCheck(this,ClickableComponent);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.emitTapEvents(),_this.enable(),_this}return _inherits(ClickableComponent,_Component),ClickableComponent.prototype.createEl=function(){var tag=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",props=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};props=(0,_obj.assign)({className:this.buildCSSClass(),tabIndex:0},props),"button"===tag&&_log2.default.error("Creating a ClickableComponent with an HTML element of "+tag+" is not supported; use a Button instead."),attributes=(0,_obj.assign)({role:"button","aria-live":"polite"},attributes),this.tabIndex_=props.tabIndex;var el=_Component.prototype.createEl.call(this,tag,props,attributes);return this.createControlTextEl(el),el},ClickableComponent.prototype.createControlTextEl=function(el){return this.controlTextEl_=Dom.createEl("span",{className:"vjs-control-text"}),el&&el.appendChild(this.controlTextEl_),this.controlText(this.controlText_,el),this.controlTextEl_},ClickableComponent.prototype.controlText=function(text){var el=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(!text)return this.controlText_||"Need Text";var localizedText=this.localize(text);return this.controlText_=text,this.controlTextEl_.innerHTML=localizedText,this.nonIconControl||el.setAttribute("title",localizedText),this},ClickableComponent.prototype.buildCSSClass=function(){return"vjs-control vjs-button "+_Component.prototype.buildCSSClass.call(this)},ClickableComponent.prototype.enable=function(){return this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.off(["tap","click"],this.handleClick),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur),this.on(["tap","click"],this.handleClick),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur),this},ClickableComponent.prototype.disable=function(){return this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off(["tap","click"],this.handleClick),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur),this},ClickableComponent.prototype.handleClick=function(event){},ClickableComponent.prototype.handleFocus=function(event){Events.on(_document2.default,"keydown",Fn.bind(this,this.handleKeyPress))},ClickableComponent.prototype.handleKeyPress=function(event){32===event.which||13===event.which?(event.preventDefault(),this.handleClick(event)):_Component.prototype.handleKeyPress&&_Component.prototype.handleKeyPress.call(this,event)},ClickableComponent.prototype.handleBlur=function(event){Events.off(_document2.default,"keydown",Fn.bind(this,this.handleKeyPress))},ClickableComponent}(_component2.default);_component2.default.registerComponent("ClickableComponent",ClickableComponent),exports.default=ClickableComponent},{5:5,81:81,82:82,83:83,86:86,88:88,94:94}],4:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _button2=_interopRequireDefault(_dereq_(2)),_component2=_interopRequireDefault(_dereq_(5)),CloseButton=function(_Button){function CloseButton(player,options){_classCallCheck(this,CloseButton);var _this=_possibleConstructorReturn(this,_Button.call(this,player,options));return _this.controlText(options&&options.controlText||_this.localize("Close")),_this}return _inherits(CloseButton,_Button),CloseButton.prototype.buildCSSClass=function(){return"vjs-close-button "+_Button.prototype.buildCSSClass.call(this)},CloseButton.prototype.handleClick=function(event){this.trigger({type:"close",bubbles:!1})},CloseButton}(_button2.default);_component2.default.registerComponent("CloseButton",CloseButton),exports.default=CloseButton},{2:2,5:5}],5:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _window2=_interopRequireDefault(_dereq_(95)),Dom=_interopRequireWildcard(_dereq_(81)),Fn=_interopRequireWildcard(_dereq_(83)),Guid=_interopRequireWildcard(_dereq_(85)),Events=_interopRequireWildcard(_dereq_(82)),_log2=_interopRequireDefault(_dereq_(86)),_toTitleCase2=_interopRequireDefault(_dereq_(91)),_mergeOptions2=_interopRequireDefault(_dereq_(87)),Component=function(){function Component(player,options,ready){if(_classCallCheck(this,Component),!player&&this.play?this.player_=player=this:this.player_=player,this.options_=(0,_mergeOptions2.default)({},this.options_),options=this.options_=(0,_mergeOptions2.default)(this.options_,options),this.id_=options.id||options.el&&options.el.id,!this.id_){var id=player&&player.id&&player.id()||"no_player";this.id_=id+"_component_"+Guid.newGUID()}this.name_=options.name||null,options.el?this.el_=options.el:!1!==options.createEl&&(this.el_=this.createEl()),this.children_=[],this.childIndex_={},this.childNameIndex_={},!1!==options.initChildren&&this.initChildren(),this.ready(ready),!1!==options.reportTouchActivity&&this.enableTouchActivity()}return Component.prototype.dispose=function(){if(this.trigger({type:"dispose",bubbles:!1}),this.children_)for(var i=this.children_.length-1;i>=0;i--)this.children_[i].dispose&&this.children_[i].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.off(),this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),Dom.removeElData(this.el_),this.el_=null},Component.prototype.player=function(){return this.player_},Component.prototype.options=function(obj){return _log2.default.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"),obj?(this.options_=(0,_mergeOptions2.default)(this.options_,obj),this.options_):this.options_},Component.prototype.el=function(){return this.el_},Component.prototype.createEl=function(tagName,properties,attributes){return Dom.createEl(tagName,properties,attributes)},Component.prototype.localize=function(string){var code=this.player_.language&&this.player_.language(),languages=this.player_.languages&&this.player_.languages();if(!code||!languages)return string;var language=languages[code];if(language&&language[string])return language[string];var primaryLang=languages[code.split("-")[0]];return primaryLang&&primaryLang[string]?primaryLang[string]:string},Component.prototype.contentEl=function(){return this.contentEl_||this.el_},Component.prototype.id=function(){return this.id_},Component.prototype.name=function(){return this.name_},Component.prototype.children=function(){return this.children_},Component.prototype.getChildById=function(id){return this.childIndex_[id]},Component.prototype.getChild=function(name){if(name)return name=(0,_toTitleCase2.default)(name),this.childNameIndex_[name]},Component.prototype.addChild=function(child){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},index=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.children_.length,component=void 0,componentName=void 0;if("string"==typeof child){componentName=(0,_toTitleCase2.default)(child),options||(options={}),!0===options&&(_log2.default.warn("Initializing a child component with `true` is deprecated.Children should be defined in an array when possible, but if necessary use an object instead of `true`."),options={});var componentClassName=options.componentClass||componentName;options.name=componentName;var ComponentClass=Component.getComponent(componentClassName);if(!ComponentClass)throw new Error("Component "+componentClassName+" does not exist");if("function"!=typeof ComponentClass)return null;component=new ComponentClass(this.player_||this,options)}else component=child;if(this.children_.splice(index,0,component),"function"==typeof component.id&&(this.childIndex_[component.id()]=component),(componentName=componentName||component.name&&(0,_toTitleCase2.default)(component.name()))&&(this.childNameIndex_[componentName]=component),"function"==typeof component.el&&component.el()){var refNode=this.contentEl().children[index]||null;this.contentEl().insertBefore(component.el(),refNode)}return component},Component.prototype.removeChild=function(component){if("string"==typeof component&&(component=this.getChild(component)),component&&this.children_){for(var childFound=!1,i=this.children_.length-1;i>=0;i--)if(this.children_[i]===component){childFound=!0,this.children_.splice(i,1);break}if(childFound){this.childIndex_[component.id()]=null,this.childNameIndex_[component.name()]=null;var compEl=component.el();compEl&&compEl.parentNode===this.contentEl()&&this.contentEl().removeChild(component.el())}}},Component.prototype.initChildren=function(){var _this=this,children=this.options_.children;if(children){var parentOptions=this.options_,workingChildren=void 0,Tech=Component.getComponent("Tech");(workingChildren=Array.isArray(children)?children:Object.keys(children)).concat(Object.keys(this.options_).filter(function(child){return!workingChildren.some(function(wchild){return"string"==typeof wchild?child===wchild:child===wchild.name})})).map(function(child){var name=void 0,opts=void 0;return"string"==typeof child?opts=children[name=child]||_this.options_[name]||{}:(name=child.name,opts=child),{name:name,opts:opts}}).filter(function(child){var c=Component.getComponent(child.opts.componentClass||(0,_toTitleCase2.default)(child.name));return c&&!Tech.isTech(c)}).forEach(function(child){var name=child.name,opts=child.opts;if(void 0!==parentOptions[name]&&(opts=parentOptions[name]),!1!==opts){!0===opts&&(opts={}),opts.playerOptions=_this.options_.playerOptions;var newChild=_this.addChild(name,opts);newChild&&(_this[name]=newChild)}})}},Component.prototype.buildCSSClass=function(){return""},Component.prototype.on=function(first,second,third){var _this2=this;if("string"==typeof first||Array.isArray(first))Events.on(this.el_,first,Fn.bind(this,second));else{var target=first,type=second,fn=Fn.bind(this,third),removeOnDispose=function(){return _this2.off(target,type,fn)};removeOnDispose.guid=fn.guid,this.on("dispose",removeOnDispose);var cleanRemover=function(){return _this2.off("dispose",removeOnDispose)};cleanRemover.guid=fn.guid,first.nodeName?(Events.on(target,type,fn),Events.on(target,"dispose",cleanRemover)):"function"==typeof first.on&&(target.on(type,fn),target.on("dispose",cleanRemover))}return this},Component.prototype.off=function(first,second,third){if(!first||"string"==typeof first||Array.isArray(first))Events.off(this.el_,first,second);else{var target=first,type=second,fn=Fn.bind(this,third);this.off("dispose",fn),first.nodeName?(Events.off(target,type,fn),Events.off(target,"dispose",fn)):(target.off(type,fn),target.off("dispose",fn))}return this},Component.prototype.one=function(first,second,third){var _this3=this,_arguments=arguments;if("string"==typeof first||Array.isArray(first))Events.one(this.el_,first,Fn.bind(this,second));else{var target=first,type=second,fn=Fn.bind(this,third),newFunc=function newFunc(){_this3.off(target,type,newFunc),fn.apply(null,_arguments)};newFunc.guid=fn.guid,this.on(target,type,newFunc)}return this},Component.prototype.trigger=function(event,hash){return Events.trigger(this.el_,event,hash),this},Component.prototype.ready=function(fn){var sync=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return fn&&(this.isReady_?sync?fn.call(this):this.setTimeout(fn,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(fn))),this},Component.prototype.triggerReady=function(){this.isReady_=!0,this.setTimeout(function(){var readyQueue=this.readyQueue_;this.readyQueue_=[],readyQueue&&readyQueue.length>0&&readyQueue.forEach(function(fn){fn.call(this)},this),this.trigger("ready")},1)},Component.prototype.$=function(selector,context){return Dom.$(selector,context||this.contentEl())},Component.prototype.$$=function(selector,context){return Dom.$$(selector,context||this.contentEl())},Component.prototype.hasClass=function(classToCheck){return Dom.hasElClass(this.el_,classToCheck)},Component.prototype.addClass=function(classToAdd){return Dom.addElClass(this.el_,classToAdd),this},Component.prototype.removeClass=function(classToRemove){return Dom.removeElClass(this.el_,classToRemove),this},Component.prototype.toggleClass=function(classToToggle,predicate){return Dom.toggleElClass(this.el_,classToToggle,predicate),this},Component.prototype.show=function(){return this.removeClass("vjs-hidden"),this},Component.prototype.hide=function(){return this.addClass("vjs-hidden"),this},Component.prototype.lockShowing=function(){return this.addClass("vjs-lock-showing"),this},Component.prototype.unlockShowing=function(){return this.removeClass("vjs-lock-showing"),this},Component.prototype.getAttribute=function(attribute){return Dom.getAttribute(this.el_,attribute)},Component.prototype.setAttribute=function(attribute,value){return Dom.setAttribute(this.el_,attribute,value),this},Component.prototype.removeAttribute=function(attribute){return Dom.removeAttribute(this.el_,attribute),this},Component.prototype.width=function(num,skipListeners){return this.dimension("width",num,skipListeners)},Component.prototype.height=function(num,skipListeners){return this.dimension("height",num,skipListeners)},Component.prototype.dimensions=function(width,height){return this.width(width,!0).height(height)},Component.prototype.dimension=function(widthOrHeight,num,skipListeners){if(void 0!==num)return null!==num&&num===num||(num=0),-1!==(""+num).indexOf("%")||-1!==(""+num).indexOf("px")?this.el_.style[widthOrHeight]=num:this.el_.style[widthOrHeight]="auto"===num?"":num+"px",skipListeners||this.trigger("resize"),this;if(!this.el_)return 0;var val=this.el_.style[widthOrHeight],pxIndex=val.indexOf("px");return-1!==pxIndex?parseInt(val.slice(0,pxIndex),10):parseInt(this.el_["offset"+(0,_toTitleCase2.default)(widthOrHeight)],10)},Component.prototype.currentDimension=function(widthOrHeight){var computedWidthOrHeight=0;if("width"!==widthOrHeight&&"height"!==widthOrHeight)throw new Error("currentDimension only accepts width or height value");if("function"==typeof _window2.default.getComputedStyle){var computedStyle=_window2.default.getComputedStyle(this.el_);computedWidthOrHeight=computedStyle.getPropertyValue(widthOrHeight)||computedStyle[widthOrHeight]}if(0===(computedWidthOrHeight=parseFloat(computedWidthOrHeight))){var rule="offset"+(0,_toTitleCase2.default)(widthOrHeight);computedWidthOrHeight=this.el_[rule]}return computedWidthOrHeight},Component.prototype.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},Component.prototype.currentWidth=function(){return this.currentDimension("width")},Component.prototype.currentHeight=function(){return this.currentDimension("height")},Component.prototype.focus=function(){this.el_.focus()},Component.prototype.blur=function(){this.el_.blur()},Component.prototype.emitTapEvents=function(){var touchStart=0,firstTouch=null,couldBeTap=void 0;this.on("touchstart",function(event){1===event.touches.length&&(firstTouch={pageX:event.touches[0].pageX,pageY:event.touches[0].pageY},touchStart=(new Date).getTime(),couldBeTap=!0)}),this.on("touchmove",function(event){if(event.touches.length>1)couldBeTap=!1;else if(firstTouch){var xdiff=event.touches[0].pageX-firstTouch.pageX,ydiff=event.touches[0].pageY-firstTouch.pageY;Math.sqrt(xdiff*xdiff+ydiff*ydiff)>10&&(couldBeTap=!1)}});var noTap=function(){couldBeTap=!1};this.on("touchleave",noTap),this.on("touchcancel",noTap),this.on("touchend",function(event){firstTouch=null,!0===couldBeTap&&(new Date).getTime()-touchStart<200&&(event.preventDefault(),this.trigger("tap"))})},Component.prototype.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var report=Fn.bind(this.player(),this.player().reportUserActivity),touchHolding=void 0;this.on("touchstart",function(){report(),this.clearInterval(touchHolding),touchHolding=this.setInterval(report,250)});var touchEnd=function(event){report(),this.clearInterval(touchHolding)};this.on("touchmove",report),this.on("touchend",touchEnd),this.on("touchcancel",touchEnd)}},Component.prototype.setTimeout=function(fn,timeout){fn=Fn.bind(this,fn);var timeoutId=_window2.default.setTimeout(fn,timeout),disposeFn=function(){this.clearTimeout(timeoutId)};return disposeFn.guid="vjs-timeout-"+timeoutId,this.on("dispose",disposeFn),timeoutId},Component.prototype.clearTimeout=function(timeoutId){_window2.default.clearTimeout(timeoutId);var disposeFn=function(){};return disposeFn.guid="vjs-timeout-"+timeoutId,this.off("dispose",disposeFn),timeoutId},Component.prototype.setInterval=function(fn,interval){fn=Fn.bind(this,fn);var intervalId=_window2.default.setInterval(fn,interval),disposeFn=function(){this.clearInterval(intervalId)};return disposeFn.guid="vjs-interval-"+intervalId,this.on("dispose",disposeFn),intervalId},Component.prototype.clearInterval=function(intervalId){_window2.default.clearInterval(intervalId);var disposeFn=function(){};return disposeFn.guid="vjs-interval-"+intervalId,this.off("dispose",disposeFn),intervalId},Component.registerComponent=function(name,comp){if(name){if(name=(0,_toTitleCase2.default)(name),Component.components_||(Component.components_={}),"Player"===name&&Component.components_[name]){var Player=Component.components_[name];if(Player.players&&Object.keys(Player.players).length>0&&Object.keys(Player.players).map(function(playerName){return Player.players[playerName]}).every(Boolean))throw new Error("Can not register Player component after player has been created")}return Component.components_[name]=comp,comp}},Component.getComponent=function(name){if(name)return name=(0,_toTitleCase2.default)(name),Component.components_&&Component.components_[name]?Component.components_[name]:_window2.default&&_window2.default.videojs&&_window2.default.videojs[name]?(_log2.default.warn("The "+name+" component was added to the videojs object when it should be registered using videojs.registerComponent(name, component)"),_window2.default.videojs[name]):void 0},Component.extend=function(props){props=props||{},_log2.default.warn("Component.extend({}) has been deprecated,  use videojs.extend(Component, {}) instead");var init=props.init||props.init||this.prototype.init||this.prototype.init||function(){},subObj=function(){init.apply(this,arguments)};(subObj.prototype=Object.create(this.prototype)).constructor=subObj,subObj.extend=Component.extend;for(var name in props)props.hasOwnProperty(name)&&(subObj.prototype[name]=props[name]);return subObj},Component}();Component.registerComponent("Component",Component),exports.default=Component},{81:81,82:82,83:83,85:85,86:86,87:87,91:91,95:95}],6:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _trackButton2=_interopRequireDefault(_dereq_(36)),_component2=_interopRequireDefault(_dereq_(5)),_audioTrackMenuItem2=_interopRequireDefault(_dereq_(7)),AudioTrackButton=function(_TrackButton){function AudioTrackButton(player){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,AudioTrackButton),options.tracks=player.audioTracks&&player.audioTracks();var _this=_possibleConstructorReturn(this,_TrackButton.call(this,player,options));return _this.el_.setAttribute("aria-label","Audio Menu"),_this}return _inherits(AudioTrackButton,_TrackButton),AudioTrackButton.prototype.buildCSSClass=function(){return"vjs-audio-button "+_TrackButton.prototype.buildCSSClass.call(this)},AudioTrackButton.prototype.createItems=function(){var items=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.hideThreshold_=1;var tracks=this.player_.audioTracks&&this.player_.audioTracks();if(!tracks)return items;for(var i=0;i<tracks.length;i++){var track=tracks[i];items.push(new _audioTrackMenuItem2.default(this.player_,{track:track,selectable:!0}))}return items},AudioTrackButton}(_trackButton2.default);AudioTrackButton.prototype.controlText_="Audio Track",_component2.default.registerComponent("AudioTrackButton",AudioTrackButton),exports.default=AudioTrackButton},{36:36,5:5,7:7}],7:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _menuItem2=_interopRequireDefault(_dereq_(48)),_component2=_interopRequireDefault(_dereq_(5)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),AudioTrackMenuItem=function(_MenuItem){function AudioTrackMenuItem(player,options){_classCallCheck(this,AudioTrackMenuItem);var track=options.track,tracks=player.audioTracks();options.label=track.label||track.language||"Unknown",options.selected=track.enabled;var _this=_possibleConstructorReturn(this,_MenuItem.call(this,player,options));if(_this.track=track,tracks){var changeHandler=Fn.bind(_this,_this.handleTracksChange);tracks.addEventListener("change",changeHandler),_this.on("dispose",function(){tracks.removeEventListener("change",changeHandler)})}return _this}return _inherits(AudioTrackMenuItem,_MenuItem),AudioTrackMenuItem.prototype.handleClick=function(event){var tracks=this.player_.audioTracks();if(_MenuItem.prototype.handleClick.call(this,event),tracks)for(var i=0;i<tracks.length;i++){var track=tracks[i];track.enabled=track===this.track}},AudioTrackMenuItem.prototype.handleTracksChange=function(event){this.selected(this.track.enabled)},AudioTrackMenuItem}(_menuItem2.default);_component2.default.registerComponent("AudioTrackMenuItem",AudioTrackMenuItem),exports.default=AudioTrackMenuItem},{48:48,5:5,83:83}],8:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5));_dereq_(12),_dereq_(32),_dereq_(33),_dereq_(35),_dereq_(34),_dereq_(10),_dereq_(18),_dereq_(9),_dereq_(38),_dereq_(40),_dereq_(11),_dereq_(25),_dereq_(27),_dereq_(29),_dereq_(24),_dereq_(6),_dereq_(13),_dereq_(21);var ControlBar=function(_Component){function ControlBar(){return _classCallCheck(this,ControlBar),_possibleConstructorReturn(this,_Component.apply(this,arguments))}return _inherits(ControlBar,_Component),ControlBar.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"},{role:"group"})},ControlBar}(_component2.default);ControlBar.prototype.options_={children:["playToggle","volumeMenuButton","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subtitlesButton","captionsButton","audioTrackButton","fullscreenToggle"]},_component2.default.registerComponent("ControlBar",ControlBar),exports.default=ControlBar},{10:10,11:11,12:12,13:13,18:18,21:21,24:24,25:25,27:27,29:29,32:32,33:33,34:34,35:35,38:38,40:40,5:5,6:6,9:9}],9:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _button2=_interopRequireDefault(_dereq_(2)),_component2=_interopRequireDefault(_dereq_(5)),FullscreenToggle=function(_Button){function FullscreenToggle(player,options){_classCallCheck(this,FullscreenToggle);var _this=_possibleConstructorReturn(this,_Button.call(this,player,options));return _this.on(player,"fullscreenchange",_this.handleFullscreenChange),_this}return _inherits(FullscreenToggle,_Button),FullscreenToggle.prototype.buildCSSClass=function(){return"vjs-fullscreen-control "+_Button.prototype.buildCSSClass.call(this)},FullscreenToggle.prototype.handleFullscreenChange=function(event){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},FullscreenToggle.prototype.handleClick=function(event){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},FullscreenToggle}(_button2.default);FullscreenToggle.prototype.controlText_="Fullscreen",_component2.default.registerComponent("FullscreenToggle",FullscreenToggle),exports.default=FullscreenToggle},{2:2,5:5}],10:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5)),Dom=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(81)),LiveDisplay=function(_Component){function LiveDisplay(player,options){_classCallCheck(this,LiveDisplay);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.updateShowing(),_this.on(_this.player(),"durationchange",_this.updateShowing),_this}return _inherits(LiveDisplay,_Component),LiveDisplay.prototype.createEl=function(){var el=_Component.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=Dom.createEl("div",{className:"vjs-live-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Stream Type")+"</span>"+this.localize("LIVE")},{"aria-live":"off"}),el.appendChild(this.contentEl_),el},LiveDisplay.prototype.updateShowing=function(event){this.player().duration()===1/0?this.show():this.hide()},LiveDisplay}(_component2.default);_component2.default.registerComponent("LiveDisplay",LiveDisplay),exports.default=LiveDisplay},{5:5,81:81}],11:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _button2=_interopRequireDefault(_dereq_(2)),_component2=_interopRequireDefault(_dereq_(5)),Dom=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(81)),MuteToggle=function(_Button){function MuteToggle(player,options){_classCallCheck(this,MuteToggle);var _this=_possibleConstructorReturn(this,_Button.call(this,player,options));return _this.on(player,"volumechange",_this.update),player.tech_&&!1===player.tech_.featuresVolumeControl&&_this.addClass("vjs-hidden"),_this.on(player,"loadstart",function(){this.update(),!1===player.tech_.featuresVolumeControl?this.addClass("vjs-hidden"):this.removeClass("vjs-hidden")}),_this}return _inherits(MuteToggle,_Button),MuteToggle.prototype.buildCSSClass=function(){return"vjs-mute-control "+_Button.prototype.buildCSSClass.call(this)},MuteToggle.prototype.handleClick=function(event){this.player_.muted(!this.player_.muted())},MuteToggle.prototype.update=function(event){var vol=this.player_.volume(),level=3;this.player_.muted()?level=0:vol<.33?level=1:vol<.67&&(level=2);var toMute=this.player_.muted()?"Unmute":"Mute";this.controlText()!==toMute&&this.controlText(toMute);for(var i=0;i<4;i++)Dom.removeElClass(this.el_,"vjs-vol-"+i);Dom.addElClass(this.el_,"vjs-vol-"+level)},MuteToggle}(_button2.default);MuteToggle.prototype.controlText_="Mute",_component2.default.registerComponent("MuteToggle",MuteToggle),exports.default=MuteToggle},{2:2,5:5,81:81}],12:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _button2=_interopRequireDefault(_dereq_(2)),_component2=_interopRequireDefault(_dereq_(5)),PlayToggle=function(_Button){function PlayToggle(player,options){_classCallCheck(this,PlayToggle);var _this=_possibleConstructorReturn(this,_Button.call(this,player,options));return _this.on(player,"play",_this.handlePlay),_this.on(player,"pause",_this.handlePause),_this}return _inherits(PlayToggle,_Button),PlayToggle.prototype.buildCSSClass=function(){return"vjs-play-control "+_Button.prototype.buildCSSClass.call(this)},PlayToggle.prototype.handleClick=function(event){this.player_.paused()?this.player_.play():this.player_.pause()},PlayToggle.prototype.handlePlay=function(event){this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},PlayToggle.prototype.handlePause=function(event){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},PlayToggle}(_button2.default);PlayToggle.prototype.controlText_="Play",_component2.default.registerComponent("PlayToggle",PlayToggle),exports.default=PlayToggle},{2:2,5:5}],13:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _menuButton2=_interopRequireDefault(_dereq_(47)),_menu2=_interopRequireDefault(_dereq_(49)),_playbackRateMenuItem2=_interopRequireDefault(_dereq_(14)),_component2=_interopRequireDefault(_dereq_(5)),Dom=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(81)),PlaybackRateMenuButton=function(_MenuButton){function PlaybackRateMenuButton(player,options){_classCallCheck(this,PlaybackRateMenuButton);var _this=_possibleConstructorReturn(this,_MenuButton.call(this,player,options));return _this.updateVisibility(),_this.updateLabel(),_this.on(player,"loadstart",_this.updateVisibility),_this.on(player,"ratechange",_this.updateLabel),_this}return _inherits(PlaybackRateMenuButton,_MenuButton),PlaybackRateMenuButton.prototype.createEl=function(){var el=_MenuButton.prototype.createEl.call(this);return this.labelEl_=Dom.createEl("div",{className:"vjs-playback-rate-value",innerHTML:1}),el.appendChild(this.labelEl_),el},PlaybackRateMenuButton.prototype.buildCSSClass=function(){return"vjs-playback-rate "+_MenuButton.prototype.buildCSSClass.call(this)},PlaybackRateMenuButton.prototype.createMenu=function(){var menu=new _menu2.default(this.player()),rates=this.playbackRates();if(rates)for(var i=rates.length-1;i>=0;i--)menu.addChild(new _playbackRateMenuItem2.default(this.player(),{rate:rates[i]+"x"}));return menu},PlaybackRateMenuButton.prototype.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},PlaybackRateMenuButton.prototype.handleClick=function(event){for(var currentRate=this.player().playbackRate(),rates=this.playbackRates(),newRate=rates[0],i=0;i<rates.length;i++)if(rates[i]>currentRate){newRate=rates[i];break}this.player().playbackRate(newRate)},PlaybackRateMenuButton.prototype.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},PlaybackRateMenuButton.prototype.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},PlaybackRateMenuButton.prototype.updateVisibility=function(event){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},PlaybackRateMenuButton.prototype.updateLabel=function(event){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},PlaybackRateMenuButton}(_menuButton2.default);PlaybackRateMenuButton.prototype.controlText_="Playback Rate",_component2.default.registerComponent("PlaybackRateMenuButton",PlaybackRateMenuButton),exports.default=PlaybackRateMenuButton},{14:14,47:47,49:49,5:5,81:81}],14:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _menuItem2=_interopRequireDefault(_dereq_(48)),_component2=_interopRequireDefault(_dereq_(5)),PlaybackRateMenuItem=function(_MenuItem){function PlaybackRateMenuItem(player,options){_classCallCheck(this,PlaybackRateMenuItem);var label=options.rate,rate=parseFloat(label,10);options.label=label,options.selected=1===rate,options.selectable=!0;var _this=_possibleConstructorReturn(this,_MenuItem.call(this,player,options));return _this.label=label,_this.rate=rate,_this.on(player,"ratechange",_this.update),_this}return _inherits(PlaybackRateMenuItem,_MenuItem),PlaybackRateMenuItem.prototype.handleClick=function(event){_MenuItem.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},PlaybackRateMenuItem.prototype.update=function(event){this.selected(this.player().playbackRate()===this.rate)},PlaybackRateMenuItem}(_menuItem2.default);PlaybackRateMenuItem.prototype.contentElType="button",_component2.default.registerComponent("PlaybackRateMenuItem",PlaybackRateMenuItem),exports.default=PlaybackRateMenuItem},{48:48,5:5}],15:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5)),Dom=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(81)),LoadProgressBar=function(_Component){function LoadProgressBar(player,options){_classCallCheck(this,LoadProgressBar);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.partEls_=[],_this.on(player,"progress",_this.update),_this}return _inherits(LoadProgressBar,_Component),LoadProgressBar.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Loaded")+"</span>: 0%</span>"})},LoadProgressBar.prototype.update=function(event){var buffered=this.player_.buffered(),duration=this.player_.duration(),bufferedEnd=this.player_.bufferedEnd(),children=this.partEls_,percentify=function(time,end){var percent=time/end||0;return 100*(percent>=1?1:percent)+"%"};this.el_.style.width=percentify(bufferedEnd,duration);for(var i=0;i<buffered.length;i++){var start=buffered.start(i),end=buffered.end(i),part=children[i];part||(part=this.el_.appendChild(Dom.createEl()),children[i]=part),part.style.left=percentify(start,bufferedEnd),part.style.width=percentify(end-start,bufferedEnd)}for(var _i=children.length;_i>buffered.length;_i--)this.el_.removeChild(children[_i-1]);children.length=buffered.length},LoadProgressBar}(_component2.default);_component2.default.registerComponent("LoadProgressBar",LoadProgressBar),exports.default=LoadProgressBar},{5:5,81:81}],16:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),Dom=_interopRequireWildcard(_dereq_(81)),Fn=_interopRequireWildcard(_dereq_(83)),_formatTime2=_interopRequireDefault(_dereq_(84)),_computedStyle2=_interopRequireDefault(_dereq_(80)),MouseTimeDisplay=function(_Component){function MouseTimeDisplay(player,options){_classCallCheck(this,MouseTimeDisplay);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return options.playerOptions&&options.playerOptions.controlBar&&options.playerOptions.controlBar.progressControl&&options.playerOptions.controlBar.progressControl.keepTooltipsInside&&(_this.keepTooltipsInside=options.playerOptions.controlBar.progressControl.keepTooltipsInside),_this.keepTooltipsInside&&(_this.tooltip=Dom.createEl("div",{className:"vjs-time-tooltip"}),_this.el().appendChild(_this.tooltip),_this.addClass("vjs-keep-tooltips-inside")),_this.update(0,0),player.on("ready",function(){_this.on(player.controlBar.progressControl.el(),"mousemove",Fn.throttle(Fn.bind(_this,_this.handleMouseMove),25))}),_this}return _inherits(MouseTimeDisplay,_Component),MouseTimeDisplay.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},MouseTimeDisplay.prototype.handleMouseMove=function(event){var duration=this.player_.duration(),newTime=this.calculateDistance(event)*duration,position=event.pageX-Dom.findElPosition(this.el().parentNode).left;this.update(newTime,position)},MouseTimeDisplay.prototype.update=function(newTime,position){var time=(0,_formatTime2.default)(newTime,this.player_.duration());if(this.el().style.left=position+"px",this.el().setAttribute("data-current-time",time),this.keepTooltipsInside){var difference=position-this.clampPosition_(position)+1,tooltipWidthHalf=parseFloat((0,_computedStyle2.default)(this.tooltip,"width"))/2;this.tooltip.innerHTML=time,this.tooltip.style.right="-"+(tooltipWidthHalf-difference)+"px"}},MouseTimeDisplay.prototype.calculateDistance=function(event){return Dom.getPointerPosition(this.el().parentNode,event).x},MouseTimeDisplay.prototype.clampPosition_=function(position){if(!this.keepTooltipsInside)return position;var playerWidth=parseFloat((0,_computedStyle2.default)(this.player().el(),"width")),tooltipWidthHalf=parseFloat((0,_computedStyle2.default)(this.tooltip,"width"))/2,actualPosition=position;return position<tooltipWidthHalf?actualPosition=Math.ceil(tooltipWidthHalf):position>playerWidth-tooltipWidthHalf&&(actualPosition=Math.floor(playerWidth-tooltipWidthHalf)),actualPosition},MouseTimeDisplay}(_component2.default);_component2.default.registerComponent("MouseTimeDisplay",MouseTimeDisplay),exports.default=MouseTimeDisplay},{5:5,80:80,81:81,83:83,84:84}],17:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),_formatTime2=_interopRequireDefault(_dereq_(84)),PlayProgressBar=function(_Component){function PlayProgressBar(player,options){_classCallCheck(this,PlayProgressBar);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.updateDataAttr(),_this.on(player,"timeupdate",_this.updateDataAttr),player.ready(Fn.bind(_this,_this.updateDataAttr)),options.playerOptions&&options.playerOptions.controlBar&&options.playerOptions.controlBar.progressControl&&options.playerOptions.controlBar.progressControl.keepTooltipsInside&&(_this.keepTooltipsInside=options.playerOptions.controlBar.progressControl.keepTooltipsInside),_this.keepTooltipsInside&&_this.addClass("vjs-keep-tooltips-inside"),_this}return _inherits(PlayProgressBar,_Component),PlayProgressBar.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar",innerHTML:'<span class="vjs-control-text"><span>'+this.localize("Progress")+"</span>: 0%</span>"})},PlayProgressBar.prototype.updateDataAttr=function(event){var time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.el_.setAttribute("data-current-time",(0,_formatTime2.default)(time,this.player_.duration()))},PlayProgressBar}(_component2.default);_component2.default.registerComponent("PlayProgressBar",PlayProgressBar),exports.default=PlayProgressBar},{5:5,83:83,84:84}],18:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5));_dereq_(19),_dereq_(16);var ProgressControl=function(_Component){function ProgressControl(){return _classCallCheck(this,ProgressControl),_possibleConstructorReturn(this,_Component.apply(this,arguments))}return _inherits(ProgressControl,_Component),ProgressControl.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},ProgressControl}(_component2.default);ProgressControl.prototype.options_={children:["seekBar"]},_component2.default.registerComponent("ProgressControl",ProgressControl),exports.default=ProgressControl},{16:16,19:19,5:5}],19:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _slider2=_interopRequireDefault(_dereq_(57)),_component2=_interopRequireDefault(_dereq_(5)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),_formatTime2=_interopRequireDefault(_dereq_(84)),_computedStyle2=_interopRequireDefault(_dereq_(80));_dereq_(15),_dereq_(17),_dereq_(20);var SeekBar=function(_Slider){function SeekBar(player,options){_classCallCheck(this,SeekBar);var _this=_possibleConstructorReturn(this,_Slider.call(this,player,options));return _this.on(player,"timeupdate",_this.updateProgress),_this.on(player,"ended",_this.updateProgress),player.ready(Fn.bind(_this,_this.updateProgress)),options.playerOptions&&options.playerOptions.controlBar&&options.playerOptions.controlBar.progressControl&&options.playerOptions.controlBar.progressControl.keepTooltipsInside&&(_this.keepTooltipsInside=options.playerOptions.controlBar.progressControl.keepTooltipsInside),_this.keepTooltipsInside&&(_this.tooltipProgressBar=_this.addChild("TooltipProgressBar")),_this}return _inherits(SeekBar,_Slider),SeekBar.prototype.createEl=function(){return _Slider.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":"progress bar"})},SeekBar.prototype.updateProgress=function(event){if(this.updateAriaAttributes(this.el_),this.keepTooltipsInside){this.updateAriaAttributes(this.tooltipProgressBar.el_),this.tooltipProgressBar.el_.style.width=this.bar.el_.style.width;var playerWidth=parseFloat((0,_computedStyle2.default)(this.player().el(),"width")),tooltipWidth=parseFloat((0,_computedStyle2.default)(this.tooltipProgressBar.tooltip,"width")),tooltipStyle=this.tooltipProgressBar.el().style;tooltipStyle.maxWidth=Math.floor(playerWidth-tooltipWidth/2)+"px",tooltipStyle.minWidth=Math.ceil(tooltipWidth/2)+"px",tooltipStyle.right="-"+tooltipWidth/2+"px"}},SeekBar.prototype.updateAriaAttributes=function(el){var time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();el.setAttribute("aria-valuenow",(100*this.getPercent()).toFixed(2)),el.setAttribute("aria-valuetext",(0,_formatTime2.default)(time,this.player_.duration()))},SeekBar.prototype.getPercent=function(){var percent=this.player_.currentTime()/this.player_.duration();return percent>=1?1:percent},SeekBar.prototype.handleMouseDown=function(event){this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),_Slider.prototype.handleMouseDown.call(this,event)},SeekBar.prototype.handleMouseMove=function(event){var newTime=this.calculateDistance(event)*this.player_.duration();newTime===this.player_.duration()&&(newTime-=.1),this.player_.currentTime(newTime)},SeekBar.prototype.handleMouseUp=function(event){_Slider.prototype.handleMouseUp.call(this,event),this.player_.scrubbing(!1),this.videoWasPlaying&&this.player_.play()},SeekBar.prototype.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+5)},SeekBar.prototype.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-5)},SeekBar}(_slider2.default);SeekBar.prototype.options_={children:["loadProgressBar","mouseTimeDisplay","playProgressBar"],barName:"playProgressBar"},SeekBar.prototype.playerEvent="timeupdate",_component2.default.registerComponent("SeekBar",SeekBar),exports.default=SeekBar},{15:15,17:17,20:20,5:5,57:57,80:80,83:83,84:84}],20:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),_formatTime2=_interopRequireDefault(_dereq_(84)),TooltipProgressBar=function(_Component){function TooltipProgressBar(player,options){_classCallCheck(this,TooltipProgressBar);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.updateDataAttr(),_this.on(player,"timeupdate",_this.updateDataAttr),player.ready(Fn.bind(_this,_this.updateDataAttr)),_this}return _inherits(TooltipProgressBar,_Component),TooltipProgressBar.prototype.createEl=function(){var el=_Component.prototype.createEl.call(this,"div",{className:"vjs-tooltip-progress-bar vjs-slider-bar",innerHTML:'<div class="vjs-time-tooltip"></div>\n        <span class="vjs-control-text"><span>'+this.localize("Progress")+"</span>: 0%</span>"});return this.tooltip=el.querySelector(".vjs-time-tooltip"),el},TooltipProgressBar.prototype.updateDataAttr=function(event){var time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),formattedTime=(0,_formatTime2.default)(time,this.player_.duration());this.el_.setAttribute("data-current-time",formattedTime),this.tooltip.innerHTML=formattedTime},TooltipProgressBar}(_component2.default);_component2.default.registerComponent("TooltipProgressBar",TooltipProgressBar),exports.default=TooltipProgressBar},{5:5,83:83,84:84}],21:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _spacer2=_interopRequireDefault(_dereq_(22)),_component2=_interopRequireDefault(_dereq_(5)),CustomControlSpacer=function(_Spacer){function CustomControlSpacer(){return _classCallCheck(this,CustomControlSpacer),_possibleConstructorReturn(this,_Spacer.apply(this,arguments))}return _inherits(CustomControlSpacer,_Spacer),CustomControlSpacer.prototype.buildCSSClass=function(){return"vjs-custom-control-spacer "+_Spacer.prototype.buildCSSClass.call(this)},CustomControlSpacer.prototype.createEl=function(){var el=_Spacer.prototype.createEl.call(this,{className:this.buildCSSClass()});return el.innerHTML="&nbsp;",el},CustomControlSpacer}(_spacer2.default);_component2.default.registerComponent("CustomControlSpacer",CustomControlSpacer),exports.default=CustomControlSpacer},{22:22,5:5}],22:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5)),Spacer=function(_Component){function Spacer(){return _classCallCheck(this,Spacer),_possibleConstructorReturn(this,_Component.apply(this,arguments))}return _inherits(Spacer,_Component),Spacer.prototype.buildCSSClass=function(){return"vjs-spacer "+_Component.prototype.buildCSSClass.call(this)},Spacer.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},Spacer}(_component2.default);_component2.default.registerComponent("Spacer",Spacer),exports.default=Spacer},{5:5}],23:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _textTrackMenuItem2=_interopRequireDefault(_dereq_(31)),_component2=_interopRequireDefault(_dereq_(5)),CaptionSettingsMenuItem=function(_TextTrackMenuItem){function CaptionSettingsMenuItem(player,options){_classCallCheck(this,CaptionSettingsMenuItem),options.track={player:player,kind:options.kind,label:options.kind+" settings",selectable:!1,default:!1,mode:"disabled"},options.selectable=!1;var _this=_possibleConstructorReturn(this,_TextTrackMenuItem.call(this,player,options));return _this.addClass("vjs-texttrack-settings"),_this.controlText(", opens "+options.kind+" settings dialog"),_this}return _inherits(CaptionSettingsMenuItem,_TextTrackMenuItem),CaptionSettingsMenuItem.prototype.handleClick=function(event){this.player().getChild("textTrackSettings").show(),this.player().getChild("textTrackSettings").el_.focus()},CaptionSettingsMenuItem}(_textTrackMenuItem2.default);_component2.default.registerComponent("CaptionSettingsMenuItem",CaptionSettingsMenuItem),exports.default=CaptionSettingsMenuItem},{31:31,5:5}],24:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _textTrackButton2=_interopRequireDefault(_dereq_(30)),_component2=_interopRequireDefault(_dereq_(5)),_captionSettingsMenuItem2=_interopRequireDefault(_dereq_(23)),CaptionsButton=function(_TextTrackButton){function CaptionsButton(player,options,ready){_classCallCheck(this,CaptionsButton);var _this=_possibleConstructorReturn(this,_TextTrackButton.call(this,player,options,ready));return _this.el_.setAttribute("aria-label","Captions Menu"),_this}return _inherits(CaptionsButton,_TextTrackButton),CaptionsButton.prototype.buildCSSClass=function(){return"vjs-captions-button "+_TextTrackButton.prototype.buildCSSClass.call(this)},CaptionsButton.prototype.createItems=function(){var items=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||(items.push(new _captionSettingsMenuItem2.default(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),_TextTrackButton.prototype.createItems.call(this,items)},CaptionsButton}(_textTrackButton2.default);CaptionsButton.prototype.kind_="captions",CaptionsButton.prototype.controlText_="Captions",_component2.default.registerComponent("CaptionsButton",CaptionsButton),exports.default=CaptionsButton},{23:23,30:30,5:5}],25:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _textTrackButton2=_interopRequireDefault(_dereq_(30)),_component2=_interopRequireDefault(_dereq_(5)),_chaptersTrackMenuItem2=_interopRequireDefault(_dereq_(26)),_toTitleCase2=_interopRequireDefault(_dereq_(91)),ChaptersButton=function(_TextTrackButton){function ChaptersButton(player,options,ready){_classCallCheck(this,ChaptersButton);var _this=_possibleConstructorReturn(this,_TextTrackButton.call(this,player,options,ready));return _this.el_.setAttribute("aria-label","Chapters Menu"),_this}return _inherits(ChaptersButton,_TextTrackButton),ChaptersButton.prototype.buildCSSClass=function(){return"vjs-chapters-button "+_TextTrackButton.prototype.buildCSSClass.call(this)},ChaptersButton.prototype.update=function(event){this.track_&&(!event||"addtrack"!==event.type&&"removetrack"!==event.type)||this.setTrack(this.findChaptersTrack()),_TextTrackButton.prototype.update.call(this)},ChaptersButton.prototype.setTrack=function(track){if(this.track_!==track){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var remoteTextTrackEl=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);remoteTextTrackEl&&remoteTextTrackEl.removeEventListener("load",this.updateHandler_),this.track_=null}if(this.track_=track,this.track_){this.track_.mode="hidden";var _remoteTextTrackEl=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);_remoteTextTrackEl&&_remoteTextTrackEl.addEventListener("load",this.updateHandler_)}}},ChaptersButton.prototype.findChaptersTrack=function(){for(var tracks=this.player_.textTracks()||[],i=tracks.length-1;i>=0;i--){var track=tracks[i];if(track.kind===this.kind_)return track}},ChaptersButton.prototype.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize((0,_toTitleCase2.default)(this.kind_))},ChaptersButton.prototype.createMenu=function(){return this.options_.title=this.getMenuCaption(),_TextTrackButton.prototype.createMenu.call(this)},ChaptersButton.prototype.createItems=function(){var items=[];if(!this.track_)return items;var cues=this.track_.cues;if(!cues)return items;for(var i=0,l=cues.length;i<l;i++){var cue=cues[i],mi=new _chaptersTrackMenuItem2.default(this.player_,{track:this.track_,cue:cue});items.push(mi)}return items},ChaptersButton}(_textTrackButton2.default);ChaptersButton.prototype.kind_="chapters",ChaptersButton.prototype.controlText_="Chapters",_component2.default.registerComponent("ChaptersButton",ChaptersButton),exports.default=ChaptersButton},{26:26,30:30,5:5,91:91}],26:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _menuItem2=_interopRequireDefault(_dereq_(48)),_component2=_interopRequireDefault(_dereq_(5)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),ChaptersTrackMenuItem=function(_MenuItem){function ChaptersTrackMenuItem(player,options){_classCallCheck(this,ChaptersTrackMenuItem);var track=options.track,cue=options.cue,currentTime=player.currentTime();options.selectable=!0,options.label=cue.text,options.selected=cue.startTime<=currentTime&&currentTime<cue.endTime;var _this=_possibleConstructorReturn(this,_MenuItem.call(this,player,options));return _this.track=track,_this.cue=cue,track.addEventListener("cuechange",Fn.bind(_this,_this.update)),_this}return _inherits(ChaptersTrackMenuItem,_MenuItem),ChaptersTrackMenuItem.prototype.handleClick=function(event){_MenuItem.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime),this.update(this.cue.startTime)},ChaptersTrackMenuItem.prototype.update=function(event){var cue=this.cue,currentTime=this.player_.currentTime();this.selected(cue.startTime<=currentTime&&currentTime<cue.endTime)},ChaptersTrackMenuItem}(_menuItem2.default);_component2.default.registerComponent("ChaptersTrackMenuItem",ChaptersTrackMenuItem),exports.default=ChaptersTrackMenuItem},{48:48,5:5,83:83}],27:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _textTrackButton2=_interopRequireDefault(_dereq_(30)),_component2=_interopRequireDefault(_dereq_(5)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),DescriptionsButton=function(_TextTrackButton){function DescriptionsButton(player,options,ready){_classCallCheck(this,DescriptionsButton);var _this=_possibleConstructorReturn(this,_TextTrackButton.call(this,player,options,ready));_this.el_.setAttribute("aria-label","Descriptions Menu");var tracks=player.textTracks();if(tracks){var changeHandler=Fn.bind(_this,_this.handleTracksChange);tracks.addEventListener("change",changeHandler),_this.on("dispose",function(){tracks.removeEventListener("change",changeHandler)})}return _this}return _inherits(DescriptionsButton,_TextTrackButton),DescriptionsButton.prototype.handleTracksChange=function(event){for(var tracks=this.player().textTracks(),disabled=!1,i=0,l=tracks.length;i<l;i++){var track=tracks[i];if(track.kind!==this.kind_&&"showing"===track.mode){disabled=!0;break}}disabled?this.disable():this.enable()},DescriptionsButton.prototype.buildCSSClass=function(){return"vjs-descriptions-button "+_TextTrackButton.prototype.buildCSSClass.call(this)},DescriptionsButton}(_textTrackButton2.default);DescriptionsButton.prototype.kind_="descriptions",DescriptionsButton.prototype.controlText_="Descriptions",_component2.default.registerComponent("DescriptionsButton",DescriptionsButton),exports.default=DescriptionsButton},{30:30,5:5,83:83}],28:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _textTrackMenuItem2=_interopRequireDefault(_dereq_(31)),_component2=_interopRequireDefault(_dereq_(5)),OffTextTrackMenuItem=function(_TextTrackMenuItem){function OffTextTrackMenuItem(player,options){_classCallCheck(this,OffTextTrackMenuItem),options.track={player:player,kind:options.kind,label:options.kind+" off",default:!1,mode:"disabled"},options.selectable=!0;var _this=_possibleConstructorReturn(this,_TextTrackMenuItem.call(this,player,options));return _this.selected(!0),_this}return _inherits(OffTextTrackMenuItem,_TextTrackMenuItem),OffTextTrackMenuItem.prototype.handleTracksChange=function(event){for(var tracks=this.player().textTracks(),selected=!0,i=0,l=tracks.length;i<l;i++){var track=tracks[i];if(track.kind===this.track.kind&&"showing"===track.mode){selected=!1;break}}this.selected(selected)},OffTextTrackMenuItem}(_textTrackMenuItem2.default);_component2.default.registerComponent("OffTextTrackMenuItem",OffTextTrackMenuItem),exports.default=OffTextTrackMenuItem},{31:31,5:5}],29:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _textTrackButton2=_interopRequireDefault(_dereq_(30)),_component2=_interopRequireDefault(_dereq_(5)),SubtitlesButton=function(_TextTrackButton){function SubtitlesButton(player,options,ready){_classCallCheck(this,SubtitlesButton);var _this=_possibleConstructorReturn(this,_TextTrackButton.call(this,player,options,ready));return _this.el_.setAttribute("aria-label","Subtitles Menu"),_this}return _inherits(SubtitlesButton,_TextTrackButton),SubtitlesButton.prototype.buildCSSClass=function(){return"vjs-subtitles-button "+_TextTrackButton.prototype.buildCSSClass.call(this)},SubtitlesButton}(_textTrackButton2.default);SubtitlesButton.prototype.kind_="subtitles",SubtitlesButton.prototype.controlText_="Subtitles",_component2.default.registerComponent("SubtitlesButton",SubtitlesButton),exports.default=SubtitlesButton},{30:30,5:5}],30:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _trackButton2=_interopRequireDefault(_dereq_(36)),_component2=_interopRequireDefault(_dereq_(5)),_textTrackMenuItem2=_interopRequireDefault(_dereq_(31)),_offTextTrackMenuItem2=_interopRequireDefault(_dereq_(28)),TextTrackButton=function(_TrackButton){function TextTrackButton(player){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,TextTrackButton),options.tracks=player.textTracks(),_possibleConstructorReturn(this,_TrackButton.call(this,player,options))}return _inherits(TextTrackButton,_TrackButton),TextTrackButton.prototype.createItems=function(){var items=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];items.push(new _offTextTrackMenuItem2.default(this.player_,{kind:this.kind_})),this.hideThreshold_+=1;var tracks=this.player_.textTracks();if(!tracks)return items;for(var i=0;i<tracks.length;i++){var track=tracks[i];track.kind===this.kind_&&items.push(new _textTrackMenuItem2.default(this.player_,{track:track,selectable:!0}))}return items},TextTrackButton}(_trackButton2.default);_component2.default.registerComponent("TextTrackButton",TextTrackButton),exports.default=TextTrackButton},{28:28,31:31,36:36,5:5}],31:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_menuItem2=_interopRequireDefault(_dereq_(48)),_component2=_interopRequireDefault(_dereq_(5)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),_window2=_interopRequireDefault(_dereq_(95)),_document2=_interopRequireDefault(_dereq_(94)),TextTrackMenuItem=function(_MenuItem){function TextTrackMenuItem(player,options){_classCallCheck(this,TextTrackMenuItem);var track=options.track,tracks=player.textTracks();options.label=track.label||track.language||"Unknown",options.selected=track.default||"showing"===track.mode;var _this=_possibleConstructorReturn(this,_MenuItem.call(this,player,options));if(_this.track=track,tracks){var changeHandler=Fn.bind(_this,_this.handleTracksChange);player.on(["loadstart","texttrackchange"],changeHandler),tracks.addEventListener("change",changeHandler),_this.on("dispose",function(){tracks.removeEventListener("change",changeHandler)})}if(tracks&&void 0===tracks.onchange){var event=void 0;_this.on(["tap","click"],function(){if("object"!==_typeof(_window2.default.Event))try{event=new _window2.default.Event("change")}catch(err){}event||(event=_document2.default.createEvent("Event")).initEvent("change",!0,!0),tracks.dispatchEvent(event)})}return _this}return _inherits(TextTrackMenuItem,_MenuItem),TextTrackMenuItem.prototype.handleClick=function(event){var kind=this.track.kind,tracks=this.player_.textTracks();if(_MenuItem.prototype.handleClick.call(this,event),tracks)for(var i=0;i<tracks.length;i++){var track=tracks[i];track.kind===kind&&(track===this.track?"showing"!==track.mode&&(track.mode="showing"):"disabled"!==track.mode&&(track.mode="disabled"))}},TextTrackMenuItem.prototype.handleTracksChange=function(event){this.selected("showing"===this.track.mode)},TextTrackMenuItem}(_menuItem2.default);_component2.default.registerComponent("TextTrackMenuItem",TextTrackMenuItem),exports.default=TextTrackMenuItem},{48:48,5:5,83:83,94:94,95:95}],32:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),Dom=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(81)),_formatTime2=_interopRequireDefault(_dereq_(84)),CurrentTimeDisplay=function(_Component){function CurrentTimeDisplay(player,options){_classCallCheck(this,CurrentTimeDisplay);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.on(player,"timeupdate",_this.updateContent),_this}return _inherits(CurrentTimeDisplay,_Component),CurrentTimeDisplay.prototype.createEl=function(){var el=_Component.prototype.createEl.call(this,"div",{className:"vjs-current-time vjs-time-control vjs-control"});return this.contentEl_=Dom.createEl("div",{className:"vjs-current-time-display",innerHTML:'<span class="vjs-control-text">Current Time </span>0:00'},{"aria-live":"off"}),el.appendChild(this.contentEl_),el},CurrentTimeDisplay.prototype.updateContent=function(event){var time=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),localizedText=this.localize("Current Time"),formattedTime=(0,_formatTime2.default)(time,this.player_.duration());formattedTime!==this.formattedTime_&&(this.formattedTime_=formattedTime,this.contentEl_.innerHTML='<span class="vjs-control-text">'+localizedText+"</span> "+formattedTime)},CurrentTimeDisplay}(_component2.default);_component2.default.registerComponent("CurrentTimeDisplay",CurrentTimeDisplay),exports.default=CurrentTimeDisplay},{5:5,81:81,84:84}],33:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),Dom=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(81)),_formatTime2=_interopRequireDefault(_dereq_(84)),DurationDisplay=function(_Component){function DurationDisplay(player,options){_classCallCheck(this,DurationDisplay);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.on(player,"durationchange",_this.updateContent),_this.on(player,"timeupdate",_this.updateContent),_this.on(player,"loadedmetadata",_this.updateContent),_this}return _inherits(DurationDisplay,_Component),DurationDisplay.prototype.createEl=function(){var el=_Component.prototype.createEl.call(this,"div",{className:"vjs-duration vjs-time-control vjs-control"});return this.contentEl_=Dom.createEl("div",{className:"vjs-duration-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Duration Time")+"</span> 0:00"},{"aria-live":"off"}),el.appendChild(this.contentEl_),el},DurationDisplay.prototype.updateContent=function(event){var duration=this.player_.duration();if(duration&&this.duration_!==duration){this.duration_=duration;var localizedText=this.localize("Duration Time"),formattedTime=(0,_formatTime2.default)(duration);this.contentEl_.innerHTML='<span class="vjs-control-text">'+localizedText+"</span> "+formattedTime}},DurationDisplay}(_component2.default);_component2.default.registerComponent("DurationDisplay",DurationDisplay),exports.default=DurationDisplay},{5:5,81:81,84:84}],34:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),Dom=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(81)),_formatTime2=_interopRequireDefault(_dereq_(84)),RemainingTimeDisplay=function(_Component){function RemainingTimeDisplay(player,options){_classCallCheck(this,RemainingTimeDisplay);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.on(player,"timeupdate",_this.updateContent),_this.on(player,"durationchange",_this.updateContent),_this}return _inherits(RemainingTimeDisplay,_Component),RemainingTimeDisplay.prototype.createEl=function(){var el=_Component.prototype.createEl.call(this,"div",{className:"vjs-remaining-time vjs-time-control vjs-control"});return this.contentEl_=Dom.createEl("div",{className:"vjs-remaining-time-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Remaining Time")+"</span> -0:00"},{"aria-live":"off"}),el.appendChild(this.contentEl_),el},RemainingTimeDisplay.prototype.updateContent=function(event){if(this.player_.duration()){var localizedText=this.localize("Remaining Time"),formattedTime=(0,_formatTime2.default)(this.player_.remainingTime());formattedTime!==this.formattedTime_&&(this.formattedTime_=formattedTime,this.contentEl_.innerHTML='<span class="vjs-control-text">'+localizedText+"</span> -"+formattedTime)}},RemainingTimeDisplay}(_component2.default);_component2.default.registerComponent("RemainingTimeDisplay",RemainingTimeDisplay),exports.default=RemainingTimeDisplay},{5:5,81:81,84:84}],35:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5)),TimeDivider=function(_Component){function TimeDivider(){return _classCallCheck(this,TimeDivider),_possibleConstructorReturn(this,_Component.apply(this,arguments))}return _inherits(TimeDivider,_Component),TimeDivider.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/</span></div>"})},TimeDivider}(_component2.default);_component2.default.registerComponent("TimeDivider",TimeDivider),exports.default=TimeDivider},{5:5}],36:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _menuButton2=_interopRequireDefault(_dereq_(47)),_component2=_interopRequireDefault(_dereq_(5)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),TrackButton=function(_MenuButton){function TrackButton(player,options){_classCallCheck(this,TrackButton);var tracks=options.tracks,_this=_possibleConstructorReturn(this,_MenuButton.call(this,player,options));if(_this.items.length<=1&&_this.hide(),!tracks)return _possibleConstructorReturn(_this);var updateHandler=Fn.bind(_this,_this.update);return tracks.addEventListener("removetrack",updateHandler),tracks.addEventListener("addtrack",updateHandler),_this.player_.on("dispose",function(){tracks.removeEventListener("removetrack",updateHandler),tracks.removeEventListener("addtrack",updateHandler)}),_this}return _inherits(TrackButton,_MenuButton),TrackButton}(_menuButton2.default);_component2.default.registerComponent("TrackButton",TrackButton),exports.default=TrackButton},{47:47,5:5,83:83}],37:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _slider2=_interopRequireDefault(_dereq_(57)),_component2=_interopRequireDefault(_dereq_(5)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83));_dereq_(39);var VolumeBar=function(_Slider){function VolumeBar(player,options){_classCallCheck(this,VolumeBar);var _this=_possibleConstructorReturn(this,_Slider.call(this,player,options));return _this.on(player,"volumechange",_this.updateARIAAttributes),player.ready(Fn.bind(_this,_this.updateARIAAttributes)),_this}return _inherits(VolumeBar,_Slider),VolumeBar.prototype.createEl=function(){return _Slider.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":"volume level"})},VolumeBar.prototype.handleMouseMove=function(event){this.checkMuted(),this.player_.volume(this.calculateDistance(event))},VolumeBar.prototype.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},VolumeBar.prototype.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},VolumeBar.prototype.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},VolumeBar.prototype.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},VolumeBar.prototype.updateARIAAttributes=function(event){var volume=(100*this.player_.volume()).toFixed(2);this.el_.setAttribute("aria-valuenow",volume),this.el_.setAttribute("aria-valuetext",volume+"%")},VolumeBar}(_slider2.default);VolumeBar.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},VolumeBar.prototype.playerEvent="volumechange",_component2.default.registerComponent("VolumeBar",VolumeBar),exports.default=VolumeBar},{39:39,5:5,57:57,83:83}],38:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5));_dereq_(37);var VolumeControl=function(_Component){function VolumeControl(player,options){_classCallCheck(this,VolumeControl);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return player.tech_&&!1===player.tech_.featuresVolumeControl&&_this.addClass("vjs-hidden"),_this.on(player,"loadstart",function(){!1===player.tech_.featuresVolumeControl?this.addClass("vjs-hidden"):this.removeClass("vjs-hidden")}),_this}return _inherits(VolumeControl,_Component),VolumeControl.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control"})},VolumeControl}(_component2.default);VolumeControl.prototype.options_={children:["volumeBar"]},_component2.default.registerComponent("VolumeControl",VolumeControl),exports.default=VolumeControl},{37:37,5:5}],39:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5)),VolumeLevel=function(_Component){function VolumeLevel(){return _classCallCheck(this,VolumeLevel),_possibleConstructorReturn(this,_Component.apply(this,arguments))}return _inherits(VolumeLevel,_Component),VolumeLevel.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})},VolumeLevel}(_component2.default);_component2.default.registerComponent("VolumeLevel",VolumeLevel),exports.default=VolumeLevel},{5:5}],40:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),_component2=_interopRequireDefault(_dereq_(5)),_popup2=_interopRequireDefault(_dereq_(54)),_popupButton2=_interopRequireDefault(_dereq_(53)),_muteToggle2=_interopRequireDefault(_dereq_(11)),_volumeBar2=_interopRequireDefault(_dereq_(37)),VolumeMenuButton=function(_PopupButton){function VolumeMenuButton(player){function updateVisibility(){player.tech_&&!1===player.tech_.featuresVolumeControl?this.addClass("vjs-hidden"):this.removeClass("vjs-hidden")}var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,VolumeMenuButton),void 0===options.inline&&(options.inline=!0),void 0===options.vertical&&(options.inline?options.vertical=!1:options.vertical=!0),options.volumeBar=options.volumeBar||{},options.volumeBar.vertical=!!options.vertical;var _this=_possibleConstructorReturn(this,_PopupButton.call(this,player,options));return _this.on(player,"volumechange",_this.volumeUpdate),_this.on(player,"loadstart",_this.volumeUpdate),updateVisibility.call(_this),_this.on(player,"loadstart",updateVisibility),_this.on(_this.volumeBar,["slideractive","focus"],function(){this.addClass("vjs-slider-active")}),_this.on(_this.volumeBar,["sliderinactive","blur"],function(){this.removeClass("vjs-slider-active")}),_this.on(_this.volumeBar,["focus"],function(){this.addClass("vjs-lock-showing")}),_this.on(_this.volumeBar,["blur"],function(){this.removeClass("vjs-lock-showing")}),_this}return _inherits(VolumeMenuButton,_PopupButton),VolumeMenuButton.prototype.buildCSSClass=function(){var orientationClass="";return orientationClass=this.options_.vertical?"vjs-volume-menu-button-vertical":"vjs-volume-menu-button-horizontal","vjs-volume-menu-button "+_PopupButton.prototype.buildCSSClass.call(this)+" "+orientationClass},VolumeMenuButton.prototype.createPopup=function(){var popup=new _popup2.default(this.player_,{contentElType:"div"}),vb=new _volumeBar2.default(this.player_,this.options_.volumeBar);return popup.addChild(vb),this.menuContent=popup,this.volumeBar=vb,this.attachVolumeBarEvents(),popup},VolumeMenuButton.prototype.handleClick=function(event){_muteToggle2.default.prototype.handleClick.call(this),_PopupButton.prototype.handleClick.call(this)},VolumeMenuButton.prototype.attachVolumeBarEvents=function(){this.menuContent.on(["mousedown","touchdown"],Fn.bind(this,this.handleMouseDown))},VolumeMenuButton.prototype.handleMouseDown=function(event){this.on(["mousemove","touchmove"],Fn.bind(this.volumeBar,this.volumeBar.handleMouseMove)),this.on(this.el_.ownerDocument,["mouseup","touchend"],this.handleMouseUp)},VolumeMenuButton.prototype.handleMouseUp=function(event){this.off(["mousemove","touchmove"],Fn.bind(this.volumeBar,this.volumeBar.handleMouseMove))},VolumeMenuButton}(_popupButton2.default);VolumeMenuButton.prototype.volumeUpdate=_muteToggle2.default.prototype.update,VolumeMenuButton.prototype.controlText_="Mute",_component2.default.registerComponent("VolumeMenuButton",VolumeMenuButton),exports.default=VolumeMenuButton},{11:11,37:37,5:5,53:53,54:54,83:83}],41:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),_modalDialog2=_interopRequireDefault(_dereq_(50)),_mergeOptions2=_interopRequireDefault(_dereq_(87)),ErrorDisplay=function(_ModalDialog){function ErrorDisplay(player,options){_classCallCheck(this,ErrorDisplay);var _this=_possibleConstructorReturn(this,_ModalDialog.call(this,player,options));return _this.on(player,"error",_this.open),_this}return _inherits(ErrorDisplay,_ModalDialog),ErrorDisplay.prototype.buildCSSClass=function(){return"vjs-error-display "+_ModalDialog.prototype.buildCSSClass.call(this)},ErrorDisplay.prototype.content=function(){var error=this.player().error();return error?this.localize(error.message):""},ErrorDisplay}(_modalDialog2.default);ErrorDisplay.prototype.options_=(0,_mergeOptions2.default)(_modalDialog2.default.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),_component2.default.registerComponent("ErrorDisplay",ErrorDisplay),exports.default=ErrorDisplay},{5:5,50:50,87:87}],42:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0;var Events=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(82)),EventTarget=function(){};EventTarget.prototype.allowedEvents_={},EventTarget.prototype.on=function(type,fn){var ael=this.addEventListener;this.addEventListener=function(){},Events.on(this,type,fn),this.addEventListener=ael},EventTarget.prototype.addEventListener=EventTarget.prototype.on,EventTarget.prototype.off=function(type,fn){Events.off(this,type,fn)},EventTarget.prototype.removeEventListener=EventTarget.prototype.off,EventTarget.prototype.one=function(type,fn){var ael=this.addEventListener;this.addEventListener=function(){},Events.one(this,type,fn),this.addEventListener=ael},EventTarget.prototype.trigger=function(event){var type=event.type||event;"string"==typeof event&&(event={type:type}),event=Events.fixEvent(event),this.allowedEvents_[type]&&this["on"+type]&&this["on"+type](event),Events.trigger(this,event)},EventTarget.prototype.dispatchEvent=EventTarget.prototype.trigger,exports.default=EventTarget},{82:82}],43:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_log2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(86)),_obj=_dereq_(88),_inherits=function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+(void 0===superClass?"undefined":_typeof(superClass)));subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(subClass.super_=superClass)};exports.default=function(superClass){var subClassMethods=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},subClass=function(){superClass.apply(this,arguments)},methods={};(0,_obj.isObject)(subClassMethods)?("function"==typeof subClassMethods.init&&(_log2.default.warn("Constructor logic via init() is deprecated; please use constructor() instead."),subClassMethods.constructor=subClassMethods.init),subClassMethods.constructor!==Object.prototype.constructor&&(subClass=subClassMethods.constructor),methods=subClassMethods):"function"==typeof subClassMethods&&(subClass=subClassMethods),_inherits(subClass,superClass);for(var name in methods)methods.hasOwnProperty(name)&&(subClass.prototype[name]=methods[name]);return subClass}},{86:86,88:88}],44:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0;for(var _document2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(94)),FullscreenApi={},apiMap=[["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"]],specApi=apiMap[0],browserApi=void 0,i=0;i<apiMap.length;i++)if(apiMap[i][1]in _document2.default){browserApi=apiMap[i];break}if(browserApi)for(var _i=0;_i<browserApi.length;_i++)FullscreenApi[specApi[_i]]=browserApi[_i];exports.default=FullscreenApi},{94:94}],45:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5)),LoadingSpinner=function(_Component){function LoadingSpinner(){return _classCallCheck(this,LoadingSpinner),_possibleConstructorReturn(this,_Component.apply(this,arguments))}return _inherits(LoadingSpinner,_Component),LoadingSpinner.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"})},LoadingSpinner}(_component2.default);_component2.default.registerComponent("LoadingSpinner",LoadingSpinner),exports.default=LoadingSpinner},{5:5}],46:[function(_dereq_,module,exports){"use strict";function MediaError(value){if(value instanceof MediaError)return value;"number"==typeof value?this.code=value:"string"==typeof value?this.message=value:(0,_obj.isObject)(value)&&("number"==typeof value.code&&(this.code=value.code),(0,_obj.assign)(this,value)),this.message||(this.message=MediaError.defaultMessages[this.code]||"")}exports.__esModule=!0;var _obj=_dereq_(88);MediaError.prototype.code=0,MediaError.prototype.message="",MediaError.prototype.status=null,MediaError.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],MediaError.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var errNum=0;errNum<MediaError.errorTypes.length;errNum++)MediaError[MediaError.errorTypes[errNum]]=errNum,MediaError.prototype[MediaError.errorTypes[errNum]]=errNum;exports.default=MediaError},{88:88}],47:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _clickableComponent2=_interopRequireDefault(_dereq_(3)),_component2=_interopRequireDefault(_dereq_(5)),_menu2=_interopRequireDefault(_dereq_(49)),Dom=_interopRequireWildcard(_dereq_(81)),Fn=_interopRequireWildcard(_dereq_(83)),_toTitleCase2=_interopRequireDefault(_dereq_(91)),MenuButton=function(_ClickableComponent){function MenuButton(player){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,MenuButton);var _this=_possibleConstructorReturn(this,_ClickableComponent.call(this,player,options));return _this.update(),_this.enabled_=!0,_this.el_.setAttribute("aria-haspopup","true"),_this.el_.setAttribute("role","menuitem"),_this.on("keydown",_this.handleSubmenuKeyPress),_this}return _inherits(MenuButton,_ClickableComponent),MenuButton.prototype.update=function(){var menu=this.createMenu();this.menu&&this.removeChild(this.menu),this.menu=menu,this.addChild(menu),this.buttonPressed_=!1,this.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},MenuButton.prototype.createMenu=function(){var menu=new _menu2.default(this.player_);if(this.hideThreshold_=0,this.options_.title){var title=Dom.createEl("li",{className:"vjs-menu-title",innerHTML:(0,_toTitleCase2.default)(this.options_.title),tabIndex:-1});this.hideThreshold_+=1,menu.children_.unshift(title),Dom.insertElFirst(title,menu.contentEl())}if(this.items=this.createItems(),this.items)for(var i=0;i<this.items.length;i++)menu.addItem(this.items[i]);return menu},MenuButton.prototype.createItems=function(){},MenuButton.prototype.createEl=function(){return _ClickableComponent.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},MenuButton.prototype.buildCSSClass=function(){var menuButtonClass="vjs-menu-button";return!0===this.options_.inline?menuButtonClass+="-inline":menuButtonClass+="-popup","vjs-menu-button "+menuButtonClass+" "+_ClickableComponent.prototype.buildCSSClass.call(this)},MenuButton.prototype.handleClick=function(event){this.one(this.menu.contentEl(),"mouseleave",Fn.bind(this,function(e){this.unpressButton(),this.el_.blur()})),this.buttonPressed_?this.unpressButton():this.pressButton()},MenuButton.prototype.handleKeyPress=function(event){27===event.which||9===event.which?(this.buttonPressed_&&this.unpressButton(),9!==event.which&&event.preventDefault()):38===event.which||40===event.which?this.buttonPressed_||(this.pressButton(),event.preventDefault()):_ClickableComponent.prototype.handleKeyPress.call(this,event)},MenuButton.prototype.handleSubmenuKeyPress=function(event){27!==event.which&&9!==event.which||(this.buttonPressed_&&this.unpressButton(),9!==event.which&&event.preventDefault())},MenuButton.prototype.pressButton=function(){this.enabled_&&(this.buttonPressed_=!0,this.menu.lockShowing(),this.el_.setAttribute("aria-expanded","true"),this.menu.focus())},MenuButton.prototype.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.el_.setAttribute("aria-expanded","false"),this.el_.focus())},MenuButton.prototype.disable=function(){return this.buttonPressed_=!1,this.menu.unlockShowing(),this.el_.setAttribute("aria-expanded","false"),this.enabled_=!1,_ClickableComponent.prototype.disable.call(this)},MenuButton.prototype.enable=function(){return this.enabled_=!0,_ClickableComponent.prototype.enable.call(this)},MenuButton}(_clickableComponent2.default);_component2.default.registerComponent("MenuButton",MenuButton),exports.default=MenuButton},{3:3,49:49,5:5,81:81,83:83,91:91}],48:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _clickableComponent2=_interopRequireDefault(_dereq_(3)),_component2=_interopRequireDefault(_dereq_(5)),_obj=_dereq_(88),MenuItem=function(_ClickableComponent){function MenuItem(player,options){_classCallCheck(this,MenuItem);var _this=_possibleConstructorReturn(this,_ClickableComponent.call(this,player,options));return _this.selectable=options.selectable,_this.selected(options.selected),_this.selectable?_this.el_.setAttribute("role","menuitemcheckbox"):_this.el_.setAttribute("role","menuitem"),_this}return _inherits(MenuItem,_ClickableComponent),MenuItem.prototype.createEl=function(type,props,attrs){return this.nonIconControl=!0,_ClickableComponent.prototype.createEl.call(this,"li",(0,_obj.assign)({className:"vjs-menu-item",innerHTML:this.localize(this.options_.label),tabIndex:-1},props),attrs)},MenuItem.prototype.handleClick=function(event){this.selected(!0)},MenuItem.prototype.selected=function(_selected){this.selectable&&(_selected?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected")):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(" ")))},MenuItem}(_clickableComponent2.default);_component2.default.registerComponent("MenuItem",MenuItem),exports.default=MenuItem},{3:3,5:5,88:88}],49:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5)),Dom=_interopRequireWildcard(_dereq_(81)),Fn=_interopRequireWildcard(_dereq_(83)),Events=_interopRequireWildcard(_dereq_(82)),Menu=function(_Component){function Menu(player,options){_classCallCheck(this,Menu);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.focusedChild_=-1,_this.on("keydown",_this.handleKeyPress),_this}return _inherits(Menu,_Component),Menu.prototype.addItem=function(component){this.addChild(component),component.on("click",Fn.bind(this,function(event){this.unlockShowing()}))},Menu.prototype.createEl=function(){var contentElType=this.options_.contentElType||"ul";this.contentEl_=Dom.createEl(contentElType,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var el=_Component.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return el.setAttribute("role","presentation"),el.appendChild(this.contentEl_),Events.on(el,"click",function(event){event.preventDefault(),event.stopImmediatePropagation()}),el},Menu.prototype.handleKeyPress=function(event){37===event.which||40===event.which?(event.preventDefault(),this.stepForward()):38!==event.which&&39!==event.which||(event.preventDefault(),this.stepBack())},Menu.prototype.stepForward=function(){var stepChild=0;void 0!==this.focusedChild_&&(stepChild=this.focusedChild_+1),this.focus(stepChild)},Menu.prototype.stepBack=function(){var stepChild=0;void 0!==this.focusedChild_&&(stepChild=this.focusedChild_-1),this.focus(stepChild)},Menu.prototype.focus=function(){var item=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,children=this.children().slice();children.length&&children[0].className&&/vjs-menu-title/.test(children[0].className)&&children.shift(),children.length>0&&(item<0?item=0:item>=children.length&&(item=children.length-1),this.focusedChild_=item,children[item].el_.focus())},Menu}(_component2.default);_component2.default.registerComponent("Menu",Menu),exports.default=Menu},{5:5,81:81,82:82,83:83}],50:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var Dom=_interopRequireWildcard(_dereq_(81)),Fn=_interopRequireWildcard(_dereq_(83)),_component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5)),MODAL_CLASS_NAME="vjs-modal-dialog",ModalDialog=function(_Component){function ModalDialog(player,options){_classCallCheck(this,ModalDialog);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.opened_=_this.hasBeenOpened_=_this.hasBeenFilled_=!1,_this.closeable(!_this.options_.uncloseable),_this.content(_this.options_.content),_this.contentEl_=Dom.createEl("div",{className:MODAL_CLASS_NAME+"-content"},{role:"document"}),_this.descEl_=Dom.createEl("p",{className:MODAL_CLASS_NAME+"-description vjs-offscreen",id:_this.el().getAttribute("aria-describedby")}),Dom.textContent(_this.descEl_,_this.description()),_this.el_.appendChild(_this.descEl_),_this.el_.appendChild(_this.contentEl_),_this}return _inherits(ModalDialog,_Component),ModalDialog.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},ModalDialog.prototype.buildCSSClass=function(){return MODAL_CLASS_NAME+" vjs-hidden "+_Component.prototype.buildCSSClass.call(this)},ModalDialog.prototype.handleKeyPress=function(e){27===e.which&&this.closeable()&&this.close()},ModalDialog.prototype.label=function(){return this.options_.label||this.localize("Modal Window")},ModalDialog.prototype.description=function(){var desc=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(desc+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),desc},ModalDialog.prototype.open=function(){if(!this.opened_){var player=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!player.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&player.pause(),this.closeable()&&this.on(this.el_.ownerDocument,"keydown",Fn.bind(this,this.handleKeyPress)),player.controls(!1),this.show(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}return this},ModalDialog.prototype.opened=function(value){return"boolean"==typeof value&&this[value?"open":"close"](),this.opened_},ModalDialog.prototype.close=function(){if(this.opened_){var player=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&player.play(),this.closeable()&&this.off(this.el_.ownerDocument,"keydown",Fn.bind(this,this.handleKeyPress)),player.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.options_.temporary&&this.dispose()}return this},ModalDialog.prototype.closeable=function(value){if("boolean"==typeof value){var closeable=this.closeable_=!!value,close=this.getChild("closeButton");if(closeable&&!close){var temp=this.contentEl_;this.contentEl_=this.el_,close=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=temp,this.on(close,"close",this.close)}!closeable&&close&&(this.off(close,"close",this.close),this.removeChild(close),close.dispose())}return this.closeable_},ModalDialog.prototype.fill=function(){return this.fillWith(this.content())},ModalDialog.prototype.fillWith=function(content){var contentEl=this.contentEl(),parentEl=contentEl.parentNode,nextSiblingEl=contentEl.nextSibling;return this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,parentEl.removeChild(contentEl),this.empty(),Dom.insertContent(contentEl,content),this.trigger("modalfill"),nextSiblingEl?parentEl.insertBefore(contentEl,nextSiblingEl):parentEl.appendChild(contentEl),this},ModalDialog.prototype.empty=function(){return this.trigger("beforemodalempty"),Dom.emptyEl(this.contentEl()),this.trigger("modalempty"),this},ModalDialog.prototype.content=function(value){return void 0!==value&&(this.content_=value),this.content_},ModalDialog}(_component2.default);ModalDialog.prototype.options_={pauseOnOpen:!0,temporary:!0},_component2.default.registerComponent("ModalDialog",ModalDialog),exports.default=ModalDialog},{5:5,81:81,83:83}],51:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),_document2=_interopRequireDefault(_dereq_(94)),_window2=_interopRequireDefault(_dereq_(95)),Events=_interopRequireWildcard(_dereq_(82)),Dom=_interopRequireWildcard(_dereq_(81)),Fn=_interopRequireWildcard(_dereq_(83)),Guid=_interopRequireWildcard(_dereq_(85)),browser=_interopRequireWildcard(_dereq_(78)),_log2=_interopRequireDefault(_dereq_(86)),_toTitleCase2=_interopRequireDefault(_dereq_(91)),_timeRanges=_dereq_(90),_buffer=_dereq_(79),stylesheet=_interopRequireWildcard(_dereq_(89)),_fullscreenApi2=_interopRequireDefault(_dereq_(44)),_mediaError2=_interopRequireDefault(_dereq_(46)),_tuple2=_interopRequireDefault(_dereq_(97)),_obj=_dereq_(88),_mergeOptions2=_interopRequireDefault(_dereq_(87)),_textTrackListConverter2=_interopRequireDefault(_dereq_(69)),_modalDialog2=_interopRequireDefault(_dereq_(50)),_tech2=_interopRequireDefault(_dereq_(62)),_audioTrackList2=_interopRequireDefault(_dereq_(63)),_videoTrackList2=_interopRequireDefault(_dereq_(76));_dereq_(61),_dereq_(59),_dereq_(55),_dereq_(68),_dereq_(45),_dereq_(1),_dereq_(4),_dereq_(8),_dereq_(41),_dereq_(71),_dereq_(60);var TECH_EVENTS_RETRIGGER=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","ratechange","volumechange","texttrackchange"],Player=function(_Component){function Player(tag,options,ready){if(_classCallCheck(this,Player),tag.id=tag.id||"vjs_video_"+Guid.newGUID(),options=(0,_obj.assign)(Player.getTagSettings(tag),options),options.initChildren=!1,options.createEl=!1,options.reportTouchActivity=!1,!options.language)if("function"==typeof tag.closest){var closest=tag.closest("[lang]");closest&&(options.language=closest.getAttribute("lang"))}else for(var element=tag;element&&1===element.nodeType;){if(Dom.getElAttributes(element).hasOwnProperty("lang")){options.language=element.getAttribute("lang");break}element=element.parentNode}var _this=_possibleConstructorReturn(this,_Component.call(this,null,options,ready));if(!_this.options_||!_this.options_.techOrder||!_this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(_this.tag=tag,_this.tagAttributes=tag&&Dom.getElAttributes(tag),_this.language(_this.options_.language),options.languages){var languagesToLower={};Object.getOwnPropertyNames(options.languages).forEach(function(name){languagesToLower[name.toLowerCase()]=options.languages[name]}),_this.languages_=languagesToLower}else _this.languages_=Player.prototype.options_.languages;_this.cache_={},_this.poster_=options.poster||"",_this.controls_=!!options.controls,tag.controls=!1,_this.scrubbing_=!1,_this.el_=_this.createEl();var playerOptionsCopy=(0,_mergeOptions2.default)(_this.options_);if(options.plugins){var plugins=options.plugins;Object.getOwnPropertyNames(plugins).forEach(function(name){"function"==typeof this[name]?this[name](plugins[name]):_log2.default.error("Unable to find plugin:",name)},_this)}_this.options_.playerOptions=playerOptionsCopy,_this.initChildren(),_this.isAudio("audio"===tag.nodeName.toLowerCase()),_this.controls()?_this.addClass("vjs-controls-enabled"):_this.addClass("vjs-controls-disabled"),_this.el_.setAttribute("role","region"),_this.isAudio()?_this.el_.setAttribute("aria-label","audio player"):_this.el_.setAttribute("aria-label","video player"),_this.isAudio()&&_this.addClass("vjs-audio"),_this.flexNotSupported_()&&_this.addClass("vjs-no-flex"),browser.IS_IOS||_this.addClass("vjs-workinghover"),Player.players[_this.id_]=_this;var majorVersion="5.20.2".split(".")[0];return _this.addClass("vjs-v"+majorVersion),_this.userActive(!0),_this.reportUserActivity(),_this.listenForUserActivity_(),_this.on("fullscreenchange",_this.handleFullscreenChange_),_this.on("stageclick",_this.handleStageClick_),_this}return _inherits(Player,_Component),Player.prototype.dispose=function(){this.trigger("dispose"),this.off("dispose"),this.styleEl_&&this.styleEl_.parentNode&&this.styleEl_.parentNode.removeChild(this.styleEl_),Player.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&this.tech_.dispose(),_Component.prototype.dispose.call(this)},Player.prototype.createEl=function(){var tag=this.tag,el=void 0,playerElIngest=this.playerElIngest_=tag.parentNode&&tag.parentNode.hasAttribute&&tag.parentNode.hasAttribute("data-vjs-player");el=this.el_=playerElIngest?tag.parentNode:_Component.prototype.createEl.call(this,"div"),tag.setAttribute("tabindex","-1"),tag.removeAttribute("width"),tag.removeAttribute("height");var attrs=Dom.getElAttributes(tag);if(Object.getOwnPropertyNames(attrs).forEach(function(attr){"class"===attr?el.className+=" "+attrs[attr]:el.setAttribute(attr,attrs[attr])}),tag.playerId=tag.id,tag.id+="_html5_api",tag.className="vjs-tech",tag.player=el.player=this,this.addClass("vjs-paused"),!0!==_window2.default.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=stylesheet.createStyleElement("vjs-styles-dimensions");var defaultsStyleEl=Dom.$(".vjs-styles-defaults"),head=Dom.$("head");head.insertBefore(this.styleEl_,defaultsStyleEl?defaultsStyleEl.nextSibling:head.firstChild)}this.width(this.options_.width),this.height(this.options_.height),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio);for(var links=tag.getElementsByTagName("a"),i=0;i<links.length;i++){var linkEl=links.item(i);Dom.addElClass(linkEl,"vjs-hidden"),linkEl.setAttribute("hidden","hidden")}return tag.initNetworkState_=tag.networkState,tag.parentNode&&!playerElIngest&&tag.parentNode.insertBefore(el,tag),Dom.insertElFirst(tag,el),this.children_.unshift(tag),this.el_=el,el},Player.prototype.width=function(value){return this.dimension("width",value)},Player.prototype.height=function(value){return this.dimension("height",value)},Player.prototype.dimension=function(_dimension,value){var privDimension=_dimension+"_";if(void 0===value)return this[privDimension]||0;if(""===value)this[privDimension]=void 0;else{var parsedVal=parseFloat(value);if(isNaN(parsedVal))return _log2.default.error('Improper value "'+value+'" supplied for for '+_dimension),this;this[privDimension]=parsedVal}return this.updateStyleEl_(),this},Player.prototype.fluid=function(bool){if(void 0===bool)return!!this.fluid_;this.fluid_=!!bool,bool?this.addClass("vjs-fluid"):this.removeClass("vjs-fluid"),this.updateStyleEl_()},Player.prototype.aspectRatio=function(ratio){if(void 0===ratio)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(ratio))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=ratio,this.fluid(!0),this.updateStyleEl_()},Player.prototype.updateStyleEl_=function(){if(!0!==_window2.default.VIDEOJS_NO_DYNAMIC_STYLE){var width=void 0,height=void 0,aspectRatio=void 0,idClass=void 0,ratioParts=(aspectRatio=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),ratioMultiplier=ratioParts[1]/ratioParts[0];width=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/ratioMultiplier:this.videoWidth()||300,height=void 0!==this.height_?this.height_:width*ratioMultiplier,idClass=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(idClass),stylesheet.setTextContent(this.styleEl_,"\n      ."+idClass+" {\n        width: "+width+"px;\n        height: "+height+"px;\n      }\n\n      ."+idClass+".vjs-fluid {\n        padding-top: "+100*ratioMultiplier+"%;\n      }\n    ")}else{var _width="number"==typeof this.width_?this.width_:this.options_.width,_height="number"==typeof this.height_?this.height_:this.options_.height,techEl=this.tech_&&this.tech_.el();techEl&&(_width>=0&&(techEl.width=_width),_height>=0&&(techEl.height=_height))}},Player.prototype.loadTech_=function(techName,source){var _this2=this;this.tech_&&this.unloadTech_(),"Html5"!==techName&&this.tag&&(_tech2.default.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=techName,this.isReady_=!1;var techOptions=(0,_obj.assign)({source:source,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+techName+"_api",videoTracks:this.videoTracks_,textTracks:this.textTracks_,audioTracks:this.audioTracks_,autoplay:this.options_.autoplay,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"]},this.options_[techName.toLowerCase()]);this.tag&&(techOptions.tag=this.tag),source&&(this.currentType_=source.type,source.src===this.cache_.src&&this.cache_.currentTime>0&&(techOptions.startTime=this.cache_.currentTime),this.cache_.sources=null,this.cache_.source=source,this.cache_.src=source.src);var TechComponent=_tech2.default.getTech(techName);TechComponent||(TechComponent=_component2.default.getComponent(techName)),this.tech_=new TechComponent(techOptions),this.tech_.ready(Fn.bind(this,this.handleTechReady_),!0),_textTrackListConverter2.default.jsonToTextTracks(this.textTracksJson_||[],this.tech_),TECH_EVENTS_RETRIGGER.forEach(function(event){_this2.on(_this2.tech_,event,_this2["handleTech"+(0,_toTitleCase2.default)(event)+"_"])}),this.on(this.tech_,"loadstart",this.handleTechLoadStart_),this.on(this.tech_,"waiting",this.handleTechWaiting_),this.on(this.tech_,"canplay",this.handleTechCanPlay_),this.on(this.tech_,"canplaythrough",this.handleTechCanPlayThrough_),this.on(this.tech_,"playing",this.handleTechPlaying_),this.on(this.tech_,"ended",this.handleTechEnded_),this.on(this.tech_,"seeking",this.handleTechSeeking_),this.on(this.tech_,"seeked",this.handleTechSeeked_),this.on(this.tech_,"play",this.handleTechPlay_),this.on(this.tech_,"firstplay",this.handleTechFirstPlay_),this.on(this.tech_,"pause",this.handleTechPause_),this.on(this.tech_,"durationchange",this.handleTechDurationChange_),this.on(this.tech_,"fullscreenchange",this.handleTechFullscreenChange_),this.on(this.tech_,"error",this.handleTechError_),this.on(this.tech_,"loadedmetadata",this.updateStyleEl_),this.on(this.tech_,"posterchange",this.handleTechPosterChange_),this.on(this.tech_,"textdata",this.handleTechTextData_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===techName&&this.tag||Dom.insertElFirst(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},Player.prototype.unloadTech_=function(){this.videoTracks_=this.videoTracks(),this.textTracks_=this.textTracks(),this.audioTracks_=this.audioTracks(),this.textTracksJson_=_textTrackListConverter2.default.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1},Player.prototype.tech=function(safety){if(safety&&safety.IWillNotUseThisInPlugins)return this.tech_;var errorText="\n      Please make sure that you are not using this inside of a plugin.\n      To disable this alert and error, please pass in an object with\n      `IWillNotUseThisInPlugins` to the `tech` method. See\n      https://github.com/videojs/video.js/issues/2617 for more info.\n    ";throw _window2.default.alert(errorText),new Error(errorText)},Player.prototype.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"mousedown",this.handleTechClick_),this.on(this.tech_,"touchstart",this.handleTechTouchStart_),this.on(this.tech_,"touchmove",this.handleTechTouchMove_),this.on(this.tech_,"touchend",this.handleTechTouchEnd_),this.on(this.tech_,"tap",this.handleTechTap_)},Player.prototype.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_),this.off(this.tech_,"touchstart",this.handleTechTouchStart_),this.off(this.tech_,"touchmove",this.handleTechTouchMove_),this.off(this.tech_,"touchend",this.handleTechTouchEnd_),this.off(this.tech_,"mousedown",this.handleTechClick_)},Player.prototype.handleTechReady_=function(){if(this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_(),(this.src()||this.currentSrc())&&this.tag&&this.options_.autoplay&&this.paused()){try{delete this.tag.poster}catch(e){(0,_log2.default)("deleting tag.poster throws in some browsers",e)}this.play()}},Player.prototype.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay"))},Player.prototype.hasStarted=function(_hasStarted){return void 0!==_hasStarted?(this.hasStarted_!==_hasStarted&&(this.hasStarted_=_hasStarted,_hasStarted?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started")),this):!!this.hasStarted_},Player.prototype.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},Player.prototype.handleTechWaiting_=function(){var _this3=this;this.addClass("vjs-waiting"),this.trigger("waiting"),this.one("timeupdate",function(){return _this3.removeClass("vjs-waiting")})},Player.prototype.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},Player.prototype.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},Player.prototype.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},Player.prototype.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},Player.prototype.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.trigger("seeked")},Player.prototype.handleTechFirstPlay_=function(){this.options_.starttime&&(_log2.default.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},Player.prototype.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},Player.prototype.handleTechEnded_=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},Player.prototype.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},Player.prototype.handleTechClick_=function(event){0===event.button&&this.controls()&&(this.paused()?this.play():this.pause())},Player.prototype.handleTechTap_=function(){this.userActive(!this.userActive())},Player.prototype.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},Player.prototype.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},Player.prototype.handleTechTouchEnd_=function(event){event.preventDefault()},Player.prototype.handleFullscreenChange_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},Player.prototype.handleStageClick_=function(){this.reportUserActivity()},Player.prototype.handleTechFullscreenChange_=function(event,data){data&&this.isFullscreen(data.isFullscreen),this.trigger("fullscreenchange")},Player.prototype.handleTechError_=function(){var error=this.tech_.error();this.error(error)},Player.prototype.handleTechTextData_=function(){var data=null;arguments.length>1&&(data=arguments[1]),this.trigger("textdata",data)},Player.prototype.getCache=function(){return this.cache_},Player.prototype.techCall_=function(method,arg){if(this.tech_&&!this.tech_.isReady_)this.tech_.ready(function(){this[method](arg)},!0);else try{this.tech_&&this.tech_[method](arg)}catch(e){throw(0,_log2.default)(e),e}},Player.prototype.techGet_=function(method){if(this.tech_&&this.tech_.isReady_)try{return this.tech_[method]()}catch(e){throw void 0===this.tech_[method]?(0,_log2.default)("Video.js: "+method+" method not defined for "+this.techName_+" playback technology.",e):"TypeError"===e.name?((0,_log2.default)("Video.js: "+method+" unavailable on "+this.techName_+" playback technology element.",e),this.tech_.isReady_=!1):(0,_log2.default)(e),e}},Player.prototype.play=function(){return this.src()||this.currentSrc()?this.techCall_("play"):this.tech_.one("loadstart",function(){this.play()}),this},Player.prototype.pause=function(){return this.techCall_("pause"),this},Player.prototype.paused=function(){return!1!==this.techGet_("paused")},Player.prototype.scrubbing=function(isScrubbing){return void 0!==isScrubbing?(this.scrubbing_=!!isScrubbing,isScrubbing?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing"),this):this.scrubbing_},Player.prototype.currentTime=function(seconds){return void 0!==seconds?(this.techCall_("setCurrentTime",seconds),this):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},Player.prototype.duration=function(seconds){return void 0===seconds?void 0!==this.cache_.duration?this.cache_.duration:NaN:((seconds=parseFloat(seconds))<0&&(seconds=1/0),seconds!==this.cache_.duration&&(this.cache_.duration=seconds,seconds===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),this.trigger("durationchange")),this)},Player.prototype.remainingTime=function(){return this.duration()-this.currentTime()},Player.prototype.buffered=function(){var buffered=this.techGet_("buffered");return buffered&&buffered.length||(buffered=(0,_timeRanges.createTimeRange)(0,0)),buffered},Player.prototype.bufferedPercent=function(){return(0,_buffer.bufferedPercent)(this.buffered(),this.duration())},Player.prototype.bufferedEnd=function(){var buffered=this.buffered(),duration=this.duration(),end=buffered.end(buffered.length-1);return end>duration&&(end=duration),end},Player.prototype.volume=function(percentAsDecimal){var vol=void 0;return void 0!==percentAsDecimal?(vol=Math.max(0,Math.min(1,parseFloat(percentAsDecimal))),this.cache_.volume=vol,this.techCall_("setVolume",vol),this):(vol=parseFloat(this.techGet_("volume")),isNaN(vol)?1:vol)},Player.prototype.muted=function(_muted){return void 0!==_muted?(this.techCall_("setMuted",_muted),this):this.techGet_("muted")||!1},Player.prototype.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},Player.prototype.isFullscreen=function(isFS){return void 0!==isFS?(this.isFullscreen_=!!isFS,this):!!this.isFullscreen_},Player.prototype.requestFullscreen=function(){var fsApi=_fullscreenApi2.default;return this.isFullscreen(!0),fsApi.requestFullscreen?(Events.on(_document2.default,fsApi.fullscreenchange,Fn.bind(this,function documentFullscreenChange(e){this.isFullscreen(_document2.default[fsApi.fullscreenElement]),!1===this.isFullscreen()&&Events.off(_document2.default,fsApi.fullscreenchange,documentFullscreenChange),this.trigger("fullscreenchange")})),this.el_[fsApi.requestFullscreen]()):this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):(this.enterFullWindow(),this.trigger("fullscreenchange")),this},Player.prototype.exitFullscreen=function(){var fsApi=_fullscreenApi2.default;return this.isFullscreen(!1),fsApi.requestFullscreen?_document2.default[fsApi.exitFullscreen]():this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):(this.exitFullWindow(),this.trigger("fullscreenchange")),this},Player.prototype.enterFullWindow=function(){this.isFullWindow=!0,this.docOrigOverflow=_document2.default.documentElement.style.overflow,Events.on(_document2.default,"keydown",Fn.bind(this,this.fullWindowOnEscKey)),_document2.default.documentElement.style.overflow="hidden",Dom.addElClass(_document2.default.body,"vjs-full-window"),this.trigger("enterFullWindow")},Player.prototype.fullWindowOnEscKey=function(event){27===event.keyCode&&(!0===this.isFullscreen()?this.exitFullscreen():this.exitFullWindow())},Player.prototype.exitFullWindow=function(){this.isFullWindow=!1,Events.off(_document2.default,"keydown",this.fullWindowOnEscKey),_document2.default.documentElement.style.overflow=this.docOrigOverflow,Dom.removeElClass(_document2.default.body,"vjs-full-window"),this.trigger("exitFullWindow")},Player.prototype.canPlayType=function(type){for(var can=void 0,i=0,j=this.options_.techOrder;i<j.length;i++){var techName=(0,_toTitleCase2.default)(j[i]),tech=_tech2.default.getTech(techName);if(tech||(tech=_component2.default.getComponent(techName)),tech){if(tech.isSupported()&&(can=tech.canPlayType(type)))return can}else _log2.default.error('The "'+techName+'" tech is undefined. Skipped browser support check for that tech.')}return""},Player.prototype.selectSource=function(sources){var _this4=this,techs=this.options_.techOrder.map(_toTitleCase2.default).map(function(techName){return[techName,_tech2.default.getTech(techName)||_component2.default.getComponent(techName)]}).filter(function(_ref){var techName=_ref[0],tech=_ref[1];return tech?tech.isSupported():(_log2.default.error('The "'+techName+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),findFirstPassingTechSourcePair=function(outerArray,innerArray,tester){var found=void 0;return outerArray.some(function(outerChoice){return innerArray.some(function(innerChoice){if(found=tester(outerChoice,innerChoice))return!0})}),found},finder=function(_ref2,source){var techName=_ref2[0];if(_ref2[1].canPlaySource(source,_this4.options_[techName.toLowerCase()]))return{source:source,tech:techName}};return(this.options_.sourceOrder?findFirstPassingTechSourcePair(sources,techs,function(fn){return function(a,b){return fn(b,a)}}(finder)):findFirstPassingTechSourcePair(techs,sources,finder))||!1},Player.prototype.src=function(source){if(void 0===source)return this.techGet_("src");var currentTech=_tech2.default.getTech(this.techName_);return currentTech||(currentTech=_component2.default.getComponent(this.techName_)),Array.isArray(source)?this.sourceList_(source):"string"==typeof source?this.src({src:source}):source instanceof Object&&(source.type&&!currentTech.canPlaySource(source,this.options_[this.techName_.toLowerCase()])?this.sourceList_([source]):(this.cache_.sources=null,this.cache_.source=source,this.cache_.src=source.src,this.currentType_=source.type||"",this.ready(function(){currentTech.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",source):this.techCall_("src",source.src),"auto"===this.options_.preload&&this.load(),this.options_.autoplay&&this.play()},!0))),this},Player.prototype.sourceList_=function(sources){var sourceTech=this.selectSource(sources);sourceTech?(sourceTech.tech===this.techName_?this.src(sourceTech.source):this.loadTech_(sourceTech.tech,sourceTech.source),this.cache_.sources=sources):(this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0),this.triggerReady())},Player.prototype.load=function(){return this.techCall_("load"),this},Player.prototype.reset=function(){return this.loadTech_((0,_toTitleCase2.default)(this.options_.techOrder[0]),null),this.techCall_("reset"),this},Player.prototype.currentSources=function(){var source=this.currentSource(),sources=[];return 0!==Object.keys(source).length&&sources.push(source),this.cache_.sources||sources},Player.prototype.currentSource=function(){var source={},src=this.currentSrc();return src&&(source.src=src),this.cache_.source||source},Player.prototype.currentSrc=function(){return this.techGet_("currentSrc")||this.cache_.src||""},Player.prototype.currentType=function(){return this.currentType_||""},Player.prototype.preload=function(value){return void 0!==value?(this.techCall_("setPreload",value),this.options_.preload=value,this):this.techGet_("preload")},Player.prototype.autoplay=function(value){return void 0!==value?(this.techCall_("setAutoplay",value),this.options_.autoplay=value,this):this.techGet_("autoplay",value)},Player.prototype.playsinline=function(value){return void 0!==value?(this.techCall_("setPlaysinline",value),this.options_.playsinline=value,this):this.techGet_("playsinline")},Player.prototype.loop=function(value){return void 0!==value?(this.techCall_("setLoop",value),this.options_.loop=value,this):this.techGet_("loop")},Player.prototype.poster=function(src){return void 0===src?this.poster_:(src||(src=""),this.poster_=src,this.techCall_("setPoster",src),this.trigger("posterchange"),this)},Player.prototype.handleTechPosterChange_=function(){!this.poster_&&this.tech_&&this.tech_.poster&&(this.poster_=this.tech_.poster()||"",this.trigger("posterchange"))},Player.prototype.controls=function(bool){return void 0!==bool?(bool=!!bool,this.controls_!==bool&&(this.controls_=bool,this.usingNativeControls()&&this.techCall_("setControls",bool),bool?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_())),this):!!this.controls_},Player.prototype.usingNativeControls=function(bool){return void 0!==bool?(bool=!!bool,this.usingNativeControls_!==bool&&(this.usingNativeControls_=bool,bool?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols"))),this):!!this.usingNativeControls_},Player.prototype.error=function(err){return void 0===err?this.error_||null:null===err?(this.error_=err,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close(),this):(this.error_=new _mediaError2.default(err),this.addClass("vjs-error"),_log2.default.error("(CODE:"+this.error_.code+" "+_mediaError2.default.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),this)},Player.prototype.reportUserActivity=function(event){this.userActivity_=!0},Player.prototype.userActive=function(bool){return void 0!==bool?((bool=!!bool)!==this.userActive_&&(this.userActive_=bool,bool?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.userActivity_=!1,this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive"))),this):this.userActive_},Player.prototype.listenForUserActivity_=function(){var mouseInProgress=void 0,lastMoveX=void 0,lastMoveY=void 0,handleActivity=Fn.bind(this,this.reportUserActivity);this.on("mousedown",function(){handleActivity(),this.clearInterval(mouseInProgress),mouseInProgress=this.setInterval(handleActivity,250)}),this.on("mousemove",function(e){e.screenX===lastMoveX&&e.screenY===lastMoveY||(lastMoveX=e.screenX,lastMoveY=e.screenY,handleActivity())}),this.on("mouseup",function(event){handleActivity(),this.clearInterval(mouseInProgress)}),this.on("keydown",handleActivity),this.on("keyup",handleActivity);var inactivityTimeout=void 0;this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(inactivityTimeout);var timeout=this.options_.inactivityTimeout;timeout>0&&(inactivityTimeout=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},timeout))}},250)},Player.prototype.playbackRate=function(rate){return void 0!==rate?(this.techCall_("setPlaybackRate",rate),this):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("playbackRate"):1},Player.prototype.isAudio=function(bool){return void 0!==bool?(this.isAudio_=!!bool,this):!!this.isAudio_},Player.prototype.videoTracks=function(){return this.tech_?this.tech_.videoTracks():(this.videoTracks_=this.videoTracks_||new _videoTrackList2.default,this.videoTracks_)},Player.prototype.audioTracks=function(){return this.tech_?this.tech_.audioTracks():(this.audioTracks_=this.audioTracks_||new _audioTrackList2.default,this.audioTracks_)},Player.prototype.textTracks=function(){if(this.tech_)return this.tech_.textTracks()},Player.prototype.remoteTextTracks=function(){if(this.tech_)return this.tech_.remoteTextTracks()},Player.prototype.remoteTextTrackEls=function(){if(this.tech_)return this.tech_.remoteTextTrackEls()},Player.prototype.addTextTrack=function(kind,label,language){if(this.tech_)return this.tech_.addTextTrack(kind,label,language)},Player.prototype.addRemoteTextTrack=function(options,manualCleanup){if(this.tech_)return this.tech_.addRemoteTextTrack(options,manualCleanup)},Player.prototype.removeRemoteTextTrack=function(){var _ref3$track=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).track,track=void 0===_ref3$track?arguments[0]:_ref3$track;if(this.tech_)return this.tech_.removeRemoteTextTrack(track)},Player.prototype.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},Player.prototype.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},Player.prototype.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},Player.prototype.language=function(code){return void 0===code?this.language_:(this.language_=String(code).toLowerCase(),this)},Player.prototype.languages=function(){return(0,_mergeOptions2.default)(Player.prototype.options_.languages,this.languages_)},Player.prototype.toJSON=function(){var options=(0,_mergeOptions2.default)(this.options_),tracks=options.tracks;options.tracks=[];for(var i=0;i<tracks.length;i++){var track=tracks[i];(track=(0,_mergeOptions2.default)(track)).player=void 0,options.tracks[i]=track}return options},Player.prototype.createModal=function(content,options){var _this5=this;(options=options||{}).content=content||"";var modal=new _modalDialog2.default(this,options);return this.addChild(modal),modal.on("dispose",function(){_this5.removeChild(modal)}),modal.open()},Player.getTagSettings=function(tag){var baseOptions={sources:[],tracks:[]},tagOptions=Dom.getElAttributes(tag),dataSetup=tagOptions["data-setup"];if(Dom.hasElClass(tag,"vjs-fluid")&&(tagOptions.fluid=!0),null!==dataSetup){var _safeParseTuple=(0,_tuple2.default)(dataSetup||"{}"),err=_safeParseTuple[0],data=_safeParseTuple[1];err&&_log2.default.error(err),(0,_obj.assign)(tagOptions,data)}if((0,_obj.assign)(baseOptions,tagOptions),tag.hasChildNodes())for(var children=tag.childNodes,i=0,j=children.length;i<j;i++){var child=children[i],childName=child.nodeName.toLowerCase();"source"===childName?baseOptions.sources.push(Dom.getElAttributes(child)):"track"===childName&&baseOptions.tracks.push(Dom.getElAttributes(child))}return baseOptions},Player.prototype.flexNotSupported_=function(){var elem=_document2.default.createElement("i");return!("flexBasis"in elem.style||"webkitFlexBasis"in elem.style||"mozFlexBasis"in elem.style||"msFlexBasis"in elem.style||"msFlexOrder"in elem.style)},Player}(_component2.default);Player.players={};var navigator=_window2.default.navigator;Player.prototype.options_={techOrder:["html5","flash"],html5:{},flash:{},defaultVolume:0,inactivityTimeout:2e3,playbackRates:[],children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","controlBar","errorDisplay","textTrackSettings"],language:navigator&&(navigator.languages&&navigator.languages[0]||navigator.userLanguage||navigator.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media."},["ended","seeking","seekable","networkState","readyState"].forEach(function(fn){Player.prototype[fn]=function(){return this.techGet_(fn)}}),TECH_EVENTS_RETRIGGER.forEach(function(event){Player.prototype["handleTech"+(0,_toTitleCase2.default)(event)+"_"]=function(){return this.trigger(event)}}),_component2.default.registerComponent("Player",Player),exports.default=Player},{1:1,4:4,41:41,44:44,45:45,46:46,5:5,50:50,55:55,59:59,60:60,61:61,62:62,63:63,68:68,69:69,71:71,76:76,78:78,79:79,8:8,81:81,82:82,83:83,85:85,86:86,87:87,88:88,89:89,90:90,91:91,94:94,95:95,97:97}],52:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0;var _player2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(51));exports.default=function(name,init){_player2.default.prototype[name]=init}},{51:51}],53:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _clickableComponent2=_interopRequireDefault(_dereq_(3)),_component2=_interopRequireDefault(_dereq_(5)),PopupButton=function(_ClickableComponent){function PopupButton(player){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,PopupButton);var _this=_possibleConstructorReturn(this,_ClickableComponent.call(this,player,options));return _this.update(),_this}return _inherits(PopupButton,_ClickableComponent),PopupButton.prototype.update=function(){var popup=this.createPopup();this.popup&&this.removeChild(this.popup),this.popup=popup,this.addChild(popup),this.items&&0===this.items.length?this.hide():this.items&&this.items.length>1&&this.show()},PopupButton.prototype.createPopup=function(){},PopupButton.prototype.createEl=function(){return _ClickableComponent.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},PopupButton.prototype.buildCSSClass=function(){var menuButtonClass="vjs-menu-button";return!0===this.options_.inline?menuButtonClass+="-inline":menuButtonClass+="-popup","vjs-menu-button "+menuButtonClass+" "+_ClickableComponent.prototype.buildCSSClass.call(this)},PopupButton}(_clickableComponent2.default);_component2.default.registerComponent("PopupButton",PopupButton),exports.default=PopupButton},{3:3,5:5}],54:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5)),Dom=_interopRequireWildcard(_dereq_(81)),Fn=_interopRequireWildcard(_dereq_(83)),Events=_interopRequireWildcard(_dereq_(82)),Popup=function(_Component){function Popup(){return _classCallCheck(this,Popup),_possibleConstructorReturn(this,_Component.apply(this,arguments))}return _inherits(Popup,_Component),Popup.prototype.addItem=function(component){this.addChild(component),component.on("click",Fn.bind(this,function(){this.unlockShowing()}))},Popup.prototype.createEl=function(){var contentElType=this.options_.contentElType||"ul";this.contentEl_=Dom.createEl(contentElType,{className:"vjs-menu-content"});var el=_Component.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return el.appendChild(this.contentEl_),Events.on(el,"click",function(event){event.preventDefault(),event.stopImmediatePropagation()}),el},Popup}(_component2.default);_component2.default.registerComponent("Popup",Popup),exports.default=Popup},{5:5,81:81,82:82,83:83}],55:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _clickableComponent2=_interopRequireDefault(_dereq_(3)),_component2=_interopRequireDefault(_dereq_(5)),Fn=_interopRequireWildcard(_dereq_(83)),Dom=_interopRequireWildcard(_dereq_(81)),browser=_interopRequireWildcard(_dereq_(78)),PosterImage=function(_ClickableComponent){function PosterImage(player,options){_classCallCheck(this,PosterImage);var _this=_possibleConstructorReturn(this,_ClickableComponent.call(this,player,options));return _this.update(),player.on("posterchange",Fn.bind(_this,_this.update)),_this}return _inherits(PosterImage,_ClickableComponent),PosterImage.prototype.dispose=function(){this.player().off("posterchange",this.update),_ClickableComponent.prototype.dispose.call(this)},PosterImage.prototype.createEl=function(){var el=Dom.createEl("div",{className:"vjs-poster",tabIndex:-1});return browser.BACKGROUND_SIZE_SUPPORTED||(this.fallbackImg_=Dom.createEl("img"),el.appendChild(this.fallbackImg_)),el},PosterImage.prototype.update=function(event){var url=this.player().poster();this.setSrc(url),url?this.show():this.hide()},PosterImage.prototype.setSrc=function(url){if(this.fallbackImg_)this.fallbackImg_.src=url;else{var backgroundImage="";url&&(backgroundImage='url("'+url+'")'),this.el_.style.backgroundImage=backgroundImage}},PosterImage.prototype.handleClick=function(event){this.player_.controls()&&(this.player_.paused()?this.player_.play():this.player_.pause())},PosterImage}(_clickableComponent2.default);_component2.default.registerComponent("PosterImage",PosterImage),exports.default=PosterImage},{3:3,5:5,78:78,81:81,83:83}],56:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function autoSetupTimeout(wait,vjs){vjs&&(videojs=vjs),_window2.default.setTimeout(autoSetup,wait)}exports.__esModule=!0,exports.hasLoaded=exports.autoSetupTimeout=exports.autoSetup=void 0;var Dom=_interopRequireWildcard(_dereq_(81)),Events=_interopRequireWildcard(_dereq_(82)),_document2=_interopRequireDefault(_dereq_(94)),_window2=_interopRequireDefault(_dereq_(95)),_windowLoaded=!1,videojs=void 0,autoSetup=function(){if(Dom.isReal()){var vids=_document2.default.getElementsByTagName("video"),audios=_document2.default.getElementsByTagName("audio"),mediaEls=[];if(vids&&vids.length>0)for(var i=0,e=vids.length;i<e;i++)mediaEls.push(vids[i]);if(audios&&audios.length>0)for(var _i=0,_e=audios.length;_i<_e;_i++)mediaEls.push(audios[_i]);if(mediaEls&&mediaEls.length>0)for(var _i2=0,_e2=mediaEls.length;_i2<_e2;_i2++){var mediaEl=mediaEls[_i2];if(!mediaEl||!mediaEl.getAttribute){autoSetupTimeout(1);break}void 0===mediaEl.player&&null!==mediaEl.getAttribute("data-setup")&&videojs(mediaEl)}else _windowLoaded||autoSetupTimeout(1)}};Dom.isReal()&&"complete"===_document2.default.readyState?_windowLoaded=!0:Events.one(_window2.default,"load",function(){_windowLoaded=!0});exports.autoSetup=autoSetup,exports.autoSetupTimeout=autoSetupTimeout,exports.hasLoaded=function(){return _windowLoaded}},{81:81,82:82,94:94,95:95}],57:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(5)),Dom=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(81)),_obj=_dereq_(88),Slider=function(_Component){function Slider(player,options){_classCallCheck(this,Slider);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.bar=_this.getChild(_this.options_.barName),_this.vertical(!!_this.options_.vertical),_this.on("mousedown",_this.handleMouseDown),_this.on("touchstart",_this.handleMouseDown),_this.on("focus",_this.handleFocus),_this.on("blur",_this.handleBlur),_this.on("click",_this.handleClick),_this.on(player,"controlsvisible",_this.update),_this.on(player,_this.playerEvent,_this.update),_this}return _inherits(Slider,_Component),Slider.prototype.createEl=function(type){var props=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return props.className=props.className+" vjs-slider",props=(0,_obj.assign)({tabIndex:0},props),attributes=(0,_obj.assign)({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},attributes),_Component.prototype.createEl.call(this,type,props,attributes)},Slider.prototype.handleMouseDown=function(event){var doc=this.bar.el_.ownerDocument;event.preventDefault(),Dom.blockTextSelection(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(doc,"mousemove",this.handleMouseMove),this.on(doc,"mouseup",this.handleMouseUp),this.on(doc,"touchmove",this.handleMouseMove),this.on(doc,"touchend",this.handleMouseUp),this.handleMouseMove(event)},Slider.prototype.handleMouseMove=function(event){},Slider.prototype.handleMouseUp=function(){var doc=this.bar.el_.ownerDocument;Dom.unblockTextSelection(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(doc,"mousemove",this.handleMouseMove),this.off(doc,"mouseup",this.handleMouseUp),this.off(doc,"touchmove",this.handleMouseMove),this.off(doc,"touchend",this.handleMouseUp),this.update()},Slider.prototype.update=function(){if(this.el_){var progress=this.getPercent(),bar=this.bar;if(bar){("number"!=typeof progress||progress!==progress||progress<0||progress===1/0)&&(progress=0);var percentage=(100*progress).toFixed(2)+"%";this.vertical()?bar.el().style.height=percentage:bar.el().style.width=percentage}}},Slider.prototype.calculateDistance=function(event){var position=Dom.getPointerPosition(this.el_,event);return this.vertical()?position.y:position.x},Slider.prototype.handleFocus=function(){this.on(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},Slider.prototype.handleKeyPress=function(event){37===event.which||40===event.which?(event.preventDefault(),this.stepBack()):38!==event.which&&39!==event.which||(event.preventDefault(),this.stepForward())},Slider.prototype.handleBlur=function(){this.off(this.bar.el_.ownerDocument,"keydown",this.handleKeyPress)},Slider.prototype.handleClick=function(event){event.stopImmediatePropagation(),event.preventDefault()},Slider.prototype.vertical=function(bool){return void 0===bool?this.vertical_||!1:(this.vertical_=!!bool,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal"),this)},Slider}(_component2.default);_component2.default.registerComponent("Slider",Slider),exports.default=Slider},{5:5,81:81,88:88}],58:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0,exports.default=function(Flash){return Flash.streamingFormats={"rtmp/mp4":"MP4","rtmp/flv":"FLV"},Flash.streamFromParts=function(connection,stream){return connection+"&"+stream},Flash.streamToParts=function(src){var parts={connection:"",stream:""};if(!src)return parts;var connEnd=src.search(/&(?!\w+=)/),streamBegin=void 0;return-1!==connEnd?streamBegin=connEnd+1:0===(connEnd=streamBegin=src.lastIndexOf("/")+1)&&(connEnd=streamBegin=src.length),parts.connection=src.substring(0,connEnd),parts.stream=src.substring(streamBegin,src.length),parts},Flash.isStreamingType=function(srcType){return srcType in Flash.streamingFormats},Flash.RTMP_RE=/^rtmp[set]?:\/\//i,Flash.isStreamingSrc=function(src){return Flash.RTMP_RE.test(src)},Flash.rtmpSourceHandler={},Flash.rtmpSourceHandler.canPlayType=function(type){return Flash.isStreamingType(type)?"maybe":""},Flash.rtmpSourceHandler.canHandleSource=function(source,options){var can=Flash.rtmpSourceHandler.canPlayType(source.type);return can||(Flash.isStreamingSrc(source.src)?"maybe":"")},Flash.rtmpSourceHandler.handleSource=function(source,tech,options){var srcParts=Flash.streamToParts(source.src);tech.setRtmpConnection(srcParts.connection),tech.setRtmpStream(srcParts.stream)},Flash.registerSourceHandler(Flash.rtmpSourceHandler),Flash}},{}],59:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function _createGetter(attr){_api[attr]=function(){return this.el_.vjs_getProperty(attr)}}exports.__esModule=!0;for(var _tech2=_interopRequireDefault(_dereq_(62)),Dom=_interopRequireWildcard(_dereq_(81)),Url=_interopRequireWildcard(_dereq_(92)),_timeRanges=_dereq_(90),_flashRtmp2=_interopRequireDefault(_dereq_(58)),_component2=_interopRequireDefault(_dereq_(5)),_window2=_interopRequireDefault(_dereq_(95)),_obj=_dereq_(88),navigator=_window2.default.navigator,Flash=function(_Tech){function Flash(options,ready){_classCallCheck(this,Flash);var _this=_possibleConstructorReturn(this,_Tech.call(this,options,ready));return options.source&&_this.ready(function(){this.setSource(options.source)},!0),options.startTime&&_this.ready(function(){this.load(),this.play(),this.currentTime(options.startTime)},!0),_window2.default.videojs=_window2.default.videojs||{},_window2.default.videojs.Flash=_window2.default.videojs.Flash||{},_window2.default.videojs.Flash.onReady=Flash.onReady,_window2.default.videojs.Flash.onEvent=Flash.onEvent,_window2.default.videojs.Flash.onError=Flash.onError,_this.on("seeked",function(){this.lastSeekTarget_=void 0}),_this}return _inherits(Flash,_Tech),Flash.prototype.createEl=function(){var options=this.options_;if(!options.swf){options.swf="//vjs.zencdn.net/swf/5.4.1/video-js.swf"}var objId=options.techId,flashVars=(0,_obj.assign)({readyFunction:"videojs.Flash.onReady",eventProxyFunction:"videojs.Flash.onEvent",errorEventProxyFunction:"videojs.Flash.onError",autoplay:options.autoplay,preload:options.preload,loop:options.loop,muted:options.muted},options.flashVars),params=(0,_obj.assign)({wmode:"opaque",bgcolor:"#000000"},options.params),attributes=(0,_obj.assign)({id:objId,name:objId,class:"vjs-tech"},options.attributes);return this.el_=Flash.embed(options.swf,flashVars,params,attributes),this.el_.tech=this,this.el_},Flash.prototype.play=function(){this.ended()&&this.setCurrentTime(0),this.el_.vjs_play()},Flash.prototype.pause=function(){this.el_.vjs_pause()},Flash.prototype.src=function(_src){return void 0===_src?this.currentSrc():this.setSrc(_src)},Flash.prototype.setSrc=function(src){var _this2=this;src=Url.getAbsoluteURL(src),this.el_.vjs_src(src),this.autoplay()&&this.setTimeout(function(){return _this2.play()},0)},Flash.prototype.seeking=function(){return void 0!==this.lastSeekTarget_},Flash.prototype.setCurrentTime=function(time){var seekable=this.seekable();seekable.length&&(time=(time=time>seekable.start(0)?time:seekable.start(0))<seekable.end(seekable.length-1)?time:seekable.end(seekable.length-1),this.lastSeekTarget_=time,this.trigger("seeking"),this.el_.vjs_setProperty("currentTime",time),_Tech.prototype.setCurrentTime.call(this))},Flash.prototype.currentTime=function(){return this.seeking()?this.lastSeekTarget_||0:this.el_.vjs_getProperty("currentTime")},Flash.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.vjs_getProperty("currentSrc")},Flash.prototype.duration=function(){if(0===this.readyState())return NaN;var duration=this.el_.vjs_getProperty("duration");return duration>=0?duration:1/0},Flash.prototype.load=function(){this.el_.vjs_load()},Flash.prototype.poster=function(){this.el_.vjs_getProperty("poster")},Flash.prototype.setPoster=function(){},Flash.prototype.seekable=function(){var duration=this.duration();return 0===duration?(0,_timeRanges.createTimeRange)():(0,_timeRanges.createTimeRange)(0,duration)},Flash.prototype.buffered=function(){var ranges=this.el_.vjs_getProperty("buffered");return 0===ranges.length?(0,_timeRanges.createTimeRange)():(0,_timeRanges.createTimeRange)(ranges[0][0],ranges[0][1])},Flash.prototype.supportsFullScreen=function(){return!1},Flash.prototype.enterFullScreen=function(){return!1},Flash.prototype.getVideoPlaybackQuality=function(){var videoPlaybackQuality=this.el_.vjs_getProperty("getVideoPlaybackQuality");return _window2.default.performance&&"function"==typeof _window2.default.performance.now?videoPlaybackQuality.creationTime=_window2.default.performance.now():_window2.default.performance&&_window2.default.performance.timing&&"number"==typeof _window2.default.performance.timing.navigationStart&&(videoPlaybackQuality.creationTime=_window2.default.Date.now()-_window2.default.performance.timing.navigationStart),videoPlaybackQuality},Flash}(_tech2.default),_api=Flash.prototype,_readWrite="rtmpConnection,rtmpStream,preload,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted".split(","),_readOnly="networkState,readyState,initialTime,startOffsetTime,paused,ended,videoWidth,videoHeight".split(","),i=0;i<_readWrite.length;i++)_createGetter(_readWrite[i]),function(attr){var attrUpper=attr.charAt(0).toUpperCase()+attr.slice(1);_api["set"+attrUpper]=function(val){return this.el_.vjs_setProperty(attr,val)}}(_readWrite[i]);for(var _i=0;_i<_readOnly.length;_i++)_createGetter(_readOnly[_i]);Flash.isSupported=function(){return Flash.version()[0]>=10},_tech2.default.withSourceHandlers(Flash),Flash.nativeSourceHandler={},Flash.nativeSourceHandler.canPlayType=function(type){return type in Flash.formats?"maybe":""},Flash.nativeSourceHandler.canHandleSource=function(source,options){var type=void 0;return type=source.type?source.type.replace(/;.*/,"").toLowerCase():function(src){var ext=Url.getFileExtension(src);return ext?"video/"+ext:""}(source.src),Flash.nativeSourceHandler.canPlayType(type)},Flash.nativeSourceHandler.handleSource=function(source,tech,options){tech.setSrc(source.src)},Flash.nativeSourceHandler.dispose=function(){},Flash.registerSourceHandler(Flash.nativeSourceHandler),Flash.formats={"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},Flash.onReady=function(currSwf){var el=Dom.getEl(currSwf),tech=el&&el.tech;tech&&tech.el()&&Flash.checkReady(tech)},Flash.checkReady=function(tech){tech.el()&&(tech.el().vjs_getProperty?tech.triggerReady():this.setTimeout(function(){Flash.checkReady(tech)},50))},Flash.onEvent=function(swfID,eventName){var tech=Dom.getEl(swfID).tech,args=Array.prototype.slice.call(arguments,2);tech.setTimeout(function(){tech.trigger(eventName,args)},1)},Flash.onError=function(swfID,err){var tech=Dom.getEl(swfID).tech;if("srcnotfound"===err)return tech.error(4);tech.error("FLASH: "+err)},Flash.version=function(){var version="0,0,0";try{version=new _window2.default.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(e){try{navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(version=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(err){}}return version.split(",")},Flash.embed=function(swf,flashVars,params,attributes){var code=Flash.getEmbedCode(swf,flashVars,params,attributes);return Dom.createEl("div",{innerHTML:code}).childNodes[0]},Flash.getEmbedCode=function(swf,flashVars,params,attributes){var flashVarsString="",paramsString="",attrsString="";return flashVars&&Object.getOwnPropertyNames(flashVars).forEach(function(key){flashVarsString+=key+"="+flashVars[key]+"&amp;"}),params=(0,_obj.assign)({movie:swf,flashvars:flashVarsString,allowScriptAccess:"always",allowNetworking:"all"},params),Object.getOwnPropertyNames(params).forEach(function(key){paramsString+='<param name="'+key+'" value="'+params[key]+'" />'}),attributes=(0,_obj.assign)({data:swf,width:"100%",height:"100%"},attributes),Object.getOwnPropertyNames(attributes).forEach(function(key){attrsString+=key+'="'+attributes[key]+'" '}),'<object type="application/x-shockwave-flash" '+attrsString+">"+paramsString+"</object>"},(0,_flashRtmp2.default)(Flash),_component2.default.registerComponent("Flash",Flash),_tech2.default.registerTech("Flash",Flash),exports.default=Flash},{5:5,58:58,62:62,81:81,88:88,90:90,92:92,95:95}],60:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _templateObject=function(strings,raw){return strings.raw=raw,strings}(["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n            This may prevent text tracks from loading."],["Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n            This may prevent text tracks from loading."]),_tech2=_interopRequireDefault(_dereq_(62)),_component2=_interopRequireDefault(_dereq_(5)),Dom=_interopRequireWildcard(_dereq_(81)),Url=_interopRequireWildcard(_dereq_(92)),Fn=_interopRequireWildcard(_dereq_(83)),_log2=_interopRequireDefault(_dereq_(86)),_tsml2=_interopRequireDefault(_dereq_(98)),browser=_interopRequireWildcard(_dereq_(78)),_document2=_interopRequireDefault(_dereq_(94)),_window2=_interopRequireDefault(_dereq_(95)),_obj=_dereq_(88),_mergeOptions2=_interopRequireDefault(_dereq_(87)),_toTitleCase2=_interopRequireDefault(_dereq_(91)),Html5=function(_Tech){function Html5(options,ready){_classCallCheck(this,Html5);var _this=_possibleConstructorReturn(this,_Tech.call(this,options,ready)),source=options.source,crossoriginTracks=!1;if(source&&(_this.el_.currentSrc!==source.src||options.tag&&3===options.tag.initNetworkState_)?_this.setSource(source):_this.handleLateInit_(_this.el_),_this.el_.hasChildNodes()){for(var nodes=_this.el_.childNodes,nodesLength=nodes.length,removeNodes=[];nodesLength--;){var node=nodes[nodesLength];"track"===node.nodeName.toLowerCase()&&(_this.featuresNativeTextTracks?(_this.remoteTextTrackEls().addTrackElement_(node),_this.remoteTextTracks().addTrack_(node.track),crossoriginTracks||_this.el_.hasAttribute("crossorigin")||!Url.isCrossOrigin(node.src)||(crossoriginTracks=!0)):removeNodes.push(node))}for(var i=0;i<removeNodes.length;i++)_this.el_.removeChild(removeNodes[i])}return["audio","video"].forEach(function(type){var elTracks=_this.el()[type+"Tracks"],techTracks=_this[type+"Tracks"](),capitalType=(0,_toTitleCase2.default)(type);_this["featuresNative"+capitalType+"Tracks"]&&elTracks&&elTracks.addEventListener&&(_this["handle"+capitalType+"TrackChange_"]=function(e){techTracks.trigger({type:"change",target:techTracks,currentTarget:techTracks,srcElement:techTracks})},_this["handle"+capitalType+"TrackAdd_"]=function(e){return techTracks.addTrack(e.track)},_this["handle"+capitalType+"TrackRemove_"]=function(e){return techTracks.removeTrack(e.track)},elTracks.addEventListener("change",_this["handle"+capitalType+"TrackChange_"]),elTracks.addEventListener("addtrack",_this["handle"+capitalType+"TrackAdd_"]),elTracks.addEventListener("removetrack",_this["handle"+capitalType+"TrackRemove_"]),_this["removeOld"+capitalType+"Tracks_"]=function(e){return _this.removeOldTracks_(techTracks,elTracks)},_this.on("loadstart",_this["removeOld"+capitalType+"Tracks_"]))}),_this.featuresNativeTextTracks&&(crossoriginTracks&&_log2.default.warn((0,_tsml2.default)(_templateObject)),_this.handleTextTrackChange_=Fn.bind(_this,_this.handleTextTrackChange),_this.handleTextTrackAdd_=Fn.bind(_this,_this.handleTextTrackAdd),_this.handleTextTrackRemove_=Fn.bind(_this,_this.handleTextTrackRemove),_this.proxyNativeTextTracks_()),(browser.TOUCH_ENABLED||browser.IS_IPHONE||browser.IS_NATIVE_ANDROID)&&!0===options.nativeControlsForTouch&&_this.setControls(!0),_this.proxyWebkitFullscreen_(),_this.triggerReady(),_this}return _inherits(Html5,_Tech),Html5.prototype.dispose=function(){var _this2=this;["audio","video","text"].forEach(function(type){var capitalType=(0,_toTitleCase2.default)(type),tl=_this2.el_[type+"Tracks"];tl&&tl.removeEventListener&&(tl.removeEventListener("change",_this2["handle"+capitalType+"TrackChange_"]),tl.removeEventListener("addtrack",_this2["handle"+capitalType+"TrackAdd_"]),tl.removeEventListener("removetrack",_this2["handle"+capitalType+"TrackRemove_"])),tl&&_this2.off("loadstart",_this2["removeOld"+capitalType+"Tracks_"])}),Html5.disposeMediaElement(this.el_),_Tech.prototype.dispose.call(this)},Html5.prototype.createEl=function(){var el=this.options_.tag;if(!el||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(el){var clone=el.cloneNode(!0);el.parentNode&&el.parentNode.insertBefore(clone,el),Html5.disposeMediaElement(el),el=clone}else{el=_document2.default.createElement("video");var tagAttributes=this.options_.tag&&Dom.getElAttributes(this.options_.tag),attributes=(0,_mergeOptions2.default)({},tagAttributes);browser.TOUCH_ENABLED&&!0===this.options_.nativeControlsForTouch||delete attributes.controls,Dom.setElAttributes(el,(0,_obj.assign)(attributes,{id:this.options_.techId,class:"vjs-tech"}))}el.playerId=this.options_.playerId}for(var settingsAttrs=["autoplay","preload","loop","muted","playsinline"],i=settingsAttrs.length-1;i>=0;i--){var attr=settingsAttrs[i],overwriteAttrs={};void 0!==this.options_[attr]&&(overwriteAttrs[attr]=this.options_[attr]),Dom.setElAttributes(el,overwriteAttrs)}return el},Html5.prototype.handleLateInit_=function(el){if(0!==el.networkState&&3!==el.networkState){if(0===el.readyState){var loadstartFired=!1,setLoadstartFired=function(){loadstartFired=!0};this.on("loadstart",setLoadstartFired);var triggerLoadstart=function(){loadstartFired||this.trigger("loadstart")};return this.on("loadedmetadata",triggerLoadstart),void this.ready(function(){this.off("loadstart",setLoadstartFired),this.off("loadedmetadata",triggerLoadstart),loadstartFired||this.trigger("loadstart")})}var eventsToTrigger=["loadstart"];eventsToTrigger.push("loadedmetadata"),el.readyState>=2&&eventsToTrigger.push("loadeddata"),el.readyState>=3&&eventsToTrigger.push("canplay"),el.readyState>=4&&eventsToTrigger.push("canplaythrough"),this.ready(function(){eventsToTrigger.forEach(function(type){this.trigger(type)},this)})}},Html5.prototype.proxyNativeTextTracks_=function(){var tt=this.el().textTracks;if(tt){for(var i=0;i<tt.length;i++)this.textTracks().addTrack_(tt[i]);tt.addEventListener&&(tt.addEventListener("change",this.handleTextTrackChange_),tt.addEventListener("addtrack",this.handleTextTrackAdd_),tt.addEventListener("removetrack",this.handleTextTrackRemove_)),this.on("loadstart",this.removeOldTextTracks_)}},Html5.prototype.handleTextTrackChange=function(e){var tt=this.textTracks();this.textTracks().trigger({type:"change",target:tt,currentTarget:tt,srcElement:tt})},Html5.prototype.handleTextTrackAdd=function(e){this.textTracks().addTrack_(e.track)},Html5.prototype.handleTextTrackRemove=function(e){this.textTracks().removeTrack_(e.track)},Html5.prototype.removeOldTracks_=function(techTracks,elTracks){var removeTracks=[];if(elTracks){for(var i=0;i<techTracks.length;i++){for(var techTrack=techTracks[i],found=!1,j=0;j<elTracks.length;j++)if(elTracks[j]===techTrack){found=!0;break}found||removeTracks.push(techTrack)}for(var _i=0;_i<removeTracks.length;_i++){var track=removeTracks[_i];techTracks.removeTrack_(track)}}},Html5.prototype.removeOldTextTracks_=function(e){var techTracks=this.textTracks(),elTracks=this.el().textTracks;this.removeOldTracks_(techTracks,elTracks)},Html5.prototype.play=function(){var playPromise=this.el_.play();void 0!==playPromise&&"function"==typeof playPromise.then&&playPromise.then(null,function(e){})},Html5.prototype.setCurrentTime=function(seconds){try{this.el_.currentTime=seconds}catch(e){(0,_log2.default)(e,"Video is not ready. (Video.js)")}},Html5.prototype.duration=function(){var _this3=this;if(this.el_.duration===1/0&&browser.IS_ANDROID&&browser.IS_CHROME&&0===this.el_.currentTime){return this.on("timeupdate",function checkProgress(){_this3.el_.currentTime>0&&(_this3.el_.duration===1/0&&_this3.trigger("durationchange"),_this3.off("timeupdate",checkProgress))}),NaN}return this.el_.duration||NaN},Html5.prototype.width=function(){return this.el_.offsetWidth},Html5.prototype.height=function(){return this.el_.offsetHeight},Html5.prototype.proxyWebkitFullscreen_=function(){var _this4=this;if("webkitDisplayingFullscreen"in this.el_){var endFn=function(){this.trigger("fullscreenchange",{isFullscreen:!1})},beginFn=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",endFn),this.trigger("fullscreenchange",{isFullscreen:!0}))};this.on("webkitbeginfullscreen",beginFn),this.on("dispose",function(){_this4.off("webkitbeginfullscreen",beginFn),_this4.off("webkitendfullscreen",endFn)})}},Html5.prototype.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var userAgent=_window2.default.navigator&&_window2.default.navigator.userAgent||"";if(/Android/.test(userAgent)||!/Chrome|Mac OS X 10.5/.test(userAgent))return!0}return!1},Html5.prototype.enterFullScreen=function(){var video=this.el_;video.paused&&video.networkState<=video.HAVE_METADATA?(this.el_.play(),this.setTimeout(function(){video.pause(),video.webkitEnterFullScreen()},0)):video.webkitEnterFullScreen()},Html5.prototype.exitFullScreen=function(){this.el_.webkitExitFullScreen()},Html5.prototype.src=function(_src){if(void 0===_src)return this.el_.src;this.setSrc(_src)},Html5.prototype.reset=function(){Html5.resetMediaElement(this.el_)},Html5.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},Html5.prototype.setControls=function(val){this.el_.controls=!!val},Html5.prototype.addTextTrack=function(kind,label,language){return this.featuresNativeTextTracks?this.el_.addTextTrack(kind,label,language):_Tech.prototype.addTextTrack.call(this,kind,label,language)},Html5.prototype.createRemoteTextTrack=function(options){if(!this.featuresNativeTextTracks)return _Tech.prototype.createRemoteTextTrack.call(this,options);var htmlTrackElement=_document2.default.createElement("track");return options.kind&&(htmlTrackElement.kind=options.kind),options.label&&(htmlTrackElement.label=options.label),(options.language||options.srclang)&&(htmlTrackElement.srclang=options.language||options.srclang),options.default&&(htmlTrackElement.default=options.default),options.id&&(htmlTrackElement.id=options.id),options.src&&(htmlTrackElement.src=options.src),htmlTrackElement},Html5.prototype.addRemoteTextTrack=function(options,manualCleanup){var htmlTrackElement=_Tech.prototype.addRemoteTextTrack.call(this,options,manualCleanup);return this.featuresNativeTextTracks&&this.el().appendChild(htmlTrackElement),htmlTrackElement},Html5.prototype.removeRemoteTextTrack=function(track){if(_Tech.prototype.removeRemoteTextTrack.call(this,track),this.featuresNativeTextTracks)for(var tracks=this.$$("track"),i=tracks.length;i--;)track!==tracks[i]&&track!==tracks[i].track||this.el().removeChild(tracks[i])},Html5.prototype.playsinline=function(){return this.el_.hasAttribute("playsinline")},Html5.prototype.setPlaysinline=function(value){value?this.el_.setAttribute("playsinline","playsinline"):this.el_.removeAttribute("playsinline")},Html5.prototype.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var videoPlaybackQuality={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(videoPlaybackQuality.droppedVideoFrames=this.el().webkitDroppedFrameCount,videoPlaybackQuality.totalVideoFrames=this.el().webkitDecodedFrameCount),_window2.default.performance&&"function"==typeof _window2.default.performance.now?videoPlaybackQuality.creationTime=_window2.default.performance.now():_window2.default.performance&&_window2.default.performance.timing&&"number"==typeof _window2.default.performance.timing.navigationStart&&(videoPlaybackQuality.creationTime=_window2.default.Date.now()-_window2.default.performance.timing.navigationStart),videoPlaybackQuality},Html5}(_tech2.default);if(Dom.isReal()){Html5.TEST_VID=_document2.default.createElement("video");var track=_document2.default.createElement("track");track.kind="captions",track.srclang="en",track.label="English",Html5.TEST_VID.appendChild(track)}Html5.isSupported=function(){try{Html5.TEST_VID.volume=.5}catch(e){return!1}return!(!Html5.TEST_VID||!Html5.TEST_VID.canPlayType)},Html5.canControlVolume=function(){try{var volume=Html5.TEST_VID.volume;return Html5.TEST_VID.volume=volume/2+.1,volume!==Html5.TEST_VID.volume}catch(e){return!1}},Html5.canControlPlaybackRate=function(){if(browser.IS_ANDROID&&browser.IS_CHROME&&browser.CHROME_VERSION<58)return!1;try{var playbackRate=Html5.TEST_VID.playbackRate;return Html5.TEST_VID.playbackRate=playbackRate/2+.1,playbackRate!==Html5.TEST_VID.playbackRate}catch(e){return!1}},Html5.supportsNativeTextTracks=function(){return browser.IS_ANY_SAFARI},Html5.supportsNativeVideoTracks=function(){return!(!Html5.TEST_VID||!Html5.TEST_VID.videoTracks)},Html5.supportsNativeAudioTracks=function(){return!(!Html5.TEST_VID||!Html5.TEST_VID.audioTracks)},Html5.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","volumechange"],Html5.prototype.featuresVolumeControl=Html5.canControlVolume(),Html5.prototype.featuresPlaybackRate=Html5.canControlPlaybackRate(),Html5.prototype.movingMediaElementInDOM=!browser.IS_IOS,Html5.prototype.featuresFullscreenResize=!0,Html5.prototype.featuresProgressEvents=!0,Html5.prototype.featuresTimeupdateEvents=!0,Html5.prototype.featuresNativeTextTracks=Html5.supportsNativeTextTracks(),Html5.prototype.featuresNativeVideoTracks=Html5.supportsNativeVideoTracks(),Html5.prototype.featuresNativeAudioTracks=Html5.supportsNativeAudioTracks();var canPlayType=Html5.TEST_VID&&Html5.TEST_VID.constructor.prototype.canPlayType,mpegurlRE=/^application\/(?:x-|vnd\.apple\.)mpegurl/i,mp4RE=/^video\/mp4/i;Html5.patchCanPlayType=function(){browser.ANDROID_VERSION>=4&&!browser.IS_FIREFOX?Html5.TEST_VID.constructor.prototype.canPlayType=function(type){return type&&mpegurlRE.test(type)?"maybe":canPlayType.call(this,type)}:browser.IS_OLD_ANDROID&&(Html5.TEST_VID.constructor.prototype.canPlayType=function(type){return type&&mp4RE.test(type)?"maybe":canPlayType.call(this,type)})},Html5.unpatchCanPlayType=function(){var r=Html5.TEST_VID.constructor.prototype.canPlayType;return Html5.TEST_VID.constructor.prototype.canPlayType=canPlayType,r},Html5.patchCanPlayType(),Html5.disposeMediaElement=function(el){if(el){for(el.parentNode&&el.parentNode.removeChild(el);el.hasChildNodes();)el.removeChild(el.firstChild);el.removeAttribute("src"),"function"==typeof el.load&&function(){try{el.load()}catch(e){}}()}},Html5.resetMediaElement=function(el){if(el){for(var sources=el.querySelectorAll("source"),i=sources.length;i--;)el.removeChild(sources[i]);el.removeAttribute("src"),"function"==typeof el.load&&function(){try{el.load()}catch(e){}}()}},["paused","currentTime","buffered","volume","muted","poster","preload","autoplay","controls","loop","error","seeking","seekable","ended","defaultMuted","playbackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(prop){Html5.prototype[prop]=function(){return this.el_[prop]}}),["volume","muted","src","poster","preload","autoplay","loop","playbackRate"].forEach(function(prop){Html5.prototype["set"+(0,_toTitleCase2.default)(prop)]=function(v){this.el_[prop]=v}}),["pause","load"].forEach(function(prop){Html5.prototype[prop]=function(){return this.el_[prop]()}}),_tech2.default.withSourceHandlers(Html5),Html5.nativeSourceHandler={},Html5.nativeSourceHandler.canPlayType=function(type){try{return Html5.TEST_VID.canPlayType(type)}catch(e){return""}},Html5.nativeSourceHandler.canHandleSource=function(source,options){if(source.type)return Html5.nativeSourceHandler.canPlayType(source.type);if(source.src){var ext=Url.getFileExtension(source.src);return Html5.nativeSourceHandler.canPlayType("video/"+ext)}return""},Html5.nativeSourceHandler.handleSource=function(source,tech,options){tech.setSrc(source.src)},Html5.nativeSourceHandler.dispose=function(){},Html5.registerSourceHandler(Html5.nativeSourceHandler),_component2.default.registerComponent("Html5",Html5),_tech2.default.registerTech("Html5",Html5),exports.default=Html5},{5:5,62:62,78:78,81:81,83:83,86:86,87:87,88:88,91:91,92:92,94:94,95:95,98:98}],61:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),_tech2=_interopRequireDefault(_dereq_(62)),_toTitleCase2=_interopRequireDefault(_dereq_(91)),MediaLoader=function(_Component){function MediaLoader(player,options,ready){_classCallCheck(this,MediaLoader);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options,ready));if(options.playerOptions.sources&&0!==options.playerOptions.sources.length)player.src(options.playerOptions.sources);else for(var i=0,j=options.playerOptions.techOrder;i<j.length;i++){var techName=(0,_toTitleCase2.default)(j[i]),tech=_tech2.default.getTech(techName);if(techName||(tech=_component2.default.getComponent(techName)),tech&&tech.isSupported()){player.loadTech_(techName);break}}return _this}return _inherits(MediaLoader,_Component),MediaLoader}(_component2.default);_component2.default.registerComponent("MediaLoader",MediaLoader),exports.default=MediaLoader},{5:5,62:62,91:91}],62:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function createTrackHelper(self,kind,label,language){var options=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},tracks=self.textTracks();options.kind=kind,label&&(options.label=label),language&&(options.language=language),options.tech=self;var track=new _textTrack2.default(options);return tracks.addTrack_(track),track}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),_htmlTrackElement2=_interopRequireDefault(_dereq_(66)),_htmlTrackElementList2=_interopRequireDefault(_dereq_(65)),_mergeOptions2=_interopRequireDefault(_dereq_(87)),_textTrack2=_interopRequireDefault(_dereq_(72)),_textTrackList2=_interopRequireDefault(_dereq_(70)),_videoTrackList2=_interopRequireDefault(_dereq_(76)),_audioTrackList2=_interopRequireDefault(_dereq_(63)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),_log2=_interopRequireDefault(_dereq_(86)),_timeRanges=_dereq_(90),_buffer=_dereq_(79),_mediaError2=_interopRequireDefault(_dereq_(46)),_window2=_interopRequireDefault(_dereq_(95)),_document2=_interopRequireDefault(_dereq_(94)),_obj=_dereq_(88),Tech=function(_Component){function Tech(){var options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},ready=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};_classCallCheck(this,Tech),options.reportTouchActivity=!1;var _this=_possibleConstructorReturn(this,_Component.call(this,null,options,ready));return _this.hasStarted_=!1,_this.on("playing",function(){this.hasStarted_=!0}),_this.on("loadstart",function(){this.hasStarted_=!1}),_this.textTracks_=options.textTracks,_this.videoTracks_=options.videoTracks,_this.audioTracks_=options.audioTracks,_this.featuresProgressEvents||_this.manualProgressOn(),_this.featuresTimeupdateEvents||_this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(track){!1===options["native"+track+"Tracks"]&&(_this["featuresNative"+track+"Tracks"]=!1)}),!1===options.nativeCaptions&&(_this.featuresNativeTextTracks=!1),_this.featuresNativeTextTracks||_this.emulateTextTracks(),_this.autoRemoteTextTracks_=new _textTrackList2.default,_this.initTextTrackListeners(),_this.initTrackListeners(),options.nativeControlsForTouch||_this.emitTapEvents(),_this.constructor&&(_this.name_=_this.constructor.name||"Unknown Tech"),_this}return _inherits(Tech,_Component),Tech.prototype.manualProgressOn=function(){this.on("durationchange",this.onDurationChange),this.manualProgress=!0,this.one("ready",this.trackProgress)},Tech.prototype.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange)},Tech.prototype.trackProgress=function(event){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Fn.bind(this,function(){var numBufferedPercent=this.bufferedPercent();this.bufferedPercent_!==numBufferedPercent&&this.trigger("progress"),this.bufferedPercent_=numBufferedPercent,1===numBufferedPercent&&this.stopTrackingProgress()}),500)},Tech.prototype.onDurationChange=function(event){this.duration_=this.duration()},Tech.prototype.buffered=function(){return(0,_timeRanges.createTimeRange)(0,0)},Tech.prototype.bufferedPercent=function(){return(0,_buffer.bufferedPercent)(this.buffered(),this.duration_)},Tech.prototype.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},Tech.prototype.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime),this.on("pause",this.stopTrackingCurrentTime)},Tech.prototype.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime),this.off("pause",this.stopTrackingCurrentTime)},Tech.prototype.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},Tech.prototype.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},Tech.prototype.dispose=function(){this.clearTracks(["audio","video","text"]),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),_Component.prototype.dispose.call(this)},Tech.prototype.clearTracks=function(types){var _this2=this;(types=[].concat(types)).forEach(function(type){for(var list=_this2[type+"Tracks"]()||[],i=list.length;i--;){var track=list[i];"text"===type&&_this2.removeRemoteTextTrack(track),list.removeTrack_(track)}})},Tech.prototype.cleanupAutoTextTracks=function(){for(var list=this.autoRemoteTextTracks_||[],i=list.length;i--;){var track=list[i];this.removeRemoteTextTrack(track)}},Tech.prototype.reset=function(){},Tech.prototype.error=function(err){return void 0!==err&&(this.error_=new _mediaError2.default(err),this.trigger("error")),this.error_},Tech.prototype.played=function(){return this.hasStarted_?(0,_timeRanges.createTimeRange)(0,0):(0,_timeRanges.createTimeRange)()},Tech.prototype.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},Tech.prototype.initTextTrackListeners=function(){var textTrackListChanges=Fn.bind(this,function(){this.trigger("texttrackchange")}),tracks=this.textTracks();tracks&&(tracks.addEventListener("removetrack",textTrackListChanges),tracks.addEventListener("addtrack",textTrackListChanges),this.on("dispose",Fn.bind(this,function(){tracks.removeEventListener("removetrack",textTrackListChanges),tracks.removeEventListener("addtrack",textTrackListChanges)})))},Tech.prototype.initTrackListeners=function(){var _this3=this;["video","audio"].forEach(function(type){var trackListChanges=function(){_this3.trigger(type+"trackchange")},tracks=_this3[type+"Tracks"]();tracks.addEventListener("removetrack",trackListChanges),tracks.addEventListener("addtrack",trackListChanges),_this3.on("dispose",function(){tracks.removeEventListener("removetrack",trackListChanges),tracks.removeEventListener("addtrack",trackListChanges)})})},Tech.prototype.addWebVttScript_=function(){var _this4=this;if(!_window2.default.WebVTT)if(_document2.default.body.contains(this.el())){var vtt=_dereq_(99);if(!this.options_["vtt.js"]&&(0,_obj.isPlain)(vtt)&&Object.keys(vtt).length>0)return void this.trigger("vttjsloaded");var script=_document2.default.createElement("script");script.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.12.4/vtt.min.js",script.onload=function(){_this4.trigger("vttjsloaded")},script.onerror=function(){_this4.trigger("vttjserror")},this.on("dispose",function(){script.onload=null,script.onerror=null}),_window2.default.WebVTT=!0,this.el().parentNode.appendChild(script)}else this.ready(this.addWebVttScript_)},Tech.prototype.emulateTextTracks=function(){var _this5=this,tracks=this.textTracks();if(tracks){var remoteTracks=this.remoteTextTracks(),handleAddTrack=function(e){return tracks.addTrack_(e.track)},handleRemoveTrack=function(e){return tracks.removeTrack_(e.track)};remoteTracks.on("addtrack",handleAddTrack),remoteTracks.on("removetrack",handleRemoveTrack),this.addWebVttScript_();var updateDisplay=function(){return _this5.trigger("texttrackchange")},textTracksChanges=function(){updateDisplay();for(var i=0;i<tracks.length;i++){var track=tracks[i];track.removeEventListener("cuechange",updateDisplay),"showing"===track.mode&&track.addEventListener("cuechange",updateDisplay)}};textTracksChanges(),tracks.addEventListener("change",textTracksChanges),tracks.addEventListener("addtrack",textTracksChanges),tracks.addEventListener("removetrack",textTracksChanges),this.on("dispose",function(){remoteTracks.off("addtrack",handleAddTrack),remoteTracks.off("removetrack",handleRemoveTrack),tracks.removeEventListener("change",textTracksChanges),tracks.removeEventListener("addtrack",textTracksChanges),tracks.removeEventListener("removetrack",textTracksChanges);for(var i=0;i<tracks.length;i++)tracks[i].removeEventListener("cuechange",updateDisplay)})}},Tech.prototype.videoTracks=function(){return this.videoTracks_=this.videoTracks_||new _videoTrackList2.default,this.videoTracks_},Tech.prototype.audioTracks=function(){return this.audioTracks_=this.audioTracks_||new _audioTrackList2.default,this.audioTracks_},Tech.prototype.textTracks=function(){return this.textTracks_=this.textTracks_||new _textTrackList2.default,this.textTracks_},Tech.prototype.remoteTextTracks=function(){return this.remoteTextTracks_=this.remoteTextTracks_||new _textTrackList2.default,this.remoteTextTracks_},Tech.prototype.remoteTextTrackEls=function(){return this.remoteTextTrackEls_=this.remoteTextTrackEls_||new _htmlTrackElementList2.default,this.remoteTextTrackEls_},Tech.prototype.addTextTrack=function(kind,label,language){if(!kind)throw new Error("TextTrack kind is required but was not provided");return createTrackHelper(this,kind,label,language)},Tech.prototype.createRemoteTextTrack=function(options){var track=(0,_mergeOptions2.default)(options,{tech:this});return new _htmlTrackElement2.default(track)},Tech.prototype.addRemoteTextTrack=function(){var options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},manualCleanup=arguments[1],htmlTrackElement=this.createRemoteTextTrack(options);return!0!==manualCleanup&&!1!==manualCleanup&&(_log2.default.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),manualCleanup=!0),this.remoteTextTrackEls().addTrackElement_(htmlTrackElement),this.remoteTextTracks().addTrack_(htmlTrackElement.track),!0!==manualCleanup&&this.autoRemoteTextTracks_.addTrack_(htmlTrackElement.track),htmlTrackElement},Tech.prototype.removeRemoteTextTrack=function(track){var trackElement=this.remoteTextTrackEls().getTrackElementByTrack_(track);this.remoteTextTrackEls().removeTrackElement_(trackElement),this.remoteTextTracks().removeTrack_(track),this.autoRemoteTextTracks_.removeTrack_(track)},Tech.prototype.getVideoPlaybackQuality=function(){return{}},Tech.prototype.setPoster=function(){},Tech.prototype.playsinline=function(){},Tech.prototype.setPlaysinline=function(){},Tech.prototype.canPlayType=function(){return""},Tech.isTech=function(component){return component.prototype instanceof Tech||component instanceof Tech||component===Tech},Tech.registerTech=function(name,tech){if(Tech.techs_||(Tech.techs_={}),!Tech.isTech(tech))throw new Error("Tech "+name+" must be a Tech");return Tech.techs_[name]=tech,tech},Tech.getTech=function(name){return Tech.techs_&&Tech.techs_[name]?Tech.techs_[name]:_window2.default&&_window2.default.videojs&&_window2.default.videojs[name]?(_log2.default.warn("The "+name+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),_window2.default.videojs[name]):void 0},Tech}(_component2.default);Tech.prototype.textTracks_,Tech.prototype.audioTracks_,Tech.prototype.videoTracks_,Tech.prototype.featuresVolumeControl=!0,Tech.prototype.featuresFullscreenResize=!1,Tech.prototype.featuresPlaybackRate=!1,Tech.prototype.featuresProgressEvents=!1,Tech.prototype.featuresTimeupdateEvents=!1,Tech.prototype.featuresNativeTextTracks=!1,Tech.withSourceHandlers=function(_Tech){_Tech.registerSourceHandler=function(handler,index){var handlers=_Tech.sourceHandlers;handlers||(handlers=_Tech.sourceHandlers=[]),void 0===index&&(index=handlers.length),handlers.splice(index,0,handler)},_Tech.canPlayType=function(type){for(var handlers=_Tech.sourceHandlers||[],can=void 0,i=0;i<handlers.length;i++)if(can=handlers[i].canPlayType(type))return can;return""},_Tech.selectSourceHandler=function(source,options){for(var handlers=_Tech.sourceHandlers||[],i=0;i<handlers.length;i++)if(handlers[i].canHandleSource(source,options))return handlers[i];return null},_Tech.canPlaySource=function(srcObj,options){var sh=_Tech.selectSourceHandler(srcObj,options);return sh?sh.canHandleSource(srcObj,options):""},["seekable","duration"].forEach(function(fnName){var originalFn=this[fnName];"function"==typeof originalFn&&(this[fnName]=function(){return this.sourceHandler_&&this.sourceHandler_[fnName]?this.sourceHandler_[fnName].apply(this.sourceHandler_,arguments):originalFn.apply(this,arguments)})},_Tech.prototype),_Tech.prototype.setSource=function(source){var sh=_Tech.selectSourceHandler(source,this.options_);return sh||(_Tech.nativeSourceHandler?sh=_Tech.nativeSourceHandler:_log2.default.error("No source hander found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler),sh!==_Tech.nativeSourceHandler&&(this.currentSource_=source,this.off(this.el_,"loadstart",_Tech.prototype.firstLoadStartListener_),this.off(this.el_,"loadstart",_Tech.prototype.successiveLoadStartListener_),this.one(this.el_,"loadstart",_Tech.prototype.firstLoadStartListener_)),this.sourceHandler_=sh.handleSource(source,this,this.options_),this.on("dispose",this.disposeSourceHandler),this},_Tech.prototype.firstLoadStartListener_=function(){this.one(this.el_,"loadstart",_Tech.prototype.successiveLoadStartListener_)},_Tech.prototype.successiveLoadStartListener_=function(){this.disposeSourceHandler(),this.one(this.el_,"loadstart",_Tech.prototype.successiveLoadStartListener_)},_Tech.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.off(this.el_,"loadstart",_Tech.prototype.firstLoadStartListener_),this.off(this.el_,"loadstart",_Tech.prototype.successiveLoadStartListener_),this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},_component2.default.registerComponent("Tech",Tech),_component2.default.registerComponent("MediaTechController",Tech),Tech.registerTech("Tech",Tech),exports.default=Tech},{46:46,5:5,63:63,65:65,66:66,70:70,72:72,76:76,79:79,83:83,86:86,87:87,88:88,90:90,94:94,95:95,99:99}],63:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _trackList2=_interopRequireDefault(_dereq_(74)),browser=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(78)),_document2=_interopRequireDefault(_dereq_(94)),disableOthers=function(list,track){for(var i=0;i<list.length;i++)track.id!==list[i].id&&(list[i].enabled=!1)},AudioTrackList=function(_TrackList){function AudioTrackList(){var _this,_ret,tracks=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];_classCallCheck(this,AudioTrackList);for(var list=void 0,i=tracks.length-1;i>=0;i--)if(tracks[i].enabled){disableOthers(tracks,tracks[i]);break}if(browser.IS_IE8){list=_document2.default.createElement("custom");for(var prop in _trackList2.default.prototype)"constructor"!==prop&&(list[prop]=_trackList2.default.prototype[prop]);for(var _prop in AudioTrackList.prototype)"constructor"!==_prop&&(list[_prop]=AudioTrackList.prototype[_prop])}return list=_this=_possibleConstructorReturn(this,_TrackList.call(this,tracks,list)),list.changing_=!1,_ret=list,_possibleConstructorReturn(_this,_ret)}return _inherits(AudioTrackList,_TrackList),AudioTrackList.prototype.addTrack_=function(track){var _this2=this;track.enabled&&disableOthers(this,track),_TrackList.prototype.addTrack_.call(this,track),track.addEventListener&&track.addEventListener("enabledchange",function(){_this2.changing_||(_this2.changing_=!0,disableOthers(_this2,track),_this2.changing_=!1,_this2.trigger("change"))})},AudioTrackList.prototype.addTrack=function(track){this.addTrack_(track)},AudioTrackList.prototype.removeTrack=function(track){_TrackList.prototype.removeTrack_.call(this,track)},AudioTrackList}(_trackList2.default);exports.default=AudioTrackList},{74:74,78:78,94:94}],64:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _trackEnums=_dereq_(73),_track2=_interopRequireDefault(_dereq_(75)),_mergeOptions2=_interopRequireDefault(_dereq_(87)),browser=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(78)),AudioTrack=function(_Track){function AudioTrack(){var _this,_ret,options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,AudioTrack);var settings=(0,_mergeOptions2.default)(options,{kind:_trackEnums.AudioTrackKind[options.kind]||""}),track=_this=_possibleConstructorReturn(this,_Track.call(this,settings)),enabled=!1;if(browser.IS_IE8)for(var prop in AudioTrack.prototype)"constructor"!==prop&&(track[prop]=AudioTrack.prototype[prop]);return Object.defineProperty(track,"enabled",{get:function(){return enabled},set:function(newEnabled){"boolean"==typeof newEnabled&&newEnabled!==enabled&&(enabled=newEnabled,this.trigger("enabledchange"))}}),settings.enabled&&(track.enabled=settings.enabled),track.loaded_=!0,_ret=track,_possibleConstructorReturn(_this,_ret)}return _inherits(AudioTrack,_Track),AudioTrack}(_track2.default);exports.default=AudioTrack},{73:73,75:75,78:78,87:87}],65:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var browser=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(78)),_document2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(94)),HtmlTrackElementList=function(){function HtmlTrackElementList(){var trackElements=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];_classCallCheck(this,HtmlTrackElementList);var list=this;if(browser.IS_IE8){list=_document2.default.createElement("custom");for(var prop in HtmlTrackElementList.prototype)"constructor"!==prop&&(list[prop]=HtmlTrackElementList.prototype[prop])}list.trackElements_=[],Object.defineProperty(list,"length",{get:function(){return this.trackElements_.length}});for(var i=0,length=trackElements.length;i<length;i++)list.addTrackElement_(trackElements[i]);if(browser.IS_IE8)return list}return HtmlTrackElementList.prototype.addTrackElement_=function(trackElement){var index=this.trackElements_.length;""+index in this||Object.defineProperty(this,index,{get:function(){return this.trackElements_[index]}}),-1===this.trackElements_.indexOf(trackElement)&&this.trackElements_.push(trackElement)},HtmlTrackElementList.prototype.getTrackElementByTrack_=function(track){for(var trackElement_=void 0,i=0,length=this.trackElements_.length;i<length;i++)if(track===this.trackElements_[i].track){trackElement_=this.trackElements_[i];break}return trackElement_},HtmlTrackElementList.prototype.removeTrackElement_=function(trackElement){for(var i=0,length=this.trackElements_.length;i<length;i++)if(trackElement===this.trackElements_[i]){this.trackElements_.splice(i,1);break}},HtmlTrackElementList}();exports.default=HtmlTrackElementList},{78:78,94:94}],66:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var browser=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(78)),_document2=_interopRequireDefault(_dereq_(94)),_eventTarget2=_interopRequireDefault(_dereq_(42)),_textTrack2=_interopRequireDefault(_dereq_(72)),NONE=0,LOADED=2,HTMLTrackElement=function(_EventTarget){function HTMLTrackElement(){var options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,HTMLTrackElement);var _this=_possibleConstructorReturn(this,_EventTarget.call(this)),readyState=void 0,trackElement=_this;if(browser.IS_IE8){trackElement=_document2.default.createElement("custom");for(var prop in HTMLTrackElement.prototype)"constructor"!==prop&&(trackElement[prop]=HTMLTrackElement.prototype[prop])}var track=new _textTrack2.default(options);if(trackElement.kind=track.kind,trackElement.src=track.src,trackElement.srclang=track.language,trackElement.label=track.label,trackElement.default=track.default,Object.defineProperty(trackElement,"readyState",{get:function(){return readyState}}),Object.defineProperty(trackElement,"track",{get:function(){return track}}),readyState=NONE,track.addEventListener("loadeddata",function(){readyState=LOADED,trackElement.trigger({type:"load",target:trackElement})}),browser.IS_IE8){var _ret;return _ret=trackElement,_possibleConstructorReturn(_this,_ret)}return _this}return _inherits(HTMLTrackElement,_EventTarget),HTMLTrackElement}(_eventTarget2.default);HTMLTrackElement.prototype.allowedEvents_={load:"load"},HTMLTrackElement.NONE=NONE,HTMLTrackElement.LOADING=1,HTMLTrackElement.LOADED=LOADED,HTMLTrackElement.ERROR=3,exports.default=HTMLTrackElement},{42:42,72:72,78:78,94:94}],67:[function(_dereq_,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var browser=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(78)),_document2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(94)),TextTrackCueList=function(){function TextTrackCueList(cues){_classCallCheck(this,TextTrackCueList);var list=this;if(browser.IS_IE8){list=_document2.default.createElement("custom");for(var prop in TextTrackCueList.prototype)"constructor"!==prop&&(list[prop]=TextTrackCueList.prototype[prop])}if(TextTrackCueList.prototype.setCues_.call(list,cues),Object.defineProperty(list,"length",{get:function(){return this.length_}}),browser.IS_IE8)return list}return TextTrackCueList.prototype.setCues_=function(cues){var oldLength=this.length||0,i=0,l=cues.length;this.cues_=cues,this.length_=cues.length;if(oldLength<l)for(i=oldLength;i<l;i++)(function(index){""+index in this||Object.defineProperty(this,""+index,{get:function(){return this.cues_[index]}})}).call(this,i)},TextTrackCueList.prototype.getCueById=function(id){for(var result=null,i=0,l=this.length;i<l;i++){var cue=this[i];if(cue.id===id){result=cue;break}}return result},TextTrackCueList}();exports.default=TextTrackCueList},{78:78,94:94}],68:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function constructColor(color,opacity){return"rgba("+parseInt(color[1]+color[1],16)+","+parseInt(color[2]+color[2],16)+","+parseInt(color[3]+color[3],16)+","+opacity+")"}function tryUpdateStyle(el,style,rule){try{el.style[style]=rule}catch(e){return}}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),Fn=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(83)),_window2=_interopRequireDefault(_dereq_(95)),fontMap={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'},TextTrackDisplay=function(_Component){function TextTrackDisplay(player,options,ready){_classCallCheck(this,TextTrackDisplay);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options,ready));return player.on("loadstart",Fn.bind(_this,_this.toggleDisplay)),player.on("texttrackchange",Fn.bind(_this,_this.updateDisplay)),player.ready(Fn.bind(_this,function(){if(player.tech_&&player.tech_.featuresNativeTextTracks)this.hide();else{player.on("fullscreenchange",Fn.bind(this,this.updateDisplay));for(var tracks=this.options_.playerOptions.tracks||[],i=0;i<tracks.length;i++)this.player_.addRemoteTextTrack(tracks[i],!0);var modes={captions:1,subtitles:1},trackList=this.player_.textTracks(),firstDesc=void 0,firstCaptions=void 0;if(trackList){for(var _i=0;_i<trackList.length;_i++){var track=trackList[_i];track.default&&("descriptions"!==track.kind||firstDesc?track.kind in modes&&!firstCaptions&&(firstCaptions=track):firstDesc=track)}firstCaptions?firstCaptions.mode="showing":firstDesc&&(firstDesc.mode="showing")}}})),_this}return _inherits(TextTrackDisplay,_Component),TextTrackDisplay.prototype.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},TextTrackDisplay.prototype.createEl=function(){return _Component.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},TextTrackDisplay.prototype.clearDisplay=function(){"function"==typeof _window2.default.WebVTT&&_window2.default.WebVTT.processCues(_window2.default,[],this.el_)},TextTrackDisplay.prototype.updateDisplay=function(){var tracks=this.player_.textTracks();if(this.clearDisplay(),tracks){for(var descriptionsTrack=null,captionsSubtitlesTrack=null,i=tracks.length;i--;){var track=tracks[i];"showing"===track.mode&&("descriptions"===track.kind?descriptionsTrack=track:captionsSubtitlesTrack=track)}captionsSubtitlesTrack?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(captionsSubtitlesTrack)):descriptionsTrack&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(descriptionsTrack))}},TextTrackDisplay.prototype.updateForTrack=function(track){if("function"==typeof _window2.default.WebVTT&&track.activeCues){for(var overrides=this.player_.textTrackSettings.getValues(),cues=[],_i2=0;_i2<track.activeCues.length;_i2++)cues.push(track.activeCues[_i2]);_window2.default.WebVTT.processCues(_window2.default,cues,this.el_);for(var i=cues.length;i--;){var cue=cues[i];if(cue){var cueDiv=cue.displayState;if(overrides.color&&(cueDiv.firstChild.style.color=overrides.color),overrides.textOpacity&&tryUpdateStyle(cueDiv.firstChild,"color",constructColor(overrides.color||"#fff",overrides.textOpacity)),overrides.backgroundColor&&(cueDiv.firstChild.style.backgroundColor=overrides.backgroundColor),overrides.backgroundOpacity&&tryUpdateStyle(cueDiv.firstChild,"backgroundColor",constructColor(overrides.backgroundColor||"#000",overrides.backgroundOpacity)),overrides.windowColor&&(overrides.windowOpacity?tryUpdateStyle(cueDiv,"backgroundColor",constructColor(overrides.windowColor,overrides.windowOpacity)):cueDiv.style.backgroundColor=overrides.windowColor),overrides.edgeStyle&&("dropshadow"===overrides.edgeStyle?cueDiv.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===overrides.edgeStyle?cueDiv.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===overrides.edgeStyle?cueDiv.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===overrides.edgeStyle&&(cueDiv.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),overrides.fontPercent&&1!==overrides.fontPercent){var fontSize=_window2.default.parseFloat(cueDiv.style.fontSize);cueDiv.style.fontSize=fontSize*overrides.fontPercent+"px",cueDiv.style.height="auto",cueDiv.style.top="auto",cueDiv.style.bottom="2px"}overrides.fontFamily&&"default"!==overrides.fontFamily&&("small-caps"===overrides.fontFamily?cueDiv.firstChild.style.fontVariant="small-caps":cueDiv.firstChild.style.fontFamily=fontMap[overrides.fontFamily])}}}},TextTrackDisplay}(_component2.default);_component2.default.registerComponent("TextTrackDisplay",TextTrackDisplay),exports.default=TextTrackDisplay},{5:5,83:83,95:95}],69:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0;var trackToJson_=function(track){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(acc,prop,i){return track[prop]&&(acc[prop]=track[prop]),acc},{cues:track.cues&&Array.prototype.map.call(track.cues,function(cue){return{startTime:cue.startTime,endTime:cue.endTime,text:cue.text,id:cue.id}})})};exports.default={textTracksToJson:function(tech){var trackEls=tech.$$("track"),trackObjs=Array.prototype.map.call(trackEls,function(t){return t.track});return Array.prototype.map.call(trackEls,function(trackEl){var json=trackToJson_(trackEl.track);return trackEl.src&&(json.src=trackEl.src),json}).concat(Array.prototype.filter.call(tech.textTracks(),function(track){return-1===trackObjs.indexOf(track)}).map(trackToJson_))},jsonToTextTracks:function(json,tech){return json.forEach(function(track){var addedTrack=tech.addRemoteTextTrack(track).track;!track.src&&track.cues&&track.cues.forEach(function(cue){return addedTrack.addCue(cue)})}),tech.textTracks()},trackToJson_:trackToJson_}},{}],70:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _trackList2=_interopRequireDefault(_dereq_(74)),Fn=_interopRequireWildcard(_dereq_(83)),browser=_interopRequireWildcard(_dereq_(78)),_document2=_interopRequireDefault(_dereq_(94)),TextTrackList=function(_TrackList){function TextTrackList(){var _this,_ret,tracks=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];_classCallCheck(this,TextTrackList);var list=void 0;if(browser.IS_IE8){list=_document2.default.createElement("custom");for(var prop in _trackList2.default.prototype)"constructor"!==prop&&(list[prop]=_trackList2.default.prototype[prop]);for(var _prop in TextTrackList.prototype)"constructor"!==_prop&&(list[_prop]=TextTrackList.prototype[_prop])}return list=_this=_possibleConstructorReturn(this,_TrackList.call(this,tracks,list)),_ret=list,_possibleConstructorReturn(_this,_ret)}return _inherits(TextTrackList,_TrackList),TextTrackList.prototype.addTrack_=function(track){_TrackList.prototype.addTrack_.call(this,track),track.addEventListener("modechange",Fn.bind(this,function(){this.trigger("change")}))},TextTrackList}(_trackList2.default);exports.default=TextTrackList},{74:74,78:78,83:83,94:94}],71:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function parseOptionValue(value,parser){if(parser&&(value=parser(value)),value&&"none"!==value)return value}function getSelectedOptionValue(el,parser){return parseOptionValue(el.options[el.options.selectedIndex].value,parser)}function setSelectedOption(el,value,parser){if(value)for(var i=0;i<el.options.length;i++)if(parseOptionValue(el.options[i].value,parser)===value){el.selectedIndex=i;break}}exports.__esModule=!0;var _window2=_interopRequireDefault(_dereq_(95)),_component2=_interopRequireDefault(_dereq_(5)),_dom=_dereq_(81),Fn=_interopRequireWildcard(_dereq_(83)),Obj=_interopRequireWildcard(_dereq_(88)),_log2=_interopRequireDefault(_dereq_(86)),COLOR_BLACK=["#000","Black"],COLOR_BLUE=["#00F","Blue"],COLOR_CYAN=["#0FF","Cyan"],COLOR_GREEN=["#0F0","Green"],COLOR_MAGENTA=["#F0F","Magenta"],COLOR_RED=["#F00","Red"],COLOR_WHITE=["#FFF","White"],COLOR_YELLOW=["#FF0","Yellow"],OPACITY_OPAQUE=["1","Opaque"],OPACITY_SEMI=["0.5","Semi-Transparent"],OPACITY_TRANS=["0","Transparent"],selectConfigs={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[COLOR_BLACK,COLOR_WHITE,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[OPACITY_OPAQUE,OPACITY_SEMI,OPACITY_TRANS]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[COLOR_WHITE,COLOR_BLACK,COLOR_RED,COLOR_GREEN,COLOR_BLUE,COLOR_YELLOW,COLOR_MAGENTA,COLOR_CYAN]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(v){return"1.00"===v?null:Number(v)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[OPACITY_OPAQUE,OPACITY_SEMI]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[OPACITY_TRANS,OPACITY_SEMI,OPACITY_OPAQUE]}};selectConfigs.windowColor.options=selectConfigs.backgroundColor.options;var TextTrackSettings=function(_Component){function TextTrackSettings(player,options){_classCallCheck(this,TextTrackSettings);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.setDefaults(),_this.hide(),_this.updateDisplay=Fn.bind(_this,_this.updateDisplay),void 0===options.persistTextTrackSettings&&(_this.options_.persistTextTrackSettings=_this.options_.playerOptions.persistTextTrackSettings),_this.on(_this.$(".vjs-done-button"),"click",function(){_this.saveSettings(),_this.hide()}),_this.on(_this.$(".vjs-default-button"),"click",function(){_this.setDefaults(),_this.updateDisplay()}),Obj.each(selectConfigs,function(config){_this.on(_this.$(config.selector),"change",_this.updateDisplay)}),_this.options_.persistTextTrackSettings&&_this.restoreSettings(),_this}return _inherits(TextTrackSettings,_Component),TextTrackSettings.prototype.createElSelect_=function(key){var _this2=this,config=selectConfigs[key],id=config.id.replace("%s",this.id_);return[(0,_dom.createEl)("label",{className:"vjs-label",textContent:config.label},{for:id}),(0,_dom.createEl)("select",{id:id},void 0,config.options.map(function(o){return(0,_dom.createEl)("option",{textContent:_this2.localize(o[1]),value:o[0]})}))]},TextTrackSettings.prototype.createElFgColor_=function(){var legend=(0,_dom.createEl)("legend",{textContent:this.localize("Text")}),select=this.createElSelect_("color"),opacity=(0,_dom.createEl)("span",{className:"vjs-text-opacity vjs-opacity"},void 0,this.createElSelect_("textOpacity"));return(0,_dom.createEl)("fieldset",{className:"vjs-fg-color vjs-tracksetting"},void 0,[legend].concat(select,opacity))},TextTrackSettings.prototype.createElBgColor_=function(){var legend=(0,_dom.createEl)("legend",{textContent:this.localize("Background")}),select=this.createElSelect_("backgroundColor"),opacity=(0,_dom.createEl)("span",{className:"vjs-bg-opacity vjs-opacity"},void 0,this.createElSelect_("backgroundOpacity"));return(0,_dom.createEl)("fieldset",{className:"vjs-bg-color vjs-tracksetting"},void 0,[legend].concat(select,opacity))},TextTrackSettings.prototype.createElWinColor_=function(){var legend=(0,_dom.createEl)("legend",{textContent:this.localize("Window")}),select=this.createElSelect_("windowColor"),opacity=(0,_dom.createEl)("span",{className:"vjs-window-opacity vjs-opacity"},void 0,this.createElSelect_("windowOpacity"));return(0,_dom.createEl)("fieldset",{className:"vjs-window-color vjs-tracksetting"},void 0,[legend].concat(select,opacity))},TextTrackSettings.prototype.createElColors_=function(){return(0,_dom.createEl)("div",{className:"vjs-tracksettings-colors"},void 0,[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()])},TextTrackSettings.prototype.createElFont_=function(){var fontPercent=(0,_dom.createEl)("div",{className:"vjs-font-percent vjs-tracksetting"},void 0,this.createElSelect_("fontPercent")),edgeStyle=(0,_dom.createEl)("div",{className:"vjs-edge-style vjs-tracksetting"},void 0,this.createElSelect_("edgeStyle")),fontFamily=(0,_dom.createEl)("div",{className:"vjs-font-family vjs-tracksetting"},void 0,this.createElSelect_("fontFamily"));return(0,_dom.createEl)("div",{className:"vjs-tracksettings-font"},void 0,[fontPercent,edgeStyle,fontFamily])},TextTrackSettings.prototype.createElControls_=function(){var defaultsButton=(0,_dom.createEl)("button",{className:"vjs-default-button",textContent:this.localize("Defaults")}),doneButton=(0,_dom.createEl)("button",{className:"vjs-done-button",textContent:"Done"});return(0,_dom.createEl)("div",{className:"vjs-tracksettings-controls"},void 0,[defaultsButton,doneButton])},TextTrackSettings.prototype.createEl=function(){var settings=(0,_dom.createEl)("div",{className:"vjs-tracksettings"},void 0,[this.createElColors_(),this.createElFont_(),this.createElControls_()]),heading=(0,_dom.createEl)("div",{className:"vjs-control-text",id:"TTsettingsDialogLabel-"+this.id_,textContent:"Caption Settings Dialog"},{"aria-level":"1",role:"heading"}),description=(0,_dom.createEl)("div",{className:"vjs-control-text",id:"TTsettingsDialogDescription-"+this.id_,textContent:"Beginning of dialog window. Escape will cancel and close the window."}),doc=(0,_dom.createEl)("div",void 0,{role:"document"},[heading,description,settings]);return(0,_dom.createEl)("div",{className:"vjs-caption-settings vjs-modal-overlay",tabIndex:-1},{role:"dialog","aria-labelledby":heading.id,"aria-describedby":description.id},doc)},TextTrackSettings.prototype.getValues=function(){var _this3=this;return Obj.reduce(selectConfigs,function(accum,config,key){var value=getSelectedOptionValue(_this3.$(config.selector),config.parser);return void 0!==value&&(accum[key]=value),accum},{})},TextTrackSettings.prototype.setValues=function(values){var _this4=this;Obj.each(selectConfigs,function(config,key){setSelectedOption(_this4.$(config.selector),values[key],config.parser)})},TextTrackSettings.prototype.setDefaults=function(){var _this5=this;Obj.each(selectConfigs,function(config){var index=config.hasOwnProperty("default")?config.default:0;_this5.$(config.selector).selectedIndex=index})},TextTrackSettings.prototype.restoreSettings=function(){var values=void 0;try{values=JSON.parse(_window2.default.localStorage.getItem("vjs-text-track-settings"))}catch(err){_log2.default.warn(err)}values&&this.setValues(values)},TextTrackSettings.prototype.saveSettings=function(){if(this.options_.persistTextTrackSettings){var values=this.getValues();try{Object.keys(values).length?_window2.default.localStorage.setItem("vjs-text-track-settings",JSON.stringify(values)):_window2.default.localStorage.removeItem("vjs-text-track-settings")}catch(err){_log2.default.warn(err)}}},TextTrackSettings.prototype.updateDisplay=function(){var ttDisplay=this.player_.getChild("textTrackDisplay");ttDisplay&&ttDisplay.updateDisplay()},TextTrackSettings}(_component2.default);_component2.default.registerComponent("TextTrackSettings",TextTrackSettings),exports.default=TextTrackSettings},{5:5,81:81,83:83,86:86,88:88,95:95}],72:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _textTrackCueList2=_interopRequireDefault(_dereq_(67)),Fn=_interopRequireWildcard(_dereq_(83)),_trackEnums=_dereq_(73),_log2=_interopRequireDefault(_dereq_(86)),_window2=_interopRequireDefault(_dereq_(95)),_track2=_interopRequireDefault(_dereq_(75)),_url=_dereq_(92),_xhr2=_interopRequireDefault(_dereq_(104)),_mergeOptions2=_interopRequireDefault(_dereq_(87)),browser=_interopRequireWildcard(_dereq_(78)),parseCues=function(srcContent,track){var parser=new _window2.default.WebVTT.Parser(_window2.default,_window2.default.vttjs,_window2.default.WebVTT.StringDecoder()),errors=[];parser.oncue=function(cue){track.addCue(cue)},parser.onparsingerror=function(error){errors.push(error)},parser.onflush=function(){track.trigger({type:"loadeddata",target:track})},parser.parse(srcContent),errors.length>0&&(_window2.default.console&&_window2.default.console.groupCollapsed&&_window2.default.console.groupCollapsed("Text Track parsing errors for "+track.src),errors.forEach(function(error){return _log2.default.error(error)}),_window2.default.console&&_window2.default.console.groupEnd&&_window2.default.console.groupEnd()),parser.flush()},loadTrack=function(src,track){var opts={uri:src},crossOrigin=(0,_url.isCrossOrigin)(src);crossOrigin&&(opts.cors=crossOrigin),(0,_xhr2.default)(opts,Fn.bind(this,function(err,response,responseBody){if(err)return _log2.default.error(err,response);if(track.loaded_=!0,"function"!=typeof _window2.default.WebVTT){if(track.tech_){var loadHandler=function(){return parseCues(responseBody,track)};track.tech_.on("vttjsloaded",loadHandler),track.tech_.on("vttjserror",function(){_log2.default.error("vttjs failed to load, stopping trying to process "+track.src),track.tech_.off("vttjsloaded",loadHandler)})}}else parseCues(responseBody,track)}))},TextTrack=function(_Track){function TextTrack(){var _this,_ret,options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(_classCallCheck(this,TextTrack),!options.tech)throw new Error("A tech was not provided.");var settings=(0,_mergeOptions2.default)(options,{kind:_trackEnums.TextTrackKind[options.kind]||"subtitles",language:options.language||options.srclang||""}),mode=_trackEnums.TextTrackMode[settings.mode]||"disabled",default_=settings.default;"metadata"!==settings.kind&&"chapters"!==settings.kind||(mode="hidden");var tt=_this=_possibleConstructorReturn(this,_Track.call(this,settings));if(tt.tech_=settings.tech,browser.IS_IE8)for(var prop in TextTrack.prototype)"constructor"!==prop&&(tt[prop]=TextTrack.prototype[prop]);tt.cues_=[],tt.activeCues_=[];var cues=new _textTrackCueList2.default(tt.cues_),activeCues=new _textTrackCueList2.default(tt.activeCues_),changed=!1,timeupdateHandler=Fn.bind(tt,function(){this.activeCues,changed&&(this.trigger("cuechange"),changed=!1)});return"disabled"!==mode&&tt.tech_.ready(function(){tt.tech_.on("timeupdate",timeupdateHandler)},!0),Object.defineProperty(tt,"default",{get:function(){return default_},set:function(){}}),Object.defineProperty(tt,"mode",{get:function(){return mode},set:function(newMode){var _this2=this;_trackEnums.TextTrackMode[newMode]&&("showing"===(mode=newMode)&&this.tech_.ready(function(){_this2.tech_.on("timeupdate",timeupdateHandler)},!0),this.trigger("modechange"))}}),Object.defineProperty(tt,"cues",{get:function(){return this.loaded_?cues:null},set:function(){}}),Object.defineProperty(tt,"activeCues",{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return activeCues;for(var ct=this.tech_.currentTime(),active=[],i=0,l=this.cues.length;i<l;i++){var cue=this.cues[i];cue.startTime<=ct&&cue.endTime>=ct?active.push(cue):cue.startTime===cue.endTime&&cue.startTime<=ct&&cue.startTime+.5>=ct&&active.push(cue)}if(changed=!1,active.length!==this.activeCues_.length)changed=!0;else for(var _i=0;_i<active.length;_i++)-1===this.activeCues_.indexOf(active[_i])&&(changed=!0);return this.activeCues_=active,activeCues.setCues_(this.activeCues_),activeCues},set:function(){}}),settings.src?(tt.src=settings.src,loadTrack(settings.src,tt)):tt.loaded_=!0,_ret=tt,_possibleConstructorReturn(_this,_ret)}return _inherits(TextTrack,_Track),TextTrack.prototype.addCue=function(originalCue){var cue=originalCue;if(_window2.default.vttjs&&!(originalCue instanceof _window2.default.vttjs.VTTCue)){cue=new _window2.default.vttjs.VTTCue(originalCue.startTime,originalCue.endTime,originalCue.text);for(var prop in originalCue)prop in cue||(cue[prop]=originalCue[prop]);cue.id=originalCue.id,cue.originalCue_=originalCue}var tracks=this.tech_.textTracks();if(tracks)for(var i=0;i<tracks.length;i++)tracks[i]!==this&&tracks[i].removeCue(cue);this.cues_.push(cue),this.cues.setCues_(this.cues_)},TextTrack.prototype.removeCue=function(_removeCue){for(var i=this.cues_.length;i--;){var cue=this.cues_[i];if(cue===_removeCue||cue.originalCue_&&cue.originalCue_===_removeCue){this.cues_.splice(i,1),this.cues.setCues_(this.cues_);break}}},TextTrack}(_track2.default);TextTrack.prototype.allowedEvents_={cuechange:"cuechange"},exports.default=TextTrack},{104:104,67:67,73:73,75:75,78:78,83:83,86:86,87:87,92:92,95:95}],73:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0;exports.VideoTrackKind={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},exports.AudioTrackKind={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},exports.TextTrackKind={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},exports.TextTrackMode={disabled:"disabled",hidden:"hidden",showing:"showing"}},{}],74:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _eventTarget2=_interopRequireDefault(_dereq_(42)),browser=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(78)),_document2=_interopRequireDefault(_dereq_(94)),TrackList=function(_EventTarget){function TrackList(){var _ret,tracks=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],list=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_classCallCheck(this,TrackList);var _this=_possibleConstructorReturn(this,_EventTarget.call(this));if(!list&&(list=_this,browser.IS_IE8)){list=_document2.default.createElement("custom");for(var prop in TrackList.prototype)"constructor"!==prop&&(list[prop]=TrackList.prototype[prop])}list.tracks_=[],Object.defineProperty(list,"length",{get:function(){return this.tracks_.length}});for(var i=0;i<tracks.length;i++)list.addTrack_(tracks[i]);return _ret=list,_possibleConstructorReturn(_this,_ret)}return _inherits(TrackList,_EventTarget),TrackList.prototype.addTrack_=function(track){var index=this.tracks_.length;""+index in this||Object.defineProperty(this,index,{get:function(){return this.tracks_[index]}}),-1===this.tracks_.indexOf(track)&&(this.tracks_.push(track),this.trigger({track:track,type:"addtrack"}))},TrackList.prototype.removeTrack_=function(rtrack){for(var track=void 0,i=0,l=this.length;i<l;i++)if(this[i]===rtrack){(track=this[i]).off&&track.off(),this.tracks_.splice(i,1);break}track&&this.trigger({track:track,type:"removetrack"})},TrackList.prototype.getTrackById=function(id){for(var result=null,i=0,l=this.length;i<l;i++){var track=this[i];if(track.id===id){result=track;break}}return result},TrackList}(_eventTarget2.default);TrackList.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"};for(var event in TrackList.prototype.allowedEvents_)TrackList.prototype["on"+event]=null;exports.default=TrackList},{42:42,78:78,94:94}],75:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var browser=_interopRequireWildcard(_dereq_(78)),_document2=_interopRequireDefault(_dereq_(94)),Guid=_interopRequireWildcard(_dereq_(85)),Track=function(_EventTarget){function Track(){var _ret,options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,Track);var _this=_possibleConstructorReturn(this,_EventTarget.call(this)),track=_this;if(browser.IS_IE8){track=_document2.default.createElement("custom");for(var prop in Track.prototype)"constructor"!==prop&&(track[prop]=Track.prototype[prop])}var trackProps={id:options.id||"vjs_track_"+Guid.newGUID(),kind:options.kind||"",label:options.label||"",language:options.language||""};for(var key in trackProps)!function(key){Object.defineProperty(track,key,{get:function(){return trackProps[key]},set:function(){}})}(key);return _ret=track,_possibleConstructorReturn(_this,_ret)}return _inherits(Track,_EventTarget),Track}(_interopRequireDefault(_dereq_(42)).default);exports.default=Track},{42:42,78:78,85:85,94:94}],76:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _trackList2=_interopRequireDefault(_dereq_(74)),browser=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(78)),_document2=_interopRequireDefault(_dereq_(94)),disableOthers=function(list,track){for(var i=0;i<list.length;i++)track.id!==list[i].id&&(list[i].selected=!1)},VideoTrackList=function(_TrackList){function VideoTrackList(){var _this,_ret,tracks=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];_classCallCheck(this,VideoTrackList);for(var list=void 0,i=tracks.length-1;i>=0;i--)if(tracks[i].selected){disableOthers(tracks,tracks[i]);break}if(browser.IS_IE8){list=_document2.default.createElement("custom");for(var prop in _trackList2.default.prototype)"constructor"!==prop&&(list[prop]=_trackList2.default.prototype[prop]);for(var _prop in VideoTrackList.prototype)"constructor"!==_prop&&(list[_prop]=VideoTrackList.prototype[_prop])}return list=_this=_possibleConstructorReturn(this,_TrackList.call(this,tracks,list)),list.changing_=!1,Object.defineProperty(list,"selectedIndex",{get:function(){for(var _i=0;_i<this.length;_i++)if(this[_i].selected)return _i;return-1},set:function(){}}),_ret=list,_possibleConstructorReturn(_this,_ret)}return _inherits(VideoTrackList,_TrackList),VideoTrackList.prototype.addTrack_=function(track){var _this2=this;track.selected&&disableOthers(this,track),_TrackList.prototype.addTrack_.call(this,track),track.addEventListener&&track.addEventListener("selectedchange",function(){_this2.changing_||(_this2.changing_=!0,disableOthers(_this2,track),_this2.changing_=!1,_this2.trigger("change"))})},VideoTrackList.prototype.addTrack=function(track){this.addTrack_(track)},VideoTrackList.prototype.removeTrack=function(track){_TrackList.prototype.removeTrack_.call(this,track)},VideoTrackList}(_trackList2.default);exports.default=VideoTrackList},{74:74,78:78,94:94}],77:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _trackEnums=_dereq_(73),_track2=_interopRequireDefault(_dereq_(75)),_mergeOptions2=_interopRequireDefault(_dereq_(87)),browser=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(78)),VideoTrack=function(_Track){function VideoTrack(){var _this,_ret,options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,VideoTrack);var settings=(0,_mergeOptions2.default)(options,{kind:_trackEnums.VideoTrackKind[options.kind]||""}),track=_this=_possibleConstructorReturn(this,_Track.call(this,settings)),selected=!1;if(browser.IS_IE8)for(var prop in VideoTrack.prototype)"constructor"!==prop&&(track[prop]=VideoTrack.prototype[prop]);return Object.defineProperty(track,"selected",{get:function(){return selected},set:function(newSelected){"boolean"==typeof newSelected&&newSelected!==selected&&(selected=newSelected,this.trigger("selectedchange"))}}),settings.selected&&(track.selected=settings.selected),_ret=track,_possibleConstructorReturn(_this,_ret)}return _inherits(VideoTrack,_Track),VideoTrack}(_track2.default);exports.default=VideoTrack},{73:73,75:75,78:78,87:87}],78:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0,exports.BACKGROUND_SIZE_SUPPORTED=exports.TOUCH_ENABLED=exports.IS_ANY_SAFARI=exports.IS_SAFARI=exports.IE_VERSION=exports.IS_IE8=exports.CHROME_VERSION=exports.IS_CHROME=exports.IS_EDGE=exports.IS_FIREFOX=exports.IS_NATIVE_ANDROID=exports.IS_OLD_ANDROID=exports.ANDROID_VERSION=exports.IS_ANDROID=exports.IOS_VERSION=exports.IS_IOS=exports.IS_IPOD=exports.IS_IPHONE=exports.IS_IPAD=void 0;var Dom=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(81)),_window2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(95)),USER_AGENT=_window2.default.navigator&&_window2.default.navigator.userAgent||"",webkitVersionMap=/AppleWebKit\/([\d.]+)/i.exec(USER_AGENT),appleWebkitVersion=webkitVersionMap?parseFloat(webkitVersionMap.pop()):null,IS_IPAD=exports.IS_IPAD=/iPad/i.test(USER_AGENT),IS_IPHONE=exports.IS_IPHONE=/iPhone/i.test(USER_AGENT)&&!IS_IPAD,IS_IPOD=exports.IS_IPOD=/iPod/i.test(USER_AGENT),IS_IOS=exports.IS_IOS=IS_IPHONE||IS_IPAD||IS_IPOD,IS_ANDROID=(exports.IOS_VERSION=function(){var match=USER_AGENT.match(/OS (\d+)_/i);return match&&match[1]?match[1]:null}(),exports.IS_ANDROID=/Android/i.test(USER_AGENT)),ANDROID_VERSION=exports.ANDROID_VERSION=function(){var match=USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!match)return null;var major=match[1]&&parseFloat(match[1]),minor=match[2]&&parseFloat(match[2]);return major&&minor?parseFloat(match[1]+"."+match[2]):major||null}(),IS_EDGE=(exports.IS_OLD_ANDROID=IS_ANDROID&&/webkit/i.test(USER_AGENT)&&ANDROID_VERSION<2.3,exports.IS_NATIVE_ANDROID=IS_ANDROID&&ANDROID_VERSION<5&&appleWebkitVersion<537,exports.IS_FIREFOX=/Firefox/i.test(USER_AGENT),exports.IS_EDGE=/Edge/i.test(USER_AGENT)),IS_CHROME=exports.IS_CHROME=!IS_EDGE&&/Chrome/i.test(USER_AGENT),IS_SAFARI=(exports.CHROME_VERSION=function(){var match=USER_AGENT.match(/Chrome\/(\d+)/);return match&&match[1]?parseFloat(match[1]):null}(),exports.IS_IE8=/MSIE\s8\.0/.test(USER_AGENT),exports.IE_VERSION=function(){var result=/MSIE\s(\d+)\.\d/.exec(USER_AGENT),version=result&&parseFloat(result[1]);return!version&&/Trident\/7.0/i.test(USER_AGENT)&&/rv:11.0/.test(USER_AGENT)&&(version=11),version}(),exports.IS_SAFARI=/Safari/i.test(USER_AGENT)&&!IS_CHROME&&!IS_ANDROID&&!IS_EDGE);exports.IS_ANY_SAFARI=IS_SAFARI||IS_IOS,exports.TOUCH_ENABLED=Dom.isReal()&&("ontouchstart"in _window2.default||_window2.default.DocumentTouch&&_window2.default.document instanceof _window2.default.DocumentTouch),exports.BACKGROUND_SIZE_SUPPORTED=Dom.isReal()&&"backgroundSize"in _window2.default.document.createElement("video").style},{81:81,95:95}],79:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0,exports.bufferedPercent=function(buffered,duration){var bufferedDuration=0,start=void 0,end=void 0;if(!duration)return 0;buffered&&buffered.length||(buffered=(0,_timeRanges.createTimeRange)(0,0));for(var i=0;i<buffered.length;i++)start=buffered.start(i),(end=buffered.end(i))>duration&&(end=duration),bufferedDuration+=end-start;return bufferedDuration/duration};var _timeRanges=_dereq_(90)},{90:90}],80:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0,exports.default=function(el,prop){if(!el||!prop)return"";if("function"==typeof _window2.default.getComputedStyle){var cs=_window2.default.getComputedStyle(el);return cs?cs[prop]:""}return el.currentStyle[prop]||""};var _window2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(95))},{95:95}],81:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function isNonBlankString(str){return"string"==typeof str&&/\S/.test(str)}function throwIfWhitespace(str){if(/\s/.test(str))throw new Error("class has illegal whitespace characters")}function classRegExp(className){return new RegExp("(^|\\s)"+className+"($|\\s)")}function isEl(value){return(0,_obj.isObject)(value)&&1===value.nodeType}function createQuerier(method){return function(selector,context){if(!isNonBlankString(selector))return _document2.default[method](null);isNonBlankString(context)&&(context=_document2.default.querySelector(context));var ctx=isEl(context)?context:_document2.default;return ctx[method]&&ctx[method](selector)}}function textContent(el,text){return void 0===el.textContent?el.innerText=text:el.textContent=text,el}function hasElClass(element,classToCheck){return throwIfWhitespace(classToCheck),element.classList?element.classList.contains(classToCheck):classRegExp(classToCheck).test(element.className)}function addElClass(element,classToAdd){return element.classList?element.classList.add(classToAdd):hasElClass(element,classToAdd)||(element.className=(element.className+" "+classToAdd).trim()),element}function removeElClass(element,classToRemove){return element.classList?element.classList.remove(classToRemove):(throwIfWhitespace(classToRemove),element.className=element.className.split(/\s+/).filter(function(c){return c!==classToRemove}).join(" ")),element}function findElPosition(el){var box=void 0;if(el.getBoundingClientRect&&el.parentNode&&(box=el.getBoundingClientRect()),!box)return{left:0,top:0};var docEl=_document2.default.documentElement,body=_document2.default.body,clientLeft=docEl.clientLeft||body.clientLeft||0,scrollLeft=_window2.default.pageXOffset||body.scrollLeft,left=box.left+scrollLeft-clientLeft,clientTop=docEl.clientTop||body.clientTop||0,scrollTop=_window2.default.pageYOffset||body.scrollTop,top=box.top+scrollTop-clientTop;return{left:Math.round(left),top:Math.round(top)}}function isTextNode(value){return(0,_obj.isObject)(value)&&3===value.nodeType}function emptyEl(el){for(;el.firstChild;)el.removeChild(el.firstChild);return el}function normalizeContent(content){return"function"==typeof content&&(content=content()),(Array.isArray(content)?content:[content]).map(function(value){return"function"==typeof value&&(value=value()),isEl(value)||isTextNode(value)?value:"string"==typeof value&&/\S/.test(value)?_document2.default.createTextNode(value):void 0}).filter(function(value){return value})}function appendContent(el,content){return normalizeContent(content).forEach(function(node){return el.appendChild(node)}),el}exports.__esModule=!0,exports.$$=exports.$=void 0;var _templateObject=function(strings,raw){return strings.raw=raw,strings}(["Setting attributes in the second argument of createEl()\n                has been deprecated. Use the third argument instead.\n                createEl(type, properties, attributes). Attempting to set "," to ","."],["Setting attributes in the second argument of createEl()\n                has been deprecated. Use the third argument instead.\n                createEl(type, properties, attributes). Attempting to set "," to ","."]);exports.isReal=function(){return _document2.default===_window2.default.document&&void 0!==_document2.default.createElement},exports.isEl=isEl,exports.getEl=function(id){return 0===id.indexOf("#")&&(id=id.slice(1)),_document2.default.getElementById(id)},exports.createEl=function(){var tagName=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",properties=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},content=arguments[3],el=_document2.default.createElement(tagName);return Object.getOwnPropertyNames(properties).forEach(function(propName){var val=properties[propName];-1!==propName.indexOf("aria-")||"role"===propName||"type"===propName?(_log2.default.warn((0,_tsml2.default)(_templateObject,propName,val)),el.setAttribute(propName,val)):"textContent"===propName?textContent(el,val):el[propName]=val}),Object.getOwnPropertyNames(attributes).forEach(function(attrName){el.setAttribute(attrName,attributes[attrName])}),content&&appendContent(el,content),el},exports.textContent=textContent,exports.insertElFirst=function(child,parent){parent.firstChild?parent.insertBefore(child,parent.firstChild):parent.appendChild(child)},exports.getElData=function(el){var id=el[elIdAttr];return id||(id=el[elIdAttr]=Guid.newGUID()),elData[id]||(elData[id]={}),elData[id]},exports.hasElData=function(el){var id=el[elIdAttr];return!!id&&!!Object.getOwnPropertyNames(elData[id]).length},exports.removeElData=function(el){var id=el[elIdAttr];if(id){delete elData[id];try{delete el[elIdAttr]}catch(e){el.removeAttribute?el.removeAttribute(elIdAttr):el[elIdAttr]=null}}},exports.hasElClass=hasElClass,exports.addElClass=addElClass,exports.removeElClass=removeElClass,exports.toggleElClass=function(element,classToToggle,predicate){var has=hasElClass(element,classToToggle);if("function"==typeof predicate&&(predicate=predicate(element,classToToggle)),"boolean"!=typeof predicate&&(predicate=!has),predicate!==has)return predicate?addElClass(element,classToToggle):removeElClass(element,classToToggle),element},exports.setElAttributes=function(el,attributes){Object.getOwnPropertyNames(attributes).forEach(function(attrName){var attrValue=attributes[attrName];null===attrValue||void 0===attrValue||!1===attrValue?el.removeAttribute(attrName):el.setAttribute(attrName,!0===attrValue?"":attrValue)})},exports.getElAttributes=function(tag){var obj={},knownBooleans=",autoplay,controls,loop,muted,default,";if(tag&&tag.attributes&&tag.attributes.length>0)for(var attrs=tag.attributes,i=attrs.length-1;i>=0;i--){var attrName=attrs[i].name,attrVal=attrs[i].value;"boolean"!=typeof tag[attrName]&&-1===knownBooleans.indexOf(","+attrName+",")||(attrVal=null!==attrVal),obj[attrName]=attrVal}return obj},exports.getAttribute=function(el,attribute){return el.getAttribute(attribute)},exports.setAttribute=function(el,attribute,value){el.setAttribute(attribute,value)},exports.removeAttribute=function(el,attribute){el.removeAttribute(attribute)},exports.blockTextSelection=function(){_document2.default.body.focus(),_document2.default.onselectstart=function(){return!1}},exports.unblockTextSelection=function(){_document2.default.onselectstart=function(){return!0}},exports.findElPosition=findElPosition,exports.getPointerPosition=function(el,event){var position={},box=findElPosition(el),boxW=el.offsetWidth,boxH=el.offsetHeight,boxY=box.top,boxX=box.left,pageY=event.pageY,pageX=event.pageX;return event.changedTouches&&(pageX=event.changedTouches[0].pageX,pageY=event.changedTouches[0].pageY),position.y=Math.max(0,Math.min(1,(boxY-pageY+boxH)/boxH)),position.x=Math.max(0,Math.min(1,(pageX-boxX)/boxW)),position},exports.isTextNode=isTextNode,exports.emptyEl=emptyEl,exports.normalizeContent=normalizeContent,exports.appendContent=appendContent,exports.insertContent=function(el,content){return appendContent(emptyEl(el),content)};var _document2=_interopRequireDefault(_dereq_(94)),_window2=_interopRequireDefault(_dereq_(95)),Guid=function(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}(_dereq_(85)),_log2=_interopRequireDefault(_dereq_(86)),_tsml2=_interopRequireDefault(_dereq_(98)),_obj=_dereq_(88),elData={},elIdAttr="vdata"+(new Date).getTime();exports.$=createQuerier("querySelector"),exports.$$=createQuerier("querySelectorAll")},{85:85,86:86,88:88,94:94,95:95,98:98}],82:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _cleanUpEvents(elem,type){var data=Dom.getElData(elem);0===data.handlers[type].length&&(delete data.handlers[type],elem.removeEventListener?elem.removeEventListener(type,data.dispatcher,!1):elem.detachEvent&&elem.detachEvent("on"+type,data.dispatcher)),Object.getOwnPropertyNames(data.handlers).length<=0&&(delete data.handlers,delete data.dispatcher,delete data.disabled),0===Object.getOwnPropertyNames(data).length&&Dom.removeElData(elem)}function _handleMultipleEvents(fn,elem,types,callback){types.forEach(function(type){fn(elem,type,callback)})}function fixEvent(event){function returnTrue(){return!0}function returnFalse(){return!1}if(!event||!event.isPropagationStopped){var old=event||_window2.default.event;event={};for(var key in old)"layerX"!==key&&"layerY"!==key&&"keyLocation"!==key&&"webkitMovementX"!==key&&"webkitMovementY"!==key&&("returnValue"===key&&old.preventDefault||(event[key]=old[key]));if(event.target||(event.target=event.srcElement||_document2.default),event.relatedTarget||(event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement),event.preventDefault=function(){old.preventDefault&&old.preventDefault(),event.returnValue=!1,old.returnValue=!1,event.defaultPrevented=!0},event.defaultPrevented=!1,event.stopPropagation=function(){old.stopPropagation&&old.stopPropagation(),event.cancelBubble=!0,old.cancelBubble=!0,event.isPropagationStopped=returnTrue},event.isPropagationStopped=returnFalse,event.stopImmediatePropagation=function(){old.stopImmediatePropagation&&old.stopImmediatePropagation(),event.isImmediatePropagationStopped=returnTrue,event.stopPropagation()},event.isImmediatePropagationStopped=returnFalse,null!==event.clientX&&void 0!==event.clientX){var doc=_document2.default.documentElement,body=_document2.default.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0),event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0)}event.which=event.charCode||event.keyCode,null!==event.button&&void 0!==event.button&&(event.button=1&event.button?0:4&event.button?1:2&event.button?2:0)}return event}function on(elem,type,fn){if(Array.isArray(type))return _handleMultipleEvents(on,elem,type,fn);var data=Dom.getElData(elem);if(data.handlers||(data.handlers={}),data.handlers[type]||(data.handlers[type]=[]),fn.guid||(fn.guid=Guid.newGUID()),data.handlers[type].push(fn),data.dispatcher||(data.disabled=!1,data.dispatcher=function(event,hash){if(!data.disabled){event=fixEvent(event);var handlers=data.handlers[event.type];if(handlers)for(var handlersCopy=handlers.slice(0),m=0,n=handlersCopy.length;m<n&&!event.isImmediatePropagationStopped();m++)try{handlersCopy[m].call(elem,event,hash)}catch(e){_log2.default.error(e)}}}),1===data.handlers[type].length)if(elem.addEventListener){var options=!1;_supportsPassive&&passiveEvents.indexOf(type)>-1&&(options={passive:!0}),elem.addEventListener(type,data.dispatcher,options)}else elem.attachEvent&&elem.attachEvent("on"+type,data.dispatcher)}function off(elem,type,fn){if(Dom.hasElData(elem)){var data=Dom.getElData(elem);if(data.handlers){if(Array.isArray(type))return _handleMultipleEvents(off,elem,type,fn);var removeType=function(t){data.handlers[t]=[],_cleanUpEvents(elem,t)};if(type){var handlers=data.handlers[type];if(handlers)if(fn){if(fn.guid)for(var n=0;n<handlers.length;n++)handlers[n].guid===fn.guid&&handlers.splice(n--,1);_cleanUpEvents(elem,type)}else removeType(type)}else for(var t in data.handlers)removeType(t)}}}function trigger(elem,event,hash){var elemData=Dom.hasElData(elem)?Dom.getElData(elem):{},parent=elem.parentNode||elem.ownerDocument;if("string"==typeof event&&(event={type:event,target:elem}),event=fixEvent(event),elemData.dispatcher&&elemData.dispatcher.call(elem,event,hash),parent&&!event.isPropagationStopped()&&!0===event.bubbles)trigger.call(null,parent,event,hash);else if(!parent&&!event.defaultPrevented){var targetData=Dom.getElData(event.target);event.target[event.type]&&(targetData.disabled=!0,"function"==typeof event.target[event.type]&&event.target[event.type](),targetData.disabled=!1)}return!event.defaultPrevented}function one(elem,type,fn){if(Array.isArray(type))return _handleMultipleEvents(one,elem,type,fn);var func=function func(){off(elem,type,func),fn.apply(this,arguments)};func.guid=fn.guid=fn.guid||Guid.newGUID(),on(elem,type,func)}exports.__esModule=!0,exports.fixEvent=fixEvent,exports.on=on,exports.off=off,exports.trigger=trigger,exports.one=one;var Dom=_interopRequireWildcard(_dereq_(81)),Guid=_interopRequireWildcard(_dereq_(85)),_log2=_interopRequireDefault(_dereq_(86)),_window2=_interopRequireDefault(_dereq_(95)),_document2=_interopRequireDefault(_dereq_(94)),_supportsPassive=!1;!function(){try{var opts=Object.defineProperty({},"passive",{get:function(){_supportsPassive=!0}});_window2.default.addEventListener("test",null,opts)}catch(e){}}();var passiveEvents=["touchstart","touchmove"]},{81:81,85:85,86:86,94:94,95:95}],83:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0,exports.throttle=exports.bind=void 0;var _guid=_dereq_(85);exports.bind=function(context,fn,uid){fn.guid||(fn.guid=(0,_guid.newGUID)());var bound=function(){return fn.apply(context,arguments)};return bound.guid=uid?uid+"_"+fn.guid:fn.guid,bound},exports.throttle=function(fn,wait){var last=Date.now();return function(){var now=Date.now();now-last>=wait&&(fn.apply(void 0,arguments),last=now)}}},{85:85}],84:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0,exports.default=function(seconds){var guide=arguments.length>1&&void 0!==arguments[1]?arguments[1]:seconds;seconds=seconds<0?0:seconds;var s=Math.floor(seconds%60),m=Math.floor(seconds/60%60),h=Math.floor(seconds/3600),gm=Math.floor(guide/60%60),gh=Math.floor(guide/3600);return(isNaN(seconds)||seconds===1/0)&&(h=m=s="-"),h=h>0||gh>0?h+":":"",m=((h||gm>=10)&&m<10?"0"+m:m)+":",s=s<10?"0"+s:s,h+m+s}},{}],85:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0,exports.newGUID=function(){return _guid++};var _guid=1},{}],86:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0,exports.logByType=void 0;var _window2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(95)),_browser=_dereq_(78),_obj=_dereq_(88),log=void 0,logByType=exports.logByType=function(type,args){var stringify=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!!_browser.IE_VERSION&&_browser.IE_VERSION<11;"log"!==type&&args.unshift(type.toUpperCase()+":"),log.history.push(args),args.unshift("VIDEOJS:");var fn=_window2.default.console&&_window2.default.console[type];fn&&(stringify&&(args=args.map(function(a){if((0,_obj.isObject)(a)||Array.isArray(a))try{return JSON.stringify(a)}catch(x){return String(a)}return String(a)}).join(" ")),fn.apply?fn[Array.isArray(args)?"apply":"call"](_window2.default.console,args):fn(args))};(log=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];logByType("log",args)}).history=[],log.error=function(){for(var _len2=arguments.length,args=Array(_len2),_key2=0;_key2<_len2;_key2++)args[_key2]=arguments[_key2];return logByType("error",args)},log.warn=function(){for(var _len3=arguments.length,args=Array(_len3),_key3=0;_key3<_len3;_key3++)args[_key3]=arguments[_key3];return logByType("warn",args)},exports.default=log},{78:78,88:88,95:95}],87:[function(_dereq_,module,exports){"use strict";function mergeOptions(){for(var result={},_len=arguments.length,sources=Array(_len),_key=0;_key<_len;_key++)sources[_key]=arguments[_key];return sources.forEach(function(source){source&&(0,_obj.each)(source,function(value,key){(0,_obj.isPlain)(value)?((0,_obj.isPlain)(result[key])||(result[key]={}),result[key]=mergeOptions(result[key],value)):result[key]=value})}),result}exports.__esModule=!0,exports.default=mergeOptions;var _obj=_dereq_(88)},{88:88}],88:[function(_dereq_,module,exports){"use strict";function each(object,fn){keys(object).forEach(function(key){return fn(object[key],key)})}function isObject(value){return!!value&&"object"===(void 0===value?"undefined":_typeof(value))}exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};exports.each=each,exports.reduce=function(object,fn){var initial=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return keys(object).reduce(function(accum,key){return fn(accum,object[key],key)},initial)},exports.assign=function(target){for(var _len=arguments.length,sources=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)sources[_key-1]=arguments[_key];return Object.assign?Object.assign.apply(Object,[target].concat(sources)):(sources.forEach(function(source){source&&each(source,function(value,key){target[key]=value})}),target)},exports.isObject=isObject,exports.isPlain=function(value){return isObject(value)&&"[object Object]"===toString.call(value)&&value.constructor===Object};var toString=Object.prototype.toString,keys=function(object){return isObject(object)?Object.keys(object):[]}},{}],89:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0,exports.setTextContent=exports.createStyleElement=void 0;var _document2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(94));exports.createStyleElement=function(className){var style=_document2.default.createElement("style");return style.className=className,style},exports.setTextContent=function(el,content){el.styleSheet?el.styleSheet.cssText=content:el.textContent=content}},{94:94}],90:[function(_dereq_,module,exports){"use strict";function rangeCheck(fnName,index,maxIndex){if(index<0||index>maxIndex)throw new Error("Failed to execute '"+fnName+"' on 'TimeRanges': The index provided ("+index+") is greater than or equal to the maximum bound ("+maxIndex+").")}function getRange(fnName,valueIndex,ranges,rangeIndex){return void 0===rangeIndex&&(_log2.default.warn("DEPRECATED: Function '"+fnName+"' on 'TimeRanges' called without an index argument."),rangeIndex=0),rangeCheck(fnName,rangeIndex,ranges.length-1),ranges[rangeIndex][valueIndex]}function createTimeRangesObj(ranges){return void 0===ranges||0===ranges.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:ranges.length,start:getRange.bind(null,"start",0,ranges),end:getRange.bind(null,"end",1,ranges)}}function createTimeRanges(start,end){return Array.isArray(start)?createTimeRangesObj(start):void 0===start||void 0===end?createTimeRangesObj():createTimeRangesObj([[start,end]])}exports.__esModule=!0,exports.createTimeRange=void 0,exports.createTimeRanges=createTimeRanges;var _log2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_dereq_(86));exports.createTimeRange=createTimeRanges},{86:86}],91:[function(_dereq_,module,exports){"use strict";exports.__esModule=!0,exports.default=function(string){return"string"!=typeof string?string:string.charAt(0).toUpperCase()+string.slice(1)}},{}],92:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.__esModule=!0,exports.isCrossOrigin=exports.getFileExtension=exports.getAbsoluteURL=exports.parseUrl=void 0;var _document2=_interopRequireDefault(_dereq_(94)),_window2=_interopRequireDefault(_dereq_(95)),parseUrl=exports.parseUrl=function(url){var props=["protocol","hostname","port","pathname","search","hash","host"],a=_document2.default.createElement("a");a.href=url;var addToBody=""===a.host&&"file:"!==a.protocol,div=void 0;addToBody&&((div=_document2.default.createElement("div")).innerHTML='<a href="'+url+'"></a>',a=div.firstChild,div.setAttribute("style","display:none; position:absolute;"),_document2.default.body.appendChild(div));for(var details={},i=0;i<props.length;i++)details[props[i]]=a[props[i]];return"http:"===details.protocol&&(details.host=details.host.replace(/:80$/,"")),"https:"===details.protocol&&(details.host=details.host.replace(/:443$/,"")),addToBody&&_document2.default.body.removeChild(div),details};exports.getAbsoluteURL=function(url){if(!url.match(/^https?:\/\//)){var div=_document2.default.createElement("div");div.innerHTML='<a href="'+url+'">x</a>',url=div.firstChild.href}return url},exports.getFileExtension=function(path){if("string"==typeof path){var pathParts=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i.exec(path);if(pathParts)return pathParts.pop().toLowerCase()}return""},exports.isCrossOrigin=function(url){var winLoc=_window2.default.location,urlInfo=parseUrl(url);return(":"===urlInfo.protocol?winLoc.protocol:urlInfo.protocol)+urlInfo.host!==winLoc.protocol+winLoc.host}},{94:94,95:95}],93:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function videojs(id,options,ready){var tag=void 0;if("string"==typeof id){if(0===id.indexOf("#")&&(id=id.slice(1)),videojs.getPlayers()[id])return options&&_log2.default.warn('Player "'+id+'" is already initialised. Options will not be applied.'),ready&&videojs.getPlayers()[id].ready(ready),videojs.getPlayers()[id];tag=Dom.getEl(id)}else tag=id;if(!tag||!tag.nodeName)throw new TypeError("The element or ID supplied is not valid. (videojs)");if(tag.player||_player2.default.players[tag.playerId])return tag.player||_player2.default.players[tag.playerId];options=options||{},videojs.hooks("beforesetup").forEach(function(hookFunction){var opts=hookFunction(tag,(0,_mergeOptions3.default)(options));(0,_obj.isObject)(opts)&&!Array.isArray(opts)?options=(0,_mergeOptions3.default)(options,opts):_log2.default.error("please return an object in beforesetup hooks")});var player=new(_component2.default.getComponent("Player"))(tag,options,ready);return videojs.hooks("setup").forEach(function(hookFunction){return hookFunction(player)}),player}exports.__esModule=!0;var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_window2=_interopRequireDefault(_dereq_(95)),_document2=_interopRequireDefault(_dereq_(94)),browser=_interopRequireWildcard(_dereq_(78)),Dom=_interopRequireWildcard(_dereq_(81)),setup=_interopRequireWildcard(_dereq_(56)),stylesheet=_interopRequireWildcard(_dereq_(89)),_component2=_interopRequireDefault(_dereq_(5)),_eventTarget2=_interopRequireDefault(_dereq_(42)),Events=_interopRequireWildcard(_dereq_(82)),_player2=_interopRequireDefault(_dereq_(51)),_plugins2=_interopRequireDefault(_dereq_(52)),_mergeOptions3=_interopRequireDefault(_dereq_(87)),Fn=_interopRequireWildcard(_dereq_(83)),_textTrack2=_interopRequireDefault(_dereq_(72)),_audioTrack2=_interopRequireDefault(_dereq_(64)),_videoTrack2=_interopRequireDefault(_dereq_(77)),_timeRanges=_dereq_(90),_formatTime2=_interopRequireDefault(_dereq_(84)),_log2=_interopRequireDefault(_dereq_(86)),Url=_interopRequireWildcard(_dereq_(92)),_obj=_dereq_(88),_computedStyle2=_interopRequireDefault(_dereq_(80)),_extend2=_interopRequireDefault(_dereq_(43)),_xhr2=_interopRequireDefault(_dereq_(104)),_tech2=_interopRequireDefault(_dereq_(62));if("undefined"==typeof HTMLVideoElement&&Dom.isReal()&&(_document2.default.createElement("video"),_document2.default.createElement("audio"),_document2.default.createElement("track")),videojs.hooks_={},videojs.hooks=function(type,fn){return videojs.hooks_[type]=videojs.hooks_[type]||[],fn&&(videojs.hooks_[type]=videojs.hooks_[type].concat(fn)),videojs.hooks_[type]},videojs.hook=function(type,fn){videojs.hooks(type,fn)},videojs.removeHook=function(type,fn){var index=videojs.hooks(type).indexOf(fn);return!(index<=-1)&&(videojs.hooks_[type]=videojs.hooks_[type].slice(),videojs.hooks_[type].splice(index,1),!0)},!0!==_window2.default.VIDEOJS_NO_DYNAMIC_STYLE&&Dom.isReal()){var style=Dom.$(".vjs-styles-defaults");if(!style){style=stylesheet.createStyleElement("vjs-styles-defaults");var head=Dom.$("head");head&&head.insertBefore(style,head.firstChild),stylesheet.setTextContent(style,"\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid {\n        padding-top: 56.25%\n      }\n    ")}}setup.autoSetupTimeout(1,videojs),videojs.VERSION="5.20.2",videojs.options=_player2.default.prototype.options_,videojs.getPlayers=function(){return _player2.default.players},videojs.players=_player2.default.players,videojs.getComponent=_component2.default.getComponent,videojs.registerComponent=function(name,comp){_tech2.default.isTech(comp)&&_log2.default.warn("The "+name+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),_component2.default.registerComponent.call(_component2.default,name,comp)},videojs.getTech=_tech2.default.getTech,videojs.registerTech=_tech2.default.registerTech,videojs.browser=browser,videojs.TOUCH_ENABLED=browser.TOUCH_ENABLED,videojs.extend=_extend2.default,videojs.mergeOptions=_mergeOptions3.default,videojs.bind=Fn.bind,videojs.plugin=_plugins2.default,videojs.addLanguage=function(code,data){var _mergeOptions;return code=(""+code).toLowerCase(),videojs.options.languages=(0,_mergeOptions3.default)(videojs.options.languages,(_mergeOptions={},_mergeOptions[code]=data,_mergeOptions)),videojs.options.languages[code]},videojs.log=_log2.default,videojs.createTimeRange=videojs.createTimeRanges=_timeRanges.createTimeRanges,videojs.formatTime=_formatTime2.default,videojs.parseUrl=Url.parseUrl,videojs.isCrossOrigin=Url.isCrossOrigin,videojs.EventTarget=_eventTarget2.default,videojs.on=Events.on,videojs.one=Events.one,videojs.off=Events.off,videojs.trigger=Events.trigger,videojs.xhr=_xhr2.default,videojs.TextTrack=_textTrack2.default,videojs.AudioTrack=_audioTrack2.default,videojs.VideoTrack=_videoTrack2.default,videojs.isEl=Dom.isEl,videojs.isTextNode=Dom.isTextNode,videojs.createEl=Dom.createEl,videojs.hasClass=Dom.hasElClass,videojs.addClass=Dom.addElClass,videojs.removeClass=Dom.removeElClass,videojs.toggleClass=Dom.toggleElClass,videojs.setAttributes=Dom.setElAttributes,videojs.getAttributes=Dom.getElAttributes,videojs.emptyEl=Dom.emptyEl,videojs.appendContent=Dom.appendContent,videojs.insertContent=Dom.insertContent,videojs.computedStyle=_computedStyle2.default,"object"===(void 0===exports?"undefined":_typeof(exports))&&"object"===(void 0===module?"undefined":_typeof(module))&&(module.exports=videojs),exports.default=videojs},{104:104,42:42,43:43,5:5,51:51,52:52,56:56,62:62,64:64,72:72,77:77,78:78,80:80,81:81,82:82,83:83,84:84,86:86,87:87,88:88,89:89,90:90,92:92,94:94,95:95}],94:[function(_dereq_,module,exports){(function(global){var topLevel=void 0!==global?global:"undefined"!=typeof window?window:{},minDoc=_dereq_(96);if("undefined"!=typeof document)module.exports=document;else{var doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"];doccy||(doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"]=minDoc),module.exports=doccy}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{96:96}],95:[function(_dereq_,module,exports){(function(global){"undefined"!=typeof window?module.exports=window:void 0!==global?module.exports=global:"undefined"!=typeof self?module.exports=self:module.exports={}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],96:[function(_dereq_,module,exports){},{}],97:[function(_dereq_,module,exports){module.exports=function(obj,reviver){var json,error=null;try{json=JSON.parse(obj,reviver)}catch(err){error=err}return[error,json]}},{}],98:[function(_dereq_,module,exports){function clean(s){return s.replace(/\n\r?\s*/g,"")}module.exports=function(sa){for(var s="",i=0;i<arguments.length;i++)s+=clean(sa[i])+(arguments[i+1]||"");return s}},{}],99:[function(_dereq_,module,exports){var window=_dereq_(103),vttjs=module.exports={WebVTT:_dereq_(100),VTTCue:_dereq_(101),VTTRegion:_dereq_(102)};window.vttjs=vttjs,window.WebVTT=vttjs.WebVTT;var cueShim=vttjs.VTTCue,regionShim=vttjs.VTTRegion,nativeVTTCue=window.VTTCue,nativeVTTRegion=window.VTTRegion;vttjs.shim=function(){window.VTTCue=cueShim,window.VTTRegion=regionShim},vttjs.restore=function(){window.VTTCue=nativeVTTCue,window.VTTRegion=nativeVTTRegion},window.VTTCue||vttjs.shim()},{100:100,101:101,102:102,103:103}],100:[function(_dereq_,module,exports){function ParsingError(errorData,message){this.name="ParsingError",this.code=errorData.code,this.message=message||errorData.message}function parseTimeStamp(input){function computeSeconds(h,m,s,f){return 3600*(0|h)+60*(0|m)+(0|s)+(0|f)/1e3}var m=input.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return m?m[3]?computeSeconds(m[1],m[2],m[3].replace(":",""),m[4]):m[1]>59?computeSeconds(m[1],m[2],0,m[4]):computeSeconds(0,m[1],m[2],m[4]):null}function Settings(){this.values=_objCreate(null)}function parseOptions(input,callback,keyValueDelim,groupDelim){var groups=groupDelim?input.split(groupDelim):[input];for(var i in groups)if("string"==typeof groups[i]){var kv=groups[i].split(keyValueDelim);2===kv.length&&callback(kv[0],kv[1])}}function parseCue(input,cue,regionList){function consumeTimeStamp(){var ts=parseTimeStamp(input);if(null===ts)throw new ParsingError(ParsingError.Errors.BadTimeStamp,"Malformed timestamp: "+oInput);return input=input.replace(/^[^\sa-zA-Z-]+/,""),ts}function skipWhitespace(){input=input.replace(/^\s+/,"")}var oInput=input;if(skipWhitespace(),cue.startTime=consumeTimeStamp(),skipWhitespace(),"--\x3e"!==input.substr(0,3))throw new ParsingError(ParsingError.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+oInput);input=input.substr(3),skipWhitespace(),cue.endTime=consumeTimeStamp(),skipWhitespace(),function(input,cue){var settings=new Settings;parseOptions(input,function(k,v){switch(k){case"region":for(var i=regionList.length-1;i>=0;i--)if(regionList[i].id===v){settings.set(k,regionList[i].region);break}break;case"vertical":settings.alt(k,v,["rl","lr"]);break;case"line":var vals=v.split(","),vals0=vals[0];settings.integer(k,vals0),settings.percent(k,vals0)&&settings.set("snapToLines",!1),settings.alt(k,vals0,["auto"]),2===vals.length&&settings.alt("lineAlign",vals[1],["start","middle","end"]);break;case"position":vals=v.split(","),settings.percent(k,vals[0]),2===vals.length&&settings.alt("positionAlign",vals[1],["start","middle","end"]);break;case"size":settings.percent(k,v);break;case"align":settings.alt(k,v,["start","middle","end","left","right"])}},/:/,/\s/),cue.region=settings.get("region",null),cue.vertical=settings.get("vertical",""),cue.line=settings.get("line","auto"),cue.lineAlign=settings.get("lineAlign","start"),cue.snapToLines=settings.get("snapToLines",!0),cue.size=settings.get("size",100),cue.align=settings.get("align","middle"),cue.position=settings.get("position",{start:0,left:0,middle:50,end:100,right:100},cue.align),cue.positionAlign=settings.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},cue.align)}(input,cue)}function parseContent(window,input){function unescape1(e){return ESCAPE[e]}for(var t,rootDiv=window.document.createElement("div"),current=rootDiv,tagStack=[];null!==(t=function(){if(!input)return null;var m=input.match(/^([^<]*)(<[^>]+>?)?/);return function(result){return input=input.substr(result.length),result}(m[1]?m[1]:m[2])}());)if("<"!==t[0])current.appendChild(window.document.createTextNode(function(s){for(;m=s.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)s=s.replace(m[0],unescape1);return s}(t)));else{if("/"===t[1]){tagStack.length&&tagStack[tagStack.length-1]===t.substr(2).replace(">","")&&(tagStack.pop(),current=current.parentNode);continue}var node,ts=parseTimeStamp(t.substr(1,t.length-2));if(ts){node=window.document.createProcessingInstruction("timestamp",ts),current.appendChild(node);continue}var m=t.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!m)continue;if(!(node=function(type,annotation){var tagName=TAG_NAME[type];if(!tagName)return null;var element=window.document.createElement(tagName);element.localName=tagName;var name=TAG_ANNOTATION[type];return name&&annotation&&(element[name]=annotation.trim()),element}(m[1],m[3])))continue;if(!function(current,element){return!NEEDS_PARENT[element.localName]||NEEDS_PARENT[element.localName]===current.localName}(current,node))continue;m[2]&&(node.className=m[2].substr(1).replace("."," ")),tagStack.push(m[1]),current.appendChild(node),current=node}return rootDiv}function isStrongRTLChar(charCode){for(var i=0;i<strongRTLRanges.length;i++){var currentRange=strongRTLRanges[i];if(charCode>=currentRange[0]&&charCode<=currentRange[1])return!0}return!1}function determineBidi(cueDiv){function pushNodes(nodeStack,node){for(var i=node.childNodes.length-1;i>=0;i--)nodeStack.push(node.childNodes[i])}function nextTextNode(nodeStack){if(!nodeStack||!nodeStack.length)return null;var node=nodeStack.pop(),text=node.textContent||node.innerText;if(text){var m=text.match(/^.*(\n|\r)/);return m?(nodeStack.length=0,m[0]):text}return"ruby"===node.tagName?nextTextNode(nodeStack):node.childNodes?(pushNodes(nodeStack,node),nextTextNode(nodeStack)):void 0}var charCode,nodeStack=[],text="";if(!cueDiv||!cueDiv.childNodes)return"ltr";for(pushNodes(nodeStack,cueDiv);text=nextTextNode(nodeStack);)for(var i=0;i<text.length;i++)if(charCode=text.charCodeAt(i),isStrongRTLChar(charCode))return"rtl";return"ltr"}function computeLinePos(cue){if("number"==typeof cue.line&&(cue.snapToLines||cue.line>=0&&cue.line<=100))return cue.line;if(!cue.track||!cue.track.textTrackList||!cue.track.textTrackList.mediaElement)return-1;for(var track=cue.track,trackList=track.textTrackList,count=0,i=0;i<trackList.length&&trackList[i]!==track;i++)"showing"===trackList[i].mode&&count++;return-1*++count}function StyleBox(){}function CueStyleBox(window,cue,styleOptions){var isIE8=/MSIE\s8\.0/.test(navigator.userAgent),color="rgba(255, 255, 255, 1)",backgroundColor="rgba(0, 0, 0, 0.8)";isIE8&&(color="rgb(255, 255, 255)",backgroundColor="rgb(0, 0, 0)"),StyleBox.call(this),this.cue=cue,this.cueDiv=parseContent(window,cue.text);var styles={color:color,backgroundColor:backgroundColor,position:"relative",left:0,right:0,top:0,bottom:0,display:"inline"};isIE8||(styles.writingMode=""===cue.vertical?"horizontal-tb":"lr"===cue.vertical?"vertical-lr":"vertical-rl",styles.unicodeBidi="plaintext"),this.applyStyles(styles,this.cueDiv),this.div=window.document.createElement("div"),styles={textAlign:"middle"===cue.align?"center":cue.align,font:styleOptions.font,whiteSpace:"pre-line",position:"absolute"},isIE8||(styles.direction=determineBidi(this.cueDiv),styles.writingMode=""===cue.vertical?"horizontal-tb":"lr"===cue.vertical?"vertical-lr":"vertical-rl".stylesunicodeBidi="plaintext"),this.applyStyles(styles),this.div.appendChild(this.cueDiv);var textPos=0;switch(cue.positionAlign){case"start":textPos=cue.position;break;case"middle":textPos=cue.position-cue.size/2;break;case"end":textPos=cue.position-cue.size}""===cue.vertical?this.applyStyles({left:this.formatStyle(textPos,"%"),width:this.formatStyle(cue.size,"%")}):this.applyStyles({top:this.formatStyle(textPos,"%"),height:this.formatStyle(cue.size,"%")}),this.move=function(box){this.applyStyles({top:this.formatStyle(box.top,"px"),bottom:this.formatStyle(box.bottom,"px"),left:this.formatStyle(box.left,"px"),right:this.formatStyle(box.right,"px"),height:this.formatStyle(box.height,"px"),width:this.formatStyle(box.width,"px")})}}function BoxPosition(obj){var lh,height,width,top,isIE8=/MSIE\s8\.0/.test(navigator.userAgent);if(obj.div){height=obj.div.offsetHeight,width=obj.div.offsetWidth,top=obj.div.offsetTop;var rects=(rects=obj.div.childNodes)&&(rects=rects[0])&&rects.getClientRects&&rects.getClientRects();obj=obj.div.getBoundingClientRect(),lh=rects?Math.max(rects[0]&&rects[0].height||0,obj.height/rects.length):0}this.left=obj.left,this.right=obj.right,this.top=obj.top||top,this.height=obj.height||height,this.bottom=obj.bottom||top+(obj.height||height),this.width=obj.width||width,this.lineHeight=void 0!==lh?lh:obj.lineHeight,isIE8&&!this.lineHeight&&(this.lineHeight=13)}function moveBoxToLinePosition(window,styleBox,containerBox,boxPositions){var boxPosition=new BoxPosition(styleBox),cue=styleBox.cue,linePos=computeLinePos(cue),axis=[];if(cue.snapToLines){var size;switch(cue.vertical){case"":axis=["+y","-y"],size="height";break;case"rl":axis=["+x","-x"],size="width";break;case"lr":axis=["-x","+x"],size="width"}var step=boxPosition.lineHeight,position=step*Math.round(linePos),maxPosition=containerBox[size]+step,initialAxis=axis[0];Math.abs(position)>maxPosition&&(position=position<0?-1:1,position*=Math.ceil(maxPosition/step)*step),linePos<0&&(position+=""===cue.vertical?containerBox.height:containerBox.width,axis=axis.reverse()),boxPosition.move(initialAxis,position)}else{var calculatedPercentage=boxPosition.lineHeight/containerBox.height*100;switch(cue.lineAlign){case"middle":linePos-=calculatedPercentage/2;break;case"end":linePos-=calculatedPercentage}switch(cue.vertical){case"":styleBox.applyStyles({top:styleBox.formatStyle(linePos,"%")});break;case"rl":styleBox.applyStyles({left:styleBox.formatStyle(linePos,"%")});break;case"lr":styleBox.applyStyles({right:styleBox.formatStyle(linePos,"%")})}axis=["+y","-x","+x","-y"],boxPosition=new BoxPosition(styleBox)}var bestPosition=function(b,axis){for(var bestPosition,specifiedPosition=new BoxPosition(b),percentage=1,i=0;i<axis.length;i++){for(;b.overlapsOppositeAxis(containerBox,axis[i])||b.within(containerBox)&&b.overlapsAny(boxPositions);)b.move(axis[i]);if(b.within(containerBox))return b;var p=b.intersectPercentage(containerBox);percentage>p&&(bestPosition=new BoxPosition(b),percentage=p),b=new BoxPosition(specifiedPosition)}return bestPosition||specifiedPosition}(boxPosition,axis);styleBox.move(bestPosition.toCSSCompatValues(containerBox))}function WebVTT(){}var _objCreate=Object.create||function(){function F(){}return function(o){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return F.prototype=o,new F}}();ParsingError.prototype=_objCreate(Error.prototype),ParsingError.prototype.constructor=ParsingError,ParsingError.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Settings.prototype={set:function(k,v){this.get(k)||""===v||(this.values[k]=v)},get:function(k,dflt,defaultKey){return defaultKey?this.has(k)?this.values[k]:dflt[defaultKey]:this.has(k)?this.values[k]:dflt},has:function(k){return k in this.values},alt:function(k,v,a){for(var n=0;n<a.length;++n)if(v===a[n]){this.set(k,v);break}},integer:function(k,v){/^-?\d+$/.test(v)&&this.set(k,parseInt(v,10))},percent:function(k,v){return!!(v.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(v=parseFloat(v))>=0&&v<=100)&&(this.set(k,v),!0)}};var ESCAPE={"&amp;":"&","&lt;":"<","&gt;":">","&lrm;":"‎","&rlm;":"‏","&nbsp;":" "},TAG_NAME={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},TAG_ANNOTATION={v:"title",lang:"lang"},NEEDS_PARENT={rt:"ruby"},strongRTLRanges=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];StyleBox.prototype.applyStyles=function(styles,div){div=div||this.div;for(var prop in styles)styles.hasOwnProperty(prop)&&(div.style[prop]=styles[prop])},StyleBox.prototype.formatStyle=function(val,unit){return 0===val?0:val+unit},(CueStyleBox.prototype=_objCreate(StyleBox.prototype)).constructor=CueStyleBox,BoxPosition.prototype.move=function(axis,toMove){switch(toMove=void 0!==toMove?toMove:this.lineHeight,axis){case"+x":this.left+=toMove,this.right+=toMove;break;case"-x":this.left-=toMove,this.right-=toMove;break;case"+y":this.top+=toMove,this.bottom+=toMove;break;case"-y":this.top-=toMove,this.bottom-=toMove}},BoxPosition.prototype.overlaps=function(b2){return this.left<b2.right&&this.right>b2.left&&this.top<b2.bottom&&this.bottom>b2.top},BoxPosition.prototype.overlapsAny=function(boxes){for(var i=0;i<boxes.length;i++)if(this.overlaps(boxes[i]))return!0;return!1},BoxPosition.prototype.within=function(container){return this.top>=container.top&&this.bottom<=container.bottom&&this.left>=container.left&&this.right<=container.right},BoxPosition.prototype.overlapsOppositeAxis=function(container,axis){switch(axis){case"+x":return this.left<container.left;case"-x":return this.right>container.right;case"+y":return this.top<container.top;case"-y":return this.bottom>container.bottom}},BoxPosition.prototype.intersectPercentage=function(b2){return Math.max(0,Math.min(this.right,b2.right)-Math.max(this.left,b2.left))*Math.max(0,Math.min(this.bottom,b2.bottom)-Math.max(this.top,b2.top))/(this.height*this.width)},BoxPosition.prototype.toCSSCompatValues=function(reference){return{top:this.top-reference.top,bottom:reference.bottom-this.bottom,left:this.left-reference.left,right:reference.right-this.right,height:this.height,width:this.width}},BoxPosition.getSimpleBoxPosition=function(obj){var height=obj.div?obj.div.offsetHeight:obj.tagName?obj.offsetHeight:0,width=obj.div?obj.div.offsetWidth:obj.tagName?obj.offsetWidth:0,top=obj.div?obj.div.offsetTop:obj.tagName?obj.offsetTop:0;return{left:(obj=obj.div?obj.div.getBoundingClientRect():obj.tagName?obj.getBoundingClientRect():obj).left,right:obj.right,top:obj.top||top,height:obj.height||height,bottom:obj.bottom||top+(obj.height||height),width:obj.width||width}},WebVTT.StringDecoder=function(){return{decode:function(data){if(!data)return"";if("string"!=typeof data)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(data))}}},WebVTT.convertCueToDOMTree=function(window,cuetext){return window&&cuetext?parseContent(window,cuetext):null};WebVTT.processCues=function(window,cues,overlay){if(!window||!cues||!overlay)return null;for(;overlay.firstChild;)overlay.removeChild(overlay.firstChild);var paddedOverlay=window.document.createElement("div");if(paddedOverlay.style.position="absolute",paddedOverlay.style.left="0",paddedOverlay.style.right="0",paddedOverlay.style.top="0",paddedOverlay.style.bottom="0",paddedOverlay.style.margin="1.5%",overlay.appendChild(paddedOverlay),function(cues){for(var i=0;i<cues.length;i++)if(cues[i].hasBeenReset||!cues[i].displayState)return!0;return!1}(cues)){var boxPositions=[],containerBox=BoxPosition.getSimpleBoxPosition(paddedOverlay),styleOptions={font:Math.round(.05*containerBox.height*100)/100+"px sans-serif"};!function(){for(var styleBox,cue,i=0;i<cues.length;i++)cue=cues[i],styleBox=new CueStyleBox(window,cue,styleOptions),paddedOverlay.appendChild(styleBox.div),moveBoxToLinePosition(0,styleBox,containerBox,boxPositions),cue.displayState=styleBox.div,boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox))}()}else for(var i=0;i<cues.length;i++)paddedOverlay.appendChild(cues[i].displayState)},(WebVTT.Parser=function(window,vttjs,decoder){decoder||(decoder=vttjs,vttjs={}),vttjs||(vttjs={}),this.window=window,this.vttjs=vttjs,this.state="INITIAL",this.buffer="",this.decoder=decoder||new TextDecoder("utf8"),this.regionList=[]}).prototype={reportOrThrowError:function(e){if(!(e instanceof ParsingError))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(data){function collectNextLine(){for(var buffer=self.buffer,pos=0;pos<buffer.length&&"\r"!==buffer[pos]&&"\n"!==buffer[pos];)++pos;var line=buffer.substr(0,pos);return"\r"===buffer[pos]&&++pos,"\n"===buffer[pos]&&++pos,self.buffer=buffer.substr(pos),line}function parseRegion(input){var settings=new Settings;if(parseOptions(input,function(k,v){switch(k){case"id":settings.set(k,v);break;case"width":settings.percent(k,v);break;case"lines":settings.integer(k,v);break;case"regionanchor":case"viewportanchor":var xy=v.split(",");if(2!==xy.length)break;var anchor=new Settings;if(anchor.percent("x",xy[0]),anchor.percent("y",xy[1]),!anchor.has("x")||!anchor.has("y"))break;settings.set(k+"X",anchor.get("x")),settings.set(k+"Y",anchor.get("y"));break;case"scroll":settings.alt(k,v,["up"])}},/=/,/\s/),settings.has("id")){var region=new(self.vttjs.VTTRegion||self.window.VTTRegion);region.width=settings.get("width",100),region.lines=settings.get("lines",3),region.regionAnchorX=settings.get("regionanchorX",0),region.regionAnchorY=settings.get("regionanchorY",100),region.viewportAnchorX=settings.get("viewportanchorX",0),region.viewportAnchorY=settings.get("viewportanchorY",100),region.scroll=settings.get("scroll",""),self.onregion&&self.onregion(region),self.regionList.push({id:settings.get("id"),region:region})}}function parseTimestampMap(input){var settings=new Settings;parseOptions(input,function(k,v){switch(k){case"MPEGT":settings.integer(k+"S",v);break;case"LOCA":settings.set(k+"L",parseTimeStamp(v))}},/[^\d]:/,/,/),self.ontimestampmap&&self.ontimestampmap({MPEGTS:settings.get("MPEGTS"),LOCAL:settings.get("LOCAL")})}var self=this;data&&(self.buffer+=self.decoder.decode(data,{stream:!0}));try{var line;if("INITIAL"===self.state){if(!/\r\n|\n/.test(self.buffer))return this;var m=(line=collectNextLine()).match(/^WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new ParsingError(ParsingError.Errors.BadSignature);self.state="HEADER"}for(var alreadyCollectedLine=!1;self.buffer;){if(!/\r\n|\n/.test(self.buffer))return this;switch(alreadyCollectedLine?alreadyCollectedLine=!1:line=collectNextLine(),self.state){case"HEADER":/:/.test(line)?function(input){input.match(/X-TIMESTAMP-MAP/)?parseOptions(input,function(k,v){switch(k){case"X-TIMESTAMP-MAP":parseTimestampMap(v)}},/=/):parseOptions(input,function(k,v){switch(k){case"Region":parseRegion(v)}},/:/)}(line):line||(self.state="ID");continue;case"NOTE":line||(self.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(line)){self.state="NOTE";break}if(!line)continue;if(self.cue=new(self.vttjs.VTTCue||self.window.VTTCue)(0,0,""),self.state="CUE",-1===line.indexOf("--\x3e")){self.cue.id=line;continue}case"CUE":try{parseCue(line,self.cue,self.regionList)}catch(e){self.reportOrThrowError(e),self.cue=null,self.state="BADCUE";continue}self.state="CUETEXT";continue;case"CUETEXT":var hasSubstring=-1!==line.indexOf("--\x3e");if(!line||hasSubstring&&(alreadyCollectedLine=!0)){self.oncue&&self.oncue(self.cue),self.cue=null,self.state="ID";continue}self.cue.text&&(self.cue.text+="\n"),self.cue.text+=line;continue;case"BADCUE":line||(self.state="ID");continue}}}catch(e){self.reportOrThrowError(e),"CUETEXT"===self.state&&self.cue&&self.oncue&&self.oncue(self.cue),self.cue=null,self.state="INITIAL"===self.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var self=this;try{if(self.buffer+=self.decoder.decode(),(self.cue||"HEADER"===self.state)&&(self.buffer+="\n\n",self.parse()),"INITIAL"===self.state)throw new ParsingError(ParsingError.Errors.BadSignature)}catch(e){self.reportOrThrowError(e)}return self.onflush&&self.onflush(),this}},module.exports=WebVTT},{}],101:[function(_dereq_,module,exports){function findDirectionSetting(value){return"string"==typeof value&&(!!directionSetting[value.toLowerCase()]&&value.toLowerCase())}function findAlignSetting(value){return"string"==typeof value&&(!!alignSetting[value.toLowerCase()]&&value.toLowerCase())}function extend(obj){for(var i=1;i<arguments.length;i++){var cobj=arguments[i];for(var p in cobj)obj[p]=cobj[p]}return obj}function VTTCue(startTime,endTime,text){var cue=this,isIE8=/MSIE\s8\.0/.test(navigator.userAgent),baseObj={};isIE8?cue=document.createElement("custom"):baseObj.enumerable=!0,cue.hasBeenReset=!1;var _id="",_pauseOnExit=!1,_startTime=startTime,_endTime=endTime,_text=text,_region=null,_vertical="",_snapToLines=!0,_line="auto",_lineAlign="start",_position=50,_positionAlign="middle",_size=50,_align="middle";if(Object.defineProperty(cue,"id",extend({},baseObj,{get:function(){return _id},set:function(value){_id=""+value}})),Object.defineProperty(cue,"pauseOnExit",extend({},baseObj,{get:function(){return _pauseOnExit},set:function(value){_pauseOnExit=!!value}})),Object.defineProperty(cue,"startTime",extend({},baseObj,{get:function(){return _startTime},set:function(value){if("number"!=typeof value)throw new TypeError("Start time must be set to a number.");_startTime=value,this.hasBeenReset=!0}})),Object.defineProperty(cue,"endTime",extend({},baseObj,{get:function(){return _endTime},set:function(value){if("number"!=typeof value)throw new TypeError("End time must be set to a number.");_endTime=value,this.hasBeenReset=!0}})),Object.defineProperty(cue,"text",extend({},baseObj,{get:function(){return _text},set:function(value){_text=""+value,this.hasBeenReset=!0}})),Object.defineProperty(cue,"region",extend({},baseObj,{get:function(){return _region},set:function(value){_region=value,this.hasBeenReset=!0}})),Object.defineProperty(cue,"vertical",extend({},baseObj,{get:function(){return _vertical},set:function(value){var setting=findDirectionSetting(value);if(!1===setting)throw new SyntaxError("An invalid or illegal string was specified.");_vertical=setting,this.hasBeenReset=!0}})),Object.defineProperty(cue,"snapToLines",extend({},baseObj,{get:function(){return _snapToLines},set:function(value){_snapToLines=!!value,this.hasBeenReset=!0}})),Object.defineProperty(cue,"line",extend({},baseObj,{get:function(){return _line},set:function(value){if("number"!=typeof value&&value!==autoKeyword)throw new SyntaxError("An invalid number or illegal string was specified.");_line=value,this.hasBeenReset=!0}})),Object.defineProperty(cue,"lineAlign",extend({},baseObj,{get:function(){return _lineAlign},set:function(value){var setting=findAlignSetting(value);if(!setting)throw new SyntaxError("An invalid or illegal string was specified.");_lineAlign=setting,this.hasBeenReset=!0}})),Object.defineProperty(cue,"position",extend({},baseObj,{get:function(){return _position},set:function(value){if(value<0||value>100)throw new Error("Position must be between 0 and 100.");_position=value,this.hasBeenReset=!0}})),Object.defineProperty(cue,"positionAlign",extend({},baseObj,{get:function(){return _positionAlign},set:function(value){var setting=findAlignSetting(value);if(!setting)throw new SyntaxError("An invalid or illegal string was specified.");_positionAlign=setting,this.hasBeenReset=!0}})),Object.defineProperty(cue,"size",extend({},baseObj,{get:function(){return _size},set:function(value){if(value<0||value>100)throw new Error("Size must be between 0 and 100.");_size=value,this.hasBeenReset=!0}})),Object.defineProperty(cue,"align",extend({},baseObj,{get:function(){return _align},set:function(value){var setting=findAlignSetting(value);if(!setting)throw new SyntaxError("An invalid or illegal string was specified.");_align=setting,this.hasBeenReset=!0}})),cue.displayState=void 0,isIE8)return cue}var autoKeyword="auto",directionSetting={"":!0,lr:!0,rl:!0},alignSetting={start:!0,middle:!0,end:!0,left:!0,right:!0};VTTCue.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},module.exports=VTTCue},{}],102:[function(_dereq_,module,exports){function findScrollSetting(value){return"string"==typeof value&&(!!scrollSetting[value.toLowerCase()]&&value.toLowerCase())}function isValidPercentValue(value){return"number"==typeof value&&value>=0&&value<=100}var scrollSetting={"":!0,up:!0};module.exports=function(){var _width=100,_lines=3,_regionAnchorX=0,_regionAnchorY=100,_viewportAnchorX=0,_viewportAnchorY=100,_scroll="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return _width},set:function(value){if(!isValidPercentValue(value))throw new Error("Width must be between 0 and 100.");_width=value}},lines:{enumerable:!0,get:function(){return _lines},set:function(value){if("number"!=typeof value)throw new TypeError("Lines must be set to a number.");_lines=value}},regionAnchorY:{enumerable:!0,get:function(){return _regionAnchorY},set:function(value){if(!isValidPercentValue(value))throw new Error("RegionAnchorX must be between 0 and 100.");_regionAnchorY=value}},regionAnchorX:{enumerable:!0,get:function(){return _regionAnchorX},set:function(value){if(!isValidPercentValue(value))throw new Error("RegionAnchorY must be between 0 and 100.");_regionAnchorX=value}},viewportAnchorY:{enumerable:!0,get:function(){return _viewportAnchorY},set:function(value){if(!isValidPercentValue(value))throw new Error("ViewportAnchorY must be between 0 and 100.");_viewportAnchorY=value}},viewportAnchorX:{enumerable:!0,get:function(){return _viewportAnchorX},set:function(value){if(!isValidPercentValue(value))throw new Error("ViewportAnchorX must be between 0 and 100.");_viewportAnchorX=value}},scroll:{enumerable:!0,get:function(){return _scroll},set:function(value){var setting=findScrollSetting(value);if(!1===setting)throw new SyntaxError("An invalid or illegal string was specified.");_scroll=setting}}})}},{}],103:[function(_dereq_,module,exports){(function(global){var win;win="undefined"!=typeof window?window:void 0!==global?global:"undefined"!=typeof self?self:{},module.exports=win}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],104:[function(_dereq_,module,exports){"use strict";function isEmpty(obj){for(var i in obj)if(obj.hasOwnProperty(i))return!1;return!0}function initParams(uri,options,callback){var params=uri;return isFunction(options)?(callback=options,"string"==typeof uri&&(params={uri:uri})):params=xtend(options,{uri:uri}),params.callback=callback,params}function createXHR(uri,options,callback){return options=initParams(uri,options,callback),_createXHR(options)}function _createXHR(options){function getBody(){var body=void 0;if(body=xhr.response?xhr.response:xhr.responseText||getXml(xhr),isJson)try{body=JSON.parse(body)}catch(e){}return body}function errorFunc(evt){return clearTimeout(timeoutTimer),evt instanceof Error||(evt=new Error(""+(evt||"Unknown XMLHttpRequest Error"))),evt.statusCode=0,callback(evt,failureResponse)}function loadFunc(){if(!aborted){var status;clearTimeout(timeoutTimer),status=options.useXDR&&void 0===xhr.status?200:1223===xhr.status?204:xhr.status;var response=failureResponse,err=null;return 0!==status?(response={body:getBody(),statusCode:status,method:method,headers:{},url:uri,rawRequest:xhr},xhr.getAllResponseHeaders&&(response.headers=parseHeaders(xhr.getAllResponseHeaders()))):err=new Error("Internal XMLHttpRequest Error"),callback(err,response,response.body)}}if(void 0===options.callback)throw new Error("callback argument missing");var called=!1,callback=function(err,response,body){called||(called=!0,options.callback(err,response,body))},failureResponse={body:void 0,headers:{},statusCode:0,method:method,url:uri,rawRequest:xhr},xhr=options.xhr||null;xhr||(xhr=options.cors||options.useXDR?new createXHR.XDomainRequest:new createXHR.XMLHttpRequest);var key,aborted,timeoutTimer,uri=xhr.url=options.uri||options.url,method=xhr.method=options.method||"GET",body=options.body||options.data||null,headers=xhr.headers=options.headers||{},sync=!!options.sync,isJson=!1;if("json"in options&&(isJson=!0,headers.accept||headers.Accept||(headers.Accept="application/json"),"GET"!==method&&"HEAD"!==method&&(headers["content-type"]||headers["Content-Type"]||(headers["Content-Type"]="application/json"),body=JSON.stringify(options.json))),xhr.onreadystatechange=function(){4===xhr.readyState&&loadFunc()},xhr.onload=loadFunc,xhr.onerror=errorFunc,xhr.onprogress=function(){},xhr.ontimeout=errorFunc,xhr.open(method,uri,!sync,options.username,options.password),sync||(xhr.withCredentials=!!options.withCredentials),!sync&&options.timeout>0&&(timeoutTimer=setTimeout(function(){aborted=!0,xhr.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",errorFunc(e)},options.timeout)),xhr.setRequestHeader)for(key in headers)headers.hasOwnProperty(key)&&xhr.setRequestHeader(key,headers[key]);else if(options.headers&&!isEmpty(options.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in options&&(xhr.responseType=options.responseType),"beforeSend"in options&&"function"==typeof options.beforeSend&&options.beforeSend(xhr),xhr.send(body),xhr}function getXml(xhr){if("document"===xhr.responseType)return xhr.responseXML;var firefoxBugTakenEffect=204===xhr.status&&xhr.responseXML&&"parsererror"===xhr.responseXML.documentElement.nodeName;return""!==xhr.responseType||firefoxBugTakenEffect?null:xhr.responseXML}var window=_dereq_(95),isFunction=_dereq_(105),parseHeaders=_dereq_(108),xtend=_dereq_(109);module.exports=createXHR,createXHR.XMLHttpRequest=window.XMLHttpRequest||function(){},createXHR.XDomainRequest="withCredentials"in new createXHR.XMLHttpRequest?createXHR.XMLHttpRequest:window.XDomainRequest,function(array,iterator){for(var i=0;i<array.length;i++)iterator(array[i])}(["get","put","post","patch","head","delete"],function(method){createXHR["delete"===method?"del":method]=function(uri,options,callback){return options=initParams(uri,options,callback),options.method=method.toUpperCase(),_createXHR(options)}})},{105:105,108:108,109:109,95:95}],105:[function(_dereq_,module,exports){module.exports=function(fn){var string=toString.call(fn);return"[object Function]"===string||"function"==typeof fn&&"[object RegExp]"!==string||"undefined"!=typeof window&&(fn===window.setTimeout||fn===window.alert||fn===window.confirm||fn===window.prompt)};var toString=Object.prototype.toString},{}],106:[function(_dereq_,module,exports){function forEachArray(array,iterator,context){for(var i=0,len=array.length;i<len;i++)hasOwnProperty.call(array,i)&&iterator.call(context,array[i],i,array)}function forEachString(string,iterator,context){for(var i=0,len=string.length;i<len;i++)iterator.call(context,string.charAt(i),i,string)}function forEachObject(object,iterator,context){for(var k in object)hasOwnProperty.call(object,k)&&iterator.call(context,object[k],k,object)}var isFunction=_dereq_(105);module.exports=function(list,iterator,context){if(!isFunction(iterator))throw new TypeError("iterator must be a function");arguments.length<3&&(context=this),"[object Array]"===toString.call(list)?forEachArray(list,iterator,context):"string"==typeof list?forEachString(list,iterator,context):forEachObject(list,iterator,context)};var toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty},{105:105}],107:[function(_dereq_,module,exports){(exports=module.exports=function(str){return str.replace(/^\s*|\s*$/g,"")}).left=function(str){return str.replace(/^\s*/,"")},exports.right=function(str){return str.replace(/\s*$/,"")}},{}],108:[function(_dereq_,module,exports){var trim=_dereq_(107),forEach=_dereq_(106),isArray=function(arg){return"[object Array]"===Object.prototype.toString.call(arg)};module.exports=function(headers){if(!headers)return{};var result={};return forEach(trim(headers).split("\n"),function(row){var index=row.indexOf(":"),key=trim(row.slice(0,index)).toLowerCase(),value=trim(row.slice(index+1));void 0===result[key]?result[key]=value:isArray(result[key])?result[key].push(value):result[key]=[result[key],value]}),result}},{106:106,107:107}],109:[function(_dereq_,module,exports){module.exports=function(){for(var target={},i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source)hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target};var hasOwnProperty=Object.prototype.hasOwnProperty},{}]},{},[93])(93)}),function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).videojsContribHls=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i.return&&_i.return()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_globalWindow2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("global/window")),findAdCue=function(track,mediaTime){for(var cues=track.cues,i=0;i<cues.length;i++){var cue=cues[i];if(mediaTime>=cue.adStartTime&&mediaTime<=cue.adEndTime)return cue}return null};exports.default={updateAdCues:function(media,track){var offset=arguments.length<=2||void 0===arguments[2]?0:arguments[2];if(media.segments)for(var mediaTime=offset,cue=void 0,i=0;i<media.segments.length;i++){var segment=media.segments[i];if(cue||(cue=findAdCue(track,mediaTime+segment.duration/2)),cue){if("cueIn"in segment){cue.endTime=mediaTime,cue.adEndTime=mediaTime,mediaTime+=segment.duration,cue=null;continue}if(mediaTime<cue.endTime){mediaTime+=segment.duration;continue}cue.endTime+=segment.duration}else if("cueOut"in segment&&((cue=new _globalWindow2.default.VTTCue(mediaTime,mediaTime+segment.duration,segment.cueOut)).adStartTime=mediaTime,cue.adEndTime=mediaTime+parseFloat(segment.cueOut),track.addCue(cue)),"cueOutCont"in segment){var adOffset=void 0,adTotal=void 0,_segment$cueOutCont$split$map=segment.cueOutCont.split("/").map(parseFloat),_segment$cueOutCont$split$map2=_slicedToArray(_segment$cueOutCont$split$map,2);adOffset=_segment$cueOutCont$split$map2[0],adTotal=_segment$cueOutCont$split$map2[1],(cue=new _globalWindow2.default.VTTCue(mediaTime,mediaTime+segment.duration,"")).adStartTime=mediaTime-adOffset,cue.adEndTime=cue.adStartTime+adTotal,track.addCue(cue)}mediaTime+=segment.duration}},findAdCue:findAdCue},module.exports=exports.default},{"global/window":31}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var textRange=function(range,i){return range.start(i)+"-"+range.end(i)},formatHexString=function(e,i){var value=e.toString(16);return"00".substring(0,2-value.length)+value+(i%2?" ":"")},formatAsciiString=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},utils={hexDump:function(data){for(var bytes=Array.prototype.slice.call(data),result="",j=0;j<bytes.length/16;j++)result+=bytes.slice(16*j,16*j+16).map(formatHexString).join("")+" "+bytes.slice(16*j,16*j+16).map(formatAsciiString).join("")+"\n";return result},tagDump:function(tag){return utils.hexDump(tag.bytes)},textRanges:function(ranges){var result="",i=void 0;for(i=0;i<ranges.length;i++)result+=textRange(ranges,i)+" ";return result},createTransferableMessage:function(message){var transferable={};return Object.keys(message).forEach(function(key){var value=message[key];ArrayBuffer.isView(value)?transferable[key]={bytes:value.buffer,byteOffset:value.byteOffset,byteLength:value.byteLength}:transferable[key]=value}),transferable},initSegmentId:function(initSegment){var byterange=initSegment.byterange||{length:1/0,offset:0};return[byterange.length,byterange.offset,initSegment.resolvedUri].join(",")}};exports.default=utils,module.exports=exports.default},{}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,GOAL_BUFFER_LENGTH_RATE:1,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,BUFFER_LOW_WATER_LINE_RATE:1},module.exports=exports.default},{}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _globalWindow2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("global/window")),_aesDecrypter=require("aes-decrypter"),_binUtils=require("./bin-utils"),DecrypterWorker=function(self){self.onmessage=function(event){var data=event.data,encrypted=new Uint8Array(data.encrypted.bytes,data.encrypted.byteOffset,data.encrypted.byteLength),key=new Uint32Array(data.key.bytes,data.key.byteOffset,data.key.byteLength/4),iv=new Uint32Array(data.iv.bytes,data.iv.byteOffset,data.iv.byteLength/4);new _aesDecrypter.Decrypter(encrypted,key,iv,function(err,bytes){_globalWindow2.default.postMessage((0,_binUtils.createTransferableMessage)({source:data.source,decrypted:bytes}),[bytes.buffer])})}};exports.default=function(self){return new DecrypterWorker(self)},module.exports=exports.default},{"./bin-utils":2,"aes-decrypter":24,"global/window":31}],5:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x,_x2,_x3){for(var _again=!0;_again;){var object=_x,property=_x2,receiver=_x3;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x=parent,_x2=property,_x3=receiver,_again=!0,desc=parent=void 0}},_playlistLoader2=_interopRequireDefault(require("./playlist-loader")),_segmentLoader2=_interopRequireDefault(require("./segment-loader")),_vttSegmentLoader2=_interopRequireDefault(require("./vtt-segment-loader")),_ranges2=_interopRequireDefault(require("./ranges")),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),_adCueTags2=_interopRequireDefault(require("./ad-cue-tags")),_syncController2=_interopRequireDefault(require("./sync-controller")),_videojsContribMediaSourcesEs5CodecUtils=require("videojs-contrib-media-sources/es5/codec-utils"),_webworkify2=_interopRequireDefault(require("webworkify")),_decrypterWorker2=_interopRequireDefault(require("./decrypter-worker")),_config2=_interopRequireDefault(require("./config")),_utilCodecsJs=require("./util/codecs.js"),Hls=void 0,defaultCodecs={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},loaderStats=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],sumLoaderStat=function(stat){return this.audioSegmentLoader_[stat]+this.mainSegmentLoader_[stat]},objectChanged=function(a,b){if(typeof a!=typeof b)return!0;if(Object.keys(a).length!==Object.keys(b).length)return!0;for(var prop in a)if(a[prop]!==b[prop])return!0;return!1},mapLegacyAvcCodecs_=function(codecString){return codecString.replace(/avc1\.(\d+)\.(\d+)/i,function(match){return(0,_videojsContribMediaSourcesEs5CodecUtils.translateLegacyCodecs)([match])[0]})};exports.mapLegacyAvcCodecs_=mapLegacyAvcCodecs_;var makeMimeTypeString=function(type,container,codecs){return type+"/"+container+'; codecs="'+codecs.filter(function(c){return!!c}).join(", ")+'"'},getContainerType=function(media){return media.segments&&media.segments.length&&media.segments[0].map?"mp4":"mp2t"},getCodecs=function(media){var mediaAttributes=media.attributes||{};return mediaAttributes.CODECS?(0,_utilCodecsJs.parseCodecs)(mediaAttributes.CODECS):defaultCodecs},mimeTypesForPlaylist_=function(master,media){var containerType=getContainerType(media),codecInfo=getCodecs(media),mediaAttributes=media.attributes||{},isMuxed=!0,isMaat=!1;if(!media)return[];if(master.mediaGroups.AUDIO&&mediaAttributes.AUDIO){var audioGroup=master.mediaGroups.AUDIO[mediaAttributes.AUDIO];if(audioGroup){isMaat=!0,isMuxed=!1;for(var groupId in audioGroup)if(!audioGroup[groupId].uri){isMuxed=!0;break}}}isMaat&&!codecInfo.audioProfile&&(_videoJs2.default.log.warn("Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"),codecInfo.audioProfile=defaultCodecs.audioProfile);var codecStrings={};codecInfo.videoCodec&&(codecStrings.video=""+codecInfo.videoCodec+codecInfo.videoObjectTypeIndicator),codecInfo.audioProfile&&(codecStrings.audio="mp4a.40."+codecInfo.audioProfile);var justAudio=makeMimeTypeString("audio",containerType,[codecStrings.audio]),justVideo=makeMimeTypeString("video",containerType,[codecStrings.video]),bothVideoAudio=makeMimeTypeString("video",containerType,[codecStrings.video,codecStrings.audio]);return isMaat?!isMuxed&&codecStrings.video?[justVideo,justAudio]:[bothVideoAudio,justAudio]:codecStrings.video?[bothVideoAudio]:[justAudio]};exports.mimeTypesForPlaylist_=mimeTypesForPlaylist_;var MasterPlaylistController=function(_videojs$EventTarget){function MasterPlaylistController(options){var _this=this;_classCallCheck(this,MasterPlaylistController),_get(Object.getPrototypeOf(MasterPlaylistController.prototype),"constructor",this).call(this);var url=options.url,withCredentials=options.withCredentials,mode=options.mode,tech=options.tech,bandwidth=options.bandwidth,externHls=options.externHls,useCueTags=options.useCueTags,blacklistDuration=options.blacklistDuration,enableLowInitialPlaylist=options.enableLowInitialPlaylist;if(!url)throw new Error("A non-empty playlist URL is required");Hls=externHls,this.withCredentials=withCredentials,this.tech_=tech,this.hls_=tech.hls,this.mode_=mode,this.useCueTags_=useCueTags,this.blacklistDuration=blacklistDuration,this.enableLowInitialPlaylist=enableLowInitialPlaylist,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:this.withCredentials,timeout:null},this.audioGroups_={},this.subtitleGroups_={groups:{},tracks:{}},this.closedCaptionGroups_={groups:{},tracks:{}},this.mediaSource=new _videoJs2.default.MediaSource({mode:mode}),this.audioinfo_=null,this.mediaSource.on("audioinfo",this.handleAudioinfoUpdate_.bind(this)),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_.bind(this)),this.seekable_=_videoJs2.default.createTimeRanges(),this.hasPlayed_=function(){return!1},this.syncController_=new _syncController2.default(options),this.segmentMetadataTrack_=tech.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=(0,_webworkify2.default)(_decrypterWorker2.default);var segmentLoaderSettings={hls:this.hls_,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:function(){return _this.seekable()},seeking:function(){return _this.tech_.seeking()},duration:function(){return _this.mediaSource.duration},hasPlayed:function(){return _this.hasPlayed_()},goalBufferLength:function(){return _this.goalBufferLength()},bandwidth:bandwidth,syncController:this.syncController_,decrypter:this.decrypter_};this.masterPlaylistLoader_=new _playlistLoader2.default(url,this.hls_,this.withCredentials),this.setupMasterPlaylistLoaderListeners_(),this.audioPlaylistLoader_=null,this.subtitlePlaylistLoader_=null,this.mainSegmentLoader_=new _segmentLoader2.default(_videoJs2.default.mergeOptions(segmentLoaderSettings,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),options),this.audioSegmentLoader_=new _segmentLoader2.default(_videoJs2.default.mergeOptions(segmentLoaderSettings,{loaderType:"audio"}),options),this.subtitleSegmentLoader_=new _vttSegmentLoader2.default(_videoJs2.default.mergeOptions(segmentLoaderSettings,{loaderType:"vtt"}),options),this.setupSegmentLoaderListeners_(),loaderStats.forEach(function(stat){_this[stat+"_"]=sumLoaderStat.bind(_this,stat)}),this.masterPlaylistLoader_.load()}return _inherits(MasterPlaylistController,_videoJs2["default"].EventTarget),_createClass(MasterPlaylistController,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var _this2=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var media=_this2.masterPlaylistLoader_.media(),requestTimeout=1.5*_this2.masterPlaylistLoader_.targetDuration*1e3;_this2.masterPlaylistLoader_.isLowestEnabledRendition_()?_this2.requestOptions_.timeout=0:_this2.requestOptions_.timeout=requestTimeout,media.endList&&"none"!==_this2.tech_.preload()&&(_this2.mainSegmentLoader_.playlist(media,_this2.requestOptions_),_this2.mainSegmentLoader_.load()),_this2.fillAudioTracks_(),_this2.setupAudio(),_this2.fillSubtitleTracks_(),_this2.setupSubtitles(),_this2.triggerPresenceUsage_(_this2.master(),media),_this2.fillClosedCaptionTracks_();try{_this2.setupSourceBuffers_()}catch(e){return _videoJs2.default.log.warn("Failed to create SourceBuffers",e),_this2.mediaSource.endOfStream("decode")}_this2.setupFirstPlay(),_this2.trigger("audioupdate"),_this2.trigger("selectedinitialmedia")}),this.masterPlaylistLoader_.on("loadedplaylist",function(){var updatedPlaylist=_this2.masterPlaylistLoader_.media();if(!updatedPlaylist){var selectedMedia=void 0;return _this2.enableLowInitialPlaylist&&(selectedMedia=_this2.selectInitialPlaylist()),selectedMedia||(selectedMedia=_this2.selectPlaylist()),_this2.initialMedia_=selectedMedia,void _this2.masterPlaylistLoader_.media(_this2.initialMedia_)}_this2.useCueTags_&&_this2.updateAdCues_(updatedPlaylist),_this2.mainSegmentLoader_.playlist(updatedPlaylist,_this2.requestOptions_),_this2.updateDuration(),_this2.tech_.paused()||_this2.mainSegmentLoader_.load(),updatedPlaylist.endList||function(){var addSeekableRange=function(){var seekable=_this2.seekable();0!==seekable.length&&_this2.mediaSource.addSeekableRange_(seekable.start(0),seekable.end(0))};_this2.duration()!==1/0?_this2.tech_.one("durationchange",function onDurationchange(){_this2.duration()===1/0?addSeekableRange():_this2.tech_.one("durationchange",onDurationchange)}):addSeekableRange()}()}),this.masterPlaylistLoader_.on("error",function(){_this2.blacklistCurrentPlaylist(_this2.masterPlaylistLoader_.error)}),this.masterPlaylistLoader_.on("mediachanging",function(){_this2.mainSegmentLoader_.abort(),_this2.mainSegmentLoader_.pause()}),this.masterPlaylistLoader_.on("mediachange",function(){var media=_this2.masterPlaylistLoader_.media(),requestTimeout=1.5*_this2.masterPlaylistLoader_.targetDuration*1e3;_this2.masterPlaylistLoader_.isLowestEnabledRendition_()?_this2.requestOptions_.timeout=0:_this2.requestOptions_.timeout=requestTimeout,_this2.mainSegmentLoader_.playlist(media,_this2.requestOptions_),_this2.mainSegmentLoader_.load(),_this2.activeAudioGroup().filter(function(track){return track.enabled})[0]||(_this2.mediaGroupChanged(),_this2.trigger("audioupdate")),_this2.setupSubtitles(),_this2.tech_.trigger({type:"mediachange",bubbles:!0})}),this.masterPlaylistLoader_.on("playlistunchanged",function(){var updatedPlaylist=_this2.masterPlaylistLoader_.media();_this2.stuckAtPlaylistEnd_(updatedPlaylist)&&(_this2.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),_this2.tech_.trigger("playliststuck"))}),this.masterPlaylistLoader_.on("renditiondisabled",function(){_this2.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})}),this.masterPlaylistLoader_.on("renditionenabled",function(){_this2.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})}},{key:"triggerPresenceUsage_",value:function(master,media){var mediaGroups=master.mediaGroups||{},defaultDemuxed=!0,audioGroupKeys=Object.keys(mediaGroups.AUDIO);for(var mediaGroup in mediaGroups.AUDIO)for(var label in mediaGroups.AUDIO[mediaGroup])mediaGroups.AUDIO[mediaGroup][label].uri||(defaultDemuxed=!1);defaultDemuxed&&this.tech_.trigger({type:"usage",name:"hls-demuxed"}),Object.keys(mediaGroups.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"}),Hls.Playlist.isAes(media)&&this.tech_.trigger({type:"usage",name:"hls-aes"}),Hls.Playlist.isFmp4(media)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"}),audioGroupKeys.length&&Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length>1&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var _this3=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){var nextPlaylist=_this3.selectPlaylist(),currentPlaylist=_this3.masterPlaylistLoader_.media(),buffered=_this3.tech_.buffered(),forwardBuffer=buffered.length?buffered.end(buffered.length-1)-_this3.tech_.currentTime():0,bufferLowWaterLine=_this3.bufferLowWaterLine();(!currentPlaylist.endList||_this3.duration()<_config2.default.MAX_BUFFER_LOW_WATER_LINE||nextPlaylist.attributes.BANDWIDTH<currentPlaylist.attributes.BANDWIDTH||forwardBuffer>=bufferLowWaterLine)&&_this3.masterPlaylistLoader_.media(nextPlaylist),_this3.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("progress",function(){_this3.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){_this3.blacklistCurrentPlaylist(_this3.mainSegmentLoader_.error())}),this.mainSegmentLoader_.on("syncinfoupdate",function(){_this3.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){_this3.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){_this3.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("ended",function(){_this3.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",function(){_this3.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120)}),this.mainSegmentLoader_.on("reseteverything",function(){_this3.tech_.trigger("hls-reset")}),this.audioSegmentLoader_.on("ended",function(){_this3.onEndOfStream()}),this.audioSegmentLoader_.on("error",function(){_videoJs2.default.log.warn("Problem encountered with the current alternate audio track. Switching back to default."),_this3.audioSegmentLoader_.abort(),_this3.audioPlaylistLoader_=null,_this3.setupAudio()}),this.subtitleSegmentLoader_.on("error",this.handleSubtitleError_.bind(this))}},{key:"handleAudioinfoUpdate_",value:function(event){if(!Hls.supportsAudioInfoChange_()&&this.audioInfo_&&objectChanged(this.audioInfo_,event.info)){var error="had different audio properties (channels, sample rate, etc.) or changed in some other way.  This behavior is currently unsupported in Firefox 48 and below due to an issue: \n\nhttps://bugzilla.mozilla.org/show_bug.cgi?id=1247138\n\n",enabledIndex=this.activeAudioGroup().map(function(track){return track.enabled}).indexOf(!0),enabledTrack=this.activeAudioGroup()[enabledIndex],defaultTrack=this.activeAudioGroup().filter(function(track){return track.properties_&&track.properties_.default})[0];this.audioPlaylistLoader_?(error="The audio track '"+enabledTrack.label+"' that we tried to switch to "+error+" Unfortunately this means we will have to return you to the main track '"+defaultTrack.label+"'. Sorry!",defaultTrack.enabled=!0,this.activeAudioGroup().splice(enabledIndex,1),this.trigger("audioupdate")):(error="The rendition that we tried to switch to "+error+"Unfortunately that means we will have to blacklist the current playlist and switch to another. Sorry!",this.blacklistCurrentPlaylist()),_videoJs2.default.log.warn(error),this.setupAudio()}else this.audioInfo_=event.info}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"fillAudioTracks_",value:function(){var mediaGroups=this.master().mediaGroups||{};mediaGroups&&mediaGroups.AUDIO&&0!==Object.keys(mediaGroups.AUDIO).length&&"html5"===this.mode_||(mediaGroups.AUDIO={main:{default:{default:!0}}});for(var mediaGroup in mediaGroups.AUDIO){this.audioGroups_[mediaGroup]||(this.audioGroups_[mediaGroup]=[]);for(var label in mediaGroups.AUDIO[mediaGroup]){var properties=mediaGroups.AUDIO[mediaGroup][label],track=new _videoJs2.default.AudioTrack({id:label,kind:this.audioTrackKind_(properties),enabled:!1,language:properties.language,label:label});track.properties_=properties,this.audioGroups_[mediaGroup].push(track)}}(this.activeAudioGroup().filter(function(audioTrack){return audioTrack.properties_.default})[0]||this.activeAudioGroup()[0]).enabled=!0}},{key:"audioTrackKind_",value:function(properties){var kind=properties.default?"main":"alternative";return properties.characteristics&&properties.characteristics.indexOf("public.accessibility.describes-video")>=0&&(kind="main-desc"),kind}},{key:"fillSubtitleTracks_",value:function(){var mediaGroups=this.master().mediaGroups||{};for(var mediaGroup in mediaGroups.SUBTITLES){this.subtitleGroups_.groups[mediaGroup]||(this.subtitleGroups_.groups[mediaGroup]=[]);for(var label in mediaGroups.SUBTITLES[mediaGroup]){var properties=mediaGroups.SUBTITLES[mediaGroup][label];if(!properties.forced&&(this.subtitleGroups_.groups[mediaGroup].push(_videoJs2.default.mergeOptions({id:label},properties)),void 0===this.subtitleGroups_.tracks[label])){var track=this.tech_.addRemoteTextTrack({id:label,kind:"subtitles",enabled:!1,language:properties.language,label:label},!1).track;this.subtitleGroups_.tracks[label]=track}}}}},{key:"fillClosedCaptionTracks_",value:function(){var mediaGroups=this.master().mediaGroups||{};for(var mediaGroup in mediaGroups["CLOSED-CAPTIONS"]){this.closedCaptionGroups_.groups[mediaGroup]||(this.closedCaptionGroups_.groups[mediaGroup]=[]);for(var label in mediaGroups["CLOSED-CAPTIONS"][mediaGroup]){var properties=mediaGroups["CLOSED-CAPTIONS"][mediaGroup][label];if(properties.instreamId.match(/CC\d/)&&(this.closedCaptionGroups_.groups[mediaGroup].push(_videoJs2.default.mergeOptions({id:label},properties)),void 0===this.closedCaptionGroups_.tracks[label])){var track=this.tech_.addRemoteTextTrack({id:properties.instreamId,kind:"captions",enabled:!1,language:properties.language,label:label},!1).track;this.closedCaptionGroups_.tracks[label]=track}}}}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.audioPlaylistLoader_&&this.audioSegmentLoader_.load(),this.subtitlePlaylistLoader_&&this.subtitleSegmentLoader_.load()}},{key:"activeAudioGroup",value:function(){var videoPlaylist=this.masterPlaylistLoader_.media(),result=void 0;return videoPlaylist.attributes.AUDIO&&(result=this.audioGroups_[videoPlaylist.attributes.AUDIO]),result||this.audioGroups_.main}},{key:"activeSubtitleGroup_",value:function(){var videoPlaylist=this.masterPlaylistLoader_.media(),result=void 0;return videoPlaylist?(videoPlaylist.attributes.SUBTITLES&&(result=this.subtitleGroups_.groups[videoPlaylist.attributes.SUBTITLES]),result||this.subtitleGroups_.groups.main):null}},{key:"activeSubtitleTrack_",value:function(){for(var trackName in this.subtitleGroups_.tracks)if("showing"===this.subtitleGroups_.tracks[trackName].mode)return this.subtitleGroups_.tracks[trackName];return null}},{key:"handleSubtitleError_",value:function(){_videoJs2.default.log.warn("Problem encountered loading the subtitle track. Switching back to default."),this.subtitleSegmentLoader_.abort();var track=this.activeSubtitleTrack_();track&&(track.mode="disabled"),this.setupSubtitles()}},{key:"mediaGroupChanged",value:function(){var track=this.getActiveAudioTrack_();this.stopAudioLoaders_(),this.resyncAudioLoaders_(track)}},{key:"setupAudio",value:function(){var track=this.getActiveAudioTrack_();this.stopAudioLoaders_(),this.resetAudioLoaders_(track)}},{key:"getActiveAudioTrack_",value:function(){var audioGroup=this.activeAudioGroup(),track=audioGroup.filter(function(audioTrack){return audioTrack.enabled})[0];return track||((track=audioGroup.filter(function(audioTrack){return audioTrack.properties_.default})[0]||audioGroup[0]).enabled=!0),track}},{key:"stopAudioLoaders_",value:function(){this.audioPlaylistLoader_&&(this.audioPlaylistLoader_.dispose(),this.audioPlaylistLoader_=null),this.audioSegmentLoader_.pause()}},{key:"resetAudioLoaders_",value:function(track){track.properties_.resolvedUri?(this.audioSegmentLoader_.resetEverything(),this.setupAudioPlaylistLoader_(track)):this.mainSegmentLoader_.resetEverything()}},{key:"resyncAudioLoaders_",value:function(track){track.properties_.resolvedUri&&(this.audioSegmentLoader_.resyncLoader(),this.setupAudioPlaylistLoader_(track))}},{key:"setupAudioPlaylistLoader_",value:function(track){var _this4=this;this.audioPlaylistLoader_=new _playlistLoader2.default(track.properties_.resolvedUri,this.hls_,this.withCredentials),this.audioPlaylistLoader_.load(),this.audioPlaylistLoader_.on("loadedmetadata",function(){var audioPlaylist=_this4.audioPlaylistLoader_.media();_this4.audioSegmentLoader_.playlist(audioPlaylist,_this4.requestOptions_),(!_this4.tech_.paused()||audioPlaylist.endList&&"none"!==_this4.tech_.preload())&&_this4.audioSegmentLoader_.load(),audioPlaylist.endList||_this4.audioPlaylistLoader_.trigger("firstplay")}),this.audioPlaylistLoader_.on("loadedplaylist",function(){var updatedPlaylist=void 0;_this4.audioPlaylistLoader_&&(updatedPlaylist=_this4.audioPlaylistLoader_.media()),updatedPlaylist?_this4.audioSegmentLoader_.playlist(updatedPlaylist,_this4.requestOptions_):_this4.audioPlaylistLoader_.media(_this4.audioPlaylistLoader_.playlists.master.playlists[0])}),this.audioPlaylistLoader_.on("error",function(){_videoJs2.default.log.warn("Problem encountered loading the alternate audio track. Switching back to default."),_this4.audioSegmentLoader_.abort(),_this4.setupAudio()})}},{key:"setupSubtitles",value:function(){var _this5=this,subtitleGroup=this.activeSubtitleGroup_(),track=this.activeSubtitleTrack_();if(this.subtitleSegmentLoader_.pause(),track){var properties=subtitleGroup.filter(function(subtitleProperties){return subtitleProperties.id===track.id})[0];this.subtitlePlaylistLoader_&&this.subtitlePlaylistLoader_.media()&&this.subtitlePlaylistLoader_.media().resolvedUri===properties.resolvedUri||(this.subtitlePlaylistLoader_&&this.subtitlePlaylistLoader_.dispose(),this.subtitleSegmentLoader_.resetEverything(),this.subtitlePlaylistLoader_=new _playlistLoader2.default(properties.resolvedUri,this.hls_,this.withCredentials),this.subtitlePlaylistLoader_.on("loadedmetadata",function(){var subtitlePlaylist=_this5.subtitlePlaylistLoader_.media();_this5.subtitleSegmentLoader_.playlist(subtitlePlaylist,_this5.requestOptions_),_this5.subtitleSegmentLoader_.track(_this5.activeSubtitleTrack_()),(!_this5.tech_.paused()||subtitlePlaylist.endList&&"none"!==_this5.tech_.preload())&&_this5.subtitleSegmentLoader_.load()}),this.subtitlePlaylistLoader_.on("loadedplaylist",function(){var updatedPlaylist=void 0;_this5.subtitlePlaylistLoader_&&(updatedPlaylist=_this5.subtitlePlaylistLoader_.media()),updatedPlaylist&&_this5.subtitleSegmentLoader_.playlist(updatedPlaylist,_this5.requestOptions_)}),this.subtitlePlaylistLoader_.on("error",this.handleSubtitleError_.bind(this))),this.subtitlePlaylistLoader_.media()&&this.subtitlePlaylistLoader_.media().resolvedUri===properties.resolvedUri?this.subtitleSegmentLoader_.load():this.subtitlePlaylistLoader_.load()}else this.subtitlePlaylistLoader_&&(this.subtitlePlaylistLoader_.dispose(),this.subtitlePlaylistLoader_=null)}},{key:"fastQualityChange_",value:function(){var media=this.selectPlaylist();media!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(media),this.mainSegmentLoader_.resetLoader())}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_()&&this.load();var seekable=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<seekable.start(0)?this.tech_.setCurrentTime(seekable.end(seekable.length-1)):void 0}}},{key:"setupFirstPlay",value:function(){var seekable=void 0,media=this.masterPlaylistLoader_.media();return!(!media||this.tech_.paused()||this.hasPlayed_())&&(media.endList||(this.trigger("firstplay"),(seekable=this.seekable()).length&&this.tech_.setCurrentTime(seekable.end(0))),this.hasPlayed_=function(){return!0},this.load(),!0)}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(e){return _videoJs2.default.log.warn("Failed to create Source Buffers",e),this.mediaSource.endOfStream("decode")}this.tech_.autoplay()&&this.tech_.play(),this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var isEndOfStream=this.mainSegmentLoader_.ended_;this.audioPlaylistLoader_&&(isEndOfStream=isEndOfStream&&this.audioSegmentLoader_.ended_),isEndOfStream&&this.mediaSource.endOfStream()}},{key:"stuckAtPlaylistEnd_",value:function(playlist){if(!this.seekable().length)return!1;var expired=this.syncController_.getExpiredTime(playlist,this.mediaSource.duration);if(null===expired)return!1;var absolutePlaylistEnd=Hls.Playlist.playlistEnd(playlist,expired),currentTime=this.tech_.currentTime(),buffered=this.tech_.buffered();if(!buffered.length)return absolutePlaylistEnd-currentTime<=_ranges2.default.TIME_FUDGE_FACTOR;var bufferedEnd=buffered.end(buffered.length-1);return bufferedEnd-currentTime<=_ranges2.default.TIME_FUDGE_FACTOR&&absolutePlaylistEnd-bufferedEnd<=_ranges2.default.TIME_FUDGE_FACTOR}},{key:"blacklistCurrentPlaylist",value:function(error,blacklistDuration){void 0===error&&(error={});var currentPlaylist=void 0,nextPlaylist=void 0;if(!(currentPlaylist=error.playlist||this.masterPlaylistLoader_.media())){this.error=error;try{return this.mediaSource.endOfStream("network")}catch(e){return this.trigger("error")}}var isFinalRendition=this.masterPlaylistLoader_.isFinalRendition_();return isFinalRendition?(_videoJs2.default.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the final playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(isFinalRendition)):(currentPlaylist.excludeUntil=Date.now()+1e3*(blacklistDuration||this.blacklistDuration),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),nextPlaylist=this.selectPlaylist(),_videoJs2.default.log.warn("Problem encountered with the current HLS playlist."+(error.message?" "+error.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(nextPlaylist))}},{key:"pauseLoading",value:function(){this.mainSegmentLoader_.pause(),this.audioPlaylistLoader_&&this.audioSegmentLoader_.pause(),this.subtitlePlaylistLoader_&&this.subtitleSegmentLoader_.pause()}},{key:"setCurrentTime",value:function(currentTime){var buffered=_ranges2.default.findRange(this.tech_.buffered(),currentTime);if(!this.masterPlaylistLoader_||!this.masterPlaylistLoader_.media())return 0;if(!this.masterPlaylistLoader_.media().segments)return 0;var isFlash="flash"===this.mode_||"auto"===this.mode_&&!_videoJs2.default.MediaSource.supportsNativeMediaSources();if(buffered&&buffered.length&&!isFlash)return currentTime;this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.audioPlaylistLoader_&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.subtitlePlaylistLoader_&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),this.load()}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:Hls.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var mainSeekable=void 0,audioSeekable=void 0;if(this.masterPlaylistLoader_){var media=this.masterPlaylistLoader_.media();if(media){var expired=this.syncController_.getExpiredTime(media,this.mediaSource.duration);if(null!==expired&&0!==(mainSeekable=Hls.Playlist.seekable(media,expired)).length){if(this.audioPlaylistLoader_){if(media=this.audioPlaylistLoader_.media(),null===(expired=this.syncController_.getExpiredTime(media,this.mediaSource.duration)))return;if(0===(audioSeekable=Hls.Playlist.seekable(media,expired)).length)return}audioSeekable?audioSeekable.start(0)>mainSeekable.end(0)||mainSeekable.start(0)>audioSeekable.end(0)?this.seekable_=mainSeekable:this.seekable_=_videoJs2.default.createTimeRanges([[audioSeekable.start(0)>mainSeekable.start(0)?audioSeekable.start(0):mainSeekable.start(0),audioSeekable.end(0)<mainSeekable.end(0)?audioSeekable.end(0):mainSeekable.end(0)]]):this.seekable_=mainSeekable,this.tech_.trigger("seekablechanged")}}}}},{key:"updateDuration",value:function(){var _this6=this,oldDuration=this.mediaSource.duration,newDuration=Hls.Playlist.duration(this.masterPlaylistLoader_.media()),buffered=this.tech_.buffered(),setDuration=function setDuration(){_this6.mediaSource.duration=newDuration,_this6.tech_.trigger("durationchange"),_this6.mediaSource.removeEventListener("sourceopen",setDuration)};buffered.length>0&&(newDuration=Math.max(newDuration,buffered.end(buffered.length-1))),oldDuration!==newDuration&&("open"!==this.mediaSource.readyState?this.mediaSource.addEventListener("sourceopen",setDuration):setDuration())}},{key:"dispose",value:function(){this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.audioPlaylistLoader_&&this.audioPlaylistLoader_.dispose(),this.subtitlePlaylistLoader_&&this.subtitlePlaylistLoader_.dispose(),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var media=this.masterPlaylistLoader_.media(),mimeTypes=void 0;if(media&&"open"===this.mediaSource.readyState){if((mimeTypes=mimeTypesForPlaylist_(this.masterPlaylistLoader_.master,media)).length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+media.resolvedUri,this.mediaSource.endOfStream("decode");this.mainSegmentLoader_.mimeType(mimeTypes[0]),mimeTypes[1]&&this.audioSegmentLoader_.mimeType(mimeTypes[1]),this.excludeIncompatibleVariants_(media)}}},{key:"excludeIncompatibleVariants_",value:function(media){var master=this.masterPlaylistLoader_.master,codecCount=2,videoCodec=null,codecs=void 0;media.attributes.CODECS&&(codecs=(0,_utilCodecsJs.parseCodecs)(media.attributes.CODECS),videoCodec=codecs.videoCodec,codecCount=codecs.codecCount),master.playlists.forEach(function(variant){var variantCodecs={codecCount:2,videoCodec:null};if(variant.attributes.CODECS){var codecString=variant.attributes.CODECS;variantCodecs=(0,_utilCodecsJs.parseCodecs)(codecString),window.MediaSource&&window.MediaSource.isTypeSupported&&!window.MediaSource.isTypeSupported('video/mp4; codecs="'+mapLegacyAvcCodecs_(codecString)+'"')&&(variant.excludeUntil=1/0)}variantCodecs.codecCount!==codecCount&&(variant.excludeUntil=1/0),variantCodecs.videoCodec!==videoCodec&&(variant.excludeUntil=1/0)})}},{key:"updateAdCues_",value:function(media){var offset=0,seekable=this.seekable();seekable.length&&(offset=seekable.start(0)),_adCueTags2.default.updateAdCues(media,this.cueTagsTrack_,offset)}},{key:"goalBufferLength",value:function(){var currentTime=this.tech_.currentTime(),initial=_config2.default.GOAL_BUFFER_LENGTH,rate=_config2.default.GOAL_BUFFER_LENGTH_RATE,max=Math.max(initial,_config2.default.MAX_GOAL_BUFFER_LENGTH);return Math.min(initial+currentTime*rate,max)}},{key:"bufferLowWaterLine",value:function(){var currentTime=this.tech_.currentTime(),initial=_config2.default.BUFFER_LOW_WATER_LINE,rate=_config2.default.BUFFER_LOW_WATER_LINE_RATE,max=Math.max(initial,_config2.default.MAX_BUFFER_LOW_WATER_LINE);return Math.min(initial+currentTime*rate,max)}}]),MasterPlaylistController}();exports.MasterPlaylistController=MasterPlaylistController}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ad-cue-tags":1,"./config":3,"./decrypter-worker":4,"./playlist-loader":8,"./ranges":11,"./segment-loader":15,"./sync-controller":17,"./util/codecs.js":18,"./vtt-segment-loader":19,"videojs-contrib-media-sources/es5/codec-utils":65,webworkify:76}],6:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _videoJs2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),_binUtils=require("./bin-utils"),REQUEST_ERRORS={FAILURE:2,TIMEOUT:-101,ABORTED:-102};exports.REQUEST_ERRORS=REQUEST_ERRORS;var byterangeStr=function(byterange){var byterangeEnd=void 0;return byterangeEnd=byterange.offset+byterange.length-1,"bytes="+byterange.offset+"-"+byterangeEnd},segmentXhrHeaders=function(segment){var headers={};return segment.byterange&&(headers.Range=byterangeStr(segment.byterange)),headers},abortAll=function(activeXhrs){activeXhrs.forEach(function(xhr){xhr.abort()})},getRequestStats=function(request){return{bandwidth:request.bandwidth,bytesReceived:request.bytesReceived||0,roundTripTime:request.roundTripTime||0}},getProgressStats=function(progressEvent){var request=progressEvent.target,stats={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-request.requestTime||0};return stats.bytesReceived=progressEvent.loaded,stats.bandwidth=Math.floor(stats.bytesReceived/stats.roundTripTime*8*1e3),stats},handleErrors=function(error,request){return request.timedout?{status:request.status,message:"HLS request timed-out at URL: "+request.uri,code:REQUEST_ERRORS.TIMEOUT,xhr:request}:request.aborted?{status:request.status,message:"HLS request aborted at URL: "+request.uri,code:REQUEST_ERRORS.ABORTED,xhr:request}:error?{status:request.status,message:"HLS request errored at URL: "+request.uri,code:REQUEST_ERRORS.FAILURE,xhr:request}:null},handleKeyResponse=function(segment,finishProcessingFn){return function(error,request){var response=request.response,errorObj=handleErrors(error,request);if(errorObj)return finishProcessingFn(errorObj,segment);if(16!==response.byteLength)return finishProcessingFn({status:request.status,message:"Invalid HLS key at URL: "+request.uri,code:REQUEST_ERRORS.FAILURE,xhr:request},segment);var view=new DataView(response);return segment.key.bytes=new Uint32Array([view.getUint32(0),view.getUint32(4),view.getUint32(8),view.getUint32(12)]),finishProcessingFn(null,segment)}},handleInitSegmentResponse=function(segment,finishProcessingFn){return function(error,request){var response=request.response,errorObj=handleErrors(error,request);return errorObj?finishProcessingFn(errorObj,segment):0===response.byteLength?finishProcessingFn({status:request.status,message:"Empty HLS segment content at URL: "+request.uri,code:REQUEST_ERRORS.FAILURE,xhr:request},segment):(segment.map.bytes=new Uint8Array(request.response),finishProcessingFn(null,segment))}},handleSegmentResponse=function(segment,finishProcessingFn){return function(error,request){var response=request.response,errorObj=handleErrors(error,request);return errorObj?finishProcessingFn(errorObj,segment):0===response.byteLength?finishProcessingFn({status:request.status,message:"Empty HLS segment content at URL: "+request.uri,code:REQUEST_ERRORS.FAILURE,xhr:request},segment):(segment.stats=getRequestStats(request),segment.key?segment.encryptedBytes=new Uint8Array(request.response):segment.bytes=new Uint8Array(request.response),finishProcessingFn(null,segment))}},decryptSegment=function(decrypter,segment,doneFn){decrypter.addEventListener("message",function decryptionHandler(event){if(event.data.source===segment.requestId){decrypter.removeEventListener("message",decryptionHandler);var decrypted=event.data.decrypted;return segment.bytes=new Uint8Array(decrypted.bytes,decrypted.byteOffset,decrypted.byteLength),doneFn(null,segment)}}),decrypter.postMessage((0,_binUtils.createTransferableMessage)({source:segment.requestId,encrypted:segment.encryptedBytes,key:segment.key.bytes,iv:segment.key.iv}),[segment.encryptedBytes.buffer,segment.key.bytes.buffer])},getMostImportantError=function(errors){return errors.reduce(function(prev,err){return err.code>prev.code?err:prev})},waitForCompletion=function(activeXhrs,decrypter,doneFn){var errors=[],count=0;return function(error,segment){if(error&&(abortAll(activeXhrs),errors.push(error)),(count+=1)===activeXhrs.length){if(segment.endOfAllRequests=Date.now(),errors.length>0){var worstError=getMostImportantError(errors);return doneFn(worstError,segment)}return segment.encryptedBytes?decryptSegment(decrypter,segment,doneFn):doneFn(null,segment)}}},handleProgress=function(segment,progressFn){return function(event){return segment.stats=_videoJs2.default.mergeOptions(segment.stats,getProgressStats(event)),!segment.stats.firstBytesReceivedAt&&segment.stats.bytesReceived&&(segment.stats.firstBytesReceivedAt=Date.now()),progressFn(event,segment)}};exports.mediaSegmentRequest=function(xhr,xhrOptions,decryptionWorker,segment,progressFn,doneFn){var activeXhrs=[],finishProcessingFn=waitForCompletion(activeXhrs,decryptionWorker,doneFn);if(segment.key){var keyXhr=xhr(_videoJs2.default.mergeOptions(xhrOptions,{uri:segment.key.resolvedUri,responseType:"arraybuffer"}),handleKeyResponse(segment,finishProcessingFn));activeXhrs.push(keyXhr)}if(segment.map&&!segment.map.bytes){var initSegmentXhr=xhr(_videoJs2.default.mergeOptions(xhrOptions,{uri:segment.map.resolvedUri,responseType:"arraybuffer",headers:segmentXhrHeaders(segment.map)}),handleInitSegmentResponse(segment,finishProcessingFn));activeXhrs.push(initSegmentXhr)}var segmentXhr=xhr(_videoJs2.default.mergeOptions(xhrOptions,{uri:segment.resolvedUri,responseType:"arraybuffer",headers:segmentXhrHeaders(segment)}),handleSegmentResponse(segment,finishProcessingFn));return segmentXhr.addEventListener("progress",handleProgress(segment,progressFn)),activeXhrs.push(segmentXhr),function(){return abortAll(activeXhrs)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./bin-utils":2}],7:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_globalWindow2=_interopRequireDefault(require("global/window")),_ranges2=_interopRequireDefault(require("./ranges")),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),timerCancelEvents=["seeking","seeked","pause","playing","error"],PlaybackWatcher=function(){function PlaybackWatcher(options){var _this=this;_classCallCheck(this,PlaybackWatcher),this.tech_=options.tech,this.seekable=options.seekable,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,options.debug&&(this.logger_=_videoJs2.default.log.bind(_videoJs2.default,"playback-watcher ->")),this.logger_("initialize");var canPlayHandler=function(){return _this.monitorCurrentTime_()},waitingHandler=function(){return _this.techWaiting_()},cancelTimerHandler=function(){return _this.cancelTimer_()},fixesBadSeeksHandler=function(){return _this.fixesBadSeeks_()};this.tech_.on("seekablechanged",fixesBadSeeksHandler),this.tech_.on("waiting",waitingHandler),this.tech_.on(timerCancelEvents,cancelTimerHandler),this.tech_.on("canplay",canPlayHandler),this.dispose=function(){_this.logger_("dispose"),_this.tech_.off("seekablechanged",fixesBadSeeksHandler),_this.tech_.off("waiting",waitingHandler),_this.tech_.off(timerCancelEvents,cancelTimerHandler),_this.tech_.off("canplay",canPlayHandler),_this.checkCurrentTimeTimeout_&&_globalWindow2.default.clearTimeout(_this.checkCurrentTimeTimeout_),_this.cancelTimer_()}}return _createClass(PlaybackWatcher,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&_globalWindow2.default.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=_globalWindow2.default.setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"checkCurrentTime_",value:function(){if(this.tech_.seeking()&&this.fixesBadSeeks_())return this.consecutiveUpdates=0,void(this.lastRecordedTime=this.tech_.currentTime());if(!this.tech_.paused()&&!this.tech_.seeking()){var currentTime=this.tech_.currentTime(),buffered=this.tech_.buffered();if(this.lastRecordedTime===currentTime&&(!buffered.length||currentTime+.1>=buffered.end(buffered.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&currentTime===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):currentTime===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=currentTime)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var seekable=this.seekable(),currentTime=this.tech_.currentTime();if(this.tech_.seeking()&&this.outsideOfSeekableWindow_(seekable,currentTime)){var seekableEnd=seekable.end(seekable.length-1);return this.logger_("Trying to seek outside of seekable at time "+currentTime+" with seekable range "+_ranges2.default.printableRange(seekable)+". Seeking to "+seekableEnd+"."),this.tech_.setCurrentTime(seekableEnd),!0}return!1}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var currentTime=this.tech_.currentTime(),buffered=this.tech_.buffered(),currentRange=_ranges2.default.findRange(buffered,currentTime);return currentRange.length&&currentTime+3<=currentRange.end(0)?(this.cancelTimer_(),this.tech_.setCurrentTime(currentTime),this.logger_("Stopped at "+currentTime+" while inside a buffered region ["+currentRange.start(0)+" -> "+currentRange.end(0)+"]. Attempting to resume playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var seekable=this.seekable(),currentTime=this.tech_.currentTime();if(this.tech_.seeking()&&this.fixesBadSeeks_())return!0;if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.fellOutOfLiveWindow_(seekable,currentTime)){var livePoint=seekable.end(seekable.length-1);return this.logger_("Fell out of live window at time "+currentTime+". Seeking to live point (seekable end) "+livePoint),this.cancelTimer_(),this.tech_.setCurrentTime(livePoint),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var buffered=this.tech_.buffered(),nextRange=_ranges2.default.findNextRange(buffered,currentTime);if(this.videoUnderflow_(nextRange,buffered,currentTime))return this.cancelTimer_(),this.tech_.setCurrentTime(currentTime),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;if(nextRange.length>0){var difference=nextRange.start(0)-currentTime;return this.logger_("Stopped at "+currentTime+", setting timer for "+difference+", seeking to "+nextRange.start(0)),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*difference,currentTime),!0}return!1}},{key:"outsideOfSeekableWindow_",value:function(seekable,currentTime){return!!seekable.length&&(currentTime<seekable.start(0)-.1||currentTime>seekable.end(seekable.length-1)+.1)}},{key:"fellOutOfLiveWindow_",value:function(seekable,currentTime){return!!(seekable.length&&seekable.start(0)>0&&currentTime<seekable.start(0))}},{key:"videoUnderflow_",value:function(nextRange,buffered,currentTime){if(0===nextRange.length){var gap=this.gapFromVideoUnderflow_(buffered,currentTime);if(gap)return this.logger_("Encountered a gap in video from "+gap.start+" to "+gap.end+". Seeking to current time "+currentTime),!0}return!1}},{key:"skipTheGap_",value:function(scheduledCurrentTime){var buffered=this.tech_.buffered(),currentTime=this.tech_.currentTime(),nextRange=_ranges2.default.findNextRange(buffered,currentTime);this.cancelTimer_(),0!==nextRange.length&&currentTime===scheduledCurrentTime&&(this.logger_("skipTheGap_:","currentTime:",currentTime,"scheduled currentTime:",scheduledCurrentTime,"nextRange start:",nextRange.start(0)),this.tech_.setCurrentTime(nextRange.start(0)+_ranges2.default.TIME_FUDGE_FACTOR),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(buffered,currentTime){for(var gaps=_ranges2.default.findGaps(buffered),i=0;i<gaps.length;i++){var start=gaps.start(i),end=gaps.end(i);if(currentTime-start<4&&currentTime-start>2)return{start:start,end:end}}return null}},{key:"logger_",value:function(){}}]),PlaybackWatcher}();exports.default=PlaybackWatcher,module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ranges":11,"global/window":31}],8:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _resolveUrl2=_interopRequireDefault(require("./resolve-url")),_videoJs="undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null,_playlistJs=require("./playlist.js"),_m3u8Parser2=_interopRequireDefault(require("m3u8-parser")),_globalWindow2=_interopRequireDefault(require("global/window")),updateSegments=function(original,update,offset){var result=update.slice(),length=void 0,i=void 0;for(offset=offset||0,length=Math.min(original.length,update.length+offset),i=offset;i<length;i++)result[i-offset]=(0,_videoJs.mergeOptions)(original[i],result[i-offset]);return result},updateMaster=function(master,media){for(var changed=!1,result=(0,_videoJs.mergeOptions)(master,{}),i=master.playlists.length,playlist=void 0,segment=void 0,j=void 0;i--;)if((playlist=result.playlists[i]).uri===media.uri){if(playlist.segments&&media.segments&&playlist.segments.length===media.segments.length&&playlist.mediaSequence===media.mediaSequence)continue;for(result.playlists[i]=(0,_videoJs.mergeOptions)(playlist,media),result.playlists[media.uri]=result.playlists[i],playlist.segments&&(result.playlists[i].segments=updateSegments(playlist.segments,media.segments,media.mediaSequence-playlist.mediaSequence)),j=0,result.playlists[i].segments&&(j=result.playlists[i].segments.length);j--;)(segment=result.playlists[i].segments[j]).resolvedUri||(segment.resolvedUri=(0,_resolveUrl2.default)(playlist.resolvedUri,segment.uri)),segment.key&&!segment.key.resolvedUri&&(segment.key.resolvedUri=(0,_resolveUrl2.default)(playlist.resolvedUri,segment.key.uri)),segment.map&&!segment.map.resolvedUri&&(segment.map.resolvedUri=(0,_resolveUrl2.default)(playlist.resolvedUri,segment.map.uri));changed=!0}return changed?result:null},PlaylistLoader=function PlaylistLoader(srcUrl,hls,withCredentials){var _this=this,loader=this,mediaUpdateTimeout=void 0,request=void 0,playlistRequestError=void 0,haveMetadata=void 0;if(PlaylistLoader.prototype.constructor.call(this),this.hls_=hls,!srcUrl)throw new Error("A non-empty playlist URL is required");playlistRequestError=function(xhr,url,startingState){loader.setBandwidth(request||xhr),request=null,startingState&&(loader.state=startingState),loader.error={playlist:loader.master.playlists[url],status:xhr.status,message:"HLS playlist request error at URL: "+url,responseText:xhr.responseText,code:xhr.status>=500?4:2},loader.trigger("error")},haveMetadata=function(xhr,url){var parser=void 0,refreshDelay=void 0,update=void 0;loader.setBandwidth(request||xhr),request=null,loader.state="HAVE_METADATA",(parser=new _m3u8Parser2.default.Parser).push(xhr.responseText),parser.end(),parser.manifest.uri=url,parser.manifest.attributes=parser.manifest.attributes||{},update=updateMaster(loader.master,parser.manifest),refreshDelay=1e3*(parser.manifest.targetDuration||10),loader.targetDuration=parser.manifest.targetDuration,update?(loader.master=update,loader.media_=loader.master.playlists[parser.manifest.uri]):(refreshDelay/=2,loader.trigger("playlistunchanged")),loader.media().endList||(_globalWindow2.default.clearTimeout(mediaUpdateTimeout),mediaUpdateTimeout=_globalWindow2.default.setTimeout(function(){loader.trigger("mediaupdatetimeout")},refreshDelay)),loader.trigger("loadedplaylist")},loader.state="HAVE_NOTHING",loader.dispose=function(){loader.stopRequest(),_globalWindow2.default.clearTimeout(mediaUpdateTimeout),loader.off()},loader.stopRequest=function(){if(request){var oldRequest=request;request=null,oldRequest.onreadystatechange=null,oldRequest.abort()}},loader.enabledPlaylists_=function(){return loader.master.playlists.filter(_playlistJs.isEnabled).length},loader.isLowestEnabledRendition_=function(){if(1===loader.master.playlists.length)return!0;var currentBandwidth=loader.media().attributes.BANDWIDTH||Number.MAX_VALUE;return 0===loader.master.playlists.filter(function(playlist){return!!(0,_playlistJs.isEnabled)(playlist)&&(playlist.attributes.BANDWIDTH||0)<currentBandwidth}).length},loader.isFinalRendition_=function(){return 1===loader.master.playlists.filter(_playlistJs.isEnabled).length},loader.media=function(playlist){var startingState=loader.state,mediaChange=void 0;if(!playlist)return loader.media_;if("HAVE_NOTHING"===loader.state)throw new Error("Cannot switch media playlist from "+loader.state);if("string"==typeof playlist){if(!loader.master.playlists[playlist])throw new Error("Unknown playlist URI: "+playlist);playlist=loader.master.playlists[playlist]}if(mediaChange=!loader.media_||playlist.uri!==loader.media_.uri,loader.master.playlists[playlist.uri].endList)return request&&(request.onreadystatechange=null,request.abort(),request=null),loader.state="HAVE_METADATA",loader.media_=playlist,void(mediaChange&&(loader.trigger("mediachanging"),loader.trigger("mediachange")));if(mediaChange){if(loader.state="SWITCHING_MEDIA",request){if((0,_resolveUrl2.default)(loader.master.uri,playlist.uri)===request.url)return;request.onreadystatechange=null,request.abort(),request=null}this.media_&&this.trigger("mediachanging"),request=this.hls_.xhr({uri:(0,_resolveUrl2.default)(loader.master.uri,playlist.uri),withCredentials:withCredentials},function(error,req){if(request){if(error)return playlistRequestError(request,playlist.uri,startingState);haveMetadata(req,playlist.uri),"HAVE_MASTER"===startingState?loader.trigger("loadedmetadata"):loader.trigger("mediachange")}})}},loader.setBandwidth=function(xhr){loader.bandwidth=xhr.bandwidth},loader.on("mediaupdatetimeout",function(){"HAVE_METADATA"===loader.state&&(loader.state="HAVE_CURRENT_METADATA",request=this.hls_.xhr({uri:(0,_resolveUrl2.default)(loader.master.uri,loader.media().uri),withCredentials:withCredentials},function(error,req){if(request)return error?playlistRequestError(request,loader.media().uri,"HAVE_METADATA"):void haveMetadata(request,loader.media().uri)}))}),loader.on("firstplay",function(){var playlist=loader.media();playlist&&(playlist.syncInfo={mediaSequence:playlist.mediaSequence,time:0})}),loader.pause=function(){loader.stopRequest(),_globalWindow2.default.clearTimeout(mediaUpdateTimeout),"HAVE_NOTHING"===loader.state&&(loader.started=!1)},loader.load=function(isFinalRendition){var media=loader.media();if(_globalWindow2.default.clearTimeout(mediaUpdateTimeout),isFinalRendition){var refreshDelay=media?media.targetDuration/2*1e3:5e3;mediaUpdateTimeout=_globalWindow2.default.setTimeout(loader.load.bind(null,!1),refreshDelay)}else loader.started?media&&!media.endList?loader.trigger("mediaupdatetimeout"):loader.trigger("loadedplaylist"):loader.start()},loader.start=function(){loader.started=!0,request=_this.hls_.xhr({uri:srcUrl,withCredentials:withCredentials},function(error,req){var parser=void 0,playlist=void 0,i=void 0;if(request){if(request=null,error)return loader.error={status:req.status,message:"HLS playlist request error at URL: "+srcUrl,responseText:req.responseText,code:2},"HAVE_NOTHING"===loader.state&&(loader.started=!1),loader.trigger("error");if((parser=new _m3u8Parser2.default.Parser).push(req.responseText),parser.end(),loader.state="HAVE_MASTER",parser.manifest.uri=srcUrl,parser.manifest.playlists){for(loader.master=parser.manifest,i=loader.master.playlists.length;i--;)playlist=loader.master.playlists[i],loader.master.playlists[playlist.uri]=playlist,playlist.resolvedUri=(0,_resolveUrl2.default)(loader.master.uri,playlist.uri),playlist.attributes||(playlist.attributes={},_videoJs.log.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."));return["AUDIO","SUBTITLES"].forEach(function(mediaType){for(var groupKey in loader.master.mediaGroups[mediaType])for(var labelKey in loader.master.mediaGroups[mediaType][groupKey]){var mediaProperties=loader.master.mediaGroups[mediaType][groupKey][labelKey];mediaProperties.uri&&(mediaProperties.resolvedUri=(0,_resolveUrl2.default)(loader.master.uri,mediaProperties.uri))}}),loader.trigger("loadedplaylist"),void(request||loader.media(parser.manifest.playlists[0]))}return loader.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:_globalWindow2.default.location.href,playlists:[{uri:srcUrl}]},loader.master.playlists[srcUrl]=loader.master.playlists[0],loader.master.playlists[0].resolvedUri=srcUrl,loader.master.playlists[0].attributes=loader.master.playlists[0].attributes||{},haveMetadata(req,srcUrl),loader.trigger("loadedmetadata")}})}};PlaylistLoader.prototype=new _videoJs.EventTarget,exports.default=PlaylistLoader,module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./playlist.js":10,"./resolve-url":14,"global/window":31,"m3u8-parser":32}],9:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _config2=_interopRequireDefault(require("./config")),_playlist2=_interopRequireDefault(require("./playlist")),_utilCodecsJs=require("./util/codecs.js"),safeGetComputedStyle=function(el,property){var result=void 0;return el&&(result=window.getComputedStyle(el))?result[property]:""},stableSort=function(array,sortFn){var newArray=array.slice();array.sort(function(left,right){var cmp=sortFn(left,right);return 0===cmp?newArray.indexOf(left)-newArray.indexOf(right):cmp})},comparePlaylistBandwidth=function(left,right){var leftBandwidth=void 0,rightBandwidth=void 0;return left.attributes.BANDWIDTH&&(leftBandwidth=left.attributes.BANDWIDTH),leftBandwidth=leftBandwidth||window.Number.MAX_VALUE,right.attributes.BANDWIDTH&&(rightBandwidth=right.attributes.BANDWIDTH),rightBandwidth=rightBandwidth||window.Number.MAX_VALUE,leftBandwidth-rightBandwidth};exports.comparePlaylistBandwidth=comparePlaylistBandwidth;exports.comparePlaylistResolution=function(left,right){var leftWidth=void 0,rightWidth=void 0;return left.attributes.RESOLUTION&&left.attributes.RESOLUTION.width&&(leftWidth=left.attributes.RESOLUTION.width),leftWidth=leftWidth||window.Number.MAX_VALUE,right.attributes.RESOLUTION&&right.attributes.RESOLUTION.width&&(rightWidth=right.attributes.RESOLUTION.width),rightWidth=rightWidth||window.Number.MAX_VALUE,leftWidth===rightWidth&&left.attributes.BANDWIDTH&&right.attributes.BANDWIDTH?left.attributes.BANDWIDTH-right.attributes.BANDWIDTH:leftWidth-rightWidth};var simpleSelector=function(master,playerBandwidth,playerWidth,playerHeight){var sortedPlaylistReps=master.playlists.map(function(playlist){var width=void 0,height=void 0,bandwidth=void 0;return width=playlist.attributes.RESOLUTION&&playlist.attributes.RESOLUTION.width,height=playlist.attributes.RESOLUTION&&playlist.attributes.RESOLUTION.height,bandwidth=playlist.attributes.BANDWIDTH,bandwidth=bandwidth||window.Number.MAX_VALUE,{bandwidth:bandwidth,width:width,height:height,playlist:playlist}});stableSort(sortedPlaylistReps,function(left,right){return left.bandwidth-right.bandwidth});var bandwidthPlaylistReps=(sortedPlaylistReps=sortedPlaylistReps.filter(function(rep){return _playlist2.default.isEnabled(rep.playlist)})).filter(function(rep){return rep.bandwidth*_config2.default.BANDWIDTH_VARIANCE<playerBandwidth}),highestRemainingBandwidthRep=bandwidthPlaylistReps[bandwidthPlaylistReps.length-1],bandwidthBestRep=bandwidthPlaylistReps.filter(function(rep){return rep.bandwidth===highestRemainingBandwidthRep.bandwidth})[0],haveResolution=bandwidthPlaylistReps.filter(function(rep){return rep.width&&rep.height});stableSort(haveResolution,function(left,right){return left.width-right.width});var resolutionBestRepList=haveResolution.filter(function(rep){return rep.width===playerWidth&&rep.height===playerHeight});highestRemainingBandwidthRep=resolutionBestRepList[resolutionBestRepList.length-1];var resolutionBestRep=resolutionBestRepList.filter(function(rep){return rep.bandwidth===highestRemainingBandwidthRep.bandwidth})[0],resolutionPlusOneList=void 0,resolutionPlusOneSmallest=void 0,resolutionPlusOneRep=void 0;return resolutionBestRep||(resolutionPlusOneSmallest=(resolutionPlusOneList=haveResolution.filter(function(rep){return rep.width>playerWidth||rep.height>playerHeight})).filter(function(rep){return rep.width===resolutionPlusOneList[0].width&&rep.height===resolutionPlusOneList[0].height}),highestRemainingBandwidthRep=resolutionPlusOneSmallest[resolutionPlusOneSmallest.length-1],resolutionPlusOneRep=resolutionPlusOneSmallest.filter(function(rep){return rep.bandwidth===highestRemainingBandwidthRep.bandwidth})[0]),(resolutionPlusOneRep||resolutionBestRep||bandwidthBestRep||sortedPlaylistReps[0]).playlist};exports.simpleSelector=simpleSelector;exports.lastBandwidthSelector=function(){return simpleSelector(this.playlists.master,this.systemBandwidth,parseInt(safeGetComputedStyle(this.tech_.el(),"width"),10),parseInt(safeGetComputedStyle(this.tech_.el(),"height"),10))};exports.movingAverageBandwidthSelector=function(decay){var average=-1;if(decay<0||decay>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){return average<0&&(average=this.systemBandwidth),average=decay*this.systemBandwidth+(1-decay)*average,simpleSelector(this.playlists.master,average,parseInt(safeGetComputedStyle(this.tech_.el(),"width"),10),parseInt(safeGetComputedStyle(this.tech_.el(),"height"),10))}};exports.minRebufferMaxBandwidthSelector=function(settings){var master=settings.master,currentTime=settings.currentTime,bandwidth=settings.bandwidth,duration=settings.duration,segmentDuration=settings.segmentDuration,timeUntilRebuffer=settings.timeUntilRebuffer,currentTimeline=settings.currentTimeline,syncController=settings.syncController,rebufferingEstimates=master.playlists.filter(function(playlist){return _playlist2.default.isEnabled(playlist)&&_playlist2.default.hasAttribute("BANDWIDTH",playlist)}).map(function(playlist){var numRequests=syncController.getSyncPoint(playlist,duration,currentTimeline,currentTime)?1:2;return{playlist:playlist,rebufferingImpact:_playlist2.default.estimateSegmentRequestTime(segmentDuration,bandwidth,playlist)*numRequests-timeUntilRebuffer}}),noRebufferingPlaylists=rebufferingEstimates.filter(function(estimate){return estimate.rebufferingImpact<=0});return stableSort(noRebufferingPlaylists,function(a,b){return comparePlaylistBandwidth(b.playlist,a.playlist)}),noRebufferingPlaylists.length?noRebufferingPlaylists[0]:(stableSort(rebufferingEstimates,function(a,b){return a.rebufferingImpact-b.rebufferingImpact}),rebufferingEstimates[0]||null)};exports.lowestBitrateCompatibleVariantSelector=function(){var playlists=this.playlists.master.playlists.filter(_playlist2.default.isEnabled);return stableSort(playlists,function(a,b){return comparePlaylistBandwidth(a,b)}),playlists.filter(function(playlist){return(0,_utilCodecsJs.parseCodecs)(playlist.attributes.CODECS).videoCodec})[0]||null}},{"./config":3,"./playlist":10,"./util/codecs.js":18}],10:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _videoJs="undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null,_globalWindow2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("global/window")),Playlist={UNSAFE_LIVE_SEGMENTS:3},backwardDuration=function(playlist,endSequence){var result=0,i=endSequence-playlist.mediaSequence,segment=playlist.segments[i];if(segment){if(void 0!==segment.start)return{result:segment.start,precise:!0};if(void 0!==segment.end)return{result:segment.end-segment.duration,precise:!0}}for(;i--;){if(void 0!==(segment=playlist.segments[i]).end)return{result:result+segment.end,precise:!0};if(result+=segment.duration,void 0!==segment.start)return{result:result+segment.start,precise:!0}}return{result:result,precise:!1}},forwardDuration=function(playlist,endSequence){for(var result=0,segment=void 0,i=endSequence-playlist.mediaSequence;i<playlist.segments.length;i++){if(void 0!==(segment=playlist.segments[i]).start)return{result:segment.start-result,precise:!0};if(result+=segment.duration,void 0!==segment.end)return{result:segment.end-result,precise:!0}}return{result:-1,precise:!1}},intervalDuration=function(playlist,endSequence,expired){var backward=void 0,forward=void 0;return void 0===endSequence&&(endSequence=playlist.mediaSequence+playlist.segments.length),endSequence<playlist.mediaSequence?0:(backward=backwardDuration(playlist,endSequence)).precise?backward.result:(forward=forwardDuration(playlist,endSequence)).precise?forward.result:backward.result+expired},duration=function(playlist,endSequence,expired){if(!playlist)return 0;if("number"!=typeof expired&&(expired=0),void 0===endSequence){if(playlist.totalDuration)return playlist.totalDuration;if(!playlist.endList)return _globalWindow2.default.Infinity}return intervalDuration(playlist,endSequence,expired)};exports.duration=duration;var sumDurations=function(playlist,startIndex,endIndex){var durations=0;if(startIndex>endIndex){var _ref=[endIndex,startIndex];startIndex=_ref[0],endIndex=_ref[1]}if(startIndex<0){for(i=startIndex;i<Math.min(0,endIndex);i++)durations+=playlist.targetDuration;startIndex=0}for(var i=startIndex;i<endIndex;i++)durations+=playlist.segments[i].duration;return durations};exports.sumDurations=sumDurations;var playlistEnd=function(playlist,expired,useSafeLiveEnd){if(!playlist||!playlist.segments)return null;if(playlist.endList)return duration(playlist);if(null===expired)return null;expired=expired||0;var endSequence=useSafeLiveEnd?Math.max(0,playlist.segments.length-Playlist.UNSAFE_LIVE_SEGMENTS):Math.max(0,playlist.segments.length);return intervalDuration(playlist,playlist.mediaSequence+endSequence,expired)};exports.playlistEnd=playlistEnd;var seekable=function(playlist,expired){var seekableStart=expired||0,seekableEnd=playlistEnd(playlist,expired,!0);return null===seekableEnd?(0,_videoJs.createTimeRange)():(0,_videoJs.createTimeRange)(seekableStart,seekableEnd)};exports.seekable=seekable;var isWholeNumber=function(num){return num-Math.floor(num)==0},roundSignificantDigit=function(increment,num){if(isWholeNumber(num))return num+.1*increment;for(var numDecimalDigits=num.toString().split(".")[1].length,i=1;i<=numDecimalDigits;i++){var scale=Math.pow(10,i),temp=num*scale;if(isWholeNumber(temp)||i===numDecimalDigits)return(temp+increment)/scale}},ceilLeastSignificantDigit=roundSignificantDigit.bind(null,1),floorLeastSignificantDigit=roundSignificantDigit.bind(null,-1),getMediaInfoForTime=function(playlist,currentTime,startIndex,startTime){var i=void 0,segment=void 0,numSegments=playlist.segments.length,time=currentTime-startTime;if(time<0){if(startIndex>0)for(i=startIndex-1;i>=0;i--)if(segment=playlist.segments[i],(time+=floorLeastSignificantDigit(segment.duration))>0)return{mediaIndex:i,startTime:startTime-sumDurations(playlist,startIndex,i)};return{mediaIndex:0,startTime:currentTime}}if(startIndex<0){for(i=startIndex;i<0;i++)if((time-=playlist.targetDuration)<0)return{mediaIndex:0,startTime:currentTime};startIndex=0}for(i=startIndex;i<numSegments;i++)if(segment=playlist.segments[i],(time-=ceilLeastSignificantDigit(segment.duration))<0)return{mediaIndex:i,startTime:startTime+sumDurations(playlist,startIndex,i)};return{mediaIndex:numSegments-1,startTime:currentTime}};exports.getMediaInfoForTime=getMediaInfoForTime;var isBlacklisted=function(playlist){return playlist.excludeUntil&&playlist.excludeUntil>Date.now()};exports.isBlacklisted=isBlacklisted;var isEnabled=function(playlist){var blacklisted=isBlacklisted(playlist);return!playlist.disabled&&!blacklisted};exports.isEnabled=isEnabled;var isAes=function(media){for(var i=0;i<media.segments.length;i++)if(media.segments[i].key)return!0;return!1};exports.isAes=isAes;var isFmp4=function(media){for(var i=0;i<media.segments.length;i++)if(media.segments[i].map)return!0;return!1};exports.isFmp4=isFmp4;var hasAttribute=function(attr,playlist){return playlist.attributes&&playlist.attributes[attr]};exports.hasAttribute=hasAttribute;var estimateSegmentRequestTime=function(segmentDuration,bandwidth,playlist){var bytesReceived=arguments.length<=3||void 0===arguments[3]?0:arguments[3];return hasAttribute("BANDWIDTH",playlist)?(segmentDuration*playlist.attributes.BANDWIDTH-8*bytesReceived)/bandwidth:NaN};exports.estimateSegmentRequestTime=estimateSegmentRequestTime,Playlist.duration=duration,Playlist.seekable=seekable,Playlist.getMediaInfoForTime=getMediaInfoForTime,Playlist.isEnabled=isEnabled,Playlist.isBlacklisted=isBlacklisted,Playlist.playlistEnd=playlistEnd,Playlist.isAes=isAes,Playlist.isFmp4=isFmp4,Playlist.hasAttribute=hasAttribute,Playlist.estimateSegmentRequestTime=estimateSegmentRequestTime,exports.default=Playlist}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"global/window":31}],11:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i.return&&_i.return()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_videoJs2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),clamp=function(num,_ref){var _ref2=_slicedToArray(_ref,2),start=_ref2[0],end=_ref2[1];return Math.min(Math.max(start,num),end)},filterRanges=function(timeRanges,predicate){var results=[],i=void 0;if(timeRanges&&timeRanges.length)for(i=0;i<timeRanges.length;i++)predicate(timeRanges.start(i),timeRanges.end(i))&&results.push([timeRanges.start(i),timeRanges.end(i)]);return _videoJs2.default.createTimeRanges(results)},bufferIntersection=function(bufferA,bufferB){var start=null,end=null,arity=0,extents=[],ranges=[];if(!(bufferA&&bufferA.length&&bufferB&&bufferB.length))return _videoJs2.default.createTimeRange();for(var count=bufferA.length;count--;)extents.push({time:bufferA.start(count),type:"start"}),extents.push({time:bufferA.end(count),type:"end"});for(count=bufferB.length;count--;)extents.push({time:bufferB.start(count),type:"start"}),extents.push({time:bufferB.end(count),type:"end"});for(extents.sort(function(a,b){return a.time-b.time}),count=0;count<extents.length;count++)"start"===extents[count].type?2===++arity&&(start=extents[count].time):"end"===extents[count].type&&1===--arity&&(end=extents[count].time),null!==start&&null!==end&&(ranges.push([start,end]),start=null,end=null);return _videoJs2.default.createTimeRanges(ranges)},calculateBufferedPercent=function(adjustedRange,referenceRange,currentTime,buffered){for(var referenceDuration=referenceRange.end(0)-referenceRange.start(0),bufferMissingFromAdjusted=referenceDuration-(adjustedRange.end(0)-adjustedRange.start(0)),adjustedIntersection=bufferIntersection(adjustedRange,buffered),referenceIntersection=bufferIntersection(referenceRange,buffered),adjustedOverlap=0,referenceOverlap=0,count=adjustedIntersection.length;count--;)adjustedOverlap+=adjustedIntersection.end(count)-adjustedIntersection.start(count),adjustedIntersection.start(count)===currentTime&&(adjustedOverlap+=bufferMissingFromAdjusted);for(count=referenceIntersection.length;count--;)referenceOverlap+=referenceIntersection.end(count)-referenceIntersection.start(count);return Math.max(adjustedOverlap,referenceOverlap)/referenceDuration*100};exports.default={findRange:function(buffered,time){return filterRanges(buffered,function(start,end){return start-1/30<=time&&end+1/30>=time})},findNextRange:function(timeRanges,time){return filterRanges(timeRanges,function(start){return start-1/30>=time})},findGaps:function(buffered){if(buffered.length<2)return _videoJs2.default.createTimeRanges();for(var ranges=[],i=1;i<buffered.length;i++){var start=buffered.end(i-1),end=buffered.start(i);ranges.push([start,end])}return _videoJs2.default.createTimeRanges(ranges)},findSoleUncommonTimeRangesEnd:function(original,update){var i=void 0,start=void 0,end=void 0,result=[],edges=[];if(original)for(i=0;i<original.length;i++)start=original.start(i),end=original.end(i),edges.push([start,end]);if(update)for(i=0;i<update.length;i++)start=update.start(i),end=update.end(i),edges.some(function(span){return span[0]<=end&&span[1]>=end})||result.push(end);return 1!==result.length?null:result[0]},getSegmentBufferedPercent:function(startOfSegment,segmentDuration,currentTime,buffered){var endOfSegment=startOfSegment+segmentDuration,originalSegmentRange=_videoJs2.default.createTimeRanges([[startOfSegment,endOfSegment]]),adjustedSegmentRange=_videoJs2.default.createTimeRanges([[clamp(startOfSegment,[currentTime,endOfSegment]),endOfSegment]]);if(adjustedSegmentRange.start(0)===adjustedSegmentRange.end(0))return 0;var percent=calculateBufferedPercent(adjustedSegmentRange,originalSegmentRange,currentTime,buffered);return isNaN(percent)||percent===1/0||percent===-1/0?0:percent},TIME_FUDGE_FACTOR:1/30,printableRange:function(range){var strArr=[];if(!range||!range.length)return"";for(var i=0;i<range.length;i++)strArr.push(range.start(i)+" => "+range.end(i));return strArr.join(", ")},timeUntilRebuffer:function(buffered,currentTime){var playbackRate=arguments.length<=2||void 0===arguments[2]?1:arguments[2];return((buffered.length?buffered.end(buffered.length-1):0)-currentTime)/playbackRate}},module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],12:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _videoJs2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),defaultOptions={errorInterval:30,getSource:function(next){return next(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_)}},initPlugin=function initPlugin(player,options){var lastCalled=0,seekTo=0,localOptions=_videoJs2.default.mergeOptions(defaultOptions,options);player.ready(function(){player.trigger({type:"usage",name:"hls-error-reload-initialized"})});var loadedMetadataHandler=function(){seekTo&&player.currentTime(seekTo)},setSource=function(sourceObj){null!==sourceObj&&void 0!==sourceObj&&(seekTo=player.duration()!==1/0&&player.currentTime()||0,player.one("loadedmetadata",loadedMetadataHandler),player.src(sourceObj),player.trigger({type:"usage",name:"hls-error-reload"}),player.play())},errorHandler=function(){if(Date.now()-lastCalled<1e3*localOptions.errorInterval)player.trigger({type:"usage",name:"hls-error-reload-canceled"});else{if(localOptions.getSource&&"function"==typeof localOptions.getSource)return lastCalled=Date.now(),localOptions.getSource.call(player,setSource);_videoJs2.default.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},cleanupEvents=function cleanupEvents(){player.off("loadedmetadata",loadedMetadataHandler),player.off("error",errorHandler),player.off("dispose",cleanupEvents)};player.on("error",errorHandler),player.on("dispose",cleanupEvents),player.reloadSourceOnError=function(newOptions){cleanupEvents(),initPlugin(player,newOptions)}};exports.default=function(options){initPlugin(this,options)},module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _playlistJs=require("./playlist.js"),enableFunction=function(loader,playlistUri,changePlaylistFn,enable){var playlist=loader.master.playlists[playlistUri],blacklisted=(0,_playlistJs.isBlacklisted)(playlist),currentlyEnabled=(0,_playlistJs.isEnabled)(playlist);return void 0===enable?currentlyEnabled:(enable?delete playlist.disabled:playlist.disabled=!0,enable===currentlyEnabled||blacklisted||(changePlaylistFn(),enable?loader.trigger("renditionenabled"):loader.trigger("renditiondisabled")),enable)},Representation=function Representation(hlsHandler,playlist,id){_classCallCheck(this,Representation);var fastChangeFunction=hlsHandler.masterPlaylistController_.fastQualityChange_.bind(hlsHandler.masterPlaylistController_);if(playlist.attributes.RESOLUTION){var resolution=playlist.attributes.RESOLUTION;this.width=resolution.width,this.height=resolution.height}this.bandwidth=playlist.attributes.BANDWIDTH,this.id=id,this.enabled=enableFunction.bind(this,hlsHandler.playlists,playlist.uri,fastChangeFunction)};exports.default=function(hlsHandler){var playlists=hlsHandler.playlists;hlsHandler.representations=function(){return playlists.master.playlists.filter(function(media){return!(0,_playlistJs.isBlacklisted)(media)}).map(function(e,i){return new Representation(hlsHandler,e,e.uri)})}},module.exports=exports.default},{"./playlist.js":10}],14:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _urlToolkit2=_interopRequireDefault(require("url-toolkit")),_globalWindow2=_interopRequireDefault(require("global/window"));exports.default=function(baseURL,relativeURL){return/^[a-z]+:/i.test(relativeURL)?relativeURL:(/\/\//i.test(baseURL)||(baseURL=_urlToolkit2.default.buildAbsoluteURL(_globalWindow2.default.location.href,baseURL)),_urlToolkit2.default.buildAbsoluteURL(baseURL,relativeURL))},module.exports=exports.default},{"global/window":31,"url-toolkit":62}],15:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x4,_x5,_x6){for(var _again=!0;_again;){var object=_x4,property=_x5,receiver=_x6;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x4=parent,_x5=property,_x6=receiver,_again=!0,desc=parent=void 0}},_playlist2=_interopRequireDefault(require("./playlist")),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),_sourceUpdater2=_interopRequireDefault(require("./source-updater")),_config2=_interopRequireDefault(require("./config")),_globalWindow2=_interopRequireDefault(require("global/window")),_videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2=_interopRequireDefault(require("videojs-contrib-media-sources/es5/remove-cues-from-track.js")),_binUtils=require("./bin-utils"),_mediaSegmentRequest=require("./media-segment-request"),_ranges=require("./ranges"),_playlistSelectors=require("./playlist-selectors"),detectEndOfStream=function(playlist,mediaSource,segmentIndex){if(!playlist||!mediaSource)return!1;var appendedLastSegment=segmentIndex===playlist.segments.length;return playlist.endList&&"open"===mediaSource.readyState&&appendedLastSegment},finite=function(num){return"number"==typeof num&&isFinite(num)},SegmentLoader=function(_videojs$EventTarget){function SegmentLoader(settings){var _this=this,options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(_classCallCheck(this,SegmentLoader),_get(Object.getPrototypeOf(SegmentLoader.prototype),"constructor",this).call(this),!settings)throw new TypeError("Initialization settings are required");if("function"!=typeof settings.currentTime)throw new TypeError("No currentTime getter specified");if(!settings.mediaSource)throw new TypeError("No MediaSource specified");this.state="INIT",this.bandwidth=settings.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.hasPlayed_=settings.hasPlayed,this.currentTime_=settings.currentTime,this.seekable_=settings.seekable,this.seeking_=settings.seeking,this.duration_=settings.duration,this.mediaSource_=settings.mediaSource,this.hls_=settings.hls,this.loaderType_=settings.loaderType,this.segmentMetadataTrack_=settings.segmentMetadataTrack,this.goalBufferLength_=settings.goalBufferLength,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.mimeType_=null,this.sourceUpdater_=null,this.xhrOptions_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.decrypter_=settings.decrypter,this.syncController_=settings.syncController,this.syncPoint_={segmentIndex:0,time:0},this.syncController_.on("syncinfoupdate",function(){return _this.trigger("syncinfoupdate")}),this.mediaSource_.addEventListener("sourceopen",function(){return _this.ended_=!1}),this.fetchAtBuffer_=!1,options.debug&&(this.logger_=_videoJs2.default.log.bind(_videoJs2.default,"segment-loader",this.loaderType_,"->"))}return _inherits(SegmentLoader,_videoJs2["default"].EventTarget),_createClass(SegmentLoader,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED",this.pause(),this.abort_(),this.sourceUpdater_&&this.sourceUpdater_.dispose(),this.resetStats_()}},{key:"abort",value:function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null}},{key:"error",value:function(_error){return void 0!==_error&&(this.error_=_error),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0,this.pause(),this.trigger("ended")}},{key:"buffered_",value:function(){return this.sourceUpdater_?this.sourceUpdater_.buffered():_videoJs2.default.createTimeRanges()}},{key:"initSegment",value:function(map){var set=!(arguments.length<=1||void 0===arguments[1])&&arguments[1];if(!map)return null;var id=(0,_binUtils.initSegmentId)(map),storedMap=this.initSegments_[id];return set&&!storedMap&&map.bytes&&(this.initSegments_[id]=storedMap={resolvedUri:map.resolvedUri,byterange:map.byterange,bytes:map.bytes}),storedMap||map}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&"INIT"===this.state)&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY")}}},{key:"init_",value:function(){return this.state="READY",this.sourceUpdater_=new _sourceUpdater2.default(this.mediaSource_,this.mimeType_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(newPlaylist){var options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(newPlaylist){var oldPlaylist=this.playlist_,segmentInfo=this.pendingSegment_;if(this.playlist_=newPlaylist,this.xhrOptions_=options,this.hasPlayed_()||(newPlaylist.syncInfo={mediaSequence:newPlaylist.mediaSequence,time:0}),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(oldPlaylist&&oldPlaylist.uri===newPlaylist.uri){var mediaSequenceDiff=newPlaylist.mediaSequence-oldPlaylist.mediaSequence;this.logger_("mediaSequenceDiff",mediaSequenceDiff),null!==this.mediaIndex&&(this.mediaIndex-=mediaSequenceDiff),segmentInfo&&(segmentInfo.mediaIndex-=mediaSequenceDiff,segmentInfo.mediaIndex>=0&&(segmentInfo.segment=newPlaylist.segments[segmentInfo.mediaIndex])),this.syncController_.saveExpiredSegmentInfo(oldPlaylist,newPlaylist)}else null!==this.mediaIndex&&this.resyncLoader()}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(_globalWindow2.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"mimeType",value:function(_mimeType){this.mimeType_||(this.mimeType_=_mimeType,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(){this.ended_=!1,this.resetLoader(),this.remove(0,this.duration_()),this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null,this.syncPoint_=null,this.abort()}},{key:"remove",value:function(start,end){this.sourceUpdater_&&this.sourceUpdater_.remove(start,end),(0,_videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2.default)(start,end,this.segmentMetadataTrack_)}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&_globalWindow2.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=_globalWindow2.default.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&_globalWindow2.default.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=_globalWindow2.default.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var segmentInfo=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);segmentInfo&&(detectEndOfStream(this.playlist_,this.mediaSource_,segmentInfo.mediaIndex)?this.endOfStream():(segmentInfo.mediaIndex!==this.playlist_.segments.length-1||"ended"!==this.mediaSource_.readyState||this.seeking_())&&((segmentInfo.timeline!==this.currentTimeline_||null!==segmentInfo.startOfSegment&&segmentInfo.startOfSegment<this.sourceUpdater_.timestampOffset())&&(this.syncController_.reset(),segmentInfo.timestampOffset=segmentInfo.startOfSegment),this.loadSegment_(segmentInfo)))}}},{key:"checkBuffer_",value:function(buffered,playlist,mediaIndex,hasPlayed,currentTime,syncPoint){var lastBufferedEnd=0,startOfSegment=void 0;buffered.length&&(lastBufferedEnd=buffered.end(buffered.length-1));var bufferedTime=Math.max(0,lastBufferedEnd-currentTime);if(!playlist.segments.length)return null;if(bufferedTime>=this.goalBufferLength_())return null;if(!hasPlayed&&bufferedTime>=1)return null;if(this.logger_("checkBuffer_","mediaIndex:",mediaIndex,"hasPlayed:",hasPlayed,"currentTime:",currentTime,"syncPoint:",syncPoint,"fetchAtBuffer:",this.fetchAtBuffer_,"bufferedTime:",bufferedTime),null===syncPoint)return mediaIndex=this.getSyncSegmentCandidate_(playlist),this.logger_("getSync","mediaIndex:",mediaIndex),this.generateSegmentInfo_(playlist,mediaIndex,null,!0);if(null!==mediaIndex){this.logger_("walkForward","mediaIndex:",mediaIndex+1);var segment=playlist.segments[mediaIndex];return startOfSegment=segment&&segment.end?segment.end:lastBufferedEnd,this.generateSegmentInfo_(playlist,mediaIndex+1,startOfSegment,!1)}if(this.fetchAtBuffer_)mediaIndex=(mediaSourceInfo=_playlist2.default.getMediaInfoForTime(playlist,lastBufferedEnd,syncPoint.segmentIndex,syncPoint.time)).mediaIndex,startOfSegment=mediaSourceInfo.startTime;else{var mediaSourceInfo=_playlist2.default.getMediaInfoForTime(playlist,currentTime,syncPoint.segmentIndex,syncPoint.time);mediaIndex=mediaSourceInfo.mediaIndex,startOfSegment=mediaSourceInfo.startTime}return this.logger_("getMediaIndexForTime","mediaIndex:",mediaIndex,"startOfSegment:",startOfSegment),this.generateSegmentInfo_(playlist,mediaIndex,startOfSegment,!1)}},{key:"getSyncSegmentCandidate_",value:function(playlist){var _this2=this;if(-1===this.currentTimeline_)return 0;var segmentIndexArray=playlist.segments.map(function(s,i){return{timeline:s.timeline,segmentIndex:i}}).filter(function(s){return s.timeline===_this2.currentTimeline_});return segmentIndexArray.length?segmentIndexArray[Math.min(segmentIndexArray.length-1,1)].segmentIndex:Math.max(playlist.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(playlist,mediaIndex,startOfSegment,isSyncRequest){if(mediaIndex<0||mediaIndex>=playlist.segments.length)return null;var segment=playlist.segments[mediaIndex];return{requestId:"segment-loader-"+Math.random(),uri:segment.resolvedUri,mediaIndex:mediaIndex,isSyncRequest:isSyncRequest,startOfSegment:startOfSegment,playlist:playlist,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:segment.timeline,duration:segment.duration,segment:segment}}},{key:"abortRequestEarly_",value:function(stats){if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH)return!1;if(Date.now()-(stats.firstBytesReceivedAt||Date.now())<1e3)return!1;var currentTime=this.currentTime_(),measuredBandwidth=stats.bandwidth,segmentDuration=this.pendingSegment_.duration,requestTimeRemaining=_playlist2.default.estimateSegmentRequestTime(segmentDuration,measuredBandwidth,this.playlist_,stats.bytesReceived),timeUntilRebuffer=(0,_ranges.timeUntilRebuffer)(this.buffered_(),currentTime,this.hls_.tech_.playbackRate())-1;if(requestTimeRemaining<=timeUntilRebuffer)return!1;var switchCandidate=(0,_playlistSelectors.minRebufferMaxBandwidthSelector)({master:this.hls_.playlists.master,currentTime:currentTime,bandwidth:measuredBandwidth,duration:this.duration_(),segmentDuration:segmentDuration,timeUntilRebuffer:timeUntilRebuffer,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(switchCandidate){var timeSavedBySwitching=requestTimeRemaining-timeUntilRebuffer-switchCandidate.rebufferingImpact,minimumTimeSaving=.5;return timeUntilRebuffer<=_ranges.TIME_FUDGE_FACTOR&&(minimumTimeSaving=1),!switchCandidate.playlist||switchCandidate.playlist.uri===this.playlist_.uri||timeSavedBySwitching<minimumTimeSaving?!1:(this.bandwidth=switchCandidate.playlist.attributes.BANDWIDTH*_config2.default.BANDWIDTH_VARIANCE+1,this.abort(),this.trigger("earlyabort"),!0)}}},{key:"handleProgress_",value:function(event,simpleSegment){this.pendingSegment_&&simpleSegment.requestId===this.pendingSegment_.requestId&&!this.abortRequestEarly_(simpleSegment.stats)&&this.trigger("progress")}},{key:"loadSegment_",value:function(segmentInfo){this.state="WAITING",this.pendingSegment_=segmentInfo,this.trimBackBuffer_(segmentInfo),segmentInfo.abortRequests=(0,_mediaSegmentRequest.mediaSegmentRequest)(this.hls_.xhr,this.xhrOptions_,this.decrypter_,this.createSimplifiedSegmentObj_(segmentInfo),this.handleProgress_.bind(this),this.segmentRequestFinished_.bind(this))}},{key:"trimBackBuffer_",value:function(segmentInfo){var seekable=this.seekable_(),currentTime=this.currentTime_(),removeToTime=0;(removeToTime=seekable.length&&seekable.start(0)>0&&seekable.start(0)<currentTime?seekable.start(0):currentTime-30)>0&&this.remove(0,removeToTime)}},{key:"createSimplifiedSegmentObj_",value:function(segmentInfo){var segment=segmentInfo.segment,simpleSegment={resolvedUri:segment.resolvedUri,byterange:segment.byterange,requestId:segmentInfo.requestId};if(segment.key){var iv=segment.key.iv||new Uint32Array([0,0,0,segmentInfo.mediaIndex+segmentInfo.playlist.mediaSequence]);simpleSegment.key={resolvedUri:segment.key.resolvedUri,iv:iv}}return segment.map&&(simpleSegment.map=this.initSegment(segment.map)),simpleSegment}},{key:"segmentRequestFinished_",value:function(error,simpleSegment){if(this.mediaRequests+=1,simpleSegment.stats&&(this.mediaBytesTransferred+=simpleSegment.stats.bytesReceived,this.mediaTransferDuration+=simpleSegment.stats.roundTripTime),this.pendingSegment_){if(simpleSegment.requestId===this.pendingSegment_.requestId){if(error)return this.pendingSegment_=null,this.state="READY",error.code===_mediaSegmentRequest.REQUEST_ERRORS.ABORTED?void(this.mediaRequestsAborted+=1):(this.pause(),error.code===_mediaSegmentRequest.REQUEST_ERRORS.TIMEOUT?(this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,void this.trigger("bandwidthupdate")):(this.mediaRequestsErrored+=1,this.error(error),void this.trigger("error")));this.bandwidth=simpleSegment.stats.bandwidth,this.roundTrip=simpleSegment.stats.roundTripTime,simpleSegment.map&&(simpleSegment.map=this.initSegment(simpleSegment.map,!0)),this.processSegmentResponse_(simpleSegment)}}else this.mediaRequestsAborted+=1}},{key:"processSegmentResponse_",value:function(simpleSegment){var segmentInfo=this.pendingSegment_;segmentInfo.bytes=simpleSegment.bytes,simpleSegment.map&&(segmentInfo.segment.map.bytes=simpleSegment.map.bytes),segmentInfo.endOfAllRequests=simpleSegment.endOfAllRequests,this.handleSegment_()}},{key:"handleSegment_",value:function(){var _this3=this;if(this.pendingSegment_){this.state="APPENDING";var segmentInfo=this.pendingSegment_,segment=segmentInfo.segment;if(this.syncController_.probeSegmentInfo(segmentInfo),segmentInfo.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");null!==segmentInfo.timestampOffset&&segmentInfo.timestampOffset!==this.sourceUpdater_.timestampOffset()&&(this.sourceUpdater_.timestampOffset(segmentInfo.timestampOffset),this.trigger("timestampoffset")),segment.map&&function(){var initId=(0,_binUtils.initSegmentId)(segment.map);if(!_this3.activeInitSegmentId_||_this3.activeInitSegmentId_!==initId){var initSegment=_this3.initSegment(segment.map);_this3.sourceUpdater_.appendBuffer(initSegment.bytes,function(){_this3.activeInitSegmentId_=initId})}}(),segmentInfo.byteLength=segmentInfo.bytes.byteLength,"number"==typeof segment.start&&"number"==typeof segment.end?this.mediaSecondsLoaded+=segment.end-segment.start:this.mediaSecondsLoaded+=segment.duration,this.sourceUpdater_.appendBuffer(segmentInfo.bytes,this.handleUpdateEnd_.bind(this))}else this.state="READY"}},{key:"handleUpdateEnd_",value:function(){if(this.logger_("handleUpdateEnd_","segmentInfo:",this.pendingSegment_),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var segmentInfo=this.pendingSegment_,segment=segmentInfo.segment,isWalkingForward=null!==this.mediaIndex;this.pendingSegment_=null,this.recordThroughput_(segmentInfo),this.addSegmentMetadataCue_(segmentInfo),this.state="READY",this.mediaIndex=segmentInfo.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=segmentInfo.timeline,this.trigger("syncinfoupdate"),segment.end&&this.currentTime_()-segment.end>3*segmentInfo.playlist.targetDuration?this.resetEverything():(isWalkingForward&&this.trigger("bandwidthupdate"),this.trigger("progress"),detectEndOfStream(segmentInfo.playlist,this.mediaSource_,segmentInfo.mediaIndex+1)&&this.endOfStream(),this.paused()||this.monitorBuffer_())}},{key:"recordThroughput_",value:function(segmentInfo){var rate=this.throughput.rate,segmentProcessingTime=Date.now()-segmentInfo.endOfAllRequests+1,segmentProcessingThroughput=Math.floor(segmentInfo.byteLength/segmentProcessingTime*8*1e3);this.throughput.rate+=(segmentProcessingThroughput-rate)/++this.throughput.count}},{key:"logger_",value:function(){}},{key:"addSegmentMetadataCue_",value:function(segmentInfo){if(this.segmentMetadataTrack_){var segment=segmentInfo.segment,start=segment.start,end=segment.end;if(finite(start)&&finite(end)){(0,_videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2.default)(start,end,this.segmentMetadataTrack_);var Cue=_globalWindow2.default.WebKitDataCue||_globalWindow2.default.VTTCue,value={uri:segmentInfo.uri,timeline:segmentInfo.timeline,playlist:segmentInfo.playlist.uri,start:start,end:end},cue=new Cue(start,end,JSON.stringify(value));cue.value=value,this.segmentMetadataTrack_.addCue(cue)}}}}]),SegmentLoader}();exports.default=SegmentLoader,module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./bin-utils":2,"./config":3,"./media-segment-request":6,"./playlist":10,"./playlist-selectors":9,"./ranges":11,"./source-updater":16,"global/window":31,"videojs-contrib-media-sources/es5/remove-cues-from-track.js":72}],16:[function(require,module,exports){(function(global){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_videoJs2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),noop=function(){},SourceUpdater=function(){function SourceUpdater(mediaSource,mimeType){var _this=this;_classCallCheck(this,SourceUpdater);var createSourceBuffer=function(){_this.sourceBuffer_=mediaSource.addSourceBuffer(mimeType),_this.onUpdateendCallback_=function(){var pendingCallback=_this.pendingCallback_;_this.pendingCallback_=null,pendingCallback&&pendingCallback(),_this.runCallback_()},_this.sourceBuffer_.addEventListener("updateend",_this.onUpdateendCallback_),_this.runCallback_()};this.callbacks_=[],this.pendingCallback_=null,this.timestampOffset_=0,this.mediaSource=mediaSource,this.processedAppend_=!1,"closed"===mediaSource.readyState?mediaSource.addEventListener("sourceopen",createSourceBuffer):createSourceBuffer()}return _createClass(SourceUpdater,[{key:"abort",value:function(done){var _this2=this;this.processedAppend_&&this.queueCallback_(function(){_this2.sourceBuffer_.abort()},done)}},{key:"appendBuffer",value:function(bytes,done){var _this3=this;this.processedAppend_=!0,this.queueCallback_(function(){_this3.sourceBuffer_.appendBuffer(bytes)},done)}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:_videoJs2.default.createTimeRanges()}},{key:"remove",value:function(start,end){var _this4=this;this.processedAppend_&&this.queueCallback_(function(){_this4.sourceBuffer_.remove(start,end)},noop)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||this.pendingCallback_}},{key:"timestampOffset",value:function(offset){var _this5=this;return void 0!==offset&&(this.queueCallback_(function(){_this5.sourceBuffer_.timestampOffset=offset}),this.timestampOffset_=offset),this.timestampOffset_}},{key:"queueCallback_",value:function(callback,done){this.callbacks_.push([callback.bind(this),done]),this.runCallback_()}},{key:"runCallback_",value:function(){var callbacks=void 0;!this.updating()&&this.callbacks_.length&&(callbacks=this.callbacks_.shift(),this.pendingCallback_=callbacks[1],callbacks[0]())}},{key:"dispose",value:function(){this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_),this.sourceBuffer_&&"open"===this.mediaSource.readyState&&this.sourceBuffer_.abort()}}]),SourceUpdater}();exports.default=SourceUpdater,module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],17:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x2,_x3,_x4){for(var _again=!0;_again;){var object=_x2,property=_x3,receiver=_x4;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x2=parent,_x3=property,_x4=receiver,_again=!0,desc=parent=void 0}},_muxJsLibMp4Probe2=_interopRequireDefault(require("mux.js/lib/mp4/probe")),_muxJsLibToolsTsInspectorJs=require("mux.js/lib/tools/ts-inspector.js"),_playlist=require("./playlist"),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),syncPointStrategies=[{name:"VOD",run:function(syncController,playlist,duration,currentTimeline,currentTime){return duration!==1/0?{time:0,segmentIndex:0}:null}},{name:"ProgramDateTime",run:function(syncController,playlist,duration,currentTimeline,currentTime){return syncController.datetimeToDisplayTime&&playlist.dateTimeObject?{time:playlist.dateTimeObject.getTime()/1e3+syncController.datetimeToDisplayTime,segmentIndex:0}:null}},{name:"Segment",run:function(syncController,playlist,duration,currentTimeline,currentTime){var segments=playlist.segments||[],syncPoint=null,lastDistance=null;currentTime=currentTime||0;for(var i=0;i<segments.length;i++){var segment=segments[i];if(segment.timeline===currentTimeline&&void 0!==segment.start){var distance=Math.abs(currentTime-segment.start);if(null!==lastDistance&&lastDistance<distance)break;(!syncPoint||null===lastDistance||lastDistance>=distance)&&(lastDistance=distance,syncPoint={time:segment.start,segmentIndex:i})}}return syncPoint}},{name:"Discontinuity",run:function(syncController,playlist,duration,currentTimeline,currentTime){var syncPoint=null;if(currentTime=currentTime||0,playlist.discontinuityStarts&&playlist.discontinuityStarts.length)for(var lastDistance=null,i=0;i<playlist.discontinuityStarts.length;i++){var segmentIndex=playlist.discontinuityStarts[i],discontinuity=playlist.discontinuitySequence+i+1,discontinuitySync=syncController.discontinuities[discontinuity];if(discontinuitySync){var distance=Math.abs(currentTime-discontinuitySync.time);if(null!==lastDistance&&lastDistance<distance)break;(!syncPoint||null===lastDistance||lastDistance>=distance)&&(lastDistance=distance,syncPoint={time:discontinuitySync.time,segmentIndex:segmentIndex})}}return syncPoint}},{name:"Playlist",run:function(syncController,playlist,duration,currentTimeline,currentTime){return playlist.syncInfo?{time:playlist.syncInfo.time,segmentIndex:playlist.syncInfo.mediaSequence-playlist.mediaSequence}:null}}];exports.syncPointStrategies=syncPointStrategies;var SyncController=function(_videojs$EventTarget){function SyncController(){var options=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];_classCallCheck(this,SyncController),_get(Object.getPrototypeOf(SyncController.prototype),"constructor",this).call(this),this.inspectCache_=void 0,this.timelines=[],this.discontinuities=[],this.datetimeToDisplayTime=null,options.debug&&(this.logger_=_videoJs2.default.log.bind(_videoJs2.default,"sync-controller ->"))}return _inherits(SyncController,_videoJs2["default"].EventTarget),_createClass(SyncController,[{key:"getSyncPoint",value:function(playlist,duration,currentTimeline,currentTime){var syncPoints=this.runStrategies_(playlist,duration,currentTimeline,currentTime);return syncPoints.length?this.selectSyncPoint_(syncPoints,{key:"time",value:currentTime}):null}},{key:"getExpiredTime",value:function(playlist,duration){if(!playlist||!playlist.segments)return null;var syncPoints=this.runStrategies_(playlist,duration,playlist.discontinuitySequence,0);if(!syncPoints.length)return null;var syncPoint=this.selectSyncPoint_(syncPoints,{key:"segmentIndex",value:0});return syncPoint.segmentIndex>0&&(syncPoint.time*=-1),Math.abs(syncPoint.time+(0,_playlist.sumDurations)(playlist,syncPoint.segmentIndex,0))}},{key:"runStrategies_",value:function(playlist,duration,currentTimeline,currentTime){for(var syncPoints=[],i=0;i<syncPointStrategies.length;i++){var strategy=syncPointStrategies[i],syncPoint=strategy.run(this,playlist,duration,currentTimeline,currentTime);syncPoint&&(syncPoint.strategy=strategy.name,syncPoints.push({strategy:strategy.name,syncPoint:syncPoint}),this.logger_("syncPoint found via <"+strategy.name+">:",syncPoint))}return syncPoints}},{key:"selectSyncPoint_",value:function(syncPoints,target){for(var bestSyncPoint=syncPoints[0].syncPoint,bestDistance=Math.abs(syncPoints[0].syncPoint[target.key]-target.value),bestStrategy=syncPoints[0].strategy,i=1;i<syncPoints.length;i++){var newDistance=Math.abs(syncPoints[i].syncPoint[target.key]-target.value);newDistance<bestDistance&&(bestDistance=newDistance,bestSyncPoint=syncPoints[i].syncPoint,bestStrategy=syncPoints[i].strategy)}return this.logger_("syncPoint with strategy <"+bestStrategy+"> chosen: ",bestSyncPoint),bestSyncPoint}},{key:"saveExpiredSegmentInfo",value:function(oldPlaylist,newPlaylist){for(var i=newPlaylist.mediaSequence-oldPlaylist.mediaSequence-1;i>=0;i--){var lastRemovedSegment=oldPlaylist.segments[i];if(lastRemovedSegment&&void 0!==lastRemovedSegment.start){newPlaylist.syncInfo={mediaSequence:oldPlaylist.mediaSequence+i,time:lastRemovedSegment.start},this.logger_("playlist sync:",newPlaylist.syncInfo),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMapping",value:function(playlist){if(!this.datetimeToDisplayTime&&playlist.dateTimeObject){var playlistTimestamp=playlist.dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-playlistTimestamp}}},{key:"reset",value:function(){this.inspectCache_=void 0}},{key:"probeSegmentInfo",value:function(segmentInfo){var timingInfo=void 0;(timingInfo=segmentInfo.segment.map?this.probeMp4Segment_(segmentInfo):this.probeTsSegment_(segmentInfo))&&this.calculateSegmentTimeMapping_(segmentInfo,timingInfo)&&this.saveDiscontinuitySyncInfo_(segmentInfo)}},{key:"probeMp4Segment_",value:function(segmentInfo){var segment=segmentInfo.segment,timescales=_muxJsLibMp4Probe2.default.timescale(segment.map.bytes),startTime=_muxJsLibMp4Probe2.default.startTime(timescales,segmentInfo.bytes);return null!==segmentInfo.timestampOffset&&(segmentInfo.timestampOffset-=startTime),{start:startTime,end:startTime+segment.duration}}},{key:"probeTsSegment_",value:function(segmentInfo){var timeInfo=(0,_muxJsLibToolsTsInspectorJs.inspect)(segmentInfo.bytes,this.inspectCache_),segmentStartTime=void 0,segmentEndTime=void 0;return timeInfo?(timeInfo.video&&2===timeInfo.video.length?(this.inspectCache_=timeInfo.video[1].dts,segmentStartTime=timeInfo.video[0].dtsTime,segmentEndTime=timeInfo.video[1].dtsTime):timeInfo.audio&&2===timeInfo.audio.length&&(this.inspectCache_=timeInfo.audio[1].dts,segmentStartTime=timeInfo.audio[0].dtsTime,segmentEndTime=timeInfo.audio[1].dtsTime),{start:segmentStartTime,end:segmentEndTime}):null}},{key:"timestampOffsetForTimeline",value:function(timeline){return void 0===this.timelines[timeline]?null:this.timelines[timeline].time}},{key:"calculateSegmentTimeMapping_",value:function(segmentInfo,timingInfo){var segment=segmentInfo.segment,mappingObj=this.timelines[segmentInfo.timeline];if(null!==segmentInfo.timestampOffset)this.logger_("tsO:",segmentInfo.timestampOffset),mappingObj={time:segmentInfo.startOfSegment,mapping:segmentInfo.startOfSegment-timingInfo.start},this.timelines[segmentInfo.timeline]=mappingObj,this.trigger("timestampoffset"),segment.start=segmentInfo.startOfSegment,segment.end=timingInfo.end+mappingObj.mapping;else{if(!mappingObj)return!1;segment.start=timingInfo.start+mappingObj.mapping,segment.end=timingInfo.end+mappingObj.mapping}return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(segmentInfo){var playlist=segmentInfo.playlist,segment=segmentInfo.segment;if(segment.discontinuity)this.discontinuities[segment.timeline]={time:segment.start,accuracy:0};else if(playlist.discontinuityStarts.length)for(var i=0;i<playlist.discontinuityStarts.length;i++){var segmentIndex=playlist.discontinuityStarts[i],discontinuity=playlist.discontinuitySequence+i+1,mediaIndexDiff=segmentIndex-segmentInfo.mediaIndex,accuracy=Math.abs(mediaIndexDiff);if(!this.discontinuities[discontinuity]||this.discontinuities[discontinuity].accuracy>accuracy){var time=void 0;time=mediaIndexDiff<0?segment.start-(0,_playlist.sumDurations)(playlist,segmentInfo.mediaIndex,segmentIndex):segment.end+(0,_playlist.sumDurations)(playlist,segmentInfo.mediaIndex+1,segmentIndex),this.discontinuities[discontinuity]={time:time,accuracy:accuracy}}}}},{key:"logger_",value:function(){}}]),SyncController}();exports.default=SyncController}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./playlist":10,"mux.js/lib/mp4/probe":56,"mux.js/lib/tools/ts-inspector.js":58}],18:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.parseCodecs=function(){var codecs=arguments.length<=0||void 0===arguments[0]?"":arguments[0],result={codecCount:0},parsed=void 0;return result.codecCount=codecs.split(",").length,result.codecCount=result.codecCount||2,(parsed=/(^|\s|,)+(avc1)([^ ,]*)/i.exec(codecs))&&(result.videoCodec=parsed[2],result.videoObjectTypeIndicator=parsed[3]),result.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(codecs),result.audioProfile=result.audioProfile&&result.audioProfile[2],result}},{}],19:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x3,_x4,_x5){for(var _again=!0;_again;){var object=_x3,property=_x4,receiver=_x5;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x3=parent,_x4=property,_x5=receiver,_again=!0,desc=parent=void 0}},_segmentLoader2=_interopRequireDefault(require("./segment-loader")),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),_globalWindow2=_interopRequireDefault(require("global/window")),_videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2=_interopRequireDefault(require("videojs-contrib-media-sources/es5/remove-cues-from-track.js")),_binUtils=require("./bin-utils"),VTT_LINE_TERMINATORS=new Uint8Array("\n\n".split("").map(function(char){return char.charCodeAt(0)})),uintToString=function(uintArray){return String.fromCharCode.apply(null,uintArray)},VTTSegmentLoader=function(_SegmentLoader){function VTTSegmentLoader(settings){var options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];_classCallCheck(this,VTTSegmentLoader),_get(Object.getPrototypeOf(VTTSegmentLoader.prototype),"constructor",this).call(this,settings,options),this.mediaSource_=null,this.subtitlesTrack_=null}return _inherits(VTTSegmentLoader,_segmentLoader2["default"]),_createClass(VTTSegmentLoader,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return _videoJs2.default.createTimeRanges();var cues=this.subtitlesTrack_.cues,start=cues[0].startTime,end=cues[cues.length-1].startTime;return _videoJs2.default.createTimeRanges([[start,end]])}},{key:"initSegment",value:function(map){var set=!(arguments.length<=1||void 0===arguments[1])&&arguments[1];if(!map)return null;var id=(0,_binUtils.initSegmentId)(map),storedMap=this.initSegments_[id];if(set&&!storedMap&&map.bytes){var combinedByteLength=VTT_LINE_TERMINATORS.byteLength+map.bytes.byteLength,combinedSegment=new Uint8Array(combinedByteLength);combinedSegment.set(map.bytes),combinedSegment.set(VTT_LINE_TERMINATORS,map.bytes.byteLength),this.initSegments_[id]=storedMap={resolvedUri:map.resolvedUri,byterange:map.byterange,bytes:combinedSegment}}return storedMap||map}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(_track){this.subtitlesTrack_=_track,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()}},{key:"remove",value:function(start,end){(0,_videojsContribMediaSourcesEs5RemoveCuesFromTrackJs2.default)(start,end,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var _this=this;this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var segmentInfo=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(segmentInfo=this.skipEmptySegments_(segmentInfo)){if(null===this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline)){return this.syncController_.one("timestampoffset",function(){_this.state="READY",_this.paused()||_this.monitorBuffer_()}),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(segmentInfo)}}},{key:"skipEmptySegments_",value:function(segmentInfo){for(;segmentInfo&&segmentInfo.segment.empty;)segmentInfo=this.generateSegmentInfo_(segmentInfo.playlist,segmentInfo.mediaIndex+1,segmentInfo.startOfSegment+segmentInfo.duration,segmentInfo.isSyncRequest);return segmentInfo}},{key:"handleSegment_",value:function(){var _this2=this;if(this.pendingSegment_){this.state="APPENDING";var segmentInfo=this.pendingSegment_,segment=segmentInfo.segment;if("function"!=typeof _globalWindow2.default.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var _ret=function(){var loadHandler=function(){_this2.handleSegment_()};return _this2.state="WAITING_ON_VTTJS",_this2.subtitlesTrack_.tech_.one("vttjsloaded",loadHandler),_this2.subtitlesTrack_.tech_.one("vttjserror",function(){_this2.subtitlesTrack_.tech_.off("vttjsloaded",loadHandler),_this2.error({message:"Error loading vtt.js"}),_this2.state="READY",_this2.pause(),_this2.trigger("error")}),{v:void 0}}();if("object"==typeof _ret)return _ret.v}segment.requested=!0;try{this.parseVTTCues_(segmentInfo)}catch(e){return this.error({message:e.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(segmentInfo,this.syncController_.timelines[segmentInfo.timeline],this.playlist_),segmentInfo.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");segmentInfo.byteLength=segmentInfo.bytes.byteLength,this.mediaSecondsLoaded+=segment.duration,segmentInfo.cues.length&&this.remove(segmentInfo.cues[0].endTime,segmentInfo.cues[segmentInfo.cues.length-1].endTime),segmentInfo.cues.forEach(function(cue){_this2.subtitlesTrack_.addCue(cue)}),this.handleUpdateEnd_()}else this.state="READY"}},{key:"parseVTTCues_",value:function(segmentInfo){var decoder=void 0,decodeBytesToString=!1;"function"==typeof _globalWindow2.default.TextDecoder?decoder=new _globalWindow2.default.TextDecoder("utf8"):(decoder=_globalWindow2.default.WebVTT.StringDecoder(),decodeBytesToString=!0);var parser=new _globalWindow2.default.WebVTT.Parser(_globalWindow2.default,_globalWindow2.default.vttjs,decoder);if(segmentInfo.cues=[],segmentInfo.timestampmap={MPEGTS:0,LOCAL:0},parser.oncue=segmentInfo.cues.push.bind(segmentInfo.cues),parser.ontimestampmap=function(map){return segmentInfo.timestampmap=map},parser.onparsingerror=function(error){_videoJs2.default.log.warn("Error encountered when parsing cues: "+error.message)},segmentInfo.segment.map){var mapData=segmentInfo.segment.map.bytes;decodeBytesToString&&(mapData=uintToString(mapData)),parser.parse(mapData)}var segmentData=segmentInfo.bytes;decodeBytesToString&&(segmentData=uintToString(segmentData)),parser.parse(segmentData),parser.flush()}},{key:"updateTimeMapping_",value:function(segmentInfo,mappingObj,playlist){var segment=segmentInfo.segment;if(mappingObj)if(segmentInfo.cues.length){var timestampmap=segmentInfo.timestampmap,diff=timestampmap.MPEGTS/9e4-timestampmap.LOCAL+mappingObj.mapping;if(segmentInfo.cues.forEach(function(cue){cue.startTime+=diff,cue.endTime+=diff}),!playlist.syncInfo){var firstStart=segmentInfo.cues[0].startTime,lastStart=segmentInfo.cues[segmentInfo.cues.length-1].startTime;playlist.syncInfo={mediaSequence:playlist.mediaSequence+segmentInfo.mediaIndex,time:Math.min(firstStart,lastStart-segment.duration)}}}else segment.empty=!0}}]),VTTSegmentLoader}();exports.default=VTTSegmentLoader,module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./bin-utils":2,"./segment-loader":15,"global/window":31,"videojs-contrib-media-sources/es5/remove-cues-from-track.js":72}],20:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _videoJs="undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null,_videoJs2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_videoJs);exports.default=function(){return function XhrFunction(options,callback){options=(0,_videoJs.mergeOptions)({timeout:45e3},options);var beforeRequest=XhrFunction.beforeRequest||_videoJs2.default.Hls.xhr.beforeRequest;if(beforeRequest&&"function"==typeof beforeRequest){var newOptions=beforeRequest(options);newOptions&&(options=newOptions)}var request=(0,_videoJs.xhr)(options,function(error,response){var reqResponse=request.response;!error&&reqResponse&&(request.responseTime=Date.now(),request.roundTripTime=request.responseTime-request.requestTime,request.bytesReceived=reqResponse.byteLength||reqResponse.length,request.bandwidth||(request.bandwidth=Math.floor(request.bytesReceived/request.roundTripTime*8*1e3))),error&&"ETIMEDOUT"===error.code&&(request.timedout=!0),error||request.aborted||200===response.statusCode||206===response.statusCode||0===response.statusCode||(error=new Error("XHR Failed with a response of: "+(request&&(reqResponse||request.responseText)))),callback(error,request)}),originalAbort=request.abort;return request.abort=function(){return request.aborted=!0,originalAbort.apply(request,arguments)},request.uri=options.uri,request.requestTime=Date.now(),request}},module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],21:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),precompute=function(){var tables=[[[],[],[],[],[]],[[],[],[],[],[]]],encTable=tables[0],decTable=tables[1],sbox=encTable[4],sboxInv=decTable[4],i=void 0,x=void 0,xInv=void 0,d=[],th=[],x2=void 0,x4=void 0,s=void 0,tEnc=void 0,tDec=void 0;for(i=0;i<256;i++)th[(d[i]=i<<1^283*(i>>7))^i]=i;for(x=xInv=0;!sbox[x];x^=x2||1,xInv=th[xInv]||1)for(s=(s=xInv^xInv<<1^xInv<<2^xInv<<3^xInv<<4)>>8^255&s^99,sbox[x]=s,sboxInv[s]=x,tDec=16843009*d[x4=d[x2=d[x]]]^65537*x4^257*x2^16843008*x,tEnc=257*d[s]^16843008*s,i=0;i<4;i++)encTable[i][x]=tEnc=tEnc<<24^tEnc>>>8,decTable[i][s]=tDec=tDec<<24^tDec>>>8;for(i=0;i<5;i++)encTable[i]=encTable[i].slice(0),decTable[i]=decTable[i].slice(0);return tables},aesTables=null,AES=function(){function AES(key){_classCallCheck(this,AES),aesTables||(aesTables=precompute()),this._tables=[[aesTables[0][0].slice(),aesTables[0][1].slice(),aesTables[0][2].slice(),aesTables[0][3].slice(),aesTables[0][4].slice()],[aesTables[1][0].slice(),aesTables[1][1].slice(),aesTables[1][2].slice(),aesTables[1][3].slice(),aesTables[1][4].slice()]];var i=void 0,j=void 0,tmp=void 0,encKey=void 0,decKey=void 0,sbox=this._tables[0][4],decTable=this._tables[1],keyLen=key.length,rcon=1;if(4!==keyLen&&6!==keyLen&&8!==keyLen)throw new Error("Invalid aes key size");for(encKey=key.slice(0),decKey=[],this._key=[encKey,decKey],i=keyLen;i<4*keyLen+28;i++)tmp=encKey[i-1],(i%keyLen==0||8===keyLen&&i%keyLen==4)&&(tmp=sbox[tmp>>>24]<<24^sbox[tmp>>16&255]<<16^sbox[tmp>>8&255]<<8^sbox[255&tmp],i%keyLen==0&&(tmp=tmp<<8^tmp>>>24^rcon<<24,rcon=rcon<<1^283*(rcon>>7))),encKey[i]=encKey[i-keyLen]^tmp;for(j=0;i;j++,i--)tmp=encKey[3&j?i:i-4],decKey[j]=i<=4||j<4?tmp:decTable[0][sbox[tmp>>>24]]^decTable[1][sbox[tmp>>16&255]]^decTable[2][sbox[tmp>>8&255]]^decTable[3][sbox[255&tmp]]}return _createClass(AES,[{key:"decrypt",value:function(encrypted0,encrypted1,encrypted2,encrypted3,out,offset){var key=this._key[1],a=encrypted0^key[0],b=encrypted3^key[1],c=encrypted2^key[2],d=encrypted1^key[3],a2=void 0,b2=void 0,c2=void 0,nInnerRounds=key.length/4-2,i=void 0,kIndex=4,table=this._tables[1],table0=table[0],table1=table[1],table2=table[2],table3=table[3],sbox=table[4];for(i=0;i<nInnerRounds;i++)a2=table0[a>>>24]^table1[b>>16&255]^table2[c>>8&255]^table3[255&d]^key[kIndex],b2=table0[b>>>24]^table1[c>>16&255]^table2[d>>8&255]^table3[255&a]^key[kIndex+1],c2=table0[c>>>24]^table1[d>>16&255]^table2[a>>8&255]^table3[255&b]^key[kIndex+2],d=table0[d>>>24]^table1[a>>16&255]^table2[b>>8&255]^table3[255&c]^key[kIndex+3],kIndex+=4,a=a2,b=b2,c=c2;for(i=0;i<4;i++)out[(3&-i)+offset]=sbox[a>>>24]<<24^sbox[b>>16&255]<<16^sbox[c>>8&255]<<8^sbox[255&d]^key[kIndex++],a2=a,a=b,b=c,c=d,d=a2}}]),AES}();exports.default=AES,module.exports=exports.default},{}],22:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x,_x2,_x3){for(var _again=!0;_again;){var object=_x,property=_x2,receiver=_x3;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x=parent,_x2=property,_x3=receiver,_again=!0,desc=parent=void 0}},_stream2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("./stream")),AsyncStream=function(_Stream){function AsyncStream(){_classCallCheck(this,AsyncStream),_get(Object.getPrototypeOf(AsyncStream.prototype),"constructor",this).call(this,_stream2.default),this.jobs=[],this.delay=1,this.timeout_=null}return _inherits(AsyncStream,_stream2["default"]),_createClass(AsyncStream,[{key:"processJob_",value:function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}},{key:"push",value:function(job){this.jobs.push(job),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}]),AsyncStream}();exports.default=AsyncStream,module.exports=exports.default},{"./stream":25}],23:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_aes2=_interopRequireDefault(require("./aes")),_asyncStream2=_interopRequireDefault(require("./async-stream")),_pkcs7=require("pkcs7"),ntoh=function(word){return word<<24|(65280&word)<<8|(16711680&word)>>8|word>>>24},decrypt=function(encrypted,key,initVector){var encrypted32=new Int32Array(encrypted.buffer,encrypted.byteOffset,encrypted.byteLength>>2),decipher=new _aes2.default(Array.prototype.slice.call(key)),decrypted=new Uint8Array(encrypted.byteLength),decrypted32=new Int32Array(decrypted.buffer),init0=void 0,init1=void 0,init2=void 0,init3=void 0,encrypted0=void 0,encrypted1=void 0,encrypted2=void 0,encrypted3=void 0,wordIx=void 0;for(init0=initVector[0],init1=initVector[1],init2=initVector[2],init3=initVector[3],wordIx=0;wordIx<encrypted32.length;wordIx+=4)encrypted0=ntoh(encrypted32[wordIx]),encrypted1=ntoh(encrypted32[wordIx+1]),encrypted2=ntoh(encrypted32[wordIx+2]),encrypted3=ntoh(encrypted32[wordIx+3]),decipher.decrypt(encrypted0,encrypted1,encrypted2,encrypted3,decrypted32,wordIx),decrypted32[wordIx]=ntoh(decrypted32[wordIx]^init0),decrypted32[wordIx+1]=ntoh(decrypted32[wordIx+1]^init1),decrypted32[wordIx+2]=ntoh(decrypted32[wordIx+2]^init2),decrypted32[wordIx+3]=ntoh(decrypted32[wordIx+3]^init3),init0=encrypted0,init1=encrypted1,init2=encrypted2,init3=encrypted3;return decrypted};exports.decrypt=decrypt;var Decrypter=function(){function Decrypter(encrypted,key,initVector,done){_classCallCheck(this,Decrypter);var step=Decrypter.STEP,encrypted32=new Int32Array(encrypted.buffer),decrypted=new Uint8Array(encrypted.byteLength),i=0;for(this.asyncStream_=new _asyncStream2.default,this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i,i+step),key,initVector,decrypted)),i=step;i<encrypted32.length;i+=step)initVector=new Uint32Array([ntoh(encrypted32[i-4]),ntoh(encrypted32[i-3]),ntoh(encrypted32[i-2]),ntoh(encrypted32[i-1])]),this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i,i+step),key,initVector,decrypted));this.asyncStream_.push(function(){done(null,(0,_pkcs7.unpad)(decrypted))})}return _createClass(Decrypter,[{key:"decryptChunk_",value:function(encrypted,key,initVector,decrypted){return function(){var bytes=decrypt(encrypted,key,initVector);decrypted.set(bytes,encrypted.byteOffset)}}}],[{key:"STEP",get:function(){return 32e3}}]),Decrypter}();exports.Decrypter=Decrypter,exports.default={Decrypter:Decrypter,decrypt:decrypt}},{"./aes":21,"./async-stream":22,pkcs7:27}],24:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _decrypter=require("./decrypter"),_asyncStream2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("./async-stream"));exports.default={decrypt:_decrypter.decrypt,Decrypter:_decrypter.Decrypter,AsyncStream:_asyncStream2.default},module.exports=exports.default},{"./async-stream":22,"./decrypter":23}],25:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),Stream=function(){function Stream(){_classCallCheck(this,Stream),this.listeners={}}return _createClass(Stream,[{key:"on",value:function(type,listener){this.listeners[type]||(this.listeners[type]=[]),this.listeners[type].push(listener)}},{key:"off",value:function(type,listener){var index=void 0;return!!this.listeners[type]&&(index=this.listeners[type].indexOf(listener),this.listeners[type].splice(index,1),index>-1)}},{key:"trigger",value:function(type){var callbacks=void 0,i=void 0,length=void 0,args=void 0;if(callbacks=this.listeners[type])if(2===arguments.length)for(length=callbacks.length,i=0;i<length;++i)callbacks[i].call(this,arguments[1]);else for(args=Array.prototype.slice.call(arguments,1),length=callbacks.length,i=0;i<length;++i)callbacks[i].apply(this,args)}},{key:"dispose",value:function(){this.listeners={}}},{key:"pipe",value:function(destination){this.on("data",function(data){destination.push(data)})}}]),Stream}();exports.default=Stream,module.exports=exports.default},{}],26:[function(require,module,exports){"use strict";var PADDING;module.exports=function(plaintext){var padding=PADDING[plaintext.byteLength%16||0],result=new Uint8Array(plaintext.byteLength+padding.length);return result.set(plaintext),result.set(padding,plaintext.byteLength),result},PADDING=[[16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16],[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15],[14,14,14,14,14,14,14,14,14,14,14,14,14,14],[13,13,13,13,13,13,13,13,13,13,13,13,13],[12,12,12,12,12,12,12,12,12,12,12,12],[11,11,11,11,11,11,11,11,11,11,11],[10,10,10,10,10,10,10,10,10,10],[9,9,9,9,9,9,9,9,9],[8,8,8,8,8,8,8,8],[7,7,7,7,7,7,7],[6,6,6,6,6,6],[5,5,5,5,5],[4,4,4,4],[3,3,3],[2,2],[1]]},{}],27:[function(require,module,exports){"use strict";exports.pad=require("./pad.js"),exports.unpad=require("./unpad.js")},{"./pad.js":26,"./unpad.js":28}],28:[function(require,module,exports){"use strict";module.exports=function(padded){return padded.subarray(0,padded.byteLength-padded[padded.byteLength-1])}},{}],29:[function(require,module,exports){},{}],30:[function(require,module,exports){(function(global){var doccy,topLevel=void 0!==global?global:"undefined"!=typeof window?window:{},minDoc=require("min-document");"undefined"!=typeof document?doccy=document:(doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"])||(doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"]=minDoc),module.exports=doccy}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":29}],31:[function(require,module,exports){(function(global){var win;win="undefined"!=typeof window?window:void 0!==global?global:"undefined"!=typeof self?self:{},module.exports=win}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],32:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _lineStream2=_interopRequireDefault(require("./line-stream")),_parseStream2=_interopRequireDefault(require("./parse-stream")),_parser2=_interopRequireDefault(require("./parser"));module.exports={LineStream:_lineStream2.default,ParseStream:_parseStream2.default,Parser:_parser2.default}},{"./line-stream":33,"./parse-stream":34,"./parser":35}],33:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_stream2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("./stream")),LineStream=function(_Stream){function LineStream(){_classCallCheck(this,LineStream);var _this=_possibleConstructorReturn(this,(LineStream.__proto__||Object.getPrototypeOf(LineStream)).call(this));return _this.buffer="",_this}return _inherits(LineStream,_stream2["default"]),_createClass(LineStream,[{key:"push",value:function(data){var nextNewline=void 0;for(this.buffer+=data,nextNewline=this.buffer.indexOf("\n");nextNewline>-1;nextNewline=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,nextNewline)),this.buffer=this.buffer.substring(nextNewline+1)}}]),LineStream}();exports.default=LineStream},{"./stream":36}],34:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i.return&&_i.return()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_stream2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(require("./stream")),attributeSeparator=function(){return new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')},parseAttributes=function(attributes){for(var attrs=attributes.split(attributeSeparator()),result={},i=attrs.length,attr=void 0;i--;)""!==attrs[i]&&((attr=/([^=]*)=(.*)/.exec(attrs[i]).slice(1))[0]=attr[0].replace(/^\s+|\s+$/g,""),attr[1]=attr[1].replace(/^\s+|\s+$/g,""),attr[1]=attr[1].replace(/^['"](.*)['"]$/g,"$1"),result[attr[0]]=attr[1]);return result},ParseStream=function(_Stream){function ParseStream(){return _classCallCheck(this,ParseStream),_possibleConstructorReturn(this,(ParseStream.__proto__||Object.getPrototypeOf(ParseStream)).call(this))}return _inherits(ParseStream,_stream2["default"]),_createClass(ParseStream,[{key:"push",value:function(line){var match=void 0,event=void 0;if(0!==(line=line.replace(/^[\u0000\s]+|[\u0000\s]+$/g,"")).length)if("#"===line[0])if(0===line.indexOf("#EXT"))if(line=line.replace("\r",""),match=/^#EXTM3U/.exec(line))this.trigger("data",{type:"tag",tagType:"m3u"});else{if(match=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(line))return event={type:"tag",tagType:"inf"},match[1]&&(event.duration=parseFloat(match[1])),match[2]&&(event.title=match[2]),void this.trigger("data",event);if(match=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(line))return event={type:"tag",tagType:"targetduration"},match[1]&&(event.duration=parseInt(match[1],10)),void this.trigger("data",event);if(match=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(line))return event={type:"tag",tagType:"totalduration"},match[1]&&(event.duration=parseInt(match[1],10)),void this.trigger("data",event);if(match=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(line))return event={type:"tag",tagType:"version"},match[1]&&(event.version=parseInt(match[1],10)),void this.trigger("data",event);if(match=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(line))return event={type:"tag",tagType:"media-sequence"},match[1]&&(event.number=parseInt(match[1],10)),void this.trigger("data",event);if(match=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(line))return event={type:"tag",tagType:"discontinuity-sequence"},match[1]&&(event.number=parseInt(match[1],10)),void this.trigger("data",event);if(match=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(line))return event={type:"tag",tagType:"playlist-type"},match[1]&&(event.playlistType=match[1]),void this.trigger("data",event);if(match=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(line))return event={type:"tag",tagType:"byterange"},match[1]&&(event.length=parseInt(match[1],10)),match[2]&&(event.offset=parseInt(match[2],10)),void this.trigger("data",event);if(match=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(line))return event={type:"tag",tagType:"allow-cache"},match[1]&&(event.allowed=!/NO/.test(match[1])),void this.trigger("data",event);if(match=/^#EXT-X-MAP:?(.*)$/.exec(line)){if(event={type:"tag",tagType:"map"},match[1]){var attributes=parseAttributes(match[1]);if(attributes.URI&&(event.uri=attributes.URI),attributes.BYTERANGE){var _attributes$BYTERANGE=attributes.BYTERANGE.split("@"),_attributes$BYTERANGE2=_slicedToArray(_attributes$BYTERANGE,2),length=_attributes$BYTERANGE2[0],offset=_attributes$BYTERANGE2[1];event.byterange={},length&&(event.byterange.length=parseInt(length,10)),offset&&(event.byterange.offset=parseInt(offset,10))}}this.trigger("data",event)}else if(match=/^#EXT-X-STREAM-INF:?(.*)$/.exec(line)){if(event={type:"tag",tagType:"stream-inf"},match[1]){if(event.attributes=parseAttributes(match[1]),event.attributes.RESOLUTION){var split=event.attributes.RESOLUTION.split("x"),resolution={};split[0]&&(resolution.width=parseInt(split[0],10)),split[1]&&(resolution.height=parseInt(split[1],10)),event.attributes.RESOLUTION=resolution}event.attributes.BANDWIDTH&&(event.attributes.BANDWIDTH=parseInt(event.attributes.BANDWIDTH,10)),event.attributes["PROGRAM-ID"]&&(event.attributes["PROGRAM-ID"]=parseInt(event.attributes["PROGRAM-ID"],10))}this.trigger("data",event)}else{if(match=/^#EXT-X-MEDIA:?(.*)$/.exec(line))return event={type:"tag",tagType:"media"},match[1]&&(event.attributes=parseAttributes(match[1])),void this.trigger("data",event);if(match=/^#EXT-X-ENDLIST/.exec(line))this.trigger("data",{type:"tag",tagType:"endlist"});else if(match=/^#EXT-X-DISCONTINUITY/.exec(line))this.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(match=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(line))return event={type:"tag",tagType:"program-date-time"},match[1]&&(event.dateTimeString=match[1],event.dateTimeObject=new Date(match[1])),void this.trigger("data",event);if(match=/^#EXT-X-KEY:?(.*)$/.exec(line))return event={type:"tag",tagType:"key"},match[1]&&(event.attributes=parseAttributes(match[1]),event.attributes.IV&&("0x"===event.attributes.IV.substring(0,2).toLowerCase()&&(event.attributes.IV=event.attributes.IV.substring(2)),event.attributes.IV=event.attributes.IV.match(/.{8}/g),event.attributes.IV[0]=parseInt(event.attributes.IV[0],16),event.attributes.IV[1]=parseInt(event.attributes.IV[1],16),event.attributes.IV[2]=parseInt(event.attributes.IV[2],16),event.attributes.IV[3]=parseInt(event.attributes.IV[3],16),event.attributes.IV=new Uint32Array(event.attributes.IV))),void this.trigger("data",event);if(match=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(line))return event={type:"tag",tagType:"cue-out-cont"},match[1]?event.data=match[1]:event.data="",void this.trigger("data",event);if(match=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(line))return event={type:"tag",tagType:"cue-out"},match[1]?event.data=match[1]:event.data="",void this.trigger("data",event);if(match=/^#EXT-X-CUE-IN:?(.*)?$/.exec(line))return event={type:"tag",tagType:"cue-in"},match[1]?event.data=match[1]:event.data="",void this.trigger("data",event);this.trigger("data",{type:"tag",data:line.slice(4)})}}}else this.trigger("data",{type:"comment",text:line.slice(1)});else this.trigger("data",{type:"uri",uri:line})}}]),ParseStream}();exports.default=ParseStream},{"./stream":36}],35:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_stream2=_interopRequireDefault(require("./stream")),_lineStream2=_interopRequireDefault(require("./line-stream")),_parseStream2=_interopRequireDefault(require("./parse-stream")),Parser=function(_Stream){function Parser(){_classCallCheck(this,Parser);var _this=_possibleConstructorReturn(this,(Parser.__proto__||Object.getPrototypeOf(Parser)).call(this));_this.lineStream=new _lineStream2.default,_this.parseStream=new _parseStream2.default,_this.lineStream.pipe(_this.parseStream);var self=_this,uris=[],currentUri={},currentMap=void 0,_key=void 0,noop=function(){},defaultMediaGroups={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},currentTimeline=0;return _this.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},_this.parseStream.on("data",function(entry){var mediaGroup=void 0,rendition=void 0;({tag:function(){(({"allow-cache":function(){this.manifest.allowCache=entry.allowed,"allowed"in entry||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var byterange={};"length"in entry&&(currentUri.byterange=byterange,byterange.length=entry.length,"offset"in entry||(this.trigger("info",{message:"defaulting offset to zero"}),entry.offset=0)),"offset"in entry&&(currentUri.byterange=byterange,byterange.offset=entry.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),entry.duration>0&&(currentUri.duration=entry.duration),0===entry.duration&&(currentUri.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=uris},key:function(){entry.attributes?"NONE"!==entry.attributes.METHOD?entry.attributes.URI?(entry.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),_key={method:entry.attributes.METHOD||"AES-128",uri:entry.attributes.URI},void 0!==entry.attributes.IV&&(_key.iv=entry.attributes.IV)):this.trigger("warn",{message:"ignoring key declaration without URI"}):_key=null:this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(entry.number)?this.manifest.mediaSequence=entry.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+entry.number})},"discontinuity-sequence":function(){isFinite(entry.number)?(this.manifest.discontinuitySequence=entry.number,currentTimeline=entry.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+entry.number})},"playlist-type":function(){/VOD|EVENT/.test(entry.playlistType)?this.manifest.playlistType=entry.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+entry.playlist})},map:function(){currentMap={},entry.uri&&(currentMap.uri=entry.uri),entry.byterange&&(currentMap.byterange=entry.byterange)},"stream-inf":function(){this.manifest.playlists=uris,this.manifest.mediaGroups=this.manifest.mediaGroups||defaultMediaGroups,entry.attributes?(currentUri.attributes||(currentUri.attributes={}),_extends(currentUri.attributes,entry.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||defaultMediaGroups,entry.attributes&&entry.attributes.TYPE&&entry.attributes["GROUP-ID"]&&entry.attributes.NAME){var mediaGroupType=this.manifest.mediaGroups[entry.attributes.TYPE];mediaGroupType[entry.attributes["GROUP-ID"]]=mediaGroupType[entry.attributes["GROUP-ID"]]||{},mediaGroup=mediaGroupType[entry.attributes["GROUP-ID"]],(rendition={default:/yes/i.test(entry.attributes.DEFAULT)}).default?rendition.autoselect=!0:rendition.autoselect=/yes/i.test(entry.attributes.AUTOSELECT),entry.attributes.LANGUAGE&&(rendition.language=entry.attributes.LANGUAGE),entry.attributes.URI&&(rendition.uri=entry.attributes.URI),entry.attributes["INSTREAM-ID"]&&(rendition.instreamId=entry.attributes["INSTREAM-ID"]),entry.attributes.CHARACTERISTICS&&(rendition.characteristics=entry.attributes.CHARACTERISTICS),entry.attributes.FORCED&&(rendition.forced=/yes/i.test(entry.attributes.FORCED)),mediaGroup[entry.attributes.NAME]=rendition}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){currentTimeline+=1,currentUri.discontinuity=!0,this.manifest.discontinuityStarts.push(uris.length)},"program-date-time":function(){this.manifest.dateTimeString=entry.dateTimeString,this.manifest.dateTimeObject=entry.dateTimeObject},targetduration:function(){!isFinite(entry.duration)||entry.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+entry.duration}):this.manifest.targetDuration=entry.duration},totalduration:function(){!isFinite(entry.duration)||entry.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+entry.duration}):this.manifest.totalDuration=entry.duration},"cue-out":function(){currentUri.cueOut=entry.data},"cue-out-cont":function(){currentUri.cueOutCont=entry.data},"cue-in":function(){currentUri.cueIn=entry.data}})[entry.tagType]||noop).call(self)},uri:function(){currentUri.uri=entry.uri,uris.push(currentUri),!this.manifest.targetDuration||"duration"in currentUri||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),currentUri.duration=this.manifest.targetDuration),_key&&(currentUri.key=_key),currentUri.timeline=currentTimeline,currentMap&&(currentUri.map=currentMap),currentUri={}},comment:function(){}})[entry.type].call(self)}),_this}return _inherits(Parser,_stream2["default"]),_createClass(Parser,[{key:"push",value:function(chunk){this.lineStream.push(chunk)}},{key:"end",value:function(){this.lineStream.push("\n")}}]),Parser}();exports.default=Parser},{"./line-stream":33,"./parse-stream":34,"./stream":36}],36:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),Stream=function(){function Stream(){_classCallCheck(this,Stream),this.listeners={}}return _createClass(Stream,[{key:"on",value:function(type,listener){this.listeners[type]||(this.listeners[type]=[]),this.listeners[type].push(listener)}},{key:"off",value:function(type,listener){if(!this.listeners[type])return!1;var index=this.listeners[type].indexOf(listener);return this.listeners[type].splice(index,1),index>-1}},{key:"trigger",value:function(type){var callbacks=this.listeners[type],i=void 0,length=void 0,args=void 0;if(callbacks)if(2===arguments.length)for(length=callbacks.length,i=0;i<length;++i)callbacks[i].call(this,arguments[1]);else for(args=Array.prototype.slice.call(arguments,1),length=callbacks.length,i=0;i<length;++i)callbacks[i].apply(this,args)}},{key:"dispose",value:function(){this.listeners={}}},{key:"pipe",value:function(destination){this.on("data",function(data){destination.push(data)})}}]),Stream}();exports.default=Stream},{}],37:[function(require,module,exports){"use strict";var AacStream,Stream=require("../utils/stream.js");(AacStream=function(){var everything=new Uint8Array,timeStamp=0;AacStream.prototype.init.call(this),this.setTimestamp=function(timestamp){timeStamp=timestamp},this.parseId3TagSize=function(header,byteIndex){var returnSize=header[byteIndex+6]<<21|header[byteIndex+7]<<14|header[byteIndex+8]<<7|header[byteIndex+9];return(16&header[byteIndex+5])>>4?returnSize+20:returnSize+10},this.parseAdtsSize=function(header,byteIndex){var lowThree=(224&header[byteIndex+5])>>5,middle=header[byteIndex+4]<<3;return 6144&header[byteIndex+3]|middle|lowThree},this.push=function(bytes){var bytesLeft,chunk,packet,tempLength,frameSize=0,byteIndex=0;for(everything.length?(tempLength=everything.length,(everything=new Uint8Array(bytes.byteLength+tempLength)).set(everything.subarray(0,tempLength)),everything.set(bytes,tempLength)):everything=bytes;everything.length-byteIndex>=3;)if(everything[byteIndex]!=="I".charCodeAt(0)||everything[byteIndex+1]!=="D".charCodeAt(0)||everything[byteIndex+2]!=="3".charCodeAt(0))if(!0&everything[byteIndex]&&240==(240&everything[byteIndex+1])){if(everything.length-byteIndex<7)break;if((frameSize=this.parseAdtsSize(everything,byteIndex))>everything.length)break;packet={type:"audio",data:everything.subarray(byteIndex,byteIndex+frameSize),pts:timeStamp,dts:timeStamp},this.trigger("data",packet),byteIndex+=frameSize}else byteIndex++;else{if(everything.length-byteIndex<10)break;if((frameSize=this.parseId3TagSize(everything,byteIndex))>everything.length)break;chunk={type:"timed-metadata",data:everything.subarray(byteIndex,byteIndex+frameSize)},this.trigger("data",chunk),byteIndex+=frameSize}bytesLeft=everything.length-byteIndex,everything=bytesLeft>0?everything.subarray(byteIndex):new Uint8Array}}).prototype=new Stream,module.exports=AacStream},{"../utils/stream.js":61}],38:[function(require,module,exports){"use strict";var ADTS_SAMPLING_FREQUENCIES=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],parseSyncSafeInteger=function(data){return data[0]<<21|data[1]<<14|data[2]<<7|data[3]},percentEncode=function(bytes,start,end){var i,result="";for(i=start;i<end;i++)result+="%"+("00"+bytes[i].toString(16)).slice(-2);return result},parseIso88591=function(bytes,start,end){return unescape(percentEncode(bytes,start,end))};module.exports={parseId3TagSize:function(header,byteIndex){var returnSize=header[byteIndex+6]<<21|header[byteIndex+7]<<14|header[byteIndex+8]<<7|header[byteIndex+9];return(16&header[byteIndex+5])>>4?returnSize+20:returnSize+10},parseAdtsSize:function(header,byteIndex){var lowThree=(224&header[byteIndex+5])>>5,middle=header[byteIndex+4]<<3;return 6144&header[byteIndex+3]|middle|lowThree},parseType:function(header,byteIndex){return header[byteIndex]==="I".charCodeAt(0)&&header[byteIndex+1]==="D".charCodeAt(0)&&header[byteIndex+2]==="3".charCodeAt(0)?"timed-metadata":!0&header[byteIndex]&&240==(240&header[byteIndex+1])?"audio":null},parseSampleRate:function(packet){for(var i=0;i+5<packet.length;){if(255===packet[i]&&240==(246&packet[i+1]))return ADTS_SAMPLING_FREQUENCIES[(60&packet[i+2])>>>2];i++}return null},parseAacTimestamp:function(packet){var frameStart,frameSize,frame;frameStart=10,64&packet[5]&&(frameStart+=4,frameStart+=parseSyncSafeInteger(packet.subarray(10,14)));do{if((frameSize=parseSyncSafeInteger(packet.subarray(frameStart+4,frameStart+8)))<1)return null;if("PRIV"===String.fromCharCode(packet[frameStart],packet[frameStart+1],packet[frameStart+2],packet[frameStart+3])){frame=packet.subarray(frameStart+10,frameStart+frameSize+10);for(var i=0;i<frame.byteLength;i++)if(0===frame[i]){if("com.apple.streaming.transportStreamTimestamp"===parseIso88591(frame,0,i)){var d=frame.subarray(i+1),size=(1&d[3])<<30|d[4]<<22|d[5]<<14|d[6]<<6|d[7]>>>2;return size*=4,size+=3&d[7]}break}}frameStart+=10,frameStart+=frameSize}while(frameStart<packet.byteLength);return null}}},{}],39:[function(require,module,exports){"use strict";var AdtsStream,Stream=require("../utils/stream.js"),ADTS_SAMPLING_FREQUENCIES=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(AdtsStream=function(){var buffer;AdtsStream.prototype.init.call(this),this.push=function(packet){var frameLength,protectionSkipBytes,frameEnd,oldBuffer,sampleCount,adtsFrameDuration,i=0,frameNum=0;if("audio"===packet.type)for(buffer?(oldBuffer=buffer,(buffer=new Uint8Array(oldBuffer.byteLength+packet.data.byteLength)).set(oldBuffer),buffer.set(packet.data,oldBuffer.byteLength)):buffer=packet.data;i+5<buffer.length;)if(255===buffer[i]&&240==(246&buffer[i+1])){if(protectionSkipBytes=2*(1&~buffer[i+1]),frameLength=(3&buffer[i+3])<<11|buffer[i+4]<<3|(224&buffer[i+5])>>5,sampleCount=1024*(1+(3&buffer[i+6])),adtsFrameDuration=9e4*sampleCount/ADTS_SAMPLING_FREQUENCIES[(60&buffer[i+2])>>>2],frameEnd=i+frameLength,buffer.byteLength<frameEnd)return;if(this.trigger("data",{pts:packet.pts+frameNum*adtsFrameDuration,dts:packet.dts+frameNum*adtsFrameDuration,sampleCount:sampleCount,audioobjecttype:1+(buffer[i+2]>>>6&3),channelcount:(1&buffer[i+2])<<2|(192&buffer[i+3])>>>6,samplerate:ADTS_SAMPLING_FREQUENCIES[(60&buffer[i+2])>>>2],samplingfrequencyindex:(60&buffer[i+2])>>>2,samplesize:16,data:buffer.subarray(i+7+protectionSkipBytes,frameEnd)}),buffer.byteLength===frameEnd)return void(buffer=void 0);frameNum++,buffer=buffer.subarray(frameEnd)}else i++},this.flush=function(){this.trigger("done")}}).prototype=new Stream,module.exports=AdtsStream},{"../utils/stream.js":61}],40:[function(require,module,exports){"use strict";var H264Stream,NalByteStream,PROFILES_WITH_OPTIONAL_SPS_DATA,Stream=require("../utils/stream.js"),ExpGolomb=require("../utils/exp-golomb.js");(NalByteStream=function(){var i,buffer,syncPoint=0;NalByteStream.prototype.init.call(this),this.push=function(data){var swapBuffer;for(buffer?((swapBuffer=new Uint8Array(buffer.byteLength+data.data.byteLength)).set(buffer),swapBuffer.set(data.data,buffer.byteLength),buffer=swapBuffer):buffer=data.data;syncPoint<buffer.byteLength-3;syncPoint++)if(1===buffer[syncPoint+2]){i=syncPoint+5;break}for(;i<buffer.byteLength;)switch(buffer[i]){case 0:if(0!==buffer[i-1]){i+=2;break}if(0!==buffer[i-2]){i++;break}syncPoint+3!==i-2&&this.trigger("data",buffer.subarray(syncPoint+3,i-2));do{i++}while(1!==buffer[i]&&i<buffer.length);syncPoint=i-2,i+=3;break;case 1:if(0!==buffer[i-1]||0!==buffer[i-2]){i+=3;break}this.trigger("data",buffer.subarray(syncPoint+3,i-2)),syncPoint=i-2,i+=3;break;default:i+=3}buffer=buffer.subarray(syncPoint),i-=syncPoint,syncPoint=0},this.flush=function(){buffer&&buffer.byteLength>3&&this.trigger("data",buffer.subarray(syncPoint+3)),buffer=null,syncPoint=0,this.trigger("done")}}).prototype=new Stream,PROFILES_WITH_OPTIONAL_SPS_DATA={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(H264Stream=function(){var self,trackId,currentPts,currentDts,discardEmulationPreventionBytes,readSequenceParameterSet,skipScalingList,nalByteStream=new NalByteStream;H264Stream.prototype.init.call(this),self=this,this.push=function(packet){"video"===packet.type&&(trackId=packet.trackId,currentPts=packet.pts,currentDts=packet.dts,nalByteStream.push(packet))},nalByteStream.on("data",function(data){var event={trackId:trackId,pts:currentPts,dts:currentDts,data:data};switch(31&data[0]){case 5:event.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:event.nalUnitType="sei_rbsp",event.escapedRBSP=discardEmulationPreventionBytes(data.subarray(1));break;case 7:event.nalUnitType="seq_parameter_set_rbsp",event.escapedRBSP=discardEmulationPreventionBytes(data.subarray(1)),event.config=readSequenceParameterSet(event.escapedRBSP);break;case 8:event.nalUnitType="pic_parameter_set_rbsp";break;case 9:event.nalUnitType="access_unit_delimiter_rbsp"}self.trigger("data",event)}),nalByteStream.on("done",function(){self.trigger("done")}),this.flush=function(){nalByteStream.flush()},skipScalingList=function(count,expGolombDecoder){var j,lastScale=8,nextScale=8;for(j=0;j<count;j++)0!==nextScale&&(nextScale=(lastScale+expGolombDecoder.readExpGolomb()+256)%256),lastScale=0===nextScale?lastScale:nextScale},discardEmulationPreventionBytes=function(data){for(var newLength,newData,length=data.byteLength,emulationPreventionBytesPositions=[],i=1;i<length-2;)0===data[i]&&0===data[i+1]&&3===data[i+2]?(emulationPreventionBytesPositions.push(i+2),i+=2):i++;if(0===emulationPreventionBytesPositions.length)return data;newLength=length-emulationPreventionBytesPositions.length,newData=new Uint8Array(newLength);var sourceIndex=0;for(i=0;i<newLength;sourceIndex++,i++)sourceIndex===emulationPreventionBytesPositions[0]&&(sourceIndex++,emulationPreventionBytesPositions.shift()),newData[i]=data[sourceIndex];return newData},readSequenceParameterSet=function(data){var expGolombDecoder,profileIdc,levelIdc,profileCompatibility,chromaFormatIdc,picOrderCntType,numRefFramesInPicOrderCntCycle,picWidthInMbsMinus1,picHeightInMapUnitsMinus1,frameMbsOnlyFlag,scalingListCount,sarRatio,i,frameCropLeftOffset=0,frameCropRightOffset=0,frameCropTopOffset=0,frameCropBottomOffset=0,sarScale=1;if(expGolombDecoder=new ExpGolomb(data),profileIdc=expGolombDecoder.readUnsignedByte(),profileCompatibility=expGolombDecoder.readUnsignedByte(),levelIdc=expGolombDecoder.readUnsignedByte(),expGolombDecoder.skipUnsignedExpGolomb(),PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]&&(3===(chromaFormatIdc=expGolombDecoder.readUnsignedExpGolomb())&&expGolombDecoder.skipBits(1),expGolombDecoder.skipUnsignedExpGolomb(),expGolombDecoder.skipUnsignedExpGolomb(),expGolombDecoder.skipBits(1),expGolombDecoder.readBoolean()))for(scalingListCount=3!==chromaFormatIdc?8:12,i=0;i<scalingListCount;i++)expGolombDecoder.readBoolean()&&(i<6?skipScalingList(16,expGolombDecoder):skipScalingList(64,expGolombDecoder));if(expGolombDecoder.skipUnsignedExpGolomb(),0===(picOrderCntType=expGolombDecoder.readUnsignedExpGolomb()))expGolombDecoder.readUnsignedExpGolomb();else if(1===picOrderCntType)for(expGolombDecoder.skipBits(1),expGolombDecoder.skipExpGolomb(),expGolombDecoder.skipExpGolomb(),numRefFramesInPicOrderCntCycle=expGolombDecoder.readUnsignedExpGolomb(),i=0;i<numRefFramesInPicOrderCntCycle;i++)expGolombDecoder.skipExpGolomb();if(expGolombDecoder.skipUnsignedExpGolomb(),expGolombDecoder.skipBits(1),picWidthInMbsMinus1=expGolombDecoder.readUnsignedExpGolomb(),picHeightInMapUnitsMinus1=expGolombDecoder.readUnsignedExpGolomb(),0===(frameMbsOnlyFlag=expGolombDecoder.readBits(1))&&expGolombDecoder.skipBits(1),expGolombDecoder.skipBits(1),expGolombDecoder.readBoolean()&&(frameCropLeftOffset=expGolombDecoder.readUnsignedExpGolomb(),frameCropRightOffset=expGolombDecoder.readUnsignedExpGolomb(),frameCropTopOffset=expGolombDecoder.readUnsignedExpGolomb(),frameCropBottomOffset=expGolombDecoder.readUnsignedExpGolomb()),expGolombDecoder.readBoolean()&&expGolombDecoder.readBoolean()){switch(expGolombDecoder.readUnsignedByte()){case 1:sarRatio=[1,1];break;case 2:sarRatio=[12,11];break;case 3:sarRatio=[10,11];break;case 4:sarRatio=[16,11];break;case 5:sarRatio=[40,33];break;case 6:sarRatio=[24,11];break;case 7:sarRatio=[20,11];break;case 8:sarRatio=[32,11];break;case 9:sarRatio=[80,33];break;case 10:sarRatio=[18,11];break;case 11:sarRatio=[15,11];break;case 12:sarRatio=[64,33];break;case 13:sarRatio=[160,99];break;case 14:sarRatio=[4,3];break;case 15:sarRatio=[3,2];break;case 16:sarRatio=[2,1];break;case 255:sarRatio=[expGolombDecoder.readUnsignedByte()<<8|expGolombDecoder.readUnsignedByte(),expGolombDecoder.readUnsignedByte()<<8|expGolombDecoder.readUnsignedByte()]}sarRatio&&(sarScale=sarRatio[0]/sarRatio[1])}return{profileIdc:profileIdc,levelIdc:levelIdc,profileCompatibility:profileCompatibility,width:Math.ceil((16*(picWidthInMbsMinus1+1)-2*frameCropLeftOffset-2*frameCropRightOffset)*sarScale),height:(2-frameMbsOnlyFlag)*(picHeightInMapUnitsMinus1+1)*16-2*frameCropTopOffset-2*frameCropBottomOffset}}}).prototype=new Stream,module.exports={H264Stream:H264Stream,NalByteStream:NalByteStream}},{"../utils/exp-golomb.js":60,"../utils/stream.js":61}],41:[function(require,module,exports){var highPrefix=[33,16,5,32,164,27],lowPrefix=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],zeroFill=function(count){for(var a=[];count--;)a.push(0);return a},coneOfSilence={96e3:[highPrefix,[227,64],zeroFill(154),[56]],88200:[highPrefix,[231],zeroFill(170),[56]],64e3:[highPrefix,[248,192],zeroFill(240),[56]],48e3:[highPrefix,[255,192],zeroFill(268),[55,148,128],zeroFill(54),[112]],44100:[highPrefix,[255,192],zeroFill(268),[55,163,128],zeroFill(84),[112]],32e3:[highPrefix,[255,192],zeroFill(268),[55,234],zeroFill(226),[112]],24e3:[highPrefix,[255,192],zeroFill(268),[55,255,128],zeroFill(268),[111,112],zeroFill(126),[224]],16e3:[highPrefix,[255,192],zeroFill(268),[55,255,128],zeroFill(268),[111,255],zeroFill(269),[223,108],zeroFill(195),[1,192]],12e3:[lowPrefix,zeroFill(268),[3,127,248],zeroFill(268),[6,255,240],zeroFill(268),[13,255,224],zeroFill(268),[27,253,128],zeroFill(259),[56]],11025:[lowPrefix,zeroFill(268),[3,127,248],zeroFill(268),[6,255,240],zeroFill(268),[13,255,224],zeroFill(268),[27,255,192],zeroFill(268),[55,175,128],zeroFill(108),[112]],8e3:[lowPrefix,zeroFill(268),[3,121,16],zeroFill(47),[7]]};module.exports=function(metaTable){return Object.keys(metaTable).reduce(function(obj,key){return obj[key]=new Uint8Array(metaTable[key].reduce(function(arr,part){return arr.concat(part)},[])),obj},{})}(coneOfSilence)},{}],42:[function(require,module,exports){"use strict";var Stream=require("../utils/stream.js"),CoalesceStream=function(options){this.numberOfTracks=0,this.metadataStream=options.metadataStream,this.videoTags=[],this.audioTags=[],this.videoTrack=null,this.audioTrack=null,this.pendingCaptions=[],this.pendingMetadata=[],this.pendingTracks=0,this.processedTracks=0,CoalesceStream.prototype.init.call(this),this.push=function(output){return output.text?this.pendingCaptions.push(output):output.frames?this.pendingMetadata.push(output):("video"===output.track.type&&(this.videoTrack=output.track,this.videoTags=output.tags,this.pendingTracks++),void("audio"===output.track.type&&(this.audioTrack=output.track,this.audioTags=output.tags,this.pendingTracks++)))}};CoalesceStream.prototype=new Stream,CoalesceStream.prototype.flush=function(flushSource){var id3,caption,i,timelineStartPts,event={tags:{},captions:[],captionStreams:{},metadata:[]};if(this.pendingTracks<this.numberOfTracks){if("VideoSegmentStream"!==flushSource&&"AudioSegmentStream"!==flushSource)return;if(0===this.pendingTracks&&++this.processedTracks<this.numberOfTracks)return}if(this.processedTracks+=this.pendingTracks,this.pendingTracks=0,!(this.processedTracks<this.numberOfTracks)){for(this.videoTrack?timelineStartPts=this.videoTrack.timelineStartInfo.pts:this.audioTrack&&(timelineStartPts=this.audioTrack.timelineStartInfo.pts),event.tags.videoTags=this.videoTags,event.tags.audioTags=this.audioTags,i=0;i<this.pendingCaptions.length;i++)(caption=this.pendingCaptions[i]).startTime=caption.startPts-timelineStartPts,caption.startTime/=9e4,caption.endTime=caption.endPts-timelineStartPts,caption.endTime/=9e4,event.captionStreams[caption.stream]=!0,event.captions.push(caption);for(i=0;i<this.pendingMetadata.length;i++)(id3=this.pendingMetadata[i]).cueTime=id3.pts-timelineStartPts,id3.cueTime/=9e4,event.metadata.push(id3);event.metadata.dispatchType=this.metadataStream.dispatchType,this.videoTrack=null,this.audioTrack=null,this.videoTags=[],this.audioTags=[],this.pendingCaptions.length=0,this.pendingMetadata.length=0,this.pendingTracks=0,this.processedTracks=0,this.trigger("data",event),this.trigger("done")}},module.exports=CoalesceStream},{"../utils/stream.js":61}],43:[function(require,module,exports){"use strict";var FlvTag=require("./flv-tag.js");module.exports=function(duration,audio,video){var metadata,result,metadataLength,headBytes=new Uint8Array(9),head=new DataView(headBytes.buffer);return duration=duration||0,audio=void 0===audio||audio,video=void 0===video||video,head.setUint8(0,70),head.setUint8(1,76),head.setUint8(2,86),head.setUint8(3,1),head.setUint8(4,(audio?4:0)|(video?1:0)),head.setUint32(5,headBytes.byteLength),duration<=0?((result=new Uint8Array(headBytes.byteLength+4)).set(headBytes),result.set([0,0,0,0],headBytes.byteLength),result):(metadata=new FlvTag(FlvTag.METADATA_TAG),metadata.pts=metadata.dts=0,metadata.writeMetaDataDouble("duration",duration),metadataLength=metadata.finalize().length,(result=new Uint8Array(headBytes.byteLength+metadataLength)).set(headBytes),result.set(head.byteLength,metadataLength),result)}},{"./flv-tag.js":44}],44:[function(require,module,exports){"use strict";var FlvTag;(FlvTag=function(type,extraData){var i,adHoc=0,bufferStartSize=16384,prepareWrite=function(flv,count){var bytes,minLength=flv.position+count;minLength<flv.bytes.byteLength||((bytes=new Uint8Array(2*minLength)).set(flv.bytes.subarray(0,flv.position),0),flv.bytes=bytes,flv.view=new DataView(flv.bytes.buffer))},widthBytes=FlvTag.widthBytes||new Uint8Array("width".length),heightBytes=FlvTag.heightBytes||new Uint8Array("height".length),videocodecidBytes=FlvTag.videocodecidBytes||new Uint8Array("videocodecid".length);if(!FlvTag.widthBytes){for(i=0;i<"width".length;i++)widthBytes[i]="width".charCodeAt(i);for(i=0;i<"height".length;i++)heightBytes[i]="height".charCodeAt(i);for(i=0;i<"videocodecid".length;i++)videocodecidBytes[i]="videocodecid".charCodeAt(i);FlvTag.widthBytes=widthBytes,FlvTag.heightBytes=heightBytes,FlvTag.videocodecidBytes=videocodecidBytes}switch(this.keyFrame=!1,type){case FlvTag.VIDEO_TAG:this.length=16,bufferStartSize*=6;break;case FlvTag.AUDIO_TAG:this.length=13,this.keyFrame=!0;break;case FlvTag.METADATA_TAG:this.length=29,this.keyFrame=!0;break;default:throw new Error("Unknown FLV tag type")}this.bytes=new Uint8Array(bufferStartSize),this.view=new DataView(this.bytes.buffer),this.bytes[0]=type,this.position=this.length,this.keyFrame=extraData,this.pts=0,this.dts=0,this.writeBytes=function(bytes,offset,length){var end,start=offset||0;end=start+(length=length||bytes.byteLength),prepareWrite(this,length),this.bytes.set(bytes.subarray(start,end),this.position),this.position+=length,this.length=Math.max(this.length,this.position)},this.writeByte=function(byte){prepareWrite(this,1),this.bytes[this.position]=byte,this.position++,this.length=Math.max(this.length,this.position)},this.writeShort=function(short){prepareWrite(this,2),this.view.setUint16(this.position,short),this.position+=2,this.length=Math.max(this.length,this.position)},this.negIndex=function(pos){return this.bytes[this.length-pos]},this.nalUnitSize=function(){return 0===adHoc?0:this.length-(adHoc+4)},this.startNalUnit=function(){if(adHoc>0)throw new Error("Attempted to create new NAL wihout closing the old one");adHoc=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(nalContainer){var nalStart,nalLength;this.length===adHoc+4?this.length-=4:adHoc>0&&(nalStart=adHoc+4,nalLength=this.length-nalStart,this.position=adHoc,this.view.setUint32(this.position,nalLength),this.position=this.length,nalContainer&&nalContainer.push(this.bytes.subarray(nalStart,nalStart+nalLength))),adHoc=0},this.writeMetaDataDouble=function(key,val){var i;if(prepareWrite(this,2+key.length+9),this.view.setUint16(this.position,key.length),this.position+=2,"width"===key)this.bytes.set(widthBytes,this.position),this.position+=5;else if("height"===key)this.bytes.set(heightBytes,this.position),this.position+=6;else if("videocodecid"===key)this.bytes.set(videocodecidBytes,this.position),this.position+=12;else for(i=0;i<key.length;i++)this.bytes[this.position]=key.charCodeAt(i),this.position++;this.position++,this.view.setFloat64(this.position,val),this.position+=8,this.length=Math.max(this.length,this.position),++adHoc},this.writeMetaDataBoolean=function(key,val){var i;for(prepareWrite(this,2),this.view.setUint16(this.position,key.length),this.position+=2,i=0;i<key.length;i++)prepareWrite(this,1),this.bytes[this.position]=key.charCodeAt(i),this.position++;prepareWrite(this,2),this.view.setUint8(this.position,1),this.position++,this.view.setUint8(this.position,val?1:0),this.position++,this.length=Math.max(this.length,this.position),++adHoc},this.finalize=function(){var dtsDelta,len;switch(this.bytes[0]){case FlvTag.VIDEO_TAG:this.bytes[11]=7|(this.keyFrame||extraData?16:32),this.bytes[12]=extraData?0:1,dtsDelta=this.pts-this.dts,this.bytes[13]=(16711680&dtsDelta)>>>16,this.bytes[14]=(65280&dtsDelta)>>>8,this.bytes[15]=(255&dtsDelta)>>>0;break;case FlvTag.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=extraData?0:1;break;case FlvTag.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,adHoc),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return len=this.length-11,this.bytes[1]=(16711680&len)>>>16,this.bytes[2]=(65280&len)>>>8,this.bytes[3]=(255&len)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,prepareWrite(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=FlvTag.frameTime(this.bytes),this}}).AUDIO_TAG=8,FlvTag.VIDEO_TAG=9,FlvTag.METADATA_TAG=18,FlvTag.isAudioFrame=function(tag){return FlvTag.AUDIO_TAG===tag[0]},FlvTag.isVideoFrame=function(tag){return FlvTag.VIDEO_TAG===tag[0]},FlvTag.isMetaData=function(tag){return FlvTag.METADATA_TAG===tag[0]},FlvTag.isKeyFrame=function(tag){return FlvTag.isVideoFrame(tag)?23===tag[11]:!!FlvTag.isAudioFrame(tag)||!!FlvTag.isMetaData(tag)},FlvTag.frameTime=function(tag){var pts=tag[4]<<16;return pts|=tag[5]<<8,pts|=tag[6]<<0,pts|=tag[7]<<24},module.exports=FlvTag},{}],45:[function(require,module,exports){module.exports={tag:require("./flv-tag"),Transmuxer:require("./transmuxer"),getFlvHeader:require("./flv-header")}},{"./flv-header":43,"./flv-tag":44,"./transmuxer":47}],46:[function(require,module,exports){"use strict";module.exports=function(){var self=this;this.list=[],this.push=function(tag){this.list.push({bytes:tag.bytes,dts:tag.dts,pts:tag.pts,keyFrame:tag.keyFrame,metaDataTag:tag.metaDataTag})},Object.defineProperty(this,"length",{get:function(){return self.list.length}})}},{}],47:[function(require,module,exports){"use strict";var Transmuxer,VideoSegmentStream,AudioSegmentStream,collectTimelineInfo,metaDataTag,extraDataTag,Stream=require("../utils/stream.js"),FlvTag=require("./flv-tag.js"),m2ts=require("../m2ts/m2ts.js"),AdtsStream=require("../codecs/adts.js"),H264Stream=require("../codecs/h264").H264Stream,CoalesceStream=require("./coalesce-stream.js"),TagList=require("./tag-list.js");collectTimelineInfo=function(track,data){"number"==typeof data.pts&&(void 0===track.timelineStartInfo.pts?track.timelineStartInfo.pts=data.pts:track.timelineStartInfo.pts=Math.min(track.timelineStartInfo.pts,data.pts)),"number"==typeof data.dts&&(void 0===track.timelineStartInfo.dts?track.timelineStartInfo.dts=data.dts:track.timelineStartInfo.dts=Math.min(track.timelineStartInfo.dts,data.dts))},metaDataTag=function(track,pts){var tag=new FlvTag(FlvTag.METADATA_TAG);return tag.dts=pts,tag.pts=pts,tag.writeMetaDataDouble("videocodecid",7),tag.writeMetaDataDouble("width",track.width),tag.writeMetaDataDouble("height",track.height),tag},extraDataTag=function(track,pts){var i,tag=new FlvTag(FlvTag.VIDEO_TAG,!0);for(tag.dts=pts,tag.pts=pts,tag.writeByte(1),tag.writeByte(track.profileIdc),tag.writeByte(track.profileCompatibility),tag.writeByte(track.levelIdc),tag.writeByte(255),tag.writeByte(225),tag.writeShort(track.sps[0].length),tag.writeBytes(track.sps[0]),tag.writeByte(track.pps.length),i=0;i<track.pps.length;++i)tag.writeShort(track.pps[i].length),tag.writeBytes(track.pps[i]);return tag},(AudioSegmentStream=function(track){var oldExtraData,adtsFrames=[],videoKeyFrames=[];AudioSegmentStream.prototype.init.call(this),this.push=function(data){collectTimelineInfo(track,data),track&&(track.audioobjecttype=data.audioobjecttype,track.channelcount=data.channelcount,track.samplerate=data.samplerate,track.samplingfrequencyindex=data.samplingfrequencyindex,track.samplesize=data.samplesize,track.extraData=track.audioobjecttype<<11|track.samplingfrequencyindex<<7|track.channelcount<<3),data.pts=Math.round(data.pts/90),data.dts=Math.round(data.dts/90),adtsFrames.push(data)},this.flush=function(){var currentFrame,adtsFrame,lastMetaPts,tags=new TagList;if(0!==adtsFrames.length){for(lastMetaPts=-1/0;adtsFrames.length;)currentFrame=adtsFrames.shift(),videoKeyFrames.length&&currentFrame.pts>=videoKeyFrames[0]&&(lastMetaPts=videoKeyFrames.shift(),this.writeMetaDataTags(tags,lastMetaPts)),(track.extraData!==oldExtraData||currentFrame.pts-lastMetaPts>=1e3)&&(this.writeMetaDataTags(tags,currentFrame.pts),oldExtraData=track.extraData,lastMetaPts=currentFrame.pts),(adtsFrame=new FlvTag(FlvTag.AUDIO_TAG)).pts=currentFrame.pts,adtsFrame.dts=currentFrame.dts,adtsFrame.writeBytes(currentFrame.data),tags.push(adtsFrame.finalize());videoKeyFrames.length=0,oldExtraData=null,this.trigger("data",{track:track,tags:tags.list}),this.trigger("done","AudioSegmentStream")}else this.trigger("done","AudioSegmentStream")},this.writeMetaDataTags=function(tags,pts){var adtsFrame;(adtsFrame=new FlvTag(FlvTag.METADATA_TAG)).pts=pts,adtsFrame.dts=pts,adtsFrame.writeMetaDataDouble("audiocodecid",10),adtsFrame.writeMetaDataBoolean("stereo",2===track.channelcount),adtsFrame.writeMetaDataDouble("audiosamplerate",track.samplerate),adtsFrame.writeMetaDataDouble("audiosamplesize",16),tags.push(adtsFrame.finalize()),(adtsFrame=new FlvTag(FlvTag.AUDIO_TAG,!0)).pts=pts,adtsFrame.dts=pts,adtsFrame.view.setUint16(adtsFrame.position,track.extraData),adtsFrame.position+=2,adtsFrame.length=Math.max(adtsFrame.length,adtsFrame.position),tags.push(adtsFrame.finalize())},this.onVideoKeyFrame=function(pts){videoKeyFrames.push(pts)}}).prototype=new Stream,(VideoSegmentStream=function(track){var config,h264Frame,nalUnits=[];VideoSegmentStream.prototype.init.call(this),this.finishFrame=function(tags,frame){if(frame){if(config&&track&&track.newMetadata&&(frame.keyFrame||0===tags.length)){var metaTag=metaDataTag(config,frame.dts).finalize(),extraTag=extraDataTag(track,frame.dts).finalize();metaTag.metaDataTag=extraTag.metaDataTag=!0,tags.push(metaTag),tags.push(extraTag),track.newMetadata=!1,this.trigger("keyframe",frame.dts)}frame.endNalUnit(),tags.push(frame.finalize()),h264Frame=null}},this.push=function(data){collectTimelineInfo(track,data),data.pts=Math.round(data.pts/90),data.dts=Math.round(data.dts/90),nalUnits.push(data)},this.flush=function(){for(var currentNal,tags=new TagList;nalUnits.length&&"access_unit_delimiter_rbsp"!==nalUnits[0].nalUnitType;)nalUnits.shift();if(0!==nalUnits.length){for(;nalUnits.length;)"seq_parameter_set_rbsp"===(currentNal=nalUnits.shift()).nalUnitType?(track.newMetadata=!0,config=currentNal.config,track.width=config.width,track.height=config.height,track.sps=[currentNal.data],track.profileIdc=config.profileIdc,track.levelIdc=config.levelIdc,track.profileCompatibility=config.profileCompatibility,h264Frame.endNalUnit()):"pic_parameter_set_rbsp"===currentNal.nalUnitType?(track.newMetadata=!0,track.pps=[currentNal.data],h264Frame.endNalUnit()):"access_unit_delimiter_rbsp"===currentNal.nalUnitType?(h264Frame&&this.finishFrame(tags,h264Frame),(h264Frame=new FlvTag(FlvTag.VIDEO_TAG)).pts=currentNal.pts,h264Frame.dts=currentNal.dts):("slice_layer_without_partitioning_rbsp_idr"===currentNal.nalUnitType&&(h264Frame.keyFrame=!0),h264Frame.endNalUnit()),h264Frame.startNalUnit(),h264Frame.writeBytes(currentNal.data);h264Frame&&this.finishFrame(tags,h264Frame),this.trigger("data",{track:track,tags:tags.list}),this.trigger("done","VideoSegmentStream")}else this.trigger("done","VideoSegmentStream")}}).prototype=new Stream,(Transmuxer=function(options){var packetStream,parseStream,elementaryStream,videoTimestampRolloverStream,audioTimestampRolloverStream,timedMetadataTimestampRolloverStream,adtsStream,h264Stream,videoSegmentStream,audioSegmentStream,captionStream,coalesceStream,self=this;Transmuxer.prototype.init.call(this),options=options||{},this.metadataStream=new m2ts.MetadataStream,options.metadataStream=this.metadataStream,packetStream=new m2ts.TransportPacketStream,parseStream=new m2ts.TransportParseStream,elementaryStream=new m2ts.ElementaryStream,videoTimestampRolloverStream=new m2ts.TimestampRolloverStream("video"),audioTimestampRolloverStream=new m2ts.TimestampRolloverStream("audio"),timedMetadataTimestampRolloverStream=new m2ts.TimestampRolloverStream("timed-metadata"),adtsStream=new AdtsStream,h264Stream=new H264Stream,coalesceStream=new CoalesceStream(options),packetStream.pipe(parseStream).pipe(elementaryStream),elementaryStream.pipe(videoTimestampRolloverStream).pipe(h264Stream),elementaryStream.pipe(audioTimestampRolloverStream).pipe(adtsStream),elementaryStream.pipe(timedMetadataTimestampRolloverStream).pipe(this.metadataStream).pipe(coalesceStream),captionStream=new m2ts.CaptionStream,h264Stream.pipe(captionStream).pipe(coalesceStream),elementaryStream.on("data",function(data){var i,videoTrack,audioTrack;if("metadata"===data.type){for(i=data.tracks.length;i--;)"video"===data.tracks[i].type?videoTrack=data.tracks[i]:"audio"===data.tracks[i].type&&(audioTrack=data.tracks[i]);videoTrack&&!videoSegmentStream&&(coalesceStream.numberOfTracks++,videoSegmentStream=new VideoSegmentStream(videoTrack),h264Stream.pipe(videoSegmentStream).pipe(coalesceStream)),audioTrack&&!audioSegmentStream&&(coalesceStream.numberOfTracks++,audioSegmentStream=new AudioSegmentStream(audioTrack),adtsStream.pipe(audioSegmentStream).pipe(coalesceStream),videoSegmentStream&&videoSegmentStream.on("keyframe",audioSegmentStream.onVideoKeyFrame))}}),this.push=function(data){packetStream.push(data)},this.flush=function(){packetStream.flush()},this.resetCaptions=function(){captionStream.reset()},coalesceStream.on("data",function(event){self.trigger("data",event)}),coalesceStream.on("done",function(){self.trigger("done")})}).prototype=new Stream,module.exports=Transmuxer},{"../codecs/adts.js":39,"../codecs/h264":40,"../m2ts/m2ts.js":49,"../utils/stream.js":61,"./coalesce-stream.js":42,"./flv-tag.js":44,"./tag-list.js":46}],48:[function(require,module,exports){"use strict";var Stream=require("../utils/stream"),parseSei=function(bytes){for(var i=0,result={payloadType:-1,payloadSize:0},payloadType=0,payloadSize=0;i<bytes.byteLength&&128!==bytes[i];){for(;255===bytes[i];)payloadType+=255,i++;for(payloadType+=bytes[i++];255===bytes[i];)payloadSize+=255,i++;if(payloadSize+=bytes[i++],!result.payload&&4===payloadType){result.payloadType=payloadType,result.payloadSize=payloadSize,result.payload=bytes.subarray(i,i+payloadSize);break}i+=payloadSize,payloadType=0,payloadSize=0}return result},parseUserData=function(sei){return 181!==sei.payload[0]?null:49!=(sei.payload[1]<<8|sei.payload[2])?null:"GA94"!==String.fromCharCode(sei.payload[3],sei.payload[4],sei.payload[5],sei.payload[6])?null:3!==sei.payload[7]?null:sei.payload.subarray(8,sei.payload.length-1)},parseCaptionPackets=function(pts,userData){var i,count,offset,data,results=[];if(!(64&userData[0]))return results;for(count=31&userData[0],i=0;i<count;i++)data={type:3&userData[(offset=3*i)+2],pts:pts},4&userData[offset+2]&&(data.ccData=userData[offset+3]<<8|userData[offset+4],results.push(data));return results},packetDropper={push:function(){}},CaptionStream=function(){CaptionStream.prototype.init.call(this),this.captionPackets_=[],this.ccStreams_=[new Cea608Stream(0,0),new Cea608Stream(0,1),new Cea608Stream(1,0),new Cea608Stream(1,1)],this.reset(),this.ccStreams_.forEach(function(cc){cc.on("data",this.trigger.bind(this,"data")),cc.on("done",this.trigger.bind(this,"done"))},this)};CaptionStream.prototype=new Stream,CaptionStream.prototype.push=function(event){var sei,userData;"sei_rbsp"===event.nalUnitType&&4===(sei=parseSei(event.escapedRBSP)).payloadType&&(userData=parseUserData(sei))&&(event.dts<this.latestDts_?this.ignoreNextEqualDts_=!0:event.dts===this.latestDts_&&this.ignoreNextEqualDts_?this.ignoreNextEqualDts_=!1:(this.captionPackets_=this.captionPackets_.concat(parseCaptionPackets(event.pts,userData)),this.latestDts_=event.dts))},CaptionStream.prototype.flush=function(){this.captionPackets_.length?(this.captionPackets_.forEach(function(elem,idx){elem.presortIndex=idx}),this.captionPackets_.sort(function(a,b){return a.pts===b.pts?a.presortIndex-b.presortIndex:a.pts-b.pts}),this.captionPackets_.forEach(function(packet){packet.type<2&&this.dispatchCea608Packet(packet)},this),this.captionPackets_.length=0,this.ccStreams_.forEach(function(cc){cc.flush()},this)):this.ccStreams_.forEach(function(cc){cc.flush()},this)},CaptionStream.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.activeCea608Channel_=null,this.activeCea608Streams_=[packetDropper,packetDropper],this.ccStreams_.forEach(function(ccStream){ccStream.reset()})},CaptionStream.prototype.dispatchCea608Packet=function(packet){this.setsChannel1Active(packet)&&1!==this.activeCea608Channel_?(this.activeCea608Channel_=1,this.activeCea608Streams_=[this.ccStreams_[0],this.ccStreams_[2]]):this.setsChannel2Active(packet)&&2!==this.activeCea608Channel_&&(this.activeCea608Channel_=2,this.activeCea608Streams_=[this.ccStreams_[1],this.ccStreams_[3]]),this.activeCea608Streams_[packet.type].push(packet)},CaptionStream.prototype.setsChannel1Active=function(packet){return 4096==(30720&packet.ccData)},CaptionStream.prototype.setsChannel2Active=function(packet){return 6144==(30720&packet.ccData)};var CHARACTER_TRANSLATION={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},getCharFromCode=function(code){return null===code?"":(code=CHARACTER_TRANSLATION[code]||code,String.fromCharCode(code))},ROWS=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],createDisplayBuffer=function(){for(var result=[],i=15;i--;)result.push("");return result},Cea608Stream=function(field,dataChannel){Cea608Stream.prototype.init.call(this),this.field_=field||0,this.dataChannel_=dataChannel||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(packet){var data,swap,char0,char1,text;if((data=32639&packet.ccData)!==this.lastControlCode_){if(4096==(61440&data)?this.lastControlCode_=data:data!==this.PADDING_&&(this.lastControlCode_=null),char0=data>>>8,char1=255&data,data!==this.PADDING_)if(data===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(data===this.END_OF_CAPTION_)this.clearFormatting(packet.pts),this.flushDisplayed(packet.pts),swap=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=swap,this.startPts_=packet.pts;else if(data===this.ROLL_UP_2_ROWS_)this.topRow_=13,this.mode_="rollUp";else if(data===this.ROLL_UP_3_ROWS_)this.topRow_=12,this.mode_="rollUp";else if(data===this.ROLL_UP_4_ROWS_)this.topRow_=11,this.mode_="rollUp";else if(data===this.CARRIAGE_RETURN_)this.clearFormatting(packet.pts),this.flushDisplayed(packet.pts),this.shiftRowsUp_(),this.startPts_=packet.pts;else if(data===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[14]=this.nonDisplayed_[14].slice(0,-1):this.displayed_[14]=this.displayed_[14].slice(0,-1);else if(data===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(packet.pts),this.displayed_=createDisplayBuffer();else if(data===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=createDisplayBuffer();else if(data===this.RESUME_DIRECT_CAPTIONING_)this.mode_="paintOn";else if(this.isSpecialCharacter(char0,char1))text=getCharFromCode((char0=(3&char0)<<8)|char1),this[this.mode_](packet.pts,text),this.column_++;else if(this.isExtCharacter(char0,char1))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[14]=this.displayed_[14].slice(0,-1),text=getCharFromCode((char0=(3&char0)<<8)|char1),this[this.mode_](packet.pts,text),this.column_++;else if(this.isMidRowCode(char0,char1))this.clearFormatting(packet.pts),this[this.mode_](packet.pts," "),this.column_++,14==(14&char1)&&this.addFormatting(packet.pts,["i"]),1==(1&char1)&&this.addFormatting(packet.pts,["u"]);else if(this.isOffsetControlCode(char0,char1))this.column_+=3&char1;else if(this.isPAC(char0,char1)){var row=ROWS.indexOf(7968&data);row!==this.row_&&(this.clearFormatting(packet.pts),this.row_=row),1&char1&&-1===this.formatting_.indexOf("u")&&this.addFormatting(packet.pts,["u"]),16==(16&data)&&(this.column_=4*((14&data)>>1)),this.isColorPAC(char1)&&14==(14&char1)&&this.addFormatting(packet.pts,["i"])}else this.isNormalChar(char0)&&(0===char1&&(char1=null),text=getCharFromCode(char0),text+=getCharFromCode(char1),this[this.mode_](packet.pts,text),this.column_+=text.length)}else this.lastControlCode_=null}};Cea608Stream.prototype=new Stream,Cea608Stream.prototype.flushDisplayed=function(pts){var content=this.displayed_.map(function(row){return row.trim()}).join("\n").replace(/^\n+|\n+$/g,"");content.length&&this.trigger("data",{startPts:this.startPts_,endPts:pts,text:content,stream:this.name_})},Cea608Stream.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=createDisplayBuffer(),this.nonDisplayed_=createDisplayBuffer(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.formatting_=[]},Cea608Stream.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Cea608Stream.prototype.isSpecialCharacter=function(char0,char1){return char0===this.EXT_&&char1>=48&&char1<=63},Cea608Stream.prototype.isExtCharacter=function(char0,char1){return(char0===this.EXT_+1||char0===this.EXT_+2)&&char1>=32&&char1<=63},Cea608Stream.prototype.isMidRowCode=function(char0,char1){return char0===this.EXT_&&char1>=32&&char1<=47},Cea608Stream.prototype.isOffsetControlCode=function(char0,char1){return char0===this.OFFSET_&&char1>=33&&char1<=35},Cea608Stream.prototype.isPAC=function(char0,char1){return char0>=this.BASE_&&char0<this.BASE_+8&&char1>=64&&char1<=127},Cea608Stream.prototype.isColorPAC=function(char1){return char1>=64&&char1<=79||char1>=96&&char1<=127},Cea608Stream.prototype.isNormalChar=function(char){return char>=32&&char<=127},Cea608Stream.prototype.addFormatting=function(pts,format){this.formatting_=this.formatting_.concat(format);var text=format.reduce(function(text,format){return text+"<"+format+">"},"");this[this.mode_](pts,text)},Cea608Stream.prototype.clearFormatting=function(pts){if(this.formatting_.length){var text=this.formatting_.reverse().reduce(function(text,format){return text+"</"+format+">"},"");this.formatting_=[],this[this.mode_](pts,text)}},Cea608Stream.prototype.popOn=function(pts,text){var baseRow=this.nonDisplayed_[this.row_];baseRow+=text,this.nonDisplayed_[this.row_]=baseRow},Cea608Stream.prototype.rollUp=function(pts,text){var baseRow=this.displayed_[14];baseRow+=text,this.displayed_[14]=baseRow},Cea608Stream.prototype.shiftRowsUp_=function(){var i;for(i=0;i<this.topRow_;i++)this.displayed_[i]="";for(i=this.topRow_;i<14;i++)this.displayed_[i]=this.displayed_[i+1];this.displayed_[14]=""},Cea608Stream.prototype.paintOn=function(){},module.exports={CaptionStream:CaptionStream,Cea608Stream:Cea608Stream}},{"../utils/stream":61}],49:[function(require,module,exports){"use strict";var TransportPacketStream,TransportParseStream,ElementaryStream,Stream=require("../utils/stream.js"),CaptionStream=require("./caption-stream"),StreamTypes=require("./stream-types"),TimestampRolloverStream=require("./timestamp-rollover-stream").TimestampRolloverStream,m2tsStreamTypes=require("./stream-types.js");(TransportPacketStream=function(){var buffer=new Uint8Array(188),bytesInBuffer=0;TransportPacketStream.prototype.init.call(this),this.push=function(bytes){var everything,startIndex=0,endIndex=188;for(bytesInBuffer?((everything=new Uint8Array(bytes.byteLength+bytesInBuffer)).set(buffer.subarray(0,bytesInBuffer)),everything.set(bytes,bytesInBuffer),bytesInBuffer=0):everything=bytes;endIndex<everything.byteLength;)71!==everything[startIndex]||71!==everything[endIndex]?(startIndex++,endIndex++):(this.trigger("data",everything.subarray(startIndex,endIndex)),startIndex+=188,endIndex+=188);startIndex<everything.byteLength&&(buffer.set(everything.subarray(startIndex),0),bytesInBuffer=everything.byteLength-startIndex)},this.flush=function(){188===bytesInBuffer&&71===buffer[0]&&(this.trigger("data",buffer),bytesInBuffer=0),this.trigger("done")}}).prototype=new Stream,(TransportParseStream=function(){var parsePsi,parsePat,parsePmt,self;TransportParseStream.prototype.init.call(this),self=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,parsePsi=function(payload,psi){var offset=0;psi.payloadUnitStartIndicator&&(offset+=payload[offset]+1),"pat"===psi.type?parsePat(payload.subarray(offset),psi):parsePmt(payload.subarray(offset),psi)},parsePat=function(payload,pat){pat.section_number=payload[7],pat.last_section_number=payload[8],self.pmtPid=(31&payload[10])<<8|payload[11],pat.pmtPid=self.pmtPid},parsePmt=function(payload,pmt){var tableEnd,offset;if(1&payload[5]){for(self.programMapTable={},tableEnd=3+((15&payload[1])<<8|payload[2])-4,offset=12+((15&payload[10])<<8|payload[11]);offset<tableEnd;)self.programMapTable[(31&payload[offset+1])<<8|payload[offset+2]]=payload[offset],offset+=5+((15&payload[offset+3])<<8|payload[offset+4]);for(pmt.programMapTable=self.programMapTable;self.packetsWaitingForPmt.length;)self.processPes_.apply(self,self.packetsWaitingForPmt.shift())}},this.push=function(packet){var result={},offset=4;result.payloadUnitStartIndicator=!!(64&packet[1]),result.pid=31&packet[1],result.pid<<=8,result.pid|=packet[2],(48&packet[3])>>>4>1&&(offset+=packet[offset]+1),0===result.pid?(result.type="pat",parsePsi(packet.subarray(offset),result),this.trigger("data",result)):result.pid===this.pmtPid?(result.type="pmt",parsePsi(packet.subarray(offset),result),this.trigger("data",result)):void 0===this.programMapTable?this.packetsWaitingForPmt.push([packet,offset,result]):this.processPes_(packet,offset,result)},this.processPes_=function(packet,offset,result){result.streamType=this.programMapTable[result.pid],result.type="pes",result.data=packet.subarray(offset),this.trigger("data",result)}}).prototype=new Stream,TransportParseStream.STREAM_TYPES={h264:27,adts:15},(ElementaryStream=function(){var self=this,video={data:[],size:0},audio={data:[],size:0},timedMetadata={data:[],size:0},parsePes=function(payload,pes){var ptsDtsFlags;pes.packetLength=6+(payload[4]<<8|payload[5]),pes.dataAlignmentIndicator=0!=(4&payload[6]),192&(ptsDtsFlags=payload[7])&&(pes.pts=(14&payload[9])<<27|(255&payload[10])<<20|(254&payload[11])<<12|(255&payload[12])<<5|(254&payload[13])>>>3,pes.pts*=4,pes.pts+=(6&payload[13])>>>1,pes.dts=pes.pts,64&ptsDtsFlags&&(pes.dts=(14&payload[14])<<27|(255&payload[15])<<20|(254&payload[16])<<12|(255&payload[17])<<5|(254&payload[18])>>>3,pes.dts*=4,pes.dts+=(6&payload[18])>>>1)),pes.data=payload.subarray(9+payload[8])},flushStream=function(stream,type,forceFlush){var fragment,packetData=new Uint8Array(stream.size),event={type:type},i=0,offset=0,packetFlushable=!1;if(stream.data.length&&!(stream.size<9)){for(event.trackId=stream.data[0].pid,i=0;i<stream.data.length;i++)fragment=stream.data[i],packetData.set(fragment.data,offset),offset+=fragment.data.byteLength;parsePes(packetData,event),packetFlushable="video"===type||event.packetLength===stream.size,(forceFlush||packetFlushable)&&(stream.size=0,stream.data.length=0),packetFlushable&&self.trigger("data",event)}};ElementaryStream.prototype.init.call(this),this.push=function(data){({pat:function(){},pes:function(){var stream,streamType;switch(data.streamType){case StreamTypes.H264_STREAM_TYPE:case m2tsStreamTypes.H264_STREAM_TYPE:stream=video,streamType="video";break;case StreamTypes.ADTS_STREAM_TYPE:stream=audio,streamType="audio";break;case StreamTypes.METADATA_STREAM_TYPE:stream=timedMetadata,streamType="timed-metadata";break;default:return}data.payloadUnitStartIndicator&&flushStream(stream,streamType,!0),stream.data.push(data),stream.size+=data.data.byteLength},pmt:function(){var k,track,event={type:"metadata",tracks:[]},programMapTable=data.programMapTable;for(k in programMapTable)programMapTable.hasOwnProperty(k)&&((track={timelineStartInfo:{baseMediaDecodeTime:0}}).id=+k,programMapTable[k]===m2tsStreamTypes.H264_STREAM_TYPE?(track.codec="avc",track.type="video"):programMapTable[k]===m2tsStreamTypes.ADTS_STREAM_TYPE&&(track.codec="adts",track.type="audio"),event.tracks.push(track));self.trigger("data",event)}})[data.type]()},this.flush=function(){flushStream(video,"video"),flushStream(audio,"audio"),flushStream(timedMetadata,"timed-metadata"),this.trigger("done")}}).prototype=new Stream;var m2ts={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:TransportPacketStream,TransportParseStream:TransportParseStream,ElementaryStream:ElementaryStream,TimestampRolloverStream:TimestampRolloverStream,CaptionStream:CaptionStream.CaptionStream,Cea608Stream:CaptionStream.Cea608Stream,MetadataStream:require("./metadata-stream")};for(var type in StreamTypes)StreamTypes.hasOwnProperty(type)&&(m2ts[type]=StreamTypes[type]);module.exports=m2ts},{"../utils/stream.js":61,"./caption-stream":48,"./metadata-stream":50,"./stream-types":52,"./stream-types.js":52,"./timestamp-rollover-stream":53}],50:[function(require,module,exports){"use strict";var MetadataStream,Stream=require("../utils/stream"),StreamTypes=require("./stream-types"),percentEncode=function(bytes,start,end){var i,result="";for(i=start;i<end;i++)result+="%"+("00"+bytes[i].toString(16)).slice(-2);return result},parseUtf8=function(bytes,start,end){return decodeURIComponent(percentEncode(bytes,start,end))},parseIso88591=function(bytes,start,end){return unescape(percentEncode(bytes,start,end))},parseSyncSafeInteger=function(data){return data[0]<<21|data[1]<<14|data[2]<<7|data[3]},tagParsers={TXXX:function(tag){var i;if(3===tag.data[0]){for(i=1;i<tag.data.length;i++)if(0===tag.data[i]){tag.description=parseUtf8(tag.data,1,i),tag.value=parseUtf8(tag.data,i+1,tag.data.length).replace(/\0*$/,"");break}tag.data=tag.value}},WXXX:function(tag){var i;if(3===tag.data[0])for(i=1;i<tag.data.length;i++)if(0===tag.data[i]){tag.description=parseUtf8(tag.data,1,i),tag.url=parseUtf8(tag.data,i+1,tag.data.length);break}},PRIV:function(tag){var i;for(i=0;i<tag.data.length;i++)if(0===tag.data[i]){tag.owner=parseIso88591(tag.data,0,i);break}tag.privateData=tag.data.subarray(i+1),tag.data=tag.privateData}};(MetadataStream=function(options){var i,settings={debug:!(!options||!options.debug),descriptor:options&&options.descriptor},tagSize=0,buffer=[],bufferSize=0;if(MetadataStream.prototype.init.call(this),this.dispatchType=StreamTypes.METADATA_STREAM_TYPE.toString(16),settings.descriptor)for(i=0;i<settings.descriptor.length;i++)this.dispatchType+=("00"+settings.descriptor[i].toString(16)).slice(-2);this.push=function(chunk){var tag,frameStart,frameSize,frame,i,frameHeader;if("timed-metadata"===chunk.type)if(chunk.dataAlignmentIndicator&&(bufferSize=0,buffer.length=0),0===buffer.length&&(chunk.data.length<10||chunk.data[0]!=="I".charCodeAt(0)||chunk.data[1]!=="D".charCodeAt(0)||chunk.data[2]!=="3".charCodeAt(0)))settings.debug&&console.log("Skipping unrecognized metadata packet");else if(buffer.push(chunk),bufferSize+=chunk.data.byteLength,1===buffer.length&&(tagSize=parseSyncSafeInteger(chunk.data.subarray(6,10)),tagSize+=10),!(bufferSize<tagSize)){for(tag={data:new Uint8Array(tagSize),frames:[],pts:buffer[0].pts,dts:buffer[0].dts},i=0;i<tagSize;)tag.data.set(buffer[0].data.subarray(0,tagSize-i),i),i+=buffer[0].data.byteLength,bufferSize-=buffer[0].data.byteLength,buffer.shift();frameStart=10,64&tag.data[5]&&(frameStart+=4,frameStart+=parseSyncSafeInteger(tag.data.subarray(10,14)),tagSize-=parseSyncSafeInteger(tag.data.subarray(16,20)));do{if((frameSize=parseSyncSafeInteger(tag.data.subarray(frameStart+4,frameStart+8)))<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");if(frameHeader=String.fromCharCode(tag.data[frameStart],tag.data[frameStart+1],tag.data[frameStart+2],tag.data[frameStart+3]),frame={id:frameHeader,data:tag.data.subarray(frameStart+10,frameStart+frameSize+10)},frame.key=frame.id,tagParsers[frame.id]&&(tagParsers[frame.id](frame),"com.apple.streaming.transportStreamTimestamp"===frame.owner)){var d=frame.data,size=(1&d[3])<<30|d[4]<<22|d[5]<<14|d[6]<<6|d[7]>>>2;size*=4,size+=3&d[7],frame.timeStamp=size,void 0===tag.pts&&void 0===tag.dts&&(tag.pts=frame.timeStamp,tag.dts=frame.timeStamp),this.trigger("timestamp",frame)}tag.frames.push(frame),frameStart+=10,frameStart+=frameSize}while(frameStart<tagSize);this.trigger("data",tag)}}}).prototype=new Stream,module.exports=MetadataStream},{"../utils/stream":61,"./stream-types":52}],51:[function(require,module,exports){"use strict";var StreamTypes=require("./stream-types.js"),parsePid=function(packet){var pid=31&packet[1];return pid<<=8,pid|=packet[2]},parsePayloadUnitStartIndicator=function(packet){return!!(64&packet[1])},parseAdaptionField=function(packet){var offset=0;return(48&packet[3])>>>4>1&&(offset+=packet[4]+1),offset},parseNalUnitType=function(type){switch(type){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}};module.exports={parseType:function(packet,pmtPid){var pid=parsePid(packet);return 0===pid?"pat":pid===pmtPid?"pmt":pmtPid?"pes":null},parsePat:function(packet){var pusi=parsePayloadUnitStartIndicator(packet),offset=4+parseAdaptionField(packet);return pusi&&(offset+=packet[offset]+1),(31&packet[offset+10])<<8|packet[offset+11]},parsePmt:function(packet){var programMapTable={},pusi=parsePayloadUnitStartIndicator(packet),payloadOffset=4+parseAdaptionField(packet);if(pusi&&(payloadOffset+=packet[payloadOffset]+1),1&packet[payloadOffset+5]){var tableEnd,programInfoLength;tableEnd=3+((15&packet[payloadOffset+1])<<8|packet[payloadOffset+2])-4;for(var offset=12+(programInfoLength=(15&packet[payloadOffset+10])<<8|packet[payloadOffset+11]);offset<tableEnd;){var i=payloadOffset+offset;programMapTable[(31&packet[i+1])<<8|packet[i+2]]=packet[i],offset+=5+((15&packet[i+3])<<8|packet[i+4])}return programMapTable}},parsePayloadUnitStartIndicator:parsePayloadUnitStartIndicator,parsePesType:function(packet,programMapTable){switch(programMapTable[parsePid(packet)]){case StreamTypes.H264_STREAM_TYPE:return"video";case StreamTypes.ADTS_STREAM_TYPE:return"audio";case StreamTypes.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(packet){if(!parsePayloadUnitStartIndicator(packet))return null;var offset=4+parseAdaptionField(packet);if(offset>=packet.byteLength)return null;var ptsDtsFlags,pes=null;return 192&(ptsDtsFlags=packet[offset+7])&&((pes={}).pts=(14&packet[offset+9])<<27|(255&packet[offset+10])<<20|(254&packet[offset+11])<<12|(255&packet[offset+12])<<5|(254&packet[offset+13])>>>3,pes.pts*=4,pes.pts+=(6&packet[offset+13])>>>1,pes.dts=pes.pts,64&ptsDtsFlags&&(pes.dts=(14&packet[offset+14])<<27|(255&packet[offset+15])<<20|(254&packet[offset+16])<<12|(255&packet[offset+17])<<5|(254&packet[offset+18])>>>3,pes.dts*=4,pes.dts+=(6&packet[offset+18])>>>1)),pes},videoPacketContainsKeyFrame:function(packet){for(var offset=4+parseAdaptionField(packet),frameBuffer=packet.subarray(offset),frameI=0,frameSyncPoint=0,foundKeyFrame=!1;frameSyncPoint<frameBuffer.byteLength-3;frameSyncPoint++)if(1===frameBuffer[frameSyncPoint+2]){frameI=frameSyncPoint+5;break}for(;frameI<frameBuffer.byteLength;)switch(frameBuffer[frameI]){case 0:if(0!==frameBuffer[frameI-1]){frameI+=2;break}if(0!==frameBuffer[frameI-2]){frameI++;break}frameSyncPoint+3!==frameI-2&&"slice_layer_without_partitioning_rbsp_idr"===parseNalUnitType(31&frameBuffer[frameSyncPoint+3])&&(foundKeyFrame=!0);do{frameI++}while(1!==frameBuffer[frameI]&&frameI<frameBuffer.length);frameSyncPoint=frameI-2,frameI+=3;break;case 1:if(0!==frameBuffer[frameI-1]||0!==frameBuffer[frameI-2]){frameI+=3;break}"slice_layer_without_partitioning_rbsp_idr"===parseNalUnitType(31&frameBuffer[frameSyncPoint+3])&&(foundKeyFrame=!0),frameSyncPoint=frameI-2,frameI+=3;break;default:frameI+=3}return frameBuffer=frameBuffer.subarray(frameSyncPoint),frameI-=frameSyncPoint,frameSyncPoint=0,frameBuffer&&frameBuffer.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===parseNalUnitType(31&frameBuffer[frameSyncPoint+3])&&(foundKeyFrame=!0),foundKeyFrame}}},{"./stream-types.js":52}],52:[function(require,module,exports){"use strict";module.exports={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21}},{}],53:[function(require,module,exports){"use strict";var Stream=require("../utils/stream"),handleRollover=function(value,reference){var direction=1;for(value>reference&&(direction=-1);Math.abs(reference-value)>4294967296;)value+=8589934592*direction;return value},TimestampRolloverStream=function(type){var lastDTS,referenceDTS;TimestampRolloverStream.prototype.init.call(this),this.type_=type,this.push=function(data){data.type===this.type_&&(void 0===referenceDTS&&(referenceDTS=data.dts),data.dts=handleRollover(data.dts,referenceDTS),data.pts=handleRollover(data.pts,referenceDTS),lastDTS=data.dts,this.trigger("data",data))},this.flush=function(){referenceDTS=lastDTS,this.trigger("done")},this.discontinuity=function(){referenceDTS=void 0,lastDTS=void 0}};TimestampRolloverStream.prototype=new Stream,module.exports={TimestampRolloverStream:TimestampRolloverStream,handleRollover:handleRollover}},{"../utils/stream":61}],54:[function(require,module,exports){module.exports={generator:require("./mp4-generator"),Transmuxer:require("./transmuxer").Transmuxer,AudioSegmentStream:require("./transmuxer").AudioSegmentStream,VideoSegmentStream:require("./transmuxer").VideoSegmentStream}},{"./mp4-generator":55,"./transmuxer":57}],55:[function(require,module,exports){"use strict";var box,dinf,esds,ftyp,mdat,mfhd,minf,moof,moov,mvex,mvhd,trak,tkhd,mdia,mdhd,hdlr,sdtp,stbl,stsd,traf,trex,trun,types,MAJOR_BRAND,MINOR_VERSION,AVC1_BRAND,VIDEO_HDLR,AUDIO_HDLR,HDLR_TYPES,VMHD,SMHD,DREF,STCO,STSC,STSZ,STTS,UINT32_MAX=Math.pow(2,32)-1;!function(){var i;if(types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(i in types)types.hasOwnProperty(i)&&(types[i]=[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]);MAJOR_BRAND=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),AVC1_BRAND=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),MINOR_VERSION=new Uint8Array([0,0,0,1]),VIDEO_HDLR=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),AUDIO_HDLR=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),HDLR_TYPES={video:VIDEO_HDLR,audio:AUDIO_HDLR},DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),STCO=new Uint8Array([0,0,0,0,0,0,0,0]),STSC=STCO,STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),STTS=STCO,VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),box=function(type){var i,result,payload=[],size=0;for(i=1;i<arguments.length;i++)payload.push(arguments[i]);for(i=payload.length;i--;)size+=payload[i].byteLength;for(result=new Uint8Array(size+8),new DataView(result.buffer,result.byteOffset,result.byteLength).setUint32(0,result.byteLength),result.set(type,4),i=0,size=8;i<payload.length;i++)result.set(payload[i],size),size+=payload[i].byteLength;return result},dinf=function(){return box(types.dinf,box(types.dref,DREF))},esds=function(track){return box(types.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,track.audioobjecttype<<3|track.samplingfrequencyindex>>>1,track.samplingfrequencyindex<<7|track.channelcount<<3,6,1,2]))},ftyp=function(){return box(types.ftyp,MAJOR_BRAND,MINOR_VERSION,MAJOR_BRAND,AVC1_BRAND)},hdlr=function(type){return box(types.hdlr,HDLR_TYPES[type])},mdat=function(data){return box(types.mdat,data)},mdhd=function(track){var result=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,track.duration>>>24&255,track.duration>>>16&255,track.duration>>>8&255,255&track.duration,85,196,0,0]);return track.samplerate&&(result[12]=track.samplerate>>>24&255,result[13]=track.samplerate>>>16&255,result[14]=track.samplerate>>>8&255,result[15]=255&track.samplerate),box(types.mdhd,result)},mdia=function(track){return box(types.mdia,mdhd(track),hdlr(track.type),minf(track))},mfhd=function(sequenceNumber){return box(types.mfhd,new Uint8Array([0,0,0,0,(4278190080&sequenceNumber)>>24,(16711680&sequenceNumber)>>16,(65280&sequenceNumber)>>8,255&sequenceNumber]))},minf=function(track){return box(types.minf,"video"===track.type?box(types.vmhd,VMHD):box(types.smhd,SMHD),dinf(),stbl(track))},moof=function(sequenceNumber,tracks){for(var trackFragments=[],i=tracks.length;i--;)trackFragments[i]=traf(tracks[i]);return box.apply(null,[types.moof,mfhd(sequenceNumber)].concat(trackFragments))},moov=function(tracks){for(var i=tracks.length,boxes=[];i--;)boxes[i]=trak(tracks[i]);return box.apply(null,[types.moov,mvhd(4294967295)].concat(boxes).concat(mvex(tracks)))},mvex=function(tracks){for(var i=tracks.length,boxes=[];i--;)boxes[i]=trex(tracks[i]);return box.apply(null,[types.mvex].concat(boxes))},mvhd=function(duration){var bytes=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&duration)>>24,(16711680&duration)>>16,(65280&duration)>>8,255&duration,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return box(types.mvhd,bytes)},sdtp=function(track){var flags,i,samples=track.samples||[],bytes=new Uint8Array(4+samples.length);for(i=0;i<samples.length;i++)flags=samples[i].flags,bytes[i+4]=flags.dependsOn<<4|flags.isDependedOn<<2|flags.hasRedundancy;return box(types.sdtp,bytes)},stbl=function(track){return box(types.stbl,stsd(track),box(types.stts,STTS),box(types.stsc,STSC),box(types.stsz,STSZ),box(types.stco,STCO))},function(){var videoSample,audioSample;stsd=function(track){return box(types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===track.type?videoSample(track):audioSample(track))},videoSample=function(track){var i,sps=track.sps||[],pps=track.pps||[],sequenceParameterSets=[],pictureParameterSets=[];for(i=0;i<sps.length;i++)sequenceParameterSets.push((65280&sps[i].byteLength)>>>8),sequenceParameterSets.push(255&sps[i].byteLength),sequenceParameterSets=sequenceParameterSets.concat(Array.prototype.slice.call(sps[i]));for(i=0;i<pps.length;i++)pictureParameterSets.push((65280&pps[i].byteLength)>>>8),pictureParameterSets.push(255&pps[i].byteLength),pictureParameterSets=pictureParameterSets.concat(Array.prototype.slice.call(pps[i]));return box(types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&track.width)>>8,255&track.width,(65280&track.height)>>8,255&track.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),box(types.avcC,new Uint8Array([1,track.profileIdc,track.profileCompatibility,track.levelIdc,255].concat([sps.length]).concat(sequenceParameterSets).concat([pps.length]).concat(pictureParameterSets))),box(types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))},audioSample=function(track){return box(types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&track.channelcount)>>8,255&track.channelcount,(65280&track.samplesize)>>8,255&track.samplesize,0,0,0,0,(65280&track.samplerate)>>8,255&track.samplerate,0,0]),esds(track))}}(),tkhd=function(track){var result=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&track.id)>>24,(16711680&track.id)>>16,(65280&track.id)>>8,255&track.id,0,0,0,0,(4278190080&track.duration)>>24,(16711680&track.duration)>>16,(65280&track.duration)>>8,255&track.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&track.width)>>8,255&track.width,0,0,(65280&track.height)>>8,255&track.height,0,0]);return box(types.tkhd,result)},traf=function(track){var trackFragmentHeader,trackFragmentDecodeTime,trackFragmentRun,sampleDependencyTable,upperWordBaseMediaDecodeTime,lowerWordBaseMediaDecodeTime;return trackFragmentHeader=box(types.tfhd,new Uint8Array([0,0,0,58,(4278190080&track.id)>>24,(16711680&track.id)>>16,(65280&track.id)>>8,255&track.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),upperWordBaseMediaDecodeTime=Math.floor(track.baseMediaDecodeTime/(UINT32_MAX+1)),lowerWordBaseMediaDecodeTime=Math.floor(track.baseMediaDecodeTime%(UINT32_MAX+1)),trackFragmentDecodeTime=box(types.tfdt,new Uint8Array([1,0,0,0,upperWordBaseMediaDecodeTime>>>24&255,upperWordBaseMediaDecodeTime>>>16&255,upperWordBaseMediaDecodeTime>>>8&255,255&upperWordBaseMediaDecodeTime,lowerWordBaseMediaDecodeTime>>>24&255,lowerWordBaseMediaDecodeTime>>>16&255,lowerWordBaseMediaDecodeTime>>>8&255,255&lowerWordBaseMediaDecodeTime])),92,"audio"===track.type?(trackFragmentRun=trun(track,92),box(types.traf,trackFragmentHeader,trackFragmentDecodeTime,trackFragmentRun)):(sampleDependencyTable=sdtp(track),trackFragmentRun=trun(track,sampleDependencyTable.length+92),box(types.traf,trackFragmentHeader,trackFragmentDecodeTime,trackFragmentRun,sampleDependencyTable))},trak=function(track){return track.duration=track.duration||4294967295,box(types.trak,tkhd(track),mdia(track))},trex=function(track){var result=new Uint8Array([0,0,0,0,(4278190080&track.id)>>24,(16711680&track.id)>>16,(65280&track.id)>>8,255&track.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==track.type&&(result[result.length-1]=0),box(types.trex,result)},function(){var audioTrun,videoTrun,trunHeader;trunHeader=function(samples,offset){var durationPresent=0,sizePresent=0,flagsPresent=0,compositionTimeOffset=0;return samples.length&&(void 0!==samples[0].duration&&(durationPresent=1),void 0!==samples[0].size&&(sizePresent=2),void 0!==samples[0].flags&&(flagsPresent=4),void 0!==samples[0].compositionTimeOffset&&(compositionTimeOffset=8)),[0,0,durationPresent|sizePresent|flagsPresent|compositionTimeOffset,1,(4278190080&samples.length)>>>24,(16711680&samples.length)>>>16,(65280&samples.length)>>>8,255&samples.length,(4278190080&offset)>>>24,(16711680&offset)>>>16,(65280&offset)>>>8,255&offset]},videoTrun=function(track,offset){var bytes,samples,sample,i;for(samples=track.samples||[],bytes=trunHeader(samples,offset+=20+16*samples.length),i=0;i<samples.length;i++)sample=samples[i],bytes=bytes.concat([(4278190080&sample.duration)>>>24,(16711680&sample.duration)>>>16,(65280&sample.duration)>>>8,255&sample.duration,(4278190080&sample.size)>>>24,(16711680&sample.size)>>>16,(65280&sample.size)>>>8,255&sample.size,sample.flags.isLeading<<2|sample.flags.dependsOn,sample.flags.isDependedOn<<6|sample.flags.hasRedundancy<<4|sample.flags.paddingValue<<1|sample.flags.isNonSyncSample,61440&sample.flags.degradationPriority,15&sample.flags.degradationPriority,(4278190080&sample.compositionTimeOffset)>>>24,(16711680&sample.compositionTimeOffset)>>>16,(65280&sample.compositionTimeOffset)>>>8,255&sample.compositionTimeOffset]);return box(types.trun,new Uint8Array(bytes))},audioTrun=function(track,offset){var bytes,samples,sample,i;for(samples=track.samples||[],bytes=trunHeader(samples,offset+=20+8*samples.length),i=0;i<samples.length;i++)sample=samples[i],bytes=bytes.concat([(4278190080&sample.duration)>>>24,(16711680&sample.duration)>>>16,(65280&sample.duration)>>>8,255&sample.duration,(4278190080&sample.size)>>>24,(16711680&sample.size)>>>16,(65280&sample.size)>>>8,255&sample.size]);return box(types.trun,new Uint8Array(bytes))},trun=function(track,offset){return"audio"===track.type?audioTrun(track,offset):videoTrun(track,offset)}}(),module.exports={ftyp:ftyp,mdat:mdat,moof:moof,moov:moov,initSegment:function(tracks){var result,fileType=ftyp(),movie=moov(tracks);return(result=new Uint8Array(fileType.byteLength+movie.byteLength)).set(fileType),result.set(movie,fileType.byteLength),result}}},{}],56:[function(require,module,exports){"use strict";var findBox,parseType,timescale,startTime;findBox=function(data,path){var i,size,type,end,subresults,results=[];if(!path.length)return null;for(i=0;i<data.byteLength;)size=data[i]<<24,size|=data[i+1]<<16,size|=data[i+2]<<8,size|=data[i+3],type=parseType(data.subarray(i+4,i+8)),end=size>1?i+size:data.byteLength,type===path[0]&&(1===path.length?results.push(data.subarray(i+8,end)):(subresults=findBox(data.subarray(i+8,end),path.slice(1))).length&&(results=results.concat(subresults))),i=end;return results},parseType=function(buffer){var result="";return result+=String.fromCharCode(buffer[0]),result+=String.fromCharCode(buffer[1]),result+=String.fromCharCode(buffer[2]),result+=String.fromCharCode(buffer[3])},timescale=function(init){var result={};return findBox(init,["moov","trak"]).reduce(function(result,trak){var tkhd,version,index,id,mdhd;return(tkhd=findBox(trak,["tkhd"])[0])?(version=tkhd[0],index=0===version?12:20,id=tkhd[index]<<24|tkhd[index+1]<<16|tkhd[index+2]<<8|tkhd[index+3],(mdhd=findBox(trak,["mdia","mdhd"])[0])?(version=mdhd[0],index=0===version?12:20,result[id]=mdhd[index]<<24|mdhd[index+1]<<16|mdhd[index+2]<<8|mdhd[index+3],result):null):null},result)},startTime=function(timescale,fragment){var trafs,baseTimes,result;return trafs=findBox(fragment,["moof","traf"]),baseTimes=[].concat.apply([],trafs.map(function(traf){return findBox(traf,["tfhd"]).map(function(tfhd){var id,scale,baseTime;return id=tfhd[4]<<24|tfhd[5]<<16|tfhd[6]<<8|tfhd[7],scale=timescale[id]||9e4,baseTime=findBox(traf,["tfdt"]).map(function(tfdt){var version,result;return version=tfdt[0],result=tfdt[4]<<24|tfdt[5]<<16|tfdt[6]<<8|tfdt[7],1===version&&(result*=Math.pow(2,32),result+=tfdt[8]<<24|tfdt[9]<<16|tfdt[10]<<8|tfdt[11]),result})[0],(baseTime=baseTime||1/0)/scale})})),result=Math.min.apply(null,baseTimes),isFinite(result)?result:0},module.exports={parseType:parseType,timescale:timescale,startTime:startTime}},{}],57:[function(require,module,exports){"use strict";var VideoSegmentStream,AudioSegmentStream,Transmuxer,CoalesceStream,isLikelyAacData,collectDtsInfo,clearDtsInfo,calculateTrackBaseMediaDecodeTime,arrayEquals,sumFrameByteLengths,Stream=require("../utils/stream.js"),mp4=require("./mp4-generator.js"),m2ts=require("../m2ts/m2ts.js"),AdtsStream=require("../codecs/adts.js"),H264Stream=require("../codecs/h264").H264Stream,AacStream=require("../aac"),coneOfSilence=require("../data/silence"),clock=require("../utils/clock"),AUDIO_PROPERTIES=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],VIDEO_PROPERTIES=["width","height","profileIdc","levelIdc","profileCompatibility"];isLikelyAacData=function(data){return data[0]==="I".charCodeAt(0)&&data[1]==="D".charCodeAt(0)&&data[2]==="3".charCodeAt(0)},arrayEquals=function(a,b){var i;if(a.length!==b.length)return!1;for(i=0;i<a.length;i++)if(a[i]!==b[i])return!1;return!0},sumFrameByteLengths=function(array){var i,sum=0;for(i=0;i<array.length;i++)sum+=array[i].data.byteLength;return sum},(AudioSegmentStream=function(track){var adtsFrames=[],sequenceNumber=0,earliestAllowedDts=0,audioAppendStartTs=0,videoBaseMediaDecodeTime=1/0;AudioSegmentStream.prototype.init.call(this),this.push=function(data){collectDtsInfo(track,data),track&&AUDIO_PROPERTIES.forEach(function(prop){track[prop]=data[prop]}),adtsFrames.push(data)},this.setEarliestDts=function(earliestDts){earliestAllowedDts=earliestDts-track.timelineStartInfo.baseMediaDecodeTime},this.setVideoBaseMediaDecodeTime=function(baseMediaDecodeTime){videoBaseMediaDecodeTime=baseMediaDecodeTime},this.setAudioAppendStart=function(timestamp){audioAppendStartTs=timestamp},this.flush=function(){var frames,moof,mdat,boxes;0!==adtsFrames.length?(frames=this.trimAdtsFramesByEarliestDts_(adtsFrames),track.baseMediaDecodeTime=calculateTrackBaseMediaDecodeTime(track),this.prefixWithSilence_(track,frames),track.samples=this.generateSampleTable_(frames),mdat=mp4.mdat(this.concatenateFrameData_(frames)),adtsFrames=[],moof=mp4.moof(sequenceNumber,[track]),boxes=new Uint8Array(moof.byteLength+mdat.byteLength),sequenceNumber++,boxes.set(moof),boxes.set(mdat,moof.byteLength),clearDtsInfo(track),this.trigger("data",{track:track,boxes:boxes}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.prefixWithSilence_=function(track,frames){var baseMediaDecodeTimeTs,silentFrame,i,frameDuration=0,audioGapDuration=0,audioFillFrameCount=0,audioFillDuration=0;if(frames.length&&(baseMediaDecodeTimeTs=clock.audioTsToVideoTs(track.baseMediaDecodeTime,track.samplerate),frameDuration=Math.ceil(9e4/(track.samplerate/1024)),audioAppendStartTs&&videoBaseMediaDecodeTime&&(audioGapDuration=baseMediaDecodeTimeTs-Math.max(audioAppendStartTs,videoBaseMediaDecodeTime),audioFillDuration=(audioFillFrameCount=Math.floor(audioGapDuration/frameDuration))*frameDuration),!(audioFillFrameCount<1||audioFillDuration>45e3))){for((silentFrame=coneOfSilence[track.samplerate])||(silentFrame=frames[0].data),i=0;i<audioFillFrameCount;i++)frames.splice(i,0,{data:silentFrame});track.baseMediaDecodeTime-=Math.floor(clock.videoTsToAudioTs(audioFillDuration,track.samplerate))}},this.trimAdtsFramesByEarliestDts_=function(adtsFrames){return track.minSegmentDts>=earliestAllowedDts?adtsFrames:(track.minSegmentDts=1/0,adtsFrames.filter(function(currentFrame){return currentFrame.dts>=earliestAllowedDts&&(track.minSegmentDts=Math.min(track.minSegmentDts,currentFrame.dts),track.minSegmentPts=track.minSegmentDts,!0)}))},this.generateSampleTable_=function(frames){var i,currentFrame,samples=[];for(i=0;i<frames.length;i++)currentFrame=frames[i],samples.push({size:currentFrame.data.byteLength,duration:1024});return samples},this.concatenateFrameData_=function(frames){var i,currentFrame,dataOffset=0,data=new Uint8Array(sumFrameByteLengths(frames));for(i=0;i<frames.length;i++)currentFrame=frames[i],data.set(currentFrame.data,dataOffset),dataOffset+=currentFrame.data.byteLength;return data}}).prototype=new Stream,(VideoSegmentStream=function(track){var config,pps,sequenceNumber=0,nalUnits=[];VideoSegmentStream.prototype.init.call(this),delete track.minPTS,this.gopCache_=[],this.push=function(nalUnit){collectDtsInfo(track,nalUnit),"seq_parameter_set_rbsp"!==nalUnit.nalUnitType||config||(config=nalUnit.config,track.sps=[nalUnit.data],VIDEO_PROPERTIES.forEach(function(prop){track[prop]=config[prop]},this)),"pic_parameter_set_rbsp"!==nalUnit.nalUnitType||pps||(pps=nalUnit.data,track.pps=[nalUnit.data]),nalUnits.push(nalUnit)},this.flush=function(){for(var frames,gopForFusion,gops,moof,mdat,boxes;nalUnits.length&&"access_unit_delimiter_rbsp"!==nalUnits[0].nalUnitType;)nalUnits.shift();if(0===nalUnits.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");frames=this.groupNalsIntoFrames_(nalUnits),(gops=this.groupFramesIntoGops_(frames))[0][0].keyFrame||((gopForFusion=this.getGopForFusion_(nalUnits[0],track))?(gops.unshift(gopForFusion),gops.byteLength+=gopForFusion.byteLength,gops.nalCount+=gopForFusion.nalCount,gops.pts=gopForFusion.pts,gops.dts=gopForFusion.dts,gops.duration+=gopForFusion.duration):gops=this.extendFirstKeyFrame_(gops)),collectDtsInfo(track,gops),track.samples=this.generateSampleTable_(gops),mdat=mp4.mdat(this.concatenateNalData_(gops)),this.gopCache_.unshift({gop:gops.pop(),pps:track.pps,sps:track.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),nalUnits=[],track.baseMediaDecodeTime=calculateTrackBaseMediaDecodeTime(track),this.trigger("baseMediaDecodeTime",track.baseMediaDecodeTime),this.trigger("timelineStartInfo",track.timelineStartInfo),moof=mp4.moof(sequenceNumber,[track]),boxes=new Uint8Array(moof.byteLength+mdat.byteLength),sequenceNumber++,boxes.set(moof),boxes.set(mdat,moof.byteLength),this.trigger("data",{track:track,boxes:boxes}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.resetStream_=function(){clearDtsInfo(track),config=void 0,pps=void 0},this.getGopForFusion_=function(nalUnit){var dtsDistance,nearestGopObj,currentGop,currentGopObj,i,nearestDistance=1/0;for(i=0;i<this.gopCache_.length;i++)currentGop=(currentGopObj=this.gopCache_[i]).gop,track.pps&&arrayEquals(track.pps[0],currentGopObj.pps[0])&&track.sps&&arrayEquals(track.sps[0],currentGopObj.sps[0])&&(currentGop.dts<track.timelineStartInfo.dts||(dtsDistance=nalUnit.dts-currentGop.dts-currentGop.duration)>=-1e4&&dtsDistance<=45e3&&(!nearestGopObj||nearestDistance>dtsDistance)&&(nearestGopObj=currentGopObj,nearestDistance=dtsDistance));return nearestGopObj?nearestGopObj.gop:null},this.extendFirstKeyFrame_=function(gops){var currentGop;return!gops[0][0].keyFrame&&gops.length>1&&(currentGop=gops.shift(),gops.byteLength-=currentGop.byteLength,gops.nalCount-=currentGop.nalCount,gops[0][0].dts=currentGop.dts,gops[0][0].pts=currentGop.pts,gops[0][0].duration+=currentGop.duration),gops},this.groupNalsIntoFrames_=function(nalUnits){var i,currentNal,currentFrame=[],frames=[];for(currentFrame.byteLength=0,i=0;i<nalUnits.length;i++)"access_unit_delimiter_rbsp"===(currentNal=nalUnits[i]).nalUnitType?(currentFrame.length&&(currentFrame.duration=currentNal.dts-currentFrame.dts,frames.push(currentFrame)),(currentFrame=[currentNal]).byteLength=currentNal.data.byteLength,currentFrame.pts=currentNal.pts,currentFrame.dts=currentNal.dts):("slice_layer_without_partitioning_rbsp_idr"===currentNal.nalUnitType&&(currentFrame.keyFrame=!0),currentFrame.duration=currentNal.dts-currentFrame.dts,currentFrame.byteLength+=currentNal.data.byteLength,currentFrame.push(currentNal));return frames.length&&(!currentFrame.duration||currentFrame.duration<=0)&&(currentFrame.duration=frames[frames.length-1].duration),frames.push(currentFrame),frames},this.groupFramesIntoGops_=function(frames){var i,currentFrame,currentGop=[],gops=[];for(currentGop.byteLength=0,currentGop.nalCount=0,currentGop.duration=0,currentGop.pts=frames[0].pts,currentGop.dts=frames[0].dts,gops.byteLength=0,gops.nalCount=0,gops.duration=0,gops.pts=frames[0].pts,gops.dts=frames[0].dts,i=0;i<frames.length;i++)(currentFrame=frames[i]).keyFrame?(currentGop.length&&(gops.push(currentGop),gops.byteLength+=currentGop.byteLength,gops.nalCount+=currentGop.nalCount,gops.duration+=currentGop.duration),(currentGop=[currentFrame]).nalCount=currentFrame.length,currentGop.byteLength=currentFrame.byteLength,currentGop.pts=currentFrame.pts,currentGop.dts=currentFrame.dts,currentGop.duration=currentFrame.duration):(currentGop.duration+=currentFrame.duration,currentGop.nalCount+=currentFrame.length,currentGop.byteLength+=currentFrame.byteLength,currentGop.push(currentFrame));return gops.length&&currentGop.duration<=0&&(currentGop.duration=gops[gops.length-1].duration),gops.byteLength+=currentGop.byteLength,gops.nalCount+=currentGop.nalCount,gops.duration+=currentGop.duration,gops.push(currentGop),gops},this.generateSampleTable_=function(gops,baseDataOffset){var h,i,sample,currentGop,currentFrame,dataOffset=baseDataOffset||0,samples=[];for(h=0;h<gops.length;h++)for(currentGop=gops[h],i=0;i<currentGop.length;i++)currentFrame=currentGop[i],(sample={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0}}).dataOffset=dataOffset,sample.compositionTimeOffset=currentFrame.pts-currentFrame.dts,sample.duration=currentFrame.duration,sample.size=4*currentFrame.length,sample.size+=currentFrame.byteLength,currentFrame.keyFrame&&(sample.flags.dependsOn=2),dataOffset+=sample.size,samples.push(sample);return samples},this.concatenateNalData_=function(gops){var h,i,j,currentGop,currentFrame,currentNal,dataOffset=0,totalByteLength=gops.byteLength+4*gops.nalCount,data=new Uint8Array(totalByteLength),view=new DataView(data.buffer);for(h=0;h<gops.length;h++)for(currentGop=gops[h],i=0;i<currentGop.length;i++)for(currentFrame=currentGop[i],j=0;j<currentFrame.length;j++)currentNal=currentFrame[j],view.setUint32(dataOffset,currentNal.data.byteLength),dataOffset+=4,data.set(currentNal.data,dataOffset),dataOffset+=currentNal.data.byteLength;return data}}).prototype=new Stream,collectDtsInfo=function(track,data){"number"==typeof data.pts&&(void 0===track.timelineStartInfo.pts&&(track.timelineStartInfo.pts=data.pts),void 0===track.minSegmentPts?track.minSegmentPts=data.pts:track.minSegmentPts=Math.min(track.minSegmentPts,data.pts),void 0===track.maxSegmentPts?track.maxSegmentPts=data.pts:track.maxSegmentPts=Math.max(track.maxSegmentPts,data.pts)),"number"==typeof data.dts&&(void 0===track.timelineStartInfo.dts&&(track.timelineStartInfo.dts=data.dts),void 0===track.minSegmentDts?track.minSegmentDts=data.dts:track.minSegmentDts=Math.min(track.minSegmentDts,data.dts),void 0===track.maxSegmentDts?track.maxSegmentDts=data.dts:track.maxSegmentDts=Math.max(track.maxSegmentDts,data.dts))},clearDtsInfo=function(track){delete track.minSegmentDts,delete track.maxSegmentDts,delete track.minSegmentPts,delete track.maxSegmentPts},calculateTrackBaseMediaDecodeTime=function(track){var baseMediaDecodeTime,timeSinceStartOfTimeline=track.minSegmentDts-track.timelineStartInfo.dts;return baseMediaDecodeTime=track.timelineStartInfo.baseMediaDecodeTime,baseMediaDecodeTime+=timeSinceStartOfTimeline,baseMediaDecodeTime=Math.max(0,baseMediaDecodeTime),"audio"===track.type&&(baseMediaDecodeTime*=track.samplerate/9e4,baseMediaDecodeTime=Math.floor(baseMediaDecodeTime)),baseMediaDecodeTime},(CoalesceStream=function(options,metadataStream){this.numberOfTracks=0,this.metadataStream=metadataStream,void 0!==options.remux?this.remuxTracks=!!options.remux:this.remuxTracks=!0,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,CoalesceStream.prototype.init.call(this),this.push=function(output){return output.text?this.pendingCaptions.push(output):output.frames?this.pendingMetadata.push(output):(this.pendingTracks.push(output.track),this.pendingBoxes.push(output.boxes),this.pendingBytes+=output.boxes.byteLength,"video"===output.track.type&&(this.videoTrack=output.track),void("audio"===output.track.type&&(this.audioTrack=output.track)))}}).prototype=new Stream,CoalesceStream.prototype.flush=function(flushSource){var caption,id3,initSegment,i,offset=0,event={captions:[],captionStreams:{},metadata:[],info:{}},timelineStartPts=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==flushSource&&"AudioSegmentStream"!==flushSource)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return void(++this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}for(this.videoTrack?(timelineStartPts=this.videoTrack.timelineStartInfo.pts,VIDEO_PROPERTIES.forEach(function(prop){event.info[prop]=this.videoTrack[prop]},this)):this.audioTrack&&(timelineStartPts=this.audioTrack.timelineStartInfo.pts,AUDIO_PROPERTIES.forEach(function(prop){event.info[prop]=this.audioTrack[prop]},this)),1===this.pendingTracks.length?event.type=this.pendingTracks[0].type:event.type="combined",this.emittedTracks+=this.pendingTracks.length,initSegment=mp4.initSegment(this.pendingTracks),event.initSegment=new Uint8Array(initSegment.byteLength),event.initSegment.set(initSegment),event.data=new Uint8Array(this.pendingBytes),i=0;i<this.pendingBoxes.length;i++)event.data.set(this.pendingBoxes[i],offset),offset+=this.pendingBoxes[i].byteLength;for(i=0;i<this.pendingCaptions.length;i++)(caption=this.pendingCaptions[i]).startTime=caption.startPts-timelineStartPts,caption.startTime/=9e4,caption.endTime=caption.endPts-timelineStartPts,caption.endTime/=9e4,event.captionStreams[caption.stream]=!0,event.captions.push(caption);for(i=0;i<this.pendingMetadata.length;i++)(id3=this.pendingMetadata[i]).cueTime=id3.pts-timelineStartPts,id3.cueTime/=9e4,event.metadata.push(id3);event.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",event),this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},(Transmuxer=function(options){var videoTrack,audioTrack,self=this,hasFlushed=!0;Transmuxer.prototype.init.call(this),options=options||{},this.baseMediaDecodeTime=options.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var pipeline={};this.transmuxPipeline_=pipeline,pipeline.type="aac",pipeline.metadataStream=new m2ts.MetadataStream,pipeline.aacStream=new AacStream,pipeline.audioTimestampRolloverStream=new m2ts.TimestampRolloverStream("audio"),pipeline.timedMetadataTimestampRolloverStream=new m2ts.TimestampRolloverStream("timed-metadata"),pipeline.adtsStream=new AdtsStream,pipeline.coalesceStream=new CoalesceStream(options,pipeline.metadataStream),pipeline.headOfPipeline=pipeline.aacStream,pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream),pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream),pipeline.metadataStream.on("timestamp",function(frame){pipeline.aacStream.setTimestamp(frame.timeStamp)}),pipeline.aacStream.on("data",function(data){"timed-metadata"!==data.type||pipeline.audioSegmentStream||(audioTrack=audioTrack||{timelineStartInfo:{baseMediaDecodeTime:self.baseMediaDecodeTime},codec:"adts",type:"audio"},pipeline.coalesceStream.numberOfTracks++,pipeline.audioSegmentStream=new AudioSegmentStream(audioTrack),pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream))}),pipeline.coalesceStream.on("data",this.trigger.bind(this,"data")),pipeline.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setupTsPipeline=function(){var pipeline={};this.transmuxPipeline_=pipeline,pipeline.type="ts",pipeline.metadataStream=new m2ts.MetadataStream,pipeline.packetStream=new m2ts.TransportPacketStream,pipeline.parseStream=new m2ts.TransportParseStream,pipeline.elementaryStream=new m2ts.ElementaryStream,pipeline.videoTimestampRolloverStream=new m2ts.TimestampRolloverStream("video"),pipeline.audioTimestampRolloverStream=new m2ts.TimestampRolloverStream("audio"),pipeline.timedMetadataTimestampRolloverStream=new m2ts.TimestampRolloverStream("timed-metadata"),pipeline.adtsStream=new AdtsStream,pipeline.h264Stream=new H264Stream,pipeline.captionStream=new m2ts.CaptionStream,pipeline.coalesceStream=new CoalesceStream(options,pipeline.metadataStream),pipeline.headOfPipeline=pipeline.packetStream,pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream),pipeline.elementaryStream.pipe(pipeline.videoTimestampRolloverStream).pipe(pipeline.h264Stream),pipeline.elementaryStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream),pipeline.elementaryStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream),pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream),pipeline.elementaryStream.on("data",function(data){var i;if("metadata"===data.type){for(i=data.tracks.length;i--;)videoTrack||"video"!==data.tracks[i].type?audioTrack||"audio"!==data.tracks[i].type||((audioTrack=data.tracks[i]).timelineStartInfo.baseMediaDecodeTime=self.baseMediaDecodeTime):(videoTrack=data.tracks[i]).timelineStartInfo.baseMediaDecodeTime=self.baseMediaDecodeTime;videoTrack&&!pipeline.videoSegmentStream&&(pipeline.coalesceStream.numberOfTracks++,pipeline.videoSegmentStream=new VideoSegmentStream(videoTrack),pipeline.videoSegmentStream.on("timelineStartInfo",function(timelineStartInfo){audioTrack&&(audioTrack.timelineStartInfo=timelineStartInfo,pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts))}),pipeline.videoSegmentStream.on("baseMediaDecodeTime",function(baseMediaDecodeTime){audioTrack&&pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime)}),pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream)),audioTrack&&!pipeline.audioSegmentStream&&(pipeline.coalesceStream.numberOfTracks++,pipeline.audioSegmentStream=new AudioSegmentStream(audioTrack),pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream))}}),pipeline.coalesceStream.on("data",this.trigger.bind(this,"data")),pipeline.coalesceStream.on("done",this.trigger.bind(this,"done"))},this.setBaseMediaDecodeTime=function(baseMediaDecodeTime){var pipeline=this.transmuxPipeline_;this.baseMediaDecodeTime=baseMediaDecodeTime,audioTrack&&(audioTrack.timelineStartInfo.dts=void 0,audioTrack.timelineStartInfo.pts=void 0,clearDtsInfo(audioTrack),audioTrack.timelineStartInfo.baseMediaDecodeTime=baseMediaDecodeTime,pipeline.audioTimestampRolloverStream&&pipeline.audioTimestampRolloverStream.discontinuity()),videoTrack&&(pipeline.videoSegmentStream&&(pipeline.videoSegmentStream.gopCache_=[],pipeline.videoTimestampRolloverStream.discontinuity()),videoTrack.timelineStartInfo.dts=void 0,videoTrack.timelineStartInfo.pts=void 0,clearDtsInfo(videoTrack),pipeline.captionStream.reset(),videoTrack.timelineStartInfo.baseMediaDecodeTime=baseMediaDecodeTime),pipeline.timedMetadataTimestampRolloverStream&&pipeline.timedMetadataTimestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(timestamp){audioTrack&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp)},this.push=function(data){if(hasFlushed){var isAac=isLikelyAacData(data);isAac&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():isAac||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),hasFlushed=!1}this.transmuxPipeline_.headOfPipeline.push(data)},this.flush=function(){hasFlushed=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new Stream,module.exports={Transmuxer:Transmuxer,VideoSegmentStream:VideoSegmentStream,AudioSegmentStream:AudioSegmentStream,AUDIO_PROPERTIES:AUDIO_PROPERTIES,VIDEO_PROPERTIES:VIDEO_PROPERTIES}},{"../aac":37,"../codecs/adts.js":39,"../codecs/h264":40,"../data/silence":41,"../m2ts/m2ts.js":49,"../utils/clock":59,"../utils/stream.js":61,"./mp4-generator.js":55}],58:[function(require,module,exports){"use strict";var StreamTypes=require("../m2ts/stream-types.js"),handleRollover=require("../m2ts/timestamp-rollover-stream.js").handleRollover,probe={};probe.ts=require("../m2ts/probe.js"),probe.aac=require("../aac/probe.js");var isLikelyAacData=function(data){return data[0]==="I".charCodeAt(0)&&data[1]==="D".charCodeAt(0)&&data[2]==="3".charCodeAt(0)},parsePsi_=function(bytes,pmt){for(var packet,startIndex=0,endIndex=188;endIndex<bytes.byteLength;)if(71!==bytes[startIndex]||71!==bytes[endIndex])startIndex++,endIndex++;else{switch(packet=bytes.subarray(startIndex,endIndex),probe.ts.parseType(packet,pmt.pid)){case"pat":pmt.pid||(pmt.pid=probe.ts.parsePat(packet));break;case"pmt":pmt.table||(pmt.table=probe.ts.parsePmt(packet))}if(pmt.pid&&pmt.table)return;startIndex+=188,endIndex+=188}},parseAudioPes_=function(bytes,pmt,result){for(var packet,pesType,pusi,parsed,startIndex=0,endIndex=188,endLoop=!1;endIndex<bytes.byteLength;)if(71!==bytes[startIndex]||71!==bytes[endIndex])startIndex++,endIndex++;else{switch(packet=bytes.subarray(startIndex,endIndex),probe.ts.parseType(packet,pmt.pid)){case"pes":pesType=probe.ts.parsePesType(packet,pmt.table),pusi=probe.ts.parsePayloadUnitStartIndicator(packet),"audio"===pesType&&pusi&&(parsed=probe.ts.parsePesTime(packet))&&(parsed.type="audio",result.audio.push(parsed),endLoop=!0)}if(endLoop)break;startIndex+=188,endIndex+=188}for(startIndex=(endIndex=bytes.byteLength)-188,endLoop=!1;startIndex>=0;)if(71!==bytes[startIndex]||71!==bytes[endIndex])startIndex--,endIndex--;else{switch(packet=bytes.subarray(startIndex,endIndex),probe.ts.parseType(packet,pmt.pid)){case"pes":pesType=probe.ts.parsePesType(packet,pmt.table),pusi=probe.ts.parsePayloadUnitStartIndicator(packet),"audio"===pesType&&pusi&&(parsed=probe.ts.parsePesTime(packet))&&(parsed.type="audio",result.audio.push(parsed),endLoop=!0)}if(endLoop)break;startIndex-=188,endIndex-=188}},parseVideoPes_=function(bytes,pmt,result){for(var packet,pesType,pusi,parsed,frame,i,pes,startIndex=0,endIndex=188,endLoop=!1,currentFrame={data:[],size:0};endIndex<bytes.byteLength;)if(71!==bytes[startIndex]||71!==bytes[endIndex])startIndex++,endIndex++;else{switch(packet=bytes.subarray(startIndex,endIndex),probe.ts.parseType(packet,pmt.pid)){case"pes":if(pesType=probe.ts.parsePesType(packet,pmt.table),pusi=probe.ts.parsePayloadUnitStartIndicator(packet),"video"===pesType&&(pusi&&!endLoop&&(parsed=probe.ts.parsePesTime(packet))&&(parsed.type="video",result.video.push(parsed),endLoop=!0),!result.firstKeyFrame)){if(pusi&&0!==currentFrame.size){for(frame=new Uint8Array(currentFrame.size),i=0;currentFrame.data.length;)pes=currentFrame.data.shift(),frame.set(pes,i),i+=pes.byteLength;probe.ts.videoPacketContainsKeyFrame(frame)&&(result.firstKeyFrame=probe.ts.parsePesTime(frame),result.firstKeyFrame.type="video"),currentFrame.size=0}currentFrame.data.push(packet),currentFrame.size+=packet.byteLength}}if(endLoop&&result.firstKeyFrame)break;startIndex+=188,endIndex+=188}for(startIndex=(endIndex=bytes.byteLength)-188,endLoop=!1;startIndex>=0;)if(71!==bytes[startIndex]||71!==bytes[endIndex])startIndex--,endIndex--;else{switch(packet=bytes.subarray(startIndex,endIndex),probe.ts.parseType(packet,pmt.pid)){case"pes":pesType=probe.ts.parsePesType(packet,pmt.table),pusi=probe.ts.parsePayloadUnitStartIndicator(packet),"video"===pesType&&pusi&&(parsed=probe.ts.parsePesTime(packet))&&(parsed.type="video",result.video.push(parsed),endLoop=!0)}if(endLoop)break;startIndex-=188,endIndex-=188}},adjustTimestamp_=function(segmentInfo,baseTimestamp){if(segmentInfo.audio&&segmentInfo.audio.length){var audioBaseTimestamp=baseTimestamp;void 0===audioBaseTimestamp&&(audioBaseTimestamp=segmentInfo.audio[0].dts),segmentInfo.audio.forEach(function(info){info.dts=handleRollover(info.dts,audioBaseTimestamp),info.pts=handleRollover(info.pts,audioBaseTimestamp),info.dtsTime=info.dts/9e4,info.ptsTime=info.pts/9e4})}if(segmentInfo.video&&segmentInfo.video.length){var videoBaseTimestamp=baseTimestamp;if(void 0===videoBaseTimestamp&&(videoBaseTimestamp=segmentInfo.video[0].dts),segmentInfo.video.forEach(function(info){info.dts=handleRollover(info.dts,videoBaseTimestamp),info.pts=handleRollover(info.pts,videoBaseTimestamp),info.dtsTime=info.dts/9e4,info.ptsTime=info.pts/9e4}),segmentInfo.firstKeyFrame){var frame=segmentInfo.firstKeyFrame;frame.dts=handleRollover(frame.dts,videoBaseTimestamp),frame.pts=handleRollover(frame.pts,videoBaseTimestamp),frame.dtsTime=frame.dts/9e4,frame.ptsTime=frame.dts/9e4}}},inspectAac_=function(bytes){for(var packet,endLoop=!1,audioCount=0,sampleRate=null,timestamp=null,frameSize=0,byteIndex=0;bytes.length-byteIndex>=3;){switch(probe.aac.parseType(bytes,byteIndex)){case"timed-metadata":if(bytes.length-byteIndex<10){endLoop=!0;break}if((frameSize=probe.aac.parseId3TagSize(bytes,byteIndex))>bytes.length){endLoop=!0;break}null===timestamp&&(packet=bytes.subarray(byteIndex,byteIndex+frameSize),timestamp=probe.aac.parseAacTimestamp(packet)),byteIndex+=frameSize;break;case"audio":if(bytes.length-byteIndex<7){endLoop=!0;break}if((frameSize=probe.aac.parseAdtsSize(bytes,byteIndex))>bytes.length){endLoop=!0;break}null===sampleRate&&(packet=bytes.subarray(byteIndex,byteIndex+frameSize),sampleRate=probe.aac.parseSampleRate(packet)),audioCount++,byteIndex+=frameSize;break;default:byteIndex++}if(endLoop)return null}if(null===sampleRate||null===timestamp)return null;var audioTimescale=9e4/sampleRate;return{audio:[{type:"audio",dts:timestamp,pts:timestamp},{type:"audio",dts:timestamp+1024*audioCount*audioTimescale,pts:timestamp+1024*audioCount*audioTimescale}]}},inspectTs_=function(bytes){var pmt={pid:null,table:null},result={};parsePsi_(bytes,pmt);for(var pid in pmt.table)if(pmt.table.hasOwnProperty(pid))switch(pmt.table[pid]){case StreamTypes.H264_STREAM_TYPE:result.video=[],parseVideoPes_(bytes,pmt,result),0===result.video.length&&delete result.video;break;case StreamTypes.ADTS_STREAM_TYPE:result.audio=[],parseAudioPes_(bytes,pmt,result),0===result.audio.length&&delete result.audio}return result};module.exports={inspect:function(bytes,baseTimestamp){var result;return(result=isLikelyAacData(bytes)?inspectAac_(bytes):inspectTs_(bytes))&&(result.audio||result.video)?(adjustTimestamp_(result,baseTimestamp),result):null}}},{"../aac/probe.js":38,"../m2ts/probe.js":51,"../m2ts/stream-types.js":52,"../m2ts/timestamp-rollover-stream.js":53}],59:[function(require,module,exports){var secondsToVideoTs,secondsToAudioTs,videoTsToSeconds,audioTsToSeconds,audioTsToVideoTs,videoTsToAudioTs;secondsToVideoTs=function(seconds){return 9e4*seconds},secondsToAudioTs=function(seconds,sampleRate){return seconds*sampleRate},videoTsToSeconds=function(timestamp){return timestamp/9e4},audioTsToSeconds=function(timestamp,sampleRate){return timestamp/sampleRate},audioTsToVideoTs=function(timestamp,sampleRate){return secondsToVideoTs(audioTsToSeconds(timestamp,sampleRate))},videoTsToAudioTs=function(timestamp,sampleRate){return secondsToAudioTs(videoTsToSeconds(timestamp),sampleRate)},module.exports={secondsToVideoTs:secondsToVideoTs,secondsToAudioTs:secondsToAudioTs,videoTsToSeconds:videoTsToSeconds,audioTsToSeconds:audioTsToSeconds,audioTsToVideoTs:audioTsToVideoTs,videoTsToAudioTs:videoTsToAudioTs}},{}],60:[function(require,module,exports){"use strict";var ExpGolomb;ExpGolomb=function(workingData){var workingBytesAvailable=workingData.byteLength,workingWord=0,workingBitsAvailable=0;this.length=function(){return 8*workingBytesAvailable},this.bitsAvailable=function(){return 8*workingBytesAvailable+workingBitsAvailable},this.loadWord=function(){var position=workingData.byteLength-workingBytesAvailable,workingBytes=new Uint8Array(4),availableBytes=Math.min(4,workingBytesAvailable);if(0===availableBytes)throw new Error("no bytes available");workingBytes.set(workingData.subarray(position,position+availableBytes)),workingWord=new DataView(workingBytes.buffer).getUint32(0),workingBitsAvailable=8*availableBytes,workingBytesAvailable-=availableBytes},this.skipBits=function(count){var skipBytes;workingBitsAvailable>count?(workingWord<<=count,workingBitsAvailable-=count):(count-=workingBitsAvailable,count-=8*(skipBytes=Math.floor(count/8)),workingBytesAvailable-=skipBytes,this.loadWord(),workingWord<<=count,workingBitsAvailable-=count)},this.readBits=function(size){var bits=Math.min(workingBitsAvailable,size),valu=workingWord>>>32-bits;return(workingBitsAvailable-=bits)>0?workingWord<<=bits:workingBytesAvailable>0&&this.loadWord(),(bits=size-bits)>0?valu<<bits|this.readBits(bits):valu},this.skipLeadingZeros=function(){var leadingZeroCount;for(leadingZeroCount=0;leadingZeroCount<workingBitsAvailable;++leadingZeroCount)if(0!=(workingWord&2147483648>>>leadingZeroCount))return workingWord<<=leadingZeroCount,workingBitsAvailable-=leadingZeroCount,leadingZeroCount;return this.loadWord(),leadingZeroCount+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var clz=this.skipLeadingZeros();return this.readBits(clz+1)-1},this.readExpGolomb=function(){var valu=this.readUnsignedExpGolomb();return 1&valu?1+valu>>>1:-1*(valu>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},module.exports=ExpGolomb},{}],61:[function(require,module,exports){"use strict";var Stream=function(){this.init=function(){var listeners={};this.on=function(type,listener){listeners[type]||(listeners[type]=[]),listeners[type]=listeners[type].concat(listener)},this.off=function(type,listener){var index;return!!listeners[type]&&(index=listeners[type].indexOf(listener),listeners[type]=listeners[type].slice(),listeners[type].splice(index,1),index>-1)},this.trigger=function(type){var callbacks,i,length,args;if(callbacks=listeners[type])if(2===arguments.length)for(length=callbacks.length,i=0;i<length;++i)callbacks[i].call(this,arguments[1]);else{for(args=[],i=arguments.length,i=1;i<arguments.length;++i)args.push(arguments[i]);for(length=callbacks.length,i=0;i<length;++i)callbacks[i].apply(this,args)}},this.dispose=function(){listeners={}}}};Stream.prototype.pipe=function(destination){return this.on("data",function(data){destination.push(data)}),this.on("done",function(flushSource){destination.flush(flushSource)}),destination},Stream.prototype.push=function(data){this.trigger("data",data)},Stream.prototype.flush=function(flushSource){this.trigger("done",flushSource)},module.exports=Stream},{}],62:[function(require,module,exports){!function(root){var URLToolkit={buildAbsoluteURL:function(baseURL,relativeURL){if(relativeURL=relativeURL.trim(),/^[a-z]+:/i.test(relativeURL))return relativeURL;var relativeURLQuery=null,relativeURLHash=null,relativeURLHashSplit=/^([^#]*)(.*)$/.exec(relativeURL);relativeURLHashSplit&&(relativeURLHash=relativeURLHashSplit[2],relativeURL=relativeURLHashSplit[1]);var relativeURLQuerySplit=/^([^\?]*)(.*)$/.exec(relativeURL);relativeURLQuerySplit&&(relativeURLQuery=relativeURLQuerySplit[2],relativeURL=relativeURLQuerySplit[1]);var baseURLHashSplit=/^([^#]*)(.*)$/.exec(baseURL);baseURLHashSplit&&(baseURL=baseURLHashSplit[1]);var baseURLQuerySplit=/^([^\?]*)(.*)$/.exec(baseURL);baseURLQuerySplit&&(baseURL=baseURLQuerySplit[1]);var baseURLDomainSplit=/^(([a-z]+:)?\/\/[^:\/]+(:[0-9]+)?)?(\/?.*)$/i.exec(baseURL);if(!baseURLDomainSplit)throw new Error("Error trying to parse base URL.");var baseURLProtocol=baseURLDomainSplit[2]||"",baseURLProtocolDomain=baseURLDomainSplit[1]||"",baseURLPath=baseURLDomainSplit[4];0!==baseURLPath.indexOf("/")&&""!==baseURLProtocolDomain&&(baseURLPath="/"+baseURLPath);var builtURL=null;return builtURL=/^\/\//.test(relativeURL)?baseURLProtocol+"//"+URLToolkit.buildAbsolutePath("",relativeURL.substring(2)):/^\//.test(relativeURL)?baseURLProtocolDomain+"/"+URLToolkit.buildAbsolutePath("",relativeURL.substring(1)):URLToolkit.buildAbsolutePath(baseURLProtocolDomain+baseURLPath,relativeURL),relativeURLQuery&&(builtURL+=relativeURLQuery),relativeURLHash&&(builtURL+=relativeURLHash),builtURL},buildAbsolutePath:function(basePath,relativePath){for(var nUpLn,nEnd,sRelPath=relativePath,sDir="",sPath=basePath.replace(/[^\/]*$/,sRelPath.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),nStart=0;(nEnd=sPath.indexOf("/../",nStart))>-1;nStart=nEnd+nUpLn)nUpLn=/^\/(?:\.\.\/)*/.exec(sPath.slice(nEnd))[0].length,sDir=(sDir+sPath.substring(nStart,nEnd)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(nUpLn-1)/3+"}$"),"/");return sDir+sPath.substr(nStart)}};"object"==typeof exports&&"object"==typeof module?module.exports=URLToolkit:"object"==typeof exports?exports.URLToolkit=URLToolkit:root.URLToolkit=URLToolkit}(this)},{}],63:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _globalWindow2=_interopRequireDefault(require("global/window")),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),deprecateOldCue=function(cue){Object.defineProperties(cue.frame,{id:{get:function(){return _videoJs2.default.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),cue.value.key}},value:{get:function(){return _videoJs2.default.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),cue.value.data}},privateData:{get:function(){return _videoJs2.default.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),cue.value.data}}})},durationOfVideo=function(duration){return isNaN(duration)||Math.abs(duration)===1/0?Number.MAX_VALUE:duration};exports.default={addTextTrackData:function(sourceHandler,captionArray,metadataArray){var Cue=_globalWindow2.default.WebKitDataCue||_globalWindow2.default.VTTCue;captionArray&&captionArray.forEach(function(caption){var track=caption.stream;this.inbandTextTracks_[track].addCue(new Cue(caption.startTime+this.timestampOffset,caption.endTime+this.timestampOffset,caption.text))},sourceHandler),metadataArray&&function(){var videoDuration=durationOfVideo(sourceHandler.mediaSource_.duration);metadataArray.forEach(function(metadata){var time=metadata.cueTime+this.timestampOffset;metadata.frames.forEach(function(frame){var cue=new Cue(time,time,frame.value||frame.url||frame.data||"");cue.frame=frame,cue.value=frame,deprecateOldCue(cue),this.metadataTrack_.addCue(cue)},this)},sourceHandler),sourceHandler.metadataTrack_&&sourceHandler.metadataTrack_.cues&&sourceHandler.metadataTrack_.cues.length&&function(){for(var cues=sourceHandler.metadataTrack_.cues,cuesArray=[],i=0;i<cues.length;i++)cues[i]&&cuesArray.push(cues[i]);var cuesGroupedByStartTime=cuesArray.reduce(function(obj,cue){var timeSlot=obj[cue.startTime]||[];return timeSlot.push(cue),obj[cue.startTime]=timeSlot,obj},{}),sortedStartTimes=Object.keys(cuesGroupedByStartTime).sort(function(a,b){return Number(a)-Number(b)});sortedStartTimes.forEach(function(startTime,idx){var cueGroup=cuesGroupedByStartTime[startTime],nextTime=Number(sortedStartTimes[idx+1])||videoDuration;cueGroup.forEach(function(cue){cue.endTime=nextTime})})}()}()},durationOfVideo:durationOfVideo},module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"global/window":31}],64:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var removeExistingTrack=function(player,kind,label){for(var tracks=player.remoteTextTracks()||[],i=0;i<tracks.length;i++){var track=tracks[i];track.kind===kind&&track.label===label&&player.removeRemoteTextTrack(track)}};exports.removeExistingTrack=removeExistingTrack;exports.cleanupTextTracks=function(player){for(var tracks=player.remoteTextTracks()||[],i=tracks.length-1;i>=0;i--){var track=tracks[i];"captions"===track.kind&&player.removeRemoteTextTrack(track)}removeExistingTrack(player,"metadata","Timed Metadata")}},{}],65:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.default={isAudioCodec:function(codec){return/mp4a\.\d+.\d+/i.test(codec)},parseContentType:function(type){var object={type:"",parameters:{}},parameters=type.trim().split(";");return object.type=parameters.shift().trim(),parameters.forEach(function(parameter){var pair=parameter.trim().split("=");if(pair.length>1){var _name=pair[0].replace(/"/g,"").trim(),value=pair[1].replace(/"/g,"").trim();object.parameters[_name]=value}}),object},isVideoCodec:function(codec){return/avc1\.[\da-f]+/i.test(codec)},translateLegacyCodecs:function(codecs){return codecs.map(function(codec){return codec.replace(/avc1\.(\d+)\.(\d+)/i,function(orig,profile,avcLevel){return"avc1."+("00"+Number(profile).toString(16)).slice(-2)+"00"+("00"+Number(avcLevel).toString(16)).slice(-2)})})}},module.exports=exports.default},{}],66:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _cleanupTextTracks=require("./cleanup-text-tracks");exports.default=function(sourceBuffer,mediaSource,segment){var player=mediaSource.player_;if(segment.captions&&segment.captions.length){sourceBuffer.inbandTextTracks_||(sourceBuffer.inbandTextTracks_={});for(var trackId in segment.captionStreams)if(!sourceBuffer.inbandTextTracks_[trackId]){player.tech_.trigger({type:"usage",name:"hls-608"});var track=player.textTracks().getTrackById(trackId);sourceBuffer.inbandTextTracks_[trackId]=track||player.addRemoteTextTrack({kind:"captions",id:trackId,label:trackId},!1).track}}segment.metadata&&segment.metadata.length&&!sourceBuffer.metadataTrack_&&((0,_cleanupTextTracks.removeExistingTrack)(player,"metadata","Timed Metadata",!0),sourceBuffer.metadataTrack_=player.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,sourceBuffer.metadataTrack_.inBandMetadataTrackDispatchType=segment.metadata.dispatchType)},module.exports=exports.default},{"./cleanup-text-tracks":64}],67:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var flashConstants={TIME_BETWEEN_CHUNKS:1,BYTES_PER_CHUNK:32768};exports.default=flashConstants,module.exports=exports.default},{}],68:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x,_x2,_x3){for(var _again=!0;_again;){var object=_x,property=_x2,receiver=_x3;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x=parent,_x2=property,_x3=receiver,_again=!0,desc=parent=void 0}},_globalDocument2=_interopRequireDefault(require("global/document")),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),_flashSourceBuffer2=_interopRequireDefault(require("./flash-source-buffer")),_flashConstants2=_interopRequireDefault(require("./flash-constants")),_codecUtils=require("./codec-utils"),_cleanupTextTracks=require("./cleanup-text-tracks"),FlashMediaSource=function(_videojs$EventTarget){function FlashMediaSource(){var _this=this;_classCallCheck(this,FlashMediaSource),_get(Object.getPrototypeOf(FlashMediaSource.prototype),"constructor",this).call(this),this.sourceBuffers=[],this.readyState="closed",this.on(["sourceopen","webkitsourceopen"],function(event){_this.swfObj=_globalDocument2.default.getElementById(event.swfId),_this.player_=(0,_videoJs2.default)(_this.swfObj.parentNode),_this.tech_=_this.swfObj.tech,_this.readyState="open",_this.tech_.on("seeking",function(){for(var i=_this.sourceBuffers.length;i--;)_this.sourceBuffers[i].abort()}),_this.tech_.hls&&_this.tech_.hls.on("dispose",function(){(0,_cleanupTextTracks.cleanupTextTracks)(_this.player_)}),_this.swfObj&&_this.swfObj.vjs_load()})}return _inherits(FlashMediaSource,_videoJs2["default"].EventTarget),_createClass(FlashMediaSource,[{key:"addSeekableRange_",value:function(){}},{key:"addSourceBuffer",value:function(type){var parsedType=(0,_codecUtils.parseContentType)(type),sourceBuffer=void 0;if("video/mp2t"!==parsedType.type&&"audio/mp2t"!==parsedType.type)throw new Error("NotSupportedError (Video.js)");return sourceBuffer=new _flashSourceBuffer2.default(this),this.sourceBuffers.push(sourceBuffer),sourceBuffer}},{key:"endOfStream",value:function(error){"network"===error?this.tech_.error(2):"decode"===error&&this.tech_.error(3),"ended"!==this.readyState&&(this.readyState="ended",this.swfObj.vjs_endOfStream())}}]),FlashMediaSource}();exports.default=FlashMediaSource;try{Object.defineProperty(FlashMediaSource.prototype,"duration",{get:function(){return this.swfObj?this.swfObj.vjs_getProperty("duration"):NaN},set:function(value){var i=void 0,oldDuration=this.swfObj.vjs_getProperty("duration");if(this.swfObj.vjs_setProperty("duration",value),value<oldDuration)for(i=0;i<this.sourceBuffers.length;i++)this.sourceBuffers[i].remove(value,oldDuration);return value}})}catch(e){FlashMediaSource.prototype.duration=NaN}for(var property in _flashConstants2.default)FlashMediaSource[property]=_flashConstants2.default[property];module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./cleanup-text-tracks":64,"./codec-utils":65,"./flash-constants":67,"./flash-source-buffer":69,"global/document":30}],69:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x,_x2,_x3){for(var _again=!0;_again;){var object=_x,property=_x2,receiver=_x3;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x=parent,_x2=property,_x3=receiver,_again=!0,desc=parent=void 0}},_globalWindow2=_interopRequireDefault(require("global/window")),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),_muxJsLibFlv2=_interopRequireDefault(require("mux.js/lib/flv")),_removeCuesFromTrack2=_interopRequireDefault(require("./remove-cues-from-track")),_createTextTracksIfNecessary2=_interopRequireDefault(require("./create-text-tracks-if-necessary")),_addTextTrackData=require("./add-text-track-data"),_flashTransmuxerWorker2=_interopRequireDefault(require("./flash-transmuxer-worker")),_webworkify2=_interopRequireDefault(require("webworkify")),_flashConstants2=_interopRequireDefault(require("./flash-constants")),scheduleTick=function(func){_globalWindow2.default.setTimeout(func,_flashConstants2.default.TIME_BETWEEN_CHUNKS)},generateRandomString=function(){return Math.random().toString(36).slice(2,8)},toDecimalPlaces=function(num,places){("number"!=typeof places||places<0)&&(places=0);var scale=Math.pow(10,places);return Math.round(num*scale)/scale},FlashSourceBuffer=function(_videojs$EventTarget){function FlashSourceBuffer(mediaSource){var _this=this;_classCallCheck(this,FlashSourceBuffer),_get(Object.getPrototypeOf(FlashSourceBuffer.prototype),"constructor",this).call(this);var encodedHeader=void 0;this.chunkSize_=_flashConstants2.default.BYTES_PER_CHUNK,this.buffer_=[],this.bufferSize_=0,this.basePtsOffset_=NaN,this.mediaSource_=mediaSource,this.audioBufferEnd_=NaN,this.videoBufferEnd_=NaN,this.updating=!1,this.timestampOffset_=0,encodedHeader=_globalWindow2.default.btoa(String.fromCharCode.apply(null,Array.prototype.slice.call(_muxJsLibFlv2.default.getFlvHeader())));var safePlayerId=this.mediaSource_.player_.id().replace(/[^a-zA-Z0-9]/g,"_");this.flashEncodedHeaderName_="vjs_flashEncodedHeader_"+safePlayerId+generateRandomString(),this.flashEncodedDataName_="vjs_flashEncodedData_"+safePlayerId+generateRandomString(),_globalWindow2.default[this.flashEncodedHeaderName_]=function(){return delete _globalWindow2.default[_this.flashEncodedHeaderName_],encodedHeader},this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedHeaderName_),this.transmuxer_=(0,_webworkify2.default)(_flashTransmuxerWorker2.default),this.transmuxer_.postMessage({action:"init",options:{}}),this.transmuxer_.onmessage=function(event){"data"===event.data.action&&_this.receiveBuffer_(event.data.segment)},this.one("updateend",function(){_this.mediaSource_.tech_.trigger("loadedmetadata")}),Object.defineProperty(this,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(val){"number"==typeof val&&val>=0&&(this.timestampOffset_=val,this.mediaSource_.swfObj.vjs_discontinuity(),this.basePtsOffset_=NaN,this.audioBufferEnd_=NaN,this.videoBufferEnd_=NaN,this.transmuxer_.postMessage({action:"reset"}))}}),Object.defineProperty(this,"buffered",{get:function(){if(!(this.mediaSource_&&this.mediaSource_.swfObj&&"vjs_getProperty"in this.mediaSource_.swfObj))return _videoJs2.default.createTimeRange();var buffered=this.mediaSource_.swfObj.vjs_getProperty("buffered");return buffered&&buffered.length&&(buffered[0][0]=toDecimalPlaces(buffered[0][0],3),buffered[0][1]=toDecimalPlaces(buffered[0][1],3)),_videoJs2.default.createTimeRanges(buffered)}}),this.mediaSource_.player_.on("seeked",function(){if((0,_removeCuesFromTrack2.default)(0,1/0,_this.metadataTrack_),_this.inbandTextTracks_)for(var track in _this.inbandTextTracks_)(0,_removeCuesFromTrack2.default)(0,1/0,_this.inbandTextTracks_[track])});var onHlsReset=this.onHlsReset_.bind(this);this.mediaSource_.player_.tech_.on("hls-reset",onHlsReset),this.mediaSource_.player_.tech_.hls.on("dispose",function(){_this.transmuxer_.terminate(),_this.mediaSource_.player_.tech_.off("hls-reset",onHlsReset)})}return _inherits(FlashSourceBuffer,_videoJs2["default"].EventTarget),_createClass(FlashSourceBuffer,[{key:"appendBuffer",value:function(bytes){var error=void 0;if(this.updating)throw error=new Error("SourceBuffer.append() cannot be called while an update is in progress"),error.name="InvalidStateError",error.code=11,error;this.updating=!0,this.mediaSource_.readyState="open",this.trigger({type:"update"}),this.transmuxer_.postMessage({action:"push",data:bytes.buffer,byteOffset:bytes.byteOffset,byteLength:bytes.byteLength},[bytes.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"abort",value:function(){this.buffer_=[],this.bufferSize_=0,this.mediaSource_.swfObj.vjs_abort(),this.updating&&(this.updating=!1,this.trigger({type:"updateend"}))}},{key:"remove",value:function(start,end){if((0,_removeCuesFromTrack2.default)(start,end,this.metadataTrack_),this.inbandTextTracks_)for(var track in this.inbandTextTracks_)(0,_removeCuesFromTrack2.default)(start,end,this.inbandTextTracks_[track]);this.trigger({type:"update"}),this.trigger({type:"updateend"})}},{key:"receiveBuffer_",value:function(segment){var _this2=this;(0,_createTextTracksIfNecessary2.default)(this,this.mediaSource_,segment),(0,_addTextTrackData.addTextTrackData)(this,segment.captions,segment.metadata),scheduleTick(function(){var flvBytes=_this2.convertTagsToData_(segment);0===_this2.buffer_.length&&scheduleTick(_this2.processBuffer_.bind(_this2)),flvBytes&&(_this2.buffer_.push(flvBytes),_this2.bufferSize_+=flvBytes.byteLength)})}},{key:"processBuffer_",value:function(){var _this3=this,chunkSize=_flashConstants2.default.BYTES_PER_CHUNK;if(this.buffer_.length){var chunk=this.buffer_[0].subarray(0,chunkSize);chunk.byteLength<chunkSize||this.buffer_[0].byteLength===chunkSize?this.buffer_.shift():this.buffer_[0]=this.buffer_[0].subarray(chunkSize),this.bufferSize_-=chunk.byteLength;for(var binary=[],length=chunk.byteLength,i=0;i<length;i++)binary.push(String.fromCharCode(chunk[i]));var b64str=_globalWindow2.default.btoa(binary.join(""));_globalWindow2.default[this.flashEncodedDataName_]=function(){return scheduleTick(_this3.processBuffer_.bind(_this3)),delete _globalWindow2.default[_this3.flashEncodedDataName_],b64str},this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedDataName_)}else!1!==this.updating&&(this.updating=!1,this.trigger({type:"updateend"}))}},{key:"convertTagsToData_",value:function(segmentData){var segmentByteLength=0,tech=this.mediaSource_.tech_,videoTargetPts=0,segment=void 0,videoTags=segmentData.tags.videoTags,audioTags=segmentData.tags.audioTags;if(isNaN(this.basePtsOffset_)&&(videoTags.length||audioTags.length)){var firstVideoTag=videoTags[0]||{pts:1/0},firstAudioTag=audioTags[0]||{pts:1/0};this.basePtsOffset_=Math.min(firstAudioTag.pts,firstVideoTag.pts)}tech.seeking()&&(this.videoBufferEnd_=NaN,this.audioBufferEnd_=NaN),isNaN(this.videoBufferEnd_)?(tech.buffered().length&&(videoTargetPts=tech.buffered().end(0)-this.timestampOffset),tech.seeking()&&(videoTargetPts=Math.max(videoTargetPts,tech.currentTime()-this.timestampOffset)),videoTargetPts*=1e3,videoTargetPts+=this.basePtsOffset_):videoTargetPts=this.videoBufferEnd_+.1;var currentIndex=videoTags.length;if(currentIndex&&videoTags[currentIndex-1].pts>=videoTargetPts){for(;--currentIndex;){var currentTag=videoTags[currentIndex];if(!(currentTag.pts>videoTargetPts)&&(currentTag.keyFrame||currentTag.metaDataTag))break}for(;currentIndex&&videoTags[currentIndex-1].metaDataTag;)currentIndex--}var filteredVideoTags=videoTags.slice(currentIndex),audioTargetPts=void 0;for(audioTargetPts=isNaN(this.audioBufferEnd_)?videoTargetPts:this.audioBufferEnd_+.1,filteredVideoTags.length&&(audioTargetPts=Math.min(audioTargetPts,filteredVideoTags[0].pts)),currentIndex=0;currentIndex<audioTags.length&&!(audioTags[currentIndex].pts>=audioTargetPts);)currentIndex++;var filteredAudioTags=audioTags.slice(currentIndex);filteredAudioTags.length&&(this.audioBufferEnd_=filteredAudioTags[filteredAudioTags.length-1].pts),filteredVideoTags.length&&(this.videoBufferEnd_=filteredVideoTags[filteredVideoTags.length-1].pts);var tags=this.getOrderedTags_(filteredVideoTags,filteredAudioTags);if(0!==tags.length){if(tags[0].pts<videoTargetPts&&tech.seeking()){var adjustedTime=tech.currentTime()-(videoTargetPts-tags[0].pts)/1e3;adjustedTime<1/30&&(adjustedTime=0);try{this.mediaSource_.swfObj.vjs_adjustCurrentTime(adjustedTime)}catch(e){}}for(i=0;i<tags.length;i++)segmentByteLength+=tags[i].bytes.byteLength;segment=new Uint8Array(segmentByteLength);for(var i=0,j=0;i<tags.length;i++)segment.set(tags[i].bytes,j),j+=tags[i].bytes.byteLength;return segment}}},{key:"getOrderedTags_",value:function(videoTags,audioTags){for(var tag=void 0,tags=[];videoTags.length||audioTags.length;)tag=videoTags.length?audioTags.length&&audioTags[0].dts<videoTags[0].dts?audioTags.shift():videoTags.shift():audioTags.shift(),tags.push(tag);return tags}},{key:"onHlsReset_",value:function(){this.transmuxer_.postMessage({action:"resetCaptions"})}}]),FlashSourceBuffer}();exports.default=FlashSourceBuffer,module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./add-text-track-data":63,"./create-text-tracks-if-necessary":66,"./flash-constants":67,"./flash-transmuxer-worker":70,"./remove-cues-from-track":72,"global/window":31,"mux.js/lib/flv":45,webworkify:76}],70:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_globalWindow2=_interopRequireDefault(require("global/window")),_muxJsLibFlv2=_interopRequireDefault(require("mux.js/lib/flv")),wireTransmuxerEvents=function(transmuxer){transmuxer.on("data",function(segment){_globalWindow2.default.postMessage({action:"data",segment:segment})}),transmuxer.on("done",function(data){_globalWindow2.default.postMessage({action:"done"})})},MessageHandlers=function(){function MessageHandlers(options){_classCallCheck(this,MessageHandlers),this.options=options||{},this.init()}return _createClass(MessageHandlers,[{key:"init",value:function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new _muxJsLibFlv2.default.Transmuxer(this.options),wireTransmuxerEvents(this.transmuxer)}},{key:"push",value:function(data){var segment=new Uint8Array(data.data,data.byteOffset,data.byteLength);this.transmuxer.push(segment)}},{key:"reset",value:function(){this.init()}},{key:"flush",value:function(){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}}]),MessageHandlers}(),FlashTransmuxerWorker=function(self){self.onmessage=function(event){"init"===event.data.action&&event.data.options?this.messageHandlers=new MessageHandlers(event.data.options):(this.messageHandlers||(this.messageHandlers=new MessageHandlers),event.data&&event.data.action&&"init"!==event.data.action&&this.messageHandlers[event.data.action]&&this.messageHandlers[event.data.action](event.data))}};exports.default=function(self){return new FlashTransmuxerWorker(self)},module.exports=exports.default},{"global/window":31,"mux.js/lib/flv":45}],71:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x,_x2,_x3){for(var _again=!0;_again;){var object=_x,property=_x2,receiver=_x3;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x=parent,_x2=property,_x3=receiver,_again=!0,desc=parent=void 0}},_globalWindow2=_interopRequireDefault(require("global/window")),_globalDocument2=_interopRequireDefault(require("global/document")),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),_virtualSourceBuffer2=_interopRequireDefault(require("./virtual-source-buffer")),_addTextTrackData=require("./add-text-track-data"),_codecUtils=require("./codec-utils"),_cleanupTextTracks=require("./cleanup-text-tracks"),HtmlMediaSource=function(_videojs$EventTarget){function HtmlMediaSource(){var _this=this;_classCallCheck(this,HtmlMediaSource),_get(Object.getPrototypeOf(HtmlMediaSource.prototype),"constructor",this).call(this);var property=void 0;this.nativeMediaSource_=new _globalWindow2.default.MediaSource;for(property in this.nativeMediaSource_)property in HtmlMediaSource.prototype||"function"!=typeof this.nativeMediaSource_[property]||(this[property]=this.nativeMediaSource_[property].bind(this.nativeMediaSource_));this.duration_=NaN,Object.defineProperty(this,"duration",{get:function(){return this.duration_===1/0?this.duration_:this.nativeMediaSource_.duration},set:function(duration){this.duration_=duration,duration===1/0||(this.nativeMediaSource_.duration=duration)}}),Object.defineProperty(this,"seekable",{get:function(){return this.duration_===1/0?_videoJs2.default.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}}),Object.defineProperty(this,"readyState",{get:function(){return this.nativeMediaSource_.readyState}}),Object.defineProperty(this,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}}),this.sourceBuffers=[],this.activeSourceBuffers_=[],this.updateActiveSourceBuffers_=function(){if(_this.activeSourceBuffers_.length=0,1===_this.sourceBuffers.length){var sourceBuffer=_this.sourceBuffers[0];return sourceBuffer.appendAudioInitSegment_=!0,sourceBuffer.audioDisabled_=!sourceBuffer.audioCodec_,void _this.activeSourceBuffers_.push(sourceBuffer)}for(var disableCombined=!1,disableAudioOnly=!0,i=0;i<_this.player_.audioTracks().length;i++){var track=_this.player_.audioTracks()[i];if(track.enabled&&"main"!==track.kind){disableCombined=!0,disableAudioOnly=!1;break}}_this.sourceBuffers.forEach(function(sourceBuffer){if(sourceBuffer.appendAudioInitSegment_=!0,sourceBuffer.videoCodec_&&sourceBuffer.audioCodec_)sourceBuffer.audioDisabled_=disableCombined;else if(sourceBuffer.videoCodec_&&!sourceBuffer.audioCodec_)sourceBuffer.audioDisabled_=!0,disableAudioOnly=!1;else if(!sourceBuffer.videoCodec_&&sourceBuffer.audioCodec_&&(sourceBuffer.audioDisabled_=disableAudioOnly,disableAudioOnly))return;_this.activeSourceBuffers_.push(sourceBuffer)})},this.onPlayerMediachange_=function(){_this.sourceBuffers.forEach(function(sourceBuffer){sourceBuffer.appendAudioInitSegment_=!0})},this.onHlsReset_=function(){_this.sourceBuffers.forEach(function(sourceBuffer){sourceBuffer.transmuxer_&&sourceBuffer.transmuxer_.postMessage({action:"resetCaptions"})})},["sourceopen","sourceclose","sourceended"].forEach(function(eventName){this.nativeMediaSource_.addEventListener(eventName,this.trigger.bind(this))},this),this.on("sourceopen",function(event){var video=_globalDocument2.default.querySelector('[src="'+_this.url_+'"]');video&&(_this.player_=(0,_videoJs2.default)(video.parentNode),_this.player_.tech_.on("hls-reset",_this.onHlsReset_),_this.player_.audioTracks&&_this.player_.audioTracks()&&(_this.player_.audioTracks().on("change",_this.updateActiveSourceBuffers_),_this.player_.audioTracks().on("addtrack",_this.updateActiveSourceBuffers_),_this.player_.audioTracks().on("removetrack",_this.updateActiveSourceBuffers_)),_this.player_.on("mediachange",_this.onPlayerMediachange_))}),this.on("sourceended",function(event){for(var duration=(0,_addTextTrackData.durationOfVideo)(_this.duration),i=0;i<_this.sourceBuffers.length;i++){var sourcebuffer=_this.sourceBuffers[i],cues=sourcebuffer.metadataTrack_&&sourcebuffer.metadataTrack_.cues;cues&&cues.length&&(cues[cues.length-1].endTime=duration)}}),this.on("sourceclose",function(event){this.sourceBuffers.forEach(function(sourceBuffer){sourceBuffer.transmuxer_&&sourceBuffer.transmuxer_.terminate()}),this.sourceBuffers.length=0,this.player_&&((0,_cleanupTextTracks.cleanupTextTracks)(this.player_),this.player_.audioTracks&&this.player_.audioTracks()&&(this.player_.audioTracks().off("change",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("addtrack",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("removetrack",this.updateActiveSourceBuffers_)),this.player_.el_&&(this.player_.off("mediachange",this.onPlayerMediachange_),this.player_.tech_.off("hls-reset",this.onHlsReset_)))})}return _inherits(HtmlMediaSource,_videoJs2["default"].EventTarget),_createClass(HtmlMediaSource,[{key:"addSeekableRange_",value:function(start,end){var error=void 0;if(this.duration!==1/0)throw error=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity"),error.name="InvalidStateError",error.code=11,error;(end>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=end)}},{key:"addSourceBuffer",value:function(type){var buffer=void 0,parsedType=(0,_codecUtils.parseContentType)(type);if(/^(video|audio)\/mp2t$/i.test(parsedType.type)){var codecs=[];parsedType.parameters&&parsedType.parameters.codecs&&(codecs=parsedType.parameters.codecs.split(","),codecs=(codecs=(0,_codecUtils.translateLegacyCodecs)(codecs)).filter(function(codec){return(0,_codecUtils.isAudioCodec)(codec)||(0,_codecUtils.isVideoCodec)(codec)})),0===codecs.length&&(codecs=["avc1.4d400d","mp4a.40.2"]),buffer=new _virtualSourceBuffer2.default(this,codecs),0!==this.sourceBuffers.length&&(this.sourceBuffers[0].createRealSourceBuffers_(),buffer.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)}else buffer=this.nativeMediaSource_.addSourceBuffer(type);return this.sourceBuffers.push(buffer),buffer}}]),HtmlMediaSource}();exports.default=HtmlMediaSource,module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./add-text-track-data":63,"./cleanup-text-tracks":64,"./codec-utils":65,"./virtual-source-buffer":75,"global/document":30,"global/window":31}],72:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.default=function(start,end,track){var i=void 0,cue=void 0;if(track&&track.cues)for(i=track.cues.length;i--;)(cue=track.cues[i]).startTime<=end&&cue.endTime>=start&&track.removeCue(cue)},module.exports=exports.default},{}],73:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_globalWindow2=_interopRequireDefault(require("global/window")),_muxJsLibMp42=_interopRequireDefault(require("mux.js/lib/mp4")),wireTransmuxerEvents=function(transmuxer){transmuxer.on("data",function(segment){var initArray=segment.initSegment;segment.initSegment={data:initArray.buffer,byteOffset:initArray.byteOffset,byteLength:initArray.byteLength};var typedArray=segment.data;segment.data=typedArray.buffer,_globalWindow2.default.postMessage({action:"data",segment:segment,byteOffset:typedArray.byteOffset,byteLength:typedArray.byteLength},[segment.data])}),transmuxer.captionStream&&transmuxer.captionStream.on("data",function(caption){_globalWindow2.default.postMessage({action:"caption",data:caption})}),transmuxer.on("done",function(data){_globalWindow2.default.postMessage({action:"done"})})},MessageHandlers=function(){function MessageHandlers(options){_classCallCheck(this,MessageHandlers),this.options=options||{},this.init()}return _createClass(MessageHandlers,[{key:"init",value:function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new _muxJsLibMp42.default.Transmuxer(this.options),wireTransmuxerEvents(this.transmuxer)}},{key:"push",value:function(data){var segment=new Uint8Array(data.data,data.byteOffset,data.byteLength);this.transmuxer.push(segment)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(data){var timestampOffset=data.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4*timestampOffset))}},{key:"setAudioAppendStart",value:function(data){this.transmuxer.setAudioAppendStart(Math.ceil(9e4*data.appendStart))}},{key:"flush",value:function(data){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}}]),MessageHandlers}(),TransmuxerWorker=function(self){self.onmessage=function(event){"init"===event.data.action&&event.data.options?this.messageHandlers=new MessageHandlers(event.data.options):(this.messageHandlers||(this.messageHandlers=new MessageHandlers),event.data&&event.data.action&&"init"!==event.data.action&&this.messageHandlers[event.data.action]&&this.messageHandlers[event.data.action](event.data))}};exports.default=function(self){return new TransmuxerWorker(self)},module.exports=exports.default},{"global/window":31,"mux.js/lib/mp4":54}],74:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _globalWindow2=_interopRequireDefault(require("global/window")),_flashMediaSource2=_interopRequireDefault(require("./flash-media-source")),_htmlMediaSource2=_interopRequireDefault(require("./html-media-source")),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),urlCount=0,defaults={mode:"auto"};_videoJs2.default.mediaSources={};var open=function(msObjectURL,swfId){var mediaSource=_videoJs2.default.mediaSources[msObjectURL];if(!mediaSource)throw new Error("Media Source not found (Video.js)");mediaSource.trigger({type:"sourceopen",swfId:swfId})},supportsNativeMediaSources=function(){return!!_globalWindow2.default.MediaSource&&!!_globalWindow2.default.MediaSource.isTypeSupported&&_globalWindow2.default.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},MediaSource=function(options){var settings=_videoJs2.default.mergeOptions(defaults,options);if(this.MediaSource={open:open,supportsNativeMediaSources:supportsNativeMediaSources},"html5"===settings.mode||"auto"===settings.mode&&supportsNativeMediaSources())return new _htmlMediaSource2.default;if(_videoJs2.default.getTech("Flash"))return new _flashMediaSource2.default;throw new Error("Cannot use Flash or Html5 to create a MediaSource for this video")};exports.MediaSource=MediaSource,MediaSource.open=open,MediaSource.supportsNativeMediaSources=supportsNativeMediaSources;var URL={createObjectURL:function(object){var url=void 0;return object instanceof _htmlMediaSource2.default?(url=_globalWindow2.default.URL.createObjectURL(object.nativeMediaSource_),object.url_=url,url):object instanceof _flashMediaSource2.default?(url="blob:vjs-media-source/"+urlCount,urlCount++,_videoJs2.default.mediaSources[url]=object,url):(url=_globalWindow2.default.URL.createObjectURL(object),object.url_=url,url)}};exports.URL=URL,_videoJs2.default.MediaSource=MediaSource,_videoJs2.default.URL=URL}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./flash-media-source":68,"./html-media-source":71,"global/window":31}],75:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x,_x2,_x3){for(var _again=!0;_again;){var object=_x,property=_x2,receiver=_x3;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x=parent,_x2=property,_x3=receiver,_again=!0,desc=parent=void 0}},_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),_createTextTracksIfNecessary2=_interopRequireDefault(require("./create-text-tracks-if-necessary")),_removeCuesFromTrack2=_interopRequireDefault(require("./remove-cues-from-track")),_addTextTrackData=require("./add-text-track-data"),_webworkify2=_interopRequireDefault(require("webworkify")),_transmuxerWorker2=_interopRequireDefault(require("./transmuxer-worker")),_codecUtils=require("./codec-utils"),makeWrappedSourceBuffer=function(mediaSource,mimeType){var sourceBuffer=mediaSource.addSourceBuffer(mimeType),wrapper=Object.create(null);wrapper.updating=!1,wrapper.realBuffer_=sourceBuffer;for(var key in sourceBuffer)!function(key){"function"==typeof sourceBuffer[key]?wrapper[key]=function(){return sourceBuffer[key].apply(sourceBuffer,arguments)}:void 0===wrapper[key]&&Object.defineProperty(wrapper,key,{get:function(){return sourceBuffer[key]},set:function(v){return sourceBuffer[key]=v}})}(key);return wrapper},VirtualSourceBuffer=function(_videojs$EventTarget){function VirtualSourceBuffer(mediaSource,codecs){var _this=this;_classCallCheck(this,VirtualSourceBuffer),_get(Object.getPrototypeOf(VirtualSourceBuffer.prototype),"constructor",this).call(this,_videoJs2.default.EventTarget),this.timestampOffset_=0,this.pendingBuffers_=[],this.bufferUpdating_=!1,this.mediaSource_=mediaSource,this.codecs_=codecs,this.audioCodec_=null,this.videoCodec_=null,this.audioDisabled_=!1,this.appendAudioInitSegment_=!0;var options={remux:!1};this.codecs_.forEach(function(codec){(0,_codecUtils.isAudioCodec)(codec)?_this.audioCodec_=codec:(0,_codecUtils.isVideoCodec)(codec)&&(_this.videoCodec_=codec)}),this.transmuxer_=(0,_webworkify2.default)(_transmuxerWorker2.default),this.transmuxer_.postMessage({action:"init",options:options}),this.transmuxer_.onmessage=function(event){return"data"===event.data.action?_this.data_(event):"done"===event.data.action?_this.done_(event):void 0},Object.defineProperty(this,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(val){"number"==typeof val&&val>=0&&(this.timestampOffset_=val,this.appendAudioInitSegment_=!0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:val}))}}),Object.defineProperty(this,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(start){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=start),this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=start)}}),Object.defineProperty(this,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(this,"buffered",{get:function(){var start=null,end=null,arity=0,extents=[],ranges=[];if(!this.videoBuffer_&&!this.audioBuffer_)return _videoJs2.default.createTimeRange();if(!this.videoBuffer_)return this.audioBuffer_.buffered;if(!this.audioBuffer_)return this.videoBuffer_.buffered;if(this.audioDisabled_)return this.videoBuffer_.buffered;if(0===this.videoBuffer_.buffered.length&&0===this.audioBuffer_.buffered.length)return _videoJs2.default.createTimeRange();for(var videoBuffered=this.videoBuffer_.buffered,audioBuffered=this.audioBuffer_.buffered,count=videoBuffered.length;count--;)extents.push({time:videoBuffered.start(count),type:"start"}),extents.push({time:videoBuffered.end(count),type:"end"});for(count=audioBuffered.length;count--;)extents.push({time:audioBuffered.start(count),type:"start"}),extents.push({time:audioBuffered.end(count),type:"end"});for(extents.sort(function(a,b){return a.time-b.time}),count=0;count<extents.length;count++)"start"===extents[count].type?2===++arity&&(start=extents[count].time):"end"===extents[count].type&&1===--arity&&(end=extents[count].time),null!==start&&null!==end&&(ranges.push([start,end]),start=null,end=null);return _videoJs2.default.createTimeRanges(ranges)}})}return _inherits(VirtualSourceBuffer,_videoJs2["default"].EventTarget),_createClass(VirtualSourceBuffer,[{key:"data_",value:function(event){var segment=event.data.segment;segment.data=new Uint8Array(segment.data,event.data.byteOffset,event.data.byteLength),segment.initSegment=new Uint8Array(segment.initSegment.data,segment.initSegment.byteOffset,segment.initSegment.byteLength),(0,_createTextTracksIfNecessary2.default)(this,this.mediaSource_,segment),this.pendingBuffers_.push(segment)}},{key:"done_",value:function(event){"closed"!==this.mediaSource_.readyState?this.processPendingSegments_():this.pendingBuffers_.length=0}},{key:"createRealSourceBuffers_",value:function(){var _this2=this,types=["audio","video"];types.forEach(function(type){if(_this2[type+"Codec_"]&&!_this2[type+"Buffer_"]){var buffer=null;if(_this2.mediaSource_[type+"Buffer_"])(buffer=_this2.mediaSource_[type+"Buffer_"]).updating=!1;else{var mimeType=type+'/mp4;codecs="'+_this2[type+"Codec_"]+'"';buffer=makeWrappedSourceBuffer(_this2.mediaSource_.nativeMediaSource_,mimeType),_this2.mediaSource_[type+"Buffer_"]=buffer}_this2[type+"Buffer_"]=buffer,["update","updatestart","updateend"].forEach(function(event){buffer.addEventListener(event,function(){if("audio"!==type||!_this2.audioDisabled_)return"updateend"===event&&(_this2[type+"Buffer_"].updating=!1),types.every(function(t){return!("audio"!==t||!_this2.audioDisabled_)||(type===t||!_this2[t+"Buffer_"]||!_this2[t+"Buffer_"].updating)})?_this2.trigger(event):void 0})})}})}},{key:"appendBuffer",value:function(segment){if(this.bufferUpdating_=!0,this.audioBuffer_&&this.audioBuffer_.buffered.length){var audioBuffered=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:audioBuffered.end(audioBuffered.length-1)})}this.transmuxer_.postMessage({action:"push",data:segment.buffer,byteOffset:segment.byteOffset,byteLength:segment.byteLength},[segment.buffer]),this.transmuxer_.postMessage({action:"flush"})}},{key:"remove",value:function(start,end){if(this.videoBuffer_&&(this.videoBuffer_.updating=!0,this.videoBuffer_.remove(start,end)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(start,end)),(0,_removeCuesFromTrack2.default)(start,end,this.metadataTrack_),this.inbandTextTracks_)for(var track in this.inbandTextTracks_)(0,_removeCuesFromTrack2.default)(start,end,this.inbandTextTracks_[track])}},{key:"processPendingSegments_",value:function(){var sortedSegments={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};sortedSegments=this.pendingBuffers_.reduce(function(segmentObj,segment){var type=segment.type,data=segment.data,initSegment=segment.initSegment;return segmentObj[type].segments.push(data),segmentObj[type].bytes+=data.byteLength,segmentObj[type].initSegment=initSegment,segment.captions&&(segmentObj.captions=segmentObj.captions.concat(segment.captions)),segment.info&&(segmentObj[type].info=segment.info),segment.metadata&&(segmentObj.metadata=segmentObj.metadata.concat(segment.metadata)),segmentObj},sortedSegments),this.videoBuffer_||this.audioBuffer_||(0===sortedSegments.video.bytes&&(this.videoCodec_=null),0===sortedSegments.audio.bytes&&(this.audioCodec_=null),this.createRealSourceBuffers_()),sortedSegments.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:sortedSegments.audio.info}),sortedSegments.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:sortedSegments.video.info}),this.appendAudioInitSegment_&&(!this.audioDisabled_&&this.audioBuffer_&&(sortedSegments.audio.segments.unshift(sortedSegments.audio.initSegment),sortedSegments.audio.bytes+=sortedSegments.audio.initSegment.byteLength),this.appendAudioInitSegment_=!1),this.videoBuffer_&&(sortedSegments.video.segments.unshift(sortedSegments.video.initSegment),sortedSegments.video.bytes+=sortedSegments.video.initSegment.byteLength,this.concatAndAppendSegments_(sortedSegments.video,this.videoBuffer_),(0,_addTextTrackData.addTextTrackData)(this,sortedSegments.captions,sortedSegments.metadata)),!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(sortedSegments.audio,this.audioBuffer_),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(segmentObj,destinationBuffer){var offset=0,tempBuffer=void 0;if(segmentObj.bytes){tempBuffer=new Uint8Array(segmentObj.bytes),segmentObj.segments.forEach(function(segment){tempBuffer.set(segment,offset),offset+=segment.byteLength});try{destinationBuffer.updating=!0,destinationBuffer.appendBuffer(tempBuffer)}catch(error){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:error.message,originalError:error})}}}},{key:"abort",value:function(){this.videoBuffer_&&this.videoBuffer_.abort(),!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"reset"}),this.pendingBuffers_.length=0,this.bufferUpdating_=!1}}]),VirtualSourceBuffer}();exports.default=VirtualSourceBuffer,module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./add-text-track-data":63,"./codec-utils":65,"./create-text-tracks-if-necessary":66,"./remove-cues-from-track":72,"./transmuxer-worker":73,webworkify:76}],76:[function(require,module,exports){var bundleFn=arguments[3],sources=arguments[4],cache=arguments[5],stringify=JSON.stringify;module.exports=function(fn){for(var wkey,cacheKeys=Object.keys(cache),i=0,l=cacheKeys.length;i<l;i++){var key=cacheKeys[i];if(cache[key].exports===fn){wkey=key;break}}if(!wkey){wkey=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var wcache={},i=0,l=cacheKeys.length;i<l;i++)wcache[key=cacheKeys[i]]=key;sources[wkey]=[Function(["require","module","exports"],"("+fn+")(self)"),wcache]}var skey=Math.floor(Math.pow(16,8)*Math.random()).toString(16),scache={};scache[wkey]=wkey,sources[skey]=[Function(["require"],"require("+stringify(wkey)+")(self)"),scache];var src="("+bundleFn+")({"+Object.keys(sources).map(function(key){return stringify(key)+":["+sources[key][0]+","+stringify(sources[key][1])+"]"}).join(",")+"},{},["+stringify(skey)+"])",URL=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(URL.createObjectURL(new Blob([src],{type:"text/javascript"})))}},{}],77:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x4,_x5,_x6){for(var _again=!0;_again;){var object=_x4,property=_x5,receiver=_x6;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x4=parent,_x5=property,_x6=receiver,_again=!0,desc=parent=void 0}},_globalDocument2=_interopRequireDefault(require("global/document")),_playlistLoader2=_interopRequireDefault(require("./playlist-loader")),_playlist2=_interopRequireDefault(require("./playlist")),_xhr2=_interopRequireDefault(require("./xhr")),_aesDecrypter=require("aes-decrypter"),_binUtils2=_interopRequireDefault(require("./bin-utils")),_videojsContribMediaSources=require("videojs-contrib-media-sources"),_m3u8Parser2=_interopRequireDefault(require("m3u8-parser")),_videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),_masterPlaylistController=require("./master-playlist-controller"),_config2=_interopRequireDefault(require("./config")),_renditionMixin2=_interopRequireDefault(require("./rendition-mixin")),_globalWindow2=_interopRequireDefault(require("global/window")),_playbackWatcher2=_interopRequireDefault(require("./playback-watcher")),_reloadSourceOnError2=_interopRequireDefault(require("./reload-source-on-error")),_playlistSelectorsJs=require("./playlist-selectors.js"),Hls={PlaylistLoader:_playlistLoader2.default,Playlist:_playlist2.default,Decrypter:_aesDecrypter.Decrypter,AsyncStream:_aesDecrypter.AsyncStream,decrypt:_aesDecrypter.decrypt,utils:_binUtils2.default,STANDARD_PLAYLIST_SELECTOR:_playlistSelectorsJs.lastBandwidthSelector,INITIAL_PLAYLIST_SELECTOR:_playlistSelectorsJs.lowestBitrateCompatibleVariantSelector,comparePlaylistBandwidth:_playlistSelectorsJs.comparePlaylistBandwidth,comparePlaylistResolution:_playlistSelectorsJs.comparePlaylistResolution,xhr:(0,_xhr2.default)()};["GOAL_BUFFER_LENGTH","MAX_GOAL_BUFFER_LENGTH","GOAL_BUFFER_LENGTH_RATE","BUFFER_LOW_WATER_LINE","MAX_BUFFER_LOW_WATER_LINE","BUFFER_LOW_WATER_LINE_RATE","BANDWIDTH_VARIANCE"].forEach(function(prop){Object.defineProperty(Hls,prop,{get:function(){return _videoJs2.default.log.warn("using Hls."+prop+" is UNSAFE be sure you know what you are doing"),_config2.default[prop]},set:function(value){_videoJs2.default.log.warn("using Hls."+prop+" is UNSAFE be sure you know what you are doing"),"number"!=typeof value||value<0?_videoJs2.default.log.warn("value of Hls."+prop+" must be greater than or equal to 0"):_config2.default[prop]=value}})});var handleHlsMediaChange=function(qualityLevels,playlistLoader){for(var newPlaylist=playlistLoader.media(),selectedIndex=-1,i=0;i<qualityLevels.length;i++)if(qualityLevels[i].id===newPlaylist.uri){selectedIndex=i;break}qualityLevels.selectedIndex_=selectedIndex,qualityLevels.trigger({selectedIndex:selectedIndex,type:"change"})},handleHlsLoadedMetadata=function(qualityLevels,hls){hls.representations().forEach(function(rep){qualityLevels.addQualityLevel(rep)}),handleHlsMediaChange(qualityLevels,hls.playlists)};Hls.canPlaySource=function(){return _videoJs2.default.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")},Hls.supportsNativeHls=function(){var video=_globalDocument2.default.createElement("video");return!!_videoJs2.default.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(canItPlay){return/maybe|probably/i.test(video.canPlayType(canItPlay))})}(),Hls.isSupported=function(){return _videoJs2.default.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var USER_AGENT=_globalWindow2.default.navigator&&_globalWindow2.default.navigator.userAgent||"";Hls.supportsAudioInfoChange_=function(){if(_videoJs2.default.browser.IS_FIREFOX){var firefoxVersionMap=/Firefox\/([\d.]+)/i.exec(USER_AGENT);return parseInt(firefoxVersionMap[1],10)>=49}return!0};var Component=_videoJs2.default.getComponent("Component"),HlsHandler=function(_Component){function HlsHandler(source,tech,options){var _this=this;if(_classCallCheck(this,HlsHandler),_get(Object.getPrototypeOf(HlsHandler.prototype),"constructor",this).call(this,tech,options.hls),tech.options_&&tech.options_.playerId){var _player=(0,_videoJs2.default)(tech.options_.playerId);_player.hasOwnProperty("hls")||Object.defineProperty(_player,"hls",{get:function(){return _videoJs2.default.log.warn("player.hls is deprecated. Use player.tech_.hls instead."),tech.trigger({type:"usage",name:"hls-player-access"}),_this}})}if(this.tech_=tech,this.source_=source,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&(tech.featuresNativeVideoTracks||tech.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");this.on(_globalDocument2.default,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(event){var fullscreenElement=_globalDocument2.default.fullscreenElement||_globalDocument2.default.webkitFullscreenElement||_globalDocument2.default.mozFullScreenElement||_globalDocument2.default.msFullscreenElement;fullscreenElement&&fullscreenElement.contains(_this.tech_.el())&&_this.masterPlaylistController_.fastQualityChange_()}),this.on(this.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()}),this.audioTrackChange_=function(){_this.masterPlaylistController_.setupAudio(),_this.tech_.trigger({type:"usage",name:"hls-audio-change"})},this.textTrackChange_=function(){_this.masterPlaylistController_.setupSubtitles()},this.on(this.tech_,"play",this.play)}return _inherits(HlsHandler,Component),_createClass(HlsHandler,[{key:"setOptions_",value:function(){var _this2=this;this.options_.withCredentials=this.options_.withCredentials||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=4194304),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&4194304===this.options_.bandwidth,["withCredentials","bandwidth"].forEach(function(option){void 0!==_this2.source_[option]&&(_this2.options_[option]=_this2.source_[option])}),this.bandwidth=this.options_.bandwidth}},{key:"src",value:function(_src){var _this3=this;_src&&(this.setOptions_(),this.options_.url=this.source_.src,this.options_.tech=this.tech_,this.options_.externHls=Hls,this.masterPlaylistController_=new _masterPlaylistController.MasterPlaylistController(this.options_),this.playbackWatcher_=new _playbackWatcher2.default(_videoJs2.default.mergeOptions(this.options_,{seekable:function(){return _this3.seekable()}})),this.masterPlaylistController_.on("error",function(){_videoJs2.default.players[_this3.tech_.options_.playerId].error(_this3.masterPlaylistController_.error)}),this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):Hls.STANDARD_PLAYLIST_SELECTOR.bind(this),this.masterPlaylistController_.selectInitialPlaylist=Hls.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(selectPlaylist){this.masterPlaylistController_.selectPlaylist=selectPlaylist.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(throughput){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=throughput,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(bandwidth){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=bandwidth,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var invBandwidth=1/(this.bandwidth||1),invThroughput=void 0;return invThroughput=this.throughput>0?1/this.throughput:0,Math.floor(1/(invBandwidth+invThroughput))},set:function(){_videoJs2.default.log.error('The "systemBandwidth" property is read-only')}}}),Object.defineProperties(this.stats,{bandwidth:{get:function(){return _this3.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return _this3.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return _this3.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return _this3.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return _this3.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return _this3.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return _this3.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return _this3.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.masterPlaylistController_.on("sourceopen",function(){_this3.tech_.audioTracks().addEventListener("change",_this3.audioTrackChange_),_this3.tech_.remoteTextTracks().addEventListener("change",_this3.textTrackChange_)}),this.masterPlaylistController_.on("selectedinitialmedia",function(){(0,_renditionMixin2.default)(_this3)}),this.masterPlaylistController_.on("audioupdate",function(){_this3.tech_.clearTracks("audio"),_this3.masterPlaylistController_.activeAudioGroup().forEach(function(audioTrack){_this3.tech_.audioTracks().addTrack(audioTrack)})}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.masterPlaylistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.tech_.ready(function(){return _this3.setupQualityLevels_()}),this.tech_.el()&&this.tech_.src(_videoJs2.default.URL.createObjectURL(this.masterPlaylistController_.mediaSource)))}},{key:"setupQualityLevels_",value:function(){var _this4=this,player=_videoJs2.default.players[this.tech_.options_.playerId];player&&player.qualityLevels&&(this.qualityLevels_=player.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){handleHlsLoadedMetadata(_this4.qualityLevels_,_this4)}),this.playlists.on("mediachange",function(){handleHlsMediaChange(_this4.qualityLevels_,_this4.playlists)}))}},{key:"activeAudioGroup_",value:function(){return this.masterPlaylistController_.activeAudioGroup()}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(currentTime){this.masterPlaylistController_.setCurrentTime(currentTime)}},{key:"duration",value:function(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value:function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_.audioTracks().removeEventListener("change",this.audioTrackChange_),this.tech_.remoteTextTracks().removeEventListener("change",this.textTrackChange_),_get(Object.getPrototypeOf(HlsHandler.prototype),"dispose",this).call(this)}}]),HlsHandler}(),HlsSourceHandler=function HlsSourceHandler(mode){return{canHandleSource:function(srcObj){var options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],localOptions=_videoJs2.default.mergeOptions(_videoJs2.default.options,options);return(!localOptions.hls||!localOptions.hls.mode||localOptions.hls.mode===mode)&&HlsSourceHandler.canPlayType(srcObj.type,localOptions)},handleSource:function(source,tech){var options=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],localOptions=_videoJs2.default.mergeOptions(_videoJs2.default.options,options,{hls:{mode:mode}});return"flash"===mode&&tech.setTimeout(function(){tech.trigger("loadstart")},1),tech.hls=new HlsHandler(source,tech,localOptions),tech.hls.xhr=(0,_xhr2.default)(),tech.hls.src(source.src),tech.hls},canPlayType:function(type){var options=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],localOptions=_videoJs2.default.mergeOptions(_videoJs2.default.options,options);return HlsSourceHandler.canPlayType(type,localOptions)?"maybe":""}}};HlsSourceHandler.canPlayType=function(type,options){if(_videoJs2.default.browser.IE_VERSION&&_videoJs2.default.browser.IE_VERSION<=10)return!1;var mpegurlRE=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;return!(!options.hls.overrideNative&&Hls.supportsNativeHls)&&mpegurlRE.test(type)},void 0!==_videoJs2.default.MediaSource&&void 0!==_videoJs2.default.URL||(_videoJs2.default.MediaSource=_videojsContribMediaSources.MediaSource,_videoJs2.default.URL=_videojsContribMediaSources.URL);var flashTech=_videoJs2.default.getTech("Flash");_videojsContribMediaSources.MediaSource.supportsNativeMediaSources()&&_videoJs2.default.getTech("Html5").registerSourceHandler(HlsSourceHandler("html5"),0),_globalWindow2.default.Uint8Array&&flashTech&&flashTech.registerSourceHandler(HlsSourceHandler("flash")),_videoJs2.default.HlsHandler=HlsHandler,_videoJs2.default.HlsSourceHandler=HlsSourceHandler,_videoJs2.default.Hls=Hls,_videoJs2.default.use||_videoJs2.default.registerComponent("Hls",Hls),_videoJs2.default.m3u8=_m3u8Parser2.default,_videoJs2.default.options.hls=_videoJs2.default.options.hls||{},_videoJs2.default.registerPlugin?_videoJs2.default.registerPlugin("reloadSourceOnError",_reloadSourceOnError2.default):_videoJs2.default.plugin("reloadSourceOnError",_reloadSourceOnError2.default),module.exports={Hls:Hls,HlsHandler:HlsHandler,HlsSourceHandler:HlsSourceHandler}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./bin-utils":2,"./config":3,"./master-playlist-controller":5,"./playback-watcher":7,"./playlist":10,"./playlist-loader":8,"./playlist-selectors.js":9,"./reload-source-on-error":12,"./rendition-mixin":13,"./xhr":20,"aes-decrypter":24,"global/document":30,"global/window":31,"m3u8-parser":32,"videojs-contrib-media-sources":74}]},{},[77])(77)}),function(window,videojs,undefined){"use strict";var VIDEO_EVENTS=videojs.getComponent("Html5").Events,cancelContentPlay=function(player){player.ads.cancelPlayTimeout||(player.ads.cancelPlayTimeout=window.setTimeout(function(){player.ads.cancelPlayTimeout=null,player.paused()||player.pause(),player.one("contentplayback",function(){player.paused()&&player.play()})},1))},getPlayerSnapshot=function(player){var track,i,tech=player.$(".vjs-tech"),tracks=player.remoteTextTracks?player.remoteTextTracks():[],suppressedTracks=[],snapshot={ended:player.ended(),currentSrc:player.currentSrc(),src:player.src(),currentTime:player.currentTime(),type:player.currentType()};for(tech&&(snapshot.nativePoster=tech.poster,snapshot.style=tech.getAttribute("style")),i=tracks.length;i--;)track=tracks[i],suppressedTracks.push({track:track,mode:track.mode}),track.mode="disabled";return snapshot.suppressedTracks=suppressedTracks,snapshot},restorePlayerSnapshot=function(player,snapshot){var trackSnapshot,tech=player.$(".vjs-tech"),attempts=20,suppressedTracks=snapshot.suppressedTracks,restoreTracks=function(){for(var i=suppressedTracks.length;i--;)(trackSnapshot=suppressedTracks[i]).track.mode=trackSnapshot.mode},resume=function(){var ended=!1,updateEnded=function(){ended=!0};player.currentTime(snapshot.currentTime),snapshot.ended?(player.ads.resumeEndedTimeout=window.setTimeout(function(){ended||player.play(),player.off("ended",updateEnded),player.ads.resumeEndedTimeout=null},250),player.on("ended",updateEnded),player.on("dispose",function(){window.clearTimeout(player.ads.resumeEndedTimeout)})):player.play()},tryToResume=function(){return player.off("contentcanplay",tryToResume),player.ads.tryToResumeTimeout_&&(player.clearTimeout(player.ads.tryToResumeTimeout_),player.ads.tryToResumeTimeout_=null),(tech=player.el().querySelector(".vjs-tech")).readyState>1?resume():void 0===tech.seekable?resume():tech.seekable.length>0?resume():void(attempts--?window.setTimeout(tryToResume,50):function(){try{resume()}catch(e){videojs.log.warn("Failed to resume the content after an advertisement",e)}}())};snapshot.nativePoster&&(tech.poster=snapshot.nativePoster),"style"in snapshot&&tech.setAttribute("style",snapshot.style||""),player.src()!==snapshot.src||player.currentSrc()!==snapshot.currentSrc?(player.one("contentloadedmetadata",restoreTracks),player.src({src:snapshot.currentSrc,type:snapshot.type}),player.load(),player.one("contentcanplay",tryToResume),player.ads.tryToResumeTimeout_=player.setTimeout(tryToResume,2e3)):player.ended()&&snapshot.ended||(restoreTracks(),player.play())},removeNativePoster=function(player){var tech=player.$(".vjs-tech");tech&&tech.removeAttribute("poster")},defaults={timeout:5e3,prerollTimeout:100,postrollTimeout:100,debug:!1};videojs.plugin("ads",function(options){var fsmHandler,player=this,settings=videojs.mergeOptions(defaults,options);!function(){var videoEvents=VIDEO_EVENTS.concat(["firstplay","loadedalldata"]),returnTrue=function(){return!0},triggerEvent=function(type,event){event.isImmediatePropagationStopped=returnTrue,event.cancelBubble=!0,event.isPropagationStopped=returnTrue,player.trigger({type:type+event.type,state:player.ads.state,originalEvent:event})};player.on(videoEvents,function(event){if("ad-playback"===player.ads.state)triggerEvent("ad",event);else if("content-playback"===player.ads.state&&"ended"===event.type)triggerEvent("content",event);else if("content-resuming"===player.ads.state){if(player.ads.snapshot){if(player.currentSrc()!==player.ads.snapshot.currentSrc){if("loadstart"===event.type)return;return triggerEvent("content",event)}if(player.ads.snapshot.ended)return"pause"===event.type||"ended"===event.type?void player.addClass("vjs-has-started"):triggerEvent("content",event)}"playing"!==event.type&&triggerEvent("content",event)}})}(),player.on(["addurationchange","adcanplay"],function(){player.currentSrc()!==player.ads.snapshot.currentSrc&&player.play()}),player.ads={state:"content-set",startLinearAdMode:function(){"preroll?"!==player.ads.state&&"content-playback"!==player.ads.state&&"postroll?"!==player.ads.state||player.trigger("adstart")},endLinearAdMode:function(){"ad-playback"===player.ads.state&&player.trigger("adend")},skipLinearAdMode:function(){"ad-playback"!==player.ads.state&&player.trigger("adskip")}},fsmHandler=function(event){var fsm={"content-set":{events:{adscanceled:function(){this.state="content-playback"},adsready:function(){this.state="ads-ready"},play:function(){this.state="ads-ready?",cancelContentPlay(player),removeNativePoster(player)},adserror:function(){this.state="content-playback"},adskip:function(){this.state="content-playback"}}},"ads-ready":{events:{play:function(){this.state="preroll?",cancelContentPlay(player)},adskip:function(){this.state="content-playback"},adserror:function(){this.state="content-playback"}}},"preroll?":{enter:function(){player.addClass("vjs-ad-loading"),player.ads.adTimeoutTimeout=window.setTimeout(function(){player.trigger("adtimeout")},settings.prerollTimeout),player.trigger("readyforpreroll")},leave:function(){window.clearTimeout(player.ads.adTimeoutTimeout),player.removeClass("vjs-ad-loading")},events:{play:function(){cancelContentPlay(player)},adstart:function(){this.state="ad-playback"},adskip:function(){this.state="content-playback"},adtimeout:function(){this.state="content-playback"},adserror:function(){this.state="content-playback"}}},"ads-ready?":{enter:function(){player.addClass("vjs-ad-loading"),player.ads.adTimeoutTimeout=window.setTimeout(function(){player.trigger("adtimeout")},settings.timeout)},leave:function(){window.clearTimeout(player.ads.adTimeoutTimeout),player.removeClass("vjs-ad-loading")},events:{play:function(){cancelContentPlay(player)},adscanceled:function(){this.state="content-playback"},adsready:function(){this.state="preroll?"},adskip:function(){this.state="content-playback"},adtimeout:function(){this.state="content-playback"},adserror:function(){this.state="content-playback"}}},"ad-playback":{enter:function(){this.snapshot=getPlayerSnapshot(player),player.addClass("vjs-ad-playing"),removeNativePoster(player),player.ads.cancelPlayTimeout&&(window.clearTimeout(player.ads.cancelPlayTimeout),player.ads.cancelPlayTimeout=null)},leave:function(){player.removeClass("vjs-ad-playing"),restorePlayerSnapshot(player,this.snapshot),"adend"!==player.ads.triggerevent&&player.trigger("adend")},events:{adend:function(){this.state="content-resuming"},adserror:function(){this.state="content-resuming"}}},"content-resuming":{enter:function(){this.snapshot.ended&&(window.clearTimeout(player.ads._fireEndedTimeout),player.ads._fireEndedTimeout=window.setTimeout(function(){player.trigger("ended")},1e3))},leave:function(){window.clearTimeout(player.ads._fireEndedTimeout)},events:{contentupdate:function(){this.state="content-set"},contentresumed:function(){this.state="content-playback"},playing:function(){this.state="content-playback"},ended:function(){this.state="content-playback"}}},"postroll?":{enter:function(){this.snapshot=getPlayerSnapshot(player),player.addClass("vjs-ad-loading"),player.ads.adTimeoutTimeout=window.setTimeout(function(){player.trigger("adtimeout")},settings.postrollTimeout)},leave:function(){window.clearTimeout(player.ads.adTimeoutTimeout),player.removeClass("vjs-ad-loading")},events:{adstart:function(){this.state="ad-playback"},adskip:function(){this.state="content-resuming",window.setTimeout(function(){player.trigger("ended")},1)},adtimeout:function(){this.state="content-resuming",window.setTimeout(function(){player.trigger("ended")},1)},adserror:function(){this.state="content-resuming",window.setTimeout(function(){player.trigger("ended")},1)}}},"content-playback":{enter:function(){player.ads.cancelPlayTimeout&&(window.clearTimeout(player.ads.cancelPlayTimeout),player.ads.cancelPlayTimeout=null),player.trigger({type:"contentplayback",triggerevent:player.ads.triggerevent})},events:{adsready:function(){player.trigger("readyforpreroll")},adstart:function(){this.state="ad-playback"},contentupdate:function(){player.paused()?this.state="content-set":this.state="ads-ready?"},contentended:function(){this.state="postroll?"}}}};!function(state){var noop=function(){};((fsm[state].events||{})[event.type]||noop).apply(player.ads),state!==player.ads.state&&(player.ads.triggerevent=event.type,(fsm[state].leave||noop).apply(player.ads),(fsm[player.ads.state].enter||noop).apply(player.ads),settings.debug&&videojs.log("ads",player.ads.triggerevent+" triggered: "+state+" -> "+player.ads.state))}(player.ads.state)},player.on(VIDEO_EVENTS.concat(["adtimeout","contentupdate","contentplaying","contentended","contentresumed","adsready","adserror","adscanceled","adstart","adend","adskip"]),fsmHandler),player.ads.contentSrc=player.currentSrc(),function(){var checkSrc=function(){var src;"ad-playback"!==player.ads.state&&(src=player.currentSrc())!==player.ads.contentSrc&&(player.trigger({type:"contentupdate",oldValue:player.ads.contentSrc,newValue:src}),player.ads.contentSrc=src)};player.on("loadstart",checkSrc),window.setTimeout(checkSrc,1)}(),player.paused()||fsmHandler({type:"play"})})}(window,videojs),function(factory){if("function"==typeof define&&define.amd)define(["video.js","videojs-contrib-ads"],function(videojs){factory(window,document,videojs)});else if("object"==typeof exports&&"object"==typeof module){var vjs=require("video.js");require("videojs-contrib-ads"),factory(window,document,vjs)}else factory(window,document,videojs)}(function(window,document,videojs){"use strict";var extend=function(obj){var arg,index,key;for(index=1;index<arguments.length;index++){arg=arguments[index];for(key in arg)arg.hasOwnProperty(key)&&(obj[key]=arg[key])}return obj},ima_defaults={debug:!1,timeout:5e3,prerollTimeout:100,adLabel:"Advertisement",showControlsForJSAds:!0},ImaPlugin=function(player,options,readyCallback){this.player=player;var assignControlAttributes_=function(element,controlName){element.id=this.controlPrefix+controlName,element.className=this.controlPrefix+controlName+" "+controlName}.bind(this),getClassRegexp_=function(className){return new RegExp("(^|[^A-Za-z-])"+className+"((?![A-Za-z-])|$)","gi")},addClass_=function(element,classToAdd){return getClassRegexp_(classToAdd).test(element.className)?element:element.className=element.className.trim()+" "+classToAdd},removeClass_=function(element,classToRemove){var classRegexp=getClassRegexp_(classToRemove);return classRegexp.test(element.className)?element.className=element.className.trim().replace(classRegexp,""):element},createAdContainer_=function(){this.vjsControls=this.player.getChild("controlBar"),this.adContainerDiv=this.vjsControls.el().parentNode.appendChild(document.createElement("div")),assignControlAttributes_(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,this.adContainerDiv.addEventListener("mouseenter",showAdControls_,!1),this.adContainerDiv.addEventListener("mouseleave",hideAdControls_,!1),createControls_(),this.adDisplayContainer=new google.ima.AdDisplayContainer(this.adContainerDiv,this.contentPlayer)}.bind(this),createControls_=function(){this.controlsDiv=document.createElement("div"),assignControlAttributes_(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.countdownDiv=document.createElement("div"),assignControlAttributes_(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.settings.adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.seekBarDiv=document.createElement("div"),assignControlAttributes_(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.progressDiv=document.createElement("div"),assignControlAttributes_(this.progressDiv,"ima-progress-div"),this.playPauseDiv=document.createElement("div"),assignControlAttributes_(this.playPauseDiv,"ima-play-pause-div"),addClass_(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",onAdPlayPauseClick_,!1),this.muteDiv=document.createElement("div"),assignControlAttributes_(this.muteDiv,"ima-mute-div"),addClass_(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",onAdMuteClick_,!1),this.sliderDiv=document.createElement("div"),assignControlAttributes_(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",onAdVolumeSliderMouseDown_,!1),this.sliderLevelDiv=document.createElement("div"),assignControlAttributes_(this.sliderLevelDiv,"ima-slider-level-div"),this.fullscreenDiv=document.createElement("div"),assignControlAttributes_(this.fullscreenDiv,"ima-fullscreen-div"),addClass_(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",onAdFullscreenClick_,!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)}.bind(this);this.initializeAdDisplayContainer=function(){this.adDisplayContainerInitialized=!0,this.adDisplayContainer.initialize()}.bind(this),this.requestAds=function(){this.adDisplayContainerInitialized||this.adDisplayContainer.initialize();var adsRequest=new google.ima.AdsRequest;this.settings.adTagUrl?adsRequest.adTagUrl=this.settings.adTagUrl:adsRequest.adsResponse=this.settings.adsResponse,this.settings.forceNonLinearFullSlot&&(adsRequest.forceNonLinearFullSlot=!0),adsRequest.linearAdSlotWidth=this.getPlayerWidth(),adsRequest.linearAdSlotHeight=this.getPlayerHeight(),adsRequest.nonLinearAdSlotWidth=this.settings.nonLinearWidth||this.getPlayerWidth(),adsRequest.nonLinearAdSlotHeight=this.settings.nonLinearHeight||this.getPlayerHeight()/3,adsRequest.setAdWillAutoPlay(this.settings.adWillAutoPlay),this.adsLoader.requestAds(adsRequest)}.bind(this);var onAdsManagerLoaded_=function(adsManagerLoadedEvent){if(this.adsManager=adsManagerLoadedEvent.getAdsManager(this.contentPlayheadTracker,this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,onAdError_),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,onAdBreakReady_),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested_),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested_),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,onAllAdsCompleted_),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,onAdLoaded_),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,onAdStarted_),this.adsManager.addEventListener(google.ima.AdEvent.Type.CLICK,onAdPlayPauseClick_),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete_),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete_),!this.autoPlayAdBreaks)try{var initWidth=this.getPlayerWidth(),initHeight=this.getPlayerHeight();this.adsManagerDimensions.width=initWidth,this.adsManagerDimensions.height=initHeight,this.adsManager.init(initWidth,initHeight,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.player.muted()?0:this.player.volume())}catch(adError){onAdError_(adError)}this.player.trigger("adsready")}.bind(this);this.start=function(){window.console.log("WARNING: player.ima.start is deprecated. Use player.ima.startFromReadyCallback instead.")},this.startFromReadyCallback=function(){if(this.autoPlayAdBreaks)try{this.adsManager.init(this.getPlayerWidth(),this.getPlayerHeight(),google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.player.muted()?0:this.player.volume()),this.adsManager.start()}catch(adError){onAdError_(adError)}}.bind(this);var onAdsLoaderError_=function(event){window.console.log("AdsLoader error: "+event.getError()),this.adContainerDiv.style.display="none",this.adsManager&&this.adsManager.destroy(),this.player.trigger({type:"adserror",data:{AdError:event.getError(),AdErrorEvent:event}})}.bind(this),onAdError_=function(adErrorEvent){var errorMessage=void 0!==adErrorEvent.getError?adErrorEvent.getError():adErrorEvent.stack;window.console.log("Ad error: "+errorMessage),this.vjsControls.show(),this.adsManager.destroy(),this.adContainerDiv.style.display="none",this.player.trigger({type:"adserror",data:{AdError:errorMessage,AdErrorEvent:adErrorEvent}})}.bind(this),onAdBreakReady_=function(adEvent){this.adBreakReadyListener(adEvent)}.bind(this);this.playAdBreak=function(){this.autoPlayAdBreaks||this.adsManager.start()}.bind(this),this.onContentPauseRequested_=function(adEvent){this.adsActive=!0,this.adPlaying=!0,this.contentSource=this.player.currentSrc(),this.player.off("ended",this.localContentEndedListener),-1!=adEvent.getAd().getAdPodInfo().getPodIndex()&&this.player.ads.startLinearAdMode(),this.adContainerDiv.style.display="block","application/javascript"!==adEvent.getAd().getContentType()||this.settings.showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.vjsControls.hide(),showPlayButton(),this.player.pause()}.bind(this),this.onContentResumeRequested_=function(adEvent){this.adsActive=!1,this.adPlaying=!1,this.player.on("ended",this.localContentEndedListener),(null==this.currentAd||this.currentAd.isLinear())&&(this.adContainerDiv.style.display="none"),this.vjsControls.show(),this.currentAd?this.contentComplete||-1==this.currentAd.getAdPodInfo().getPodIndex()||this.player.ads.endLinearAdMode():this.player.ads.endLinearAdMode(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""}.bind(this);var onAllAdsCompleted_=function(adEvent){if(this.allAdsCompleted=!0,this.adContainerDiv.style.display="none",1==this.contentComplete){this.contentPlayer.src!=this.contentSource&&this.player.src(this.contentSource);for(var index in this.contentAndAdsEndedListeners)this.contentAndAdsEndedListeners[index]()}}.bind(this),onAdLoaded_=function(adEvent){adEvent.getAd().isLinear()||this.player.play()}.bind(this),onAdStarted_=function(adEvent){this.currentAd=adEvent.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(onAdPlayheadTrackerInterval_,250),removeClass_(this.adContainerDiv,"bumpable-ima-ad-container")):addClass_(this.adContainerDiv,"bumpable-ima-ad-container"),this.adContainerDiv.style.display="block"}.bind(this);this.onAdComplete_=function(adEvent){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)}.bind(this);var onAdPlayheadTrackerInterval_=function(){var remainingTime=this.adsManager.getRemainingTime(),duration=this.currentAd.getDuration(),currentTime=duration-remainingTime;currentTime=currentTime>0?currentTime:0;var adPosition,isPod=!1,totalAds=0;this.currentAd.getAdPodInfo()&&(isPod=!0,adPosition=this.currentAd.getAdPodInfo().getAdPosition(),totalAds=this.currentAd.getAdPodInfo().getTotalAds());var remainingMinutes=Math.floor(remainingTime/60),remainingSeconds=Math.floor(remainingTime%60);remainingSeconds.toString().length<2&&(remainingSeconds="0"+remainingSeconds);var podCount=": ";isPod&&totalAds>1&&(podCount=" ("+adPosition+" of "+totalAds+"): "),this.countdownDiv.innerHTML=this.settings.adLabel+podCount+remainingMinutes+":"+remainingSeconds;var playProgressPercent=100*(currentTime/duration);this.progressDiv.style.width=playProgressPercent+"%"}.bind(this);this.getPlayerWidth=function(){var computedStyle=getComputedStyle(this.player.el())||{};return parseInt(computedStyle.width,10)||this.player.width()}.bind(this),this.getPlayerHeight=function(){var computedStyle=getComputedStyle(this.player.el())||{};return parseInt(computedStyle.height,10)||this.player.height()}.bind(this);var hideAdControls_=function(){this.controlsDiv.style.height="14px",this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"}.bind(this),showAdControls_=function(){this.controlsDiv.style.height="37px",this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.sliderDiv.style.display="block",this.fullscreenDiv.style.display="block"}.bind(this),showPauseButton=function(){addClass_(this.playPauseDiv,"ima-paused"),removeClass_(this.playPauseDiv,"ima-playing")}.bind(this),showPlayButton=function(){addClass_(this.playPauseDiv,"ima-playing"),removeClass_(this.playPauseDiv,"ima-paused")}.bind(this),onAdPlayPauseClick_=function(){this.adPlaying?(showPauseButton(),this.adsManager.pause(),this.adPlaying=!1):(showPlayButton(),this.adsManager.resume(),this.adPlaying=!0)}.bind(this),onAdMuteClick_=function(){this.adMuted?(addClass_(this.muteDiv,"ima-non-muted"),removeClass_(this.muteDiv,"ima-muted"),this.adsManager.setVolume(1),this.player.muted(!1),this.adMuted=!1,this.sliderLevelDiv.style.width=100*this.player.volume()+"%"):(addClass_(this.muteDiv,"ima-muted"),removeClass_(this.muteDiv,"ima-non-muted"),this.adsManager.setVolume(0),this.player.muted(!0),this.adMuted=!0,this.sliderLevelDiv.style.width="0%")}.bind(this),onAdVolumeSliderMouseDown_=function(){document.addEventListener("mouseup",onMouseUp_,!1),document.addEventListener("mousemove",onMouseMove_,!1)},onMouseMove_=function(event){setVolumeSlider_(event)},onMouseUp_=function(event){setVolumeSlider_(event),document.removeEventListener("mousemove",onMouseMove_),document.removeEventListener("mouseup",onMouseUp_)},setVolumeSlider_=function(event){var percent=(event.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;percent*=100,percent=Math.min(Math.max(percent,0),100),this.sliderLevelDiv.style.width=percent+"%",this.player.volume(percent/100),this.adsManager.setVolume(percent/100),0==this.player.volume()?(addClass_(this.muteDiv,"ima-muted"),removeClass_(this.muteDiv,"ima-non-muted"),this.player.muted(!0),this.adMuted=!0):(addClass_(this.muteDiv,"ima-non-muted"),removeClass_(this.muteDiv,"ima-muted"),this.player.muted(!1),this.adMuted=!1)}.bind(this),onAdFullscreenClick_=function(){this.player.isFullscreen()?this.player.exitFullscreen():this.player.requestFullscreen()}.bind(this),onFullscreenChange_=function(){this.player.isFullscreen()?(addClass_(this.fullscreenDiv,"ima-fullscreen"),removeClass_(this.fullscreenDiv,"ima-non-fullscreen"),this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)):(addClass_(this.fullscreenDiv,"ima-non-fullscreen"),removeClass_(this.fullscreenDiv,"ima-fullscreen"),this.adsManager&&this.adsManager.resize(this.getPlayerWidth(),this.getPlayerHeight(),google.ima.ViewMode.NORMAL))}.bind(this),onVolumeChange_=function(){var newVolume=this.player.muted()?0:this.player.volume();this.adsManager&&this.adsManager.setVolume(newVolume),0==newVolume?(this.adMuted=!0,addClass_(this.muteDiv,"ima-muted"),removeClass_(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.adMuted=!1,addClass_(this.muteDiv,"ima-non-muted"),removeClass_(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*newVolume+"%")}.bind(this),seekContentToZero_=function(){this.player.off("loadedmetadata",seekContentToZero_),this.player.currentTime(0)}.bind(this),playContentFromZero_=function(){this.player.off("loadedmetadata",playContentFromZero_),this.player.currentTime(0),this.player.play()}.bind(this),resetIMA_=function(){this.adsActive=!1,this.adPlaying=!1,this.player.on("ended",this.localContentEndedListener),this.vjsControls.show(),this.player.ads.endLinearAdMode(),this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.contentPlayheadTracker.currentTime=0,this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentComplete&&this.adsLoader.contentComplete(),this.contentComplete=!1,this.allAdsCompleted=!1}.bind(this);this.addEventListener=function(event,callback){this.adsManager&&this.adsManager.addEventListener(event,callback)}.bind(this),this.getAdsManager=function(){return this.adsManager}.bind(this),this.setContent=function(contentSrc,adTag,playOnLoad){window.console.log("WARNING: player.ima.setContent is deprecated. Use player.ima.setContentWithAdTag instead."),this.setContentWithAdTag(contentSrc,adTag,playOnLoad)}.bind(this),this.setContentWithAdTag=function(contentSrc,adTag,playOnLoad){resetIMA_(),this.settings.adTagUrl=adTag||this.settings.adTagUrl,changeSource_(contentSrc,playOnLoad)}.bind(this),this.setContentWithAdsResponse=function(contentSrc,adsResponse,playOnLoad){resetIMA_(),this.settings.adsResponse=adsResponse||this.settings.adsResponse,changeSource_(contentSrc,playOnLoad)}.bind(this),this.changeAdTag=function(adTag){resetIMA_(),this.settings.adTagUrl=adTag}.bind(this);var changeSource_=function(contentSrc,playOnLoad){this.player.currentSrc()&&(this.player.currentTime(0),this.player.pause()),contentSrc&&this.player.src(contentSrc),playOnLoad?this.player.on("loadedmetadata",playContentFromZero_):this.player.on("loadedmetadata",seekContentToZero_)}.bind(this);this.addContentEndedListener=function(listener){this.contentEndedListeners.push(listener)}.bind(this),this.addContentAndAdsEndedListener=function(listener){this.contentAndAdsEndedListeners.push(listener)}.bind(this),this.setAdBreakReadyListener=function(listener){this.adBreakReadyListener=listener}.bind(this),this.pauseAd=function(){this.adsActive&&this.adPlaying&&(showPauseButton(),this.adsManager.pause(),this.adPlaying=!1)}.bind(this),this.resumeAd=function(){this.adsActive&&!this.adPlaying&&(showPlayButton(),this.adsManager.resume(),this.adPlaying=!0)}.bind(this);var setUpPlayerIntervals_=function(){this.updateTimeIntervalHandle=setInterval(updateCurrentTime_,this.seekCheckInterval),this.seekCheckIntervalHandle=setInterval(checkForSeeking_,this.seekCheckInterval),this.resizeCheckIntervalHandle=setInterval(checkForResize_,this.resizeCheckInterval)}.bind(this),updateCurrentTime_=function(){this.contentPlayheadTracker.seeking||(this.contentPlayheadTracker.currentTime=this.player.currentTime())}.bind(this),checkForSeeking_=function(){var diff=1e3*(this.player.currentTime()-this.contentPlayheadTracker.previousTime);Math.abs(diff)>this.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.player.currentTime()}.bind(this),checkForResize_=function(){var currentWidth=this.getPlayerWidth(),currentHeight=this.getPlayerHeight();!this.adsManager||currentWidth==this.adsManagerDimensions.width&&currentHeight==this.adsManagerDimensions.height||(this.adsManagerDimensions.width=currentWidth,this.adsManagerDimensions.height=currentHeight,this.adsManager.resize(currentWidth,currentHeight,google.ima.ViewMode.NORMAL))}.bind(this);if(this.setShowCountdown=function(showCountdownIn){this.showCountdown=showCountdownIn,this.countdownDiv.style.display=this.showCountdown?"block":"none"}.bind(this),this.VERSION="0.2.0",this.settings,this.controlPrefix,this.contentPlayer,this.showCountdown,this.autoPlayAdBreaks,this.vjsControls,this.adContainerDiv,this.controlsDiv,this.countdownDiv,this.seekBarDiv,this.progressDiv,this.playPauseDiv,this.muteDiv,this.sliderDiv,this.sliderLevelDiv,this.fullscreenDiv,this.adDisplayContainer,this.adDisplayContainerInitialized=!1,this.adsLoader,this.adsManager,this.adsRenderingSettings=null,this.adTagUrl,this.adsResponse,this.currentAd,this.contentTrackingTimer,this.adTrackingTimer,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.contentComplete=!1,this.allAdsCompleted=!1,this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.seekCheckInterval=1e3,this.resizeCheckIntervalHandle,this.resizeCheckInterval=250,this.seekThreshold=100,this.contentPlayheadTracker={currentTime:0,previousTime:0,seeking:!1,duration:0},this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.adsManagerDimensions={width:0,height:0},this.contentEndedListeners=[],this.contentAndAdsEndedListeners=[],this.adBreakReadyListener=void 0,this.contentSource="",this.localContentEndedListener=function(){this.adsLoader&&!this.contentComplete&&(this.adsLoader.contentComplete(),this.contentComplete=!0);for(var index in this.contentEndedListeners)this.contentEndedListeners[index]();if(this.allAdsCompleted)for(var index in this.contentAndAdsEndedListeners)this.contentAndAdsEndedListeners[index]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.player.el()&&this.player.one("play",setUpPlayerIntervals_)}.bind(this),this.playerDisposedListener=function(){this.contentEndedListeners,this.contentAndAdsEndedListeners=[],this.contentComplete=!0,this.player.off("ended",this.localContentEndedListener),this.player.ads.adTimeoutTimeout&&clearTimeout(this.player.ads.adTimeoutTimeout);var intervalsToClear=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.adTrackingTimer,this.resizeCheckIntervalHandle];for(var index in intervalsToClear){var interval=intervalsToClear[index];interval&&clearInterval(interval)}this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)}.bind(this),this.settings=extend({},ima_defaults,options||{}),this.settings.id){this.controlPrefix=this.settings.id+"_"||"",this.contentPlayer=document.getElementById(this.settings.id+"_html5_api"),this.contentPlayer.hasAttribute("autoplay")&&(this.settings.adWillAutoPlay=this.settings.adWillAutoPlay||!0),this.showCountdown=!0,0==this.settings.showCountdown&&(this.showCountdown=!1),this.autoPlayAdBreaks=!0,0==this.settings.autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),player.one("play",setUpPlayerIntervals_),player.on("ended",this.localContentEndedListener),player.on("dispose",this.playerDisposedListener);var contrib_ads_defaults={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},ads_plugin_settings=extend({},contrib_ads_defaults,options.contribAdsSettings||{});if(player.ads(ads_plugin_settings),this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.settings.adsRenderingSettings)for(var setting in this.settings.adsRenderingSettings)this.adsRenderingSettings[setting]=this.settings.adsRenderingSettings[setting];this.settings.locale&&google.ima.settings.setLocale(this.settings.locale),createAdContainer_(),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.settings.vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.settings.vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.settings.vpaidMode),this.settings.locale&&this.adsLoader.getSettings().setLocale(this.settings.locale),this.settings.numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.settings.numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(this.VERSION),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,onAdsManagerLoaded_,!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,onAdsLoaderError_,!1),readyCallback||(readyCallback=this.startFromReadyCallback),player.on("readyforpreroll",readyCallback),player.ready(function(){onVolumeChange_(),player.on("fullscreenchange",onFullscreenChange_),player.on("volumechange",onVolumeChange_)})}else window.console.log("Error: must provide id of video.js div")};videojs.plugin("ima",function(options,readyCallback){this.ima=new ImaPlugin(this,options,readyCallback)})}),function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;((t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).video||(t.video={})).jsChromecast=e()}}(function(){return function e(t,i,o){function n(r,s){if(!i[r]){if(!t[r]){var c="function"==typeof require&&require;if(!s&&c)return c(r,!0);if(a)return a(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var d=i[r]={exports:{}};t[r][0].call(d.exports,function(e){var i=t[r][1][e];return n(i||e)},d,d.exports,e,t,i,o)}return i[r].exports}for(var a="function"==typeof require&&require,r=0;r<o.length;r++)n(o[r]);return n}({1:[function(e,t,i){(function(e){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,i,o){return i&&e(t.prototype,i),o&&e(t,o),t}}(),s=function(e,t,i){for(var o=!0;o;){var n=e,a=t,r=i;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var c=s.get;if(void 0===c)return;return c.call(r)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,i=r,o=!0,s=u=void 0}},u=function(e){return e&&e.__esModule?e:{default:e}}("undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null),d=u.default.getComponent("Component"),l=u.default.getComponent("ControlBar"),p=u.default.getComponent("Button"),h=function(e){function t(e,i){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e,i),this.hide(),this.initializeApi(),i.appId=e.options_.chromecast.appId,e.chromecast=this}return a(t,p),r(t,[{key:"initializeApi",value:function(){var e=void 0,t=void 0,i=void 0;return u.default.browser.IS_CHROME&&!u.default.browser.IS_EDGE?chrome.cast&&chrome.cast.isAvailable?(u.default.log("Cast APIs are available"),t=this.options_.appId||chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,i=new chrome.cast.SessionRequest(t),e=new chrome.cast.ApiConfig(i,this.sessionJoinedListener.bind(this),this.receiverListener.bind(this)),chrome.cast.initialize(e,this.onInitSuccess.bind(this),this.castError.bind(this))):(u.default.log("Cast APIs not available"),this.tryingReconnect<10&&(this.setTimeout(this.initializeApi,1e3),++this.tryingReconnect),void u.default.log("Cast APIs not available. Max reconnect attempt")):void 0}},{key:"castError",value:function(e){var t={code:e.code,message:e.description};switch(e.code){case chrome.cast.ErrorCode.API_NOT_INITIALIZED:case chrome.cast.ErrorCode.EXTENSION_MISSING:case chrome.cast.ErrorCode.EXTENSION_NOT_COMPATIBLE:case chrome.cast.ErrorCode.INVALID_PARAMETER:case chrome.cast.ErrorCode.LOAD_MEDIA_FAILED:case chrome.cast.ErrorCode.RECEIVER_UNAVAILABLE:case chrome.cast.ErrorCode.SESSION_ERROR:case chrome.cast.ErrorCode.CHANNEL_ERROR:case chrome.cast.ErrorCode.TIMEOUT:this.addClass("error");break;case chrome.cast.ErrorCode.CANCEL:break;default:this.player_.error(t)}return u.default.log("Cast Error: "+JSON.stringify(e))}},{key:"onInitSuccess",value:function(){return this.apiInitialized=!0}},{key:"sessionJoinedListener",value:function(e){return e.media.length&&(this.apiSession=e,this.onMediaDiscovered(e.media[0])),console.log("Session joined")}},{key:"receiverListener",value:function(e){return"available"===e?this.show():void 0}},{key:"doLaunch",value:function(){return u.default.log("Cast video: "+this.player_.cache_.src),this.apiInitialized?chrome.cast.requestSession(this.onSessionSuccess.bind(this),this.castError.bind(this)):u.default.log("Session not initialized")}},{key:"onSessionSuccess",value:function(e){var t=void 0,i=void 0,o=void 0,n=void 0,a=void 0,r=void 0;this.apiSession=e;var s=this.player_.cache_.src,c=this.player_.currentType();if(u.default.log("Session initialized: "+e.sessionId+" source : "+s+" type : "+c),n=new chrome.cast.media.MediaInfo(s,c),n.metadata=new chrome.cast.media.GenericMediaMetadata,this.options_.metadata){a=this.options_.metadata;for(i in a)r=a[i],n.metadata[i]=r}var d=this.player().poster();d&&(t=new chrome.cast.Image(d),n.metadata.images=[t]);var l=this.player().textTracks(),p=this.player().remoteTextTrackEls(),h=[],f=0,v=void 0,y=void 0,m=0,g=void 0;if(l){for(f=0;f<l.length;f++)y=l.tracks_[f],v=p&&p.trackElements_&&p.trackElements_[f],m++,g=new chrome.cast.media.Track(m,chrome.cast.media.TrackType.TEXT),g.trackContentId=v?v.src:"caption_"+y.language,g.subtype=chrome.cast.media.TextTrackType.CAPTIONS,g.name=y.label,g.language=y.language,g.customData=null,h.push(g);n.textTrackStyle=new chrome.cast.media.TextTrackStyle,n.textTrackStyle.foregroundColor="#FFFFFF",n.textTrackStyle.backgroundColor="#00000060",n.textTrackStyle.edgeType=chrome.cast.media.TextTrackEdgeType.DROP_SHADOW,n.textTrackStyle.windowType=chrome.cast.media.TextTrackWindowType.ROUNDED_CORNERS}try{if(l=this.player().audioTracks())for(f=0;f<l.length;f++)y=l.tracks_[f],m++,g=new chrome.cast.media.Track(m,chrome.cast.media.TrackType.AUDIO),g.subtype=null,g.name=y.label,g.language=y.language,g.customData=null,h.push(g)}catch(b){u.default.log("get player audioTracks fail"+b)}h.length&&(n.tracks=h),(o=new chrome.cast.media.LoadRequest(n)).autoplay=!0,o.currentTime=this.player_.currentTime(),this.apiSession.loadMedia(o,this.onMediaDiscovered.bind(this),this.castError.bind(this)),this.apiSession.addUpdateListener(this.onSessionUpdate.bind(this))}},{key:"onMediaDiscovered",value:function(e){this.player_.loadTech_("Chromecast",{type:"cast",apiMedia:e,apiSession:this.apiSession}),this.casting=!0,this.inactivityTimeout=this.player_.options_.inactivityTimeout,this.player_.options_.inactivityTimeout=0,this.player_.userActive(!0),this.addClass("connected"),this.removeClass("error")}},{key:"onSessionUpdate",value:function(e){return this.player_.apiMedia?e?void 0:this.onStopAppSuccess():void 0}},{key:"stopCasting",value:function(){return this.apiSession.stop(this.onStopAppSuccess.bind(this),this.castError.bind(this))}},{key:"onStopAppSuccess",value:function(){this.casting=!1;var e=this.player_.currentTime();return this.removeClass("connected"),this.player_.src(this.player_.options_.sources),this.player_.paused()||this.player_.one("seeked",function(){return this.player_.play()}),this.player_.currentTime(e),this.player_.options_.inactivityTimeout=this.inactivityTimeout,this.apiSession=null}},{key:"buildCSSClass",value:function(){return"vjs-chromecast-button "+s(Object.getPrototypeOf(t.prototype),"buildCSSClass",this).call(this)}},{key:"handleClick",value:function(){return s(Object.getPrototypeOf(t.prototype),"handleClick",this).call(this),this.casting?this.stopCasting():this.doLaunch()}}]),t}();h.prototype.tryingReconnect=0,h.prototype.inactivityTimeout=2e3,h.prototype.controlText_="Chromecast",l.prototype.options_.children.splice(l.prototype.options_.children.length-1,0,"chromeCastButton"),d.registerComponent("ChromeCastButton",h),i.default=h,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,i){(function(e){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,i,o){return i&&e(t.prototype,i),o&&e(t,o),t}}(),s=function(e,t,i){for(var o=!0;o;){var n=e,a=t,r=i;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var c=s.get;if(void 0===c)return;return c.call(r)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,i=r,o=!0,s=u=void 0}},u=function(e){return e&&e.__esModule?e:{default:e}}("undefined"!=typeof window?window.videojs:void 0!==e?e.videojs:null),d=u.default.getComponent("Component"),l=u.default.getComponent("Tech"),p=function(e){function t(e,i){var o=this;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e,i),this.apiMedia=this.options_.source.apiMedia,this.apiSession=this.options_.source.apiSession,this.receiver=this.apiSession.receiver.friendlyName;var a=this.onMediaStatusUpdate.bind(this),r=this.onSessionUpdate.bind(this);this.apiMedia.addUpdateListener(a),this.apiSession.addUpdateListener(r),this.on("dispose",function(){o.apiMedia.removeUpdateListener(a),o.apiSession.removeUpdateListener(r),o.onMediaStatusUpdate(),o.onSessionUpdate(!1)});var c=this.textTracks();c&&function(){var e=o.handleTextTracksChange.bind(o);c.addEventListener("change",e),o.on("dispose",function(){c.removeEventListener("change",e)}),o.handleTextTracksChange()}();try{(c=this.audioTracks())&&function(){var e=o.handleAudioTracksChange.bind(o);c.addEventListener("change",e),o.on("dispose",function(){c.removeEventListener("change",e)})}()}catch(d){u.default.log("get player audioTracks fail"+d)}try{(c=this.videoTracks())&&function(){var e=o.handleVideoTracksChange.bind(o);c.addEventListener("change",e),o.on("dispose",function(){c.removeEventListener("change",e)})}()}catch(d){u.default.log("get player videoTracks fail"+d)}this.update(),this.triggerReady()}return a(t,l),r(t,[{key:"createEl",value:function(){return u.default.createEl("div",{id:this.options_.techId,className:"vjs-tech vjs-tech-chromecast"})}},{key:"update",value:function(){this.el_.innerHTML='<div class="casting-image" style="background-image: url(\''+this.options_.poster+'\')"></div><div class="casting-overlay"><div class="casting-information"><div class="casting-icon"></div><div class="casting-description"><small>'+this.localize("CASTING TO")+"</small><br>"+this.receiver+"</div></div></div>"}},{key:"onSessionUpdate",value:function(e){return this.apiMedia?e?void 0:this.onStopAppSuccess():void 0}},{key:"onStopAppSuccess",value:function(){this.stopTrackingCurrentTime(),this.apiMedia=null}},{key:"onMediaStatusUpdate",value:function(){if(this.apiMedia)switch(this.apiMedia.playerState){case chrome.cast.media.PlayerState.BUFFERING:this.trigger("waiting");break;case chrome.cast.media.PlayerState.IDLE:this.trigger("timeupdate");break;case chrome.cast.media.PlayerState.PAUSED:this.trigger("pause"),this.paused_=!0;break;case chrome.cast.media.PlayerState.PLAYING:this.trigger("playing"),this.trigger("play"),this.paused_=!1}}},{key:"src",value:function(e){}},{key:"currentSrc",value:function(){return this.apiMedia?this.apiMedia.media.contentId:void 0}},{key:"handleAudioTracksChange",value:function(){var e=[],t=this.textTracks(),i=this.audioTracks();if(i){for(var o=0;o<i.length;o++)i[o].enabled&&e.push(o+1+t.length);return this.apiMedia&&e.length?(this.tracksInfoRequest=new chrome.cast.media.EditTracksInfoRequest(e),this.apiMedia.editTracksInfo(this.tracksInfoRequest,this.onTrackSuccess.bind(this),this.onTrackError.bind(this))):void 0}}},{key:"handleVideoTracksChange",value:function(){}},{key:"handleTextTracksChange",value:function(){var e=[],t=this.textTracks();if(t){for(var i=0;i<t.length;i++)"showing"===t[i].mode&&e.push(i+1);return this.apiMedia&&e.length?(this.tracksInfoRequest=new chrome.cast.media.EditTracksInfoRequest(e),this.apiMedia.editTracksInfo(this.tracksInfoRequest,this.onTrackSuccess.bind(this),this.onTrackError.bind(this))):void 0}}},{key:"onTrackSuccess",value:function(){return u.default.log("track added")}},{key:"onTrackError",value:function(e){return u.default.log("Cast track Error: "+JSON.stringify(e))}},{key:"castError",value:function(e){return u.default.log("Cast Error: "+JSON.stringify(e))}},{key:"play",value:function(){return this.apiMedia?(this.paused_&&this.apiMedia.play(null,this.mediaCommandSuccessCallback.bind(this,"Playing: "+this.apiMedia.sessionId),this.castError.bind(this)),this.paused_=!1):void 0}},{key:"pause",value:function(){return this.apiMedia?this.paused_?void 0:(this.apiMedia.pause(null,this.mediaCommandSuccessCallback.bind(this,"Paused: "+this.apiMedia.sessionId),this.castError.bind(this)),this.paused_=!0):void 0}},{key:"paused",value:function(){return this.paused_}},{key:"currentTime",value:function(){return this.apiMedia?this.apiMedia.getEstimatedTime():0}},{key:"setCurrentTime",value:function(e){if(!this.apiMedia)return 0;var t=void 0;return t=new chrome.cast.media.SeekRequest,t.currentTime=e,this.apiMedia.seek(t,this.onSeekSuccess.bind(this,e),this.castError.bind(this))}},{key:"onSeekSuccess",value:function(e){u.default.log("seek success"+e)}},{key:"volume",value:function(){return this.volume_}},{key:"duration",value:function(){return this.apiMedia?this.apiMedia.media.duration||1/0:0}},{key:"controls",value:function(){return!1}},{key:"setVolume",value:function(e){var t=!(arguments.length<=1||void 0===arguments[1])&&arguments[1],i=void 0,o=void 0;return this.apiMedia?(o=new chrome.cast.Volume,o.level=e,o.muted=t,this.volume_=o.level,this.muted_=t,i=new chrome.cast.media.VolumeRequest,i.volume=o,this.apiMedia.setVolume(i,this.mediaCommandSuccessCallback.bind(this,"Volume changed"),this.castError.bind(this)),this.trigger("volumechange")):void 0}},{key:"mediaCommandSuccessCallback",value:function(e){u.default.log(e)}},{key:"muted",value:function(){return this.muted_}},{key:"setMuted",value:function(e){return this.setVolume(this.volume_,e)}},{key:"supportsFullScreen",value:function(){return!1}},{key:"resetSrc_",value:function(e){e()}},{key:"dispose",value:function(){this.resetSrc_(Function.prototype),s(Object.getPrototypeOf(t.prototype),"dispose",this).call(this,this)}}]),t}();p.prototype.paused_=!1,p.prototype.options_={},p.prototype.timerStep=1e3,p.isSupported=function(){return!0},l.withSourceHandlers(p),p.nativeSourceHandler={},p.nativeSourceHandler.canPlayType=function(e){var i=/^video\/(mpd|mp4|webm|m3u8)/i;return/^application\/(?:dash\+xml|(x-|vnd\.apple\.)mpegurl)/i.test(e)?"probably":i.test(e)?"maybe":""},p.nativeSourceHandler.canHandleSource=function(e){return e.type?p.nativeSourceHandler.canPlayType(e.type):e.src?p.nativeSourceHandler.canPlayType(e.src):""},p.nativeSourceHandler.handleSource=function(e,t){t.src(e.src)},p.nativeSourceHandler.dispose=function(){},p.registerSourceHandler(p.nativeSourceHandler),p.prototype.featuresVolumeControl=!0,p.prototype.featuresPlaybackRate=!1,p.prototype.movingMediaElementInDOM=!1,p.prototype.featuresFullscreenResize=!1,p.prototype.featuresTimeupdateEvents=!1,p.prototype.featuresProgressEvents=!1,p.prototype.featuresNativeTextTracks=!0,p.prototype.featuresNativeAudioTracks=!0,p.prototype.featuresNativeVideoTracks=!1,u.default.options.chromecast={},d.registerComponent("Chromecast",p),l.registerTech("Chromecast",p),i.default=p,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(e,t,i){(function(o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(i,"__esModule",{value:!0});var s=function(e,t,i){for(var o=!0;o;){var n=e,a=t,r=i;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var c=s.get;if(void 0===c)return;return c.call(r)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,i=r,o=!0,s=u=void 0}},u=n("undefined"!=typeof window?window.videojs:void 0!==o?o.videojs:null),p=(n((n(e("./component/control-bar/chromecast-button")),e("./tech/chromecast"))),u.default.getComponent("Component")),h=function(e){function t(e,i){a(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e,i)}return r(t,p),t}();h.prototype.options_={},u.default.options.children.push("chromecast"),u.default.addLanguage("en",{"CASTING TO":"WIEDERGABE AUF"}),u.default.addLanguage("de",{"CASTING TO":"WIEDERGABE AUF"}),u.default.addLanguage("it",{"CASTING TO":"PLAYBACK SU"}),u.default.addLanguage("fr",{"CASTING TO":"CAST EN COURS SUR"});var f=window.navigator.userAgent;u.default.browser.IS_EDGE=/Edge/i.test(f),p.registerComponent("Chromecast",h),i.default=h,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./component/control-bar/chromecast-button":1,"./tech/chromecast":2}],4:[function(e,t,i){(function(o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(i,"__esModule",{value:!0});var r=n("undefined"!=typeof window?window.videojs:void 0!==o?o.videojs:null),c=(n(e("./videojs-chromecast")),function(e){this.addChild("Chromecast",e)});r.default.plugin("chromecast",c),i.default=c,t.exports=i.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./videojs-chromecast":3}]},{},[4])(4)}),function(root,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory(require("video.js")):"function"==typeof define&&define.amd?define(["videojs"],function(videojs){return root.Youtube=factory(videojs)}):root.Youtube=factory(root.videojs)}(this,function(videojs){"use strict";var _isOnMobile=videojs.browser.IS_IOS||videojs.browser.IS_ANDROID,Tech=videojs.getTech("Tech"),Youtube=videojs.extend(Tech,{constructor:function(options,ready){Tech.call(this,options,ready),this.setPoster(options.poster),this.setSrc(this.options_.source,!0),this.setTimeout(function(){this.el_&&(this.el_.parentNode.className+=" vjs-youtube",_isOnMobile&&(this.el_.parentNode.className+=" vjs-youtube-mobile"),Youtube.isApiReady?this.initYTPlayer():Youtube.apiReadyQueue.push(this))}.bind(this))},dispose:function(){if(this.ytPlayer)this.ytPlayer.stopVideo&&this.ytPlayer.stopVideo(),this.ytPlayer.destroy&&this.ytPlayer.destroy();else{var index=Youtube.apiReadyQueue.indexOf(this);-1!==index&&Youtube.apiReadyQueue.splice(index,1)}this.ytPlayer=null,this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-youtube","").replace(" vjs-youtube-mobile",""),this.el_.parentNode.removeChild(this.el_),Tech.prototype.dispose.call(this)},createEl:function(){var div=document.createElement("div");div.setAttribute("id",this.options_.techId),div.setAttribute("style","width:100%;height:100%;top:0;left:0;position:absolute"),div.setAttribute("class","vjs-tech");var divWrapper=document.createElement("div");if(divWrapper.appendChild(div),!_isOnMobile&&!this.options_.ytControls){var divBlocker=document.createElement("div");divBlocker.setAttribute("class","vjs-iframe-blocker"),divBlocker.setAttribute("style","position:absolute;top:0;left:0;width:100%;height:100%"),divBlocker.onclick=function(){this.pause()}.bind(this),divWrapper.appendChild(divBlocker)}return divWrapper},initYTPlayer:function(){var playerVars={controls:0,modestbranding:1,rel:0,showinfo:0,loop:this.options_.loop?1:0};if(void 0!==this.options_.autohide&&(playerVars.autohide=this.options_.autohide),void 0!==this.options_.cc_load_policy&&(playerVars.cc_load_policy=this.options_.cc_load_policy),void 0!==this.options_.ytControls&&(playerVars.controls=this.options_.ytControls),void 0!==this.options_.disablekb&&(playerVars.disablekb=this.options_.disablekb),void 0!==this.options_.end&&(playerVars.end=this.options_.end),void 0!==this.options_.color&&(playerVars.color=this.options_.color),playerVars.controls?void 0!==this.options_.fs&&(playerVars.fs=this.options_.fs):playerVars.fs=0,void 0!==this.options_.end&&(playerVars.end=this.options_.end),void 0!==this.options_.hl?playerVars.hl=this.options_.hl:void 0!==this.options_.language&&(playerVars.hl=this.options_.language.substr(0,2)),void 0!==this.options_.iv_load_policy&&(playerVars.iv_load_policy=this.options_.iv_load_policy),void 0!==this.options_.list?playerVars.list=this.options_.list:this.url&&void 0!==this.url.listId&&(playerVars.list=this.url.listId),void 0!==this.options_.listType&&(playerVars.listType=this.options_.listType),void 0!==this.options_.modestbranding&&(playerVars.modestbranding=this.options_.modestbranding),void 0!==this.options_.playlist&&(playerVars.playlist=this.options_.playlist),void 0!==this.options_.playsinline&&(playerVars.playsinline=this.options_.playsinline),void 0!==this.options_.rel&&(playerVars.rel=this.options_.rel),void 0!==this.options_.showinfo&&(playerVars.showinfo=this.options_.showinfo),void 0!==this.options_.start&&(playerVars.start=this.options_.start),void 0!==this.options_.theme&&(playerVars.theme=this.options_.theme),void 0!==this.options_.customVars){var customVars=this.options_.customVars;Object.keys(customVars).forEach(function(key){playerVars[key]=customVars[key]})}this.activeVideoId=this.url?this.url.videoId:null,this.activeList=playerVars.list,this.ytPlayer=new YT.Player(this.options_.techId,{videoId:this.activeVideoId,playerVars:playerVars,events:{onReady:this.onPlayerReady.bind(this),onPlaybackQualityChange:this.onPlayerPlaybackQualityChange.bind(this),onPlaybackRateChange:this.onPlayerPlaybackRateChange.bind(this),onStateChange:this.onPlayerStateChange.bind(this),onVolumeChange:this.onPlayerVolumeChange.bind(this),onError:this.onPlayerError.bind(this)}})},onPlayerReady:function(){this.options_.muted&&this.ytPlayer.mute(),this.ytPlayer.getAvailablePlaybackRates().length>1&&(this.featuresPlaybackRate=!0),this.playerReady_=!0,this.triggerReady(),this.playOnReady?this.play():this.cueOnReady&&(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)},onPlayerPlaybackQualityChange:function(){},onPlayerPlaybackRateChange:function(){this.trigger("ratechange")},onPlayerStateChange:function(e){var state=e.data;if(state!==this.lastState&&!this.errorNumber)switch(this.lastState=state,state){case-1:this.trigger("loadstart"),this.trigger("loadedmetadata"),this.trigger("durationchange"),this.trigger("ratechange");break;case YT.PlayerState.ENDED:this.trigger("ended");break;case YT.PlayerState.PLAYING:this.trigger("timeupdate"),this.trigger("durationchange"),this.trigger("playing"),this.trigger("play"),this.isSeeking&&this.onSeeked();break;case YT.PlayerState.PAUSED:this.trigger("canplay"),this.isSeeking?this.onSeeked():this.trigger("pause");break;case YT.PlayerState.BUFFERING:this.player_.trigger("timeupdate"),this.player_.trigger("waiting")}},onPlayerVolumeChange:function(){this.trigger("volumechange")},onPlayerError:function(e){this.errorNumber=e.data,this.trigger("pause"),this.trigger("error")},error:function(){var code=1e3+this.errorNumber;switch(this.errorNumber){case 5:return{code:code,message:"Error while trying to play the video"};case 2:case 100:return{code:code,message:"Unable to find the video"};case 101:case 150:return{code:code,message:"Playback on other Websites has been disabled by the video owner."}}return{code:code,message:"YouTube unknown error ("+this.errorNumber+")"}},loadVideoById_:function(id){var options={videoId:id};this.options_.start&&(options.startSeconds=this.options_.start),this.options_.end&&(options.endEnd=this.options_.end),this.ytPlayer.loadVideoById(options)},cueVideoById_:function(id){var options={videoId:id};this.options_.start&&(options.startSeconds=this.options_.start),this.options_.end&&(options.endEnd=this.options_.end),this.ytPlayer.cueVideoById(options)},src:function(src){return src&&this.setSrc({src:src}),this.source},poster:function(){return _isOnMobile?null:this.poster_},setPoster:function(poster){this.poster_=poster},setSrc:function(source){source&&source.src&&(delete this.errorNumber,this.source=source,this.url=Youtube.parseUrl(source.src),this.options_.poster||this.url.videoId&&(this.poster_="https://img.youtube.com/vi/"+this.url.videoId+"/0.jpg",this.trigger("posterchange"),this.checkHighResPoster()),this.options_.autoplay&&!_isOnMobile?this.isReady_?this.play():this.playOnReady=!0:this.activeVideoId!==this.url.videoId&&(this.isReady_?(this.cueVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId):this.cueOnReady=!0))},autoplay:function(){return this.options_.autoplay},setAutoplay:function(val){this.options_.autoplay=val},loop:function(){return this.options_.loop},setLoop:function(val){this.options_.loop=val},play:function(){this.url&&this.url.videoId&&(this.wasPausedBeforeSeek=!1,this.isReady_?(this.url.listId&&(this.activeList===this.url.listId?this.ytPlayer.playVideo():(this.ytPlayer.loadPlaylist(this.url.listId),this.activeList=this.url.listId)),this.activeVideoId===this.url.videoId?this.ytPlayer.playVideo():(this.loadVideoById_(this.url.videoId),this.activeVideoId=this.url.videoId)):(this.trigger("waiting"),this.playOnReady=!0))},pause:function(){this.ytPlayer&&this.ytPlayer.pauseVideo()},paused:function(){return!this.ytPlayer||this.lastState!==YT.PlayerState.PLAYING&&this.lastState!==YT.PlayerState.BUFFERING},currentTime:function(){return this.ytPlayer?this.ytPlayer.getCurrentTime():0},setCurrentTime:function(seconds){this.lastState===YT.PlayerState.PAUSED&&(this.timeBeforeSeek=this.currentTime()),this.isSeeking||(this.wasPausedBeforeSeek=this.paused()),this.ytPlayer.seekTo(seconds,!0),this.trigger("timeupdate"),this.trigger("seeking"),this.isSeeking=!0,this.lastState===YT.PlayerState.PAUSED&&this.timeBeforeSeek!==seconds&&(clearInterval(this.checkSeekedInPauseInterval),this.checkSeekedInPauseInterval=setInterval(function(){this.lastState===YT.PlayerState.PAUSED&&this.isSeeking?this.currentTime()!==this.timeBeforeSeek&&(this.trigger("timeupdate"),this.onSeeked()):clearInterval(this.checkSeekedInPauseInterval)}.bind(this),250))},seeking:function(){return this.isSeeking},seekable:function(){return this.ytPlayer?videojs.createTimeRange(0,this.ytPlayer.getDuration()):videojs.createTimeRange()},onSeeked:function(){clearInterval(this.checkSeekedInPauseInterval),this.isSeeking=!1,this.wasPausedBeforeSeek&&this.pause(),this.trigger("seeked")},playbackRate:function(){return this.ytPlayer?this.ytPlayer.getPlaybackRate():1},setPlaybackRate:function(suggestedRate){this.ytPlayer&&this.ytPlayer.setPlaybackRate(suggestedRate)},duration:function(){return this.ytPlayer?this.ytPlayer.getDuration():0},currentSrc:function(){return this.source&&this.source.src},ended:function(){return!!this.ytPlayer&&this.lastState===YT.PlayerState.ENDED},volume:function(){return this.ytPlayer?this.ytPlayer.getVolume()/100:1},setVolume:function(percentAsDecimal){this.ytPlayer&&this.ytPlayer.setVolume(100*percentAsDecimal)},muted:function(){return!!this.ytPlayer&&this.ytPlayer.isMuted()},setMuted:function(mute){this.ytPlayer&&(this.muted(!0),mute?this.ytPlayer.mute():this.ytPlayer.unMute(),this.setTimeout(function(){this.trigger("volumechange")},50))},buffered:function(){if(!this.ytPlayer||!this.ytPlayer.getVideoLoadedFraction)return videojs.createTimeRange();var bufferedEnd=this.ytPlayer.getVideoLoadedFraction()*this.ytPlayer.getDuration();return videojs.createTimeRange(0,bufferedEnd)},preload:function(){},load:function(){},reset:function(){},supportsFullScreen:function(){return!0},checkHighResPoster:function(){var uri="https://img.youtube.com/vi/"+this.url.videoId+"/maxresdefault.jpg";try{var image=new Image;image.onload=function(){if("naturalHeight"in image){if(image.naturalHeight<=90||image.naturalWidth<=120)return}else if(image.height<=90||image.width<=120)return;this.poster_=uri,this.trigger("posterchange")}.bind(this),image.onerror=function(){},image.src=uri}catch(e){}}});Youtube.isSupported=function(){return!0},Youtube.canPlaySource=function(e){return Youtube.canPlayType(e.type)},Youtube.canPlayType=function(e){return"video/youtube"===e},Youtube.parseUrl=function(url){var result={videoId:null},regex=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,match=url.match(regex);match&&11===match[2].length&&(result.videoId=match[2]);var regPlaylist=/[?&]list=([^#\&\?]+)/;return(match=url.match(regPlaylist))&&match[1]&&(result.listId=match[1]),result},Youtube.apiReadyQueue=[],"undefined"!=typeof document&&(function(src,callback){var loaded=!1,tag=document.createElement("script"),firstScriptTag=document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag),tag.onload=function(){loaded||(loaded=!0,callback())},tag.onreadystatechange=function(){loaded||"complete"!==this.readyState&&"loaded"!==this.readyState||(loaded=!0,callback())},tag.src=src}("https://www.youtube.com/iframe_api",function(){YT.ready(function(){Youtube.isApiReady=!0;for(var i=0;i<Youtube.apiReadyQueue.length;++i)Youtube.apiReadyQueue[i].initYTPlayer()})}),function(){var css=".vjs-youtube .vjs-iframe-blocker { display: none; }.vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }.vjs-youtube .vjs-poster { background-size: cover; }.vjs-youtube-mobile .vjs-big-play-button { display: none; }",head=document.head||document.getElementsByTagName("head")[0],style=document.createElement("style");style.type="text/css",style.styleSheet?style.styleSheet.cssText=css:style.appendChild(document.createTextNode(css)),head.appendChild(style)}()),void 0!==videojs.registerTech?videojs.registerTech("Youtube",Youtube):videojs.registerComponent("Youtube",Youtube)}),function(root,factory){"function"==typeof define&&define.amd?define(["video.js"],function(videojs){return root.Vimeo=factory(videojs)}):"object"==typeof module&&module.exports?module.exports=root.Vimeo=factory(require("video.js")):root.Vimeo=factory(root.videojs)}(this,function(videojs){"use strict";function injectCss(){var css=".vjs-vimeo .vjs-iframe-blocker { display: none; }.vjs-vimeo.vjs-user-inactive .vjs-iframe-blocker { display: block; }.vjs-vimeo .vjs-poster { background-size: cover; }.vjs-vimeo { height:100%; }.vimeoplayer { width:100%; height:180%; position:absolute; left:0; top:-40%; }",head=document.head||document.getElementsByTagName("head")[0],style=document.createElement("style");style.type="text/css",style.styleSheet?style.styleSheet.cssText=css:style.appendChild(document.createTextNode(css)),head.appendChild(style)}var VimeoState={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3},Tech=videojs.getComponent("Tech"),Vimeo=videojs.extend(Tech,{constructor:function(options,ready){Tech.call(this,options,ready),""!=options.poster&&this.setPoster(options.poster),this.setSrc(this.options_.source.src,!0),setTimeout(function(){this.el_.parentNode.className+=" vjs-vimeo"}.bind(this))},dispose:function(){this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-vimeo","")},createEl:function(){this.vimeo={},this.vimeoInfo={},this.baseUrl="https://player.vimeo.com/video/",this.baseApiUrl="http://www.vimeo.com/api/v2/video/",this.videoId=Vimeo.parseUrl(this.options_.source.src).videoId,this.iframe=document.createElement("iframe"),this.iframe.setAttribute("id",this.options_.techId),this.iframe.setAttribute("title","Vimeo Video Player"),this.iframe.setAttribute("class","vimeoplayer"),this.iframe.setAttribute("src",this.baseUrl+this.videoId+"?api=1&player_id="+this.options_.techId),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("marginWidth","0"),this.iframe.setAttribute("marginHeight","0"),this.iframe.setAttribute("webkitAllowFullScreen","0"),this.iframe.setAttribute("mozallowfullscreen","0"),this.iframe.setAttribute("allowFullScreen","0");var divWrapper=document.createElement("div");if(divWrapper.setAttribute("style","margin:0 auto;padding-bottom:56.25%;width:100%;height:0;position:relative;overflow:hidden;"),divWrapper.setAttribute("class","vimeoFrame"),divWrapper.appendChild(this.iframe),!_isOnMobile&&!this.options_.ytControls){var divBlocker=document.createElement("div");divBlocker.setAttribute("class","vjs-iframe-blocker"),divBlocker.setAttribute("style","position:absolute;top:0;left:0;width:100%;height:100%"),divBlocker.onclick=function(){this.onPause()}.bind(this),divWrapper.appendChild(divBlocker)}return Vimeo.isApiReady?this.initPlayer():Vimeo.apiReadyQueue.push(this),""==this.options_.poster&&$.getJSON(this.baseApiUrl+this.videoId+".json?callback=?",{format:"json"},function(_this){return function(data){_this.setPoster(data[0].thumbnail_large)}}(this)),divWrapper},initPlayer:function(){var self=this;Vimeo.parseUrl(this.options_.source.src).videoId;this.vimeo&&this.vimeo.api&&(this.vimeo.api("unload"),delete this.vimeo),self.vimeo=$f(self.iframe),self.vimeoInfo={state:VimeoState.UNSTARTED,volume:1,muted:!1,muteVolume:1,time:0,duration:0,buffered:0,url:self.baseUrl+self.videoId,error:null},this.vimeo.addEvent("ready",function(id){self.onReady(),self.vimeo.addEvent("loadProgress",function(data,id){self.onLoadProgress(data)}),self.vimeo.addEvent("playProgress",function(data,id){self.onPlayProgress(data)}),self.vimeo.addEvent("play",function(id){self.onPlay()}),self.vimeo.addEvent("pause",function(id){self.onPause()}),self.vimeo.addEvent("finish",function(id){self.onFinish()}),self.vimeo.addEvent("seek",function(data,id){self.onSeek(data)})})},onReady:function(){this.isReady_=!0,this.triggerReady(),this.trigger("loadedmetadata"),this.startMuted&&(this.setMuted(!0),this.startMuted=!1)},onLoadProgress:function(data){var durationUpdate=!this.vimeoInfo.duration;this.vimeoInfo.duration=data.duration,this.vimeoInfo.buffered=data.percent,this.trigger("progress"),durationUpdate&&this.trigger("durationchange")},onPlayProgress:function(data){this.vimeoInfo.time=data.seconds,this.trigger("timeupdate")},onPlay:function(){this.vimeoInfo.state=VimeoState.PLAYING,this.trigger("play")},onPause:function(){this.vimeoInfo.state=VimeoState.PAUSED,this.trigger("pause")},onFinish:function(){this.vimeoInfo.state=VimeoState.ENDED,this.trigger("ended")},onSeek:function(data){this.trigger("seeking"),this.vimeoInfo.time=data.seconds,this.trigger("timeupdate"),this.trigger("seeked")},onError:function(error){this.error=error,this.trigger("error")},error:function(){switch(this.errorNumber){case 2:return{code:"Unable to find the video"};case 5:return{code:"Error while trying to play the video"};case 100:return{code:"Unable to find the video"};case 101:case 150:return{code:"Playback on other Websites has been disabled by the video owner."}}return{code:"Vimeo unknown error ("+this.errorNumber+")"}},src:function(){return this.source},poster:function(){return this.poster_},setPoster:function(poster){this.poster_=poster},setSrc:function(source){source&&source.src&&(this.source=source,this.url=Vimeo.parseUrl(source.src),this.options_.poster||this.url.videoId&&($.getJSON(this.baseApiUrl+this.videoId+".json?callback=?",{format:"json"},function(_this){return function(data){_this.poster_=data[0].thumbnail_small}}(this)),this.checkHighResPoster()),this.options_.autoplay&&!_isOnMobile&&(this.isReady_?this.play():this.playOnReady=!0))},supportsFullScreen:function(){return!0},load:function(){},play:function(){this.vimeo.api("play")},pause:function(){this.vimeo.api("pause")},paused:function(){return this.vimeoInfo.state!==VimeoState.PLAYING&&this.vimeoInfo.state!==VimeoState.BUFFERING},currentTime:function(){return this.vimeoInfo.time||0},setCurrentTime:function(seconds){this.vimeo.api("seekTo",seconds),this.player_.trigger("timeupdate")},duration:function(){return this.vimeoInfo.duration||0},buffered:function(){return videojs.createTimeRange(0,this.vimeoInfo.buffered*this.vimeoInfo.duration||0)},volume:function(){return this.vimeoInfo.muted?this.vimeoInfo.muteVolume:this.vimeoInfo.volume},setVolume:function(percentAsDecimal){this.vimeo.api("setvolume",percentAsDecimal),this.vimeoInfo.volume=percentAsDecimal,this.player_.trigger("volumechange")},currentSrc:function(){return this.el_.src},muted:function(){return this.vimeoInfo.muted||!1},setMuted:function(muted){muted?(this.vimeoInfo.muteVolume=this.vimeoInfo.volume,this.setVolume(0)):this.setVolume(this.vimeoInfo.muteVolume),this.vimeoInfo.muted=muted,this.player_.trigger("volumechange")},checkHighResPoster:function(){try{$.getJSON(this.baseApiUrl+this.videoId+".json?callback=?",{format:"json"},function(_uri){return function(data){_uri=data[0].thumbnail_large}}(""));var image=new Image;image.onload=function(){if("naturalHeight"in this){if(this.naturalHeight<=90||this.naturalWidth<=120)return void this.onerror()}else if(this.height<=90||this.width<=120)return void this.onerror();this.poster_="",this.trigger("posterchange")}.bind(this),image.onerror=function(){},image.src=""}catch(e){}}});Vimeo.isSupported=function(){return!0},Vimeo.canPlaySource=function(e){return"video/vimeo"===e.type};var _isOnMobile=/(iPad|iPhone|iPod|Android)/g.test(navigator.userAgent);Vimeo.parseUrl=function(url){var result={videoId:null},regex=/^.*(vimeo\.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/,match=url.match(regex);return match&&(result.videoId=match[5]),result},Vimeo.apiReadyQueue=[];!function(){Vimeo.isApiReady=!0,injectCss();for(var i=0;i<Vimeo.apiReadyQueue.length;++i)Vimeo.apiReadyQueue[i].initPlayer()}(),videojs.registerTech("Vimeo",Vimeo);!function(){function Froogaloop(iframe){return new Froogaloop.fn.init(iframe)}function postMessage(method,params,target){if(!target.contentWindow.postMessage)return!1;var data=JSON.stringify({method:method,value:params});target.contentWindow.postMessage(data,playerOrigin)}function onMessageReceived(event){var data,method;try{method=(data=JSON.parse(event.data)).event||data.method}catch(e){}if("ready"!=method||isReady||(isReady=!0),!/^https?:\/\/player.vimeo.com/.test(event.origin))return!1;"*"===playerOrigin&&(playerOrigin=event.origin);var value=data.value,eventData=data.data,target_id=""===target_id?null:data.player_id,callback=getCallback(method,target_id),params=[];return!!callback&&(void 0!==value&&params.push(value),eventData&&params.push(eventData),target_id&&params.push(target_id),params.length>0?callback.apply(null,params):callback.call())}function storeCallback(eventName,callback,target_id){target_id?(eventCallbacks[target_id]||(eventCallbacks[target_id]={}),eventCallbacks[target_id][eventName]=callback):eventCallbacks[eventName]=callback}function getCallback(eventName,target_id){return target_id&&eventCallbacks[target_id]?eventCallbacks[target_id][eventName]:eventCallbacks[eventName]?eventCallbacks[eventName]:void 0}function removeCallback(eventName,target_id){if(target_id&&eventCallbacks[target_id]){if(!eventCallbacks[target_id][eventName])return!1;eventCallbacks[target_id][eventName]=null}else{if(!eventCallbacks[eventName])return!1;eventCallbacks[eventName]=null}return!0}function isFunction(obj){return!!(obj&&obj.constructor&&obj.call&&obj.apply)}var eventCallbacks={},isReady=!1,playerOrigin=(Array.prototype.slice,"*");Froogaloop.fn=Froogaloop.prototype={element:null,init:function(iframe){return"string"==typeof iframe&&(iframe=document.getElementById(iframe)),this.element=iframe,this},api:function(method,valueOrCallback){if(!this.element||!method)return!1;var self=this,element=self.element,target_id=""!==element.id?element.id:null,params=isFunction(valueOrCallback)?null:valueOrCallback,callback=isFunction(valueOrCallback)?valueOrCallback:null;return callback&&storeCallback(method,callback,target_id),postMessage(method,params,element),self},addEvent:function(eventName,callback){if(!this.element)return!1;var self=this,element=self.element,target_id=""!==element.id?element.id:null;return storeCallback(eventName,callback,target_id),"ready"!=eventName?postMessage("addEventListener",eventName,element):"ready"==eventName&&isReady&&callback.call(null,target_id),self},removeEvent:function(eventName){if(!this.element)return!1;var element=this.element,removed=removeCallback(eventName,""!==element.id?element.id:null);"ready"!=eventName&&removed&&postMessage("removeEventListener",eventName,element)}},Froogaloop.fn.init.prototype=Froogaloop.fn,window.addEventListener?window.addEventListener("message",onMessageReceived,!1):window.attachEvent("onmessage",onMessageReceived),window.Froogaloop=window.$f=Froogaloop}()}),function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _videoJs2=_interopRequireDefault("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),plugin=(_interopRequireDefault(require("./videojs-dailymotion")),function(options){dailymotion(this,options)});_videoJs2.default.plugin("dailymotion",plugin),exports.default=plugin,module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./videojs-dailymotion":2}],2:[function(require,module,exports){(function(global){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_get=function(_x,_x2,_x3){for(var _again=!0;_again;){var object=_x,property=_x2,receiver=_x3;_again=!1,null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0!==desc){if("value"in desc)return desc.value;var getter=desc.get;if(void 0===getter)return;return getter.call(receiver)}var parent=Object.getPrototypeOf(object);if(null===parent)return;_x=parent,_x2=property,_x3=receiver,_again=!0,desc=parent=void 0}},_videoJs2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),Component=_videoJs2.default.getComponent("Component"),Tech=_videoJs2.default.getComponent("Tech"),Dailymotion=function(_Tech){function Dailymotion(options,ready){var _this=this;_classCallCheck(this,Dailymotion),_get(Object.getPrototypeOf(Dailymotion.prototype),"constructor",this).call(this,options,ready),this.params={id:this.options_.techId,autoplay:this.player_.options_.autoplay?1:0,chromeless:this.player_.options_.dmControls?0:1,html:1,info:1,logo:1,controls:"html",wmode:"opaque",format:"json",url:options.source.src},"file:"!==window.location.protocol&&(this.params.origin=window.location.protocol+"//"+window.location.hostname),this.videoId=this.parseSrc(options.source.src),void 0!==this.videoId&&this.setTimeout(function(){_this.getPoster(_this.videoId),_this.loadApi()},100)}return _inherits(Dailymotion,Tech),_createClass(Dailymotion,[{key:"createEl",value:function(){var el=_videoJs2.default.createEl("iframe",{id:this.options_.techId,className:"vjs-tech vjs-tech-dailymotion"}),iframeContainer=_videoJs2.default.createEl("iframe",{scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0,webkitAllowFullScreen:"",mozallowfullscreen:"",allowFullScreen:""});if(el.appendChild(iframeContainer),/MSIE (\d+\.\d+);/.test(navigator.userAgent)||!/(iPad|iPhone|iPod|Android)/g.test(navigator.userAgent)){var divBlocker=_videoJs2.default.createEl("div",{className:"vjs-iframe-blocker",style:"position:absolute;top:0;left:0;width:100%;height:100%"});divBlocker.onclick=function(){this.pause()}.bind(this),el.appendChild(divBlocker)}return el}},{key:"loadApi",value:function(){this.dmPlayer=new DM.player(this.options_.techId,{video:this.videoId,width:this.options_.width,height:this.options_.height,params:this.params}),this.setupTriggers(),this.dmPlayer.vjsTech=this}},{key:"parseSrc",value:function(src){if(src){var regExp=/^.+dailymotion.com\/((video|hub)\/([^_]+))?[^#]*(#video=([^_&]+))?/,match=src.match(regExp);return match?match[5]||match[3]:null}}},{key:"getPoster",value:function(id){if(id){var that=this,url="https://api.dailymotion.com/video/"+id+"?fields=thumbnail_large_url",xmlHttp=new XMLHttpRequest;xmlHttp.onreadystatechange=function(){if(4==xmlHttp.readyState&&200==xmlHttp.status){var poster=JSON.parse(xmlHttp.responseText);that.setPoster(poster.thumbnail_large_url)}},xmlHttp.open("GET",url,!0),xmlHttp.send(null)}}},{key:"setupTriggers",value:function(){this.dmPlayer.listeners=[];for(var i=Dailymotion.Events.length-1;i>=0;i--){var listener=_videoJs2.default.bind(this,this.eventHandler);this.dmPlayer.listeners.push({event:Dailymotion.Events[i],func:listener}),this.dmPlayer.addEventListener(Dailymotion.Events[i],listener)}}},{key:"eventHandler",value:function(e){this.onStateChange(e),this.trigger(e)}},{key:"onStateChange",value:function(event){var state=event.type;if(state!==this.lastState){switch(state){case-1:break;case"apiready":this.triggerReady();break;case"video_end":this.trigger("ended");break;case"ad_play":this.trigger("play");break;case"video_start":case"ad_start":this.trigger("playing"),this.trigger("play")}this.lastState=state}}},{key:"poster",value:function(){return this.poster_}},{key:"setPoster",value:function(poster){this.poster_=poster,this.trigger("posterchange")}},{key:"src",value:function(_src){return void 0!==_src&&(this.src_=this.parseSrc(_src),this.dmPlayer.load(this.src_)),this.src_}},{key:"currentSrc",value:function(){return this.src_}},{key:"play",value:function(){this.isReady_?this.dmPlayer.play():this.player_.options_.dmControls||this.player_.bigPlayButton.show()}},{key:"ended",value:function(){return!!this.isReady_&&0===this.dmPlayer.getPlayerState()}},{key:"pause",value:function(){this.dmPlayer.pause(!this.dmPlayer.paused)}},{key:"paused",value:function(){return this.dmPlayer.paused}},{key:"currentTime",value:function(){return this.dmPlayer&&this.dmPlayer.currentTime?this.dmPlayer.currentTime:0}},{key:"setCurrentTime",value:function(position){this.dmPlayer.seek(position)}},{key:"duration",value:function(){return this.dmPlayer&&this.dmPlayer.duration?this.dmPlayer.duration:0}},{key:"volume",value:function(){return isNaN(this.volume_)&&(this.volume_=this.dmPlayer.volume),this.volume_}},{key:"enterFullScreen",value:function(){this.dmPlayer.setFullscreen(!0)}},{key:"exitFullScreen",value:function(){this.dmPlayer.setFullscreen(!1)}},{key:"setVolume",value:function(percentAsDecimal){void 0!==percentAsDecimal&&percentAsDecimal!==this.volume_&&(this.dmPlayer.setVolume(percentAsDecimal),this.volume_=percentAsDecimal,this.player_.trigger("volumechange"))}},{key:"buffered",value:function(){return[]}},{key:"controls",value:function(){return!1}},{key:"muted",value:function(){return this.dmPlayer.muted}},{key:"setMuted",value:function(muted){this.dmPlayer.setMuted(muted),this.setTimeout(function(){this.player_.trigger("volumechange")})}},{key:"supportsFullScreen",value:function(){return!0}},{key:"resetSrc_",value:function(callback){callback()}},{key:"dispose",value:function(){this.resetSrc_(Function.prototype),_get(Object.getPrototypeOf(Dailymotion.prototype),"dispose",this).call(this,this)}}]),Dailymotion}();Dailymotion.prototype.options_={},Dailymotion.apiReadyQueue=[],Dailymotion.makeQueryString=function(args){var querys=[];for(var key in args)args.hasOwnProperty(key)&&querys.push(encodeURIComponent(key)+"="+encodeURIComponent(args[key]));return querys.join("&")};Dailymotion.isSupported=function(){return!0},Tech.withSourceHandlers(Dailymotion),Dailymotion.nativeSourceHandler={},Dailymotion.nativeSourceHandler.canPlayType=function(source){return/^video\/(dailymotion)/i.test(source)?"maybe":""},Dailymotion.nativeSourceHandler.canHandleSource=function(source){return source.type?Dailymotion.nativeSourceHandler.canPlayType(source.type):source.src?Dailymotion.nativeSourceHandler.canPlayType(source.src):""},Dailymotion.nativeSourceHandler.handleSource=function(source,tech){tech.src(source.src)},Dailymotion.nativeSourceHandler.dispose=function(){},Dailymotion.registerSourceHandler(Dailymotion.nativeSourceHandler),Dailymotion.prototype.featuresVolumeControl=!0,Dailymotion.prototype.featuresPlaybackRate=!1,Dailymotion.prototype.movingMediaElementInDOM=!1,Dailymotion.prototype.featuresFullscreenResize=!1,Dailymotion.prototype.featuresTimeupdateEvents=!1,Dailymotion.prototype.featuresProgressEvents=!1,Dailymotion.prototype.featuresNativeTextTracks=!0,Dailymotion.prototype.featuresNativeAudioTracks=!0,Dailymotion.prototype.featuresNativeVideoTracks=!1,Dailymotion.Events="apiready,ad_play,ad_start,ad_timeupdate,ad_pause,ad_end,video_start,video_end,play,playing,pause,ended,canplay,canplaythrough,timeupdate,progress,seeking,seeked,volumechange,durationchange,fullscreenchange,error".split(","),_videoJs2.default.options.Dailymotion={},Component.registerComponent("Dailymotion",Dailymotion),Tech.registerTech("Dailymotion",Dailymotion),function(){var tag=document.createElement("script");tag.src="https://api.dmcdn.net/all.js";var firstScriptTag=document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag)}(),window.dmAsyncInit=function(){for(var dm;dm=Dailymotion.apiReadyQueue.shift();)dm.loadApi();Dailymotion.apiReadyQueue=[],Dailymotion.isApiReady=!0},exports.default=Dailymotion,module.exports=exports.default}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]),function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define(factory):global.s3bubbleSweetalert2=factory()}(this,function(){"use strict";var defaultParams={title:"",titleText:"",text:"",html:"",type:null,customClass:"",target:"body",animation:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonColor:"#3085d6",confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonColor:"#aaa",cancelButtonClass:null,buttonsStyling:!0,reverseButtons:!1,focusCancel:!1,showCloseButton:!1,showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageClass:null,timer:null,width:500,padding:20,background:"#fff",input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,progressSteps:[],currentProgressStep:null,progressStepsDistance:"40px",onOpen:null,onClose:null,useRejections:!0},prefix=function(items){var result={};for(var i in items)result[items[i]]="s3bubble-swal2-"+items[i];return result},swalClasses=prefix(["container","shown","iosfix","modal","overlay","fade","show","hide","noanimation","close","title","content","buttonswrapper","confirm","cancel","icon","image","input","file","range","select","radio","checkbox","textarea","inputerror","validationerror","progresssteps","activeprogressstep","progresscircle","progressline","loading","styled"]),iconTypes=prefix(["success","warning","info","question","error"]),colorLuminance=function(hex,lum){(hex=String(hex).replace(/[^0-9a-f]/gi,"")).length<6&&(hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]),lum=lum||0;for(var rgb="#",i=0;i<3;i++){var c=parseInt(hex.substr(2*i,2),16);rgb+=("00"+(c=Math.round(Math.min(Math.max(0,c+c*lum),255)).toString(16))).substr(c.length)}return rgb},uniqueArray=function(arr){var result=[];for(var i in arr)-1===result.indexOf(arr[i])&&result.push(arr[i]);return result},states={previousWindowKeyDown:null,previousActiveElement:null,previousBodyPadding:null},init=function(params){if("undefined"!=typeof document){var container=document.createElement("div");container.className=swalClasses.container,container.innerHTML=sweetHTML;var targetElement=document.querySelector(params.target);targetElement||(console.warn("s3bubbleSweetAlert2: Can't find the target \""+params.target+'"'),targetElement=document.body),targetElement.appendChild(container);var modal=getModal(),input=getChildByClass(modal,swalClasses.input),file=getChildByClass(modal,swalClasses.file),range=modal.querySelector("."+swalClasses.range+" input"),rangeOutput=modal.querySelector("."+swalClasses.range+" output"),select=getChildByClass(modal,swalClasses.select),checkbox=modal.querySelector("."+swalClasses.checkbox+" input"),textarea=getChildByClass(modal,swalClasses.textarea);return input.oninput=function(){s3bubbleSweetAlert.resetValidationError()},input.onkeydown=function(event){setTimeout(function(){13===event.keyCode&&params.allowEnterKey&&(event.stopPropagation(),s3bubbleSweetAlert.clickConfirm())},0)},file.onchange=function(){s3bubbleSweetAlert.resetValidationError()},range.oninput=function(){s3bubbleSweetAlert.resetValidationError(),rangeOutput.value=range.value},range.onchange=function(){s3bubbleSweetAlert.resetValidationError(),range.previousSibling.value=range.value},select.onchange=function(){s3bubbleSweetAlert.resetValidationError()},checkbox.onchange=function(){s3bubbleSweetAlert.resetValidationError()},textarea.oninput=function(){s3bubbleSweetAlert.resetValidationError()},modal}console.error("s3bubbleSweetAlert2 requires document to initialize")},sweetHTML=('\n <div role="dialog" aria-labelledby="'+swalClasses.title+'" aria-describedby="'+swalClasses.content+'" class="'+swalClasses.modal+'" tabindex="-1">\n   <ul class="'+swalClasses.progresssteps+'"></ul>\n   <div class="'+swalClasses.icon+" "+iconTypes.error+'">\n     <span class="swal2-x-mark"><span class="swal2-x-mark-line-left"></span><span class="swal2-x-mark-line-right"></span></span>\n   </div>\n   <div class="'+swalClasses.icon+" "+iconTypes.question+'">?</div>\n   <div class="'+swalClasses.icon+" "+iconTypes.warning+'">!</div>\n   <div class="'+swalClasses.icon+" "+iconTypes.info+'">i</div>\n   <div class="'+swalClasses.icon+" "+iconTypes.success+'">\n     <div class="swal2-success-circular-line-left"></div>\n     <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n     <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n     <div class="swal2-success-circular-line-right"></div>\n   </div>\n   <img class="'+swalClasses.image+'">\n   <h2 class="'+swalClasses.title+'" id="'+swalClasses.title+'"></h2>\n   <div id="'+swalClasses.content+'" class="'+swalClasses.content+'"></div>\n   <input class="'+swalClasses.input+'">\n   <input type="file" class="'+swalClasses.file+'">\n   <div class="'+swalClasses.range+'">\n     <output></output>\n     <input type="range">\n   </div>\n   <select class="'+swalClasses.select+'"></select>\n   <div class="'+swalClasses.radio+'"></div>\n   <label for="'+swalClasses.checkbox+'" class="'+swalClasses.checkbox+'">\n     <input type="checkbox">\n   </label>\n   <textarea class="'+swalClasses.textarea+'"></textarea>\n   <div class="'+swalClasses.validationerror+'"></div>\n   <div class="'+swalClasses.buttonswrapper+'">\n     <button type="button" class="'+swalClasses.confirm+'">OK</button>\n     <button type="button" class="'+swalClasses.cancel+'">Cancel</button>\n   </div>\n   <button type="button" class="'+swalClasses.close+'" aria-label="Close this dialog">&times;</button>\n </div>\n').replace(/(^|\n)\s*/g,""),getContainer=function(){return document.body.querySelector("."+swalClasses.container)},getModal=function(){return getContainer()?getContainer().querySelector("."+swalClasses.modal):null},getIcons=function(){return getModal().querySelectorAll("."+swalClasses.icon)},elementByClass=function(className){return getContainer()?getContainer().querySelector("."+className):null},getTitle=function(){return elementByClass(swalClasses.title)},getContent=function(){return elementByClass(swalClasses.content)},getImage=function(){return elementByClass(swalClasses.image)},getButtonsWrapper=function(){return elementByClass(swalClasses.buttonswrapper)},getProgressSteps=function(){return elementByClass(swalClasses.progresssteps)},getValidationError=function(){return elementByClass(swalClasses.validationerror)},getConfirmButton=function(){return elementByClass(swalClasses.confirm)},getCancelButton=function(){return elementByClass(swalClasses.cancel)},getCloseButton=function(){return elementByClass(swalClasses.close)},getFocusableElements=function(focusCancel){var buttons=[getConfirmButton(),getCancelButton()];focusCancel&&buttons.reverse();var focusableElements=buttons.concat(Array.prototype.slice.call(getModal().querySelectorAll('button, input:not([type=hidden]), textarea, select, a, *[tabindex]:not([tabindex="-1"])')));return uniqueArray(focusableElements)},hasClass=function(elem,className){return!!elem.classList&&elem.classList.contains(className)},focusInput=function(input){if(input.focus(),"file"!==input.type){var val=input.value;input.value="",input.value=val}},addClass=function(elem,className){elem&&className&&className.split(/\s+/).filter(Boolean).forEach(function(className){elem.classList.add(className)})},removeClass=function(elem,className){elem&&className&&className.split(/\s+/).filter(Boolean).forEach(function(className){elem.classList.remove(className)})},getChildByClass=function(elem,className){for(var i=0;i<elem.childNodes.length;i++)if(hasClass(elem.childNodes[i],className))return elem.childNodes[i]},show=function(elem,display){display||(display="block"),elem.style.opacity="",elem.style.display=display},hide=function(elem){elem.style.opacity="",elem.style.display="none"},empty=function(elem){for(;elem.firstChild;)elem.removeChild(elem.firstChild)},isVisible=function(elem){return elem.offsetWidth||elem.offsetHeight||elem.getClientRects().length},removeStyleProperty=function(elem,property){elem.style.removeProperty?elem.style.removeProperty(property):elem.style.removeAttribute(property)},fireClick=function(node){if(!isVisible(node))return!1;if("function"==typeof MouseEvent){var mevt=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0});node.dispatchEvent(mevt)}else if(document.createEvent){var evt=document.createEvent("MouseEvents");evt.initEvent("click",!1,!1),node.dispatchEvent(evt)}else document.createEventObject?node.fireEvent("onclick"):"function"==typeof node.onclick&&node.onclick()},animationEndEvent=function(){var testEl=document.createElement("div"),transEndEventNames={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",msAnimation:"MSAnimationEnd",animation:"animationend"};for(var i in transEndEventNames)if(transEndEventNames.hasOwnProperty(i)&&void 0!==testEl.style[i])return transEndEventNames[i];return!1}(),resetPrevState=function(){if(window.onkeydown=states.previousWindowKeyDown,states.previousActiveElement&&states.previousActiveElement.focus){var x=window.scrollX,y=window.scrollY;states.previousActiveElement.focus(),x&&y&&window.scrollTo(x,y)}},measureScrollbar=function(){if("ontouchstart"in window||navigator.msMaxTouchPoints)return 0;var scrollDiv=document.createElement("div");scrollDiv.style.width="50px",scrollDiv.style.height="50px",scrollDiv.style.overflow="scroll",document.body.appendChild(scrollDiv);var scrollbarWidth=scrollDiv.offsetWidth-scrollDiv.clientWidth;return document.body.removeChild(scrollDiv),scrollbarWidth},debounce=function(func,wait){var timeout=void 0;return function(){clearTimeout(timeout),timeout=setTimeout(function(){timeout=null,func()},wait)}},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},modalParams=_extends({},defaultParams),queue=[],swal2Observer=void 0,setParameters=function(params){var modal=getModal()||init(params);for(var param in params)defaultParams.hasOwnProperty(param)||"extraParams"===param||console.warn('s3bubbleSweetAlert2: Unknown parameter "'+param+'"');modal.style.width="number"==typeof params.width?params.width+"px":params.width,modal.style.padding=params.padding+"px",modal.style.background=params.background;for(var successIconParts=modal.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix"),i=0;i<successIconParts.length;i++)successIconParts[i].style.background=params.background;var title=getTitle(),content=getContent(),buttonsWrapper=getButtonsWrapper(),confirmButton=getConfirmButton(),cancelButton=getCancelButton(),closeButton=getCloseButton();if(params.titleText?title.innerText=params.titleText:title.innerHTML=params.title.split("\n").join("<br>"),params.text||params.html){if("object"===_typeof(params.html))if(content.innerHTML="",0 in params.html)for(var _i=0;_i in params.html;_i++)content.appendChild(params.html[_i].cloneNode(!0));else content.appendChild(params.html.cloneNode(!0));else params.html?content.innerHTML=params.html:params.text&&(content.textContent=params.text);show(content)}else hide(content);params.showCloseButton?show(closeButton):hide(closeButton),modal.className=swalClasses.modal,params.customClass&&addClass(modal,params.customClass);var progressStepsContainer=getProgressSteps(),currentProgressStep=parseInt(null===params.currentProgressStep?s3bubbleSweetAlert.getQueueStep():params.currentProgressStep,10);params.progressSteps.length?(show(progressStepsContainer),empty(progressStepsContainer),currentProgressStep>=params.progressSteps.length&&console.warn("s3bubbleSweetAlert2: Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),params.progressSteps.forEach(function(step,index){var circle=document.createElement("li");if(addClass(circle,swalClasses.progresscircle),circle.innerHTML=step,index===currentProgressStep&&addClass(circle,swalClasses.activeprogressstep),progressStepsContainer.appendChild(circle),index!==params.progressSteps.length-1){var line=document.createElement("li");addClass(line,swalClasses.progressline),line.style.width=params.progressStepsDistance,progressStepsContainer.appendChild(line)}})):hide(progressStepsContainer);for(var icons=getIcons(),_i2=0;_i2<icons.length;_i2++)hide(icons[_i2]);if(params.type){var validType=!1;for(var iconType in iconTypes)if(params.type===iconType){validType=!0;break}if(!validType)return console.error("s3bubbleSweetAlert2: Unknown alert type: "+params.type),!1;var icon=modal.querySelector("."+swalClasses.icon+"."+iconTypes[params.type]);if(show(icon),params.animation)switch(params.type){case"success":addClass(icon,"swal2-animate-success-icon"),addClass(icon.querySelector(".swal2-success-line-tip"),"swal2-animate-success-line-tip"),addClass(icon.querySelector(".swal2-success-line-long"),"swal2-animate-success-line-long");break;case"error":addClass(icon,"swal2-animate-error-icon"),addClass(icon.querySelector(".swal2-x-mark"),"swal2-animate-x-mark")}}var image=getImage();params.imageUrl?(image.setAttribute("src",params.imageUrl),show(image),params.imageWidth?image.setAttribute("width",params.imageWidth):image.removeAttribute("width"),params.imageHeight?image.setAttribute("height",params.imageHeight):image.removeAttribute("height"),image.className=swalClasses.image,params.imageClass&&addClass(image,params.imageClass)):hide(image),params.showCancelButton?cancelButton.style.display="inline-block":hide(cancelButton),params.showConfirmButton?removeStyleProperty(confirmButton,"display"):hide(confirmButton),params.showConfirmButton||params.showCancelButton?show(buttonsWrapper):hide(buttonsWrapper),confirmButton.innerHTML=params.confirmButtonText,cancelButton.innerHTML=params.cancelButtonText,params.buttonsStyling&&(confirmButton.style.backgroundColor=params.confirmButtonColor,cancelButton.style.backgroundColor=params.cancelButtonColor),confirmButton.className=swalClasses.confirm,addClass(confirmButton,params.confirmButtonClass),cancelButton.className=swalClasses.cancel,addClass(cancelButton,params.cancelButtonClass),params.buttonsStyling?(addClass(confirmButton,swalClasses.styled),addClass(cancelButton,swalClasses.styled)):(removeClass(confirmButton,swalClasses.styled),removeClass(cancelButton,swalClasses.styled),confirmButton.style.backgroundColor=confirmButton.style.borderLeftColor=confirmButton.style.borderRightColor="",cancelButton.style.backgroundColor=cancelButton.style.borderLeftColor=cancelButton.style.borderRightColor=""),!0===params.animation?removeClass(modal,swalClasses.noanimation):addClass(modal,swalClasses.noanimation)},openModal=function(animation,onComplete){var container=getContainer(),modal=getModal();animation?(addClass(modal,swalClasses.show),addClass(container,swalClasses.fade),removeClass(modal,swalClasses.hide)):removeClass(modal,swalClasses.fade),show(modal),container.style.overflowY="hidden",animationEndEvent&&!hasClass(modal,swalClasses.noanimation)?modal.addEventListener(animationEndEvent,function swalCloseEventFinished(){modal.removeEventListener(animationEndEvent,swalCloseEventFinished),container.style.overflowY="auto"}):container.style.overflowY="auto",addClass(document.documentElement,swalClasses.shown),addClass(document.body,swalClasses.shown),addClass(container,swalClasses.shown),fixScrollbar(),iOSfix(),states.previousActiveElement=document.activeElement,null!==onComplete&&"function"==typeof onComplete&&setTimeout(function(){onComplete(modal)})},fixScrollbar=function(){null===states.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(states.previousBodyPadding=document.body.style.paddingRight,document.body.style.paddingRight=measureScrollbar()+"px")},undoScrollbar=function(){null!==states.previousBodyPadding&&(document.body.style.paddingRight=states.previousBodyPadding,states.previousBodyPadding=null)},iOSfix=function(){if(/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream&&!hasClass(document.body,swalClasses.iosfix)){var offset=document.body.scrollTop;document.body.style.top=-1*offset+"px",addClass(document.body,swalClasses.iosfix)}},undoIOSfix=function(){if(hasClass(document.body,swalClasses.iosfix)){var offset=parseInt(document.body.style.top,10);removeClass(document.body,swalClasses.iosfix),document.body.style.top="",document.body.scrollTop=-1*offset}},s3bubbleSweetAlert=function s3bubbleSweetAlert(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];if(void 0===args[0])return console.error("s3bubbleSweetAlert2 expects at least 1 attribute!"),!1;var params=_extends({},modalParams);switch(_typeof(args[0])){case"string":params.title=args[0],params.html=args[1],params.type=args[2];break;case"object":_extends(params,args[0]),params.extraParams=args[0].extraParams,"email"===params.input&&null===params.inputValidator&&(params.inputValidator=function(email){return new Promise(function(resolve,reject){/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/.test(email)?resolve():reject("Invalid email address")})}),"url"===params.input&&null===params.inputValidator&&(params.inputValidator=function(url){return new Promise(function(resolve,reject){/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)$/.test(url)?resolve():reject("Invalid URL")})});break;default:return console.error('s3bubbleSweetAlert2: Unexpected type of argument! Expected "string" or "object", got '+_typeof(args[0])),!1}setParameters(params);var container=getContainer(),modal=getModal();return new Promise(function(resolve,reject){params.timer&&(modal.timeout=setTimeout(function(){s3bubbleSweetAlert.closeModal(params.onClose),params.useRejections?reject("timer"):resolve({dismiss:"timer"})},params.timer));var getInput=function(inputType){if(!(inputType=inputType||params.input))return null;switch(inputType){case"select":case"textarea":case"file":return getChildByClass(modal,swalClasses[inputType]);case"checkbox":return modal.querySelector("."+swalClasses.checkbox+" input");case"radio":return modal.querySelector("."+swalClasses.radio+" input:checked")||modal.querySelector("."+swalClasses.radio+" input:first-child");case"range":return modal.querySelector("."+swalClasses.range+" input");default:return getChildByClass(modal,swalClasses.input)}},getInputValue=function(){var input=getInput();if(!input)return null;switch(params.input){case"checkbox":return input.checked?1:0;case"radio":return input.checked?input.value:null;case"file":return input.files.length?input.files[0]:null;default:return params.inputAutoTrim?input.value.trim():input.value}};params.input&&setTimeout(function(){var input=getInput();input&&focusInput(input)},0);for(var confirm=function(value){params.showLoaderOnConfirm&&s3bubbleSweetAlert.showLoading(),params.preConfirm?params.preConfirm(value,params.extraParams).then(function(preConfirmValue){s3bubbleSweetAlert.closeModal(params.onClose),resolve(preConfirmValue||value)},function(error){s3bubbleSweetAlert.hideLoading(),error&&s3bubbleSweetAlert.showValidationError(error)}):(s3bubbleSweetAlert.closeModal(params.onClose),resolve(params.useRejections?value:{value:value}))},onButtonEvent=function(event){var e=event||window.event,target=e.target||e.srcElement,confirmButton=getConfirmButton(),cancelButton=getCancelButton(),targetedConfirm=confirmButton&&(confirmButton===target||confirmButton.contains(target)),targetedCancel=cancelButton&&(cancelButton===target||cancelButton.contains(target));switch(e.type){case"mouseover":case"mouseup":params.buttonsStyling&&(targetedConfirm?confirmButton.style.backgroundColor=colorLuminance(params.confirmButtonColor,-.1):targetedCancel&&(cancelButton.style.backgroundColor=colorLuminance(params.cancelButtonColor,-.1)));break;case"mouseout":params.buttonsStyling&&(targetedConfirm?confirmButton.style.backgroundColor=params.confirmButtonColor:targetedCancel&&(cancelButton.style.backgroundColor=params.cancelButtonColor));break;case"mousedown":params.buttonsStyling&&(targetedConfirm?confirmButton.style.backgroundColor=colorLuminance(params.confirmButtonColor,-.2):targetedCancel&&(cancelButton.style.backgroundColor=colorLuminance(params.cancelButtonColor,-.2)));break;case"click":if(targetedConfirm&&s3bubbleSweetAlert.isVisible())if(s3bubbleSweetAlert.disableButtons(),params.input){var inputValue=getInputValue();params.inputValidator?(s3bubbleSweetAlert.disableInput(),params.inputValidator(inputValue,params.extraParams).then(function(){s3bubbleSweetAlert.enableButtons(),s3bubbleSweetAlert.enableInput(),confirm(inputValue)},function(error){s3bubbleSweetAlert.enableButtons(),s3bubbleSweetAlert.enableInput(),error&&s3bubbleSweetAlert.showValidationError(error)})):confirm(inputValue)}else confirm(!0);else targetedCancel&&s3bubbleSweetAlert.isVisible()&&(s3bubbleSweetAlert.disableButtons(),s3bubbleSweetAlert.closeModal(params.onClose),params.useRejections?reject("cancel"):resolve({dismiss:"cancel"}))}},buttons=modal.querySelectorAll("button"),i=0;i<buttons.length;i++)buttons[i].onclick=onButtonEvent,buttons[i].onmouseover=onButtonEvent,buttons[i].onmouseout=onButtonEvent,buttons[i].onmousedown=onButtonEvent;getCloseButton().onclick=function(){s3bubbleSweetAlert.closeModal(params.onClose),params.useRejections?reject("close"):resolve({dismiss:"close"})},container.onclick=function(e){e.target===container&&params.allowOutsideClick&&(s3bubbleSweetAlert.closeModal(params.onClose),params.useRejections?reject("overlay"):resolve({dismiss:"overlay"}))};var buttonsWrapper=getButtonsWrapper(),confirmButton=getConfirmButton(),cancelButton=getCancelButton();params.reverseButtons?confirmButton.parentNode.insertBefore(cancelButton,confirmButton):confirmButton.parentNode.insertBefore(confirmButton,cancelButton);var setFocus=function(index,increment){for(var focusableElements=getFocusableElements(params.focusCancel),_i3=0;_i3<focusableElements.length;_i3++){(index+=increment)===focusableElements.length?index=0:-1===index&&(index=focusableElements.length-1);var el=focusableElements[index];if(isVisible(el))return el.focus()}},handleKeyDown=function(event){var e=event||window.event,keyCode=e.keyCode||e.which;if(-1!==[9,13,32,27,37,38,39,40].indexOf(keyCode)){for(var targetElement=e.target||e.srcElement,focusableElements=getFocusableElements(params.focusCancel),btnIndex=-1,_i4=0;_i4<focusableElements.length;_i4++)if(targetElement===focusableElements[_i4]){btnIndex=_i4;break}9===keyCode?(e.shiftKey?setFocus(btnIndex,-1):setFocus(btnIndex,1),e.stopPropagation(),e.preventDefault()):37===keyCode||38===keyCode||39===keyCode||40===keyCode?document.activeElement===confirmButton&&isVisible(cancelButton)?cancelButton.focus():document.activeElement===cancelButton&&isVisible(confirmButton)&&confirmButton.focus():13===keyCode||32===keyCode?-1===btnIndex&&params.allowEnterKey&&(fireClick(params.focusCancel?cancelButton:confirmButton),e.stopPropagation(),e.preventDefault()):27===keyCode&&!0===params.allowEscapeKey&&(s3bubbleSweetAlert.closeModal(params.onClose),params.useRejections?reject("esc"):resolve({dismiss:"esc"}))}};window.onkeydown&&window.onkeydown.toString()===handleKeyDown.toString()||(states.previousWindowKeyDown=window.onkeydown,window.onkeydown=handleKeyDown),params.buttonsStyling&&(confirmButton.style.borderLeftColor=params.confirmButtonColor,confirmButton.style.borderRightColor=params.confirmButtonColor),s3bubbleSweetAlert.hideLoading=s3bubbleSweetAlert.disableLoading=function(){params.showConfirmButton||(hide(confirmButton),params.showCancelButton||hide(getButtonsWrapper())),removeClass(buttonsWrapper,swalClasses.loading),removeClass(modal,swalClasses.loading),confirmButton.disabled=!1,cancelButton.disabled=!1},s3bubbleSweetAlert.getTitle=function(){return getTitle()},s3bubbleSweetAlert.getContent=function(){return getContent()},s3bubbleSweetAlert.getInput=function(){return getInput()},s3bubbleSweetAlert.getImage=function(){return getImage()},s3bubbleSweetAlert.getButtonsWrapper=function(){return getButtonsWrapper()},s3bubbleSweetAlert.getConfirmButton=function(){return getConfirmButton()},s3bubbleSweetAlert.getCancelButton=function(){return getCancelButton()},s3bubbleSweetAlert.enableButtons=function(){confirmButton.disabled=!1,cancelButton.disabled=!1},s3bubbleSweetAlert.disableButtons=function(){confirmButton.disabled=!0,cancelButton.disabled=!0},s3bubbleSweetAlert.enableConfirmButton=function(){confirmButton.disabled=!1},s3bubbleSweetAlert.disableConfirmButton=function(){confirmButton.disabled=!0},s3bubbleSweetAlert.enableInput=function(){var input=getInput();if(!input)return!1;if("radio"===input.type)for(var radios=input.parentNode.parentNode.querySelectorAll("input"),_i5=0;_i5<radios.length;_i5++)radios[_i5].disabled=!1;else input.disabled=!1},s3bubbleSweetAlert.disableInput=function(){var input=getInput();if(!input)return!1;if(input&&"radio"===input.type)for(var radios=input.parentNode.parentNode.querySelectorAll("input"),_i6=0;_i6<radios.length;_i6++)radios[_i6].disabled=!0;else input.disabled=!0},s3bubbleSweetAlert.recalculateHeight=debounce(function(){var modal=getModal();if(modal){var prevState=modal.style.display;modal.style.minHeight="",show(modal),modal.style.minHeight=modal.scrollHeight+1+"px",modal.style.display=prevState}},50),s3bubbleSweetAlert.showValidationError=function(error){var validationError=getValidationError();validationError.innerHTML=error,show(validationError);var input=getInput();input&&(focusInput(input),addClass(input,swalClasses.inputerror))},s3bubbleSweetAlert.resetValidationError=function(){var validationError=getValidationError();hide(validationError),s3bubbleSweetAlert.recalculateHeight();var input=getInput();input&&removeClass(input,swalClasses.inputerror)},s3bubbleSweetAlert.getProgressSteps=function(){return params.progressSteps},s3bubbleSweetAlert.setProgressSteps=function(progressSteps){params.progressSteps=progressSteps,setParameters(params)},s3bubbleSweetAlert.showProgressSteps=function(){show(getProgressSteps())},s3bubbleSweetAlert.hideProgressSteps=function(){hide(getProgressSteps())},s3bubbleSweetAlert.enableButtons(),s3bubbleSweetAlert.hideLoading(),s3bubbleSweetAlert.resetValidationError();for(var inputTypes=["input","file","range","select","radio","checkbox","textarea"],input=void 0,_i7=0;_i7<inputTypes.length;_i7++){var inputClass=swalClasses[inputTypes[_i7]],inputContainer=getChildByClass(modal,inputClass);if(input=getInput(inputTypes[_i7])){for(var j in input.attributes)if(input.attributes.hasOwnProperty(j)){var attrName=input.attributes[j].name;"type"!==attrName&&"value"!==attrName&&input.removeAttribute(attrName)}for(var attr in params.inputAttributes)input.setAttribute(attr,params.inputAttributes[attr])}inputContainer.className=inputClass,params.inputClass&&addClass(inputContainer,params.inputClass),hide(inputContainer)}var populateInputOptions=void 0;switch(params.input){case"text":case"email":case"password":case"number":case"tel":case"url":(input=getChildByClass(modal,swalClasses.input)).value=params.inputValue,input.placeholder=params.inputPlaceholder,input.type=params.input,show(input);break;case"file":(input=getChildByClass(modal,swalClasses.file)).placeholder=params.inputPlaceholder,input.type=params.input,show(input);break;case"range":var range=getChildByClass(modal,swalClasses.range),rangeInput=range.querySelector("input"),rangeOutput=range.querySelector("output");rangeInput.value=params.inputValue,rangeInput.type=params.input,rangeOutput.value=params.inputValue,show(range);break;case"select":var select=getChildByClass(modal,swalClasses.select);if(select.innerHTML="",params.inputPlaceholder){var placeholder=document.createElement("option");placeholder.innerHTML=params.inputPlaceholder,placeholder.value="",placeholder.disabled=!0,placeholder.selected=!0,select.appendChild(placeholder)}populateInputOptions=function(inputOptions){for(var optionValue in inputOptions){var option=document.createElement("option");option.value=optionValue,option.innerHTML=inputOptions[optionValue],params.inputValue===optionValue&&(option.selected=!0),select.appendChild(option)}show(select),select.focus()};break;case"radio":var radio=getChildByClass(modal,swalClasses.radio);radio.innerHTML="",populateInputOptions=function(inputOptions){for(var radioValue in inputOptions){var radioInput=document.createElement("input"),radioLabel=document.createElement("label"),radioLabelSpan=document.createElement("span");radioInput.type="radio",radioInput.name=swalClasses.radio,radioInput.value=radioValue,params.inputValue===radioValue&&(radioInput.checked=!0),radioLabelSpan.innerHTML=inputOptions[radioValue],radioLabel.appendChild(radioInput),radioLabel.appendChild(radioLabelSpan),radioLabel.for=radioInput.id,radio.appendChild(radioLabel)}show(radio);var radios=radio.querySelectorAll("input");radios.length&&radios[0].focus()};break;case"checkbox":var checkbox=getChildByClass(modal,swalClasses.checkbox),checkboxInput=getInput("checkbox");checkboxInput.type="checkbox",checkboxInput.value=1,checkboxInput.id=swalClasses.checkbox,checkboxInput.checked=Boolean(params.inputValue);var label=checkbox.getElementsByTagName("span");label.length&&checkbox.removeChild(label[0]),(label=document.createElement("span")).innerHTML=params.inputPlaceholder,checkbox.appendChild(label),show(checkbox);break;case"textarea":var textarea=getChildByClass(modal,swalClasses.textarea);textarea.value=params.inputValue,textarea.placeholder=params.inputPlaceholder,show(textarea);break;case null:break;default:console.error('s3bubbleSweetAlert2: Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'+params.input+'"')}"select"!==params.input&&"radio"!==params.input||(params.inputOptions instanceof Promise?(s3bubbleSweetAlert.showLoading(),params.inputOptions.then(function(inputOptions){s3bubbleSweetAlert.hideLoading(),populateInputOptions(inputOptions)})):"object"===_typeof(params.inputOptions)?populateInputOptions(params.inputOptions):console.error("s3bubbleSweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got "+_typeof(params.inputOptions))),openModal(params.animation,params.onOpen),params.allowEnterKey?setFocus(-1,1):document.activeElement&&document.activeElement.blur(),getContainer().scrollTop=0,"undefined"==typeof MutationObserver||swal2Observer||(swal2Observer=new MutationObserver(s3bubbleSweetAlert.recalculateHeight)).observe(modal,{childList:!0,characterData:!0,subtree:!0})})};return s3bubbleSweetAlert.isVisible=function(){return!!getModal()},s3bubbleSweetAlert.queue=function(steps){queue=steps;var resetQueue=function(){queue=[],document.body.removeAttribute("data-swal2-queue-step")},queueResult=[];return new Promise(function(resolve,reject){!function step(i,callback){i<queue.length?(document.body.setAttribute("data-swal2-queue-step",i),s3bubbleSweetAlert(queue[i]).then(function(result){queueResult.push(result),step(i+1,callback)},function(dismiss){resetQueue(),reject(dismiss)})):(resetQueue(),resolve(queueResult))}(0)})},s3bubbleSweetAlert.getQueueStep=function(){return document.body.getAttribute("data-swal2-queue-step")},s3bubbleSweetAlert.insertQueueStep=function(step,index){return index&&index<queue.length?queue.splice(index,0,step):queue.push(step)},s3bubbleSweetAlert.deleteQueueStep=function(index){void 0!==queue[index]&&queue.splice(index,1)},s3bubbleSweetAlert.close=s3bubbleSweetAlert.closeModal=function(onComplete){var container=getContainer(),modal=getModal();if(modal){removeClass(modal,swalClasses.show),addClass(modal,swalClasses.hide),clearTimeout(modal.timeout),resetPrevState();var removeModalAndResetState=function(){container.parentNode&&container.parentNode.removeChild(container),removeClass(document.documentElement,swalClasses.shown),removeClass(document.body,swalClasses.shown),undoScrollbar(),undoIOSfix()};animationEndEvent&&!hasClass(modal,swalClasses.noanimation)?modal.addEventListener(animationEndEvent,function swalCloseEventFinished(){modal.removeEventListener(animationEndEvent,swalCloseEventFinished),hasClass(modal,swalClasses.hide)&&removeModalAndResetState()}):removeModalAndResetState(),null!==onComplete&&"function"==typeof onComplete&&setTimeout(function(){onComplete(modal)})}},s3bubbleSweetAlert.clickConfirm=function(){return getConfirmButton().click()},s3bubbleSweetAlert.clickCancel=function(){return getCancelButton().click()},s3bubbleSweetAlert.showLoading=s3bubbleSweetAlert.enableLoading=function(){var modal=getModal();modal||s3bubbleSweetAlert("");var buttonsWrapper=getButtonsWrapper(),confirmButton=getConfirmButton(),cancelButton=getCancelButton();show(buttonsWrapper),show(confirmButton,"inline-block"),addClass(buttonsWrapper,swalClasses.loading),addClass(modal,swalClasses.loading),confirmButton.disabled=!0,cancelButton.disabled=!0},s3bubbleSweetAlert.setDefaults=function(userParams){if(!userParams||"object"!==(void 0===userParams?"undefined":_typeof(userParams)))return console.error("s3bubbleSweetAlert2: the argument for setDefaults() is required and has to be a object");for(var param in userParams)defaultParams.hasOwnProperty(param)||"extraParams"===param||(console.warn('s3bubbleSweetAlert2: Unknown parameter "'+param+'"'),delete userParams[param]);_extends(modalParams,userParams)},s3bubbleSweetAlert.resetDefaults=function(){modalParams=_extends({},defaultParams)},s3bubbleSweetAlert.noop=function(){},s3bubbleSweetAlert.version="6.6.5",s3bubbleSweetAlert.default=s3bubbleSweetAlert,s3bubbleSweetAlert}),window.s3bubbleSweetalert2&&(window.s3bubbleSweetAlert=window.s3bubbleswal=window.s3bubbleSweetalert2);var s3bubbleHelpers=s3bubbleGlobals();s3bubbleHelpers.addScripts(),function(){var JSONP,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};window.Waveform=function(){function Waveform(options){if(this.redraw=__bind(this.redraw,this),this.container=options.container,this.canvas=options.canvas,this.data=options.data||[],this.outerColor=options.outerColor||"transparent",this.innerColor=options.innerColor||"#000000",this.interpolate=!0,this.spacer=options.spacer||!1,!1===options.interpolate&&(this.interpolate=!1),null==this.canvas){if(!this.container)throw"Either canvas or container option must be passed";this.canvas=this.createCanvas(this.container,options.width||this.container.clientWidth,options.height||this.container.clientHeight)}this.patchCanvasForIE(this.canvas),this.context=this.canvas.getContext("2d"),this.width=parseInt(this.context.canvas.width,10),this.height=parseInt(this.context.canvas.height,10),options.data&&this.update(options)}return Waveform.name="Waveform",Waveform.prototype.setData=function(data){return this.data=data},Waveform.prototype.setDataInterpolated=function(data){return this.setData(this.interpolateArray(data,this.width))},Waveform.prototype.setDataCropped=function(data){return this.setData(this.expandArray(data,this.width))},Waveform.prototype.update=function(options){return null!=options.interpolate&&(this.interpolate=options.interpolate),!1===this.interpolate?this.setDataCropped(options.data):this.setDataInterpolated(options.data),this.redraw()},Waveform.prototype.redraw=function(){var d,i,middle,t,_i,_len,_ref,_results;for(this.clear(),this.context.fillStyle=this.innerColor,middle=this.height,i=0,_results=[],_i=0,_len=(_ref=this.data).length;_i<_len;_i++){d=_ref[_i],t=this.width/this.data.length,"function"==typeof this.innerColor&&(this.context.fillStyle=this.innerColor(i/this.width,d));var spacer=this.spacer;spacer?(this.context.clearRect(t*i,middle-middle*d,i%(spacer+1)==0?spacer:0,middle*d*2),this.context.fillRect(t*i,middle-middle*d,i%(spacer+1)==0?spacer:0,middle*d*2)):(this.context.clearRect(t*i,middle-middle*d,t,middle*d*2),this.context.fillRect(t*i,middle-middle*d,t,middle*d*2)),_results.push(i++)}return _results},Waveform.prototype.clear=function(){return this.context.fillStyle=this.outerColor,this.context.clearRect(0,0,this.width,this.height),this.context.fillRect(0,0,this.width,this.height)},Waveform.prototype.patchCanvasForIE=function(canvas){var oldGetContext;if(void 0!==window.G_vmlCanvasManager)return canvas=window.G_vmlCanvasManager.initElement(canvas),oldGetContext=canvas.getContext,canvas.getContext=function(a){var ctx;return ctx=oldGetContext.apply(canvas,arguments),canvas.getContext=oldGetContext,ctx}},Waveform.prototype.createCanvas=function(container,width,height){var canvas;return canvas=document.createElement("canvas"),container.appendChild(canvas),canvas.width=width,canvas.height=height,canvas},Waveform.prototype.expandArray=function(data,limit,defaultValue){var i,newData,_i,_ref;if(null==defaultValue&&(defaultValue=0),newData=[],data.length>limit)newData=data.slice(data.length-limit,data.length);else for(i=_i=0,_ref=limit-1;0<=_ref?_i<=_ref:_i>=_ref;i=0<=_ref?++_i:--_i)newData[i]=data[i]||defaultValue;return newData},Waveform.prototype.linearInterpolate=function(before,after,atPoint){return before+(after-before)*atPoint},Waveform.prototype.interpolateArray=function(data,fitCount){var after,atPoint,before,i,newData,springFactor,tmp;for(newData=new Array,springFactor=new Number((data.length-1)/(fitCount-1)),newData[0]=data[0],i=1;i<fitCount-1;)tmp=i*springFactor,before=new Number(Math.floor(tmp)).toFixed(),after=new Number(Math.ceil(tmp)).toFixed(),atPoint=tmp-before,newData[i]=this.linearInterpolate(data[before],data[after],atPoint),i++;return newData[fitCount-1]=data[data.length-1],newData},Waveform.prototype.optionsForSyncedStream=function(options){var innerColorWasSet,that;return null==options&&(options={}),innerColorWasSet=!1,that=this,{whileplaying:this.redraw,whileloading:function(){var stream;return innerColorWasSet||(stream=this,that.innerColor=function(x,y){return x<stream.position/stream.durationEstimate?options.playedColor||"rgba(255,  102, 0, 0.8)":x<stream.bytesLoaded/stream.bytesTotal?options.loadedColor||"rgba(0, 0, 0, 0.8)":options.defaultColor||"rgba(0, 0, 0, 0.4)"},innerColorWasSet=!0),this.redraw}}},Waveform.prototype.dataFromSoundCloudTrack=function(track){var _this=this;return JSONP.get("http://waveformjs.org/w",{url:track.waveform_url},function(data){return _this.update({data:data})})},Waveform}(),JSONP=function(){var config,counter,encode,jsonp,load,setDefaults,window;return load=function(url){var done,head,script;return script=document.createElement("script"),done=!1,script.src=url,script.async=!0,script.onload=script.onreadystatechange=function(){if(!(done||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)&&(done=!0,script.onload=script.onreadystatechange=null,script&&script.parentNode))return script.parentNode.removeChild(script)},head||(head=document.getElementsByTagName("head")[0]),head.appendChild(script)},encode=function(str){return encodeURIComponent(str)},jsonp=function(url,params,callback,callbackName){var key,query;query=-1===(url||"").indexOf("?")?"?":"&",params=params||{};for(key in params)params.hasOwnProperty(key)&&(query+=encode(key)+"="+encode(params[key])+"&");return jsonp="json"+ ++counter,window[jsonp]=function(data){callback(data);try{delete window[jsonp]}catch(_error){}return window[jsonp]=null},load(url+query+(callbackName||config.callbackName||"callback")+"="+jsonp),jsonp},setDefaults=function(obj){return obj},counter=0,void 0,void 0,void 0,window=this,config={},{get:jsonp,init:setDefaults}}()}.call(this),window.FontAwesomeCdnConfig={autoA11y:{enabled:!1},asyncLoading:{enabled:!1},reporting:{enabled:!0,domains:"localhost, *.dev"},useUrl:"use.fontawesome.com",faCdnUrl:"https://cdn.fontawesome.com:443",code:"90156040ed"},function(){function d(a){var b,c,d,e;a=a||"fa",b=document.querySelectorAll("."+a),Array.prototype.forEach.call(b,function(a){c=a.getAttribute("title"),a.setAttribute("aria-hidden","true"),d=!a.nextElementSibling||!a.nextElementSibling.classList.contains("sr-only"),c&&d&&(e=document.createElement("span"),e.innerHTML=c,e.classList.add("sr-only"),a.parentNode.insertBefore(e,a.nextSibling))})}!function(){"use strict";function a(a){l.push(a),1==l.length&&k()}function b(){for(;l.length;)l[0](),l.shift()}function c(a){this.a=m,this.b=void 0,this.f=[];var b=this;try{a(function(a){f(b,a)},function(a){g(b,a)})}catch(c){g(b,c)}}function e(a){return new c(function(b){b(a)})}function f(a,b){if(a.a==m){if(b==a)throw new TypeError;var c=!1;try{var d=b&&b.then;if(null!=b&&"object"==typeof b&&"function"==typeof d)return void d.call(b,function(b){c||f(a,b),c=!0},function(b){c||g(a,b),c=!0})}catch(e){return void(c||g(a,e))}a.a=0,a.b=b,h(a)}}function g(a,b){if(a.a==m){if(b==a)throw new TypeError;a.a=1,a.b=b,h(a)}}function h(b){a(function(){if(b.a!=m)for(;b.f.length;){var c=(a=b.f.shift())[0],d=a[1],e=a[2],a=a[3];try{0==b.a?e("function"==typeof c?c.call(void 0,b.b):b.b):1==b.a&&("function"==typeof d?e(d.call(void 0,b.b)):a(b.b))}catch(f){a(f)}}})}var k,l=[];k=function(){setTimeout(b)};var m=2;c.prototype.g=function(a){return this.c(void 0,a)},c.prototype.c=function(a,b){var d=this;return new c(function(c,e){d.f.push([a,b,c,e]),h(d)})},window.Promise||(window.Promise=c,window.Promise.resolve=e,window.Promise.reject=function(a){return new c(function(b,c){c(a)})},window.Promise.race=function(a){return new c(function(b,c){for(var d=0;d<a.length;d+=1)e(a[d]).c(b,c)})},window.Promise.all=function(a){return new c(function(b,c){var f=0,g=[];0==a.length&&b(g);for(var h=0;h<a.length;h+=1)e(a[h]).c(function(c){return function(d){g[c]=d,(f+=1)==a.length&&b(g)}}(h),c)})},window.Promise.prototype.then=c.prototype.c,window.Promise.prototype.catch=c.prototype.g)}(),function(){function a(a){this.el=a;for(var b=a.className.replace(/^\s+|\s+$/g,"").split(/\s+/),c=0;c<b.length;c++)d.call(this,b[c])}if(!(void 0===window.Element||"classList"in document.documentElement)){var c=Array.prototype,d=c.push,e=c.splice,f=c.join;a.prototype={add:function(a){this.contains(a)||(d.call(this,a),this.el.className=this.toString())},contains:function(a){return-1!=this.el.className.indexOf(a)},item:function(a){return this[a]||null},remove:function(a){if(this.contains(a)){for(var b=0;b<this.length&&this[b]!=a;b++);e.call(this,b,1),this.el.className=this.toString()}},toString:function(){return f.call(this," ")},toggle:function(a){return this.contains(a)?this.remove(a):this.add(a),this.contains(a)}},window.DOMTokenList=a,function(a,b,c){Object.defineProperty?Object.defineProperty(a,b,{get:c}):a.__defineGetter__(b,c)}(Element.prototype,"classList",function(){return new a(this)})}}();var e=function(a,b,c){function d(a){return g.body?a():void setTimeout(function(){d(a)})}function e(){h.addEventListener&&h.removeEventListener("load",e),h.media=c||"all"}var f,g=window.document,h=g.createElement("link");if(b)f=b;else{var i=(g.body||g.getElementsByTagName("head")[0]).childNodes;f=i[i.length-1]}var j=g.styleSheets;h.rel="stylesheet",h.href=a,h.media="only x",d(function(){f.parentNode.insertBefore(h,b?f:f.nextSibling)});var k=function(a){for(var b=h.href,c=j.length;c--;)if(j[c].href===b)return a();setTimeout(function(){k(a)})};return h.addEventListener&&h.addEventListener("load",e),h.onloadcssdefined=k,k(e),h},f=null;!function(){function a(a,b){document.addEventListener?a.addEventListener("scroll",b,!1):a.attachEvent("scroll",b)}function b(a){document.body?a():document.addEventListener?document.addEventListener("DOMContentLoaded",function b(){document.removeEventListener("DOMContentLoaded",b),a()}):document.attachEvent("onreadystatechange",function c(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",c),a())})}function c(a){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(a)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function d(a,b){a.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+b+";"}function e(a){var b=a.a.offsetWidth,c=b+100;return a.f.style.width=c+"px",a.c.scrollLeft=c,a.b.scrollLeft=a.b.scrollWidth+100,a.g!==b&&(a.g=b,!0)}function g(b,c){function d(){var a=f;e(a)&&a.a.parentNode&&c(a.g)}var f=b;a(b.b,d),a(b.c,d),e(b)}function h(a,b){var c=b||{};this.family=a,this.style=c.style||"normal",this.weight=c.weight||"normal",this.stretch=c.stretch||"normal"}function i(){if(null===l){var a=document.createElement("div");try{a.style.font="condensed 100px sans-serif"}catch(b){}l=""!==a.style.font}return l}function j(a,b){return[a.style,a.weight,i()?a.stretch:"","100px",b].join(" ")}var k=null,l=null,m=null;h.prototype.load=function(a,e){var f=this,h=a||"BESbswy",i=e||3e3,l=(new Date).getTime();return new Promise(function(a,e){if(null===m&&(m=!!window.FontFace),m){var n=new Promise(function(a,b){function c(){(new Date).getTime()-l>=i?b():document.fonts.load(j(f,f.family),h).then(function(b){1<=b.length?a():setTimeout(c,25)},function(){b()})}c()}),o=new Promise(function(a,b){setTimeout(b,i)});Promise.race([o,n]).then(function(){a(f)},function(){e(f)})}else b(function(){function b(){var b;(b=-1!=q&&-1!=r||-1!=q&&-1!=s||-1!=r&&-1!=s)&&((b=q!=r&&q!=s&&r!=s)||(null===k&&(b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),k=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))),b=k&&(q==t&&r==t&&s==t||q==u&&r==u&&s==u||q==v&&r==v&&s==v)),b=!b),b&&(w.parentNode&&w.parentNode.removeChild(w),clearTimeout(x),a(f))}function m(){if((new Date).getTime()-l>=i)w.parentNode&&w.parentNode.removeChild(w),e(f);else{var a=document.hidden;!0!==a&&void 0!==a||(q=n.a.offsetWidth,r=o.a.offsetWidth,s=p.a.offsetWidth,b()),x=setTimeout(m,50)}}var n=new c(h),o=new c(h),p=new c(h),q=-1,r=-1,s=-1,t=-1,u=-1,v=-1,w=document.createElement("div"),x=0;w.dir="ltr",d(n,j(f,"sans-serif")),d(o,j(f,"serif")),d(p,j(f,"monospace")),w.appendChild(n.a),w.appendChild(o.a),w.appendChild(p.a),document.body.appendChild(w),t=n.a.offsetWidth,u=o.a.offsetWidth,v=p.a.offsetWidth,m(),g(n,function(a){q=a,b()}),d(n,j(f,'"'+f.family+'",sans-serif')),g(o,function(a){r=a,b()}),d(o,j(f,'"'+f.family+'",serif')),g(p,function(a){s=a,b()}),d(p,j(f,'"'+f.family+'",monospace'))})})},f=h}();var g={observe:function(a,b){for(var c=b.prefix,e=0;e<a.length;e++)!function(a){var b=a.weight?"-"+a.weight:"",d=a.style?"-"+a.style:"",e=a.className?"-"+a.className:"",g=a.className?"-"+a.className+b+d:"",h=document.getElementsByTagName("html")[0].classList,i=function(a){h.add(c+e+"-"+a),h.add(c+g+"-"+a)},j=function(a){h.remove(c+e+"-"+a),h.remove(c+g+"-"+a)};i("loading"),new f(a.familyName).load(a.testString).then(function(){i("ready"),j("loading")},function(){i("failed"),j("loading")})}(a[e])}},h={load:function(a){var b=document.createElement("link");b.href=a,b.media="all",b.rel="stylesheet",document.getElementsByTagName("head")[0].appendChild(b)},loadAsync:function(a){e(a)}},i={load:function(a){var b=document.createElement("script"),c=document.scripts[0];b.src=a,c.parentNode.appendChild(b)}};try{if(window.FontAwesomeCdnConfig){var j=window.FontAwesomeCdnConfig,k=j.useUrl,l=j.faCdnUrl,m=j.code,n="FontAwesome",q=d.bind(d,"fa"),r=function(){};j.autoA11y.enabled&&(function(a){var b,c=[],d=document,f="DOMContentLoaded",g=(d.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(d.readyState);g||d.addEventListener(f,b=function(){for(d.removeEventListener(f,b),g=1;b=c.shift();)b()}),g?setTimeout(a,0):c.push(a)}(q),function(a){"undefined"!=typeof MutationObserver&&new MutationObserver(a).observe(document,{childList:!0,subtree:!0})}(q)),j.reporting.enabled&&function(a,b){var c=!1;return a.split(",").forEach(function(a){var d=new RegExp(a.trim().replace(".","\\.").replace("*","(.*)"));b.match(d)&&(c=!0)}),c}(j.reporting.domains,location.host)&&i.load(l+"/js/stats.js"),cssUrl="https://"+k+"/"+m+".css",new f(n).load("").then(function(){((window.FontAwesomeHooks||{}).loaded||r)()},r),j.asyncLoading.enabled?h.loadAsync(cssUrl):h.load(cssUrl),g.observe([{familyName:n,testString:""}],{prefix:"fa-events-icons"})}}catch(s){}}(),function(){var __indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++)if(i in this&&this[i]===item)return i;return-1};videojs.plugin("ga",function(options){var dataSetupOptions,defaultsEventsToTrack,end,error,eventCategory,eventLabel,eventsToTrack,fullscreen,parsedOptions,pause,percentsAlreadyTracked,percentsPlayedInterval,play,resize,seekEnd,seekStart,seeking,sendbeacon,timeupdate,volumeChange;return null==options&&(options={}),dataSetupOptions={},this.options()["data-setup"]&&(parsedOptions=JSON.parse(this.options()["data-setup"])).ga&&(dataSetupOptions=parsedOptions.ga),defaultsEventsToTrack=["percentsPlayed","start","end","seek","play","pause","resize","volumeChange","error","fullscreen"],eventsToTrack=options.eventsToTrack||dataSetupOptions.eventsToTrack||defaultsEventsToTrack,percentsPlayedInterval=options.percentsPlayedInterval||dataSetupOptions.percentsPlayedInterval||10,eventCategory=options.eventCategory||dataSetupOptions.eventCategory||"event",eventLabel=options.hasOwnProperty("code")?options.code:"blank",options.debug=options.debug||!1,percentsAlreadyTracked=[],seekStart=seekEnd=0,seeking=!1,timeupdate=function(){var currentTime,duration,percent,percentPlayed,_i;for(currentTime=Math.round(this.currentTime()),duration=Math.round(this.duration()),percentPlayed=Math.round(currentTime/duration*100),percent=_i=0;_i<=99;percent=_i+=percentsPlayedInterval)percentPlayed>=percent&&__indexOf.call(percentsAlreadyTracked,percent)<0&&(__indexOf.call(eventsToTrack,"start")>=0&&0===percent&&percentPlayed>0?sendbeacon("start",!0):__indexOf.call(eventsToTrack,"percentsPlayed")>=0&&0!==percentPlayed&&sendbeacon("percent played",!0,percent),percentPlayed>0&&percentsAlreadyTracked.push(percent));__indexOf.call(eventsToTrack,"seek")>=0&&(seekStart=seekEnd,seekEnd=currentTime,Math.abs(seekStart-seekEnd)>1&&(seeking=!0,sendbeacon("seek start",!1,seekStart),sendbeacon("seek end",!1,seekEnd)))},end=function(){sendbeacon("end",!0)},play=function(){var currentTime;currentTime=Math.round(this.currentTime()),sendbeacon("play",!0,currentTime),seeking=!1},pause=function(){var currentTime;(currentTime=Math.round(this.currentTime()))===Math.round(this.duration())||seeking||sendbeacon("pause",!1,currentTime)},volumeChange=function(){var volume;volume=!0===this.muted()?0:this.volume(),sendbeacon("volume change",!1,volume)},resize=function(){sendbeacon("resize - "+this.width()+"*"+this.height(),!0)},error=function(){var currentTime;currentTime=Math.round(this.currentTime()),sendbeacon("error",!0,currentTime)},fullscreen=function(){var currentTime;currentTime=Math.round(this.currentTime()),("function"==typeof this.isFullscreen?this.isFullscreen():void 0)||("function"==typeof this.isFullScreen?this.isFullScreen():void 0)?sendbeacon("enter fullscreen",!1,currentTime):sendbeacon("exit fullscreen",!1,currentTime)},sendbeacon=function(action,nonInteraction,value){window.ga?ga("s3bubble.send","event",{eventCategory:"s3bubble."+eventCategory,eventAction:action,eventLabel:eventLabel,eventValue:value,nonInteraction:nonInteraction}):window._gaq?_gaq.push(["_trackEvent",eventCategory,action,eventLabel,value,nonInteraction]):options.debug&&console.log("Google Analytics not detected")},this.ready(function(){if(this.on("timeupdate",timeupdate),__indexOf.call(eventsToTrack,"end")>=0&&this.on("ended",end),__indexOf.call(eventsToTrack,"play")>=0&&this.on("play",play),__indexOf.call(eventsToTrack,"pause")>=0&&this.on("pause",pause),__indexOf.call(eventsToTrack,"volumeChange")>=0&&this.on("volumechange",volumeChange),__indexOf.call(eventsToTrack,"resize")>=0&&this.on("resize",resize),__indexOf.call(eventsToTrack,"error")>=0&&this.on("error",error),__indexOf.call(eventsToTrack,"fullscreen")>=0)return this.on("fullscreenchange",fullscreen)}),{sendbeacon:sendbeacon}})}.call(this),window.videojs.plugin("thumbnails",function(options){var div,img,player,progressControl,duration,moveListener,moveCancel;if((player=this).el()){var setupCheck=player.el().getElementsByClassName("vjs-thumbnail-holder")[0];setupCheck&&setupCheck.parentNode.removeChild(setupCheck),0!==options.length&&(function(){var progressControl,addFakeActive,removeFakeActive;-1!==navigator.userAgent.toLowerCase().indexOf("android")&&(addFakeActive=function(){progressControl.addClass("fake-active")},removeFakeActive=function(){progressControl.removeClass("fake-active")},(progressControl=player.controlBar.progressControl).on("touchstart",addFakeActive),progressControl.on("touchend",removeFakeActive),progressControl.on("touchcancel",removeFakeActive))}(),(div=document.createElement("div")).className="vjs-thumbnail-holder",(img=document.createElement("img")).width="200",div.appendChild(img),img.src=options[0].src,img.className="vjs-thumbnail",img.style.left||img.style.right||(img.onload=function(){img.style.left="-100px"}),duration=player.duration(),player.on("durationchange",function(event){duration=player.duration()}),player.on("loadedmetadata",function(event){duration=player.duration()}),(progressControl=player.controlBar.progressControl).el().appendChild(div),moveListener=function(event){if(!(event.offsetX<=1)){var mouseTime,active,left,setting;active=0,left=event.offsetX,mouseTime=Math.floor(event.offsetX/progressControl.width()*duration),active=10*Math.round(mouseTime/10),options.width=200,void 0!=(setting=options[active])&&(img.src=setting.src),left>1&&(div.style.left=left+"px")}},progressControl.on("mousemove",moveListener),progressControl.on("touchmove",moveListener),moveCancel=function(event){},progressControl.on("mouseout",moveCancel),progressControl.on("touchcancel",moveCancel),progressControl.on("touchend",moveCancel),player.on("userinactive",moveCancel))}}),window.videojs.plugin("popitPlugin",function(div,options){var getPlayerDiv=document.getElementById(div),getPlayer=document.getElementById(div+"-player"),throttleDown=0,throttleUp=0,split=s3bubbleHelpers.isMobile()?1.5:3,vWidth=options.hasOwnProperty("width")?options.width:Math.round(window.innerWidth/split),vHeight=Math.round(vWidth/16*9);document.addEventListener("scroll",function(event){throttleDown>10&&(s3bubbleHelpers.addClass(getPlayer,"vjs-popit"),getPlayer.style.width=vWidth+"px",getPlayer.style.height=vHeight+"px",throttleDown=0),throttleUp>10&&(s3bubbleHelpers.removeClass(getPlayer,"vjs-popit"),getPlayer.style.width="",getPlayer.style.height="",throttleUp=0),!1===s3bubbleHelpers.isScrolledIntoView(getPlayerDiv)?throttleDown++:throttleUp++})}),window.videojs.plugin("brandPlugin",function(options){var player=this;if("object"==typeof options){var sheet=document.getElementById("s3bubble-amazon-s3-audio-streaming-css-css");null!=sheet&&(sheet.disabled=!0);var controlBar=player.el().getElementsByClassName("vjs-control-bar");controlBar.length>0&&controlBar[0].style.setProperty("background-color",options.controlbar,"important");var bigPlayButton=player.el().getElementsByClassName("vjs-big-play-button");bigPlayButton.length>0&&(bigPlayButton[0].style.setProperty("background-color",options.controlbar,"important"),bigPlayButton[0].style.setProperty("color",options.icons,"important"));for(var control=player.el().getElementsByClassName("vjs-control"),i=0;i<control.length;i++)void 0!==control[i]&&control[i].style.setProperty("color",options.icons,"important");var playProgress=player.el().getElementsByClassName("vjs-play-progress");playProgress.length>0&&playProgress[0].style.setProperty("background-color",options.sliders,"important");var volumeLevel=player.el().getElementsByClassName("vjs-volume-level");volumeLevel.length>0&&volumeLevel[0].style.setProperty("background-color",options.sliders,"important");var adPlaying=player.el().getElementsByClassName("vjs-ad-playing");adPlaying.length>0&&adPlaying[0].style.setProperty("background-color",options.sliders,"important");var css=".video-js .vjs-progress-control .vjs-mouse-display:after, .vjs-mouse-display .vjs-time-tooltip {background:"+options.sliders+";} .vjs-control-popover, .s3bubble-skip-btn {background:"+options.controlbar+";} .vjs-icon-airplay, .vjs-control-playlist, .vjs-s3bubble-button a, .s3bubble-skip-btn {color:"+options.icons+"  !important;}",head=document.head||document.getElementsByTagName("head")[0],style=document.createElement("style");style.type="text/css",style.styleSheet?style.styleSheet.cssText=css:style.appendChild(document.createTextNode(css)),head.appendChild(style)}}),window.videojs.plugin("waveformPlugin",function(div,options){if(options.source.waveform){var waveBgColor="#444";options.brand.controlbar&&(waveBgColor=options.brand.controlbar);var player=this,waveform=null,setupCheck=document.getElementById("vjs-s3bubble-waveform");setupCheck&&setupCheck.parentNode.removeChild(setupCheck);var waveformDiv=document.createElement("div");waveformDiv.id="vjs-s3bubble-waveform",waveformDiv.style.width="98%",waveformDiv.style.height="50px",waveformDiv.style.position="absolute",waveformDiv.style.marginLeft="1%",waveformDiv.style.zIndex="1";var startEvent="click";(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(startEvent="touchstart"),waveformDiv.addEventListener(startEvent,function(event){if(event.touches)var touch=event.touches[0],posX=Math.round(touch.clientX),width=Math.round(event.target.clientWidth);else var posX=Math.round(event.offsetX),width=Math.round(event.target.clientWidth);player.currentTime(player.duration()/width*posX),player.play()},!1),player.el().getElementsByClassName("vjs-control-bar")[0].appendChild(waveformDiv),player.el().getElementsByClassName("vjs-progress-control")[0].style.opacity="0",player.on("timeupdate",function(){var current=player.currentTime(),duration=player.duration(),percentage=(this.remainingTime(),current/duration*100);percentage=Math.round(parseInt(percentage)),waveform&&waveform.redraw()}),s3bubbleHelpers.getJson({waveform:options.source.waveform},function(response){var duration=response.duration,waveData=response.left;(waveform=new Waveform({container:waveformDiv,height:50,interpolate:!0,spacer:0,innerColor:function(percentageOfWaveform,d){return percentageOfWaveform>player.currentTime()/duration?waveBgColor:options.brand.sliders}})).update({data:waveData}),window.onresize=function(event){document.getElementById("vjs-s3bubble-waveform").innerHTML="",(waveform=new Waveform({container:waveformDiv,height:50,interpolate:!0,spacer:0,innerColor:function(percentageOfWaveform,d){return percentageOfWaveform>player.currentTime()/duration?waveBgColor:options.brand.sliders}})).update({data:waveData})},waveformDiv.style.top="-51px",waveformDiv.style.left="0px",waveformDiv.style.right="0px"})}}),window.videojs.plugin("vPaidPlugin",function(id,data){if(""!==data.options.vpaid){var player=this;try{var contentPlayer=document.getElementById("s3bubble-"+data.id+"_html5_api");(navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&contentPlayer.hasAttribute("controls")&&contentPlayer.removeAttribute("controls"),player.ima({id:id,adTagUrl:data.options.vpaid}),player.ima.initializeAdDisplayContainer(),player.ima.requestAds(),player.play()}catch(e){console.log("VPAID ERROR: ",e)}}}),function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).videojsS3bubbleMetaOverlay=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){"use strict";exports.__esModule=!0;var _video2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}("undefined"!=typeof window?window.videojs:void 0!==global?global.videojs:null),defaults={},onPlayerReady=function(player,options){var setupCheck=player.el().getElementsByClassName("s3bubble-meta-overlay")[0];setupCheck&&setupCheck.parentNode.removeChild(setupCheck);var clickEvent="click";(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(clickEvent="touchend");var showSocial=options.showSocial,BackButton=options.backButton,SkipButtons=options.skipButtons,Artist=s3bubbleHelpers.s3bubbleCleanFilename(options.subTitle),Title=s3bubbleHelpers.s3bubbleCleanFilename(options.title),Desc=s3bubbleHelpers.s3bubbleCleanFilename(options.para),s3BubbleMetaOverlayWrap=document.createElement("div");s3BubbleMetaOverlayWrap.id="s3bubble-meta-overlay",s3BubbleMetaOverlayWrap.className="s3bubble-meta-overlay";var s3BubbleMetaOverlayInnerWrap=document.createElement("div");s3BubbleMetaOverlayInnerWrap.id="s3bubble-meta-overlay-container",s3BubbleMetaOverlayInnerWrap.className="s3bubble-meta-overlay-container player-hidden",s3BubbleMetaOverlayWrap.appendChild(s3BubbleMetaOverlayInnerWrap);var shareLinks=[{class:"fb",icon:"fa fa-facebook",link:"https://www.facebook.com/sharer/sharer.php?u="+window.location.href+"&amp;title="+Title},{class:"tw",icon:"fa fa-twitter",link:"https://twitter.com/intent/tweet?url="+window.location.href+"&amp;text="+Title},{class:"gp",icon:"fa fa-google",link:"https://plus.google.com/share?url="+window.location.href}],buildShareItems=document.createElement("ul");buildShareItems.className="social";for(var i=shareLinks.length-1;i>=0;i--){var menuUlList=document.createElement("li"),menuUlListLink=document.createElement("a");menuUlListLink.className=shareLinks[i].class,menuUlListLink.innerHTML='<i class="'+shareLinks[i].icon+'"></i>',menuUlListLink.setAttribute("link",shareLinks[i].link),menuUlListLink.addEventListener(clickEvent,function(event){return window.open(this.getAttribute("link"),"S3BubbleShareWindow","height=400, width=600, top=100, left=100, toolbar=0, centerscreen=yes, resizable=yes, modal=yes, scrollbars=0"),!1}),menuUlList.appendChild(menuUlListLink),buildShareItems.appendChild(menuUlList)}if(options.hasOwnProperty("download")&&""!=options.download){var s3BubbleMetaOverlayWrapDownload=document.createElement("a");s3BubbleMetaOverlayWrapDownload.style.top=showSocial?"50px":"0px",s3BubbleMetaOverlayWrapDownload.className=" s3bubble-meta-overlay-download player-hidden",s3BubbleMetaOverlayWrapDownload.innerHTML='<i class="fa fa-cloud-download"></i> Download',s3BubbleMetaOverlayWrapDownload.addEventListener(clickEvent,function(event){return window.open(options.download,"_blank").focus(),!1}),s3BubbleMetaOverlayWrapDownload.appendChild(buildShareItems),s3BubbleMetaOverlayWrap.appendChild(s3BubbleMetaOverlayWrapDownload)}var s3BubbleMetaOverlayWrapShare=document.createElement("div");s3BubbleMetaOverlayWrapShare.className=" s3bubble-meta-overlay-social-share player-hidden",s3BubbleMetaOverlayWrapShare.style.display=showSocial?"block":"none",s3BubbleMetaOverlayWrapShare.appendChild(buildShareItems),s3BubbleMetaOverlayWrap.appendChild(s3BubbleMetaOverlayWrapShare);var s3BubbleMetaOverlayWrapBackButton=document.createElement("a");s3BubbleMetaOverlayWrapBackButton.className="s3bubble-meta-overlay-back-to-browse",s3BubbleMetaOverlayWrapBackButton.innerHTML='<i class="fa fa-chevron-circle-left" aria-hidden="true"></i>',s3BubbleMetaOverlayWrapBackButton.style.display=BackButton?"block":"none",s3BubbleMetaOverlayWrapBackButton.addEventListener(clickEvent,function(){window.history.back()}),s3BubbleMetaOverlayInnerWrap.appendChild(s3BubbleMetaOverlayWrapBackButton);var bigPlayBtn=player.el().getElementsByClassName("vjs-big-play-button")[0],forwardBtn=document.createElement("span");forwardBtn.style.display=SkipButtons?"block":"none";var forwardBtnIcon=document.createElement("i");forwardBtn.className="s3bubble-skip-forward s3bubble-skip-btn",forwardBtn.appendChild(forwardBtnIcon),forwardBtnIcon.className="fa fa-repeat",forwardBtn.addEventListener(clickEvent,function(){var skip=player.currentTime();player.currentTime(skip+60)}),bigPlayBtn.appendChild(forwardBtn);var backBtn=document.createElement("span");backBtn.style.display=SkipButtons?"block":"none";var backBtnIcon=document.createElement("i");backBtn.className="s3bubble-skip-backward s3bubble-skip-btn",backBtn.appendChild(backBtnIcon),backBtnIcon.className="fa fa-undo",backBtn.addEventListener(clickEvent,function(){var skip=player.currentTime();player.currentTime(skip-60)}),bigPlayBtn.appendChild(backBtn);var s3BubbleMetaOverlayWrapSubTitle=document.createElement("h5");s3BubbleMetaOverlayWrapSubTitle.innerHTML=Artist,s3BubbleMetaOverlayWrapSubTitle.style.display=Artist?"block":"none",s3BubbleMetaOverlayInnerWrap.appendChild(s3BubbleMetaOverlayWrapSubTitle);var s3BubbleMetaOverlayWrapTitle=document.createElement("h1");s3BubbleMetaOverlayWrapTitle.innerHTML=Title,s3BubbleMetaOverlayWrapTitle.style.display=Title?"block":"none",s3BubbleMetaOverlayInnerWrap.appendChild(s3BubbleMetaOverlayWrapTitle);var s3BubbleMetaOverlayWrapPara=document.createElement("p");s3BubbleMetaOverlayWrapPara.innerHTML=Desc,s3BubbleMetaOverlayWrapPara.style.display=Desc?"block":"none",s3BubbleMetaOverlayInnerWrap.appendChild(s3BubbleMetaOverlayWrapPara),player.el().appendChild(s3BubbleMetaOverlayWrap);var setFont=function(){s3bubbleHelpers.setFontSize({id:player.id(),elements:[{fontRatio:14,el:s3BubbleMetaOverlayWrapBackButton},{fontRatio:60,el:s3BubbleMetaOverlayWrapSubTitle},{fontRatio:25,el:s3BubbleMetaOverlayWrapTitle},{fontRatio:55,el:s3BubbleMetaOverlayWrapPara}]})};window.addEventListener("resize",setFont,!1),setFont(),new MutationObserver(function(mutations){setFont()}).observe(player.el(),{attributes:!0,attributeFilter:["style"]}),s3bubbleHelpers.removeClass(s3BubbleMetaOverlayInnerWrap,"player-hidden"),s3bubbleHelpers.removeClass(s3BubbleMetaOverlayWrapShare,"player-hidden"),player.on("play",function(){s3bubbleHelpers.addClass(s3BubbleMetaOverlayInnerWrap,"player-hidden"),s3bubbleHelpers.addClass(s3BubbleMetaOverlayWrap,"s3bubble-meta-overlay-hidden")}),player.on("pause",function(){s3bubbleHelpers.removeClass(s3BubbleMetaOverlayInnerWrap,"player-hidden"),s3bubbleHelpers.removeClass(s3BubbleMetaOverlayWrap,"s3bubble-meta-overlay-hidden"),s3bubbleHelpers.addClass(s3BubbleMetaOverlayWrap,"s3bubble-meta-overlay-visible")}),player.on("playing",function(){s3bubbleHelpers.addClass(s3BubbleMetaOverlayInnerWrap,"player-hidden"),s3bubbleHelpers.addClass(s3BubbleMetaOverlayWrap,"s3bubble-meta-overlay-hidden")})},s3BubbleMetaOverlay=function(options){var _this=this;this.ready(function(){onPlayerReady(_this,_video2.default.mergeOptions(defaults,options))})};_video2.default.plugin("s3BubbleMetaOverlay",s3BubbleMetaOverlay),s3BubbleMetaOverlay.VERSION="0.0.3",exports.default=s3BubbleMetaOverlay}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}),window.videojs.plugin("s3BubbleMultiAdvertsLoad",function(options){var player=this,adverts=options.adverts;adverts.sort(function(a,b){return parseFloat(a.time)-parseFloat(b.time)}),options.hasOwnProperty("adverts")&&(adverts.length>0?(player.adverts=adverts,player.adverts.source=options.source):delete player.adverts)}),window.videojs.plugin("s3BubbleMultiAdvertsInit",function(brand){function search(idKey,myArray){for(var i=0;i<myArray.length;i++)if(parseInt(myArray[i].time)===idKey)return{data:myArray[i],index:i}}var player=this,firePlayThroughOnce=!0,progressBar=(player.el().getElementsByClassName("vjs-progress-holder")[0],player.el().getElementsByClassName("vjs-progress-control")[0]),skipButton=player.addChild("button");skipButton.el(),skipButton.el().id="s3bubble-skip-button",skipButton.el().className="s3bubble-skip-button",skipButton.el().style.width="70px",skipButton.el().style.height="30px",skipButton.el().style.position="absolute",skipButton.el().style.bottom="50px",skipButton.el().style.cursor="pointer",skipButton.el().style.right="-2px",skipButton.el().style.borderRadius="2px",skipButton.el().style.background=brand.controlbar,skipButton.el().style.display="none",skipButton.el().style.zIndex="2";var skipButtonText=document.createElement("a"),skipButtonDiv=player.el().getElementsByClassName("s3bubble-skip-button")[0];skipButtonDiv&&(skipButtonDiv.appendChild(skipButtonText),skipButtonText.innerHTML="Skip",skipButtonText.style.fontSize="16px",skipButtonText.style.fontWeight="normal",skipButtonText.style.margin="0px",skipButtonText.style.padding="0px",skipButtonText.style.color=brand.icons,skipButton.on("click",function(){resumeVideo()}));var s3bubbleAdvertismentText=document.createElement("div");s3bubbleAdvertismentText.id="advertisement",s3bubbleAdvertismentText.className="vjs-control vjs-s3bubble-advertisement",s3bubbleAdvertismentText.style.width="auto",s3bubbleAdvertismentText.style.padding="0 10px",s3bubbleAdvertismentText.style.lineHeight="30px",s3bubbleAdvertismentText.style.textAlign="left",s3bubbleAdvertismentText.style.display="none";var s3bubbleAdvertismentLink=document.createElement("a");s3bubbleAdvertismentLink.className="vjs-control line-height",s3bubbleAdvertismentLink.setAttribute("href",""),s3bubbleAdvertismentLink.setAttribute("target","_blank"),s3bubbleAdvertismentLink.addEventListener("click",function(){window.open(this.getAttribute("href"),"_blank").focus(),event.preventDefault()}),s3bubbleAdvertismentLink.innerHTML="Advertisement",s3bubbleAdvertismentLink.style.color=brand.icons,s3bubbleAdvertismentLink.style.textDecoration="none",s3bubbleAdvertismentLink.style.textAlign="left",s3bubbleAdvertismentText.appendChild(s3bubbleAdvertismentLink);var controlBar=player.el().getElementsByClassName("vjs-control-bar")[0],insertBeforeNode=player.el().getElementsByClassName("vjs-volume-menu-button")[0],playAdvert=function(data){player.advert_playing=!0,player.advert_last_time=Math.floor(player.currentTime()),player.advert_skip=parseInt(data.skip),s3bubbleAdvertismentText.style.display="block",progressBar.style.height="0px",progressBar.style.overflow="hidden",player.el().getElementsByClassName("vjs-s3bubble-switch")[0]&&(player.el().getElementsByClassName("vjs-s3bubble-switch")[0].style.display="none"),player.el().getElementsByClassName("vjs-hide-me")[0]&&(player.el().getElementsByClassName("vjs-hide-me")[0].style.display="none"),player.el().getElementsByClassName("vjs-share-control")[0]&&(player.el().getElementsByClassName("vjs-share-control")[0].style.display="none"),player.el().getElementsByClassName("vjs-captions-button")[0]&&(player.el().getElementsByClassName("vjs-captions-button")[0].style.display="none"),player.el().getElementsByClassName("vjs-playback-rate")[0]&&(player.el().getElementsByClassName("vjs-playback-rate")[0].style.display="none"),player.el().getElementsByClassName("vjs-control-playlist")[0]&&(player.el().getElementsByClassName("vjs-control-playlist")[0].style.display="none"),player.el().getElementsByClassName("vjs-captions-button")[0]&&(player.el().getElementsByClassName("vjs-captions-button")[0].style.display="none"),player.src({type:data.mime_type,src:data.url}),player.currentTime(0),player.play();var linkIt=data.link;""!=linkIt&&(s3bubbleAdvertismentLink.innerHTML="Ad: More information",s3bubbleAdvertismentLink.setAttribute("href",linkIt))},resumeVideo=function(){player.advert_playing=!1,firePlayThroughOnce=!0,player.src(player.adverts.source),player.play()};player.on("timeupdate",function(_event){var time=Math.round(this.currentTime()),duration=Math.floor(this.duration());if(this.hasOwnProperty("adverts")){if(!this.advert_playing){var resultObject=search(time,this.adverts);resultObject&&(playAdvert(resultObject.data),this.adverts.splice(resultObject.index,1))}time===duration&&0!=duration&&this.advert_playing&&resumeVideo(),this.hasOwnProperty("advert_skip")&&this.advert_skip>0&&time>this.advert_skip&&(skipButton.el().style.display="block",this.advert_skip=null)}}),player.on("playing",function(_event){!this.advert_playing&&this.hasOwnProperty("adverts")&&(skipButton.el().style.display="none",s3bubbleAdvertismentText.style.display="none",progressBar.style.height="auto",progressBar.style.overflow="visible",this.el().getElementsByClassName("vjs-s3bubble-switch")[0]&&(this.el().getElementsByClassName("vjs-s3bubble-switch")[0].style.display="block"),this.el().getElementsByClassName("vjs-hide-me")[0]&&(this.el().getElementsByClassName("vjs-hide-me")[0].style.display="block"),this.el().getElementsByClassName("vjs-share-control")[0]&&(this.el().getElementsByClassName("vjs-share-control")[0].style.display="block"),this.el().getElementsByClassName("vjs-captions-button")[0]&&(this.el().getElementsByClassName("vjs-captions-button")[0].style.display="block"),this.el().getElementsByClassName("vjs-playback-rate")[0]&&(this.el().getElementsByClassName("vjs-playback-rate")[0].style.display="block"),this.el().getElementsByClassName("vjs-control-playlist")[0]&&(this.el().getElementsByClassName("vjs-control-playlist")[0].style.display="block"),player.el().getElementsByClassName("vjs-captions-button")[0]&&(player.el().getElementsByClassName("vjs-captions-button")[0].style.display="block"))}),player.on("loadedmetadata",function(_event){controlBar.insertBefore(s3bubbleAdvertismentText,insertBeforeNode.nextSibling),!this.advert_playing&&this.hasOwnProperty("adverts")&&firePlayThroughOnce&&(player.currentTime(player.advert_last_time),firePlayThroughOnce=!1)})}),window.videojs.plugin("playlistPlugin",function(settings){var player=this;if(settings.codes){var codeList=settings.codes;if(codeList.length>1){player.on("ended",function(){var ind=parseInt(settings.index);ind<settings.codes.length-1?ind++:ind=0,player.playlistSkip(ind)});var playlistToggle=videojs.getComponent("MenuButton"),playlistButton=videojs.extend(playlistToggle,{constructor:function(player,options){playlistToggle.call(this,player,options),this.controlText("")},handleClick:function(){},buildCSSClass:function(){return"fa fa-bars vjs-menu-button vjs-menu-button-popup vjs-control vjs-control-playlist"}});videojs.registerComponent("playlistToggle",playlistButton),player.controlBar.childNameIndex_.hasOwnProperty("playlistToggle")||(playlistToggle=player.controlBar.addChild("playlistToggle",{}),s3bubbleHelpers.getData({uri:"playlist_button",location:location.host,codes:codeList},function(response){if(response.error)console.log("ERROR: ",response.message);else{var menuPopover=document.createElement("div");menuPopover.className="vjs-menu vjs-control-popover";var menuUL=document.createElement("ul");menuUL.className="vjs-menu-content vjs-s3bubble-playlist",menuUL.style.setProperty("max-height",player.el().offsetHeight-50+"px","important");var clickEvent="click";(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(clickEvent="touchend");for(var setPlaylist=response.results,i=0;i<setPlaylist.length;i++){var selected=settings.hasOwnProperty("setIndex")?parseInt(settings.setIndex):0,child=document.createElement("li");child.className="vjs-menu-item "+(i===selected?"vjs-selected":""),child.id=i;var title=""===setPlaylist[i].title?setPlaylist[i].key:setPlaylist[i].title,para=""===setPlaylist[i].para?"No description":setPlaylist[i].para,poster=setPlaylist[i].poster;child.innerHTML="<span class='vjs-s3bubble-playlist-img' style='background-image:url("+poster+");'></span><span class='vjs-s3bubble-playlist-title'>"+s3bubbleHelpers.s3bubbleCleanFilename(title)+"</span><span class='vjs-s3bubble-playlist-para'>"+s3bubbleHelpers.s3bubbleCleanFilename(para)+"</span>",child.addEventListener(clickEvent,function(e){player.playlistSkip(this.getAttribute("id"))},!1),menuUL.appendChild(child)}menuPopover.appendChild(menuUL),playlistToggle.el().appendChild(menuPopover)}}))}}}),window.videojs.plugin("playlistPluginLazy",function(settings){var player=this;if(settings.codes){var codeList=settings.codes;if(codeList.length>1){player.on("ended",function(){var ind=parseInt(settings.index);ind<settings.codes.length-1?ind++:ind=0,player.playlistSkip(ind)});var playlistToggle=videojs.getComponent("MenuButton"),playlistButton=videojs.extend(playlistToggle,{constructor:function(player,options){playlistToggle.call(this,player,options),this.controlText("")},handleClick:function(){},buildCSSClass:function(){return"fa fa-bars vjs-menu-button vjs-menu-button-popup vjs-control vjs-control-playlist-lazy"}});if(videojs.registerComponent("playlistToggle",playlistButton),!player.controlBar.childNameIndex_.hasOwnProperty("playlistToggle")){var playlistToggle=player.controlBar.addChild("playlistToggle",{}),menuPopover=document.createElement("div");menuPopover.className="vjs-menu vjs-control-popover";var menuUL=document.createElement("ul");menuUL.className="vjs-menu-content vjs-s3bubble-playlist-lazy",menuUL.style.setProperty("max-height",player.el().offsetHeight-50+"px","important");var clickEvent="click";(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(clickEvent="touchend");for(var setPlaylist=codeList,i=0;i<setPlaylist.length;i++){var selected=settings.hasOwnProperty("setIndex")?parseInt(settings.setIndex):0,child=document.createElement("li");child.className="vjs-menu-item "+(i===selected?"vjs-selected":""),child.id=i,child.innerHTML="<span class='vjs-s3bubble-playlist-lazy-title'>"+(i+1)+". <i class='fa "+setPlaylist[i].media+"' aria-hidden='true'></i> "+s3bubbleHelpers.s3bubbleCleanFilename(setPlaylist[i].title)+"</span>",child.addEventListener(clickEvent,function(e){player.playlistSkip(this.getAttribute("id"))},!1),menuUL.appendChild(child)}menuPopover.appendChild(menuUL),playlistToggle.el().appendChild(menuPopover)}}}}),window.videojs.plugin("previewPlugin",function(options){var player=this;options.fire=!0,player.preview=options;player.on("timeupdate",function(){if(player.preview.previewSeconds>0&&player.currentTime()>parseInt(player.preview.previewSeconds)){if(player.preview.fire){var previewHtml='<div class="preview-over-wrapper-trans"></div><div class="preview-over-wrapper"><span><div class="card radius shadowDepth1"><div class="card__content card__padding"><div class="card__share"><a id="share" class="share-toggle share-icon" href="'+player.preview.previewLink+'" target="_blank"></a></div><article class="card__article"><h2>'+player.preview.previewTitle+"</h2><p>"+player.preview.previewDescription+"</p></article></div></div></span></div>",previewerElement=document.createElement("div");previewerElement.id="preview-over",previewerElement.className="preview-over",previewerElement.innerHTML=previewHtml,player.el().appendChild(previewerElement),player.preview.fire=!1}player.pause(),document.webkitExitFullscreen&&document.webkitExitFullscreen()}}),player.updatePreview=function(data){var setupCheck=player.el().getElementsByClassName("preview-over")[0];setupCheck&&setupCheck.parentNode.removeChild(setupCheck),data.fire=!0,player.preview=data}}),window.videojs.plugin("buttonsPlugin",function(buttons){var player=this;if(buttons){buttons.sort(function(a,b){return a.position-b.position});for(var i=0;i<buttons.length;i++)!function(data){data.player;var controlBar,newElement=document.createElement("div"),newLink=document.createElement("a"),newIcon=document.createElement("i");newElement.className=data.pclass+" vjs-control",data.link?(newElement.appendChild(newLink),newLink.setAttribute("href",data.link),newLink.setAttribute("target","_blank"),newLink.appendChild(newIcon)):newElement.appendChild(newIcon),newIcon.className=data.iconClass,controlBar=document.getElementsByClassName("vjs-control-bar")[0],insertBeforeNode=document.getElementsByClassName(data.before)[0],controlBar.insertBefore(newElement,insertBeforeNode.nextSibling)}({player:player,iconClass:"fa "+buttons[i].icon,pclass:"vjs-hide-me vjs-s3bubble-button",before:"vjs-remaining-time",link:buttons[i].link})}}),window.videojs.plugin("airplayPlugin",function(options){var player=this;if(window.WebKitPlaybackTargetAvailabilityEvent){var videoEl=player.el().getElementsByTagName("video")[0],AirplayToggle=videojs.getComponent("Button"),AirplayButton=videojs.extend(AirplayToggle,{constructor:function(player,options){AirplayToggle.call(this,player,options),this.controlText("Airplay")},handleClick:function(){videoEl.webkitShowPlaybackTargetPicker()},buildCSSClass:function(){return"vjs-icon-airplay vjs-control vjs-button"}});videojs.registerComponent("AirplayToggle",AirplayButton),videoEl.addEventListener("webkitplaybacktargetavailabilitychanged",function(event){switch(event.availability){case"available":player.on("loadeddata",function(){if(!player.controlBar.childNameIndex_.hasOwnProperty("AirplayToggle")){var AirplayToggle=player.controlBar.addChild("AirplayToggle",{});player.controlBar.el().insertBefore(AirplayToggle.el(),player.controlBar.fullscreenToggle.el())}});break;case"not-available":console.log("airplay not available")}})}}),window.videojs.plugin("ratesSwitcherPlugin",function(options){var player=this,setupCheck=player.el().getElementsByClassName("vjs-s3bubble-switch")[0];if(setupCheck&&setupCheck.parentNode.removeChild(setupCheck),"application/x-mpegURL"==player.currentType_&&player.tech_.hasOwnProperty("hls")&&!s3bubbleHelpers.isMobile()){var newElement=document.createElement("div");newElement.id="switch",newElement.className="vjs-hide-me vjs-control vjs-s3bubble-switch";var menuUL=document.createElement("ul");menuUL.className="vjs-menu-content";var i,repButtons=player.tech_.hls.representations(),resHeight=Math.max.apply(Math,repButtons.map(function(o){return o.height})),classIndex=100;for(i=0;i<repButtons.length;i++){repButtons[i].height===resHeight&&(classIndex=i);var res=function(preset){var url=preset.id,name=url.substring(0,url.indexOf("/"));return name.length>10?preset.bandwidth/1e3+"k":name.indexOf("p")>=0?name:preset.hasOwnProperty("height")?preset.height:preset.bandwidth/1e3+"k"}(repButtons[i]),child=document.createElement("li");child.className="vjs-menu-item",child.id=repButtons[i].bandwidth,child.innerHTML=res+'<span class="vjs-control-text"></span>',child.addEventListener("click",function(e){var c,children=menuUL.childNodes;for(c=0;c<children.length;c++)s3bubbleHelpers.removeClass(children[c],"vjs-selected");s3bubbleHelpers.addClass(this,"vjs-selected");var a,ratesSelected=parseInt(this.getAttribute("id"));for(a=0;a<repButtons.length;a++)repButtons[a].bandwidth===ratesSelected?repButtons[a].enabled(!0):repButtons[a].enabled(!1)},!1),menuUL.appendChild(child)}var menuULDiv=document.createElement("div");menuULDiv.className="vjs-playback-rate vjs-menu-button vjs-menu-button-popup vjs-control vjs-button",newElement.appendChild(menuULDiv);var menuULInnerDiv=document.createElement("div");menuULInnerDiv.className="vjs-menu res-btn",menuULDiv.appendChild(menuULInnerDiv);var menuULInnerPlaybackDiv=document.createElement("div");menuULInnerPlaybackDiv.className="vjs-playback-rate-value",menuULDiv.appendChild(menuULInnerPlaybackDiv);var menuULInnerIcon=document.createElement("i");menuULInnerIcon.className="fa fa-cog",menuULInnerIcon.style.color=options.brand.icons,menuULInnerPlaybackDiv.appendChild(menuULInnerIcon);var controlBar=player.el().getElementsByClassName("vjs-control-bar")[0],insertBeforeNode=player.el().getElementsByClassName("vjs-fullscreen-control")[0];controlBar.insertBefore(newElement,insertBeforeNode),player.el().getElementsByClassName("res-btn")[0].appendChild(menuUL),options.hasOwnProperty("options")&&options.options.hasOwnProperty("forceQuality")&&setTimeout(function(){document.getElementById(repButtons[classIndex].bandwidth).click()},1e3)}}),window.videojs.plugin("ratesSwitcherLivePlugin",function(options){var player=this,setupCheck=player.el().getElementsByClassName("vjs-s3bubble-switch")[0];if(setupCheck&&setupCheck.parentNode.removeChild(setupCheck),options.buttons&&!s3bubbleHelpers.isMobile()){var newElement=document.createElement("div");newElement.id="live-switch",newElement.className="vjs-hide-me vjs-control vjs-s3bubble-switch";var menuUL=document.createElement("ul");menuUL.className="vjs-menu-content";for(var i=0;i<options.buttons.length;i++){var child=document.createElement("li");child.className="vjs-menu-item",child.id=options.buttons[i].id,child.innerHTML=options.buttons[i].uri+'<span class="vjs-control-text"></span>',child.addEventListener("click",function(e){var i,children=menuUL.childNodes;for(i=0;i<children.length;i++)s3bubbleHelpers.removeClass(children[i],"vjs-selected");s3bubbleHelpers.addClass(this,"vjs-selected");var ratesSelected=this.getAttribute("id");if(1===parseInt(ratesSelected)){var hasFlash=!1;try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")&&(hasFlash=!0)}catch(e){navigator.mimeTypes&&void 0!=navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(hasFlash=!0)}hasFlash?(player.pause(),player.src(options.settings.rtmp),player.load(),player.play()):(player.error(1),player.el().getElementsByClassName("vjs-modal-dialog-content")[0].innerHTML="<div class='vjs-modal-dialog-content-inner'><h2>Information</h2><p>You dont not have flash installed flash is required to run the fastest playback please install below. !Important you maybe need to close and re open browser after install.</p><span><a href='https://get.adobe.com/flashplayer' target='_blank'>Install Flash</a></span></div>")}2===parseInt(ratesSelected)&&(player.pause(),player.src(options.settings.m3u8),player.load(),player.play())},!1),menuUL.appendChild(child)}var menuULDiv=document.createElement("div");menuULDiv.className="vjs-playback-rate vjs-menu-button vjs-menu-button-popup vjs-control vjs-button",newElement.appendChild(menuULDiv);var menuULInnerDiv=document.createElement("div");menuULInnerDiv.className="vjs-menu res-btn",menuULDiv.appendChild(menuULInnerDiv);var menuULInnerPlaybackDiv=document.createElement("div");menuULInnerPlaybackDiv.className="vjs-playback-rate-value",menuULDiv.appendChild(menuULInnerPlaybackDiv);var menuULInnerIcon=document.createElement("i");menuULInnerIcon.className="fa fa-cog",menuULInnerIcon.style.color=options.settings.brand.icons,menuULInnerPlaybackDiv.appendChild(menuULInnerIcon);var controlBar=player.el().getElementsByClassName("vjs-control-bar")[0],insertBeforeNode=player.el().getElementsByClassName("vjs-fullscreen-control")[0];controlBar.insertBefore(newElement,insertBeforeNode),player.el().getElementsByClassName("res-btn")[0].appendChild(menuUL)}}),window.videojs.plugin("errorsPlugin",function(){this.on("error",function(_event){var error=this.player().error(),errorModal=this.el().getElementsByClassName("vjs-modal-dialog-content")[0];if(void 0!==errorModal)switch(parseInt(error.code)){case 1:case 2:case 3:case 4:case 5:case 6:errorModal.innerHTML="<div class='vjs-modal-dialog-content-inner'><h2>Error</h2><p>"+error.message+"</p></div>";break;case 7:errorModal.innerHTML="<div class='vjs-modal-dialog-content-inner'><h2>Error</h2><p>"+error.message+". </p><span><a href='http://status.aws.amazon.com/' target='_blank'>AWS service health</a></span></div>";break;default:errorModal.innerHTML="<div class='vjs-modal-dialog-content-inner'><h2>Error</h2><p>"+error.message+"</p></div>"}})}); 
     1function s3bubbleGlobals(){var defaults={api:"https://s3bubbleapi.com"},helpers={};return helpers.extend=function(og,so){for(var key in so)"object"==typeof og[key]?helpers.extend(og[key],so[key]):og[key]=so[key];return og},helpers.isScrolledIntoView=function(el){var elemTop=el.getBoundingClientRect().top,elemBottom=el.getBoundingClientRect().bottom;return elemTop<window.innerHeight&&elemBottom>=0},helpers.setFontSize=function(options){var elw=document.getElementById(options.id).offsetWidth,defaults={maximum:9999,minimum:1,maxFont:9999,minFont:1,fontRatio:35};if(options.hasOwnProperty("elements"))for(var elms=options.elements,i=elms.length-1;i>=0;i--)if(elms[i].hasOwnProperty("fontRatio")&&elms[i].hasOwnProperty("el")){var fontBase=(elw>defaults.maximum?defaults.maximum:elw<defaults.minimum?defaults.minimum:elw)/elms[i].fontRatio,fontSize=fontBase>defaults.maxFont?defaults.maxFont:fontBase<defaults.minFont?defaults.minFont:fontBase;elms[i].el.style.fontSize=fontSize+"px"}},helpers.addScripts=function(){var ima3=document.createElement("script");ima3.type="text/javascript",ima3.src="//imasdk.googleapis.com/js/sdkloader/ima3.js";var googleAnalytics=document.createElement("script");googleAnalytics.type="text/javascript",googleAnalytics.async=!0,googleAnalytics.src="//www.google-analytics.com/analytics.js",document.getElementsByTagName("head")[0].setAttribute("data-cast-api-enabled","true");var chromeCastSDK=document.createElement("script");chromeCastSDK.type="text/javascript",chromeCastSDK.async=!0,chromeCastSDK.src="//www.gstatic.com/cv/js/sender/v1/cast_sender.js",function(){try{return window.self!==window.top}catch(e){return!0}}()||(document.head.appendChild(ima3),document.head.appendChild(googleAnalytics),document.head.appendChild(chromeCastSDK));var s3bubbleMain=document.getElementsByClassName("s3bubble");for(i=0;i<s3bubbleMain.length;i++)if(s3bubbleMain[i].getAttribute("data-setup")){setup=JSON.parse(s3bubbleMain[i].getAttribute("data-setup"));s3bubble(s3bubbleMain[i].getAttribute("id")).video(setup)}var s3bubbleModal=document.getElementsByClassName("s3bubble-modal");for(i=0;i<s3bubbleModal.length;i++)if(s3bubbleModal[i].getAttribute("data-setup")){setup=JSON.parse(s3bubbleModal[i].getAttribute("data-setup"));s3bubble("s3bubble-modal").modal(setup)}var s3bubbleService=document.getElementsByClassName("s3bubble-service");for(i=0;i<s3bubbleService.length;i++)if(s3bubbleService[i].getAttribute("data-setup")){setup=JSON.parse(s3bubbleService[i].getAttribute("data-setup"));s3bubble(s3bubbleService[i].getAttribute("id")).service(setup)}var s3bubbleAudio=document.getElementsByClassName("s3bubble-audio");for(i=0;i<s3bubbleAudio.length;i++)if(s3bubbleAudio[i].getAttribute("data-setup")){setup=JSON.parse(s3bubbleAudio[i].getAttribute("data-setup"));s3bubble(s3bubbleAudio[i].getAttribute("id")).audio(setup)}var s3bubbleLive=document.getElementsByClassName("s3bubble-live");for(i=0;i<s3bubbleLive.length;i++)if(s3bubbleLive[i].getAttribute("data-setup")){setup=JSON.parse(s3bubbleLive[i].getAttribute("data-setup"));s3bubble(s3bubbleLive[i].getAttribute("id")).live(setup)}var s3bubblePlaylist=document.getElementsByClassName("s3bubble-playlist");for(i=0;i<s3bubblePlaylist.length;i++)if(s3bubblePlaylist[i].getAttribute("data-setup")){setup=JSON.parse(s3bubblePlaylist[i].getAttribute("data-setup"));s3bubble(s3bubblePlaylist[i].getAttribute("id")).playlist(setup)}var s3bubbleLazyPlaylist=document.getElementsByClassName("s3bubble-lazy");for(i=0;i<s3bubbleLazyPlaylist.length;i++)if(s3bubbleLazyPlaylist[i].getAttribute("data-setup")){var setup=JSON.parse(s3bubbleLazyPlaylist[i].getAttribute("data-setup"));s3bubble(s3bubbleLazyPlaylist[i].getAttribute("id")).lazy(setup)}for(var s3bubbleLinkClick=document.getElementsByClassName("s3bubble-link"),i=0;i<s3bubbleLinkClick.length;i++)s3bubbleLinkClick[i].addEventListener("click",function(){var setup=JSON.parse(this.getAttribute("data-setup"));s3bubble("s3bubble-modal").modal(setup)},!1)},helpers.getData=function(data,callback){var xhr=new XMLHttpRequest;xhr.open("POST",defaults.api+"/api/"+data.uri),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.onload=function(){if(200===xhr.status){var data=JSON.parse(xhr.responseText);callback(data.error?{error:!0,message:data.message}:data)}else 200!==xhr.status&&callback({error:!0,message:"Request failed.  Returned status of "+xhr.status})},data.location=location.host.indexOf("www.")&&location.host||location.host.replace("www.",""),xhr.send(function(object){var encodedString="";for(var prop in object)object.hasOwnProperty(prop)&&(encodedString.length>0&&(encodedString+="&"),encodedString+=encodeURI(prop+"="+object[prop]));return encodedString}(data))},helpers.getJson=function(data,callback){var xhr=new XMLHttpRequest;xhr.open("GET",data.waveform),xhr.setRequestHeader("Content-Type","application/json"),xhr.onload=function(){if(200===xhr.status){var data=JSON.parse(xhr.responseText);callback(data.error?{error:!0,message:data.message}:data)}else 200!==xhr.status&&callback({error:!0,message:"Request failed.  Returned status of "+xhr.status})},xhr.send()},helpers.swipedetect=function(el,callback){var swipedir,startX,startY,distX,distY,elapsedTime,startTime,touchsurface=el,handleswipe=callback||function(swipedir){};touchsurface.addEventListener("touchstart",function(e){var touchobj=e.changedTouches[0];swipedir="none",dist=0,startX=touchobj.pageX,startY=touchobj.pageY,startTime=(new Date).getTime(),e.preventDefault()},!1),touchsurface.addEventListener("touchmove",function(e){e.preventDefault()},!1),touchsurface.addEventListener("touchend",function(e){var touchobj=e.changedTouches[0];distX=touchobj.pageX-startX,distY=touchobj.pageY-startY,(elapsedTime=(new Date).getTime()-startTime)<=300&&(Math.abs(distX)>=150&&Math.abs(distY)<=100?swipedir=distX<0?"left":"right":Math.abs(distY)>=150&&Math.abs(distX)<=100&&(swipedir=distY<0?"up":"down")),handleswipe(swipedir),e.preventDefault()},!1)},helpers.s3bubbleCleanFilename=function(name){if(""===name||void 0===name||!1===name)return null;try{return name=decodeURIComponent(name),name=name.replace(/\\/g,""),name=name.replace(/\_/g," "),name=name.replace(/\-/g," ")}catch(err){return name=name.replace(/\\/g,""),name=name.replace(/\_/g," "),name=name.replace(/\-/g," ")}},helpers.hasClass=function(ele,cls){if(ele)return!!ele.className.match(new RegExp("(\\s|^)"+cls+"(\\s|$)"))},helpers.addClass=function(ele,cls){ele&&(helpers.hasClass(ele,cls)||(ele.className+=" "+cls))},helpers.removeClass=function(ele,cls){if(ele&&helpers.hasClass(ele,cls)){var reg=new RegExp("(\\s|^)"+cls+"(\\s|$)");ele.className=ele.className.replace(reg," ")}},helpers.isAndroid=function(){return navigator.userAgent.match(/Android/i)},helpers.isBlackBerry=function(){return navigator.userAgent.match(/BlackBerry/i)},helpers.isIOS=function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},helpers.isOpera=function(){return navigator.userAgent.match(/Opera Mini/i)},helpers.isWindows=function(){return navigator.userAgent.match(/IEMobile/i)||navigator.userAgent.match(/WPDesktop/i)},helpers.isMobile=function(){return helpers.isAndroid()||helpers.isBlackBerry()||helpers.isIOS()||helpers.isOpera()||helpers.isWindows()},helpers.getExternalService=function(url){if(url.match(/(http:\/\/|https:\/\/|)(player.|www.)?(dailymotion\.com|vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),RegExp.$3.indexOf("youtu")>-1)type="youtube";else if(RegExp.$3.indexOf("vimeo")>-1)type="vimeo";else if(RegExp.$3.indexOf("dailymotion")>-1)var type="dailymotion";return{type:type,id:RegExp.$6}},helpers}function s3bubble(div){var s3bubble={};return videojs.browser.IS_ANY_SAFARI||(videojs.options.hls.overrideNative=!0,videojs.options.html5.nativeAudioTracks=!1,videojs.options.html5.nativeTextTracks=!1),s3bubble.playlist=function(options,callback){if(options.hasOwnProperty("code")){var getPlayerDiv=document.getElementById(div);null!==getPlayerDiv?s3bubbleHelpers.getData({uri:"playlist_codes",id:options.code},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),player=videojs("aws-player"),player.errorsPlugin(),void player.error({code:7,message:_response.message});options.codes=_response.codes,options.options=_response.options,options.meta=_response.meta,options.brand=_response.brand,options.source=_response.source,options.playlist=!0,options.hasOwnProperty("type")&&"audio"===options.type?s3bubble.audio(options,callback):s3bubble.video(options,callback)}):console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: Code is a required option")},s3bubble.modal=function(options,callback){if(options.hasOwnProperty("codes"))if(options.hasOwnProperty("modal")){var text="";options.modal.hasOwnProperty("text")&&(text="<p style='margin-top:10px;'>"+options.modal.text+"</p>"),options.modal.html="<div id='"+div+"' class='s3bubbble-prepare-16-9'></div>"+text,options.hasOwnProperty("options")?options.options.prepare=!0:(options.options={},options.options.prepare=!0);var link=null;if(options.modal.hasOwnProperty("link")&&(link=options.modal.link,delete options.modal.link),options.modal.hasOwnProperty("delay")){var delay=options.modal.delay;delete options.modal.delay,setTimeout(function(){if(s3bubbleswal(options.modal).then(function(){var searchForOldPlayers=document.querySelector("#"+div);null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),link&&window.open(link,"_self")}),!options.modal.hasOwnProperty("title")){var removeTitle=document.querySelector(".s3bubble-swal2-title");null!=removeTitle&&removeTitle.parentNode.removeChild(removeTitle)}options.hasOwnProperty("type")&&"audio"===options.type?s3bubble.audio(options,callback):s3bubble.video(options,callback)},delay)}else{if(s3bubbleswal(options.modal).then(function(){var searchForOldPlayers=document.querySelector("#"+div);null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),link&&window.open(link,"_self")}),!options.modal.hasOwnProperty("title")){var removeTitle=document.querySelector(".s3bubble-swal2-title");null!=removeTitle&&removeTitle.parentNode.removeChild(removeTitle)}options.hasOwnProperty("type")&&"audio"===options.type?s3bubble.audio(options,callback):s3bubble.video(options,callback)}}else options.hasOwnProperty("options")?options.options.prepare=!0:(options.options={},options.options.prepare=!0),s3bubbleswal({html:"<div id='"+div+"' class='s3bubbble-prepare-16-9'></div>",width:800}).then(function(){var searchForOldPlayers=document.querySelector("#"+div);null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose())}),options.hasOwnProperty("type")&&"audio"===options.type?s3bubble.audio(options,callback):s3bubble.video(options,callback);else console.log("ERROR: Code is a required option")},s3bubble.audio=function(options,callback){var settings,video,player,searchForOldPlayers=document.querySelector("#"+div);if(null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),options.hasOwnProperty("codes")){"string"==typeof options.codes&&(options.codes=[options.codes]);var getPlayerDiv=document.getElementById(div);if(null!==getPlayerDiv){var int=0;options.hasOwnProperty("setIndex")&&(int=parseInt(options.setIndex)),s3bubbleHelpers.getData({uri:"player",code:options.codes[int]},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),(player=videojs("aws-player")).errorsPlugin(),void player.error({code:7,message:_response.message});(settings=s3bubbleHelpers.extend(_response,options)).index=0,settings.length=0,window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create",settings.options.googleUaCode,"auto","s3bubble"),ga("s3bubble.send","pageview"),ga("s3bubble.send","event","s3bubble.init","video.code",settings.options.code),ga("s3bubble.send","event","s3bubble.init","video.bucket",settings.options.bucket),ga("s3bubble.send","event","s3bubble.init","video.title",s3bubbleHelpers.s3bubbleCleanFilename(settings.meta.title)),ga("s3bubble.send","event","s3bubble.init","video.key",settings.options.key),ga("s3bubble.send","event","s3bubble.init","video.vpaid",settings.options.vpaid),(video=document.createElement("video")).id=div+"-player",video.className="video-js vjs-default-skin",video.poster=settings.source.poster,video.controls=settings.options.controls,video.muted=settings.options.muted,video.preload=settings.options.preload,video.crossorigin="anonymous",video.playsinline=!0,video.addEventListener("contextmenu",function(e){e.preventDefault()},!1),settings.options.hasOwnProperty("prepare")&&(video.style.position="absolute",video.style.top="0px"),getPlayerDiv.appendChild(video),s3bubbleHelpers.swipedetect(getPlayerDiv,function(swipedir){"right"===swipedir&&window.history.back()});var videoOptions={autoplay:settings.options.autoplay,playbackRates:settings.options.playbackRates,loop:settings.options.loop,nativeControlsForTouch:!1,plugins:{chromecast:{appId:settings.options.hasOwnProperty("chromecast")?settings.options.chromecast:"E14DC85B"}}};settings.options.hasOwnProperty("width")&&(videoOptions.width=settings.options.width),settings.options.hasOwnProperty("height")&&(videoOptions.height=settings.options.height),settings.options.hasOwnProperty("height")||settings.options.hasOwnProperty("width")||(settings.options.hasOwnProperty("aspect")?video.classList.add("vjs-"+settings.options.aspect):video.classList.add("vjs-16-9")),settings.options.fluid&&video.classList.add("vjs-s3bubble-fullscreen");var css=".vjs-default-skin.vjs-user-inactive .vjs-control-bar {opacity:1 !important;}.video-js .vjs-control-bar {display:inline-flex !important;}",head=document.head||document.getElementsByTagName("head")[0],style=document.createElement("style");style.type="text/css",style.styleSheet?style.styleSheet.cssText=css:style.appendChild(document.createTextNode(css)),head.appendChild(style),(player=videojs(div+"-player",videoOptions,function(){this.one("durationchange",function(){if(settings.hasOwnProperty("startTime")){var skipToPercentage=this.duration()/100*settings.startTime;this.currentTime(Math.round(parseInt(skipToPercentage)))}}),settings.hasOwnProperty("popit")&&this.popitPlugin(div,settings.popit),this.playlistPlugin(settings),this.airplayPlugin(),this.ga({code:settings.options.code}),callback&&callback(this)})).src(settings.source),player.errorsPlugin(),player.waveformPlugin(div,settings),settings.source.hasOwnProperty("download")&&"application/x-mpegURL"!=settings.source.type&&(settings.meta.download=settings.source.download),player.s3BubbleMetaOverlay(settings.meta),player.brandPlugin(settings.brand),s3bubbleHelpers.isMobile()&&(player.el().getElementsByClassName("vjs-big-play-button")[0].style.display="none"),settings.hasOwnProperty("playlist")||(player.previewPlugin(settings.preview),player.buttonsPlugin(settings.buttons));var startEvent=settings.options.autoplay?"loadedmetadata":"click";(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(startEvent="touchend"),player.one(startEvent,function(_event){this.vPaidPlugin(div+"-player",settings)}),player.on("loadedmetadata",function(_event){this.ratesSwitcherPlugin(settings)}),player.playlistSkip=function(ind){var that=this;settings.index=ind;var code=settings.codes.indexOf(ind);-1!=code&&(settings.index=code);var getPlaylist=that.el().getElementsByClassName("vjs-s3bubble-playlist");if(getPlaylist){var i,playlistChildren=getPlaylist[0].childNodes;for(i=0;i<playlistChildren.length;i++)parseInt(playlistChildren[i].getAttribute("id"))===parseInt(settings.index)?s3bubbleHelpers.addClass(playlistChildren[i],"vjs-selected"):s3bubbleHelpers.removeClass(playlistChildren[i],"vjs-selected")}that.pause(),s3bubbleHelpers.getData({uri:"player",code:settings.codes[settings.index]},function(_response){_response.error?console.log("ERROR: ",_response.message):(settings.hasOwnProperty("playlist")?(that.src(_response.source),that.load(),_response.brand=settings.brand,that.waveformPlugin(div,_response)):(that.src(_response.source),that.load(),that.poster(_response.source.poster),that.s3BubbleMetaOverlay(_response.meta),that.updatePreview(_response.preview),_response.brand=settings.brand,that.waveformPlugin(div,_response)),that.play())})},player.reload=function(ind){var that=this;that.pause(),s3bubbleHelpers.getData({uri:"player",code:settings.codes[0]},function(_response){_response.error?console.log("ERROR: ",_response.message):(settings.hasOwnProperty("playlist")?(that.src(_response.source),that.load(),that.waveformPlugin(div,_response)):(that.src(_response.source),that.load(),that.waveformPlugin(div,_response),that.poster(_response.source.poster),that.s3BubbleMetaOverlay(_response.meta),that.updatePreview(_response.preview)),that.play())})}})}else console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: Codes is a required option")},s3bubble.video=function(options,callback){var settings,video,player,searchForOldPlayers=document.querySelector("#"+div);if(null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),options.hasOwnProperty("codes")){"string"==typeof options.codes&&(options.codes=[options.codes]);var getPlayerDiv=document.getElementById(div);if(null!==getPlayerDiv){var int=0;options.hasOwnProperty("setIndex")&&(int=parseInt(options.setIndex)),s3bubbleHelpers.getData({uri:"player",code:options.codes[int]},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),(player=videojs("aws-player")).errorsPlugin(),void player.error({code:7,message:_response.message});(settings=s3bubbleHelpers.extend(_response,options)).index=0,settings.length=0,window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create",settings.options.googleUaCode,"auto","s3bubble"),ga("s3bubble.send","pageview"),ga("s3bubble.send","event","s3bubble.init","video.code",settings.options.code),ga("s3bubble.send","event","s3bubble.init","video.bucket",settings.options.bucket),ga("s3bubble.send","event","s3bubble.init","video.title",s3bubbleHelpers.s3bubbleCleanFilename(settings.meta.title)),ga("s3bubble.send","event","s3bubble.init","video.key",settings.options.key),ga("s3bubble.send","event","s3bubble.init","video.vpaid",settings.options.vpaid),(video=document.createElement("video")).id=div+"-player",settings.options.background?video.className="video-js vjs-s3bubble-background":video.className="video-js vjs-default-skin",video.poster=settings.source.poster,video.controls=settings.options.controls,video.muted=settings.options.muted,video.preload=settings.options.preload,video.crossorigin="anonymous",video.addEventListener("contextmenu",function(e){e.preventDefault()},!1),settings.options.hasOwnProperty("prepare")&&(video.style.position="absolute",video.style.top="0px"),getPlayerDiv.appendChild(video),s3bubbleHelpers.swipedetect(getPlayerDiv,function(swipedir){"right"===swipedir&&window.history.back()});var videoOptions={autoplay:settings.options.autoplay,playbackRates:settings.options.playbackRates,loop:settings.options.loop,nativeControlsForTouch:!1,plugins:{chromecast:{appId:settings.options.hasOwnProperty("chromecast")?settings.options.chromecast:"E14DC85B"}}};settings.options.hasOwnProperty("width")&&(videoOptions.width=settings.options.width),settings.options.hasOwnProperty("height")&&(videoOptions.height=settings.options.height),settings.options.hasOwnProperty("height")||settings.options.hasOwnProperty("width")||(settings.options.hasOwnProperty("aspect")?video.classList.add("vjs-"+settings.options.aspect):video.classList.add("vjs-16-9")),settings.options.fluid&&video.classList.add("vjs-s3bubble-fullscreen"),player=videojs(div+"-player",videoOptions,function(){this.one("durationchange",function(){if(settings.hasOwnProperty("startTime")){var skipToPercentage=this.duration()/100*settings.startTime;this.currentTime(Math.round(parseInt(skipToPercentage)))}}),settings.hasOwnProperty("popit")&&this.popitPlugin(div,settings.popit),this.playlistPlugin(settings),this.airplayPlugin(),this.ga({code:settings.options.code}),this.getThumbs(0),this.getCaptions(0),this.s3BubbleMultiAdvertsLoad(settings),callback&&callback(this)}),"video/quicktime"===settings.source.type&&(settings.source.type="video/mp4");var sources=[];sources.push(settings.source),"application/x-mpegURL"===settings.source.type&&settings.hasOwnProperty("fallback")&&sources.push(settings.fallback),player.src(sources),player.errorsPlugin(),settings.source.hasOwnProperty("download")&&"application/x-mpegURL"!=settings.source.type&&(settings.meta.download=settings.source.download),player.s3BubbleMetaOverlay(settings.meta),player.brandPlugin(settings.brand),player.s3BubbleMultiAdvertsInit(settings.brand),settings.hasOwnProperty("playlist")||(player.previewPlugin(settings.preview),player.buttonsPlugin(settings.buttons));var startEvent=settings.options.autoplay?"loadedmetadata":"click";(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(startEvent="touchend"),player.one(startEvent,function(_event){this.vPaidPlugin(div+"-player",settings)}),player.on("loadedmetadata",function(_event){this.ratesSwitcherPlugin(settings)}),player.getCaptions=function(ind){var that=this;s3bubbleHelpers.getData({uri:"captions",code:settings.codes[ind]},function(_response){if(_response.error)console.log("ERROR: ",_response.message);else{if(!that.el())return;var captionsButton=that.el().getElementsByClassName("vjs-captions-button");if(captionsButton.length>0){var S3BubbleVideo=that.el().getElementsByClassName("vjs-tech");S3BubbleVideo.length>0&&(S3BubbleVideo[0].crossOrigin="anonymous"),that.tech_.hasOwnProperty("textTracks_")&&that.tech_.textTracks_.hasOwnProperty("tracks_")&&(captionsButton[0].style.display="none",that.tech_.textTracks_.tracks_=[]);var captions=_response.captions;if(captions.length>0){captionsButton[0].style.display="block";for(var i=captions.length-1;i>=0;i--)that.addRemoteTextTrack({kind:"captions",language:captions[i].lang,label:captions[i].label,src:captions[i].src},!0)}}}})},player.getThumbs=function(ind){var that=this;s3bubbleHelpers.getData({uri:"thumbs",code:settings.codes[ind]},function(_response){if(_response.error)console.log("ERROR: ",_response.message);else{var thumbs=_response.thumbs,tu=[];if(thumbs.length>0)for(var i=thumbs.length-1;i>=0;i--){var build=thumbs[i],element={src:build.src};tu[build.time]=element}that.thumbnails(tu)}})},player.playlistSkip=function(ind){var that=this;settings.index=ind;var code=settings.codes.indexOf(ind);-1!=code&&(settings.index=code);var getPlaylist=that.el().getElementsByClassName("vjs-s3bubble-playlist");if(getPlaylist){var i,playlistChildren=getPlaylist[0].childNodes;for(i=0;i<playlistChildren.length;i++)parseInt(playlistChildren[i].getAttribute("id"))===parseInt(settings.index)?s3bubbleHelpers.addClass(playlistChildren[i],"vjs-selected"):s3bubbleHelpers.removeClass(playlistChildren[i],"vjs-selected")}that.pause(),s3bubbleHelpers.getData({uri:"player",code:settings.codes[settings.index]},function(_response){_response.error?console.log("ERROR: ",_response.message):(settings.hasOwnProperty("playlist")?(that.src(_response.source),that.load(),that.s3BubbleMultiAdvertsLoad(_response),that.getThumbs(settings.index),that.getCaptions(settings.index)):(that.src(_response.source),that.load(),_response.source.hasOwnProperty("download")&&"application/x-mpegURL"!=_response.source.type&&(_response.meta.download=_response.source.download),that.s3BubbleMetaOverlay(_response.meta),that.s3BubbleMultiAdvertsLoad(_response),that.updatePreview(_response.preview),that.getThumbs(settings.index),that.getCaptions(settings.index)),that.play())})},player.reload=function(ind){var that=this;that.pause(),s3bubbleHelpers.getData({uri:"player",code:settings.codes[0]},function(_response){_response.error?console.log("ERROR: ",_response.message):(settings.hasOwnProperty("playlist")?(that.src(_response.source),that.load(),that.getThumbs(settings.index),that.getCaptions(settings.index)):(that.src(_response.source),that.load(),_response.source.hasOwnProperty("download")&&"application/x-mpegURL"!=_response.source.type&&(_response.meta.download=_response.source.download),that.s3BubbleMetaOverlay(_response.meta),that.updatePreview(_response.preview),that.getThumbs(settings.index),that.getCaptions(settings.index)),that.play())})}})}else console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: Codes is a required option")},s3bubble.service=function(options,callback){var settings,video,player,searchForOldPlayers=document.querySelector("#"+div);if(null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),options.hasOwnProperty("codes")){"string"==typeof options.codes&&(options.codes=[options.codes]);var getPlayerDiv=document.getElementById(div);if(null!==getPlayerDiv){var service=s3bubbleHelpers.getExternalService(options.codes[0]);void 0!==service.type?s3bubbleHelpers.getData({uri:"globals"},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),(player=videojs("aws-player")).errorsPlugin(),void player.error({code:7,message:_response.message});(settings=s3bubbleHelpers.extend(_response,options)).index=0,settings.length=0,window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create",settings.options.googleUaCode,"auto","s3bubble"),ga("s3bubble.send","pageview"),ga("s3bubble.send","event","s3bubble.service","video.code",settings.codes[settings.index]),(video=document.createElement("video")).id=div+"-player",settings.options.background?video.className="video-js vjs-s3bubble-background":video.className="video-js vjs-default-skin vjs-16-9 "+(settings.options.fluid?"vjs-s3bubble-fullscreen ":" "),video.poster=settings.source.poster,video.controls=settings.options.controls,video.muted=settings.options.muted,video.preload=settings.options.preload,video.addEventListener("contextmenu",function(e){e.preventDefault()},!1),video.crossorigin="anonymous",getPlayerDiv.appendChild(video),s3bubbleHelpers.swipedetect(getPlayerDiv,function(swipedir){"right"===swipedir&&window.history.back()}),(player=videojs(div+"-player",{techOrder:["youtube","vimeo","dailymotion"],sources:[{type:"video/"+service.type,src:settings.codes[settings.index]}],autoplay:settings.options.autoplay,playbackRates:settings.options.playbackRates,loop:settings.options.loop,nativeControlsForTouch:!1,plugins:{chromecast:{appId:settings.options.hasOwnProperty("chromecast")?settings.options.chromecast:"E14DC85B"}}},function(){this.one("durationchange",function(){if(settings.hasOwnProperty("startTime")){var skipToPercentage=this.duration()/100*settings.startTime;this.currentTime(Math.round(parseInt(skipToPercentage)))}}),this.brandPlugin(settings.brand),settings.hasOwnProperty("meta")&&(settings.source.hasOwnProperty("download")&&(settings.meta.download=settings.source.download),this.s3BubbleMetaOverlay(settings.meta)),this.ga({code:settings.codes[settings.index]}),callback&&callback(this)})).on("ended",function(){if(parseInt(settings.index)<settings.codes.length-1){settings.index++;var service=s3bubbleHelpers.getExternalService(settings.codes[settings.index]);if(void 0===service.type)return void console.log("ERROR: Please enter the full url");var vimeoFrame=player.el().getElementsByClassName("vimeoFrame")[0];void 0!==vimeoFrame&&(vimeoFrame.style.display="youtube"===service.type?"none":"block"),this.src({type:"video/"+service.type,src:settings.codes[settings.index]}),this.play()}})}):console.log("ERROR: Please enter the full url")}else console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: Codes is a required option")},s3bubble.lazy=function(options,callback){var settings,video,player,searchForOldPlayers=document.querySelector("#"+div);if(null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),options.hasOwnProperty("code")){var getPlayerDiv=document.getElementById(div);null!==getPlayerDiv?s3bubbleHelpers.getData({uri:"lazy",code:options.code,types:options.types},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),(player=videojs("aws-player")).errorsPlugin(),void player.error({code:7,message:_response.message});(settings=s3bubbleHelpers.extend(_response,options)).index=0,settings.length=0,window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create",settings.options.googleUaCode,"auto","s3bubble"),ga("s3bubble.send","pageview"),(video=document.createElement("video")).id=div+"-player",settings.options.background?video.className="video-js vjs-s3bubble-background":video.className="video-js vjs-default-skin vjs-16-9 "+(settings.options.fluid?"vjs-s3bubble-fullscreen ":" "),video.poster=settings.source.poster,video.controls=settings.options.controls,video.muted=settings.options.muted,video.preload=settings.options.preload,video.addEventListener("contextmenu",function(e){e.preventDefault()},!1),video.crossorigin="anonymous",getPlayerDiv.appendChild(video),s3bubbleHelpers.swipedetect(getPlayerDiv,function(swipedir){"right"===swipedir&&window.history.back()}),(player=videojs(div+"-player",{autoplay:settings.options.autoplay,playbackRates:settings.options.playbackRates,loop:settings.options.loop,nativeControlsForTouch:!1,plugins:{chromecast:{appId:settings.options.hasOwnProperty("chromecast")?settings.options.chromecast:"E14DC85B"}}},function(){this.playlistPluginLazy(settings),this.brandPlugin(settings.brand),settings.hasOwnProperty("meta")&&(settings.source.hasOwnProperty("download")&&(settings.meta.download=settings.source.download),this.s3BubbleMetaOverlay(settings.meta)),callback&&callback(this)})).src(_response.codes[0]),player.playlistSkip=function(ind){var that=this;settings.index=ind;var code=settings.codes.indexOf(ind);-1!=code&&(settings.index=code),player.src(settings.codes[ind]);var getPlaylist=that.el().getElementsByClassName("vjs-s3bubble-playlist-lazy");if(getPlaylist){var i,playlistChildren=getPlaylist[0].childNodes;for(i=0;i<playlistChildren.length;i++)parseInt(playlistChildren[i].getAttribute("id"))===parseInt(settings.index)?s3bubbleHelpers.addClass(playlistChildren[i],"vjs-selected"):s3bubbleHelpers.removeClass(playlistChildren[i],"vjs-selected")}that.s3BubbleMetaOverlay(settings.codes[ind].meta),that.play()},player.on("ended",function(){})}):console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: Codes is a required option")},s3bubble.live=function(options,callback){var settings,video,player,searchForOldPlayers=document.querySelector("#"+div);if(null!=searchForOldPlayers&&searchForOldPlayers.children.length>0&&(console.log("Clean up..."),videojs(searchForOldPlayers.children[0]).dispose()),options.hasOwnProperty("stream")){var getPlayerDiv=document.getElementById(div);null!==getPlayerDiv?s3bubbleHelpers.getData({uri:"stream",code:options.stream},function(_response){if(_response.error)return video=document.createElement("video"),video.id="aws-player",video.className="video-js vjs-default-skin vjs-16-9",getPlayerDiv.appendChild(video),(player=videojs("aws-player")).errorsPlugin(),void player.error({code:7,message:_response.message});var protocol=(settings=s3bubbleHelpers.extend(_response,options)).source.protocol,address=settings.source.address,stream=settings.source.stream;settings.source.streamer;window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create",settings.options.googleUaCode,"auto","s3bubble"),ga("s3bubble.send","pageview"),ga("s3bubble.send","event","s3bubble.live","video.code",settings.options.stream),ga("s3bubble.send","event","s3bubble.live","video.title",s3bubbleHelpers.s3bubbleCleanFilename(settings.meta.title)),(video=document.createElement("video")).id=div+"-player",settings.options.background?video.className="video-js vjs-s3bubble-background":video.className="video-js vjs-default-skin vjs-16-9 "+(settings.options.fluid?"vjs-s3bubble-fullscreen ":" "),video.poster=settings.source.poster,video.controls=settings.options.controls,video.muted=settings.options.muted,video.preload=settings.options.preload,video.addEventListener("contextmenu",function(e){e.preventDefault()},!1),video.crossorigin="anonymous",getPlayerDiv.appendChild(video),s3bubbleHelpers.swipedetect(getPlayerDiv,function(swipedir){"right"===swipedir&&window.history.back()}),(player=videojs(div+"-player",{autoplay:settings.options.autoplay,nativeControlsForTouch:!1,plugins:{chromecast:{appId:settings.options.hasOwnProperty("chromecast")?settings.options.chromecast:"E14DC85B"}}},function(){var removeProgress=this.el().getElementsByClassName("vjs-progress-control")[0];removeProgress.style.opacity="0",this.el().getElementsByClassName("vjs-remaining-time-display")[0].innerHTML="LIVE";var remainingTime=this.el().getElementsByClassName("vjs-remaining-time")[0];removeProgress.parentNode.insertBefore(remainingTime,removeProgress),this.brandPlugin(settings.brand),this.airplayPlugin(),this.ga({code:stream}),callback&&callback(this)})).src({type:"application/x-mpegURL",src:protocol+"://"+address+"/hls/"+stream+".m3u8"}),player.errorsPlugin();var startEvent=settings.options.autoplay?"loadedmetadata":"click";(navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&(startEvent="touchend"),player.one(startEvent,function(_event){this.vPaidPlugin(div+"-player",settings)}),player.one("loadstart",function(){this.s3BubbleMetaOverlay(settings.meta)});var last_value=0,offline_test=0;player.on("timeupdate",function(){this.currentTime()===last_value?(offline_test>3&&(this.userActive(!0),this.el().getElementsByClassName("vjs-live-display")[0].innerHTML="OFFLINE",offline_test=0),offline_test++):(offline_test=0,this.el().getElementsByClassName("vjs-live-display")[0].innerHTML="LIVE: HLS"),last_value=this.currentTime()})}):console.log("ERROR: Please make sure your html div has a unique id element")}else console.log("ERROR: No address was sent")},s3bubble}void 0===window.HTMLVideoElement&&(document.createElement("video"),document.createElement("audio"),document.createElement("track")),function(root,factory){"use strict";"function"==typeof define&&define.amd?define(factory):"object"==typeof exports?module.exports=factory():root.returnExports=factory()}(this,function(){var isCallable,$Array=Array,ArrayPrototype=$Array.prototype,$Object=Object,ObjectPrototype=$Object.prototype,FunctionPrototype=Function.prototype,$String=String,StringPrototype=$String.prototype,$Number=Number,NumberPrototype=$Number.prototype,array_slice=ArrayPrototype.slice,array_splice=ArrayPrototype.splice,array_push=ArrayPrototype.push,array_unshift=ArrayPrototype.unshift,array_concat=ArrayPrototype.concat,call=FunctionPrototype.call,apply=FunctionPrototype.apply,max=Math.max,min=Math.min,to_string=ObjectPrototype.toString,hasToStringTag="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,fnToStr=Function.prototype.toString,tryFunctionObject=function(value){try{return fnToStr.call(value),!0}catch(e){return!1}};isCallable=function(value){if("function"!=typeof value)return!1;if(hasToStringTag)return tryFunctionObject(value);var strClass=to_string.call(value);return"[object Function]"===strClass||"[object GeneratorFunction]"===strClass};var isRegex,regexExec=RegExp.prototype.exec,tryRegexExec=function(value){try{return regexExec.call(value),!0}catch(e){return!1}};isRegex=function(value){return"object"==typeof value&&(hasToStringTag?tryRegexExec(value):"[object RegExp]"===to_string.call(value))};var isString,strValue=String.prototype.valueOf,tryStringObject=function(value){try{return strValue.call(value),!0}catch(e){return!1}};isString=function(value){return"string"==typeof value||"object"==typeof value&&(hasToStringTag?tryStringObject(value):"[object String]"===to_string.call(value))};var supportsDescriptors=$Object.defineProperty&&function(){try{var obj={};$Object.defineProperty(obj,"x",{enumerable:!1,value:obj});for(var _ in obj)return!1;return obj.x===obj}catch(e){return!1}}(),defineProperties=function(has){var defineProperty;return defineProperty=supportsDescriptors?function(object,name,method,forceAssign){!forceAssign&&name in object||$Object.defineProperty(object,name,{configurable:!0,enumerable:!1,writable:!0,value:method})}:function(object,name,method,forceAssign){!forceAssign&&name in object||(object[name]=method)},function(object,map,forceAssign){for(var name in map)has.call(map,name)&&defineProperty(object,name,map[name],forceAssign)}}(ObjectPrototype.hasOwnProperty),isPrimitive=function(input){var type=typeof input;return null===input||"object"!==type&&"function"!==type},isActualNaN=$Number.isNaN||function(x){return x!==x},ES={ToInteger:function(num){var n=+num;return isActualNaN(n)?n=0:0!==n&&n!==1/0&&n!==-1/0&&(n=(n>0||-1)*Math.floor(Math.abs(n))),n},ToPrimitive:function(input){var val,valueOf,toStr;if(isPrimitive(input))return input;if(valueOf=input.valueOf,isCallable(valueOf)&&(val=valueOf.call(input),isPrimitive(val)))return val;if(toStr=input.toString,isCallable(toStr)&&(val=toStr.call(input),isPrimitive(val)))return val;throw new TypeError},ToObject:function(o){if(null==o)throw new TypeError("can't convert "+o+" to object");return $Object(o)},ToUint32:function(x){return x>>>0}},Empty=function(){};defineProperties(FunctionPrototype,{bind:function(that){var target=this;if(!isCallable(target))throw new TypeError("Function.prototype.bind called on incompatible "+target);for(var bound,args=array_slice.call(arguments,1),boundLength=max(0,target.length-args.length),boundArgs=[],i=0;i<boundLength;i++)array_push.call(boundArgs,"$"+i);return bound=Function("binder","return function ("+boundArgs.join(",")+"){ return binder.apply(this, arguments); }")(function(){if(this instanceof bound){var result=target.apply(this,array_concat.call(args,array_slice.call(arguments)));return $Object(result)===result?result:this}return target.apply(that,array_concat.call(args,array_slice.call(arguments)))}),target.prototype&&(Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null),bound}});var owns=call.bind(ObjectPrototype.hasOwnProperty),toStr=call.bind(ObjectPrototype.toString),arraySlice=call.bind(array_slice),arraySliceApply=apply.bind(array_slice),strSlice=call.bind(StringPrototype.slice),strSplit=call.bind(StringPrototype.split),strIndexOf=call.bind(StringPrototype.indexOf),pushCall=call.bind(array_push),isEnum=call.bind(ObjectPrototype.propertyIsEnumerable),arraySort=call.bind(ArrayPrototype.sort),isArray=$Array.isArray||function(obj){return"[object Array]"===toStr(obj)},hasUnshiftReturnValueBug=1!==[].unshift(0);defineProperties(ArrayPrototype,{unshift:function(){return array_unshift.apply(this,arguments),this.length}},hasUnshiftReturnValueBug),defineProperties($Array,{isArray:isArray});var boxedString=$Object("a"),splitString="a"!==boxedString[0]||!(0 in boxedString),properlyBoxesContext=function(method){var properlyBoxesNonStrict=!0,properlyBoxesStrict=!0,threwException=!1;if(method)try{method.call("foo",function(_,__,context){"object"!=typeof context&&(properlyBoxesNonStrict=!1)}),method.call([1],function(){"use strict";properlyBoxesStrict="string"==typeof this},"x")}catch(e){threwException=!0}return!!method&&!threwException&&properlyBoxesNonStrict&&properlyBoxesStrict};defineProperties(ArrayPrototype,{forEach:function(callbackfn){var T,object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,i=-1,length=ES.ToUint32(self.length);if(arguments.length>1&&(T=arguments[1]),!isCallable(callbackfn))throw new TypeError("Array.prototype.forEach callback must be a function");for(;++i<length;)i in self&&(void 0===T?callbackfn(self[i],i,object):callbackfn.call(T,self[i],i,object))}},!properlyBoxesContext(ArrayPrototype.forEach)),defineProperties(ArrayPrototype,{map:function(callbackfn){var T,object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length),result=$Array(length);if(arguments.length>1&&(T=arguments[1]),!isCallable(callbackfn))throw new TypeError("Array.prototype.map callback must be a function");for(var i=0;i<length;i++)i in self&&(result[i]=void 0===T?callbackfn(self[i],i,object):callbackfn.call(T,self[i],i,object));return result}},!properlyBoxesContext(ArrayPrototype.map)),defineProperties(ArrayPrototype,{filter:function(callbackfn){var value,T,object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length),result=[];if(arguments.length>1&&(T=arguments[1]),!isCallable(callbackfn))throw new TypeError("Array.prototype.filter callback must be a function");for(var i=0;i<length;i++)i in self&&(value=self[i],(void 0===T?callbackfn(value,i,object):callbackfn.call(T,value,i,object))&&pushCall(result,value));return result}},!properlyBoxesContext(ArrayPrototype.filter)),defineProperties(ArrayPrototype,{every:function(callbackfn){var T,object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length);if(arguments.length>1&&(T=arguments[1]),!isCallable(callbackfn))throw new TypeError("Array.prototype.every callback must be a function");for(var i=0;i<length;i++)if(i in self&&!(void 0===T?callbackfn(self[i],i,object):callbackfn.call(T,self[i],i,object)))return!1;return!0}},!properlyBoxesContext(ArrayPrototype.every)),defineProperties(ArrayPrototype,{some:function(callbackfn){var T,object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length);if(arguments.length>1&&(T=arguments[1]),!isCallable(callbackfn))throw new TypeError("Array.prototype.some callback must be a function");for(var i=0;i<length;i++)if(i in self&&(void 0===T?callbackfn(self[i],i,object):callbackfn.call(T,self[i],i,object)))return!0;return!1}},!properlyBoxesContext(ArrayPrototype.some));var reduceCoercesToObject=!1;ArrayPrototype.reduce&&(reduceCoercesToObject="object"==typeof ArrayPrototype.reduce.call("es5",function(_,__,___,list){return list})),defineProperties(ArrayPrototype,{reduce:function(callbackfn){var object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length);if(!isCallable(callbackfn))throw new TypeError("Array.prototype.reduce callback must be a function");if(0===length&&1===arguments.length)throw new TypeError("reduce of empty array with no initial value");var result,i=0;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError("reduce of empty array with no initial value")}for(;i<length;i++)i in self&&(result=callbackfn(result,self[i],i,object));return result}},!reduceCoercesToObject);var reduceRightCoercesToObject=!1;ArrayPrototype.reduceRight&&(reduceRightCoercesToObject="object"==typeof ArrayPrototype.reduceRight.call("es5",function(_,__,___,list){return list})),defineProperties(ArrayPrototype,{reduceRight:function(callbackfn){var object=ES.ToObject(this),self=splitString&&isString(this)?strSplit(this,""):object,length=ES.ToUint32(self.length);if(!isCallable(callbackfn))throw new TypeError("Array.prototype.reduceRight callback must be a function");if(0===length&&1===arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i--];break}if(--i<0)throw new TypeError("reduceRight of empty array with no initial value")}if(i<0)return result;do{i in self&&(result=callbackfn(result,self[i],i,object))}while(i--);return result}},!reduceRightCoercesToObject);var hasFirefox2IndexOfBug=ArrayPrototype.indexOf&&-1!==[0,1].indexOf(1,2);defineProperties(ArrayPrototype,{indexOf:function(searchElement){var self=splitString&&isString(this)?strSplit(this,""):ES.ToObject(this),length=ES.ToUint32(self.length);if(0===length)return-1;var i=0;for(arguments.length>1&&(i=ES.ToInteger(arguments[1])),i=i>=0?i:max(0,length+i);i<length;i++)if(i in self&&self[i]===searchElement)return i;return-1}},hasFirefox2IndexOfBug);var hasFirefox2LastIndexOfBug=ArrayPrototype.lastIndexOf&&-1!==[0,1].lastIndexOf(0,-3);defineProperties(ArrayPrototype,{lastIndexOf:function(searchElement){var self=splitString&&isString(this)?strSplit(this,""):ES.ToObject(this),length=ES.ToUint32(self.length);if(0===length)return-1;var i=length-1;for(arguments.length>1&&(i=min(i,ES.ToInteger(arguments[1]))),i=i>=0?i:length-Math.abs(i);i>=0;i--)if(i in self&&searchElement===self[i])return i;return-1}},hasFirefox2LastIndexOfBug);var spliceNoopReturnsEmptyArray=function(){var a=[1,2],result=a.splice();return 2===a.length&&isArray(result)&&0===result.length}();defineProperties(ArrayPrototype,{splice:function(start,deleteCount){return 0===arguments.length?[]:array_splice.apply(this,arguments)}},!spliceNoopReturnsEmptyArray);var spliceWorksWithEmptyObject=function(){var obj={};return ArrayPrototype.splice.call(obj,0,0,1),1===obj.length}();defineProperties(ArrayPrototype,{splice:function(start,deleteCount){if(0===arguments.length)return[];var args=arguments;return this.length=max(ES.ToInteger(this.length),0),arguments.length>0&&"number"!=typeof deleteCount&&((args=arraySlice(arguments)).length<2?pushCall(args,this.length-start):args[1]=ES.ToInteger(deleteCount)),array_splice.apply(this,args)}},!spliceWorksWithEmptyObject);var spliceWorksWithLargeSparseArrays=function(){var arr=new $Array(1e5);return arr[8]="x",arr.splice(1,1),7===arr.indexOf("x")}(),spliceWorksWithSmallSparseArrays=function(){var arr=[];return arr[256]="a",arr.splice(257,0,"b"),"a"===arr[256]}();defineProperties(ArrayPrototype,{splice:function(start,deleteCount){for(var from,O=ES.ToObject(this),A=[],len=ES.ToUint32(O.length),relativeStart=ES.ToInteger(start),actualStart=relativeStart<0?max(len+relativeStart,0):min(relativeStart,len),actualDeleteCount=min(max(ES.ToInteger(deleteCount),0),len-actualStart),k=0;k<actualDeleteCount;)from=$String(actualStart+k),owns(O,from)&&(A[k]=O[from]),k+=1;var to,items=arraySlice(arguments,2),itemCount=items.length;if(itemCount<actualDeleteCount){for(k=actualStart;k<len-actualDeleteCount;)from=$String(k+actualDeleteCount),to=$String(k+itemCount),owns(O,from)?O[to]=O[from]:delete O[to],k+=1;for(k=len;k>len-actualDeleteCount+itemCount;)delete O[k-1],k-=1}else if(itemCount>actualDeleteCount)for(k=len-actualDeleteCount;k>actualStart;)from=$String(k+actualDeleteCount-1),to=$String(k+itemCount-1),owns(O,from)?O[to]=O[from]:delete O[to],k-=1;k=actualStart;for(var i=0;i<items.length;++i)O[k]=items[i],k+=1;return O.length=len-actualDeleteCount+itemCount,A}},!spliceWorksWithLargeSparseArrays||!spliceWorksWithSmallSparseArrays);var hasStringJoinBug,originalJoin=ArrayPrototype.join;try{hasStringJoinBug="1,2,3"!==Array.prototype.join.call("123",",")}catch(e){hasStringJoinBug=!0}hasStringJoinBug&&defineProperties(ArrayPrototype,{join:function(separator){var sep=void 0===separator?",":separator;return originalJoin.call(isString(this)?strSplit(this,""):this,sep)}},hasStringJoinBug);var hasJoinUndefinedBug="1,2"!==[1,2].join(void 0);hasJoinUndefinedBug&&defineProperties(ArrayPrototype,{join:function(separator){var sep=void 0===separator?",":separator;return originalJoin.call(this,sep)}},hasJoinUndefinedBug);var pushShim=function(item){for(var O=ES.ToObject(this),n=ES.ToUint32(O.length),i=0;i<arguments.length;)O[n+i]=arguments[i],i+=1;return O.length=n+i,n+i},pushIsNotGeneric=function(){var obj={};return 1!==Array.prototype.push.call(obj,void 0)||1!==obj.length||void 0!==obj[0]||!owns(obj,0)}();defineProperties(ArrayPrototype,{push:function(item){return isArray(this)?array_push.apply(this,arguments):pushShim.apply(this,arguments)}},pushIsNotGeneric);var pushUndefinedIsWeird=function(){var arr=[];return 1!==arr.push(void 0)||1!==arr.length||void 0!==arr[0]||!owns(arr,0)}();defineProperties(ArrayPrototype,{push:pushShim},pushUndefinedIsWeird),defineProperties(ArrayPrototype,{slice:function(start,end){var arr=isString(this)?strSplit(this,""):this;return arraySliceApply(arr,arguments)}},splitString);var sortIgnoresNonFunctions=function(){try{return[1,2].sort(null),[1,2].sort({}),!0}catch(e){}return!1}(),sortThrowsOnRegex=function(){try{return[1,2].sort(/a/),!1}catch(e){}return!0}(),sortIgnoresUndefined=function(){try{return[1,2].sort(void 0),!0}catch(e){}return!1}();defineProperties(ArrayPrototype,{sort:function(compareFn){if(void 0===compareFn)return arraySort(this);if(!isCallable(compareFn))throw new TypeError("Array.prototype.sort callback must be a function");return arraySort(this,compareFn)}},sortIgnoresNonFunctions||!sortIgnoresUndefined||!sortThrowsOnRegex);var hasDontEnumBug=!{toString:null}.propertyIsEnumerable("toString"),hasProtoEnumBug=function(){}.propertyIsEnumerable("prototype"),hasStringEnumBug=!owns("x","0"),equalsConstructorPrototype=function(o){var ctor=o.constructor;return ctor&&ctor.prototype===o},blacklistedKeys={$window:!0,$console:!0,$parent:!0,$self:!0,$frame:!0,$frames:!0,$frameElement:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$external:!0},hasAutomationEqualityBug=function(){if("undefined"==typeof window)return!1;for(var k in window)try{!blacklistedKeys["$"+k]&&owns(window,k)&&null!==window[k]&&"object"==typeof window[k]&&equalsConstructorPrototype(window[k])}catch(e){return!0}return!1}(),equalsConstructorPrototypeIfNotBuggy=function(object){if("undefined"==typeof window||!hasAutomationEqualityBug)return equalsConstructorPrototype(object);try{return equalsConstructorPrototype(object)}catch(e){return!1}},dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length,isStandardArguments=function(value){return"[object Arguments]"===toStr(value)},isArguments=isStandardArguments(arguments)?isStandardArguments:function(value){return null!==value&&"object"==typeof value&&"number"==typeof value.length&&value.length>=0&&!isArray(value)&&isCallable(value.callee)};defineProperties($Object,{keys:function(object){var isFn=isCallable(object),isArgs=isArguments(object),isObject=null!==object&&"object"==typeof object,isStr=isObject&&isString(object);if(!isObject&&!isFn&&!isArgs)throw new TypeError("Object.keys called on a non-object");var theKeys=[],skipProto=hasProtoEnumBug&&isFn;if(isStr&&hasStringEnumBug||isArgs)for(var i=0;i<object.length;++i)pushCall(theKeys,$String(i));if(!isArgs)for(var name in object)skipProto&&"prototype"===name||!owns(object,name)||pushCall(theKeys,$String(name));if(hasDontEnumBug)for(var skipConstructor=equalsConstructorPrototypeIfNotBuggy(object),j=0;j<dontEnumsLength;j++){var dontEnum=dontEnums[j];skipConstructor&&"constructor"===dontEnum||!owns(object,dontEnum)||pushCall(theKeys,dontEnum)}return theKeys}});var keysWorksWithArguments=$Object.keys&&function(){return 2===$Object.keys(arguments).length}(1,2),keysHasArgumentsLengthBug=$Object.keys&&function(){var argKeys=$Object.keys(arguments);return 1!==arguments.length||1!==argKeys.length||1!==argKeys[0]}(1),originalKeys=$Object.keys;defineProperties($Object,{keys:function(object){return originalKeys(isArguments(object)?arraySlice(object):object)}},!keysWorksWithArguments||keysHasArgumentsLengthBug);var hasToDateStringFormatBug,hasToStringFormatBug,hasNegativeMonthYearBug=0!==new Date(-0xc782b5b342b24).getUTCMonth(),aNegativeTestDate=new Date(-0x55d318d56a724),aPositiveTestDate=new Date(14496624e5),hasToUTCStringFormatBug="Mon, 01 Jan -45875 11:59:59 GMT"!==aNegativeTestDate.toUTCString();aNegativeTestDate.getTimezoneOffset()<-720?(hasToDateStringFormatBug="Tue Jan 02 -45875"!==aNegativeTestDate.toDateString(),hasToStringFormatBug=!/^Thu Dec 10 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/.test(aPositiveTestDate.toString())):(hasToDateStringFormatBug="Mon Jan 01 -45875"!==aNegativeTestDate.toDateString(),hasToStringFormatBug=!/^Wed Dec 09 2015 \d\d:\d\d:\d\d GMT[-\+]\d\d\d\d(?: |$)/.test(aPositiveTestDate.toString()));var originalGetFullYear=call.bind(Date.prototype.getFullYear),originalGetMonth=call.bind(Date.prototype.getMonth),originalGetDate=call.bind(Date.prototype.getDate),originalGetUTCFullYear=call.bind(Date.prototype.getUTCFullYear),originalGetUTCMonth=call.bind(Date.prototype.getUTCMonth),originalGetUTCDate=call.bind(Date.prototype.getUTCDate),originalGetUTCDay=call.bind(Date.prototype.getUTCDay),originalGetUTCHours=call.bind(Date.prototype.getUTCHours),originalGetUTCMinutes=call.bind(Date.prototype.getUTCMinutes),originalGetUTCSeconds=call.bind(Date.prototype.getUTCSeconds),originalGetUTCMilliseconds=call.bind(Date.prototype.getUTCMilliseconds),dayName=["Sun","Mon","Tue","Wed","Thu","Fri"],monthName=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],daysInMonth=function(month,year){return originalGetDate(new Date(year,month,0))};defineProperties(Date.prototype,{getFullYear:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetFullYear(this);return year<0&&originalGetMonth(this)>11?year+1:year},getMonth:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetFullYear(this),month=originalGetMonth(this);return year<0&&month>11?0:month},getDate:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetFullYear(this),month=originalGetMonth(this),date=originalGetDate(this);return year<0&&month>11?12===month?date:daysInMonth(0,year+1)-date+1:date},getUTCFullYear:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetUTCFullYear(this);return year<0&&originalGetUTCMonth(this)>11?year+1:year},getUTCMonth:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetUTCFullYear(this),month=originalGetUTCMonth(this);return year<0&&month>11?0:month},getUTCDate:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var year=originalGetUTCFullYear(this),month=originalGetUTCMonth(this),date=originalGetUTCDate(this);return year<0&&month>11?12===month?date:daysInMonth(0,year+1)-date+1:date}},hasNegativeMonthYearBug),defineProperties(Date.prototype,{toUTCString:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var day=originalGetUTCDay(this),date=originalGetUTCDate(this),month=originalGetUTCMonth(this),year=originalGetUTCFullYear(this),hour=originalGetUTCHours(this),minute=originalGetUTCMinutes(this),second=originalGetUTCSeconds(this);return dayName[day]+", "+(date<10?"0"+date:date)+" "+monthName[month]+" "+year+" "+(hour<10?"0"+hour:hour)+":"+(minute<10?"0"+minute:minute)+":"+(second<10?"0"+second:second)+" GMT"}},hasNegativeMonthYearBug||hasToUTCStringFormatBug),defineProperties(Date.prototype,{toDateString:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var day=this.getDay(),date=this.getDate(),month=this.getMonth(),year=this.getFullYear();return dayName[day]+" "+monthName[month]+" "+(date<10?"0"+date:date)+" "+year}},hasNegativeMonthYearBug||hasToDateStringFormatBug),(hasNegativeMonthYearBug||hasToStringFormatBug)&&(Date.prototype.toString=function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var day=this.getDay(),date=this.getDate(),month=this.getMonth(),year=this.getFullYear(),hour=this.getHours(),minute=this.getMinutes(),second=this.getSeconds(),timezoneOffset=this.getTimezoneOffset(),hoursOffset=Math.floor(Math.abs(timezoneOffset)/60),minutesOffset=Math.floor(Math.abs(timezoneOffset)%60);return dayName[day]+" "+monthName[month]+" "+(date<10?"0"+date:date)+" "+year+" "+(hour<10?"0"+hour:hour)+":"+(minute<10?"0"+minute:minute)+":"+(second<10?"0"+second:second)+" GMT"+(timezoneOffset>0?"-":"+")+(hoursOffset<10?"0"+hoursOffset:hoursOffset)+(minutesOffset<10?"0"+minutesOffset:minutesOffset)},supportsDescriptors&&$Object.defineProperty(Date.prototype,"toString",{configurable:!0,enumerable:!1,writable:!0}));var hasNegativeDateBug=Date.prototype.toISOString&&-1===new Date(-621987552e5).toISOString().indexOf("-000001"),hasSafari51DateBug=Date.prototype.toISOString&&"1969-12-31T23:59:59.999Z"!==new Date(-1).toISOString();defineProperties(Date.prototype,{toISOString:function(){if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");var year=originalGetUTCFullYear(this),month=originalGetUTCMonth(this);year+=Math.floor(month/12);var result=[(month=(month%12+12)%12)+1,originalGetUTCDate(this),originalGetUTCHours(this),originalGetUTCMinutes(this),originalGetUTCSeconds(this)];year=(year<0?"-":year>9999?"+":"")+strSlice("00000"+Math.abs(year),0<=year&&year<=9999?-4:-6);for(var i=0;i<result.length;++i)result[i]=strSlice("00"+result[i],-2);return year+"-"+arraySlice(result,0,2).join("-")+"T"+arraySlice(result,2).join(":")+"."+strSlice("000"+originalGetUTCMilliseconds(this),-3)+"Z"}},hasNegativeDateBug||hasSafari51DateBug),function(){try{return Date.prototype.toJSON&&null===new Date(NaN).toJSON()&&-1!==new Date(-621987552e5).toJSON().indexOf("-000001")&&Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(e){return!1}}()||(Date.prototype.toJSON=function(key){var O=$Object(this),tv=ES.ToPrimitive(O);if("number"==typeof tv&&!isFinite(tv))return null;var toISO=O.toISOString;if(!isCallable(toISO))throw new TypeError("toISOString property is not callable");return toISO.call(O)});var supportsExtendedYears=1e15===Date.parse("+033658-09-27T01:46:40.000Z"),acceptsInvalidDates=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z"))||!isNaN(Date.parse("2012-12-31T23:59:60.000Z"));if(isNaN(Date.parse("2000-01-01T00:00:00.000Z"))||acceptsInvalidDates||!supportsExtendedYears){var maxSafeUnsigned32Bit=Math.pow(2,31)-1,hasSafariSignedIntBug=isActualNaN(new Date(1970,0,1,0,0,0,maxSafeUnsigned32Bit+1).getTime());Date=function(NativeDate){var DateShim=function(Y,M,D,h,m,s,ms){var date,length=arguments.length;if(this instanceof NativeDate){var seconds=s,millis=ms;if(hasSafariSignedIntBug&&length>=7&&ms>maxSafeUnsigned32Bit){var msToShift=Math.floor(ms/maxSafeUnsigned32Bit)*maxSafeUnsigned32Bit,sToShift=Math.floor(msToShift/1e3);seconds+=sToShift,millis-=1e3*sToShift}date=1===length&&$String(Y)===Y?new NativeDate(DateShim.parse(Y)):length>=7?new NativeDate(Y,M,D,h,m,seconds,millis):length>=6?new NativeDate(Y,M,D,h,m,seconds):length>=5?new NativeDate(Y,M,D,h,m):length>=4?new NativeDate(Y,M,D,h):length>=3?new NativeDate(Y,M,D):length>=2?new NativeDate(Y,M):length>=1?new NativeDate(Y):new NativeDate}else date=NativeDate.apply(this,arguments);return isPrimitive(date)||defineProperties(date,{constructor:DateShim},!0),date},isoDateExpression=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),months=[0,31,59,90,120,151,181,212,243,273,304,334,365],dayFromMonth=function(year,month){var t=month>1?1:0;return months[month]+Math.floor((year-1969+t)/4)-Math.floor((year-1901+t)/100)+Math.floor((year-1601+t)/400)+365*(year-1970)},toUTC=function(t){var s=0,ms=t;if(hasSafariSignedIntBug&&ms>maxSafeUnsigned32Bit){var msToShift=Math.floor(ms/maxSafeUnsigned32Bit)*maxSafeUnsigned32Bit,sToShift=Math.floor(msToShift/1e3);s+=sToShift,ms-=1e3*sToShift}return $Number(new NativeDate(1970,0,1,0,0,s,ms))};for(var key in NativeDate)owns(NativeDate,key)&&(DateShim[key]=NativeDate[key]);defineProperties(DateShim,{now:NativeDate.now,UTC:NativeDate.UTC},!0),DateShim.prototype=NativeDate.prototype,defineProperties(DateShim.prototype,{constructor:DateShim},!0);return defineProperties(DateShim,{parse:function(string){var match=isoDateExpression.exec(string);if(match){var result,year=$Number(match[1]),month=$Number(match[2]||1)-1,day=$Number(match[3]||1)-1,hour=$Number(match[4]||0),minute=$Number(match[5]||0),second=$Number(match[6]||0),millisecond=Math.floor(1e3*$Number(match[7]||0)),isLocalTime=Boolean(match[4]&&!match[8]),signOffset="-"===match[9]?1:-1,hourOffset=$Number(match[10]||0),minuteOffset=$Number(match[11]||0);return hour<(minute>0||second>0||millisecond>0?24:25)&&minute<60&&second<60&&millisecond<1e3&&month>-1&&month<12&&hourOffset<24&&minuteOffset<60&&day>-1&&day<dayFromMonth(year,month+1)-dayFromMonth(year,month)&&(result=60*(24*(dayFromMonth(year,month)+day)+hour+hourOffset*signOffset),result=1e3*(60*(result+minute+minuteOffset*signOffset)+second)+millisecond,isLocalTime&&(result=toUTC(result)),-864e13<=result&&result<=864e13)?result:NaN}return NativeDate.parse.apply(this,arguments)}}),DateShim}(Date)}Date.now||(Date.now=function(){return(new Date).getTime()});var hasToFixedBugs=NumberPrototype.toFixed&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0)),toFixedHelpers={base:1e7,size:6,data:[0,0,0,0,0,0],multiply:function(n,c){for(var i=-1,c2=c;++i<toFixedHelpers.size;)c2+=n*toFixedHelpers.data[i],toFixedHelpers.data[i]=c2%toFixedHelpers.base,c2=Math.floor(c2/toFixedHelpers.base)},divide:function(n){for(var i=toFixedHelpers.size,c=0;--i>=0;)c+=toFixedHelpers.data[i],toFixedHelpers.data[i]=Math.floor(c/n),c=c%n*toFixedHelpers.base},numToString:function(){for(var i=toFixedHelpers.size,s="";--i>=0;)if(""!==s||0===i||0!==toFixedHelpers.data[i]){var t=$String(toFixedHelpers.data[i]);""===s?s=t:s+=strSlice("0000000",0,7-t.length)+t}return s},pow:function pow(x,n,acc){return 0===n?acc:n%2==1?pow(x,n-1,acc*x):pow(x*x,n/2,acc)},log:function(x){for(var n=0,x2=x;x2>=4096;)n+=12,x2/=4096;for(;x2>=2;)n+=1,x2/=2;return n}};defineProperties(NumberPrototype,{toFixed:function(fractionDigits){var f,x,s,m,e,z,j,k;if(f=$Number(fractionDigits),(f=isActualNaN(f)?0:Math.floor(f))<0||f>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(x=$Number(this),isActualNaN(x))return"NaN";if(x<=-1e21||x>=1e21)return $String(x);if(s="",x<0&&(s="-",x=-x),m="0",x>1e-21)if(e=toFixedHelpers.log(x*toFixedHelpers.pow(2,69,1))-69,z=e<0?x*toFixedHelpers.pow(2,-e,1):x/toFixedHelpers.pow(2,e,1),z*=4503599627370496,(e=52-e)>0){for(toFixedHelpers.multiply(0,z),j=f;j>=7;)toFixedHelpers.multiply(1e7,0),j-=7;for(toFixedHelpers.multiply(toFixedHelpers.pow(10,j,1),0),j=e-1;j>=23;)toFixedHelpers.divide(1<<23),j-=23;toFixedHelpers.divide(1<<j),toFixedHelpers.multiply(1,1),toFixedHelpers.divide(2),m=toFixedHelpers.numToString()}else toFixedHelpers.multiply(0,z),toFixedHelpers.multiply(1<<-e,0),m=toFixedHelpers.numToString()+strSlice("0.00000000000000000000",2,2+f);return m=f>0?(k=m.length)<=f?s+strSlice("0.0000000000000000000",0,f-k+2)+m:s+strSlice(m,0,k-f)+"."+strSlice(m,k-f):s+m}},hasToFixedBugs);var hasToPrecisionUndefinedBug=function(){try{return"1"===1..toPrecision(void 0)}catch(e){return!0}}(),originalToPrecision=NumberPrototype.toPrecision;defineProperties(NumberPrototype,{toPrecision:function(precision){return void 0===precision?originalToPrecision.call(this):originalToPrecision.call(this,precision)}},hasToPrecisionUndefinedBug),2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?function(){var compliantExecNpcg=void 0===/()??/.exec("")[1],maxSafe32BitInt=Math.pow(2,32)-1;StringPrototype.split=function(separator,limit){var string=String(this);if(void 0===separator&&0===limit)return[];if(!isRegex(separator))return strSplit(this,separator,limit);var separator2,match,lastIndex,lastLength,output=[],flags=(separator.ignoreCase?"i":"")+(separator.multiline?"m":"")+(separator.unicode?"u":"")+(separator.sticky?"y":""),lastLastIndex=0,separatorCopy=new RegExp(separator.source,flags+"g");compliantExecNpcg||(separator2=new RegExp("^"+separatorCopy.source+"$(?!\\s)",flags));var splitLimit=void 0===limit?maxSafe32BitInt:ES.ToUint32(limit);for(match=separatorCopy.exec(string);match&&!((lastIndex=match.index+match[0].length)>lastLastIndex&&(pushCall(output,strSlice(string,lastLastIndex,match.index)),!compliantExecNpcg&&match.length>1&&match[0].replace(separator2,function(){for(var i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(match[i]=void 0)}),match.length>1&&match.index<string.length&&array_push.apply(output,arraySlice(match,1)),lastLength=match[0].length,lastLastIndex=lastIndex,output.length>=splitLimit));)separatorCopy.lastIndex===match.index&&separatorCopy.lastIndex++,match=separatorCopy.exec(string);return lastLastIndex===string.length?!lastLength&&separatorCopy.test("")||pushCall(output,""):pushCall(output,strSlice(string,lastLastIndex)),output.length>splitLimit?strSlice(output,0,splitLimit):output}}():"0".split(void 0,0).length&&(StringPrototype.split=function(separator,limit){return void 0===separator&&0===limit?[]:strSplit(this,separator,limit)});var str_replace=StringPrototype.replace;(function(){var groups=[];return"x".replace(/x(.)?/g,function(match,group){pushCall(groups,group)}),1===groups.length&&void 0===groups[0]})()||(StringPrototype.replace=function(searchValue,replaceValue){var isFn=isCallable(replaceValue),hasCapturingGroups=isRegex(searchValue)&&/\)[*?]/.test(searchValue.source);if(isFn&&hasCapturingGroups){return str_replace.call(this,searchValue,function(match){var length=arguments.length,originalLastIndex=searchValue.lastIndex;searchValue.lastIndex=0;var args=searchValue.exec(match)||[];return searchValue.lastIndex=originalLastIndex,pushCall(args,arguments[length-2],arguments[length-1]),replaceValue.apply(this,args)})}return str_replace.call(this,searchValue,replaceValue)});var string_substr=StringPrototype.substr,hasNegativeSubstrBug="".substr&&"b"!=="0b".substr(-1);defineProperties(StringPrototype,{substr:function(start,length){var normalizedStart=start;return start<0&&(normalizedStart=max(this.length+start,0)),string_substr.call(this,normalizedStart,length)}},hasNegativeSubstrBug);var ws="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff",wsRegexChars="["+ws+"]",trimBeginRegexp=new RegExp("^"+wsRegexChars+wsRegexChars+"*"),trimEndRegexp=new RegExp(wsRegexChars+wsRegexChars+"*$"),hasTrimWhitespaceBug=StringPrototype.trim&&(ws.trim()||!"​".trim());defineProperties(StringPrototype,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return $String(this).replace(trimBeginRegexp,"").replace(trimEndRegexp,"")}},hasTrimWhitespaceBug);var trim=call.bind(String.prototype.trim),hasLastIndexBug=StringPrototype.lastIndexOf&&-1!=="abcあい".lastIndexOf("あい",2);defineProperties(StringPrototype,{lastIndexOf:function(searchString){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");for(var S=$String(this),searchStr=$String(searchString),numPos=arguments.length>1?$Number(arguments[1]):NaN,pos=isActualNaN(numPos)?1/0:ES.ToInteger(numPos),start=min(max(pos,0),S.length),searchLen=searchStr.length,k=start+searchLen;k>0;){k=max(0,k-searchLen);var index=strIndexOf(strSlice(S,k,start+searchLen),searchStr);if(-1!==index)return k+index}return-1}},hasLastIndexBug);var originalLastIndexOf=StringPrototype.lastIndexOf;if(defineProperties(StringPrototype,{lastIndexOf:function(searchString){return originalLastIndexOf.apply(this,arguments)}},1!==StringPrototype.lastIndexOf.length),8===parseInt(ws+"08")&&22===parseInt(ws+"0x16")||(parseInt=function(origParseInt){var hexRegex=/^[\-+]?0[xX]/;return function(str,radix){var string=trim(str),defaultedRadix=$Number(radix)||(hexRegex.test(string)?16:10);return origParseInt(string,defaultedRadix)}}(parseInt)),1/parseFloat("-0")!=-1/0&&(parseFloat=function(origParseFloat){return function(string){var inputString=trim(string),result=origParseFloat(inputString);return 0===result&&"-"===strSlice(inputString,0,1)?-0:result}}(parseFloat)),"RangeError: test"!==String(new RangeError("test"))){Error.prototype.toString=function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");var name=this.name;void 0===name?name="Error":"string"!=typeof name&&(name=$String(name));var msg=this.message;return void 0===msg?msg="":"string"!=typeof msg&&(msg=$String(msg)),name?msg?name+": "+msg:name:msg}}if(supportsDescriptors){var ensureNonEnumerable=function(obj,prop){if(isEnum(obj,prop)){var desc=Object.getOwnPropertyDescriptor(obj,prop);desc.enumerable=!1,Object.defineProperty(obj,prop,desc)}};ensureNonEnumerable(Error.prototype,"message"),""!==Error.prototype.message&&(Error.prototype.message=""),ensureNonEnumerable(Error.prototype,"name")}if("/a/gim"!==String(/a/gim)){RegExp.prototype.toString=function(){var str="/"+this.source+"/";return this.global&&(str+="g"),this.ignoreCase&&(str+="i"),this.multiline&&(str+="m"),str}}}),function(root,factory){"use strict";"function"==typeof define&&define.amd?define(factory):"object"==typeof exports?module.exports=factory():root.returnExports=factory()}(this,function(){var defineGetter,defineSetter,lookupGetter,lookupSetter,call=Function.call,prototypeOfObject=Object.prototype,owns=call.bind(prototypeOfObject.hasOwnProperty),isEnumerable=call.bind(prototypeOfObject.propertyIsEnumerable),toStr=call.bind(prototypeOfObject.toString),supportsAccessors=owns(prototypeOfObject,"__defineGetter__");supportsAccessors&&(defineGetter=call.bind(prototypeOfObject.__defineGetter__),defineSetter=call.bind(prototypeOfObject.__defineSetter__),lookupGetter=call.bind(prototypeOfObject.__lookupGetter__),lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)),Object.getPrototypeOf||(Object.getPrototypeOf=function(object){var proto=object.__proto__;return proto||null===proto?proto:"[object Function]"===toStr(object.constructor)?object.constructor.prototype:object instanceof Object?prototypeOfObject:null});var doesGetOwnPropertyDescriptorWork=function(object){try{return object.sentinel=0,0===Object.getOwnPropertyDescriptor(object,"sentinel").value}catch(exception){return!1}};if(Object.defineProperty){var getOwnPropertyDescriptorWorksOnObject=doesGetOwnPropertyDescriptorWork({});if(!("undefined"==typeof document||doesGetOwnPropertyDescriptorWork(document.createElement("div")))||!getOwnPropertyDescriptorWorksOnObject)var getOwnPropertyDescriptorFallback=Object.getOwnPropertyDescriptor}if(!Object.getOwnPropertyDescriptor||getOwnPropertyDescriptorFallback){Object.getOwnPropertyDescriptor=function(object,property){if("object"!=typeof object&&"function"!=typeof object||null===object)throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object: "+object);if(getOwnPropertyDescriptorFallback)try{return getOwnPropertyDescriptorFallback.call(Object,object,property)}catch(exception){}var descriptor;if(!owns(object,property))return descriptor;if(descriptor={enumerable:isEnumerable(object,property),configurable:!0},supportsAccessors){var prototype=object.__proto__,notPrototypeOfObject=object!==prototypeOfObject;notPrototypeOfObject&&(object.__proto__=prototypeOfObject);var getter=lookupGetter(object,property),setter=lookupSetter(object,property);if(notPrototypeOfObject&&(object.__proto__=prototype),getter||setter)return getter&&(descriptor.get=getter),setter&&(descriptor.set=setter),descriptor}return descriptor.value=object[property],descriptor.writable=!0,descriptor}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(object){return Object.keys(object)}),!Object.create){var createEmpty,supportsProto=!({__proto__:null}instanceof Object),shouldUseActiveX=function(){if(!document.domain)return!1;try{return!!new ActiveXObject("htmlfile")}catch(exception){return!1}},getEmptyViaActiveX=function(){var empty,xDoc;return(xDoc=new ActiveXObject("htmlfile")).write("<script><\/script>"),xDoc.close(),empty=xDoc.parentWindow.Object.prototype,xDoc=null,empty},getEmptyViaIFrame=function(){var empty,iframe=document.createElement("iframe"),parent=document.body||document.documentElement;return iframe.style.display="none",parent.appendChild(iframe),iframe.src="javascript:",empty=iframe.contentWindow.Object.prototype,parent.removeChild(iframe),iframe=null,empty};createEmpty=supportsProto||"undefined"==typeof document?function(){return{__proto__:null}}:function(){var empty=shouldUseActiveX()?getEmptyViaActiveX():getEmptyViaIFrame();delete empty.constructor,delete empty.hasOwnProperty,delete empty.propertyIsEnumerable,delete empty.isPrototypeOf,delete empty.toLocaleString,delete empty.toString,delete empty.valueOf;var Empty=function(){};return Empty.prototype=empty,createEmpty=function(){return new Empty},new Empty},Object.create=function(prototype,properties){var object,Type=function(){};if(null===prototype)object=createEmpty();else{if("object"!=typeof prototype&&"function"!=typeof prototype)throw new TypeError("Object prototype may only be an Object or null");Type.prototype=prototype,(object=new Type).__proto__=prototype}return void 0!==properties&&Object.defineProperties(object,properties),object}}var doesDefinePropertyWork=function(object){try{return Object.defineProperty(object,"sentinel",{}),"sentinel"in object}catch(exception){return!1}};if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({}),definePropertyWorksOnDom="undefined"==typeof document||doesDefinePropertyWork(document.createElement("div"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom)var definePropertyFallback=Object.defineProperty,definePropertiesFallback=Object.defineProperties}if(!Object.defineProperty||definePropertyFallback){Object.defineProperty=function(object,property,descriptor){if("object"!=typeof object&&"function"!=typeof object||null===object)throw new TypeError("Object.defineProperty called on non-object: "+object);if("object"!=typeof descriptor&&"function"!=typeof descriptor||null===descriptor)throw new TypeError("Property description must be an object: "+descriptor);if(definePropertyFallback)try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}if("value"in descriptor)if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject,delete object[property],object[property]=descriptor.value,object.__proto__=prototype}else object[property]=descriptor.value;else{if(!supportsAccessors&&("get"in descriptor||"set"in descriptor))throw new TypeError("getters & setters can not be defined on this javascript engine");"get"in descriptor&&defineGetter(object,property,descriptor.get),"set"in descriptor&&defineSetter(object,property,descriptor.set)}return object}}Object.defineProperties&&!definePropertiesFallback||(Object.defineProperties=function(object,properties){if(definePropertiesFallback)try{return definePropertiesFallback.call(Object,object,properties)}catch(exception){}return Object.keys(properties).forEach(function(property){"__proto__"!==property&&Object.defineProperty(object,property,properties[property])}),object}),Object.seal||(Object.seal=function(object){if(Object(object)!==object)throw new TypeError("Object.seal can only be called on Objects.");return object}),Object.freeze||(Object.freeze=function(object){if(Object(object)!==object)throw new TypeError("Object.freeze can only be called on Objects.");return object});try{Object.freeze(function(){})}catch(exception){Object.freeze=function(freezeObject){return function(object){return"function"==typeof object?object:freezeObject(object)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(object){if(Object(object)!==object)throw new TypeError("Object.preventExtensions can only be called on Objects.");return object}),Object.isSealed||(Object.isSealed=function(object){if(Object(object)!==object)throw new TypeError("Object.isSealed can only be called on Objects.");return!1}),Object.isFrozen||(Object.isFrozen=function(object){if(Object(object)!==object)throw new TypeError("Object.isFrozen can only be called on Objects.");return!1}),Object.isExtensible||(Object.isExtensible=function(object){if(Object(object)!==object)throw new TypeError("Object.isExtensible can only be called on Objects.");for(var name="";owns(object,name);)name+="?";object[name]=!0;var returnValue=owns(object,name);return delete object[name],returnValue})}),function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).videojs=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _button2=_interopRequireDefault(_dereq_(2)),_component2=_interopRequireDefault(_dereq_(5)),BigPlayButton=function(_Button){function BigPlayButton(player,options){_classCallCheck(this,BigPlayButton);var _this=_possibleConstructorReturn(this,_Button.call(this,player,options));return _this.mouseused_=!1,_this.on("mousedown",_this.handleMouseDown),_this}return _inherits(BigPlayButton,_Button),BigPlayButton.prototype.buildCSSClass=function(){return"vjs-big-play-button"},BigPlayButton.prototype.handleClick=function(event){var playPromise=this.player_.play();if(!(this.mouseused_&&event.clientX&&event.clientY)){var cb=this.player_.getChild("controlBar"),playToggle=cb&&cb.getChild("playToggle");if(playToggle){var playFocus=function(){return playToggle.focus()};if(playPromise&&playPromise.then){playPromise.then(playFocus,function(){})}else this.setTimeout(playFocus,1)}else this.player_.focus()}},BigPlayButton.prototype.handleKeyPress=function(event){this.mouseused_=!1,_Button.prototype.handleKeyPress.call(this,event)},BigPlayButton.prototype.handleMouseDown=function(event){this.mouseused_=!0},BigPlayButton}(_button2.default);BigPlayButton.prototype.controlText_="Play Video",_component2.default.registerComponent("BigPlayButton",BigPlayButton),exports.default=BigPlayButton},{2:2,5:5}],2:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _clickableComponent2=_interopRequireDefault(_dereq_(3)),_component2=_interopRequireDefault(_dereq_(5)),_log2=_interopRequireDefault(_dereq_(86)),_obj=_dereq_(88),Button=function(_ClickableComponent){function Button(){return _classCallCheck(this,Button),_possibleConstructorReturn(this,_ClickableComponent.apply(this,arguments))}return _inherits(Button,_ClickableComponent),Button.prototype.createEl=function(){var tag=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"button",props=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};props=(0,_obj.assign)({className:this.buildCSSClass()},props),"button"!==tag&&(_log2.default.warn("Creating a Button with an HTML element of "+tag+" is deprecated; use ClickableComponent instead."),props=(0,_obj.assign)({tabIndex:0},props),attributes=(0,_obj.assign)({role:"button"},attributes)),attributes=(0,_obj.assign)({type:"button","aria-live":"polite"},attributes);var el=_component2.default.prototype.createEl.call(this,tag,props,attributes);return this.createControlTextEl(el),el},Button.prototype.addChild=function(child){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},className=this.constructor.name;return _log2.default.warn("Adding an actionable (user controllable) child to a Button ("+className+") is not supported; use a ClickableComponent instead."),_component2.default.prototype.addChild.call(this,child,options)},Button.prototype.enable=function(){_ClickableComponent.prototype.enable.call(this),this.el_.removeAttribute("disabled")},Button.prototype.disable=function(){_ClickableComponent.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},Button.prototype.handleKeyPress=function(event){32!==event.which&&13!==event.which&&_ClickableComponent.prototype.handleKeyPress.call(this,event)},Button}(_clickableComponent2.default);_component2.default.registerComponent("Button",Button),exports.default=Button},{3:3,5:5,86:86,88:88}],3:[function(_dereq_,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj.default=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _component2=_interopRequireDefault(_dereq_(5)),Dom=_interopRequireWildcard(_dereq_(81)),Events=_interopRequireWildcard(_dereq_(82)),Fn=_interopRequireWildcard(_dereq_(83)),_log2=_interopRequireDefault(_dereq_(86)),_document2=_interopRequireDefault(_dereq_(94)),_obj=_dereq_(88),ClickableComponent=function(_Component){function ClickableComponent(player,options){_classCallCheck(this,ClickableComponent);var _this=_possibleConstructorReturn(this,_Component.call(this,player,options));return _this.emitTapEvents(),_this.enable(),_this}return _inherits(ClickableComponent,_Component),ClickableComponent.prototype.createEl=function(){var tag=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",props=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};props=(0,_obj.assign)({className:this.buildCSSClass(),tabIndex:0},props),"button"===tag&&_log2.default.error("Creating a ClickableComponent with an HTML element of "+tag+" is not supported; use a Button instead."),attributes=(0,_obj.assign)({role:"button","aria-live":"polite"},attributes),this.tabIndex_=props.tabIndex;var el=_Component.prototype.createEl.call(this,tag,props,attributes);return this.createControlTextEl(el),el},ClickableComponent.prototype.createControlTextEl=function(el){return this.controlTextEl_=Dom.createEl("span",{className:"vjs-control-text"}),el&&el.appendChild(this.controlTextEl_),this.controlText(this.controlText_,el),this.controlTextEl_},ClickableComponent.prototype.controlText=function(text){var el=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(!text)return this.controlText_||"Need Text";var localizedText=this.localize(text);return this.controlText_=text,this.controlTextEl_.innerHTML=localizedText,this.nonIconControl||el.setAttribute("title",localizedText),this},ClickableComponent.prototype.buildCSSClass=function(){return"vjs-control vjs-button "+_Component.prototype.buildCSSClass.call(this)},ClickableComponent.prototype.enable=function(){return this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.off(["tap","click"],this.handleClick),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur),this.on(["tap","click"],this.handleClick),this.on("focus",this.handleFocus),this.on("blur",this.handleBlur),this},ClickableComponent.prototype.disable=function(){return this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off(["tap","click"],this.handleClick),this.off("focus",this.handleFocus),this.off("blur",this.handleBlur),this},ClickableComponent.prototype.handleClick=function(event){},ClickableComponent.prototype.handleFocus=function(event){Events.on(_document2.default,"keydown",Fn.bind(this,this.handleKeyPress))},ClickableComponent.prototype.handleKeyPress=function(event){32===event.which||13===event.which?(event.preventDefault(),this.handleClick(event)):_Component.prototype.handleKeyPress&&_Component.prototype.handleKeyPress.call(this,event)},ClickableComponent.prototype.handleBlur=function(event){Events.off(_document2.default,"keydown",Fn.bind(this,this.handleKeyPress))},ClickableComponent}(_component2.default);_component2.default.registerComponent("ClickableComponent",ClickableComponent),exports.default=ClickableComponent},{5:5,81:81,82:82,83:83,86:86,88:88,94:94}],4:[function(_dereq_,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw