From 80f79007a7ddcfe51b441ff601bdc65e4fa2d40e Mon Sep 17 00:00:00 2001 From: Anton Schubert Date: Fri, 22 Dec 2017 22:57:10 +0100 Subject: try to increase player robustness --- assets/clapprio/dash-shaka-playback.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'assets/clapprio') diff --git a/assets/clapprio/dash-shaka-playback.min.js b/assets/clapprio/dash-shaka-playback.min.js index 3d47aae..d7cb91e 100644 --- a/assets/clapprio/dash-shaka-playback.min.js +++ b/assets/clapprio/dash-shaka-playback.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("clappr")):"function"==typeof define&&define.amd?define(["clappr"],e):"object"==typeof exports?exports.DashShakaPlayback=e(require("clappr")):t.DashShakaPlayback=e(t.Clappr)}("undefined"!=typeof self?self:this,function(t){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="dist/",e(e.s=0)}([function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,i,n)}if("value"in r)return r.value;var s=r.get;if(void 0!==s)return s.call(n)},o=function(){function t(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:"";c.default.polyfill.installAll();var i=c.default.Player.isBrowserSupported(),n=t.split("?")[0].match(/.*\.(.*)$/)||[];return i&&("mpd"===n[1]||e.indexOf("application/dash+xml")>-1)}},{key:"Events",get:function(){return{SHAKA_READY:"shaka:ready"}}}]),o(e,[{key:"play",value:function(){if(this._player||this._setup(),!this.isReady)return void this.once(e.Events.SHAKA_READY,this.play);this._stopped=!1,this._src=this.el.src,s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"play",this).call(this)}},{key:"setupSrc",value:function(){}},{key:"_ready",value:function(){}},{key:"_onShakaReady",value:function(){this._isShakaReadyState=!0,this.trigger(e.Events.SHAKA_READY),this.trigger(u.Events.PLAYBACK_READY,this.name)}},{key:"error",value:function(t){u.Log.error("an error was raised by the video tag",t,this.el.error)}},{key:"isHighDefinitionInUse",value:function(){return!1}},{key:"stop",value:function(){var t=this;clearInterval(this.sendStatsId),this._stopped=!0,this._player?(this._sendStats(),this._player.unload().then(function(){s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",t).call(t),t._player=null,t._isShakaReadyState=!1}).catch(function(){u.Log.error("shaka could not be unloaded")})):s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this)}},{key:"getPlaybackType",value:function(){return(this.isReady&&this._player.isLive()?"live":"vod")||""}},{key:"selectAudioLanguage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._player.selectAudioLanguage(t,e)}},{key:"selectTrack",value:function(t){if("text"===t.type)this._player.selectTextTrack(t);else{if("variant"!==t.type)throw new Error("Unhandled track type:",t.type);this._player.selectVariantTrack(t),t.mimeType.startsWith("video/")&&this._onAdaptation()}}},{key:"_enableShakaTextTrack",value:function(t){this.el.textTracks&&(this._shakaTTVisible=t,Array.from(this.el.textTracks).filter(function(t){return"subtitles"===t.kind}).forEach(function(e){return e.mode=!0===t?"showing":"hidden"}))}},{key:"_checkForClosedCaptions",value:function(){if(!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(u.Events.PLAYBACK_SUBTITLE_AVAILABLE);var t=this.closedCaptionsTrackId;this.closedCaptionsTrackId=t}this._ccIsSetup=!0}}},{key:"destroy",value:function(){var t=this;clearInterval(this.sendStatsId),this._player?this._player.destroy().then(function(){return t._destroy()}).catch(function(){t._destroy(),u.Log.error("shaka could not be destroyed")}):this._destroy()}},{key:"_setup",value:function(){var t=this;this._isShakaReadyState=!1,this._ccIsSetup=!1,this._player=this._createPlayer(),this._options.shakaConfiguration&&this._player.configure(this._options.shakaConfiguration),this._options.shakaOnBeforeLoad&&this._options.shakaOnBeforeLoad(this._player),this._player.load(this._options.src).then(function(){return t._loaded()}).catch(function(e){return t._setupError(e)})}},{key:"_createPlayer",value:function(){var t=new c.default.Player(this.el);return t.addEventListener("error",this._onError.bind(this)),t.addEventListener("adaptation",this._onAdaptation.bind(this)),t.addEventListener("buffering",this._onBuffering.bind(this)),t}},{key:"_onBuffering",value:function(t){if(!this._stopped){var e=t.buffering?u.Events.PLAYBACK_BUFFERING:u.Events.PLAYBACK_BUFFERFULL;this.trigger(e)}}},{key:"_loaded",value:function(){this._onShakaReady(),this._startToSendStats(),this._fillLevels(),this._checkForClosedCaptions()}},{key:"_fillLevels",value:function(){0===this._levels.length&&(this._levels=this.videoTracks.slice(0).reverse(),this.trigger(u.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels))}},{key:"_startToSendStats",value:function(){var t=this,e=this._options.shakaSendStatsInterval||3e4;this.sendStatsId=setInterval(function(){return t._sendStats()},e)}},{key:"_sendStats",value:function(){this.trigger(u.Events.PLAYBACK_STATS_ADD,this._player.getStats())}},{key:"_setupError",value:function(t){this._onError(t)}},{key:"_onError",value:function(t){u.Log.error("Shaka error event:",t),this.trigger(u.Events.PLAYBACK_ERROR,t,this.name)}},{key:"_onAdaptation",value:function(){var t=this.videoTracks.filter(function(t){return!0===t.active})[0];this._fillLevels(),this._sendStats(),this._pendingAdaptationEvent_&&(this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END),this._pendingAdaptationEvent=!1),u.Log.debug("an adaptation has happened:",t),this.trigger(u.Events.PLAYBACK_BITRATE,{bandwidth:t.bandwidth,language:t.language,width:t.width,height:t.height,level:t.id})}},{key:"_destroy",value:function(){s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this),this._isShakaReadyState=!1,u.Log.debug("shaka was destroyed")}},{key:"isReady",get:function(){return this._isShakaReadyState}},{key:"textTracks",get:function(){return this.isReady&&this._player.getTextTracks()}},{key:"audioLanguages",get:function(){return this.isReady&&this._player.getAudioLanguages()}},{key:"audioTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("audio/")})}},{key:"videoTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("video/")})}},{key:"closedCaptionsTracks",get:function(){var t=0,e=function(){return t++};return(this.textTracks||[]).filter(function(t){return"subtitle"===t.kind}).map(function(t){return{id:e(),name:t.label||t.language,track:t}})}},{key:"closedCaptionsTrackId",get:function(){return s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"closedCaptionsTrackId",this)},set:function(t){if(this._player){var e=this.closedCaptionsTracks,i=void 0;if(-1!==t){if(!(i=e.find(function(e){return e.id===t})))return void u.Log.warn('Track id "'+t+'" not found');if(this._shakaTTVisible&&!0===i.track.active)return void u.Log.info('Track id "'+t+'" already showing')}i?(this._player.selectTextTrack(i.track),this._enableShakaTextTrack(!0)):this._enableShakaTextTrack(!1),this._ccTrackId=t,this.trigger(u.Events.PLAYBACK_SUBTITLE_CHANGED,{id:t})}}}]),e}(u.HTML5Video);e.default=l,t.exports=e.default},function(e,i){e.exports=t},function(t,e,i){var n;!function(){var r={};(function(t){function e(t,e){var i=t.split("."),n=$s;i[0]in n||!n.execScript||n.execScript("var "+i[0]);for(var r;i.length&&(r=i.shift());)i.length||void 0===e?n=n[r]?n[r]:n[r]={}:n[r]=e}function i(t){function e(){}var i=Se;e.prototype=i.prototype,t.Te=i.prototype,t.prototype=new e,t.prototype.constructor=t,t.Re=function(t,e,n){return i.prototype[e].apply(t,Array.prototype.slice.call(arguments,2))}}function n(t){this.c=Math.exp(Math.log(.5)/t),this.b=this.a=0}function r(t,e,i){var n=Math.pow(t.c,e);i=i*(1-n)+n*t.a,isNaN(i)||(t.a=i,t.b+=e)}function a(t){return t.a/(1-Math.pow(t.c,t.b))}function s(){this.b=new n(2),this.c=new n(5),this.a=0}function o(){}function u(){}function h(t,e,i,n){this.severity=t,this.category=e,this.code=i,this.data=Array.prototype.slice.call(arguments,3),this.handled=!1}function c(t){var e;t instanceof c?(l(this,t.ea),this.Aa=t.Aa,this.ja=t.ja,f(this,t.Ia),this.ba=t.ba,d(this,b(t.a)),this.ta=t.ta):t&&(e=String(t).match(Ws))?(l(this,e[1]||"",!0),this.Aa=p(e[2]||""),this.ja=p(e[3]||"",!0),f(this,e[4]),this.ba=p(e[5]||"",!0),d(this,e[6]||"",!0),this.ta=p(e[7]||"")):this.a=new g(null)}function l(t,e,i){t.ea=i?p(e,!0):e,t.ea&&(t.ea=t.ea.replace(/:$/,""))}function f(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.Ia=e}else t.Ia=null}function d(t,e,i){e instanceof g?t.a=e:(i||(e=m(e,to)),t.a=new g(e))}function p(t,e){return t?e?decodeURI(t):decodeURIComponent(t):""}function m(t,e,i){return"string"==typeof t?(t=encodeURI(t).replace(e,v),i&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function v(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}function g(t){this.b=t||null}function b(t){var e=new g;if(e.b=t.b,t.a){var i,n={};for(i in t.a)n[i]=t.a[i].concat();e.a=n,e.c=t.c}return e}function y(){var t,e,i=new Promise(function(i,n){t=i,e=n});return i.resolve=t,i.reject=e,i}function T(t,e,i){var n=E();this.j=null==t.maxAttempts?n.maxAttempts:t.maxAttempts,this.f=null==t.baseDelay?n.baseDelay:t.baseDelay,this.i=null==t.fuzzFactor?n.fuzzFactor:t.fuzzFactor,this.h=null==t.backoffFactor?n.backoffFactor:t.backoffFactor,this.a=0,this.b=this.f,this.c=e||!1,this.g=i||null,this.c&&(this.a=1)}function w(t){if(t.a>=t.j){if(!t.c)return Promise.reject();t.a=1,t.b=t.f}var e=new y;return t.a?(S(t,e.resolve,t.b*(1+(2*Math.random()-1)*t.i)),t.b*=t.h):e.resolve(),t.a++,e}function E(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0}}function S(t,e,i){if(t.g)if(t.g()||!i)e();else{var n=Math.min(200,i);A(function(){S(this,e,i-n)}.bind(t),n)}else A(e,i)}function A(e,i){t.setTimeout(e,i)}function k(t,e,i,n,r){var a,s=r in n;for(a in e){var o=r+"."+a,u=s?n[r]:i[a];(s||a in t)&&(void 0===e[a]?void 0===u||s?delete t[a]:t[a]=u:u.constructor==Object&&e[a]&&e[a].constructor==Object?(t[a]||(t[a]=u),k(t[a],e[a],u,n,o)):typeof e[a]==typeof u&&null!=e[a]&&e[a].constructor==u.constructor&&(t[a]=e[a]))}}function I(t){function e(t){switch(typeof t){case"undefined":case"boolean":case"number":case"string":case"symbol":case"function":return t;default:if(!t)return t;if(0<=i.indexOf(t))return null;var n=t.constructor==Array;if(t.constructor!=Object&&!n)return null;i.push(t);var r,a=n?[]:{};for(r in t)a[r]=e(t[r]);return n&&(a.length=t.length),a}}var i=[];return e(t)}function P(t,e){return t.reduce(function(t,e,i){return e.catch(t.bind(null,i))}.bind(null,e),Promise.reject())}function _(t,e){return t.concat(e)}function x(){}function R(t){return null!=t}function N(t,e,i){return i.indexOf(t)==e}function D(t){this.f=!1,this.a=[],this.b=[],this.c=[],this.g=t||null}function L(t,e){return{uris:t,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:e}}function C(t,e,i,n,r,a,s){if(t.f||s())return Promise.reject();var o=new c(i.uris[r]),u=o.ea;if(u||(u=location.protocol,u=u.slice(0,-1),l(o,u),i.uris[r]=o.toString()),!(u=io[u]))return Promise.reject(new h(2,1,1e3,o));var f=Date.now();return u(i.uris[r],i,e).then(function(t){void 0==t.timeMs&&(t.timeMs=Date.now()-f);var i=Date.now(),n=Promise.resolve();return this.c.forEach(function(i){n=n.then(function(){return Promise.resolve(i(e,t))}.bind(this))}.bind(this)),n=n.catch(function(t){var e=2;throw t instanceof h&&(e=t.severity),new h(e,1,1007,t)}),n.then(function(){return t.timeMs+=Date.now()-i,t.timeMs+=a,t})}.bind(t)).catch(function(t){if(t&&1==t.severity)return r=(r+1)%i.uris.length,s()?Promise.reject():w(n).then(function(){return C(this,e,i,n,r,a,s)}.bind(this),function(){throw t});throw t}.bind(t))}function M(t,e){for(var i=[],n=0;n=t[e]}.bind(null,e);if(!e[0]&&!e[2])return tt(t,!1);if(!e[1]&&!e[3])return tt(t,!0);if(i(0)&&i(1)&&i(2)&&i(3))return Z(t);throw new h(2,2,2003)}function it(t){t=unescape(encodeURIComponent(t));for(var e=new Uint8Array(t.length),i=0;it.end(0)-t.start(0)?null:t.length?t.end(t.length-1):null}function Nt(t,e){return!(!t||!t.length||1==t.length&&1e-6>t.end(0)-t.start(0))&&(e>=t.start(0)&&e<=t.end(t.length-1))}function Dt(t,e){if(!t||!t.length||1==t.length&&1e-6>t.end(0)-t.start(0))return 0;for(var i=0,n=t.length-1;0<=n&&t.end(n)>e;--n)i+=t.end(n)-Math.max(t.start(n),e);return i}function Lt(t){if(!t)return[];for(var e=[],i=0;i=this.h&&t.startTimei.end(0)-i.start(0)?null:1==i.length&&0>i.start(0)?0:i.length?i.start(0):null;return i}function Ht(t,e){try{return t.b[e].buffered}catch(t){return null}}function Kt(t,e,i,n,r){return"text"==e?Ot(t.a,i,n,r):Xt(t,e,t.Ae.bind(t,e,i))}function Gt(t,e){return"text"==e?t.a.remove(0,1/0):Xt(t,e,t.Ac.bind(t,e,0,t.f.duration))}function qt(t,e,i,n,r){return"text"==e?(t.a.i=i,t=t.a,t.h=n,t.g=r,Promise.resolve()):Promise.all([Xt(t,e,t.Pc.bind(t,e)),Xt(t,e,t.re.bind(t,e,i)),Xt(t,e,t.oe.bind(t,e,n,r))])}function Xt(t,e,i){if(t.i)return Promise.reject();if(i={start:i,p:new y},t.c[e].push(i),1==t.c[e].length)try{i.start()}catch(n){"QuotaExceededError"==n.name?i.p.reject(new h(2,3,3017,e)):i.p.reject(new h(2,3,3015,n)),zt(t,e)}return i.p}function Yt(t,e){if(t.i)return Promise.reject();var i,n=[];for(i in t.b){var r=new y,a={start:function(t){t.resolve()}.bind(null,r),p:r};t.c[i].push(a),n.push(r),1==t.c[i].length&&a.start()}return Promise.all(n).then(function(){var t;try{e()}catch(t){var i=Promise.reject(new h(2,3,3015,t))}for(t in this.b)zt(this,t);return i}.bind(t),function(){return Promise.reject()}.bind(t))}function zt(t,e){t.c[e].shift();var i=t.c[e][0];if(i)try{i.start()}catch(n){i.p.reject(new h(2,3,3015,n)),zt(t,e)}}function $t(t,e,i){return i==e||t>=so&&i==e.split("-")[0]||t>=oo&&i.split("-")[0]==e.split("-")[0]}function Wt(t){t=t.toLowerCase().split("-");var e=uo[t[0]];return e&&(t[0]=e),t.join("-")}function Jt(t,e,i){var n=t.video;return!(n&&(n.widthe.maxWidth||n.width>i.width||n.heighte.maxHeight||n.height>i.height||n.width*n.heighte.maxPixels)||t.bandwidthe.maxBandwidth)}function Qt(t,e,i){var n=!1;return t.variants.forEach(function(t){var r=t.allowedByApplication;t.allowedByApplication=Jt(t,e,i),r!=t.allowedByApplication&&(n=!0)}),n}function Zt(t,e,i){var n=e.video,r=e.audio;for(e=0;en.indexOf(e)||i&&(t.mimeType!=i.mimeType||t.codecs.split(".")[0]!=i.codecs.split(".")[0]))}function ee(t,e,i){var n=null;return ae(t.variants).map(function(t){var r;r=t.video&&t.audio?i==t.video.id&&e==t.audio.id:t.video&&i==t.video.id||t.audio&&e==t.audio.id;var a="";t.video&&(a+=t.video.codecs),t.audio&&(""!=a&&(a+=", "),a+=t.audio.codecs,n=t.audio.label);var s=t.audio?t.audio.codecs:null,o=t.video?t.video.codecs:null,u=null;t.video?u=t.video.mimeType:t.audio&&(u=t.audio.mimeType);var h=null;t.audio?h=t.audio.kind:t.video&&(h=t.video.kind);var c=M((t.audio?t.audio.roles:[]).concat(t.video?t.video.roles:[]));return{id:t.id,active:r,type:"variant",bandwidth:t.bandwidth,language:t.language,label:n,kind:h||null,width:t.video?t.video.width:null,height:t.video?t.video.height:null,frameRate:t.video?t.video.frameRate:void 0,mimeType:u,codecs:a,audioCodec:s,videoCodec:o,primary:t.primary,roles:c,videoId:t.video?t.video.id:null,audioId:t.audio?t.audio.id:null,channelsCount:t.audio?t.audio.channelsCount:null,audioBandwidth:t.audio&&t.audio.bandwidth?t.audio.bandwidth:null,videoBandwidth:t.video&&t.video.bandwidth?t.video.bandwidth:null}})}function ie(t,e){return t.textStreams.map(function(t){return{id:t.id,active:e==t.id,type:"text",language:t.language,label:t.label,kind:t.kind,mimeType:t.mimeType,codecs:t.codecs||null,audioCodec:null,videoCodec:null,primary:t.primary,roles:t.roles,channelsCount:null,audioBandwidth:null,videoBandwidth:null}})}function ne(t,e){for(var i=0;i=t.periods[i].startTime)return i;return 0}function de(t,e){for(var i=0;ie?"-Infinity":"Infinity":e;return n}})}function ge(t){return JSON.parse(t,function(t,e){return"NaN"==e?NaN:"-Infinity"==e?-1/0:"Infinity"==e?1/0:e&&"object"==typeof e&&"TimeRanges"==e.__type__?be(e):e})}function be(t){return{length:t.length,start:function(e){return t.start[e]},end:function(e){return t.end[e]}}}function ye(t,e,i,n,r,a){this.J=t,this.g=e,this.L=i,this.j=!1,this.C=n,this.D=r,this.w=a,this.b=this.h=!1,this.B="",this.i=null,this.l=this.mc.bind(this),this.m=this.Cd.bind(this),this.a={video:{},player:{}},this.s=0,this.c={},this.f=null}function Te(t){var e=Eo;e.removeUpdateListener(t.l),e.removeMessageListener("urn:x-cast:com.google.shaka.v2",t.m)}function we(t){for(var e in t.c){var i=t.c[e];delete t.c[e],i.reject(new h(1,7,7e3))}}function Ee(t){t=ve(t),Eo.sendMessage("urn:x-cast:com.google.shaka.v2",t,function(){},u)}function Se(){this.vb=new j,this.bb=this}function Ae(t,e,i){Se.call(this),this.c=t,this.b=e,this.i=this.g=this.f=this.j=this.h=null,this.a=new ye(i,this.ve.bind(this),this.we.bind(this),this.xe.bind(this),this.ye.bind(this),this.fc.bind(this)),ke(this)}function ke(t){t.a.init(),t.i=new B,ho.forEach(function(t){F(this.i,this.c,t,this.Me.bind(this))}.bind(t)),po.forEach(function(t){F(this.i,this.b,t,this.Yd.bind(this))}.bind(t)),t.h={};for(var e in t.c)Object.defineProperty(t.h,e,{configurable:!1,enumerable:!0,get:t.Le.bind(t,e),set:t.Ne.bind(t,e)});t.j={};for(e in t.b)Object.defineProperty(t.j,e,{configurable:!1,enumerable:!0,get:t.Xd.bind(t,e)});t.f=new Se,t.f.bb=t.h,t.g=new Se,t.g.bb=t.j}function Ie(t,e,i,n){Se.call(this),this.a=t,this.b=e,this.j={video:t,player:e},this.l=i||function(){},this.m=n||function(t){return t},this.i=!1,this.f=!0,this.h=this.g=this.c=null,Pe(this)}function Pe(e){var i=cast.receiver.CastReceiverManager.getInstance();i.onSenderConnected=e.tc.bind(e),i.onSenderDisconnected=e.tc.bind(e),i.onSystemVolumeChanged=e.Xc.bind(e),e.g=i.getCastMessageBus("urn:x-cast:com.google.cast.media"),e.g.onMessage=e.xd.bind(e),e.c=i.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),e.c.onMessage=e.Ld.bind(e),i.start(),ho.forEach(function(t){this.a.addEventListener(t,this.wc.bind(this,"video"))}.bind(e)),po.forEach(function(t){this.b.addEventListener(t,this.wc.bind(this,"player"))}.bind(e)),cast.__platform__&&cast.__platform__.canDisplayType('video/mp4; codecs="avc1.640028"; width=3840; height=2160')?e.b.Sb(3840,2160):e.b.Sb(1920,1080),e.b.addEventListener("loading",function(){this.f=!1,_e(this)}.bind(e)),e.a.addEventListener("playing",function(){this.f=!1,_e(this)}.bind(e)),e.a.addEventListener("pause",function(){_e(this)}.bind(e)),e.b.addEventListener("unloading",function(){this.f=!0,_e(this)}.bind(e)),e.a.addEventListener("ended",function(){t.setTimeout(function(){this.a&&this.a.ended&&(this.f=!0,_e(this))}.bind(this),5e3)}.bind(e))}function _e(t){Promise.resolve().then(function(){this.dispatchEvent(new G("caststatuschanged")),Ne(this,0)}.bind(t))}function xe(t,e,i){for(var n in e.player)t.b[n](e.player[n]);t.l(i),i=Promise.resolve();var r=t.a.autoplay;e.manifest&&(t.a.autoplay=!1,i=t.b.load(e.manifest,e.startTime),i.catch(function(t){this.b.dispatchEvent(new G("error",{detail:t}))}.bind(t))),i.then(function(){var t;for(t in e.video){var i=e.video[t];this.a[t]=i}for(t in e.playerAfterLoad)i=e.playerAfterLoad[t],this.b[t](i);this.a.autoplay=r,e.manifest&&(this.a.play(),Ne(this,0))}.bind(t))}function Re(t,e,i,n){t.i&&(t=ve(e),n?i.getCastChannel(n).send(t):i.broadcast(t))}function Ne(t,e,i){var n=So,n={mediaSessionId:0,playbackRate:t.a.playbackRate,playerState:t.f?n.IDLE:t.b.Oa?n.Lc:t.a.paused?n.Mc:n.Nc,currentTime:t.a.currentTime,supportedMediaCommands:15,volume:{level:t.a.volume,muted:t.a.muted}};i&&(n.media=i),Re(t,{requestId:e,type:"MEDIA_STATUS",status:[n]},t.g)}function De(t,e){var i=Le(t,e);return 1!=i.length?null:i[0]}function Le(t,e){return Array.prototype.filter.call(t.childNodes,function(t){return t.tagName==e})}function Ce(t){var e=t.firstChild;return e&&e.nodeType==Node.TEXT_NODE?t.textContent.trim():null}function Me(t,e,i,n){var r=null;return t=t.getAttribute(e),null!=t&&(r=i(t)),null==r?void 0!=n?n:null:r}function Oe(t){return t?(/^\d+\-\d+\-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t)&&(t+="Z"),t=Date.parse(t),isNaN(t)?null:Math.floor(t/1e3)):null}function Ue(t){return t&&(t=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(t))?(t=31536e3*Number(t[1]||null)+2592e3*Number(t[2]||null)+86400*Number(t[3]||null)+3600*Number(t[4]||null)+60*Number(t[5]||null)+Number(t[6]||null),isFinite(t)?t:null):null}function je(t){var e=/([0-9]+)-([0-9]+)/.exec(t);return e?(t=Number(e[1]),isFinite(t)?(e=Number(e[2]),isFinite(e)?{start:t,end:e}:null):null):null}function Be(t){return t=Number(t),t%1?null:t}function Fe(t){return t=Number(t),!(t%1)&&0(f=f||0))if(l+1=f)break;f=Math.ceil((f-d)/p)-1}else{if(1/0==u)break;if(d/r>=u)break;f=Math.ceil((u*r-d)/p)-1}0>>31,c=2147483647&c,f=n.u.F();if(n.u.I(4),1==l)throw new h(2,3,3006);r.push(new ei(r.length,s/a-e,(s+f)/a-e,function(){return i},t,t+c-1)),s+=f,t+=c}return r}function fi(t){this.a=t}function di(t,e){for(var i;t.a.length&&(i=t.a[t.a.length-1],i.startTime>=e);)t.a.pop();for(;t.a.length&&(i=t.a[0],0>=i.endTime);)t.a.shift();t.a.length&&(i=t.a[0],i.startTime=e&&!(i&1<<8-e);e++);if(8t||i&&t>=i?null:Math.floor(t/n)},getSegmentReference:function(t){var e=t*n;return 0>e||i&&e>=i?null:new ei(t,e,e+n,function(){var i=Ye(s,u,t+r,o,e*a);return q(h,[i])},0,null)}}}function Li(t,e){for(var i=[],n=0;ne.l||(e.f=t.setTimeout(e.ze.bind(e),1e3*Math.max(Math.max(3,e.l)-i,0)))}function Yi(t,e,i){e=e||{contentType:"",mimeType:"",codecs:"",containsEmsgBoxes:!1,frameRate:void 0,Fb:null},i=i||e.$;var n=Le(t,"BaseURL").map(Ce),r=t.getAttribute("contentType")||e.contentType,a=t.getAttribute("mimeType")||e.mimeType,s=t.getAttribute("codecs")||e.codecs,o=Me(t,"frameRate",He)||e.frameRate,u=!!Le(t,"InbandEventStream").length,h=Le(t,"AudioChannelConfiguration"),h=zi(h)||e.Fb;return r||(r=Qi(a,s)),{$:q(i,n),Wa:De(t,"SegmentBase")||e.Wa,pa:De(t,"SegmentList")||e.pa,Xa:De(t,"SegmentTemplate")||e.Xa,width:Me(t,"width",Ve)||e.width,height:Me(t,"height",Ve)||e.height,contentType:r,mimeType:a,codecs:s,frameRate:o,containsEmsgBoxes:u||e.containsEmsgBoxes,id:t.getAttribute("id"),Fb:h}}function zi(t){for(var e=0;e>=1;return t}}}return null}function $i(t){var e=0+(t.Wa?1:0);return e+=t.pa?1:0,(e+=t.Xa?1:0)?(1!=e&&(t.Wa&&(t.pa=null),t.Xa=null),!0):"text"==t.contentType||"application"==t.contentType}function Wi(t,e,i,n){return e=q(e,[i]),e=L(e,t.b.retryParameters),e.method=n,t.a.networkingEngine.request(0,e).then(function(t){if("HEAD"==n){if(!t.headers||!t.headers.date)return 0;t=t.headers.date}else t=Z(t.data);return t=Date.parse(t),isNaN(t)?0:t-Date.now()})}function Ji(t,e,i,n){i=i.map(function(t){return{scheme:t.getAttribute("schemeIdUri"),value:t.getAttribute("value")}});var r=t.b.dash.clockSyncUri;return n&&!i.length&&r&&i.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:r}),P(i,function(t){var i=t.value;switch(t.scheme){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":return Wi(this,e,i,"HEAD");case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":return Wi(this,e,i,"GET");case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":return t=Date.parse(i),isNaN(t)?0:t-Date.now();case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:return Promise.reject()}}.bind(t)).catch(function(){return 0})}function Qi(t,e){return ao[Q(t,e)]?"text":t.split("/")[0]}function Zi(t,e,i,n){this.uri=t,this.type=e,this.U=i,this.segments=n||null}function tn(t,e,i,n){this.id=t,this.name=e,this.a=i,this.value=n||null}function en(t,e){this.name=t,this.value=e}function nn(t,e,i){return i=i||null,(t=t.getAttribute(e))?t.value:i}function rn(t,e){this.U=e,this.uri=t}function an(t,e){return t.filter(function(t){return t.name==e})}function sn(t,e){var i=an(t,e);return i.length?i[0]:null}function on(t,e,i){return t.filter(function(t){var n=t.getAttribute("TYPE");return t=t.getAttribute("GROUP-ID"),n.value==e&&t.value==i})}function un(t){this.b=t,this.a=0}function hn(t,e){e.lastIndex=t.a;var i=(i=e.exec(t.b))?{position:i.index,length:i[0].length,he:i}:null;return t.a!=t.b.length&&i&&i.position==t.a?(t.a+=i.length,i.he):null}function cn(t){return t.a==t.b.length?null:(t=hn(t,/[^ \t\n]*/gm))?t[0]:null}function ln(){this.a=0}function fn(t,e,i){e=Z(e),e=e.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();var n=e.split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(n[0]))throw new h(2,4,4015);e=0;for(var r=[],a=1;an.position){var u=o.endTime-o.startTime,c=a,l=a+u,a=a+u;r.push(new ei(o.position,c,l,o.a,o.T,o.K))}}i=r,e.je.ob(i),i.length&&(e.Bb=i[i.length-1]),sn(t.U,"EXT-X-ENDLIST")&&(t=e.Bb.endTime,Vn(this,!1),this.a.ga(t))}.bind(t))}function bn(t,e,i){if(e=fn(t.w,e,i),0!=e.type)throw new h(2,4,4022);return yn(t,e).then(function(t){this.b.filterAllPeriods([t]),this.f&&this.a.Hc(3*this.l),this.B={presentationTimeline:this.a,periods:[t],offlineSessionIds:[],minBufferTime:0}}.bind(t))}function yn(t,e){var i=e.U,n=an(e.U,"EXT-X-MEDIA").filter(function(t){return"SUBTITLES"==Un(t,"TYPE")}.bind(t)).map(function(t){return Sn(this,t,e)}.bind(t));return Promise.all(n).then(function(t){var n=an(i,"EXT-X-STREAM-INF").map(function(t){return Tn(this,t,e)}.bind(this));return Promise.all(n).then(function(e){return e=e.reduce(_,[]),this.f||Dn(this,e),{startTime:0,variants:e,textStreams:t}}.bind(this))}.bind(t))}function Tn(t,e,i){var n=nn(e,"CODECS","avc1.42E01E,mp4a.40.2").split(","),r=e.getAttribute("RESOLUTION"),a=null,s=null,o=nn(e,"FRAME-RATE"),u=Number(Un(e,"BANDWIDTH"));if(r)var h=r.value.split("x"),a=h[0],s=h[1];var c=On(t,i);i=an(i.U,"EXT-X-MEDIA");var l=nn(e,"AUDIO"),f=nn(e,"VIDEO");if(l?i=on(i,"AUDIO",l):f&&(i=on(i,"VIDEO",f)),h=Ln("text",n)){var d=nn(e,"SUBTITLES");d&&(d=on(i,"SUBTITLES",d),d.length&&(t.g[d[0].id].stream.codecs=h)),n.splice(n.indexOf(h),1)}i=i.map(function(t){return An(this,t,n,c)}.bind(t));var p=[],m=[];return Promise.all(i).then(function(t){if(l?p=t:f&&(m=t),p.length||m.length)if(p.length)if(Un(e,"URI")==p[0].Pb){t="audio";var i=!0}else t="video";else t="audio";else i=!1,1==n.length?(t=Ln("video",n),t=r||o||t?"video":"audio"):(t="video",n=[n.join(",")]);return i?Promise.resolve():In(this,e,n,t,c)}.bind(t)).then(function(t){return t&&("audio"==t.stream.type?p=[t]:m=[t]),wn(this,p,m,u,a,s,o)}.bind(t))}function wn(t,e,i,n,r,a,s){i.forEach(function(t){(t=t.stream)&&(t.width=Number(r)||void 0,t.height=Number(a)||void 0,t.frameRate=Number(s)||void 0)}.bind(t)),e.length||(e=[null]),i.length||(i=[null]);for(var o=[],u=0;ui&&(t.c=i):(Vn(t,!0),t.c=i),t.l=Math.max(i,t.l)}}function xn(t,e){var i=null,n=0;t.f&&(i=Date.now()/1e3-e,n=3*t.l),t.a=new Ui(i,n),t.a.rb(!t.f)}function Rn(t){var e=an(t.U,"EXT-X-MAP");if(!e.length)return null;if(1=i?i-t.l.durationBackoff:e}function qn(t){return 0e.W()?e.ka():e.nb(),t.m=Gn(t,e),e}function Yn(t,e){t.f&&(t.f.cancel(),t.f=null),t.i=e,t.a.playbackRate=t.j||0>e?0:e,!t.j&&0>e&&(t.f=new rt(function(){this.a.currentTime+=e/4}.bind(t)),st(t.f,.25))}function zn(t,e){var i=Nt.bind(null,t.a.buffered),n=1*Math.max(t.c.minBufferTime||0,t.l.rebufferingGoal),r=t.c.presentationTimeline,a=r.ua(),s=r.Da(n),o=r.Da(5),n=r.Da(n+5);return e>=r.W()?Gn(t,e):e>a?a:e=s||i(e)?e:n}function $n(t,e,i){t.a.currentTime=i;var n=0,r=function(){!this.a||10<=n++||this.a.currentTime!=e||(this.a.currentTime=i,setTimeout(r,100))}.bind(t);setTimeout(r,100)}function Wn(t,e){var i=t.c.presentationTimeline.ka();return ei?i:e)}function Jn(t,e,i,n,r,a,s){this.a=t,this.B=e,this.g=i,this.w=n,this.l=r,this.h=a,this.C=s,this.c=[],this.j=new B,this.b=!1,this.i=-1,this.f=null,Zn(this)}function Qn(t){var e=I(t);return e.eventElement=t.eventElement,e}function Zn(e){tr(e),e.f=t.setTimeout(e.D.bind(e),250)}function tr(e){e.f&&(t.clearTimeout(e.f),e.f=null)}function er(t,e){this.a=e,this.b=t,this.h=null,this.i=1,this.m=Promise.resolve(),this.g=[],this.j={},this.c={},this.s=!1,this.w=null,this.f=this.l=!1}function ir(t){var e=qn(t.a.Ua);return t.b.periods[fe(t.b,e)]}function nr(t){var e=t.c.video||t.c.audio;return e?t.b.periods[e.wa]:null}function rr(t){return $(t.c,function(t){return t.oa||t.stream})}function ar(t,e){var i=t.c.video;if(i){var n=i.stream;if(n)if(e){var r=n.trickModeVideo;if(r){var a=i.oa;a||(or(t,r,!1),i.oa=n)}}else(a=i.oa)&&(i.oa=null,or(t,a,!0))}}function sr(t,e,i){e.video&&or(t,e.video,i),e.audio&&or(t,e.audio,i)}function or(t,e,i){var n=t.c[e.type];if(!n&&"text"==e.type&&t.h.ignoreTextStreamFailures)cr(t,{text:e});else if(n){var r=de(t.b,e);i&&r!=n.wa?hr(t):(n.oa&&(e.trickModeVideo?(n.oa=e,e=e.trickModeVideo):n.oa=null),(r=t.g[r])&&r.Ka&&(r=t.j[e.id])&&r.Ka&&n.stream!=e&&("text"==e.type&&Ft(t.a.M,Q(e.mimeType,e.codecs)),n.stream=e,n.pb=!0,i&&(n.sa?n.tb=!0:n.xa?(n.ra=!0,n.tb=!0):(Pr(n),kr(t,n,!0)))))}}function ur(t){var e=qn(t.a.Ua);Object.keys(t.c).every(function(t){var i=this.a.M;return"text"==t?(t=i.a,t=e>=t.a&&ee?t.a.M.ga(e):t.a.M.ga(Math.pow(2,32))}function pr(t,e){var i=qn(t.a.Ua),n=e.Ea&&e.la?t.b.periods[de(t.b,e.Ea)].startTime+e.la.endTime:Math.max(i,e.Bc),r=de(t.b,e.stream),a=fe(t.b,n),s=t.a.M,o=e.type;return"text"==o?(s=s.a,s=null==s.b||s.b=t.b.presentationTimeline.W()?(e.endOfStream=!0,null):(e.endOfStream=!1,e.wa=a,a!=r?null:s>=o?.5:(n=t.a.M,a=e.type,n="text"==a?n.a.b:Rt(Ht(n,a)),e.la&&e.stream==e.Ea?(a=e.la.position+1,n=mr(t,e,r,a)):(a=e.la?e.stream.findSegmentPosition(Math.max(0,t.b.periods[de(t.b,e.Ea)].startTime+e.la.endTime-t.b.periods[r].startTime)):e.stream.findSegmentPosition(Math.max(0,(n||i)-t.b.periods[r].startTime)),null==a?n=null:(s=null,null==n&&(s=mr(t,e,r,Math.max(0,a-1))),n=s||mr(t,e,r,a))),n?(e.Bc=0,vr(t,e,i,r,n),null):1))}function mr(t,e,i,n){return i=t.b.periods[i],(e=e.stream.getSegmentReference(n))?(t=t.b.presentationTimeline,n=t.ua(),i.startTime+e.endTimen?null:e):null}function vr(t,e,i,n,r){var a=t.b.periods[n],s=e.stream,o=t.b.presentationTimeline.W(),u=t.b.periods[n+1];n=br(t,e,n,a.startTime,u?u.startTime:o),e.xa=!0,e.pb=!1,o=Ar(t,r),Promise.all([n,o]).then(function(t){if(!this.f&&!this.l)return yr(this,e,i,a,s,r,t[1])}.bind(t)).then(function(){this.f||this.l||(e.xa=!1,e.Ob=!1,e.ra||this.a.Ib(),Ir(this,e,0),wr(this,s))}.bind(t)).catch(function(t){this.f||this.l||(e.xa=!1,"text"==e.type&&this.h.ignoreTextStreamFailures?delete this.c.text:3017==t.code?gr(this,e,t):(e.Qa=!0,t.severity=2,_r(this,t)))}.bind(t))}function gr(t,e,i){if(!z(t.c).some(function(t){return t!=e&&t.Ob})){var n=Math.round(100*t.i);if(20=i?Promise.resolve():t.a.M.remove(e.type,n,n+i).then(function(){}.bind(t)))}function wr(t,e){if(!t.s&&(t.s=z(t.c).every(function(t){return"text"==t.type||!t.ra&&!t.sa&&t.la}),t.s)){var i=de(t.b,e);for(t.g[i]||lr(t,i).then(function(){this.a.jc()}.bind(t)).catch(x),i=0;i=e.status&&202!=e.status)e.responseURL&&(t=e.responseURL),i({uri:t,data:e.response,headers:r,fromCache:!!r["x-shaka-from-cache"]});else{var a=null;try{a=et(e.response)}catch(t){}n(new h(401==e.status||403==e.status?2:1,1,1001,t,e.status,a,r))}},r.onerror=function(){n(new h(1,1,1002,t))},r.ontimeout=function(){n(new h(1,1,1003,t))};for(var a in e.headers)r.setRequestHeader(a,e.headers[a]);r.send(e.body)})}function Rr(){this.a=null,this.b=[],this.c={}}function Nr(t,e,i){return Cr(t,e,"readwrite",function(t){t.put(i)})}function Dr(t,e,i){return Cr(t,"segment","readwrite",function(t){for(var n=0;n=t.length?Promise.resolve():Yr(this,t[e++]).then(i):Promise.reject(new h(2,9,9002))}.bind(this);return i()}.bind(t));return t.b={},t.i=Promise.all(i).then(function(){return Nr(this.j,"manifest",e)}.bind(t)).then(function(){this.l=[]}.bind(t)),t.i}function Yr(t,e){var i=L(e.uris,t.w);(e.T||null!=e.K)&&(i.headers.Range="bytes="+e.T+"-"+(null==e.K?"":e.K));var n;return t.s.request(1,i).then(function(t){return this.a?(n=t.data.byteLength,this.l.push(e.Qb.key),e.Qb.data=t.data,Nr(this.j,"segment",e.Qb)):Promise.reject(new h(2,9,9002))}.bind(t)).then(function(){if(!this.a)return Promise.reject(new h(2,9,9002));null==e.K?(this.a.size+=n,this.f+=e.$b):this.h+=n;var t=(this.h+this.f)/(this.c+this.g),i=Ur(this.a);this.m.progressCallback(i,t)}.bind(t))}function zr(){this.a=-1}function $r(t){var e=new Ui(null,0);e.ga(t.duration);var i=t.drmInfo?[t.drmInfo]:[];return{presentationTimeline:e,minBufferTime:10,offlineSessionIds:t.sessionIds,periods:t.periods.map(function(t){return jr(t,i,e)})}}function Wr(t){if(/^offline:([0-9]+)$/.exec(t)){var e={uri:t,data:new ArrayBuffer(0),headers:{"content-type":"application/x-offline-manifest"}};return Promise.resolve(e)}if(e=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t)){var i=Number(e[1]),n=Kr();return n?n.init(Co).then(function(){return n.get("segment",i)}).then(function(e){return n.o().then(function(){if(!e)throw new h(2,9,9003,i);return{uri:t,data:e.data,headers:{}}})}):Promise.reject(new h(2,9,9e3))}return Promise.reject(new h(2,1,9004,t))}function Jr(t){this.a=null;for(var e=0;e=e.endTime)return null;var i=new VTTCue(e.startTime,e.endTime,e.payload);i.lineAlign=e.lineAlign,i.positionAlign=e.positionAlign,i.size=e.size;try{i.align=e.textAlign}catch(t){}if("center"==e.textAlign&&"center"!=i.align&&(i.align="middle"),e.writingDirection==Wo?i.vertical="lr":e.writingDirection==Jo&&(i.vertical="rl"),e.lineInterpretation==Zo&&(i.snapToLines=!1),null!=e.line&&(i.line=e.line),null!=e.position&&(i.position=e.position),t.VTTRegion&&e.region){var n=new VTTRegion;n.viewportAnchorX=e.region.x,n.viewportAnchorY=e.region.y,n.width=e.region.width,n.height=e.region.height,i.region=n}return i}function Zr(t,e){for(var i=t.b,n=[],r=0;r=n.a.length)t=i;else{var r=[];for(t=0;tt.textDecoration.indexOf("underline")&&t.textDecoration.push("underline");break;case"noUnderline":0<=t.textDecoration.indexOf("underline")&&U(t.textDecoration,"underline");break;case"lineThrough":0>t.textDecoration.indexOf("lineThrough")&&t.textDecoration.push("lineThrough");break;case"noLineThrough":0<=t.textDecoration.indexOf("lineThrough")&&U(t.textDecoration,"lineThrough");break;case"overline":0>t.textDecoration.indexOf("overline")&&t.textDecoration.push("overline");break;case"noOverline":0<=t.textDecoration.indexOf("overline")&&U(t.textDecoration,"overline")}}function Cs(t,e,i,n){return(t=Os(t,i,n))?t:Ms(e,i,n)}function Ms(t,e,i){for(var n=Ns(t),r=0;ri.length)return null;var n=null,r=t;for(t=null;r&&!(t=r.getAttribute(e))&&(r=r.parentNode)instanceof Element;);if(e=t)for(t=0;tthis.a?t:Math.min(a(this.b),a(this.c))},t.console&&t.console.log.bind&&(o=console.warn.bind(console)),e("shaka.util.Error",h),h.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")},h.Severity={RECOVERABLE:1,CRITICAL:2},h.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9},h.Code={UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,UNKNOWN_DATA_URI_ENCODING:1005,REQUEST_FILTER_ERROR:1006,RESPONSE_FILTER_ERROR:1007,INVALID_TEXT_HEADER:2e3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_MP4_TTML:2007,INVALID_MP4_VTT:2008,BUFFER_READ_OUT_OF_BOUNDS:3e3,JS_INTEGER_OVERFLOW:3001,EBML_OVERFLOW:3002,EBML_BAD_FLOATING_POINT_SIZE:3003,MP4_SIDX_WRONG_BOX_TYPE:3004,MP4_SIDX_INVALID_TIMESCALE:3005,MP4_SIDX_TYPE_NOT_SUPPORTED:3006,WEBM_CUES_ELEMENT_MISSING:3007,WEBM_EBML_HEADER_ELEMENT_MISSING:3008,WEBM_SEGMENT_ELEMENT_MISSING:3009,WEBM_INFO_ELEMENT_MISSING:3010,WEBM_DURATION_ELEMENT_MISSING:3011,WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING:3012,WEBM_CUE_TIME_ELEMENT_MISSING:3013,MEDIA_SOURCE_OPERATION_FAILED:3014,MEDIA_SOURCE_OPERATION_THREW:3015,VIDEO_ERROR:3016,QUOTA_EXCEEDED_ERROR:3017,UNABLE_TO_GUESS_MANIFEST_TYPE:4e3,DASH_INVALID_XML:4001,DASH_NO_SEGMENT_INFO:4002,DASH_EMPTY_ADAPTATION_SET:4003,DASH_EMPTY_PERIOD:4004,DASH_WEBM_MISSING_INIT:4005,DASH_UNSUPPORTED_CONTAINER:4006,DASH_PSSH_BAD_ENCODING:4007,DASH_NO_COMMON_KEY_SYSTEM:4008,DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED:4009,DASH_CONFLICTING_KEY_IDS:4010,UNPLAYABLE_PERIOD:4011,RESTRICTIONS_CANNOT_BE_MET:4012,NO_PERIODS:4014,HLS_PLAYLIST_HEADER_MISSING:4015,INVALID_HLS_TAG:4016,HLS_INVALID_PLAYLIST_HIERARCHY:4017,DASH_DUPLICATE_REPRESENTATION_ID:4018,HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND:4020,HLS_COULD_NOT_GUESS_MIME_TYPE:4021,HLS_MASTER_PLAYLIST_NOT_PROVIDED:4022,HLS_REQUIRED_ATTRIBUTE_MISSING:4023,HLS_REQUIRED_TAG_MISSING:4024,HLS_COULD_NOT_GUESS_CODECS:4025,HLS_KEYFORMATS_NOT_SUPPORTED:4026,DASH_UNSUPPORTED_XLINK_ACTUATE:4027,DASH_XLINK_DEPTH_LIMIT:4028,HLS_LIVE_CONTENT_NOT_SUPPORTED:4029,INVALID_STREAMS_CHOSEN:5005,NO_RECOGNIZED_KEY_SYSTEMS:6e3,REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE:6001,FAILED_TO_CREATE_CDM:6002,FAILED_TO_ATTACH_TO_VIDEO:6003,INVALID_SERVER_CERTIFICATE:6004,FAILED_TO_CREATE_SESSION:6005,FAILED_TO_GENERATE_LICENSE_REQUEST:6006,LICENSE_REQUEST_FAILED:6007,LICENSE_RESPONSE_REJECTED:6008,ENCRYPTED_CONTENT_WITHOUT_DRM_INFO:6010,NO_LICENSE_SERVER_GIVEN:6012,OFFLINE_SESSION_REMOVED:6013,EXPIRED:6014,LOAD_INTERRUPTED:7e3,CAST_API_UNAVAILABLE:8e3,NO_CAST_RECEIVERS:8001,ALREADY_CASTING:8002,UNEXPECTED_CAST_ERROR:8003,CAST_CANCELED_BY_USER:8004,CAST_CONNECTION_TIMED_OUT:8005,CAST_RECEIVER_APP_UNAVAILABLE:8006,STORAGE_NOT_SUPPORTED:9e3,INDEXED_DB_ERROR:9001,OPERATION_ABORTED:9002,REQUESTED_ITEM_NOT_FOUND:9003,MALFORMED_OFFLINE_URI:9004,CANNOT_STORE_LIVE_OFFLINE:9005,STORE_ALREADY_IN_PROGRESS:9006,NO_INIT_DATA_FOR_OFFLINE:9007,LOCAL_PLAYER_INSTANCE_REQUIRED:9008,CONTENT_UNSUPPORTED_BY_BROWSER:9009};var Ws=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;zs=c.prototype,zs.ea="",zs.Aa="",zs.ja="",zs.Ia=null,zs.ba="",zs.ta="",zs.toString=function(){var t=[],e=this.ea;if(e&&t.push(m(e,Js,!0),":"),e=this.ja){t.push("//");var i=this.Aa;i&&t.push(m(i,Js,!0),"@"),t.push(encodeURIComponent(e).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e=this.Ia,null!=e&&t.push(":",String(e))}return(e=this.ba)&&(this.ja&&"/"!=e.charAt(0)&&t.push("/"),t.push(m(e,"/"==e.charAt(0)?Zs:Qs,!0))),(e=this.a.toString())&&t.push("?",e),(e=this.ta)&&t.push("#",m(e,eo)),t.join("")},zs.resolve=function(t){var e=new c(this);"data"===e.ea&&(e=new c);var i=!!t.ea;i?l(e,t.ea):i=!!t.Aa,i?e.Aa=t.Aa:i=!!t.ja,i?e.ja=t.ja:i=null!=t.Ia;var n=t.ba;if(i)f(e,t.Ia);else if(i=!!t.ba){if("/"!=n.charAt(0))if(this.ja&&!this.ba)n="/"+n;else{var r=e.ba.lastIndexOf("/");-1!=r&&(n=e.ba.substr(0,r+1)+n)}if(".."==n||"."==n)n="";else if(-1!=n.indexOf("./")||-1!=n.indexOf("/.")){for(var r=!n.lastIndexOf("/",0),n=n.split("/"),a=[],s=0;sn||i&&1e3>n)&&!this.a[e].na&&(this.a.splice(e,1),t.close()),at(this.D,.5)}},zs.$d=function(){function t(t,e){return"expired"==e}!Y(this.C)&&W(this.C,t)&&this.g(new h(2,6,6014)),this.s.Hb(this.C)},zs.Gd=function(){for(var t=0;t=this.b||(t<=this.a&&e>=this.b?this.a=this.b=null:t<=this.a&&ethis.a&&e>=this.b&&(this.b=t))}.bind(this))},Ut.prototype.parseInit=function(t){this.Ta(t,0,null,null)},Ut.prototype.parseMedia=function(t,e){return this.Ta(t,e.periodStart,e.segmentStart,e.segmentEnd)},zs=jt.prototype,zs.o=function(){this.i=!0;var t,e=[];for(t in this.c){var i=this.c[t],n=i[0];for(this.c[t]=i.slice(0,1),n&&e.push(n.p.catch(x)),n=1;n=r.bandwidth/this.a.bandwidthDowngradeTarget&&e<=a&&(i=r)}return this.f=Date.now(),i},pe.prototype.chooseVariant=pe.prototype.chooseVariant,pe.prototype.enable=function(){this.c=!0},pe.prototype.enable=pe.prototype.enable,pe.prototype.disable=function(){this.c=!1},pe.prototype.disable=pe.prototype.disable,pe.prototype.segmentDownloaded=function(t,e){var i=this.b;if(!(16e3>e)){var n=8e3*e/t,a=t/1e3;i.a+=e,r(i.b,a,n),r(i.c,a,n)}if(null!=this.f&&this.c)t:{if(this.i){if(Date.now()-this.f<1e3*this.a.switchInterval)break t}else{if(!(128e3<=this.b.a))break t;this.i=!0}i=this.chooseVariant(),this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate),this.h(i)}},pe.prototype.segmentDownloaded=pe.prototype.segmentDownloaded,pe.prototype.getBandwidthEstimate=function(){return this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate)},pe.prototype.getBandwidthEstimate=pe.prototype.getBandwidthEstimate,pe.prototype.setVariants=function(t){this.g=t},pe.prototype.setVariants=pe.prototype.setVariants,pe.prototype.configure=function(t){this.a=t},pe.prototype.configure=pe.prototype.configure;var ho="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),co="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),lo=["loop","playbackRate"],fo=["pause","play"],po="adaptation buffering emsg error loading streaming texttrackvisibility timelineregionadded timelineregionenter timelineregionexit trackschanged unloading".split(" "),mo="drmInfo getAudioLanguages getBufferedInfo getConfiguration getExpiration getManifest getManifestUri getPlaybackRate getTextLanguages getTextTracks getStats getVariantTracks isAudioOnly isBuffering isInProgress isLive isTextTrackVisible keySystem seekRange".split(" "),vo=["getPlayheadTimeAsDate","getPresentationStartTimeAsDate"],go=[["getConfiguration","configure"]],bo=[["isTextTrackVisible","setTextTrackVisibility"]],yo="addTextTrack cancelTrickPlay configure resetConfiguration retryStreaming selectAudioLanguage selectTextLanguage selectTextTrack selectVariantTrack setTextTrackVisibility trickPlay".split(" "),To=["load","unload"],wo=!1,Eo=null;zs=ye.prototype,zs.o=function(){return we(this),Eo&&Te(this),this.D=this.C=this.g=null,this.b=this.h=!1,this.m=this.l=this.f=this.c=this.a=this.i=null,Promise.resolve()},zs.aa=function(){return this.b},zs.Nb=function(){return this.B},zs.init=function(){if(t.chrome&&chrome.cast&&chrome.cast.isAvailable){delete t.__onGCastApiAvailable,this.h=!0,this.g();var e=new chrome.cast.SessionRequest(this.J),e=new chrome.cast.ApiConfig(e,this.nc.bind(this),this.Id.bind(this),"origin_scoped");chrome.cast.initialize(e,function(){},function(){}),wo&&setTimeout(this.g.bind(this),20),(e=Eo)&&e.status!=chrome.cast.SessionStatus.STOPPED?this.nc(e):Eo=null}else t.__onGCastApiAvailable=function(t){t&&this.init()}.bind(this)},zs.Rb=function(t){this.i=t,this.b&&Ee({type:"appData",appData:this.i})},zs.cast=function(t){return this.h?wo?this.b?Promise.reject(new h(1,8,8002)):(this.f=new y,chrome.cast.requestSession(this.Jb.bind(this,t),this.lc.bind(this)),this.f):Promise.reject(new h(1,8,8001)):Promise.reject(new h(1,8,8e3))},zs.lb=function(){this.b&&(we(this),Eo&&(Te(this),Eo.stop(function(){},function(){}),Eo=null))},zs.get=function(t,e){if("video"==t){if(0<=fo.indexOf(e))return this.zc.bind(this,t,e)}else if("player"==t){if(0<=vo.indexOf(e)&&!this.get("player","isLive")())return function(){};if(0<=yo.indexOf(e))return this.zc.bind(this,t,e);if(0<=To.indexOf(e))return this.de.bind(this,t,e);if(0<=mo.indexOf(e))return this.vc.bind(this,t,e)}return this.vc(t,e)},zs.set=function(t,e,i){this.a[t][e]=i,Ee({type:"set",targetName:t,property:e,value:i})},zs.Jb=function(t,e){Eo=e,e.addUpdateListener(this.l),e.addMessageListener("urn:x-cast:com.google.shaka.v2",this.m),this.mc(),Ee({type:"init",initState:t,appData:this.i}),this.f.resolve()},zs.lc=function(t){var e=8003;switch(t.code){case"cancel":e=8004;break;case"timeout":e=8005;break;case"receiver_unavailable":e=8006}this.f.reject(new h(2,8,e,t))},zs.vc=function(t,e){return this.a[t][e]},zs.zc=function(t,e){Ee({type:"call",targetName:t,methodName:e,args:Array.prototype.slice.call(arguments,2)})},zs.de=function(t,e){var i=Array.prototype.slice.call(arguments,2),n=new y,r=this.s.toString();return this.s++,this.c[r]=n,Ee({type:"asyncCall",targetName:t,methodName:e,args:i,id:r}),n},zs.nc=function(t){var e=this.w();this.f=new y,this.j=!0,this.Jb(e,t)},zs.Id=function(t){wo="available"==t,this.g()},zs.mc=function(){var t=!!Eo&&"connected"==Eo.status;if(this.b&&!t){this.D();for(var e in this.a)this.a[e]={};we(this)}this.B=(this.b=t)?Eo.receiver.friendlyName:"",this.g()},zs.Cd=function(t,e){var i=ge(e);switch(i.type){case"event":var n=i.targetName,r=i.event;this.C(n,new G(r.type,r));break;case"update":r=i.update;for(n in r){var i=this.a[n]||{};for(a in r[n])i[a]=r[n][a]}this.j&&(this.L(),this.j=!1);break;case"asyncComplete":n=i.id;var a=i.error;if(i=this.c[n],delete this.c[n],i)if(a){n=new h(a.severity,a.category,a.code);for(r in a)n[r]=a[r];i.reject(n)}else i.resolve()}},Se.prototype.addEventListener=function(t,e){this.vb.push(t,e)},Se.prototype.removeEventListener=function(t,e){this.vb.remove(t,e)},Se.prototype.dispatchEvent=function(t){for(var e=this.vb.get(t.type)||[],i=0;ithis.O.byteLength&&ni();var e=ri(this,this.v,this.v+t);return this.v+=t,new Uint8Array(e)},ii.prototype.readBytes=ii.prototype.Ja,ii.prototype.I=function(t){this.v+t>this.O.byteLength&&ni(),this.v+=t},ii.prototype.skip=ii.prototype.I,ii.prototype.Lb=function(){for(var t=this.v;this.da()&&this.O.getUint8(this.v);)this.v+=1;return t=ri(this,t,this.v),this.v+=1,Z(t)},ii.prototype.readTerminatedString=ii.prototype.Lb,e("shaka.util.Mp4Parser",ai),ai.prototype.G=function(t,e){var i=hi(t);return this.b[i]=0,this.a[i]=e,this},ai.prototype.box=ai.prototype.G,ai.prototype.ca=function(t,e){var i=hi(t);return this.b[i]=1,this.a[i]=e,this},ai.prototype.fullBox=ai.prototype.ca,ai.prototype.parse=function(t){for(t=new ii(new DataView(t),0);t.da();)this.qb(0,t)},ai.prototype.parse=ai.prototype.parse,ai.prototype.qb=function(t,e){var i=e.v,n=e.F(),r=e.F();switch(n){case 0:n=e.O.byteLength-i;break;case 1:n=e.Va()}var a=this.a[r];if(a){var s=null,o=null;1==this.b[r]&&(o=e.F(),s=o>>>24,o&=16777215),r=i+n-e.v,r=0=i.startTime&&tt||t>=this.a.length?null:this.a[t]):null},fi.prototype.get=fi.prototype.get,fi.prototype.ob=function(t){for(var e,i,n,r=[],a=e=0;en.startTime?e||r.push(n):(.1t);++e);this.a.splice(0,e)},fi.prototype.evict=fi.prototype.xb;var Io;pi.prototype.da=function(){return this.a.da()},yi.prototype.parse=function(t,e,i,n){var r;if(e=new pi(new DataView(e)),440786851!=mi(e).id)throw new h(2,3,3008);var a=mi(e);if(408125543!=a.id)throw new h(2,3,3009);for(e=a.a.byteOffset,a=new pi(a.a),r=null;a.da();){var s=mi(a);if(357149030==s.id){r=s;break}}if(!r)throw new h(2,3,3010);for(a=new pi(r.a),r=1e6,s=null;a.da();){var o=mi(a);if(2807729==o.id)r=bi(o);else if(17545==o.id)if(s=o,4==s.a.byteLength)s=s.a.getFloat32(0);else{if(8!=s.a.byteLength)throw new h(2,3,3003);s=s.a.getFloat64(0)}}if(null==s)throw new h(2,3,3011);if(a=r/1e9,r=s*a,t=mi(new pi(new DataView(t))),475249515!=t.id)throw new h(2,3,3007);return Ti(t,e,a,r,i,n)};var Po={},_o={};e("shaka.media.ManifestParser.registerParserByExtension",function(t,e){_o[t]=e}),e("shaka.media.ManifestParser.registerParserByMime",function(t,e){Po[t]=e}),e("shaka.media.PresentationTimeline",Ui),Ui.prototype.W=function(){return this.a},Ui.prototype.getDuration=Ui.prototype.W,Ui.prototype.ga=function(t){this.a=t},Ui.prototype.setDuration=Ui.prototype.ga,Ui.prototype.gd=function(){return this.c},Ui.prototype.getPresentationStartTime=Ui.prototype.gd,Ui.prototype.Gc=function(t){this.i=t},Ui.prototype.setClockOffset=Ui.prototype.Gc,Ui.prototype.rb=function(t){this.h=t},Ui.prototype.setStatic=Ui.prototype.rb,Ui.prototype.jd=function(){return this.f},Ui.prototype.getSegmentAvailabilityDuration=Ui.prototype.jd,Ui.prototype.Ic=function(t){this.f=t},Ui.prototype.setSegmentAvailabilityDuration=Ui.prototype.Ic,Ui.prototype.Hc=function(t){this.j=t},Ui.prototype.setDelay=Ui.prototype.Hc,Ui.prototype.Ga=function(t,e){e.length&&(this.b=e.reduce(function(t,e){return Math.max(t,e.endTime-e.startTime)},this.b))},Ui.prototype.notifySegments=Ui.prototype.Ga,Ui.prototype.Eb=function(t){this.b=Math.max(this.b,t)},Ui.prototype.notifyMaxSegmentDuration=Ui.prototype.Eb,Ui.prototype.R=function(){return 1/0==this.a&&!this.h},Ui.prototype.isLive=Ui.prototype.R,Ui.prototype.va=function(){return 1/0!=this.a&&!this.h},Ui.prototype.isInProgress=Ui.prototype.va,Ui.prototype.ka=function(){return this.Da(0)},Ui.prototype.getSegmentAvailabilityStart=Ui.prototype.ka,Ui.prototype.Da=function(t){if(1/0==this.f)return this.g;var e=this.ua();return Math.max(this.g,Math.min(e-this.f+t,e))},Ui.prototype.getSafeAvailabilityStart=Ui.prototype.Da,Ui.prototype.Fc=function(t){this.g=t},Ui.prototype.setAvailabilityStart=Ui.prototype.Fc,Ui.prototype.ua=function(){return this.R()||this.va()?Math.min(Math.max(0,(Date.now()+this.i)/1e3-this.b-this.c),this.a):this.a},Ui.prototype.getSegmentAvailabilityEnd=Ui.prototype.ua,Ui.prototype.nb=function(){return Math.max(0,this.ua()-(this.R()||this.va()?this.j:0))},Ui.prototype.getSeekRangeEnd=Ui.prototype.nb,e("shaka.dash.DashParser",ji),zs=ji.prototype,zs.configure=function(t){this.b=t},zs.start=function(t,e){return this.g=[t],this.a=e,Bi(this).then(function(){return this.a&&Xi(this,0),this.c}.bind(this))},zs.stop=function(){return this.b=this.a=null,this.g=[],this.c=null,this.i=[],this.j={},null!=this.f&&(t.clearTimeout(this.f),this.f=null),Promise.resolve()},zs.update=function(){Bi(this).catch(function(t){this.a&&this.a.onError(t)}.bind(this))},zs.onExpirationUpdated=function(){},zs.Td=function(t,e){t.V=Yi(e,t.Y,null);var i=!1,n=Le(e,"Role"),r=n.map(function(t){return t.getAttribute("value")}).filter(R),a=void 0;"text"==t.V.contentType&&(a="subtitle");for(var s=0;si.length||"data"!=i[0])throw new h(2,1,1004,e);if(i=i.slice(1).join(":").split(","),2>i.length)throw new h(2,1,1004,e);var n=i[0],i=t.decodeURIComponent(i.slice(1).join(",")),n=n.split(";"),r=null;if(1this.i?0:this.i;this.a.playbackRate&&this.a.playbackRate!=t&&Yn(this,this.a.playbackRate)},zs.pc=function(){var t=Xn(this);this.b.ha(this.a,"timeupdate"),this.g.cancel(),.001>Math.abs(this.a.currentTime-t)?(F(this.b,this.a,"seeking",this.sc.bind(this)),F(this.b,this.a,"playing",this.qc.bind(this))):(V(this.b,this.a,"seeking",this.Jd.bind(this)),this.a.currentTime=t)},zs.Jd=function(){F(this.b,this.a,"seeking",this.sc.bind(this)),F(this.b,this.a,"playing",this.qc.bind(this))},zs.rc=function(){if(this.a.readyState&&!this.a.paused){this.a.readyState!=this.D&&(this.s=!1,this.D=this.a.readyState);var t=this.l.smallGapLimit,e=this.a.currentTime,i=this.a.buffered;if(ei.end(0)-i.start(0))){var n=.1;/(Edge\/|Trident\/|Tizen)/.test(navigator.userAgent)&&(n=.5);for(var r=0;re&&(!r||i.end(r-1)-e<=n)){n=r;break t}}n=null}if(null==n){if(3>this.a.readyState&&0=i.start(n)&&e=this.c.presentationTimeline.nb())){var a=r-e,t=a<=t,s=!1;t||this.s||(this.s=!0,a=new G("largegap",{currentTime:e,gapSize:a}),a.cancelable=!0,this.J(a),this.l.jumpLargeGaps&&!a.defaultPrevented&&(s=!0)),(t||s)&&(n&&i.end(n-1),$n(this,e,r))}}}},zs.ud=function(){this.m=zn(this,this.a.currentTime)},zs.sc=function(){this.w=!1;var t=this.a.currentTime,e=zn(this,t);.001this.a.currentTime?1:e.info.endTime=n||this.a.ended||r;this.b?(i=1*Math.max(this.g.minBufferTime||0,this.w.rebufferingGoal),(e||t>=i)&&0!=this.b&&(this.b=!1,this.l(!1))):!e&&.5>t&&1!=this.b&&(this.b=!0,this.l(!0)),this.c.forEach(this.m.bind(this,!1))},zs=er.prototype,zs.o=function(){for(var t in this.c)Pr(this.c[t]);return this.h=this.c=this.j=this.g=this.m=this.b=this.a=null,this.f=!0,Promise.resolve()},zs.configure=function(t){this.h=t,this.w=new T({maxAttempts:Math.max(t.retryParameters.maxAttempts,2),baseDelay:t.retryParameters.baseDelay,backoffFactor:t.retryParameters.backoffFactor,fuzzFactor:t.retryParameters.fuzzFactor,timeout:0},!0)},zs.init=function(){var t=qn(this.a.Ua),t=this.a.kc(this.b.periods[fe(this.b,t)]);return t.variant||t.text?cr(this,t).then(function(){this.a&&this.a.yd&&this.a.yd()}.bind(this)):Promise.reject(new h(2,5,5005))},zs.Ce=function(t){if(!this.f&&!t.xa&&null!=t.qa&&!t.sa)if(t.qa=null,t.ra)kr(this,t,t.tb);else{try{var e=pr(this,t);null!=e&&(Ir(this,t,e),t.Qa=!1)}catch(t){return void _r(this,t)}e=z(this.c),Er(this,t),e.every(function(t){return t.endOfStream})&&this.a.M.endOfStream().then(function(){this.b.presentationTimeline.ga(this.a.M.W())}.bind(this))}},zs.Ud=function(t,e,i){var n=i.u.Lb(),r=i.u.Lb(),a=i.u.F(),s=i.u.F(),o=i.u.F(),u=i.u.F();i=i.u.Ja(i.u.O.byteLength-i.u.v),t=t.startTime+e.startTime+s/a,"urn:mpeg:dash:event:2012"==n?this.a.Ad():this.a.onEvent(new G("emsg",{detail:{startTime:t,endTime:t+o/a,schemeIdUri:n,value:r,timescale:a,presentationTimeDelta:s,eventDuration:o,id:u,messageData:i}}))},e("shaka.net.HttpPlugin",xr),io.http=xr,io.https=xr,zs=Rr.prototype,zs.init=function(t,e){return Mr(this,t,e).then(function(){var e=Object.keys(t);return Promise.all(e.map(function(t){return Lr(this,t).then(function(e){this.c[t]=e}.bind(this))}.bind(this)))}.bind(this))},zs.o=function(){return Promise.all(this.b.map(function(t){try{t.transaction.abort()}catch(t){}return t.N.catch(x)})).then(function(){this.a&&(this.a.close(),this.a=null)}.bind(this))},zs.get=function(t,e){var i;return Cr(this,t,"readonly",function(t){i=t.get(e)}).then(function(){return i.result})},zs.forEach=function(t,e){return Cr(this,t,"readonly",function(t){t.openCursor().onsuccess=function(t){(t=t.target.result)&&(e(t.value),t.continue())}})},zs.remove=function(t,e){return Cr(this,t,"readwrite",function(t){t.delete(e)})};var Co={manifest:"key",segment:"key"};Gr.prototype.o=function(){var t=this.j,e=this.l,i=this.i||Promise.resolve();return e.length&&(i=i.then(function(){return Dr(t,e)})),this.b={},this.l=[],this.i=this.a=this.w=this.s=this.j=this.m=null,i},zs=zr.prototype,zs.configure=function(){},zs.start=function(t){var e=/^offline:([0-9]+)$/.exec(t);if(!e)return Promise.reject(new h(2,1,9004,t));var i=Number(e[1]),n=Kr();return this.a=i,n?n.init(Co).then(function(){return n.get("manifest",i)}).then(function(t){if(!t)throw new h(2,9,9003,i);return $r(t)}).then(function(t){return n.o().then(function(){return t})},function(t){return n.o().then(function(){throw t})}):Promise.reject(new h(2,9,9e3))},zs.stop=function(){return Promise.resolve()},zs.update=function(){},zs.onExpirationUpdated=function(t,e){var i=Kr();i.init(Co).then(function(){return i.get("manifest",this.a)}.bind(this)).then(function(n){if(n&&!(0>n.sessionIds.indexOf(t))&&(void 0==n.expiration||n.expiration>e))return n.expiration=e,Nr(i,"manifest",n)}).catch(function(){}).then(function(){return i.o()})},Po["application/x-offline-manifest"]=zr,e("shaka.offline.OfflineScheme",Wr),io.offline=Wr,e("shaka.text.SimpleTextDisplayer",Jr),Jr.prototype.remove=function(t,e){return!!this.a&&(Zr(this,function(i){return!(i.startTime>=e||i.endTime<=t)}),!0)},Jr.prototype.remove=Jr.prototype.remove,Jr.prototype.append=function(t){for(var e=[],i=0;ithis.eb.indexOf(t.id)}.bind(this))},ia.prototype.getTextTracks=ia.prototype.ld,ia.prototype.me=function(t){if(this.a){(t=re(ir(this.a),t))&&(ha(this,t,!1),this.Ba?this.X=t:or(this.a,t,!0))}},ia.prototype.selectTextTrack=ia.prototype.me,ia.prototype.ne=function(t,e){if(this.a){this.c.abr.enabled&&o("Changing tracks while abr manager is enabled will likely result in the selected track being overriden. Consider disabling abr before calling selectVariantTrack().");var i=ir(this.a);(i=ne(i,t))&&i.allowedByApplication&&i.allowedByKeySystem&&(ua(this,i,!1),va(this,i,e))}},ia.prototype.selectVariantTrack=ia.prototype.ne,ia.prototype.Zc=function(){return this.a?ae(ir(this.a).variants).map(function(t){return t.language}).filter(N):[]},ia.prototype.getAudioLanguages=ia.prototype.Zc,ia.prototype.kd=function(){return this.a?ir(this.a).textStreams.map(function(t){return t.language}).filter(N):[]},ia.prototype.getTextLanguages=ia.prototype.kd,ia.prototype.ke=function(t,e){if(this.a){var i=ir(this.a);this.Ma=t,this.ab=e||"",Ta(this,i)}},ia.prototype.selectAudioLanguage=ia.prototype.ke,ia.prototype.le=function(t,e){if(this.a){var i=ir(this.a);this.$a=t,this.ub=e||"",Ta(this,i)}},ia.prototype.selectTextLanguage=ia.prototype.le,ia.prototype.rd=function(){return this.w?this.w.isTextVisible():this.jb},ia.prototype.isTextTrackVisible=ia.prototype.rd,ia.prototype.qe=function(t){this.w?this.w.setTextVisibility(t):this.jb=t,Sa(this)},ia.prototype.setTextTrackVisibility=ia.prototype.qe,ia.prototype.ed=function(){return this.b?new Date(1e3*this.b.presentationTimeline.c+1e3*this.f.currentTime):null},ia.prototype.getPlayheadTimeAsDate=ia.prototype.ed,ia.prototype.hd=function(){return this.b?new Date(1e3*this.b.presentationTimeline.c):null},ia.prototype.getPresentationStartTimeAsDate=ia.prototype.hd,ia.prototype.yb=function(){return this.J?this.J.yb():{total:[],audio:[],video:[],text:[]}},ia.prototype.getBufferedInfo=ia.prototype.yb,ia.prototype.getStats=function(){ga(this),this.Za();var t=null,e=null,i=this.f,i=i&&i.getVideoPlaybackQuality?i.getVideoPlaybackQuality():{};return this.h&&this.b&&(t=fe(this.b,qn(this.h)),e=this.C[t],e=le(e.audio,e.video,this.b.periods[t].variants),t=e.video||{}),t||(t={}),e||(e={}),{width:t.width||0,height:t.height||0,streamBandwidth:e.bandwidth||0,decodedFrames:Number(i.totalVideoFrames),droppedFrames:Number(i.droppedVideoFrames),estimatedBandwidth:this.g?this.g.getBandwidthEstimate():NaN,loadLatency:this.j.loadLatency,playTime:this.j.playTime,bufferingTime:this.j.bufferingTime,switchHistory:I(this.j.switchHistory),stateHistory:I(this.j.stateHistory)}},ia.prototype.getStats=ia.prototype.getStats,ia.prototype.addTextTrack=function(t,e,i,n,r,a){if(!this.a)return Promise.reject();for(var s,o=ir(this.a),u=0;uae(t.variants).length)throw new h(2,4,4012)}.bind(this))},zs.kb=function(t){var e=this.a?rr(this.a):{};if(Zt(this.l,e,t),e=0ae(t.variants).length,!e)throw new h(2,4,4011);if(t)throw new h(2,4,4012)},zs.ue=function(t,e){this.g&&this.g.segmentDownloaded(t,e)},zs.Jc=function(t){if(ga(this),this.Oa=t,this.Za(),this.h){var e=this.h;t!=e.j&&(e.j=t,Yn(e,e.i))}this.dispatchEvent(new G("buffering",{buffering:t}))},zs.se=function(){Ea(this)},zs.Za=function(){if(!this.D){var t=this.Oa?"buffering":this.f.ended?"ended":this.f.paused?"paused":"playing",e=Date.now()/1e3;if(this.j.stateHistory.length){var i=this.j.stateHistory[this.j.stateHistory.length-1];if(i.duration=e-i.timestamp,t==i.state)return}this.j.stateHistory.push({timestamp:e,state:t,duration:0})}},zs.te=function(){if(this.B){var t=this.B;t.c.forEach(t.m.bind(t,!0))}this.a&&ur(this.a)},zs.td=function(t){this.Ba=!0,this.g.disable();var e={audio:!1,text:!1},i=se(t,this.Ma,this.ab,e);return t=oe(t,this.$a,this.ub,e),i=ya(this,i),t=t[0]||null,this.X=this.Na=null,i&&ua(this,i,!0),t&&(ha(this,t,!0),!nr(this.a)&&i&&i.audio&&e.text&&t.language!=i.audio.language&&(this.w.setTextVisibility(!0),Sa(this))),{variant:i,text:t}},zs.Rc=function(){this.Ba=!1,this.c.abr.enabled&&this.g.enable(),this.Na&&(sr(this.a,this.Na,this.Yb),this.Na=null),this.X&&(or(this.a,this.X,!0),this.X=null)},zs.Bd=function(){this.i&&this.i.update&&this.i.update()},zs.Kd=function(){this.h&&this.h.Ib()},zs.Kc=function(t,e){ua(this,t,!0),this.a&&(sr(this.a,t,e||!1),wa(this))},zs.Fe=function(t,e){if(this.a){var i=nr(this.a);(i=ce(t.audio,t.video,i?i.variants:[]))&&this.Kc(i,e)}},zs.La=function(t){if(!this.D){var e=new G("error",{detail:t});this.dispatchEvent(e),e.defaultPrevented&&(t.handled=!0)}},zs.Nd=function(t){this.B?this.B.s(t):this.hb.push(t)},zs.Ya=function(t){this.dispatchEvent(t)},zs.Od=function(){if(this.f.error){var t=this.f.error.code;if(1!=t){var e=this.f.error.msExtendedCode;e&&(0>e&&(e+=Math.pow(2,32)),e=e.toString(16)),this.La(new h(2,3,3016,t,e,this.f.error.message))}}},zs.zd=function(t){var e=["output-restricted","internal-error"],i=ir(this.a),n=!1,r=1==Object.keys(t).length&&"00"==Object.keys(t)[0];i.variants.forEach(function(i){var a=[];i.audio&&a.push(i.audio),i.video&&a.push(i.video),a.forEach(function(a){var s=i.allowedByKeySystem;a.keyId&&(a=t[r?"00":a.keyId],i.allowedByKeySystem=!!a&&0>e.indexOf(a)),s!=i.allowedByKeySystem&&(n=!0)})});var a=rr(this.a);(a=ce(a.audio,a.video,i.variants))&&!a.allowedByKeySystem&&Ta(this,i),n&&Ea(this)},zs.wd=function(t,e){this.i&&this.i.onExpirationUpdated&&this.i.onExpirationUpdated(t,e),this.dispatchEvent(new G("expirationupdated"))},e("shaka.offline.Storage",Aa),Aa.support=ka,Aa.prototype.o=function(){var t=this.a,e=this.i?this.i.o().catch(function(){}).then(function(){if(t)return t.o()}):Promise.resolve();return this.b=this.g=this.i=this.a=null,e},Aa.prototype.destroy=Aa.prototype.o,Aa.prototype.configure=function(t){k(this.b,t,Pa(this),{},"")},Aa.prototype.configure=Aa.prototype.configure,Aa.prototype.De=function(t,e,i){function n(t){a=t}if(this.s)return Promise.reject(new h(2,9,9006));this.s=!0;var r,a=null;return _a(this).then(function(){return Da(this),Ia(this,t,n,i)}.bind(this)).then(function(i){if(Da(this),this.f=i.manifest,this.c=i.Wc,this.f.presentationTimeline.R()||this.f.presentationTimeline.va())throw new h(2,9,9005,t);this.m(this.f.periods),this.h=this.a.c.manifest++,this.l=0,i=e||{};var n=this.f.periods.map(this.C.bind(this)),a=this.c.b,s=vt(this.c);if(a){if(!s.length)throw new h(2,9,9007,t);a.initData=[]}return r={key:this.h,originalManifestUri:t,duration:this.l,size:0,expiration:this.c.mb(),periods:n,sessionIds:this.b.usePersistentLicense?s:[],drmInfo:a,appMetadata:i},Xr(this.i,r)}.bind(this)).then(function(){if(Da(this),a)throw a;return xa(this)}.bind(this)).then(function(){return Ur(r)}.bind(this)).catch(function(t){return xa(this).catch(x).then(function(){throw t})}.bind(this))},Aa.prototype.store=Aa.prototype.De,Aa.prototype.remove=function(t){function e(t){6013!=t.code&&(s=t)}var i=t.offlineUri,n=/^offline:([0-9]+)$/.exec(i);if(!n)return Promise.reject(new h(2,9,9004,i));var r,a,s=null,o=Number(n[1]);return _a(this).then(function(){return Da(this),this.a.get("manifest",o)}.bind(this)).then(function(t){if(Da(this),!t)throw new h(2,9,9003,i);return r=t,t=$r(r),a=new ft({Sa:this.g.s,onError:e,Hb:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),a.configure(this.g.getConfiguration().drm),a.init(t,this.b.usePersistentLicense||!1)}.bind(this)).then(function(){return pt(a,r.sessionIds)}.bind(this)).then(function(){return a.o()}.bind(this)).then(function(){if(Da(this),s)throw s;var e=r.periods.map(function(t){return t.streams.map(function(t){var e=t.segments.map(function(t){return t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t.uri),Number(t[1])});return t.initSegmentUri&&(t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t.initSegmentUri),e.push(Number(t[1]))),e}).reduce(_,[])}).reduce(_,[]),i=0,n=e.length,a=this.b.progressCallback;return Dr(this.a,e,function(){i++,a(t,i/n)})}.bind(this)).then(function(){return Da(this),this.b.progressCallback(t,1),this.a.remove("manifest",o)}.bind(this))},Aa.prototype.remove=Aa.prototype.remove,Aa.prototype.list=function(){var t=[];return _a(this).then(function(){return Da(this),this.a.forEach("manifest",function(e){t.push(Ur(e))})}.bind(this)).then(function(){return t})},Aa.prototype.list=Aa.prototype.list,Aa.prototype.B=function(t){for(var e,i=[],n=Wt(this.g.getConfiguration().preferredAudioLanguage),r=[0,so,oo],a=t.filter(function(t){return"variant"==t.type}),r=r.map(function(t){return a.filter(function(e){return e=Wt(e.language),$t(t,n,e)})}),s=0;s=t.height});return o.length&&(o.sort(function(t,e){return e.height-t.height}),e=o.filter(function(t){return t.height==o[0].height})),e.sort(function(t,e){return t.bandwidth-e.bandwidth}),e.length&&i.push(e[Math.floor(e.length/2)]),i.push.apply(i,t.filter(function(t){return"text"==t.type})),i},Aa.prototype.m=function(t){t.forEach(this.w.bind(this))},Aa.prototype.w=function(t){var e={};if(this.j){var i=this.j.filter(function(t){return"variant"==t.type}),n=null;i.length&&(n=ne(t,i[0])),n&&(n.video&&(e.video=n.video),n.audio&&(e.audio=n.audio))}Zt(this.c,e,t),Qt(t,this.g.getConfiguration().restrictions,{width:1/0,height:1/0})},Aa.prototype.C=function(t){var e,i,n=ee(t,null,null),r=ie(t,null),n=this.b.trackSelectionCallback(n.concat(r));for(this.j||(this.j=n,this.m(this.f.periods)),r=n.length-1;0navigator.userAgent.indexOf("Trident/")||HTMLInputElement.prototype.addEventListener==Ma||(Uo=HTMLInputElement.prototype.addEventListener,HTMLInputElement.prototype.addEventListener=Ma)}),La(function(){if(4503599627370497!=Math.round(4503599627370497)){var t=Math.round;Math.round=function(e){var i=e;return 4503599627370496>=e&&(i=t(e)),i}}}),Oa.prototype.c=function(t){if(!(1s[0].indexOf("--\x3e")&&(u=s[0],s.splice(0,1));var c=new un(s[0]),l=Gs(c),f=hn(c,/[ \t]+--\x3e[ \t]+/g),d=Gs(c);if(null==l||!f||null==d)throw new h(2,2,2001);for(s=new xs(l+o,d+o,s.slice(1).join("\n").trim()),hn(c,/[ \t]+/gm),o=cn(c);o;)Ks(s,o),hn(c,/[ \t]+/gm),o=cn(c);null!=u&&(s.id=u),u=s}u&&a.push(u)}return a},Mt("text/vtt",Hs),Mt('text/vtt; codecs="vtt"',Hs),qs.prototype.parseInit=function(t){var e=!1;if((new ai).G("moov",si).G("trak",si).G("mdia",si).ca("mdhd",function(t){0==t.version?(t.u.I(4),t.u.I(4),this.a=t.u.F(),t.u.I(4)):(t.u.I(8),t.u.I(8),this.a=t.u.F(),t.u.I(8)),t.u.I(4)}.bind(this)).G("minf",si).G("stbl",si).ca("stsd",oi).G("wvtt",function(){e=!0}).parse(t),!this.a)throw new h(2,2,2008);if(!e)throw new h(2,2,2008)},qs.prototype.parseMedia=function(t,e){var i=0,n=[],r=[],a=[],s=!1,o=!1,u=!1,c=null;if((new ai).G("moof",si).G("traf",si).ca("tfdt",function(t){s=!0,i=t.version?t.u.Va():t.u.F()}).ca("tfhd",function(t){var e=t.ec;t=t.u,t.I(4),1&e&&t.I(8),2&e&&t.I(4),c=8&e?t.F():null}).ca("trun",function(t){o=!0;var e=t.version,i=t.ec;t=t.u;var r=t.F();1&i&&t.I(4),4&i&&t.I(4);for(var a=[],s=0;s1&&void 0!==arguments[1]?arguments[1]:"";c.default.polyfill.installAll();var i=c.default.Player.isBrowserSupported(),n=t.split("?")[0].match(/.*\.(.*)$/)||[];return i&&("mpd"===n[1]||e.indexOf("application/dash+xml")>-1)}},{key:"Events",get:function(){return{SHAKA_READY:"shaka:ready"}}}]),o(e,[{key:"play",value:function(){if(this._player||this._setup(),!this.isReady)return void this.once(e.Events.SHAKA_READY,this.play);this._stopped=!1,this._src=this.el.src,s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"play",this).call(this)}},{key:"setupSrc",value:function(){}},{key:"_ready",value:function(){}},{key:"_onShakaReady",value:function(){this._isShakaReadyState=!0,this.trigger(e.Events.SHAKA_READY),this.trigger(u.Events.PLAYBACK_READY,this.name)}},{key:"error",value:function(t){u.Log.error("an error was raised by the video tag",t,this.el.error)}},{key:"isHighDefinitionInUse",value:function(){return!1}},{key:"stop",value:function(){var t=this;clearInterval(this.sendStatsId),this._stopped=!0,this._player?(this._sendStats(),this._player.unload().then(function(){s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",t).call(t),t._player=null,t._isShakaReadyState=!1}).catch(function(){u.Log.error("shaka could not be unloaded")})):s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this)}},{key:"getPlaybackType",value:function(){return(this.isReady&&this._player.isLive()?"live":"vod")||""}},{key:"selectAudioLanguage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._player.selectAudioLanguage(t,e)}},{key:"selectTrack",value:function(t){if("text"===t.type)this._player.selectTextTrack(t);else{if("variant"!==t.type)throw new Error("Unhandled track type:",t.type);this._player.selectVariantTrack(t),t.mimeType.startsWith("video/")&&this._onAdaptation()}}},{key:"_enableShakaTextTrack",value:function(t){this.el.textTracks&&(this._shakaTTVisible=t,Array.from(this.el.textTracks).filter(function(t){return"subtitles"===t.kind}).forEach(function(e){return e.mode=!0===t?"showing":"hidden"}))}},{key:"_checkForClosedCaptions",value:function(){if(!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(u.Events.PLAYBACK_SUBTITLE_AVAILABLE);var t=this.closedCaptionsTrackId;this.closedCaptionsTrackId=t}this._ccIsSetup=!0}}},{key:"destroy",value:function(){var t=this;clearInterval(this.sendStatsId),this._player?this._player.destroy().then(function(){return t._destroy()}).catch(function(){t._destroy(),u.Log.error("shaka could not be destroyed")}):this._destroy()}},{key:"_setup",value:function(){var t=this;this._isShakaReadyState=!1,this._ccIsSetup=!1,this._player=this._createPlayer(),this._options.shakaConfiguration&&this._player.configure(this._options.shakaConfiguration),this._options.shakaOnBeforeLoad&&this._options.shakaOnBeforeLoad(this._player),this._player.load(this._options.src).then(function(){return t._loaded()}).catch(function(e){return t._setupError(e)})}},{key:"_createPlayer",value:function(){var t=new c.default.Player(this.el);return t.addEventListener("error",this._onError.bind(this)),t.addEventListener("adaptation",this._onAdaptation.bind(this)),t.addEventListener("buffering",this._onBuffering.bind(this)),t}},{key:"_onBuffering",value:function(t){if(!this._stopped){var e=t.buffering?u.Events.PLAYBACK_BUFFERING:u.Events.PLAYBACK_BUFFERFULL;this.trigger(e)}}},{key:"_loaded",value:function(){this._onShakaReady(),this._startToSendStats(),this._fillLevels(),this._checkForClosedCaptions()}},{key:"_fillLevels",value:function(){0===this._levels.length&&(this._levels=this.videoTracks.slice(0).reverse(),this.trigger(u.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels))}},{key:"_startToSendStats",value:function(){var t=this,e=this._options.shakaSendStatsInterval||3e4;this.sendStatsId=setInterval(function(){return t._sendStats()},e)}},{key:"_sendStats",value:function(){this.trigger(u.Events.PLAYBACK_STATS_ADD,this._player.getStats())}},{key:"_setupError",value:function(t){this._onError(t)}},{key:"_onError",value:function(t){var e=this;u.Log.error("Shaka error event:",t.detail),this.trigger(u.Events.PLAYBACK_ERROR,t,this.name),2==t.detail.severity&&1002==t.detail.code&&(console.log("retrying"),this.stop(),setTimeout(function(){return e.play()},1e3))}},{key:"_onAdaptation",value:function(){var t=this.videoTracks.filter(function(t){return!0===t.active})[0];this._fillLevels(),this._sendStats(),this._pendingAdaptationEvent_&&(this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END),this._pendingAdaptationEvent=!1),u.Log.debug("an adaptation has happened:",t),this.trigger(u.Events.PLAYBACK_BITRATE,{bandwidth:t.bandwidth,language:t.language,width:t.width,height:t.height,level:t.id})}},{key:"_destroy",value:function(){s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this),this._isShakaReadyState=!1,u.Log.debug("shaka was destroyed")}},{key:"isReady",get:function(){return this._isShakaReadyState}},{key:"textTracks",get:function(){return this.isReady&&this._player.getTextTracks()}},{key:"audioLanguages",get:function(){return this.isReady&&this._player.getAudioLanguages()}},{key:"audioTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("audio/")})}},{key:"videoTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("video/")})}},{key:"closedCaptionsTracks",get:function(){var t=0,e=function(){return t++};return(this.textTracks||[]).filter(function(t){return"subtitle"===t.kind}).map(function(t){return{id:e(),name:t.label||t.language,track:t}})}},{key:"closedCaptionsTrackId",get:function(){return s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"closedCaptionsTrackId",this)},set:function(t){if(this._player){var e=this.closedCaptionsTracks,i=void 0;if(-1!==t){if(!(i=e.find(function(e){return e.id===t})))return void u.Log.warn('Track id "'+t+'" not found');if(this._shakaTTVisible&&!0===i.track.active)return void u.Log.info('Track id "'+t+'" already showing')}i?(this._player.selectTextTrack(i.track),this._enableShakaTextTrack(!0)):this._enableShakaTextTrack(!1),this._ccTrackId=t,this.trigger(u.Events.PLAYBACK_SUBTITLE_CHANGED,{id:t})}}}]),e}(u.HTML5Video);e.default=l,t.exports=e.default},function(e,i){e.exports=t},function(t,e,i){var n;!function(){var r={};(function(t){function e(t,e){var i=t.split("."),n=$s;i[0]in n||!n.execScript||n.execScript("var "+i[0]);for(var r;i.length&&(r=i.shift());)i.length||void 0===e?n=n[r]?n[r]:n[r]={}:n[r]=e}function i(t){function e(){}var i=Se;e.prototype=i.prototype,t.Te=i.prototype,t.prototype=new e,t.prototype.constructor=t,t.Re=function(t,e,n){return i.prototype[e].apply(t,Array.prototype.slice.call(arguments,2))}}function n(t){this.c=Math.exp(Math.log(.5)/t),this.b=this.a=0}function r(t,e,i){var n=Math.pow(t.c,e);i=i*(1-n)+n*t.a,isNaN(i)||(t.a=i,t.b+=e)}function a(t){return t.a/(1-Math.pow(t.c,t.b))}function s(){this.b=new n(2),this.c=new n(5),this.a=0}function o(){}function u(){}function h(t,e,i,n){this.severity=t,this.category=e,this.code=i,this.data=Array.prototype.slice.call(arguments,3),this.handled=!1}function c(t){var e;t instanceof c?(l(this,t.ea),this.Aa=t.Aa,this.ja=t.ja,d(this,t.Ia),this.ba=t.ba,f(this,b(t.a)),this.ta=t.ta):t&&(e=String(t).match(Ws))?(l(this,e[1]||"",!0),this.Aa=p(e[2]||""),this.ja=p(e[3]||"",!0),d(this,e[4]),this.ba=p(e[5]||"",!0),f(this,e[6]||"",!0),this.ta=p(e[7]||"")):this.a=new g(null)}function l(t,e,i){t.ea=i?p(e,!0):e,t.ea&&(t.ea=t.ea.replace(/:$/,""))}function d(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.Ia=e}else t.Ia=null}function f(t,e,i){e instanceof g?t.a=e:(i||(e=m(e,to)),t.a=new g(e))}function p(t,e){return t?e?decodeURI(t):decodeURIComponent(t):""}function m(t,e,i){return"string"==typeof t?(t=encodeURI(t).replace(e,v),i&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function v(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}function g(t){this.b=t||null}function b(t){var e=new g;if(e.b=t.b,t.a){var i,n={};for(i in t.a)n[i]=t.a[i].concat();e.a=n,e.c=t.c}return e}function y(){var t,e,i=new Promise(function(i,n){t=i,e=n});return i.resolve=t,i.reject=e,i}function T(t,e,i){var n=E();this.j=null==t.maxAttempts?n.maxAttempts:t.maxAttempts,this.f=null==t.baseDelay?n.baseDelay:t.baseDelay,this.i=null==t.fuzzFactor?n.fuzzFactor:t.fuzzFactor,this.h=null==t.backoffFactor?n.backoffFactor:t.backoffFactor,this.a=0,this.b=this.f,this.c=e||!1,this.g=i||null,this.c&&(this.a=1)}function w(t){if(t.a>=t.j){if(!t.c)return Promise.reject();t.a=1,t.b=t.f}var e=new y;return t.a?(S(t,e.resolve,t.b*(1+(2*Math.random()-1)*t.i)),t.b*=t.h):e.resolve(),t.a++,e}function E(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0}}function S(t,e,i){if(t.g)if(t.g()||!i)e();else{var n=Math.min(200,i);A(function(){S(this,e,i-n)}.bind(t),n)}else A(e,i)}function A(e,i){t.setTimeout(e,i)}function k(t,e,i,n,r){var a,s=r in n;for(a in e){var o=r+"."+a,u=s?n[r]:i[a];(s||a in t)&&(void 0===e[a]?void 0===u||s?delete t[a]:t[a]=u:u.constructor==Object&&e[a]&&e[a].constructor==Object?(t[a]||(t[a]=u),k(t[a],e[a],u,n,o)):typeof e[a]==typeof u&&null!=e[a]&&e[a].constructor==u.constructor&&(t[a]=e[a]))}}function I(t){function e(t){switch(typeof t){case"undefined":case"boolean":case"number":case"string":case"symbol":case"function":return t;default:if(!t)return t;if(0<=i.indexOf(t))return null;var n=t.constructor==Array;if(t.constructor!=Object&&!n)return null;i.push(t);var r,a=n?[]:{};for(r in t)a[r]=e(t[r]);return n&&(a.length=t.length),a}}var i=[];return e(t)}function P(t,e){return t.reduce(function(t,e,i){return e.catch(t.bind(null,i))}.bind(null,e),Promise.reject())}function _(t,e){return t.concat(e)}function x(){}function R(t){return null!=t}function N(t,e,i){return i.indexOf(t)==e}function D(t){this.f=!1,this.a=[],this.b=[],this.c=[],this.g=t||null}function L(t,e){return{uris:t,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:e}}function C(t,e,i,n,r,a,s){if(t.f||s())return Promise.reject();var o=new c(i.uris[r]),u=o.ea;if(u||(u=location.protocol,u=u.slice(0,-1),l(o,u),i.uris[r]=o.toString()),!(u=io[u]))return Promise.reject(new h(2,1,1e3,o));var d=Date.now();return u(i.uris[r],i,e).then(function(t){void 0==t.timeMs&&(t.timeMs=Date.now()-d);var i=Date.now(),n=Promise.resolve();return this.c.forEach(function(i){n=n.then(function(){return Promise.resolve(i(e,t))}.bind(this))}.bind(this)),n=n.catch(function(t){var e=2;throw t instanceof h&&(e=t.severity),new h(e,1,1007,t)}),n.then(function(){return t.timeMs+=Date.now()-i,t.timeMs+=a,t})}.bind(t)).catch(function(t){if(t&&1==t.severity)return r=(r+1)%i.uris.length,s()?Promise.reject():w(n).then(function(){return C(this,e,i,n,r,a,s)}.bind(this),function(){throw t});throw t}.bind(t))}function M(t,e){for(var i=[],n=0;n=t[e]}.bind(null,e);if(!e[0]&&!e[2])return tt(t,!1);if(!e[1]&&!e[3])return tt(t,!0);if(i(0)&&i(1)&&i(2)&&i(3))return Z(t);throw new h(2,2,2003)}function it(t){t=unescape(encodeURIComponent(t));for(var e=new Uint8Array(t.length),i=0;it.end(0)-t.start(0)?null:t.length?t.end(t.length-1):null}function Nt(t,e){return!(!t||!t.length||1==t.length&&1e-6>t.end(0)-t.start(0))&&(e>=t.start(0)&&e<=t.end(t.length-1))}function Dt(t,e){if(!t||!t.length||1==t.length&&1e-6>t.end(0)-t.start(0))return 0;for(var i=0,n=t.length-1;0<=n&&t.end(n)>e;--n)i+=t.end(n)-Math.max(t.start(n),e);return i}function Lt(t){if(!t)return[];for(var e=[],i=0;i=this.h&&t.startTimei.end(0)-i.start(0)?null:1==i.length&&0>i.start(0)?0:i.length?i.start(0):null;return i}function Ht(t,e){try{return t.b[e].buffered}catch(t){return null}}function Kt(t,e,i,n,r){return"text"==e?Ot(t.a,i,n,r):Xt(t,e,t.Ae.bind(t,e,i))}function Gt(t,e){return"text"==e?t.a.remove(0,1/0):Xt(t,e,t.Ac.bind(t,e,0,t.f.duration))}function qt(t,e,i,n,r){return"text"==e?(t.a.i=i,t=t.a,t.h=n,t.g=r,Promise.resolve()):Promise.all([Xt(t,e,t.Pc.bind(t,e)),Xt(t,e,t.re.bind(t,e,i)),Xt(t,e,t.oe.bind(t,e,n,r))])}function Xt(t,e,i){if(t.i)return Promise.reject();if(i={start:i,p:new y},t.c[e].push(i),1==t.c[e].length)try{i.start()}catch(n){"QuotaExceededError"==n.name?i.p.reject(new h(2,3,3017,e)):i.p.reject(new h(2,3,3015,n)),zt(t,e)}return i.p}function Yt(t,e){if(t.i)return Promise.reject();var i,n=[];for(i in t.b){var r=new y,a={start:function(t){t.resolve()}.bind(null,r),p:r};t.c[i].push(a),n.push(r),1==t.c[i].length&&a.start()}return Promise.all(n).then(function(){var t;try{e()}catch(t){var i=Promise.reject(new h(2,3,3015,t))}for(t in this.b)zt(this,t);return i}.bind(t),function(){return Promise.reject()}.bind(t))}function zt(t,e){t.c[e].shift();var i=t.c[e][0];if(i)try{i.start()}catch(n){i.p.reject(new h(2,3,3015,n)),zt(t,e)}}function $t(t,e,i){return i==e||t>=so&&i==e.split("-")[0]||t>=oo&&i.split("-")[0]==e.split("-")[0]}function Wt(t){t=t.toLowerCase().split("-");var e=uo[t[0]];return e&&(t[0]=e),t.join("-")}function Jt(t,e,i){var n=t.video;return!(n&&(n.widthe.maxWidth||n.width>i.width||n.heighte.maxHeight||n.height>i.height||n.width*n.heighte.maxPixels)||t.bandwidthe.maxBandwidth)}function Qt(t,e,i){var n=!1;return t.variants.forEach(function(t){var r=t.allowedByApplication;t.allowedByApplication=Jt(t,e,i),r!=t.allowedByApplication&&(n=!0)}),n}function Zt(t,e,i){var n=e.video,r=e.audio;for(e=0;en.indexOf(e)||i&&(t.mimeType!=i.mimeType||t.codecs.split(".")[0]!=i.codecs.split(".")[0]))}function ee(t,e,i){var n=null;return ae(t.variants).map(function(t){var r;r=t.video&&t.audio?i==t.video.id&&e==t.audio.id:t.video&&i==t.video.id||t.audio&&e==t.audio.id;var a="";t.video&&(a+=t.video.codecs),t.audio&&(""!=a&&(a+=", "),a+=t.audio.codecs,n=t.audio.label);var s=t.audio?t.audio.codecs:null,o=t.video?t.video.codecs:null,u=null;t.video?u=t.video.mimeType:t.audio&&(u=t.audio.mimeType);var h=null;t.audio?h=t.audio.kind:t.video&&(h=t.video.kind);var c=M((t.audio?t.audio.roles:[]).concat(t.video?t.video.roles:[]));return{id:t.id,active:r,type:"variant",bandwidth:t.bandwidth,language:t.language,label:n,kind:h||null,width:t.video?t.video.width:null,height:t.video?t.video.height:null,frameRate:t.video?t.video.frameRate:void 0,mimeType:u,codecs:a,audioCodec:s,videoCodec:o,primary:t.primary,roles:c,videoId:t.video?t.video.id:null,audioId:t.audio?t.audio.id:null,channelsCount:t.audio?t.audio.channelsCount:null,audioBandwidth:t.audio&&t.audio.bandwidth?t.audio.bandwidth:null,videoBandwidth:t.video&&t.video.bandwidth?t.video.bandwidth:null}})}function ie(t,e){return t.textStreams.map(function(t){return{id:t.id,active:e==t.id,type:"text",language:t.language,label:t.label,kind:t.kind,mimeType:t.mimeType,codecs:t.codecs||null,audioCodec:null,videoCodec:null,primary:t.primary,roles:t.roles,channelsCount:null,audioBandwidth:null,videoBandwidth:null}})}function ne(t,e){for(var i=0;i=t.periods[i].startTime)return i;return 0}function fe(t,e){for(var i=0;ie?"-Infinity":"Infinity":e;return n}})}function ge(t){return JSON.parse(t,function(t,e){return"NaN"==e?NaN:"-Infinity"==e?-1/0:"Infinity"==e?1/0:e&&"object"==typeof e&&"TimeRanges"==e.__type__?be(e):e})}function be(t){return{length:t.length,start:function(e){return t.start[e]},end:function(e){return t.end[e]}}}function ye(t,e,i,n,r,a){this.J=t,this.g=e,this.L=i,this.j=!1,this.C=n,this.D=r,this.w=a,this.b=this.h=!1,this.B="",this.i=null,this.l=this.mc.bind(this),this.m=this.Cd.bind(this),this.a={video:{},player:{}},this.s=0,this.c={},this.f=null}function Te(t){var e=Eo;e.removeUpdateListener(t.l),e.removeMessageListener("urn:x-cast:com.google.shaka.v2",t.m)}function we(t){for(var e in t.c){var i=t.c[e];delete t.c[e],i.reject(new h(1,7,7e3))}}function Ee(t){t=ve(t),Eo.sendMessage("urn:x-cast:com.google.shaka.v2",t,function(){},u)}function Se(){this.vb=new j,this.bb=this}function Ae(t,e,i){Se.call(this),this.c=t,this.b=e,this.i=this.g=this.f=this.j=this.h=null,this.a=new ye(i,this.ve.bind(this),this.we.bind(this),this.xe.bind(this),this.ye.bind(this),this.fc.bind(this)),ke(this)}function ke(t){t.a.init(),t.i=new B,ho.forEach(function(t){F(this.i,this.c,t,this.Me.bind(this))}.bind(t)),po.forEach(function(t){F(this.i,this.b,t,this.Yd.bind(this))}.bind(t)),t.h={};for(var e in t.c)Object.defineProperty(t.h,e,{configurable:!1,enumerable:!0,get:t.Le.bind(t,e),set:t.Ne.bind(t,e)});t.j={};for(e in t.b)Object.defineProperty(t.j,e,{configurable:!1,enumerable:!0,get:t.Xd.bind(t,e)});t.f=new Se,t.f.bb=t.h,t.g=new Se,t.g.bb=t.j}function Ie(t,e,i,n){Se.call(this),this.a=t,this.b=e,this.j={video:t,player:e},this.l=i||function(){},this.m=n||function(t){return t},this.i=!1,this.f=!0,this.h=this.g=this.c=null,Pe(this)}function Pe(e){var i=cast.receiver.CastReceiverManager.getInstance();i.onSenderConnected=e.tc.bind(e),i.onSenderDisconnected=e.tc.bind(e),i.onSystemVolumeChanged=e.Xc.bind(e),e.g=i.getCastMessageBus("urn:x-cast:com.google.cast.media"),e.g.onMessage=e.xd.bind(e),e.c=i.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),e.c.onMessage=e.Ld.bind(e),i.start(),ho.forEach(function(t){this.a.addEventListener(t,this.wc.bind(this,"video"))}.bind(e)),po.forEach(function(t){this.b.addEventListener(t,this.wc.bind(this,"player"))}.bind(e)),cast.__platform__&&cast.__platform__.canDisplayType('video/mp4; codecs="avc1.640028"; width=3840; height=2160')?e.b.Sb(3840,2160):e.b.Sb(1920,1080),e.b.addEventListener("loading",function(){this.f=!1,_e(this)}.bind(e)),e.a.addEventListener("playing",function(){this.f=!1,_e(this)}.bind(e)),e.a.addEventListener("pause",function(){_e(this)}.bind(e)),e.b.addEventListener("unloading",function(){this.f=!0,_e(this)}.bind(e)),e.a.addEventListener("ended",function(){t.setTimeout(function(){this.a&&this.a.ended&&(this.f=!0,_e(this))}.bind(this),5e3)}.bind(e))}function _e(t){Promise.resolve().then(function(){this.dispatchEvent(new G("caststatuschanged")),Ne(this,0)}.bind(t))}function xe(t,e,i){for(var n in e.player)t.b[n](e.player[n]);t.l(i),i=Promise.resolve();var r=t.a.autoplay;e.manifest&&(t.a.autoplay=!1,i=t.b.load(e.manifest,e.startTime),i.catch(function(t){this.b.dispatchEvent(new G("error",{detail:t}))}.bind(t))),i.then(function(){var t;for(t in e.video){var i=e.video[t];this.a[t]=i}for(t in e.playerAfterLoad)i=e.playerAfterLoad[t],this.b[t](i);this.a.autoplay=r,e.manifest&&(this.a.play(),Ne(this,0))}.bind(t))}function Re(t,e,i,n){t.i&&(t=ve(e),n?i.getCastChannel(n).send(t):i.broadcast(t))}function Ne(t,e,i){var n=So,n={mediaSessionId:0,playbackRate:t.a.playbackRate,playerState:t.f?n.IDLE:t.b.Oa?n.Lc:t.a.paused?n.Mc:n.Nc,currentTime:t.a.currentTime,supportedMediaCommands:15,volume:{level:t.a.volume,muted:t.a.muted}};i&&(n.media=i),Re(t,{requestId:e,type:"MEDIA_STATUS",status:[n]},t.g)}function De(t,e){var i=Le(t,e);return 1!=i.length?null:i[0]}function Le(t,e){return Array.prototype.filter.call(t.childNodes,function(t){return t.tagName==e})}function Ce(t){var e=t.firstChild;return e&&e.nodeType==Node.TEXT_NODE?t.textContent.trim():null}function Me(t,e,i,n){var r=null;return t=t.getAttribute(e),null!=t&&(r=i(t)),null==r?void 0!=n?n:null:r}function Oe(t){return t?(/^\d+\-\d+\-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t)&&(t+="Z"),t=Date.parse(t),isNaN(t)?null:Math.floor(t/1e3)):null}function Ue(t){return t&&(t=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(t))?(t=31536e3*Number(t[1]||null)+2592e3*Number(t[2]||null)+86400*Number(t[3]||null)+3600*Number(t[4]||null)+60*Number(t[5]||null)+Number(t[6]||null),isFinite(t)?t:null):null}function je(t){var e=/([0-9]+)-([0-9]+)/.exec(t);return e?(t=Number(e[1]),isFinite(t)?(e=Number(e[2]),isFinite(e)?{start:t,end:e}:null):null):null}function Be(t){return t=Number(t),t%1?null:t}function Fe(t){return t=Number(t),!(t%1)&&0(d=d||0))if(l+1=d)break;d=Math.ceil((d-f)/p)-1}else{if(1/0==u)break;if(f/r>=u)break;d=Math.ceil((u*r-f)/p)-1}0>>31,c=2147483647&c,d=n.u.F();if(n.u.I(4),1==l)throw new h(2,3,3006);r.push(new ei(r.length,s/a-e,(s+d)/a-e,function(){return i},t,t+c-1)),s+=d,t+=c}return r}function di(t){this.a=t}function fi(t,e){for(var i;t.a.length&&(i=t.a[t.a.length-1],i.startTime>=e);)t.a.pop();for(;t.a.length&&(i=t.a[0],0>=i.endTime);)t.a.shift();t.a.length&&(i=t.a[0],i.startTime=e&&!(i&1<<8-e);e++);if(8t||i&&t>=i?null:Math.floor(t/n)},getSegmentReference:function(t){var e=t*n;return 0>e||i&&e>=i?null:new ei(t,e,e+n,function(){var i=Ye(s,u,t+r,o,e*a);return q(h,[i])},0,null)}}}function Li(t,e){for(var i=[],n=0;ne.l||(e.f=t.setTimeout(e.ze.bind(e),1e3*Math.max(Math.max(3,e.l)-i,0)))}function Yi(t,e,i){e=e||{contentType:"",mimeType:"",codecs:"",containsEmsgBoxes:!1,frameRate:void 0,Fb:null},i=i||e.$;var n=Le(t,"BaseURL").map(Ce),r=t.getAttribute("contentType")||e.contentType,a=t.getAttribute("mimeType")||e.mimeType,s=t.getAttribute("codecs")||e.codecs,o=Me(t,"frameRate",He)||e.frameRate,u=!!Le(t,"InbandEventStream").length,h=Le(t,"AudioChannelConfiguration"),h=zi(h)||e.Fb;return r||(r=Qi(a,s)),{$:q(i,n),Wa:De(t,"SegmentBase")||e.Wa,pa:De(t,"SegmentList")||e.pa,Xa:De(t,"SegmentTemplate")||e.Xa,width:Me(t,"width",Ve)||e.width,height:Me(t,"height",Ve)||e.height,contentType:r,mimeType:a,codecs:s,frameRate:o,containsEmsgBoxes:u||e.containsEmsgBoxes,id:t.getAttribute("id"),Fb:h}}function zi(t){for(var e=0;e>=1;return t}}}return null}function $i(t){var e=0+(t.Wa?1:0);return e+=t.pa?1:0,(e+=t.Xa?1:0)?(1!=e&&(t.Wa&&(t.pa=null),t.Xa=null),!0):"text"==t.contentType||"application"==t.contentType}function Wi(t,e,i,n){return e=q(e,[i]),e=L(e,t.b.retryParameters),e.method=n,t.a.networkingEngine.request(0,e).then(function(t){if("HEAD"==n){if(!t.headers||!t.headers.date)return 0;t=t.headers.date}else t=Z(t.data);return t=Date.parse(t),isNaN(t)?0:t-Date.now()})}function Ji(t,e,i,n){i=i.map(function(t){return{scheme:t.getAttribute("schemeIdUri"),value:t.getAttribute("value")}});var r=t.b.dash.clockSyncUri;return n&&!i.length&&r&&i.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:r}),P(i,function(t){var i=t.value;switch(t.scheme){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":return Wi(this,e,i,"HEAD");case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":return Wi(this,e,i,"GET");case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":return t=Date.parse(i),isNaN(t)?0:t-Date.now();case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:return Promise.reject()}}.bind(t)).catch(function(){return 0})}function Qi(t,e){return ao[Q(t,e)]?"text":t.split("/")[0]}function Zi(t,e,i,n){this.uri=t,this.type=e,this.U=i,this.segments=n||null}function tn(t,e,i,n){this.id=t,this.name=e,this.a=i,this.value=n||null}function en(t,e){this.name=t,this.value=e}function nn(t,e,i){return i=i||null,(t=t.getAttribute(e))?t.value:i}function rn(t,e){this.U=e,this.uri=t}function an(t,e){return t.filter(function(t){return t.name==e})}function sn(t,e){var i=an(t,e);return i.length?i[0]:null}function on(t,e,i){return t.filter(function(t){var n=t.getAttribute("TYPE");return t=t.getAttribute("GROUP-ID"),n.value==e&&t.value==i})}function un(t){this.b=t,this.a=0}function hn(t,e){e.lastIndex=t.a;var i=(i=e.exec(t.b))?{position:i.index,length:i[0].length,he:i}:null;return t.a!=t.b.length&&i&&i.position==t.a?(t.a+=i.length,i.he):null}function cn(t){return t.a==t.b.length?null:(t=hn(t,/[^ \t\n]*/gm))?t[0]:null}function ln(){this.a=0}function dn(t,e,i){e=Z(e),e=e.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();var n=e.split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(n[0]))throw new h(2,4,4015);e=0;for(var r=[],a=1;an.position){var u=o.endTime-o.startTime,c=a,l=a+u,a=a+u;r.push(new ei(o.position,c,l,o.a,o.T,o.K))}}i=r,e.je.ob(i),i.length&&(e.Bb=i[i.length-1]),sn(t.U,"EXT-X-ENDLIST")&&(t=e.Bb.endTime,Vn(this,!1),this.a.ga(t))}.bind(t))}function bn(t,e,i){if(e=dn(t.w,e,i),0!=e.type)throw new h(2,4,4022);return yn(t,e).then(function(t){this.b.filterAllPeriods([t]),this.f&&this.a.Hc(3*this.l),this.B={presentationTimeline:this.a,periods:[t],offlineSessionIds:[],minBufferTime:0}}.bind(t))}function yn(t,e){var i=e.U,n=an(e.U,"EXT-X-MEDIA").filter(function(t){return"SUBTITLES"==Un(t,"TYPE")}.bind(t)).map(function(t){return Sn(this,t,e)}.bind(t));return Promise.all(n).then(function(t){var n=an(i,"EXT-X-STREAM-INF").map(function(t){return Tn(this,t,e)}.bind(this));return Promise.all(n).then(function(e){return e=e.reduce(_,[]),this.f||Dn(this,e),{startTime:0,variants:e,textStreams:t}}.bind(this))}.bind(t))}function Tn(t,e,i){var n=nn(e,"CODECS","avc1.42E01E,mp4a.40.2").split(","),r=e.getAttribute("RESOLUTION"),a=null,s=null,o=nn(e,"FRAME-RATE"),u=Number(Un(e,"BANDWIDTH"));if(r)var h=r.value.split("x"),a=h[0],s=h[1];var c=On(t,i);i=an(i.U,"EXT-X-MEDIA");var l=nn(e,"AUDIO"),d=nn(e,"VIDEO");if(l?i=on(i,"AUDIO",l):d&&(i=on(i,"VIDEO",d)),h=Ln("text",n)){var f=nn(e,"SUBTITLES");f&&(f=on(i,"SUBTITLES",f),f.length&&(t.g[f[0].id].stream.codecs=h)),n.splice(n.indexOf(h),1)}i=i.map(function(t){return An(this,t,n,c)}.bind(t));var p=[],m=[];return Promise.all(i).then(function(t){if(l?p=t:d&&(m=t),p.length||m.length)if(p.length)if(Un(e,"URI")==p[0].Pb){t="audio";var i=!0}else t="video";else t="audio";else i=!1,1==n.length?(t=Ln("video",n),t=r||o||t?"video":"audio"):(t="video",n=[n.join(",")]);return i?Promise.resolve():In(this,e,n,t,c)}.bind(t)).then(function(t){return t&&("audio"==t.stream.type?p=[t]:m=[t]),wn(this,p,m,u,a,s,o)}.bind(t))}function wn(t,e,i,n,r,a,s){i.forEach(function(t){(t=t.stream)&&(t.width=Number(r)||void 0,t.height=Number(a)||void 0,t.frameRate=Number(s)||void 0)}.bind(t)),e.length||(e=[null]),i.length||(i=[null]);for(var o=[],u=0;ui&&(t.c=i):(Vn(t,!0),t.c=i),t.l=Math.max(i,t.l)}}function xn(t,e){var i=null,n=0;t.f&&(i=Date.now()/1e3-e,n=3*t.l),t.a=new Ui(i,n),t.a.rb(!t.f)}function Rn(t){var e=an(t.U,"EXT-X-MAP");if(!e.length)return null;if(1=i?i-t.l.durationBackoff:e}function qn(t){return 0e.W()?e.ka():e.nb(),t.m=Gn(t,e),e}function Yn(t,e){t.f&&(t.f.cancel(),t.f=null),t.i=e,t.a.playbackRate=t.j||0>e?0:e,!t.j&&0>e&&(t.f=new rt(function(){this.a.currentTime+=e/4}.bind(t)),st(t.f,.25))}function zn(t,e){var i=Nt.bind(null,t.a.buffered),n=1*Math.max(t.c.minBufferTime||0,t.l.rebufferingGoal),r=t.c.presentationTimeline,a=r.ua(),s=r.Da(n),o=r.Da(5),n=r.Da(n+5);return e>=r.W()?Gn(t,e):e>a?a:e=s||i(e)?e:n}function $n(t,e,i){t.a.currentTime=i;var n=0,r=function(){!this.a||10<=n++||this.a.currentTime!=e||(this.a.currentTime=i,setTimeout(r,100))}.bind(t);setTimeout(r,100)}function Wn(t,e){var i=t.c.presentationTimeline.ka();return ei?i:e)}function Jn(t,e,i,n,r,a,s){this.a=t,this.B=e,this.g=i,this.w=n,this.l=r,this.h=a,this.C=s,this.c=[],this.j=new B,this.b=!1,this.i=-1,this.f=null,Zn(this)}function Qn(t){var e=I(t);return e.eventElement=t.eventElement,e}function Zn(e){tr(e),e.f=t.setTimeout(e.D.bind(e),250)}function tr(e){e.f&&(t.clearTimeout(e.f),e.f=null)}function er(t,e){this.a=e,this.b=t,this.h=null,this.i=1,this.m=Promise.resolve(),this.g=[],this.j={},this.c={},this.s=!1,this.w=null,this.f=this.l=!1}function ir(t){var e=qn(t.a.Ua);return t.b.periods[de(t.b,e)]}function nr(t){var e=t.c.video||t.c.audio;return e?t.b.periods[e.wa]:null}function rr(t){return $(t.c,function(t){return t.oa||t.stream})}function ar(t,e){var i=t.c.video;if(i){var n=i.stream;if(n)if(e){var r=n.trickModeVideo;if(r){var a=i.oa;a||(or(t,r,!1),i.oa=n)}}else(a=i.oa)&&(i.oa=null,or(t,a,!0))}}function sr(t,e,i){e.video&&or(t,e.video,i),e.audio&&or(t,e.audio,i)}function or(t,e,i){var n=t.c[e.type];if(!n&&"text"==e.type&&t.h.ignoreTextStreamFailures)cr(t,{text:e});else if(n){var r=fe(t.b,e);i&&r!=n.wa?hr(t):(n.oa&&(e.trickModeVideo?(n.oa=e,e=e.trickModeVideo):n.oa=null),(r=t.g[r])&&r.Ka&&(r=t.j[e.id])&&r.Ka&&n.stream!=e&&("text"==e.type&&Ft(t.a.M,Q(e.mimeType,e.codecs)),n.stream=e,n.pb=!0,i&&(n.sa?n.tb=!0:n.xa?(n.ra=!0,n.tb=!0):(Pr(n),kr(t,n,!0)))))}}function ur(t){var e=qn(t.a.Ua);Object.keys(t.c).every(function(t){var i=this.a.M;return"text"==t?(t=i.a,t=e>=t.a&&ee?t.a.M.ga(e):t.a.M.ga(Math.pow(2,32))}function pr(t,e){var i=qn(t.a.Ua),n=e.Ea&&e.la?t.b.periods[fe(t.b,e.Ea)].startTime+e.la.endTime:Math.max(i,e.Bc),r=fe(t.b,e.stream),a=de(t.b,n),s=t.a.M,o=e.type;return"text"==o?(s=s.a,s=null==s.b||s.b=t.b.presentationTimeline.W()?(e.endOfStream=!0,null):(e.endOfStream=!1,e.wa=a,a!=r?null:s>=o?.5:(n=t.a.M,a=e.type,n="text"==a?n.a.b:Rt(Ht(n,a)),e.la&&e.stream==e.Ea?(a=e.la.position+1,n=mr(t,e,r,a)):(a=e.la?e.stream.findSegmentPosition(Math.max(0,t.b.periods[fe(t.b,e.Ea)].startTime+e.la.endTime-t.b.periods[r].startTime)):e.stream.findSegmentPosition(Math.max(0,(n||i)-t.b.periods[r].startTime)),null==a?n=null:(s=null,null==n&&(s=mr(t,e,r,Math.max(0,a-1))),n=s||mr(t,e,r,a))),n?(e.Bc=0,vr(t,e,i,r,n),null):1))}function mr(t,e,i,n){return i=t.b.periods[i],(e=e.stream.getSegmentReference(n))?(t=t.b.presentationTimeline,n=t.ua(),i.startTime+e.endTimen?null:e):null}function vr(t,e,i,n,r){var a=t.b.periods[n],s=e.stream,o=t.b.presentationTimeline.W(),u=t.b.periods[n+1];n=br(t,e,n,a.startTime,u?u.startTime:o),e.xa=!0,e.pb=!1,o=Ar(t,r),Promise.all([n,o]).then(function(t){if(!this.f&&!this.l)return yr(this,e,i,a,s,r,t[1])}.bind(t)).then(function(){this.f||this.l||(e.xa=!1,e.Ob=!1,e.ra||this.a.Ib(),Ir(this,e,0),wr(this,s))}.bind(t)).catch(function(t){this.f||this.l||(e.xa=!1,"text"==e.type&&this.h.ignoreTextStreamFailures?delete this.c.text:3017==t.code?gr(this,e,t):(e.Qa=!0,t.severity=2,_r(this,t)))}.bind(t))}function gr(t,e,i){if(!z(t.c).some(function(t){return t!=e&&t.Ob})){var n=Math.round(100*t.i);if(20=i?Promise.resolve():t.a.M.remove(e.type,n,n+i).then(function(){}.bind(t)))}function wr(t,e){if(!t.s&&(t.s=z(t.c).every(function(t){return"text"==t.type||!t.ra&&!t.sa&&t.la}),t.s)){var i=fe(t.b,e);for(t.g[i]||lr(t,i).then(function(){this.a.jc()}.bind(t)).catch(x),i=0;i=e.status&&202!=e.status)e.responseURL&&(t=e.responseURL),i({uri:t,data:e.response,headers:r,fromCache:!!r["x-shaka-from-cache"]});else{var a=null;try{a=et(e.response)}catch(t){}n(new h(401==e.status||403==e.status?2:1,1,1001,t,e.status,a,r))}},r.onerror=function(){n(new h(1,1,1002,t))},r.ontimeout=function(){n(new h(1,1,1003,t))};for(var a in e.headers)r.setRequestHeader(a,e.headers[a]);r.send(e.body)})}function Rr(){this.a=null,this.b=[],this.c={}}function Nr(t,e,i){return Cr(t,e,"readwrite",function(t){t.put(i)})}function Dr(t,e,i){return Cr(t,"segment","readwrite",function(t){for(var n=0;n=t.length?Promise.resolve():Yr(this,t[e++]).then(i):Promise.reject(new h(2,9,9002))}.bind(this);return i()}.bind(t));return t.b={},t.i=Promise.all(i).then(function(){return Nr(this.j,"manifest",e)}.bind(t)).then(function(){this.l=[]}.bind(t)),t.i}function Yr(t,e){var i=L(e.uris,t.w);(e.T||null!=e.K)&&(i.headers.Range="bytes="+e.T+"-"+(null==e.K?"":e.K));var n;return t.s.request(1,i).then(function(t){return this.a?(n=t.data.byteLength,this.l.push(e.Qb.key),e.Qb.data=t.data,Nr(this.j,"segment",e.Qb)):Promise.reject(new h(2,9,9002))}.bind(t)).then(function(){if(!this.a)return Promise.reject(new h(2,9,9002));null==e.K?(this.a.size+=n,this.f+=e.$b):this.h+=n;var t=(this.h+this.f)/(this.c+this.g),i=Ur(this.a);this.m.progressCallback(i,t)}.bind(t))}function zr(){this.a=-1}function $r(t){var e=new Ui(null,0);e.ga(t.duration);var i=t.drmInfo?[t.drmInfo]:[];return{presentationTimeline:e,minBufferTime:10,offlineSessionIds:t.sessionIds,periods:t.periods.map(function(t){return jr(t,i,e)})}}function Wr(t){if(/^offline:([0-9]+)$/.exec(t)){var e={uri:t,data:new ArrayBuffer(0),headers:{"content-type":"application/x-offline-manifest"}};return Promise.resolve(e)}if(e=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t)){var i=Number(e[1]),n=Kr();return n?n.init(Co).then(function(){return n.get("segment",i)}).then(function(e){return n.o().then(function(){if(!e)throw new h(2,9,9003,i);return{uri:t,data:e.data,headers:{}}})}):Promise.reject(new h(2,9,9e3))}return Promise.reject(new h(2,1,9004,t))}function Jr(t){this.a=null;for(var e=0;e=e.endTime)return null;var i=new VTTCue(e.startTime,e.endTime,e.payload);i.lineAlign=e.lineAlign,i.positionAlign=e.positionAlign,i.size=e.size;try{i.align=e.textAlign}catch(t){}if("center"==e.textAlign&&"center"!=i.align&&(i.align="middle"),e.writingDirection==Wo?i.vertical="lr":e.writingDirection==Jo&&(i.vertical="rl"),e.lineInterpretation==Zo&&(i.snapToLines=!1),null!=e.line&&(i.line=e.line),null!=e.position&&(i.position=e.position),t.VTTRegion&&e.region){var n=new VTTRegion;n.viewportAnchorX=e.region.x,n.viewportAnchorY=e.region.y,n.width=e.region.width,n.height=e.region.height,i.region=n}return i}function Zr(t,e){for(var i=t.b,n=[],r=0;r=n.a.length)t=i;else{var r=[];for(t=0;tt.textDecoration.indexOf("underline")&&t.textDecoration.push("underline");break;case"noUnderline":0<=t.textDecoration.indexOf("underline")&&U(t.textDecoration,"underline");break;case"lineThrough":0>t.textDecoration.indexOf("lineThrough")&&t.textDecoration.push("lineThrough");break;case"noLineThrough":0<=t.textDecoration.indexOf("lineThrough")&&U(t.textDecoration,"lineThrough");break;case"overline":0>t.textDecoration.indexOf("overline")&&t.textDecoration.push("overline");break;case"noOverline":0<=t.textDecoration.indexOf("overline")&&U(t.textDecoration,"overline")}}function Cs(t,e,i,n){return(t=Os(t,i,n))?t:Ms(e,i,n)}function Ms(t,e,i){for(var n=Ns(t),r=0;ri.length)return null;var n=null,r=t;for(t=null;r&&!(t=r.getAttribute(e))&&(r=r.parentNode)instanceof Element;);if(e=t)for(t=0;tthis.a?t:Math.min(a(this.b),a(this.c))},t.console&&t.console.log.bind&&(o=console.warn.bind(console)),e("shaka.util.Error",h),h.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")},h.Severity={RECOVERABLE:1,CRITICAL:2},h.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9},h.Code={UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,UNKNOWN_DATA_URI_ENCODING:1005,REQUEST_FILTER_ERROR:1006,RESPONSE_FILTER_ERROR:1007,INVALID_TEXT_HEADER:2e3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_MP4_TTML:2007,INVALID_MP4_VTT:2008,BUFFER_READ_OUT_OF_BOUNDS:3e3,JS_INTEGER_OVERFLOW:3001,EBML_OVERFLOW:3002,EBML_BAD_FLOATING_POINT_SIZE:3003,MP4_SIDX_WRONG_BOX_TYPE:3004,MP4_SIDX_INVALID_TIMESCALE:3005,MP4_SIDX_TYPE_NOT_SUPPORTED:3006,WEBM_CUES_ELEMENT_MISSING:3007,WEBM_EBML_HEADER_ELEMENT_MISSING:3008,WEBM_SEGMENT_ELEMENT_MISSING:3009,WEBM_INFO_ELEMENT_MISSING:3010,WEBM_DURATION_ELEMENT_MISSING:3011,WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING:3012,WEBM_CUE_TIME_ELEMENT_MISSING:3013,MEDIA_SOURCE_OPERATION_FAILED:3014,MEDIA_SOURCE_OPERATION_THREW:3015,VIDEO_ERROR:3016,QUOTA_EXCEEDED_ERROR:3017,UNABLE_TO_GUESS_MANIFEST_TYPE:4e3,DASH_INVALID_XML:4001,DASH_NO_SEGMENT_INFO:4002,DASH_EMPTY_ADAPTATION_SET:4003,DASH_EMPTY_PERIOD:4004,DASH_WEBM_MISSING_INIT:4005,DASH_UNSUPPORTED_CONTAINER:4006,DASH_PSSH_BAD_ENCODING:4007,DASH_NO_COMMON_KEY_SYSTEM:4008,DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED:4009,DASH_CONFLICTING_KEY_IDS:4010,UNPLAYABLE_PERIOD:4011,RESTRICTIONS_CANNOT_BE_MET:4012,NO_PERIODS:4014,HLS_PLAYLIST_HEADER_MISSING:4015,INVALID_HLS_TAG:4016,HLS_INVALID_PLAYLIST_HIERARCHY:4017,DASH_DUPLICATE_REPRESENTATION_ID:4018,HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND:4020,HLS_COULD_NOT_GUESS_MIME_TYPE:4021,HLS_MASTER_PLAYLIST_NOT_PROVIDED:4022,HLS_REQUIRED_ATTRIBUTE_MISSING:4023,HLS_REQUIRED_TAG_MISSING:4024,HLS_COULD_NOT_GUESS_CODECS:4025,HLS_KEYFORMATS_NOT_SUPPORTED:4026,DASH_UNSUPPORTED_XLINK_ACTUATE:4027,DASH_XLINK_DEPTH_LIMIT:4028,HLS_LIVE_CONTENT_NOT_SUPPORTED:4029,INVALID_STREAMS_CHOSEN:5005,NO_RECOGNIZED_KEY_SYSTEMS:6e3,REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE:6001,FAILED_TO_CREATE_CDM:6002,FAILED_TO_ATTACH_TO_VIDEO:6003,INVALID_SERVER_CERTIFICATE:6004,FAILED_TO_CREATE_SESSION:6005,FAILED_TO_GENERATE_LICENSE_REQUEST:6006,LICENSE_REQUEST_FAILED:6007,LICENSE_RESPONSE_REJECTED:6008,ENCRYPTED_CONTENT_WITHOUT_DRM_INFO:6010,NO_LICENSE_SERVER_GIVEN:6012,OFFLINE_SESSION_REMOVED:6013,EXPIRED:6014,LOAD_INTERRUPTED:7e3,CAST_API_UNAVAILABLE:8e3,NO_CAST_RECEIVERS:8001,ALREADY_CASTING:8002,UNEXPECTED_CAST_ERROR:8003,CAST_CANCELED_BY_USER:8004,CAST_CONNECTION_TIMED_OUT:8005,CAST_RECEIVER_APP_UNAVAILABLE:8006,STORAGE_NOT_SUPPORTED:9e3,INDEXED_DB_ERROR:9001,OPERATION_ABORTED:9002,REQUESTED_ITEM_NOT_FOUND:9003,MALFORMED_OFFLINE_URI:9004,CANNOT_STORE_LIVE_OFFLINE:9005,STORE_ALREADY_IN_PROGRESS:9006,NO_INIT_DATA_FOR_OFFLINE:9007,LOCAL_PLAYER_INSTANCE_REQUIRED:9008,CONTENT_UNSUPPORTED_BY_BROWSER:9009};var Ws=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;zs=c.prototype,zs.ea="",zs.Aa="",zs.ja="",zs.Ia=null,zs.ba="",zs.ta="",zs.toString=function(){var t=[],e=this.ea;if(e&&t.push(m(e,Js,!0),":"),e=this.ja){t.push("//");var i=this.Aa;i&&t.push(m(i,Js,!0),"@"),t.push(encodeURIComponent(e).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e=this.Ia,null!=e&&t.push(":",String(e))}return(e=this.ba)&&(this.ja&&"/"!=e.charAt(0)&&t.push("/"),t.push(m(e,"/"==e.charAt(0)?Zs:Qs,!0))),(e=this.a.toString())&&t.push("?",e),(e=this.ta)&&t.push("#",m(e,eo)),t.join("")},zs.resolve=function(t){var e=new c(this);"data"===e.ea&&(e=new c);var i=!!t.ea;i?l(e,t.ea):i=!!t.Aa,i?e.Aa=t.Aa:i=!!t.ja,i?e.ja=t.ja:i=null!=t.Ia;var n=t.ba;if(i)d(e,t.Ia);else if(i=!!t.ba){if("/"!=n.charAt(0))if(this.ja&&!this.ba)n="/"+n;else{var r=e.ba.lastIndexOf("/");-1!=r&&(n=e.ba.substr(0,r+1)+n)}if(".."==n||"."==n)n="";else if(-1!=n.indexOf("./")||-1!=n.indexOf("/.")){for(var r=!n.lastIndexOf("/",0),n=n.split("/"),a=[],s=0;sn||i&&1e3>n)&&!this.a[e].na&&(this.a.splice(e,1),t.close()),at(this.D,.5)}},zs.$d=function(){function t(t,e){return"expired"==e}!Y(this.C)&&W(this.C,t)&&this.g(new h(2,6,6014)),this.s.Hb(this.C)},zs.Gd=function(){for(var t=0;t=this.b||(t<=this.a&&e>=this.b?this.a=this.b=null:t<=this.a&&ethis.a&&e>=this.b&&(this.b=t))}.bind(this))},Ut.prototype.parseInit=function(t){this.Ta(t,0,null,null)},Ut.prototype.parseMedia=function(t,e){return this.Ta(t,e.periodStart,e.segmentStart,e.segmentEnd)},zs=jt.prototype,zs.o=function(){this.i=!0;var t,e=[];for(t in this.c){var i=this.c[t],n=i[0];for(this.c[t]=i.slice(0,1),n&&e.push(n.p.catch(x)),n=1;n=r.bandwidth/this.a.bandwidthDowngradeTarget&&e<=a&&(i=r)}return this.f=Date.now(),i},pe.prototype.chooseVariant=pe.prototype.chooseVariant,pe.prototype.enable=function(){this.c=!0},pe.prototype.enable=pe.prototype.enable,pe.prototype.disable=function(){this.c=!1},pe.prototype.disable=pe.prototype.disable,pe.prototype.segmentDownloaded=function(t,e){var i=this.b;if(!(16e3>e)){var n=8e3*e/t,a=t/1e3;i.a+=e,r(i.b,a,n),r(i.c,a,n)}if(null!=this.f&&this.c)t:{if(this.i){if(Date.now()-this.f<1e3*this.a.switchInterval)break t}else{if(!(128e3<=this.b.a))break t;this.i=!0}i=this.chooseVariant(),this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate),this.h(i)}},pe.prototype.segmentDownloaded=pe.prototype.segmentDownloaded,pe.prototype.getBandwidthEstimate=function(){return this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate)},pe.prototype.getBandwidthEstimate=pe.prototype.getBandwidthEstimate,pe.prototype.setVariants=function(t){this.g=t},pe.prototype.setVariants=pe.prototype.setVariants,pe.prototype.configure=function(t){this.a=t},pe.prototype.configure=pe.prototype.configure;var ho="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),co="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),lo=["loop","playbackRate"],fo=["pause","play"],po="adaptation buffering emsg error loading streaming texttrackvisibility timelineregionadded timelineregionenter timelineregionexit trackschanged unloading".split(" "),mo="drmInfo getAudioLanguages getBufferedInfo getConfiguration getExpiration getManifest getManifestUri getPlaybackRate getTextLanguages getTextTracks getStats getVariantTracks isAudioOnly isBuffering isInProgress isLive isTextTrackVisible keySystem seekRange".split(" "),vo=["getPlayheadTimeAsDate","getPresentationStartTimeAsDate"],go=[["getConfiguration","configure"]],bo=[["isTextTrackVisible","setTextTrackVisibility"]],yo="addTextTrack cancelTrickPlay configure resetConfiguration retryStreaming selectAudioLanguage selectTextLanguage selectTextTrack selectVariantTrack setTextTrackVisibility trickPlay".split(" "),To=["load","unload"],wo=!1,Eo=null;zs=ye.prototype,zs.o=function(){return we(this),Eo&&Te(this),this.D=this.C=this.g=null,this.b=this.h=!1,this.m=this.l=this.f=this.c=this.a=this.i=null,Promise.resolve()},zs.aa=function(){return this.b},zs.Nb=function(){return this.B},zs.init=function(){if(t.chrome&&chrome.cast&&chrome.cast.isAvailable){delete t.__onGCastApiAvailable,this.h=!0,this.g();var e=new chrome.cast.SessionRequest(this.J),e=new chrome.cast.ApiConfig(e,this.nc.bind(this),this.Id.bind(this),"origin_scoped");chrome.cast.initialize(e,function(){},function(){}),wo&&setTimeout(this.g.bind(this),20),(e=Eo)&&e.status!=chrome.cast.SessionStatus.STOPPED?this.nc(e):Eo=null}else t.__onGCastApiAvailable=function(t){t&&this.init()}.bind(this)},zs.Rb=function(t){this.i=t,this.b&&Ee({type:"appData",appData:this.i})},zs.cast=function(t){return this.h?wo?this.b?Promise.reject(new h(1,8,8002)):(this.f=new y,chrome.cast.requestSession(this.Jb.bind(this,t),this.lc.bind(this)),this.f):Promise.reject(new h(1,8,8001)):Promise.reject(new h(1,8,8e3))},zs.lb=function(){this.b&&(we(this),Eo&&(Te(this),Eo.stop(function(){},function(){}),Eo=null))},zs.get=function(t,e){if("video"==t){if(0<=fo.indexOf(e))return this.zc.bind(this,t,e)}else if("player"==t){if(0<=vo.indexOf(e)&&!this.get("player","isLive")())return function(){};if(0<=yo.indexOf(e))return this.zc.bind(this,t,e);if(0<=To.indexOf(e))return this.de.bind(this,t,e);if(0<=mo.indexOf(e))return this.vc.bind(this,t,e)}return this.vc(t,e)},zs.set=function(t,e,i){this.a[t][e]=i,Ee({type:"set",targetName:t,property:e,value:i})},zs.Jb=function(t,e){Eo=e,e.addUpdateListener(this.l),e.addMessageListener("urn:x-cast:com.google.shaka.v2",this.m),this.mc(),Ee({type:"init",initState:t,appData:this.i}),this.f.resolve()},zs.lc=function(t){var e=8003;switch(t.code){case"cancel":e=8004;break;case"timeout":e=8005;break;case"receiver_unavailable":e=8006}this.f.reject(new h(2,8,e,t))},zs.vc=function(t,e){return this.a[t][e]},zs.zc=function(t,e){Ee({type:"call",targetName:t,methodName:e,args:Array.prototype.slice.call(arguments,2)})},zs.de=function(t,e){var i=Array.prototype.slice.call(arguments,2),n=new y,r=this.s.toString();return this.s++,this.c[r]=n,Ee({type:"asyncCall",targetName:t,methodName:e,args:i,id:r}),n},zs.nc=function(t){var e=this.w();this.f=new y,this.j=!0,this.Jb(e,t)},zs.Id=function(t){wo="available"==t,this.g()},zs.mc=function(){var t=!!Eo&&"connected"==Eo.status;if(this.b&&!t){this.D();for(var e in this.a)this.a[e]={};we(this)}this.B=(this.b=t)?Eo.receiver.friendlyName:"",this.g()},zs.Cd=function(t,e){var i=ge(e);switch(i.type){case"event":var n=i.targetName,r=i.event;this.C(n,new G(r.type,r));break;case"update":r=i.update;for(n in r){var i=this.a[n]||{};for(a in r[n])i[a]=r[n][a]}this.j&&(this.L(),this.j=!1);break;case"asyncComplete":n=i.id;var a=i.error;if(i=this.c[n],delete this.c[n],i)if(a){n=new h(a.severity,a.category,a.code);for(r in a)n[r]=a[r];i.reject(n)}else i.resolve()}},Se.prototype.addEventListener=function(t,e){this.vb.push(t,e)},Se.prototype.removeEventListener=function(t,e){this.vb.remove(t,e)},Se.prototype.dispatchEvent=function(t){for(var e=this.vb.get(t.type)||[],i=0;ithis.O.byteLength&&ni();var e=ri(this,this.v,this.v+t);return this.v+=t,new Uint8Array(e)},ii.prototype.readBytes=ii.prototype.Ja,ii.prototype.I=function(t){this.v+t>this.O.byteLength&&ni(),this.v+=t},ii.prototype.skip=ii.prototype.I,ii.prototype.Lb=function(){for(var t=this.v;this.da()&&this.O.getUint8(this.v);)this.v+=1;return t=ri(this,t,this.v),this.v+=1,Z(t)},ii.prototype.readTerminatedString=ii.prototype.Lb,e("shaka.util.Mp4Parser",ai),ai.prototype.G=function(t,e){var i=hi(t);return this.b[i]=0,this.a[i]=e,this},ai.prototype.box=ai.prototype.G,ai.prototype.ca=function(t,e){var i=hi(t);return this.b[i]=1,this.a[i]=e,this},ai.prototype.fullBox=ai.prototype.ca,ai.prototype.parse=function(t){for(t=new ii(new DataView(t),0);t.da();)this.qb(0,t)},ai.prototype.parse=ai.prototype.parse,ai.prototype.qb=function(t,e){var i=e.v,n=e.F(),r=e.F();switch(n){case 0:n=e.O.byteLength-i;break;case 1:n=e.Va()}var a=this.a[r];if(a){var s=null,o=null;1==this.b[r]&&(o=e.F(),s=o>>>24,o&=16777215),r=i+n-e.v,r=0=i.startTime&&tt||t>=this.a.length?null:this.a[t]):null},di.prototype.get=di.prototype.get,di.prototype.ob=function(t){for(var e,i,n,r=[],a=e=0;en.startTime?e||r.push(n):(.1t);++e);this.a.splice(0,e)},di.prototype.evict=di.prototype.xb;var Io;pi.prototype.da=function(){return this.a.da()},yi.prototype.parse=function(t,e,i,n){var r;if(e=new pi(new DataView(e)),440786851!=mi(e).id)throw new h(2,3,3008);var a=mi(e);if(408125543!=a.id)throw new h(2,3,3009);for(e=a.a.byteOffset,a=new pi(a.a),r=null;a.da();){var s=mi(a);if(357149030==s.id){r=s;break}}if(!r)throw new h(2,3,3010);for(a=new pi(r.a),r=1e6,s=null;a.da();){var o=mi(a);if(2807729==o.id)r=bi(o);else if(17545==o.id)if(s=o,4==s.a.byteLength)s=s.a.getFloat32(0);else{if(8!=s.a.byteLength)throw new h(2,3,3003);s=s.a.getFloat64(0)}}if(null==s)throw new h(2,3,3011);if(a=r/1e9,r=s*a,t=mi(new pi(new DataView(t))),475249515!=t.id)throw new h(2,3,3007);return Ti(t,e,a,r,i,n)};var Po={},_o={};e("shaka.media.ManifestParser.registerParserByExtension",function(t,e){_o[t]=e}),e("shaka.media.ManifestParser.registerParserByMime",function(t,e){Po[t]=e}),e("shaka.media.PresentationTimeline",Ui),Ui.prototype.W=function(){return this.a},Ui.prototype.getDuration=Ui.prototype.W,Ui.prototype.ga=function(t){this.a=t},Ui.prototype.setDuration=Ui.prototype.ga,Ui.prototype.gd=function(){return this.c},Ui.prototype.getPresentationStartTime=Ui.prototype.gd,Ui.prototype.Gc=function(t){this.i=t},Ui.prototype.setClockOffset=Ui.prototype.Gc,Ui.prototype.rb=function(t){this.h=t},Ui.prototype.setStatic=Ui.prototype.rb,Ui.prototype.jd=function(){return this.f},Ui.prototype.getSegmentAvailabilityDuration=Ui.prototype.jd,Ui.prototype.Ic=function(t){this.f=t},Ui.prototype.setSegmentAvailabilityDuration=Ui.prototype.Ic,Ui.prototype.Hc=function(t){this.j=t},Ui.prototype.setDelay=Ui.prototype.Hc,Ui.prototype.Ga=function(t,e){e.length&&(this.b=e.reduce(function(t,e){return Math.max(t,e.endTime-e.startTime)},this.b))},Ui.prototype.notifySegments=Ui.prototype.Ga,Ui.prototype.Eb=function(t){this.b=Math.max(this.b,t)},Ui.prototype.notifyMaxSegmentDuration=Ui.prototype.Eb,Ui.prototype.R=function(){return 1/0==this.a&&!this.h},Ui.prototype.isLive=Ui.prototype.R,Ui.prototype.va=function(){return 1/0!=this.a&&!this.h},Ui.prototype.isInProgress=Ui.prototype.va,Ui.prototype.ka=function(){return this.Da(0)},Ui.prototype.getSegmentAvailabilityStart=Ui.prototype.ka,Ui.prototype.Da=function(t){if(1/0==this.f)return this.g;var e=this.ua();return Math.max(this.g,Math.min(e-this.f+t,e))},Ui.prototype.getSafeAvailabilityStart=Ui.prototype.Da,Ui.prototype.Fc=function(t){this.g=t},Ui.prototype.setAvailabilityStart=Ui.prototype.Fc,Ui.prototype.ua=function(){return this.R()||this.va()?Math.min(Math.max(0,(Date.now()+this.i)/1e3-this.b-this.c),this.a):this.a},Ui.prototype.getSegmentAvailabilityEnd=Ui.prototype.ua,Ui.prototype.nb=function(){return Math.max(0,this.ua()-(this.R()||this.va()?this.j:0))},Ui.prototype.getSeekRangeEnd=Ui.prototype.nb,e("shaka.dash.DashParser",ji),zs=ji.prototype,zs.configure=function(t){this.b=t},zs.start=function(t,e){return this.g=[t],this.a=e,Bi(this).then(function(){return this.a&&Xi(this,0),this.c}.bind(this))},zs.stop=function(){return this.b=this.a=null,this.g=[],this.c=null,this.i=[],this.j={},null!=this.f&&(t.clearTimeout(this.f),this.f=null),Promise.resolve()},zs.update=function(){Bi(this).catch(function(t){this.a&&this.a.onError(t)}.bind(this))},zs.onExpirationUpdated=function(){},zs.Td=function(t,e){t.V=Yi(e,t.Y,null);var i=!1,n=Le(e,"Role"),r=n.map(function(t){return t.getAttribute("value")}).filter(R),a=void 0;"text"==t.V.contentType&&(a="subtitle");for(var s=0;si.length||"data"!=i[0])throw new h(2,1,1004,e);if(i=i.slice(1).join(":").split(","),2>i.length)throw new h(2,1,1004,e);var n=i[0],i=t.decodeURIComponent(i.slice(1).join(",")),n=n.split(";"),r=null;if(1this.i?0:this.i;this.a.playbackRate&&this.a.playbackRate!=t&&Yn(this,this.a.playbackRate)},zs.pc=function(){var t=Xn(this);this.b.ha(this.a,"timeupdate"),this.g.cancel(),.001>Math.abs(this.a.currentTime-t)?(F(this.b,this.a,"seeking",this.sc.bind(this)),F(this.b,this.a,"playing",this.qc.bind(this))):(V(this.b,this.a,"seeking",this.Jd.bind(this)),this.a.currentTime=t)},zs.Jd=function(){F(this.b,this.a,"seeking",this.sc.bind(this)),F(this.b,this.a,"playing",this.qc.bind(this))},zs.rc=function(){if(this.a.readyState&&!this.a.paused){this.a.readyState!=this.D&&(this.s=!1,this.D=this.a.readyState);var t=this.l.smallGapLimit,e=this.a.currentTime,i=this.a.buffered;if(ei.end(0)-i.start(0))){var n=.1;/(Edge\/|Trident\/|Tizen)/.test(navigator.userAgent)&&(n=.5);for(var r=0;re&&(!r||i.end(r-1)-e<=n)){n=r;break t}}n=null}if(null==n){if(3>this.a.readyState&&0=i.start(n)&&e=this.c.presentationTimeline.nb())){var a=r-e,t=a<=t,s=!1;t||this.s||(this.s=!0,a=new G("largegap",{currentTime:e,gapSize:a}),a.cancelable=!0,this.J(a),this.l.jumpLargeGaps&&!a.defaultPrevented&&(s=!0)),(t||s)&&(n&&i.end(n-1),$n(this,e,r))}}}},zs.ud=function(){this.m=zn(this,this.a.currentTime)},zs.sc=function(){this.w=!1;var t=this.a.currentTime,e=zn(this,t);.001this.a.currentTime?1:e.info.endTime=n||this.a.ended||r;this.b?(i=1*Math.max(this.g.minBufferTime||0,this.w.rebufferingGoal),(e||t>=i)&&0!=this.b&&(this.b=!1,this.l(!1))):!e&&.5>t&&1!=this.b&&(this.b=!0,this.l(!0)),this.c.forEach(this.m.bind(this,!1))},zs=er.prototype,zs.o=function(){for(var t in this.c)Pr(this.c[t]);return this.h=this.c=this.j=this.g=this.m=this.b=this.a=null,this.f=!0,Promise.resolve()},zs.configure=function(t){this.h=t,this.w=new T({maxAttempts:Math.max(t.retryParameters.maxAttempts,2),baseDelay:t.retryParameters.baseDelay,backoffFactor:t.retryParameters.backoffFactor,fuzzFactor:t.retryParameters.fuzzFactor,timeout:0},!0)},zs.init=function(){var t=qn(this.a.Ua),t=this.a.kc(this.b.periods[de(this.b,t)]);return t.variant||t.text?cr(this,t).then(function(){this.a&&this.a.yd&&this.a.yd()}.bind(this)):Promise.reject(new h(2,5,5005))},zs.Ce=function(t){if(!this.f&&!t.xa&&null!=t.qa&&!t.sa)if(t.qa=null,t.ra)kr(this,t,t.tb);else{try{var e=pr(this,t);null!=e&&(Ir(this,t,e),t.Qa=!1)}catch(t){return void _r(this,t)}e=z(this.c),Er(this,t),e.every(function(t){return t.endOfStream})&&this.a.M.endOfStream().then(function(){this.b.presentationTimeline.ga(this.a.M.W())}.bind(this))}},zs.Ud=function(t,e,i){var n=i.u.Lb(),r=i.u.Lb(),a=i.u.F(),s=i.u.F(),o=i.u.F(),u=i.u.F();i=i.u.Ja(i.u.O.byteLength-i.u.v),t=t.startTime+e.startTime+s/a,"urn:mpeg:dash:event:2012"==n?this.a.Ad():this.a.onEvent(new G("emsg",{detail:{startTime:t,endTime:t+o/a,schemeIdUri:n,value:r,timescale:a,presentationTimeDelta:s,eventDuration:o,id:u,messageData:i}}))},e("shaka.net.HttpPlugin",xr),io.http=xr,io.https=xr,zs=Rr.prototype,zs.init=function(t,e){return Mr(this,t,e).then(function(){var e=Object.keys(t);return Promise.all(e.map(function(t){return Lr(this,t).then(function(e){this.c[t]=e}.bind(this))}.bind(this)))}.bind(this))},zs.o=function(){return Promise.all(this.b.map(function(t){try{t.transaction.abort()}catch(t){}return t.N.catch(x)})).then(function(){this.a&&(this.a.close(),this.a=null)}.bind(this))},zs.get=function(t,e){var i;return Cr(this,t,"readonly",function(t){i=t.get(e)}).then(function(){return i.result})},zs.forEach=function(t,e){return Cr(this,t,"readonly",function(t){t.openCursor().onsuccess=function(t){(t=t.target.result)&&(e(t.value),t.continue())}})},zs.remove=function(t,e){return Cr(this,t,"readwrite",function(t){t.delete(e)})};var Co={manifest:"key",segment:"key"};Gr.prototype.o=function(){var t=this.j,e=this.l,i=this.i||Promise.resolve();return e.length&&(i=i.then(function(){return Dr(t,e)})),this.b={},this.l=[],this.i=this.a=this.w=this.s=this.j=this.m=null,i},zs=zr.prototype,zs.configure=function(){},zs.start=function(t){var e=/^offline:([0-9]+)$/.exec(t);if(!e)return Promise.reject(new h(2,1,9004,t));var i=Number(e[1]),n=Kr();return this.a=i,n?n.init(Co).then(function(){return n.get("manifest",i)}).then(function(t){if(!t)throw new h(2,9,9003,i);return $r(t)}).then(function(t){return n.o().then(function(){return t})},function(t){return n.o().then(function(){throw t})}):Promise.reject(new h(2,9,9e3))},zs.stop=function(){return Promise.resolve()},zs.update=function(){},zs.onExpirationUpdated=function(t,e){var i=Kr();i.init(Co).then(function(){return i.get("manifest",this.a)}.bind(this)).then(function(n){if(n&&!(0>n.sessionIds.indexOf(t))&&(void 0==n.expiration||n.expiration>e))return n.expiration=e,Nr(i,"manifest",n)}).catch(function(){}).then(function(){return i.o()})},Po["application/x-offline-manifest"]=zr,e("shaka.offline.OfflineScheme",Wr),io.offline=Wr,e("shaka.text.SimpleTextDisplayer",Jr),Jr.prototype.remove=function(t,e){return!!this.a&&(Zr(this,function(i){return!(i.startTime>=e||i.endTime<=t)}),!0)},Jr.prototype.remove=Jr.prototype.remove,Jr.prototype.append=function(t){for(var e=[],i=0;ithis.eb.indexOf(t.id)}.bind(this))},ia.prototype.getTextTracks=ia.prototype.ld,ia.prototype.me=function(t){if(this.a){(t=re(ir(this.a),t))&&(ha(this,t,!1),this.Ba?this.X=t:or(this.a,t,!0))}},ia.prototype.selectTextTrack=ia.prototype.me,ia.prototype.ne=function(t,e){if(this.a){this.c.abr.enabled&&o("Changing tracks while abr manager is enabled will likely result in the selected track being overriden. Consider disabling abr before calling selectVariantTrack().");var i=ir(this.a);(i=ne(i,t))&&i.allowedByApplication&&i.allowedByKeySystem&&(ua(this,i,!1),va(this,i,e))}},ia.prototype.selectVariantTrack=ia.prototype.ne,ia.prototype.Zc=function(){return this.a?ae(ir(this.a).variants).map(function(t){return t.language}).filter(N):[]},ia.prototype.getAudioLanguages=ia.prototype.Zc,ia.prototype.kd=function(){return this.a?ir(this.a).textStreams.map(function(t){return t.language}).filter(N):[]},ia.prototype.getTextLanguages=ia.prototype.kd,ia.prototype.ke=function(t,e){if(this.a){var i=ir(this.a);this.Ma=t,this.ab=e||"",Ta(this,i)}},ia.prototype.selectAudioLanguage=ia.prototype.ke,ia.prototype.le=function(t,e){if(this.a){var i=ir(this.a);this.$a=t,this.ub=e||"",Ta(this,i)}},ia.prototype.selectTextLanguage=ia.prototype.le,ia.prototype.rd=function(){return this.w?this.w.isTextVisible():this.jb},ia.prototype.isTextTrackVisible=ia.prototype.rd,ia.prototype.qe=function(t){this.w?this.w.setTextVisibility(t):this.jb=t,Sa(this)},ia.prototype.setTextTrackVisibility=ia.prototype.qe,ia.prototype.ed=function(){return this.b?new Date(1e3*this.b.presentationTimeline.c+1e3*this.f.currentTime):null},ia.prototype.getPlayheadTimeAsDate=ia.prototype.ed,ia.prototype.hd=function(){return this.b?new Date(1e3*this.b.presentationTimeline.c):null},ia.prototype.getPresentationStartTimeAsDate=ia.prototype.hd,ia.prototype.yb=function(){return this.J?this.J.yb():{total:[],audio:[],video:[],text:[]}},ia.prototype.getBufferedInfo=ia.prototype.yb,ia.prototype.getStats=function(){ga(this),this.Za();var t=null,e=null,i=this.f,i=i&&i.getVideoPlaybackQuality?i.getVideoPlaybackQuality():{};return this.h&&this.b&&(t=de(this.b,qn(this.h)),e=this.C[t],e=le(e.audio,e.video,this.b.periods[t].variants),t=e.video||{}),t||(t={}),e||(e={}),{width:t.width||0,height:t.height||0,streamBandwidth:e.bandwidth||0,decodedFrames:Number(i.totalVideoFrames),droppedFrames:Number(i.droppedVideoFrames),estimatedBandwidth:this.g?this.g.getBandwidthEstimate():NaN,loadLatency:this.j.loadLatency,playTime:this.j.playTime,bufferingTime:this.j.bufferingTime,switchHistory:I(this.j.switchHistory),stateHistory:I(this.j.stateHistory)}},ia.prototype.getStats=ia.prototype.getStats,ia.prototype.addTextTrack=function(t,e,i,n,r,a){if(!this.a)return Promise.reject();for(var s,o=ir(this.a),u=0;uae(t.variants).length)throw new h(2,4,4012)}.bind(this))},zs.kb=function(t){var e=this.a?rr(this.a):{};if(Zt(this.l,e,t),e=0ae(t.variants).length,!e)throw new h(2,4,4011);if(t)throw new h(2,4,4012)},zs.ue=function(t,e){this.g&&this.g.segmentDownloaded(t,e)},zs.Jc=function(t){if(ga(this),this.Oa=t,this.Za(),this.h){var e=this.h;t!=e.j&&(e.j=t,Yn(e,e.i))}this.dispatchEvent(new G("buffering",{buffering:t}))},zs.se=function(){Ea(this)},zs.Za=function(){if(!this.D){var t=this.Oa?"buffering":this.f.ended?"ended":this.f.paused?"paused":"playing",e=Date.now()/1e3;if(this.j.stateHistory.length){var i=this.j.stateHistory[this.j.stateHistory.length-1];if(i.duration=e-i.timestamp,t==i.state)return}this.j.stateHistory.push({timestamp:e,state:t,duration:0})}},zs.te=function(){if(this.B){var t=this.B;t.c.forEach(t.m.bind(t,!0))}this.a&&ur(this.a)},zs.td=function(t){this.Ba=!0,this.g.disable();var e={audio:!1,text:!1},i=se(t,this.Ma,this.ab,e);return t=oe(t,this.$a,this.ub,e),i=ya(this,i),t=t[0]||null,this.X=this.Na=null,i&&ua(this,i,!0),t&&(ha(this,t,!0),!nr(this.a)&&i&&i.audio&&e.text&&t.language!=i.audio.language&&(this.w.setTextVisibility(!0),Sa(this))),{variant:i,text:t}},zs.Rc=function(){this.Ba=!1,this.c.abr.enabled&&this.g.enable(),this.Na&&(sr(this.a,this.Na,this.Yb),this.Na=null),this.X&&(or(this.a,this.X,!0),this.X=null)},zs.Bd=function(){this.i&&this.i.update&&this.i.update()},zs.Kd=function(){this.h&&this.h.Ib()},zs.Kc=function(t,e){ua(this,t,!0),this.a&&(sr(this.a,t,e||!1),wa(this))},zs.Fe=function(t,e){if(this.a){var i=nr(this.a);(i=ce(t.audio,t.video,i?i.variants:[]))&&this.Kc(i,e)}},zs.La=function(t){if(!this.D){var e=new G("error",{detail:t});this.dispatchEvent(e),e.defaultPrevented&&(t.handled=!0)}},zs.Nd=function(t){this.B?this.B.s(t):this.hb.push(t)},zs.Ya=function(t){this.dispatchEvent(t)},zs.Od=function(){if(this.f.error){var t=this.f.error.code;if(1!=t){var e=this.f.error.msExtendedCode;e&&(0>e&&(e+=Math.pow(2,32)),e=e.toString(16)),this.La(new h(2,3,3016,t,e,this.f.error.message))}}},zs.zd=function(t){var e=["output-restricted","internal-error"],i=ir(this.a),n=!1,r=1==Object.keys(t).length&&"00"==Object.keys(t)[0];i.variants.forEach(function(i){var a=[];i.audio&&a.push(i.audio),i.video&&a.push(i.video),a.forEach(function(a){var s=i.allowedByKeySystem;a.keyId&&(a=t[r?"00":a.keyId],i.allowedByKeySystem=!!a&&0>e.indexOf(a)),s!=i.allowedByKeySystem&&(n=!0)})});var a=rr(this.a);(a=ce(a.audio,a.video,i.variants))&&!a.allowedByKeySystem&&Ta(this,i),n&&Ea(this)},zs.wd=function(t,e){this.i&&this.i.onExpirationUpdated&&this.i.onExpirationUpdated(t,e),this.dispatchEvent(new G("expirationupdated"))},e("shaka.offline.Storage",Aa),Aa.support=ka,Aa.prototype.o=function(){var t=this.a,e=this.i?this.i.o().catch(function(){}).then(function(){if(t)return t.o()}):Promise.resolve();return this.b=this.g=this.i=this.a=null,e},Aa.prototype.destroy=Aa.prototype.o,Aa.prototype.configure=function(t){k(this.b,t,Pa(this),{},"")},Aa.prototype.configure=Aa.prototype.configure,Aa.prototype.De=function(t,e,i){function n(t){a=t}if(this.s)return Promise.reject(new h(2,9,9006));this.s=!0;var r,a=null;return _a(this).then(function(){return Da(this),Ia(this,t,n,i)}.bind(this)).then(function(i){if(Da(this),this.f=i.manifest,this.c=i.Wc,this.f.presentationTimeline.R()||this.f.presentationTimeline.va())throw new h(2,9,9005,t);this.m(this.f.periods),this.h=this.a.c.manifest++,this.l=0,i=e||{};var n=this.f.periods.map(this.C.bind(this)),a=this.c.b,s=vt(this.c);if(a){if(!s.length)throw new h(2,9,9007,t);a.initData=[]}return r={key:this.h,originalManifestUri:t,duration:this.l,size:0,expiration:this.c.mb(),periods:n,sessionIds:this.b.usePersistentLicense?s:[],drmInfo:a,appMetadata:i},Xr(this.i,r)}.bind(this)).then(function(){if(Da(this),a)throw a;return xa(this)}.bind(this)).then(function(){return Ur(r)}.bind(this)).catch(function(t){return xa(this).catch(x).then(function(){throw t})}.bind(this))},Aa.prototype.store=Aa.prototype.De,Aa.prototype.remove=function(t){function e(t){6013!=t.code&&(s=t)}var i=t.offlineUri,n=/^offline:([0-9]+)$/.exec(i);if(!n)return Promise.reject(new h(2,9,9004,i));var r,a,s=null,o=Number(n[1]);return _a(this).then(function(){return Da(this),this.a.get("manifest",o)}.bind(this)).then(function(t){if(Da(this),!t)throw new h(2,9,9003,i);return r=t,t=$r(r),a=new dt({Sa:this.g.s,onError:e,Hb:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),a.configure(this.g.getConfiguration().drm),a.init(t,this.b.usePersistentLicense||!1)}.bind(this)).then(function(){return pt(a,r.sessionIds)}.bind(this)).then(function(){return a.o()}.bind(this)).then(function(){if(Da(this),s)throw s;var e=r.periods.map(function(t){return t.streams.map(function(t){var e=t.segments.map(function(t){return t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t.uri),Number(t[1])});return t.initSegmentUri&&(t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t.initSegmentUri),e.push(Number(t[1]))),e}).reduce(_,[])}).reduce(_,[]),i=0,n=e.length,a=this.b.progressCallback;return Dr(this.a,e,function(){i++,a(t,i/n)})}.bind(this)).then(function(){return Da(this),this.b.progressCallback(t,1),this.a.remove("manifest",o)}.bind(this))},Aa.prototype.remove=Aa.prototype.remove,Aa.prototype.list=function(){var t=[];return _a(this).then(function(){return Da(this),this.a.forEach("manifest",function(e){t.push(Ur(e))})}.bind(this)).then(function(){return t})},Aa.prototype.list=Aa.prototype.list,Aa.prototype.B=function(t){for(var e,i=[],n=Wt(this.g.getConfiguration().preferredAudioLanguage),r=[0,so,oo],a=t.filter(function(t){return"variant"==t.type}),r=r.map(function(t){return a.filter(function(e){return e=Wt(e.language),$t(t,n,e)})}),s=0;s=t.height});return o.length&&(o.sort(function(t,e){return e.height-t.height}),e=o.filter(function(t){return t.height==o[0].height})),e.sort(function(t,e){return t.bandwidth-e.bandwidth}),e.length&&i.push(e[Math.floor(e.length/2)]),i.push.apply(i,t.filter(function(t){return"text"==t.type})),i},Aa.prototype.m=function(t){t.forEach(this.w.bind(this))},Aa.prototype.w=function(t){var e={};if(this.j){var i=this.j.filter(function(t){return"variant"==t.type}),n=null;i.length&&(n=ne(t,i[0])),n&&(n.video&&(e.video=n.video),n.audio&&(e.audio=n.audio))}Zt(this.c,e,t),Qt(t,this.g.getConfiguration().restrictions,{width:1/0,height:1/0})},Aa.prototype.C=function(t){var e,i,n=ee(t,null,null),r=ie(t,null),n=this.b.trackSelectionCallback(n.concat(r));for(this.j||(this.j=n,this.m(this.f.periods)),r=n.length-1;0navigator.userAgent.indexOf("Trident/")||HTMLInputElement.prototype.addEventListener==Ma||(Uo=HTMLInputElement.prototype.addEventListener,HTMLInputElement.prototype.addEventListener=Ma)}),La(function(){if(4503599627370497!=Math.round(4503599627370497)){var t=Math.round;Math.round=function(e){var i=e;return 4503599627370496>=e&&(i=t(e)),i}}}),Oa.prototype.c=function(t){if(!(1s[0].indexOf("--\x3e")&&(u=s[0],s.splice(0,1));var c=new un(s[0]),l=Gs(c),d=hn(c,/[ \t]+--\x3e[ \t]+/g),f=Gs(c);if(null==l||!d||null==f)throw new h(2,2,2001);for(s=new xs(l+o,f+o,s.slice(1).join("\n").trim()),hn(c,/[ \t]+/gm),o=cn(c);o;)Ks(s,o),hn(c,/[ \t]+/gm),o=cn(c);null!=u&&(s.id=u),u=s}u&&a.push(u)}return a},Mt("text/vtt",Hs),Mt('text/vtt; codecs="vtt"',Hs),qs.prototype.parseInit=function(t){var e=!1;if((new ai).G("moov",si).G("trak",si).G("mdia",si).ca("mdhd",function(t){0==t.version?(t.u.I(4),t.u.I(4),this.a=t.u.F(),t.u.I(4)):(t.u.I(8),t.u.I(8),this.a=t.u.F(),t.u.I(8)),t.u.I(4)}.bind(this)).G("minf",si).G("stbl",si).ca("stsd",oi).G("wvtt",function(){e=!0}).parse(t),!this.a)throw new h(2,2,2008);if(!e)throw new h(2,2,2008)},qs.prototype.parseMedia=function(t,e){var i=0,n=[],r=[],a=[],s=!1,o=!1,u=!1,c=null;if((new ai).G("moof",si).G("traf",si).ca("tfdt",function(t){s=!0,i=t.version?t.u.Va():t.u.F()}).ca("tfhd",function(t){var e=t.ec;t=t.u,t.I(4),1&e&&t.I(8),2&e&&t.I(4),c=8&e?t.F():null}).ca("trun",function(t){o=!0;var e=t.version,i=t.ec;t=t.u;var r=t.F();1&i&&t.I(4),4&i&&t.I(4);for(var a=[],s=0;s