aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorAnton Schubert2017-12-22 22:57:10 +0100
committerMaZderMind2018-01-24 23:33:20 +0100
commit80f79007a7ddcfe51b441ff601bdc65e4fa2d40e (patch)
treed9639790754f063b610754296b24a3678617dd48 /assets
parent152082d3525c9627c5b1c435ffe3d05807148784 (diff)
try to increase player robustness
Diffstat (limited to 'assets')
-rw-r--r--assets/clapprio/dash-shaka-playback.min.js2
1 files changed, 1 insertions, 1 deletions
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;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),u=i(1),h=i(2),c=function(t){return t&&t.__esModule?t:{default:t}}(h),l=function(t){function e(t){n(this,e);var i=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i._levels=[],i._pendingAdaptationEvent=!1,i._isShakaReadyState=!1,t.autoPlay&&i.play(),i}return a(e,t),o(e,[{key:"name",get:function(){return"dash_shaka_playback"}},{key:"shakaVersion",get:function(){return c.default.player.Player.version}},{key:"shakaPlayerInstance",get:function(){return this._player}},{key:"levels",get:function(){return this._levels}},{key:"currentLevel",set:function(t){var e=this;this._currentLevelId=t;var i=-1===this._currentLevelId;this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_START),i?(this._player.configure({abr:{enabled:!0}}),this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END)):(this._player.configure({abr:{enabled:!1}}),this._pendingAdaptationEvent=!0,this.selectTrack(this.videoTracks.filter(function(t){return t.id===e._currentLevelId})[0]))},get:function(){return this._currentLevelId||-1}}],[{key:"canPlay",value:function(t){var e=arguments.length>1&&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.length;++n){for(var r=!1,a=0;a<i.length&&!(r=e?e(t[n],i[a]):t[n]===i[a]);++a);r||i.push(t[n])}return i}function O(t,e,i){for(var n=0;n<t.length;++n)if(i(t[n],e))return n;return-1}function U(t,e){var i=t.indexOf(e);-1<i&&t.splice(i,1)}function j(){this.a={}}function B(){this.a=new j}function F(t,e,i,n){t.a&&(e=new K(e,i,n),t.a.push(i,e))}function V(t,e,i,n){F(t,e,i,function(t){this.ha(e,i),n(t)}.bind(t))}function H(t){if(t.a){var e,i=t.a,n=[];for(e in i.a)n.push.apply(n,i.a[e]);for(i=0;i<n.length;++i)n[i].ha();t.a.a={}}}function K(t,e,i){this.target=t,this.type=e,this.a=i,this.target.addEventListener(e,i,!1)}function G(e,i){var n,r=i||{};for(n in r)this[n]=r[n];this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=t.performance&&t.performance.now?t.performance.now():Date.now(),this.type=e,this.isTrusted=!1,this.target=this.currentTarget=null,this.a=!1}function q(t,e){if(!e.length)return t;var i=e.map(function(t){return new c(t)});return t.map(function(t){return new c(t)}).map(function(t){return i.map(t.resolve.bind(t))}).reduce(_,[]).map(function(t){return t.toString()})}function X(t,e){return{keySystem:t,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:e||[],keyIds:[]}}function Y(t){return!t||!Object.keys(t).length}function z(t){return Object.keys(t).map(function(e){return t[e]})}function $(t,e){return Object.keys(t).reduce(function(i,n){return i[n]=e(t[n],n),i},{})}function W(t,e){return Object.keys(t).every(function(i){return e(i,t[i])})}function J(t,e){Object.keys(t).forEach(function(i){e(i,t[i])})}function Q(t,e){var i=t;return e&&(i+='; codecs="'+e+'"'),i}function Z(t){if(!t)return"";t=new Uint8Array(t),239==t[0]&&187==t[1]&&191==t[2]&&(t=t.subarray(3)),t=escape(nt(t));try{return decodeURIComponent(t)}catch(t){throw new h(2,2,2004)}}function tt(t,e,i){if(!t)return"";if(!i&&t.byteLength%2)throw new h(2,2,2004);if(t instanceof ArrayBuffer)var n=t;else i=new Uint8Array(t.byteLength),i.set(new Uint8Array(t)),n=i.buffer;t=Math.floor(t.byteLength/2),i=new Uint16Array(t),n=new DataView(n);for(var r=0;r<t;r++)i[r]=n.getUint16(2*r,e);return nt(i)}function et(t){var e=new Uint8Array(t);if(239==e[0]&&187==e[1]&&191==e[2])return Z(e);if(254==e[0]&&255==e[1])return tt(e.subarray(2),!1);if(255==e[0]&&254==e[1])return tt(e.subarray(2),!0);var i=function(t,e){return t.byteLength<=e||32<=t[e]&&126>=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;i<t.length;++i)e[i]=t.charCodeAt(i);return e.buffer}function nt(t){for(var e="",i=0;i<t.length;i+=16e3)e+=String.fromCharCode.apply(null,t.subarray(i,i+16e3));return e}function rt(t){this.a=null,this.b=function(){this.a=null,t()}.bind(this)}function at(t,e){t.cancel(),t.a=setTimeout(t.b,1e3*e)}function st(t,e){t.cancel();var i=function(){this.b(),this.a=setTimeout(i,1e3*e)}.bind(t);t.a=setTimeout(i,1e3*e)}function ot(e,i){var n=void 0==i||i,r=t.btoa(String.fromCharCode.apply(null,e)).replace(/\+/g,"-").replace(/\//g,"_");return n?r:r.replace(/=*$/,"")}function ut(e){e=t.atob(e.replace(/-/g,"+").replace(/_/g,"/"));for(var i=new Uint8Array(e.length),n=0;n<e.length;++n)i[n]=e.charCodeAt(n);return i}function ht(e){for(var i=new Uint8Array(e.length/2),n=0;n<e.length;n+=2)i[n/2]=t.parseInt(e.substr(n,2),16);return i}function ct(t){for(var e="",i=0;i<t.length;++i){var n=t[i].toString(16);1==n.length&&(n="0"+n),e+=n}return e}function lt(t,e){if(!t&&!e)return!0;if(!t||!e||t.length!=e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!=e[i])return!1;return!0}function ft(t){this.s=t,this.l=this.j=this.w=null,this.L=!1,this.b=null,this.f=new B,this.a=[],this.m=[],this.i=new y,this.h=null,this.g=function(e){this.i.reject(e),t.onError(e)}.bind(this),this.C={},this.D=new rt(this.$d.bind(this)),this.ia=this.c=!1,this.J=[],this.X=!1,this.B=new rt(this.Zd.bind(this)),st(this.B,1),this.i.catch(function(){})}function dt(t,e){if(!t.j)return V(t.f,e,"encrypted",function(){this.g(new h(2,6,6010))}.bind(t)),Promise.resolve();t.l=e,V(t.f,t.l,"play",t.Gd.bind(t));var i=t.l.setMediaKeys(t.j),i=i.catch(function(t){return Promise.reject(new h(2,6,6003,t.message))}),n=null;return t.b.serverCertificate&&t.b.serverCertificate.length&&(n=t.j.setServerCertificate(t.b.serverCertificate).then(function(){}).catch(function(t){return Promise.reject(new h(2,6,6004,t.message))})),Promise.all([i,n]).then(function(){if(this.c)return Promise.reject();mt(this),this.b.initData.length||this.m.length||F(this.f,this.l,"encrypted",this.vd.bind(this))}.bind(t)).catch(function(t){return this.c?Promise.resolve():Promise.reject(t)}.bind(t))}function pt(t,e){return Promise.all(e.map(function(t){return St(this,t).then(function(t){if(t){for(var e=new y,i=0;i<this.a.length;i++)if(this.a[i].fa==t){this.a[i].na=e;break}return Promise.all([t.remove(),e])}}.bind(this))}.bind(t)))}function mt(t){var e=t.b?t.b.initData:[];return e.forEach(function(t){At(this,t.initDataType,t.initData)}.bind(t)),t.m.forEach(function(t){St(this,t)}.bind(t)),e.length||t.m.length||t.i.resolve(),t.i}function vt(t){return t.a.map(function(t){return t.fa.sessionId})}function gt(e,i,n,r,a){var s=Tt(e);i.periods.forEach(function(e){e.variants.forEach(function(e){s&&(e.drmInfos=[s]),e.drmInfos.forEach(function(i){yt(this,i),t.cast&&t.cast.__platform__&&"com.microsoft.playready"==i.keySystem&&(i.keySystem="com.chromecast.playready");var s=r[i.keySystem];s||(s={audioCapabilities:[],videoCapabilities:[],distinctiveIdentifier:"optional",persistentState:n?"required":"optional",sessionTypes:[n?"persistent-license":"temporary"],label:i.keySystem,drmInfos:[]},r[i.keySystem]=s,a.push(i.keySystem)),s.drmInfos.push(i),i.distinctiveIdentifierRequired&&(s.distinctiveIdentifier="required"),i.persistentStateRequired&&(s.persistentState="required");var o=[];e.video&&o.push(e.video),e.audio&&o.push(e.audio),o.forEach(function(t){("video"==t.type?s.videoCapabilities:s.audioCapabilities).push({robustness:("video"==t.type?i.videoRobustness:i.audioRobustness)||"",contentType:Q(t.mimeType,t.codecs)})}.bind(this))}.bind(this))}.bind(this))}.bind(e))}function bt(t,e,i){if(1==i.length&&""==i[0])return Promise.reject(new h(2,6,6e3));var n=new y,r=n;return[!0,!1].forEach(function(t){i.forEach(function(i){var n=e[i];n.drmInfos.some(function(t){return!!t.licenseServerUri})==t&&(n.audioCapabilities.length||delete n.audioCapabilities,n.videoCapabilities.length||delete n.videoCapabilities,r=r.catch(function(){return this.c?Promise.reject():navigator.requestMediaKeySystemAccess(i,[n])}.bind(this)))}.bind(this))}.bind(t)),r=r.catch(function(){return Promise.reject(new h(2,6,6001))}),r=r.then(function(t){if(this.c)return Promise.reject();var i=0<=navigator.userAgent.indexOf("Edge/"),n=t.getConfiguration();return this.w=(n.audioCapabilities||[]).concat(n.videoCapabilities||[]).map(function(t){return t.contentType}),i&&(this.w=null),i=e[t.keySystem],wt(this,t.keySystem,i,i.drmInfos),this.b.licenseServerUri?t.createMediaKeys():Promise.reject(new h(2,6,6012))}.bind(t)).then(function(t){if(this.c)return Promise.reject();this.j=t,this.L=!0}.bind(t)).catch(function(t){return this.c?Promise.resolve():(this.w=this.b=null,t instanceof h?Promise.reject(t):Promise.reject(new h(2,6,6002,t.message)))}.bind(t)),n.reject(),r}function yt(t,e){var i=e.keySystem;if(i){if(!e.licenseServerUri){var n=t.h.servers[i];n&&(e.licenseServerUri=n)}e.keyIds||(e.keyIds=[]),(i=t.h.advanced[i])&&(e.distinctiveIdentifierRequired||(e.distinctiveIdentifierRequired=i.distinctiveIdentifierRequired),e.persistentStateRequired||(e.persistentStateRequired=i.persistentStateRequired),e.videoRobustness||(e.videoRobustness=i.videoRobustness),e.audioRobustness||(e.audioRobustness=i.audioRobustness),e.serverCertificate||(e.serverCertificate=i.serverCertificate))}}function Tt(e){if(Y(e.h.clearKeys))return null;var i,n=[],r=[];for(i in e.h.clearKeys){var a=e.h.clearKeys[i],s=ht(i),a=ht(a),s={kty:"oct",kid:ot(s,!1),k:ot(a,!1)};n.push(s),r.push(s.kid)}return e=JSON.stringify({keys:n}),r=JSON.stringify({kids:r}),r=[{initData:new Uint8Array(it(r)),initDataType:"keyids"}],{keySystem:"org.w3.clearkey",licenseServerUri:"data:application/json;base64,"+t.btoa(e),distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:r,keyIds:[]}}function wt(t,e,i,n){var r=[],a=[],s=[],o=[];Et(n,r,a,s,o),t.b={keySystem:e,licenseServerUri:r[0],distinctiveIdentifierRequired:"required"==i.distinctiveIdentifier,persistentStateRequired:"required"==i.persistentState,audioRobustness:i.audioCapabilities?i.audioCapabilities[0].robustness:"",videoRobustness:i.videoCapabilities?i.videoCapabilities[0].robustness:"",serverCertificate:a[0],initData:s,keyIds:o}}function Et(t,e,i,n,r){function a(t,e){return!(!t.keyId||t.keyId!=e.keyId)||t.initDataType==e.initDataType&&lt(t.initData,e.initData)}t.forEach(function(t){if(-1==e.indexOf(t.licenseServerUri)&&e.push(t.licenseServerUri),t.serverCertificate&&-1==O(i,t.serverCertificate,lt)&&i.push(t.serverCertificate),t.initData&&t.initData.forEach(function(t){-1==O(n,t,a)&&n.push(t)}),t.keyIds)for(var s=0;s<t.keyIds.length;++s)-1==r.indexOf(t.keyIds[s])&&r.push(t.keyIds[s])})}function St(t,e){try{var i=t.j.createSession("persistent-license")}catch(e){var n=new h(2,6,6005,e.message);return t.g(n),Promise.reject(n)}F(t.f,i,"message",t.uc.bind(t)),F(t.f,i,"keystatuseschange",t.oc.bind(t));var r={initData:null,fa:i,loaded:!1,Gb:1/0,na:null};return t.a.push(r),i.load(e).then(function(t){if(!this.c){if(t)return r.loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve(),i;this.a.splice(this.a.indexOf(r),1),this.g(new h(2,6,6013))}}.bind(t),function(t){this.c||(this.a.splice(this.a.indexOf(r),1),this.g(new h(2,6,6005,t.message)))}.bind(t))}function At(t,e,i){try{var n=t.ia?t.j.createSession("persistent-license"):t.j.createSession()}catch(e){return void t.g(new h(2,6,6005,e.message))}F(t.f,n,"message",t.uc.bind(t)),F(t.f,n,"keystatuseschange",t.oc.bind(t)),t.a.push({initData:i,fa:n,loaded:!1,Gb:1/0,na:null}),n.generateRequest(e,i.buffer).catch(function(t){if(!this.c){for(var e=0;e<this.a.length;++e)if(this.a[e].fa==n){this.a.splice(e,1);break}this.g(new h(2,6,6006,t.message))}}.bind(t))}function kt(t,e){for(var i,n=e.target,r=0;r<t.a.length;r++)if(t.a[r].fa==n){i=t.a[r];break}r=L([t.b.licenseServerUri],t.h.retryParameters),r.body=e.message,r.method="POST","com.microsoft.playready"!=t.b.keySystem&&"com.chromecast.playready"!=t.b.keySystem||It(r),t.s.Sa.request(2,r).then(function(t){return this.c?Promise.reject():n.update(t.data).then(function(){this.s.onEvent(new G("drmsessionupdate")),i&&(i.na&&i.na.resolve(),setTimeout(function(){i.loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve()}.bind(this),5e3))}.bind(this))}.bind(t),function(t){if(this.c)return Promise.resolve();t=new h(2,6,6007,t),this.g(t),i&&i.na&&i.na.reject(t)}.bind(t)).catch(function(t){if(this.c)return Promise.resolve();t=new h(2,6,6008,t.message),this.g(t),i&&i.na&&i.na.reject(t)}.bind(t))}function It(t){var e=tt(t.body,!0,!0);if(-1==e.indexOf("PlayReadyKeyMessage"))t.headers["Content-Type"]="text/xml; charset=utf-8";else{for(var e=(new DOMParser).parseFromString(e,"application/xml"),i=e.getElementsByTagName("HttpHeader"),n=0;n<i.length;++n)t.headers[i[n].querySelector("name").textContent]=i[n].querySelector("value").textContent;t.body=ut(e.querySelector("Challenge").textContent).buffer}}function Pt(){var t=[],e=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],i=[{videoCapabilities:e,persistentState:"required",sessionTypes:["persistent-license"]},{videoCapabilities:e}],n={};return"org.w3.clearkey com.widevine.alpha com.microsoft.playready com.apple.fps.2_0 com.apple.fps.1_0 com.apple.fps com.adobe.primetime".split(" ").forEach(function(e){var r=navigator.requestMediaKeySystemAccess(e,i).then(function(t){var i=t.getConfiguration().sessionTypes,i=!!i&&0<=i.indexOf("persistent-license");return 0<=navigator.userAgent.indexOf("Tizen 3")&&(i=!1),n[e]={persistentState:i},t.createMediaKeys()}).catch(function(){n[e]=null});t.push(r)}),Promise.all(t).then(function(){return n})}function _t(t,e){var i=t.keySystem();return!e.drmInfos.length||e.drmInfos.some(function(t){return t.keySystem==i})}function xt(t,e){if(!t.length)return e;if(!e.length)return t;for(var i=[],n=0;n<t.length;n++)for(var r=0;r<e.length;r++)if(t[n].keySystem==e[r].keySystem){var a=t[n],r=e[r],s=[],s=s.concat(a.initData||[]),s=s.concat(r.initData||[]),o=[],o=o.concat(a.keyIds),o=o.concat(r.keyIds);i.push({keySystem:a.keySystem,licenseServerUri:a.licenseServerUri||r.licenseServerUri,distinctiveIdentifierRequired:a.distinctiveIdentifierRequired||r.distinctiveIdentifierRequired,persistentStateRequired:a.persistentStateRequired||r.persistentStateRequired,videoRobustness:a.videoRobustness||r.videoRobustness,audioRobustness:a.audioRobustness||r.audioRobustness,serverCertificate:a.serverCertificate||r.serverCertificate,initData:s,keyIds:o});break}return i}function Rt(t){return!t||1==t.length&&1e-6>t.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<t.length;i++)e.push({start:t.start(i),end:t.end(i)});return e}function Ct(t){this.f=null,this.c=t,this.h=this.i=0,this.g=1/0,this.b=this.a=null}function Mt(t,e){e.length?(o("The use of stateless text parsers is deprecated."),ao[t]=Ut.bind(null,e)):ao[t]=e}function Ot(t,e,i,n){return Promise.resolve().then(function(){if(this.f&&this.c)if(null==i||null==n)this.f.parseInit(e);else{var t=this.f.parseMedia(e,{periodStart:this.i,segmentStart:i,segmentEnd:n}).filter(function(t){return t.startTime>=this.h&&t.startTime<this.g}.bind(this));this.c.append(t),null==this.a&&(this.a=Math.max(i,this.h)),this.b=Math.min(n,this.g)}}.bind(t))}function Ut(t){this.Ta=t}function jt(t,e,i){this.g=t,this.f=e,this.j=i,this.b={},this.a=null,this.c={},this.h=new B,this.i=!1}function Bt(){var t={};return'video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="opus",audio/mp4; codecs="flac",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="av1",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",video/mp2t; codecs="mp4a.40.2",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").forEach(function(e){t[e]=!!ao[e]||MediaSource.isTypeSupported(e);var i=e.split(";")[0];t[i]=t[i]||t[e]}),t}function Ft(t,e){t.a||(t.a=new Ct(t.j)),t.a.f=new ao[e]}function Vt(t,e){if("text"==e)var i=t.a.a;else i=Ht(t,e),i=!i||1==i.length&&1e-6>i.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.width<e.minWidth||n.width>e.maxWidth||n.width>i.width||n.height<e.minHeight||n.height>e.maxHeight||n.height>i.height||n.width*n.height<e.minPixels||n.width*n.height>e.maxPixels)||t.bandwidth<e.minBandwidth||t.bandwidth>e.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;e<i.variants.length;++e){var a=i.variants[e],s=t,o=r,u=n;(s&&s.L&&!_t(s,a)?0:te(a.audio,s,o)&&te(a.video,s,u))||(i.variants.splice(e,1),--e)}for(e=0;e<i.textStreams.length;++e)t=i.textStreams[e],ao[Q(t.mimeType,t.codecs)]||(i.textStreams.splice(e,1),--e)}function te(t,e,i){if(!t)return!0;var n=null;e&&e.L&&(n=e.w),e=Q(t.mimeType,t.codecs);var r,a=t.mimeType;for(r in ro){var s=t[r],o=ro[r];s&&(a+="; "+o+'="'+s+'"')}return!(!ao[Q(t.mimeType,t.codecs)]&&!MediaSource.isTypeSupported(a)||n&&t.encrypted&&0>n.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.variants.length;i++)if(t.variants[i].id==e.id)return t.variants[i];return null}function re(t,e){for(var i=0;i<t.textStreams.length;i++)if(t.textStreams[i].id==e.id)return t.textStreams[i];return null}function ae(t){return t.filter(function(t){return t.allowedByApplication&&t.allowedByKeySystem})}function se(t,e,i,n){var r=ae(t.variants),a=r.filter(function(t){return t.primary});a.length||(a=r);var s=a.length?a[0].language:"",a=a.filter(function(t){return t.language==s});if(e){var o=Wt(e);[oo,so,0].forEach(function(t){var e=!1;r.forEach(function(i){o=Wt(o);var r=Wt(i.language);$t(t,o,r)&&(e?a.push(i):(a=[i],e=!0),n&&(n.audio=!0))})})}return i&&(t=ue(a,i),t.length)?t:(t=a.map(function(t){return(t.audio?t.audio.roles:[]).concat(t.video?t.video.roles:[])}).reduce(_,[]),t.length?ue(a,t[0]):a)}function oe(t,e,i,n){var r=t.textStreams,a=r.filter(function(t){return t.primary});a.length||(a=r);var s=a.length?a[0].language:"",a=a.filter(function(t){return t.language==s});if(e){var o=Wt(e);[oo,so,0].forEach(function(t){var e=!1;r.forEach(function(i){var r=Wt(i.language);$t(t,o,r)&&(e?a.push(i):(a=[i],e=!0),n&&(n.text=!0))})})}return i&&(t=he(a,i),t.length)?t:(t=a.map(function(t){return t.roles}).reduce(_,[]),t.length?he(a,t[0]):a)}function ue(t,e){return t.filter(function(t){return t.audio&&0<=t.audio.roles.indexOf(e)||t.video&&0<=t.video.roles.indexOf(e)})}function he(t,e){return t.filter(function(t){return 0<=t.roles.indexOf(e)})}function ce(t,e,i){for(var n=0;n<i.length;n++)if(i[n].audio==t&&i[n].video==e)return i[n];return null}function le(t,e,i){function n(t,e){return null==t?null==e:e.id==t}for(var r=0;r<i.length;r++)if(n(t,i[r].audio)&&n(e,i[r].video))return i[r];return null}function fe(t,e){for(var i=t.periods.length-1;0<i;--i)if(e+no>=t.periods[i].startTime)return i;return 0}function de(t,e){for(var i=0;i<t.periods.length;++i){var n=t.periods[i];if("text"==e.type){for(var r=0;r<n.textStreams.length;++r)if(n.textStreams[r]==e)return i}else for(r=0;r<n.variants.length;++r){var a=n.variants[r];if(a.audio==e||a.video==e||a.video&&a.video.trickModeVideo==e)return i}}return-1}function pe(){this.h=null,this.c=!1,this.b=new s,this.g=[],this.i=!1,this.a=this.f=null}function me(t,e){return e.filter(function(e){return Jt(e,t,{width:1/0,height:1/0})}).sort(function(t,e){return t.bandwidth-e.bandwidth})}function ve(t){return JSON.stringify(t,function(t,e){if("manager"!=t&&"function"!=typeof e){if(e instanceof Event||e instanceof G){var i,n={};for(i in e){var r=e[i];r&&"object"==typeof r?"detail"==i&&(n[i]=r):i in Event||(n[i]=r)}return n}if(e instanceof TimeRanges)for(n={__type__:"TimeRanges",length:e.length,start:[],end:[]},i=0;i<e.length;++i)n.start.push(e.start(i)),n.end.push(e.end(i));else n="number"==typeof e?isNaN(e)?"NaN":isFinite(e)?e:0>e?"-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<t?t:null}function Ve(t){return t=Number(t),!(t%1)&&0<=t?t:null}function He(t){var e;return t=(e=t.match(/^(\d+)\/(\d+)$/))?Number(e[1]/e[2]):Number(t),isNaN(t)?null:t}function Ke(t,e,i){t=Xe(t);var n=null,r=[],a=[],s=t.map(function(t){return t.keyId}).filter(R);if(s.length&&1<s.filter(N).length)throw new h(2,4,4010);i||(a=t.filter(function(t){return"urn:mpeg:dash:mp4protection:2011"!=t.Dc||(n=t.init||n,!1)}),a.length&&(r=qe(n,e,a),r.length||(r=[X("",n)]))),!t.length||!i&&a.length||(r=z(Ao).map(function(t){return X(t,n)}));var o=s[0]||null;return o&&r.forEach(function(t){t.initData.forEach(function(t){t.keyId=o})}),{ac:o,Se:n,drmInfos:r,dc:!0}}function Ge(t,e,i,n){var r=Ke(t,e,n);if(i.dc)t=1==i.drmInfos.length&&!i.drmInfos[0].keySystem,e=!r.drmInfos.length,(!i.drmInfos.length||t&&!e)&&(i.drmInfos=r.drmInfos),i.dc=!1;else if(0<r.drmInfos.length&&(i.drmInfos=i.drmInfos.filter(function(t){return r.drmInfos.some(function(e){return e.keySystem==t.keySystem})}),!i.drmInfos.length))throw new h(2,4,4008);return r.ac||i.ac}function qe(t,e,i){return i.map(function(i){var n=Ao[i.Dc];return n?[X(n,i.init||t)]:e(i.node)||[]}).reduce(_,[])}function Xe(t){return t.map(function(t){var e=t.getAttribute("schemeIdUri"),i=t.getAttribute("cenc:default_KID"),n=Le(t,"cenc:pssh").map(Ce);if(!e)return null;if(e=e.toLowerCase(),i&&(i=i.replace(/-/g,"").toLowerCase(),0<=i.indexOf(" ")))throw new h(2,4,4009);var r=[];try{r=n.map(function(t){return{initDataType:"cenc",initData:ut(t),keyId:null}})}catch(t){throw new h(2,4,4007)}return{node:t,Dc:e,keyId:i,init:0<r.length?r:null}}).filter(R)}function Ye(e,i,n,r,a){null!=a&&(a=Math.round(a));var s={RepresentationID:i,Number:n,Bandwidth:r,Time:a};return e.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)d)?\$/g,function(e,i,n){if("$$"==e)return"$";var r=s[i];return null==r?e:("RepresentationID"==i&&n&&(n=void 0),e=r.toString(),n=t.parseInt(n,10)||1,Array(Math.max(0,n-e.length)+1).join("0")+e)})}function ze(t,e){var i=$e(t,e,"timescale"),n=1;i&&(n=Fe(i)||1),i=$e(t,e,"duration"),(i=Fe(i||""))&&(i/=n);var r=$e(t,e,"startNumber"),a=Number($e(t,e,"presentationTimeOffset"))||0,s=Ve(r||"");null!=r&&null!=s||(s=1);var o=We(t,e,"SegmentTimeline"),r=null;if(o){for(var r=n,u=t.S.duration||1/0,o=Le(o,"S"),h=[],c=0,l=0;l<o.length;++l){var f=o[l],d=Me(f,"t",Ve),p=Me(f,"d",Ve),f=Me(f,"r",Be);if(null!=d&&(d-=a),!p)break;if(d=null!=d?d:c,0>(f=f||0))if(l+1<o.length){if(null==(f=Me(o[l+1],"t",Ve)))break;if(d>=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<h.length&&d!=c&&(h[h.length-1].end=d/r);for(var m=0;m<=f;++m)c=d+p,h.push({start:d/r,end:c/r,Je:d}),d=c}r=h}return{timescale:n,P:i,ya:s,Z:a/n||0,Xb:a,H:r}}function $e(t,e,i){return[e(t.A),e(t.V),e(t.Y)].filter(R).map(function(t){return t.getAttribute(i)}).reduce(function(t,e){return t||e})}function We(t,e,i){return[e(t.A),e(t.V),e(t.Y)].filter(R).map(function(t){return De(t,i)}).reduce(function(t,e){return t||e})}function Je(t,e){var i=new DOMParser;try{var n=Z(t),r=i.parseFromString(n,"text/xml")}catch(t){}if(r&&r.documentElement.tagName==e)var a=r.documentElement;return a&&0<a.getElementsByTagName("parsererror").length?null:a}function Qe(t,e,i,n,r,a){for(var s=t.getAttribute("xlink:href"),o=t.getAttribute("xlink:actuate")||"onRequest",u=0;u<t.attributes.length;u++){var c=t.attributes[u].nodeName;-1!=c.indexOf("xlink:")&&(t.removeAttribute(c),--u)}if(5<=a)return Promise.reject(new h(2,4,4028));if("onLoad"!=o)return Promise.reject(new h(2,4,4027));var l=q([n],[s]);return r.request(0,L(l,e)).then(function(n){if(!(n=Je(n.data,t.tagName)))return Promise.reject(new h(2,4,4001,s));for(;t.childNodes.length;)t.removeChild(t.childNodes[0]);for(;n.childNodes.length;){var o=n.childNodes[0];n.removeChild(o),t.appendChild(o)}for(o=0;o<n.attributes.length;o++){var u=n.attributes[o].nodeName,c=n.getAttribute(u);t.setAttribute(u,c)}return Ze(t,e,i,l[0],r,a+1)}.bind(t))}function Ze(t,e,i,n,r,a){if(a=a||0,t.getAttribute("xlink:href")){var s=Qe(t,e,i,n,r,a);return i&&(s=s.catch(function(){return Ze(t,e,i,n,r,a)})),s}for(s=0;s<t.childNodes.length;s++){var o=t.childNodes[s];o instanceof Element&&"urn:mpeg:dash:resolve-to-zero:2013"==o.getAttribute("xlink:href")&&(t.removeChild(o),--s)}for(var u=[],s=0;s<t.childNodes.length;s++)o=t.childNodes[s],o.nodeType==Node.ELEMENT_NODE&&(o=Ze(o,e,i,n,r,a),u.push(o));return Promise.all(u).then(function(){return t})}function ti(t,e,i){this.a=t,this.T=e,this.K=i}function ei(t,e,i,n,r,a){this.position=t,this.startTime=e,this.endTime=i,this.a=n,this.T=r,this.K=a}function ii(t,e){this.O=t,this.a=e==ko,this.v=0}function ni(){throw new h(2,3,3e3)}function ri(t,e,i){var n=new Uint8Array(i-e);return n.set(new Uint8Array(t.O.buffer,e,i-e)),n.buffer}function ai(){this.b=[],this.a=[]}function si(t){for(;t.u.da();)t.Ta.qb(t.start,t.u)}function oi(t){for(var e=t.u.F();0<e;--e)t.Ta.qb(t.start,t.u)}function ui(t){return function(e){t(e.u.Ja(e.u.O.byteLength-e.u.v))}}function hi(t){for(var e=0,i=0;i<t.length;i++)e=e<<8|t.charCodeAt(i);return e}function ci(t,e,i,n){var r,a=(new ai).ca("sidx",function(t){r=li(e,n,i,t)});if(t&&a.parse(t),r)return r;throw new h(2,3,3004)}function li(t,e,i,n){var r=[];n.u.I(4);var a=n.u.F();if(!a)throw new h(2,3,3005);if(n.version)var s=n.u.Va(),o=n.u.Va();else s=n.u.F(),o=n.u.F();n.u.I(2);var u=n.u.yc();for(t=t+n.size+o,o=0;o<u;o++){var c=n.u.F(),l=(2147483648&c)>>>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<no&&(t.a[0]=new ei(i.position,0,i.endTime,i.a,i.T,i.K)),i=t.a[t.a.length-1],t.a[t.a.length-1]=new ei(i.position,i.startTime,e,i.a,i.T,i.K))}function pi(t){this.b=t,this.a=new ii(t,0),Io||(Io=[new Uint8Array([255]),new Uint8Array([127,255]),new Uint8Array([63,255,255]),new Uint8Array([31,255,255,255]),new Uint8Array([15,255,255,255,255]),new Uint8Array([7,255,255,255,255,255]),new Uint8Array([3,255,255,255,255,255,255]),new Uint8Array([1,255,255,255,255,255,255,255])])}function mi(t){var e=vi(t);if(7<e.length)throw new h(2,3,3002);for(var i=0,n=0;n<e.length;n++)i=256*i+e[n];e=i,i=vi(t);t:{for(n=0;n<Io.length;n++)if(lt(i,Io[n])){n=!0;break t}n=!1}if(n)i=t.b.byteLength-t.a.v;else{if(8==i.length&&224&i[1])throw new h(2,3,3001);for(var n=i[0]&(1<<8-i.length)-1,r=1;r<i.length;r++)n=256*n+i[r];i=n}return i=t.a.v+i<=t.b.byteLength?i:t.b.byteLength-t.a.v,n=new DataView(t.b.buffer,t.b.byteOffset+t.a.v,i),t.a.I(i),new gi(e,n)}function vi(t){var e,i=t.a.Mb();for(e=1;8>=e&&!(i&1<<8-e);e++);if(8<e)throw new h(2,3,3002);var n=new Uint8Array(e);for(n[0]=i,i=1;i<e;i++)n[i]=t.a.Mb();return n}function gi(t,e){this.id=t,this.a=e}function bi(t){if(8<t.a.byteLength)throw new h(2,3,3002);if(8==t.a.byteLength&&224&t.a.getUint8(0))throw new h(2,3,3001);for(var e=0,i=0;i<t.a.byteLength;i++)var n=t.a.getUint8(i),e=256*e+n;return e}function yi(){}function Ti(t,e,i,n,r,a){function s(){return r}var o=[];t=new pi(t.a);for(var u=null,h=null;t.da();){var c=mi(t);if(187==c.id){var l=wi(c);l&&(c=i*l.Ke,l=e+l.ce,null!=u&&o.push(new ei(o.length,u-a,c-a,s,h,l-1)),u=c,h=l)}}return null!=u&&o.push(new ei(o.length,u-a,n-a,s,h,null)),o}function wi(t){var e=new pi(t.a);if(t=mi(e),179!=t.id)throw new h(2,3,3013);if(t=bi(t),e=mi(e),183!=e.id)throw new h(2,3,3012);for(var e=new pi(e.a),i=0;e.da();){var n=mi(e);if(241==n.id){i=bi(n);break}}return{Ke:t,ce:i}}function Ei(t,e){var i=We(t,e,"Initialization");if(!i)return null;var n=t.A.$,r=i.getAttribute("sourceURL");r&&(n=q(t.A.$,[r]));var r=0,a=null;return(i=Me(i,"range",je))&&(r=i.start,a=i.end),new ti(function(){return n},r,a)}function Si(t,e){var i=Number($e(t,ki,"presentationTimeOffset"))||0,n=$e(t,ki,"timescale"),r=1;n&&(r=Fe(n)||1);var i=i/r||0,n=Ei(t,ki),a=t.A.contentType,r=t.A.mimeType.split("/")[1];if("text"!=a&&"mp4"!=r&&"webm"!=r)throw new h(2,4,4006);if("webm"==r&&!n)throw new h(2,4,4005);var a=We(t,ki,"RepresentationIndex"),s=$e(t,ki,"indexRange"),o=t.A.$,s=je(s||"");if(a){var u=a.getAttribute("sourceURL");u&&(o=q(t.A.$,[u])),s=Me(a,"range",je,s)}if(!s)throw new h(2,4,4002);return r=Ai(t,e,n,o,s.start,s.end,r,i),{createSegmentIndex:r.createSegmentIndex,findSegmentPosition:r.findSegmentPosition,getSegmentReference:r.getSegmentReference,initSegmentReference:n,Z:i}}function Ai(t,e,i,n,r,a,s,o){var u=t.presentationTimeline,h=!t.Ca||!t.S.Ab,c=t.S.duration,l=e,f=null;return{createSegmentIndex:function(){var t=[l(n,r,a),"webm"==s?l(i.a(),i.T,i.K):null];return l=null,Promise.all(t).then(function(t){var e=t[0];t=t[1]||null,e="mp4"==s?ci(e,r,n,o):(new yi).parse(e,t,n,o),u.Ga(0,e),f=new fi(e),h&&di(f,c)})},findSegmentPosition:function(t){return f.find(t)},getSegmentReference:function(t){return f.get(t)}}}function ki(t){return t.Wa}function Ii(t,e){var i=Ei(t,Pi),n=xi(t),r=ze(t,Pi),a=r.ya;a||(a=1);var s=0;if(r.P?s=r.P*(a-1):r.H&&0<r.H.length&&(s=r.H[0].start),n={P:r.P,startTime:s,ya:a,Z:r.Z,H:r.H,Fa:n},!n.P&&!n.H&&1<n.Fa.length)throw new h(2,4,4002);if(!n.P&&!t.S.duration&&!n.H&&1==n.Fa.length)throw new h(2,4,4002);if(n.H&&!n.H.length)throw new h(2,4,4002);return a=r=null,t.Y.id&&t.A.id&&(a=t.Y.id+","+t.A.id,r=e[a]),s=_i(t.S.duration,n.ya,t.A.$,n),r?(r.ob(s),r.xb(t.presentationTimeline.ka()-t.S.start)):(t.presentationTimeline.Ga(0,s),r=new fi(s),a&&t.Ca&&(e[a]=r)),t.Ca&&t.S.Ab||di(r,t.S.duration),{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:r.find.bind(r),getSegmentReference:r.get.bind(r),initSegmentReference:i,Z:n.Z}}function Pi(t){return t.pa}function _i(t,e,i,n){var r=n.Fa.length;n.H&&n.H.length!=n.Fa.length&&(r=Math.min(n.H.length,n.Fa.length));for(var a=[],s=n.startTime,o=0;o<r;o++){var u=n.Fa[o],h=q(i,[u.sd]),c=null!=n.P?s+n.P:n.H?n.H[o].end:s+t;a.push(new ei(o+e,s,c,function(t){return t}.bind(null,h),u.start,u.end)),s=c}return a}function xi(t){return[t.A.pa,t.V.pa,t.Y.pa].filter(R).map(function(t){return Le(t,"SegmentURL")}).reduce(function(t,e){return 0<t.length?t:e}).map(function(e){e.getAttribute("indexRange")&&!t.ic&&(t.ic=!0);var i=e.getAttribute("media");return e=Me(e,"mediaRange",je,{start:0,end:null}),{sd:i,start:e.start,end:e.end}})}function Ri(t,e,i,n){var r=Ci(t),a=ze(t,Ni),s=$e(t,Ni,"media"),o=$e(t,Ni,"index");if(a={P:a.P,timescale:a.timescale,ya:a.ya,Z:a.Z,Xb:a.Xb,H:a.H,Db:s,Ra:o},s=0+(a.Ra?1:0),s+=a.H?1:0,!(s+=a.P?1:0))throw new h(2,4,4002);if(1!=s&&(a.Ra&&(a.H=null),a.P=null),!a.Ra&&!a.Db)throw new h(2,4,4002);if(a.Ra){if("mp4"!=(i=t.A.mimeType.split("/")[1])&&"webm"!=i)throw new h(2,4,4006);if("webm"==i&&!r)throw new h(2,4,4005);n=Ye(a.Ra,t.A.id,null,t.bandwidth||null,null),n=q(t.A.$,[n]),t=Ai(t,e,r,n,0,null,i,a.Z)}else a.P?(n||t.presentationTimeline.Eb(a.P),t=Di(t,a)):(n=e=null,t.Y.id&&t.A.id&&(n=t.Y.id+","+t.A.id,e=i[n]),s=Li(t,a),e?(e.ob(s),e.xb(t.presentationTimeline.ka()-t.S.start)):(t.presentationTimeline.Ga(0,s),e=new fi(s),n&&t.Ca&&(i[n]=e)),t.Ca&&t.S.Ab||di(e,t.S.duration),t={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.find.bind(e),getSegmentReference:e.get.bind(e)});return{createSegmentIndex:t.createSegmentIndex,findSegmentPosition:t.findSegmentPosition,getSegmentReference:t.getSegmentReference,initSegmentReference:r,Z:a.Z}}function Ni(t){return t.Xa}function Di(t,e){var i=t.S.duration,n=e.P,r=e.ya,a=e.timescale,s=e.Db,o=t.bandwidth||null,u=t.A.id,h=t.A.$;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(t){return 0>t||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;n<e.H.length;n++){var r=n+e.ya;i.push(new ei(r,e.H[n].start,e.H[n].end,function(t,e,i,n,r,a){return t=Ye(t,e,r,i,a),q(n,[t]).map(function(t){return t.toString()})}.bind(null,e.Db,t.A.id,t.bandwidth||null,t.A.$,r,e.H[n].Je+e.Xb),0,null))}return i}function Ci(t){var e=$e(t,Ni,"initialization");if(!e)return null;var i=t.A.id,n=t.bandwidth||null,r=t.A.$;return new ti(function(){var t=Ye(e,i,null,n,null);return q(r,[t])},0,null)}function Mi(){var t,e={};for(t in Po)e[t]=!0;for(t in _o)e[t]=!0;return["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"].forEach(function(t){e[t]=!!Po[t]}),["mpd","m3u8","ism"].forEach(function(t){e[t]=!!_o[t]}),e}function Oi(t,e,i,n){var r=n;return r||(n=new c(t).ba.split("/").pop().split("."),1<n.length&&(n=n.pop().toLowerCase(),r=_o[n])),r?Promise.resolve(r):(i=L([t],i),i.method="HEAD",e.request(0,i).then(function(e){return(e=e.headers["content-type"])&&(e=e.toLowerCase()),(r=Po[e])?r:Promise.reject(new h(2,4,4e3,t))},function(t){return t.severity=2,Promise.reject(t)}))}function Ui(t,e){this.c=t,this.j=e,this.f=this.a=1/0,this.b=1,this.i=0,this.h=!0,this.g=0}function ji(){this.a=this.b=null,this.g=[],this.c=null,this.i=[],this.h=1,this.j={},this.l=0,this.f=null}function Bi(t){return t.a.networkingEngine.request(0,L(t.g,t.b.retryParameters),function(){return!this.a}.bind(t)).then(function(t){if(this.a)return Fi(this,t.data,t.uri)}.bind(t))}function Fi(t,e,i){if(!(e=Je(e,"MPD")))throw new h(2,4,4001,i);return Ze(e,t.b.retryParameters,t.b.dash.xlinkFailGracefully,i,t.a.networkingEngine).then(function(t){return Vi(this,t,i)}.bind(t))}function Vi(t,e,i){i=[i];var n=Le(e,"Location").map(Ce).filter(R);0<n.length&&(i=t.g=n),n=Le(e,"BaseURL").map(Ce),i=q(i,n);var r=Me(e,"minBufferTime",Ue);t.l=Me(e,"minimumUpdatePeriod",Ue,-1);var a=Me(e,"availabilityStartTime",Oe),n=Me(e,"timeShiftBufferDepth",Ue),s=Me(e,"suggestedPresentationDelay",Ue),o=Me(e,"maxSegmentDuration",Ue),u=e.getAttribute("type")||"static";if(t.c)var h=t.c.presentationTimeline;else{var c=Math.max(10,1.5*r);h=new Ui(a,null!=s?s:c)}var a=Hi(t,{Ca:"static"!=u,presentationTimeline:h,Y:null,S:null,V:null,A:null,bandwidth:0,ic:!1},i,e),s=a.duration,l=a.periods;return h.rb("static"==u),"static"!=u&&a.bc||h.ga(s||1/0),h.Ic(null!=n?n:1/0),h.Eb(o||1),t.c?Promise.resolve():(e=Le(e,"UTCTiming"),Ji(t,i,e,h.R()).then(function(t){this.a&&(h.Gc(t),this.c={presentationTimeline:h,periods:l,offlineSessionIds:[],minBufferTime:r||0})}.bind(t)))}function Hi(t,e,i,n){var r=Me(n,"mediaPresentationDuration",Ue),a=[],s=0;n=Le(n,"Period");for(var o=0;o<n.length;o++){var u=n[o],s=Me(u,"start",Ue,s),h=Me(u,"duration",Ue),c=null;if(o!=n.length-1){var l=Me(n[o+1],"start",Ue);null!=l&&(c=l-s)}else null!=r&&(c=r-s);if(null==c&&(c=h),u=Ki(t,e,i,{start:s,duration:c,node:u,Ab:null==c||o==n.length-1}),a.push(u),h=e.Y.id,-1==t.i.indexOf(h)&&(t.i.push(h),t.c&&(t.a.filterNewPeriod(u),t.c.periods.push(u))),null==c){s=null;break}s+=c}return t.c||t.a.filterAllPeriods(a),null!=r?{periods:a,duration:r,bc:!1}:{periods:a,duration:s,bc:!0}}function Ki(t,e,i,n){e.Y=Yi(n.node,null,i),e.S=n,e.Y.id||(e.Y.id="__shaka_period_"+n.start),Le(n.node,"EventStream").forEach(t.Vd.bind(t,n.start,n.duration)),i=Le(n.node,"AdaptationSet").map(t.Td.bind(t,e)).filter(R);var r=i.map(function(t){return t.ee}).reduce(_,[]),a=r.filter(N);if(e.Ca&&r.length!=a.length)throw new h(2,4,4018);var s=i.filter(function(t){return!t.Wb});if(i.filter(function(t){return t.Wb}).forEach(function(t){var e=t.streams[0],i=t.Wb;s.forEach(function(t){t.id==i&&t.streams.forEach(function(t){t.trickModeVideo=e})})}),r=Gi(s,"video"),a=Gi(s,"audio"),!r.length&&!a.length)throw new h(2,4,4004);for(a.length||(a=[null]),r.length||(r=[null]),e=[],i=0;i<a.length;i++)for(var o=0;o<r.length;o++)qi(t,a[i],r[o],e);for(t=Gi(s,"text"),r=[],i=0;i<t.length;i++)r.push.apply(r,t[i].streams);return{startTime:n.start,textStreams:r,variants:e}}function Gi(t,e){return t.filter(function(t){return t.contentType==e})}function qi(t,e,i,n){if(e||i)if(e&&i){var r=e.drmInfos,a=i.drmInfos;if(r.length&&a.length?0<xt(r,a).length:1)for(var s=xt(e.drmInfos,i.drmInfos),r=0;r<e.streams.length;r++)for(var o=0;o<i.streams.length;o++)a=(i.streams[o].bandwidth||0)+(e.streams[r].bandwidth||0),a={id:t.h++,language:e.language,primary:e.Cb||i.Cb,audio:e.streams[r],video:i.streams[o],bandwidth:a,drmInfos:s,allowedByApplication:!0,allowedByKeySystem:!0},n.push(a)}else for(s=e||i,r=0;r<s.streams.length;r++)a=s.streams[r].bandwidth||0,a={id:t.h++,language:s.language||"und",primary:s.Cb,audio:e?s.streams[r]:null,video:i?s.streams[r]:null,bandwidth:a,drmInfos:s.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},n.push(a)}function Xi(e,i){0>e.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<t.length;++e){var i=t[e],n=i.getAttribute("schemeIdUri");if(n&&(i=i.getAttribute("value")))switch(n){case"urn:mpeg:dash:outputChannelPositionList:2012":return i.trim().split(/ +/).length;case"urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case"urn:dts:dash:audio_channel_configuration:2012":if(!(n=parseInt(i,10)))continue;return n;case"tag:dolby.com,2014:dash:audio_channel_configuration:2011":case"urn:dolby:dash:audio_channel_configuration:2011":if(n=parseInt(i,16)){for(t=0;n;)1&n&&++t,n>>=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;a<n.length;)if(/^#(?!EXT)/m.test(n[a]))a+=1;else{var s=n[a];if(s=pn(t.a++,s),0<=xo.indexOf(s.name))e=1;else if(0<=Ro.indexOf(s.name)){if(1!=e)throw new h(2,4,4017);return n=n.splice(a,n.length-a),t=dn(t,n,r),new Zi(i,e,r,t)}r.push(s),a+=1,"EXT-X-STREAM-INF"==s.name&&(s.a.push(new en("URI",n[a])),a+=1)}return new Zi(i,e,r)}function dn(t,e,i){var n=[],r=[];return e.forEach(function(t){/^(#EXT)/.test(t)?(t=pn(this.a++,t),0<=xo.indexOf(t.name)?i.push(t):r.push(t)):/^#(?!EXT)/m.test(t)||(n.push(new rn(t.trim(),r)),r=[])}.bind(t)),n}function pn(t,e){var i=e.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!i)throw new h(2,4,4016);var n=i[1],r=i[2],i=[];if(r&&0<=r.indexOf("="))for(var a,r=new un(r),s=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;a=hn(r,s);)i.push(new en(a[1],a[2]||a[3]));else if(r)return new tn(t,n,i,r);return new tn(t,n,i)}function mn(t){return new Promise(function(e){var i=mn.parse(t);e({uri:t,data:i.data,headers:{"content-type":i.contentType}})})}function vn(){this.h=this.b=null,this.D=1,this.g={},this.C={},this.j={},this.s={},this.a=null,this.m="",this.w=new ln,this.i=this.c=null,this.f=!1,this.B=null,this.l=0}function gn(t,e,i){Bn(t,i).then(function(t){if(t=fn(this.w,t.data,t.uri),1!=t.type)throw new h(2,4,4017);for(var i=sn(t.U,"EXT-X-MEDIA-SEQUENCE"),i=Nn(this,t,i?Number(i.value):0),n=e.Bb,r=[],a=n.endTime,s=0;s<i.length;s++){var o=i[s];if(o.position>n.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;u<e.length;u++)for(var h=0;h<i.length;h++){var c=e[u]?e[u].stream:null,l=i[h]?i[h].stream:null,f=e[u]?e[u].drmInfos:null,d=i[h]?i[h].drmInfos:null;if(c&&l){if(!(f.length&&d.length?0<xt(f,d).length:1))continue;var p=xt(f,d)}else c?p=f:l&&(p=d);f=(i[u]?i[u].Pb:"")+" - "+(e[u]?e[u].Pb:""),t.C[f]||(c=En(t,c,l,n,p),o.push(c),t.C[f]=c)}return o}function En(t,e,i,n,r){return{id:t.D++,language:e?e.language:"und",primary:!!e&&e.primary||!!i&&i.primary,audio:e,video:i,bandwidth:n,drmInfos:r,allowedByApplication:!0,allowedByKeySystem:!0}}function Sn(t,e,i){return Un(e,"TYPE"),i=On(t,i),An(t,e,[],i).then(function(t){return t.stream})}function An(t,e,i,n){if(t.g[e.id])return Promise.resolve().then(function(){return this.g[e.id]}.bind(t));var r=Un(e,"TYPE").toLowerCase();"subtitles"==r&&(r="text");var a=Wt(nn(e,"LANGUAGE","und")),s=nn(e,"NAME"),o=e.getAttribute("DEFAULT"),u=e.getAttribute("AUTOSELECT"),h=nn(e,"CHANNELS"),h="audio"==r?kn(h):null,c=Un(e,"URI"),c=q([t.m],[c])[0];return Pn(t,c,i,r,n,a,!!o||!!u,s,h).then(function(t){return this.g[e.id]=t,this.s[c]=t}.bind(t))}function kn(t){return t?(t=t.split("/")[0],parseInt(t,10)):null}function In(t,e,i,n,r){var a=Un(e,"URI"),a=q([t.m],[a])[0];return Pn(t,a,i,n,r,"und",!1,null,null).then(function(t){return this.s[a]=t}.bind(t))}function Pn(t,e,i,n,r,a,s,o,u){var c=e;return e=q([t.m],[e])[0],Bn(t,e).then(function(t){if(t=fn(this.w,t.data,t.uri),1!=t.type)throw new h(2,4,4017);var e=sn(t.U,"EXT-X-MEDIA-SEQUENCE"),l=Nn(this,t,e?Number(e.value):0),f=new fi(l);_n(this,t),this.a||xn(this,l[l.length-1].endTime),r=On(this,t)||r;var d=null;if("text"!=n&&(d=Rn(t)),this.a.Ga(0,l),!this.f){var e=l[l.length-1].endTime-l[0].startTime,p=this.a.W();(1/0==p||p<e)&&this.a.ga(e)}var m=Cn(n,i),v=void 0;"text"==n&&(v="subtitle");var g=[];t.segments.forEach(function(t){t=an(t.U,"EXT-X-KEY"),g.push.apply(g,t)});var b=!1,y=[],T=null;if(g.forEach(function(t){if("NONE"!=Un(t,"METHOD")){b=!0;var e=Un(t,"KEYFORMAT");(t=(e=Lo[e])?e(t):null)&&(t.keyIds.length&&(T=t.keyIds[0]),y.push(t))}}),b&&!y.length)throw new h(2,4,4026);return Mn(this,n,m,l[0].a()[0]).then(function(t){return t={id:this.D++,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:f.find.bind(f),getSegmentReference:f.get.bind(f),initSegmentReference:d,presentationTimeOffset:r||0,mimeType:t,codecs:m,kind:v,encrypted:b,keyId:T,language:a,label:o||null,type:n,primary:s,trickModeVideo:null,containsEmsgBoxes:!1,frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:u},this.j[t.id]=f,{stream:t,je:f,drmInfos:y,Pb:c,Bb:l[l.length-1]}}.bind(this))}.bind(t))}function _n(t,e){var i=sn(e.U,"EXT-X-PLAYLIST-TYPE");if(sn(e.U,"EXT-X-ENDLIST")||i&&"VOD"==i.value)Vn(t,!1);else{if(!i)throw new h(2,4,4029);i=jn(e.U,"EXT-X-TARGETDURATION"),i=Number(i.value),t.c?t.c>i&&(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<e.length)throw new h(2,4,4020);var e=e[0],i=Un(e,"URI"),n=q([t.uri],[i])[0];return t=0,i=null,(e=nn(e,"BYTERANGE"))&&(t=e.split("@"),e=Number(t[0]),t=Number(t[1]),i=t+e-1),new ti(function(){return[n]},t,i)}function Nn(t,e,i){var n=e.segments,r=[];return n.forEach(function(t){var a,s=t.U,o=q([e.uri],[t.uri])[0],u=jn(s,"EXTINF").value.split(","),u=Number(u[0]);a=(t=n.indexOf(t))?r[t-1].endTime:0;var u=a+u,h=0,c=null;(s=sn(s,"EXT-X-BYTERANGE"))&&(s=s.value.split("@"),c=Number(s[0]),h=s[1]?Number(s[1]):r[t-1].K+1,c=h+c-1,t==n.length-1&&(c=null)),r.push(new ei(i+t,a,u,function(){return[o]},h,c))}.bind(t)),r}function Dn(t,e){e.forEach(function(t){var e=this.a.W(),i=t.video;t=t.audio,i&&this.j[i.id]&&di(this.j[i.id],e),t&&this.j[t.id]&&di(this.j[t.id],e)}.bind(t))}function Ln(t,e){for(var i=No[t],n=0;n<i.length;n++)for(var r=0;r<e.length;r++)if(i[n].test(e[r].trim()))return e[r].trim();return"text"==t?"":null}function Cn(t,e){if(1==e.length)return e[0];var i=Ln(t,e);if(null!=i)return i;throw new h(2,4,4025,e)}function Mn(t,e,i,n){var r=n.split("."),a=r[r.length-1];return(r=Do[e][a])?Promise.resolve(r):"text"==e?i&&"vtt"!=i?Promise.resolve("application/mp4"):Promise.resolve("text/vtt"):(e=L([n],t.h.retryParameters),e.method="HEAD",t.b.networkingEngine.request(1,e).then(function(t){if(!(t=t.headers["content-type"]))throw new h(2,4,4021,a);return t.split(";")[0]}))}function On(t,e){var i=sn(e.U,"EXT-X-START");return i?Number(Un(i,"TIME-OFFSET")):t.h.hls.defaultTimeOffset}function Un(t,e){var i=t.getAttribute(e);if(!i)throw new h(2,4,4023,e);return i.value}function jn(t,e){var i=sn(t,e);if(!i)throw new h(2,4,4024,e);return i}function Bn(t,e){return t.b.networkingEngine.request(0,L([e],t.h.retryParameters),function(){return!this.b}.bind(t))}function Fn(e,i){null!=e.c&&null!=i&&(e.i=t.setTimeout(e.J.bind(e),1e3*i))}function Vn(e,i){e.f=i,e.a&&e.a.rb(!i),i||null==e.i||(t.clearTimeout(e.i),e.i=null,e.c=null)}function Hn(t,e,i,n,r,a){this.a=t,this.c=e,this.l=i,this.m=null==n?null:Gn(this,n),this.L=r,this.J=a,this.b=new B,this.j=!1,this.i=1,this.h=this.f=null,this.g=new rt(this.ud.bind(this)),this.D=t.readyState,this.s=!1,this.C=this.X=-1,this.w=this.B=!1,0<t.readyState?this.pc():(V(this.b,t,"loadedmetadata",this.pc.bind(this)),F(this.b,t,"timeupdate",function(){at(this.g,.1)}.bind(this))),e=this.rc.bind(this),F(this.b,t,"ratechange",this.Hd.bind(this)),F(this.b,t,"waiting",e),this.h=new rt(e),st(this.h,.25)}function Kn(t,e){0<t.a.readyState?t.a.currentTime=Wn(t,e):t.m=e}function Gn(t,e){var i=t.c.presentationTimeline.W();return e>=i?i-t.l.durationBackoff:e}function qn(t){return 0<t.a.readyState?t.a.paused?t.a.currentTime:Wn(t,t.a.currentTime):Xn(t)}function Xn(t){if(null!=t.m)return Wn(t,t.m);var e=t.c.presentationTimeline;return e=1/0>e.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<r.Da(0)?i(o)?o:n: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 e<i?i:(i=t.c.presentationTimeline.ua(),e>i?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&&e<t.b):(t=Ht(i,t),t=Nt(t,e)),t}.bind(t))||hr(t)}function hr(t){for(var e in t.c){var i=t.c[e];i.sa||i.ra||(i.xa?i.ra=!0:null==Vt(t.a.M,e)?null==i.qa&&Ir(t,i,0):(Pr(i),kr(t,i,!1)))}}function cr(t,e,i){var n=qn(t.a.Ua),r=fe(t.b,n),a={},n=[];return e.variant&&e.variant.audio&&(a.audio=e.variant.audio,n.push(e.variant.audio)),e.variant&&e.variant.video&&(a.video=e.variant.video,n.push(e.variant.video)),e.text&&(a.text=e.text,n.push(e.text)),t.a.M.init(a),dr(t),fr(t,n).then(function(){if(!this.f)for(var t in a){var e=a[t];this.c[t]||(this.c[t]={stream:e,type:t,Ea:null,la:null,oa:null,pb:!0,wa:r,endOfStream:!1,xa:!1,qa:null,ra:!1,tb:!1,sa:!1,Ob:!1,Qa:!1,Bc:i||0},Ir(this,this.c[t],0))}}.bind(t))}function lr(t,e){var i=t.g[e];if(i)return i.N;i={N:new y,Ka:!1},t.g[e]=i;var n=t.b.periods[e].variants.map(function(t){var e=[];return t.audio&&e.push(t.audio),t.video&&e.push(t.video),t.video&&t.video.trickModeVideo&&e.push(t.video.trickModeVideo),e}).reduce(_,[]).filter(N);return n.push.apply(n,t.b.periods[e].textStreams),t.m=t.m.then(function(){if(!this.f)return fr(this,n)}.bind(t)).then(function(){this.f||(this.g[e].N.resolve(),this.g[e].Ka=!0)}.bind(t)).catch(function(t){this.f||(this.g[e].N.reject(),delete this.g[e],this.a.onError(t))}.bind(t)),i.N}function fr(t,e){e.map(function(t){return t.id}).filter(N);for(var i=[],n=0;n<e.length;++n){var r=e[n],a=t.j[r.id];a?i.push(a.N):(t.j[r.id]={N:new y,Ka:!1},i.push(r.createSegmentIndex()))}return Promise.all(i).then(function(){if(!this.f)for(var t=0;t<e.length;++t){var i=this.j[e[t].id];i.Ka||(i.N.resolve(),i.Ka=!0)}}.bind(t)).catch(function(t){if(!this.f)return this.j[r.id].N.reject(),delete this.j[r.id],Promise.reject(t)}.bind(t))}function dr(t){var e=t.b.presentationTimeline.W();1/0>e?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<i?0:s.b-Math.max(i,s.a)):(s=Ht(s,o),s=Dt(s,i)),o=Math.max(t.i*Math.max(t.b.minBufferTime||0,t.h.rebufferingGoal),t.i*t.h.bufferingGoal),n>=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.endTime<t.ka()||i.startTime+e.startTime>n?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<n)t.i-=.2;else{if(!(4<n))return e.Qa=!0,t.l=!0,void t.a.onError(i);t.i-=.04}e.Ob=!0}Ir(t,e,4)}function br(t,e,i,n,r){return e.pb?(i=qt(t.a.M,e.type,t.b.periods[i].startTime-e.stream.presentationTimeOffset,n,r),e.stream.initSegmentReference?(t=Ar(t,e.stream.initSegmentReference).then(function(t){if(!this.f)return Kt(this.a.M,e.type,t,null,null)}.bind(t)).catch(function(t){return e.pb=!0,Promise.reject(t)}),Promise.all([i,t])):i):Promise.resolve()}function yr(t,e,i,n,r,a,s){return r.containsEmsgBoxes&&(new ai).ca("emsg",t.Ud.bind(t,n,a)).parse(s),Tr(t,e,i).then(function(){if(!this.f)return Kt(this.a.M,e.type,s,a.startTime+n.startTime,a.endTime+n.startTime)}.bind(t)).then(function(){if(!this.f)return e.Ea=r,e.la=a,Promise.resolve()}.bind(t))}function Tr(t,e,i){var n=Vt(t.a.M,e.type);return null==n?Promise.resolve():(i=i-n-t.h.bufferBehind,0>=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<t.b.periods.length;++i)lr(t,i).catch(x);t.a.Md&&t.a.Md()}}function Er(t,e){if(e.wa!=de(t.b,e.stream)){var i=e.wa,n=z(t.c);n.every(function(t){return t.wa==i})&&n.every(Sr)&&lr(t,i).then(function(){if(!this.f&&n.every(function(t){var e=de(this.b,t.stream);return Sr(t)&&t.wa==i&&e!=i}.bind(this))){var t=this.b.periods[i],e=this.a.kc(t),r={};e.variant&&e.variant.video&&(r.video=e.variant.video),e.variant&&e.variant.audio&&(r.audio=e.variant.audio),e.text&&(r.text=e.text);for(var a in this.c)if(!r[a]&&"text"!=a)return void this.a.onError(new h(2,5,5005));for(a in r)if(!this.c[a]){if("text"!=a)return void this.a.onError(new h(2,5,5005));cr(this,{text:r.text},t.startTime),delete r[a]}for(a in this.c)(t=r[a])?(or(this,t,!1),Ir(this,this.c[a],0)):delete this.c[a];this.a.jc()}}.bind(t)).catch(x)}}function Sr(t){return!t.xa&&null==t.qa&&!t.ra&&!t.sa}function Ar(t,e){var i=L(e.a(),t.h.retryParameters);if(e.T||null!=e.K){var n="bytes="+e.T+"-";null!=e.K&&(n+=e.K),i.headers.Range=n}return t.a.Sa.request(1,i).then(function(t){return t.data})}function kr(t,e,i){e.ra=!1,e.tb=!1,e.sa=!0,Gt(t.a.M,e.type).then(function(){if(!this.f&&i){var t=this.a.M,n=e.type;return"text"==n?Promise.resolve():Xt(t,n,t.Yc.bind(t,n))}}.bind(t)).then(function(){this.f||(e.Ea=null,e.la=null,e.sa=!1,e.endOfStream=!1,Ir(this,e,0))}.bind(t))}function Ir(e,i,n){i.qa=t.setTimeout(e.Ce.bind(e,i),1e3*n)}function Pr(e){null!=e.qa&&(t.clearTimeout(e.qa),e.qa=null)}function _r(t,e){w(t.w).then(function(){this.a.onError(e),e.handled||this.h.failureCallback(e)}.bind(t))}function xr(t,e){return new Promise(function(i,n){var r=new XMLHttpRequest;r.open(e.method,t,!0),r.responseType="arraybuffer",r.timeout=e.retryParameters.timeout,r.withCredentials=e.allowCrossSiteCredentials,r.onload=function(e){e=e.target;var r=e.getAllResponseHeaders().split("\r\n").reduce(function(t,e){var i=e.split(": ");return t[i[0].toLowerCase()]=i.slice(1).join(": "),t},{});if(200<=e.status&&299>=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<e.length;n++)t.delete(e[n]).onsuccess=i||function(){}})}function Lr(t,e){var i=0;return Cr(t,e,"readonly",function(t){t.openCursor(null,"prev").onsuccess=function(t){(t=t.target.result)&&(i=t.key+1)}}).then(function(){return i})}function Cr(t,e,i,n){var r={transaction:t.a.transaction([e],i),N:new y};return r.transaction.oncomplete=function(){this.b.splice(this.b.indexOf(r),1),r.N.resolve()}.bind(t),r.transaction.onabort=function(t){this.b.splice(this.b.indexOf(r),1),Or(r.transaction,r.N,t)}.bind(t),r.transaction.onerror=function(t){t.preventDefault()}.bind(t),e=r.transaction.objectStore(e),n(e),t.b.push(r),r.N}function Mr(e,i,n){var r=t.indexedDB.open("shaka_offline_db",1),a=!1,s=new y;return r.onupgradeneeded=function(t){a=!0,t=t.target.result;for(var e in i)t.createObjectStore(e,{keyPath:i[e]})},r.onsuccess=function(t){n&&!a?(t.target.result.close(),setTimeout(function(){Mr(this,i,n-1).then(s.resolve,s.reject)}.bind(this),1e3)):(this.a=t.target.result,s.resolve())}.bind(e),r.onerror=Or.bind(null,r,s),s}function Or(t,e,i){t.error?e.reject(new h(2,9,9001,t.error)):e.reject(new h(2,9,9002)),i.preventDefault()}function Ur(t){var e=jr(t.periods[0],[],new Ui(null,0)),i=ee(e,null,null),e=ie(e,null);return i.push.apply(i,e),{offlineUri:"offline:"+t.key,originalManifestUri:t.originalManifestUri,duration:t.duration,size:t.size,expiration:void 0==t.expiration?1/0:t.expiration,tracks:i,appMetadata:t.appMetadata}}function jr(t,e,i){var n=t.streams.filter(function(t){return"text"==t.contentType});return e=Fr(t.streams.filter(function(t){return"audio"==t.contentType}),t.streams.filter(function(t){return"video"==t.contentType}),e),n=n.map(Hr),t.streams.forEach(function(t){t=Br(t),i.Ga(0,t)}),{startTime:t.startTime,variants:e,textStreams:n}}function Br(t){return t.segments.map(function(t,e){return new ei(e,t.startTime,t.endTime,function(){return[t.uri]},0,null)})}function Fr(t,e,i){var n=[];if(!t.length&&!e.length)return n;t.length?e.length||(e=[null]):t=[null];for(var r=0,a=0;a<t.length;a++)for(var s=0;s<e.length;s++)if(Vr(t[a],e[s])){var o=t[a],u=e[s],h=i;o={id:r++,language:o?o.language:"",primary:!!o&&o.primary||!!u&&u.primary,audio:Hr(o),video:Hr(u),bandwidth:0,drmInfos:h,allowedByApplication:!0,allowedByKeySystem:!0},n.push(o)}return n}function Vr(t,e){if(!(t&&e&&t.variantIds&&e.variantIds))return!0;for(var i=0;i<t.variantIds.length;i++)if(e.variantIds.some(function(e){return e==t.variantIds[i]}))return!0;return!1}function Hr(t){if(!t)return null;var e=Br(t),e=new fi(e);return{id:t.id,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.find.bind(e),getSegmentReference:e.get.bind(e),initSegmentReference:t.initSegmentUri?new ti(function(){return[t.initSegmentUri]},0,null):null,presentationTimeOffset:t.presentationTimeOffset,mimeType:t.mimeType,codecs:t.codecs,width:t.width||void 0,height:t.height||void 0,frameRate:t.frameRate||void 0,kind:t.kind,encrypted:t.encrypted,keyId:t.keyId,language:t.language,label:t.label||null,type:t.contentType,primary:t.primary,trickModeVideo:null,containsEmsgBoxes:!1,roles:[],channelsCount:null}}function Kr(){return t.indexedDB?new Rr:null}function Gr(t,e,i,n){this.b={},this.l=[],this.m=n,this.j=t,this.s=e,this.w=i,this.i=this.a=null,this.f=this.g=this.h=this.c=0}function qr(t,e,i,n,r){t.b[e]=t.b[e]||[],t.b[e].push({uris:i.a(),T:i.T,K:i.K,$b:n,Qb:r})}function Xr(t,e){t.c=0,t.h=0,t.g=0,t.f=0,z(t.b).forEach(function(t){t.forEach(function(t){null!=t.K?this.c+=t.K-t.T+1:this.g+=t.$b}.bind(this))}.bind(t)),t.a=e,t.a.size=t.c;var i=z(t.b).map(function(t){var e=0,i=function(){return this.m?e>=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<t.textTracks.length;++e){var i=t.textTracks[e];i.mode="disabled","Shaka Player TextTrack"==i.label&&(this.a=i)}this.a||(this.a=t.addTextTrack("subtitles","Shaka Player TextTrack")),this.a.mode="hidden",this.b=this.a.cues}function Qr(e){if(e.startTime>=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<i.length;++r)e(i[r])&&n.push(i[r]);for(r=0;r<n.length;++r)t.a.removeCue(n[r])}function ta(){this.a=Promise.resolve(),this.b=this.c=this.f=!1,this.i=new Promise(function(t){this.g=t}.bind(this))}function ea(t){return t.f||(t.a=t.a.then(function(t){return this.c=!0,Promise.resolve(t)}.bind(t),function(t){return this.c=!0,this.b?(this.g(),Promise.reject(this.h)):Promise.reject(t)}.bind(t))),t.f=!0,t.a}function ia(t,e){Se.call(this),this.D=!1,this.f=t,this.jb=!1,this.w=null,this.m=new B,this.g=this.ib=this.b=this.i=this.a=this.B=this.h=this.gb=this.J=this.L=this.l=this.s=null,this.Oc=1e9,this.eb=[],this.Oa=!1,this.Ba=!0,this.Na=this.Pa=this.ia=null,this.Yb=!1,this.X=null,this.hb=[],this.C={},this.c=pa(this),this.fb={width:1/0,height:1/0},this.j=ma(),this.cb=0,this.Ma=this.c.preferredAudioLanguage,this.$a=this.c.preferredTextLanguage,this.ub=this.ab="",this.Zb=!0,e&&e(this),this.s=new D(this.ue.bind(this)),this.gb=aa(this),F(this.m,this.f,"error",this.Od.bind(this))}function na(t){if(!t.ia)return Promise.resolve();var e=Promise.resolve();return t.i&&(e=t.i.stop(),t.i=null),t=t.ia.cancel(new h(2,7,7e3)),Promise.all([e,t])}function ra(t){function e(t){return(t.video?t.video.codecs.split(".")[0]:"")+"-"+(t.audio?t.audio.codecs.split(".")[0]:"")}var i={};t.b.periods.forEach(function(t){t.variants.forEach(function(t){var n=e(t);n in i||(i[n]=[]),i[n].push(t)})});var n=null,r=1/0;J(i,function(t,e){var i=0,a=0;e.forEach(function(t){i+=t.bandwidth||0,++a});var s=i/a;s<r&&(n=t,r=s)}),t.b.periods.forEach(function(t){t.variants=t.variants.filter(function(t){return e(t)==n})})}function aa(e){e.L=new MediaSource;var i=new y;return F(e.m,e.L,"sourceopen",i.resolve),e.f.src=t.URL.createObjectURL(e.L),i}function sa(t){if(t.i&&t.i.configure(t.c.manifest),t.l&&t.l.configure(t.c.drm),t.a){t.a.configure(t.c.streaming);try{t.b.periods.forEach(t.kb.bind(t))}catch(e){t.La(e)}var e=rr(t.a),i=e.audio,n=e.video,e=ir(t.a);(i=ce(i,n,e.variants))&&i.allowedByApplication&&i.allowedByKeySystem||Ta(t,e)}t.g&&(oa(t),t.c.abr.enabled&&!t.Ba?t.g.enable():t.g.disable())}function oa(t){t.g.configure?t.g.configure(t.c.abr):(o("AbrManager API has changed. AbrManager.setDefaultEstimate() and AbrManager.setRestrictions() are deprecated. AbrManager.configure() is used instead. Please upgrade to the new API. The old API will be removed in v2.3."),t.g.setDefaultEstimate(t.c.abr.defaultBandwidthEstimate),t.g.setRestrictions(t.c.abr.restrictions))}function ua(t,e,i){e.video&&ca(t,e.video),e.audio&&ca(t,e.audio);var n=nr(t.a),r=rr(t.a);e!=ce(r.audio,r.video,n?n.variants:[])&&t.j.switchHistory.push({timestamp:Date.now()/1e3,id:e.id,type:"variant",fromAdaptation:i,bandwidth:e.bandwidth})}function ha(t,e,i){ca(t,e),t.j.switchHistory.push({timestamp:Date.now()/1e3,id:e.id,type:"text",fromAdaptation:i,bandwidth:null})}function ca(t,e){var i=de(t.b,e);t.C[i]||(t.C[i]={}),t.C[i][e.type]=e.id}function la(t){t.m&&(t.m.ha(t.L,"sourceopen"),t.m.ha(t.f,"loadeddata"),t.m.ha(t.f,"playing"),t.m.ha(t.f,"pause"),t.m.ha(t.f,"ended")),t.f&&(t.f.removeAttribute("src"),t.f.load());var e=Promise.all([t.g?t.g.stop():null,t.l?t.l.o():null,t.J?t.J.o():null,t.h?t.h.o():null,t.B?t.B.o():null,t.a?t.a.o():null,t.i?t.i.stop():null,t.w?t.w.o():null]);return t.l=null,t.J=null,t.h=null,t.B=null,t.a=null,t.i=null,t.w=null,t.b=null,t.ib=null,t.gb=null,t.L=null,t.hb=[],t.C={},t.j=ma(),e}function fa(t){return t.i?la(t).then(function(){this.D||(this.Jc(!1),this.gb=aa(this))}.bind(t)):Promise.resolve()}function da(){return{".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",serverCertificate:new Uint8Array(0)}}}function pa(t){return{drm:{retryParameters:E(),servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1},manifest:{retryParameters:E(),dash:{customScheme:function(t){if(t)return null},clockSyncUri:"",ignoreDrmInfo:!1,xlinkFailGracefully:!1},hls:{defaultTimeOffset:0}},streaming:{retryParameters:E(),failureCallback:t.Vc.bind(t),rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,ignoreTextStreamFailures:!1,startAtSegmentBoundary:!1,smallGapLimit:.5,jumpLargeGaps:!1,durationBackoff:1},abrFactory:pe,textDisplayFactory:function(t){return new Jr(t)}.bind(null,t.f),abr:{enabled:!0,defaultBandwidthEstimate:5e5,switchInterval:8,bandwidthUpgradeTarget:.85,bandwidthDowngradeTarget:.95,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minBandwidth:0,maxBandwidth:1/0}},preferredAudioLanguage:"",preferredTextLanguage:"",restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minBandwidth:0,maxBandwidth:1/0},playRangeStart:0,playRangeEnd:1/0}}function ma(){return{width:NaN,height:NaN,streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,estimatedBandwidth:NaN,loadLatency:NaN,playTime:0,bufferingTime:0,switchHistory:[],stateHistory:[]}}function va(t,e,i){t.Ba?(t.Na=e,t.Yb=i||!1):sr(t.a,e,i||!1)}function ga(t){if(t.b){var e=Date.now()/1e3;t.Oa?t.j.bufferingTime+=e-t.cb:t.j.playTime+=e-t.cb,t.cb=e}}function ba(t,e){function i(t,e){if(!t)return null;var i=t.findSegmentPosition(e-r.startTime);return null==i?null:(i=t.getSegmentReference(i))?i.startTime+r.startTime:null}var n=rr(t.a),r=ir(t.a),a=i(n.video,e),n=i(n.audio,e);return null!=a&&null!=n?Math.max(a,n):null!=a?a:null!=n?n:e}function ya(t,e){if(!e||!e.length)return t.La(new h(2,4,4012)),null;if(t.g.setVariants(e),t.g.chooseStreams){o("AbrManager API has changed. AbrManager.chooseStreams() is deprecated. Please implement AbrManager.chooseVariant() to upgrade. The old API will be removed in v2.3.");var i=t.g.chooseStreams(["video","audio"]);return ce(i.audio,i.video,e)}return t.g.chooseVariant()}function Ta(t,e){var i=se(e,t.Ma,t.ab),n=oe(e,t.$a,t.ub);(i=ya(t,i))&&(ua(t,i,!0),va(t,i,!0)),(n=n[0])&&(ha(t,n,!0),t.Ba?t.X=n:or(t.a,n,!0)),wa(t)}function wa(t){Promise.resolve().then(function(){this.D||this.dispatchEvent(new G("adaptation"))}.bind(t))}function Ea(t){Promise.resolve().then(function(){this.D||this.dispatchEvent(new G("trackschanged"))}.bind(t))}function Sa(t){t.dispatchEvent(new G("texttrackvisibility"))}function Aa(t){if(!t||t.constructor!=ia)throw new h(2,9,9008);this.a=Kr(),this.g=t,this.b=Pa(this),this.c=null,this.s=!1,this.j=null,this.h=-1,this.l=0,this.f=null,this.i=new Gr(this.a,t.s,t.getConfiguration().streaming.retryParameters,this.b)}function ka(){return!!t.indexedDB}function Ia(t,e,i,n){function r(){}var a,s,o,u=t.g.s,h=t.g.getConfiguration();return Oi(e,u,h.manifest.retryParameters,n).then(function(t){return Da(this),o=new t,o.configure(h.manifest),o.start(e,{networkingEngine:u,filterAllPeriods:this.m.bind(this),filterNewPeriod:this.w.bind(this),onTimelineRegionAdded:function(){},onEvent:function(){},onError:i})}.bind(t)).then(function(t){return Da(this),a=t,s=new ft({Sa:u,onError:i,Hb:r,onExpirationUpdated:function(){},onEvent:function(){}}),s.configure(h.drm),s.init(a,this.b.usePersistentLicense||!1)}.bind(t)).then(function(){return Da(this),Ra(a)}.bind(t)).then(function(){return Da(this),mt(s)}.bind(t)).then(function(){return Da(this),o.stop()}.bind(t)).then(function(){return Da(this),{manifest:a,Wc:s}}.bind(t)).catch(function(t){if(o)return o.stop().then(function(){throw t});throw t})}function Pa(t){return{trackSelectionCallback:t.B.bind(t),progressCallback:function(t,e){if(t||e)return null},usePersistentLicense:!0}}function _a(t){return t.a?t.a.a?Promise.resolve():t.a.init(Co):Promise.reject(new h(2,9,9e3))}function xa(t){var e=t.c?t.c.o():Promise.resolve();return t.c=null,t.f=null,t.s=!1,t.j=null,t.h=-1,e}function Ra(t){var e=t.periods.map(function(t){return t.variants}).reduce(_,[]).map(function(t){var e=[];return t.audio&&e.push(t.audio),t.video&&e.push(t.video),e}).reduce(_,[]).filter(N);return t=t.periods.map(function(t){return t.textStreams}).reduce(_,[]),e.push.apply(e,t),Promise.all(e.map(function(t){return t.createSegmentIndex()}))}function Na(t,e,i,n,r){for(var a=[],s=t.f.presentationTimeline.ka(),o=s,u=i.findSegmentPosition(s),h=null!=u?i.getSegmentReference(u):null;h;)o=t.a.c.segment++,qr(t.i,i.type,h,(h.endTime-h.startTime)*n/8,{key:o,data:null,manifestKey:t.h,streamNumber:i.id,segmentNumber:o}),a.push({startTime:h.startTime,endTime:h.endTime,uri:"offline:"+t.h+"/"+i.id+"/"+o}),o=h.endTime+e.startTime,h=i.getSegmentReference(++u);return t.l=Math.max(t.l,o-s),e=null,i.initSegmentReference&&(o=t.a.c.segment++,e="offline:"+t.h+"/"+i.id+"/"+o,qr(t.i,i.contentType,i.initSegmentReference,0,{key:o,data:null,manifestKey:t.h,streamNumber:i.id,segmentNumber:-1})),t=[],null!=r&&t.push(r),{id:i.id,primary:i.primary,presentationTimeOffset:i.presentationTimeOffset||0,contentType:i.type,mimeType:i.mimeType,codecs:i.codecs,frameRate:i.frameRate,kind:i.kind,language:i.language,label:i.label,width:i.width||null,height:i.height||null,initSegmentUri:e,encrypted:i.encrypted,keyId:i.keyId,segments:a,variantIds:t}}function Da(t){if(!t.g)throw new h(2,9,9002)}function La(t){Oo.push(t)}function Ca(t){var e=t.type.replace(/^(webkit|moz|MS)/,"").toLowerCase();if("function"==typeof Event)var i=new Event(e,t);else i=document.createEvent("Event"),i.initEvent(e,t.bubbles,t.cancelable);t.target.dispatchEvent(i)}function Ma(t,e,i){if("input"==t)switch(this.type){case"range":t="change"}Uo.call(this,t,e,i)}function Oa(t){this.f=[],this.b=[],this.a=[],(new ai).ca("pssh",this.c.bind(this)).parse(t.buffer)}function Ua(t,e){try{var i=new ja(t,e);return Promise.resolve(i)}catch(t){return Promise.reject(t)}}function ja(t,e){this.keySystem=t;for(var i=!1,n=0;n<e.length;++n){var r=e[n],a={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:r.initDataTypes,sessionTypes:["temporary"],label:r.label},s=!1;if(r.audioCapabilities)for(var o=0;o<r.audioCapabilities.length;++o){var u=r.audioCapabilities[o];if(u.contentType){s=!0;var h=u.contentType.split(";")[0];MSMediaKeys.isTypeSupported(this.keySystem,h)&&(a.audioCapabilities.push(u),i=!0)}}if(r.videoCapabilities)for(o=0;o<r.videoCapabilities.length;++o)u=r.videoCapabilities[o],u.contentType&&(s=!0,h=u.contentType.split(";")[0],MSMediaKeys.isTypeSupported(this.keySystem,h)&&(a.videoCapabilities.push(u),i=!0));if(s||(i=MSMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),"required"==r.persistentState&&(i=!1),i)return void(this.a=a)}throw r=Error("Unsupported keySystem"),r.name="NotSupportedError",r.code=DOMException.NOT_SUPPORTED_ERR,r}function Ba(t){var e=this.mediaKeys;return e&&e!=t&&Va(e,null),delete this.mediaKeys,(this.mediaKeys=t)?Va(t,this):Promise.resolve()}function Fa(t){this.a=new MSMediaKeys(t),this.b=new B}function Va(t,e){function i(){e.msSetMediaKeys(n.a),e.removeEventListener("loadedmetadata",i)}if(H(t.b),!e)return Promise.resolve();F(t.b,e,"msneedkey",Ka);var n=t;try{return 1<=e.readyState?e.msSetMediaKeys(t.a):e.addEventListener("loadedmetadata",i),Promise.resolve()}catch(t){return Promise.reject(t)}}function Ha(t){Se.call(this),this.c=null,this.g=t,this.b=this.a=null,this.f=new B,this.sessionId="",this.expiration=NaN,this.closed=new y,this.keyStatuses=new Xa}function Ka(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="cenc";var i=t.initData;if(i){var n=new Oa(i);if(1>=n.a.length)t=i;else{var r=[];for(t=0;t<n.a.length;t++)r.push(i.subarray(n.a[t].start,n.a[t].end+1));for(i=M(r,Ga),t=n=0;t<i.length;t++)n+=i[t].length;for(n=new Uint8Array(n),t=r=0;t<i.length;t++)n.set(i[t],r),r+=i[t].length;t=n}}else t=i;e.initData=t,this.dispatchEvent(e)}function Ga(t,e){return lt(t,e)}function qa(t,e){var i=t.keyStatuses;i.size=void 0==e?0:1,i.a=e,t.dispatchEvent(new G("keystatuseschange"))}function Xa(){this.size=0,this.a=void 0}function Ya(){return Promise.reject(Error("The key system specified is not supported."))}function za(t){return t?Promise.reject(Error("MediaKeys not supported.")):Promise.resolve()}function $a(){throw new TypeError("Illegal constructor.")}function Wa(){throw new TypeError("Illegal constructor.")}function Ja(e){Bo=e,Fo=new Uint8Array([0]).buffer,navigator.requestMediaKeySystemAccess=Za,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=ts,t.MediaKeys=is,t.MediaKeySystemAccess=es}function Qa(t){var e=Bo;return e?e+t.charAt(0).toUpperCase()+t.slice(1):t}function Za(t,e){try{var i=new es(t,e);return Promise.resolve(i)}catch(t){return Promise.reject(t)}}function ts(t){var e=this.mediaKeys;return e&&e!=t&&ns(e,null),delete this.mediaKeys,(this.mediaKeys=t)&&ns(t,this),Promise.resolve()}function es(t,e){this.a=this.keySystem=t;var i=!1;"org.w3.clearkey"==t&&(this.a="webkit-org.w3.clearkey",i=!1);for(var n=!1,r=document.getElementsByTagName("video"),a=r.length?r[0]:document.createElement("video"),s=0;s<e.length;++s){r=e[s];var o={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:r.initDataTypes,sessionTypes:["temporary"],label:r.label},u=!1;if(r.audioCapabilities)for(var h=0;h<r.audioCapabilities.length;++h){var c=r.audioCapabilities[h];if(c.contentType){var u=!0,l=c.contentType.split(";")[0];a.canPlayType(l,this.a)&&(o.audioCapabilities.push(c),n=!0)}}if(r.videoCapabilities)for(h=0;h<r.videoCapabilities.length;++h)c=r.videoCapabilities[h],c.contentType&&(u=!0,a.canPlayType(c.contentType,this.a)&&(o.videoCapabilities.push(c),n=!0));if(u||(n=a.canPlayType("video/mp4",this.a)||a.canPlayType("video/webm",this.a)),"required"==r.persistentState&&(i?(o.persistentState="required",o.sessionTypes=["persistent-license"]):n=!1),n)return void(this.b=o)}throw i="Unsupported keySystem","org.w3.clearkey"!=t&&"com.widevine.alpha"!=t||(i="None of the requested configurations were supported."),i=Error(i),i.name="NotSupportedError",i.code=DOMException.NOT_SUPPORTED_ERR,i}function is(t){this.g=t,this.b=null,this.a=new B,this.c=[],this.f={}}function ns(t,e){t.b=e,H(t.a);var i=Bo;e&&(F(t.a,e,i+"needkey",t.Sd.bind(t)),F(t.a,e,i+"keymessage",t.Rd.bind(t)),F(t.a,e,i+"keyadded",t.Pd.bind(t)),F(t.a,e,i+"keyerror",t.Qd.bind(t)))}function rs(t,e){var i=t.f[e];return i||((i=t.c.shift())?(i.sessionId=e,t.f[e]=i):null)}function as(t,e,i){Se.call(this),this.f=t,this.h=!1,this.a=this.b=null,this.c=e,this.g=i,this.sessionId="",this.expiration=NaN,this.closed=new y,this.keyStatuses=new us}function ss(t,e,i){if(t.h)return Promise.reject(Error("The session is already initialized."));t.h=!0;try{if("persistent-license"==t.g)if(i)var n=new Uint8Array(it("LOAD_SESSION|"+i));else{var r=it("PERSISTENT|"),a=new Uint8Array(r.byteLength+e.byteLength);a.set(new Uint8Array(r),0),a.set(new Uint8Array(e),r.byteLength),n=a}else n=new Uint8Array(e)}catch(t){return Promise.reject(t)}t.b=new y;var s=Qa("generateKeyRequest");try{t.f[s](t.c,n)}catch(e){if("InvalidStateError"!=e.name)return t.b=null,Promise.reject(e);setTimeout(function(){try{this.f[s](this.c,n)}catch(t){this.b.reject(t),this.b=null}}.bind(t),10)}return t.b}function os(t,e){var i=t.keyStatuses;i.size=void 0==e?0:1,i.a=e,t.dispatchEvent(new G("keystatuseschange"))}function us(){this.size=0,this.a=void 0}function hs(){var t=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var e=t.apply(this,arguments);return e.abort=function(){},e}}function cs(){var t=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(e,i){return t.call(this,e,i-.001)}}function ls(){var t=MediaSource.prototype.endOfStream;MediaSource.prototype.endOfStream=function(){for(var e,i=0,n=0;n<this.sourceBuffers.length;++n)e=this.sourceBuffers[n],e=e.buffered.end(e.buffered.length-1),i=Math.max(i,e);if(!isNaN(this.duration)&&i<this.duration)for(this.hc=!0,n=0;n<this.sourceBuffers.length;++n)e=this.sourceBuffers[n],e.cc=!1;return t.apply(this,arguments)};var e=!1,i=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var t=i.apply(this,arguments);return t.mediaSource_=this,t.addEventListener("updateend",fs,!1),e||(this.addEventListener("sourceclose",ds,!1),e=!0),t}}function fs(t){var e=t.target,i=e.mediaSource_;if(i.hc){for(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),e.cc=!0,t=0;t<i.sourceBuffers.length;++t)if(0==i.sourceBuffers[t].cc)return;i.hc=!1}}function ds(t){t=t.target;for(var e=0;e<t.sourceBuffers.length;++e)t.sourceBuffers[e].removeEventListener("updateend",fs,!1);t.removeEventListener("sourceclose",ds,!1)}function ps(){var t=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(e){return"mp2t"!=e.split(/ *; */)[0].split("/")[1]&&t(e)}}function ms(){var t=MediaSource.isTypeSupported,e=/^dv(?:he|av)\./;MediaSource.isTypeSupported=function(i){for(var n,r,a=i.split(/ *; */),s=a[0],o={},u=1;u<a.length;++u)n=a[u].split("="),r=n[0],n=n[1].replace(/"(.*)"/,"$1"),o[r]=n;if(!(n=o.codecs))return t(i);var h=!1,c=!1;i=n.split(",").filter(function(t){return e.test(t)?(c=!0,!1):(/^(hev|hvc)1\.2/.test(t)&&(h=!0),!0)}),c&&(h=!1),o.codecs=i.join(","),h&&(o.eotf="smpte2084");for(r in o)n=o[r],s+="; "+r+'="'+n+'"';return cast.__platform__.canDisplayType(s)}}function vs(t){if(this.c=[],this.b=[],this.za=Vo,t)try{t(this.ma.bind(this),this.a.bind(this))}catch(t){this.a(t)}}function gs(t){var e=new vs;return e.ma(void 0),e.then(function(){return t})}function bs(t){var e=new vs;return e.a(t),e}function ys(t){function e(t,e,i){t.za==Vo&&(r[e]=i,++n==r.length&&t.ma(r))}var i=new vs;if(!t.length)return i.ma([]),i;for(var n=0,r=Array(t.length),a=i.a.bind(i),s=0;s<t.length;++s)t[s]&&t[s].then?t[s].then(e.bind(null,i,s),a):e(i,s,t[s]);return i}function Ts(t){for(var e=new vs,i=e.ma.bind(e),n=e.a.bind(e),r=0;r<t.length;++r)t[r]&&t[r].then?t[r].then(i,n):i(t[r]);return e}function ws(t,e,i){Ko.push(function(){if(i&&"function"==typeof i){try{var t=i(this.f)}catch(t){return void e.a(t)}try{var n=t&&t.then}catch(t){return void e.a(t)}t instanceof vs?t==e?e.a(new TypeError("Chaining cycle detected")):t.then(e.ma.bind(e),e.a.bind(e)):n?Es(t,n,e):e.ma(t)}else 1==this.za?e.ma(this.f):e.a(this.f)}.bind(t)),null==Ho&&(Ho=As(Ss))}function Es(t,e,i){try{var n=!1;e.call(t,function(t){if(!n){n=!0;try{var e=t&&t.then}catch(t){return void i.a(t)}e?Es(t,e,i):i.ma(t)}},i.a.bind(i))}catch(t){i.a(t)}}function Ss(){for(;Ko.length;){null!=Ho&&(ks(Ho),Ho=null);var t=Ko;Ko=[];for(var e=0;e<t.length;++e)t[e]()}}function As(){return 0}function ks(){}function Is(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}function Ps(e,i,n){return new t.TextTrackCue(e,i,n)}function _s(e,i,n){return new t.TextTrackCue(e+"-"+i+"-"+n,e,i,n)}function xs(t,e,i){this.startTime=t,this.endTime=e,this.payload=i,this.region={x:0,y:0,width:100,height:100},this.position=null,this.positionAlign=Go,this.size=100,this.textAlign=qo,this.writingDirection=$o,this.lineInterpretation=Qo,this.line=null,this.lineHeight="",this.lineAlign=tu,this.displayAlign=Yo,this.fontSize=this.backgroundColor=this.color="",this.fontWeight=iu,this.fontStyle=nu,this.fontFamily="",this.textDecoration=[],this.wrapLine=!0,this.id=""}function Rs(){}function Ns(t){var e=[];if(!t)return e;for(var i=t.childNodes,n=0;n<i.length;n++){var r="span"==i[n].nodeName&&"p"==t.nodeName;i[n].nodeType!=Node.ELEMENT_NODE||"br"==i[n].nodeName||r||(r=Ns(i[n]),e=e.concat(r))}return e.length||e.push(t),e}function Ds(t,e){for(var i=t.childNodes,n=0;n<i.length;n++)if("br"==i[n].nodeName&&0<n)i[n-1].textContent+="\n";else if(0<i[n].childNodes.length)Ds(i[n],e);else if(e){var r=i[n].textContent.trim(),r=r.replace(/\s+/g," ");i[n].textContent=r}}function Ls(t,e){for(var i=e.split(" "),n=0;n<i.length;n++)switch(i[n]){case"underline":0>t.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;r<n.length;r++){var a=n[r].getAttribute(i);if(a)return a}return(t=Us(t,"style",e))?t.getAttribute(i):null}function Os(t,e,i){return(t=Us(t,"style",e))?t.getAttribute(i):null}function Us(t,e,i){if(!t||1>i.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;t<i.length;t++)if(i[t].getAttribute("xml:id")==e){n=i[t];break}return n}function js(t,e){var i=null;if(au.test(t))var i=au.exec(t),n=Number(i[1]),r=Number(i[2]),a=Number(i[3]),s=Number(i[4]),s=s+(Number(i[5])||0)/e.b,a=a+s/e.frameRate,i=a+60*r+3600*n;else su.test(t)?i=Bs(su,t):ou.test(t)?i=Bs(ou,t):uu.test(t)?(i=uu.exec(t),i=Number(i[1])/e.frameRate):hu.test(t)?(i=hu.exec(t),i=Number(i[1])/e.a):cu.test(t)&&(i=Bs(cu,t));return i}function Bs(t,e){var i=t.exec(e);return i&&""!=i[0]?(Number(i[4])||0)/1e3+(Number(i[3])||0)+60*(Number(i[2])||0)+3600*(Number(i[1])||0):null}function Fs(t,e,i,n){this.frameRate=Number(t)||30,this.b=Number(e)||1,this.a=Number(n),this.a||(this.a=t?this.frameRate*this.b:1),i&&(t=/^(\d+) (\d+)$/g.exec(i))&&(this.frameRate*=t[1]/t[2])}function Vs(){this.a=new Rs}function Hs(){}function Ks(t,e){var i;(i=/^align:(start|middle|center|end|left|right)$/.exec(e))?(i=i[1],t.textAlign="middle"==i?qo:Xo[i.toUpperCase()]):(i=/^vertical:(lr|rl)$/.exec(e))?t.writingDirection="lr"==i[1]?Wo:Jo:(i=/^size:([\d\.]+)%$/.exec(e))?t.size=Number(i[1]):(i=/^position:([\d\.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(e))?(t.position=Number(i[1]),i[2]&&(i=i[2],t.positionAlign="line-left"==i||"start"==i?"line-left":"line-right"==i||"end"==i?"line-right":"center")):(i=/^line:([\d\.]+)%(?:,(start|end|center))?$/.exec(e))?(t.lineInterpretation=Zo,t.line=Number(i[1]),i[2]&&(t.lineAlign=eu[i[2].toUpperCase()])):(i=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(e))&&(t.lineInterpretation=Qo,t.line=Number(i[1]),i[2]&&(t.lineAlign=eu[i[2].toUpperCase()]))}function Gs(t){if(!(t=hn(t,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g)))return null;var e=Number(t[2]),i=Number(t[3]);return 59<e||59<i?null:Number(t[4])/1e3+i+60*e+3600*(Number(t[1])||0)}function qs(){this.a=null}function Xs(t,e,i){var n,r,a;return(new ai).G("payl",ui(function(t){n=Z(t)})).G("iden",ui(function(t){r=Z(t)})).G("sttg",ui(function(t){a=Z(t)})).parse(t),n?Ys(n,r,a,e,i):null}function Ys(t,e,i,n,r){if(t=new xs(n,r,t),e&&(t.id=e),i)for(e=new un(i),i=cn(e);i;)Ks(t,i),hn(e,/[ \t]+/gm),i=cn(e);return t}var zs,$s=this;$s.Pe=!0,s.prototype.getBandwidthEstimate=function(t){return 128e3>this.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;s<n.length;){var o=n[s++];"."==o?r&&s==n.length&&a.push(""):".."==o?((1<a.length||1==a.length&&""!=a[0])&&a.pop(),r&&s==n.length&&a.push("")):(a.push(o),r=!0)}n=a.join("/")}}return i?e.ba=n:i=""!==t.a.toString(),i?d(e,b(t.a)):i=!!t.ta,i&&(e.ta=t.ta),e};var Js=/[#\/\?@]/g,Qs=/[\#\?:]/g,Zs=/[\#\?]/g,to=/[\#\?@]/g,eo=/#/g;g.prototype.a=null,g.prototype.c=null,g.prototype.toString=function(){if(this.b)return this.b;if(!this.a)return"";var t,e=[];for(t in this.a)for(var i=encodeURIComponent(t),n=this.a[t],r=0;r<n.length;r++){var a=i;""!==n[r]&&(a+="="+encodeURIComponent(n[r])),e.push(a)}return this.b=e.join("&")},e("shaka.net.NetworkingEngine",D),D.RequestType={MANIFEST:0,SEGMENT:1,LICENSE:2,APP:3};var io={};D.registerScheme=function(t,e){io[t]=e},D.unregisterScheme=function(t){delete io[t]},D.prototype.ae=function(t){this.b.push(t)},D.prototype.registerRequestFilter=D.prototype.ae,D.prototype.He=function(t){var e=this.b;0<=(t=e.indexOf(t))&&e.splice(t,1)},D.prototype.unregisterRequestFilter=D.prototype.He,D.prototype.Tc=function(){this.b=[]},D.prototype.clearAllRequestFilters=D.prototype.Tc,D.prototype.be=function(t){this.c.push(t)},D.prototype.registerResponseFilter=D.prototype.be,D.prototype.Ie=function(t){var e=this.c;0<=(t=e.indexOf(t))&&e.splice(t,1)},D.prototype.unregisterResponseFilter=D.prototype.Ie,D.prototype.Uc=function(){this.c=[]},D.prototype.clearAllResponseFilters=D.prototype.Uc,D.prototype.o=function(){this.f=!0,this.b=[],this.c=[];for(var t=[],e=0;e<this.a.length;++e)t.push(this.a[e].catch(x));return Promise.all(t)},D.prototype.destroy=D.prototype.o,D.prototype.request=function(t,e,i){var n=i||function(){return!1};if(this.f)return Promise.reject();e.method=e.method||"GET",e.headers=e.headers||{},e.retryParameters=e.retryParameters?I(e.retryParameters):E(),e.uris=I(e.uris);var r=Date.now(),a=Promise.resolve();return this.b.forEach(function(i){a=a.then(i.bind(null,t,e))}),a=a.catch(function(t){throw new h(2,1,1006,t)}),a=a.then(function(){var a=Date.now()-r,s=new T(e.retryParameters,!1,i);return w(s).then(function(){return C(this,t,e,s,0,a,n)}.bind(this))}.bind(this)),this.a.push(a),a.then(function(e){return 0<=this.a.indexOf(a)&&this.a.splice(this.a.indexOf(a),1),this.g&&!e.fromCache&&1==t&&this.g(e.timeMs,e.data.byteLength),e}.bind(this)).catch(function(t){return t&&(t.severity=2),0<=this.a.indexOf(a)&&this.a.splice(this.a.indexOf(a),1),Promise.reject(t)}.bind(this))},D.prototype.request=D.prototype.request,j.prototype.push=function(t,e){this.a.hasOwnProperty(t)?this.a[t].push(e):this.a[t]=[e]},j.prototype.get=function(t){return(t=this.a[t])?t.slice():null},j.prototype.remove=function(t,e){var i=this.a[t];if(i)for(var n=0;n<i.length;++n)i[n]==e&&(i.splice(n,1),--n)},B.prototype.o=function(){return H(this),this.a=null,Promise.resolve()},B.prototype.ha=function(t,e){if(this.a)for(var i=this.a.get(e)||[],n=0;n<i.length;++n){var r=i[n];r.target==t&&(r.ha(),this.a.remove(e,r))}},K.prototype.ha=function(){this.target.removeEventListener(this.type,this.a,!1),this.a=this.target=null},G.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},G.prototype.stopImmediatePropagation=function(){this.a=!0},G.prototype.stopPropagation=function(){};var no=1/15,ro={codecs:"codecs",frameRate:"framerate",bandwidth:"bitrate",width:"width",height:"height",channelsCount:"channels"};e("shaka.util.StringUtils.fromUTF8",Z),e("shaka.util.StringUtils.fromUTF16",tt),e("shaka.util.StringUtils.fromBytesAutoDetect",et),e("shaka.util.StringUtils.toUTF8",it),rt.prototype.cancel=function(){null!=this.a&&(clearTimeout(this.a),this.a=null)},e("shaka.util.Uint8ArrayUtils.toBase64",ot),e("shaka.util.Uint8ArrayUtils.fromBase64",ut),e("shaka.util.Uint8ArrayUtils.fromHex",ht),e("shaka.util.Uint8ArrayUtils.toHex",ct),e("shaka.util.Uint8ArrayUtils.equal",lt),e("shaka.util.Uint8ArrayUtils.concat",function(t){for(var e=0,i=0;i<arguments.length;++i)e+=arguments[i].length;for(var e=new Uint8Array(e),n=0,i=0;i<arguments.length;++i)e.set(arguments[i],n),n+=arguments[i].length;return e}),zs=ft.prototype,zs.o=function(){this.c=!0;var t=[];return this.a.forEach(function(e){e=e.fa.close().catch(x);var i=new Promise(function(t){setTimeout(t,1e3)});t.push(Promise.race([e,i]))}),this.i.reject(),this.f&&t.push(this.f.o()),this.l&&t.push(this.l.setMediaKeys(null).catch(x)),this.B&&(this.B.cancel(),this.B=null),this.D&&(this.D.cancel(),this.D=null),this.f=this.l=this.j=this.w=this.b=null,this.a=[],this.m=[],this.s=this.g=this.h=null,Promise.all(t)},zs.configure=function(t){this.h=t},zs.init=function(t,e){var i={},n=[];return this.ia=e,this.m=t.offlineSessionIds,gt(this,t,e||0<t.offlineSessionIds.length,i,n),n.length?bt(this,i,n):(this.L=!0,Promise.resolve())},zs.keySystem=function(){return this.b?this.b.keySystem:""},zs.mb=function(){var t=this.a.map(function(t){return t=t.fa.expiration,isNaN(t)?1/0:t});return Math.min.apply(Math,t)},zs.vd=function(t){for(var e=new Uint8Array(t.initData),i=0;i<this.a.length;++i)if(lt(e,this.a[i].initData))return;At(this,t.initDataType,e)},zs.uc=function(t){this.h.delayLicenseRequestUntilPlayed&&this.l.paused&&!this.X?this.J.push(t):kt(this,t)},zs.oc=function(t){t=t.target;var e;for(e=0;e<this.a.length&&this.a[e].fa!=t;++e);if(e!=this.a.length){var i=!1;t.keyStatuses.forEach(function(t,n){if("string"==typeof n){var r=n;n=t,t=r}if("com.microsoft.playready"==this.b.keySystem&&16==n.byteLength){var r=new DataView(n),a=r.getUint32(0,!0),s=r.getUint16(4,!0),o=r.getUint16(6,!0);r.setUint32(0,a,!1),r.setUint16(4,s,!1),r.setUint16(6,o,!1)}"com.microsoft.playready"==this.b.keySystem&&"status-pending"==t&&(t="usable"),"status-pending"!=t&&(this.a[e].loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve()),"expired"==t&&(i=!0),r=ct(new Uint8Array(n)),this.C[r]=t}.bind(this));var n=t.expiration-Date.now();(0>n||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.J.length;t++)kt(this,this.J[t]);this.X=!0,this.J=[]},zs.Zd=function(){this.a.forEach(function(t){var e=t.Gb,i=t.fa.expiration;isNaN(i)&&(i=1/0),i!=e&&(this.s.onExpirationUpdated(t.fa.sessionId,i),t.Gb=i)}.bind(this))};var ao={};e("shaka.text.TextEngine.registerParser",Mt),e("shaka.text.TextEngine.unregisterParser",function(t){delete ao[t]}),Ct.prototype.o=function(){return this.c=this.f=null,Promise.resolve()},Ct.prototype.pe=function(t){this.c=t},Ct.prototype.setDisplayer=Ct.prototype.pe,Ct.prototype.remove=function(t,e){return Promise.resolve().then(function(){!this.c||!this.c.remove(t,e)||null==this.a||e<=this.a||t>=this.b||(t<=this.a&&e>=this.b?this.a=this.b=null:t<=this.a&&e<this.b?this.a=e:t>this.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<i.length;++n)i[n].p.catch(x),i[n].p.reject()}return this.a&&e.push(this.a.o()),Promise.all(e).then(function(){this.h.o(),this.j=this.a=this.f=this.g=this.h=null,this.b={},this.c={}}.bind(this))},zs.init=function(t){for(var e in t){var i=t[e],i=Q(i.mimeType,i.codecs);"text"==e?Ft(this,i):(i=this.f.addSourceBuffer(i),F(this.h,i,"error",this.Be.bind(this,e)),F(this.h,i,"updateend",this.Ha.bind(this,e)),this.b[e]=i,this.c[e]=[])}},zs.yb=function(){var t=this.a&&null!=this.a.a?[{start:this.a.a,end:this.a.b}]:[];return{total:Lt(this.g.buffered),audio:Lt(Ht(this,"audio")),video:Lt(Ht(this,"video")),text:t}},zs.remove=function(t,e,i){return"text"==t?this.a.remove(e,i):Xt(this,t,this.Ac.bind(this,t,e,i))},zs.endOfStream=function(t){return Yt(this,function(){t?this.f.endOfStream(t):this.f.endOfStream()}.bind(this))},zs.ga=function(t){return Yt(this,function(){this.f.duration=t}.bind(this))},zs.W=function(){return this.f.duration},zs.Ae=function(t,e){this.b[t].appendBuffer(e)},zs.Ac=function(t,e,i){i<=e?this.Ha(t):this.b[t].remove(e,i)},zs.Pc=function(t){var e=this.b[t].appendWindowStart,i=this.b[t].appendWindowEnd;this.b[t].abort(),this.b[t].appendWindowStart=e,this.b[t].appendWindowEnd=i,this.Ha(t)},zs.Yc=function(t){this.g.currentTime-=.001,this.Ha(t)},zs.re=function(t,e){this.b[t].timestampOffset=e,this.Ha(t)},zs.oe=function(t,e,i){this.b[t].appendWindowStart=0,this.b[t].appendWindowEnd=i,this.b[t].appendWindowStart=e,this.Ha(t)},zs.Be=function(t){this.c[t][0].p.reject(new h(2,3,3014,this.g.error?this.g.error.code:0))},zs.Ha=function(t){var e=this.c[t][0];e&&(e.p.resolve(),zt(this,t))};var so=1,oo=2,uo={aar:"aa",abk:"ab",afr:"af",aka:"ak",alb:"sq",amh:"am",ara:"ar",arg:"an",arm:"hy",asm:"as",ava:"av",ave:"ae",aym:"ay",aze:"az",bak:"ba",bam:"bm",baq:"eu",bel:"be",ben:"bn",bih:"bh",bis:"bi",bod:"bo",bos:"bs",bre:"br",bul:"bg",bur:"my",cat:"ca",ces:"cs",cha:"ch",che:"ce",chi:"zh",chu:"cu",chv:"cv",cor:"kw",cos:"co",cre:"cr",cym:"cy",cze:"cs",dan:"da",deu:"de",div:"dv",dut:"nl",dzo:"dz",ell:"el",eng:"en",epo:"eo",est:"et",eus:"eu",ewe:"ee",fao:"fo",fas:"fa",fij:"fj",fin:"fi",fra:"fr",fre:"fr",fry:"fy",ful:"ff",geo:"ka",ger:"de",gla:"gd",gle:"ga",glg:"gl",glv:"gv",gre:"el",grn:"gn",guj:"gu",hat:"ht",hau:"ha",heb:"he",her:"hz",hin:"hi",hmo:"ho",hrv:"hr",hun:"hu",hye:"hy",ibo:"ig",ice:"is",ido:"io",iii:"ii",iku:"iu",ile:"ie",ina:"ia",ind:"id",ipk:"ik",isl:"is",ita:"it",jav:"jv",jpn:"ja",kal:"kl",kan:"kn",kas:"ks",kat:"ka",kau:"kr",kaz:"kk",khm:"km",kik:"ki",kin:"rw",kir:"ky",kom:"kv",kon:"kg",kor:"ko",kua:"kj",kur:"ku",lao:"lo",lat:"la",lav:"lv",lim:"li",lin:"ln",lit:"lt",ltz:"lb",lub:"lu",lug:"lg",mac:"mk",mah:"mh",mal:"ml",mao:"mi",mar:"mr",may:"ms",mkd:"mk",mlg:"mg",mlt:"mt",mon:"mn",mri:"mi",msa:"ms",mya:"my",nau:"na",nav:"nv",nbl:"nr",nde:"nd",ndo:"ng",nep:"ne",nld:"nl",nno:"nn",nob:"nb",nor:"no",nya:"ny",oci:"oc",oji:"oj",ori:"or",orm:"om",oss:"os",pan:"pa",per:"fa",pli:"pi",pol:"pl",por:"pt",pus:"ps",que:"qu",roh:"rm",ron:"ro",rum:"ro",run:"rn",rus:"ru",sag:"sg",san:"sa",sin:"si",slk:"sk",slo:"sk",slv:"sl",sme:"se",smo:"sm",sna:"sn",snd:"sd",som:"so",sot:"st",spa:"es",sqi:"sq",srd:"sc",srp:"sr",ssw:"ss",sun:"su",swa:"sw",swe:"sv",tah:"ty",tam:"ta",tat:"tt",tel:"te",tgk:"tg",tgl:"tl",tha:"th",tib:"bo",tir:"ti",ton:"to",tsn:"tn",tso:"ts",tuk:"tk",tur:"tr",twi:"tw",uig:"ug",ukr:"uk",urd:"ur",uzb:"uz",ven:"ve",vie:"vi",vol:"vo",wel:"cy",wln:"wa",wol:"wo",xho:"xh",yid:"yi",yor:"yo",zha:"za",zho:"zh",zul:"zu"};e("shaka.abr.SimpleAbrManager",pe),pe.prototype.stop=function(){this.h=null,this.c=!1,this.g=[],this.f=null},pe.prototype.stop=pe.prototype.stop,pe.prototype.init=function(t){this.h=t},pe.prototype.init=pe.prototype.init,pe.prototype.chooseVariant=function(){var t=me(this.a.restrictions,this.g),e=this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate);if(this.g.length&&!t.length)throw new h(2,4,4012);for(var i=t[0]||null,n=0;n<t.length;++n){var r=t[n],a=(t[n+1]||{bandwidth:1/0}).bandwidth/this.a.bandwidthUpgradeTarget;e>=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;i<e.length;++i){t.target=this.bb,t.currentTarget=this.bb;var n=e[i];try{n.handleEvent?n.handleEvent(t):n.call(this,t)}catch(t){}if(t.a)break}return t.defaultPrevented},i(Ae),e("shaka.cast.CastProxy",Ae),Ae.prototype.o=function(t){return t&&this.a&&this.a.lb(),t=[this.i?this.i.o():null,this.b?this.b.o():null,this.a?this.a.o():null],this.a=this.i=this.j=this.h=this.b=this.c=null,Promise.all(t)},Ae.prototype.destroy=Ae.prototype.o,Ae.prototype.nd=function(){return this.h},Ae.prototype.getVideo=Ae.prototype.nd,Ae.prototype.dd=function(){return this.j},Ae.prototype.getPlayer=Ae.prototype.dd,Ae.prototype.Qc=function(){return!!this.a&&(this.a.h&&wo)},Ae.prototype.canCast=Ae.prototype.Qc,Ae.prototype.aa=function(){return!!this.a&&this.a.aa()},Ae.prototype.isCasting=Ae.prototype.aa,Ae.prototype.Nb=function(){return this.a?this.a.Nb():""},Ae.prototype.receiverName=Ae.prototype.Nb,Ae.prototype.cast=function(){var t=this.fc();return this.a.cast(t).then(function(){return this.b.sb()}.bind(this))},Ae.prototype.cast=Ae.prototype.cast,Ae.prototype.Rb=function(t){this.a.Rb(t)},Ae.prototype.setAppData=Ae.prototype.Rb,Ae.prototype.Ee=function(){var t=this.a;if(t.b){var e=t.w();chrome.cast.requestSession(t.Jb.bind(t,e),t.lc.bind(t))}},Ae.prototype.suggestDisconnect=Ae.prototype.Ee,Ae.prototype.lb=function(){this.a.lb()},Ae.prototype.forceDisconnect=Ae.prototype.lb,zs=Ae.prototype,zs.fc=function(){var t={video:{},player:{},playerAfterLoad:{},manifest:this.b.ib,startTime:null};return this.c.pause(),lo.forEach(function(e){t.video[e]=this.c[e]}.bind(this)),this.c.ended||(t.startTime=this.c.currentTime),go.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.player[i]=e}.bind(this)),bo.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.playerAfterLoad[i]=e}.bind(this)),t},zs.ve=function(){this.dispatchEvent(new G("caststatuschanged"))},zs.we=function(){this.f.dispatchEvent(new G(this.h.paused?"pause":"play"))},zs.ye=function(){go.forEach(function(t){var e=t[1];t=this.a.get("player",t[0])(),this.b[e](t)}.bind(this));var t=this.a.get("player","getManifestUri")(),e=this.a.get("video","ended"),i=Promise.resolve(),n=this.c.autoplay,r=null;e||(r=this.a.get("video","currentTime")),t&&(this.c.autoplay=!1,i=this.b.load(t,r),i.catch(function(t){this.b.dispatchEvent(new G("error",{detail:t}))}.bind(this)));var a={};lo.forEach(function(t){a[t]=this.a.get("video",t)}.bind(this)),i.then(function(){lo.forEach(function(t){this.c[t]=a[t]}.bind(this)),bo.forEach(function(t){var e=t[1];t=this.a.get("player",t[0])(),this.b[e](t)}.bind(this)),this.c.autoplay=n,t&&this.c.play()}.bind(this))},zs.Le=function(t){if("addEventListener"==t)return this.f.addEventListener.bind(this.f);if("removeEventListener"==t)return this.f.removeEventListener.bind(this.f);if(this.a.aa()&&!Object.keys(this.a.a.video).length){var e=this.c[t];if("function"!=typeof e)return e}return this.a.aa()?this.a.get("video",t):(e=this.c[t],"function"==typeof e&&(e=e.bind(this.c)),e)},zs.Ne=function(t,e){this.a.aa()?this.a.set("video",t,e):this.c[t]=e},zs.Me=function(t){this.a.aa()||this.f.dispatchEvent(new G(t.type,t))},zs.Xd=function(t){return"addEventListener"==t?this.g.addEventListener.bind(this.g):"removeEventListener"==t?this.g.removeEventListener.bind(this.g):"getMediaElement"==t?function(){return this.h}.bind(this):"getNetworkingEngine"==t?this.b.gc.bind(this.b):this.a.aa()&&!Object.keys(this.a.a.video).length&&0<=mo.indexOf(t)||!this.a.aa()?(t=this.b[t],t.bind(this.b)):this.a.get("player",t)},zs.Yd=function(t){this.a.aa()||this.g.dispatchEvent(t)},zs.xe=function(t,e){this.a.aa()&&("video"==t?this.f.dispatchEvent(e):"player"==t&&this.g.dispatchEvent(e))},i(Ie),e("shaka.cast.CastReceiver",Ie),Ie.prototype.isConnected=function(){return this.i},Ie.prototype.isConnected=Ie.prototype.isConnected,Ie.prototype.qd=function(){return this.f},Ie.prototype.isIdle=Ie.prototype.qd,Ie.prototype.o=function(){var e=this.b?this.b.o():Promise.resolve();return null!=this.h&&t.clearTimeout(this.h),this.l=this.j=this.b=this.a=null,this.i=!1,this.f=!0,this.h=this.g=this.c=null,e.then(function(){cast.receiver.CastReceiverManager.getInstance().stop()})},Ie.prototype.destroy=Ie.prototype.o,zs=Ie.prototype,zs.tc=function(){this.i=!!cast.receiver.CastReceiverManager.getInstance().getSenders().length,_e(this)},zs.wc=function(t,e){this.b&&(this.Kb(),Re(this,{type:"event",targetName:t,event:e},this.c))},zs.Kb=function(){null!=this.h&&t.clearTimeout(this.h),this.h=t.setTimeout(this.Kb.bind(this),500);var e={video:{},player:{}};co.forEach(function(t){e.video[t]=this.a[t]}.bind(this));var i=mo;this.b.R()&&(i=i.concat(vo)),i.forEach(function(t){e.player[t]=this.b[t]()}.bind(this)),(i=cast.receiver.CastReceiverManager.getInstance().getSystemVolume())&&(e.video.volume=i.level,e.video.muted=i.muted),Re(this,{type:"update",update:e},this.c)},zs.Xc=function(){var t=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();t&&Re(this,{type:"update",update:{video:{volume:t.level,muted:t.muted}}},this.c),Re(this,{type:"event",targetName:"video",event:{type:"volumechange"}},this.c)},zs.Ld=function(t){var e=ge(t.data);switch(e.type){case"init":xe(this,e.initState,e.appData),this.Kb();break;case"appData":this.l(e.appData);break;case"set":var i=e.targetName,n=e.property,r=e.value;if("video"==i){if(e=cast.receiver.CastReceiverManager.getInstance(),"volume"==n){e.setSystemVolumeLevel(r);break}if("muted"==n){e.setSystemVolumeMuted(r);break}}this.j[i][n]=r;break;case"call":i=e.targetName,n=e.methodName,r=e.args,i=this.j[i],i[n].apply(i,r);break;case"asyncCall":i=e.targetName,n=e.methodName,r=e.args,e=e.id,t=t.senderId,i=this.j[i],i[n].apply(i,r).then(this.Ec.bind(this,t,e,null),this.Ec.bind(this,t,e))}},zs.xd=function(t){var e=ge(t.data);switch(e.type){case"PLAY":this.a.play(),Ne(this,0);break;case"PAUSE":this.a.pause(),Ne(this,0);break;case"SEEK":t=e.currentTime;var i=e.resumeState;null!=t&&(this.a.currentTime=Number(t)),i&&"PLAYBACK_START"==i?(this.a.play(),Ne(this,0)):i&&"PLAYBACK_PAUSE"==i&&(this.a.pause(),Ne(this,0));break;case"STOP":this.b.sb().then(function(){Ne(this,0)}.bind(this));break;case"GET_STATUS":Ne(this,Number(e.requestId));break;case"VOLUME":i=e.volume,t=i.level;var i=i.muted,n=this.a.volume,r=this.a.muted;null!=t&&(this.a.volume=Number(t)),null!=i&&(this.a.muted=i),n==this.a.volume&&r==this.a.muted||Ne(this,0);break;case"LOAD":i=e.media.contentId,t=e.currentTime;var a=this.m(i);this.a.autoplay=!0,this.b.load(a,t).then(function(){Ne(this,0,{contentId:a,streamType:this.b.R()?"LIVE":"BUFFERED",contentType:""})}.bind(this)).catch(function(t){var i="LOAD_FAILED";7==t.category&&7e3==t.code&&(i="LOAD_CANCELLED"),Re(this,{requestId:Number(e.requestId),type:i},this.g)}.bind(this));break;default:Re(this,{requestId:Number(e.requestId),type:"INVALID_REQUEST",reason:"INVALID_COMMAND"},this.g)}},zs.Ec=function(t,e,i){Re(this,{type:"asyncComplete",id:e,error:i},this.c,t)};var So={IDLE:"IDLE",Nc:"PLAYING",Lc:"BUFFERING",Mc:"PAUSED"},Ao={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"};e("shaka.media.InitSegmentReference",ti),e("shaka.media.SegmentReference",ei),e("shaka.util.DataViewReader",ii);var ko=1;ii.Endianness={Oe:0,Qe:ko},ii.prototype.da=function(){return this.v<this.O.byteLength},ii.prototype.hasMoreData=ii.prototype.da,ii.prototype.fd=function(){return this.v},ii.prototype.getPosition=ii.prototype.fd,ii.prototype.$c=function(){return this.O.byteLength},ii.prototype.getLength=ii.prototype.$c,ii.prototype.Mb=function(){try{var t=this.O.getUint8(this.v)}catch(t){ni()}return this.v+=1,t},ii.prototype.readUint8=ii.prototype.Mb,ii.prototype.yc=function(){try{var t=this.O.getUint16(this.v,this.a)}catch(t){ni()}return this.v+=2,t},ii.prototype.readUint16=ii.prototype.yc,ii.prototype.F=function(){try{var t=this.O.getUint32(this.v,this.a)}catch(t){ni()}return this.v+=4,t},ii.prototype.readUint32=ii.prototype.F,ii.prototype.xc=function(){try{var t=this.O.getInt32(this.v,this.a)}catch(t){ni()}return this.v+=4,t},ii.prototype.readInt32=ii.prototype.xc,ii.prototype.Va=function(){try{if(this.a)var t=this.O.getUint32(this.v,!0),e=this.O.getUint32(this.v+4,!0);else e=this.O.getUint32(this.v,!1),t=this.O.getUint32(this.v+4,!1)}catch(t){ni()}if(2097151<e)throw new h(2,3,3001);return this.v+=8,e*Math.pow(2,32)+t},ii.prototype.readUint64=ii.prototype.Va,ii.prototype.Ja=function(t){this.v+t>this.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<r?e.Ja(r).buffer:new ArrayBuffer(0),r=new ii(new DataView(r),0),a({Ta:this,version:s,ec:o,u:r,size:n,start:i+t})}else e.I(i+n-e.v)},ai.prototype.parseNext=ai.prototype.qb,ai.children=si,ai.sampleDescription=oi,ai.allData=ui,e("shaka.media.SegmentIndex",fi),fi.prototype.o=function(){return this.a=null,Promise.resolve()},fi.prototype.destroy=fi.prototype.o,fi.prototype.find=function(t){for(var e=this.a.length-1;0<=e;--e){var i=this.a[e];if(t>=i.startTime&&t<i.endTime)return i.position}return this.a.length&&t<this.a[0].startTime?this.a[0].position:null},fi.prototype.find=fi.prototype.find,fi.prototype.get=function(t){return this.a.length?(t-=this.a[0].position,0>t||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;e<this.a.length&&a<t.length;)i=this.a[e],n=t[a],i.startTime<n.startTime?(r.push(i),e++):(i.startTime>n.startTime?e||r.push(n):(.1<Math.abs(i.endTime-n.endTime)?(n=new ei(i.position,n.startTime,n.endTime,n.a,n.T,n.K),r.push(n)):r.push(i),e++),a++);for(;e<this.a.length;)r.push(this.a[e++]);if(r.length)for(e=r[r.length-1].position+1;a<t.length;)n=t[a++],n=new ei(e++,n.startTime,n.endTime,n.a,n.T,n.K),r.push(n);else r=t;this.a=r},fi.prototype.merge=fi.prototype.ob,fi.prototype.xb=function(t){for(var e=0;e<this.a.length&&!(this.a[e].endTime>t);++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;s<n.length;s++){var o=n[s].getAttribute("schemeIdUri");if(null==o||"urn:mpeg:dash:role:2011"==o)switch(o=n[s].getAttribute("value")){case"main":i=!0;break;case"caption":case"subtitle":a=o}}var u=null,c=!1;if(Le(e,"EssentialProperty").forEach(function(t){"http://dashif.org/guidelines/trickmode"==t.getAttribute("schemeIdUri")?u=t.getAttribute("value"):c=!0}),c)return null;var n=Le(e,"ContentProtection"),l=Ke(n,this.b.dash.customScheme,this.b.dash.ignoreDrmInfo),n=Wt(e.getAttribute("lang")||"und"),o=e.getAttribute("label"),s=Le(e,"Representation"),r=s.map(this.Wd.bind(this,t,l,a,n,o,i,r)).filter(function(t){return!!t});if(!r.length)throw new h(2,4,4003);return t.V.contentType&&"application"!=t.V.contentType||(t.V.contentType=Qi(r[0].mimeType,r[0].codecs),r.forEach(function(e){e.type=t.V.contentType})),r.forEach(function(t){l.drmInfos.forEach(function(e){t.keyId&&e.keyIds.push(t.keyId)})}),a=s.map(function(t){return t.getAttribute("id")}).filter(R),{id:t.V.id||"__fake__"+this.h++,contentType:t.V.contentType,language:n,Cb:i,streams:r,drmInfos:l.drmInfos,Wb:u,ee:a}},zs.Wd=function(t,e,i,n,r,a,s,o){if(t.A=Yi(o,t.V,null),!$i(t.A))return null;t.bandwidth=Me(o,"bandwidth",Fe)||0;var u=this.fe.bind(this);if(t.A.Wa)u=Si(t,u);else if(t.A.pa)u=Ii(t,this.j);else if(t.A.Xa)u=Ri(t,u,this.j,!!this.c);else{var h=t.A.$,c=t.S.duration||0;u={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(t){return 0<=t&&t<c?1:null},getSegmentReference:function(t){return 1!=t?null:new ei(1,0,c,function(){return h},0,null)},initSegmentReference:null,Z:0}}return o=Le(o,"ContentProtection"),o=Ge(o,this.b.dash.customScheme,e,this.b.dash.ignoreDrmInfo),{id:this.h++,createSegmentIndex:u.createSegmentIndex,findSegmentPosition:u.findSegmentPosition,getSegmentReference:u.getSegmentReference,initSegmentReference:u.initSegmentReference,presentationTimeOffset:u.Z,mimeType:t.A.mimeType,codecs:t.A.codecs,frameRate:t.A.frameRate,bandwidth:t.bandwidth,width:t.A.width,height:t.A.height,kind:i,encrypted:0<e.drmInfos.length,keyId:o,language:n,label:r,type:t.V.contentType,primary:a,trickModeVideo:null,containsEmsgBoxes:t.A.containsEmsgBoxes,roles:s,channelsCount:t.A.Fb}},zs.ze=function(){this.f=null;var t=Date.now();Bi(this).then(function(){this.a&&Xi(this,(Date.now()-t)/1e3)}.bind(this)).catch(function(t){this.a&&(t.severity=1,this.a.onError(t),Xi(this,0))}.bind(this))},zs.Vd=function(t,e,i){var n=i.getAttribute("schemeIdUri")||"",r=i.getAttribute("value")||"",a=Me(i,"timescale",Ve)||1;Le(i,"Event").forEach(function(i){var s=Me(i,"presentationTime",Ve)||0,o=Me(i,"duration",Ve)||0,s=s/a+t,o=s+o/a;null!=e&&(s=Math.min(s,t+e),o=Math.min(o,t+e)),i={schemeIdUri:n,value:r,startTime:s,endTime:o,id:i.getAttribute("id")||"",eventElement:i},this.a.onTimelineRegionAdded(i)}.bind(this))},zs.fe=function(t,e,i){return t=L(t,this.b.retryParameters),null!=e&&(t.headers.Range="bytes="+e+"-"+(null!=i?i:"")),this.a.networkingEngine.request(1,t).then(function(t){return t.data})},_o.mpd=ji,Po["application/dash+xml"]=ji,tn.prototype.toString=function(){function t(t){return t.name+'="'+t.value+'"'}return this.value?"#"+this.name+":"+this.value:0<this.a.length?"#"+this.name+":"+this.a.map(t).join(","):"#"+this.name},tn.prototype.getAttribute=function(t){var e=this.a.filter(function(e){return e.name==t});return e.length?e[0]:null};var xo="EXT-X-TARGETDURATION EXT-X-MEDIA-SEQUENCE EXT-X-DISCONTINUITY-SEQUENCE EXT-X-PLAYLIST-TYPE EXT-X-MAP EXT-X-I-FRAMES-ONLY EXT-X-ENDLIST".split(" "),Ro="EXTINF EXT-X-BYTERANGE EXT-X-DISCONTINUITY EXT-X-PROGRAM-DATE-TIME EXT-X-KEY EXT-X-DATERANGE".split(" ");e("shaka.net.DataUriPlugin",mn),mn.parse=function(e){var i=e.split(":");if(2>i.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(1<n.length&&(r=n[1]),"base64"==r)e=ut(i).buffer;else{if(r)throw new h(2,1,1005,e);e=it(i)}return{data:e,contentType:n[0]}},io.data=mn,e("shaka.hls.HlsParser",vn),zs=vn.prototype,zs.configure=function(t){this.h=t},zs.start=function(t,e){return this.b=e,this.m=t,Bn(this,t).then(function(e){return bn(this,e.data,t).then(function(){return Fn(this,this.c),this.B}.bind(this))}.bind(this))},zs.stop=function(){return this.h=this.b=null,this.g={},this.C={},this.B=null,Promise.resolve()},zs.update=function(){if(this.f){for(var t=[],e=Object.keys(this.s),i=0;i<e.length;i++){var n=e[i];t.push(gn(this,this.s[n],n))}return Promise.all(t)}},zs.onExpirationUpdated=function(){};var No={audio:[/^vorbis$/,/^opus$/,/^flac$/,/^mp4a/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]},Do={audio:{mp4:"audio/mp4",m4s:"audio/mp4",m4i:"audio/mp4",m4a:"audio/mp4",ts:"video/mp2t"},video:{mp4:"video/mp4",m4s:"video/mp4",m4i:"video/mp4",m4v:"video/mp4",ts:"video/mp2t"},text:{mp4:"application/mp4",m4s:"application/mp4",m4i:"application/mp4",vtt:"text/vtt",ttml:"application/ttml+xml"}};vn.prototype.J=function(){this.b&&(this.i=null,this.update().then(function(){Fn(this,this.c)}.bind(this)).catch(function(t){this.b&&(t.severity=1,this.b.onError(t),Fn(this,0))}.bind(this)))};var Lo={"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(t){if("SAMPLE-AES-CENC"!=Un(t,"METHOD"))return null;var e=Un(t,"URI"),e=mn.parse(e),e=new Uint8Array(e.data),e=X("com.widevine.alpha",[{initDataType:"cenc",initData:e}]);return(t=nn(t,"KEYID"))&&(e.keyIds=[t.substr(2).toLowerCase()]),e}};_o.m3u8=vn,Po["application/x-mpegurl"]=vn,Po["application/vnd.apple.mpegurl"]=vn,zs=Hn.prototype,zs.o=function(){var t=this.b.o();return this.b=null,this.f&&(this.f.cancel(),this.f=null),this.h&&(this.h.cancel(),this.h=null),this.g&&(this.g.cancel(),this.g=null),this.J=this.L=this.l=this.c=this.a=null,t},zs.zb=function(){return this.i},zs.Ib=function(){this.w=!0,this.rc()},zs.Hd=function(){var t=this.j||0>this.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(e<this.c.presentationTimeline.ka())i=zn(this,e),$n(this,e,i);else{t:{if(i&&i.length&&!(1==i.length&&1e-6>i.end(0)-i.start(0))){var n=.1;/(Edge\/|Trident\/|Tizen)/.test(navigator.userAgent)&&(n=.5);for(var r=0;r<i.length;r++)if(i.start(r)>e&&(!r||i.end(r-1)-e<=n)){n=r;break t}}n=null}if(null==n){if(3>this.a.readyState&&0<this.a.playbackRate)if(this.C!=e)this.C=e,this.X=Date.now(),this.B=!1;else if(!this.B&&this.X<Date.now()-1e3)for(n=0;n<i.length;n++)if(e>=i.start(n)&&e<i.end(n)-.5){this.a.currentTime+=.1,this.C=this.a.currentTime,this.B=!0;break}}else if((n||this.w)&&!((r=i.start(n))>=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);.001<Math.abs(e-t)?$n(this,t,e):(this.s=!1,this.L())},zs.qc=function(){var t=this.a.currentTime,e=zn(this,t);.001<Math.abs(e-t)&&$n(this,t,e)},Jn.prototype.o=function(){var t=this.j?this.j.o():Promise.resolve();return this.j=null,tr(this),this.C=this.h=this.l=this.w=this.g=this.B=this.a=null,this.c=[],t},Jn.prototype.s=function(t){if(!this.c.some(function(e){return e.info.schemeIdUri==t.schemeIdUri&&e.info.startTime==t.startTime&&e.info.endTime==t.endTime})){var e={info:t,status:1};this.c.push(e);var i=new G("timelineregionadded",{detail:Qn(t)});this.h(i),this.m(!0,e)}},Jn.prototype.m=function(t,e){var i=e.info.startTime>this.a.currentTime?1:e.info.endTime<this.a.currentTime?3:2,n=2==e.status,r=2==i;i!=e.status&&((!t||n||r)&&(n||this.h(new G("timelineregionenter",{detail:Qn(e.info)})),r||this.h(new G("timelineregionexit",{detail:Qn(e.info)}))),e.status=i)},Jn.prototype.D=function(){this.f=null,Zn(this);var t=fe(this.g,this.a.currentTime);t!=this.i&&(-1!=this.i&&this.C(),this.i=t);var t=Dt(this.a.buffered,this.a.currentTime),e=Rt(this.a.buffered),i=this.g.presentationTimeline,n=i.ua(),r="ended"==this.B.readyState,e=i.R()&&e>=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;i<t.length;i++){var n=Qr(t[i]);n&&e.push(n)}e.slice().sort(function(t,i){return t.startTime!=i.startTime?t.startTime-i.startTime:t.endTime!=i.endTime?t.endTime-i.startTime:e.indexOf(i)-e.indexOf(t)}).forEach(function(t){this.a.addCue(t)}.bind(this))},Jr.prototype.append=Jr.prototype.append,Jr.prototype.o=function(){return this.a&&Zr(this,function(){return!0}),this.a=null,Promise.resolve()},Jr.prototype.destroy=Jr.prototype.o,Jr.prototype.isTextVisible=function(){return"showing"==this.a.mode},Jr.prototype.isTextVisible=Jr.prototype.isTextVisible,Jr.prototype.setTextVisibility=function(t){this.a.mode=t?"showing":"hidden"},Jr.prototype.setTextVisibility=Jr.prototype.setTextVisibility,ta.prototype.then=function(t){return this.a=this.a.then(t).then(function(t){return this.b?(this.g(),Promise.reject(this.h)):Promise.resolve(t)}.bind(this)),this},ta.prototype.cancel=function(t){return this.c?Promise.resolve():(this.b=!0,this.h=t,this.i)},i(ia),e("shaka.Player",ia),ia.prototype.o=function(){return this.D=!0,na(this).then(function(){var t=Promise.all([this.Pa,la(this),this.m?this.m.o():null,this.s?this.s.o():null]);return this.f=null,this.jb=!1,this.c=this.s=this.g=this.m=null,t}.bind(this))},ia.prototype.destroy=ia.prototype.o,ia.version="v2.2.8";var Mo={};ia.registerSupportPlugin=function(t,e){Mo[t]=e},ia.isBrowserSupported=function(){return!!(t.Promise&&t.Uint8Array&&Array.prototype.forEach&&t.MediaSource&&MediaSource.isTypeSupported&&t.MediaKeys&&t.navigator&&t.navigator.requestMediaKeySystemAccess&&t.MediaKeySystemAccess&&t.MediaKeySystemAccess.prototype.getConfiguration)},ia.probeSupport=function(){return Pt().then(function(t){t={manifest:Mi(),media:Bt(),drm:t};for(var e in Mo)t[e]=Mo[e]();return t})},ia.prototype.load=function(t,e,i){var n=this.sb(),r=new ta;this.ia=r,this.dispatchEvent(new G("loading"));var a=Date.now();return ea(r.then(function(){return n}).then(function(){return this.j=ma(),F(this.m,this.f,"playing",this.Za.bind(this)),F(this.m,this.f,"pause",this.Za.bind(this)),F(this.m,this.f,"ended",this.Za.bind(this)),this.g=new this.c.abrFactory,oa(this),this.w=new this.c.textDisplayFactory,this.w.setTextVisibility(this.jb),Oi(t,this.s,this.c.manifest.retryParameters,i)}.bind(this)).then(function(e){return this.i=new e,this.i.configure(this.c.manifest),e={networkingEngine:this.s,filterNewPeriod:this.kb.bind(this),filterAllPeriods:this.Tb.bind(this),onTimelineRegionAdded:this.Nd.bind(this),onEvent:this.Ya.bind(this),onError:this.La.bind(this)},2<this.i.start.length?(o("The ManifestParser interface has changed. Please upgrade your plugin to accept the PlayerInterface structure. See the ManifestParser documentation for details."),this.i.start(t,this.s,e.filterNewPeriod,e.onError,e.onEvent)):this.i.start(t,e)}.bind(this)).then(function(e){if(e.periods.some(function(t){return t.variants.some(function(t){return t.video&&t.audio})})&&e.periods.forEach(function(t){t.variants=t.variants.filter(function(t){return t.video&&t.audio})}),0==e.periods.length)throw new h(2,4,4014);return this.b=e,this.ib=t,this.l=new ft({Sa:this.s,onError:this.La.bind(this),Hb:this.zd.bind(this),onExpirationUpdated:this.wd.bind(this),onEvent:this.Ya.bind(this)}),this.l.configure(this.c.drm),this.l.init(e,!1)}.bind(this)).then(function(){this.Tb(this.b.periods),this.cb=Date.now()/1e3,this.Ma=this.c.preferredAudioLanguage,this.$a=this.c.preferredTextLanguage;var t=this.b.presentationTimeline.W(),e=this.c.playRangeEnd,i=this.c.playRangeStart;return 0<i&&(this.R()||this.b.presentationTimeline.Fc(i)),e<t&&(this.R()||this.b.presentationTimeline.ga(e)),Promise.all([dt(this.l,this.f),this.gb])}.bind(this)).then(function(){return this.g.chooseStreams?(o("AbrManager API has changed. The SwitchCallback signature has changed to accept a variant instead of a map. Please update your AbrManager. The old API will be removed in v2.3."),this.g.init(this.Fe.bind(this))):this.g.init(this.Kc.bind(this)),this.h=new Hn(this.f,this.b,this.c.streaming,void 0==e?null:e,this.te.bind(this),this.Ya.bind(this)),this.B=new Jn(this.f,this.L,this.b,this.c.streaming,this.Jc.bind(this),this.Ya.bind(this),this.se.bind(this)),this.J=new jt(this.f,this.L,this.w),this.a=new er(this.b,{Ua:this.h,M:this.J,Sa:this.s,kc:this.td.bind(this),jc:this.Rc.bind(this),onError:this.La.bind(this),onEvent:this.Ya.bind(this),Ad:this.Bd.bind(this),Ib:this.Kd.bind(this),filterNewPeriod:this.kb.bind(this),filterAllPeriods:this.Tb.bind(this)}),this.a.configure(this.c.streaming),this.dispatchEvent(new G("streaming")),ra(this),this.a.init()}.bind(this)).then(function(){if(this.c.streaming.startAtSegmentBoundary){var t=ba(this,qn(this.h));Kn(this.h,t)}this.b.periods.forEach(this.kb.bind(this)),Ea(this),wa(this);var t=ir(this.a),e=se(t,this.Ma,this.ab);this.g.setVariants(e),t.variants.some(function(t){return t.primary}),this.hb.forEach(this.B.s.bind(this.B)),this.hb=[],V(this.m,this.f,"loadeddata",function(){this.j.loadLatency=(Date.now()-a)/1e3}.bind(this)),this.ia=null}.bind(this))).catch(function(t){return this.ia==r&&(this.ia=null,this.dispatchEvent(new G("unloading"))),Promise.reject(t)}.bind(this))},ia.prototype.load=ia.prototype.load,ia.prototype.configure=function(t){if(t.abr&&t.abr.manager){o("AbrManager configuration has changed. Please use abrFactory instead of abr.manager. The old API will be removed in v2.3.");var e=t.abr.manager;delete t.abr.manager,t.abrFactory=function(){return e}}t.streaming&&null!=t.streaming.infiniteRetriesForLiveStreams&&(o("Streaming configuration has changed. Please use streaming.failureCallback instead of streaming.infiniteRetriesForLiveStreams. The old API will be removed in v2.3."),this.Zb=!!t.streaming.infiniteRetriesForLiveStreams,delete t.streaming.infiniteRetriesForLiveStreams),k(this.c,t,pa(this),da(),""),sa(this)},ia.prototype.configure=ia.prototype.configure,ia.prototype.getConfiguration=function(){var t=pa(this);return k(t,this.c,pa(this),da(),""),t},ia.prototype.getConfiguration=ia.prototype.getConfiguration,ia.prototype.ge=function(){this.c=pa(this),sa(this)},ia.prototype.resetConfiguration=ia.prototype.ge,ia.prototype.cd=function(){return this.f},ia.prototype.getMediaElement=ia.prototype.cd,ia.prototype.gc=function(){return this.s},ia.prototype.getNetworkingEngine=ia.prototype.gc,ia.prototype.bd=function(){return this.ib},ia.prototype.getManifestUri=ia.prototype.bd,ia.prototype.R=function(){return!!this.b&&this.b.presentationTimeline.R()},ia.prototype.isLive=ia.prototype.R,ia.prototype.va=function(){return!!this.b&&this.b.presentationTimeline.va()},ia.prototype.isInProgress=ia.prototype.va,ia.prototype.od=function(){if(!this.b||!this.b.periods.length)return!1;var t=this.b.periods[0].variants;return!!t.length&&!t[0].video},ia.prototype.isAudioOnly=ia.prototype.od,ia.prototype.ie=function(){var t=0,e=0;return this.b&&(e=this.b.presentationTimeline,t=e.ka(),e=e.nb()),{start:t,end:e}},ia.prototype.seekRange=ia.prototype.ie,ia.prototype.keySystem=function(){return this.l?this.l.keySystem():""},ia.prototype.keySystem=ia.prototype.keySystem,ia.prototype.drmInfo=function(){return this.l?this.l.b:null},ia.prototype.drmInfo=ia.prototype.drmInfo,ia.prototype.mb=function(){return this.l?this.l.mb():1/0},ia.prototype.getExpiration=ia.prototype.mb,ia.prototype.pd=function(){return this.Oa},ia.prototype.isBuffering=ia.prototype.pd,ia.prototype.sb=function(){return this.D?Promise.resolve():(this.dispatchEvent(new G("unloading")),na(this).then(function(){return this.Pa||(this.Pa=fa(this).then(function(){this.Pa=null}.bind(this))),this.Pa}.bind(this)))},ia.prototype.unload=ia.prototype.sb,ia.prototype.zb=function(){return this.h?this.h.zb():0},ia.prototype.getPlaybackRate=ia.prototype.zb,ia.prototype.Ge=function(t){this.h&&Yn(this.h,t),this.a&&ar(this.a,1!=t)},ia.prototype.trickPlay=ia.prototype.Ge,ia.prototype.Sc=function(){this.h&&Yn(this.h,1),this.a&&ar(this.a,!1)},ia.prototype.cancelTrickPlay=ia.prototype.Sc,ia.prototype.md=function(){if(!this.b||!this.h)return[];var t=fe(this.b,qn(this.h)),e=this.C[t]||{};return ee(this.b.periods[t],e.audio,e.video)},ia.prototype.getVariantTracks=ia.prototype.md,ia.prototype.ld=function(){if(!this.b||!this.h)return[];var t=fe(this.b,qn(this.h));return ie(this.b.periods[t],(this.C[t]||{}).text).filter(function(t){return 0>this.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;u<this.b.periods.length;u++)if(this.b.periods[u]==o){if(u==this.b.periods.length-1){if(s=this.b.presentationTimeline.W()-o.startTime,1/0==s)return Promise.reject()}else s=this.b.periods[u+1].startTime-o.startTime;break}var h={id:this.Oc++,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return 1},getSegmentReference:function(e){return 1!=e?null:new ei(1,0,s,function(){return[t]},0,null)},initSegmentReference:null,presentationTimeOffset:0,mimeType:n,codecs:r||"",kind:i,encrypted:!1,keyId:null,language:e,label:a||null,type:"text",primary:!1,trickModeVideo:null,containsEmsgBoxes:!1,roles:[],channelsCount:null};return this.eb.push(h.id),o.textStreams.push(h),cr(this.a,{text:h}).then(function(){if(!this.D){var t=this.b.periods.indexOf(o),n=rr(this.a);return n.text&&(this.C[t].text=n.text.id),this.eb.splice(this.eb.indexOf(h.id),1),Ta(this,o),Ea(this),{id:h.id,active:!1,type:"text",bandwidth:0,language:e,label:a||null,kind:i,width:null,height:null}}}.bind(this))},ia.prototype.addTextTrack=ia.prototype.addTextTrack,ia.prototype.Sb=function(t,e){this.fb.width=t,this.fb.height=e},ia.prototype.setMaxHardwareResolution=ia.prototype.Sb,ia.prototype.Cc=function(){if(this.a){var t=this.a;if(t.f)t=!1;else if(t.l)t=!1;else{for(var e in t.c){var i=t.c[e];i.Qa&&(i.Qa=!1,Ir(t,i,.1))}t=!0}}else t=!1;return t},ia.prototype.retryStreaming=ia.prototype.Cc,ia.prototype.ad=function(){return this.b},ia.prototype.getManifest=ia.prototype.ad,zs=ia.prototype,zs.Vc=function(t){var e=[1001,1002,1003];this.R()&&this.Zb&&0<=e.indexOf(t.code)&&(t.severity=1,this.Cc())},zs.Tb=function(t){var e=this.a?rr(this.a):{};t.forEach(function(t){Zt(this.l,e,t)}.bind(this));var i=0;if(t.forEach(function(t){0<ae(t.variants).length&&i++}.bind(this)),!i)throw new h(2,4,9009);if(i<t.length)throw new h(2,4,4011);t.forEach(function(t){if(Qt(t,this.c.restrictions,this.fb)&&this.a&&ir(this.a)==t&&Ea(this),1>ae(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=0<ae(t.variants).length,Qt(t,this.c.restrictions,this.fb)&&this.a&&ir(this.a)==t&&Ea(this),t=1>ae(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<r.length;s++)if(r[s].length){e=r[s];break}e||(r=a.filter(function(t){return t.primary}),r.length&&(e=r)),e||(e=a,a.map(function(t){return t.language}).filter(N));var o=e.filter(function(t){return t.height&&480>=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;0<r;--r){var a=!1;for(i=r-1;0<=i;--i)if(n[r].type==n[i].type&&n[r].kind==n[i].kind&&n[r].language==n[i].language){a=!0;break}if(a)break}for(a=[],r=0;r<n.length;r++)(e=ne(t,n[r]))?(e.audio&&((i=a.filter(function(t){return t.id==e.audio.id})[0])?i.variantIds.push(e.id):(i=e.video?e.bandwidth/2:e.bandwidth,a.push(Na(this,t,e.audio,i,e.id)))),e.video&&((i=a.filter(function(t){return t.id==e.video.id})[0])?i.variantIds.push(e.id):(i=e.audio?e.bandwidth/2:e.bandwidth,a.push(Na(this,t,e.video,i,e.id))))):a.push(Na(this,t,re(t,n[r]),0));return{startTime:t.startTime,streams:a}},Mo.offline=ka,e("shaka.polyfill.installAll",function(){for(var t=0;t<Oo.length;++t)Oo[t]()});var Oo=[];e("shaka.polyfill.register",La),La(function(){if(t.Document){var e=Element.prototype;e.requestFullscreen=e.requestFullscreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullscreen,e=Document.prototype,e.exitFullscreen=e.exitFullscreen||e.mozCancelFullScreen||e.msExitFullscreen||e.webkitExitFullscreen,"fullscreenElement"in document||(Object.defineProperty(document,"fullscreenElement",{get:function(){return document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement}}),Object.defineProperty(document,"fullscreenEnabled",{get:function(){return document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled}})),document.addEventListener("webkitfullscreenchange",Ca),document.addEventListener("webkitfullscreenerror",Ca),document.addEventListener("mozfullscreenchange",Ca),document.addEventListener("mozfullscreenerror",Ca),document.addEventListener("MSFullscreenChange",Ca),document.addEventListener("MSFullscreenError",Ca)}}),La(function(){var e=navigator.userAgent;e&&0<=e.indexOf("CrKey")&&delete t.indexedDB});var Uo;La(function(){0>navigator.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(!(1<t.version)){var e=ct(t.u.Ja(16)),i=[];if(0<t.version)for(var n=t.u.F(),r=0;r<n;++r){var a=ct(t.u.Ja(16));i.push(a)}n=t.u.F(),t.u.I(n),this.b.push.apply(this.b,i),this.f.push(e),this.a.push({start:t.start,end:t.start+t.size-1})}},ja.prototype.createMediaKeys=function(){var t=new Fa(this.keySystem);return Promise.resolve(t)},ja.prototype.getConfiguration=function(){return this.a},Fa.prototype.createSession=function(t){if("temporary"!=(t||"temporary"))throw new TypeError("Session type "+t+" is unsupported on this platform.");return new Ha(this.a)},Fa.prototype.setServerCertificate=function(){return Promise.resolve(!1)},i(Ha),zs=Ha.prototype,zs.generateRequest=function(t,e){this.a=new y;try{this.c=this.g.createSession("video/mp4",new Uint8Array(e),null),F(this.f,this.c,"mskeymessage",this.Fd.bind(this)),F(this.f,this.c,"mskeyadded",this.Dd.bind(this)),F(this.f,this.c,"mskeyerror",this.Ed.bind(this)),qa(this,"status-pending")}catch(t){this.a.reject(t)}return this.a},zs.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},zs.update=function(t){this.b=new y;try{this.c.update(new Uint8Array(t))}catch(t){this.b.reject(t)}return this.b},zs.close=function(){try{this.c.close(),this.closed.resolve(),H(this.f)}catch(t){this.closed.reject(t)}return this.closed},zs.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},zs.Fd=function(t){this.a&&(this.a.resolve(),this.a=null),this.dispatchEvent(new G("message",{messageType:void 0==this.keyStatuses.a?"licenserequest":"licenserenewal",message:t.message.buffer}))},zs.Dd=function(){this.a?(qa(this,"usable"),this.a.resolve(),this.a=null):this.b&&(qa(this,"usable"),this.b.resolve(),this.b=null)},zs.Ed=function(){var t=Error("EME PatchedMediaKeysMs key error");if(t.errorCode=this.c.error,this.a)this.a.reject(t),this.a=null;else if(this.b)this.b.reject(t),this.b=null;else switch(this.c.error.code){case MSMediaKeyError.MS_MEDIA_KEYERR_OUTPUT:case MSMediaKeyError.MS_MEDIA_KEYERR_HARDWARECHANGE:qa(this,"output-not-allowed");default:qa(this,"internal-error")}};var jo;zs=Xa.prototype,zs.forEach=function(t){this.a&&t(this.a,jo)},zs.get=function(t){if(this.has(t))return this.a},zs.has=function(t){var e=jo;return!(!this.a||!lt(new Uint8Array(t),new Uint8Array(e)))},zs.entries=function(){},zs.keys=function(){},zs.values=function(){},$a.prototype.createSession=function(){},$a.prototype.setServerCertificate=function(){},Wa.prototype.getConfiguration=function(){},Wa.prototype.createMediaKeys=function(){};var Bo="";es.prototype.createMediaKeys=function(){var t=new is(this.a);return Promise.resolve(t)},es.prototype.getConfiguration=function(){return this.b},zs=is.prototype,zs.createSession=function(t){var e=t||"temporary";if("temporary"!=e&&"persistent-license"!=e)throw new TypeError("Session type "+t+" is unsupported on this platform.");return t=this.b||document.createElement("video"),t.src||(t.src="about:blank"),e=new as(t,this.g,e),this.c.push(e),e},zs.setServerCertificate=function(){return Promise.resolve(!1)},zs.Sd=function(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="webm",e.initData=t.initData,this.b.dispatchEvent(e)},zs.Rd=function(t){var e=rs(this,t.sessionId);e&&(t=new G("message",{messageType:void 0==e.keyStatuses.a?"licenserequest":"licenserenewal",message:t.message}),e.b&&(e.b.resolve(),e.b=null),e.dispatchEvent(t))},zs.Pd=function(t){(t=rs(this,t.sessionId))&&(os(t,"usable"),t.a&&t.a.resolve(),t.a=null)},zs.Qd=function(t){var e=rs(this,t.sessionId);if(e){var i=Error("EME v0.1b key error");i.errorCode=t.errorCode,i.errorCode.systemCode=t.systemCode,!t.sessionId&&e.b?(i.method="generateRequest",45==t.systemCode&&(i.message="Unsupported session type."),e.b.reject(i),e.b=null):t.sessionId&&e.a?(i.method="update",e.a.reject(i),e.a=null):(i=t.systemCode,t.errorCode.code==MediaKeyError.MEDIA_KEYERR_OUTPUT?os(e,"output-restricted"):1==i?os(e,"expired"):os(e,"internal-error"))}},i(as),zs=as.prototype,zs.Ub=function(t,e){if(this.a)this.a.then(this.Ub.bind(this,t,e)).catch(this.Ub.bind(this,t,e));else{if(this.a=t,"webkit-org.w3.clearkey"==this.c){var i=Z(e),n=JSON.parse(i);"oct"!=n.keys[0].kty&&(this.a.reject(Error("Response is not a valid JSON Web Key Set.")),this.a=null),i=ut(n.keys[0].k),n=ut(n.keys[0].kid)}else i=new Uint8Array(e),n=null;var r=Qa("addKey");try{this.f[r](this.c,i,n,this.sessionId)}catch(t){this.a.reject(t),this.a=null}}},zs.generateRequest=function(t,e){return ss(this,e,null)},zs.load=function(t){return"persistent-license"==this.g?ss(this,null,t):Promise.reject(Error("Not a persistent session."))},zs.update=function(t){var e=new y;return this.Ub(e,t),e},zs.close=function(){if("persistent-license"!=this.g){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var t=Qa("cancelKeyRequest");try{this.f[t](this.c,this.sessionId)}catch(t){}}return this.closed.resolve(),this.closed},zs.remove=function(){return"persistent-license"!=this.g?Promise.reject(Error("Not a persistent session.")):this.close()};var Fo;zs=us.prototype,zs.forEach=function(t){this.a&&t(this.a,Fo)},zs.get=function(t){if(this.has(t))return this.a},zs.has=function(t){var e=Fo;return!(!this.a||!lt(new Uint8Array(t),new Uint8Array(e)))},zs.entries=function(){},zs.keys=function(){},zs.values=function(){},La(function(){!t.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(HTMLMediaElement.prototype.webkitGenerateKeyRequest?Ja("webkit"):HTMLMediaElement.prototype.generateKeyRequest?Ja(""):t.MSMediaKeys?(jo=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Ba,t.MediaKeys=Fa,t.MediaKeySystemAccess=ja,navigator.requestMediaKeySystemAccess=Ua):(navigator.requestMediaKeySystemAccess=Ya,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=za,t.MediaKeys=$a,t.MediaKeySystemAccess=Wa))}),La(function(){if(t.MediaSource)if(t.cast&&cast.__platform__&&cast.__platform__.canDisplayType)ms();else if(navigator.vendor&&0<=navigator.vendor.indexOf("Apple")){var e=navigator.appVersion;ps(),0<=e.indexOf("Version/8")?t.MediaSource=null:0<=e.indexOf("Version/9")?hs():0<=e.indexOf("Version/10")?(hs(),ls()):0<=e.indexOf("Version/11")&&(hs(),cs())}});var Vo=0;vs.prototype.then=function(t,e){var i=new vs;switch(this.za){case 1:ws(this,i,t);break;case 2:ws(this,i,e);break;case Vo:this.c.push({N:i,wb:t}),this.b.push({N:i,wb:e})}return i},vs.prototype.catch=function(t){return this.then(void 0,t)},vs.prototype.ma=function(t){if(this.za==Vo){for(this.f=t,this.za=1,t=0;t<this.c.length;++t)ws(this,this.c[t].N,this.c[t].wb);this.c=[],this.b=[]}},vs.prototype.a=function(t){if(this.za==Vo){for(this.f=t,this.za=2,t=0;t<this.b.length;++t)ws(this,this.b[t].N,this.b[t].wb);this.c=[],this.b=[]}};var Ho=null,Ko=[];La(function(e){t.setImmediate?(As=function(e){return t.setImmediate(e)},ks=function(e){return t.clearImmediate(e)}):(As=function(e){return t.setTimeout(e,0)},ks=function(e){return t.clearTimeout(e)}),t.Promise&&!e||(t.Promise=vs,t.Promise.resolve=gs,t.Promise.reject=bs,t.Promise.all=ys,t.Promise.race=Ts,t.Promise.prototype.then=vs.prototype.then,t.Promise.prototype.catch=vs.prototype.catch)}),La(function(){if(t.HTMLMediaElement){var e=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){var t=e.apply(this,arguments);return t&&t.catch(function(){}),t}}}),La(function(){if(t.HTMLVideoElement){var e=HTMLVideoElement.prototype;!e.getVideoPlaybackQuality&&"webkitDroppedFrameCount"in e&&(e.getVideoPlaybackQuality=Is)}}),La(function(){if(!t.VTTCue&&t.TextTrackCue){var e=TextTrackCue.length;if(3==e)t.VTTCue=Ps;else if(6==e)t.VTTCue=_s;else{try{var i=!!Ps(1,2,"")}catch(t){i=!1}i&&(t.VTTCue=Ps)}}}),e("shaka.text.Cue",xs);var Go="auto";xs.positionAlign={LEFT:"line-left",RIGHT:"line-right",CENTER:"center",AUTO:Go};var qo="center",Xo={LEFT:"left",RIGHT:"right",CENTER:qo,START:"start",END:"end"};xs.textAlign=Xo;var Yo="before",zo={BEFORE:Yo,CENTER:"center",AFTER:"after"};xs.displayAlign=zo;var $o=0,Wo=2,Jo=3;xs.writingDirection={HORIZONTAL_LEFT_TO_RIGHT:$o,HORIZONTAL_RIGHT_TO_LEFT:1,VERTICAL_LEFT_TO_RIGHT:Wo,VERTICAL_RIGHT_TO_LEFT:Jo};var Qo=0,Zo=1;xs.lineInterpretation={LINE_NUMBER:Qo,PERCENTAGE:Zo};var tu="center",eu={CENTER:tu,START:"start",END:"end"};xs.lineAlign=eu;var iu=400;xs.fontWeight={NORMAL:iu,BOLD:700};var nu="normal",ru={NORMAL:nu,ITALIC:"italic",OBLIQUE:"oblique"};xs.fontStyle=ru,xs.textDecoration={UNDERLINE:"underline",LINE_THROUGH:"lineThrough",OVERLINE:"overline"},Rs.prototype.parseInit=function(){},Rs.prototype.parseMedia=function(t,e){var i=Z(t),n=[],r=new DOMParser,a=null;try{a=r.parseFromString(i,"text/xml")}catch(t){throw new h(2,2,2005)}if(a){var s=a.getElementsByTagName("tt")[0];if(!s)throw new h(2,2,2005);r=s.getAttribute("ttp:frameRate"),a=s.getAttribute("ttp:subFrameRate");var o=s.getAttribute("ttp:frameRateMultiplier"),u=s.getAttribute("ttp:tickRate");if("default"!=(i=s.getAttribute("xml:space")||"default")&&"preserve"!=i)throw new h(2,2,2005);for(i="default"==i,r=new Fs(r,a,o,u),a=Ns(s.getElementsByTagName("styling")[0]),o=Ns(s.getElementsByTagName("layout")[0]),s=Ns(s.getElementsByTagName("body")[0]),u=0;u<s.length;u++){var c=s[u],l=e.periodStart,f=r,d=a,p=o,m=i;if(c.hasAttribute("begin")||c.hasAttribute("end")||!/^\s*$/.test(c.textContent)){Ds(c,m);var m=js(c.getAttribute("begin"),f),v=js(c.getAttribute("end"),f),f=js(c.getAttribute("dur"),f),g=c.textContent;if(null==v&&null!=f&&(v=m+f),null==m||null==v)throw new h(2,2,2001);l=new xs(m+l,v+l,g),m=Us(c,"region",p),p=l,"rtl"==Cs(c,m,d,"tts:direction")&&(p.writingDirection=1),v=Cs(c,m,d,"tts:writingMode"),"tb"==v||"tblr"==v?p.writingDirection=Wo:"tbrl"==v?p.writingDirection=Jo:"rltb"==v||"rl"==v?p.writingDirection=1:v&&(p.writingDirection=$o),(v=Cs(c,m,d,"tts:origin"))&&(v=lu.exec(v))&&(p.region.x=Number(v[1]),p.region.y=Number(v[2])),(v=Cs(c,m,d,"tts:extent"))&&(v=lu.exec(v))&&(p.region.width=Number(v[1]),p.region.height=Number(v[2])),(v=Cs(c,m,d,"tts:textAlign"))&&(p.positionAlign=pu[v],p.lineAlign=du[v],p.textAlign=Xo[v.toUpperCase()]),(v=Cs(c,m,d,"tts:displayAlign"))&&(p.displayAlign=zo[v.toUpperCase()]),(v=Cs(c,m,d,"tts:color"))&&(p.color=v),(v=Cs(c,m,d,"tts:backgroundColor"))&&(p.backgroundColor=v),(v=Cs(c,m,d,"tts:fontFamily"))&&(p.fontFamily=v),(v=Cs(c,m,d,"tts:fontWeight"))&&"bold"==v&&(p.fontWeight=700),(v=Cs(c,m,d,"tts:wrapOption"))&&"noWrap"==v&&(p.wrapLine=!1),(v=Cs(c,m,d,"tts:lineHeight"))&&v.match(fu)&&(p.lineHeight=v),(v=Cs(c,m,d,"tts:fontSize"))&&v.match(fu)&&(p.fontSize=v),(v=Cs(c,m,d,"tts:fontStyle"))&&(p.fontStyle=ru[v.toUpperCase()]),(m=Ms(m,d,"tts:textDecoration"))&&Ls(p,m),(c=Os(c,d,"tts:textDecoration"))&&Ls(p,c)}else l=null;l&&n.push(l)}}return n};var au=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,su=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,ou=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,uu=/^(\d*\.?\d*)f$/,hu=/^(\d*\.?\d*)t$/,cu=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,lu=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,fu=/^(\d+px|\d+em)$/,du={left:"start",center:"center",right:"end",start:"start",end:"end"},pu={left:"line-left",center:"center",right:"line-right"};Mt("application/ttml+xml",Rs),Vs.prototype.parseInit=function(t){var e=!1;if((new ai).G("moov",si).G("trak",si).G("mdia",si).G("minf",si).G("stbl",si).ca("stsd",oi).G("stpp",function(){e=!0}).parse(t),!e)throw new h(2,2,2007)},Vs.prototype.parseMedia=function(t,e){var i=!1,n=[];if((new ai).G("mdat",ui(function(t){i=!0,n=n.concat(this.a.parseMedia(t.buffer,e))}.bind(this))).parse(t),!i)throw new h(2,2,2007);return n},Mt('application/mp4; codecs="stpp"',Vs),Mt('application/mp4; codecs="stpp.TTML.im1t"',Vs),Hs.prototype.parseInit=function(){},Hs.prototype.parseMedia=function(t,e){var i=Z(t),i=i.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n"),i=i.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(i[0]))throw new h(2,2,2e3);var n=e.segmentStart;if(0<=i[0].indexOf("X-TIMESTAMP-MAP")){var r=i[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),a=i[0].match(/MPEGTS:(\d+)/m);r&&a&&(n=Gs(new un(r[1])),n=e.periodStart+(Number(a[1])/9e4-n))}for(a=[],r=1;r<i.length;r++){var s=i[r].split("\n"),o=n;if(1==s.length&&!s[0]||/^NOTE($|[ \t])/.test(s[0])||"STYLE"==s[0])var u=null;else{u=null,0>s[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;s<r;s++){var u={duration:null,Vb:null};256&i&&(u.duration=t.F()),512&i&&t.I(4),1024&i&&t.I(4),2048&i&&(u.Vb=e?t.xc():t.F()),a.push(u)}n=a}).G("vtte",function(){r.push(null)}).G("vttc",ui(function(t){r.push(t.buffer)})).G("mdat",function(t){u=!0,si(t)}).parse(t),!u&&!s&&!o)throw new h(2,2,2008);for(var l=i,f=0;f<n.length;f++){var d=n[f],p=r[f],m=d.duration||c;m&&(d=d.Vb?i+d.Vb:l,l=d+m,p&&a.push(Xs(p,e.periodStart+d/this.a,e.periodStart+l/this.a)))}return a.filter(R)},Mt('application/mp4; codecs="wvtt"',qs)}).call(r,this),void 0!==t&&t.exports?t.exports=r.shaka:void 0!==(n=function(){return r.shaka}.call(e,i,e,t))&&(t.exports=n)}()}])});
+!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;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),u=i(1),h=i(2),c=function(t){return t&&t.__esModule?t:{default:t}}(h),l=function(t){function e(t){n(this,e);var i=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i._levels=[],i._pendingAdaptationEvent=!1,i._isShakaReadyState=!1,t.autoPlay&&i.play(),i}return a(e,t),o(e,[{key:"name",get:function(){return"dash_shaka_playback"}},{key:"shakaVersion",get:function(){return c.default.player.Player.version}},{key:"shakaPlayerInstance",get:function(){return this._player}},{key:"levels",get:function(){return this._levels}},{key:"currentLevel",set:function(t){var e=this;this._currentLevelId=t;var i=-1===this._currentLevelId;this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_START),i?(this._player.configure({abr:{enabled:!0}}),this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END)):(this._player.configure({abr:{enabled:!1}}),this._pendingAdaptationEvent=!0,this.selectTrack(this.videoTracks.filter(function(t){return t.id===e._currentLevelId})[0]))},get:function(){return this._currentLevelId||-1}}],[{key:"canPlay",value:function(t){var e=arguments.length>1&&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.length;++n){for(var r=!1,a=0;a<i.length&&!(r=e?e(t[n],i[a]):t[n]===i[a]);++a);r||i.push(t[n])}return i}function O(t,e,i){for(var n=0;n<t.length;++n)if(i(t[n],e))return n;return-1}function U(t,e){var i=t.indexOf(e);-1<i&&t.splice(i,1)}function j(){this.a={}}function B(){this.a=new j}function F(t,e,i,n){t.a&&(e=new K(e,i,n),t.a.push(i,e))}function V(t,e,i,n){F(t,e,i,function(t){this.ha(e,i),n(t)}.bind(t))}function H(t){if(t.a){var e,i=t.a,n=[];for(e in i.a)n.push.apply(n,i.a[e]);for(i=0;i<n.length;++i)n[i].ha();t.a.a={}}}function K(t,e,i){this.target=t,this.type=e,this.a=i,this.target.addEventListener(e,i,!1)}function G(e,i){var n,r=i||{};for(n in r)this[n]=r[n];this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=t.performance&&t.performance.now?t.performance.now():Date.now(),this.type=e,this.isTrusted=!1,this.target=this.currentTarget=null,this.a=!1}function q(t,e){if(!e.length)return t;var i=e.map(function(t){return new c(t)});return t.map(function(t){return new c(t)}).map(function(t){return i.map(t.resolve.bind(t))}).reduce(_,[]).map(function(t){return t.toString()})}function X(t,e){return{keySystem:t,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:e||[],keyIds:[]}}function Y(t){return!t||!Object.keys(t).length}function z(t){return Object.keys(t).map(function(e){return t[e]})}function $(t,e){return Object.keys(t).reduce(function(i,n){return i[n]=e(t[n],n),i},{})}function W(t,e){return Object.keys(t).every(function(i){return e(i,t[i])})}function J(t,e){Object.keys(t).forEach(function(i){e(i,t[i])})}function Q(t,e){var i=t;return e&&(i+='; codecs="'+e+'"'),i}function Z(t){if(!t)return"";t=new Uint8Array(t),239==t[0]&&187==t[1]&&191==t[2]&&(t=t.subarray(3)),t=escape(nt(t));try{return decodeURIComponent(t)}catch(t){throw new h(2,2,2004)}}function tt(t,e,i){if(!t)return"";if(!i&&t.byteLength%2)throw new h(2,2,2004);if(t instanceof ArrayBuffer)var n=t;else i=new Uint8Array(t.byteLength),i.set(new Uint8Array(t)),n=i.buffer;t=Math.floor(t.byteLength/2),i=new Uint16Array(t),n=new DataView(n);for(var r=0;r<t;r++)i[r]=n.getUint16(2*r,e);return nt(i)}function et(t){var e=new Uint8Array(t);if(239==e[0]&&187==e[1]&&191==e[2])return Z(e);if(254==e[0]&&255==e[1])return tt(e.subarray(2),!1);if(255==e[0]&&254==e[1])return tt(e.subarray(2),!0);var i=function(t,e){return t.byteLength<=e||32<=t[e]&&126>=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;i<t.length;++i)e[i]=t.charCodeAt(i);return e.buffer}function nt(t){for(var e="",i=0;i<t.length;i+=16e3)e+=String.fromCharCode.apply(null,t.subarray(i,i+16e3));return e}function rt(t){this.a=null,this.b=function(){this.a=null,t()}.bind(this)}function at(t,e){t.cancel(),t.a=setTimeout(t.b,1e3*e)}function st(t,e){t.cancel();var i=function(){this.b(),this.a=setTimeout(i,1e3*e)}.bind(t);t.a=setTimeout(i,1e3*e)}function ot(e,i){var n=void 0==i||i,r=t.btoa(String.fromCharCode.apply(null,e)).replace(/\+/g,"-").replace(/\//g,"_");return n?r:r.replace(/=*$/,"")}function ut(e){e=t.atob(e.replace(/-/g,"+").replace(/_/g,"/"));for(var i=new Uint8Array(e.length),n=0;n<e.length;++n)i[n]=e.charCodeAt(n);return i}function ht(e){for(var i=new Uint8Array(e.length/2),n=0;n<e.length;n+=2)i[n/2]=t.parseInt(e.substr(n,2),16);return i}function ct(t){for(var e="",i=0;i<t.length;++i){var n=t[i].toString(16);1==n.length&&(n="0"+n),e+=n}return e}function lt(t,e){if(!t&&!e)return!0;if(!t||!e||t.length!=e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!=e[i])return!1;return!0}function dt(t){this.s=t,this.l=this.j=this.w=null,this.L=!1,this.b=null,this.f=new B,this.a=[],this.m=[],this.i=new y,this.h=null,this.g=function(e){this.i.reject(e),t.onError(e)}.bind(this),this.C={},this.D=new rt(this.$d.bind(this)),this.ia=this.c=!1,this.J=[],this.X=!1,this.B=new rt(this.Zd.bind(this)),st(this.B,1),this.i.catch(function(){})}function ft(t,e){if(!t.j)return V(t.f,e,"encrypted",function(){this.g(new h(2,6,6010))}.bind(t)),Promise.resolve();t.l=e,V(t.f,t.l,"play",t.Gd.bind(t));var i=t.l.setMediaKeys(t.j),i=i.catch(function(t){return Promise.reject(new h(2,6,6003,t.message))}),n=null;return t.b.serverCertificate&&t.b.serverCertificate.length&&(n=t.j.setServerCertificate(t.b.serverCertificate).then(function(){}).catch(function(t){return Promise.reject(new h(2,6,6004,t.message))})),Promise.all([i,n]).then(function(){if(this.c)return Promise.reject();mt(this),this.b.initData.length||this.m.length||F(this.f,this.l,"encrypted",this.vd.bind(this))}.bind(t)).catch(function(t){return this.c?Promise.resolve():Promise.reject(t)}.bind(t))}function pt(t,e){return Promise.all(e.map(function(t){return St(this,t).then(function(t){if(t){for(var e=new y,i=0;i<this.a.length;i++)if(this.a[i].fa==t){this.a[i].na=e;break}return Promise.all([t.remove(),e])}}.bind(this))}.bind(t)))}function mt(t){var e=t.b?t.b.initData:[];return e.forEach(function(t){At(this,t.initDataType,t.initData)}.bind(t)),t.m.forEach(function(t){St(this,t)}.bind(t)),e.length||t.m.length||t.i.resolve(),t.i}function vt(t){return t.a.map(function(t){return t.fa.sessionId})}function gt(e,i,n,r,a){var s=Tt(e);i.periods.forEach(function(e){e.variants.forEach(function(e){s&&(e.drmInfos=[s]),e.drmInfos.forEach(function(i){yt(this,i),t.cast&&t.cast.__platform__&&"com.microsoft.playready"==i.keySystem&&(i.keySystem="com.chromecast.playready");var s=r[i.keySystem];s||(s={audioCapabilities:[],videoCapabilities:[],distinctiveIdentifier:"optional",persistentState:n?"required":"optional",sessionTypes:[n?"persistent-license":"temporary"],label:i.keySystem,drmInfos:[]},r[i.keySystem]=s,a.push(i.keySystem)),s.drmInfos.push(i),i.distinctiveIdentifierRequired&&(s.distinctiveIdentifier="required"),i.persistentStateRequired&&(s.persistentState="required");var o=[];e.video&&o.push(e.video),e.audio&&o.push(e.audio),o.forEach(function(t){("video"==t.type?s.videoCapabilities:s.audioCapabilities).push({robustness:("video"==t.type?i.videoRobustness:i.audioRobustness)||"",contentType:Q(t.mimeType,t.codecs)})}.bind(this))}.bind(this))}.bind(this))}.bind(e))}function bt(t,e,i){if(1==i.length&&""==i[0])return Promise.reject(new h(2,6,6e3));var n=new y,r=n;return[!0,!1].forEach(function(t){i.forEach(function(i){var n=e[i];n.drmInfos.some(function(t){return!!t.licenseServerUri})==t&&(n.audioCapabilities.length||delete n.audioCapabilities,n.videoCapabilities.length||delete n.videoCapabilities,r=r.catch(function(){return this.c?Promise.reject():navigator.requestMediaKeySystemAccess(i,[n])}.bind(this)))}.bind(this))}.bind(t)),r=r.catch(function(){return Promise.reject(new h(2,6,6001))}),r=r.then(function(t){if(this.c)return Promise.reject();var i=0<=navigator.userAgent.indexOf("Edge/"),n=t.getConfiguration();return this.w=(n.audioCapabilities||[]).concat(n.videoCapabilities||[]).map(function(t){return t.contentType}),i&&(this.w=null),i=e[t.keySystem],wt(this,t.keySystem,i,i.drmInfos),this.b.licenseServerUri?t.createMediaKeys():Promise.reject(new h(2,6,6012))}.bind(t)).then(function(t){if(this.c)return Promise.reject();this.j=t,this.L=!0}.bind(t)).catch(function(t){return this.c?Promise.resolve():(this.w=this.b=null,t instanceof h?Promise.reject(t):Promise.reject(new h(2,6,6002,t.message)))}.bind(t)),n.reject(),r}function yt(t,e){var i=e.keySystem;if(i){if(!e.licenseServerUri){var n=t.h.servers[i];n&&(e.licenseServerUri=n)}e.keyIds||(e.keyIds=[]),(i=t.h.advanced[i])&&(e.distinctiveIdentifierRequired||(e.distinctiveIdentifierRequired=i.distinctiveIdentifierRequired),e.persistentStateRequired||(e.persistentStateRequired=i.persistentStateRequired),e.videoRobustness||(e.videoRobustness=i.videoRobustness),e.audioRobustness||(e.audioRobustness=i.audioRobustness),e.serverCertificate||(e.serverCertificate=i.serverCertificate))}}function Tt(e){if(Y(e.h.clearKeys))return null;var i,n=[],r=[];for(i in e.h.clearKeys){var a=e.h.clearKeys[i],s=ht(i),a=ht(a),s={kty:"oct",kid:ot(s,!1),k:ot(a,!1)};n.push(s),r.push(s.kid)}return e=JSON.stringify({keys:n}),r=JSON.stringify({kids:r}),r=[{initData:new Uint8Array(it(r)),initDataType:"keyids"}],{keySystem:"org.w3.clearkey",licenseServerUri:"data:application/json;base64,"+t.btoa(e),distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:r,keyIds:[]}}function wt(t,e,i,n){var r=[],a=[],s=[],o=[];Et(n,r,a,s,o),t.b={keySystem:e,licenseServerUri:r[0],distinctiveIdentifierRequired:"required"==i.distinctiveIdentifier,persistentStateRequired:"required"==i.persistentState,audioRobustness:i.audioCapabilities?i.audioCapabilities[0].robustness:"",videoRobustness:i.videoCapabilities?i.videoCapabilities[0].robustness:"",serverCertificate:a[0],initData:s,keyIds:o}}function Et(t,e,i,n,r){function a(t,e){return!(!t.keyId||t.keyId!=e.keyId)||t.initDataType==e.initDataType&&lt(t.initData,e.initData)}t.forEach(function(t){if(-1==e.indexOf(t.licenseServerUri)&&e.push(t.licenseServerUri),t.serverCertificate&&-1==O(i,t.serverCertificate,lt)&&i.push(t.serverCertificate),t.initData&&t.initData.forEach(function(t){-1==O(n,t,a)&&n.push(t)}),t.keyIds)for(var s=0;s<t.keyIds.length;++s)-1==r.indexOf(t.keyIds[s])&&r.push(t.keyIds[s])})}function St(t,e){try{var i=t.j.createSession("persistent-license")}catch(e){var n=new h(2,6,6005,e.message);return t.g(n),Promise.reject(n)}F(t.f,i,"message",t.uc.bind(t)),F(t.f,i,"keystatuseschange",t.oc.bind(t));var r={initData:null,fa:i,loaded:!1,Gb:1/0,na:null};return t.a.push(r),i.load(e).then(function(t){if(!this.c){if(t)return r.loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve(),i;this.a.splice(this.a.indexOf(r),1),this.g(new h(2,6,6013))}}.bind(t),function(t){this.c||(this.a.splice(this.a.indexOf(r),1),this.g(new h(2,6,6005,t.message)))}.bind(t))}function At(t,e,i){try{var n=t.ia?t.j.createSession("persistent-license"):t.j.createSession()}catch(e){return void t.g(new h(2,6,6005,e.message))}F(t.f,n,"message",t.uc.bind(t)),F(t.f,n,"keystatuseschange",t.oc.bind(t)),t.a.push({initData:i,fa:n,loaded:!1,Gb:1/0,na:null}),n.generateRequest(e,i.buffer).catch(function(t){if(!this.c){for(var e=0;e<this.a.length;++e)if(this.a[e].fa==n){this.a.splice(e,1);break}this.g(new h(2,6,6006,t.message))}}.bind(t))}function kt(t,e){for(var i,n=e.target,r=0;r<t.a.length;r++)if(t.a[r].fa==n){i=t.a[r];break}r=L([t.b.licenseServerUri],t.h.retryParameters),r.body=e.message,r.method="POST","com.microsoft.playready"!=t.b.keySystem&&"com.chromecast.playready"!=t.b.keySystem||It(r),t.s.Sa.request(2,r).then(function(t){return this.c?Promise.reject():n.update(t.data).then(function(){this.s.onEvent(new G("drmsessionupdate")),i&&(i.na&&i.na.resolve(),setTimeout(function(){i.loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve()}.bind(this),5e3))}.bind(this))}.bind(t),function(t){if(this.c)return Promise.resolve();t=new h(2,6,6007,t),this.g(t),i&&i.na&&i.na.reject(t)}.bind(t)).catch(function(t){if(this.c)return Promise.resolve();t=new h(2,6,6008,t.message),this.g(t),i&&i.na&&i.na.reject(t)}.bind(t))}function It(t){var e=tt(t.body,!0,!0);if(-1==e.indexOf("PlayReadyKeyMessage"))t.headers["Content-Type"]="text/xml; charset=utf-8";else{for(var e=(new DOMParser).parseFromString(e,"application/xml"),i=e.getElementsByTagName("HttpHeader"),n=0;n<i.length;++n)t.headers[i[n].querySelector("name").textContent]=i[n].querySelector("value").textContent;t.body=ut(e.querySelector("Challenge").textContent).buffer}}function Pt(){var t=[],e=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],i=[{videoCapabilities:e,persistentState:"required",sessionTypes:["persistent-license"]},{videoCapabilities:e}],n={};return"org.w3.clearkey com.widevine.alpha com.microsoft.playready com.apple.fps.2_0 com.apple.fps.1_0 com.apple.fps com.adobe.primetime".split(" ").forEach(function(e){var r=navigator.requestMediaKeySystemAccess(e,i).then(function(t){var i=t.getConfiguration().sessionTypes,i=!!i&&0<=i.indexOf("persistent-license");return 0<=navigator.userAgent.indexOf("Tizen 3")&&(i=!1),n[e]={persistentState:i},t.createMediaKeys()}).catch(function(){n[e]=null});t.push(r)}),Promise.all(t).then(function(){return n})}function _t(t,e){var i=t.keySystem();return!e.drmInfos.length||e.drmInfos.some(function(t){return t.keySystem==i})}function xt(t,e){if(!t.length)return e;if(!e.length)return t;for(var i=[],n=0;n<t.length;n++)for(var r=0;r<e.length;r++)if(t[n].keySystem==e[r].keySystem){var a=t[n],r=e[r],s=[],s=s.concat(a.initData||[]),s=s.concat(r.initData||[]),o=[],o=o.concat(a.keyIds),o=o.concat(r.keyIds);i.push({keySystem:a.keySystem,licenseServerUri:a.licenseServerUri||r.licenseServerUri,distinctiveIdentifierRequired:a.distinctiveIdentifierRequired||r.distinctiveIdentifierRequired,persistentStateRequired:a.persistentStateRequired||r.persistentStateRequired,videoRobustness:a.videoRobustness||r.videoRobustness,audioRobustness:a.audioRobustness||r.audioRobustness,serverCertificate:a.serverCertificate||r.serverCertificate,initData:s,keyIds:o});break}return i}function Rt(t){return!t||1==t.length&&1e-6>t.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<t.length;i++)e.push({start:t.start(i),end:t.end(i)});return e}function Ct(t){this.f=null,this.c=t,this.h=this.i=0,this.g=1/0,this.b=this.a=null}function Mt(t,e){e.length?(o("The use of stateless text parsers is deprecated."),ao[t]=Ut.bind(null,e)):ao[t]=e}function Ot(t,e,i,n){return Promise.resolve().then(function(){if(this.f&&this.c)if(null==i||null==n)this.f.parseInit(e);else{var t=this.f.parseMedia(e,{periodStart:this.i,segmentStart:i,segmentEnd:n}).filter(function(t){return t.startTime>=this.h&&t.startTime<this.g}.bind(this));this.c.append(t),null==this.a&&(this.a=Math.max(i,this.h)),this.b=Math.min(n,this.g)}}.bind(t))}function Ut(t){this.Ta=t}function jt(t,e,i){this.g=t,this.f=e,this.j=i,this.b={},this.a=null,this.c={},this.h=new B,this.i=!1}function Bt(){var t={};return'video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="opus",audio/mp4; codecs="flac",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="av1",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",video/mp2t; codecs="mp4a.40.2",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").forEach(function(e){t[e]=!!ao[e]||MediaSource.isTypeSupported(e);var i=e.split(";")[0];t[i]=t[i]||t[e]}),t}function Ft(t,e){t.a||(t.a=new Ct(t.j)),t.a.f=new ao[e]}function Vt(t,e){if("text"==e)var i=t.a.a;else i=Ht(t,e),i=!i||1==i.length&&1e-6>i.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.width<e.minWidth||n.width>e.maxWidth||n.width>i.width||n.height<e.minHeight||n.height>e.maxHeight||n.height>i.height||n.width*n.height<e.minPixels||n.width*n.height>e.maxPixels)||t.bandwidth<e.minBandwidth||t.bandwidth>e.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;e<i.variants.length;++e){var a=i.variants[e],s=t,o=r,u=n;(s&&s.L&&!_t(s,a)?0:te(a.audio,s,o)&&te(a.video,s,u))||(i.variants.splice(e,1),--e)}for(e=0;e<i.textStreams.length;++e)t=i.textStreams[e],ao[Q(t.mimeType,t.codecs)]||(i.textStreams.splice(e,1),--e)}function te(t,e,i){if(!t)return!0;var n=null;e&&e.L&&(n=e.w),e=Q(t.mimeType,t.codecs);var r,a=t.mimeType;for(r in ro){var s=t[r],o=ro[r];s&&(a+="; "+o+'="'+s+'"')}return!(!ao[Q(t.mimeType,t.codecs)]&&!MediaSource.isTypeSupported(a)||n&&t.encrypted&&0>n.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.variants.length;i++)if(t.variants[i].id==e.id)return t.variants[i];return null}function re(t,e){for(var i=0;i<t.textStreams.length;i++)if(t.textStreams[i].id==e.id)return t.textStreams[i];return null}function ae(t){return t.filter(function(t){return t.allowedByApplication&&t.allowedByKeySystem})}function se(t,e,i,n){var r=ae(t.variants),a=r.filter(function(t){return t.primary});a.length||(a=r);var s=a.length?a[0].language:"",a=a.filter(function(t){return t.language==s});if(e){var o=Wt(e);[oo,so,0].forEach(function(t){var e=!1;r.forEach(function(i){o=Wt(o);var r=Wt(i.language);$t(t,o,r)&&(e?a.push(i):(a=[i],e=!0),n&&(n.audio=!0))})})}return i&&(t=ue(a,i),t.length)?t:(t=a.map(function(t){return(t.audio?t.audio.roles:[]).concat(t.video?t.video.roles:[])}).reduce(_,[]),t.length?ue(a,t[0]):a)}function oe(t,e,i,n){var r=t.textStreams,a=r.filter(function(t){return t.primary});a.length||(a=r);var s=a.length?a[0].language:"",a=a.filter(function(t){return t.language==s});if(e){var o=Wt(e);[oo,so,0].forEach(function(t){var e=!1;r.forEach(function(i){var r=Wt(i.language);$t(t,o,r)&&(e?a.push(i):(a=[i],e=!0),n&&(n.text=!0))})})}return i&&(t=he(a,i),t.length)?t:(t=a.map(function(t){return t.roles}).reduce(_,[]),t.length?he(a,t[0]):a)}function ue(t,e){return t.filter(function(t){return t.audio&&0<=t.audio.roles.indexOf(e)||t.video&&0<=t.video.roles.indexOf(e)})}function he(t,e){return t.filter(function(t){return 0<=t.roles.indexOf(e)})}function ce(t,e,i){for(var n=0;n<i.length;n++)if(i[n].audio==t&&i[n].video==e)return i[n];return null}function le(t,e,i){function n(t,e){return null==t?null==e:e.id==t}for(var r=0;r<i.length;r++)if(n(t,i[r].audio)&&n(e,i[r].video))return i[r];return null}function de(t,e){for(var i=t.periods.length-1;0<i;--i)if(e+no>=t.periods[i].startTime)return i;return 0}function fe(t,e){for(var i=0;i<t.periods.length;++i){var n=t.periods[i];if("text"==e.type){for(var r=0;r<n.textStreams.length;++r)if(n.textStreams[r]==e)return i}else for(r=0;r<n.variants.length;++r){var a=n.variants[r];if(a.audio==e||a.video==e||a.video&&a.video.trickModeVideo==e)return i}}return-1}function pe(){this.h=null,this.c=!1,this.b=new s,this.g=[],this.i=!1,this.a=this.f=null}function me(t,e){return e.filter(function(e){return Jt(e,t,{width:1/0,height:1/0})}).sort(function(t,e){return t.bandwidth-e.bandwidth})}function ve(t){return JSON.stringify(t,function(t,e){if("manager"!=t&&"function"!=typeof e){if(e instanceof Event||e instanceof G){var i,n={};for(i in e){var r=e[i];r&&"object"==typeof r?"detail"==i&&(n[i]=r):i in Event||(n[i]=r)}return n}if(e instanceof TimeRanges)for(n={__type__:"TimeRanges",length:e.length,start:[],end:[]},i=0;i<e.length;++i)n.start.push(e.start(i)),n.end.push(e.end(i));else n="number"==typeof e?isNaN(e)?"NaN":isFinite(e)?e:0>e?"-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<t?t:null}function Ve(t){return t=Number(t),!(t%1)&&0<=t?t:null}function He(t){var e;return t=(e=t.match(/^(\d+)\/(\d+)$/))?Number(e[1]/e[2]):Number(t),isNaN(t)?null:t}function Ke(t,e,i){t=Xe(t);var n=null,r=[],a=[],s=t.map(function(t){return t.keyId}).filter(R);if(s.length&&1<s.filter(N).length)throw new h(2,4,4010);i||(a=t.filter(function(t){return"urn:mpeg:dash:mp4protection:2011"!=t.Dc||(n=t.init||n,!1)}),a.length&&(r=qe(n,e,a),r.length||(r=[X("",n)]))),!t.length||!i&&a.length||(r=z(Ao).map(function(t){return X(t,n)}));var o=s[0]||null;return o&&r.forEach(function(t){t.initData.forEach(function(t){t.keyId=o})}),{ac:o,Se:n,drmInfos:r,dc:!0}}function Ge(t,e,i,n){var r=Ke(t,e,n);if(i.dc)t=1==i.drmInfos.length&&!i.drmInfos[0].keySystem,e=!r.drmInfos.length,(!i.drmInfos.length||t&&!e)&&(i.drmInfos=r.drmInfos),i.dc=!1;else if(0<r.drmInfos.length&&(i.drmInfos=i.drmInfos.filter(function(t){return r.drmInfos.some(function(e){return e.keySystem==t.keySystem})}),!i.drmInfos.length))throw new h(2,4,4008);return r.ac||i.ac}function qe(t,e,i){return i.map(function(i){var n=Ao[i.Dc];return n?[X(n,i.init||t)]:e(i.node)||[]}).reduce(_,[])}function Xe(t){return t.map(function(t){var e=t.getAttribute("schemeIdUri"),i=t.getAttribute("cenc:default_KID"),n=Le(t,"cenc:pssh").map(Ce);if(!e)return null;if(e=e.toLowerCase(),i&&(i=i.replace(/-/g,"").toLowerCase(),0<=i.indexOf(" ")))throw new h(2,4,4009);var r=[];try{r=n.map(function(t){return{initDataType:"cenc",initData:ut(t),keyId:null}})}catch(t){throw new h(2,4,4007)}return{node:t,Dc:e,keyId:i,init:0<r.length?r:null}}).filter(R)}function Ye(e,i,n,r,a){null!=a&&(a=Math.round(a));var s={RepresentationID:i,Number:n,Bandwidth:r,Time:a};return e.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)d)?\$/g,function(e,i,n){if("$$"==e)return"$";var r=s[i];return null==r?e:("RepresentationID"==i&&n&&(n=void 0),e=r.toString(),n=t.parseInt(n,10)||1,Array(Math.max(0,n-e.length)+1).join("0")+e)})}function ze(t,e){var i=$e(t,e,"timescale"),n=1;i&&(n=Fe(i)||1),i=$e(t,e,"duration"),(i=Fe(i||""))&&(i/=n);var r=$e(t,e,"startNumber"),a=Number($e(t,e,"presentationTimeOffset"))||0,s=Ve(r||"");null!=r&&null!=s||(s=1);var o=We(t,e,"SegmentTimeline"),r=null;if(o){for(var r=n,u=t.S.duration||1/0,o=Le(o,"S"),h=[],c=0,l=0;l<o.length;++l){var d=o[l],f=Me(d,"t",Ve),p=Me(d,"d",Ve),d=Me(d,"r",Be);if(null!=f&&(f-=a),!p)break;if(f=null!=f?f:c,0>(d=d||0))if(l+1<o.length){if(null==(d=Me(o[l+1],"t",Ve)))break;if(f>=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<h.length&&f!=c&&(h[h.length-1].end=f/r);for(var m=0;m<=d;++m)c=f+p,h.push({start:f/r,end:c/r,Je:f}),f=c}r=h}return{timescale:n,P:i,ya:s,Z:a/n||0,Xb:a,H:r}}function $e(t,e,i){return[e(t.A),e(t.V),e(t.Y)].filter(R).map(function(t){return t.getAttribute(i)}).reduce(function(t,e){return t||e})}function We(t,e,i){return[e(t.A),e(t.V),e(t.Y)].filter(R).map(function(t){return De(t,i)}).reduce(function(t,e){return t||e})}function Je(t,e){var i=new DOMParser;try{var n=Z(t),r=i.parseFromString(n,"text/xml")}catch(t){}if(r&&r.documentElement.tagName==e)var a=r.documentElement;return a&&0<a.getElementsByTagName("parsererror").length?null:a}function Qe(t,e,i,n,r,a){for(var s=t.getAttribute("xlink:href"),o=t.getAttribute("xlink:actuate")||"onRequest",u=0;u<t.attributes.length;u++){var c=t.attributes[u].nodeName;-1!=c.indexOf("xlink:")&&(t.removeAttribute(c),--u)}if(5<=a)return Promise.reject(new h(2,4,4028));if("onLoad"!=o)return Promise.reject(new h(2,4,4027));var l=q([n],[s]);return r.request(0,L(l,e)).then(function(n){if(!(n=Je(n.data,t.tagName)))return Promise.reject(new h(2,4,4001,s));for(;t.childNodes.length;)t.removeChild(t.childNodes[0]);for(;n.childNodes.length;){var o=n.childNodes[0];n.removeChild(o),t.appendChild(o)}for(o=0;o<n.attributes.length;o++){var u=n.attributes[o].nodeName,c=n.getAttribute(u);t.setAttribute(u,c)}return Ze(t,e,i,l[0],r,a+1)}.bind(t))}function Ze(t,e,i,n,r,a){if(a=a||0,t.getAttribute("xlink:href")){var s=Qe(t,e,i,n,r,a);return i&&(s=s.catch(function(){return Ze(t,e,i,n,r,a)})),s}for(s=0;s<t.childNodes.length;s++){var o=t.childNodes[s];o instanceof Element&&"urn:mpeg:dash:resolve-to-zero:2013"==o.getAttribute("xlink:href")&&(t.removeChild(o),--s)}for(var u=[],s=0;s<t.childNodes.length;s++)o=t.childNodes[s],o.nodeType==Node.ELEMENT_NODE&&(o=Ze(o,e,i,n,r,a),u.push(o));return Promise.all(u).then(function(){return t})}function ti(t,e,i){this.a=t,this.T=e,this.K=i}function ei(t,e,i,n,r,a){this.position=t,this.startTime=e,this.endTime=i,this.a=n,this.T=r,this.K=a}function ii(t,e){this.O=t,this.a=e==ko,this.v=0}function ni(){throw new h(2,3,3e3)}function ri(t,e,i){var n=new Uint8Array(i-e);return n.set(new Uint8Array(t.O.buffer,e,i-e)),n.buffer}function ai(){this.b=[],this.a=[]}function si(t){for(;t.u.da();)t.Ta.qb(t.start,t.u)}function oi(t){for(var e=t.u.F();0<e;--e)t.Ta.qb(t.start,t.u)}function ui(t){return function(e){t(e.u.Ja(e.u.O.byteLength-e.u.v))}}function hi(t){for(var e=0,i=0;i<t.length;i++)e=e<<8|t.charCodeAt(i);return e}function ci(t,e,i,n){var r,a=(new ai).ca("sidx",function(t){r=li(e,n,i,t)});if(t&&a.parse(t),r)return r;throw new h(2,3,3004)}function li(t,e,i,n){var r=[];n.u.I(4);var a=n.u.F();if(!a)throw new h(2,3,3005);if(n.version)var s=n.u.Va(),o=n.u.Va();else s=n.u.F(),o=n.u.F();n.u.I(2);var u=n.u.yc();for(t=t+n.size+o,o=0;o<u;o++){var c=n.u.F(),l=(2147483648&c)>>>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<no&&(t.a[0]=new ei(i.position,0,i.endTime,i.a,i.T,i.K)),i=t.a[t.a.length-1],t.a[t.a.length-1]=new ei(i.position,i.startTime,e,i.a,i.T,i.K))}function pi(t){this.b=t,this.a=new ii(t,0),Io||(Io=[new Uint8Array([255]),new Uint8Array([127,255]),new Uint8Array([63,255,255]),new Uint8Array([31,255,255,255]),new Uint8Array([15,255,255,255,255]),new Uint8Array([7,255,255,255,255,255]),new Uint8Array([3,255,255,255,255,255,255]),new Uint8Array([1,255,255,255,255,255,255,255])])}function mi(t){var e=vi(t);if(7<e.length)throw new h(2,3,3002);for(var i=0,n=0;n<e.length;n++)i=256*i+e[n];e=i,i=vi(t);t:{for(n=0;n<Io.length;n++)if(lt(i,Io[n])){n=!0;break t}n=!1}if(n)i=t.b.byteLength-t.a.v;else{if(8==i.length&&224&i[1])throw new h(2,3,3001);for(var n=i[0]&(1<<8-i.length)-1,r=1;r<i.length;r++)n=256*n+i[r];i=n}return i=t.a.v+i<=t.b.byteLength?i:t.b.byteLength-t.a.v,n=new DataView(t.b.buffer,t.b.byteOffset+t.a.v,i),t.a.I(i),new gi(e,n)}function vi(t){var e,i=t.a.Mb();for(e=1;8>=e&&!(i&1<<8-e);e++);if(8<e)throw new h(2,3,3002);var n=new Uint8Array(e);for(n[0]=i,i=1;i<e;i++)n[i]=t.a.Mb();return n}function gi(t,e){this.id=t,this.a=e}function bi(t){if(8<t.a.byteLength)throw new h(2,3,3002);if(8==t.a.byteLength&&224&t.a.getUint8(0))throw new h(2,3,3001);for(var e=0,i=0;i<t.a.byteLength;i++)var n=t.a.getUint8(i),e=256*e+n;return e}function yi(){}function Ti(t,e,i,n,r,a){function s(){return r}var o=[];t=new pi(t.a);for(var u=null,h=null;t.da();){var c=mi(t);if(187==c.id){var l=wi(c);l&&(c=i*l.Ke,l=e+l.ce,null!=u&&o.push(new ei(o.length,u-a,c-a,s,h,l-1)),u=c,h=l)}}return null!=u&&o.push(new ei(o.length,u-a,n-a,s,h,null)),o}function wi(t){var e=new pi(t.a);if(t=mi(e),179!=t.id)throw new h(2,3,3013);if(t=bi(t),e=mi(e),183!=e.id)throw new h(2,3,3012);for(var e=new pi(e.a),i=0;e.da();){var n=mi(e);if(241==n.id){i=bi(n);break}}return{Ke:t,ce:i}}function Ei(t,e){var i=We(t,e,"Initialization");if(!i)return null;var n=t.A.$,r=i.getAttribute("sourceURL");r&&(n=q(t.A.$,[r]));var r=0,a=null;return(i=Me(i,"range",je))&&(r=i.start,a=i.end),new ti(function(){return n},r,a)}function Si(t,e){var i=Number($e(t,ki,"presentationTimeOffset"))||0,n=$e(t,ki,"timescale"),r=1;n&&(r=Fe(n)||1);var i=i/r||0,n=Ei(t,ki),a=t.A.contentType,r=t.A.mimeType.split("/")[1];if("text"!=a&&"mp4"!=r&&"webm"!=r)throw new h(2,4,4006);if("webm"==r&&!n)throw new h(2,4,4005);var a=We(t,ki,"RepresentationIndex"),s=$e(t,ki,"indexRange"),o=t.A.$,s=je(s||"");if(a){var u=a.getAttribute("sourceURL");u&&(o=q(t.A.$,[u])),s=Me(a,"range",je,s)}if(!s)throw new h(2,4,4002);return r=Ai(t,e,n,o,s.start,s.end,r,i),{createSegmentIndex:r.createSegmentIndex,findSegmentPosition:r.findSegmentPosition,getSegmentReference:r.getSegmentReference,initSegmentReference:n,Z:i}}function Ai(t,e,i,n,r,a,s,o){var u=t.presentationTimeline,h=!t.Ca||!t.S.Ab,c=t.S.duration,l=e,d=null;return{createSegmentIndex:function(){var t=[l(n,r,a),"webm"==s?l(i.a(),i.T,i.K):null];return l=null,Promise.all(t).then(function(t){var e=t[0];t=t[1]||null,e="mp4"==s?ci(e,r,n,o):(new yi).parse(e,t,n,o),u.Ga(0,e),d=new di(e),h&&fi(d,c)})},findSegmentPosition:function(t){return d.find(t)},getSegmentReference:function(t){return d.get(t)}}}function ki(t){return t.Wa}function Ii(t,e){var i=Ei(t,Pi),n=xi(t),r=ze(t,Pi),a=r.ya;a||(a=1);var s=0;if(r.P?s=r.P*(a-1):r.H&&0<r.H.length&&(s=r.H[0].start),n={P:r.P,startTime:s,ya:a,Z:r.Z,H:r.H,Fa:n},!n.P&&!n.H&&1<n.Fa.length)throw new h(2,4,4002);if(!n.P&&!t.S.duration&&!n.H&&1==n.Fa.length)throw new h(2,4,4002);if(n.H&&!n.H.length)throw new h(2,4,4002);return a=r=null,t.Y.id&&t.A.id&&(a=t.Y.id+","+t.A.id,r=e[a]),s=_i(t.S.duration,n.ya,t.A.$,n),r?(r.ob(s),r.xb(t.presentationTimeline.ka()-t.S.start)):(t.presentationTimeline.Ga(0,s),r=new di(s),a&&t.Ca&&(e[a]=r)),t.Ca&&t.S.Ab||fi(r,t.S.duration),{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:r.find.bind(r),getSegmentReference:r.get.bind(r),initSegmentReference:i,Z:n.Z}}function Pi(t){return t.pa}function _i(t,e,i,n){var r=n.Fa.length;n.H&&n.H.length!=n.Fa.length&&(r=Math.min(n.H.length,n.Fa.length));for(var a=[],s=n.startTime,o=0;o<r;o++){var u=n.Fa[o],h=q(i,[u.sd]),c=null!=n.P?s+n.P:n.H?n.H[o].end:s+t;a.push(new ei(o+e,s,c,function(t){return t}.bind(null,h),u.start,u.end)),s=c}return a}function xi(t){return[t.A.pa,t.V.pa,t.Y.pa].filter(R).map(function(t){return Le(t,"SegmentURL")}).reduce(function(t,e){return 0<t.length?t:e}).map(function(e){e.getAttribute("indexRange")&&!t.ic&&(t.ic=!0);var i=e.getAttribute("media");return e=Me(e,"mediaRange",je,{start:0,end:null}),{sd:i,start:e.start,end:e.end}})}function Ri(t,e,i,n){var r=Ci(t),a=ze(t,Ni),s=$e(t,Ni,"media"),o=$e(t,Ni,"index");if(a={P:a.P,timescale:a.timescale,ya:a.ya,Z:a.Z,Xb:a.Xb,H:a.H,Db:s,Ra:o},s=0+(a.Ra?1:0),s+=a.H?1:0,!(s+=a.P?1:0))throw new h(2,4,4002);if(1!=s&&(a.Ra&&(a.H=null),a.P=null),!a.Ra&&!a.Db)throw new h(2,4,4002);if(a.Ra){if("mp4"!=(i=t.A.mimeType.split("/")[1])&&"webm"!=i)throw new h(2,4,4006);if("webm"==i&&!r)throw new h(2,4,4005);n=Ye(a.Ra,t.A.id,null,t.bandwidth||null,null),n=q(t.A.$,[n]),t=Ai(t,e,r,n,0,null,i,a.Z)}else a.P?(n||t.presentationTimeline.Eb(a.P),t=Di(t,a)):(n=e=null,t.Y.id&&t.A.id&&(n=t.Y.id+","+t.A.id,e=i[n]),s=Li(t,a),e?(e.ob(s),e.xb(t.presentationTimeline.ka()-t.S.start)):(t.presentationTimeline.Ga(0,s),e=new di(s),n&&t.Ca&&(i[n]=e)),t.Ca&&t.S.Ab||fi(e,t.S.duration),t={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.find.bind(e),getSegmentReference:e.get.bind(e)});return{createSegmentIndex:t.createSegmentIndex,findSegmentPosition:t.findSegmentPosition,getSegmentReference:t.getSegmentReference,initSegmentReference:r,Z:a.Z}}function Ni(t){return t.Xa}function Di(t,e){var i=t.S.duration,n=e.P,r=e.ya,a=e.timescale,s=e.Db,o=t.bandwidth||null,u=t.A.id,h=t.A.$;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(t){return 0>t||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;n<e.H.length;n++){var r=n+e.ya;i.push(new ei(r,e.H[n].start,e.H[n].end,function(t,e,i,n,r,a){return t=Ye(t,e,r,i,a),q(n,[t]).map(function(t){return t.toString()})}.bind(null,e.Db,t.A.id,t.bandwidth||null,t.A.$,r,e.H[n].Je+e.Xb),0,null))}return i}function Ci(t){var e=$e(t,Ni,"initialization");if(!e)return null;var i=t.A.id,n=t.bandwidth||null,r=t.A.$;return new ti(function(){var t=Ye(e,i,null,n,null);return q(r,[t])},0,null)}function Mi(){var t,e={};for(t in Po)e[t]=!0;for(t in _o)e[t]=!0;return["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"].forEach(function(t){e[t]=!!Po[t]}),["mpd","m3u8","ism"].forEach(function(t){e[t]=!!_o[t]}),e}function Oi(t,e,i,n){var r=n;return r||(n=new c(t).ba.split("/").pop().split("."),1<n.length&&(n=n.pop().toLowerCase(),r=_o[n])),r?Promise.resolve(r):(i=L([t],i),i.method="HEAD",e.request(0,i).then(function(e){return(e=e.headers["content-type"])&&(e=e.toLowerCase()),(r=Po[e])?r:Promise.reject(new h(2,4,4e3,t))},function(t){return t.severity=2,Promise.reject(t)}))}function Ui(t,e){this.c=t,this.j=e,this.f=this.a=1/0,this.b=1,this.i=0,this.h=!0,this.g=0}function ji(){this.a=this.b=null,this.g=[],this.c=null,this.i=[],this.h=1,this.j={},this.l=0,this.f=null}function Bi(t){return t.a.networkingEngine.request(0,L(t.g,t.b.retryParameters),function(){return!this.a}.bind(t)).then(function(t){if(this.a)return Fi(this,t.data,t.uri)}.bind(t))}function Fi(t,e,i){if(!(e=Je(e,"MPD")))throw new h(2,4,4001,i);return Ze(e,t.b.retryParameters,t.b.dash.xlinkFailGracefully,i,t.a.networkingEngine).then(function(t){return Vi(this,t,i)}.bind(t))}function Vi(t,e,i){i=[i];var n=Le(e,"Location").map(Ce).filter(R);0<n.length&&(i=t.g=n),n=Le(e,"BaseURL").map(Ce),i=q(i,n);var r=Me(e,"minBufferTime",Ue);t.l=Me(e,"minimumUpdatePeriod",Ue,-1);var a=Me(e,"availabilityStartTime",Oe),n=Me(e,"timeShiftBufferDepth",Ue),s=Me(e,"suggestedPresentationDelay",Ue),o=Me(e,"maxSegmentDuration",Ue),u=e.getAttribute("type")||"static";if(t.c)var h=t.c.presentationTimeline;else{var c=Math.max(10,1.5*r);h=new Ui(a,null!=s?s:c)}var a=Hi(t,{Ca:"static"!=u,presentationTimeline:h,Y:null,S:null,V:null,A:null,bandwidth:0,ic:!1},i,e),s=a.duration,l=a.periods;return h.rb("static"==u),"static"!=u&&a.bc||h.ga(s||1/0),h.Ic(null!=n?n:1/0),h.Eb(o||1),t.c?Promise.resolve():(e=Le(e,"UTCTiming"),Ji(t,i,e,h.R()).then(function(t){this.a&&(h.Gc(t),this.c={presentationTimeline:h,periods:l,offlineSessionIds:[],minBufferTime:r||0})}.bind(t)))}function Hi(t,e,i,n){var r=Me(n,"mediaPresentationDuration",Ue),a=[],s=0;n=Le(n,"Period");for(var o=0;o<n.length;o++){var u=n[o],s=Me(u,"start",Ue,s),h=Me(u,"duration",Ue),c=null;if(o!=n.length-1){var l=Me(n[o+1],"start",Ue);null!=l&&(c=l-s)}else null!=r&&(c=r-s);if(null==c&&(c=h),u=Ki(t,e,i,{start:s,duration:c,node:u,Ab:null==c||o==n.length-1}),a.push(u),h=e.Y.id,-1==t.i.indexOf(h)&&(t.i.push(h),t.c&&(t.a.filterNewPeriod(u),t.c.periods.push(u))),null==c){s=null;break}s+=c}return t.c||t.a.filterAllPeriods(a),null!=r?{periods:a,duration:r,bc:!1}:{periods:a,duration:s,bc:!0}}function Ki(t,e,i,n){e.Y=Yi(n.node,null,i),e.S=n,e.Y.id||(e.Y.id="__shaka_period_"+n.start),Le(n.node,"EventStream").forEach(t.Vd.bind(t,n.start,n.duration)),i=Le(n.node,"AdaptationSet").map(t.Td.bind(t,e)).filter(R);var r=i.map(function(t){return t.ee}).reduce(_,[]),a=r.filter(N);if(e.Ca&&r.length!=a.length)throw new h(2,4,4018);var s=i.filter(function(t){return!t.Wb});if(i.filter(function(t){return t.Wb}).forEach(function(t){var e=t.streams[0],i=t.Wb;s.forEach(function(t){t.id==i&&t.streams.forEach(function(t){t.trickModeVideo=e})})}),r=Gi(s,"video"),a=Gi(s,"audio"),!r.length&&!a.length)throw new h(2,4,4004);for(a.length||(a=[null]),r.length||(r=[null]),e=[],i=0;i<a.length;i++)for(var o=0;o<r.length;o++)qi(t,a[i],r[o],e);for(t=Gi(s,"text"),r=[],i=0;i<t.length;i++)r.push.apply(r,t[i].streams);return{startTime:n.start,textStreams:r,variants:e}}function Gi(t,e){return t.filter(function(t){return t.contentType==e})}function qi(t,e,i,n){if(e||i)if(e&&i){var r=e.drmInfos,a=i.drmInfos;if(r.length&&a.length?0<xt(r,a).length:1)for(var s=xt(e.drmInfos,i.drmInfos),r=0;r<e.streams.length;r++)for(var o=0;o<i.streams.length;o++)a=(i.streams[o].bandwidth||0)+(e.streams[r].bandwidth||0),a={id:t.h++,language:e.language,primary:e.Cb||i.Cb,audio:e.streams[r],video:i.streams[o],bandwidth:a,drmInfos:s,allowedByApplication:!0,allowedByKeySystem:!0},n.push(a)}else for(s=e||i,r=0;r<s.streams.length;r++)a=s.streams[r].bandwidth||0,a={id:t.h++,language:s.language||"und",primary:s.Cb,audio:e?s.streams[r]:null,video:i?s.streams[r]:null,bandwidth:a,drmInfos:s.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},n.push(a)}function Xi(e,i){0>e.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<t.length;++e){var i=t[e],n=i.getAttribute("schemeIdUri");if(n&&(i=i.getAttribute("value")))switch(n){case"urn:mpeg:dash:outputChannelPositionList:2012":return i.trim().split(/ +/).length;case"urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case"urn:dts:dash:audio_channel_configuration:2012":if(!(n=parseInt(i,10)))continue;return n;case"tag:dolby.com,2014:dash:audio_channel_configuration:2011":case"urn:dolby:dash:audio_channel_configuration:2011":if(n=parseInt(i,16)){for(t=0;n;)1&n&&++t,n>>=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;a<n.length;)if(/^#(?!EXT)/m.test(n[a]))a+=1;else{var s=n[a];if(s=pn(t.a++,s),0<=xo.indexOf(s.name))e=1;else if(0<=Ro.indexOf(s.name)){if(1!=e)throw new h(2,4,4017);return n=n.splice(a,n.length-a),t=fn(t,n,r),new Zi(i,e,r,t)}r.push(s),a+=1,"EXT-X-STREAM-INF"==s.name&&(s.a.push(new en("URI",n[a])),a+=1)}return new Zi(i,e,r)}function fn(t,e,i){var n=[],r=[];return e.forEach(function(t){/^(#EXT)/.test(t)?(t=pn(this.a++,t),0<=xo.indexOf(t.name)?i.push(t):r.push(t)):/^#(?!EXT)/m.test(t)||(n.push(new rn(t.trim(),r)),r=[])}.bind(t)),n}function pn(t,e){var i=e.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!i)throw new h(2,4,4016);var n=i[1],r=i[2],i=[];if(r&&0<=r.indexOf("="))for(var a,r=new un(r),s=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;a=hn(r,s);)i.push(new en(a[1],a[2]||a[3]));else if(r)return new tn(t,n,i,r);return new tn(t,n,i)}function mn(t){return new Promise(function(e){var i=mn.parse(t);e({uri:t,data:i.data,headers:{"content-type":i.contentType}})})}function vn(){this.h=this.b=null,this.D=1,this.g={},this.C={},this.j={},this.s={},this.a=null,this.m="",this.w=new ln,this.i=this.c=null,this.f=!1,this.B=null,this.l=0}function gn(t,e,i){Bn(t,i).then(function(t){if(t=dn(this.w,t.data,t.uri),1!=t.type)throw new h(2,4,4017);for(var i=sn(t.U,"EXT-X-MEDIA-SEQUENCE"),i=Nn(this,t,i?Number(i.value):0),n=e.Bb,r=[],a=n.endTime,s=0;s<i.length;s++){var o=i[s];if(o.position>n.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;u<e.length;u++)for(var h=0;h<i.length;h++){var c=e[u]?e[u].stream:null,l=i[h]?i[h].stream:null,d=e[u]?e[u].drmInfos:null,f=i[h]?i[h].drmInfos:null;if(c&&l){if(!(d.length&&f.length?0<xt(d,f).length:1))continue;var p=xt(d,f)}else c?p=d:l&&(p=f);d=(i[u]?i[u].Pb:"")+" - "+(e[u]?e[u].Pb:""),t.C[d]||(c=En(t,c,l,n,p),o.push(c),t.C[d]=c)}return o}function En(t,e,i,n,r){return{id:t.D++,language:e?e.language:"und",primary:!!e&&e.primary||!!i&&i.primary,audio:e,video:i,bandwidth:n,drmInfos:r,allowedByApplication:!0,allowedByKeySystem:!0}}function Sn(t,e,i){return Un(e,"TYPE"),i=On(t,i),An(t,e,[],i).then(function(t){return t.stream})}function An(t,e,i,n){if(t.g[e.id])return Promise.resolve().then(function(){return this.g[e.id]}.bind(t));var r=Un(e,"TYPE").toLowerCase();"subtitles"==r&&(r="text");var a=Wt(nn(e,"LANGUAGE","und")),s=nn(e,"NAME"),o=e.getAttribute("DEFAULT"),u=e.getAttribute("AUTOSELECT"),h=nn(e,"CHANNELS"),h="audio"==r?kn(h):null,c=Un(e,"URI"),c=q([t.m],[c])[0];return Pn(t,c,i,r,n,a,!!o||!!u,s,h).then(function(t){return this.g[e.id]=t,this.s[c]=t}.bind(t))}function kn(t){return t?(t=t.split("/")[0],parseInt(t,10)):null}function In(t,e,i,n,r){var a=Un(e,"URI"),a=q([t.m],[a])[0];return Pn(t,a,i,n,r,"und",!1,null,null).then(function(t){return this.s[a]=t}.bind(t))}function Pn(t,e,i,n,r,a,s,o,u){var c=e;return e=q([t.m],[e])[0],Bn(t,e).then(function(t){if(t=dn(this.w,t.data,t.uri),1!=t.type)throw new h(2,4,4017);var e=sn(t.U,"EXT-X-MEDIA-SEQUENCE"),l=Nn(this,t,e?Number(e.value):0),d=new di(l);_n(this,t),this.a||xn(this,l[l.length-1].endTime),r=On(this,t)||r;var f=null;if("text"!=n&&(f=Rn(t)),this.a.Ga(0,l),!this.f){var e=l[l.length-1].endTime-l[0].startTime,p=this.a.W();(1/0==p||p<e)&&this.a.ga(e)}var m=Cn(n,i),v=void 0;"text"==n&&(v="subtitle");var g=[];t.segments.forEach(function(t){t=an(t.U,"EXT-X-KEY"),g.push.apply(g,t)});var b=!1,y=[],T=null;if(g.forEach(function(t){if("NONE"!=Un(t,"METHOD")){b=!0;var e=Un(t,"KEYFORMAT");(t=(e=Lo[e])?e(t):null)&&(t.keyIds.length&&(T=t.keyIds[0]),y.push(t))}}),b&&!y.length)throw new h(2,4,4026);return Mn(this,n,m,l[0].a()[0]).then(function(t){return t={id:this.D++,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:d.find.bind(d),getSegmentReference:d.get.bind(d),initSegmentReference:f,presentationTimeOffset:r||0,mimeType:t,codecs:m,kind:v,encrypted:b,keyId:T,language:a,label:o||null,type:n,primary:s,trickModeVideo:null,containsEmsgBoxes:!1,frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:u},this.j[t.id]=d,{stream:t,je:d,drmInfos:y,Pb:c,Bb:l[l.length-1]}}.bind(this))}.bind(t))}function _n(t,e){var i=sn(e.U,"EXT-X-PLAYLIST-TYPE");if(sn(e.U,"EXT-X-ENDLIST")||i&&"VOD"==i.value)Vn(t,!1);else{if(!i)throw new h(2,4,4029);i=jn(e.U,"EXT-X-TARGETDURATION"),i=Number(i.value),t.c?t.c>i&&(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<e.length)throw new h(2,4,4020);var e=e[0],i=Un(e,"URI"),n=q([t.uri],[i])[0];return t=0,i=null,(e=nn(e,"BYTERANGE"))&&(t=e.split("@"),e=Number(t[0]),t=Number(t[1]),i=t+e-1),new ti(function(){return[n]},t,i)}function Nn(t,e,i){var n=e.segments,r=[];return n.forEach(function(t){var a,s=t.U,o=q([e.uri],[t.uri])[0],u=jn(s,"EXTINF").value.split(","),u=Number(u[0]);a=(t=n.indexOf(t))?r[t-1].endTime:0;var u=a+u,h=0,c=null;(s=sn(s,"EXT-X-BYTERANGE"))&&(s=s.value.split("@"),c=Number(s[0]),h=s[1]?Number(s[1]):r[t-1].K+1,c=h+c-1,t==n.length-1&&(c=null)),r.push(new ei(i+t,a,u,function(){return[o]},h,c))}.bind(t)),r}function Dn(t,e){e.forEach(function(t){var e=this.a.W(),i=t.video;t=t.audio,i&&this.j[i.id]&&fi(this.j[i.id],e),t&&this.j[t.id]&&fi(this.j[t.id],e)}.bind(t))}function Ln(t,e){for(var i=No[t],n=0;n<i.length;n++)for(var r=0;r<e.length;r++)if(i[n].test(e[r].trim()))return e[r].trim();return"text"==t?"":null}function Cn(t,e){if(1==e.length)return e[0];var i=Ln(t,e);if(null!=i)return i;throw new h(2,4,4025,e)}function Mn(t,e,i,n){var r=n.split("."),a=r[r.length-1];return(r=Do[e][a])?Promise.resolve(r):"text"==e?i&&"vtt"!=i?Promise.resolve("application/mp4"):Promise.resolve("text/vtt"):(e=L([n],t.h.retryParameters),e.method="HEAD",t.b.networkingEngine.request(1,e).then(function(t){if(!(t=t.headers["content-type"]))throw new h(2,4,4021,a);return t.split(";")[0]}))}function On(t,e){var i=sn(e.U,"EXT-X-START");return i?Number(Un(i,"TIME-OFFSET")):t.h.hls.defaultTimeOffset}function Un(t,e){var i=t.getAttribute(e);if(!i)throw new h(2,4,4023,e);return i.value}function jn(t,e){var i=sn(t,e);if(!i)throw new h(2,4,4024,e);return i}function Bn(t,e){return t.b.networkingEngine.request(0,L([e],t.h.retryParameters),function(){return!this.b}.bind(t))}function Fn(e,i){null!=e.c&&null!=i&&(e.i=t.setTimeout(e.J.bind(e),1e3*i))}function Vn(e,i){e.f=i,e.a&&e.a.rb(!i),i||null==e.i||(t.clearTimeout(e.i),e.i=null,e.c=null)}function Hn(t,e,i,n,r,a){this.a=t,this.c=e,this.l=i,this.m=null==n?null:Gn(this,n),this.L=r,this.J=a,this.b=new B,this.j=!1,this.i=1,this.h=this.f=null,this.g=new rt(this.ud.bind(this)),this.D=t.readyState,this.s=!1,this.C=this.X=-1,this.w=this.B=!1,0<t.readyState?this.pc():(V(this.b,t,"loadedmetadata",this.pc.bind(this)),F(this.b,t,"timeupdate",function(){at(this.g,.1)}.bind(this))),e=this.rc.bind(this),F(this.b,t,"ratechange",this.Hd.bind(this)),F(this.b,t,"waiting",e),this.h=new rt(e),st(this.h,.25)}function Kn(t,e){0<t.a.readyState?t.a.currentTime=Wn(t,e):t.m=e}function Gn(t,e){var i=t.c.presentationTimeline.W();return e>=i?i-t.l.durationBackoff:e}function qn(t){return 0<t.a.readyState?t.a.paused?t.a.currentTime:Wn(t,t.a.currentTime):Xn(t)}function Xn(t){if(null!=t.m)return Wn(t,t.m);var e=t.c.presentationTimeline;return e=1/0>e.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<r.Da(0)?i(o)?o:n: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 e<i?i:(i=t.c.presentationTimeline.ua(),e>i?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&&e<t.b):(t=Ht(i,t),t=Nt(t,e)),t}.bind(t))||hr(t)}function hr(t){for(var e in t.c){var i=t.c[e];i.sa||i.ra||(i.xa?i.ra=!0:null==Vt(t.a.M,e)?null==i.qa&&Ir(t,i,0):(Pr(i),kr(t,i,!1)))}}function cr(t,e,i){var n=qn(t.a.Ua),r=de(t.b,n),a={},n=[];return e.variant&&e.variant.audio&&(a.audio=e.variant.audio,n.push(e.variant.audio)),e.variant&&e.variant.video&&(a.video=e.variant.video,n.push(e.variant.video)),e.text&&(a.text=e.text,n.push(e.text)),t.a.M.init(a),fr(t),dr(t,n).then(function(){if(!this.f)for(var t in a){var e=a[t];this.c[t]||(this.c[t]={stream:e,type:t,Ea:null,la:null,oa:null,pb:!0,wa:r,endOfStream:!1,xa:!1,qa:null,ra:!1,tb:!1,sa:!1,Ob:!1,Qa:!1,Bc:i||0},Ir(this,this.c[t],0))}}.bind(t))}function lr(t,e){var i=t.g[e];if(i)return i.N;i={N:new y,Ka:!1},t.g[e]=i;var n=t.b.periods[e].variants.map(function(t){var e=[];return t.audio&&e.push(t.audio),t.video&&e.push(t.video),t.video&&t.video.trickModeVideo&&e.push(t.video.trickModeVideo),e}).reduce(_,[]).filter(N);return n.push.apply(n,t.b.periods[e].textStreams),t.m=t.m.then(function(){if(!this.f)return dr(this,n)}.bind(t)).then(function(){this.f||(this.g[e].N.resolve(),this.g[e].Ka=!0)}.bind(t)).catch(function(t){this.f||(this.g[e].N.reject(),delete this.g[e],this.a.onError(t))}.bind(t)),i.N}function dr(t,e){e.map(function(t){return t.id}).filter(N);for(var i=[],n=0;n<e.length;++n){var r=e[n],a=t.j[r.id];a?i.push(a.N):(t.j[r.id]={N:new y,Ka:!1},i.push(r.createSegmentIndex()))}return Promise.all(i).then(function(){if(!this.f)for(var t=0;t<e.length;++t){var i=this.j[e[t].id];i.Ka||(i.N.resolve(),i.Ka=!0)}}.bind(t)).catch(function(t){if(!this.f)return this.j[r.id].N.reject(),delete this.j[r.id],Promise.reject(t)}.bind(t))}function fr(t){var e=t.b.presentationTimeline.W();1/0>e?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<i?0:s.b-Math.max(i,s.a)):(s=Ht(s,o),s=Dt(s,i)),o=Math.max(t.i*Math.max(t.b.minBufferTime||0,t.h.rebufferingGoal),t.i*t.h.bufferingGoal),n>=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.endTime<t.ka()||i.startTime+e.startTime>n?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<n)t.i-=.2;else{if(!(4<n))return e.Qa=!0,t.l=!0,void t.a.onError(i);t.i-=.04}e.Ob=!0}Ir(t,e,4)}function br(t,e,i,n,r){return e.pb?(i=qt(t.a.M,e.type,t.b.periods[i].startTime-e.stream.presentationTimeOffset,n,r),e.stream.initSegmentReference?(t=Ar(t,e.stream.initSegmentReference).then(function(t){if(!this.f)return Kt(this.a.M,e.type,t,null,null)}.bind(t)).catch(function(t){return e.pb=!0,Promise.reject(t)}),Promise.all([i,t])):i):Promise.resolve()}function yr(t,e,i,n,r,a,s){return r.containsEmsgBoxes&&(new ai).ca("emsg",t.Ud.bind(t,n,a)).parse(s),Tr(t,e,i).then(function(){if(!this.f)return Kt(this.a.M,e.type,s,a.startTime+n.startTime,a.endTime+n.startTime)}.bind(t)).then(function(){if(!this.f)return e.Ea=r,e.la=a,Promise.resolve()}.bind(t))}function Tr(t,e,i){var n=Vt(t.a.M,e.type);return null==n?Promise.resolve():(i=i-n-t.h.bufferBehind,0>=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<t.b.periods.length;++i)lr(t,i).catch(x);t.a.Md&&t.a.Md()}}function Er(t,e){if(e.wa!=fe(t.b,e.stream)){var i=e.wa,n=z(t.c);n.every(function(t){return t.wa==i})&&n.every(Sr)&&lr(t,i).then(function(){if(!this.f&&n.every(function(t){var e=fe(this.b,t.stream);return Sr(t)&&t.wa==i&&e!=i}.bind(this))){var t=this.b.periods[i],e=this.a.kc(t),r={};e.variant&&e.variant.video&&(r.video=e.variant.video),e.variant&&e.variant.audio&&(r.audio=e.variant.audio),e.text&&(r.text=e.text);for(var a in this.c)if(!r[a]&&"text"!=a)return void this.a.onError(new h(2,5,5005));for(a in r)if(!this.c[a]){if("text"!=a)return void this.a.onError(new h(2,5,5005));cr(this,{text:r.text},t.startTime),delete r[a]}for(a in this.c)(t=r[a])?(or(this,t,!1),Ir(this,this.c[a],0)):delete this.c[a];this.a.jc()}}.bind(t)).catch(x)}}function Sr(t){return!t.xa&&null==t.qa&&!t.ra&&!t.sa}function Ar(t,e){var i=L(e.a(),t.h.retryParameters);if(e.T||null!=e.K){var n="bytes="+e.T+"-";null!=e.K&&(n+=e.K),i.headers.Range=n}return t.a.Sa.request(1,i).then(function(t){return t.data})}function kr(t,e,i){e.ra=!1,e.tb=!1,e.sa=!0,Gt(t.a.M,e.type).then(function(){if(!this.f&&i){var t=this.a.M,n=e.type;return"text"==n?Promise.resolve():Xt(t,n,t.Yc.bind(t,n))}}.bind(t)).then(function(){this.f||(e.Ea=null,e.la=null,e.sa=!1,e.endOfStream=!1,Ir(this,e,0))}.bind(t))}function Ir(e,i,n){i.qa=t.setTimeout(e.Ce.bind(e,i),1e3*n)}function Pr(e){null!=e.qa&&(t.clearTimeout(e.qa),e.qa=null)}function _r(t,e){w(t.w).then(function(){this.a.onError(e),e.handled||this.h.failureCallback(e)}.bind(t))}function xr(t,e){return new Promise(function(i,n){var r=new XMLHttpRequest;r.open(e.method,t,!0),r.responseType="arraybuffer",r.timeout=e.retryParameters.timeout,r.withCredentials=e.allowCrossSiteCredentials,r.onload=function(e){e=e.target;var r=e.getAllResponseHeaders().split("\r\n").reduce(function(t,e){var i=e.split(": ");return t[i[0].toLowerCase()]=i.slice(1).join(": "),t},{});if(200<=e.status&&299>=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<e.length;n++)t.delete(e[n]).onsuccess=i||function(){}})}function Lr(t,e){var i=0;return Cr(t,e,"readonly",function(t){t.openCursor(null,"prev").onsuccess=function(t){(t=t.target.result)&&(i=t.key+1)}}).then(function(){return i})}function Cr(t,e,i,n){var r={transaction:t.a.transaction([e],i),N:new y};return r.transaction.oncomplete=function(){this.b.splice(this.b.indexOf(r),1),r.N.resolve()}.bind(t),r.transaction.onabort=function(t){this.b.splice(this.b.indexOf(r),1),Or(r.transaction,r.N,t)}.bind(t),r.transaction.onerror=function(t){t.preventDefault()}.bind(t),e=r.transaction.objectStore(e),n(e),t.b.push(r),r.N}function Mr(e,i,n){var r=t.indexedDB.open("shaka_offline_db",1),a=!1,s=new y;return r.onupgradeneeded=function(t){a=!0,t=t.target.result;for(var e in i)t.createObjectStore(e,{keyPath:i[e]})},r.onsuccess=function(t){n&&!a?(t.target.result.close(),setTimeout(function(){Mr(this,i,n-1).then(s.resolve,s.reject)}.bind(this),1e3)):(this.a=t.target.result,s.resolve())}.bind(e),r.onerror=Or.bind(null,r,s),s}function Or(t,e,i){t.error?e.reject(new h(2,9,9001,t.error)):e.reject(new h(2,9,9002)),i.preventDefault()}function Ur(t){var e=jr(t.periods[0],[],new Ui(null,0)),i=ee(e,null,null),e=ie(e,null);return i.push.apply(i,e),{offlineUri:"offline:"+t.key,originalManifestUri:t.originalManifestUri,duration:t.duration,size:t.size,expiration:void 0==t.expiration?1/0:t.expiration,tracks:i,appMetadata:t.appMetadata}}function jr(t,e,i){var n=t.streams.filter(function(t){return"text"==t.contentType});return e=Fr(t.streams.filter(function(t){return"audio"==t.contentType}),t.streams.filter(function(t){return"video"==t.contentType}),e),n=n.map(Hr),t.streams.forEach(function(t){t=Br(t),i.Ga(0,t)}),{startTime:t.startTime,variants:e,textStreams:n}}function Br(t){return t.segments.map(function(t,e){return new ei(e,t.startTime,t.endTime,function(){return[t.uri]},0,null)})}function Fr(t,e,i){var n=[];if(!t.length&&!e.length)return n;t.length?e.length||(e=[null]):t=[null];for(var r=0,a=0;a<t.length;a++)for(var s=0;s<e.length;s++)if(Vr(t[a],e[s])){var o=t[a],u=e[s],h=i;o={id:r++,language:o?o.language:"",primary:!!o&&o.primary||!!u&&u.primary,audio:Hr(o),video:Hr(u),bandwidth:0,drmInfos:h,allowedByApplication:!0,allowedByKeySystem:!0},n.push(o)}return n}function Vr(t,e){if(!(t&&e&&t.variantIds&&e.variantIds))return!0;for(var i=0;i<t.variantIds.length;i++)if(e.variantIds.some(function(e){return e==t.variantIds[i]}))return!0;return!1}function Hr(t){if(!t)return null;var e=Br(t),e=new di(e);return{id:t.id,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.find.bind(e),getSegmentReference:e.get.bind(e),initSegmentReference:t.initSegmentUri?new ti(function(){return[t.initSegmentUri]},0,null):null,presentationTimeOffset:t.presentationTimeOffset,mimeType:t.mimeType,codecs:t.codecs,width:t.width||void 0,height:t.height||void 0,frameRate:t.frameRate||void 0,kind:t.kind,encrypted:t.encrypted,keyId:t.keyId,language:t.language,label:t.label||null,type:t.contentType,primary:t.primary,trickModeVideo:null,containsEmsgBoxes:!1,roles:[],channelsCount:null}}function Kr(){return t.indexedDB?new Rr:null}function Gr(t,e,i,n){this.b={},this.l=[],this.m=n,this.j=t,this.s=e,this.w=i,this.i=this.a=null,this.f=this.g=this.h=this.c=0}function qr(t,e,i,n,r){t.b[e]=t.b[e]||[],t.b[e].push({uris:i.a(),T:i.T,K:i.K,$b:n,Qb:r})}function Xr(t,e){t.c=0,t.h=0,t.g=0,t.f=0,z(t.b).forEach(function(t){t.forEach(function(t){null!=t.K?this.c+=t.K-t.T+1:this.g+=t.$b}.bind(this))}.bind(t)),t.a=e,t.a.size=t.c;var i=z(t.b).map(function(t){var e=0,i=function(){return this.m?e>=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<t.textTracks.length;++e){var i=t.textTracks[e];i.mode="disabled","Shaka Player TextTrack"==i.label&&(this.a=i)}this.a||(this.a=t.addTextTrack("subtitles","Shaka Player TextTrack")),this.a.mode="hidden",this.b=this.a.cues}function Qr(e){if(e.startTime>=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<i.length;++r)e(i[r])&&n.push(i[r]);for(r=0;r<n.length;++r)t.a.removeCue(n[r])}function ta(){this.a=Promise.resolve(),this.b=this.c=this.f=!1,this.i=new Promise(function(t){this.g=t}.bind(this))}function ea(t){return t.f||(t.a=t.a.then(function(t){return this.c=!0,Promise.resolve(t)}.bind(t),function(t){return this.c=!0,this.b?(this.g(),Promise.reject(this.h)):Promise.reject(t)}.bind(t))),t.f=!0,t.a}function ia(t,e){Se.call(this),this.D=!1,this.f=t,this.jb=!1,this.w=null,this.m=new B,this.g=this.ib=this.b=this.i=this.a=this.B=this.h=this.gb=this.J=this.L=this.l=this.s=null,this.Oc=1e9,this.eb=[],this.Oa=!1,this.Ba=!0,this.Na=this.Pa=this.ia=null,this.Yb=!1,this.X=null,this.hb=[],this.C={},this.c=pa(this),this.fb={width:1/0,height:1/0},this.j=ma(),this.cb=0,this.Ma=this.c.preferredAudioLanguage,this.$a=this.c.preferredTextLanguage,this.ub=this.ab="",this.Zb=!0,e&&e(this),this.s=new D(this.ue.bind(this)),this.gb=aa(this),F(this.m,this.f,"error",this.Od.bind(this))}function na(t){if(!t.ia)return Promise.resolve();var e=Promise.resolve();return t.i&&(e=t.i.stop(),t.i=null),t=t.ia.cancel(new h(2,7,7e3)),Promise.all([e,t])}function ra(t){function e(t){return(t.video?t.video.codecs.split(".")[0]:"")+"-"+(t.audio?t.audio.codecs.split(".")[0]:"")}var i={};t.b.periods.forEach(function(t){t.variants.forEach(function(t){var n=e(t);n in i||(i[n]=[]),i[n].push(t)})});var n=null,r=1/0;J(i,function(t,e){var i=0,a=0;e.forEach(function(t){i+=t.bandwidth||0,++a});var s=i/a;s<r&&(n=t,r=s)}),t.b.periods.forEach(function(t){t.variants=t.variants.filter(function(t){return e(t)==n})})}function aa(e){e.L=new MediaSource;var i=new y;return F(e.m,e.L,"sourceopen",i.resolve),e.f.src=t.URL.createObjectURL(e.L),i}function sa(t){if(t.i&&t.i.configure(t.c.manifest),t.l&&t.l.configure(t.c.drm),t.a){t.a.configure(t.c.streaming);try{t.b.periods.forEach(t.kb.bind(t))}catch(e){t.La(e)}var e=rr(t.a),i=e.audio,n=e.video,e=ir(t.a);(i=ce(i,n,e.variants))&&i.allowedByApplication&&i.allowedByKeySystem||Ta(t,e)}t.g&&(oa(t),t.c.abr.enabled&&!t.Ba?t.g.enable():t.g.disable())}function oa(t){t.g.configure?t.g.configure(t.c.abr):(o("AbrManager API has changed. AbrManager.setDefaultEstimate() and AbrManager.setRestrictions() are deprecated. AbrManager.configure() is used instead. Please upgrade to the new API. The old API will be removed in v2.3."),t.g.setDefaultEstimate(t.c.abr.defaultBandwidthEstimate),t.g.setRestrictions(t.c.abr.restrictions))}function ua(t,e,i){e.video&&ca(t,e.video),e.audio&&ca(t,e.audio);var n=nr(t.a),r=rr(t.a);e!=ce(r.audio,r.video,n?n.variants:[])&&t.j.switchHistory.push({timestamp:Date.now()/1e3,id:e.id,type:"variant",fromAdaptation:i,bandwidth:e.bandwidth})}function ha(t,e,i){ca(t,e),t.j.switchHistory.push({timestamp:Date.now()/1e3,id:e.id,type:"text",fromAdaptation:i,bandwidth:null})}function ca(t,e){var i=fe(t.b,e);t.C[i]||(t.C[i]={}),t.C[i][e.type]=e.id}function la(t){t.m&&(t.m.ha(t.L,"sourceopen"),t.m.ha(t.f,"loadeddata"),t.m.ha(t.f,"playing"),t.m.ha(t.f,"pause"),t.m.ha(t.f,"ended")),t.f&&(t.f.removeAttribute("src"),t.f.load());var e=Promise.all([t.g?t.g.stop():null,t.l?t.l.o():null,t.J?t.J.o():null,t.h?t.h.o():null,t.B?t.B.o():null,t.a?t.a.o():null,t.i?t.i.stop():null,t.w?t.w.o():null]);return t.l=null,t.J=null,t.h=null,t.B=null,t.a=null,t.i=null,t.w=null,t.b=null,t.ib=null,t.gb=null,t.L=null,t.hb=[],t.C={},t.j=ma(),e}function da(t){return t.i?la(t).then(function(){this.D||(this.Jc(!1),this.gb=aa(this))}.bind(t)):Promise.resolve()}function fa(){return{".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",serverCertificate:new Uint8Array(0)}}}function pa(t){return{drm:{retryParameters:E(),servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1},manifest:{retryParameters:E(),dash:{customScheme:function(t){if(t)return null},clockSyncUri:"",ignoreDrmInfo:!1,xlinkFailGracefully:!1},hls:{defaultTimeOffset:0}},streaming:{retryParameters:E(),failureCallback:t.Vc.bind(t),rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,ignoreTextStreamFailures:!1,startAtSegmentBoundary:!1,smallGapLimit:.5,jumpLargeGaps:!1,durationBackoff:1},abrFactory:pe,textDisplayFactory:function(t){return new Jr(t)}.bind(null,t.f),abr:{enabled:!0,defaultBandwidthEstimate:5e5,switchInterval:8,bandwidthUpgradeTarget:.85,bandwidthDowngradeTarget:.95,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minBandwidth:0,maxBandwidth:1/0}},preferredAudioLanguage:"",preferredTextLanguage:"",restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minBandwidth:0,maxBandwidth:1/0},playRangeStart:0,playRangeEnd:1/0}}function ma(){return{width:NaN,height:NaN,streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,estimatedBandwidth:NaN,loadLatency:NaN,playTime:0,bufferingTime:0,switchHistory:[],stateHistory:[]}}function va(t,e,i){t.Ba?(t.Na=e,t.Yb=i||!1):sr(t.a,e,i||!1)}function ga(t){if(t.b){var e=Date.now()/1e3;t.Oa?t.j.bufferingTime+=e-t.cb:t.j.playTime+=e-t.cb,t.cb=e}}function ba(t,e){function i(t,e){if(!t)return null;var i=t.findSegmentPosition(e-r.startTime);return null==i?null:(i=t.getSegmentReference(i))?i.startTime+r.startTime:null}var n=rr(t.a),r=ir(t.a),a=i(n.video,e),n=i(n.audio,e);return null!=a&&null!=n?Math.max(a,n):null!=a?a:null!=n?n:e}function ya(t,e){if(!e||!e.length)return t.La(new h(2,4,4012)),null;if(t.g.setVariants(e),t.g.chooseStreams){o("AbrManager API has changed. AbrManager.chooseStreams() is deprecated. Please implement AbrManager.chooseVariant() to upgrade. The old API will be removed in v2.3.");var i=t.g.chooseStreams(["video","audio"]);return ce(i.audio,i.video,e)}return t.g.chooseVariant()}function Ta(t,e){var i=se(e,t.Ma,t.ab),n=oe(e,t.$a,t.ub);(i=ya(t,i))&&(ua(t,i,!0),va(t,i,!0)),(n=n[0])&&(ha(t,n,!0),t.Ba?t.X=n:or(t.a,n,!0)),wa(t)}function wa(t){Promise.resolve().then(function(){this.D||this.dispatchEvent(new G("adaptation"))}.bind(t))}function Ea(t){Promise.resolve().then(function(){this.D||this.dispatchEvent(new G("trackschanged"))}.bind(t))}function Sa(t){t.dispatchEvent(new G("texttrackvisibility"))}function Aa(t){if(!t||t.constructor!=ia)throw new h(2,9,9008);this.a=Kr(),this.g=t,this.b=Pa(this),this.c=null,this.s=!1,this.j=null,this.h=-1,this.l=0,this.f=null,this.i=new Gr(this.a,t.s,t.getConfiguration().streaming.retryParameters,this.b)}function ka(){return!!t.indexedDB}function Ia(t,e,i,n){function r(){}var a,s,o,u=t.g.s,h=t.g.getConfiguration();return Oi(e,u,h.manifest.retryParameters,n).then(function(t){return Da(this),o=new t,o.configure(h.manifest),o.start(e,{networkingEngine:u,filterAllPeriods:this.m.bind(this),filterNewPeriod:this.w.bind(this),onTimelineRegionAdded:function(){},onEvent:function(){},onError:i})}.bind(t)).then(function(t){return Da(this),a=t,s=new dt({Sa:u,onError:i,Hb:r,onExpirationUpdated:function(){},onEvent:function(){}}),s.configure(h.drm),s.init(a,this.b.usePersistentLicense||!1)}.bind(t)).then(function(){return Da(this),Ra(a)}.bind(t)).then(function(){return Da(this),mt(s)}.bind(t)).then(function(){return Da(this),o.stop()}.bind(t)).then(function(){return Da(this),{manifest:a,Wc:s}}.bind(t)).catch(function(t){if(o)return o.stop().then(function(){throw t});throw t})}function Pa(t){return{trackSelectionCallback:t.B.bind(t),progressCallback:function(t,e){if(t||e)return null},usePersistentLicense:!0}}function _a(t){return t.a?t.a.a?Promise.resolve():t.a.init(Co):Promise.reject(new h(2,9,9e3))}function xa(t){var e=t.c?t.c.o():Promise.resolve();return t.c=null,t.f=null,t.s=!1,t.j=null,t.h=-1,e}function Ra(t){var e=t.periods.map(function(t){return t.variants}).reduce(_,[]).map(function(t){var e=[];return t.audio&&e.push(t.audio),t.video&&e.push(t.video),e}).reduce(_,[]).filter(N);return t=t.periods.map(function(t){return t.textStreams}).reduce(_,[]),e.push.apply(e,t),Promise.all(e.map(function(t){return t.createSegmentIndex()}))}function Na(t,e,i,n,r){for(var a=[],s=t.f.presentationTimeline.ka(),o=s,u=i.findSegmentPosition(s),h=null!=u?i.getSegmentReference(u):null;h;)o=t.a.c.segment++,qr(t.i,i.type,h,(h.endTime-h.startTime)*n/8,{key:o,data:null,manifestKey:t.h,streamNumber:i.id,segmentNumber:o}),a.push({startTime:h.startTime,endTime:h.endTime,uri:"offline:"+t.h+"/"+i.id+"/"+o}),o=h.endTime+e.startTime,h=i.getSegmentReference(++u);return t.l=Math.max(t.l,o-s),e=null,i.initSegmentReference&&(o=t.a.c.segment++,e="offline:"+t.h+"/"+i.id+"/"+o,qr(t.i,i.contentType,i.initSegmentReference,0,{key:o,data:null,manifestKey:t.h,streamNumber:i.id,segmentNumber:-1})),t=[],null!=r&&t.push(r),{id:i.id,primary:i.primary,presentationTimeOffset:i.presentationTimeOffset||0,contentType:i.type,mimeType:i.mimeType,codecs:i.codecs,frameRate:i.frameRate,kind:i.kind,language:i.language,label:i.label,width:i.width||null,height:i.height||null,initSegmentUri:e,encrypted:i.encrypted,keyId:i.keyId,segments:a,variantIds:t}}function Da(t){if(!t.g)throw new h(2,9,9002)}function La(t){Oo.push(t)}function Ca(t){var e=t.type.replace(/^(webkit|moz|MS)/,"").toLowerCase();if("function"==typeof Event)var i=new Event(e,t);else i=document.createEvent("Event"),i.initEvent(e,t.bubbles,t.cancelable);t.target.dispatchEvent(i)}function Ma(t,e,i){if("input"==t)switch(this.type){case"range":t="change"}Uo.call(this,t,e,i)}function Oa(t){this.f=[],this.b=[],this.a=[],(new ai).ca("pssh",this.c.bind(this)).parse(t.buffer)}function Ua(t,e){try{var i=new ja(t,e);return Promise.resolve(i)}catch(t){return Promise.reject(t)}}function ja(t,e){this.keySystem=t;for(var i=!1,n=0;n<e.length;++n){var r=e[n],a={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:r.initDataTypes,sessionTypes:["temporary"],label:r.label},s=!1;if(r.audioCapabilities)for(var o=0;o<r.audioCapabilities.length;++o){var u=r.audioCapabilities[o];if(u.contentType){s=!0;var h=u.contentType.split(";")[0];MSMediaKeys.isTypeSupported(this.keySystem,h)&&(a.audioCapabilities.push(u),i=!0)}}if(r.videoCapabilities)for(o=0;o<r.videoCapabilities.length;++o)u=r.videoCapabilities[o],u.contentType&&(s=!0,h=u.contentType.split(";")[0],MSMediaKeys.isTypeSupported(this.keySystem,h)&&(a.videoCapabilities.push(u),i=!0));if(s||(i=MSMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),"required"==r.persistentState&&(i=!1),i)return void(this.a=a)}throw r=Error("Unsupported keySystem"),r.name="NotSupportedError",r.code=DOMException.NOT_SUPPORTED_ERR,r}function Ba(t){var e=this.mediaKeys;return e&&e!=t&&Va(e,null),delete this.mediaKeys,(this.mediaKeys=t)?Va(t,this):Promise.resolve()}function Fa(t){this.a=new MSMediaKeys(t),this.b=new B}function Va(t,e){function i(){e.msSetMediaKeys(n.a),e.removeEventListener("loadedmetadata",i)}if(H(t.b),!e)return Promise.resolve();F(t.b,e,"msneedkey",Ka);var n=t;try{return 1<=e.readyState?e.msSetMediaKeys(t.a):e.addEventListener("loadedmetadata",i),Promise.resolve()}catch(t){return Promise.reject(t)}}function Ha(t){Se.call(this),this.c=null,this.g=t,this.b=this.a=null,this.f=new B,this.sessionId="",this.expiration=NaN,this.closed=new y,this.keyStatuses=new Xa}function Ka(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="cenc";var i=t.initData;if(i){var n=new Oa(i);if(1>=n.a.length)t=i;else{var r=[];for(t=0;t<n.a.length;t++)r.push(i.subarray(n.a[t].start,n.a[t].end+1));for(i=M(r,Ga),t=n=0;t<i.length;t++)n+=i[t].length;for(n=new Uint8Array(n),t=r=0;t<i.length;t++)n.set(i[t],r),r+=i[t].length;t=n}}else t=i;e.initData=t,this.dispatchEvent(e)}function Ga(t,e){return lt(t,e)}function qa(t,e){var i=t.keyStatuses;i.size=void 0==e?0:1,i.a=e,t.dispatchEvent(new G("keystatuseschange"))}function Xa(){this.size=0,this.a=void 0}function Ya(){return Promise.reject(Error("The key system specified is not supported."))}function za(t){return t?Promise.reject(Error("MediaKeys not supported.")):Promise.resolve()}function $a(){throw new TypeError("Illegal constructor.")}function Wa(){throw new TypeError("Illegal constructor.")}function Ja(e){Bo=e,Fo=new Uint8Array([0]).buffer,navigator.requestMediaKeySystemAccess=Za,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=ts,t.MediaKeys=is,t.MediaKeySystemAccess=es}function Qa(t){var e=Bo;return e?e+t.charAt(0).toUpperCase()+t.slice(1):t}function Za(t,e){try{var i=new es(t,e);return Promise.resolve(i)}catch(t){return Promise.reject(t)}}function ts(t){var e=this.mediaKeys;return e&&e!=t&&ns(e,null),delete this.mediaKeys,(this.mediaKeys=t)&&ns(t,this),Promise.resolve()}function es(t,e){this.a=this.keySystem=t;var i=!1;"org.w3.clearkey"==t&&(this.a="webkit-org.w3.clearkey",i=!1);for(var n=!1,r=document.getElementsByTagName("video"),a=r.length?r[0]:document.createElement("video"),s=0;s<e.length;++s){r=e[s];var o={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:r.initDataTypes,sessionTypes:["temporary"],label:r.label},u=!1;if(r.audioCapabilities)for(var h=0;h<r.audioCapabilities.length;++h){var c=r.audioCapabilities[h];if(c.contentType){var u=!0,l=c.contentType.split(";")[0];a.canPlayType(l,this.a)&&(o.audioCapabilities.push(c),n=!0)}}if(r.videoCapabilities)for(h=0;h<r.videoCapabilities.length;++h)c=r.videoCapabilities[h],c.contentType&&(u=!0,a.canPlayType(c.contentType,this.a)&&(o.videoCapabilities.push(c),n=!0));if(u||(n=a.canPlayType("video/mp4",this.a)||a.canPlayType("video/webm",this.a)),"required"==r.persistentState&&(i?(o.persistentState="required",o.sessionTypes=["persistent-license"]):n=!1),n)return void(this.b=o)}throw i="Unsupported keySystem","org.w3.clearkey"!=t&&"com.widevine.alpha"!=t||(i="None of the requested configurations were supported."),i=Error(i),i.name="NotSupportedError",i.code=DOMException.NOT_SUPPORTED_ERR,i}function is(t){this.g=t,this.b=null,this.a=new B,this.c=[],this.f={}}function ns(t,e){t.b=e,H(t.a);var i=Bo;e&&(F(t.a,e,i+"needkey",t.Sd.bind(t)),F(t.a,e,i+"keymessage",t.Rd.bind(t)),F(t.a,e,i+"keyadded",t.Pd.bind(t)),F(t.a,e,i+"keyerror",t.Qd.bind(t)))}function rs(t,e){var i=t.f[e];return i||((i=t.c.shift())?(i.sessionId=e,t.f[e]=i):null)}function as(t,e,i){Se.call(this),this.f=t,this.h=!1,this.a=this.b=null,this.c=e,this.g=i,this.sessionId="",this.expiration=NaN,this.closed=new y,this.keyStatuses=new us}function ss(t,e,i){if(t.h)return Promise.reject(Error("The session is already initialized."));t.h=!0;try{if("persistent-license"==t.g)if(i)var n=new Uint8Array(it("LOAD_SESSION|"+i));else{var r=it("PERSISTENT|"),a=new Uint8Array(r.byteLength+e.byteLength);a.set(new Uint8Array(r),0),a.set(new Uint8Array(e),r.byteLength),n=a}else n=new Uint8Array(e)}catch(t){return Promise.reject(t)}t.b=new y;var s=Qa("generateKeyRequest");try{t.f[s](t.c,n)}catch(e){if("InvalidStateError"!=e.name)return t.b=null,Promise.reject(e);setTimeout(function(){try{this.f[s](this.c,n)}catch(t){this.b.reject(t),this.b=null}}.bind(t),10)}return t.b}function os(t,e){var i=t.keyStatuses;i.size=void 0==e?0:1,i.a=e,t.dispatchEvent(new G("keystatuseschange"))}function us(){this.size=0,this.a=void 0}function hs(){var t=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var e=t.apply(this,arguments);return e.abort=function(){},e}}function cs(){var t=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(e,i){return t.call(this,e,i-.001)}}function ls(){var t=MediaSource.prototype.endOfStream;MediaSource.prototype.endOfStream=function(){for(var e,i=0,n=0;n<this.sourceBuffers.length;++n)e=this.sourceBuffers[n],e=e.buffered.end(e.buffered.length-1),i=Math.max(i,e);if(!isNaN(this.duration)&&i<this.duration)for(this.hc=!0,n=0;n<this.sourceBuffers.length;++n)e=this.sourceBuffers[n],e.cc=!1;return t.apply(this,arguments)};var e=!1,i=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var t=i.apply(this,arguments);return t.mediaSource_=this,t.addEventListener("updateend",ds,!1),e||(this.addEventListener("sourceclose",fs,!1),e=!0),t}}function ds(t){var e=t.target,i=e.mediaSource_;if(i.hc){for(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),e.cc=!0,t=0;t<i.sourceBuffers.length;++t)if(0==i.sourceBuffers[t].cc)return;i.hc=!1}}function fs(t){t=t.target;for(var e=0;e<t.sourceBuffers.length;++e)t.sourceBuffers[e].removeEventListener("updateend",ds,!1);t.removeEventListener("sourceclose",fs,!1)}function ps(){var t=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(e){return"mp2t"!=e.split(/ *; */)[0].split("/")[1]&&t(e)}}function ms(){var t=MediaSource.isTypeSupported,e=/^dv(?:he|av)\./;MediaSource.isTypeSupported=function(i){for(var n,r,a=i.split(/ *; */),s=a[0],o={},u=1;u<a.length;++u)n=a[u].split("="),r=n[0],n=n[1].replace(/"(.*)"/,"$1"),o[r]=n;if(!(n=o.codecs))return t(i);var h=!1,c=!1;i=n.split(",").filter(function(t){return e.test(t)?(c=!0,!1):(/^(hev|hvc)1\.2/.test(t)&&(h=!0),!0)}),c&&(h=!1),o.codecs=i.join(","),h&&(o.eotf="smpte2084");for(r in o)n=o[r],s+="; "+r+'="'+n+'"';return cast.__platform__.canDisplayType(s)}}function vs(t){if(this.c=[],this.b=[],this.za=Vo,t)try{t(this.ma.bind(this),this.a.bind(this))}catch(t){this.a(t)}}function gs(t){var e=new vs;return e.ma(void 0),e.then(function(){return t})}function bs(t){var e=new vs;return e.a(t),e}function ys(t){function e(t,e,i){t.za==Vo&&(r[e]=i,++n==r.length&&t.ma(r))}var i=new vs;if(!t.length)return i.ma([]),i;for(var n=0,r=Array(t.length),a=i.a.bind(i),s=0;s<t.length;++s)t[s]&&t[s].then?t[s].then(e.bind(null,i,s),a):e(i,s,t[s]);return i}function Ts(t){for(var e=new vs,i=e.ma.bind(e),n=e.a.bind(e),r=0;r<t.length;++r)t[r]&&t[r].then?t[r].then(i,n):i(t[r]);return e}function ws(t,e,i){Ko.push(function(){if(i&&"function"==typeof i){try{var t=i(this.f)}catch(t){return void e.a(t)}try{var n=t&&t.then}catch(t){return void e.a(t)}t instanceof vs?t==e?e.a(new TypeError("Chaining cycle detected")):t.then(e.ma.bind(e),e.a.bind(e)):n?Es(t,n,e):e.ma(t)}else 1==this.za?e.ma(this.f):e.a(this.f)}.bind(t)),null==Ho&&(Ho=As(Ss))}function Es(t,e,i){try{var n=!1;e.call(t,function(t){if(!n){n=!0;try{var e=t&&t.then}catch(t){return void i.a(t)}e?Es(t,e,i):i.ma(t)}},i.a.bind(i))}catch(t){i.a(t)}}function Ss(){for(;Ko.length;){null!=Ho&&(ks(Ho),Ho=null);var t=Ko;Ko=[];for(var e=0;e<t.length;++e)t[e]()}}function As(){return 0}function ks(){}function Is(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}function Ps(e,i,n){return new t.TextTrackCue(e,i,n)}function _s(e,i,n){return new t.TextTrackCue(e+"-"+i+"-"+n,e,i,n)}function xs(t,e,i){this.startTime=t,this.endTime=e,this.payload=i,this.region={x:0,y:0,width:100,height:100},this.position=null,this.positionAlign=Go,this.size=100,this.textAlign=qo,this.writingDirection=$o,this.lineInterpretation=Qo,this.line=null,this.lineHeight="",this.lineAlign=tu,this.displayAlign=Yo,this.fontSize=this.backgroundColor=this.color="",this.fontWeight=iu,this.fontStyle=nu,this.fontFamily="",this.textDecoration=[],this.wrapLine=!0,this.id=""}function Rs(){}function Ns(t){var e=[];if(!t)return e;for(var i=t.childNodes,n=0;n<i.length;n++){var r="span"==i[n].nodeName&&"p"==t.nodeName;i[n].nodeType!=Node.ELEMENT_NODE||"br"==i[n].nodeName||r||(r=Ns(i[n]),e=e.concat(r))}return e.length||e.push(t),e}function Ds(t,e){for(var i=t.childNodes,n=0;n<i.length;n++)if("br"==i[n].nodeName&&0<n)i[n-1].textContent+="\n";else if(0<i[n].childNodes.length)Ds(i[n],e);else if(e){var r=i[n].textContent.trim(),r=r.replace(/\s+/g," ");i[n].textContent=r}}function Ls(t,e){for(var i=e.split(" "),n=0;n<i.length;n++)switch(i[n]){case"underline":0>t.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;r<n.length;r++){var a=n[r].getAttribute(i);if(a)return a}return(t=Us(t,"style",e))?t.getAttribute(i):null}function Os(t,e,i){return(t=Us(t,"style",e))?t.getAttribute(i):null}function Us(t,e,i){if(!t||1>i.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;t<i.length;t++)if(i[t].getAttribute("xml:id")==e){n=i[t];break}return n}function js(t,e){var i=null;if(au.test(t))var i=au.exec(t),n=Number(i[1]),r=Number(i[2]),a=Number(i[3]),s=Number(i[4]),s=s+(Number(i[5])||0)/e.b,a=a+s/e.frameRate,i=a+60*r+3600*n;else su.test(t)?i=Bs(su,t):ou.test(t)?i=Bs(ou,t):uu.test(t)?(i=uu.exec(t),i=Number(i[1])/e.frameRate):hu.test(t)?(i=hu.exec(t),i=Number(i[1])/e.a):cu.test(t)&&(i=Bs(cu,t));return i}function Bs(t,e){var i=t.exec(e);return i&&""!=i[0]?(Number(i[4])||0)/1e3+(Number(i[3])||0)+60*(Number(i[2])||0)+3600*(Number(i[1])||0):null}function Fs(t,e,i,n){this.frameRate=Number(t)||30,this.b=Number(e)||1,this.a=Number(n),this.a||(this.a=t?this.frameRate*this.b:1),i&&(t=/^(\d+) (\d+)$/g.exec(i))&&(this.frameRate*=t[1]/t[2])}function Vs(){this.a=new Rs}function Hs(){}function Ks(t,e){var i;(i=/^align:(start|middle|center|end|left|right)$/.exec(e))?(i=i[1],t.textAlign="middle"==i?qo:Xo[i.toUpperCase()]):(i=/^vertical:(lr|rl)$/.exec(e))?t.writingDirection="lr"==i[1]?Wo:Jo:(i=/^size:([\d\.]+)%$/.exec(e))?t.size=Number(i[1]):(i=/^position:([\d\.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(e))?(t.position=Number(i[1]),i[2]&&(i=i[2],t.positionAlign="line-left"==i||"start"==i?"line-left":"line-right"==i||"end"==i?"line-right":"center")):(i=/^line:([\d\.]+)%(?:,(start|end|center))?$/.exec(e))?(t.lineInterpretation=Zo,t.line=Number(i[1]),i[2]&&(t.lineAlign=eu[i[2].toUpperCase()])):(i=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(e))&&(t.lineInterpretation=Qo,t.line=Number(i[1]),i[2]&&(t.lineAlign=eu[i[2].toUpperCase()]))}function Gs(t){if(!(t=hn(t,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g)))return null;var e=Number(t[2]),i=Number(t[3]);return 59<e||59<i?null:Number(t[4])/1e3+i+60*e+3600*(Number(t[1])||0)}function qs(){this.a=null}function Xs(t,e,i){var n,r,a;return(new ai).G("payl",ui(function(t){n=Z(t)})).G("iden",ui(function(t){r=Z(t)})).G("sttg",ui(function(t){a=Z(t)})).parse(t),n?Ys(n,r,a,e,i):null}function Ys(t,e,i,n,r){if(t=new xs(n,r,t),e&&(t.id=e),i)for(e=new un(i),i=cn(e);i;)Ks(t,i),hn(e,/[ \t]+/gm),i=cn(e);return t}var zs,$s=this;$s.Pe=!0,s.prototype.getBandwidthEstimate=function(t){return 128e3>this.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;s<n.length;){var o=n[s++];"."==o?r&&s==n.length&&a.push(""):".."==o?((1<a.length||1==a.length&&""!=a[0])&&a.pop(),r&&s==n.length&&a.push("")):(a.push(o),r=!0)}n=a.join("/")}}return i?e.ba=n:i=""!==t.a.toString(),i?f(e,b(t.a)):i=!!t.ta,i&&(e.ta=t.ta),e};var Js=/[#\/\?@]/g,Qs=/[\#\?:]/g,Zs=/[\#\?]/g,to=/[\#\?@]/g,eo=/#/g;g.prototype.a=null,g.prototype.c=null,g.prototype.toString=function(){if(this.b)return this.b;if(!this.a)return"";var t,e=[];for(t in this.a)for(var i=encodeURIComponent(t),n=this.a[t],r=0;r<n.length;r++){var a=i;""!==n[r]&&(a+="="+encodeURIComponent(n[r])),e.push(a)}return this.b=e.join("&")},e("shaka.net.NetworkingEngine",D),D.RequestType={MANIFEST:0,SEGMENT:1,LICENSE:2,APP:3};var io={};D.registerScheme=function(t,e){io[t]=e},D.unregisterScheme=function(t){delete io[t]},D.prototype.ae=function(t){this.b.push(t)},D.prototype.registerRequestFilter=D.prototype.ae,D.prototype.He=function(t){var e=this.b;0<=(t=e.indexOf(t))&&e.splice(t,1)},D.prototype.unregisterRequestFilter=D.prototype.He,D.prototype.Tc=function(){this.b=[]},D.prototype.clearAllRequestFilters=D.prototype.Tc,D.prototype.be=function(t){this.c.push(t)},D.prototype.registerResponseFilter=D.prototype.be,D.prototype.Ie=function(t){var e=this.c;0<=(t=e.indexOf(t))&&e.splice(t,1)},D.prototype.unregisterResponseFilter=D.prototype.Ie,D.prototype.Uc=function(){this.c=[]},D.prototype.clearAllResponseFilters=D.prototype.Uc,D.prototype.o=function(){this.f=!0,this.b=[],this.c=[];for(var t=[],e=0;e<this.a.length;++e)t.push(this.a[e].catch(x));return Promise.all(t)},D.prototype.destroy=D.prototype.o,D.prototype.request=function(t,e,i){var n=i||function(){return!1};if(this.f)return Promise.reject();e.method=e.method||"GET",e.headers=e.headers||{},e.retryParameters=e.retryParameters?I(e.retryParameters):E(),e.uris=I(e.uris);var r=Date.now(),a=Promise.resolve();return this.b.forEach(function(i){a=a.then(i.bind(null,t,e))}),a=a.catch(function(t){throw new h(2,1,1006,t)}),a=a.then(function(){var a=Date.now()-r,s=new T(e.retryParameters,!1,i);return w(s).then(function(){return C(this,t,e,s,0,a,n)}.bind(this))}.bind(this)),this.a.push(a),a.then(function(e){return 0<=this.a.indexOf(a)&&this.a.splice(this.a.indexOf(a),1),this.g&&!e.fromCache&&1==t&&this.g(e.timeMs,e.data.byteLength),e}.bind(this)).catch(function(t){return t&&(t.severity=2),0<=this.a.indexOf(a)&&this.a.splice(this.a.indexOf(a),1),Promise.reject(t)}.bind(this))},D.prototype.request=D.prototype.request,j.prototype.push=function(t,e){this.a.hasOwnProperty(t)?this.a[t].push(e):this.a[t]=[e]},j.prototype.get=function(t){return(t=this.a[t])?t.slice():null},j.prototype.remove=function(t,e){var i=this.a[t];if(i)for(var n=0;n<i.length;++n)i[n]==e&&(i.splice(n,1),--n)},B.prototype.o=function(){return H(this),this.a=null,Promise.resolve()},B.prototype.ha=function(t,e){if(this.a)for(var i=this.a.get(e)||[],n=0;n<i.length;++n){var r=i[n];r.target==t&&(r.ha(),this.a.remove(e,r))}},K.prototype.ha=function(){this.target.removeEventListener(this.type,this.a,!1),this.a=this.target=null},G.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},G.prototype.stopImmediatePropagation=function(){this.a=!0},G.prototype.stopPropagation=function(){};var no=1/15,ro={codecs:"codecs",frameRate:"framerate",bandwidth:"bitrate",width:"width",height:"height",channelsCount:"channels"};e("shaka.util.StringUtils.fromUTF8",Z),e("shaka.util.StringUtils.fromUTF16",tt),e("shaka.util.StringUtils.fromBytesAutoDetect",et),e("shaka.util.StringUtils.toUTF8",it),rt.prototype.cancel=function(){null!=this.a&&(clearTimeout(this.a),this.a=null)},e("shaka.util.Uint8ArrayUtils.toBase64",ot),e("shaka.util.Uint8ArrayUtils.fromBase64",ut),e("shaka.util.Uint8ArrayUtils.fromHex",ht),e("shaka.util.Uint8ArrayUtils.toHex",ct),e("shaka.util.Uint8ArrayUtils.equal",lt),e("shaka.util.Uint8ArrayUtils.concat",function(t){for(var e=0,i=0;i<arguments.length;++i)e+=arguments[i].length;for(var e=new Uint8Array(e),n=0,i=0;i<arguments.length;++i)e.set(arguments[i],n),n+=arguments[i].length;return e}),zs=dt.prototype,zs.o=function(){this.c=!0;var t=[];return this.a.forEach(function(e){e=e.fa.close().catch(x);var i=new Promise(function(t){setTimeout(t,1e3)});t.push(Promise.race([e,i]))}),this.i.reject(),this.f&&t.push(this.f.o()),this.l&&t.push(this.l.setMediaKeys(null).catch(x)),this.B&&(this.B.cancel(),this.B=null),this.D&&(this.D.cancel(),this.D=null),this.f=this.l=this.j=this.w=this.b=null,this.a=[],this.m=[],this.s=this.g=this.h=null,Promise.all(t)},zs.configure=function(t){this.h=t},zs.init=function(t,e){var i={},n=[];return this.ia=e,this.m=t.offlineSessionIds,gt(this,t,e||0<t.offlineSessionIds.length,i,n),n.length?bt(this,i,n):(this.L=!0,Promise.resolve())},zs.keySystem=function(){return this.b?this.b.keySystem:""},zs.mb=function(){var t=this.a.map(function(t){return t=t.fa.expiration,isNaN(t)?1/0:t});return Math.min.apply(Math,t)},zs.vd=function(t){for(var e=new Uint8Array(t.initData),i=0;i<this.a.length;++i)if(lt(e,this.a[i].initData))return;At(this,t.initDataType,e)},zs.uc=function(t){this.h.delayLicenseRequestUntilPlayed&&this.l.paused&&!this.X?this.J.push(t):kt(this,t)},zs.oc=function(t){t=t.target;var e;for(e=0;e<this.a.length&&this.a[e].fa!=t;++e);if(e!=this.a.length){var i=!1;t.keyStatuses.forEach(function(t,n){if("string"==typeof n){var r=n;n=t,t=r}if("com.microsoft.playready"==this.b.keySystem&&16==n.byteLength){var r=new DataView(n),a=r.getUint32(0,!0),s=r.getUint16(4,!0),o=r.getUint16(6,!0);r.setUint32(0,a,!1),r.setUint16(4,s,!1),r.setUint16(6,o,!1)}"com.microsoft.playready"==this.b.keySystem&&"status-pending"==t&&(t="usable"),"status-pending"!=t&&(this.a[e].loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve()),"expired"==t&&(i=!0),r=ct(new Uint8Array(n)),this.C[r]=t}.bind(this));var n=t.expiration-Date.now();(0>n||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.J.length;t++)kt(this,this.J[t]);this.X=!0,this.J=[]},zs.Zd=function(){this.a.forEach(function(t){var e=t.Gb,i=t.fa.expiration;isNaN(i)&&(i=1/0),i!=e&&(this.s.onExpirationUpdated(t.fa.sessionId,i),t.Gb=i)}.bind(this))};var ao={};e("shaka.text.TextEngine.registerParser",Mt),e("shaka.text.TextEngine.unregisterParser",function(t){delete ao[t]}),Ct.prototype.o=function(){return this.c=this.f=null,Promise.resolve()},Ct.prototype.pe=function(t){this.c=t},Ct.prototype.setDisplayer=Ct.prototype.pe,Ct.prototype.remove=function(t,e){return Promise.resolve().then(function(){!this.c||!this.c.remove(t,e)||null==this.a||e<=this.a||t>=this.b||(t<=this.a&&e>=this.b?this.a=this.b=null:t<=this.a&&e<this.b?this.a=e:t>this.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<i.length;++n)i[n].p.catch(x),i[n].p.reject()}return this.a&&e.push(this.a.o()),Promise.all(e).then(function(){this.h.o(),this.j=this.a=this.f=this.g=this.h=null,this.b={},this.c={}}.bind(this))},zs.init=function(t){for(var e in t){var i=t[e],i=Q(i.mimeType,i.codecs);"text"==e?Ft(this,i):(i=this.f.addSourceBuffer(i),F(this.h,i,"error",this.Be.bind(this,e)),F(this.h,i,"updateend",this.Ha.bind(this,e)),this.b[e]=i,this.c[e]=[])}},zs.yb=function(){var t=this.a&&null!=this.a.a?[{start:this.a.a,end:this.a.b}]:[];return{total:Lt(this.g.buffered),audio:Lt(Ht(this,"audio")),video:Lt(Ht(this,"video")),text:t}},zs.remove=function(t,e,i){return"text"==t?this.a.remove(e,i):Xt(this,t,this.Ac.bind(this,t,e,i))},zs.endOfStream=function(t){return Yt(this,function(){t?this.f.endOfStream(t):this.f.endOfStream()}.bind(this))},zs.ga=function(t){return Yt(this,function(){this.f.duration=t}.bind(this))},zs.W=function(){return this.f.duration},zs.Ae=function(t,e){this.b[t].appendBuffer(e)},zs.Ac=function(t,e,i){i<=e?this.Ha(t):this.b[t].remove(e,i)},zs.Pc=function(t){var e=this.b[t].appendWindowStart,i=this.b[t].appendWindowEnd;this.b[t].abort(),this.b[t].appendWindowStart=e,this.b[t].appendWindowEnd=i,this.Ha(t)},zs.Yc=function(t){this.g.currentTime-=.001,this.Ha(t)},zs.re=function(t,e){this.b[t].timestampOffset=e,this.Ha(t)},zs.oe=function(t,e,i){this.b[t].appendWindowStart=0,this.b[t].appendWindowEnd=i,this.b[t].appendWindowStart=e,this.Ha(t)},zs.Be=function(t){this.c[t][0].p.reject(new h(2,3,3014,this.g.error?this.g.error.code:0))},zs.Ha=function(t){var e=this.c[t][0];e&&(e.p.resolve(),zt(this,t))};var so=1,oo=2,uo={aar:"aa",abk:"ab",afr:"af",aka:"ak",alb:"sq",amh:"am",ara:"ar",arg:"an",arm:"hy",asm:"as",ava:"av",ave:"ae",aym:"ay",aze:"az",bak:"ba",bam:"bm",baq:"eu",bel:"be",ben:"bn",bih:"bh",bis:"bi",bod:"bo",bos:"bs",bre:"br",bul:"bg",bur:"my",cat:"ca",ces:"cs",cha:"ch",che:"ce",chi:"zh",chu:"cu",chv:"cv",cor:"kw",cos:"co",cre:"cr",cym:"cy",cze:"cs",dan:"da",deu:"de",div:"dv",dut:"nl",dzo:"dz",ell:"el",eng:"en",epo:"eo",est:"et",eus:"eu",ewe:"ee",fao:"fo",fas:"fa",fij:"fj",fin:"fi",fra:"fr",fre:"fr",fry:"fy",ful:"ff",geo:"ka",ger:"de",gla:"gd",gle:"ga",glg:"gl",glv:"gv",gre:"el",grn:"gn",guj:"gu",hat:"ht",hau:"ha",heb:"he",her:"hz",hin:"hi",hmo:"ho",hrv:"hr",hun:"hu",hye:"hy",ibo:"ig",ice:"is",ido:"io",iii:"ii",iku:"iu",ile:"ie",ina:"ia",ind:"id",ipk:"ik",isl:"is",ita:"it",jav:"jv",jpn:"ja",kal:"kl",kan:"kn",kas:"ks",kat:"ka",kau:"kr",kaz:"kk",khm:"km",kik:"ki",kin:"rw",kir:"ky",kom:"kv",kon:"kg",kor:"ko",kua:"kj",kur:"ku",lao:"lo",lat:"la",lav:"lv",lim:"li",lin:"ln",lit:"lt",ltz:"lb",lub:"lu",lug:"lg",mac:"mk",mah:"mh",mal:"ml",mao:"mi",mar:"mr",may:"ms",mkd:"mk",mlg:"mg",mlt:"mt",mon:"mn",mri:"mi",msa:"ms",mya:"my",nau:"na",nav:"nv",nbl:"nr",nde:"nd",ndo:"ng",nep:"ne",nld:"nl",nno:"nn",nob:"nb",nor:"no",nya:"ny",oci:"oc",oji:"oj",ori:"or",orm:"om",oss:"os",pan:"pa",per:"fa",pli:"pi",pol:"pl",por:"pt",pus:"ps",que:"qu",roh:"rm",ron:"ro",rum:"ro",run:"rn",rus:"ru",sag:"sg",san:"sa",sin:"si",slk:"sk",slo:"sk",slv:"sl",sme:"se",smo:"sm",sna:"sn",snd:"sd",som:"so",sot:"st",spa:"es",sqi:"sq",srd:"sc",srp:"sr",ssw:"ss",sun:"su",swa:"sw",swe:"sv",tah:"ty",tam:"ta",tat:"tt",tel:"te",tgk:"tg",tgl:"tl",tha:"th",tib:"bo",tir:"ti",ton:"to",tsn:"tn",tso:"ts",tuk:"tk",tur:"tr",twi:"tw",uig:"ug",ukr:"uk",urd:"ur",uzb:"uz",ven:"ve",vie:"vi",vol:"vo",wel:"cy",wln:"wa",wol:"wo",xho:"xh",yid:"yi",yor:"yo",zha:"za",zho:"zh",zul:"zu"};e("shaka.abr.SimpleAbrManager",pe),pe.prototype.stop=function(){this.h=null,this.c=!1,this.g=[],this.f=null},pe.prototype.stop=pe.prototype.stop,pe.prototype.init=function(t){this.h=t},pe.prototype.init=pe.prototype.init,pe.prototype.chooseVariant=function(){var t=me(this.a.restrictions,this.g),e=this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate);if(this.g.length&&!t.length)throw new h(2,4,4012);for(var i=t[0]||null,n=0;n<t.length;++n){var r=t[n],a=(t[n+1]||{bandwidth:1/0}).bandwidth/this.a.bandwidthUpgradeTarget;e>=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;i<e.length;++i){t.target=this.bb,t.currentTarget=this.bb;var n=e[i];try{n.handleEvent?n.handleEvent(t):n.call(this,t)}catch(t){}if(t.a)break}return t.defaultPrevented},i(Ae),e("shaka.cast.CastProxy",Ae),Ae.prototype.o=function(t){return t&&this.a&&this.a.lb(),t=[this.i?this.i.o():null,this.b?this.b.o():null,this.a?this.a.o():null],this.a=this.i=this.j=this.h=this.b=this.c=null,Promise.all(t)},Ae.prototype.destroy=Ae.prototype.o,Ae.prototype.nd=function(){return this.h},Ae.prototype.getVideo=Ae.prototype.nd,Ae.prototype.dd=function(){return this.j},Ae.prototype.getPlayer=Ae.prototype.dd,Ae.prototype.Qc=function(){return!!this.a&&(this.a.h&&wo)},Ae.prototype.canCast=Ae.prototype.Qc,Ae.prototype.aa=function(){return!!this.a&&this.a.aa()},Ae.prototype.isCasting=Ae.prototype.aa,Ae.prototype.Nb=function(){return this.a?this.a.Nb():""},Ae.prototype.receiverName=Ae.prototype.Nb,Ae.prototype.cast=function(){var t=this.fc();return this.a.cast(t).then(function(){return this.b.sb()}.bind(this))},Ae.prototype.cast=Ae.prototype.cast,Ae.prototype.Rb=function(t){this.a.Rb(t)},Ae.prototype.setAppData=Ae.prototype.Rb,Ae.prototype.Ee=function(){var t=this.a;if(t.b){var e=t.w();chrome.cast.requestSession(t.Jb.bind(t,e),t.lc.bind(t))}},Ae.prototype.suggestDisconnect=Ae.prototype.Ee,Ae.prototype.lb=function(){this.a.lb()},Ae.prototype.forceDisconnect=Ae.prototype.lb,zs=Ae.prototype,zs.fc=function(){var t={video:{},player:{},playerAfterLoad:{},manifest:this.b.ib,startTime:null};return this.c.pause(),lo.forEach(function(e){t.video[e]=this.c[e]}.bind(this)),this.c.ended||(t.startTime=this.c.currentTime),go.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.player[i]=e}.bind(this)),bo.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.playerAfterLoad[i]=e}.bind(this)),t},zs.ve=function(){this.dispatchEvent(new G("caststatuschanged"))},zs.we=function(){this.f.dispatchEvent(new G(this.h.paused?"pause":"play"))},zs.ye=function(){go.forEach(function(t){var e=t[1];t=this.a.get("player",t[0])(),this.b[e](t)}.bind(this));var t=this.a.get("player","getManifestUri")(),e=this.a.get("video","ended"),i=Promise.resolve(),n=this.c.autoplay,r=null;e||(r=this.a.get("video","currentTime")),t&&(this.c.autoplay=!1,i=this.b.load(t,r),i.catch(function(t){this.b.dispatchEvent(new G("error",{detail:t}))}.bind(this)));var a={};lo.forEach(function(t){a[t]=this.a.get("video",t)}.bind(this)),i.then(function(){lo.forEach(function(t){this.c[t]=a[t]}.bind(this)),bo.forEach(function(t){var e=t[1];t=this.a.get("player",t[0])(),this.b[e](t)}.bind(this)),this.c.autoplay=n,t&&this.c.play()}.bind(this))},zs.Le=function(t){if("addEventListener"==t)return this.f.addEventListener.bind(this.f);if("removeEventListener"==t)return this.f.removeEventListener.bind(this.f);if(this.a.aa()&&!Object.keys(this.a.a.video).length){var e=this.c[t];if("function"!=typeof e)return e}return this.a.aa()?this.a.get("video",t):(e=this.c[t],"function"==typeof e&&(e=e.bind(this.c)),e)},zs.Ne=function(t,e){this.a.aa()?this.a.set("video",t,e):this.c[t]=e},zs.Me=function(t){this.a.aa()||this.f.dispatchEvent(new G(t.type,t))},zs.Xd=function(t){return"addEventListener"==t?this.g.addEventListener.bind(this.g):"removeEventListener"==t?this.g.removeEventListener.bind(this.g):"getMediaElement"==t?function(){return this.h}.bind(this):"getNetworkingEngine"==t?this.b.gc.bind(this.b):this.a.aa()&&!Object.keys(this.a.a.video).length&&0<=mo.indexOf(t)||!this.a.aa()?(t=this.b[t],t.bind(this.b)):this.a.get("player",t)},zs.Yd=function(t){this.a.aa()||this.g.dispatchEvent(t)},zs.xe=function(t,e){this.a.aa()&&("video"==t?this.f.dispatchEvent(e):"player"==t&&this.g.dispatchEvent(e))},i(Ie),e("shaka.cast.CastReceiver",Ie),Ie.prototype.isConnected=function(){return this.i},Ie.prototype.isConnected=Ie.prototype.isConnected,Ie.prototype.qd=function(){return this.f},Ie.prototype.isIdle=Ie.prototype.qd,Ie.prototype.o=function(){var e=this.b?this.b.o():Promise.resolve();return null!=this.h&&t.clearTimeout(this.h),this.l=this.j=this.b=this.a=null,this.i=!1,this.f=!0,this.h=this.g=this.c=null,e.then(function(){cast.receiver.CastReceiverManager.getInstance().stop()})},Ie.prototype.destroy=Ie.prototype.o,zs=Ie.prototype,zs.tc=function(){this.i=!!cast.receiver.CastReceiverManager.getInstance().getSenders().length,_e(this)},zs.wc=function(t,e){this.b&&(this.Kb(),Re(this,{type:"event",targetName:t,event:e},this.c))},zs.Kb=function(){null!=this.h&&t.clearTimeout(this.h),this.h=t.setTimeout(this.Kb.bind(this),500);var e={video:{},player:{}};co.forEach(function(t){e.video[t]=this.a[t]}.bind(this));var i=mo;this.b.R()&&(i=i.concat(vo)),i.forEach(function(t){e.player[t]=this.b[t]()}.bind(this)),(i=cast.receiver.CastReceiverManager.getInstance().getSystemVolume())&&(e.video.volume=i.level,e.video.muted=i.muted),Re(this,{type:"update",update:e},this.c)},zs.Xc=function(){var t=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();t&&Re(this,{type:"update",update:{video:{volume:t.level,muted:t.muted}}},this.c),Re(this,{type:"event",targetName:"video",event:{type:"volumechange"}},this.c)},zs.Ld=function(t){var e=ge(t.data);switch(e.type){case"init":xe(this,e.initState,e.appData),this.Kb();break;case"appData":this.l(e.appData);break;case"set":var i=e.targetName,n=e.property,r=e.value;if("video"==i){if(e=cast.receiver.CastReceiverManager.getInstance(),"volume"==n){e.setSystemVolumeLevel(r);break}if("muted"==n){e.setSystemVolumeMuted(r);break}}this.j[i][n]=r;break;case"call":i=e.targetName,n=e.methodName,r=e.args,i=this.j[i],i[n].apply(i,r);break;case"asyncCall":i=e.targetName,n=e.methodName,r=e.args,e=e.id,t=t.senderId,i=this.j[i],i[n].apply(i,r).then(this.Ec.bind(this,t,e,null),this.Ec.bind(this,t,e))}},zs.xd=function(t){var e=ge(t.data);switch(e.type){case"PLAY":this.a.play(),Ne(this,0);break;case"PAUSE":this.a.pause(),Ne(this,0);break;case"SEEK":t=e.currentTime;var i=e.resumeState;null!=t&&(this.a.currentTime=Number(t)),i&&"PLAYBACK_START"==i?(this.a.play(),Ne(this,0)):i&&"PLAYBACK_PAUSE"==i&&(this.a.pause(),Ne(this,0));break;case"STOP":this.b.sb().then(function(){Ne(this,0)}.bind(this));break;case"GET_STATUS":Ne(this,Number(e.requestId));break;case"VOLUME":i=e.volume,t=i.level;var i=i.muted,n=this.a.volume,r=this.a.muted;null!=t&&(this.a.volume=Number(t)),null!=i&&(this.a.muted=i),n==this.a.volume&&r==this.a.muted||Ne(this,0);break;case"LOAD":i=e.media.contentId,t=e.currentTime;var a=this.m(i);this.a.autoplay=!0,this.b.load(a,t).then(function(){Ne(this,0,{contentId:a,streamType:this.b.R()?"LIVE":"BUFFERED",contentType:""})}.bind(this)).catch(function(t){var i="LOAD_FAILED";7==t.category&&7e3==t.code&&(i="LOAD_CANCELLED"),Re(this,{requestId:Number(e.requestId),type:i},this.g)}.bind(this));break;default:Re(this,{requestId:Number(e.requestId),type:"INVALID_REQUEST",reason:"INVALID_COMMAND"},this.g)}},zs.Ec=function(t,e,i){Re(this,{type:"asyncComplete",id:e,error:i},this.c,t)};var So={IDLE:"IDLE",Nc:"PLAYING",Lc:"BUFFERING",Mc:"PAUSED"},Ao={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"};e("shaka.media.InitSegmentReference",ti),e("shaka.media.SegmentReference",ei),e("shaka.util.DataViewReader",ii);var ko=1;ii.Endianness={Oe:0,Qe:ko},ii.prototype.da=function(){return this.v<this.O.byteLength},ii.prototype.hasMoreData=ii.prototype.da,ii.prototype.fd=function(){return this.v},ii.prototype.getPosition=ii.prototype.fd,ii.prototype.$c=function(){return this.O.byteLength},ii.prototype.getLength=ii.prototype.$c,ii.prototype.Mb=function(){try{var t=this.O.getUint8(this.v)}catch(t){ni()}return this.v+=1,t},ii.prototype.readUint8=ii.prototype.Mb,ii.prototype.yc=function(){try{var t=this.O.getUint16(this.v,this.a)}catch(t){ni()}return this.v+=2,t},ii.prototype.readUint16=ii.prototype.yc,ii.prototype.F=function(){try{var t=this.O.getUint32(this.v,this.a)}catch(t){ni()}return this.v+=4,t},ii.prototype.readUint32=ii.prototype.F,ii.prototype.xc=function(){try{var t=this.O.getInt32(this.v,this.a)}catch(t){ni()}return this.v+=4,t},ii.prototype.readInt32=ii.prototype.xc,ii.prototype.Va=function(){try{if(this.a)var t=this.O.getUint32(this.v,!0),e=this.O.getUint32(this.v+4,!0);else e=this.O.getUint32(this.v,!1),t=this.O.getUint32(this.v+4,!1)}catch(t){ni()}if(2097151<e)throw new h(2,3,3001);return this.v+=8,e*Math.pow(2,32)+t},ii.prototype.readUint64=ii.prototype.Va,ii.prototype.Ja=function(t){this.v+t>this.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<r?e.Ja(r).buffer:new ArrayBuffer(0),r=new ii(new DataView(r),0),a({Ta:this,version:s,ec:o,u:r,size:n,start:i+t})}else e.I(i+n-e.v)},ai.prototype.parseNext=ai.prototype.qb,ai.children=si,ai.sampleDescription=oi,ai.allData=ui,e("shaka.media.SegmentIndex",di),di.prototype.o=function(){return this.a=null,Promise.resolve()},di.prototype.destroy=di.prototype.o,di.prototype.find=function(t){for(var e=this.a.length-1;0<=e;--e){var i=this.a[e];if(t>=i.startTime&&t<i.endTime)return i.position}return this.a.length&&t<this.a[0].startTime?this.a[0].position:null},di.prototype.find=di.prototype.find,di.prototype.get=function(t){return this.a.length?(t-=this.a[0].position,0>t||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;e<this.a.length&&a<t.length;)i=this.a[e],n=t[a],i.startTime<n.startTime?(r.push(i),e++):(i.startTime>n.startTime?e||r.push(n):(.1<Math.abs(i.endTime-n.endTime)?(n=new ei(i.position,n.startTime,n.endTime,n.a,n.T,n.K),r.push(n)):r.push(i),e++),a++);for(;e<this.a.length;)r.push(this.a[e++]);if(r.length)for(e=r[r.length-1].position+1;a<t.length;)n=t[a++],n=new ei(e++,n.startTime,n.endTime,n.a,n.T,n.K),r.push(n);else r=t;this.a=r},di.prototype.merge=di.prototype.ob,di.prototype.xb=function(t){for(var e=0;e<this.a.length&&!(this.a[e].endTime>t);++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;s<n.length;s++){var o=n[s].getAttribute("schemeIdUri");if(null==o||"urn:mpeg:dash:role:2011"==o)switch(o=n[s].getAttribute("value")){case"main":i=!0;break;case"caption":case"subtitle":a=o}}var u=null,c=!1;if(Le(e,"EssentialProperty").forEach(function(t){"http://dashif.org/guidelines/trickmode"==t.getAttribute("schemeIdUri")?u=t.getAttribute("value"):c=!0}),c)return null;var n=Le(e,"ContentProtection"),l=Ke(n,this.b.dash.customScheme,this.b.dash.ignoreDrmInfo),n=Wt(e.getAttribute("lang")||"und"),o=e.getAttribute("label"),s=Le(e,"Representation"),r=s.map(this.Wd.bind(this,t,l,a,n,o,i,r)).filter(function(t){return!!t});if(!r.length)throw new h(2,4,4003);return t.V.contentType&&"application"!=t.V.contentType||(t.V.contentType=Qi(r[0].mimeType,r[0].codecs),r.forEach(function(e){e.type=t.V.contentType})),r.forEach(function(t){l.drmInfos.forEach(function(e){t.keyId&&e.keyIds.push(t.keyId)})}),a=s.map(function(t){return t.getAttribute("id")}).filter(R),{id:t.V.id||"__fake__"+this.h++,contentType:t.V.contentType,language:n,Cb:i,streams:r,drmInfos:l.drmInfos,Wb:u,ee:a}},zs.Wd=function(t,e,i,n,r,a,s,o){if(t.A=Yi(o,t.V,null),!$i(t.A))return null;t.bandwidth=Me(o,"bandwidth",Fe)||0;var u=this.fe.bind(this);if(t.A.Wa)u=Si(t,u);else if(t.A.pa)u=Ii(t,this.j);else if(t.A.Xa)u=Ri(t,u,this.j,!!this.c);else{var h=t.A.$,c=t.S.duration||0;u={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(t){return 0<=t&&t<c?1:null},getSegmentReference:function(t){return 1!=t?null:new ei(1,0,c,function(){return h},0,null)},initSegmentReference:null,Z:0}}return o=Le(o,"ContentProtection"),o=Ge(o,this.b.dash.customScheme,e,this.b.dash.ignoreDrmInfo),{id:this.h++,createSegmentIndex:u.createSegmentIndex,findSegmentPosition:u.findSegmentPosition,getSegmentReference:u.getSegmentReference,initSegmentReference:u.initSegmentReference,presentationTimeOffset:u.Z,mimeType:t.A.mimeType,codecs:t.A.codecs,frameRate:t.A.frameRate,bandwidth:t.bandwidth,width:t.A.width,height:t.A.height,kind:i,encrypted:0<e.drmInfos.length,keyId:o,language:n,label:r,type:t.V.contentType,primary:a,trickModeVideo:null,containsEmsgBoxes:t.A.containsEmsgBoxes,roles:s,channelsCount:t.A.Fb}},zs.ze=function(){this.f=null;var t=Date.now();Bi(this).then(function(){this.a&&Xi(this,(Date.now()-t)/1e3)}.bind(this)).catch(function(t){this.a&&(t.severity=1,this.a.onError(t),Xi(this,0))}.bind(this))},zs.Vd=function(t,e,i){var n=i.getAttribute("schemeIdUri")||"",r=i.getAttribute("value")||"",a=Me(i,"timescale",Ve)||1;Le(i,"Event").forEach(function(i){var s=Me(i,"presentationTime",Ve)||0,o=Me(i,"duration",Ve)||0,s=s/a+t,o=s+o/a;null!=e&&(s=Math.min(s,t+e),o=Math.min(o,t+e)),i={schemeIdUri:n,value:r,startTime:s,endTime:o,id:i.getAttribute("id")||"",eventElement:i},this.a.onTimelineRegionAdded(i)}.bind(this))},zs.fe=function(t,e,i){return t=L(t,this.b.retryParameters),null!=e&&(t.headers.Range="bytes="+e+"-"+(null!=i?i:"")),this.a.networkingEngine.request(1,t).then(function(t){return t.data})},_o.mpd=ji,Po["application/dash+xml"]=ji,tn.prototype.toString=function(){function t(t){return t.name+'="'+t.value+'"'}return this.value?"#"+this.name+":"+this.value:0<this.a.length?"#"+this.name+":"+this.a.map(t).join(","):"#"+this.name},tn.prototype.getAttribute=function(t){var e=this.a.filter(function(e){return e.name==t});return e.length?e[0]:null};var xo="EXT-X-TARGETDURATION EXT-X-MEDIA-SEQUENCE EXT-X-DISCONTINUITY-SEQUENCE EXT-X-PLAYLIST-TYPE EXT-X-MAP EXT-X-I-FRAMES-ONLY EXT-X-ENDLIST".split(" "),Ro="EXTINF EXT-X-BYTERANGE EXT-X-DISCONTINUITY EXT-X-PROGRAM-DATE-TIME EXT-X-KEY EXT-X-DATERANGE".split(" ");e("shaka.net.DataUriPlugin",mn),mn.parse=function(e){var i=e.split(":");if(2>i.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(1<n.length&&(r=n[1]),"base64"==r)e=ut(i).buffer;else{if(r)throw new h(2,1,1005,e);e=it(i)}return{data:e,contentType:n[0]}},io.data=mn,e("shaka.hls.HlsParser",vn),zs=vn.prototype,zs.configure=function(t){this.h=t},zs.start=function(t,e){return this.b=e,this.m=t,Bn(this,t).then(function(e){return bn(this,e.data,t).then(function(){return Fn(this,this.c),this.B}.bind(this))}.bind(this))},zs.stop=function(){return this.h=this.b=null,this.g={},this.C={},this.B=null,Promise.resolve()},zs.update=function(){if(this.f){for(var t=[],e=Object.keys(this.s),i=0;i<e.length;i++){var n=e[i];t.push(gn(this,this.s[n],n))}return Promise.all(t)}},zs.onExpirationUpdated=function(){};var No={audio:[/^vorbis$/,/^opus$/,/^flac$/,/^mp4a/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]},Do={audio:{mp4:"audio/mp4",m4s:"audio/mp4",m4i:"audio/mp4",m4a:"audio/mp4",ts:"video/mp2t"},video:{mp4:"video/mp4",m4s:"video/mp4",m4i:"video/mp4",m4v:"video/mp4",ts:"video/mp2t"},text:{mp4:"application/mp4",m4s:"application/mp4",m4i:"application/mp4",vtt:"text/vtt",ttml:"application/ttml+xml"}};vn.prototype.J=function(){this.b&&(this.i=null,this.update().then(function(){Fn(this,this.c)}.bind(this)).catch(function(t){this.b&&(t.severity=1,this.b.onError(t),Fn(this,0))}.bind(this)))};var Lo={"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(t){if("SAMPLE-AES-CENC"!=Un(t,"METHOD"))return null;var e=Un(t,"URI"),e=mn.parse(e),e=new Uint8Array(e.data),e=X("com.widevine.alpha",[{initDataType:"cenc",initData:e}]);return(t=nn(t,"KEYID"))&&(e.keyIds=[t.substr(2).toLowerCase()]),e}};_o.m3u8=vn,Po["application/x-mpegurl"]=vn,Po["application/vnd.apple.mpegurl"]=vn,zs=Hn.prototype,zs.o=function(){var t=this.b.o();return this.b=null,this.f&&(this.f.cancel(),this.f=null),this.h&&(this.h.cancel(),this.h=null),this.g&&(this.g.cancel(),this.g=null),this.J=this.L=this.l=this.c=this.a=null,t},zs.zb=function(){return this.i},zs.Ib=function(){this.w=!0,this.rc()},zs.Hd=function(){var t=this.j||0>this.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(e<this.c.presentationTimeline.ka())i=zn(this,e),$n(this,e,i);else{t:{if(i&&i.length&&!(1==i.length&&1e-6>i.end(0)-i.start(0))){var n=.1;/(Edge\/|Trident\/|Tizen)/.test(navigator.userAgent)&&(n=.5);for(var r=0;r<i.length;r++)if(i.start(r)>e&&(!r||i.end(r-1)-e<=n)){n=r;break t}}n=null}if(null==n){if(3>this.a.readyState&&0<this.a.playbackRate)if(this.C!=e)this.C=e,this.X=Date.now(),this.B=!1;else if(!this.B&&this.X<Date.now()-1e3)for(n=0;n<i.length;n++)if(e>=i.start(n)&&e<i.end(n)-.5){this.a.currentTime+=.1,this.C=this.a.currentTime,this.B=!0;break}}else if((n||this.w)&&!((r=i.start(n))>=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);.001<Math.abs(e-t)?$n(this,t,e):(this.s=!1,this.L())},zs.qc=function(){var t=this.a.currentTime,e=zn(this,t);.001<Math.abs(e-t)&&$n(this,t,e)},Jn.prototype.o=function(){var t=this.j?this.j.o():Promise.resolve();return this.j=null,tr(this),this.C=this.h=this.l=this.w=this.g=this.B=this.a=null,this.c=[],t},Jn.prototype.s=function(t){if(!this.c.some(function(e){return e.info.schemeIdUri==t.schemeIdUri&&e.info.startTime==t.startTime&&e.info.endTime==t.endTime})){var e={info:t,status:1};this.c.push(e);var i=new G("timelineregionadded",{detail:Qn(t)});this.h(i),this.m(!0,e)}},Jn.prototype.m=function(t,e){var i=e.info.startTime>this.a.currentTime?1:e.info.endTime<this.a.currentTime?3:2,n=2==e.status,r=2==i;i!=e.status&&((!t||n||r)&&(n||this.h(new G("timelineregionenter",{detail:Qn(e.info)})),r||this.h(new G("timelineregionexit",{detail:Qn(e.info)}))),e.status=i)},Jn.prototype.D=function(){this.f=null,Zn(this);var t=de(this.g,this.a.currentTime);t!=this.i&&(-1!=this.i&&this.C(),this.i=t);var t=Dt(this.a.buffered,this.a.currentTime),e=Rt(this.a.buffered),i=this.g.presentationTimeline,n=i.ua(),r="ended"==this.B.readyState,e=i.R()&&e>=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;i<t.length;i++){var n=Qr(t[i]);n&&e.push(n)}e.slice().sort(function(t,i){return t.startTime!=i.startTime?t.startTime-i.startTime:t.endTime!=i.endTime?t.endTime-i.startTime:e.indexOf(i)-e.indexOf(t)}).forEach(function(t){this.a.addCue(t)}.bind(this))},Jr.prototype.append=Jr.prototype.append,Jr.prototype.o=function(){return this.a&&Zr(this,function(){return!0}),this.a=null,Promise.resolve()},Jr.prototype.destroy=Jr.prototype.o,Jr.prototype.isTextVisible=function(){return"showing"==this.a.mode},Jr.prototype.isTextVisible=Jr.prototype.isTextVisible,Jr.prototype.setTextVisibility=function(t){this.a.mode=t?"showing":"hidden"},Jr.prototype.setTextVisibility=Jr.prototype.setTextVisibility,ta.prototype.then=function(t){return this.a=this.a.then(t).then(function(t){return this.b?(this.g(),Promise.reject(this.h)):Promise.resolve(t)}.bind(this)),this},ta.prototype.cancel=function(t){return this.c?Promise.resolve():(this.b=!0,this.h=t,this.i)},i(ia),e("shaka.Player",ia),ia.prototype.o=function(){return this.D=!0,na(this).then(function(){var t=Promise.all([this.Pa,la(this),this.m?this.m.o():null,this.s?this.s.o():null]);return this.f=null,this.jb=!1,this.c=this.s=this.g=this.m=null,t}.bind(this))},ia.prototype.destroy=ia.prototype.o,ia.version="v2.2.8";var Mo={};ia.registerSupportPlugin=function(t,e){Mo[t]=e},ia.isBrowserSupported=function(){return!!(t.Promise&&t.Uint8Array&&Array.prototype.forEach&&t.MediaSource&&MediaSource.isTypeSupported&&t.MediaKeys&&t.navigator&&t.navigator.requestMediaKeySystemAccess&&t.MediaKeySystemAccess&&t.MediaKeySystemAccess.prototype.getConfiguration)},ia.probeSupport=function(){return Pt().then(function(t){t={manifest:Mi(),media:Bt(),drm:t};for(var e in Mo)t[e]=Mo[e]();return t})},ia.prototype.load=function(t,e,i){var n=this.sb(),r=new ta;this.ia=r,this.dispatchEvent(new G("loading"));var a=Date.now();return ea(r.then(function(){return n}).then(function(){return this.j=ma(),F(this.m,this.f,"playing",this.Za.bind(this)),F(this.m,this.f,"pause",this.Za.bind(this)),F(this.m,this.f,"ended",this.Za.bind(this)),this.g=new this.c.abrFactory,oa(this),this.w=new this.c.textDisplayFactory,this.w.setTextVisibility(this.jb),Oi(t,this.s,this.c.manifest.retryParameters,i)}.bind(this)).then(function(e){return this.i=new e,this.i.configure(this.c.manifest),e={networkingEngine:this.s,filterNewPeriod:this.kb.bind(this),filterAllPeriods:this.Tb.bind(this),onTimelineRegionAdded:this.Nd.bind(this),onEvent:this.Ya.bind(this),onError:this.La.bind(this)},2<this.i.start.length?(o("The ManifestParser interface has changed. Please upgrade your plugin to accept the PlayerInterface structure. See the ManifestParser documentation for details."),this.i.start(t,this.s,e.filterNewPeriod,e.onError,e.onEvent)):this.i.start(t,e)}.bind(this)).then(function(e){if(e.periods.some(function(t){return t.variants.some(function(t){return t.video&&t.audio})})&&e.periods.forEach(function(t){t.variants=t.variants.filter(function(t){return t.video&&t.audio})}),0==e.periods.length)throw new h(2,4,4014);return this.b=e,this.ib=t,this.l=new dt({Sa:this.s,onError:this.La.bind(this),Hb:this.zd.bind(this),onExpirationUpdated:this.wd.bind(this),onEvent:this.Ya.bind(this)}),this.l.configure(this.c.drm),this.l.init(e,!1)}.bind(this)).then(function(){this.Tb(this.b.periods),this.cb=Date.now()/1e3,this.Ma=this.c.preferredAudioLanguage,this.$a=this.c.preferredTextLanguage;var t=this.b.presentationTimeline.W(),e=this.c.playRangeEnd,i=this.c.playRangeStart;return 0<i&&(this.R()||this.b.presentationTimeline.Fc(i)),e<t&&(this.R()||this.b.presentationTimeline.ga(e)),Promise.all([ft(this.l,this.f),this.gb])}.bind(this)).then(function(){return this.g.chooseStreams?(o("AbrManager API has changed. The SwitchCallback signature has changed to accept a variant instead of a map. Please update your AbrManager. The old API will be removed in v2.3."),this.g.init(this.Fe.bind(this))):this.g.init(this.Kc.bind(this)),this.h=new Hn(this.f,this.b,this.c.streaming,void 0==e?null:e,this.te.bind(this),this.Ya.bind(this)),this.B=new Jn(this.f,this.L,this.b,this.c.streaming,this.Jc.bind(this),this.Ya.bind(this),this.se.bind(this)),this.J=new jt(this.f,this.L,this.w),this.a=new er(this.b,{Ua:this.h,M:this.J,Sa:this.s,kc:this.td.bind(this),jc:this.Rc.bind(this),onError:this.La.bind(this),onEvent:this.Ya.bind(this),Ad:this.Bd.bind(this),Ib:this.Kd.bind(this),filterNewPeriod:this.kb.bind(this),filterAllPeriods:this.Tb.bind(this)}),this.a.configure(this.c.streaming),this.dispatchEvent(new G("streaming")),ra(this),this.a.init()}.bind(this)).then(function(){if(this.c.streaming.startAtSegmentBoundary){var t=ba(this,qn(this.h));Kn(this.h,t)}this.b.periods.forEach(this.kb.bind(this)),Ea(this),wa(this);var t=ir(this.a),e=se(t,this.Ma,this.ab);this.g.setVariants(e),t.variants.some(function(t){return t.primary}),this.hb.forEach(this.B.s.bind(this.B)),this.hb=[],V(this.m,this.f,"loadeddata",function(){this.j.loadLatency=(Date.now()-a)/1e3}.bind(this)),this.ia=null}.bind(this))).catch(function(t){return this.ia==r&&(this.ia=null,this.dispatchEvent(new G("unloading"))),Promise.reject(t)}.bind(this))},ia.prototype.load=ia.prototype.load,ia.prototype.configure=function(t){if(t.abr&&t.abr.manager){o("AbrManager configuration has changed. Please use abrFactory instead of abr.manager. The old API will be removed in v2.3.");var e=t.abr.manager;delete t.abr.manager,t.abrFactory=function(){return e}}t.streaming&&null!=t.streaming.infiniteRetriesForLiveStreams&&(o("Streaming configuration has changed. Please use streaming.failureCallback instead of streaming.infiniteRetriesForLiveStreams. The old API will be removed in v2.3."),this.Zb=!!t.streaming.infiniteRetriesForLiveStreams,delete t.streaming.infiniteRetriesForLiveStreams),k(this.c,t,pa(this),fa(),""),sa(this)},ia.prototype.configure=ia.prototype.configure,ia.prototype.getConfiguration=function(){var t=pa(this);return k(t,this.c,pa(this),fa(),""),t},ia.prototype.getConfiguration=ia.prototype.getConfiguration,ia.prototype.ge=function(){this.c=pa(this),sa(this)},ia.prototype.resetConfiguration=ia.prototype.ge,ia.prototype.cd=function(){return this.f},ia.prototype.getMediaElement=ia.prototype.cd,ia.prototype.gc=function(){return this.s},ia.prototype.getNetworkingEngine=ia.prototype.gc,ia.prototype.bd=function(){return this.ib},ia.prototype.getManifestUri=ia.prototype.bd,ia.prototype.R=function(){return!!this.b&&this.b.presentationTimeline.R()},ia.prototype.isLive=ia.prototype.R,ia.prototype.va=function(){return!!this.b&&this.b.presentationTimeline.va()},ia.prototype.isInProgress=ia.prototype.va,ia.prototype.od=function(){if(!this.b||!this.b.periods.length)return!1;var t=this.b.periods[0].variants;return!!t.length&&!t[0].video},ia.prototype.isAudioOnly=ia.prototype.od,ia.prototype.ie=function(){var t=0,e=0;return this.b&&(e=this.b.presentationTimeline,t=e.ka(),e=e.nb()),{start:t,end:e}},ia.prototype.seekRange=ia.prototype.ie,ia.prototype.keySystem=function(){return this.l?this.l.keySystem():""},ia.prototype.keySystem=ia.prototype.keySystem,ia.prototype.drmInfo=function(){return this.l?this.l.b:null},ia.prototype.drmInfo=ia.prototype.drmInfo,ia.prototype.mb=function(){return this.l?this.l.mb():1/0},ia.prototype.getExpiration=ia.prototype.mb,ia.prototype.pd=function(){return this.Oa},ia.prototype.isBuffering=ia.prototype.pd,ia.prototype.sb=function(){return this.D?Promise.resolve():(this.dispatchEvent(new G("unloading")),na(this).then(function(){return this.Pa||(this.Pa=da(this).then(function(){this.Pa=null}.bind(this))),this.Pa}.bind(this)))},ia.prototype.unload=ia.prototype.sb,ia.prototype.zb=function(){return this.h?this.h.zb():0},ia.prototype.getPlaybackRate=ia.prototype.zb,ia.prototype.Ge=function(t){this.h&&Yn(this.h,t),this.a&&ar(this.a,1!=t)},ia.prototype.trickPlay=ia.prototype.Ge,ia.prototype.Sc=function(){this.h&&Yn(this.h,1),this.a&&ar(this.a,!1)},ia.prototype.cancelTrickPlay=ia.prototype.Sc,ia.prototype.md=function(){if(!this.b||!this.h)return[];var t=de(this.b,qn(this.h)),e=this.C[t]||{};return ee(this.b.periods[t],e.audio,e.video)},ia.prototype.getVariantTracks=ia.prototype.md,ia.prototype.ld=function(){if(!this.b||!this.h)return[];var t=de(this.b,qn(this.h));return ie(this.b.periods[t],(this.C[t]||{}).text).filter(function(t){return 0>this.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;u<this.b.periods.length;u++)if(this.b.periods[u]==o){if(u==this.b.periods.length-1){if(s=this.b.presentationTimeline.W()-o.startTime,1/0==s)return Promise.reject()}else s=this.b.periods[u+1].startTime-o.startTime;break}var h={id:this.Oc++,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return 1},getSegmentReference:function(e){return 1!=e?null:new ei(1,0,s,function(){return[t]},0,null)},initSegmentReference:null,presentationTimeOffset:0,mimeType:n,codecs:r||"",kind:i,encrypted:!1,keyId:null,language:e,label:a||null,type:"text",primary:!1,trickModeVideo:null,containsEmsgBoxes:!1,roles:[],channelsCount:null};return this.eb.push(h.id),o.textStreams.push(h),cr(this.a,{text:h}).then(function(){if(!this.D){var t=this.b.periods.indexOf(o),n=rr(this.a);return n.text&&(this.C[t].text=n.text.id),this.eb.splice(this.eb.indexOf(h.id),1),Ta(this,o),Ea(this),{id:h.id,active:!1,type:"text",bandwidth:0,language:e,label:a||null,kind:i,width:null,height:null}}}.bind(this))},ia.prototype.addTextTrack=ia.prototype.addTextTrack,ia.prototype.Sb=function(t,e){this.fb.width=t,this.fb.height=e},ia.prototype.setMaxHardwareResolution=ia.prototype.Sb,ia.prototype.Cc=function(){if(this.a){var t=this.a;if(t.f)t=!1;else if(t.l)t=!1;else{for(var e in t.c){var i=t.c[e];i.Qa&&(i.Qa=!1,Ir(t,i,.1))}t=!0}}else t=!1;return t},ia.prototype.retryStreaming=ia.prototype.Cc,ia.prototype.ad=function(){return this.b},ia.prototype.getManifest=ia.prototype.ad,zs=ia.prototype,zs.Vc=function(t){var e=[1001,1002,1003];this.R()&&this.Zb&&0<=e.indexOf(t.code)&&(t.severity=1,this.Cc())},zs.Tb=function(t){var e=this.a?rr(this.a):{};t.forEach(function(t){Zt(this.l,e,t)}.bind(this));var i=0;if(t.forEach(function(t){0<ae(t.variants).length&&i++}.bind(this)),!i)throw new h(2,4,9009);if(i<t.length)throw new h(2,4,4011);t.forEach(function(t){if(Qt(t,this.c.restrictions,this.fb)&&this.a&&ir(this.a)==t&&Ea(this),1>ae(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=0<ae(t.variants).length,Qt(t,this.c.restrictions,this.fb)&&this.a&&ir(this.a)==t&&Ea(this),t=1>ae(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<r.length;s++)if(r[s].length){e=r[s];break}e||(r=a.filter(function(t){return t.primary}),r.length&&(e=r)),e||(e=a,a.map(function(t){return t.language}).filter(N));var o=e.filter(function(t){return t.height&&480>=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;0<r;--r){var a=!1;for(i=r-1;0<=i;--i)if(n[r].type==n[i].type&&n[r].kind==n[i].kind&&n[r].language==n[i].language){a=!0;break}if(a)break}for(a=[],r=0;r<n.length;r++)(e=ne(t,n[r]))?(e.audio&&((i=a.filter(function(t){return t.id==e.audio.id})[0])?i.variantIds.push(e.id):(i=e.video?e.bandwidth/2:e.bandwidth,a.push(Na(this,t,e.audio,i,e.id)))),e.video&&((i=a.filter(function(t){return t.id==e.video.id})[0])?i.variantIds.push(e.id):(i=e.audio?e.bandwidth/2:e.bandwidth,a.push(Na(this,t,e.video,i,e.id))))):a.push(Na(this,t,re(t,n[r]),0));return{startTime:t.startTime,streams:a}},Mo.offline=ka,e("shaka.polyfill.installAll",function(){for(var t=0;t<Oo.length;++t)Oo[t]()});var Oo=[];e("shaka.polyfill.register",La),La(function(){if(t.Document){var e=Element.prototype;e.requestFullscreen=e.requestFullscreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullscreen,e=Document.prototype,e.exitFullscreen=e.exitFullscreen||e.mozCancelFullScreen||e.msExitFullscreen||e.webkitExitFullscreen,"fullscreenElement"in document||(Object.defineProperty(document,"fullscreenElement",{get:function(){return document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement}}),Object.defineProperty(document,"fullscreenEnabled",{get:function(){return document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled}})),document.addEventListener("webkitfullscreenchange",Ca),document.addEventListener("webkitfullscreenerror",Ca),document.addEventListener("mozfullscreenchange",Ca),document.addEventListener("mozfullscreenerror",Ca),document.addEventListener("MSFullscreenChange",Ca),document.addEventListener("MSFullscreenError",Ca)}}),La(function(){var e=navigator.userAgent;e&&0<=e.indexOf("CrKey")&&delete t.indexedDB});var Uo;La(function(){0>navigator.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(!(1<t.version)){var e=ct(t.u.Ja(16)),i=[];if(0<t.version)for(var n=t.u.F(),r=0;r<n;++r){var a=ct(t.u.Ja(16));i.push(a)}n=t.u.F(),t.u.I(n),this.b.push.apply(this.b,i),this.f.push(e),this.a.push({start:t.start,end:t.start+t.size-1})}},ja.prototype.createMediaKeys=function(){var t=new Fa(this.keySystem);return Promise.resolve(t)},ja.prototype.getConfiguration=function(){return this.a},Fa.prototype.createSession=function(t){if("temporary"!=(t||"temporary"))throw new TypeError("Session type "+t+" is unsupported on this platform.");return new Ha(this.a)},Fa.prototype.setServerCertificate=function(){return Promise.resolve(!1)},i(Ha),zs=Ha.prototype,zs.generateRequest=function(t,e){this.a=new y;try{this.c=this.g.createSession("video/mp4",new Uint8Array(e),null),F(this.f,this.c,"mskeymessage",this.Fd.bind(this)),F(this.f,this.c,"mskeyadded",this.Dd.bind(this)),F(this.f,this.c,"mskeyerror",this.Ed.bind(this)),qa(this,"status-pending")}catch(t){this.a.reject(t)}return this.a},zs.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},zs.update=function(t){this.b=new y;try{this.c.update(new Uint8Array(t))}catch(t){this.b.reject(t)}return this.b},zs.close=function(){try{this.c.close(),this.closed.resolve(),H(this.f)}catch(t){this.closed.reject(t)}return this.closed},zs.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},zs.Fd=function(t){this.a&&(this.a.resolve(),this.a=null),this.dispatchEvent(new G("message",{messageType:void 0==this.keyStatuses.a?"licenserequest":"licenserenewal",message:t.message.buffer}))},zs.Dd=function(){this.a?(qa(this,"usable"),this.a.resolve(),this.a=null):this.b&&(qa(this,"usable"),this.b.resolve(),this.b=null)},zs.Ed=function(){var t=Error("EME PatchedMediaKeysMs key error");if(t.errorCode=this.c.error,this.a)this.a.reject(t),this.a=null;else if(this.b)this.b.reject(t),this.b=null;else switch(this.c.error.code){case MSMediaKeyError.MS_MEDIA_KEYERR_OUTPUT:case MSMediaKeyError.MS_MEDIA_KEYERR_HARDWARECHANGE:qa(this,"output-not-allowed");default:qa(this,"internal-error")}};var jo;zs=Xa.prototype,zs.forEach=function(t){this.a&&t(this.a,jo)},zs.get=function(t){if(this.has(t))return this.a},zs.has=function(t){var e=jo;return!(!this.a||!lt(new Uint8Array(t),new Uint8Array(e)))},zs.entries=function(){},zs.keys=function(){},zs.values=function(){},$a.prototype.createSession=function(){},$a.prototype.setServerCertificate=function(){},Wa.prototype.getConfiguration=function(){},Wa.prototype.createMediaKeys=function(){};var Bo="";es.prototype.createMediaKeys=function(){var t=new is(this.a);return Promise.resolve(t)},es.prototype.getConfiguration=function(){return this.b},zs=is.prototype,zs.createSession=function(t){var e=t||"temporary";if("temporary"!=e&&"persistent-license"!=e)throw new TypeError("Session type "+t+" is unsupported on this platform.");return t=this.b||document.createElement("video"),t.src||(t.src="about:blank"),e=new as(t,this.g,e),this.c.push(e),e},zs.setServerCertificate=function(){return Promise.resolve(!1)},zs.Sd=function(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="webm",e.initData=t.initData,this.b.dispatchEvent(e)},zs.Rd=function(t){var e=rs(this,t.sessionId);e&&(t=new G("message",{messageType:void 0==e.keyStatuses.a?"licenserequest":"licenserenewal",message:t.message}),e.b&&(e.b.resolve(),e.b=null),e.dispatchEvent(t))},zs.Pd=function(t){(t=rs(this,t.sessionId))&&(os(t,"usable"),t.a&&t.a.resolve(),t.a=null)},zs.Qd=function(t){var e=rs(this,t.sessionId);if(e){var i=Error("EME v0.1b key error");i.errorCode=t.errorCode,i.errorCode.systemCode=t.systemCode,!t.sessionId&&e.b?(i.method="generateRequest",45==t.systemCode&&(i.message="Unsupported session type."),e.b.reject(i),e.b=null):t.sessionId&&e.a?(i.method="update",e.a.reject(i),e.a=null):(i=t.systemCode,t.errorCode.code==MediaKeyError.MEDIA_KEYERR_OUTPUT?os(e,"output-restricted"):1==i?os(e,"expired"):os(e,"internal-error"))}},i(as),zs=as.prototype,zs.Ub=function(t,e){if(this.a)this.a.then(this.Ub.bind(this,t,e)).catch(this.Ub.bind(this,t,e));else{if(this.a=t,"webkit-org.w3.clearkey"==this.c){var i=Z(e),n=JSON.parse(i);"oct"!=n.keys[0].kty&&(this.a.reject(Error("Response is not a valid JSON Web Key Set.")),this.a=null),i=ut(n.keys[0].k),n=ut(n.keys[0].kid)}else i=new Uint8Array(e),n=null;var r=Qa("addKey");try{this.f[r](this.c,i,n,this.sessionId)}catch(t){this.a.reject(t),this.a=null}}},zs.generateRequest=function(t,e){return ss(this,e,null)},zs.load=function(t){return"persistent-license"==this.g?ss(this,null,t):Promise.reject(Error("Not a persistent session."))},zs.update=function(t){var e=new y;return this.Ub(e,t),e},zs.close=function(){if("persistent-license"!=this.g){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var t=Qa("cancelKeyRequest");try{this.f[t](this.c,this.sessionId)}catch(t){}}return this.closed.resolve(),this.closed},zs.remove=function(){return"persistent-license"!=this.g?Promise.reject(Error("Not a persistent session.")):this.close()};var Fo;zs=us.prototype,zs.forEach=function(t){this.a&&t(this.a,Fo)},zs.get=function(t){if(this.has(t))return this.a},zs.has=function(t){var e=Fo;return!(!this.a||!lt(new Uint8Array(t),new Uint8Array(e)))},zs.entries=function(){},zs.keys=function(){},zs.values=function(){},La(function(){!t.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(HTMLMediaElement.prototype.webkitGenerateKeyRequest?Ja("webkit"):HTMLMediaElement.prototype.generateKeyRequest?Ja(""):t.MSMediaKeys?(jo=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Ba,t.MediaKeys=Fa,t.MediaKeySystemAccess=ja,navigator.requestMediaKeySystemAccess=Ua):(navigator.requestMediaKeySystemAccess=Ya,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=za,t.MediaKeys=$a,t.MediaKeySystemAccess=Wa))}),La(function(){if(t.MediaSource)if(t.cast&&cast.__platform__&&cast.__platform__.canDisplayType)ms();else if(navigator.vendor&&0<=navigator.vendor.indexOf("Apple")){var e=navigator.appVersion;ps(),0<=e.indexOf("Version/8")?t.MediaSource=null:0<=e.indexOf("Version/9")?hs():0<=e.indexOf("Version/10")?(hs(),ls()):0<=e.indexOf("Version/11")&&(hs(),cs())}});var Vo=0;vs.prototype.then=function(t,e){var i=new vs;switch(this.za){case 1:ws(this,i,t);break;case 2:ws(this,i,e);break;case Vo:this.c.push({N:i,wb:t}),this.b.push({N:i,wb:e})}return i},vs.prototype.catch=function(t){return this.then(void 0,t)},vs.prototype.ma=function(t){if(this.za==Vo){for(this.f=t,this.za=1,t=0;t<this.c.length;++t)ws(this,this.c[t].N,this.c[t].wb);this.c=[],this.b=[]}},vs.prototype.a=function(t){if(this.za==Vo){for(this.f=t,this.za=2,t=0;t<this.b.length;++t)ws(this,this.b[t].N,this.b[t].wb);this.c=[],this.b=[]}};var Ho=null,Ko=[];La(function(e){t.setImmediate?(As=function(e){return t.setImmediate(e)},ks=function(e){return t.clearImmediate(e)}):(As=function(e){return t.setTimeout(e,0)},ks=function(e){return t.clearTimeout(e)}),t.Promise&&!e||(t.Promise=vs,t.Promise.resolve=gs,t.Promise.reject=bs,t.Promise.all=ys,t.Promise.race=Ts,t.Promise.prototype.then=vs.prototype.then,t.Promise.prototype.catch=vs.prototype.catch)}),La(function(){if(t.HTMLMediaElement){var e=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){var t=e.apply(this,arguments);return t&&t.catch(function(){}),t}}}),La(function(){if(t.HTMLVideoElement){var e=HTMLVideoElement.prototype;!e.getVideoPlaybackQuality&&"webkitDroppedFrameCount"in e&&(e.getVideoPlaybackQuality=Is)}}),La(function(){if(!t.VTTCue&&t.TextTrackCue){var e=TextTrackCue.length;if(3==e)t.VTTCue=Ps;else if(6==e)t.VTTCue=_s;else{try{var i=!!Ps(1,2,"")}catch(t){i=!1}i&&(t.VTTCue=Ps)}}}),e("shaka.text.Cue",xs);var Go="auto";xs.positionAlign={LEFT:"line-left",RIGHT:"line-right",CENTER:"center",AUTO:Go};var qo="center",Xo={LEFT:"left",RIGHT:"right",CENTER:qo,START:"start",END:"end"};xs.textAlign=Xo;var Yo="before",zo={BEFORE:Yo,CENTER:"center",AFTER:"after"};xs.displayAlign=zo;var $o=0,Wo=2,Jo=3;xs.writingDirection={HORIZONTAL_LEFT_TO_RIGHT:$o,HORIZONTAL_RIGHT_TO_LEFT:1,VERTICAL_LEFT_TO_RIGHT:Wo,VERTICAL_RIGHT_TO_LEFT:Jo};var Qo=0,Zo=1;xs.lineInterpretation={LINE_NUMBER:Qo,PERCENTAGE:Zo};var tu="center",eu={CENTER:tu,START:"start",END:"end"};xs.lineAlign=eu;var iu=400;xs.fontWeight={NORMAL:iu,BOLD:700};var nu="normal",ru={NORMAL:nu,ITALIC:"italic",OBLIQUE:"oblique"};xs.fontStyle=ru,xs.textDecoration={UNDERLINE:"underline",LINE_THROUGH:"lineThrough",OVERLINE:"overline"},Rs.prototype.parseInit=function(){},Rs.prototype.parseMedia=function(t,e){var i=Z(t),n=[],r=new DOMParser,a=null;try{a=r.parseFromString(i,"text/xml")}catch(t){throw new h(2,2,2005)}if(a){var s=a.getElementsByTagName("tt")[0];if(!s)throw new h(2,2,2005);r=s.getAttribute("ttp:frameRate"),a=s.getAttribute("ttp:subFrameRate");var o=s.getAttribute("ttp:frameRateMultiplier"),u=s.getAttribute("ttp:tickRate");if("default"!=(i=s.getAttribute("xml:space")||"default")&&"preserve"!=i)throw new h(2,2,2005);for(i="default"==i,r=new Fs(r,a,o,u),a=Ns(s.getElementsByTagName("styling")[0]),o=Ns(s.getElementsByTagName("layout")[0]),s=Ns(s.getElementsByTagName("body")[0]),u=0;u<s.length;u++){var c=s[u],l=e.periodStart,d=r,f=a,p=o,m=i;if(c.hasAttribute("begin")||c.hasAttribute("end")||!/^\s*$/.test(c.textContent)){Ds(c,m);var m=js(c.getAttribute("begin"),d),v=js(c.getAttribute("end"),d),d=js(c.getAttribute("dur"),d),g=c.textContent;if(null==v&&null!=d&&(v=m+d),null==m||null==v)throw new h(2,2,2001);l=new xs(m+l,v+l,g),m=Us(c,"region",p),p=l,"rtl"==Cs(c,m,f,"tts:direction")&&(p.writingDirection=1),v=Cs(c,m,f,"tts:writingMode"),"tb"==v||"tblr"==v?p.writingDirection=Wo:"tbrl"==v?p.writingDirection=Jo:"rltb"==v||"rl"==v?p.writingDirection=1:v&&(p.writingDirection=$o),(v=Cs(c,m,f,"tts:origin"))&&(v=lu.exec(v))&&(p.region.x=Number(v[1]),p.region.y=Number(v[2])),(v=Cs(c,m,f,"tts:extent"))&&(v=lu.exec(v))&&(p.region.width=Number(v[1]),p.region.height=Number(v[2])),(v=Cs(c,m,f,"tts:textAlign"))&&(p.positionAlign=pu[v],p.lineAlign=fu[v],p.textAlign=Xo[v.toUpperCase()]),(v=Cs(c,m,f,"tts:displayAlign"))&&(p.displayAlign=zo[v.toUpperCase()]),(v=Cs(c,m,f,"tts:color"))&&(p.color=v),(v=Cs(c,m,f,"tts:backgroundColor"))&&(p.backgroundColor=v),(v=Cs(c,m,f,"tts:fontFamily"))&&(p.fontFamily=v),(v=Cs(c,m,f,"tts:fontWeight"))&&"bold"==v&&(p.fontWeight=700),(v=Cs(c,m,f,"tts:wrapOption"))&&"noWrap"==v&&(p.wrapLine=!1),(v=Cs(c,m,f,"tts:lineHeight"))&&v.match(du)&&(p.lineHeight=v),(v=Cs(c,m,f,"tts:fontSize"))&&v.match(du)&&(p.fontSize=v),(v=Cs(c,m,f,"tts:fontStyle"))&&(p.fontStyle=ru[v.toUpperCase()]),(m=Ms(m,f,"tts:textDecoration"))&&Ls(p,m),(c=Os(c,f,"tts:textDecoration"))&&Ls(p,c)}else l=null;l&&n.push(l)}}return n};var au=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,su=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,ou=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,uu=/^(\d*\.?\d*)f$/,hu=/^(\d*\.?\d*)t$/,cu=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,lu=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,du=/^(\d+px|\d+em)$/,fu={left:"start",center:"center",right:"end",start:"start",end:"end"},pu={left:"line-left",center:"center",right:"line-right"};Mt("application/ttml+xml",Rs),Vs.prototype.parseInit=function(t){var e=!1;if((new ai).G("moov",si).G("trak",si).G("mdia",si).G("minf",si).G("stbl",si).ca("stsd",oi).G("stpp",function(){e=!0}).parse(t),!e)throw new h(2,2,2007)},Vs.prototype.parseMedia=function(t,e){var i=!1,n=[];if((new ai).G("mdat",ui(function(t){i=!0,n=n.concat(this.a.parseMedia(t.buffer,e))}.bind(this))).parse(t),!i)throw new h(2,2,2007);return n},Mt('application/mp4; codecs="stpp"',Vs),Mt('application/mp4; codecs="stpp.TTML.im1t"',Vs),Hs.prototype.parseInit=function(){},Hs.prototype.parseMedia=function(t,e){var i=Z(t),i=i.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n"),i=i.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(i[0]))throw new h(2,2,2e3);var n=e.segmentStart;if(0<=i[0].indexOf("X-TIMESTAMP-MAP")){var r=i[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),a=i[0].match(/MPEGTS:(\d+)/m);r&&a&&(n=Gs(new un(r[1])),n=e.periodStart+(Number(a[1])/9e4-n))}for(a=[],r=1;r<i.length;r++){var s=i[r].split("\n"),o=n;if(1==s.length&&!s[0]||/^NOTE($|[ \t])/.test(s[0])||"STYLE"==s[0])var u=null;else{u=null,0>s[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<r;s++){var u={duration:null,Vb:null};256&i&&(u.duration=t.F()),512&i&&t.I(4),1024&i&&t.I(4),2048&i&&(u.Vb=e?t.xc():t.F()),a.push(u)}n=a}).G("vtte",function(){r.push(null)}).G("vttc",ui(function(t){r.push(t.buffer)})).G("mdat",function(t){u=!0,si(t)}).parse(t),!u&&!s&&!o)throw new h(2,2,2008);for(var l=i,d=0;d<n.length;d++){var f=n[d],p=r[d],m=f.duration||c;m&&(f=f.Vb?i+f.Vb:l,l=f+m,p&&a.push(Xs(p,e.periodStart+f/this.a,e.periodStart+l/this.a)))}return a.filter(R)},Mt('application/mp4; codecs="wvtt"',qs)}).call(r,this),void 0!==t&&t.exports?t.exports=r.shaka:void 0!==(n=function(){return r.shaka}.call(e,i,e,t))&&(t.exports=n)}()}])});
//# sourceMappingURL=dash-shaka-playback.min.js.map \ No newline at end of file